From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- vendor/x11iraf/.gdb_history | 31 + vendor/x11iraf/Imakefile | 162 + vendor/x11iraf/Notes-V1.3.html | 1841 ++ vendor/x11iraf/Notes-V1.3.txt | 1472 ++ vendor/x11iraf/Notes-V2.0.txt | 635 + vendor/x11iraf/README | 91 + vendor/x11iraf/README.install | 65 + vendor/x11iraf/Revisions | 1 + vendor/x11iraf/Revisions.v15 | 885 + vendor/x11iraf/Revisions.v20 | 20 + vendor/x11iraf/X11IRAF.tmpl | 200 + vendor/x11iraf/app-defaults/XGterm | 112 + vendor/x11iraf/app-defaults/XTapemon | 168 + vendor/x11iraf/bin | 1 + vendor/x11iraf/bin.linux/ism_wcspix.e | Bin 0 -> 926020 bytes vendor/x11iraf/bin.linux/obmsh | Bin 0 -> 904640 bytes vendor/x11iraf/bin.linux/resize | Bin 0 -> 7668 bytes vendor/x11iraf/bin.linux/vximtool | Bin 0 -> 553048 bytes vendor/x11iraf/bin.linux/xgterm | Bin 0 -> 5397517 bytes vendor/x11iraf/bin.linux/ximtool | Bin 0 -> 6270887 bytes vendor/x11iraf/bin.linux/ximtool-alt | 11658 +++++++++++ vendor/x11iraf/bin.linux/ximtool-old | 10944 ++++++++++ vendor/x11iraf/bin.linux/xtapemon | Bin 0 -> 212844 bytes vendor/x11iraf/bin.macintel/ism_wcspix.e | Bin 0 -> 1512812 bytes vendor/x11iraf/bin.macintel/obmsh | Bin 0 -> 878152 bytes vendor/x11iraf/bin.macintel/resize | Bin 0 -> 17952 bytes vendor/x11iraf/bin.macintel/vximtool | Bin 0 -> 551668 bytes vendor/x11iraf/bin.macintel/xgterm | Bin 0 -> 1017180 bytes vendor/x11iraf/bin.macintel/ximtool | Bin 0 -> 4779232 bytes vendor/x11iraf/bin.macintel/ximtool-alt | 11658 +++++++++++ vendor/x11iraf/bin.macintel/ximtool-old | 10944 ++++++++++ vendor/x11iraf/bin.macintel/xtapemon | Bin 0 -> 209212 bytes vendor/x11iraf/cdl/.alias | 3 + vendor/x11iraf/cdl/Imakefile | 92 + vendor/x11iraf/cdl/Imakefile.standalone | 97 + vendor/x11iraf/cdl/Makefile.generic | 205 + vendor/x11iraf/cdl/Notes | 171 + vendor/x11iraf/cdl/README | 36 + vendor/x11iraf/cdl/Revisions | 361 + vendor/x11iraf/cdl/TODO | 34 + vendor/x11iraf/cdl/cdl.c | 1934 ++ vendor/x11iraf/cdl/cdl.h | 336 + vendor/x11iraf/cdl/cdlP.h | 177 + vendor/x11iraf/cdl/cdlProto.h | 106 + vendor/x11iraf/cdl/cdl_f77.c | 1793 ++ vendor/x11iraf/cdl/cdl_f77.h | 250 + vendor/x11iraf/cdl/cdl_spp.c | 1754 ++ vendor/x11iraf/cdl/cdl_spp.h | 253 + vendor/x11iraf/cdl/cdlfits.c | 804 + vendor/x11iraf/cdl/cdlfont.h | 790 + vendor/x11iraf/cdl/cdlftn.inc | 79 + vendor/x11iraf/cdl/cdliraf.c | 848 + vendor/x11iraf/cdl/cdlmark.c | 3861 ++++ vendor/x11iraf/cdl/cdlspp.h | 131 + vendor/x11iraf/cdl/cdlzscale.c | 688 + vendor/x11iraf/cdl/comm.c | 789 + vendor/x11iraf/cdl/configure | 49 + vendor/x11iraf/cdl/doc/RELEASE-1.6.NOTES | 168 + vendor/x11iraf/cdl/doc/cdlref.ms | 2637 +++ vendor/x11iraf/cdl/doc/cdlref.ms-V1.0 | 2297 +++ vendor/x11iraf/cdl/doc/cdlref.ms-V1.6 | 2512 +++ vendor/x11iraf/cdl/doc/cdlref.ps | 19799 +++++++++++++++++++ vendor/x11iraf/cdl/doc/greek.ps | 2521 +++ vendor/x11iraf/cdl/doc/vximtool.man | 276 + vendor/x11iraf/cdl/doc/vximtool.ps | 2472 +++ vendor/x11iraf/cdl/eps.c | 2187 ++ vendor/x11iraf/cdl/eps.h | 109 + vendor/x11iraf/cdl/examples/Imakefile | 36 + vendor/x11iraf/cdl/examples/Imakefile.standalone | 54 + vendor/x11iraf/cdl/examples/Makefile.generic | 102 + vendor/x11iraf/cdl/examples/README | 25 + vendor/x11iraf/cdl/examples/animate.c | 153 + vendor/x11iraf/cdl/examples/coords | 42 + vendor/x11iraf/cdl/examples/display.c | 257 + vendor/x11iraf/cdl/examples/dpix.fits | Bin 0 -> 532800 bytes vendor/x11iraf/cdl/examples/fdisplay.f | 65 + vendor/x11iraf/cdl/examples/ftvmark.f | 301 + vendor/x11iraf/cdl/examples/mosaic.c | 219 + vendor/x11iraf/cdl/examples/tvmark.c | 397 + vendor/x11iraf/cdl/imd.c | 2095 ++ vendor/x11iraf/cdl/mkpkg | 45 + vendor/x11iraf/cdl/test/Imakefile | 22 + vendor/x11iraf/cdl/test/Imakefile.standalone | 39 + vendor/x11iraf/cdl/test/Makefile.generic | 76 + vendor/x11iraf/cdl/test/cdltest.c | 635 + vendor/x11iraf/cdl/test/coords | 42 + vendor/x11iraf/cdl/test/imdtest.c | 336 + vendor/x11iraf/cdl/test/zzdebug.x | 44 + vendor/x11iraf/cdl/vximtool.c | 2130 ++ vendor/x11iraf/doc/cdlref.ps | 19799 +++++++++++++++++++ vendor/x11iraf/doc/obmsh.ps | 552 + vendor/x11iraf/doc/vximtool.ps | 2472 +++ vendor/x11iraf/doc/xgterm.ps | 7083 +++++++ vendor/x11iraf/doc/ximtool.ps | 16410 +++++++++++++++ vendor/x11iraf/doc/xtapemon.ps | 361 + vendor/x11iraf/guidemo/Notes | 41 + vendor/x11iraf/guidemo/README | 6 + vendor/x11iraf/guidemo/frame.gui | 70 + vendor/x11iraf/guidemo/gtest.gui | 182 + vendor/x11iraf/guidemo/guidemo.cl | 8 + vendor/x11iraf/guidemo/hello.gui | 23 + vendor/x11iraf/guidemo/hello.par | 5 + vendor/x11iraf/guidemo/hello.x | 39 + vendor/x11iraf/guidemo/help.gui | 301 + vendor/x11iraf/guidemo/html.gui | 113 + vendor/x11iraf/guidemo/imbrowse.gui | 373 + vendor/x11iraf/guidemo/imbrowse.par | 10 + vendor/x11iraf/guidemo/imbrowse.x | 563 + vendor/x11iraf/guidemo/larrow2.xbm | 6 + vendor/x11iraf/guidemo/login.cl | 99 + vendor/x11iraf/guidemo/loginuser.cl | 6 + vendor/x11iraf/guidemo/ltree.gui | 33 + vendor/x11iraf/guidemo/marker.gui | 314 + vendor/x11iraf/guidemo/mkpkg | 30 + vendor/x11iraf/guidemo/panel.gui | 94 + vendor/x11iraf/guidemo/panel2.gui | 820 + vendor/x11iraf/guidemo/rarrow2.xbm | 6 + vendor/x11iraf/guidemo/region.gui | 197 + vendor/x11iraf/guidemo/table.gui | 1958 ++ vendor/x11iraf/guidemo/table.gui.bak | 1682 ++ vendor/x11iraf/guidemo/tabs.gui | 103 + vendor/x11iraf/guidemo/x_guidemo.x | 4 + vendor/x11iraf/guidemo/ximtool.html | 674 + vendor/x11iraf/guidemo/zscale.x | 437 + vendor/x11iraf/include/cdl.h | 336 + vendor/x11iraf/include/cdlftn.inc | 79 + vendor/x11iraf/include/cdlspp.h | 131 + vendor/x11iraf/install | 675 + vendor/x11iraf/lib | 1 + vendor/x11iraf/lib.linux/libcdl.a | Bin 0 -> 182432 bytes vendor/x11iraf/lib.macintel/libcdl.a | Bin 0 -> 370748 bytes vendor/x11iraf/man/obmsh.1 | 71 + vendor/x11iraf/man/resize.1 | 72 + vendor/x11iraf/man/vximtool.1 | 178 + vendor/x11iraf/man/xgterm.1 | 981 + vendor/x11iraf/man/ximtool.1 | 2338 +++ vendor/x11iraf/man/xtapemon.1 | 135 + vendor/x11iraf/mkarch | 182 + vendor/x11iraf/obm/Imakefile | 91 + vendor/x11iraf/obm/OBM.revs | 350 + vendor/x11iraf/obm/Obm.c | 1039 + vendor/x11iraf/obm/Obm.h | 45 + vendor/x11iraf/obm/ObmP.h | 508 + vendor/x11iraf/obm/ObmW/Arrow.c | 465 + vendor/x11iraf/obm/ObmW/Arrow.h | 70 + vendor/x11iraf/obm/ObmW/Arrow.man | 680 + vendor/x11iraf/obm/ObmW/ArrowP.h | 51 + vendor/x11iraf/obm/ObmW/Board.c | 393 + vendor/x11iraf/obm/ObmW/Board.h | 120 + vendor/x11iraf/obm/ObmW/Board.man | 749 + vendor/x11iraf/obm/ObmW/BoardP.h | 56 + vendor/x11iraf/obm/ObmW/Button.c | 123 + vendor/x11iraf/obm/ObmW/Button.h | 20 + vendor/x11iraf/obm/ObmW/Button.man | 264 + vendor/x11iraf/obm/ObmW/ButtonP.h | 41 + vendor/x11iraf/obm/ObmW/CHANGES | 32 + vendor/x11iraf/obm/ObmW/Common.c | 770 + vendor/x11iraf/obm/ObmW/Common.c.ORIG | 852 + vendor/x11iraf/obm/ObmW/Common.h | 108 + vendor/x11iraf/obm/ObmW/Common.man | 1226 ++ vendor/x11iraf/obm/ObmW/CommonP.h | 108 + vendor/x11iraf/obm/ObmW/Container.c | 346 + vendor/x11iraf/obm/ObmW/Container.h | 61 + vendor/x11iraf/obm/ObmW/ContainerP.h | 71 + vendor/x11iraf/obm/ObmW/Converters.h | 42 + vendor/x11iraf/obm/ObmW/DrawIString.c | 45 + vendor/x11iraf/obm/ObmW/DrawString.c | 45 + vendor/x11iraf/obm/ObmW/DrawingArea.c | 193 + vendor/x11iraf/obm/ObmW/DrawingArea.h | 35 + vendor/x11iraf/obm/ObmW/DrawingAreaP.h | 45 + vendor/x11iraf/obm/ObmW/FIXFWF | 6 + vendor/x11iraf/obm/ObmW/FWFSED | 17 + vendor/x11iraf/obm/ObmW/Frame.c | 654 + vendor/x11iraf/obm/ObmW/Frame.h | 142 + vendor/x11iraf/obm/ObmW/Frame.man | 1062 + vendor/x11iraf/obm/ObmW/FrameP.h | 48 + vendor/x11iraf/obm/ObmW/Gcs.c | 580 + vendor/x11iraf/obm/ObmW/Gcs.h | 121 + vendor/x11iraf/obm/ObmW/Group.c | 383 + vendor/x11iraf/obm/ObmW/Group.h | 74 + vendor/x11iraf/obm/ObmW/Group.man | 723 + vendor/x11iraf/obm/ObmW/GroupP.h | 48 + vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c | 13283 +++++++++++++ vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c.ORIG | 11897 +++++++++++ vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.h | 306 + vendor/x11iraf/obm/ObmW/Gterm.092408/GtermP.h | 587 + vendor/x11iraf/obm/ObmW/Gterm.c | 1944 ++ vendor/x11iraf/obm/ObmW/Gterm.c.ORIG | 11897 +++++++++++ vendor/x11iraf/obm/ObmW/Gterm.h | 306 + vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c | 12188 ++++++++++++ vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c.ORIG | 11897 +++++++++++ vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.h | 247 + vendor/x11iraf/obm/ObmW/Gterm1.5/GtermP.h | 524 + vendor/x11iraf/obm/ObmW/GtermCmap.c | 765 + vendor/x11iraf/obm/ObmW/GtermCnv.c | 486 + vendor/x11iraf/obm/ObmW/GtermDebug.c | 23 + vendor/x11iraf/obm/ObmW/GtermGraphics.c | 1474 ++ vendor/x11iraf/obm/ObmW/GtermImaging.c | 3164 +++ vendor/x11iraf/obm/ObmW/GtermMapping.c | 2189 ++ vendor/x11iraf/obm/ObmW/GtermMarker.c | 4674 +++++ vendor/x11iraf/obm/ObmW/GtermP.h | 598 + vendor/x11iraf/obm/ObmW/GtermUtil.c | 52 + vendor/x11iraf/obm/ObmW/HTML-PSformat.c | 1544 ++ vendor/x11iraf/obm/ObmW/HTML.c | 6177 ++++++ vendor/x11iraf/obm/ObmW/HTML.h | 491 + vendor/x11iraf/obm/ObmW/HTML.notes | 72 + vendor/x11iraf/obm/ObmW/HTMLP.h | 246 + vendor/x11iraf/obm/ObmW/HTMLamp.h | 141 + vendor/x11iraf/obm/ObmW/HTMLformat.c | 6285 ++++++ vendor/x11iraf/obm/ObmW/HTMLimages.c | 891 + vendor/x11iraf/obm/ObmW/HTMLjot.c | 642 + vendor/x11iraf/obm/ObmW/HTMLlists.c | 897 + vendor/x11iraf/obm/ObmW/HTMLparse.c | 1373 ++ vendor/x11iraf/obm/ObmW/HTMLwidgets.c | 4014 ++++ vendor/x11iraf/obm/ObmW/Icon.c | 224 + vendor/x11iraf/obm/ObmW/Icon.h | 31 + vendor/x11iraf/obm/ObmW/Icon.man | 392 + vendor/x11iraf/obm/ObmW/IconP.h | 41 + vendor/x11iraf/obm/ObmW/Imakefile | 241 + vendor/x11iraf/obm/ObmW/Label.c | 345 + vendor/x11iraf/obm/ObmW/Label.h | 130 + vendor/x11iraf/obm/ObmW/Label.man | 732 + vendor/x11iraf/obm/ObmW/LabelP.h | 89 + vendor/x11iraf/obm/ObmW/Layout.c | 965 + vendor/x11iraf/obm/ObmW/Layout.c.ORIG | 952 + vendor/x11iraf/obm/ObmW/Layout.ex | 463 + vendor/x11iraf/obm/ObmW/Layout.h | 94 + vendor/x11iraf/obm/ObmW/Layout.ps.gz.mip | Bin 0 -> 17910 bytes vendor/x11iraf/obm/ObmW/LayoutP.h | 213 + vendor/x11iraf/obm/ObmW/ListTree.c | 2265 +++ vendor/x11iraf/obm/ObmW/ListTree.h | 123 + vendor/x11iraf/obm/ObmW/ListTreeP.h | 109 + vendor/x11iraf/obm/ObmW/Makefile | 1192 ++ vendor/x11iraf/obm/ObmW/MenuBar.c | 183 + vendor/x11iraf/obm/ObmW/MenuBar.h | 15 + vendor/x11iraf/obm/ObmW/MenuBar.man | 365 + vendor/x11iraf/obm/ObmW/MenuBarP.h | 47 + vendor/x11iraf/obm/ObmW/MultiList.c | 1793 ++ vendor/x11iraf/obm/ObmW/MultiList.h | 279 + vendor/x11iraf/obm/ObmW/MultiList.man | 207 + vendor/x11iraf/obm/ObmW/MultiListP.h | 200 + vendor/x11iraf/obm/ObmW/Notes | 191 + vendor/x11iraf/obm/ObmW/README | 83 + vendor/x11iraf/obm/ObmW/RadioGrp.c | 239 + vendor/x11iraf/obm/ObmW/RadioGrp.h | 22 + vendor/x11iraf/obm/ObmW/RadioGrp.man | 384 + vendor/x11iraf/obm/ObmW/RadioGrpP.h | 43 + vendor/x11iraf/obm/ObmW/RowCol.c | 346 + vendor/x11iraf/obm/ObmW/RowCol.h | 60 + vendor/x11iraf/obm/ObmW/RowCol.man | 482 + vendor/x11iraf/obm/ObmW/RowColP.h | 51 + vendor/x11iraf/obm/ObmW/Scrollbar.c | 427 + vendor/x11iraf/obm/ObmW/Scrollbar.h | 105 + vendor/x11iraf/obm/ObmW/Scrollbar.man | 812 + vendor/x11iraf/obm/ObmW/ScrollbarP.h | 58 + vendor/x11iraf/obm/ObmW/Separator.c | 357 + vendor/x11iraf/obm/ObmW/Separator.h | 98 + vendor/x11iraf/obm/ObmW/SeparatorP.h | 62 + vendor/x11iraf/obm/ObmW/Simple.c | 489 + vendor/x11iraf/obm/ObmW/SimpleMenu.c | 1467 ++ vendor/x11iraf/obm/ObmW/Slider2.c | 640 + vendor/x11iraf/obm/ObmW/Slider2.h | 96 + vendor/x11iraf/obm/ObmW/Slider2.man | 1068 + vendor/x11iraf/obm/ObmW/Slider2P.h | 87 + vendor/x11iraf/obm/ObmW/TabString.h | 26 + vendor/x11iraf/obm/ObmW/Table.c | 4594 +++++ vendor/x11iraf/obm/ObmW/Table.h | 539 + vendor/x11iraf/obm/ObmW/Table3d.c | 924 + vendor/x11iraf/obm/ObmW/Table3d.h | 145 + vendor/x11iraf/obm/ObmW/TableP.h | 166 + vendor/x11iraf/obm/ObmW/TableUtil.c | 919 + vendor/x11iraf/obm/ObmW/TableUtil.h | 94 + vendor/x11iraf/obm/ObmW/Tablist2Tabs.c | 35 + vendor/x11iraf/obm/ObmW/Tabs.c | 2183 ++ vendor/x11iraf/obm/ObmW/Tabs.h | 186 + vendor/x11iraf/obm/ObmW/TabsP.h | 127 + vendor/x11iraf/obm/ObmW/TextWidth.c | 39 + vendor/x11iraf/obm/ObmW/Toggle.c | 290 + vendor/x11iraf/obm/ObmW/Toggle.h | 60 + vendor/x11iraf/obm/ObmW/Toggle.man | 538 + vendor/x11iraf/obm/ObmW/ToggleP.h | 50 + vendor/x11iraf/obm/ObmW/Xraw/3d.h | 145 + vendor/x11iraf/obm/ObmW/Xraw/AllWidgets.h | 33 + vendor/x11iraf/obm/ObmW/Xraw/Arrow.h | 144 + vendor/x11iraf/obm/ObmW/Xraw/ArrowP.h | 45 + vendor/x11iraf/obm/ObmW/Xraw/AsciiSink.h | 87 + vendor/x11iraf/obm/ObmW/Xraw/AsciiSinkP.h | 93 + vendor/x11iraf/obm/ObmW/Xraw/AsciiSrc.h | 190 + vendor/x11iraf/obm/ObmW/Xraw/AsciiSrcP.h | 133 + vendor/x11iraf/obm/ObmW/Xraw/AsciiText.h | 110 + vendor/x11iraf/obm/ObmW/Xraw/AsciiTextP.h | 138 + vendor/x11iraf/obm/ObmW/Xraw/Box.h | 74 + vendor/x11iraf/obm/ObmW/Xraw/BoxP.h | 90 + vendor/x11iraf/obm/ObmW/Xraw/Cardinals.h | 35 + vendor/x11iraf/obm/ObmW/Xraw/Clock.h | 87 + vendor/x11iraf/obm/ObmW/Xraw/ClockP.h | 95 + vendor/x11iraf/obm/ObmW/Xraw/Command.h | 104 + vendor/x11iraf/obm/ObmW/Xraw/CommandP.h | 121 + vendor/x11iraf/obm/ObmW/Xraw/Container.h | 61 + vendor/x11iraf/obm/ObmW/Xraw/ContainerP.h | 71 + vendor/x11iraf/obm/ObmW/Xraw/Dialog.h | 82 + vendor/x11iraf/obm/ObmW/Xraw/DialogP.h | 76 + vendor/x11iraf/obm/ObmW/Xraw/Form.h | 142 + vendor/x11iraf/obm/ObmW/Xraw/FormP.h | 126 + vendor/x11iraf/obm/ObmW/Xraw/Frame.h | 163 + vendor/x11iraf/obm/ObmW/Xraw/FrameP.h | 95 + vendor/x11iraf/obm/ObmW/Xraw/Grip.h | 83 + vendor/x11iraf/obm/ObmW/Xraw/GripP.h | 79 + vendor/x11iraf/obm/ObmW/Xraw/Label.h | 98 + vendor/x11iraf/obm/ObmW/Xraw/LabelP.h | 111 + vendor/x11iraf/obm/ObmW/Xraw/List.h | 225 + vendor/x11iraf/obm/ObmW/Xraw/ListP.h | 115 + vendor/x11iraf/obm/ObmW/Xraw/Logo.h | 50 + vendor/x11iraf/obm/ObmW/Xraw/LogoP.h | 51 + vendor/x11iraf/obm/ObmW/Xraw/Mailbox.h | 61 + vendor/x11iraf/obm/ObmW/Xraw/MailboxP.h | 80 + vendor/x11iraf/obm/ObmW/Xraw/MenuButtoP.h | 96 + vendor/x11iraf/obm/ObmW/Xraw/MenuButton.h | 86 + vendor/x11iraf/obm/ObmW/Xraw/Object.h | 37 + vendor/x11iraf/obm/ObmW/Xraw/Paned.h | 229 + vendor/x11iraf/obm/ObmW/Xraw/PanedP.h | 172 + vendor/x11iraf/obm/ObmW/Xraw/Panner.h | 104 + vendor/x11iraf/obm/ObmW/Xraw/PannerP.h | 100 + vendor/x11iraf/obm/ObmW/Xraw/Porthole.h | 60 + vendor/x11iraf/obm/ObmW/Xraw/PortholeP.h | 63 + vendor/x11iraf/obm/ObmW/Xraw/Repeater.h | 73 + vendor/x11iraf/obm/ObmW/Xraw/RepeaterP.h | 76 + vendor/x11iraf/obm/ObmW/Xraw/Reports.h | 51 + vendor/x11iraf/obm/ObmW/Xraw/Scrollbar.h | 221 + vendor/x11iraf/obm/ObmW/Xraw/ScrollbarP.h | 99 + vendor/x11iraf/obm/ObmW/Xraw/ScrolledTable.h | 104 + vendor/x11iraf/obm/ObmW/Xraw/ScrolledTableP.h | 64 + vendor/x11iraf/obm/ObmW/Xraw/Separator.h | 99 + vendor/x11iraf/obm/ObmW/Xraw/SeparatorP.h | 60 + vendor/x11iraf/obm/ObmW/Xraw/Simple.h | 96 + vendor/x11iraf/obm/ObmW/Xraw/SimpleMenP.h | 113 + vendor/x11iraf/obm/ObmW/Xraw/SimpleMenu.h | 169 + vendor/x11iraf/obm/ObmW/Xraw/SimpleP.h | 62 + vendor/x11iraf/obm/ObmW/Xraw/Sme.h | 66 + vendor/x11iraf/obm/ObmW/Xraw/SmeBSB.h | 109 + vendor/x11iraf/obm/ObmW/Xraw/SmeBSBP.h | 121 + vendor/x11iraf/obm/ObmW/Xraw/SmeLine.h | 75 + vendor/x11iraf/obm/ObmW/Xraw/SmeLineP.h | 93 + vendor/x11iraf/obm/ObmW/Xraw/SmeP.h | 102 + vendor/x11iraf/obm/ObmW/Xraw/StripCharP.h | 83 + vendor/x11iraf/obm/ObmW/Xraw/StripChart.h | 94 + vendor/x11iraf/obm/ObmW/Xraw/Table.h | 539 + vendor/x11iraf/obm/ObmW/Xraw/Table3d.h | 145 + vendor/x11iraf/obm/ObmW/Xraw/TableP.h | 166 + vendor/x11iraf/obm/ObmW/Xraw/TableUtil.h | 94 + vendor/x11iraf/obm/ObmW/Xraw/Template.h | 65 + vendor/x11iraf/obm/ObmW/Xraw/TemplateP.h | 57 + vendor/x11iraf/obm/ObmW/Xraw/Text.h | 314 + vendor/x11iraf/obm/ObmW/Xraw/TextP.h | 224 + vendor/x11iraf/obm/ObmW/Xraw/TextSink.h | 239 + vendor/x11iraf/obm/ObmW/Xraw/TextSinkP.h | 121 + vendor/x11iraf/obm/ObmW/Xraw/TextSrc.h | 224 + vendor/x11iraf/obm/ObmW/Xraw/TextSrcP.h | 106 + vendor/x11iraf/obm/ObmW/Xraw/Toggle.h | 170 + vendor/x11iraf/obm/ObmW/Xraw/ToggleP.h | 108 + vendor/x11iraf/obm/ObmW/Xraw/Tree.h | 120 + vendor/x11iraf/obm/ObmW/Xraw/TreeP.h | 112 + vendor/x11iraf/obm/ObmW/Xraw/Viewport.h | 153 + vendor/x11iraf/obm/ObmW/Xraw/ViewportP.h | 92 + vendor/x11iraf/obm/ObmW/Xraw/XawAll.h | 48 + vendor/x11iraf/obm/ObmW/Xraw/XawInit.h | 60 + vendor/x11iraf/obm/ObmW/Xraw/Xosdefs.h | 95 + vendor/x11iraf/obm/ObmW/Xraw/XrawInit.h | 60 + vendor/x11iraf/obm/ObmW/Xraw/color.h | 73 + vendor/x11iraf/obm/ObmW/Xraw/xraw_table.h | 94 + vendor/x11iraf/obm/ObmW/_c | 90 + vendor/x11iraf/obm/ObmW/bitmaps/AnchoredImage.xbm | 8 + vendor/x11iraf/obm/ObmW/bitmaps/DelayedImage.xbm | 16 + vendor/x11iraf/obm/ObmW/bitmaps/ERROR.pm | 41 + vendor/x11iraf/obm/ObmW/bitmaps/FATAL.pm | 48 + vendor/x11iraf/obm/ObmW/bitmaps/INFO.pm | 42 + vendor/x11iraf/obm/ObmW/bitmaps/NONE.pm | 36 + vendor/x11iraf/obm/ObmW/bitmaps/NoImage.xbm | 46 + vendor/x11iraf/obm/ObmW/bitmaps/QUESTION.pm | 38 + vendor/x11iraf/obm/ObmW/bitmaps/WARNING.pm | 39 + vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm | 26 + vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm.ORIG | 26 + vendor/x11iraf/obm/ObmW/bitmaps/diamond0m.pm | 26 + vendor/x11iraf/obm/ObmW/bitmaps/diamond0s.pm | 26 + vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm | 27 + vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm.ORIG | 27 + vendor/x11iraf/obm/ObmW/bitmaps/diamond1m.pm | 27 + vendor/x11iraf/obm/ObmW/bitmaps/diamond1s.pm | 27 + vendor/x11iraf/obm/ObmW/bitmaps/square0.pm | 24 + vendor/x11iraf/obm/ObmW/bitmaps/square0m.pm | 24 + vendor/x11iraf/obm/ObmW/bitmaps/square0s.pm | 24 + vendor/x11iraf/obm/ObmW/bitmaps/square1.pm | 24 + vendor/x11iraf/obm/ObmW/bitmaps/square1m.pm | 25 + vendor/x11iraf/obm/ObmW/bitmaps/square1s.pm | 25 + vendor/x11iraf/obm/ObmW/color.c | 309 + vendor/x11iraf/obm/ObmW/cvtLong.c | 34 + vendor/x11iraf/obm/ObmW/done.h | 16 + vendor/x11iraf/obm/ObmW/iconutil.c | 297 + vendor/x11iraf/obm/ObmW/iconutil.c.ORIG | 279 + vendor/x11iraf/obm/ObmW/inkstore.h | 1844 ++ vendor/x11iraf/obm/ObmW/laygram.y | 263 + vendor/x11iraf/obm/ObmW/laylex.l | 126 + vendor/x11iraf/obm/ObmW/laylex.l.ORIG | 96 + vendor/x11iraf/obm/ObmW/scroll.c | 46 + vendor/x11iraf/obm/ObmW/scroll.h | 96 + vendor/x11iraf/obm/ObmW/stip4.bm | 4 + vendor/x11iraf/obm/ObmW/strnchr.c | 17 + vendor/x11iraf/obm/ObmW/zz/Separator.c | 357 + vendor/x11iraf/obm/ObmW/zz/Separator.h | 99 + vendor/x11iraf/obm/ObmW/zz/SeparatorP.h | 60 + vendor/x11iraf/obm/ObmW/zz/Simple.c | 489 + vendor/x11iraf/obm/ObmW/zz/Simple.h | 96 + vendor/x11iraf/obm/ObmW/zz/SimpleMenP.h | 113 + vendor/x11iraf/obm/ObmW/zz/SimpleMenu.c | 1467 ++ vendor/x11iraf/obm/ObmW/zz/SimpleMenu.h | 169 + vendor/x11iraf/obm/ObmW/zz/SimpleP.h | 62 + vendor/x11iraf/obm/ObmW/zz/Table.c | 4529 +++++ vendor/x11iraf/obm/ObmW/zz/Table.h | 539 + vendor/x11iraf/obm/ObmW/zz/Table3d.c | 924 + vendor/x11iraf/obm/ObmW/zz/Table3d.h | 145 + vendor/x11iraf/obm/ObmW/zz/TableP.h | 166 + vendor/x11iraf/obm/ObmW/zz/TableUtil.c | 918 + vendor/x11iraf/obm/ObmW/zz/TableUtil.h | 94 + vendor/x11iraf/obm/ObmW/zz/XrawInit.h | 60 + vendor/x11iraf/obm/README | 9 + vendor/x11iraf/obm/Tcl/Imakefile | 224 + vendor/x11iraf/obm/Tcl/Imakefile.ORIG | 163 + vendor/x11iraf/obm/Tcl/Makefile | 1136 ++ vendor/x11iraf/obm/Tcl/README | 346 + vendor/x11iraf/obm/Tcl/README.OBM | 17 + vendor/x11iraf/obm/Tcl/changes | 958 + vendor/x11iraf/obm/Tcl/compat/README | 6 + vendor/x11iraf/obm/Tcl/compat/dirent.h | 37 + vendor/x11iraf/obm/Tcl/compat/dirent2.h | 73 + vendor/x11iraf/obm/Tcl/compat/float.h | 30 + vendor/x11iraf/obm/Tcl/compat/getcwd.c | 63 + vendor/x11iraf/obm/Tcl/compat/limits.h | 34 + vendor/x11iraf/obm/Tcl/compat/opendir.c | 106 + vendor/x11iraf/obm/Tcl/compat/stdlib.h | 59 + vendor/x11iraf/obm/Tcl/compat/strerror.c | 484 + vendor/x11iraf/obm/Tcl/compat/string.h | 78 + vendor/x11iraf/obm/Tcl/compat/strstr.c | 84 + vendor/x11iraf/obm/Tcl/compat/strtod.c | 273 + vendor/x11iraf/obm/Tcl/compat/strtol.c | 99 + vendor/x11iraf/obm/Tcl/compat/strtoul.c | 199 + vendor/x11iraf/obm/Tcl/compat/tmpnam.c | 41 + vendor/x11iraf/obm/Tcl/compat/unistd.h | 83 + vendor/x11iraf/obm/Tcl/compat/waitpid.c | 186 + vendor/x11iraf/obm/Tcl/config.status | 64 + vendor/x11iraf/obm/Tcl/configure | 1015 + vendor/x11iraf/obm/Tcl/configure.in | 182 + vendor/x11iraf/obm/Tcl/configure.info | 81 + vendor/x11iraf/obm/Tcl/doc/AddErrInfo.3 | 143 + vendor/x11iraf/obm/Tcl/doc/AppInit.3 | 68 + vendor/x11iraf/obm/Tcl/doc/Async.3 | 172 + vendor/x11iraf/obm/Tcl/doc/Backslash.3 | 58 + vendor/x11iraf/obm/Tcl/doc/CallDel.3 | 82 + vendor/x11iraf/obm/Tcl/doc/CmdCmplt.3 | 49 + vendor/x11iraf/obm/Tcl/doc/Concat.3 | 64 + vendor/x11iraf/obm/Tcl/doc/CrtCommand.3 | 172 + vendor/x11iraf/obm/Tcl/doc/CrtInterp.3 | 61 + vendor/x11iraf/obm/Tcl/doc/CrtMathFnc.3 | 114 + vendor/x11iraf/obm/Tcl/doc/CrtPipelin.3 | 114 + vendor/x11iraf/obm/Tcl/doc/CrtTrace.3 | 125 + vendor/x11iraf/obm/Tcl/doc/DString.3 | 141 + vendor/x11iraf/obm/Tcl/doc/DetachPids.3 | 79 + vendor/x11iraf/obm/Tcl/doc/EnterFile.3 | 98 + vendor/x11iraf/obm/Tcl/doc/Eval.3 | 119 + vendor/x11iraf/obm/Tcl/doc/ExprLong.3 | 119 + vendor/x11iraf/obm/Tcl/doc/GetInt.3 | 94 + vendor/x11iraf/obm/Tcl/doc/Hash.3 | 222 + vendor/x11iraf/obm/Tcl/doc/Interp.3 | 132 + vendor/x11iraf/obm/Tcl/doc/LinkVar.3 | 113 + vendor/x11iraf/obm/Tcl/doc/PrintDbl.3 | 58 + vendor/x11iraf/obm/Tcl/doc/RecordEval.3 | 60 + vendor/x11iraf/obm/Tcl/doc/RegExp.3 | 57 + vendor/x11iraf/obm/Tcl/doc/SetRecLmt.3 | 60 + vendor/x11iraf/obm/Tcl/doc/SetResult.3 | 162 + vendor/x11iraf/obm/Tcl/doc/SetVar.3 | 166 + vendor/x11iraf/obm/Tcl/doc/SplitList.3 | 164 + vendor/x11iraf/obm/Tcl/doc/StrMatch.3 | 52 + vendor/x11iraf/obm/Tcl/doc/Tcl.n | 205 + vendor/x11iraf/obm/Tcl/doc/TildeSubst.3 | 85 + vendor/x11iraf/obm/Tcl/doc/TraceVar.3 | 361 + vendor/x11iraf/obm/Tcl/doc/append.n | 45 + vendor/x11iraf/obm/Tcl/doc/array.n | 95 + vendor/x11iraf/obm/Tcl/doc/break.n | 41 + vendor/x11iraf/obm/Tcl/doc/case.n | 72 + vendor/x11iraf/obm/Tcl/doc/catch.n | 50 + vendor/x11iraf/obm/Tcl/doc/cd.n | 43 + vendor/x11iraf/obm/Tcl/doc/close.n | 46 + vendor/x11iraf/obm/Tcl/doc/concat.n | 57 + vendor/x11iraf/obm/Tcl/doc/continue.n | 43 + vendor/x11iraf/obm/Tcl/doc/eof.n | 43 + vendor/x11iraf/obm/Tcl/doc/error.n | 71 + vendor/x11iraf/obm/Tcl/doc/eval.n | 43 + vendor/x11iraf/obm/Tcl/doc/exec.n | 198 + vendor/x11iraf/obm/Tcl/doc/exit.n | 41 + vendor/x11iraf/obm/Tcl/doc/expr.n | 302 + vendor/x11iraf/obm/Tcl/doc/file.n | 146 + vendor/x11iraf/obm/Tcl/doc/flush.n | 43 + vendor/x11iraf/obm/Tcl/doc/for.n | 57 + vendor/x11iraf/obm/Tcl/doc/foreach.n | 47 + vendor/x11iraf/obm/Tcl/doc/format.n | 233 + vendor/x11iraf/obm/Tcl/doc/gets.n | 61 + vendor/x11iraf/obm/Tcl/doc/glob.n | 92 + vendor/x11iraf/obm/Tcl/doc/global.n | 43 + vendor/x11iraf/obm/Tcl/doc/history.n | 181 + vendor/x11iraf/obm/Tcl/doc/if.n | 58 + vendor/x11iraf/obm/Tcl/doc/incr.n | 44 + vendor/x11iraf/obm/Tcl/doc/info.n | 162 + vendor/x11iraf/obm/Tcl/doc/join.n | 42 + vendor/x11iraf/obm/Tcl/doc/lappend.n | 48 + vendor/x11iraf/obm/Tcl/doc/library.n | 239 + vendor/x11iraf/obm/Tcl/doc/lindex.n | 46 + vendor/x11iraf/obm/Tcl/doc/linsert.n | 45 + vendor/x11iraf/obm/Tcl/doc/list.n | 62 + vendor/x11iraf/obm/Tcl/doc/llength.n | 39 + vendor/x11iraf/obm/Tcl/doc/lrange.n | 51 + vendor/x11iraf/obm/Tcl/doc/lreplace.n | 55 + vendor/x11iraf/obm/Tcl/doc/lsearch.n | 60 + vendor/x11iraf/obm/Tcl/doc/lsort.n | 72 + vendor/x11iraf/obm/Tcl/doc/man.macros | 182 + vendor/x11iraf/obm/Tcl/doc/open.n | 138 + vendor/x11iraf/obm/Tcl/doc/pid.n | 47 + vendor/x11iraf/obm/Tcl/doc/proc.n | 80 + vendor/x11iraf/obm/Tcl/doc/puts.n | 50 + vendor/x11iraf/obm/Tcl/doc/pwd.n | 38 + vendor/x11iraf/obm/Tcl/doc/read.n | 54 + vendor/x11iraf/obm/Tcl/doc/regexp.n | 160 + vendor/x11iraf/obm/Tcl/doc/regsub.n | 88 + vendor/x11iraf/obm/Tcl/doc/rename.n | 41 + vendor/x11iraf/obm/Tcl/doc/return.n | 104 + vendor/x11iraf/obm/Tcl/doc/scan.n | 149 + vendor/x11iraf/obm/Tcl/doc/seek.n | 64 + vendor/x11iraf/obm/Tcl/doc/set.n | 51 + vendor/x11iraf/obm/Tcl/doc/source.n | 47 + vendor/x11iraf/obm/Tcl/doc/split.n | 57 + vendor/x11iraf/obm/Tcl/doc/string.n | 131 + vendor/x11iraf/obm/Tcl/doc/switch.n | 122 + vendor/x11iraf/obm/Tcl/doc/tclsh.1 | 103 + vendor/x11iraf/obm/Tcl/doc/tclvars.n | 156 + vendor/x11iraf/obm/Tcl/doc/tell.n | 43 + vendor/x11iraf/obm/Tcl/doc/time.n | 46 + vendor/x11iraf/obm/Tcl/doc/trace.n | 175 + vendor/x11iraf/obm/Tcl/doc/unknown.n | 55 + vendor/x11iraf/obm/Tcl/doc/unset.n | 47 + vendor/x11iraf/obm/Tcl/doc/uplevel.n | 79 + vendor/x11iraf/obm/Tcl/doc/upvar.n | 83 + vendor/x11iraf/obm/Tcl/doc/while.n | 50 + vendor/x11iraf/obm/Tcl/library/init.tcl | 259 + vendor/x11iraf/obm/Tcl/library/parray.tcl | 43 + vendor/x11iraf/obm/Tcl/library/tclIndex | 14 + vendor/x11iraf/obm/Tcl/panic.c | 69 + vendor/x11iraf/obm/Tcl/patchlevel.h | 11 + vendor/x11iraf/obm/Tcl/porting.notes | 214 + vendor/x11iraf/obm/Tcl/regexp.c | 1233 ++ vendor/x11iraf/obm/Tcl/tcl.h | 649 + vendor/x11iraf/obm/Tcl/tclAppInit.c | 95 + vendor/x11iraf/obm/Tcl/tclAsync.c | 256 + vendor/x11iraf/obm/Tcl/tclBasic.c | 1381 ++ vendor/x11iraf/obm/Tcl/tclCkalloc.c | 607 + vendor/x11iraf/obm/Tcl/tclCmdAH.c | 952 + vendor/x11iraf/obm/Tcl/tclCmdIL.c | 1403 ++ vendor/x11iraf/obm/Tcl/tclCmdMZ.c | 1730 ++ vendor/x11iraf/obm/Tcl/tclEnv.c | 531 + vendor/x11iraf/obm/Tcl/tclExpr.c | 2011 ++ vendor/x11iraf/obm/Tcl/tclGet.c | 210 + vendor/x11iraf/obm/Tcl/tclGlob.c | 455 + vendor/x11iraf/obm/Tcl/tclHash.c | 937 + vendor/x11iraf/obm/Tcl/tclHistory.c | 1109 ++ vendor/x11iraf/obm/Tcl/tclInt.h | 947 + vendor/x11iraf/obm/Tcl/tclLink.c | 361 + vendor/x11iraf/obm/Tcl/tclMain.c | 296 + vendor/x11iraf/obm/Tcl/tclMtherr.c | 89 + vendor/x11iraf/obm/Tcl/tclParse.c | 1284 ++ vendor/x11iraf/obm/Tcl/tclProc.c | 625 + vendor/x11iraf/obm/Tcl/tclRegexp.h | 30 + vendor/x11iraf/obm/Tcl/tclTest.c | 786 + vendor/x11iraf/obm/Tcl/tclUnix.h | 285 + vendor/x11iraf/obm/Tcl/tclUnixAZ.c | 1998 ++ vendor/x11iraf/obm/Tcl/tclUnixStr.c | 737 + vendor/x11iraf/obm/Tcl/tclUnixStr.c.OLD | 735 + vendor/x11iraf/obm/Tcl/tclUnixUtil.c | 1393 ++ vendor/x11iraf/obm/Tcl/tclUtil.c | 1998 ++ vendor/x11iraf/obm/Tcl/tclVar.c | 2363 +++ vendor/x11iraf/obm/Tcl/tests/README | 93 + vendor/x11iraf/obm/Tcl/tests/all | 10 + vendor/x11iraf/obm/Tcl/tests/append.test | 122 + vendor/x11iraf/obm/Tcl/tests/async.test | 145 + vendor/x11iraf/obm/Tcl/tests/case.test | 126 + vendor/x11iraf/obm/Tcl/tests/cd.test | 121 + vendor/x11iraf/obm/Tcl/tests/cmdinfo.test | 79 + vendor/x11iraf/obm/Tcl/tests/concat.test | 53 + vendor/x11iraf/obm/Tcl/tests/dcall.test | 54 + vendor/x11iraf/obm/Tcl/tests/defs | 94 + vendor/x11iraf/obm/Tcl/tests/dstring.test | 192 + vendor/x11iraf/obm/Tcl/tests/env.test | 122 + vendor/x11iraf/obm/Tcl/tests/error.test | 185 + vendor/x11iraf/obm/Tcl/tests/eval.test | 69 + vendor/x11iraf/obm/Tcl/tests/exec.test | 435 + vendor/x11iraf/obm/Tcl/tests/expr.test | 822 + vendor/x11iraf/obm/Tcl/tests/file.test | 326 + vendor/x11iraf/obm/Tcl/tests/for.test | 169 + vendor/x11iraf/obm/Tcl/tests/format.test | 379 + vendor/x11iraf/obm/Tcl/tests/glob.test | 153 + vendor/x11iraf/obm/Tcl/tests/history.test | 400 + vendor/x11iraf/obm/Tcl/tests/if.test | 162 + vendor/x11iraf/obm/Tcl/tests/incr.test | 86 + vendor/x11iraf/obm/Tcl/tests/info.test | 524 + vendor/x11iraf/obm/Tcl/tests/join.test | 52 + vendor/x11iraf/obm/Tcl/tests/lindex.test | 73 + vendor/x11iraf/obm/Tcl/tests/link.test | 148 + vendor/x11iraf/obm/Tcl/tests/linsert.test | 91 + vendor/x11iraf/obm/Tcl/tests/list.test | 87 + vendor/x11iraf/obm/Tcl/tests/llength.test | 49 + vendor/x11iraf/obm/Tcl/tests/lrange.test | 79 + vendor/x11iraf/obm/Tcl/tests/lreplace.test | 106 + vendor/x11iraf/obm/Tcl/tests/lsearch.test | 81 + vendor/x11iraf/obm/Tcl/tests/lsort.test | 136 + vendor/x11iraf/obm/Tcl/tests/misc.test | 84 + vendor/x11iraf/obm/Tcl/tests/open.test | 662 + vendor/x11iraf/obm/Tcl/tests/parse.test | 429 + vendor/x11iraf/obm/Tcl/tests/pid.test | 58 + vendor/x11iraf/obm/Tcl/tests/proc.test | 450 + vendor/x11iraf/obm/Tcl/tests/regexp.test | 324 + vendor/x11iraf/obm/Tcl/tests/rename.test | 78 + vendor/x11iraf/obm/Tcl/tests/scan.test | 276 + vendor/x11iraf/obm/Tcl/tests/set.test | 584 + vendor/x11iraf/obm/Tcl/tests/source.test | 95 + vendor/x11iraf/obm/Tcl/tests/split.test | 58 + vendor/x11iraf/obm/Tcl/tests/string.test | 333 + vendor/x11iraf/obm/Tcl/tests/switch.test | 184 + vendor/x11iraf/obm/Tcl/tests/trace.test | 914 + vendor/x11iraf/obm/Tcl/tests/unknown.test | 73 + vendor/x11iraf/obm/Tcl/tests/uplevel.test | 123 + vendor/x11iraf/obm/Tcl/tests/upvar.test | 303 + vendor/x11iraf/obm/Tcl/tests/while.test | 113 + vendor/x11iraf/obm/client.c | 253 + vendor/x11iraf/obm/docs/gui.doc/TclQuickRef.html | 208 + vendor/x11iraf/obm/docs/gui.doc/alphabetic.html | 39 + vendor/x11iraf/obm/docs/gui.doc/athena.gif | Bin 0 -> 1018 bytes vendor/x11iraf/obm/docs/gui.doc/athena.html | 73 + vendor/x11iraf/obm/docs/gui.doc/blueline.gif | Bin 0 -> 75 bytes vendor/x11iraf/obm/docs/gui.doc/book.p1.ps.gz | Bin 0 -> 201061 bytes vendor/x11iraf/obm/docs/gui.doc/clientclass.html | 75 + vendor/x11iraf/obm/docs/gui.doc/coloredline.gif | Bin 0 -> 5979 bytes vendor/x11iraf/obm/docs/gui.doc/einstein.html | 5 + vendor/x11iraf/obm/docs/gui.doc/example.html | 6 + vendor/x11iraf/obm/docs/gui.doc/exampmap | 30 + vendor/x11iraf/obm/docs/gui.doc/gmc.html | 402 + vendor/x11iraf/obm/docs/gui.doc/gterm.gif | Bin 0 -> 1689 bytes vendor/x11iraf/obm/docs/gui.doc/gtermclass.html | 694 + vendor/x11iraf/obm/docs/gui.doc/gui.html | 93 + vendor/x11iraf/obm/docs/gui.doc/guiintro.html | 9 + vendor/x11iraf/obm/docs/gui.doc/imbrowse.gif | Bin 0 -> 4642 bytes .../obm/docs/gui.doc/imbrowsemap/controlForm.html | 3 + .../obm/docs/gui.doc/imbrowsemap/dirName.html | 3 + .../obm/docs/gui.doc/imbrowsemap/dirSelect.html | 3 + .../obm/docs/gui.doc/imbrowsemap/headerText.html | 3 + .../obm/docs/gui.doc/imbrowsemap/imageButton.html | 3 + .../x11iraf/obm/docs/gui.doc/imbrowsemap/none.html | 3 + .../obm/docs/gui.doc/imbrowsemap/objView.html | 3 + .../obm/docs/gui.doc/imbrowsemap/panel.html | 3 + .../obm/docs/gui.doc/imbrowsemap/sectionBox.html | 3 + .../obm/docs/gui.doc/imbrowsemap/statusBox.html | 3 + vendor/x11iraf/obm/docs/gui.doc/imtool.gif | Bin 0 -> 13848 bytes vendor/x11iraf/obm/docs/gui.doc/intro.gif | Bin 0 -> 228 bytes vendor/x11iraf/obm/docs/gui.doc/irafgui.gif | Bin 0 -> 1102 bytes vendor/x11iraf/obm/docs/gui.doc/llama.gif | Bin 0 -> 21774 bytes vendor/x11iraf/obm/docs/gui.doc/marker.gif | Bin 0 -> 1297 bytes vendor/x11iraf/obm/docs/gui.doc/newgui.html | 18 + vendor/x11iraf/obm/docs/gui.doc/notyet.html | 5 + vendor/x11iraf/obm/docs/gui.doc/notyet2.html | 5 + vendor/x11iraf/obm/docs/gui.doc/otherwidgets.html | 10 + vendor/x11iraf/obm/docs/gui.doc/params.gif | Bin 0 -> 420 bytes vendor/x11iraf/obm/docs/gui.doc/redline.gif | Bin 0 -> 75 bytes vendor/x11iraf/obm/docs/gui.doc/serverclass.html | 38 + vendor/x11iraf/obm/docs/gui.doc/servercom.html | 375 + vendor/x11iraf/obm/docs/gui.doc/softgui.gif | Bin 0 -> 381 bytes vendor/x11iraf/obm/docs/gui.doc/tcl.gif | Bin 0 -> 186 bytes vendor/x11iraf/obm/docs/gui.doc/tcl.html | 7 + .../x11iraf/obm/docs/gui.doc/uiparameterclass.html | 107 + vendor/x11iraf/obm/docs/gui.doc/widgetclass.html | 450 + vendor/x11iraf/obm/docs/gui.doc/widgets.gif | Bin 0 -> 378 bytes vendor/x11iraf/obm/docs/gui.doc/widgets.html | 14 + vendor/x11iraf/obm/docs/gui.doc/ximclient.html | 194 + vendor/x11iraf/obm/docs/obm/Client.html | 75 + vendor/x11iraf/obm/docs/obm/Gterm.html | 694 + vendor/x11iraf/obm/docs/obm/Marker.html | 402 + vendor/x11iraf/obm/docs/obm/Parameter.html | 107 + vendor/x11iraf/obm/docs/obm/Server.html | 38 + vendor/x11iraf/obm/docs/obm/Widget.html | 450 + vendor/x11iraf/obm/docs/obm/alphabetic.html | 39 + vendor/x11iraf/obm/docs/obm/index.html | 2515 +++ vendor/x11iraf/obm/docs/obm/obm.html | 2515 +++ vendor/x11iraf/obm/docs/obm/servercom.html | 375 + vendor/x11iraf/obm/docs/tody.paper/todyd.html | 522 + vendor/x11iraf/obm/docs/tody.paper/todyd1.gif | Bin 0 -> 5681 bytes vendor/x11iraf/obm/docs/tody.paper/todyd2.gif | Bin 0 -> 6468 bytes vendor/x11iraf/obm/docs/tody.paper/todyd3.gif | Bin 0 -> 3535 bytes vendor/x11iraf/obm/geom.c | 179 + vendor/x11iraf/obm/gterm.c | 4407 +++++ vendor/x11iraf/obm/html.c | 1534 ++ vendor/x11iraf/obm/listres/AllWidgets.c | 151 + vendor/x11iraf/obm/listres/AllWidgets.h | 33 + vendor/x11iraf/obm/listres/Imakefile | 20 + vendor/x11iraf/obm/listres/Makefile.bak | 587 + vendor/x11iraf/obm/listres/README | 29 + vendor/x11iraf/obm/listres/listres.c | 302 + vendor/x11iraf/obm/listres/listres.man | 54 + vendor/x11iraf/obm/marker.c | 1869 ++ vendor/x11iraf/obm/obmres.c | 2301 +++ vendor/x11iraf/obm/obmres.dat | 538 + vendor/x11iraf/obm/param.c | 401 + vendor/x11iraf/obm/server.c | 3175 +++ vendor/x11iraf/obm/widget.c | 5017 +++++ vendor/x11iraf/obm/widget.h | 47 + vendor/x11iraf/obmsh/.gdb_history | 58 + vendor/x11iraf/obmsh/Imakefile | 47 + vendor/x11iraf/obmsh/Imakefile.orig | 23 + vendor/x11iraf/obmsh/README | 11 + vendor/x11iraf/obmsh/obmsh.c | 127 + vendor/x11iraf/obmsh/obmsh.man | 71 + vendor/x11iraf/obmsh/obmsh.ps | 552 + vendor/x11iraf/obmsh/puzzle | 330 + vendor/x11iraf/obmsh/zz | 334 + vendor/x11iraf/util/ras2bin.c | 201 + vendor/x11iraf/util/ras2text.c | 277 + vendor/x11iraf/version.h | 1 + vendor/x11iraf/vximtool/Imakefile | 45 + vendor/x11iraf/vximtool/vximtool.c | 2147 ++ vendor/x11iraf/vximtool/vximtool.man | 178 + vendor/x11iraf/vximtool/vximtool.ps | 1569 ++ vendor/x11iraf/vximtool/vximtool_non_cdl.c | 1728 ++ vendor/x11iraf/xaw3d/AllWidgets.c | 124 + vendor/x11iraf/xaw3d/AllWidgets.h | 37 + vendor/x11iraf/xaw3d/AsciiSink.c | 693 + vendor/x11iraf/xaw3d/AsciiSink.h | 91 + vendor/x11iraf/xaw3d/AsciiSinkP.h | 118 + vendor/x11iraf/xaw3d/AsciiSrc.c | 1411 ++ vendor/x11iraf/xaw3d/AsciiSrc.h | 162 + vendor/x11iraf/xaw3d/AsciiSrcP.h | 163 + vendor/x11iraf/xaw3d/AsciiText.c | 336 + vendor/x11iraf/xaw3d/AsciiText.h | 148 + vendor/x11iraf/xaw3d/AsciiTextP.h | 163 + vendor/x11iraf/xaw3d/Box.c | 622 + vendor/x11iraf/xaw3d/Box.h | 98 + vendor/x11iraf/xaw3d/BoxP.h | 108 + vendor/x11iraf/xaw3d/Cardinals.h | 44 + vendor/x11iraf/xaw3d/Command.c | 608 + vendor/x11iraf/xaw3d/Command.h | 118 + vendor/x11iraf/xaw3d/CommandP.h | 142 + vendor/x11iraf/xaw3d/Dialog.c | 448 + vendor/x11iraf/xaw3d/Dialog.h | 109 + vendor/x11iraf/xaw3d/DialogP.h | 98 + vendor/x11iraf/xaw3d/Form.c | 848 + vendor/x11iraf/xaw3d/Form.h | 168 + vendor/x11iraf/xaw3d/FormP.h | 143 + vendor/x11iraf/xaw3d/Grip.c | 150 + vendor/x11iraf/xaw3d/Grip.h | 105 + vendor/x11iraf/xaw3d/GripP.h | 105 + vendor/x11iraf/xaw3d/Imakefile | 306 + vendor/x11iraf/xaw3d/Label.c | 806 + vendor/x11iraf/xaw3d/Label.h | 129 + vendor/x11iraf/xaw3d/LabelP.h | 131 + vendor/x11iraf/xaw3d/Layout.c | 1049 + vendor/x11iraf/xaw3d/Layout.h | 94 + vendor/x11iraf/xaw3d/LayoutP.h | 232 + vendor/x11iraf/xaw3d/List.c | 1204 ++ vendor/x11iraf/xaw3d/List.h | 237 + vendor/x11iraf/xaw3d/ListP.h | 116 + vendor/x11iraf/xaw3d/MenuButtoP.h | 102 + vendor/x11iraf/xaw3d/MenuButton.c | 221 + vendor/x11iraf/xaw3d/MenuButton.h | 90 + vendor/x11iraf/xaw3d/MultiSink.c | 780 + vendor/x11iraf/xaw3d/MultiSink.h | 118 + vendor/x11iraf/xaw3d/MultiSinkP.h | 157 + vendor/x11iraf/xaw3d/MultiSrc.c | 1460 ++ vendor/x11iraf/xaw3d/MultiSrc.h | 151 + vendor/x11iraf/xaw3d/MultiSrcP.h | 194 + vendor/x11iraf/xaw3d/Paned.c | 1945 ++ vendor/x11iraf/xaw3d/Paned.h | 256 + vendor/x11iraf/xaw3d/PanedP.h | 193 + vendor/x11iraf/xaw3d/Panner.c | 957 + vendor/x11iraf/xaw3d/Panner.h | 108 + vendor/x11iraf/xaw3d/PannerP.h | 104 + vendor/x11iraf/xaw3d/Porthole.c | 366 + vendor/x11iraf/xaw3d/Porthole.h | 64 + vendor/x11iraf/xaw3d/PortholeP.h | 65 + vendor/x11iraf/xaw3d/README.XAW3D | 213 + vendor/x11iraf/xaw3d/Repeater.c | 278 + vendor/x11iraf/xaw3d/Repeater.h | 77 + vendor/x11iraf/xaw3d/RepeaterP.h | 82 + vendor/x11iraf/xaw3d/Reports.h | 55 + vendor/x11iraf/xaw3d/Scrollbar.c | 1257 ++ vendor/x11iraf/xaw3d/Scrollbar.h | 146 + vendor/x11iraf/xaw3d/ScrollbarP.h | 121 + vendor/x11iraf/xaw3d/Simple.c | 294 + vendor/x11iraf/xaw3d/Simple.h | 103 + vendor/x11iraf/xaw3d/SimpleMenP.h | 99 + vendor/x11iraf/xaw3d/SimpleMenu.c | 1277 ++ vendor/x11iraf/xaw3d/SimpleMenu.h | 152 + vendor/x11iraf/xaw3d/SimpleP.h | 86 + vendor/x11iraf/xaw3d/Sme.c | 244 + vendor/x11iraf/xaw3d/Sme.h | 80 + vendor/x11iraf/xaw3d/SmeBSB.c | 728 + vendor/x11iraf/xaw3d/SmeBSB.h | 101 + vendor/x11iraf/xaw3d/SmeBSBP.h | 115 + vendor/x11iraf/xaw3d/SmeLine.c | 293 + vendor/x11iraf/xaw3d/SmeLine.h | 79 + vendor/x11iraf/xaw3d/SmeLineP.h | 97 + vendor/x11iraf/xaw3d/SmeP.h | 105 + vendor/x11iraf/xaw3d/SmeThreeD.c | 612 + vendor/x11iraf/xaw3d/SmeThreeD.h | 96 + vendor/x11iraf/xaw3d/SmeThreeDP.h | 82 + vendor/x11iraf/xaw3d/StripCharP.h | 109 + vendor/x11iraf/xaw3d/StripChart.c | 556 + vendor/x11iraf/xaw3d/StripChart.h | 118 + vendor/x11iraf/xaw3d/Template.c | 94 + vendor/x11iraf/xaw3d/Template.h | 71 + vendor/x11iraf/xaw3d/TemplateP.h | 64 + vendor/x11iraf/xaw3d/Text.c | 3533 ++++ vendor/x11iraf/xaw3d/Text.h | 310 + vendor/x11iraf/xaw3d/TextAction.c | 2270 +++ vendor/x11iraf/xaw3d/TextP.h | 289 + vendor/x11iraf/xaw3d/TextPop.c | 1430 ++ vendor/x11iraf/xaw3d/TextSink.c | 779 + vendor/x11iraf/xaw3d/TextSink.h | 317 + vendor/x11iraf/xaw3d/TextSinkP.h | 143 + vendor/x11iraf/xaw3d/TextSrc.c | 671 + vendor/x11iraf/xaw3d/TextSrc.h | 237 + vendor/x11iraf/xaw3d/TextSrcP.h | 164 + vendor/x11iraf/xaw3d/TextTr.c | 130 + vendor/x11iraf/xaw3d/ThreeD.c | 640 + vendor/x11iraf/xaw3d/ThreeD.c.sav | 641 + vendor/x11iraf/xaw3d/ThreeD.h | 95 + vendor/x11iraf/xaw3d/ThreeDP.h | 74 + vendor/x11iraf/xaw3d/Toggle.c | 619 + vendor/x11iraf/xaw3d/Toggle.h | 177 + vendor/x11iraf/xaw3d/ToggleP.h | 113 + vendor/x11iraf/xaw3d/Tree.c | 1008 + vendor/x11iraf/xaw3d/Tree.h | 125 + vendor/x11iraf/xaw3d/TreeP.h | 132 + vendor/x11iraf/xaw3d/Vendor.c | 461 + vendor/x11iraf/xaw3d/VendorEP.h | 81 + vendor/x11iraf/xaw3d/Viewport.c | 1084 + vendor/x11iraf/xaw3d/Viewport.h | 124 + vendor/x11iraf/xaw3d/ViewportP.h | 106 + vendor/x11iraf/xaw3d/XawI18n.c | 88 + vendor/x11iraf/xaw3d/XawI18n.h | 80 + vendor/x11iraf/xaw3d/XawIm.c | 1716 ++ vendor/x11iraf/xaw3d/XawImP.h | 240 + vendor/x11iraf/xaw3d/XawInit.c | 49 + vendor/x11iraf/xaw3d/XawInit.h | 31 + .../xaw3d/exports/include/X11/Xaw3d/AllWidgets.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/AsciiSink.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/AsciiSinkP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/AsciiSrc.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/AsciiSrcP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/AsciiText.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/AsciiTextP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/Box.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/BoxP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Cardinals.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Command.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/CommandP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Dialog.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/DialogP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/Form.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/FormP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/Grip.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/GripP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Label.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/LabelP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/List.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/ListP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/MenuButtoP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/MenuButton.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/MultiSink.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/MultiSinkP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/MultiSrc.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/MultiSrcP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Paned.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/PanedP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Panner.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/PannerP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Porthole.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/PortholeP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Repeater.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/RepeaterP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Reports.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Scrollbar.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/ScrollbarP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Simple.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SimpleMenP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SimpleMenu.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SimpleP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/Sme.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SmeBSB.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SmeBSBP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SmeLine.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SmeLineP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SmeThreeD.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/SmeThreeDP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/StripCharP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/StripChart.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Template.c | 1 + .../xaw3d/exports/include/X11/Xaw3d/Template.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TemplateP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/Text.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TextP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TextSink.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TextSinkP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TextSrc.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TextSrcP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/ThreeD.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/ThreeDP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Toggle.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/ToggleP.h | 1 + .../x11iraf/xaw3d/exports/include/X11/Xaw3d/Tree.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/TreeP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/VendorEP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/Viewport.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/ViewportP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/XawImP.h | 1 + .../xaw3d/exports/include/X11/Xaw3d/XawInit.h | 1 + vendor/x11iraf/xaw3d/jump_funcs | 128 + vendor/x11iraf/xaw3d/jump_ignore | 3 + vendor/x11iraf/xaw3d/jump_vars | 126 + vendor/x11iraf/xaw3d/laygram.h | 45 + vendor/x11iraf/xaw3d/laygram.y | 263 + vendor/x11iraf/xaw3d/laylex.l | 127 + vendor/x11iraf/xaw3d/sharedlib.c | 179 + vendor/x11iraf/xgterm/.gdb_history | 93 + vendor/x11iraf/xgterm/.pure | 0 vendor/x11iraf/xgterm/Imakefile | 154 + vendor/x11iraf/xgterm/NOTES | 959 + vendor/x11iraf/xgterm/README | 15 + vendor/x11iraf/xgterm/TODO | 93 + vendor/x11iraf/xgterm/Tests | 42 + vendor/x11iraf/xgterm/VTPrsTbl.c | 2956 +++ vendor/x11iraf/xgterm/VTparse.def | 80 + vendor/x11iraf/xgterm/VTparse.h | 110 + vendor/x11iraf/xgterm/XGterm.ad | 112 + vendor/x11iraf/xgterm/XGterm.ad.R5 | 85 + vendor/x11iraf/xgterm/_3d | 44 + vendor/x11iraf/xgterm/button.c | 1480 ++ vendor/x11iraf/xgterm/charproc.c | 3877 ++++ vendor/x11iraf/xgterm/ctlseqs.ms | 587 + vendor/x11iraf/xgterm/ctlseqs.ps | 9696 +++++++++ vendor/x11iraf/xgterm/cursor.c | 244 + vendor/x11iraf/xgterm/data.c | 106 + vendor/x11iraf/xgterm/data.h | 69 + vendor/x11iraf/xgterm/error.h | 111 + vendor/x11iraf/xgterm/gtermio.c | 2671 +++ vendor/x11iraf/xgterm/gtermio.esc | 122 + vendor/x11iraf/xgterm/gtermio.h | 8 + vendor/x11iraf/xgterm/input.c | 295 + vendor/x11iraf/xgterm/login.cl | 108 + vendor/x11iraf/xgterm/main.c | 5300 +++++ vendor/x11iraf/xgterm/main.h | 31 + vendor/x11iraf/xgterm/menu.c | 1313 ++ vendor/x11iraf/xgterm/menu.h | 311 + vendor/x11iraf/xgterm/misc.c | 1530 ++ vendor/x11iraf/xgterm/mkp | 1 + vendor/x11iraf/xgterm/ptyx.h | 557 + vendor/x11iraf/xgterm/ptyx_new.h | 1836 ++ vendor/x11iraf/xgterm/resize.c | 584 + vendor/x11iraf/xgterm/resize.man | 72 + vendor/x11iraf/xgterm/screen.c | 771 + vendor/x11iraf/xgterm/scrollbar.c | 531 + vendor/x11iraf/xgterm/tabs.c | 106 + vendor/x11iraf/xgterm/termcap | 27 + vendor/x11iraf/xgterm/terminfo | 17 + vendor/x11iraf/xgterm/util.c | 1111 ++ vendor/x11iraf/xgterm/xgterm.man | 981 + vendor/x11iraf/xgterm/xgterm.ps | 1298 ++ vendor/x11iraf/xgterm/xterm.man | 1649 ++ vendor/x11iraf/xgterm/z | 5 + vendor/x11iraf/xgterm/zz.c | 14 + vendor/x11iraf/ximtool/.alias | 5 + vendor/x11iraf/ximtool/.gdb_history | 33 + vendor/x11iraf/ximtool/BUGS | 196 + vendor/x11iraf/ximtool/BUGS-v2.0 | 56 + vendor/x11iraf/ximtool/Imakefile | 100 + vendor/x11iraf/ximtool/NOTES | 222 + vendor/x11iraf/ximtool/OLD/ximtool-0.5.info | 798 + vendor/x11iraf/ximtool/OLD/ximtool-alt.man | 1568 ++ vendor/x11iraf/ximtool/OLD/ximtool-mag | 5494 +++++ vendor/x11iraf/ximtool/OLD/ximtool-mag.c | 419 + vendor/x11iraf/ximtool/OLD/ximtool-mag.gui | 5388 +++++ vendor/x11iraf/ximtool/OLD/ximtool-mag.html | 697 + vendor/x11iraf/ximtool/OLD/ximtool-mag.man | 1493 ++ vendor/x11iraf/ximtool/OLD/ximtool-mag.ps | 10025 ++++++++++ vendor/x11iraf/ximtool/TODO | 241 + vendor/x11iraf/ximtool/clients.old/.DONE | 0 vendor/x11iraf/ximtool/clients.old/DONE | 0 vendor/x11iraf/ximtool/clients.old/Imakefile | 32 + vendor/x11iraf/ximtool/clients.old/README | 0 vendor/x11iraf/ximtool/clients.old/_spplint | 489 + vendor/x11iraf/ximtool/clients.old/doc/Notes | 199 + vendor/x11iraf/ximtool/clients.old/doc/README | 0 vendor/x11iraf/ximtool/clients.old/lib/README | 0 vendor/x11iraf/ximtool/clients.old/lib/dspmmap.f | 356 + vendor/x11iraf/ximtool/clients.old/lib/dspmmap.x | 244 + vendor/x11iraf/ximtool/clients.old/lib/idxstr.f | 44 + vendor/x11iraf/ximtool/clients.old/lib/idxstr.x | 54 + vendor/x11iraf/ximtool/clients.old/lib/mkpkg | 17 + vendor/x11iraf/ximtool/clients.old/lib/reopen.f | 70 + vendor/x11iraf/ximtool/clients.old/lib/reopen.x | 55 + .../ximtool/clients.old/lib/skywcs/doc/README | 302 + .../clients.old/lib/skywcs/doc/ccsystems.hlp | 134 + .../ximtool/clients.old/lib/skywcs/doc/skclose.hlp | 23 + .../ximtool/clients.old/lib/skywcs/doc/skcopy.hlp | 24 + .../ximtool/clients.old/lib/skywcs/doc/skdecim.hlp | 55 + .../clients.old/lib/skywcs/doc/skdecwcs.hlp | 62 + .../clients.old/lib/skywcs/doc/skdecwstr.hlp | 46 + .../ximtool/clients.old/lib/skywcs/doc/skenwcs.hlp | 32 + .../clients.old/lib/skywcs/doc/skequatorial.hlp | 59 + .../clients.old/lib/skywcs/doc/skiiprint.hlp | 39 + .../clients.old/lib/skywcs/doc/skiiwrite.hlp | 43 + .../clients.old/lib/skywcs/doc/sklltran.hlp | 60 + .../clients.old/lib/skywcs/doc/sksaveim.hlp | 39 + .../ximtool/clients.old/lib/skywcs/doc/sksetd.hlp | 53 + .../ximtool/clients.old/lib/skywcs/doc/skseti.hlp | 93 + .../ximtool/clients.old/lib/skywcs/doc/sksets.hlp | 36 + .../ximtool/clients.old/lib/skywcs/doc/skstatd.hlp | 49 + .../ximtool/clients.old/lib/skywcs/doc/skstati.hlp | 79 + .../ximtool/clients.old/lib/skywcs/doc/skstats.hlp | 40 + .../clients.old/lib/skywcs/doc/skultran.hlp | 51 + .../ximtool/clients.old/lib/skywcs/doc/skywcs.hd | 25 + .../ximtool/clients.old/lib/skywcs/doc/skywcs.hlp | 306 + .../ximtool/clients.old/lib/skywcs/doc/skywcs.men | 15 + .../x11iraf/ximtool/clients.old/lib/skywcs/mkpkg | 16 + .../ximtool/clients.old/lib/skywcs/skdecode.f | 1412 ++ .../ximtool/clients.old/lib/skywcs/skdecode.x | 999 + .../ximtool/clients.old/lib/skywcs/sksaveim.f | 363 + .../ximtool/clients.old/lib/skywcs/sksaveim.x | 157 + .../x11iraf/ximtool/clients.old/lib/skywcs/skset.f | 179 + .../x11iraf/ximtool/clients.old/lib/skywcs/skset.x | 90 + .../ximtool/clients.old/lib/skywcs/skstat.f | 179 + .../ximtool/clients.old/lib/skywcs/skstat.x | 90 + .../ximtool/clients.old/lib/skywcs/sktransform.f | 756 + .../ximtool/clients.old/lib/skywcs/sktransform.x | 577 + .../ximtool/clients.old/lib/skywcs/skwrdstr.f | 45 + .../ximtool/clients.old/lib/skywcs/skwrdstr.x | 53 + .../ximtool/clients.old/lib/skywcs/skwrite.f | 1014 + .../ximtool/clients.old/lib/skywcs/skwrite.x | 510 + .../ximtool/clients.old/lib/skywcs/skywcs.h | 132 + .../ximtool/clients.old/lib/skywcs/skywcsdef.h | 24 + vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.f | 89 + vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.x | 61 + vendor/x11iraf/ximtool/clients.old/lib/ximtool.f | 510 + vendor/x11iraf/ximtool/clients.old/lib/ximtool.x | 459 + vendor/x11iraf/ximtool/clients.old/lib/zfiond.c | 723 + vendor/x11iraf/ximtool/clients.old/mkpkg | 34 + vendor/x11iraf/ximtool/clients.old/wcspix/README | 0 .../x11iraf/ximtool/clients.old/wcspix/class.com | 6 + vendor/x11iraf/ximtool/clients.old/wcspix/mkpkg | 15 + .../x11iraf/ximtool/clients.old/wcspix/t_wcspix.f | 1124 ++ .../x11iraf/ximtool/clients.old/wcspix/t_wcspix.x | 769 + .../x11iraf/ximtool/clients.old/wcspix/wcimage.f | 1975 ++ .../x11iraf/ximtool/clients.old/wcspix/wcimage.x | 1268 ++ vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.f | 30 + vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.x | 50 + .../x11iraf/ximtool/clients.old/wcspix/wcmspec.f | 30 + .../x11iraf/ximtool/clients.old/wcspix/wcmspec.x | 50 + vendor/x11iraf/ximtool/clients.old/wcspix/wcspix.h | 111 + .../x11iraf/ximtool/clients.old/wcspix/wcunknown.f | 229 + .../x11iraf/ximtool/clients.old/wcspix/wcunknown.x | 185 + vendor/x11iraf/ximtool/clients.old/x_ism.f | 145 + vendor/x11iraf/ximtool/clients.old/x_ism.x | 1 + vendor/x11iraf/ximtool/clients/DONE | 0 vendor/x11iraf/ximtool/clients/Imakefile | 32 + vendor/x11iraf/ximtool/clients/Makefile | 1067 + vendor/x11iraf/ximtool/clients/README | 3 + vendor/x11iraf/ximtool/clients/doc/Notes | 199 + vendor/x11iraf/ximtool/clients/doc/README | 3 + vendor/x11iraf/ximtool/clients/lib/README | 11 + vendor/x11iraf/ximtool/clients/lib/dspmmap.x | 244 + vendor/x11iraf/ximtool/clients/lib/idxstr.x | 54 + vendor/x11iraf/ximtool/clients/lib/ism.x | 432 + vendor/x11iraf/ximtool/clients/lib/ismcom.com | 4 + vendor/x11iraf/ximtool/clients/lib/ismfd.com | 11 + vendor/x11iraf/ximtool/clients/lib/mkpkg | 15 + vendor/x11iraf/ximtool/clients/lib/wcsgfterm.x | 61 + vendor/x11iraf/ximtool/clients/lib/ximtool.x | 531 + vendor/x11iraf/ximtool/clients/mkpkg | 34 + vendor/x11iraf/ximtool/clients/wcspix/README | 0 vendor/x11iraf/ximtool/clients/wcspix/class.com | 6 + vendor/x11iraf/ximtool/clients/wcspix/mkpkg | 16 + vendor/x11iraf/ximtool/clients/wcspix/t_wcspix.x | 792 + vendor/x11iraf/ximtool/clients/wcspix/wcimage.x | 1465 ++ .../x11iraf/ximtool/clients/wcspix/wcimage.x.bak | 1515 ++ vendor/x11iraf/ximtool/clients/wcspix/wcmef.x | 50 + vendor/x11iraf/ximtool/clients/wcspix/wcmspec.x | 50 + vendor/x11iraf/ximtool/clients/wcspix/wcspix.h | 112 + vendor/x11iraf/ximtool/clients/wcspix/wcunknown.x | 185 + vendor/x11iraf/ximtool/clients/x_ism.x | 1 + vendor/x11iraf/ximtool/data/README | 2 + vendor/x11iraf/ximtool/data/aips0.lut | 257 + vendor/x11iraf/ximtool/data/blue.lut | 257 + vendor/x11iraf/ximtool/data/brightness.xbm | 6 + vendor/x11iraf/ximtool/data/color.lut | 257 + vendor/x11iraf/ximtool/data/contrast.xbm | 6 + vendor/x11iraf/ximtool/data/green.lut | 257 + vendor/x11iraf/ximtool/data/halley.lut | 257 + vendor/x11iraf/ximtool/data/heat.lut | 257 + vendor/x11iraf/ximtool/data/hflip.xbm | 6 + vendor/x11iraf/ximtool/data/larrow.xbm | 6 + vendor/x11iraf/ximtool/data/panel.xbm | 6 + vendor/x11iraf/ximtool/data/panel1.xbm | 6 + vendor/x11iraf/ximtool/data/qmark.xbm | 6 + vendor/x11iraf/ximtool/data/rainbow.lut | 257 + vendor/x11iraf/ximtool/data/rarrow.xbm | 6 + vendor/x11iraf/ximtool/data/red.lut | 257 + vendor/x11iraf/ximtool/data/solid.xbm | 19 + vendor/x11iraf/ximtool/data/staircase.lut | 257 + vendor/x11iraf/ximtool/data/standard.lut | 257 + vendor/x11iraf/ximtool/data/vflip.xbm | 6 + vendor/x11iraf/ximtool/data/xflip.xbm | 6 + vendor/x11iraf/ximtool/data/xflip2.xbm | 6 + vendor/x11iraf/ximtool/data/yflip.xbm | 6 + vendor/x11iraf/ximtool/data/yflip2.xbm | 6 + vendor/x11iraf/ximtool/eps.c | 1902 ++ vendor/x11iraf/ximtool/eps.h | 146 + vendor/x11iraf/ximtool/fitsio.c | 923 + vendor/x11iraf/ximtool/gifio.c | 1325 ++ vendor/x11iraf/ximtool/gui.bak/blink.obj | 46 + vendor/x11iraf/ximtool/gui.bak/blink.res | 167 + vendor/x11iraf/ximtool/gui.bak/boot.tcl | 74 + vendor/x11iraf/ximtool/gui.bak/compass.tcl | 205 + vendor/x11iraf/ximtool/gui.bak/compass.tcl.bak | 195 + vendor/x11iraf/ximtool/gui.bak/display.res | 451 + vendor/x11iraf/ximtool/gui.bak/func.tcl | 123 + vendor/x11iraf/ximtool/gui.bak/global.res | 103 + vendor/x11iraf/ximtool/gui.bak/global.tcl | 147 + vendor/x11iraf/ximtool/gui.bak/hdr.obj | 36 + vendor/x11iraf/ximtool/gui.bak/hdr.res | 138 + vendor/x11iraf/ximtool/gui.bak/hdr.tcl | 105 + vendor/x11iraf/ximtool/gui.bak/help.obj | 27 + vendor/x11iraf/ximtool/gui.bak/help.res | 111 + vendor/x11iraf/ximtool/gui.bak/help.tcl | 209 + vendor/x11iraf/ximtool/gui.bak/imagewin.tcl | 1123 ++ vendor/x11iraf/ximtool/gui.bak/info.res | 58 + vendor/x11iraf/ximtool/gui.bak/info.tcl | 86 + vendor/x11iraf/ximtool/gui.bak/ism.tcl | 423 + vendor/x11iraf/ximtool/gui.bak/ism.tcl.bak | 411 + vendor/x11iraf/ximtool/gui.bak/load.res | 173 + vendor/x11iraf/ximtool/gui.bak/load.tcl | 247 + vendor/x11iraf/ximtool/gui.bak/magnifier.tcl | 576 + vendor/x11iraf/ximtool/gui.bak/main-old.obj | 51 + vendor/x11iraf/ximtool/gui.bak/main-old.res | 422 + vendor/x11iraf/ximtool/gui.bak/main.obj | 85 + vendor/x11iraf/ximtool/gui.bak/main.res | 521 + vendor/x11iraf/ximtool/gui.bak/mkgui | 81 + vendor/x11iraf/ximtool/gui.bak/panel.obj | 412 + vendor/x11iraf/ximtool/gui.bak/panel.res | 69 + vendor/x11iraf/ximtool/gui.bak/panel.tcl | 833 + vendor/x11iraf/ximtool/gui.bak/panner.tcl | 535 + vendor/x11iraf/ximtool/gui.bak/param.obj | 32 + vendor/x11iraf/ximtool/gui.bak/pixtab.obj | 30 + vendor/x11iraf/ximtool/gui.bak/pixtab.res | 128 + vendor/x11iraf/ximtool/gui.bak/pixtab.tcl | 144 + vendor/x11iraf/ximtool/gui.bak/plots.tcl | 659 + vendor/x11iraf/ximtool/gui.bak/print.res | 304 + vendor/x11iraf/ximtool/gui.bak/print.tcl | 342 + vendor/x11iraf/ximtool/gui.bak/resources.res | 26 + vendor/x11iraf/ximtool/gui.bak/rulers.tcl | 524 + vendor/x11iraf/ximtool/gui.bak/save.res | 143 + vendor/x11iraf/ximtool/gui.bak/save.tcl | 156 + vendor/x11iraf/ximtool/gui.bak/tcl.obj | 13 + vendor/x11iraf/ximtool/gui.bak/tcl.res | 44 + vendor/x11iraf/ximtool/gui.bak/tcl.tcl | 36 + vendor/x11iraf/ximtool/gui.bak/tile.res | 149 + vendor/x11iraf/ximtool/gui.bak/tile.tcl | 214 + vendor/x11iraf/ximtool/gui.bak/toolbars.tcl | 555 + vendor/x11iraf/ximtool/gui.bak/warn.obj | 12 + vendor/x11iraf/ximtool/gui.bak/warn.res | 49 + vendor/x11iraf/ximtool/gui.bak/warn.tcl | 49 + vendor/x11iraf/ximtool/gui.bak/wcs.res | 212 + vendor/x11iraf/ximtool/gui.bak/wcs.tcl | 464 + vendor/x11iraf/ximtool/gui.bak/zztest | 56 + vendor/x11iraf/ximtool/gui/blink.obj | 46 + vendor/x11iraf/ximtool/gui/blink.res | 167 + vendor/x11iraf/ximtool/gui/boot.tcl | 74 + vendor/x11iraf/ximtool/gui/compass.tcl | 215 + vendor/x11iraf/ximtool/gui/compass.tcl.bak | 195 + vendor/x11iraf/ximtool/gui/compass.tcl.new | 205 + vendor/x11iraf/ximtool/gui/display.res | 451 + vendor/x11iraf/ximtool/gui/func.tcl | 202 + vendor/x11iraf/ximtool/gui/global.res | 161 + vendor/x11iraf/ximtool/gui/global.tcl | 147 + vendor/x11iraf/ximtool/gui/hdr.obj | 36 + vendor/x11iraf/ximtool/gui/hdr.res | 138 + vendor/x11iraf/ximtool/gui/hdr.tcl | 105 + vendor/x11iraf/ximtool/gui/help.obj | 27 + vendor/x11iraf/ximtool/gui/help.res | 111 + vendor/x11iraf/ximtool/gui/help.tcl | 209 + vendor/x11iraf/ximtool/gui/imagewin.tcl | 1155 ++ vendor/x11iraf/ximtool/gui/info.res | 58 + vendor/x11iraf/ximtool/gui/info.tcl | 86 + vendor/x11iraf/ximtool/gui/ism.tcl | 423 + vendor/x11iraf/ximtool/gui/ism.tcl.bak | 411 + vendor/x11iraf/ximtool/gui/load.res | 173 + vendor/x11iraf/ximtool/gui/load.tcl | 247 + vendor/x11iraf/ximtool/gui/magnifier.tcl | 577 + vendor/x11iraf/ximtool/gui/main-old.obj | 52 + vendor/x11iraf/ximtool/gui/main-old.res | 422 + vendor/x11iraf/ximtool/gui/main.obj | 86 + vendor/x11iraf/ximtool/gui/main.res | 525 + vendor/x11iraf/ximtool/gui/mkgui | 81 + vendor/x11iraf/ximtool/gui/panel.obj | 412 + vendor/x11iraf/ximtool/gui/panel.res | 69 + vendor/x11iraf/ximtool/gui/panel.tcl | 835 + vendor/x11iraf/ximtool/gui/panner.tcl | 536 + vendor/x11iraf/ximtool/gui/param.obj | 33 + vendor/x11iraf/ximtool/gui/pixtab.obj | 30 + vendor/x11iraf/ximtool/gui/pixtab.res | 128 + vendor/x11iraf/ximtool/gui/pixtab.tcl | 144 + vendor/x11iraf/ximtool/gui/plots.tcl | 667 + vendor/x11iraf/ximtool/gui/print.res | 304 + vendor/x11iraf/ximtool/gui/print.tcl | 342 + vendor/x11iraf/ximtool/gui/resources.res | 26 + vendor/x11iraf/ximtool/gui/rulers.tcl | 524 + vendor/x11iraf/ximtool/gui/save.res | 143 + vendor/x11iraf/ximtool/gui/save.tcl | 156 + vendor/x11iraf/ximtool/gui/tcl.obj | 13 + vendor/x11iraf/ximtool/gui/tcl.res | 44 + vendor/x11iraf/ximtool/gui/tcl.tcl | 36 + vendor/x11iraf/ximtool/gui/tile.res | 149 + vendor/x11iraf/ximtool/gui/tile.tcl | 214 + vendor/x11iraf/ximtool/gui/toolbars.tcl | 557 + vendor/x11iraf/ximtool/gui/warn.obj | 12 + vendor/x11iraf/ximtool/gui/warn.res | 49 + vendor/x11iraf/ximtool/gui/warn.tcl | 49 + vendor/x11iraf/ximtool/gui/wcs.res | 212 + vendor/x11iraf/ximtool/gui/wcs.tcl | 464 + vendor/x11iraf/ximtool/gui2c.sed | 6 + vendor/x11iraf/ximtool/iis.c | 1698 ++ vendor/x11iraf/ximtool/iis.h | 18 + vendor/x11iraf/ximtool/irafio.c | 585 + vendor/x11iraf/ximtool/ism.c | 706 + vendor/x11iraf/ximtool/ism_wcspix.c | 140 + vendor/x11iraf/ximtool/load.c | 925 + vendor/x11iraf/ximtool/logo.c | 36 + vendor/x11iraf/ximtool/logo.h | 17485 ++++++++++++++++ vendor/x11iraf/ximtool/logo/NOTES | 17 + vendor/x11iraf/ximtool/logo/logo.bin.gz | Bin 0 -> 70597 bytes vendor/x11iraf/ximtool/logo/logo.fits | Bin 0 -> 1054080 bytes vendor/x11iraf/ximtool/logo/logo.fits.gz | Bin 0 -> 112284 bytes vendor/x11iraf/ximtool/logo/mkhdr.c | 31 + vendor/x11iraf/ximtool/luts/README | 37 + vendor/x11iraf/ximtool/luts/alex.lut | 256 + vendor/x11iraf/ximtool/luts/backgr.lut | 256 + vendor/x11iraf/ximtool/luts/blulut.lut | 256 + vendor/x11iraf/ximtool/luts/flag.lut | 256 + vendor/x11iraf/ximtool/luts/idl11.lut | 256 + vendor/x11iraf/ximtool/luts/idl12.lut | 256 + vendor/x11iraf/ximtool/luts/idl14.lut | 256 + vendor/x11iraf/ximtool/luts/idl15.lut | 256 + vendor/x11iraf/ximtool/luts/idl2.lut | 256 + vendor/x11iraf/ximtool/luts/idl4.lut | 256 + vendor/x11iraf/ximtool/luts/idl5.lut | 256 + vendor/x11iraf/ximtool/luts/idl6.lut | 256 + vendor/x11iraf/ximtool/luts/ikon.lut | 256 + vendor/x11iraf/ximtool/luts/isophot.lut | 256 + vendor/x11iraf/ximtool/luts/light.lut | 256 + vendor/x11iraf/ximtool/luts/lnspiral.lut | 256 + vendor/x11iraf/ximtool/luts/manycol.lut | 256 + vendor/x11iraf/ximtool/luts/mousse.lut | 256 + vendor/x11iraf/ximtool/luts/pastel.lut | 256 + vendor/x11iraf/ximtool/luts/pseudo1.lut | 256 + vendor/x11iraf/ximtool/luts/pseudo2.lut | 256 + vendor/x11iraf/ximtool/luts/rainbow.lut | 256 + vendor/x11iraf/ximtool/luts/rainbow1.lut | 256 + vendor/x11iraf/ximtool/luts/rainbow2.lut | 256 + vendor/x11iraf/ximtool/luts/rainbow3.lut | 256 + vendor/x11iraf/ximtool/luts/rainbow4.lut | 256 + vendor/x11iraf/ximtool/luts/random.lut | 256 + vendor/x11iraf/ximtool/luts/random1.lut | 256 + vendor/x11iraf/ximtool/luts/random2.lut | 256 + vendor/x11iraf/ximtool/luts/random3.lut | 256 + vendor/x11iraf/ximtool/luts/random4.lut | 256 + vendor/x11iraf/ximtool/luts/real.lut | 256 + vendor/x11iraf/ximtool/luts/smooth.lut | 256 + vendor/x11iraf/ximtool/luts/staircase.lut | 256 + vendor/x11iraf/ximtool/luts/stairs8.lut | 256 + vendor/x11iraf/ximtool/luts/stairs9.lut | 256 + vendor/x11iraf/ximtool/luts/standard.lut | 256 + vendor/x11iraf/ximtool/print.c | 387 + vendor/x11iraf/ximtool/quant.c | 797 + vendor/x11iraf/ximtool/rasio.c | 660 + vendor/x11iraf/ximtool/raster.c | 2995 +++ vendor/x11iraf/ximtool/save.c | 377 + vendor/x11iraf/ximtool/tiffio.c | 197 + vendor/x11iraf/ximtool/util.c | 251 + vendor/x11iraf/ximtool/ximclient.c | 2576 +++ vendor/x11iraf/ximtool/ximprint.cfg | 30 + vendor/x11iraf/ximtool/ximtool-alt.csh | 98 + vendor/x11iraf/ximtool/ximtool-alt.gui | 1 + vendor/x11iraf/ximtool/ximtool-old.csh | 78 + vendor/x11iraf/ximtool/ximtool-old.gui | 10873 ++++++++++ vendor/x11iraf/ximtool/ximtool.c | 640 + vendor/x11iraf/ximtool/ximtool.gui | 11567 +++++++++++ vendor/x11iraf/ximtool/ximtool.gui.h | 11567 +++++++++++ vendor/x11iraf/ximtool/ximtool.h | 733 + vendor/x11iraf/ximtool/ximtool.html | 1219 ++ vendor/x11iraf/ximtool/ximtool.html.h | 1219 ++ vendor/x11iraf/ximtool/ximtool.man | 2338 +++ vendor/x11iraf/ximtool/ximtool.ps | 16410 +++++++++++++++ vendor/x11iraf/ximtool/zscale.c | 532 + vendor/x11iraf/xpm/Imakefile | 147 + vendor/x11iraf/xpm/README | 2 + vendor/x11iraf/xpm/XpmCrBufFrI.c | 331 + vendor/x11iraf/xpm/XpmCrBufFrP.c | 48 + vendor/x11iraf/xpm/XpmCrDataFrI.c | 313 + vendor/x11iraf/xpm/XpmCrDataFrP.c | 47 + vendor/x11iraf/xpm/XpmCrIFrBuf.c | 69 + vendor/x11iraf/xpm/XpmCrIFrData.c | 64 + vendor/x11iraf/xpm/XpmCrPFrBuf.c | 47 + vendor/x11iraf/xpm/XpmCrPFrData.c | 45 + vendor/x11iraf/xpm/XpmRdFToData.c | 41 + vendor/x11iraf/xpm/XpmRdFToI.c | 64 + vendor/x11iraf/xpm/XpmRdFToP.c | 46 + vendor/x11iraf/xpm/XpmWrFFrData.c | 36 + vendor/x11iraf/xpm/XpmWrFFrI.c | 251 + vendor/x11iraf/xpm/XpmWrFFrP.c | 47 + vendor/x11iraf/xpm/create.c | 1456 ++ vendor/x11iraf/xpm/data.c | 645 + vendor/x11iraf/xpm/doc/xpm.ps | 4750 +++++ vendor/x11iraf/xpm/hashtable.c | 208 + vendor/x11iraf/xpm/icons/NeXT.xpm | 79 + vendor/x11iraf/xpm/icons/Plaid.xpm | 33 + vendor/x11iraf/xpm/icons/arrdown.xpm | 41 + vendor/x11iraf/xpm/icons/arrleft.xpm | 41 + vendor/x11iraf/xpm/icons/arrne.xpm | 41 + vendor/x11iraf/xpm/icons/arrright.xpm | 41 + vendor/x11iraf/xpm/icons/arrup.xpm | 41 + vendor/x11iraf/xpm/icons/bee.xpm | 50 + vendor/x11iraf/xpm/icons/block.xpm | 41 + vendor/x11iraf/xpm/icons/bomb.xpm | 42 + vendor/x11iraf/xpm/icons/bull.xpm | 31 + vendor/x11iraf/xpm/icons/circles.xpm | 73 + vendor/x11iraf/xpm/icons/city.xpm | 74 + vendor/x11iraf/xpm/icons/crab.xpm | 41 + vendor/x11iraf/xpm/icons/crab45.xpm | 41 + vendor/x11iraf/xpm/icons/dos.xpm | 41 + vendor/x11iraf/xpm/icons/doso.xpm | 41 + vendor/x11iraf/xpm/icons/doss.xpm | 41 + vendor/x11iraf/xpm/icons/editor.xpm | 41 + vendor/x11iraf/xpm/icons/escherknot.xpm | 61 + vendor/x11iraf/xpm/icons/eye.xpm | 43 + vendor/x11iraf/xpm/icons/eye1.xpm | 43 + vendor/x11iraf/xpm/icons/eye10.xpm | 43 + vendor/x11iraf/xpm/icons/eye11.xpm | 43 + vendor/x11iraf/xpm/icons/eye12.xpm | 43 + vendor/x11iraf/xpm/icons/eye13.xpm | 43 + vendor/x11iraf/xpm/icons/eye14.xpm | 43 + vendor/x11iraf/xpm/icons/eye15.xpm | 43 + vendor/x11iraf/xpm/icons/eye16.xpm | 43 + vendor/x11iraf/xpm/icons/eye17.xpm | 43 + vendor/x11iraf/xpm/icons/eye18.xpm | 43 + vendor/x11iraf/xpm/icons/eye19.xpm | 42 + vendor/x11iraf/xpm/icons/eye2.xpm | 43 + vendor/x11iraf/xpm/icons/eye20.xpm | 42 + vendor/x11iraf/xpm/icons/eye21.xpm | 42 + vendor/x11iraf/xpm/icons/eye22.xpm | 42 + vendor/x11iraf/xpm/icons/eye23.xpm | 42 + vendor/x11iraf/xpm/icons/eye24.xpm | 42 + vendor/x11iraf/xpm/icons/eye3.xpm | 43 + vendor/x11iraf/xpm/icons/eye4.xpm | 43 + vendor/x11iraf/xpm/icons/eye5.xpm | 43 + vendor/x11iraf/xpm/icons/eye6.xpm | 43 + vendor/x11iraf/xpm/icons/eye7.xpm | 43 + vendor/x11iraf/xpm/icons/eye8.xpm | 43 + vendor/x11iraf/xpm/icons/eye9.xpm | 43 + vendor/x11iraf/xpm/icons/fil.xpm | 41 + vendor/x11iraf/xpm/icons/fils.xpm | 41 + vendor/x11iraf/xpm/icons/floppy.xpm | 41 + vendor/x11iraf/xpm/icons/jolifond.xpm | 58 + vendor/x11iraf/xpm/icons/koala.xpm | 51 + vendor/x11iraf/xpm/icons/lambda.xpm | 42 + vendor/x11iraf/xpm/icons/martini.xpm | 43 + vendor/x11iraf/xpm/icons/mickey.xpm | 73 + vendor/x11iraf/xpm/icons/mouse.xpm | 61 + vendor/x11iraf/xpm/icons/nobozos.xpm | 73 + vendor/x11iraf/xpm/icons/nose.xpm | 43 + vendor/x11iraf/xpm/icons/noseback.xpm | 43 + vendor/x11iraf/xpm/icons/nosefront.xpm | 43 + vendor/x11iraf/xpm/icons/nosmoking.xpm | 42 + vendor/x11iraf/xpm/icons/porsche.xpm | 75 + vendor/x11iraf/xpm/icons/stopsign.xpm | 42 + vendor/x11iraf/xpm/icons/umbrella.xpm | 41 + vendor/x11iraf/xpm/icons/wingdogs.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/NeXT.xpm | 79 + vendor/x11iraf/xpm/icons/xpm3icons/Plaid.xpm | 33 + vendor/x11iraf/xpm/icons/xpm3icons/arrdown.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/arrleft.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/arrne.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/arrright.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/arrup.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/bee.xpm | 50 + vendor/x11iraf/xpm/icons/xpm3icons/block.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/bomb.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/bull.xpm | 31 + vendor/x11iraf/xpm/icons/xpm3icons/circles.xpm | 73 + vendor/x11iraf/xpm/icons/xpm3icons/city.xpm | 74 + vendor/x11iraf/xpm/icons/xpm3icons/crab.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/crab45.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/dos.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/doso.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/doss.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/editor.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/escherknot.xpm | 61 + vendor/x11iraf/xpm/icons/xpm3icons/eye.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye1.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye10.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye11.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye12.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye13.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye14.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye15.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye16.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye17.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye18.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye19.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/eye2.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye20.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/eye21.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/eye22.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/eye23.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/eye24.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/eye3.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye4.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye5.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye6.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye7.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye8.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/eye9.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/fil.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/fils.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/floppy.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/jolifond.xpm | 58 + vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm | 51 + vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm~ | 51 + vendor/x11iraf/xpm/icons/xpm3icons/lambda.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/martini.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/mickey.xpm | 73 + vendor/x11iraf/xpm/icons/xpm3icons/mouse.xpm | 61 + vendor/x11iraf/xpm/icons/xpm3icons/nobozos.xpm | 73 + vendor/x11iraf/xpm/icons/xpm3icons/nose.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/noseback.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/nosefront.xpm | 43 + vendor/x11iraf/xpm/icons/xpm3icons/nosmoking.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/porsche.xpm | 75 + vendor/x11iraf/xpm/icons/xpm3icons/stopsign.xpm | 42 + vendor/x11iraf/xpm/icons/xpm3icons/umbrella.xpm | 41 + vendor/x11iraf/xpm/icons/xpm3icons/wingdogs.xpm | 41 + vendor/x11iraf/xpm/misc.c | 293 + vendor/x11iraf/xpm/parse.c | 657 + vendor/x11iraf/xpm/rgb.c | 136 + vendor/x11iraf/xpm/scan.c | 722 + vendor/x11iraf/xpm/strdup.c | 19 + vendor/x11iraf/xpm/xpm.h | 378 + vendor/x11iraf/xpm/xpmP.h | 251 + vendor/x11iraf/xtapemon/Imakefile | 69 + vendor/x11iraf/xtapemon/Imakefile.orig | 33 + vendor/x11iraf/xtapemon/XTapemon.ad | 168 + vendor/x11iraf/xtapemon/XTapemon.ad.h | 132 + vendor/x11iraf/xtapemon/ad2c.sh | 62 + vendor/x11iraf/xtapemon/appres.h | 21 + vendor/x11iraf/xtapemon/classnames.c | 80 + vendor/x11iraf/xtapemon/classnames.h | 8 + vendor/x11iraf/xtapemon/gui2c.sed | 6 + vendor/x11iraf/xtapemon/patchlevel.h | 6 + vendor/x11iraf/xtapemon/types.c | 78 + vendor/x11iraf/xtapemon/types.h | 22 + vendor/x11iraf/xtapemon/xtapemon.c | 736 + vendor/x11iraf/xtapemon/xtapemon.h | 29 + vendor/x11iraf/xtapemon/xtapemon.man | 135 + vendor/x11iraf/xtapemon/xtapemon.ps | 361 + vendor/x11iraf/xtapemon/zzdebug.c | 62 + 1485 files changed, 718684 insertions(+) create mode 100644 vendor/x11iraf/.gdb_history create mode 100644 vendor/x11iraf/Imakefile create mode 100644 vendor/x11iraf/Notes-V1.3.html create mode 100644 vendor/x11iraf/Notes-V1.3.txt create mode 100644 vendor/x11iraf/Notes-V2.0.txt create mode 100644 vendor/x11iraf/README create mode 100644 vendor/x11iraf/README.install create mode 120000 vendor/x11iraf/Revisions create mode 100644 vendor/x11iraf/Revisions.v15 create mode 100644 vendor/x11iraf/Revisions.v20 create mode 100644 vendor/x11iraf/X11IRAF.tmpl create mode 100644 vendor/x11iraf/app-defaults/XGterm create mode 100644 vendor/x11iraf/app-defaults/XTapemon create mode 120000 vendor/x11iraf/bin create mode 100755 vendor/x11iraf/bin.linux/ism_wcspix.e create mode 100755 vendor/x11iraf/bin.linux/obmsh create mode 100755 vendor/x11iraf/bin.linux/resize create mode 100755 vendor/x11iraf/bin.linux/vximtool create mode 100755 vendor/x11iraf/bin.linux/xgterm create mode 100755 vendor/x11iraf/bin.linux/ximtool create mode 100755 vendor/x11iraf/bin.linux/ximtool-alt create mode 100755 vendor/x11iraf/bin.linux/ximtool-old create mode 100755 vendor/x11iraf/bin.linux/xtapemon create mode 100755 vendor/x11iraf/bin.macintel/ism_wcspix.e create mode 100755 vendor/x11iraf/bin.macintel/obmsh create mode 100755 vendor/x11iraf/bin.macintel/resize create mode 100755 vendor/x11iraf/bin.macintel/vximtool create mode 100755 vendor/x11iraf/bin.macintel/xgterm create mode 100755 vendor/x11iraf/bin.macintel/ximtool create mode 100755 vendor/x11iraf/bin.macintel/ximtool-alt create mode 100755 vendor/x11iraf/bin.macintel/ximtool-old create mode 100755 vendor/x11iraf/bin.macintel/xtapemon create mode 100644 vendor/x11iraf/cdl/.alias create mode 100644 vendor/x11iraf/cdl/Imakefile create mode 100644 vendor/x11iraf/cdl/Imakefile.standalone create mode 100644 vendor/x11iraf/cdl/Makefile.generic create mode 100644 vendor/x11iraf/cdl/Notes create mode 100644 vendor/x11iraf/cdl/README create mode 100644 vendor/x11iraf/cdl/Revisions create mode 100644 vendor/x11iraf/cdl/TODO create mode 100644 vendor/x11iraf/cdl/cdl.c create mode 100644 vendor/x11iraf/cdl/cdl.h create mode 100644 vendor/x11iraf/cdl/cdlP.h create mode 100644 vendor/x11iraf/cdl/cdlProto.h create mode 100644 vendor/x11iraf/cdl/cdl_f77.c create mode 100644 vendor/x11iraf/cdl/cdl_f77.h create mode 100644 vendor/x11iraf/cdl/cdl_spp.c create mode 100644 vendor/x11iraf/cdl/cdl_spp.h create mode 100644 vendor/x11iraf/cdl/cdlfits.c create mode 100644 vendor/x11iraf/cdl/cdlfont.h create mode 100644 vendor/x11iraf/cdl/cdlftn.inc create mode 100644 vendor/x11iraf/cdl/cdliraf.c create mode 100644 vendor/x11iraf/cdl/cdlmark.c create mode 100644 vendor/x11iraf/cdl/cdlspp.h create mode 100644 vendor/x11iraf/cdl/cdlzscale.c create mode 100644 vendor/x11iraf/cdl/comm.c create mode 100755 vendor/x11iraf/cdl/configure create mode 100644 vendor/x11iraf/cdl/doc/RELEASE-1.6.NOTES create mode 100644 vendor/x11iraf/cdl/doc/cdlref.ms create mode 100644 vendor/x11iraf/cdl/doc/cdlref.ms-V1.0 create mode 100644 vendor/x11iraf/cdl/doc/cdlref.ms-V1.6 create mode 100644 vendor/x11iraf/cdl/doc/cdlref.ps create mode 100644 vendor/x11iraf/cdl/doc/greek.ps create mode 100644 vendor/x11iraf/cdl/doc/vximtool.man create mode 100644 vendor/x11iraf/cdl/doc/vximtool.ps create mode 100644 vendor/x11iraf/cdl/eps.c create mode 100644 vendor/x11iraf/cdl/eps.h create mode 100644 vendor/x11iraf/cdl/examples/Imakefile create mode 100644 vendor/x11iraf/cdl/examples/Imakefile.standalone create mode 100644 vendor/x11iraf/cdl/examples/Makefile.generic create mode 100644 vendor/x11iraf/cdl/examples/README create mode 100644 vendor/x11iraf/cdl/examples/animate.c create mode 100644 vendor/x11iraf/cdl/examples/coords create mode 100644 vendor/x11iraf/cdl/examples/display.c create mode 100644 vendor/x11iraf/cdl/examples/dpix.fits create mode 100644 vendor/x11iraf/cdl/examples/fdisplay.f create mode 100644 vendor/x11iraf/cdl/examples/ftvmark.f create mode 100644 vendor/x11iraf/cdl/examples/mosaic.c create mode 100644 vendor/x11iraf/cdl/examples/tvmark.c create mode 100644 vendor/x11iraf/cdl/imd.c create mode 100644 vendor/x11iraf/cdl/mkpkg create mode 100644 vendor/x11iraf/cdl/test/Imakefile create mode 100644 vendor/x11iraf/cdl/test/Imakefile.standalone create mode 100644 vendor/x11iraf/cdl/test/Makefile.generic create mode 100644 vendor/x11iraf/cdl/test/cdltest.c create mode 100644 vendor/x11iraf/cdl/test/coords create mode 100644 vendor/x11iraf/cdl/test/imdtest.c create mode 100644 vendor/x11iraf/cdl/test/zzdebug.x create mode 100644 vendor/x11iraf/cdl/vximtool.c create mode 100644 vendor/x11iraf/doc/cdlref.ps create mode 100644 vendor/x11iraf/doc/obmsh.ps create mode 100644 vendor/x11iraf/doc/vximtool.ps create mode 100644 vendor/x11iraf/doc/xgterm.ps create mode 100644 vendor/x11iraf/doc/ximtool.ps create mode 100644 vendor/x11iraf/doc/xtapemon.ps create mode 100644 vendor/x11iraf/guidemo/Notes create mode 100644 vendor/x11iraf/guidemo/README create mode 100644 vendor/x11iraf/guidemo/frame.gui create mode 100644 vendor/x11iraf/guidemo/gtest.gui create mode 100644 vendor/x11iraf/guidemo/guidemo.cl create mode 100644 vendor/x11iraf/guidemo/hello.gui create mode 100644 vendor/x11iraf/guidemo/hello.par create mode 100644 vendor/x11iraf/guidemo/hello.x create mode 100644 vendor/x11iraf/guidemo/help.gui create mode 100644 vendor/x11iraf/guidemo/html.gui create mode 100644 vendor/x11iraf/guidemo/imbrowse.gui create mode 100644 vendor/x11iraf/guidemo/imbrowse.par create mode 100644 vendor/x11iraf/guidemo/imbrowse.x create mode 100644 vendor/x11iraf/guidemo/larrow2.xbm create mode 100644 vendor/x11iraf/guidemo/login.cl create mode 100644 vendor/x11iraf/guidemo/loginuser.cl create mode 100644 vendor/x11iraf/guidemo/ltree.gui create mode 100644 vendor/x11iraf/guidemo/marker.gui create mode 100644 vendor/x11iraf/guidemo/mkpkg create mode 100644 vendor/x11iraf/guidemo/panel.gui create mode 100644 vendor/x11iraf/guidemo/panel2.gui create mode 100644 vendor/x11iraf/guidemo/rarrow2.xbm create mode 100644 vendor/x11iraf/guidemo/region.gui create mode 100644 vendor/x11iraf/guidemo/table.gui create mode 100644 vendor/x11iraf/guidemo/table.gui.bak create mode 100644 vendor/x11iraf/guidemo/tabs.gui create mode 100644 vendor/x11iraf/guidemo/x_guidemo.x create mode 100644 vendor/x11iraf/guidemo/ximtool.html create mode 100644 vendor/x11iraf/guidemo/zscale.x create mode 100644 vendor/x11iraf/include/cdl.h create mode 100644 vendor/x11iraf/include/cdlftn.inc create mode 100644 vendor/x11iraf/include/cdlspp.h create mode 100755 vendor/x11iraf/install create mode 120000 vendor/x11iraf/lib create mode 100644 vendor/x11iraf/lib.linux/libcdl.a create mode 100644 vendor/x11iraf/lib.macintel/libcdl.a create mode 100644 vendor/x11iraf/man/obmsh.1 create mode 100644 vendor/x11iraf/man/resize.1 create mode 100644 vendor/x11iraf/man/vximtool.1 create mode 100644 vendor/x11iraf/man/xgterm.1 create mode 100644 vendor/x11iraf/man/ximtool.1 create mode 100644 vendor/x11iraf/man/xtapemon.1 create mode 100755 vendor/x11iraf/mkarch create mode 100644 vendor/x11iraf/obm/Imakefile create mode 100644 vendor/x11iraf/obm/OBM.revs create mode 100644 vendor/x11iraf/obm/Obm.c create mode 100644 vendor/x11iraf/obm/Obm.h create mode 100644 vendor/x11iraf/obm/ObmP.h create mode 100644 vendor/x11iraf/obm/ObmW/Arrow.c create mode 100644 vendor/x11iraf/obm/ObmW/Arrow.h create mode 100644 vendor/x11iraf/obm/ObmW/Arrow.man create mode 100644 vendor/x11iraf/obm/ObmW/ArrowP.h create mode 100644 vendor/x11iraf/obm/ObmW/Board.c create mode 100644 vendor/x11iraf/obm/ObmW/Board.h create mode 100644 vendor/x11iraf/obm/ObmW/Board.man create mode 100644 vendor/x11iraf/obm/ObmW/BoardP.h create mode 100644 vendor/x11iraf/obm/ObmW/Button.c create mode 100644 vendor/x11iraf/obm/ObmW/Button.h create mode 100644 vendor/x11iraf/obm/ObmW/Button.man create mode 100644 vendor/x11iraf/obm/ObmW/ButtonP.h create mode 100644 vendor/x11iraf/obm/ObmW/CHANGES create mode 100644 vendor/x11iraf/obm/ObmW/Common.c create mode 100644 vendor/x11iraf/obm/ObmW/Common.c.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/Common.h create mode 100644 vendor/x11iraf/obm/ObmW/Common.man create mode 100644 vendor/x11iraf/obm/ObmW/CommonP.h create mode 100644 vendor/x11iraf/obm/ObmW/Container.c create mode 100644 vendor/x11iraf/obm/ObmW/Container.h create mode 100644 vendor/x11iraf/obm/ObmW/ContainerP.h create mode 100644 vendor/x11iraf/obm/ObmW/Converters.h create mode 100644 vendor/x11iraf/obm/ObmW/DrawIString.c create mode 100644 vendor/x11iraf/obm/ObmW/DrawString.c create mode 100644 vendor/x11iraf/obm/ObmW/DrawingArea.c create mode 100644 vendor/x11iraf/obm/ObmW/DrawingArea.h create mode 100644 vendor/x11iraf/obm/ObmW/DrawingAreaP.h create mode 100755 vendor/x11iraf/obm/ObmW/FIXFWF create mode 100644 vendor/x11iraf/obm/ObmW/FWFSED create mode 100644 vendor/x11iraf/obm/ObmW/Frame.c create mode 100644 vendor/x11iraf/obm/ObmW/Frame.h create mode 100644 vendor/x11iraf/obm/ObmW/Frame.man create mode 100644 vendor/x11iraf/obm/ObmW/FrameP.h create mode 100644 vendor/x11iraf/obm/ObmW/Gcs.c create mode 100644 vendor/x11iraf/obm/ObmW/Gcs.h create mode 100644 vendor/x11iraf/obm/ObmW/Group.c create mode 100644 vendor/x11iraf/obm/ObmW/Group.h create mode 100644 vendor/x11iraf/obm/ObmW/Group.man create mode 100644 vendor/x11iraf/obm/ObmW/GroupP.h create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.h create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.092408/GtermP.h create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.c create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.c.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/Gterm.h create mode 100644 vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c create mode 100644 vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.h create mode 100644 vendor/x11iraf/obm/ObmW/Gterm1.5/GtermP.h create mode 100644 vendor/x11iraf/obm/ObmW/GtermCmap.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermCnv.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermDebug.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermGraphics.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermImaging.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermMapping.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermMarker.c create mode 100644 vendor/x11iraf/obm/ObmW/GtermP.h create mode 100644 vendor/x11iraf/obm/ObmW/GtermUtil.c create mode 100644 vendor/x11iraf/obm/ObmW/HTML-PSformat.c create mode 100644 vendor/x11iraf/obm/ObmW/HTML.c create mode 100644 vendor/x11iraf/obm/ObmW/HTML.h create mode 100644 vendor/x11iraf/obm/ObmW/HTML.notes create mode 100644 vendor/x11iraf/obm/ObmW/HTMLP.h create mode 100644 vendor/x11iraf/obm/ObmW/HTMLamp.h create mode 100644 vendor/x11iraf/obm/ObmW/HTMLformat.c create mode 100644 vendor/x11iraf/obm/ObmW/HTMLimages.c create mode 100644 vendor/x11iraf/obm/ObmW/HTMLjot.c create mode 100644 vendor/x11iraf/obm/ObmW/HTMLlists.c create mode 100644 vendor/x11iraf/obm/ObmW/HTMLparse.c create mode 100644 vendor/x11iraf/obm/ObmW/HTMLwidgets.c create mode 100644 vendor/x11iraf/obm/ObmW/Icon.c create mode 100644 vendor/x11iraf/obm/ObmW/Icon.h create mode 100644 vendor/x11iraf/obm/ObmW/Icon.man create mode 100644 vendor/x11iraf/obm/ObmW/IconP.h create mode 100644 vendor/x11iraf/obm/ObmW/Imakefile create mode 100644 vendor/x11iraf/obm/ObmW/Label.c create mode 100644 vendor/x11iraf/obm/ObmW/Label.h create mode 100644 vendor/x11iraf/obm/ObmW/Label.man create mode 100644 vendor/x11iraf/obm/ObmW/LabelP.h create mode 100644 vendor/x11iraf/obm/ObmW/Layout.c create mode 100644 vendor/x11iraf/obm/ObmW/Layout.c.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/Layout.ex create mode 100644 vendor/x11iraf/obm/ObmW/Layout.h create mode 100644 vendor/x11iraf/obm/ObmW/Layout.ps.gz.mip create mode 100644 vendor/x11iraf/obm/ObmW/LayoutP.h create mode 100644 vendor/x11iraf/obm/ObmW/ListTree.c create mode 100644 vendor/x11iraf/obm/ObmW/ListTree.h create mode 100644 vendor/x11iraf/obm/ObmW/ListTreeP.h create mode 100644 vendor/x11iraf/obm/ObmW/Makefile create mode 100644 vendor/x11iraf/obm/ObmW/MenuBar.c create mode 100644 vendor/x11iraf/obm/ObmW/MenuBar.h create mode 100644 vendor/x11iraf/obm/ObmW/MenuBar.man create mode 100644 vendor/x11iraf/obm/ObmW/MenuBarP.h create mode 100644 vendor/x11iraf/obm/ObmW/MultiList.c create mode 100644 vendor/x11iraf/obm/ObmW/MultiList.h create mode 100644 vendor/x11iraf/obm/ObmW/MultiList.man create mode 100644 vendor/x11iraf/obm/ObmW/MultiListP.h create mode 100644 vendor/x11iraf/obm/ObmW/Notes create mode 100644 vendor/x11iraf/obm/ObmW/README create mode 100644 vendor/x11iraf/obm/ObmW/RadioGrp.c create mode 100644 vendor/x11iraf/obm/ObmW/RadioGrp.h create mode 100644 vendor/x11iraf/obm/ObmW/RadioGrp.man create mode 100644 vendor/x11iraf/obm/ObmW/RadioGrpP.h create mode 100644 vendor/x11iraf/obm/ObmW/RowCol.c create mode 100644 vendor/x11iraf/obm/ObmW/RowCol.h create mode 100644 vendor/x11iraf/obm/ObmW/RowCol.man create mode 100644 vendor/x11iraf/obm/ObmW/RowColP.h create mode 100644 vendor/x11iraf/obm/ObmW/Scrollbar.c create mode 100644 vendor/x11iraf/obm/ObmW/Scrollbar.h create mode 100644 vendor/x11iraf/obm/ObmW/Scrollbar.man create mode 100644 vendor/x11iraf/obm/ObmW/ScrollbarP.h create mode 100644 vendor/x11iraf/obm/ObmW/Separator.c create mode 100644 vendor/x11iraf/obm/ObmW/Separator.h create mode 100644 vendor/x11iraf/obm/ObmW/SeparatorP.h create mode 100644 vendor/x11iraf/obm/ObmW/Simple.c create mode 100644 vendor/x11iraf/obm/ObmW/SimpleMenu.c create mode 100644 vendor/x11iraf/obm/ObmW/Slider2.c create mode 100644 vendor/x11iraf/obm/ObmW/Slider2.h create mode 100644 vendor/x11iraf/obm/ObmW/Slider2.man create mode 100644 vendor/x11iraf/obm/ObmW/Slider2P.h create mode 100644 vendor/x11iraf/obm/ObmW/TabString.h create mode 100644 vendor/x11iraf/obm/ObmW/Table.c create mode 100644 vendor/x11iraf/obm/ObmW/Table.h create mode 100644 vendor/x11iraf/obm/ObmW/Table3d.c create mode 100644 vendor/x11iraf/obm/ObmW/Table3d.h create mode 100644 vendor/x11iraf/obm/ObmW/TableP.h create mode 100644 vendor/x11iraf/obm/ObmW/TableUtil.c create mode 100644 vendor/x11iraf/obm/ObmW/TableUtil.h create mode 100644 vendor/x11iraf/obm/ObmW/Tablist2Tabs.c create mode 100644 vendor/x11iraf/obm/ObmW/Tabs.c create mode 100644 vendor/x11iraf/obm/ObmW/Tabs.h create mode 100644 vendor/x11iraf/obm/ObmW/TabsP.h create mode 100644 vendor/x11iraf/obm/ObmW/TextWidth.c create mode 100644 vendor/x11iraf/obm/ObmW/Toggle.c create mode 100644 vendor/x11iraf/obm/ObmW/Toggle.h create mode 100644 vendor/x11iraf/obm/ObmW/Toggle.man create mode 100644 vendor/x11iraf/obm/ObmW/ToggleP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/3d.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AllWidgets.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Arrow.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ArrowP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AsciiSink.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AsciiSinkP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AsciiSrc.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AsciiSrcP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AsciiText.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/AsciiTextP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Box.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/BoxP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Cardinals.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Clock.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ClockP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Command.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/CommandP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Container.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ContainerP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Dialog.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/DialogP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Form.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/FormP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Frame.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/FrameP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Grip.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/GripP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Label.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/LabelP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/List.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ListP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Logo.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/LogoP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Mailbox.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/MailboxP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/MenuButtoP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/MenuButton.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Object.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Paned.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/PanedP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Panner.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/PannerP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Porthole.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/PortholeP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Repeater.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/RepeaterP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Reports.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Scrollbar.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ScrollbarP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ScrolledTable.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ScrolledTableP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Separator.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SeparatorP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Simple.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SimpleMenP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SimpleMenu.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SimpleP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Sme.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SmeBSB.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SmeBSBP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SmeLine.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SmeLineP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/SmeP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/StripCharP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/StripChart.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Table.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Table3d.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TableP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TableUtil.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Template.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TemplateP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Text.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TextP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TextSink.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TextSinkP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TextSrc.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TextSrcP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Toggle.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ToggleP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Tree.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/TreeP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Viewport.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/ViewportP.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/XawAll.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/XawInit.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/Xosdefs.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/XrawInit.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/color.h create mode 100644 vendor/x11iraf/obm/ObmW/Xraw/xraw_table.h create mode 100644 vendor/x11iraf/obm/ObmW/_c create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/AnchoredImage.xbm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/DelayedImage.xbm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/ERROR.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/FATAL.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/INFO.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/NONE.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/NoImage.xbm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/QUESTION.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/WARNING.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond0m.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond0s.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond1m.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/diamond1s.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/square0.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/square0m.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/square0s.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/square1.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/square1m.pm create mode 100644 vendor/x11iraf/obm/ObmW/bitmaps/square1s.pm create mode 100644 vendor/x11iraf/obm/ObmW/color.c create mode 100644 vendor/x11iraf/obm/ObmW/cvtLong.c create mode 100644 vendor/x11iraf/obm/ObmW/done.h create mode 100644 vendor/x11iraf/obm/ObmW/iconutil.c create mode 100644 vendor/x11iraf/obm/ObmW/iconutil.c.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/inkstore.h create mode 100644 vendor/x11iraf/obm/ObmW/laygram.y create mode 100644 vendor/x11iraf/obm/ObmW/laylex.l create mode 100644 vendor/x11iraf/obm/ObmW/laylex.l.ORIG create mode 100644 vendor/x11iraf/obm/ObmW/scroll.c create mode 100644 vendor/x11iraf/obm/ObmW/scroll.h create mode 100644 vendor/x11iraf/obm/ObmW/stip4.bm create mode 100644 vendor/x11iraf/obm/ObmW/strnchr.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/Separator.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/Separator.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/SeparatorP.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/Simple.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/Simple.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/SimpleMenP.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/SimpleMenu.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/SimpleMenu.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/SimpleP.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/Table.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/Table.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/Table3d.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/Table3d.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/TableP.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/TableUtil.c create mode 100644 vendor/x11iraf/obm/ObmW/zz/TableUtil.h create mode 100644 vendor/x11iraf/obm/ObmW/zz/XrawInit.h create mode 100644 vendor/x11iraf/obm/README create mode 100644 vendor/x11iraf/obm/Tcl/Imakefile create mode 100644 vendor/x11iraf/obm/Tcl/Imakefile.ORIG create mode 100644 vendor/x11iraf/obm/Tcl/Makefile create mode 100644 vendor/x11iraf/obm/Tcl/README create mode 100644 vendor/x11iraf/obm/Tcl/README.OBM create mode 100644 vendor/x11iraf/obm/Tcl/changes create mode 100644 vendor/x11iraf/obm/Tcl/compat/README create mode 100644 vendor/x11iraf/obm/Tcl/compat/dirent.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/dirent2.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/float.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/getcwd.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/limits.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/opendir.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/stdlib.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/strerror.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/string.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/strstr.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/strtod.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/strtol.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/strtoul.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/tmpnam.c create mode 100644 vendor/x11iraf/obm/Tcl/compat/unistd.h create mode 100644 vendor/x11iraf/obm/Tcl/compat/waitpid.c create mode 100755 vendor/x11iraf/obm/Tcl/config.status create mode 100755 vendor/x11iraf/obm/Tcl/configure create mode 100755 vendor/x11iraf/obm/Tcl/configure.in create mode 100755 vendor/x11iraf/obm/Tcl/configure.info create mode 100644 vendor/x11iraf/obm/Tcl/doc/AddErrInfo.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/AppInit.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Async.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Backslash.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CallDel.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CmdCmplt.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Concat.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CrtCommand.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CrtInterp.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CrtMathFnc.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CrtPipelin.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/CrtTrace.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/DString.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/DetachPids.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/EnterFile.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Eval.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/ExprLong.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/GetInt.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Hash.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Interp.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/LinkVar.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/PrintDbl.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/RecordEval.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/RegExp.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/SetRecLmt.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/SetResult.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/SetVar.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/SplitList.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/StrMatch.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/Tcl.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/TildeSubst.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/TraceVar.3 create mode 100644 vendor/x11iraf/obm/Tcl/doc/append.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/array.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/break.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/case.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/catch.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/cd.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/close.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/concat.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/continue.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/eof.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/error.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/eval.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/exec.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/exit.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/expr.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/file.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/flush.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/for.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/foreach.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/format.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/gets.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/glob.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/global.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/history.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/if.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/incr.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/info.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/join.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/lappend.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/library.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/lindex.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/linsert.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/list.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/llength.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/lrange.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/lreplace.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/lsearch.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/lsort.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/man.macros create mode 100644 vendor/x11iraf/obm/Tcl/doc/open.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/pid.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/proc.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/puts.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/pwd.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/read.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/regexp.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/regsub.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/rename.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/return.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/scan.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/seek.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/set.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/source.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/split.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/string.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/switch.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/tclsh.1 create mode 100644 vendor/x11iraf/obm/Tcl/doc/tclvars.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/tell.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/time.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/trace.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/unknown.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/unset.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/uplevel.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/upvar.n create mode 100644 vendor/x11iraf/obm/Tcl/doc/while.n create mode 100644 vendor/x11iraf/obm/Tcl/library/init.tcl create mode 100644 vendor/x11iraf/obm/Tcl/library/parray.tcl create mode 100644 vendor/x11iraf/obm/Tcl/library/tclIndex create mode 100644 vendor/x11iraf/obm/Tcl/panic.c create mode 100644 vendor/x11iraf/obm/Tcl/patchlevel.h create mode 100644 vendor/x11iraf/obm/Tcl/porting.notes create mode 100644 vendor/x11iraf/obm/Tcl/regexp.c create mode 100644 vendor/x11iraf/obm/Tcl/tcl.h create mode 100644 vendor/x11iraf/obm/Tcl/tclAppInit.c create mode 100644 vendor/x11iraf/obm/Tcl/tclAsync.c create mode 100644 vendor/x11iraf/obm/Tcl/tclBasic.c create mode 100644 vendor/x11iraf/obm/Tcl/tclCkalloc.c create mode 100644 vendor/x11iraf/obm/Tcl/tclCmdAH.c create mode 100644 vendor/x11iraf/obm/Tcl/tclCmdIL.c create mode 100644 vendor/x11iraf/obm/Tcl/tclCmdMZ.c create mode 100644 vendor/x11iraf/obm/Tcl/tclEnv.c create mode 100644 vendor/x11iraf/obm/Tcl/tclExpr.c create mode 100644 vendor/x11iraf/obm/Tcl/tclGet.c create mode 100644 vendor/x11iraf/obm/Tcl/tclGlob.c create mode 100644 vendor/x11iraf/obm/Tcl/tclHash.c create mode 100644 vendor/x11iraf/obm/Tcl/tclHistory.c create mode 100644 vendor/x11iraf/obm/Tcl/tclInt.h create mode 100644 vendor/x11iraf/obm/Tcl/tclLink.c create mode 100644 vendor/x11iraf/obm/Tcl/tclMain.c create mode 100644 vendor/x11iraf/obm/Tcl/tclMtherr.c create mode 100644 vendor/x11iraf/obm/Tcl/tclParse.c create mode 100644 vendor/x11iraf/obm/Tcl/tclProc.c create mode 100644 vendor/x11iraf/obm/Tcl/tclRegexp.h create mode 100644 vendor/x11iraf/obm/Tcl/tclTest.c create mode 100644 vendor/x11iraf/obm/Tcl/tclUnix.h create mode 100644 vendor/x11iraf/obm/Tcl/tclUnixAZ.c create mode 100644 vendor/x11iraf/obm/Tcl/tclUnixStr.c create mode 100644 vendor/x11iraf/obm/Tcl/tclUnixStr.c.OLD create mode 100644 vendor/x11iraf/obm/Tcl/tclUnixUtil.c create mode 100644 vendor/x11iraf/obm/Tcl/tclUtil.c create mode 100644 vendor/x11iraf/obm/Tcl/tclVar.c create mode 100644 vendor/x11iraf/obm/Tcl/tests/README create mode 100644 vendor/x11iraf/obm/Tcl/tests/all create mode 100644 vendor/x11iraf/obm/Tcl/tests/append.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/async.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/case.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/cd.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/cmdinfo.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/concat.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/dcall.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/defs create mode 100644 vendor/x11iraf/obm/Tcl/tests/dstring.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/env.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/error.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/eval.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/exec.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/expr.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/file.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/for.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/format.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/glob.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/history.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/if.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/incr.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/info.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/join.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/lindex.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/link.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/linsert.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/list.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/llength.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/lrange.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/lreplace.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/lsearch.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/lsort.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/misc.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/open.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/parse.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/pid.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/proc.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/regexp.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/rename.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/scan.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/set.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/source.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/split.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/string.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/switch.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/trace.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/unknown.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/uplevel.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/upvar.test create mode 100644 vendor/x11iraf/obm/Tcl/tests/while.test create mode 100644 vendor/x11iraf/obm/client.c create mode 100644 vendor/x11iraf/obm/docs/gui.doc/TclQuickRef.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/alphabetic.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/athena.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/athena.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/blueline.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/book.p1.ps.gz create mode 100644 vendor/x11iraf/obm/docs/gui.doc/clientclass.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/coloredline.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/einstein.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/example.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/exampmap create mode 100644 vendor/x11iraf/obm/docs/gui.doc/gmc.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/gterm.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/gtermclass.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/gui.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/guiintro.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowse.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/controlForm.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirName.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirSelect.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/headerText.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/imageButton.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/none.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/objView.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/panel.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/sectionBox.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/statusBox.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/imtool.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/intro.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/irafgui.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/llama.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/marker.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/newgui.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/notyet.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/notyet2.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/otherwidgets.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/params.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/redline.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/serverclass.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/servercom.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/softgui.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/tcl.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/tcl.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/uiparameterclass.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/widgetclass.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/widgets.gif create mode 100644 vendor/x11iraf/obm/docs/gui.doc/widgets.html create mode 100644 vendor/x11iraf/obm/docs/gui.doc/ximclient.html create mode 100644 vendor/x11iraf/obm/docs/obm/Client.html create mode 100644 vendor/x11iraf/obm/docs/obm/Gterm.html create mode 100644 vendor/x11iraf/obm/docs/obm/Marker.html create mode 100644 vendor/x11iraf/obm/docs/obm/Parameter.html create mode 100644 vendor/x11iraf/obm/docs/obm/Server.html create mode 100644 vendor/x11iraf/obm/docs/obm/Widget.html create mode 100644 vendor/x11iraf/obm/docs/obm/alphabetic.html create mode 100644 vendor/x11iraf/obm/docs/obm/index.html create mode 100644 vendor/x11iraf/obm/docs/obm/obm.html create mode 100644 vendor/x11iraf/obm/docs/obm/servercom.html create mode 100644 vendor/x11iraf/obm/docs/tody.paper/todyd.html create mode 100644 vendor/x11iraf/obm/docs/tody.paper/todyd1.gif create mode 100644 vendor/x11iraf/obm/docs/tody.paper/todyd2.gif create mode 100644 vendor/x11iraf/obm/docs/tody.paper/todyd3.gif create mode 100644 vendor/x11iraf/obm/geom.c create mode 100644 vendor/x11iraf/obm/gterm.c create mode 100644 vendor/x11iraf/obm/html.c create mode 100644 vendor/x11iraf/obm/listres/AllWidgets.c create mode 100644 vendor/x11iraf/obm/listres/AllWidgets.h create mode 100644 vendor/x11iraf/obm/listres/Imakefile create mode 100644 vendor/x11iraf/obm/listres/Makefile.bak create mode 100644 vendor/x11iraf/obm/listres/README create mode 100644 vendor/x11iraf/obm/listres/listres.c create mode 100644 vendor/x11iraf/obm/listres/listres.man create mode 100644 vendor/x11iraf/obm/marker.c create mode 100644 vendor/x11iraf/obm/obmres.c create mode 100644 vendor/x11iraf/obm/obmres.dat create mode 100644 vendor/x11iraf/obm/param.c create mode 100644 vendor/x11iraf/obm/server.c create mode 100644 vendor/x11iraf/obm/widget.c create mode 100644 vendor/x11iraf/obm/widget.h create mode 100644 vendor/x11iraf/obmsh/.gdb_history create mode 100644 vendor/x11iraf/obmsh/Imakefile create mode 100644 vendor/x11iraf/obmsh/Imakefile.orig create mode 100644 vendor/x11iraf/obmsh/README create mode 100644 vendor/x11iraf/obmsh/obmsh.c create mode 100644 vendor/x11iraf/obmsh/obmsh.man create mode 100644 vendor/x11iraf/obmsh/obmsh.ps create mode 100755 vendor/x11iraf/obmsh/puzzle create mode 100755 vendor/x11iraf/obmsh/zz create mode 100644 vendor/x11iraf/util/ras2bin.c create mode 100644 vendor/x11iraf/util/ras2text.c create mode 100644 vendor/x11iraf/version.h create mode 100644 vendor/x11iraf/vximtool/Imakefile create mode 100644 vendor/x11iraf/vximtool/vximtool.c create mode 100644 vendor/x11iraf/vximtool/vximtool.man create mode 100644 vendor/x11iraf/vximtool/vximtool.ps create mode 100644 vendor/x11iraf/vximtool/vximtool_non_cdl.c create mode 100644 vendor/x11iraf/xaw3d/AllWidgets.c create mode 100644 vendor/x11iraf/xaw3d/AllWidgets.h create mode 100644 vendor/x11iraf/xaw3d/AsciiSink.c create mode 100644 vendor/x11iraf/xaw3d/AsciiSink.h create mode 100644 vendor/x11iraf/xaw3d/AsciiSinkP.h create mode 100644 vendor/x11iraf/xaw3d/AsciiSrc.c create mode 100644 vendor/x11iraf/xaw3d/AsciiSrc.h create mode 100644 vendor/x11iraf/xaw3d/AsciiSrcP.h create mode 100644 vendor/x11iraf/xaw3d/AsciiText.c create mode 100644 vendor/x11iraf/xaw3d/AsciiText.h create mode 100644 vendor/x11iraf/xaw3d/AsciiTextP.h create mode 100644 vendor/x11iraf/xaw3d/Box.c create mode 100644 vendor/x11iraf/xaw3d/Box.h create mode 100644 vendor/x11iraf/xaw3d/BoxP.h create mode 100644 vendor/x11iraf/xaw3d/Cardinals.h create mode 100644 vendor/x11iraf/xaw3d/Command.c create mode 100644 vendor/x11iraf/xaw3d/Command.h create mode 100644 vendor/x11iraf/xaw3d/CommandP.h create mode 100644 vendor/x11iraf/xaw3d/Dialog.c create mode 100644 vendor/x11iraf/xaw3d/Dialog.h create mode 100644 vendor/x11iraf/xaw3d/DialogP.h create mode 100644 vendor/x11iraf/xaw3d/Form.c create mode 100644 vendor/x11iraf/xaw3d/Form.h create mode 100644 vendor/x11iraf/xaw3d/FormP.h create mode 100644 vendor/x11iraf/xaw3d/Grip.c create mode 100644 vendor/x11iraf/xaw3d/Grip.h create mode 100644 vendor/x11iraf/xaw3d/GripP.h create mode 100644 vendor/x11iraf/xaw3d/Imakefile create mode 100644 vendor/x11iraf/xaw3d/Label.c create mode 100644 vendor/x11iraf/xaw3d/Label.h create mode 100644 vendor/x11iraf/xaw3d/LabelP.h create mode 100644 vendor/x11iraf/xaw3d/Layout.c create mode 100644 vendor/x11iraf/xaw3d/Layout.h create mode 100644 vendor/x11iraf/xaw3d/LayoutP.h create mode 100644 vendor/x11iraf/xaw3d/List.c create mode 100644 vendor/x11iraf/xaw3d/List.h create mode 100644 vendor/x11iraf/xaw3d/ListP.h create mode 100644 vendor/x11iraf/xaw3d/MenuButtoP.h create mode 100644 vendor/x11iraf/xaw3d/MenuButton.c create mode 100644 vendor/x11iraf/xaw3d/MenuButton.h create mode 100644 vendor/x11iraf/xaw3d/MultiSink.c create mode 100644 vendor/x11iraf/xaw3d/MultiSink.h create mode 100644 vendor/x11iraf/xaw3d/MultiSinkP.h create mode 100644 vendor/x11iraf/xaw3d/MultiSrc.c create mode 100644 vendor/x11iraf/xaw3d/MultiSrc.h create mode 100644 vendor/x11iraf/xaw3d/MultiSrcP.h create mode 100644 vendor/x11iraf/xaw3d/Paned.c create mode 100644 vendor/x11iraf/xaw3d/Paned.h create mode 100644 vendor/x11iraf/xaw3d/PanedP.h create mode 100644 vendor/x11iraf/xaw3d/Panner.c create mode 100644 vendor/x11iraf/xaw3d/Panner.h create mode 100644 vendor/x11iraf/xaw3d/PannerP.h create mode 100644 vendor/x11iraf/xaw3d/Porthole.c create mode 100644 vendor/x11iraf/xaw3d/Porthole.h create mode 100644 vendor/x11iraf/xaw3d/PortholeP.h create mode 100644 vendor/x11iraf/xaw3d/README.XAW3D create mode 100644 vendor/x11iraf/xaw3d/Repeater.c create mode 100644 vendor/x11iraf/xaw3d/Repeater.h create mode 100644 vendor/x11iraf/xaw3d/RepeaterP.h create mode 100644 vendor/x11iraf/xaw3d/Reports.h create mode 100644 vendor/x11iraf/xaw3d/Scrollbar.c create mode 100644 vendor/x11iraf/xaw3d/Scrollbar.h create mode 100644 vendor/x11iraf/xaw3d/ScrollbarP.h create mode 100644 vendor/x11iraf/xaw3d/Simple.c create mode 100644 vendor/x11iraf/xaw3d/Simple.h create mode 100644 vendor/x11iraf/xaw3d/SimpleMenP.h create mode 100644 vendor/x11iraf/xaw3d/SimpleMenu.c create mode 100644 vendor/x11iraf/xaw3d/SimpleMenu.h create mode 100644 vendor/x11iraf/xaw3d/SimpleP.h create mode 100644 vendor/x11iraf/xaw3d/Sme.c create mode 100644 vendor/x11iraf/xaw3d/Sme.h create mode 100644 vendor/x11iraf/xaw3d/SmeBSB.c create mode 100644 vendor/x11iraf/xaw3d/SmeBSB.h create mode 100644 vendor/x11iraf/xaw3d/SmeBSBP.h create mode 100644 vendor/x11iraf/xaw3d/SmeLine.c create mode 100644 vendor/x11iraf/xaw3d/SmeLine.h create mode 100644 vendor/x11iraf/xaw3d/SmeLineP.h create mode 100644 vendor/x11iraf/xaw3d/SmeP.h create mode 100644 vendor/x11iraf/xaw3d/SmeThreeD.c create mode 100644 vendor/x11iraf/xaw3d/SmeThreeD.h create mode 100644 vendor/x11iraf/xaw3d/SmeThreeDP.h create mode 100644 vendor/x11iraf/xaw3d/StripCharP.h create mode 100644 vendor/x11iraf/xaw3d/StripChart.c create mode 100644 vendor/x11iraf/xaw3d/StripChart.h create mode 100644 vendor/x11iraf/xaw3d/Template.c create mode 100644 vendor/x11iraf/xaw3d/Template.h create mode 100644 vendor/x11iraf/xaw3d/TemplateP.h create mode 100644 vendor/x11iraf/xaw3d/Text.c create mode 100644 vendor/x11iraf/xaw3d/Text.h create mode 100644 vendor/x11iraf/xaw3d/TextAction.c create mode 100644 vendor/x11iraf/xaw3d/TextP.h create mode 100644 vendor/x11iraf/xaw3d/TextPop.c create mode 100644 vendor/x11iraf/xaw3d/TextSink.c create mode 100644 vendor/x11iraf/xaw3d/TextSink.h create mode 100644 vendor/x11iraf/xaw3d/TextSinkP.h create mode 100644 vendor/x11iraf/xaw3d/TextSrc.c create mode 100644 vendor/x11iraf/xaw3d/TextSrc.h create mode 100644 vendor/x11iraf/xaw3d/TextSrcP.h create mode 100644 vendor/x11iraf/xaw3d/TextTr.c create mode 100644 vendor/x11iraf/xaw3d/ThreeD.c create mode 100644 vendor/x11iraf/xaw3d/ThreeD.c.sav create mode 100644 vendor/x11iraf/xaw3d/ThreeD.h create mode 100644 vendor/x11iraf/xaw3d/ThreeDP.h create mode 100644 vendor/x11iraf/xaw3d/Toggle.c create mode 100644 vendor/x11iraf/xaw3d/Toggle.h create mode 100644 vendor/x11iraf/xaw3d/ToggleP.h create mode 100644 vendor/x11iraf/xaw3d/Tree.c create mode 100644 vendor/x11iraf/xaw3d/Tree.h create mode 100644 vendor/x11iraf/xaw3d/TreeP.h create mode 100644 vendor/x11iraf/xaw3d/Vendor.c create mode 100644 vendor/x11iraf/xaw3d/VendorEP.h create mode 100644 vendor/x11iraf/xaw3d/Viewport.c create mode 100644 vendor/x11iraf/xaw3d/Viewport.h create mode 100644 vendor/x11iraf/xaw3d/ViewportP.h create mode 100644 vendor/x11iraf/xaw3d/XawI18n.c create mode 100644 vendor/x11iraf/xaw3d/XawI18n.h create mode 100644 vendor/x11iraf/xaw3d/XawIm.c create mode 100644 vendor/x11iraf/xaw3d/XawImP.h create mode 100644 vendor/x11iraf/xaw3d/XawInit.c create mode 100644 vendor/x11iraf/xaw3d/XawInit.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AllWidgets.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSink.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSinkP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrc.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrcP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiText.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiTextP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Box.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/BoxP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Cardinals.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Command.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/CommandP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Dialog.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/DialogP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Form.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/FormP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Grip.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/GripP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Label.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/LabelP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/List.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ListP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButtoP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButton.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSink.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSinkP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrc.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrcP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Paned.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PanedP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Panner.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PannerP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Porthole.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PortholeP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Repeater.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/RepeaterP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Reports.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Scrollbar.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ScrollbarP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Simple.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenu.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Sme.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSB.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSBP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLine.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLineP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeD.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeDP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripCharP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripChart.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.c create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TemplateP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Text.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSink.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSinkP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrc.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrcP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeD.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeDP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Toggle.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ToggleP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Tree.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TreeP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/VendorEP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Viewport.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ViewportP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawImP.h create mode 120000 vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawInit.h create mode 100644 vendor/x11iraf/xaw3d/jump_funcs create mode 100644 vendor/x11iraf/xaw3d/jump_ignore create mode 100644 vendor/x11iraf/xaw3d/jump_vars create mode 100644 vendor/x11iraf/xaw3d/laygram.h create mode 100644 vendor/x11iraf/xaw3d/laygram.y create mode 100644 vendor/x11iraf/xaw3d/laylex.l create mode 100644 vendor/x11iraf/xaw3d/sharedlib.c create mode 100644 vendor/x11iraf/xgterm/.gdb_history create mode 100644 vendor/x11iraf/xgterm/.pure create mode 100644 vendor/x11iraf/xgterm/Imakefile create mode 100644 vendor/x11iraf/xgterm/NOTES create mode 100644 vendor/x11iraf/xgterm/README create mode 100644 vendor/x11iraf/xgterm/TODO create mode 100644 vendor/x11iraf/xgterm/Tests create mode 100644 vendor/x11iraf/xgterm/VTPrsTbl.c create mode 100644 vendor/x11iraf/xgterm/VTparse.def create mode 100644 vendor/x11iraf/xgterm/VTparse.h create mode 100644 vendor/x11iraf/xgterm/XGterm.ad create mode 100644 vendor/x11iraf/xgterm/XGterm.ad.R5 create mode 100644 vendor/x11iraf/xgterm/_3d create mode 100644 vendor/x11iraf/xgterm/button.c create mode 100644 vendor/x11iraf/xgterm/charproc.c create mode 100644 vendor/x11iraf/xgterm/ctlseqs.ms create mode 100644 vendor/x11iraf/xgterm/ctlseqs.ps create mode 100644 vendor/x11iraf/xgterm/cursor.c create mode 100644 vendor/x11iraf/xgterm/data.c create mode 100644 vendor/x11iraf/xgterm/data.h create mode 100644 vendor/x11iraf/xgterm/error.h create mode 100644 vendor/x11iraf/xgterm/gtermio.c create mode 100644 vendor/x11iraf/xgterm/gtermio.esc create mode 100644 vendor/x11iraf/xgterm/gtermio.h create mode 100644 vendor/x11iraf/xgterm/input.c create mode 100644 vendor/x11iraf/xgterm/login.cl create mode 100644 vendor/x11iraf/xgterm/main.c create mode 100644 vendor/x11iraf/xgterm/main.h create mode 100644 vendor/x11iraf/xgterm/menu.c create mode 100644 vendor/x11iraf/xgterm/menu.h create mode 100644 vendor/x11iraf/xgterm/misc.c create mode 100644 vendor/x11iraf/xgterm/mkp create mode 100644 vendor/x11iraf/xgterm/ptyx.h create mode 100644 vendor/x11iraf/xgterm/ptyx_new.h create mode 100644 vendor/x11iraf/xgterm/resize.c create mode 100644 vendor/x11iraf/xgterm/resize.man create mode 100644 vendor/x11iraf/xgterm/screen.c create mode 100644 vendor/x11iraf/xgterm/scrollbar.c create mode 100644 vendor/x11iraf/xgterm/tabs.c create mode 100644 vendor/x11iraf/xgterm/termcap create mode 100644 vendor/x11iraf/xgterm/terminfo create mode 100644 vendor/x11iraf/xgterm/util.c create mode 100644 vendor/x11iraf/xgterm/xgterm.man create mode 100644 vendor/x11iraf/xgterm/xgterm.ps create mode 100644 vendor/x11iraf/xgterm/xterm.man create mode 100755 vendor/x11iraf/xgterm/z create mode 100644 vendor/x11iraf/xgterm/zz.c create mode 100644 vendor/x11iraf/ximtool/.alias create mode 100644 vendor/x11iraf/ximtool/.gdb_history create mode 100644 vendor/x11iraf/ximtool/BUGS create mode 100644 vendor/x11iraf/ximtool/BUGS-v2.0 create mode 100644 vendor/x11iraf/ximtool/Imakefile create mode 100644 vendor/x11iraf/ximtool/NOTES create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-0.5.info create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-alt.man create mode 100755 vendor/x11iraf/ximtool/OLD/ximtool-mag create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-mag.c create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-mag.gui create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-mag.html create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-mag.man create mode 100644 vendor/x11iraf/ximtool/OLD/ximtool-mag.ps create mode 100644 vendor/x11iraf/ximtool/TODO create mode 100644 vendor/x11iraf/ximtool/clients.old/.DONE create mode 100644 vendor/x11iraf/ximtool/clients.old/DONE create mode 100644 vendor/x11iraf/ximtool/clients.old/Imakefile create mode 100644 vendor/x11iraf/ximtool/clients.old/README create mode 100644 vendor/x11iraf/ximtool/clients.old/_spplint create mode 100644 vendor/x11iraf/ximtool/clients.old/doc/Notes create mode 100644 vendor/x11iraf/ximtool/clients.old/doc/README create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/README create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/dspmmap.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/dspmmap.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/idxstr.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/idxstr.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/reopen.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/reopen.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/README create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/ccsystems.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skclose.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skcopy.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecim.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwcs.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwstr.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skenwcs.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skequatorial.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiprint.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiwrite.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sklltran.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksaveim.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksetd.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skseti.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksets.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstatd.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstati.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstats.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skultran.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hd create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hlp create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.men create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcs.h create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcsdef.h create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/ximtool.f create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/ximtool.x create mode 100644 vendor/x11iraf/ximtool/clients.old/lib/zfiond.c create mode 100644 vendor/x11iraf/ximtool/clients.old/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/README create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/class.com create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.f create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.x create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.f create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.x create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.f create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.x create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.f create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.x create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcspix.h create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.f create mode 100644 vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.x create mode 100644 vendor/x11iraf/ximtool/clients.old/x_ism.f create mode 100644 vendor/x11iraf/ximtool/clients.old/x_ism.x create mode 100644 vendor/x11iraf/ximtool/clients/DONE create mode 100644 vendor/x11iraf/ximtool/clients/Imakefile create mode 100644 vendor/x11iraf/ximtool/clients/Makefile create mode 100644 vendor/x11iraf/ximtool/clients/README create mode 100644 vendor/x11iraf/ximtool/clients/doc/Notes create mode 100644 vendor/x11iraf/ximtool/clients/doc/README create mode 100644 vendor/x11iraf/ximtool/clients/lib/README create mode 100644 vendor/x11iraf/ximtool/clients/lib/dspmmap.x create mode 100644 vendor/x11iraf/ximtool/clients/lib/idxstr.x create mode 100644 vendor/x11iraf/ximtool/clients/lib/ism.x create mode 100644 vendor/x11iraf/ximtool/clients/lib/ismcom.com create mode 100644 vendor/x11iraf/ximtool/clients/lib/ismfd.com create mode 100644 vendor/x11iraf/ximtool/clients/lib/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients/lib/wcsgfterm.x create mode 100644 vendor/x11iraf/ximtool/clients/lib/ximtool.x create mode 100644 vendor/x11iraf/ximtool/clients/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/README create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/class.com create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/mkpkg create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/t_wcspix.x create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/wcimage.x create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/wcimage.x.bak create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/wcmef.x create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/wcmspec.x create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/wcspix.h create mode 100644 vendor/x11iraf/ximtool/clients/wcspix/wcunknown.x create mode 100644 vendor/x11iraf/ximtool/clients/x_ism.x create mode 100644 vendor/x11iraf/ximtool/data/README create mode 100644 vendor/x11iraf/ximtool/data/aips0.lut create mode 100644 vendor/x11iraf/ximtool/data/blue.lut create mode 100644 vendor/x11iraf/ximtool/data/brightness.xbm create mode 100644 vendor/x11iraf/ximtool/data/color.lut create mode 100644 vendor/x11iraf/ximtool/data/contrast.xbm create mode 100644 vendor/x11iraf/ximtool/data/green.lut create mode 100644 vendor/x11iraf/ximtool/data/halley.lut create mode 100644 vendor/x11iraf/ximtool/data/heat.lut create mode 100644 vendor/x11iraf/ximtool/data/hflip.xbm create mode 100644 vendor/x11iraf/ximtool/data/larrow.xbm create mode 100644 vendor/x11iraf/ximtool/data/panel.xbm create mode 100644 vendor/x11iraf/ximtool/data/panel1.xbm create mode 100644 vendor/x11iraf/ximtool/data/qmark.xbm create mode 100644 vendor/x11iraf/ximtool/data/rainbow.lut create mode 100644 vendor/x11iraf/ximtool/data/rarrow.xbm create mode 100644 vendor/x11iraf/ximtool/data/red.lut create mode 100644 vendor/x11iraf/ximtool/data/solid.xbm create mode 100644 vendor/x11iraf/ximtool/data/staircase.lut create mode 100644 vendor/x11iraf/ximtool/data/standard.lut create mode 100644 vendor/x11iraf/ximtool/data/vflip.xbm create mode 100644 vendor/x11iraf/ximtool/data/xflip.xbm create mode 100644 vendor/x11iraf/ximtool/data/xflip2.xbm create mode 100644 vendor/x11iraf/ximtool/data/yflip.xbm create mode 100644 vendor/x11iraf/ximtool/data/yflip2.xbm create mode 100644 vendor/x11iraf/ximtool/eps.c create mode 100644 vendor/x11iraf/ximtool/eps.h create mode 100644 vendor/x11iraf/ximtool/fitsio.c create mode 100644 vendor/x11iraf/ximtool/gifio.c create mode 100644 vendor/x11iraf/ximtool/gui.bak/blink.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/blink.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/boot.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/compass.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/compass.tcl.bak create mode 100644 vendor/x11iraf/ximtool/gui.bak/display.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/func.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/global.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/global.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/hdr.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/hdr.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/hdr.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/help.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/help.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/help.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/imagewin.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/info.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/info.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/ism.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/ism.tcl.bak create mode 100644 vendor/x11iraf/ximtool/gui.bak/load.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/load.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/magnifier.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/main-old.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/main-old.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/main.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/main.res create mode 100755 vendor/x11iraf/ximtool/gui.bak/mkgui create mode 100644 vendor/x11iraf/ximtool/gui.bak/panel.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/panel.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/panel.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/panner.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/param.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/pixtab.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/pixtab.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/pixtab.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/plots.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/print.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/print.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/resources.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/rulers.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/save.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/save.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/tcl.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/tcl.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/tcl.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/tile.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/tile.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/toolbars.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/warn.obj create mode 100644 vendor/x11iraf/ximtool/gui.bak/warn.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/warn.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/wcs.res create mode 100644 vendor/x11iraf/ximtool/gui.bak/wcs.tcl create mode 100644 vendor/x11iraf/ximtool/gui.bak/zztest create mode 100644 vendor/x11iraf/ximtool/gui/blink.obj create mode 100644 vendor/x11iraf/ximtool/gui/blink.res create mode 100644 vendor/x11iraf/ximtool/gui/boot.tcl create mode 100644 vendor/x11iraf/ximtool/gui/compass.tcl create mode 100644 vendor/x11iraf/ximtool/gui/compass.tcl.bak create mode 100644 vendor/x11iraf/ximtool/gui/compass.tcl.new create mode 100644 vendor/x11iraf/ximtool/gui/display.res create mode 100644 vendor/x11iraf/ximtool/gui/func.tcl create mode 100644 vendor/x11iraf/ximtool/gui/global.res create mode 100644 vendor/x11iraf/ximtool/gui/global.tcl create mode 100644 vendor/x11iraf/ximtool/gui/hdr.obj create mode 100644 vendor/x11iraf/ximtool/gui/hdr.res create mode 100644 vendor/x11iraf/ximtool/gui/hdr.tcl create mode 100644 vendor/x11iraf/ximtool/gui/help.obj create mode 100644 vendor/x11iraf/ximtool/gui/help.res create mode 100644 vendor/x11iraf/ximtool/gui/help.tcl create mode 100644 vendor/x11iraf/ximtool/gui/imagewin.tcl create mode 100644 vendor/x11iraf/ximtool/gui/info.res create mode 100644 vendor/x11iraf/ximtool/gui/info.tcl create mode 100644 vendor/x11iraf/ximtool/gui/ism.tcl create mode 100644 vendor/x11iraf/ximtool/gui/ism.tcl.bak create mode 100644 vendor/x11iraf/ximtool/gui/load.res create mode 100644 vendor/x11iraf/ximtool/gui/load.tcl create mode 100644 vendor/x11iraf/ximtool/gui/magnifier.tcl create mode 100644 vendor/x11iraf/ximtool/gui/main-old.obj create mode 100644 vendor/x11iraf/ximtool/gui/main-old.res create mode 100644 vendor/x11iraf/ximtool/gui/main.obj create mode 100644 vendor/x11iraf/ximtool/gui/main.res create mode 100755 vendor/x11iraf/ximtool/gui/mkgui create mode 100644 vendor/x11iraf/ximtool/gui/panel.obj create mode 100644 vendor/x11iraf/ximtool/gui/panel.res create mode 100644 vendor/x11iraf/ximtool/gui/panel.tcl create mode 100644 vendor/x11iraf/ximtool/gui/panner.tcl create mode 100644 vendor/x11iraf/ximtool/gui/param.obj create mode 100644 vendor/x11iraf/ximtool/gui/pixtab.obj create mode 100644 vendor/x11iraf/ximtool/gui/pixtab.res create mode 100644 vendor/x11iraf/ximtool/gui/pixtab.tcl create mode 100644 vendor/x11iraf/ximtool/gui/plots.tcl create mode 100644 vendor/x11iraf/ximtool/gui/print.res create mode 100644 vendor/x11iraf/ximtool/gui/print.tcl create mode 100644 vendor/x11iraf/ximtool/gui/resources.res create mode 100644 vendor/x11iraf/ximtool/gui/rulers.tcl create mode 100644 vendor/x11iraf/ximtool/gui/save.res create mode 100644 vendor/x11iraf/ximtool/gui/save.tcl create mode 100644 vendor/x11iraf/ximtool/gui/tcl.obj create mode 100644 vendor/x11iraf/ximtool/gui/tcl.res create mode 100644 vendor/x11iraf/ximtool/gui/tcl.tcl create mode 100644 vendor/x11iraf/ximtool/gui/tile.res create mode 100644 vendor/x11iraf/ximtool/gui/tile.tcl create mode 100644 vendor/x11iraf/ximtool/gui/toolbars.tcl create mode 100644 vendor/x11iraf/ximtool/gui/warn.obj create mode 100644 vendor/x11iraf/ximtool/gui/warn.res create mode 100644 vendor/x11iraf/ximtool/gui/warn.tcl create mode 100644 vendor/x11iraf/ximtool/gui/wcs.res create mode 100644 vendor/x11iraf/ximtool/gui/wcs.tcl create mode 100644 vendor/x11iraf/ximtool/gui2c.sed create mode 100644 vendor/x11iraf/ximtool/iis.c create mode 100644 vendor/x11iraf/ximtool/iis.h create mode 100644 vendor/x11iraf/ximtool/irafio.c create mode 100644 vendor/x11iraf/ximtool/ism.c create mode 100644 vendor/x11iraf/ximtool/ism_wcspix.c create mode 100644 vendor/x11iraf/ximtool/load.c create mode 100644 vendor/x11iraf/ximtool/logo.c create mode 100644 vendor/x11iraf/ximtool/logo.h create mode 100644 vendor/x11iraf/ximtool/logo/NOTES create mode 100644 vendor/x11iraf/ximtool/logo/logo.bin.gz create mode 100644 vendor/x11iraf/ximtool/logo/logo.fits create mode 100644 vendor/x11iraf/ximtool/logo/logo.fits.gz create mode 100644 vendor/x11iraf/ximtool/logo/mkhdr.c create mode 100644 vendor/x11iraf/ximtool/luts/README create mode 100644 vendor/x11iraf/ximtool/luts/alex.lut create mode 100644 vendor/x11iraf/ximtool/luts/backgr.lut create mode 100644 vendor/x11iraf/ximtool/luts/blulut.lut create mode 100644 vendor/x11iraf/ximtool/luts/flag.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl11.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl12.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl14.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl15.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl2.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl4.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl5.lut create mode 100644 vendor/x11iraf/ximtool/luts/idl6.lut create mode 100644 vendor/x11iraf/ximtool/luts/ikon.lut create mode 100644 vendor/x11iraf/ximtool/luts/isophot.lut create mode 100644 vendor/x11iraf/ximtool/luts/light.lut create mode 100644 vendor/x11iraf/ximtool/luts/lnspiral.lut create mode 100644 vendor/x11iraf/ximtool/luts/manycol.lut create mode 100644 vendor/x11iraf/ximtool/luts/mousse.lut create mode 100644 vendor/x11iraf/ximtool/luts/pastel.lut create mode 100644 vendor/x11iraf/ximtool/luts/pseudo1.lut create mode 100644 vendor/x11iraf/ximtool/luts/pseudo2.lut create mode 100644 vendor/x11iraf/ximtool/luts/rainbow.lut create mode 100644 vendor/x11iraf/ximtool/luts/rainbow1.lut create mode 100644 vendor/x11iraf/ximtool/luts/rainbow2.lut create mode 100644 vendor/x11iraf/ximtool/luts/rainbow3.lut create mode 100644 vendor/x11iraf/ximtool/luts/rainbow4.lut create mode 100644 vendor/x11iraf/ximtool/luts/random.lut create mode 100644 vendor/x11iraf/ximtool/luts/random1.lut create mode 100644 vendor/x11iraf/ximtool/luts/random2.lut create mode 100644 vendor/x11iraf/ximtool/luts/random3.lut create mode 100644 vendor/x11iraf/ximtool/luts/random4.lut create mode 100644 vendor/x11iraf/ximtool/luts/real.lut create mode 100644 vendor/x11iraf/ximtool/luts/smooth.lut create mode 100644 vendor/x11iraf/ximtool/luts/staircase.lut create mode 100644 vendor/x11iraf/ximtool/luts/stairs8.lut create mode 100644 vendor/x11iraf/ximtool/luts/stairs9.lut create mode 100644 vendor/x11iraf/ximtool/luts/standard.lut create mode 100644 vendor/x11iraf/ximtool/print.c create mode 100644 vendor/x11iraf/ximtool/quant.c create mode 100644 vendor/x11iraf/ximtool/rasio.c create mode 100644 vendor/x11iraf/ximtool/raster.c create mode 100644 vendor/x11iraf/ximtool/save.c create mode 100644 vendor/x11iraf/ximtool/tiffio.c create mode 100644 vendor/x11iraf/ximtool/util.c create mode 100644 vendor/x11iraf/ximtool/ximclient.c create mode 100644 vendor/x11iraf/ximtool/ximprint.cfg create mode 100755 vendor/x11iraf/ximtool/ximtool-alt.csh create mode 120000 vendor/x11iraf/ximtool/ximtool-alt.gui create mode 100755 vendor/x11iraf/ximtool/ximtool-old.csh create mode 100644 vendor/x11iraf/ximtool/ximtool-old.gui create mode 100644 vendor/x11iraf/ximtool/ximtool.c create mode 100644 vendor/x11iraf/ximtool/ximtool.gui create mode 100644 vendor/x11iraf/ximtool/ximtool.gui.h create mode 100644 vendor/x11iraf/ximtool/ximtool.h create mode 100644 vendor/x11iraf/ximtool/ximtool.html create mode 100644 vendor/x11iraf/ximtool/ximtool.html.h create mode 100644 vendor/x11iraf/ximtool/ximtool.man create mode 100644 vendor/x11iraf/ximtool/ximtool.ps create mode 100644 vendor/x11iraf/ximtool/zscale.c create mode 100644 vendor/x11iraf/xpm/Imakefile create mode 100644 vendor/x11iraf/xpm/README create mode 100644 vendor/x11iraf/xpm/XpmCrBufFrI.c create mode 100644 vendor/x11iraf/xpm/XpmCrBufFrP.c create mode 100644 vendor/x11iraf/xpm/XpmCrDataFrI.c create mode 100644 vendor/x11iraf/xpm/XpmCrDataFrP.c create mode 100644 vendor/x11iraf/xpm/XpmCrIFrBuf.c create mode 100644 vendor/x11iraf/xpm/XpmCrIFrData.c create mode 100644 vendor/x11iraf/xpm/XpmCrPFrBuf.c create mode 100644 vendor/x11iraf/xpm/XpmCrPFrData.c create mode 100644 vendor/x11iraf/xpm/XpmRdFToData.c create mode 100644 vendor/x11iraf/xpm/XpmRdFToI.c create mode 100644 vendor/x11iraf/xpm/XpmRdFToP.c create mode 100644 vendor/x11iraf/xpm/XpmWrFFrData.c create mode 100644 vendor/x11iraf/xpm/XpmWrFFrI.c create mode 100644 vendor/x11iraf/xpm/XpmWrFFrP.c create mode 100644 vendor/x11iraf/xpm/create.c create mode 100644 vendor/x11iraf/xpm/data.c create mode 100644 vendor/x11iraf/xpm/doc/xpm.ps create mode 100644 vendor/x11iraf/xpm/hashtable.c create mode 100644 vendor/x11iraf/xpm/icons/NeXT.xpm create mode 100644 vendor/x11iraf/xpm/icons/Plaid.xpm create mode 100644 vendor/x11iraf/xpm/icons/arrdown.xpm create mode 100644 vendor/x11iraf/xpm/icons/arrleft.xpm create mode 100644 vendor/x11iraf/xpm/icons/arrne.xpm create mode 100644 vendor/x11iraf/xpm/icons/arrright.xpm create mode 100644 vendor/x11iraf/xpm/icons/arrup.xpm create mode 100644 vendor/x11iraf/xpm/icons/bee.xpm create mode 100644 vendor/x11iraf/xpm/icons/block.xpm create mode 100644 vendor/x11iraf/xpm/icons/bomb.xpm create mode 100644 vendor/x11iraf/xpm/icons/bull.xpm create mode 100644 vendor/x11iraf/xpm/icons/circles.xpm create mode 100644 vendor/x11iraf/xpm/icons/city.xpm create mode 100644 vendor/x11iraf/xpm/icons/crab.xpm create mode 100644 vendor/x11iraf/xpm/icons/crab45.xpm create mode 100644 vendor/x11iraf/xpm/icons/dos.xpm create mode 100644 vendor/x11iraf/xpm/icons/doso.xpm create mode 100644 vendor/x11iraf/xpm/icons/doss.xpm create mode 100644 vendor/x11iraf/xpm/icons/editor.xpm create mode 100644 vendor/x11iraf/xpm/icons/escherknot.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye1.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye10.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye11.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye12.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye13.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye14.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye15.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye16.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye17.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye18.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye19.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye2.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye20.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye21.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye22.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye23.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye24.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye3.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye4.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye5.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye6.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye7.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye8.xpm create mode 100644 vendor/x11iraf/xpm/icons/eye9.xpm create mode 100644 vendor/x11iraf/xpm/icons/fil.xpm create mode 100644 vendor/x11iraf/xpm/icons/fils.xpm create mode 100644 vendor/x11iraf/xpm/icons/floppy.xpm create mode 100644 vendor/x11iraf/xpm/icons/jolifond.xpm create mode 100644 vendor/x11iraf/xpm/icons/koala.xpm create mode 100644 vendor/x11iraf/xpm/icons/lambda.xpm create mode 100644 vendor/x11iraf/xpm/icons/martini.xpm create mode 100644 vendor/x11iraf/xpm/icons/mickey.xpm create mode 100644 vendor/x11iraf/xpm/icons/mouse.xpm create mode 100644 vendor/x11iraf/xpm/icons/nobozos.xpm create mode 100644 vendor/x11iraf/xpm/icons/nose.xpm create mode 100644 vendor/x11iraf/xpm/icons/noseback.xpm create mode 100644 vendor/x11iraf/xpm/icons/nosefront.xpm create mode 100644 vendor/x11iraf/xpm/icons/nosmoking.xpm create mode 100644 vendor/x11iraf/xpm/icons/porsche.xpm create mode 100644 vendor/x11iraf/xpm/icons/stopsign.xpm create mode 100644 vendor/x11iraf/xpm/icons/umbrella.xpm create mode 100644 vendor/x11iraf/xpm/icons/wingdogs.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/NeXT.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/Plaid.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/arrdown.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/arrleft.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/arrne.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/arrright.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/arrup.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/bee.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/block.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/bomb.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/bull.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/circles.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/city.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/crab.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/crab45.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/dos.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/doso.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/doss.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/editor.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/escherknot.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye1.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye10.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye11.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye12.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye13.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye14.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye15.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye16.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye17.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye18.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye19.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye2.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye20.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye21.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye22.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye23.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye24.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye3.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye4.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye5.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye6.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye7.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye8.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/eye9.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/fil.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/fils.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/floppy.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/jolifond.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm~ create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/lambda.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/martini.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/mickey.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/mouse.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/nobozos.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/nose.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/noseback.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/nosefront.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/nosmoking.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/porsche.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/stopsign.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/umbrella.xpm create mode 100644 vendor/x11iraf/xpm/icons/xpm3icons/wingdogs.xpm create mode 100644 vendor/x11iraf/xpm/misc.c create mode 100644 vendor/x11iraf/xpm/parse.c create mode 100644 vendor/x11iraf/xpm/rgb.c create mode 100644 vendor/x11iraf/xpm/scan.c create mode 100644 vendor/x11iraf/xpm/strdup.c create mode 100644 vendor/x11iraf/xpm/xpm.h create mode 100644 vendor/x11iraf/xpm/xpmP.h create mode 100644 vendor/x11iraf/xtapemon/Imakefile create mode 100644 vendor/x11iraf/xtapemon/Imakefile.orig create mode 100644 vendor/x11iraf/xtapemon/XTapemon.ad create mode 100644 vendor/x11iraf/xtapemon/XTapemon.ad.h create mode 100755 vendor/x11iraf/xtapemon/ad2c.sh create mode 100644 vendor/x11iraf/xtapemon/appres.h create mode 100644 vendor/x11iraf/xtapemon/classnames.c create mode 100644 vendor/x11iraf/xtapemon/classnames.h create mode 100644 vendor/x11iraf/xtapemon/gui2c.sed create mode 100644 vendor/x11iraf/xtapemon/patchlevel.h create mode 100644 vendor/x11iraf/xtapemon/types.c create mode 100644 vendor/x11iraf/xtapemon/types.h create mode 100644 vendor/x11iraf/xtapemon/xtapemon.c create mode 100644 vendor/x11iraf/xtapemon/xtapemon.h create mode 100644 vendor/x11iraf/xtapemon/xtapemon.man create mode 100644 vendor/x11iraf/xtapemon/xtapemon.ps create mode 100644 vendor/x11iraf/xtapemon/zzdebug.c (limited to 'vendor/x11iraf') diff --git a/vendor/x11iraf/.gdb_history b/vendor/x11iraf/.gdb_history new file mode 100644 index 00000000..8a50ea9f --- /dev/null +++ b/vendor/x11iraf/.gdb_history @@ -0,0 +1,31 @@ +b exit +b exit_ +b _exit +run +where +quit +b _exit +run -gui /tmp/zz.gui +where +run -gui /tmp/zz.gui +where +quit +run -display /tmp/zz.gui +b _exit +run -display /tmp/zz.gui +where +quit +b _exit +run -display /tmp/zz.gui +where +quit +b _exit +run +where +run +where +quit +b _exit +run +where +quit diff --git a/vendor/x11iraf/Imakefile b/vendor/x11iraf/Imakefile new file mode 100644 index 00000000..95538c40 --- /dev/null +++ b/vendor/x11iraf/Imakefile @@ -0,0 +1,162 @@ +## +## Imakefile for the X11IRAF Source Tree +## +## Mike Fitzpatrick, National Optical Astronomy Observatories, IRAF project. +## Aug 9 1996 + +#include + +#define IHaveSubdirs +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + +RELEASE = v2.0BETA2 + +LIBDIRS = obm xaw3d xpm cdl +APPDIRS = xgterm ximtool xtapemon obmsh vximtool +SUBDIRS = $(LIBDIRS) $(APPDIRS) + +all:: World + +World:: + @echo "Building the X11IRAF $(RELEASE) software tree" + @echo "" ; date ; echo "" + @echo "" + MakeDir (include) + MakeDir (app-defaults) + $(MAKE) $(MFLAGS) arch X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) Makefile X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) Makefiles X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) includes X11IRAFDIR=$$PWD +#if !defined (PpcDarwinArchitecture) && !defined (TenonServer) + $(MAKE) $(MFLAGS) depend X11IRAFDIR=$$PWD +#endif + $(MAKE) $(MFLAGS) libs X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) apps X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) install X11IRAFDIR=$$PWD + @echo "" ; date ; echo "" + @echo "Done." + +update:: + @echo "Updating the X11IRAF $(RELEASE) software tree" + @echo "" ; date ; echo "" + @echo "" + $(MAKE) $(MFLAGS) arch X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) Makefile X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) Makefiles X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) libs X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) apps X11IRAFDIR=$$PWD + $(MAKE) $(MFLAGS) install X11IRAFDIR=$$PWD + @echo "" ; date ; echo "" + @echo "Done." + +#if defined (PpcDarwinArchitecture) || defined (TenonServer) +libs:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(LIBDIRS) ;\ + do \ + (cd $$i ; echo "making" linklibs "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all linklibs); \ + done +#else +libs:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(LIBDIRS) ;\ + do \ + (cd $$i ; echo "making" linklibs "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all linklibs); \ + done +#endif + +apps:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(APPDIRS) ;\ + do \ + (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \ + done + +dirs:: + @echo "Creating Directories...." + $(MAKE) $(MFLAGS) arch + + +# Architecture branches. +alpha: + @(./mkarch alpha) +arch:: + @(./mkarch -current) +generic: + @(./mkarch generic) +cygwin: + @(./mkarch cygwin) +freebsd: + @(./mkarch freebsd) +hp700: + @(./mkarch hp700) +irix: + @(./mkarch irix) +linux: + @(./mkarch linux) +linuxppc: + @(./mkarch linuxppc) +macosx: + @(./mkarch macosx) +macintel: + @(./mkarch macintel) +mklinux: + @(./mkarch mklinux) +redhat: + @(./mkarch redhat) +rs6000: + @(./mkarch rs6000) +showarch:: + @(./mkarch -show) +sparc: + @(./mkarch sparc) +ssun: + @(./mkarch ssun) +sunos: + @(./mkarch sunos) +suse: + @(./mkarch suse) +ultrix: + @(./mkarch ultrix) +unknown: + @(./mkarch unknown) + + +BTARFILE = ../x11iraf-$(RELEASE)-bin.`./mkarch -arch`.tar + +DISTFILES = bin.`./mkarch -arch`/[a-z]* \ + lib.`./mkarch -arch`/libcdl.a \ + Notes-V2.0.txt \ + Revisions.v20 \ + include/cdl* \ + app-defaults \ + man \ + mkarch \ + README.install \ + install + +bindist:: + (./mkarch -current -noclean) + @(echo "Making tar file....$(BTARFILE)" ) + @(tar -cf $(BTARFILE) $(DISTFILES) ) + @(echo "Compressing files...." ; gzip $(BTARFILE) ) + @(echo "Done.") + + +archive:: + $(MAKE) $(MFLAGS) pristine + @(tar -cf - . | gzip > ../x11iraf-$(RELEASE)-src.tar.gz) + +pristine:: + $(MAKE) $(MFLAGS) clean + $(MAKE) $(MFLAGS) generic + $(RM) -rf bin.[a-fh-z]* lib.[a-fh-z]* \ + bin.tar* include app-defaults man *spool* Makefile makefile\ + Makefile.bak */Makefile */Makefile.bak */*/Makefile */*/Makefile.bak + +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) + diff --git a/vendor/x11iraf/Notes-V1.3.html b/vendor/x11iraf/Notes-V1.3.html new file mode 100644 index 00000000..810a1efe --- /dev/null +++ b/vendor/x11iraf/Notes-V1.3.html @@ -0,0 +1,1841 @@ + + + + + + + + +

+
+

X11IRAF V1.3 REVISIONS NOTES

+Last Modified: Mon Feb 4 16:33:02 MST 2002 + +
+ +

+
+
Table of Contents:
+
+ + + + +


+ +
+1. INSTALLATION CHANGES +
+ +

+ A new script automatically unpacks the distribution and installs +files in the system (or user's directories for a private install), provides +error checking and user interaction to skip parts of the process or change +defaults. The 'install' script is packaged with both source and binary +distribution files. To install for general use in the system directories +the script must be run as root user, it may be run by any user to install +to private directories. + +

+To install from an unpacked source distribution: + +

+     % xmkmf              build the package Makefile
+     % make World         build binaries from sources
+     % su                 become the root user
+     # ./install          install the files (interactive)
+
+ +

+Only the last two commands are required to install from an unpacked binary +distribution. + + +


+ +


+2. XIMTOOL REVISIONS +
+ +

+ Aside from general bug fixes most of the changes in this release +are all new features for XImtool. Details on individual features are +explained below, but in summary: + +

+ +

+ The most significant change in this version is the ability to +access the displayed image pixels or header data to produce the real-pixel +and WCS readouts. This is done using an external process called an ISM +(Image Support Module) which communicates with ximtool as a "plug-in" +module to enhance the features of the core program. In this case the ISM +is written as an IRAF task (although any application that can send text +over a socket can be used as an ISM regardless of the language/environment) +run at the host level with the ability to access any supported image format. +Any number of such ISM plug-ins can be developed to provide e.g. catalog +overlay, animation, and so on. + +

+ For the WCS/pixel ISM to operate properly changes to the display +protocol were required to pass the needed information. These changes are all +backwards compatible with "older" display servers however for the ISM to +work at all you will need to be running at least IRAF V2.12. Updates to +external packages using image display (notably MSCRED) have already been +completed. Details of the changes required are found in the technical notes +at the end of this document. + +

+ Users should feel free to contact IRAF site support (iraf@noao.edu) +with any questions. + + +


+ +


+ +2.1 Real-Time WCS/pixel Readout + + +

+ XImtool now has the ability to display the actual pixel value +of an image (as well as the scaled value previously shown) and the cursor +position in image WCS values (e.g. RA/DEC, GLAT/GLONG, etc). This is done +using an external task (the 'ism_wcspix.e' binary in the new distribution) +to access the image and pass the coordinate/pixel information to the GUI. +

+ WCS readout is enabled by default but can be toggled or reset +using the 'WCS/Pix' button on the Coords tab +in the control panel or the "ISM" toggle on the alt-gui +menubar. When enabled, images currently in the server or subsequently +displayed will be passed to the external process where they are cached for +access. Cursor movements generate an event that maps the current frame buffer +position to a position in the cached image. The ISM (ISM is Image +Support Module) task then reads the image to determine the pixel value +(or a small table of values around the current position), and computes one +or more coordinates from the image position. The ISM task also has access +to the associated BPM images and can optionally return bad pixel information +during the cursor readout. +

+ By default, the logical and world image coordinates are displayed +to both the Coords panel readout as well as the main display +window wcsbox text marker. Alternate coordinate systems (e.g. transformation +of equatorial to galactic coordinates or some other sky system, physical +coords, amplifier coords, etc) can be selected for display by hitting the +"Options" toggle on the Coords panel. +Available coordinate systems are chosen using the "Type" +menu on the panel, the readout format (sexigesimal, degrees, etc) using +the "Format" menu, and the display to the current panel or +main image window using the remaining toggles for each WCS. Up to four +systems may be displayed at one time, the coordinate panel and wcsbox marker +will adjust size automatically depending on the display. + +

+ By selecting the "BPM Data" toggle from the +Coords.Options panel ximtool is able to flag pixels in images +with an associated bad pixel mask. This bad pixel mask is currently assumed +to be named in the image header "BPM" keyword by convention. If the +cursor passes over a bad pixel in the mask, the Coords bpm +display as well as the main window wcsbox will change to a red background +color. Only the Coords display will show the value, any +non-zero value will be flagged with the color change. + +

+ With the ISM enabled the Compass indicator +will display a set of arrows showing North-East if a WCS is available, +otherwise just the current X-Y axes are shown. The pixel table will display +actual pixel values from the image, with the ISM off the pixel table +displays the scaled image values from the frame buffer. + + +


+ +


+ 2.2 "Peak-up" Cursor Centroid Positioning + +

+ Several new keystroke commands are available to reposition the +cursor to a centroid or min/max pixel value within a bounding box of the +cursor position, allowing you to approximate the position with the mouse +and fine tune it quickly before typing an application keystroke command. +The initial box size is controlled with a 'centerBoxSize' +GUI resource (defaults to 5 pixels) but can be adjusted interactively +using the Ctrl-[ and Ctrl-] commands to +descrease andincrease the box size respectively. A marker will flash briefly +to indicate the new box size. +

+ The Ctrl-0 (zero) key finds either a centroid or +the local maximum pixel value within this box region, Alt-Ctrl-0 +(zero) will find the local minimum value. In either case the cursor is +reposition to the computed value. The default peak-up action is to find +the centroid position in the box however this can be changed to find the +max pixel by selection the "Centroid Peaks" option from +the main Display control panel or by resetting the +"peakCentroid" GUI resource (defaults to True). + +

+ Centroiding is done using only the scaled screen pixel values and +only pixels above the mean value within the box are used. It works best +if the box size is set appropriately, the centroid position may appear to +drift if the box is too large and includes too many background pixels. + +

+ +
+2.2.1 Command Summary: + +

+        Ctrl-0 (zero)           Reposition to centroid/max-pixel
+    Alt-Ctrl-0 (zero)           Reposition to min-pixel
+        Ctrl-[                  Decrease centering box size (min of 5)
+        Ctrl-]                  Increase centering box size
+
+

+ +
+2.2.2 Resource Summary: + +

+        peakCentroid    True    Compute the box centroid position, a
+                                'False' value force the max value to be used
+        centerBoxSize   5       Size of the centroid box, used as cursor
+                                position +/- this value
+
+ + + +


+ +
+ 2.3 Auto-Registration of Images + + +

+ The auto-register feature allows you specify a registration of +two or more display frames with an offset. When enabled, this registration +is maintained for all frames in the list if any one of them is panned or +zoomed to a new location in the frame buffer. The list of frames to be +registered is maintained in the Display panel. + +

+For example, to use this feature do the following: + +

    +
  1. Enable Auto-Register (either on the + Display panel or the toolbar on the alt-gui) + and pan/zoom to some star of interest. +
  2. Use Mouse-Button-2 to center the star in the frame. +
  3. Cycle through the frames and you may see a small shift + of the star. For each frame, position the cursor on the + star and type Ctrl-o to offset it to the center. + Repeat as necessary. Small corrections will be cumulatively added + so you can use the Ctrl-0 peak-up command to + centroid each object in the frame before the Ctrl-o + offset. +
  4. Pan around the image in one display frame, then switch frames + and the new frame should also be panned to the new image with + the proper offset. +
  5. A Ctrl-a command will toggle the feature, offsets are + only allowed when Auto-Register is enabled. +
+ +

+ Hitting "Register" will zero the offsets, as will +toggling the auto-register function. What you should see is the object +centered in the frame and as you blink through it remains registered but +the panner box marker is moving around. Drag the panner around and all +frames still remain registered with the given offset. The control/info +panels also now display what the offset is for each frame. + +

+ The register display list is shared with the blink list and can +be set using the Display control panel. By default all +frames are included in the list. For accessing more than four frames, use +the box icon in the Blink/Register box of the +Display control panel to bring up a new window with access +to all 16 available frames. + +


+2.3.1 Command Summary: + +

+        Ctrl-o         set the offset from center
+        Ctrl-a         toggle the Auto-register feature
+
+ + + +


+ +
+2.4 Integrated Control Panel + +

+ The separate windows previous used for Control/Print/Load/Save/etc +have now been integrated into a single window with the appropriate control +panel selectable with a Tab widget. There are also new Tab +panels for setting the frame tile configuration (see below), more detailed +information on the server status, and selecting the WCS readout options +(see above). + +

+ All panels were updated as part of the integration, however some +changes of note to each panels include: + +

+ + +


+ +
+2.4.1 Load Panel Changes + + +

+ The Load panel was redesigned to make directory +navigation easier as well as to provide new features. The file list box +is now larger and implemented using a more natural directory listing format. +The filename filter box can now accept a comma-delimited list of templates +providing multiple matches to e.g. "*.fits" and "*.imh" images in the same +listing. Sub-directories are always listed in the output. + +

+A new options group was added to the panel with the following features: + +

+ +

+ + +


+ +
+2.4.2 Info Panel Changes + +

+ The Info panel was revised to provide a greater variety of status +information. The type of output is controlled by the toggle buttons on +the bottom of the frame, however all output is kept current as the program +runs. Current info options include: + +

+ + +


+ +
+2.4.3 Tile Panel (NEW) + +

+ With the additional frames in this release, the default tiling +scheme proved inadequate. A new control panel Tile frame +now allows you to select from a number of tile configurations, the list of +frames to be tiled, a "fill style" (left-to-right or top-to-bottom), as +well as optional labels for each of the tiles (frame number, image title +or image name). +

+Tile configuration will make use of all frames currently selected in the +"Tile Frame" group in the following manner: + +

+ + +


+ +
+2.4.4 Coords Panel (NEW) + +

+ The Coords Panel is meant to provide a full-featured readout as +well as serve as a control panel for the various options. The display +window contains the image name/title and frame buffer info, and a selection +of coordinate and image pixel readouts. The intent is provide more information +than can fit comfortably on the main image window while still +taking up as little screen space as possible. To this end the "Options" +button is used to hide most of the feature controls when not in use (see +below). Other options on the main panel include: + +

+ + The "Readout Values" group controls the selection +of WCS type, location and format to be displayed. The "Type" +menu always provides a selection of the image Logical, Physical +or World systems, which may be identical depending on the image +header. If a World system is supplied in the image addition entries +for transformations to other sky systems, (e.g. FK5 to ICRS or +galactic/ecliptic) will also be available. The selection is dependent on +whether the ISM is running as well as WCS information +present in the image. The "Format" menu allows the use to +select a sexigeimal display, conversion to degrees or radians, or whichever +format is most natural for the coordinate being display. The two toggles +to the right control whether this WCS is to be displayed on the +Panel (i.e. the Coords Panel window) or +the ImgWin (i.e. the text marker on the main image window). +

+ Other options below this group control whether or not to display the +WCS labels, the image name/title, and frame buffer information in the main +Coords Panel display. The "BPM Data" option +controls whether or not the ISM will try to map any bad-pixel mask +associated with the image. If enabled, a bad-pixel mask specified by the +image header BPM keyword (currently fixed by convention but this may +be selectable later) will be mapped along with the image. Aside from +wcs/pixel readouts at each cursor position, any BPM data values found will +also be displayed. A non-zero value will cause the BPM field of the +Coords Panel readout as well as the main image window marker +to switch to a red background color to flag the value. +

+ The last box allows the user to specify a different ISM task +to be executed or to reinitialize the current one. In most cases this +won't need to be changed, however a custom ISM could be started when +using special data formats. This command string can also be controlled by +the application "ism_task" resource. + + + +


+ +


+2.5 Support for 16 Display Frames + +

+ As part of the extensive GUI changes, support for the full 16 +frames allowed by the current IIS protocol is now available. IRAF V2.12 or +later client tasks (and CDL library) are required to take advantage of +these frames. All changes are backwards compatible, older versions of IRAF +will continue to work but cannot access more than the original four +frames. The new DISPLAY task will automatically sense +whether the display server being used supports 16 frames or the original +4 and adjust the 'frame' parameter maximum accordingly. The changes +are fully backwards compatible for other servers (e.g. SAOimage, +DS9, etc). +

+ More frames are possible if needed but will require further changes +to the client IRAF code to be effective. Allowing creation of more than +16 frames by the Load panel can be done independently but +would also require numerous code change to XImtool. Please contact +site support (iraf@noao.edu) if there is a need for this, or for workaround +suggestions depending on your application. + + + +


+ +


+2.6 Magnifier + +

+ The magnifier marker appears to be stable and was moved into the +default ximtool GUI and is now enabled by default. The ximtool-mag command +has been removed. + + +


+ +


+2.7 Freezing Cursor Readout + +

+ Holding down the Alt key will now freeze the cursor +display readout and draw crosshairs on the screen at the last position. +This can be used for example to position the cursor but then allow the cursor +to be moved to another window (to enter text, start a program, whatever) +without losing the position information displayed on the screen. + + +


+ +


+2.8 Cut-Graphs + +

+ XImtool now has the ability to display horizontal and vertical +cut-graphs of the display, these appear as "flip-out" panels that appear +on the bottom and right side of the main display window and are controlled +by the small "H" and "V" buttons in the lower +right corner of the window. When both panels are enabled the corner area +of the display also shows an options panel for the graphs. +Current options include: + +

+ +

+ Graphs are (currently) drawn using only the scaled display values +to avoid complications of accessing multiple images in a mosaic display. Both +plots are labeled using the frame z1/z2 values and contain cursor indicators +which update contuously. + + + +


+ +


+2.9 Ruler Markers + +

+ Holding down the Ctrl key and the +Left-Mouse-Button while moving the mouse will drag out +a "ruler marker" measuring the distance from the initial point to +the current mouse position. Releasing the Ctrl key before +lifting the mouse button will leave the marker on the display, otherwise +it will be erased automatically once the mouse button is released. Any +number of ruler markers can be created in the frame. +

+ Distances are measured by default in image logical pixels however +the Right-Mouse-Button can be used inside the marker to +popup a menu of options: + +

+ +

+The marker can also be destroyed by hitting the Delete +or Backspace key while the cursor is in the marker. There +is presently no way to move the marker to a new position in the frame. + + +


+ +


+2.10 Summary of Cursor Commands + +
+    * - indicates a new/changed command
+
+ + +Misc Functions +
+    Ctrl-b              Backward frame
+    Ctrl-c              Center frame
+    Ctrl-f              Forward frame
+    Ctrl-i              Invert
+    Ctrl-n              Normalize
+*   Ctrl-m              Toggle Magnifier
+*   Ctrl-p              Toggle Panner
+    Ctrl-r              Register
+*   Ctrl-s              Match LUTs
+    Ctrl-t              Tile frames toggle
+    Ctrl-u              Unzoom (zoom=1)
+    Ctrl-x              Flip X
+    Ctrl-y              Flip Y
+    Ctrl-=              Print
+    Ctrl-<              Decrease blink rate
+    Ctrl->              Increase blink rate
+    Ctrl-+              Zoom in
+    Ctrl--              Zoom out
+
+    Alt-1 thru Alt-4    Set frame displayed
+    Ctrl-1 thru Ctrl-9  Set integer zoom factor
+
+    Ctrl-Alt-q          Quit
+    Ctrl-Alt-f          Fitframe
+
+ +Panels +
+    Alt-b               Blink frames toggle
+    Alt-c               Control panel
+    Alt-h               Help panel
+    Alt-i               Info box panel
+    Alt-l               Load file panel
+    Alt-p               Print panel
+    Alt-s               Save panel
+    Alt-t               Tcl Shell panel
+
+ +Auto-Registration +
+*   Ctrl-a              Toggle Auto-Reg
+*   Ctrl-o              Set offset
+
+ +Cursor Positioning +
+*   Ctrl-h/Left_Arrow   move cursor 1 pixel left
+*   Ctrl-j/Down_Arrow   move cursor 1 pixel down
+*   Ctrl-k/Up_Arrorw    move cursor 1 pixel up
+*   Ctrl-l/Right_Arrow  move cursor 1 pixel right
+
+*   Shift-Ctrl-h        move cursor 10 pixels left
+*   Shift-Left          move cursor 10 pixels left
+*   Shift-Ctrl-j        move cursor 10 pixels down
+*   Shift-Down          move cursor 10 pixels down
+*   Shift-Ctrl-k        move cursor 10 pixels up
+*   Shift-Up            move cursor 10 pixels up
+*   Shift-Ctrl-l        move cursor 10 pixels right
+*   Shift-Right         move cursor 10 pixels right
+
+ +Frame Positioning +
+    Ctrl-Left           shift one full frame left
+    Ctrl-Down           shift one full frame down
+    Ctrl-Up             shift one full frame up
+    Ctrl-Right          shift one full frame right
+
+    Ctrl-Alt-Left       shift one half frame left
+    Ctrl-Alt-Down       shift one half frame down
+    Ctrl-Alt-Up         shift one half frame up
+    Ctrl-Alt-Right      shift one half frame right
+
+ +Peak-Up Centroiding +
+*   Ctrl-[              decrease centering box size
+*   Ctrl-]              inrease centering box size
+*   Ctrl-0 (zero)       centroid/find local max
+*   Alt-Ctrl-0 (zero)   find local min
+
+ +Mouse Button Actions +
+    Shift-Btn1Down      turn on magnifier
+    Shift-Btn1Up        turn off magnifier
+    Shift-Btn2Down      turn on crosshair cursor
+    Shift-Btn2Up        turn off crosshair cursor
+    Btn1Down            create marker
+    Btn1Motion          resize marker being created
+    Btn2Down            zoom on cursor position
+    Btn3Down/Motion     brightness/contrast scaling
+
+*   Ctrl-Btn1Down       create ruler marker
+*   Ctrl-Btn1Motion     resize ruler marker
+*   Ctrl-Btn1Up         destroy ruler marker
+
+*   Alt-Motion          freeze cursor readout
+
+ + +


+ +
+2.11 Summary of Application Resources + +

+ Following is a summary of the task client and GUI resources, along +with select resources defined for the main image display Gterm widget. All +GUI elements can be controlled to some exten with resource definitions +although not all resources are useful. Feel free to contact site-support +(iraf@noao.edu) with questions about how to change the appearance of the GUI. +Future versions of XImtool should feature a control panel to allow some of +these more critical resources to be redefined at runtime. +

+ Format for the listing is resource-name, default-value, and type, +with an optional note appended. See the man page or online help for a full +description of all resources. A '*' in the leftmost column indicates a new +resource added with this release, some resource apply only to the alternative +GUI. + + +Client Program Resources +

+    defConfig            1                              Int
+    defNFrames           0                              Int
+    tileBorderWidth      3                              Int
+    tileBorderColor      9                              Int
+    autoscale            False                          Boolean
+    antialias            False                          Boolean
+    antialiasType        boxcar                         String          (1)
+    tileFrames           False                          Boolean
+    highlightFrames      True                           Boolean
+    gui                  default                        String          (2)
+    imtoolrc             /usr/local/lib/imtoolrc        String
+    invert               False                          Boolean
+    memModel             Fast                           String          (3)
+    basePixel            64                             Int
+    maxColors            216                            Int
+    cmapInitialize       False                          Boolean
+    cmap1                none                           String          (4)
+    cmap2                none                           String          (4)
+    cmapDir1             none                           String          (5)
+    cmapDir2             /usr/local/lib/imtoolcmap      String          (5)
+    input_fifo           /dev/imt1i                     String          (6)
+    output_fifo          /dev/imt1o                     String          (6)
+    unixaddr             /tmp/.IMT%d                    String          (7)
+*   ism_addr             /tmp/.ISM%d                    String          (8)
+*   ism_task             "ism_wcspix.e wcspix &"        String          (9)
+
+ +

+ Notes: +

    +
  1. Options: nearest, bilinear, area, blkavg, boxcar, lowpass, gaussian +
  2. Either the string 'default' or the path to a valid GUI file +
  3. Options: fast, small, beNiceToServer +
  4. Name of a colormap file in the cmapDir[1|2] directory +
  5. Path to directory of valid colormaps +
  6. Path to FIFO pipe +
  7. Unix socket path, a '%d' is replaced with the uid +
  8. Unix socket path, a '%d' is replaced with the uid. This is the + socket used by plug-ins to negotiate a socket, once connected the + actual communications use a different socket. +
  9. Command used to start the default WCS/Pixel readout ISM task. +
+ +

+GUI Resources +
+    autoscale            True                           Boolean
+    zoomfactors          1 2 4 8                        String
+    displayCoords        True                           Boolean
+    displayPanner        True                           Boolean
+    displayMagnifier     False                          Boolean
+    blinkRate            1.0                            Real            (1)
+    pannerArea           150*150                        Geometry
+    pannerGeom           -5+5                           Geometry
+*   magnifierArea        100*100                        Geometry
+*   magnifierGeom        +5+5                           Geometry
+    wcsboxGeom           -5-5                           Geometry
+    maxContrast          5.0                            Real
+*   showToolBar          False                          Boolean
+*   showPanelBar         False                          Boolean
+    warnings             True                           Boolean
+*   centerBoxSize        5                              Int
+*   peakCentroid         True                           Boolean
+
+ +

+ Notes: +

    +
  1. Value represents blink rate in seconds +
+ + +

+Main Image Window (Gterm) Resources +
+    cmapName             image                          String          (1)
+    basePixel            64                             Int
+    warpCursor           True                           Boolean
+    raiseWindow          True                           Boolean
+    deiconifyWindow      True                           Boolean
+    ginmodeCursor        circle                         Cursor
+    ginmodeBlinkInterval 500                            Int             (2)
+    color0               Black                          Pixel
+    color1               White                          Pixel
+    background           Black                          Pixel
+    foreground           White                          Pixel
+    width                512                            Int
+    height               512                            Int
+
+ +

+ Notes: +

    +
  1. Any user-defined name is acceptable +
  2. Value represents blink rate in milliseconds +
+ + +


+ +
+2.12 Summary of Command-Line Options + +
+    -basePixel <num>                 Base colormap pixel
+    -cmap1 <file>                    User colormap 1
+    -cmap2 <file>                    User colormap 2
+    -cmapDir1 <dir>                  User colormap directory
+    -cmapDir2 <dir>                  Default colormap directory
+    -cmapInitialize <bool>           initialize colormap
+    -cmapName <name>                 Set Colormap name
+    -config <num>                    Set initial config number
+    -defgui                          Print default GUI and exit
+    -displayPanner <bool>            Display Panner box
+    -displayMagnifier <bool>         Display Magnifier box
+    -displayCoords <bool>            Display WCS Coords box
+    -fifo <pipe>                     Fifo pipe to use for connection
+    -fifo_only                       Use fifo only for display
+    -gui <file>                      GUI file
+    -help                            Print help
+    -imtoolrc <file>                 Set frame buffer configuration file
+    -inet_only | -port_only          Use inet only for display
+    -invert                          Start with inverted colormap 
+    -ismdev <dev>                    ISM device (socket) template 
+    -maxColors <num>                 Max number of image colors to allocate
+    -memModel <type>                 Memory model (fast|small|beNiceToServer)
+    -nframes <num>                   Number of frames to create at startup
+    -port <num>                      Set inet port to use for connection
+    -printConfig <name>              Set printer config file
+    -tile                            Start in tile-frames mode
+    -unix <name>                     Set unix socket to use for connection
+    -unix_only                       Use only unix socket for display
+    <file>                           File to load at startup
+
+ + + +


+ +
+3. OBM (WIDGET SERVER) REVISIONS +
+ + +


+3.1 New Widgets + +

+ As part of the OBM modifications two new widgets were added +to the toolkit. The widgets were also added to the LISTRES +application in the X11IRAF sources which can be consulted for a +complete list of resources. LISTRES is not normally built with the system +but is installed locally on the NOAO/IRAF development machines. To build +it yourself: + +

+        % cd /<path>/x11iraf/obm/listres        # go to the source directory
+        % xmkmf                                 # create the Makefile
+        % make listres                          # compile the task
+
+ +

+It may then be used as e.g. "listres <widget>" to print a full list of +resources for the named widget. + + +


+ +


+3.1.1 Tabs Widget + +

+ The Tabs widget is a composite widget providing an +"index tab" appearance to it's child widgets. The children will normally +be layouts of more complex panels such as is done for the XImtool +Control Panel. Only the children of the active Tab are visible, the +contents of other Tabs are not displayed until that Tab is raised by +selecting it with the mouse and the left mouse button. +

+ A new Widget class command was added to allow GUI control of the +active Tab (e.g. to programmatically raise a Tab). This command is of +the form + +

+        send <tab> setTop <name>
+
+ +

+where <tab> is the name of the Tab widget, +and <name> is the name of the child widget to be raised. +Only one Tab widget is required to handle child widgets, the Tabs will be +created automatically. +

+ The widget code was also modified slightly to allow specific +resource values to hide the appearance of the widget from the display, e.g. +to completely change the appearance of a panel's layout by invisibly raising +a different Tab. For instance, assuming we have a Tab widget called +'opPanels' with several child widgets containing layouts of other +widgets, the following resource settings will hide the parent Tabs widget: +

+

+    *opPanels.tabLabel:
+    *opPanels.font:                             nil2
+    *opPanels.height:                           0
+    *opPanels.width:                            0
+    *opPanels.borderWidth:                      65535
+    *opPanels.internalWidth:                    32765
+    *opPanels.internalHeight:                   32765
+
+ +

+Essentially we set NULL labels and sizes and values for the borderWidth +and internalHeight/Width that have the same bit pattern as a negative value +which internally means the borders are not drawn. The GUI callback code +can then use the setTop Widget method to raise the desired Tab meaning the +entire panel will change layouts automatically. This has advantages over +simply unmapping/mapping the layouts as it doesn't create a window resize +event which may cause the panel to "flash" during the change. +

+ An example GUI for this widget is in x11iraf$guidemo/tabs.gui + + +


+ +


+3.1.2 ListTree Widget + +

+ The ListTree widget provides a nested list of items, +where each item is either a terminal item in a list, or another list. Lists +may be "open" meaning their contents are displayed, or "closed" meaning +they are shown as an individual item. This widget can best be used to +represent e.g. contents of a directory or sections/subsections of a document. + +

+ A new Widget class command was added to allow GUI control of the +list contents. This command is of the form +

+

+        send <listree> setListTree <nested list>
+
+ +

+where <listree> is the name of the widget, +and <nested list> is a list of +items to be displayed. This list should be a valid Tcl list, where items +in the list may be lists themselves to produce the nested format. All +ListTree widget are initially presented with the embedded lists +"closed". There is presently no way to append the contents of the list, +the entire list must be redefined with the above command. For example, +the command +

+

+  send list setListTree {a1 {b1 { {a2 {a3 b3 c3 d3}} { b2 {z1 z2}} } } c1}
+
+

+would produce a nested list such as + +

+               a1
+               b1
+                 a2
+                   a3
+                   b3
+                 b2
+               c1
+
+ +

+Specifying the lists is a bit complex, but this widget is a nice way to +handle something like a table of contents in online documentation. + +

+ An example GUI for this widget is in x11iraf$guidemo/ltree.gui + + +


+ +


+3.2 Dynamic Widget Creation + +

+ In the original implementation of the OBM, the GUI is created or +defined using the 'appInitialize' and +'createObjects' server commands. appInitialize +initializes the X display but the 'resources' argument just sets the +fallback resources for the application. A 'createObjects' call +then queries the fallback resource database (either by a named resource o +the 'objects' resource by default) to get the widget tree and then parses +that as a string to actually create the widgets in the OBM. +

+ The initial example GUIs all defined an "objects" resource +as the way to define the widgets and all the subsequent GUI tasks followed +that form, however appInitialize requires only a string of resource +definitions ('object' resources or otherwise), and createObjects +can take an argument as to which resource value specifies the widgets to +create. For dynamic widget creation all that's really required is that we +have a way to append the fallback resource database with a new list of widgets. +

+ The solution then was implement a new 'appExtend' +server command that simply sends a new resource string to the OBM to be +merged into the fallback resource database. A plug-in would call this to +load the widgets, then call createObjects naming the resource +to realize the widgets. The new widgets are created as though they were +specified from the start and can receive messages, be destroyed, etc. +The appExtend server method essentially works by + +

    +
  1. getting the fallback resource database +
  2. convert resource string arg to a new resource database +
  3. combine the two resource databases +
  4. write the combined database back as the new fallback database +
+ +

+For example, the plug-in code for a "Hello, World" GUI panel would look +something like + +

+     appExtend {
+         *test_objects:\
+             toplevel        TopLevelShell   testPanel\
+             testPanel       Form            testForm\
+             testForm        Label           testLabel\
+             testForm        Command         testQuit
+     
+         *testLabel.label:                   Hello, world!
+         *testQuit.fromHoriz:                testLabel
+         *testQuit.label:                    Quit
+     }
+     createObjects test_objects
+     send testPanel map
+
+ +

+This code could be uploaded by an ISM plug-in and sourced as Tcl code +in a callback. It's also possible to define objects w/ existing parents +meaning a plug-in can add buttons to menubars or panels when they first +connect (e.g. a plug-in can add a new activation button for it to an +existing menubar on the GUI). +

+ The ability to dynamically create widgets means that plug-in modules +can create their own GUI components, but it also means that meta-widgets such +as Help panels, Image Display panels, etc can be recycled from a library of +code. To use this effectively, however, some rules need to be established +for an object naming convention, protocols for adding/deleting callbacks and +event handlers, and some method of object orientation is desired in the Tcl +code to make having multiple instances of a meta-widget in a GUI easier to +handle. These details are still largely TBD, the basic functionality now +exists in this version but may change as we take advantage of it and +implement new plug-in tasks or meta-widgets. + + +


+ +


+ +
+4. CLIENT DISPLAY LIBRARY (CDL) REVISIONS +
+ + +


+4.1 Display Protocol Changes + +

+ The IIS display protocol used was modified to conform to the XImtool +and IRAF changes implemented for the support of WCS mapping information. +These are detailed in section 5.1 below. +

+ Unlike the IRAF IMD interface changes though, the WCS version can +be determined when the CDL is first opened so no explicit call to query +this is required by CDL applications. Tasks may still set/retrieve mapping +information and assume this is handled automatically by the interface. +The hi-level routines for displaying FITS or IRAF images will also send the +mapping information automatically, it's only when using the low-level +cdl_displayPix() routine or setting the WCS explicitly where the mappings +need to be set by the application. + +

+ Changes remain completely backwards compatible so client tasks need +to be modified only to support the new XImtool features. + + +


+ +


+4.2 New Procedures + +

+ Three new public interface procedures were added in addition to the +internal changes made to support image mappings: + +

+ + +


+ +
+4.2.1 C Calling Sequence + +

+

+ valid = cdl_setMapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref)
+  stat = cdl_getMapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref)
+stat = cdl_queryMapping (cdl, wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref)
+
+ +

+Where the arguments are defined as + +

+    cdl               - CDL package pointer returned by cdl_open()
+    region            - user-defined name for the region (e.g. 'image',
+                        'subras1', 'ccd3', etc).
+    sx, sy, snx, sny  - source rect in the object
+    dx, dy, dnx, dny  - destinaton rect in the display frame buffer
+    ref               - full node!/path/image[sec] image name, same as
+                        was immap'd when the image was displayed.  Used
+                        for access after the display
+    wcs               - WCS number for a specified mapping
+
+ + + +


+ +
+4.2.2 F77 Calling Sequence + +
+           cfsetmapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier)
+           cfgetmapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier)
+         cfquerymapping (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier)
+
+ +

+Where the arguments are defined as above +and 'ier' is an error status code. + + +


+ +


+4.2.3 SPP Calling Sequence + +
+         cdl_setMapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier)
+         cdl_getMapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier)
+       cdl_queryMapping (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier)
+
+ +

+Where the arguments are defined as above +and 'ier' is an error status code. + + +


+ +


+4.3 Demo Task Updates + + + + +
+


+ +
+5. TECHNICAL NOTES +
+ +


+5.1 IIS Protocol Changes + +

+ For backwards compatability none of the existing IIS protocols were +modified completely, however we take advantage of unused registers to flag +the new features in existing functions (like read/write WCS). The WCS mapping +changes required only that the unused 'x' register be set to indicate +the new behavior was desired, e.g. the wcs text containing the extra mapping +data. +

+ We also added two new WCS calls that allow us to query the WCS version, +or query a WCS by a specific number corresponding to a mapping. The WCS +version query will return a string such as "version=10" which can be parsed +by the client to get a version number '10' (corresponding to version 1.0). +

+ Because of the added mapping text the WCS string length was increased +from 320 to 1024 bytes, the string length used internally depends on whether +the 'x' register has been set. +

+ Support for the full 16 frames allowed by the bit-flag 'z' +register in the IIS header packet required the masking values be changed at +various places in the code. This was more a limitation of the initial +implementation than a required change to the protocol. +

+ A complete summary of the XImtool IIS protocol implementation follows. + + +


+ +


+5.1.1 IIS Protocol Summary + +

+

+                                   IIS Header Packet Summary
+
+                      TID            Subunit     Tct   X   Y    Z   T    Data
+              +------------------+-------------+-----+---+---+----+---+--------+
+Read Data     | IIS_READ|PACKED  | MEMORY      | -NB | x | y | fr | - | nbytes |
+Write Data    | IIS_WRITE|PACKED | MEMORY      | -NB | x | y | fr | - | nbytes |
+Read Cursor   | IIS_READ         | IMCURSOR    |  -  | - | - | wcs| - | -      |
+Write Cursor  | IIS_WRITE        | IMCURSOR    |  -  | x | y | wcs| - | -      |
+Set Frame     | IIS_WRITE        | LUT|COMMAND | -1  | - | - | -  | - | 2      |
+Erase Frame   | IIS_WRITE | fb   | FEEDBACK    |  -  | - | - | fr | - | -      |
+              |                  |             |     |   |   |    |   |        |
+Old Read WCS  | IIS_READ         | WCS         |  -  | - | - | fr | - | 320    |
+Old Write WCS | IIS_WRITE|PACKED | WCS         | -N  | - | - | fr |fb | 320    |
+              |                  |             |     |   |   |    |   |        |
+WCS Version?  | IIS_READ         | WCS         |  -  | 1 | 1 | -  | - | 320    |
+WCS by Num.?  | IIS_READ         | WCS         |  -  | 1 | - | fr |wcs| 1024   |
+New Read WCS  | IIS_READ         | WCS         |  -  | 1 | - | fr | - | 1024   |
+New Write WCS | IIS_WRITE|PACKED | WCS         | -N  | 1 | - | fr |fb | 1024   |
+              +------------------+-------------+-----+---+---+----+---+--------+
+
+ + +

+Where +

+        nbytes | NB  = number of bytes expected or written
+        x            = x position of operation in frame buffer coords
+        y            = y position of operation in frame buffer coords
+        fr           = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc)
+        fb           = frame buffer config number (zero indexed)
+        N            = length of WCS string
+        wcs          = WCS number (usually zero)
+        Data         = the number of bytes of data to be read or written
+                        following the header packet.
+
+        IIS_WRITE    = 0400000
+        IIS_READ     = 0100000
+        COMMAND      = 0100000
+        PACKED       = 0040000
+        IMC_SAMPLE   = 0040000
+
+        MEMORY       = 001
+        LUT          = 002
+        FEEDBACK     = 005
+        IMCURSOR     = 020
+        WCS          = 021
+
+ + + +


+ +
+5.2 IRAF 'imd' Interface Changes. + +

+ In order for the XImtool ISM task map exactly the same image that +was passed into the task displaying the image (i.e. the fully qualified +node!path prefix including any image section or kernel args). It was +necessary to modify the IIS SetWCS command to contain extra information +at the end of the normal WCS text. This is passed from XImtool to the ISM +at the time of the display if an ISM is already running, or when the ISM +first connects thereafter. + +

+ To maintain complete backwards compatability it is not possible to +bury this change in the internals of the interface, therefore it will be +necessary for all tasks using the IMD interface to display images to make +revisions to use the new features. Tasks which are not changed will continue +to work, XImtool will simply disable the ISM when the display client connects +without indicating it is able to pass mapping information. Client tasks, +modified or not, will also continue to work when connecting to "mapping +unaware" display servers since the interface only send the extra mapping +information to servers which are expecting it. + +

+ To modify a task to make use these changes, there are just a few +routines you need to be aware of: + +

+

+    imd_wcsver()  - Query the server for new capabilities.  Returns a
+                    non-zero version if the server can use the new
+                    mapping functionality.
+
+imd_setmapping()  - Set mapping data to be sent with next imd_putwcs() call
+
+imd_getmapping()  - Get mapping data returned with last imd_getwcs() call.
+                    returns a non-zero status if valid mapping available
+
+ imd_query_map()  - Given a WCS number return the mapping data.  Returns a
+                    non-zero status if valid mapping available
+
+ +

+where the calling sequence is + +

+         imd_setmapping (reg, sx,sy,snx,sny, dx,dy,dnx,dny, objref)
+ valid = md_getmapping (reg, sx,sy,snx,sny, dx,dy,dnx,dny, objref)
+ status = md_query_map (wcs, reg, sx,sy,snx,sny, dx,dy,dnx,dny, objref)
+   version = md_wcsver ()
+
+ +

+In order to maintain compatability with existing servers as well as take +advantage of the new ximtool features, the idea is that all interfaces will +remain the same and any program wishing to use these features will need a +slight modification to 1) determine whether mappings are supported via a +call to imd_wcsver(), and 2) use the new imd_[sg]etmapping() +procedures to set and retrieve the mapping information. imd_query_map() +can be used to query for the mapping using the wcs number returned from +e.g. a cursor read. Details and examples of these modifications are +included below. + + +


+ +


+5.2.1 Program Initialization + +

+ For a program to use mappings it must first query the server to see +if this is supported, the reply also serves to initialize the imd interface. +This is done using the imd_wcsver() call. For example, in the DISPLAY +task during startup one would do something like + +

+        # Query server to get the WCS version, this also tells us whether
+        # we can use the all 16 supported frames.
+        if (imd_wcsver() == 0)
+            call clputi ("display.frame.p_max", 4)
+        else
+            call clputi ("display.frame.p_max", 16)
+
+ +

+The call to imd_wcsver() in this case is used to reset the number of +allowed frames depending on the server capabilities. + +

+ This call is REQUIRED before mappings can be used by the +interface. Internally, the interface defaults to a "version" of zero +meaning the server does not support mappings, once the procedure is called +the server reply value is stored in the interface common and returned as +the function value. The return value is always an integer, zero means the +server does not support mappings and a non-zero value is the WCS version +number of the display change (e.g. a value of 10 is version 1.0, 11 is 1.1, +etc). +

+ A 'disable_wcs_maps' boolean environment variable +can be set by the user to force this procedure to always return zero and +disable mappings in case a problem is found after release or the old behavior +is desired. + + +


+ +


+5.2.2 WCS Text Changes + +

+ Without getting into the details, if a server is found to be capable +of using mappings in the imd_wcsver() call, the WCS string sent/read +will have two additional lines of information to define the mapping. +Specifically, +

+        name - title\n
+        a b c d tx ty z1 z2 zt\n
+        region_name sx sy snx sny dx dy dnx dny\n
+        object_ref
+
+ +

+where the new parameters are defined as + +

+    region_name       - user-defined name for the region (e.g. 'image',
+                        'subras1', 'ccd3', etc).
+    sx, sy, snx, sny  - source rect in the object
+    dx, dy, dnx, dny  - dest rect in the display frame buffer
+    object_ref        - full node!/path/image[sec] image name, same as
+                        was immap'd when the image was displayed.  Used
+                        for access after the display
+
+

+ Since the interfaces remain the same a separate imd_setmapping() +or imd_getmapping() call is required to set/get the additional mapping data. +For example, to set the WCS: +

+

+    # Set the mapping info to be written with the WCS.
+    call imd_setmapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, objref)
+
+    # Write the WCS and mapping info to the data.
+    call imd_putwcs (ds, frame, Memc[imname], Memc[title],
+        a, b, c, d, tx, ty, W_ZS(wdwin), W_ZE(wdwin), W_ZT(wdwin))
+
+ + +

+To read the frame WCS: + +

+    # Query the server for a wcs.
+ if (imd_getwcs (frame, server, image, sz_image, title, sz_title, + a,b,c,d, tx,ty) == OK) { + + # If we got that okay, get the mapping information returned. + if (imd_getmapping (reg, sx,sy,snx,sny, dx,dy,dnx,dny, obj) > 0) { + : + } + } +
+ +

+In all cases if the imd_wcsver() initialization says the server can't +do mappings these calls will be no-ops. + +

+ For multiple-image displays to a single frame it's important to +remember that the default WCS for the frame will be the *last* +WCS set by the client. For example, a mosaic display can set a wcs and mapping +for each of the subrasters, but a final SetWCS call is required to define +an overall WCS for the frame defining the "detector coords". Note that the +'objref' string should include the MEF extension number so it's mapped +properly by the ISM. + + +


+ +


+5.2.3 Cursor Reads + +

+ The imd_query_map() procedure is used to return the mapping +for a particular WCS number, such as that returned by a cursor read. It +will do a new WCS query for this regardless of a previous imd_getwcs() +call. Typical usage would be something like the following in IMEXAMINE: + +

+procedure t_imexamine ()
+        :
+begin
+        :
+    wcsver = imd_wcsver()
+        :
+        :
+    while (ie_gcur (ie, curtype, x,y,wcs, key, cmd, SZ_LINE) != EOF) {
+        if (imd_query_map (wcs,reg,sx,sy,snx,sny,dx,dy,dnx,dny,imname) > 0) {
+            .... add image name to list
+        }
+    }
+        :
+end
+
+ +

+[NOTE: in this example the ie_gcur() procedure was modified to return the + wcs from the cursor read.] +

+ +

+The WCS number returned by a cursor read now corresponds to the object id +used in the server. It still contains the frame number as before, but the +wcs number itself is used to identify the mapping. + + +


+ +


+5.3 ISM Communications + +

+ The ISM (Image Support Module) can be any external task which +connects to XImtool over a socket. Communications are limited to simple +null-terminated text strings. In most cases these strings are just the +standard OBM messages sent to XImtool objects but can also include Tcl +callback code (either ISM-specific callbacks, procedures which can be +added to the callback list for existing XImtool objects, or even new GUI +code to create panels and new objects). + + +


+ +


+5.3.1 Socket Connection + +

+ The ISM first requests a connection to XImtool on a dedicated +socket whose default value is "/tmp/.ISM%d", where the '%d' +is replaced by the userid allowing multiple users on a machine to have +independent sockets. The XImtool 'ism_addr' resource or +"-ismdev" command-line option can be used to change this +address, a value of 'none' will disable ISM communications. The +socket may also be set with an ISMDEV environment variable which will +override the resource or command-line options. +

+ Once a connection request is received, XImtool replies with +a message telling the ISM to reconnect on a different socket, it then +frees the initial connection allowing multiple other ISMs to request +their own connection. The communications between XImtool and the ISM +are carried out entirely over this second negotiated socket. Once connected, +the ISM appears as just another named object which can receive OBM messages. + + +


+ +


+5.3.1 Communications Protocol + +

+ Messages from the ISM are written to the connection socket and must +be preceeded by one of the following keywords: + +

+    callback            Negotiate a connection on another socket
+    ready               Client is ready to begin processing
+    quit                Client is shutting down and disconnecting
+    send                Send a message to another object
+
+ + +

+Messages are of the form: + +

+ +

+All messages must be null-terminated. XImtool will buffer the text until +a complete message is received. Once an ISM client has delivered a +QUIT message no further messages will be sent the that ISM. +

+ In OBM terminology the ISM is a named Client class object, where +the name is set in the connection request. Messages sent to the ISM should +use this name, messages sent to "client" are still interpreted to mean the +XImtool client. +

+ The content of messages delivered to the ISM are totally free-form +and may contain any text the ISM is expected to understand. + + +


+ +


+5.3.3 GUI Objects + +

+ While the ISM can send a message to any object in the task, there +is a GUI Parameter object called 'ism_msg' designed especially to process +messages from the ISM. The callback in the GUI is expecting a message +beginning with one of the following keywords: + +

+    source        Source message text as Tcl code
+    alert         Message contains error text to be displayed in the
+                  GUI 'alert' box
+    deliver       Message text should be passed to a callback routine
+                  specific to that ISM.  This processing callback may
+                  have been previously uploaded.  The message text
+                  may be any form the processing callback is expected
+                  to understand.
+    info          Message text is status output intended for the
+                  XImtool 'info' panel (connect/disconnect requests, etc)
+
+ + +

+In all cases the message is expected to be of the form + +

+      <cmd> <ism_name> [ <arg1> <arg2> <...> ]
+
+ +

+where <cmd> is one of the above keywords, <ism_name> is the name of the +ISM sending the message. The remainder of the message is passed as an 'argv' +list to the processing callback uploaded for the ISM. The ISM is responsible +for formatting these messages. + + + + + diff --git a/vendor/x11iraf/Notes-V1.3.txt b/vendor/x11iraf/Notes-V1.3.txt new file mode 100644 index 00000000..bd708235 --- /dev/null +++ b/vendor/x11iraf/Notes-V1.3.txt @@ -0,0 +1,1472 @@ + + X11IRAF V1.3 REVISIONS NOTES + ============================ + +------------------------------------------------------------------------------- + Last Modified: Mon Feb 4 14:29:30 MST 2002 +------------------------------------------------------------------------------- + +Table of Contents: +------------------ + + 1. Installation Changes + + 2. XImtool Revisions + 2.1 Real-Time WCS/pixel Readout + 2.2 "Peak-up" Cursor Centroid Positioning + 2.2.1 Command Summary + 2.2.2 Resource Summary + 2.3 Auto-Registration of Images + 2.3.1 Command Summary + 2.4 Integrated Control Panel + 2.4.1 Load Panel Changes + 2.4.2 Info Panel Changes + 2.4.3 Tile Panel (NEW) + 2.4.4 Coords Panel (NEW) + 2.5 Support for 16 Display Frames + 2.6 Magnifier + 2.7 Freezing Cursor Readout + 2.8 Cut-Graphs + 2.9 Ruler Markers + 2.10 Summary of Cursor Commands + 2.11 Summary of Application Resources + 2.12 Summary of Command-Line Options + + 3. OBM (Widget Server) Revisions + 3.1 New Toolkit Widgets + 3.1.1 Tabs Widget + 3.1.2 ListTree Widget + 3.2 Dynamic Widget Creation + + 4. Client Display Library (CDL) Revisions + 4.1 Display Protocol Changes + 4.2 New Procedures + 4.2.1 C Calling Sequence + 4.2.2 F77 Calling Sequence + 4.2.3 SPP Calling Sequence + 4.3 Demo Task Updates + + 5. Technical Notes + 5.1 IIS Protocol Changes + 5.1.1 IIS Protocol Summary + 5.2 IRAF 'imd' Interface Changes. + 5.2.1 Program Initialization + 5.2.2 WCS Text Changes + 5.2.3 Cursor Reads + 5.3 ISM Communications + 5.3.1 Socket Connection + 5.3.2 Communications Protocol + 5.3.3 GUI Objects + +------------------------------------------------------------------------------- + + + +1. INSTALLATION CHANGES +======================= + + A new script automatically unpacks the distribution and installs +files in the system (or user's directories for a private install), provides +error checking and user interaction to skip parts of the process or change +defaults. The 'install' script is packaged with both source and binary +distribution files. To install for general use in the system directories +the script must be run as root user, it may be run by any user to install +to private directories. + +To install from an unpacked source distribution: + + % xmkmf build the package Makefile + % make World build binaries from sources + % su become the root user + # ./install install the files (interactive) + +Only the last two commands are required to install from an unpacked binary +distribution. + + + +2. XIMTOOL REVISIONS +===================== + + Aside from general bug fixes most of the changes in this release +are all new features for XImtool. Details on individual features are +explained below, but in summary: + + - real-time cursor image WCS and actual pixel readout + - new cursor centroiding function + - ability to "auto-register" frames + - integrated/enhanced control panel + - support for up to 16 display frames + - improved support for image tiling + - a "compass" indicator for the display orientation + - pixel table readout + - image header display (keyword selection, WCS display) + - horizontal/vertical cut-graphs of the display + - ruler markers on the display + - control port for external process communications + + + The most significant change in this version is the ability to +access the displayed image pixels or header data to produce the real-pixel +and WCS readouts. This is done using an external process called an ISM +(Image Support Module) which communicates with ximtool as a "plug-in" +module to enhance the features of the core program. In this case the ISM +is written as an IRAF task (although any application that can send text +over a socket can be used as an ISM regardless of the +language/environment) run at the host level with the ability to access any +supported image format. Any number of such ISM plug-ins can be developed +to provide e.g. catalog overlay, animation, and so on. + + For the WCS/pixel ISM to operate properly changes to the display +protocol were required to pass the needed information. These changes are all +backwards compatible with "older" display servers however for the ISM to +work at all you will need to be running at least IRAF V2.11.4. Updates to +external packages using image display (notably MSCRED) have already been +completed. Details of the changes required are found in the technical notes +at the end of this document. + + Users should feel free to contact IRAF site support (iraf@noao.edu) +with any questions. + + +------------------------------------------------------------------------------ + + + Detailed Revisions Notes + ======================== + + +2.1 Real-Time WCS/pixel Readout +================================ + + XImtool now has the ability to display the actual pixel value of +an image (as well as the scaled value previously shown) and the +cursor position in image WCS values (e.g. RA/DEC, GLAT/GLONG, etc). This +is done using an external task (the 'ism_wcspix.e' binary in the new +distribution) to access the image and pass the coordinate/pixel info- +rmation to the GUI. + + WCS readout is enabled by default but can be toggled or reset +using the 'WCS/Pix' button on the Coords tab in the control panel or the +"ISM" toggle on the alt-gui menubar. When enabled, images currently in +the server or subsequently displayed will be passed to the external +process where they are cached for access. Cursor movements generate an +event that maps the current frame buffer position to a position in the +cached image. The ISM (ISM is Image Support Module) task then reads the +image to determine the pixel value (or a small table of values around the +current position), and computes one or more coordinates from the image +position. The ISM task also has access to the associated BPM images and +can optionally return bad pixel information during the cursor readout. + + By default, the logical and world image coordinates are displayed +to both the Coords panel readout as well as the main display window wcsbox +text marker. Alternate coordinate systems (e.g. transformation of +equatorial to galactic coordinates or some other sky system, physical +coords, amplifier coords, etc) can be selected for display by hitting the +"Options" toggle on the Coords panel. Available coordinate systems are +chosen using the "Type" menu on the panel, the readout format +(sexigesimal, degrees, etc) using the "Format" menu, and the display to +the current panel or main image window using the remaining toggles for +each WCS. Up to four systems may be displayed at one time, the coordinate +panel and wcsbox marker will adjust size automatically depending on the +display. + + By selecting the "BPM Data" toggle from the Coords.Options panel +ximtool is able to flag pixels in images with an associated bad pixel mask. +This bad pixel mask is currently assumed to be named in the image header +"BPM" keyword by convention. If the cursor passes over a bad pixel in the +mask, the Coords bpm display as well as the main window wcsbox will change +to a red background color. Only the Coords display will show the value, +any non-zero value will be flagged with the color change. + + With the ISM enabled the Compass indicator will display a set of +arrows showing North-East if a WCS is available, otherwise just the +current X-Y axes are shown. The pixel table will display actual pixel +values from the image, with the ISM off the pixel table displays the +scaled image values from the frame buffer. + + + +2.2 "Peak-up" Cursor Centroid Positioning +========================================== + + Several new keystroke commands are available to reposition the +cursor to a centroid or min/max pixel value within a bounding box of the +cursor position, allowing you to approximate the position with the mouse +and fine tune it quickly before typing the application keystroke command. +The initial box size is controlled with a 'centerBoxSize' GUI resource +(defaults to 5 pixels) but can be adjusted interactively using the Ctrl-[ +and Ctrl-] commands to descrease/increase the box size respectively. A +marker will flash briefly to indicate the box size. + + The Ctrl-0 (zero) key finds either a centroid or the local maximum +pixel value within this box region, Alt-Ctrl-0 (zero) will find the local +minimum value. In either case the cursor is reposition to the computed +value. The default peak-up action is to find the centroid position in the +box however this can be changed to find the max pixel by selection the +"Centroid Peaks" option from the main Display control panel or by resetting +the "peakCentroid" GUI resource (defaults to True). + + Centroiding is done using only the scaled screen pixel values and +only pixels above the mean value within the box are used. It works best +if the box size is set appropriately, the centroid position may appear to +drift if the box is too large and includes too many background pixels. + + + 2.2.1 Command Summary: + ---------------------- + + Ctrl-0 (zero) Reposition to centroid/max-pixel + Alt-Ctrl-0 (zero) Reposition to min-pixel + Ctrl-[ Decrease centering box size (min of 5) + Ctrl-] Increase centering box size + + 2.2.2 Resource Summary: + ----------------------- + + peakCentroid True Compute the box centroid position, a + 'False' value force the max value to be used + centerBoxSize 5 Size of the centroid box, used as cursor + position +/- this value + + + +2.3 Auto-Registration of Images +================================ + + The auto-register feature allows you specify a registration of +two or more display frames with an offset. When enabled, this registration +is maintained for all frames in the list if any one of them is panned or +zoomed to a new location in the frame buffer. + +For example, to use this feature do the following: + + 1) Enable Auto-Register (either on the Control Panel or the tool- + bar on the alt-gui) and pan/zoom to some star of interest. + 2) Use Mouse-Button-2 to center the star in the frame. + 3) Cycle through the frames and you may see a small shift + of the star. For each frame, position the cursor on the + star and type Ctrl-o to offset it to the center. Repeat + as necessary. Small corrections will be cumulatively added + so you can use the Ctrl-0 peak-up command to centroid each + object in the frame before the Ctrl-o offset. + 4) Pan around the image in one display frame, then switch frames + and the new frame should also be panned to the new image with + the proper offset. + 5) A Ctrl-a command will toggle the feature, offsets are only + allowed when autoreg is enabled. + + Hitting "Register" will zero the offsets, as will toggling the +auto-register function. What you should see is the object centered in +the frame and as you blink through it remains registered but the panner +box marker is moving around. Drag the panner around and all frames +still remain registered with the given offset. The control/info panels +now display what the offset is for each frame. + + The register display list is shared with the blink list and can +be set using the Display control panel. By default all frames are included +in the list. For accessing more than four frames, use the box icon in +the Blink/Register box of the Display control panel to bring up a new window +with access to all 16 available frames. + + + 2.3.1 Command Summary: + ----------------------- + + Ctrl-o set the offset from center + Ctrl-a toggle the Auto-register feature + + + +2.4 Integrated Control Panel +============================= + + The separate windows previous used for Control/Print/Load/Save/etc +have now been integrated into a single window with the appropriate control +panel selectable with a Tab widget. There are also new Tab panels for +setting the frame tile configuration (see below), more detailed information +on the server status, and selecting the WCS readout options (see above). + + All panels were updated as part of the integration, however some +changes of note to each panels include: + + Display + + View box + - supports 16 frames + - Frame offset added to readout + + Blink/Register + - new box icon button brings up independent control panel w/ + access to all 16 frames + + Options + - addition of "Magnifier" and "Centroid Peaks" options + Print + + Postscript Options + - added B5 paper size as option + Load + + Complete redesign of panel (see below) + + New options group (see below) + + Filename filter accepts a comma-delimited list of templates + Save + + EPS added a save format, saves image w/ no annotation + Info + + Complete redesign of panel (see below) + Tile + + New panel allowing configuration of tile frame layout (see below) + Coords + + New panel allowing selection of WCS readout options (see below) + + +2.4.1 Load Panel Changes +------------------------- + + The Load panel was redesigned to make directory navigation easier +as well as to provide new features. The file list box is now larger and +implemented using a more natural directory listing format. The filename +filter box can now accept a comma-delimited list of templates providing +multiple matches to e.g. "*.fits" and "*.imh" images in the same listing. +Directories are always listed in the output. + +A new options group was added to the panel with the following features: + + Auto Load + If enabled, selecting an image name from the list will force it + to the display automatically. Otherwise the Load button at the + bottom of the panel must be used to load the image. Specifying + a filename in the "Load File" text box will load that image either + with a CR or using the panel Load button. + + Auto Grayscale + If enabled, color images (e.g. GIF) are converted to grayscale + automatically, otherwise a private colormap is loaded for the image. + + List Image Headers + If enabled the file list will change to display only the matching + image names along with the pixel size, image size, and optional + title string. Directory navigation is disabled until this option + is turned off. MEF FITS files will be listed with the number + of extensions they contain but cannot be loaded. + + Frame + Select the frame in which to display the image. The special + value "Current" is used to display to whichever is the current + display frame, otherwise any of 16 available frames may be selected. + + Zscale Options + The remaining options can be used to specify the z-scale parameters + used when loading the image. The algorithm works as follows: + + if (zscale enabled) + determine optiminal z1/z2 given 'Nsample' points + else if (zrange enabled) + use image min/max as z1/z2 + else + use panel z1/z2 values + + To load 8-bit data directly the 'zscale' option should be disabled. + + +2.4.2 Info Panel Changes +------------------------- + The Info panel was revised to provide a greater variety of status +information. The type of output is controlled by the toggle buttons on +the bottom of the frame, however all output is kept current as the program +runs. Current info options include: + + Frame - Info about the current display frame + Server - Info about various server options, e.g. colormaps, + memory model, antialias type, etc. + Clients - Show currently connected clients. Lists available + connection channels and active ISM clients. + WCS - List all WCS and mappings for the current frame + ISM - Log of various ISM status messages + Imtoolrc - Show current frame buffer configuration table + + +2.4.3 Tile Panel (NEW) +----------------------- + + With the additional frames, the default tiling scheme proved in- +adequate. A new control panel Tile frame now allows you to select from +a number of tile configurations, the list of frames to be tiled, a "fill +style" (left-to-right or top-to-bottom), as well as optional labels for +each of the tiles (frame number, image title or image name). + +Tile configuration will make use of all frames currently selected in the +"Tile Frame" group in the following manner: + + Disabled Do not tile the display + Manual Tile according to "Manual Configuration" settings + Best Optimize layout for frame buffer aspect + Square Always force a square layout (2x2, 3x3, etc) + Horizontal Preferentially tile horizontally (6 frames ==> 3x2) + Vertical Preferentially tile vertically (6 frames ==> 2x3) + One Row Tile all in one row (Nx1) + One Column Tile all in one column (1xN) + + +2.4.4 Coords Panel (NEW) +------------------------- + + The Coords Panel is meant to provide a full-featured readout as +well as serve as a control panel for the various options. The display +window contains the image name/title and frame buffer info, and a selection +of coordinate and image pixel readouts. The intent is provide more infor- +mation than can fit comfortably on the main image window while still +taking up as little screen space as possible. To this end the "Options" +button is used to hide most of the feature controls when not in use (see +below). Other options on the main panel include: + + WCS/Pix Toggle the real-time WCS/pixel readout capability + (i.e. the ISM used to access the disk image). This + must be enabled for certain other options to work. + + Pix Table Open a panel showing an image pixel table. The panel + shows an array of pixels surrounding the cursor position, + either the actual pixel values if the ISM is enabled, or + scaled display values otherwise. The size of the table + may be selected from the menubar. + + Header Display the current image header in a new panel. Both + the entire image header as well as WCS-specific parts of + the header are available under different tabs. This + option is only active when the ISM is enabled. + + Compass Draw an orientation compass on the display panner. If + the ISM is enabled and a WCS is present in the header, + the compass will indicate N/E according to the WCS, other- + wise the X/Y axes of the image are drawn. + + Options Pop-up/down the option control portion of the panel. When + enabled, the Coords Panel will change size to reveal the + options which can be changed (explained below). + + The "Readout Values" group controls the selection of WCS type, +location and format to be displayed. The "Type" menu always provides a +selection of the image Logical, Physical or World systems, which may be +identical depending on the image header. If a World system is supplied in +the image addition entries for transformations to other sky systems, (e.g. +FK5 to ICRS or galactic/ecliptic) will also be available. The selection +is dependent on whether the ISM is running as well as WCS information +present in the image. The "Format" menu allows the use to select a +sexigeimal display, conversion to degrees or radians, or whichever format +is most natural for the coordinate being display. The two toggle to the +right control whether this WCS is to be displayed on the Panel (i.e. the +Coords Panel window) or the ImgWin (i.e. the text marker on the main +image window). + + Other options below this group control whether or not to display the +WCS labels, the image name/title, and frame buffer information in the main +Coords Panel display. The "BPM Data" option controls whether or not the +ISM will try to map any bad-pixel mask associated with the image. If enabled, +a bad-pixel mask specified by the image header BPM keyword (currently fixed +by convention but this may be selectable later) will be mapped along with the +image. Aside from wcs/pixel readouts at each cursor position, any BPM data +values found will also be displayed. A non-zero value will cause the BPM +field of the Coords Panel readout as well as the main image window marker +to switch to a red background color to flag the value. + + The last box allows the user to specify a different ISM task to be +executed or to reinitialize the current one. In most cases this won't need +to be changed, however a custom ISM could be started when using special +data formats. This command string can also be controlled by the application +"ism_task" resource. + + + +2.5 Support for 16 Display Frames +================================== + + As part of the extensive GUI changes, support for the full 16 +frames allowed by the IIS protocol is now available. IRAF V2.12 or +later client tasks (and CDL library) are required to take advantage of +these frames. All changes are backwards compatible, older versions of IRAF +will continue to work but cannot access more than the original four +frames. The new DISPLAY task will automatically sense whether the display +server being used supports 16 frames or the original 4 and adjust the +'frame' parameter maximum accordingly. The changes are fully backwards +compatible for other servers (e.g. SAOimage, DS9, etc). + + More frames are possible if needed but will require further changes +to the client IRAF code to be effective. Allowing creation of more than +16 frames by the Load panel can be done independently but would also require +numerous code change to XImtool. Please contact site support (iraf@noao.edu) +if there is a need for this, or for workaround suggestions depending on your +application. + + + +2.6 Magnifier +============== + + The magnifier marker appears to be stable and was moved into the +default ximtool GUI and is now enabled by default. The ximtool-mag command +has been removed. + + +2.7 Freezing Cursor Readout +============================ + + Holding down the Alt key will now freeze the cursor display readout +and draw crosshairs on the screen at the last position. This can be used +for example to position the cursor but then allow the cursor to be moved to +another window (to enter text, start a program, whatever) without losing +the position information displayed on the screen. + + +2.8 Cut-Graphs +=============== + + XImtool now has the ability to display horizontal and vertical +cut-graphs of the display, these appear as "flip-out" panels that appear +on the bottom and right side of the main display window and are controlled +by the small "H" and "V" buttons in the lower right corner of the window. +When both panels are enabled the corner area of the display also shows an +options panel for the graphs. Current options are: + + + Better Speed Draw the graphics so they update at the fastest + possible rate. This is done by subsampling pixels + to produce a smoother graph but without sacrificing + too much accuracy. + + Better Accuracy Draw the graphics using all screen pixels to produce + the most accurate display. On fast modern machines + this can be enabled with no apparent loss of speed, + however older machines may wish to use this only + occassionally to limit any lag in the cursor tracking. + + Image Pixels (Not Yet Implemented) + + + Jump Cursor If enabled, large jumps of the cursor do not update + the graphics display, small movements around an object + of interest will update the display continuously. + + Smooth Cursor If enabled, all cursor movements cause the display to + be updated. This is another option that can be set + safely on faster machines but will cause a delay on + slower ones. + + Graphics Cursors If enabled, the graphics cursors in either of the + plots are active and can be used to update the cursor + readout on the main image window and the complementary + cut-graph. This can be used for example to freeze + the cursor in the main display using the Alt key (see + above), then moving to one of the graphics windows + to perform cut graphs in only one axis. + + Graphs are (currently) drawn using only the scaled display values +to avoid complications of accessing multiple images in a mosaic display. Both +plots are labeled using the frame z1/z2 values and contain cursor indicators +which update contuously. + + + +2.9 Ruler Markers +================== + + Holding down the Ctrl key and the Left-Mouse-Button while moving +the mouse will drag out a "ruler marker" measuring the distance from the +initial point to the current mouse position. Releasing the Ctrl key before +lifting the mouse button will leave the marker on the display, otherwise +it will be erased automatically once the mouse button is released. Any +number of ruler markers can be created in the frame. + + Distances are measured by default in image logical pixels however +the Right-Mouse-Button can be used inside the marker to popup a menu of +options: + + Sticky By default rulers are destroyed whenever the display + changes due to a pan, zoom, flip, or frame change. + This option will make the ruler "sticky" so it will + not be erased, subsequent use of the menu to shows + this option to be "UnSticky" to remove this feature. + + Units Sub-menu to select the units of the display. If the + ISM is enabled and a WCS is present in the image and + selected as one of the readout options, distances may + also be read out in units of arcseconds, arcminutes, + or degrees instead of the default logical pixels. All + markers created after the unit change will readout in + the new units as their default. + + Color Select the color of the marker. + + Draw into Frame (Not Yet Implemented) Draw the marker as overlay + graphics in the frame. Doing so will retain the + marker when printing a hardcopy of the display. + + Destroy Destroy the marker. + +The marker can also be destroyed by hitting the Delete or Backspace key +while the cursor is in the marker. There is presently no way to move the +marker to a new position in the frame. + + + +2.10 Summary of Cursor Commands +=============================== + + * - indicates a new/changed command + + Misc Functions + -------------- + Ctrl-b Backward frame + Ctrl-c Center frame + Ctrl-f Forward frame + Ctrl-i Invert + Ctrl-n Normalize +* Ctrl-m Toggle Magnifier +* Ctrl-p Toggle Panner + Ctrl-r Register +* Ctrl-s Match LUTs + Ctrl-t Tile frames toggle + Ctrl-u Unzoom (zoom=1) + Ctrl-x Flip X + Ctrl-y Flip Y + Ctrl-= Print + Ctrl-< Decrease blink rate + Ctrl-> Increase blink rate + Ctrl-+ Zoom in + Ctrl-- Zoom out + + Alt-1 thru Alt-4 Set frame displayed + Ctrl-1 thru Ctrl-9 Set integer zoom factor + + Ctrl-Alt-q Quit + Ctrl-Alt-f Fitframe + + Panels + ------ + Alt-b Blink frames toggle + Alt-c Control panel + Alt-h Help panel + Alt-i Info box panel + Alt-l Load file panel + Alt-p Print panel + Alt-s Save panel + Alt-t Tcl Shell panel + + Auto-Registration + ----------------- +* Ctrl-a Toggle Auto-Reg +* Ctrl-o Set offset + + Cursor Positioning + ------------------ +* Ctrl-h/Left_Arrow move cursor 1 pixel left +* Ctrl-j/Down_Arrow move cursor 1 pixel down +* Ctrl-k/Up_Arrorw move cursor 1 pixel up +* Ctrl-l/Right_Arrow move cursor 1 pixel right + +* Shift-Ctrl-h move cursor 10 pixels left +* Shift-Left move cursor 10 pixels left +* Shift-Ctrl-j move cursor 10 pixels down +* Shift-Down move cursor 10 pixels down +* Shift-Ctrl-k move cursor 10 pixels up +* Shift-Up move cursor 10 pixels up +* Shift-Ctrl-l move cursor 10 pixels right +* Shift-Right move cursor 10 pixels right + + Frame Positioning + ----------------- + Ctrl-Left shift one full frame left + Ctrl-Down shift one full frame down + Ctrl-Up shift one full frame up + Ctrl-Right shift one full frame right + + Ctrl-Alt-Left shift one half frame left + Ctrl-Alt-Down shift one half frame down + Ctrl-Alt-Up shift one half frame up + Ctrl-Alt-Right shift one half frame right + + Peak-Up Centroiding + ------------------- +* Ctrl-[ decrease centering box size +* Ctrl-] inrease centering box size +* Ctrl-0 (zero) centroid/find local max +* Alt-Ctrl-0 (zero) find local min + + Mouse Button Actions + -------------------- + Shift-Btn1Down turn on magnifier + Shift-Btn1Up turn off magnifier + Shift-Btn2Down turn on crosshair cursor + Shift-Btn2Up turn off crosshair cursor + Btn1Down create marker + Btn1Motion resize marker being created + Btn2Down zoom on cursor position + Btn3Down/Motion brightness/contrast scaling + +* Ctrl-Btn1Down create ruler marker +* Ctrl-Btn1Motion resize ruler marker +* Ctrl-Btn1Up destroy ruler marker + +* Alt-Motion freeze cursor readout + + + +2.11 Summary of Application Resources +===================================== + + Following is a summary of the task client and GUI resources, along +with select resources defined for the main image display Gterm widget. All +GUI elements can be controlled to some exten with resource definitions +although not all resources are useful. Feel free to contact site-support +with questions about how to change the appearance of the GUI. Future +versions of XImtool should feature a control panel to allow some of these +more critical resources to be redefined at runtime. + Format for the listing is resource-name, default-value, and type, +with an optional note appended. See the man page or online help for a full +description of all resources. A '*' in the leftmost column indicates a new +resource added with this release, some resource apply only to the alternative +GUI. + + + Client Program Resources + ------------------------ + defConfig 1 Int + defNFrames 0 Int + tileBorderWidth 3 Int + tileBorderColor 9 Int + autoscale False Boolean + antialias False Boolean + antialiasType boxcar String (1) + tileFrames False Boolean + highlightFrames True Boolean + gui default String (2) + imtoolrc /usr/local/lib/imtoolrc String + invert False Boolean + memModel Fast String (3) + basePixel 64 Int + maxColors 216 Int + cmapInitialize False Boolean + cmap1 none String (4) + cmap2 none String (4) + cmapDir1 none String (5) + cmapDir2 /usr/local/lib/imtoolcmap String (5) + input_fifo /dev/imt1i String (6) + output_fifo /dev/imt1o String (6) + unixaddr /tmp/.IMT%d String (7) +* ism_addr /tmp/.ISM%d String (8) +* ism_task "ism_wcspix.e wcspix &" String (9) + + Notes: + 1) Options: nearest, bilinear, area, blkavg, boxcar, lowpass, gaussian + 2) Either the string 'default' or the path to a valid GUI file + 3) Options: fast, small, beNiceToServer + 4) Name of a colormap file in the cmapDir[1|2] directory + 5) Path to directory of valid colormaps + 6) Path to FIFO pipe + 7) Unix socket path, a '%d' is replaced with the uid + 8) Unix socket path, a '%d' is replaced with the uid. This is the + socket used by plug-ins to negotiate a socket, once connected the + actual communications use a different socket. + 9) Command used to start the default WCS/Pixel readout ISM task. + + + GUI Resources + ------------- + autoscale True Boolean + zoomfactors 1 2 4 8 String + displayCoords True Boolean + displayPanner True Boolean + displayMagnifier False Boolean + blinkRate 1.0 Real (1) + pannerArea 150*150 Geometry + pannerGeom -5+5 Geometry +* magnifierArea 100*100 Geometry +* magnifierGeom +5+5 Geometry + wcsboxGeom -5-5 Geometry + maxContrast 5.0 Real +* showToolBar False Boolean +* showPanelBar False Boolean + warnings True Boolean +* centerBoxSize 5 Int +* peakCentroid True Boolean + + Notes: + 1) Value represents blink rate in seconds + + + Main Image Window (Gterm) Resources + ----------------------------------- + cmapName image String (1) + basePixel 64 Int + warpCursor True Boolean + raiseWindow True Boolean + deiconifyWindow True Boolean + ginmodeCursor circle Cursor + ginmodeBlinkInterval 500 Int (2) + color0 Black Pixel + color1 White Pixel + background Black Pixel + foreground White Pixel + width 512 Int + height 512 Int + + Notes: + 1) Any user-defined name is acceptable + 2) Value represents blink rate in milliseconds + + + +2.12 Summary of Command-Line Options +==================================== + + -basePixel Base colormap pixel + -cmap1 User colormap 1 + -cmap2 User colormap 2 + -cmapDir1

User colormap directory + -cmapDir2 Default colormap directory + -cmapInitialize initialize colormap + -cmapName Set Colormap name + -config Set initial config number + -defgui Print default GUI and exit + -displayPanner Display Panner box + -displayMagnifier Display Magnifier box + -displayCoords Display WCS Coords box + -fifo Fifo pipe to use for connection + -fifo_only Use fifo only for display + -gui GUI file + -help Print help + -imtoolrc Set frame buffer configuration file + -inet_only | -port_only Use inet only for display + -invert Start with inverted colormap + -ismdev ISM device (socket) template + -maxColors Max number of image colors to allocate + -memModel Memory model (fast|small|beNiceToServer) + -nframes Number of frames to create at startup + -port Set inet port to use for connection + -printConfig Set printer config file + -tile Start in tile-frames mode + -unix Set unix socket to use for connection + -unix_only Use only unix socket for display + File to load at startup + + + +-------------------------------------------------------------------------------- + +3. OBM (WIDGET SERVER) REVISIONS +================================= + + +3.1 New Widgets +--------------- + + As part of the OBM modifications two new widgets were added to +the toolkit. The widgets were also added to the LISTRES application in +the X11IRAF sources which can be consulted for a complete list of resources. +LISTRES is not normally built with the system but is installed locally on +the NOAO/IRAF development machines. To build it yourself: + + % cd //x11iraf/obm/listres # go to the source directory + % xmkmf # create the Makefile + % make listres # compile the task + +It may then be used as e.g. "listres " to print a full list of +resources for the named widget. + + +3.1.1 Tabs Widget +------------------ + + The Tabs widget is a composite widget providing an "index tab" +appearance to it's child widgets. The children will normally be layouts +of more complex panels such as is done for the XImtool Control Panel. +Only the children of the active Tab are visible, the contents of other +Tabs are not displayed until that Tab is raised by selecting it with the +mouse and the left mouse button. + + A new Widget class command was added to allow GUI control of the +active Tab (e.g. to programmatically raise a Tab). This command is of +the form + + send setTop + +where is the name of the Tab widget, and is the name of the +child widget to be raised. Only one Tab widget is required to handle +child widgets, the Tabs will be created automatically. + + The widget code was also modified slightly to allow specific +resource values to hide the appearance of the widget from the display, e.g. +to completely change the appearance of a panel's layout by invisibly raising +a different Tab. For instance, assuming we have a Tab widget called +'opPanels' with several child widgets containing layouts of other widgets, +the following resource settings will hide the parent Tabs widget: + + *opPanels.tabLabel: + *opPanels.font: nil2 + *opPanels.height: 0 + *opPanels.width: 0 + *opPanels.borderWidth: 65535 + *opPanels.internalWidth: 32765 + *opPanels.internalHeight: 32765 + +Essentially we set NULL labels and sizes and values for the borderWidth +and internalHeight/Width that have the same bit pattern as a negative value +which internally means the borders are not drawn. The GUI callback code +can then use the setTop Widget method to raise the desired Tab meaning the +entire panel will change layouts automatically. This has advantages over +simply unmapping/mapping the layouts as it doesn't create a window resize +event which may cause the panel to "flash" during the change. + + An example GUI for this widget is in x11iraf$guidemo/tabs.gui + + +3.1.2 ListTree Widget +---------------------- + + The ListTree widget provides a nested list of items, where each +item is either a terminal item in a list, or another list. Lists may be +"open" meaning their contents are displayed, or "closed" meaning they are +shown as an individual item. This widget can best be used to represent +e.g. contents of a directory or sections/subsections of a document. + + A new Widget class command was added to allow GUI control of the +list contents. This command is of the form + + send setListTree + +where is the name of the widget, and is a list of +items to be displayed. This list should be a valid Tcl list, where items +in the list may be lists themselves to produce the nested format. All +ListTree widget are initially presented with the embedded lists "closed". +There is presently no way to append the contents of the list, the entire +list must be redefined with the above command. For example, the command + + send list setListTree {a1 {b1 { {a2 {a3 b3 c3 d3}} { b2 {z1 z2}} } } c1} + +would produce a nested list such as + + a1 + b1 + a2 + a3 + b3 + b2 + c1 + +Specifying the lists is a bit complex, but this widget is a nice way to +handle something like a table of contents in online documentation. + + An example GUI for this widget is in x11iraf$guidemo/ltree.gui + + +3.2 Dynamic Widget Creation (TBD) +--------------------------------- + + In the original implementation of the OBM, the GUI is created or +defined using the 'appInitialize' and 'createObjects' server commands. +appInitialize initializes the X display but the 'resources' argument just +sets the fallback resources for the application. A 'createObjects' call +then queries the fallback resource database (either by a named resource o +the 'objects' resource by default) to get the widget tree and then parses +that as a string to actually create the widgets in the OBM. + + The initial example GUIs all defined an "objects" resource as the +way to define the widgets and all the subsequent GUI tasks followed that form, +however appInitialize requires only a string of resource definitions ('object' +resources or otherwise), and createObjects can take an argument as to which +resource value specifies the widgets to create. For dynamic widget creation +all that's really required is that we have a way to append the fallback +resource database with a new list of widgets. + + The solution then was implement a new 'appExtend' server command +that simply sends a new resource string to the OBM to be merged into the +fallback resource DB. A plug-in would call this to load the widgets, then +call createObjects naming the resource to realize the widgets. The new +widgets are created as though they were specified from the start and can +receive messages, be destroyed, etc. The appExtend server method essentially +works by + + - getting the fallback resource database + - convert resource string arg to a new resource database + - combine the two resource databases + - write the combined database back as the new fallback database + +For example, the plug-in code for a "Hello, World" GUI panel would look +something like + + appExtend { + *test_objects:\ + toplevel TopLevelShell testPanel\ + testPanel Form testForm\ + testForm Label testLabel\ + testForm Command testQuit + + *testLabel.label: Hello, world! + *testQuit.fromHoriz: testLabel + *testQuit.label: Quit + } + createObjects test_objects + send testPanel map + +This code could be uploaded by an ISM plug-in and sourced as Tcl code +in a callback. It's also possible to define objects w/ existing parents +meaning a plug-in can add buttons to menubars or panels when they first +connect (e.g. a plug-in can add a new activation button for it to an +existing menubar on the GUI). + + The ability to dynamically create widgets means that plug-in modules +can create their own GUI components, but it also means that meta-widgets such +as Help panels, Image Display panels, etc can be recycled from a library of +code. To use this effectively, however, some rules need to be established +for an object naming convention, protocols for adding/deleting callbacks and +event handlers, and some method of object orientation is desired in the Tcl +code to make having multiple instances of a meta-widget in a GUI easier to +handle. These details are still largely TBD, the basic functionality now +exists in this version but may change as we take advantage of it and +implement new plug-in tasks or meta-widgets. + + +-------------------------------------------------------------------------------- + +4. CLIENT DISPLAY LIBRARY (CDL) REVISIONS +========================================== + + +4.1 Display Protocol Changes +----------------------------- + + The IIS display protocol used was modified to conform to the XImtool +and IRAF changes implemented for the support of WCS mapping information. +These are detailed in section 5.1 below. + + Unlike the IRAF IMD interface changes though, the WCS version can +be determined when the CDL is first opened so no explicit call to query +this is required by CDL applications. Tasks may still set/retrieve mapping +information and assume this is handled automatically by the interface. +The hi-level routines for displaying FITS or IRAF images will also send the +mapping information automatically, it's only when using the low-level +cdl_displayPix() routine or setting the WCS explicitly where the mappings +need to be set by the application. + + Changes remain completely backwards compatible so client tasks need +to be modified only to support the new XImtool features. + + +4.2 New Procedures +------------------- + + Three new public interface procedures were added in addition to the +internal changes made to support image mappings: + + cdl_setMapping() - Set mapping data to be sent with next cdl_setWCS() call. + Returns a non-zero status if mapping was set. + cdl_getMapping() - Get mapping data returned with last cdl_getWCS() call. + Returns a non-zero status if valid mapping available + cdl_queryMap() - Given a WCS number return the mapping data for that WCS. + Returns a non-zero status if valid mapping available. + + +4.2.1 C Calling Sequence +------------------------- + + valid = cdl_setMapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) + stat = cdl_getMapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +stat = cdl_queryMapping (cdl, wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref) + +Where the arguments are defined as + + cdl - CDL package pointer returned by cdl_open() + region - user-defined name for the region (e.g. 'image', + 'subras1', 'ccd3', etc). + sx, sy, snx, sny - source rect in the object + dx, dy, dnx, dny - destinaton rect in the display frame buffer + ref - full node!/path/image[sec] image name, same as + was immap'd when the image was displayed. Used + for access after the display + wcs - WCS number for a specified mapping + + + +4.2.2 F77 Calling Sequence +--------------------------- + + cfsetmapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) + cfgetmapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) + cfquerymapping (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier) + +Where the arguments are defined as above and 'ier' is an error status code. + + +4.2.3 SPP Calling Sequence +--------------------------- + + cdl_setMapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) + cdl_getMapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) + cdl_queryMapping (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier) + +Where the arguments are defined as above and 'ier' is an error status code. + + +4.3 Demo Task Updates +---------------------- + + o The DISPLAY demo task in the 'examples' subdirectory was modified + to show how the cdl_setMappings() call is to be used when displaying + the image using the low-level procedures. + + o The CDLTEST test task in the 'test' subdirectory has a new 'Q' + command to test the cdl_queryMap() procedure. + + + +-------------------------------------------------------------------------------- + +5. TECHNICAL NOTES +================== + +5.1 IIS Protocol Changes +------------------------- + + For backwards compatability none of the existing IIS protocols were +modified completely, however we take advantage of unused registers to flag +the new features in existing functions (like read/write WCS). The WCS mapping +changes required only that the unused 'x' register be set to indicate the new +behavior was desired, e.g. the wcs text containing the extra mapping data. + + We also added two new WCS calls that allow us to query the WCS version, +or query a WCS by a specific number corresponding to a mapping. The WCS +version query will return a string such as "version=10" which can be parsed +by the client to get a version number '10' (corresponding to version 1.0). + + Because of the added mapping text the WCS string length was increased +from 320 to 1024 bytes, the string length used internally depends on whether +the 'x' register has been set. + + Support for the full 16 frames allowed by the bit-flag 'z' register +in the IIS header packet required the masking values be changed at various +places in the code. This was more a limitation of the initial implementation +than a required change to the protocol. + + A complete summary of the XImtool IIS protocol implementation follows. + + +5.1.1 IIS Protocol Summary +--------------------------- + + IIS Header Packet Summary + + TID Subunit Tct X Y Z T Data + +------------------+-------------+-----+---+---+----+---+--------+ +Read Data | IIS_READ|PACKED | MEMORY | -NB | x | y | fr | - | nbytes | +Write Data | IIS_WRITE|PACKED | MEMORY | -NB | x | y | fr | - | nbytes | +Read Cursor | IIS_READ | IMCURSOR | - | - | - | wcs| - | - | +Write Cursor | IIS_WRITE | IMCURSOR | - | x | y | wcs| - | - | +Set Frame | IIS_WRITE | LUT|COMMAND | -1 | - | - | - | - | 2 | +Erase Frame | IIS_WRITE | fb | FEEDBACK | - | - | - | fr | - | - | + | | | | | | | | | +Old Read WCS | IIS_READ | WCS | - | - | - | fr | - | 320 | +Old Write WCS | IIS_WRITE|PACKED | WCS | -N | - | - | fr |fb | 320 | + | | | | | | | | | +WCS Version? | IIS_READ | WCS | - | 1 | 1 | - | - | 320 | +WCS by Num.? | IIS_READ | WCS | - | 1 | - | fr |wcs| 1024 | +New Read WCS | IIS_READ | WCS | - | 1 | - | fr | - | 1024 | +New Write WCS | IIS_WRITE|PACKED | WCS | -N | 1 | - | fr |fb | 1024 | + +------------------+-------------+-----+---+---+----+---+--------+ + + +Where nbytes | NB = number of bytes expected or written + x = x position of operation in frame buffer coords + y = y position of operation in frame buffer coords + fr = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written + following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 + + + +5.2 IRAF 'imd' Interface Changes. +---------------------------------- + + In order for the XImtool ISM task map exactly the same image that +was passed into the task displaying the image (i.e. the fully qualified +node!path prefix including any image section or kernel args). It was +necessary to modify the IIS SetWCS command to contain extra information +at the end of the normal WCS text. This is passed from XImtool to the ISM +at the time of the display if an ISM is already running, or when the ISM +first connects thereafter. + + To maintain complete backwards compatability it is not possible to +bury this change in the internals of the interface, therefore it will be +necessary for all tasks using the IMD interface to display images to make +revisions to use the new features. Tasks which are not changed will continue +to work, XImtool will simply disable the ISM when the display client connects +without indicating it is able to pass mapping information. Client tasks, +modified or not, will also continue to work when connecting to "mapping +unaware" display servers since the interface only send the extra mapping +information to servers which are expecting it. + + To modify a task to make use these changes, there are just a few +routines you need to be aware of: + + imd_wcsver() - Query the server for new capabilities. Returns a + non-zero version if the server can use the new + mapping functionality. +imd_setmapping() - Set mapping data to be sent with next imd_putwcs() call +imd_getmapping() - Get mapping data returned with last imd_getwcs() call. + returns a non-zero status if valid mapping available + imd_query_map() - Given a WCS number return the mapping data. Returns a + non-zero status if valid mapping available + +where the calling sequence is + + imd_setmapping (reg, sx,sy,snx,sny, dx,dy,dnx,dny, objref) + valid = imd_getmapping (reg, sx,sy,snx,sny, dx,dy,dnx,dny, objref) + status = imd_query_map (wcs, reg, sx,sy,snx,sny, dx,dy,dnx,dny, objref) + version = imd_wcsver () + +In order to maintain compatability with existing servers as well as take +advantage of the new ximtool features, the idea is that all interfaces will +remain the same and any program wishing to use these features will need a +slight modification to 1) determine whether mappings are supported via a +call to imd_wcsver(), and 2) use the new imd_[sg]etmapping() procedures to +set and retrieve the mapping information. imd_query_map() can be used to +query for the mapping using the wcs number returned from e.g. a cursor read. +Details and examples of these modifications are included below. + + +5.2.1 Program Initialization +---------------------------- + + For a program to use mappings it must first query the server to see +if this is supported, the reply also serves to initialize the imd interface. +This is done using the imd_wcsver() call. For example, in the DISPLAY task +during startup one would do something like + + # Query server to get the WCS version, this also tells us whether + # we can use the all 16 supported frames. + if (imd_wcsver() == 0) + call clputi ("display.frame.p_max", 4) + else + call clputi ("display.frame.p_max", 16) + +The call to imd_wcsver() in this case is used to reset the number of allowed +frames depending on the server. + + This call is REQUIRED before mappings can be used by the interface. +Internally, the interface defaults to a "version" of zero meaning the server +does not support mappings, once the procedure is called the server reply +value is stored in the interface common and returned as the function value. +The return value is always an integer, zero means the server does not support +mappings and a non-zero value is the WCS version number of the display +change (e.g. a value of 10 is version 1.0, 11 is 1.1, etc). + + A 'disable_wcs_maps' boolean environment variable can be set by +the user to force this procedure to always return zero and disable mappings +in case a problem is found after release or the old behavior is desired. + + +5.2.2 WCS Text Changes +---------------------- + + Without getting into the details, if a server is found to be capable +of using mappings in the imd_wcsver() call, the WCS string sent/read will +have two additional lines of information to define the mapping. Specifically, + + name - title\n + a b c d tx ty z1 z2 zt\n + region_name sx sy snx sny dx dy dnx dny\n + object_ref + +where the new parameters are defined as + + region_name - user-defined name for the region (e.g. 'image', + 'subras1', 'ccd3', etc). + sx, sy, snx, sny - source rect in the object + dx, dy, dnx, dny - dest rect in the display frame buffer + object_ref - full node!/path/image[sec] image name, same as + was immap'd when the image was displayed. Used + for access after the display + + Since the interfaces remain the same a separate imd_setmapping() +or imd_getmapping() call is required to set/get the additional mapping data. +For example, + +To set the WCS: + + # Set the mapping info to be written with the WCS. + call imd_setmapping (region, sx,sy,snx,sny, dx,dy,dnx,dny, objref) + + # Write the WCS and mapping info to the data. + call imd_putwcs (ds, frame, Memc[imname], Memc[title], + a, b, c, d, tx, ty, W_ZS(wdwin), W_ZE(wdwin), W_ZT(wdwin)) + + +To read the frame WCS: + + # Query the server for a wcs. + if (imd_getwcs (frame, server, image, sz_image, title, sz_title, + a,b,c,d, tx,ty) == OK) { + + # If we got that okay, get the mapping information returned. + if (imd_getmapping (reg, sx,sy,snx,sny, dx,dy,dnx,dny, obj) > 0) { + : + } + } + +In all cases if the imd_wcsver() initialization says the server can't +do mappings these calls will be no-ops. + + For multiple-image displays to a single frame it's important to +remember that the default WCS for the frame will be the *last* WCS set +by the client. For example, a mosaic display can set a wcs and mapping +for each of the subrasters, but a final SetWCS call is required to define +an overall WCS for the frame defining the "detector coords". Note that the +'objref' string should include the MEF extension number so it's mapped +properly by the ISM. + + +5.2.3 Cursor Reads +------------------- + + The imd_query_map() procedure is used to return the mapping for a +particular WCS number, such as that returned by a cursor read. It will do +a new WCS query for this regardless of a previous imd_getwcs() call. Typical +usage would be something like the following in IMEXAMINE: + +procedure t_imexamine () + : +begin + : + wcsver = imd_wcsver() + : + : + while (ie_gcur (ie, curtype, x,y,wcs, key, cmd, SZ_LINE) != EOF) { + + if (imd_query_map (wcs,reg,sx,sy,snx,sny,dx,dy,dnx,dny,imname) > 0) { + .... add image name to list + } + + } + : +end + +[NOTE: in this example the ie_gcur() procedure was modified to return the + wcs from the cursor read.] + +The WCS number returned by a cursor read now corresponds to the object id +used in the server. It still contains the frame number as before, but the +wcs number itself is used to identify the mapping. + + +5.3 ISM Communications +----------------------- + + The ISM (Image Support Module) can be any external task which +connects to XImtool over a socket. Communications are limited to simple +null-terminated text strings. In most cases these strings are just the +standard OBM messages sent to XImtool objects but can also include Tcl +callback code (either ISM-specific callbacks, procedures which can be +added to the callback list for existing XImtool objects, or even new GUI +code to create panels and new objects). + + +5.3.1 Socket Connection +------------------------ + + The ISM first requests a connection to XImtool on a dedicated +socket whose default value is "/tmp/.ISM%d", where the '%d' is replaced +by the userid allowing multiple users on a machine to have independent +sockets. The XImtool 'ism_addr' resource or "-ismdev" command-line option +can be used to change this address, a value of 'none' will disable ISM +communications. The socket may also be set with an ISMDEV environment +variable which will override the resource or command-line options. + + Once a connection request is received, XImtool replies with +a message telling the ISM to reconnect on a different socket, it then +frees the initial connection allowing multiple other ISMs to request +their own connection. The communications between XImtool and the ISM +are carried out entirely over this second negotiated socket. Once connected, +the ISM appears as just another named object which can receive OBM messages. + + +5.3.2 Communications Protocol +------------------------------ + + Messages from the ISM are written to the connection socket and must +be preceeded by one of the following keywords: + + callback Negotiate a connection on another socket + ready Client is ready to begin processing + quit Client is shutting down and disconnecting + send Send a message to another object + + +Messages are of the form: + + connect Request a connection for the ISM + + ready Reconnection request for the ISM on + negotiated socket, ISM is ready to processing. + + send '{' '}' Send to the named . The message + may be any valid string that will be under- + stood by the recipient. The object may be + any object in the GUI or OBM (see below). + + quit ISM is shutting down. The named is determined + from the communications channel, ISM is + responsible for any cleanup of it's callbacks + before issuing the shutdown. + +All messages must be null-terminated. XImtool will buffer the text until +a complete message is received. Once an ISM client has delivered a QUIT +message no further messages will be sent the that ISM. + + In OBM terminology the ISM is a named Client class object, where +the name is set in the connection request. Messages sent to the ISM should +use this name, messages sent to "client" are still interpreted to mean the +XImtool client. + + The content of messages delivered to the ISM are totally free-form +and may contain any text the ISM is expected to understand. + + +5.3.3 GUI Objects +------------------ + + While the ISM can send a message to any object in the task, there +is a GUI Parameter object called 'ism_msg' designed especially to process +messages from the ISM. The callback in the GUI is expecting a message +beginning with one of the following keywords: + + source Source message text as Tcl code + alert Message contains error text to be displayed in the + GUI 'alert' box + deliver Message text should be passed to a callback routine + specific to that ISM. This processing callback may + have been previously uploaded. The message text + may be any form the processing callback is expected + to understand. + info Message text is status output intended for the + XImtool 'info' panel (connect/disconnect requests, etc) + + +In all cases the message is expected to be of the form + + [ <...> ] + +where is one of the above keywords, is the name of the +ISM sending the message. The remainder of the message is passed as an 'argv' +list to the processing callback uploaded for the ISM. The ISM is responsible +for formatting these messages. + + diff --git a/vendor/x11iraf/Notes-V2.0.txt b/vendor/x11iraf/Notes-V2.0.txt new file mode 100644 index 00000000..4587c6ac --- /dev/null +++ b/vendor/x11iraf/Notes-V2.0.txt @@ -0,0 +1,635 @@ + + X11IRAF V2.0 RELEASE NOTES + ========================== + + Last Modified: Mon Nov 17 12:00:11 MST 2008 + +------------------------------------------------------------------------------- + +Release History: + + November 17, 2008 -- Initial V2.0BETA public release + +------------------------------------------------------------------------------- + + +Table of Contents: +------------------ + + Executive Summary + + 1. Download and Installation + 1.1 Downloading the Distribution + 1.2 Installing Pre-Built Binaries + 1.3 Building From Source + 1.4 Comments, Suggestions and Bug Reports + + 2. XImtool Revisions + 2.1 XGterm Revisions + + 3. Platform Support Issues + 3.1 Linux Systems + 3.1.1 Determining your Graphics Hardware + 3.1.2 Intel Chipset Issues + 3.1.3 NVidia Issues + 3.2 Mac OSX Systems + 3.2.1 Tiger and Leopard Support + 3.3 Other Platforms + + 4. OBM (Widget Server) Revisions + 4.1 GTerm Widget Changes + 4.2 Athena Widget Changes + + 5. Client Display Library (CDL) Revisions + 5.1 Display Protocol Changes + + 6. Technical Notes + 6.1 IIS Protocol Changes + 6.1.1 IIS Protocol Summary + 6.1.2 Faster Sub-Raster Writes + + 7. Post-Release Notes + +------------------------------------------------------------------------------- + +================== +Executing Summary +================== + +This release provides the following improvements over previous versions: + + 1) 24-bit display Support for XImtool + 2) 24-bit display Support for XGterm applications using imaging + 3) General platform support improvements + +For those accustomed to DS9 and not familiar with XImtool, a summary of +features is provided at + + ftp://iraf.noao.edu/iraf/x11iraf/Notes-V1.3.html + +This document will be updated as needed, see the 'Revisions' file for a +detailed list of changes made in the source code. + + +------------------------------------------------------------------------------- + +============================= +1. DOWNLOAD AND INSTALLATION +============================= + +1.1 Downloading the Distribution +--------------------------------- + + The X11IRAF v2.0 system is being distributed as tarballs of either +pure-source or prebuilt binaries. The convention in open-source software +is that such tarballs create the toplevel directory for the application, +however we require that users first create a directory for the distribution +file since we don't want to impose a directory name that might overlap +existing versions. We may reconsider this based on user suggestions, but +users should be aware that creating the package directory is required before +unpacking either source or binaries. + +Distributions are available in the following files: + + Source Distribution: + + http://iraf.noao.edu/x11iraf/x11iraf-v2.0BETA-src.tar.gz + + Pre-built Binaries: + + http://iraf.noao.edu/x11iraf/x11iraf-v2.0BETA-bin.redhat.tar.gz + http://iraf.noao.edu/x11iraf/x11iraf-v2.0BETA-bin.macosx.tar.gz + http://iraf.noao.edu/x11iraf/x11iraf-v2.0BETA-bin.macintel.tar.gz + +Once the system is out of the Beta-test phase the version string will +change, additional platform binaries will be added as they become +available. The Mac OSX binaries are suitable for Tiger or Leopard systems, +Redhat binaries should run on most Linux systems whether based on a Redhat +distribution or not. See the platform-specific notes below for additional +details. + + +1.2 Installing Pre-Built Binaries +---------------------------------- + + Installing from binaries is a simple matter of finding the approp- +riate distribution file for your platform. Unpacking the file can be +done using the commands (e.g.) + + % mkdir /path/x11iraf # create the X11IRAF directory + % cd /path/x11iraf # go into X11IRAF directory + +and then unpack the tarball using a command such as + + % tar zxvf x11iraf-v2.0BETA-bin.macintel.tar.gz + +This will create an 'x11iraf' directory in the place you execute the +command that contains the distribution. + +Installing to the default system directories will require root permission +and can be accomplished with the commands: + + % su # become the root user + # ./install # install the files (interactive) +or + % sudo ./install # execute install as root + + + +1.3 Building From Source +------------------------- + + Installing from source is a simple matter downloading the +source distribution and unpacking the file in a directory you create. +Unpacking the file can be done using the commands (e.g.) + + % mkdir /path/x11iraf # create the X11IRAF directory + % cd /path/x11iraf # go into X11IRAF directory + +and then unpack the tarball using a command such as + + % tar zxvf x11iraf-v2.0BETA-src.tar.gz + +This will create an 'x11iraf' directory in the place you execute the +command that contains the distribution. + +To build and install from an unpacked source distribution: + + % mkdir /path/x11iraf create the X11IRAF directory + % cd /path/x11iraf go into X11IRAF directory + % xmkmf build the package Makefile + % make World build binaries from sources + + % su become the root user + # ./install install the files (interactive) +or + % sudo ./install execute install as root + +Only the last two commands are required to install from an unpacked binary +distribution. Note that root permission is required in order to install to +the default system locations. The X development environment for your +platform must be installed prior to building sources, otherwise please +install from one of the available binary distributions. + + +1.4 Comments, Suggestions and Bug Reports +------------------------------------------ + + Please report any bugs, comments or suggestions to + + fitz@noao.edu + +Additionally, X11IRAF announcements and a user-forum is available at + + http://iraf.net + + +When reporting problems, please provide as much information as possible +(e.g. platform, OS version, commands used, buttons pushed, etc) so the +error can be reproduced. + + + +-------------------------------------------------------------------------------- + +====================== +2. XIMTOOL REVISIONS +====================== + + The scope of this upgrade was limited entirely to supporting the +existing X11IRAF applications and features on TrueColor visuals (so-called +'24-bit displays'). As such, the changes to XImtool itself were relatively +minor and mostly limited to internal changes and not user-features. + + The one exception to this is the addition of a new GUI feature on +the display window we call the 'colormap focus slider'. This is a new GUI +element that is used to set the size of an interactive update box on the +display window that will be refreshed as the user slides the mouse around +to do the contrast stretching of the image. By default, this will be the +entire display window (i.e. the slider is all the way to the right), but it +can be changed to make the update window smaller to the point where when +the slider is on the far-left a box of 128x128 (deemed to be the minimally +useful size) is set. Upon releasing the mouse window, the entire display +will be updated. + + [NOTE: At present, there are known issues in the V2.0BETA version + with this box not being properly updated as a result of window + resizing. These problems will be addressed.] + + On many systems, the refresh rates for contrast stretching will be +satisfactory, however certain OS/hardware configurations exhibit problems +resulting in poor performance. Details (as they are known) of these +configurations are described below, however this slider is meant as a +stopgap for users to change the refresh box as needed to achieve acceptable +rates. Even on fully-supported hardware, this box can be used to mitigate +performance problems when using XImtool over remote X connections. + + A long list of possible XImtool enhancements is prepared, however +we are relying on the user-community to provide input in the way of +suggestions and comments that this work is needed before deciding to allocate +scarce resources to further development. + + +2.1 XGterm Revisions +---------------------- + + No changes to XGterm we made specifically during this upgrade, +however the underlying Gterm widget changes means that IRAF tasks in the +XAPPHOT package of the GUIAPPS external package can now be used on 24-bit +displays. Because of the color changes required, some work still remains +to fixup resource in the XAPPHOT gui itself, however for the most part it +is now functional on 24-bit displays as well. + + +-------------------------------------------------------------------------------- + +============================ +3. PLATFORM SUPPORT ISSUES +============================ + + +3.1 Linux Systems +------------------ + + In early testing, a number of issues arose that were caused in part +by host-system graphics issues. With TrueColor support, the interactive +contrast stretching requires many times more screen refreshes than in the +8-bit version where only the colormap was updated. As a result, even though +the machines have become much faster, there is a greater dependence on how +well the underlying hardware is supported by the system. Combined with a +general switch from the old XFree86 X11 systems to the newer (and supposedly +better) X.org code base, we are once again faced with the issue of driver +support under Linux systems. + + Proprietary drivers such as for NVidia graphics card present a +challenge for Linux developers since much of the system has to be reverse- +engineered. NVidia itself is improving it's support for Linux but the most +recent drivers have not yet made their way into mainstream linux +distributions. Likewise, there are problems with other graphics chipsets +or specific window managers, but there are also a large number of users who +will see no specific problems at all. + + The sections below will be updated as new problems (and solutions) +are found, and if changes can be made in the XImtool application itself they +will be implemented. Most commonly, any problems you experience will be +with the rate at which the screen refreshes in response to brightness/contrast +scaling of the image. Window resizing is another issue that may come up +and will depend on the type of window manager used. When reporting issues, +please be as specific as possible about the hardware, window manager and +OS version you are using as well as steps needed to reproduce any problem. + + + +3.1.1 Determining your Graphics Hardware +----------------------------------------- + + On many Linux systems the 'lspci' command can be used to print +the PCI hardware of the machine. For example + + % /sbin/lspci | grep -i VGA + 22:06:01.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27) + +indicates this machine has an ATI Rage XL graphics card. The location of +the command may vary but /sbin is common. + + Additionally, systems such as Ubunto have control-panel applications +that can be used to list details of machine hardware. + + + +3.1.2 Intel Chipset Issues +---------------------------- + + Intel graphics chips are common on many laptops, however the default +'EXA' acceleration is known to be slow on systems using recent versions of +the X.org server. The suggested workaround is to edit your /etc/X11/xorg.conf +file and add the following to your 'Device' section: + + Option "AccelMethod" "exa" + Option "MigrationHeuristic" "greedy" + Option "ExaNoComposite" "false" + +This has been reported to improve the screen-refresh performance of a number +of applications. + + An alternative, is to change the 'AccelMethod' option to be 'xaa' +to use a different accelerator. The disadvantage here is that certain +applications requiring video capability (such as Compiz-Fusion window manager +on Ubuntu) will no longer work properly. For older X.org systems, however, +this may be the only option. + + + +3.1.3 NVidia Issues +--------------------- + + Linux systems running the X.org server with the stock 'nv' driver +have reported slow refresh rates when stretching the image contrast. To +help alleviate thi sproblem the 'colormap focus slider' on the bottom of +the main window can be used to adjust the size of the interactive refresh +area to tolerable rates. + + A better solution is to install the latest version of the nvidia +driver available for linux from the driver page at: + + http://www.nvidia.com/object/unix.html + +This driver update has been reported to greatly improve the performace of +the system and is recommended to those comfortable doing the upgrade. + + + +3.1.4 Ubuntu Issues +--------------------- + + Ubuntu linux systems using the Compiz-Fusion window manager have +reported problems with some of the static colors being rendered properly. +At this time, there are no known workarounds while the problem is being +investigated. + + + +3.2 Mac OSX Systems +-------------------- + +3.2.1 Tiger and Leopard Support +-------------------------------- + + An Intel MacBook Pro running 10.4 (Tiger) was used as a primary +development platform, however the same code base compiled under 10.4 is +known to run on 10.5 (Leopard) systems for both Intel and PPC systems. + + With 10.5, Apple switched from an XFree6-based X11 environment to +one based on the X.org server, and the resulting problems are well documented +on the net but pertain mainly to 8-bit application support. As far as this +package is concerned, the only issue appears to be one of screen-refresh +speeds on machines with NVidia graphics cards (e.g. 12" MacBook Pro and other +older systems). This is similar to speed problems seen under Linux and may +be solved in future updates of the Apple X11 server. For now, the workaround +is to utilize the "colormap focus slider" described above to set an update +box-size that gives satisfacory performance. + + Other issues and solutions found with Mac systems will be documented +here as they arise. + + +3.3 Other Platforms +-------------------- + + As of this release the only major system lacking support is the +Windows platform using Cygwin, however this is planned before the final +public release of the package. + + Issues identified with Mac version support (considering the +upheavals in the X support under 10.5) will be addressed as they come up +with the goal that a single binary for each CPU architecture will be all +that is required. A Universal binary is being considered but was not a +focus of this release. + + + +-------------------------------------------------------------------------------- + +================================== +4. OBM (WIDGET SERVER) REVISIONS +================================== + + The primary focus of changes in this release is to update all +tasks and toolkits to support 24-bit (more generically, 'TrueColor visual') +displays. No signbificant new features were added however many files +were checked and slightly modified so they would work in the new display +environment. + + +4.1 GTerm Widget Changes +------------------------- + + The custom Gterm widget obviously underwent significant change +during this upgrade. To summarize the issue: With an 8-bit PseudoColor +display the contrast stretching is done by simply rewriting the scaled +colormap to the display (256 elements), but with a TrueColor visual there +is no colormap and the RGB value of *each pixel on the screen* must be +updated and refreshed when a change is made (i.e. 512x512 pixels or more +depending on the screen size). Increased CPU/GPU power makes fast updates +possible compared to 10 years ago, however much depends on the graphics +hardware and how well it is supported by the underlying OS and the X server +used. + + Fundamentally, the Gterm widget still retains the concept of a +colormap so that the higher-level applications which rely on it can remain +almost completely unchanged. The support for TrueColor displays is added +at the lowest level of the widget that interacts directly with the X +display. For example, in XImtool a "frame" consists internally of a client +XImage that holds the 8-bit display data sent by the client and is the size +of the frame buffer. This frame also has a 'pixmap' that is the same depth +as the display visual (e.g. 24-bits) however it is only the size of the +Gterm window. It is the pixmap that is rendered to the screen and so we +can implement 24-bit support by mapping the 8-bit XImage data to the 24-bit +pixmap when we pan/zoom or stretch the display contrast. Converting these +pixels is done using the colormap still present in the widget and set by +the user and the conversion is optimized with lookup-tables to minimize +computation time. + + The static colors in the widget are unchanged and we are able to +fully utilize all 200+ colors available in the Gterm color model. Vector +graphics and "markers" in the widget were largely unchanged except for +cases where resource colors (e.g. the vector color in a plot) needed to be +specified explicitly. + + This approach worked remarkably well in limiting the changes to the +Gterm widget itself and requiring (relatively) little in the way of changes +needed by applications such as XImtool or XGterm. A number of small issues +remain to be solved (and new ones will no-doubt be found) during the +beta-test period, but a fully-supported and stable system is clearly within +reach. + + +4.2 Athena Widget Changes +-------------------------- + + The Athena3D widget toolkit used also had problems under 24-bit +systems, mostly related to the definition of color resources. This toolkit +provides the 3-D effect for common widgets such as Buttons, Menus and +Toggles and changes were needed to allow these widgets to be used on +TrueColor visuals. + + Other projects had encountered these same problems and patches for +the toolkit were easily found on the web and applied. The older version of +the library source was retained in the distribution for reference in case +future bugs are found. + + One issue still to be investigated is the rendering of widgets on +8-bit pseudocolor displays, which on some systems appears to lose the 3-D +effect. This will be resolved during the "cleanup" phase and would only +affect a very small numbers of users. + + +-------------------------------------------------------------------------------- + +=========================================== +5. CLIENT DISPLAY LIBRARY (CDL) REVISIONS +=========================================== + + +5.1 Display Protocol Changes +----------------------------- + + The following CDL methods were modified in order to implemented the +faster sub-raster I/O described below in section 5.1.2: + + cdl_readSubRaster (cdl, lx, ly, nx, ny, &pix) + cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix) + +The changes made are internal to the procedure and do not affect the +application interface, only the behavior of the procedure. + + Specfically, if the connection to the display server detects a WCS +version greater than "10" (i.e. v1.0), then a new method for writing +subraster data will be used that transfers data directly to the region +specified. This should greatly improve the performance of applications that +do many subraster transfers of this type and is fully backward compatible +to other display servers. + + All that is required to use this feature is to relink the CDL +application with the new version of the library, and to use the XImtool +server distributed with X11iraf V2.0 or later. + + + +-------------------------------------------------------------------------------- + +=================== +6. TECHNICAL NOTES +=================== + + +6.1 IIS Protocol Changes +------------------------- + + + The IIS protocol was modified slightly in this release in order +to provide greatly improved performance of sub-raster read and write oper- +ations from client applications. The change was made to accomodate a +Real-Time Display capability for a new IR Mosaic instrument recently +developed in which the display is loaded simultaneously by independent +clients responsible for different parts of the focal plane. The change +resulted in a 200-fold increase in speed allowing a 4k x 4k image to be +displayed from multiple machines in under a second. + + The details of this change are covered in detail in section 5.1.2 +below but will be automatic for any application linking against the new +version of the CDL library. In summary, earlier versions of the subraster +display were done by reading back the entire width of the frame buffer, +editing the affected pixels and then writing back the rows in the buffer. +For small sub-raster this is highly inefficient but usually acceptable +because of the small number of subraster reads/writes being done. In this +improved version, the pixels in the frame buffer are written directly to +the screen, avoiding the unnecessary readback-edit-write cycle as before. +When displaying a full image into a frame buffer approximately the same +size as the image, the change will not be noticeable. However, when the +image is much smaller than the buffer, or when writing many small +subrasters to the display (e.g tiling images or editing indivual regions), +users should notice a considerable improvement in the speed. + + + +6.1.1 IIS Protocol Summary +--------------------------- + + This section is meant to provide an up-to-date reference of the IIS +protocol used in X11IRAF v2.0, including any changes described above or in +following sections. These changes are implemented in XImtool display +server, the VXImtool virtual frame buffer, and the CDL application library +included with this release. Necessary changes in the current IRAF v2.14 +release are also implied. + + + IIS Header Packet Summary + + TID Subunit Tct X Y Z T Data + +------------------+-------------+-----+---+---+----+---+--------+ +Read Data | IIS_READ|PACKED | MEMORY | -NB | x | y | fr |nx | nbytes | +Write Data | IIS_WRITE|PACKED | MEMORY | -NB | x | y | fr |nx | nbytes | +Read Cursor | IIS_READ | IMCURSOR | - | - | - | wcs| - | - | +Write Cursor | IIS_WRITE | IMCURSOR | - | x | y | wcs| - | - | +Set Frame | IIS_WRITE | LUT|COMMAND | -1 | - | - | - | - | 2 | +Erase Frame | IIS_WRITE | fb | FEEDBACK | - | - | - | fr | - | - | + | | | | | | | | | +Old Read WCS | IIS_READ | WCS | - | - | - | fr | - | 320 | +Old Write WCS | IIS_WRITE|PACKED | WCS | -N | - | - | fr |fb | 320 | + | | | | | | | | | +WCS Version? | IIS_READ | WCS | - | 1 | 1 | - | - | 320 | +WCS by Num.? | IIS_READ | WCS | - | 1 | - | fr |wcs| 1024 | +New Read WCS | IIS_READ | WCS | - | 1 | - | fr | - | 1024 | +New Write WCS | IIS_WRITE|PACKED | WCS | -N | 1 | - | fr |fb | 1024 | + +------------------+-------------+-----+---+---+----+---+--------+ + + +Where nbytes | NB = number of bytes expected or written + x = x position of operation in frame buffer coords + y = y position of operation in frame buffer coords + nx = width of data to be read/written. If zero, the width + of the current frame buffer is assumed. + fr = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written + following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 + + + +6.1.2 Faster Sub-Raster Writes +------------------------------- + + Sub-raster I/O is a special case of the IIS_READ and IIS_WRITE +commands in which the caller specifies the (x,y) position of the operation +and the number of bytes to be transferred. Traditionally, the X position +was always zero (indicating the starting row of the frame buffer), the Y +position was the row to be written and the data sent represented one or +more complete rows of the frame buffer. + + In the new scheme, we take advantage of the unused 't' register in +the IIS header packet to specify the width of the subraster. If this value +remains 0 (zero), we use the old behavior and assume the data are the full +width of the frame buffer. For values greater than zero in the 't' +register, the value is taken to be the width of the subraster to be written +at the given (x,y) position. The size of the subraster is then 't' pixels +wide by 'nbytes/t' rows high. + + When using the cdl_readSubRaster() or cdl_writeSubRaster() methods +in the CDL application library, the setting of the 't' register is handled +automatically on behalf of the caller. This faster display model is used +only if the "iis_version" is greater than 10 meaning CDL applications +should remain backward compatible with the current (as of this writing) +DS9. + + + +------------------------------------------------------------------------------- + +7. POST-RELEASE NOTES +===================== + + +11/18/08 -- Fixed a problem seen on some systems resulting in a BadAlloc + error. This was caused by the resizing of the hcut/vcut plots + such that the widget sizes was being seen as 65534 or so (i.e. + actually negative). + +11/20/08 -- Trapped a bad read on the ISM socket that causes an error message + to be written when you quit XImtool. It is unclear whether + this is related to a 'memory corrupted' message sometimes seen + when quitting. diff --git a/vendor/x11iraf/README b/vendor/x11iraf/README new file mode 100644 index 00000000..c1c32109 --- /dev/null +++ b/vendor/x11iraf/README @@ -0,0 +1,91 @@ +# X11IRAF -- X11/GUI development utilities and applications developed by the +# IRAF Project, National Optical Astronomy Observatories, 1994. +# +# Version 1.2 - Fri Apr 28 14:01:32 MST 2000 +# (Principal authors Doug Tody, Mike Fitzpatrick. Email: iraf@noao.edu) + + README This file + README.install Installation instructions for source or binaries + Imakefile Global x11iraf Imakefile + Revisions Package revisions log + X11IRAF.tmpl Imakefile template for x11iraf + + bin, The binaries get installed here + lib, The libraries get installed here + doc Postscript documentation for the programs + include The header files get installed here + app-defaults The applications defaults files get installed here + man The manual pages are installed here + + cdl Source for the Client Display Library (CDL) + obmsh Source for the OBM shell + xgterm Source for xgterm (xterm with OBM graphics) + ximtool Source for ximtool (image display server/browser) + guidemo Some sample GUI applications + xtapemon IRAF tape monitor GUI + vximtool Source for Virtual XImtool dummy display server + + obm Source for the Object Manager (OBM) + xpm OBM-compatible copy of the X pixmap source + xaw3d OBM-compatible copy of the 3D Xaw widget set + util Miscellaneous utility programs + +The Xaw3D and XPM libraries are publically available software packages which +x11iraf only uses, we did did not develop them. Similarly OBM uses Tcl as +well as a collection of Xt-based widgets, including the FWF (Free Widget +Foundation) widgets, which were developed by others. Even if you already +have copies of these libraries on your system you should let x11iraf use the +included versions, as interface evolution will likely render other versions +incompatible with x11iraf (we periodically update our copies and perform the +necessary integration). + +Both XGterm and XImtool rely upon the IRAF Object Manager for the GUI. +The GUIDEMO package illustrates how to use GUIs in IRAF applications. + +XGterm provides a Tek 4012 compatible graphics terminal emulation plus, for +clients in the know, a datastream driven widget server capability using the +Object Manager to provide full access to the underlying toolkit and widget +set. The remote client application downloads a GUI file to the widget +server (xgterm) which executes the GUI. While the GUI is executing it +exchanges messages with the remote client application at runtime via +interprocess communication. In the case of Xgterm, this currently uses +a serial (tty based) protocol. + +XImtool is an image display server. This provides an image display +capability to remote client applications using the standard imtool/iis image +display protocol. The image display server allows a number of image frame +buffers to be created and displayed. The client can read and write data in +these frame buffers. Any frame or combination of frames can be displayed. +Various display options are provided, e.g., zoom and pan, flip about either +axis, frame blink, windowing of the display, and colortable enhancement. + +XTapemon is a conventional Xt/Athena application which allows the status of +an IRAF tape job to be monitored continuously while the tape is being +accessed. + +Manual pages are included for all the above utilities. + + +INSTALLATION + +Before building x11iraf you should check the archives on iraf.noao.edu to +see if there are already pre-built binaries available for your platform. +To build x11iraf type, in the x11iraf root directory, + + % xmkmf + % make World # (or preferably, make World >& spool &) + +This will do a "make World", build everything, and install into the x11iraf +bin and other install directories. To install somewhere else you can manually +move the binaries to /usr/local/bin or wherever you wish to install them. +Alternatively the X11IRAF.tmpl file can be edited to customize the install. +The minimal install requires moving the executables in bin to a public +directory, and installing the app-defaults files "XGterm" and "XTapemon". +ximtool does not require installation of an app-defaults file. See the +manual pages for more detailed configuration instructions. + +To build the GUIDEMO IRAF package type "mkpkg" in the guidemo directory. + +The LIB and INCLUDE directories should be referenced in applications which +use any of the x11iraf libaries (libobm.a, libXaw3d.a, libXpm.a, libcdl.a). + diff --git a/vendor/x11iraf/README.install b/vendor/x11iraf/README.install new file mode 100644 index 00000000..df6100e2 --- /dev/null +++ b/vendor/x11iraf/README.install @@ -0,0 +1,65 @@ +# X11IRAF -- X11/GUI development utilities and applications developed by the +# IRAF Project, National Optical Astronomy Observatories, 1994. +# +# Version 1.3BETA - Mon Aug 13 00:13:38 MST 2001 +# (Principal authors Doug Tody, Mike Fitzpatrick. Email: iraf@noao.edu) + + +BUILDING FROM SOURCES + +Before building x11iraf you should check the archives on iraf.noao.edu (or +it's mirror sites) to see if there are already pre-built binaries available +for your platform. + +To build x11iraf type, in the x11iraf root directory, + + % xmkmf + % make World # (or preferably, make World >& spool &) + +This will do a "make World", build everything, and install into the x11iraf +bin and other install directories. To install somewhere else you can manually +move the binaries to /usr/local/bin or wherever you wish to install them. +Alternatively the X11IRAF.tmpl file can be edited to customize the install. +The minimal install requires moving the executables in bin to a public +directory, and installing the app-defaults files "XGterm" and "XTapemon". +ximtool does not require installation of an app-defaults file. See the +manual pages for more detailed configuration instructions. + +To build the GUIDEMO IRAF package type "mkpkg" in the guidemo directory. + +The LIB and INCLUDE directories should be referenced in applications which +use any of the x11iraf libaries (libobm.a, libXaw3d.a, libXpm.a, libcdl.a). + + +USING THE INSTALL SCRIPT + +To install the files you can use the new 'install' script by logging in as +the root user and issuing the command: + + # ./install + +Just answer the questions about path destinations and the files will be +moved automatically. Root permissions are required to install the files to +system diretories, however the install script can be used by "normal" users +wishing to install in a private directory. + + +BINARY DISTRIBUTION INSTALLATION + +The binary distributions are all that are required to use the package. +Binaries may be installed in any place normally in the user's path but +we recommend something like the following + + % mv bin./* /usr/local/bin # for the binaries + % mv lib./* /usr/local/lib # for the CDL library + % mv include/* /usr/local/include # for CDL include files + % mv app-defaults/* /usr/lib/X11/app-defaults # app resource defaults + % mv man/* /usr/man/man1 # man pages + +The CDL file installation is not required unless you plan to use it for +building local applications. The app-defaults file are for XGterm and +XTapemon. Note that on Sun systems these files may need to be installed +in the /usr/openwin/lib/app-defaults directory. + +Anyone with questions or problems should feel free to contact site support, +iraf@noao.edu diff --git a/vendor/x11iraf/Revisions b/vendor/x11iraf/Revisions new file mode 120000 index 00000000..3a16add4 --- /dev/null +++ b/vendor/x11iraf/Revisions @@ -0,0 +1 @@ +Revisions.v20 \ No newline at end of file diff --git a/vendor/x11iraf/Revisions.v15 b/vendor/x11iraf/Revisions.v15 new file mode 100644 index 00000000..296f8cb8 --- /dev/null +++ b/vendor/x11iraf/Revisions.v15 @@ -0,0 +1,885 @@ +# X11IRAF V1.0 Notes File +# +# See also the x11iraf$obm/OBM.revs file for a detailed list of changes to OBM. +# +# Begun 6 Mar 1997 +# ----------------------- + +X11IRAF.tmpl + Removed a /* from the comment causing aix to complain + +ximtool/Imakefile + Removed the !@#^% app-defaults install + Change man page install, wasn't working on Solaris + +ximtool/load.c + Removed a qsort call and replaced with a local string sort, avoids + crashes on various platforms + +ximtool/ximtool.c + Fixed -memModel and -fifo_flag bugs + +ximtool/ximtool.gui +ximtool/ximtool-alt.gui + Minor mod to workaround Layout crash on alpha. Also changed "Close" + buttons to be "Done" so all subpanels are consistent. + +ximtool/save.c + Added a missing arg to sprintf causing a segvio. + +obm/widget.c + Changed encoding of obm pointer address for do_text to %lx since + pointers on the alpha overflowed the %x and the pointer was lost. + +ximtool/ximtool.c + Fixed a bug w/ the -fifo flag + +ximtool/ximtool.gui +ximtool/ximtool-alt.gui + Defined width for TextButton widgets to workaround bug on Xterminals. + +ximtool/eps.c + Fixed a missing grestore causing problems for Digital PrintServer 17 + printers. + +ximtool/ximtool.c +ximtool/ximtool.man +ximtool/ximtool.html +ximtool/ximtool.ps + Fixed a bug preventing the resource command line args from actually + taking effect. Also clarified the explanation of the ximprint.cfg + file, regenerated postscript man page. + +xtapemon/xtapemon.man +xtapemon/xtapemon.ps + Following a user suggestion moved the discussion of the amount of + tape used being acurately calculated from the BUGS section to the + DISCUSSION section since it will usually be the case that the count + will be incorrect unless MTEXAMINE is used to position the tape, this + wasn't as obvious before. Regenerated postscript man page. + +obm/ObmW/LayoutP.h +xaw3d/LayoutP.h + Changed the XtMalloc call for creating new objects to XtCalloc calls + so values are properly initialized. Fixes OSF V3.2d1 bug. + +ximtool/fitsio.c + Ifndef AIXV3 for typedef uchar 'cuz it was conflicting + +--------------------------- +V1.0 Patch-1 release 4/5/97 +--------------------------- + +xgterm/main.c + Undef'd memove for SunOS and X11R6 systems + +ximtool/load.c + For large directories the message containing the directory listing + was overflowing the xim_message static buffer, modified to call + OBM directly. + +ximtool/ximclient.c + Fixed a typo in the page size setting page orientation. + +ximtool/ximtool.gui +ximtool/ximtool-alt.gui + Added "send activate" msgs to the main display and colorbar + widgets so the saved cursor position is intialized in the widget. If + this is not done a WCSLAB will sample the cursor before beginning the + display causing the widget to restore unitialized positions which can + blow away the app with a server error. + +ximtool/iis.c + Added IIS packet debugging output triggered by a DEBUG_IIS env var. + +ximtool/iis.c + Removed some code related to setting the fbconfig in the special + case of fbconfig=1 and the window not the same size as the frame + buffer. This was apparently done originally when experimenting with + resizing the window automatically but that was abandoned and this code was never removed. It causes a bug in displaying to an un- + initialized frame. + +ximtool/ximtool.h + Changed FBCONFIG_ENV2 from 'XIMTOOLRC' to 'IMTOOLRC' (6/1) + +ximtool/irafio.c + Modified to handle new OIF V2 images. (6/8) + +ximtool/ximtool.gui +ximtool/newimtool.gui + Deleted windowRGB translations. (6/11) + +ximtool/iis.c + Fixed a missing pair of braces. (7/9) + +ximtool/ximtool.c + Fixed a bug in the -nframes flag (7/9) + +obm/ObmW/Gterm.c +ximtool/ximtool-alt.gui + Implemented magnify marker and cursor movement keystrokes for alt gui. + Fixed bug in scaling raster zero cursor values causing keystroke + moves to 'jump', change in get_draw_context() (7/11) + +ximtool/eps.c +ximtool/eps.h +ximtool/ximtool.gui +ximtool/ximtool-alt.gui + Fixed BoundingBox errors and unmatched grestore preventing inclusion + of images in AASTex docs (8/6) + +ximtool/ximtool.gui +ximtool/ximtool-alt.gui + Added Shift-MB2Up translation to turn off crosshair when button + released. (8/6) + +ximtool/ximtool.c + Added "-rv" toolkit flag. (8/22) + +ximtool/ximtool-alt.gui + Fixed size of magnifier marker, added some common keystroke trans- + lations to markers. (8/22) + +Imakefile +vximtool/ + + Added the Virtual XImtool dummy server (8/22) + +obm/ObmW/Gterm.c + Fixed a bug in GtSetMapping which wasn't returning a success value, + caused an evaluation error on HP (8/26) + +obm/ObmW/Gterm.c + Fixed a bug in refresh_destination() in which only the left side of + an image would be displayed if the FB was bigger than 512x512 and + memModel=beNiceToServer. (8/27) + +obm/ObmW/Gterm.c + Fixed a bug in scale_intzoom in which a beNiceToServer memModel would + display odd zooms factors w/ a yflip. (8/27) + +ximtool/ximtool.man +ximtool/ximtool.html + Misc. typos. (8/28) + +Imakefile +ximtool/ximtool.gui +ximtool/ximtool.html + Changed version to V1.1 set release date as 9/1/97? (8/28) + +ximtool/Imakefile + Modified to automatically build a separate ximtool-alt binary. + Eventually one or the other GUI should be used as the default so + for now there are copies of the needed files and each binary builds + from a different list, but the directory should be cleaned up when + the new features are added permanently (8/28) + +obmsh/Imakefile +obmsh/obmsh.man + + Added a man page for the task (8/28) + +ximtool/raster.c + Fixed an off-by-one bug in the computation of the center when doing + an integer zoom. Caused a one pixel boundary on two sides of a + hardcopy plot (8/29) + +ximtool/ximtool-alt.man +ximtool/ximtool-alt.html + Added documentation for the alt GUI. (8/29) + +ximtool/ximtool.gui +ximtool/ximtool.html + Removed cursor movement commands (9/10) + +obm/Tcl/Imakefile + DU4 now defines OSF1Architecture instead of OSF1, wasn't getting + the right flags. (9/10) + +obm/Imakefile +obm/ObmP.h +ximtool/Imakefile +ximtool/eps.c +ximtool/fitsio.c +ximtool/gifio.c +ximtool/irafio.c + Digital Unix 4 now defines a uchar typedef so had I had to define + an OSF1 flag to workaround the local typedefs causing compiler errors. + (9/10) + +xpm/Imakefile +xaw3d/Imakefile + Needed to add a 'all' target specifying the library to be built. + On AIX these Imakefiles create an enpty all target and the library + is skipped since it thinks the (empty) target is up to date. (9/10) + +vximtool/vximtool.c + Need to ifdef include for AIX (9/10) + +-------------------- +V1.1 Release (9/10) +-------------------- + +ximtool/eps.c + Fixed the gsave/grestore pairing again. Somehow the change got + lost and had to be redone, this slipped by earlier testing for + the V2.1 release. (11/3) + +ximtool/ximtool.gui +ximtool/ximtool-alt.gui +ximtool/ximtool-mag.gui + Change the winWidth/winHeight initialization to query the imagewin + rather than use a fixed 512 size. This is required to properly scale + the image when the window size was set with a geometry flag/resource + (11/20) + +vximtool/vximtool.c + Changed so that when the stdin is added to the select list only when + -i is not set explicitly, or when -background is used explicitly. + +ximtool/ximtool-alt +ximtool/ximtool-mag + Moved the #!/bin/csh to line 1 so scripts may be executed from + Bourne shells (3/15/98) + +ximtool/print.c +ximtool/save.c +ximtool/irafio.c + Fixed complaints about incompatible pointer types from GCC (3/31/98) + +ximtool/ximtool.c + Added error handling code to dump core after 5 errors received if + XGXERROR set to 'dumpcore', or exit on 'exit'. (4/2/98) + +xaw3d --> xaw3d-old +xaw3d/Scrollbar*.[ch] +xaw3d/ThreeD*.[ch] + Replaced Scrollbar widget with one from the Xaw3d V1.3 library which + gives a true 3D Motif-like scrollbar with arrows. + +xgterm --> xgterm-old +xgterm/ (all sources) + 1) Diff-merged to bring XGterm up to X11R6 version + 2) Numerous bug fixes to the dynamic colors code so it can properly + be enabled/disabled via +/-dc flags or dynamicColors resource. + 3) Made the right-side scrollbar a runtime +/-sbr option or + scrollBarRight resource + 4) Merged new 3D scrollbar and color resources into app-defaults file + +ximtool/ximtool.gui +ximtool/ximtool-alt.gui +ximtool/ximtool-mag.gui + Added new Scrollbar resources for the help and info panels to get + the 3-D effect. (4/28/98) + +ximtool/load.c + Fixed a bug in which loading e.g. frame 2 with certain frame buffers + would cause the image load to fail. The imtoolrc file for some FBs + only define one frame by default, the code was not initializing any + more that specified even if it was load some other frame (5/7/98) + +ximtool/iis.c + Fixed a bug in which turning off the DISPLAY 'select' param could + erase frame 1. (5/16/98) + +ximtool/zscale.c + Changed the comparison function for qsort to handle cases where the + range of data is <1.0 (6/1/98) + +obm/server.c + Fixed a bug affecting the use of "-display" when DISPLAY wasn't also + set in the environment. The call to XtOpenDisplay at line 385 was + passing '""' as a argument for the display name instead of NULL and + so the routine wasn't parsing for the argument internally, and if + DISPLAY wasn't set in the environment as a backup this would result + in a NULL Display pointer being returned which would segvio on the + next line. Added an error check for a NULL return from XtOpenDisplay. + (6/4/98) + +ximtool/raster.c +obm/Tcl/tclExpr.c +obm/Tcl/tclParse.c + Added a redefinition of isalnum() for linux systems to work around + an incompatibility of the definition of this macro between Slackware + and RedHat 4.2 systems. (6/4/98) + +xgterm/charproc.c + Increased TEXT_BUF_SIZE from 256 to 1024 to allow longer input lines, + e.g. when doing a cut-n-paste of compiler verbose output which expands + path names. (6/17/98) + +ximtool/iis.c + Fixed a bug in which resetting the FB and displaying to frame >1 + would leave the server displaying frame 1. (6/17/98) + +ximtool/ximtool.c + Fixed a typo in the pointer allocation for a -fifo opt (9/3/98) + +ximtool/iis.c +vximtool/vximtool.c + Changed the read()/write() calls to new routines which loop until + all of the expected bytes have been read or written. On inet socket + connections it's possible that the I/O would return a short count if + a kernel buffer filled up causing bad reads and eventually a crash. + This may also explain the occassional "bad header checksum" errors + that have been reported. (9/26/98) + +xgterm/main.c + Moved a block of code to get a pty for IRIX 6.5 systems to avoid an + segvio when out of ptys. The old code was left where it was for + earlier versions. (12/2/98) + +ximtool/irafio.c + There was a duplicate close of the image header which caused a + memory corruption on linux systems when loading an image on the + command line. (2/8/99) + +Imakefile +*/Imakefile +mkarch + + Added support for doing multiple architectures. (3/2/99) + +xaw3d/AsciiSink.c + Removed the 'black box' drawn on the right side of the screen + indicating there is more text off the screen. (3/30/99) + +xgterm/gtermio.c + Fixed a bug in the arg ordering of the call to GtReadPixels() (4/22/99) + +xgterm/gtermio.c + The colormap readback required that the rgb arrays be right shifted + 8 bit for the value to be interpreted correctly. (4/24/99) + +Imakefile +ximtool/*.gui + Increased version number to V1.2, set expected release date 5/30/99. + +ximtool/iis.c +ximtool/raster.c + Fixed a problem with initialize frames when adding new frames while + in tile mode. Previously if there were 2 frames defined and you + displayed to frame 3 you would be dumped from tile mode silently, + the new code just changes the number of tile frames. Also fixed + was a bug where displaying to a new fbconfig was not reinitializing + the tile mode properly (e.g. in a 4-frame tile changing to a 2-frame + config would leave the task in 4-frame mode and improperly clear + the screen mapping). (5/17/99) + +xgterm/misc.c + Modified the xerror() procedure to recognize XGXERROR as 'ignore' + which will cause the error to be ignored and not counted towards the + total which eventually causes the task to exit. Also added an + XGMAXERROR environment variable which can be defined to set the + limit. (8/24/99) + +xgterm/gtermio.c + 1) Modified so any buffered output is flushed when activated. This + is to keep any GUI client commands that may have been caused by + pushing buttons while the client program isn't running from being + read by the next cursor read. For example after the GUI is done + it may not be unmapped and a 'Quit' key send a 'q' keystroke. One + could hit the button several times causing numerous 'q' commands to + be buffered, the next interactive task would get the keystrokes + and probably quit itself, causing confusion for the user. + 2) Also posted a dummy gio_deactivate_cb() procedure. This appears + to be necessary to catch a window-close event such as can be done + from the window manager menubar or 'X' button. (8/24/99) + +ximtool/raster.c + Modified the frame buffer config open procedure to set defaults for + commonly used sizes such as 1K, 2K, etc. Also modified to search for + the imtoolrc file in additional directories such as /opt/local/lib, + /iraf/iraf/dev, and if not found will now print out a warning + message. (9/8/99) + +ximtool/print.c +ximtool/ximtool*.gui + Made the title/colorbar/borders are optional. (11/9/99) + +ximtool/iis.c + Added a SO_REUSEADDR option to the inet socket (11/99) + +ximtool/ximtool*.gui + Added new keystrke commands Ctrl- and Ctrl-Alt- to + move the frame one or a hald panner width in the given direction. + This is useful for panning full window frames around large mosaic + images (12/99) + +ximtool/save.c +ximtool/tiffio.c + +ximtool/ximtool*.gui + Added a TIFF output format option for the save command. This is a + very basic TIFF file, input cannot be supported without supporting + the full tiff library. (2/00) + +xaw3d/Imakefile +xaw3d/Text.c MF039 +xaw3d/TextTr.c + Modified the code to make _XawDefaultTextTranslations a static array + rather than one allocated and never freed. Required changes to the + array declaration in TextTr.c, and textClassRec definition and + ClassInitialize() procedure. (3/2/00) + +cdl/imd.c + Fixed a bug in the drawing of markers where the start coord for + the subraster is (1,1). When writing out the subraster the + routine was incorrectly deciding that the frame buffer did not + need to be readback to edit the subraster. (3/14/00) + +ximtool/ximtool.gui + Deleted a debug print statement (3/15/00) + +xaw3d/Label.c +xaw3d/List.c +xaw3d/Panner.c +xaw3d/Scrollbar.c +xaw3d/SmeBSB.c +obm/ObmW/Gcs.c +obm/ObmW/Tabs.c +obm/ObmW/MultiList.c + Added an #ifdef USE_XMU_STIPPLE around code calling the + XmuCreateStippledPixemap() routine. This procedure maintains a cache + of the pixmaps which would be corrupted at somepoint resulting in + BadGC and BadPixmap errors, causing xgterm stability problems. (3/28/00) + +xaw3d/Paned.c +xaw3d/Simple.c +xaw3d/SimpleMenu.c +obm/ObmW/Frame.c + Added and #ifdef USW_CWCURSOR around code which adds the CW_Cursor + XCreateWindow attribute in widget creation. This was causing various + BadCursor bugs in the X lib which would cascade and result in xgterm + stability problems. (3/28/00) + +cdl/cdl.c **** INTERFACE CHANGE **** + Modified the behavior of cdl_getFrame() to do a sampling cursor + read to get the frame buffer from the server. If the value returned + is zero (as from SAOimage) the current value of the frame number in + the CDL is returned. (3/29/00) + +cdl/cdl.[ch] **** INTERFACE CHANGE **** +cdl/imd.c **** INTERFACE CHANGE **** +cdl/comm.c **** INTERFACE CHANGE **** +cdl/cdl_f77.[ch] **** INTERFACE CHANGE **** +cdl/cdl_spp.c **** INTERFACE CHANGE **** +cdl/examples/tvmark.c **** INTERFACE CHANGE **** +cdl/test/cdltest.c **** INTERFACE CHANGE **** +cdl/test/imdtest.c **** INTERFACE CHANGE **** + Modified the cdl_readCursor() routine to have a new 'wcs' argument + to return the WCS of the cursor read. This is to allow applications + to get the frame number of the read from the wcs (i.e. wcs is + coded as "frame * 100 + wcs". (3/29/00) + +xaw3d/Text.h + Removed include of . Comments indicate this is + only required for R3 compatability but due to changes the the Xaw + text widget in XFree86 V4 the include file changes were causing + compile problems. (4/5/00) + +xgterm/screen.c +xgterm/scrollbar.c + Removed declarations for calloc/malloc/realloc since they were + conflicting and causing build problems on Solaris 8. + Used explicit cast of pointer when needed in code instead. (4/5/00) + +X11IRAF.tmpl +obm/ObmW/Imakefile + Modified CCOPTIONS for Solaris 8 and HPUX build of new Tab widgets. + (4/5/00) + +ximtool/ximtool.gui +ximtool/ximtool-mag.gui +ximtool/ximtool-alt.gui + Updated translation tables with Ctrl-M and Ctrl-P keystrokes to + toggle magnifier/panner markers. (4/7/00) + +xgterm/misc.c + Changed the default behavior of the xerror() handler to ignore any + BadCursor events. A new action value, 'catchall', can be defined + to bypass this and count all error actions toward the final + shutdown. (4/7/00) + +cdl.h + Fixed a typo in the prototype declaration for cdl_readCursor (4/14/00) + +xgterm/misc.c + Fixed a bug in the way BadCursor errors were being ignored. (4/14/00) + +xgterm/gtermio.c + Forgot to merge in a change mapping LFLF to LF the same way CRLF is + currently mapped. On Alpha systems there is an apparent bug in the + stdgraph kernel causing this to extra char to be inserted and + confusing the interpretation of the GUI message. Hacked around this + for now by mapping LFLF to a single LF but it needs to be investigated + further. (4/14/00) + +X11IRAF.tmpl + Added a special-case XTOOLONLYLIB flag so binaries built on lyra + will use the patched Xt library needed to work around the "Attempt + to manage a child widget when parent is not Composite" message + during shutdown. (4/14/00) + +cdl/mkpkg + + Added a mkpkg file to build the library. Requested by Ken Mighell + for use in one of his packages. (4/17/00) + +mkarch +obm/Tcl/tclInt.h +obm/ObmW/HTML-PSformat.c + Added a workaround for our old use of the varargs macros which was + causing problems under LinuxPPC. Also changed arch name from + mklinux to linuxppc. (4/18/00) + +ximtool/ximtool-mag.c + Increased the size of some command-line arg buffers. This was done + for the ximtool.c code earlier but never propogated. (4/26/00) + +xgterm/Imakefile + Removed the '-lcurses' termlib for HP systems. Under HP-UX 10.10 + there is a bug in the curses library select() routine which could + cause the xgterm to hang. (5/1/00) + +------------------------ +V1.2 Release (5/1/2000) +------------------------ + +ximtool/tiffio.c + Fixed a byte order problem for TIFF images on swapped systems (7/10/00) + +vximtool/vximtool.c +cdl/vximtool.c + Added an #ifdef AIX for on AIX systems (7/10/00) + +obm/ObmW/Gterm.c + Removed the comment chars for XRecolorCursor first done for MF030. + While these do trigger BadCursor errors these will now be ignored by + the xgterm error handler. (4/7/00) + +obm/server.c + Changed a malloc to a calloc call for the timer struct. Also deleted + an XtFree for the callback in serverTimedProc() which would corrupt + memory if the timer callback were later deleted. (7/28/00) + +obm/ObmP.h +obm/Obm.c + Added support for a new environent variable OBMOBJECTS which will help + restrict the messages printed during debugging. For example, it can be + set as + + setenv OBMOBJECTS "client imagewin" + + to have OBMDEBUG print only messages for the 'client' and 'imagewin' + objects. (8/3/00) + +ximtool/Imakefile +ximtool/ximtool.c +ximtool/ximtool.gui +ximtool/ximtool-mag.* - + Removed the ximtool-mag command to the 'OLD' subdirectory and merged + the magnifier marker into the default GUI. (7/28/00) + +ximtool/raster.c +ximtool/ximclient.c +ximtool/ximtool.gui +ximtool/ximtool-alt.gui + Added new client callbacks 'centroid', 'offsetRegister' and 'setOffset' + as part of the implementation of the DEIMOS peak-up and auto-register + features. (8/3/00). + +ximtool/ximtool.c + Added a check for the visual at startup so the task can exit with a + more informative message than just the BadMatch error. (8/3/00) + +obm/client.c +obmsh/obmsh.c +xgterm/gtermio.c +ximtool/ximclient.c + Modified the clientOutput callbacks to accept a new 'objname' argument. + By default this will be "client" but in the case of XImtool this would + allow a new client (the ISM) to be connected to the OBM by name. (8/11/00) + +obm/widget.c + Added a new 'setTop' command for the Tabs widget that can be used to + raise a particular tab from within the GUI. (8/29/00) + +ximtool/ximclient.c +ximtool/gui/print.tcl + Minor fixes to finish implementing B5 paper size (1/8/02) + +version.h +ximtool/gui/main.obj +ximtool/gui/main-alt.obj + Updated the version string from V1.3DEVELOP to V1.3EXPORT (1/25/02) + +ximtool/clients/wcspix/wcimage.x + Fixed a bug in the WCS info computation for images which don't actually + have a WCS, causing a segvio under sparc (1/31/02) + +ximtool/gui + Changed the default width/height of the hcut/vcut plots to 1 pixel + from zero to avoid problems found on some X servers. Also fixed a + bug in the tile-mode initialization. + +------------------------- +V1.3 Release (02/03/2002) +------------------------- + +ximtool/gui/global.res + Prefixed all resources with a Class name to avoid mixups with desktop + color settings. (2/8/02) + +ximtool/raster.c + Modified the xim_labelTiles() procedure to draw the labels by creating + text markers internally for each label. This avoids problems with using + X text drawing and allows the markers to be moved by the user as needed. + (2/8/02) + +ximtool/gui/panel.obj +ximtool/gui/tile.res + Fixed some color problems in the GUI. (2/8/02) + +ximtool/clients/lib/dspmmap.x (from V2.12 code) + Added the feature that the bad pixel mask or overlay mask may be + specified by a keyword value with the syntax !. This is + important for multiextension files where various masks are set + as keywords. The new task OBJMASKS also writes the object mask name + that is created for an image in the header. Use of !objmask then + allows the object mask to be used for the bad pixel mask (to set + the scaling using only sky pixels) and for overlay. + +cdl/vximtool.c +ximtool/raster.c +vximtool/vximtool.c + Fixed a pointer allocation problem in the get_fbconfig() procedure + causing a segfault. (2/15/02) + +ximtool/ximtool.c + Fixed a bug in the -tile flag not starting up in tile mode (2/24/02) + +ximtool/gui +ximtool/clients + Reworked the code to be more efficient when doing cursor translations. + Also disabled the BPM mapping at startup to speed startup of the ISM + cache. (2/24/02) + +ximtool/gui/main.res +ximtool/gui/main-alt.res +ximtool/gui/plots.tcl + Changed the plotOps object to be completely resizeable and unmapped + at the start to avoid a BadAlloc msg on sun older OW servers. (2/26/02) + +ximtool/ximtool.c + Local variable used to store the tile option wasn't properly initialized + meaning the task could start up in tile mode. (2/28/02) + +ximtool/clients/wcspix/t_wcspix.x + The new wp_read() routine wasn't properly returning an EOF meaning the + task could be left a zombie if the server crashed. (2/28/02) + +ximtool/gui/main.res +ximtool/gui/main-alt.res +ximtool/gui/plots.tcl + More fixes same as above but on the cut-plot widgets. (2/28/02) + +ximtool/gui/global.tcl +ximtool/gui/main-alt.obj +ximtool/gui/main.obj + Updated GUI version strings to V1.3EXPORT from V1.3DEVELOP (2/28/02) + +ximtool/gui + Minor fixes for getting '-geometry' to work, the alt-gui resizing when + closing the toolbars, and cut-graph geometry causing the gui to die + on some sun systems. (3/2/02) + +ximtool/iis.c + Minor fix for ISM readout error when displaying image sections (3/3/02) + +ximtool/gui +ximtool/clients/wcspix + Implemented a "display" coordinate readout as the default when there is + no image WCS. This is essentially the coordinate system used by + calculating from the frame buffer wcs and the one you get when the ISM + isn't running. When displaying image sections this becomes the 'physical' + coordinate referenced to the parent image same as always rather than the + true 'logical' coordinate that was printed previously. (3/4/02) + +install + Fixed a bug in the install script not supplying a proper default. (3/6/02) + +ximtool/clients/wcspix/wcimage.x + Fixed a but in the transformation of GAPPT/FK4-NO-E projections (3/20/02) + +ximtool/gui/ism.tcl +ximtool/gui/compass.tcl +ximtool/clients/wcspix/wcimage.x +ximtool/clients/wcspix/wcunknown.x + Various fixes to allow the ISM to work on transposed images (coord + readout and compass indicator). (3/21/02) + +ximtool/gui/main.obj +ximtool/gui/main.res +ximtool/gui/panel.tcl +ximtool/gui/imagewin.tcl + The control panel Dismiss wasn't toggling the control panel button on + the "classic" gui menubar. Also found that there was a potential name + conflict with objects used in the alt-gui for 'panelButton' (3/21/02) + +ximtool/iis.c +ximtool/clients/wcspix/wcimage.x + Fixes related to coord readout when displaying image sections (3/22/02) + +ximtool/gui/ism.tcl +ximtool/gui/pixtab.tcl +ximtool/clients/wcspix/wcimage.x + Pixel table data was being sent when it wasn't needed, optimized to + avoid this case. (3/22/02) + +---------------- +Mac OS X port +---------------- + +./mkarch +./install + Added branch for OS X (4/1/02) + +obm/Tcl/Imakefile + Added a branch for OS X (4/1/02) + +obm/Tcl/tclInt.h + Added an #ifdef __DARWIN__ to use instead of , + modified the va_start stuff just below that to trigger on only + __powerpc__ to work with both linux and darwin. + +xaw3d/AsciiSrc.c +xaw3d/TextPop.c +xgterm/misc.c +ximtool/ximtool.c + Added an #ifdef __DARWIN__ for the sys_errlist declarations (4/4/02) + +xaw3d/Imakefile + Added a case in the 'includes' to create a symlink 'Xaw' pointing to + the x11iraf$include/X11/Xaw3d dir so we pick up the local .h files. Some + files, esp TextSink.h, appear broken under Darwin. (4/5/02) + +X11IRAF.tmpl + Added a '-w' flag to the default CCOPTIONS for 'PpcDarwinArchitecture' + to shut up the warnings. (4/5/02) + +obm/ObmW/Imakefile +obm/ObmW/icon.c -> iconutil.c +obm/ObmW/icon.c.ORIG -> iconutil.c.ORIG + Incredibly filenames under OS X are case-insensitive and the 'Icon.c' + widget source was being wiped out by the 'icon.c' utility code. Renamed + the file to avoid this. (4/5/02) + +obm/ObmW/Imakefile +obm/Tcl/Imakefile + Added '-traditional-cpp' compile flags to work around the problems with + (4/5/02) + +Imakefile + Ifdef'd out the 'make depend' for OS X since I couldn't find a way to + make this work without getting the errors that's fixed by + the -traditional-cpp flag. (4/5/02) + +obm/ObmW/Imakefile + Added a target to 'all' to build laylex.c and laygram.c (4/5/02) + +----------------- +System builds now +----------------- + +obmsh/obmsh.c + The OBMSH task would segfault in main() due to a problem with the static + allocation of a 1Mb char buffer for the GUI message when used as a shell. + Changed to an allocated pointer and it works now. (4/6/02) + +install + OS X puts the app-defaults in /etc/X11/app-defaults, added that as a + fallback for the install script prompt. (4/6/02) + +Imakefile +X11IRAF.tmpl +xaw3d/Imakefile +obm/ObmW/Imakefile +obm/Tcl/Imakefile + Modified the PpcDarwinArchitecture defines to also check 'TenonServer' + for systems not using the XFree86 server (4/23/02) + +ximtool/iis.c +ximtool/ximtool.c +ximtool/ximclient.c + Minor changes to allow the cmdline flags to properly disable input + connections (fifo, etc) and show a 'disabled' status in the info box. + Also clarified the warnings printed for EADDRINUSE and ifdef'd the + fifo opening so it's never used (we can't write to /dev in OS X). + (4/29/02) + +------------------------------ +X11IRAF V1.3 Released (5/7/02) + +xaw3d/AllWidgets.c +xaw3d/XawInit.c + Removed __DARWIN__ ifdefs around vendorShellWidgetClass definitions. + This was put in originally to avoid link-time errors under OSX but had + the effect of keeping the DYLD_FLAT_NAMESPACE workaround from doing + anything. (7/5/02) + +------------------------------ +X11IRAF V1.3.1 Released (7/15/02) + +obm/server.c + Modified serverActivate() to supply input focus hints to workaround + problems with certain window managers (e.g. FVWM2). (7/8/02) + +guidemo/table.gui + Added demo GUI for the TABLE widget which includes "metawidget" code + to encapsulate row/col labels, scrollbars, support routines etc around + a simple Table widget. The code provides an interface to a composite + "widget" which can be instantiated any number of times and is addressed + by a name assigned at creation time. (10/02) + +ximtool/load.c +ximtool/gui/load.tcl + Fixed a bug where setting z1/z2 values in the Load panel would overwrite + the z2 with the z1 value. (10/4/02) + +Imakefile + Updated 'RELEASE' to v1.3.2 (1/14/03) + +ximtool/gui/compass.tcl +ximtool/clients/wcspix/wcimage.x + Fixed a problem in the compass indicator which assumed North was always + either up or down. For images where N was to the right and E up the + rotation could legally be zero degrees but the indicator was wrong. + Switched to a new algorithm in which the compass arms are computed + directly from the image CD matrix. (1/16/03) + +xgterm/charproc.c + Had to add an "#ifndef X_NOT_STDC_ENV" to include instead + of the char* declarations for malloc/realloc to workaround a declaration + type conflict under FreeBSD 4.7 (1/16/03) + +ximtool/fitsio.c + Removed a restriction on the FITS header reader that the card value + end at column 30. Fixes a problem with FITS files produced by Image- + Magick where BITPIX is in the "wrong" place. (7/1/03) + +vximtool/vximtool.c + Fixed a bug in displaying to frame 16. (2/22/04) + +ximtool/gui/panel.tcl + Modified the changeFrame callback to only request image header updates + when the panel is visible to improve response time (3/3/04) + +ximtool/Imakefile +ximtool/ximtool-old.csh + +ximtool/gui/mkgui +ximtool/gui/main.obj -> main-old.obj +ximtool/gui/main.res -> main-old.res +ximtool/gui/main-alt.obj -> main.obj +ximtool/gui/main-alt.res -> main.res +ximtool/gui/alt.tcl -> toolbars.tcl + Changed the default GUI for XImtool to be the 'alt' gui. The original + gui is accessible through an 'ximtool-old' script command, and the + 'ximtool-alt' is still around as a compatability command for people who + have this in WM menu files. Just typing 'ximtool' however, now brings + up the alt gui. (3/3/04) diff --git a/vendor/x11iraf/Revisions.v20 b/vendor/x11iraf/Revisions.v20 new file mode 100644 index 00000000..277f920c --- /dev/null +++ b/vendor/x11iraf/Revisions.v20 @@ -0,0 +1,20 @@ +# +# X11IRAF V2.0 Notes File +# +# See also the x11iraf$obm/OBM.revs file for a detailed list of changes to OBM. +# +# +# The V2.0 Release of this package is identical in most respects to the +# earlier v1.5 release with the exception that 24-bit TrueColor visual +# displays are now supported in XImtool. +# +# +#=============================================================================== +# +# Release History: +# +# Nov 16, 2008 - V2.0BETA Initial Release for Linux/Mac +# +#=============================================================================== + + diff --git a/vendor/x11iraf/X11IRAF.tmpl b/vendor/x11iraf/X11IRAF.tmpl new file mode 100644 index 00000000..1296455c --- /dev/null +++ b/vendor/x11iraf/X11IRAF.tmpl @@ -0,0 +1,200 @@ +/* + * Imake template and rules for X11IRAF. + * + * Mike Fitzpatrick, National Optical Astronomy Observatories, IRAF project. + * Aug 19 1996 + */ + +#include + +/* CONFIGURE: You may edit the symbol definitions below as you see fit, + * e.g. change the definition of "InstallLibraries" and "InstallIncludes" + * to "YES" if you want to have the libraries and include files installed, + * see below for *where* they will be installed. + */ +#ifndef InstallBinaries +#define InstallBinaries YES +#endif +#ifndef InstallManuals +#define InstallManuals YES +#endif +#ifndef InstallAppdefs +#define InstallAppdefs YES +#endif +#ifndef InstallLibraries +#define InstallLibraries YES +#endif +#ifndef InstallIncludes +#define InstallIncludes YES +#endif + +/* CONFIGURE: Where to install X11IRAF (defaults to the X11IRAF directories). + */ +#ifndef X11irafDir /* defaults to nothing */ +#define X11irafDir +#endif +#ifndef X11irafBinDir +#define X11irafBinDir $(X11IRAFDIR)/bin +#endif +#ifndef X11irafManDir +#define X11irafManDir $(X11IRAFDIR)/man +#endif +#ifndef X11irafLibDir +#define X11irafLibDir $(X11IRAFDIR)/lib +#endif +#ifndef X11irafIncDir +#define X11irafIncDir $(X11IRAFDIR)/include +#endif +#ifndef X11irafAppDir +#define X11irafAppDir $(X11IRAFDIR)/app-defaults +#endif + +/******************************************************************************/ +/********************** End of configurable definitions. **********************/ +/******************************************************************************/ + + +/* Subdirectories: */ +#ifndef XGtermDir +#define XGtermDir $(X11IRAFDIR)/xgterm +#endif +#ifndef XImtoolDir +#define XImtoolDir $(X11IRAFDIR)/ximtool +#endif +#ifndef XTapemonDir +#define XTapemonDir $(X11IRAFDIR)/xtapemon +#endif +#ifndef ObmshDir +#define ObmshDir $(X11IRAFDIR)/obmsh +#endif +#ifndef ObmDir +#define ObmDir $(X11IRAFDIR)/obm +#endif +#ifndef Xaw3dDir +#define Xaw3dDir $(X11IRAFDIR)/xaw3d +#endif +#ifndef XpmDir +#define XpmDir $(X11IRAFDIR)/xpm +#endif +#ifndef CDLDir +#define CDLDir $(X11IRAFDIR)/cdl +#endif + +/* Libraries: */ +#ifndef LibObm +#define LibObm -lobm +#endif +#ifndef LibXpm +#define LibXpm -lXpm +#endif +#ifndef LibXaw3d +#define LibXaw3d -lXaw3d +#endif +#ifndef LibCDL +#define LibCDL -lcdl +#endif + +/* Dependency libraries: */ +#ifndef DepLibObm +#define DepLibObm $(OBMDIR)/libobm.a +#endif +#ifndef DepLibXpm +#define DepLibXpm $(XPMDIR)/libXpm.a +#endif +#ifndef DepLibXaw3d +#define DepLibXaw3d $(XAW3DDIR)/libXaw3d.a +#endif +#ifndef DepLibCDL +#define DepLibCDL $(CDLDIR)/libcdl.a +#endif + + + X11IRAFBINDIR = X11irafBinDir + X11IRAFMANDIR = X11irafManDir + X11IRAFLIBDIR = X11irafLibDir + X11IRAFINCDIR = X11irafIncDir + + XGTERMDIR = XGtermDir + XIMTOOLDIR = XImtoolDir + XTAPEMONDIR = XTapemonDir + OBMSHDIR = ObmshDir + OBMDIR = ObmDir + XPMDIR = XpmDir + XAW3DDIR = Xaw3dDir + CDLDIR = CDLDir + + DEPLIBOBM = DepLibObm + LIBOBM = LibObm + DEPLIBXPM = DepLibXpm + LIBXPM = LibXpm + DEPLIBXAW3D = DepLibXaw3d + LIBXAW3D = LibXaw3d + LIBCDL = LibCDL + + X11IRAF_LDFLAGS = -L$(X11IRAFDIR)/lib -L../lib + X11IRAF_INCLUDES = -I$(X11IRAFDIR)/include -I../include + + +/******************************************************************************/ +/******************** Architecture specific definitions. **********************/ +/******************************************************************************/ + +/* Redefine $(CP) to preserve the filedate so we don't recompile unnecessarily + * after a 'make install'. + */ + CP = cp -p + + +/* For Solaris x86 check to see whether the SUNPro compilers are actually + * installed, if not assume we have GCC available and use it instead. + */ +#if defined(i386Architecture) && defined(SunArchitecture) + CC:sh = if test /opt/SUNWspro/bin/cc ; \ + then \ + echo gcc ; \ + fi +#if CC == gcc +#define UseGCC YES + CCOPTIONS = + EXTRA_LDOPTIONS = +#endif +#endif + +/* Hack to compile under SunPRO V4 on Sun Solaris */ +#if !defined(UseGCC) +#if defined (SunArchitecture) && HasSunC && OSMajorVersion >= 5 +#if OSMinorVersion <= 5 + CCOPTIONS = -Xs + EXTRA_LDOPTIONS = -xildoff +#else + CCOPTIONS = + EXTRA_LDOPTIONS = -xildoff +#endif +#endif +#endif + +/* Set needed flags for the HP. */ +#if defined (HPArchitecture) + CCOPTIONS = -DHPUX +#endif + +/* Set needed flags for the DECStations. */ +#if defined (UltrixArchitecture) + CCOPTIONS = -DULTRIX +#endif + +/* Set needed flags for the Alpha. */ +#if defined (OSF1Architecture) && OSMajorVersion >= 4 + CCOPTIONS = -DOSF1 +#endif + +/* Hack needed so binaries built on NOAO Alpha use patched Xt library */ +#if defined (OSF1Architecture) && OSMajorVersion >= 4 +XTOOLONLYLIB = -no_so -lXt -so_archive +#endif + +/* Set needed flags for the OS X. Shut off the endless -Wall warnings.*/ +#if defined (DarwinArchitecture) + CCOPTIONS = -w +#endif + diff --git a/vendor/x11iraf/app-defaults/XGterm b/vendor/x11iraf/app-defaults/XGterm new file mode 100644 index 00000000..644f5a68 --- /dev/null +++ b/vendor/x11iraf/app-defaults/XGterm @@ -0,0 +1,112 @@ +*SimpleMenu*BackingStore: NotUseful +*SimpleMenu*font: -adobe-helvetica-bold-r-normal--*-100-*-*-*-*-iso8859-* +*SimpleMenu*menuLabel.vertSpace: 100 +*SimpleMenu*HorizontalMargins: 16 +*SimpleMenu*vertSpace: 10 +*SimpleMenu*Cursor: left_ptr + +! Comment out if not color display. +*SimpleMenu*menuLabel.foreground: White +*SimpleMenu.borderColor: black +!.xgterm.SimpleMenu.background: #7c8498 +!.gterm-iraf.tekMenu.background: #7c8498 +.xgterm.SimpleMenu.background: #8992a8 +.gterm-iraf.tekMenu.background: #8992a8 +*SimpleMenu*foreground: Black + +! The following is for Xaw3d. +*beNiceToColormap: False + +*mainMenu.Label: Main Options +*mainMenu*securekbd*Label: Secure Keyboard +*mainMenu*allowsends*Label: Allow SendEvents +*mainMenu*logging*Label: Log to File +*mainMenu*redraw*Label: Redraw Window +*mainMenu*suspend*Label: Send STOP Signal +*mainMenu*continue*Label: Send CONT Signal +*mainMenu*interrupt*Label: Send INT Signal +*mainMenu*hangup*Label: Send HUP Signal +*mainMenu*terminate*Label: Send TERM Signal +*mainMenu*kill*Label: Send KILL Signal +*mainMenu*quit*Label: Quit + +*fontMenu.Label: VT Fonts +*fontMenu*fontdefault*Label: Default +*fontMenu*font1*Label: Unreadable +*VT100*font1: nil2 +*fontMenu*font2*Label: Tiny +*VT100*font2: 5x7 +*fontMenu*font3*Label: Small +*VT100*font3: 6x10 +*fontMenu*font4*Label: Medium +*VT100*font4: 7x13 +*fontMenu*font5*Label: Large +*VT100*font5: 9x15 +*fontMenu*font6*Label: Huge +*VT100*font6: 10x20 +*fontMenu*fontescape*Label: Escape Sequence +*fontMenu*fontsel*Label: Selection +!fontescape and fontsel overridden by application + +*vtMenu.Label: Control Options +*vtMenu*scrollbar*Label: Enable Scrollbar +*vtMenu*jumpscroll*Label: Enable Jump Scroll +*vtMenu*reversevideo*Label: Enable Reverse Video +*vtMenu*colortext*Label: Enable Color Text +*vtMenu*autowrap*Label: Enable Auto Wraparound +*vtMenu*reversewrap*Label: Enable Reverse Wraparound +*vtMenu*autolinefeed*Label: Enable Auto Linefeed +*vtMenu*appcursor*Label: Enable Application Cursor Keys +*vtMenu*appkeypad*Label: Enable Application Keypad +*vtMenu*scrollkey*Label: Scroll to Bottom on Key Press +*vtMenu*scrollttyoutput*Label: Scroll to Bottom on Tty Output +*vtMenu*allow132*Label: Allow 80/132 Column Switching +*vtMenu*cursesemul*Label: Enable Curses Emulation +*vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*marginbell*Label: Enable Margin Bell +*vtMenu*altscreen*Label: Show Alternate Screen +*vtMenu*softreset*Label: Do Soft Reset +*vtMenu*hardreset*Label: Do Full Reset +*vtMenu*clearsavedlines*Label: Reset and Clear Saved Lines +*vtMenu*gioenable*Label: Enable Graphics Capabilities +*vtMenu*tekshow*Label: Show Graphics Window +*vtMenu*tekmode*Label: Switch to Graphics Mode +*vtMenu*tekreset*Label: Reset Graphics Window +*vtMenu*vthide*Label: Hide VT Window + +*tekMenu.Label: Graphics Options +*tekMenu*tekpage*Label: Clear window +*tekMenu*tekhide*Label: Hide Window +*tekMenu*vtshow*Label: Show VT Window +*tekMenu*tekreset*Label: Destroy Window + +! The following key bindings are for Sun sparcstation keyboards (copy/paste). +*VT100.Translations: #override \ + L6:select-set(CLIPBOARD)\n\ + L8:insert-selection(CLIPBOARD) + +! The following define the ISO 6429 color standard +*VT100*color0: black +*VT100*color1: red +*VT100*color2: green +*VT100*color3: yellow +*VT100*color4: blue +*VT100*color5: magenta +*VT100*color6: cyan +*VT100*color7: gray55 +*VT100*color8: gray30 +*VT100*color9: red +*VT100*color10: green +*VT100*color11: yellow +*VT100*color12: blue +*VT100*color13: magenta +*VT100*color14: cyan +*VT100*color15: white +*VT100*colorBD: white +*VT100*colorUL: yellow + +! The following define resources to produce a 3-D scrollbar with arrows. +*VT100*Scrollbar*background: #c0c0c0 +*VT100*Scrollbar*width: 15 +*VT100*Scrollbar*height: 15 +*VT100*Scrollbar*shadowWidth: 2 diff --git a/vendor/x11iraf/app-defaults/XTapemon b/vendor/x11iraf/app-defaults/XTapemon new file mode 100644 index 00000000..9438d2c4 --- /dev/null +++ b/vendor/x11iraf/app-defaults/XTapemon @@ -0,0 +1,168 @@ +! +! XTapemon.ad : Application defaults for the X11 tape monitor utility. +! + +XTapemon.port: 5138 +XTapemon.alternate: 0 +XTapemon.debug: 0 + +! Main display widget hierachy: +XTapemon.widgets: \ + toplevel Paned panel \ +\ + panel Form statusForm \ + panel.statusForm Label statusLabel \ + panel.statusForm AsciiText statusText \ + panel.statusForm Command quitButton \ +\ + panel AsciiText messages \ +\ + panel Form stringForm \ + panel.stringForm Label devtypeLabel \ + panel.stringForm AsciiText devtypeText \ + panel.stringForm Label tapetypeLabel \ + panel.stringForm AsciiText tapetypeText \ + panel.stringForm Label tapesizeLabel \ + panel.stringForm AsciiText tapesizeText \ + panel.stringForm Label tapeusedLabel \ + panel.stringForm AsciiText tapeusedText \ + panel.stringForm Label acmodeLabel \ + panel.stringForm AsciiText acmodeText \ + panel.stringForm Label densityLabel \ + panel.stringForm AsciiText densityText \ + panel.stringForm Label blksizeLabel \ + panel.stringForm AsciiText blksizeText \ + panel.stringForm Label nfilesLabel \ + panel.stringForm AsciiText nfilesText \ + panel.stringForm Label fileLabel \ + panel.stringForm AsciiText fileText \ + panel.stringForm Label recordLabel \ + panel.stringForm AsciiText recordText \ + panel.stringForm Label recsizeLabel \ + panel.stringForm AsciiText recsizeText + +! Overall Paned widget +*panel.orientation: vertical +*showGrip: false + +! Status window +*statusForm.background: lightgray +*statusForm*statusLabel.label: Status: +*statusForm*statusLabel.background: lightgray +*statusForm*statusText.fromHoriz: statusLabel +*statusForm*statusText*width: 370 +*statusForm*statusText*editType: read +*statusForm*statusText.borderWidth: 0 +*statusForm*statusText*translations: #override\n +*statusForm*statusText.background: lightgray + +*statusForm*quitButton.label: Quit +*statusForm*quitButton.fromHoriz: statusText +*statusForm*quitButton.background: lightgray + +! AsciiText scrolling widget for messages +*messages.scrollVertical: always +*messages.scrollHorizontal: whenNeeded +*messages*editType: append +*messages*Scrollbar.thickness: 10 +*messages*displayCaret: False +*messages*string: idle\n + +! +! Defaults for all the classes of widgets +! + +*input: True +*Grip*height: 5 +*Grip*width: 5 +*Label.borderWidth: 0 +*Label.internalWidth: 0 +*Text*borderWidth: 1 +*Text*font: fixed +*Text*Scrollbar.thickness: 5 +*Text*editType: read +*Text.scrollHorizontal: whenNeeded +*Text*displayCaret: False + +! +! Bottom String Form +! +! These keep the strings from getting bigger or smaller when the panes +! resize. Thus only the message region grows. +*stringForm.min: 100 +*stringForm.max: 100 +*stringForm.background: lightgray +*stringForm*Label.background: lightgray + +*stringForm*devtypeLabel.label: Device Type: +*stringForm*devtypeText*width: 415 +*stringForm*devtypeText.fromHoriz: devtypeLabel + +*stringForm*tapetypeLabel.label: \ \ Tape Type: +*stringForm*tapetypeLabel.fromVert: devtypeLabel +*stringForm*tapetypeText.fromVert: devtypeLabel +*stringForm*tapetypeText.fromHoriz: tapetypeLabel +*stringForm*tapetypeText.width: 105 + +*stringForm*tapesizeLabel.label: Capacity: +*stringForm*tapesizeLabel.fromVert: devtypeLabel +*stringForm*tapesizeLabel.fromHoriz: tapetypeText +*stringForm*tapesizeText.fromVert: devtypeLabel +*stringForm*tapesizeText.fromHoriz: tapesizeLabel +*stringForm*tapesizeText.width: 75 + +*stringForm*tapeusedLabel.label: Used: +*stringForm*tapeusedLabel.fromVert: devtypeLabel +*stringForm*tapeusedLabel.fromHoriz: tapesizeText +*stringForm*tapeusedText.fromVert: devtypeLabel +*stringForm*tapeusedText.fromHoriz: tapeusedLabel +*stringForm*tapeusedText.width: 117 + +*stringForm*acmodeLabel.label: Access Mode: +*stringForm*acmodeLabel.fromVert: tapeusedLabel +*stringForm*acmodeText.fromVert: tapeusedLabel +*stringForm*acmodeText.fromHoriz: acmodeLabel +*stringForm*acmodeText.width: 70 + +*stringForm*densityLabel.label: Density: +*stringForm*densityLabel.fromVert: tapeusedLabel +*stringForm*densityLabel.fromHoriz: acmodeText +*stringForm*densityText.fromVert: tapeusedLabel +*stringForm*densityText.fromHoriz: densityLabel +*stringForm*densityText.width: 72 + +*stringForm*blksizeLabel.label: Device Block Size: +*stringForm*blksizeLabel.fromVert: tapeusedLabel +*stringForm*blksizeLabel.fromHoriz: densityText +*stringForm*blksizeText.fromVert: tapeusedLabel +*stringForm*blksizeText.fromHoriz: blksizeLabel +*stringForm*blksizeText.width: 71 + +*stringForm*nfilesLabel.label: Total Files: +*stringForm*nfilesLabel.fromVert: acmodeLabel +*stringForm*nfilesText.fromVert: acmodeLabel +*stringForm*nfilesText.fromHoriz: nfilesLabel +*stringForm*nfilesText.width: 55 + +*stringForm*fileLabel.label: File: +*stringForm*fileLabel.fromVert: acmodeLabel +*stringForm*fileLabel.fromHoriz: nfilesText +*stringForm*fileText.fromVert: acmodeLabel +*stringForm*fileText.fromHoriz: fileLabel +*stringForm*fileText.width: 62 + +*stringForm*recordLabel.label: Record: +*stringForm*recordLabel.fromVert: acmodeLabel +*stringForm*recordLabel.fromHoriz: fileText +*stringForm*recordText.fromVert: acmodeLabel +*stringForm*recordText.fromHoriz: recordLabel +*stringForm*recordText.width: 50 + +*stringForm*recsizeLabel.label: Record Size: +*stringForm*recsizeLabel.fromVert: acmodeLabel +*stringForm*recsizeLabel.fromHoriz: recordText +*stringForm*recsizeText.fromVert: acmodeLabel +*stringForm*recsizeText.fromHoriz: recsizeLabel +*stringForm*recsizeText.width: 50 + +*beNiceToColormap: False diff --git a/vendor/x11iraf/bin b/vendor/x11iraf/bin new file mode 120000 index 00000000..715871b3 --- /dev/null +++ b/vendor/x11iraf/bin @@ -0,0 +1 @@ +bin.generic \ No newline at end of file diff --git a/vendor/x11iraf/bin.linux/ism_wcspix.e b/vendor/x11iraf/bin.linux/ism_wcspix.e new file mode 100755 index 00000000..49d86355 Binary files /dev/null and b/vendor/x11iraf/bin.linux/ism_wcspix.e differ diff --git a/vendor/x11iraf/bin.linux/obmsh b/vendor/x11iraf/bin.linux/obmsh new file mode 100755 index 00000000..d2fac5ce Binary files /dev/null and b/vendor/x11iraf/bin.linux/obmsh differ diff --git a/vendor/x11iraf/bin.linux/resize b/vendor/x11iraf/bin.linux/resize new file mode 100755 index 00000000..7307d64f Binary files /dev/null and b/vendor/x11iraf/bin.linux/resize differ diff --git a/vendor/x11iraf/bin.linux/vximtool b/vendor/x11iraf/bin.linux/vximtool new file mode 100755 index 00000000..ec05dcad Binary files /dev/null and b/vendor/x11iraf/bin.linux/vximtool differ diff --git a/vendor/x11iraf/bin.linux/xgterm b/vendor/x11iraf/bin.linux/xgterm new file mode 100755 index 00000000..9a834c21 Binary files /dev/null and b/vendor/x11iraf/bin.linux/xgterm differ diff --git a/vendor/x11iraf/bin.linux/ximtool b/vendor/x11iraf/bin.linux/ximtool new file mode 100755 index 00000000..aea86a96 Binary files /dev/null and b/vendor/x11iraf/bin.linux/ximtool differ diff --git a/vendor/x11iraf/bin.linux/ximtool-alt b/vendor/x11iraf/bin.linux/ximtool-alt new file mode 100755 index 00000000..aae6787f --- /dev/null +++ b/vendor/x11iraf/bin.linux/ximtool-alt @@ -0,0 +1,11658 @@ +#!/bin/csh -f +# +# XIMTOOL-ALT -- Script wrapper to start XImtool using the alternate GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# Arguments specific to this GUI include: +# +# -showToolBar show toolbar on startup +# -showPanelBar show panelbar on startup +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 99 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool V1.3 - Alternative GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else if ("$1" == "-showToolBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showToolBar ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showToolBar:$1$q" + else if ("$1" == "-showPanelBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showPanelBar ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showPanelBar:$1$q" + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ +exit 0 + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-ALT.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + +#!/usr/local/bin/obmsh +# +# XIMTOOL-ALT.GUI -- Default GUI for the Ximtool-alt image display server. +# +# Version 2.0 -- BETA VERSION + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display\ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton\ + menubar MenuButton viewButton\ + menubar MenuButton optionsButton\ + menubar Label imageTitle\ + menubar Toggle mXflipButton\ + menubar Toggle mYflipButton\ + menubar Command mPrevButton\ + menubar MenuButton mFrameButton\ + menubar Command mNextButton\ + menubar Toggle toolButton\ + menubar Toggle panelButton\ +\ + display Layout toolbar\ + toolbar Command tbZoomIn\ + toolbar Command tbZoom0\ + toolbar Command tbZoomOut\ + toolbar Command tbInvert\ + toolbar Command tbNormalize\ + toolbar Command tbMatchLUT\ + toolbar Toggle tbAutoReg\ + toolbar Command tbRegister\ + toolbar Command tbCenter\ + toolbar Command tbBlinkDec\ + toolbar Toggle tbBlink\ + toolbar Command tbBlinkInc\ + toolbar Toggle xflipButton\ + toolbar Toggle yflipButton\ + toolbar Toggle tbTile\ + toolbar Toggle tbCompass\ + toolbar Command prevButton\ + toolbar MenuButton frameButton\ + toolbar Command nextButton\ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +\ + display Layout panelbar\ + panelbar Toggle pbDisplayP\ + panelbar Toggle pbLoadP\ + panelbar Toggle pbSaveP\ + panelbar Toggle pbPrintP\ + panelbar Toggle pbInfoP\ + panelbar Toggle pbTileP\ + panelbar Toggle pbCoordP\ + panelbar Toggle pbPanM\ + panelbar Toggle pbMagM\ + panelbar Toggle pbWcsM\ + panelbar Toggle pbIsm\ + panelbar Toggle helpButton\ + panelbar Command pbQuit\ +} + + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: White + *rulerMenu.foreground: White + *display.imagewin.markerMenu.foreground: White + *display.imagewin.rulerMenu.foreground: White + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: White + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: White + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerColor.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: White + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: White + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 2 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + horizontal { 1 toolbar < +inf -inf * > 1 } \ + 1 < -1 > \ + horizontal { 1 panelbar < +inf -inf * > 1 } \ + 1 < -1 > \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + -2 \ + vcutFrame < * +inf -inf > \ + } \ + -3 \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 horizontal { -4 plotOpts} -4 } \ + } \ + -3 \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 1 + *hcutFrame.outerOffset: 1 + //*hcutPlot.color0: #c4c4c4 + //*hcutPlot.color1: #000000 + *hcutPlot.color0: #000000 + *hcutPlot.color1: #ffffff + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(displayPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + //*vcutPlot.color0: #c4c4c4 + //*vcutPlot.color1: black + *vcutPlot.color0: #000000 + *vcutPlot.color1: #ffffff + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(displayPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 38 + *menuGroup.width: 512 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 2 < -2 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + mXflipButton 1 < -1 > mYflipButton \ + 1 < -1 > \ + mPrevButton 1 < -1 > mFrameButton 1 < -1 > mNextButton \ + 1 < -1 > \ + toolButton 1 < -1 > panelButton \ + 2 < -2 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: White + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *menubar.width: 512 + *menubar*borderWidth: 0 + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *toolbar.layout: horizontal { \ + tbZoomIn < +inf -inf * > 1 < -1 > \ + tbZoom0 < +inf -inf * > 1 < -1 > \ + tbZoomOut < +inf -inf * > 1 < -1 > \ + tbInvert < +inf -inf * > 1 < -1 > \ + tbNormalize < +inf -inf * > 1 < -1 > \ + tbMatchLUT < +inf -inf * > 1 < -1 > \ + tbAutoReg < +inf -inf * > 1 < -1 > \ + tbRegister < +inf -inf * > 1 < -1 > \ + tbCenter < +inf -inf * > 1 < -1 > \ + tbBlinkDec < +inf -inf * > 1 < -1 > \ + tbBlink < +inf -inf * > 1 < -1 > \ + tbBlinkInc < +inf -inf * > 1 < -1 > \ + xflipButton < +inf -inf * > 1 < -1 > \ + yflipButton < +inf -inf * > 1 < -1 > \ + tbCompass < +inf -inf * > 1 < -1 > \ + tbTile < +inf -inf * > 1 < -1 > \ + prevButton < +inf -inf * > 1 < -1 > \ + frameButton < +inf -inf * > 1 < -1 > \ + nextButton < +inf -inf * > 1 < -1 > \ + } + *toolbar.width: 512 + *toolbar.height: 25 + *toolbar*borderWidth: 0 + *toolbar*Command.internalWidth: 3 + *toolbar*Command.borderWidth: 0 + *toolbar*Toggle.internalWidth: 2 + *toolbar*Toggle.borderWidth: 0 + + *panelbar.layout: horizontal { \ + pbDisplayP < +inf -inf * > 1 < -1 > \ + pbPrintP < +inf -inf * > 1 < -1 > \ + pbLoadP < +inf -inf * > 1 < -1 > \ + pbSaveP < +inf -inf * > 1 < -1 > \ + pbInfoP < +inf -inf * > 1 < -1 > \ + pbTileP < +inf -inf * > 1 < -1 > \ + pbCoordP < +inf -inf * > 1 < -1 > \ + pbPanM < +inf -inf * > 1 < -1 > \ + pbMagM < +inf -inf * > 1 < -1 > \ + pbWcsM < +inf -inf * > 1 < -1 > \ + pbIsm < +inf -inf * > 1 < -1 > \ + helpButton < +inf -inf * > 1 < -1 > \ + pbQuit < +inf -inf * > 1 < -1 > \ + } + *panelbar*SimpleMenu.borderColor: Black + *panelbar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *panelbar.width: 12 + *panelbar.height: 25 + *panelbar*borderWidth: 0 + *panelbar*Label.internalWidth: 4 + *panelbar*Label.borderWidth: 0 + *panelbar*Command.internalWidth: 4 + *panelbar*Command.borderWidth: 0 + *panelbar*Toggle.internalWidth: 3 + *panelbar*Toggle.borderWidth: 0 + + *pbLoadP.label: Load + *pbDisplayP.label: Display + *pbSaveP.label: Save + *pbPrintP.label: Print + *pbInfoP.label: Info + *pbTileP.label: Tile + *pbCoordP.label: Coords + *pbPanM.label: Pan + *pbPanM.state: 1 + *pbMagM.label: Mag + *pbMagM.state: 0 + *pbWcsM.label: WCS + *pbWcsM.state: 1 + *pbIsm.label: ISM + *pbIsm.state: 0 + *helpButton.label: + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *toolButton.label: + *toolButton.state: 0 + *panelButton.label: + *panelButton.state: 0 + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + *mFrameButton.menuName: mFrameMenu + *mFrameButton.label: 1 + *mFrameButton.width: 20 + *pbQuit.label: Quit + *tbZoom0.label: Mag + *tbBlink.label: Blink + *tbBlink.internalWidth: 3 + *tbCenter.label: Cntr + *tbAutoReg.label: AReg + *tbRegister.label: Reg + *tbInvert.label: Inv + *tbNormalize.label: Norm + *tbMatchLUT.label: Match + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *panelbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *toolbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 512 + *imageFrame.height: 512 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 512 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.idleCursor: crosshair + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + NoneLeft: call(move_cursor,-1,0) \n\ + NoneDown: call(move_cursor,0,1) \n\ + NoneUp: call(move_cursor,0,-1) \n\ + NoneRight: call(move_cursor,1,0) \n\ + !Shift Left: call(move_cursor,-10,0) \n\ + !Shift Down: call(move_cursor,0,10) \n\ + !Shift Up: call(move_cursor,0,-10) \n\ + !Shift Right: call(move_cursor,10,0) \n\ + !Ctrl h: call(move_cursor,-1,0) \n\ + !Ctrl j: call(move_cursor,0,1) \n\ + !Ctrl k: call(move_cursor,0,-1) \n\ + !Ctrl l: call(move_cursor,1,0) \n\ + !Ctrl Shift h: call(move_cursor,-10,0) \n\ + !Ctrl Shift j: call(move_cursor,0,10) \n\ + !Ctrl Shift k: call(move_cursor,0,-10) \n\ + !Ctrl Shift l: call(move_cursor,10,0) \n\ + !Ctrl Left: call(moveFrame,-1,0) \n\ + !Ctrl Down: call(moveFrame,0,1) \n\ + !Ctrl Up: call(moveFrame,0,-1) \n\ + !Ctrl Right: call(moveFrame,1,0) \n\ + !Ctrl Alt Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt Right: call(moveFrame,0.5,0) \n\ + !Alt 1: call(cpSetFrame,frame1) \n\ + !Alt 2: call(cpSetFrame,frame2) \n\ + !Alt 3: call(cpSetFrame,frame3) \n\ + !Alt 4: call(cpSetFrame,frame4) \n\ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl a: call(tbToggleAutoReg) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl c: call(cpZoomAction,centerFrame) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl o: call(offset,$x,$y) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl t: call(tbTileFramesToggle) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + !Ctrl x: call(cpFrameAction,flipX) \n\ + !Ctrl y: call(cpFrameAction,flipY) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + !Ctrl Alt =: call(Print) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl \[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl \]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl 0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt 0: call(centroid,$x,$y,min) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(displayPanel) \n\ + !Ctrl Shift c: call(displayPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !Ctrl Shift t: call(tclPanel) \n\ + !Shift: call(setDynamicMagnifier,1) \n\ + !Shift: call(setDynamicMagnifier,0) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift : crosshair(on) \n\ + !Shift : crosshair(on) \n\ + !Shift : crosshair(off) \n\ + !: crosshair(off) \n\ + !: call(zoom,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !: call(updateColormap,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !Ctrl : call(makeRuler,$name,$x,$y) \n\ + !Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl : call(deleteRuler,$x,$y) \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,1) \n\ + + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.height: 17 + *colorbar.width: 50 + *colorbar.borderWidth: 0 +} + + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(markerMenu) + : popdown(markerMenu) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : m_input() + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(magzoomMenu) + : popdown(magzoomMenu) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : call(pannerPanXY,$x,$y) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + !Ctrl r: call(cpRegisterFrames) + !Ctrl s: call(cpMatchFrames) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl b: call(prevFrame,$name) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: call(deleteNamedRuler,NAME,$x,$y) + Delete: call(deleteNamedRuler,NAME,$x,$y) + : m_input() + : call(setRulerMenu) popup(rulerMenu) + : popdown(rulerMenu) +!Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl : call(deleteRuler,$x,$y) + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tcl_panel unmap } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "
%s\n%s
" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + + + +################################################################################ +# +# XIMTOOL-ALT -- Procedures and declarations for the ALT GUI. +# +################################################################################ + +# Creat the bitmaps needed for the alternate optional bars. + +createBitmap tools 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, + 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap control 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xe3, 0xc7, 0xe3, 0xcf, 0x33, 0xcc, + 0x33, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x33, 0xcc, 0xf3, 0xcf, + 0xe3, 0xc7, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap tile 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff}; + +createBitmap compass 16 16 { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x80, 0x0f, 0xc0, 0x1f, 0x00, 0x07, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0xfc, 0x07, + 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00} + +createBitmap plus 11 11 { + 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00}; + +createBitmap minus 11 11 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap disk 16 16 { + 0xfe,0x1f,0x11,0x25,0x11,0x45,0x11,0x44,0xf1,0x47,0x01,0x40,0x01,0x40,0xf9, + 0x4f,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0xff,0x7f, + 0x00,0x00}; + +createBitmap printer 32 16 { + 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x12, 0x00, + 0x00, 0x02, 0x22, 0x00, 0x00, 0x02, 0x3e, 0x00, 0x00, 0x02, 0x20, 0x00, + 0x00, 0x02, 0x20, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0x10, 0x03, 0xe0, 0x06, + 0x08, 0xff, 0x7f, 0x09, 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, + 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x08, + 0xf8, 0xff, 0xff, 0x0f}; + + +send tbBlinkDec "set bitmap larrow" ;# Assign the bitmaps to the buttons. +send tbBlinkInc "set bitmap rarrow" +send tbZoomIn "set bitmap plus" +send tbZoomOut "set bitmap minus" +send tbTile "set bitmap tile" +send tbCompass "set bitmap compass; addCallback toggleCompass" +#send helpButton "set bitmap qmark; addCallback Help" +send mXflipButton "set bitmap xflip; addCallback xflip" +send mYflipButton "set bitmap yflip; addCallback yflip" +send mNextButton "set bitmap rarrow; addCallback nextFrame" +send mPrevButton "set bitmap larrow; addCallback prevFrame" + + +# toolBox -- Toggle the toolbox and panelbar display. + +set toolbox_up [ true $showToolBar ] +set panelbar_up [ true $showPanelBar ] + +proc toolBoxToggle args \ +{ + global toolbox_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$toolbox_up} { + send toolbar set height 0 + send toolButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w; set height $nh" + set toolbox_up 0 + send mXflipButton map + send mYflipButton map + send mPrevButton map + send mFrameButton map + send mNextButton map + } else { + send toolbar set height 25 + send toolButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set toolbox_up 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap + } +} + +proc panelBarToggle args \ +{ + global panelbar_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$panelbar_up} { + send panelbar set height 0 + send panelButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w ; set height $nh" + set panelbar_up 0 + } else { + send panelbar set height 25 + send panelButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set panelbar_up 1 + } +} + + + +# Initialize the bars to be displayed if the resource was set. + +send toolButton "set bitmap tools; addCallback toolBoxToggle" +if { ! [ true $showToolBar ] } { + send display set height [expr [send display get height] - 25] + send toolbar set height 0 + send toolButton set state 0 +} else { + send toolButton set state 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap +} + +send panelButton "deleteCallback panel" +send panelButton "set bitmap control; addCallback panelBarToggle" + +if { ! [ true $showPanelBar ] } { + send display set height [expr [send display get height] - 25] + send panelbar set height 0 + send panelButton set state 0 +} else { + send panelButton set state 1 +} + + +############################################## +# Panelbar callbacks. +############################################## + +send pbQuit addCallback Quit +send helpClose addCallback "send helpButton set state 0" + + +# Control Panel. +#------------------------------------------------------ +proc pbToggleControl {name element op} \ +{ + upvar $name panel_up + send pbDisplayP set state [expr !($panel_up)] +} ; #trace variable panel_up w pbToggleControl + +proc pbResetPanel {param old new} \ +{ + global displayPanner displayMagnifier displayCoords + switch $new { + done { send pbPanM set state [true $displayPanner] + send pbMagM set state [true $displayMagnifier] + send pbWcsM set state [true $displayCoords] + } + } +} ; send initialize addCallback pbResetPanel + +set WidgetToTab(pbDisplayP) display_panel +set WidgetToTab(pbInfoP) info_panel +set WidgetToTab(pbLoadP) load_panel +set WidgetToTab(pbPrintP) print_panel +set WidgetToTab(pbSaveP) save_panel +set WidgetToTab(pbTileP) tile_panel +set WidgetToTab(pbCoordP) wcs_panel + +set TabToWidget(display_panel) pbDisplayP +set TabToWidget(print_panel) pbPrintP +set TabToWidget(load_panel) pbLoadP +set TabToWidget(save_panel) pbSaveP +set TabToWidget(info_panel) pbInfoP +set TabToWidget(tile_panel) pbTileP +set TabToWidget(wcs_panel) pbCoordP + +set pbTabTop "pbDisplayP" + +proc pbPanelDismiss args \ +{ + global tabTop TabToWidget WidgetToTab + set panel $TabToWidget($tabTop) + send $panel set state 0 +} ; send panelClose addCallback pbPanelDismiss + +proc pbResizeCB {widget event a b c d e args} \ +{ + global pbTabTop TabToWidget WidgetToTab + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + send $pbTabTop set state 0 + set new $TabToWidget($widget) + send $new set state 1 + set pbTabTop $new + } +} ; foreach w $cpTabs {send $w addEventHandler pbResizeCB exposureMask} + +proc pbPanelTabs { widget type state args } \ +{ + global pbTabTop tabTop panel_up + global TabToWidget WidgetToTab + + set panel $WidgetToTab($widget) + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $widget set state 0 + set panel_up 0 + return + } + + send $TabToWidget($tabTop) set state 0 + set tabTop $panel + set pbTabTop $TabToWidget($panel) + send panelTabs setTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send $widget set state 1 + send panelShell map + set panel_up 1 + } +} +foreach w { pbDisplayP pbInfoP pbLoadP pbPrintP pbSaveP pbTileP pbCoordP } { + send $w addCallback pbPanelTabs +} + + + +# Load Panel. (Really need to clean this up.) +#------------------------------------------------------ +proc pbDoLoadOptions { param old new } \ +{ + set val [ join [lrange $new 1 end] " " ] + switch [lindex $new 0] { + newfile { send fnameText set string $val } + } +} ; send loadOptions addCallback pbDoLoadOptions + +proc pbFileLoad { widget mode fname args } \ +{ + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + send imagewin setCursorType idle +} ; send fnameText addCallback pbFileLoad + +proc pbflSelectPrint {widget cbtype selections args} \ +{ + foreach selection $selections { + ; + } +}; #send imageList addCallback pbflSelectPrint + +proc pbFileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname != ""} { + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + } +} ; send filesLoadButton addCallback pbFileLoadB + + +# Panner Marker. +#------------------------------------------------------ +proc pbTracePanner {name element op} \ +{ + global last_compass + + catch { + upvar $name panner_enable + send pbPanM set state $panner_enable + + if { $panner_enable } { + send tbCompass "setSensitive True ; set state $last_compass" + drawCompass + } else { + send tbCompass "setSensitive False ; set state False" + eraseCompass + } + } +} ; trace variable panner_enable w pbTracePanner + +proc pannerPanel args \ +{ + global panner_enable displayPanner + + setPanner [expr !$panner_enable] + send pannerButton set on [expr $panner_enable] +}; send pbPanM addCallback pannerPanel + + +# Magnifier Marker. +#------------------------------------------------------ +proc pbTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send pbMagM set state $magnifier_enable +} ; trace variable magnifier_enable w pbTraceMagnifier + +proc magnifierPanel args \ +{ + global magnifier_enable displayMagnifier + setMagnifier [expr !$magnifier_enable] + send magnifierButton set on [expr $magnifier_enable] +}; send pbMagM addCallback magnifierPanel + + +# CoordsBox Marker. +#------------------------------------------------------ +proc pbTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send pbWcsM set state $track_enable +} ; trace variable track_enable w pbTraceCoordsBox + +proc wcsPanel args \ +{ + global track_enable + setTrack [expr !$track_enable] +}; send pbWcsM addCallback wcsPanel + + + +# WPIX ISM Callbacks. +#------------------------------------------------------ + +proc altIsmToggle { widget type state args } \ +{ + ismToggle pbIsm junk $state +} ; send pbIsm addCallback altIsmToggle + +proc pbTraceIsm {name element op} \ +{ + upvar $name ism_enable + send pbIsm set state $ism_enable +} ; trace variable ism_enable w pbTraceIsm + + +proc altIsmMsgCB { param old new } \ +{ + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + deliver { ${ism}_alt_msg $argc $argv } + } +} ; send ism_msg addCallback altIsmMsgCB + + +proc wcspix_alt_msg { argc argv } \ +{ + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + switch $cmd { + startup { } + shutdown { } + disable { send pbIsm "set state False ; setSensitive False" } + capable { send pbIsm "setSensitive True" } + } +} + + + +############################################## +# Toolbar callbacks. +############################################## + +send tbNormalize addCallback normalize +send tbInvert addCallback cpInvert +send tbRegister addCallback cpRegisterFrames +send tbMatchLUT addCallback cpMatchFrames + + +# Frame Selection. +#------------------ +createMenu mFrameMenu mFrameButton $frameMenuDescription + +proc altFrameChanged {param old new} \ +{ + send mFrameButton set label $new +} ; send frame addCallback altFrameChanged + + +# Image Flipping. +#------------------------------------------------------ +proc tbSetFlip {param old new} \ +{ + if {$param == "xflip"} { + send mXflipButton set state [true $new] + } else { + send mYflipButton set state [true $new] + } +}; foreach i {xflip yflip} { send $i addCallback tbSetFlip } + + +# Zoom/Pan buttons. +#------------------------------------------------------ +proc tbZoomAction { widget args } \ +{ + global frameWidth frameHeight + + switch $widget { + tbZoom0 { cpZoom 1 1 fixed } + tbZoomIn { cpZoom 2.0 2.0 relative } + tbZoomOut { cpZoom 0.5 0.5 relative } + tbCenter { send client pan [expr $frameWidth/2.0] [expr $frameHeight/2.0] } + } +} +foreach widget { tbCenter tbZoomIn tbZoom0 tbZoomOut } { + send $widget addCallback tbZoomAction +} + + +# Frame Blink. +#------------------------------------------------------ +proc tbSetBlinkRate {w args} \ +{ + if {$w == "tbBlinkInc"} { + cpSetBlinkRate BRincrease + } else { + cpSetBlinkRate BRdeccrease + } +} +foreach w {tbBlinkDec tbBlinkInc} { send $w addCallback tbSetBlinkRate } + +proc tbBlink { widget args } \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send tbBlink set state 0 + } else { + if {$widget != "tbBlink"} { + if {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } + } else { + if {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } + } + } +} ; send tbBlink addCallback tbBlink + +proc tbTraceBlink {name element op} \ +{ + upvar $name blinkId + send tbBlink set state [expr $blinkId != 0] +} ; trace variable blinkId w tbTraceBlink + + +# Auto-register. +#------------------------------------------------------ +proc tbAutoRegister { widget type state args } \ +{ + send tbAutoReg set state $state +} +foreach w {autoregButton brAregButton tbAutoReg} { + send $w addCallback cpAutoRegister +} + +proc tbToggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + send tbAutoReg set state 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + send tbAutoReg set state 1 + } +} + + +# Frame Tiles. +#------------------------------------------------------ +proc tbSetTileFrames args \ +{ + global tileOpt + + # Send the option to the client. + if {[send tbTile get state ]} { + if {$tileOpt == 0} { + # If mode is disabled, turn on the tile selection. + selectTileOrientation junk junk Best + } else { + # Otherwise, turn on in current mode. + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } + } else { + selectTileOrientation junk junk Disabled + } +}; send tbTile addCallback tbSetTileFrames + +proc tbTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] + send tbTile set state $new +}; send tileFrames addCallback tbTrackTileFrames + +proc tbTileFramesToggle args \ +{ + set value [send tileFramesButton get on] + if {$value} { set not 0 } else { set not 1 } + + send tileFramesButton set on $not + send tbTile set state $not + cpSetTileFrames tbTile junk $not +} + + +# Compass Indicator. +#------------------------------------------------------ +proc tbToggleCompass { widget type state args } \ +{ + global frame + + if {$state} { + send compass set on True + send tbCompass set state 1 + drawCompass + } else { + send compass set on False + send tbCompass set state 0 + eraseCompass + } +} ; foreach w {compass tbCompass} { send $w addCallback tbToggleCompass } + + diff --git a/vendor/x11iraf/bin.linux/ximtool-old b/vendor/x11iraf/bin.linux/ximtool-old new file mode 100755 index 00000000..d85d07d8 --- /dev/null +++ b/vendor/x11iraf/bin.linux/ximtool-old @@ -0,0 +1,10944 @@ +#!/bin/csh -f +# +# XIMTOOL-OLD -- Script wrapper to start XImtool using the original GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 79 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool V1.4 - Original GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ +exit 0 + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-OLD.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + +#!/usr/local/bin/obmsh +# +# XIMTOOL.GUI -- Default GUI for the Ximtool image display server. +# +# Version 2.0 -- BETA VERSION + + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display \ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar Label imageTitle \ + menubar Toggle controlButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +} + + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.foreground: Black + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: Black + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: Black + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: Black + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 0 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + -2 \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + vcutFrame < * +inf -inf > \ + } \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 plotOpts -4 } \ + } \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 0 + *hcutFrame.outerOffset: 0 + *hcutPlot.color0: #c4c4c4 + *hcutPlot.color1: black + *hcutPlot.color0: darkslategray + *hcutPlot.color1: #eeeee0 + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(controlPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + *vcutPlot.color0: #c4c4c4 + *vcutPlot.color1: black + *vcutPlot.color0: darkslategray + *vcutPlot.color1: #eeeee0 + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(controlPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 40 + *menuGroup.width: 518 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + controlButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: white + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 518 + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 518 + *imageFrame.height: 518 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 518 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + NoneLeft: call(move_cursor,-1,0) \n\ + NoneDown: call(move_cursor,0,1) \n\ + NoneUp: call(move_cursor,0,-1) \n\ + NoneRight: call(move_cursor,1,0) \n\ + !Shift Left: call(move_cursor,-10,0) \n\ + !Shift Down: call(move_cursor,0,10) \n\ + !Shift Up: call(move_cursor,0,-10) \n\ + !Shift Right: call(move_cursor,10,0) \n\ + !Ctrl h: call(move_cursor,-1,0) \n\ + !Ctrl j: call(move_cursor,0,1) \n\ + !Ctrl k: call(move_cursor,0,-1) \n\ + !Ctrl l: call(move_cursor,1,0) \n\ + !Ctrl Shift h: call(move_cursor,-10,0) \n\ + !Ctrl Shift j: call(move_cursor,0,10) \n\ + !Ctrl Shift k: call(move_cursor,0,-10) \n\ + !Ctrl Shift l: call(move_cursor,10,0) \n\ + !Alt 1: call(cpSetFrame,frame1) \n\ + !Alt 2: call(cpSetFrame,frame2) \n\ + !Alt 3: call(cpSetFrame,frame3) \n\ + !Alt 4: call(cpSetFrame,frame4) \n\ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl Left: call(moveFrame,-1,0) \n\ + !Ctrl Down: call(moveFrame,0,1) \n\ + !Ctrl Up: call(moveFrame,0,-1) \n\ + !Ctrl Right: call(moveFrame,1,0) \n\ + !Ctrl Alt Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt Right: call(moveFrame,0.5,0) \n\ + !Ctrl a: call(toggleAutoReg) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl c: call(cpZoomAction,centerFrame) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl o: call(offset,$x,$y) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl t: call(tileFramesToggle) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + !Ctrl x: call(cpFrameAction,flipX) \n\ + !Ctrl y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt =: call(Print) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl \[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl \]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl 0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt 0: call(centroid,$x,$y,min) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(controlPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift : crosshair(on) \n\ + !Shift : crosshair(on) \n\ + !Shift: crosshair(off) \n\ + !: crosshair(off) \n\ + !: call(zoom,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !: call(updateColormap,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !Ctrl : call(makeRuler,$name,$x,$y) \n\ + !Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl : call(deleteRuler,$x,$y) \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.borderWidth: 0 + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 50 + *colorbar.height: 17 +} + + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(markerMenu) + : popdown(markerMenu) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : m_input() + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(magzoomMenu) + : popdown(magzoomMenu) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : call(pannerPanXY,$x,$y) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + !Ctrl r: call(cpRegisterFrames) + !Ctrl s: call(cpMatchFrames) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl b: call(prevFrame,$name) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: call(deleteNamedRuler,NAME,$x,$y) + Delete: call(deleteNamedRuler,NAME,$x,$y) + : m_input() + : call(setRulerMenu) popup(rulerMenu) + : popdown(rulerMenu) +!Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl : call(deleteRuler,$x,$y) + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tcl_panel unmap } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "
%s\n%s
" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/bin.linux/xtapemon b/vendor/x11iraf/bin.linux/xtapemon new file mode 100755 index 00000000..cd8a8fce Binary files /dev/null and b/vendor/x11iraf/bin.linux/xtapemon differ diff --git a/vendor/x11iraf/bin.macintel/ism_wcspix.e b/vendor/x11iraf/bin.macintel/ism_wcspix.e new file mode 100755 index 00000000..deabd115 Binary files /dev/null and b/vendor/x11iraf/bin.macintel/ism_wcspix.e differ diff --git a/vendor/x11iraf/bin.macintel/obmsh b/vendor/x11iraf/bin.macintel/obmsh new file mode 100755 index 00000000..8fae747e Binary files /dev/null and b/vendor/x11iraf/bin.macintel/obmsh differ diff --git a/vendor/x11iraf/bin.macintel/resize b/vendor/x11iraf/bin.macintel/resize new file mode 100755 index 00000000..77a7ea99 Binary files /dev/null and b/vendor/x11iraf/bin.macintel/resize differ diff --git a/vendor/x11iraf/bin.macintel/vximtool b/vendor/x11iraf/bin.macintel/vximtool new file mode 100755 index 00000000..ccff6ed0 Binary files /dev/null and b/vendor/x11iraf/bin.macintel/vximtool differ diff --git a/vendor/x11iraf/bin.macintel/xgterm b/vendor/x11iraf/bin.macintel/xgterm new file mode 100755 index 00000000..37c3d836 Binary files /dev/null and b/vendor/x11iraf/bin.macintel/xgterm differ diff --git a/vendor/x11iraf/bin.macintel/ximtool b/vendor/x11iraf/bin.macintel/ximtool new file mode 100755 index 00000000..c21a3a60 Binary files /dev/null and b/vendor/x11iraf/bin.macintel/ximtool differ diff --git a/vendor/x11iraf/bin.macintel/ximtool-alt b/vendor/x11iraf/bin.macintel/ximtool-alt new file mode 100755 index 00000000..aae6787f --- /dev/null +++ b/vendor/x11iraf/bin.macintel/ximtool-alt @@ -0,0 +1,11658 @@ +#!/bin/csh -f +# +# XIMTOOL-ALT -- Script wrapper to start XImtool using the alternate GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# Arguments specific to this GUI include: +# +# -showToolBar show toolbar on startup +# -showPanelBar show panelbar on startup +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 99 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool V1.3 - Alternative GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else if ("$1" == "-showToolBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showToolBar ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showToolBar:$1$q" + else if ("$1" == "-showPanelBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showPanelBar ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showPanelBar:$1$q" + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ +exit 0 + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-ALT.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + +#!/usr/local/bin/obmsh +# +# XIMTOOL-ALT.GUI -- Default GUI for the Ximtool-alt image display server. +# +# Version 2.0 -- BETA VERSION + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display\ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton\ + menubar MenuButton viewButton\ + menubar MenuButton optionsButton\ + menubar Label imageTitle\ + menubar Toggle mXflipButton\ + menubar Toggle mYflipButton\ + menubar Command mPrevButton\ + menubar MenuButton mFrameButton\ + menubar Command mNextButton\ + menubar Toggle toolButton\ + menubar Toggle panelButton\ +\ + display Layout toolbar\ + toolbar Command tbZoomIn\ + toolbar Command tbZoom0\ + toolbar Command tbZoomOut\ + toolbar Command tbInvert\ + toolbar Command tbNormalize\ + toolbar Command tbMatchLUT\ + toolbar Toggle tbAutoReg\ + toolbar Command tbRegister\ + toolbar Command tbCenter\ + toolbar Command tbBlinkDec\ + toolbar Toggle tbBlink\ + toolbar Command tbBlinkInc\ + toolbar Toggle xflipButton\ + toolbar Toggle yflipButton\ + toolbar Toggle tbTile\ + toolbar Toggle tbCompass\ + toolbar Command prevButton\ + toolbar MenuButton frameButton\ + toolbar Command nextButton\ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +\ + display Layout panelbar\ + panelbar Toggle pbDisplayP\ + panelbar Toggle pbLoadP\ + panelbar Toggle pbSaveP\ + panelbar Toggle pbPrintP\ + panelbar Toggle pbInfoP\ + panelbar Toggle pbTileP\ + panelbar Toggle pbCoordP\ + panelbar Toggle pbPanM\ + panelbar Toggle pbMagM\ + panelbar Toggle pbWcsM\ + panelbar Toggle pbIsm\ + panelbar Toggle helpButton\ + panelbar Command pbQuit\ +} + + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: White + *rulerMenu.foreground: White + *display.imagewin.markerMenu.foreground: White + *display.imagewin.rulerMenu.foreground: White + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: White + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: White + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerColor.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: White + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: White + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 2 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + horizontal { 1 toolbar < +inf -inf * > 1 } \ + 1 < -1 > \ + horizontal { 1 panelbar < +inf -inf * > 1 } \ + 1 < -1 > \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + -2 \ + vcutFrame < * +inf -inf > \ + } \ + -3 \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 horizontal { -4 plotOpts} -4 } \ + } \ + -3 \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 1 + *hcutFrame.outerOffset: 1 + //*hcutPlot.color0: #c4c4c4 + //*hcutPlot.color1: #000000 + *hcutPlot.color0: #000000 + *hcutPlot.color1: #ffffff + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(displayPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + //*vcutPlot.color0: #c4c4c4 + //*vcutPlot.color1: black + *vcutPlot.color0: #000000 + *vcutPlot.color1: #ffffff + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(displayPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 38 + *menuGroup.width: 512 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 2 < -2 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + mXflipButton 1 < -1 > mYflipButton \ + 1 < -1 > \ + mPrevButton 1 < -1 > mFrameButton 1 < -1 > mNextButton \ + 1 < -1 > \ + toolButton 1 < -1 > panelButton \ + 2 < -2 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: White + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *menubar.width: 512 + *menubar*borderWidth: 0 + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *toolbar.layout: horizontal { \ + tbZoomIn < +inf -inf * > 1 < -1 > \ + tbZoom0 < +inf -inf * > 1 < -1 > \ + tbZoomOut < +inf -inf * > 1 < -1 > \ + tbInvert < +inf -inf * > 1 < -1 > \ + tbNormalize < +inf -inf * > 1 < -1 > \ + tbMatchLUT < +inf -inf * > 1 < -1 > \ + tbAutoReg < +inf -inf * > 1 < -1 > \ + tbRegister < +inf -inf * > 1 < -1 > \ + tbCenter < +inf -inf * > 1 < -1 > \ + tbBlinkDec < +inf -inf * > 1 < -1 > \ + tbBlink < +inf -inf * > 1 < -1 > \ + tbBlinkInc < +inf -inf * > 1 < -1 > \ + xflipButton < +inf -inf * > 1 < -1 > \ + yflipButton < +inf -inf * > 1 < -1 > \ + tbCompass < +inf -inf * > 1 < -1 > \ + tbTile < +inf -inf * > 1 < -1 > \ + prevButton < +inf -inf * > 1 < -1 > \ + frameButton < +inf -inf * > 1 < -1 > \ + nextButton < +inf -inf * > 1 < -1 > \ + } + *toolbar.width: 512 + *toolbar.height: 25 + *toolbar*borderWidth: 0 + *toolbar*Command.internalWidth: 3 + *toolbar*Command.borderWidth: 0 + *toolbar*Toggle.internalWidth: 2 + *toolbar*Toggle.borderWidth: 0 + + *panelbar.layout: horizontal { \ + pbDisplayP < +inf -inf * > 1 < -1 > \ + pbPrintP < +inf -inf * > 1 < -1 > \ + pbLoadP < +inf -inf * > 1 < -1 > \ + pbSaveP < +inf -inf * > 1 < -1 > \ + pbInfoP < +inf -inf * > 1 < -1 > \ + pbTileP < +inf -inf * > 1 < -1 > \ + pbCoordP < +inf -inf * > 1 < -1 > \ + pbPanM < +inf -inf * > 1 < -1 > \ + pbMagM < +inf -inf * > 1 < -1 > \ + pbWcsM < +inf -inf * > 1 < -1 > \ + pbIsm < +inf -inf * > 1 < -1 > \ + helpButton < +inf -inf * > 1 < -1 > \ + pbQuit < +inf -inf * > 1 < -1 > \ + } + *panelbar*SimpleMenu.borderColor: Black + *panelbar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *panelbar.width: 12 + *panelbar.height: 25 + *panelbar*borderWidth: 0 + *panelbar*Label.internalWidth: 4 + *panelbar*Label.borderWidth: 0 + *panelbar*Command.internalWidth: 4 + *panelbar*Command.borderWidth: 0 + *panelbar*Toggle.internalWidth: 3 + *panelbar*Toggle.borderWidth: 0 + + *pbLoadP.label: Load + *pbDisplayP.label: Display + *pbSaveP.label: Save + *pbPrintP.label: Print + *pbInfoP.label: Info + *pbTileP.label: Tile + *pbCoordP.label: Coords + *pbPanM.label: Pan + *pbPanM.state: 1 + *pbMagM.label: Mag + *pbMagM.state: 0 + *pbWcsM.label: WCS + *pbWcsM.state: 1 + *pbIsm.label: ISM + *pbIsm.state: 0 + *helpButton.label: + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *toolButton.label: + *toolButton.state: 0 + *panelButton.label: + *panelButton.state: 0 + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + *mFrameButton.menuName: mFrameMenu + *mFrameButton.label: 1 + *mFrameButton.width: 20 + *pbQuit.label: Quit + *tbZoom0.label: Mag + *tbBlink.label: Blink + *tbBlink.internalWidth: 3 + *tbCenter.label: Cntr + *tbAutoReg.label: AReg + *tbRegister.label: Reg + *tbInvert.label: Inv + *tbNormalize.label: Norm + *tbMatchLUT.label: Match + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *panelbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *toolbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 512 + *imageFrame.height: 512 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 512 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.idleCursor: crosshair + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + NoneLeft: call(move_cursor,-1,0) \n\ + NoneDown: call(move_cursor,0,1) \n\ + NoneUp: call(move_cursor,0,-1) \n\ + NoneRight: call(move_cursor,1,0) \n\ + !Shift Left: call(move_cursor,-10,0) \n\ + !Shift Down: call(move_cursor,0,10) \n\ + !Shift Up: call(move_cursor,0,-10) \n\ + !Shift Right: call(move_cursor,10,0) \n\ + !Ctrl h: call(move_cursor,-1,0) \n\ + !Ctrl j: call(move_cursor,0,1) \n\ + !Ctrl k: call(move_cursor,0,-1) \n\ + !Ctrl l: call(move_cursor,1,0) \n\ + !Ctrl Shift h: call(move_cursor,-10,0) \n\ + !Ctrl Shift j: call(move_cursor,0,10) \n\ + !Ctrl Shift k: call(move_cursor,0,-10) \n\ + !Ctrl Shift l: call(move_cursor,10,0) \n\ + !Ctrl Left: call(moveFrame,-1,0) \n\ + !Ctrl Down: call(moveFrame,0,1) \n\ + !Ctrl Up: call(moveFrame,0,-1) \n\ + !Ctrl Right: call(moveFrame,1,0) \n\ + !Ctrl Alt Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt Right: call(moveFrame,0.5,0) \n\ + !Alt 1: call(cpSetFrame,frame1) \n\ + !Alt 2: call(cpSetFrame,frame2) \n\ + !Alt 3: call(cpSetFrame,frame3) \n\ + !Alt 4: call(cpSetFrame,frame4) \n\ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl a: call(tbToggleAutoReg) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl c: call(cpZoomAction,centerFrame) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl o: call(offset,$x,$y) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl t: call(tbTileFramesToggle) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + !Ctrl x: call(cpFrameAction,flipX) \n\ + !Ctrl y: call(cpFrameAction,flipY) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + !Ctrl Alt =: call(Print) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl \[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl \]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl 0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt 0: call(centroid,$x,$y,min) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(displayPanel) \n\ + !Ctrl Shift c: call(displayPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !Ctrl Shift t: call(tclPanel) \n\ + !Shift: call(setDynamicMagnifier,1) \n\ + !Shift: call(setDynamicMagnifier,0) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift : crosshair(on) \n\ + !Shift : crosshair(on) \n\ + !Shift : crosshair(off) \n\ + !: crosshair(off) \n\ + !: call(zoom,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !: call(updateColormap,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !Ctrl : call(makeRuler,$name,$x,$y) \n\ + !Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl : call(deleteRuler,$x,$y) \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,1) \n\ + + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.height: 17 + *colorbar.width: 50 + *colorbar.borderWidth: 0 +} + + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(markerMenu) + : popdown(markerMenu) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : m_input() + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(magzoomMenu) + : popdown(magzoomMenu) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : call(pannerPanXY,$x,$y) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + !Ctrl r: call(cpRegisterFrames) + !Ctrl s: call(cpMatchFrames) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl b: call(prevFrame,$name) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: call(deleteNamedRuler,NAME,$x,$y) + Delete: call(deleteNamedRuler,NAME,$x,$y) + : m_input() + : call(setRulerMenu) popup(rulerMenu) + : popdown(rulerMenu) +!Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl : call(deleteRuler,$x,$y) + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tcl_panel unmap } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "
%s\n%s
" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + + + +################################################################################ +# +# XIMTOOL-ALT -- Procedures and declarations for the ALT GUI. +# +################################################################################ + +# Creat the bitmaps needed for the alternate optional bars. + +createBitmap tools 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, + 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap control 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xe3, 0xc7, 0xe3, 0xcf, 0x33, 0xcc, + 0x33, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x33, 0xcc, 0xf3, 0xcf, + 0xe3, 0xc7, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap tile 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff}; + +createBitmap compass 16 16 { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x80, 0x0f, 0xc0, 0x1f, 0x00, 0x07, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0xfc, 0x07, + 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00} + +createBitmap plus 11 11 { + 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00}; + +createBitmap minus 11 11 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap disk 16 16 { + 0xfe,0x1f,0x11,0x25,0x11,0x45,0x11,0x44,0xf1,0x47,0x01,0x40,0x01,0x40,0xf9, + 0x4f,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0xff,0x7f, + 0x00,0x00}; + +createBitmap printer 32 16 { + 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x12, 0x00, + 0x00, 0x02, 0x22, 0x00, 0x00, 0x02, 0x3e, 0x00, 0x00, 0x02, 0x20, 0x00, + 0x00, 0x02, 0x20, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0x10, 0x03, 0xe0, 0x06, + 0x08, 0xff, 0x7f, 0x09, 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, + 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x08, + 0xf8, 0xff, 0xff, 0x0f}; + + +send tbBlinkDec "set bitmap larrow" ;# Assign the bitmaps to the buttons. +send tbBlinkInc "set bitmap rarrow" +send tbZoomIn "set bitmap plus" +send tbZoomOut "set bitmap minus" +send tbTile "set bitmap tile" +send tbCompass "set bitmap compass; addCallback toggleCompass" +#send helpButton "set bitmap qmark; addCallback Help" +send mXflipButton "set bitmap xflip; addCallback xflip" +send mYflipButton "set bitmap yflip; addCallback yflip" +send mNextButton "set bitmap rarrow; addCallback nextFrame" +send mPrevButton "set bitmap larrow; addCallback prevFrame" + + +# toolBox -- Toggle the toolbox and panelbar display. + +set toolbox_up [ true $showToolBar ] +set panelbar_up [ true $showPanelBar ] + +proc toolBoxToggle args \ +{ + global toolbox_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$toolbox_up} { + send toolbar set height 0 + send toolButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w; set height $nh" + set toolbox_up 0 + send mXflipButton map + send mYflipButton map + send mPrevButton map + send mFrameButton map + send mNextButton map + } else { + send toolbar set height 25 + send toolButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set toolbox_up 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap + } +} + +proc panelBarToggle args \ +{ + global panelbar_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$panelbar_up} { + send panelbar set height 0 + send panelButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w ; set height $nh" + set panelbar_up 0 + } else { + send panelbar set height 25 + send panelButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set panelbar_up 1 + } +} + + + +# Initialize the bars to be displayed if the resource was set. + +send toolButton "set bitmap tools; addCallback toolBoxToggle" +if { ! [ true $showToolBar ] } { + send display set height [expr [send display get height] - 25] + send toolbar set height 0 + send toolButton set state 0 +} else { + send toolButton set state 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap +} + +send panelButton "deleteCallback panel" +send panelButton "set bitmap control; addCallback panelBarToggle" + +if { ! [ true $showPanelBar ] } { + send display set height [expr [send display get height] - 25] + send panelbar set height 0 + send panelButton set state 0 +} else { + send panelButton set state 1 +} + + +############################################## +# Panelbar callbacks. +############################################## + +send pbQuit addCallback Quit +send helpClose addCallback "send helpButton set state 0" + + +# Control Panel. +#------------------------------------------------------ +proc pbToggleControl {name element op} \ +{ + upvar $name panel_up + send pbDisplayP set state [expr !($panel_up)] +} ; #trace variable panel_up w pbToggleControl + +proc pbResetPanel {param old new} \ +{ + global displayPanner displayMagnifier displayCoords + switch $new { + done { send pbPanM set state [true $displayPanner] + send pbMagM set state [true $displayMagnifier] + send pbWcsM set state [true $displayCoords] + } + } +} ; send initialize addCallback pbResetPanel + +set WidgetToTab(pbDisplayP) display_panel +set WidgetToTab(pbInfoP) info_panel +set WidgetToTab(pbLoadP) load_panel +set WidgetToTab(pbPrintP) print_panel +set WidgetToTab(pbSaveP) save_panel +set WidgetToTab(pbTileP) tile_panel +set WidgetToTab(pbCoordP) wcs_panel + +set TabToWidget(display_panel) pbDisplayP +set TabToWidget(print_panel) pbPrintP +set TabToWidget(load_panel) pbLoadP +set TabToWidget(save_panel) pbSaveP +set TabToWidget(info_panel) pbInfoP +set TabToWidget(tile_panel) pbTileP +set TabToWidget(wcs_panel) pbCoordP + +set pbTabTop "pbDisplayP" + +proc pbPanelDismiss args \ +{ + global tabTop TabToWidget WidgetToTab + set panel $TabToWidget($tabTop) + send $panel set state 0 +} ; send panelClose addCallback pbPanelDismiss + +proc pbResizeCB {widget event a b c d e args} \ +{ + global pbTabTop TabToWidget WidgetToTab + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + send $pbTabTop set state 0 + set new $TabToWidget($widget) + send $new set state 1 + set pbTabTop $new + } +} ; foreach w $cpTabs {send $w addEventHandler pbResizeCB exposureMask} + +proc pbPanelTabs { widget type state args } \ +{ + global pbTabTop tabTop panel_up + global TabToWidget WidgetToTab + + set panel $WidgetToTab($widget) + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $widget set state 0 + set panel_up 0 + return + } + + send $TabToWidget($tabTop) set state 0 + set tabTop $panel + set pbTabTop $TabToWidget($panel) + send panelTabs setTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send $widget set state 1 + send panelShell map + set panel_up 1 + } +} +foreach w { pbDisplayP pbInfoP pbLoadP pbPrintP pbSaveP pbTileP pbCoordP } { + send $w addCallback pbPanelTabs +} + + + +# Load Panel. (Really need to clean this up.) +#------------------------------------------------------ +proc pbDoLoadOptions { param old new } \ +{ + set val [ join [lrange $new 1 end] " " ] + switch [lindex $new 0] { + newfile { send fnameText set string $val } + } +} ; send loadOptions addCallback pbDoLoadOptions + +proc pbFileLoad { widget mode fname args } \ +{ + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + send imagewin setCursorType idle +} ; send fnameText addCallback pbFileLoad + +proc pbflSelectPrint {widget cbtype selections args} \ +{ + foreach selection $selections { + ; + } +}; #send imageList addCallback pbflSelectPrint + +proc pbFileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname != ""} { + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + } +} ; send filesLoadButton addCallback pbFileLoadB + + +# Panner Marker. +#------------------------------------------------------ +proc pbTracePanner {name element op} \ +{ + global last_compass + + catch { + upvar $name panner_enable + send pbPanM set state $panner_enable + + if { $panner_enable } { + send tbCompass "setSensitive True ; set state $last_compass" + drawCompass + } else { + send tbCompass "setSensitive False ; set state False" + eraseCompass + } + } +} ; trace variable panner_enable w pbTracePanner + +proc pannerPanel args \ +{ + global panner_enable displayPanner + + setPanner [expr !$panner_enable] + send pannerButton set on [expr $panner_enable] +}; send pbPanM addCallback pannerPanel + + +# Magnifier Marker. +#------------------------------------------------------ +proc pbTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send pbMagM set state $magnifier_enable +} ; trace variable magnifier_enable w pbTraceMagnifier + +proc magnifierPanel args \ +{ + global magnifier_enable displayMagnifier + setMagnifier [expr !$magnifier_enable] + send magnifierButton set on [expr $magnifier_enable] +}; send pbMagM addCallback magnifierPanel + + +# CoordsBox Marker. +#------------------------------------------------------ +proc pbTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send pbWcsM set state $track_enable +} ; trace variable track_enable w pbTraceCoordsBox + +proc wcsPanel args \ +{ + global track_enable + setTrack [expr !$track_enable] +}; send pbWcsM addCallback wcsPanel + + + +# WPIX ISM Callbacks. +#------------------------------------------------------ + +proc altIsmToggle { widget type state args } \ +{ + ismToggle pbIsm junk $state +} ; send pbIsm addCallback altIsmToggle + +proc pbTraceIsm {name element op} \ +{ + upvar $name ism_enable + send pbIsm set state $ism_enable +} ; trace variable ism_enable w pbTraceIsm + + +proc altIsmMsgCB { param old new } \ +{ + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + deliver { ${ism}_alt_msg $argc $argv } + } +} ; send ism_msg addCallback altIsmMsgCB + + +proc wcspix_alt_msg { argc argv } \ +{ + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + switch $cmd { + startup { } + shutdown { } + disable { send pbIsm "set state False ; setSensitive False" } + capable { send pbIsm "setSensitive True" } + } +} + + + +############################################## +# Toolbar callbacks. +############################################## + +send tbNormalize addCallback normalize +send tbInvert addCallback cpInvert +send tbRegister addCallback cpRegisterFrames +send tbMatchLUT addCallback cpMatchFrames + + +# Frame Selection. +#------------------ +createMenu mFrameMenu mFrameButton $frameMenuDescription + +proc altFrameChanged {param old new} \ +{ + send mFrameButton set label $new +} ; send frame addCallback altFrameChanged + + +# Image Flipping. +#------------------------------------------------------ +proc tbSetFlip {param old new} \ +{ + if {$param == "xflip"} { + send mXflipButton set state [true $new] + } else { + send mYflipButton set state [true $new] + } +}; foreach i {xflip yflip} { send $i addCallback tbSetFlip } + + +# Zoom/Pan buttons. +#------------------------------------------------------ +proc tbZoomAction { widget args } \ +{ + global frameWidth frameHeight + + switch $widget { + tbZoom0 { cpZoom 1 1 fixed } + tbZoomIn { cpZoom 2.0 2.0 relative } + tbZoomOut { cpZoom 0.5 0.5 relative } + tbCenter { send client pan [expr $frameWidth/2.0] [expr $frameHeight/2.0] } + } +} +foreach widget { tbCenter tbZoomIn tbZoom0 tbZoomOut } { + send $widget addCallback tbZoomAction +} + + +# Frame Blink. +#------------------------------------------------------ +proc tbSetBlinkRate {w args} \ +{ + if {$w == "tbBlinkInc"} { + cpSetBlinkRate BRincrease + } else { + cpSetBlinkRate BRdeccrease + } +} +foreach w {tbBlinkDec tbBlinkInc} { send $w addCallback tbSetBlinkRate } + +proc tbBlink { widget args } \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send tbBlink set state 0 + } else { + if {$widget != "tbBlink"} { + if {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } + } else { + if {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } + } + } +} ; send tbBlink addCallback tbBlink + +proc tbTraceBlink {name element op} \ +{ + upvar $name blinkId + send tbBlink set state [expr $blinkId != 0] +} ; trace variable blinkId w tbTraceBlink + + +# Auto-register. +#------------------------------------------------------ +proc tbAutoRegister { widget type state args } \ +{ + send tbAutoReg set state $state +} +foreach w {autoregButton brAregButton tbAutoReg} { + send $w addCallback cpAutoRegister +} + +proc tbToggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + send tbAutoReg set state 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + send tbAutoReg set state 1 + } +} + + +# Frame Tiles. +#------------------------------------------------------ +proc tbSetTileFrames args \ +{ + global tileOpt + + # Send the option to the client. + if {[send tbTile get state ]} { + if {$tileOpt == 0} { + # If mode is disabled, turn on the tile selection. + selectTileOrientation junk junk Best + } else { + # Otherwise, turn on in current mode. + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } + } else { + selectTileOrientation junk junk Disabled + } +}; send tbTile addCallback tbSetTileFrames + +proc tbTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] + send tbTile set state $new +}; send tileFrames addCallback tbTrackTileFrames + +proc tbTileFramesToggle args \ +{ + set value [send tileFramesButton get on] + if {$value} { set not 0 } else { set not 1 } + + send tileFramesButton set on $not + send tbTile set state $not + cpSetTileFrames tbTile junk $not +} + + +# Compass Indicator. +#------------------------------------------------------ +proc tbToggleCompass { widget type state args } \ +{ + global frame + + if {$state} { + send compass set on True + send tbCompass set state 1 + drawCompass + } else { + send compass set on False + send tbCompass set state 0 + eraseCompass + } +} ; foreach w {compass tbCompass} { send $w addCallback tbToggleCompass } + + diff --git a/vendor/x11iraf/bin.macintel/ximtool-old b/vendor/x11iraf/bin.macintel/ximtool-old new file mode 100755 index 00000000..d85d07d8 --- /dev/null +++ b/vendor/x11iraf/bin.macintel/ximtool-old @@ -0,0 +1,10944 @@ +#!/bin/csh -f +# +# XIMTOOL-OLD -- Script wrapper to start XImtool using the original GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 79 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool V1.4 - Original GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm ' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ +exit 0 + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-OLD.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + +#!/usr/local/bin/obmsh +# +# XIMTOOL.GUI -- Default GUI for the Ximtool image display server. +# +# Version 2.0 -- BETA VERSION + + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display \ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar Label imageTitle \ + menubar Toggle controlButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +} + + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.foreground: Black + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: Black + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: Black + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: Black + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 0 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + -2 \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + vcutFrame < * +inf -inf > \ + } \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 plotOpts -4 } \ + } \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 0 + *hcutFrame.outerOffset: 0 + *hcutPlot.color0: #c4c4c4 + *hcutPlot.color1: black + *hcutPlot.color0: darkslategray + *hcutPlot.color1: #eeeee0 + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(controlPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + *vcutPlot.color0: #c4c4c4 + *vcutPlot.color1: black + *vcutPlot.color0: darkslategray + *vcutPlot.color1: #eeeee0 + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(controlPanel) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 40 + *menuGroup.width: 518 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + controlButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: white + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 518 + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 518 + *imageFrame.height: 518 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 518 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + NoneLeft: call(move_cursor,-1,0) \n\ + NoneDown: call(move_cursor,0,1) \n\ + NoneUp: call(move_cursor,0,-1) \n\ + NoneRight: call(move_cursor,1,0) \n\ + !Shift Left: call(move_cursor,-10,0) \n\ + !Shift Down: call(move_cursor,0,10) \n\ + !Shift Up: call(move_cursor,0,-10) \n\ + !Shift Right: call(move_cursor,10,0) \n\ + !Ctrl h: call(move_cursor,-1,0) \n\ + !Ctrl j: call(move_cursor,0,1) \n\ + !Ctrl k: call(move_cursor,0,-1) \n\ + !Ctrl l: call(move_cursor,1,0) \n\ + !Ctrl Shift h: call(move_cursor,-10,0) \n\ + !Ctrl Shift j: call(move_cursor,0,10) \n\ + !Ctrl Shift k: call(move_cursor,0,-10) \n\ + !Ctrl Shift l: call(move_cursor,10,0) \n\ + !Alt 1: call(cpSetFrame,frame1) \n\ + !Alt 2: call(cpSetFrame,frame2) \n\ + !Alt 3: call(cpSetFrame,frame3) \n\ + !Alt 4: call(cpSetFrame,frame4) \n\ + !Ctrl 1: call(cpZoom,1,1,fixed) \n\ + !Ctrl 2: call(cpZoom,2,2,fixed) \n\ + !Ctrl 3: call(cpZoom,3,3,fixed) \n\ + !Ctrl 4: call(cpZoom,4,4,fixed) \n\ + !Ctrl 5: call(cpZoom,5,5,fixed) \n\ + !Ctrl 6: call(cpZoom,6,6,fixed) \n\ + !Ctrl 7: call(cpZoom,7,7,fixed) \n\ + !Ctrl 8: call(cpZoom,8,8,fixed) \n\ + !Ctrl 9: call(cpZoom,9,9,fixed) \n\ + !Ctrl Left: call(moveFrame,-1,0) \n\ + !Ctrl Down: call(moveFrame,0,1) \n\ + !Ctrl Up: call(moveFrame,0,-1) \n\ + !Ctrl Right: call(moveFrame,1,0) \n\ + !Ctrl Alt Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt Right: call(moveFrame,0.5,0) \n\ + !Ctrl a: call(toggleAutoReg) \n\ + !Ctrl b: call(prevFrame,$name) \n\ + !Ctrl c: call(cpZoomAction,centerFrame) \n\ + !Ctrl f: call(nextFrame,$name) \n\ + !Ctrl i: call(cpInvert) \n\ + !Ctrl m: call(toggleMagnifier) \n\ + !Ctrl n: call(normalize) \n\ + !Ctrl o: call(offset,$x,$y) \n\ + !Ctrl p: call(togglePanner) \n\ + !Ctrl Alt q: call(Quit) \n\ + !Ctrl r: call(cpRegisterFrames) \n\ + !Ctrl s: call(cpMatchFrames) \n\ + !Ctrl t: call(tileFramesToggle) \n\ + !Ctrl u: call(cpZoom,1,1,fixed) \n\ + !Ctrl x: call(cpFrameAction,flipX) \n\ + !Ctrl y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt =: call(Print) \n\ + Ctrl +: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl -: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl \<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl \>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl \[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl \]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl 0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt 0: call(centroid,$x,$y,min) \n\ + !Alt b: call(toggleBlink) \n\ + !Alt c: call(controlPanel) \n\ + !Ctrl Alt f: call(fitFrame) \n\ + !Alt h: call(Help) \n\ + !Alt i: call(infoPanel) \n\ + !Alt l: call(loadPanel) \n\ + !Alt p: call(printPanel) \n\ + !Alt s: call(savePanel) \n\ + !Alt t: call(tclPanel) \n\ + !: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift : crosshair(on) \n\ + !Shift : crosshair(on) \n\ + !Shift: crosshair(off) \n\ + !: crosshair(off) \n\ + !: call(zoom,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !: call(updateColormap,$x,$y) \n\ + !: call(windowColormap,$x,$y) \n\ + !Ctrl : call(makeRuler,$name,$x,$y) \n\ + !Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl : call(deleteRuler,$x,$y) \n\ + : enter-window() \n\ + : leave-window() \n\ + : graphics-input() \n\ + !Alt : call(curtrack_msg,$x,$y) \n\ + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl : call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.borderWidth: 0 + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 50 + *colorbar.height: 17 +} + + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(markerMenu) + : popdown(markerMenu) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : m_input() + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : popup(magzoomMenu) + : popdown(magzoomMenu) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift : m_rotateResize() + : m_moveResize() + !Shift : m_raise() m_markpos() + : m_raise() m_markposAdd() + : m_redraw() m_destroyNull() + : m_lower() + : call(pannerPanXY,$x,$y) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(toggleMagnifier) + !Ctrl p: call(togglePanner) + !Ctrl r: call(cpRegisterFrames) + !Ctrl s: call(cpMatchFrames) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: m_deleteDestroy() + Delete: m_deleteDestroy() + : graphics-input() + : track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl b: call(prevFrame,$name) + !Ctrl b: call(prevFrame,$name) + !Ctrl f: call(nextFrame,$name) + !Ctrl h: call(move_cursor,-1,0) + !Ctrl j: call(move_cursor,0,1) + !Ctrl k: call(move_cursor,0,-1) + !Ctrl l: call(move_cursor,1,0) + !Ctrl n: call(normalize) + !Ctrl c: call(cpZoomAction,centerFrame) + !Ctrl i: call(cpInvert) + !Ctrl m: call(cpMatchFrames) + !Ctrl r: call(cpRegisterFrames) + !Ctrl p: call(togglePanner) + !Alt 1: call(cpSetFrame,frame1) + !Alt 2: call(cpSetFrame,frame2) + !Alt 3: call(cpSetFrame,frame3) + !Alt 4: call(cpSetFrame,frame4) + !Ctrl 1: call(cpZoom,1,1,fixed) + !Ctrl 2: call(cpZoom,2,2,fixed) + !Ctrl 3: call(cpZoom,3,3,fixed) + !Ctrl 4: call(cpZoom,4,4,fixed) + !Ctrl 5: call(cpZoom,5,5,fixed) + !Ctrl 6: call(cpZoom,6,6,fixed) + !Ctrl 7: call(cpZoom,7,7,fixed) + !Ctrl 8: call(cpZoom,8,8,fixed) + !Ctrl 9: call(cpZoom,9,9,fixed) + BackSpace: call(deleteNamedRuler,NAME,$x,$y) + Delete: call(deleteNamedRuler,NAME,$x,$y) + : m_input() + : call(setRulerMenu) popup(rulerMenu) + : popdown(rulerMenu) +!Ctrl : track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl : call(deleteRuler,$x,$y) + : track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tcl_panel unmap } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "
%s\n%s
" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/bin.macintel/xtapemon b/vendor/x11iraf/bin.macintel/xtapemon new file mode 100755 index 00000000..3cd5ea65 Binary files /dev/null and b/vendor/x11iraf/bin.macintel/xtapemon differ diff --git a/vendor/x11iraf/cdl/.alias b/vendor/x11iraf/cdl/.alias new file mode 100644 index 00000000..fa044759 --- /dev/null +++ b/vendor/x11iraf/cdl/.alias @@ -0,0 +1,3 @@ +alias x /iraf/x11iraf/ximtool/ximtool +alias z cdltest +alias mk make diff --git a/vendor/x11iraf/cdl/Imakefile b/vendor/x11iraf/cdl/Imakefile new file mode 100644 index 00000000..9185071e --- /dev/null +++ b/vendor/x11iraf/cdl/Imakefile @@ -0,0 +1,92 @@ +# +# Imakefile for the Client Display Library V1.8 +# +# Mike Fitzpatrick, National Optical Astronomy Observatories, IRAF project. +# Feb 1997 + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + +# CDEBUGFLAGS = -g + EXTRA_INCLUDES = -I. +#if defined (HPArchitecture) || defined(RsArchitecture) + EXTRA_DEFINES = -D_NO_US_ +#else + +# If you plan to use the ANSI function prototypes in your application +# you *must* edit the following to include '-DCDL_ANSIC' so the CDL +# is compiled with prototypes and will not promote arguments to a +# different type. + +# EXTRA_DEFINES = -DCDL_ANSIC +#endif + +#if HasLargeTmp | SystemV4 + ARADD = ar ru +#else + ARADD = ar rul +#endif + + + SUBDIRS = + MATHLIB = -lm + + SRCS = cdl.c cdlmark.c cdlfits.c cdliraf.c cdlzscale.c cdl_f77.c \ + cdl_spp.c eps.c comm.c imd.c + OBJS = cdl.o cdlmark.o cdlfits.o cdliraf.o cdlzscale.o cdl_f77.o \ + cdl_spp.o eps.o comm.o imd.o + CDL_INCLUDES = cdl.h cdlP.h cdlProto.h cdl_f77.h cdlfont.h eps.h + HEADERS = cdl.h cdlspp.h cdlftn.inc + +World:: + @echo "Building Release 1.8 of the IRAF CLient Display Library" + @echo "" ; date ; echo "" + $(MAKE) $(MFLAGS) Makefiles + $(MAKE) $(MFLAGS) clean + $(MAKE) $(MFLAGS) depend + $(MAKE) $(MFLAGS) all + @echo "Done." ; date ; echo "" + +all:: libcdl.a + +NormalLibraryTarget(cdl,$(OBJS)) + +LinkFileList(linklibs,libcdl.a,X11irafLibDir,CDLDir) + +DependTarget() + + +#if InstallLibraries +install:: libcdl.a + @(set -x; $(RM) X11irafLibDir/libcdl.a) + @(set -x; $(CP) -p libcdl.a X11irafLibDir/libcdl.a) +#endif + +includes:: + MakeDir(X11irafIncDir) + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/$$i; \ + $(CP) -p CDLDir/$$i X11irafIncDir/$$i; \ + done) + +#if InstallIncludes +install:: + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/$$i; \ + done) + for i in $(HEADERS); do \ + (set -x; $(CP) -p $$i $(DESTDIR)$(X11IRAFDIR)/include); \ + done +#endif + + +pristine:: + $(MAKE) $(MFLAGS) clean + $(RM) -f Makefile test/Makefile examples/Makefile *spool* + +archive:: + $(MAKE) $(MFLAGS) pristine + !tar -cvf - . | compress > ../cdl.tar.Z + diff --git a/vendor/x11iraf/cdl/Imakefile.standalone b/vendor/x11iraf/cdl/Imakefile.standalone new file mode 100644 index 00000000..9e4d9c39 --- /dev/null +++ b/vendor/x11iraf/cdl/Imakefile.standalone @@ -0,0 +1,97 @@ +# +# Imakefile for the Client Display Library V1.8 +# +# Mike Fitzpatrick, National Optical Astronomy Observatories, IRAF project. +# Feb 1997 + +#define IHaveSubdirs +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + + CDEBUGFLAGS = -g + EXTRA_INCLUDES = -I. +#if defined (HPArchitecture) || defined(RsArchitecture) + EXTRA_DEFINES = -D_NO_US_ +#else + +# If you plan to use the ANSI function prototypes in your application +# you *must* edit the following to include '-DCDL_ANSIC' so the CDL +# is compiled with prototypes and will not promote arguments to a +# different type. + +# EXTRA_DEFINES = -DCDL_ANSIC +#endif + +#if HasLargeTmp | SystemV4 + ARADD = ar ru +#else + ARADD = ar rul +#endif + +# Hack to compile under SunPRO V4 on Solaris +#if defined (SunArchitecture) && OSMajorVersion >= 5 && HasSunC +#if OSMinorVersion <= 5 +#if !defined (i386Architecture) + CCOPTIONS = -Xs +EXTRA_LDOPTIONS = -xildoff +#endif +#else + CCOPTIONS = +EXTRA_LDOPTIONS = -xildoff +#endif + +#else +#if defined (UltrixArchitecture) + CCOPTIONS = -DULTRIX +#endif +#if defined (OSF1Architecture) && OSMajorVersion >= 4 + CCOPTIONS = -DOSF1 +#endif +#endif + + SUBDIRS = examples test + MATHLIB = -lm + + SRCS = cdl.c cdlmark.c cdlfits.c cdliraf.c cdlzscale.c cdl_f77.c \ + cdl_spp.c eps.c comm.c imd.c + OBJS = cdl.o cdlmark.o cdlfits.o cdliraf.o cdlzscale.o cdl_f77.o \ + cdl_spp.o eps.o comm.o imd.o + CDL_INCLUDES = cdl.h cdlP.h cdlProto.h cdl_f77.h cdlfont.h eps.h + + +World:: + @echo "Building Release 1.8 of the IRAF Client Display Library" + @echo "" ; date ; echo "" + $(MAKE) $(MFLAGS) Makefiles + $(MAKE) $(MFLAGS) clean + $(MAKE) $(MFLAGS) depend + $(MAKE) $(MFLAGS) all + @echo "Done." ; date ; echo "" + +all:: libcdl.a vximtool + +NormalLibraryTarget(cdl,$(OBJS)) + +vximtool: vximtool.o + $(RM) vximtool + $(CC) -o vximtool -DHAVE_CDL vximtool.o $(LDOPTIONS) libcdl.a \ + $(MATHLIB) $(EXTRA_LIBRARIES) + +vximtool.o: + $(CC) -c $(CFLAGS) -DHAVE_CDL vximtool.c + +clean:: + $(RM) vximtool vximtool.o + +ForceSubdirs($(SUBDIRS)) +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) + +pristine:: + $(MAKE) $(MFLAGS) clean + $(RM) -f Makefile test/Makefile examples/Makefile *spool* + +archive:: + $(MAKE) $(MFLAGS) pristine + !tar -cvf - . | compress > ../cdl.tar.Z + +DependTarget() diff --git a/vendor/x11iraf/cdl/Makefile.generic b/vendor/x11iraf/cdl/Makefile.generic new file mode 100644 index 00000000..1295035e --- /dev/null +++ b/vendor/x11iraf/cdl/Makefile.generic @@ -0,0 +1,205 @@ +# +# Generic Makefile for the Client Display Library V1.0 +# +# Mike Fitzpatrick, National Optical Astronomy Observatories, IRAF project. +# Apr 1997 + + EXTRA_CFLAGS = + CDEBUGFLAGS = -g + + AR = ar r + ARADD = ar rul + RANLIB = ranlib + RM = rm + + SUBDIRS = examples test + MATHLIB = -lm + + SRCS = cdl.c cdlmark.c cdlfits.c cdliraf.c cdlzscale.c cdl_f77.c \ + cdl_spp.c eps.c comm.c imd.c + OBJS = cdl.o cdlmark.o cdlfits.o cdliraf.o cdlzscale.o cdl_f77.o \ + cdl_spp.o eps.o comm.o imd.o + CDL_INCLUDES = cdl.h cdlP.h cdlProto.h cdl_f77.h cdlfont.h eps.h + + +World:: + @echo "Building Release 1.8 of the IRAF CLient Display Library" + @echo "" ; date ; echo "" + $(MAKE) $(MFLAGS) all + @echo "Done." ; date ; echo "" + +.c.o: + $(RM) -f $@ + $(CC) -c $(EXTRA_CFLAGS) $(CFLAGS) $*.c + +all:: libcdl.a vximtool + + +libcdl.a: $(OBJS) $(CDL_INCLUDES) + $(RM) -f libcdl.a + $(AR) libcdl.a $(OBJS) + $(RANLIB) libcdl.a + +vximtool: vximtool.o + $(RM) -f vximtool + $(CC) -o vximtool -DHAVE_CDL vximtool.o libcdl.a $(MATHLIB) + +vximtool.o: + $(CC) -c $(CFLAGS) -DHAVE_CDL vximtool.c + +$(SUBDIRS): FRC + @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \ + $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all + +FRC: + +all:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \ + done + +depend:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) depend); \ + done + +pristine:: + $(MAKE) $(MFLAGS) clean + $(RM) -f Makefile test/Makefile examples/Makefile + $(RM) -f Makefile.bak test/Makefile.bak examples/Makefile.bak + +clean:: + $(RM) -f *.o *.a *spool* vximtool + +depend:: + +# ------------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +emptyrule:: + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) -f Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +saber: + # load $(ALLDEFINES) $(SRCS) + +osaber: + # load $(ALLDEFINES) $(OBJS) + +# ------------------------------------------------------------------------- +# rules for building in SUBDIRS - do not edit + +install:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \ + done + +install.man:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \ + done + +clean:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \ + done + +tags:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \ + done + +Makefiles:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ + case "$$i" in \ + ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ + ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ + ./?*/?*) newtop=../../ sub=subsub;; \ + ./?*) newtop=../ sub=sub;; \ + */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ + */?*/?*) newtop=../../../ sub=subsubsub;; \ + */?*) newtop=../../ sub=subsub;; \ + *) newtop=../ sub=sub;; \ + esac; \ + case "$(TOP)" in \ + /?*) newtop= upprefix= ;; \ + *) upprefix=../ ;; \ + esac; \ + $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ + MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ + done + +subdirMakefiles: + $(RM) -f $(MAKEFILE_SUBDIR)/Makefile.bak + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ + else exit 0; fi + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ + $(MAKE) $(MFLAGS) Makefiles + +subsubdirMakefiles: + $(RM) -f $(MAKEFILE_SUBDIR)/Makefile.bak + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ + else exit 0; fi + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ + $(MAKE) $(MFLAGS) Makefiles + +subsubsubdirMakefiles: + $(RM) -f $(MAKEFILE_SUBDIR)/Makefile.bak + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ + else exit 0; fi + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ + $(MAKE) $(MFLAGS) Makefiles + +subsubsubsubdirMakefiles: + $(RM) -f $(MAKEFILE_SUBDIR)/Makefile.bak + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ + else exit 0; fi + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ + $(MAKE) $(MFLAGS) Makefiles + +includes:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \ + $(MAKE) $(MFLAGS) includes); \ + done + +# ------------------------------------------------------------------------- +# dependencies generated by makedepend + +# DO NOT DELETE + diff --git a/vendor/x11iraf/cdl/Notes b/vendor/x11iraf/cdl/Notes new file mode 100644 index 00000000..a929bdec --- /dev/null +++ b/vendor/x11iraf/cdl/Notes @@ -0,0 +1,171 @@ +/* + * CDL -- Client Display Library. This package provides a general interface + * for client applications to do IRAF-like image display and interaction. + * It is layered upon other interfaces for handling basic display, cursor + * and frame buffer operations, and low-level server communications. + * + * cdl = cdl_open (imtdev) + * cdl_displayPix (cdl, pix, nx, ny, bitpix, frame, fbconfig, zscale) + * cdl_readCursor (cdl, sample, &x, &y, &key) + * cdl_setCursor (cdl, x, y, wcs) + * cdl_clearFrame (cdl) + * cdl_close (cdl) + * + * cdl_displayIRAF (cdl, fname, band, frame, fbconfig, zscale) + * cdl_isIRAF (fname) + * cdl_readIRAF (fname, band, &pix, &nx, &ny, &bitpix); + * + * cdl_displayFITS (cdl, fname, frame, fbconfig, zscale) + * cdl_isFITS (fname) + * cdl_readFITS (fname, &pix, &nx, &ny, &bitpix); + * + * cdl_computeZscale (cdl, pix, nx, ny, bitpix, &z1, &z2) + * cdl_zscaleImage (cdl, &pix, nx, ny, bitpix, z1, z2) + * + * cdl_printPix (cdl, cmd, pix, nx, ny, annotate) + * cdl_printPixToFile (cdl, fname, pix, nx, ny, annotate) + * + * cdl_readImage (cdl, &pix, &nx, &ny) + * cdl_readFrameBuffer (cdl, &pix, &nx, &ny) + * cdl_readSubRaster (cdl, lx, ly, nx, ny, &pix) + * cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix) + * + * cdl_selectFB (cdl, nx, ny, &fb, &fb_w, &fb_h, &nframes, reset) + * cdl_setFBConfig (cdl, configno) + * cdl_getFBConfig (cdl, &configno, &w, &h, &nframes) + * cdl_lookupFBSize (cdl, configno, &w, &h, &nframes) + * + * cdl_[set|get]WCS (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) + * cdl_[set|get]Frame (cdl, frame) + * cdl_[set|get]ZTrans (cdl, ztrans) + * cdl_[set|get]ZScale (cdl, z1, z2) + * cdl_[set|get]Sample (cdl, nsample) + * cdl_[set|get]SampleLines (cdl, nlines) + * cdl_[set|get]Contrast (cdl, contrast) + * cdl_[set|get]Name (cdl, imname) + * cdl_[set|get]Title (cdl, imtitle) + * + * + * GRAPHICS OVERLAY ROUTINES: + * -------------------------- + * cdl_mapFrame (cdl, frame) + * cdl_markPoint (cdl, x, y, number, size, type, color) + * cdl_markLine (cdl, xs, ys, xe, ye, color) + * cdl_markBox (cdl, lx, ly, ux, uy, fill, color) + * cdl_markPolyline (cdl, xpts, ypts, npts, color) + * cdl_markPolygon (cdl, xpts, ypts, npts, fill, color) + * cdl_markCircle (cdl, x, y, radius, fill, color) + * cdl_markCircAnnuli (cdl, x, y, radius, nannuli, sep, color) + * cdl_markEllipse (cdl, x, y, xrad, yrad, ang, fill, color) + * cdl_markEllipAnnuli (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) + * cdl_markText (cdl, x, y, str, size, angle, color) + * + * cdl_setFont (cdl, type) + * + * cdl_beginDisplayList (cdl) + * cdl_endDisplayList (cdl) + * cdl_drawDisplayList (cdl) + * + * cdl_deleteMark (cdl, x, y) + * cdl_clearOverlay (cdl) + * cdl_redrawOverlay (cdl) + * + * + * Client applications begin with a cdl_open() call to initialize the + * interface. The "imtdev" argument is used to specify a connection at device + * open time, or if NULL the procedure will attempt to first connect on a unix + * socket or fifo pipe if that fails. The syntax for the imtdev argument is + * as follows: + * :
+ * + * where is one of "inet" (internet tcp/ip socket), "unix" (unix + * domain socket) or "fifo" (named pipe). The form of the address depends + * upon the domain, see the IMD interface code comments or documentation + * for examples. + * + * The library assumes a logical coordinate system that has the image or + * raster origin in the lower-left corner. All I/O routines should be passed + * or will return a pixel pointer set to the LL corner of the raster, all + * cursor positions will similarly use this coordinate system. Initially the + * [0,0] origin is defined as the LL of the frame buffer, this will remain + * the case until the WCS is redefined either explicitly through a cdl_setWCS() + * call or by using one of the high level cdl_display*() procedures to display + * an image smaller that the current frame buffer. Applications wishing to + * retain this initial origin or those wanting to explicitly place the image + * in the frame buffer should use the cdl_writeSubRaster() for display. This + * is to allow cursor and subraster positions to be specified in image coord- + * inates more easily. Negative positions are allowed and will either refer + * to empty pixels if the frame buffer is larger than the image, or pixels + * outside the frame buffer boundaries. Raster I/O requests will be clipped + * to the frame buffer endpoints, a request completely outside the frame buffer + * is an error. + * + * The high-level display routines cdl_displayIRAF() and cdl_displayFITS() + * can be used to display images directly by name. A WCS will automatically + * be defined for each image after the optional zscaling hass been computed. + * Applications wishing to define their own WCS need to call cdl_setWCS() + * after the display call to redefine the default WCS. + */ + +------------------------------------------------------------------------------ + +/* + * IMAGE DISPLAY -- The image display interface is responsible for actually + * displaying an image to the server, for reading back a raster from the + * server, and cursor positioning. This is a mid-level interface for + * handling the steps necessary for image display operations without dealing + * directly with the details of communicating with the server. + * + * imd = imd_open (imtdev) + * imd_displayImage (imd, pix, nx, ny, frame, fbconfig, comp_wcs) + * imd_readCursor (imd, sample, &x, &y, &key) + * imd_[set|get]WCS (imd, name, title, a, b, c, d, tx, ty, z1, z2, zt) + * imd_close (imd) + * + * Low Level Procedures + * -------------------- + * imd_writeImage (imd, pix, nx, ny, lx, ly) + * imd_readImage (imd, &pix, &nx, &ny) + * imd_readFrameBuffer (imd, &pix, &nx, &ny) + * imd_setFrame (imd, frame) + * imd_setFBConfig (imd, configno) + * imd_getFBConfig (imd, &configno, &width, &height, &nframes)) + * imd_setName (imd, name) + * imd_setTitle (imd, title) + * imd_setCursor (imd, x, y, wcs) + * imd_clearFrame (imd) + * imd_writeSubRaster (imd, lx, ly, nx, ny, pix) + * imd_readSubRaster (imd, lx, ly, nx, ny, &pix) + * + * We leave it to the higher level procedures to handle Z-scale trans- + * formations, spatial scaling, and high level image I/O. All display pixels + * are assumed to be scaled to 8-bits already. + */ + +------------------------------------------------------------------------------ + +/* + * COMMUNICATIONS INTERFACE -- The communications interface handles all the + * low-level communications with the server. It implements only the subset + * of the IIS protocol used by XImtool, SAOtng and SAOimage, not the entire + * IIS protocol. It may be swapped out for another protocol in the future + * without affecting the tasks which use it as long as the basic steps re- + * quired for image display are the same. + * + * com_writeData (fd, x, y, pix, nx, ny) + * com_readData (fd, x, y, &pix, &nx, &ny) + * com_readCursor (fd, sample, &x, &y, &key) + * com_setCursor (fd, x, y, wcs) + * com_setFBConfig (fd, configno) + * com_setFrame (fd, frame) + * com_writeWCS (fd, name, a, b, c, d, tx, ty, z1, z2, zt) + * com_readWCS (fd, &name, &a, &b, &c, &d, &tx, &ty, + * &z1, &z2, &zt) + * com_eraseFrame (fd) + * + * We do not actually display images here, all we do is send the individual + * set frame, write a data chunk, etc commands. The caller is responsible for + * coordinating these calls into a legal sequence for image display. + * All routines return 0 if successfull and 1 otherwise. + */ + diff --git a/vendor/x11iraf/cdl/README b/vendor/x11iraf/cdl/README new file mode 100644 index 00000000..32762ca4 --- /dev/null +++ b/vendor/x11iraf/cdl/README @@ -0,0 +1,36 @@ +########################################################################### +# # +# CDL -- Client Display Library Mar 04, 1998 # +# # +########################################################################### + + + This directory contains the Client Display Library (CDL) sources. +The CDL is a host interface for C or Fortran programs allowing them to +display images or overlay graphics to display servers such as XImtool or +SAOimage / SAOtng. High-level procedures allow IRAF or FITS images to be +displayed simply, other routines permit access to all other server functions +(e.g. cursor and image readback, frame selection, etc). The library also +features a number of functions for doing image overlay graphics; supported +graphics primitives include numerous point shapes, lines, circles, ellipses, +polygons, annular shapes, and text. + + This package is made up of several interfaces, specifically + + CDL - high-level image display and graphics overlay + IMD - mid-level image display routines + COMM - server communications (currently IIS) + +See the Notes file or Reference Guide in the doc subdirectory for more +information. + + Source for the library itself is in this directory. Documentation +is in the 'doc' subdirectory and demonstration applications can be found in +the 'examples' subdirectory. The 'test' subdirectory contains debugging +programs used during development; they're not really good examples of +programming practice but may serve as demos of how individual functions +can be called. + + See the RELEASE.NOTES file in this directory, or the Reference +Guide in the 'doc' subdirectory for information on using and installing +this library. diff --git a/vendor/x11iraf/cdl/Revisions b/vendor/x11iraf/cdl/Revisions new file mode 100644 index 00000000..bd1249e8 --- /dev/null +++ b/vendor/x11iraf/cdl/Revisions @@ -0,0 +1,361 @@ + +cdl.h + Added missing procedure declarations for cdl_isFITS(), cdl_isIRAF(), + and cdl_markPointLabel(). (12/12/02) + +cdlzscal.c + Added a missing (12/12/02) + +============= +V1.8 Released +============= + +cdl.c **** INTERFACE CHANGE **** +imd.c **** INTERFACE CHANGE **** +cdl.h **** INTERFACE CHANGE **** +cdl_spp.c **** INTERFACE CHANGE **** +cdl_spp.h **** INTERFACE CHANGE **** +cdl_f77.c **** INTERFACE CHANGE **** +cdl_77.h **** INTERFACE CHANGE **** +cdlspp.h **** INTERFACE CHANGE **** + Added new interface routines for the set/get/query mapping calls. + See the detailed Revisions notes for specifics (8/4/01) + +imd.c +comm.c +cdlP.h +cdlProto.h + Added a new com_wcsVersion() routine to query server for the + WCS version (i.e. new XImtool mapping support) (6/14/01) + +eps.c + Made certain variables static, other lint cleanups (6/14/01) + +cdlzscale.c + Changed to handle the case of a very small slope produced by the + fitting rejection (5/31/01) + +cdlfits.c + Minor change to variable names. (5/30/01) + +imd.c + Fixed a minor bug where the last line of a display was being left + off due to an incorrect indexing of the last block being written + in imd_writeSubRaster(). (4/17/01) + +Imakefile + Incremented version to 1.8 (4/17/01) + +comm.c + Fixed a bug in reading octal cursor values (e.g. space) (11/20/2000) + +cdlzscale.c + Added a '#include "cdl.h"' so the ANSI_FUNC was defined (11/17/2000) + +cdlmark.c + Fixed a bug in the selection of BOX markers for deletion (10/27/2000) + +cdl_f77.c + Fixed a bug preventing cfreadiraf() from getting the pixels + correctly (5/23/2000) + +cdliraf.c + Fixed a bug in getting the V2 image title (5/23/2000) + + +============= +V1.7 Released +============= + +cdl.c **** INTERFACE CHANGE **** + Modified the behavior of cdl_getFrame() to do a sampling cursor + read to get the frame buffer from the server. If the value returned + is zero (as from SAOimage) the current value of the frame number in + the CDL is returned. (3/29/00) + +cdl.[ch] **** INTERFACE CHANGE **** +imd.c **** INTERFACE CHANGE **** +comm.c **** INTERFACE CHANGE **** +cdlProto.h **** INTERFACE CHANGE **** +cdl_f77.[ch] **** INTERFACE CHANGE **** +cdl_spp.c **** INTERFACE CHANGE **** +examples/tvmark.c **** INTERFACE CHANGE **** +test/cdltest.c **** INTERFACE CHANGE **** +test/imdtest.c **** INTERFACE CHANGE **** + Modified the cdl_readCursor() routine to have a new 'wcs' argument + to return the WCS of the cursor read. This is to allow applications + to get the frame number of the read from the wcs (i.e. wcs is + coded as "frame * 100 + wcs". (3/29/00) + +imd.c + Fixed a bug in the drawing of markers where the start coord for + the subraster is (1,1). When writing out the subraster the + routine was incorrectly deciding that the frame buffer did not + need to be readback to edit the subraster. (3/14/00) + +examples/mosaic.c + Added an ability to display raw images of the same size per user + request (2/19/99) + +cdl.c +cdlmark.c + Removed duplicate includes (1/5/99) + +comm.c + Fixed a readWCS call so it correctly gets the frame requested, + now it's always getting frame 1. (1/4/99) + +imd.c + Closed the file descriptors in imd_close(). This was preventing + the CDL from reconnecting properly and leaving the server in a + read hang. (1/4/99) + +cdl_f77.c + Modified the CDF_READ* wrappers to use a temporary buffer in the + actual call to the CDL C routines since fortran passes in static + arrays which cannot be reallocated by the low-level C code. The + data is moved from the temp buffer to the input buffer after the + call. (1/2/99) + +cdl_f77.[ch] +cdl_spp.[ch] + Fixed some errors in the binding code not finding certain procedures. + (10/28/98) + +cdlfits.c + Changed bscale/bzero to double to avoid an overflow (10/13/98) + +cdlmark.c + Added an offset to the circle coordinate calculation to assure + circle is centered. (10/13/98) + +cdl.c + Fixed a bug in the zscale of real and double data. (6/3/98) + +cdlzscale.c + Fixed a bug in floatCompare causing the sort to fail when the range + of data is <1.0 (6/2/98) + +imd.c + Modified debug output so individual writes are only printed when + verbose output requested. (6/1/98) + +cdl.c +cdl.h + Modified the zscale code to behave more like the V2.11 code in + determining z1/z2. If the number of sample lines isn't explicitly + set then the sample is derived evenly from the entire image as though + with an image section, otherwise the old method is used. The default + number of sample points was increased to 1000. (6/1/98) + +imd.c + Fixed a bug in the image display code causing garbage values + for some image sizes (3/16/98) + +cdlfits.c + Removed col 30 restriction from logical keywords (3/16/98) + +============= +V1.6 Released +============= + +Imakefile +Makefile.generic + Misc platform bug fixes. (3/3/98) + +doc/cdlref.ms + Updated with latest changes. (3/1/98) + +cdl_spp.[ch] + Misc small bug fixes. (3/1/98) + +cdl.h +Imakefile +Makefile.generic + Updated version number to 1.6 (2/28/98) + +cdlP.h +cdlmark.c +cdlspp.h +cdl_f77.[ch] +cdl_spp.[ch] + Finished implementation of dashed line type for all markers (2/18/98) + +cdlmark.c + Finished implementation of hollow/shadow line type for all markers + (2/13/98) + +cdlmark.c + Fixed a bug in the marker deletetion code (2/13/98) + +All sources + Numerous changes to all sources to provide ANSI C function prototypes + and to separate the public and private declarations. For ANSI use + CDL_ANSIC must be defined prior to the "#include ". (1/16/98) + +cdl_f77.[ch] +cdl_spp.[ch] +cdlspp.h +cdlftn.inc +cdlmark.c +cdl.h + Added new routines cdl_setLineWidth() and cdl_setTextWidth() and + hooked them into marker code. Also added a new BOLD font type + which maintain current font but increases the width. (1/5/98) + +imd.c + Fixed a bug in computing the WCS for images larger than the FB (1/1/98) + +imd.c + Changed the subraster code so it would do a read when writing as + subraster the full width of the FB. (1/1/98) + +cdliraf.c **** INTERFACE CHANGE **** +cdlfits.c **** INTERFACE CHANGE **** +cdl_f77.c **** INTERFACE CHANGE **** +cdl_spp.c **** INTERFACE CHANGE **** + Changed the cdl_readXXX() calls to return the title string (1/1/98) + +cdliraf.c +cdlfits.c +examples/display.c + Fixed a bug in writing the name/title to the WCS (12/31/97) + +cdl.h +cdl.c +imd.c + Fixed a bug where the z1/z2 values weren't being properly loaded by + the cdl_displayPix procedure when zscaling. (12/29/97) + +cdl.h +imd.h + Included cdl.h in the imd.h file so there is only one structure + definition of the IMD struct. Cleaned up duplicate defines. (11/13/97) + +cdlmark.c +cdlfont.h +cdl_f77.[ch] +cdl_spp.[ch] + Added a new routine cdl_setFont() which can be used to choose be- + tween a set of new fonts. (9/9/97) + +cdliraf.c + Modified to handle new V2 OIF format images. (6/6/97) + +cdlmark.c + Fixed up the text presentation a bit by making the default size + a little larger for clarity, added proportional spacing for thin + chars like 'i' and 'l', and fixed a bug in the subregion size (6/4/97) + +configure + +Makefile.generic + +examples/ Makefile.generic + +test/ Makefile.generic + + Added a generalized set of makefiles for sites w/out Imake (4/27/97) + +eps.c + Fixed a minor bug in axis labeling. (4/27/97) + +cdliraf.c +cdlfits.c + Initialized z1/z2 values in display procedures (4/25/97) + +cdl.c +cdlmark.c + The DLHead/DLtail structures were being accessed as one-indexed + arrays, changed so they're zero-index and won't overflow the + allocation. (4/25/97) + +comm.c + Fixed a bug where the fbconfig was being passed in incorrectly in + a clear-frame request. Caused a "shifted buffer" effect on SAOimage + in subsequent calls to the display example. (4/24/97) + +comm.c +doc/cdlref.ms +doc/cdlref.ps + Fixed a bug in the encoding of the frame number as it's passed to + the server, caused display to frames 3-4 to fail. Updated docs. + (4/22/97) + +cdl.c + Removed the imd_setWCS() call from the cdl_open() procedure to + avoid reinitialize the frame buffers in the server. This would + erase previously displayed frames e.g. in the display example + when using an FB larger than the default. (4/13/97) + +cdl.c +cdl_f.c +doc/cdlref.ms +doc/cdlref.ps + Changed the behavior of the cdl_open() procedure (C and F77) to check + automatically for the IMTDEV variable if passed a NULL arg. Also + fixed a bug in the fortran interface string stripping procedure intro- + duced by the earlier bug fix. (3/29/97) + +cdl_f.c + Fixed bug in string passing. Fortran appends a 'hidden' string + length argument that was not being used and strings were being + truncated or assumed to be a certain length improperly. Also + modified CDF_OPEN to handle an empty string properly (the ftn + getenv procedure doesn't always return a NULL, just an empty + string). (3/27/97) + +examples/fdisplay.f +examples/ftvmark.f + Modified to show use of IMTDEV environment variable for making + the server connection. (3/27/97) + +eps.c + Added a grestore to the prolog to workaround a bug on Digital + Printerserver 17 printers. (3/27/97) + +cdlfits.c + Fixed a bug in the reading of FITS files with BSCALE/BZERO (3/18/97) + +cdl_f.c + Removed an errant cdl arg to CDF_CLOSE (3/12/97) + +imd.c +eps.c +cdl.h +comm.c +test/imdtest.c + Ifdef'd uchar typedef for AIX systems. (3/12/97) + +cdliraf.c +examples/display.c + Ifdef'd include for lseek on Ultrix systems (3/12/97) + +cdliraf +comm.c + SAOimage assumes that a ClearFrame request passes the fbconfig + number in the tid field of the packet, XImtool doesn't. This + is also what IRAF does so the FEEDBACK unit now also passes in + the fbconfig as well. (2/28/97) + +cdl.c +comm.c + Added debugging output to print each header packet for comm + interface. (2/28/97) + +cdliraf.c + Fixed one bug causing a segvio for odd sized images, fixed another + affecting image with padding in the pixels. (2/27/97) + +examples/display.c + Enabled -fbconfig flag for iraf format (2/27/97) + +cdl.c + Changed a debug print so 'imtdev' isn't printed directly if it's + NULL, causes a segvio on Sol2.5 systems. (2/27/97) + +examples/Imakefile + Needed to add "-lnsl -lsocket" for Solaris linking. (2/27/97) + +Imakefile + Added a "HasSunC" check for Solaris check since the extra flags are + only needed by SunPRO compilers, not GCC. (2/26/97) + +------------------------------------------------------------------------------ +V1.0 Beta released. (2/26/97) diff --git a/vendor/x11iraf/cdl/TODO b/vendor/x11iraf/cdl/TODO new file mode 100644 index 00000000..78db15fd --- /dev/null +++ b/vendor/x11iraf/cdl/TODO @@ -0,0 +1,34 @@ + 2/2/98 + + - Need a better fill area algorithm + - Log scaling seems to be "off" + - Would be nice to be able to create an overlay plane in memory + before display to speed display of a large number of markers. +DONE - Need a tile image procedure? +DONE - selectFB should find the minimal residual size FB rather than + simply the first one larger than the image +DONE - Check for memory leaks +DONE - Write example tasks +DONE - Documentation +DONE - Clean up header files +DONE - Fortran interface +DONE - Clean up procedure decls, find the void procs + - if not doing a scale need to set up a simple type conversion +DONE - be able to rotate text? + - load/save display list procedure? +DONE - SPP interface + - register multiple servers for output? +DONE - fix iraf I/O for V2 image formats +DONE - use better fonts and proportional spacing? +DONE - sub/superscripting, inline font changes +DONE - greek font + - mosaic example has bug with sampling odd sized images +DONE - segvio with missing imtoolrc file + - displaying 32x4 image shows a "fifth" row +DONE - ANSI func prototypes +DONE - polyline width option +DONE - polyline style option +DONE - "hollow" line type to show lines as it crosses intensities + - FITS extension support + - hbar/vbar point types should have complimentary diagonal types + - need better WCS support diff --git a/vendor/x11iraf/cdl/cdl.c b/vendor/x11iraf/cdl/cdl.c new file mode 100644 index 00000000..306b121b --- /dev/null +++ b/vendor/x11iraf/cdl/cdl.c @@ -0,0 +1,1934 @@ +#include +#include +#include +#include +#include +#define CDL_LIBRARY_SOURCE +#define CDL_NEED_COLORMAPS +#include "cdl.h" + + +/* + * CDL -- Client Display Library. This package provides a general interface + * for client applications to do IRAF-like image display and interaction. + * It is layered upon other interfaces for handling basic display, cursor + * and frame buffer operations, and low-level server communications. + * + * cdl = cdl_open (imtdev) + * cdl_displayPix (cdl, pix, nx, ny, bitpix, frame, fbconfig, zscale) + * cdl_readCursor (cdl, sample, &x, &y, &wcs, &key) + * cdl_setCursor (cdl, x, y, wcs) + * cdl_clearFrame (cdl) + * cdl_close (cdl) + * + * cdl_displayIRAF (cdl, fname, band, frame, fbconfig, zscale) + * cdl_isIRAF (fname) + * cdl_readIRAF (fname, band, &pix, &nx, &ny, &bitpix, title); + * + * cdl_displayFITS (cdl, fname, frame, fbconfig, zscale) + * cdl_isFITS (fname) + * cdl_readFITS (fname, &pix, &nx, &ny, &bitpix, title); + * + * cdl_computeZscale (cdl, pix, nx, ny, bitpix, &z1, &z2) + * cdl_zscaleImage (cdl, &pix, nx, ny, bitpix, z1, z2) + * + * cdl_printPix (cdl, cmd, pix, nx, ny, annotate) + * cdl_printPixToFile (cdl, fname, pix, nx, ny, annotate) + * + * cdl_readImage (cdl, &pix, &nx, &ny) + * cdl_readFrameBuffer (cdl, &pix, &nx, &ny) + * cdl_readSubRaster (cdl, lx, ly, nx, ny, &pix) + * cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix) + * + * cdl_selectFB (cdl, nx, ny, &fb, &fb_w, &fb_h, &nframes, reset) + * cdl_setFBConfig (cdl, configno) + * cdl_getFBConfig (cdl, &configno, &w, &h, &nframes) + * cdl_lookupFBSize (cdl, configno, &w, &h, &nframes) + * + * cdl_[set|get]WCS (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) + * cdl_[set|get]Mapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) + * cdl_queryMap (cdl, wcs, region, sx,sy,snx,sny, + * dx,dy,dnx,dny, objref) + * + * cdl_[set|get]Frame (cdl, frame) + * cdl_[set|get]ZTrans (cdl, ztrans) + * cdl_[set|get]ZScale (cdl, z1, z2) + * cdl_[set|get]Sample (cdl, nsample) + * cdl_[set|get]SampleLines (cdl, nlines) + * cdl_[set|get]Contrast (cdl, contrast) + * cdl_[set|get]Name (cdl, imname) + * cdl_[set|get]Title (cdl, imtitle) + * + * + * GRAPHICS OVERLAY ROUTINES: + * -------------------------- + * cdl_mapFrame (cdl, frame) + * cdl_markPoint (cdl, x, y, number, size, type, color) + * cdl_markLine (cdl, xs, ys, xe, ye, color) + * cdl_markBox (cdl, lx, ly, ux, uy, fill, color) + * cdl_markPolyline (cdl, xpts, ypts, npts, color) + * cdl_markPolygon (cdl, xpts, ypts, npts, fill, color) + * cdl_markCircle (cdl, x, y, radius, fill, color) + * cdl_markCircAnnuli (cdl, x, y, radius, nannuli, sep, color) + * cdl_markEllipse (cdl, x, y, xrad, yrad, ang, fill, color) + * cdl_markEllipAnnuli (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) + * cdl_markText (cdl, x, y, str, size, angle, color) + * + * cdl_setFont (cdl, type) + * + * cdl_deleteMark (cdl, x, y) + * cdl_clearOverlay (cdl) + * cdl_redrawOverlay (cdl) + * + * + * Client applications begin with a cdl_open() call to initialize the + * interface. The "imtdev" argument is used to specify a connection at device + * open time, or if NULL the procedure will attempt to first connect on a unix + * socket or fifo pipe if that fails. The syntax for the imtdev argument is + * as follows: + * :
+ * + * where is one of "inet" (internet tcp/ip socket), "unix" (unix + * domain socket) or "fifo" (named pipe). The form of the address depends + * upon the domain, see the IMD interface code comments or documentation + * for examples. + * + * The library assumes a logical coordinate system that has the image or + * raster origin in the lower-left corner. All I/O routines should be passed + * or will return a pixel pointer set to the LL corner of the raster, all + * cursor positions will similarly use this coordinate system. Initially the + * [0,0] origin is defined as the LL of the frame buffer, this will remain + * the case until the WCS is redefined either explicitly through a cdl_setWCS() + * call or by using one of the high level cdl_display*() procedures to display + * an image smaller that the current frame buffer. Applications wishing to + * retain this initial origin or those wanting to explicitly place the image + * in the frame buffer should use the cdl_writeSubRaster() for display. This + * is to allow cursor and subraster positions to be specified in image coord- + * inates more easily. Negative positions are allowed and will either refer + * to empty pixels if the frame buffer is larger than the image, or pixels + * outside the frame buffer boundaries. Raster I/O requests will be clipped + * to the frame buffer endpoints, a request completely outside the frame buffer + * is an error. + * + * The high-level display routines cdl_displayIRAF() and cdl_displayFITS() + * can be used to display images directly by name. A WCS will automatically + * be defined for each image after the optional zscaling hass been computed. + * Applications wishing to define their own WCS need to call cdl_setWCS() + * after the display call to redefine the default WCS. + */ + +/* Function prototypes */ +#ifdef __STDC__ +#include +#endif + +#ifdef ANSI_FUNC + +void cdl_zscale(uchar *im, int nx, int ny, int bitpix, float *z1, float *z2, float contrast, int opt_size, int len_stdline); +int cdl_freeDisplayList(CDLPtr cdl, MarkerPtr head); + +extern char *mktemp(char *template); +extern int system(const char *cmd); +extern void bcopy(char *b1, char *b2, int length); + +#endif + +/* Display list declarations. We keep a separate list for each frame that + * is freed whenever a new image is displayed. The list is maintained as + * a doubly-linked list of Marker structs. + */ +extern MarkerPtr DLHead[MAX_FRAMES]; /* diplay list head */ +extern MarkerPtr DLTail[MAX_FRAMES]; /* diplay list tail */ + + +int cdl_debug = 0; + +static void cdl_applyZscale(), cdl_flip(); + + +/* CDL_OPEN -- Open and initialize the CDL package. + */ + +#ifdef ANSI_FUNC + +CDLPtr +cdl_open ( + char *imtdev /* connection device */ +) +#else + +CDLPtr +cdl_open (imtdev) +char *imtdev; /* connection device */ +#endif +{ + register int i; + CDLPtr cdl; + IMDPtr imd_open(); + + /* If the debug flag isn't set in the code, see if it's set in the + * runtime environment. + */ + if (cdl_debug == 0) { + if (getenv("CDL_DEBUG") != NULL) + cdl_debug = atoi(getenv("CDL_DEBUG")); + else + cdl_debug = 0; + cdl_setDebug (cdl_debug); + } + + if (cdl_debug) + printf ("%s\n[cdl_open] imtdev='%s'\n", CDL_VERSION, + (imtdev ? imtdev : "")); + + /* Allocate the cdl structure. */ + cdl = (struct CDL *) calloc (1, sizeof (struct CDL)); + + /* Open the connection to the server. */ + cdl->imd = imd_open ((imtdev == NULL) ? getenv("IMTDEV") : imtdev); + if (cdl->imd == (IMDPtr) NULL) { + free ((char *)cdl); + return (NULL); + } + + /* Initialize the CDL structure. */ + cdl->frame = 1; + cdl->fbconfig = 1; + cdl->fbwidth = 512; + cdl->fbheight = 512; + cdl->fbnf = 2; + cdl->im_nx = 512; + cdl->im_ny = 512; + + cdl->contrast = DEF_CONTRAST; + cdl->nsample = DEF_NSAMPLE; + cdl->nsamplines = DEF_NSAMPLINES; + + cdl->font = F_ROMAN; + cdl->textwidth = 1; + cdl->linewidth = 1; + cdl->linestyle = L_SOLID; + + /* Initialize a WCS. */ + cdl->a = 1.0; + cdl->b = 0.0; + cdl->c = 0.0; + cdl->d = -1.0; + cdl->tx = 1.0; /* default for 512x512 fb */ + cdl->ty = 512.0; /* default for 512x512 fb */ + cdl->z1 = 0.0; + cdl->z2 = 255.0; + cdl->ztrans = CDL_LINEAR; + + /* Initialize the mapping. */ + cdl->sx = 1.0; + cdl->sy = 1.0; + cdl->snx = 512; + cdl->sny = 512; + cdl->dx = 0; + cdl->dy = 0; + cdl->dnx = 511; + cdl->dny = 511; + + cdl->iis_version = cdl->imd->iis_version; + cdl->iis_valid = cdl->imd->iis_valid; + + cdl->imname = (char *) calloc (SZ_NAME, sizeof(char)); + cdl->imtitle = (char *) calloc (SZ_NAME, sizeof(char)); + cdl->region = (char *) calloc (SZ_NAME, sizeof(char)); + cdl->ref = (char *) calloc (SZ_NAME, sizeof(char)); + + /* Initialize the display list. */ + for (i=0; i < MAX_FRAMES; i++) + DLHead[i] = DLTail[i] = (MarkerPtr) NULL; + + return (cdl); +} + + +/* CDL_DISPLAYPIX -- Display a raw pixel array to the server. Pixels may + * be larger than 8-bits; they will be scaled for display either through + * a simple minmax scaling to 8-bits if zscale=0, or an optimal Z-transform + * will be computed and used if zscale=1. + */ + +#ifdef ANSI_FUNC + +int +cdl_displayPix ( + CDLPtr cdl, /* package ptr */ + uchar *pix, /* pixels to display */ + int nx, + int ny, /* image dimensions */ + int bitpix, /* pixel size */ + int frame, /* display frame */ + int fbconfig, /* frame bvuffer config */ + int zscale /* do zscale of image? */ +) +#else + +int +cdl_displayPix (cdl, pix, nx, ny, bitpix, frame, fbconfig, zscale) +CDLPtr cdl; /* package ptr */ +uchar *pix; /* pixels to display */ +int nx, ny; /* image dimensions */ +int bitpix; /* pixel size */ +int frame; /* display frame */ +int fbconfig; /* frame bvuffer config */ +int zscale; /* do zscale of image? */ +#endif +{ + float z1 = 0.0, z2 = 0.0; + int fb = fbconfig, w, h, nframes; + + if (cdl_debug) + printf ("[cdl_displayPix] %dx%d-%d frame=%d fb=%d zscale=%d\n", + nx, ny, bitpix, frame, fbconfig, zscale); + + /* Sanity check. */ + if (frame < 1 || frame > MAX_FRAMES) { + perror ("cdl_displayPix: invalid frame number"); + return (ERR); + } + + if (zscale) { + /* Compute the optimal zscale values. */ + cdl_computeZscale (cdl, pix, nx, ny, bitpix, &z1, &z2); + cdl_zscaleImage (cdl, &pix, nx, ny, bitpix, z1, z2); + cdl_setZScale (cdl, z1, z2); + cdl->imd->z1 = z1; + cdl->imd->z2 = z2; + } + + /* See if we need to free the display list for the frame. */ + if (DLHead[frame-1] != (MarkerPtr) NULL) + (void) cdl_freeDisplayList (cdl, DLHead[frame-1]); + + /* Do the frame buffer configuration if needed. */ + if (fbconfig == FB_AUTO) { + cdl_selectFB (cdl, nx, ny, &fb, &w, &h, &nframes, True); + } else if (fbconfig != cdl->fbconfig) { + cdl_setFBConfig (cdl, fbconfig); + fb = max (1, fbconfig); + } + + cdl->frame = frame; + cdl->im_nx = nx; + cdl->im_ny = ny; + + return (imd_displayImage (cdl->imd, pix, nx, ny, frame, fb, 1)); +} + + +/* CDL_READCURSOR -- Read the current cursor position. If sample is defined + * logical cursor position will be sampled and returned immediately, otherwise + * the server will block until a key is hit and we return that value as well. + */ + +#ifdef ANSI_FUNC + +char +cdl_readCursor ( + CDLPtr cdl, /* package ptr */ + int sample, /* wait for keystroke? */ + float *x, + float *y, /* position (output) */ + int *wcs, /* WCS */ + char *key /* keystroke (output) */ +) +#else + +char +cdl_readCursor (cdl, sample, x, y, wcs, key) +CDLPtr cdl; /* package ptr */ +int sample; /* wait for keystroke? */ +float *x, *y; /* position (output) */ +int *wcs; /* WCS */ +char *key; /* keystroke (output) */ +#endif +{ + int status; + + if (cdl_debug) + printf ("[cdl_readCursor]\n"); + + status = imd_readCursor (cdl->imd, sample, x, y, wcs, key); + return (*key); +} + + +/* CDL_SETCURSOR -- Set the current logical cursor position. If 'wcs' is + * non-zero the cursor position is assumed to be defined in terms of the + * current image WCS, otherwise it is in frame buffer coordinates. + */ + +#ifdef ANSI_FUNC + +int +cdl_setCursor ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* position */ + int wcs /* cursor wcs */ +) +#else + +int +cdl_setCursor (cdl, x, y, wcs) +CDLPtr cdl; /* package ptr */ +int x, y; /* position */ +int wcs; /* cursor wcs */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setCursor] x=%d y=%d wcs=%d\n", x, y, wcs); + + return (imd_setCursor (cdl->imd, x, y, wcs)); +} + + +/* CDL_SETWCS -- Set the WCS of the screen. The WCS is passed in a string + * defined as: + * Image_Name_String\n a b c d tx ty z1 z2 zt + * where: + * X' = a*X + c*Y + tx + * Y' = b*X + d*Y + ty + * + * z1 is the minimum pixel value, z2 is the maximum pixel value, zt + * defines the type of transformation to use. + */ + +#ifdef ANSI_FUNC + +int cdl_setWCS ( + CDLPtr cdl, /* package ptr */ + char *imname, /* name string */ + char *imtitle, /* title string */ + float a, + float b, + float c, + float d, /* WCS values */ + float tx, + float ty, /* translation */ + float z1, + float z2, /* zscale values */ + int zt /* transformation type */ +) +#else + +int +cdl_setWCS (cdl, imname, imtitle, a, b, c, d, tx, ty, z1, z2, zt) +CDLPtr cdl; /* package ptr */ +char *imname; /* name string */ +char *imtitle; /* title string */ +float a, b, c, d; /* WCS values */ +float tx, ty; /* translation */ +float z1, z2; /* zscale values */ +int zt; /* transformation type */ +#endif +{ + int status = 0; + + + if (cdl_debug) { + printf ("[cdl_setWCS] name='%s' title='%s'\n", (imname?imname:""), + (imtitle?imtitle:"")); + printf ("\ta=%g b=%g c=%g d=%g tx=%g ty=%g z1=%g z2=%g zt=%d\n", + a, b, c, d, tx, ty, z1, z2, zt); + } + + strcpy (cdl->imname, (imname ? imname : "")); + strcpy (cdl->imtitle, (imtitle ? imtitle : "")); + cdl->a = a; + cdl->b = b; + cdl->c = c; + cdl->d = d; + cdl->tx = tx; + cdl->ty = ty; + cdl->z1 = z1; + cdl->z2 = z2; + cdl->ztrans = zt; + + /* Send the WCS. */ + status = imd_setWCS (cdl->imd, imname, imtitle, a, b, c, d, tx, ty, + z1, z2, zt); + + /* Invalidate the mapping once it's been sent. */ + cdl->iis_valid = 0; + + return (status); +} + + +/* CDL_GETWCS -- Get the current display frame WCS information. + */ + +#ifdef ANSI_FUNC + +int +cdl_getWCS ( + CDLPtr cdl, /* package ptr */ + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt /* transformation type */ +) +#else + +int +cdl_getWCS (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +CDLPtr cdl; /* package ptr */ +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +#endif +{ + int wcs = 0; /* get the frame WCS */ + int status = imd_getWCS (cdl->imd, wcs, name, title, a, b, c, d, + tx, ty, z1, z2, zt); + + cdl->iis_valid = cdl->imd->iis_valid; + + if (cdl_debug) { + printf ("[cdl_getWCS] name='%s' title='%s'\n", (name ? name : ""), + (title ? title : "")); + printf ("\ta=%g b=%g c=%g d=%g tx=%g ty=%g z1=%g z2=%g zt=%d\n", + *a, *b, *c, *d, *tx, *ty, *z1, *z2, *zt); + } + + return (status); +} + + +/* CDL_SETMAPPING -- Set the mapping information to be sent with the next + * cdl_setWcs() call. + */ +#ifdef ANSI_FUNC + +int +cdl_setMapping ( + CDLPtr cdl, /* package ptr */ + char *region, /* region name */ + float sx, /* source rect */ + float sy, + int snx, /* source extent */ + int sny, + int dx, /* dest rect */ + int dy, + int dnx, /* dest extent */ + int dny, + char *ref /* reference name */ +) +#else + +int +cdl_setMapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +CDLPtr cdl; /* package ptr */ +char *region; /* region name */ +float sx, sy; /* source rect */ +int snx, sny; /* source extent */ +int dx, dy; /* dest rect */ +int dnx, dny; /* dest extent */ +char *ref; /* reference name */ +#endif +{ + if (cdl_debug) { + printf ("[cdl_setMapping] region='%s' ref='%s'\n", + (region ? region : ""), (ref ? ref : "")); + printf ("\tsrc = %g,%g,%d,%d dest = %d,%d,%d,%d\n", + sx, sy, snx, sny, dx, dy, dnx, dny); + } + + strcpy (cdl->region, (region ? region : "")); + strcpy (cdl->ref, (ref ? ref : "")); + cdl->sx = sx; + cdl->sy = sy; + cdl->snx = snx; + cdl->sny = sny; + cdl->dx = dx; + cdl->dy = dy; + cdl->dnx = dnx; + cdl->dny = dny; + + return ((cdl->iis_valid = imd_setMapping (cdl->imd, + region, sx,sy,snx,sny, dx,dy,dnx,dny, ref))); +} + + +/* CDL_GETMAPPING -- Get the mapping information returned with the last + * cdl_getWcs() call. + */ +#ifdef ANSI_FUNC +int +cdl_getMapping ( + CDLPtr cdl, /* package ptr */ + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *ref /* reference name */ +) + +#else +int +cdl_getMapping (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +CDLPtr cdl; /* package ptr */ +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *ref; /* reference name */ +#endif +{ + int + status = imd_getMapping (cdl->imd, region, + sx,sy,snx,sny, dx,dy,dnx,dny, ref); + + if (cdl_debug) { + printf ("[cdl_getMapping] region='%s' ref='%s'\n", + (region ? region : ""), (ref ? ref : "")); + printf ("\tsrc = %g,%g,%d,%d dest = %d,%d,%d,%d\n", + *sx, *sy, *snx, *sny, *dx, *dy, *dnx, *dny); + } + + return (status); +} + + +/* CDL_QUERYMAP -- Query a mapping given the wcs number. + */ +#ifdef ANSI_FUNC + +int +cdl_queryMap ( + CDLPtr cdl, /* package ptr */ + int wcs, /* requested wcs number */ + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *objref /* reference name */ +) +#else + +int +cdl_queryMap (cdl, wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref) +CDLPtr cdl; /* package ptr */ +int wcs; /* requested wcs number */ +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *objref; /* reference name */ +#endif +{ + float a, b, c, d, tx, ty, z1, z2; + int zt; + char name[256], title[256]; + int wcs_status = ERR; + int frame = wcs / 100; + + + if (cdl->iis_version > 0) { + /* Do a WCS query so we get the requested mapping. */ + wcs_status = imd_getWCS (cdl->imd, wcs, name, title, + &a, &b, &c, &d, &tx, &ty, &z1, &z2, &zt); + + /* What we really want is the mapping info for the WCS */ + wcs_status = cdl_getMapping (cdl, region, sx,sy,snx,sny, + dx,dy,dnx,dny, objref); + + if (cdl_debug) { + printf ("[cdl_queryMap] wcs=%d name='%s' title='%s'\n", + wcs, (name ? name : ""), (title ? title : "")); + printf ("\ta=%g b=%g c=%g d=%g tx=%g ty=%g z1=%g z2=%g zt=%d\n", + a, b, c, d, tx, ty, z1, z2, zt); + printf ("\tregion='%s' ref='%s'\n", + (region ? region : ""), (objref ? objref : "")); + printf ("\tsrc = %g,%g,%d,%d dest = %d,%d,%d,%d\n", + sx, sy, snx, sny, dx, dy, dnx, dny); + } + } + + return (wcs_status); +} + + + +/* CDL_CLEARFRAME -- Erase the current display frame. + */ + +#ifdef ANSI_FUNC + +int +cdl_clearFrame ( + CDLPtr cdl /* package ptr */ +) +#else + +int +cdl_clearFrame (cdl) +CDLPtr cdl; /* package ptr */ +#endif +{ + if (cdl_debug) + printf ("[cdl_clearFrame]\n"); + + return (imd_clearFrame (cdl->imd)); +} + + +/* CDL_SELECTFB -- Select a frame buffer large enough to contain an image + * of the given size. Instead of finding jsut the first buffer large + * enough to hold the image look for one with minimal edge space. + */ + +#ifdef ANSI_FUNC + +void +cdl_selectFB ( + CDLPtr cdl, /* package ptr */ + int nx, + int ny, /* image size */ + int *fb, /* frame buffer */ + int *w, + int *h, /* frame size */ + int *nf, /* number of frames */ + int reset /* reset after select */ +) +#else + +void +cdl_selectFB (cdl, nx, ny, fb, w, h, nf, reset) +CDLPtr cdl; /* package ptr */ +int nx, ny; /* image size */ +int *fb; /* frame buffer */ +int *w, *h; /* frame size */ +int *nf; /* number of frames */ +int reset; /* reset after select */ +#endif +{ + register int i, edges, mintab = -1, tmin = 100000; + FBTab tab; + + if (cdl_debug) + printf ("[cdl_selectFb] nx=%d ny=%d ", nx, ny); + + for (i=0; i < MAX_FBCONFIG; i++) { + tab = *cdl->imd->fbtab[i]; + if (tab.width == nx && tab.height == ny) { + /* Get an exact match first. */ + tab = *cdl->imd->fbtab[i]; + goto found; + + } else if (tab.width >= nx && tab.height >= ny) { + /* Look for match with smallest padding. */ + edges = tab.width - nx + tab.height - ny; + if (edges < tmin) { + tmin = edges; + mintab = i; + } + } + } + if (mintab >= 0) { + tab = *cdl->imd->fbtab[mintab]; + goto found; + } + + /* Couldn't find one, punt and use the default. */ + fprintf (stderr, + "Warning: cannot find adequate frame buffer, using default.\n"); + tab = *cdl->imd->fbtab[0]; +found: + *fb = tab.config; + *w = tab.width; + *h = tab.height; + *nf = tab.nframes; + if (reset && cdl->fbconfig != *fb) + cdl_setFBConfig (cdl, *fb); + + if (cdl_debug) + printf ("-> fb=%d w=%d h=%d nf=%d\n", *fb, *w, *h, *nf); +} + + +/* CDL_CLOSE -- Close the CDL package descriptor. + */ + +#ifdef ANSI_FUNC + +void +cdl_close ( + CDLPtr cdl /* package ptr */ +) +#else + +void +cdl_close (cdl) +CDLPtr cdl; /* package ptr */ +#endif +{ + register int i; + + if (cdl_debug) + printf ("[cdl_close]\n"); + + for (i=0; i < MAX_FRAMES; i++) + if (DLHead[i] != (MarkerPtr) NULL) + cdl_freeDisplayList (cdl, DLHead[i]); + + free ((char *) cdl->imname); + free ((char *) cdl->imtitle); + free ((char *) cdl->region); + free ((char *) cdl->ref); + + imd_close (cdl->imd); + free ((CDLPtr) cdl); +} + + + +/* CDL_READIMAGE -- Read the currently displayed image and return a pointer to + * the array and it's dimensions. Since we know where the image was written + * in the frame buffer this is really just a large subregion read. + */ + +#ifdef ANSI_FUNC + +int +cdl_readImage ( + CDLPtr cdl, /* package ptr */ + uchar **pix, /* image pixels (output)*/ + int *nx, + int *ny /* dimensions (output) */ +) +#else + +int +cdl_readImage (cdl, pix, nx, ny) +CDLPtr cdl; /* package ptr */ +uchar **pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +#endif +{ + int status; + + if (*pix == NULL) + *pix = (uchar *) malloc (cdl->im_nx * cdl->im_ny); + + status = imd_readImage (cdl->imd, *pix, nx, ny); + if (cdl_debug) + printf ("[cdl_readImage] %dx%d pixels\n", *nx, *ny); + + return (status); +} + + +/* CDL_READFRAMEBUFFER -- Read the contents of the entire frame buffer and + * return a pointer to the array and it's dimensions. + */ + +#ifdef ANSI_FUNC + +int +cdl_readFrameBuffer ( + CDLPtr cdl, /* package ptr */ + uchar **pix, /* image pixels (output)*/ + int *nx, + int *ny /* dimensions (output) */ +) +#else + +int +cdl_readFrameBuffer (cdl, pix, nx, ny) +CDLPtr cdl; /* package ptr */ +uchar **pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +#endif +{ + int status; + + if (*pix == NULL) + *pix = (uchar *) malloc (cdl->fbwidth * cdl->fbheight); + + status = imd_readFrameBuffer (cdl->imd, *pix, nx, ny); + if (cdl_debug) + printf ("[cdl_readFrameBuffer] %dx%d pixels\n", *nx, *ny); + + return (status); +} + + +/* CDL_COMPUTEZSCALE -- Compute the optimal z1/z2 values for an array. We + * don't transform the pixels, just compute the values. + */ + +#ifdef ANSI_FUNC + +void +cdl_computeZscale ( + CDLPtr cdl, /* package ptr */ + uchar *pix, /* data to be sampled */ + int nx, + int ny, /* image dimensions */ + int bitpix, /* bits per pixel */ + float *z1, + float *z2 /* min/max zscale values*/ +) +#else + +void +cdl_computeZscale (cdl, pix, nx, ny, bitpix, z1, z2) +CDLPtr cdl; /* package ptr */ +uchar *pix; /* data to be sampled */ +int nx, ny; /* image dimensions */ +int bitpix; /* bits per pixel */ +float *z1, *z2; /* min/max zscale values*/ +#endif +{ + register float np = nx * ny; + + cdl_zscale ((uchar *)pix, + nx, ny, + bitpix, + z1, z2, + cdl->contrast, + cdl->nsample, + MAX(2, + (int)(cdl->nsample / (cdl->nsamplines > 0 ? + cdl->nsamplines : + (int)((float)ny / sqrt(np / (float)cdl->nsample))) ))); + + if (cdl_debug) + printf ("[cdl_computeZscale] %dx%d-%d --> z1=%g z2=%g zt=%d\n", + nx, ny, bitpix, *z1, *z2, cdl->ztrans); +} + + +/* CDL_ZSCALEIMAGE -- Compute the optimal z1/z2 values for an array and then + * scale the pixels. We only compute the scale values if they're not input, + * otherwise we used the values passed in. + */ + +#ifdef ANSI_FUNC + +void +cdl_zscaleImage ( + CDLPtr cdl, /* package ptr */ + uchar **pix, /* data to be sampled */ + int nx, + int ny, /* image dimensions */ + int bitpix, /* bits per pixel */ + float z1, + float z2 /* min/max zscale values*/ +) +#else + +void +cdl_zscaleImage (cdl, pix, nx, ny, bitpix, z1, z2) +CDLPtr cdl; /* package ptr */ +uchar **pix; /* data to be sampled */ +int nx, ny; /* image dimensions */ +int bitpix; /* bits per pixel */ +float z1, z2; /* min/max zscale values*/ +#endif +{ + if (cdl_debug) + printf ("[cdl_zscaleImage]\n"); + + cdl_setZScale (cdl, z1, z2); + cdl_applyZscale (cdl, pix, nx, ny, bitpix); +} + + +/* CDL_PRINTPIX -- Print the given pixels as EPS to the named command. + * We assume that the 'cmd' argument is a unix command string that takes + * input from the stdin. + */ + +#ifdef ANSI_FUNC + +int +cdl_printPix ( + CDLPtr cdl, /* package ptr */ + char *cmd, /* command string */ + uchar *pix, /* pixel array */ + int nx, + int ny, /* image dimensions */ + int annotate /* annotate output? */ +) +#else + +int +cdl_printPix (cdl, cmd, pix, nx, ny, annotate) +CDLPtr cdl; /* package ptr */ +char *cmd; /* command string */ +uchar *pix; /* pixel array */ +int nx, ny; /* image dimensions */ +int annotate; /* annotate output? */ +#endif +{ + FILE *fp; + PSImagePtr psim, eps_init(); + char tmpfile[SZ_NAME], text[SZ_NAME]; + extern char *mktemp(); + extern int system(); + + if (cdl_debug) + printf ("[cdl_printPix] cmd='%s' %dx%d annotate=%d\n", + cmd, nx, ny, annotate); + + /* Open the image pointer each time since we assume it's not going to + * happen too often. + */ + psim = eps_init(); + + /* Print to a printer device. */ + strcpy (tmpfile, "/tmp/cdlXXXXXX"); + if (mktemp(tmpfile) == (char *)NULL) { + eps_close (psim); + return (ERR); + } + + if (!(fp = fopen (tmpfile, "w"))) { + eps_close (psim); + return (ERR); + } + psim->annotate = annotate; + cdl_flip (pix, nx, ny); + eps_setLabel (psim, cdl->imname); + eps_setCorners (psim, 0, 0, nx, ny); + eps_setColorType (psim, EPS_PSEUDOCOLOR); + eps_setCmap (psim, cmap_r, cmap_g, cmap_b, 256); + eps_print (psim, fp, pix, nx, ny, 8, 0); + + sprintf (text, "cat %s | %s", tmpfile, (cmd ? cmd : "lpr")); + (void)system (text); /* dispose to printer */ + unlink (tmpfile); /* delete tmp file */ + + /* Clean up. */ + fclose (fp); + eps_close (psim); + return (OK); +} + + +/* CDL_PRINTPIXTOFILE -- Print the given pixels as EPS to the named file. + */ + +#ifdef ANSI_FUNC + +int +cdl_printPixToFile ( + CDLPtr cdl, /* package ptr */ + char *fname, /* filename */ + uchar *pix, /* pixel array */ + int nx, + int ny, /* image dimensions */ + int annotate /* annotate output? */ +) +#else + +int +cdl_printPixToFile (cdl, fname, pix, nx, ny, annotate) +CDLPtr cdl; /* package ptr */ +char *fname; /* filename */ +uchar *pix; /* pixel array */ +int nx, ny; /* image dimensions */ +int annotate; /* annotate output? */ +#endif +{ + FILE *fp; + PSImagePtr psim, eps_init(); + + if (cdl_debug) + printf ("[cdl_printPixToFile] fname='%s' %dx%d annotate=%d\n", + fname, nx, ny, annotate); + + /* Open the image pointer each time since we assume it's not going to + * happen too often. + */ + psim = eps_init(); + + /* Dump the EPS to the file. */ + if (access (fname, F_OK) < 0) { + if ((fp = fopen (fname, "w"))) { + eps_setLabel (psim, cdl->imname); + psim->annotate = annotate; + cdl_flip (pix, nx, ny); + eps_setColorType (psim, EPS_PSEUDOCOLOR); + eps_setCmap (psim, cmap_r, cmap_g, cmap_b, 256); + eps_setCorners (psim, 0, 0, nx, ny); + eps_print (psim, fp, pix, nx, nx, 8, 0); + fclose (fp); + } else { + fprintf (stderr, "Could not open file %s", fname); + eps_close (psim); + return (ERR); + } + } + + eps_close (psim); + return (OK); +} + + + +/* CDL_READSUBRASTER -- Read a rectangular region of the frame buffer. + */ + +#ifdef ANSI_FUNC + +int +cdl_readSubRaster ( + CDLPtr cdl, /* package ptr */ + int lx, + int ly, /* region corner */ + int nx, + int ny, /* dimensions */ + uchar **pix /* image pixels (output)*/ +) +#else + +int +cdl_readSubRaster (cdl, lx, ly, nx, ny, pix) +CDLPtr cdl; /* package ptr */ +int lx, ly; /* region corner */ +int nx, ny; /* dimensions */ +uchar **pix; /* image pixels (output)*/ +#endif +{ + register int llx, lly; + + if (*pix == NULL) + *pix = (uchar *) malloc (nx * ny); + + llx = lx + (cdl->fbwidth / 2) - (cdl->im_nx / 2); + lly = ly + cdl->fbheight - ((cdl->fbheight / 2) + (cdl->im_ny / 2)); + + if (cdl_debug) + printf ("[cdl_readSubRaster] %dx%d at [%d,%d] offset [%d,%d]\n", + nx, ny, lx, ly, llx, lly); + + return (imd_readSubRaster (cdl->imd, lx, ly, nx, ny, *pix)); +} + + +/* CDL_WRITESUBRASTER -- Write a rectangular region of the frame buffer. + */ + +#ifdef ANSI_FUNC + +int +cdl_writeSubRaster ( + CDLPtr cdl, /* package ptr */ + int lx, + int ly, /* region corner */ + int nx, + int ny, /* dimensions */ + uchar *pix /* subraster pixels */ +) +#else + +int +cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix) +CDLPtr cdl; /* package ptr */ +int lx, ly; /* region corner */ +int nx, ny; /* dimensions */ +uchar *pix; /* subraster pixels */ +#endif +{ + if (cdl_debug) + printf ("[cdl_writeSubRaster] %dx%d at [%d,%d]\n", + nx, ny, lx, ly); + + return (imd_writeSubRaster (cdl->imd, lx, ly, nx, ny, pix)); +} + + + +/* CDL_SETFBCONFIG -- Set the frame buffer configuration number. + */ + +#ifdef ANSI_FUNC + +void +cdl_setFBConfig ( + CDLPtr cdl, /* package ptr */ + int configno /* fb config number */ +) +#else + +void +cdl_setFBConfig (cdl, configno) +CDLPtr cdl; /* package ptr */ +int configno; /* fb config number */ +#endif +{ + int cfg = max (1, configno); + + if (cdl_debug) + printf ("[cdl_setFBConfig] configno=%d\n", configno); + + cdl->fbconfig = cfg; + cdl->fbwidth = cdl->imd->fbtab[cfg-1]->width; + cdl->fbheight = cdl->imd->fbtab[cfg-1]->height; + cdl->fbnf = cdl->imd->fbtab[cfg-1]->nframes; + (void) imd_setFBConfig (cdl->imd, cdl->fbconfig); +} + + +/* CDL_GETFBCONFIG -- Get the frame buffer configuration number. + */ + +#ifdef ANSI_FUNC + +void +cdl_getFBConfig ( + CDLPtr cdl, /* package ptr */ + int *configno, /* fb config number */ + int *w, + int *h, /* fb frame size */ + int *nframes /* number of frames */ +) +#else + +void +cdl_getFBConfig (cdl, configno, w, h, nframes) +CDLPtr cdl; /* package ptr */ +int *configno; /* fb config number */ +int *w, *h; /* fb frame size */ +int *nframes; /* number of frames */ +#endif +{ + *configno = cdl->fbconfig; + *w = cdl->fbwidth; + *h = cdl->fbheight; + *nframes = cdl->fbnf; + + if (cdl_debug) + printf ("[cdl_getFBConfig] configno=%d\n", *configno); +} + + +/* CDL_LOOKUPFBSIZE -- Get the frame buffer dimensions given a config number. + */ + +#ifdef ANSI_FUNC + +void +cdl_lookupFBSize ( + CDLPtr cdl, /* package ptr */ + int configno, /* fb config number */ + int *w, + int *h, /* fb frame size */ + int *nf /* number of frames */ +) +#else + +void +cdl_lookupFBSize (cdl, configno, w, h, nf) +CDLPtr cdl; /* package ptr */ +int configno; /* fb config number */ +int *w, *h; /* fb frame size */ +int *nf; /* number of frames */ +#endif +{ + *w = cdl->imd->fbtab[configno-1]->width; + *h = cdl->imd->fbtab[configno-1]->height; + *nf = cdl->imd->fbtab[configno-1]->nframes; + + if (cdl_debug) { + printf ("[cdl_lookupFBSize] configno=%d size=%dx%d\n", configno, + *w, *h); + } +} + + + +/* CDL_SETFRAME -- Set the current display frame. + */ + +#ifdef ANSI_FUNC + +void +cdl_setFrame ( + CDLPtr cdl, /* package ptr */ + int frame /* frame number */ +) +#else + +void +cdl_setFrame (cdl, frame) +CDLPtr cdl; /* package ptr */ +int frame; /* frame number */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setFrame] frame=%d\n", frame); + + /* Sanity check. */ + if (frame < 1 || frame > MAX_FRAMES) { + perror ("cdl_setFrame: invalid frame number - resetting."); + } + + cdl->frame = max(1,min(MAX_FRAMES,frame)); + (void) imd_setFrame (cdl->imd, cdl->frame); +} + + +/* CDL_SETZTRANS -- Set the current zscale transform parameters. + */ + +#ifdef ANSI_FUNC + +void +cdl_setZTrans ( + CDLPtr cdl, /* package ptr */ + int ztrans /* z-transform type */ +) +#else + +void +cdl_setZTrans (cdl, ztrans) +CDLPtr cdl; /* package ptr */ +int ztrans; /* z-transform type */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setZTrans] zt=%d\n", ztrans); + + cdl->ztrans = ztrans; +} + + +/* CDL_SETZSCLAE -- Set the current zscale transform parameters. + */ + +#ifdef ANSI_FUNC + +void +cdl_setZScale ( + CDLPtr cdl, /* package ptr */ + float z1, + float z2 /* zscale values */ +) +#else + +void +cdl_setZScale (cdl, z1, z2) +CDLPtr cdl; /* package ptr */ +float z1, z2; /* zscale values */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setZScale] z1=%g z2=%g\n", z1, z2); + + cdl->z1 = z1; + cdl->z2 = z2; + cdl->imd->z1 = z1; + cdl->imd->z2 = z2; +} + + +/* CDL_SETSAMPLE -- Set the number of zscale sample points to use. + */ + +#define cdl_setNSamples (cdl, ns) cdl_setSample(cdl,ns) +#define cdl_setSamples (cdl, ns) cdl_setSample(cdl,ns) + +#ifdef ANSI_FUNC + +void +cdl_setSample ( + CDLPtr cdl, /* package ptr */ + int nsample /* no. of sample pts */ +) +#else + +void +cdl_setSample (cdl, nsample) +CDLPtr cdl; /* package ptr */ +int nsample; /* no. of sample pts */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setSample] nsample=%d\n", nsample); + + cdl->nsample = MAX(5,nsample); +} + + +/* CDL_SETSAMPLELINES -- Set the number of zscale sample lines to use. + */ + +#ifdef ANSI_FUNC + +void +cdl_setSampleLines ( + CDLPtr cdl, /* package ptr */ + int nlines /* no. of sample lines */ +) +#else + +void +cdl_setSampleLines (cdl, nlines) +CDLPtr cdl; /* package ptr */ +int nlines; /* no. of sample lines */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setSampleLines] nlines=%d\n", nlines); + + cdl->nsamplines = MAX(1,nlines); +} + + +/* CDL_SETCONTRAST -- Set the zscale contrast value. + */ + +#ifdef ANSI_FUNC + +void +cdl_setContrast ( + CDLPtr cdl, /* package ptr */ + float contrast /* contrast value */ +) +#else + +void +cdl_setContrast (cdl, contrast) +CDLPtr cdl; /* package ptr */ +float contrast; /* contrast value */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setContrast] contrast=%g\n", contrast); + + cdl->contrast = contrast; +} + + +/* CDL_SETNAME -- Set the image name for the WCS string. + */ + +#ifdef ANSI_FUNC + +void +cdl_setName ( + CDLPtr cdl, /* package ptr */ + char *imname /* image name */ +) +#else + +void +cdl_setName (cdl, imname) +CDLPtr cdl; /* package ptr */ +char *imname; /* image name */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setName] name='%s'\n", (imname?imname:"")); + + (void) imd_setName(cdl->imd, imname); +} + + +/* CDL_SETTITLE -- Set the image title for the WCS string. + */ + +#ifdef ANSI_FUNC + +void +cdl_setTitle ( + CDLPtr cdl, /* package ptr */ + char *imtitle /* image title */ +) +#else + +void +cdl_setTitle (cdl, imtitle) +CDLPtr cdl; /* package ptr */ +char *imtitle; /* image title */ +#endif +{ + if (cdl_debug) + printf ("[cdl_setTitle] title='%s'\n", (imtitle?imtitle:"")); + + (void) imd_setTitle(cdl->imd, imtitle); +} + + +/* CDL_GETFRAME -- Get the current display frame. + */ + +#ifdef ANSI_FUNC + +void +cdl_getFrame ( + CDLPtr cdl, /* package ptr */ + int *frame /* frame number */ +) +#else + +void +cdl_getFrame (cdl, frame) +CDLPtr cdl; /* package ptr */ +int *frame; /* frame number */ +#endif +{ + float x, y; + int wcs; + char key; + + (void) imd_readCursor (cdl->imd, 1, &x, &y, &wcs, &key); + *frame = (int) (wcs / 100); + + if (*frame == 0) + *frame = cdl->frame; + + if (cdl_debug) + printf ("[cdl_getFrame] frame=%d\n", *frame); +} + + +/* CDL_GETZTRANS -- Get the current zscale transform parameters. + */ + +#ifdef ANSI_FUNC + +void +cdl_getZTrans ( + CDLPtr cdl, /* package ptr */ + int *ztrans /* z-transform type */ +) +#else + +void +cdl_getZTrans (cdl, ztrans) +CDLPtr cdl; /* package ptr */ +int *ztrans; /* z-transform type */ +#endif +{ + *ztrans = cdl->ztrans; + + if (cdl_debug) + printf ("[cdl_getZTrans] zt=%d\n", *ztrans); +} + + +/* CDL_GETZTRANS -- Get the current zscale transform parameters. + */ + +#ifdef ANSI_FUNC + +void +cdl_getZScale ( + CDLPtr cdl, /* package ptr */ + float *z1, + float *z2 /* zscale values */ +) +#else + +void +cdl_getZScale (cdl, z1, z2) +CDLPtr cdl; /* package ptr */ +float *z1, *z2; /* zscale values */ +#endif +{ + *z1 = cdl->z1; + *z2 = cdl->z2; + + if (cdl_debug) + printf ("[cdl_getZScale] z1=%g z2=%g\n", *z1, *z2); +} + + +/* CDL_GETSAMPLE -- Get the number of zscale sample points to use. + */ + +#ifdef ANSI_FUNC + +void +cdl_getSample ( + CDLPtr cdl, /* package ptr */ + int *nsample /* no. of sample pts */ +) +#else + +void +cdl_getSample (cdl, nsample) +CDLPtr cdl; /* package ptr */ +int *nsample; /* no. of sample pts */ +#endif +{ + *nsample = cdl->nsample; + + if (cdl_debug) + printf ("[cdl_getSample] nsample=%d\n", *nsample); +} + + +/* CDL_GETSAMPLELINES -- Get the number of zscale sample lines to use. + */ + +#ifdef ANSI_FUNC + +void +cdl_getSampleLines ( + CDLPtr cdl, /* package ptr */ + int *nlines /* no. of sample lines */ +) +#else + +void +cdl_getSampleLines (cdl, nlines) +CDLPtr cdl; /* package ptr */ +int *nlines; /* no. of sample lines */ +#endif +{ + *nlines = cdl->nsamplines; + + if (cdl_debug) + printf ("[cdl_getSampleLines] nlines=%d\n", *nlines); +} + + +/* CDL_GETCONTRAST -- Get the zscale contrast value. + */ + +#ifdef ANSI_FUNC + +void +cdl_getContrast ( + CDLPtr cdl, /* package ptr */ + float *contrast /* contrast value */ +) +#else + +void +cdl_getContrast (cdl, contrast) +CDLPtr cdl; /* package ptr */ +float *contrast; /* contrast value */ +#endif +{ + *contrast = cdl->contrast; + + if (cdl_debug) + printf ("[cdl_getContrast] contrast=%g\n", *contrast); +} + + +/* CDL_GETNAME -- Get the image name for the WCS string. + */ + +#ifdef ANSI_FUNC + +void +cdl_getName ( + CDLPtr cdl, /* package ptr */ + char *imname /* image name */ +) +#else + +void +cdl_getName (cdl, imname) +CDLPtr cdl; /* package ptr */ +char *imname; /* image name */ +#endif +{ + if (imname) + strcpy (imname, cdl->imname); + + if (cdl_debug) + printf ("[cdl_setName] name='%s'\n", (imname?imname:"")); +} + + +/* CDL_GETTITLE -- Get the image title for the WCS string. + */ + +#ifdef ANSI_FUNC + +void +cdl_getTitle ( + CDLPtr cdl, /* package ptr */ + char *imtitle /* image title */ +) +#else + +void +cdl_getTitle (cdl, imtitle) +CDLPtr cdl; /* package ptr */ +char *imtitle; /* image title */ +#endif +{ + if (imtitle) + strcpy (imtitle, cdl->imtitle); + + if (cdl_debug) + printf ("[cdl_setTitle] title='%s'\n", (imtitle?imtitle:"")); +} + + +/* -------------------- + * PRIVATE PROCEDURES + * ------------------ */ + + + +/* CDL_SETDEBUG -- Set the state of the debug flag. + */ + +#ifdef ANSI_FUNC + +void +cdl_setDebug (int state) +#else + +void +cdl_setDebug (state) +int state; +#endif +{ + cdl_debug = state; + if (state >= 1) + imd_setDebug (state); + if (state >= 2) + com_setDebug (state); +} + + +/* CDL_APPLYZSCALE -- Compute the Zscale transform image given an array of + * raw pixels and image size. We use the z1/z2/ztrans values assumed to be + * previously stored. + */ + +#ifdef ANSI_FUNC + +static void +cdl_applyZscale ( + CDLPtr cdl, /* package ptr */ + uchar **pix, /* input image pixels */ + int nx, + int ny, /* image dimensions */ + int bitpix /* pixel type */ +) +#else + +static void +cdl_applyZscale (cdl, pix, nx, ny, bitpix) +CDLPtr cdl; /* package ptr */ +uchar **pix; /* input image pixels */ +int nx, ny; /* image dimensions */ +int bitpix; /* pixel type */ +#endif +{ + register int i, n = nx * ny, pmin = 1, pmax = 200; + register int smax, smin; + float pval, scale = 0.0, dscale = (200.0 / 3.0); + uchar *outpix ; + float z1, z2; /* zscale values */ + int zt; + extern void bcopy(); + + + if (cdl_debug) + printf ("[cdl_applyZscale] nx=%d by=%d bitpix=%d\n", nx,ny,bitpix); + + /* Move the input array to the output array before zscaling. */ + outpix = (uchar *) malloc (nx * ny); + bcopy ((char *)*pix, (char *)outpix, nx * ny); + + /* Get the zscale transform values. */ + cdl_getZTrans (cdl, &zt); + cdl_getZScale (cdl, &z1, &z2); + smin = (int) z1; + smax = (int) z2; + if (bitpix < 0) + scale = (z2 == z1) ? 0. : 200. / (z2 - z1); + else + scale = (smax == smin) ? 0. : 200. / (z2 - z1); + + + /* Now scale the pixels. */ + if (bitpix == 16) { + register short int *buffer = (short *)(*pix); + + if (zt == CDL_LINEAR) { + for (i=0; i < n; i++) + outpix[i] = max (pmin, min (pmax, + (int)(scale * (float)((int)buffer[i] - smin)) )); + } else if (zt == CDL_LOG) { + scale = (smax == smin) ? 0. : (1000.0 - 1.0) / (z2 - z1); + for (i=0; i < n; i++) { + /* Scale that to the range 1-1000 and take the log. */ + pval = max (1.0,min(1000.0, (scale * (buffer[i] - smin)) )); + pval = log10 (pval); + + /* Now scale back to the display range */ + outpix[i] = (uchar) max (pmin, min (pmax, + (uchar)(dscale * pval) )); + } + } else if (zt == CDL_UNITARY) { + for (i=0; i < n; i++) + outpix[i] = buffer[i]; + } + + } else if (bitpix == 32) { + register int *buffer = (int *)(*pix); + + if (zt == CDL_LINEAR) { + for (i=0; i < n; i++) + outpix[i] = max (pmin, min (pmax, + (int)(scale * (float)((int)buffer[i] - smin)) )); + } else if (zt == CDL_LOG) { + scale = (smax == smin) ? 0. : (1000.0 - 1.0) / (z2 - z1); + for (i=0; i < n; i++) { + /* Scale that to the range 1-1000 and take the log. */ + pval = max (1.0,min(1000.0, (scale * (buffer[i] - smin)) )); + pval = log10 (pval); + + /* Now scale back to the display range */ + outpix[i] = (uchar) max (pmin, min (pmax, + (uchar)(dscale * pval) )); + } + } else if (zt == CDL_UNITARY) { + for (i=0; i < n; i++) + outpix[i] = buffer[i]; + } + + } else if (bitpix == 64) { + register long int *buffer = (long *)(*pix); + + if (zt == CDL_LINEAR) { + for (i=0; i < n; i++) + outpix[i] = max (pmin, min (pmax, + (int)(scale * (float)((int)buffer[i] - smin)) )); + } else if (zt == CDL_LOG) { + scale = (smax == smin) ? 0. : (1000.0 - 1.0) / (z2 - z1); + for (i=0; i < n; i++) { + /* Scale that to the range 1-1000 and take the log. */ + pval = max (1.0,min(1000.0, (scale * (buffer[i] - smin)) )); + pval = log10 (pval); + + /* Now scale back to the display range */ + outpix[i] = (uchar) max (pmin, min (pmax, + (uchar)(dscale * pval) )); + } + } else if (zt == CDL_UNITARY) { + for (i=0; i < n; i++) + outpix[i] = buffer[i]; + } + + } else if (bitpix == -32) { + register float *buffer = (float *)(*pix); + + if (zt == CDL_LINEAR) { + for (i=0; i < n; i++) + outpix[i] = max (pmin, min (pmax, + (int)(scale * (float)((float)buffer[i] - z1)) )); + } else if (zt == CDL_LOG) { + scale = (smax == smin) ? 0. : (1000.0 - 1.0) / (z2 - z1); + for (i=0; i < n; i++) { + /* Scale that to the range 1-1000 and take the log. */ + pval = max (1.0,min(1000.0, (scale * (buffer[i] - z1)) )); + pval = log10 (pval); + + /* Now scale back to the display range */ + outpix[i] = (uchar) max (pmin, min (pmax, + (uchar)(dscale * pval) )); + } + } else if (zt == CDL_UNITARY) { + for (i=0; i < n; i++) + outpix[i] = buffer[i]; + } + + } else if (bitpix == -64) { + register double *buffer = (double *)(*pix); + + if (zt == CDL_LINEAR) { + for (i=0; i < n; i++) + outpix[i] = max (pmin, min (pmax, + (int)(scale * (float)((double)buffer[i] - z1)) )); + } else if (zt == CDL_LOG) { + scale = (smax == smin) ? 0. : (1000.0 - 1.0) / (z2 - z1); + for (i=0; i < n; i++) { + /* Scale that to the range 1-1000 and take the log. */ + pval = max (1.0,min(1000.0, (scale * (buffer[i] - z1)) )); + pval = log10 (pval); + + /* Now scale back to the display range */ + outpix[i] = (uchar) max (pmin, min (pmax, + (uchar)(dscale * pval) )); + } + } else if (zt == CDL_UNITARY) { + for (i=0; i < n; i++) + outpix[i] = buffer[i]; + } + } + + /* Copy the scaled pixel array back to the original raster. We don't + * realloc the pointer in case it's some static array. + */ + bcopy ((char *)outpix, (char *)*pix, n); + + if (cdl_debug) + printf ("[cdl_zscaleImage] %dx%d-%d --> z1=%g z2=%g zt=%d\n", + nx, ny, bitpix, z1, z2, zt); + + free ((char *) outpix); +} + + +/* CDL_FLIP -- Reverse order of lines in image. + */ + +#ifdef ANSI_FUNC + +static void +cdl_flip (uchar *buffer, int nx, int ny) +#else + +static void +cdl_flip (buffer, nx, ny) +uchar *buffer; +int nx; +int ny; +#endif +{ + register int i, j, v; + register uchar *buff1, *buff2; + + for (i = 0; i < ny / 2; i++) { + buff1 = &buffer[i*nx]; + buff2 = &buffer[(ny-1-i)*nx]; + for (j = 0; j < nx; j++) { + v = *buff1; + *(buff1++) = *buff2; + *(buff2++) = v; + } + } +} diff --git a/vendor/x11iraf/cdl/cdl.h b/vendor/x11iraf/cdl/cdl.h new file mode 100644 index 00000000..8abdd8a3 --- /dev/null +++ b/vendor/x11iraf/cdl/cdl.h @@ -0,0 +1,336 @@ +/* + * CDL.H -- Global definitions for the Client Display Library. + */ + +#ifndef _CDL_Defined +#define _CDL_Defined + +#define CDL_VERSION "Client Display Library V1.8 07/28/01" + +/* Declare prototypes if using ANSI C */ +#ifdef CDL_ANSIC +#define ANSI_FUNC +#endif + +#define MAX_FBCONFIG 128 /* max size of FB config table */ +#define MAX_FRAMES 16 /* max frames support by server */ +#define MAX_MAPPINGS 32 /* max image mappings per frame */ +#define DEF_CONTRAST 0.25 /* default zscale contrast */ +#define DEF_NSAMPLE 600 /* default number of samples */ +#define DEF_NSAMPLINES -1 /* default no. of sample lines */ +#define INDEF -999 /* INDEF value flag */ + + +/* Include private definitions when compiling library sources. */ +#ifdef CDL_LIBRARY_SOURCE +#include "eps.h" +#include "cdlP.h" +#endif + +/* Frame buffer selection code. */ +#define FB_AUTO -1 /* autoconfig the frame buffer */ + +/* Types of greyscale transformations. */ +#define CDL_UNITARY 0 /* values map without change */ +#define CDL_LINEAR 1 /* linear mapping */ +#define CDL_LOG 2 /* logarithmic mapping */ + +/* Overlay colors. */ +#define C_BLACK 202 /* Static overlay color defs */ +#define C_WHITE 203 +#define C_RED 204 +#define C_GREEN 205 +#define C_BLUE 206 +#define C_YELLOW 207 +#define C_CYAN 208 +#define C_MAGENTA 209 +#define C_CORAL 210 +#define C_MAROON 211 +#define C_ORANGE 212 +#define C_KHAKI 213 +#define C_ORCHID 214 +#define C_TURQUOISE 215 +#define C_VIOLET 216 +#define C_WHEAT 217 + +#define M_FILL 1 /* Overlay point mark types. */ +#define M_POINT 2 +#define M_BOX 4 +#define M_PLUS 8 +#define M_CROSS 16 +#define M_DIAMOND 32 +#define M_CIRCLE 64 +#define M_STAR 128 +#define M_HLINE 256 +#define M_VLINE 512 +#define M_HBLINE 1024 +#define M_VBLINE 2048 + +#define F_ROMAN 0 /* Font types. */ +#define F_GREEK 1 +#define F_FUTURA 2 +#define F_TIMES 3 +#define F_BOLD 4 + +#define L_SOLID 0 /* Polyline attribute values. */ +#define L_DASHED 1 +#define L_DOTTED 2 +#define L_DOTDASH 3 +#define L_HOLLOW 4 +#define L_SHADOW 5 + + +#define MOD_FAST 1 /* SubRaster display model */ +#define MOD_NORMAL 2 +#define DEF_MODEL MOD_FAST + + +/* Local type definitions. */ +typedef struct CDL *CDLPtr; +typedef struct Marker *MarkerPtr; + + +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + + + +/* The main CDL package structure. + */ +struct CDL { +#ifdef CDL_LIBRARY_SOURCE + IMDPtr imd; /* IMD package pointer */ + int memModel; /* Memory model to use */ +#endif + + int frame; /* display frame number */ + int fbconfig; /* fb config number */ + int fbwidth; /* current FB width */ + int fbheight; /* current FB height */ + int fbnf; /* current FB nframes */ + + float contrast; /* zscale contrast value*/ + int nsample; /* opt. sample points */ + int nsamplines; /* opt. sample lines */ + + int im_nx; /* current image width */ + int im_ny; /* current image height */ + + /* Overlay graphics attributes. */ + int font; /* overlay text font */ + int textwidth; /* text width */ + int linewidth; /* line width */ + int linestyle; /* line style */ + + /* WCS descriptor stuff. */ + char *imname; /* image name */ + char *imtitle; /* image title */ + float a, b, c, d; /* WCS values */ + float tx, ty; /* translation values */ + float z1, z2; /* zscale values */ + int ztrans; /* Z trans type */ + + /* Coordinate mappings on the frame buffer. */ + char *ref; /* img reference */ + char *region; /* region name */ + float sx, sy; /* source rect */ + int snx, sny; + int dx, dy; /* destination rect */ + int dnx, dny; + int iis_version; /* server IIS version */ + int iis_valid; /* valid mapping flag */ +}; + + +/* A element of the display list describing the marker. We throw in the + * kitchen sinke here to cover all possible marker types, in reality only + * a few of these are used for any given marker type. + */ +struct Marker { + short type; /* marker type */ + int x, y; /* center coords */ + int number; /* label a point */ + int pt_type; /* point type */ + int size; /* point marker size */ + int fill; /* fill marker */ + int color; /* marker color */ + int *xp, *yp; /* coords */ + int npts; /* npts in array */ + int radius; /* circle radius */ + int nannuli; /* num of annuli */ + int sep; /* annulus separation */ + int xrad, yrad; /* ellipse axes */ + float ang; /* ellipse rotation */ + float txsize; /* text marker size */ + char *str; /* text marker string */ + int font; /* text font type */ + int textwidth; /* text width */ + int linewidth; /* line width */ + int linestyle; /* line style */ + + int nx, ny; /* marker region size */ + int lx, ly; /* marker LL corner */ + + unsigned char *refpix; /* orig image pixels */ + unsigned char *markpix; /* marked image pixels */ + + MarkerPtr back; /* linked list pointers */ + MarkerPtr next; + int markerID; /* assigned id number */ +}; + + +/* Marker types used internally. */ +#define MK_POINT 0 +#define MK_LINE 1 +#define MK_BOX 2 +#define MK_POLYLINE 3 +#define MK_POLYGON 4 +#define MK_CIRCLE 5 +#define MK_CIRCANN 6 +#define MK_ELLIPSE 7 +#define MK_ELLIPANN 8 +#define MK_TEXT 9 + + +/* Function definitions. */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ANSI_FUNC + +CDLPtr cdl_open(); + +char cdl_readCursor(); + +int cdl_displayPix(), cdl_displayIRAF(), cdl_displayFITS(); +int cdl_isIRAF(), cdl_isFITS(); +int cdl_readIRAF(), cdl_readFITS(), cdl_clearFrame(); +int cdl_readImage(), cdl_readFrameBuffer(), cdl_readSubRaster(); +int cdl_writeSubRaster(), cdl_setCursor(); +int cdl_printPix(), cdl_printPixToFile(); +int cdl_setWCS(), cdl_getWCS(); +int cdl_getMapping(), cdl_setMapping(), cdl_queryMap(); + +void cdl_selectFB(), cdl_close(), cdl_computeZscale(), cdl_zscaleImage(); +void cdl_setFrame(), cdl_setFBConfig(), cdl_setZTrans(), cdl_setZoom(); +void cdl_setSample(), cdl_setContrast(), cdl_setName(), cdl_setTitle(); +void cdl_getFrame(), cdl_getFBConfig(), cdl_getZTrans(), cdl_getZoom(); +void cdl_getSample(), cdl_getContrast(), cdl_getName(), cdl_getTitle(); +void cdl_getSampleLines(), cdl_setSampleLines(), cdl_zscale(); +void cdl_setZScale(), cdl_getZScale(), cdl_lookupFBSize(); +void cdl_setDebug(); + +/* Marker function definitions. */ +int cdl_markPoint(), cdl_markLine(), cdl_markBox(), cdl_markPolyline(); +int cdl_markPolygon(), cdl_markCircle(), cdl_markCircAnnuli(); +int cdl_markEllipse(), cdl_markEllipAnnuli(), cdl_markText(); +int cdl_deleteMark(), cdl_clearOverlay(), cdl_redrawOverlay(); +int cdl_markCoordsFile(), cdl_mapFrame(), cdl_markPointLabel(); + +void cdl_setFont(), cdl_setTextWidth(); +void cdl_setLineWidth(), cdl_setLineStyle(); + +#endif + + +/* Include function prototypes for all public CDL functions when using ANSI C */ + +#ifdef ANSI_FUNC + +CDLPtr cdl_open(char *imtdev); +int cdl_displayPix(CDLPtr cdl, uchar *pix, int nx, int ny, int bitpix, int frame, int fbconfig, int zscale); +char cdl_readCursor(CDLPtr cdl, int sample, float *x, float *y, int *wcs, char *key); +int cdl_setCursor(CDLPtr cdl, int x, int y, int wcs); +int cdl_setWCS(CDLPtr cdl, char *imname, char *imtitle, float a, float b, float c, float d, float tx, float ty, float z1, float z2, int zt); +int cdl_getWCS(CDLPtr cdl, char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt); +int cdl_getMapping(CDLPtr cdl, char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref); +int cdl_setMapping(CDLPtr cdl, char *region, float sx, float sy, int snx, int sny, int dx, int dy, int dnx, int dny, char *ref); +int cdl_queryMap(CDLPtr cdl, int wcs, char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *objref); +int cdl_clearFrame(CDLPtr cdl); +void cdl_selectFB(CDLPtr cdl, int nx, int ny, int *fb, int *w, int *h, int *nf, int reset); +void cdl_close(CDLPtr cdl); +int cdl_readImage(CDLPtr cdl, uchar **pix, int *nx, int *ny); +int cdl_readFrameBuffer(CDLPtr cdl, uchar **pix, int *nx, int *ny); +void cdl_computeZscale(CDLPtr cdl, uchar *pix, int nx, int ny, int bitpix, float *z1, float *z2); +void cdl_zscaleImage(CDLPtr cdl, uchar **pix, int nx, int ny, int bitpix, float z1, float z2); +int cdl_printPix(CDLPtr cdl, char *cmd, uchar *pix, int nx, int ny, int annotate); +int cdl_printPixToFile(CDLPtr cdl, char *fname, uchar *pix, int nx, int ny, int annotate); +int cdl_readSubRaster(CDLPtr cdl, int lx, int ly, int nx, int ny, uchar **pix); +int cdl_writeSubRaster(CDLPtr cdl, int lx, int ly, int nx, int ny, uchar *pix); +void cdl_setFBConfig(CDLPtr cdl, int configno); +void cdl_getFBConfig(CDLPtr cdl, int *configno, int *w, int *h, int *nframes); +void cdl_lookupFBSize(CDLPtr cdl, int configno, int *w, int *h, int *nf); +void cdl_setFrame(CDLPtr cdl, int frame); +void cdl_setZTrans(CDLPtr cdl, int ztrans); +void cdl_setZScale(CDLPtr cdl, float z1, float z2); +void cdl_setSample(CDLPtr cdl, int nsample); +void cdl_setSampleLines(CDLPtr cdl, int nlines); +void cdl_setContrast(CDLPtr cdl, float contrast); +void cdl_setName(CDLPtr cdl, char *imname); +void cdl_setTitle(CDLPtr cdl, char *imtitle); +void cdl_getFrame(CDLPtr cdl, int *frame); +void cdl_getZTrans(CDLPtr cdl, int *ztrans); +void cdl_getZScale(CDLPtr cdl, float *z1, float *z2); +void cdl_getSample(CDLPtr cdl, int *nsample); +void cdl_getSampleLines(CDLPtr cdl, int *nlines); +void cdl_getContrast(CDLPtr cdl, float *contrast); +void cdl_getName(CDLPtr cdl, char *imname); +void cdl_getTitle(CDLPtr cdl, char *imtitle); +void cdl_setDebug(int state); + + +int cdl_mapFrame(CDLPtr cdl, int frame); +int cdl_markCoordsFile(CDLPtr cdl, char *fname, int type, int size, int color, int label); +int cdl_markPoint(CDLPtr cdl, int x, int y, int number, int size, int type, int color); +int cdl_markPointLabel(CDLPtr cdl, int x, int y, char *label, int size, int type, int color); +int cdl_markLine(CDLPtr cdl, int xs, int ys, int xe, int ye, int color); +int cdl_markBox(CDLPtr cdl, int lx, int ly, int ux, int uy, int fill, int color); +int cdl_markPolygon(CDLPtr cdl, int xarray[], int yarray[], int npts, int fill, int color); +int cdl_markPolyline(CDLPtr cdl, int *xarray, int *yarray, int npts, int color); +int cdl_markCircle(CDLPtr cdl, int x, int y, int radius, int fill, int color); +int cdl_markCircAnnuli(CDLPtr cdl, int x, int y, int radius, int nannuli, int sep, int color); +int cdl_markEllipse(CDLPtr cdl, int x, int y, int xrad, int yrad, float rotang, int fill, int color); +int cdl_markEllipAnnuli(CDLPtr cdl, int x, int y, int xrad, int yrad, float ang, int nannuli, int sep, int color); +int cdl_markText(CDLPtr cdl, int x, int y, char *str, float size, float angle, int color); +void cdl_setFont(CDLPtr cdl, int font); +void cdl_setTextWidth(CDLPtr cdl, int width); +void cdl_setLineWidth(CDLPtr cdl, int width); +void cdl_setLineStyle(CDLPtr cdl, int style); +int cdl_deleteMark(CDLPtr cdl, int x, int y); +int cdl_clearOverlay(CDLPtr cdl); +int cdl_redrawOverlay(CDLPtr cdl); +void cdl_beginDList(int frame); +void cdl_drawDList(int frame); +void cdl_clearDList(int frame); +void cdl_endDList(int frame, int flush); +int cdl_doTextMarker(int x, int y, char *string, float size, float angle, int color, int width, int font, uchar *pix, int lx, int ly, int nx, int ny); +int cdl_freeDisplayList(CDLPtr cdl, MarkerPtr head); + +int cdl_displayFITS(CDLPtr cdl, char *fname, int frame, int fbconfig, int zscale); +int cdl_isFITS(char *fname); +int cdl_readFITS(char *fname, uchar **pix, int *nx, int *ny, int *bitpix, +char *title); + +int cdl_displayIRAF(CDLPtr cdl, char *fname, int band, int frame, int +fbconfig, int zscale); +int cdl_isIRAF(char *fname); +int cdl_readIRAF(char *fname, int band, uchar **pix, int *nx, int *ny, int *bitpix, char *title); + +#endif + +#ifdef __cplusplus +} +#endif + + +#ifdef CDL_LIBRARY_SOURCE +#include "cdlProto.h" +#endif + +/* _CDL_Defined */ +#endif diff --git a/vendor/x11iraf/cdl/cdlP.h b/vendor/x11iraf/cdl/cdlP.h new file mode 100644 index 00000000..fa1ed457 --- /dev/null +++ b/vendor/x11iraf/cdl/cdlP.h @@ -0,0 +1,177 @@ +/* + * CDLP.H -- Private definitions for the Client Display Library. + */ + +/* Default values, size limiting values. + */ +#define SZ_FNAME 256 /* size of an image name */ +#define SZ_NAME 256 /* size of an image name */ +#define SZ_LINE 256 /* size of temp buffer */ +#define SZ_IMTDEV 128 /* size of an IMTDEV string */ +#define SZ_IMCURVAL 160 /* cursor value str length */ +#define SZ_OLD_WCSBUF 320 /* old wcs buffer length */ +#define SZ_WCSBUF 1024 /* wcs buffer length */ + +#define OK 0 /* success */ +#define ERR 1 /* failure */ +#define EOS '\0' /* end of statement */ + + + +/* Utility macros. + */ +#undef max +#define max(a,b) (a > b ? a : b) +#undef min +#define min(a,b) (a < b ? a : b) + +/* Handy values. + */ +#undef True +#define True 1 +#undef False +#define False 0 + + +/* Define the structures needed by the IMD interface. This is a kludge + * to avoid having applications include the IMD header. + */ + +typedef struct { + int config; /* configuration number */ + int nframes; /* number of frames */ + int width, height; /* frame buffer dimensions */ +} FBTab; + +struct IMD { + int datain, dataout; /* connection file descriptors */ + int domain; /* connection type */ + int model; /* subraster display model */ + + short frame; /* display frame number */ + short fbconfig; /* frame buffer config number */ + FBTab *fbtab[MAX_FBCONFIG]; /* fb configuration table */ + + short xs, xe; /* X start/end values */ + short ys, ye; /* Y start/end values */ + char *name; /* image name */ + char *title; /* image title */ + float a, b, c, d; /* WCS values */ + float tx, ty; /* translation values */ + float z1, z2; /* zscale values */ + short ztrans; /* Z trans type */ + + /* Coordinate mappings on the frame buffer. */ + int iis_version; /* server IIS version */ + int iis_valid; /* valid mapping flag */ + char *ref; /* img reference */ + char *region; /* region name */ + float sx, sy; /* source rect */ + int snx, sny; + int dx, dy; /* destination rect */ + int dnx, dny; +}; +typedef struct IMD *IMDPtr; + + + +#ifdef CDL_NEED_COLORMAPS + +/* Define a grayscale+static colormap used by the print routines. */ +static unsigned char cmap_r[] = { + 0, 1, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, + 20, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 40, + 41, 42, 44, 45, 46, 47, 49, 50, 51, 52, 54, 55, 56, 58, 59, 60, + 61, 63, 64, 65, 67, 68, 69, 70, 72, 73, 74, 76, 77, 78, 79, 81, + 82, 83, 84, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 99, 100, 101, +102, 104, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 118, 119, 120, 122, +123, 124, 125, 127, 128, 129, 131, 132, 133, 134, 136, 137, 138, 140, 141, 142, +143, 145, 146, 147, 148, 150, 151, 152, 154, 155, 156, 157, 159, 160, 161, 163, +164, 165, 166, 168, 169, 170, 172, 173, 174, 175, 177, 178, 179, 180, 182, 183, +184, 186, 187, 188, 189, 191, 192, 193, 195, 196, 197, 198, 200, 201, 202, 204, +205, 206, 207, 209, 210, 211, 212, 214, 215, 216, 218, 219, 220, 221, 223, 224, +225, 227, 228, 229, 230, 232, 233, 234, 236, 237, 238, 239, 241, 242, 243, 244, +246, 247, 248, 250, 251, 252, 253, 255, 255, 255, 0, 255, 255, 0, 0, 255, + 0, 255, 255, 177, 255, 255, 219, 0, 239, 255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char cmap_g[] = { + 0, 1, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, + 20, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 40, + 41, 42, 44, 45, 46, 47, 49, 50, 51, 52, 54, 55, 56, 58, 59, 60, + 61, 63, 64, 65, 67, 68, 69, 70, 72, 73, 74, 76, 77, 78, 79, 81, + 82, 83, 84, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 99, 100, 101, +102, 104, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 118, 119, 120, 122, +123, 124, 125, 127, 128, 129, 131, 132, 133, 134, 136, 137, 138, 140, 141, 142, +143, 145, 146, 147, 148, 150, 151, 152, 154, 155, 156, 157, 159, 160, 161, 163, +164, 165, 166, 168, 169, 170, 172, 173, 174, 175, 177, 178, 179, 180, 182, 183, +184, 186, 187, 188, 189, 191, 192, 193, 195, 196, 197, 198, 200, 201, 202, 204, +205, 206, 207, 209, 210, 211, 212, 214, 215, 216, 218, 219, 220, 221, 223, 224, +225, 227, 228, 229, 230, 232, 233, 234, 236, 237, 238, 239, 241, 242, 243, 244, +246, 247, 248, 250, 251, 252, 253, 255, 255, 255, 0, 255, 0, 255, 0, 255, +255, 0, 127, 48, 166, 247, 112, 246, 131, 232, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char cmap_b[] = { + 0, 1, 3, 4, 5, 6, 8, 9, 10, 12, 13, 14, 15, 17, 18, 19, + 20, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 40, + 41, 42, 44, 45, 46, 47, 49, 50, 51, 52, 54, 55, 56, 58, 59, 60, + 61, 63, 64, 65, 67, 68, 69, 70, 72, 73, 74, 76, 77, 78, 79, 81, + 82, 83, 84, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 99, 100, 101, +102, 104, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 118, 119, 120, 122, +123, 124, 125, 127, 128, 129, 131, 132, 133, 134, 136, 137, 138, 140, 141, 142, +143, 145, 146, 147, 148, 150, 151, 152, 154, 155, 156, 157, 159, 160, 161, 163, +164, 165, 166, 168, 169, 170, 172, 173, 174, 175, 177, 178, 179, 180, 182, 183, +184, 186, 187, 188, 189, 191, 192, 193, 195, 196, 197, 198, 200, 201, 202, 204, +205, 206, 207, 209, 210, 211, 212, 214, 215, 216, 218, 219, 220, 221, 223, 224, +225, 227, 228, 229, 230, 232, 233, 234, 236, 237, 238, 239, 241, 242, 243, 244, +246, 247, 248, 250, 251, 252, 253, 255, 255, 255, 0, 255, 0, 0, 255, 0, +255, 255, 80, 96, 0, 144, 215, 255, 239, 187, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#endif + + +#ifdef CDL_NEED_LINESTYLES + +/* Define the linestyle arrays needed in the marker code. */ + +#define HOLLOW_LINE_WIDTH 5 +#define SHADOW_LINE_WIDTH 4 + +static char dash_pattern[] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }; +static char dot_pattern[] = {1, 1, 0, 0, 0, 0 }; +static char dotdash_pattern[] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 1, 1, 0, 0, 0, 0, 0 }; + +static int dash = 0, sv_dash = 0, p_dash = 0, + dot = 0, sv_dot = 0, p_dot = 0, + dotdash = 0, sv_dotdash = 0, p_dotdash = 0; + +#define LEN_DASH 12 +#define LEN_DOT 6 +#define LEN_DOTDASH 19 + +#define DASH_PIXEL (dash_pattern[(dash++)%LEN_DASH]) +#define DOT_PIXEL (dot_pattern[(dot++)%LEN_DOT]) +#define DOTDASH_PIXEL (dotdash_pattern[(dotdash++)%LEN_DOTDASH]) + +#define SAVE_DASH_COUNT sv_dash=dash; +#define CLEAR_DASH_COUNT dash=0; +#define RESTORE_DASH_COUNT dash=sv_dash; + +#define SAVE_DOT_COUNT sv_dot=dot; +#define CLEAR_DOT_COUNT dot=0; +#define RESTORE_DOT_COUNT dot=sv_dot; + +#define SAVE_DOTDASH_COUNT sv_dotdash=dotdash; +#define CLEAR_DOTDASH_COUNT dotdash=0; +#define RESTORE_DOTDASH_COUNT dotdash=sv_dotdash; + +#endif diff --git a/vendor/x11iraf/cdl/cdlProto.h b/vendor/x11iraf/cdl/cdlProto.h new file mode 100644 index 00000000..1d4caee6 --- /dev/null +++ b/vendor/x11iraf/cdl/cdlProto.h @@ -0,0 +1,106 @@ +/* + * CDLPROTO.H -- CDL Library internal function prototype definitions. + */ + + +/* IMD Interface Function definitions. */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef ANSI_FUNC + +IMDPtr imd_open(char *imtdev); +int imd_displayImage(IMDPtr imd, uchar *pix, int nx, int ny, int frame, int fbconfig, int comp_wcs); +int imd_readCursor(IMDPtr imd, int sample, float *x, float *y, int *wcs, char *key); +int imd_setWCS(IMDPtr imd, char *name, char *title, float a, float b, float c, float d, float tx, float ty, float z1, float z2, int zt); +int imd_getWCS(IMDPtr imd, int wcs, char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt); +int imd_close(IMDPtr imd); +int imd_writeImage(IMDPtr imd, uchar *pix, int nx, int ny, int llx, int lly); +int imd_readImage(IMDPtr imd, uchar *pix, int *nx, int *ny); +int imd_readFrameBuffer(IMDPtr imd, uchar *pix, int *nx, int *ny); +int imd_setFrame(IMDPtr imd, int frame); +int imd_setFBConfig(IMDPtr imd, int configno); +int imd_getFBConfig(IMDPtr imd, int *configno, int *width, int *height, int *nframes); +int imd_setName(IMDPtr imd, char *name); +int imd_setTitle(IMDPtr imd, char *title); +int imd_setCursor(IMDPtr imd, int x, int y, int wcs); +int imd_clearFrame(IMDPtr imd); +int imd_readSubRaster(IMDPtr imd, int llx, int lly, int nx, int ny, uchar *pix); +int imd_writeSubRaster(IMDPtr imd, int llx, int lly, int nx, int ny, uchar *pix); +int imd_setDebug(int state); + +#else + +IMDPtr imd_open(); +int imd_setFBConfig(), imd_writeDisplay(), imd_readDisplay(); +int imd_setFrame(), imd_setCursor(), imd_readCursor(); +int imd_close(), imd_readSubRaster(), imd_writeSubRaster(); +int imd_clearFrame(), imd_setWCS(), imd_getWCS(); + +#endif + +#ifdef __cplusplus +} +#endif + + + +/* COMM Interface Function definitions. */ + +#ifdef ANSI_FUNC + +int com_writeData(int fd, short x, short y, uchar *pix, int nbytes); +int com_readData(int fdin, int fdout, short x, short y, uchar *pix, int *npix); +int com_writeSubraster(int fd, short x, short y, uchar *pix, int nx, int ny); +int com_readSubraster(int fdin, int fdout, short x, short y, uchar *pix, int *nx, int *ny); +int com_readCursor(int fdin, int fdout, int sample, float *x, float *y, int *wcs, char *key); +int com_setCursor(int fd, int x, int y, int wcs); +int com_setFBConfig(int fd, int configno); +int com_setFrame(int fd, int frame_num); +int com_writeWCS(int fd, char *buffer, int nbytes, int version); +int com_readWCS(int fdin, int fdout, char *buffer, int *nbytes, int wcs,int version); +int com_eraseFrame(int fd); +int com_wcsVersion(int fdin, int fdout); + +int com_setDebug(int state); + +#else + +int com_writeData(), com_readData(), com_setFBConfig(); +int com_readCursor(), com_setCursor(), com_setFrame(); +int com_writeWCS(), com_readWCS(), com_eraseFrame(); +int com_setDebug(), com_wcsVersion(); +int com_writeSubraster(), com_readSubraster(); + +#endif + + + +/* EPS Interface Function definitions. */ + +#ifdef ANSI_FUNC + +PSImage *eps_init(void); +void eps_print(PSImage *psim, FILE *fp, uchar *data, int xdim, int ydim, int depth, int pad); +void eps_close(PSImage *psim); +void eps_setPage(PSImage *psim, int orientation, int paper_size, int scale, int flags); +void eps_setCmap(PSImage *psim, uchar *r, uchar *g, uchar *b, int ncolors); +void eps_setCompress(PSImage *psim, int compress); +void eps_setColorType(PSImage *psim, int color_class); +void eps_setLabel(register PSImage *psim, char *label); +void eps_setTransform(PSImage *psim, float z1, float z2, int ztype, float offset, float scale, char *cmap_name); +void eps_setCorners(PSImage *psim, int llx, int lly, int urx, int ury); +void eps_getImageSize(PSImagePtr psim, int xdim, int ydim, float *width, float *height); +void eps_getImagePos(PSImagePtr psim, int xdim, int ydim, int *llx, int *lly); + +#else + +PSImage *eps_init(); +void eps_print(), eps_close(), eps_setPage(), eps_setCmap(); +void eps_setCompress(), eps_setColorType(), eps_setLabel(); +void eps_setTransform(), eps_setCorners(), eps_getImageSize(); +void eps_getImagePos(); + +#endif diff --git a/vendor/x11iraf/cdl/cdl_f77.c b/vendor/x11iraf/cdl/cdl_f77.c new file mode 100644 index 00000000..8b96e34b --- /dev/null +++ b/vendor/x11iraf/cdl/cdl_f77.c @@ -0,0 +1,1793 @@ +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" +#include "cdl_f77.h" + + +#define ABS(a) (((a)<0) ? -(a) : (a)) + + +/* CDL_F77.C -- Fortran binding for the CDL package. + */ + +static CDLPtr cdl_f = (CDLPtr) NULL; + + +#ifdef ANSI_FUNC +static char * sstrip (char *instr, int len); +#else +static char * sstrip(); +#endif + +#ifdef ANSI_FUNC +static void spad (char *outstr, int len); +#else +static void spad (); +#endif + + + +/* CDF_OPEN -- Open and initialize the CDL package. */ + +#ifdef ANSI_FUNC + +void +CDF_OPEN ( + char *imtdev, /* connection device */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_OPEN (imtdev, ier, len) +char *imtdev; /* connection device */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + char *dev; + + if (imtdev == NULL || *imtdev == '\0') + dev = NULL; + else { + dev = sstrip (imtdev, len); + if (*dev == '\0') + dev = getenv("IMTDEV"); + } + *ier = ((cdl_f = (CDLPtr) cdl_open (dev)) == (CDLPtr) NULL ? 1 : 0); +} + + +/* CDF_DISPLAYPIX -- Display a raw pixel array to the server. */ + +#ifdef ANSI_FUNC + +void +CDF_DISPLAYPIX ( + uchar *pix, /* pixels to display */ + int *nx, + int *ny, /* image dimensions */ + int *bitpix, /* pixel size */ + int *frame, /* display frame */ + int *fbconfig, /* FB config number */ + int *zscale, /* do zscale of image? */ + int *ier /* error code */ +) +#else + +void +CDF_DISPLAYPIX (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +uchar *pix; /* pixels to display */ +int *nx, *ny; /* image dimensions */ +int *bitpix; /* pixel size */ +int *frame; /* display frame */ +int *fbconfig; /* FB config number */ +int *zscale; /* do zscale of image? */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_displayPix (cdl_f, pix, *nx, *ny, *bitpix, *frame, + *fbconfig, *zscale); +} + + +/* CDF_READCURSOR -- Read the current cursor position. */ + +#ifdef ANSI_FUNC + +void +CDF_READCURSOR ( + int *sample, /* wait for keystroke? */ + float *x, + float *y, /* position (output) */ + int *wcs, /* WCS */ + char *key, /* keystroke (output) */ + int *ier /* error code */ +) +#else + +void +CDF_READCURSOR (sample, x, y, wcs, key, ier) +int *sample; /* wait for keystroke? */ +float *x, *y; /* position (output) */ +int *wcs; /* WCS */ +char *key; /* keystroke (output) */ +int *ier; /* error code */ +#endif +{ + *ier = (cdl_readCursor (cdl_f, *sample, x, y, wcs, key) != 0 ? 0 : 1); +} + + +/* CDF_DISPLAYIRAF -- Display an IRAF OIF format image. */ + +#ifdef ANSI_FUNC + +void +CDF_DISPLAYIRAF ( + char *fname, /* image name */ + int *band, /* image band if 3-d */ + int *frame, /* display frame */ + int *fbconfig, /* frame buffer config */ + int *zscale, /* do zscale of image? */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_DISPLAYIRAF (fname, band, frame, fbconfig, zscale, ier, len) +char *fname; /* image name */ +int *band; /* image band if 3-d */ +int *frame; /* display frame */ +int *fbconfig; /* frame buffer config */ +int *zscale; /* do zscale of image? */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + *ier = cdl_displayIRAF(cdl_f, sstrip(fname, len), + *band, *frame, *fbconfig, *zscale); +} + + +/* CDF_ISIRAF -- Test a file to see if it is a IRAF file. */ + +#ifdef ANSI_FUNC + +void +CDF_ISIRAF ( + char *fname, /* input filename */ + int *isiraf, + int len /* string length */ +) +#else + +void +CDF_ISIRAF (fname, isiraf, len) +char *fname; /* input filename */ +int *isiraf; +int len; /* string length */ +#endif +{ + *isiraf = cdl_isIRAF (sstrip(fname, len)); +} + + +/* CDF_READIRAF -- Read the pixels from an IRAF OIF format image. */ + +#ifdef ANSI_FUNC + +void +CDF_READIRAF ( + char *fname, /* image name */ + int *band, /* image band if 3-d */ + uchar *pix, /* pixel array (output) */ + int *nx, + int *ny, /* dimensions (output) */ + int *bitpix, /* pixel size (output) */ + char *title, /* image title */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_READIRAF (fname, band, pix, nx, ny, bitpix, title, ier, len) +char *fname; /* image name */ +int *band; /* image band if 3-d */ +uchar *pix; /* pixel array (output) */ +int *nx, *ny; /* dimensions (output) */ +int *bitpix; /* pixel size (output) */ +char *title; /* image title */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + uchar *data = (uchar) NULL; + + *ier = cdl_readIRAF (sstrip(fname, len), + *band, &data, nx, ny, bitpix, title); + + spad(title, len); + bcopy (data, pix, ((*nx) * (*ny) * (ABS(*bitpix)/8)) ); + + free (data); +} + + +/* CDF_DISPLAYFITS -- Display a simple FITS format image. */ + +#ifdef ANSI_FUNC + +void +CDF_DISPLAYFITS ( + char *fname, + int *frame, + int *fbconfig, + int *zscale, + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_DISPLAYFITS (fname, frame, fbconfig, zscale, ier, len) +char *fname; +int *frame; +int *fbconfig; +int *zscale; +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + *ier = cdl_displayFITS (cdl_f, sstrip(fname, len), + *frame, *fbconfig, *zscale); +} + + +/* CDF_ISFITS -- Test a file to see if it is a simple FITS file. */ + +#ifdef ANSI_FUNC + +void +CDF_ISFITS ( + char *fname, /* input filename */ + int *isfits, + int len /* string length */ +) +#else + +void +CDF_ISFITS (fname, isfits, len) +char *fname; /* input filename */ +int *isfits; +int len; /* string length */ +#endif +{ + *isfits = cdl_isFITS (sstrip(fname, len)); +} + + +/* CDF_READFITS -- Read the pixels from a simple FITS format image. */ + +#ifdef ANSI_FUNC + +void +CDF_READFITS ( + char *fname, /* image name */ + uchar *pix, /* pixel array (output) */ + int *nx, + int *ny, /* dimensions (output) */ + int *bitpix, /* pixel size (output) */ + char *title, /* image title */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_READFITS (fname, pix, nx, ny, bitpix, title, ier, len) +char *fname; /* image name */ +uchar *pix; /* pixel array (output) */ +int *nx, *ny; /* dimensions (output) */ +int *bitpix; /* pixel size (output) */ +char *title; /* image title */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + *ier = cdl_readFITS (sstrip(fname, len), &pix, nx, ny, bitpix, title); +} + + +/* CDF_SETCURSOR -- Set the current logical cursor position. */ + +#ifdef ANSI_FUNC + +void +CDF_SETCURSOR ( + int *x, + int *y, /* position */ + int *wcs, /* cursor wcs */ + int *ier /* error code */ +) +#else + +void +CDF_SETCURSOR (x, y, wcs, ier) +int *x, *y; /* position */ +int *wcs; /* cursor wcs */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_setCursor (cdl_f, *x, *y, *wcs); +} + + +/* CDF_SETWCS -- Set the WCS of the screen. */ + +#ifdef ANSI_FUNC + +void +CDF_SETWCS ( + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt, /* transformation type */ + int *ier, /* error code */ + int nlen, + int tlen /* string lengths */ +) +#else + +void +CDF_SETWCS (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier, nlen, tlen) +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +int *ier; /* error code */ +int nlen, tlen; /* string lengths */ +#endif +{ + char localname[SZ_FNAME], localtitle[SZ_FNAME]; + + strcpy (localname, sstrip (name, min(nlen,SZ_FNAME))); + strcpy (localtitle, sstrip (title, min(tlen,SZ_FNAME))); + *ier = cdl_setWCS (cdl_f, localname, localtitle, *a, *b, *c, *d, + *tx, *ty, *z1, *z2, *zt); +} + + +/* CDF_GETWCS -- Get the current display frame WCS information. */ + +#ifdef ANSI_FUNC + +void +CDF_GETWCS ( + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt, /* transformation type */ + int *ier, /* error code */ + int nlen, + int tlen /* string lengths */ +) +#else + +void +CDF_GETWCS (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier, nlen, tlen) +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +int *ier; /* error code */ +int nlen, tlen; /* string lengths */ +#endif +{ + *ier = cdl_getWCS (cdl_f, name, title, a, b, c, d, tx, ty, z1, z2, zt); + spad (name, nlen); + spad (title, tlen); +} + + +/* CDF_SETMAPPING -- Set the mapping information to be sent with the next + * cdl_setWcs() call. + */ +#ifdef ANSI_FUNC + +void +CDF_SETMAPPING ( + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *ref, /* reference name */ + int *ier, /* error code */ + int reglen, /* string lengths */ + int reflen +) +#else + +void +CDF_SETMAPPING (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier, reglen, reflen) +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *ref; /* reference name */ +int *ier; /* error code */ +int reglen, reflen; /* string lengths */ +#endif +{ + char objreg[SZ_FNAME], objref[SZ_FNAME]; + + strcpy (objreg, sstrip (region, min(reglen, SZ_FNAME))); + strcpy (objref, sstrip (ref, min(reflen, SZ_FNAME))); + *ier = cdl_setMapping (cdl_f, objreg, *sx,*sy,*snx,*sny, + *dx,*dy,*dnx,*dny, objref); +} + + +/* CDF_GETMAPPING -- Get the mapping information returned with the last + * cdl_getWcs() call. + */ +#ifdef ANSI_FUNC +void +CDF_GETMAPPING ( + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *ref, /* reference name */ + int *ier, /* error code */ + int reglen, /* string lengths */ + int reflen +) + +#else +void +CDF_GETMAPPING (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier, reglen, reflen) +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *ref; /* reference name */ +int *ier; /* error code */ +int reglen, reflen; /* string lengths */ +#endif +{ + *ier = cdl_getMapping (cdl_f, region, sx,sy,snx,sny, + dx,dy,dnx,dny, ref); + spad (region, reglen); + spad (ref, reflen); +} + + +/* CDF_QUERYMAP -- Query a mapping given the wcs number. + */ +#ifdef ANSI_FUNC + +void +CDF_QUERYMAP ( + int *wcs, /* requested wcs number */ + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *objref, /* reference name */ + int *ier, /* error code */ + int reglen, /* string lengths */ + int reflen +) +#else + +void +CDF_QUERYMAP (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier, reglen, reflen) +int *wcs; /* requested wcs number */ +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *objref; /* reference name */ +int *ier; /* error code */ +int reglen, reflen; /* string lengths */ +#endif +{ + *ier = cdl_queryMap (cdl_f, *wcs, region, sx,sy,snx,sny, + dx,dy,dnx,dny, objref); + spad (region, reglen); + spad (objref, reflen); +} + + +/* CDF_CLEARFRAME -- Erase the current display frame. */ + +#ifdef ANSI_FUNC + +void +CDF_CLEARFRAME ( + int *ier /* error code */ +) +#else + +void +CDF_CLEARFRAME (ier) +int *ier; /* error code */ +#endif +{ + *ier = cdl_clearFrame (cdl_f); +} + + +/* CDF_SELECTFB -- Select an appropriate frame buffer for the image. */ + +#ifdef ANSI_FUNC + +void +CDF_SELECTFB ( + int *nx, + int *ny, /* image size */ + int *fb, /* frame buffer */ + int *w, + int *h, /* frame size */ + int *nf, /* number of frames */ + int *reset /* reset after select */ +) +#else + +void +CDF_SELECTFB (nx, ny, fb, w, h, nf, reset) +int *nx, *ny; /* image size */ +int *fb; /* frame buffer */ +int *w, *h; /* frame size */ +int *nf; /* number of frames */ +int *reset; /* reset after select */ +#endif +{ + cdl_selectFB (cdl_f, *nx, *ny, fb, w, h, nf, *reset); +} + + +/* CDF_CLOSE -- Close the CDL package descriptor. */ + +#ifdef ANSI_FUNC + +void +CDF_CLOSE (void) +#else + +void +CDF_CLOSE () +#endif +{ + if (cdl_f) cdl_close (cdl_f); +} + + +/* CDF_READIMAGE -- Read the currently displayed image. */ + +#ifdef ANSI_FUNC + +void +CDF_READIMAGE ( + uchar *pix, /* image pixels (output)*/ + int *nx, + int *ny, /* dimensions (output) */ + int *ier /* error code */ +) +#else + +void +CDF_READIMAGE (pix, nx, ny, ier) +uchar *pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_readImage (cdl_f, &pix, nx, ny); +} + + +/* CDF_READFRAMEBUFFER -- Read the contents of the entire frame buffer. */ + +#ifdef ANSI_FUNC + +void +CDF_READFRAMEBUFFER ( + uchar *pix, /* image pixels (output)*/ + int *nx, + int *ny, /* dimensions (output) */ + int *ier /* error code */ +) +#else + +void +CDF_READFRAMEBUFFER (pix, nx, ny, ier) +uchar *pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_readFrameBuffer (cdl_f, &pix, nx, ny); +} + + +/* CDF_COMPZSCALE -- Compute the optimal z1/z2 values for an array. */ + +#ifdef ANSI_FUNC + +void +CDF_COMPZSCALE ( + uchar *pix, /* data to be sampled */ + int *nx, + int *ny, /* image dimensions */ + int *bitpix, /* bits per pixel */ + float *z1, + float *z2 /* min/max zscale values*/ +) +#else + +void +CDF_COMPZSCALE (pix, nx, ny, bitpix, z1, z2) +uchar *pix; /* data to be sampled */ +int *nx, *ny; /* image dimensions */ +int *bitpix; /* bits per pixel */ +float *z1, *z2; /* min/max zscale values*/ +#endif +{ + cdl_computeZscale (cdl_f, pix, *nx, *ny, *bitpix, z1, z2); +} + + +/* CDF_ZSCALEIMAGE -- Compute the optimal z1/z2 values for an array. */ + +#ifdef ANSI_FUNC + +void +CDF_ZSCALEIMAGE ( + uchar *pix, /* data to be sampled */ + int *nx, + int *ny, /* image dimensions */ + int *bitpix, /* bits per pixel */ + float *z1, + float *z2 /* min/max zscale values*/ +) +#else + +void +CDF_ZSCALEIMAGE (pix, nx, ny, bitpix, z1, z2) +uchar *pix; /* data to be sampled */ +int *nx, *ny; /* image dimensions */ +int *bitpix; /* bits per pixel */ +float *z1, *z2; /* min/max zscale values*/ +#endif +{ + cdl_zscaleImage (cdl_f, &pix, *nx, *ny, *bitpix, *z1, *z2); +} + + +/* CDF_PRINTPIX -- Print the given pixels as EPS to the named command. */ + +#ifdef ANSI_FUNC + +void +CDF_PRINTPIX ( + char *cmd, /* command string */ + uchar *pix, /* pixel array */ + int *nx, + int *ny, /* image dimensions */ + int *annotate, /* annotate output? */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_PRINTPIX (cmd, pix, nx, ny, annotate, ier, len) +char *cmd; /* command string */ +uchar *pix; /* pixel array */ +int *nx, *ny; /* image dimensions */ +int *annotate; /* annotate output? */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + *ier = cdl_printPix (cdl_f, sstrip(cmd, len), pix, *nx, *ny, *annotate); +} + + +/* CDF_PRINTPIXTOFILE -- Print the given pixels as EPS to the named file. */ + +#ifdef ANSI_FUNC + +void +CDF_PRINTPIXTOFILE ( + char *fname, /* filename */ + uchar *pix, /* pixel array */ + int *nx, + int *ny, /* image dimensions */ + int *annotate, /* annotate output? */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_PRINTPIXTOFILE (fname, pix, nx, ny, annotate, ier, len) +char *fname; /* filename */ +uchar *pix; /* pixel array */ +int *nx, *ny; /* image dimensions */ +int *annotate; /* annotate output? */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + *ier = cdl_printPixToFile (cdl_f, sstrip(fname, len), pix, *nx, *ny, *annotate); +} + + +/* CDF_READSUBRASTER -- Read a rectangular region of the frame buffer. */ + +#ifdef ANSI_FUNC + +void +CDF_READSUBRASTER ( + int *lx, + int *ly, /* region corner */ + int *nx, + int *ny, /* dimensions */ + uchar *pix, /* image pixels (output)*/ + int *ier /* error code */ +) +#else + +void +CDF_READSUBRASTER (lx, ly, nx, ny, pix, ier) +int *lx, *ly; /* region corner */ +int *nx, *ny; /* dimensions */ +uchar *pix; /* image pixels (output)*/ +int *ier; /* error code */ +#endif +{ + *ier = cdl_readSubRaster (cdl_f, *lx, *ly, *nx, *ny, &pix); +} + + +/* CDF_WRITESUBRAS -- Write a rectangular region of the frame buffer. */ + +#ifdef ANSI_FUNC + +void +CDF_WRITESUBRAS ( + int *lx, + int *ly, /* region corner */ + int *nx, + int *ny, /* dimensions */ + uchar *pix, /* subraster pixels */ + int *ier /* error code */ +) +#else + +void +CDF_WRITESUBRAS (lx, ly, nx, ny, pix, ier) +int *lx, *ly; /* region corner */ +int *nx, *ny; /* dimensions */ +uchar *pix; /* subraster pixels */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_writeSubRaster (cdl_f, *lx, *ly, *nx, *ny, pix); +} + + +/* CDF_SETFBCONFIG -- Set the frame buffer configuration number. */ + +#ifdef ANSI_FUNC + +void +CDF_SETFBCONFIG ( + int *configno /* fb config number */ +) +#else + +void +CDF_SETFBCONFIG (configno) +int *configno; /* fb config number */ +#endif +{ + cdl_setFBConfig (cdl_f, *configno); +} + + +/* CDF_GETFBCONFIG -- Get the frame buffer configuration number. */ + +#ifdef ANSI_FUNC + +void +CDF_GETFBCONFIG ( + int *configno, /* fb config number */ + int *w, + int *h, /* fb frame size */ + int *nframes /* number of frames */ +) +#else + +void +CDF_GETFBCONFIG (configno, w, h, nframes) +int *configno; /* fb config number */ +int *w, *h; /* fb frame size */ +int *nframes; /* number of frames */ +#endif +{ + cdl_getFBConfig (cdl_f, configno, w, h, nframes); +} + + +/* CDF_LOOKUPFBSIZE -- Lookup the frame buffer dimensions.*/ + +#ifdef ANSI_FUNC + +void +CDF_LOOKUPFBSIZE ( + int *configno, /* fb config number */ + int *w, + int *h, /* fb frame size */ + int *nf /* number of frames */ +) +#else + +void +CDF_LOOKUPFBSIZE (configno, w, h, nf) +int *configno; /* fb config number */ +int *w, *h; /* fb frame size */ +int *nf; /* number of frames */ +#endif +{ + cdl_lookupFBSize (cdl_f, *configno, w, h, nf); +} + + +/* CDF_SETFRAME -- Set the current display frame. */ + +#ifdef ANSI_FUNC + +void +CDF_SETFRAME ( + int *frame /* frame number */ +) +#else + +void +CDF_SETFRAME (frame) +int *frame; /* frame number */ +#endif +{ + cdl_setFrame (cdl_f, *frame); +} + + +/* CDF_SETZTRANS -- Set the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDF_SETZTRANS ( + int *ztrans /* z-transform type */ +) +#else + +void +CDF_SETZTRANS (ztrans) +int *ztrans; /* z-transform type */ +#endif +{ + cdl_setZTrans (cdl_f, *ztrans); +} + + +/* CDF_SETZSCLAE -- Set the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDF_SETZSCALE ( + float *z1, + float *z2 /* zscale values */ +) +#else + +void +CDF_SETZSCALE (z1, z2) +float *z1, *z2; /* zscale values */ +#endif +{ + cdl_setZScale (cdl_f, *z1, *z2); +} + + +/* CDF_SETSAMPLE -- Set the number of zscale sample points to use. */ + +#ifdef ANSI_FUNC + +void +CDF_SETSAMPLE ( + int *nsample /* no. of sample pts */ +) +#else + +void +CDF_SETSAMPLE (nsample) +int *nsample; /* no. of sample pts */ +#endif +{ + cdl_setSample (cdl_f, *nsample); +} + + +/* CDF_SETSAMPLELINES -- Set the number of zscale sample lines to use. */ + +#ifdef ANSI_FUNC + +void +CDF_SETSAMPLELINES ( + int *nlines /* no. of sample lines */ +) +#else + +void +CDF_SETSAMPLELINES (nlines) +int *nlines; /* no. of sample lines */ +#endif +{ + cdl_setSampleLines (cdl_f, *nlines); +} + + +/* CDF_SETCONTRAST -- Set the zscale contrast value. */ + +#ifdef ANSI_FUNC + +void +CDF_SETCONTRAST ( + float *contrast /* contrast value */ +) +#else + +void +CDF_SETCONTRAST (contrast) +float *contrast; /* contrast value */ +#endif +{ + cdl_setContrast (cdl_f, *contrast); +} + + +/* CDF_SETNAME -- Set the image name for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDF_SETNAME ( + char *imname, /* image name */ + int len /* string length */ +) +#else + +void +CDF_SETNAME (imname, len) +char *imname; /* image name */ +int len; /* string length */ +#endif +{ + cdl_setName (cdl_f, sstrip(imname, len)); +} + + +/* CDF_SETTITLE -- Set the image title for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDF_SETTITLE ( + char *imtitle, /* image title */ + int len /* string length */ +) +#else + +void +CDF_SETTITLE (imtitle, len) +char *imtitle; /* image title */ +int len; /* string length */ +#endif +{ + cdl_setTitle (cdl_f, sstrip(imtitle, len)); +} + + +/* CDF_GETFRAME -- Get the current display frame. */ + +#ifdef ANSI_FUNC + +void +CDF_GETFRAME ( + int *frame /* frame number */ +) +#else + +void +CDF_GETFRAME (frame) +int *frame; /* frame number */ +#endif +{ + cdl_getFrame (cdl_f, frame); +} + + +/* CDF_GETZTRANS -- Get the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDF_GETZTRANS ( + int *ztrans /* z-transform type */ +) +#else + +void +CDF_GETZTRANS (ztrans) +int *ztrans; /* z-transform type */ +#endif +{ + cdl_getZTrans (cdl_f, ztrans); +} + + +/* CDF_GETZSCALE -- Get the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDF_GETZSCALE ( + float *z1, + float *z2 /* zscale values */ +) +#else + +void +CDF_GETZSCALE (z1, z2) +float *z1, *z2; /* zscale values */ +#endif +{ + cdl_getZScale (cdl_f, z1, z2); +} + + +/* CDF_GETSAMPLE -- Get the number of zscale sample points to use. */ + +#ifdef ANSI_FUNC + +void +CDF_GETSAMPLE ( + int *nsample /* no. of sample pts */ +) +#else + +void +CDF_GETSAMPLE (nsample) +int *nsample; /* no. of sample pts */ +#endif +{ + cdl_getSample (cdl_f, nsample); +} + + +/* CDF_GETSAMPLELINES -- Get the number of zscale sample lines to use. */ + +#ifdef ANSI_FUNC + +void +CDF_GETSAMPLELINES ( + int *nlines /* no. of sample lines */ +) +#else + +void +CDF_GETSAMPLELINES (nlines) +int *nlines; /* no. of sample lines */ +#endif +{ + cdl_getSampleLines (cdl_f, nlines); +} + + +/* CDF_GETCONTRAST -- Get the zscale contrast value. */ + +#ifdef ANSI_FUNC + +void +CDF_GETCONTRAST ( + float *contrast /* contrast value */ +) +#else + +void +CDF_GETCONTRAST (contrast) +float *contrast; /* contrast value */ +#endif +{ + cdl_getContrast (cdl_f, contrast); +} + + +/* CDF_GETNAME -- Get the image name for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDF_GETNAME ( + char *imname, /* image name */ + int len /* string length */ +) +#else + +void +CDF_GETNAME (imname, len) +char *imname; /* image name */ +int len; /* string length */ +#endif +{ + cdl_getName (cdl_f, imname); spad (imname, len); +} + + +/* CDF_GETTITLE -- Get the image title for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDF_GETTITLE ( + char *imtitle, /* image title */ + int len /* string length */ +) +#else + +void +CDF_GETTITLE (imtitle, len) +char *imtitle; /* image title */ +int len; /* string length */ +#endif +{ + cdl_getTitle (cdl_f, imtitle); spad (imtitle, len); +} + + +/* CDF_MAPFRAME -- Map the current frame buffer as an image for overlay. */ + +#ifdef ANSI_FUNC + +void +CDF_MAPFRAME ( + int *frame, /* fb frame to map */ + int *ier /* error code */ +) +#else + +void +CDF_MAPFRAME (frame, ier) +int *frame; /* fb frame to map */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_mapFrame (cdl_f, *frame); +} + + +/* CDF_MARKCOORDSFILE -- Mark a list of coords from a file. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKCOORDSFILE ( + char *fname, /* file name */ + int *type, /* marker type */ + int *size, /* marker size */ + int *color, /* marker color */ + int *label, /* label? */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_MARKCOORDSFILE (fname, type, size, color, label, ier, len) +char *fname; /* file name */ +int *type; /* marker type */ +int *size; /* marker size */ +int *color; /* marker color */ +int *label; /* label? */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + *ier = cdl_markCoordsFile (cdl_f, sstrip (fname, len), *type, *size, *color, *label); +} + + +/* CDF_MARKPOINT -- Draw a mark on the display at the given point. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKPOINT ( + int *x, + int *y, /* marker position */ + int *number, /* if > 0, label value */ + int *size, /* marker size (pixels) */ + int *type, /* type to draw */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKPOINT (x, y, number, size, type, color, ier) +int *x, *y; /* marker position */ +int *number; /* if > 0, label value */ +int *size; /* marker size (pixels) */ +int *type; /* type to draw */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markPoint (cdl_f, *x, *y, *number, *size, *type, *color); +} + + +/* CDF_MARKPOINTLABEL -- Draw a mark on the display at the given point. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKPOINTLABEL ( + int *x, + int *y, /* marker position */ + char *label, /* point label string */ + int *size, /* marker size (pixels) */ + int *type, /* type to draw */ + int *color, /* marker color */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_MARKPOINTLABEL (x, y, label, size, type, color, ier, len) +int *x, *y; /* marker position */ +char *label; /* point label string */ +int *size; /* marker size (pixels) */ +int *type; /* type to draw */ +int *color; /* marker color */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + sstrip (label, len); + *ier = cdl_markPointLabel (cdl_f, *x, *y, sstrip(label, len), + *size, *type, *color); +} + + +/* CDF_MARKLINE -- Draw a line of given color between two points. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKLINE ( + int *xs, + int *ys, /* line start points */ + int *xe, + int *ye, /* line end points */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKLINE (xs, ys, xe, ye, color, ier) +int *xs, *ys; /* line start points */ +int *xe, *ye; /* line end points */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markLine (cdl_f, *xs, *ys, *xe, *ye, *color); +} + + +/* CDF_MARKBOX -- Draw a rectangular box given two corner endpoints. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKBOX ( + int *lx, + int *ly, /* LL corner points */ + int *ux, + int *uy, /* UR corner points */ + int *fill, /* fill rectangle? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKBOX (lx, ly, ux, uy, fill, color, ier) +int *lx, *ly; /* LL corner points */ +int *ux, *uy; /* UR corner points */ +int *fill; /* fill rectangle? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markBox (cdl_f, *lx, *ly, *ux, *uy, *fill, *color); +} + + +/* CDF_MARKPOLYGON -- Draw a polygon on the display, optionally filling. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKPOLYGON ( + int *xarray, + int *yarray, /* vertex points */ + int *npts, /* number of corners */ + int *fill, /* fill polygon? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKPOLYGON (xarray, yarray, npts, fill, color, ier) +int *xarray, *yarray; /* vertex points */ +int *npts; /* number of corners */ +int *fill; /* fill polygon? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markPolygon (cdl_f, xarray, yarray, *npts, *fill, *color); +} + + +/* CDF_MARKPOLYLINE -- Draw a polyline on the display, optionally filling. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKPOLYLINE ( + int *xarray, + int *yarray, /* vertex points */ + int *npts, /* number of points */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKPOLYLINE (xarray, yarray, npts, color, ier) +int *xarray, *yarray; /* vertex points */ +int *npts; /* number of points */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markPolyline (cdl_f, xarray, yarray, *npts, *color); +} + + +/* CDF_MARKCIRCLE -- Draw of circle on the display, optionally filling. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKCIRCLE ( + int *x, + int *y, /* center position */ + int *radius, /* radius of circle */ + int *fill, /* fill circle? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKCIRCLE (x, y, radius, fill, color, ier) +int *x, *y; /* center position */ +int *radius; /* radius of circle */ +int *fill; /* fill circle? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markCircle (cdl_f, *x, *y, *radius, *fill, *color); +} + + +/* CDF_MARKCIRCANNULI -- Draw circular annuli on the display. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKCIRCANNULI ( + int *x, + int *y, /* center position */ + int *radius, /* radius of 1st annulus*/ + int *nannuli, /* no. of annuli */ + int *sep, /* annuli sep (pixels) */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKCIRCANNULI (x, y, radius, nannuli, sep, color, ier) +int *x, *y; /* center position */ +int *radius; /* radius of 1st annulus*/ +int *nannuli; /* no. of annuli */ +int *sep; /* annuli sep (pixels) */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markCircAnnuli (cdl_f, *x, *y, *radius, *nannuli, + *sep, *color); +} + + +/* CDF_MARKELLIPSE -- Draw an ellipse. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKELLIPSE ( + int *x, + int *y, /* center position */ + int *xrad, + int *yrad, /* x and y radii */ + float *ang, /* position angle (deg) */ + int *fill, /* fill ellipse? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKELLIPSE (x, y, xrad, yrad, ang, fill, color, ier) +int *x, *y; /* center position */ +int *xrad, *yrad; /* x and y radii */ +float *ang; /* position angle (deg) */ +int *fill; /* fill ellipse? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markEllipse (cdl_f, *x, *y, *xrad, *yrad, *ang, + *fill, *color); +} + + +/* CDF_MARKELLIPANNULI -- Draw elliptical annuli on the display. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKELLIPANNULI ( + int *x, + int *y, /* center position */ + int *xrad, + int *yrad, /* radius of 1st annulus*/ + float *ang, /* rotation angle */ + int *nannuli, /* no. of annuli */ + int *sep, /* annuli sep (pixels) */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDF_MARKELLIPANNULI (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +int *x, *y; /* center position */ +int *xrad, *yrad; /* radius of 1st annulus*/ +float *ang; /* rotation angle */ +int *nannuli; /* no. of annuli */ +int *sep; /* annuli sep (pixels) */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_markEllipAnnuli (cdl_f, *x, *y, *xrad, *yrad, *ang, + *nannuli, *sep, *color); +} + + +/* CDF_MARKTEXT -- Draw a text string on the display at the given location. */ + +#ifdef ANSI_FUNC + +void +CDF_MARKTEXT ( + int *x, + int *y, /* marker position */ + char *str, /* text string */ + float *size, /* size scale factor */ + float *angle, /* text rotation angle */ + int *color, /* marker color */ + int *ier, /* error code */ + int len /* string length */ +) +#else + +void +CDF_MARKTEXT (x, y, str, size, angle, color, ier, len) +int *x, *y; /* marker position */ +char *str; /* text string */ +float *size; /* size scale factor */ +float *angle; /* text rotation angle */ +int *color; /* marker color */ +int *ier; /* error code */ +int len; /* string length */ +#endif +{ + sstrip (str, len); + *ier = cdl_markText (cdl_f, *x, *y, sstrip(str, len), + *size, *angle, *color); +} + + +/* CDF_SETFONT -- Set the font to be used for text. */ + +#ifdef ANSI_FUNC + +void +CDF_SETFONT ( + int *font /* font type */ +) +#else + +void +CDF_SETFONT (font) +int *font; /* font type */ +#endif +{ + cdl_setFont (cdl_f, *font); +} + + +/* CDF_SETLINEWIDTH -- Set the line width to be used. */ + +#ifdef ANSI_FUNC + +void +CDF_SETLINEWIDTH ( + int *width /* line width */ +) +#else + +void +CDF_SETLINEWIDTH (width) +int *width; /* line width */ +#endif +{ + cdl_setLineWidth (cdl_f, *width); +} + + +/* CDF_SETLINESTYLE -- Set the line style to be used. */ + +#ifdef ANSI_FUNC + +void +CDF_SETLINESTYLE ( + int *style /* line style */ +) +#else + +void +CDF_SETLINESTYLE (style) +int *style; /* line style */ +#endif +{ + cdl_setLineStyle (cdl_f, *style); +} + + +/* CDF_SETTEXTWIDTH -- Set the line width to be used. */ + +#ifdef ANSI_FUNC + +void +CDF_SETTEXTWIDTH ( + int *width /* text width */ +) +#else + +void +CDF_SETTEXTWIDTH (width) +int *width; /* text width */ +#endif +{ + cdl_setTextWidth (cdl_f, *width); +} + + +/* CDF_DELETEMARK -- Delete the overlay mark whose center is closest. */ + +#ifdef ANSI_FUNC + +void +CDF_DELETEMARK ( + int *x, + int *y, /* marker position */ + int *ier /* error code */ +) +#else + +void +CDF_DELETEMARK (x, y, ier) +int *x, *y; /* marker position */ +int *ier; /* error code */ +#endif +{ + *ier = cdl_deleteMark (cdl_f, *x, *y); +} + + +/* CDF_CLEAROVERLAY -- Erase all marks in the current display list. */ + +#ifdef ANSI_FUNC + +void +CDF_CLEAROVERLAY ( + int *ier /* error code */ +) +#else + +void +CDF_CLEAROVERLAY (ier) +int *ier; /* error code */ +#endif +{ + *ier = cdl_clearOverlay (cdl_f); +} + + +/* CDF_REDRAWOVERLAY -- Redraw all marks in the current display list. */ + +#ifdef ANSI_FUNC + +void +CDF_REDRAWOVERLAY ( + int *ier /* error code */ +) +#else + +void +CDF_REDRAWOVERLAY (ier) +int *ier; /* error code */ +#endif +{ + *ier = cdl_redrawOverlay (cdl_f); +} + + +/* Debug routine. */ +#ifdef ANSI_FUNC + +void +CDF_SETDEBUG (int *state) +#else + +void CDF_SETDEBUG (state) int *state; +#endif + { cdl_setDebug (*state); } + + +/* ------------------- + * PRIVATE PROCEDURES + * -------------------*/ + +/* Support utility to trim trailing blanks from string and add + * a null terminator. + */ + +static char t[SZ_LINE]; + +#ifdef ANSI_FUNC + +static char * +sstrip (char *instr, int len) +#else + +static char * +sstrip (instr, len) +char *instr; +int len; +#endif +{ + int i; + + if (instr == NULL) + t[0] = '\0'; + else { + strncpy (t, instr, min(len, SZ_LINE)); + i = min(len, SZ_LINE) - 1; + while (t[i] == ' ') + i = i - 1; + t[i+1] = '\0'; + } + return(t); +} + +/* + * SPAD --- Pad a string to length 'len' with blanks, as Fortran + * requires. + */ + +#ifdef ANSI_FUNC +static void +spad (char *outstr, int len) +#else + +static void +spad (outstr, len) +char *outstr; +int len; +#endif +{ + int i; + + for (i = strlen(outstr); i < len; i++) + outstr[i] = ' '; +} diff --git a/vendor/x11iraf/cdl/cdl_f77.h b/vendor/x11iraf/cdl/cdl_f77.h new file mode 100644 index 00000000..7688245e --- /dev/null +++ b/vendor/x11iraf/cdl/cdl_f77.h @@ -0,0 +1,250 @@ +/* + * CDL_F77.H -- header file for the CDL Fortran interface. Fortran compilers + * on various platforms may append one or more trailing underscores to + * symbol names, we'll use macros for the interface names and use defines + * to see what the symbol name is. + */ + + +#ifdef _NO_US_ + +#define CDF_OPEN cfopen +#define CDF_DISPLAYPIX cfdisplaypix +#define CDF_READCURSOR cfreadcursor +#define CDF_SETCURSOR cfsetcursor +#define CDF_CLEARFRAME cfclearframe +#define CDF_SELECTFB cfselectfb +#define CDF_CLOSE cfclose +#define CDF_DISPLAYIRAF cfdisplayiraf +#define CDF_ISIRAF cfisiraf +#define CDF_READIRAF cfreadiraf +#define CDF_DISPLAYFITS cfdisplayfits +#define CDF_ISFITS cfisfits +#define CDF_READFITS cfreadfits +#define CDF_COMPZSCALE cfcompzscale +#define CDF_ZSCALEIMAGE cfzscaleimage +#define CDF_PRINTPIX cfprintpix +#define CDF_PRINTPIXTOFILE cfprintpixtofile +#define CDF_READIMAGE cfreadimage +#define CDF_READFRAMEBUFFER cfreadframebuffer +#define CDF_READSUBRAS cfreadsubras +#define CDF_WRITESUBRAS cfwritesubras +#define CDF_SETWCS cfsetwcs +#define CDF_SETFBCONFIG cfsetfbconfig +#define CDF_GETFBCONFIG cfgetfbconfig +#define CDF_LOOKUPFBSIZE cflookupfbsize +#define CDF_SETFRAME cfsetframe +#define CDF_SETZTRANS cfsetztrans +#define CDF_SETZSCALE cfsetzscale +#define CDF_SETSAMPLE cfsetsample +#define CDF_SETSAMPLELINES cfsetsamplelines +#define CDF_SETCONTRAST cfsetcontrast +#define CDF_SETNAME cfsetname +#define CDF_SETTITLE cfsettitle +#define CDF_GETWCS cfgetwcs +#define CDF_GETFRAME cfgetframe +#define CDF_GETZTRANS cfgetztrans +#define CDF_GETZSCALE cfgetzscale +#define CDF_GETSAMPLE cfgetsample +#define CDF_GETSAMPLELINES cfgetsamplelines +#define CDF_GETCONTRAST cfgetcontrast +#define CDF_GETNAME cfgetname +#define CDF_GETTITLE cfgettitle +#define CDF_MAPFRAME cfmapframe +#define CDF_MARKCOORDSFILE cfmarkcoordsfile +#define CDF_MARKPOINT cfmarkpoint +#define CDF_MARKPOINTLABEL cfmarkpointlabel +#define CDF_MARKLINE cfmarkline +#define CDF_MARKBOX cfmarkbox +#define CDF_MARKPOLYLINE cfmarkpolyline +#define CDF_MARKPOLYGON cfmarkpolygon +#define CDF_MARKCIRCLE cfmarkcircle +#define CDF_MARKCIRCANNULI cfmarkcircannuli +#define CDF_MARKELLIPSE cfmarkellipse +#define CDF_MARKELLIPANNULI cfmarkellipannuli +#define CDF_SETFONT cfsetfont +#define CDF_SETLINEWIDTH cfsetlwidth +#define CDF_SETLINESTYLE cfsetlstyle +#define CDF_SETTEXTWIDTH cfsettwidth +#define CDF_MARKTEXT cfmarktext +#define CDF_DELETEMARK cfdeletemark +#define CDF_CLEAROVERLAY cfclearoverlay +#define CDF_REDRAWOVERLAY cfredrawoverlay +#define CDF_SETDEBUG cfsetdebug +#define CDF_SETMAPPING cfsetmapping +#define CDF_GETMAPPING cfgetmapping +#define CDF_QUERYMAP cfquerymap + + +#else + +#define CDF_OPEN cfopen_ +#define CDF_DISPLAYPIX cfdisplaypix_ +#define CDF_READCURSOR cfreadcursor_ +#define CDF_SETCURSOR cfsetcursor_ +#define CDF_CLEARFRAME cfclearframe_ +#define CDF_SELECTFB cfselectfb_ +#define CDF_CLOSE cfclose_ +#define CDF_DISPLAYIRAF cfdisplayiraf_ +#define CDF_ISIRAF cfisiraf_ +#define CDF_READIRAF cfreadiraf_ +#define CDF_DISPLAYFITS cfdisplayfits_ +#define CDF_ISFITS cfisfits_ +#define CDF_READFITS cfreadfits_ +#define CDF_COMPZSCALE cfcompzscale_ +#define CDF_ZSCALEIMAGE cfzscaleimage_ +#define CDF_PRINTPIX cfprintpix_ +#define CDF_PRINTPIXTOFILE cfprintpixtofile_ +#define CDF_READIMAGE cfreadimage_ +#define CDF_READFRAMEBUFFER cfreadframebuffer_ +#define CDF_READSUBRAS cfreadsubras_ +#define CDF_WRITESUBRAS cfwritesubras_ +#define CDF_SETWCS cfsetwcs_ +#define CDF_SETFBCONFIG cfsetfbconfig_ +#define CDF_GETFBCONFIG cfgetfbconfig_ +#define CDF_LOOKUPFBSIZE cflookupfbsize_ +#define CDF_SETFRAME cfsetframe_ +#define CDF_SETZTRANS cfsetztrans_ +#define CDF_SETZSCALE cfsetzscale_ +#define CDF_SETSAMPLE cfsetsample_ +#define CDF_SETSAMPLELINES cfsetsamplelines_ +#define CDF_SETCONTRAST cfsetcontrast_ +#define CDF_SETNAME cfsetname_ +#define CDF_SETTITLE cfsettitle_ +#define CDF_GETWCS cfgetwcs_ +#define CDF_GETFRAME cfgetframe_ +#define CDF_GETZTRANS cfgetztrans_ +#define CDF_GETZSCALE cfgetzscale_ +#define CDF_GETSAMPLE cfgetsample_ +#define CDF_GETSAMPLELINES cfgetsamplelines_ +#define CDF_GETCONTRAST cfgetcontrast_ +#define CDF_GETNAME cfgetname_ +#define CDF_GETTITLE cfgettitle_ +#define CDF_MAPFRAME cfmapframe_ +#define CDF_MARKCOORDSFILE cfmarkcoordsfile_ +#define CDF_MARKPOINT cfmarkpoint_ +#define CDF_MARKPOINTLABEL cfmarkpointlabel_ +#define CDF_MARKLINE cfmarkline_ +#define CDF_MARKBOX cfmarkbox_ +#define CDF_MARKPOLYLINE cfmarkpolyline_ +#define CDF_MARKPOLYGON cfmarkpolygon_ +#define CDF_MARKCIRCLE cfmarkcircle_ +#define CDF_MARKCIRCANNULI cfmarkcircannuli_ +#define CDF_MARKELLIPSE cfmarkellipse_ +#define CDF_MARKELLIPANNULI cfmarkellipannuli_ +#define CDF_MARKTEXT cfmarktext_ +#define CDF_SETFONT cfsetfont_ +#define CDF_SETLINEWIDTH cfsetlwidth_ +#define CDF_SETLINESTYLE cfsetlstyle_ +#define CDF_SETTEXTWIDTH cfsettwidth_ +#define CDF_DELETEMARK cfdeletemark_ +#define CDF_CLEAROVERLAY cfclearoverlay_ +#define CDF_REDRAWOVERLAY cfredrawoverlay_ +#define CDF_SETDEBUG cfsetdebug_ +#define CDF_SETMAPPING cfsetmapping_ +#define CDF_GETMAPPING cfgetmapping_ +#define CDF_QUERYMAP cfquerymap_ + +#endif + + +#ifdef ANSI_FUNC + +void CDF_OPEN(char *imtdev, int *ier, int len); +void CDF_DISPLAYPIX(uchar *pix, int *nx, int *ny, int *bitpix, int *frame, int *fbconfig, int *zscale, int *ier); +void CDF_READCURSOR(int *sample, float *x, float *y, int *wcs, char *key, int *ier); +void CDF_DISPLAYIRAF(char *fname, int *band, int *frame, int *fbconfig, int *zscale, int *ier, int len); +void CDF_ISIRAF(char *fname, int *isiraf, int len); +void CDF_READIRAF(char *fname, int *band, uchar *pix, int *nx, int *ny, int *bitpix, char *title, int *ier, int len); +void CDF_DISPLAYFITS(char *fname, int *frame, int *fbconfig, int *zscale, int *ier, int len); +void CDF_ISFITS(char *fname, int *isfits, int len); +void CDF_READFITS(char *fname, uchar *pix, int *nx, int *ny, int *bitpix, char *title, int *ier, int len); +void CDF_SETCURSOR(int *x, int *y, int *wcs, int *ier); +void CDF_SETWCS(char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt, int *ier, int nlen, int tlen); +void CDF_GETWCS(char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt, int *ier, int nlen, int tlen); +void CDF_CLEARFRAME(int *ier); +void CDF_SELECTFB(int *nx, int *ny, int *fb, int *w, int *h, int *nf, int *reset); +void CDF_CLOSE(void); +void CDF_READIMAGE(uchar *pix, int *nx, int *ny, int *ier); +void CDF_READFRAMEBUFFER(uchar *pix, int *nx, int *ny, int *ier); +void CDF_COMPZSCALE(uchar *pix, int *nx, int *ny, int *bitpix, float *z1, float *z2); +void CDF_ZSCALEIMAGE(uchar *pix, int *nx, int *ny, int *bitpix, float *z1, float *z2); +void CDF_PRINTPIX(char *cmd, uchar *pix, int *nx, int *ny, int *annotate, int *ier, int len); +void CDF_PRINTPIXTOFILE(char *fname, uchar *pix, int *nx, int *ny, int *annotate, int *ier, int len); +void CDF_READSUBRAS(int *lx, int *ly, int *nx, int *ny, uchar *pix, int *ier); +void CDF_WRITESUBRAS(int *lx, int *ly, int *nx, int *ny, uchar *pix, int *ier); +void CDF_SETFBCONFIG(int *configno); +void CDF_GETFBCONFIG(int *configno, int *w, int *h, int *nframes); +void CDF_LOOKUPFBSIZE(int *configno, int *w, int *h, int *nf); +void CDF_SETFRAME(int *frame); +void CDF_SETZTRANS(int *ztrans); +void CDF_SETZSCALE(float *z1, float *z2); +void CDF_SETSAMPLE(int *nsample); +void CDF_SETSAMPLELINES(int *nlines); +void CDF_SETCONTRAST(float *contrast); +void CDF_SETNAME(char *imname, int len); +void CDF_SETTITLE(char *imtitle, int len); +void CDF_GETFRAME(int *frame); +void CDF_GETZTRANS(int *ztrans); +void CDF_GETZSCALE(float *z1, float *z2); +void CDF_GETSAMPLE(int *nsample); +void CDF_GETSAMPLELINES(int *nlines); +void CDF_GETCONTRAST(float *contrast); +void CDF_GETNAME(char *imname, int len); +void CDF_GETTITLE(char *imtitle, int len); +void CDF_MAPFRAME(int *frame, int *ier); +void CDF_MARKCOORDSFILE(char *fname, int *type, int *size, int *color, int *label, int *ier, int len); +void CDF_MARKPOINT(int *x, int *y, int *number, int *size, int *type, int *color, int *ier); +void CDF_MARKPOINTLABEL(int *x, int *y, char *label, int *size, int *type, int *color, int *ier, int len); +void CDF_MARKLINE(int *xs, int *ys, int *xe, int *ye, int *color, int *ier); +void CDF_MARKBOX(int *lx, int *ly, int *ux, int *uy, int *fill, int *color, int *ier); +void CDF_MARKPOLYGON(int *xarray, int *yarray, int *npts, int *fill, int *color, int *ier); +void CDF_MARKPOLYLINE(int *xarray, int *yarray, int *npts, int *color, int *ier); +void CDF_MARKCIRCLE(int *x, int *y, int *radius, int *fill, int *color, int *ier); +void CDF_MARKCIRCANNULI(int *x, int *y, int *radius, int *nannuli, int *sep, int *color, int *ier); +void CDF_MARKELLIPSE(int *x, int *y, int *xrad, int *yrad, float *ang, int *fill, int *color, int *ier); +void CDF_MARKELLIPANNULI(int *x, int *y, int *xrad, int *yrad, float *ang, int *nannuli, int *sep, int *color, int *ier); +void CDF_MARKTEXT(int *x, int *y, char *str, float *size, float *angle, int *color, int *ier, int len); +void CDF_SETFONT(int *font); +void CDF_SETLINEWIDTH(int *width); +void CDF_SETLINESTYLE(int *style); +void CDF_SETTEXTWIDTH(int *width); +void CDF_DELETEMARK(int *x, int *y, int *ier); +void CDF_CLEAROVERLAY(int *ier); +void CDF_REDRAWOVERLAY(int *ier); +void CDF_SETDEBUG(int *state); +void CDF_SETMAPPING(char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref, int *ier, int reglen, int reflen); +void CDF_GETMAPPING(char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref, int *ier, int reglen, int reflen); +void CDF_QUERYMAP(int *wcs, char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref, int *ier, int reglen, int reflen); + + +#else + +/* Function Definitions. */ +void CDF_OPEN(); +void CDF_DISPLAYPIX(), CDF_DISPLAYIRAF(), CDF_DISPLAYFITS(); +void CDF_READIRAF(), CDF_READFITS(), CDF_CLEARFRAME(); +void CDF_READIMAGE(), CDF_READFRAMEBUFFER(), CDF_READSUBRAS(); +void CDF_WRITESUBRAS(), CDF_SETCURSOR(), CDF_READCURSOR(); +void CDF_SELECTFB(), CDF_CLOSE(), CDF_COMPZSCALE(), CDF_ZSCALEIMAGE(); +void CDF_SETFRAME(), CDF_SETFBCONFIG(), CDF_SETZTRANS(), CDF_SETZOOM(); +void CDF_SETSAMPLE(), CDF_SETCONTRAST(), CDF_SETNAME(), CDF_SETTITLE(); +void CDF_GETFRAME(), CDF_GETFBCONFIG(), CDF_GETZTRANS(), CDF_GETZOOM(); +void CDF_GETSAMPLE(), CDF_GETCONTRAST(), CDF_GETNAME(), CDF_GETTITLE(); +void CDF_SETZSCALE(), CDF_GETZSCALE(), CDF_LOOKUPFBSIZE(); +void CDF_ISIRAF(), CDF_ISFITS(), CDF_SETDEBUG(); +void CDF_PRINTPIX (), CDF_PRINTPIXTOFILE (); +void CDF_SETSAMPLELINES (), CDF_GETSAMPLELINES (); +void CDF_SETWCS(), CDF_GETWCS(); +void CDF_SETMAPPING(), CDF_GETMAPPING(), CDF_QUERYMAP(); + +/* Marker Function Definitions. */ +void CDF_MARKPOINT(), CDF_MARKLINE(), CDF_MARKBOX(), CDF_MARKPOLYLINE(); +void CDF_MARKPOLYGON(), CDF_MARKCIRCLE(), CDF_MARKCIRCANNULI(); +void CDF_MARKELLIPSE(), CDF_MARKELLIPANNULI(), CDF_MARKTEXT(); +void CDF_MARKPOINTLABEL(), CDF_SETFONT(); +void CDF_DELETEMARK(), CDF_CLEAROVERLAY(), CDF_REDRAWOVERLAY(); +void CDF_SETLINEWIDTH(), CDF_SETTEXTWIDTH(), CDF_SETLINESTYLE(); +void CDF_MARKCOORDSFILE(); + +#endif diff --git a/vendor/x11iraf/cdl/cdl_spp.c b/vendor/x11iraf/cdl/cdl_spp.c new file mode 100644 index 00000000..6dfab5cf --- /dev/null +++ b/vendor/x11iraf/cdl/cdl_spp.c @@ -0,0 +1,1754 @@ +#include +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" +#include "cdl_spp.h" + + + +/* + * CDL_SPP.C -- SPP binding for the CDL package. Even though we mostly + * call the F77 routines here we need a unique procedure for each function + * so we can map the SPP symbol names correctly. + */ + +char cstr[512], cstr2[512]; + + +/* CDS_OPEN -- Open and initialize the CDL package. */ + +#ifdef ANSI_FUNC + +void +CDS_OPEN ( + char *imtdev, /* connection device */ + int *ier /* error code */ +) +#else + +void +CDS_OPEN (imtdev, ier) +char *imtdev; /* connection device */ +int *ier; /* error code */ +#endif +{ + strpak (imtdev, cstr, SZ_FNAME); + CDF_OPEN (cstr, ier, strlen(cstr)); +} + + +/* CDS_DISPLAYPIX -- Display a raw pixel array to the server. */ + +#ifdef ANSI_FUNC + +void +CDS_DISPLAYPIX ( + uchar *pix, /* pixels to display */ + int *nx, + int *ny, /* image dimensions */ + int *bitpix, /* pixel size */ + int *frame, /* display frame */ + int *fbconfig, /* FB config number */ + int *zscale, /* do zscale of image? */ + int *ier /* error code */ +) +#else + +void +CDS_DISPLAYPIX (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +uchar *pix; /* pixels to display */ +int *nx, *ny; /* image dimensions */ +int *bitpix; /* pixel size */ +int *frame; /* display frame */ +int *fbconfig; /* FB config number */ +int *zscale; /* do zscale of image? */ +int *ier; /* error code */ +#endif +{ + CDF_DISPLAYPIX (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier); +} + + +/* CDS_READCURSOR -- Read the current cursor position. */ + +#ifdef ANSI_FUNC + +void +CDS_READCURSOR ( + int *sample, /* wait for keystroke? */ + float *x, + float *y, /* position (output) */ + int *wcs, /* WCS */ + char *key, /* keystroke (output) */ + int *ier /* error code */ +) +#else + +void +CDS_READCURSOR (sample, x, y, wcs, key, ier) +int *sample; /* wait for keystroke? */ +float *x, *y; /* position (output) */ +int *wcs; /* WCS */ +char *key; /* keystroke (output) */ +int *ier; /* error code */ +#endif +{ + char ch[2]; + CDF_READCURSOR (sample, x, y, wcs, ch, ier); + strupk (ch, key, 2); + + /* If the char read is a control char, return EOS */ + if (iscntrl(key[0])) + key[0] = key[1] = '\0'; +} + + +/* CDS_DISPLAYIRAF -- Display an IRAF OIF format image. */ + +#ifdef ANSI_FUNC + +void +CDS_DISPLAYIRAF ( + char *fname, /* image name */ + int *band, /* image band if 3-d */ + int *frame, /* display frame */ + int *fbconfig, /* frame buffer config */ + int *zscale, /* do zscale of image? */ + int *ier /* error code */ +) +#else + +void +CDS_DISPLAYIRAF (fname, band, frame, fbconfig, zscale, ier) +char *fname; /* image name */ +int *band; /* image band if 3-d */ +int *frame; /* display frame */ +int *fbconfig; /* frame buffer config */ +int *zscale; /* do zscale of image? */ +int *ier; /* error code */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_DISPLAYIRAF (cstr, band, frame, fbconfig, zscale, ier, SZ_FNAME); +} + + +/* CDS_ISIRAF -- Test a file to see if it is a IRAF file. */ + +#ifdef ANSI_FUNC + +void +CDS_ISIRAF ( + char *fname, /* input filename */ + int *isiraf +) +#else + +void +CDS_ISIRAF (fname, isiraf) +char *fname; /* input filename */ +int *isiraf; +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_ISIRAF (cstr, isiraf, SZ_FNAME); +} + + +/* CDS_READIRAF -- Read the pixels from an IRAF OIF format image. */ + +#ifdef ANSI_FUNC + +void +CDS_READIRAF ( + char *fname, /* image name */ + int *band, /* image band if 3-d */ + uchar *pix, /* pixel array (output) */ + int *nx, + int *ny, /* dimensions (output) */ + int *bitpix, /* pixel size (output) */ + char *title, /* image title (output) */ + int *ier /* error code */ +) +#else + +void +CDS_READIRAF (fname, band, pix, nx, ny, bitpix, title, ier) +char *fname; /* image name */ +int *band; /* image band if 3-d */ +uchar *pix; /* pixel array (output) */ +int *nx, *ny; /* dimensions (output) */ +int *bitpix; /* pixel size (output) */ +char *title; /* image title (output) */ +int *ier; /* error code */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_READIRAF (cstr, band, pix, nx, ny, bitpix, cstr2, ier, SZ_FNAME); + strupk (cstr2, title, SZ_FNAME); +} + + +/* CDS_DISPLAYFITS -- Display a simple FITS format image. */ + +#ifdef ANSI_FUNC + +void +CDS_DISPLAYFITS ( + char *fname, + int *frame, + int *fbconfig, + int *zscale, + int *ier /* error code */ +) +#else + +void +CDS_DISPLAYFITS (fname, frame, fbconfig, zscale, ier) +char *fname; +int *frame; +int *fbconfig; +int *zscale; +int *ier; /* error code */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_DISPLAYFITS (cstr, frame, fbconfig, zscale, ier, SZ_FNAME); +} + + +/* CDS_ISFITS -- Test a file to see if it is a simple FITS file. */ + +#ifdef ANSI_FUNC + +void +CDS_ISFITS ( + char *fname, /* input filename */ + int *isfits /* return value */ +) +#else + +void +CDS_ISFITS (fname, isfits) +char *fname; /* input filename */ +int *isfits; /* return value */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_ISFITS (cstr, isfits, SZ_FNAME); +} + + +/* CDS_READFITS -- Read the pixels from a simple FITS format image. */ + +#ifdef ANSI_FUNC + +void +CDS_READFITS ( + char *fname, /* image name */ + uchar *pix, /* pixel array (output) */ + int *nx, + int *ny, /* dimensions (output) */ + int *bitpix, /* pixel size (output) */ + char *title, /* image title (output) */ + int *ier /* error code */ +) +#else + +void +CDS_READFITS (fname, pix, nx, ny, bitpix, title, ier) +char *fname; /* image name */ +uchar *pix; /* pixel array (output) */ +int *nx, *ny; /* dimensions (output) */ +int *bitpix; /* pixel size (output) */ +char *title; /* image title (output) */ +int *ier; /* error code */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_READFITS (fname, pix, nx, ny, bitpix, cstr2, ier, SZ_FNAME); + strupk (cstr2, title, SZ_FNAME); +} + + +/* CDS_SETCURSOR -- Set the current logical cursor position. */ + +#ifdef ANSI_FUNC + +void +CDS_SETCURSOR ( + int *x, + int *y, /* position */ + int *wcs, /* cursor wcs */ + int *ier /* error code */ +) +#else + +void +CDS_SETCURSOR (x, y, wcs, ier) +int *x, *y; /* position */ +int *wcs; /* cursor wcs */ +int *ier; /* error code */ +#endif +{ + CDF_SETCURSOR (x, y, wcs, ier); +} + + +/* CDS_SETWCS -- Set the WCS of the screen. */ + +#ifdef ANSI_FUNC + +void +CDS_SETWCS ( + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt, /* transformation type */ + int *ier /* error code */ +) +#else + +void +CDS_SETWCS (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +int *ier; /* error code */ +#endif +{ + strpak (name, cstr, SZ_FNAME); + strpak (title, cstr2, SZ_FNAME); + CDF_SETWCS (cstr, cstr2, a, b, c, d, tx,ty, z1,z2, zt, ier, + SZ_FNAME, SZ_FNAME); +} + + +/* CDS_GETWCS -- Get the current display frame WCS information. */ + +#ifdef ANSI_FUNC + +void +CDS_GETWCS ( + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt, /* transformation type */ + int *ier /* error code */ +) +#else + +void +CDS_GETWCS (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +int *ier; /* error code */ +#endif +{ + CDF_GETWCS (cstr, cstr2, a, b, c, d, tx,ty, z1,z2, zt, ier, + SZ_FNAME, SZ_FNAME); + strupk (cstr, name, SZ_FNAME); + strupk (cstr2, title, SZ_FNAME); +} + + +/* CDS_SETMAPPING -- Set the mapping information to be sent with the next + * cdl_setWcs() call. + */ +#ifdef ANSI_FUNC + +void +CDS_SETMAPPING ( + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *ref, /* reference name */ + int *ier, /* error code */ + int reglen, /* string lengths */ + int reflen +) +#else + +void +CDS_SETMAPPING (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier, reglen, reflen) +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *ref; /* reference name */ +int *ier; /* error code */ +int reglen, reflen; /* string lengths */ +#endif +{ + strpak (region, cstr, SZ_FNAME); + strpak (ref, cstr2, SZ_FNAME); + CDF_SETMAPPING (cstr, sx,sy,snx,sny, dx,dy,dnx,dny, cstr2, ier, + SZ_FNAME, SZ_FNAME); +} + + +/* CDS_GETMAPPING -- Get the mapping information returned with the last + * cdl_getWcs() call. + */ +#ifdef ANSI_FUNC +void +CDS_GETMAPPING ( + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *ref, /* reference name */ + int *ier, /* error code */ + int reglen, /* string lengths */ + int reflen +) + +#else +void +CDS_GETMAPPING (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier, reglen, reflen) +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *ref; /* reference name */ +int *ier; /* error code */ +int reglen, reflen; /* string lengths */ +#endif +{ + CDF_GETMAPPING (cstr, sx,sy,snx,sny, dx,dy,dnx,dny, cstr2, ier, + SZ_FNAME, SZ_FNAME); + strupk (cstr, region, SZ_FNAME); + strupk (cstr2, ref, SZ_FNAME); +} + + +/* CDS_QUERYMAP -- Query a mapping given the wcs number. + */ +#ifdef ANSI_FUNC + +void +CDS_QUERYMAP ( + int *wcs, /* requested wcs number */ + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *objref, /* reference name */ + int *ier, /* error code */ + int reglen, /* string lengths */ + int reflen +) +#else + +void +CDS_QUERYMAP (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier, reglen, reflen) +int *wcs; /* requested wcs number */ +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *objref; /* reference name */ +int *ier; /* error code */ +int reglen, reflen; /* string lengths */ +#endif +{ + CDF_QUERYMAP (wcs, cstr, sx,sy,snx,sny, dx,dy,dnx,dny, cstr2, ier, + SZ_FNAME, SZ_FNAME); + strupk (cstr, region, SZ_FNAME); + strupk (cstr2, objref, SZ_FNAME); +} + + +/* CDS_CLEARFRAME -- Erase the current display frame. */ + +#ifdef ANSI_FUNC + +void +CDS_CLEARFRAME ( + int *ier /* error code */ +) +#else + +void +CDS_CLEARFRAME (ier) +int *ier; /* error code */ +#endif +{ + CDF_CLEARFRAME (ier); +} + + +/* CDS_SELECTFB -- Select an appropriate frame buffer for the image. */ + +#ifdef ANSI_FUNC + +void +CDS_SELECTFB ( + int *nx, + int *ny, /* image size */ + int *fb, /* frame buffer */ + int *w, + int *h, /* frame size */ + int *nf, /* number of frames */ + int *reset /* reset after select */ +) +#else + +void +CDS_SELECTFB (nx, ny, fb, w, h, nf, reset) +int *nx, *ny; /* image size */ +int *fb; /* frame buffer */ +int *w, *h; /* frame size */ +int *nf; /* number of frames */ +int *reset; /* reset after select */ +#endif +{ + CDF_SELECTFB (nx, ny, fb, w, h, nf, reset); +} + + +/* CDS_CLOSE -- Close the CDL package descriptor. */ + +#ifdef ANSI_FUNC + +void +CDS_CLOSE (void) +#else + +void +CDS_CLOSE () +#endif +{ + CDF_CLOSE (); +} + + +/* CDS_READIMAGE -- Read the currently displayed image. */ + +#ifdef ANSI_FUNC + +void +CDS_READIMAGE ( + uchar *pix, /* image pixels (output)*/ + int *nx, + int *ny, /* dimensions (output) */ + int *ier /* error code */ +) +#else + +void +CDS_READIMAGE (pix, nx, ny, ier) +uchar *pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +int *ier; /* error code */ +#endif +{ + CDF_READIMAGE (pix, nx, ny, ier); +} + + +/* CDS_READFRAMEBUFFER -- Read the contents of the entire frame buffer. */ + +#ifdef ANSI_FUNC + +void +CDS_READFRAMEBUFFER ( + uchar *pix, /* image pixels (output)*/ + int *nx, + int *ny, /* dimensions (output) */ + int *ier /* error code */ +) +#else + +void +CDS_READFRAMEBUFFER (pix, nx, ny, ier) +uchar *pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +int *ier; /* error code */ +#endif +{ + CDF_READFRAMEBUFFER (pix, nx, ny, ier); +} + + +/* CDS_COMPZSCALE -- Compute the optimal z1/z2 values for an array. */ + +#ifdef ANSI_FUNC + +void +CDS_COMPZSCALE ( + uchar *pix, /* data to be sampled */ + int *nx, + int *ny, /* image dimensions */ + int *bitpix, /* bits per pixel */ + float *z1, + float *z2 /* min/max zscale values*/ +) +#else + +void +CDS_COMPZSCALE (pix, nx, ny, bitpix, z1, z2) +uchar *pix; /* data to be sampled */ +int *nx, *ny; /* image dimensions */ +int *bitpix; /* bits per pixel */ +float *z1, *z2; /* min/max zscale values*/ +#endif +{ + CDF_COMPZSCALE (pix, nx, ny, bitpix, z1, z2); +} + + +/* CDS_ZSCALEIMAGE -- Compute the optimal z1/z2 values for an array. */ + +#ifdef ANSI_FUNC + +void +CDS_ZSCALEIMAGE ( + uchar *pix, /* data to be sampled */ + int *nx, + int *ny, /* image dimensions */ + int *bitpix, /* bits per pixel */ + float *z1, + float *z2 /* min/max zscale values*/ +) +#else + +void +CDS_ZSCALEIMAGE (pix, nx, ny, bitpix, z1, z2) +uchar *pix; /* data to be sampled */ +int *nx, *ny; /* image dimensions */ +int *bitpix; /* bits per pixel */ +float *z1, *z2; /* min/max zscale values*/ +#endif +{ + CDF_ZSCALEIMAGE (pix, nx, ny, bitpix, z1, z2); +} + + +/* CDS_PRINTPIX -- Print the given pixels as EPS to the named command. */ + +#ifdef ANSI_FUNC + +void +CDS_PRINTPIX ( + char *cmd, /* command string */ + uchar *pix, /* pixel array */ + int *nx, + int *ny, /* image dimensions */ + int *annotate, /* annotate output? */ + int *ier /* error code */ +) +#else + +void +CDS_PRINTPIX (cmd, pix, nx, ny, annotate, ier) +char *cmd; /* command string */ +uchar *pix; /* pixel array */ +int *nx, *ny; /* image dimensions */ +int *annotate; /* annotate output? */ +int *ier; /* error code */ +#endif +{ + strpak (cmd, cstr, SZ_FNAME); + CDF_PRINTPIX (cmd, pix, nx, ny, annotate, ier, SZ_FNAME); +} + + +/* CDS_PRINTPIXTOFILE -- Print the given pixels as EPS to the named file. */ + +#ifdef ANSI_FUNC + +void +CDS_PRINTPIXTOFILE ( + char *fname, /* filename */ + uchar *pix, /* pixel array */ + int *nx, + int *ny, /* image dimensions */ + int *annotate, /* annotate output? */ + int *ier /* error code */ +) +#else + +void +CDS_PRINTPIXTOFILE (fname, pix, nx, ny, annotate, ier) +char *fname; /* filename */ +uchar *pix; /* pixel array */ +int *nx, *ny; /* image dimensions */ +int *annotate; /* annotate output? */ +int *ier; /* error code */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_PRINTPIXTOFILE (cstr, pix, nx, ny, annotate, ier, SZ_FNAME); +} + + +/* CDS_READSUBRAS -- Read a rectangular region of the frame buffer. */ + +#ifdef ANSI_FUNC + +void +CDS_READSUBRAS ( + int *lx, + int *ly, /* region corner */ + int *nx, + int *ny, /* dimensions */ + uchar *pix, /* image pixels (output)*/ + int *ier /* error code */ +) +#else + +void +CDS_READSUBRAS (lx, ly, nx, ny, pix, ier) +int *lx, *ly; /* region corner */ +int *nx, *ny; /* dimensions */ +uchar *pix; /* image pixels (output)*/ +int *ier; /* error code */ +#endif +{ + CDF_READSUBRAS (lx, ly, nx, ny, pix, ier); +} + + +/* CDS_WRITESUBRAS -- Write a rectangular region of the frame buffer. */ + +#ifdef ANSI_FUNC + +void +CDS_WRITESUBRAS ( + int *lx, + int *ly, /* region corner */ + int *nx, + int *ny, /* dimensions */ + uchar *pix, /* subraster pixels */ + int *ier /* error code */ +) +#else + +void +CDS_WRITESUBRAS (lx, ly, nx, ny, pix, ier) +int *lx, *ly; /* region corner */ +int *nx, *ny; /* dimensions */ +uchar *pix; /* subraster pixels */ +int *ier; /* error code */ +#endif +{ + CDF_WRITESUBRAS (lx, ly, nx, ny, pix, ier); +} + + +/* CDS_SETFBCONFIG -- Set the frame buffer configuration number. */ + +#ifdef ANSI_FUNC + +void +CDS_SETFBCONFIG ( + int *configno /* fb config number */ +) +#else + +void +CDS_SETFBCONFIG (configno) +int *configno; /* fb config number */ +#endif +{ + CDF_SETFBCONFIG (configno); +} + + +/* CDS_GETFBCONFIG -- Get the frame buffer configuration number. */ + +#ifdef ANSI_FUNC + +void +CDS_GETFBCONFIG ( + int *configno, /* fb config number */ + int *w, + int *h, /* fb frame size */ + int *nframes /* number of frames */ +) +#else + +void +CDS_GETFBCONFIG (configno, w, h, nframes) +int *configno; /* fb config number */ +int *w, *h; /* fb frame size */ +int *nframes; /* number of frames */ +#endif +{ + CDF_GETFBCONFIG (configno, w, h, nframes); +} + + +/* CDS_LOOKUPFBSIZE -- Lookup the frame buffer dimensions.*/ + +#ifdef ANSI_FUNC + +void +CDS_LOOKUPFBSIZE ( + int *configno, /* fb config number */ + int *w, + int *h, /* fb frame size */ + int *nf /* number of frames */ +) +#else + +void +CDS_LOOKUPFBSIZE (configno, w, h, nf) +int *configno; /* fb config number */ +int *w, *h; /* fb frame size */ +int *nf; /* number of frames */ +#endif +{ + CDF_LOOKUPFBSIZE (configno, w, h, nf); +} + + +/* CDS_SETFRAME -- Set the current display frame. */ + +#ifdef ANSI_FUNC + +void +CDS_SETFRAME ( + int *frame /* frame number */ +) +#else + +void +CDS_SETFRAME (frame) +int *frame; /* frame number */ +#endif +{ + CDF_SETFRAME (frame); +} + + +/* CDS_SETZTRANS -- Set the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDS_SETZTRANS ( + int *ztrans /* z-transform type */ +) +#else + +void +CDS_SETZTRANS (ztrans) +int *ztrans; /* z-transform type */ +#endif +{ + CDF_SETZTRANS (ztrans); +} + + +/* CDS_SETZSCLAE -- Set the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDS_SETZSCALE ( + float *z1, + float *z2 /* zscale values */ +) +#else + +void +CDS_SETZSCALE (z1, z2) +float *z1, *z2; /* zscale values */ +#endif +{ + CDF_SETZSCALE (z1, z2); +} + + +/* CDS_SETSAMPLE -- Set the number of zscale sample points to use. */ + +#ifdef ANSI_FUNC + +void +CDS_SETSAMPLE ( + int *nsample /* no. of sample pts */ +) +#else + +void +CDS_SETSAMPLE (nsample) +int *nsample; /* no. of sample pts */ +#endif +{ + CDF_SETSAMPLE (nsample); +} + + +/* CDS_SETSAMPLELINES -- Set the number of zscale sample lines to use. */ + +#ifdef ANSI_FUNC + +void +CDS_SETSAMPLELINES ( + int *nlines /* no. of sample lines */ +) +#else + +void +CDS_SETSAMPLELINES (nlines) +int *nlines; /* no. of sample lines */ +#endif +{ + CDF_SETSAMPLELINES (nlines); +} + + +/* CDS_SETCONTRAST -- Set the zscale contrast value. */ + +#ifdef ANSI_FUNC + +void +CDS_SETCONTRAST ( + float *contrast /* contrast value */ +) +#else + +void +CDS_SETCONTRAST (contrast) +float *contrast; /* contrast value */ +#endif +{ + CDF_SETCONTRAST (contrast); +} + + +/* CDS_SETNAME -- Set the image name for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDS_SETNAME ( + char *imname /* image name */ +) +#else + +void +CDS_SETNAME (imname) +char *imname; /* image name */ +#endif +{ + strpak (imname, cstr, SZ_FNAME); + CDF_SETNAME (imname, SZ_FNAME); +} + + +/* CDS_SETTITLE -- Set the image title for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDS_SETTITLE ( + char *imtitle /* image title */ +) +#else + +void +CDS_SETTITLE (imtitle) +char *imtitle; /* image title */ +#endif +{ + strpak (imtitle, cstr, SZ_FNAME); + CDF_SETTITLE (imtitle, SZ_FNAME); +} + + +/* CDS_GETFRAME -- Get the current display frame. */ + +#ifdef ANSI_FUNC + +void +CDS_GETFRAME ( + int *frame /* frame number */ +) +#else + +void +CDS_GETFRAME (frame) +int *frame; /* frame number */ +#endif +{ + CDF_GETFRAME (frame); +} + + +/* CDS_GETZTRANS -- Get the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDS_GETZTRANS ( + int *ztrans /* z-transform type */ +) +#else + +void +CDS_GETZTRANS (ztrans) +int *ztrans; /* z-transform type */ +#endif +{ + CDF_GETZTRANS (ztrans); +} + + +/* CDS_GETZSCALE -- Get the current zscale transform parameters. */ + +#ifdef ANSI_FUNC + +void +CDS_GETZSCALE ( + float *z1, + float *z2 /* zscale values */ +) +#else + +void +CDS_GETZSCALE (z1, z2) +float *z1, *z2; /* zscale values */ +#endif +{ + CDF_GETZSCALE (z1, z2); +} + + +/* CDS_GETSAMPLE -- Get the number of zscale sample points to use. */ + +#ifdef ANSI_FUNC + +void +CDS_GETSAMPLE ( + int *nsample /* no. of sample pts */ +) +#else + +void +CDS_GETSAMPLE (nsample) +int *nsample; /* no. of sample pts */ +#endif +{ + CDF_GETSAMPLE (nsample); +} + + +/* CDS_GETSAMPLELINES -- Get the number of zscale sample lines to use. */ + +#ifdef ANSI_FUNC + +void +CDS_GETSAMPLELINES ( + int *nlines /* no. of sample lines */ +) +#else + +void +CDS_GETSAMPLELINES (nlines) +int *nlines; /* no. of sample lines */ +#endif +{ + CDF_GETSAMPLELINES (nlines); +} + + +/* CDS_GETCONTRAST -- Get the zscale contrast value. */ + +#ifdef ANSI_FUNC + +void +CDS_GETCONTRAST ( + float *contrast /* contrast value */ +) +#else + +void +CDS_GETCONTRAST (contrast) +float *contrast; /* contrast value */ +#endif +{ + CDF_GETCONTRAST (contrast); +} + + +/* CDS_GETNAME -- Get the image name for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDS_GETNAME ( + char *imname /* image name */ +) +#else + +void +CDS_GETNAME (imname) +char *imname; /* image name */ +#endif +{ + CDF_GETNAME (cstr, SZ_FNAME); + strupk (cstr, imname, SZ_FNAME); +} + + +/* CDS_GETTITLE -- Get the image title for the WCS string. */ + +#ifdef ANSI_FUNC + +void +CDS_GETTITLE ( + char *imtitle /* image title */ +) +#else + +void +CDS_GETTITLE (imtitle) +char *imtitle; /* image title */ +#endif +{ + CDF_GETTITLE (cstr, SZ_FNAME); + strupk (cstr, imtitle, SZ_FNAME); +} + + +/* CDS_MAPFRAME -- Map the current frame buffer as an image for overlay. */ + +#ifdef ANSI_FUNC + +void +CDS_MAPFRAME ( + int *frame, /* fb frame to map */ + int *ier /* error code */ +) +#else + +void +CDS_MAPFRAME (frame, ier) +int *frame; /* fb frame to map */ +int *ier; /* error code */ +#endif +{ + CDF_MAPFRAME (frame, ier); +} + +/* CDF_MARKCOORDSFILE -- Mark a list of coords from a file. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKCOORDSFILE ( + char *fname, /* file name */ + int *type, /* marker type */ + int *size, /* marker size */ + int *color, /* marker color */ + int *label, /* label? */ + int *ier /* error code */ +) +#else + +void +CDS_MARKCOORDSFILE (fname, type, size, color, label, ier) +char *fname; /* file name */ +int *type; /* marker type */ +int *size; /* marker size */ +int *color; /* marker color */ +int *label; /* label? */ +int *ier; /* error code */ +#endif +{ + strpak (fname, cstr, SZ_FNAME); + CDF_MARKCOORDSFILE (cstr, type, size, color, label, ier, SZ_FNAME); +} + + +/* CDS_MARKPOINT -- Draw a mark on the display at the given point. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKPOINT ( + int *x, + int *y, /* marker position */ + int *number, /* if > 0, label value */ + int *size, /* marker size (pixels) */ + int *type, /* type to draw */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKPOINT (x, y, number, size, type, color, ier) +int *x, *y; /* marker position */ +int *number; /* if > 0, label value */ +int *size; /* marker size (pixels) */ +int *type; /* type to draw */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKPOINT (x, y, number, size, type, color, ier); +} + + +/* CDS_MARKPOINTLABEL -- Draw a mark on the display at the given point. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKPOINTLABEL ( + int *x, + int *y, /* marker position */ + char *label, /* point label string */ + int *size, /* marker size (pixels) */ + int *type, /* type to draw */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKPOINTLABEL (x, y, label, size, type, color, ier) +int *x, *y; /* marker position */ +char *label; /* point label string */ +int *size; /* marker size (pixels) */ +int *type; /* type to draw */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + strpak (label, cstr, SZ_FNAME); + CDF_MARKPOINTLABEL (x, y, cstr, size, type, color, ier, SZ_FNAME); +} + + +/* CDS_MARKLINE -- Draw a line of given color between two points. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKLINE ( + int *xs, + int *ys, /* line start points */ + int *xe, + int *ye, /* line end points */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKLINE (xs, ys, xe, ye, color, ier) +int *xs, *ys; /* line start points */ +int *xe, *ye; /* line end points */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKLINE (xs, ys, xe, ye, color, ier); +} + + +/* CDS_MARKBOX -- Draw a rectangular box given two corner endpoints. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKBOX ( + int *lx, + int *ly, /* LL corner points */ + int *ux, + int *uy, /* UR corner points */ + int *fill, /* fill rectangle? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKBOX (lx, ly, ux, uy, fill, color, ier) +int *lx, *ly; /* LL corner points */ +int *ux, *uy; /* UR corner points */ +int *fill; /* fill rectangle? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKBOX (lx, ly, ux, uy, fill, color, ier); +} + + +/* CDS_MARKPOLYGON -- Draw a polygon on the display, optionally filling. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKPOLYGON ( + int *xarray, + int *yarray, /* vertex points */ + int *npts, /* number of corners */ + int *fill, /* fill polygon? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKPOLYGON (xarray, yarray, npts, fill, color, ier) +int *xarray, *yarray; /* vertex points */ +int *npts; /* number of corners */ +int *fill; /* fill polygon? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKPOLYGON (xarray, yarray, npts, fill, color, ier); +} + + +/* CDS_MARKPOLYLINE -- Draw a polyline on the display, optionally filling. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKPOLYLINE ( + int *xarray, + int *yarray, /* vertex points */ + int *npts, /* number of points */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKPOLYLINE (xarray, yarray, npts, color, ier) +int *xarray, *yarray; /* vertex points */ +int *npts; /* number of points */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKPOLYLINE (xarray, yarray, npts, color, ier); +} + + +/* CDS_MARKCIRCLE -- Draw of circle on the display, optionally filling. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKCIRCLE ( + int *x, + int *y, /* center position */ + int *radius, /* radius of circle */ + int *fill, /* fill circle? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKCIRCLE (x, y, radius, fill, color, ier) +int *x, *y; /* center position */ +int *radius; /* radius of circle */ +int *fill; /* fill circle? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKCIRCLE (x, y, radius, fill, color, ier); +} + + +/* CDS_MARKCIRCANNULI -- Draw circular annuli on the display. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKCIRCANNULI ( + int *x, + int *y, /* center position */ + int *radius, /* radius of 1st annulus*/ + int *nannuli, /* no. of annuli */ + int *sep, /* annuli sep (pixels) */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKCIRCANNULI (x, y, radius, nannuli, sep, color, ier) +int *x, *y; /* center position */ +int *radius; /* radius of 1st annulus*/ +int *nannuli; /* no. of annuli */ +int *sep; /* annuli sep (pixels) */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKCIRCANNULI (x, y, radius, nannuli, sep, color, ier); +} + + +/* CDS_MARKELLIPSE -- Draw an ellipse. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKELLIPSE ( + int *x, + int *y, /* center position */ + int *xrad, + int *yrad, /* x and y radii */ + float *ang, /* position angle (deg) */ + int *fill, /* fill ellipse? */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKELLIPSE (x, y, xrad, yrad, ang, fill, color, ier) +int *x, *y; /* center position */ +int *xrad, *yrad; /* x and y radii */ +float *ang; /* position angle (deg) */ +int *fill; /* fill ellipse? */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKELLIPSE (x, y, xrad, yrad, ang, fill, color, ier); +} + + +/* CDS_MARKELLIPANNULI -- Draw elliptical annuli on the display. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKELLIPANNULI ( + int *x, + int *y, /* center position */ + int *xrad, + int *yrad, /* radius of 1st annulus*/ + float *ang, /* rotation angle */ + int *nannuli, /* no. of annuli */ + int *sep, /* annuli sep (pixels) */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKELLIPANNULI (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +int *x, *y; /* center position */ +int *xrad, *yrad; /* radius of 1st annulus*/ +float *ang; /* rotation angle */ +int *nannuli; /* no. of annuli */ +int *sep; /* annuli sep (pixels) */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + CDF_MARKELLIPANNULI (x, y, xrad, yrad, ang, nannuli, sep, color, ier); +} + + +/* CDS_MARKTEXT -- Draw a text string on the display at the given location. */ + +#ifdef ANSI_FUNC + +void +CDS_MARKTEXT ( + int *x, + int *y, /* marker position */ + char *str, /* text string */ + float *size, /* size scale factor */ + float *angle, /* text rotation angle */ + int *color, /* marker color */ + int *ier /* error code */ +) +#else + +void +CDS_MARKTEXT (x, y, str, size, angle, color, ier) +int *x, *y; /* marker position */ +char *str; /* text string */ +float *size; /* size scale factor */ +float *angle; /* text rotation angle */ +int *color; /* marker color */ +int *ier; /* error code */ +#endif +{ + strpak (str, cstr, SZ_FNAME); + CDF_MARKTEXT (x, y, cstr, size, angle, color, ier, SZ_FNAME); +} + + +/* CDS_SETFONT -- Set the font to be used. */ + +#ifdef ANSI_FUNC + +void +CDS_SETFONT ( + int *font /* font type */ +) +#else + +void +CDS_SETFONT (font) +int *font; /* font type */ +#endif +{ + CDF_SETFONT (font); +} + + +/* CDS_SETLINEWIDTH -- Set the line width to be used. */ + +#ifdef ANSI_FUNC + +void +CDS_SETLINEWIDTH ( + int *width /* line width */ +) +#else + +void +CDS_SETLINEWIDTH (width) +int *width; /* line width */ +#endif +{ + CDF_SETLINEWIDTH (width); +} + + +/* CDS_SETLINESTYLE -- Set the line style to be used. */ + +#ifdef ANSI_FUNC + +void +CDS_SETLINESTYLE ( + int *style /* line style */ +) +#else + +void +CDS_SETLINESTYLE (style) +int *style; /* line style */ +#endif +{ + CDF_SETLINESTYLE (style); +} + + +/* CDS_SETTEXTWIDTH -- Set the line width to be used. */ + +#ifdef ANSI_FUNC + +void +CDS_SETTEXTWIDTH ( + int *width /* line width */ +) +#else + +void +CDS_SETTEXTWIDTH (width) +int *width; /* line width */ +#endif +{ + CDF_SETTEXTWIDTH (width); +} + + +/* CDS_DELETEMARK -- Delete the overlay mark whose center is closest. */ + +#ifdef ANSI_FUNC + +void +CDS_DELETEMARK ( + int *x, + int *y, /* marker position */ + int *ier /* error code */ +) +#else + +void +CDS_DELETEMARK (x, y, ier) +int *x, *y; /* marker position */ +int *ier; /* error code */ +#endif +{ + CDF_DELETEMARK (x, y, ier); +} + + +/* CDS_CLEAROVERLAY -- Erase all marks in the current display list. */ + +#ifdef ANSI_FUNC + +void +CDS_CLEAROVERLAY ( + int *ier /* error code */ +) +#else + +void +CDS_CLEAROVERLAY (ier) +int *ier; /* error code */ +#endif +{ + CDF_CLEAROVERLAY (ier); +} + + +/* CDS_REDRAWOVERLAY -- Redraw all marks in the current display list. */ + +#ifdef ANSI_FUNC + +void +CDS_REDRAWOVERLAY ( + int *ier /* error code */ +) +#else + +void +CDS_REDRAWOVERLAY (ier) +int *ier; /* error code */ +#endif +{ + CDF_REDRAWOVERLAY (ier); +} + + +/* Debug routine. */ +#ifdef ANSI_FUNC + +void +CDS_SETDEBUG (int *state) +#else + +void CDS_SETDEBUG (state) int *state; +#endif + { cdl_setDebug (*state); } + + +/* ------------------- + * PRIVATE PROCEDURES + * -------------------*/ + + +/* STRUPK -- Unpack a C string into an SPP string. + */ + +#ifdef ANSI_FUNC + +static void +strupk ( + char *str, /* C string */ + char *outstr, /* SPP string */ + int maxch /* max chars out, incl EOS */ +) +#else + +static void +strupk (str, outstr, maxch) +char *str; /* C string */ +char *outstr; /* SPP string */ +int maxch; /* max chars out, incl EOS */ +#endif +{ + register char *ip = str; + register short *op = (short *)outstr; + register int n = maxch-1; + + /* Is is necessary to determine the length of the string in order to + * be able to unpack the string in place, i.e., from right to left. + */ + if (maxch) + if (str != (char *)outstr) { + n = min (n, strlen(ip)); + op[n] = '\0'; + + for (n = n - 1; n >= 0; --n) + op[n] = ip[n]; + } +} + + +/* STRPAK -- Pack an SPP string (type XCHAR) into a C string in a user + * supplied buffer. Return a pointer to the output buffer. + */ + +#ifdef ANSI_FUNC + +static void +strpak ( + char *sppstr, /* SPP string */ + char *cstr, /* C string */ + int maxch /* max chars out, incl EOS */ +) +#else + +static void +strpak (sppstr, cstr, maxch) +char *sppstr; /* SPP string */ +char *cstr; /* C string */ +int maxch; /* max chars out, incl EOS */ +#endif +{ + register short *ip = (short *)sppstr; + register char *op = cstr; + register int n = maxch-1; + + if (maxch) + if ((char *)sppstr != cstr) { + while (--n >= 0 && (*op++ = *ip++) != '\0') + ; + cstr[maxch-1] = '\0'; + } +} diff --git a/vendor/x11iraf/cdl/cdl_spp.h b/vendor/x11iraf/cdl/cdl_spp.h new file mode 100644 index 00000000..e6e1ce40 --- /dev/null +++ b/vendor/x11iraf/cdl/cdl_spp.h @@ -0,0 +1,253 @@ +/* + * CDL_SPP.H -- Header file for the CDL SPP interface. Fortran compilers + * on various platforms may append one or more trailing underscores to + * symbol names, we'll use macros for the interface names and use defines + * to see what the symbol name is. + */ + +#include "cdl_f77.h" + +#ifdef _NO_US_ + +#define CDS_OPEN cdopen +#define CDS_DISPLAYPIX cdsppx +#define CDS_READCURSOR crdcur +#define CDS_SETCURSOR cscurs +#define CDS_CLEARFRAME cclfrm +#define CDS_SELECTFB cselfb +#define CDS_CLOSE cclose +#define CDS_DISPLAYIRAF cdspir +#define CDS_ISIRAF cisirf +#define CDS_READIRAF crdirf +#define CDS_DISPLAYFITS cdspft +#define CDS_ISFITS cisfts +#define CDS_READFITS crdfts +#define CDS_COMPZSCALE ccmpzs +#define CDS_ZSCALEIMAGE czscim +#define CDS_PRINTPIX cprpix +#define CDS_PRINTPIXTOFILE cprpfl +#define CDS_READIMAGE crdimg +#define CDS_READFRAMEBUFFER crdfrb +#define CDS_READSUBRAS crsubr +#define CDS_WRITESUBRAS cwsubr +#define CDS_SETWCS cstwcs +#define CDS_SETFBCONFIG csfbcf +#define CDS_GETFBCONFIG cgfbcf +#define CDS_LOOKUPFBSIZE clkfbs +#define CDS_SETFRAME csfram +#define CDS_SETZTRANS csztrn +#define CDS_SETZSCALE cszscl +#define CDS_SETSAMPLE cssamp +#define CDS_SETSAMPLELINES cssaml +#define CDS_SETCONTRAST cscntr +#define CDS_SETNAME csname +#define CDS_SETTITLE cstitl +#define CDS_GETWCS cgtwcs +#define CDS_GETFRAME cgfram +#define CDS_GETZTRANS cgztrn +#define CDS_GETZSCALE cgzscl +#define CDS_GETSAMPLE cgsamp +#define CDS_GETSAMPLELINES cgsmpl +#define CDS_GETCONTRAST cgcntr +#define CDS_GETNAME cgname +#define CDS_GETTITLE cgtitl +#define CDS_MAPFRAME cmapfr +#define CDS_MARKCOORDSFILE cmkcfl +#define CDS_MARKPOINT cmkpnt +#define CDS_MARKPOINTLABEL cmkpnl +#define CDS_MARKLINE cmklin +#define CDS_MARKBOX cmkbox +#define CDS_MARKPOLYLINE cmkpln +#define CDS_MARKPOLYGON cmkpgn +#define CDS_MARKCIRCLE cmkcrc +#define CDS_MARKCIRCANNULI cmkcan +#define CDS_MARKELLIPSE cmkell +#define CDS_MARKELLIPANNULI cmkela +#define CDS_MARKTEXT cmktxt +#define CDS_SETFONT csfont +#define CDS_SETLINEWIDTH cslwid +#define CDS_SETLINESTYLE cslsty +#define CDS_SETTEXTWIDTH cstwid +#define CDS_DELETEMARK cdelmk +#define CDS_CLEAROVERLAY cclrov +#define CDS_REDRAWOVERLAY crdrov +#define CDS_SETDEBUG cstdbg +#define CDS_SETMAPPING cstmap +#define CDS_GETMAPPING cgtmap +#define CDS_QUERYMAP cqrmap + +#else + +#define CDS_OPEN cdopen_ +#define CDS_DISPLAYPIX cdsppx_ +#define CDS_READCURSOR crdcur_ +#define CDS_SETCURSOR cscurs_ +#define CDS_CLEARFRAME cclfrm_ +#define CDS_SELECTFB cselfb_ +#define CDS_CLOSE cclose_ +#define CDS_DISPLAYIRAF cdspir_ +#define CDS_ISIRAF cisirf_ +#define CDS_READIRAF crdirf_ +#define CDS_DISPLAYFITS cdspft_ +#define CDS_ISFITS cisfts_ +#define CDS_READFITS crdfts_ +#define CDS_COMPZSCALE ccmpzs_ +#define CDS_ZSCALEIMAGE czscim_ +#define CDS_PRINTPIX cprpix_ +#define CDS_PRINTPIXTOFILE cprpfl_ +#define CDS_READIMAGE crdimg_ +#define CDS_READFRAMEBUFFER crdfrb_ +#define CDS_READSUBRAS crsubr_ +#define CDS_WRITESUBRAS cwsubr_ +#define CDS_SETWCS cstwcs_ +#define CDS_SETFBCONFIG csfbcf_ +#define CDS_GETFBCONFIG cgfbcf_ +#define CDS_LOOKUPFBSIZE clkfbs_ +#define CDS_SETFRAME csfram_ +#define CDS_SETZTRANS csztrn_ +#define CDS_SETZSCALE cszscl_ +#define CDS_SETSAMPLE cssamp_ +#define CDS_SETSAMPLELINES cssaml_ +#define CDS_SETCONTRAST cscntr_ +#define CDS_SETNAME csname_ +#define CDS_SETTITLE cstitl_ +#define CDS_GETWCS cgtwcs_ +#define CDS_GETFRAME cgfram_ +#define CDS_GETZTRANS cgztrn_ +#define CDS_GETZSCALE cgzscl_ +#define CDS_GETSAMPLE cgsamp_ +#define CDS_GETSAMPLELINES cgsmpl_ +#define CDS_GETCONTRAST cgcntr_ +#define CDS_GETNAME cgname_ +#define CDS_GETTITLE cgtitl_ +#define CDS_MAPFRAME cmapfr_ +#define CDS_MARKCOORDSFILE cmkcfl_ +#define CDS_MARKPOINT cmkpnt_ +#define CDS_MARKPOINTLABEL cmkpnl_ +#define CDS_MARKLINE cmklin_ +#define CDS_MARKBOX cmkbox_ +#define CDS_MARKPOLYLINE cmkpln_ +#define CDS_MARKPOLYGON cmkpgn_ +#define CDS_MARKCIRCLE cmkcrc_ +#define CDS_MARKCIRCANNULI cmkcan_ +#define CDS_MARKELLIPSE cmkell_ +#define CDS_MARKELLIPANNULI cmkela_ +#define CDS_MARKTEXT cmktxt_ +#define CDS_SETFONT csfont_ +#define CDS_SETLINEWIDTH cslwid_ +#define CDS_SETLINESTYLE cslsty_ +#define CDS_SETTEXTWIDTH cstwid_ +#define CDS_DELETEMARK cdelmk_ +#define CDS_CLEAROVERLAY cclrov_ +#define CDS_REDRAWOVERLAY crdrov_ +#define CDS_SETDEBUG cstdbg_ +#define CDS_SETMAPPING cstmap_ +#define CDS_GETMAPPING cgtmap_ +#define CDS_QUERYMAP cqrmap_ + +#endif + + +#ifdef ANSI_FUNC + +void CDS_OPEN(char *imtdev, int *ier); +void CDS_DISPLAYPIX(uchar *pix, int *nx, int *ny, int *bitpix, int *frame, int *fbconfig, int *zscale, int *ier); +void CDS_READCURSOR(int *sample, float *x, float *y, int *wcs, char *key, int *ier); +void CDS_DISPLAYIRAF(char *fname, int *band, int *frame, int *fbconfig, int *zscale, int *ier); +void CDS_ISIRAF(char *fname, int *isiraf); +void CDS_READIRAF(char *fname, int *band, uchar *pix, int *nx, int *ny, int *bitpix, char *title, int *ier); +void CDS_DISPLAYFITS(char *fname, int *frame, int *fbconfig, int *zscale, int *ier); +void CDS_ISFITS(char *fname, int *isfits); +void CDS_READFITS(char *fname, uchar *pix, int *nx, int *ny, int *bitpix, char *title, int *ier); +void CDS_SETCURSOR(int *x, int *y, int *wcs, int *ier); +void CDS_SETWCS(char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt, int *ier); +void CDS_GETWCS(char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt, int *ier); +void CDS_CLEARFRAME(int *ier); +void CDS_SELECTFB(int *nx, int *ny, int *fb, int *w, int *h, int *nf, int *reset); +void CDS_CLOSE(void); +void CDS_READIMAGE(uchar *pix, int *nx, int *ny, int *ier); +void CDS_READFRAMEBUFFER(uchar *pix, int *nx, int *ny, int *ier); +void CDS_COMPZSCALE(uchar *pix, int *nx, int *ny, int *bitpix, float *z1, float *z2); +void CDS_ZSCALEIMAGE(uchar *pix, int *nx, int *ny, int *bitpix, float *z1, float *z2); +void CDS_PRINTPIX(char *cmd, uchar *pix, int *nx, int *ny, int *annotate, int *ier); +void CDS_PRINTPIXTOFILE(char *fname, uchar *pix, int *nx, int *ny, int *annotate, int *ier); +void CDS_READSUBRAS(int *lx, int *ly, int *nx, int *ny, uchar *pix, int *ier); +void CDS_WRITESUBRAS(int *lx, int *ly, int *nx, int *ny, uchar *pix, int *ier); +void CDS_SETFBCONFIG(int *configno); +void CDS_GETFBCONFIG(int *configno, int *w, int *h, int *nframes); +void CDS_LOOKUPFBSIZE(int *configno, int *w, int *h, int *nf); +void CDS_SETFRAME(int *frame); +void CDS_SETZTRANS(int *ztrans); +void CDS_SETZSCALE(float *z1, float *z2); +void CDS_SETSAMPLE(int *nsample); +void CDS_SETSAMPLELINES(int *nlines); +void CDS_SETCONTRAST(float *contrast); +void CDS_SETNAME(char *imname); +void CDS_SETTITLE(char *imtitle); +void CDS_GETFRAME(int *frame); +void CDS_GETZTRANS(int *ztrans); +void CDS_GETZSCALE(float *z1, float *z2); +void CDS_GETSAMPLE(int *nsample); +void CDS_GETSAMPLELINES(int *nlines); +void CDS_GETCONTRAST(float *contrast); +void CDS_GETNAME(char *imname); +void CDS_GETTITLE(char *imtitle); +void CDS_MAPFRAME(int *frame, int *ier); +void CDS_MARKCOORDSFILE(char *fname, int *type, int *size, int *color, int *label, int *ier); +void CDS_MARKPOINT(int *x, int *y, int *number, int *size, int *type, int *color, int *ier); +void CDS_MARKPOINTLABEL(int *x, int *y, char *label, int *size, int *type, int *color, int *ier); +void CDS_MARKLINE(int *xs, int *ys, int *xe, int *ye, int *color, int *ier); +void CDS_MARKBOX(int *lx, int *ly, int *ux, int *uy, int *fill, int *color, int *ier); +void CDS_MARKPOLYGON(int *xarray, int *yarray, int *npts, int *fill, int *color, int *ier); +void CDS_MARKPOLYLINE(int *xarray, int *yarray, int *npts, int *color, int *ier); +void CDS_MARKCIRCLE(int *x, int *y, int *radius, int *fill, int *color, int *ier); +void CDS_MARKCIRCANNULI(int *x, int *y, int *radius, int *nannuli, int *sep, int *color, int *ier); +void CDS_MARKELLIPSE(int *x, int *y, int *xrad, int *yrad, float *ang, int *fill, int *color, int *ier); +void CDS_MARKELLIPANNULI(int *x, int *y, int *xrad, int *yrad, float *ang, int *nannuli, int *sep, int *color, int *ier); +void CDS_MARKTEXT(int *x, int *y, char *str, float *size, float *angle, int *color, int *ier); +void CDS_SETFONT(int *font); +void CDS_SETLINEWIDTH(int *width); +void CDS_SETLINESTYLE(int *style); +void CDS_SETTEXTWIDTH(int *width); +void CDS_DELETEMARK(int *x, int *y, int *ier); +void CDS_CLEAROVERLAY(int *ier); +void CDS_REDRAWOVERLAY(int *ier); +void CDS_SETDEBUG(int *state); +void CDS_SETMAPPING(char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref, int *ier, int reglen, int reflen); +void CDS_GETMAPPING(char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref, int *ier, int reglen, int reflen); +void CDS_QUERYMAP(int *wcs, char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref, int *ier, int reglen, int reflen); + +static void strupk(char *str, char *outstr, int maxch); +static void strpak(char *sppstr, char *cstr, int maxch); + +#else + +/* Function Definitions. */ +void CDS_OPEN(); +void CDS_DISPLAYPIX(), CDS_DISPLAYIRAF(), CDS_DISPLAYFITS(); +void CDS_READIRAF(), CDS_READFITS(), CDS_CLEARFRAME(); +void CDS_READIMAGE(), CDS_READFRAMEBUFFER(), CDS_READSUBRAS(); +void CDS_WRITESUBRAS(), CDS_SETCURSOR(), CDS_READCURSOR(); +void CDS_SELECTFB(), CDS_CLOSE(), CDS_COMPZSCALE(), CDS_ZSCALEIMAGE(); +void CDS_SETFRAME(), CDS_SETFBCONFIG(), CDS_SETZTRANS(), CDS_SETZOOM(); +void CDS_SETSAMPLE(), CDS_SETCONTRAST(), CDS_SETNAME(), CDS_SETTITLE(); +void CDS_GETFRAME(), CDS_GETFBCONFIG(), CDS_GETZTRANS(), CDS_GETZOOM(); +void CDS_GETSAMPLE(), CDS_GETCONTRAST(), CDS_GETNAME(), CDS_GETTITLE(); +void CDS_SETZSCALE(), CDS_GETZSCALE(), CDS_LOOKUPFBSIZE(); +void CDS_ISIRAF(), CDS_ISFITS(), CDS_SETDEBUG(); +void CDS_PRINTPIX (), CDS_PRINTPIXTOFILE (); +void CDS_SETSAMPLELINES (), CDS_GETSAMPLELINES (); +void CDS_SETWCS(), CDS_GETWCS(); +void CDS_SETMAPPING(), CDS_GETMAPPING(), CDS_QUERYMAP(); + +/* Marker Function Definitions. */ +void CDS_MARKPOINT(), CDS_MARKLINE(), CDS_MARKBOX(), CDS_MARKPOLYLINE(); +void CDS_MARKPOLYGON(), CDS_MARKCIRCLE(), CDS_MARKCIRCANNULI(); +void CDS_MARKELLIPSE(), CDS_MARKELLIPANNULI(), CDS_MARKTEXT(); +void CDS_DELETEMARK(), CDS_CLEAROVERLAY(), CDS_REDRAWOVERLAY(); +void CDS_SETFONT(), CDS_SETLINEWIDTH(), CDS_SETTEXTWIDTH(); +void CDS_SETLINESTYLE(), CDS_MARKCOORDSFILE(), CDS_MARKPOINTLABEL(); + +static void strupk(), strpak(); + +#endif diff --git a/vendor/x11iraf/cdl/cdlfits.c b/vendor/x11iraf/cdl/cdlfits.c new file mode 100644 index 00000000..59d75c5c --- /dev/null +++ b/vendor/x11iraf/cdl/cdlfits.c @@ -0,0 +1,804 @@ +#include +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + + +/* + * CDLFITS.C -- Routines to load simple FITS files. + * + * cdl_displayFITS (cdl, fname, frame, fbconfig, zscale) + * cdl_isFITS (fname) + * cdl_readFITS (fname, &pix, &nx, &ny, &bitpix, title); + */ + + +#define NCARDS 36 +#define BLOCKSIZE 2880 +#define SZ_CARD 80 + +/* data types */ +enum datatype { T_INT, T_LOG, T_REAL, T_STR, T_NOVAL }; + +typedef struct { + FILE *fp; /* file pointer */ + int bitpix, size; /* number of bits per pixel, sizeof(unit) */ + int naxis; /* number of axes */ + long int axes[2]; /* size of each axis */ + long int ndata; /* number of elements in data */ + long int cpos; /* current position in data file */ + float bscale, bzero; /* scaling parameters */ + char object[SZ_CARD]; /* object keyword name */ +} FITS; + +/* Function prototypes */ +#ifdef __STDC__ +#include +#include +#endif + +#undef max +#define f_max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define f_min(a,b) ((a) < (b) ? (a) : (b)) + +extern int cdl_debug; + + +#ifdef ANSI_FUNC + +static int cdl_readFITSHdr(char *fname, float *bscale, float *bzero, char *obj); +static char *cdl_getFITSPixels(char *fname, uchar **pix, int *nx, int *ny, int *bitpix); +static char *cdl_openFITS(FITS *fs, char *file, int *nx, int *ny, int *bitpix); +static char *cdl_readHeader(FITS *fs); +static char *cdl_rdCard(char *card, char *name, enum datatype dtype, long *kvalue, float *rvalue, char *svalue); +static char *cdl_getData(FITS *fs, uchar *buffer, int nelem); +static char *cdl_fixData(FITS *fs, void *buffer, int nelem); + +#else + +static char *cdl_getFITSPixels(); +static char *cdl_openFITS(), *cdl_readHeader (); +static char *cdl_rdCard(), *cdl_getData (), *cdl_fixData(); +static int cdl_readFITSHdr(); + +#endif + + +/* CDL_DISPLAYFITS -- Display a simple FITS format image to the given frame, + * optionally doing a Zscale transform of the image pixels. + */ + +#ifdef ANSI_FUNC + +int +cdl_displayFITS ( + CDLPtr cdl, /* package ptr */ + char *fname, /* image name */ + int frame, /* display frame */ + int fbconfig, /* frame buffer config */ + int zscale /* do zscale of image? */ +) +#else + +int +cdl_displayFITS (cdl, fname, frame, fbconfig, zscale) +CDLPtr cdl; /* package ptr */ +char *fname; /* image name */ +int frame; /* display frame */ +int fbconfig; /* frame buffer config */ +int zscale; /* do zscale of image? */ +#endif +{ + char obj[SZ_CARD]; + int status, nx, ny, bitpix; + uchar *pix; + float z1 = 0.0, z2 = 0.0, bscale, bzero; + + /* See if this is a valid FITS file. */ + if (!cdl_isFITS (fname)) { + fprintf (stderr, "%s: not a simple FITS file or doesn't exist.\n", + fname); + return (ERR); + } + + /* Get the raw FITS image pixels. */ + if (cdl_readFITS (fname, &pix, &nx, &ny, &bitpix, obj)) + return (ERR); + + if (cdl_debug) { + printf("[cdl_displayFITS] '%s' frame=%d zscale=%d\n", + fname, frame, zscale); + printf("[cdl_displayFITS] %dx%d bitpix=%d pixels z1=%g z2=%g\n", + nx, ny, bitpix, z1, z2); + } + + /* Read the header. */ + if (cdl_readFITSHdr (fname, &bscale, &bzero, obj)) + return (ERR); + (void) cdl_setTitle (cdl, obj); + + (void) cdl_setName (cdl, fname); + status = cdl_displayPix (cdl, pix, nx, ny, bitpix, frame, fbconfig, + zscale); + free ((char *) pix); + return (status); +} + + +/* CDL_ISFITS -- Test a file to see if it is a simple FITS file. + */ + +#ifdef ANSI_FUNC + +int +cdl_isFITS ( + char *fname /* input filename */ +) +#else + +int +cdl_isFITS (fname) +char *fname; /* input filename */ +#endif +{ + register FILE *fp; + int value = 0; + char keyw[8], val; + + if ((fp = fopen (fname, "r"))) { + fscanf (fp, "%6s = %c", keyw, &val); + if (strcmp ("SIMPLE", keyw) == 0 && val == 'T') + value = 1; + fclose (fp); + } + return value; +} + + +/* CDL_READFITS -- Read the pixels from a simple FITS format image, ret- + * urning the pixel array, dimensions, and image type. + */ + +#ifdef ANSI_FUNC + +int +cdl_readFITS ( + char *fname, /* image name */ + uchar **pix, /* pixel array (output) */ + int *nx, + int *ny, /* dimensions (output) */ + int *bitpix, /* pixel size (output) */ + char *title /* image title (output) */ +) +#else + +int +cdl_readFITS (fname, pix, nx, ny, bitpix, title) +char *fname; /* image name */ +uchar **pix; /* pixel array (output) */ +int *nx, *ny; /* dimensions (output) */ +int *bitpix; /* pixel size (output) */ +char *title; /* image title (output) */ +#endif +{ + char *errstr, *cdl_getFITSPixels(); + float bscale=1.0, bzero=0.0; + + /* See if this is a valid FITS file. */ + if (!cdl_isFITS (fname)) { + fprintf (stderr, "%s: not a simple FITS file or doesn't exist.\n", + fname); + return (ERR); + } + + if ((errstr = cdl_getFITSPixels (fname, pix, nx, ny, bitpix))) { + fprintf (stderr, "%s\n", errstr); + return (ERR); + } + if (cdl_readFITSHdr (fname, &bscale, &bzero, title)) + return (ERR); + + if (cdl_debug) + printf ("[cdl_readFITS] '%s' nx=%d ny=%d bitpix=%d title='%s'\n", + fname, *nx, *ny, *bitpix, title); + + return (OK); +} + + +/* ------------------ + * Private Procedures + * ------------------*/ + + +/* CDL_READFITSHDR -- Read several header parameters from the image. + */ + +#ifdef ANSI_FUNC + +static int +cdl_readFITSHdr ( + char *fname, /* image name */ + float *bscale, + float *bzero, /* scaling (output) */ + char *obj /* image title (output) */ +) +#else + +static int +cdl_readFITSHdr (fname, bscale, bzero, obj) +char *fname; /* image name */ +float *bscale, *bzero; /* scaling (output) */ +char *obj; /* image title (output) */ +#endif +{ + char *errstr; + register FITS *fs; + register FILE *fp; + + /* See if this is a valid FITS file. */ + if (!cdl_isFITS (fname)) { + fprintf (stderr, "%s: not a simple FITS file or doesn't exist.\n", + fname); + return (ERR); + } + + if ((fp = fopen(fname, "rb")) == NULL) + return (ERR); + + fs = (FITS *) malloc (sizeof(FITS)); + fs->fp = fp; + fs->bitpix = fs->naxis = fs->cpos = 0; + + /* Read the header. */ + if ((errstr = cdl_readHeader (fs))) { + fclose(fs->fp); + free ((char *) fs); + return (ERR); + } + + *bscale = fs->bscale; + *bzero = fs->bzero; + if (obj == (char *)NULL) + obj = (char *) malloc (SZ_CARD+1); + sprintf (obj, "%s", fs->object); + + if (cdl_debug) + printf ("[cdl_readFITSHdr] '%s' bscale=%g bzero=%g obj='%s'\n", + fname, *bscale, *bzero, obj); + + fclose(fs->fp); + free ((char *) fs); + return (OK); +} + + +/* CDL_GETFITSPIXELS -- Given an FITS filename return a pointer to the pixel + * array and the image dimensions. + */ + +#ifdef ANSI_FUNC + +static char * +cdl_getFITSPixels ( + char *fname, /* input filename */ + uchar **pix, /* output pixels */ + int *nx, + int *ny, /* dimensions */ + int *bitpix /* pixel size */ +) +#else + +static char * +cdl_getFITSPixels (fname, pix, nx, ny, bitpix) +char *fname; /* input filename */ +uchar **pix; /* output pixels */ +int *nx, *ny; /* dimensions */ +int *bitpix; /* pixel size */ +#endif +{ + FITS fs; + register int i, nelem; + char *error = NULL; + + + if ((error = cdl_openFITS (&fs, fname, nx, ny, bitpix))) + return error; + + /* Allocate a buffer to store the image. */ + nelem = (*nx) * (*ny); + if (fs.bscale != 1.0 || fs.bzero != 0.0) + *pix = (uchar *) malloc (nelem * f_max(fs.size,4)); + else + *pix = (uchar *) malloc (nelem * fs.size); + if (*pix == NULL) + return "Insufficient memory for workspace"; + + /* If the data is uchar, then read it directly */ + if (fs.bitpix == 8 && (fs.bscale == 1.0 || fs.bzero == 0.0)) + return cdl_getData (&fs, *pix, nelem); + else if ((error = cdl_getData (&fs, *pix, nelem))) + return error; + + /* If we've got BSCALE/BZERO values compute the original pixel values + * and convert the buffer to floating point before processing it. + * The pix buffer was allocated above with this in mind so it should + * be large enough that we can fix the pixels in place. + */ + if (fs.bscale != 1.0 || fs.bzero != 0.0) { + register float *buf; + + buf = (float *)*pix; + + if (fs.bitpix == 8) { + for (i=(nelem-1); i >= 0; i--) + buf[i] = (float) (*pix)[i] * fs.bscale + fs.bzero; + } else if (fs.bitpix == 16) { + register short *old = (short *) *pix; + for (i=(nelem-1); i >= 0; i--) + buf[i] = (float) old[i] * fs.bscale + fs.bzero; + } else if (fs.bitpix == 32) { + register int *old = (int *) *pix; + for (i=(nelem-1); i >= 0; i--) + buf[i] = (float) old[i] * fs.bscale + fs.bzero; + } else if (fs.bitpix == -32) { + register float *old = (float *) *pix; + for (i=(nelem-1); i >= 0; i--) + buf[i] = (float) old[i] * fs.bscale + fs.bzero; + } else if (fs.bitpix == -64) { + register double *old = (double *) *pix, *dbuf; + register float *fpix; + + dbuf = (double *) malloc (nelem * sizeof(double)); + for (i=(nelem-1); i >= 0; i--) + dbuf[i] = (float) old[i] * fs.bscale + fs.bzero; + fpix = (float *) *pix; + for (i=0; ifp = fp; + fs->bitpix = 0; + fs->naxis = 0; + fs->cpos = 0; + + /* Read the header. */ + if ((error = cdl_readHeader (fs))) { + fclose(fs->fp); + return error; + } + + if (fs->naxis > 2) { + fclose(fs->fp); + return "Not a 2-D FITS image."; + } + + /* Get number of pixel. */ + fs->ndata = 1; + for (i = 0; i < fs->naxis; i++) + fs->ndata = fs->ndata * fs->axes[i]; + + *nx = fs->axes[0]; + *ny = fs->axes[1]; + *bitpix = fs->bitpix; + + return NULL; +} + + +/* CDL_READHEADER -- Reads the fits header, and updates the FITS structure fs. + * Returns NULL on success, or an error message otherwise. + */ + +#ifdef ANSI_FUNC + +static char * +cdl_readHeader (FITS *fs) +#else + +static char * +cdl_readHeader (fs) +FITS *fs; +#endif +{ + register int i, j, res; + char name[9]; + char *block; + char *error = NULL; + long int val; /* the value */ + float rval; /* floating point value */ + char sval[SZ_FNAME]; /* string value */ + + + if ((block = (char *) malloc(BLOCKSIZE)) == NULL) + return "Insufficient memory for workspace"; + + if ((res = fread (block, sizeof(char), BLOCKSIZE, fs->fp)) != BLOCKSIZE) + return "Error reading FITS file"; + i = 0; + + /* Read SIMPLE keyword. */ + if ((error = cdl_rdCard (block, "SIMPLE", T_LOG, &val, &rval, sval))) + return error; + if (val == 0) + return "Not a SIMPLE FITS file"; + i++; + + /* Read BITPIX keyword. */ + if ((error = cdl_rdCard(&block[SZ_CARD], "BITPIX", T_INT, &val, &rval, + sval))) + return error; + if (val != 8 && val != 16 && val != 32 && val != 64 && val != -32 && + val != -64) + return "Bad BITPIX value in FITS file"; + fs->bitpix = val; + j = fs->bitpix; + if (j < 0) + j = -j; + fs->size = j / 8; + i++; + + /* Read NAXIS keyword. */ + if ((error=cdl_rdCard(&block[2*SZ_CARD], "NAXIS", T_INT, &val, &rval, + sval))) + return error; + if (val < 0 || val > 999) + return "Bad NAXIS value in FITS file"; + if (val < 2) + return "FITS file is not a two-dimensional image"; + fs->naxis = val; + i++; + + /* Read NAXISnnn keys. We allow NAXIS to be > 2 iff the dimensions + * of the extra axes are 1. + */ + for (j = 0; j < fs->naxis; j++) { + if (i == NCARDS) { + res = fread(block, sizeof(char), BLOCKSIZE, fs->fp); + if (res != BLOCKSIZE) + return "Error reading FITS file"; + i = 0; + } + + sprintf (name, "NAXIS%d", j + 1); + if ((error=cdl_rdCard (&block[i*SZ_CARD], name, T_INT, &val, &rval, + sval))) + return error; + if (val < 0) + return "Bad NAXISn value in FITS file"; + if (j < 2) + fs->axes[j] = val; + else if (val != 1) + return "FITS file is not a two-dimensional image"; + i++; + } + fs->naxis = 2; + + /* Do the remainder. */ + fs->bscale = 1.0; + fs->bzero = 0.0; + fs->object[0] = '\0'; + while (1) { + + /* Try reading a BSCALE or BZERO keyword from this card. */ + if (block[i*SZ_CARD] == 'B') { + error = cdl_rdCard(&block[i*SZ_CARD], "BSCALE", T_REAL, &val, + &rval, sval); + if (error == NULL) + fs->bscale = rval; + error = cdl_rdCard (&block[i*SZ_CARD], "BZERO", T_REAL, &val, + &rval, sval); + if (error == NULL) + fs->bzero = rval; + } else if (strncmp("OBJECT", &block[i*SZ_CARD], 6) == 0) { + /* Read OBJECT keyword. */ + if ((error = cdl_rdCard (&block[i*SZ_CARD], "OBJECT", T_STR, + &val, &rval, sval))) { + strcpy (fs->object, "no title"); + break; + } + strncpy (fs->object, sval, SZ_CARD); + i++; + } + + if (i == NCARDS) { + res = fread (block, sizeof(char), BLOCKSIZE, fs->fp); + if (res != BLOCKSIZE) + return "Unexpected EOF in FITS file"; + i = 0; + } + if (strncmp (&block[i*SZ_CARD], "END ", 8) == 0) + break; + i++; + } + + free (block); + return NULL; +} + + +/* CDL_RDCARD -- Read a header record, from the 80 byte buffer card. + * The keyword name must match 'name'; and parse its value according to + * dtype. This can have the following values: + * dtype = T_LOG # value is logical, either 'T' or 'F' in column 30 + * dtype = T_INT # value is an int, right justified in columns 11-30 + * dtype = T_REAL # value is a real + * dtype = T_STR # value is a string + * + * The value is stored in kvalue. Returns NULL on success, or an error + * message otherwise. + */ + +#ifdef ANSI_FUNC + +static char * +cdl_rdCard ( + char *card, /* FITS keyword card */ + char *name, /* keyword name */ + enum datatype dtype, /* type of value */ + long *kvalue, /* integer value */ + float *rvalue, /* real value */ + char *svalue /* string value */ +) +#else + +static char * +cdl_rdCard (card, name, dtype, kvalue, rvalue, svalue) +char *card; /* FITS keyword card */ +char *name; /* keyword name */ +enum datatype dtype; /* type of value */ +long *kvalue; /* integer value */ +float *rvalue; /* real value */ +char *svalue; /* string value */ +#endif +{ + register int i, ptr; + char namestr[9], *ip; + + /* Get the keyword from the card. */ + bcopy (card, namestr, 8); + for (i=7; i >= 0 && namestr[i] == ' '; i--) + ; + namestr[i+1] = '\0'; + if (strcmp(namestr, name) != 0) + return "Keyword not found in FITS file."; + + /* Get start of value. */ + ptr = 10; + while (ptr < SZ_CARD && card[ptr] == ' ') + ptr++; + if (ptr == SZ_CARD) + return "FITS file has missing keyword value"; /* no value */ + + if (dtype == T_LOG) { + *kvalue = (card[ptr] == 'T'); + + } else if (dtype == T_STR) { + for (ip=&card[9]; *ip != '\''; ip++) + ; + for (i=0, ip=&card[ptr+1]; *ip != '\'' && i < SZ_FNAME; i++) + svalue[i] = *ip++; + svalue[i] = '\0'; + } else { + /* An integer or real value. */ + long int ival; + float fval; + char num[21]; + + if (ptr > 29) + return "Keyword has bad integer value in FITS file"; + memcpy (num, &card[ptr], 30 - ptr); + num[30-ptr] = '\0'; + if (dtype == T_INT) { + i = sscanf (num, "%ld", &ival); + if (i != 1) + return "Keyword has bad integer value in FITS file"; + *kvalue = ival; + *rvalue = 0.0; + } else if (dtype == T_REAL) { + i = sscanf (num, "%g", &fval); + if (i != 1) + return "Keyword has bad real value in FITS file"; + *kvalue = 0; + *rvalue = fval; + } + } + + return NULL; +} + + +/* CDL_GETDATA -- Reads nelem values into the buffer. Copes with the fact + * that the last 2880 byte record of the FITS file may be truncated, and + * should be padded out with zeros. Returns NULL for success or an error + * message. + */ + +#ifdef ANSI_FUNC + +static char * +cdl_getData (FITS *fs, uchar *buffer, int nelem) +#else + +static char * +cdl_getData (fs, buffer, nelem) +FITS *fs; +uchar *buffer; +int nelem; +#endif +{ + int res; + + if (nelem == 0) + return NULL; + + if ((res = fread ((void *)buffer, fs->size, nelem, fs->fp)) != nelem) { + /* Nblock is the number of elements in a record. size is + * always a factor of BLOCKSIZE + */ + int loffs, nblock = BLOCKSIZE / fs->size; + + if (!feof(fs->fp)) + return "I/O error reading FITS file"; + + /* The last record might be short; check this. + * loffs is the offset of the start of the last record from + * the current position. + */ + loffs = ((fs->ndata + nblock - 1) / nblock - 1) * nblock - fs->cpos; + + /* If we didn't read to the end of the penultimate record */ + if (res < loffs) + return "Unexpected eof reading FITS file"; + + /* Pad with zeros */ + memset ((char *)buffer+res*fs->size, '\0', (nelem-res)*fs->size); + } + + fs->cpos += res; + return cdl_fixData(fs, buffer, nelem); +} + + +/* CDL_FIXDATA -- convert the raw data, as stored in the FITS file, to the + * format appropiate for the data representation of the host computer. + * Assumes that + * short int = 2 byte integer + * int = 4 byte integer + */ + +#ifdef ANSI_FUNC + +static char * +cdl_fixData (FITS *fs, void *buffer, int nelem) +#else + +static char * +cdl_fixData (fs, buffer, nelem) +FITS *fs; +void *buffer; +int nelem; +#endif +{ + register int i, n = nelem; + register uchar *ptr = buffer; + + /* Conversions. Although the data may be signed, reverse using unsigned + * variables. Convert from big-endian two-byte signed integer to + * native form. + */ + if (fs->bitpix == 16) + for (i = 0; i < n; i++, ptr += 2) + *(unsigned short int *)ptr = (((int)*ptr) << 8) | (int)(ptr[1]); + + /* Convert from big-endian four-byte signed integer to native form */ + else if (fs->bitpix == 32) + for (i = 0; i < n; i++, ptr += 4) + *(unsigned int *)ptr = (((unsigned int)*ptr) << 24) | + ((unsigned int)ptr[1] << 16) | + ((unsigned int)ptr[2] << 8) | + (unsigned int)ptr[3]; + + /* Convert from IEE 754 single precision to native form */ + else if (fs->bitpix == -32) { + register int j, k, expo; + static float *exps = NULL; + + if (exps == NULL) { + exps = (float *)calloc(256, sizeof(float)); + if (exps == NULL) + return "Insufficient memory for workspace"; + exps[150] = 1.; + for (i = 151; i < 256; i++) + exps[i] = 2. * exps[i-1]; + for (i = 149; i >= 0; i--) + exps[i] = 0.5 * exps[i+1]; + } + + + for (i = 0; i < n; i++, ptr += 4) { + k = (int)*ptr; + j = ((int)ptr[1] << 16) | ((int)ptr[2] << 8) | (int)ptr[3]; + expo = ((k & 127) << 1) | (j >> 23); + if ((expo | j) == 0) + *(float *)ptr = 0.; + else + *(float *)ptr = exps[expo] * (float)(j | 0x800000); + if (k & 128) + *(float *)ptr = -*(float *)ptr; + } + + /* Convert from IEE 754 double precision to native form */ + } else if (fs->bitpix == -64) { + register int expo, k, l; + register unsigned int j; + static double *exps = NULL; + + if (exps == NULL) { + exps = (double *)calloc(2048, sizeof(double)); + if (exps == NULL) + return "Insufficient memory for workspace"; + exps[1075] = 1.; + for (i = 1076; i < 2048; i++) + exps[i] = 2. * exps[i-1]; + for (i = 1074; i >= 0; i--) + exps[i] = 0.5 * exps[i+1]; + } + + for (i = 0; i < n; i++, ptr += 8) { + k = (int)*ptr; + j = ((unsigned int)ptr[1] << 24) | ((unsigned int)ptr[2] << 16)| + ((unsigned int)ptr[3] << 8) | (unsigned int)ptr[4]; + l = ((int)ptr[5] << 16) | ((int)ptr[6] << 8) | (int)ptr[7]; + expo = ((k & 127) << 4) | (j >> 28); + if ((expo | j | l) == 0) + *(double *)ptr = 0.; + else + *(double *)ptr = exps[expo] * (16777216. * + (double)((j & 0x0FFFFFFF) | 0x10000000) + (double)l); + if (k & 128) + *(double *)ptr = -*(double *)ptr; + } + } + + return NULL; +} diff --git a/vendor/x11iraf/cdl/cdlfont.h b/vendor/x11iraf/cdl/cdlfont.h new file mode 100644 index 00000000..ebbbd418 --- /dev/null +++ b/vendor/x11iraf/cdl/cdlfont.h @@ -0,0 +1,790 @@ +/* CDLFONT.H -- Font definitions. + */ + +#define CHARACTER_START 32 +#define CHARACTER_END 126 +#define CHARACTER_HEIGHT 26 +#define CHARACTER_WIDTH 17 + +#define FONT_LEFT 0 +#define FONT_CENTER 9 +#define FONT_RIGHT 27 +#define FONT_TOP 36 +#define FONT_CAP 34 +#define FONT_HALF 23 +#define FONT_BASE 9 +#define FONT_BOTTOM 0 +#define FONT_WIDTH 27 +#define FONT_HEIGHT 36 + +#define COORD_X_START 7 +#define COORD_Y_START 1 +#define COORD_PEN_START 13 +#define COORD_X_LEN 6 +#define COORD_Y_LEN 6 +#define COORD_PEN_LEN 1 + +#define PAINT_BEGIN_START 14 +#define PAINT_END_START 15 +#define PAINT_BEGIN_LEN 1 +#define PAINT_END_LEN 1 + + +/* CHRTAB -- Table of strokes for the printable ASCII characters. Each char- + * acter is encoded as a series of strokes. Each stroke is expressed by a + * single integer containing the following bitfields: + * + * 2 1 + * 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 + * | | | | | | | + * | | | +---------+ +---------+ + * | | | | | + * | | | X Y + * | | | + * | | +-- pen up/down + * | +---- begin paint (not used at present) + * +------ end paint (not used at present) + *------------------------------------------------------------------------------ + */ + +/* Define the database. */ + + +/* Index into CHRTAB of each printable character (starting with SP). */ + +short chridx[] = { /* character index in chrtab */ + 1, 3, 12, 21, 30, 45, 66, 79, 85, 92, + 99, 106, 111, 118, 121, 128, 131, 141, 145, 154, + 168, 177, 187, 199, 203, 221, 233, 246, 259, 263, + 268, 272, 287, 307, 314, 327, 336, 344, 352, 359, + 371, 378, 385, 391, 398, 402, 408, 413, 425, 433, + 445, 455, 468, 473, 480, 484, 490, 495, 501, 506, + 511, 514, 519, 523, 526, 529, 543, 554, 563, 574, + 585, 593, 607, 615, 625, 638, 645, 650, 663, 671, + 681, 692, 703, 710, 723, 731, 739, 743, 749, 754, + 759, 764, 776, 781, 793, 801 +}; + + +short chrtab[] = { /* stroke data to draw the characters */ + 36, 1764, 675, 29328, 585, 21063, 21191, 21193, 21065, 29383, + 1764, 355, 29023, 351, 29027, 931, 29599, 927, 29603, 1764, + 603, 29066, 842, 29723, 1302, 28886, 143, 29839, 1764, 611, + 29256, 78, 20810, 21322, 21581, 21586, 21334, 20822, 20569, 20573, + 20833, 21345, 29789, 1764, 419, 20707, 20577, 20574, 20700, 20892, + 21022, 21025, 20899, 1187, 28744, 717, 21194, 21320, 21512, 21642, + 21645, 21519, 21327, 21197, 1764, 1160, 20700, 20704, 20835, 21027, + 21152, 21149, 20561, 20556, 20744, 21192, 29841, 1764, 611, 21023, + 21087, 21155, 21091, 1764, 739, 21087, 21018, 21009, 21068, 29384, + 1764, 547, 21151, 21210, 21201, 21132, 29192, 1764, 93, 29774, + 608, 29259, 78, 29789, 1764, 604, 29260, 84, 29780, 1764, + 516, 21062, 21065, 21001, 21000, 21064, 1764, 84, 29780, 1764, + 585, 21063, 21191, 21193, 21065, 21191, 1764, 72, 29859, 1764, + 419, 20573, 20558, 20872, 21320, 21646, 21661, 21347, 20899, 1764, + 221, 21155, 29320, 1764, 95, 20835, 21411, 21663, 21655, 20556, + 20552, 29832, 1764, 95, 20899, 21347, 21663, 21658, 21334, 29270, + 854, 5266, 21644, 21320, 20872, 28749, 1764, 904, 21411, 21283, + 20561, 20559, 21391, 911, 13455, 1764, 136, 21320, 21645, 21652, + 21337, 20889, 20565, 20579, 29859, 1764, 83, 20888, 21336, 21651, + 21645, 21320, 20872, 20557, 20563, 20635, 29347, 1764, 99, 21667, + 29064, 1764, 355, 20575, 20570, 20822, 20562, 20556, 20808, 21384, + 21644, 21650, 21398, 20822, 918, 5274, 21663, 21411, 20835, 1764, + 648, 21584, 21656, 21662, 21347, 20899, 20574, 20568, 20883, 21331, + 21656, 1764, 602, 21210, 21207, 21079, 21082, 21207, 592, 21069, + 21197, 21200, 21072, 21197, 1764, 602, 21146, 21143, 21079, 21082, + 21143, 585, 21132, 21136, 21072, 21071, 21135, 1764, 988, 20628, + 29644, 1764, 1112, 28824, 144, 29776, 1764, 156, 21460, 28812, + 1764, 221, 20704, 20899, 21218, 21471, 21466, 21011, 21007, 521, + 20999, 21127, 21129, 21001, 21127, 1764, 908, 20812, 20560, 20571, + 20831, 21407, 21659, 21651, 21521, 21393, 21331, 21335, 21210, 21018, + 20887, 20883, 21009, 21201, 21331, 1764, 72, 20963, 21219, 29768, + 210, 5074, 1764, 99, 21411, 21663, 21658, 21398, 20566, 918, + 5266, 21644, 21384, 20552, 20579, 1764, 1165, 21320, 20872, 20557, + 20574, 20899, 21347, 29854, 1764, 99, 21347, 21662, 21645, 21320, + 20552, 20579, 1764, 99, 20552, 29832, 86, 13078, 99, 29859, + 1764, 99, 20552, 86, 13078, 99, 29859, 1764, 722, 21650, + 29832, 1165, 4936, 20872, 20557, 20574, 20899, 21347, 29854, 1764, + 99, 28744, 85, 5269, 1160, 29859, 1764, 291, 29603, 611, + 4680, 328, 29576, 1764, 77, 20872, 21256, 21581, 29795, 1764, + 99, 28744, 1160, 20887, 82, 13475, 1764, 99, 20552, 29832, + 1764, 72, 20579, 21077, 21603, 29768, 1764, 72, 20579, 21640, + 29859, 1764, 94, 20899, 21347, 21662, 21645, 21320, 20872, 20557, + 20574, 862, 29859, 1764, 72, 20579, 21411, 21663, 21656, 21396, + 20564, 1764, 94, 20557, 20872, 21320, 21645, 21662, 21347, 20899, + 20574, 536, 29828, 1764, 72, 20579, 21411, 21663, 21657, 21398, + 20566, 918, 13448, 1764, 76, 20808, 21384, 21644, 21649, 21397, + 20822, 20570, 20575, 20835, 21411, 29855, 1764, 648, 21155, 99, + 29923, 1764, 99, 20557, 20872, 21320, 21645, 29859, 1764, 99, + 21064, 29795, 1764, 99, 20808, 21141, 21448, 29923, 1764, 99, + 29832, 72, 29859, 1764, 99, 21079, 29256, 599, 13411, 1764, + 99, 21667, 20552, 29832, 1764, 805, 20965, 20935, 29447, 1764, + 99, 29832, 1764, 421, 21221, 21191, 29063, 1764, 288, 21091, + 29600, 1764, 3, 29891, 1764, 547, 29341, 1764, 279, 21207, + 21396, 21387, 21127, 20807, 20555, 20558, 20753, 21201, 21391, 907, + 13447, 1764, 99, 28744, 76, 4424, 21256, 21516, 21523, 21271, + 20823, 20563, 1764, 981, 21271, 20823, 20563, 20556, 20808, 21256, + 29642, 1764, 1043, 4887, 20823, 20563, 20556, 20808, 21256, 21516, + 1032, 29731, 1764, 80, 5136, 21523, 21271, 20823, 20563, 20556, + 20808, 21256, 29707, 1764, 215, 29591, 456, 20958, 21153, 21409, + 29727, 1764, 67, 20800, 21248, 21508, 29719, 1043, 21271, 20823, + 20563, 20556, 20808, 21256, 21516, 1764, 99, 28744, 83, 4439, + 21271, 21523, 29704, 1764, 541, 21019, 21147, 21149, 21021, 21147, + 533, 21077, 29256, 1764, 541, 21019, 21147, 21149, 21021, 21147, + 533, 21077, 21058, 20928, 20736, 28802, 1764, 99, 28744, 84, + 29530, 342, 13320, 1764, 483, 21089, 21066, 29384, 1764, 87, + 28744, 584, 21076, 84, 4375, 20951, 21076, 21207, 21399, 21588, + 29768, 1764, 87, 28744, 83, 20823, 21271, 21523, 29704, 1764, + 83, 20556, 20808, 21256, 21516, 21523, 21271, 20823, 20563, 1764, + 87, 28736, 83, 20823, 21271, 21523, 21516, 21256, 20808, 20556, + 1764, 1047, 29696, 1036, 21256, 20808, 20556, 20563, 20823, 21271, + 21523, 1764, 87, 28744, 83, 20823, 21271, 29716, 1764, 74, + 20808, 21256, 21514, 21518, 21264, 20816, 20562, 20565, 20823, 21271, + 21461, 1764, 279, 29591, 970, 21320, 21128, 21002, 21025, 1764, + 87, 20556, 20808, 21256, 21516, 1032, 29719, 1764, 151, 21064, + 29719, 1764, 87, 20808, 21077, 21320, 29783, 1764, 151, 29704, + 136, 29719, 1764, 87, 21064, 320, 29783, 1764, 151, 21527, + 20616, 29704, 1764, 805, 21157, 21026, 21017, 20951, 20822, 20949, + 21011, 21001, 21127, 21255, 1764, 611, 29273, 594, 29256, 1764, + 485, 21093, 21218, 21209, 21271, 21398, 21269, 21203, 21193, 21063, + 29127, 1764, 83, 20758, 20950, 21265, 21457, 29844, 1764, 0 +}; + + +/* Greek character index in gchtab */ +short gchidx[] = { /* character index in gchtab */ + 1, 3, 16, 29, 38, 77, 107, 154, 162, 181, 200, 205, + 212, 233, 240, 246, 259, 297, 306, 348, 392, 402, 437, 483, + 510, 568, 614, 645, 658, 666, 673, 681, 688, 741, 767, 793, + 795, 806, 821, 863, 874, 883, 888, 899, 901, 912, 921, 930, + 972, 987, 1037, 1067, 1083, 1088, 1117, 1143, 1182, 1207, 1242, 1244, + 1253, 1256, 1265, 1267, 1276, 1284, 1321, 1373, 1394, 1436, 1465, 1500, + 1520, 1549, 1563, 1605, 1630, 1650, 1674, 1694, 1724, 1741, 1783, 1812, + 1844, 1857, 1886, 1888, 1929, 1970, 2001, 2031, 2069, 2074, 2112, 2121, +}; + +/* Width data. */ +short gchwid[] = { /* width data in gchtab */ + 21, 15, 15, 26, 25, 29, 30, 15, 19, 19, + 27, 29, 30, 29, 15, 31, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 29, 15, 29, 31, + 29, 31, 32, 25, 30, 21, 25, 29, 26, 23, + 26, 19, 25, 21, 25, 21, 21, 27, 29, 27, + 29, 26, 19, 24, 25, 27, 27, 28, 21, 19, + 19, 19, 21, 31, 27, 28, 26, 23, 24, 23, + 27, 25, 27, 17, 24, 25, 25, 28, 25, 23, + 27, 28, 24, 26, 25, 25, 21, 28, 22, 28, + 23, 19, 19, 19, 31, 19 +}; + +/* Stroke data. */ +short gchtab[] = { /* stroke data in gchtab */ + 35, 0, 220, 4250, 4302, 4378, 4316, 218, 4308, 201, + 4232, 4295, 4360, 4297, 0, 213, 4244, 4307, 4372, 4309, + 199, 4232, 4297, 4360, 4358, 4292, 4227, 0, 604, 4224, + 988, 4608, 145, 5137, 75, 5067, 0, 416, 4483, 672, + 4739, 921, 4952, 5015, 5080, 5081, 4955, 4764, 4508, 4315, + 4185, 4183, 4245, 4308, 4435, 4817, 4944, 5070, 87, 4309, + 4436, 4818, 4945, 5008, 5070, 5066, 4936, 4743, 4487, 4296, + 4170, 4171, 4236, 4299, 4234, 0, 1244, 4167, 412, 4634, + 4632, 4566, 4437, 4309, 4183, 4185, 4251, 4380, 4508, 4635, + 4826, 5018, 5211, 5340, 974, 4941, 4875, 4873, 4999, 5127, + 5256, 5322, 5324, 5198, 5070, 0, 1236, 5267, 5330, 5395, + 5396, 5333, 5269, 5204, 5138, 5005, 4874, 4744, 4615, 4423, + 4232, 4170, 4173, 4239, 4627, 4757, 4823, 4825, 4763, 4636, + 4507, 4441, 4439, 4500, 4625, 4938, 5064, 5255, 5319, 5384, + 5385, 327, 4296, 4234, 4237, 4303, 4433, 343, 4501, 5002, + 5128, 5255, 0, 218, 4251, 4316, 4379, 4377, 4311, 4246, + 0, 608, 4574, 4443, 4311, 4242, 4238, 4297, 4421, 4546, + 4672, 478, 4442, 4375, 4306, 4302, 4361, 4422, 4546, 0, + 96, 4318, 4443, 4567, 4626, 4622, 4553, 4421, 4290, 4160, + 222, 4442, 4503, 4562, 4558, 4489, 4422, 4290, 0, 151, + 5129, 1047, 4233, 0, 664, 4743, 144, 5264, 135, 5255, + 0, 1227, 5195, 5068, 4942, 4754, 4691, 4564, 4436, 4307, + 4241, 4239, 4301, 4428, 4556, 4685, 4750, 4946, 5076, 5205, + 5333, 0, 664, 4743, 152, 5272, 144, 5264, 0, 201, + 4232, 4295, 4360, 4297, 0, 729, 4760, 4823, 4888, 4825, + 144, 5392, 713, 4744, 4807, 4872, 4809, 0, 476, 4379, + 4248, 4179, 4176, 4235, 4360, 4551, 4679, 4872, 5003, 5072, + 5075, 5016, 4891, 4700, 4572, 476, 4443, 4378, 4312, 4243, + 4240, 4299, 4361, 4424, 4551, 583, 4808, 4873, 4939, 5008, + 5011, 4952, 4890, 4827, 4700, 0, 280, 4505, 4700, 4679, + 539, 4615, 263, 4935, 0, 152, 4311, 4246, 4183, 4184, + 4250, 4315, 4508, 4764, 4955, 5018, 5080, 5078, 5012, 4818, + 4496, 4367, 4237, 4170, 4167, 668, 4891, 4954, 5016, 5014, + 4948, 4754, 4496, 73, 4234, 4362, 4680, 4872, 5001, 5066, + 266, 4679, 4935, 5000, 5066, 5068, 0, 152, 4311, 4246, + 4183, 4184, 4250, 4315, 4508, 4764, 4955, 5017, 5014, 4948, + 4755, 4563, 668, 4891, 4953, 4950, 4884, 4755, 659, 4882, + 5008, 5070, 5067, 5001, 4936, 4743, 4487, 4296, 4233, 4171, + 4172, 4237, 4300, 4235, 849, 5006, 5003, 4937, 4872, 4743, + 0, 666, 4743, 732, 4807, 732, 4109, 5133, 455, 4999, + 0, 220, 4178, 82, 4308, 4501, 4693, 4884, 5010, 5071, + 5069, 5002, 4872, 4679, 4487, 4296, 4233, 4171, 4172, 4237, + 4300, 4235, 597, 4820, 4946, 5007, 5005, 4938, 4808, 4679, + 220, 4956, 219, 4635, 4956, 0, 857, 4888, 4951, 5016, + 5017, 4955, 4828, 4636, 4443, 4313, 4247, 4179, 4173, 4234, + 4360, 4551, 4679, 4872, 5002, 5069, 5070, 5009, 4883, 4692, + 4628, 4435, 4305, 4238, 540, 4507, 4377, 4311, 4243, 4237, + 4298, 4424, 4551, 583, 4808, 4938, 5005, 5006, 4945, 4819, + 4692, 0, 92, 4182, 88, 4250, 4380, 4508, 4825, 4953, + 5018, 5084, 154, 4379, 4507, 4825, 988, 5081, 5014, 4753, + 4687, 4620, 4615, 918, 4689, 4623, 4556, 4551, 0, 412, + 4315, 4249, 4246, 4308, 4499, 4755, 4948, 5014, 5017, 4955, + 4764, 4508, 412, 4379, 4313, 4310, 4372, 4499, 659, 4884, + 4950, 4953, 4891, 4764, 403, 4306, 4241, 4175, 4171, 4233, + 4296, 4487, 4743, 4936, 5001, 5067, 5071, 5009, 4946, 4755, + 403, 4370, 4305, 4239, 4235, 4297, 4360, 4487, 647, 4872, + 4937, 5003, 5007, 4945, 4882, 4755, 0, 917, 4946, 4816, + 4623, 4559, 4368, 4242, 4181, 4182, 4249, 4379, 4572, 4700, + 4891, 5017, 5078, 5072, 5004, 4938, 4808, 4615, 4423, 4296, + 4234, 4235, 4300, 4363, 4298, 463, 4432, 4306, 4245, 4246, + 4313, 4443, 4572, 604, 4827, 4953, 5014, 5008, 4940, 4874, + 4744, 4615, 0, 1247, 5278, 5341, 5406, 5407, 5344, 5216, + 5087, 4957, 4891, 4824, 4756, 4616, 4548, 4482, 926, 4956, + 4888, 4748, 4680, 4613, 4547, 4417, 4288, 4160, 4097, 4098, + 4163, 4226, 4161, 0, 213, 4244, 4307, 4372, 4309, 199, + 4232, 4297, 4360, 4358, 4292, 4227, 0, 1180, 4245, 5262, + 140, 5260, 135, 5255, 0, 149, 5397, 144, 5392, 139, + 5387, 0, 156, 5269, 4238, 140, 5260, 135, 5255, 0, + 1177, 4359, 147, 5395, 141, 5389, 0, 1044, 5078, 4951, + 4759, 4630, 4565, 4498, 4495, 4557, 4684, 4876, 5005, 5071, + 663, 4629, 4562, 4559, 4621, 4684, 1047, 5071, 5069, 5196, + 5324, 5454, 5521, 5523, 5462, 5400, 5274, 5147, 4956, 4764, + 4571, 4442, 4312, 4246, 4179, 4176, 4237, 4299, 4425, 4552, + 4743, 4935, 5128, 5257, 5322, 1111, 5135, 5133, 5196, 0, + 473, 4167, 601, 5063, 537, 4999, 205, 4877, 7, 4423, + 711, 5191, 480, 4447, 4381, 4379, 4441, 4568, 4696, 4825, + 4891, 4893, 4831, 4704, 4576, 0, 1295, 5325, 5196, 5068, + 4941, 4878, 4690, 4627, 4500, 4372, 4243, 4177, 4175, 4237, + 4364, 4492, 4621, 4686, 4882, 4947, 5076, 5204, 5331, 5393, + 5391, 0, 35, 0, 540, 4103, 540, 5127, 537, 5063, + 72, 5064, 7, 5127, 0, 1176, 4824, 4567, 4438, 4308, + 4241, 4239, 4300, 4426, 4553, 4808, 5256, 144, 5008, 0, + 540, 4615, 604, 4679, 407, 4310, 4245, 4179, 4176, 4238, + 4301, 4492, 4812, 5005, 5070, 5136, 5139, 5077, 5014, 4823, + 4503, 407, 4374, 4309, 4243, 4240, 4302, 4365, 4492, 716, + 4941, 5006, 5072, 5075, 5013, 4950, 4823, 348, 4892, 327, + 4871, 0, 220, 4295, 284, 4359, 28, 5084, 5078, 5020, + 7, 4551, 0, 608, 4224, 992, 4608, 147, 5139, 77, + 5069, 0, 160, 4224, 544, 4608, 0, 28, 4615, 92, + 4617, 1052, 4615, 28, 5148, 91, 5083, 0, 35, 0, + 540, 4167, 540, 5063, 537, 4999, 7, 4423, 711, 5191, + 0, 278, 4505, 4630, 83, 4504, 4819, 408, 4487, 0, + 266, 4487, 4618, 77, 4488, 4813, 409, 4488, 0, 540, + 4443, 4313, 4247, 4179, 4176, 4236, 4298, 4424, 4615, 4743, + 4936, 5066, 5132, 5200, 5203, 5143, 5081, 4955, 4764, 4636, + 540, 4507, 4377, 4311, 4243, 4240, 4300, 4362, 4488, 4615, + 647, 4872, 5002, 5068, 5136, 5139, 5079, 5017, 4891, 4764, + 0, 220, 4295, 284, 4359, 1052, 5127, 1116, 5191, 28, + 5404, 7, 4551, 839, 5383, 0, 540, 4443, 4313, 4247, + 4179, 4176, 4236, 4298, 4424, 4615, 4743, 4936, 5066, 5132, + 5200, 5203, 5143, 5081, 4955, 4764, 4636, 540, 4507, 4377, + 4311, 4243, 4240, 4300, 4362, 4488, 4615, 647, 4872, 5002, + 5068, 5136, 5139, 5079, 5017, 4891, 4764, 405, 4494, 789, + 4878, 402, 4882, 401, 4881, 0, 1244, 4167, 412, 4634, + 4632, 4566, 4437, 4309, 4183, 4185, 4251, 4380, 4508, 4635, + 4826, 5018, 5211, 5340, 974, 4941, 4875, 4873, 4999, 5127, + 5256, 5322, 5324, 5198, 5070, 0, 92, 4626, 4103, 28, + 4562, 28, 5084, 5142, 5020, 72, 5000, 7, 5063, 5133, + 4999, 0, 160, 4224, 544, 4608, 0, 23, 4121, 4187, + 4252, 4380, 4443, 4505, 4565, 4551, 25, 4251, 4379, 4505, + 983, 5081, 5019, 4956, 4828, 4763, 4697, 4629, 4615, 985, + 4955, 4827, 4697, 263, 4807, 0, 473, 4167, 601, 5063, + 537, 4999, 205, 4877, 7, 4423, 711, 5191, 480, 4447, + 4381, 4379, 4441, 4568, 4696, 4825, 4891, 4893, 4831, 4704, + 4576, 0, 74, 4231, 4487, 4363, 4239, 4178, 4182, 4249, + 4379, 4572, 4828, 5019, 5145, 5206, 5202, 5135, 5003, 4871, + 5127, 5194, 267, 4302, 4242, 4246, 4313, 4443, 4572, 732, + 4955, 5081, 5142, 5138, 5070, 5003, 136, 4424, 840, 5128, + 0, 157, 4184, 1117, 5144, 404, 4431, 852, 4879, 139, + 4166, 1099, 5126, 155, 5147, 154, 5146, 402, 4882, 401, + 4881, 137, 5129, 136, 5128, 0, 604, 4679, 668, 4743, + 21, 4182, 4309, 4369, 4431, 4494, 4621, 86, 4245, 4305, + 4367, 4430, 4621, 4813, 5006, 5071, 5137, 5205, 5270, 717, + 4942, 5007, 5073, 5141, 5270, 5333, 412, 4956, 391, 4935, + 0, 35, 0, 160, 4224, 224, 4288, 160, 4704, 128, + 4672, 0, 28, 4868, 0, 480, 4544, 544, 4608, 96, + 4640, 64, 4608, 0, 35, 0, 1106, 5392, 5198, 917, + 5328, 5003, 144, 5328, 0, 85, 4437, 4809, 277, 4807, + 1312, 4807, 0, 533, 4436, 4306, 4240, 4173, 4170, 4232, + 4423, 4551, 4680, 4875, 5006, 5138, 5205, 533, 4500, 4370, + 4304, 4237, 4234, 4296, 4423, 533, 4757, 4884, 4946, 5066, + 5128, 5191, 661, 4820, 4882, 5002, 5064, 5191, 5255, 0, + 732, 4635, 4505, 4373, 4306, 4238, 4168, 4096, 732, 4699, + 4569, 4437, 4370, 4302, 4232, 4160, 732, 4956, 5083, 5146, + 5143, 5077, 5012, 4819, 4563, 860, 5082, 5079, 5013, 4948, + 4819, 467, 4818, 4944, 5006, 5003, 4937, 4872, 4679, 4551, + 4424, 4361, 4300, 467, 4754, 4880, 4942, 4939, 4873, 4808, + 4679, 0, 21, 4245, 4372, 4434, 4739, 4801, 4864, 149, + 4308, 4370, 4675, 4737, 4864, 4992, 981, 5011, 4880, 4229, + 4098, 4096, 0, 724, 4693, 4565, 4372, 4241, 4174, 4171, + 4233, 4296, 4423, 4551, 4744, 4875, 4942, 4945, 4883, 4632, + 4570, 4572, 4637, 4765, 4892, 5018, 469, 4436, 4305, 4238, + 4234, 4296, 455, 4680, 4811, 4878, 4882, 4820, 4695, 4633, + 4635, 4700, 4828, 5018, 0, 850, 4820, 4693, 4437, 4308, + 4306, 4432, 4623, 341, 4372, 4370, 4496, 4623, 527, 4302, + 4172, 4170, 4232, 4423, 4615, 4744, 4874, 527, 4366, 4236, + 4234, 4296, 4423, 0, 404, 4371, 4241, 4174, 4171, 4233, + 4296, 4423, 4615, 4808, 5002, 5133, 5200, 5203, 5077, 4949, + 4819, 4687, 4554, 4352, 75, 4297, 4424, 4616, 4809, 5003, + 5133, 1107, 5076, 4948, 4818, 4687, 4553, 4416, 0, 277, + 4231, 341, 4367, 4298, 4231, 981, 5009, 4877, 1045, 5074, + 5008, 4877, 4747, 4553, 4424, 4231, 85, 4437, 0, 17, + 4115, 4245, 4437, 4500, 4498, 4430, 4295, 277, 4436, 4434, + 4366, 4231, 334, 4562, 4692, 4821, 4949, 5076, 5139, 5136, + 5067, 4864, 853, 5075, 5072, 5003, 4800, 0, 277, 4238, + 4170, 4168, 4231, 4423, 4553, 4619, 341, 4302, 4234, 4232, + 4295, 0, 848, 4883, 4820, 4693, 4565, 4372, 4241, 4174, + 4171, 4233, 4296, 4423, 4551, 4744, 4874, 4941, 5010, 5015, + 4954, 4891, 4764, 4572, 4443, 4378, 4377, 4441, 4442, 469, + 4436, 4305, 4238, 4234, 4296, 455, 4680, 4810, 4877, 4946, + 4951, 4890, 4764, 0, 277, 4103, 341, 4167, 917, 5076, + 5140, 5077, 4949, 4820, 4560, 4431, 4303, 335, 4558, 4680, + 4743, 335, 4494, 4616, 4679, 4807, 4936, 5067, 0, 92, + 4316, 4443, 4506, 4568, 4938, 5000, 5063, 220, 4442, 4504, + 4874, 4936, 5063, 5127, 533, 4103, 533, 4167, 0, 341, + 4096, 405, 4096, 338, 4364, 4361, 4487, 4615, 4744, 4874, + 5005, 1045, 4938, 4936, 4999, 5191, 5321, 5387, 1109, 5002, + 5000, 5063, 0, 277, 4231, 341, 4367, 4298, 4231, 981, + 5009, 4877, 1045, 5074, 5008, 4877, 4747, 4553, 4424, 4231, + 85, 4437, 0, 469, 4372, 4241, 4174, 4171, 4233, 4296, + 4423, 4551, 4744, 4875, 4942, 4945, 4883, 4820, 4693, 4565, + 469, 4436, 4305, 4238, 4234, 4296, 455, 4680, 4811, 4878, + 4882, 4820, 0, 468, 4295, 468, 4359, 852, 4935, 852, + 4999, 18, 4244, 4437, 5269, 18, 4243, 4436, 5268, 0, + 17, 4115, 4245, 4437, 4500, 4498, 4429, 4426, 4488, 4551, + 277, 4436, 4434, 4365, 4362, 4424, 4551, 4679, 4808, 4938, + 5069, 5136, 5205, 5209, 5147, 5020, 4892, 4762, 4760, 4821, + 4946, 5072, 5262, 712, 4939, 5005, 5072, 5141, 5145, 5083, + 5020, 0, 140, 4297, 4360, 4487, 4615, 4808, 4939, 5006, + 5009, 4947, 4884, 4757, 4629, 4436, 4305, 4238, 4096, 519, + 4744, 4875, 4942, 4946, 4884, 533, 4500, 4369, 4302, 4096, + 0, 1109, 4565, 4372, 4241, 4174, 4171, 4233, 4296, 4423, + 4551, 4744, 4875, 4942, 4945, 4883, 4820, 4693, 469, 4436, + 4305, 4238, 4234, 4296, 455, 4680, 4811, 4878, 4882, 4820, + 724, 5204, 0, 596, 4487, 596, 4551, 18, 4244, 4437, + 5141, 18, 4243, 4436, 5140, 0, 17, 4115, 4245, 4437, + 4500, 4498, 4364, 4361, 4487, 277, 4436, 4434, 4300, 4297, + 4360, 4487, 4551, 4744, 4874, 5005, 5072, 5075, 5013, 4948, + 5011, 5072, 909, 5075, 0, 35, 0, 145, 4371, 4564, + 4501, 4372, 4241, 4174, 4171, 4232, 4295, 4423, 4552, 4683, + 4750, 75, 4233, 4296, 4424, 4553, 4683, 590, 4683, 4744, + 4807, 4935, 5064, 5195, 5262, 5265, 5204, 5141, 5076, 5203, + 5265, 587, 4745, 4808, 4936, 5065, 5195, 0, 604, 4571, + 4506, 4505, 4568, 4759, 4951, 663, 4502, 4373, 4307, 4305, + 4431, 4622, 4814, 663, 4566, 4437, 4371, 4369, 4495, 4622, + 526, 4365, 4236, 4170, 4168, 4294, 4612, 4675, 4673, 4544, + 4416, 526, 4429, 4300, 4234, 4232, 4358, 4612, 0, 860, + 4544, 924, 4480, 17, 4115, 4245, 4437, 4500, 4498, 4429, + 4426, 4552, 4744, 4873, 5068, 5199, 277, 4436, 4434, 4365, + 4362, 4424, 4551, 4743, 4872, 5002, 5133, 5199, 5333, 0, + 604, 4571, 4506, 4505, 4568, 4759, 5079, 5080, 4887, 4629, + 4435, 4240, 4173, 4171, 4233, 4423, 4613, 4675, 4673, 4608, + 4480, 4417, 662, 4499, 4304, 4237, 4235, 4297, 4423, 0, + 480, 4447, 4382, 4316, 4314, 4376, 4439, 4501, 4499, 4369, + 351, 4381, 4379, 4441, 4504, 4566, 4564, 4498, 4240, 4494, + 4556, 4554, 4488, 4423, 4357, 4355, 4417, 271, 4493, 4491, + 4425, 4360, 4294, 4292, 4354, 4417, 4544, 0, 160, 4224, + 544, 4608, 0, 224, 4447, 4510, 4572, 4570, 4504, 4439, + 4373, 4371, 4497, 351, 4509, 4507, 4441, 4376, 4310, 4308, + 4370, 4624, 4366, 4300, 4298, 4360, 4423, 4485, 4483, 4417, + 399, 4365, 4363, 4425, 4488, 4550, 4548, 4482, 4417, 4288, + 0, 338, 4240, 4430, 533, 4304, 4619, 208, 5392, 0, + 284, 4251, 4185, 4183, 4245, 4372, 4500, 4629, 4695, 4697, + 4635, 4508, 4380, 0, +}; + + +/* Times Font data. */ +short timidx[] = { /* character index in timtab */ + 1, 3, 16, 33, 42, 81, 111, 158, 163, 182, 201, 208, + 213, 221, 224, 230, 233, 271, 280, 322, 366, 376, 411, 457, + 484, 542, 588, 599, 612, 616, 621, 625, 655, 708, 721, 761, + 792, 819, 836, 851, 887, 906, 915, 933, 952, 963, 984, 999, + 1041, 1066, 1126, 1165, 1198, 1211, 1231, 1242, 1259, 1274, 1289, 1302, + 1311, 1314, 1323, 1330, 1333, 1339, 1375, 1404, 1431, 1462, 1491, 1510, + 1565, 1587, 1601, 1623, 1642, 1651, 1686, 1708, 1742, 1773, 1802, 1821, + 1852, 1866, 1888, 1899, 1916, 1931, 1949, 1962, 2000, 2003, 2041, 2064, +}; + +/* Width data. */ +short timwid[] = { /* width data in timtab */ + 21, 15, 23, 26, 25, 29, 30, 13, 19, 19, + 21, 31, 13, 31, 13, 27, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 13, 13, 29, 31, + 29, 23, 32, 25, 27, 26, 27, 26, 25, 28, + 29, 16, 20, 27, 23, 32, 28, 27, 27, 27, + 27, 25, 24, 29, 25, 29, 25, 26, 25, 19, + 19, 19, 27, 25, 17, 25, 26, 24, 26, 24, + 18, 24, 27, 16, 16, 26, 16, 36, 27, 25, + 26, 25, 22, 22, 20, 27, 23, 29, 25, 24, + 23, 19, 13, 19, 29, 21 +}; + +/* Stroke data. */ +short timtab[] = { /* stroke data in timtab */ + 35, 0, 220, 4250, 4302, 4378, 4316, 218, 4308, 201, + 4232, 4295, 4360, 4297, 0, 220, 4251, 4245, 219, 4245, + 220, 4379, 4245, 796, 4827, 4821, 795, 4821, 796, 4955, + 4821, 0, 608, 4224, 992, 4608, 147, 5139, 77, 5069, + 0, 416, 4483, 672, 4739, 921, 4952, 5015, 5080, 5081, + 4955, 4764, 4508, 4315, 4185, 4183, 4245, 4308, 4435, 4817, + 4944, 5070, 87, 4309, 4436, 4818, 4945, 5008, 5070, 5066, + 4936, 4743, 4487, 4296, 4170, 4171, 4236, 4299, 4234, 0, + 1244, 4167, 412, 4634, 4632, 4566, 4437, 4309, 4183, 4185, + 4251, 4380, 4508, 4635, 4826, 5018, 5211, 5340, 974, 4941, + 4875, 4873, 4999, 5127, 5256, 5322, 5324, 5198, 5070, 0, + 1236, 5267, 5330, 5395, 5396, 5333, 5269, 5204, 5138, 5005, + 4874, 4744, 4615, 4423, 4232, 4170, 4173, 4239, 4627, 4757, + 4823, 4825, 4763, 4636, 4507, 4441, 4439, 4500, 4625, 4938, + 5064, 5255, 5319, 5384, 5385, 327, 4296, 4234, 4237, 4303, + 4433, 343, 4501, 5002, 5128, 5255, 0, 156, 4181, 220, + 4181, 0, 608, 4574, 4443, 4311, 4242, 4238, 4297, 4421, + 4546, 4672, 478, 4442, 4375, 4306, 4302, 4361, 4422, 4546, + 0, 96, 4318, 4443, 4567, 4626, 4622, 4553, 4421, 4290, + 4160, 222, 4442, 4503, 4562, 4558, 4489, 4422, 4290, 0, + 406, 4490, 83, 4813, 723, 4173, 0, 729, 4807, 144, + 5392, 0, 203, 4234, 4171, 4236, 4299, 4297, 4167, 0, + 144, 5392, 0, 140, 4171, 4234, 4299, 4236, 0, 1184, + 4096, 0, 476, 4379, 4248, 4179, 4176, 4235, 4360, 4551, + 4679, 4872, 5003, 5072, 5075, 5016, 4891, 4700, 4572, 476, + 4443, 4378, 4312, 4243, 4240, 4299, 4361, 4424, 4551, 583, + 4808, 4873, 4939, 5008, 5011, 4952, 4890, 4827, 4700, 0, + 280, 4505, 4700, 4679, 539, 4615, 263, 4935, 0, 152, + 4311, 4246, 4183, 4184, 4250, 4315, 4508, 4764, 4955, 5018, + 5080, 5078, 5012, 4818, 4496, 4367, 4237, 4170, 4167, 668, + 4891, 4954, 5016, 5014, 4948, 4754, 4496, 73, 4234, 4362, + 4680, 4872, 5001, 5066, 266, 4679, 4935, 5000, 5066, 5068, + 0, 152, 4311, 4246, 4183, 4184, 4250, 4315, 4508, 4764, + 4955, 5017, 5014, 4948, 4755, 4563, 668, 4891, 4953, 4950, + 4884, 4755, 659, 4882, 5008, 5070, 5067, 5001, 4936, 4743, + 4487, 4296, 4233, 4171, 4172, 4237, 4300, 4235, 849, 5006, + 5003, 4937, 4872, 4743, 0, 666, 4743, 732, 4807, 732, + 4109, 5133, 455, 4999, 0, 220, 4178, 82, 4308, 4501, + 4693, 4884, 5010, 5071, 5069, 5002, 4872, 4679, 4487, 4296, + 4233, 4171, 4172, 4237, 4300, 4235, 597, 4820, 4946, 5007, + 5005, 4938, 4808, 4679, 220, 4956, 219, 4635, 4956, 0, + 857, 4888, 4951, 5016, 5017, 4955, 4828, 4636, 4443, 4313, + 4247, 4179, 4173, 4234, 4360, 4551, 4679, 4872, 5002, 5069, + 5070, 5009, 4883, 4692, 4628, 4435, 4305, 4238, 540, 4507, + 4377, 4311, 4243, 4237, 4298, 4424, 4551, 583, 4808, 4938, + 5005, 5006, 4945, 4819, 4692, 0, 92, 4182, 88, 4250, + 4380, 4508, 4825, 4953, 5018, 5084, 154, 4379, 4507, 4825, + 988, 5081, 5014, 4753, 4687, 4620, 4615, 918, 4689, 4623, + 4556, 4551, 0, 412, 4315, 4249, 4246, 4308, 4499, 4755, + 4948, 5014, 5017, 4955, 4764, 4508, 412, 4379, 4313, 4310, + 4372, 4499, 659, 4884, 4950, 4953, 4891, 4764, 403, 4306, + 4241, 4175, 4171, 4233, 4296, 4487, 4743, 4936, 5001, 5067, + 5071, 5009, 4946, 4755, 403, 4370, 4305, 4239, 4235, 4297, + 4360, 4487, 647, 4872, 4937, 5003, 5007, 4945, 4882, 4755, + 0, 917, 4946, 4816, 4623, 4559, 4368, 4242, 4181, 4182, + 4249, 4379, 4572, 4700, 4891, 5017, 5078, 5072, 5004, 4938, + 4808, 4615, 4423, 4296, 4234, 4235, 4300, 4363, 4298, 463, + 4432, 4306, 4245, 4246, 4313, 4443, 4572, 604, 4827, 4953, + 5014, 5008, 4940, 4874, 4744, 4615, 0, 147, 4178, 4241, + 4306, 4243, 140, 4171, 4234, 4299, 4236, 0, 147, 4178, + 4241, 4306, 4243, 203, 4234, 4171, 4236, 4299, 4297, 4167, + 0, 1177, 4240, 5255, 0, 147, 5395, 141, 5389, 0, + 153, 5264, 4231, 0, 152, 4311, 4246, 4183, 4184, 4250, + 4315, 4444, 4636, 4827, 4890, 4952, 4950, 4884, 4819, 4561, + 4558, 540, 4763, 4826, 4888, 4886, 4820, 4690, 457, 4488, + 4551, 4616, 4553, 0, 1044, 5078, 4951, 4759, 4630, 4565, + 4498, 4495, 4557, 4684, 4876, 5005, 5071, 663, 4629, 4562, + 4559, 4621, 4684, 1047, 5071, 5069, 5196, 5324, 5454, 5521, + 5523, 5462, 5400, 5274, 5147, 4956, 4764, 4571, 4442, 4312, + 4246, 4179, 4176, 4237, 4299, 4425, 4552, 4743, 4935, 5128, + 5257, 5322, 1111, 5135, 5133, 5196, 0, 540, 4167, 540, + 5063, 537, 4999, 205, 4877, 7, 4423, 711, 5191, 0, + 220, 4295, 284, 4359, 28, 4892, 5083, 5146, 5208, 5206, + 5140, 5075, 4882, 796, 5019, 5082, 5144, 5142, 5076, 5011, + 4882, 274, 4882, 5073, 5136, 5198, 5195, 5129, 5064, 4871, + 4103, 786, 5009, 5072, 5134, 5131, 5065, 5000, 4871, 0, + 985, 5142, 5148, 5081, 4955, 4764, 4636, 4443, 4313, 4247, + 4180, 4175, 4236, 4298, 4424, 4615, 4743, 4936, 5066, 5132, + 540, 4507, 4377, 4311, 4244, 4239, 4300, 4362, 4488, 4615, + 0, 220, 4295, 284, 4359, 28, 4764, 4955, 5081, 5143, + 5204, 5199, 5132, 5066, 4936, 4743, 4103, 668, 4891, 5017, + 5079, 5140, 5135, 5068, 5002, 4872, 4743, 0, 220, 4295, + 284, 4359, 662, 4750, 28, 5148, 5142, 5084, 274, 4754, + 7, 5127, 5133, 5063, 0, 220, 4295, 284, 4359, 662, + 4750, 28, 5148, 5142, 5084, 274, 4754, 7, 4551, 0, + 985, 5142, 5148, 5081, 4955, 4764, 4636, 4443, 4313, 4247, + 4180, 4175, 4236, 4298, 4424, 4615, 4743, 4936, 5066, 540, + 4507, 4377, 4311, 4244, 4239, 4300, 4362, 4488, 4615, 975, + 5063, 1039, 5127, 783, 5327, 0, 220, 4295, 284, 4359, + 1052, 5127, 1116, 5191, 28, 4572, 860, 5404, 274, 5138, + 7, 4551, 839, 5383, 0, 220, 4295, 284, 4359, 28, + 4572, 7, 4551, 0, 540, 4619, 4552, 4423, 4295, 4168, + 4106, 4108, 4173, 4236, 4171, 476, 4555, 4488, 4423, 284, + 4828, 0, 220, 4295, 284, 4359, 1116, 4367, 595, 5191, + 531, 5127, 28, 4572, 860, 5340, 7, 4551, 839, 5319, + 0, 220, 4295, 284, 4359, 28, 4572, 7, 5063, 5069, + 4999, 0, 220, 4295, 284, 4746, 220, 4743, 1116, 4743, + 1116, 5191, 1180, 5255, 28, 4380, 1116, 5468, 7, 4487, + 903, 5447, 0, 220, 4295, 284, 5129, 282, 5127, 1052, + 5127, 28, 4380, 860, 5340, 7, 4487, 0, 540, 4443, + 4313, 4247, 4179, 4176, 4236, 4298, 4424, 4615, 4743, 4936, + 5066, 5132, 5200, 5203, 5143, 5081, 4955, 4764, 4636, 540, + 4507, 4377, 4311, 4243, 4240, 4300, 4362, 4488, 4615, 647, + 4872, 5002, 5068, 5136, 5139, 5079, 5017, 4891, 4764, 0, + 220, 4295, 284, 4359, 28, 4892, 5083, 5146, 5208, 5205, + 5139, 5074, 4881, 4369, 796, 5019, 5082, 5144, 5141, 5075, + 5010, 4881, 7, 4551, 0, 540, 4443, 4313, 4247, 4179, + 4176, 4236, 4298, 4424, 4615, 4743, 4936, 5066, 5132, 5200, + 5203, 5143, 5081, 4955, 4764, 4636, 540, 4507, 4377, 4311, + 4243, 4240, 4300, 4362, 4488, 4615, 647, 4872, 5002, 5068, + 5136, 5139, 5079, 5017, 4891, 4764, 329, 4426, 4492, 4621, + 4685, 4812, 4874, 4931, 4994, 5122, 5188, 5189, 778, 4934, + 4996, 5059, 5123, 5188, 0, 220, 4295, 284, 4359, 28, + 4892, 5083, 5146, 5208, 5206, 5140, 5075, 4882, 4370, 796, + 5019, 5082, 5144, 5142, 5076, 5011, 4882, 7, 4551, 594, + 4817, 4880, 5065, 5128, 5192, 5257, 721, 4879, 5000, 5063, + 5191, 5257, 5258, 0, 921, 5084, 5078, 5017, 4891, 4700, + 4508, 4315, 4185, 4183, 4245, 4308, 4435, 4817, 4944, 5070, + 87, 4309, 4436, 4818, 4945, 5008, 5070, 5066, 4936, 4743, + 4551, 4360, 4234, 4173, 4167, 4234, 0, 476, 4551, 540, + 4615, 92, 4118, 4124, 5084, 5078, 5020, 263, 4807, 0, + 220, 4301, 4362, 4488, 4679, 4807, 5000, 5130, 5197, 5212, + 284, 4365, 4426, 4552, 4679, 28, 4572, 924, 5404, 0, + 92, 4615, 156, 4618, 988, 4615, 28, 4444, 732, 5212, + 0, 156, 4487, 220, 4492, 668, 4487, 668, 4999, 732, + 5004, 1180, 4999, 28, 4508, 988, 5468, 0, 92, 4999, + 156, 5063, 988, 4167, 28, 4444, 732, 5212, 7, 4423, + 711, 5191, 0, 92, 4625, 4615, 156, 4689, 4679, 1052, + 4689, 28, 4444, 796, 5276, 327, 4871, 0, 924, 4167, + 988, 4231, 156, 4182, 4188, 5084, 71, 5063, 5069, 4999, + 0, 160, 4224, 224, 4288, 160, 4704, 128, 4672, 0, + 28, 4868, 0, 480, 4544, 544, 4608, 96, 4640, 64, + 4608, 0, 78, 4691, 5198, 78, 4690, 5198, 0, 0, + 5248, 0, 156, 4566, 156, 4187, 4566, 0, 211, 4306, + 4242, 4243, 4308, 4437, 4693, 4820, 4883, 4945, 4938, 5000, + 5063, 787, 4874, 4936, 5063, 5127, 785, 4816, 4431, 4238, + 4172, 4170, 4232, 4423, 4615, 4744, 4874, 335, 4302, 4236, + 4234, 4296, 4423, 0, 220, 4295, 284, 4359, 274, 4500, + 4629, 4757, 4948, 5074, 5135, 5133, 5066, 4936, 4743, 4615, + 4488, 4362, 661, 4884, 5010, 5071, 5069, 5002, 4872, 4743, + 28, 4380, 0, 850, 4881, 4944, 5009, 5010, 4884, 4757, + 4565, 4372, 4242, 4175, 4173, 4234, 4360, 4551, 4679, 4872, + 5002, 469, 4436, 4306, 4239, 4237, 4298, 4424, 4551, 0, + 860, 4935, 924, 4999, 850, 4820, 4693, 4565, 4372, 4242, + 4175, 4173, 4234, 4360, 4551, 4679, 4808, 4938, 469, 4436, + 4306, 4239, 4237, 4298, 4424, 4551, 668, 5020, 839, 5191, + 0, 143, 5007, 5009, 4947, 4884, 4757, 4565, 4372, 4242, + 4175, 4173, 4234, 4360, 4551, 4679, 4872, 5002, 847, 4946, + 4884, 469, 4436, 4306, 4239, 4237, 4298, 4424, 4551, 0, + 539, 4570, 4633, 4698, 4699, 4636, 4508, 4379, 4313, 4295, + 412, 4443, 4377, 4359, 21, 4629, 7, 4551, 0, 405, + 4372, 4307, 4241, 4239, 4301, 4364, 4491, 4619, 4748, 4813, + 4879, 4881, 4819, 4756, 4629, 4501, 276, 4306, 4302, 4364, + 652, 4814, 4818, 4756, 723, 4884, 5013, 5012, 4884, 205, + 4236, 4170, 4169, 4231, 4422, 4742, 4933, 4996, 73, 4232, + 4423, 4743, 4934, 4996, 4995, 4929, 4736, 4352, 4161, 4099, + 4100, 4166, 4359, 0, 220, 4295, 284, 4359, 274, 4500, + 4693, 4821, 5012, 5074, 5063, 725, 4948, 5010, 4999, 28, + 4380, 7, 4551, 711, 5255, 0, 220, 4251, 4314, 4379, + 4316, 213, 4295, 277, 4359, 21, 4373, 7, 4551, 0, + 284, 4315, 4378, 4443, 4380, 341, 4419, 4353, 4224, 4096, + 4097, 4098, 4099, 4162, 4097, 277, 4355, 4289, 4224, 85, + 4437, 0, 220, 4295, 284, 4359, 917, 4363, 591, 5063, + 527, 4999, 28, 4380, 725, 5205, 7, 4551, 711, 5191, + 0, 220, 4295, 284, 4359, 28, 4380, 7, 4551, 0, + 213, 4295, 277, 4359, 274, 4500, 4693, 4821, 5012, 5074, + 5063, 725, 4948, 5010, 4999, 978, 5204, 5397, 5525, 5716, + 5778, 5767, 1429, 5652, 5714, 5703, 21, 4373, 7, 4551, + 711, 5255, 1415, 5959, 0, 213, 4295, 277, 4359, 274, + 4500, 4693, 4821, 5012, 5074, 5063, 725, 4948, 5010, 4999, + 21, 4373, 7, 4551, 711, 5255, 0, 469, 4372, 4242, + 4175, 4173, 4234, 4360, 4551, 4679, 4872, 5002, 5069, 5071, + 5010, 4884, 4693, 4565, 469, 4436, 4306, 4239, 4237, 4298, + 4424, 4551, 583, 4808, 4938, 5005, 5007, 4946, 4820, 4693, + 0, 213, 4288, 277, 4352, 274, 4500, 4629, 4757, 4948, + 5074, 5135, 5133, 5066, 4936, 4743, 4615, 4488, 4362, 661, + 4884, 5010, 5071, 5069, 5002, 4872, 4743, 21, 4373, 0, + 4544, 0, 853, 4928, 917, 4992, 850, 4820, 4693, 4565, + 4372, 4242, 4175, 4173, 4234, 4360, 4551, 4679, 4808, 4938, + 469, 4436, 4306, 4239, 4237, 4298, 4424, 4551, 640, 5184, + 0, 213, 4295, 277, 4359, 271, 4434, 4564, 4693, 4885, + 4948, 4947, 4882, 4819, 4884, 21, 4373, 7, 4551, 0, + 723, 4885, 4881, 4819, 4756, 4629, 4373, 4244, 4179, 4177, + 4240, 4367, 4685, 4812, 4875, 82, 4241, 4368, 4686, 4813, + 4876, 4873, 4808, 4679, 4423, 4296, 4233, 4171, 4167, 4233, + 0, 220, 4299, 4360, 4487, 4615, 4744, 4810, 284, 4363, + 4424, 4487, 21, 4629, 0, 213, 4298, 4360, 4551, 4679, + 4872, 5002, 277, 4362, 4424, 4551, 917, 4999, 981, 5063, + 21, 4373, 725, 5077, 903, 5255, 0, 85, 4551, 149, + 4553, 853, 4551, 21, 4437, 597, 5077, 0, 149, 4487, + 213, 4490, 661, 4487, 661, 4999, 725, 5002, 1173, 4999, + 21, 4501, 981, 5461, 0, 149, 4935, 213, 4999, 917, + 4231, 21, 4501, 661, 5141, 7, 4487, 647, 5127, 0, + 149, 4615, 213, 4617, 917, 4615, 4483, 4353, 4224, 4160, + 4097, 4162, 4225, 21, 4501, 661, 5141, 0, 789, 4167, + 853, 4231, 149, 4177, 4181, 4949, 71, 4935, 4939, 4871, + 0, 480, 4447, 4382, 4316, 4314, 4376, 4439, 4501, 4499, + 4369, 351, 4381, 4379, 4441, 4504, 4566, 4564, 4498, 4240, + 4494, 4556, 4554, 4488, 4423, 4357, 4355, 4417, 271, 4493, + 4491, 4425, 4360, 4294, 4292, 4354, 4417, 4544, 0, 160, + 4224, 0, 224, 4447, 4510, 4572, 4570, 4504, 4439, 4373, + 4371, 4497, 351, 4509, 4507, 4441, 4376, 4310, 4308, 4370, + 4624, 4366, 4300, 4298, 4360, 4423, 4485, 4483, 4417, 399, + 4365, 4363, 4425, 4488, 4550, 4548, 4482, 4417, 4288, 0, + 77, 4175, 4242, 4371, 4499, 4626, 4879, 5006, 5134, 5263, + 5329, 79, 4241, 4370, 4498, 4625, 4878, 5005, 5133, 5262, + 5329, 5331, 0, 28, 4103, 4103, 4124, 4124, 4103, 4167, + 4188, 4252, 4231, 4295, 4316, 4380, 4359, 4423, 4444, 4508, + 4487, 4551, 4572, 4636, 4615, 4679, 4700, 4764, 4743, 4807, + 4828, 4892, 4871, 4935, 4956, 5020, 4999, 0, +}; + + +/* Futura Font Data */ +short futidx[] = { /* character index in futtab */ + 1, 3, 11, 16, 25, 50, 80, 115, 123, 134, 145, 152, + 157, 165, 168, 174, 177, 195, 200, 215, 231, 237, 255, 279, + 284, 314, 338, 349, 362, 366, 371, 375, 395, 448, 455, 477, + 496, 511, 520, 527, 549, 556, 559, 570, 577, 582, 591, 598, + 620, 633, 657, 672, 693, 698, 709, 714, 723, 728, 734, 741, + 750, 753, 762, 767, 770, 778, 795, 812, 827, 844, 862, 870, + 892, 902, 910, 921, 928, 931, 948, 958, 976, 993, 1010, 1018, + 1036, 1044, 1054, 1059, 1068, 1073, 1082, 1089, 1127, 1130, 1168, 1191, +}; + +/* Width data. */ +short futwid[] = { /* width data in futtab */ + 21, 15, 21, 26, 25, 29, 31, 15, 19, 19, + 21, 31, 13, 31, 13, 27, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 13, 13, 29, 31, + 29, 23, 32, 23, 26, 26, 26, 24, 23, 26, + 27, 13, 21, 26, 22, 29, 27, 27, 26, 27, + 26, 25, 21, 27, 23, 29, 25, 23, 25, 19, + 19, 19, 21, 23, 13, 24, 24, 23, 24, 23, + 17, 24, 24, 11, 15, 22, 13, 34, 24, 24, + 24, 24, 20, 22, 17, 24, 21, 27, 22, 21, + 22, 19, 13, 19, 29, 21 +}; + +/* Stroke data. */ +short futtab[] = { /* stroke data in futtab */ + 35, 0, 220, 4302, 201, 4232, 4295, 4360, 4297, 0, + 156, 4245, 668, 4757, 0, 608, 4224, 992, 4608, 147, + 5139, 77, 5069, 0, 416, 4483, 672, 4739, 985, 4955, + 4764, 4508, 4315, 4185, 4183, 4245, 4308, 4435, 4817, 4944, + 5007, 5069, 5066, 4936, 4743, 4487, 4296, 4170, 0, 1244, + 4167, 412, 4634, 4632, 4566, 4437, 4309, 4183, 4185, 4251, + 4380, 4508, 4635, 4826, 5018, 5211, 5340, 974, 4941, 4875, + 4873, 4999, 5127, 5256, 5322, 5324, 5198, 5070, 0, 1363, + 5460, 5397, 5333, 5268, 5202, 5069, 4938, 4808, 4679, 4423, + 4296, 4233, 4171, 4173, 4239, 4304, 4756, 4821, 4887, 4889, + 4827, 4700, 4571, 4505, 4503, 4564, 4689, 5002, 5128, 5255, + 5383, 5448, 5449, 0, 218, 4251, 4316, 4379, 4377, 4311, + 4246, 0, 608, 4574, 4443, 4311, 4242, 4238, 4297, 4421, + 4546, 4672, 0, 96, 4318, 4443, 4567, 4626, 4622, 4553, + 4421, 4290, 4160, 0, 406, 4490, 83, 4813, 723, 4173, + 0, 729, 4807, 144, 5392, 0, 203, 4234, 4171, 4236, + 4299, 4297, 4167, 0, 144, 5392, 0, 140, 4171, 4234, + 4299, 4236, 0, 1184, 4096, 0, 476, 4379, 4248, 4179, + 4176, 4235, 4360, 4551, 4679, 4872, 5003, 5072, 5075, 5016, + 4891, 4700, 4572, 0, 280, 4505, 4700, 4679, 0, 151, + 4248, 4314, 4379, 4508, 4764, 4891, 4954, 5016, 5014, 4948, + 4817, 4167, 5063, 0, 220, 5020, 4628, 4820, 4947, 5010, + 5071, 5069, 5002, 4872, 4679, 4487, 4296, 4233, 4171, 0, + 732, 4174, 5134, 732, 4807, 0, 860, 4316, 4243, 4308, + 4501, 4693, 4884, 5010, 5071, 5069, 5002, 4872, 4679, 4487, + 4296, 4233, 4171, 0, 921, 4955, 4764, 4636, 4443, 4312, + 4243, 4238, 4298, 4424, 4615, 4679, 4872, 5002, 5069, 5070, + 5009, 4883, 4692, 4628, 4435, 4305, 4238, 0, 988, 4423, + 92, 5084, 0, 412, 4315, 4249, 4247, 4309, 4436, 4691, + 4882, 5008, 5070, 5067, 5001, 4936, 4743, 4487, 4296, 4233, + 4171, 4174, 4240, 4370, 4563, 4820, 4949, 5015, 5017, 4955, + 4764, 4508, 0, 917, 4946, 4816, 4623, 4559, 4368, 4242, + 4181, 4182, 4249, 4379, 4572, 4636, 4827, 4953, 5013, 5008, + 4939, 4808, 4615, 4487, 4296, 4234, 0, 147, 4178, 4241, + 4306, 4243, 140, 4171, 4234, 4299, 4236, 0, 147, 4178, + 4241, 4306, 4243, 203, 4234, 4171, 4236, 4299, 4297, 4167, + 0, 1177, 4240, 5255, 0, 147, 5395, 141, 5389, 0, + 153, 5264, 4231, 0, 87, 4184, 4250, 4315, 4444, 4700, + 4827, 4890, 4952, 4950, 4884, 4819, 4561, 4558, 457, 4488, + 4551, 4616, 4553, 0, 1044, 5078, 4951, 4759, 4630, 4565, + 4498, 4495, 4557, 4684, 4876, 5005, 5071, 663, 4629, 4562, + 4559, 4621, 4684, 1047, 5071, 5069, 5196, 5324, 5454, 5521, + 5523, 5462, 5400, 5274, 5147, 4956, 4764, 4571, 4442, 4312, + 4246, 4179, 4176, 4237, 4299, 4425, 4552, 4743, 4935, 5128, + 5257, 5322, 1111, 5135, 5133, 5196, 0, 476, 4103, 476, + 5063, 142, 4878, 0, 156, 4231, 156, 4828, 5019, 5082, + 5144, 5142, 5076, 5011, 4818, 146, 4818, 5009, 5072, 5134, + 5131, 5065, 5000, 4807, 4231, 0, 1047, 5081, 4955, 4828, + 4572, 4443, 4313, 4247, 4180, 4175, 4236, 4298, 4424, 4551, + 4807, 4936, 5066, 5132, 0, 156, 4231, 156, 4700, 4891, + 5017, 5079, 5140, 5135, 5068, 5002, 4872, 4679, 4231, 0, + 156, 4231, 156, 5084, 146, 4754, 135, 5063, 0, 156, + 4231, 156, 5084, 146, 4754, 0, 1047, 5081, 4955, 4828, + 4572, 4443, 4313, 4247, 4180, 4175, 4236, 4298, 4424, 4551, + 4807, 4936, 5066, 5132, 5135, 719, 5135, 0, 156, 4231, + 1052, 5127, 146, 5138, 0, 156, 4231, 0, 668, 4748, + 4681, 4616, 4487, 4359, 4232, 4169, 4108, 4110, 0, 156, + 4231, 1052, 4238, 467, 5127, 0, 156, 4231, 135, 4999, + 0, 156, 4231, 156, 4743, 1180, 4743, 1180, 5255, 0, + 156, 4231, 156, 5127, 1052, 5127, 0, 476, 4443, 4313, + 4247, 4180, 4175, 4236, 4298, 4424, 4551, 4807, 4936, 5066, + 5132, 5199, 5204, 5143, 5081, 4955, 4828, 4572, 0, 156, + 4231, 156, 4828, 5019, 5082, 5144, 5141, 5075, 5010, 4817, + 4241, 0, 476, 4443, 4313, 4247, 4180, 4175, 4236, 4298, + 4424, 4551, 4807, 4936, 5066, 5132, 5199, 5204, 5143, 5081, + 4955, 4828, 4572, 651, 5125, 0, 156, 4231, 156, 4828, + 5019, 5082, 5144, 5142, 5076, 5011, 4818, 4242, 594, 5127, + 0, 985, 4955, 4764, 4508, 4315, 4185, 4183, 4245, 4308, + 4435, 4817, 4944, 5007, 5069, 5066, 4936, 4743, 4487, 4296, + 4170, 0, 412, 4487, 28, 4956, 0, 156, 4237, 4298, + 4424, 4615, 4743, 4936, 5066, 5133, 5148, 0, 28, 4551, + 988, 4551, 0, 28, 4423, 668, 4423, 668, 5063, 1308, + 5063, 0, 92, 5063, 988, 4167, 0, 28, 4562, 4551, + 988, 4562, 0, 988, 4167, 92, 5084, 71, 5063, 0, + 160, 4224, 224, 4288, 160, 4704, 128, 4672, 0, 28, + 4868, 0, 480, 4544, 544, 4608, 96, 4640, 64, 4608, + 0, 414, 4112, 414, 5008, 0, 0, 5120, 0, 215, + 4181, 4179, 4242, 4307, 4244, 4179, 0, 853, 4935, 850, + 4820, 4693, 4501, 4372, 4242, 4175, 4173, 4234, 4360, 4487, + 4679, 4808, 4938, 0, 156, 4231, 146, 4372, 4501, 4693, + 4820, 4946, 5007, 5005, 4938, 4808, 4679, 4487, 4360, 4234, + 0, 850, 4820, 4693, 4501, 4372, 4242, 4175, 4173, 4234, + 4360, 4487, 4679, 4808, 4938, 0, 860, 4935, 850, 4820, + 4693, 4501, 4372, 4242, 4175, 4173, 4234, 4360, 4487, 4679, + 4808, 4938, 0, 79, 4943, 4945, 4883, 4820, 4693, 4501, + 4372, 4242, 4175, 4173, 4234, 4360, 4487, 4679, 4808, 4938, + 0, 540, 4508, 4379, 4312, 4295, 21, 4565, 0, 853, + 4933, 4866, 4801, 4672, 4480, 4353, 850, 4820, 4693, 4501, + 4372, 4242, 4175, 4173, 4234, 4360, 4487, 4679, 4808, 4938, + 0, 156, 4231, 145, 4436, 4565, 4757, 4884, 4945, 4935, + 0, 92, 4251, 4316, 4253, 4188, 149, 4231, 0, 220, + 4379, 4444, 4381, 4316, 277, 4356, 4289, 4160, 4096, 0, + 156, 4231, 789, 4235, 399, 4935, 0, 156, 4231, 0, + 149, 4231, 145, 4436, 4565, 4757, 4884, 4945, 4935, 849, + 5140, 5269, 5461, 5588, 5649, 5639, 0, 149, 4231, 145, + 4436, 4565, 4757, 4884, 4945, 4935, 0, 405, 4372, 4242, + 4175, 4173, 4234, 4360, 4487, 4679, 4808, 4938, 5005, 5007, + 4946, 4820, 4693, 4501, 0, 149, 4224, 146, 4372, 4501, + 4693, 4820, 4946, 5007, 5005, 4938, 4808, 4679, 4487, 4360, + 4234, 0, 853, 4928, 850, 4820, 4693, 4501, 4372, 4242, + 4175, 4173, 4234, 4360, 4487, 4679, 4808, 4938, 0, 149, + 4231, 143, 4306, 4436, 4565, 4757, 0, 786, 4820, 4629, + 4437, 4244, 4178, 4240, 4367, 4686, 4813, 4875, 4874, 4808, + 4615, 4423, 4232, 4170, 0, 220, 4299, 4360, 4487, 4615, + 21, 4565, 0, 149, 4235, 4296, 4423, 4615, 4744, 4939, + 853, 4935, 0, 21, 4487, 789, 4487, 0, 85, 4423, + 597, 4423, 597, 4935, 1109, 4935, 0, 85, 4871, 789, + 4167, 0, 21, 4487, 789, 4487, 4355, 4225, 4096, 4096, + 0, 789, 4167, 85, 4885, 71, 4871, 0, 480, 4447, + 4382, 4316, 4314, 4376, 4439, 4501, 4499, 4369, 351, 4381, + 4379, 4441, 4504, 4566, 4564, 4498, 4240, 4494, 4556, 4554, + 4488, 4423, 4357, 4355, 4417, 271, 4493, 4491, 4425, 4360, + 4294, 4292, 4354, 4417, 4544, 0, 160, 4224, 0, 224, + 4447, 4510, 4572, 4570, 4504, 4439, 4373, 4371, 4497, 351, + 4509, 4507, 4441, 4376, 4310, 4308, 4370, 4624, 4366, 4300, + 4298, 4360, 4423, 4485, 4483, 4417, 399, 4365, 4363, 4425, + 4488, 4550, 4548, 4482, 4417, 4288, 0, 77, 4175, 4242, + 4371, 4499, 4626, 4879, 5006, 5134, 5263, 5329, 79, 4241, + 4370, 4498, 4625, 4878, 5005, 5133, 5262, 5329, 5331, 0, + 28, 4103, 4103, 4124, 4124, 4103, 4167, 4188, 4252, 4231, + 4295, 4316, 4380, 4359, 4423, 4444, 4508, 4487, 4551, 4572, + 4636, 4615, 4679, 4700, 4764, 4743, 4807, 4828, 4892, 4871, + 4935, 4956, 5020, 4999, 0, +}; diff --git a/vendor/x11iraf/cdl/cdlftn.inc b/vendor/x11iraf/cdl/cdlftn.inc new file mode 100644 index 00000000..6adecd7d --- /dev/null +++ b/vendor/x11iraf/cdl/cdlftn.inc @@ -0,0 +1,79 @@ +C ======================================================================== +C = +C CDLFTN.INC -- Include file for Fortran programs to give symbolic = +C names to various constants used by the CDL. = +C = +C ======================================================================== + + integer NULL + integer FB_AUTO + integer CDL_UNITARY, CDL_LINEAR, CDL_LOG + + integer C_BLACK, C_WHITE, C_RED, C_GREEN, C_BLUE, C_YELLOW + integer C_CYAN, C_MAGENTA, C_CORAL, C_MAROON, C_ORANGE, C_KHAKI + integer C_ORCHID, C_TURQUOISE, C_VIOLET, C_WHEAT + + integer M_FILL, M_POINT, M_BOX, M_PLUS, M_CROSS, M_DIAMOND + integer M_STAR, M_HLINE, M_VLINE, M_HBLINE, M_VBLINE, M_CIRCLE + + integer F_ROMAN, F_GREEK, F_FUTURA, F_TIMES, F_BOLD + + integer L_SOLID, L_DASHED, L_DOTTED, L_DOTDASH, L_HOLLOW, L_SHADOW + +C Commonly used C constants + parameter (NULL=0) + +C Automatically select frame buffer + parameter (FB_AUTO=-1) + +C Types of greyscale transformations. + parameter (CDL_UNITARY=0) + parameter (CDL_LINEAR=1) + parameter (CDL_LOG=2) + +C Overlay colors. + parameter (C_BLACK=202) + parameter (C_WHITE=203) + parameter (C_RED=204) + parameter (C_GREEN=205) + parameter (C_BLUE=206) + parameter (C_YELLOW=207) + parameter (C_CYAN=208) + parameter (C_MAGENTA=209) + parameter (C_CORAL=210) + parameter (C_MAROON=211) + parameter (C_ORANGE=212) + parameter (C_KHAKI=213) + parameter (C_ORCHID=214) + parameter (C_TURQUOISE=215) + parameter (C_VIOLET=216) + parameter (C_WHEAT=217) + +C Overlay point mark types. + parameter (M_FILL=1) + parameter (M_POINT=2) + parameter (M_BOX=4) + parameter (M_PLUS=8) + parameter (M_CROSS=16) + parameter (M_DIAMOND=32) + parameter (M_CIRCLE=64) + parameter (M_STAR=128) + parameter (M_HLINE=256) + parameter (M_VLINE=512) + parameter (M_HBLINE=1024) + parameter (M_VBLINE=2048) + +C Font types. + parameter (F_ROMAN=0) + parameter (F_GREEK=1) + parameter (F_FUTURA=2) + parameter (F_TIMES=3) + parameter (F_BOLD=4) + +C Line styles. + parameter (L_SOLID=0) + parameter (L_DASHED=1) + parameter (L_DOTTED=2) + parameter (L_DOTDASH=3) + parameter (L_HOLLOW=4) + parameter (L_SHADOW=5) diff --git a/vendor/x11iraf/cdl/cdliraf.c b/vendor/x11iraf/cdl/cdliraf.c new file mode 100644 index 00000000..87c28e57 --- /dev/null +++ b/vendor/x11iraf/cdl/cdliraf.c @@ -0,0 +1,848 @@ +#include +#ifdef linux +/*#include */ +#include +#endif +#ifdef ULTRIX +#include +#endif +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + + +/* + * CDLIRAF.C -- Routines to read IRAF OIF images. + * + * cdl_displayIRAF (cdl, fname, band, frame, fbconfig, zscale) + * cdl_isIRAF (fname) + * cdl_readIRAF (fname, band, &pix, &nx, &ny, &bitpix, title); + */ + + +#define VERSION_1 1 +#define VERSION_2 2 + +/* Image header parmeters. */ +#define SZ_V1PIXFILE 79 +#define SZ_V1TITLE 79 +#define SZ_V1HDR 2048 + +/* Offsets into header (in sizeof(int) units) for various parameters */ +#define IM_V1PIXTYPE 4 /* datatype of the pixels */ +#define IM_V1NDIM 5 /* number of dimensions */ +#define IM_V1LEN 6 /* image dimensions */ +#define IM_V1PHYSLEN 13 /* physical length (as stored) */ +#define IM_V1PIXOFF 22 /* offset of the pixels */ +#define IM_V1PIXFILE 103 /* name of pixel storage file */ +#define IM_V1TITLE 183 /* title of image */ + +/* Image header parmeters. */ +#define SZ_V2PIXFILE 255 +#define SZ_V2TITLE 383 +#define SZ_V2HDR 1024 + +/* Offsets into header (in sizeof(int) units) for various parameters */ +#define IM_V2PIXTYPE 10 /* datatype of the pixels */ +#define IM_V2SWAPPED 14 /* number of dimensions */ +#define IM_V2NDIM 18 /* number of dimensions */ +#define IM_V2LEN 22 /* image dimensions */ +#define IM_V2PHYSLEN 50 /* physical length (as stored) */ +#define IM_V2PIXOFF 86 /* offset of the pixels */ +#define IM_V2PIXFILE 126 /* name of pixel storage file */ +#define IM_V2TITLE 638 /* title of image */ + +/* IRAF dataype codes */ +#define TY_CHAR 2 +#define TY_SHORT 3 +#define TY_INT 4 +#define TY_LONG 5 +#define TY_REAL 6 +#define TY_DOUBLE 7 +#define TY_USHORT 11 +#define TY_UCHAR 12 + +#ifdef __STDC__ +#include +#include +#endif + +#undef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define min(a,b) ((a) < (b) ? (a) : (b)) + +extern int cdl_debug; + + +#ifdef ANSI_FUNC + +static char *cdl_getIRAFPixels(char *fname, int band, uchar **image, int *nx, int *ny, int *bitpix, char *title); +static int cdl_readImageHdr(char *fname, int *version, int *px, int *py, int *nx, int *ny, int *nbands, int *ptype, int *offset, int *swapped, char *pfile, char *title); +static int cdl_getVersion(FILE *fd); +static void cdl_getPixfile(char *fname, char *pfile); +static int cdl_setBitpix(int ptype, int *pix_size, int *bitpix); +static void cdl_swapPixels(int swapped, int nx, int ny, int ptype, uchar **image); +static void cdl_strpak(char *in, char *out, int len); +static void bswap2(char *a, char *b, int nbytes); +static void bswap4(char *a, int aoff, char *b, int boff, int nbytes); +static void bswap8(char *a, int aoff, char *b, int boff, int nbytes); +static int is_swapped_machine(void); + +#else + +static char *cdl_getIRAFPixels(); +static void cdl_getPixfile(), cdl_strpak(); +static void bswap2(), bswap4(), bswap8(); +static void cdl_swapPixels (); +static int cdl_readImageHdr(), cdl_setBitpix(); +static int cdl_getVersion(); +static int is_swapped_machine(); + +#endif + + + +/* CDL_DISPLAYIRAF -- Display an IRAF OIF format image to the given frame, + * optionally doing a Zscale transform of the image pixels. + */ + +#ifdef ANSI_FUNC + +int +cdl_displayIRAF ( + CDLPtr cdl, /* package ptr */ + char *fname, /* image name */ + int band, /* image band if 3-d */ + int frame, /* display frame */ + int fbconfig, /* frame buffer config */ + int zscale /* do zscale of image? */ +) +#else + +int +cdl_displayIRAF (cdl, fname, band, frame, fbconfig, zscale) +CDLPtr cdl; /* package ptr */ +char *fname; /* image name */ +int band; /* image band if 3-d */ +int frame; /* display frame */ +int fbconfig; /* frame buffer config */ +int zscale; /* do zscale of image? */ +#endif +{ + char title[128]; + int status, nx, ny, bitpix; + uchar *pix = NULL; + float z1 = 0.0, z2 = 0.0; + + + /* See if this is a valid IRAF file. */ + if (!cdl_isIRAF (fname)) { + fprintf (stderr, "%s: not a valid IRAF file or doesn't exist.\n", + fname); + return (ERR); + } + + /* Get the raw IRAF image pixels. */ + if (cdl_readIRAF (fname, band, &pix, &nx, &ny, &bitpix, title)) + return (ERR); + + if (cdl_debug) { + printf("[cdl_displayIRAF] '%s[%d] frame=%d zscale=%d\n", + fname, band, frame, zscale); + printf("[cdl_displayIRAF] %dx%d bitpix=%d pixels z1=%g z2=%g\n", + nx, ny, bitpix, z1, z2); + } + + (void) cdl_setTitle (cdl, title); + (void) cdl_setName (cdl, fname); + status = cdl_displayPix (cdl, pix, nx, ny, bitpix, frame, fbconfig, + zscale); + free ((char *) pix); + return (status); +} + + +/* CDL_ISIRAF -- Test a file to see if it is a IRAF file. We check for both + * V1 and V2 header magic numbers and return the appropriate version if found. + */ + +#ifdef ANSI_FUNC + +int +cdl_isIRAF ( + char *fname /* input filename */ +) +#else + +int +cdl_isIRAF (fname) +char *fname; /* input filename */ +#endif +{ + register FILE *fp; + int value = 0; + char magic[24]; + + if ((fp = fopen (fname, "r"))) { + fread (magic, sizeof (char), 12, fp); + fclose (fp); + + /* See if this is a valid OIF header file. */ + if (strncmp(magic, "imhv2", 5) == 0) + value = 2; + else { + cdl_strpak (magic, magic, 5); + if (strncmp(magic, "imhdr", 5) == 0) + value = 1; + } + } + + return value; +} + + +/* CDL_READIRAF -- Read the pixels from an IRAF OIF format image, returning + * the pixel array, dimensions, and image type. + */ + +#ifdef ANSI_FUNC + +int +cdl_readIRAF ( + char *fname, /* image name */ + int band, /* image band if 3-d */ + uchar **pix, /* pixel array (output) */ + int *nx, + int *ny, /* dimensions (output) */ + int *bitpix, /* pixel size (output) */ + char *title /* image title */ +) +#else + +int +cdl_readIRAF (fname, band, pix, nx, ny, bitpix, title) +char *fname; /* image name */ +int band; /* image band if 3-d */ +uchar **pix; /* pixel array (output) */ +int *nx, *ny; /* dimensions (output) */ +int *bitpix; /* pixel size (output) */ +char *title; /* image title */ +#endif +{ + char *errstr; + char *cdl_getIRAFPixels(); + + /* See if this is a valid IRAF file. */ + if (!cdl_isIRAF (fname)) { + fprintf (stderr, "%s: not a valid IRAF file or doesn't exist.\n", + fname); + return (ERR); + } + + if ((errstr=cdl_getIRAFPixels(fname,band,pix,nx,ny,bitpix,title))) { + fprintf (stderr, "%s\n", errstr); + return (ERR); + } + + if (cdl_debug) + printf ("[cdl_readIRAF] '%s[%d]' nx=%d ny=%d bitpix=%d\n", + fname, band, *nx, *ny, *bitpix); + + return (OK); +} + + + +/* ------------------ + * Private routines. + * ------------------*/ + +/* CDL_GETIRAFPIXELS -- Given an IRAF filename return a pointer to the pixel + * array and the image dimensions. + */ + +#ifdef ANSI_FUNC + +static char * +cdl_getIRAFPixels ( + char *fname, /* input filename */ + int band, /* image band */ + uchar **image, /* output pixels */ + int *nx, + int *ny, /* dimensions */ + int *bitpix, /* pixel size */ + char *title /* image title */ +) +#else + +static char * +cdl_getIRAFPixels (fname, band, image, nx, ny, bitpix, title) +char *fname; /* input filename */ +int band; /* image band */ +uchar **image; /* output pixels */ +int *nx, *ny; /* dimensions */ +int *bitpix; /* pixel size */ +char *title; /* image title */ +#endif +{ + register int i; + int npix, px, py, nbands, pix_size, version, swapped = 0; + FILE *pf; + char *line, pixfile[256]; + int ptype, offset; + + + /* Read the image header params */ + if (cdl_readImageHdr (fname, &version, &px, &py, nx, ny, &nbands, + &ptype, &offset, &swapped, pixfile, title) == ERR) + return "error reading image header"; + + /* Do some simple error checking. */ + if (band > nbands) + return "Invalid band request."; + if (access (pixfile, R_OK) != 0) + return "Cannot access pixel file"; + + /* Open the pixel file and seek to the beginning of the data. */ + if ((pf = fopen (pixfile, "r")) == NULL) + return "Cannot open pixel file."; + + npix = (*nx) * (*ny); + if (cdl_setBitpix (ptype, &pix_size, bitpix) == ERR) { + fclose (pf); + return "Invalid pixel type in image"; + } + + /* Now suck up the pixels. */ + *image = (uchar *) malloc (npix * pix_size); + offset += (band - 1) * (px * py) * pix_size; + lseek (fileno(pf), (off_t)offset, SEEK_SET); + + if (*nx == px) + fread ((void *)*image, pix_size, npix, pf); + else { + line = (char *) malloc (px * pix_size); + for (i=0; i < (*ny); i++) { + fread (line, pix_size, px, pf); + bcopy (line, &((*image)[i*(*nx)*pix_size]), (*nx)*pix_size); + } + free ((char *)line); + } + + /* See if we need to swap the bytes. */ + if (version == 2) + cdl_swapPixels (swapped, *nx, *ny, ptype, image); + + fclose (pf); + return NULL; +} + + +/* CDL_READIMAGEHDR -- Read the image header information. + */ + +#ifdef ANSI_FUNC + +static int +cdl_readImageHdr ( + char *fname, /* image name */ + int *version, /* OIF version number */ + int *px, + int *py, /* physical storage dims */ + int *nx, + int *ny, + int *nbands, /* image dims */ + int *ptype, /* pixel type */ + int *offset, /* offset to pixels */ + int *swapped, /* byte-swapped pixels */ + char *pfile, /* pixfile pathname */ + char *title /* image title */ +) +#else + +static int +cdl_readImageHdr (fname, version, px, py, nx, ny, nbands, ptype, offset, + swapped, pfile, title) +char *fname; /* image name */ +int *version; /* OIF version number */ +int *px, *py; /* physical storage dims */ +int *nx, *ny, *nbands; /* image dims */ +int *ptype; /* pixel type */ +int *offset; /* offset to pixels */ +int *swapped; /* byte-swapped pixels */ +char *pfile; /* pixfile pathname */ +char *title; /* image title */ +#endif +{ + FILE *hdr; + + if ((hdr = fopen (fname, "r")) == NULL) + return (ERR); + + *version = cdl_getVersion (hdr); + if (*version == VERSION_1) { + int header_v1[SZ_V1HDR]; + char pixfile_v1[SZ_V1PIXFILE]; + + /* Read in the image header. */ + fread ((void *)header_v1, sizeof (char), SZ_V1HDR, hdr); + + /* Get the interesting stuff. */ + *px = header_v1[IM_V1PHYSLEN]; + *py = header_v1[IM_V1PHYSLEN+1]; + *nx = header_v1[IM_V1LEN]; + *ny = header_v1[IM_V1LEN+1]; + *ptype = header_v1[IM_V1PIXTYPE]; + *offset = (header_v1[IM_V1PIXOFF] - 1) * sizeof(short); + *nbands = header_v1[IM_V1LEN+2]; + *swapped = 0; + + /* Find the pixfile and see if it exists. */ + cdl_strpak ((char *)&header_v1[IM_V1PIXFILE], pixfile_v1, + SZ_V1PIXFILE); + cdl_getPixfile (fname, pixfile_v1); + (void) strcpy (pfile, pixfile_v1); + + /* Find the image title string */ + if (title == (char *)NULL) + title = (char *) malloc (SZ_V1TITLE+1); + cdl_strpak ((char *)&header_v1[IM_V1TITLE], title, SZ_V1TITLE); + + } else if (*version == VERSION_2) { + char header_v2[SZ_V2HDR], *tp; + char pixfile_v2[SZ_V2PIXFILE]; + + /* Read in the image header. */ + fread (header_v2, sizeof (char), SZ_V2HDR, hdr); + + /* Get the interesting stuff. */ + + if (is_swapped_machine()) + bswap4 (&header_v2[IM_V2SWAPPED], 1, (char *)swapped, + 1, sizeof(int)); + else + bcopy ((char *)&header_v2[IM_V2SWAPPED], (char *)swapped, + sizeof(int)); + + if (is_swapped_machine()) { + bswap4 (&header_v2[IM_V2PHYSLEN], 1, (char *)px, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2PHYSLEN+sizeof(int)], 1, + (char *)py, 1, sizeof(int)); + bswap4 (&header_v2[IM_V2LEN], 1, (char *)nx, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2LEN+sizeof(int)], 1, (char *)ny, + 1, sizeof(int)); + bswap4 (&header_v2[IM_V2PIXTYPE], 1, (char *)ptype, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2PIXOFF], 1, (char *)offset, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2LEN+(2*sizeof(int))], 1, + (char *)nbands, 1, sizeof(int)); + } else { + bcopy ((char *)&header_v2[IM_V2PHYSLEN], px, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PHYSLEN+sizeof(int)], py, + sizeof(int)); + bcopy ((char *)&header_v2[IM_V2LEN], nx, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2LEN+sizeof(int)], ny, + sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PIXTYPE], ptype, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PIXOFF], offset, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2LEN+(2*sizeof(int))], nbands, + sizeof(int)); + } + *offset = (*offset - 1) * sizeof(short); + + /* Find the pixfile and see if it exists. */ + bcopy ((char *)&header_v2[IM_V2PIXFILE], pixfile_v2, SZ_V2PIXFILE); + cdl_getPixfile (fname, pixfile_v2); + (void) strcpy (pfile, pixfile_v2); + + /* Find the image title string */ + tp = (char *)&header_v2[IM_V2TITLE]; + if (title == (char *)NULL) + title = (char *) malloc (SZ_V2TITLE+1); + strcpy (title, (char *)tp); + } + + if (cdl_debug) { + printf("[cdl_readImageHdr] px,py=%d,%d nx,ny,nb=%d,%d,%d\n\t", + *px, *py, *nx, *ny, *nbands); + printf("ptype=%d offset=%d swap=%d pixfile='%s' title='%s'\n", + *ptype, *offset, swapped, pfile, title); + } + + fclose (hdr); /* we're done with the header */ + return (OK); +} + + +/* CDL_GETVERSION -- Return image header version. + */ + +#ifdef ANSI_FUNC + +static int +cdl_getVersion ( + FILE *fd /* input filename */ +) +#else + +static int +cdl_getVersion (fd) +FILE *fd; /* input filename */ +#endif +{ + int value = 0; + char magic[24]; + + rewind (fd); + fread (magic, sizeof (char), 12, fd); + rewind (fd); + + /* See if this is a valid OIF header file. */ + if (strncmp(magic, "imhv2", 5) == 0) + value = 2; + else { + cdl_strpak (magic, magic, 5); + if (strncmp(magic, "imhdr", 5) == 0) + value = 1; + } + return value; +} + + +/* CDL_GETPIXFILE -- Get the pixelfile pathname. + */ + +#ifdef ANSI_FUNC + +static void +cdl_getPixfile (char *fname, char *pfile) +#else + +static void +cdl_getPixfile (fname, pfile) +char *fname; +char *pfile; +#endif +{ + char temp[SZ_V1PIXFILE], *ip; + int len; + char *index(); + + if (strncmp (pfile, "HDR$", 4) == 0) { + /* Handle the special case of a HDR$ pixfile path, prepend the + * current working directory name to the pixfile. + */ + ip = pfile + 4; + (void) strncpy (temp, ip, SZ_V1PIXFILE); + (void) strncpy (pfile, fname, SZ_V1PIXFILE); + + /* Find the end of the pathname. */ + len = strlen (pfile); + while ( (len > 0) && (pfile[len-1] != '/') ) + len--; + + /* Add the image name. */ + pfile[len] = '\0'; + (void) strncat (pfile, temp, SZ_V1PIXFILE); + + } else if (index (pfile, '!') != NULL) { + /* Strip out the leading node! prefix from the pixfile path. */ + for (ip = pfile; *ip != '!' ; ) + ip++; + (void) strcpy (pfile, ++ip); + } +} + + +/* CDL_SETBITPIX -- Set the number of pixels for a given pixel type. + */ + +#ifdef ANSI_FUNC + +static int +cdl_setBitpix (int ptype, int *pix_size, int *bitpix) +#else + +static int +cdl_setBitpix (ptype, pix_size, bitpix) +int ptype; +int *pix_size; +int *bitpix; +#endif +{ + switch (ptype) { + case TY_USHORT: + case TY_SHORT: + *pix_size = sizeof (short); + *bitpix = 16; + break; + case TY_INT: + *pix_size = sizeof (int); + *bitpix = 32; + break; + case TY_LONG: + *pix_size = sizeof (long); + *bitpix = 32; + break; + case TY_REAL: + *pix_size = sizeof (float); + *bitpix = -32; + break; + case TY_DOUBLE: + *pix_size = sizeof (double); + *bitpix = -64; + break; + default: + return (ERR); + } + return (OK); +} + + +/* CDL_SWAPPIXELS -- Byte swap pixels if necessary. + */ + +#ifdef ANSI_FUNC + +static void +cdl_swapPixels (int swapped, int nx, int ny, int ptype, uchar **image) +#else + +static void +cdl_swapPixels (swapped, nx, ny, ptype, image) +int swapped; +int nx, ny; +int ptype; +uchar **image; +#endif +{ + if ((swapped != is_swapped_machine())) { + switch (ptype) { + case TY_USHORT: + case TY_SHORT: + bswap2 ((char *)*image, (char *)*image, + nx * ny * sizeof(short)); + break; + case TY_INT: + case TY_LONG: + bswap4 ((char *)*image, 1, (char *)*image, 1, + nx * ny * sizeof(int)); + break; + case TY_REAL: + bswap4 ((char *)*image, 1, (char *)*image, 1, + nx * ny * sizeof(float)); + break; + case TY_DOUBLE: + bswap8 ((char *)*image, 1, (char *)*image, 1, + nx * ny * sizeof(double)); + break; + } + } +} + + +/* CDL_STRPAK -- Convert ASCII string from SPP char per short to C char + * per byte. + */ + +#ifdef ANSI_FUNC + +static void +cdl_strpak (char *in, char *out, int len) +#else + +static void +cdl_strpak (in, out, len) +char *in, *out; +int len; +#endif +{ + int i, j; + + /* Adaptive byte selection (whichever byte order) chars alternate + * with \0. + */ + j = (in[0] == '\0' ? 1 : 0); + + for (i = 0; i < len; i++, j += 2) + out[i] = in[j]; + out[i] = '\0'; +} + + +/* BSWAP2 - Move bytes from array "a" to array "b", swapping successive + * pairs of bytes. The two arrays may be the same but may not be offset + * and overlapping. + */ + +#ifdef ANSI_FUNC + +static void +bswap2 ( + char *a, + char *b, /* input array */ + int nbytes /* number of bytes to swap */ +) +#else + +static void +bswap2 (a, b, nbytes) +char *a, *b; /* input array */ +int nbytes; /* number of bytes to swap */ +#endif +{ + register char *ip=a, *op=b, *otop; + register unsigned temp; + + /* Swap successive pairs of bytes. + */ + for (otop = op + (nbytes & ~1); op < otop; ) { + temp = *ip++; + *op++ = *ip++; + *op++ = temp; + } + + /* If there is an odd byte left, move it to the output array. + */ + if (nbytes & 1) + *op = *ip; +} + + +/* BSWAP4 - Move bytes from array "a" to array "b", swapping the four bytes + * in each successive 4 byte group, i.e., 12345678 becomes 43218765. + * The input and output arrays may be the same but may not partially overlap. + */ + +#ifdef ANSI_FUNC + +static void +bswap4 ( + char *a, /* input array */ + int aoff, /* first byte in input array */ + char *b, /* output array */ + int boff, /* first byte in output array */ + int nbytes /* number of bytes to swap */ +) +#else + +static void +bswap4 (a, aoff, b, boff, nbytes) +char *a; /* input array */ +int aoff; /* first byte in input array */ +char *b; /* output array */ +int boff; /* first byte in output array */ +int nbytes; /* number of bytes to swap */ +#endif +{ + register char *ip, *op, *tp; + register int n; + static char temp[4]; + + tp = temp; + ip = (char *)a + aoff - 1; + op = (char *)b + boff - 1; + + /* Swap successive four byte groups. + */ + for (n = nbytes >> 2; --n >= 0; ) { + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + } + + /* If there are any odd bytes left, move them to the output array. + * Do not bother to swap as it is unclear how to swap a partial + * group, and really incorrect if the data is not modulus 4. + */ + for (n = nbytes & 03; --n >= 0; ) + *op++ = *ip++; +} + + +/* BSWAP8 - Move bytes from array "a" to array "b", swapping the eight bytes + * in each successive 8 byte group, i.e., 12345678 becomes 87654321. + * The input and output arrays may be the same but may not partially overlap. + */ +#ifdef ANSI_FUNC + +static void +bswap8 ( + char *a, /* input array */ + int aoff, /* first byte in input array */ + char *b, /* output array */ + int boff, /* first byte in output array */ + int nbytes /* number of bytes to swap */ +) +#else + +static void +bswap8 (a, aoff, b, boff, nbytes) +char *a; /* input array */ +int aoff; /* first byte in input array */ +char *b; /* output array */ +int boff; /* first byte in output array */ +int nbytes; /* number of bytes to swap */ +#endif +{ + register char *ip, *op, *tp; + register int n; + static char temp[8]; + + tp = temp; + ip = (char *)a + aoff - 1; + op = (char *)b + boff - 1; + + /* Swap successive eight byte groups. + */ + for (n = nbytes >> 3; --n >= 0; ) { + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + } + + /* If there are any odd bytes left, move them to the output array. + * Do not bother to swap as it is unclear how to swap a partial + * group, and really incorrect if the data is not modulus 8. + */ + for (n = nbytes & 03; --n >= 0; ) + *op++ = *ip++; +} + + +#ifdef ANSI_FUNC + +static int +is_swapped_machine (void) +#else + +static int +is_swapped_machine () +#endif +{ + union { char ch[4]; int i; } u; + u.i = 1; + return (u.ch[0]); +} diff --git a/vendor/x11iraf/cdl/cdlmark.c b/vendor/x11iraf/cdl/cdlmark.c new file mode 100644 index 00000000..16a06965 --- /dev/null +++ b/vendor/x11iraf/cdl/cdlmark.c @@ -0,0 +1,3861 @@ +#include +#include +#include +#include +#define CDL_NEED_LINESTYLES +#define CDL_LIBRARY_SOURCE +#include "cdl.h" +#include "cdlfont.h" + +/* + * CDL Marker Procedures -- Procedures for doing overlay graphics. + * + * cdl_mapFrame (cdl, frame) + * cdl_markCoordsFile (cdl, fname, type, size, color, label) + * cdl_markPoint (cdl, x, y, number, size, type, color) + * cdl_markPointLabel (cdl, x, y, label, size, type, color) + * cdl_markLine (cdl, xs, ys, xe, ye, color) + * cdl_markBox (cdl, lx, ly, ux, uy, fill, color) + * cdl_markPolyline (cdl, xpts, ypts, npts, color) + * cdl_markPolygon (cdl, xpts, ypts, npts, fill, color) + * cdl_markCircle (cdl, x, y, radius, fill, color) + * cdl_markCircAnnuli (cdl, x, y, radius, nannuli, sep, color) + * cdl_markEllipse (cdl, x, y, xrad, yrad, ang, fill, color) + * cdl_markEllipAnnuli (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) + * cdl_markText (cdl, x, y, str, size, angle, color) + * + * cdl_setFont (cdl, font) + * cdl_setTextWidth (cdl, width) + * cdl_setLineWidth (cdl, width) + * cdl_setLineStyle (cdl, style) + * + * cdl_deleteMark (cdl, x, y) + * cdl_clearOverlay (cdl) + * cdl_redrawOverlay (cdl) + * + * cdl_beginDList (frame) Not Yet Implemented + * cdl_clearDList (frame) Not Yet Implemented + * cdl_drawDList (frame) Not Yet Implemented + * cdl_endDList (frame, flush) Not Yet Implemented + */ + +/* Function prototypes */ +#ifdef __STDC__ +#include +#endif + +#ifdef ANSI_FUNC + +static int cdl_getPixRegion(CDLPtr cdl, int lx, int ly, int nx, int ny, uchar *ras); +static void cdl_doPointMark(int color, int type, uchar *pix, int sz); +static void cdl_doLineMark(int color, int width, int style, uchar *pix, int xs, int ys, int xe, int ye); +static void cdl_doBoxMark(int color, int width, int style, int fill, uchar *pix, int lx, int ly, int nx, int ny); +static void cdl_doPolygonMark(int color, int width, int style, int fill, int *x, int *y, int npts, uchar *pix, int lx, int ly, int nx, int ny, int close); +static void cdl_doCircleMark(int x, int y, int radius, int color, int width, int style, int fill, uchar *pix, int lx, int ly, int nx, int ny); +static void cdl_doCircAnnuliMark(int x, int y, int radius, int nannuli, int sep, int color, int width, int style, uchar *pix, int lx, int ly, int nx, int ny); +static void cdl_doEllipseMark(int color, int width, int style, int fill, int xc, int yc, int xrad, int yrad, float ang, uchar *pix, int lx, int ly, int nx, int ny); +static void cdl_doEllipAnnuliMark(int x, int y, int xrad, int yrad, float ang, int nannuli, int sep, int color, int width, int style, uchar *pix, int lx, int ly, int nx, int ny); +int cdl_doTextMarker(int x, int y, char *string, float size, float angle, int color, int width, int font, uchar *pix, int lx, int ly, int nx, int ny); +int cdl_freeDisplayList(CDLPtr cdl, MarkerPtr head); +static void cdl_insertMarker(CDLPtr cdl, MarkerPtr back, MarkerPtr new); +static void cdl_removeMarker(CDLPtr cdl, MarkerPtr mk); +static MarkerPtr cdl_findNearest(MarkerPtr head, int x, int y); +static void cdl_printDisplayList(FILE *fd, MarkerPtr head); +static MarkerPtr cdl_initPointMarker(int x, int y, int number, int size, int type, int color); +static MarkerPtr cdl_initPointLabelMarker(int x, int y, char *label, int size, int type, int color, int font); +static MarkerPtr cdl_initLineMarker(int x1, int y1, int x2, int y2, int color, int width, int style); +static MarkerPtr cdl_initBoxMarker(int lx, int ly, int ux, int uy, int fill, int color, int width, int style); +static MarkerPtr cdl_initPolylineMarker(int *x, int *y, int npts, int color, int width, int style); +static MarkerPtr cdl_initPolygonMarker(int *x, int *y, int npts, int fill, int color, int width, int style); +static MarkerPtr cdl_initCircleMarker(int x, int y, int radius, int fill, int color, int width, int style); +static MarkerPtr cdl_initCircAnnMarker(int x, int y, int radius, int nannuli, int sep, int color, int width, int style); +static MarkerPtr cdl_initEllipseMarker(int x, int y, int xrad, int yrad, float ang, int fill, int color, int width, int style); +static MarkerPtr cdl_initEllAnnMarker(int x, int y, int xrad, int yrad, float ang, int nannuli, int sep, int color, int width, int style); +static MarkerPtr cdl_initTextMarker(int x, int y, char *string, float size, int color, int font, int width); +static void cdl_initMarkPos(MarkerPtr mk, int nx, int ny, int lx, int ly); +static void cdl_doLineInSubRas(uchar *pix, int color, int width, int style, int x1, int x2, int y1, int y2, int lx, int ly, int nx, int ny); +static void cdl_doDashedLine(uchar *pix, int color, int width, int style, int *x, int *y, int np, int lx, int ly, int nx, int ny); +static void cdl_drawThickVector (uchar *pix, int color, int width, int style, int x1, int x2, int y1, int y2, int lx, int ly, int nx, int ny); +static void cdl_drawVector(uchar *pix, int color, int x1, int x2, int y1, int y2, int lx, int ly, int nx, int ny); +static void cdl_drawThickDashVec (uchar *pix, int color, int width, int style, int x1, int x2, int y1, int y2, int lx, int ly, int nx, int ny); +static void cdl_drawDashVec(uchar *pix, int color, int style, int x1, int x2, int y1, int y2, int lx, int ly, int nx, int ny); +static uchar cdl_setpixel(uchar pix, int style, int color); +static void cdl_fillArea(uchar *pix, int nx, int ny, int color); +static void cdl_getCircleCoords(int xcen, int ycen, int radius, int *x, int *y, int npts); +static void cdl_getEllipseCoords(int xcen, int ycen, int xradius, int yradius, float rotang, int *x, int *y); +static void cdl_minmax(int *array, int npts, int *amin, int *amax); +static int cdl_strlen(char *str, float size, int font); +static int bitupk(unsigned int wordp, int offset, int nbits); + +#else + +int cdl_freeDisplayList(); +void cdl_setFont(), cdl_setLineWidth(), cdl_setLineStyle(); +void cdl_beginDList(), cdl_drawDList(); +void cdl_clearDList(), cdl_endDList(), cdl_setTextWidth(); + +static int cdl_getPixRegion(); +static uchar cdl_setpixel(); +static void cdl_insertMarker(), cdl_removeMarker(); +static void cdl_doLineInSubRas(), cdl_drawThickVector(), cdl_drawVector(); +static void cdl_doPointMark(), cdl_doLineMark(), cdl_doBoxMark(); +static void cdl_doPolygonMark(), cdl_doCircleMark(), cdl_doCircAnnuliMark(); +static void cdl_doEllipseMark(), cdl_doEllipAnnuliMark(); +static void cdl_getCircleCoords(), cdl_getEllipseCoords(); +static void cdl_printDisplayList(), cdl_initMarkPos(); +static void cdl_fillArea(), cdl_minmax(), cdl_doDashedLine(); +static void cdl_drawThickDashVec(), cdl_drawDashVec(); + +static int cdl_strlen(), bitupk(); + +static MarkerPtr cdl_initPointMarker(), cdl_initLineMarker(); +static MarkerPtr cdl_initBoxMarker(), cdl_initPolylineMarker(); +static MarkerPtr cdl_initPolygonMarker(), cdl_initCircleMarker(); +static MarkerPtr cdl_initCircAnnMarker(), cdl_initEllipseMarker(); +static MarkerPtr cdl_initEllAnnMarker(), cdl_findNearest(); +static MarkerPtr cdl_initTextMarker(), cdl_initPointLabelMarker(); + +#endif + + +/* Display list declarations. We keep a separate list for each frame that + * is freed whenever a new image is displayed. The list is maintained as + * a doubly-linked list of Marker structs. + */ +MarkerPtr DLHead[MAX_FRAMES]; /* diplay list head */ +MarkerPtr DLTail[MAX_FRAMES]; /* diplay list tail */ +int DLFlag[] = { /* display list flags. */ + 0, 0, 0, 0, /* If set we're doing */ + 0, 0, 0, 0 /* markers in memory */ + }; +uchar *DLFBPix[MAX_FRAMES]; /* frame buffer pixels */ + + +/* absolute value of a */ +#define ABS(a) (((a)<0) ? -(a) : (a)) + +/* take binary sign of a, either -1, or 1 if >= 0 */ +#define SGN(a) (((a)<0) ? -1 : 1) + +#define N_CIRCLE_PTS 48 /* no. of points defining unit circle */ +#define N_ELLIPSE_PTS 64 /* no. of points defining unit ellipse */ +#define FONT_SCALE 0.36 /* default text font scale */ +#define FONT_SPACE 4 /* default text font spacing */ + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +extern int cdl_debug; + + + +/* CDL_MAPFRAME -- Map the current frame buffer as an image for overlay. + * This routine is a bit of a hack since we're trying to make some guesses + * about what the server has displayed, there's no way to actually query it. + * We assume the fbconfig has already been reset if it's not the default, + * and we assume the WCS defined is for a single image centered in the frame. + */ + +#ifdef ANSI_FUNC + +int +cdl_mapFrame ( + CDLPtr cdl, /* package ptr */ +int frame /* fb frame to map */ +) +#else + +int +cdl_mapFrame (cdl, frame) +CDLPtr cdl; /* package ptr */ +int frame; /* fb frame to map */ +#endif +{ + int xo, yo; + float a, b, c, d, tx, ty, z1, z2; + int zt; + char *name = NULL, *title = NULL; + + name = (char *) malloc (SZ_NAME); + title = (char *) malloc (SZ_NAME); + + /* Select the requested frame. */ + cdl_setFrame (cdl, frame); + + /* Get/Set the current WCS. */ + (void) cdl_getWCS (cdl, name, title, &a, &b, &c, &d, &tx, &ty, + &z1, &z2, &zt); + + /* If no WCS is defined for the frame make up a default. */ + if ((a+b+c+d+tx+ty+z1+z2+zt) == 0.0) { + a = 1.0; + b = 0.0; + c = 0.0; + d = -1.0; + tx = 1.0; + ty = (float) cdl->fbheight; + z1 = 0.0; + z2 = 255.0; + zt = CDL_LINEAR; + } + (void) cdl_setWCS (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt); + + /* Reset the image corners, assume image is centered in the frame. */ + xo = - cdl->tx + 1; + yo = cdl->fbheight - cdl->ty; + cdl->imd->xs = xo; + cdl->imd->ys = yo; + cdl->imd->xe = cdl->fbwidth - xo + 1; + cdl->imd->ye = cdl->fbheight - yo + 1; + + free (name); + free (title); + return (OK); +} + + +/* CDL_MARKPOINT -- Draw a mark on the display at the given point. Marks + * be specified as either a '+', 'x', or '*'. If the number argument is + * positive that value will be drawn next to the mark as a label string. + */ + +#ifdef ANSI_FUNC + +int +cdl_markPoint ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* marker position */ + int number, /* if > 0, label value */ + int size, /* marker size (pixels) */ + int type, /* type to draw */ + int color /* marker color */ +) +#else + +int +cdl_markPoint (cdl, x, y, number, size, type, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* marker position */ +int number; /* if > 0, label value */ +int size; /* marker size (pixels) */ +int type; /* type to draw */ +int color; /* marker color */ +#endif +{ + register int lx, ly, sz; + uchar *pix = NULL; + MarkerPtr mk = cdl_initPointMarker (x, y, number, size, type, color); + + if (cdl_debug) + printf ("[cdl_markPoint] (%dx%d) num=%d size=%d type=%d color=%d\n", + x, y, number, size, type, color); + + sz = (size % 2 ? size : size + 1); + sz = max (sz, 3); + lx = x - (sz / 2); + ly = y - (sz / 2); + cdl_initMarkPos (mk, sz, sz, lx, ly); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (sz * sz); + if (cdl_getPixRegion (cdl, lx, ly, sz, sz, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (sz * sz); + mk->markpix = (uchar *) malloc (sz * sz); + bcopy (pix, mk->refpix, sz * sz); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doPointMark (color, type, pix, sz); + bcopy (pix, mk->markpix, sz * sz); + + /* Number the point if requested. */ + if (number > 0) { + char lab[64]; + int cx, cy, llen; + + sprintf (lab, "%d", number); + llen = strlen(lab) * (CHARACTER_WIDTH * FONT_SCALE) + strlen(lab); + + /* Position the label so it isn't clipped. + */ + cx = x + (sz / 2) - 1; + cy = y + (sz / 2) - 1; + if ((cx + llen) > cdl->im_nx) cx = x - llen + 1; + if ((cy + llen) > cdl->im_ny) cy = y - llen + 1; + cdl_markText (cdl, cx, cy, lab, 1., 0.0, color); + } + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, sz, sz, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKPOINTLABEL -- Draw a mark on the display at the given point. + * Marks be specified as either a '+', 'x', or '*'. If the number argument + * is positive that value will be drawn next to the mark as a label string. + */ + +#ifdef ANSI_FUNC + +int +cdl_markPointLabel ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* marker position */ + char *label, /* point label str */ + int size, /* marker size (pixels) */ + int type, /* type to draw */ + int color /* marker color */ +) +#else + +int +cdl_markPointLabel (cdl, x, y, label, size, type, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* marker position */ +char *label; /* point label str */ +int size; /* marker size (pixels) */ +int type; /* type to draw */ +int color; /* marker color */ +#endif +{ + register int lx, ly, sz; + uchar *pix = NULL; + MarkerPtr mk = cdl_initPointLabelMarker(x,y, label, size, type, + color, cdl->font); + + if (cdl_debug) + printf("[cdl_pointLabel] (%dx%d) lab=%s size=%d type=%d color=%d\n", + x, y, label, size, type, color); + + sz = (size % 2 ? size : size + 1); + sz = max (sz, 3); + lx = x - (sz / 2); + ly = y - (sz / 2); + cdl_initMarkPos (mk, sz, sz, lx, ly); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (sz * sz); + if (cdl_getPixRegion (cdl, lx, ly, sz, sz, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (sz * sz); + mk->markpix = (uchar *) malloc (sz * sz); + bcopy (pix, mk->refpix, sz * sz); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doPointMark (color, type, pix, sz); + bcopy (pix, mk->markpix, sz * sz); + + /* Number the point if requested. */ + if (label) { + int cx, cy, llen; + + llen = cdl_strlen (label, mk->txsize, mk->font); + + /* Position the label so it isn't clipped. */ + cx = x + (sz / 2) - 1; + cy = y + (sz / 2) - 1; + if ((cx + llen) > cdl->im_nx) cx = x - llen + 1; + if ((cy + llen) > cdl->im_ny) cy = y - llen + 1; + cdl_markText (cdl, cx, cy, label, 1., 0.0, color); + } + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, sz, sz, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKLIST -- Given a filename of (x,y) and possibly label strings + * mark all points on the display with a point marker of the given type, + * size and color. + */ + +#ifdef ANSI_FUNC + +int +cdl_markCoordsFile ( + CDLPtr cdl, /* package ptr */ + char *fname, /* file name */ + int type, /* marker type */ + int size, /* marker size */ + int color, /* marker color */ + int label /* label? */ +) +#else + +int +cdl_markCoordsFile (cdl, fname, type, size, color, label) +CDLPtr cdl; /* package ptr */ +char *fname; /* file name */ +int type; /* marker type */ +int size; /* marker size */ +int color; /* marker color */ +int label; /* label? */ +#endif +{ + if (fname == (char *)NULL) + return (ERR); + + /* If a coordinate file was specified read the file and mark those + * coords with points of the specified size, type and color. + */ + if (access (fname, F_OK) == 0) { + FILE *fp; + float rx, ry; + int i, x, y; + + if ((fp = fopen (fname, "r"))) { + /* The coord file is assumed to be simply a file containing + * (x,y) pairs, one per line. Scan the file and mark each + * point. We do no bounds checking to see if the coords + * are correct for the frame. + */ + i = 1; + while (fscanf (fp, "%g %g", &rx, &ry) != EOF) { + x = (int) (rx + 0.5); + y = (int) (ry + 0.5); + if (label) + cdl_markPoint (cdl, x, y, i++, size, type, color); + else + cdl_markPoint (cdl, x, y, 0, size, type, color); + } + + } else { + fprintf (stderr, "cannot open coord file '%s'.\n", fname); + return (ERR); + } + } else { + fprintf (stderr, "'%s': coord file doesn't exist, ignoring.\n", + fname); + return (ERR); + } + return (OK); +} + + +/* CDL_MARKLINE -- Draw a line of given color between the two points + * specified. + */ + +#ifdef ANSI_FUNC + +int +cdl_markLine ( + CDLPtr cdl, /* package ptr */ + int xs, + int ys, /* line start points */ + int xe, + int ye, /* line end points */ + int color /* marker color */ +) +#else + +int +cdl_markLine (cdl, xs, ys, xe, ye, color) +CDLPtr cdl; /* package ptr */ +int xs, ys; /* line start points */ +int xe, ye; /* line end points */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + uchar *pix = NULL; + MarkerPtr mk = cdl_initLineMarker (xs, ys, xe, ye, color, width, style); + + if (cdl_debug) + printf ("[cdl_markLine] (%d,%d) -> (%d,%d) color=%d\n", + xs, ys, xe, ye, color); + + if (style >= L_HOLLOW) width = HOLLOW_LINE_WIDTH; + nx = ABS(xe-xs) + width + 1; + ny = ABS(ye-ys) + width + 1; + lx = min(xs,xe) - width/2 - 1; + ly = min(ys,ye) - width/2 - 1; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doLineMark (color, width, style, pix, xs, ys, xe, ye); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKBOX -- Draw a rectangular box given two corner endpoints. The + * box may be optionally filled with the specified color. + */ + +#ifdef ANSI_FUNC + +int +cdl_markBox ( + CDLPtr cdl, /* package ptr */ + int lx, + int ly, /* LL corner points */ + int ux, + int uy, /* UR corner points */ + int fill, /* fill rectangle? */ + int color /* marker color */ +) +#else + +int +cdl_markBox (cdl, lx, ly, ux, uy, fill, color) +CDLPtr cdl; /* package ptr */ +int lx, ly; /* LL corner points */ +int ux, uy; /* UR corner points */ +int fill; /* fill rectangle? */ +int color; /* marker color */ +#endif +{ + register int tmp, nx, ny; + register int width = cdl->linewidth, style = cdl->linestyle; + uchar *pix = NULL; + MarkerPtr mk = cdl_initBoxMarker (lx, ly, ux, uy, fill, color, + width, style); + + if (cdl_debug) + printf ("[cdl_markBox] (%d,%d) -> (%d,%d) fill=%d color=%d\n", + lx, ly, ux, uy, fill, color); + + /* Take care of a corner specified the wrong way. */ + if (lx > ux) { tmp = ux; ux = lx; lx = tmp; } + if (ly > uy) { tmp = uy; uy = ly; ly = tmp; } + nx = ux - lx + width + 1; + ny = uy - ly + width + 1; + lx = lx - width/2 - 1; + ly = ly - width/2 - 1; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doBoxMark (color, width, style, fill, pix, lx, ly, nx, ny); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKPOLYGON -- Draw a polygon on the display, optionally filling with + * the specified color. + */ + +#ifdef ANSI_FUNC + +int +cdl_markPolygon ( + CDLPtr cdl, /* package ptr */ + int xarray[], + int yarray[], /* vertex points */ + int npts, /* number of corners */ + int fill, /* fill polygon? */ + int color /* marker color */ +) +#else + +int +cdl_markPolygon (cdl, xarray, yarray, npts, fill, color) +CDLPtr cdl; /* package ptr */ +int xarray[], yarray[]; /* vertex points */ +int npts; /* number of corners */ +int fill; /* fill polygon? */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + int xmin, xmax, ymin, ymax; + uchar *pix; + MarkerPtr mk = cdl_initPolygonMarker (xarray, yarray, npts, + fill, color, width, style); + + /* Find the boundaries of the polygon. */ + cdl_minmax (xarray, npts, &xmin, &xmax); + cdl_minmax (yarray, npts, &ymin, &ymax); + nx = ABS(xmax-xmin) + width + 1; + ny = ABS(ymax-ymin) + width + 1; + lx = min(xmin,xmax) - width/2 - 1; + ly = min(ymin,ymax) - width/2 - 1; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + if (cdl_debug) + printf ("[cdl_markPolygon] npts=%d fill=%d color=%d nx=%d ny=%d\n", + npts, fill, color, nx, ny); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doPolygonMark (color, width, style, fill, xarray, yarray, npts, + pix, lx, ly, nx, ny, True); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKPOLYLINE -- Draw a polyline on the display, optionally filling with + * the specified color. + */ + +#ifdef ANSI_FUNC + +int +cdl_markPolyline ( + CDLPtr cdl, /* package ptr */ + int *xarray, + int *yarray, /* vertex points */ + int npts, /* number of points */ + int color /* marker color */ +) +#else + +int +cdl_markPolyline (cdl, xarray, yarray, npts, color) +CDLPtr cdl; /* package ptr */ +int *xarray, *yarray; /* vertex points */ +int npts; /* number of points */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + int xmin, xmax, ymin, ymax; + uchar *pix; + MarkerPtr mk = cdl_initPolylineMarker (xarray, yarray, npts, color, + width, style); + + /* Find the boundaries of the polyline. */ + cdl_minmax (xarray, npts, &xmin, &xmax); + cdl_minmax (yarray, npts, &ymin, &ymax); + nx = ABS(xmax-xmin) + width + 1; + ny = ABS(ymax-ymin) + width + 1; + lx = min(xmin,xmax) - width/2 - 1; + ly = min(ymin,ymax) - width/2 - 1; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + if (cdl_debug) + printf ("[cdl_markPolyline] npts=%d color=%d nx=%d ny=%d\n", + npts, color, nx, ny); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doPolygonMark (color, width, style, False, xarray, yarray, npts, + pix, lx, ly, nx, ny, False); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKCIRCLE -- Draw of circle on the display, optionally filling with + * the specified color. + */ + +#ifdef ANSI_FUNC + +int +cdl_markCircle ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* center position */ + int radius, /* radius of circle */ + int fill, /* fill circle? */ + int color /* marker color */ +) +#else + +int +cdl_markCircle (cdl, x, y, radius, fill, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* center position */ +int radius; /* radius of circle */ +int fill; /* fill circle? */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + uchar *pix; + MarkerPtr mk = cdl_initCircleMarker (x, y, radius, fill, color, + width, style); + + nx = ny = 2 * radius + width + 3; + lx = x - radius - width/2 - 1; + ly = y - radius - width/2 - 1; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + if (cdl_debug) + printf ("[cdl_markCircle] (%d,%d) radius=%d fill=%d color=%d\n", + x, y, radius, fill, color); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doCircleMark (x, y, radius, color, width, style, fill, pix, + lx, ly, nx, ny); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKCIRCANNULI -- Draw circular annuli on the display. + */ + +#ifdef ANSI_FUNC + +int +cdl_markCircAnnuli ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* center position */ + int radius, /* radius of 1st annulus*/ + int nannuli, /* no. of annuli */ + int sep, /* annuli sep (pixels) */ + int color /* marker color */ +) +#else + +int +cdl_markCircAnnuli (cdl, x, y, radius, nannuli, sep, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* center position */ +int radius; /* radius of 1st annulus*/ +int nannuli; /* no. of annuli */ +int sep; /* annuli sep (pixels) */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + uchar *pix; + MarkerPtr mk = cdl_initCircAnnMarker(x, y, radius, nannuli, sep, + color, width, style); + + nx = ny = 2 * (radius + nannuli * sep) + width + 3; + lx = x - (nx / 2) - width/2; + ly = y - (ny / 2) - width/2; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + if (cdl_debug) + printf("[cdl_markAnnuli] (%d,%d) radius=%d N=%d sep=%d color=%d\n", + x, y, radius, nannuli, sep, color); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doCircAnnuliMark (x, y, radius, nannuli, sep, color, width, style, + pix, lx, ly, nx, ny); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKELLIPSE -- Draw an ellipse with a given center, eccentricity + * and position on the display, optionally filling with the specified color. + */ + +#ifdef ANSI_FUNC + +int +cdl_markEllipse ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* center position */ + int xrad, + int yrad, /* x and y radii */ + float rotang, /* position angle (deg) */ + int fill, /* fill ellipse? */ + int color /* marker color */ +) +#else + +int +cdl_markEllipse (cdl, x, y, xrad, yrad, rotang, fill, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* center position */ +int xrad, yrad; /* x and y radii */ +float rotang; /* position angle (deg) */ +int fill; /* fill ellipse? */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + uchar *pix; + MarkerPtr mk = cdl_initEllipseMarker (x, y, xrad, yrad, rotang, + fill, color, width, style); + + nx = 2 * max(xrad,yrad) + width + 3; + ny = 2 * max(xrad,yrad) + width + 3; + lx = x - (nx / 2) - width/2; + ly = y - (ny / 2) - width/2; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + if (cdl_debug) + printf("[cdl_markEllipse] (%d,%d) R=(%d,%d) pa=%g fill=%d col=%d\n", + x, y, xrad, yrad, rotang, fill, color); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doEllipseMark (color, width, style, fill, x, y, xrad, yrad, rotang, + pix, lx, ly, nx, ny); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_MARKELLIPANNULI -- Draw elliptical annuli on the display. + */ + +#ifdef ANSI_FUNC + +int +cdl_markEllipAnnuli ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* center position */ + int xrad, + int yrad, /* radius of 1st annulus*/ + float ang, /* rotation angle */ + int nannuli, /* no. of annuli */ + int sep, /* annuli sep (pixels) */ + int color /* marker color */ +) +#else + +int +cdl_markEllipAnnuli (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* center position */ +int xrad, yrad; /* radius of 1st annulus*/ +float ang; /* rotation angle */ +int nannuli; /* no. of annuli */ +int sep; /* annuli sep (pixels) */ +int color; /* marker color */ +#endif +{ + register int nx, ny, lx, ly; + register int width = cdl->linewidth, style = cdl->linestyle; + uchar *pix; + MarkerPtr mk = cdl_initEllAnnMarker (x, y, xrad, yrad, ang, nannuli, + sep, color, width, style); + + nx = 2 * max(xrad + nannuli * sep, yrad + nannuli * sep) + width + 3; + ny = 2 * max(xrad + nannuli * sep, yrad + nannuli * sep) + width + 3; + lx = x - (nx / 2) - width/2; + ly = y - (ny / 2) - width/2; + cdl_initMarkPos (mk, nx, ny, lx, ly); + + if (cdl_debug) + printf("[cdl_markElAnn] (%d,%d) R=(%d,%d) pa=%g N=%d S=%d col=%d\n", + x, y, xrad, yrad, ang, nannuli, sep, color); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doEllipAnnuliMark (x, y, xrad, yrad, ang, nannuli, + sep, color, width, style, pix, lx, ly, nx, ny); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + + +/* CDL_MARKTEXT -- Draw a text string on the display at the given location. + */ + +#ifdef ANSI_FUNC + +int +cdl_markText ( + CDLPtr cdl, /* package ptr */ + int x, + int y, /* marker position */ + char *str, /* text string */ + float size, /* size scale factor */ + float angle, /* text rotation angle */ + int color /* marker color */ +) +#else + +int +cdl_markText (cdl, x, y, str, size, angle, color) +CDLPtr cdl; /* package ptr */ +int x, y; /* marker position */ +char *str; /* text string */ +float size; /* size scale factor */ +float angle; /* text rotation angle */ +int color; /* marker color */ +#endif +{ + register int lx, ly, nx, ny, w = cdl->textwidth; + register int len, font = cdl->font; + uchar *pix = NULL; + float cw, ch; + MarkerPtr mk = cdl_initTextMarker (x, y, str, size, color, font, w); + extern int cdl_getPixRegion(); + extern void cdl_insertMarker(), cdl_doLineInSubRas(); + + if (cdl_debug) + printf ("[cdl_markText] (%d,%d) str='%s' size=%g color=%d ang=%g\n", + x, y, str, size, color, angle); + + len = cdl_strlen (str, size, mk->font); + cw = CHARACTER_WIDTH * (size * FONT_SCALE) + FONT_SPACE; + ch = CHARACTER_HEIGHT * (size * FONT_SCALE); + if (angle == 0.0) { + /* Optimize a bit for horizontal text. */ + lx = x; + ly = y - (2 * size); + nx = cdl_strlen (str, size, mk->font); + ny = FONT_HEIGHT * (size * FONT_SCALE) + (6 * size); + if (strstr(str, "\\fU")) { + ny += ch - (ch * 0.666) / 2; + } + if (strstr(str, "\\fD")) { + ly -= ch - (ch * 0.666) / 2 ; + ny += ch - (ch * 0.666) / 2; + } + } else { + /* Compute the four corners of the rotated and scaled text. Then + * define the raster needed to get all of the text in the box. + */ + int xc[4], yc[4]; + int i, tx, ty, xmin, xmax, ymin, ymax; + double coso, sino; + + coso = cos ((double)(angle * (double)(M_PI/180.0))); + sino = sin ((double)(angle * (double)(M_PI/180.0))); + + xc[0] = -cw / 2; /* LL corner */ + yc[0] = -ch / 2; + xc[1] = -cw / 2; /* UL corner */ + yc[1] = ch + ch / 2; + xc[2] = len + cw / 2; /* UR corner */ + yc[2] = ch + ch / 2; + xc[3] = len + cw / 2; /* LR corner */ + yc[3] = -ch / 2; + + if (strstr(str, "\fU")) + yc[1] = yc[2] = yc[1] + (ch + ch / 2); + if (strstr(str, "\fD")) + yc[0] = yc[3] = yc[1] - (ch + ch / 2); + + /* Rotate the bounding box. */ + for (i=0; i < 4; i++) { + tx = xc[i], ty = yc[i]; + xc[i] = tx * coso - ty * sino + x + 0.5; + yc[i] = tx * sino + ty * coso + y + 0.5; + } + + cdl_minmax (xc, 4, &xmin, &xmax); + cdl_minmax (yc, 4, &ymin, &ymax); + + lx = xmin - cw / 2, ly = ymin - ch / 2; + nx = xmax - xmin + cw / 2; + ny = ymax - ymin + ch / 2; +/*cdl_markBox (cdl, lx, ly, lx+nx, ly+ny, 0, 205);*/ + } + cdl_initMarkPos (mk, nx, ny, lx, ly); + + /* Get the pixel region we'll be marking. */ + pix = (uchar *) malloc (nx * ny); + if (cdl_getPixRegion (cdl, lx, ly, nx, ny, pix)) + return (ERR); + + /* Save the image pixels in the display list for erasure later. */ + mk->refpix = (uchar *) malloc (nx * ny); + mk->markpix = (uchar *) malloc (nx * ny); + bcopy (pix, mk->refpix, nx * ny); + cdl_insertMarker (cdl, DLTail[cdl->frame-1], mk); + + /* Edit the pixels with the requested color and save the raster. */ + cdl_doTextMarker (x, y, str, size, angle, color, w, mk->font, + pix, lx, ly, nx, ny); + bcopy (pix, mk->markpix, nx * ny); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) { + free ((char *)pix); + return (ERR); + } + + free ((char *)pix); + return (OK); +} + + +/* CDL_SETFONT -- Set the default font type. + */ + +#ifdef ANSI_FUNC + +void +cdl_setFont ( + CDLPtr cdl, + int font +) +#else + +void +cdl_setFont (cdl, font) +CDLPtr cdl; +int font; +#endif +{ + if (font == F_ROMAN) cdl->font = F_ROMAN; + else if (font == F_GREEK) cdl->font = F_GREEK; + else if (font == F_TIMES) cdl->font = F_TIMES; + else if (font == F_FUTURA) cdl->font = F_FUTURA; + else if (font == F_BOLD) + cdl_setTextWidth (cdl, cdl->textwidth+1); + else + fprintf (stderr, "Invalid font specification.\n"); +} + + +/* CDL_SETTEXTWIDTH -- Set the default text width. + */ + +#ifdef ANSI_FUNC + +void +cdl_setTextWidth ( + CDLPtr cdl, + int width +) +#else + +void +cdl_setTextWidth (cdl, width) +CDLPtr cdl; +int width; +#endif +{ + cdl->textwidth = (width > 0 ? width : 1); +} + + + +/* CDL_SETLINEWIDTH -- Set the default line width. + */ + +#ifdef ANSI_FUNC + +void +cdl_setLineWidth ( + CDLPtr cdl, + int width +) +#else + +void +cdl_setLineWidth (cdl, width) +CDLPtr cdl; +int width; +#endif +{ + cdl->linewidth = (width > 0 ? width : 1); +} + + +/* CDL_SETLINESTYLE -- Set the default line style. + */ + +#ifdef ANSI_FUNC + +void +cdl_setLineStyle ( + CDLPtr cdl, + int style +) +#else + +void +cdl_setLineStyle (cdl, style) +CDLPtr cdl; +int style; +#endif +{ + cdl->linestyle = (style >= 0 ? style : 0); +} + + +/* CDL_DELETEMARK -- Delete the overlay mark whose center is closest to + * the given position. + */ + +#ifdef ANSI_FUNC + +int +cdl_deleteMark ( + CDLPtr cdl, /* package ptr */ + int x, + int y /* marker position */ +) +#else + +int +cdl_deleteMark (cdl, x, y) +CDLPtr cdl; /* package ptr */ +int x, y; /* marker position */ +#endif +{ + MarkerPtr mk, next, back; + + if (cdl_debug) + printf ("[cdl_deleteMark] (%d,%d)\n", x, y); + + if (DLHead[cdl->frame-1] == (MarkerPtr) NULL) + return (OK); + + /* Get the marker closest to the given point. */ + mk = cdl_findNearest (DLHead[cdl->frame-1], x, y); + + /* Write the region back to the display. */ + if (cdl_writeSubRaster(cdl, mk->lx, mk->ly, mk->nx, mk->ny, mk->refpix)) + return (ERR); + + /* For point markers we may need to also delete an associated label. */ + if (mk->type == MK_POINT && mk->number > 0 && mk->next != NULL) { + next = mk->next; + if (cdl_writeSubRaster(cdl, next->lx, next->ly, + next->nx, next->ny, next->refpix)) + return (ERR); + cdl_removeMarker (cdl, next); + } else if (mk->type == MK_TEXT && mk->back != NULL) { + /* If it's a text marker, see if the previous on was a point + * with a label. + */ + back = mk->back; + if (back->type == MK_POINT && back->number > 0) { + if (cdl_writeSubRaster(cdl, back->lx, back->ly, + back->nx, back->ny, back->refpix)) + return (ERR); + cdl_removeMarker (cdl, back); + } + } + + /* Delete the marker from the display list. */ + cdl_removeMarker (cdl, mk); + + return (OK); +} + + +/* CDL_CLEAROVERLAY -- Erase all marks in the current display list. Work + * from the tail of the list so we handle overlapping marks correctly. + */ + +#ifdef ANSI_FUNC + +int +cdl_clearOverlay ( + CDLPtr cdl /* package ptr */ +) +#else + +int +cdl_clearOverlay (cdl) +CDLPtr cdl; /* package ptr */ +#endif +{ + MarkerPtr mk, back; + + if (cdl_debug) + printf ("[cdl_clearOverlay]\n"); + + /* To clear the overlay we simply walk the display list and delete + * each point. + */ + for (mk = DLTail[cdl->frame-1]; mk != (MarkerPtr) NULL; mk = back) { + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, mk->lx, mk->ly, mk->nx, mk->ny, + mk->refpix)) + return (ERR); + + /* Delete the marker from the display list. */ + back = mk->back; + cdl_removeMarker (cdl, mk); + } + DLHead[cdl->frame-1] = DLTail[cdl->frame-1] = (MarkerPtr) NULL; + + return (OK); +} + + +/* CDL_REDRAWOVERLAY -- Redraw all marks in the current display list. + */ + +#ifdef ANSI_FUNC + +int +cdl_redrawOverlay ( + CDLPtr cdl /* package ptr */ +) +#else + +int +cdl_redrawOverlay (cdl) +CDLPtr cdl; /* package ptr */ +#endif +{ + MarkerPtr mk; + + if (cdl_debug) + printf ("[cdl_redrawOverlay]\n"); + + /* Just walk the list redisplaying the markers. */ + for (mk = DLHead[cdl->frame-1]; mk != (MarkerPtr) NULL; mk = mk->next) + /* Write the region back to the display. */ + if (cdl_writeSubRaster (cdl, mk->lx, mk->ly, mk->nx, mk->ny, + mk->markpix)) + return (ERR); + + return (OK); +} + + +/* CDL_BEGINDLIST -- + */ + +#ifdef ANSI_FUNC + +void +cdl_beginDList ( + int frame /* frame number */ +) +#else + +void +cdl_beginDList (frame) +int frame; /* frame number */ +#endif +{ +/* + if (DLFlag[frame]) + error "Display list already open for frame %d"; +*/ +} + + +/* CDL_ENDDLIST -- + */ + +#ifdef ANSI_FUNC + +void +cdl_endDList ( + int frame, /* frame number */ + int flush /* flush on close */ +) +#else + +void +cdl_endDList (frame, flush) +int frame; /* frame number */ +int flush; /* flush on close */ +#endif +{ +} + + +/* CDL_CLEARDLIST -- + */ + +#ifdef ANSI_FUNC + +void +cdl_clearDList ( + int frame /* frame number */ +) +#else + +void +cdl_clearDList (frame) +int frame; /* frame number */ +#endif +{ +} + + +/* CDL_DRAWDLIST -- + */ + +#ifdef ANSI_FUNC + +void +cdl_drawDList ( + int frame /* frame number */ +) +#else + +void +cdl_drawDList (frame) +int frame; /* frame number */ +#endif +{ +} + + + +/* ------------------- + * PRIVATE PROCEDUURES + * ------------------- */ + + +/* CDL_GETPIXREGION -- Given a corner position and size, return a subraster + * of the image pixels in that region. + */ + +#ifdef ANSI_FUNC + +static int +cdl_getPixRegion ( + CDLPtr cdl, /* package ptr */ + int lx, + int ly, /* corner position */ + int nx, + int ny, /* corner position */ + uchar *ras /* subraster pixels */ +) +#else + +static int +cdl_getPixRegion (cdl, lx, ly, nx, ny, ras) +CDLPtr cdl; /* package ptr */ +int lx, ly; /* corner position */ +int nx, ny; /* corner position */ +uchar *ras; /* subraster pixels */ +#endif +{ + if (ras == NULL) + ras = (uchar *) malloc (nx * ny); + + /* Do a server query to get the pixels. */ + return (cdl_readSubRaster (cdl, lx, ly, nx, ny, &ras)); +} + + +/* CDL_DOPOINTMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doPointMark ( + int color, /* overlay color */ + int type, /* type of mark to draw */ + uchar *pix, /* edit region raster */ + int sz /* mark size */ +) +#else + +static void +cdl_doPointMark (color, type, pix, sz) +int color; /* overlay color */ +int type; /* type of mark to draw */ +uchar *pix; /* edit region raster */ +int sz; /* mark size */ +#endif +{ + register int i, j, k, npts, center, cpix, fill = 0; + int x, y, width, xp[4], yp[4]; + + /* Save the central pixel value, we don't overwrite that. */ + x = y = (sz / 2); + center = ((sz / 2) * sz) + (sz / 2); + cpix = pix[center]; + + /* Check flags */ + if (type & M_POINT) { + cpix = color; + pix[center] = cpix; + } + if (type & M_FILL) + fill++; + + /* Draw the types requested. */ + if (type & M_BOX) + cdl_doBoxMark (color, 1, L_SOLID, fill, pix, 0, 0, sz, sz); + + if (type & M_PLUS || type & M_STAR) { + j = (y * sz); + for (i=0; i < sz; i++) + pix[j+i] = color; + j = ((sz - 1) * sz) + x; + for (i=0; i < sz; i++, j -= sz) + pix[j] = color; + } + + if (type & M_HLINE || type & M_HBLINE) { + npts = (sz - (sz / 3)) / 2; + if (type & M_HBLINE) { + j = ((y - 1) * sz); + width = 3; + } else { + j = (y * sz); + width = 1; + } + for (k=0; k < width; k++, j += sz) { + for (i=0; i < npts; i++) { + pix[j+i] = color; + pix[j+sz-i-1] = color; + } + } + } + + if (type & M_VLINE || type & M_VBLINE) { + npts = (sz - (sz / 3)) / 2; + if (type & M_VBLINE) { + for (k=-1; k < 2; k++) { + j = ((sz - 1) * sz) + x; + for (i=0; i < npts; i++, j -= sz) { + pix[j+k] = color; + pix[(i*sz)+x+k] = color; + } + } + } else { + j = ((sz - 1) * sz) + x; + for (i=0; i < npts; i++, j -= sz) { + pix[j] = color; + pix[(i*sz)+x] = color; + } + } + } + + if (type & M_CROSS || type & M_STAR) { + for (i=0, j=((sz-1)*sz); i < sz; i++, j-=sz) { + pix[(i*sz)+i] = color; /* main diagonal */ + pix[j+i] = color; /* off diagonal */ + } + } + + if (type & M_DIAMOND) { + xp[0] = x - (sz/2); yp[0] = y; + xp[1] = x; yp[1] = y + (sz/2); + xp[2] = x + (sz/2); yp[2] = y; + xp[3] = x; yp[3] = y - (sz/2); + cdl_doPolygonMark (color, 1, L_SOLID, fill, xp, yp, 4, pix, + 0, 0, sz, sz, True); + pix[x] = color; + } + + if (type & M_CIRCLE) + cdl_doCircleMark(x, y, (sz/2)+1, color, 1, L_SOLID, fill, pix, + 0, 0, sz, sz); + + /* Restore the central pixel value, we don't usually overwrite that. + */ + if (!fill && !(type & M_POINT)) + pix[center] = cpix; +} + + +/* CDL_DOLINEMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doLineMark ( + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + uchar *pix, /* edit region raster */ + int xs, + int ys, + int xe, + int ye /* line endpoints */ +) +#else + +static void +cdl_doLineMark (color, width, style, pix, xs, ys, xe, ye) +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +uchar *pix; /* edit region raster */ +int xs, ys, xe, ye; /* line endpoints */ +#endif +{ + register int nx, ny, lx, ly; + + nx = ABS(xe-xs) + width + 1; + ny = ABS(ye-ys) + width + 1; + lx = min(xs,xe) - width/2 - 1; + ly = min(ys,ye) - width/2 - 1; + + /* Handle a line between arbitrary endpoints of any style. */ + if (style == L_SOLID || style >= L_HOLLOW) { + cdl_doLineInSubRas (pix, color, width, style, xs, xe, ys, ye, + lx, ly, nx ,ny); + } else { + int x[2], y[2]; + + switch (style) { + case L_DASHED: CLEAR_DASH_COUNT; break; + case L_DOTTED: CLEAR_DOT_COUNT; break; + case L_DOTDASH: CLEAR_DOTDASH_COUNT; break; + } + + x[0] = xs, x[1] = xe; + y[0] = ys, y[1] = ye; + cdl_doDashedLine (pix, color, width, style, x, y, 2, + lx, ly, nx ,ny); + } +} + + +/* CDL_DOBOXMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doBoxMark ( + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int fill, /* fill the box? */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny /* box size */ +) +#else + +static void +cdl_doBoxMark (color, width, style, fill, pix, lx, ly, nx, ny) +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int fill; /* fill the box? */ +uchar *pix; /* edit region raster */ +int lx, ly; /* box corner */ +int nx, ny; /* box size */ +#endif +{ + register int i=0, j=0, k=0, np = (nx * ny); + + /* Edit the pixels with the requested color. */ + if (fill) { + /* Fill the entire rectangle with the color. */ + for (i=0; i < np ; i++) + pix[i] = color; + } else { + if (style == L_SOLID) { + /* Change just the borders of the box to requested color. */ + for (k=0; k < width; k++) + for (i=0, j = (ny-k-1) * nx; i < nx; i++, j++) + pix[(k*nx)+i] = pix[j] = color; + for (k=0; k < width; k++) + for (i=0+k, j = (nx-k-1); i < np; i+=nx, j+=nx) + pix[i] = pix[j] = color; + + } else if (style == L_HOLLOW) { + /* Change just the borders of the box to requested style. */ + for (k=0; k < HOLLOW_LINE_WIDTH; k++) + for (i=0, j = (ny-k-1) * nx; i < nx; i++, j++) + pix[(k*nx)+i] = pix[j] = (k == 2 ? 0 : color); + for (k=0; k < HOLLOW_LINE_WIDTH; k++) + for (i=0+k, j = (nx-k-1); i < np; i+=nx, j+=nx) + pix[i] = pix[j] = color; + + /* Redraw the center of the box to create the hollow. */ + for (i=3, j = (ny-3) * nx + 2; i < nx - 2; i++, j++) + pix[2*nx+i] = pix[j] = 0; + for (i=(2*nx) + 2, j = (nx-3); i < np - (2 * nx); i+=nx, j+=nx) + pix[i] = pix[2*nx+j] = 0; + + } else if (style == L_SHADOW) { + /* Change just the borders of the box to requested style. */ + for (k=0; k < SHADOW_LINE_WIDTH; k++) + for (i=0, j = (ny-k-1) * nx; i < nx; i++, j++) + pix[(k*nx)+i] = pix[j] = (k > 1 ? 0 : color); + for (k=0; k < SHADOW_LINE_WIDTH; k++) + for (i=(2*nx)+k, j = (3*nx-k-1); i < np-(2*nx); i+=nx,j+=nx) + pix[i] = pix[j] = (k > 1 ? 0 : color); + + } else { + int x[2], y[2], w = width, s = style; + + dash = 0, dot = 0, dotdash = 0; + +/* bottom */ x[0] = lx+width, y[0] = ly+w/2; + x[1] = lx+nx-width, y[1] = ly+w/2; + cdl_doDashedLine (pix, color, w, s, x, y, 2, lx, ly, nx, ny); + dash = 0, dot = 0, dotdash = 0; + +/* right */ x[0] = lx+nx-w/2-1, y[0] = ly+width; + x[1] = lx+nx-w/2-1, y[1] = ly+ny-width; + cdl_doDashedLine (pix, color, w, s, x, y, 2, lx, ly, nx, ny); + dash = 0, dot = 0, dotdash = 0; + +/* top */ x[0] = lx+nx-width, y[0] = ly+ny-w/2-1; + x[1] = lx+width, y[1] = ly+ny-w/2-1; + cdl_doDashedLine (pix, color, w, s, x, y, 2, lx, ly, nx, ny); + dash = 0, dot = 0, dotdash = 0; + +/* left */ x[0] = lx+w/2, y[0] = ly+ny-width; + x[1] = lx+w/2, y[1] = ly+width; + cdl_doDashedLine (pix, color, w, s, x, y, 2, lx, ly, nx, ny); + dash = 0, dot = 0, dotdash = 0; + } + } +} + + +/* CDL_DOPOLYGONMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doPolygonMark ( + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int fill, /* fill polygon */ + int *x, + int *y, /* coordinate arrays */ + int npts, /* npts to plot */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny, /* subraster size */ + int close /* close the polygon */ +) +#else + +static void +cdl_doPolygonMark (color, width, style, fill, x, y, npts, pix, lx, ly, nx, ny, close) +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int fill; /* fill polygon */ +int *x, *y; /* coordinate arrays */ +int npts; /* npts to plot */ +uchar *pix; /* edit region raster */ +int lx, ly; /* subraster corner */ +int nx, ny; /* subraster size */ +int close; /* close the polygon */ +#endif +{ + register int i, nseg = (npts - 1); + + if (cdl_debug) + printf ("[cdl_doPolygonMark] npts=%d lx=%d ly=%d nseg=%d\n", + npts, lx, ly, nseg); + + /* For solid lines just draw the segments */ + if (style == L_SOLID || style >= L_HOLLOW) { + + /* Connect all the vertices. */ + if (style == L_HOLLOW) { + for (i=0; i < nseg; i++) + cdl_doLineInSubRas (pix, color, HOLLOW_LINE_WIDTH, L_SOLID, + x[i], x[i+1], y[i], y[i+1], lx, ly, nx, ny); + for (i=0; i < nseg; i++) + cdl_doLineInSubRas (pix, 0, 1, L_SOLID, + x[i], x[i+1], y[i], y[i+1], lx, ly, nx, ny); + } else { + for (i=0; i < nseg; i++) + cdl_doLineInSubRas (pix, color, width, style, x[i], x[i+1], + y[i], y[i+1], lx, ly, nx, ny); + } + + /* Now connect the last point to the first to close the polygon. */ + if (close) { + if (x[0] != x[npts] && y[0] != y[npts]) + if (style == L_HOLLOW) { + cdl_doLineInSubRas (pix, color, HOLLOW_LINE_WIDTH, + L_SOLID, x[0], x[nseg], y[0], y[nseg], + lx, ly, nx, ny); + cdl_doLineInSubRas (pix, 0, 1, L_SOLID, + x[0], x[nseg], y[0], y[nseg], lx, ly, nx, ny); + } else { + cdl_doLineInSubRas (pix, color, width, style, + x[0], x[nseg], y[0], y[nseg], lx, ly, nx, ny); + } + + /* Flood fill the polygon if requested. */ + if (fill) + cdl_fillArea (pix, nx, ny, color); + } + + } else { + switch (style) { + case L_DASHED: CLEAR_DASH_COUNT; break; + case L_DOTTED: CLEAR_DOT_COUNT; break; + case L_DOTDASH: CLEAR_DOTDASH_COUNT; break; + } + + if (close) { + register int i, *xp, *yp; + + xp = (int *) malloc ((npts+1) * sizeof(int)); + yp = (int *) malloc ((npts+1) * sizeof(int)); + for (i=0; i < npts; i++) { + xp[i] = x[i]; + yp[i] = y[i]; + } + xp[i] = x[0]; + yp[i] = y[0]; + cdl_doDashedLine (pix, color, width, style, xp, yp, npts+1, + lx, ly, nx ,ny); + + free ((char *) xp); + free ((char *) yp); + } else + cdl_doDashedLine (pix, color, width, style, x, y, npts, + lx, ly, nx ,ny); + } +} + + +/* CDL_DOCIRCLEMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doCircleMark ( + int x, + int y, /* center point */ + int radius, /* circle radius */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int fill, /* fill the box? */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny /* box size */ +) +#else + +static void +cdl_doCircleMark (x, y, radius, color, width, style, fill, pix, lx, ly, nx, ny) +int x, y; /* center point */ +int radius; /* circle radius */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int fill; /* fill the box? */ +uchar *pix; /* edit region raster */ +int lx, ly; /* subraster corner */ +int nx, ny; /* box size */ +#endif +{ + int xp[N_CIRCLE_PTS+1], yp[N_CIRCLE_PTS+1]; + + /* Get the coordinates for drawing the circle. */ + cdl_getCircleCoords (x, y, radius, xp, yp, N_CIRCLE_PTS); + + /* Connect the dots to draw the circle. */ + cdl_doPolygonMark (color, width, style, fill, xp, yp, N_CIRCLE_PTS, + pix, lx, ly, nx, ny, True); +} + + +/* CDL_DOCIRCANNULIMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doCircAnnuliMark ( + int x, + int y, /* center point */ + int radius, /* circle radius */ + int nannuli, /* No. of annuli */ + int sep, /* annulus separation */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny /* box size */ +) +#else + +static void +cdl_doCircAnnuliMark(x, y, radius, nannuli, sep, color, width, style, pix, lx, ly, nx, ny) +int x, y; /* center point */ +int radius; /* circle radius */ +int nannuli; /* No. of annuli */ +int sep; /* annulus separation */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +uchar *pix; /* edit region raster */ +int lx, ly; /* subraster corner */ +int nx, ny; /* box size */ +#endif +{ + register int i; + + /* For each annulus radius draw the circle. */ + for (i=0; i <= nannuli; i++) + cdl_doCircleMark (x, y, radius + (i* sep), color, width, style, + False, pix, lx, ly, nx, ny); +} + + +/* CDL_DOELLIPSEMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doEllipseMark ( + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int fill, /* fill the box? */ + int xc, + int yc, /* ellipse center */ + int xrad, + int yrad, /* semimajor axes */ + float ang, /* rotation angle */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny /* box size */ +) +#else + +static void +cdl_doEllipseMark (color, width, style, fill, xc, yc, xrad, yrad, ang, pix,lx,ly,nx,ny) +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int fill; /* fill the box? */ +int xc, yc; /* ellipse center */ +int xrad, yrad; /* semimajor axes */ +float ang; /* rotation angle */ +uchar *pix; /* edit region raster */ +int lx, ly; /* subraster corner */ +int nx, ny; /* box size */ +#endif +{ + int xp[N_ELLIPSE_PTS+1], yp[N_ELLIPSE_PTS+1]; + + /* Get the coordinates for drawing the ellipse. */ + cdl_getEllipseCoords (xc, yc, xrad, yrad, ang, xp, yp); + + /* Connect the dots to draw the ellipse. */ + cdl_doPolygonMark (color, width, style, fill, xp, yp, N_ELLIPSE_PTS, + pix, lx, ly, nx, ny, True); +} + + +/* CDL_DOELLIPANNULIMARK -- Edit a given raster with the requested mark. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doEllipAnnuliMark ( + int x, + int y, /* ellipse center */ + int xrad, + int yrad, /* semimajor axes */ + float ang, /* rotation angle */ + int nannuli, /* No. of annuli */ + int sep, /* annulus separation */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny /* box size */ +) +#else + +static void +cdl_doEllipAnnuliMark(x, y, xrad, yrad, ang, nannuli, sep, color, width, + style, pix, lx, ly, nx, ny) +int x, y; /* ellipse center */ +int xrad, yrad; /* semimajor axes */ +float ang; /* rotation angle */ +int nannuli; /* No. of annuli */ +int sep; /* annulus separation */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +uchar *pix; /* edit region raster */ +int lx, ly; /* subraster corner */ +int nx, ny; /* box size */ +#endif +{ + register int i, xr, yr; + + /* For each annulus compute the ellipse and draw it... */ + for (i=0; i <= nannuli; i++) { + xr = xrad + (i * sep); + yr = yrad + (i * sep); + cdl_doEllipseMark (color, width, style, False, x, y, xr, yr, ang, + pix, lx, ly, nx, ny); + } +} + + +/* CDL_DOTEXTMARKER -- Draw a text string to the display. + */ + +#ifdef ANSI_FUNC + +int +cdl_doTextMarker ( + int x, + int y, /* LL text position */ + char *string, /* string to draw */ + float txtsize, /* relative scale size */ + float angle, /* text rotation angle */ + int color, /* overlay color */ + int width, /* line width */ + int txtfont, /* text font */ + uchar *pix, /* edit region raster */ + int lx, + int ly, /* subraster corner */ + int nx, + int ny /* box size */ +) +#else + +int +cdl_doTextMarker (x,y,string,txtsize,angle,color,width,txtfont,pix,lx,ly,nx,ny) +int x, y; /* LL text position */ +char *string; /* string to draw */ +float txtsize; /* relative scale size */ +float angle; /* text rotation angle */ +int color; /* overlay color */ +int width; /* line width */ +int txtfont; /* text font */ +uchar *pix; /* edit region raster */ +int lx, ly; /* subraster corner */ +int nx, ny; /* box size */ +#endif +{ + char chr, *sp = string; + int mx, my, stroke, tab1, tab2, i, j, pen, len; + int x1, x2, y1, y2; + int oldfont, font, offset = 0; + register int w, cw, ch, cx, cy, ip; + float px, py, size = txtsize; + double coso, sino; + int bitupk(); + + font = oldfont = txtfont; + coso = cos ((double) (-angle * (double)(M_PI / 180.0))); + sino = sin ((double) (-angle * (double)(M_PI / 180.0))); + + /* Loop over each character in the string. */ + len = strlen (string); + x1 = cx = x; + y1 = cy = y; + + cw = CHARACTER_WIDTH * (size * FONT_SCALE) + FONT_SPACE; + ch = CHARACTER_HEIGHT * (size * FONT_SCALE); + for (j = 0; j < len && *sp; j++, sp++) { + +escape: + /* Check for an inline font escape. */ + if (*sp == '\\' && *(sp+1) == 'f') { + sp++; sp++; + if (*sp != 'P') + oldfont = font; + + switch (*sp) { + case 'B': + width = width + 1; + break; + case 'R': + font = F_ROMAN; + break; + case 'F': + font = F_FUTURA; + break; + case 'T': + font = F_TIMES; + break; + case 'G': + font = F_GREEK; + break; + case 'P': + if (width > 1) + width = width - 1; + font = oldfont; + break; + + /* Check for a super/subscript escape. */ + case 'U': + offset += ch - (ch * 0.666) / 2; + break; + case 'D': + offset -= ch - (ch * 0.666) / 2; + break; + } + sp++; + if (*sp == '\\') + goto escape; + } + + /* Adjust the size if we're doing sub/superscript. */ + if (offset != 0) + size = txtsize * 0.666; + else + size = txtsize; + + if (*sp < CHARACTER_START || *sp > CHARACTER_END) + chr = i = '?' - CHARACTER_START; + else + chr = i = *sp - CHARACTER_START; + + switch (font) { + case F_ROMAN: + tab1 = chridx[i] - 1; + tab2 = chridx[i+1] - 1; + break; + case F_GREEK: + tab1 = gchidx[i] - 1; + tab2 = gchidx[i+1] - 1; + break; + case F_TIMES: + tab1 = timidx[i] - 1; + tab2 = timidx[i+1] - 1; + break; + case F_FUTURA: + tab1 = futidx[i] - 1; + tab2 = futidx[i+1] - 1; + break; + } + + for (i=tab1; i <= tab2; i++) { + switch (font) { + case F_ROMAN: + stroke = chrtab[i]; break; + case F_GREEK: + stroke = gchtab[i]; break; + case F_TIMES: + stroke = timtab[i]; break; + case F_FUTURA: + stroke = futtab[i]; break; + } + px = (float) bitupk (stroke, COORD_X_START, COORD_X_LEN); + py = (float) bitupk (stroke, COORD_Y_START, COORD_Y_LEN); + pen = bitupk (stroke, COORD_PEN_START, COORD_PEN_LEN); + + /* Scale size of character. */ + px = px * (size * FONT_SCALE); + py = py * (size * FONT_SCALE) + offset; + + /* Shift and rotate. + */ + mx = cx + px * coso + py * sino; + my = cy - px * sino + py * coso; + + if (pen == 0) { + /* Move start point. */ + x1 = mx; + y1 = my; + } else { + /* Draw to this point and update. */ + x2 = mx; + y2 = my; + cdl_doLineInSubRas (pix, color, width, L_SOLID, + x1, x2, y1, y2, lx, ly, nx, ny); + x1 = x2; + y1 = y2; + } + } + + /* Update the character position. */ + ip = (int) chr; + switch (font) { + case F_ROMAN: + cx += cw * coso; + cy -= cw * sino; + + /* Now correct a bit to kludge a nice spacing. */ + if (index("il1:;.,!|'`", *sp)) { + cx -= FONT_SPACE * coso; + cy += FONT_SPACE * sino; + } else if (*sp == 'r') { + cx -= (FONT_SPACE - 2) * coso; + cy += (FONT_SPACE - 2) * sino; + } + break; + case F_GREEK: + w = (gchwid[ip] / 2) * (size * FONT_SCALE) + FONT_SPACE + 2; + cx += w * coso; + cy -= w * sino; + break; + case F_TIMES: + w = (timwid[ip] - 12) * (size * FONT_SCALE) + FONT_SPACE + 2; + cx += w * coso; + cy -= w * sino; + break; + case F_FUTURA: + w = (futwid[ip] / 2) * (size * FONT_SCALE) + FONT_SPACE + 2; + cx += w * coso; + cy -= w * sino; + break; + } + } + + return (OK); +} + + + + +/* ------------------------ + * Display List Procedures + * ------------------------*/ + + + +/* CDL_FREEDISPLAYLIST -- Free up the named display list. + */ + +#ifdef ANSI_FUNC + +int +cdl_freeDisplayList ( + CDLPtr cdl, /* package ptr */ + MarkerPtr head +) +#else + +int +cdl_freeDisplayList (cdl, head) +CDLPtr cdl; /* package ptr */ +MarkerPtr head; +#endif +{ + MarkerPtr mk; + + if (cdl_debug) + printf ("[cdl_freeDisplayList]\n"); + + /* Just walk the list freeing the markers. */ + for (mk = head; mk != (MarkerPtr) NULL; mk = mk->next) + cdl_removeMarker (cdl, mk); + + return (OK); +} + + +/* CDL_INSERTMARKER -- Insert a marker in the display list after the given + * entry. The display list is maintained as a doubly linked list of markers. + */ + +#ifdef ANSI_FUNC + +static void +cdl_insertMarker ( + CDLPtr cdl, /* package ptr */ + MarkerPtr back, /* insert point */ + MarkerPtr new /* marker to insert */ +) +#else + +static void +cdl_insertMarker (cdl, back, new) +CDLPtr cdl; /* package ptr */ +MarkerPtr back; /* insert point */ +MarkerPtr new; /* marker to insert */ +#endif +{ + MarkerPtr tmp; + + /* If the back pointer is null it means we're creating the head. */ + if (back == (MarkerPtr) NULL) { + DLHead[cdl->frame-1] = DLTail[cdl->frame-1] = new; + new->back = new->next = (MarkerPtr) NULL; + + } else { + /* Otherwise reset the pointers to insert the marker. */ + tmp = back->next; + back->next = new; + new->back = back; + + /* If the beck marker pointed at something, take care of that. */ + if (tmp) { + new->next = tmp; + tmp->back = new; + } else { + new->next = (MarkerPtr) NULL; + DLTail[cdl->frame-1] = new; + } + } +} + + +/* CDL_REMOVEMARKER -- Remove a marker from the display list. + */ + +#ifdef ANSI_FUNC + +static void +cdl_removeMarker ( + CDLPtr cdl, /* package ptr */ + MarkerPtr mk /* marker to delete */ +) +#else + +static void +cdl_removeMarker (cdl, mk) +CDLPtr cdl; /* package ptr */ +MarkerPtr mk; /* marker to delete */ +#endif +{ + if (mk->back) /* handle the back ptr */ + mk->back->next = mk->next; + else + DLHead[cdl->frame-1] = mk->next; + if (mk->next) /* handle the next ptr */ + mk->next->back = mk->back; + else + DLTail[cdl->frame-1] = mk->back; + + /* Now free up the marker and internal pointers. */ + if (mk->str) free ((uchar *) mk->str); + if (mk->refpix) free ((uchar *) mk->refpix); + if (mk->markpix) free ((uchar *) mk->markpix); + if (mk->xp) free ((uchar *) mk->xp); + if (mk->yp) free ((uchar *) mk->yp); + free ((MarkerPtr) mk); +} + + +/* CDL_FINDNEAREST -- Find the marker in the display list that is closest + * to the indicated point. For markers with a defined center we check the + * distance to the central point. For polylines and polygons we check for + * a vertex ir knot point that is closest. The marker is then returned. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_findNearest ( + MarkerPtr head, /* display list head */ + int x, + int y /* pixel coords */ +) +#else + +static MarkerPtr +cdl_findNearest (head, x, y) +MarkerPtr head; /* display list head */ +int x, y; /* pixel coords */ +#endif +{ + MarkerPtr mk, nearest; + register float dmin = 10.0e9, mk_dist, dist = 10.0e9, A, C, cx, cy; + register int i; + + if (head == (MarkerPtr) NULL) + return ((MarkerPtr) NULL); + + nearest = head; + for (mk = head; mk ; mk = mk->next) { + switch (mk->type) { + case MK_POLYLINE: + case MK_POLYGON: + /* Find the nearest point in the poly. */ + for (i=0; i < mk->npts; i++) { + mk_dist = sqrt ((double)(ABS(x - mk->x) * ABS(x - mk->x) + + ABS(y - mk->y) * ABS(y - mk->y)) ); + if (mk_dist < dmin) + dmin = mk_dist; + } + mk_dist = dmin; + break; + + case MK_BOX: + /* Select the box center closest to the point. */ + cx = (mk->xp[1] + mk->xp[0]) / 2; + cy = (mk->yp[1] + mk->yp[0]) / 2; + mk_dist = sqrt ((double)(ABS(x - cx) * ABS(x - cx) + + ABS(y - cy) * ABS(y - cy)) ); + break; + + case MK_LINE: + A = (float) ((mk->yp[1] - mk->yp[0]) / (mk->xp[1] - mk->xp[0])); + C = mk->yp[0] - A * x; + mk_dist = ABS( (A * x - y + C) / sqrt (A * A + 1)); + break; + + case MK_POINT: + case MK_CIRCLE: + case MK_CIRCANN: + case MK_ELLIPSE: + case MK_ELLIPANN: + case MK_TEXT: + /* Get the distance from the point to the center. */ + mk_dist = sqrt ((double)(ABS(x - mk->x) * ABS(x - mk->x) + + ABS(y - mk->y) * ABS(y - mk->y)) ); + } + if (mk_dist < dist) { + dist = mk_dist; + nearest = mk; + } + + if (cdl_debug) + printf ("Nearest: Marker type=%2d dist=%g mk_dist=%g N=%d\n", + mk->type, dist, mk_dist, nearest->type); + } + return (nearest); +} + + +/* CDL_PRINTDISPLAYLIST -- Print the display list to a file. + */ + +#ifdef ANSI_FUNC + +static void +cdl_printDisplayList ( + FILE *fd, /* file descriptor */ + MarkerPtr head /* display list head */ +) +#else + +static void +cdl_printDisplayList (fd, head) +FILE *fd; /* file descriptor */ +MarkerPtr head; /* display list head */ +#endif +{ + MarkerPtr mk; + + for (mk = head; mk ; mk = mk->next) { + switch (mk->type) { + case MK_POINT: printf ("point\t\t"); break; + case MK_LINE: printf ("line\t\t"); break; + case MK_BOX: printf ("box\t\t"); break; + case MK_POLYLINE: printf ("polyline\t\t"); break; + case MK_POLYGON: printf ("polygon\t\t"); break; + case MK_CIRCLE: printf ("circle\t\t"); break; + case MK_CIRCANN: printf ("circann\t\t"); break; + case MK_ELLIPSE: printf ("ellipse\t\t"); break; + case MK_ELLIPANN: printf ("ellipann\t\t"); break; + case MK_TEXT: printf ("text\t\t"); break; + } + printf ("mk=%d back=%10d next=%10d\n", + (int)mk, (int)mk->back, (int)mk->next); + } +} + + +/* CDL_INITPOINTMARKER -- Allocate and initialize the space for a point marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initPointMarker ( + int x, + int y, /* marker position */ + int number, /* if > 0, label value */ + int size, /* marker size (pixels) */ + int type, /* type to draw */ + int color /* marker color */ +) +#else + +static MarkerPtr +cdl_initPointMarker (x, y, number, size, type, color) +int x, y; /* marker position */ +int number; /* if > 0, label value */ +int size; /* marker size (pixels) */ +int type; /* type to draw */ +int color; /* marker color */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_POINT; + mk->x = x; + mk->y = y; + mk->number = number; + mk->size = size; + mk->pt_type = type; + mk->color = color; + return mk; +} + + + +/* CDL_INITPOINTLABELMARKER -- Allocate and initialize the space for a point + * with a text label marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initPointLabelMarker ( + int x, + int y, /* marker position */ + char *label, /* point label str */ + int size, /* marker size (pixels) */ + int type, /* type to draw */ + int color, /* marker color */ + int font /* label font */ +) +#else + +static MarkerPtr +cdl_initPointLabelMarker (x, y, label, size, type, color, font) +int x, y; /* marker position */ +char *label; /* point label str */ +int size; /* marker size (pixels) */ +int type; /* type to draw */ +int color; /* marker color */ +int font; /* label font */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_POINT; + mk->x = x; + mk->y = y; + mk->size = size; + mk->pt_type = type; + mk->color = color; + mk->font = font; + mk->str = (char *) malloc (strlen(label) + 1); + strcpy (mk->str, label); + return mk; +} + + +/* CDL_INITLINEMARKER -- Allocate and initialize the space for a line marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initLineMarker ( + int x1, + int y1, /* line start points */ + int x2, + int y2, /* line end points */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initLineMarker (x1, y1, x2, y2, color, width, style) +int x1, y1; /* line start points */ +int x2, y2; /* line end points */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line width */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_LINE; + mk->x = x1; + mk->y = y1; + mk->xp = (int *) malloc (2 * sizeof(int)); + mk->xp[0] = x1; + mk->xp[1] = x2; + mk->yp = (int *) malloc (2 * sizeof(int)); + mk->yp[0] = y1; + mk->yp[1] = y2; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITBOXMARKER -- Allocate and initialize the space for a box marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initBoxMarker ( + int lx, + int ly, /* LL corner points */ + int ux, + int uy, /* UR corner points */ + int fill, /* fill rectangle? */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initBoxMarker (lx, ly, ux, uy, fill, color, width, style) +int lx, ly; /* LL corner points */ +int ux, uy; /* UR corner points */ +int fill; /* fill rectangle? */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_BOX; + mk->x = lx; + mk->y = ly; + mk->xp = (int *) malloc (2 * sizeof(int)); + mk->xp[0] = lx; + mk->xp[1] = ux; + mk->yp = (int *) malloc (2 * sizeof(int)); + mk->yp[0] = ly; + mk->yp[1] = uy; + mk->fill = fill; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITPOLYLINEMARKER -- Allocate and initialize the space for a + * polyine marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initPolylineMarker ( + int *x, + int *y, /* vertex points */ + int npts, /* number of points */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initPolylineMarker (x, y, npts, color, width, style) +int *x, *y; /* vertex points */ +int npts; /* number of points */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_POLYLINE; + mk->xp = (int *) malloc (npts * sizeof(int)); + mk->yp = (int *) malloc (npts * sizeof(int)); + bcopy (x, mk->xp, npts * sizeof(int)); + bcopy (y, mk->yp, npts * sizeof(int)); + mk->x = mk->xp[0]; + mk->y = mk->yp[0]; + mk->npts = npts; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITPOLYGONMARKER -- Allocate and initialize the space for a + * polygon marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initPolygonMarker ( + int *x, + int *y, /* vertex points */ + int npts, /* number of corners */ + int fill, /* fill polygon? */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initPolygonMarker (x, y, npts, fill, color, width, style) +int *x, *y; /* vertex points */ +int npts; /* number of corners */ +int fill; /* fill polygon? */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_POLYGON; + mk->xp = (int *) malloc (npts * sizeof(int)); + mk->yp = (int *) malloc (npts * sizeof(int)); + bcopy (x, mk->xp, npts * sizeof(int)); + bcopy (y, mk->yp, npts * sizeof(int)); + mk->x = mk->xp[0]; + mk->y = mk->yp[0]; + mk->npts = npts; + mk->fill = fill; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITCIRCLEMARKER -- Allocate and initialize the space for a + * circle marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initCircleMarker ( + int x, + int y, /* center position */ + int radius, /* radius of circle */ + int fill, /* fill circle? */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initCircleMarker (x, y, radius, fill, color, width, style) +int x, y; /* center position */ +int radius; /* radius of circle */ +int fill; /* fill circle? */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_CIRCLE; + mk->x = x; + mk->y = y; + mk->radius = radius; + mk->fill = fill; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITCIRCANNMARKER -- Allocate and initialize the space for a + * circular annuli marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initCircAnnMarker ( + int x, + int y, /* center position */ + int radius, /* radius of 1st annulus*/ + int nannuli, /* no. of annuli */ + int sep, /* annuli sep (pixels) */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initCircAnnMarker (x, y, radius, nannuli, sep, color, width, style) +int x, y; /* center position */ +int radius; /* radius of 1st annulus*/ +int nannuli; /* no. of annuli */ +int sep; /* annuli sep (pixels) */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_CIRCANN; + mk->x = x; + mk->y = y; + mk->radius = radius; + mk->nannuli = nannuli; + mk->sep = sep; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITELLIPSEMARKER -- Allocate and initialize the space for a + * ellipse marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initEllipseMarker ( + int x, + int y, /* center position */ + int xrad, + int yrad, /* x and y radii */ + float ang, /* position angle (deg) */ + int fill, /* fill ellipse? */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initEllipseMarker (x, y, xrad, yrad, ang, fill, color, width, style) +int x, y; /* center position */ +int xrad, yrad; /* x and y radii */ +float ang; /* position angle (deg) */ +int fill; /* fill ellipse? */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_ELLIPSE; + mk->x = x; + mk->y = y; + mk->xrad = xrad; + mk->yrad = yrad; + mk->ang = ang; + mk->fill = fill; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITELLANNMARKER -- Allocate and initialize the space for a + * elliptical annuli marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initEllAnnMarker ( + int x, + int y, /* center position */ + int xrad, + int yrad, /* radius of 1st annulus*/ + float ang, /* rotation angle */ + int nannuli, /* no. of annuli */ + int sep, /* annuli sep (pixels) */ + int color, /* marker color */ + int width, /* line width */ + int style /* line style */ +) +#else + +static MarkerPtr +cdl_initEllAnnMarker (x, y, xrad, yrad, ang, nannuli, sep, color, width, style) +int x, y; /* center position */ +int xrad, yrad; /* radius of 1st annulus*/ +float ang; /* rotation angle */ +int nannuli; /* no. of annuli */ +int sep; /* annuli sep (pixels) */ +int color; /* marker color */ +int width; /* line width */ +int style; /* line style */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_ELLIPANN; + mk->x = x; + mk->y = y; + mk->xrad = xrad; + mk->yrad = yrad; + mk->ang = ang; + mk->nannuli = nannuli; + mk->sep = sep; + mk->color = color; + mk->linewidth = width; + mk->linestyle = style; + return mk; +} + + +/* CDL_INITTEXTMARKER -- Allocate and initialize the space for a text marker. + */ + +#ifdef ANSI_FUNC + +static MarkerPtr +cdl_initTextMarker ( + int x, + int y, /* marker position */ + char *string, /* string to draw */ + float size, /* marker size (pixels) */ + int color, /* marker color */ + int font, /* text font */ + int width /* line width */ +) +#else + +static MarkerPtr +cdl_initTextMarker (x, y, string, size, color, font, width) +int x, y; /* marker position */ +char *string; /* string to draw */ +float size; /* marker size (pixels) */ +int color; /* marker color */ +int font; /* text font */ +int width; /* line width */ +#endif +{ + MarkerPtr mk = (MarkerPtr) calloc (1, sizeof(struct Marker)); + + mk->type = MK_TEXT; + mk->x = x; + mk->y = y; + mk->txsize = size; + mk->color = color; + mk->font = font; + mk->textwidth = width; + mk->str = (char *) malloc (strlen(string) + 1); + strcpy (mk->str, string); + return mk; +} + + + +#ifdef ANSI_FUNC + +static void +cdl_initMarkPos (MarkerPtr mk, int nx, int ny, int lx, int ly) +#else + +static void +cdl_initMarkPos (mk, nx, ny, lx, ly) +MarkerPtr mk; +int nx, ny; +int lx, ly; +#endif +{ + mk->nx = nx; + mk->ny = ny; + mk->lx = lx; + mk->ly = ly; +} + + + +/* ------------------------ + * Misc. Utility Procedures + * ------------------------*/ + +/* CDL_DOLINEINSUBRAS -- Draw a line between two arbitrary endpoints in a + * subraster. Line widths and styles are passed through to specialized + # routines. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doLineInSubRas ( + uchar *pix, /* edit region raster */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int x1, + int x2, + int y1, + int y2, /* line endpoints */ + int lx, + int ly, /* subraster LL corner */ + int nx, + int ny /* subraster size */ +) +#else + +static void +cdl_doLineInSubRas (pix, color, width, style, x1, x2, y1, y2, lx, ly, nx, ny) +uchar *pix; /* edit region raster */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int x1, y1, x2, y2; /* line endpoints */ +int lx, ly; /* subraster LL corner */ +int nx, ny; /* subraster size */ +#endif +{ + if (style == L_SOLID || style >= L_HOLLOW) { + if (width == 1 && style == L_SOLID) + cdl_drawVector (pix, color, x1, x2, y1, y2, lx, ly, nx, ny); + else { + cdl_drawThickVector (pix, color, width, style, x1, x2, y1, y2, + lx, ly, nx, ny); + } + } else { + ; + } +} + + +/* CDL_DOLINEINSUBRAS -- Draw a line between two arbitrary endpoints in a + * subraster. Line widths and styles are passed through to specialized + # routines. + */ + +#ifdef ANSI_FUNC + +static void +cdl_doDashedLine ( + uchar *pix, /* edit region raster */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int *x, + int *y, /* line vertices */ + int npts, /* number of vertices */ + int lx, + int ly, /* subraster LL corner */ + int nx, + int ny /* subraster size */ +) +#else + +static void +cdl_doDashedLine (pix, color, width, style, x, y, npts, lx, ly, nx, ny) +uchar *pix; /* edit region raster */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int *x, *y; /* line vertices */ +int npts; /* number of vertices */ +int lx, ly; /* subraster LL corner */ +int nx, ny; /* subraster size */ +#endif +{ + register int i, nseg = (npts - 1); + + if (cdl_debug) + printf ("[cdl_doDashedLine] npts=%d lx=%d ly=%d nseg=%d style=%d\n", + npts, lx, ly, nseg, style); + + /* Connect all the vertices. */ + if (width == 1) { + for (i=0; i < nseg; i++) + cdl_drawDashVec (pix, color, style, x[i], x[i+1], + y[i], y[i+1], lx, ly, nx, ny); + } else { + for (i=0; i < nseg; i++) { + cdl_drawThickDashVec (pix, color, width, style, x[i], x[i+1], + y[i], y[i+1], lx, ly, nx, ny); + + /* Restore the dashed line counters so we get a smooth line */ + dash = p_dash, dot = p_dot, dotdash = p_dotdash; + } + } +} + + +/* CDL_DRAWTHICKVECTOR -- Draw a line between two arbitrary endpoints in a + * subraster. We draw multiple vectors to achieve the line thickness. + */ + +#ifdef ANSI_FUNC + +static void +cdl_drawThickVector ( + uchar *pix, /* edit region raster */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int x1, + int x2, + int y1, + int y2, /* line endpoints */ + int lx, + int ly, /* subraster LL corner */ + int nx, + int ny /* subraster size */ +) +#else + +static void +cdl_drawThickVector (pix, color, width, style, x1, x2, y1, y2, lx, ly, nx, ny) +uchar *pix; /* edit region raster */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int x1, y1, x2, y2; /* line endpoints */ +int lx, ly; /* subraster LL corner */ +int nx, ny; /* subraster size */ +#endif +{ + register int i, new_x = x2, new_y = y2, dx = 0, dy = 0; + register int xshift = 0, yshift = 0, w = width, col = color; + register int xx1, xx2, yy1, yy2, n = 0, sign = 1; + + if (abs (new_x - x1) > abs (new_y - y1)) + dx = 0, dy = 1; + else + dx = 1, dy = 0; + + if (style == L_HOLLOW) + w = HOLLOW_LINE_WIDTH; + else if (style == L_SHADOW) + w = SHADOW_LINE_WIDTH; + + for (i=1; i <= w; i++) { + xx1 = x1 + xshift; + yy1 = y1 + yshift; + xx2 = new_x + xshift; + yy2 = new_y + yshift; + + if (style == L_HOLLOW && i == 1) + col = 0; + else if ((style == L_SHADOW && i % 2 && dx) || + (style == L_SHADOW && !(i % 2) && dy)) + col = 0; + else + col = color; + + cdl_drawVector (pix, col, xx1, xx2, yy1, yy2, lx, ly, nx, ny); + + n = (i + 1 + 0.5) / 2; + sign = ((i % 2 == 0) ? 1 : -1); + if (x1 == x2) + xshift = sign * dx * n; + else if (y1 == y2) + yshift = sign * dy * n; + else { + xshift = sign * dx * n; + yshift = sign * dy * n; + } + } +} + + +/* CDL_DRAWVECTOR -- Draw a line between two arbitrary endpoints in a + * subraster. Endpoints are given in image coordinates along with the + * subraster boundary, we translate to subraster coords before marking the + * pixel. This allows us to get a subraster for a larger object such as + * polygon and use the line primitive to draw each vertex before writing + * back a single subraster rather than use the less efficient sequence of + * server I/O calls for each line segment. Uses Bresenham's algorithm to + * get a smoother line. + */ + +#ifdef ANSI_FUNC + +static void +cdl_drawVector ( + uchar *pix, /* edit region raster */ + int color, /* overlay color */ + int x1, + int x2, + int y1, + int y2, /* line endpoints */ + int lx, + int ly, /* subraster LL corner */ + int nx, + int ny /* subraster size */ +) +#else + +static void +cdl_drawVector (pix, color, x1, x2, y1, y2, lx, ly, nx, ny) +uchar *pix; /* edit region raster */ +int color; /* overlay color */ +int x1, y1, x2, y2; /* line endpoints */ +int lx, ly; /* subraster LL corner */ +int nx, ny; /* subraster size */ +#endif +{ + register int i, d, x, y; + register int ax, ay, sx, sy, dx, dy; + + /* Use a Bresenham algorith do draw the line. */ + dx = x2 - x1; ax = ABS(dx) << 1; sx = SGN(dx); + dy = y2 - y1; ay = ABS(dy) << 1; sy = SGN(dy); + x = x1; + y = y1; + if (ax > ay) { /* X span is dominant */ + for (d = ay - (ax >> 1); x != x2; x += sx, d += ay) { + i = max (((y-ly) * nx) + min(nx-1,(x-lx)), 0); + pix[i] = color; + if (d >= 0) { + y += sy; + d -= ax; + } + } + } else { /* Y span is dominant */ + for (d = ax - (ay >> 1); y != y2; y += sy, d += ax) { + i = max (((y-ly) * nx) + min(nx-1,(x-lx)), 0); + pix[i] = color; + if (d >= 0) { + x += sx; + d -= ay; + } + } + } + i = max (((y-ly) * nx) + min(nx-1,(x-lx)), 0); + pix[i] = color; +} + + +/* CDL_DRAWTHICKDASHVEC -- Draw a line between two arbitrary endpoints in + * a subraster. We draw multiple vectors to achieve the line thickness. + */ + +#ifdef ANSI_FUNC + +static void +cdl_drawThickDashVec ( + uchar *pix, /* edit region raster */ + int color, /* overlay color */ + int width, /* line width */ + int style, /* line style */ + int x1, + int x2, + int y1, + int y2, /* line endpoints */ + int lx, + int ly, /* subraster LL corner */ + int nx, + int ny /* subraster size */ +) +#else + +static void +cdl_drawThickDashVec (pix, color, width, style, x1, x2, y1, y2, lx, ly, nx, ny) +uchar *pix; /* edit region raster */ +int color; /* overlay color */ +int width; /* line width */ +int style; /* line style */ +int x1, y1, x2, y2; /* line endpoints */ +int lx, ly; /* subraster LL corner */ +int nx, ny; /* subraster size */ +#endif +{ + register int i, new_x = x2, new_y = y2, dx = 0, dy = 0; + register int xshift = 0, yshift = 0; + register int xx1, xx2, yy1, yy2, n = 0, sign = 1; + + if (abs (new_x - x1) > abs (new_y - y1)) + dx = 0, dy = 1; + else + dx = 1, dy = 0; + + switch (style) { + case L_DASHED: SAVE_DASH_COUNT; break; + case L_DOTTED: SAVE_DOT_COUNT; break; + case L_DOTDASH: SAVE_DOTDASH_COUNT; break; + } + + for (i=1; i <= width; i++) { + xx1 = x1 + xshift; + yy1 = y1 + yshift; + xx2 = new_x + xshift; + yy2 = new_y + yshift; + + cdl_drawDashVec (pix, color, style, xx1, xx2, yy1, yy2, + lx, ly, nx, ny); + + if (i == 1) { + /* Save the dashed line counters so we get a smooth line */ + p_dash = dash, p_dot = dot, p_dotdash = dotdash; + } + + switch (style) { + case L_DASHED: RESTORE_DASH_COUNT; break; + case L_DOTTED: RESTORE_DOT_COUNT; break; + case L_DOTDASH: RESTORE_DOTDASH_COUNT; break; + } + + n = (i + 1 + 0.5) / 2; + sign = ((i % 2 == 0) ? 1 : -1); + if (x1 == x2) + xshift = sign * dx * n; + else if (y1 == y2) + yshift = sign * dy * n; + else { + xshift = sign * dx * n; + yshift = sign * dy * n; + } + } +} + + +/* CDL_DRAWDASHVEC -- Draw a line between two arbitrary endpoints in a + * subraster. Endpoints are given in image coordinates along with the + * subraster boundary, we translate to subraster coords before marking the + * pixel. This allows us to get a subraster for a larger object such as + * polygon and use the line primitive to draw each vertex before writing + * back a single subraster rather than use the less efficient sequence of + * server I/O calls for each line segment. Uses Bresenham's algorithm to + * get a smoother line. + */ + +#ifdef ANSI_FUNC + +static void +cdl_drawDashVec ( + uchar *pix, /* edit region raster */ + int color, /* overlay color */ + int style, /* line style */ + int x1, + int x2, + int y1, + int y2, /* line endpoints */ + int lx, + int ly, /* subraster LL corner */ + int nx, + int ny /* subraster size */ +) +#else + +static void +cdl_drawDashVec (pix, color, style, x1, x2, y1, y2, lx, ly, nx, ny) +uchar *pix; /* edit region raster */ +int color; /* overlay color */ +int style; /* line style */ +int x1, y1, x2, y2; /* line endpoints */ +int lx, ly; /* subraster LL corner */ +int nx, ny; /* subraster size */ +#endif +{ + register int i, d, x, y; + register int ax, ay, sx, sy, dx, dy; + + /* Use a Bresenham algorith do draw the line. */ + dx = x2 - x1; ax = ABS(dx) << 1; sx = SGN(dx); + dy = y2 - y1; ay = ABS(dy) << 1; sy = SGN(dy); + x = x1; + y = y1; + if (ax > ay) { /* X span is dominant */ + for (d = ay - (ax >> 1); x != x2; x += sx, d += ay) { + i = ((y-ly) * nx) + min(nx-1,(x-lx)); + i = max (i, 0); + pix[i] = cdl_setpixel (pix[i], style, color); + if (d >= 0) { + y += sy; + d -= ax; + } + } + } else { /* Y span is dominant */ + for (d = ax - (ay >> 1); y != y2; y += sy, d += ax) { + i = ((y-ly) * nx) + min(nx-1,(x-lx)); + i = max (i, 0); + pix[i] = cdl_setpixel (pix[i], style, color); + if (d >= 0) { + x += sx; + d -= ay; + } + } + } +} + + +/* CDL_SETPIXEL -- Set the pixel to the desired color and keep track of + * which pixels have been changed so we get a dashed line effect. + */ + +#ifdef ANSI_FUNC + +static uchar +cdl_setpixel ( + uchar pix, /* input pixel */ + int style, /* line style */ + int color /* line color */ +) +#else + +static uchar +cdl_setpixel (pix, style, color) +uchar pix; /* input pixel */ +int style; /* line style */ +int color; /* line color */ +#endif +{ + /* If the current pixel is already set just ignore it. We need + * to do this so that when drawing many small segments in a poly- + * line (e.g. a circle) we don't increment the dash counters un- + * necessarily so we can maintain the spacing. + */ + if (pix == color) + return (pix); + + switch (style) { + case L_DASHED: + return ((DASH_PIXEL ? color : pix)); + case L_DOTTED: + return ((DOT_PIXEL ? color : pix)); + case L_DOTDASH: + return ((DOTDASH_PIXEL ? color : pix)); + } + + return (color); +} + +/* CDL_FILLAREA -- Scan the pixel array and fill the area enclosed by the + * given color, or replace with those pixels from the reference raster. + * We assume the area to be filled is a simple closed convex polygon. + */ + +#ifdef ANSI_FUNC + +static void +cdl_fillArea ( + uchar *pix, /* edit region raster */ + int nx, + int ny, /* subraster size */ + int color /* overlay color */ +) +#else + +static void +cdl_fillArea (pix, nx, ny, color) +uchar *pix; /* edit region raster */ +int nx, ny; /* subraster size */ +int color; /* overlay color */ +#endif +{ + register int i, j, l, r; + + for (i=0; i < ny; i++) { + l = r = 0; + + /* Find the left endpoint. */ + while (l < nx && pix[(i * nx) + l] != color) + l++; + if (l != nx) { + + /* Find the right endpoint. */ + r = nx - 1; + while (r > l && pix[(i * nx) + r] != color) + r--; + + if (r > l) { + /* Fill the area in between. */ + for (j=l; j <= r; j++) + pix[(i*nx)+j] = color; + } + } + } +} + + +/* CDL_GETCIRCLECOORDS -- Compute the coords for points needed to draw a + * circle of a given radius at the given center. + */ + +#ifdef ANSI_FUNC + +static void +cdl_getCircleCoords ( + int xcen, + int ycen, /* circle center */ + int radius, /* circle radius */ + int *x, + int *y, /* output coords */ + int npts /* number of coords */ +) +#else + +static void +cdl_getCircleCoords (xcen, ycen, radius, x, y, npts) +int xcen, ycen; /* circle center */ +int radius; /* circle radius */ +int *x, *y; /* output coords */ +int npts; /* number of coords */ +#endif +{ + register int i, count, xoff, yoff; + register int a1, a2, a3, b1, b2, b3, b4; + static double UnitCircleX[12] = { + -0.06540312923014, -0.19509032201613, + -0.32143946530316, -0.44228869021900, + -0.55557023301960, -0.65934581510007, + -0.75183980747898, -0.83146961230255, + -0.89687274153269, -0.94693012949511, + -0.98078528040323, -0.99785892323860 + }; + static double UnitCircleY[12] = { + -0.99785892323860, -0.98078528040323, + -0.94693012949511, -0.89687274153269, + -0.83146961230255, -0.75183980747898, + -0.65934581510007, -0.55557023301960, + -0.44228869021900, -0.32143946530316, + -0.19509032201613, -0.06540312923014 + }; + + + /* Set up array indexes for 8 fold symetry */ + /* 8 indexes radiating both ways from each of the four axes */ + a1 = npts / 4; /* (1 * cnt) / 4 */ + a2 = a1 + a1; /* (2 * cnt) / 4 */ + a3 = a2 + a1; /* (3 * cnt) / 4 */ + b1 = a1 - 1; + b2 = a2 - 1; + b3 = a3 - 1; + b4 = a3 + a1 - 1; /* (4 * cnt) / 4 - 1 */ + + /* Calculate points on circumference for 1/8th of circle */ + /* Apply to each of 8 pairs */ + count = npts / 8; + xcen -= 1; /* fix for mysterious off-by-one bug */ + for( i=0; i <= count; i++ ) { + xoff = UnitCircleX[i] * radius + 0.5; + yoff = UnitCircleY[i] * radius + 0.5; + x[i] = xcen + xoff; + y[i] = ycen + yoff; + x[a1+i] = xcen + yoff; + y[a1+i] = ycen - xoff; + x[a2+i] = xcen - xoff; + y[a2+i] = ycen - yoff; + x[a3+i] = xcen - yoff; + y[a3+i] = ycen + xoff; + x[b1-i] = xcen + yoff; + y[b1-i] = ycen + xoff; + x[b2-i] = xcen + xoff; + y[b2-i] = ycen - yoff; + x[b3-i] = xcen - yoff; + y[b3-i] = ycen - xoff; + x[b4-i] = xcen - xoff; + y[b4-i] = ycen + yoff; + } + /* Close the circle (end point same as starting point) */ + x[npts-1] = x[0]; + y[npts-1] = y[0]; +} + + +/* CDL_GETELLIPSECOORDS -- Compute the coords for points needed to draw a + * ellipse w/ given axes and angle at the desired center. + */ + +#ifdef ANSI_FUNC + +static void +cdl_getEllipseCoords ( + int xcen, + int ycen, /* ellipse center */ + int xradius, + int yradius, /* ellipse axes */ + float rotang, /* angle from X axis */ + int *x, + int *y /* output coords */ +) +#else + +static void +cdl_getEllipseCoords (xcen, ycen, xradius, yradius, rotang, x, y) +int xcen, ycen; /* ellipse center */ +int xradius, yradius; /* ellipse axes */ +float rotang; /* angle from X axis */ +int *x, *y; /* output coords */ +#endif +{ + int loop; + float xoff, yoff; + double rotsin, rotcos; + register int i; + register int x1, x2, y1, y2; + register int a2, b1, b3; + static double UnitEllipseX[16] = { + -0.04906767432742, -0.14673047445536, + -0.24298017990326, -0.33688985339222, + -0.42755509343028, -0.51410274419322, + -0.59569930449243, -0.67155895484702, + -0.74095112535496, -0.80320753148064, + -0.85772861000027, -0.90398929312344, + -0.94154406518302, -0.97003125319454, + -0.98917650996478, -0.99879545620517 + }; + static double UnitEllipseY[16] = { + -0.99879545620517, -0.98917650996478, + -0.97003125319454, -0.94154406518302, + -0.90398929312344, -0.85772861000027, + -0.80320753148064, -0.74095112535496, + -0.67155895484702, -0.59569930449243, + -0.51410274419322, -0.42755509343028, + -0.33688985339222, -0.24298017990326, + -0.14673047445536, -0.04906767432742 + }; + + /* Set up array indexes for 8 fold symetry */ + /* 4 indexes radiating both ways from each of the two axis rays */ + a2 = N_ELLIPSE_PTS / 2; + b1 = a2 - 1; + b3 = N_ELLIPSE_PTS - 1; + + rotsin = sin ((double) ((double)rotang * 0.017453293)); + rotcos = cos ((double) ((double)rotang * 0.017453293)); + + /* Recalculate points on circumference */ + /* Apply to each of 4 pairs */ + loop = N_ELLIPSE_PTS / 4; + for( i=0; i < loop; i++ ) { + /* Calculate ray lengths for orthogonal case */ + xoff = UnitEllipseX[i] * xradius; + yoff = UnitEllipseY[i] * yradius; + + /* Calculate offset of two points on the right (rotate) */ + x2 = (xoff * rotcos) + (yoff * rotsin) + 0.5; + y2 = (xoff * rotsin) - (yoff * rotcos) - 0.5; + x1 = (xoff * rotcos) - (yoff * rotsin) - 0.5; + y1 = (xoff * rotsin) + (yoff * rotcos) + 0.5; + x[i] = xcen + x1; + y[i] = ycen + y1; + x[a2+i] = xcen - x1; + y[a2+i] = ycen - y1; + x[b1-i] = xcen + x2; + y[b1-i] = ycen + y2; + x[b3-i] = xcen - x2; + y[b3-i] = ycen - y2; + } + /* Close the circle (end point same as starting point) */ + x[N_ELLIPSE_PTS-1] = x[0]; + y[N_ELLIPSE_PTS-1] = y[0]; +} + + +/* CDL_MINMAX -- Find the array extrema. */ + +#ifdef ANSI_FUNC + +static void +cdl_minmax ( + int *array, /* array to check */ + int npts, /* no of points */ + int *amin, + int *amax /* extremes */ +) +#else + +static void +cdl_minmax (array, npts, amin, amax) +int *array; /* array to check */ +int npts; /* no of points */ +int *amin, *amax; /* extremes */ +#endif +{ + register int i; + + *amin = *amax = array[0]; + for (i=1; i < npts; i++) { + if (*amin > array[i]) *amin = array[i]; + if (*amax < array[i]) *amax = array[i]; + } +} + + +/* CDL_STRLEN -- Find the length of a string to be drawn. */ + +#ifdef ANSI_FUNC + +static int +cdl_strlen ( +char *str, /* string to draw */ +float txtsize, /* string size */ +int txtfont /* font */ +) +#else + +static int +cdl_strlen (str, txtsize, txtfont) +char *str; /* string to draw */ +float txtsize; /* string size */ +int txtfont; /* font */ +#endif +{ + char chr, *sp = str; + int ip, oldfont, font = txtfont, offset = 0; + register int i, cw, ch, len; + float size = txtsize; + + /* Loop over each character in the string. */ + len = 0; + cw = CHARACTER_WIDTH * (size * FONT_SCALE) + FONT_SPACE; + ch = CHARACTER_HEIGHT * (size * FONT_SCALE); + for (; *sp; sp++) { + + /* Check for an inline font escape. */ + if (*sp == '\\' && *(sp+1) == 'f') { + sp++; sp++; + if (*sp != 'P') + oldfont = font; + + switch (*sp) { + case 'R': + font = F_ROMAN; break; + case 'F': + font = F_FUTURA; break; + case 'T': + font = F_TIMES; break; + case 'G': + font = F_GREEK; break; + case 'P': + font = oldfont; break; + + /* Check for a super/subscript escape. */ + case 'U': + offset += ch / 2; + break; + case 'D': + offset -= ch / 2; + break; + } + sp++; + } + + /* Adjust the size if we're doing sub/superscript. */ + if (offset != 0) + size = txtsize * 0.666; + else + size = txtsize; + + if (*sp < CHARACTER_START || *sp > CHARACTER_END) + chr = i = '?' - CHARACTER_START; + else + chr = i = *sp - CHARACTER_START; + + /* Update the character position. */ + ip = (int) chr; + switch (font) { + case F_ROMAN: + len += cw; + break; + case F_GREEK: + len += (gchwid[ip] / 2) * (size * FONT_SCALE) + FONT_SPACE + 2; + break; + case F_TIMES: + len += (timwid[ip] -12) * (size * FONT_SCALE) + FONT_SPACE + 2; + break; + case F_FUTURA: + len += (futwid[ip] / 2) * (size * FONT_SCALE) + FONT_SPACE + 2; + break; + } + } + return (len); +} + + +/* BITUPK -- Unpack an unsigned integer bit field from a longword. + */ + +unsigned bitmask[] = { 0, /* MACHDEP */ + 01, 03, 07, + 017, 037, 077, + 0177, 0377, 0777, + 01777, 03777, 07777, + 017777, 037777, 077777, + 0177777, 0377777, 0777777, + 01777777, 03777777, 07777777, + 017777777, 037777777, 077777777, + 0177777777, 0377777777, 0777777777, + 01777777777, 03777777777, 07777777777, + 017777777777, 037777777777 +}; + +#ifdef ANSI_FUNC + +static int +bitupk ( + unsigned int wordp, /* longword to be examined */ + int offset, /* one-indexed offset of first bit */ + int nbits /* number of bits to be set */ +) +#else + +static int +bitupk (wordp, offset, nbits) +unsigned int wordp; /* longword to be examined */ +int offset; /* one-indexed offset of first bit */ +int nbits; /* number of bits to be set */ +#endif +{ + return ((wordp >> (offset-1)) & bitmask[nbits]); +} + diff --git a/vendor/x11iraf/cdl/cdlspp.h b/vendor/x11iraf/cdl/cdlspp.h new file mode 100644 index 00000000..b3e78cae --- /dev/null +++ b/vendor/x11iraf/cdl/cdlspp.h @@ -0,0 +1,131 @@ + +# CDL_SPP.H -- Header file for the CDL SPP interface. Fortran compilers +# on various platforms may append one or more trailing underscores to +# symbol names, we'll use macros for the interface names and use defines +# to see what the symbol name is. + + +define FB_AUTO -1 # autoconfig the frame buffer + +# Types of greyscale transformations. +define CDL_UNITARY 0 # values map without change +define CDL_LINEAR 1 # linear mapping +define CDL_LOG 2 # logarithmic mapping + +# Overlay colors. +define C_BLACK 202 # static overlay color defs +define C_WHITE 203 +define C_RED 204 +define C_GREEN 205 +define C_BLUE 206 +define C_YELLOW 207 +define C_CYAN 208 +define C_MAGENTA 209 +define C_CORAL 210 +define C_MAROON 211 +define C_ORANGE 212 +define C_KHAKI 213 +define C_ORCHID 214 +define C_TURQUOISE 215 +define C_VIOLET 216 +define C_WHEAT 217 + +# Overlay point mark types. +define M_FILL 1 +define M_POINT 2 +define M_BOX 4 +define M_PLUS 8 +define M_CROSS 16 +define M_DIAMOND 32 +define M_CIRCLE 64 +define M_STAR 128 +define M_HLINE 256 +define M_VLINE 512 +define M_HBLINE 1024 +define M_VBLINE 2048 + +# Font types. +define F_ROMAN 0 +define F_GREEK 1 +define F_FUTURA 2 +define F_TIMES 3 +define F_BOLD 4 + +# Polyline attribute values. +define L_SOLID 0 +define L_DASHED 1 +define L_DOTTED 2 +define L_DOTDASH 3 +define L_HOLLOW 4 +define L_SHADOW 5 + + +# Map the SPP names to the symbols in the library. +define cdl_open cdopen_ +define cdl_displayPix cdsppx_ +define cdl_readCursor crdcur_ +define cdl_setCursor cscurs_ +define cdl_clearFrame cclfrm_ +define cdl_selectFB cselfb_ +define cdl_close cclose_ +define cdl_displayIRAF cdspir_ +define cdl_isIRAF cisirf_ +define cdl_readIRAF crdirf_ +define cdl_displayFITS cdspft_ +define cdl_isFITS cisfts_ +define cdl_readFITS crdfts_ +define cdl_compZScale ccmpzs_ +define cdl_zscaleImage czscim_ +define cdl_printPix cprpix_ +define cdl_printPixToFile cprpfl_ +define cdl_readImage crdimg_ +define cdl_readFrameBuffer crdfrb_ +define cdl_readSubRaster crsubr_ +define cdl_writesubRaster cwsubr_ +define cdl_setWCS cstwcs_ +define cdl_setFBConfig csfbcf_ +define cdl_getFBConfig cgfbcf_ +define cdl_lookupFBSize clkfbs_ +define cdl_setFrame csfram_ +define cdl_setZTrans csztrn_ +define cdl_setZScale cszscl_ +define cdl_setSample cssamp_ +define cdl_setSampleLines cssaml_ +define cdl_setContrast cscntr_ +define cdl_setName csname_ +define cdl_setTitle cstitl_ +define cdl_getWCS cgtwcs_ +define cdl_getFrame cgfram_ +define cdl_getZTrans cgztrn_ +define cdl_getZScale cgzscl_ +define cdl_getSample cgsamp_ +define cdl_getSampleLines cgsmpl_ +define cdl_getContrast cgcntr_ +define cdl_getName cgname_ +define cdl_getTitle cgtitl_ +define cdl_mapFrame cmapfr_ +define cdl_markCoordsFile cmkcfl_ +define cdl_markPoint cmkpnt_ +define cdl_markPointLabel cmkpnl_ +define cdl_markLine cmklin_ +define cdl_markBox cmkbox_ +define cdl_markPolyline cmkpln_ +define cdl_markPolygon cmkpgn_ +define cdl_markCircle cmkcrc_ +define cdl_markCircAnnuli cmkcan_ +define cdl_markEllipse cmkell_ +define cdl_markEllipAnnuli cmkela_ +define cdl_markText cmktxt_ +define cdl_setFont csfont_ +define cdl_setLineWidth cslwid_ +define cdl_setLineStyle cslsty_ +define cdl_setTextWidth cstwid_ +define cdl_deleteMark cdelmk_ +define cdl_clearOverlay cclrov_ +define cdl_redrawOverlay crdrov_ +define cdl_setDebug cstdbg_ +define cdl_setMapping cstmap_ +define cdl_getMapping cgtmap_ +define cdl_queryMap cqrmap_ + + diff --git a/vendor/x11iraf/cdl/cdlzscale.c b/vendor/x11iraf/cdl/cdlzscale.c new file mode 100644 index 00000000..e7881ef2 --- /dev/null +++ b/vendor/x11iraf/cdl/cdlzscale.c @@ -0,0 +1,688 @@ +#include +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + + +/* + * ZSCALE -- Compute the optimal Z1, Z2 (range of greyscale values to be + * displayed) of an image. For efficiency a statistical subsample of an image + * is used. The pixel sample evenly subsamples the image in x and y. The + * entire image is used if the number of pixels in the image is smaller than + * the desired sample. + * + * The sample is accumulated in a buffer and sorted by greyscale value. + * The median value is the central value of the sorted array. The slope of a + * straight line fitted to the sorted sample is a measure of the standard + * deviation of the sample about the median value. Our algorithm is to sort + * the sample and perform an iterative fit of a straight line to the sample, + * using pixel rejection to omit gross deviants near the endpoints. The fitted + * straight line is the transfer function used to map image Z into display Z. + * If more than half the pixels are rejected the full range is used. The slope + * of the fitted line is divided by the user-supplied contrast factor and the + * final Z1 and Z2 are computed, taking the origin of the fitted line at the + * median value. + */ + +#define MIN_NPIXELS 5 /* smallest permissible sample */ +#define MAX_REJECT 0.5 /* max frac. of pixels to be rejected */ +#define GOOD_PIXEL 0 /* use pixel in fit */ +#define BAD_PIXEL 1 /* ignore pixel in all computations */ +#define REJECT_PIXEL 2 /* reject pixel after a bit */ +#define KREJ 2.5 /* k-sigma pixel rejection factor */ +#define MAX_ITERATIONS 5 /* maximum number of fitline iterations */ + +#undef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define min(a,b) ((a) < (b) ? (a) : (b)) +#undef mod +#define mod(a,b) ((a) % (b)) +#undef nint +#define nint(a) ((int)(a + 0.5)) +#undef abs +#define abs(a) ((a) >= 0 ? (a) : -(a)) + + +extern int cdl_debug; + +#ifdef ANSI_FUNC + +void cdl_zscale(unsigned char *im, int nx, int ny, int bitpix, float *z1, float *z2, float contrast, int opt_size, int len_stdline); +int sampleImage(unsigned char *im, int bitpix, float **sample, int nx, int ny, int optimal_size, int len_stdline); + +static void subSample(float *a, float *b, int npix, int step); +int fitLine(float *data, int npix, float *zstart, float *zslope, float krej, int ngrow, int maxiter); +static void flattenData(float *data, float *flat, float *x, int npix, double +z0, double dz); +int computeSigma(float *a, char *badpix, int npix, double *mean, double *sigma); +int rejectPixels(float *data, float *flat, float *normx, char *badpix, int npix, double *sumxsqr, double *sumxz, double *sumx, double *sumz, double threshold, int ngrow); +int floatCompare(float *i, float *j); + +#else + +int rejectPixels(), computeSigma(); +int sampleImage(), fitLine(), floatCompare(); + +static void flattenData(); +static void subSample(); + +#endif + +/* Compatibility hacks. */ +#ifdef AUX + +#ifdef ANSI_FUNC +void * memmove (void *a, const void *b, size_t n) +#else +void *memmove(a,b,n) void *a; const void *b; size_t n; +#endif + + { bcopy(b,a,n); } + +#else + +#if defined(sun) && !defined(SYSV) + +#ifdef ANSI_FUNC +void * memmove (void *a, void *b, int n) +#else +void *memmove(a,b,n) void *a, *b; int n; +#endif + + { bcopy(b,a,n); } +#endif +#endif + + + +/* CDL_ZSCALE -- Sample the image and compute optimal Z1 and Z2 values. + */ + +#ifdef ANSI_FUNC + +void +cdl_zscale ( + unsigned char *im, /* image data to be sampled */ + int nx, + int ny, /* image dimensions */ + int bitpix, /* bits per pixel */ + float *z1, + float *z2, /* output min and max greyscale values */ + float contrast, /* adj. to slope of transfer function */ + int opt_size, /* desired number of pixels in sample */ + int len_stdline /* optimal number of pixels per line */ +) +#else + +void +cdl_zscale (im, nx, ny, bitpix, z1, z2, contrast, opt_size, len_stdline) + +unsigned char *im; /* image data to be sampled */ +int nx, ny; /* image dimensions */ +int bitpix; /* bits per pixel */ +float *z1, *z2; /* output min and max greyscale values */ +float contrast; /* adj. to slope of transfer function */ +int opt_size; /* desired number of pixels in sample */ +int len_stdline; /* optimal number of pixels per line */ +#endif +{ + register int npix, minpix, ngoodpix, center_pixel, ngrow; + float zmin, zmax, median; + float zstart, zslope; + float *sample = NULL, *left = NULL; + + + if (cdl_debug) + printf ("[cdl_zscale] %dx%d-%d cont=%g optsz=%d len=%d\n", + nx, ny, bitpix, contrast, opt_size, len_stdline); + + /* Subsample the image. */ + npix = sampleImage((unsigned char *)im, bitpix, &sample, nx, ny, + opt_size, len_stdline); + + /* Sort the sample, compute the minimum, maximum, and median pixel + * values. + */ + qsort (sample, npix, sizeof (float), floatCompare); + zmin = *sample; + zmax = *(sample+npix-1); + + /* The median value is the average of the two central values if there + * are an even number of pixels in the sample. + */ + center_pixel = max (1, (npix + 1) / 2); + left = &(sample[center_pixel - 1]); + if (mod (npix, 2) == 1 || center_pixel >= npix) + median = *left; + else + median = (*left + *(left+1)) / 2; + + /* Fit a line to the sorted sample vector. If more than half of the + * pixels in the sample are rejected give up and return the full range. + * If the user-supplied contrast factor is not 1.0 adjust the scale + * accordingly and compute Z1 and Z2, the y intercepts at indices 1 and + * npix. + */ + minpix = max (MIN_NPIXELS, (int) (npix * MAX_REJECT)); + ngrow = max (1, nint (npix * .01)); + ngoodpix = fitLine (sample, npix, &zstart, &zslope, + KREJ, ngrow, MAX_ITERATIONS); + + if (ngoodpix < minpix) { + *z1 = zmin; + *z2 = zmax; + } else { + if (contrast > 0) + zslope = zslope / contrast; + *z1 = max (zmin, median - (center_pixel - 1) * zslope); + *z2 = min (zmax, median + (npix - center_pixel) * zslope); + } + + if (cdl_debug) { + printf("[cdl_zscale] zmin=%g zmax=%g left=%g median=%g\n", + zmin, zmax, *left, median); + printf("[cdl_zscale] minpix=%d ngrow=%d ngoodpix=%d\n", + minpix, ngrow, ngoodpix); + printf("[cdl_zscale] zslope=%g center_pix=%d z1=%g z2=%g\n", + zslope, center_pixel, *z1, *z2); + } + + /* Clean up. */ + free ((float *)sample); +} + + +/* sampleImage -- Extract an evenly gridded subsample of the pixels from + * a two-dimensional image into a one-dimensional vector. + */ + +#ifdef ANSI_FUNC + +int +sampleImage ( + unsigned char *im, /* image to be sampled */ + int bitpix, /* bits per pixel in image */ + float **sample, /* output vector containing the sample */ + int nx, + int ny, /* image dimensions */ + int optimal_size, /* desired number of pixels in sample */ + int len_stdline /* optimal number of pixels per line */ +) +#else + +int +sampleImage (im, bitpix, sample, nx, ny, optimal_size, len_stdline) + +unsigned char *im; /* image to be sampled */ +int bitpix; /* bits per pixel in image */ +float **sample; /* output vector containing the sample */ +int nx, ny; /* image dimensions */ +int optimal_size; /* desired number of pixels in sample */ +int len_stdline; /* optimal number of pixels per line */ +#endif +{ + register int i; + int ncols, nlines, col_step, line_step, maxpix, line; + int opt_npix_per_line, npix_per_line, npix = 0; + int opt_nlines_in_sample, min_nlines_in_sample, max_nlines_in_sample; + float *op = NULL, *row = NULL; + int *ipix = NULL; + float *fpix = NULL; + double *dpix = NULL; + short *spix = NULL; + char *bpix = NULL; + + + ncols = nx; + nlines = ny; + + /* Compute the number of pixels each line will contribute to the sample, + * and the subsampling step size for a line. The sampling grid must + * span the whole line on a uniform grid. + */ + opt_npix_per_line = max (1, min (ncols, len_stdline)); + col_step = max (2, (ncols + opt_npix_per_line-1) / opt_npix_per_line); + npix_per_line = max (1, (ncols + col_step-1) / col_step); + if (cdl_debug) + printf ("[sampleImage] opt_npix/line=%d col_step=%d n/line=%d\n", + opt_npix_per_line, col_step, npix_per_line); + + /* Compute the number of lines to sample and the spacing between lines. + * We must ensure that the image is adequately sampled despite its + * size, hence there is a lower limit on the number of lines in the + * sample. We also want to minimize the number of lines accessed when + * accessing a large image, because each disk seek and read is ex- + * pensive. The number of lines extracted will be roughly the sample + * size divided by len_stdline, possibly more if the lines are very + * short. + */ + min_nlines_in_sample = max (1, optimal_size / len_stdline); + opt_nlines_in_sample = max(min_nlines_in_sample, min(nlines, + (optimal_size + npix_per_line-1) / npix_per_line)); + line_step = max (2, nlines / (opt_nlines_in_sample)); + max_nlines_in_sample = (nlines + line_step-1) / line_step; + if (cdl_debug) + printf ("[sampleImage] nl_in_samp=%d/%d opt_nl/samp=%d lstep=%d\n", + min_nlines_in_sample, opt_nlines_in_sample, line_step, + max_nlines_in_sample); + + /* Allocate space for the output vector. Buffer must be freed by our + * caller. + */ + maxpix = npix_per_line * max_nlines_in_sample; + *sample = (float *) malloc (maxpix * sizeof (float)); + row = (float *) malloc (nx * sizeof (float)); + + /* Extract the vector. */ + op = *sample; + for (line = (line_step + 1)/2; line < nlines; line+=line_step) { + /* Load a row of float values from the image */ + switch (bitpix) { + case 8: + bpix = (char *) &im[(line-1) * nx * sizeof(char)]; + for (i=0; i < nx; i++) + row[i] = (float) bpix[i]; + break; + case 16: + spix = (short *) &im[(line-1) * nx * sizeof(short)]; + for (i=0; i < nx; i++) + row[i] = (float) spix[i]; + break; + case 32: + ipix = (int *) &im[(line-1) * nx * sizeof(int)]; + for (i=0; i < nx; i++) + row[i] = (float) ipix[i]; + break; + case -32: + fpix = (float *) &im[(line-1) * nx * sizeof(float)]; + for (i=0; i < nx; i++) + row[i] = (float) fpix[i]; + break; + case -64: + dpix = (double *) &im[(line-1) * nx * sizeof(double)]; + for (i=0; i < nx; i++) + row[i] = (float) dpix[i]; + break; + } + + subSample (row, op, npix_per_line, col_step); + op += npix_per_line; + npix += npix_per_line; + if (npix > maxpix) + break; + } + + free ((float *)row); + return (npix); +} + + +/* subSample -- Subsample an image line. Extract the first pixel and + * every "step"th pixel thereafter for a total of npix pixels. + */ + +#ifdef ANSI_FUNC + +static void +subSample (float *a, float *b, int npix, int step) +#else + +static void +subSample (a, b, npix, step) +float *a; +float *b; +int npix, step; +#endif +{ + register int ip, i; + + if (step <= 1) + memmove (b, a, npix); + else { + ip = 0; + for (i=0; i < npix; i++) { + b[i] = a[ip]; + ip += step; + } + } +} + + +/* fitLine -- Fit a straight line to a data array of type real. This is + * an iterative fitting algorithm, wherein points further than ksigma from the + * current fit are excluded from the next fit. Convergence occurs when the + * next iteration does not decrease the number of pixels in the fit, or when + * there are no pixels left. The number of pixels left after pixel rejection + * is returned as the function value. + */ + +#ifdef ANSI_FUNC + +int +fitLine ( + float *data, /* data to be fitted */ + int npix, /* number of pixels before rejection */ + float *zstart, /* Z-value of pixel data[1] (output) */ + float *zslope, /* dz/pixel (output) */ + float krej, /* k-sigma pixel rejection factor */ + int ngrow, /* number of pixels of growing */ + int maxiter /* max iterations */ +) +#else + +int +fitLine (data, npix, zstart, zslope, krej, ngrow, maxiter) + +float *data; /* data to be fitted */ +int npix; /* number of pixels before rejection */ +float *zstart; /* Z-value of pixel data[1] (output) */ +float *zslope; /* dz/pixel (output) */ +float krej; /* k-sigma pixel rejection factor */ +int ngrow; /* number of pixels of growing */ +int maxiter; /* max iterations */ +#endif +{ + int i, ngoodpix, last_ngoodpix, minpix, niter; + double xscale, z0, dz, o_dz, x, z, mean, sigma, threshold; + double sumxsqr, sumxz, sumz, sumx, rowrat; + float *flat, *normx; + char *badpix; + + if (npix <= 0) + return (0); + else if (npix == 1) { + *zstart = data[1]; + *zslope = 0.0; + return (1); + } else + xscale = 2.0 / (npix - 1); + + /* Allocate a buffer for data minus fitted curve, another for the + * normalized X values, and another to flag rejected pixels. + */ + flat = (float *) malloc (npix * sizeof (float)); + normx = (float *) malloc (npix * sizeof (float)); + badpix = (char *) calloc (npix, sizeof(char)); + + /* Compute normalized X vector. The data X values [1:npix] are + * normalized to the range [-1:1]. This diagonalizes the lsq matrix + * and reduces its condition number. + */ + for (i=0; i 0) { + rowrat = sumx / sumxsqr; + z0 = (sumz - rowrat * sumxz) / (ngoodpix - rowrat * sumx); + dz = (sumxz - z0 * sumx) / sumxsqr; + } + + if (ngoodpix >= last_ngoodpix || ngoodpix < minpix) + break; + } + + /* Transform the line coefficients back to the X range [1:npix]. */ + *zstart = z0 - dz; + *zslope = dz * xscale; + if (abs(*zslope) < 0.001) + *zslope = o_dz * xscale; + + free ((float *)flat); + free ((float *)normx); + free ((char *)badpix); + return (ngoodpix); +} + + +/* flattenData -- Compute and subtract the fitted line from the data array, + * returned the flattened data in FLAT. + */ + +#ifdef ANSI_FUNC + +static void +flattenData ( + float *data, /* raw data array */ + float *flat, /* flattened data (output) */ + float *x, /* x value of each pixel */ + int npix, /* number of pixels */ + double z0, + double dz /* z-intercept, dz/dx of fitted line */ +) +#else + +static void +flattenData (data, flat, x, npix, z0, dz) +float *data; /* raw data array */ +float *flat; /* flattened data (output) */ +float *x; /* x value of each pixel */ +int npix; /* number of pixels */ +double z0, dz; /* z-intercept, dz/dx of fitted line */ +#endif +{ + register int i; + + for (i=0; i < npix; i++) + flat[i] = data[i] - (x[i] * dz + z0); +} + + +/* computeSigma -- Compute the root mean square deviation from the + * mean of a flattened array. Ignore rejected pixels. + */ + +#ifdef ANSI_FUNC + +int +computeSigma ( + float *a, /* flattened data array */ + char *badpix, /* bad pixel flags (!= 0 if bad pixel) */ + int npix, + double *mean, + double *sigma /* (output) */ +) +#else + +int +computeSigma (a, badpix, npix, mean, sigma) + +float *a; /* flattened data array */ +char *badpix; /* bad pixel flags (!= 0 if bad pixel) */ +int npix; +double *mean, *sigma; /* (output) */ +#endif +{ + float pixval; + int i, ngoodpix = 0; + double sum = 0.0, sumsq = 0.0, temp; + + /* Accumulate sum and sum of squares. */ + for (i=0; i < npix; i++) + if (badpix[i] == GOOD_PIXEL) { + pixval = a[i]; + ngoodpix = ngoodpix + 1; + sum = sum + pixval; + sumsq = sumsq + pixval * pixval; + } + + /* Compute mean and sigma. */ + switch (ngoodpix) { + case 0: + *mean = INDEF; + *sigma = INDEF; + break; + case 1: + *mean = sum; + *sigma = INDEF; + break; + default: + *mean = sum / (double) ngoodpix; + temp = sumsq / (double) (ngoodpix-1) - + (sum*sum) / (double) (ngoodpix*(ngoodpix - 1)); + if (temp < 0) /* possible with roundoff error */ + *sigma = 0.0; + else + *sigma = sqrt (temp); + } + + return (ngoodpix); +} + + +/* rejectPixels -- Detect and reject pixels more than "threshold" greyscale + * units from the fitted line. The residuals about the fitted line are given + * by the "flat" array, while the raw data is in "data". Each time a pixel + * is rejected subtract its contributions from the matrix sums and flag the + * pixel as rejected. When a pixel is rejected reject its neighbors out to + * a specified radius as well. This speeds up convergence considerably and + * produces a more stringent rejection criteria which takes advantage of the + * fact that bad pixels tend to be clumped. The number of pixels left in the + * fit is returned as the function value. + */ + +#ifdef ANSI_FUNC + +int +rejectPixels ( + float *data, /* raw data array */ + float *flat, /* flattened data array */ + float *normx, /* normalized x values of pixels */ + char *badpix, /* bad pixel flags (!= 0 if bad pixel) */ + int npix, + double *sumxsqr, + double *sumxz, + double *sumx, + double *sumz,/* matrix sums */ + double threshold, /* threshold for pixel rejection */ + int ngrow /* number of pixels of growing */ +) +#else + +int +rejectPixels (data, flat, normx, badpix, npix, + sumxsqr, sumxz, sumx, sumz, threshold, ngrow) + +float *data; /* raw data array */ +float *flat; /* flattened data array */ +float *normx; /* normalized x values of pixels */ +char *badpix; /* bad pixel flags (!= 0 if bad) */ +int npix; +double *sumxsqr,*sumxz,*sumx,*sumz; /* matrix sums */ +double threshold; /* threshold for pixel rejection */ +int ngrow; /* number of pixels of growing */ +#endif +{ + int ngoodpix, i, j; + float residual, lcut, hcut; + double x, z; + + ngoodpix = npix; + lcut = -threshold; + hcut = threshold; + + for (i=0; i < npix; i++) { + if (badpix[i] == BAD_PIXEL) + ngoodpix = ngoodpix - 1; + else { + residual = flat[i]; + if (residual < lcut || residual > hcut) { + /* Reject the pixel and its neighbors out to the growing + * radius. We must be careful how we do this to avoid + * directional effects. Do not turn off thresholding on + * pixels in the forward direction; mark them for rejection + * but do not reject until they have been thresholded. + * If this is not done growing will not be symmetric. + */ + for (j=max(0,i-ngrow); j < min(npix,i+ngrow); j++) { + if (badpix[j] != BAD_PIXEL) { + if (j <= i) { + x = (double) normx[j]; + z = (double) data[j]; + *sumxsqr = *sumxsqr - (x * x); + *sumxz = *sumxz - z * x; + *sumx = *sumx - x; + *sumz = *sumz - z; + badpix[j] = BAD_PIXEL; + ngoodpix = ngoodpix - 1; + } else + badpix[j] = REJECT_PIXEL; + } + } + } + } + } + + return (ngoodpix); +} + + +#ifdef ANSI_FUNC + +int +floatCompare (float *i, float *j) +#else + +int floatCompare (i,j) +float *i, *j; +#endif +{ + return ((*i <= *j) ? -1 : 1); +} diff --git a/vendor/x11iraf/cdl/comm.c b/vendor/x11iraf/cdl/comm.c new file mode 100644 index 00000000..a155bc76 --- /dev/null +++ b/vendor/x11iraf/cdl/comm.c @@ -0,0 +1,789 @@ +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + + +/* + * COMMUNICATIONS INTERFACE -- The communications interface handles all the + * low-level communications with the server. It implements only the subset + * of the IIS protocol used by XImtool, SAOtng and SAOimage, not the entire + * IIS protocol. It may be swapped out for another protocol in the future + * without affecting the tasks which use it as long as the basic steps re- + * quired for image display are the same. + * + * com_writeData (fdout, x, y, pix, nbytes) + * com_readData (fdin, x, y, &pix, &bytes) + * com_writeSubraster (fdout, x, y, pix, nx, ny) + * com_readSubraster (fdin, x, y, &pix, &nx, &ny) + * com_readCursor (fdin, fdout, sample, &x, &y, &wcs, &key) + * com_setCursor (fdout, x, y, wcs) + * com_setFBConfig (fdout, configno) + * com_setFrame (fdout, frame) + * com_writeWCS (fdout, buffer, nbytes, version) + * com_readWCS (fdin, fdout, &buffer, &nbytes, &version) + * com_eraseFrame (fdout) + * com_wcsVersion (fdin, fdout) + * + * We do not actually display images here, all we do is send the individual + * set frame, write a data chunk, etc commands. The caller is responsible for + * coordinating these calls into a legal sequence for image display. + * All routines return 0 if successfull and 1 otherwise. + */ + +/* Function prototypes */ +#ifdef __STDC__ +#include +#include +#endif + + +/* Command definitions */ +#define MEMORY 01 /* frame buffer i/o */ +#define LUT 02 /* lut i/o */ +#define FEEDBACK 05 /* used for frame clears */ +#define IMCURSOR 020 /* logical image cursor */ +#define WCS 021 /* used to set WCS */ + +#define PACKED 0040000 +#define IMC_SAMPLE 0040000 +#define COMMAND 0100000 +#define IIS_WRITE 0400000 +#define IIS_READ 0100000 + + + +/* IIS header packet structure. DO NOT CHANGE. */ +typedef struct { + short tid; /* transfer id */ + short thingct; /* thing count */ + short subunit; /* subunit */ + short checksum; /* check sum */ + short x, y, z, t; /* registers */ +} iis_hdr; + + +static int frame = 1, fbconfig = 1; +static int com_debug = 0; +extern int errno; + +#ifdef ANSI_FUNC + +static int com_whdr(int fd, int tid, int subunit, int thingct, int x, int y, int z, int t); +static int com_write(int fd, char *buf, int nbytes); +static int com_read(int fd, char *buf, int maxbytes, int *nbytes); + +#else + +static int com_whdr(), com_write(), com_read(); + +#endif + + + +/* COM_WRITEDATA -- Write a block of data to the display. This does not + * display the entire image, it just writes an array of pixels to the server. + */ + +#ifdef ANSI_FUNC + +int +com_writeData ( + int fd, /* connection file descriptor */ + short x, + short y, /* corner of array */ + uchar *pix, /* pixel array */ + int nbytes /* number of bytes write */ +) +#else + +int +com_writeData (fd, x, y, pix, nbytes) +int fd; /* connection file descriptor */ +short x, y; /* corner of array */ +uchar *pix; /* pixel array */ +int nbytes; /* number of bytes write */ +#endif +{ + int status = 0; + + /* Send the IIS command for a data write. */ + if (com_whdr (fd, IIS_WRITE | PACKED, MEMORY, -nbytes, x, y, + 1<<(frame-1), 0)) { + if (com_debug >= 2) + printf ("com_writeData: error return from header write.\n"); + return (ERR); + } + + /* Send the pixels. */ + status = com_write (fd, (char *)pix, nbytes); + if (status && com_debug >= 2) + printf ("com_writeData: error return from data write.\n"); + return (status); +} + + +/* COM_READDATA -- Read a block of data at a given location from the + * display. + */ + +#ifdef ANSI_FUNC + +int +com_readData ( + int fdin, + int fdout, /* connection file descriptors */ + short x, + short y, /* corner of readout */ + uchar *pix, /* output pixel array */ + int *npix /* number of bytes read */ +) +#else + +int +com_readData (fdin, fdout, x, y, pix, npix) +int fdin, fdout; /* connection file descriptors */ +short x, y; /* corner of readout */ +uchar *pix; /* output pixel array */ +int *npix; /* number of bytes read */ +#endif +{ + int status = 0, nb = 0, n = *npix; + + /* Send the IIS command for a data read. */ + if (com_whdr (fdout, IIS_READ | PACKED, MEMORY, -(*npix), x, y, + 1<<(frame-1), 0)) { + if (com_debug >= 2) + printf ("com_readData: error return from header read.\n"); + return (ERR); + } + + /* Get the pixels. */ + if (pix == NULL) + pix = (uchar *) malloc ((unsigned) *npix); + + while (nb < *npix) { + status = com_read (fdin, (char *)pix+nb, n, &n); + if (status && com_debug >= 2) { + printf ("com_readData: error return from data read.\n"); + return (ERR); + } + nb += n; + n = *npix - nb; + } + return (OK); +} + + +/* COM_WRITESUBRASTER -- Write a block of data to the display. This does not + * display the entire image, it just writes an array of pixels to the server. + */ + +#ifdef ANSI_FUNC + +int +com_writeSubraster ( + int fd, /* connection file descriptor */ + short x, + short y, /* corner of array */ + uchar *pix, /* pixel array */ + int nx, int ny /* number of bytes write at pos */ +) +#else + +int +com_writeSubraster (fd, x, y, pix, nx, ny) +int fd; /* connection file descriptor */ +short x, y; /* corner of array */ +uchar *pix; /* pixel array */ +int nx, ny; /* number of bytes write at pos */ +#endif +{ + int status = 0; + int nbytes = (nx * ny); + + /* Send the IIS command for a data write. */ + if (com_whdr (fd, IIS_WRITE | PACKED, MEMORY, -nbytes, x, y, + 1<<(frame-1), nx)) { + if (com_debug >= 2) + printf ("com_writeData: error return from header write.\n"); + return (ERR); + } + + /* Send the pixels. */ + status = com_write (fd, (char *)pix, nbytes); + if (status && com_debug >= 2) + printf ("com_writeData: error return from data write.\n"); + return (status); +} + + +/* COM_READSUBRASTER -- Read a block of data at a given location from the + * display. + */ + +#ifdef ANSI_FUNC + +int +com_readSubraster ( + int fdin, + int fdout, /* connection file descriptors */ + short x, + short y, /* corner of readout */ + uchar *pix, /* output pixel array */ + int nx, ny /* number of bytes read */ +) +#else + +int +com_readSubraster (fdin, fdout, x, y, pix, nx, ny) +int fdin, fdout; /* connection file descriptors */ +short x, y; /* corner of readout */ +uchar *pix; /* output pixel array */ +int nx, ny; /* number of bytes read */ +#endif +{ + int status = 0, nb = 0, n, npix = (nx * ny); + + /* Send the IIS command for a data read. */ + n = npix; + if (com_whdr (fdout, IIS_READ | PACKED, MEMORY, -npix, x, y, + 1<<(frame-1), nx)) { + if (com_debug >= 2) + printf ("com_readData: error return from header read.\n"); + return (ERR); + } + + /* Get the pixels. */ + if (pix == NULL) + pix = (uchar *) malloc ((unsigned) npix); + + /* + */ + while (nb < npix) { + status = com_read (fdin, (char *)pix+nb, n, &n); + if (status && com_debug >= 2) { + printf ("com_readData: error return from data read.\n"); + return (ERR); + } + nb += n; + n = npix - nb; + } + return (OK); +} + + + +/* COM_READCURSOR -- Read the current cursor position. If sample is set the + * value of the cursor is returned immediately, otherwise the read + * is blocked until the user hits a key. + */ + +#ifdef ANSI_FUNC + +int +com_readCursor ( + int fdin, + int fdout, /* connection file descriptors */ + int sample, /* sample cursor or block */ + float *x, + float *y, /* output cursor coords */ + int *wcs, /* WCS of cursor read */ + char *key /* keystroke hit */ +) +#else + +int +com_readCursor (fdin, fdout, sample, x, y, wcs, key) +int fdin, fdout; /* connection file descriptors */ +int sample; /* sample cursor or block */ +float *x, *y; /* output cursor coords */ +int *wcs; /* WCS of cursor read */ +char *key; /* keystroke hit */ +#endif +{ + char buf[SZ_IMCURVAL]; + int status = 0, n = SZ_IMCURVAL, octal = 0; + + /* Send the IIS command for a cursor read. */ + if (com_whdr (fdout, (IIS_READ | (sample ? IMC_SAMPLE : 0)), IMCURSOR, + 0, 0, 0, *wcs, 0)) { + if (com_debug >= 2) + printf ("com_readCursor: error return from header read.\n"); + return (ERR); + } + + /* Read back the ascii string and extract the cursor position. */ + buf[0] = '\0'; + if (com_read (fdin, buf, n, &n)) + return (ERR); + + *key = (char)NULL; + status = sscanf (buf, "%f %f %d %c", x, y, wcs, key); + if (*key == '\\') { /* fixup octal char read */ + status = sscanf (buf, "%f %f %d \\%o", x, y, wcs, &octal); + *key = octal; + } + + if (status == 0 && strncmp (buf, "EOF", 3) == 0) { + *x = *y = 0.0; + *key = EOF; + } + if ((status != 4) && com_debug >= 2) { + printf ("com_readCursor: error return from data read.\n"); + return (ERR); + } + return ((int) *key); +} + + +/* COM_SETCURSOR -- Set the image cursor position. + */ + +#ifdef ANSI_FUNC + +int +com_setCursor ( + int fd, /* connection file descriptor */ + int x, + int y, /* cursor coords */ + int wcs /* cursor wcs */ +) +#else + +int +com_setCursor (fd, x, y, wcs) +int fd; /* connection file descriptor */ +int x, y; /* cursor coords */ +int wcs; /* cursor wcs */ +#endif +{ + /* Pack up IIS command to set cursor */ + if (com_whdr (fd, IIS_WRITE, IMCURSOR, 0, x, y, wcs, 0)) { + if (com_debug >= 2) + printf ("com_writeCursor: error return from header write.\n"); + return (ERR); + } + return (OK); +} + + +/* COM_SETFBCONFIG -- Set the frame buffer configuration number. This is + * passed to the server in a WCS set command so we'll just save it for now. + */ + +#ifdef ANSI_FUNC + +int +com_setFBConfig ( + int fd, /* connection file descriptor */ + int configno /* fb configuration number */ +) +#else + +int +com_setFBConfig (fd, configno) +int fd; /* connection file descriptor */ +int configno; /* fb configuration number */ +#endif +{ + fbconfig = configno; + return (OK); +} + + +/* COM_SETFRAME -- Set the current display frame. + */ + +#ifdef ANSI_FUNC + +int +com_setFrame ( + int fd, /* connection file descriptor */ + int frame_num /* frame number */ +) +#else + +int +com_setFrame (fd, frame_num) +int fd; /* connection file descriptor */ +int frame_num; /* frame number */ +#endif +{ + short status = 0, fr = 0; + + frame = frame_num; + fr = 1 << (frame_num-1); + + /* Send the IIS command to select a frame. */ + if (com_whdr (fd, IIS_WRITE, LUT | COMMAND, -1, 0, 0, 0, 0)) { + if (com_debug >= 2) + printf ("com_setFrame: error return from header write.\n"); + return (ERR); + } + + /* Send the frame info. */ + status = com_write (fd, (char *)&fr, sizeof(short)); + if (status && com_debug >= 2) { + printf ("com_setFrame: error return from data write.\n"); + return (ERR); + } + return (status); +} + + +/* COM_WRITEWCS -- Send the (linear) WCS to the server. + */ + +#ifdef ANSI_FUNC + +int +com_writeWCS ( + int fd, /* connection file descriptor */ + char *buffer, /* wcs buffer string */ + int nbytes, /* nbytes to transmit */ + int version /* iis version type */ +) +#else + +int +com_writeWCS (fd, buffer, nbytes, version) +int fd; /* connection file descriptor */ +char *buffer; /* wcs buffer string */ +int nbytes; /* nbytes to transmit */ +int version; /* iis version type */ +#endif +{ + char wcs_info[SZ_WCSBUF]; + int status = 0; + short x = 0, y = 0, z = (1 << (frame-1)), t = (fbconfig - 1); + + /* Send the IIS header to set a WCS. */ + if (version == 0) { + /* Do the old-style WCS read. Set registers and size.*/ + x = 0, y = 0, z = (1 << (frame-1)), t = (fbconfig - 1); + } else { + /* Do the new-style WCS read. Set registers and size.*/ + x = 1, y = 0, z = (1 << (frame-1)), t = (fbconfig - 1); + } + + /* Send the setWcs header. */ + if (com_whdr (fd, IIS_WRITE|PACKED, WCS, -nbytes, x, y, z, t)) { + if (com_debug >= 2) + printf ("com_writeWCS: error return from header write.\n"); + return (ERR); + } + + /* Send the wcs info. */ + if (com_write (fd, buffer, nbytes)) { + if (com_debug >= 2) + printf ("com_writeWCS: error return from data write.\n"); + return (ERR); + } + return (OK); +} + + +/* COM_READWCS -- Read the (linear) WCS from the server. + */ + +#ifdef ANSI_FUNC + +int +com_readWCS ( + int fdin, + int fdout, /* connection file descriptors */ + char *buffer, /* wcs string buffer */ + int *nbytes, /* length of string */ + int wcs, /* requested WCS number */ + int version /* iis version number */ +) +#else + +int +com_readWCS (fdin, fdout, buffer, nbytes, wcs, version) +int fdin, fdout; /* connection file descriptors */ +char *buffer; /* wcs string buffer */ +int *nbytes; /* length of string */ +int wcs; /* requested WCS number */ +int version; /* iis version number */ +#endif +{ + int nread, tokens, len; + short x, y, z, t; + char wcs_info[SZ_WCSBUF]; + + + /* Set registers and size. Note that 'version' and 'wcs' will + * be zero when using the old WCS protocols. + */ + x = version; + y = 0; + z = (1 << (frame-1)); + t = wcs; + len = (version == 0) ? SZ_OLD_WCSBUF : SZ_WCSBUF; + + /* Send the WCS query string. */ + if (com_whdr (fdout, IIS_READ, WCS, 0, x, y, z, t)) { + if (com_debug >= 2) + printf ("com_readWCS: error return from header read.\n"); + return (ERR); + } + + /* Read the reply string. */ + if (com_read (fdin, wcs_info, len, &nread)) { + if (com_debug >= 2) + printf ("com_readWCS: error return from data read.\n"); + return (ERR); + } + + /* Copy the data string to the return buffer. */ + *nbytes = nread; + strncpy (buffer, wcs_info, nread); + + return (OK); +} + + +/* COM_ERASEFRAME -- Clear the current frame. + */ + +#ifdef ANSI_FUNC + +int +com_eraseFrame ( + int fd /* connection file descriptor */ +) +#else + +int +com_eraseFrame (fd) +int fd; /* connection file descriptor */ +#endif +{ + /* Send IIS command to erase. */ + if (com_whdr (fd, IIS_WRITE+(fbconfig-1), FEEDBACK, 0, 0, 0, + 1<<(frame-1), 0)) { + if (com_debug >= 2) + printf ("com_eraseFrame: error return from header write.\n"); + return (ERR); + } + return (OK); +} + + +/* COM_WCSVERSION -- Determine the server WCS version. + */ + +#ifdef ANSI_FUNC + +int +com_wcsVersion ( + int fdin, /* connection file descriptor */ + int fdout /* connection file descriptor */ +) +#else + +int +com_wcsVersion (fdin, fdout) +int fdin; /* connection file descriptor */ +int fdout; /* connection file descriptor */ +#endif +{ + char wcstext[SZ_OLD_WCSBUF]; + int n = SZ_OLD_WCSBUF, status = 0, version = 0; + short x = 1, y = 1, z = (1 << (frame-1)), t = 0; + + + /* Send IIS command to return the WCS version (subunitof getWCS) */ + if (com_whdr (fdout, IIS_READ, WCS, 0, x, y, z, t)) { + if (com_debug >= 2) + printf ("com_eraseFrame: error return from header write.\n"); + return (0); + } + + /* Read the reply string. */ + status = com_read (fdin, wcstext, SZ_OLD_WCSBUF, &n); + if (status && com_debug >= 2) { + printf ("com_wcsVersion: error return from version read.\n"); + return (0); + } + + /* Decode the version from the WCS text. */ + if (strncmp (wcstext, "version=", 8) == 0) { + if (sscanf (wcstext, "version=%d", &version) < 1) + version = 0; + } else + version = 0; + + return (version); +} + + + + +/*------------------ + PRIVATE PROCEDURES + ------------------*/ + + +/* COM_WHDR -- Load and send the IIS header packet given the structure elements. + */ + +#ifdef ANSI_FUNC + +static int +com_whdr ( + int fd, /* connection file descriptor */ + int tid, /* thing ID */ + int subunit, /* subunit */ + int thingct, /* thing count */ + int x, + int y, + int z, + int t /* registers */ +) +#else + +static int +com_whdr (fd, tid, subunit, thingct, x, y, z, t) +int fd; /* connection file descriptor */ +int tid; /* thing ID */ +int subunit; /* subunit */ +int thingct; /* thing count */ +int x, y, z, t; /* registers */ +#endif +{ + iis_hdr iis; + int sum = 0; + + /* Load the structure. */ + iis.tid = (short) tid; + iis.subunit = (short) subunit; + iis.thingct = (short) thingct; + iis.checksum = (short) 0; + iis.x = (short) x; + iis.y = (short) y; + iis.z = (short) z; + iis.t = (short) t; + + /* Compute the checksum. */ + sum = iis.tid + iis.subunit + iis.thingct + iis.checksum + + iis.x + iis.y + iis.z + iis.t; + iis.checksum = 0177777 - sum; + + if (com_debug) { + printf ( + "subunit=%06o tid=%06o nbytes=%7d x=%05o y=%05o z=%05o t=%05o\n", + iis.subunit & 077, + iis.tid, + (!(iis.tid & PACKED) ? (-iis.thingct * 2) : (-iis.thingct)), + iis.x & 0177777, + iis.y & 0177777, + iis.z & 0177777, + iis.t & 0177777); + (void) fflush (stdout); + } + + /* Send the header and return the success code. */ + return (com_write(fd, (char *)&iis, sizeof(iis))); +} + + +/* COM_WRITE -- Asynchronous write of data to the server. Write exactly + * nbytes bytes from the buffer to the server. + */ + +#ifdef ANSI_FUNC + +static int +com_write ( + int fd, /* connection file descriptor */ + char *buf, /* buffer to write */ + int nbytes /* number of bytes to write */ +) +#else + +static int +com_write (fd, buf, nbytes) +int fd; /* connection file descriptor */ +char *buf; /* buffer to write */ +int nbytes; /* number of bytes to write */ +#endif +{ + int n = 0, total = 0, maxbytes = nbytes; + char *ip = (char *)buf; + + for (total=0; total < nbytes; total += n, ip += n) { + n = nbytes - total; + if (maxbytes) + n = min (maxbytes, n); + if ((n = write (fd, ip, n)) <= 0) + return (ERR); + } + return (OK); +} + + +/* COM_READ -- Read data from the server. Try to read at most maxbytes bytes + * from the server into the buffer, return the number of bytes actually read. + */ + +#ifdef ANSI_FUNC + +static int +com_read ( + int fd, /* connection file descriptor */ + char *buf, /* buffer to write */ + int maxbytes, /* max number of bytes to read */ + int *nbytes /* number of bytes actually read*/ +) +#else + +static int +com_read (fd, buf, maxbytes, nbytes) +int fd; /* connection file descriptor */ +char *buf; /* buffer to write */ +int maxbytes; /* max number of bytes to read */ +int *nbytes; /* number of bytes actually read*/ +#endif +{ + int nread; + int nleft = maxbytes; + char *ptr = buf; + + *nbytes = 0; + while (nleft > 0) { + if ( (nread = read(fd, ptr, nleft)) < 0) { + if (errno == EINTR) + nread = 0; /* and call read() again */ + else + return (ERR); + } else if (nread == 0) + break; /* EOF */ + + nleft -= nread; + ptr += nread; + *nbytes += nread; + } + return (OK); +} + + +/* COM_SETDEBUG -- Set the state of the debug flag. + */ + +#ifdef ANSI_FUNC + +int +com_setDebug (int state) +#else + +int +com_setDebug (state) +int state; +#endif +{ + com_debug = state; + return (OK); +} diff --git a/vendor/x11iraf/cdl/configure b/vendor/x11iraf/cdl/configure new file mode 100755 index 00000000..00d3283f --- /dev/null +++ b/vendor/x11iraf/cdl/configure @@ -0,0 +1,49 @@ +#!/bin/csh -f +# +# Configuration script to produce Makefiles for various platforms. +# This *is not* an GNU autoconf-generated script, just a cheap imitation +# with minimal requirements. + + +# Determine platform architecture. +setenv OS `uname` +setenv OSVERSION `uname -r | cut -c1` + +if ($OS == "SunOS" && $OSVERSION == 5) then + cat Makefile.generic | \ + sed -e 's/EXTRA_CFLAGS =/EXTRA_CFLAGS = -DSOLARIS/g' > Makefile + cat examples/Makefile.generic | \ + sed -e 's/LDLIBS =/LDLIBS = -lnsl -lsocket/g' > examples/Makefile + cat test/Makefile.generic | \ + sed -e 's/LDLIBS =/LDLIBS = -lnsl -lsocket/g' > test/Makefile +else if ($OS == "OSF1") then + cat Makefile.generic | \ + sed -e 's/EXTRA_CFLAGS =/EXTRA_CFLAGS = -DOSF1/g' > Makefile + cp examples/Makefile.generic examples/Makefile + cp test/Makefile.generic test/Makefile +else if ($OS == "ULTRIX") then + cat Makefile.generic | \ + sed -e 's/EXTRA_CFLAGS =/EXTRA_CFLAGS = -DULTRIX/g' > Makefile + cp examples/Makefile.generic examples/Makefile + cp test/Makefile.generic test/Makefile +else if ($OS == "AUX") then + cat Makefile.generic | \ + sed -e 's/EXTRA_CFLAGS =/EXTRA_CFLAGS = -DAUX/g' > Makefile + cp examples/Makefile.generic examples/Makefile + cp test/Makefile.generic test/Makefile +else if ($OS == "HP-UX") then + cat Makefile.generic | \ + sed -e 's/ranlib/echo/g' | \ + sed -e 's/EXTRA_CFLAGS =/EXTRA_CFLAGS = -D_NO_US_/g' > Makefile + cp examples/Makefile.generic examples/Makefile + cp test/Makefile.generic test/Makefile +else if ($OS == "AIX") then + cat Makefile.generic | \ + sed -e 's/EXTRA_CFLAGS =/EXTRA_CFLAGS = -D_NO_US_/g' > Makefile + cp examples/Makefile.generic examples/Makefile + cp test/Makefile.generic test/Makefile +else + cp Makefile.generic Makefile + cp examples/Makefile.generic examples/Makefile + cp test/Makefile.generic test/Makefile +endif diff --git a/vendor/x11iraf/cdl/doc/RELEASE-1.6.NOTES b/vendor/x11iraf/cdl/doc/RELEASE-1.6.NOTES new file mode 100644 index 00000000..18c5399e --- /dev/null +++ b/vendor/x11iraf/cdl/doc/RELEASE-1.6.NOTES @@ -0,0 +1,168 @@ + + README FOR CLIENT DISPLAY LIBRARY (CDL) V1.6 + Updated March 1998 + +-------------------------------------------------------------------------- +21 Feb 1997 Initial V1.0 Release +04 Mar 1998 V1.6 Upgrade Release + +See also the post-distribution notes at the end of this file. These are +continually updated after the release as any problems are encountered. +-------------------------------------------------------------------------- + + +1. INTRODUCTION +================ + The Client Display Library (CDL) is a host interface for C or +Fortran programs allowing them to display images or overlay graphics to +display servers such as XImtool or SAOimage / SAOtng. High-level +procedures allow IRAF or FITS images to be displayed simply, other +routines permit access to all other server functions (e.g. cursor and +image readback, frame selection, etc). The library also features a number +of functions for doing image overlay graphics; supported graphics +primitives include numerous point shapes, lines, circles, ellipses, +polygons, annular shapes, and text. + + +1.1 WHAT'S NEW IN THIS RELEASE +------------------------------- + + The initial CDL release provided most of the functionality required +for image display or graphic overlay clients, since then a number of new +features have crept in that were needed. The V1.6 version number reflects +the stop-n-start nature of this work, more work is planned but a release of +the new version is long overdue. New features include: + + - Support for the new V2.11 IRAF OIF image format + - A prototype SPP language binding + - Full ANSI C function prototype support + - Support for variable line widths + - A selection of "dashed" line styles for polyline/polygon markers + - A selection of text fonts including + ROMAN FUTURA TIMES + GREEK BOLD + - Sub/Superscripting text + - In-line font changes + - Support for text line widths + - A "virtual" display server that may also be used as a 'proxy' + server providing an image display "tee" functionality + - Numerous bug fixes + +See the CDL Reference Guide in the 'doc' subdirectory for details on new +features. + +1.2 THINGS TO WATCH OUT FOR +---------------------------- + + The V1.6 release contains two small interface changes which may +cause problems, otherwise the new library should work seemlessly with +existing applications. The interface changes involve the routines + + cdl_readIRAF() and cdl_readFITS() + +These routines now have an extra 'title' argument to return the title string +from the image which allows the hi-level display routines to include this +information in the WCS string. This argument is a character pointer and +affects the Fortran and SPP bindings as well. See the Reference Guide for +additional information. + + New features such as line styles and text fonts have been well-tested +but the use of ANSI prototypes and the SPP binding have only been minimally +exercised. Anyone finding a problem with these features should send a bug +report the iraf@noao.edu help address, we can probably provide a quick fix +for most bugs. + + +2. Documentation and Example Applications +========================================== + + Documentation for the package is located in the 'doc' subdirectory +as both TROFF source and Postscript. The reference manual covers each of +the routines available in the library and contains a summary of the interface +as well as code samples. + Working programs are also included in the 'examples' subdirectory. +Users may find it easier to start by modifying these programs for a particular +need (e.g. add a new command for marking, an option for overlaying points +from a file, etc) before starting an application from scratch to become fam- +iliar with the library. + Fortran programmers should consult the reference manual for information +on array passing in the CDL. In particular, while the CDL can be used from +IMFORT programs special care needs to be taken when displaying arrays read +using the IMFORT routines. + + +3. Building the Package +======================== + + The CDL package relies on the Imake facility to generate the make- +files needed to compile the package. To build the CDL use the following +command: + + % xmkmf # build the parent Makefile + % make World # compile it all + +There is no supported "make install" option, all files will be left in the +CDL working directory following the World build. Users of the package +must either build the library and install the lib and include files by hand +in their final destination, or use compiler "-I" and "-L" flags to find the +files when compiling clients. + As an alternative for sites that don't have Imake installed or who +encounter problems you can try the generic makefiles provided. To use these +simply do + + % configure # create the makefiles + % make World # compile it all + + Programs using the CDL will need one of three include files depending +on the language interface being used: the "cdl.h" file for C programs, the +"cdlftn.inc" file for Fortran programs, or the "cdlspp.h" file for SPP tasks. +The C and SPP include files is required, the Fortran include file is optional +and just defines symbolic names for various constants. Fortran programmers +not using the cdlftn.inc file should see to Reference Manual for values of +symbolic constants. The library file to be linked is "libcdl.a", all programs +using the CDL must also link with the system math library. + +**************************************************************************** +***** NOTE: Solaris users will also need to include "-lnsl -lsocket" ***** +***** when linking programs to include the socket interfaces. ***** +**************************************************************************** + + +4. Reporting Problems +====================== + + Each of the CDL functions has been tested individually but there is +no practical way to test how various combinations of routines may be used +in any given application so bugs are inevitable. If you think you've found +a bug, have a suggestion for future enhancements, or just have a question +about how something works, contact + + iraf@noao.edu + +Messages may also be posted to the adass.iraf.programming newsgroup so that +others may benefit from the exchange. If you're not familiar with the ADASS +newsgroup hierarchy send a message + + irafinfo@iraf.noao.edu + +with the one-line message "get iraf newsgroups" in the body of the message +for more information. A small code sample demonstrating the problem would +help greatly in finding the solution. Debugging output for the package may +be enabled by defining a unix CDL_DEBUG environment variable. For example + + % setenv CDL_DEBUG 0 # minimal debug output + % setenv CDL_DEBUG 1 # CDL and IMD debug info + % setenv CDL_DEBUG 2 # print it all + +Send this output along with the code sample. An FAQ may be added later if +needed. + + +Mike Fitzpatrick +NOAO/IRAF Project +March 1998 + + +Post-Distribution Notes +======================= + diff --git a/vendor/x11iraf/cdl/doc/cdlref.ms b/vendor/x11iraf/cdl/doc/cdlref.ms new file mode 100644 index 00000000..da05ee1f --- /dev/null +++ b/vendor/x11iraf/cdl/doc/cdlref.ms @@ -0,0 +1,2637 @@ +.RP +.de us +\\$1\l'|0\(ul' +.. +.TL +A Reference Guide for the IRAF Client Display Library (CDL) +.AU +Michael Fitzpatrick +.AI +NOAO/IRAF Group +.sp 0.5 +February 1997 +.sp 0.5 +\fIRevised: August 2001\fR +\fICurrent Version: CDL V1.8\fR + +.AB +The Client Display Library (CDL) is a host interface for C, Fortran or SPP +programs allowing them to display images or overlay graphics to display +servers such as \fIXImtool\fR, \fIDS9\fR, or \fISAOimage / SAOtng\fR. +High-level procedures allow IRAF or FITS images to be displayed simply, other +routines permit access to all other server functions (e.g. cursor and image +readback, frame selection, etc). The library also features a number of +functions for doing image overlay graphics; supported graphics primitives +include numerous point shapes, lines, circles, ellipses, polygons, annular +shapes, and text. +.AE + +.pn 1 +.bp +.ce +.ps +3 +\fBContents\fR +.ps -3 +.sp 2 +1\h'|0.25i'\fBIntroduction\fP\l'|5.6i.'\0\01 +.sp 0.5 +2\h'|0.25i'\fBGetting Started\fP\l'|5.6i.'\0\01 +.sp 0.5 +3\h'|0.25i'\fBServer Connections\fP\l'|5.6i.'\0\02 +.br +\h'|0.25i'3.1\h'|0.75i'Domain Sockets\l'|5.6i.'\0\02 +.br +\h'|0.25i'3.2\h'|0.75i'Named FIFO Pipes\l'|5.6i.'\0\03 +.br +\h'|0.25i'3.3\h'|0.75i'Inet Sockets\l'|5.6i.'\0\03 +.br +\h'|0.25i'3.4\h'|0.75i'User-Defined Connections\l'|5.6i.'\0\03 +.sp 0.5 +4\h'|0.25i'\fBImage Display\fP\l'|5.6i.'\0\03 +.br +\h'|0.25i'4.1\h'|0.75i'Overview of the Display Process\l'|5.6i.'\0\03 +.br +\h'|0.25i'4.2\h'|0.75i'Displaying IRAF Images\l'|5.6i.'\0\04 +.br +\h'|0.25i'4.3\h'|0.75i'Displaying FITS Images\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.4\h'|0.75i'Displaying Raw Pixels\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.5\h'|0.75i'Frame Selection\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.6\h'|0.75i'Clearing the Display\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.7\h'|0.75i'Frame Buffer Selection\l'|5.6i.'\0\06 +.br +\h'|0.4i'4.7.1\h'|0.95i'Automatic Selection\l'|5.6i.'\0\06 +.br +\h'|0.4i'4.7.2\h'|0.95i'The Frame Buffer Configuration File\l'|5.6i.'\0\06 +.br +\h'|0.25i'4.8\h'|0.75i'Image WCS Description\l'|5.6i.'\0\07 +.br +\h'|0.4i'4.8.1\h'|0.95i'Image Mappings\l'|5.6i.'\0\07 +.br +\h'|0.25i'4.9\h'|0.75i'Image Colormaps\l'|5.6i.'\0\08 +.br +\h'|0.4i'4.9.1\h'|0.95i'Imtool Color Model\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.10\h'|0.75i'ZScale Intensity Mapping\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.11\h'|0.75i'Image Hardcopy\l'|5.6i.'\010 +.br +\h'|0.25i'4.12\h'|0.75i'Image Cursor\l'|5.6i.'\010 +.br +\h'|0.4i'4.12.1\h'|0.95i'Cursor Sampling\l'|5.6i.'\011 +.br +\h'|0.25i'4.13\h'|0.75i'Image Readout\l'|5.6i.'\011 +.br +\h'|0.25i'4.14\h'|0.75i'Subraster I/O\l'|5.6i.'\011 +.sp 0.5 +5\h'|0.25i'\fBGraphics Overlay\fP\l'|5.6i.'\011 +.br +\h'|0.25i'5.1\h'|0.75i'Marker Coordinates\l'|5.6i.'\011 +.br +\h'|0.25i'5.2\h'|0.75i'Mapping a Previously Displayed Image\l'|5.6i.'\011 +.br +\h'|0.25i'5.3\h'|0.75i'Marking a Coordinate File\l'|5.6i.'\012 +.br +\h'|0.25i'5.4\h'|0.75i'Marker Colors\l'|5.6i.'\012 +.br +\h'|0.25i'5.5\h'|0.75i'Marker Types\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.1\h'|0.95i'Point\l'|5.6i.'\013 +.br +\h'|0.4i'5.5.2\h'|0.95i'Line\l'|5.6i.'\013 +.br +\h'|0.4i'5.5.3\h'|0.95i'Box\l'|5.6i.'\013 +.br +\h'|0.4i'5.5.4\h'|0.95i'Circle\l'|5.6i.'\013 +.br +\h'|0.4i'5.5.5\h'|0.95i'Polyline\l'|5.6i.'\014 +.br +\h'|0.4i'5.5.6\h'|0.95i'Polygon\l'|5.6i.'\014 +.br +\h'|0.4i'5.5.7\h'|0.95i'Ellipse\l'|5.6i.'\014 +.br +\h'|0.4i'5.5.8\h'|0.95i'Circular Annuli\l'|5.6i.'\014 +.br +\h'|0.4i'5.5.9\h'|0.95i'Elliptical Annuli\l'|5.6i.'\014 +.br +\h'|0.4i'5.5.10\h'|0.95i'Text\l'|5.6i.'\014 +.br +\h'|0.25i'5.6\h'|0.75i'Text Fonts\l'|5.6i.'\015 +.br +\h'|0.4i'5.6.1\h'|0.95i'In-line Font Changes\l'|5.6i.'\015 +.br +\h'|0.25i'5.7\h'|0.75i'Line Widths and Styles\l'|5.6i.'\015 +.br +\h'|0.25i'5.8\h'|0.75i'Deleting Markers\l'|5.6i.'\016 +.br +\h'|0.4i'5.8.1\h'|0.95i'Individual Markers\l'|5.6i.'\016 +.br +\h'|0.4i'5.8.2\h'|0.95i'The Entire Overlay\l'|5.6i.'\016 +.br +\h'|0.25i'5.9\h'|0.75i'Redrawing the Overlay\l'|5.6i.'\016 +.sp 0.5 +6\h'|0.25i'\fBANSI C Function Prototypes\fP\l'|5.6i.'\017 +.sp 0.5 +7\h'|0.25i'\fBFortran Language Binding Notes\fP\l'|5.6i.'\017 +.sp 0.5 +8\h'|0.25i'\fBSPP Language Binding Notes\fP\l'|5.6i.'\018 +.sp 0.5 +9\h'|0.25i'\fBIIS Protocol Description\fP\l'|5.6i.'\018 +.sp 0.5 +10\h'|0.25i'\fBVXIMTOOL Proxy/Display Server Usage\fP\l'|5.6i.'\019 +.sp 0.5 +11\h'|0.25i'\fBC Interface Summary\fP\l'|5.6i.'\021 +.sp 0.5 +12\h'|0.25i'\fBC Example Tasks\fP\l'|5.6i.'\023 +.br +\h'|0.25i'12.1\h'|0.75i'Display Example\l'|5.6i.'\023 +.br +\h'|0.25i'12.2\h'|0.75i'Interactive Graphics Overlay Example\l'|5.6i.'\027 +.br +\h'|0.25i'12.3\h'|0.75i'Image Mosaic Example\l'|5.6i.'\031 +.sp 0.5 +13\h'|0.25i'\fBFortran Interface Summary\fP\l'|5.6i.'\033 +.sp 0.5 +14\h'|0.25i'\fBFortran Example Tasks\fP\l'|5.6i.'\035 +.br +\h'|0.25i'14.1\h'|0.75i'Display Example\l'|5.6i.'\035 +.br +\h'|0.25i'14.2\h'|0.75i'Interactive Graphics Overlay Example\l'|5.6i.'\036 +.sp 0.5 +15\h'|0.25i'\fBSPP Interface Summary\fP\l'|5.6i.'\038 +.pn 1 + +.NH +Introduction +.LP + For more than a decade IRAF has used a \fIdisplay server\fR as the +primary means for image display. IRAF client tasks connect to the server +and send or read data using a modification of the IIS Model 70 protocol, +originally through named fifo pipes but more recently using unix domain +or inet sockets. The advantage to this approach was that IRAF client tasks +could make use of the image display functionality without duplicating +the code needed for actually displaying the image. The longtime disadvantage +was that the IIS protocol used was arcane and undocumented and therefore +largely unavailable to applications outside of the IRAF project. The +Client Display Library (CDL) provides a public C and Fortran interface for +displaying images and overlay graphics that is independent of the underlying +protocol used. +.LP + Unlike the interface used by IRAF applications, the CDL is meant to +provide an easy-to-use, fully featured interface for applications that can +be easily evolved for future display servers, communications schemes, or +display functionality. Indeed, the CDL is independent of IRAF itself (as +are the display servers) so display tasks can be written for any discipline +or application. +.LP + While this guide assumes programs are written in C, Fortran programmers +should find the translation straightforward by referring to the Fortran +interface summary. The package source files include example tasks as does +this guide; users with problems, questions, or bug reports are encouraged to +contact \fIiraf@noao.edu\fR. A small code sample demonstrating the problem +would be very helpful in finding a solution to any reported problems. + +.NH +Getting Started +.LP + All C programs must include the header file \fB"cdl.h"\fR in order +to get package definitions for constants such as colors and structure +definitions used. The Fortran interface does not \fIrequire\fR anything +similar, however for fortran compilers which support an \f(CWinclude\fR +directive a \fBcdlftn.inc\fR file may be used to define symbolic constants +passed to procedures, this file must be included by each procedure using the +CDL. Fortran programs not using this file must pass in the constants +explicitly, needed values are found throughout this manual. C procedures +which return an integer value will return a positive number to indicate an +error has occurred and print an error message, otherwise zero is returned. +.LP + The \fBcdl_open()\fR procedure is used to establish a connection +to the server and initialize the package, it returns a CDL structure pointer +that is passed to other CDL procedures. For C programs this means +a separate pointer may be maintained for each server connection, the Fortran +interface is limited to only one server connection per process since the +pointer is maintained internally. The connection is terminated using the +\fBcdl_close()\fR procedure. Between these two calls may be any combination +of CDL procedure calls for doing image display or overlay graphics. +.LP + For example, the simplest possible program for displaying an IRAF +image would look something like: +.sp 0.5 +.nf + \f(CW#include "cdl.h" + + main (int argc, char *argv[]) + { + CDLPtr cdl = cdl_open ((char *)0); + cdl_displayIRAF (cdl, argv[1], 1, 1, 1, 1); + cdl_close (cdl); + }\fR +.fi +.sp 0.5 +.LP +This program displays band one of an image named on the command line to the +server in frame one using the default 512x512 frame buffer, zscaling the +pixels to 8-bit values automatically. No error checking is performed to verify +that a connection was established or that the argument is a valid IRAF image. +Most programs will be more complex than this but it should be clear that +image display from client applications is a now trivial operation. + +.us "Synopsis" +.sp 0.5 +.nf + \f(CW#include "cdl.h"\fR + + \f(CWCDLPtr cdl_open (char *imtdev)\fR + \f(CWvoid cdl_close (CDLPtr cdl)\fR +.fi + +.NH +Server Connections +.LP + The \fBcdl_open()\fR procedure takes a single argument specifying the +type of connection to make to the server, this routine also initializes +the CDL package. If this is a NULL pointer the CDL will attempt to first +connect on a unix domain socket, if that fails the standard IRAF /dev/imt1* +fifo pipes are tried. The syntax for the \fIimtdev\fR argument is as follows: +.sp 0.5 + \f(CW :
\fR +.sp 0.5 +.LP +where is one of "\fBinet\fR" (internet tcp/ip socket), "\fBunix\fR" +(unix domain socket) or "\fBfifo\fR" (named pipe). The form of the address +depends upon the domain, as illustrated in the examples below. The address +field may contain up to two "%d" fields. If present, the user's UID will be +substituted (e.g. "unix:/tmp/.IMT%d"). The default connection if no imtdev +is specified is "unix:/tmp/.IMT%d", failing that a connection is attempted +on the /dev/imt1[io] named fifo pipes. +.NH 2 +Domain Sockets +.LP + Domain sockets are sockets created on the local host. The connection +is usually faster than an inet socket and comparable to a fifo. If the +socket name is specified with a '%d' field the client can be assured of a +unique socket name for each user allowing multiple clients to be run on the +same host by different users. +.LP +.us "Example" +.sp 0.5 +.nf +\f(CW + /* Connection to a local host using socket domain socket. */ + if ((cdl = cdl_open ("unix:/tmp/.IMT%d")) == NULL) { + fprintf (stderr, "cannot open domain socket connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +Named FIFO Pipes +.LP + This is the traditional approach, and the only one supported by +SAOimage (although recent versions contain support for sockets). Any named +fifo pipe may be used, the syntax for the \fIimtdev\fR string in this case is +.sp 0.5 + \fBfifo:\f(CW\fB:\f(CW\fR +.sp 0.5 +.LP +.us "Example" +.sp 0.5 +.nf + \f(CW/* Connection to a local host using named fifo pipes. */ + if ((cdl = cdl_open ("fifo:/dev/imt1i:/dev/imt1o")) == NULL) { + fprintf (stderr, "cannot open fifo pipe connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +Inet Sockets +.LP + Inet sockets are connections between hosts via a tcp/ip socket. +This permits connecting to the server over a remote network connection +anywhere on the Internet. +.LP +.us "Example" +.sp 0.5 +.nf + \f(CW/* Connection to a local host using socket 5137. */ + if ((cdl = cdl_open ("inet:5137")) == NULL) { + fprintf (stderr, "cannot open inet socket connection\\n"); + exit (1); + } + + /* Connection to a remote internet host using socket 5137. */ + if ((cdl = cdl_open ("inet:5137:foo.bar.edu")) == NULL) { + fprintf (stderr, "cannot open inet socket connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +User-Defined Connections +.LP + Since IRAF V2.10.3 client tasks have been able to use an \fBIMTDEV\fR +unix environment variable to set the connection type, the syntax of this +variable is the same as described above. If the \fIcdl_open()\fR procedure +is called with a NULL pointer the IMTDEV environment variable will +automatically be checked. To explicitly use this (or any other) variable +in the client task the \fIcdl_open()\fR procedure may be called as +e.g. +.sp 0.5 +.nf + \f(CWif ((cdl = cdl_open (getenv("IMTDEV"))) == NULL) { + fprintf (stderr, "cannot open server connection\\n"); + exit (1); + }\fR +.fi +.NH +Image Display +.NH 2 +Overview of the Display Process +.LP + Basic image display is done most easily using the high-level +\fBcdl_displayIRAF()\fR, \fBcdl_displayFITS()\fR and \fBcdl_displayPix()\fR +procedures. These routines automatically define an image WCS and mapping, +clear the frame, set the frame buffer configuration and center the image +in the display. For most applications these are all that will be needed, +but the \fBcdl_writeSubRaster()\fR procedure can also be used to display an +image. For example, to display one image in a mosaic or other cases where +the task needs low-level access to position the image or write raw pixel +values. +.LP + In these cases it is the responsibility of the client program to +prepare the server for display. The basic steps involved in displaying an +image include +.sp 0.5 +.TS +center; +lB lB +- - +l lI. +Operation CDL Procedure +Selecting the frame cdl_setFrame() +Clear the frame cdl_clearFrame() +Select the frame buffer configuration cdl_selectFB() +Set the frame buffer configuration cdl_setFBConfig() +Scale the image pixels to 201 display values cdl_zscaleImage() +Compute the raster placement in the frame buffer +Construct a \fInode!path\fR image path +Set the image mapping cdl_setMapping() +Define the image WCS +Set the image WCS cdl_setWCS() +Write the pixels to the display cdl_writeSubRaster() +.TE +.sp 0.5 +In cases like a mosaic display, obviously some steps (e.g. clearing the +frame, selecting the configuration, etc) will only need to be done once. +XImtool V1.3 and later version support multiple WCSs in a single frame +so each piece of the mosaic should define a mapping and an independent +WCS. The last step in the display here should be a single WCS for the +entire mosaic such as "\fIdetector coordinates\fR", without this the +coordinates used by default will be based on the last WCS sent to the +display. Servers which do not support mappings will just ignore the +mapping information, but may still require a frame buffer WCS for other +tasks to operate correctly. For simple displays of single images, the +high-level routines handle all of these steps automatically, they are +included here as checklist of what must be considered when using the CDL +for low-level display. +.NH 2 +Displaying IRAF Images +.LP + The \fBcdl_displayIRAF()\fR procedure can be used to display an +IRAF OIF format image (i.e. images with a \fI.imh\fR extension) by +simply passing in the image name. Pixel files for the image must be +accessible from the local machine but can be in any directory, the HDR$ +syntax for the imdir is also recognized. Images may be three dimensional, +the \fIband\fR argument is used to select the image band to be displayed. +The \fIframe\fR and \fIfbconfig\fR arguments select the frame and frame +buffer size respectively, the special symbolic value \fBFB_AUTO\fR may be +used for the \fIfbconfig\fR argument to have the procedure automatically +select the frame buffer most appropriate for the image size. +If the \fIzscale\fR flag is greater than zero +the image will automatically be converted to 8-bit values using the zscale +mapping algorithm. The function returns a positive value if the image +cannot be accessed or displayed for any reason, an error message will be +printed. +.LP + The \fIcdl_isIRAF()\fR procedure returns a positive value if the +filename argument is recognized as an IRAF image, it does not check whether +the pixel file can be successfully accessed. For simply reading the pixels +from an IRAF image the \fBcdl_readIRAF()\fR procedure may be used. The +function returns a zero value and sets the output pixel array, image +dimensions and pixel size if successful, otherwise the function returns a +positive value. Note that +the output pixel values may need to be scaled before they can be displayed. + +.us "Synopsis" +.nf + \f(CWint cdl_displayIRAF (CDLPtr cdl, char *fname, int band, + int frame, int fbconfig, int zscale)\fR + \f(CWint cdl_isIRAF (char *fname)\fR + \f(CWint cdl_readIRAF (char *fname, int band, uchar **pix, + int *nx, int *ny, int *bitpix, char *title)\fR +.fi +.NH 2 +Displaying FITS Images +.LP + The \fBcdl_displayFITS()\fR procedure can be used to display a +\fIsimple\fR FITS image by name. A "simple" FITS file is assumed to be +one containing a single image and having no extensions. Other types of +FITS files may of course be displayed but the client will have to use other +means to import the pixels. FITS image extensions may be supported in a future +release of the CDL. The \fIframe\fR and \fIfbconfig\fR +arguments select the frame and frame buffer size respectively, +the special symbolic value \fBFB_AUTO\fR may be +used for the \fIfbconfig\fR argument to have the procedure automatically +select the frame buffer most appropriate for the image size. +If the +\fIzscale\fR flag is greater than zero the image will automatically be +converted to 8-bit values using the zscale mapping algorithm. The function +returns a positive value if the image cannot be accessed or displayed for +any reason, an error message will be printed. +.LP + The \fIcdl_isFITS()\fR procedure returns a positive value if the +filename argument is recognized as a simple FITS image. For simply reading +the image pixels the \fBcdl_readFITS()\fR procedure may be used. The +output pixel array, image dimensions and pixel size are returned if +successful otherwise the function returns a positive value. Note that +the returned pixel values may need to be scaled before they can be displayed. + +.us "Synopsis" +.nf + \f(CWint cdl_displayFITS (CDLPtr cdl, char *fname, int frame, + int fbconfig, int zscale)\fR + \f(CWint cdl_isFITS (char *fname)\fR + \f(CWint cdl_readFITS (char *fname, uchar **pix, int *nx, int *ny, + int *bitpix, char *title)\fR +.fi +.NH 2 +Displaying Raw Pixels +.LP + The \fBcdl_displayPix()\fR procedure can be used to display an +arbitrary array of pixels of any size. The \fInx\fR and \fIny\fR arguments +are the raster dimensions, and \fIbitpix\fR is the pixel size and has the +same meaning as the FITS BITPIX keyword. The \fIframe\fR and \fIfbconfig\fR +arguments select the frame and frame buffer size respectively, +the special symbolic value \fBFB_AUTO\fR may be +used for the \fIfbconfig\fR argument to have the procedure automatically +select the frame buffer most appropriate for the image size. +If the +\fIzscale\fR flag is greater than zero the image will automatically be +converted to 8-bit values using the zscale mapping algorithm. + +.us "Synopsis" +.nf + \f(CWint cdl_displayPix (CDLPtr cdl, uchar *pix, int nx, int ny, + int bitpix, int frame, int fbconfig, int zscale)\fR +.fi +.NH 2 +Frame Selection +.LP + Frame selection is normally done as an argument to one of the display +procedures, however frames may be explicitly selected using the +\fBcdl_setFrame()\fR procedure. This allows client programs to essentially +"blink" frames independently, as long as the server supports multiple frames. +The \fBcdl_getFrame()\fR procedure may be used to get the current frame +set in the server. + +.us "Synopsis" +.nf + \f(CWvoid cdl_setFrame (CDLPtr cdl, int frame)\fR + \f(CWvoid cdl_getFrame (CDLPtr cdl, int *frame)\fR +.fi +.NH 2 +Clearing the Display +.LP + The current display frame may be explicitly cleared using the +\fBcdl_clearFrame()\fR procedure. The frame is also cleared prior to +displaying new images by the procedures \fBcdl_displayPix()\fR, +\fBcdl_displayFITS()\fR, and \fBcdl_displayIRAF()\fR. + +.us "Synopsis" +.nf + \f(CWint cdl_clearFrame (CDLPtr cdl)\fR +.fi +.NH 2 +Frame Buffer Selection +.LP + The default frame buffer used is 512x512, other sizes may be +selected using the \fBcdl_setFBConfig()\fR procedure. To set the frame +buffer size the client passes the frame buffer number as defined in +the frame buffer configuration file (see below) while setting the image +WCS. It is important to note that the frame buffer isn't actually changed +in the server until a subsequent \fBcdl_setWCS()\fR call, either directly +or through some other procedure which sets the WCS (e.g. one of the display +procedures). +.LP + To get the size of the currently defined frame buffer the user +may call the \fBcdl_getFBConfig()\fR procedure. This returns not only +the current configuration number, but the size as well. To get the size +and any arbitrary configuration without actually setting it, the +\fBcdl_lookupFBSize()\fR procedure may be used. Any configuration not actually +defined in the frame buffer configuration file is returned as the default +512x512 size. + +.us "Synopsis" +.nf + \f(CWvoid cdl_setFBConfig (CDLPtr cdl, int configno)\fR + \f(CWvoid cdl_getFBConfig (CDLPtr cdl, int *configno, int *width, + int *height, int *nframes)\fR + \f(CWvoid cdl_lookupFBSize (CDLPtr cdl, int configno, int *width, + int *height, int *nframes)\fR +.fi +.NH 3 +Automatic Selection +.LP + The \fBcdl_selectFB()\fR procedure may be used to select the most +appropriate frame buffer to use for a given image size. If possible a frame +buffer the same size as the image will be used, otherwise one that is +larger will be chosen. Rather than simply selecting the first configuration +larger than the image, the procedure searches the entire configuration file +selecting the one with the least empty space in both dimensions. If the +\fIreset\fR flag is non-zero this frame is set automatically by the +procedure, otherwise the selected dimension is simply returned to the +calling program. In either case the new frame buffer will not take effect +until a new WCS is defined for the frame. + +.us "Synopsis" +.nf + \f(CWvoid cdl_selectFB (CDLPtr cdl, int nx, int ny, int *fb, + int *w, int *h, int *nf, int reset) +.fi +.NH 3 +The Frame Buffer Configuration File +.LP + The size of the frame buffer is not passed directly to the server +since this is not part of the communications protocol used. Instead, the +frame buffer number is sent as part of the WCS header packet. So that +both the server and client can know that a particular frame buffer number +corresponds to a specific size, a \fIframe buffer configuration file\fR +is used which both the client and server read. +.LP + The default configuration file is /usr/local/lib/imtoolrc, this can +be overridden by defining an \fBIMTOOLRC\fR environment variable naming +the file to be used, or by creating a .imtoolrc file in your home directory. +Since the server must also read the same file, this must be done before +starting both the client and server applications. +.LP +The format of the frame buffer configuration file is +.sp 0.5 + \fIconfigno nframes width height [extra fields]\fP +.sp 0.5 +e.g. +.sp 0.5 + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 4 frames, configuration numbers need not be sequential but should be +in ascending order. +.NH 2 +Image WCS Description +.LP + The image WCS is defined using the \fBcdl_setWCS()\fR procedure. The +WCS defines a mapping between any linear coordinate system and the image +pixels, for our purposes we will discuss how the WCS is used to map the frame +buffer pixels to image coordinates. It is passed to the server in a string +of the form: +.sp 0.5 +.nf + \fIname\fR - \fItitle\fR\\n + a b c d tx ty z1 z2 zt +.fi +.sp 0.2 +where: +.sp 0.2 + \fBX\fR' = a * \fBX\fR + c * \fBY\fR + tx + \fBY\fR' = b * \fBX\fR + d * \fBY\fR + ty + +The terms \fIa, b, c\fR, and \fId\fR define a rotation of the WCS wrt the +pixel (i.e. frame buffer) +coordinates, the \fItx\fR and \fIty\fR values are translation terms relative +to the upper-left corner of the display. The +remaining three values define the intensity mapping of the display pixels; +\fIz1\fR is the minimum pixel value used in the transformation, \fIz2\fR is +the maximum value, and \fIzt\fR defines the type of transformation used (0 for +none, 1 for linear, 2 for log10). +.LP + The WCS may be set explicitly by the calling program or a default +appropriate for the image will be set automatically by the high-level +display procedures, otherwise a WCS for the frame buffer is defined +(i.e. returned coordinates are frame buffer coords). As an example of how +the WCS is defined, the default WCS for an image \fIIMX\fR x \fIIMY\fR +pixels in a frame buffer \fIFBX\fR x \fIFBY\fR pixels is defined as +.sp 0.5 +.nf +\f(CW a = 1.0; /* no rotation */ + b = 0.0; + c = 0.0; + d = -1.0; + tx = (\fIIMX\f(CW / 2) - (\fIFBX\f(CW / 2) + 1; /* center in FB */ + ty = (\fIFBY\f(CW / 2) + (\fIIMY\f(CW / 2); + z1 = z1; /* zscale values */ + z2 = z2; + zt = 1;\fR +.fi + +.us "Synopsis" +.nf + \f(CWint cdl_setWCS (CDLPtr cdl, char *name, char *title, + float a, float b, float c, float d, float tx, float ty, + float z1, float z2, int zt)\fR + \f(CWint cdl_getWCS (CDLPtr cdl, char *name, char *title, + float *a, float *b, float *c, float *d, float *tx, float *ty, + float *z1, float *z2, int *zt)\fR +.fi +.NH 3 +Image Mappings +.LP + Beginning with \fBX11IRAF V1.3\fR the \fIXImtool\fR display server +has had the ability to use multiple world coordinate systems in a frame +(e.g. subrasters of a mosaic display). To do this, the \fBIRAF\fR and +\fBCDL\fR display interfaces were modified to pass in extra information +with the WCS string to define the mapping of the image pixels to the frame +buffer pixels. This extra information allows the XImtool to know when the +cursor in within one of the image subrasters and compute coordinates +appropriately. (See the \fIXImtool\fR documentation for details on how +this is done exactly). +.LP + The CDL will automatically determine when the connection is first +established whether the server is aware of this new mapping information. +Calls to send or receive mapping data will be ignored for servers which are +not aware of the extra data in the string. For servers which can use the +mappings, and where a mapping has been provided, the WCS string now looks +like +.sp 0.5 +.nf + \fIname\fR - \fItitle\fR\\n + a b c d tx ty z1 z2 zt\\n + \fBregion_name sx sy snx sny dx dy dnx dny\\n + object_ref\R +.fi +.sp 0.5 +where the new parameters are defined to be: +.sp 0.2 +.TS +center; +lB lI. +region_name User-defined name for the region. +sx, sy, snx, sny Source rect in the object. +dx, dy, dnx, dny Destination rect in the display frame buffer. +object_ref Full node!/path image specification. +.TE +The \fIobject_ref\fR should be a complete node!path specification to the +image including any image section or extension. This is needed by the +XImtool coordinate/pixel plug-in to map the same image as was displayed by +the client. The path and node are required to ensure the image will be +found properly. The \fIregion_name\fR can be anything such as \fIimage\fR, +\fIsubraster1\fR, or \fIccd3\fR. The purpose of this field is to provide +some named value for the mapping that may be useful to other client programs +needing to access the mapping. \fISource\fR coordinates refer to the image +pixels, \fIdestination\fR coordinates refer to the frame buffer. +.LP + Because we did not wish to change any of the existing interfaces, +mappings must be set prior to the \fBcdl_setWCS()\fR call using the +\fBcdl_setMapping()\fR procedure. The mapping is stored until the WCS is +actually sent. Similarly, a mapping may be retrieved \fIafter\fR a +\fBcdl_getWCS()\fR call using the \fBcdl_getMapping()\fR procedure to +return the values read with the last WCS retrieval. Since there can at +times be more than one WCS in a frame, it's also possible to query the +mapping for a particular WCS by number (e.g. the WCS number returned in a +cursor read) using the \fIcdl_queryMap()\fR procedure. See the sample +programs in the appendices for examples of how these procedures might be +called. + +.us "Synopsis" +.nf + \f(CWint cdl_getMapping(CDLPtr cdl, char *region, + float *sx, float *sy, int *snx, int *sny, + int *dx, int *dy, int *dnx, int *dny, char *ref); + \f(CWint cdl_setMapping(CDLPtr cdl, char *region, + float sx, float sy, int snx, int sny, + int dx, int dy, int dnx, int dny, char *ref); + \f(CWint cdl_queryMap(CDLPtr cdl, int wcs, char *region, + float *sx, float *sy, int *snx, int *sny, + int *dx, int *dy, int *dnx, int *dny, char *objref); +.fi + +.NH 2 +Image Colormaps +.LP + The IIS protocol used does not permit the downloading of user-defined +colormaps, all images are loaded as raw grayscale values according to the +XImtool colormap model used by currently supported servers. All images +containing private colormaps or more than the 201 grayscale values defined +by the Imtool colormap model must either convert the image to 8-bit +grayscale values by calling the CDL zscale procedures (\fBcdl_computeZscale()\fR +and \fBcdl_zscaleImage()\fR) or scale the images in client code with +user LUTs. The CDL zscale procedures scale image to 201 grayscale values +so that they are displayed to the full 8-bit range, user LUT +transformations or user code for converting to grayscale from a private +colormap procedures should do the same. +.NH 3 +Imtool Color Model +.LP + The IMTOOL color model defines at most 201 grayscale values for use in +displaying the image, a set of 16 static colors are also defined for overlay +graphics. Pixel values sent to the server should be already scaled to this +model, i.e. the image pixels should be scaled to the range 1-200, values +above this will either represent the overlay colors or will wrap around to +8-bit values. The CDL zscale procedures will automatically scale +arbitrary pixel values to use this color model, the overlay procedures +assume color values are defined for the static color range 201-217 but any +8-bit value may be used. +.LP + A summary of the color model values is included below: +.TS +center; +lB lB cB cB lB lB +l l c c l l. +Color Description Color Description +0 Background 208 Cyan +1 - 200 Image data 209 Magenta +201 Cursor (white) 210 Coral +202 Background (black) 211 Maroon +203 White 212 Orange +204 Red 213 Khaki +205 Green 214 Orchid +206 Blue 215 Turquoise +207 Yellow 216 Violet +217 Wheat 218-255 undefined +.TE +.NH 2 +ZScale Intensity Mapping +.LP + Since most display servers are only capable of displaying 8-bit pixel +values, images with more than 8-bits per pixel must be scaled prior to +display. For linear transformations this is typically done using a simple +conversion of the image min/max values to the 256 grayscale values, however +this doesn't produce very good results when most pixel values are near one +of the extremes (usually the image min for astronomical images). To solve +this IRAF uses a \fIzscale\fR mapping algorithm where a sampling grid is used +to approximate the image min/max values rather than computing it directly, +a line is then fit to these sample pixels to determine the optimal +transformation to the display values. This is not only more efficient but +maps the most common pixel values to the display range producing a better image. +.LP + The CDL has several routines for doing the same transformation: the +\fIcdl_computeZscale()\fR procedure is used to compute the optimal \fIz1\fR +and \fIz2\fR +values (the min/max used for the zscale transform) for an image of any pixel +size. The \fIbitpix\fR argument is the number of bits-per-pixel for the input +array and has the same meaning as for the FITS \fIBITPIX\fR keyword. To then +transform the image using these values (or user-defined values) the +\fIcdl_zscaleImage()\fR procedure is used. The input pixels are modified by +this procedure but the array is not reallocated to the smaller size needed by +an 8-bit array. The \fBcdl_setSample()\fR and \fBcdl_setSampleLines()\fR +procedures can be used to change the sampling grid and number of sample +points (the default is 600 points on 5 lines). The \fBcdl_setContrast()\fR +procedure can be used to change the default contrast adjustment to the slope +used in the transformation (the default is 0.25). If a value of zero is +given then the minimum and maximum of the intensity sample is used as the +z1/z2 value. +.LP + Each of the CDL display procedures has a \fIzscale\fR flag to +automatically scale the pixels prior to display. Applications wishing to +set their own z1/z2 values will need to call the zscale procedures and +disable this flag. By default cdl_zscaleImage() will use a linear transform, +the \fBcdl_setZTrans()\fR procedure may be used to change this. Acceptable +values are \fBCDL_UNITARY\fR (zero) for a unitary transform, \fBCDL_LINEAR\fR +(one) for a linear transform, or \fBCDL_LOG\fR (two) for a log10 transform. + +.us "Synopsis" +.nf + \f(CWvoid cdl_computeZscale (CDLPtr cdl, uchar *pix, int nx, + int ny, int bitpix, float *z1, float *z2)\fR + \f(CWvoid cdl_zscaleImage (CDLPtr cdl, uchar **pix, int nx, + int ny, int bitpix, float z1, float z2)\fR + + \f(CWvoid cdl_setZTrans (CDLPtr cdl, int ztrans)\fR + \f(CWvoid cdl_getZTrans (CDLPtr cdl, int *ztrans)\fR + \f(CWvoid cdl_setZScale (CDLPtr cdl, float z1, float z2)\fR + \f(CWvoid cdl_getZScale (CDLPtr cdl, float *z1, float *z2)\fR + + \f(CWvoid cdl_setSample (CDLPtr cdl, int nsample)\fR + \f(CWvoid cdl_setSampleLines (CDLPtr cdl, int nlines)\fR + \f(CWvoid cdl_setContrast (CDLPtr cdl, float contrast)\fR + \f(CWvoid cdl_getSample (CDLPtr cdl, int *nsample)\fR + \f(CWvoid cdl_getSampleLines (CDLPtr cdl, int *nlines)\fR + \f(CWvoid cdl_getContrast (CDLPtr cdl, float *contrast)\fR + +.fi +.NH 2 +Image Hardcopy +.LP + While most servers include some hardcopy capability of their own the +CDL provides two procedures for creating hardcopy images from the client +(e.g. for a batch processing application). The client will typically read +back the entire image, frame buffer, of just a subraster and pass those +pixels to the print procedure. Images will be written as Pseudocolor +Postscript (to preserve the overlay marker colors) and may be disposed to +a file using the \fBcdl_printPixToFile()\fR procedure or to any command string +accepting input from \fIstdin\fR (typically just an 'lpr' command) by using +the \fBcdl_printPix()\fR procedure. + +.us "Synopsis" +.nf + \f(CWint cdl_printPix (CDLPtr cdl, char *cmd, uchar *pix, int nx, + int ny, int annotate)\fR + \f(CWint cdl_printPixToFile (CDLPtr cdl, char *fname, uchar *pix, + int nx, int ny, int annotate)\fR +.fi +.NH 2 +Image Cursor +.LP + The image cursor is read using the \fBcdl_readCursor()\fR procedure. +The returned value is the cursor \fI(x,y)\fR position as floating point value +in terms of the currently define image WCS. Note that this position must +be converted to integer if it is to be used in one of the marker procedures. + +.us "Synopsis" +.nf + \f(CWint cdl_readCursor (CDLPtr cdl, int sample, float *x, + float *y, int *wcs, char *key)\fR +.fi + +The \fIwcs\fR argument is defined as + +.nf + wcs = frame * 100 + wcs_number +.fi + +(where wcs_number=0 for frame buffer coords and 1 for image coords). So, +you can get the frame as simply + +.nf + frame = (int) (wcs / 100) +.fi + +.NH 3 +Cursor Sampling +.LP + If the cdl_readCursor() \fIsample\fR flag is non-zero the \fIlogical +image cursor\fR position is returned immediately, otherwise the display server +will wait for a keystroke before returning the cursor position. The logical +image cursor is the last value set by a \fIcdl_setCursor()\fR call or the last +value returned by a \fIcdl_readCursor()\fR call. When sampling the cursor +position the keystroke value is undefined. +.NH 2 +Image Readout +.LP + The CDL maintains an internal knowledge of where an image has been +positioned if it was displayed using one of the \fIcdl_display*\fR procedures. +The \fBcdl_readImage()\fR procedure may be used to read back the entire image +pixels from the server ignoring the region of the frame buffer outside of +the image, the \fBcdl_readFrameBuffer()\fR procedure will read back the +contents of the entire frame buffer. The dimensions of the array are returned +in the \fInx\fR and \fIny\fR arguments. + +.us "Synopsis" +.nf + \f(CWint cdl_readImage (CDLPtr cdl, uchar **pix, int *nx, + int *ny)\R + \f(CWint cdl_readFrameBuffer (CDLPtr cdl, uchar **pix, + int *nx, int *ny)\R +.fi +.NH 2 +Subraster I/O +.LP + The \fBcdl_writeSubRaster()\fR procedure is used to write an arbitrary +raster to any location in the display. Similarly the +\fBcdl_readSubRaster()\fR procedure is used to read back an arbitrary raster. +When an image has previously been displayed the subraster position is given +in image coordinates (e.g. when writing a subregion of edited pixels), +otherwise the position is in frame buffer coordinates (e.g. to display +multiple images per frame you should use the cdl_writeSubRaster() call). +See the section on \fIMarker Coordinates\fR for further explanation of the +coordinate systems used. + +.us "Synopsis" +.nf + \f(CWint cdl_writeSubRaster (CDLPtr cdl, int lx, int ly, int nx, + int ny, uchar *pix)\fR + \f(CWint cdl_readSubRaster (CDLPtr cdl, int lx, int ly, int nx, + int ny, uchar **pix)\fR +.fi +.NH +Graphics Overlay +.NH 2 +Marker Coordinates +.LP + All marker positions are assumed to be image pixel coordinates, +although there is no requirement that the position be on the image itself. +When an image WCS is defined (using the CDL display procedures or explicitly) +the origin of the coordinates used shifts from the frame buffer lower-left +to the lower-left of the image as displayed in the frame. Negative +positions are allowed and will either refer to empty pixels if the frame +buffer is larger than the image, or pixels outside the frame buffer +boundaries. Raster I/O requests will be clipped to the frame buffer +endpoints, a request completely outside the frame buffer is an error. +.NH 2 +Mapping a Previously Displayed Image +.LP + Ideally any application wishing to draw markers on an image will have +also displayed that image, however the \fBcdl_mapFrame()\fR procedure may +be used to map the requested frame for marker overlay. It does this by +reading the WCS defined for that frame and assumes an image has been +displayed and centered in the frame buffer, then resets the internal CDL +image position. For this reason it should not be used when multiple image +mappings have been displayed to a frame unless the marker overlay can be +done reliably using the last WCS displayed to the frame buffer. +If no image has been displayed the frame buffer is mapped +directly. This can be used for example to map an empty frame for displaying +just the markers without an image, or for mapping another frame's WCS for +use on the current display. The frame is not changed by the procedure call +however the current WCS \fIis\fR changed. + +.us "Synopsis" +.nf + \f(CWint cdl_mapFrame (CDLPtr cdl, int frame)\fR +.fi +.NH 2 +Marking a Coordinate File +.LP + Since a common function for programs will be to mark a list of +coordinates, the high-level \fBcdl_markCoordsFile()\fR procedure is +provided to make this easier. The input parameters include a filename +expected to contain a set of (x,y) points (real or integer), and arguments +specifying the point type, size and color to draw. If the \fIlabel\fR +argument is positive each marker point will be labeled with it's relative +number in the file. The size, type and color arguments all have the same +meaning as for the \fBcdl_markPoint()\fR procedure described below. + +.us "Synopsis" +.nf + \f(CWint cdl_markCoordsFile (CDLPtr cdl, char *fname, int type, + int size, int color, int label)\fR +.fi +.NH 2 +Marker Colors +.LP + Markers may be drawn using any 8-bit value, in order to use the +static overlay colors the color must be in the range 201-217 (see above for +notes on the XImtool color model). The "\fIcdl.h\fR" include file +for C programs, the "\fIcdlftn.inc\fR" include for fortran programs, +or the "\fIcdlspp.h\fR" include for SPP programs, defines the following +symbolic constants for each of the static overlay colors: +.sp 0.5 +.TS +center; +lB l c c lB l. +C_BLACK 202 C_CORAL 210 +C_WHITE 203 C_MAROON 211 +C_RED 204 C_ORANGE 212 +C_GREEN 205 C_KHAKI 213 +C_BLUE 206 C_ORCHID 214 +C_YELLOW 207 C_TURQUOISE 215 +C_CYAN 208 C_VIOLET 216 +C_MAGENTA 209 C_WHEAT 217 +.TE +.NH 2 +Marker Types +.LP + Currently supported marker types include: \fI +.TS +center; +l l l l l. +Point Line Box Polyline Polygon +Circle Circular Annuli Ellipse Elliptical Annuli Text +.TE +.LP + \fRThe "\fIcdl.h\fR" include file for C programs, the +"\fIcdlftn.inc\fR" include for fortran programs, or the "\fIcdlspp.h\fR" +include file SPP programs, defines the following symbolic constants for +each of the defined \fIPoint\fR marker types: +.TS +center; +lB r c c lB r. +M_FILL 1 M_CIRCLE 64 +M_POINT 2 M_STAR 128 +M_BOX 4 M_HLINE 256 +M_PLUS 8 M_VLINE 512 +M_CROSS 16 M_HBLINE 1024 +M_DIAMOND 32 M_VBLINE 2048 +.TE +.LP + Point markers are drawn using the \fBcdl_markPoint()\fR procedure, +point types may be logically \fIOR\fR'd to create composite markers, closed +shapes such as a circles, diamonds, or squares may be \fIOR\fR'd with the +M_FILL flag to flood-fill the point with the current overlay color. +.NH 3 +Point +.LP + The \fBcdl_markPoint()\fR procedure is used to mark a specific point +on the image using one of the marker types listed above. The marker is +centered at the coordinates specified by the \fIx\fR and \fIy\fR arguments, +\fItype\fR is an integer flag indicating what kind of marker to draw and +may be a composite type by logically ORing two or more marker types. +\fISize\fR is the width and height of the marker measured in pixel unxits, +and \fIcolor\fR is the color used to draw the marker. If the \fInumber\fR +argument is greater than zero that number will be drawn next to the point +as a label, creating text labels for point markers can be done using the +\fIcdl_markPointLabel\fR procedure. +.LP + Most marker names are fairly obvious but several are worth special +mention: The M_DIAMOND, M_CIRCLE and M_BOX marker types may be logically +\fIOR\fRed with the M_FILL flag to produce a filled marker type. Unless +\fIOR\fRd with the M_POINT flag all point markers will leave the center +pixel unchanged. The M_HLINE and M_VLINE markers are most useful in +astronomical applications to mark an individual star, they are horizontal +and vertical lines respectively with a gap in the middle third of the marker +(the M_HBLINE and M_VBLINE are identical but with a width of 3 pixels). +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPoint (CDLPtr cdl, int x, int y, int number, + int size, int type, int color)\fR + \f(CWint cdl_markPointLabel (CDLPtr cdl, int x, int y, char *label + int size, int type, int color)\fR +.fi +.NH 3 +Line +.LP + The \fBcdl_markLine()\fR procedure is used to draw a line of the +specified color between points (\fIxs,ys\fR) and (\fIxe,ye\fR). +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markLine (CDLPtr cdl, int xs, int ys, int xe, int ye, + int color)\fR +.fi +.NH 3 +Box +.LP + The \fBcdl_markBox()\fR procedure is used to draw a box of the +specified color with endpoints specified by (\fIlx,ly\fR) and (\fIux,uy\fR). +If the \fIfill\fR flag is set the box will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markBox (CDLPtr cdl, int lx, int ly, int ux, int uy, + int fill, int color)\fR +.fi +.NH 3 +Circle +.LP + The \fBcdl_markCircle()\fR procedure is used to draw a circle of the +specified color with a center at (\fIx,y\fR) and radius \fIradius\fR. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markCircle (CDLPtr cdl, int x, int y, int radius, + int fill, int color)\fR +.fi +.NH 3 +Polyline +.LP + The \fBcdl_markPolyline()\fR procedure is used to draw a line +connecting the \fInpts\fR points specified by the \fIxpts\fR and +\fIypts\fR array in the desired \fIcolor\fR. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPolyline (CDLPtr cdl, int *xpts, int *ypts, + int npts, int color)\fR +.fi +.NH 3 +Polygon +.LP + The \fBcdl_markPolygon()\fR procedure is used to draw a closed +polygon consisting of \fInpts\fR vertices specified by the \fIxpts\fR and +\fIypts\fR array in the desired \fIcolor\fR. The last point in the array +will automatically be connected to the first point by the procedure. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPolygon (CDLPtr cdl, int *xpts, int *ypts, + int npts, int fill, int color)\fR +.fi +.NH 3 +Ellipse +.LP + The \fBcdl_markEllipse()\fR procedure is used to draw an ellipse of the +specified color with a center at (\fIx,y\fR) and semimajor-axis \fIxrad\fR +and semiminor-axis \fIyrad\fR pixels long. A rotation angle for the ellipse +may be specified by passing a non-zero \fIangle\fR argument, the angle is +measured in degrees from the positive x-axis. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markEllipse (CDLPtr cdl, int x, int y, int xrad, + int yrad, float ang, int fill, int color)\fR +.fi +.NH 3 +Circular Annuli +.LP + The \fBcdl_markCircAnnuli()\fR procedure is used to draw +\fInannuli\fR circles separated by \fIsep\fR pixels each. The circle is +centered at (\fIx,y\fR) with an initial radius of \fIradius\fR pixels. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markCircAnnuli (CDLPtr cdl, int x, int y, int radius, + int nannuli, int sep, int color)\fR +.fi +.NH 3 +Elliptical Annuli +.LP + The \fBcdl_markEllipAnnuli()\fR procedure is used to draw +\fInannuli\fR ellipses separated by \fIsep\fR pixels each. The ellipse is +centered at (\fIx,y\fR) with an initial semimajor and semiminor axis +specified by the \fIxrad\fR and \fIyrad\fR arguments. Each ellipse will +be optionally rotate by an \fIangle\fR degrees as measured from the positive +x-axis. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markEllipAnnuli (CDLPtr cdl, x, y, xrad, yrad, ang, + int nannuli, int sep, int color)\fR +.fi +.NH 3 +Text +.LP + The \fBcdl_markText()\fR procedure is used to draw a text string +specified by \fIstr\fR argument with an initial position at (\fIx,y\fR) +and optionally rotated by \fIangle\fR degrees as measured from the positive +x-axis. The default \fIsize\fR is 1.0 and is approximately a 6x13 font, +the font size may be scaled by any fractional amount. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markText (CDLPtr cdl, int x, int y, char *str, + float size, float angle, int color)\fR +.fi +.NH 2 +Text Fonts +.LP + The \fBcdl_setFont()\fR procedure is used to choose between one +of four available fonts as the text marker default: Roman, Greek, Futura, +Bold and Times respectively. By default the Roman font will be used. +The width of the lines used to draw the text may also be set. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWvoid cdl_setFont (CDLPtr cdl, int font)\fR + \f(CWvoid cdl_setTextWidth (CDLPtr cdl, int width)\fR +.fi +.sp 0.5 +A complete listing of the Greek character mappings can be found in the +file 'greek.ps' in the 'doc' subdirectory of the CDL distribution. + The \fIRoman\fR font is the font implemented in the original version +of the CDL and works well for most applications. Both the \fIGreek\fR and +\fITimes\fR fonts are hi-resolution fonts which work best for larger frame +buffers but can produce publication quality text. The \fIFutura\fR font +is a simpler font which can produce better results than the default on small +size frame buffers. A \fIBold\fR font automatically increases the text line +width by one pixel over the current setting and may be used with any font. +.NH 3 +In-Line Font Changes +.LP + Text markers are drawn using the font selected with +the \fIcdl_setFont()\fR +routine, however fonts may be change within a string itself (e.g. to set +a Greek character) using a \\f escape sequence. The escape is followed +by the character 'R' to set a Roman font, 'G' for Greek, 'F' for +futura, 'B' for bold +and 'T' for Times. Any number of escapes are permitted within a string, +the font change will remain in effect until it is changed, or the end of +string at which point any subsequent strings will again be drawn with the +default font. Additionally a 'P' in the escape sequence will change the +font to the one previously used, whatever that may be. +.LP + The CDL also supports a sub/superscripting of text which can only +be done with the font escapes. In this case the escape character followed by +a 'U' produces a superscript and a 'D' produces a subscript. The changes may +be nested permitting several levels of sub/superscripts, these escapes may +also be used in conjunction with a font change to cause the sub/superscript +to be drawn with a different font. A superscript escape will remain in +effect until the end of the string or a \\fD escape is seen. Similarly a +subscript remains in effect until the end of the string of a \\fU escape. +Sub/superscripted text is drawn using a smaller font size, there is presently +no way to specify a different size for the sub/superscripted text. +.TS +center; +cb s +l l. +Summary of Font Escapes +.sp 0.5 +\\\\fR change to Roman font +\\\\fG change to Greek font +\\\\fF change to Futura font +\\\\fT change to Times font +\\\\fB change to bold font +\\\\fP change to previous font +\\\\fU begin relative superscripted text +\\\\fD begin relative subscripted text +.TE +.NH 2 +Line Widths and Styles +.LP + The \fBcdl_setLineWidth()\fR procedure can be used to set the line +width used to draw polygon or polyline markers, point markers will not +be affected. The \fBcdl_setLineStyle()\fR procedure is used to set a line +style other than solid. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWvoid cdl_setLineWidth (CDLPtr cdl, int width)\fR + \f(CWvoid cdl_setLineStyle (CDLPtr cdl, int style)\fR +.fi +.LP + \fRThe "\fIcdl.h\fR" include file for C programs, the +"\fIcdlftn.inc\fR" include for fortran programs, or the "\fIcdlspp.h\fR" +include file SPP programs, defines the following symbolic constants for +each of the defined line styles: +.TS +center; +lB r c c lB r. +L_SOLID 0 L_DASHED 1 +L_DOTTED 2 L_DOTDASH 3 +L_HOLLOW 4 L_SHADOW 5 +.TE +.LP + The \fIhollow\fR line style is drawn with a linewidth of five pixels, +two pixels of color, a black line, and two pixels of color. It is best +used when the marker will traverse extreme changes in brightness, due to the +thickness of the line it may work best with larger frame buffers. The +\fIshadow\fR linestyle is drawn as two pixels of color and two pixels of black +and should be used for similar brightness variations, however it effectively +shows up as a line only two pixels wide and may be preferred for medium or +smaller frame buffers. +.LP + The three dashed linestyles are drawn using "gap" spacings of 5 +pixels in between line segments. Whether or not these gaps are resolved +depends on the size of the frame buffer being used and the magnification +used in the display server. By default they should resolve completely +using frame buffers up to 1024x1024 pixels, or magnification factors +displaying 1024x1024 pixels. If larger sizes are needed the image should +be subsampled prior to display to maintain the marker resolution needed +for these linestyles. + +.NH 2 +Deleting Markers +.LP + When markers are drawn the underlying subraster is first saved to +an internal structure, erasure is done by simply redisplaying the saved +raster. Problems can arise however when markers overlap; when deleting a +marker that is \fIunder\fR another marker the original pixels can overwrite +the pixels of the marker on top. This is an unfortunate side effect of the +simple scheme used in this version of the package, users can call the +\fBcdl_redrawOverlay()\fR procedure to help clean up any artifacts left +behind. +.NH 3 +Individual Markers +.LP + The \fBcdl_deleteMark()\fR procedure is used to delete a single +marker from the display(). The (\fIx,y\fR) argument is either the center +position of the marker if that is know by the application, more typically +it will be an approximate position. In the latter case the marker whose +center is closest to this position will be deleted. For markers with no +defined center the distance used to decide if the marker should be +deleted is the distance from the argument position to the edge of the +marker. For example, distance from a box or polygon is measured as the +distance from to one of the sides, for text it is the distance to the +start of the text string. There is no way to \fIun\fRdelete a marker other +than to redraw it. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_deleteMark (CDLPtr cdl, int x, int y)\fR +.fi +.NH 3 +The Entire Overlay +.LP + To erase all markers currently displayed use the +\fBcdl_clearOverlay()\fR procedure. Markers are erased in the reverse order +they were drawn to help reduce the chance that overlaying markers will leave +stray pixels. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_clearOverlay (CDLPtr cdl)\fR +.fi +.NH 2 +Redraw +.LP + The \fBcdl_redrawOverlay()\fR procedure can be used to redraw all +markers currently in the display list. This is sometimes needed when +subraster I/O procedures are used to redisplay subregions and overwrite +existing markers. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_redrawOverlay (CDLPtr cdl)\fR +.fi +.NH +ANSI C Function Prototypes +.LP + The current release of CDL provides full ANSI C function prototypes +for all public and private procedures. By default these will not be used +even on systems with native ANSI compilers, however. +To make use of the CDL prototypes users will +need to define the macro \fBCDL_ANSIC\fR either when compiling the program +(using the -D option to the compiler), +or as a definition in the program source preceding the 'cdl.h' include +directive. +.LP + For example, +.sp 0.5 +.nf + \f(CW#define CDL_ANSIC + #include "cdl.h" + : + main (int argc, char **argv) + :\fR +.fi +.sp 0.5 +or when compiling using something like +.sp 0.5 +.nf + \f(CWcc -DCDL_ANSIC client.c libcdl.a -lm\fR +.fi +.sp 0.5 + Note that when using CDL_ANSIC to build the client program it is +also required that the CDL itself be built in the same way to avoid +confusing FPE errors. Similarly, when building client tasks that \fIdo +not\fR +use CDL_ANSIC you must use a version of the library that has not been +compiled with prototypes. +.LP + The reason is that the float args to the CDL procedures in the +library, or in your task calls, are +promoted to doubles when compiling those procedures, but may only be passed as +floats in your code (or as double where the CDL is expecting float). +This means the argument stack is off by 4 bytes for each float arg and +the values interpreted by the CDL procedure will be corrupted. +If you're going to use the prototypes you'll +need to edit the CDL Imakefile to define "-DCDL_ANSIC" in the EXTRA_DEFINES +so it will use the prototypes and everything will line up. You will then +need to rebuild the libcdl.a as well as relink your program. +.NH +Fortran Language Binding Notes +.LP + The Fortran language binding routines are implemented in C but +should be accessible from any fortran program as though they were real +fortran subroutines. The calling sequences are the same as with the C +library routines with the following exceptions: +.IP +\(bu The CDL package pointer is maintained internally so no 'cdl' pointer is +passed in the fortran interface. +.IP +\(bu All routines which are integer procedures in the C interface return an +extra 'ier' argument to contain the error flag. All Fortran functions are +implemented as subroutines. +.IP +\(bu The procedure names are the same except that \fIcdl_\fR has been +replaced with \fIcf\fR in the fortran binding. If your compiler is +case-sensitive then use all lower case letters. +.LP +The binding has been tested on a number of different platforms without +problems. The procedure names haven't been restricted to the traditional +6-character fortran names since most modern compilers can handle longer +names, if yours isn't one of them contact \fIiraf@noao.edu\fR for help +in changing the names. +.LP + Since the CDL is implemented as a set of C routines, the one aspect +that cannot be overlooked in the fortran binding is the between Fortran and +C storage order for arrays. In most cases this will not be a problem since +the CDL routines are just passing around pointers even if they live for a +short while in a fortran program. The problem comes when using the fortran +program to read the arrays, for example in using the array returned by the +\fBcfreadIRAF()\fR procedure, or when passing in arrays for display that +originated in the user's fortran code. In these cases the array \fBmust\fR +be transposed to be interpreted correctly. It was assumed that in most +applications arrays returned by CDL procedures would be immediately passed +to other CDL procedures so having the binding routines +transpose the array to/from +Fortran storage order was unnecessarily inefficient. This may be changed in +later releases if required. + +.NH +SPP Language Binding Notes +.LP + The SPP language binding is experimental and is intended to provide +a way to quickly prototype tasks, it should not be used in production code +as it may not be as portable as the rest of the task. In essence this +binding is a layer on top of the Fortran binding since most IRAF platforms +still use Fortran as the intermediate code. The calling sequences are the +same as with the Fortran library routines with the following caveats: +.IP +\(bu The 'cdlspp.h' SPP include file is required by all files which call +CDL routines. The binding names are actually SPP macros to resolve the +current 6 character limit on procedure names. +.IP +\(bu All character string arguments must be dimensioned to at least SZ_FNAME +characters in length. +.IP +\(bu The CDL package pointer is maintained internally so no 'cdl' pointer is +passed in the fortran interface. +.IP +\(bu All routines which are integer procedures in the C interface return an +extra 'ier' argument to contain the error flag. All SPP functions are +implemented as subroutines. +.IP +\(bu On HPUX or IBM RS6000 systems the 'cdlspp.h' file must be edited to +remove the trailing underscores from the procedure name macros. This is +because on these platforms the fortran compiler will not append an +underscore to the SPP symbols as it does on other platforms. + +.NH +IIS Protocol Description +.LP + The communications protocol used by the CDL and servers such as +\fIXImtool\fR and \fISAOimage\fR, is a slightly modified version of that used +by the IIS Model 70. All operations are initiated by sending a header +packet containing a \fIthing id\fR (tid) and \fIsubunit\fR selecting the +function to be performed, optionally followed by data up to 32K bytes long. +The IIS header packet used is defined as +.nf + \f(CWstruct iism70 { + short tid; + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; + };\fR +.fi + +The \fIthing count\fR field contains the negative number of bytes of data +that will be sent following the header packet. The IIS header checksum is +computed as +.nf +\f(CW + checksum = 0177777 - (tid + subunit + thingct + x + y + z + t); +\fR +.fi +The four IIS registers are set differently depending on the operation, a +summary of the header packets for each operation is summarized below. + +.KS +.ce 1 +\fBIIS Header Packet Summary\fR +.TS +tab(:); +c c c c c c c c c. +:TID:Subunit:Tct:X:Y:Z:T:Data +.T& +l | l | l | c | c | c | l | l | l |. +:_:_:_:_:_:_:_:_ +Read Data:IIS_READ\fB|\fPPACKED:MEMORY:-NB:x:y:fr:-:NB +Write Data:IIS_WRITE\fB|\fPPACKED:MEMORY:-NB:x:y:fr:-:NB +Read Cursor:IIS_READ:IMCURSOR:-:-:-:-:-:- +Write Cursor:IIS_WRITE:IMCURSOR:-:x:y:wcs:-:- +Set Frame:IIS_WRITE:LUT\fB|\fPCOMMAND:-1:-:-:-:-:2 +Erase Frame:IIS_WRITE \fB|\fP fb:FEEDBACK:-:-:-:fr:-:- + +Old Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:-:-:fr:fb:320 +Old Read WCS:IIS_READ:WCS:-:-:-:fr:wcs:320 + +WCS Version?:IIS_READ:WCS:-:1:1:-:-:320 +WCS by Number?:IIS_READ:WCS:-:1:-:fr:wcs:1024 +New Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:1:-:fr:fb:1024 +New Read WCS:IIS_READ:WCS:-:1:-:fr:wcs:1024 +:_:_:_:_:_:_:_:_ +.TE +.KE +.TS +l l l. +Where NB = number of bytes expected or written + x = x position of operation in frame buffer coords + y = y position of operation in frame buffer coords + fr = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 +.TE +.LP +TID fields can be logically OR'd with the PACKED flag indicating the number +of data bytes is exactly \fIthingct\fR bytes long, otherwise \fIthingct\fR +must be specified as half the number of data bytes. In a cursor read, if +the IIS_READ flag is OR'd with IMC_SAMPLE the logical cursor position (i.e. +the last value read or set) is returned immediately, otherwise the server +will wait for a keystroke to be hit before returning a string containing the +(x,y) position, wcs of the read, and the keystroke. When setting the frame +you must send a short integer in the data containing the frame selected. + +.NH +VXIMTOOL Proxy/Display Server Usage +.LP +\fIVXIMTOOL\fR is a image display server process much like \fIXIMTOOL\fR, +except that all it normally does is respond to datastream requests +to read and write to internal frame buffers maintained as arrays in memory. +Multiple frame buffers and frame buffer configurations are supported. It +can be used to debug CDL programs by printing out the +protocol packets received, or can simply be used as a dummy server in cases +where no image display is really needed. By enabling the \fI-proxy\fR +flag the server can also be used to repeat the datastream requests to a +list of other servers, effectively splitting the image display to a number +of other servers. See the \fIvximtool\fR man page for details on other +command-line arguments and usage. +.LP +The program was originally intended as a debugging tool, either in the +development of CDL clients directly or in cases where the display may +need to go to separate screens as part of a larger project. For example, +engineers may wish to "eavesdrop" on the system by viewing images displayed +by CDL clients used as part of a data acquisition system. It can also be +used as a memory-only display server for CDL clients which need to be run +in the background as part of a pipeline processing system requiring a +frame buffer for image marking. +.LP +In proxy mode the program acts as a relay for the IIS datastream packets, +sending image data, frame requests, etc. to a list of other servers specified +on the command line. The effect of this is to allow a client to display to +this program which then re-displays to each of the other named servers. +Of course CDL clients can also do this internally by opening multiple +connections, using \fIvximtool\fR in proxy mode adds the functionality to +programs which may use this feature only ocasionally. A maximum of 8 servers +may be named, they may be either on the local host or a remote machine +and connections can be established using either fifos or sockets. See +above or the \fIvximtool\fR man page for details on how to specify the +server connection. +.LP +The current implementation has a few restrictions users should keep in mind: +.IP +\(bu The time to display an image or perform any output operation scales +with the number of connected hosts. Each IIS packet is forwarded to each +host in turn before processing the next input packet, and connection over a slow +network will delay the entire process. +.IP +\(bu Cursor and image readback are done by sending the request \fIonly\fR to +the first server named on the command line. This is done to avoid forcing +a cursor mode on all servers which cannot be terminated when a response is +received from only one server, and means that the first server named should +be the one used to control interactive sessions. The remaining servers +however can still respond to cursor requests from other applications +connected to that server on another channel. +.IP +\(bu All named servers must be running prior to starting the proxy server. +The connection to the remote servers is established when this task is first +run and if no server is running that connection will be ignored. The task will +exit if no remote servers can be found for display. +.IP +\(bu Any connected server that shuts down while the proxy server is running +is likely to cause the program to crash on the next display. +.bp +.NH +C Interface Summary +.LP +.in 0.5i +#include "\fBcdl.h\fR" +.in -0.5i + +.TS +center; +r l. +CDLPtr \fBcdl_open\fR (imtdev) +int \fBcdl_displayPix\fR (cdl, pix, nx, ny, bitpix, frame, fbconfig, zscale) +char \fBcdl_readCursor\fR (cdl, sample, x, y, wcs, key) +int \fBcdl_setCursor\fR (cdl, x, y, wcs) +int \fBcdl_setWCS\fR (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +int \fBcdl_getWCS\fR (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +void \fBcdl_setFrame\fR (cdl, frame) +int \fBcdl_clearFrame\fR (cdl) +void \fBcdl_close\fR (cdl) + +int \fBcdl_setMapping\fR (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +int \fBcdl_getMapping\fR (cdl, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +int \fBcdl_queryMap\fR (cdl, wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref) + +int \fBcdl_displayIRAF\fR (cdl, fname, band, frame, fbconfig, zscale) +int \fBcdl_isIRAF\fR (fname) +int \fBcdl_readIRAF\fR (fname, band, pix, nx, ny, bitpix, title) + +int \fBcdl_displayFITS\fR (cdl, fname, frame, fbconfig, zscale) +int \fBcdl_isFITS\fR (fname) +int \fBcdl_readFITS\fR (fname, pix, nx, ny, bitpix, title) + +void \fBcdl_computeZscale\fR (cdl, pix, nx, ny, bitpix, z1, z2) +void \fBcdl_zscaleImage\fR (cdl, pix, nx, ny, bitpix, z1, z2) + +int \fBcdl_printPix\fR (cdl, cmd, pix, nx, ny, annotate) +int \fBcdl_printPixToFile\fR (cdl, fname, pix, nx, ny, annotate) + +int \fBcdl_readImage\fR (cdl, pix, nx, ny) +int \fBcdl_readFrameBuffer\fR (cdl, pix, nx, ny) +int \fBcdl_readSubRaster\fR (cdl, lx, ly, nx, ny, pix) +int \fBcdl_writeSubRaster\fR (cdl, lx, ly, nx, ny, pix) + +void \fBcdl_selectFB\fR (cdl, nx, ny, fb, w, h, nf, reset) +void \fBcdl_setFBConfig\fR (cdl, configno) +void \fBcdl_getFBConfig\fR (cdl, configno, w, h, nf) +void \fBcdl_lookupFBSize\fR (cdl, configno, w, h, nf) + +void \fBcdl_setZTrans\fR (cdl, ztrans) +void \fBcdl_setZScale\fR (cdl, z1, z2) +void \fBcdl_setSample\fR (cdl, nsample) +void \fBcdl_setSampleLines\fR (cdl, nlines) +void \fBcdl_setContrast\fR (cdl, contrast) +void \fBcdl_setName\fR (cdl, imname) +void \fBcdl_setTitle\fR (cdl, imtitle) + +void \fBcdl_getFrame\fR (cdl, frame) +void \fBcdl_getZTrans\fR (cdl, ztrans) +void \fBcdl_getZScale\fR (cdl, z1, z2) +void \fBcdl_getSample\fR (cdl, nsample) +void \fBcdl_getSampleLines\fR (cdl, nlines) +void \fBcdl_getContrast\fR (cdl, contrast) +void \fBcdl_getName\fR (cdl, imname) +void \fBcdl_getTitle\fR (cdl, imtitle) + +int \fBcdl_mapFrame\fR (cdl, frame) +int \fBcdl_markCoordsFile\fR (cdl, fname, type, size, color, label) +int \fBcdl_markPoint\fR (cdl, x, y, number, size, type, color) +int \fBcdl_markPointLabel\fR (cdl, x, y, label, size, type, color) +int \fBcdl_markLine\fR (cdl, xs, ys, xe, ye, color) +int \fBcdl_markBox\fR (cdl, lx, ly, ux, uy, fill, color) +int \fBcdl_markPolygon\fR (cdl, xarray, yarray, npts, fill, color) +int \fBcdl_markPolyline\fR (cdl, xarray, yarray, npts, color) +int \fBcdl_markCircle\fR (cdl, x, y, radius, fill, color) +int \fBcdl_markCircAnnuli\fR (cdl, x, y, radius, nannuli, sep, color) +int \fBcdl_markEllipse\fR (cdl, x, y, xrad, yrad, rotang, fill, color) +int \fBcdl_markEllipAnnuli\fR (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) +int \fBcdl_markText\fR (cdl, x, y, str, size, angle, color) +int \fBcdl_setFont\fR (cdl, font) +int \fBcdl_setTextWidth\fR (cdl, width) +int \fBcdl_setLineWidth\fR (cdl, width) +int \fBcdl_setLineStyle\fR (cdl, style) +int \fBcdl_deleteMark\fR (cdl, x, y) +int \fBcdl_clearOverlay\fR (cdl) +int \fBcdl_redrawOverlay\fR (cdl) +.TE + +.bp +.NH +C Example Tasks +.LP + The examples shown here are for demonstration purposes only. They +are based on working example tasks in the CDL source \fIexamples\fR +subdirectory, see the programs there for the full program listing. + +.NH 2 +Display Example +.LP +.ps -2 +.vs -2 +.nf +\f(CW +#include +#include +#include "cdl.h" + +/* \fIDISPLAY -- Example task to display an image as a command-line task. + * This task is meant to show three ways the CDL can be used to display + * an image, see the code comments for a description of each method. + * + * Examples: + * To display a simple IRAF or FITS file: + * % ./display -frame 2 image.imh + * % ./display image.fits + * + * To display a FITS file as a raw image: + * % ./display -nx 512 -ny 512 -depth 16 -hskip 5760 -raw dpix.fits + * + * Usage: + * display [-depth N] [-fits] [-frame N] [-fbconfig N] [-hskip N] + * [-iraf] [-nozscale] [-nx N] [-ny N] [-raw] [-zscale] file\fP + */ + +#define NONE -1 +#define IRAF 0 +#define FITS 1 +#define RAW 2 + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname, title[128]; + int i, status = 0, frame = 1, fbconfig = 0, zscale = 1; + int format = NONE, nx = 0, ny = 0, depth = 8, hskip = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strcmp (argv[i], "-depth") == 0) depth = atoi (argv[++i]); + else if (strcmp (argv[i], "-fits") == 0) format = FITS; + else if (strcmp (argv[i], "-frame") == 0) frame = atoi (argv[++i]); + else if (strcmp (argv[i], "-fbconfig") == 0) fbconfig = atoi (argv[++i]); + else if (strcmp (argv[i], "-hskip") == 0) hskip = atoi (argv[++i]); + else if (strcmp (argv[i], "-iraf") == 0) format = IRAF; + else if (strcmp (argv[i], "-nozscale") == 0) zscale = 0; + else if (strcmp (argv[i], "-nx") == 0) nx = atoi (argv[++i]); + else if (strcmp (argv[i], "-ny") == 0) ny = atoi (argv[++i]); + else if (strcmp (argv[i], "-raw") == 0) format = RAW; + else if (strcmp (argv[i], "-zscale") == 0) zscale = 1; + } + } + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + fname = argv[argc-1]; + + /* \fIMETHOD 1: Displays the image using the high-level format display + * call. Display as an IRAF image if the option was set indicating + * this is the format, otherwise test the file to see if it is anyway.\fP + */ + if (format == IRAF || (format == NONE && \fBcdl_isIRAF\fP (fname))) { + status = \fBcdl_displayIRAF\fP (cdl, fname, 1, frame, FB_AUTO, zscale); + + /* \fIMETHOD 2: Uses the CDL procedure for getting image pixels from + * a known format, minimal work required to display an image. The + * point here is that you can use this method to process the image + * yourself prior to display, e.g. subsample the pixels, apply a user + * LUT, etc but still use the CDL to get the raw image and do the + * display.\fP + */ + } else if (format == FITS || (format == NONE && \fBcdl_isFITS\fP (fname))) { + + /* \fIGet the FITS image pixels, exit w/ an error status if something + * went wrong, the procedure will print what that was.\fP + */ + if (\fBcdl_readFITS\fP (fname, &pix, &nx, &ny, &depth, title)) { + \fBcdl_close\fP (cdl); /* \fIclose the package\fP */ + exit (1); /* \fIexit w/ error code\fP */ + } + + /* \fINow select a frame buffer large enough for the image. The + * fbconfig number is passed in the WCS packet, but the display + * call below will compute the correct WCS for the image and + * transmit that prior to display, all we're doing here is + * setting up the FB to be used.\fP + */ + if (fbconfig == 0) + \fBcdl_selectFB\fP (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 0); + + /* \fILastly, display the pixels to the requested frame, do any + * zscaling requested using the CDL procedure.\fP + */ + status = \fBcdl_displayPix\fP (cdl, pix, nx, ny, depth, frame, + fbconfig, zscale); + + /* \fIMETHOD 3: Displays an image of raw pixels. The client code is + * responsible for reading the image and calling all the procedures + * needed for image display, initialize the frame, zscaling pix, etc. + * While we assume a simple raster format in this program, the user + * code can read a compressed image format such as GIF, mosaic multiple + * images for display as a single image, or just about anything that + * produces a raster for display. The intent here is to show all the + * lowest level calls needed for displaying the image.\fP + */ + } else if (format == RAW) { + FILE *fd; + int lx, ly; + + if (nx == 0 || ny == 0) { + fprintf (stderr, "No size given for raw data.\\n"); + exit (1); + } + + /* \fIOpen the image file if we can.\fP */ + if (fd = fopen (fname, "r")) { + + /* \fISeek to the offset specified.\fP */ + lseek (fileno(fd), (off_t) hskip, SEEK_SET); + + /* \fIAllocate the pixel pointer and read the data.\fP */ + pix = (unsigned char *) malloc (nx * ny * (depth / 8)); + fread (pix, depth/8, nx * ny, fd); + + /* \fIIf we're zscaling and depth is more than 8-bits, do that.\fP */ + if (zscale && depth > 8) { + \fBcdl_computeZscale\fP (cdl, pix, nx, ny, depth, &z1, &z2); + \fBcdl_zscaleImage\fP (cdl, &pix, nx, ny, depth, z1, z2); + } + + /* \fINow select a frame buffer large enough for the image. + * We'll ask that this be reset but the change won't go to + * the server until we send in the WCS below.\fP + */ + \fBcdl_selectFB\fP (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 1); + + /* \fICompute the image placement so it's centered in the frame, + * but note the cdl_writeSubRaster() routine can place an + * arbitrary raster anywhere in the frame buffer.\fP + lx = (fb_w / 2) - (nx / 2); + ly = fb_h - ((fb_h / 2) + (ny / 2)); + + /* \fISet the mapping we'll send with the WCS which must be + * called before the cdl_setWCS() call since the data is sent + * with the WCS and not as a separate call.\fP + * + * \fRFirst we must compose a node!path prefix for the image.\fP */ + */ + gethostname (node, 512); + (void) getcwd (path, 512); + if (*fname == '/') + (void) sprintf (path_prefix, "%s!%s", node, fname); + else + (void) sprintf (path_prefix, "%s!%s/%s", node, path, fname); + + \fBcdl_setMapping\fP (cdl, "image", 0., 0., nx, ny, lx, ly, nx, ny, + path_prefix); + + /* \fIFor the WCS we assume a simple linear transform where the + * image is Y-flipped, the (x,y) translation is computed so + * it is correct for an frame buffer >= than the image size.\fP + */ + \fBcdl_setWCS\fP (cdl, fname, "", 1., 0., 0., -1., + (float) (nx / 2) - (fb_w / 2) + 1, /* \fIX trans.\fP */ + (float) (fb_h / 2) + (ny / 2), /* \fIY trans.\fP */ + z1, z2, CDL_LINEAR); /* \fIZ transform\fP */ + + /* \fIFinally, display the pixels.\fP */ + if (\fBcdl_writeSubRaster\fR (cdl, lx, ly, nx, ny, pix)) + status = 1; + } else + status = 1; + } else { + if (access (fname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\\n", fname); + else + fprintf (stderr, "'%s': image does not exist.\\n", fname); + status = 1; + } + + /* \fINow just free the pixel pointer to clean up.\fP */ + if (pix) + free ((unsigned char *) pix); + \fBcdl_close\fP (cdl); /* \fIclose the package\fP */ + exit (status); +} +\fR +.fi +.vs +2 +.ps +2 +.bp +.NH 2 +Interactive Graphics Overlay Example +.LP +.ps -2 +.vs -2 +.nf +\f(CW +#include +#include +#include +#include "cdl.h" + +/* \fI + * TVMARK -- Example task for displaying an marking images. This program + * can be used to either display an image and overlay points defined in + * a coordinate file, map an existing display frame for marking, or option- + * ally enter a cursor command loop after either of these providing other + * marking capability. All options support minimum match. + * + * Examples: + * % tvmark dpix.fits + * % tvmark -coords coords -color 205 dpix.fits + * % tvmark -frame 2 + * % tvmark -coords coords -interactive dpix.fits + * + * Usage: + * tvmark [-frame N] [-fbconfig N] [-coords ] [-size N] [-color N] + * [-nolabel] [-fill] [-interactive] [image]\fP + */ + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL, *cfname = NULL; + int i, status = 0, fill = 0, frame = 1, fb = FB_AUTO, zscale = 1; + int color = 201, label = 1, size = 9, interactive = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp(argv[i], "-color",4) == 0) color = atoi (argv[++i]); + else if (strncmp(argv[i], "-coords",4) == 0) cfname = argv[++i]; + else if (strncmp(argv[i], "-fbconfig",3) == 0) fb = atoi (argv[++i]); + else if (strncmp(argv[i], "-fill",4) == 0) fill = 1; + else if (strncmp(argv[i], "-frame",3) == 0) frame = atoi (argv[++i]); + else if (strncmp(argv[i], "-interactive",4) == 0) interactive = 1; + else if (strncmp(argv[i], "-nolabel",4) == 0) label = 0; + else if (strncmp(argv[i], "-nozscale",4) == 0) zscale = 0; + else if (strncmp(argv[i], "-size",2) == 0) size = atoi (argv[++i]); + else + fname = argv[i]; + } + } + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* \fIIf an image was specified display it first, otherwise assume the + * image has already been loaded in the frame and mark that.\fP + */ + if (fname) { + if (\fBcdl_isIRAF\fP (fname)) + status = \fBcdl_displayIRAF\fP (cdl, fname, 1, frame, fb, zscale); + else if (\fBcdl_isFITS\fP (fname)) + status = \fBcdl_displayFITS\fP (cdl, fname, frame, fb, zscale); + else { + if (access (cfname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\\n", fname); + else + fprintf (stderr, "'%s': image doesn't exist.\\n", fname); + status = 1; + } + if (status) goto err_; + } else { + + /* \fIIf we've requested a special frame buffer, set it now.\fP */ + if (fb > 0) + \fBcdl_setFBConfig\fP (cdl, fb); + + /* \fIMap the current display frame for use as an image.\fP */ + \fBcdl_mapFrame\fP (cdl, frame); + } + + /* \fIIf a coordinate file was specified read the file and mark those + * coords with points.\fP + */ + if (cfname) + \fBcdl_markCoordsFile\fP (cdl, cfname, M_STAR, size, color, label); + + /* \fILastly, start up an interactive cursor loop if needed.\fP */ + if (interactive) + tvmInteractive (cdl, label, fill, color, size); + + /* \fIClose the package and clean up.\fP */ +err_: \fBcdl_close\fP (cdl); + exit (status); +} + +/* \fITVMINTERACTIVE -- Process commands interactively.\fP */ + +tvmInteractive (cdl, label, fill, color, size) +CDLPtr cdl; +int label, fill, color, size; +{ + float angle = 0.0, rx, ry, txsize = 1.; + int nx, ny, i, x, y, x2, y2, wcs; + int number=1, radius=11, xrad=11, yrad=6, nannuli=3, sep=5; + char key, cmd[SZ_NAME], str[SZ_NAME]; + unsigned char *pix; + + /* \fIProcess commands until a 'q' keystroke is hit.\fP */ + while (\fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key) != 'q') { + x = (int) (rx + 0.5); /* \fIconvert to int pixels\fP */ + y = (int) (ry + 0.5); + + switch (key) { + case ':': /* \fIprocess a colon command\fP */ + putchar (':'); + gets (str); + for (i=0; str[i] != ' ' && str[i]; i++) + cmd[i] = str[i]; + cmd[i++] = '\0'; + + if (strcmp (cmd, "angle") == 0) angle = atof (&str[i]); + else if (strcmp (cmd, "color") == 0) color = atoi (&str[i]); + else if (strcmp (cmd, "fill") == 0) fill = atoi (&str[i]); + else if (strcmp (cmd, "number") == 0) number = atoi (&str[i]); + else if (strcmp (cmd, "nannuli") == 0) nannuli = atoi (&str[i]); + else if (strcmp (cmd, "label") == 0) label = atoi (&str[i]); + else if (strcmp (cmd, "sep") == 0) sep = atoi (&str[i]); + else if (strcmp (cmd, "size") == 0) size = atoi (&str[i]); + else if (strcmp (cmd, "txsize") == 0) txsize = atof (&str[i]); + else if (strcmp (cmd, "xrad") == 0) xrad = atoi (&str[i]); + else if (strcmp (cmd, "yrad") == 0) yrad = atoi (&str[i]); + else if (strcmp (cmd, "print") == 0) { + \fBcdl_readFrameBuffer\fP (cdl, &pix, &nx, &ny); + \fBcdl_printPix\fP (cdl, NULL, pix, nx, ny, 1); + } else if (strcmp (cmd, "snap") == 0) { + \fBcdl_readFrameBuffer\fP (cdl, &pix, &nx, &ny); + \fBcdl_printPixToFile\fP (cdl, &str[i], pix, nx, ny, 1); + } else if (strcmp (cmd, "status") == 0) { + printf ("angle = %-5.3g\tcolor = %d\t", angle, color); + printf ("fill = %-5d\tnumber = %d\\n", fill, number); + printf ("nannuli = %-5d\tsep = %d\t", nannuli, sep); + printf ("size = %-5d\ttxsize = %g\\n", size, txsize); + printf ("xrad = %-5d\tyrad = %d\t", xrad, yrad); + printf ("label = %-5d\\n", label); + } + break; + + case '?': + /* ......\fIhelp procedures\fP */ + break; + + case 'p': /* \fIplus mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_PLUS, color); + break; + case 'x': /* \fIcross mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_CROSS, color); + break; + case '.': /* \fIpoint mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_POINT, color); + break; + case '*': /* \fIstar mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_STAR, color); + break; + case '_': /* \fIhoriz dash mark\fP*/ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_HBLINE, color); + break; + case '|': /* \fIvert dash mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_VBLINE, color); + break; + case 'o': /* \fIcircle mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_CIRCLE|fill, color); + break; + case 's': /* \fIsquare mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_BOX|fill, color); + break; + case 'v': /* \fIdiamond mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_DIAMOND|fill, color); + break; + + case 'b': /* \fIBox\fP */ + printf ("Hit another key to define the box...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + \fBcdl_markBox\fP (cdl, x, y, x2, y2, fill, color); + break; + case 'c': /* \fICircle\fP */ + printf ("Hit another key to set radius ...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + radius = (int) sqrt ((double) ((x2-x)*(x2-x) + (y2-y)*(y2-y))); + \fBcdl_markCircle\fP (cdl, x, y, radius, fill, color); + break; + case 'd': /* \fIDelete marker\fP */ + \fBcdl_deleteMark\fP (cdl, x, y); + break; + case 'e': /* \fIEllipse\fP */ + \fBcdl_markEllipse\fP (cdl, x, y, xrad, yrad, angle, fill, color); + break; + case 'l': /* \fILine\fP */ + printf ("Hit another key to set line endpoint...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + \fBcdl_markLine\fP (cdl, x, y, x2, y2, color); + break; + case 't': /* \fIText string\fP */ + printf ("Text string: "); + gets (str); + \fBcdl_markText\fP (cdl, x, y, str, txsize, angle, color); + break; + case 'C': /* \fICircular annuli\fP*/ + \fBcdl_markCircAnnuli\fP (cdl, x, y, radius, nannuli, sep, color); + break; + case 'D': /* \fIDelete all markers\fP*/ + \fBcdl_clearOverlay\fP (cdl); + break; + case 'E': /* \fIElliptical annuli\fP*/ + \fBcdl_markEllipAnnuli\fP (cdl, x, y, xrad, yrad, angle, nannuli, sep, color); + break; + default: + break; + } + } +} +\fR +.fi +.vs +2 +.ps +2 +.bp +.NH 2 +Image Mosaic Example +.LP +.in 0.5i +.ps -2 +.vs -2 +.nf +#include +#include +#\fBinclude "cdl.h"\fP + +/* \fIMOSAIC -- Example task to mosaic several images on a display. Demonstrates + * usage of low-level routines for complex display operations.\fP + */ + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL, title[128]; + int i, j, k, status=0, label=0, frame=1, fb=FB_AUTO, zscale=1; + int sample=1, pad=0, col=204, imx, imy, bitpix, nimages, nim; + int ii, xinit, rowx, rowy, nnx, nny, fb_w, fb_h, nf, mx, my, nx, ny; + float z1, z2; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp (argv[i], "-fbconfig",3) == 0) fb=atoi(argv[++i]); + else if (strncmp (argv[i],"-frame",3) == 0) frame=atoi(argv[++i]); + else if (strncmp (argv[i],"-color",3) == 0) col=atoi(argv[++i]); + else if (strncmp (argv[i],"-label",4) == 0) label=1; + else if (strncmp (argv[i],"-nozscale",4) == 0) zscale=0; + else if (strncmp (argv[i],"-nx",3) == 0) nx=atoi(argv[++i]); + else if (strncmp (argv[i],"-ny",3) == 0) ny=atoi(argv[++i]); + else if (strncmp (argv[i],"-pad",4) == 0) pad=atoi(argv[++i]); + else if (strncmp (argv[i],"-sample",4) == 0) sample=atoi(argv[++i]); + else + break; + } + } + nimages = argc - i; + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* \fIClear the frame to begin.\fP */ + (void) \fBcdl_clearFrame\fP (cdl); + + /* \fILoop over each of the images in the list.\fP */ + nim = rowx = rowy = nnx = nny = 0; + for (k=0; k < ny && nim < nimages; k++) { + rowy += nny + pad; + for (rowx = xinit, j=0; j < nx && nim < nimages; j++) { + + /* \fIGet the image name for display.\fP */ + fname = argv[i++]; + + /* \fIFigure out what kind of image it is and get the pixels.\fP */ + if (cdl_isIRAF (fname)) + status = \fBcdl_readIRAF\fP (fname, 1, &pix, &imx, &imy, &bitpix, title); + else if (cdl_isFITS (fname)) + status = \fBcdl_readFITS\fP (fname, &pix, &imx, &imy, &bitpix, title); + else { + fprintf(stderr, "'%s': unknown or nonexistant image.\\n", fname); + status = 1; + } + if (status) goto err_; + + /* \fICompute subsampled image size.\fP */ + if (sample > 1) + nnx = imx / sample, nny = imy / sample; + else + nnx = imx, nny = imy; + + /* \fIUnless we asked for a specific FB size find one large enough + * to handle the mosaic. We don't check to be sure what's + * returned is really large enough.\fP + */ + if (nim == 0 && fb == FB_AUTO) + \fBcdl_selectFB\fP (cdl, nx*nnx+(pad*(nx-1)), ny*nny+(pad*(ny-1)), &fb, &fb_w, &fb_h, &nf, 1); + else { + \fBcdl_setFBConfig\fP (cdl, fb); + \fBcdl_lookupFBSize\fP (cdl, fb, &fb_w, &fb_h, &nf); + } + + /* \fIDefine a WCS for the frame.\fP */ + \fBcdl_setWCS\fP (cdl, "image mosaic", title, 1., 0., 0., -1., 0., (float) ny*imy+(pad*(ny+1)), 1., 255., 1); + + /* \fIThe first time through figure out the placement so the + * entire mosaic is centered in the frame.\fP + */ + if (nim == 0) { + mx = (nx * nnx) + pad * (nx-1); + my = (ny * nny) + pad * (ny-1); + rowy = (fb_h - my) / 2; + xinit = rowx = (fb_w - mx) / 2; + } + + /* \fICompute the zscaled imaged pixels.\fP */ + if (zscale) { + \fBcdl_computeZscale\fP (cdl, pix, imx ,imy, bitpix, &z1, &z2); + \fBcdl_zscaleImage\fP (cdl, &pix, imx ,imy, bitpix, z1, z2); + } + + /* \fISubsample the image if requested.\fP */ + if (sample > 1) { + int l, m, n=0; + for (l=0; l < imy; l+=sample) + for (m=0; m < imx; m+=sample) + pix[n++] = pix[(l*imx)+m]; + } + + /* \fIWrite the image to the frame buffer.\fP */ + if (\fBcdl_writeSubRaster\fP (cdl, rowx, rowy, nnx, nny, pix)) goto err_; + + /* \fIDraw the image name as a label.\fP */ + if (label) \fBcdl_markText\fP (cdl, rowx+10, rowy+10, fname, 1., 0., col); + + nim++; rowx += nnx + pad; + } + } + + /* \fIClose the package and clean up.\fP */ +err_: \fBcdl_close\fP (cdl); + exit (status); +} +.fi +.vs +2 +.ps +2 +.in -0.5i + +.bp +.NH +Fortran Interface Summary +.LP +.in 0.5i +include "\fBcdlftn.inc\fR" +.in -0.5i + +.TS +center; +r l. +\fBcfopen\fR (imtdev, ier) +\fBcfdisplayPix\fR (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +\fBcfreadCursor\fR (sample, x, y, key, ier) +\fBcfsetCursor\fR (x, y, wcs, ier) +\fBcfsetWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcfgetWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcfsetFrame\fR (frame) +\fBcfclearFrame\fR (ier) +\fBcfclose\fR () + +\fBcfsetMapping\fR (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) +\fBcfgetMapping\fR (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) +\fBcfqueryMap\fR (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier) + +\fBcfdisplayIRAF\fR (fname, band, frame, fbconfig, zscale, ier) +\fBcfisIRAF\fR (fname, isiraf) +\fBcfreadIRAF\fR (fname, band, pix, nx, ny, bitpix, title, ier) + +\fBcfdisplayFITS\fR (fname, frame, fbconfig, zscale, ier) +\fBcfisFITS\fR (fname, isfits) +\fBcfreadFITS\fR (fname, pix, nx, ny, bitpix, title, ier) + +\fBcfcomputeZscale\fR (pix, nx, ny, bitpix, z1, z2) +\fBcfzscaleImage\fR (pix, nx, ny, bitpix, z1, z2) + +\fBcfprintPix\fR (cmd, pix, nx, ny, annotate, ier) +\fBcfprintPixToFile\fR (fname, pix, nx, ny, annotate, ier) + +\fBcfreadImage\fR (pix, nx, ny, ier) +\fBcfreadFrameBuffer\fR (pix, nx, ny, ier) +\fBcfreadSubRaster\fR (lx, ly, nx, ny, pix, ier) +\fBcfwriteSubRaster\fR (lx, ly, nx, ny, pix, ier) + +\fBcfselectFB\fR (nx, ny, fb, w, h, nf, reset) +\fBcfsetFBConfig\fR (configno) +\fBcfgetFBConfig\fR (configno, w, h, nf) +\fBcflookupFBSize\fR (configno, w, h, nf) + +\fBcfsetZTrans\fR (ztrans) +\fBcfsetZScale\fR (z1, z2) +\fBcfsetSample\fR (nsample) +\fBcfsetSampleLines\fR (nlines) +\fBcfsetContrast\fR (contrast) +\fBcfsetName\fR (imname) +\fBcfsetTitle\fR (imtitle) + +\fBcfgetFrame\fR (frame) +\fBcfgetZTrans\fR (ztrans) +\fBcfgetZScale\fR (z1, z2) +\fBcfgetSample\fR (nsample) +\fBcfgetSampleLines\fR (nlines) +\fBcfgetContrast\fR (contrast) +\fBcfgetName\fR (imname) +\fBcfgetTitle\fR (imtitle) + +\fBcfmapFrame\fR (frame, ier) +\fBcfmarkPoint\fR (x, y, number, size, type, color, ier) +\fBcfmarkcoordsfile\fR (fname, type, size, color, label, ier) +\fBcfmarkPointLabel\fR (x, y, label, size, type, color, ier) +\fBcfmarkLine\fR (xs, ys, xe, ye, color, ier) +\fBcfmarkBox\fR (lx, ly, ux, uy, fill, color, ier) +\fBcfmarkPolygon\fR (xarray, yarray, npts, fill, color, ier) +\fBcfmarkPolyline\fR (xarray, yarray, npts, color, ier) +\fBcfmarkCircle\fR (x, y, radius, fill, color, ier) +\fBcfmarkCircAnnuli\fR (x, y, radius, nannuli, sep, color, ier) +\fBcfmarkEllipse\fR (x, y, xrad, yrad, rotang, fill, color, ier) +\fBcfmarkEllipAnnuli\fR (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +\fBcfmarkText\fR (x, y, str, size, angle, color, ier) +\fBcfsetfont\fR (font) +\fBcfsettextwidth\fR (width) +\fBcfsetlwidth\fR (width) +\fBcfsetlstyle\fR (style) +\fBcfdeleteMark\fR (x, y, ier) +\fBcfclearOverlay\fR (ier) +\fBcfredrawOverlay\fR (ier) +.TE +.bp +.NH +Fortran Example Tasks +.LP + The examples shown here are for demonstration purposes only. They +are based on working example tasks in the CDL source \fIexamples\fR +subdirectory, see the programs there for the full program listing. + +.NH 2 +Display Example +.in 0.5i +.ps -2 +.vs -2 +.nf +\f(CW +C ======================================================================== +C FDISPLAY -- Example fortran program showing the use of the Client +C Display Library (CDL) Fortran interface for displaying images. +C ======================================================================== + + PROGRAM FDISPLAY + character*64 imname + +C \fIInitialize the CDL package\fP + call \fBcfopen\fP (0, ier) + if (ier .gt. 0) then + write (*,*) 'open: Error return from CDL' + goto 999 + endif + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C \fIIf we've got a FITS format image, go ahead and display it.\fP + call \fBcfisFITS\fP (imname, isfits) + if (isfits .gt. 0) then + call \fBcfdisplayFITS\fP (imname, iframe, ifb, 1, ier) + else +C \fIWe've got an IRAF format image, go ahead and display it.\fP + call \fBcfisIRAF\fP (imname, isiraf) + if (isiraf .gt. 0) then + call \fBcfdisplayIRAF\fP (imname, 1, iframe, ifb, 1, ier) + else +C \fIUnrecognized image, punt and exit.\fP + write (*,*) 'Unrecognized image format' + endif + endif + +C \fIClean up and exit.\fP +999 continue + call \fBcfclose\fP (ier) + end +\fR +.fi +.ps +2 +.vs +2 +.in -0.5i +.bp +.NH 2 +Interactive Graphics Overlay Example +.in 0.5i +.ps -2 +.vs -2 +.nf +\f(CW +C ========================================================================== +C FTVMARK -- Example fortran program showing the use of the Client +C Display Library (CDL) Fortran interface for doing graphics overlay. No +C checking of the error flag is done here for space considerations. +C ========================================================================== + + PROGRAM FTVMARK + include "\fBcdlftn.inc\fP" + character*64 imname + +C \fIInitialize the CDL package\fP + call \fBcfopen\fP (0, ier) + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C \fIIf we've got a FITS format image, go ahead and display it.\fP + call \fBcfisFITS\fP (imname, isfits) + if (isfits .gt. 0) then + call \fBcfdisplayFITS\fP (imname, iframe, ifb, 1, ier) + else +C \fIWe've got an IRAF format image, go ahead and display it.\fP + call \fBcfisIRAF\fP (imname, isiraf) + if (isiraf .gt. 0) then + call \fBcfdisplayIRAF\fP (imname, 1, iframe, ifb, 1, ier) + else +C \fINo valid image given, so map the current display for marking.\fP + call \fBcfmapFrame\fP (iframe) + endif + endif + +C \fINow that we've got an image displayed or mapped, enter a cursor loop to mark the image. \fP + call markInteractive () + +C \fIClean up and exit\fP +999 continue + call \fBcfclose\fP (ier) + end + +C \fIMARKINTERACTIVE -- Subroutine for processing the cursor loop.\fP + subroutine markInteractive () + include "\fBcdlftn.inc\fP" + real angle, rx, ry, txsize + integer nx, ny, x, y, x2, y2, fill, size, color + integer number, radius, xrad, yrad, nannuli, sep + character key + character*64 cmd, str + +C \fIAllocate a 1024x1024 array for pixels. \fP + character pix(1048576) + +C \fI....Initialize the local parameters to use\fP + +C \fIRead a cursor keystroke telling us what to do.\fP +10 call \fBcfreadCursor\fP (0, rx, ry, key, ier) + +C \fIRound the real cursor position to integer pixel positions.\fP + x = nint (rx + 0.5) + y = nint (ry + 0.5) + +C \fICheck the keystroke and take the appropriate action.\fP +C \fIColon Commands\fP + if (key .eq. ':') then +C \fIRead a three character command and value field and process the colon command\fP + read (*,'(A3, i4)') cmd, ival + if (cmd(1:3) .eq. 'ang') then + angle = real (ival) + else if (cmd(1:3) .eq. 'col') then + color = ival + else if (cmd(1:3) .eq. 'fil') then + fill = ival +\fI : + ....and so on to set local variables + :\fR + else if (cmd(1:3) .eq. 'pri') then +C \fIPrint contents of the current frame buffer\fP + call \fBcfreadFrameBuffer\fP (pix, nx, ny, ier) + call \fBcfprintPix\fP ("lpr", pix, nx, ny, 1, ier) + else if (cmd(1:3) .eq. 'sta') then + \fI....print out the status (value) of variables\fP + endif + +C \fIPoint Markers\fP + else if (key .eq. 'p') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_PLUS, color, ier) + else if (key .eq. 'x') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_CROSS, color, ier) + else if (key .eq. '_') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_HBLINE, color, ier) + else if (key .eq. 'o') then +C \fIExample of a filled point marker \fP + call \fBcfmarkPoint\fP (x, y, 1, size, or(M_CIRCLE,fill), color, ier) +\fI : + ....and so on to set other types of point markers\fR + +C \fIOther Markers\fP + else if (key .eq. 'b') then + print '("Hit another key to define the box ....")' + call \fBcfreadCursor\fP (0, rx, ry, key, ier) + x2 = nint (rx + 0.5) + y2 = nint (ry + 0.5) + call \fBcfmarkBox\fP (x, y, x2, y2, fill, color, ier) + else if (key .eq. 'd') then + call \fBcfdeleteMark\fP (x, y, ier) + else if (key .eq. 'e') then + call \fBcfmarkEllipse\fP (x, y, xrad, yrad, angle, fill, color, ier) + else if (key .eq. 't') then + print '("Text string: ", $)' + read (*,'(A64)') str + call \fBcfmarkText\fP (x, y, str, txsize, angle, color, ier) +\fI : + ....and so on to set other types of markers\fR + +C \fIQuit\fP + else if (key .eq. 'q') then + goto 998 + endif + +C \fILoop back until we want to quit\fP + goto 10 +998 continue + end +\fR +.fi +.ps +2 +.vs +2 +.in -0.5i +.bp +.NH +SPP Interface Summary +.LP +.in 0.5i +#include "\fBcdlspp.h\fR" +.in -0.5i + +.TS +center; +r l. +\fBcdl_open\fR (imtdev, ier) +\fBcdl_displayPix\fR (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +\fBcdl_readCursor\fR (sample, x, y, wcs, key, ier) +\fBcdl_setCursor\fR (x, y, wcs, ier) +\fBcdl_setWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcdl_getWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcdl_setFrame\fR (frame) +\fBcdl_clearFrame\fR (ier) +\fBcdl_close\fR () + +\fBcdl_setMapping\fR (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) +\fBcdl_getMapping\fR (region, sx,sy,snx,sny, dx,dy,dnx,dny, ref, ier) +\fBcdl_queryMap\fR (wcs, region, sx,sy,snx,sny, dx,dy,dnx,dny, objref, ier) + +\fBcdl_displayIRAF\fR (fname, band, frame, fbconfig, zscale, ier) +\fBcdl_isIRAF\fR (fname, isiraf) +\fBcdl_readIRAF\fR (fname, band, pix, nx, ny, bitpix, title, ier) + +\fBcdl_displayFITS\fR (fname, frame, fbconfig, zscale, ier) +\fBcdl_isFITS\fR (fname, isfits) +\fBcdl_readFITS\fR (fname, pix, nx, ny, bitpix, title, ier) + +\fBcdl_computeZscale\fR (pix, nx, ny, bitpix, z1, z2) +\fBcdl_zscaleImage\fR (pix, nx, ny, bitpix, z1, z2) + +\fBcdl_printPix\fR (cmd, pix, nx, ny, annotate, ier) +\fBcdl_printPixToFile\fR (fname, pix, nx, ny, annotate, ier) + +\fBcdl_readImage\fR (pix, nx, ny, ier) +\fBcdl_readFrameBuffer\fR (pix, nx, ny, ier) +\fBcdl_readSubRaster\fR (lx, ly, nx, ny, pix, ier) +\fBcdl_writeSubRaster\fR (lx, ly, nx, ny, pix, ier) + +\fBcdl_selectFB\fR (nx, ny, fb, w, h, nf, reset) +\fBcdl_setFBConfig\fR (configno) +\fBcdl_getFBConfig\fR (configno, w, h, nf) +\fBcdl_lookupFBSize\fR (configno, w, h, nf) + +\fBcdl_setZTrans\fR (ztrans) +\fBcdl_setZScale\fR (z1, z2) +\fBcdl_setSample\fR (nsample) +\fBcdl_setSampleLines\fR (nlines) +\fBcdl_setContrast\fR (contrast) +\fBcdl_setName\fR (imname) +\fBcdl_setTitle\fR (imtitle) + +\fBcdl_getFrame\fR (frame) +\fBcdl_getZTrans\fR (ztrans) +\fBcdl_getZScale\fR (z1, z2) +\fBcdl_getSample\fR (nsample) +\fBcdl_getSampleLines\fR (nlines) +\fBcdl_getContrast\fR (contrast) +\fBcdl_getName\fR (imname) +\fBcdl_getTitle\fR (imtitle) + +\fBcdl_mapFrame\fR (frame, ier) +\fBcdl_markCoordsFile\fR (fname, type, size, color, label, ier) +\fBcdl_markPoint\fR (x, y, number, size, type, color, ier) +\fBcdl_markPointLabel\fR (x, y, label, size, type, color, ier) +\fBcdl_markLine\fR (xs, ys, xe, ye, color, ier) +\fBcdl_markBox\fR (lx, ly, ux, uy, fill, color, ier) +\fBcdl_markPolygon\fR (xarray, yarray, npts, fill, color, ier) +\fBcdl_markPolyline\fR (xarray, yarray, npts, color, ier) +\fBcdl_markCircle\fR (x, y, radius, fill, color, ier) +\fBcdl_markCircAnnuli\fR (x, y, radius, nannuli, sep, color, ier) +\fBcdl_markEllipse\fR (x, y, xrad, yrad, rotang, fill, color, ier) +\fBcdl_markEllipAnnuli\fR (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +\fBcdl_markText\fR (x, y, str, size, angle, color, ier) +\fBcdl_setFont\fR (font) +\fBcdl_setTextWidth\fR (width) +\fBcdl_setLineWidth\fR (width) +\fBcdl_setLineStyle\fR (style) +\fBcdl_deleteMark\fR (x, y, ier) +\fBcdl_clearOverlay\fR (ier) +\fBcdl_redrawOverlay\fR (ier) +\fBcdl_setDebug\fR (level) +.TE diff --git a/vendor/x11iraf/cdl/doc/cdlref.ms-V1.0 b/vendor/x11iraf/cdl/doc/cdlref.ms-V1.0 new file mode 100644 index 00000000..52f4fafa --- /dev/null +++ b/vendor/x11iraf/cdl/doc/cdlref.ms-V1.0 @@ -0,0 +1,2297 @@ +.RP +.de us +\\$1\l'|0\(ul' +.. +.TL +A Reference Guide for the IRAF Client Display Library (CDL) +.AU +Michael Fitzpatrick +.AI +NOAO/IRAF Group +.sp 0.5 +February 1997 +.sp 0.5 +\fIRevised September 1997\fR + +.AB +The Client Display Library (CDL) is a host interface for C or Fortran +programs allowing them to display images or overlay graphics to display +servers such as \fIXImtool\fR or \fISAOimage / SAOtng\fR. High-level +procedures allow IRAF or FITS images to be displayed simply, other +routines permit access to all other server functions (e.g. cursor and image +readback, frame selection, etc). The library also features a number of +functions for doing image overlay graphics; supported graphics primitives +include numerous point shapes, lines, circles, ellipses, polygons, annular +shapes, and text. +.AE + +.pn 1 +.bp +.ce +.ps +3 +\fBContents\fR +.ps -3 +.sp 2 +1.\h'|0.25i'\fBIntroduction\fP\l'|5.6i.'\0\01 +.sp 0.5 +2.\h'|0.25i'\fBGetting Started\fP\l'|5.6i.'\0\01 +.sp 0.5 +3.\h'|0.25i'\fBServer Connections\fP\l'|5.6i.'\0\02 +.br +\h'|0.25i'3.1.\h'|0.75i'Domain Sockets\l'|5.6i.'\0\02 +.br +\h'|0.25i'3.2.\h'|0.75i'Named FIFO Pipes\l'|5.6i.'\0\03 +.br +\h'|0.25i'3.3.\h'|0.75i'Inet Sockets\l'|5.6i.'\0\03 +.br +\h'|0.25i'3.4.\h'|0.75i'User-Defined Connections\l'|5.6i.'\0\03 +.sp 0.5 +4.\h'|0.25i'\fBImage Display\fP\l'|5.6i.'\0\03 +.br +\h'|0.25i'4.1.\h'|0.75i'Overview of the Display Process\l'|5.6i.'\0\03 +.br +\h'|0.25i'4.2.\h'|0.75i'Displaying IRAF Images\l'|5.6i.'\0\04 +.br +\h'|0.25i'4.3.\h'|0.75i'Displaying FITS Images\l'|5.6i.'\0\04 +.br +\h'|0.25i'4.4.\h'|0.75i'Displaying Raw Pixels\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.5.\h'|0.75i'Frame Selection\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.6.\h'|0.75i'Clearing the Display\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.7.\h'|0.75i'Frame Buffer Selection\l'|5.6i.'\0\05 +.br +\h'|0.5i'4.7.1.\h'|0.9i'Automatic Selection\l'|5.6i.'\0\06 +.br +\h'|0.5i'4.7.2.\h'|0.9i'The Frame Buffer Configuration File\l'|5.6i.'\0\06 +.br +\h'|0.25i'4.8.\h'|0.75i'Image WCS Description\l'|5.6i.'\0\06 +.br +\h'|0.25i'4.9.\h'|0.75i'Image Colormaps\l'|5.6i.'\0\07 +.br +\h'|0.5i'5.2.1.\h'|0.9i'Imtool Color Model\l'|5.6i.'\0\07 +.br +\h'|0.25i'4.10.\h'|0.75i'ZScale Intensity Mapping\l'|5.6i.'\0\08 +.br +\h'|0.25i'4.11.\h'|0.75i'Image Hardcopy\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.12.\h'|0.75i'Image Cursor\l'|5.6i.'\0\09 +.br +\h'|0.5i'4.13.1.\h'|0.9i'Cursor Sampling\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.14.\h'|0.75i'Image Readout\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.15.\h'|0.75i'Subraster I/O\l'|5.6i.'\0\09 +.sp 0.5 +5.\h'|0.25i'\fBGraphics Overlay\fP\l'|5.6i.'\010 +.br +\h'|0.25i'5.1.\h'|0.75i'Marker Coordinates\l'|5.6i.'\010 +.br +\h'|0.5i'5.1.1.\h'|0.9i'Mapping a Previously Displayed Image\l'|5.6i.'\010 +.br +\h'|0.25i'5.2.\h'|0.75i'Marker Colors\l'|5.6i.'\010 +.br +\h'|0.25i'5.3.\h'|0.75i'Marker Types\l'|5.6i.'\010 +.br +\h'|0.5i'5.3.1.\h'|0.9i'Point\l'|5.6i.'\011 +.br +\h'|0.5i'5.3.2.\h'|0.9i'Line\l'|5.6i.'\011 +.br +\h'|0.5i'5.3.3.\h'|0.9i'Box\l'|5.6i.'\011 +.br +\h'|0.5i'5.3.4.\h'|0.9i'Circle\l'|5.6i.'\011 +.br +\h'|0.5i'5.3.5.\h'|0.9i'Polyline\l'|5.6i.'\012 +.br +\h'|0.5i'5.3.6.\h'|0.9i'Polygon\l'|5.6i.'\012 +.br +\h'|0.5i'5.3.7.\h'|0.9i'Ellipse\l'|5.6i.'\012 +.br +\h'|0.5i'5.3.8.\h'|0.9i'Circular Annuli\l'|5.6i.'\012 +.br +\h'|0.5i'5.3.9.\h'|0.9i'Elliptical Annuli\l'|5.6i.'\012 +.br +\h'|0.5i'5.3.10.\h'|0.9i'Text\l'|5.6i.'\012 +.br +\h'|0.5i'5.4.\h'|0.9i'Text Fonts\l'|5.6i.'\013 +.br +\h'|0.5i'5.5.1.\h'|0.9i'In-line Font Changes\l'|5.6i.'\013 +.br +\h'|0.25i'5.5.\h'|0.75i'Deleting Markers\l'|5.6i.'\013 +.br +\h'|0.5i'5.5.1.\h'|0.9i'Individual Markers\l'|5.6i.'\013 +.br +\h'|0.5i'5.5.2.\h'|0.9i'The Entire Overlay\l'|5.6i.'\014 +.br +\h'|0.25i'5.6.\h'|0.75i'Redrawing the Overlay\l'|5.6i.'\014 +.sp 0.5 +6.\h'|0.25i'\fBFortran Language Binding Notes\fP\l'|5.6i.'\014 +.sp 0.5 +7.\h'|0.25i'\fBSPP Language Binding Notes\fP\l'|5.6i.'\014 +.sp 0.5 +8.\h'|0.25i'\fBIIS Protocol Description\fP\l'|5.6i.'\015 +.sp 0.5 +9.\h'|0.25i'\fBC Interface Summary\fP\l'|5.6i.'\017 +.sp 0.5 +10.\h'|0.25i'\fBC Example Tasks\fP\l'|5.6i.'\019 +.br +\h'|0.25i'10.1.\h'|0.75i'Display Example\l'|5.6i.'\019 +.br +\h'|0.25i'10.2.\h'|0.75i'Interactive Graphics Overlay Example\l'|5.6i.'\022 +.br +\h'|0.25i'10.3.\h'|0.75i'Image Mosaic Example\l'|5.6i.'\026 +.sp 0.5 +11.\h'|0.25i'\fBFortran Interface Summary\fP\l'|5.6i.'\028 +.sp 0.5 +12.\h'|0.25i'\fBFortran Example Tasks\fP\l'|5.6i.'\030 +.br +\h'|0.25i'12.1.\h'|0.75i'Display Example\l'|5.6i.'\030 +.br +\h'|0.25i'12.2.\h'|0.75i'Interactive Graphics Overlay Example\l'|5.6i.'\031 +.sp 0.5 +13.\h'|0.25i'\fBSPP Interface Summary\fP\l'|5.6i.'\033 +.pn 1 + +.NH +Introduction +.LP + For more than a decade IRAF has used a \fIdisplay server\fR as the +primary means for image display. IRAF client tasks connect to the server +and send or read data using a modification of the IIS Model 70 protocol, +originally through named fifo pipes but more recently using unix domain +or inet sockets. The advantage to this approach was that IRAF client tasks +could make use of the image display functionality without duplicating +the code needed for actually displaying the image. The longtime disadvantage +was that the IIS protocol used was arcane and undocumented and therefore +largely unavailable to applications outside of the IRAF project. The +Client Display Library (CDL) provides a public C and Fortran interface for +displaying images and overlay graphics that is independent of the underlying +protocol used. +.LP + Unlike the interface used by IRAF applications, the CDL is meant to +provide an easy-to-use, fully featured interface for applications that can +be easily evolved for future display servers, communications schemes, or +display functionality. Indeed, the CDL is independent of IRAF itself (as +are the display servers) so display tasks can be written for any discipline +or application. +.LP + While this guide assumes programs are written in C, Fortran programmers +should find the translation straightforward by referring to the Fortran +interface summary. The package source files include example tasks as does +this guide; users with problems, questions, or bug reports are encouraged to +contact \fIiraf@noao.edu\fR. A small code sample demonstrating the problem +would be very helpful in finding a solution to any reported problems. + +.NH +Getting Started +.LP + All C programs must include the header file \fB"cdl.h"\fR in order +to get package definitions for constants such as colors and structure +definitions used. The Fortran interface does not \fIrequire\fR anything +similar, however for fortran compilers which support an \f(CWinclude\fR +directive a \fBcdlftn.inc\fR file may be used to define symbolic constants +passed to procedures, this file must be included by each procedure using the +CDL. Fortran programs not using this file must pass in the constants +explicitly, needed values are found throughout this manual. C procedures +which return an integer value will return a positive number to indicate an +error has occured and print an error message, otherwise zero is returned. +.LP + The \fBcdl_open()\fR procedure is used to establish a connection +to the server and initialize the package, it returns a CDL structure pointer +that is passed to other CDL procedures. For C programs this means +a separate pointer may be maintained for each server connection, the Fortran +interface is limited to only one server connection per process since the +pointer is maintained internally. The connection is terminated using the +\fBcdl_close()\fR procedure. Between these two calls may be any combination +of CDL procedure calls for doing image display or overlay graphics. +.LP + For example, the simplest possible program for displaying an IRAF +image would look something like: +.sp 0.5 +.nf + \f(CW#include "cdl.h" + + main (int argc, char *argv[]) + { + CDLPtr cdl = cdl_open ((char *)0); + cdl_displayIRAF (cdl, argv[1], 1, 1, 1, 1); + cdl_close (cdl); + }\fR +.fi +.sp 0.5 +.LP +This program displays band one of an image named on the command line to the +server in frame one using the default 512x512 frame buffer, zscaling the +pixels to 8-bit values automatically. No error checking is performed to verify +that a connection was established or that the argument is a valid IRAF image. +Most programs will be more complex than this but it should be clear that +image display from client applications is a now trivial operation. + +.us "Synopsis" +.sp 0.5 +.nf + \f(CW#include "cdl.h"\fR + + \f(CWCDLPtr cdl_open (char *imtdev)\fR + \f(CWvoid cdl_close (CDLPtr cdl)\fR +.fi + +.NH +Server Connections +.LP + The \fBcdl_open()\fR procedure takes a single argument specifying the +type of connection to make to the server, this routine also initializes +the CDL package. If this is a NULL pointer the CDL will attempt to first +connect on a unix domain socket, if that fails the standard IRAF /dev/imt1* +fifo pipes are tried. The syntax for the \fIimtdev\fR argument is as follows: +.sp 0.5 + \f(CW :
\fR +.sp 0.5 +.LP +where is one of "\fBinet\fR" (internet tcp/ip socket), "\fBunix\fR" +(unix domain socket) or "\fBfifo\fR" (named pipe). The form of the address +depends upon the domain, as illustrated in the examples below. The address +field may contain up to two "%d" fields. If present, the user's UID will be +substituted (e.g. "unix:/tmp/.IMT%d"). The default connection if no imtdev +is specified is "unix:/tmp/.IMT%d", failing that a connection is attempted +on the /dev/imt1[io] named fifo pipes. +.NH 2 +Domain Sockets +.LP + Domain sockets are sockets created on the local host. The connection +is usually faster than an inet socket and comparable to a fifo. If the +socket name is specified with a '%d' field the client can be assured of a +unique socket name for each user allowing multiple clients to be run on the +same host by different users. +.LP +.us "Example" +.sp 0.5 +.nf +\f(CW + /* Connection to a local host using socket domain socket. */ + if ((cdl = cdl_open ("unix:/tmp/.IMT%d")) == NULL) { + fprintf (stderr, "cannot open domain socket connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +Named FIFO Pipes +.LP + This is the traditional approach, and the only one supported by +SAOimage (although recent versions contain support for sockets). Any named +fifo pipe may be used, the syntax for the \fIimtdev\fR string in this case is +.sp 0.5 + \fBfifo:\f(CW\fB:\f(CW\fR +.sp 0.5 +.LP +.us "Example" +.sp 0.5 +.nf + \f(CW/* Connection to a local host using named fifo pipes. */ + if ((cdl = cdl_open ("fifo:/dev/imt1i:/dev/imt1o")) == NULL) { + fprintf (stderr, "cannot open fifo pipe connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +Inet Sockets +.LP + Inet sockets are connections between hosts via a tcp/ip socket. +This permits connecting to the server over a remote network connection +anywhere on the Internet. +.LP +.us "Example" +.sp 0.5 +.nf + \f(CW/* Connection to a local host using socket 5137. */ + if ((cdl = cdl_open ("inet:5137")) == NULL) { + fprintf (stderr, "cannot open inet socket connection\\n"); + exit (1); + } + + /* Connection to a remote internet host using socket 5137. */ + if ((cdl = cdl_open ("inet:5137:foo.bar.edu")) == NULL) { + fprintf (stderr, "cannot open inet socket connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +User-Defined Connections +.LP + Since IRAF V2.10.3 client tasks have been able to use an \fBIMTDEV\fR +unix environment variable to set the connection type, the syntax of this +variable is the same as described above. If the \fIcdl_open()\fR procedure +is called with a NULL pointer the IMTDEV environment variable will +automatically be checked. To explicitly use this variable in the client +task the \fIcdl_open()\fR procedure may be called as +e.g. +.sp 0.5 +.nf + \f(CWif ((cdl = cdl_open (getenv("IMTDEV"))) == NULL) { + fprintf (stderr, "cannot open server connection\\n"); + exit (1); + }\fR +.fi +.NH +Image Display +.NH 2 +Overview of the Display Process +.LP + Basic image display is done most easily using the high-level +\fBcdl_displayIRAF()\fR, \fBcdl_displayFITS()\fR and \fBcdl_displayPix()\fR +procedures. These routines automaticaly define an image WCS, clear the +frame, set the frame buffer and center the image in the display. For most +applications these are all that will be needed, but the +\fBcdl_writeSubRaster()\fR procedure can also be used to display an image. +For example, to display one image in a mosaic or other cases where +the task needs low-level access to position the image or write raw pixel +values. +.LP + In these cases it is the responsibility of the client program to +prepare the server for display. The basic steps involed in displaying an +image include +.sp 0.5 +.TS +center; +lB lB +- - +l lI. +Operation CDL Procedure +Selecting the frame cdl_setFrame() +Clear the frame cdl_clearFrame() +Select the frame buffer configuration cdl_selectFB() +Set the frame buffer configuration cdl_setFBConfig() +Scale the image pixels to 201 display values cdl_zscaleImage() +Define the image WCS +Set the image WCS cdl_setWCS() +Compute the raster placement in the frame buffer +Write the pixels to the display cdl_writeSubRaster() +.TE +.sp 0.5 +In cases like a mosaic display obviously clearing the frame will only need +to be done once and a single WCS for the mosaic should be defined. For +simple display the high-level routines handle all of these steps for you, they +are included here as checklist of what must be considered when using the CDL +for low-level display. +.NH 2 +Displaying IRAF Images +.LP + The \fBcdl_displayIRAF()\fR procedure can be used to display an IRAF +OIF format image (i.e. images with a \fI.imh\fR extension) by simply +passing in the image name. Pixel files for the +image must be accessible from the local machine but can be in any directory, +the HDR$ syntax for the imdir is also recognized. Images may be three +dimensional, the +\fIband\fR argument is used to select the image band to be displayed. +The \fIframe\fR and \fIfbconfig\fR arguments select the frame and frame buffer +size respectively, if the \fIzscale\fR flag is greater than zero the image +will automatically be converted to 8-bit values using the zscale mapping +algorithm. The function returns a positive value if the image cannot +be accessed or displayed for any reason, an error message will be printed. +.LP + The \fIcdl_isIRAF()\fR procedure returns a positive value if the +filename argument is recognized as an IRAF image, it does not check whether +the pixel file can be successfully accessed. For simply reading the pixels +from an IRAF image the \fBcdl_readIRAF()\fR procedure may be used. The +function returns a zero value and sets the output pixel array, image +dimensions and pixel size if successful, otherwise the function returns a +positive value. Note that +the output pixel values may need to be scaled before they can be displayed. + +.us "Synopsis" +.nf + \f(CWint cdl_displayIRAF (CDLPtr cdl, char *fname, int band, + int frame, int fbconfig, int zscale)\fR + \f(CWint cdl_isIRAF (char *fname)\fR + \f(CWint cdl_readIRAF (char *fname, int band, uchar **pix, + int *nx, int *ny, int *bitpix)\fR +.fi +.NH 2 +Displaying FITS Images +.LP + The \fBcdl_displayFITS()\fR procedure can be used to display a +\fIsimple\fR FITS image by name. A "simple" FITS file is assumed to be +one containing a single image and having no extensions. Other types of +FITS files may of course be displayed but the client will have to use other +means to import the pixels. FITS image extensions may be supported in a future +release of the CDL. The \fIframe\fR and \fIfbconfig\fR +arguments select the frame and frame buffer size respectively, if the +\fIzscale\fR flag is greater than zero the image will automatically be +converted to 8-bit values using the zscale mapping algorithm. The function +returns a positive value if the image cannot be accessed or displayed for +any reason, an error message will be printed. +.LP + The \fIcdl_isFITS()\fR procedure returns a positive value if the +filename argument is recognized as a simple FITS image. For simply reading +the image pixels the \fBcdl_readFITS()\fR procedure may be used. The +output pixel array, image dimensions and pixel size are returned if +successful otherwise the function returns a positive value. Note that +the returned pixel values may need to be scaled before they can be displayed. + +.us "Synopsis" +.nf + \f(CWint cdl_displayFITS (CDLPtr cdl, char *fname, int frame, + int fbconfig, int zscale)\fR + \f(CWint cdl_isFITS (char *fname)\fR + \f(CWint cdl_readFITS (char *fname, uchar **pix, int *nx, int *ny, + int *bitpix)\fR +.fi +.NH 2 +Displaying Raw Pixels +.LP + The \fBcdl_displayPix()\fR procedure can be used to display an +arbitrary array of pixels of any size. The \fInx\fR and \fIny\fR arguments +are the raster dimensions, and \fIbitpix\fR is the pixel size and has the +same meaning as the FITS BITPIX keyword. The \fIframe\fR and \fIfbconfig\fR +arguments select the frame and frame buffer size respectively, if the +\fIzscale\fR flag is greater than zero the image will automatically be +converted to 8-bit values using the zscale mapping algorithm. + +.us "Synopsis" +.nf + \f(CWint cdl_displayPix (CDLPtr cdl, uchar *pix, int nx, int ny, + int bitpix, int frame, int fbconfig, int zscale)\fR +.fi +.NH 2 +Frame Selection +.LP + Frame selection is normally done as an argument to one of the display +procedures, however frames may be explicitly selected using the +\fBcdl_setFrame()\fR procedure. This allows client programs to essentially +"blink" frames independently, as long as the server supports multiple frames. + +.us "Synopsis" +.nf + \f(CWvoid cdl_getFrame (CDLPtr cdl, int frame)\fR +.fi +.NH 2 +Clearing the Display +.LP + The current display frame may be explicitly cleared using the +\fBcdl_clearFrame()\fR procedure. The frame is also cleared prior to +displaying new images by the procedures \fBcdl_displayPix()\fR, +\fBcdl_displayFITS()\fR, and \fBcdl_displayIRAF()\fR. + +.us "Synopsis" +.nf + \f(CWint cdl_clearFrame (CDLPtr cdl)\fR +.fi +.NH 2 +Frame Buffer Selection +.LP + The default frame buffer used is 512x512, other sizes may be +selected using the \fBcdl_setFBConfig()\fR procedure. To set the frame +buffer size the client passes the frame buffer number as defined in +the frame buffer configuration file (see below) while setting the image +WCS. It is important to note that the frame buffer isn't actually changed +in the server +until a subsequent \fBcdl_setWCS()\fR call, either directly or through +some other procedure which sets the WCS (e.g. one of the display procedures). +.LP + To get the size of the currently defined frame buffer the user +may call the \fBcdl_getFBConfig()\fR procedure. This returns not only +the current configuration number, but the size as well. To get the size +and any arbitrary configuration without actually setting it, the +\fBcdl_lookupFBSize()\fR procedure may be used. Any configuration not actually +defined in the frame buffer configuration file is returned as the default +512x512 size. + +.us "Synopsis" +.nf + \f(CWvoid cdl_setFBConfig (CDLPtr cdl, int configno)\fR + \f(CWvoid cdl_getFBConfig (CDLPtr cdl, int *configno, int *width, + int *height, int *nframes)\fR + \f(CWvoid cdl_lookupFBSize (CDLPtr cdl, int configno, int *width, + int *height, int *nframes)\fR +.fi +.NH 3 +Automatic Selection +.LP + The \fBcdl_selectFB()\fR procedure may be used to select the most +appropriate frame buffer to use for a given image size. If possible a frame +buffer the same size as the image will be used, otherwise one that is +larger will be chosen. Rather than simply selecting the first configuration +larger than the image, the procedure searches the entire configuration file +selecting the one with the least empty space in both dimensions. If the +\fIreset\fR flag is non-zero this frame is set automatically by the +procedure, otherwise the selected dimension is simply returned to the +calling program. In either case the new frame buffer will not take effect +until a new WCS is defined for the frame. + +.us "Synopsis" +.nf + \f(CWvoid cdl_selectFB (CDLPtr cdl, int nx, int ny, int *fb, + int *w, int *h, int *nf, int reset) +. +.NH 3 +The Frame Buffer Configuration File +.LP + The size of the frame buffer is not passed directly to the server +since this is not part of the communications protocol used. Instead, the +frame buffer number is sent as part of the WCS header packet. So that +both the server and client can know that a particular frame buffer number +corresponds to a specific size, a \fIframe buffer configuration file\fR +is used which both the client and server read. +.LP + The default configuration file is /usr/local/lib/imtoolrc, this can +be overridden by defining an \fBIMTOOLRC\fR environment variable naming +the file to be used, or by creating a .imtoolrc file in your home directory. +Since the server must also read the same file, this must be done before +starting both the client and server applications. +.LP +The format of the frame buffer configuration file is +.sp 0.5 + \fIconfigno nframes width height [extra fields]\fP +.sp 0.5 +e.g. +.sp 0.5 + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 4 frames, configuration numbers need not be sequential but should be +in ascending order. +.NH 2 +Image WCS Description +.LP + The image WCS is defined using the \fBcdl_setWCS()\fR procedure. The +WCS defines a mapping between any linear coordinate system and the image +pixels, for our purposes we will discuss how the WCS is used to map the frame +buffer pixels to image coordinates. It is passed to the server in a string +of the form: +.sp 0.5 + Image_Name_String\\n a b c d tx ty z1 z2 zt +.sp 0.2 +where: +.sp 0.2 + X' = a*X + c*Y + tx + Y' = b*X + d*Y + ty + +The terms \fIa, b, c\fR, and \fId\fR define a rotation of the WCS wrt the pixel +coordinates, the \fItx\fR and \fIty\fR values are translation terms. The +remaining three values define the intensity mapping of the display pixels; +\fIz1\fR is the minimum pixel value used in the transformation, \fIz2\fR is +the maximum value, and \fIzt\fR defines the type of transformation used (0 for +none, 1 for linear, 2 for log10). +.LP + The WCS may be set explicitly by the calling program or a default +appropriate for the image will be set automatically by the high-level +display procedures, otherwise a WCS for the +frame buffer is defined (i.e. returned coordinates are frame buffer coords). +As an example of how the WCS is defined, the default WCS for an image +IMX x IMY pixels in a frame buffer FBX x FBY pixels is defined as +.sp 0.5 +.nf +\f(CW a = 1.0; /* no rotation */ + b = 0.0; + c = 0.0; + d = -1.0; + tx = (IMX / 2) - (FBX / 2) + 1; /* center in FB */ + ty = (FBY / 2) + (IMY / 2); + z1 = z1; /* zscale values */ + z2 = z2; + zt = 1;\fR +.fi + +.us "Synopsis" +.nf + \f(CWint cdl_setWCS (CDLPtr cdl, char *name, char *title, + float a, float b, float c, float d, float tx, float ty, + float z1, float z2, int zt)\fR + \f(CWint cdl_getWCS (CDLPtr cdl, char *name, char *title, + float *a, float *b, float *c, float *d, float *tx, float *ty, + float *z1, float *z2, int *zt)\fR +.fi +.NH 2 +Image Colormaps +.LP + The IIS protocol used does not permit the downloading of user-defined +colormaps, all images are loaded as raw grayscale values according to the +XImtool colormap model used by currently supported servers. All images +containing private colormaps or more than the 201 grayscale values defined +by the Imtool colormap model must either convert the image to 8-bit +grayscale values by calling the CDL zscale procedures (\fBcdl_computeZscale()\fR +and \fBcdl_zscaleImage()\fR) or scale the images in client code with +user LUTs. The CDL zscale procedures scale image to 201 grayscale values +so that they are displayed to the full 8-bit range, user LUT +transformations or user code for converting to grayscale from a private +colormap procedures should do the same. +.NH 3 +Imtool Color Model +.LP + The IMTOOL color model defines at most 201 grayscale values for use in +displaying the image, a set of 16 static colors are also defined for overlay +graphics. Pixel values sent to the server should be already scaled to this +model, i.e. the image pixels should be scaled to the range 1-200, values +above this will either represent the overlay colors or will wrap around to +8-bit values. The CDL zscale procedures will automatically scale +arbitrary pixel values to use this color model, the overlay procedures +assume color values are defined for the static color range 201-217 but any +8-bit value may be used. +.LP + A summary of the color model values is included below: +.TS +center; +lB lB cB cB lB lB +l l c c l l. +Color Description Color Description +0 Background 208 Cyan +1 - 200 Image data 209 Magenta +201 Cursor (white) 210 Coral +202 Background (black) 211 Maroon +203 White 212 Orange +204 Red 213 Khaki +205 Green 214 Orchid +206 Blue 215 Turquoise +207 Yellow 216 Violet +217 Wheat 218-255 undefined +.TE +.NH 2 +ZScale Intensity Mapping +.LP + Since most display servers are only capable of displaying 8-bit pixel +values, images with more than 8-bits per pixel must be scaled prior to +display. For linear transformations this is typically done using a simple +conversion of the image min/max values to the 256 grayscale values, however +this doesn't produce very good results when most pixel values are near one +of the extremes (usually the image min for astronomical images). To solve +this IRAF uses a \fIzscale\fR mapping algorithm where a sampling grid is used +to approximate the image min/max values rather than computing it directly, +a line is then fit to these sample pixels to determine the optimal +transformation to the display values. This is not only more efficient but +maps the most common pixel values to the display range producing a better image. +.LP + The CDL has several routines for doing the same transformation: the +\fIcdl_computeZscale()\fR procedure is used to compute the optimal \fIz1\fR +and \fIz2\fR +values (the min/max used for the zscale transform) for an image of any pixel +size. The \fIbitpix\fR argument is the number of bits-per-pixel for the input +array and has the same meaning as for the FITS \fIBITPIX\fR keyword. To then +transform the image using these values (or user-defined values) the +\fIcdl_zscaleImage()\fR procedure is used. The input pixels are modified by +this procedure but the array is not reallocated to the smaller size needed by +an 8-bit array. The \fBcdl_setSample()\fR and \fBcdl_setSampleLines()\fR +procedures can be used to change the sampling grid and number of sample +points (the default is 600 points on 5 lines). The \fBcdl_setContrast()\fR +procedure can be used to change the default contrast adjustment to the slope +used in the transformation (the default is 0.25). If a value of zero is +given then the minimum and maximum of the intensity sample is used as the +z1/z2 value. +.LP + Each of the CDL display procedures has a \fIzscale\fR flag to +automatically scale the pixels prior to display. Applications wishing to +set their own z1/z2 values will need to call the zscale procedures and +disable this flag. By default cdl_zscaleImage() will use a linear transform, +the \fBcdl_setZTrans()\fR procedure may be used to change this. Acceptable +values are \fBCDL_UNITARY\fR (zero) for a unitary transform, \fBCDL_LINEAR\fR +(one) for a linear transform, or \fBCDL_LOG\fR (two) for a log10 transform. + +.us "Synopsis" +.nf + \f(CWvoid cdl_computeZscale (CDLPtr cdl, uchar *pix, int nx, + int ny, int bitpix, float *z1, float *z2)\fR + \f(CWvoid cdl_zscaleImage (CDLPtr cdl, uchar **pix, int nx, + int ny, int bitpix, float z1, float z2)\fR + + \f(CWvoid cdl_setZTrans (CDLPtr cdl, int ztrans)\fR + \f(CWvoid cdl_getZTrans (CDLPtr cdl, int *ztrans)\fR + \f(CWvoid cdl_setZScale (CDLPtr cdl, float z1, float z2)\fR + \f(CWvoid cdl_getZScale (CDLPtr cdl, float *z1, float *z2)\fR + + \f(CWvoid cdl_setSample (CDLPtr cdl, int nsample)\fR + \f(CWvoid cdl_setSampleLines (CDLPtr cdl, int nlines)\fR + \f(CWvoid cdl_setContrast (CDLPtr cdl, float contrast)\fR + \f(CWvoid cdl_getSample (CDLPtr cdl, int *nsample)\fR + \f(CWvoid cdl_getSampleLines (CDLPtr cdl, int *nlines)\fR + \f(CWvoid cdl_getContrast (CDLPtr cdl, float *contrast)\fR + +.fi +.NH 2 +Image Hardcopy +.LP + While most servers include some hardcopy capability of their own the +CDL provides two procedures for creating hardcopy images from the client +(e.g. for a batch processing application). The client will typically read +back the entire image, frame buffer, of just a subraster and pass those +pixels to the print procedure. Images will be written as Pseudocolor +Postscript (to preserve the overlay marker colors) and may be disposed to +a file using the \fBcdl_printPixToFile()\fR procedure or to any command string +accepting input from \fIstdin\fR (typically just an 'lpr' command) by using +the \fBcdl_printPix()\fR procedure. + +.us "Synopsis" +.nf + \f(CWint cdl_printPix (CDLPtr cdl, char *cmd, uchar *pix, int nx, + int ny, int annotate)\fR + \f(CWint cdl_printPixToFile (CDLPtr cdl, char *fname, uchar *pix, + int nx, int ny, int annotate)\fR +.fi +.NH 2 +Image Cursor +.LP + The image cursor is read using the \fBcdl_readCursor()\fR procedure. +The returned value is the cursor \fI(x,y)\fR position as floating point value +in terms of the currently define image WCS. Note that this position must +be converted to integer if it is to be used in one of the marker procedures. + +.us "Synopsis" +.nf + \f(CWint cdl_readCursor (CDLPtr cdl, int sample, float *x, + float *y, char *key)\fR +.fi +.NH 3 +Cursor Sampling +.LP + If the cdl_readCursor() \fIsample\fR flag is non-zero the \fIlogical +image cursor\fR position is returned immediately, otherwise the display server +will wait for a keystroke before returning the cursor position. The logical +image cursor is the last value set by a \fIcdl_setCursor()\fR call or the last +value returned by a \fIbcdl_readCursor()\fR call. When sampling the cursor +position the keystroke value is undefined. +.NH 2 +Image Readout +.LP + The CDL maintains an internal knowledge of where an image has been +positioned if it was displayed using one of the \fIcdl_display*\fR procedures. +The \fBcdl_readImage()\fR procedure may be used to read back the entire image +pixels from the server ignoring the region of the frame buffer outside of +the image, the \fBcdl_readFrameBuffer()\fR procedure will read back the +contents of the entire frame buffer. The dimensions of the array are returned +in the \fInx\fR and \fIny\fR arguments. + +.us "Synopsis" +.nf + \f(CWint cdl_readImage (CDLPtr cdl, uchar **pix, int *nx, + int *ny)\R + \f(CWint cdl_readFrameBuffer (CDLPtr cdl, uchar **pix, + int *nx, int *ny)\R +.fi +.NH 2 +Subraster I/O +.LP + The \fBcdl_writeSubRaster()\fR procedure is used to write an arbitrary +raster to any location in the display. Similarly the +\fBcdl_readSubRaster()\fR procedure is used to read back an arbitrary raster. +When an image has previously been displayed the subraster position is given +in image coordinates (e.g. when writing a subregion of edited pixels), +otherwise the position is in frame buffer coordinates (e.g. to display +multiple images per frame you should use the cdl_writeSubRaster() call). +See the section on \fIMarker Coordinates\fR for further explanation of the +coordinate systems used. + +.us "Synopsis" +.nf + \f(CWint cdl_writeSubRaster (CDLPtr cdl, int lx, int ly, int nx, + int ny, uchar *pix)\fR + \f(CWint cdl_readSubRaster (CDLPtr cdl, int lx, int ly, int nx, + int ny, uchar **pix)\fR +.fi +.NH +Graphics Overlay +.NH 2 +Marker Coordinates +.LP + All marker positions are assumed to be image pixel coordinates, +although there is no requirement that the position be on the image itself. +When an image WCS is defined (using the CDL display procedures or explicitly) +the origin of the coordinates used shifts from the frame buffer lower-left +to the lower-left of the image as displayed in the frame. Negative +positions are allowed and will either refer to empty pixels if the frame +buffer is larger than the image, or pixels outside the frame buffer +boundaries. Raster I/O requests will be clipped to the frame buffer +endpoints, a request completely outside the frame buffer is an error. +.NH 3 +Mapping a Previously Displayed Image +.LP + Ideally any application wishing to draw markers on an image will have +also displayed that image, however the \fBcdl_mapFrame()\fR procedure may +be used to map the requested frame for marker overlay. It does this by +reading the WCS defined for that frame and assumes an image has been +displayed and centered in the frame buffer, then resets the internal CDL +image position. If no image has been displayed the frame buffer is mapped +directly. This can be used for example to map an empty frame for displaying +just the markers without an image, or for mapping another frame's WCS for +use on the current display. The frame is not changed by the procedure call +however the current WCS \fIis\fR changed. + +.us "Synopsis" +.nf + \f(CWint cdl_mapFrame (CDLPtr cdl, int frame)\fR +.fi +.NH 2 +Marker Colors +.LP + Markers may be drawn using any 8-bit value, in order to use the +static overlay colors the color must be in the range 201-217 (see above for +notes on the XImtool color model). The "\fIcdl.h\fR" include file +for C programs, or the "\fIcdlftn.inc\fR" include for fortran programs, +defines the following symbolic constants for each of the static overlay colors: +.sp 0.5 +.TS +center; +lB l c c lB l. +C_BLACK 202 C_CORAL 210 +C_WHITE 203 C_MAROON 211 +C_RED 204 C_ORANGE 212 +C_GREEN 205 C_KHAKI 213 +C_BLUE 206 C_ORCHID 214 +C_YELLOW 207 C_TURQUOISE 215 +C_CYAN 208 C_VIOLET 216 +C_MAGENTA 209 C_WHEAT 217 +.TE +.NH 2 +Marker Types +.LP + Currently supported marker types include: \fI +.TS +center; +l l l l l. +Point Line Box Polyline Polygon +Circle Circular Annuli Ellipse Elliptical Annuli Text +.TE +.LP + \fRThe "\fIcdl.h\fR" include file for C programs, or the +"\fIcdlftn.inc\fR" include for fortran programs, defines the following +symbolic constants for each of the defined \fIPoint\fR marker types: +.TS +center; +lB r c c lB r. +M_FILL 1 M_CIRCLE 64 +M_POINT 2 M_STAR 128 +M_BOX 4 M_HLINE 256 +M_PLUS 8 M_VLINE 512 +M_CROSS 16 M_HBLINE 1024 +M_DIAMOND 32 M_VBLINE 2048 +.TE +.LP + Point markers are drawn using the \fBcdl_markPoint()\fR procedure, +point types may be logically \fIOR\fR'd to create composite markers, closed +shapes such as a circles, diamonds, or squares may be \fIOR\fR'd with the +M_FILL flag to flood-fill the point with the current overlay color. +.NH 3 +Point +.LP + The \fBcdl_markPoint()\fR procedure is used to mark a specific point +on the image using one of the marker types listed above. The marker is +centered at the coordinates specified by the \fIx\fR and \fIy\fR arguments, +\fItype\fR is an integer flag indicating what kind of marker to draw and +may be a composite type by logically ORing two or more marker types. +\fISize\fR is the width and height of the marker measured in pixel unxits, +and \fIcolor\fR is the color used to draw the marker. If the \fInumber\fR +argument is greater than zero that number will be drawn next to the point +as a label, +creating text labels for point markers can bedone using the +\fIcdl_markPointLabel\fR procedure. +.LP + Most marker names are fairly obvious but several are worth special +mention: The M_DIAMOND, M_CIRCLE and M_BOX marker types may be logically +\fIOR\fRed with the M_FILL flag to produce a filled marker type. Unless +\fIOR\fRd with the M_POINT flag all point markers will leave the center +pixel unchanged. The M_HLINE and M_VLINE markers are most useful in +astronomical applications to mark an individual star, they are horizontal +and vertical lines respectively with a gap in the middle third of the marker +(the M_HBLINE and M_VBLINE are identical but with a width of 3 pixels). +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPoint (CDLPtr cdl, int x, int y, int number, + int size, int type, int color)\fR + \f(CWint cdl_markPoint (CDLPtr cdl, int x, int y, char *label + int size, int type, int color)\fR +.fi +.NH 3 +Line +.LP + The \fBcdl_markLine()\fR procedure is used to draw a line of the +specified color between points (\fIxs,ys\fR) and (\fIxe,ye\fR). +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markLine (CDLPtr cdl, int xs, int ys, int xe, int ye, + int color)\fR +.fi +.NH 3 +Box +.LP + The \fBcdl_markBox()\fR procedure is used to draw a box of the +specified color with endpoints specified by (\fIlx,ly\fR) and (\fIux,uy\fR). +If the \fIfill\fR flag is set the box will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markBox (CDLPtr cdl, int lx, int ly, int ux, int uy, + int fill, int color)\fR +.fi +.NH 3 +Circle +.LP + The \fBcdl_markCircle()\fR procedure is used to draw a circle of the +specified color with a center at (\fIx,y\fR) and radius \fIradius\fR. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markCircle (CDLPtr cdl, int x, int y, int radius, + int fill, int color)\fR +.fi +.NH 3 +Polyline +.LP + The \fBcdl_markPolyline()\fR procedure is used to draw a line +connecting the \fInpts\fR points specified by the \fIxpts\fR and +\fIypts\fR array in the desired \fIcolor\fR. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPolyline (CDLPtr cdl, int *xpts, int *ypts, + int npts, int color)\fR +.fi +.NH 3 +Polygon +.LP + The \fBcdl_markPolygon()\fR procedure is used to draw a closed +polygon consisting of \fInpts\fR vertices specified by the \fIxpts\fR and +\fIypts\fR array in the desired \fIcolor\fR. The last point in the array +will automatically be connected to the first point by the procedure. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPolygon (CDLPtr cdl, int *xpts, int *ypts, + int npts, int fill, int color)\fR +.fi +.NH 3 +Ellipse +.LP + The \fBcdl_markEllipse()\fR procedure is used to draw an ellipse of the +specified color with a center at (\fIx,y\fR) and semimajor-axis \fIxrad\fR +and semiminor-axis \fIyrad\fR pixels long. A rotation angle for the ellipse +may be specified by passing a non-zero \fIangle\fR argument, the angle is +measured in degrees from the positive x-axis. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markEllipse (CDLPtr cdl, int x, int y, int xrad, + int yrad, float ang, int fill, int color)\fR +.fi +.NH 3 +Circular Annuli +.LP + The \fBcdl_markCircAnnuli()\fR procedure is used to draw +\fInannuli\fR circles separated by \fIsep\fR pixels each. The circle is +centered at (\fIx,y\fR) with an initial radius of \fIradius\fR pixels. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markCircAnnuli (CDLPtr cdl, int x, int y, int radius, + int nannuli, int sep, int color)\fR +.fi +.NH 3 +Elliptical Annuli +.LP + The \fBcdl_markEllipAnnuli()\fR procedure is used to draw +\fInannuli\fR ellipses separated by \fIsep\fR pixels each. The ellipse is +centered at (\fIx,y\fR) with an initial semimajor and semiminor axis +specified by the \fIxrad\fR and \fIyrad\fR arguments. Each ellipse will +be optionally rotate by an \fIangle\fR degrees as measured from the positive +x-axis. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markEllipAnnuli (CDLPtr cdl, x, y, xrad, yrad, ang, + int nannuli, int sep, int color)\fR +.fi +.NH 3 +Text +.LP + The \fBcdl_markText()\fR procedure is used to draw a text string +specified by \fIstr\fR argument with an initial position at (\fIx,y\fR) +and optionally rotated by \fIangle\fR degrees as measured from the positive +x-axis. The default \fIsize\fR is 1.0 and is approximately a 6x13 font, +the font size may be scaled by any fractional amount. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markText (CDLPtr cdl, int x, int y, char *str, + float size, float angle, int color)\fR +.fi +.NH 2 +Text Fonts +.LP + The \fBcdl_setFont()\fR procedure is used to choose between one +of four available fonts as the text marker default: Roman, Greek, Futura, +and Times respectively. By default the Roman font will be used. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWvoid cdl_setFont (CDLPtr cdl, int font)\fR +.fi +A complete listing of the Greek character mappings can be found in the file +'greek.ps' in the 'doc' subdirectory of the CDL distribution. +.NH 3 +In-Line Font Changes +.LP + Text markers are drawn using the font selected with the cdl_setFont() +routine, however fonts may be change within a string itself (e.g. to set +a Greek character) using a \\f escape sequence. The escape is followed +by the character 'R' to set a Roman font, 'G' for Greek, 'F' for futura +and 'T' for Times. Any number of escapes are permitted within a string, +the font change will remain in effect until it is changed, or the end of +string at which point any subsequent strings will again be drawn with the +default font. Additionally a 'P' in the escape sequence will change the +font to the one previously used, whatever that may be. +.LP + The CDL also supports a sub/superscripting of text which is also +done with the font escapes. In this case the escape character followed by a +'U' produces a superscript and a 'D' produces a subscript. The changes may +be nested permitting several levels of sub/superscripts, these escapes may +also be used in conjustion with a font change to cause the sub/superscript +to be drawn with a different font. A superscript escape will remain in +effect until the end of the string or a \\fD escape is seen. Similary a +subscript remains in effect until the end of the string of a \\fU escape. +.TS +center; +c s +l l. +Summary of Font Escapes +.sp 0.5 +\\\\fR change to Roman font +\\\\fG change to Greek font +\\\\fF change to Futura font +\\\\fT change to Times font +\\\\fP change to previous font +\\\\fU begin superscripted text +\\\\fD begin subscripted text +.TE +.NH 2 +Deleting Markers +.LP + When markers are drawn the underlying subraster is first saved to +an internal structure, erasure is done by simply redisplaying the saved +raster. Problems can arise however when markers overlap; when deleting a +marker that is \fIunder\fR another marker the original pixels can overwrite +the pixels of the marker on top. This is an unfortunate side effect of the +simple scheme used in this version of the package, users can call the +\fBcdl_redrawOverlay()\fR procedure to help clean up any artifacts left +behind. +.NH 3 +Individual Markers +.LP + The \fBcdl_deleteMark()\fR procedure is used to delete a single +marker from the display(). The (\fIx,y\fR) argument is either the center +position of the marker if that is know by the application, more typically +it will be an approximate position. In the latter case the marker whose +center is closest to this position will be deleted. For markers with no +defined center the distance used to decide if the marker should be +deleted is the distance from the argument position to the edge of the +marker. For example, distance from a box or polygon is measured as the +distance from to one of the sides, for text it is the distance to the +start of the text string. There is no way to \fIun\fRdelete a marker other +than to redraw it. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_deleteMark (CDLPtr cdl, int x, int y)\fR +.fi +.NH 3 +The Entire Overlay +.LP + To erase all markers currently displayed use the +\fBcdl_clearOverlay()\fR procedure. Markers are erased in the reverse order +they were drawn to help reduce the chance that overlaying markers will leave +stray pixels. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_clearOverlay (CDLPtr cdl)\fR +.fi +.NH 2 +Redraw +.LP + The \fBcdl_redrawOverlay()\fR procedure can be used to redraw all +markers currently in the display list. This is sometimes needed when +subraster I/O procedures are used to redisplay subregions and overwrite +existing markers. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_redrawOverlay (CDLPtr cdl)\fR +.fi +.NH +Fortran Language Binding Notes +.LP + The Fortran languange binding routines are implemented in C but +should be accessible from any fortran program as though they were real +fortran subroutines. The calling sequences are the same as with the C +library routines with the following exceptions: +.IP +\(bu The CDL package pointer is maintained internally so no 'cdl' pointer is +passed in the fortran interface. +.IP +\(bu All routines which are integer procedures in the C interface return an +extra 'ier' argument to contain the error flag. All Fortran functions are +implemented as subroutines. +.IP +\(bu The procedure names are the same except that \fIcdl_\fR has been +replaced with \fIcf\fR in the fortran binding. If your compiler is +case-sensitive then use all lower case letters. +.LP +The binding has been tested on a number of different platforms without +problems. The procedure names haven't been restricted to the traditional +6-character fortran names since most modern compilers can handle longer +names, if yours isn't one of them contact \fIiraf@noao.edu\fR for help +in changing the names. +.LP + Since the CDL is implemented as a set of C routines, the one aspect +that cannot be overlooked in the fortran binding is the between Fortran and +C storage order for arrays. In most cases this will not be a problem since +the CDL routines are just passing around pointers even if they live for a +short while in a fortran program. The problem comes when using the fortran +program to read the arrays, for example in using the array returned by the +\fBcfreadIRAF()\fR procedure, or when passing in arrays for display that +originated in the user's fortran code. In these cases the array \fBmust\fR +be transposed to be interpreted correctly. It was assumed that in most +applications arrays returned by CDL procedures would be immediately passed +to other CDL procedures so having the binding routines +transpose the array to/from +Fortran storage order was unnecessarily inefficient. This may be changed in +later releases if required. + +.NH +SPP Language Binding Notes +.LP + The SPP language binding is experimental and is intended to provide +a way to quickly prototype tasks, it should not be used in production code +as it may not be as portable as the rest of the task. In essence this +binding is layer on top of the Fortran binding since most IRAF platforms +still use Fortran as the intermediate code. The calling sequences are the +same as with the Fortran library routines with the following caveats: +.IP +\(bu The 'cdlspp.h' SPP include file is required by all files which call +CDL routines. The binding names are actually SPP macros to resolve the +current 6 character limit on procedure name. +.IP +\(bu The CDL package pointer is maintained internally so no 'cdl' pointer is +passed in the fortran interface. +.IP +\(bu All routines which are integer procedures in the C interface return an +extra 'ier' argument to contain the error flag. All SPP functions are +implemented as subroutines. +.IP +\(bu The procedure names are the same except that they are all upper case +and the \fIcdl_\fR has been replaced with \fICDS_\fR in the SPP binding. The +upper case is required. + +.NH +IIS Protocol Description +.LP + The communications protocol used by the CDL and servers such as +\fIXImtool\fR and \fISAOimage\fR, is a slightly modified version of that used +by the IIS Model 70. All operations are initiated by sending a header +packet containing a \fIthing id\fR (tid) and \fIsubunit\fR selecting the +function to be performed, optionally followed by data up to 32K bytes long. +The IIS header packet used is defined as +.nf + \f(CWstruct iism70 { + short tid; + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; + };\fR +.fi + +The \fIthing count\fR field contains the negative number of bytes of data +that will be sent following the header packet. The IIS header checksum is +computed as +.nf +\f(CW + checksum = 0177777 - (tid + subunit + thingct + x + y + z + t); +\fR +.fi +The four IIS registers are set differently depending on the operation, a +summary of the header packets for each operation is summarized below. + +.ce 1 +\fBIIS Header Packet Summary\fR +.TS +tab(:); +c c c c c c c c c. +:TID:Subunit:Thingct:X:Y:Z:T:Data +.T& +l | l | l | c | c | c | l | l | l |. +:_:_:_:_:_:_:_:_ +Read Data:IIS_READ\fB|\fPPACKED:MEMORY:-nbytes:x:y:frame:-:nbytes +Write Data:IIS_WRITE\fB|\fPPACKED:MEMORY:-nbytes:x:y:frame:-:nbytes +Read Cursor:IIS_READ:IMCURSOR:-:-:-:-:-:- +Write Cursor:IIS_WRITE:IMCURSOR:-:x:y:wcs:-:- +Set Frame:IIS_WRITE:LUT\fB|\fPCOMMAND:-1:-:-:-:-:2 +Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:-:-:frame:fb:N +Read WCS:IIS_READ:WCS:-:-:-:-:-:320 +Erase Frame:IIS_WRITE \fB|\fP fb:FEEDBACK:-:-:-:frame:-:- +:_:_:_:_:_:_:_:_ +.TE +.TS +l l l. +Where nbytes = number of bytes expected or written + x = x postion of operation in frame buffer coords + y = y postion of operation in frame buffer coords + frame = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 +.TE +.LP +TID fields can be logically OR'd with the PACKED flag indicating the number +of data bytes is exactly \fIthingct\fR bytes long, otherwise \fIthingct\fR +must be specified as half the number of data bytes. In a cursor read, if +the IIS_READ flag is OR'd with IMC_SAMPLE the logical cursor position (i.e. +the last value read or set) is returned immediately, otherwise the server +will wait for a keystroke to be hit before returning a string containing the +(x,y) position, wcs of the read, and the keystroke. When setting the frame +you must send a short integer in the data containing the frame selected. +.bp +.NH +C Interface Summary +.LP +.in 0.5i +#include "\fBcdl.h\fR" +.in -0.5i + +.TS +center; +r l. +CDLPtr \fBcdl_open\fR (imtdev) +int \fBcdl_displayPix\fR (cdl, pix, nx, ny, bitpix, frame, fbconfig, zscale) +char \fBcdl_readCursor\fR (cdl, sample, x, y, key) +int \fBcdl_setCursor\fR (cdl, x, y, wcs) +int \fBcdl_setWCS\fR (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +int \fBcdl_getWCS\fR (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +void \fBcdl_setFrame\fR (cdl, frame) +int \fBcdl_clearFrame\fR (cdl) +void \fBcdl_close\fR (cdl) + +int \fBcdl_displayIRAF\fR (cdl, fname, band, frame, fbconfig, zscale) +int \fBcdl_isIRAF\fR (fname) +int \fBcdl_readIRAF\fR (fname, band, pix, nx, ny, bitpix) + +int \fBcdl_displayFITS\fR (cdl, fname, frame, fbconfig, zscale) +int \fBcdl_isFITS\fR (fname) +int \fBcdl_readFITS\fR (fname, pix, nx, ny, bitpix) + +void \fBcdl_computeZscale\fR (cdl, pix, nx, ny, bitpix, z1, z2) +void \fBcdl_zscaleImage\fR (cdl, pix, nx, ny, bitpix, z1, z2) + +int \fBcdl_printPix\fR (cdl, cmd, pix, nx, ny, annotate) +int \fBcdl_printPixToFile\fR (cdl, fname, pix, nx, ny, annotate) + +int \fBcdl_readImage\fR (cdl, pix, nx, ny) +int \fBcdl_readFrameBuffer\fR (cdl, pix, nx, ny) +int \fBcdl_readSubRaster\fR (cdl, lx, ly, nx, ny, pix) +int \fBcdl_writeSubRaster\fR (cdl, lx, ly, nx, ny, pix) + +void \fBcdl_selectFB\fR (cdl, nx, ny, fb, w, h, nf, reset) +void \fBcdl_setFBConfig\fR (cdl, configno) +void \fBcdl_getFBConfig\fR (cdl, configno, w, h, nf) +void \fBcdl_lookupFBSize\fR (cdl, configno, w, h, nf) + +void \fBcdl_setZTrans\fR (cdl, ztrans) +void \fBcdl_setZScale\fR (cdl, z1, z2) +void \fBcdl_setSample\fR (cdl, nsample) +void \fBcdl_setSampleLines\fR (cdl, nlines) +void \fBcdl_setContrast\fR (cdl, contrast) +void \fBcdl_setName\fR (cdl, imname) +void \fBcdl_setTitle\fR (cdl, imtitle) + +void \fBcdl_getFrame\fR (cdl, frame) +void \fBcdl_getZTrans\fR (cdl, ztrans) +void \fBcdl_getZScale\fR (cdl, z1, z2) +void \fBcdl_getSample\fR (cdl, nsample) +void \fBcdl_getSampleLines\fR (cdl, nlines) +void \fBcdl_getContrast\fR (cdl, contrast) +void \fBcdl_getName\fR (cdl, imname) +void \fBcdl_getTitle\fR (cdl, imtitle) + +int \fBcdl_mapFrame\fR (cdl, frame) +int \fBcdl_markPoint\fR (cdl, x, y, number, size, type, color) +int \fBcdl_markPointLabel\fR (cdl, x, y, label, size, type, color) +int \fBcdl_markLine\fR (cdl, xs, ys, xe, ye, color) +int \fBcdl_markBox\fR (cdl, lx, ly, ux, uy, fill, color) +int \fBcdl_markPolygon\fR (cdl, xarray, yarray, npts, fill, color) +int \fBcdl_markPolyline\fR (cdl, xarray, yarray, npts, color) +int \fBcdl_markCircle\fR (cdl, x, y, radius, fill, color) +int \fBcdl_markCircAnnuli\fR (cdl, x, y, radius, nannuli, sep, color) +int \fBcdl_markEllipse\fR (cdl, x, y, xrad, yrad, rotang, fill, color) +int \fBcdl_markEllipAnnuli\fR (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) +int \fBcdl_markText\fR (cdl, x, y, str, size, angle, color) +int \fBcdl_deleteMark\fR (cdl, x, y) +int \fBcdl_clearOverlay\fR (cdl) +int \fBcdl_redrawOverlay\fR (cdl) +.TE + +.bp +.NH +C Example Tasks +.LP + The examples shown here are for demonstration purposes only. They +are based on working example tasks in the CDL source \fIexamples\fR +subdirectory, see the programs there for the full program listing. + +.NH 2 +Display Example +.LP +.ps -2 +.vs -2 +.nf +\f(CW +#include +#include +#include "cdl.h" + +/* \fIDISPLAY -- Example task to display an image as a command-line task. + * This task is meant to show three ways the CDL can be used to display + * an image, see the code comments for a description of each method. + * + * Examples: + * To display a simple IRAF or FITS file: + * % ./display -frame 2 image.imh + * % ./display image.fits + * + * To display a FITS file as a raw image: + * % ./display -nx 512 -ny 512 -depth 16 -hskip 5760 -raw dpix.fits + * + * Usage: + * display [-depth N] [-fits] [-frame N] [-fbconfig N] [-hskip N] + * [-iraf] [-nozscale] [-nx N] [-ny N] [-raw] [-zscale] file\fP + */ + +#define NONE -1 +#define IRAF 0 +#define FITS 1 +#define RAW 2 + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname; + int i, status = 0, frame = 1, fbconfig = 0, zscale = 1; + int format = NONE, nx = 0, ny = 0, depth = 8, hskip = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strcmp (argv[i], "-depth") == 0) depth = atoi (argv[++i]); + else if (strcmp (argv[i], "-fits") == 0) format = FITS; + else if (strcmp (argv[i], "-frame") == 0) frame = atoi (argv[++i]); + else if (strcmp (argv[i], "-fbconfig") == 0) fbconfig = atoi (argv[++i]); + else if (strcmp (argv[i], "-hskip") == 0) hskip = atoi (argv[++i]); + else if (strcmp (argv[i], "-iraf") == 0) format = IRAF; + else if (strcmp (argv[i], "-nozscale") == 0) zscale = 0; + else if (strcmp (argv[i], "-nx") == 0) nx = atoi (argv[++i]); + else if (strcmp (argv[i], "-ny") == 0) ny = atoi (argv[++i]); + else if (strcmp (argv[i], "-raw") == 0) format = RAW; + else if (strcmp (argv[i], "-zscale") == 0) zscale = 1; + } + } + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + fname = argv[argc-1]; + + /* \fIMETHOD 1: Displays the image using the high-level format display + * call. Display as an IRAF image if the option was set indicating + * this is the format, otherwise test the file to see if it is anyway.\fP + */ + if (format == IRAF || (format == NONE && \fBcdl_isIRAF\fP (fname))) { + status = \fBcdl_displayIRAF\fP (cdl, fname, 1, frame, FB_AUTO, zscale); + + /* \fIMETHOD 2: Uses the CDL procedure for getting image pixels from + * a known format, minimal work required to display an image. The + * point here is that you can use this method to process the image + * yourself prior to display, e.g. subsample the pixels, apply a user + * LUT, etc but still use the CDL to get the raw image and do the + * display.\fP + */ + } else if (format == FITS || (format == NONE && \fBcdl_isFITS\fP (fname))) { + + /* \fIGet the FITS image pixels, exit w/ an error status if something + * went wrong, the procedure will print what that was.\fP + */ + if (\fBcdl_readFITS\fP (fname, &pix, &nx, &ny, &depth)) { + \fBcdl_close\fP (cdl); /* close the package */ + exit (1); /* exit w/ error code */ + } + + /* \fINow select a frame buffer large enough for the image. The + * fbconfig number is passed in the WCS packet, but the display + * call below will compute the correct WCS for the image and + * transmit that prior to display, all we're doing here is + * setting up the FB to be used.\fP + */ + if (fbconfig == 0) + cdl_selectFB (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 0); + + /* \fILastly, display the pixels to the requested frame, do any + * zscaling requested using the CDL procedure.\fP + */ + status = \fBcdl_displayPix\fP (cdl, pix, nx, ny, depth, frame, + fbconfig, zscale); + + /* \fIMETHOD 3: Displays an image of raw pixels. The client code is + * responsible for reading the image and calling all the procedures + * needed for image display, initialize the frame, zscaling pix, etc. + * While we assume a simple raster format in this program, the user + * code can read a compressed image format such as GIF, mosaic multiple + * images for display as a single image, or just about anything that + * produces a raster for display. The intent here is to show all the + * lowest level calls needed for displaying the image.\fP + */ + } else if (format == RAW) { + FILE *fd; + int lx, ly; + + if (nx == 0 || ny == 0) { + fprintf (stderr, "No size given for raw data.\\n"); + exit (1); + } + + /* \fIOpen the image file if we can.\fP */ + if (fd = fopen (fname, "r")) { + + /* \fISeek to the offset specified.\fP */ + lseek (fileno(fd), (off_t) hskip, SEEK_SET); + + /* \fIAllocate the pixel pointer and read the data.\fP */ + pix = (unsigned char *) malloc (nx * ny * (depth / 8)); + fread (pix, depth/8, nx * ny, fd); + + /* \fIIf we're zscaling and depth is more than 8-bits, do that.\fP */ + if (zscale && depth > 8) { + \fBcdl_computeZscale\fP (cdl, pix, nx, ny, depth, &z1, &z2); + \fBcdl_zscaleImage\fP (cdl, &pix, nx, ny, depth, z1, z2); + } + + /* \fINow select a frame buffer large enough for the image. We'll + * ask that this be reset but the change won't go to the server + * until we send in a WCS, so compute that as well. For the + * WCS we assume a simple linear transform where the image is + * Y-flipped, the (x,y) translation is computed so it is correct + * for an frame buffer >= than the image size.\fP + */ + \fBcdl_selectFB\fP(cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf,1); + \fBcdl_setWCS\fP (cdl, fname, NULL, 1., 0., 0., -1., + (float) (nx / 2) - (fb_w / 2) + 1, /* \fIX trans.\fP */ + (float) (fb_h / 2) + (ny / 2), /* \fIY trans.\fP */ + z1, z2, CDL_LINEAR); /* \fIZ transform\fP */ + + /* \fISelect and clear the requested frame prior to display.\fP */ + \fBcdl_setFrame\fP (cdl, frame); + \fBcdl_clearFrame\fP (cdl); + + /* \fINow display the pixels. We'll compute the image placement + * ourselves and write the image as a raw subraster of the frame + * buffer. In this case we'll center the image, but the CDL + * cdl_writeSubRaster() procedure can be used to write arbitrary + * rasters at any point in the frame buffer.\fP + */ + lx = (fb_w / 2) - (nx / 2); + ly = fb_h - ((fb_h / 2) + (ny / 2)); + status = \fBcdl_writeSubRaster\fP (cdl, lx, ly, nx, ny, pix); + } else + status = 1; + } else { + if (access (fname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\\n", fname); + else + fprintf (stderr, "'%s': image does not exist.\\n", fname); + status = 1; + } + + /* \fINow just free the pixel pointer to clean up.\fP */ + if (pix) + free ((unsigned char *) pix); + \fBcdl_close\fP (cdl); /* \fIclose the package\fP */ + exit (status); +} +\fR +.fi +.vs +2 +.ps +2 +.bp +.NH 2 +Interactive Graphics Overlay Example +.LP +.ps -2 +.vs -2 +.nf +\f(CW +#include +#include +#include +#include "cdl.h" + +/* \fI + * TVMARK -- Example task for displaying an marking images. This program + * can be used to either display an image and overlay points defined in + * a coordinate file, map an existing display frame for marking, or option- + * ally enter a cursor command loop after either of these providing other + * marking capability. All options support minimum match. + * + * Examples: + * % tvmark dpix.fits + * % tvmark -coords coords -color 205 dpix.fits + * % tvmark -frame 2 + * % tvmark -coords coords -interactive dpix.fits + * + * Usage: + * tvmark [-frame N] [-fbconfig N] [-coords ] [-size N] [-color N] + * [-nolabel] [-fill] [-interactive] [image]\fP + */ + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL, *cfname = NULL; + int i, status = 0, fill = 0, frame = 1, fb = FB_AUTO, zscale = 1; + int color = 201, label = 1, size = 9, interactive = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp(argv[i], "-color",4) == 0) color = atoi (argv[++i]); + else if (strncmp(argv[i], "-coords",4) == 0) cfname = argv[++i]; + else if (strncmp(argv[i], "-fbconfig",3) == 0) fb = atoi (argv[++i]); + else if (strncmp(argv[i], "-fill",4) == 0) fill = 1; + else if (strncmp(argv[i], "-frame",3) == 0) frame = atoi (argv[++i]); + else if (strncmp(argv[i], "-interactive",4) == 0) interactive = 1; + else if (strncmp(argv[i], "-nolabel",4) == 0) label = 0; + else if (strncmp(argv[i], "-nozscale",4) == 0) zscale = 0; + else if (strncmp(argv[i], "-size",2) == 0) size = atoi (argv[++i]); + else + fname = argv[i]; + } + } + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* \fIIf an image was specified display it first, otherwise assume the + * image has already been loaded in the frame and mark that.\fP + */ + if (fname) { + if (\fBcdl_isIRAF\fP (fname)) + status = \fBcdl_displayIRAF\fP (cdl, fname, 1, frame, fb, zscale); + else if (\fBcdl_isFITS\fP (fname)) + status = \fBcdl_displayFITS\fP (cdl, fname, frame, fb, zscale); + else { + if (access (cfname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\\n", fname); + else + fprintf (stderr, "'%s': image doesn't exist.\\n", fname); + status = 1; + } + if (status) goto err_; + } else { + + /* \fIIf we've requested a special frame buffer, set it now.\fP */ + if (fb > 0) + \fBcdl_setFBConfig\fP (cdl, fb); + + /* \fIMap the current display frame for use as an image.\fP */ + \fBcdl_mapFrame\fP (cdl, frame); + } + + /* \fIIf a coordinate file was specified read the file and mark those + * coords with points.\fP + */ + if (cfname) { + if (access (cfname, F_OK) == 0) { + FILE *fp; + int i, x, y; + + if (fp = fopen (cfname, "r")) { + /* \fIThe coord file is assumed to be simply a file containing + * (x,y) pairs, one per line. Scan the file and mark each + * point. We do no bounds checking to see if the coords + * are correct for the frame, marker type is fixed.\fP + */ + i = 1; + while (fscanf (fp, "%d %d", &x, &y) != EOF) { + if (label) + \fBcdl_markPoint\fP (cdl, x, y, i++, size, M_STAR, color); + else + \fBcdl_markPoint\fP (cdl, x, y, 0, size, M_STAR, color); + } + + } else + fprintf (stderr, "cannot open coord file '%s'.\\n", cfname); + } else + fprintf (stderr, "'%s': coord file doesn't exist, ignoring.\\n", cfname); + } + + /* \fILastly, start up an interactive cursor loop if needed.\fP */ + if (interactive) + tvmInteractive (cdl, label, fill, color, size); + + /* \fIClose the package and clean up.\fP */ +err_: \fBcdl_close\fP (cdl); + exit (status); +} + +/* \fITVMINTERACTIVE -- Process commands interactively.\fP */ + +tvmInteractive (cdl, label, fill, color, size) +CDLPtr cdl; +int label, fill, color, size; +{ + float angle = 0.0, rx, ry, txsize = 1.; + int nx, ny, i, x, y, x2, y2; + int number=1, radius=11, xrad=11, yrad=6, nannuli=3, sep=5; + char key, cmd[SZ_NAME], str[SZ_NAME]; + unsigned char *pix; + + /* \fIProcess commands until a 'q' keystrke is hit.\fP */ + while (\fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &key) != 'q') { + x = (int) (rx + 0.5); /* \fIconvert to int pixels\fP */ + y = (int) (ry + 0.5); + + switch (key) { + case ':': /* \fIprocess a colon command\fP */ + putchar (':'); + gets (str); + for (i=0; str[i] != ' ' && str[i]; i++) + cmd[i] = str[i]; + cmd[i++] = '\0'; + + if (strcmp (cmd, "angle") == 0) angle = atof (&str[i]); + else if (strcmp (cmd, "color") == 0) color = atoi (&str[i]); + else if (strcmp (cmd, "fill") == 0) fill = atoi (&str[i]); + else if (strcmp (cmd, "number") == 0) number = atoi (&str[i]); + else if (strcmp (cmd, "nannuli") == 0) nannuli = atoi (&str[i]); + else if (strcmp (cmd, "label") == 0) label = atoi (&str[i]); + else if (strcmp (cmd, "sep") == 0) sep = atoi (&str[i]); + else if (strcmp (cmd, "size") == 0) size = atoi (&str[i]); + else if (strcmp (cmd, "txsize") == 0) txsize = atof (&str[i]); + else if (strcmp (cmd, "xrad") == 0) xrad = atoi (&str[i]); + else if (strcmp (cmd, "yrad") == 0) yrad = atoi (&str[i]); + else if (strcmp (cmd, "print") == 0) { + \fBcdl_readFrameBuffer\fP (cdl, &pix, &nx, &ny); + \fBcdl_printPix\fP (cdl, NULL, pix, nx, ny, 1); + } else if (strcmp (cmd, "snap") == 0) { + \fBcdl_readFrameBuffer\fP (cdl, &pix, &nx, &ny); + \fBcdl_printPixToFile\fP (cdl, &str[i], pix, nx, ny, 1); + } else if (strcmp (cmd, "status") == 0) { + printf ("angle = %-5.3g\tcolor = %d\t", angle, color); + printf ("fill = %-5d\tnumber = %d\\n", fill, number); + printf ("nannuli = %-5d\tsep = %d\t", nannuli, sep); + printf ("size = %-5d\ttxsize = %g\\n", size, txsize); + printf ("xrad = %-5d\tyrad = %d\t", xrad, yrad); + printf ("label = %-5d\\n", label); + } + break; + + case '?': + /* ......\fIhelp procedures\fP */ + break; + + case 'p': /* \fIplus mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_PLUS, color); + break; + case 'x': /* \fIcross mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_CROSS, color); + break; + case '.': /* \fIpoint mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_POINT, color); + break; + case '*': /* \fIstar mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_STAR, color); + break; + case '_': /* \fIhoriz dash mark\fP*/ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_HBLINE, color); + break; + case '|': /* \fIvert dash mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_VBLINE, color); + break; + case 'o': /* \fIcircle mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_CIRCLE|fill, color); + break; + case 's': /* \fIsquare mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_BOX|fill, color); + break; + case 'v': /* \fIdiamond mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_DIAMOND|fill, color); + break; + + case 'b': /* \fIBox\fP */ + printf ("Hit another key to define the box...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + \fBcdl_markBox\fP (cdl, x, y, x2, y2, fill, color); + break; + case 'c': /* \fICircle\fP */ + printf ("Hit another key to set radius ...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + radius = (int) sqrt ((double) ((x2-x)*(x2-x) + (y2-y)*(y2-y))); + \fBcdl_markCircle\fP (cdl, x, y, radius, fill, color); + break; + case 'd': /* \fIDelete marker\fP */ + \fBcdl_deleteMark\fP (cdl, x, y); + break; + case 'e': /* \fIEllipse\fP */ + \fBcdl_markEllipse\fP (cdl, x, y, xrad, yrad, angle, fill, color); + break; + case 'l': /* \fILine\fP */ + printf ("Hit another key to set line endpoint...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + \fBcdl_markLine\fP (cdl, x, y, x2, y2, color); + break; + case 't': /* \fIText string\fP */ + printf ("Text string: "); + gets (str); + \fBcdl_markText\fP (cdl, x, y, str, txsize, angle, color); + break; + case 'C': /* \fICircular annuli\fP*/ + \fBcdl_markCircAnnuli\fP (cdl, x, y, radius, nannuli, sep, color); + break; + case 'D': /* \fIDelete all markers\fP*/ + \fBcdl_clearOverlay\fP (cdl); + break; + case 'E': /* \fIElliptical annuli\fP*/ + \fBcdl_markEllipAnnuli\fP (cdl, x, y, xrad, yrad, angle, nannuli, sep, color); + break; + default: + break; + } + } +} +\fR +.fi +.vs +2 +.ps +2 +.bp +.NH 2 +Image Mosaic Example +.LP +.in 0.5i +.ps -2 +.vs -2 +.nf +#include +#include +#\fBinclude "cdl.h"\fP + +/* \fIMOSAIC -- Example task to mosaic several images on a display. Demonstrates + * usage of low-level routines for complex display operations.\fP + */ + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL; + int i, j, k, status=0, label=0, frame=1, fb=FB_AUTO, zscale=1; + int sample=1, pad=0, col=204, imx, imy, bitpix, nimages, nim; + int ii, xinit, rowx, rowy, nnx, nny, fb_w, fb_h, nf, mx, my, nx, ny; + float z1, z2; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp (argv[i], "-fbconfig",3) == 0) fb=atoi(argv[++i]); + else if (strncmp (argv[i],"-frame",3) == 0) frame=atoi(argv[++i]); + else if (strncmp (argv[i],"-color",3) == 0) col=atoi(argv[++i]); + else if (strncmp (argv[i],"-label",4) == 0) label=1; + else if (strncmp (argv[i],"-nozscale",4) == 0) zscale=0; + else if (strncmp (argv[i],"-nx",3) == 0) nx=atoi(argv[++i]); + else if (strncmp (argv[i],"-ny",3) == 0) ny=atoi(argv[++i]); + else if (strncmp (argv[i],"-pad",4) == 0) pad=atoi(argv[++i]); + else if (strncmp (argv[i],"-sample",4) == 0) sample=atoi(argv[++i]); + else + break; + } + } + nimages = argc - i; + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* \fIClear the frame to begin.\fP */ + (void) \fBcdl_clearFrame\fP (cdl); + + /* \fILoop over each of the images in the list.\fP */ + nim = rowx = rowy = nnx = nny = 0; + for (k=0; k < ny && nim < nimages; k++) { + rowy += nny + pad; + for (rowx = xinit, j=0; j < nx && nim < nimages; j++) { + + /* \fIGet the image name for display.\fP */ + fname = argv[i++]; + + /* \fIFigure out what kind of image it is and get the pixels.\fP */ + if (cdl_isIRAF (fname)) + status = \fBcdl_readIRAF\fP (fname, 1, &pix, &imx, &imy, &bitpix); + else if (cdl_isFITS (fname)) + status = \fBcdl_readFITS\fP (fname, &pix, &imx, &imy, &bitpix); + else { + fprintf(stderr, "'%s': unknown or nonexistant image.\\n", fname); + status = 1; + } + if (status) goto err_; + + /* \fICompute subsampled image size.\fP */ + if (sample > 1) + nnx = imx / sample, nny = imy / sample; + else + nnx = imx, nny = imy; + + /* \fIUnless we asked for a specific FB size find one large enough + * to handle the mosaic. We don't check to be sure what's + * returned is really large enough.\fP + */ + if (nim == 0 && fb == FB_AUTO) + \fBcdl_selectFB\fP (cdl, nx*nnx+(pad*(nx-1)), ny*nny+(pad*(ny-1)), &fb, &fb_w, &fb_h, &nf, 1); + else { + \fBcdl_setFBConfig\fP (cdl, fb); + \fBcdl_lookupFBSize\fP (cdl, fb, &fb_w, &fb_h, &nf); + } + + /* \fIDefine a WCS for the frame.\fP */ + \fBcdl_setWCS\fP (cdl, "image mosaic", "", 1., 0., 0., -1., 0., (float) ny*imy+(pad*(ny+1)), 1., 255., 1); + + /* \fIThe first time through figure out the placement so the + * entire mosaic is centered in the frame.\fP + */ + if (nim == 0) { + mx = (nx * nnx) + pad * (nx-1); + my = (ny * nny) + pad * (ny-1); + rowy = (fb_h - my) / 2; + xinit = rowx = (fb_w - mx) / 2; + } + + /* \fICompute the zscaled imaged pixels.\fP */ + if (zscale) { + \fBcdl_computeZscale\fP (cdl, pix, imx ,imy, bitpix, &z1, &z2); + \fBcdl_zscaleImage\fP (cdl, &pix, imx ,imy, bitpix, z1, z2); + } + + /* \fISubsample the image if requested.\fP */ + if (sample > 1) { + int l, m, n=0; + for (l=0; l < imy; l+=sample) + for (m=0; m < imx; m+=sample) + pix[n++] = pix[(l*imx)+m]; + } + + /* \fIWrite the image to the frame buffer.\fP */ + if (\fBcdl_writeSubRaster\fP (cdl, rowx, rowy, nnx, nny, pix)) goto err_; + + /* \fIDraw the image name as a label.\fP */ + if (label) \fBcdl_markText\fP (cdl, rowx+10, rowy+10, fname, 1., 0., col); + + nim++; rowx += nnx + pad; + } + } + + /* \fIClose the package and clean up.\fP */ +err_: \fBcdl_close\fP (cdl); + exit (status); +} +.fi +.vs +2 +.ps +2 +.in -0.5i + +.bp +.NH +Fortran Interface Summary +.LP +.in 0.5i +include "\fBcdlftn.inc\fR" +.in -0.5i + +.TS +center; +r l. +\fBcfopen\fR (imtdev, ier) +\fBcfdisplayPix\fR (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +\fBcfreadCursor\fR (sample, x, y, key, ier) +\fBcfsetCursor\fR (x, y, wcs, ier) +\fBcfsetWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcfgetWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcfsetFrame\fR (frame) +\fBcfclearFrame\fR (ier) +\fBcfclose\fR () + +\fBcfdisplayIRAF\fR (fname, band, frame, fbconfig, zscale, ier) +\fBcfisIRAF\fR (fname, isiraf) +\fBcfreadIRAF\fR (fname, band, pix, nx, ny, bitpix, ier) + +\fBcfdisplayFITS\fR (fname, frame, fbconfig, zscale, ier) +\fBcfisFITS\fR (fname, isfits) +\fBcfreadFITS\fR (fname, pix, nx, ny, bitpix, ier) + +\fBcfcomputeZscale\fR (pix, nx, ny, bitpix, z1, z2) +\fBcfzscaleImage\fR (pix, nx, ny, bitpix, z1, z2) + +\fBcfprintPix\fR (cmd, pix, nx, ny, annotate, ier) +\fBcfprintPixToFile\fR (fname, pix, nx, ny, annotate, ier) + +\fBcfreadImage\fR (pix, nx, ny, ier) +\fBcfreadFrameBuffer\fR (pix, nx, ny, ier) +\fBcfreadSubRaster\fR (lx, ly, nx, ny, pix, ier) +\fBcfwriteSubRaster\fR (lx, ly, nx, ny, pix, ier) + +\fBcfselectFB\fR (nx, ny, fb, w, h, nf, reset) +\fBcfsetFBConfig\fR (configno) +\fBcfgetFBConfig\fR (configno, w, h, nf) +\fBcflookupFBSize\fR (configno, w, h, nf) + +\fBcfsetZTrans\fR (ztrans) +\fBcfsetZScale\fR (z1, z2) +\fBcfsetSample\fR (nsample) +\fBcfsetSampleLines\fR (nlines) +\fBcfsetContrast\fR (contrast) +\fBcfsetName\fR (imname) +\fBcfsetTitle\fR (imtitle) + +\fBcfgetFrame\fR (frame) +\fBcfgetZTrans\fR (ztrans) +\fBcfgetZScale\fR (z1, z2) +\fBcfgetSample\fR (nsample) +\fBcfgetSampleLines\fR (nlines) +\fBcfgetContrast\fR (contrast) +\fBcfgetName\fR (imname) +\fBcfgetTitle\fR (imtitle) + +\fBcfmapFrame\fR (frame, ier) +\fBcfmarkPoint\fR (x, y, number, size, type, color, ier) +\fBcfmarkPointLabel\fR (x, y, label, size, type, color, ier) +\fBcfmarkLine\fR (xs, ys, xe, ye, color, ier) +\fBcfmarkBox\fR (lx, ly, ux, uy, fill, color, ier) +\fBcfmarkPolygon\fR (xarray, yarray, npts, fill, color, ier) +\fBcfmarkPolyline\fR (xarray, yarray, npts, color, ier) +\fBcfmarkCircle\fR (x, y, radius, fill, color, ier) +\fBcfmarkCircAnnuli\fR (x, y, radius, nannuli, sep, color, ier) +\fBcfmarkEllipse\fR (x, y, xrad, yrad, rotang, fill, color, ier) +\fBcfmarkEllipAnnuli\fR (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +\fBcfmarkText\fR (x, y, str, size, angle, color, ier) +\fBcfsetfont\fR (font) +\fBcfdeleteMark\fR (x, y, ier) +\fBcfclearOverlay\fR (ier) +\fBcfredrawOverlay\fR (ier) +.TE +.bp +.NH +Fortran Example Tasks +.LP + The examples shown here are for demonstration purposes only. They +are based on working example tasks in the CDL source \fIexamples\fR +subdirectory, see the programs there for the full program listing. + +.NH 2 +Display Example +.in 0.5i +.ps -2 +.vs -2 +.nf +\f(CW +C ======================================================================== +C FDISPLAY -- Example fortran program showing the use of the Client +C Display Library (CDL) Fortran interface for displaying images. +C ======================================================================== + + PROGRAM FDISPLAY + character*64 imname + +C \fIInitialize the CDL package\fP + call \fBcfopen\fP (0, ier) + if (ier .gt. 0) then + write (*,*) 'open: Error return from CDL' + goto 999 + endif + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C \fIIf we've got a FITS format image, go ahead and display it.\fP + call \fBcfisFITS\fP (imname, isfits) + if (isfits .gt. 0) then + call \fBcfdisplayFITS\fP (imname, iframe, ifb, 1, ier) + else +C \fIWe've got an IRAF format image, go ahead and display it.\fP + call \fBcfisIRAF\fP (imname, isiraf) + if (isiraf .gt. 0) then + call \fBcfdisplayIRAF\fP (imname, 1, iframe, ifb, 1, ier) + else +C \fIUnrecognized image, punt and exit.\fP + write (*,*) 'Unrecognized image format' + endif + endif + +C \fIClean up and exit.\fP +999 continue + call \fBcfclose\fP (ier) + end +\fR +.fi +.ps +2 +.vs +2 +.in -0.5i +.bp +.NH 2 +Interactive Graphics Overlay Example +.in 0.5i +.ps -2 +.vs -2 +.nf +\f(CW +C ========================================================================== +C FTVMARK -- Example fortran program showing the use of the Client +C Display Library (CDL) Fortran interface for doing graphics overlay. No +C checking of the error flag is done here for space considerations. +C ========================================================================== + + PROGRAM FTVMARK + include "\fBcdlftn.inc\fP" + character*64 imname + +C \fIInitialize the CDL package\fP + call \fBcfopen\fP (0, ier) + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C \fIIf we've got a FITS format image, go ahead and display it.\fP + call \fBcfisFITS\fP (imname, isfits) + if (isfits .gt. 0) then + call \fBcfdisplayFITS\fP (imname, iframe, ifb, 1, ier) + else +C \fIWe've got an IRAF format image, go ahead and display it.\fP + call \fBcfisIRAF\fP (imname, isiraf) + if (isiraf .gt. 0) then + call \fBcfdisplayIRAF\fP (imname, 1, iframe, ifb, 1, ier) + else +C \fINo valid image given, so map the current display for marking.\fP + call \fBcfmapFrame\fP (iframe) + endif + endif + +C \fINow that we've got an image displayed or mapped, enter a cursor loop to mark the image. \fP + call markInteractive () + +C \fIClean up and exit\fP +999 continue + call \fBcfclose\fP (ier) + end + +C \fIMARKINTERACTIVE -- Subroutine for processing the cursor loop.\fP + subroutine markInteractive () + include "\fBcdlftn.inc\fP" + real angle, rx, ry, txsize + integer nx, ny, x, y, x2, y2, fill, size, color + integer number, radius, xrad, yrad, nannuli, sep + character key + character*64 cmd, str + +C \fIAllocate a 1024x1024 array for pixels. \fP + character pix(1048576) + +C \fI....Initialize the local parameters to use\fP + +C \fIRead a cursor keystroke telling us what to do.\fP +10 call \fBcfreadCursor\fP (0, rx, ry, key, ier) + +C \fIRound the real cursor position to integer pixel positions.\fP + x = nint (rx + 0.5) + y = nint (ry + 0.5) + +C \fICheck the keystroke and take the appropriate action.\fP +C \fIColon Commands\fP + if (key .eq. ':') then +C \fIRead a three character command and value field and process the colon command\fP + read (*,'(A3, i4)') cmd, ival + if (cmd(1:3) .eq. 'ang') then + angle = real (ival) + else if (cmd(1:3) .eq. 'col') then + color = ival + else if (cmd(1:3) .eq. 'fil') then + fill = ival +\fI : + ....and so on to set local variables + :\fR + else if (cmd(1:3) .eq. 'pri') then +C \fIPrint contents of the current frame buffer\fP + call \fBcfreadFrameBuffer\fP (pix, nx, ny, ier) + call \fBcfprintPix\fP ("lpr", pix, nx, ny, 1, ier) + else if (cmd(1:3) .eq. 'sta') then + \fI....print out the status (value) of variables\fP + endif + +C \fIPoint Markers\fP + else if (key .eq. 'p') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_PLUS, color, ier) + else if (key .eq. 'x') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_CROSS, color, ier) + else if (key .eq. '_') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_HBLINE, color, ier) + else if (key .eq. 'o') then +C \fIExample of a filled point marker \fP + call \fBcfmarkPoint\fP (x, y, 1, size, or(M_CIRCLE,fill), color, ier) +\fI : + ....and so on to set other types of point markers\fR + +C \fIOther Markers\fP + else if (key .eq. 'b') then + print '("Hit another key to define the box ....")' + call \fBcfreadCursor\fP (0, rx, ry, key, ier) + x2 = nint (rx + 0.5) + y2 = nint (ry + 0.5) + call \fBcfmarkBox\fP (x, y, x2, y2, fill, color, ier) + else if (key .eq. 'd') then + call \fBcfdeleteMark\fP (x, y, ier) + else if (key .eq. 'e') then + call \fBcfmarkEllipse\fP (x, y, xrad, yrad, angle, fill, color, ier) + else if (key .eq. 't') then + print '("Text string: ", $)' + read (*,'(A64)') str + call \fBcfmarkText\fP (x, y, str, txsize, angle, color, ier) +\fI : + ....and so on to set other types of markers\fR + +C \fIQuit\fP + else if (key .eq. 'q') then + goto 998 + endif + +C \fILoop back until we want to quit\fP + goto 10 +998 continue + end +\fR +.fi +.ps +2 +.vs +2 +.in -0.5i +.bp +.NH +SPP Interface Summary +.LP +.in 0.5i +#include "\fBcdlspp.h\fR" +.in -0.5i + +.TS +center; +r l. +\fBCDS_OPEN\fR (imtdev, ier) +\fBCDS_DISPLAYPIX\fR (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +\fBCDS_READCURSOR\fR (sample, x, y, key, ier) +\fBCDS_SETCURSOR\fR (x, y, wcs, ier) +\fBCDS_SETWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBCDS_GETWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBCDS_SETFRAME\fR (frame) +\fBCDS_CLEARFRAME\fR (ier) +\fBCDS_CLOSE\fR () + +\fBCDS_DISPLAYIRAF\fR (fname, band, frame, fbconfig, zscale, ier) +\fBCDS_ISIRAF\fR (fname, isiraf) +\fBCDS_READIRAF\fR (fname, band, pix, nx, ny, bitpix, ier) + +\fBCDS_DISPLAYFITS\fR (fname, frame, fbconfig, zscale, ier) +\fBCDS_ISFITS\fR (fname, isfits) +\fBCDS_READFITS\fR (fname, pix, nx, ny, bitpix, ier) + +\fBCDS_COMPUTEZSCALE\fR (pix, nx, ny, bitpix, z1, z2) +\fBCDS_ZSCALEIMAGE\fR (pix, nx, ny, bitpix, z1, z2) + +\fBCDS_PRINTPIX\fR (cmd, pix, nx, ny, annotate, ier) +\fBCDS_PRINTPIXTOFILE\fR (fname, pix, nx, ny, annotate, ier) + +\fBCDS_READIMAGE\fR (pix, nx, ny, ier) +\fBCDS_READFRAMEBUFFER\fR (pix, nx, ny, ier) +\fBCDS_READSUBRASTER\fR (lx, ly, nx, ny, pix, ier) +\fBCDS_WRITESUBRASTER\fR (lx, ly, nx, ny, pix, ier) + +\fBCDS_SELECTFB\fR (nx, ny, fb, w, h, nf, reset) +\fBCDS_SETFBCONFIG\fR (configno) +\fBCDS_GETFBCONFIG\fR (configno, w, h, nf) +\fBCDS_LOOKUPFBSIZE\fR (configno, w, h, nf) + +\fBCDS_SETZTRANS\fR (ztrans) +\fBCDS_SETZSCALE\fR (z1, z2) +\fBCDS_SETSAMPLE\fR (nsample) +\fBCDS_SETSAMPLELINES\fR (nlines) +\fBCDS_SETCONTRAST\fR (contrast) +\fBCDS_SETNAME\fR (imname) +\fBCDS_SETTITLE\fR (imtitle) + +\fBCDS_GETFRAME\fR (frame) +\fBCDS_GETZTRANS\fR (ztrans) +\fBCDS_GETZSCALE\fR (z1, z2) +\fBCDS_GETSAMPLE\fR (nsample) +\fBCDS_GETSAMPLELINES\fR (nlines) +\fBCDS_GETCONTRAST\fR (contrast) +\fBCDS_GETNAME\fR (imname) +\fBCDS_GETTITLE\fR (imtitle) + +\fBCDS_MAPFRAME\fR (frame, ier) +\fBCDS_MARKPOINT\fR (x, y, number, size, type, color, ier) +\fBCDS_MARKPOINTLABEL\fR (x, y, label, size, type, color, ier) +\fBCDS_MARKLINE\fR (xs, ys, xe, ye, color, ier) +\fBCDS_MARKBOX\fR (lx, ly, ux, uy, fill, color, ier) +\fBCDS_MARKPOLYGON\fR (xarray, yarray, npts, fill, color, ier) +\fBCDS_MARKPOLYLINE\fR (xarray, yarray, npts, color, ier) +\fBCDS_MARKCIRCLE\fR (x, y, radius, fill, color, ier) +\fBCDS_MARKCIRCANNULI\fR (x, y, radius, nannuli, sep, color, ier) +\fBCDS_MARKELLIPSE\fR (x, y, xrad, yrad, rotang, fill, color, ier) +\fBCDS_MARKELLIPANNULI\fR (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +\fBCDS_MARKTEXT\fR (x, y, str, size, angle, color, ier) +\fBCDS_SETFONT\fR (font) +\fBCDS_DELETEMARK\fR (x, y, ier) +\fBCDS_CLEAROVERLAY\fR (ier) +\fBCDS_REDRAWOVERLAY\fR (ier) +.TE diff --git a/vendor/x11iraf/cdl/doc/cdlref.ms-V1.6 b/vendor/x11iraf/cdl/doc/cdlref.ms-V1.6 new file mode 100644 index 00000000..a97147be --- /dev/null +++ b/vendor/x11iraf/cdl/doc/cdlref.ms-V1.6 @@ -0,0 +1,2512 @@ +.RP +.de us +\\$1\l'|0\(ul' +.. +.TL +A Reference Guide for the IRAF Client Display Library (CDL) +.AU +Michael Fitzpatrick +.AI +NOAO/IRAF Group +.sp 0.5 +February 1997 +.sp 0.5 +\fIRevised March 1998\fR + +.AB +The Client Display Library (CDL) is a host interface for C, Fortran or SPP +programs allowing them to display images or overlay graphics to display +servers such as \fIXImtool\fR or \fISAOimage / SAOtng\fR. High-level +procedures allow IRAF or FITS images to be displayed simply, other +routines permit access to all other server functions (e.g. cursor and image +readback, frame selection, etc). The library also features a number of +functions for doing image overlay graphics; supported graphics primitives +include numerous point shapes, lines, circles, ellipses, polygons, annular +shapes, and text. +.AE + +.pn 1 +.bp +.ce +.ps +3 +\fBContents\fR +.ps -3 +.sp 2 +1\h'|0.25i'\fBIntroduction\fP\l'|5.6i.'\0\01 +.sp 0.5 +2\h'|0.25i'\fBGetting Started\fP\l'|5.6i.'\0\01 +.sp 0.5 +3\h'|0.25i'\fBServer Connections\fP\l'|5.6i.'\0\02 +.br +\h'|0.25i'3.1\h'|0.75i'Domain Sockets\l'|5.6i.'\0\02 +.br +\h'|0.25i'3.2\h'|0.75i'Named FIFO Pipes\l'|5.6i.'\0\03 +.br +\h'|0.25i'3.3\h'|0.75i'Inet Sockets\l'|5.6i.'\0\03 +.br +\h'|0.25i'3.4\h'|0.75i'User-Defined Connections\l'|5.6i.'\0\03 +.sp 0.5 +4\h'|0.25i'\fBImage Display\fP\l'|5.6i.'\0\03 +.br +\h'|0.25i'4.1\h'|0.75i'Overview of the Display Process\l'|5.6i.'\0\03 +.br +\h'|0.25i'4.2\h'|0.75i'Displaying IRAF Images\l'|5.6i.'\0\04 +.br +\h'|0.25i'4.3\h'|0.75i'Displaying FITS Images\l'|5.6i.'\0\04 +.br +\h'|0.25i'4.4\h'|0.75i'Displaying Raw Pixels\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.5\h'|0.75i'Frame Selection\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.6\h'|0.75i'Clearing the Display\l'|5.6i.'\0\05 +.br +\h'|0.25i'4.7\h'|0.75i'Frame Buffer Selection\l'|5.6i.'\0\05 +.br +\h'|0.4i'4.7.1\h'|0.95i'Automatic Selection\l'|5.6i.'\0\06 +.br +\h'|0.4i'4.7.2\h'|0.95i'The Frame Buffer Configuration File\l'|5.6i.'\0\06 +.br +\h'|0.25i'4.8\h'|0.75i'Image WCS Description\l'|5.6i.'\0\06 +.br +\h'|0.25i'4.9\h'|0.75i'Image Colormaps\l'|5.6i.'\0\07 +.br +\h'|0.4i'4.9.1\h'|0.95i'Imtool Color Model\l'|5.6i.'\0\07 +.br +\h'|0.25i'4.10\h'|0.75i'ZScale Intensity Mapping\l'|5.6i.'\0\08 +.br +\h'|0.25i'4.11\h'|0.75i'Image Hardcopy\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.12\h'|0.75i'Image Cursor\l'|5.6i.'\0\09 +.br +\h'|0.4i'4.12.1\h'|0.95i'Cursor Sampling\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.13\h'|0.75i'Image Readout\l'|5.6i.'\0\09 +.br +\h'|0.25i'4.14\h'|0.75i'Subraster I/O\l'|5.6i.'\0\09 +.sp 0.5 +5\h'|0.25i'\fBGraphics Overlay\fP\l'|5.6i.'\010 +.br +\h'|0.25i'5.1\h'|0.75i'Marker Coordinates\l'|5.6i.'\010 +.br +\h'|0.25i'5.2\h'|0.75i'Mapping a Previously Displayed Image\l'|5.6i.'\010 +.br +\h'|0.25i'5.3\h'|0.75i'Marking a Coordinate File\l'|5.6i.'\010 +.br +\h'|0.25i'5.4\h'|0.75i'Marker Colors\l'|5.6i.'\010 +.br +\h'|0.25i'5.5\h'|0.75i'Marker Types\l'|5.6i.'\011 +.br +\h'|0.4i'5.5.1\h'|0.95i'Point\l'|5.6i.'\011 +.br +\h'|0.4i'5.5.2\h'|0.95i'Line\l'|5.6i.'\011 +.br +\h'|0.4i'5.5.3\h'|0.95i'Box\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.4\h'|0.95i'Circle\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.5\h'|0.95i'Polyline\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.6\h'|0.95i'Polygon\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.7\h'|0.95i'Ellipse\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.8\h'|0.95i'Circular Annuli\l'|5.6i.'\012 +.br +\h'|0.4i'5.5.9\h'|0.95i'Elliptical Annuli\l'|5.6i.'\013 +.br +\h'|0.4i'5.5.10\h'|0.95i'Text\l'|5.6i.'\013 +.br +\h'|0.25i'5.6\h'|0.75i'Text Fonts\l'|5.6i.'\013 +.br +\h'|0.4i'5.6.1\h'|0.95i'In-line Font Changes\l'|5.6i.'\013 +.br +\h'|0.25i'5.7\h'|0.75i'Line Widths and Styles\l'|5.6i.'\014 +.br +\h'|0.25i'5.8\h'|0.75i'Deleting Markers\l'|5.6i.'\014 +.br +\h'|0.4i'5.8.1\h'|0.95i'Individual Markers\l'|5.6i.'\014 +.br +\h'|0.4i'5.8.2\h'|0.95i'The Entire Overlay\l'|5.6i.'\015 +.br +\h'|0.25i'5.9\h'|0.75i'Redrawing the Overlay\l'|5.6i.'\015 +.sp 0.5 +6\h'|0.25i'\fBANSI C Function Prototypes\fP\l'|5.6i.'\015 +.sp 0.5 +7\h'|0.25i'\fBFortran Language Binding Notes\fP\l'|5.6i.'\015 +.sp 0.5 +8\h'|0.25i'\fBSPP Language Binding Notes\fP\l'|5.6i.'\015 +.sp 0.5 +9\h'|0.25i'\fBIIS Protocol Description\fP\l'|5.6i.'\016 +.sp 0.5 +10\h'|0.25i'\fBVXIMTOOL Proxy/Display Server Usage\fP\l'|5.6i.'\018 +.sp 0.5 +11\h'|0.25i'\fBC Interface Summary\fP\l'|5.6i.'\019 +.sp 0.5 +12\h'|0.25i'\fBC Example Tasks\fP\l'|5.6i.'\021 +.br +\h'|0.25i'12.1\h'|0.75i'Display Example\l'|5.6i.'\021 +.br +\h'|0.25i'12.2\h'|0.75i'Interactive Graphics Overlay Example\l'|5.6i.'\024 +.br +\h'|0.25i'12.3\h'|0.75i'Image Mosaic Example\l'|5.6i.'\028 +.sp 0.5 +13\h'|0.25i'\fBFortran Interface Summary\fP\l'|5.6i.'\030 +.sp 0.5 +14\h'|0.25i'\fBFortran Example Tasks\fP\l'|5.6i.'\032 +.br +\h'|0.25i'14.1\h'|0.75i'Display Example\l'|5.6i.'\032 +.br +\h'|0.25i'14.2\h'|0.75i'Interactive Graphics Overlay Example\l'|5.6i.'\033 +.sp 0.5 +15\h'|0.25i'\fBSPP Interface Summary\fP\l'|5.6i.'\035 +.pn 1 + +.NH +Introduction +.LP + For more than a decade IRAF has used a \fIdisplay server\fR as the +primary means for image display. IRAF client tasks connect to the server +and send or read data using a modification of the IIS Model 70 protocol, +originally through named fifo pipes but more recently using unix domain +or inet sockets. The advantage to this approach was that IRAF client tasks +could make use of the image display functionality without duplicating +the code needed for actually displaying the image. The longtime disadvantage +was that the IIS protocol used was arcane and undocumented and therefore +largely unavailable to applications outside of the IRAF project. The +Client Display Library (CDL) provides a public C and Fortran interface for +displaying images and overlay graphics that is independent of the underlying +protocol used. +.LP + Unlike the interface used by IRAF applications, the CDL is meant to +provide an easy-to-use, fully featured interface for applications that can +be easily evolved for future display servers, communications schemes, or +display functionality. Indeed, the CDL is independent of IRAF itself (as +are the display servers) so display tasks can be written for any discipline +or application. +.LP + While this guide assumes programs are written in C, Fortran programmers +should find the translation straightforward by referring to the Fortran +interface summary. The package source files include example tasks as does +this guide; users with problems, questions, or bug reports are encouraged to +contact \fIiraf@noao.edu\fR. A small code sample demonstrating the problem +would be very helpful in finding a solution to any reported problems. + +.NH +Getting Started +.LP + All C programs must include the header file \fB"cdl.h"\fR in order +to get package definitions for constants such as colors and structure +definitions used. The Fortran interface does not \fIrequire\fR anything +similar, however for fortran compilers which support an \f(CWinclude\fR +directive a \fBcdlftn.inc\fR file may be used to define symbolic constants +passed to procedures, this file must be included by each procedure using the +CDL. Fortran programs not using this file must pass in the constants +explicitly, needed values are found throughout this manual. C procedures +which return an integer value will return a positive number to indicate an +error has occurred and print an error message, otherwise zero is returned. +.LP + The \fBcdl_open()\fR procedure is used to establish a connection +to the server and initialize the package, it returns a CDL structure pointer +that is passed to other CDL procedures. For C programs this means +a separate pointer may be maintained for each server connection, the Fortran +interface is limited to only one server connection per process since the +pointer is maintained internally. The connection is terminated using the +\fBcdl_close()\fR procedure. Between these two calls may be any combination +of CDL procedure calls for doing image display or overlay graphics. +.LP + For example, the simplest possible program for displaying an IRAF +image would look something like: +.sp 0.5 +.nf + \f(CW#include "cdl.h" + + main (int argc, char *argv[]) + { + CDLPtr cdl = cdl_open ((char *)0); + cdl_displayIRAF (cdl, argv[1], 1, 1, 1, 1); + cdl_close (cdl); + }\fR +.fi +.sp 0.5 +.LP +This program displays band one of an image named on the command line to the +server in frame one using the default 512x512 frame buffer, zscaling the +pixels to 8-bit values automatically. No error checking is performed to verify +that a connection was established or that the argument is a valid IRAF image. +Most programs will be more complex than this but it should be clear that +image display from client applications is a now trivial operation. + +.us "Synopsis" +.sp 0.5 +.nf + \f(CW#include "cdl.h"\fR + + \f(CWCDLPtr cdl_open (char *imtdev)\fR + \f(CWvoid cdl_close (CDLPtr cdl)\fR +.fi + +.NH +Server Connections +.LP + The \fBcdl_open()\fR procedure takes a single argument specifying the +type of connection to make to the server, this routine also initializes +the CDL package. If this is a NULL pointer the CDL will attempt to first +connect on a unix domain socket, if that fails the standard IRAF /dev/imt1* +fifo pipes are tried. The syntax for the \fIimtdev\fR argument is as follows: +.sp 0.5 + \f(CW :
\fR +.sp 0.5 +.LP +where is one of "\fBinet\fR" (internet tcp/ip socket), "\fBunix\fR" +(unix domain socket) or "\fBfifo\fR" (named pipe). The form of the address +depends upon the domain, as illustrated in the examples below. The address +field may contain up to two "%d" fields. If present, the user's UID will be +substituted (e.g. "unix:/tmp/.IMT%d"). The default connection if no imtdev +is specified is "unix:/tmp/.IMT%d", failing that a connection is attempted +on the /dev/imt1[io] named fifo pipes. +.NH 2 +Domain Sockets +.LP + Domain sockets are sockets created on the local host. The connection +is usually faster than an inet socket and comparable to a fifo. If the +socket name is specified with a '%d' field the client can be assured of a +unique socket name for each user allowing multiple clients to be run on the +same host by different users. +.LP +.us "Example" +.sp 0.5 +.nf +\f(CW + /* Connection to a local host using socket domain socket. */ + if ((cdl = cdl_open ("unix:/tmp/.IMT%d")) == NULL) { + fprintf (stderr, "cannot open domain socket connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +Named FIFO Pipes +.LP + This is the traditional approach, and the only one supported by +SAOimage (although recent versions contain support for sockets). Any named +fifo pipe may be used, the syntax for the \fIimtdev\fR string in this case is +.sp 0.5 + \fBfifo:\f(CW\fB:\f(CW\fR +.sp 0.5 +.LP +.us "Example" +.sp 0.5 +.nf + \f(CW/* Connection to a local host using named fifo pipes. */ + if ((cdl = cdl_open ("fifo:/dev/imt1i:/dev/imt1o")) == NULL) { + fprintf (stderr, "cannot open fifo pipe connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +Inet Sockets +.LP + Inet sockets are connections between hosts via a tcp/ip socket. +This permits connecting to the server over a remote network connection +anywhere on the Internet. +.LP +.us "Example" +.sp 0.5 +.nf + \f(CW/* Connection to a local host using socket 5137. */ + if ((cdl = cdl_open ("inet:5137")) == NULL) { + fprintf (stderr, "cannot open inet socket connection\\n"); + exit (1); + } + + /* Connection to a remote internet host using socket 5137. */ + if ((cdl = cdl_open ("inet:5137:foo.bar.edu")) == NULL) { + fprintf (stderr, "cannot open inet socket connection\\n"); + exit (1); + } \fR +.fi +.NH 2 +User-Defined Connections +.LP + Since IRAF V2.10.3 client tasks have been able to use an \fBIMTDEV\fR +unix environment variable to set the connection type, the syntax of this +variable is the same as described above. If the \fIcdl_open()\fR procedure +is called with a NULL pointer the IMTDEV environment variable will +automatically be checked. To explicitly use this (or any other) variable +in the client task the \fIcdl_open()\fR procedure may be called as +e.g. +.sp 0.5 +.nf + \f(CWif ((cdl = cdl_open (getenv("IMTDEV"))) == NULL) { + fprintf (stderr, "cannot open server connection\\n"); + exit (1); + }\fR +.fi +.NH +Image Display +.NH 2 +Overview of the Display Process +.LP + Basic image display is done most easily using the high-level +\fBcdl_displayIRAF()\fR, \fBcdl_displayFITS()\fR and \fBcdl_displayPix()\fR +procedures. These routines automatically define an image WCS, clear the +frame, set the frame buffer and center the image in the display. For most +applications these are all that will be needed, but the +\fBcdl_writeSubRaster()\fR procedure can also be used to display an image. +For example, to display one image in a mosaic or other cases where +the task needs low-level access to position the image or write raw pixel +values. +.LP + In these cases it is the responsibility of the client program to +prepare the server for display. The basic steps involved in displaying an +image include +.sp 0.5 +.TS +center; +lB lB +- - +l lI. +Operation CDL Procedure +Selecting the frame cdl_setFrame() +Clear the frame cdl_clearFrame() +Select the frame buffer configuration cdl_selectFB() +Set the frame buffer configuration cdl_setFBConfig() +Scale the image pixels to 201 display values cdl_zscaleImage() +Define the image WCS +Set the image WCS cdl_setWCS() +Compute the raster placement in the frame buffer +Write the pixels to the display cdl_writeSubRaster() +.TE +.sp 0.5 +In cases like a mosaic display obviously clearing the frame will only need +to be done once and a single WCS for the mosaic should be defined. For +simple display the high-level routines handle all of these steps for you, they +are included here as checklist of what must be considered when using the CDL +for low-level display. +.NH 2 +Displaying IRAF Images +.LP + The \fBcdl_displayIRAF()\fR procedure can be used to display an + IRAF OIF format image (i.e. images with a \fI.imh\fR extension) by +simply passing in the image name. Pixel files for the image must be +accessible from the local machine but can be in any directory, the HDR$ +syntax for the imdir is also recognized. Images may be three dimensional, +the \fIband\fR argument is used to select the image band to be displayed. +The \fIframe\fR and \fIfbconfig\fR arguments select the frame and frame +buffer size respectively, the special symbolic value \fBFB_AUTO\fR may be +used for the \fIfbconfig\fR argument to have the procedure automatically +select the frame buffer most appropriate for the image size. +If the \fIzscale\fR flag is greater than zero +the image will automatically be converted to 8-bit values using the zscale +mapping algorithm. The function returns a positive value if the image +cannot be accessed or displayed for any reason, an error message will be +printed. +.LP + The \fIcdl_isIRAF()\fR procedure returns a positive value if the +filename argument is recognized as an IRAF image, it does not check whether +the pixel file can be successfully accessed. For simply reading the pixels +from an IRAF image the \fBcdl_readIRAF()\fR procedure may be used. The +function returns a zero value and sets the output pixel array, image +dimensions and pixel size if successful, otherwise the function returns a +positive value. Note that +the output pixel values may need to be scaled before they can be displayed. + +.us "Synopsis" +.nf + \f(CWint cdl_displayIRAF (CDLPtr cdl, char *fname, int band, + int frame, int fbconfig, int zscale)\fR + \f(CWint cdl_isIRAF (char *fname)\fR + \f(CWint cdl_readIRAF (char *fname, int band, uchar **pix, + int *nx, int *ny, int *bitpix, char *title)\fR +.fi +.NH 2 +Displaying FITS Images +.LP + The \fBcdl_displayFITS()\fR procedure can be used to display a +\fIsimple\fR FITS image by name. A "simple" FITS file is assumed to be +one containing a single image and having no extensions. Other types of +FITS files may of course be displayed but the client will have to use other +means to import the pixels. FITS image extensions may be supported in a future +release of the CDL. The \fIframe\fR and \fIfbconfig\fR +arguments select the frame and frame buffer size respectively, +the special symbolic value \fBFB_AUTO\fR may be +used for the \fIfbconfig\fR argument to have the procedure automatically +select the frame buffer most appropriate for the image size. +If the +\fIzscale\fR flag is greater than zero the image will automatically be +converted to 8-bit values using the zscale mapping algorithm. The function +returns a positive value if the image cannot be accessed or displayed for +any reason, an error message will be printed. +.LP + The \fIcdl_isFITS()\fR procedure returns a positive value if the +filename argument is recognized as a simple FITS image. For simply reading +the image pixels the \fBcdl_readFITS()\fR procedure may be used. The +output pixel array, image dimensions and pixel size are returned if +successful otherwise the function returns a positive value. Note that +the returned pixel values may need to be scaled before they can be displayed. + +.us "Synopsis" +.nf + \f(CWint cdl_displayFITS (CDLPtr cdl, char *fname, int frame, + int fbconfig, int zscale)\fR + \f(CWint cdl_isFITS (char *fname)\fR + \f(CWint cdl_readFITS (char *fname, uchar **pix, int *nx, int *ny, + int *bitpix, char *title)\fR +.fi +.NH 2 +Displaying Raw Pixels +.LP + The \fBcdl_displayPix()\fR procedure can be used to display an +arbitrary array of pixels of any size. The \fInx\fR and \fIny\fR arguments +are the raster dimensions, and \fIbitpix\fR is the pixel size and has the +same meaning as the FITS BITPIX keyword. The \fIframe\fR and \fIfbconfig\fR +arguments select the frame and frame buffer size respectively, +the special symbolic value \fBFB_AUTO\fR may be +used for the \fIfbconfig\fR argument to have the procedure automatically +select the frame buffer most appropriate for the image size. +If the +\fIzscale\fR flag is greater than zero the image will automatically be +converted to 8-bit values using the zscale mapping algorithm. + +.us "Synopsis" +.nf + \f(CWint cdl_displayPix (CDLPtr cdl, uchar *pix, int nx, int ny, + int bitpix, int frame, int fbconfig, int zscale)\fR +.fi +.NH 2 +Frame Selection +.LP + Frame selection is normally done as an argument to one of the display +procedures, however frames may be explicitly selected using the +\fBcdl_setFrame()\fR procedure. This allows client programs to essentially +"blink" frames independently, as long as the server supports multiple frames. +The \fBcdl_getFrame()\fR procedure may be used to get the current frame +set in the server. + +.us "Synopsis" +.nf + \f(CWvoid cdl_setFrame (CDLPtr cdl, int frame)\fR + \f(CWvoid cdl_getFrame (CDLPtr cdl, int *frame)\fR +.fi +.NH 2 +Clearing the Display +.LP + The current display frame may be explicitly cleared using the +\fBcdl_clearFrame()\fR procedure. The frame is also cleared prior to +displaying new images by the procedures \fBcdl_displayPix()\fR, +\fBcdl_displayFITS()\fR, and \fBcdl_displayIRAF()\fR. + +.us "Synopsis" +.nf + \f(CWint cdl_clearFrame (CDLPtr cdl)\fR +.fi +.NH 2 +Frame Buffer Selection +.LP + The default frame buffer used is 512x512, other sizes may be +selected using the \fBcdl_setFBConfig()\fR procedure. To set the frame +buffer size the client passes the frame buffer number as defined in +the frame buffer configuration file (see below) while setting the image +WCS. It is important to note that the frame buffer isn't actually changed +in the server +until a subsequent \fBcdl_setWCS()\fR call, either directly or through +some other procedure which sets the WCS (e.g. one of the display procedures). +.LP + To get the size of the currently defined frame buffer the user +may call the \fBcdl_getFBConfig()\fR procedure. This returns not only +the current configuration number, but the size as well. To get the size +and any arbitrary configuration without actually setting it, the +\fBcdl_lookupFBSize()\fR procedure may be used. Any configuration not actually +defined in the frame buffer configuration file is returned as the default +512x512 size. + +.us "Synopsis" +.nf + \f(CWvoid cdl_setFBConfig (CDLPtr cdl, int configno)\fR + \f(CWvoid cdl_getFBConfig (CDLPtr cdl, int *configno, int *width, + int *height, int *nframes)\fR + \f(CWvoid cdl_lookupFBSize (CDLPtr cdl, int configno, int *width, + int *height, int *nframes)\fR +.fi +.NH 3 +Automatic Selection +.LP + The \fBcdl_selectFB()\fR procedure may be used to select the most +appropriate frame buffer to use for a given image size. If possible a frame +buffer the same size as the image will be used, otherwise one that is +larger will be chosen. Rather than simply selecting the first configuration +larger than the image, the procedure searches the entire configuration file +selecting the one with the least empty space in both dimensions. If the +\fIreset\fR flag is non-zero this frame is set automatically by the +procedure, otherwise the selected dimension is simply returned to the +calling program. In either case the new frame buffer will not take effect +until a new WCS is defined for the frame. + +.us "Synopsis" +.nf + \f(CWvoid cdl_selectFB (CDLPtr cdl, int nx, int ny, int *fb, + int *w, int *h, int *nf, int reset) +. +.NH 3 +The Frame Buffer Configuration File +.LP + The size of the frame buffer is not passed directly to the server +since this is not part of the communications protocol used. Instead, the +frame buffer number is sent as part of the WCS header packet. So that +both the server and client can know that a particular frame buffer number +corresponds to a specific size, a \fIframe buffer configuration file\fR +is used which both the client and server read. +.LP + The default configuration file is /usr/local/lib/imtoolrc, this can +be overridden by defining an \fBIMTOOLRC\fR environment variable naming +the file to be used, or by creating a .imtoolrc file in your home directory. +Since the server must also read the same file, this must be done before +starting both the client and server applications. +.LP +The format of the frame buffer configuration file is +.sp 0.5 + \fIconfigno nframes width height [extra fields]\fP +.sp 0.5 +e.g. +.sp 0.5 + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 4 frames, configuration numbers need not be sequential but should be +in ascending order. +.NH 2 +Image WCS Description +.LP + The image WCS is defined using the \fBcdl_setWCS()\fR procedure. The +WCS defines a mapping between any linear coordinate system and the image +pixels, for our purposes we will discuss how the WCS is used to map the frame +buffer pixels to image coordinates. It is passed to the server in a string +of the form: +.sp 0.5 + Image_Name_String\\n a b c d tx ty z1 z2 zt +.sp 0.2 +where: +.sp 0.2 + X' = a*X + c*Y + tx + Y' = b*X + d*Y + ty + +The terms \fIa, b, c\fR, and \fId\fR define a rotation of the WCS wrt the pixel +coordinates, the \fItx\fR and \fIty\fR values are translation terms. The +remaining three values define the intensity mapping of the display pixels; +\fIz1\fR is the minimum pixel value used in the transformation, \fIz2\fR is +the maximum value, and \fIzt\fR defines the type of transformation used (0 for +none, 1 for linear, 2 for log10). +.LP + The WCS may be set explicitly by the calling program or a default +appropriate for the image will be set automatically by the high-level +display procedures, otherwise a WCS for the +frame buffer is defined (i.e. returned coordinates are frame buffer coords). +As an example of how the WCS is defined, the default WCS for an image +IMX x IMY pixels in a frame buffer FBX x FBY pixels is defined as +.sp 0.5 +.nf +\f(CW a = 1.0; /* no rotation */ + b = 0.0; + c = 0.0; + d = -1.0; + tx = (IMX / 2) - (FBX / 2) + 1; /* center in FB */ + ty = (FBY / 2) + (IMY / 2); + z1 = z1; /* zscale values */ + z2 = z2; + zt = 1;\fR +.fi + +.us "Synopsis" +.nf + \f(CWint cdl_setWCS (CDLPtr cdl, char *name, char *title, + float a, float b, float c, float d, float tx, float ty, + float z1, float z2, int zt)\fR + \f(CWint cdl_getWCS (CDLPtr cdl, char *name, char *title, + float *a, float *b, float *c, float *d, float *tx, float *ty, + float *z1, float *z2, int *zt)\fR +.fi +.NH 2 +Image Colormaps +.LP + The IIS protocol used does not permit the downloading of user-defined +colormaps, all images are loaded as raw grayscale values according to the +XImtool colormap model used by currently supported servers. All images +containing private colormaps or more than the 201 grayscale values defined +by the Imtool colormap model must either convert the image to 8-bit +grayscale values by calling the CDL zscale procedures (\fBcdl_computeZscale()\fR +and \fBcdl_zscaleImage()\fR) or scale the images in client code with +user LUTs. The CDL zscale procedures scale image to 201 grayscale values +so that they are displayed to the full 8-bit range, user LUT +transformations or user code for converting to grayscale from a private +colormap procedures should do the same. +.NH 3 +Imtool Color Model +.LP + The IMTOOL color model defines at most 201 grayscale values for use in +displaying the image, a set of 16 static colors are also defined for overlay +graphics. Pixel values sent to the server should be already scaled to this +model, i.e. the image pixels should be scaled to the range 1-200, values +above this will either represent the overlay colors or will wrap around to +8-bit values. The CDL zscale procedures will automatically scale +arbitrary pixel values to use this color model, the overlay procedures +assume color values are defined for the static color range 201-217 but any +8-bit value may be used. +.LP + A summary of the color model values is included below: +.TS +center; +lB lB cB cB lB lB +l l c c l l. +Color Description Color Description +0 Background 208 Cyan +1 - 200 Image data 209 Magenta +201 Cursor (white) 210 Coral +202 Background (black) 211 Maroon +203 White 212 Orange +204 Red 213 Khaki +205 Green 214 Orchid +206 Blue 215 Turquoise +207 Yellow 216 Violet +217 Wheat 218-255 undefined +.TE +.NH 2 +ZScale Intensity Mapping +.LP + Since most display servers are only capable of displaying 8-bit pixel +values, images with more than 8-bits per pixel must be scaled prior to +display. For linear transformations this is typically done using a simple +conversion of the image min/max values to the 256 grayscale values, however +this doesn't produce very good results when most pixel values are near one +of the extremes (usually the image min for astronomical images). To solve +this IRAF uses a \fIzscale\fR mapping algorithm where a sampling grid is used +to approximate the image min/max values rather than computing it directly, +a line is then fit to these sample pixels to determine the optimal +transformation to the display values. This is not only more efficient but +maps the most common pixel values to the display range producing a better image. +.LP + The CDL has several routines for doing the same transformation: the +\fIcdl_computeZscale()\fR procedure is used to compute the optimal \fIz1\fR +and \fIz2\fR +values (the min/max used for the zscale transform) for an image of any pixel +size. The \fIbitpix\fR argument is the number of bits-per-pixel for the input +array and has the same meaning as for the FITS \fIBITPIX\fR keyword. To then +transform the image using these values (or user-defined values) the +\fIcdl_zscaleImage()\fR procedure is used. The input pixels are modified by +this procedure but the array is not reallocated to the smaller size needed by +an 8-bit array. The \fBcdl_setSample()\fR and \fBcdl_setSampleLines()\fR +procedures can be used to change the sampling grid and number of sample +points (the default is 600 points on 5 lines). The \fBcdl_setContrast()\fR +procedure can be used to change the default contrast adjustment to the slope +used in the transformation (the default is 0.25). If a value of zero is +given then the minimum and maximum of the intensity sample is used as the +z1/z2 value. +.LP + Each of the CDL display procedures has a \fIzscale\fR flag to +automatically scale the pixels prior to display. Applications wishing to +set their own z1/z2 values will need to call the zscale procedures and +disable this flag. By default cdl_zscaleImage() will use a linear transform, +the \fBcdl_setZTrans()\fR procedure may be used to change this. Acceptable +values are \fBCDL_UNITARY\fR (zero) for a unitary transform, \fBCDL_LINEAR\fR +(one) for a linear transform, or \fBCDL_LOG\fR (two) for a log10 transform. + +.us "Synopsis" +.nf + \f(CWvoid cdl_computeZscale (CDLPtr cdl, uchar *pix, int nx, + int ny, int bitpix, float *z1, float *z2)\fR + \f(CWvoid cdl_zscaleImage (CDLPtr cdl, uchar **pix, int nx, + int ny, int bitpix, float z1, float z2)\fR + + \f(CWvoid cdl_setZTrans (CDLPtr cdl, int ztrans)\fR + \f(CWvoid cdl_getZTrans (CDLPtr cdl, int *ztrans)\fR + \f(CWvoid cdl_setZScale (CDLPtr cdl, float z1, float z2)\fR + \f(CWvoid cdl_getZScale (CDLPtr cdl, float *z1, float *z2)\fR + + \f(CWvoid cdl_setSample (CDLPtr cdl, int nsample)\fR + \f(CWvoid cdl_setSampleLines (CDLPtr cdl, int nlines)\fR + \f(CWvoid cdl_setContrast (CDLPtr cdl, float contrast)\fR + \f(CWvoid cdl_getSample (CDLPtr cdl, int *nsample)\fR + \f(CWvoid cdl_getSampleLines (CDLPtr cdl, int *nlines)\fR + \f(CWvoid cdl_getContrast (CDLPtr cdl, float *contrast)\fR + +.fi +.NH 2 +Image Hardcopy +.LP + While most servers include some hardcopy capability of their own the +CDL provides two procedures for creating hardcopy images from the client +(e.g. for a batch processing application). The client will typically read +back the entire image, frame buffer, of just a subraster and pass those +pixels to the print procedure. Images will be written as Pseudocolor +Postscript (to preserve the overlay marker colors) and may be disposed to +a file using the \fBcdl_printPixToFile()\fR procedure or to any command string +accepting input from \fIstdin\fR (typically just an 'lpr' command) by using +the \fBcdl_printPix()\fR procedure. + +.us "Synopsis" +.nf + \f(CWint cdl_printPix (CDLPtr cdl, char *cmd, uchar *pix, int nx, + int ny, int annotate)\fR + \f(CWint cdl_printPixToFile (CDLPtr cdl, char *fname, uchar *pix, + int nx, int ny, int annotate)\fR +.fi +.NH 2 +Image Cursor +.LP + The image cursor is read using the \fBcdl_readCursor()\fR procedure. +The returned value is the cursor \fI(x,y)\fR position as floating point value +in terms of the currently define image WCS. Note that this position must +be converted to integer if it is to be used in one of the marker procedures. + +.us "Synopsis" +.nf + \f(CWint cdl_readCursor (CDLPtr cdl, int sample, float *x, + float *y, int *wcs, char *key)\fR +.fi + +The \fIwcs\fR argument is defined as + +.nf + wcs = frame * 100 + wcs_number +.fi + +(where wcs_number=0 for frame buffer coords and 1 for image coords). So, +you can get the frame as simply + +.nf + frame = (int) (wcs / 100) +.fi + +.NH 3 +Cursor Sampling +.LP + If the cdl_readCursor() \fIsample\fR flag is non-zero the \fIlogical +image cursor\fR position is returned immediately, otherwise the display server +will wait for a keystroke before returning the cursor position. The logical +image cursor is the last value set by a \fIcdl_setCursor()\fR call or the last +value returned by a \fIcdl_readCursor()\fR call. When sampling the cursor +position the keystroke value is undefined. +.NH 2 +Image Readout +.LP + The CDL maintains an internal knowledge of where an image has been +positioned if it was displayed using one of the \fIcdl_display*\fR procedures. +The \fBcdl_readImage()\fR procedure may be used to read back the entire image +pixels from the server ignoring the region of the frame buffer outside of +the image, the \fBcdl_readFrameBuffer()\fR procedure will read back the +contents of the entire frame buffer. The dimensions of the array are returned +in the \fInx\fR and \fIny\fR arguments. + +.us "Synopsis" +.nf + \f(CWint cdl_readImage (CDLPtr cdl, uchar **pix, int *nx, + int *ny)\R + \f(CWint cdl_readFrameBuffer (CDLPtr cdl, uchar **pix, + int *nx, int *ny)\R +.fi +.NH 2 +Subraster I/O +.LP + The \fBcdl_writeSubRaster()\fR procedure is used to write an arbitrary +raster to any location in the display. Similarly the +\fBcdl_readSubRaster()\fR procedure is used to read back an arbitrary raster. +When an image has previously been displayed the subraster position is given +in image coordinates (e.g. when writing a subregion of edited pixels), +otherwise the position is in frame buffer coordinates (e.g. to display +multiple images per frame you should use the cdl_writeSubRaster() call). +See the section on \fIMarker Coordinates\fR for further explanation of the +coordinate systems used. + +.us "Synopsis" +.nf + \f(CWint cdl_writeSubRaster (CDLPtr cdl, int lx, int ly, int nx, + int ny, uchar *pix)\fR + \f(CWint cdl_readSubRaster (CDLPtr cdl, int lx, int ly, int nx, + int ny, uchar **pix)\fR +.fi +.NH +Graphics Overlay +.NH 2 +Marker Coordinates +.LP + All marker positions are assumed to be image pixel coordinates, +although there is no requirement that the position be on the image itself. +When an image WCS is defined (using the CDL display procedures or explicitly) +the origin of the coordinates used shifts from the frame buffer lower-left +to the lower-left of the image as displayed in the frame. Negative +positions are allowed and will either refer to empty pixels if the frame +buffer is larger than the image, or pixels outside the frame buffer +boundaries. Raster I/O requests will be clipped to the frame buffer +endpoints, a request completely outside the frame buffer is an error. +.NH 2 +Mapping a Previously Displayed Image +.LP + Ideally any application wishing to draw markers on an image will have +also displayed that image, however the \fBcdl_mapFrame()\fR procedure may +be used to map the requested frame for marker overlay. It does this by +reading the WCS defined for that frame and assumes an image has been +displayed and centered in the frame buffer, then resets the internal CDL +image position. If no image has been displayed the frame buffer is mapped +directly. This can be used for example to map an empty frame for displaying +just the markers without an image, or for mapping another frame's WCS for +use on the current display. The frame is not changed by the procedure call +however the current WCS \fIis\fR changed. + +.us "Synopsis" +.nf + \f(CWint cdl_mapFrame (CDLPtr cdl, int frame)\fR +.fi +.NH 2 +Marking a Coordinate File +.LP + Since a common function for programs will be to mark a list of +coordinates, the high-level \fBcdl_markCoordsFile()\fR procedure is +provided to make this easier. The input parameters include a filename +expected to contain a set of (x,y) points (real or integer), and arguments +specifying the point type, size and color to draw. If the \fIlabel\fR +argument is positive each marker point will be labeled with it's relative +number in the file. The size, type and color arguments all have the same +meaning as for the \fBcdl_markPoint()\fR procedure described below. + +.us "Synopsis" +.nf + \f(CWint cdl_markCoordsFile (CDLPtr cdl, char *fname, int type, + int size, int color, int label)\fR +.fi +.NH 2 +Marker Colors +.LP + Markers may be drawn using any 8-bit value, in order to use the +static overlay colors the color must be in the range 201-217 (see above for +notes on the XImtool color model). The "\fIcdl.h\fR" include file +for C programs, the "\fIcdlftn.inc\fR" include for fortran programs, +or the "\fIcdlspp.h\fR" include for SPP programs, defines the following +symbolic constants for each of the static overlay colors: +.sp 0.5 +.TS +center; +lB l c c lB l. +C_BLACK 202 C_CORAL 210 +C_WHITE 203 C_MAROON 211 +C_RED 204 C_ORANGE 212 +C_GREEN 205 C_KHAKI 213 +C_BLUE 206 C_ORCHID 214 +C_YELLOW 207 C_TURQUOISE 215 +C_CYAN 208 C_VIOLET 216 +C_MAGENTA 209 C_WHEAT 217 +.TE +.NH 2 +Marker Types +.LP + Currently supported marker types include: \fI +.TS +center; +l l l l l. +Point Line Box Polyline Polygon +Circle Circular Annuli Ellipse Elliptical Annuli Text +.TE +.LP + \fRThe "\fIcdl.h\fR" include file for C programs, the +"\fIcdlftn.inc\fR" include for fortran programs, or the "\fIcdlspp.h\fR" +include file SPP programs, defines the following symbolic constants for +each of the defined \fIPoint\fR marker types: +.TS +center; +lB r c c lB r. +M_FILL 1 M_CIRCLE 64 +M_POINT 2 M_STAR 128 +M_BOX 4 M_HLINE 256 +M_PLUS 8 M_VLINE 512 +M_CROSS 16 M_HBLINE 1024 +M_DIAMOND 32 M_VBLINE 2048 +.TE +.LP + Point markers are drawn using the \fBcdl_markPoint()\fR procedure, +point types may be logically \fIOR\fR'd to create composite markers, closed +shapes such as a circles, diamonds, or squares may be \fIOR\fR'd with the +M_FILL flag to flood-fill the point with the current overlay color. +.NH 3 +Point +.LP + The \fBcdl_markPoint()\fR procedure is used to mark a specific point +on the image using one of the marker types listed above. The marker is +centered at the coordinates specified by the \fIx\fR and \fIy\fR arguments, +\fItype\fR is an integer flag indicating what kind of marker to draw and +may be a composite type by logically ORing two or more marker types. +\fISize\fR is the width and height of the marker measured in pixel unxits, +and \fIcolor\fR is the color used to draw the marker. If the \fInumber\fR +argument is greater than zero that number will be drawn next to the point +as a label, creating text labels for point markers can be done using the +\fIcdl_markPointLabel\fR procedure. +.LP + Most marker names are fairly obvious but several are worth special +mention: The M_DIAMOND, M_CIRCLE and M_BOX marker types may be logically +\fIOR\fRed with the M_FILL flag to produce a filled marker type. Unless +\fIOR\fRd with the M_POINT flag all point markers will leave the center +pixel unchanged. The M_HLINE and M_VLINE markers are most useful in +astronomical applications to mark an individual star, they are horizontal +and vertical lines respectively with a gap in the middle third of the marker +(the M_HBLINE and M_VBLINE are identical but with a width of 3 pixels). +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPoint (CDLPtr cdl, int x, int y, int number, + int size, int type, int color)\fR + \f(CWint cdl_markPointLabel (CDLPtr cdl, int x, int y, char *label + int size, int type, int color)\fR +.fi +.NH 3 +Line +.LP + The \fBcdl_markLine()\fR procedure is used to draw a line of the +specified color between points (\fIxs,ys\fR) and (\fIxe,ye\fR). +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markLine (CDLPtr cdl, int xs, int ys, int xe, int ye, + int color)\fR +.fi +.NH 3 +Box +.LP + The \fBcdl_markBox()\fR procedure is used to draw a box of the +specified color with endpoints specified by (\fIlx,ly\fR) and (\fIux,uy\fR). +If the \fIfill\fR flag is set the box will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markBox (CDLPtr cdl, int lx, int ly, int ux, int uy, + int fill, int color)\fR +.fi +.NH 3 +Circle +.LP + The \fBcdl_markCircle()\fR procedure is used to draw a circle of the +specified color with a center at (\fIx,y\fR) and radius \fIradius\fR. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markCircle (CDLPtr cdl, int x, int y, int radius, + int fill, int color)\fR +.fi +.NH 3 +Polyline +.LP + The \fBcdl_markPolyline()\fR procedure is used to draw a line +connecting the \fInpts\fR points specified by the \fIxpts\fR and +\fIypts\fR array in the desired \fIcolor\fR. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPolyline (CDLPtr cdl, int *xpts, int *ypts, + int npts, int color)\fR +.fi +.NH 3 +Polygon +.LP + The \fBcdl_markPolygon()\fR procedure is used to draw a closed +polygon consisting of \fInpts\fR vertices specified by the \fIxpts\fR and +\fIypts\fR array in the desired \fIcolor\fR. The last point in the array +will automatically be connected to the first point by the procedure. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markPolygon (CDLPtr cdl, int *xpts, int *ypts, + int npts, int fill, int color)\fR +.fi +.NH 3 +Ellipse +.LP + The \fBcdl_markEllipse()\fR procedure is used to draw an ellipse of the +specified color with a center at (\fIx,y\fR) and semimajor-axis \fIxrad\fR +and semiminor-axis \fIyrad\fR pixels long. A rotation angle for the ellipse +may be specified by passing a non-zero \fIangle\fR argument, the angle is +measured in degrees from the positive x-axis. +If the \fIfill\fR flag is set the circle will be filled with the marker color. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markEllipse (CDLPtr cdl, int x, int y, int xrad, + int yrad, float ang, int fill, int color)\fR +.fi +.NH 3 +Circular Annuli +.LP + The \fBcdl_markCircAnnuli()\fR procedure is used to draw +\fInannuli\fR circles separated by \fIsep\fR pixels each. The circle is +centered at (\fIx,y\fR) with an initial radius of \fIradius\fR pixels. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markCircAnnuli (CDLPtr cdl, int x, int y, int radius, + int nannuli, int sep, int color)\fR +.fi +.NH 3 +Elliptical Annuli +.LP + The \fBcdl_markEllipAnnuli()\fR procedure is used to draw +\fInannuli\fR ellipses separated by \fIsep\fR pixels each. The ellipse is +centered at (\fIx,y\fR) with an initial semimajor and semiminor axis +specified by the \fIxrad\fR and \fIyrad\fR arguments. Each ellipse will +be optionally rotate by an \fIangle\fR degrees as measured from the positive +x-axis. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markEllipAnnuli (CDLPtr cdl, x, y, xrad, yrad, ang, + int nannuli, int sep, int color)\fR +.fi +.NH 3 +Text +.LP + The \fBcdl_markText()\fR procedure is used to draw a text string +specified by \fIstr\fR argument with an initial position at (\fIx,y\fR) +and optionally rotated by \fIangle\fR degrees as measured from the positive +x-axis. The default \fIsize\fR is 1.0 and is approximately a 6x13 font, +the font size may be scaled by any fractional amount. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_markText (CDLPtr cdl, int x, int y, char *str, + float size, float angle, int color)\fR +.fi +.NH 2 +Text Fonts +.LP + The \fBcdl_setFont()\fR procedure is used to choose between one +of four available fonts as the text marker default: Roman, Greek, Futura, +Bold and Times respectively. By default the Roman font will be used. +The width of the lines used to draw the text may also be set. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWvoid cdl_setFont (CDLPtr cdl, int font)\fR + \f(CWvoid cdl_setTextWidth (CDLPtr cdl, int width)\fR +.fi +.sp 0.5 +A complete listing of the Greek character mappings can be found in the +file 'greek.ps' in the 'doc' subdirectory of the CDL distribution. + The \fIRoman\fR font is the font implemented in the original version +of the CDL and works well for most applications. Both the \fIGreek\fR and +\fITimes\fR fonts are hi-resolution fonts which work best for larger frame +buffers but can produce publication quality text. The \fIFutura\fR font +is a simpler font which can produce better results than the default on small +size frame buffers. A \fIBold\fR font automatically increases the text line +width by one pixel over the current setting and may be used with any font. +.NH 3 +In-Line Font Changes +.LP + Text markers are drawn using the font selected with +the \fIcdl_setFont()\fR +routine, however fonts may be change within a string itself (e.g. to set +a Greek character) using a \\f escape sequence. The escape is followed +by the character 'R' to set a Roman font, 'G' for Greek, 'F' for +futura, 'B' for bold +and 'T' for Times. Any number of escapes are permitted within a string, +the font change will remain in effect until it is changed, or the end of +string at which point any subsequent strings will again be drawn with the +default font. Additionally a 'P' in the escape sequence will change the +font to the one previously used, whatever that may be. +.LP + The CDL also supports a sub/superscripting of text which can only +be done with the font escapes. In this case the escape character followed by +a 'U' produces a superscript and a 'D' produces a subscript. The changes may +be nested permitting several levels of sub/superscripts, these escapes may +also be used in conjunction with a font change to cause the sub/superscript +to be drawn with a different font. A superscript escape will remain in +effect until the end of the string or a \\fD escape is seen. Similarly a +subscript remains in effect until the end of the string of a \\fU escape. +Sub/superscripted text is drawn using a smaller font size, there is presently +no way to specify a different size for the sub/superscripted text. +.TS +center; +cb s +l l. +Summary of Font Escapes +.sp 0.5 +\\\\fR change to Roman font +\\\\fG change to Greek font +\\\\fF change to Futura font +\\\\fT change to Times font +\\\\fB change to bold font +\\\\fP change to previous font +\\\\fU begin relative superscripted text +\\\\fD begin relative subscripted text +.TE +.NH 2 +Line Widths and Styles +.LP + The \fBcdl_setLineWidth()\fR procedure can be used to set the line +width used to draw polygon or polyline markers, point markers will not +be affected. The \fBcdl_setLineStyle()\fR procedure is used to set a line +style other than solid. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWvoid cdl_setLineWidth (CDLPtr cdl, int width)\fR + \f(CWvoid cdl_setLineStyle (CDLPtr cdl, int style)\fR +.fi +.LP + \fRThe "\fIcdl.h\fR" include file for C programs, the +"\fIcdlftn.inc\fR" include for fortran programs, or the "\fIcdlspp.h\fR" +include file SPP programs, defines the following symbolic constants for +each of the defined line styles: +.TS +center; +lB r c c lB r. +L_SOLID 0 L_DASHED 1 +L_DOTTED 2 L_DOTDASH 3 +L_HOLLOW 4 L_SHADOW 5 +.TE +.LP + The \fIhollow\fR line style is drawn with a linewidth of five pixels, +two pixels of color, a black line, and two pixels of color. It is best +used when the marker will traverse extreme changes in brightness, due to the +thickness of the line it may work best with larger frame buffers. The +\fIshadow\fR linestyle is drawn as two pixels of color and two pixels of black +and should be used for similar brightness variations, however it effectively +shows up as a line only two pixels wide and may be preferred for medium or +smaller frame buffers. +.LP + The three dashed linestyles are drawn using "gap" spacings of 5 +pixels in between line segments. Whether or not these gaps are resolved +depends on the size of the frame buffer being used and the magnification +used in the display server. By default they should resolve completely +using frame buffers up to 1024x1024 pixels, or magnification factors +displaying 1024x1024 pixels. If larger sizes are needed the image should +be subsampled prior to display to maintain the marker resolution needed +for these linestyles. + +.NH 2 +Deleting Markers +.LP + When markers are drawn the underlying subraster is first saved to +an internal structure, erasure is done by simply redisplaying the saved +raster. Problems can arise however when markers overlap; when deleting a +marker that is \fIunder\fR another marker the original pixels can overwrite +the pixels of the marker on top. This is an unfortunate side effect of the +simple scheme used in this version of the package, users can call the +\fBcdl_redrawOverlay()\fR procedure to help clean up any artifacts left +behind. +.NH 3 +Individual Markers +.LP + The \fBcdl_deleteMark()\fR procedure is used to delete a single +marker from the display(). The (\fIx,y\fR) argument is either the center +position of the marker if that is know by the application, more typically +it will be an approximate position. In the latter case the marker whose +center is closest to this position will be deleted. For markers with no +defined center the distance used to decide if the marker should be +deleted is the distance from the argument position to the edge of the +marker. For example, distance from a box or polygon is measured as the +distance from to one of the sides, for text it is the distance to the +start of the text string. There is no way to \fIun\fRdelete a marker other +than to redraw it. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_deleteMark (CDLPtr cdl, int x, int y)\fR +.fi +.NH 3 +The Entire Overlay +.LP + To erase all markers currently displayed use the +\fBcdl_clearOverlay()\fR procedure. Markers are erased in the reverse order +they were drawn to help reduce the chance that overlaying markers will leave +stray pixels. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_clearOverlay (CDLPtr cdl)\fR +.fi +.NH 2 +Redraw +.LP + The \fBcdl_redrawOverlay()\fR procedure can be used to redraw all +markers currently in the display list. This is sometimes needed when +subraster I/O procedures are used to redisplay subregions and overwrite +existing markers. +.sp 0.5 +.us "Synopsis" +.nf + \f(CWint cdl_redrawOverlay (CDLPtr cdl)\fR +.fi +.NH +ANSI C Function Prototypes +.LP + The current release of CDL provides full ANSI C function prototypes +for all public and private procedures. By default these will not be used +even on systems with native ANSI compilers, however. +To make use of the CDL prototypes users will +need to define the macro \fBCDL_ANSIC\fR either when compiling the program +(using the -D option to the compiler), +or as a definition in the program source preceding the 'cdl.h' include +directive. +.LP + For example, +.sp 0.5 +.nf + \f(CW#define CDL_ANSIC + #include "cdl.h" + : + main (int argc, char **argv) + :\fR +.fi +.sp 0.5 +or when compiling using something like +.sp 0.5 +.nf + \f(CWcc -DCDL_ANSIC client.c libcdl.a -lm\fR +.fi +.sp 0.5 + Note that when using CDL_ANSIC to build the client program it is +also required that the CDL itself be built in the same way to avoid +confusing FPE errors. Similarly, when building client tasks that \fIdo +not\fR +use CDL_ANSIC you must use a version of the library that has not been +compiled with prototypes. +.LP + The reason is that the float args to the CDL procedures in the +library, or in your task calls, are +promoted to doubles when compiling those procedures, but may only be passed as +floats in your code (or as double where the CDL is expecting float). +This means the argument stack is off by 4 bytes for each float arg and +the values interpreted by the CDL procedure will be corrupted. +If you're going to use the prototypes you'll +need to edit the CDL Imakefile to define "-DCDL_ANSIC" in the EXTRA_DEFINES +so it will use the prototypes and everything will line up. You will then +need to rebuild the libcdl.a as well as relink your program. +.NH +Fortran Language Binding Notes +.LP + The Fortran language binding routines are implemented in C but +should be accessible from any fortran program as though they were real +fortran subroutines. The calling sequences are the same as with the C +library routines with the following exceptions: +.IP +\(bu The CDL package pointer is maintained internally so no 'cdl' pointer is +passed in the fortran interface. +.IP +\(bu All routines which are integer procedures in the C interface return an +extra 'ier' argument to contain the error flag. All Fortran functions are +implemented as subroutines. +.IP +\(bu The procedure names are the same except that \fIcdl_\fR has been +replaced with \fIcf\fR in the fortran binding. If your compiler is +case-sensitive then use all lower case letters. +.LP +The binding has been tested on a number of different platforms without +problems. The procedure names haven't been restricted to the traditional +6-character fortran names since most modern compilers can handle longer +names, if yours isn't one of them contact \fIiraf@noao.edu\fR for help +in changing the names. +.LP + Since the CDL is implemented as a set of C routines, the one aspect +that cannot be overlooked in the fortran binding is the between Fortran and +C storage order for arrays. In most cases this will not be a problem since +the CDL routines are just passing around pointers even if they live for a +short while in a fortran program. The problem comes when using the fortran +program to read the arrays, for example in using the array returned by the +\fBcfreadIRAF()\fR procedure, or when passing in arrays for display that +originated in the user's fortran code. In these cases the array \fBmust\fR +be transposed to be interpreted correctly. It was assumed that in most +applications arrays returned by CDL procedures would be immediately passed +to other CDL procedures so having the binding routines +transpose the array to/from +Fortran storage order was unnecessarily inefficient. This may be changed in +later releases if required. + +.NH +SPP Language Binding Notes +.LP + The SPP language binding is experimental and is intended to provide +a way to quickly prototype tasks, it should not be used in production code +as it may not be as portable as the rest of the task. In essence this +binding is a layer on top of the Fortran binding since most IRAF platforms +still use Fortran as the intermediate code. The calling sequences are the +same as with the Fortran library routines with the following caveats: +.IP +\(bu The 'cdlspp.h' SPP include file is required by all files which call +CDL routines. The binding names are actually SPP macros to resolve the +current 6 character limit on procedure names. +.IP +\(bu All character string arguments must be dimensioned to at least SZ_FNAME +characters in length. +.IP +\(bu The CDL package pointer is maintained internally so no 'cdl' pointer is +passed in the fortran interface. +.IP +\(bu All routines which are integer procedures in the C interface return an +extra 'ier' argument to contain the error flag. All SPP functions are +implemented as subroutines. +.IP +\(bu On HPUX or IBM RS6000 systems the 'cdlspp.h' file must be edited to +remove the trailing underscores from the procedure name macros. This is +because on these platforms the fortran compiler will not append an +underscore to the SPP symbols as it does on other platforms. + +.NH +IIS Protocol Description +.LP + The communications protocol used by the CDL and servers such as +\fIXImtool\fR and \fISAOimage\fR, is a slightly modified version of that used +by the IIS Model 70. All operations are initiated by sending a header +packet containing a \fIthing id\fR (tid) and \fIsubunit\fR selecting the +function to be performed, optionally followed by data up to 32K bytes long. +The IIS header packet used is defined as +.nf + \f(CWstruct iism70 { + short tid; + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; + };\fR +.fi + +The \fIthing count\fR field contains the negative number of bytes of data +that will be sent following the header packet. The IIS header checksum is +computed as +.nf +\f(CW + checksum = 0177777 - (tid + subunit + thingct + x + y + z + t); +\fR +.fi +The four IIS registers are set differently depending on the operation, a +summary of the header packets for each operation is summarized below. + +.KS +.ce 1 +\fBIIS Header Packet Summary\fR +.TS +tab(:); +c c c c c c c c c. +:TID:Subunit:Thingct:X:Y:Z:T:Data +.T& +l | l | l | c | c | c | l | l | l |. +:_:_:_:_:_:_:_:_ +Read Data:IIS_READ\fB|\fPPACKED:MEMORY:-nbytes:x:y:frame:-:nbytes +Write Data:IIS_WRITE\fB|\fPPACKED:MEMORY:-nbytes:x:y:frame:-:nbytes +Read Cursor:IIS_READ:IMCURSOR:-:-:-:-:-:- +Write Cursor:IIS_WRITE:IMCURSOR:-:x:y:wcs:-:- +Set Frame:IIS_WRITE:LUT\fB|\fPCOMMAND:-1:-:-:-:-:2 +Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:-:-:frame:fb:N +Read WCS:IIS_READ:WCS:-:-:-:frame:wcs:320 +Erase Frame:IIS_WRITE \fB|\fP fb:FEEDBACK:-:-:-:frame:-:- +:_:_:_:_:_:_:_:_ +.TE +.KE +.TS +l l l. +Where nbytes = number of bytes expected or written + x = x position of operation in frame buffer coords + y = y position of operation in frame buffer coords + frame = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 +.TE +.LP +TID fields can be logically OR'd with the PACKED flag indicating the number +of data bytes is exactly \fIthingct\fR bytes long, otherwise \fIthingct\fR +must be specified as half the number of data bytes. In a cursor read, if +the IIS_READ flag is OR'd with IMC_SAMPLE the logical cursor position (i.e. +the last value read or set) is returned immediately, otherwise the server +will wait for a keystroke to be hit before returning a string containing the +(x,y) position, wcs of the read, and the keystroke. When setting the frame +you must send a short integer in the data containing the frame selected. + +.NH +VXIMTOOL Proxy/Display Server Usage +.LP +\fIVXIMTOOL\fR is a image display server process much like \fIXIMTOOL\fR, +except that all it normally does is respond to datastream requests +to read and write to internal frame buffers maintained as arrays in memory. +Multiple frame buffers and frame buffer configurations are supported. It +can be used to debug CDL programs by printing out the +protocol packets received, or can simply be used as a dummy server in cases +where no image display is really needed. By enabling the \fI-proxy\fR +flag the server can also be used to repeat the datastream requests to a +list of other servers, effectively splitting the image display to a number +of other servers. See the \fIvximtool\fR man page for details on other +command-line arguments and usage. +.LP +The program was originally intended as a debugging tool, either in the +development of CDL clients directly or in cases where the display may +need to go to separate screens as part of a larger project. For example, +engineers may wish to "eavesdrop" on the system by viewing images displayed +by CDL clients used as part of a data acquisition system. It can also be +used as a memory-only display server for CDL clients which need to be run +in the background as part of a pipeline processing system requiring a +frame buffer for image marking. +.LP +In proxy mode the program acts as a relay for the IIS datastream packets, +sending image data, frame requests, etc. to a list of other servers specified +on the command line. The effect of this is to allow a client to display to +this program which then re-displays to each of the other named servers. +Of course CDL clients can also do this internally by opening multiple +connections, using \fIvximtool\fR in proxy mode adds the functionality to +programs which may use this feature only ocasionally. A maximum of 8 servers +may be named, they may be either on the local host or a remote machine +and connections can be established using either fifos or sockets. See +above or the \fIvximtool\fR man page for details on how to specify the +server connection. +.LP +The current implementation has a few restrictions users should keep in mind: +.IP +\(bu The time to display an image or perform any output operation scales +with the number of connected hosts. Each IIS packet is forwarded to each +host in turn before processing the next input packet, and connection over a slow +network will delay the entire process. +.IP +\(bu Cursor and image readback are done by sending the request \fIonly\fR to +the first server named on the command line. This is done to avoid forcing +a cursor mode on all servers which cannot be terminated when a response is +received from only one server, and means that the first server named should +be the one used to control interactive sessions. The remaining servers +however can still respond to cursor requests from other applications +connected to that server on another channel. +.IP +\(bu All named servers must be running prior to starting the proxy server. +The connection to the remote servers is established when this task is first +run and if no server is running that connection will be ignored. The task will +exit if no remote servers can be found for display. +.IP +\(bu Any connected server that shuts down while the proxy server is running +is likely to cause the program to crash on the next display. +.bp +.NH +C Interface Summary +.LP +.in 0.5i +#include "\fBcdl.h\fR" +.in -0.5i + +.TS +center; +r l. +CDLPtr \fBcdl_open\fR (imtdev) +int \fBcdl_displayPix\fR (cdl, pix, nx, ny, bitpix, frame, fbconfig, zscale) +char \fBcdl_readCursor\fR (cdl, sample, x, y, wcs, key) +int \fBcdl_setCursor\fR (cdl, x, y, wcs) +int \fBcdl_setWCS\fR (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +int \fBcdl_getWCS\fR (cdl, name, title, a, b, c, d, tx, ty, z1, z2, zt) +void \fBcdl_setFrame\fR (cdl, frame) +int \fBcdl_clearFrame\fR (cdl) +void \fBcdl_close\fR (cdl) + +int \fBcdl_displayIRAF\fR (cdl, fname, band, frame, fbconfig, zscale) +int \fBcdl_isIRAF\fR (fname) +int \fBcdl_readIRAF\fR (fname, band, pix, nx, ny, bitpix, title) + +int \fBcdl_displayFITS\fR (cdl, fname, frame, fbconfig, zscale) +int \fBcdl_isFITS\fR (fname) +int \fBcdl_readFITS\fR (fname, pix, nx, ny, bitpix, title) + +void \fBcdl_computeZscale\fR (cdl, pix, nx, ny, bitpix, z1, z2) +void \fBcdl_zscaleImage\fR (cdl, pix, nx, ny, bitpix, z1, z2) + +int \fBcdl_printPix\fR (cdl, cmd, pix, nx, ny, annotate) +int \fBcdl_printPixToFile\fR (cdl, fname, pix, nx, ny, annotate) + +int \fBcdl_readImage\fR (cdl, pix, nx, ny) +int \fBcdl_readFrameBuffer\fR (cdl, pix, nx, ny) +int \fBcdl_readSubRaster\fR (cdl, lx, ly, nx, ny, pix) +int \fBcdl_writeSubRaster\fR (cdl, lx, ly, nx, ny, pix) + +void \fBcdl_selectFB\fR (cdl, nx, ny, fb, w, h, nf, reset) +void \fBcdl_setFBConfig\fR (cdl, configno) +void \fBcdl_getFBConfig\fR (cdl, configno, w, h, nf) +void \fBcdl_lookupFBSize\fR (cdl, configno, w, h, nf) + +void \fBcdl_setZTrans\fR (cdl, ztrans) +void \fBcdl_setZScale\fR (cdl, z1, z2) +void \fBcdl_setSample\fR (cdl, nsample) +void \fBcdl_setSampleLines\fR (cdl, nlines) +void \fBcdl_setContrast\fR (cdl, contrast) +void \fBcdl_setName\fR (cdl, imname) +void \fBcdl_setTitle\fR (cdl, imtitle) + +void \fBcdl_getFrame\fR (cdl, frame) +void \fBcdl_getZTrans\fR (cdl, ztrans) +void \fBcdl_getZScale\fR (cdl, z1, z2) +void \fBcdl_getSample\fR (cdl, nsample) +void \fBcdl_getSampleLines\fR (cdl, nlines) +void \fBcdl_getContrast\fR (cdl, contrast) +void \fBcdl_getName\fR (cdl, imname) +void \fBcdl_getTitle\fR (cdl, imtitle) + +int \fBcdl_mapFrame\fR (cdl, frame) +int \fBcdl_markCoordsFile\fR (cdl, fname, type, size, color, label) +int \fBcdl_markPoint\fR (cdl, x, y, number, size, type, color) +int \fBcdl_markPointLabel\fR (cdl, x, y, label, size, type, color) +int \fBcdl_markLine\fR (cdl, xs, ys, xe, ye, color) +int \fBcdl_markBox\fR (cdl, lx, ly, ux, uy, fill, color) +int \fBcdl_markPolygon\fR (cdl, xarray, yarray, npts, fill, color) +int \fBcdl_markPolyline\fR (cdl, xarray, yarray, npts, color) +int \fBcdl_markCircle\fR (cdl, x, y, radius, fill, color) +int \fBcdl_markCircAnnuli\fR (cdl, x, y, radius, nannuli, sep, color) +int \fBcdl_markEllipse\fR (cdl, x, y, xrad, yrad, rotang, fill, color) +int \fBcdl_markEllipAnnuli\fR (cdl, x, y, xrad, yrad, ang, nannuli, sep, color) +int \fBcdl_markText\fR (cdl, x, y, str, size, angle, color) +int \fBcdl_setFont\fR (cdl, font) +int \fBcdl_setTextWidth\fR (cdl, width) +int \fBcdl_setLineWidth\fR (cdl, width) +int \fBcdl_setLineStyle\fR (cdl, style) +int \fBcdl_deleteMark\fR (cdl, x, y) +int \fBcdl_clearOverlay\fR (cdl) +int \fBcdl_redrawOverlay\fR (cdl) +.TE + +.bp +.NH +C Example Tasks +.LP + The examples shown here are for demonstration purposes only. They +are based on working example tasks in the CDL source \fIexamples\fR +subdirectory, see the programs there for the full program listing. + +.NH 2 +Display Example +.LP +.ps -2 +.vs -2 +.nf +\f(CW +#include +#include +#include "cdl.h" + +/* \fIDISPLAY -- Example task to display an image as a command-line task. + * This task is meant to show three ways the CDL can be used to display + * an image, see the code comments for a description of each method. + * + * Examples: + * To display a simple IRAF or FITS file: + * % ./display -frame 2 image.imh + * % ./display image.fits + * + * To display a FITS file as a raw image: + * % ./display -nx 512 -ny 512 -depth 16 -hskip 5760 -raw dpix.fits + * + * Usage: + * display [-depth N] [-fits] [-frame N] [-fbconfig N] [-hskip N] + * [-iraf] [-nozscale] [-nx N] [-ny N] [-raw] [-zscale] file\fP + */ + +#define NONE -1 +#define IRAF 0 +#define FITS 1 +#define RAW 2 + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname, title[128]; + int i, status = 0, frame = 1, fbconfig = 0, zscale = 1; + int format = NONE, nx = 0, ny = 0, depth = 8, hskip = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strcmp (argv[i], "-depth") == 0) depth = atoi (argv[++i]); + else if (strcmp (argv[i], "-fits") == 0) format = FITS; + else if (strcmp (argv[i], "-frame") == 0) frame = atoi (argv[++i]); + else if (strcmp (argv[i], "-fbconfig") == 0) fbconfig = atoi (argv[++i]); + else if (strcmp (argv[i], "-hskip") == 0) hskip = atoi (argv[++i]); + else if (strcmp (argv[i], "-iraf") == 0) format = IRAF; + else if (strcmp (argv[i], "-nozscale") == 0) zscale = 0; + else if (strcmp (argv[i], "-nx") == 0) nx = atoi (argv[++i]); + else if (strcmp (argv[i], "-ny") == 0) ny = atoi (argv[++i]); + else if (strcmp (argv[i], "-raw") == 0) format = RAW; + else if (strcmp (argv[i], "-zscale") == 0) zscale = 1; + } + } + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + fname = argv[argc-1]; + + /* \fIMETHOD 1: Displays the image using the high-level format display + * call. Display as an IRAF image if the option was set indicating + * this is the format, otherwise test the file to see if it is anyway.\fP + */ + if (format == IRAF || (format == NONE && \fBcdl_isIRAF\fP (fname))) { + status = \fBcdl_displayIRAF\fP (cdl, fname, 1, frame, FB_AUTO, zscale); + + /* \fIMETHOD 2: Uses the CDL procedure for getting image pixels from + * a known format, minimal work required to display an image. The + * point here is that you can use this method to process the image + * yourself prior to display, e.g. subsample the pixels, apply a user + * LUT, etc but still use the CDL to get the raw image and do the + * display.\fP + */ + } else if (format == FITS || (format == NONE && \fBcdl_isFITS\fP (fname))) { + + /* \fIGet the FITS image pixels, exit w/ an error status if something + * went wrong, the procedure will print what that was.\fP + */ + if (\fBcdl_readFITS\fP (fname, &pix, &nx, &ny, &depth, title)) { + \fBcdl_close\fP (cdl); /* close the package */ + exit (1); /* exit w/ error code */ + } + + /* \fINow select a frame buffer large enough for the image. The + * fbconfig number is passed in the WCS packet, but the display + * call below will compute the correct WCS for the image and + * transmit that prior to display, all we're doing here is + * setting up the FB to be used.\fP + */ + if (fbconfig == 0) + cdl_selectFB (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 0); + + /* \fILastly, display the pixels to the requested frame, do any + * zscaling requested using the CDL procedure.\fP + */ + status = \fBcdl_displayPix\fP (cdl, pix, nx, ny, depth, frame, + fbconfig, zscale); + + /* \fIMETHOD 3: Displays an image of raw pixels. The client code is + * responsible for reading the image and calling all the procedures + * needed for image display, initialize the frame, zscaling pix, etc. + * While we assume a simple raster format in this program, the user + * code can read a compressed image format such as GIF, mosaic multiple + * images for display as a single image, or just about anything that + * produces a raster for display. The intent here is to show all the + * lowest level calls needed for displaying the image.\fP + */ + } else if (format == RAW) { + FILE *fd; + int lx, ly; + + if (nx == 0 || ny == 0) { + fprintf (stderr, "No size given for raw data.\\n"); + exit (1); + } + + /* \fIOpen the image file if we can.\fP */ + if (fd = fopen (fname, "r")) { + + /* \fISeek to the offset specified.\fP */ + lseek (fileno(fd), (off_t) hskip, SEEK_SET); + + /* \fIAllocate the pixel pointer and read the data.\fP */ + pix = (unsigned char *) malloc (nx * ny * (depth / 8)); + fread (pix, depth/8, nx * ny, fd); + + /* \fIIf we're zscaling and depth is more than 8-bits, do that.\fP */ + if (zscale && depth > 8) { + \fBcdl_computeZscale\fP (cdl, pix, nx, ny, depth, &z1, &z2); + \fBcdl_zscaleImage\fP (cdl, &pix, nx, ny, depth, z1, z2); + } + + /* \fINow select a frame buffer large enough for the image. We'll + * ask that this be reset but the change won't go to the server + * until we send in a WCS, so compute that as well. For the + * WCS we assume a simple linear transform where the image is + * Y-flipped, the (x,y) translation is computed so it is correct + * for an frame buffer >= than the image size.\fP + */ + \fBcdl_selectFB\fP(cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf,1); + \fBcdl_setWCS\fP (cdl, fname, NULL, 1., 0., 0., -1., + (float) (nx / 2) - (fb_w / 2) + 1, /* \fIX trans.\fP */ + (float) (fb_h / 2) + (ny / 2), /* \fIY trans.\fP */ + z1, z2, CDL_LINEAR); /* \fIZ transform\fP */ + + /* \fISelect and clear the requested frame prior to display.\fP */ + \fBcdl_setFrame\fP (cdl, frame); + \fBcdl_clearFrame\fP (cdl); + + /* \fINow display the pixels. We'll compute the image placement + * ourselves and write the image as a raw subraster of the frame + * buffer. In this case we'll center the image, but the CDL + * cdl_writeSubRaster() procedure can be used to write arbitrary + * rasters at any point in the frame buffer.\fP + */ + lx = (fb_w / 2) - (nx / 2); + ly = fb_h - ((fb_h / 2) + (ny / 2)); + status = \fBcdl_writeSubRaster\fP (cdl, lx, ly, nx, ny, pix); + } else + status = 1; + } else { + if (access (fname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\\n", fname); + else + fprintf (stderr, "'%s': image does not exist.\\n", fname); + status = 1; + } + + /* \fINow just free the pixel pointer to clean up.\fP */ + if (pix) + free ((unsigned char *) pix); + \fBcdl_close\fP (cdl); /* \fIclose the package\fP */ + exit (status); +} +\fR +.fi +.vs +2 +.ps +2 +.bp +.NH 2 +Interactive Graphics Overlay Example +.LP +.ps -2 +.vs -2 +.nf +\f(CW +#include +#include +#include +#include "cdl.h" + +/* \fI + * TVMARK -- Example task for displaying an marking images. This program + * can be used to either display an image and overlay points defined in + * a coordinate file, map an existing display frame for marking, or option- + * ally enter a cursor command loop after either of these providing other + * marking capability. All options support minimum match. + * + * Examples: + * % tvmark dpix.fits + * % tvmark -coords coords -color 205 dpix.fits + * % tvmark -frame 2 + * % tvmark -coords coords -interactive dpix.fits + * + * Usage: + * tvmark [-frame N] [-fbconfig N] [-coords ] [-size N] [-color N] + * [-nolabel] [-fill] [-interactive] [image]\fP + */ + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL, *cfname = NULL; + int i, status = 0, fill = 0, frame = 1, fb = FB_AUTO, zscale = 1; + int color = 201, label = 1, size = 9, interactive = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp(argv[i], "-color",4) == 0) color = atoi (argv[++i]); + else if (strncmp(argv[i], "-coords",4) == 0) cfname = argv[++i]; + else if (strncmp(argv[i], "-fbconfig",3) == 0) fb = atoi (argv[++i]); + else if (strncmp(argv[i], "-fill",4) == 0) fill = 1; + else if (strncmp(argv[i], "-frame",3) == 0) frame = atoi (argv[++i]); + else if (strncmp(argv[i], "-interactive",4) == 0) interactive = 1; + else if (strncmp(argv[i], "-nolabel",4) == 0) label = 0; + else if (strncmp(argv[i], "-nozscale",4) == 0) zscale = 0; + else if (strncmp(argv[i], "-size",2) == 0) size = atoi (argv[++i]); + else + fname = argv[i]; + } + } + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* \fIIf an image was specified display it first, otherwise assume the + * image has already been loaded in the frame and mark that.\fP + */ + if (fname) { + if (\fBcdl_isIRAF\fP (fname)) + status = \fBcdl_displayIRAF\fP (cdl, fname, 1, frame, fb, zscale); + else if (\fBcdl_isFITS\fP (fname)) + status = \fBcdl_displayFITS\fP (cdl, fname, frame, fb, zscale); + else { + if (access (cfname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\\n", fname); + else + fprintf (stderr, "'%s': image doesn't exist.\\n", fname); + status = 1; + } + if (status) goto err_; + } else { + + /* \fIIf we've requested a special frame buffer, set it now.\fP */ + if (fb > 0) + \fBcdl_setFBConfig\fP (cdl, fb); + + /* \fIMap the current display frame for use as an image.\fP */ + \fBcdl_mapFrame\fP (cdl, frame); + } + + /* \fIIf a coordinate file was specified read the file and mark those + * coords with points.\fP + */ + if (cfname) + \fBcdl_markCoordsFile\fP (cdl, cfname, M_STAR, size, color, label); + + /* \fILastly, start up an interactive cursor loop if needed.\fP */ + if (interactive) + tvmInteractive (cdl, label, fill, color, size); + + /* \fIClose the package and clean up.\fP */ +err_: \fBcdl_close\fP (cdl); + exit (status); +} + +/* \fITVMINTERACTIVE -- Process commands interactively.\fP */ + +tvmInteractive (cdl, label, fill, color, size) +CDLPtr cdl; +int label, fill, color, size; +{ + float angle = 0.0, rx, ry, txsize = 1.; + int nx, ny, i, x, y, x2, y2, wcs; + int number=1, radius=11, xrad=11, yrad=6, nannuli=3, sep=5; + char key, cmd[SZ_NAME], str[SZ_NAME]; + unsigned char *pix; + + /* \fIProcess commands until a 'q' keystroke is hit.\fP */ + while (\fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key) != 'q') { + x = (int) (rx + 0.5); /* \fIconvert to int pixels\fP */ + y = (int) (ry + 0.5); + + switch (key) { + case ':': /* \fIprocess a colon command\fP */ + putchar (':'); + gets (str); + for (i=0; str[i] != ' ' && str[i]; i++) + cmd[i] = str[i]; + cmd[i++] = '\0'; + + if (strcmp (cmd, "angle") == 0) angle = atof (&str[i]); + else if (strcmp (cmd, "color") == 0) color = atoi (&str[i]); + else if (strcmp (cmd, "fill") == 0) fill = atoi (&str[i]); + else if (strcmp (cmd, "number") == 0) number = atoi (&str[i]); + else if (strcmp (cmd, "nannuli") == 0) nannuli = atoi (&str[i]); + else if (strcmp (cmd, "label") == 0) label = atoi (&str[i]); + else if (strcmp (cmd, "sep") == 0) sep = atoi (&str[i]); + else if (strcmp (cmd, "size") == 0) size = atoi (&str[i]); + else if (strcmp (cmd, "txsize") == 0) txsize = atof (&str[i]); + else if (strcmp (cmd, "xrad") == 0) xrad = atoi (&str[i]); + else if (strcmp (cmd, "yrad") == 0) yrad = atoi (&str[i]); + else if (strcmp (cmd, "print") == 0) { + \fBcdl_readFrameBuffer\fP (cdl, &pix, &nx, &ny); + \fBcdl_printPix\fP (cdl, NULL, pix, nx, ny, 1); + } else if (strcmp (cmd, "snap") == 0) { + \fBcdl_readFrameBuffer\fP (cdl, &pix, &nx, &ny); + \fBcdl_printPixToFile\fP (cdl, &str[i], pix, nx, ny, 1); + } else if (strcmp (cmd, "status") == 0) { + printf ("angle = %-5.3g\tcolor = %d\t", angle, color); + printf ("fill = %-5d\tnumber = %d\\n", fill, number); + printf ("nannuli = %-5d\tsep = %d\t", nannuli, sep); + printf ("size = %-5d\ttxsize = %g\\n", size, txsize); + printf ("xrad = %-5d\tyrad = %d\t", xrad, yrad); + printf ("label = %-5d\\n", label); + } + break; + + case '?': + /* ......\fIhelp procedures\fP */ + break; + + case 'p': /* \fIplus mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_PLUS, color); + break; + case 'x': /* \fIcross mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_CROSS, color); + break; + case '.': /* \fIpoint mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_POINT, color); + break; + case '*': /* \fIstar mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_STAR, color); + break; + case '_': /* \fIhoriz dash mark\fP*/ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_HBLINE, color); + break; + case '|': /* \fIvert dash mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_VBLINE, color); + break; + case 'o': /* \fIcircle mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_CIRCLE|fill, color); + break; + case 's': /* \fIsquare mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_BOX|fill, color); + break; + case 'v': /* \fIdiamond mark\fP */ + \fBcdl_markPoint\fP (cdl, x, y, (label ? number++ : 0), size, M_DIAMOND|fill, color); + break; + + case 'b': /* \fIBox\fP */ + printf ("Hit another key to define the box...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + \fBcdl_markBox\fP (cdl, x, y, x2, y2, fill, color); + break; + case 'c': /* \fICircle\fP */ + printf ("Hit another key to set radius ...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + radius = (int) sqrt ((double) ((x2-x)*(x2-x) + (y2-y)*(y2-y))); + \fBcdl_markCircle\fP (cdl, x, y, radius, fill, color); + break; + case 'd': /* \fIDelete marker\fP */ + \fBcdl_deleteMark\fP (cdl, x, y); + break; + case 'e': /* \fIEllipse\fP */ + \fBcdl_markEllipse\fP (cdl, x, y, xrad, yrad, angle, fill, color); + break; + case 'l': /* \fILine\fP */ + printf ("Hit another key to set line endpoint...\\n"); + (void) \fBcdl_readCursor\fP (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + 0.5); y2 = (int) (ry + 0.5); + \fBcdl_markLine\fP (cdl, x, y, x2, y2, color); + break; + case 't': /* \fIText string\fP */ + printf ("Text string: "); + gets (str); + \fBcdl_markText\fP (cdl, x, y, str, txsize, angle, color); + break; + case 'C': /* \fICircular annuli\fP*/ + \fBcdl_markCircAnnuli\fP (cdl, x, y, radius, nannuli, sep, color); + break; + case 'D': /* \fIDelete all markers\fP*/ + \fBcdl_clearOverlay\fP (cdl); + break; + case 'E': /* \fIElliptical annuli\fP*/ + \fBcdl_markEllipAnnuli\fP (cdl, x, y, xrad, yrad, angle, nannuli, sep, color); + break; + default: + break; + } + } +} +\fR +.fi +.vs +2 +.ps +2 +.bp +.NH 2 +Image Mosaic Example +.LP +.in 0.5i +.ps -2 +.vs -2 +.nf +#include +#include +#\fBinclude "cdl.h"\fP + +/* \fIMOSAIC -- Example task to mosaic several images on a display. Demonstrates + * usage of low-level routines for complex display operations.\fP + */ + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL, title[128]; + int i, j, k, status=0, label=0, frame=1, fb=FB_AUTO, zscale=1; + int sample=1, pad=0, col=204, imx, imy, bitpix, nimages, nim; + int ii, xinit, rowx, rowy, nnx, nny, fb_w, fb_h, nf, mx, my, nx, ny; + float z1, z2; + unsigned char *pix = NULL; + + /* \fIProcess the command line options.\fP */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp (argv[i], "-fbconfig",3) == 0) fb=atoi(argv[++i]); + else if (strncmp (argv[i],"-frame",3) == 0) frame=atoi(argv[++i]); + else if (strncmp (argv[i],"-color",3) == 0) col=atoi(argv[++i]); + else if (strncmp (argv[i],"-label",4) == 0) label=1; + else if (strncmp (argv[i],"-nozscale",4) == 0) zscale=0; + else if (strncmp (argv[i],"-nx",3) == 0) nx=atoi(argv[++i]); + else if (strncmp (argv[i],"-ny",3) == 0) ny=atoi(argv[++i]); + else if (strncmp (argv[i],"-pad",4) == 0) pad=atoi(argv[++i]); + else if (strncmp (argv[i],"-sample",4) == 0) sample=atoi(argv[++i]); + else + break; + } + } + nimages = argc - i; + + /* \fIOpen the package and a connection to the server.\fP */ + if (!(cdl = \fBcdl_open\fP ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* \fIClear the frame to begin.\fP */ + (void) \fBcdl_clearFrame\fP (cdl); + + /* \fILoop over each of the images in the list.\fP */ + nim = rowx = rowy = nnx = nny = 0; + for (k=0; k < ny && nim < nimages; k++) { + rowy += nny + pad; + for (rowx = xinit, j=0; j < nx && nim < nimages; j++) { + + /* \fIGet the image name for display.\fP */ + fname = argv[i++]; + + /* \fIFigure out what kind of image it is and get the pixels.\fP */ + if (cdl_isIRAF (fname)) + status = \fBcdl_readIRAF\fP (fname, 1, &pix, &imx, &imy, &bitpix, title); + else if (cdl_isFITS (fname)) + status = \fBcdl_readFITS\fP (fname, &pix, &imx, &imy, &bitpix, title); + else { + fprintf(stderr, "'%s': unknown or nonexistant image.\\n", fname); + status = 1; + } + if (status) goto err_; + + /* \fICompute subsampled image size.\fP */ + if (sample > 1) + nnx = imx / sample, nny = imy / sample; + else + nnx = imx, nny = imy; + + /* \fIUnless we asked for a specific FB size find one large enough + * to handle the mosaic. We don't check to be sure what's + * returned is really large enough.\fP + */ + if (nim == 0 && fb == FB_AUTO) + \fBcdl_selectFB\fP (cdl, nx*nnx+(pad*(nx-1)), ny*nny+(pad*(ny-1)), &fb, &fb_w, &fb_h, &nf, 1); + else { + \fBcdl_setFBConfig\fP (cdl, fb); + \fBcdl_lookupFBSize\fP (cdl, fb, &fb_w, &fb_h, &nf); + } + + /* \fIDefine a WCS for the frame.\fP */ + \fBcdl_setWCS\fP (cdl, "image mosaic", title, 1., 0., 0., -1., 0., (float) ny*imy+(pad*(ny+1)), 1., 255., 1); + + /* \fIThe first time through figure out the placement so the + * entire mosaic is centered in the frame.\fP + */ + if (nim == 0) { + mx = (nx * nnx) + pad * (nx-1); + my = (ny * nny) + pad * (ny-1); + rowy = (fb_h - my) / 2; + xinit = rowx = (fb_w - mx) / 2; + } + + /* \fICompute the zscaled imaged pixels.\fP */ + if (zscale) { + \fBcdl_computeZscale\fP (cdl, pix, imx ,imy, bitpix, &z1, &z2); + \fBcdl_zscaleImage\fP (cdl, &pix, imx ,imy, bitpix, z1, z2); + } + + /* \fISubsample the image if requested.\fP */ + if (sample > 1) { + int l, m, n=0; + for (l=0; l < imy; l+=sample) + for (m=0; m < imx; m+=sample) + pix[n++] = pix[(l*imx)+m]; + } + + /* \fIWrite the image to the frame buffer.\fP */ + if (\fBcdl_writeSubRaster\fP (cdl, rowx, rowy, nnx, nny, pix)) goto err_; + + /* \fIDraw the image name as a label.\fP */ + if (label) \fBcdl_markText\fP (cdl, rowx+10, rowy+10, fname, 1., 0., col); + + nim++; rowx += nnx + pad; + } + } + + /* \fIClose the package and clean up.\fP */ +err_: \fBcdl_close\fP (cdl); + exit (status); +} +.fi +.vs +2 +.ps +2 +.in -0.5i + +.bp +.NH +Fortran Interface Summary +.LP +.in 0.5i +include "\fBcdlftn.inc\fR" +.in -0.5i + +.TS +center; +r l. +\fBcfopen\fR (imtdev, ier) +\fBcfdisplayPix\fR (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +\fBcfreadCursor\fR (sample, x, y, key, ier) +\fBcfsetCursor\fR (x, y, wcs, ier) +\fBcfsetWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcfgetWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcfsetFrame\fR (frame) +\fBcfclearFrame\fR (ier) +\fBcfclose\fR () + +\fBcfdisplayIRAF\fR (fname, band, frame, fbconfig, zscale, ier) +\fBcfisIRAF\fR (fname, isiraf) +\fBcfreadIRAF\fR (fname, band, pix, nx, ny, bitpix, title, ier) + +\fBcfdisplayFITS\fR (fname, frame, fbconfig, zscale, ier) +\fBcfisFITS\fR (fname, isfits) +\fBcfreadFITS\fR (fname, pix, nx, ny, bitpix, title, ier) + +\fBcfcomputeZscale\fR (pix, nx, ny, bitpix, z1, z2) +\fBcfzscaleImage\fR (pix, nx, ny, bitpix, z1, z2) + +\fBcfprintPix\fR (cmd, pix, nx, ny, annotate, ier) +\fBcfprintPixToFile\fR (fname, pix, nx, ny, annotate, ier) + +\fBcfreadImage\fR (pix, nx, ny, ier) +\fBcfreadFrameBuffer\fR (pix, nx, ny, ier) +\fBcfreadSubRaster\fR (lx, ly, nx, ny, pix, ier) +\fBcfwriteSubRaster\fR (lx, ly, nx, ny, pix, ier) + +\fBcfselectFB\fR (nx, ny, fb, w, h, nf, reset) +\fBcfsetFBConfig\fR (configno) +\fBcfgetFBConfig\fR (configno, w, h, nf) +\fBcflookupFBSize\fR (configno, w, h, nf) + +\fBcfsetZTrans\fR (ztrans) +\fBcfsetZScale\fR (z1, z2) +\fBcfsetSample\fR (nsample) +\fBcfsetSampleLines\fR (nlines) +\fBcfsetContrast\fR (contrast) +\fBcfsetName\fR (imname) +\fBcfsetTitle\fR (imtitle) + +\fBcfgetFrame\fR (frame) +\fBcfgetZTrans\fR (ztrans) +\fBcfgetZScale\fR (z1, z2) +\fBcfgetSample\fR (nsample) +\fBcfgetSampleLines\fR (nlines) +\fBcfgetContrast\fR (contrast) +\fBcfgetName\fR (imname) +\fBcfgetTitle\fR (imtitle) + +\fBcfmapFrame\fR (frame, ier) +\fBcfmarkPoint\fR (x, y, number, size, type, color, ier) +\fBcfmarkcoordsfile\fR (fname, type, size, color, label, ier) +\fBcfmarkPointLabel\fR (x, y, label, size, type, color, ier) +\fBcfmarkLine\fR (xs, ys, xe, ye, color, ier) +\fBcfmarkBox\fR (lx, ly, ux, uy, fill, color, ier) +\fBcfmarkPolygon\fR (xarray, yarray, npts, fill, color, ier) +\fBcfmarkPolyline\fR (xarray, yarray, npts, color, ier) +\fBcfmarkCircle\fR (x, y, radius, fill, color, ier) +\fBcfmarkCircAnnuli\fR (x, y, radius, nannuli, sep, color, ier) +\fBcfmarkEllipse\fR (x, y, xrad, yrad, rotang, fill, color, ier) +\fBcfmarkEllipAnnuli\fR (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +\fBcfmarkText\fR (x, y, str, size, angle, color, ier) +\fBcfsetfont\fR (font) +\fBcfsettextwidth\fR (width) +\fBcfsetlwidth\fR (width) +\fBcfsetlstyle\fR (style) +\fBcfdeleteMark\fR (x, y, ier) +\fBcfclearOverlay\fR (ier) +\fBcfredrawOverlay\fR (ier) +.TE +.bp +.NH +Fortran Example Tasks +.LP + The examples shown here are for demonstration purposes only. They +are based on working example tasks in the CDL source \fIexamples\fR +subdirectory, see the programs there for the full program listing. + +.NH 2 +Display Example +.in 0.5i +.ps -2 +.vs -2 +.nf +\f(CW +C ======================================================================== +C FDISPLAY -- Example fortran program showing the use of the Client +C Display Library (CDL) Fortran interface for displaying images. +C ======================================================================== + + PROGRAM FDISPLAY + character*64 imname + +C \fIInitialize the CDL package\fP + call \fBcfopen\fP (0, ier) + if (ier .gt. 0) then + write (*,*) 'open: Error return from CDL' + goto 999 + endif + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C \fIIf we've got a FITS format image, go ahead and display it.\fP + call \fBcfisFITS\fP (imname, isfits) + if (isfits .gt. 0) then + call \fBcfdisplayFITS\fP (imname, iframe, ifb, 1, ier) + else +C \fIWe've got an IRAF format image, go ahead and display it.\fP + call \fBcfisIRAF\fP (imname, isiraf) + if (isiraf .gt. 0) then + call \fBcfdisplayIRAF\fP (imname, 1, iframe, ifb, 1, ier) + else +C \fIUnrecognized image, punt and exit.\fP + write (*,*) 'Unrecognized image format' + endif + endif + +C \fIClean up and exit.\fP +999 continue + call \fBcfclose\fP (ier) + end +\fR +.fi +.ps +2 +.vs +2 +.in -0.5i +.bp +.NH 2 +Interactive Graphics Overlay Example +.in 0.5i +.ps -2 +.vs -2 +.nf +\f(CW +C ========================================================================== +C FTVMARK -- Example fortran program showing the use of the Client +C Display Library (CDL) Fortran interface for doing graphics overlay. No +C checking of the error flag is done here for space considerations. +C ========================================================================== + + PROGRAM FTVMARK + include "\fBcdlftn.inc\fP" + character*64 imname + +C \fIInitialize the CDL package\fP + call \fBcfopen\fP (0, ier) + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C \fIIf we've got a FITS format image, go ahead and display it.\fP + call \fBcfisFITS\fP (imname, isfits) + if (isfits .gt. 0) then + call \fBcfdisplayFITS\fP (imname, iframe, ifb, 1, ier) + else +C \fIWe've got an IRAF format image, go ahead and display it.\fP + call \fBcfisIRAF\fP (imname, isiraf) + if (isiraf .gt. 0) then + call \fBcfdisplayIRAF\fP (imname, 1, iframe, ifb, 1, ier) + else +C \fINo valid image given, so map the current display for marking.\fP + call \fBcfmapFrame\fP (iframe) + endif + endif + +C \fINow that we've got an image displayed or mapped, enter a cursor loop to mark the image. \fP + call markInteractive () + +C \fIClean up and exit\fP +999 continue + call \fBcfclose\fP (ier) + end + +C \fIMARKINTERACTIVE -- Subroutine for processing the cursor loop.\fP + subroutine markInteractive () + include "\fBcdlftn.inc\fP" + real angle, rx, ry, txsize + integer nx, ny, x, y, x2, y2, fill, size, color + integer number, radius, xrad, yrad, nannuli, sep + character key + character*64 cmd, str + +C \fIAllocate a 1024x1024 array for pixels. \fP + character pix(1048576) + +C \fI....Initialize the local parameters to use\fP + +C \fIRead a cursor keystroke telling us what to do.\fP +10 call \fBcfreadCursor\fP (0, rx, ry, key, ier) + +C \fIRound the real cursor position to integer pixel positions.\fP + x = nint (rx + 0.5) + y = nint (ry + 0.5) + +C \fICheck the keystroke and take the appropriate action.\fP +C \fIColon Commands\fP + if (key .eq. ':') then +C \fIRead a three character command and value field and process the colon command\fP + read (*,'(A3, i4)') cmd, ival + if (cmd(1:3) .eq. 'ang') then + angle = real (ival) + else if (cmd(1:3) .eq. 'col') then + color = ival + else if (cmd(1:3) .eq. 'fil') then + fill = ival +\fI : + ....and so on to set local variables + :\fR + else if (cmd(1:3) .eq. 'pri') then +C \fIPrint contents of the current frame buffer\fP + call \fBcfreadFrameBuffer\fP (pix, nx, ny, ier) + call \fBcfprintPix\fP ("lpr", pix, nx, ny, 1, ier) + else if (cmd(1:3) .eq. 'sta') then + \fI....print out the status (value) of variables\fP + endif + +C \fIPoint Markers\fP + else if (key .eq. 'p') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_PLUS, color, ier) + else if (key .eq. 'x') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_CROSS, color, ier) + else if (key .eq. '_') then + call \fBcfmarkPoint\fP (x, y, 1, size, M_HBLINE, color, ier) + else if (key .eq. 'o') then +C \fIExample of a filled point marker \fP + call \fBcfmarkPoint\fP (x, y, 1, size, or(M_CIRCLE,fill), color, ier) +\fI : + ....and so on to set other types of point markers\fR + +C \fIOther Markers\fP + else if (key .eq. 'b') then + print '("Hit another key to define the box ....")' + call \fBcfreadCursor\fP (0, rx, ry, key, ier) + x2 = nint (rx + 0.5) + y2 = nint (ry + 0.5) + call \fBcfmarkBox\fP (x, y, x2, y2, fill, color, ier) + else if (key .eq. 'd') then + call \fBcfdeleteMark\fP (x, y, ier) + else if (key .eq. 'e') then + call \fBcfmarkEllipse\fP (x, y, xrad, yrad, angle, fill, color, ier) + else if (key .eq. 't') then + print '("Text string: ", $)' + read (*,'(A64)') str + call \fBcfmarkText\fP (x, y, str, txsize, angle, color, ier) +\fI : + ....and so on to set other types of markers\fR + +C \fIQuit\fP + else if (key .eq. 'q') then + goto 998 + endif + +C \fILoop back until we want to quit\fP + goto 10 +998 continue + end +\fR +.fi +.ps +2 +.vs +2 +.in -0.5i +.bp +.NH +SPP Interface Summary +.LP +.in 0.5i +#include "\fBcdlspp.h\fR" +.in -0.5i + +.TS +center; +r l. +\fBcdl_open\fR (imtdev, ier) +\fBcdl_displayPix\fR (pix, nx, ny, bitpix, frame, fbconfig, zscale, ier) +\fBcdl_readCursor\fR (sample, x, y, wcs, key, ier) +\fBcdl_setCursor\fR (x, y, wcs, ier) +\fBcdl_setWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcdl_getWCS\fR (name, title, a, b, c, d, tx, ty, z1, z2, zt, ier) +\fBcdl_setFrame\fR (frame) +\fBcdl_clearFrame\fR (ier) +\fBcdl_close\fR () + +\fBcdl_displayIRAF\fR (fname, band, frame, fbconfig, zscale, ier) +\fBcdl_isIRAF\fR (fname, isiraf) +\fBcdl_readIRAF\fR (fname, band, pix, nx, ny, bitpix, title, ier) + +\fBcdl_displayFITS\fR (fname, frame, fbconfig, zscale, ier) +\fBcdl_isFITS\fR (fname, isfits) +\fBcdl_readFITS\fR (fname, pix, nx, ny, bitpix, title, ier) + +\fBcdl_computeZscale\fR (pix, nx, ny, bitpix, z1, z2) +\fBcdl_zscaleImage\fR (pix, nx, ny, bitpix, z1, z2) + +\fBcdl_printPix\fR (cmd, pix, nx, ny, annotate, ier) +\fBcdl_printPixToFile\fR (fname, pix, nx, ny, annotate, ier) + +\fBcdl_readImage\fR (pix, nx, ny, ier) +\fBcdl_readFrameBuffer\fR (pix, nx, ny, ier) +\fBcdl_readSubRaster\fR (lx, ly, nx, ny, pix, ier) +\fBcdl_writeSubRaster\fR (lx, ly, nx, ny, pix, ier) + +\fBcdl_selectFB\fR (nx, ny, fb, w, h, nf, reset) +\fBcdl_setFBConfig\fR (configno) +\fBcdl_getFBConfig\fR (configno, w, h, nf) +\fBcdl_lookupFBSize\fR (configno, w, h, nf) + +\fBcdl_setZTrans\fR (ztrans) +\fBcdl_setZScale\fR (z1, z2) +\fBcdl_setSample\fR (nsample) +\fBcdl_setSampleLines\fR (nlines) +\fBcdl_setContrast\fR (contrast) +\fBcdl_setName\fR (imname) +\fBcdl_setTitle\fR (imtitle) + +\fBcdl_getFrame\fR (frame) +\fBcdl_getZTrans\fR (ztrans) +\fBcdl_getZScale\fR (z1, z2) +\fBcdl_getSample\fR (nsample) +\fBcdl_getSampleLines\fR (nlines) +\fBcdl_getContrast\fR (contrast) +\fBcdl_getName\fR (imname) +\fBcdl_getTitle\fR (imtitle) + +\fBcdl_mapFrame\fR (frame, ier) +\fBcdl_markCoordsFile\fR (fname, type, size, color, label, ier) +\fBcdl_markPoint\fR (x, y, number, size, type, color, ier) +\fBcdl_markPointLabel\fR (x, y, label, size, type, color, ier) +\fBcdl_markLine\fR (xs, ys, xe, ye, color, ier) +\fBcdl_markBox\fR (lx, ly, ux, uy, fill, color, ier) +\fBcdl_markPolygon\fR (xarray, yarray, npts, fill, color, ier) +\fBcdl_markPolyline\fR (xarray, yarray, npts, color, ier) +\fBcdl_markCircle\fR (x, y, radius, fill, color, ier) +\fBcdl_markCircAnnuli\fR (x, y, radius, nannuli, sep, color, ier) +\fBcdl_markEllipse\fR (x, y, xrad, yrad, rotang, fill, color, ier) +\fBcdl_markEllipAnnuli\fR (x, y, xrad, yrad, ang, nannuli, sep, color, ier) +\fBcdl_markText\fR (x, y, str, size, angle, color, ier) +\fBcdl_setFont\fR (font) +\fBcdl_setTextWidth\fR (width) +\fBcdl_setLineWidth\fR (width) +\fBcdl_setLineStyle\fR (style) +\fBcdl_deleteMark\fR (x, y, ier) +\fBcdl_clearOverlay\fR (ier) +\fBcdl_redrawOverlay\fR (ier) +\fBcdl_setDebug\fR (level) +.TE diff --git a/vendor/x11iraf/cdl/doc/cdlref.ps b/vendor/x11iraf/cdl/doc/cdlref.ps new file mode 100644 index 00000000..f192e0b1 --- /dev/null +++ b/vendor/x11iraf/cdl/doc/cdlref.ps @@ -0,0 +1,19799 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Sat Aug 11 21:36:49 2001 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/C{/Courier FF}def +%% Troff special characters not on Symbol font +%% Copyright (C) 1986 by Pipeline Associates, Inc. +%% Version 1.1 +/altRTD 20 dict def +altRTD begin +/s{setcachedevice}def +/C{1000 1000 scale}def +/m{moveto}def +/c{curveto}def +/S{stroke}def +/l{lineto}def +/a{arcto}def +/p{pop}def +/sl{setlinewidth}def +end +/F_Troff 17 dict def F_Troff begin +systemdict /currentpacking known +{/SavePacking currentpacking def true setpacking}if +/PaintType 0 def +/FontType 3 def +/StrokeWidth 0 def +/UniqueID 8277003 def +/FontMatrix [.001000 0 0 .001000 0 0] def +/FontBBox [-12 -105 942 855 ] def +/Encoding 256 array def +/CD 256 1 add dict def +/FontInfo 3 dict def FontInfo begin +/UnderlinePosition -133 def /UnderlineThickness 20 def end +/FontName (Troff) def +0 1 256 1 sub{Encoding exch /.notdef put}for +CD /.notdef{500 0 setcharwidth{}}put +Encoding (1) 0 get /br put +%% bold vertical rule used by tbl +CD /br{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +0 .9 l +{S} +}put +Encoding (2) 0 get /ul put +%% underline used by tbl +CD /ul{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +.5 -.1 l +{S} +}put +Encoding (3) 0 get /ru put +%% baseline rule +CD /ru{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +m0 +.5 0 l +{S} +}put +Encoding (4) 0 get /vr put +%% vertical rule +CD /vr{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +m0 +0 1 l +{S} +}put +Encoding (5) 0 get /sq put +%% square +CD /sq{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{S} +}put +Encoding (6) 0 get /bx put +%% solid box +CD /bx{ +C +.5 0 -.5 -.5 1 1 s +np +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{fill} +}put +Encoding (7) 0 get /rn put +%% radical extender +CD /rn{ +C +.5 0 -.5 -.5 1 1 s +np +.03 sl +-.03 .9 m +.5 0 rl +{S} +}put +Encoding (8) 0 get /GR put +%% gray mask +CD /GR{ +C +.5 0 setcharwidth +.5 setgray +np +0 -.1 m +0 1 rl +.5 0 rl +0 -1 rl +-.5 0 rl +closepath +{fill} +}put +Encoding 97 /a put +CD /a{1000 0 0 66 942 421 s 430 415 +m 578 406 678 349 662 319 c 655 306 614 287 583 +296 c 570 300 466 340 438 332 c 365 309 335 213 +270 209 c 0 310 m 108 310 l 108 114 l 0 +114 l 0 310 l 42 161 m 42 134 l 66 134 l 66 +161 l 42 161 l 47 155 m 47 140 l 62 140 l 62 +155 l 47 155 l 110 133 m 226 113 300 66 410 +80 c 497 91 550 69 634 76 c 645 76 663 92 669 +107 c 677 125 673 141 668 160 c 725 334 m 758 +332 734 253 701 250 c 501 325 m 475 316 476 309 +473 302 c 465 282 482 263 499 257 c 552 236 615 +253 689 253 c 701 253 713 236 713 218 c 712 194 +702 168 678 161 c 671 159 663 160 655 160 c 591 +158 516 156 479 168 c 461 173 453 191 453 210 c 453 +224 456 235 466 244 c 476 253 490 252 503 255 c 459 +84 m 447 96 435 106 435 123 c 435 136 440 145 447 +155 c 453 163 462 168 469 173 c 110 293 m 173 +318 300 421 435 415 c 609 407 852 416 885 411 c 898 +409 924 411 930 380 c 942 316 828 339 742 334 c 731 +334 730 335 725 335 c 701 336 685 336 660 336 c{S}}put +Encoding 98 /b put +CD /b{1000 0 -12 66 930 421 s 500 +415 m 352 406 252 349 268 319 c 275 306 316 287 +347 296 c 360 300 464 340 492 332 c 565 309 595 +213 660 209 c 930 310 m 822 310 l 822 114 l 930 +114 l 930 310 l 888 161 m 888 134 l 864 134 +l 864 161 l 888 161 l 883 155 m 883 140 l 868 +140 l 868 155 l 883 155 l 820 133 m 704 113 +630 66 520 80 c 433 91 380 69 296 76 c 285 76 +267 92 261 107 c 253 125 257 141 262 160 c 205 +334 m 172 332 196 253 229 250 c 429 325 m 455 +316 454 309 457 302 c 465 282 448 263 431 257 c 378 +236 315 253 241 253 c 229 253 217 236 217 218 c 218 +194 228 168 252 161 c 259 159 267 160 275 160 c 339 +158 414 156 451 168 c 469 173 477 191 477 210 c 477 +224 474 235 464 244 c 454 253 440 252 427 255 c 471 +84 m 483 96 495 106 495 123 c 495 136 490 145 483 +155 c 477 163 468 168 461 173 c 820 293 m 757 +318 630 421 495 415 c 321 407 78 416 45 411 c 32 +409 6 411 0 380 c -12 316 102 339 188 334 c 199 +334 200 335 205 335 c 229 336 245 336 270 336 c{S}}put +Encoding 99 /c put +CD /c{1000 0 184 0 827 627 s 185 315 +m 186 488 332 627 505 625 c 682 623 827 467 815 +290 c 804 124 666 0 500 0 c 327 0 184 142 185 +315 c{S}}put +Encoding 100 /d put +CD /d{590 0 134 158 477 500 s 300 +160 m 208 162 134 238 135 330 c 136 423 212 500 +305 500 c 397 500 473 427 475 335 c 477 239 396 +158 300 160 c{fill}}put +Encoding 101 /e put % Bell Symbol +CD /e{1010 0 -100 -210 1010 1010 s 100 sl 0 setlinecap +420 300 450 0 360 arc +420 650 m 420 575 l S +newpath 120 125 m 720 125 l 75 sl S +420 125 m 420 25 l S +220 400 m 220 175 120 175 100 a p p p p +220 400 m 220 550 420 550 80 a p p p p +620 400 m 620 175 720 175 100 a p p p p +620 400 m 620 550 420 550 80 a p p p p +295 550 m 545 550 l{S}}put +/BuildChar{altRTD /BuildChar get exec}def end +altRTD begin /BuildChar{altRTD begin +/char exch def /fontdict exch def save +/charname fontdict /Encoding get char get def +fontdict /StrokeWidth get sl +fontdict /CD get dup charname known +{charname}{/.notdef}ifelse get newpath exec +fontdict /PaintType get 0 eq{exec}{p S}ifelse +restore end}def end +systemdict /currentpacking known{F_Troff /SavePacking get setpacking}if +/Troff F_Troff definefont pop +/Y1{/Troff FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +1230 V +12 B +1419(A)S +1541(Reference)S +2088(Guide)S +2439(for)S +2628(the)S +2824(IRAF)S +3152(Client)S +3502(Display)S +3926(Library)S +4369(\(CDL\))S +1470 V +10 I +2662(Michael)S +3019(Fitzpatrick)S +1650 V +10 R +2645(NOAO/IRAF)S +3219(Group)S +1890 V +2765(February)S +3155(1997)S +2130 V +10 I +2619(Revised:)S +2992(August)S +3300(2001)S +2250 V +2479(Current)S +2826(Version:)S +3230(CDL)S +3455(V1.8)S +2850 V +2823(ABSTRACT)S +3090 V +11 R +1510(The)S +1713(Client)S +2016(Display)S +2391(Library)S +2752(\(CDL\))S +3077(is)S +3184(a)S +3265(host)S +3482(interface)S +3896(for)S +4056(C,)S +4192(Fortran)S +4549(or)S +4674(SPP)S +3210 V +1260(programs)S +1707(allowing)S +2125(them)S +2378(to)S +2497(display)S +2848(images)S +3192(or)S +3316(overlay)S +3677(graphics)S +4081(to)S +4200(display)S +4551(servers)S +3330 V +1260(such)S +1513(as)S +11 I +1656(XImtool)S +11 R +2010(,)S +11 I +2090(DS9)S +11 R +2279(,)S +2359(or)S +11 I +2502(SAOimage)S +3023(/)S +3106(SAOtng)S +11 R +3448(.)S +3562(High-level)S +4084(procedures)S +4616(allow)S +3450 V +1260(IRAF)S +1545(or)S +1670(FITS)S +1931(images)S +2276(to)S +2396(be)S +2533(displayed)S +2988(simply,)S +3351(other)S +3610(routines)S +3998(permit)S +4319(access)S +4631(to)S +4750(all)S +3570 V +1260(other)S +1537(server)S +1855(functions)S +2316(\(e.g.)S +2563(cursor)S +2888(and)S +3098(image)S +3418(readback,)S +3891(frame)S +4198(selection,)S +4669(etc\).)S +3690 V +1260(The)S +1470(library)S +1802(also)S +2019(features)S +2404(a)S +2492(number)S +2867(of)S +2997(functions)S +3445(for)S +3611(doing)S +3901(image)S +4208(overlay)S +4575(graph-)S +3810 V +1260(ics;)S +1451(supported)S +1922(graphics)S +2331(primitives)S +2816(include)S +3177(numerous)S +3648(point)S +3913(shapes,)S +4272(lines,)S +4547(circles,)S +3930 V +1260(ellipses,)S +1651(polygons,)S +2116(annular)S +2477(shapes,)S +2830(and)S +3021(text.)S +4410 V +10 R +900(August)S +1219(11,)S +1374(2001)S +7920 V +EP +%%Page: 1 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +840 V +13 B +2810(Contents)S +1200 V +10 R +900(1)S +10 B +1080(Introduction)S +10 R +1632(....................................................................................................................................)S +5032(1)S +1380 V +900(2)S +10 B +1080(Getting)S +1432(Started)S +10 R +1757(...............................................................................................................................)S +5032(1)S +1560 V +900(3)S +10 B +1080(Server)S +1392(Connections)S +10 R +1932(........................................................................................................................)S +5032(2)S +1680 V +1080(3.1)S +1440(Domain)S +1792(Sockets)S +2107(.................................................................................................................)S +5032(2)S +1800 V +1080(3.2)S +1440(Named)S +1758(FIFO)S +2005(Pipes)S +2232(............................................................................................................)S +5032(3)S +1920 V +1080(3.3)S +1440(Inet)S +1625(Sockets)S +1957(.......................................................................................................................)S +5032(3)S +2040 V +1080(3.4)S +1440(User-De\256ned)S +2007(Connections.................................................................................................)S +5032(3)S +2220 V +900(4)S +10 B +1080(Image)S +1376(Display)S +10 R +1707(.................................................................................................................................)S +5032(3)S +2340 V +1080(4.1)S +1440(Overview)S +1863(of)S +1976(the)S +2128(Display)S +2469(Process)S +2782(......................................................................................)S +5032(3)S +2460 V +1080(4.2)S +1440(Displaying)S +1909(IRAF)S +2167(Images)S +2457(...................................................................................................)S +5032(4)S +2580 V +1080(4.3)S +1440(Displaying)S +1909(FITS)S +2145(Images)S +2457(...................................................................................................)S +5032(5)S +2700 V +1080(4.4)S +1440(Displaying)S +1909(Raw)S +2122(Pixels)S +2382(......................................................................................................)S +5032(5)S +2820 V +1080(4.5)S +1440(Frame)S +1725(Selection)S +2107(.................................................................................................................)S +5032(5)S +2940 V +1080(4.6)S +1440(Clearing)S +1814(the)S +1966(Display)S +2282(..........................................................................................................)S +5032(5)S +3060 V +1080(4.7)S +1440(Frame)S +1725(Bu)S +1842 H + (f)show 10 -.5 mul h (f)show +10 R +1903(er)S +2010(Selection......................................................................................................)S +5032(6)S +3180 V +1188(4.7.1)S +1584(Automatic)S +2036(Selection)S +2432(....................................................................................................)S +5032(6)S +3300 V +1188(4.7.2)S +1584(The)S +1769(Frame)S +2054(Bu)S +2171 H + (f)show 10 -.5 mul h (f)show +10 R +2232(er)S +2339(Con\256guration)S +2925(File)S +3082(..........................................................................)S +5032(6)S +3420 V +1080(4.8)S +1440(Image)S +1719(WCS)S +1966(Description....................................................................................................)S +5032(7)S +3540 V +1188(4.8.1)S +1584(Image)S +1863(Mappings)S +2282(..........................................................................................................)S +5032(7)S +3660 V +1080(4.9)S +1440(Image)S +1719(Colormaps)S +2182(..............................................................................................................)S +5032(8)S +3780 V +1188(4.9.1)S +1584(Imtool)S +1881(Color)S +2139(Model)S +2407(.....................................................................................................)S +5032(9)S +3900 V +1080(4.10)S +1440(ZScale)S +1747(Intensity)S +2127(Mapping)S +2507(.................................................................................................)S +5032(9)S +4020 V +1080(4.11)S +1440(Image)S +1719(Hardcopy)S +2132(................................................................................................................)S +4982(10)S +4140 V +1080(4.12)S +1440(Image)S +1719(Cursor)S +2007(.....................................................................................................................)S +4982(10)S +4260 V +1188(4.12.1)S +1584(Cursor)S +1886(Sampling)S +2282(..........................................................................................................)S +4982(11)S +4380 V +1080(4.13)S +1440(Image)S +1719(Readout)S +2057(...................................................................................................................)S +4982(11)S +4500 V +1080(4.14)S +1440(Subraster)S +1847(I/O)S +1982(......................................................................................................................)S +4982(11)S +4680 V +900(5)S +10 B +1080(Graphics)S +1505(Overlay)S +10 R +1857(...........................................................................................................................)S +4982(11)S +4800 V +1080(5.1)S +1440(Marker)S +1763(Coordinates)S +2257(...........................................................................................................)S +4982(11)S +4920 V +1080(5.2)S +1440(Mapping)S +1831(a)S +1905(Previously)S +2363(Displayed)S +2798(Image)S +3057(...........................................................................)S +4982(11)S +5040 V +1080(5.3)S +1440(Marking)S +1814(a)S +1888(Coordinate)S +2362(File)S +2532(................................................................................................)S +4982(12)S +5160 V +1080(5.4)S +1440(Marker)S +1763(Colors)S +2032(....................................................................................................................)S +4982(12)S +5280 V +1080(5.5)S +1440(Marker)S +1763(Types.....................................................................................................................)S +4982(12)S +5400 V +1188(5.5.1)S +1584(Point)S +1807(.............................................................................................................................)S +4982(13)S +5520 V +1188(5.5.2)S +1584(Line)S +1782(..............................................................................................................................)S +4982(13)S +5640 V +1188(5.5.3)S +1584(Box)S +1757(...............................................................................................................................)S +4982(13)S +5760 V +1188(5.5.4)S +1584(Circle)S +1832(............................................................................................................................)S +4982(13)S +5880 V +1188(5.5.5)S +1584(Polyline)S +1932(........................................................................................................................)S +4982(14)S +6000 V +1188(5.5.6)S +1584(Polygon)S +1932(........................................................................................................................)S +4982(14)S +6120 V +1188(5.5.7)S +1584(Ellipse)S +1882(..........................................................................................................................)S +4982(14)S +6240 V +1188(5.5.8)S +1584(Circular)S +1941(Annuli)S +2232(............................................................................................................)S +4982(14)S +6360 V +1188(5.5.9)S +1584(Elliptical)S +1981(Annuli)S +2282(..........................................................................................................)S +4982(14)S +6480 V +1188(5.5.10)S +1584(Text)S +1782(..............................................................................................................................)S +4982(14)S +6600 V +1080(5.6)S +1440(Text)S +1653(Fonts)S +1882(..........................................................................................................................)S +4982(15)S +6720 V +1188(5.6.1)S +1584(In-line)S +1880(Font)S +2094(Changes)S +2457(...................................................................................................)S +4982(15)S +6840 V +1080(5.7)S +1440(Line)S +1653(Widths)S +1972(and)S +2146(Styles)S +2407(.....................................................................................................)S +4982(15)S +6960 V +1080(5.8)S +1440(Deleting)S +1814(Markers)S +2157(...............................................................................................................)S +4982(16)S +7080 V +1188(5.8.1)S +1584(Individual)S +2025(Markers.......................................................................................................)S +4982(16)S +7200 V +1188(5.8.2)S +1584(The)S +1769(Entire)S +2043(Overlay)S +2382(......................................................................................................)S +4982(16)S +7920 V +EP +%%Page: 2 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +11 R +2963(- 2 -)S +840 V +10 R +1080(5.9)S +1440(Redrawing)S +1908(the)S +2060(Overlay)S +2382(......................................................................................................)S +4982(16)S +1020 V +900(6)S +10 B +1080(ANSI)S +1349(C)S +1451(Function)S +1865(Prototypes)S +10 R +2332(........................................................................................................)S +4982(17)S +1200 V +900(7)S +10 B +1080(Fortran)S +1448(Language)S +1901(Binding)S +2272(Notes)S +10 R +2532(................................................................................................)S +4982(17)S +1380 V +900(8)S +10 B +1080(SPP)S +1288(Language)S +1741(Binding)S +2112(Notes)S +10 R +2357(.......................................................................................................)S +4982(18)S +1560 V +900(9)S +10 B +1080(IIS)S +1244(Protocol)S +1634(Description)S +10 R +2132(................................................................................................................)S +4982(18)S +1740 V +900(10)S +10 B +1080(VXIMTOOL)S +1677(Proxy/Display)S +2313(Server)S +2625(Usage)S +10 R +2882(..................................................................................)S +4982(19)S +1920 V +900(11)S +10 B +1080(C)S +1182(Interface)S +1599(Summary)S +10 R +2032(....................................................................................................................)S +4982(21)S +2100 V +900(12)S +10 B +1080(C)S +1182(Example)S +1590(Tasks)S +10 R +1857(...........................................................................................................................)S +4982(23)S +2220 V +1080(12.1)S +1440(Display)S +1781(Example)S +2157(...............................................................................................................)S +4982(23)S +2340 V +1080(12.2)S +1440(Interactive)S +1896(Graphics)S +2286(Overlay)S +2637(Example)S +3007(.............................................................................)S +4982(27)S +2460 V +1080(12.3)S +1440(Image)S +1719(Mosaic)S +2043(Example)S +2407(.....................................................................................................)S +4982(31)S +2640 V +900(13)S +10 B +1080(Fortran)S +1448(Interface)S +1865(Summary)S +10 R +2307(.........................................................................................................)S +4982(33)S +2820 V +900(14)S +10 B +1080(Fortran)S +1448(Example)S +1856(Tasks)S +10 R +2107(.................................................................................................................)S +4982(35)S +2940 V +1080(14.1)S +1440(Display)S +1781(Example)S +2157(...............................................................................................................)S +4982(35)S +3060 V +1080(14.2)S +1440(Interactive)S +1896(Graphics)S +2286(Overlay)S +2637(Example)S +3007(.............................................................................)S +4982(36)S +3240 V +900(15)S +10 B +1080(SPP)S +1288(Interface)S +1705(Summary)S +10 R +2132(................................................................................................................)S +4982(38)S +7920 V +EP +%%Page: 1 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +1230 V +12 B +1419(A)S +1541(Reference)S +2088(Guide)S +2439(for)S +2628(the)S +2824(IRAF)S +3152(Client)S +3502(Display)S +3926(Library)S +4369(\(CDL\))S +1470 V +10 I +2662(Michael)S +3019(Fitzpatrick)S +1650 V +10 R +2645(NOAO/IRAF)S +3219(Group)S +1890 V +2765(February)S +3155(1997)S +2130 V +10 I +2619(Revised:)S +2992(August)S +3300(2001)S +2250 V +2479(Current)S +2826(Version:)S +3230(CDL)S +3455(V1.8)S +2730 V +11 B +900(1.)S +1049(Introduction)S +2886 V +11 R +1175(For)S +1368(more)S +1633(than)S +1862(a)S +1950(decade)S +2292(IRAF)S +2583(has)S +2769(used)S +3010(a)S +11 I +3098(display)S +3456(server)S +11 R +3769(as)S +3900(the)S +4075(primary)S +4463(means)S +4784(for)S +4952(image)S +3006 V +900(display.)S +1320(IRAF)S +1612(client)S +1897(tasks)S +2158(connect)S +2539(to)S +2666(the)S +2840(server)S +3146(and)S +3344(send)S +3585(or)S +3716(read)S +3943(data)S +4165(using)S +4444(a)S +4532(modi\256cation)S +5129(of)S +3126 V +900(the)S +1081(IIS)S +1262(Model)S +1596(70)S +1753(protocol,)S +2194(originally)S +2669(through)S +3058(named)S +3397(\256fo)S +3597(pipes)S +3876(but)S +4064(more)S +4337(recently)S +4737(using)S +5024(unix)S +3246 V +900(domain)S +1268(or)S +1397(inet)S +1600(sockets.)S +2022(The)S +2230(advantage)S +2710(to)S +2833(this)S +3030(approach)S +3467(was)S +3674(that)S +3876(IRAF)S +4164(client)S +4445(tasks)S +4702(could)S +4983(make)S +3366 V +900(use)S +1083(of)S +1211(the)S +1383(image)S +1689(display)S +2045(functionality)S +2645(without)S +3020(duplicating)S +3553(the)S +3725(code)S +3969(needed)S +4316(for)S +4481(actually)S +4866(display-)S +3486 V +900(ing)S +1078(the)S +1249(image.)S +1615(The)S +1822(longtime)S +2251(disadvantage)S +2859(was)S +3065(that)S +3266(the)S +3436(IIS)S +3606(protocol)S +4008(used)S +4245(was)S +4451(arcane)S +4770(and)S +4964(undo-)S +3606 V +900(cumented)S +1375(and)S +1582(therefore)S +2024(largely)S +2377(unavailable)S +2931(to)S +3066(applications)S +3646(outside)S +4013(of)S +4153(the)S +4336(IRAF)S +4636(project.)S +5050(The)S +3726 V +900(Client)S +1213(Display)S +1598(Library)S +1969(\(CDL\))S +2304(provides)S +2725(a)S +2816(public)S +3134(C)S +3251(and)S +3451(Fortran)S +3816(interface)S +4239(for)S +4408(displaying)S +4909(images)S +3846 V +900(and)S +1091(overlay)S +1452(graphics)S +1856(that)S +2054(is)S +2161(independent)S +2730(of)S +2854(the)S +3021(underlying)S +3530(protocol)S +3929(used.)S +4002 V +1175(Unlike)S +1512(the)S +1684(interface)S +2103(used)S +2342(by)S +2490(IRAF)S +2779(applications,)S +3376(the)S +3548(CDL)S +3807(is)S +3920(meant)S +4227(to)S +4352(provide)S +4726(an)S +4868(easy-to-)S +4122 V +900(use,)S +1109(fully)S +1351(featured)S +1742(interface)S +2157(for)S +2318(applications)S +2883(that)S +3082(can)S +3267(be)S +3404(easily)S +3694(evolved)S +4075(for)S +4236(future)S +4531(display)S +4883(servers,)S +4242 V +900(communications)S +1675(schemes,)S +2122(or)S +2261(display)S +2627(functionality.)S +3298(Indeed,)S +3671(the)S +3853(CDL)S +4121(is)S +4244(independent)S +4829(of)S +4969(IRAF)S +4362 V +900(itself)S +1163(\(as)S +1333(are)S +1508(the)S +1685(display)S +2046(servers\))S +2434(so)S +2575(display)S +2936(tasks)S +3199(can)S +3393(be)S +3539(written)S +3893(for)S +4063(any)S +4264(discipline)S +4735(or)S +4868(applica-)S +4482 V +900(tion.)S +4638 V +1175(While)S +1478(this)S +1673(guide)S +1952(assumes)S +2353(programs)S +2802(are)S +2969(written)S +3315(in)S +3436(C,)S +3573(Fortran)S +3931(programmers)S +4550(should)S +4879(\256nd)S +5086(the)S +4758 V +900(translation)S +1408(straightforward)S +2127(by)S +2281(referring)S +2706(to)S +2836(the)S +3014(Fortran)S +3381(interface)S +3806(summary.)S +4320(The)S +4534(package)S +4935(source)S +4878 V +900(\256les)S +1117(include)S +1473(example)S +1877(tasks)S +2130(as)S +2254(does)S +2488(this)S +2681(guide;)S +2989(users)S +3247(with)S +3477(problems,)S +3948(questions,)S +4426(or)S +4551(bug)S +4750(reports)S +5088(are)S +4998 V +900(encouraged)S +1444(to)S +1571(contact)S +11 I +1928(iraf@noao.edu)S +11 R +2595(.)S +2697(A)S +2817(small)S +3097(code)S +3344(sample)S +3696(demonstrating)S +4365(the)S +4539(problem)S +4945(would)S +5118 V +900(be)S +1036(very)S +1263(helpful)S +1607(in)S +1726(\256nding)S +2072(a)S +2153(solution)S +2542(to)S +2661(any)S +2852(reported)S +3249(problems.)S +5478 V +11 B +900(2.)S +1049(Getting)S +1436(Started)S +5634 V +11 R +1175(All)S +1358(C)S +1474(programs)S +1930(must)S +2188(include)S +2554(the)S +2731(header)S +3064(\256le)S +11 B +3248("cdl.h")S +11 R +3646(in)S +3775(order)S +4048(to)S +4177(get)S +4354(package)S +4754(de\256nitions)S +5754 V +900(for)S +1084(constants)S +1550(such)S +1808(as)S +1956(colors)S +2281(and)S +2496(structure)S +2936(de\256nitions)S +3459(used.)S +3778(The)S +4005(Fortran)S +4385(interface)S +4822(does)S +5079(not)S +5874 V +11 I +900(require)S +11 R +1257(anything)S +1676(similar,)S +2045(however)S +2456(for)S +2618(fortran)S +2950(compilers)S +3418(which)S +3721(support)S +4086(an)S +11 C +4257(include)S +11 R +4754(directive)S +5172(a)S +5994 V +11 B +900(cdlftn.inc)S +11 R +1383(\256le)S +1562(may)S +1789(be)S +1930(used)S +2169(to)S +2293(de\256ne)S +2599(symbolic)S +3041(constants)S +3488(passed)S +3818(to)S +3942(procedures,)S +4487(this)S +4685(\256le)S +4864(must)S +5117(be)S +6114 V +900(included)S +1320(by)S +1472(each)S +1713(procedure)S +2191(using)S +2472(the)S +2648(CDL.)S +2971(Fortran)S +3336(programs)S +3792(not)S +3975(using)S +4257(this)S +4460(\256le)S +4644(must)S +4902(pass)S +5134(in)S +6234 V +900(the)S +1077(constants)S +1529(explicitly,)S +2016(needed)S +2368(values)S +2690(are)S +2864(found)S +3162(throughout)S +3687(this)S +3889(manual.)S +4315(C)S +4431(procedures)S +4952(which)S +6354 V +900(return)S +1199(an)S +1340(integer)S +1682(value)S +1957(will)S +2167(return)S +2466(a)S +2552(positive)S +2939(number)S +3312(to)S +3436(indicate)S +3821(an)S +3962(error)S +4211(has)S +4395(occurred)S +4815(and)S +5012(print)S +6474 V +900(an)S +1036(error)S +1280(message,)S +1712(otherwise)S +2171(zero)S +2391(is)S +2498(returned.)S +6630 V +1175(The)S +11 B +1381(cdl_open\(\))S +11 R +1912(procedure)S +2384(is)S +2494(used)S +2731(to)S +2853(establish)S +3274(a)S +3358(connection)S +3875(to)S +3997(the)S +4167(server)S +4469(and)S +4664(initialize)S +5086(the)S +6750 V +900(package,)S +1323(it)S +1423(returns)S +1765(a)S +1851(CDL)S +2108(structure)S +2528(pointer)S +2876(that)S +3078(is)S +3189(passed)S +3518(to)S +3641(other)S +3903(CDL)S +4160(procedures.)S +4737(For)S +4927(C)S +5038(pro-)S +6870 V +900(grams)S +1207(this)S +1406(means)S +1726(a)S +1814(separate)S +2211(pointer)S +2562(may)S +2791(be)S +2934(maintained)S +3462(for)S +3629(each)S +3868(server)S +4174(connection,)S +4723(the)S +4897(Fortran)S +6990 V +900(interface)S +1329(is)S +1451(limited)S +1812(to)S +1946(only)S +2190(one)S +2396(server)S +2710(connection)S +3239(per)S +3425(process)S +3800(since)S +4072(the)S +4253(pointer)S +4611(is)S +4732(maintained)S +7110 V +900(internally.)S +1428(The)S +1644(connection)S +2171(is)S +2291(terminated)S +2806(using)S +3091(the)S +11 B +3271(cdl_close\(\))S +11 R +3810(procedure.)S +4353(Between)S +4783(these)S +5055(two)S +7230 V +900(calls)S +1158(may)S +1404(be)S +1564(any)S +1779(combination)S +2385(of)S +2532(CDL)S +2808(procedure)S +3300(calls)S +3557(for)S +3740(doing)S +4047(image)S +4371(display)S +4745(or)S +4892(overlay)S +7920 V +EP +%%Page: 2 5 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 2 -)S +840 V +900(graphics.)S +996 V +1175(For)S +1376(example,)S +1823(the)S +2005(simplest)S +2421(possible)S +2830(program)S +3249(for)S +3424(displaying)S +3931(an)S +4083(IRAF)S +4383(image)S +4700(would)S +5024(look)S +1116 V +900(something)S +1392(like:)S +1296 V +11 C +1450(#include)S +2044("cdl.h")S +1536 V +1450(main)S +1780(\(int)S +2110(argc,)S +2506(char)S +2836(*argv[]\))S +1656 V +1450({)S +1776 V +1714(CDLPtr)S +2176(cdl)S +2440(=)S +2572(cdl_open)S +3166(\(\(char)S +3628(*\)0\);)S +1896 V +1714(cdl_displayIRAF)S +2770(\(cdl,)S +3166(argv[1],)S +3760(1,)S +3958(1,)S +4156(1,)S +4354(1\);)S +2016 V +1714(cdl_close)S +2374(\(cdl\);)S +2136 V +1450(})S +2352 V +11 R +900(This)S +1131(program)S +1537(displays)S +1933(band)S +2181(one)S +2374(of)S +2500(an)S +2638(image)S +2941(named)S +3268(on)S +3413(the)S +3582(command)S +4050(line)S +4250(to)S +4372(the)S +4542(server)S +4844(in)S +4966(frame)S +2472 V +900(one)S +1092(using)S +1365(the)S +1533(default)S +1871(512x512)S +2290(frame)S +2577(bu)S +2687 H + (f)show 11 -.5 mul h (f)show +11 R +2754(er,)S +2899(zscaling)S +3291(the)S +3458(pixels)S +3754(to)S +3873(8-bit)S +4114(values)S +4427(automatically.)S +5086(No)S +2592 V +900(error)S +1146(checking)S +1576(is)S +1685(performed)S +2175(to)S +2296(verify)S +2592(that)S +2792(a)S +2875(connection)S +3391(was)S +3596(established)S +4119(or)S +4245(that)S +4445(the)S +4614(argument)S +5063(is)S +5172(a)S +2712 V +900(valid)S +1163(IRAF)S +1457(image.)S +1829(Most)S +2099(programs)S +2555(will)S +2769(be)S +2914(more)S +3181(complex)S +3601(than)S +3832(this)S +4034(but)S +4217(it)S +4321(should)S +4657(be)S +4802(clear)S +5055(that)S +2832 V +900(image)S +1201(display)S +1552(from)S +1798(client)S +2075(applications)S +2639(is)S +2746(a)S +2827(now)S +3049(trivial)S +3345(operation.)S +3072 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3252 V +11 C +1175(#include)S +1769("cdl.h")S +3492 V +1175(CDLPtr)S +1637(cdl_open)S +2231(\(char)S +2627(*imtdev\))S +3612 V +1175(void)S +1505(cdl_close)S +2165(\(CDLPtr)S +2693(cdl\))S +3972 V +11 B +900(3.)S +1049(Server)S +1391(Connections)S +4128 V +11 R +1175(The)S +11 B +1391(cdl_open\(\))S +11 R +1932(procedure)S +2414(takes)S +2685(a)S +2779(single)S +3088(argument)S +3548(specifying)S +4051(the)S +4232(type)S +4468(of)S +4606(connection)S +5134(to)S +4248 V +900(make)S +1175(to)S +1298(the)S +1469(server,)S +1800(this)S +1997(routine)S +2345(also)S +2559(initializes)S +3024(the)S +3195(CDL)S +3452(package.)S +3907(If)S +4016(this)S +4213(is)S +4324(a)S +4409(NULL)S +4738(pointer)S +5086(the)S +4368 V +900(CDL)S +1171(will)S +1395(attempt)S +1777(to)S +1915(\256rst)S +2139(connect)S +2531(on)S +2693(a)S +2793(unix)S +3041(domain)S +3423(socket,)S +3783(if)S +3902(that)S +4119(fails)S +4360(the)S +4546(standard)S +4969(IRAF)S +4488 V +900(/dev/imt1*)S +1411(\256fo)S +1597(pipes)S +1862(are)S +2027(tried.)S +2322(The)S +2525(syntax)S +2845(for)S +3005(the)S +11 I +3172(imtdev)S +11 R +3497(argument)S +3944(is)S +4051(as)S +4175(follows:)S +4668 V +11 C +2000()S +2594(:)S +2726(
)S +4884 V +11 R +900(where)S +1204()S +1696(is)S +1808(one)S +2004(of)S +2133(")S +11 B +2178(inet)S +11 R +2355(")S +2438(\(internet)S +2847(tcp/ip)S +3136(socket\),)S +3518(")S +11 B +3563(unix)S +11 R +3773(")S +3856(\(unix)S +4126(domain)S +4494(socket\))S +4848(or)S +4977(")S +11 B +5022(\256fo)S +11 R +5175(")S +5004 V +900(\(named)S +1264(pipe\).)S +1586(The)S +1792(form)S +2041(of)S +2168(the)S +2338(address)S +2702(depends)S +3097(upon)S +3353(the)S +3522(domain,)S +3915(as)S +4041(illustrated)S +4516(in)S +4637(the)S +4806(examples)S +5124 V +900(below.)S +1264(The)S +1469(address)S +1832(\256eld)S +2063(may)S +2288(contain)S +2647(up)S +2793(to)S +2915(two)S +3116("%d")S +3388(\256elds.)S +3724(If)S +3832(present,)S +4212(the)S +4382(user's)S +4679(UID)S +4909(will)S +5117(be)S +5244 V +900(substituted)S +1440(\(e.g.)S +1697("unix:/tmp/.IMT%d"\).)S +2749(The)S +2981(default)S +3347(connection)S +3890(if)S +4019(no)S +4191(imtdev)S +4559(is)S +4695(speci\256ed)S +5146(is)S +5364 V +900("unix:/tmp/.IMT%d",)S +1909(failing)S +2251(that)S +2471(a)S +2574(connection)S +3110(is)S +3239(attempted)S +3727(on)S +3892(the)S +4082(/dev/imt1[io])S +4719(named)S +5067(\256fo)S +5484 V +900(pipes.)S +5724 V +11 B +900(3.1.)S +1132(Domain)S +1538(Sockets)S +5880 V +11 R +1175(Domain)S +1576(sockets)S +1946(are)S +2125(sockets)S +2495(created)S +2856(on)S +3013(the)S +3194(local)S +3454(host.)S +3746(The)S +3963(connection)S +4491(is)S +4612(usually)S +4978(faster)S +6000 V +900(than)S +1130(an)S +1274(inet)S +1479(socket)S +1799(and)S +1997(comparable)S +2547(to)S +2673(a)S +2761(\256fo.)S +3015(If)S +3127(the)S +3301(socket)S +3621(name)S +3898(is)S +4012(speci\256ed)S +4442(with)S +4678(a)S +4766('%d')S +5024(\256eld)S +6120 V +900(the)S +1073(client)S +1356(can)S +1546(be)S +1688(assured)S +2055(of)S +2185(a)S +2272(unique)S +2610(socket)S +2929(name)S +3205(for)S +3371(each)S +3609(user)S +3831(allowing)S +4256(multiple)S +4664(clients)S +4991(to)S +5117(be)S +6240 V +900(run)S +1079(on)S +1222(the)S +1389(same)S +1647(host)S +1864(by)S +2007(di)S +2093 H + (f)show 11 -.5 mul h (f)show +11 R +2160(erent)S +2411(users.)S +6396 V +900(Example)S +11 Y1 +900(2)S +905(2222222)S +6696 V +11 C +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(local)S +2825(host)S +3155(using)S +3551(socket)S +4013(domain)S +4475(socket.)S +5003(*/)S +6816 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("unix:/tmp/.IMT%d"\)\))S +3947(==)S +4145(NULL\))S +4541({)S +6936 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(domain)S +3947(socket)S +4409(connection\\n"\);)S +7056 V +1505(exit)S +1835(\(1\);)S +7176 V +1175(})S +7920 V +EP +%%Page: 3 6 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2963(- 3 -)S +840 V +11 B +900(3.2.)S +1132(Named)S +1500(FIFO)S +1796(Pipes)S +996 V +11 R +1175(This)S +1426(is)S +1555(the)S +1744(traditional)S +2251(approach,)S +2734(and)S +2947(the)S +3136(only)S +3387(one)S +3600(supported)S +4089(by)S +4255(SAOimage)S +4799(\(although)S +1116 V +900(recent)S +1208(versions)S +1616(contain)S +1981(support)S +2353(for)S +2522(sockets\).)S +2951(Any)S +3182(named)S +3516(\256fo)S +3711(pipe)S +3942(may)S +4173(be)S +4318(used,)S +4589(the)S +4765(syntax)S +5093(for)S +1236 V +900(the)S +11 I +1067(imtdev)S +11 R +1392(string)S +1676(in)S +1795(this)S +1988(case)S +2208(is)S +1416 V +11 B +1450(\256fo:)S +11 C +1639()S +11 B +2431(:)S +11 C +2467()S +1632 V +11 R +900(Example)S +11 Y1 +900(2)S +905(2222222)S +1812 V +11 C +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(local)S +2825(host)S +3155(using)S +3551(named)S +3947(fifo)S +4277(pipes.)S +4739(*/)S +1932 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("fifo:/dev/imt1i:/dev/imt1o"\)\))S +4607(==)S +4805(NULL\))S +5201({)S +2052 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(fifo)S +3815(pipe)S +4145(connection\\n"\);)S +2172 V +1505(exit)S +1835(\(1\);)S +2292 V +1175(})S +2532 V +11 B +900(3.3.)S +1132(Inet)S +1354(Sockets)S +2688 V +11 R +1175(Inet)S +1378(sockets)S +1734(are)S +1899(connections)S +2456(between)S +2854(hosts)S +3115(via)S +3283(a)S +3365(tcp/ip)S +3650(socket.)S +4025(This)S +4255(permits)S +4619(connecting)S +5134(to)S +2808 V +900(the)S +1067(server)S +1366(over)S +1593(a)S +1674(remote)S +2011(network)S +2403(connection)S +2917(anywhere)S +3374(on)S +3517(the)S +3684(Internet.)S +2964 V +900(Example)S +11 Y1 +900(2)S +905(2222222)S +3144 V +11 C +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(local)S +2825(host)S +3155(using)S +3551(socket)S +4013(5137.)S +4409(*/)S +3264 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("inet:5137"\)\))S +3485(==)S +3683(NULL\))S +4079({)S +3384 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(inet)S +3815(socket)S +4277(connection\\n"\);)S +3504 V +1505(exit)S +1835(\(1\);)S +3624 V +1175(})S +3864 V +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(remote)S +2891(internet)S +3485(host)S +3815(using)S +4211(socket)S +4673(5137.)S +5069(*/)S +3984 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("inet:5137:foo.bar.edu"\)\))S +4277(==)S +4475(NULL\))S +4871({)S +4104 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(inet)S +3815(socket)S +4277(connection\\n"\);)S +4224 V +1505(exit)S +1835(\(1\);)S +4344 V +1175(})S +4584 V +11 B +900(3.4.)S +1132(User-De\256ned)S +1780(Connections)S +4740 V +11 R +1175(Since)S +1465(IRAF)S +1762(V2.10.3)S +2163(client)S +2453(tasks)S +2719(have)S +2971(been)S +3223(able)S +3451(to)S +3583(use)S +3775(an)S +11 B +3924(IMTDEV)S +11 R +4422(unix)S +4665(environment)S +4860 V +900(variable)S +1286(to)S +1406(set)S +1562(the)S +1730(connection)S +2245(type,)S +2496(the)S +2663(syntax)S +2983(of)S +3107(this)S +3300(variable)S +3685(is)S +3792(the)S +3959(same)S +4217(as)S +4341(described)S +4793(above.)S +5148(If)S +4980 V +900(the)S +11 I +1069(cdl_open\(\))S +11 R +1578(procedure)S +2049(is)S +2158(called)S +2454(with)S +2685(a)S +2768(NULL)S +3095(pointer)S +3441(the)S +3610(IMTDEV)S +4071(environment)S +4661(variable)S +5048(will)S +5100 V +900(automatically)S +1544(be)S +1693(checked.)S +2157(To)S +2325(explicitly)S +2787(use)S +2979(this)S +3185(\(or)S +3358(any)S +3562(other\))S +3868(variable)S +4265(in)S +4396(the)S +4575(client)S +4864(task)S +5086(the)S +5220 V +11 I +900(cdl_open\(\))S +11 R +1407(procedure)S +1876(may)S +2098(be)S +2234(called)S +2528(as)S +2652(e.g.)S +5400 V +11 C +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\(getenv\("IMTDEV"\)\)\))S +3815(==)S +4013(NULL\))S +4409({)S +5520 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(server)S +3947(connection\\n"\);)S +5640 V +1505(exit)S +1835(\(1\);)S +5760 V +1175(})S +6000 V +11 B +900(4.)S +1049(Image)S +1374(Display)S +6240 V +900(4.1.)S +1132(Overview)S +1615(of)S +1739(the)S +1918(Display)S +2307(Process)S +6396 V +11 R +1175(Basic)S +1492(image)S +1833(display)S +2224(is)S +2371(done)S +2658(most)S +2947(easily)S +3277(using)S +3590(the)S +3798(high-level)S +11 B +4317(cdl_displayIRAF\(\))S +11 R +5192(,)S +6516 V +11 B +900(cdl_displayFITS\(\))S +11 R +1807(and)S +11 B +2018(cdl_displayPix\(\))S +11 R +2831(procedures.)S +3424(These)S +3738(routines)S +4145(automatically)S +4796(de\256ne)S +5117(an)S +6636 V +900(image)S +1218(WCS)S +1507(and)S +1715(mapping,)S +2178(clear)S +2439(the)S +2623(frame,)S +2955(set)S +3127(the)S +3311(frame)S +3615(bu)S +3725 H + (f)show 11 -.5 mul h (f)show +11 R +3792(er)S +3926(con\256guration)S +4562(and)S +4770(center)S +5086(the)S +6756 V +900(image)S +1237(in)S +1392(the)S +1595(display.)S +2043(For)S +2265(most)S +2549(applications)S +3149(these)S +3443(are)S +3644(all)S +3823(that)S +4057(will)S +4298(be)S +4470(needed,)S +4876(but)S +5086(the)S +6876 V +11 B +900(cdl_writeSubRaster\(\))S +11 R +1940(procedure)S +2411(can)S +2597(also)S +2809(be)S +2947(used)S +3183(to)S +3304(display)S +3657(an)S +3795(image.)S +4159(For)S +4347(example,)S +4781(to)S +4902(display)S +6996 V +900(one)S +1109(image)S +1428(in)S +1565(a)S +1664(mosaic)S +2026(or)S +2168(other)S +2444(cases)S +2725(where)S +3042(the)S +3226(task)S +3453(needs)S +3752(low-level)S +4216(access)S +4544(to)S +4680(position)S +5086(the)S +7116 V +900(image)S +1201(or)S +1325(write)S +1583(raw)S +1779(pixel)S +2032(values.)S +7920 V +EP +%%Page: 4 7 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 4 -)S +840 V +1175(In)S +1322(these)S +1603(cases)S +1889(it)S +2007(is)S +2137(the)S +2328(responsibility)S +2985(of)S +3133(the)S +3324(client)S +3625(program)S +4053(to)S +4196(prepare)S +4579(the)S +4770(server)S +5093(for)S +960 V +900(display.)S +1312(The)S +1515(basic)S +1773(steps)S +2026(involved)S +2444(in)S +2563(displaying)S +3055(an)S +3191(image)S +3492(include)S +1200 V +11 B +1407(Operation)S +3773(CDL)S +4038(Procedure)S +1210 V +11 Y1 +1407(2)S +1413(222222222222222222222222222222222222222222222222222222222222)S +1330 V +11 R +1407(Selecting)S +1849(the)S +2016(frame)S +11 I +3773(cdl_setFrame\(\))S +1450 V +11 R +1407(Clear)S +1677(the)S +1844(frame)S +11 I +3773(cdl_clearFrame\(\))S +1570 V +11 R +1407(Select)S +1708(the)S +1875(frame)S +2162(bu)S +2272 H + (f)show 11 -.5 mul h (f)show +11 R +2339(er)S +2456(con\256guration)S +11 I +3773(cdl_selectFB\(\))S +1690 V +11 R +1407(Set)S +1581(the)S +1748(frame)S +2035(bu)S +2145 H + (f)show 11 -.5 mul h (f)show +11 R +2212(er)S +2329(con\256guration)S +11 I +3773(cdl_setFBCon\256g\(\))S +1810 V +11 R +1407(Scale)S +1677(the)S +1844(image)S +2145(pixels)S +2441(to)S +2560(201)S +2758(display)S +3109(values)S +11 I +3773(cdl_zscaleImage\(\))S +1930 V +11 R +1407(Compute)S +1844(the)S +2011(raster)S +2286(placement)S +2769(in)S +2888(the)S +3055(frame)S +3342(bu)S +3452 H + (f)show 11 -.5 mul h (f)show +11 R +3519(er)S +2050 V +1407(Construct)S +1868(a)S +11 I +1949(node!path)S +11 R +2427(image)S +2728(path)S +2170 V +1407(Set)S +1581(the)S +1748(image)S +2049(mapping)S +11 I +3773(cdl_setMapping\(\))S +2290 V +11 R +1407(De\256ne)S +1732(the)S +1899(image)S +2200(WCS)S +2410 V +1407(Set)S +1581(the)S +1748(image)S +2049(WCS)S +11 I +3773(cdl_setWCS\(\))S +2530 V +11 R +1407(Write)S +1689(the)S +1856(pixels)S +2152(to)S +2271(the)S +2438(display)S +11 I +3773(cdl_writeSubRaster\(\))S +2770 V +11 R +900(In)S +1044(cases)S +1328(like)S +1547(a)S +1649(mosaic)S +2014(display,)S +2414(obviously)S +2903(some)S +3189(steps)S +3463(\(e.g.)S +3712(clearing)S +4118(the)S +4306(frame,)S +4642(selecting)S +5086(the)S +2890 V +900(con\256guration,)S +1548(etc\))S +1745(will)S +1950(only)S +2179(need)S +2418(to)S +2537(be)S +2673(done)S +2919(once.)S +3219(XImtool)S +3625(V1.3)S +3875(and)S +4066(later)S +4293(version)S +4649(support)S +5012(mul-)S +3010 V +900(tiple)S +1147(WCSs)S +1480(in)S +1617(a)S +1716(single)S +2030(frame)S +2335(so)S +2484(each)S +2734(piece)S +3015(of)S +3157(the)S +3342(mosaic)S +3704(should)S +4050(de\256ne)S +4370(a)S +4470(mapping)S +4907(and)S +5117(an)S +3130 V +900(independent)S +1487(WCS.)S +1838(The)S +2058(last)S +2261(step)S +2488(in)S +2624(the)S +2808(display)S +3176(here)S +3413(should)S +3757(be)S +3910(a)S +4008(single)S +4321(WCS)S +4610(for)S +4787(the)S +4971(entire)S +3250 V +900(mosaic)S +1264(such)S +1518(as)S +1662(")S +11 I +1707(detector)S +2119(coordinates)S +11 R +2638(",)S +2764(without)S +3154(this)S +3367(the)S +3555(coordinates)S +4114(used)S +4369(by)S +4533(default)S +4891(will)S +5117(be)S +3370 V +900(based)S +1195(on)S +1351(the)S +1530(last)S +1728(WCS)S +2012(sent)S +2234(to)S +2365(the)S +2544(display.)S +2968(Servers)S +3341(which)S +3654(do)S +3809(not)S +3995(support)S +4370(mappings)S +4843(will)S +5060(just)S +3490 V +900(ignore)S +1227(the)S +1408(mapping)S +1840(information,)S +2434(but)S +2622(may)S +2858(still)S +3072(require)S +3428(a)S +3523(frame)S +3824(bu)S +3934 H + (f)show 11 -.5 mul h (f)show +11 R +4001(er)S +4132(WCS)S +4418(for)S +4593(other)S +4866(tasks)S +5134(to)S +3610 V +900(operate)S +1269(correctly.)S +1766(For)S +1967(simple)S +2309(displays)S +2718(of)S +2857(single)S +3168(images,)S +3555(the)S +3737(high-level)S +4230(routines)S +4632(handle)S +4972(all)S +5129(of)S +3730 V +900(these)S +1164(steps)S +1423(automatically,)S +2088(they)S +2316(are)S +2487(included)S +2904(here)S +3130(as)S +3260(checklist)S +3689(of)S +3819(what)S +4071(must)S +4326(be)S +4469(considered)S +4983(when)S +3850 V +900(using)S +1172(the)S +1339(CDL)S +1592(for)S +1752(low-level)S +2199(display.)S +4090 V +11 B +900(4.2.)S +1132(Displaying)S +1669(IRAF)S +1970(Images)S +4246 V +11 R +1175(The)S +11 B +1379(cdl_displayIRAF\(\))S +11 R +2288(procedure)S +2758(can)S +2943(be)S +3080(used)S +3315(to)S +3435(display)S +3787(an)S +3924(IRAF)S +4209(OIF)S +4420(format)S +4746(image)S +5049(\(i.e.)S +4366 V +900(images)S +1252(with)S +1489(a)S +11 I +1578(.imh)S +11 R +1812(extension\))S +2310(by)S +2461(simply)S +2803(passing)S +3174(in)S +3300(the)S +3474(image)S +3782(name.)S +4120(Pixel)S +4387(\256les)S +4611(for)S +4778(the)S +4952(image)S +4486 V +900(must)S +1150(be)S +1288(accessible)S +1766(from)S +2014(the)S +2183(local)S +2431(machine)S +2837(but)S +3013(can)S +3199(be)S +3337(in)S +3458(any)S +3651(directory,)S +4109(the)S +4278(HDR$)S +4600(syntax)S +4923(for)S +5086(the)S +4606 V +900(imdir)S +1174(is)S +1283(also)S +1495(recognized.)S +2070(Images)S +2421(may)S +2645(be)S +2783(three)S +3036(dimensional,)S +3637(the)S +11 I +3806(band)S +11 R +4060(argument)S +4508(is)S +4616(used)S +4851(to)S +4971(select)S +4726 V +900(the)S +1073(image)S +1380(band)S +1632(to)S +1757(be)S +1899(displayed.)S +2420(The)S +11 I +2629(frame)S +11 R +2924(and)S +11 I +3121(fbcon\256g)S +11 R +3514(arguments)S +4011(select)S +4300(the)S +4474(frame)S +4768(and)S +4966(frame)S +4846 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1210(size)S +1429(respectively,)S +2035(the)S +2218(special)S +2571(symbolic)S +3024(value)S +11 B +3310(FB_AUTO)S +11 R +3872(may)S +4109(be)S +4260(used)S +4509(for)S +4684(the)S +11 I +4866(fbcon\256g)S +4966 V +11 R +900(argument)S +1358(to)S +1488(have)S +1738(the)S +1916(procedure)S +2396(automatically)S +3038(select)S +3331(the)S +3509(frame)S +3807(bu)S +3917 H + (f)show 11 -.5 mul h (f)show +11 R +3984(er)S +4112(most)S +4371(appropriate)S +4914(for)S +5086(the)S +5086 V +900(image)S +1208(size.)S +1479(If)S +1591(the)S +11 I +1765(zscale)S +11 R +2073(\257ag)S +2278(is)S +2392(greater)S +2734(than)S +2963(zero)S +3190(the)S +3364(image)S +3672(will)S +3884(automatically)S +4522(be)S +4664(converted)S +5134(to)S +5206 V +900(8-bit)S +1154(values)S +1480(using)S +1765(the)S +1945(zscale)S +2257(mapping)S +2688(algorithm.)S +3223(The)S +3439(function)S +3851(returns)S +4201(a)S +4295(positive)S +4690(value)S +4973(if)S +5086(the)S +5326 V +900(image)S +1201(cannot)S +1526(be)S +1662(accessed)S +2076(or)S +2200(displayed)S +2654(for)S +2814(any)S +3005(reason,)S +3351(an)S +3487(error)S +3731(message)S +4135(will)S +4340(be)S +4476(printed.)S +5482 V +1175(The)S +11 I +1393(cdl_isIRAF\(\))S +11 R +2013(procedure)S +2497(returns)S +2849(a)S +2946(positive)S +3344(value)S +3630(if)S +3746(the)S +3929(\256lename)S +4356(argument)S +4819(is)S +4942(recog-)S +5602 V +900(nized)S +1177(as)S +1308(an)S +1451(IRAF)S +1742(image,)S +2078(it)S +2180(does)S +2421(not)S +2602(check)S +2896(whether)S +3288(the)S +3462(pixel)S +3722(\256le)S +3903(can)S +4094(be)S +4236(successfully)S +4811(accessed.)S +5722 V +900(For)S +1086(simply)S +1420(reading)S +1781(the)S +1948(pixels)S +2244(from)S +2490(an)S +2626(IRAF)S +2910(image)S +3211(the)S +11 B +3378(cdl_readIRAF\(\))S +11 R +4161(procedure)S +4631(may)S +4854(be)S +4991(used.)S +5842 V +900(The)S +1114(function)S +1524(returns)S +1872(a)S +1964(zero)S +2195(value)S +2475(and)S +2676(sets)S +2884(the)S +3061(output)S +3386(pixel)S +3649(array,)S +3943(image)S +4254(dimensions)S +4799(and)S +5000(pixel)S +5962 V +900(size)S +1117(if)S +1231(successful,)S +1756(otherwise)S +2229(the)S +2410(function)S +2823(returns)S +3175(a)S +3271(positive)S +3668(value.)S +4014(Note)S +4275(that)S +4488(the)S +4670(output)S +5000(pixel)S +6082 V +900(values)S +1213(may)S +1435(need)S +1674(to)S +1793(be)S +1929(scaled)S +2235(before)S +2546(they)S +2768(can)S +2952(be)S +3088(displayed.)S +6322 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6442 V +11 C +1175(int)S +1439(cdl_displayIRAF)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(char)S +3683(*fname,)S +4211(int)S +4475(band,)S +6562 V +1439(int)S +1703(frame,)S +2165(int)S +2429(fbconfig,)S +3089(int)S +3353(zscale\))S +6682 V +1175(int)S +1439(cdl_isIRAF)S +2165(\(char)S +2561(*fname\))S +6802 V +1175(int)S +1439(cdl_readIRAF)S +2297(\(char)S +2693(*fname,)S +3221(int)S +3485(band,)S +3881(uchar)S +4277(**pix,)S +6922 V +1439(int)S +1703(*nx,)S +2033(int)S +2297(*ny,)S +2627(int)S +2891(*bitpix,)S +3485(char)S +3815(*title\))S +7920 V +EP +%%Page: 5 8 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2963(- 5 -)S +840 V +11 B +900(4.3.)S +1132(Displaying)S +1669(FITS)S +1948(Images)S +996 V +11 R +1175(The)S +11 B +1385(cdl_displayFITS\(\))S +11 R +2278(procedure)S +2754(can)S +2945(be)S +3088(used)S +3329(to)S +3455(display)S +3813(a)S +11 I +3901(simple)S +11 R +4228(FITS)S +4495(image)S +4804(by)S +4955(name.)S +1116 V +900(A)S +1016("simple")S +1437(FITS)S +1701(\256le)S +1879(is)S +1990(assumed)S +2405(to)S +2528(be)S +2668(one)S +2863(containing)S +3364(a)S +3449(single)S +3749(image)S +4053(and)S +4247(having)S +4582(no)S +4728(extensions.)S +1236 V +900(Other)S +1183(types)S +1449(of)S +1574(FITS)S +1835(\256les)S +2053(may)S +2276(of)S +2401(course)S +2720(be)S +2857(displayed)S +3312(but)S +3487(the)S +3655(client)S +3933(will)S +4139(have)S +4379(to)S +4499(use)S +4680(other)S +4940(means)S +1356 V +900(to)S +1026(import)S +1360(the)S +1534(pixels.)S +1898(FITS)S +2164(image)S +2471(extensions)S +2974(may)S +3202(be)S +3344(supported)S +3816(in)S +3941(a)S +4028(future)S +4328(release)S +4669(of)S +4799(the)S +4972(CDL.)S +1476 V +900(The)S +11 I +1110(frame)S +11 R +1406(and)S +11 I +1605(fbcon\256g)S +11 R +2000(arguments)S +2498(select)S +2788(the)S +2963(frame)S +3258(and)S +3457(frame)S +3752(bu)S +3862 H + (f)show 11 -.5 mul h (f)show +11 R +3929(er)S +4054(size)S +4265(respectively,)S +4863(the)S +5038(spe-)S +1596 V +900(cial)S +1103(symbolic)S +1552(value)S +11 B +1834(FB_AUTO)S +11 R +2393(may)S +2627(be)S +2775(used)S +3021(for)S +3192(the)S +11 I +3370(fbcon\256g)S +11 R +3768(argument)S +4226(to)S +4356(have)S +4606(the)S +4784(procedure)S +1716 V +900(automatically)S +1540(select)S +1831(the)S +2007(frame)S +2303(bu)S +2413 H + (f)show 11 -.5 mul h (f)show +11 R +2480(er)S +2606(most)S +2863(appropriate)S +3403(for)S +3573(the)S +3750(image)S +4061(size.)S +4335(If)S +4450(the)S +11 I +4627(zscale)S +11 R +4938(\257ag)S +5146(is)S +1836 V +900(greater)S +1236(than)S +1459(zero)S +1680(the)S +1847(image)S +2148(will)S +2353(automatically)S +2984(be)S +3120(converted)S +3584(to)S +3703(8-bit)S +3944(values)S +4257(using)S +4529(the)S +4696(zscale)S +4995(map-)S +1956 V +900(ping)S +1154(algorithm.)S +1702(The)S +1931(function)S +2356(returns)S +2719(a)S +2826(positive)S +3234(value)S +3530(if)S +3656(the)S +3849(image)S +4176(cannot)S +4527(be)S +4689(accessed)S +5129(or)S +2076 V +900(displayed)S +1354(for)S +1514(any)S +1705(reason,)S +2051(an)S +2187(error)S +2431(message)S +2835(will)S +3040(be)S +3176(printed.)S +2232 V +1175(The)S +11 I +1378(cdl_isFITS\(\))S +11 R +1966(procedure)S +2435(returns)S +2772(a)S +2853(positive)S +3235(value)S +3505(if)S +3605(the)S +3773(\256lename)S +4185(argument)S +4633(is)S +4741(recognized)S +2352 V +900(as)S +1037(a)S +1131(simple)S +1470(FITS)S +1742(image.)S +2116(For)S +2314(simply)S +2660(reading)S +3033(the)S +3212(image)S +3525(pixels)S +3833(the)S +11 B +4012(cdl_readFITS\(\))S +11 R +4784(procedure)S +2472 V +900(may)S +1123(be)S +1260(used.)S +1556(The)S +1760(output)S +2076(pixel)S +2330(array,)S +2615(image)S +2917(dimensions)S +3453(and)S +3645(pixel)S +3899(size)S +4103(are)S +4269(returned)S +4668(if)S +4770(successful)S +2592 V +900(otherwise)S +1362(the)S +1532(function)S +1934(returns)S +2274(a)S +2358(positive)S +2743(value.)S +3077(Note)S +3326(that)S +3527(the)S +3697(returned)S +4097(pixel)S +4353(values)S +4669(may)S +4893(need)S +5134(to)S +2712 V +900(be)S +1036(scaled)S +1342(before)S +1653(they)S +1875(can)S +2059(be)S +2195(displayed.)S +2952 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3072 V +11 C +1175(int)S +1439(cdl_displayFITS)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(char)S +3683(*fname,)S +4211(int)S +4475(frame,)S +3192 V +1439(int)S +1703(fbconfig,)S +2363(int)S +2627(zscale\))S +3312 V +1175(int)S +1439(cdl_isFITS)S +2165(\(char)S +2561(*fname\))S +3432 V +1175(int)S +1439(cdl_readFITS)S +2297(\(char)S +2693(*fname,)S +3221(uchar)S +3617(**pix,)S +4079(int)S +4343(*nx,)S +4673(int)S +4937(*ny,)S +3552 V +1439(int)S +1703(*bitpix,)S +2297(char)S +2627(*title\))S +3792 V +11 B +900(4.4.)S +1132(Displaying)S +1669(Raw)S +1915(Pixels)S +3948 V +11 R +1175(The)S +11 B +1381(cdl_displayPix\(\))S +11 R +2177(procedure)S +2649(can)S +2837(be)S +2977(used)S +3215(to)S +3338(display)S +3693(an)S +3833(arbitrary)S +4246(array)S +4506(of)S +4634(pixels)S +4934(of)S +5062(any)S +4068 V +900(size.)S +1166(The)S +11 I +1371(nx)S +11 R +1509(and)S +11 I +1701(ny)S +11 R +1838(arguments)S +2329(are)S +2495(the)S +2663(raster)S +2939(dimensions,)S +3503(and)S +11 I +3695(bitpix)S +11 R +3980(is)S +4088(the)S +4256(pixel)S +4510(size)S +4714(and)S +4906(has)S +5086(the)S +4188 V +900(same)S +1178(meaning)S +1609(as)S +1753(the)S +1940(FITS)S +2220(BITPIX)S +2627(keyword.)S +3124(The)S +11 I +3347(frame)S +11 R +3656(and)S +11 I +3867(fbcon\256g)S +11 R +4274(arguments)S +4784(select)S +5086(the)S +4308 V +900(frame)S +1199(and)S +1402(frame)S +1701(bu)S +1811 H + (f)show 11 -.5 mul h (f)show +11 R +1878(er)S +2007(size)S +2222(respectively,)S +2824(the)S +3003(special)S +3352(symbolic)S +3800(value)S +11 B +4081(FB_AUTO)S +11 R +4639(may)S +4872(be)S +5019(used)S +4428 V +900(for)S +1082(the)S +11 I +1271(fbcon\256g)S +11 R +1680(argument)S +2149(to)S +2290(have)S +2551(the)S +2740(procedure)S +3231(automatically)S +3884(select)S +4188(the)S +4378(frame)S +4688(bu)S +4798 H + (f)show 11 -.5 mul h (f)show +11 R +4865(er)S +5005(most)S +4548 V +900(appropriate)S +1441(for)S +1611(the)S +1788(image)S +2099(size.)S +2372(If)S +2486(the)S +11 I +2662(zscale)S +11 R +2972(\257ag)S +3179(is)S +3295(greater)S +3639(than)S +3870(zero)S +4099(the)S +4275(image)S +4585(will)S +4799(automati-)S +4668 V +900(cally)S +1146(be)S +1282(converted)S +1746(to)S +1865(8-bit)S +2106(values)S +2419(using)S +2691(the)S +2858(zscale)S +3157(mapping)S +3575(algorithm.)S +4908 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5028 V +11 C +1175(int)S +1439(cdl_displayPix)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(uchar)S +3683(*pix,)S +4079(int)S +4343(nx,)S +4607(int)S +4871(ny,)S +5148 V +1439(int)S +1703(bitpix,)S +2231(int)S +2495(frame,)S +2957(int)S +3221(fbconfig,)S +3881(int)S +4145(zscale\))S +5388 V +11 B +900(4.5.)S +1132(Frame)S +1474(Selection)S +5544 V +11 R +1175(Frame)S +1495(selection)S +1925(is)S +2039(normally)S +2476(done)S +2729(as)S +2860(an)S +3003(argument)S +3457(to)S +3583(one)S +3781(of)S +3913(the)S +4088(display)S +4447(procedures,)S +4995(how-)S +5664 V +900(ever)S +1127(frames)S +1464(may)S +1693(be)S +1836(explicitly)S +2292(selected)S +2684(using)S +2963(the)S +11 B +3136(cdl_setFrame\(\))S +11 R +3879(procedure.)S +4415(This)S +4650(allows)S +4976(client)S +5784 V +900(programs)S +1361(to)S +1494(essentially)S +2005("blink")S +2370(frames)S +2715(independently,)S +3413(as)S +3552(long)S +3796(as)S +3935(the)S +4117(server)S +4431(supports)S +4852(multiple)S +5904 V +900(frames.)S +1291(The)S +11 B +1494(cdl_getFrame\(\))S +11 R +2243(procedure)S +2712(may)S +2934(be)S +3070(used)S +3304(to)S +3423(get)S +3590(the)S +3757(current)S +4099(frame)S +4386(set)S +4541(in)S +4660(the)S +4827(server.)S +6144 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6264 V +11 C +1175(void)S +1505(cdl_setFrame)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(frame\))S +6384 V +1175(void)S +1505(cdl_getFrame)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(*frame\))S +6624 V +11 B +900(4.6.)S +1132(Clearing)S +1574(the)S +1753(Display)S +6780 V +11 R +1175(The)S +1400(current)S +1764(display)S +2137(frame)S +2446(may)S +2690(be)S +2848(explicitly)S +3320(cleared)S +3690(using)S +3985(the)S +11 B +4175(cdl_clearFrame\(\))S +11 R +5038(pro-)S +6900 V +900(cedure.)S +1329(The)S +1577(frame)S +1909(is)S +2061(also)S +2316(cleared)S +2707(prior)S +2997(to)S +3160(displaying)S +3696(new)S +3955(images)S +4343(by)S +4530(the)S +4741(procedures)S +7020 V +11 B +900(cdl_displayPix\(\))S +11 R +1660(,)S +11 B +1721(cdl_displayFITS\(\))S +11 R +2574(,)S +2635(and)S +11 B +2826(cdl_displayIRAF\(\))S +11 R +3701(.)S +7260 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7920 V +EP +%%Page: 6 9 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 6 -)S +840 V +11 C +1175(int)S +1439(cdl_clearFrame)S +2429(\(CDLPtr)S +2957(cdl\))S +1080 V +11 B +900(4.7.)S +1132(Frame)S +1474(Bu)S +1610 H + (f)show 11 -.5 mul h (f)show +11 B +1677(er)S +1806(Selection)S +1236 V +11 R +1175(The)S +1415(default)S +1789(frame)S +2113(bu)S +2223 H + (f)show 11 -.5 mul h (f)show +11 R +2290(er)S +2444(used)S +2715(is)S +2859(512x512,)S +3342(other)S +3637(sizes)S +3920(may)S +4179(be)S +4353(selected)S +4776(using)S +5086(the)S +1356 V +11 B +900(cdl_setFBCon\256g\(\))S +11 R +1796(procedure.)S +2340(To)S +2509(set)S +2678(the)S +2859(frame)S +3160(bu)S +3270 H + (f)show 11 -.5 mul h (f)show +11 R +3337(er)S +3467(size)S +3683(the)S +3863(client)S +4153(passes)S +4479(the)S +4659(frame)S +4959(bu)S +5069 H + (f)show 11 -.5 mul h (f)show +11 R +5136(er)S +1476 V +900(number)S +1284(as)S +1424(de\256ned)S +1796(in)S +1931(the)S +2114(frame)S +2417(bu)S +2527 H + (f)show 11 -.5 mul h (f)show +11 R +2594(er)S +2727(con\256guration)S +3362(\256le)S +3552(\(see)S +3776(below\))S +4130(while)S +4424(setting)S +4768(the)S +4952(image)S +1596 V +900(WCS.)S +1243(It)S +1353(is)S +1470(important)S +1941(to)S +2069(note)S +2300(that)S +2507(the)S +2683(frame)S +2979(bu)S +3089 H + (f)show 11 -.5 mul h (f)show +11 R +3156(er)S +3282(isn't)S +3520(actually)S +3909(changed)S +4315(in)S +4443(the)S +4619(server)S +4927(until)S +5172(a)S +1716 V +900(subsequent)S +11 B +1431(cdl_setWCS\(\))S +11 R +2120(call,)S +2349(either)S +2641(directly)S +3019(or)S +3154(through)S +3540(some)S +3816(other)S +4085(procedure)S +4565(which)S +4877(sets)S +5086(the)S +1836 V +900(WCS)S +1172(\(e.g.)S +1400(one)S +1591(of)S +1715(the)S +1882(display)S +2233(procedures\).)S +1992 V +1175(To)S +1384(get)S +1605(the)S +1827(size)S +2085(of)S +2264(the)S +2486(currently)S +2969(de\256ned)S +3380(frame)S +3722(bu)S +3832 H + (f)show 11 -.5 mul h (f)show +11 R +3899(er)S +4071(the)S +4293(user)S +4563(may)S +4840(call)S +5086(the)S +2112 V +11 B +900(cdl_getFBCon\256g\(\))S +11 R +1803(procedure.)S +2342(This)S +2580(returns)S +2926(not)S +3109(only)S +3347(the)S +3523(current)S +3873(con\256guration)S +4500(number,)S +4904(but)S +5086(the)S +2232 V +900(size)S +1121(as)S +1263(well.)S +1564(To)S +1737(get)S +1922(the)S +2107(size)S +2328(and)S +2537(any)S +2746(arbitrary)S +3173(con\256guration)S +3810(without)S +4199(actually)S +4598(setting)S +4944(it,)S +5086(the)S +2352 V +11 B +900(cdl_lookupFBSize\(\))S +11 R +1880(procedure)S +2371(may)S +2615(be)S +2773(used.)S +3090(Any)S +3333(con\256guration)S +3973(not)S +4168(actually)S +4569(de\256ned)S +4946(in)S +5086(the)S +2472 V +900(frame)S +1187(bu)S +1297 H + (f)show 11 -.5 mul h (f)show +11 R +1364(er)S +1481(con\256guration)S +2100(\256le)S +2274(is)S +2381(returned)S +2778(as)S +2902(the)S +3069(default)S +3406(512x512)S +3824(size.)S +2712 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2832 V +11 C +1175(void)S +1505(cdl_setFBConfig)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(int)S +3683(configno\))S +2952 V +1175(void)S +1505(cdl_getFBConfig)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(int)S +3683(*configno,)S +4409(int)S +4673(*width,)S +3072 V +1439(int)S +1703(*height,)S +2297(int)S +2561(*nframes\))S +3192 V +1175(void)S +1505(cdl_lookupFBSize)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(configno,)S +4409(int)S +4673(*width,)S +3312 V +1439(int)S +1703(*height,)S +2297(int)S +2561(*nframes\))S +3552 V +11 B +900(4.7.1.)S +1215(Automatic)S +1741(Selection)S +3708 V +11 R +1175(The)S +11 B +1383(cdl_selectFB\(\))S +11 R +2084(procedure)S +2558(may)S +2785(be)S +2926(used)S +3165(to)S +3289(select)S +3577(the)S +3750(most)S +4004(appropriate)S +4541(frame)S +4834(bu)S +4944 H + (f)show 11 -.5 mul h (f)show +11 R +5011(er)S +5134(to)S +3828 V +900(use)S +1085(for)S +1251(a)S +1338(given)S +1621(image)S +1928(size.)S +2198(If)S +2309(possible)S +2709(a)S +2796(frame)S +3089(bu)S +3199 H + (f)show 11 -.5 mul h (f)show +11 R +3266(er)S +3389(the)S +3562(same)S +3825(size)S +4033(as)S +4162(the)S +4334(image)S +4640(will)S +4850(be)S +4991(used,)S +3948 V +900(otherwise)S +1364(one)S +1560(that)S +1763(is)S +1875(larger)S +2167(will)S +2377(be)S +2518(chosen.)S +2922(Rather)S +3253(than)S +3481(simply)S +3821(selecting)S +4250(the)S +4423(\256rst)S +4634(con\256guration)S +4068 V +900(larger)S +1192(than)S +1419(the)S +1590(image,)S +1923(the)S +2094(procedure)S +2567(searches)S +2973(the)S +3144(entire)S +3430(con\256guration)S +4053(\256le)S +4231(selecting)S +4658(the)S +4829(one)S +5024(with)S +4188 V +900(the)S +1067(least)S +1302(empty)S +1611(space)S +1887(in)S +2007(both)S +2237(dimensions.)S +2834(If)S +2940(the)S +11 I +3108(reset)S +11 R +3355(\257ag)S +3554(is)S +3662(non-zero)S +4084(this)S +4278(frame)S +4566(is)S +4674(set)S +4830(automat-)S +4308 V +900(ically)S +1184(by)S +1334(the)S +1508(procedure,)S +2012(otherwise)S +2478(the)S +2652(selected)S +3044(dimension)S +3543(is)S +3657(simply)S +3998(returned)S +4402(to)S +4527(the)S +4700(calling)S +5038(pro-)S +4428 V +900(gram.)S +1227(In)S +1359(either)S +1649(case)S +1877(the)S +2052(new)S +2275(frame)S +2570(bu)S +2680 H + (f)show 11 -.5 mul h (f)show +11 R +2747(er)S +2872(will)S +3085(not)S +3267(take)S +3490(e)S +3538 H + (f)show 11 -.5 mul h (f)show +11 R +3605(ect)S +3773(until)S +4017(a)S +4107(new)S +4331(WCS)S +4612(is)S +4728(de\256ned)S +5093(for)S +4548 V +900(the)S +1067(frame.)S +4788 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4908 V +11 C +1175(void)S +1505(cdl_selectFB)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(nx,)S +3749(int)S +4013(ny,)S +4277(int)S +4541(*fb,)S +5028 V +1450(int)S +1714(*w,)S +1978(int)S +2242(*h,)S +2506(int)S +2770(*nf,)S +3100(int)S +3364(reset\))S +5268 V +11 B +900(4.7.2.)S +1215(The)S +1432(Frame)S +1774(Bu)S +1910 H + (f)show 11 -.5 mul h (f)show +11 B +1977(er)S +2106(Con\256guration)S +2801(File)S +5424 V +11 R +1175(The)S +1378(size)S +1581(of)S +1705(the)S +1872(frame)S +2160(bu)S +2270 H + (f)show 11 -.5 mul h (f)show +11 R +2337(er)S +2455(is)S +2563(not)S +2738(passed)S +3064(directly)S +3433(to)S +3553(the)S +3721(server)S +4021(since)S +4280(this)S +4474(is)S +4582(not)S +4757(part)S +4961(of)S +5086(the)S +5544 V +900(communications)S +1675(protocol)S +2089(used.)S +2399(Instead,)S +2790(the)S +2971(frame)S +3272(bu)S +3382 H + (f)show 11 -.5 mul h (f)show +11 R +3449(er)S +3580(number)S +3962(is)S +4083(sent)S +4307(as)S +4445(part)S +4662(of)S +4800(the)S +4981(WCS)S +5664 V +900(header)S +1247(packet.)S +1650(So)S +1824(that)S +2046(both)S +2299(the)S +2490(server)S +2813(and)S +3028(client)S +3330(can)S +3539(know)S +3841(that)S +4064(a)S +4170(particular)S +4647(frame)S +4959(bu)S +5069 H + (f)show 11 -.5 mul h (f)show +11 R +5136(er)S +5784 V +900(number)S +1277(corresponds)S +1848(to)S +1976(a)S +2066(speci\256c)S +2443(size,)S +2683(a)S +11 I +2773(frame)S +3071(bu)S +3181 H + (f)show 11 -.5 mul h (f)show +11 I +3237(er)S +3370(con\256guration)S +4005(\256le)S +11 R +4181(is)S +4297(used)S +4540(which)S +4849(both)S +5086(the)S +5904 V +900(client)S +1177(and)S +1368(server)S +1667(read.)S +6060 V +1175(The)S +1383(default)S +1725(con\256guration)S +2349(\256le)S +2528(is)S +2640(/usr/local/lib/imtoolrc,)S +3667(this)S +3865(can)S +4055(be)S +4197(overridden)S +4710(by)S +4859(de\256ning)S +6180 V +900(an)S +11 B +1038(IMTOOLRC)S +11 R +1697(environment)S +2287(variable)S +2674(naming)S +3039(the)S +3208(\256le)S +3384(to)S +3505(be)S +3643(used,)S +3907(or)S +4032(by)S +4176(creating)S +4562(a)S +4644(.imtoolrc)S +5079(\256le)S +6300 V +900(in)S +1022(your)S +1259(home)S +1539(directory.)S +2031(Since)S +2311(the)S +2481(server)S +2783(must)S +3034(also)S +3247(read)S +3470(the)S +3640(same)S +3901(\256le,)S +4106(this)S +4302(must)S +4553(be)S +4692(done)S +4942(before)S +6420 V +900(starting)S +1263(both)S +1492(the)S +1659(client)S +1936(and)S +2127(server)S +2426(applications.)S +6576 V +900(The)S +1103(format)S +1428(of)S +1552(the)S +1719(frame)S +2006(bu)S +2116 H + (f)show 11 -.5 mul h (f)show +11 R +2183(er)S +2300(con\256guration)S +2919(\256le)S +3093(is)S +6756 V +11 I +1175(con\256gno)S +1586(nframes)S +1973(width)S +2252(height)S +2560([extra)S +2861(\256elds])S +6936 V +11 R +900(e.g.)S +7116 V +1230(1)S +1351(2)S +1472(512)S +1703(512)S +7236 V +1230(2)S +1351(2)S +1472(800)S +1703(800)S +7920 V +EP +%%Page: 7 10 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 7 -)S +840 V +1230(3)S +1351(1)S +1439(1024)S +1692(1024)S +2242(#)S +2330(comment)S +960 V +1230(:)S +1327(:)S +1457(:)S +1620(:)S +1200 V +900(At)S +1050(most)S +1305(128)S +1510(frame)S +1804(bu)S +1914 H + (f)show 11 -.5 mul h (f)show +11 R +1981(er)S +2105(sizes)S +2358(may)S +2587(be)S +2730(de\256ned,)S +3121(each)S +3360(con\256guration)S +3986(may)S +4215(de\256ne)S +4523(up)S +4673(to)S +4799(4)S +4895(frames,)S +1320 V +900(con\256guration)S +1519(numbers)S +1930(need)S +2169(not)S +2343(be)S +2479(sequential)S +2957(but)S +3131(should)S +3458(be)S +3594(in)S +3713(ascending)S +4184(order.)S +1560 V +11 B +900(4.8.)S +1132(Image)S +1457(WCS)S +1741(Description)S +1716 V +11 R +1175(The)S +1380(image)S +1683(WCS)S +1957(is)S +2066(de\256ned)S +2424(using)S +2698(the)S +11 B +2868(cdl_setWCS\(\))S +11 R +3550(procedure.)S +4083(The)S +4289(WCS)S +4564(de\256nes)S +4911(a)S +4995(map-)S +1836 V +900(ping)S +1137(between)S +1542(any)S +1741(linear)S +2031(coordinate)S +2534(system)S +2881(and)S +3080(the)S +3254(image)S +3562(pixels,)S +3893(for)S +4060(our)S +4246(purposes)S +4676(we)S +4843(will)S +5055(dis-)S +1956 V +900(cuss)S +1126(how)S +1352(the)S +1523(WCS)S +1799(is)S +1910(used)S +2148(to)S +2271(map)S +2497(the)S +2668(frame)S +2959(bu)S +3069 H + (f)show 11 -.5 mul h (f)show +11 R +3136(er)S +3257(pixels)S +3557(to)S +3680(image)S +3985(coordinates.)S +4588(It)S +4692(is)S +4804(passed)S +5134(to)S +2076 V +900(the)S +1067(server)S +1366(in)S +1485(a)S +1566(string)S +1850(of)S +1974(the)S +2141(form:)S +2256 V +11 I +1428(name)S +11 R +1698(-)S +11 I +1767(title)S +11 R +1939(\\n)S +2376 V +1450(a)S +1531(b)S +1619(c)S +1700(d)S +1788(tx)S +1907(ty)S +2026(z1)S +2162(z2)S +2298(zt)S +2520 V +900(where:)S +2664 V +11 B +1362(X)S +11 R +1441(')S +1510(=)S +1605(a)S +1686(*)S +11 B +1774(X)S +11 R +1886(+)S +1981(c)S +2062(*)S +11 B +2150(Y)S +11 R +2262(+)S +2357(tx)S +2784 V +11 B +1362(Y)S +11 R +1441(')S +1510(=)S +1605(b)S +1693(*)S +11 B +1781(X)S +11 R +1893(+)S +1988(d)S +2076(*)S +11 B +2164(Y)S +11 R +2276(+)S +2371(ty)S +3024 V +900(The)S +1111(terms)S +11 I +1396(a,)S +1520(b,)S +1644(c)S +11 R +1692(,)S +1761(and)S +11 I +1960(d)S +11 R +2056(de\256ne)S +2366(a)S +2456(rotation)S +2840(of)S +2973(the)S +3149(WCS)S +3430(wrt)S +3618(the)S +3794(pixel)S +4056(\(i.e.)S +4269(frame)S +4565(bu)S +4675 H + (f)show 11 -.5 mul h (f)show +11 R +4742(er\))S +4904(coordi-)S +3144 V +900(nates,)S +1195(the)S +11 I +1371(tx)S +11 R +1492(and)S +11 I +1692(ty)S +11 R +1813(values)S +2135(are)S +2309(translation)S +2815(terms)S +3101(relative)S +3471(to)S +3599(the)S +3775(upper-left)S +4248(corner)S +4567(of)S +4699(the)S +4874(display.)S +3264 V +900(The)S +1134(remaining)S +1643(three)S +1925(values)S +2269(de\256ne)S +2601(the)S +2799(intensity)S +3243(mapping)S +3692(of)S +3847(the)S +4045(display)S +4427(pixels;)S +11 I +4785(z1)S +11 R +4947(is)S +5086(the)S +3384 V +900(minimum)S +1373(pixel)S +1636(value)S +1916(used)S +2160(in)S +2289(the)S +2466(transformation,)S +11 I +3183(z2)S +11 R +3324(is)S +3441(the)S +3618(maximum)S +4108(value,)S +4416(and)S +11 I +4617(zt)S +11 R +4733(de\256nes)S +5086(the)S +3504 V +900(type)S +1122(of)S +1246(transformation)S +1925(used)S +2159(\(0)S +2283(for)S +2443(none,)S +2717(1)S +2805(for)S +2965(linear,)S +3275(2)S +3363(for)S +3523(log10\).)S +3660 V +1175(The)S +1391(WCS)S +1676(may)S +1911(be)S +2060(set)S +2228(explicitly)S +2690(by)S +2846(the)S +3026(calling)S +3371(program)S +3788(or)S +3925(a)S +4019(default)S +4369(appropriate)S +4913(for)S +5086(the)S +3780 V +900(image)S +1209(will)S +1422(be)S +1566(set)S +1729(automatically)S +2368(by)S +2519(the)S +2694(high-level)S +3180(display)S +3539(procedures,)S +4086(otherwise)S +4552(a)S +4640(WCS)S +4919(for)S +5086(the)S +3900 V +900(frame)S +1200(bu)S +1310 H + (f)show 11 -.5 mul h (f)show +11 R +1377(er)S +1507(is)S +1627(de\256ned)S +1996(\(i.e.)S +2213(returned)S +2623(coordinates)S +3174(are)S +3352(frame)S +3652(bu)S +3762 H + (f)show 11 -.5 mul h (f)show +11 R +3829(er)S +3959(coords\).)S +4394(As)S +4562(an)S +4711(example)S +5129(of)S +4020 V +900(how)S +1134(the)S +1313(WCS)S +1597(is)S +1716(de\256ned,)S +2112(the)S +2291(default)S +2640(WCS)S +2924(for)S +3096(an)S +3244(image)S +11 I +3557(IMX)S +11 R +3796(x)S +11 I +3896(IMY)S +11 R +4130(pixels)S +4438(in)S +4569(a)S +4661(frame)S +4959(bu)S +5069 H + (f)show 11 -.5 mul h (f)show +11 R +5136(er)S +4140 V +11 I +900(FBX)S +11 R +1134(x)S +11 I +1222(FBY)S +11 R +1451(pixels)S +1747(is)S +1854(de\256ned)S +2210(as)S +4320 V +11 C +1428(a)S +1626(=)S +1824(1.0;)S +3738(/*)S +3936(no)S +4134(rotation)S +4728(*/)S +4440 V +1428(b)S +1626(=)S +1824(0.0;)S +4560 V +1428(c)S +1626(=)S +1824(0.0;)S +4680 V +1428(d)S +1626(=)S +1758(-1.0;)S +4800 V +1428(tx)S +1626(=)S +1758(\()S +11 I +1824(IMX)S +11 C +2084(/)S +2216(2\))S +2414(-)S +2546(\()S +11 I +2612(FBX)S +11 C +2879(/)S +3011(2\))S +3209(+)S +3341(1;)S +3737(/*)S +3935(center)S +4397(in)S +4595(FB)S +4793(*/)S +4920 V +1428(ty)S +1626(=)S +1758(\()S +11 I +1824(FBY)S +11 C +2086(/)S +2218(2\))S +2416(+)S +2548(\()S +11 I +2614(IMY)S +11 C +2869(/)S +3001(2\);)S +5040 V +1428(z1)S +1626(=)S +1758(z1;)S +3738(/*)S +3936(zscale)S +4398(values)S +4860(*/)S +5160 V +1428(z2)S +1626(=)S +1758(z2;)S +5280 V +1428(zt)S +1626(=)S +1758(1;)S +5520 V +11 R +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5640 V +11 C +1175(int)S +1439(cdl_setWCS)S +2165(\(CDLPtr)S +2693(cdl,)S +3023(char)S +3353(*name,)S +3815(char)S +4145(*title,)S +5760 V +1439(float)S +1835(a,)S +2033(float)S +2429(b,)S +2627(float)S +3023(c,)S +3221(float)S +3617(d,)S +3815(float)S +4211(tx,)S +4475(float)S +4871(ty,)S +5880 V +1439(float)S +1835(z1,)S +2099(float)S +2495(z2,)S +2759(int)S +3023(zt\))S +6000 V +1175(int)S +1439(cdl_getWCS)S +2165(\(CDLPtr)S +2693(cdl,)S +3023(char)S +3353(*name,)S +3815(char)S +4145(*title,)S +6120 V +1439(float)S +1835(*a,)S +2099(float)S +2495(*b,)S +2759(float)S +3155(*c,)S +3419(float)S +3815(*d,)S +4079(float)S +4475(*tx,)S +4805(float)S +5201(*ty,)S +6240 V +1439(float)S +1835(*z1,)S +2165(float)S +2561(*z2,)S +2891(int)S +3155(*zt\))S +6480 V +11 B +900(4.8.1.)S +1215(Image)S +1540(Mappings)S +6636 V +11 R +1175(Beginning)S +1668(with)S +11 B +1898(X11IRAF)S +2389(V1.3)S +11 R +2640(the)S +11 I +2808(XImtool)S +11 R +3196(display)S +3549(server)S +3850(has)S +4031(had)S +4224(the)S +4393(ability)S +4710(to)S +4831(use)S +5012(mul-)S +6756 V +900(tiple)S +1135(world)S +1430(coordinate)S +1931(systems)S +2319(in)S +2444(a)S +2531(frame)S +2824(\(e.g.)S +3058(subrasters)S +3535(of)S +3664(a)S +3750(mosaic)S +4099(display\).)S +4552(To)S +4712(do)S +4860(this,)S +5086(the)S +6876 V +11 B +900(IRAF)S +11 R +1214(and)S +11 B +1418(CDL)S +11 R +1696(display)S +2060(interfaces)S +2530(were)S +2787(modi\256ed)S +3225(to)S +3357(pass)S +3593(in)S +3726(extra)S +3991(information)S +4557(with)S +4800(the)S +4981(WCS)S +6996 V +900(string)S +1188(to)S +1311(de\256ne)S +1616(the)S +1787(mapping)S +2209(of)S +2337(the)S +2508(image)S +2813(pixels)S +3112(to)S +3234(the)S +3404(frame)S +3694(bu)S +3804 H + (f)show 11 -.5 mul h (f)show +11 R +3871(er)S +3991(pixels.)S +4351(This)S +4583(extra)S +4837(informa-)S +7116 V +900(tion)S +1119(allows)S +1453(the)S +1634(XImtool)S +2055(to)S +2189(know)S +2481(when)S +2766(the)S +2948(cursor)S +3269(in)S +3403(within)S +3733(one)S +3939(of)S +4078(the)S +4260(image)S +4576(subrasters)S +5062(and)S +7236 V +900(compute)S +1321(coordinates)S +1869(appropriately.)S +2557(\(See)S +2794(the)S +11 I +2971(XImtool)S +11 R +3368(documentation)S +4063(for)S +4232(details)S +4561(on)S +4713(how)S +4944(this)S +5146(is)S +7920 V +EP +%%Page: 8 11 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 8 -)S +840 V +900(done)S +1146(exactly\).)S +996 V +1175(The)S +1391(CDL)S +1657(will)S +1875(automatically)S +2519(determine)S +3003(when)S +3286(the)S +3466(connection)S +3993(is)S +4114(\256rst)S +4333(established)S +4868(whether)S +1116 V +900(the)S +1068(server)S +1368(is)S +1476(aware)S +1768(of)S +1892(this)S +2085(new)S +2300(mapping)S +2718(information.)S +3331(Calls)S +3591(to)S +3710(send)S +3944(or)S +4068(receive)S +4415(mapping)S +4833(data)S +5048(will)S +1236 V +900(be)S +1036(ignored)S +1404(for)S +1564(servers)S +1906(which)S +2208(are)S +2374(not)S +2549(aware)S +2842(of)S +2967(the)S +3135(extra)S +3387(data)S +3603(in)S +3723(the)S +3891(string.)S +4237(For)S +4424(servers)S +4767(which)S +5069(can)S +1356 V +900(use)S +1079(the)S +1246(mappings,)S +1735(and)S +1926(where)S +2225(a)S +2306(mapping)S +2724(has)S +2903(been)S +3142(provided,)S +3626(the)S +3793(WCS)S +4065(string)S +4349(now)S +4571(looks)S +4843(like)S +1536 V +11 I +1428(name)S +11 R +1698(-)S +11 I +1767(title)S +11 R +1939(\\n)S +1656 V +1450(a)S +1531(b)S +1619(c)S +1700(d)S +1788(tx)S +1907(ty)S +2026(z1)S +2162(z2)S +2298(zt\\n)S +1776 V +11 B +1450(region_name)S +2093(sx)S +2224(sy)S +2355(snx)S +2548(sny)S +2741(dx)S +2891(dy)S +3041(dnx)S +3253(dny\\n)S +1896 V +1450(object_refR)S +2076 V +900(where)S +1218(the)S +1397(new)S +1619(parameters)S +2186(are)S +2370(de\256ned)S +2747(to)S +2871(be:)S +2280 V +1606(region_name)S +11 I +2546(User-de\256ned)S +3144(name)S +3414(for)S +3576(the)S +3743(region.)S +2400 V +11 B +1606(sx,)S +1765(sy,)S +1924(snx,)S +2145(sny)S +11 I +2546(Source)S +2883(rect)S +3086(in)S +3205(the)S +3372(object.)S +2520 V +11 B +1606(dx,)S +1784(dy,)S +1962(dnx,)S +2202(dny)S +11 I +2546(Destination)S +3093(rect)S +3296(in)S +3415(the)S +3582(display)S +3933(frame)S +4222(bu)S +4332 H + (f)show 11 -.5 mul h (f)show +11 I +4388(er.)S +2640 V +11 B +1606(object_ref)S +11 I +2546(Full)S +2763(node!/path)S +3272(image)S +3573(speci\256cation.)S +2820 V +11 B +900(The)S +11 I +1124(object_ref)S +11 R +1609(should)S +1943(be)S +2086(a)S +2174(complete)S +2616(node!path)S +3094(speci\256cation)S +3689(to)S +3815(the)S +3989(image)S +4297(including)S +4753(any)S +4952(image)S +2940 V +900(section)S +1253(or)S +1385(extension.)S +1908(This)S +2145(is)S +2260(needed)S +2610(by)S +2761(the)S +2936(XImtool)S +3350(coordinate/pixel)S +4104(plug-in)S +4463(to)S +4590(map)S +4820(the)S +4995(same)S +3060 V +900(image)S +1206(as)S +1335(was)S +1543(displayed)S +2002(by)S +2150(the)S +2322(client.)S +2665(The)S +2873(path)S +3100(and)S +3296(node)S +3547(are)S +3717(required)S +4119(to)S +4244(ensure)S +4568(the)S +4741(image)S +5048(will)S +3180 V +900(be)S +1041(found)S +1335(properly.)S +1805(The)S +11 I +2013(region_name)S +11 R +2630(can)S +2819(be)S +2960(anything)S +3383(such)S +3621(as)S +11 I +3749(image)S +11 R +4017(,)S +11 I +4082(subraster1)S +11 R +4553(,)S +4618(or)S +11 I +4746(ccd3)S +11 R +4952(.)S +5050(The)S +3300 V +900(purpose)S +1294(of)S +1432(this)S +1639(\256eld)S +1883(is)S +2005(to)S +2139(provide)S +2522(some)S +2802(named)S +3142(value)S +3427(for)S +3602(the)S +3784(mapping)S +4217(that)S +4430(may)S +4667(be)S +4818(useful)S +5134(to)S +3420 V +900(other)S +1159(client)S +1437(programs)S +1885(needing)S +2266(to)S +2386(access)S +2698(the)S +2865(mapping.)S +11 I +3344(Source)S +11 R +3681(coordinates)S +4219(refer)S +4456(to)S +4575(the)S +4742(image)S +5043(pix-)S +3540 V +900(els,)S +11 I +1083(destination)S +11 R +1606(coordinates)S +2144(refer)S +2381(to)S +2500(the)S +2667(frame)S +2954(bu)S +3064 H + (f)show 11 -.5 mul h (f)show +11 R +3131(er.)S +3696 V +1175(Because)S +1580(we)S +1748(did)S +1930(not)S +2112(wish)S +2361(to)S +2488(change)S +2838(any)S +3037(of)S +3169(the)S +3344(existing)S +3734(interfaces,)S +4227(mappings)S +4696(must)S +4953(be)S +5098(set)S +3816 V +900(prior)S +1152(to)S +1277(the)S +11 B +1449(cdl_setWCS\(\))S +11 R +2133(call)S +2362(using)S +2639(the)S +11 B +2811(cdl_setMapping\(\))S +11 R +3674(procedure.)S +4209(The)S +4417(mapping)S +4840(is)S +4952(stored)S +3936 V +900(until)S +1147(the)S +1325(WCS)S +1608(is)S +1726(actually)S +2117(sent.)S +2399(Similarly,)S +2882(a)S +2974(mapping)S +3403(may)S +3636(be)S +3783(retrieved)S +11 I +4216(after)S +11 R +4469(a)S +11 B +4562(cdl_getWCS\(\))S +4056 V +11 R +900(call)S +1124(using)S +1428(the)S +11 B +1627(cdl_getMapping\(\))S +11 R +2529(procedure)S +3030(to)S +3181(return)S +3507(the)S +3706(values)S +4051(read)S +4303(with)S +4564(the)S +4763(last)S +4981(WCS)S +4176 V +900(retrieval.)S +1359(Since)S +1637(there)S +1889(can)S +2074(at)S +2187(times)S +2460(be)S +2597(more)S +2856(than)S +3079(one)S +3271(WCS)S +3545(in)S +3666(a)S +3749(frame,)S +4066(it's)S +4242(also)S +4454(possible)S +4850(to)S +4971(query)S +4296 V +900(the)S +1074(mapping)S +1499(for)S +1665(a)S +1752(particular)S +2210(WCS)S +2488(by)S +2637(number)S +3011(\(e.g.)S +3245(the)S +3418(WCS)S +3696(number)S +4070(returned)S +4473(in)S +4598(a)S +4685(cursor)S +4997(read\))S +4416 V +900(using)S +1178(the)S +11 I +1351(cdl_queryMap\(\))S +11 R +2101(procedure.)S +2637(See)S +2834(the)S +3008(sample)S +3359(programs)S +3813(in)S +3939(the)S +4113(appendices)S +4639(for)S +4806(examples)S +4536 V +900(of)S +1024(how)S +1246(these)S +1504(procedures)S +2016(might)S +2307(be)S +2443(called.)S +4776 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4896 V +11 C +1175(int)S +1439(cdl_getMapping\(CDLPtr)S +2891(cdl,)S +3221(char)S +3551(*region,)S +5016 V +1439(float)S +1835(*sx,)S +2165(float)S +2561(*sy,)S +2891(int)S +3155(*snx,)S +3551(int)S +3815(*sny,)S +5136 V +1439(int)S +1703(*dx,)S +2033(int)S +2297(*dy,)S +2627(int)S +2891(*dnx,)S +3287(int)S +3551(*dny,)S +3947(char)S +4277(*ref\);)S +5256 V +1175(int)S +1439(cdl_setMapping\(CDLPtr)S +2891(cdl,)S +3221(char)S +3551(*region,)S +5376 V +1439(float)S +1835(sx,)S +2099(float)S +2495(sy,)S +2759(int)S +3023(snx,)S +3353(int)S +3617(sny,)S +5496 V +1439(int)S +1703(dx,)S +1967(int)S +2231(dy,)S +2495(int)S +2759(dnx,)S +3089(int)S +3353(dny,)S +3683(char)S +4013(*ref\);)S +5616 V +1175(int)S +1439(cdl_queryMap\(CDLPtr)S +2759(cdl,)S +3089(int)S +3353(wcs,)S +3683(char)S +4013(*region,)S +5736 V +1439(float)S +1835(*sx,)S +2165(float)S +2561(*sy,)S +2891(int)S +3155(*snx,)S +3551(int)S +3815(*sny,)S +5856 V +1439(int)S +1703(*dx,)S +2033(int)S +2297(*dy,)S +2627(int)S +2891(*dnx,)S +3287(int)S +3551(*dny,)S +3947(char)S +4277(*objref\);)S +6216 V +11 B +900(4.9.)S +1132(Image)S +1457(Colormaps)S +6372 V +11 R +1175(The)S +1395(IIS)S +1579(protocol)S +1996(used)S +2248(does)S +2500(not)S +2692(permit)S +3030(the)S +3215(downloading)S +3840(of)S +3982(user-de\256ned)S +4574(colormaps,)S +5110(all)S +6492 V +900(images)S +1255(are)S +1431(loaded)S +1767(as)S +1902(raw)S +2109(grayscale)S +2565(values)S +2889(according)S +3364(to)S +3494(the)S +3672(XImtool)S +4089(colormap)S +4547(model)S +4866(used)S +5110(by)S +6612 V +900(currently)S +1348(supported)S +1834(servers.)S +2257(All)S +2451(images)S +2815(containing)S +3332(private)S +3689(colormaps)S +4200(or)S +4345(more)S +4624(than)S +4867(the)S +5055(201)S +6732 V +900(grayscale)S +1355(values)S +1678(de\256ned)S +2043(by)S +2195(the)S +2371(Imtool)S +2707(colormap)S +3163(model)S +3480(must)S +3737(either)S +4028(convert)S +4398(the)S +4574(image)S +4884(to)S +5012(8-bit)S +6852 V +900(grayscale)S +1418(values)S +1804(by)S +2020(calling)S +2425(the)S +2665(CDL)S +2991(zscale)S +3364(procedures)S +3950(\()S +11 B +3986(cdl_computeZscale\(\))S +11 R +5062(and)S +6972 V +11 B +900(cdl_zscaleImage\(\))S +11 R +1733(\))S +1814(or)S +1950(scale)S +2213(the)S +2392(images)S +2748(in)S +2879(client)S +3168(code)S +3419(with)S +3660(user)S +3887(LUTs.)S +4249(The)S +4464(CDL)S +4728(zscale)S +5038(pro-)S +7092 V +900(cedures)S +1276(scale)S +1537(image)S +1849(to)S +1979(201)S +2188(grayscale)S +2644(values)S +2968(so)S +3110(that)S +3319(they)S +3552(are)S +3728(displayed)S +4193(to)S +4323(the)S +4501(full)S +4698(8-bit)S +4950(range,)S +7212 V +900(user)S +1135(LUT)S +1401(transformations)S +2143(or)S +2287(user)S +2522(code)S +2781(for)S +2961(converting)S +3483(to)S +3621(grayscale)S +4085(from)S +4350(a)S +4450(private)S +4806(colormap)S +7920 V +EP +%%Page: 9 12 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 9 -)S +840 V +900(procedures)S +1412(should)S +1739(do)S +1882(the)S +2049(same.)S +1080 V +11 B +900(4.9.1.)S +1215(Imtool)S +1559(Color)S +1860(Model)S +1236 V +11 R +1175(The)S +1383(IMTOOL)S +1847(color)S +2110(model)S +2423(de\256nes)S +2772(at)S +2889(most)S +3142(201)S +3345(grayscale)S +3795(values)S +4113(for)S +4278(use)S +4463(in)S +4588(displaying)S +5086(the)S +1356 V +900(image,)S +1239(a)S +1330(set)S +1495(of)S +1629(16)S +1782(static)S +2057(colors)S +2368(are)S +2543(also)S +2763(de\256ned)S +3129(for)S +3299(overlay)S +3670(graphics.)S +4145(Pixel)S +4415(values)S +4738(sent)S +4958(to)S +5086(the)S +1476 V +900(server)S +1200(should)S +1528(be)S +1665(already)S +2020(scaled)S +2327(to)S +2447(this)S +2641(model,)S +2978(i.e.)S +3147(the)S +3315(image)S +3617(pixels)S +3914(should)S +4242(be)S +4380(scaled)S +4688(to)S +4809(the)S +4978(range)S +1596 V +900(1-200,)S +1231(values)S +1558(above)S +1866(this)S +2073(will)S +2292(either)S +2588(represent)S +3035(the)S +3216(overlay)S +3591(colors)S +3906(or)S +4044(will)S +4263(wrap)S +4528(around)S +4879(to)S +5012(8-bit)S +1716 V +900(values.)S +1286(The)S +1501(CDL)S +1766(zscale)S +2077(procedures)S +2601(will)S +2818(automatically)S +3461(scale)S +3724(arbitrary)S +4145(pixel)S +4410(values)S +4736(to)S +4868(use)S +5060(this)S +1836 V +900(color)S +1169(model,)S +1516(the)S +1694(overlay)S +2066(procedures)S +2589(assume)S +2956(color)S +3224(values)S +3547(are)S +3722(de\256ned)S +4088(for)S +4258(the)S +4435(static)S +4710(color)S +4978(range)S +1956 V +900(201-217)S +1299(but)S +1473(any)S +1664(8-bit)S +1905(value)S +2175(may)S +2397(be)S +2533(used.)S +2112 V +1175(A)S +1287(summary)S +1729(of)S +1853(the)S +2020(color)S +2278(model)S +2586(values)S +2899(is)S +3006(included)S +3417(below:)S +2292 V +11 B +1593(Color)S +2080(Description)S +3337(Color)S +3819(Description)S +2412 V +11 R +1593(0)S +2080(Background)S +3388(208)S +3819(Cyan)S +2532 V +1593(1)S +1681(-)S +1750(200)S +2080(Image)S +2386(data)S +3388(209)S +3819(Magenta)S +2652 V +1593(201)S +2080(Cursor)S +2412(\(white\))S +3388(210)S +3819(Coral)S +2772 V +1593(202)S +2080(Background)S +2649(\(black\))S +3388(211)S +3819(Maroon)S +2892 V +1593(203)S +2080(White)S +3388(212)S +3819(Orange)S +3012 V +1593(204)S +2080(Red)S +3388(213)S +3819(Khaki)S +3132 V +1593(205)S +2080(Green)S +3388(214)S +3819(Orchid)S +3252 V +1593(206)S +2080(Blue)S +3388(215)S +3819(Turquoise)S +3372 V +1593(207)S +2080(Yellow)S +3388(216)S +3819(Violet)S +3492 V +1593(217)S +2080(Wheat)S +3288(218-255)S +3819(unde\256ned)S +3792 V +11 B +900(4.10.)S +1187(ZScale)S +1538(Intensity)S +1987(Mapping)S +3948 V +11 R +1175(Since)S +1455(most)S +1706(display)S +2060(servers)S +2405(are)S +2573(only)S +2805(capable)S +3174(of)S +3301(displaying)S +3796(8-bit)S +4041(pixel)S +4298(values,)S +4676(images)S +5024(with)S +4068 V +900(more)S +1172(than)S +1408(8-bits)S +1706(per)S +1892(pixel)S +2159(must)S +2421(be)S +2571(scaled)S +2891(prior)S +3151(to)S +3284(display.)S +3710(For)S +3910(linear)S +4205(transformations)S +4940(this)S +5146(is)S +4188 V +900(typically)S +1334(done)S +1596(using)S +1885(a)S +1983(simple)S +2327(conversion)S +2858(of)S +2999(the)S +3183(image)S +3501(min/max)S +3943(values)S +4273(to)S +4409(the)S +4593(256)S +4808(grayscale)S +4308 V +900(values,)S +1247(however)S +1662(this)S +1861(doesn't)S +2223(produce)S +2614(very)S +2847(good)S +3106(results)S +3432(when)S +3708(most)S +3962(pixel)S +4220(values)S +4538(are)S +4708(near)S +4933(one)S +5129(of)S +4428 V +900(the)S +1088(extremes)S +1537(\(usually)S +1945(the)S +2133(image)S +2455(min)S +2681(for)S +2862(astronomical)S +3483(images\).)S +3945(To)S +4121(solve)S +4407(this)S +4622(IRAF)S +4928(uses)S +5172(a)S +4548 V +11 I +900(zscale)S +11 R +1218(mapping)S +1653(algorithm)S +2131(where)S +2447(a)S +2544(sampling)S +2997(grid)S +3223(is)S +3346(used)S +3596(to)S +3731(approximate)S +4328(the)S +4511(image)S +4828(min/max)S +4668 V +900(values)S +1214(rather)S +1502(than)S +1725(computing)S +2230(it)S +2326(directly,)S +2723(a)S +2806(line)S +3006(is)S +3115(then)S +3339(\256t)S +3467(to)S +3588(these)S +3848(sample)S +4194(pixels)S +4492(to)S +4613(determine)S +5086(the)S +4788 V +900(optimal)S +1274(transformation)S +1957(to)S +2080(the)S +2251(display)S +2606(values.)S +2984(This)S +3217(is)S +3328(not)S +3506(only)S +3739(more)S +4001(e)S +4049 H + (f)show 11 -.5 mul h (\256)show +11 R +4141(cient)S +4390(but)S +4567(maps)S +4835(the)S +5005(most)S +4908 V +900(common)S +1318(pixel)S +1571(values)S +1884(to)S +2003(the)S +2170(display)S +2521(range)S +2796(producing)S +3274(a)S +3355(better)S +3637(image.)S +5064 V +1175(The)S +1379(CDL)S +1633(has)S +1813(several)S +2156(routines)S +2544(for)S +2705(doing)S +2991(the)S +3160(same)S +3420(transformation:)S +4132(the)S +11 I +4301(cdl_computeZscale\(\))S +5184 V +11 R +900(procedure)S +1383(is)S +1504(used)S +1752(to)S +1885(compute)S +2310(the)S +2491(optimal)S +11 I +2875(z1)S +11 R +3020(and)S +11 I +3225(z2)S +11 R +3370(values)S +3697(\(the)S +3914(min/max)S +4353(used)S +4601(for)S +4774(the)S +4954(zscale)S +5304 V +900(transform\))S +1402(for)S +1569(an)S +1712(image)S +2020(of)S +2151(any)S +2349(pixel)S +2609(size.)S +2880(The)S +11 I +3090(bitpix)S +11 R +3381(argument)S +3835(is)S +3949(the)S +4123(number)S +4498(of)S +4629(bits-per-pixel)S +5424 V +900(for)S +1086(the)S +1279(input)S +1565(array)S +1847(and)S +2063(has)S +2267(the)S +2459(same)S +2742(meaning)S +3178(as)S +3327(for)S +3512(the)S +3704(FITS)S +11 I +3989(BITPIX)S +11 R +4382(keyword.)S +4851(To)S +5031(then)S +5544 V +900(transform)S +1361(the)S +1530(image)S +1833(using)S +2107(these)S +2368(values)S +2684(\(or)S +2847(user-de\256ned)S +3424(values\))S +3776(the)S +11 I +3946(cdl_zscaleImage\(\))S +11 R +4784(procedure)S +5664 V +900(is)S +1015(used.)S +1318(The)S +1528(input)S +1795(pixels)S +2098(are)S +2270(modi\256ed)S +2702(by)S +2852(this)S +3052(procedure)S +3528(but)S +3709(the)S +3883(array)S +4146(is)S +4260(not)S +4441(reallocated)S +4960(to)S +5086(the)S +5784 V +900(smaller)S +1273(size)S +1493(needed)S +1852(by)S +2012(an)S +2166(8-bit)S +2425(array.)S +2760(The)S +11 B +2981(cdl_setSample\(\))S +11 R +3776(and)S +11 B +3985(cdl_setSampleLines\(\))S +11 R +5038(pro-)S +5904 V +900(cedures)S +1278(can)S +1474(be)S +1622(used)S +1868(to)S +1999(change)S +2352(the)S +2530(sampling)S +2978(grid)S +3199(and)S +3401(number)S +3780(of)S +3915(sample)S +4270(points)S +4584(\(the)S +4798(default)S +5146(is)S +6024 V +900(600)S +1099(points)S +1403(on)S +1547(5)S +1636(lines\).)S +1975(The)S +11 B +2179(cdl_setContrast\(\))S +11 R +3022(procedure)S +3493(can)S +3679(be)S +3817(used)S +4053(to)S +4174(change)S +4518(the)S +4687(default)S +5026(con-)S +6144 V +900(trast)S +1128(adjustment)S +1650(to)S +1775(the)S +1948(slope)S +2219(used)S +2459(in)S +2584(the)S +2757(transformation)S +3442(\(the)S +3651(default)S +3993(is)S +4105(0.25\).)S +4433(If)S +4543(a)S +4629(value)S +4904(of)S +5033(zero)S +6264 V +900(is)S +1007(given)S +1284(then)S +1506(the)S +1673(minimum)S +2136(and)S +2327(maximum)S +2807(of)S +2931(the)S +3098(intensity)S +3511(sample)S +3855(is)S +3962(used)S +4196(as)S +4320(the)S +4487(z1/z2)S +4757(value.)S +6420 V +1175(Each)S +1440(of)S +1578(the)S +1759(CDL)S +2026(display)S +2391(procedures)S +2917(has)S +3110(a)S +11 I +3205(zscale)S +11 R +3520(\257ag)S +3732(to)S +3865(automatically)S +4510(scale)S +4775(the)S +4957(pixels)S +6540 V +900(prior)S +1151(to)S +1275(display.)S +1691(Applications)S +2290(wishing)S +2676(to)S +2799(set)S +2958(their)S +3196(own)S +3422(z1/z2)S +3696(values)S +4013(will)S +4222(need)S +4465(to)S +4588(call)S +4783(the)S +4954(zscale)S +6660 V +900(procedures)S +1421(and)S +1621(disable)S +1974(this)S +2176(\257ag.)S +2444(By)S +2615(default)S +2961(cdl_zscaleImage\(\))S +3803(will)S +4017(use)S +4206(a)S +4297(linear)S +4589(transform,)S +5086(the)S +6780 V +11 B +900(cdl_setZTrans\(\))S +11 R +1764(procedure)S +2312(may)S +2613(be)S +2828(used)S +3141(to)S +3339(change)S +3760(this.)S +4093(Acceptable)S +4696(values)S +5088(are)S +6900 V +11 B +900(CDL_UNITARY)S +11 R +1733(\(zero\))S +2026(for)S +2187(a)S +2269(unitary)S +2614(transform,)S +11 B +3102(CDL_LINEAR)S +11 R +3851(\(one\))S +4115(for)S +4276(a)S +4358(linear)S +4641(transform,)S +5129(or)S +7020 V +11 B +900(CDL_LOG)S +11 R +1466(\(two\))S +1736(for)S +1896(a)S +1977(log10)S +2261(transform.)S +7260 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7920 V +EP +%%Page: 10 13 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 10 -)S +840 V +11 C +1175(void)S +1505(cdl_computeZscale)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(uchar)S +3947(*pix,)S +4343(int)S +4607(nx,)S +960 V +1439(int)S +1703(ny,)S +1967(int)S +2231(bitpix,)S +2759(float)S +3155(*z1,)S +3485(float)S +3881(*z2\))S +1080 V +1175(void)S +1505(cdl_zscaleImage)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(uchar)S +3815(**pix,)S +4277(int)S +4541(nx,)S +1200 V +1439(int)S +1703(ny,)S +1967(int)S +2231(bitpix,)S +2759(float)S +3155(z1,)S +3419(float)S +3815(z2\))S +1440 V +1175(void)S +1505(cdl_setZTrans)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(ztrans\))S +1560 V +1175(void)S +1505(cdl_getZTrans)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(*ztrans\))S +1680 V +1175(void)S +1505(cdl_setZScale)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(float)S +3683(z1,)S +3947(float)S +4343(z2\))S +1800 V +1175(void)S +1505(cdl_getZScale)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(float)S +3683(*z1,)S +4013(float)S +4409(*z2\))S +2040 V +1175(void)S +1505(cdl_setSample)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(nsample\))S +2160 V +1175(void)S +1505(cdl_setSampleLines)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(int)S +3881(nlines\))S +2280 V +1175(void)S +1505(cdl_setContrast)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(float)S +3815(contrast\))S +2400 V +1175(void)S +1505(cdl_getSample)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(*nsample\))S +2520 V +1175(void)S +1505(cdl_getSampleLines)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(int)S +3881(*nlines\))S +2640 V +1175(void)S +1505(cdl_getContrast)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(float)S +3815(*contrast\))S +3000 V +11 B +900(4.11.)S +1187(Image)S +1512(Hardcopy)S +3156 V +11 R +1175(While)S +1479(most)S +1731(servers)S +2077(include)S +2437(some)S +2706(hardcopy)S +3150(capability)S +3620(of)S +3748(their)S +3986(own)S +4212(the)S +4383(CDL)S +4640(provides)S +5055(two)S +3276 V +900(procedures)S +1428(for)S +1603(creating)S +2003(hardcopy)S +2458(images)S +2817(from)S +3078(the)S +3260(client)S +3552(\(e.g.)S +3795(for)S +3970(a)S +4066(batch)S +4351(processing)S +4868(applica-)S +3396 V +900(tion\).)S +1207(The)S +1415(client)S +1697(will)S +1907(typically)S +2330(read)S +2555(back)S +2799(the)S +2971(entire)S +3258(image,)S +3592(frame)S +3884(bu)S +3994 H + (f)show 11 -.5 mul h (f)show +11 R +4061(er,)S +4212(of)S +4342(just)S +4541(a)S +4628(subraster)S +5062(and)S +3516 V +900(pass)S +1134(those)S +1411(pixels)S +1718(to)S +1848(the)S +2026(print)S +2278(procedure.)S +2819(Images)S +3179(will)S +3395(be)S +3542(written)S +3897(as)S +4032(Pseudocolor)S +4619(Postscript)S +5098(\(to)S +3636 V +900(preserve)S +1376(the)S +1617(overlay)S +2052(marker)S +2468(colors\))S +2879(and)S +3144(may)S +3440(be)S +3650(disposed)S +4142(to)S +4335(a)S +4490(\256le)S +4739(using)S +5086(the)S +3756 V +11 B +900(cdl_printPixToFile\(\))S +11 R +1903(procedure)S +2376(or)S +2504(to)S +2627(any)S +2822(command)S +3292(string)S +3580(accepting)S +4036(input)S +4299(from)S +11 I +4548(stdin)S +11 R +4799(\(typically)S +3876 V +900(just)S +1093(an)S +1229('lpr')S +1456(command\))S +1958(by)S +2101(using)S +2373(the)S +11 B +2540(cdl_printPix\(\))S +11 R +3233(procedure.)S +4116 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4236 V +11 C +1175(int)S +1439(cdl_printPix)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(char)S +3485(*cmd,)S +3881(uchar)S +4277(*pix,)S +4673(int)S +4937(nx,)S +4356 V +1439(int)S +1703(ny,)S +1967(int)S +2231(annotate\))S +4476 V +1175(int)S +1439(cdl_printPixToFile)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(char)S +3881(*fname,)S +4409(uchar)S +4805(*pix,)S +4596 V +1439(int)S +1703(nx,)S +1967(int)S +2231(ny,)S +2495(int)S +2759(annotate\))S +4836 V +11 B +900(4.12.)S +1187(Image)S +1512(Cursor)S +4992 V +11 R +1175(The)S +1390(image)S +1703(cursor)S +2021(is)S +2140(read)S +2372(using)S +2656(the)S +11 B +2835(cdl_readCursor\(\))S +11 R +3696(procedure.)S +4238(The)S +4453(returned)S +4863(value)S +5146(is)S +5112 V +900(the)S +1082(cursor)S +11 I +1403(\(x,y\))S +11 R +1647(position)S +2051(as)S +2190(\257oating)S +2575(point)S +2850(value)S +3135(in)S +3269(terms)S +3561(of)S +3700(the)S +3881(currently)S +4323(de\256ne)S +4638(image)S +4953(WCS.)S +5232 V +900(Note)S +1149(that)S +1350(this)S +1546(position)S +1938(must)S +2189(be)S +2328(converted)S +2796(to)S +2919(integer)S +3260(if)S +3364(it)S +3463(is)S +3574(to)S +3697(be)S +3837(used)S +4075(in)S +4198(one)S +4393(of)S +4521(the)S +4692(marker)S +5038(pro-)S +5352 V +900(cedures.)S +5592 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5712 V +11 C +1175(int)S +1439(cdl_readCursor)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(sample,)S +4079(float)S +4475(*x,)S +5832 V +1439(float)S +1835(*y,)S +2099(int)S +2363(*wcs,)S +2759(char)S +3089(*key\))S +6072 V +11 R +900(The)S +11 I +1103(wcs)S +11 R +1301(argument)S +1748(is)S +1855(de\256ned)S +2211(as)S +6312 V +1164(wcs)S +1367(=)S +1462(frame)S +1749(*)S +1837(100)S +2035(+)S +2130(wcs_number)S +6552 V +900(\(where)S +1247(wcs_number=0)S +1969(for)S +2141(frame)S +2440(bu)S +2550 H + (f)show 11 -.5 mul h (f)show +11 R +2617(er)S +2746(coords)S +3083(and)S +3286(1)S +3386(for)S +3558(image)S +3872(coords\).)S +4307(So,)S +4498(you)S +4709(can)S +4906(get)S +5086(the)S +6672 V +900(frame)S +1187(as)S +1311(simply)S +6912 V +1164(frame)S +1451(=)S +1546(\(int\))S +1768(\(wcs)S +2007(/)S +2071(100\))S +7920 V +EP +%%Page: 11 14 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 11 -)S +840 V +11 B +900(4.12.1.)S +1270(Cursor)S +1638(Sampling)S +996 V +11 R +1175(If)S +1307(the)S +1501(cdl_readCursor\(\))S +11 I +2308(sample)S +11 R +2680(\257ag)S +2906(is)S +3041(non-zero)S +3490(the)S +11 I +3685(logical)S +4052(image)S +4381(cursor)S +11 R +4729(position)S +5146(is)S +1116 V +900(returned)S +1300(immediately,)S +1914(otherwise)S +2376(the)S +2545(display)S +2898(server)S +3199(will)S +3406(wait)S +3630(for)S +3792(a)S +3875(keystroke)S +4336(before)S +4649(returning)S +5086(the)S +1236 V +900(cursor)S +1214(position.)S +1672(The)S +1883(logical)S +2223(image)S +2532(cursor)S +2846(is)S +2961(the)S +3136(last)S +3330(value)S +3609(set)S +3773(by)S +3925(a)S +11 I +4015(cdl_setCursor\(\))S +11 R +4753(call)S +4953(or)S +5086(the)S +1356 V +900(last)S +1101(value)S +1386(returned)S +1798(by)S +1956(a)S +11 I +2051(cdl_readCursor\(\))S +11 R +2873(call.)S +3139(When)S +3447(sampling)S +3898(the)S +4079(cursor)S +4399(position)S +4802(the)S +4983(keys-)S +1476 V +900(troke)S +1158(value)S +1428(is)S +1535(unde\256ned.)S +1716 V +11 B +900(4.13.)S +1187(Image)S +1512(Readout)S +1872 V +11 R +1175(The)S +1390(CDL)S +1655(maintains)S +2128(an)S +2276(internal)S +2657(knowledge)S +3184(of)S +3321(where)S +3633(an)S +3782(image)S +4096(has)S +4288(been)S +4540(positioned)S +5045(if)S +5158(it)S +1992 V +900(was)S +1110(displayed)S +1571(using)S +1850(one)S +2048(of)S +2179(the)S +11 I +2353(cdl_display*)S +11 R +2955(procedures.)S +3535(The)S +11 B +3744(cdl_readImage\(\))S +11 R +4556(procedure)S +5031(may)S +2112 V +900(be)S +1046(used)S +1290(to)S +1419(read)S +1649(back)S +1899(the)S +2077(entire)S +2370(image)S +2682(pixels)S +2989(from)S +3246(the)S +3424(server)S +3734(ignoring)S +4151(the)S +4329(region)S +4653(of)S +4788(the)S +4966(frame)S +2232 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1203(outside)S +1563(of)S +1696(the)S +1872(image,)S +2209(the)S +11 B +2384(cdl_readFrameBu)S +3238 H + (f)show 11 -.5 mul h (f)show +11 B +3305(er\(\))S +11 R +3514(procedure)S +3991(will)S +4204(read)S +4432(back)S +4679(the)S +4854(contents)S +2352 V +900(of)S +1024(the)S +1191(entire)S +1473(frame)S +1760(bu)S +1870 H + (f)show 11 -.5 mul h (f)show +11 R +1937(er.)S +2115(The)S +2318(dimensions)S +2853(of)S +2977(the)S +3144(array)S +3400(are)S +3565(returned)S +3962(in)S +4081(the)S +11 I +4248(nx)S +11 R +4384(and)S +11 I +4575(ny)S +11 R +4711(arguments.)S +2592 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2712 V +11 C +1175(int)S +1439(cdl_readImage)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(uchar)S +3617(**pix,)S +4079(int)S +4343(*nx,)S +2832 V +1439(int)S +1703(*ny\)R)S +2952 V +1175(int)S +1439(cdl_readFrameBuffer)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(uchar)S +4013(**pix,)S +3072 V +1439(int)S +1703(*nx,)S +2033(int)S +2297(*ny\)R)S +3312 V +11 B +900(4.14.)S +1187(Subraster)S +1684(I/O)S +3468 V +11 R +1175(The)S +11 B +1379(cdl_writeSubRaster\(\))S +11 R +2418(procedure)S +2888(is)S +2996(used)S +3231(to)S +3351(write)S +3610(an)S +3747(arbitrary)S +4157(raster)S +4433(to)S +4553(any)S +4745(location)S +5134(in)S +3588 V +900(the)S +1069(display.)S +1483(Similarly)S +1929(the)S +11 B +2098(cdl_readSubRaster\(\))S +11 R +3109(procedure)S +3580(is)S +3689(used)S +3925(to)S +4046(read)S +4268(back)S +4509(an)S +4647(arbitrary)S +5057(ras-)S +3708 V +900(ter.)S +1127(When)S +1439(an)S +1593(image)S +1912(has)S +2109(previously)S +2624(been)S +2881(displayed)S +3353(the)S +3538(subraster)S +3984(position)S +4392(is)S +4518(given)S +4814(in)S +4952(image)S +3828 V +900(coordinates)S +1446(\(e.g.)S +1682(when)S +1960(writing)S +2319(a)S +2408(subregion)S +2882(of)S +3014(edited)S +3323(pixels\),)S +3690(otherwise)S +4156(the)S +4330(position)S +4726(is)S +4840(in)S +4966(frame)S +3948 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1256(coordinates)S +1856(\(e.g.)S +2146(to)S +2327(display)S +2740(multiple)S +3203(images)S +3609(per)S +3843(frame)S +4193(you)S +4454(should)S +4844(use)S +5086(the)S +4068 V +900(cdl_writeSubRaster\(\))S +1885(call\).)S +2187(See)S +2392(the)S +2573(section)S +2931(on)S +11 I +3088(Marker)S +3463(Coordinates)S +11 R +4055(for)S +4228(further)S +4571(explanation)S +5129(of)S +4188 V +900(the)S +1067(coordinate)S +1562(systems)S +1944(used.)S +4428 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4548 V +11 C +1175(int)S +1439(cdl_writeSubRaster)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(int)S +3815(lx,)S +4079(int)S +4343(ly,)S +4607(int)S +4871(nx,)S +4668 V +1439(int)S +1703(ny,)S +1967(uchar)S +2363(*pix\))S +4788 V +1175(int)S +1439(cdl_readSubRaster)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(lx,)S +4013(int)S +4277(ly,)S +4541(int)S +4805(nx,)S +4908 V +1439(int)S +1703(ny,)S +1967(uchar)S +2363(**pix\))S +5148 V +11 B +900(5.)S +1049(Graphics)S +1517(Overlay)S +5388 V +900(5.1.)S +1132(Marker)S +1529(Coordinates)S +5544 V +11 R +1175(All)S +1369(marker)S +1731(positions)S +2183(are)S +2368(assumed)S +2799(to)S +2938(be)S +3094(image)S +3415(pixel)S +3688(coordinates,)S +4274(although)S +4712(there)S +4983(is)S +5110(no)S +5664 V +900(requirement)S +1465(that)S +1666(the)S +1836(position)S +2227(be)S +2365(on)S +2510(the)S +2679(image)S +2982(itself.)S +3298(When)S +3594(an)S +3732(image)S +4035(WCS)S +4309(is)S +4418(de\256ned)S +4776(\(using)S +5086(the)S +5784 V +900(CDL)S +1162(display)S +1522(procedures)S +2043(or)S +2176(explicitly\))S +2670(the)S +2846(origin)S +3151(of)S +3284(the)S +3460(coordinates)S +4007(used)S +4251(shifts)S +4533(from)S +4789(the)S +4966(frame)S +5904 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1205(lower-left)S +1680(to)S +1810(the)S +1988(lower-left)S +2463(of)S +2598(the)S +2776(image)S +3088(as)S +3222(displayed)S +3686(in)S +3815(the)S +3992(frame.)S +4383(Negative)S +4821(positions)S +6024 V +900(are)S +1069(allowed)S +1453(and)S +1648(will)S +1857(either)S +2144(refer)S +2386(to)S +2510(empty)S +2823(pixels)S +3124(if)S +3229(the)S +3401(frame)S +3693(bu)S +3803 H + (f)show 11 -.5 mul h (f)show +11 R +3870(er)S +3992(is)S +4104(larger)S +4396(than)S +4623(the)S +4795(image,)S +5129(or)S +6144 V +900(pixels)S +1213(outside)S +1581(the)S +1765(frame)S +2069(bu)S +2179 H + (f)show 11 -.5 mul h (f)show +11 R +2246(er)S +2380(boundaries.)S +2971(Raster)S +3300(I/O)S +3495(requests)S +3903(will)S +4124(be)S +4276(clipped)S +4648(to)S +4783(the)S +4966(frame)S +6264 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1194(endpoints,)S +1683(a)S +1764(request)S +2113(completely)S +2634(outside)S +2985(the)S +3152(frame)S +3439(bu)S +3549 H + (f)show 11 -.5 mul h (f)show +11 R +3616(er)S +3733(is)S +3840(an)S +3976(error.)S +6504 V +11 B +900(5.2.)S +1132(Mapping)S +1595(a)S +1683(Previously)S +2211(Displayed)S +2710(Image)S +6660 V +11 R +1175(Ideally)S +1512(any)S +1703(application)S +2224(wishing)S +2606(to)S +2725(draw)S +2976(markers)S +3361(on)S +3504(an)S +3641(image)S +3943(will)S +4149(have)S +4389(also)S +4600(displayed)S +5055(that)S +6780 V +900(image,)S +1242(however)S +1664(the)S +11 B +1844(cdl_mapFrame\(\))S +11 R +2675(procedure)S +3157(may)S +3392(be)S +3540(used)S +3786(to)S +3917(map)S +4151(the)S +4330(requested)S +4794(frame)S +5093(for)S +6900 V +900(marker)S +1247(overlay.)S +1674(It)S +1779(does)S +2018(this)S +2216(by)S +2365(reading)S +2732(the)S +2905(WCS)S +3183(de\256ned)S +3545(for)S +3711(that)S +3915(frame)S +4208(and)S +4405(assumes)S +4810(an)S +4952(image)S +7020 V +900(has)S +1089(been)S +1338(displayed)S +1802(and)S +2003(centered)S +2415(in)S +2544(the)S +2721(frame)S +3018(bu)S +3128 H + (f)show 11 -.5 mul h (f)show +11 R +3195(er,)S +3350(then)S +3582(resets)S +3874(the)S +4051(internal)S +4428(CDL)S +4690(image)S +5000(posi-)S +7140 V +900(tion.)S +1200(For)S +1387(this)S +1581(reason)S +1900(it)S +1997(should)S +2326(not)S +2502(be)S +2640(used)S +2876(when)S +3148(multiple)S +3551(image)S +3854(mappings)S +4317(have)S +4558(been)S +4799(displayed)S +7260 V +900(to)S +1026(a)S +1114(frame)S +1408(unless)S +1723(the)S +1897(marker)S +2246(overlay)S +2614(can)S +2805(be)S +2948(done)S +3201(reliably)S +3576(using)S +3855(the)S +4029(last)S +4222(WCS)S +4501(displayed)S +4961(to)S +5086(the)S +7920 V +EP +%%Page: 12 15 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 12 -)S +840 V +900(frame)S +1191(bu)S +1301 H + (f)show 11 -.5 mul h (f)show +11 R +1368(er.)S +1550(If)S +1659(no)S +1807(image)S +2113(has)S +2297(been)S +2541(displayed)S +3000(the)S +3172(frame)S +3464(bu)S +3574 H + (f)show 11 -.5 mul h (f)show +11 R +3641(er)S +3763(is)S +3875(mapped)S +4260(directly.)S +4694(This)S +4928(can)S +5117(be)S +960 V +900(used)S +1142(for)S +1310(example)S +1722(to)S +1849(map)S +2079(an)S +2223(empty)S +2539(frame)S +2834(for)S +3002(displaying)S +3502(just)S +3703(the)S +3878(markers)S +4271(without)S +4649(an)S +4793(image,)S +5129(or)S +1080 V +900(for)S +1063(mapping)S +1484(another)S +1849(frame's)S +2219(WCS)S +2495(for)S +2659(use)S +2842(on)S +2989(the)S +3160(current)S +3506(display.)S +3922(The)S +4129(frame)S +4420(is)S +4531(not)S +4709(changed)S +5110(by)S +1200 V +900(the)S +1067(procedure)S +1536(call)S +1727(however)S +2136(the)S +2303(current)S +2645(WCS)S +11 I +2917(is)S +11 R +3024(changed.)S +1440 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +1560 V +11 C +1175(int)S +1439(cdl_mapFrame)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(frame\))S +1800 V +11 B +900(5.3.)S +1132(Marking)S +1581(a)S +1669(Coordinate)S +2233(File)S +1956 V +11 R +1175(Since)S +1465(a)S +1559(common)S +1990(function)S +2402(for)S +2576(programs)S +3037(will)S +3256(be)S +3406(to)S +3539(mark)S +3811(a)S +3906(list)S +4089(of)S +4227(coordinates,)S +4807(the)S +4988(high-)S +2076 V +900(level)S +11 B +1158(cdl_markCoordsFile\(\))S +11 R +2246(procedure)S +2727(is)S +2846(provided)S +3281(to)S +3412(make)S +3693(this)S +3897(easier.)S +4256(The)S +4470(input)S +4741(parameters)S +2196 V +900(include)S +1273(a)S +1371(\256lename)S +1799(expected)S +2237(to)S +2373(contain)S +2747(a)S +2846(set)S +3019(of)S +3161(\(x,y\))S +3422(points)S +3743(\(real)S +3993(or)S +4135(integer\),)S +4554(and)S +4763(arguments)S +2316 V +900(specifying)S +1395(the)S +1567(point)S +1832(type,)S +2087(size)S +2294(and)S +2489(color)S +2751(to)S +2874(draw.)S +3190(If)S +3299(the)S +11 I +3470(label)S +11 R +3727(argument)S +4178(is)S +4289(positive)S +4675(each)S +4911(marker)S +2436 V +900(point)S +1160(will)S +1365(be)S +1501(labeled)S +1850(with)S +2079(it's)S +2254(relative)S +2616(number)S +2985(in)S +3105(the)S +3273(\256le.)S +3509(The)S +3713(size,)S +3945(type)S +4168(and)S +4360(color)S +4619(arguments)S +5110(all)S +2556 V +900(have)S +1139(the)S +1306(same)S +1564(meaning)S +1975(as)S +2099(for)S +2259(the)S +11 B +2426(cdl_markPoint\(\))S +11 R +3234(procedure)S +3703(described)S +4155(below.)S +2796 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2916 V +11 C +1175(int)S +1439(cdl_markCoordsFile)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(char)S +3881(*fname,)S +4409(int)S +4673(type,)S +3036 V +1439(int)S +1703(size,)S +2099(int)S +2363(color,)S +2825(int)S +3089(label\))S +3276 V +11 B +900(5.4.)S +1132(Marker)S +1529(Colors)S +3432 V +11 R +1175(Markers)S +1576(may)S +1802(be)S +1942(drawn)S +2252(using)S +2528(any)S +2723(8-bit)S +2969(value,)S +3272(in)S +3396(order)S +3664(to)S +3788(use)S +3972(the)S +4144(static)S +4414(overlay)S +4780(colors)S +5086(the)S +3552 V +900(color)S +1174(must)S +1438(be)S +1589(in)S +1723(the)S +1905(range)S +2195(201-217)S +2609(\(see)S +2832(above)S +3141(for)S +3316(notes)S +3596(on)S +3754(the)S +3936(XImtool)S +4357(color)S +4630(model\).)S +5050(The)S +3672 V +900(")S +11 I +945(cdl.h)S +11 R +1162(")S +1272(include)S +1660(\256le)S +1866(for)S +2059(C)S +2199(programs,)S +2707(the)S +2907(")S +11 I +2952(cdlftn.inc)S +11 R +3365(")S +3476(include)S +3865(for)S +4058(fortran)S +4421(programs,)S +4929(or)S +5086(the)S +3792 V +900(")S +11 I +945(cdlspp.h)S +11 R +1315(")S +1402(include)S +1767(for)S +1936(SPP)S +2164(programs,)S +2648(de\256nes)S +3001(the)S +3177(following)S +3647(symbolic)S +4093(constants)S +4544(for)S +4713(each)S +4954(of)S +5086(the)S +3912 V +900(static)S +1165(overlay)S +1526(colors:)S +4152 V +11 B +1730(C_BLACK)S +11 R +2603(202)S +11 B +3263(C_CORAL)S +11 R +4224(210)S +4272 V +11 B +1730(C_WHITE)S +11 R +2603(203)S +11 B +3263(C_MAROON)S +11 R +4224(211)S +4392 V +11 B +1730(C_RED)S +11 R +2603(204)S +11 B +3263(C_ORANGE)S +11 R +4224(212)S +4512 V +11 B +1730(C_GREEN)S +11 R +2603(205)S +11 B +3263(C_KHAKI)S +11 R +4224(213)S +4632 V +11 B +1730(C_BLUE)S +11 R +2603(206)S +11 B +3263(C_ORCHID)S +11 R +4224(214)S +4752 V +11 B +1730(C_YELLOW)S +11 R +2603(207)S +11 B +3263(C_TURQUOISE)S +11 R +4224(215)S +4872 V +11 B +1730(C_CYAN)S +11 R +2603(208)S +11 B +3263(C_VIOLET)S +11 R +4224(216)S +4992 V +11 B +1730(C_MAGENTA)S +11 R +2603(209)S +11 B +3263(C_WHEAT)S +11 R +4224(217)S +5292 V +11 B +900(5.5.)S +1132(Marker)S +1529(Types)S +5448 V +11 R +1175(Currently)S +1629(supported)S +2095(marker)S +2437(types)S +2702(include:)S +5628 V +11 I +1534(Point)S +1974(Line)S +2846(Box)S +3317(Polyline)S +4220(Polygon)S +5748 V +1534(Circle)S +1974(Circular)S +2387(Annuli)S +2846(Ellipse)S +3317(Elliptical)S +3761(Annuli)S +4220(Text)S +5964 V +11 R +1175(The)S +1386(")S +11 I +1431(cdl.h)S +11 R +1648(")S +1734(include)S +2099(\256le)S +2282(for)S +2451(C)S +2567(programs,)S +3051(the)S +3227(")S +11 I +3272(cdlftn.inc)S +11 R +3685(")S +3772(include)S +4137(for)S +4306(fortran)S +4645(programs,)S +5129(or)S +6084 V +900(the)S +1075(")S +11 I +1120(cdlspp.h)S +11 R +1490(")S +1576(include)S +1940(\256le)S +2122(SPP)S +2349(programs,)S +2832(de\256nes)S +3184(the)S +3359(following)S +3828(symbolic)S +4273(constants)S +4723(for)S +4890(each)S +5129(of)S +6204 V +900(the)S +1067(de\256ned)S +11 I +1423(Point)S +11 R +1695(marker)S +2037(types:)S +6384 V +11 B +1835(M_FILL)S +11 R +2761(1)S +11 B +3311(M_CIRCLE)S +11 R +4174(64)S +6504 V +11 B +1835(M_POINT)S +11 R +2761(2)S +11 B +3311(M_STAR)S +11 R +4119(128)S +6624 V +11 B +1835(M_BOX)S +11 R +2761(4)S +11 B +3311(M_HLINE)S +11 R +4119(256)S +6744 V +11 B +1835(M_PLUS)S +11 R +2761(8)S +11 B +3311(M_VLINE)S +11 R +4119(512)S +6864 V +11 B +1835(M_CROSS)S +11 R +2706(16)S +11 B +3311(M_HBLINE)S +11 R +4064(1024)S +6984 V +11 B +1835(M_DIAMOND)S +11 R +2706(32)S +11 B +3311(M_VBLINE)S +11 R +4064(2048)S +7920 V +EP +%%Page: 13 16 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 13 -)S +840 V +1175(Point)S +1449(markers)S +1841(are)S +2013(drawn)S +2326(using)S +2605(the)S +11 B +2779(cdl_markPoint\(\))S +11 R +3594(procedure,)S +4098(point)S +4365(types)S +4638(may)S +4868(be)S +5012(logi-)S +960 V +900(cally)S +11 I +1156(OR)S +11 R +1302('d)S +1436(to)S +1565(create)S +1867(composite)S +2362(markers,)S +2784(closed)S +3106(shapes)S +3440(such)S +3683(as)S +3816(a)S +3906(circles,)S +4261(diamonds,)S +4759(or)S +4892(squares)S +1080 V +900(may)S +1122(be)S +11 I +1258(OR)S +11 R +1404('d)S +1528(with)S +1757(the)S +1924(M_FILL)S +2342(\257ag)S +2540(to)S +2659(\257ood-\256ll)S +3079(the)S +3246(point)S +3506(with)S +3735(the)S +3902(current)S +4244(overlay)S +4605(color.)S +1320 V +11 B +900(5.5.1.)S +1215(Point)S +1476 V +11 R +1175(The)S +11 B +1384(cdl_markPoint\(\))S +11 R +2199(procedure)S +2675(is)S +2789(used)S +3030(to)S +3156(mark)S +3421(a)S +3509(speci\256c)S +3884(point)S +4151(on)S +4301(the)S +4475(image)S +4783(using)S +5062(one)S +1596 V +900(of)S +1033(the)S +1209(marker)S +1560(types)S +1834(listed)S +2115(above.)S +2479(The)S +2691(marker)S +3042(is)S +3158(centered)S +3569(at)S +3690(the)S +3866(coordinates)S +4413(speci\256ed)S +4845(by)S +4997(the)S +11 I +5172(x)S +1716 V +11 R +900(and)S +11 I +1099(y)S +11 R +1188(arguments,)S +11 I +1714(type)S +11 R +1937(is)S +2052(an)S +2196(integer)S +2542(\257ag)S +2749(indicating)S +3231(what)S +3486(kind)S +3724(of)S +3857(marker)S +4208(to)S +4336(draw)S +4596(and)S +4796(may)S +5027(be)S +5172(a)S +1836 V +900(composite)S +1393(type)S +1623(by)S +1774(logically)S +2200(ORing)S +2535(two)S +2741(or)S +2873(more)S +3138(marker)S +3487(types.)S +11 I +3820(Size)S +11 R +4037(is)S +4151(the)S +4325(width)S +4616(and)S +4814(height)S +5129(of)S +1956 V +900(the)S +1082(marker)S +1439(measured)S +1906(in)S +2040(pixel)S +2308(unxits,)S +2654(and)S +11 I +2860(color)S +11 R +3140(is)S +3262(the)S +3444(color)S +3717(used)S +3966(to)S +4100(draw)S +4366(the)S +4548(marker.)S +4966(If)S +5086(the)S +2076 V +11 I +900(number)S +11 R +1280(argument)S +1739(is)S +1858(greater)S +2205(than)S +2439(zero)S +2671(that)S +2881(number)S +3260(will)S +3476(be)S +3623(drawn)S +3940(next)S +4173(to)S +4303(the)S +4481(point)S +4752(as)S +4887(a)S +4979(label,)S +2196 V +900(creating)S +1285(text)S +1483(labels)S +1772(for)S +1932(point)S +2192(markers)S +2577(can)S +2761(be)S +2897(done)S +3143(using)S +3415(the)S +11 I +3582(cdl_markPointLabel)S +11 R +4519(procedure.)S +2352 V +1175(Most)S +1466(marker)S +1839(names)S +2183(are)S +2379(fairly)S +2680(obvious)S +3093(but)S +3299(several)S +3673(are)S +3870(worth)S +4191(special)S +4560(mention:)S +5050(The)S +2472 V +900(M_DIAMOND,)S +1676(M_CIRCLE)S +2287(and)S +2511(M_BOX)S +2962(marker)S +3337(types)S +3635(may)S +3890(be)S +4059(logically)S +11 I +4510(OR)S +11 R +4656(ed)S +4825(with)S +5086(the)S +2592 V +900(M_FILL)S +1331(\257ag)S +1542(to)S +1674(produce)S +2072(a)S +2166(\256lled)S +2439(marker)S +2794(type.)S +3090(Unless)S +11 I +3435(OR)S +11 R +3581(d)S +3682(with)S +3924(the)S +4104(M_POINT)S +4626(\257ag)S +4837(all)S +4993(point)S +2712 V +900(markers)S +1306(will)S +1531(leave)S +1814(the)S +2001(center)S +2320(pixel)S +2593(unchanged.)S +3181(The)S +3404(M_HLINE)S +3938(and)S +4149(M_VLINE)S +4683(markers)S +5088(are)S +2832 V +900(most)S +1149(useful)S +1451(in)S +1571(astronomical)S +2172(applications)S +2737(to)S +2857(mark)S +3116(an)S +3253(individual)S +3734(star,)S +3954(they)S +4177(are)S +4343(horizontal)S +4822(and)S +5014(vert-)S +2952 V +900(ical)S +1117(lines)S +1384(respectively)S +1971(with)S +2225(a)S +2331(gap)S +2547(in)S +2691(the)S +2883(middle)S +3247(third)S +3513(of)S +3662(the)S +3854(marker)S +4221(\(the)S +4449(M_HBLINE)S +5062(and)S +3072 V +900(M_VBLINE)S +1488(are)S +1653(identical)S +2064(but)S +2238(with)S +2467(a)S +2548(width)S +2832(of)S +2956(3)S +3044(pixels\).)S +3252 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3372 V +11 C +1175(int)S +1439(cdl_markPoint)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(x,)S +3683(int)S +3947(y,)S +4145(int)S +4409(number,)S +3492 V +1439(int)S +1703(size,)S +2099(int)S +2363(type,)S +2759(int)S +3023(color\))S +3612 V +1175(int)S +1439(cdl_markPointLabel)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(int)S +3815(x,)S +4013(int)S +4277(y,)S +4475(char)S +4805(*label)S +3732 V +1439(int)S +1703(size,)S +2099(int)S +2363(type,)S +2759(int)S +3023(color\))S +3972 V +11 B +900(5.5.2.)S +1215(Line)S +4128 V +11 R +1175(The)S +11 B +1399(cdl_markLine\(\))S +11 R +2192(procedure)S +2682(is)S +2810(used)S +3065(to)S +3205(draw)S +3477(a)S +3579(line)S +3798(of)S +3943(the)S +4131(speci\256ed)S +4576(color)S +4856(between)S +4248 V +900(points)S +1203(\()S +11 I +1239(xs,ys)S +11 R +1449(\))S +1518(and)S +1709(\()S +11 I +1745(xe,ye)S +11 R +1965(\).)S +4428 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4548 V +11 C +1175(int)S +1439(cdl_markLine)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(xs,)S +3683(int)S +3947(ys,)S +4211(int)S +4475(xe,)S +4739(int)S +5003(ye,)S +4668 V +1439(int)S +1703(color\))S +4908 V +11 B +900(5.5.3.)S +1215(Box)S +5064 V +11 R +1175(The)S +11 B +1378(cdl_markBox\(\))S +11 R +2120(procedure)S +2590(is)S +2698(used)S +2933(to)S +3053(draw)S +3305(a)S +3387(box)S +3586(of)S +3711(the)S +3879(speci\256ed)S +4303(color)S +4562(with)S +4792(endpoints)S +5184 V +900(speci\256ed)S +1323(by)S +1466(\()S +11 I +1502(lx,ly)S +11 R +1688(\))S +1757(and)S +1948(\()S +11 I +1984(ux,uy)S +11 R +2218(\).)S +2348(If)S +2453(the)S +11 I +2620(\256ll)S +11 R +2770(\257ag)S +2968(is)S +3075(set)S +3230(the)S +3397(box)S +3595(will)S +3800(be)S +3936(\256lled)S +4196(with)S +4425(the)S +4592(marker)S +4934(color.)S +5364 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5484 V +11 C +1175(int)S +1439(cdl_markBox)S +2231(\(CDLPtr)S +2759(cdl,)S +3089(int)S +3353(lx,)S +3617(int)S +3881(ly,)S +4145(int)S +4409(ux,)S +4673(int)S +4937(uy,)S +5604 V +1439(int)S +1703(fill,)S +2099(int)S +2363(color\))S +5844 V +11 B +900(5.5.4.)S +1215(Circle)S +6000 V +11 R +1175(The)S +11 B +1393(cdl_markCircle\(\))S +11 R +2250(procedure)S +2734(is)S +2856(used)S +3105(to)S +3239(draw)S +3505(a)S +3601(circle)S +3891(of)S +4031(the)S +4214(speci\256ed)S +4653(color)S +4927(with)S +5172(a)S +6120 V +900(center)S +1209(at)S +1331(\()S +11 I +1367(x,y)S +11 R +1491(\))S +1570(and)S +1771(radius)S +11 I +2082(radius)S +11 R +2364(.)S +2468(If)S +2583(the)S +11 I +2760(\256ll)S +11 R +2920(\257ag)S +3128(is)S +3245(set)S +3409(the)S +3585(circle)S +3869(will)S +4083(be)S +4228(\256lled)S +4497(with)S +4735(the)S +4911(marker)S +6240 V +900(color.)S +6420 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6540 V +11 C +1175(int)S +1439(cdl_markCircle)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(x,)S +3749(int)S +4013(y,)S +4211(int)S +4475(radius,)S +6660 V +1439(int)S +1703(fill,)S +2099(int)S +2363(color\))S +7920 V +EP +%%Page: 14 17 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2936(- 14 -)S +840 V +11 B +900(5.5.5.)S +1215(Polyline)S +996 V +11 R +1175(The)S +11 B +1401(cdl_markPolyline\(\))S +11 R +2361(procedure)S +2853(is)S +2983(used)S +3240(to)S +3382(draw)S +3656(a)S +3760(line)S +3981(connecting)S +4518(the)S +11 I +4709(npts)S +11 R +4950(points)S +1116 V +900(speci\256ed)S +1323(by)S +1466(the)S +11 I +1633(xpts)S +11 R +1843(and)S +11 I +2034(ypts)S +11 R +2244(array)S +2500(in)S +2619(the)S +2786(desired)S +11 I +3135(color)S +11 R +3367(.)S +1296 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +1416 V +11 C +1175(int)S +1439(cdl_markPolyline)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(int)S +3683(*xpts,)S +4145(int)S +4409(*ypts,)S +1536 V +1439(int)S +1703(npts,)S +2099(int)S +2363(color\))S +1776 V +11 B +900(5.5.6.)S +1215(Polygon)S +1932 V +11 R +1175(The)S +11 B +1390(cdl_markPolygon\(\))S +11 R +2339(procedure)S +2820(is)S +2939(used)S +3185(to)S +3316(draw)S +3579(a)S +3673(closed)S +3999(polygon)S +4406(consisting)S +4899(of)S +11 I +5036(npts)S +2052 V +11 R +900(vertices)S +1275(speci\256ed)S +1700(by)S +1845(the)S +11 I +2014(xpts)S +11 R +2226(and)S +11 I +2418(ypts)S +11 R +2629(array)S +2886(in)S +3006(the)S +3174(desired)S +11 I +3524(color)S +11 R +3756(.)S +3851(The)S +4055(last)S +4242(point)S +4503(in)S +4623(the)S +4791(array)S +5048(will)S +2172 V +900(automatically)S +1542(be)S +1689(connected)S +2176(to)S +2306(the)S +2484(\256rst)S +2700(point)S +2971(by)S +3125(the)S +3303(procedure.)S +3845(If)S +3962(the)S +11 I +4141(\256ll)S +11 R +4303(\257ag)S +4513(is)S +4632(set)S +4799(the)S +4978(circle)S +2292 V +900(will)S +1105(be)S +1241(\256lled)S +1501(with)S +1730(the)S +1897(marker)S +2239(color.)S +2472 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2592 V +11 C +1175(int)S +1439(cdl_markPolygon)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(int)S +3617(*xpts,)S +4079(int)S +4343(*ypts,)S +2712 V +1439(int)S +1703(npts,)S +2099(int)S +2363(fill,)S +2759(int)S +3023(color\))S +2952 V +11 B +900(5.5.7.)S +1215(Ellipse)S +3108 V +11 R +1175(The)S +11 B +1383(cdl_markEllipse\(\))S +11 R +2265(procedure)S +2739(is)S +2851(used)S +3091(to)S +3216(draw)S +3473(an)S +3615(ellipse)S +3941(of)S +4071(the)S +4244(speci\256ed)S +4673(color)S +4937(with)S +5172(a)S +3228 V +900(center)S +1207(at)S +1327(\()S +11 I +1363(x,y)S +11 R +1487(\))S +1563(and)S +1761(semimajor-axis)S +11 I +2478(xrad)S +11 R +2719(and)S +2917(semiminor-axis)S +11 I +3641(yrad)S +11 R +3882(pixels)S +4185(long.)S +4482(A)S +4601(rotation)S +4983(angle)S +3348 V +900(for)S +1063(the)S +1233(ellipse)S +1556(may)S +1781(be)S +1920(speci\256ed)S +2346(by)S +2492(passing)S +2858(a)S +2942(non-zero)S +11 I +3366(angle)S +11 R +3646(argument,)S +4124(the)S +4294(angle)S +4567(is)S +4678(measured)S +5134(in)S +3468 V +900(degrees)S +1276(from)S +1532(the)S +1709(positive)S +2101(x-axis.)S +2473(If)S +2587(the)S +11 I +2763(\256ll)S +11 R +2922(\257ag)S +3129(is)S +3245(set)S +3409(the)S +3585(circle)S +3869(will)S +4083(be)S +4228(\256lled)S +4497(with)S +4735(the)S +4911(marker)S +3588 V +900(color.)S +3768 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3888 V +11 C +1175(int)S +1439(cdl_markEllipse)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(int)S +3617(x,)S +3815(int)S +4079(y,)S +4277(int)S +4541(xrad,)S +4008 V +1439(int)S +1703(yrad,)S +2099(float)S +2495(ang,)S +2825(int)S +3089(fill,)S +3485(int)S +3749(color\))S +4248 V +11 B +900(5.5.8.)S +1215(Circular)S +1650(Annuli)S +4404 V +11 R +1175(The)S +11 B +1391(cdl_markCircAnnuli\(\))S +11 R +2494(procedure)S +2976(is)S +3096(used)S +3344(to)S +3477(draw)S +11 I +3742(nannuli)S +11 R +4126(circles)S +4458(separated)S +4917(by)S +11 I +5074(sep)S +4524 V +11 R +900(pixels)S +1196(each.)S +1489(The)S +1692(circle)S +1967(is)S +2074(centered)S +2476(at)S +2588(\()S +11 I +2624(x,y)S +11 R +2748(\))S +2817(with)S +3046(an)S +3182(initial)S +3473(radius)S +3774(of)S +11 I +3898(radius)S +11 R +4213(pixels.)S +4704 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4824 V +11 C +1175(int)S +1439(cdl_markCircAnnuli)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(int)S +3815(x,)S +4013(int)S +4277(y,)S +4475(int)S +4739(radius,)S +4944 V +1439(int)S +1703(nannuli,)S +2297(int)S +2561(sep,)S +2891(int)S +3155(color\))S +5184 V +11 B +900(5.5.9.)S +1215(Elliptical)S +1678(Annuli)S +5340 V +11 R +1175(The)S +11 B +1385(cdl_markEllipAnnuli\(\))S +11 R +2505(procedure)S +2981(is)S +3095(used)S +3336(to)S +3462(draw)S +11 I +3721(nannuli)S +11 R +4099(ellipses)S +4470(separated)S +4923(by)S +11 I +5074(sep)S +5460 V +11 R +900(pixels)S +1220(each.)S +1537(The)S +1764(ellipse)S +2108(is)S +2239(centered)S +2665(at)S +2801(\()S +11 I +2837(x,y)S +11 R +2961(\))S +3054(with)S +3307(an)S +3467(initial)S +3782(semimajor)S +4302(and)S +4516(semiminor)S +5043(axis)S +5580 V +900(speci\256ed)S +1335(by)S +1490(the)S +11 I +1669(xrad)S +11 R +1915(and)S +11 I +2118(yrad)S +11 R +2364(arguments.)S +2927(Each)S +3190(ellipse)S +3522(will)S +3739(be)S +3887(optionally)S +4379(rotate)S +4673(by)S +4828(an)S +11 I +4976(angle)S +5700 V +11 R +900(degrees)S +1266(as)S +1390(measured)S +1842(from)S +2088(the)S +2255(positive)S +2637(x-axis.)S +5880 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6000 V +11 C +1175(int)S +1439(cdl_markEllipAnnuli)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(x,)S +3815(y,)S +4013(xrad,)S +4409(yrad,)S +4805(ang,)S +6120 V +1439(int)S +1703(nannuli,)S +2297(int)S +2561(sep,)S +2891(int)S +3155(color\))S +6360 V +11 B +900(5.5.10.)S +1270(Text)S +6516 V +11 R +1175(The)S +11 B +1393(cdl_markText\(\))S +11 R +2178(procedure)S +2662(is)S +2784(used)S +3033(to)S +3167(draw)S +3433(a)S +3529(text)S +3742(string)S +4042(speci\256ed)S +4481(by)S +11 I +4640(str)S +11 R +4806(argument)S +6636 V +900(with)S +1142(an)S +1291(initial)S +1595(position)S +1997(at)S +2121(\()S +11 I +2157(x,y)S +11 R +2281(\))S +2362(and)S +2565(optionally)S +3057(rotated)S +3406(by)S +11 I +3561(angle)S +11 R +3850(degrees)S +4228(as)S +4364(measured)S +4828(from)S +5086(the)S +6756 V +900(positive)S +1288(x-axis.)S +1657(The)S +1867(default)S +11 I +2211(size)S +11 R +2416(is)S +2530(1.0)S +2708(and)S +2906(is)S +3020(approximately)S +3694(a)S +3782(6x13)S +4042(font,)S +4287(the)S +4461(font)S +4678(size)S +4888(may)S +5117(be)S +6876 V +900(scaled)S +1206(by)S +1349(any)S +1540(fractional)S +1992(amount.)S +7056 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7176 V +11 C +1175(int)S +1439(cdl_markText)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(x,)S +3617(int)S +3881(y,)S +4079(char)S +4409(*str,)S +7296 V +1439(float)S +1835(size,)S +2231(float)S +2627(angle,)S +3089(int)S +3353(color\))S +7920 V +EP +%%Page: 15 18 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2936(- 15 -)S +840 V +11 B +900(5.6.)S +1132(Text)S +1378(Fonts)S +996 V +11 R +1175(The)S +11 B +1382(cdl_setFont\(\))S +11 R +2034(procedure)S +2507(is)S +2618(used)S +2856(to)S +2979(choose)S +3320(between)S +3721(one)S +3917(of)S +4046(four)S +4266(available)S +4699(fonts)S +4957(as)S +5086(the)S +1116 V +900(text)S +1099(marker)S +1442(default:)S +1811(Roman,)S +2191(Greek,)S +2518(Futura,)S +2866(Bold)S +3114(and)S +3305(Times)S +3613(respectively.)S +4236(By)S +4398(default)S +4735(the)S +4902(Roman)S +1236 V +900(font)S +1110(will)S +1315(be)S +1451(used.)S +1713(The)S +1916(width)S +2200(of)S +2324(the)S +2491(lines)S +2732(used)S +2966(to)S +3085(draw)S +3336(the)S +3503(text)S +3701(may)S +3923(also)S +4133(be)S +4269(set.)S +1416 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +1536 V +11 C +1175(void)S +1505(cdl_setFont)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(font\))S +1656 V +1175(void)S +1505(cdl_setTextWidth)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(width\))S +1836 V +11 R +900(A)S +1023(complete)S +1469(listing)S +1790(of)S +1925(the)S +2103(Greek)S +2413(character)S +2856(mappings)S +3329(can)S +3525(be)S +3673(found)S +3974(in)S +4105(the)S +4284(\256le)S +4470('greek.ps')S +4955(in)S +5086(the)S +1956 V +900('doc')S +1173(subdirectory)S +1764(of)S +1898(the)S +2074(CDL)S +2336(distribution.)S +3223(The)S +11 I +3435(Roman)S +11 R +3788(font)S +4007(is)S +4123(the)S +4299(font)S +4518(implemented)S +5134(in)S +2076 V +900(the)S +1084(original)S +1476(version)S +1849(of)S +1990(the)S +2174(CDL)S +2444(and)S +2652(works)S +2970(well)S +3209(for)S +3386(most)S +3651(applications.)S +4294(Both)S +4560(the)S +11 I +4745(Greek)S +11 R +5062(and)S +2196 V +11 I +900(Times)S +11 R +1211(fonts)S +1479(are)S +1659(hi-resolution)S +2269(fonts)S +2537(which)S +2853(work)S +3126(best)S +3351(for)S +3526(larger)S +3828(frame)S +4130(bu)S +4240 H + (f)show 11 -.5 mul h (f)show +11 R +4307(ers)S +4482(but)S +4670(can)S +4868(produce)S +2316 V +900(publication)S +1429(quality)S +1769(text.)S +2029(The)S +11 I +2233(Futura)S +11 R +2573(font)S +2784(is)S +2892(a)S +2974(simpler)S +3338(font)S +3549(which)S +3852(can)S +4038(produce)S +4425(better)S +4709(results)S +5031(than)S +2436 V +900(the)S +1072(default)S +1414(on)S +1562(small)S +1839(size)S +2047(frame)S +2339(bu)S +2449 H + (f)show 11 -.5 mul h (f)show +11 R +2516(ers.)S +2742(A)S +11 I +2859(Bold)S +11 R +3105(font)S +3320(automatically)S +3956(increases)S +4394(the)S +4565(text)S +4767(line)S +4969(width)S +2556 V +900(by)S +1043(one)S +1234(pixel)S +1487(over)S +1714(the)S +1881(current)S +2223(setting)S +2550(and)S +2741(may)S +2963(be)S +3099(used)S +3333(with)S +3562(any)S +3753(font.)S +2796 V +11 B +900(5.6.1.)S +1215(In-Line)S +1604(Font)S +1857(Changes)S +2952 V +11 R +1175(Text)S +1421(markers)S +1818(are)S +1995(drawn)S +2314(using)S +2599(the)S +2779(font)S +3002(selected)S +3400(with)S +3642(the)S +11 I +3822(cdl_setFont\(\))S +11 R +4459(routine,)S +4844(however)S +3072 V +900(fonts)S +1174(may)S +1417(be)S +1573(change)S +1935(within)S +2270(a)S +2371(string)S +2675(itself)S +2948(\(e.g.)S +3196(to)S +3335(set)S +3510(a)S +3611(Greek)S +3930(character\))S +4417(using)S +4709(a)S +4810(\\f)S +4930(escape)S +3192 V +900(sequence.)S +1399(The)S +1608(escape)S +1937(is)S +2050(followed)S +2479(by)S +2628(the)S +2801(character)S +3238('R')S +3423(to)S +3548(set)S +3709(a)S +3796(Roman)S +4153(font,)S +4397('G')S +4587(for)S +4753(Greek,)S +5086('F')S +3312 V +900(for)S +1061(futura,)S +1384('B')S +1564(for)S +1725(bold)S +1954(and)S +2145('T')S +2317(for)S +2477(Times.)S +2846(Any)S +3068(number)S +3436(of)S +3560(escapes)S +3926(are)S +4091(permitted)S +4545(within)S +4860(a)S +4941(string,)S +3432 V +900(the)S +1071(font)S +1285(change)S +1631(will)S +1840(remain)S +2181(in)S +2304(e)S +2352 H + (f)show 11 -.5 mul h (f)show +11 R +2419(ect)S +2583(until)S +2823(it)S +2922(is)S +3033(changed,)S +3462(or)S +3590(the)S +3761(end)S +3956(of)S +4085(string)S +4374(at)S +4491(which)S +4797(point)S +5062(any)S +3552 V +900(subsequent)S +1431(strings)S +1768(will)S +1982(again)S +2261(be)S +2406(drawn)S +2721(with)S +2959(the)S +3135(default)S +3481(font.)S +3761(Additionally)S +4360(a)S +4450('P')S +4626(in)S +4754(the)S +4930(escape)S +3672 V +900(sequence)S +1333(will)S +1538(change)S +1880(the)S +2047(font)S +2257(to)S +2376(the)S +2543(one)S +2734(previously)S +3231(used,)S +3493(whatever)S +3926(that)S +4124(may)S +4346(be.)S +3828 V +1175(The)S +1382(CDL)S +1639(also)S +1853(supports)S +2263(a)S +2348(sub/superscripting)S +3191(of)S +3319(text)S +3521(which)S +3826(can)S +4014(only)S +4247(be)S +4387(done)S +4637(with)S +4871(the)S +5043(font)S +3948 V +900(escapes.)S +1337(In)S +1471(this)S +1674(case)S +1904(the)S +2081(escape)S +2414(character)S +2855(followed)S +3288(by)S +3441(a)S +3532('U')S +3726(produces)S +4164(a)S +4255(superscript)S +4779(and)S +4979(a)S +5069('D')S +4068 V +900(produces)S +1334(a)S +1421(subscript.)S +1918(The)S +2127(changes)S +2518(may)S +2746(be)S +2889(nested)S +3209(permitting)S +3708(several)S +4057(levels)S +4353(of)S +4484(sub/superscripts,)S +4188 V +900(these)S +1159(escapes)S +1526(may)S +1749(also)S +1960(be)S +2097(used)S +2332(in)S +2452(conjunction)S +3005(with)S +3235(a)S +3317(font)S +3528(change)S +3871(to)S +3991(cause)S +4267(the)S +4435(sub/superscript)S +5134(to)S +4308 V +900(be)S +1045(drawn)S +1360(with)S +1598(a)S +1688(di)S +1774 H + (f)show 11 -.5 mul h (f)show +11 R +1841(erent)S +2101(font.)S +2381(A)S +2502(superscript)S +3025(escape)S +3357(will)S +3571(remain)S +3917(in)S +4045(e)S +4093 H + (f)show 11 -.5 mul h (f)show +11 R +4160(ect)S +4329(until)S +4574(the)S +4751(end)S +4952(of)S +5086(the)S +4428 V +900(string)S +1188(or)S +1316(a)S +1401(\\fD)S +1584(escape)S +1911(is)S +2022(seen.)S +2314(Similarly)S +2762(a)S +2847(subscript)S +3281(remains)S +3665(in)S +3788(e)S +3836 H + (f)show 11 -.5 mul h (f)show +11 R +3903(ect)S +4067(until)S +4307(the)S +4478(end)S +4672(of)S +4799(the)S +4969(string)S +4548 V +900(of)S +1028(a)S +1113(\\fU)S +1296(escape.)S +1684(Sub/superscripted)S +2508(text)S +2710(is)S +2821(drawn)S +3131(using)S +3407(a)S +3492(smaller)S +3852(font)S +4066(size,)S +4302(there)S +4558(is)S +4670(presently)S +5110(no)S +4668 V +900(way)S +1115(to)S +1234(specify)S +1583(a)S +1664(di)S +1750 H + (f)show 11 -.5 mul h (f)show +11 R +1817(erent)S +2068(size)S +2271(for)S +2431(the)S +2598(sub/superscripted)S +3399(text.)S +4848 V +11 B +2436(Summary)S +2933(of)S +3057(Font)S +3310(Escapes)S +5028 V +11 R +2179(\\fR)S +2521(change)S +2863(to)S +2982(Roman)S +3333(font)S +5148 V +2179(\\fG)S +2521(change)S +2863(to)S +2982(Greek)S +3281(font)S +5268 V +2179(\\fF)S +2521(change)S +2863(to)S +2982(Futura)S +3302(font)S +5388 V +2179(\\fT)S +2521(change)S +2863(to)S +2982(Times)S +3290(font)S +5508 V +2179(\\fB)S +2521(change)S +2863(to)S +2982(bold)S +3211(font)S +5628 V +2179(\\fP)S +2521(change)S +2863(to)S +2982(previous)S +3393(font)S +5748 V +2179(\\fU)S +2521(begin)S +2798(relative)S +3159(superscripted)S +3776(text)S +5868 V +2179(\\fD)S +2521(begin)S +2798(relative)S +3159(subscripted)S +3692(text)S +6168 V +11 B +900(5.7.)S +1132(Line)S +1380(Widths)S +1757(and)S +1969(Styles)S +6324 V +11 R +1175(The)S +11 B +1407(cdl_setLineWidth\(\))S +11 R +2380(procedure)S +2878(can)S +3091(be)S +3256(used)S +3519(to)S +3667(set)S +3851(the)S +4047(line)S +4275(width)S +4589(used)S +4853(to)S +5002(draw)S +6444 V +900(polygon)S +1306(or)S +1442(polyline)S +1848(markers,)S +2273(point)S +2544(markers)S +2940(will)S +3156(not)S +3341(be)S +3488(a)S +3536 H + (f)show 11 -.5 mul h (f)show +11 R +3603(ected.)S +3938(The)S +11 B +4152(cdl_setLineStyle\(\))S +11 R +5038(pro-)S +6564 V +900(cedure)S +1223(is)S +1330(used)S +1564(to)S +1683(set)S +1838(a)S +1919(line)S +2117(style)S +2358(other)S +2616(than)S +2838(solid.)S +6744 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6864 V +11 C +1175(void)S +1505(cdl_setLineWidth)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(width\))S +6984 V +1175(void)S +1505(cdl_setLineStyle)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(style\))S +7140 V +11 R +1175(The)S +1386(")S +11 I +1431(cdl.h)S +11 R +1648(")S +1734(include)S +2099(\256le)S +2282(for)S +2451(C)S +2567(programs,)S +3051(the)S +3227(")S +11 I +3272(cdlftn.inc)S +11 R +3685(")S +3772(include)S +4137(for)S +4306(fortran)S +4645(programs,)S +5129(or)S +7260 V +900(the)S +1075(")S +11 I +1120(cdlspp.h)S +11 R +1490(")S +1576(include)S +1940(\256le)S +2122(SPP)S +2349(programs,)S +2832(de\256nes)S +3184(the)S +3359(following)S +3828(symbolic)S +4273(constants)S +4723(for)S +4890(each)S +5129(of)S +7920 V +EP +%%Page: 16 19 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 16 -)S +840 V +900(the)S +1067(de\256ned)S +1423(line)S +1621(styles:)S +1020 V +11 B +1933(L_SOLID)S +11 R +2743(0)S +11 B +3293(L_DASHED)S +11 R +4132(1)S +1140 V +11 B +1933(L_DOTTED)S +11 R +2743(2)S +11 B +3293(L_DOTDASH)S +11 R +4132(3)S +1260 V +11 B +1933(L_HOLLOW)S +11 R +2743(4)S +11 B +3293(L_SHADOW)S +11 R +4132(5)S +1476 V +1175(The)S +11 I +1379(hollow)S +11 R +1714(line)S +1913(style)S +2155(is)S +2263(drawn)S +2571(with)S +2802(a)S +2885(linewidth)S +3336(of)S +3462(\256ve)S +3662(pixels,)S +3988(two)S +4188(pixels)S +4486(of)S +4612(color,)S +4900(a)S +4983(black)S +1596 V +900(line,)S +1132(and)S +1329(two)S +1533(pixels)S +1835(of)S +1965(color.)S +2290(It)S +2396(is)S +2509(best)S +2725(used)S +2965(when)S +3241(the)S +3414(marker)S +3761(will)S +3971(traverse)S +4354(extreme)S +4744(changes)S +5134(in)S +1716 V +900(brightness,)S +1414(due)S +1606(to)S +1726(the)S +1894(thickness)S +2337(of)S +2462(the)S +2630(line)S +2829(it)S +2925(may)S +3148(work)S +3407(best)S +3618(with)S +3848(larger)S +4137(frame)S +4426(bu)S +4536 H + (f)show 11 -.5 mul h (f)show +11 R +4603(ers.)S +4826(The)S +11 I +5031(sha-)S +1836 V +900(dow)S +11 R +1128(linestyle)S +1545(is)S +1663(drawn)S +1980(as)S +2115(two)S +2324(pixels)S +2631(of)S +2766(color)S +3035(and)S +3237(two)S +3445(pixels)S +3751(of)S +3885(black)S +4165(and)S +4366(should)S +4703(be)S +4849(used)S +5093(for)S +1956 V +900(similar)S +1240(brightness)S +1726(variations,)S +2221(however)S +2631(it)S +2727(e)S +2775 H + (f)show 11 -.5 mul h (f)show +11 R +2842(ectively)S +3223(shows)S +3532(up)S +3676(as)S +3802(a)S +3885(line)S +4085(only)S +4316(two)S +4516(pixels)S +4814(wide)S +5062(and)S +2076 V +900(may)S +1122(be)S +1258(preferred)S +1689(for)S +1849(medium)S +2243(or)S +2367(smaller)S +2723(frame)S +3010(bu)S +3120 H + (f)show 11 -.5 mul h (f)show +11 R +3187(ers.)S +2232 V +1175(The)S +1390(three)S +1654(dashed)S +2004(linestyles)S +2466(are)S +2644(drawn)S +2963(using)S +3248("gap")S +3542(spacings)S +3966(of)S +4103(5)S +4204(pixels)S +4513(in)S +4645(between)S +5055(line)S +2352 V +900(segments.)S +1405(Whether)S +1816(or)S +1942(not)S +2118(these)S +2378(gaps)S +2614(are)S +2781(resolved)S +3187(depends)S +3581(on)S +3726(the)S +3895(size)S +4100(of)S +4225(the)S +4393(frame)S +4681(bu)S +4791 H + (f)show 11 -.5 mul h (f)show +11 R +4858(er)S +4976(being)S +2472 V +900(used)S +1150(and)S +1358(the)S +1542(magni\256cation)S +2197(used)S +2448(in)S +2584(the)S +2768(display)S +3136(server.)S +3513(By)S +3692(default)S +4046(they)S +4285(should)S +4629(resolve)S +4995(com-)S +2592 V +900(pletely)S +1271(using)S +1582(frame)S +1908(bu)S +2018 H + (f)show 11 -.5 mul h (f)show +11 R +2085(ers)S +2284(up)S +2466(to)S +2624(1024x1024)S +3191(pixels,)S +3554(or)S +3717(magni\256cation)S +4393(factors)S +4761(displaying)S +2712 V +900(1024x1024)S +1428(pixels.)S +1785(If)S +1890(larger)S +2177(sizes)S +2423(are)S +2588(needed)S +2930(the)S +3097(image)S +3398(should)S +3725(be)S +3862(subsampled)S +4415(prior)S +4662(to)S +4782(display)S +5134(to)S +2832 V +900(maintain)S +1318(the)S +1485(marker)S +1827(resolution)S +2300(needed)S +2642(for)S +2802(these)S +3060(linestyles.)S +3192 V +11 B +900(5.8.)S +1132(Deleting)S +1555(Markers)S +3348 V +11 R +1175(When)S +1481(markers)S +1878(are)S +2055(drawn)S +2373(the)S +2552(underlying)S +3073(subraster)S +3514(is)S +3634(\256rst)S +3852(saved)S +4147(to)S +4279(an)S +4428(internal)S +4809(structure,)S +3468 V +900(erasure)S +1268(is)S +1396(done)S +1663(by)S +1827(simply)S +2181(redisplaying)S +2777(the)S +2964(saved)S +3266(raster.)S +3622(Problems)S +4091(can)S +4295(arise)S +4554(however)S +4983(when)S +3588 V +900(markers)S +1295(overlap;)S +1730(when)S +2010(deleting)S +2407(a)S +2498(marker)S +2850(that)S +3058(is)S +11 I +3175(under)S +11 R +3474(another)S +3845(marker)S +4198(the)S +4376(original)S +4762(pixels)S +5069(can)S +3708 V +900(overwrite)S +1372(the)S +1559(pixels)S +1875(of)S +2019(the)S +2206(marker)S +2568(on)S +2731(top.)S +2986(This)S +3235(is)S +3362(an)S +3517(unfortunate)S +4074(side)S +4303(e)S +4351 H + (f)show 11 -.5 mul h (f)show +11 R +4418(ect)S +4597(of)S +4740(the)S +4926(simple)S +3828 V +900(scheme)S +1268(used)S +1509(in)S +1635(this)S +1835(version)S +2198(of)S +2329(the)S +2503(package,)S +2928(users)S +3193(can)S +3384(call)S +3582(the)S +11 B +3757(cdl_redrawOverlay\(\))S +11 R +4784(procedure)S +3948 V +900(to)S +1019(help)S +1241(clean)S +1504(up)S +1647(any)S +1838(artifacts)S +2223(left)S +2402(behind.)S +4188 V +11 B +900(5.8.1.)S +1215(Individual)S +1742(Markers)S +4344 V +11 R +1175(The)S +11 B +1396(cdl_deleteMark\(\))S +11 R +2257(procedure)S +2745(is)S +2871(used)S +3124(to)S +3262(delete)S +3575(a)S +3675(single)S +3990(marker)S +4351(from)S +4616(the)S +4802(display\(\).)S +4464 V +900(The)S +1107(\()S +11 I +1143(x,y)S +11 R +1267(\))S +1340(argument)S +1791(is)S +1902(either)S +2188(the)S +2358(center)S +2660(position)S +3052(of)S +3179(the)S +3349(marker)S +3694(if)S +3797(that)S +3998(is)S +4108(know)S +4388(by)S +4534(the)S +4704(application,)S +4584 V +900(more)S +1162(typically)S +1584(it)S +1683(will)S +1893(be)S +2034(an)S +2175(approximate)S +2761(position.)S +3216(In)S +3345(the)S +3517(latter)S +3780(case)S +4005(the)S +4177(marker)S +4524(whose)S +4842(center)S +5146(is)S +4704 V +900(closest)S +1234(to)S +1355(this)S +1550(position)S +1941(will)S +2148(be)S +2286(deleted.)S +2698(For)S +2886(markers)S +3273(with)S +3504(no)S +3648(de\256ned)S +4005(center)S +4338(the)S +4506(distance)S +4899(used)S +5134(to)S +4824 V +900(decide)S +1220(if)S +1323(the)S +1493(marker)S +1838(should)S +2168(be)S +2307(deleted)S +2659(is)S +2769(the)S +2939(distance)S +3334(from)S +3583(the)S +3753(argument)S +4203(position)S +4595(to)S +4717(the)S +4887(edge)S +5129(of)S +4944 V +900(the)S +1075(marker.)S +1486(For)S +1680(example,)S +2120(distance)S +2520(from)S +2774(a)S +2863(box)S +3069(or)S +3201(polygon)S +3603(is)S +3718(measured)S +4177(as)S +4308(the)S +4482(distance)S +4881(from)S +5134(to)S +5064 V +900(one)S +1103(of)S +1239(the)S +1418(sides,)S +1711(for)S +1883(text)S +2093(it)S +2200(is)S +2319(the)S +2498(distance)S +2902(to)S +3033(the)S +3212(start)S +3446(of)S +3582(the)S +3761(text)S +3972(string.)S +4330(There)S +4630(is)S +4750(no)S +4906(way)S +5134(to)S +5184 V +11 I +900(un)S +11 R +1010(delete)S +1304(a)S +1385(marker)S +1727(other)S +1985(than)S +2207(to)S +2326(redraw)S +2661(it.)S +5364 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5484 V +11 C +1175(int)S +1439(cdl_deleteMark)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(x,)S +3749(int)S +4013(y\))S +5724 V +11 B +900(5.8.2.)S +1215(The)S +1432(Entire)S +1764(Overlay)S +5880 V +11 R +1175(To)S +1337(erase)S +1600(all)S +1750(markers)S +2142(currently)S +2577(displayed)S +3039(use)S +3226(the)S +11 B +3401(cdl_clearOverlay\(\))S +11 R +4318(procedure.)S +4856(Markers)S +6000 V +900(are)S +1069(erased)S +1383(in)S +1505(the)S +1675(reverse)S +2025(order)S +2291(they)S +2516(were)S +2763(drawn)S +3072(to)S +3194(help)S +3419(reduce)S +3745(the)S +3915(chance)S +4253(that)S +4454(overlaying)S +4959(mark-)S +6120 V +900(ers)S +1060(will)S +1265(leave)S +1528(stray)S +1774(pixels.)S +6300 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6420 V +11 C +1175(int)S +1439(cdl_clearOverlay)S +2561(\(CDLPtr)S +3089(cdl\))S +6660 V +11 B +900(5.9.)S +1132(Redraw)S +6816 V +11 R +1175(The)S +11 B +1389(cdl_redrawOverlay\(\))S +11 R +2419(procedure)S +2899(can)S +3094(be)S +3241(used)S +3486(to)S +3616(redraw)S +3963(all)S +4118(markers)S +4515(currently)S +4955(in)S +5086(the)S +6936 V +900(display)S +1271(list.)S +1520(This)S +1768(is)S +1894(sometimes)S +2417(needed)S +2778(when)S +3067(subraster)S +3514(I/O)S +3712(procedures)S +4243(are)S +4427(used)S +4680(to)S +4818(redisplay)S +7056 V +900(subregions)S +1409(and)S +1600(overwrite)S +2052(existing)S +2434(markers.)S +7236 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7920 V +EP +%%Page: 17 20 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 17 -)S +840 V +11 C +1175(int)S +1439(cdl_redrawOverlay)S +2627(\(CDLPtr)S +3155(cdl\))S +1080 V +11 B +900(6.)S +1049(ANSI)S +1345(C)S +1457(Function)S +1913(Prototypes)S +1236 V +11 R +1175(The)S +1387(current)S +1738(release)S +2082(of)S +2215(CDL)S +2477(provides)S +2897(full)S +3092(ANSI)S +3390(C)S +3506(function)S +3914(prototypes)S +4421(for)S +4591(all)S +4744(public)S +5062(and)S +1356 V +900(private)S +1244(procedures.)S +1824(By)S +1993(default)S +2337(these)S +2602(will)S +2814(not)S +2994(be)S +3136(used)S +3376(even)S +3621(on)S +3770(systems)S +4158(with)S +4393(native)S +4700(ANSI)S +4995(com-)S +1476 V +900(pilers,)S +1227(however.)S +1719(To)S +1896(make)S +2188(use)S +2389(of)S +2535(the)S +2724(CDL)S +3000(prototypes)S +3520(users)S +3801(will)S +4029(need)S +4291(to)S +4433(de\256ne)S +4757(the)S +4947(macro)S +1596 V +11 B +900(CDL_ANSIC)S +11 R +1566(either)S +1852(when)S +2126(compiling)S +2609(the)S +2779(program)S +3186(\(using)S +3497(the)S +3667(-D)S +3818(option)S +4136(to)S +4258(the)S +4428(compiler\),)S +4918(or)S +5045(as)S +5172(a)S +1716 V +900(de\256nition)S +1356(in)S +1475(the)S +1642(program)S +2046(source)S +2364(preceding)S +2828(the)S +2995('cdl.h')S +3317(include)S +3673(directive.)S +1872 V +1175(For)S +1361(example,)S +2052 V +11 C +1175(#define)S +1769(CDL_ANSIC)S +2172 V +1175(#include)S +1769("cdl.h")S +2292 V +1505(:)S +2412 V +1175(main)S +1505(\(int)S +1835(argc,)S +2231(char)S +2561(**argv\))S +2532 V +1505(:)S +2712 V +11 R +900(or)S +1024(when)S +1294(compiling)S +1774(using)S +2046(something)S +2538(like)S +2892 V +11 C +1175(cc)S +1373(-DCDL_ANSIC)S +2165(client.c)S +2759(libcdl.a)S +3353(-lm)S +3072 V +11 R +1175(Note)S +1424(that)S +1625(when)S +1898(using)S +2173(CDL_ANSIC)S +2814(to)S +2936(build)S +3199(the)S +3370(client)S +3651(program)S +4059(it)S +4158(is)S +4269(also)S +4483(required)S +4884(that)S +5086(the)S +3192 V +900(CDL)S +1163(itself)S +1426(be)S +1572(built)S +1818(in)S +1946(the)S +2122(same)S +2389(way)S +2613(to)S +2741(avoid)S +3027(confusing)S +3502(FPE)S +3735(errors.)S +4092(Similarly,)S +4573(when)S +4852(building)S +3312 V +900(client)S +1178(tasks)S +1432(that)S +11 I +1631(do)S +1775(not)S +11 R +1950(use)S +2130(CDL_ANSIC)S +2769(you)S +2968(must)S +3217(use)S +3397(a)S +3479(version)S +3836(of)S +3961(the)S +4130(library)S +4457(that)S +4657(has)S +4838(not)S +5014(been)S +3432 V +900(compiled)S +1342(with)S +1571(prototypes.)S +3588 V +1175(The)S +1378(reason)S +1696(is)S +1803(that)S +2001(the)S +2168(\257oat)S +2397(args)S +2612(to)S +2731(the)S +2898(CDL)S +3151(procedures)S +3663(in)S +3782(the)S +3949(library,)S +4302(or)S +4426(in)S +4545(your)S +4780(task)S +4991(calls,)S +3708 V +900(are)S +1071(promoted)S +1531(to)S +1656(doubles)S +2037(when)S +2313(compiling)S +2799(those)S +3070(procedures,)S +3616(but)S +3796(may)S +4023(only)S +4257(be)S +4398(passed)S +4728(as)S +4857(\257oats)S +5134(in)S +3828 V +900(your)S +1134(code)S +1373(\(or)S +1533(as)S +1657(double)S +1989(where)S +2288(the)S +2455(CDL)S +2709(is)S +2817(expecting)S +3277(\257oat\).)S +3571(This)S +3801(means)S +4115(the)S +4283(argument)S +4731(stack)S +4990(is)S +5098(o)S +5153 H + (f)show 11 -.5 mul h (f)show +11 R +3948 V +900(by)S +1045(4)S +1135(bytes)S +1402(for)S +1564(each)S +1798(\257oat)S +2029(arg)S +2203(and)S +2396(the)S +2565(values)S +2880(interpreted)S +3389(by)S +3534(the)S +3703(CDL)S +3958(procedure)S +4429(will)S +4636(be)S +4773(corrupted.)S +4068 V +900(If)S +1031(you're)S +1376(going)S +1687(to)S +1833(use)S +2039(the)S +2233(prototypes)S +2757(you'll)S +3080(need)S +3346(to)S +3492(edit)S +3717(the)S +3911(CDL)S +4191(Imake\256le)S +4665(to)S +4811(de\256ne)S +5139("-)S +4188 V +900(DCDL_ANSIC")S +1665(in)S +1787(the)S +1957(EXTRA_DEFINES)S +2865(so)S +2998(it)S +3095(will)S +3302(use)S +3483(the)S +3652(prototypes)S +4151(and)S +4344(everything)S +4848(will)S +5055(line)S +4308 V +900(up.)S +1104(You)S +1326(will)S +1531(then)S +1753(need)S +1992(to)S +2111(rebuild)S +2455(the)S +2622(libcdl.a)S +2982(as)S +3106(well)S +3328(as)S +3452(relink)S +3741(your)S +3975(program.)S +4548 V +11 B +900(7.)S +1049(Fortran)S +1453(Language)S +1952(Binding)S +2362(Notes)S +4704 V +11 R +1175(The)S +1396(Fortran)S +1770(language)S +2216(binding)S +2604(routines)S +3009(are)S +3193(implemented)S +3819(in)S +3957(C)S +4083(but)S +4276(should)S +4622(be)S +4777(accessible)S +4824 V +900(from)S +1155(any)S +1355(fortran)S +1694(program)S +2107(as)S +2240(though)S +2588(they)S +2819(were)S +3072(real)S +3277(fortran)S +3616(subroutines.)S +4226(The)S +4437(calling)S +4777(sequences)S +4944 V +900(are)S +1065(the)S +1232(same)S +1490(as)S +1614(with)S +1843(the)S +2010(C)S +2117(library)S +2442(routines)S +2829(with)S +3058(the)S +3225(following)S +3686(exceptions:)S +5100 V +11 Y1 +1150(d)S +11 R +1289(The)S +1500(CDL)S +1761(package)S +2159(pointer)S +2511(is)S +2626(maintained)S +3155(internally)S +3617(so)S +3756(no)S +3907('cdl')S +4155(pointer)S +4508(is)S +4624(passed)S +4958(in)S +5086(the)S +5220 V +1150(fortran)S +1480(interface.)S +5376 V +11 Y1 +1150(d)S +11 R +1289(All)S +1471(routines)S +1866(which)S +2175(are)S +2348(integer)S +2693(procedures)S +3213(in)S +3340(the)S +3515(C)S +3630(interface)S +4053(return)S +4356(an)S +4501(extra)S +4761('ier')S +4990(argu-)S +5496 V +1150(ment)S +1403(to)S +1522(contain)S +1878(the)S +2045(error)S +2289(\257ag.)S +2548(All)S +2722(Fortran)S +3078(functions)S +3520(are)S +3685(implemented)S +4292(as)S +4416(subroutines.)S +5652 V +11 Y1 +1150(d)S +11 R +1281(The)S +1485(procedure)S +1955(names)S +2269(are)S +2435(the)S +2603(same)S +2862(except)S +3181(that)S +11 I +3380(cdl_)S +11 R +3603(has)S +3783(been)S +4023(replaced)S +4426(with)S +11 I +4656(cf)S +11 R +4769(in)S +4889(the)S +5057(for-)S +5772 V +1150(tran)S +1353(binding.)S +1784(If)S +1889(your)S +2123(compiler)S +2546(is)S +2653(case-sensitive)S +3294(then)S +3516(use)S +3695(all)S +3838(lower)S +4120(case)S +4340(letters.)S +5928 V +900(The)S +1117(binding)S +1501(has)S +1695(been)S +1949(tested)S +2253(on)S +2411(a)S +2507(number)S +2890(of)S +3029(di)S +3115 H + (f)show 11 -.5 mul h (f)show +11 R +3182(erent)S +3448(platforms)S +3917(without)S +4302(problems.)S +4820(The)S +5038(pro-)S +6048 V +900(cedure)S +1243(names)S +1576(haven't)S +1957(been)S +2216(restricted)S +2676(to)S +2815(the)S +3002(traditional)S +3506(6-character)S +4047(fortran)S +4396(names)S +4728(since)S +5005(most)S +6168 V +900(modern)S +1278(compilers)S +1754(can)S +1948(handle)S +2283(longer)S +2606(names,)S +2957(if)S +3067(yours)S +3354(isn't)S +3593(one)S +3794(of)S +3929(them)S +4193(contact)S +11 I +4553(iraf@noao.edu)S +6288 V +11 R +900(for)S +1060(help)S +1282(in)S +1401(changing)S +1836(the)S +2003(names.)S +6444 V +1175(Since)S +1456(the)S +1627(CDL)S +1884(is)S +1995(implemented)S +2606(as)S +2734(a)S +2819(set)S +2978(of)S +3106(C)S +3217(routines,)S +3637(the)S +3809(one)S +4005(aspect)S +4316(that)S +4519(cannot)S +4849(be)S +4990(over-)S +6564 V +900(looked)S +1245(in)S +1377(the)S +1557(fortran)S +1900(binding)S +2283(is)S +2403(the)S +2583(between)S +2993(Fortran)S +3362(and)S +3566(C)S +3686(storage)S +4048(order)S +4324(for)S +4497(arrays.)S +4869(In)S +5005(most)S +6684 V +900(cases)S +1166(this)S +1362(will)S +1570(not)S +1747(be)S +1886(a)S +1970(problem)S +2372(since)S +2633(the)S +2803(CDL)S +3059(routines)S +3449(are)S +3617(just)S +3813(passing)S +4179(around)S +4519(pointers)S +4910(even)S +5153(if)S +6804 V +900(they)S +1136(live)S +1348(for)S +1522(a)S +1617(short)S +1884(while)S +2174(in)S +2306(a)S +2400(fortran)S +2743(program.)S +3221(The)S +3437(problem)S +3849(comes)S +4175(when)S +4458(using)S +4743(the)S +4923(fortran)S +6924 V +900(program)S +1313(to)S +1441(read)S +1670(the)S +1846(arrays,)S +2183(for)S +2353(example)S +2767(in)S +2896(using)S +3178(the)S +3355(array)S +3621(returned)S +4028(by)S +4181(the)S +11 B +4358(cfreadIRAF\(\))S +11 R +5038(pro-)S +7044 V +900(cedure,)S +1254(or)S +1381(when)S +1654(passing)S +2020(in)S +2142(arrays)S +2444(for)S +2607(display)S +2961(that)S +3162(originated)S +3643(in)S +3765(the)S +3935(user's)S +4232(fortran)S +4565(code.)S +4868(In)S +4995(these)S +7164 V +900(cases)S +1179(the)S +1362(array)S +11 B +1634(must)S +11 R +1915(be)S +2067(transposed)S +2585(to)S +2720(be)S +2872(interpreted)S +3395(correctly.)S +3893(It)S +4009(was)S +4228(assumed)S +4655(that)S +4869(in)S +5005(most)S +7284 V +900(applications)S +1481(arrays)S +1797(returned)S +2211(by)S +2371(CDL)S +2641(procedures)S +3170(would)S +3495(be)S +3648(immediately)S +4248(passed)S +4590(to)S +4726(other)S +5000(CDL)S +7920 V +EP +%%Page: 18 21 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 18 -)S +840 V +900(procedures)S +1415(so)S +1549(having)S +1885(the)S +2056(binding)S +2430(routines)S +2821(transpose)S +3272(the)S +3443(array)S +3703(to/from)S +4070(Fortran)S +4430(storage)S +4783(order)S +5050(was)S +960 V +900(unnecessarily)S +1529(ine)S +1663 H + (f)show 11 -.5 mul h (\256)show +11 R +1755(cient.)S +2062(This)S +2291(may)S +2513(be)S +2649(changed)S +3046(in)S +3165(later)S +3392(releases)S +3770(if)S +3870(required.)S +1320 V +11 B +900(8.)S +1049(SPP)S +1278(Language)S +1777(Binding)S +2187(Notes)S +1476 V +11 R +1175(The)S +1390(SPP)S +1621(language)S +2061(binding)S +2443(is)S +2562(experimental)S +3179(and)S +3382(is)S +3501(intended)S +3924(to)S +4055(provide)S +4436(a)S +4530(way)S +4758(to)S +4890(quickly)S +1596 V +900(prototype)S +1356(tasks,)S +1639(it)S +1736(should)S +2065(not)S +2241(be)S +2379(used)S +2615(in)S +2736(production)S +3247(code)S +3488(as)S +3614(it)S +3711(may)S +3935(not)S +4111(be)S +4249(as)S +4375(portable)S +4769(as)S +4894(the)S +5062(rest)S +1716 V +900(of)S +1033(the)S +1209(task.)S +1489(In)S +1622(essence)S +1997(this)S +2200(binding)S +2580(is)S +2697(a)S +2788(layer)S +3049(on)S +3202(top)S +3386(of)S +3520(the)S +3697(Fortran)S +4063(binding)S +4443(since)S +4711(most)S +4969(IRAF)S +1836 V +900(platforms)S +1357(still)S +1560(use)S +1742(Fortran)S +2101(as)S +2228(the)S +2398(intermediate)S +2982(code.)S +3285(The)S +3490(calling)S +3824(sequences)S +4302(are)S +4469(the)S +4638(same)S +4898(as)S +5024(with)S +1956 V +900(the)S +1067(Fortran)S +1423(library)S +1748(routines)S +2135(with)S +2364(the)S +2531(following)S +2992(caveats:)S +2112 V +11 Y1 +1150(d)S +11 R +1290(The)S +1502('cdlspp.h')S +1986(SPP)S +2214(include)S +2579(\256le)S +2762(is)S +2878(required)S +3284(by)S +3437(all)S +3590(\256les)S +3817(which)S +4128(call)S +4329(CDL)S +4592(routines.)S +5050(The)S +2232 V +1150(binding)S +1535(names)S +1863(are)S +2043(actually)S +2438(SPP)S +2672(macros)S +3036(to)S +3170(resolve)S +3534(the)S +3716(current)S +4073(6)S +4176(character)S +4622(limit)S +4880(on)S +5038(pro-)S +2352 V +1150(cedure)S +1473(names.)S +2508 V +11 Y1 +1150(d)S +11 R +1287(All)S +1467(character)S +1904(string)S +2194(arguments)S +2690(must)S +2944(be)S +3086(dimensioned)S +3687(to)S +3812(at)S +3930(least)S +4170(SZ_FNAME)S +4779(characters)S +2628 V +1150(in)S +1269(length.)S +2784 V +11 Y1 +1150(d)S +11 R +1289(The)S +1500(CDL)S +1761(package)S +2159(pointer)S +2511(is)S +2626(maintained)S +3155(internally)S +3617(so)S +3756(no)S +3907('cdl')S +4155(pointer)S +4508(is)S +4624(passed)S +4958(in)S +5086(the)S +2904 V +1150(fortran)S +1480(interface.)S +3060 V +11 Y1 +1150(d)S +11 R +1289(All)S +1471(routines)S +1866(which)S +2175(are)S +2348(integer)S +2693(procedures)S +3213(in)S +3340(the)S +3515(C)S +3630(interface)S +4053(return)S +4356(an)S +4501(extra)S +4761('ier')S +4990(argu-)S +3180 V +1150(ment)S +1403(to)S +1522(contain)S +1878(the)S +2045(error)S +2289(\257ag.)S +2548(All)S +2722(SPP)S +2941(functions)S +3383(are)S +3548(implemented)S +4155(as)S +4279(subroutines.)S +3336 V +11 Y1 +1150(d)S +11 R +1293(On)S +1472(HPUX)S +1816(or)S +1952(IBM)S +2205(RS6000)S +2606(systems)S +3001(the)S +3181('cdlspp.h')S +3669(\256le)S +3856(must)S +4117(be)S +4266(edited)S +4580(to)S +4712(remove)S +5086(the)S +3456 V +1150(trailing)S +1507(underscores)S +2068(from)S +2320(the)S +2493(procedure)S +2968(name)S +3244(macros.)S +3659(This)S +3893(is)S +4005(because)S +4388(on)S +4536(these)S +4799(platforms)S +3576 V +1150(the)S +1319(fortran)S +1652(compiler)S +2078(will)S +2286(not)S +2463(append)S +2815(an)S +2954(underscore)S +3469(to)S +3591(the)S +3761(SPP)S +3983(symbols)S +4387(as)S +4514(it)S +4612(does)S +4849(on)S +4995(other)S +3696 V +1150(platforms.)S +4056 V +11 B +900(9.)S +1049(IIS)S +1230(Protocol)S +1658(Description)S +4212 V +11 R +1175(The)S +1383(communications)S +2148(protocol)S +2552(used)S +2791(by)S +2939(the)S +3111(CDL)S +3369(and)S +3565(servers)S +3913(such)S +4153(as)S +11 I +4283(XImtool)S +11 R +4676(and)S +11 I +4873(SAOim-)S +4332 V +900(age)S +11 R +1058(,)S +1121(is)S +1230(a)S +1313(slightly)S +1679(modi\256ed)S +2105(version)S +2462(of)S +2587(that)S +2786(used)S +3021(by)S +3165(the)S +3333(IIS)S +3501(Model)S +3822(70.)S +4027(All)S +4202(operations)S +4693(are)S +4859(initiated)S +4452 V +900(by)S +1051(sending)S +1434(a)S +1523(header)S +1855(packet)S +2182(containing)S +2688(a)S +11 I +2778(thing)S +3047(id)S +11 R +3175(\(tid\))S +3406(and)S +11 I +3606(subunit)S +11 R +3973(selecting)S +4405(the)S +4581(function)S +4989(to)S +5117(be)S +4572 V +900(performed,)S +1429(optionally)S +1922(followed)S +2358(by)S +2514(data)S +2742(up)S +2897(to)S +3028(32K)S +3262(bytes)S +3539(long.)S +3841(The)S +4056(IIS)S +4235(header)S +4570(packet)S +4900(used)S +5146(is)S +4692 V +900(de\256ned)S +1256(as)S +4812 V +11 C +1450(struct)S +1978(iism70)S +2440({)S +4932 V +1725(short)S +2253(tid;)S +5052 V +1725(short)S +2253(thingct;)S +5172 V +1725(short)S +2253(subunit;)S +5292 V +1725(short)S +2253(checksum;)S +5412 V +1725(short)S +2253(x,)S +2451(y,)S +2649(z;)S +5532 V +1725(short)S +2253(t;)S +5652 V +1450(};)S +5892 V +11 R +900(The)S +11 I +1109(thing)S +1375(count)S +11 R +1658(\256eld)S +1893(contains)S +2299(the)S +2473(negative)S +2884(number)S +3259(of)S +3390(bytes)S +3662(of)S +3793(data)S +4015(that)S +4220(will)S +4432(be)S +4575(sent)S +4792(following)S +6012 V +900(the)S +1067(header)S +1390(packet.)S +1769(The)S +1972(IIS)S +2139(header)S +2462(checksum)S +2933(is)S +3040(computed)S +3506(as)S +6252 V +11 C +1164(checksum)S +1758(=)S +1890(0177777)S +2418(-)S +2550(\(tid)S +2880(+)S +3012(subunit)S +3540(+)S +3672(thingct)S +4200(+)S +4332(x)S +4464(+)S +4596(y)S +4728(+)S +4860(z)S +4992(+)S +5124(t\);)S +6492 V +11 R +900(The)S +1112(four)S +1336(IIS)S +1512(registers)S +1925(are)S +2099(set)S +2263(di)S +2349 H + (f)show 11 -.5 mul h (f)show +11 R +2416(erently)S +2762(depending)S +3261(on)S +3414(the)S +3591(operation,)S +4076(a)S +4167(summary)S +4619(of)S +4753(the)S +4930(header)S +6612 V +900(packets)S +1261(for)S +1421(each)S +1653(operation)S +2100(is)S +2207(summarized)S +2776(below.)S +7920 V +EP +%%Page: 19 22 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 19 -)S +840 V +11 B +2373(IIS)S +2554(Header)S +2934(Packet)S +3283(Summary)S +1020 V +11 R +2296(TID)S +3291(Subunit)S +4061(Tct)S +4394(X)S +4638(Y)S +4933(Z)S +5268(T)S +5575(Data)S +1030 V +11 Y1 +1805(2)S +1845(2222222222222222222222222222222222222222222222222222222222222222222222222)S +1150 V +11 R +900(Read)S +1158(Data)S +1887(IIS_READ)S +11 B +2375(|)S +11 R +2399(PACKED)S +3052(MEMORY)S +4040(-NB)S +4406(x)S +4650(y)S +4882(fr)S +5217(-)S +5552(NB)S +1270 V +900(Write)S +1182(Data)S +1887(IIS_WRITE)S +11 B +2423(|)S +11 R +2447(PACKED)S +3052(MEMORY)S +4040(-NB)S +4406(x)S +4650(y)S +4882(fr)S +5217(-)S +5552(NB)S +1390 V +900(Read)S +1158(Cursor)S +1887(IIS_READ)S +3052(IMCURSOR)S +4116(-)S +4415(-)S +4659(-)S +4882(-)S +5217(-)S +5552(-)S +1510 V +900(Write)S +1182(Cursor)S +1887(IIS_WRITE)S +3052(IMCURSOR)S +4116(-)S +4406(x)S +4650(y)S +4882(wcs)S +5217(-)S +5552(-)S +1630 V +900(Set)S +1074(Frame)S +1887(IIS_WRITE)S +3052(LUT)S +11 B +3265(|)S +11 R +3289(COMMAND)S +4089(-1)S +4415(-)S +4659(-)S +4882(-)S +5217(-)S +5552(2)S +1750 V +900(Erase)S +1175(Frame)S +1887(IIS_WRITE)S +11 B +2456(|)S +11 R +2513(fb)S +3052(FEEDBACK)S +4116(-)S +4415(-)S +4659(-)S +4882(fr)S +5217(-)S +5552(-)S +1990 V +900(Old)S +1098(Write)S +1380(WCS)S +1887(IIS_WRITE)S +11 B +2423(|)S +11 R +2447(PACKED)S +3052(WCS)S +4077(-N)S +4415(-)S +4659(-)S +4882(fr)S +5217(fb)S +5552(320)S +2110 V +900(Old)S +1098(Read)S +1356(WCS)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4415(-)S +4659(-)S +4882(fr)S +5217(wcs)S +5552(320)S +2350 V +900(WCS)S +1172(Version?)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4406(1)S +4650(1)S +4882(-)S +5217(-)S +5552(320)S +2470 V +900(WCS)S +1172(by)S +1315(Number?)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4406(1)S +4659(-)S +4882(fr)S +5217(wcs)S +5552(1024)S +2590 V +900(New)S +1139(Write)S +1421(WCS)S +1887(IIS_WRITE)S +11 B +2423(|)S +11 R +2447(PACKED)S +3052(WCS)S +4077(-N)S +4406(1)S +4659(-)S +4882(fr)S +5217(fb)S +5552(1024)S +2710 V +900(New)S +1139(Read)S +1397(WCS)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4406(1)S +4659(-)S +4882(fr)S +5217(wcs)S +5552(1024)S +2720 V +11 Y1 +1805(2)S +1845(2222222222222222222222222222222222222222222222222222222222222222222222222)S +1804(1)S +2680 V +1804(1)S +2570 V +1804(1)S +2460 V +1804(1)S +2350 V +1804(1)S +2240 V +1804(1)S +2130 V +1804(1)S +2020 V +1804(1)S +1910 V +1804(1)S +1800 V +1804(1)S +1690 V +1804(1)S +1580 V +1804(1)S +1470 V +1804(1)S +1360 V +1804(1)S +1250 V +1804(1)S +1140 V +1804(1)S +2720 V +2969(1)S +2680 V +2969(1)S +2570 V +2969(1)S +2460 V +2969(1)S +2350 V +2969(1)S +2240 V +2969(1)S +2130 V +2969(1)S +2020 V +2969(1)S +1910 V +2969(1)S +1800 V +2969(1)S +1690 V +2969(1)S +1580 V +2969(1)S +1470 V +2969(1)S +1360 V +2969(1)S +1250 V +2969(1)S +1140 V +2969(1)S +2720 V +3957(1)S +2680 V +3957(1)S +2570 V +3957(1)S +2460 V +3957(1)S +2350 V +3957(1)S +2240 V +3957(1)S +2130 V +3957(1)S +2020 V +3957(1)S +1910 V +3957(1)S +1800 V +3957(1)S +1690 V +3957(1)S +1580 V +3957(1)S +1470 V +3957(1)S +1360 V +3957(1)S +1250 V +3957(1)S +1140 V +3957(1)S +2720 V +4311(1)S +2680 V +4311(1)S +2570 V +4311(1)S +2460 V +4311(1)S +2350 V +4311(1)S +2240 V +4311(1)S +2130 V +4311(1)S +2020 V +4311(1)S +1910 V +4311(1)S +1800 V +4311(1)S +1690 V +4311(1)S +1580 V +4311(1)S +1470 V +4311(1)S +1360 V +4311(1)S +1250 V +4311(1)S +1140 V +4311(1)S +2720 V +4555(1)S +2680 V +4555(1)S +2570 V +4555(1)S +2460 V +4555(1)S +2350 V +4555(1)S +2240 V +4555(1)S +2130 V +4555(1)S +2020 V +4555(1)S +1910 V +4555(1)S +1800 V +4555(1)S +1690 V +4555(1)S +1580 V +4555(1)S +1470 V +4555(1)S +1360 V +4555(1)S +1250 V +4555(1)S +1140 V +4555(1)S +2720 V +4799(1)S +2680 V +4799(1)S +2570 V +4799(1)S +2460 V +4799(1)S +2350 V +4799(1)S +2240 V +4799(1)S +2130 V +4799(1)S +2020 V +4799(1)S +1910 V +4799(1)S +1800 V +4799(1)S +1690 V +4799(1)S +1580 V +4799(1)S +1470 V +4799(1)S +1360 V +4799(1)S +1250 V +4799(1)S +1140 V +4799(1)S +2720 V +5134(1)S +2680 V +5134(1)S +2570 V +5134(1)S +2460 V +5134(1)S +2350 V +5134(1)S +2240 V +5134(1)S +2130 V +5134(1)S +2020 V +5134(1)S +1910 V +5134(1)S +1800 V +5134(1)S +1690 V +5134(1)S +1580 V +5134(1)S +1470 V +5134(1)S +1360 V +5134(1)S +1250 V +5134(1)S +1140 V +5134(1)S +2720 V +5469(1)S +2680 V +5469(1)S +2570 V +5469(1)S +2460 V +5469(1)S +2350 V +5469(1)S +2240 V +5469(1)S +2130 V +5469(1)S +2020 V +5469(1)S +1910 V +5469(1)S +1800 V +5469(1)S +1690 V +5469(1)S +1580 V +5469(1)S +1470 V +5469(1)S +1360 V +5469(1)S +1250 V +5469(1)S +1140 V +5469(1)S +2720 V +5860(1)S +2680 V +5860(1)S +2570 V +5860(1)S +2460 V +5860(1)S +2350 V +5860(1)S +2240 V +5860(1)S +2130 V +5860(1)S +2020 V +5860(1)S +1910 V +5860(1)S +1800 V +5860(1)S +1690 V +5860(1)S +1580 V +5860(1)S +1470 V +5860(1)S +1360 V +5860(1)S +1250 V +5860(1)S +1140 V +5860(1)S +2960 V +11 R +900(Where)S +1355(NB)S +2218(=)S +2313(number)S +2681(of)S +2805(bytes)S +3070(expected)S +3491(or)S +3615(written)S +3080 V +1355(x)S +2218(=)S +2313(x)S +2401(position)S +2790(of)S +2914(operation)S +3361(in)S +3480(frame)S +3767(bu)S +3877 H + (f)show 11 -.5 mul h (f)show +11 R +3944(er)S +4061(coords)S +3200 V +1355(y)S +2218(=)S +2313(y)S +2401(position)S +2790(of)S +2914(operation)S +3361(in)S +3480(frame)S +3767(bu)S +3877 H + (f)show 11 -.5 mul h (f)show +11 R +3944(er)S +4061(coords)S +3320 V +1355(fr)S +2218(=)S +2313(frame)S +2600(number)S +2968(\(passed)S +3329(as)S +3453(bit\257ag)S +3768(\(i.e.)S +3972(1,)S +4088(2)S +4176(,4)S +4292(8,)S +4408(etc\))S +3440 V +1355(fb)S +2218(=)S +2313(frame)S +2600(bu)S +2710 H + (f)show 11 -.5 mul h (f)show +11 R +2777(er)S +2894(con\256g)S +3202(number)S +3570(\(zero)S +3826(indexed\))S +3560 V +1355(N)S +2218(=)S +2313(length)S +2621(of)S +2745(WCS)S +3017(string)S +3680 V +1355(wcs)S +2218(=)S +2313(WCS)S +2585(number)S +2953(\(usually)S +3340(zero\))S +3800 V +1355(Data)S +2218(=)S +2313(the)S +2480(number)S +2848(of)S +2972(bytes)S +3237(of)S +3361(data)S +3576(to)S +3695(be)S +3831(read)S +4051(or)S +4175(written)S +4519(following)S +4980(the)S +5147(header)S +5470(packet.)S +4040 V +1355(IIS_WRITE)S +2251(=)S +2346(0400000)S +4160 V +1355(IIS_READ)S +2251(=)S +2346(0100000)S +4280 V +1355(COMMAND)S +2251(=)S +2346(0100000)S +4400 V +1355(PACKED)S +2251(=)S +2346(0040000)S +4520 V +1355(IMC_SAMPLE)S +2251(=)S +2346(0040000)S +4760 V +1355(MEMORY)S +2251(=)S +2346(001)S +4880 V +1355(LUT)S +2251(=)S +2346(002)S +5000 V +1355(FEEDBACK)S +2251(=)S +2346(005)S +5120 V +1355(IMCURSOR)S +2251(=)S +2346(020)S +5240 V +1355(WCS)S +2251(=)S +2346(021)S +5456 V +900(TID)S +1119(\256elds)S +1395(can)S +1583(be)S +1723(logically)S +2145(OR'd)S +2426(with)S +2659(the)S +2830(PACKED)S +3307(\257ag)S +3509(indicating)S +3986(the)S +4157(number)S +4529(of)S +4657(data)S +4876(bytes)S +5146(is)S +5576 V +900(exactly)S +11 I +1252(thingct)S +11 R +1594(bytes)S +1862(long,)S +2122(otherwise)S +11 I +2584(thingct)S +11 R +2926(must)S +3177(be)S +3316(speci\256ed)S +3742(as)S +3869(half)S +4075(the)S +4245(number)S +4616(of)S +4743(data)S +4960(bytes.)S +5696 V +900(In)S +1028(a)S +1113(cursor)S +1423(read,)S +1675(if)S +1779(the)S +1951(IIS_READ)S +2477(\257ag)S +2680(is)S +2792(OR'd)S +3074(with)S +3308(IMC_SAMPLE)S +4044(the)S +4216(logical)S +4553(cursor)S +4864(position)S +5816 V +900(\(i.e.)S +1153(the)S +1336(last)S +1538(value)S +1824(read)S +2060(or)S +2200(set\))S +2407(is)S +2530(returned)S +2943(immediately,)S +3570(otherwise)S +4044(the)S +4226(server)S +4540(will)S +4760(wait)S +4997(for)S +5172(a)S +5936 V +900(keystroke)S +1366(to)S +1492(be)S +1635(hit)S +1792(before)S +2110(returning)S +2552(a)S +2640(string)S +2932(containing)S +3437(the)S +3612(\(x,y\))S +3863(position,)S +4288(wcs)S +4499(of)S +4631(the)S +4806(read,)S +5062(and)S +6056 V +900(the)S +1072(keystroke.)S +1597(When)S +1896(setting)S +2228(the)S +2400(frame)S +2692(you)S +2895(must)S +3148(send)S +3387(a)S +3473(short)S +3731(integer)S +4072(in)S +4195(the)S +4366(data)S +4585(containing)S +5086(the)S +6176 V +900(frame)S +1187(selected.)S +6536 V +11 B +900(10.)S +1104(VXIMTOOL)S +1761(Proxy/Display)S +2461(Server)S +2803(Usage)S +6692 V +11 I +900(VXIMTOOL)S +11 R +1481(is)S +1593(a)S +1679(image)S +1986(display)S +2343(server)S +2648(process)S +3015(much)S +3298(like)S +11 I +3502(XIMTOOL)S +11 R +3978(,)S +4045(except)S +4369(that)S +4573(all)S +4722(it)S +4823(normally)S +6812 V +900(does)S +1139(is)S +1251(respond)S +1636(to)S +1760(datastream)S +2272(requests)S +2669(to)S +2793(read)S +3018(and)S +3214(write)S +3477(to)S +3600(internal)S +3972(frame)S +4263(bu)S +4373 H + (f)show 11 -.5 mul h (f)show +11 R +4440(ers)S +4604(maintained)S +5129(as)S +6932 V +900(arrays)S +1201(in)S +1322(memory.)S +1784(Multiple)S +2199(frame)S +2488(bu)S +2598 H + (f)show 11 -.5 mul h (f)show +11 R +2665(ers)S +2827(and)S +3020(frame)S +3309(bu)S +3419 H + (f)show 11 -.5 mul h (f)show +11 R +3486(er)S +3605(con\256gurations)S +4269(are)S +4436(supported.)S +4966(It)S +5069(can)S +7052 V +900(be)S +1038(used)S +1274(to)S +1395(debug)S +1698(CDL)S +1953(programs)S +2402(by)S +2547(printing)S +2931(out)S +3107(the)S +3276(protocol)S +3677(packets)S +4040(received,)S +4472(or)S +4597(can)S +4782(simply)S +5117(be)S +7172 V +900(used)S +1148(as)S +1286(a)S +1381(dummy)S +1766(server)S +2080(in)S +2214(cases)S +2492(where)S +2806(no)S +2964(image)S +3280(display)S +3646(is)S +3768(really)S +4065(needed.)S +4483(By)S +4660(enabling)S +5086(the)S +7292 V +11 I +900(-proxy)S +11 R +1219(\257ag)S +1418(the)S +1585(server)S +1884(can)S +2068(also)S +2278(be)S +2414(used)S +2648(to)S +2767(repeat)S +3066(the)S +3233(datastream)S +3740(requests)S +4132(to)S +4251(a)S +4332(list)S +4501(of)S +4625(other)S +4883(servers,)S +7920 V +EP +%%Page: 20 23 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 20 -)S +840 V +900(e)S +948 H + (f)show 11 -.5 mul h (f)show +11 R +1015(ectively)S +1399(splitting)S +1799(the)S +1970(image)S +2275(display)S +2630(to)S +2753(a)S +2838(number)S +3210(of)S +3338(other)S +3600(servers.)S +4007(See)S +4202(the)S +11 I +4373(vximtool)S +11 R +4788(man)S +5014(page)S +960 V +900(for)S +1060(details)S +1380(on)S +1523(other)S +1781(command-line)S +2448(arguments)S +2938(and)S +3129(usage.)S +1116 V +900(The)S +1116(program)S +1533(was)S +1749(originally)S +2223(intended)S +2647(as)S +2785(a)S +2880(debugging)S +3391(tool,)S +3638(either)S +3934(in)S +4067(the)S +4248(development)S +4862(of)S +5000(CDL)S +1236 V +900(clients)S +1233(directly)S +1614(or)S +1751(in)S +1883(cases)S +2159(where)S +2471(the)S +2651(display)S +3015(may)S +3249(need)S +3500(to)S +3631(go)S +3786(to)S +3917(separate)S +4319(screens)S +4685(as)S +4821(part)S +5036(of)S +5172(a)S +1356 V +900(larger)S +1207(project.)S +1625(For)S +1832(example,)S +2285(engineers)S +2758(may)S +3001(wish)S +3263(to)S +3403("eavesdrop")S +3990(on)S +4154(the)S +4342(system)S +4702(by)S +4866(viewing)S +1476 V +900(images)S +1249(displayed)S +1708(by)S +1856(CDL)S +2114(clients)S +2439(used)S +2678(as)S +2807(part)S +3015(of)S +3144(a)S +3230(data)S +3449(acquisition)S +3969(system.)S +4373(It)S +4477(can)S +4665(also)S +4879(be)S +5019(used)S +1596 V +900(as)S +1036(a)S +1129(memory-only)S +1772(display)S +2135(server)S +2446(for)S +2618(CDL)S +2883(clients)S +3215(which)S +3529(need)S +3781(to)S +3913(be)S +4062(run)S +4254(in)S +4386(the)S +4566(background)S +5129(as)S +1716 V +900(part)S +1103(of)S +1227(a)S +1308(pipeline)S +1695(processing)S +2197(system)S +2536(requiring)S +2971(a)S +3052(frame)S +3339(bu)S +3449 H + (f)show 11 -.5 mul h (f)show +11 R +3516(er)S +3633(for)S +3793(image)S +4094(marking.)S +1872 V +900(In)S +1031(proxy)S +1327(mode)S +1611(the)S +1785(program)S +2197(acts)S +2408(as)S +2540(a)S +2629(relay)S +2888(for)S +3056(the)S +3231(IIS)S +3406(datastream)S +3921(packets,)S +4318(sending)S +4701(image)S +5010(data,)S +1992 V +900(frame)S +1188(requests,)S +1609(etc.)S +1798(to)S +1918(a)S +2000(list)S +2169(of)S +2293(other)S +2551(servers)S +2893(speci\256ed)S +3316(on)S +3459(the)S +3626(command)S +4092(line.)S +4351(The)S +4554(e)S +4602 H + (f)show 11 -.5 mul h (f)show +11 R +4669(ect)S +4829(of)S +4953(this)S +5146(is)S +2112 V +900(to)S +1027(allow)S +1312(a)S +1402(client)S +1688(to)S +1816(display)S +2176(to)S +2304(this)S +2506(program)S +2919(which)S +3229(then)S +3460(re-displays)S +3983(to)S +4111(each)S +4352(of)S +4485(the)S +4661(other)S +4928(named)S +2232 V +900(servers.)S +1289(Of)S +1456(course)S +1793(CDL)S +2065(clients)S +2404(can)S +2607(also)S +2836(do)S +2998(this)S +3210(internally)S +3683(by)S +3844(opening)S +4249(multiple)S +4668(connections,)S +2352 V +900(using)S +11 I +1185(vximtool)S +11 R +1609(in)S +1741(proxy)S +2044(mode)S +2335(adds)S +2583(the)S +2764(functionality)S +3373(to)S +3506(programs)S +3967(which)S +4282(may)S +4518(use)S +4711(this)S +4918(feature)S +2472 V +900(only)S +1132(ocasionally.)S +1729(A)S +1844(maximum)S +2327(of)S +2453(8)S +2543(servers)S +2887(may)S +3111(be)S +3249(named,)S +3604(they)S +3828(may)S +4052(be)S +4190(either)S +4474(on)S +4619(the)S +4788(local)S +5036(host)S +2592 V +900(or)S +1024(a)S +1105(remote)S +1442(machine)S +1846(and)S +2037(connections)S +2594(can)S +2779(be)S +2916(established)S +3438(using)S +3711(either)S +3994(\256fos)S +4224(or)S +4349(sockets.)S +4767(See)S +4959(above)S +2712 V +900(or)S +1024(the)S +11 I +1191(vximtool)S +11 R +1602(man)S +1824(page)S +2063(for)S +2223(details)S +2543(on)S +2686(how)S +2908(to)S +3027(specify)S +3376(the)S +3543(server)S +3842(connection.)S +2868 V +900(The)S +1103(current)S +1445(implementation)S +2169(has)S +2348(a)S +2429(few)S +2625(restrictions)S +3146(users)S +3404(should)S +3731(keep)S +3970(in)S +4089(mind:)S +3024 V +11 Y1 +1150(d)S +11 R +1288(The)S +1498(time)S +1734(to)S +1860(display)S +2218(an)S +2361(image)S +2669(or)S +2801(perform)S +3194(any)S +3393(output)S +3716(operation)S +4171(scales)S +4473(with)S +4710(the)S +4885(number)S +3144 V +1150(of)S +1285(connected)S +1772(hosts.)S +2104(Each)S +2366(IIS)S +2544(packet)S +2873(is)S +2991(forwarded)S +3483(to)S +3612(each)S +3854(host)S +4081(in)S +4210(turn)S +4430(before)S +4751(processing)S +3264 V +1150(the)S +1317(next)S +1539(input)S +1799(packet,)S +2145(and)S +2336(connection)S +2850(over)S +3077(a)S +3158(slow)S +3399(network)S +3791(will)S +3996(delay)S +4266(the)S +4433(entire)S +4715(process.)S +3420 V +11 Y1 +1150(d)S +11 R +1298(Cursor)S +1647(and)S +1855(image)S +2173(readback)S +2616(are)S +2799(done)S +3063(by)S +3224(sending)S +3617(the)S +3802(request)S +11 I +4169(only)S +11 R +4409(to)S +4546(the)S +4731(\256rst)S +4954(server)S +3540 V +1150(named)S +1483(on)S +1634(the)S +1809(command)S +2283(line.)S +2550(This)S +2787(is)S +2902(done)S +3156(to)S +3283(avoid)S +3568(forcing)S +3925(a)S +4014(cursor)S +4327(mode)S +4611(on)S +4761(all)S +4911(servers)S +3660 V +1150(which)S +1455(cannot)S +1784(be)S +1924(terminated)S +2430(when)S +2705(a)S +2791(response)S +3212(is)S +3324(received)S +3731(from)S +3982(only)S +4216(one)S +4412(server,)S +4744(and)S +4940(means)S +3780 V +1150(that)S +1365(the)S +1549(\256rst)S +1771(server)S +2087(named)S +2429(should)S +2773(be)S +2926(the)S +3110(one)S +3318(used)S +3569(to)S +3705(control)S +4066(interactive)S +4578(sessions.)S +5050(The)S +3900 V +1150(remaining)S +1648(servers)S +2010(however)S +2439(can)S +2643(still)S +2863(respond)S +3263(to)S +3403(cursor)S +3730(requests)S +4143(from)S +4410(other)S +4689(applications)S +4020 V +1150(connected)S +1626(to)S +1745(that)S +1943(server)S +2242(on)S +2385(another)S +2746(channel.)S +4176 V +11 Y1 +1150(d)S +11 R +1282(All)S +1457(named)S +1783(servers)S +2126(must)S +2375(be)S +2513(running)S +2890(prior)S +3138(to)S +3259(starting)S +3624(the)S +3793(proxy)S +4084(server.)S +4413(The)S +4618(connection)S +5134(to)S +4296 V +1150(the)S +1321(remote)S +1661(servers)S +2006(is)S +2116(established)S +2640(when)S +2913(this)S +3109(task)S +3322(is)S +3432(\256rst)S +3640(run)S +3822(and)S +4016(if)S +4119(no)S +4265(server)S +4567(is)S +4677(running)S +5055(that)S +4416 V +1150(connection)S +1687(will)S +1915(be)S +2074(ignored.)S +2493(The)S +2719(task)S +2952(will)S +3180(exit)S +3401(if)S +3524(no)S +3690(remote)S +4050(servers)S +4415(can)S +4622(be)S +4781(found)S +5093(for)S +4536 V +1150(display.)S +4692 V +11 Y1 +1150(d)S +11 R +1295(Any)S +1531(connected)S +2021(server)S +2334(that)S +2546(shuts)S +2820(down)S +3111(while)S +3402(the)S +3583(proxy)S +3887(server)S +4201(is)S +4323(running)S +4713(is)S +4835(likely)S +5134(to)S +4812 V +1150(cause)S +1425(the)S +1592(program)S +1996(to)S +2115(crash)S +2378(on)S +2521(the)S +2688(next)S +2910(display.)S +7920 V +EP +%%Page: 21 24 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 21 -)S +840 V +11 B +900(11.)S +1104(C)S +1216(Interface)S +1673(Summary)S +996 V +11 R +1260(#include)S +1704(")S +11 B +1749(cdl.h)S +11 R +1980(")S +1296 V +1537(CDLPtr)S +11 B +1919(cdl_open)S +11 R +2507(\(imtdev\))S +1416 V +1504(int)S +11 B +1654(cdl_displayPix)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny,)S +3282(bitpix,)S +3601(frame,)S +3916(fbcon\256g,)S +4343(zscale\))S +1536 V +1378(char)S +11 B +1598(cdl_readCursor)S +11 R +2507(\(cdl,)S +2738(sample,)S +3110(x,)S +3226(y,)S +3342(wcs,)S +3573(key\))S +1656 V +1534(int)S +11 B +1684(cdl_setCursor)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(wcs\))S +1776 V +1618(int)S +11 B +1768(cdl_setWCS)S +11 R +2507(\(cdl,)S +2738(name,)S +3036(title,)S +3269(a,)S +3378(b,)S +3494(c,)S +3603(d,)S +3719(tx,)S +3866(ty,)S +4013(z1,)S +4177(z2,)S +4341(zt\))S +1896 V +1606(int)S +11 B +1756(cdl_getWCS)S +11 R +2507(\(cdl,)S +2738(name,)S +3036(title,)S +3269(a,)S +3378(b,)S +3494(c,)S +3603(d,)S +3719(tx,)S +3866(ty,)S +4013(z1,)S +4177(z2,)S +4341(zt\))S +2016 V +1481(void)S +11 B +1710(cdl_setFrame)S +11 R +2507(\(cdl,)S +2738(frame\))S +2136 V +1457(int)S +11 B +1607(cdl_clearFrame)S +11 R +2507(\(cdl\))S +2256 V +1692(void)S +11 B +1921(cdl_close)S +11 R +2507(\(cdl\))S +2496 V +1439(int)S +11 B +1589(cdl_setMapping)S +11 R +2507(\(cdl,)S +2738(region,)S +3079(sx,sy,snx,sny,)S +3726(dx,dy,dnx,dny,)S +4421(ref\))S +2616 V +1427(int)S +11 B +1577(cdl_getMapping)S +11 R +2507(\(cdl,)S +2738(region,)S +3079(sx,sy,snx,sny,)S +3726(dx,dy,dnx,dny,)S +4421(ref\))S +2736 V +1501(int)S +11 B +1651(cdl_queryMap)S +11 R +2507(\(cdl,)S +2738(wcs,)S +2969(region,)S +3310(sx,sy,snx,sny,)S +3957(dx,dy,dnx,dny,)S +4652(objref\))S +2976 V +1389(int)S +11 B +1539(cdl_displayIRAF)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(band,)S +3346(frame,)S +3661(fbcon\256g,)S +4088(zscale\))S +3096 V +1654(int)S +11 B +1804(cdl_isIRAF)S +11 R +2507(\(fname\))S +3216 V +1515(int)S +11 B +1665(cdl_readIRAF)S +11 R +2507(\(fname,)S +2877(band,)S +3151(pix,)S +3353(nx,)S +3524(ny,)S +3695(bitpix,)S +4014(title\))S +3456 V +1411(int)S +11 B +1561(cdl_displayFITS)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(frame,)S +3387(fbcon\256g,)S +3814(zscale\))S +3576 V +1676(int)S +11 B +1826(cdl_isFITS)S +11 R +2507(\(fname\))S +3696 V +1537(int)S +11 B +1687(cdl_readFITS)S +11 R +2507(\(fname,)S +2877(pix,)S +3079(nx,)S +3250(ny,)S +3421(bitpix,)S +3740(title\))S +3936 V +1216(void)S +11 B +1445(cdl_computeZscale)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny,)S +3282(bitpix,)S +3601(z1,)S +3765(z2\))S +4056 V +1352(void)S +11 B +1581(cdl_zscaleImage)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny,)S +3282(bitpix,)S +3601(z1,)S +3765(z2\))S +4296 V +1604(int)S +11 B +1754(cdl_printPix)S +11 R +2507(\(cdl,)S +2738(cmd,)S +2988(pix,)S +3190(nx,)S +3361(ny,)S +3532(annotate\))S +4416 V +1298(int)S +11 B +1448(cdl_printPixToFile)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(pix,)S +3274(nx,)S +3445(ny,)S +3616(annotate\))S +4656 V +1491(int)S +11 B +1641(cdl_readImage)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny\))S +4776 V +1175(int)S +11 B +1325(cdl_readFrameBu)S +2179 H + (f)show 11 -.5 mul h (f)show +11 B +2246(er)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny\))S +4896 V +1288(int)S +11 B +1438(cdl_readSubRaster)S +11 R +2507(\(cdl,)S +2738(lx,)S +2885(ly,)S +3032(nx,)S +3203(ny,)S +3374(pix\))S +5016 V +1259(int)S +11 B +1409(cdl_writeSubRaster)S +11 R +2507(\(cdl,)S +2738(lx,)S +2885(ly,)S +3032(nx,)S +3203(ny,)S +3374(pix\))S +5256 V +1522(void)S +11 B +1751(cdl_selectFB)S +11 R +2507(\(cdl,)S +2738(nx,)S +2909(ny,)S +3080(fb,)S +3232(w,)S +3372(h,)S +3488(nf,)S +3640(reset\))S +5376 V +1336(void)S +11 B +1565(cdl_setFBCon\256g)S +11 R +2507(\(cdl,)S +2738(con\256gno\))S +5496 V +1324(void)S +11 B +1553(cdl_getFBCon\256g)S +11 R +2507(\(cdl,)S +2738(con\256gno,)S +3184(w,)S +3324(h,)S +3440(nf\))S +5616 V +1260(void)S +11 B +1489(cdl_lookupFBSize)S +11 R +2507(\(cdl,)S +2738(con\256gno,)S +3184(w,)S +3324(h,)S +3440(nf\))S +5856 V +1434(void)S +11 B +1663(cdl_setZTrans)S +11 R +2507(\(cdl,)S +2738(ztrans\))S +5976 V +1472(void)S +11 B +1701(cdl_setZScale)S +11 R +2507(\(cdl,)S +2738(z1,)S +2902(z2\))S +6096 V +1441(void)S +11 B +1670(cdl_setSample)S +11 R +2507(\(cdl,)S +2738(nsample\))S +6216 V +1183(void)S +11 B +1412(cdl_setSampleLines)S +11 R +2507(\(cdl,)S +2738(nlines\))S +6336 V +1376(void)S +11 B +1605(cdl_setContrast)S +11 R +2507(\(cdl,)S +2738(contrast\))S +6456 V +1517(void)S +11 B +1746(cdl_setName)S +11 R +2507(\(cdl,)S +2738(imname\))S +6576 V +1570(void)S +11 B +1799(cdl_setTitle)S +11 R +2507(\(cdl,)S +2738(imtitle\))S +6816 V +1469(void)S +11 B +1698(cdl_getFrame)S +11 R +2507(\(cdl,)S +2738(frame\))S +6936 V +1422(void)S +11 B +1651(cdl_getZTrans)S +11 R +2507(\(cdl,)S +2738(ztrans\))S +7056 V +1460(void)S +11 B +1689(cdl_getZScale)S +11 R +2507(\(cdl,)S +2738(z1,)S +2902(z2\))S +7176 V +1429(void)S +11 B +1658(cdl_getSample)S +11 R +2507(\(cdl,)S +2738(nsample\))S +7296 V +1171(void)S +11 B +1400(cdl_getSampleLines)S +11 R +2507(\(cdl,)S +2738(nlines\))S +7920 V +EP +%%Page: 22 25 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 22 -)S +840 V +1364(void)S +11 B +1593(cdl_getContrast)S +11 R +2507(\(cdl,)S +2738(contrast\))S +960 V +1505(void)S +11 B +1734(cdl_getName)S +11 R +2507(\(cdl,)S +2738(imname\))S +1080 V +1558(void)S +11 B +1787(cdl_getTitle)S +11 R +2507(\(cdl,)S +2738(imtitle\))S +1320 V +1479(int)S +11 B +1629(cdl_mapFrame)S +11 R +2507(\(cdl,)S +2738(frame\))S +1440 V +1221(int)S +11 B +1371(cdl_markCoordsFile)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(type,)S +3322(size,)S +3553(color,)S +3839(label\))S +1560 V +1489(int)S +11 B +1639(cdl_markPoint)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(number,)S +3366(size,)S +3597(type,)S +3847(color\))S +1680 V +1219(int)S +11 B +1369(cdl_markPointLabel)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(label,)S +3244(size,)S +3475(type,)S +3725(color\))S +1800 V +1525(int)S +11 B +1675(cdl_markLine)S +11 R +2507(\(cdl,)S +2738(xs,)S +2897(ys,)S +3056(xe,)S +3220(ye,)S +3384(color\))S +1920 V +1556(int)S +11 B +1706(cdl_markBox)S +11 R +2507(\(cdl,)S +2738(lx,)S +2885(ly,)S +3032(ux,)S +3203(uy,)S +3374(\256ll,)S +3559(color\))S +2040 V +1360(int)S +11 B +1510(cdl_markPolygon)S +11 R +2507(\(cdl,)S +2738(xarray,)S +3077(yarray,)S +3416(npts,)S +3661(\256ll,)S +3846(color\))S +2160 V +1360(int)S +11 B +1510(cdl_markPolyline)S +11 R +2507(\(cdl,)S +2738(xarray,)S +3077(yarray,)S +3416(npts,)S +3661(color\))S +2280 V +1455(int)S +11 B +1605(cdl_markCircle)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(radius,)S +3299(\256ll,)S +3484(color\))S +2400 V +1207(int)S +11 B +1357(cdl_markCircAnnuli)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(radius,)S +3299(nannuli,)S +3690(sep,)S +3897(color\))S +2520 V +1420(int)S +11 B +1570(cdl_markEllipse)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(xrad,)S +3225(yrad,)S +3480(rotang,)S +3821(\256ll,)S +4006(color\))S +2640 V +1184(int)S +11 B +1334(cdl_markEllipAnnuli)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(xrad,)S +3225(yrad,)S +3480(ang,)S +3699(nannuli,)S +4090(sep,)S +4297(color\))S +2760 V +1527(int)S +11 B +1677(cdl_markText)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(str,)S +3141(size,)S +3372(angle,)S +3670(color\))S +2880 V +1649(int)S +11 B +1799(cdl_setFont)S +11 R +2507(\(cdl,)S +2738(font\))S +3000 V +1355(int)S +11 B +1505(cdl_setTextWidth)S +11 R +2507(\(cdl,)S +2738(width\))S +3120 V +1353(int)S +11 B +1503(cdl_setLineWidth)S +11 R +2507(\(cdl,)S +2738(width\))S +3240 V +1422(int)S +11 B +1572(cdl_setLineStyle)S +11 R +2507(\(cdl,)S +2738(style\))S +3360 V +1455(int)S +11 B +1605(cdl_deleteMark)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y\))S +3480 V +1355(int)S +11 B +1505(cdl_clearOverlay)S +11 R +2507(\(cdl\))S +3600 V +1245(int)S +11 B +1395(cdl_redrawOverlay)S +11 R +2507(\(cdl\))S +7920 V +EP +%%Page: 23 26 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 23 -)S +840 V +11 B +900(12.)S +1104(C)S +1216(Example)S +1665(Tasks)S +996 V +11 R +1175(The)S +1381(examples)S +1831(shown)S +2154(here)S +2377(are)S +2545(for)S +2708(demonstration)S +3374(purposes)S +3801(only.)S +4095(They)S +4357(are)S +4526(based)S +4812(on)S +4959(work-)S +1116 V +900(ing)S +1079(example)S +1488(tasks)S +1746(in)S +1870(the)S +2042(CDL)S +2300(source)S +11 I +2622(examples)S +11 R +3066(subdirectory,)S +3679(see)S +3855(the)S +4026(programs)S +4477(there)S +4732(for)S +4896(the)S +5067(full)S +1236 V +900(program)S +1304(listing.)S +1596 V +11 B +900(12.1.)S +1187(Display)S +1576(Example)S +1832 V +9 C +900(#include)S +1386()S +1932 V +900(#include)S +1386()S +2032 V +900(#include)S +1386("cdl.h")S +2232 V +900(/*)S +9 I +1116(DISPLAY)S +1493(--)S +1580(Example)S +1922(task)S +2094(to)S +2191(display)S +2478(an)S +2595(image)S +2842(as)S +2949(a)S +3021(command-line)S +3563(task.)S +2332 V +954(*)S +1053(This)S +1235(task)S +1407(is)S +1494(meant)S +1741(to)S +1838(show)S +2050(three)S +2262(ways)S +2469(the)S +2606(CDL)S +2808(can)S +2965(be)S +3077(used)S +3269(to)S +3366(display)S +2432 V +954(*)S +1053(an)S +1170(image,)S +1440(see)S +1582(the)S +1719(code)S +1916(comments)S +2303(for)S +2435(a)S +2507(description)S +2939(of)S +3036(each)S +3233(method.)S +2532 V +954(*)S +2632 V +954(*)S +1053(Examples:)S +2732 V +954(*)S +1161(To)S +1283(display)S +1570(a)S +1642(simple)S +1904(IRAF)S +2126(or)S +2233(FITS)S +2440(\256le:)S +2832 V +954(*)S +1283(%)S +1385(./display)S +1720(-frame)S +1987(2)S +2059(image.imh)S +2932 V +954(*)S +1242(%)S +1344(./display)S +1679(image.\256ts)S +3032 V +954(*)S +3132 V +954(*)S +1161(To)S +1283(display)S +1570(a)S +1642(FITS)S +1849(\256le)S +1986(as)S +2093(a)S +2165(raw)S +2332(image:)S +3232 V +954(*)S +1269(%)S +1371(./display)S +1706(-nx)S +1848(512)S +2010(-ny)S +2152(512)S +2314(-depth)S +2571(16)S +2688(-hskip)S +2935(5760)S +3142(-raw)S +3339(dpix.\256ts)S +3332 V +954(*)S +3432 V +954(*)S +1053(Usage:)S +3532 V +954(*)S +1175(display)S +1462([-depth)S +1754(N])S +1876([-\256ts])S +2108([-frame)S +2410(N])S +2532([-fbcon\256g)S +2914(N])S +3036([-hskip)S +3318(N])S +3632 V +954(*)S +1283([-iraf])S +1540([-nozscale])S +1977([-nx)S +2154(N])S +2276([-ny)S +2453(N])S +2575([-raw])S +2842([-zscale])S +3189(\256le)S +3732 V +9 C +954(*/)S +3932 V +900(#define)S +1332(NONE)S +1725(-1)S +4032 V +900(#define)S +1450(IRAF)S +1779(0)S +4132 V +900(#define)S +1450(FITS)S +1779(1)S +4232 V +900(#define)S +1450(RAW)S +1779(2)S +4432 V +900(main)S +1170(\(argc,)S +1548(argv\))S +4532 V +900(int)S +1175(argc;)S +4632 V +900(char)S +1175(*argv[];)S +4732 V +900({)S +4832 V +1175(CDLPtr)S +1725(cdl;)S +4932 V +1175(char)S +1450(*fname,)S +1882(title[128];)S +5032 V +1175(int)S +1450(i,)S +1612(status)S +1990(=)S +2098(0,)S +2260(frame)S +2584(=)S +2692(1,)S +2854(fbconfig)S +3340(=)S +3448(0,)S +3610(zscale)S +3988(=)S +4096(1;)S +5132 V +1175(int)S +1450(format)S +1828(=)S +1936(NONE,)S +2260(nx)S +2422(=)S +2530(0,)S +2692(ny)S +2854(=)S +2962(0,)S +3124(depth)S +3448(=)S +3556(8,)S +3718(hskip)S +4042(=)S +4150(0;)S +5232 V +1175(float)S +1725(z1,)S +1941(z2;)S +5332 V +1175(int)S +1450(fb_w,)S +1774(fb_h,)S +2098(nf;)S +5432 V +1175(unsigned)S +1661(char)S +1931(*pix)S +2201(=)S +2309(NULL;)S +5632 V +1175(/*)S +9 I +1337(Process)S +1649(the)S +1786(command)S +2163(line)S +2325(options.)S +9 C +2667(*/)S +5732 V +1175(if)S +1337(\(argc)S +1661(>)S +1769(1\))S +1931({)S +5832 V +1391(for)S +1607(\(i=1;)S +1931(i)S +2039(<)S +2147(argc;)S +2471(i++\))S +2741({)S +5932 V +1548(if)S +1710(\(strcmp)S +2142(\(argv[i],)S +2682("-depth"\))S +3222(==)S +3384(0\))S +3978(depth)S +4302(=)S +4410(atoi)S +4680(\(argv[++i]\);)S +6032 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-fits"\))S +3438(==)S +3600(0\))S +3978(format)S +4356(=)S +4464(FITS;)S +6132 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-frame"\))S +3492(==)S +3654(0\))S +3978(frame)S +4302(=)S +4410(atoi)S +4680(\(argv[++i]\);)S +6232 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-fbconfig"\))S +3654(==)S +3816(0\))S +3978(fbconfig)S +4464(=)S +4572(atoi)S +4842(\(argv[++i]\);)S +6332 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-hskip"\))S +3492(==)S +3654(0\))S +3978(hskip)S +4302(=)S +4410(atoi)S +4680(\(argv[++i]\);)S +6432 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-iraf"\))S +3438(==)S +3600(0\))S +3978(format)S +4356(=)S +4464(IRAF;)S +6532 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-nozscale"\))S +3654(==)S +3816(0\))S +3978(zscale)S +4356(=)S +4464(0;)S +6632 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-nx"\))S +3330(==)S +3492(0\))S +3978(nx)S +4140(=)S +4248(atoi)S +4518(\(argv[++i]\);)S +6732 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-ny"\))S +3330(==)S +3492(0\))S +3978(ny)S +4140(=)S +4248(atoi)S +4518(\(argv[++i]\);)S +6832 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-raw"\))S +3384(==)S +3546(0\))S +3978(format)S +4356(=)S +4464(RAW;)S +6932 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-zscale"\))S +3546(==)S +3708(0\))S +3978(zscale)S +4356(=)S +4464(1;)S +7032 V +1391(})S +7132 V +1175(})S +7920 V +EP +%%Page: 24 27 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 24 -)S +820 V +9 C +1175(/*)S +9 I +1337(Open)S +1559(the)S +1696(package)S +2023(and)S +2185(a)S +2257(connection)S +2679(to)S +2776(the)S +2913(server.)S +9 C +3215(*/)S +920 V +1175(if)S +1337(\(!\(cdl)S +1715(=)S +9 B +1823(cdl_open)S +9 C +2222(\(\(char)S +2600(*\)getenv\("IMTDEV"\)\)\))S +3734(\))S +1020 V +1337(exit)S +1607(\(-1\);)S +1220 V +1175(fname)S +1499(=)S +1607(argv[argc-1];)S +1420 V +1175(/*)S +9 I +1337(METHOD)S +1739(1:)S +1868(Displays)S +2210(the)S +2347(image)S +2594(using)S +2816(the)S +2953(high-level)S +3340(format)S +3607(display)S +1520 V +1229(*)S +1301(call.)S +1513(Display)S +1820(as)S +1927(an)S +2044(IRAF)S +2266(image)S +2513(if)S +2590(the)S +2727(option)S +2984(was)S +3151(set)S +3278(indicating)S +1620 V +1229(*)S +1301(this)S +1458(is)S +1545(the)S +1682(format,)S +1972(otherwise)S +2349(test)S +2501(the)S +2638(\256le)S +2775(to)S +2872(see)S +3014(if)S +3091(it)S +3168(is)S +3255(anyway.)S +1720 V +9 C +1229(*/)S +1820 V +1175(if)S +1337(\(format)S +1769(==)S +1931(IRAF)S +2201(||)S +2363(\(format)S +2795(==)S +2957(NONE)S +3227(&&)S +9 B +3389(cdl_isIRAF)S +9 C +3883(\(fname\)\)\))S +4423({)S +1920 V +1391(status)S +1769(=)S +9 B +1877(cdl_displayIRAF)S +9 C +2586(\(cdl,)S +2910(fname,)S +3288(1,)S +3450(frame,)S +3828(FB_AUTO,)S +4314(zscale\);)S +2120 V +1175(/*)S +9 I +1337(METHOD)S +1739(2:)S +1868(Uses)S +2070(the)S +2207(CDL)S +2409(procedure)S +2806(for)S +2938(getting)S +3215(image)S +3462(pixels)S +3699(from)S +2220 V +1229(*)S +1301(a)S +1373(known)S +1635(format,)S +1925(minimal)S +2247(work)S +2454(required)S +2791(to)S +2888(display)S +3175(an)S +3292(image.)S +3589(The)S +2320 V +1229(*)S +1301(point)S +1513(here)S +1700(is)S +1787(that)S +1954(you)S +2111(can)S +2268(use)S +2415(this)S +2572(method)S +2864(to)S +2961(process)S +3263(the)S +3400(image)S +2420 V +1229(*)S +1301(yourself)S +1618(prior)S +1830(to)S +1927(display,)S +2237(e.g.)S +2395(subsample)S +2802(the)S +2939(pixels,)S +3199(apply)S +3426(a)S +3498(user)S +2520 V +1229(*)S +1301(LUT,)S +1516(etc)S +1648(but)S +1790(still)S +1952(use)S +2099(the)S +2236(CDL)S +2438(to)S +2535(get)S +2672(the)S +2809(raw)S +2976(image)S +3223(and)S +3385(do)S +3502(the)S +2620 V +1229(*)S +1301(display.)S +2720 V +9 C +1229(*/)S +2820 V +1175(})S +1283(else)S +1553(if)S +1715(\(format)S +2147(==)S +2309(FITS)S +2579(||)S +2741(\(format)S +3173(==)S +3335(NONE)S +3605(&&)S +9 B +3767(cdl_isFITS)S +9 C +4241(\(fname\)\)\))S +4781({)S +3020 V +1391(/*)S +9 I +1553(Get)S +1710(the)S +1847(FITS)S +2054(image)S +2301(pixels,)S +2561(exit)S +2718(w/)S +2830(an)S +2947(error)S +3164(status)S +3401(if)S +3478(something)S +3120 V +1445(*)S +1517(went)S +1714(wrong,)S +1994(the)S +2131(procedure)S +2528(will)S +2690(print)S +2892(what)S +3094(that)S +3261(was.)S +3220 V +9 C +1445(*/)S +3320 V +1391(if)S +1553(\()S +9 B +1607(cdl_readFITS)S +9 C +2196(\(fname,)S +2628(&pix,)S +2952(&nx,)S +3222(&ny,)S +3492(&depth,)S +3924(title\)\))S +4356({)S +3420 V +9 B +1450(cdl_close)S +9 C +1849(\(cdl\);)S +2550(/*)S +9 I +2712(close)S +2924(the)S +3061(package)S +9 C +3469(*/)S +3520 V +1450(exit)S +1720(\(1\);)S +2550(/*)S +9 I +2712(exit)S +2869(w/)S +2981(error)S +3198(code)S +9 C +3422(*/)S +3620 V +1391(})S +3820 V +1391(/*)S +9 I +1553(Now)S +1745(select)S +1977(a)S +2049(frame)S +2286(bu)S +2376 H + (f)show 9 -.5 mul h (f)show +9 I +2422(er)S +2524(large)S +2741(enough)S +3033(for)S +3165(the)S +3302(image.)S +3572(The)S +3920 V +1445(*)S +1517(fbcon\256g)S +1834(number)S +2136(is)S +2223(passed)S +2495(in)S +2592(the)S +2729(WCS)S +2936(packet,)S +3221(but)S +3363(the)S +3500(display)S +4020 V +1445(*)S +1517(call)S +1679(below)S +1921(will)S +2083(compute)S +2415(the)S +2552(correct)S +2839(WCS)S +3046(for)S +3178(the)S +3315(image)S +3562(and)S +4120 V +1445(*)S +1517(transmit)S +1844(that)S +2011(prior)S +2223(to)S +2320(display,)S +2630(all)S +2752(we're)S +2984(doing)S +3216(here)S +3403(is)S +4220 V +1445(*)S +1517(setting)S +1784(up)S +1901(the)S +2038(FB)S +2175(to)S +2272(be)S +2384(used.)S +4320 V +9 C +1445(*/)S +4420 V +1391(if)S +1553(\(fbconfig)S +2093(==)S +2255(0\))S +4520 V +9 B +1607(cdl_selectFB)S +9 C +2146(\(cdl,)S +2470(nx,)S +2686(ny,)S +2902(&fbconfig,)S +3496(&fb_w,)S +3874(&fb_h,)S +4252(&nf,)S +4522(0\);)S +4720 V +1391(/*)S +9 I +1553(Lastly,)S +1823(display)S +2110(the)S +2247(pixels)S +2484(to)S +2581(the)S +2718(requested)S +3095(frame,)S +3355(do)S +3472(any)S +4820 V +1445(*)S +1517(zscaling)S +1839(requested)S +2216(using)S +2438(the)S +2575(CDL)S +2777(procedure.)S +4920 V +9 C +1445(*/)S +5020 V +1391(status)S +1769(=)S +9 B +1877(cdl_displayPix)S +9 C +2491(\(cdl,)S +2815(pix,)S +3085(nx,)S +3301(ny,)S +3517(depth,)S +3895(frame,)S +5120 V +1450(fbconfig,)S +1990(zscale\);)S +5320 V +1175(/*)S +9 I +1337(METHOD)S +1739(3:)S +1868(Displays)S +2210(an)S +2327(image)S +2574(of)S +2671(raw)S +2838(pixels.)S +3125(The)S +3287(client)S +3514(code)S +3711(is)S +5420 V +1229(*)S +1301(responsible)S +1743(for)S +1875(reading)S +2182(the)S +2319(image)S +2566(and)S +2728(calling)S +3005(all)S +3127(the)S +3264(procedures)S +5520 V +1229(*)S +1301(needed)S +1583(for)S +1715(image)S +1962(display,)S +2272(initialize)S +2614(the)S +2751(frame,)S +3011(zscaling)S +3333(pix,)S +3493(etc.)S +5620 V +1229(*)S +1301(While)S +1538(we)S +1665(assume)S +1957(a)S +2029(simple)S +2291(raster)S +2533(format)S +2800(in)S +2897(this)S +3054(program,)S +3419(the)S +3556(user)S +5720 V +1229(*)S +1301(code)S +1498(can)S +1655(read)S +1847(a)S +1919(compressed)S +2371(image)S +2618(format)S +2885(such)S +3077(as)S +3184(GIF,)S +3384(mosaic)S +3666(multiple)S +5820 V +1229(*)S +1301(images)S +1583(for)S +1715(display)S +2002(as)S +2109(a)S +2181(single)S +2423(image,)S +2693(or)S +2800(just)S +2957(about)S +3189(anything)S +3531(that)S +5920 V +1229(*)S +1301(produces)S +1658(a)S +1730(raster)S +1972(for)S +2104(display.)S +2414(The)S +2576(intent)S +2808(here)S +2995(is)S +3082(to)S +3179(show)S +3391(all)S +3513(the)S +6020 V +1229(*)S +1301(lowest)S +1558(level)S +1755(calls)S +1952(needed)S +2234(for)S +2366(displaying)S +2768(the)S +2905(image.)S +6120 V +9 C +1229(*/)S +6220 V +1175(})S +1283(else)S +1553(if)S +1715(\(format)S +2147(==)S +2309(RAW\))S +2579({)S +6320 V +1391(FILE)S +1725(*fd;)S +6420 V +1391(int)S +2000(lx,)S +2216(ly;)S +6620 V +1391(if)S +1553(\(nx)S +1769(==)S +1931(0)S +2039(||)S +2201(ny)S +2363(==)S +2525(0\))S +2687({)S +6720 V +1607(fprintf)S +2039(\(stderr,)S +2525("No)S +2741(size)S +3011(given)S +3335(for)S +3551(raw)S +3767(data.\\n"\);)S +6820 V +1607(exit)S +1877(\(1\);)S +6920 V +1391(})S +7120 V +1391(/*)S +9 I +1553(Open)S +1775(the)S +1912(image)S +2159(\256le)S +2296(if)S +2373(we)S +2500(can.)S +9 C +2707(*/)S +7220 V +1391(if)S +1553(\(fd)S +1769(=)S +1877(fopen)S +2201(\(fname,)S +2633("r"\)\))S +2957({)S +7920 V +EP +%%Page: 25 28 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 25 -)S +820 V +9 C +1450(/*)S +9 I +1612(Seek)S +1804(to)S +1901(the)S +2038(o)S +2083 H + (f)show 9 -.5 mul h (f)show +9 I +2129(set)S +2256(speci\256ed.)S +9 C +2648(*/)S +920 V +1450(lseek)S +1774(\(fileno\(fd\),)S +2476(\(off_t\))S +2908(hskip,)S +3286(SEEK_SET\);)S +1120 V +1450(/*)S +9 I +1612(Allocate)S +1939(the)S +2076(pixel)S +2278(pointer)S +2565(and)S +2727(read)S +2919(the)S +3056(data.)S +9 C +3293(*/)S +1220 V +1450(pix)S +1666(=)S +1774(\(unsigned)S +2314(char)S +2584(*\))S +2746(malloc)S +3124(\(nx)S +3340(*)S +3448(ny)S +3610(*)S +3718(\(depth)S +4096(/)S +4204(8\)\);)S +1320 V +1450(fread)S +1774(\(pix,)S +2098(depth/8,)S +2584(nx)S +2746(*)S +2854(ny,)S +3070(fd\);)S +1520 V +1450(/*)S +9 I +1612(If)S +1694(we're)S +1926(zscaling)S +2248(and)S +2410(depth)S +2637(is)S +2724(more)S +2936(than)S +3123(8-bits,)S +3378(do)S +3495(that.)S +9 C +3712(*/)S +1620 V +1450(if)S +1612(\(zscale)S +2044(&&)S +2206(depth)S +2530(>)S +2638(8\))S +2800({)S +1720 V +9 B +1666(cdl_computeZscale)S +9 C +2455(\(cdl,)S +2779(pix,)S +3049(nx,)S +3265(ny,)S +3481(depth,)S +3859(&z1,)S +4129(&z2\);)S +1820 V +9 B +1666(cdl_zscaleImage)S +9 C +2345(\(cdl,)S +2669(&pix,)S +2993(nx,)S +3209(ny,)S +3425(depth,)S +3803(z1,)S +4019(z2\);)S +1920 V +1450(})S +2120 V +1450(/*)S +9 I +1612(Now)S +1804(select)S +2036(a)S +2108(frame)S +2345(bu)S +2435 H + (f)show 9 -.5 mul h (f)show +9 I +2481(er)S +2583(large)S +2800(enough)S +3092(for)S +3224(the)S +3361(image.)S +2220 V +1477(*)S +1549(We'll)S +1771(ask)S +1918(that)S +2085(this)S +2242(be)S +2354(reset)S +2556(but)S +2698(the)S +2835(change)S +3122(won't)S +3354(go)S +3471(to)S +2320 V +1477(*)S +1549(the)S +1686(server)S +1938(until)S +2130(we)S +2257(send)S +2449(in)S +2546(the)S +2683(WCS)S +2890(below.)S +2420 V +9 C +1504(*/)S +2520 V +9 B +1450(cdl_selectFB)S +9 C +1989(\(cdl,)S +2313(nx,)S +2529(ny,)S +2745(&fbconfig,)S +3339(&fb_w,)S +3717(&fb_h,)S +4095(&nf,)S +4365(1\);)S +2720 V +1450(/*)S +9 I +1612(Compute)S +1964(the)S +2101(image)S +2348(placement)S +2745(so)S +2852(it's)S +2994(centered)S +3331(in)S +3428(the)S +3565(frame,)S +2820 V +1477(*)S +1549(but)S +1691(note)S +1873(the)S +2010(cdl_writeSubRaster\(\))S +2807(routine)S +3094(can)S +3251(place)S +3473(an)S +2920 V +1477(*)S +1549(arbitrary)S +1906(raster)S +2148(anywhere)S +2525(in)S +2622(the)S +2759(frame)S +2996(bu)S +3086 H + (f)show 9 -.5 mul h (f)show +9 I +3132(er.)S +3020 V +9 C +1450(lx)S +1612(=)S +1720(\(fb_w)S +2044(/)S +2152(2\))S +2314(-)S +2422(\(nx)S +2638(/)S +2746(2\);)S +3120 V +1450(ly)S +1612(=)S +1720(fb_h)S +1990(-)S +2098(\(\(fb_h)S +2476(/)S +2584(2\))S +2746(+)S +2854(\(ny)S +3070(/)S +3178(2\)\);)S +3320 V +1450(/*)S +9 I +1612(Set)S +1749(the)S +1886(mapping)S +2228(we'll)S +2435(send)S +2627(with)S +2809(the)S +2946(WCS)S +3153(which)S +3395(must)S +3592(be)S +3420 V +1477(*)S +1549(called)S +1796(before)S +2053(the)S +2190(cdl_setWCS\(\))S +2712(call)S +2874(since)S +3086(the)S +3223(data)S +3410(is)S +3497(sent)S +3520 V +1477(*)S +1549(with)S +1731(the)S +1868(WCS)S +2075(and)S +2237(not)S +2379(as)S +2486(a)S +2558(separate)S +2895(call.)S +3620 V +9 C +1504(*)S +3720 V +1504(*)S +9 R +1612(First)S +1804(we)S +1936(must)S +2138(compose)S +2485(a)S +2552(node!path)S +2939(pre\256x)S +3176(for)S +3308(the)S +3445(image.)S +9 C +3742(*/)S +3820 V +1504(*/)S +3920 V +1450(gethostname)S +2098(\(node,)S +2476(512\);)S +4020 V +1450(\(void\))S +1828(getcwd)S +2206(\(path,)S +2584(512\);)S +4120 V +1450(if)S +1612(\(*fname)S +2044(==)S +2206('/'\))S +4220 V +1666(\(void\))S +2044(sprintf)S +2476(\(path_prefix,)S +3232("%s!%s",)S +3718(node,)S +4042(fname\);)S +4320 V +1450(else)S +4420 V +1666(\(void\))S +2044(sprintf)S +2476(\(path_prefix,)S +3232("%s!%s/%s",)S +3880(node,)S +4204(path,)S +4528(fname\);)S +4620 V +9 B +1450(cdl_setMapping)S +9 C +2119(\(cdl,)S +2443("image",)S +2929(0.,)S +3145(0.,)S +3361(nx,)S +3577(ny,)S +3793(lx,)S +4009(ly,)S +4225(nx,)S +4441(ny,)S +4720 V +1612(path_prefix\);)S +4920 V +1450(/*)S +9 I +1612(For)S +1774(the)S +1911(WCS)S +2118(we)S +2245(assume)S +2537(a)S +2609(simple)S +2871(linear)S +3113(transform)S +3495(where)S +3742(the)S +5020 V +1477(*)S +1549(image)S +1796(is)S +1883(Y-\257ipped,)S +2258(the)S +2395(\(x,y\))S +2585(translation)S +3007(is)S +3094(computed)S +3471(so)S +5120 V +1477(*)S +1549(it)S +1626(is)S +1713(correct)S +2000(for)S +2132(an)S +2249(frame)S +2486(bu)S +2576 H + (f)show 9 -.5 mul h (f)show +9 I +2622(er)S +2724(>=)S +2873(than)S +3060(the)S +3197(image)S +3444(size.)S +5220 V +9 C +1504(*/)S +5320 V +9 B +1450(cdl_setWCS)S +9 C +1974(\(cdl,)S +2298(fname,)S +2676("",)S +2892(1.,)S +3108(0.,)S +3324(0.,)S +3540(-1.,)S +5420 V +1666(\(float\))S +2098(\(nx)S +2314(/)S +2422(2\))S +2584(-)S +2692(\(fb_w)S +3016(/)S +3124(2\))S +3286(+)S +3394(1,)S +3826(/*)S +9 I +3988(X)S +4070(trans.)S +9 C +4494(*/)S +5520 V +1666(\(float\))S +2098(\(fb_h)S +2422(/)S +2530(2\))S +2692(+)S +2800(\(ny)S +3016(/)S +3124(2\),)S +3826(/*)S +9 I +3988(Y)S +4065(trans.)S +9 C +4489(*/)S +5620 V +1666(z1,)S +1882(z2,)S +2098(CDL_LINEAR\);)S +3826(/*)S +9 I +3988(Z)S +4065(transform)S +9 C +4474(*/)S +5820 V +1450(/*)S +9 I +1612(Finally,)S +1922(display)S +2209(the)S +2346(pixels.)S +9 C +2687(*/)S +5920 V +1450(if)S +1612(\()S +9 B +1666(cdl_writeSubRaster)S +9 R +2458(\(cdl,)S +2648(lx,)S +2768(ly,)S +2888(nx,)S +3028(ny,)S +3168(pix\)\))S +6020 V +1558(status)S +1790(=)S +1867(1;)S +6120 V +1283(})S +1353(else)S +6220 V +1450(status)S +1682(=)S +1759(1;)S +6320 V +1175(})S +1245(else)S +1412({)S +6420 V +1283(if)S +1365(\(access)S +1652(\(fname,)S +1957(F_OK\))S +2239(==)S +2366(0\))S +6520 V +1450(fprintf)S +1707(\(stderr,)S +1992("'%s':)S +2251(unknown)S +2613(image)S +2860(format.\\n",)S +3280(fname\);)S +6620 V +1283(else)S +6720 V +1450(fprintf)S +1707(\(stderr,)S +1992("'%s':)S +2251(image)S +2498(does)S +2690(not)S +2832(exist.\\n",)S +3182(fname\);)S +6820 V +1283(status)S +1515(=)S +1592(1;)S +6920 V +1175(})S +7120 V +1175(/*)S +9 I +1272(Now)S +1464(just)S +1621(free)S +1788(the)S +1925(pixel)S +2127(pointer)S +2414(to)S +2511(clean)S +2733(up.)S +9 R +2873(*/)S +7220 V +1175(if)S +1257(\(pix\))S +7920 V +EP +%%Page: 26 29 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +460 V +11 R +2936(- 26 -)S +820 V +9 R +1283(free)S +1450(\(\(unsigned)S +1862(char)S +2044(*\))S +2146(pix\);)S +920 V +9 B +1175(cdl_close)S +9 R +1547(\(cdl\);)S +2275(/*)S +9 I +2372(close)S +2584(the)S +2721(package)S +9 R +3048(*/)S +1020 V +1175(exit)S +1337(\(status\);)S +1120 V +900(})S +7920 V +EP +%%Page: 27 30 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +480 V +11 R +2936(- 27 -)S +840 V +11 B +900(12.2.)S +1187(Interactive)S +1730(Graphics)S +2198(Overlay)S +2609(Example)S +1076 V +9 C +900(#include)S +1386()S +1176 V +900(#include)S +1386()S +1276 V +900(#include)S +1386()S +1376 V +900(#include)S +1386("cdl.h")S +1576 V +900(/*)S +1676 V +9 I +954(*)S +1053(TVMARK)S +1430(--)S +1517(Example)S +1859(task)S +2031(for)S +2163(displaying)S +2565(an)S +2682(marking)S +3009(images.)S +3341(This)S +3523(program)S +1776 V +954(*)S +1053(can)S +1210(be)S +1322(used)S +1514(to)S +1611(either)S +1848(display)S +2135(an)S +2252(image)S +2499(and)S +2661(overlay)S +2958(points)S +3205(de\256ned)S +3492(in)S +1876 V +954(*)S +1053(a)S +1125(coordinate)S +1542(\256le,)S +1702(map)S +1884(an)S +2001(existing)S +2308(display)S +2595(frame)S +2832(for)S +2964(marking,)S +3314(or)S +3421(option-)S +1976 V +954(*)S +1053(ally)S +1215(enter)S +1427(a)S +1499(cursor)S +1761(command)S +2138(loop)S +2325(after)S +2522(either)S +2759(of)S +2856(these)S +3068(providing)S +3445(other)S +2076 V +954(*)S +1053(marking)S +1380(capability.)S +1817(All)S +1949(options)S +2241(support)S +2543(minimum)S +2905(match.)S +2176 V +954(*)S +2276 V +954(*)S +1053(Examples:)S +2376 V +954(*)S +1175(%)S +1277(tvmark)S +1554(dpix.\256ts)S +2476 V +954(*)S +1175(%)S +1277(tvmark)S +1554(-coords)S +1856(coords)S +2128(-color)S +2375(205)S +2537(dpix.\256ts)S +2576 V +954(*)S +1175(%)S +1277(tvmark)S +1554(-frame)S +1821(2)S +2676 V +954(*)S +1175(%)S +1277(tvmark)S +1554(-coords)S +1856(coords)S +2128(-interactive)S +2570(dpix.\256ts)S +2776 V +954(*)S +2876 V +954(*)S +1053(Usage:)S +2976 V +954(*)S +1175(tvmark)S +1452([-frame)S +1754(N])S +1876([-fbcon\256g)S +2258(N])S +2380([-coords)S +2717(<\256le>])S +3011([-size)S +3238(N])S +3360([-color)S +3642(N])S +3076 V +954(*)S +1310([-nolabel])S +1707([-\256ll])S +1929([-interactive])S +2441([image])S +3176 V +9 C +954(*/)S +3376 V +900(main)S +1170(\(argc,)S +1548(argv\))S +3476 V +900(int)S +1175(argc;)S +3576 V +900(char)S +1175(*argv[];)S +3676 V +900({)S +3776 V +1175(CDLPtr)S +1725(cdl;)S +3876 V +1175(char)S +1450(*fname)S +1828(=)S +1936(NULL,)S +2260(*cfname)S +2692(=)S +2800(NULL;)S +3976 V +1175(int)S +1450(i,)S +1612(status)S +1990(=)S +2098(0,)S +2260(fill)S +2530(=)S +2638(0,)S +2800(frame)S +3124(=)S +3232(1,)S +3394(fb)S +3556(=)S +3664(FB_AUTO,)S +4150(zscale)S +4528(=)S +4636(1;)S +4076 V +1175(int)S +1450(color)S +1774(=)S +1882(201,)S +2152(label)S +2476(=)S +2584(1,)S +2746(size)S +3016(=)S +3124(9,)S +3286(interactive)S +3934(=)S +4042(0;)S +4176 V +1175(float)S +1725(z1,)S +1941(z2;)S +4276 V +1175(int)S +1450(fb_w,)S +1774(fb_h,)S +2098(nf;)S +4376 V +1175(unsigned)S +1661(char)S +1931(*pix)S +2201(=)S +2309(NULL;)S +4576 V +1175(/*)S +9 I +1337(Process)S +1649(the)S +1786(command)S +2163(line)S +2325(options.)S +9 C +2667(*/)S +4676 V +1175(if)S +1337(\(argc)S +1661(>)S +1769(1\))S +1931({)S +4776 V +1391(for)S +1607(\(i=1;)S +1931(i)S +2039(<)S +2147(argc;)S +2471(i++\))S +2741({)S +4876 V +1548(if)S +1710(\(strncmp\(argv[i],)S +2682("-color",4\))S +3330(==)S +3492(0\))S +3654(color)S +3978(=)S +4086(atoi)S +4356(\(argv[++i]\);)S +4976 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-coords",4\))S +3654(==)S +3816(0\))S +3978(cfname)S +4356(=)S +4464(argv[++i];)S +5076 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-fbconfig",3\))S +3762(==)S +3924(0\))S +4086(fb)S +4248(=)S +4356(atoi)S +4626(\(argv[++i]\);)S +5176 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-fill",4\))S +3546(==)S +3708(0\))S +3870(fill)S +4140(=)S +4248(1;)S +5276 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-frame",3\))S +3600(==)S +3762(0\))S +3924(frame)S +4248(=)S +4356(atoi)S +4626(\(argv[++i]\);)S +5376 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-interactive",4\))S +3924(==)S +4086(0\))S +4248(interactive)S +4896(=)S +5004(1;)S +5476 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-nolabel",4\))S +3708(==)S +3870(0\))S +4032(label)S +4356(=)S +4464(0;)S +5576 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-nozscale",4\))S +3762(==)S +3924(0\))S +4086(zscale)S +4464(=)S +4572(0;)S +5676 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-size",2\))S +3546(==)S +3708(0\))S +3870(size)S +4140(=)S +4248(atoi)S +4518(\(argv[++i]\);)S +5776 V +1391(else)S +5876 V +1607(fname)S +1931(=)S +2039(argv[i];)S +5976 V +1391(})S +6076 V +1175(})S +6276 V +1175(/*)S +9 I +1337(Open)S +1559(the)S +1696(package)S +2023(and)S +2185(a)S +2257(connection)S +2679(to)S +2776(the)S +2913(server.)S +9 C +3215(*/)S +6376 V +1175(if)S +1337(\(!\(cdl)S +1715(=)S +9 B +1823(cdl_open)S +9 C +2222(\(\(char)S +2600(*\)getenv\("IMTDEV"\)\)\))S +3734(\))S +6476 V +1337(exit)S +1607(\(-1\);)S +6676 V +1175(/*)S +9 I +1337(If)S +1419(an)S +1536(image)S +1783(was)S +1950(speci\256ed)S +2292(display)S +2579(it)S +2656(\256rst,)S +2846(otherwise)S +3223(assume)S +3515(the)S +6776 V +1229(*)S +1301(image)S +1548(has)S +1700(already)S +2002(been)S +2199(loaded)S +2471(in)S +2568(the)S +2705(frame)S +2942(and)S +3104(mark)S +3316(that.)S +6876 V +9 C +1229(*/)S +6976 V +1175(if)S +1337(\(fname\))S +1769({)S +7076 V +1391(if)S +1553(\()S +9 B +1607(cdl_isIRAF)S +9 C +2101(\(fname\)\))S +7176 V +1607(status)S +1985(=)S +9 B +2093(cdl_displayIRAF)S +9 C +2802(\(cdl,)S +3126(fname,)S +3504(1,)S +3666(frame,)S +4044(fb,)S +4260(zscale\);)S +7276 V +1391(else)S +1661(if)S +1823(\()S +9 B +1877(cdl_isFITS)S +9 C +2351(\(fname\)\))S +7920 V +EP +%%Page: 28 31 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 28 -)S +820 V +9 C +1607(status)S +1985(=)S +9 B +2093(cdl_displayFITS)S +9 C +2782(\(cdl,)S +3106(fname,)S +3484(frame,)S +3862(fb,)S +4078(zscale\);)S +920 V +1391(else)S +1661({)S +1020 V +1450(if)S +1612(\(access)S +2044(\(cfname,)S +2530(F_OK\))S +2854(==)S +3016(0\))S +1120 V +1823(fprintf)S +2255(\(stderr,)S +2741("'%s':)S +3119(unknown)S +3551(image)S +3875(format.\\n",)S +4523(fname\);)S +1220 V +1450(else)S +1320 V +1823(fprintf)S +2255(\(stderr,)S +2741("'%s':)S +3119(image)S +3443(doesn't)S +3875(exist.\\n",)S +4469(fname\);)S +1420 V +1607(status)S +1985(=)S +2093(1;)S +1520 V +1391(})S +1620 V +1391(if)S +1553(\(status\))S +2093(goto)S +2363(err_;)S +1720 V +1175(})S +1283(else)S +1553({)S +1920 V +1391(/*)S +9 I +1553(If)S +1635(we've)S +1872(requested)S +2249(a)S +2321(special)S +2603(frame)S +2840(bu)S +2930 H + (f)show 9 -.5 mul h (f)show +9 I +2976(er,)S +3101(set)S +3228(it)S +3305(now.)S +9 C +3532(*/)S +2020 V +1391(if)S +1553(\(fb)S +1769(>)S +1877(0\))S +2120 V +9 B +1558(cdl_setFBCon\256g)S +9 C +2247(\(cdl,)S +2571(fb\);)S +2320 V +1391(/*)S +9 I +1553(Map)S +1745(the)S +1882(current)S +2174(display)S +2461(frame)S +2698(for)S +2830(use)S +2977(as)S +3084(an)S +3201(image.)S +9 C +3498(*/)S +2420 V +9 B +1391(cdl_mapFrame)S +9 C +2030(\(cdl,)S +2354(frame\);)S +2520 V +1175(})S +2720 V +1175(/*)S +9 I +1337(If)S +1419(a)S +1491(coordinate)S +1908(\256le)S +2045(was)S +2212(speci\256ed)S +2554(read)S +2746(the)S +2883(\256le)S +3020(and)S +3182(mark)S +3394(those)S +2820 V +1229(*)S +1301(coords)S +1573(with)S +1755(points.)S +2920 V +9 C +1229(*/)S +3020 V +1175(if)S +1337(\(cfname\))S +3120 V +9 B +1548(cdl_markCoordsFile)S +9 C +2397(\(cdl,)S +2721(cfname,)S +3153(M_STAR,)S +3585(size,)S +3909(color,)S +4287(label\);)S +3320 V +1175(/*)S +9 I +1337(Lastly,)S +1607(start)S +1799(up)S +1916(an)S +2033(interactive)S +2445(cursor)S +2707(loop)S +2894(if)S +2971(needed.)S +9 C +3303(*/)S +3420 V +1175(if)S +1337(\(interactive\))S +3520 V +1391(tvmInteractive)S +2201(\(cdl,)S +2525(label,)S +2903(fill,)S +3227(color,)S +3605(size\);)S +3720 V +1175(/*)S +9 I +1337(Close)S +1569(the)S +1706(package)S +2033(and)S +2195(clean)S +2417(up.)S +9 C +2584(*/)S +3820 V +900(err_:)S +9 B +1175(cdl_close)S +9 C +1574(\(cdl\);)S +3920 V +1175(exit)S +1445(\(status\);)S +4020 V +900(})S +4220 V +900(/*)S +9 I +1116(TVMINTERACTIVE)S +1878(--)S +1965(Process)S +2277(commands)S +2689(interactively.)S +9 C +3270(*/)S +4420 V +900(tvmInteractive)S +1710(\(cdl,)S +2034(label,)S +2412(fill,)S +2736(color,)S +3114(size\))S +4520 V +900(CDLPtr)S +1450(cdl;)S +4620 V +900(int)S +1175(label,)S +1553(fill,)S +1877(color,)S +2255(size;)S +4720 V +900({)S +4820 V +1175(float)S +1607(angle)S +1931(=)S +2039(0.0,)S +2309(rx,)S +2525(ry,)S +2741(txsize)S +3119(=)S +3227(1.;)S +4920 V +1175(int)S +1607(nx,)S +1823(ny,)S +2039(i,)S +2201(x,)S +2363(y,)S +2525(x2,)S +2741(y2,)S +2957(wcs;)S +5020 V +1175(int)S +1607(number=1,)S +2147(radius=11,)S +2741(xrad=11,)S +3227(yrad=6,)S +3659(nannuli=3,)S +4253(sep=5;)S +5120 V +1175(char)S +1607(key,)S +1877(cmd[SZ_NAME],)S +2633(str[SZ_NAME];)S +5220 V +1175(unsigned)S +1661(char)S +1931(*pix;)S +5420 V +1175(/*)S +9 I +1337(Process)S +1649(commands)S +2061(until)S +2253(a)S +2325('q')S +2457(keystroke)S +2824(is)S +2911(hit.)S +9 C +3083(*/)S +5520 V +1175(while)S +1499(\()S +9 B +1553(cdl_readCursor)S +9 C +2217(\(cdl,)S +2541(0,)S +2703(&rx,)S +2973(&ry,)S +3243(&wcs,)S +3567(&key\))S +3891(!=)S +4053('q'\))S +4323({)S +5620 V +1391(x)S +1499(=)S +1607(\(int\))S +1931(\(rx)S +2147(+)S +2255(0.5\);)S +2550(/*)S +9 I +2712(convert)S +3009(to)S +3106(int)S +3228(pixels)S +9 C +3492(*/)S +5720 V +1391(y)S +1499(=)S +1607(\(int\))S +1931(\(ry)S +2147(+)S +2255(0.5\);)S +5920 V +1391(switch)S +1769(\(key\))S +2093({)S +6020 V +1391(case)S +1661(':':)S +2550(/*)S +9 I +2712(process)S +3014(a)S +3086(colon)S +3313(command)S +9 C +3717(*/)S +6120 V +1450(putchar)S +1882(\(':'\);)S +6220 V +1450(gets)S +1720(\(str\);)S +6320 V +1450(for)S +1666(\(i=0;)S +1990(str[i])S +2368(!=)S +2530(')S +2638(')S +2746(&&)S +2908(str[i];)S +3340(i++\))S +6420 V +1666(cmd[i])S +2044(=)S +2152(str[i];)S +6520 V +1450(cmd[i++])S +1936(=)S +2044(')S +2152(';)S +6720 V +1450(if)S +1612(\(strcmp)S +2044(\(cmd,)S +2368("angle"\))S +2854(==)S +3016(0\))S +3556(angle)S +3880(=)S +3988(atof)S +4258(\(&str[i]\);)S +6820 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("color"\))S +3124(==)S +3286(0\))S +3556(color)S +3880(=)S +3988(atoi)S +4258(\(&str[i]\);)S +6920 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("fill"\))S +3070(==)S +3232(0\))S +3556(fill)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +7020 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("number"\))S +3178(==)S +3340(0\))S +3556(number)S +3934(=)S +4042(atoi)S +4312(\(&str[i]\);)S +7120 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("nannuli"\))S +3232(==)S +3394(0\))S +3556(nannuli)S +3988(=)S +4096(atoi)S +4366(\(&str[i]\);)S +7220 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("label"\))S +3124(==)S +3286(0\))S +3556(label)S +3880(=)S +3988(atoi)S +4258(\(&str[i]\);)S +7920 V +EP +%%Page: 29 32 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 29 -)S +820 V +9 C +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("sep"\))S +3016(==)S +3178(0\))S +3556(sep)S +3772(=)S +3880(atoi)S +4150(\(&str[i]\);)S +920 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("size"\))S +3070(==)S +3232(0\))S +3556(size)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +1020 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("txsize"\))S +3178(==)S +3340(0\))S +3556(txsize)S +3934(=)S +4042(atof)S +4312(\(&str[i]\);)S +1120 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("xrad"\))S +3070(==)S +3232(0\))S +3556(xrad)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +1220 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("yrad"\))S +3070(==)S +3232(0\))S +3556(yrad)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +1320 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("print"\))S +3124(==)S +3286(0\))S +3448({)S +1420 V +9 B +1666(cdl_readFrameBu)S +2366 H + (f)show 9 -.5 mul h (f)show +9 B +2421(er)S +9 C +2555(\(cdl,)S +2879(&pix,)S +3203(&nx,)S +3473(&ny\);)S +1520 V +9 B +1666(cdl_printPix)S +9 C +2200(\(cdl,)S +2524(NULL,)S +2848(pix,)S +3118(nx,)S +3334(ny,)S +3550(1\);)S +1620 V +1450(})S +1558(else)S +1828(if)S +1990(\(strcmp)S +2422(\(cmd,)S +2746("snap"\))S +3178(==)S +3340(0\))S +3502({)S +1720 V +9 B +1666(cdl_readFrameBu)S +2366 H + (f)show 9 -.5 mul h (f)show +9 B +2421(er)S +9 C +2555(\(cdl,)S +2879(&pix,)S +3203(&nx,)S +3473(&ny\);)S +1820 V +9 B +1666(cdl_printPixToFile)S +9 C +2450(\(cdl,)S +2774(&str[i],)S +3260(pix,)S +3530(nx,)S +3746(ny,)S +3962(1\);)S +1920 V +1450(})S +1558(else)S +1828(if)S +1990(\(strcmp)S +2422(\(cmd,)S +2746("status"\))S +3286(==)S +3448(0\))S +3610({)S +2020 V +1666(printf)S +2044(\("angle)S +2550(=)S +2658(%-5.3gcolor)S +3375(=)S +3483(%d",)S +3753(angle,)S +4131(color\);)S +2120 V +1666(printf)S +2044(\("fill)S +2550(=)S +2658(%-5dnumber)S +3375(=)S +3483(%d\\n",)S +3861(fill,)S +4185(number\);)S +2220 V +1666(printf)S +2044(\("nannuli)S +2550(=)S +2658(%-5dsep)S +3100(=)S +3208(%d",)S +3478(nannuli,)S +3964(sep\);)S +2320 V +1666(printf)S +2044(\("size)S +2550(=)S +2658(%-5dtxsize)S +3375(=)S +3483(%g\\n",)S +3861(size,)S +4185(txsize\);)S +2420 V +1666(printf)S +2044(\("xrad)S +2550(=)S +2658(%-5dyrad)S +3100(=)S +3208(%d",)S +3478(xrad,)S +3802(yrad\);)S +2520 V +1666(printf)S +2044(\("label)S +2550(=)S +2658(%-5d\\n",)S +3144(label\);)S +2620 V +1450(})S +2720 V +1450(break;)S +2920 V +1391(case)S +1661('?':)S +3020 V +1450(/*)S +1612(......)S +9 I +1936(help)S +2118(procedures)S +9 C +2577(*/)S +3120 V +1450(break;)S +3320 V +1391(case)S +1661('p':)S +2825(/*)S +9 I +2987(plus)S +3164(mark)S +9 C +3375(*/)S +3420 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_PLUS,)S +4779(color\);)S +3520 V +1450(break;)S +3620 V +1391(case)S +1661('x':)S +2825(/*)S +9 I +2987(cross)S +3204(mark)S +9 C +3650(*/)S +3720 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_CROSS,)S +4833(color\);)S +3820 V +1450(break;)S +3920 V +1391(case)S +1661('.':)S +2825(/*)S +9 I +2987(point)S +3199(mark)S +9 C +3650(*/)S +4020 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_POINT,)S +4833(color\);)S +4120 V +1450(break;)S +4220 V +1391(case)S +1661('*':)S +2825(/*)S +9 I +2987(star)S +3154(mark)S +9 C +3375(*/)S +4320 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_STAR,)S +4779(color\);)S +4420 V +1450(break;)S +4520 V +1391(case)S +1661('_':)S +2825(/*)S +9 I +2987(horiz)S +3199(dash)S +3396(mark)S +9 C +3581(*/)S +4620 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_HBLINE,)S +4887(color\);)S +4720 V +1450(break;)S +4820 V +1391(case)S +1661('|':)S +2825(/*)S +9 I +2987(vert)S +3154(dash)S +3351(mark)S +9 C +3650(*/)S +4920 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_VBLINE,)S +4887(color\);)S +5020 V +1450(break;)S +5120 V +1391(case)S +1661('o':)S +2825(/*)S +9 I +2987(circle)S +3219(mark)S +9 C +3650(*/)S +5220 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_CIRCLE|fill,)S +5157(color\);)S +5320 V +1450(break;)S +5420 V +1391(case)S +1661('s':)S +2825(/*)S +9 I +2987(square)S +3259(mark)S +9 C +3650(*/)S +5520 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_BOX|fill,)S +4995(color\);)S +5620 V +1450(break;)S +5720 V +1391(case)S +1661('v':)S +2825(/*)S +9 I +2987(diamond)S +3329(mark)S +9 C +3650(*/)S +5820 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_DIAMOND|fill,)S +5211(color\);)S +5920 V +1450(break;)S +6120 V +1391(case)S +1661('b':)S +2825(/*)S +9 I +2987(Box)S +9 C +3650(*/)S +6220 V +1450(printf)S +1828(\("Hit)S +2152(another)S +2584(key)S +2800(to)S +2962(define)S +3340(the)S +3556(box...\\n"\);)S +6320 V +1450(\(void\))S +9 B +1828(cdl_readCursor)S +9 C +2492(\(cdl,)S +2816(0,)S +2978(&rx,)S +3248(&ry,)S +3518(&wcs,)S +3842(&key\);)S +6420 V +1450(x2)S +1612(=)S +1720(\(int\))S +2044(\(rx)S +2260(+)S +2368(0.5\);)S +3100(y2)S +3262(=)S +3370(\(int\))S +3694(\(ry)S +3910(+)S +4018(0.5\);)S +6520 V +9 B +1450(cdl_markBox)S +9 C +2024(\(cdl,)S +2348(x,)S +2510(y,)S +2672(x2,)S +2888(y2,)S +3104(fill,)S +3428(color\);)S +6620 V +1450(break;)S +6720 V +1391(case)S +1661('c':)S +2825(/*)S +9 I +2987(Circle)S +9 C +3650(*/)S +6820 V +1450(printf)S +1828(\("Hit)S +2152(another)S +2584(key)S +2800(to)S +2962(set)S +3178(radius)S +3556(...\\n"\);)S +6920 V +1450(\(void\))S +9 B +1828(cdl_readCursor)S +9 C +2492(\(cdl,)S +2816(0,)S +2978(&rx,)S +3248(&ry,)S +3518(&wcs,)S +3842(&key\);)S +7020 V +1450(x2)S +1612(=)S +1720(\(int\))S +2044(\(rx)S +2260(+)S +2368(0.5\);)S +3100(y2)S +3262(=)S +3370(\(int\))S +3694(\(ry)S +3910(+)S +4018(0.5\);)S +7120 V +1450(radius)S +1828(=)S +1936(\(int\))S +2260(sqrt)S +2530(\(\(double\))S +3070(\(\(x2-x\)*\(x2-x\))S +3880(+)S +3988(\(y2-y\)*\(y2-y\)\)\);)S +7220 V +9 B +1450(cdl_markCircle)S +9 C +2109(\(cdl,)S +2433(x,)S +2595(y,)S +2757(radius,)S +3189(fill,)S +3513(color\);)S +7920 V +EP +%%Page: 30 33 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 30 -)S +820 V +9 C +1450(break;)S +920 V +1391(case)S +1661('d':)S +2825(/*)S +9 I +2987(Delete)S +3249(marker)S +9 C +3650(*/)S +1020 V +9 B +1450(cdl_deleteMark)S +9 C +2109(\(cdl,)S +2433(x,)S +2595(y\);)S +1120 V +1450(break;)S +1220 V +1391(case)S +1661('e':)S +2825(/*)S +9 I +2987(Ellipse)S +9 C +3375(*/)S +1320 V +9 B +1450(cdl_markEllipse)S +9 C +2134(\(cdl,)S +2458(x,)S +2620(y,)S +2782(xrad,)S +3106(yrad,)S +3430(angle,)S +3808(fill,)S +4132(color\);)S +1420 V +1450(break;)S +1520 V +1391(case)S +1661('l':)S +2825(/*)S +9 I +2987(Line)S +9 C +3650(*/)S +1620 V +1450(printf)S +1828(\("Hit)S +2152(another)S +2584(key)S +2800(to)S +2962(set)S +3178(line)S +3448(endpoint...\\n"\);)S +1720 V +1450(\(void\))S +9 B +1828(cdl_readCursor)S +9 C +2492(\(cdl,)S +2816(0,)S +2978(&rx,)S +3248(&ry,)S +3518(&wcs,)S +3842(&key\);)S +1820 V +1450(x2)S +1612(=)S +1720(\(int\))S +2044(\(rx)S +2260(+)S +2368(0.5\);)S +3100(y2)S +3262(=)S +3370(\(int\))S +3694(\(ry)S +3910(+)S +4018(0.5\);)S +1920 V +9 B +1450(cdl_markLine)S +9 C +2049(\(cdl,)S +2373(x,)S +2535(y,)S +2697(x2,)S +2913(y2,)S +3129(color\);)S +2020 V +1450(break;)S +2120 V +1391(case)S +1661('t':)S +2825(/*)S +9 I +2987(Text)S +3169(string)S +9 C +3650(*/)S +2220 V +1450(printf)S +1828(\("Text)S +2206(string:)S +2638("\);)S +2320 V +1450(gets)S +1720(\(str\);)S +2420 V +9 B +1450(cdl_markText)S +9 C +2049(\(cdl,)S +2373(x,)S +2535(y,)S +2697(str,)S +2967(txsize,)S +3399(angle,)S +3777(color\);)S +2520 V +1450(break;)S +2620 V +1391(case)S +1661('C':)S +2825(/*)S +9 I +2987(Circular)S +3324(annuli)S +9 C +3554(*/)S +2720 V +9 B +1450(cdl_markCircAnnuli)S +9 C +2309(\(cdl,)S +2633(x,)S +2795(y,)S +2957(radius,)S +3389(nannuli,)S +3875(sep,)S +4145(color\);)S +2820 V +1450(break;)S +2920 V +1391(case)S +1661('D':)S +2825(/*)S +9 I +2987(Delete)S +3249(all)S +3371(markers)S +9 C +3666(*/)S +3020 V +9 B +1450(cdl_clearOverlay)S +9 C +2164(\(cdl\);)S +3120 V +1450(break;)S +3220 V +1391(case)S +1661('E':)S +2825(/*)S +9 I +2987(Elliptical)S +3349(annuli)S +9 C +3579(*/)S +3320 V +9 B +1450(cdl_markEllipAnnuli)S +9 C +2324(\(cdl,)S +2648(x,)S +2810(y,)S +2972(xrad,)S +3296(yrad,)S +3620(angle,)S +3998(nannuli,)S +4484(sep,)S +4754(color\);)S +3420 V +1450(break;)S +3520 V +1391(default:)S +3620 V +1450(break;)S +3720 V +1391(})S +3820 V +1175(})S +3920 V +900(})S +7920 V +EP +%%Page: 31 34 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +480 V +11 R +2936(- 31 -)S +840 V +11 B +900(12.3.)S +1187(Image)S +1512(Mosaic)S +1880(Example)S +976 V +9 R +1260(#include)S +1597()S +1076 V +1260(#include)S +1597()S +1176 V +1260(#)S +9 B +1305(include)S +1612("cdl.h")S +1376 V +9 R +1260(/*)S +9 I +1357(MOSAIC)S +1714(--)S +1801(Example)S +2143(task)S +2315(to)S +2412(mosaic)S +2694(several)S +2981(images)S +3263(on)S +3380(a)S +3452(display.)S +3762(Demonstrates)S +1476 V +1287(*)S +1359(usage)S +1596(of)S +1693(low-level)S +2050(routines)S +2372(for)S +2504(complex)S +2831(display)S +3118(operations.)S +1576 V +9 R +1287(*/)S +1776 V +1260(main)S +1467(\(argc,)S +1702(argv\))S +1876 V +1260(int)S +1535(argc;)S +1976 V +1260(char)S +1535(*argv[];)S +2076 V +1260({)S +2176 V +1535(CDLPtr)S +2085(cdl;)S +2276 V +1535(char)S +1810(*fname)S +2107(=)S +2184(NULL,)S +2474(title[128];)S +2376 V +1535(int)S +1810(i,)S +1885(j,)S +1960(k,)S +2055(status=0,)S +2405(label=0,)S +2725(frame=1,)S +3080(fb=FB_AUTO,)S +3660(zscale=1;)S +2476 V +1535(int)S +1810(sample=1,)S +2210(pad=0,)S +2485(col=204,)S +2830(imx,)S +3020(imy,)S +3210(bitpix,)S +3470(nimages,)S +3820(nim;)S +2576 V +1535(int)S +1810(ii,)S +1910(xinit,)S +2125(rowx,)S +2360(rowy,)S +2595(nnx,)S +2780(nny,)S +2965(fb_w,)S +3200(fb_h,)S +3415(nf,)S +3540(mx,)S +3705(my,)S +3870(nx,)S +4010(ny;)S +2676 V +1535(\257oat)S +1810(z1,)S +1945(z2;)S +2776 V +1535(unsigned)S +1887(char)S +2069(*pix)S +2256(=)S +2333(NULL;)S +2976 V +1535(/*)S +9 I +1632(Process)S +1944(the)S +2081(command)S +2458(line)S +2620(options.)S +9 R +2935(*/)S +3076 V +1535(if)S +1617(\(argc)S +1829(>)S +1906(1\))S +2008({)S +3176 V +1589(for)S +1721(\(i=1;)S +1923(i)S +1975(<)S +2052(argc;)S +2259(i++\))S +2441({)S +3276 V +1584(if)S +1666(\(strncmp)S +2013(\(argv[i],)S +2338("-fbcon\256g",3\))S +2867(==)S +2994(0\))S +3096(fb=atoi\(argv[++i]\);)S +3376 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-frame",3\))S +2976(==)S +3103(0\))S +3205(frame=atoi\(argv[++i]\);)S +3476 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-color",3\))S +2951(==)S +3078(0\))S +3180(col=atoi\(argv[++i]\);)S +3576 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-label",4\))S +2941(==)S +3068(0\))S +3170(label=1;)S +3676 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-nozscale",4\))S +3076(==)S +3203(0\))S +3305(zscale=0;)S +3776 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-nx",3\))S +2856(==)S +2983(0\))S +3085(nx=atoi\(argv[++i]\);)S +3876 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-ny",3\))S +2856(==)S +2983(0\))S +3085(ny=atoi\(argv[++i]\);)S +3976 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-pad",4\))S +2896(==)S +3023(0\))S +3125(pad=atoi\(argv[++i]\);)S +4076 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-sample",4\))S +3021(==)S +3148(0\))S +3250(sample=atoi\(argv[++i]\);)S +4176 V +1643(else)S +4276 V +1751(break;)S +4376 V +1589(})S +4476 V +1535(})S +4576 V +1535(nimages)S +1862(=)S +1939(argc)S +2121(-)S +2178(i;)S +4776 V +1535(/*)S +9 I +1632(Open)S +1854(the)S +1991(package)S +2318(and)S +2480(a)S +2552(connection)S +2974(to)S +3071(the)S +3208(server.)S +9 R +3483(*/)S +4876 V +1535(if)S +1617(\(!\(cdl)S +1844(=)S +9 B +1921(cdl_open)S +9 R +2293(\(\(char)S +2535(*\)getenv\("IMTDEV"\)\)\))S +3421(\))S +4976 V +1616(exit)S +1778(\(-1\);)S +5176 V +1535(/*)S +9 I +1632(Clear)S +1864(the)S +2001(frame)S +2238(to)S +2335(begin.)S +9 R +2585(*/)S +5276 V +1535(\(void\))S +9 B +1782(cdl_clearFrame)S +9 R +2414(\(cdl\);)S +5476 V +1535(/*)S +9 I +1632(Loop)S +1844(over)S +2031(each)S +2228(of)S +2325(the)S +2462(images)S +2744(in)S +2841(the)S +2978(list.)S +9 R +3138(*/)S +5576 V +1535(nim)S +1702(=)S +1779(rowx)S +1991(=)S +2068(rowy)S +2280(=)S +2357(nnx)S +2519(=)S +2596(nny)S +2758(=)S +2835(0;)S +5676 V +1535(for)S +1667(\(k=0;)S +1889(k)S +1961(<)S +2038(ny)S +2155(&&)S +2322(nim)S +2489(<)S +2566(nimages;)S +2918(k++\))S +3120({)S +5776 V +1643(rowy)S +1855(+=)S +1982(nny)S +2144(+)S +2221(pad;)S +5876 V +1643(for)S +1775(\(rowx)S +2017(=)S +2094(xinit,)S +2309(j=0;)S +2481(j)S +2533(<)S +2610(nx)S +2727(&&)S +2894(nim)S +3061(<)S +3138(nimages;)S +3490(j++\))S +3672({)S +6076 V +1810(/*)S +9 I +1907(Get)S +2064(the)S +2201(image)S +2448(name)S +2670(for)S +2802(display.)S +9 R +3112(*/)S +6176 V +1810(fname)S +2062(=)S +2139(argv[i++];)S +6376 V +1810(/*)S +9 I +1907(Figure)S +2179(out)S +2321(what)S +2523(kind)S +2705(of)S +2802(image)S +3049(it)S +3126(is)S +3213(and)S +3375(get)S +3512(the)S +3649(pixels.)S +9 R +3909(*/)S +6476 V +1810(if)S +1892(\(cdl_isIRAF)S +2369(\(fname\)\))S +6576 V +1918(status)S +2150(=)S +9 B +2227(cdl_readIRAF)S +9 R +2809(\(fname,)S +3114(1,)S +3209(&pix,)S +3444(&imx,)S +3704(&imy,)S +3964(&bitpix,)S +4294(title\);)S +6676 V +1810(else)S +1977(if)S +2059(\(cdl_isFITS)S +2516(\(fname\)\))S +6776 V +1918(status)S +2150(=)S +9 B +2227(cdl_readFITS)S +9 R +2789(\(fname,)S +3094(&pix,)S +3329(&imx,)S +3589(&imy,)S +3849(&bitpix,)S +4179(title\);)S +6876 V +1810(else)S +1977({)S +6976 V +1918(fprintf\(stderr,)S +2433("'%s':)S +2692(unknown)S +3054(or)S +3156(nonexistant)S +3598(image.\\n",)S +3998(fname\);)S +7076 V +1918(status)S +2150(=)S +2227(1;)S +7176 V +1810(})S +7276 V +1810(if)S +1892(\(status\))S +2211(goto)S +2398(err_;)S +7920 V +EP +%%Page: 32 35 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +460 V +11 R +2936(- 32 -)S +820 V +9 R +1810(/*)S +9 I +1907(Compute)S +2259(subsampled)S +2711(image)S +2958(size.)S +9 R +3143(*/)S +920 V +1810(if)S +1892(\(sample)S +2204(>)S +2281(1\))S +1020 V +1918(nnx)S +2080(=)S +2157(imx)S +2324(/)S +2376(sample,)S +2681(nny)S +2843(=)S +2920(imy)S +3087(/)S +3139(sample;)S +1120 V +1810(else)S +1220 V +1918(nnx)S +2080(=)S +2157(imx,)S +2347(nny)S +2509(=)S +2586(imy;)S +1420 V +1810(/*)S +9 I +1907(Unless)S +2179(we)S +2306(asked)S +2538(for)S +2670(a)S +2742(speci\256c)S +3039(FB)S +3176(size)S +3338(\256nd)S +3500(one)S +3657(large)S +3874(enough)S +1520 V +1837(*)S +1909(to)S +2006(handle)S +2278(the)S +2415(mosaic.)S +2747(We)S +2889(don't)S +3106(check)S +3338(to)S +3435(be)S +3547(sure)S +3729(what's)S +1620 V +1837(*)S +1909(returned)S +2246(is)S +2333(really)S +2570(large)S +2787(enough.)S +1720 V +9 R +1837(*/)S +1820 V +1810(if)S +1892(\(nim)S +2089(==)S +2216(0)S +2288(&&)S +2455(fb)S +2557(==)S +2684(FB_AUTO\))S +1920 V +9 B +1918(cdl_selectFB)S +9 R +2430(\(cdl,)S +2620(nx*nnx+\(pad*\(nx-1\)\),)S +3450(ny*nny+\(pad*\(ny-1\)\),)S +4280(&fb,)S +4475(&fb_w,)S +4780(&fb_h,)S +5065(&nf,)S +5260(1\);)S +2020 V +1810(else)S +1977({)S +2120 V +9 B +1918(cdl_setFBCon\256g)S +9 R +2580(\(cdl,)S +2770(fb\);)S +2220 V +9 B +1918(cdl_lookupFBSize)S +9 R +2640(\(cdl,)S +2830(fb,)S +2955(&fb_w,)S +3260(&fb_h,)S +3545(&nf\);)S +2320 V +1810(})S +2520 V +1810(/*)S +9 I +1907(De\256ne)S +2169(a)S +2241(WCS)S +2448(for)S +2580(the)S +2717(frame.)S +9 R +2977(*/)S +2620 V +9 B +1810(cdl_setWCS)S +9 R +2307(\(cdl,)S +2497("image)S +2781(mosaic",)S +3123(title,)S +3313(1.,)S +3431(0.,)S +3549(0.,)S +3667(-1.,)S +3815(0.,)S +3933(\(\257oat\))S +4180(ny*imy+\(pad*\(ny+1\)\),)S +5035(1.,)S +5153(255.,)S +5361(1\);)S +2820 V +1810(/*)S +9 I +1907(The)S +2069(\256rst)S +2236(time)S +2418(through)S +2730(\256gure)S +2967(out)S +3109(the)S +3246(placement)S +3643(so)S +3750(the)S +2920 V +1837(*)S +1909(entire)S +2146(mosaic)S +2428(is)S +2515(centered)S +2852(in)S +2949(the)S +3086(frame.)S +3020 V +9 R +1837(*/)S +3120 V +1810(if)S +1919(\(nim)S +2116(==)S +2243(0\))S +2345({)S +3220 V +1918(mx)S +2060(=)S +2137(\(nx)S +2284(*)S +2356(nnx\))S +2548(+)S +2625(pad)S +2782(*)S +2854(\(nx-1\);)S +3320 V +1918(my)S +2060(=)S +2137(\(ny)S +2284(*)S +2356(nny\))S +2548(+)S +2625(pad)S +2782(*)S +2854(\(ny-1\);)S +3420 V +1918(rowy)S +2130(=)S +2207(\(fb_h)S +2429(-)S +2486(my\))S +2658(/)S +2710(2;)S +3520 V +1918(xinit)S +2110(=)S +2187(rowx)S +2399(=)S +2476(\(fb_w)S +2718(-)S +2775(mx\))S +2947(/)S +2999(2;)S +3620 V +1810(})S +3820 V +1810(/*)S +9 I +1907(Compute)S +2259(the)S +2396(zscaled)S +2688(imaged)S +2980(pixels.)S +9 R +3240(*/)S +3920 V +1810(if)S +1892(\(zscale\))S +2199({)S +4020 V +9 B +1918(cdl_computeZscale)S +9 R +2680(\(cdl,)S +2870(pix,)S +3035(imx)S +3202(,imy,)S +3415(bitpix,)S +3675(&z1,)S +3880(&z2\);)S +4120 V +9 B +1918(cdl_zscaleImage)S +9 R +2570(\(cdl,)S +2760(&pix,)S +2995(imx)S +3162(,imy,)S +3375(bitpix,)S +3635(z1,)S +3770(z2\);)S +4220 V +1810(})S +4420 V +1810(/*)S +9 I +1907(Subsample)S +2324(the)S +2461(image)S +2708(if)S +2785(requested.)S +9 R +3185(*/)S +4520 V +1810(if)S +1892(\(sample)S +2204(>)S +2281(1\))S +2383({)S +4620 V +1918(int)S +2040(l,)S +2115(m,)S +2235(n=0;)S +4720 V +1918(for)S +2050(\(l=0;)S +2252(l)S +2304(<)S +2381(imy;)S +2573(l+=sample\))S +4820 V +2026(for)S +2158(\(m=0;)S +2405(m)S +2502(<)S +2579(imx;)S +2771(m+=sample\))S +4920 V +2134(pix[n++])S +2481(=)S +2558(pix[\(l*imx\)+m];)S +5020 V +1810(})S +5220 V +1810(/*)S +9 I +1907(Write)S +2134(the)S +2271(image)S +2518(to)S +2615(the)S +2752(frame)S +2989(bu)S +3079 H + (f)show 9 -.5 mul h (f)show +9 I +3125(er.)S +9 R +3250(*/)S +5320 V +1810(if)S +1892(\()S +9 B +1922(cdl_writeSubRaster)S +9 R +2714(\(cdl,)S +2904(rowx,)S +3139(rowy,)S +3374(nnx,)S +3559(nny,)S +3744(pix\)\))S +3946(goto)S +4133(err_;)S +5520 V +1810(/*)S +9 I +1907(Draw)S +2139(the)S +2276(image)S +2523(name)S +2745(as)S +2852(a)S +2924(label.)S +9 R +3154(*/)S +5620 V +1810(if)S +1892(\(label\))S +9 B +2154(cdl_markText)S +9 R +2726(\(cdl,)S +2916(rowx+10,)S +3291(rowy+10,)S +3666(fname,)S +3941(1.,)S +4059(0.,)S +4177(col\);)S +5820 V +1810(nim++;)S +2360(rowx)S +2572(+=)S +2699(nnx)S +2861(+)S +2938(pad;)S +5920 V +1643(})S +6020 V +1535(})S +6220 V +1535(/*)S +9 I +1632(Close)S +1864(the)S +2001(package)S +2328(and)S +2490(clean)S +2712(up.)S +9 R +2852(*/)S +6320 V +1260(err_:)S +9 B +1535(cdl_close)S +9 R +1907(\(cdl\);)S +6420 V +1535(exit)S +1697(\(status\);)S +6520 V +1260(})S +7920 V +EP +%%Page: 33 36 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +480 V +11 R +2936(- 33 -)S +840 V +11 B +900(13.)S +1104(Fortran)S +1541(Interface)S +1998(Summary)S +996 V +11 R +1260(include)S +1649(")S +11 B +1694(cdlftn.inc)S +11 R +2138(")S +1296 V +11 B +1910(cfopen)S +11 R +2386(\(imtdev,)S +2789(ier\))S +1416 V +11 B +1645(cfdisplayPix)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(bitpix,)S +3285(frame,)S +3600(fbcon\256g,)S +4027(zscale,)S +4354(ier\))S +1536 V +11 B +1589(cfreadCursor)S +11 R +2386(\(sample,)S +2794(x,)S +2910(y,)S +3026(key,)S +3245(ier\))S +1656 V +11 B +1675(cfsetCursor)S +11 R +2386(\(x,)S +2538(y,)S +2654(wcs,)S +2885(ier\))S +1776 V +11 B +1759(cfsetWCS)S +11 R +2386(\(name,)S +2720(title,)S +2953(a,)S +3062(b,)S +3178(c,)S +3287(d,)S +3403(tx,)S +3550(ty,)S +3697(z1,)S +3861(z2,)S +4025(zt,)S +4165(ier\))S +1896 V +11 B +1747(cfgetWCS)S +11 R +2386(\(name,)S +2720(title,)S +2953(a,)S +3062(b,)S +3178(c,)S +3287(d,)S +3403(tx,)S +3550(ty,)S +3697(z1,)S +3861(z2,)S +4025(zt,)S +4165(ier\))S +2016 V +11 B +1701(cfsetFrame)S +11 R +2386(\(frame\))S +2136 V +11 B +1598(cfclearFrame)S +11 R +2386(\(ier\))S +2256 V +11 B +1912(cfclose)S +11 R +2386(\(\))S +2496 V +11 B +1580(cfsetMapping)S +11 R +2386(\(region,)S +2763(sx,sy,snx,sny,)S +3410(dx,dy,dnx,dny,)S +4105(ref,)S +4286(ier\))S +2616 V +11 B +1568(cfgetMapping)S +11 R +2386(\(region,)S +2763(sx,sy,snx,sny,)S +3410(dx,dy,dnx,dny,)S +4105(ref,)S +4286(ier\))S +2736 V +11 B +1642(cfqueryMap)S +11 R +2386(\(wcs,)S +2653(region,)S +2994(sx,sy,snx,sny,)S +3641(dx,dy,dnx,dny,)S +4336(objref,)S +4658(ier\))S +2976 V +11 B +1530(cfdisplayIRAF)S +11 R +2386(\(fname,)S +2756(band,)S +3030(frame,)S +3345(fbcon\256g,)S +3772(zscale,)S +4099(ier\))S +3096 V +11 B +1800(c\256sIRAF)S +11 R +2386(\(fname,)S +2756(isiraf\))S +3216 V +11 B +1656(cfreadIRAF)S +11 R +2386(\(fname,)S +2756(band,)S +3030(pix,)S +3232(nx,)S +3403(ny,)S +3574(bitpix,)S +3893(title,)S +4126(ier\))S +3456 V +11 B +1552(cfdisplayFITS)S +11 R +2386(\(fname,)S +2756(frame,)S +3071(fbcon\256g,)S +3498(zscale,)S +3825(ier\))S +3576 V +11 B +1822(c\256sFITS)S +11 R +2386(\(fname,)S +2756(is\256ts\))S +3696 V +11 B +1678(cfreadFITS)S +11 R +2386(\(fname,)S +2756(pix,)S +2958(nx,)S +3129(ny,)S +3300(bitpix,)S +3619(title,)S +3852(ier\))S +3936 V +11 B +1436(cfcomputeZscale)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(bitpix,)S +3285(z1,)S +3449(z2\))S +4056 V +11 B +1572(cfzscaleImage)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(bitpix,)S +3285(z1,)S +3449(z2\))S +4296 V +11 B +1745(cfprintPix)S +11 R +2386(\(cmd,)S +2672(pix,)S +2874(nx,)S +3045(ny,)S +3216(annotate,)S +3648(ier\))S +4416 V +11 B +1439(cfprintPixToFile)S +11 R +2386(\(fname,)S +2756(pix,)S +2958(nx,)S +3129(ny,)S +3300(annotate,)S +3732(ier\))S +4656 V +11 B +1632(cfreadImage)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(ier\))S +4776 V +11 B +1316(cfreadFrameBu)S +2058 H + (f)show 11 -.5 mul h (f)show +11 B +2125(er)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(ier\))S +4896 V +11 B +1429(cfreadSubRaster)S +11 R +2386(\(lx,)S +2569(ly,)S +2716(nx,)S +2887(ny,)S +3058(pix,)S +3260(ier\))S +5016 V +11 B +1400(cfwriteSubRaster)S +11 R +2386(\(lx,)S +2569(ly,)S +2716(nx,)S +2887(ny,)S +3058(pix,)S +3260(ier\))S +5256 V +11 B +1742(cfselectFB)S +11 R +2386(\(nx,)S +2593(ny,)S +2764(fb,)S +2916(w,)S +3056(h,)S +3172(nf,)S +3324(reset\))S +5376 V +11 B +1556(cfsetFBCon\256g)S +11 R +2386(\(con\256gno\))S +5496 V +11 B +1544(cfgetFBCon\256g)S +11 R +2386(\(con\256gno,)S +2868(w,)S +3008(h,)S +3124(nf\))S +5616 V +11 B +1485(c\257ookupFBSize)S +11 R +2386(\(con\256gno,)S +2868(w,)S +3008(h,)S +3124(nf\))S +5856 V +11 B +1654(cfsetZTrans)S +11 R +2386(\(ztrans\))S +5976 V +11 B +1692(cfsetZScale)S +11 R +2386(\(z1,)S +2586(z2\))S +6096 V +11 B +1661(cfsetSample)S +11 R +2386(\(nsample\))S +6216 V +11 B +1403(cfsetSampleLines)S +11 R +2386(\(nlines\))S +6336 V +11 B +1596(cfsetContrast)S +11 R +2386(\(contrast\))S +6456 V +11 B +1737(cfsetName)S +11 R +2386(\(imname\))S +6576 V +11 B +1790(cfsetTitle)S +11 R +2386(\(imtitle\))S +6816 V +11 B +1689(cfgetFrame)S +11 R +2386(\(frame\))S +6936 V +11 B +1642(cfgetZTrans)S +11 R +2386(\(ztrans\))S +7056 V +11 B +1680(cfgetZScale)S +11 R +2386(\(z1,)S +2586(z2\))S +7176 V +11 B +1649(cfgetSample)S +11 R +2386(\(nsample\))S +7296 V +11 B +1391(cfgetSampleLines)S +11 R +2386(\(nlines\))S +7920 V +EP +%%Page: 34 37 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 34 -)S +840 V +11 B +1584(cfgetContrast)S +11 R +2386(\(contrast\))S +960 V +11 B +1725(cfgetName)S +11 R +2386(\(imname\))S +1080 V +11 B +1778(cfgetTitle)S +11 R +2386(\(imtitle\))S +1320 V +11 B +1620(cfmapFrame)S +11 R +2386(\(frame,)S +2737(ier\))S +1440 V +11 B +1630(cfmarkPoint)S +11 R +2386(\(x,)S +2538(y,)S +2654(number,)S +3050(size,)S +3281(type,)S +3531(color,)S +3817(ier\))S +1560 V +11 B +1429(cfmarkcoords\256le)S +11 R +2386(\(fname,)S +2756(type,)S +3006(size,)S +3237(color,)S +3523(label,)S +3797(ier\))S +1680 V +11 B +1360(cfmarkPointLabel)S +11 R +2386(\(x,)S +2538(y,)S +2654(label,)S +2928(size,)S +3159(type,)S +3409(color,)S +3695(ier\))S +1800 V +11 B +1666(cfmarkLine)S +11 R +2386(\(xs,)S +2581(ys,)S +2740(xe,)S +2904(ye,)S +3068(color,)S +3354(ier\))S +1920 V +11 B +1697(cfmarkBox)S +11 R +2386(\(lx,)S +2569(ly,)S +2716(ux,)S +2887(uy,)S +3058(\256ll,)S +3243(color,)S +3529(ier\))S +2040 V +11 B +1501(cfmarkPolygon)S +11 R +2386(\(xarray,)S +2761(yarray,)S +3100(npts,)S +3345(\256ll,)S +3530(color,)S +3816(ier\))S +2160 V +11 B +1501(cfmarkPolyline)S +11 R +2386(\(xarray,)S +2761(yarray,)S +3100(npts,)S +3345(color,)S +3631(ier\))S +2280 V +11 B +1596(cfmarkCircle)S +11 R +2386(\(x,)S +2538(y,)S +2654(radius,)S +2983(\256ll,)S +3168(color,)S +3454(ier\))S +2400 V +11 B +1348(cfmarkCircAnnuli)S +11 R +2386(\(x,)S +2538(y,)S +2654(radius,)S +2983(nannuli,)S +3374(sep,)S +3581(color,)S +3867(ier\))S +2520 V +11 B +1561(cfmarkEllipse)S +11 R +2386(\(x,)S +2538(y,)S +2654(xrad,)S +2909(yrad,)S +3164(rotang,)S +3505(\256ll,)S +3690(color,)S +3976(ier\))S +2640 V +11 B +1325(cfmarkEllipAnnuli)S +11 R +2386(\(x,)S +2538(y,)S +2654(xrad,)S +2909(yrad,)S +3164(ang,)S +3383(nannuli,)S +3774(sep,)S +3981(color,)S +4267(ier\))S +2760 V +11 B +1668(cfmarkText)S +11 R +2386(\(x,)S +2538(y,)S +2654(str,)S +2825(size,)S +3056(angle,)S +3354(color,)S +3640(ier\))S +2880 V +11 B +1821(cfsetfont)S +3000 V +1565(cfsettextwidth)S +11 R +2386(\(width\))S +3120 V +11 B +1709(cfsetlwidth)S +11 R +2386(\(width\))S +3240 V +11 B +1766(cfsetlstyle)S +11 R +2386(\(style\))S +3360 V +11 B +1596(cfdeleteMark)S +11 R +2386(\(x,)S +2538(y,)S +2654(ier\))S +3480 V +11 B +1529(cfclearOverlay)S +11 R +2386(\(ier\))S +3600 V +11 B +1419(cfredrawOverlay)S +11 R +2386(\(ier\))S +7920 V +EP +%%Page: 35 38 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 35 -)S +840 V +11 B +900(14.)S +1104(Fortran)S +1508(Example)S +1957(Tasks)S +996 V +11 R +1175(The)S +1381(examples)S +1831(shown)S +2154(here)S +2377(are)S +2545(for)S +2708(demonstration)S +3374(purposes)S +3801(only.)S +4095(They)S +4357(are)S +4526(based)S +4812(on)S +4959(work-)S +1116 V +900(ing)S +1079(example)S +1488(tasks)S +1746(in)S +1870(the)S +2042(CDL)S +2300(source)S +11 I +2622(examples)S +11 R +3066(subdirectory,)S +3679(see)S +3855(the)S +4026(programs)S +4477(there)S +4732(for)S +4896(the)S +5067(full)S +1236 V +900(program)S +1304(listing.)S +1596 V +11 B +900(14.1.)S +1187(Display)S +1576(Example)S +1796 V +9 C +1260(C)S +1368(========================================================================)S +1896 V +1260(C)S +1422(FDISPLAY)S +1908(--)S +2070(Example)S +2502(fortran)S +2934(program)S +3366(showing)S +3798(the)S +4014(use)S +4230(of)S +4392(the)S +4608(Client)S +1996 V +1260(C)S +1422(Display)S +1854(Library)S +2286(\(CDL\))S +2610(Fortran)S +3042(interface)S +3582(for)S +3798(displaying)S +4392(images.)S +2096 V +1260(C)S +1368(========================================================================)S +2296 V +1535(PROGRAM)S +1967(FDISPLAY)S +2396 V +1535(character*64)S +2345(imname)S +2596 V +1260(C)S +9 I +1535(Initialize)S +1882(the)S +2019(CDL)S +2221(package)S +2696 V +9 C +1535(call)S +9 B +1805(cfopen)S +9 C +2114(\(0,)S +2330(ier\))S +2796 V +1535(if)S +1697(\(ier)S +1967(.gt.)S +2237(0\))S +2399(then)S +2896 V +1751(write)S +2075(\(*,*\))S +2399('open:)S +2777(Error)S +3101(return)S +3479(from)S +3749(CDL')S +2996 V +1751(goto)S +2021(999)S +3096 V +1535(endif)S +3296 V +1535(write)S +1859(\(*,)S +2075("\('Image)S +2561(Name:)S +2885(',)S +3047($\)"\))S +3396 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(imname)S +3496 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(Number:)S +2993(',)S +3155($\)"\))S +3596 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(iframe)S +3696 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(buffer)S +2939(configuration)S +3695(number:)S +4127(',)S +4289($\)"\))S +3796 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(ifb)S +3996 V +1260(C)S +9 I +1535(If)S +1617(we've)S +1854(got)S +1996(a)S +2068(FITS)S +2275(format)S +2542(image,)S +2812(go)S +2929(ahead)S +3176(and)S +3338(display)S +3625(it.)S +4096 V +9 C +1535(call)S +9 B +1805(c\256sFITS)S +9 C +2184(\(imname,)S +2670(isfits\))S +4196 V +1535(if)S +1697(\(isfits)S +2129(.gt.)S +2399(0\))S +2561(then)S +4296 V +1751(call)S +9 B +2021(cfdisplayFITS)S +9 C +2620(\(imname,)S +3106(iframe,)S +3538(ifb,)S +3808(1,)S +3970(ier\))S +4396 V +1535(else)S +4496 V +1260(C)S +9 I +1751(We've)S +2003(got)S +2145(an)S +2262(IRAF)S +2484(format)S +2751(image,)S +3021(go)S +3138(ahead)S +3385(and)S +3547(display)S +3834(it.)S +4596 V +9 C +1751(call)S +9 B +2021(c\256sIRAF)S +9 C +2420(\(imname,)S +2906(isiraf\))S +4696 V +1751(if)S +1913(\(isiraf)S +2345(.gt.)S +2615(0\))S +2777(then)S +4796 V +1967(call)S +9 B +2237(cfdisplayIRAF)S +9 C +2856(\(imname,)S +3342(1,)S +3504(iframe,)S +3936(ifb,)S +4206(1,)S +4368(ier\))S +4896 V +1751(else)S +4996 V +1260(C)S +9 I +1810(Unrecognized)S +2342(image,)S +2612(punt)S +2799(and)S +2961(exit.)S +5096 V +9 C +1967(write)S +2291(\(*,*\))S +2615('Unrecognized)S +3371(image)S +3695(format')S +5196 V +1751(endif)S +5296 V +1535(endif)S +5496 V +1260(C)S +9 I +1535(Clean)S +1777(up)S +1894(and)S +2056(exit.)S +5596 V +9 C +1260(999)S +1535(continue)S +5696 V +1535(call)S +9 B +1805(cfclose)S +9 C +2114(\(ier\))S +5796 V +1535(end)S +7920 V +EP +%%Page: 36 39 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +480 V +11 R +2936(- 36 -)S +840 V +11 B +900(14.2.)S +1187(Interactive)S +1730(Graphics)S +2198(Overlay)S +2609(Example)S +1040 V +9 C +1260(C)S +1368(==========================================================================)S +1140 V +1260(C)S +1422(FTVMARK)S +1854(--)S +2070(Example)S +2502(fortran)S +2934(program)S +3366(showing)S +3798(the)S +4014(use)S +4230(of)S +4392(the)S +4608(Client)S +1240 V +1260(C)S +1422(Display)S +1854(Library)S +2286(\(CDL\))S +2610(Fortran)S +3042(interface)S +3582(for)S +3798(doing)S +4122(graphics)S +4608(overlay.)S +5094(No)S +1340 V +1260(C)S +1422(checking)S +1908(of)S +2070(the)S +2286(error)S +2610(flag)S +2880(is)S +3042(done)S +3312(here)S +3582(for)S +3798(space)S +4122(considerations.)S +1440 V +1260(C)S +1368(==========================================================================)S +1640 V +1535(PROGRAM)S +1967(FTVMARK)S +1740 V +1535(include)S +2085(")S +9 B +2139(cdlftn.inc)S +9 C +2502(")S +1840 V +1535(character*64)S +2360(imname)S +2040 V +1260(C)S +9 I +1535(Initialize)S +1882(the)S +2019(CDL)S +2221(package)S +2140 V +9 C +1535(call)S +9 B +1805(cfopen)S +9 C +2114(\(0,)S +2330(ier\))S +2340 V +1535(write)S +1859(\(*,)S +2075("\('Image)S +2561(Name:)S +2885(',)S +3047($\)"\))S +2440 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(imname)S +2540 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(Number:)S +2993(',)S +3155($\)"\))S +2640 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(iframe)S +2740 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(buffer)S +2939(configuration)S +3695(number:)S +4127(',)S +4289($\)"\))S +2840 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(ifb)S +3040 V +1260(C)S +9 I +1535(If)S +1617(we've)S +1854(got)S +1996(a)S +2068(FITS)S +2275(format)S +2542(image,)S +2812(go)S +2929(ahead)S +3176(and)S +3338(display)S +3625(it.)S +3140 V +9 C +1535(call)S +9 B +1805(c\256sFITS)S +9 C +2184(\(imname,)S +2670(isfits\))S +3240 V +1535(if)S +1697(\(isfits)S +2129(.gt.)S +2399(0\))S +2561(then)S +3340 V +1751(call)S +9 B +2021(cfdisplayFITS)S +9 C +2620(\(imname,)S +3106(iframe,)S +3538(ifb,)S +3808(1,)S +3970(ier\))S +3440 V +1535(else)S +3540 V +1260(C)S +9 I +1751(We've)S +2003(got)S +2145(an)S +2262(IRAF)S +2484(format)S +2751(image,)S +3021(go)S +3138(ahead)S +3385(and)S +3547(display)S +3834(it.)S +3640 V +9 C +1751(call)S +9 B +2021(c\256sIRAF)S +9 C +2420(\(imname,)S +2906(isiraf\))S +3740 V +1751(if)S +1913(\(isiraf)S +2345(.gt.)S +2615(0\))S +2777(then)S +3840 V +1967(call)S +9 B +2237(cfdisplayIRAF)S +9 C +2856(\(imname,)S +3342(1,)S +3504(iframe,)S +3936(ifb,)S +4206(1,)S +4368(ier\))S +3940 V +1751(else)S +4040 V +1260(C)S +9 I +1967(No)S +2099(valid)S +2306(image)S +2553(given,)S +2798(so)S +2905(map)S +3087(the)S +3224(current)S +3516(display)S +3803(for)S +3935(marking.)S +4140 V +9 C +1967(call)S +9 B +2237(cfmapFrame)S +9 C +2786(\(iframe\))S +4240 V +1751(endif)S +4340 V +1535(endif)S +4540 V +1260(C)S +9 I +1535(Now)S +1727(that)S +1894(we've)S +2131(got)S +2273(an)S +2390(image)S +2637(displayed)S +3009(or)S +3116(mapped,)S +3451(enter)S +3663(a)S +3735(cursor)S +3997(loop)S +4184(to)S +4281(mark)S +4493(the)S +4630(image.)S +4640 V +9 C +1535(call)S +1805(markInteractive)S +2669(\(\))S +4840 V +1260(C)S +9 I +1535(Clean)S +1777(up)S +1894(and)S +2056(exit)S +4940 V +9 C +1260(999)S +1535(continue)S +5040 V +1535(call)S +9 B +1805(cfclose)S +9 C +2114(\(ier\))S +5140 V +1535(end)S +5340 V +1260(C)S +9 I +1476(MARKINTERACTIVE)S +2303(--)S +2390(Subroutine)S +2812(for)S +2944(processing)S +3361(the)S +3498(cursor)S +3760(loop.)S +5440 V +9 C +1535(subroutine)S +2129(markInteractive)S +2993(\(\))S +5540 V +1535(include)S +2085(")S +9 B +2139(cdlftn.inc)S +9 C +2502(")S +5640 V +1535(real)S +2085(angle,)S +2463(rx,)S +2679(ry,)S +2895(txsize)S +5740 V +1535(integer)S +2360(nx,)S +2576(ny,)S +2792(x,)S +2954(y,)S +3116(x2,)S +3332(y2,)S +3548(fill,)S +3872(size,)S +4196(color)S +5840 V +1535(integer)S +2360(number,)S +2792(radius,)S +3224(xrad,)S +3548(yrad,)S +3872(nannuli,)S +4358(sep)S +5940 V +1535(character)S +2085(key)S +6040 V +1535(character*64)S +2360(cmd,)S +2630(str)S +6240 V +1260(C)S +9 I +1535(Allocate)S +1862(a)S +1934(1024x1024)S +2361(array)S +2588(for)S +2720(pixels.)S +6340 V +9 C +1535(character)S +2085(pix\(1048576\))S +6540 V +1260(C)S +9 I +1535(....Initialize)S +1974(the)S +2111(local)S +2318(parameters)S +2755(to)S +2852(use)S +6740 V +9 C +1260(C)S +9 I +1535(Read)S +1747(a)S +1819(cursor)S +2081(keystroke)S +2448(telling)S +2705(us)S +2812(what)S +3014(to)S +3111(do.)S +6840 V +9 C +1260(10)S +1535(call)S +9 B +1805(cfreadCursor)S +9 C +2379(\(0,)S +2595(rx,)S +2811(ry,)S +3027(key,)S +3297(ier\))S +7040 V +1260(C)S +9 I +1535(Round)S +1797(the)S +1934(real)S +2106(cursor)S +2368(position)S +2685(to)S +2782(integer)S +3064(pixel)S +3266(positions.)S +7140 V +9 C +1751(x)S +1859(=)S +1967(nint)S +2237(\(rx)S +2453(+)S +2561(0.5\))S +7240 V +1751(y)S +1859(=)S +1967(nint)S +2237(\(ry)S +2453(+)S +2561(0.5\))S +7920 V +EP +%%Page: 37 40 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 37 -)S +820 V +9 C +1260(C)S +9 I +1535(Check)S +1787(the)S +1924(keystroke)S +2291(and)S +2453(take)S +2630(the)S +2767(appropriate)S +3224(action.)S +920 V +9 C +1260(C)S +9 I +1751(Colon)S +1998(Commands)S +1020 V +9 C +1751(if)S +1913(\(key)S +2183(.eq.)S +2453(':'\))S +2723(then)S +1120 V +1260(C)S +9 I +1810(Read)S +2022(a)S +2094(three)S +2306(character)S +2683(command)S +3060(and)S +3222(value)S +3444(\256eld)S +3626(and)S +3788(process)S +4090(the)S +4227(colon)S +4454(command)S +1220 V +9 C +1810(read)S +2080(\(*,'\(A3,)S +2566(i4\)'\))S +2890(cmd,)S +3160(ival)S +1320 V +1810(if)S +1972(\(cmd\(1:3\))S +2512(.eq.)S +2782('ang'\))S +3160(then)S +1420 V +2026(angle)S +2350(=)S +2458(real)S +2728(\(ival\))S +1520 V +1810(else)S +2080(if)S +2242(\(cmd\(1:3\))S +2782(.eq.)S +3052('col'\))S +3430(then)S +1620 V +2026(color)S +2350(=)S +2458(ival)S +1720 V +1810(else)S +2080(if)S +2242(\(cmd\(1:3\))S +2782(.eq.)S +3052('fil'\))S +3430(then)S +1820 V +2026(fill)S +2296(=)S +2404(ival)S +1920 V +9 I +2085(:)S +2020 V +2085(....and)S +2339(so)S +2446(on)S +2563(to)S +2660(set)S +2787(local)S +2994(variables)S +2120 V +2085(:)S +2220 V +9 R +1810(else)S +1977(if)S +2059(\(cmd\(1:3\))S +2446(.eq.)S +2604('pri'\))S +2821(then)S +2320 V +1260(C)S +9 I +1918(Print)S +2130(contents)S +2457(of)S +2554(the)S +2691(current)S +2983(frame)S +3220(bu)S +3310 H + (f)show 9 -.5 mul h (f)show +9 I +3356(er)S +2420 V +9 R +1918(call)S +9 B +2075(cfreadFrameBu)S +2685 H + (f)show 9 -.5 mul h (f)show +9 B +2740(er)S +9 R +2847(\(pix,)S +3042(nx,)S +3182(ny,)S +3322(ier\))S +2520 V +1918(call)S +9 B +2075(cfprintPix)S +9 R +2492(\("lpr",)S +2746(pix,)S +2911(nx,)S +3051(ny,)S +3191(1,)S +3286(ier\))S +2620 V +1810(else)S +1977(if)S +2059(\(cmd\(1:3\))S +2446(.eq.)S +2604('sta'\))S +2821(then)S +2720 V +9 I +2085(....print)S +2379(out)S +2521(the)S +2658(status)S +2895(\(value\))S +3177(of)S +3274(variables)S +2820 V +9 R +1810(endif)S +3020 V +1260(C)S +9 I +1643(Point)S +1865(Markers)S +3120 V +9 R +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('p'\))S +2399(then)S +3220 V +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(M_PLUS,)S +3379(color,)S +3614(ier\))S +3320 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('x'\))S +2399(then)S +3420 V +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(M_CROSS,)S +3444(color,)S +3679(ier\))S +3520 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('_'\))S +2399(then)S +3620 V +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(M_HBLINE,)S +3489(color,)S +3724(ier\))S +3720 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('o'\))S +2399(then)S +3820 V +1260(C)S +9 I +1810(Example)S +2152(of)S +2249(a)S +2321(\256lled)S +2528(point)S +2740(marker)S +3920 V +9 R +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(or\(M_CIRCLE,\256ll\),)S +3737(color,)S +3972(ier\))S +4020 V +9 I +2085(:)S +4120 V +2085(....and)S +2339(so)S +2446(on)S +2563(to)S +2660(set)S +2787(other)S +3004(types)S +3216(of)S +3313(point)S +3525(markers)S +4320 V +9 R +1260(C)S +9 I +1643(Other)S +1880(Markers)S +4420 V +9 R +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('b'\))S +2399(then)S +4520 V +1810(print)S +2007('\("Hit)S +2246(another)S +2543(key)S +2700(to)S +2797(de\256ne)S +3044(the)S +3181(box)S +3343(...."\)')S +4620 V +1810(call)S +9 B +1967(cfreadCursor)S +9 R +2514(\(0,)S +2639(rx,)S +2764(ry,)S +2889(key,)S +3069(ier\))S +4720 V +1810(x2)S +1927(=)S +2004(nint)S +2171(\(rx)S +2303(+)S +2380(0.5\))S +4820 V +1810(y2)S +1927(=)S +2004(nint)S +2171(\(ry)S +2303(+)S +2380(0.5\))S +4920 V +1810(call)S +9 B +1967(cfmarkBox)S +9 R +2424(\(x,)S +2549(y,)S +2644(x2,)S +2784(y2,)S +2924(\256ll,)S +3074(color,)S +3309(ier\))S +5020 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('d'\))S +2399(then)S +5120 V +1810(call)S +9 B +1967(cfdeleteMark)S +9 R +2509(\(x,)S +2634(y,)S +2729(ier\))S +5220 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('e'\))S +2394(then)S +5320 V +1810(call)S +9 B +1967(cfmarkEllipse)S +9 R +2534(\(x,)S +2659(y,)S +2754(xrad,)S +2964(yrad,)S +3174(angle,)S +3419(\256ll,)S +3569(color,)S +3804(ier\))S +5420 V +1584(else)S +1751(if)S +1833(\(key)S +2020(.eq.)S +2178('t'\))S +2320(then)S +5520 V +1692(print)S +1889('\("Text)S +2178(string:)S +2462(",)S +2549($\)')S +5620 V +1692(read)S +1874(\(*,'\(A64\)'\))S +2304(str)S +5720 V +1692(call)S +9 B +1849(cfmarkText)S +9 R +2331(\(x,)S +2456(y,)S +2551(str,)S +2691(txsize,)S +2951(angle,)S +3196(color,)S +3431(ier\))S +5820 V +9 I +2085(:)S +5920 V +2085(....and)S +2339(so)S +2446(on)S +2563(to)S +2660(set)S +2787(other)S +3004(types)S +3216(of)S +3313(markers)S +6120 V +9 R +1260(C)S +9 I +1643(Quit)S +6220 V +9 R +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('q'\))S +2399(then)S +6320 V +1810(goto)S +1997(998)S +6420 V +1643(endif)S +6620 V +1260(C)S +9 I +1535(Loop)S +1747(back)S +1944(until)S +2136(we)S +2263(want)S +2465(to)S +2562(quit)S +6720 V +9 R +1535(goto)S +1722(10)S +6820 V +1260(998)S +1535(continue)S +6920 V +1535(end)S +7920 V +EP +%%Page: 38 41 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +480 V +11 R +2936(- 38 -)S +840 V +11 B +900(15.)S +1104(SPP)S +1333(Interface)S +1790(Summary)S +996 V +11 R +1260(#include)S +1704(")S +11 B +1749(cdlspp.h)S +11 R +2147(")S +1296 V +11 B +1854(cdl_open)S +11 R +2442(\(imtdev,)S +2845(ier\))S +1416 V +11 B +1589(cdl_displayPix)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(bitpix,)S +3341(frame,)S +3656(fbcon\256g,)S +4083(zscale,)S +4410(ier\))S +1536 V +11 B +1533(cdl_readCursor)S +11 R +2442(\(sample,)S +2850(x,)S +2966(y,)S +3082(wcs,)S +3313(key,)S +3532(ier\))S +1656 V +11 B +1619(cdl_setCursor)S +11 R +2442(\(x,)S +2594(y,)S +2710(wcs,)S +2941(ier\))S +1776 V +11 B +1703(cdl_setWCS)S +11 R +2442(\(name,)S +2776(title,)S +3009(a,)S +3118(b,)S +3234(c,)S +3343(d,)S +3459(tx,)S +3606(ty,)S +3753(z1,)S +3917(z2,)S +4081(zt,)S +4221(ier\))S +1896 V +11 B +1691(cdl_getWCS)S +11 R +2442(\(name,)S +2776(title,)S +3009(a,)S +3118(b,)S +3234(c,)S +3343(d,)S +3459(tx,)S +3606(ty,)S +3753(z1,)S +3917(z2,)S +4081(zt,)S +4221(ier\))S +2016 V +11 B +1645(cdl_setFrame)S +11 R +2442(\(frame\))S +2136 V +11 B +1542(cdl_clearFrame)S +11 R +2442(\(ier\))S +2256 V +11 B +1856(cdl_close)S +11 R +2442(\(\))S +2496 V +11 B +1524(cdl_setMapping)S +11 R +2442(\(region,)S +2819(sx,sy,snx,sny,)S +3466(dx,dy,dnx,dny,)S +4161(ref,)S +4342(ier\))S +2616 V +11 B +1512(cdl_getMapping)S +11 R +2442(\(region,)S +2819(sx,sy,snx,sny,)S +3466(dx,dy,dnx,dny,)S +4161(ref,)S +4342(ier\))S +2736 V +11 B +1586(cdl_queryMap)S +11 R +2442(\(wcs,)S +2709(region,)S +3050(sx,sy,snx,sny,)S +3697(dx,dy,dnx,dny,)S +4392(objref,)S +4714(ier\))S +2976 V +11 B +1474(cdl_displayIRAF)S +11 R +2442(\(fname,)S +2812(band,)S +3086(frame,)S +3401(fbcon\256g,)S +3828(zscale,)S +4155(ier\))S +3096 V +11 B +1739(cdl_isIRAF)S +11 R +2442(\(fname,)S +2812(isiraf\))S +3216 V +11 B +1600(cdl_readIRAF)S +11 R +2442(\(fname,)S +2812(band,)S +3086(pix,)S +3288(nx,)S +3459(ny,)S +3630(bitpix,)S +3949(title,)S +4182(ier\))S +3456 V +11 B +1496(cdl_displayFITS)S +11 R +2442(\(fname,)S +2812(frame,)S +3127(fbcon\256g,)S +3554(zscale,)S +3881(ier\))S +3576 V +11 B +1761(cdl_isFITS)S +11 R +2442(\(fname,)S +2812(is\256ts\))S +3696 V +11 B +1622(cdl_readFITS)S +11 R +2442(\(fname,)S +2812(pix,)S +3014(nx,)S +3185(ny,)S +3356(bitpix,)S +3675(title,)S +3908(ier\))S +3936 V +11 B +1380(cdl_computeZscale)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(bitpix,)S +3341(z1,)S +3505(z2\))S +4056 V +11 B +1516(cdl_zscaleImage)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(bitpix,)S +3341(z1,)S +3505(z2\))S +4296 V +11 B +1689(cdl_printPix)S +11 R +2442(\(cmd,)S +2728(pix,)S +2930(nx,)S +3101(ny,)S +3272(annotate,)S +3704(ier\))S +4416 V +11 B +1383(cdl_printPixToFile)S +11 R +2442(\(fname,)S +2812(pix,)S +3014(nx,)S +3185(ny,)S +3356(annotate,)S +3788(ier\))S +4656 V +11 B +1576(cdl_readImage)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(ier\))S +4776 V +11 B +1260(cdl_readFrameBu)S +2114 H + (f)show 11 -.5 mul h (f)show +11 B +2181(er)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(ier\))S +4896 V +11 B +1373(cdl_readSubRaster)S +11 R +2442(\(lx,)S +2625(ly,)S +2772(nx,)S +2943(ny,)S +3114(pix,)S +3316(ier\))S +5016 V +11 B +1344(cdl_writeSubRaster)S +11 R +2442(\(lx,)S +2625(ly,)S +2772(nx,)S +2943(ny,)S +3114(pix,)S +3316(ier\))S +5256 V +11 B +1686(cdl_selectFB)S +11 R +2442(\(nx,)S +2649(ny,)S +2820(fb,)S +2972(w,)S +3112(h,)S +3228(nf,)S +3380(reset\))S +5376 V +11 B +1500(cdl_setFBCon\256g)S +11 R +2442(\(con\256gno\))S +5496 V +11 B +1488(cdl_getFBCon\256g)S +11 R +2442(\(con\256gno,)S +2924(w,)S +3064(h,)S +3180(nf\))S +5616 V +11 B +1424(cdl_lookupFBSize)S +11 R +2442(\(con\256gno,)S +2924(w,)S +3064(h,)S +3180(nf\))S +5856 V +11 B +1598(cdl_setZTrans)S +11 R +2442(\(ztrans\))S +5976 V +11 B +1636(cdl_setZScale)S +11 R +2442(\(z1,)S +2642(z2\))S +6096 V +11 B +1605(cdl_setSample)S +11 R +2442(\(nsample\))S +6216 V +11 B +1347(cdl_setSampleLines)S +11 R +2442(\(nlines\))S +6336 V +11 B +1540(cdl_setContrast)S +11 R +2442(\(contrast\))S +6456 V +11 B +1681(cdl_setName)S +11 R +2442(\(imname\))S +6576 V +11 B +1734(cdl_setTitle)S +11 R +2442(\(imtitle\))S +6816 V +11 B +1633(cdl_getFrame)S +11 R +2442(\(frame\))S +6936 V +11 B +1586(cdl_getZTrans)S +11 R +2442(\(ztrans\))S +7056 V +11 B +1624(cdl_getZScale)S +11 R +2442(\(z1,)S +2642(z2\))S +7176 V +11 B +1593(cdl_getSample)S +11 R +2442(\(nsample\))S +7296 V +11 B +1335(cdl_getSampleLines)S +11 R +2442(\(nlines\))S +7920 V +EP +%%Page: 39 42 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 39 -)S +840 V +11 B +1528(cdl_getContrast)S +11 R +2442(\(contrast\))S +960 V +11 B +1669(cdl_getName)S +11 R +2442(\(imname\))S +1080 V +11 B +1722(cdl_getTitle)S +11 R +2442(\(imtitle\))S +1320 V +11 B +1564(cdl_mapFrame)S +11 R +2442(\(frame,)S +2793(ier\))S +1440 V +11 B +1306(cdl_markCoordsFile)S +11 R +2442(\(fname,)S +2812(type,)S +3062(size,)S +3293(color,)S +3579(label,)S +3853(ier\))S +1560 V +11 B +1574(cdl_markPoint)S +11 R +2442(\(x,)S +2594(y,)S +2710(number,)S +3106(size,)S +3337(type,)S +3587(color,)S +3873(ier\))S +1680 V +11 B +1304(cdl_markPointLabel)S +11 R +2442(\(x,)S +2594(y,)S +2710(label,)S +2984(size,)S +3215(type,)S +3465(color,)S +3751(ier\))S +1800 V +11 B +1610(cdl_markLine)S +11 R +2442(\(xs,)S +2637(ys,)S +2796(xe,)S +2960(ye,)S +3124(color,)S +3410(ier\))S +1920 V +11 B +1641(cdl_markBox)S +11 R +2442(\(lx,)S +2625(ly,)S +2772(ux,)S +2943(uy,)S +3114(\256ll,)S +3299(color,)S +3585(ier\))S +2040 V +11 B +1445(cdl_markPolygon)S +11 R +2442(\(xarray,)S +2817(yarray,)S +3156(npts,)S +3401(\256ll,)S +3586(color,)S +3872(ier\))S +2160 V +11 B +1445(cdl_markPolyline)S +11 R +2442(\(xarray,)S +2817(yarray,)S +3156(npts,)S +3401(color,)S +3687(ier\))S +2280 V +11 B +1540(cdl_markCircle)S +11 R +2442(\(x,)S +2594(y,)S +2710(radius,)S +3039(\256ll,)S +3224(color,)S +3510(ier\))S +2400 V +11 B +1292(cdl_markCircAnnuli)S +11 R +2442(\(x,)S +2594(y,)S +2710(radius,)S +3039(nannuli,)S +3430(sep,)S +3637(color,)S +3923(ier\))S +2520 V +11 B +1505(cdl_markEllipse)S +11 R +2442(\(x,)S +2594(y,)S +2710(xrad,)S +2965(yrad,)S +3220(rotang,)S +3561(\256ll,)S +3746(color,)S +4032(ier\))S +2640 V +11 B +1269(cdl_markEllipAnnuli)S +11 R +2442(\(x,)S +2594(y,)S +2710(xrad,)S +2965(yrad,)S +3220(ang,)S +3439(nannuli,)S +3830(sep,)S +4037(color,)S +4323(ier\))S +2760 V +11 B +1612(cdl_markText)S +11 R +2442(\(x,)S +2594(y,)S +2710(str,)S +2881(size,)S +3112(angle,)S +3410(color,)S +3696(ier\))S +2880 V +11 B +1734(cdl_setFont)S +11 R +2442(\(font\))S +3000 V +11 B +1440(cdl_setTextWidth)S +11 R +2442(\(width\))S +3120 V +11 B +1438(cdl_setLineWidth)S +11 R +2442(\(width\))S +3240 V +11 B +1507(cdl_setLineStyle)S +11 R +2442(\(style\))S +3360 V +11 B +1540(cdl_deleteMark)S +11 R +2442(\(x,)S +2594(y,)S +2710(ier\))S +3480 V +11 B +1473(cdl_clearOverlay)S +11 R +2442(\(ier\))S +3600 V +11 B +1363(cdl_redrawOverlay)S +11 R +2442(\(ier\))S +3720 V +11 B +1648(cdl_setDebug)S +11 R +2442(\(level\))S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier Troff +%%Pages: 42 + \ No newline at end of file diff --git a/vendor/x11iraf/cdl/doc/greek.ps b/vendor/x11iraf/cdl/doc/greek.ps new file mode 100644 index 00000000..ab2728e0 --- /dev/null +++ b/vendor/x11iraf/cdl/doc/greek.ps @@ -0,0 +1,2521 @@ +%!PS +/devppi 300 def +/userppi 72 def +/pagewidth 8.5 def +/devpixtouser { userppi mul devppi div } def +/pagetolandscape 90 def +/setcoords { pagewidth userppi mul 0 translate + pagetolandscape rotate 1 devpixtouser 1 devpixtouser scale } def +/setjoins { 1 setlinejoin 1 setlinecap } def +erasepage initgraphics setcoords setjoins +/getpoint { + currentfile read pop 8#77 and 6 bitshift + currentfile read pop 8#77 and or + currentfile read pop 8#77 and 6 bitshift + currentfile read pop 8#77 and or + } def +/m { getpoint moveto } def +/d { getpoint lineto } def +02 setlinewidth +02 setlinewidth +m WCfG d WDfM d WDfA d WCfG d W@fK d V}fM d VyfM d VufK d VrfG d VpfC +d Voe} d Voes d Vpem d Vrej d Vuef d Vyed d V}ed d W@ef d WCef d WDed +d WDes m VsfG d VrfC d Vpe} d Vpes d Vrem d Vsej m VyfM d VvfK d VsfE +d Vre} d Vres d Vsek d Vvef d Vyed m WCeq d WCeh m WAes d WAeh d W@ef +m V}es d WHes m V?es d WAeq m W@es d WAeo m WFes d WDeo m WGes d WDeq +m VneV m W\e? d W\ed m W^e} d W^ef m WWe? d W`e? d W`ed m Wle{ d Wle} +d Wke} d Wkey d Wney d Wne} d Wle? d Wie? d Wee} d Waey d W`es m WWed +d Weed m WXe? d W\e} m WZe? d W\e{ m W\ef d WXed m W\eh d WZed m W`eh +d Waed m W`ef d Wced m WWeV m W|es d XNes d XNew d XLe{ d XKe} d XFe? +d XCe? d W~e} d Wzey d Wyes d Wyeo d Wzej d W~ef d XCed d XFed d XKef +d XNej m XLeu d XLew d XKe{ m W|ey d Wzeu d Wzem d W|ej m XKes d XKey +d XIe} d XFe? m XCe? d W?e} d W~e{ d W|eu d W|em d W~eh d W?ef d XCed +m WweV m X_es d Xqes d Xqew d Xpe{ d Xne} d Xie? d Xfe? d Xae} d X^ey +d X\es d X\eo d X^ej d Xaef d Xfed d Xied d Xnef d Xqej m Xpeu d Xpew +d Xne{ m X_ey d X^eu d X^em d X_ej m Xnes d Xney d Xle} d Xie? m Xfe? +d Xce} d Xae{ d X_eu d X_em d Xaeh d Xcef d Xfed m XZeV m YBfM d YBed +m YCfK d YCef m X}fM d YEfM d YEed m YRe} d YEek m YKes d YUed m YKeq +d YTed m YIeq d YRed m YNe? d YXe? m X}ed d YIed m YNed d YXed m X?fM +d YBfK m Y@fM d YBfI m YOe? d YRe} m YVe? d YRe} m YBef d X?ed m YBeh +d Y@ed m YEeh d YFed m YEef d YHed m YReh d YOed m YQeh d YVed m X}eV +m YefZ m YeeV m ZIfM d ZIed m ZJfK d ZJef m ZLfM d ZLed m ZDfM d Z]fM +d Z]fA m ZLey d ZUey m ZUfA d ZUeq m ZDed d ZQed m ZFfM d ZIfK m ZGfM +d ZIfI m ZNfM d ZLfI m ZOfM d ZLfK m ZUfM d Z]fK m ZYfM d Z]fI m ZZfM +d Z]fG m Z\fM d Z]fA m ZUfA d ZTey d ZUeq m ZUe} d ZRey d ZUeu m ZUe{ +d ZOey d ZUew m ZIef d ZFed m ZIeh d ZGed m ZLeh d ZNed m ZLef d ZOed +m ZDeV m Zte? d Zoe} d Zley d Zjes d Zjeo d Zlej d Zoef d Zted d Zwed +d Z|ef d Z?ej d [@eo d [@es d Z?ey d Z|e} d Zwe? d Zte? m Zmey d Zleu +d Zlem d Zmej m Z}ej d Z?em d Z?eu d Z}ey m Zte? d Zqe} d Zoe{ d Zmeu +d Zmem d Zoeh d Zqef d Zted m Zwed d Zzef d Z|eh d Z}em d Z}eu d Z|e{ +d Zze} d Zwe? m ZieV m [Re? d [Red m [Se} d [Sef m [Me? d [Te? d [Ted +m [Tew d [Ve{ d [We} d [Ze? d [^e? d [ae} d [ce{ d [deu d [ded m [ae{ +d [ceu d [cef m [^e? d [`e} d [aew d [aed m [Med d [Yed m []ed d [hed +m [Oe? d [Re} m [Pe? d [Re{ m [Ref d [Oed m [Reh d [Ped m [Teh d [Ved +m [Tef d [Wed m [aef d [^ed m [aeh d [`ed m [deh d [eed m [def d [ged +m [MeV m [|fI d [|em d [~eh d \@ef d \Ded d \Hed d \Lef d \Nej m [~fI +d [~ek d \@eh m [|fI d \@fM d \@ek d \Bef d \Ded m [we? d \He? m [weV +m \TfZ m \TeV m ]IfG d ]JfM d ]JfA d ]IfG d ]FfK d ]AfM d \|fM d \wfK +d \tfG d \tfA d \ve} d \{ey d ]Deu d ]Ges d ]Ieo d ]Iej d ]Gef m \vfA +d \we} d \{e{ d ]Dew d ]Geu d ]Ieq m \wfK d \vfG d \vfC d \we? d \{e} +d ]Dey d ]Ieu d ]Jeq d ]Jek d ]Ieh d ]Gef d ]Ced d \~ed d \yef d \vej +d \teo d \ted d \vej m \seV m ]\es d ]oes d ]oew d ]me{ d ]ke} d ]fe? +d ]ce? d ]^e} d ][ey d ]Yes d ]Yeo d ][ej d ]^ef d ]ced d ]fed d ]kef +d ]oej m ]meu d ]mew d ]ke{ m ]\ey d ][eu d ][em d ]\ej m ]kes d ]key +d ]je} d ]fe? m ]ce? d ]`e} d ]^e{ d ]\eu d ]\em d ]^eh d ]`ef d ]ced +m ]WeV m ^AfI d ^Aem d ^Beh d ^Eef d ^Ied d ^Led d ^Pef d ^Rej m ^BfI +d ^Bek d ^Eeh m ^AfI d ^EfM d ^Eek d ^Fef d ^Ied m ]{e? d ^Le? m ]{eV +m Fwcf d Fycd d Fwcb d Fvcd d Fvcf d Fwcj d Fycl d F~cn d GDcn d GIcl +d GJch d GJcb d GIc^ d GDc\ d F?c\ m GDcn d GGcl d GIch d GIcb d GGc^ +d GDc\ m GDc\ d GGcZ d GJcV d GLcS d GLcM d GJcI d GIcG d GDcE d F~cE +d FycG d FwcI d FvcM d FvcO d FwcQ d FycO d FwcM m GIcX d GJcS d GJcM +d GIcI d GGcG d GDcE m Ftbw m G\cf d G]cd d G\cb d GZcd d GZcf d G\cj +d G]cl d Gbcn d Gicn d Gmcl d Gocj d Gpcf d Gpcb d Goc^ d GjcZ d GbcV +d G_cU d G\cQ d GZcK d GZcE m Gicn d Glcl d Gmcj d Gocf d Gocb d Gmc^ +d GicZ d GbcV m GZcI d G\cK d G_cK d GgcG d GlcG d GocI d GpcK m G_cK +d GgcE d GmcE d GocG d GpcK d GpcO m GYbw m G}c{ m G}bw m H\c{ m H\bw +m FwbW d FybU d FwbS d FvbU d FvbW d Fwb[ d Fyb] d F~b^ d GDb^ d GIb] +d GJbY d GJbS d GIbO d GDbM d F?bM m GDb^ d GGb] d GIbY d GIbS d GGbO +d GDbM m GDbM d GGbK d GJbG d GLbC d GLa} d GJaz d GIax d GDav d F~av +d Fyax d Fwaz d Fva} d Fva? d FwbA d Fya? d Fwa} m GIbI d GJbC d GJa} +d GIaz d GGax d GDav m Ftah m G\bW d G]bU d G\bS d GZbU d GZbW d G\b[ +d G]b] d Gbb^ d Gib^ d Gmb] d GobY d GobS d GmbO d GibM d GdbM m Gib^ +d Glb] d GmbY d GmbS d GlbO d GibM m GibM d GlbK d GobG d GpbC d Gpa} +d Goaz d Gmax d Giav d Gbav d G]ax d G\az d GZa} d GZa? d G\bA d G]a? +d G\a} m GmbI d GobC d Goa} d Gmaz d Glax d Giav m GYah m G}bl m G}ah +m H\bl m H\ah m ICb^ d I@b[ d ICbC d IFb[ d ICb^ m ICb[ d ICbO m ICaz +d I@ax d ICav d IFax d ICaz m H{ah m FwaG d FyaE d FwaC d FvaE d FvaG +d FwaK d FyaM d F~aO d GDaO d GIaM d GJaI d GJaC d GIa@ d GD`~ d F?`~ +m GDaO d GGaM d GIaI d GIaC d GGa@ +stroke +m GGa@ d GD`~ m GD`~ d GG`| d GJ`x d GL`t d GL`n d GJ`j d GI`h d GD`f +d F~`f d Fy`h d Fw`j d Fv`n d Fv`p d Fw`r d Fy`p d Fw`n m GI`z d GJ`t +d GJ`n d GI`j d GG`h d GD`f m Ft`Y m GiaK d Gi`f m GjaO d Gj`f m GjaO +d GY`r d Gr`r m Gd`f d Go`f m GY`Y m G}a] m G}`Y m H\a] m H\`Y m ICaB +d I@a@ d IC`~ d IFa@ d ICaB m IC`f d I@`h d IC`j d IF`h d IF`d d IC`a +d I@`_ m H{`Y m Fw_x d Fy_v d Fw_t d Fv_v d Fv_x d Fw_| d Fy_~ d F~`@ +d GD`@ d GI_~ d GJ_z d GJ_t d GI_p d GD_n d F?_n m GD`@ d GG_~ d GI_z +d GI_t d GG_p d GD_n m GD_n d GG_l d GJ_i d GL_e d GL__ d GJ_[ d GI_Y +d GD_W d F~_W d Fy_Y d Fw_[ d Fv__ d Fv_a d Fw_c d Fy_a d Fw__ m GI_j +d GJ_e d GJ__ d GI_[ d GG_Y d GD_W m Ft_I m G]`@ d GZ_l m GZ_l d G]_p +d Gb_r d Gg_r d Gl_p d Go_l d Gp_g d Gp_c d Go_] d Gl_Y d Gg_W d Gb_W +d G]_Y d G\_[ d GZ__ d GZ_a d G\_c d G]_a d G\__ m Gg_r d Gj_p d Gm_l +d Go_g d Go_c d Gm_] d Gj_Y d Gg_W m G]`@ d Gm`@ m G]_~ d Ge_~ d Gm`@ +m GY_I m G}`M m G}_I m H\`M m H\_I m II`@ d H~_I m IR`@ d IG_I m H~_j +d IS_j m H}__ d IR__ m H{_I m Fw^i d Fy^g d Fw^e d Fv^g d Fv^i d Fw^m +d Fy^o d F~^p d GD^p d GI^o d GJ^k d GJ^e d GI^a d GD^_ d F?^_ m GD^p +d GG^o d GI^k d GI^e d GG^a d GD^_ m GD^_ d GG^] d GJ^Y d GL^U d GL^O +d GJ^K d GI^J d GD^H d F~^H d Fy^J d Fw^K d Fv^O d Fv^Q d Fw^S d Fy^Q +d Fw^O m GI^[ d GJ^U d GJ^O d GI^K d GG^J d GD^H m Ft]z m Gm^k d Gl^i +d Gm^g d Go^i d Go^k d Gm^o d Gj^p d Ge^p d Ga^o d G]^k d G\^g d GZ^_ +d GZ^S d G\^M d G_^J d Gd^H d Gg^H d Gl^J d Go^M d Gp^S d Gp^U d Go^[ +d Gl^_ d Gg^a d Ge^a d Ga^_ d G]^[ d G\^U m Ge^p d Gb^o d G_^k d G]^g +d G\^_ d G\^S d G]^M d Ga^J d Gd^H m Gg^H d Gj^J d Gm^M d Go^S d Go^U +d Gm^[ d Gj^_ d Gg^a m GY]z m G}^~ m G}]z m H\^~ m H\]z m IE^x d IE^@ +m IK^x d IK^@ m IQ^k d IP^i d IQ^g d IS^i d IS^k d IP^o d IK^p d IE^p +d I@^o d H}^k d H}^g d H~^c d I@^a d IC^_ d IL^[ d IP^Y d IS^U m H}^g +d I@^c d IC^a d IL^] d IP^[ d IQ^Y d IS^U d IS^M d IP^J d IK^H d IE^H +d I@^J d H}^M d H}^O d H~^Q d I@^O d H~^M m H{]z m Fw]Y d Fy]W d Fw]U +d Fv]W d Fv]Y d Fw]] d Fy]_ d F~]a d GD]a d GI]_ d GJ][ d GJ]U d GI]R +d GD]P d F?]P m GD]a d GG]_ d GI][ d GI]U d GG]R d GD]P m GD]P d GG]N +d GJ]J d GL]F d GL]@ d GJ\| d GI\z d GD\x d F~\x d Fy\z d Fw\| d Fv]@ +d Fv]B d Fw]D d Fy]B d Fw]@ m GI]L d GJ]F d GJ]@ d GI\| d GG\z d GD\x +m Ft\k m GZ]a d GZ]U m GZ]Y d G\]] d G_]a d Gb]a d Gj][ d Gm][ d Go]] +d Gp]a m G\]] d G_]_ d Gb]_ d Gj][ m Gp]a d Gp][ d Go]U d Gi]L d Gg]H +d Ge]B d Ge\x m Go]U d Gg]L d Ge]H d Gd]B d Gd\x m GY\k m G}]o m G}\k +m H\]o m H\\k m IU]a d H|\x m IC]a d IF]] d IF]Y d IE]U d IB]S d H?]S +d H|]W d H|][ d H~]_ d IA]a d IC]a d IF]_ d IJ]] d IN]] d IR]_ d IU]a +m IP]F d IM]D d IK]@ d IK\| d IN\x d IQ\x d IT\z d IU\~ d IU]B d IR]F +d IP]F m H{\k m Fw\J d Fy\H d Fw\F d Fv\H d Fv\J d Fw\N d Fy\P d F~\R +d GD\R d GI\P d GJ\L d GJ\F d GI\B d GD\@ d F?\@ m GD\R d GG\P d GI\L +d GI\F d GG\B d GD\@ m GD\@ d GG[~ d GJ[{ d GL[w d GL[q d GJ[m d GI[k +d GD[i d F~[i d Fy[k d Fw[m d Fv[q d Fv[s d Fw[u d Fy[s d Fw[q m GI[| +d GJ[w d GJ[q d GI[m d GG[k d GD[i m Ft[[ m Gb\R d G]\P d G\\L d G\\F +d G]\B d Gb\@ d Gi\@ d Gm\B d Go\F d Go\L d Gm\P d Gi\R d Gb\R m Gb\R +d G_\P d G]\L d G]\F d G_\B d Gb\@ m Gi\@ d Gl\B d Gm\F d Gm\L d Gl\P +d Gi\R m Gb\@ d G][~ d G\[| d GZ[y d GZ[q d G\[m d G][k d Gb[i d Gi[i +d Gm[k d Go[m d Gp[q d Gp[y d Go[| d Gm[~ d Gi\@ m Gb\@ d G_[~ d G][| +d G\[y d G\[q d G][m d G_[k d Gb[i m Gi[i d Gl[k d Gm[m d Go[q d Go[y +d Gm[| d Gl[~ d Gi\@ m GY[[ m G}\_ m G}[[ m H\\_ m H\[[ m IT\B d IS\@ +d IT[~ d IU\@ d IU\B d IT\D d IS\D d IR\B d IP[~ d IN[u d IK[o d IH[k +d IF[i d IB[i d H~[k d H|[o d H|[u d H~[y d IF\@ d IH\D d IJ\H d IJ\L +d IH\P d IF\R d IC\P d IB\L d IB\H d IC\B d IF[| d IL[o d IO[k d IS[i +d IT[i d IU[k d IU[m m IB[i d H?[k d H~[o d H~[u d H?[y d IB[| m IB\H +d IC\D d IN[o d IP[k d IS[i m H{[[ m FwZ{ d FyZy d FwZw d FvZy d FvZ{ +d FwZ? d Fy[A d F~[C d GD[C d GI[A d GJZ} d GJZw d GIZs d GDZq d F?Zq +m GD[C d GG[A d GIZ} d GIZw d GGZs d GDZq m GDZq d GGZo d GJZk d GLZg +d GLZa d GJZ^ d GIZ\ d GDZZ d F~ZZ d FyZ\ d FwZ^ d FvZa d FvZc d FwZe +d FyZc d FwZa m GIZm d GJZg d GJZa d GIZ^ d GGZ\ d GDZZ m FtZL m GoZu +d GmZo d GjZk d GeZi d GdZi d G_Zk d G\Zo d GZZu d GZZw d G\Z} d G_[A +d Gd[C d Gg[C d Gl[A d GoZ} d GpZw d GpZk d GoZc d GmZ` d GjZ\ d GeZZ +d GaZZ d G]Z\ d G\Z` d G\Za d G]Zc d G_Za d G]Z` m GdZi d GaZk d G]Zo +d G\Zu d G\Zw d G]Z} +stroke +m G]Z} d Ga[A d Gd[C m Gg[C d Gj[A d GmZ} d GoZw d GoZk d GmZc d GlZ` +d GiZ\ d GeZZ m GYZL m G}[P m G}ZL m H\[P m H\ZL m ICZ? d I@[A d IC[C +d IF[A d IFZ} d ICZy d I@Zw m H{ZL m GDYo d GDYJ m GEYs d GEYJ m GEYs +d FtYV d GMYV m F?YJ d GJYJ m FtX} m GdYs d G_Yq d G\Yk d GZYb d GZY\ +d G\YR d G_YL d GdYJ d GgYJ d GlYL d GoYR d GpY\ d GpYb d GoYk d GlYq +d GgYs d GdYs m GdYs d GaYq d G_Yo d G]Yk d G\Yb d G\Y\ d G]YR d G_YN +d GaYL d GdYJ m GgYJ d GjYL d GlYN d GmYR d GoY\ d GoYb d GmYk d GlYo +d GjYq d GgYs m GYX} m G}ZA m G}X} m H\ZA m H\X} m INY{ d IJYw d IEYq +d IAYi d H?Y` d H?YX d IAYN d IEYF d IJYA d INX} m IJYw d IEYo d ICYi +d IAY` d IAYX d ICYN d IEYH d IJYA m H{X} m GDX` d GDW{ m GEXd d GEW{ +m GEXd d FtXG d GMXG m F?W{ d GJW{ m FtWm m G_X\ d GbX^ d GgXd d GgW{ +m GeXb d GeW{ m G_W{ d GmW{ m GYWm m G}Xq m G}Wm m H\Xq m H\Wm m H}Xl +d IAXh d IEXb d IJXZ d ILXP d ILXI d IJW? d IEWw d IAWq d H}Wm m IAXh +d IEX` d IHXZ d IJXP d IJXI d IHW? d IEWy d IAWq m H{Wm m GDWQ d GDVl +m GEWT d GEVl m GEWT d FtVw d GMVw m F?Vl d GJVl m FtV^ m G\WM d G]WK +d G\WI d GZWK d GZWM d G\WQ d G]WS d GbWT d GiWT d GmWS d GoWQ d GpWM +d GpWI d GoWE d GjWA d GbV} d G_V{ d G\Vw d GZVq d GZVl m GiWT d GlWS +d GmWQ d GoWM d GoWI d GmWE d GiWA d GbV} m GZVp d G\Vq d G_Vq d GgVn +d GlVn d GoVp d GpVq m G_Vq d GgVl d GmVl d GoVn d GpVq d GpVu m GYV^ +m G}Wb m G}V^ m H\Wb m H\V^ m H~WK d ISVp m ISWK d H~Vp m H{V^ m GDVA +d GDU\ m GEVE d GEU\ m GEVE d FtUh d GMUh m F?U\ d GJU\ m FtUO m G\U} +d G]U{ d G\Uy d GZU{ d GZU} d G\VA d G]VC d GbVE d GiVE d GmVC d GoU? +d GoUy d GmUv d GiUt d GdUt m GiVE d GlVC d GmU? d GmUy d GlUv d GiUt +m GiUt d GlUr d GoUn d GpUj d GpUd d GoU` d GmU^ d GiU\ d GbU\ d G]U^ +d G\U` d GZUd d GZUf d G\Uh d G]Uf d G\Ud m GmUp d GoUj d GoUd d GmU` +d GlU^ d GiU\ m GYUO m G}VS m G}UO m H\VS m H\UO m IIU} d IIU\ m H~Un +d ITUn m H~U\ d ITU\ m H{UO m GDTr d GDTM m GETv d GETM m GETv d FtTY +d GMTY m F?TM d GJTM m FtS? m GiTr d GiTM m GjTv d GjTM m GjTv d GYTY +d GrTY m GdTM d GoTM m GYS? m G}UC m G}S? m H\UC m H\S? m ITTU d IRTU +d IOTW d ILT[ d IHTb d IGTd d IDTf d IBTf d H?Td d H~T` d H~T] d H?TY +d IBTW d IDTW d IGTY d IHT[ d ILTb d IOTf d IRTh d ITTh m H{S? m GDSc +d GDR~ m GESf d GER~ m GESf d FtSI d GMSI m F?R~ d GJR~ m FtRp m G]Sf +d GZSS m GZSS d G]SW d GbSY d GgSY d GlSW d GoSS d GpSM d GpSI d GoSC +d GlS@ d GgR~ d GbR~ d G]S@ d G\SB d GZSE d GZSG d G\SI d G]SG d G\SE +m GgSY d GjSW d GmSS d GoSM d GoSI d GmSC d GjS@ d GgR~ m G]Sf d GmSf +m G]Se d GeSe d GmSf m GYRp m G}St m G}Rp m H\St m H\Rp m IIS_ d IIR~ +m H~S_ d ITS_ m H~SO d ITSO m H{Rp m GDRS d GDQn m GERW d GEQn m GERW +d FtQz d GMQz m F?Qn d GJQn m FtQa m GmRQ d GlRO d GmRM d GoRO d GoRQ +d GmRU d GjRW d GeRW d GaRU d G]RQ d G\RM d GZRF d GZQz d G\Qt d G_Qp +d GdQn d GgQn d GlQp d GoQt d GpQz d GpQ| d GoRB d GlRF d GgRH d GeRH +d GaRF d G]RB d G\Q| m GeRW d GbRU d G_RQ d G]RM d G\RF d G\Qz d G]Qt +d GaQp d GdQn m GgQn d GjQp d GmQt d GoQz d GoQ| d GmRB d GjRF d GgRH +m GYQa m G}Re m G}Qa m H\Re m H\Qa m ICQr d I@Qp d ICQn d IFQp d ICQr +m H{Qa m GDQD d GDP_ m GEQH d GEP_ m GEQH d FtPk d GMPk m F?P_ d GJP_ +m FtPQ m GZQH d GZP| m GZQ@ d G\QD d G_QH d GbQH d GjQB d GmQB d GoQD +d GpQH m G\QD d G_QF d GbQF d GjQB m GpQH d GpQB d GoP| d GiPr d GgPo +d GePi d GeP_ m GoP| d GgPr d GePo d GdPi d GdP_ m GYPQ m G}QU m G}PQ +m H\QU m H\PQ m IIQB d IHQ@ d IIP~ d IJQ@ d IIQB m H~Pq d IUPq m IIPc +d IHPa d IIP_ d IJPa d IIPc m H{PQ m GDOu d GDOP m GEOy d GEOP m GEOy +d FtO[ d GMO[ m F?OP d GJOP m FtOB m GbOy d G]Ow d G\Os d G\Om d G]Oi +d GbOg d GiOg d GmOi d GoOm d GoOs d GmOw d GiOy d GbOy m GbOy d G_Ow +d G]Os d G]Om d G_Oi d GbOg m GiOg d GlOi d GmOm d GmOs d GlOw d GiOy +m GbOg d G]Oe d G\Oc d GZO_ d GZOW d G\OT d G]OR d GbOP d GiOP d GmOR +d GoOT d GpOW d GpO_ d GoOc d GmOe d GiOg m GbOg d G_Oe d G]Oc d G\O_ +d G\OW d G]OT d G_OR d GbOP m GiOP d GlOR d GmOT d GoOW d GoO_ d GmOc +d GlOe d GiOg m GYOB m G}PF m G}OB m H\PF m H\OB m IFOy d IAOw d H~Oq +d H}Og d H}Oa d H~OW d IAOR d IFOP d IIOP d INOR d IQOW d ISOa d ISOg +d IQOq d INOw d IIOy d IFOy m IFOy d ICOw d IAOu d I@Oq d H~Og d H~Oa +d I@OW d IAOT d ICOR d IFOP m IIOP d ILOR d INOT d IPOW d IQOa d IQOg +d IPOq d INOu d ILOw d IIOy m H{OB m GDNe d GDN@ m GENi d GEN@ m GENi +d FtNL d GMNL m F?N@ d GJN@ m FtMs m GoN[ d GmNV d GjNR d GeNP d GdNP +d G_NR d G\NV d GZN[ d GZN] d G\Nc d G_Ng d GdNi d GgNi d GlNg d GoNc +d GpN] d GpNR d GoNJ d GmNF d GjNB d GeN@ d GaN@ d G]NB d G\NF d G\NH +d G]NJ d G_NH d G]NF m GdNP d GaNR d G]NV d G\N[ d G\N] d G]Nc d GaNg +d GdNi m GgNi d GjNg d GmNc d GoN] d GoNR d GmNJ d GlNF d GiNB d GeN@ +m GYMs m G}Nw m G}Ms m H\Nw m H\Ms m IANa d IENc d IINi d IIN@ m IHNg +d IHN@ m IAN@ d IPN@ m H{Ms m FyMZ d FvMF m FvMF d FyMJ d F~ML d GBML +d GGMJ d GJMF d GLMA d GLL} d GJLw d GGLs d GBLq d F~Lq d FyLs d FwLu +d FvLy d FvL{ d FwL} d FyL{ d FwLy m GBML d GEMJ d GIMF d GJMA d GJL} +d GILw d GELs d GBLq m FyMZ d GIMZ m FyMX d GAMX d GIMZ m FtLc m GdMZ +d G_MX d G\MR +stroke +m G\MR d GZMH d GZMC d G\Ly d G_Ls d GdLq d GgLq d GlLs d GoLy d GpMC +d GpMH d GoMR d GlMX d GgMZ d GdMZ m GdMZ d GaMX d G_MV d G]MR d G\MH +d G\MC d G]Ly d G_Lu d GaLs d GdLq m GgLq d GjLs d GlLu d GmLy d GoMC +d GoMH d GmMR d GlMV d GjMX d GgMZ m GYLc m G}Mg m G}Lc m H\Mg m H\Lc +m H~MR d I@MP d H~MN d H}MP d H}MR d H~MV d I@MX d IEMZ d IKMZ d IPMX +d IQMV d ISMR d ISMN d IQMJ d ILMF d IEMC d IAMA d H~L} d H}Lw d H}Lq +m IKMZ d INMX d IPMV d IQMR d IQMN d IPMJ d IKMF d IEMC m H}Lu d H~Lw +d IALw d IILs d INLs d IQLu d ISLw m IALw d IILq d IPLq d IQLs d ISLw +d ISL{ m H{Lc m FyLK d FvKw m FvKw d FyK{ d F~K} d GBK} d GGK{ d GJKw +d GLKq d GLKm d GJKg d GGKd d GBKb d F~Kb d FyKd d FwKf d FvKi d FvKk +d FwKm d FyKk d FwKi m GBK} d GEK{ d GIKw d GJKq d GJKm d GIKg d GEKd +d GBKb m FyLK d GILK m FyLI d GALI d GILK m FtKT m G_LC d GbLE d GgLK +d GgKb m GeLI d GeKb m G_Kb d GmKb m GYKT m G}LX m G}KT m H\LX m H\KT +m H~LC d I@LA d H~K? d H}LA d H}LC d H~LG d I@LI d IELK d IKLK d IPLI +d IQLE d IQK? d IPK{ d IKKy d IFKy m IKLK d INLI d IPLE d IPK? d INK{ +d IKKy m IKKy d INKw d IQKs d ISKo d ISKi d IQKf d IPKd d IKKb d IEKb +d I@Kd d H~Kf d H}Ki d H}Kk d H~Km d I@Kk d H~Ki m IPKu d IQKo d IQKi +d IPKf d INKd d IKKb m H{KT m FyJ{ d FvJh m FvJh d FyJl d F~Jn d GBJn +d GGJl d GJJh d GLJb d GLJ^ d GJJX d GGJT d GBJR d F~JR d FyJT d FwJV +d FvJZ d FvJ\ d FwJ^ d FyJ\ d FwJZ m GBJn d GEJl d GIJh d GJJb d GJJ^ +d GIJX d GEJT d GBJR m FyJ{ d GIJ{ m FyJy d GAJy d GIJ{ m FtJE m G\Js +d G]Jq d G\Jo d GZJq d GZJs d G\Jw d G]Jy d GbJ{ d GiJ{ d GmJy d GoJw +d GpJs d GpJo d GoJl d GjJh d GbJd d G_Jb d G\J^ d GZJX d GZJR m GiJ{ +d GlJy d GmJw d GoJs d GoJo d GmJl d GiJh d GbJd m GZJV d G\JX d G_JX +d GgJT d GlJT d GoJV d GpJX m G_JX d GgJR d GmJR d GoJT d GpJX d GpJ\ +m GYJE m G}KI m G}JE m H\KI m H\JE m IKJw d IKJR m ILJ{ d ILJR m ILJ{ +d H{J^ d ITJ^ m IFJR d IQJR m H{JE m FyIl d FvIX m FvIX d FyI\ d F~I^ +d GBI^ d GGI\ d GJIX d GLIS d GLIO d GJII d GGIE d GBIC d F~IC d FyIE +d FwIG d FvIK d FvIM d FwIO d FyIM d FwIK m GBI^ d GEI\ d GIIX d GJIS +d GJIO d GIII d GEIE d GBIC m FyIl d GIIl m FyIj d GAIj d GIIl m FtHu +m G\Id d G]Ib d G\I` d GZIb d GZId d G\Ih d G]Ij d GbIl d GiIl d GmIj +d GoIf d GoI` d GmI\ d GiIZ d GdIZ m GiIl d GlIj d GmIf d GmI` d GlI\ +d GiIZ m GiIZ d GlIX d GoIT d GpIQ d GpIK d GoIG d GmIE d GiIC d GbIC +d G]IE d G\IG d GZIK d GZIM d G\IO d G]IM d G\IK m GmIV d GoIQ d GoIK +d GmIG d GlIE d GiIC m GYHu m G}Iy m G}Hu m H\Iy m H\Hu m I@Il d H}IX +m H}IX d I@I\ d IEI^ d III^ d INI\ d IQIX d ISIS d ISIO d IQII d INIE +d IIIC d IEIC d I@IE d H~IG d H}IK d H}IM d H~IO d I@IM d H~IK m III^ +d ILI\ d IPIX d IQIS d IQIO d IPII d ILIE d IIIC m I@Il d IPIl m I@Ij +d IHIj d IPIl m H{Hu m FyH\ d FvHI m FvHI d FyHM d F~HO d GBHO d GGHM +d GJHI d GLHC d GLG? d GJGy d GGGv d GBGt d F~Gt d FyGv d FwGx d FvG{ +d FvG} d FwG? d FyG} d FwG{ m GBHO d GEHM d GIHI d GJHC d GJG? d GIGy +d GEGv d GBGt m FyH\ d GIH\ m FyH[ d GAH[ d GIH\ m FtGf m GiHY d GiGt +m GjH\ d GjGt m GjH\ d GYG? d GrG? m GdGt d GoGt m GYGf m G}Hj m G}Gf +m H\Hj m H\Gf m IPHW d INHU d IPHS d IQHU d IQHW d IPH[ d ILH\ d IHH\ +d ICH[ d I@HW d H~HS d H}HK d H}G? d H~Gy d IAGv d IFGt d IIGt d INGv +d IQGy d ISG? d ISHA d IQHG d INHK d IIHM d IHHM d ICHK d I@HG d H~HA +m IHH\ d IEH[ d IAHW d I@HS d H~HK d H~G? d I@Gy d ICGv d IFGt m IIGt +d ILGv d IPGy d IQG? d IQHA d IPHG d ILHK d IIHM m H{Gf m FyGM d FvFz +m FvFz d FyF~ d F~G@ d GBG@ d GGF~ d GJFz d GLFt d GLFp d GJFj d GGFf +d GBFd d F~Fd d FyFf d FwFh d FvFl d FvFn d FwFp d FyFn d FwFl m GBG@ +d GEF~ d GIFz d GJFt d GJFp d GIFj d GEFf d GBFd m FyGM d GIGM m FyGK +d GAGK d GIGM m FtFW m G]GM d GZFz m GZFz d G]F~ d GbG@ d GgG@ d GlF~ +d GoFz d GpFt d GpFp d GoFj d GlFf d GgFd d GbFd d G]Ff d G\Fh d GZFl +d GZFn d G\Fp d G]Fn d G\Fl m GgG@ d GjF~ d GmFz d GoFt d GoFp d GmFj +d GjFf d GgFd m G]GM d GmGM m G]GK d GeGK d GmGM m GYFW m G}G[ m G}FW +m H\G[ m H\FW m H}GM d H}GA m H}GE d H~GI d IAGM d IEGM d ILGG d IPGG +d IQGI d ISGM m H~GI d IAGK d IEGK d ILGG m ISGM d ISGG d IQGA d IKFx +d IIFt d IHFn d IHFd m IQGA d IIFx d IHFt d IFFn d IFFd m H{FW m RTcn +d RQcZ m RQcZ d RTc^ d RYc` d R^c` d Rbc^ d RfcZ d RgcU d RgcQ d RfcK +d RbcG d R^cE d RYcE d RTcG d RRcI d RQcM d RQcO d RRcQ d RTcO d RRcM +m R^c` d Rac^ d RdcZ d RfcU d RfcQ d RdcK d RacG d R^cE m RTcn d Rdcn +m RTcl d R\cl d Rdcn m RObw m SIch d SGcf d SIcd d SJcf d SJch d SIcl +d SEcn d SAcn d R|cl d Rych d Rwcd d Rvc\ d RvcQ d RwcK d RzcG d R?cE +d SBcE d SGcG d SJcK d SLcQ +stroke +m SLcQ d SLcS d SJcX d SGc\ d SBc^ d SAc^ d R|c\ d RycX d RwcS m SAcn +d R~cl d Rzch d Rycd d Rwc\ d RwcQ d RycK d R|cG d R?cE m SBcE d SEcG +d SIcK d SJcQ d SJcS d SIcX d SEc\ d SBc^ m Rtbw m SYc{ m SYbw m Sxc{ +m Sxbw m T`cn d T[cl d TZch d TZcb d T[c^ d T`c\ d Tfc\ d Tkc^ d Tmcb +d Tmch d Tkcl d Tfcn d T`cn m T`cn d T]cl d T[ch d T[cb d T]c^ d T`c\ +m Tfc\ d Tic^ d Tkcb d Tkch d Ticl d Tfcn m T`c\ d T[cZ d TZcX d TXcU +d TXcM d TZcI d T[cG d T`cE d TfcE d TkcG d TmcI d TncM d TncU d TmcX +d TkcZ d Tfc\ m T`c\ d T]cZ d T[cX d TZcU d TZcM d T[cI d T]cG d T`cE +m TfcE d TicG d TkcI d TmcM d TmcU d TkcX d TicZ d Tfc\ m TVbw m RTb^ +d RQbK m RQbK d RTbO d RYbQ d R^bQ d RbbO d RfbK d RgbE d RgbA d Rfa{ +d Rbax d R^av d RYav d RTax d RRaz d RQa} d RQa? d RRbA d RTa? d RRa} +m R^bQ d RabO d RdbK d RfbE d RfbA d Rda{ d Raax d R^av m RTb^ d Rdb^ +m RTb] d R\b] d Rdb^ m ROah m Rvb^ d RvbS m RvbW d Rwb[ d Rzb^ d R~b^ +d SEbY d SIbY d SJb[ d SLb^ m Rwb[ d Rzb] d R~b] d SEbY m SLb^ d SLbY +d SJbS d SDbI d SBbE d SAa? d SAav m SJbS d SBbI d SAbE d R?a? d R?av +m Rtah m SYbl m SYah m Sxbl m Sxah m TmbQ d TkbK d ThbG d TcbE d TbbE +d T]bG d TZbK d TXbQ d TXbS d TZbY d T]b] d Tbb^ d Teb^ d Tib] d TmbY +d TnbS d TnbG d Tma? d Tka{ d Thax d Tcav d T^av d T[ax d TZa{ d TZa} +d T[a? d T]a} d T[a{ m TbbE d T^bG d T[bK d TZbQ d TZbS d T[bY d T^b] +d Tbb^ m Teb^ d Thb] d TkbY d TmbS d TmbG d Tka? d Tia{ d Tfax d Tcav +m TVah m RTaO d RQ`| m RQ`| d RTa@ d RYaB d R^aB d Rba@ d Rf`| d Rg`v +d Rg`r d Rf`l d Rb`h d R^`f d RY`f d RT`h d RR`j d RQ`n d RQ`p d RR`r +d RT`p d RR`n m R^aB d Raa@ d Rd`| d Rf`v d Rf`r d Rd`l d Ra`h d R^`f +m RTaO d RdaO m RTaM d R\aM d RdaO m RO`Y m R~aO d RyaM d RwaI d RwaC +d Rya@ d R~`~ d SD`~ d SIa@ d SJaC d SJaI d SIaM d SDaO d R~aO m R~aO +d RzaM d RyaI d RyaC d Rza@ d R~`~ m SD`~ d SGa@ d SIaC d SIaI d SGaM +d SDaO m R~`~ d Ry`| d Rw`z d Rv`v d Rv`n d Rw`j d Ry`h d R~`f d SD`f +d SI`h d SJ`j d SL`n d SL`v d SJ`z d SI`| d SD`~ m R~`~ d Rz`| d Ry`z +d Rw`v d Rw`n d Ry`j d Rz`h d R~`f m SD`f d SG`h d SI`j d SJ`n d SJ`v +d SI`z d SG`| d SD`~ m Rt`Y m SYa] m SY`Y m Sxa] m Sx`Y m TpaU d ToaS +d TpaQ d TraS d TraU d TpaW d TnaW d TkaU d ThaQ d TgaM d TeaG d Tda@ +d Ta`h d T``a d T_`] m TjaS d ThaO d TgaG d Td`p d Tc`h d Ta`b d T``_ +d T]`[ d T[`Y d TX`Y d TV`[ d TV`] d TX`_ d TY`] d TX`[ m TV`Y m RT`@ +d RQ_l m RQ_l d RT_p d RY_r d R^_r d Rb_p d Rf_l d Rg_g d Rg_c d Rf_] +d Rb_Y d R^_W d RY_W d RT_Y d RR_[ d RQ__ d RQ_a d RR_c d RT_a d RR__ +m R^_r d Ra_p d Rd_l d Rf_g d Rf_c d Rd_] d Ra_Y d R^_W m RT`@ d Rd`@ +m RT_~ d R\_~ d Rd`@ m RO_I m SJ_r d SI_l d SE_i d SA_g d R?_g d Rz_i +d Rw_l d Rv_r d Rv_t d Rw_z d Rz_~ d R?`@ d SB`@ d SG_~ d SJ_z d SL_t +d SL_i d SJ_a d SI_] d SE_Y d SA_W d R|_W d Ry_Y d Rw_] d Rw__ d Ry_a +d Rz__ d Ry_] m R?_g d R|_i d Ry_l d Rw_r d Rw_t d Ry_z d R|_~ d R?`@ +m SB`@ d SE_~ d SI_z d SJ_t d SJ_i d SI_a d SG_] d SD_Y d SA_W m Rt_I +m SY`M m SY_I m Sx`M m Sx_I m T^_r d T\_p d T^_n d Ta_p d T^_r m T^_W +d T\_Y d T^_[ d Ta_Y d Ta_U d T^_Q d T\_O m TV_I m Rd^k d Rb^i d Rd^g +d Rf^i d Rf^k d Rd^o d Ra^p d R\^p d RW^o d RT^k d RR^g d RQ^_ d RQ^S +d RR^M d RV^J d RZ^H d R^^H d Rb^J d Rf^M d Rg^S d Rg^U d Rf^[ d Rb^_ +d R^^a d R\^a d RW^_ d RT^[ d RR^U m R\^p d RY^o d RV^k d RT^g d RR^_ +d RR^S d RT^M d RW^J d RZ^H m R^^H d Ra^J d Rd^M d Rf^S d Rf^U d Rd^[ +d Ra^_ d R^^a m RO]z m R?^p d Rz^o d Rw^i d Rv^_ d Rv^Y d Rw^O d Rz^J +d R?^H d SB^H d SG^J d SJ^O d SL^Y d SL^_ d SJ^i d SG^o d SB^p d R?^p +m R?^p d R|^o d Rz^m d Ry^i d Rw^_ d Rw^Y d Ry^O d Rz^K d R|^J d R?^H +m SB^H d SE^J d SG^K d SI^O d SJ^Y d SJ^_ d SI^i d SG^m d SE^o d SB^p +m Rt]z m SY^~ m SY]z m Sx^~ m Sx]z m To^p d TY^c d To^U m TY^Q d To^Q +m TY^H d To^H m TV]z m Rd][ d Rb]Y d Rd]W d Rf]Y d Rf][ d Rd]_ d Ra]a +d R\]a d RW]_ d RT][ d RR]W d RQ]P d RQ]D d RR\~ d RV\z d RZ\x d R^\x +d Rb\z d Rf\~ d Rg]D d Rg]F d Rf]L d Rb]P d R^]R d R\]R d RW]P d RT]L +d RR]F m R\]a d RY]_ d RV][ d RT]W d RR]P d RR]D d RT\~ d RW\z d RZ\x +m R^\x d Ra\z d Rd\~ d Rf]D d Rf]F d Rd]L d Ra]P d R^]R m RO\k m Rz]Y +d R~][ d SB]a d SB\x m SA]_ d SA\x m Rz\x d SI\x m Rt\k m SY]o m SY\k +m Sx]o m Sx\k m TY]S d Tp]S m TY]J d Tp]J m TY]@ d Tp]@ m TV\k m Rd\L +d Rb\J d Rd\H d Rf\J d Rf\L d Rd\P d Ra\R d R\\R d RW\P d RT\L d RR\H +d RQ\@ d RQ[u d RR[o d RV[k d RZ[i d R^[i d Rb[k d Rf[o d Rg[u d Rg[w +d Rf[| d Rb\@ d R^\B d R\\B d RW\@ d RT[| d RR[w m R\\R d RY\P +stroke +m RY\P d RV\L d RT\H d RR\@ d RR[u d RT[o d RW[k d RZ[i m R^[i d Ra[k +d Rd[o d Rf[u d Rf[w d Rd[| d Ra\@ d R^\B m RO[[ m Rw\J d Ry\H d Rw\F +d Rv\H d Rv\J d Rw\N d Ry\P d R~\R d SD\R d SI\P d SJ\N d SL\J d SL\F +d SJ\B d SE[~ d R~[{ d Rz[y d Rw[u d Rv[o d Rv[i m SD\R d SG\P d SI\N +d SJ\J d SJ\F d SI\B d SD[~ d R~[{ m Rv[m d Rw[o d Rz[o d SB[k d SG[k +d SJ[m d SL[o m Rz[o d SB[i d SI[i d SJ[k d SL[o d SL[s m Rt[[ m SY\_ +m SY[[ m Sx\_ m Sx[[ m TY\R d To\D d TY[w m TY[s d To[s m TY[i d To[i +m TV[[ m RdZ} d RbZ{ d RdZy d RfZ{ d RfZ} d Rd[A d Ra[C d R\[C d RW[A +d RTZ} d RRZy d RQZq d RQZe d RRZ` d RVZ\ d RZZZ d R^ZZ d RbZ\ d RfZ` +d RgZe d RgZg d RfZm d RbZq d R^Zs d R\Zs d RWZq d RTZm d RRZg m R\[C +d RY[A d RVZ} d RTZy d RRZq d RRZe d RTZ` d RWZ\ d RZZZ m R^ZZ d RaZ\ +d RdZ` d RfZe d RfZg d RdZm d RaZq d R^Zs m ROZL m RwZ{ d RyZy d RwZw +d RvZy d RvZ{ d RwZ? d Ry[A d R~[C d SD[C d SI[A d SJZ} d SJZw d SIZs +d SDZq d R?Zq m SD[C d SG[A d SIZ} d SIZw d SGZs d SDZq m SDZq d SGZo +d SJZk d SLZg d SLZa d SJZ^ d SIZ\ d SDZZ d R~ZZ d RyZ\ d RwZ^ d RvZa +d RvZc d RwZe d RyZc d RwZa m SIZm d SJZg d SJZa d SIZ^ d SGZ\ d SDZZ +m RtZL m SY[P m SYZL m Sx[P m SxZL m TmZ} d T[ZZ m TYZq d TpZq m TYZe +d TpZe m TVZL m RdYm d RbYk d RdYi d RfYk d RfYm d RdYq d RaYs d R\Ys +d RWYq d RTYm d RRYi d RQYb d RQYV d RRYP d RVYL d RZYJ d R^YJ d RbYL +d RfYP d RgYV d RgYX d RfY^ d RbYb d R^Yd d R\Yd d RWYb d RTY^ d RRYX +m R\Ys d RYYq d RVYm d RTYi d RRYb d RRYV d RTYP d RWYL d RZYJ m R^YJ +d RaYL d RdYP d RfYV d RfYX d RdY^ d RaYb d R^Yd m ROX} m SDYo d SDYJ +m SEYs d SEYJ m SEYs d RtYV d SMYV m R?YJ d SJYJ m RtX} m SYZA m SYX} +m SxZA m SxX} m TjYd d TiYg d TgYi d TcYi d T`Yg d T_Ye d T^Y` d T^YZ +d T_YV d TbYT d TeYT d ThYV d TiYZ m TcYi d T`Ye d T_Y` d T_YZ d T`YV +d TbYT m TjYi d TiYZ d TiYV d TlYT d TnYT d TpYX d TrY^ d TrYb d TpYg +d ToYk d TmYo d TjYq d TgYs d TcYs d T_Yq d T]Yo d TZYk d TYYg d TXYb +d TXY\ d TYYV d TZYR d T]YN d T_YL d TcYJ d TgYJ d TjYL d TmYN d TnYP +m TlYi d TjYZ d TjYV d TlYT m TVX} m RdX^ d RbX\ d RdXZ d RfX\ d RfX^ +d RdXb d RaXd d R\Xd d RWXb d RTX^ d RRXZ d RQXR d RQXG d RRXA d RVW} +d RZW{ d R^W{ d RbW} d RfXA d RgXG d RgXI d RfXN d RbXR d R^XT d R\XT +d RWXR d RTXN d RRXI m R\Xd d RYXb d RVX^ d RTXZ d RRXR d RRXG d RTXA +d RWW} d RZW{ m R^W{ d RaW} d RdXA d RfXG d RfXI d RdXN d RaXR d R^XT +m ROWm m RyXd d RvXP m RvXP d RyXT d R~XV d SBXV d SGXT d SJXP d SLXK +d SLXG d SJXA d SGW} d SBW{ d R~W{ d RyW} d RwW? d RvXC d RvXE d RwXG +d RyXE d RwXC m SBXV d SEXT d SIXP d SJXK d SJXG d SIXA d SEW} d SBW{ +m RyXd d SIXd m RyXb d SAXb d SIXd m RtWm m SYXq m SYWm m SxXq m SxWm +m TbX^ d TXW{ m TeX^ d TnW{ m TcX^ d TmW{ m T[XG d TiXG m TVW{ d T^W{ +m ThW{ d TqW{ m TbXl d T^Xj d T]Xf d T]Xb d T^X^ d TbX\ d TeX\ d ThX^ +d TiXb d TiXf d ThXj d TeXl d TbXl m TVWm m RdWO d RbWM d RdWK d RfWM +d RfWO d RdWS d RaWT d R\WT d RWWS d RTWO d RRWK d RQWC d RQVw d RRVq +d RVVn d RZVl d R^Vl d RbVn d RfVq d RgVw d RgVy d RfV? d RbWC d R^WE +d R\WE d RWWC d RTV? d RRVy m R\WT d RYWS d RVWO d RTWK d RRWC d RRVw +d RTVq d RWVn d RZVl m R^Vl d RaVn d RdVq d RfVw d RfVy d RdV? d RaWC +d R^WE m ROV^ m SIWO d SGWM d SIWK d SJWM d SJWO d SIWS d SEWT d SAWT +d R|WS d RyWO d RwWK d RvWC d RvVw d RwVq d RzVn d R?Vl d SBVl d SGVn +d SJVq d SLVw d SLVy d SJV? d SGWC d SBWE d SAWE d R|WC d RyV? d RwVy +m SAWT d R~WS d RzWO d RyWK d RwWC d RwVw d RyVq d R|Vn d R?Vl m SBVl +d SEVn d SIVq d SJVw d SJVy d SIV? d SEWC d SBWE m RtV^ m SYWb m SYV^ +m SxWb m SxV^ m TqV{ d TpVw d TmVu d TjVu d ThVw d TfVy d TbWA d TaWC +d T^WE d T\WE d TYWC d TXV? d TXV{ d TYVw d T\Vu d T^Vu d TaVw d TbVy +d TfWA d ThWC d TjWE d TmWE d TpWC d TqV? d TqV{ m TVV^ m RdU? d RbU} +d RdU{ d RfU} d RfU? d RdVC d RaVE d R\VE d RWVC d RTU? d RRU{ d RQUt +d RQUh d RRUb d RVU^ d RZU\ d R^U\ d RbU^ d RfUb d RgUh d RgUj d RfUp +d RbUt d R^Uv d R\Uv d RWUt d RTUp d RRUj m R\VE d RYVC d RVU? d RTU{ +d RRUt d RRUh d RTUb d RWU^ d RZU\ m R^U\ d RaU^ d RdUb d RfUh d RfUj +d RdUp d RaUt d R^Uv m ROUO m RvVE d RvUy m RvU} d RwVA d RzVE d R~VE +d SEU? d SIU? d SJVA d SLVE m RwVA d RzVC d R~VC d SEU? m SLVE d SLU? +d SJUy d SDUp d SBUl d SAUf d SAU\ m SJUy d SBUp d SAUl d R?Uf d R?U\ +m RtUO m SYVS m SYUO m SxVS m SxUO m TVVS m TVUO m RdTp d RbTn d RdTl +d RfTn d RfTp d RdTt d RaTv d R\Tv d RWTt d RTTp d RRTl d RQTd d RQTY +d RRTS d RVTO d RZTM d R^TM d RbTO d RfTS d RgTY +stroke +m RgTY d RgT[ d RfT` d RbTd d R^Tf d R\Tf d RWTd d RTT` d RRT[ m R\Tv +d RYTt d RVTp d RTTl d RRTd d RRTY d RTTS d RWTO d RZTM m R^TM d RaTO +d RdTS d RfTY d RfT[ d RdT` d RaTd d R^Tf m ROS? m R~Tv d RyTt d RwTp +d RwTj d RyTf d R~Td d SDTd d SITf d SJTj d SJTp d SITt d SDTv d R~Tv +m R~Tv d RzTt d RyTp d RyTj d RzTf d R~Td m SDTd d SGTf d SITj d SITp +d SGTt d SDTv m R~Td d RyTb d RwT` d RvT] d RvTU d RwTQ d RyTO d R~TM +d SDTM d SITO d SJTQ d SLTU d SLT] d SJT` d SITb d SDTd m R~Td d RzTb +d RyT` d RwT] d RwTU d RyTQ d RzTO d R~TM m SDTM d SGTO d SITQ d SJTU +d SJT] d SIT` d SGTb d SDTd m RtS? m SYUC m SYS? m SxUC m SxS? m TcTv +d TVTM m TcTv d TpTM m TcTp d TnTM m TXTO d TnTO m TVTM d TpTM m TVS? +m RdSa d RbS_ d RdS] d RfS_ d RfSa d RdSe d RaSf d R\Sf d RWSe d RTSa +d RRS] d RQSU d RQSI d RRSC d RVS@ d RZR~ d R^R~ d RbS@ d RfSC d RgSI +d RgSK d RfSQ d RbSU d R^SW d R\SW d RWSU d RTSQ d RRSK m R\Sf d RYSe +d RVSa d RTS] d RRSU d RRSI d RTSC d RWS@ d RZR~ m R^R~ d RaS@ d RdSC +d RfSI d RfSK d RdSQ d RaSU d R^SW m RORp m SJSY d SISS d SESO d SASM +d R?SM d RzSO d RwSS d RvSY d RvS[ d RwSa d RzSe d R?Sf d SBSf d SGSe +d SJSa d SLS[ d SLSO d SJSG d SISC d SES@ d SAR~ d R|R~ d RyS@ d RwSC +d RwSE d RySG d RzSE d RySC m R?SM d R|SO d RySS d RwSY d RwS[ d RySa +d R|Se d R?Sf m SBSf d SESe d SISa d SJS[ d SJSO d SISG d SGSC d SDS@ +d SAR~ m RtRp m SYSt m SYRp m SxSt m SxRp m ToS_ d TeS_ d T`S] d T]S[ +d T[SW d TYSQ d TYSM d T[SG d T]SC d T`SB d TeS@ d ToS@ m TYSO d TjSO +m TVRp m RQRW d RQRK m RQRO d RRRS d RVRW d RYRW d RaRQ d RdRQ d RfRS +d RgRW m RRRS d RVRU d RYRU d RaRQ m RgRW d RgRQ d RfRK d R_RB d R^Q~ +d R\Qx d R\Qn m RfRK d R^RB d R\Q~ d RZQx d RZQn m ROQa m R?RW d RzRU +d RwRO d RvRF d RvR@ d RwQv d RzQp d R?Qn d SBQn d SGQp d SJQv d SLR@ +d SLRF d SJRO d SGRU d SBRW d R?RW m R?RW d R|RU d RzRS d RyRO d RwRF +d RwR@ d RyQv d RzQr d R|Qp d R?Qn m SBQn d SEQp d SGQr d SIQv d SJR@ +d SJRF d SIRO d SGRS d SERU d SBRW m RtQa m SYRe m SYQa m SxRe m SxQa +m TcRW d TcQn m TdRW d TdQn m T`RM d T[RK d TYRJ d TXRF d TXR@ d TYQ| +d T[Qz d T`Qx d TgQx d TlQz d TmQ| d ToR@ d ToRF d TmRJ d TlRK d TgRM +d T`RM m T`RM d T\RK d T[RJ d TYRF d TYR@ d T[Q| d T\Qz d T`Qx m TgQx +d TjQz d TlQ| d TmR@ d TmRF d TlRJ d TjRK d TgRM m T^RW d TiRW m T^Qn +d TiQn m TVQa m RQQH d RQP| m RQQ@ d RRQD d RVQH d RYQH d RaQB d RdQB +d RfQD d RgQH m RRQD d RVQF d RYQF d RaQB m RgQH d RgQB d RfP| d R_Pr +d R^Po d R\Pi d R\P_ m RfP| d R^Pr d R\Po d RZPi d RZP_ m ROPQ m RzQ@ +d R~QB d SBQH d SBP_ m SAQF d SAP_ m RzP_ d SIP_ m RtPQ m SYQU m SYPQ +m SxQU m SxPQ m T\QH d T\P_ m T]QH d T]P_ m TVQH d TpQH d TpP| d ToQH +m TVP_ d TbP_ m TVPQ m RQOy d RQOm m RQOq d RROu d RVOy d RYOy d RaOs +d RdOs d RfOu d RgOy m RROu d RVOw d RYOw d RaOs m RgOy d RgOs d RfOm +d R_Oc d R^O_ d R\OY d R\OP m RfOm d R^Oc d R\O_ d RZOY d RZOP m ROOB +m RwOq d RyOo d RwOm d RvOo d RvOq d RwOu d RyOw d R~Oy d SDOy d SIOw +d SJOu d SLOq d SLOm d SJOi d SEOe d R~Oa d RzO_ d RwO[ d RvOV d RvOP +m SDOy d SGOw d SIOu d SJOq d SJOm d SIOi d SDOe d R~Oa m RvOT d RwOV +d RzOV d SBOR d SGOR d SJOT d SLOV m RzOV d SBOP d SIOP d SJOR d SLOV +d SLOY m RtOB m SYPF m SYOB m SxPF m SxOB m TdP@ d TYOB m TmP@ d TcOB +m TYOg d ToOg m TXO[ d TmO[ m TVOB m RQNi d RQN] m RQNa d RRNe d RVNi +d RYNi d RaNc d RdNc d RfNe d RgNi m RRNe d RVNg d RYNg d RaNc m RgNi +d RgNc d RfN] d R_NT d R^NP d R\NJ d R\N@ m RfN] d R^NT d R\NP d RZNJ +d RZN@ m ROMs m RwNa d RyN_ d RwN] d RvN_ d RvNa d RwNe d RyNg d R~Ni +d SDNi d SINg d SJNc d SJN] d SINZ d SDNX d R?NX m SDNi d SGNg d SINc +d SIN] d SGNZ d SDNX m SDNX d SGNV d SJNR d SLNN d SLNH d SJND d SINB +d SDN@ d R~N@ d RyNB d RwND d RvNH d RvNJ d RwNL d RyNJ d RwNH m SINT +d SJNN d SJNH d SIND d SGNB d SDN@ m RtMs m SYNw m SYMs m SxNw m SxMs +m T[Nq d T[Ms m TgNq d TgMs m TVMs m RQMZ d RQMN m RQMR d RRMV d RVMZ +d RYMZ d RaMT d RdMT d RfMV d RgMZ m RRMV d RVMX d RYMX d RaMT m RgMZ +d RgMT d RfMN d R_MD d R^MA d R\L{ d R\Lq m RfMN d R^MD d R\MA d RZL{ +d RZLq m ROLc m SDMV d SDLq m SEMZ d SELq m SEMZ d RtL} d SML} m R?Lq +d SJLq m RtLc m SYMg m SYLc m SxMg m SxLc m TVMZ d TcLq m TXMZ d TcLu +m TpMZ d TcLq m TVMZ d TpMZ m TXMX d TnMX m TVLc m RQLK d RQK? m RQLC +d RRLG d RVLK d RYLK d RaLE d RdLE d RfLG d RgLK m RRLG d RVLI d RYLI +d RaLE m RgLK d RgLE d RfK? d R_Ku d R^Kq d R\Kk d R\Kb m RfK? d R^Ku +d R\Kq d RZKk d RZKb m ROKT m RyLK d RvKw m RvKw d RyK{ d R~K} d SBK} +d SGK{ d SJKw d SLKq d SLKm d SJKg d SGKd d SBKb d R~Kb d RyKd d RwKf +d RvKi d RvKk d RwKm d RyKk d RwKi m SBK} d SEK{ d SIKw d SJKq d SJKm +d SIKg d SEKd d SBKb m RyLK d SILK m RyLI d SALI d SILK m RtKT m SYLX +m SYKT m SxLX m SxKT m TVLX m TVKT m RQJ{ d RQJo m RQJs d RRJw d RVJ{ +d RYJ{ d RaJu d RdJu d RfJw d RgJ{ m RRJw d RVJy d RYJy d RaJu m RgJ{ +d RgJu +stroke +m RgJu d RfJo d R_Jf d R^Jb d R\J\ d R\JR m RfJo d R^Jf d R\Jb d RZJ\ +d RZJR m ROJE m SIJu d SGJs d SIJq d SJJs d SJJu d SIJy d SEJ{ d SAJ{ +d R|Jy d RyJu d RwJq d RvJj d RvJ^ d RwJX d RzJT d R?JR d SBJR d SGJT +d SJJX d SLJ^ d SLJ` d SJJf d SGJj d SBJl d SAJl d R|Jj d RyJf d RwJ` +m SAJ{ d R~Jy d RzJu d RyJq d RwJj d RwJ^ d RyJX d R|JT d R?JR m SBJR +d SEJT d SIJX d SJJ^ d SJJ` d SIJf d SEJj d SBJl m RtJE m SYKI m SYJE +m SxKI m SxJE m TcJ{ d TXJR m TcJ{ d TnJR m TcJu d TmJR m TVJR d T^JR +m ThJR d TqJR m TVJE m RQIl d RQI` m RQId d RRIh d RVIl d RYIl d RaIf +d RdIf d RfIh d RgIl m RRIh d RVIj d RYIj d RaIf m RgIl d RgIf d RfI` +d R_IV d R^IS d R\IM d R\IC m RfI` d R^IV d R\IS d RZIM d RZIC m ROHu +m RvIl d RvI` m RvId d RwIh d RzIl d R~Il d SEIf d SIIf d SJIh d SLIl +m RwIh d RzIj d R~Ij d SEIf m SLIl d SLIf d SJI` d SDIV d SBIS d SAIM +d SAIC m SJI` d SBIV d SAIS d R?IM d R?IC m RtHu m SYIy m SYHu m SxIy +m SxHu m T^I` d TbIf d TeI` m TXIZ d TbId d TkIZ m TbId d TbIC m TVHu +m RQH\ d RQHQ m RQHU d RRHY d RVH\ d RYH\ d RaHW d RdHW d RfHY d RgH\ +m RRHY d RVH[ d RYH[ d RaHW m RgH\ d RgHW d RfHQ d R_HG d R^HC d R\G} +d R\Gt m RfHQ d R^HG d R\HC d RZG} d RZGt m ROGf m R~H\ d RyH[ d RwHW +d RwHQ d RyHM d R~HK d SDHK d SIHM d SJHQ d SJHW d SIH[ d SDH\ d R~H\ +m R~H\ d RzH[ d RyHW d RyHQ d RzHM d R~HK m SDHK d SGHM d SIHQ d SIHW +d SGH[ d SDH\ m R~HK d RyHI d RwHG d RvHC d RvG{ d RwGx d RyGv d R~Gt +d SDGt d SIGv d SJGx d SLG{ d SLHC d SJHG d SIHI d SDHK m R~HK d RzHI +d RyHG d RwHC d RwG{ d RyGx d RzGv d R~Gt m SDGt d SGGv d SIGx d SJG{ +d SJHC d SIHG d SGHI d SDHK m RtGf m SYHj m SYGf m SxHj m SxGf m T^Gy +d TbGt d TeGy m TXG? d TbGv d TkG? m TbHW d TbGv m TVGf m RQGM d RQGA +m RQGE d RRGI d RVGM d RYGM d RaGG d RdGG d RfGI d RgGM m RRGI d RVGK +d RYGK d RaGG m RgGM d RgGG d RfGA d R_Fx d R^Ft d R\Fn d R\Fd m RfGA +d R^Fx d R\Ft d RZFn d RZFd m ROFW m SJG@ d SIFz d SEFv d SAFt d R?Ft +d RzFv d RwFz d RvG@ d RvGA d RwGG d RzGK d R?GM d SBGM d SGGK d SJGG +d SLGA d SLFv d SJFn d SIFj d SEFf d SAFd d R|Fd d RyFf d RwFj d RwFl +d RyFn d RzFl d RyFj m R?Ft d R|Fv d RyFz d RwG@ d RwGA d RyGG d R|GK +d R?GM m SBGM d SEGK d SIGG d SJGA d SJFv d SIFn d SGFj d SDFf d SAFd +m RtFW m SYG[ m SYFW m SxG[ m SxFW m TbGM d T^GK d T[GG d TYGC d TXF| +d TXFv d TYFn d T[Fj d T^Ff d TbFd d TeFd d TiFf d TlFj d TnFn d ToFv +d ToF| d TnGC d TlGG d TiGK d TeGM d TbGM m TbGM d T_GK d T\GG d T[GC +d TYF| d TYFv d T[Fn d T\Fj d T_Ff d TbFd m TeFd d ThFf d TkFj d TlFn +d TnFv d TnF| d TlGC d TkGG d ThGK d TeGM m TVFW m ]Kc{ m ]Kbw m ]scn +d ]ocl d ]mch d ]mcb d ]oc^ d ]sc\ d ]zc\ d ]~c^ d ^@cb d ^@ch d ]~cl +d ]zcn d ]scn m ]scn d ]pcl d ]och d ]ocb d ]pc^ d ]sc\ m ]zc\ d ]}c^ +d ]~cb d ]~ch d ]}cl d ]zcn m ]sc\ d ]ocZ d ]mcX d ]kcU d ]kcM d ]mcI +d ]ocG d ]scE d ]zcE d ]~cG d ^@cI d ^BcM d ^BcU d ^@cX d ]~cZ d ]zc\ +m ]sc\ d ]pcZ d ]ocX d ]mcU d ]mcM d ]ocI d ]pcG d ]scE m ]zcE d ]}cG +d ]~cI d ^@cM d ^@cU d ]~cX d ]}cZ d ]zc\ m ]jbw m ^Zcn d ^Ucl d ^Rcf +d ^Pc\ d ^PcV d ^RcM d ^UcG d ^ZcE d ^]cE d ^bcG d ^ecM d ^fcV d ^fc\ +d ^ecf d ^bcl d ^]cn d ^Zcn m ^Zcn d ^Vcl d ^Ucj d ^Scf d ^Rc\ d ^RcV +d ^ScM d ^UcI d ^VcG d ^ZcE m ^]cE d ^`cG d ^bcI d ^ccM d ^ecV d ^ec\ +d ^ccf d ^bcj d ^`cl d ^]cn m ^Obw m ^sc{ m ^sbw m _Rc{ m _Rbw m _ucn +d _ucE m _vcn d _vcE m `Gcn d `GcE m `Hcn d `HcE m _qcn d `Lcn m _qcE +d _zcE m `CcE d `LcE m _qbw m ]Kbl m ]Kah m ]sb^ d ]ob] d ]mbY d ]mbS +d ]obO d ]sbM d ]zbM d ]~bO d ^@bS d ^@bY d ]~b] d ]zb^ d ]sb^ m ]sb^ +d ]pb] d ]obY d ]obS d ]pbO d ]sbM m ]zbM d ]}bO d ]~bS d ]~bY d ]}b] +d ]zb^ m ]sbM d ]obK d ]mbI d ]kbE d ]ka} d ]maz d ]oax d ]sav d ]zav +d ]~ax d ^@az d ^Ba} d ^BbE d ^@bI d ]~bK d ]zbM m ]sbM d ]pbK d ]obI +d ]mbE d ]ma} d ]oaz d ]pax d ]sav m ]zav d ]}ax d ]~az d ^@a} d ^@bE +d ]~bI d ]}bK d ]zbM m ]jah m ^UbW d ^XbY d ^]b^ d ^]av m ^[b] d ^[av +m ^Uav d ^cav m ^Oah m ^sbl m ^sah m _Rbl m _Rah m _}b^ d _xb] d _ubY +d _tbU d _rbM d _rbG d _ta? d _ua{ d _xax d _}av d `@av d `Dax d `Ga{ +d `Ha? d `JbG d `JbM d `HbU d `GbY d `Db] d `@b^ d _}b^ m _}b^ d _zb] +d _wbY d _ubU d _tbM d _tbG d _ua? d _wa{ d _zax d _}av m `@av d `Cax +d `Fa{ d `Ga? d `HbG d `HbM d `GbU d `FbY d `Cb] d `@b^ m _zbQ d _zbC +m `CbQ d `CbC m _zbK d `CbK m _zbI d `CbI m _qah m ]Ka] m ]K`Y m ]saO +d ]oaM d ]maI d ]maC d ]oa@ d ]s`~ d ]z`~ d ]~a@ d ^@aC d ^@aI d ]~aM +d ]zaO d ]saO m ]saO d ]paM d ]oaI d ]oaC d ]pa@ d ]s`~ m ]z`~ d ]}a@ +d ]~aC d ]~aI d ]}aM d ]zaO m ]s`~ d ]o`| d ]m`z d ]k`v d ]k`n d ]m`j +d ]o`h d ]s`f d ]z`f d ]~`h d ^@`j d ^B`n d ^B`v d ^@`z d ]~`| d ]z`~ +m ]s`~ d ]p`| d ]o`z d ]m`v d ]m`n d ]o`j +stroke +m ]o`j d ]p`h d ]s`f m ]z`f d ]}`h d ]~`j d ^@`n d ^@`v d ]~`z d ]}`| +d ]z`~ m ]j`Y m ^RaG d ^SaE d ^RaC d ^PaE d ^PaG d ^RaK d ^SaM d ^XaO +d ^^aO d ^caM d ^eaK d ^faG d ^faC d ^ea@ d ^``| d ^X`x d ^U`v d ^R`r +d ^P`l d ^P`f m ^^aO d ^baM d ^caK d ^eaG d ^eaC d ^ca@ d ^^`| d ^X`x +m ^P`j d ^R`l d ^U`l d ^]`h d ^b`h d ^e`j d ^f`l m ^U`l d ^]`f d ^c`f +d ^e`h d ^f`l d ^f`p m ^O`Y m ^sa] m ^s`Y m _Ra] m _R`Y m `KaO d _r`f +m _yaO d _|aK d _|aG d _zaC d _xaB d _uaB d _raE d _raI d _taM d _vaO +d _yaO d _|aM d `@aK d `DaK d `HaM d `KaO m `E`t d `C`r d `A`n d `A`j +d `D`f d `G`f d `I`h d `K`l d `K`p d `H`t d `E`t m _q`Y m ]K`M m ]K_I +m ]s`@ d ]o_~ d ]m_z d ]m_t d ]o_p d ]s_n d ]z_n d ]~_p d ^@_t d ^@_z +d ]~_~ d ]z`@ d ]s`@ m ]s`@ d ]p_~ d ]o_z d ]o_t d ]p_p d ]s_n m ]z_n +d ]}_p d ]~_t d ]~_z d ]}_~ d ]z`@ m ]s_n d ]o_l d ]m_j d ]k_g d ]k__ +d ]m_[ d ]o_Y d ]s_W d ]z_W d ]~_Y d ^@_[ d ^B__ d ^B_g d ^@_j d ]~_l +d ]z_n m ]s_n d ]p_l d ]o_j d ]m_g d ]m__ d ]o_[ d ]p_Y d ]s_W m ]z_W +d ]}_Y d ]~_[ d ^@__ d ^@_g d ]~_j d ]}_l d ]z_n m ]j_I m ^R_x d ^S_v +d ^R_t d ^P_v d ^P_x d ^R_| d ^S_~ d ^X`@ d ^^`@ d ^c_~ d ^e_z d ^e_t +d ^c_p d ^^_n d ^Z_n m ^^`@ d ^b_~ d ^c_z d ^c_t d ^b_p d ^^_n m ^^_n +d ^b_l d ^e_i d ^f_e d ^f__ d ^e_[ d ^c_Y d ^^_W d ^X_W d ^S_Y d ^R_[ +d ^P__ d ^P_a d ^R_c d ^S_a d ^R__ m ^c_j d ^e_e d ^e__ d ^c_[ d ^b_Y +d ^^_W m ^O_I m ^s`M m ^s_I m _R`M m _R_I m _r`@ d _}_l d _q_W m _q`@ +d _|_l m _q`@ d `H`@ d `I_t d `F`@ m _r_Y d `F_Y m _q_W d `H_W d `I_c +d `F_W m _q_I m ]K^~ m ]K]z m ]s^p d ]o^o d ]m^k d ]m^e d ]o^a d ]s^_ +d ]z^_ d ]~^a d ^@^e d ^@^k d ]~^o d ]z^p d ]s^p m ]s^p d ]p^o d ]o^k +d ]o^e d ]p^a d ]s^_ m ]z^_ d ]}^a d ]~^e d ]~^k d ]}^o d ]z^p m ]s^_ +d ]o^] d ]m^[ d ]k^W d ]k^O d ]m^K d ]o^J d ]s^H d ]z^H d ]~^J d ^@^K +d ^B^O d ^B^W d ^@^[ d ]~^] d ]z^_ m ]s^_ d ]p^] d ]o^[ d ]m^W d ]m^O +d ]o^K d ]p^J d ]s^H m ]z^H d ]}^J d ]~^K d ^@^O d ^@^W d ]~^[ d ]}^] +d ]z^_ m ]j]z m ^^^m d ^^^H m ^`^p d ^`^H m ^`^p d ^O^S d ^h^S m ^Z^H +d ^e^H m ^O]z m ^s^~ m ^s]z m _R^~ m _R]z m _u^x d _u]z m `B^x d `B]z +m _q]z m ]K]o m ]K\k m ]s]a d ]o]_ d ]m][ d ]m]U d ]o]R d ]s]P d ]z]P +d ]~]R d ^@]U d ^@][ d ]~]_ d ]z]a d ]s]a m ]s]a d ]p]_ d ]o][ d ]o]U +d ]p]R d ]s]P m ]z]P d ]}]R d ]~]U d ]~][ d ]}]_ d ]z]a m ]s]P d ]o]N +d ]m]L d ]k]H d ]k]@ d ]m\| d ]o\z d ]s\x d ]z\x d ]~\z d ^@\| d ^B]@ +d ^B]H d ^@]L d ]~]N d ]z]P m ]s]P d ]p]N d ]o]L d ]m]H d ]m]@ d ]o\| +d ]p\z d ]s\x m ]z\x d ]}\z d ]~\| d ^@]@ d ^@]H d ]~]L d ]}]N d ]z]P +m ]j\k m ^S]a d ^P]N m ^P]N d ^S]R d ^X]S d ^]]S d ^b]R d ^e]N d ^f]H +d ^f]D d ^e\~ d ^b\z d ^]\x d ^X\x d ^S\z d ^R\| d ^P]@ d ^P]B d ^R]D +d ^S]B d ^R]@ m ^]]S d ^`]R d ^c]N d ^e]H d ^e]D d ^c\~ d ^`\z d ^]\x +m ^S]a d ^c]a m ^S]_ d ^[]_ d ^c]a m ^O\k m ^s]o m ^s\k m _R]o m _R\k +m _q]W d _q][ d _s]_ d _t]a d _x]a d _y]_ d _{][ d _|]S d _|\x m _q][ +d _t]_ d _x]_ d _{][ m `J]W d `J][ d `H]_ d `F]a d `C]a d `A]_ d `@][ +d _~]S d _~\x m `J][ d `F]_ d `C]_ d `@][ m _x\x d `C\x m _q\k m ]K\_ +m ]K[[ m ]s\R d ]o\P d ]m\L d ]m\F d ]o\B d ]s\@ d ]z\@ d ]~\B d ^@\F +d ^@\L d ]~\P d ]z\R d ]s\R m ]s\R d ]p\P d ]o\L d ]o\F d ]p\B d ]s\@ +m ]z\@ d ]}\B d ]~\F d ]~\L d ]}\P d ]z\R m ]s\@ d ]o[~ d ]m[| d ]k[y +d ]k[q d ]m[m d ]o[k d ]s[i d ]z[i d ]~[k d ^@[m d ^B[q d ^B[y d ^@[| +d ]~[~ d ]z\@ m ]s\@ d ]p[~ d ]o[| d ]m[y d ]m[q d ]o[m d ]p[k d ]s[i +m ]z[i d ]}[k d ]~[m d ^@[q d ^@[y d ]~[| d ]}[~ d ]z\@ m ]j[[ m ^c\L +d ^b\J d ^c\H d ^e\J d ^e\L d ^c\P d ^`\R d ^[\R d ^V\P d ^S\L d ^R\H +d ^P\@ d ^P[u d ^R[o d ^U[k d ^Z[i d ^][i d ^b[k d ^e[o d ^f[u d ^f[w +d ^e[| d ^b\@ d ^]\B d ^[\B d ^V\@ d ^S[| d ^R[w m ^[\R d ^X\P d ^U\L +d ^S\H d ^R\@ d ^R[u d ^S[o d ^V[k d ^Z[i m ^][i d ^`[k d ^c[o d ^e[u +d ^e[w d ^c[| d ^`\@ d ^]\B m ^O[[ m ^s\_ m ^s[[ m _R\_ m _R[[ m _|\L +d _r[i m _?\L d `I[i m _~\L d `G[i m _v[u d `D[u m _q[i d _y[i m `B[i +d `L[i m _|\Z d _y\X d _w\T d _w\P d _y\L d _|\J d _?\J d `B\L d `D\P +d `D\T d `B\X d _?\Z d _|\Z m _q[[ m ]K[P m ]KZL m ]s[C d ]o[A d ]mZ} +d ]mZw d ]oZs d ]sZq d ]zZq d ]~Zs d ^@Zw d ^@Z} d ]~[A d ]z[C d ]s[C +m ]s[C d ]p[A d ]oZ} d ]oZw d ]pZs d ]sZq m ]zZq d ]}Zs d ]~Zw d ]~Z} +d ]}[A d ]z[C m ]sZq d ]oZo d ]mZm d ]kZi d ]kZa d ]mZ^ d ]oZ\ d ]sZZ +d ]zZZ d ]~Z\ d ^@Z^ d ^BZa d ^BZi d ^@Zm d ]~Zo d ]zZq m ]sZq d ]pZo +d ]oZm d ]mZi d ]mZa d ]oZ^ d ]pZ\ d ]sZZ m ]zZZ d ]}Z\ d ]~Z^ d ^@Za +d ^@Zi d ]~Zm d ]}Zo d ]zZq m ]jZL m ^P[C d ^PZw m ^PZ{ d ^RZ? d ^U[C +d ^X[C d ^`Z} d ^cZ} d ^eZ? d ^f[C m ^RZ? d ^U[A d ^X[A d ^`Z} m ^f[C +d ^fZ} d ^eZw d ^^Zm d ^]Zi d ^[Zc d ^[ZZ m ^eZw d ^]Zm +stroke +m ^]Zm d ^[Zi d ^ZZc d ^ZZZ m ^OZL m ^s[P m ^sZL m _R[P m _RZL m _rZ` +d _tZZ d _zZZ d _wZa d _tZi d _rZo d _rZw d _tZ} d _w[A d _{[C d `A[C +d `F[A d `HZ} d `JZw d `JZo d `HZi d `FZa d `CZZ d `HZZ d `JZ` m _wZa +d _uZg d _tZo d _tZw d _uZ} d _x[A d _{[C m `A[C d `D[A d `GZ} d `HZw +d `HZo d `GZg d `FZa m _tZ\ d _xZ\ m `DZ\ d `HZ\ m _qZL m ]KZA m ]KX} +m ]sYs d ]oYq d ]mYm d ]mYg d ]oYd d ]sYb d ]zYb d ]~Yd d ^@Yg d ^@Ym +d ]~Yq d ]zYs d ]sYs m ]sYs d ]pYq d ]oYm d ]oYg d ]pYd d ]sYb m ]zYb +d ]}Yd d ]~Yg d ]~Ym d ]}Yq d ]zYs m ]sYb d ]oY` d ]mY^ d ]kYZ d ]kYR +d ]mYN d ]oYL d ]sYJ d ]zYJ d ]~YL d ^@YN d ^BYR d ^BYZ d ^@Y^ d ]~Y` +d ]zYb m ]sYb d ]pY` d ]oY^ d ]mYZ d ]mYR d ]oYN d ]pYL d ]sYJ m ]zYJ +d ]}YL d ]~YN d ^@YR d ^@YZ d ]~Y^ d ]}Y` d ]zYb m ]jX} m ^XYs d ^SYq +d ^RYm d ^RYg d ^SYd d ^XYb d ^^Yb d ^cYd d ^eYg d ^eYm d ^cYq d ^^Ys +d ^XYs m ^XYs d ^UYq d ^SYm d ^SYg d ^UYd d ^XYb m ^^Yb d ^bYd d ^cYg +d ^cYm d ^bYq d ^^Ys m ^XYb d ^SY` d ^RY^ d ^PYZ d ^PYR d ^RYN d ^SYL +d ^XYJ d ^^YJ d ^cYL d ^eYN d ^fYR d ^fYZ d ^eY^ d ^cY` d ^^Yb m ^XYb +d ^UY` d ^SY^ d ^RYZ d ^RYR d ^SYN d ^UYL d ^XYJ m ^^YJ d ^bYL d ^cYN +d ^eYR d ^eYZ d ^cY^ d ^bY` d ^^Yb m ^OX} m ^sZA m ^sX} m _RZA m _RX} +m _tYu d _rYk m `JYu d `HYk m _zYd d _xYZ m `DYd d `CYZ m _tYR d _rYH +m `JYR d `HYH m _tYq d `HYq m _tYo d `HYo m _zY` d `CY` m _zY^ d `CY^ +m _tYN d `HYN m _tYL d `HYL m _qX} m ]KXq m ]KWm m ]sXd d ]oXb d ]mX^ +d ]mXX d ]oXT d ]sXR d ]zXR d ]~XT d ^@XX d ^@X^ d ]~Xb d ]zXd d ]sXd +m ]sXd d ]pXb d ]oX^ d ]oXX d ]pXT d ]sXR m ]zXR d ]}XT d ]~XX d ]~X^ +d ]}Xb d ]zXd m ]sXR d ]oXP d ]mXN d ]kXK d ]kXC d ]mW? d ]oW} d ]sW{ +d ]zW{ d ]~W} d ^@W? d ^BXC d ^BXK d ^@XN d ]~XP d ]zXR m ]sXR d ]pXP +d ]oXN d ]mXK d ]mXC d ]oW? d ]pW} d ]sW{ m ]zW{ d ]}W} d ]~W? d ^@XC +d ^@XK d ]~XN d ]}XP d ]zXR m ]jWm m ^eXV d ^cXP d ^`XM d ^[XK d ^ZXK +d ^UXM d ^RXP d ^PXV d ^PXX d ^RX^ d ^UXb d ^ZXd d ^]Xd d ^bXb d ^eX^ +d ^fXX d ^fXM d ^eXE d ^cXA d ^`W} d ^[W{ d ^VW{ d ^SW} d ^RXA d ^RXC +d ^SXE d ^UXC d ^SXA m ^ZXK d ^VXM d ^SXP d ^RXV d ^RXX d ^SX^ d ^VXb +d ^ZXd m ^]Xd d ^`Xb d ^cX^ d ^eXX d ^eXM d ^cXE d ^bXA d ^^W} d ^[W{ +m ^OWm m ^sXq m ^sWm m _RXq m _RWm m _~Xd d _~W{ m _?Xd d _?W{ m _qXV +d _rXX d _uXV d _wXN d _xXK d _yXI d _|XG m _rXX d _tXV d _uXN d _wXK +d _xXI d _|XG d `@XG d `EXI d `FXK d `HXN d `IXV d `JXX m `@XG d `CXI +d `EXK d `FXN d `HXV d `JXX d `LXV m _yXd d `CXd m _yW{ d `CW{ m _qWm +m ]KWb m ]KV^ m ^@WG d ]~WA d ]{V} d ]vV{ d ]uV{ d ]pV} d ]mWA d ]kWG +d ]kWI d ]mWO d ]pWS d ]uWT d ]xWT d ]}WS d ^@WO d ^BWI d ^BV} d ^@Vu +d ]~Vq d ]{Vn d ]vVl d ]rVl d ]oVn d ]mVq d ]mVs d ]oVu d ]pVs d ]oVq +m ]uV{ d ]rV} d ]oWA d ]mWG d ]mWI d ]oWO d ]rWS d ]uWT m ]xWT d ]{WS +d ]~WO d ^@WI d ^@V} d ]~Vu d ]}Vq d ]zVn d ]vVl m ]jV^ m ^ZWT d ^UWS +d ^RWM d ^PWC d ^PV} d ^RVs d ^UVn d ^ZVl d ^]Vl d ^bVn d ^eVs d ^fV} +d ^fWC d ^eWM d ^bWS d ^]WT d ^ZWT m ^ZWT d ^VWS d ^UWQ d ^SWM d ^RWC +d ^RV} d ^SVs d ^UVp d ^VVn d ^ZVl m ^]Vl d ^`Vn d ^bVp d ^cVs d ^eV} +d ^eWC d ^cWM d ^bWQ d ^`WS d ^]WT m ^OV^ m ^sWb m ^sV^ m _RWb m _RV^ +m _qWb m _qV^ m ]KVS m ]KUO m ^@Ux d ]~Ur d ]{Un d ]vUl d ]uUl d ]pUn +d ]mUr d ]kUx d ]kUy d ]mU? d ]pVC d ]uVE d ]xVE d ]}VC d ^@U? d ^BUy +d ^BUn d ^@Uf d ]~Ub d ]{U^ d ]vU\ d ]rU\ d ]oU^ d ]mUb d ]mUd d ]oUf +d ]pUd d ]oUb m ]uUl d ]rUn d ]oUr d ]mUx d ]mUy d ]oU? d ]rVC d ]uVE +m ]xVE d ]{VC d ]~U? d ^@Uy d ^@Un d ]~Uf d ]}Ub d ]zU^ d ]vU\ m ]jUO +m ^UU} d ^XU? d ^]VE d ^]U\ m ^[VC d ^[U\ m ^UU\ d ^cU\ m ^OUO m ^sVS +m ^sUO m _RVS m _RUO m _uVM d _uUO m _wVM d _wUO m _uVM d `DVM m _uUO +d `DUO m _qUO m ]KUC m ]KS? m ^@Th d ]~Tb d ]{T^ d ]vT] d ]uT] d ]pT^ +d ]mTb d ]kTh d ]kTj d ]mTp d ]pTt d ]uTv d ]xTv d ]}Tt d ^@Tp d ^BTj +d ^BT^ d ^@TW d ]~TS d ]{TO d ]vTM d ]rTM d ]oTO d ]mTS d ]mTU d ]oTW +d ]pTU d ]oTS m ]uT] d ]rT^ d ]oTb d ]mTh d ]mTj d ]oTp d ]rTt d ]uTv +m ]xTv d ]{Tt d ]~Tp d ^@Tj d ^@T^ d ]~TW d ]}TS d ]zTO d ]vTM m ]jS? +m ^RTn d ^STl d ^RTj d ^PTl d ^PTn d ^RTr d ^STt d ^XTv d ^^Tv d ^cTt +d ^eTr d ^fTn d ^fTj d ^eTf d ^`Tb d ^XT^ d ^UT] d ^RTY d ^PTS d ^PTM +m ^^Tv d ^bTt d ^cTr d ^eTn d ^eTj d ^cTf d ^^Tb d ^XT^ m ^PTQ d ^RTS +d ^UTS d ^]TO d ^bTO d ^eTQ d ^fTS m ^UTS d ^]TM d ^cTM d ^eTO d ^fTS +d ^fTW m ^OS? m ^sUC m ^sS? m _RUC m _RS? m _qTv d `JTG m _qS? m ]KSt +m ]KRp m ^@SY d ]~SS d ]{SO d ]vSM d ]uSM d ]pSO d ]mSS d ]kSY d ]kS[ +d ]mSa d ]pSe d ]uSf d ]xSf d ]}Se d ^@Sa d ^BS[ d ^BSO d ^@SG d ]~SC +d ]{S@ d ]vR~ d ]rR~ d ]oS@ d ]mSC d ]mSE d ]oSG d ]pSE d ]oSC m ]uSM +d ]rSO d ]oSS d ]mSY d ]mS[ d ]oSa d ]rSe d ]uSf m ]xSf d ]{Se d ]~Sa +stroke +m ]~Sa d ^@S[ d ^@SO d ]~SG d ]}SC d ]zS@ d ]vR~ m ]jRp m ^RS_ d ^SS] +d ^RS[ d ^PS] d ^PS_ d ^RSc d ^SSe d ^XSf d ^^Sf d ^cSe d ^eSa d ^eS[ +d ^cSW d ^^SU d ^ZSU m ^^Sf d ^bSe d ^cSa d ^cS[ d ^bSW d ^^SU m ^^SU +d ^bSS d ^eSO d ^fSK d ^fSE d ^eSB d ^cS@ d ^^R~ d ^XR~ d ^SS@ d ^RSB +d ^PSE d ^PSG d ^RSI d ^SSG d ^RSE m ^cSQ d ^eSK d ^eSE d ^cSB d ^bS@ +d ^^R~ m ^ORp m ^sSt m ^sRp m _RSt m _RRp m _?Sn d _?Rp m `BSn d `BRp +m _sSn d `BSn m _sRp d `BRp m _qRp m ]KRe m ]KQa m ^@RJ d ]~RD d ]{R@ +d ]vQ~ d ]uQ~ d ]pR@ d ]mRD d ]kRJ d ]kRK d ]mRQ d ]pRU d ]uRW d ]xRW +d ]}RU d ^@RQ d ^BRK d ^BR@ d ^@Qx d ]~Qt d ]{Qp d ]vQn d ]rQn d ]oQp +d ]mQt d ]mQv d ]oQx d ]pQv d ]oQt m ]uQ~ d ]rR@ d ]oRD d ]mRJ d ]mRK +d ]oRQ d ]rRU d ]uRW m ]xRW d ]{RU d ]~RQ d ^@RK d ^@R@ d ]~Qx d ]}Qt +d ]zQp d ]vQn m ]jQa m ^^RS d ^^Qn m ^`RW d ^`Qn m ^`RW d ^OQz d ^hQz +m ^ZQn d ^eQn m ^OQa m ^sRe m ^sQa m _RRe m _RQa m _qRe m _qQa m ]KQU +m ]KPQ m ^@Pz d ]~Pt d ]{Pq d ]vPo d ]uPo d ]pPq d ]mPt d ]kPz d ]kP| +d ]mQB d ]pQF d ]uQH d ]xQH d ]}QF d ^@QB d ^BP| d ^BPq d ^@Pi d ]~Pe +d ]{Pa d ]vP_ d ]rP_ d ]oPa d ]mPe d ]mPg d ]oPi d ]pPg d ]oPe m ]uPo +d ]rPq d ]oPt d ]mPz d ]mP| d ]oQB d ]rQF d ]uQH m ]xQH d ]{QF d ]~QB +d ^@P| d ^@Pq d ]~Pi d ]}Pe d ]zPa d ]vP_ m ]jPQ m ^SQH d ^PPt m ^PPt +d ^SPx d ^XPz d ^]Pz d ^bPx d ^ePt d ^fPo d ^fPk d ^ePe d ^bPa d ^]P_ +d ^XP_ d ^SPa d ^RPc d ^PPg d ^PPi d ^RPk d ^SPi d ^RPg m ^]Pz d ^`Px +d ^cPt d ^ePo d ^ePk d ^cPe d ^`Pa d ^]P_ m ^SQH d ^cQH m ^SQF d ^[QF +d ^cQH m ^OPQ m ^sQU m ^sPQ m _RQU m _RPQ m `GPt d `JPq d `GPm m `CPz +d `IPq d `CPg m _sPq d `IPq m _qPQ m ]KPF m ]KOB m ^@Ok d ]~Oe d ]{Oa +d ]vO_ d ]uO_ d ]pOa d ]mOe d ]kOk d ]kOm d ]mOs d ]pOw d ]uOy d ]xOy +d ]}Ow d ^@Os d ^BOm d ^BOa d ^@OY d ]~OV d ]{OR d ]vOP d ]rOP d ]oOR +d ]mOV d ]mOW d ]oOY d ]pOW d ]oOV m ]uO_ d ]rOa d ]oOe d ]mOk d ]mOm +d ]oOs d ]rOw d ]uOy m ]xOy d ]{Ow d ]~Os d ^@Om d ^@Oa d ]~OY d ]}OV +d ]zOR d ]vOP m ]jOB m ^cOs d ^bOq d ^cOo d ^eOq d ^eOs d ^cOw d ^`Oy +d ^[Oy d ^VOw d ^SOs d ^ROo d ^POg d ^PO[ d ^ROV d ^UOR d ^ZOP d ^]OP +d ^bOR d ^eOV d ^fO[ d ^fO] d ^eOc d ^bOg d ^]Oi d ^[Oi d ^VOg d ^SOc +d ^RO] m ^[Oy d ^XOw d ^UOs d ^SOo d ^ROg d ^RO[ d ^SOV d ^VOR d ^ZOP +m ^]OP d ^`OR d ^cOV d ^eO[ d ^eO] d ^cOc d ^`Og d ^]Oi m ^OOB m ^sPF +m ^sOB m _RPF m _ROB m _rOk d _xOk d `AOT m _wOk d `AOP m `NP@ d `AOP +m _qOB m ]KNw m ]KMs m ^@N[ d ]~NV d ]{NR d ]vNP d ]uNP d ]pNR d ]mNV +d ]kN[ d ]kN] d ]mNc d ]pNg d ]uNi d ]xNi d ]}Ng d ^@Nc d ^BN] d ^BNR +d ^@NJ d ]~NF d ]{NB d ]vN@ d ]rN@ d ]oNB d ]mNF d ]mNH d ]oNJ d ]pNH +d ]oNF m ]uNP d ]rNR d ]oNV d ]mN[ d ]mN] d ]oNc d ]rNg d ]uNi m ]xNi +d ]{Ng d ]~Nc d ^@N] d ^@NR d ]~NJ d ]}NF d ]zNB d ]vN@ m ]jMs m ^PNi +d ^PN] m ^PNa d ^RNe d ^UNi d ^XNi d ^`Nc d ^cNc d ^eNe d ^fNi m ^RNe +d ^UNg d ^XNg d ^`Nc m ^fNi d ^fNc d ^eN] d ^^NT d ^]NP d ^[NJ d ^[N@ +m ^eN] d ^]NT d ^[NP d ^ZNJ d ^ZN@ m ^OMs m ^sNw m ^sMs m _RNw m _RMs +m _|N[ d _xNZ d _uNV d _tNR d _rNL d _rNF d _tNB d _xN@ d _{N@ d _~NB +d `BNH d `ENN d `HNV d `IN[ m _|N[ d _yNZ d _wNV d _uNR d _tNL d _tNF +d _uNB d _xN@ m _|N[ d _?N[ d `BNZ d `CNV d `FNF d `HNB d `IN@ m _?N[ +d `@NZ d `BNV d `ENF d `FNB d `IN@ d `JN@ m _qMs m ]KMg m ]KLc m ^@ML +d ]~MF d ]{MC d ]vMA d ]uMA d ]pMC d ]mMF d ]kML d ]kMN d ]mMT d ]pMX +d ]uMZ d ]xMZ d ]}MX d ^@MT d ^BMN d ^BMC d ^@L{ d ]~Lw d ]{Ls d ]vLq +d ]rLq d ]oLs d ]mLw d ]mLy d ]oL{ d ]pLy d ]oLw m ]uMA d ]rMC d ]oMF +d ]mML d ]mMN d ]oMT d ]rMX d ]uMZ m ]xMZ d ]{MX d ]~MT d ^@MN d ^@MC +d ]~L{ d ]}Lw d ]zLs d ]vLq m ]jLc m ^XMZ d ^SMX d ^RMT d ^RMN d ^SMJ +d ^XMH d ^^MH d ^cMJ d ^eMN d ^eMT d ^cMX d ^^MZ d ^XMZ m ^XMZ d ^UMX +d ^SMT d ^SMN d ^UMJ d ^XMH m ^^MH d ^bMJ d ^cMN d ^cMT d ^bMX d ^^MZ +m ^XMH d ^SMF d ^RMD d ^PMA d ^PLy d ^RLu d ^SLs d ^XLq d ^^Lq d ^cLs +d ^eLu d ^fLy d ^fMA d ^eMD d ^cMF d ^^MH m ^XMH d ^UMF d ^SMD d ^RMA +d ^RLy d ^SLu d ^ULs d ^XLq m ^^Lq d ^bLs d ^cLu d ^eLy d ^eMA d ^cMD +d ^bMF d ^^MH m ^OLc m ^sMg m ^sLc m _RMg m _RLc m `BMZ d _}MX d _zMT +d _wML d _uMF d _tL? d _rLs d _qLc m `BMZ d _?MX d _|MT d _yML d _wMF +d _uL? d _tLs d _rLc m `BMZ d `EMZ d `HMX d `IMV d `IMP d `HML d `FMJ +d `BMH d _|MH m `EMZ d `HMV d `HMP d `FML d `EMJ d `BMH m _|MH d `BMF +d `EMC d `FL? d `FLy d `ELu d `CLs d _?Lq d _|Lq d _yLs d _wLu d _uL{ +m _|MH d `@MF d `CMC d `EL? d `ELy d `CLu d `BLs d _?Lq m _qLc m ]KLX +m ]KKT m ^@K} d ]~Kw d ]{Ks d ]vKq d ]uKq d ]pKs d ]mKw d ]kK} d ]kK? +d ]mLE d ]pLI d ]uLK d ]xLK d ]}LI d ^@LE d ^BK? d ^BKs d ^@Kk d ]~Kg +d ]{Kd d ]vKb +stroke +m ]vKb d ]rKb d ]oKd d ]mKg d ]mKi d ]oKk d ]pKi d ]oKg m ]uKq d ]rKs +d ]oKw d ]mK} d ]mK? d ]oLE d ]rLI d ]uLK m ]xLK d ]{LI d ]~LE d ^@K? +d ^@Ks d ]~Kk d ]}Kg d ]zKd d ]vKb m ]jKT m ^eK} d ^cKw d ^`Ks d ^[Kq +d ^ZKq d ^UKs d ^RKw d ^PK} d ^PK? d ^RLE d ^ULI d ^ZLK d ^]LK d ^bLI +d ^eLE d ^fK? d ^fKs d ^eKk d ^cKg d ^`Kd d ^[Kb d ^VKb d ^SKd d ^RKg +d ^RKi d ^SKk d ^UKi d ^SKg m ^ZKq d ^VKs d ^SKw d ^RK} d ^RK? d ^SLE +d ^VLI d ^ZLK m ^]LK d ^`LI d ^cLE d ^eK? d ^eKs d ^cKk d ^bKg d ^^Kd +d ^[Kb m ^OKT m ^sLX m ^sKT m _RLX m _RKT m _qK} d _tK} d _xK{ d _yKw +d `BKZ d `DKV d `FKT m _tK} d _vK{ d _xKw d `@KZ d `BKV d `FKT d `IKT +m `KK} d `IKy d `FKs d _tK^ d _qKX d _qKT m _qKT m ]QJs d ]TJu d ]YJ{ +d ]YJR m ]XJy d ]XJR m ]QJR d ]`JR m ]KJE m ]{J{ d ]vJy d ]sJs d ]qJj +d ]qJd d ]sJZ d ]vJT d ]{JR d ]~JR d ^CJT d ^FJZ d ^GJd d ^GJj d ^FJs +d ^CJy d ]~J{ d ]{J{ m ]{J{ d ]xJy d ]vJw d ]tJs d ]sJj d ]sJd d ]tJZ +d ]vJV d ]xJT d ]{JR m ]~JR d ^AJT d ^CJV d ^DJZ d ^FJd d ^FJj d ^DJs +d ^CJw d ^AJy d ]~J{ m ]pJE m ^_J{ d ^[Jy d ^WJs d ^VJj d ^VJd d ^WJZ +d ^[JT d ^_JR d ^cJR d ^gJT d ^kJZ d ^lJd d ^lJj d ^kJs d ^gJy d ^cJ{ +d ^_J{ m ^_J{ d ^\Jy d ^[Jw d ^YJs d ^WJj d ^WJd d ^YJZ d ^[JV d ^\JT +d ^_JR m ^cJR d ^fJT d ^gJV d ^iJZ d ^kJd d ^kJj d ^iJs d ^gJw d ^fJy +d ^cJ{ m ^TJE m ^yKI m ^yJE m _XKI m _XJE m `IJl d `FJn d `BJn d _}Jl +d _zJf d _xJ` d _xJZ d _zJV d _|JT d _?JR d `BJR d `GJT d `KJZ d `LJ` +d `LJf d `KJj d `DJs d `BJw d `BJ{ d `DJ} d `GJ} d `KJ{ d `NJw m `BJn +d _?Jl d _|Jf d _zJ` d _zJX d _|JT m `BJR d `FJT d `IJZ d `KJ` d `KJh +d `IJl d `FJq d `DJu d `DJy d `FJ{ d `IJ{ d `NJw m _wJE m ]QId d ]TIf +d ]YIl d ]YIC m ]XIj d ]XIC m ]QIC d ]`IC m ]KHu m ]{Il d ]vIj d ]sId +d ]qIZ d ]qIT d ]sIK d ]vIE d ]{IC d ]~IC d ^CIE d ^FIK d ^GIT d ^GIZ +d ^FId d ^CIj d ]~Il d ]{Il m ]{Il d ]xIj d ]vIh d ]tId d ]sIZ d ]sIT +d ]tIK d ]vIG d ]xIE d ]{IC m ]~IC d ^AIE d ^CIG d ^DIK d ^FIT d ^FIZ +d ^DId d ^CIh d ^AIj d ]~Il m ]pHu m ^[Id d ^^If d ^cIl d ^cIC m ^aIj +d ^aIC m ^[IC d ^iIC m ^THu m ^yIy m ^yHu m _XIy m _XHu m `MIX d `JI\ +d `FI^ d _?I^ d _|I\ d _|IX d _?IT d `EIS m _?I^ d _~I\ d _~IX d `AIT +d `EIS m `EIS d _|IQ d _xIM d _xII d _zIE d _?IC d `EIC d `HIE d `KII +m `EIS d _~IQ d _zIM d _zII d _|IE d _?IC m _wHu m ]QHU d ]THW d ]YH\ +d ]YGt m ]XH[ d ]XGt m ]QGt d ]`Gt m ]KGf m ]{H\ d ]vH[ d ]sHU d ]qHK +d ]qHE d ]sG{ d ]vGv d ]{Gt d ]~Gt d ^CGv d ^FG{ d ^GHE d ^GHK d ^FHU +d ^CH[ d ]~H\ d ]{H\ m ]{H\ d ]xH[ d ]vHY d ]tHU d ]sHK d ]sHE d ]tG{ +d ]vGx d ]xGv d ]{Gt m ]~Gt d ^AGv d ^CGx d ^DG{ d ^FHE d ^FHK d ^DHU +d ^CHY d ^AH[ d ]~H\ m ]pGf m ^WHU d ^YHS d ^WHQ d ^VHS d ^VHU d ^WHY +d ^YH[ d ^^H\ d ^dH\ d ^iH[ d ^kHY d ^lHU d ^lHQ d ^kHM d ^fHI d ^^HE +d ^[HC d ^WG? d ^VGy d ^VGt m ^dH\ d ^gH[ d ^iHY d ^kHU d ^kHQ d ^iHM +d ^dHI d ^^HE m ^VGx d ^WGy d ^[Gy d ^cGv d ^gGv d ^kGx d ^lGy m ^[Gy +d ^cGt d ^iGt d ^kGv d ^lGy d ^lG} m ^TGf m ^yHj m ^yGf m _XHj m _XGf +m _?HM d _}HK d _zHG d _xHA d _xG{ d _zGx d _{Gv d _~Gt d `CGt d `GGv +d `KGy d `NG? d `PHE d `PHK d `MHO d `JHO d `GHK d `DHC d `AGy d _}Gf +m _xG{ d _{Gx d _~Gv d `CGv d `GGx d `KG{ d `NG? m `PHK d `MHM d `JHM +d `GHI d `DHC d `AGx d _~Gf m _wGf m ]QGE d ]TGG d ]YGM d ]YFd m ]XGK +d ]XFd m ]QFd d ]`Fd m ]KFW m ]{GM d ]vGK d ]sGE d ]qF| d ]qFv d ]sFl +d ]vFf d ]{Fd d ]~Fd d ^CFf d ^FFl d ^GFv d ^GF| d ^FGE d ^CGK d ]~GM +d ]{GM m ]{GM d ]xGK d ]vGI d ]tGE d ]sF| d ]sFv d ]tFl d ]vFh d ]xFf +d ]{Fd m ]~Fd d ^AFf d ^CFh d ^DFl d ^FFv d ^FF| d ^DGE d ^CGI d ^AGK +d ]~GM m ]pFW m ^WGE d ^YGC d ^WGA d ^VGC d ^VGE d ^WGI d ^YGK d ^^GM +d ^dGM d ^iGK d ^kGG d ^kGA d ^iF~ d ^dF| d ^_F| m ^dGM d ^gGK d ^iGG +d ^iGA d ^gF~ d ^dF| m ^dF| d ^gFz d ^kFv d ^lFr d ^lFl d ^kFh d ^iFf +d ^dFd d ^^Fd d ^YFf d ^WFh d ^VFl d ^VFn d ^WFp d ^YFn d ^WFl m ^iFx +d ^kFr d ^kFl d ^iFh d ^gFf d ^dFd m ^TFW m ^yG[ m ^yFW m _XG[ m _XFW +m _}G@ d _zFd m _?G@ d _}Ft d _|Fj d _zFd m `OG@ d `MFx d `JFp m `PG@ +d `OFz d `MFv d `JFp d `GFl d `BFh d _?Ff d _zFd m _xG@ d _?G@ m _wFW +m ilcf d ipch d itcn d itcE m iscl d iscE m ilcE d i{cE m ifbw m jVcn +d jQcl d jNcf d jLc\ d jLcV d jNcM d jQcG d jVcE d jYcE d j^cG d jacM +d jbcV d jbc\ d jacf d j^cl d jYcn d jVcn m jVcn d jScl d jQcj d jOcf +d jNc\ d jNcV d jOcM d jQcI d jScG d jVcE m jYcE d j\cG d j^cI d j_cM +d jacV d jac\ d j_cf d j^cj d j\cl d jYcn m jKbw m j?cj d j?cE m kAcn +d kAcE m kAcn d jocQ d kIcQ m jzcE d kFcE m jobw m kTc{ m kTbw m ksc{ +m ksbw m lRcX d lRc\ d lUc` d lYc` d l[c^ d l[cZ d lYcS d lVcE m lXc` +d lYc^ d lYcZ d lXcS +stroke +m lXcS d lUcE m lYcS d l\cZ d l_c^ d lbc` d lec` d lhc^ d lic\ d licV +d lhcM d lcbw m lec` d lhc\ d lhcV d lfcM d lbbw m lRbw m ilbW d ipbY +d itb^ d itav m isb] d isav m ilav d i{av m ifah m jVb^ d jQb] d jNbW +d jLbM d jLbG d jNa} d jQax d jVav d jYav d j^ax d jaa} d jbbG d jbbM +d jabW d j^b] d jYb^ d jVb^ m jVb^ d jSb] d jQb[ d jObW d jNbM d jNbG +d jOa} d jQaz d jSax d jVav m jYav d j\ax d j^az d j_a} d jabG d jabM +d j_bW d j^b[ d j\b] d jYb^ m jKah m jtb^ d jqbK m jqbK d jtbO d jybQ +d j~bQ d kBbO d kFbK d kGbE d kGbA d kFa{ d kBax d j~av d jyav d jtax +d jraz d jqa} d jqa? d jrbA d jta? d jra} m j~bQ d kAbO d kDbK d kFbE +d kFbA d kDa{ d kAax d j~av m jtb^ d kDb^ m jtb] d j|b] d kDb^ m joah +m kTbl m kTah m ksbl m ksah m l[bQ d lVbC d lTa{ d lTax d lVav d l]av +d lbaz d lda} m l]bQ d lYbC d lVa{ d lVax d lYav m lRah m ilaG d ipaI +d itaO d it`f m isaM d is`f m il`f d i{`f m if`Y m jVaO d jQaM d jNaG +d jL`~ d jL`x d jN`n d jQ`h d jV`f d jY`f d j^`h d ja`n d jb`x d jb`~ +d jaaG d j^aM d jYaO d jVaO m jVaO d jSaM d jQaK d jOaG d jN`~ d jN`x +d jO`n d jQ`j d jS`h d jV`f m jY`f d j\`h d j^`j d j_`n d ja`x d ja`~ +d j_aG d j^aK d j\aM d jYaO m jK`Y m kDaI d kBaG d kDaE d kFaG d kFaI +d kDaM d kAaO d j|aO d jwaM d jtaI d jraE d jq`~ d jq`r d jr`l d jv`h +d jz`f d j~`f d kB`h d kF`l d kG`r d kG`t d kF`z d kB`~ d j~a@ d j|a@ +d jw`~ d jt`z d jr`t m j|aO d jyaM d jvaI d jtaE d jr`~ d jr`r d jt`l +d jw`h d jz`f m j~`f d kA`h d kD`l d kF`r d kF`t d kD`z d kA`~ d j~a@ +m jo`Y m kTa] m kT`Y m ksa] m ks`Y m lg`x d lf`~ d lda@ d laaB d l]aB +d lXa@ d lU`z d lS`t d lS`n d lU`j d lW`h d lZ`f d l]`f d lb`h d lf`l +d lg`r d li`| d liaE d lgaK d lfaM d lbaO d l]aO d lZaM d lXaK d lXaI +d lZaI d lZaK m l]aB d lZa@ d lW`z d lU`t d lU`l d lW`h m l]`f d la`h +d ld`l d lf`r d lg`| d lgaE d lfaK d lbaO m lR`Y m il_x d ip_z d it`@ +d it_W m is_~ d is_W m il_W d i{_W m if_I m jV`@ d jQ_~ d jN_x d jL_n +d jL_i d jN__ d jQ_Y d jV_W d jY_W d j^_Y d ja__ d jb_i d jb_n d ja_x +d j^_~ d jY`@ d jV`@ m jV`@ d jS_~ d jQ_| d jO_x d jN_n d jN_i d jO__ +d jQ_[ d jS_Y d jV_W m jY_W d j\_Y d j^_[ d j___ d ja_i d ja_n d j__x +d j^_| d j\_~ d jY`@ m jK_I m jq`@ d jq_t m jq_x d jr_| d jv`@ d jy`@ +d kA_z d kD_z d kF_| d kG`@ m jr_| d jv_~ d jy_~ d kA_z m kG`@ d kG_z +d kF_t d j?_j d j~_g d j|_a d j|_W m kF_t d j~_j d j|_g d jz_a d jz_W +m jo_I m kT`M m kT_I m ks`M m ks_I m lX_r d lR_W m lZ_r d lS_W m lh_r +d lj_p d lk_p d lj_r d lf_r d lc_p d l]_i d lZ_g d lW_g m lZ_g d l]_e +d l`_Y d lb_W m lZ_g d l[_e d l^_Y d l`_W d lc_W d lf_Y d lj__ m lR_I +m il^i d ip^k d it^p d it^H m is^o d is^H m il^H d i{^H m if]z m jV^p +d jQ^o d jN^i d jL^_ d jL^Y d jN^O d jQ^J d jV^H d jY^H d j^^J d ja^O +d jb^Y d jb^_ d ja^i d j^^o d jY^p d jV^p m jV^p d jS^o d jQ^m d jO^i +d jN^_ d jN^Y d jO^O d jQ^K d jS^J d jV^H m jY^H d j\^J d j^^K d j_^O +d ja^Y d ja^_ d j_^i d j^^m d j\^o d jY^p m jK]z m jy^p d jt^o d jr^k +d jr^e d jt^a d jy^_ d j?^_ d kD^a d kF^e d kF^k d kD^o d j?^p d jy^p +m jy^p d jv^o d jt^k d jt^e d jv^a d jy^_ m j?^_ d kB^a d kD^e d kD^k +d kB^o d j?^p m jy^_ d jt^] d jr^[ d jq^W d jq^O d jr^K d jt^J d jy^H +d j?^H d kD^J d kF^K d kG^O d kG^W d kF^[ d kD^] d j?^_ m jy^_ d jv^] +d jt^[ d jr^W d jr^O d jt^K d jv^J d jy^H m j?^H d kB^J d kD^K d kF^O +d kF^W d kD^[ d kB^] d j?^_ m jo]z m kT^~ m kT]z m ks^~ m ks]z m lS^p +d lW^p d lZ^o d l[^m d l]^i d lf^M d lh^J d lj^H m lW^p d lZ^m d l[^i +d le^M d lf^J d lj^H d lk^H m l^^c d lR^H m l^^c d lS^H m lR]z m il]Y +d ip][ d it]a d it\x m is]_ d is\x m il\x d i{\x m if\k m jV]a d jQ]_ +d jN]Y d jL]P d jL]J d jN]@ d jQ\z d jV\x d jY\x d j^\z d ja]@ d jb]J +d jb]P d ja]Y d j^]_ d jY]a d jV]a m jV]a d jS]_ d jQ]] d jO]Y d jN]P +d jN]J d jO]@ d jQ\| d jS\z d jV\x m jY\x d j\\z d j^\| d j_]@ d ja]J +d ja]P d j_]Y d j^]] d j\]_ d jY]a m jK\k m kF]S d kD]N d kA]J d j|]H +d jz]H d jv]J d jr]N d jq]S d jq]U d jr][ d jv]_ d jz]a d j~]a d kB]_ +d kF][ d kG]U d kG]J d kF]B d kD\~ d kA\z d j|\x d jw\x d jt\z d jr\~ +d jr]@ d jt]B d jv]@ d jt\~ m jz]H d jw]J d jt]N d jr]S d jr]U d jt][ +d jw]_ d jz]a m j~]a d kA]_ d kD][ d kF]U d kF]J d kD]B d kB\~ d j?\z +d j|\x m jo\k m kT]o m kT\k m ks]o m ks\k m lY]S d lR\k m lZ]S d lR\k +m lY]N d lW]B d lW\| d lZ\x d l]\x d l`\z d lc\~ d lf]D m lh]S d ld\~ +d ld\z d lf\x d lj\x d lm\| d ln]@ m lj]S d lf\~ d lf\z d lg\x m lR\k +m il\J d ip\L d it\R d it[i m is\P d is[i m il[i d i{[i m if[[ m jQ\J +d jT\L d jY\R d jY[i m jW\P d jW[i m jQ[i d j_[i m jK[[ m jz\R d jv\P +d jr\J d jq\@ d jq[{ d jr[q d jv[k d jz[i d j~[i +stroke +m j~[i d kB[k d kF[q d kG[{ d kG\@ d kF\J d kB\P d j~\R d jz\R m jz\R +d jw\P d jv\N d jt\J d jr\@ d jr[{ d jt[q d jv[m d jw[k d jz[i m j~[i +d kA[k d kB[m d kD[q d kF[{ d kF\@ d kD\J d kB\N d kA\P d j~\R m jo[[ +m kT\_ m kT[[ m ks\_ m ks[[ m lX\D d lU[i m lZ\D d lX[y d lW[o d lU[i +m lj\D d lh[| d le[u m lk\D d lj[~ d lh[{ d le[u d lb[q d l][m d lZ[k +d lU[i m lS\D d lZ\D m lR[[ m ilZ{ d ipZ} d it[C d itZZ m is[A d isZZ +m ilZZ d i{ZZ m ifZL m jQZ{ d jTZ} d jY[C d jYZZ m jW[A d jWZZ m jQZZ +d j_ZZ m jKZL m jvZ{ d jyZ} d j~[C d j~ZZ m j|[A d j|ZZ m jvZZ d kDZZ +m joZL m kT[P m kTZL m ks[P m ksZL m l^Zu d lYZs d lUZm d lSZg d lSZa +d lUZ^ d lWZ\ d lZZZ d l^ZZ d lcZ\ d lfZa d lhZg d lhZm d lfZq d leZs +d laZu d l^Zu m l^Zu d lZZs d lWZm d lUZg d lUZ` d lWZ\ m l^ZZ d laZ\ +d leZa d lfZg d lfZo d leZs m lRZL m ilYk d ipYm d itYs d itYJ m isYq +d isYJ m ilYJ d i{YJ m ifX} m jQYk d jTYm d jYYs d jYYJ m jWYq d jWYJ +m jQYJ d j_YJ m jKX} m jrYk d jtYi d jrYg d jqYi d jqYk d jrYo d jtYq +d jyYs d j?Ys d kDYq d kFYo d kGYk d kGYg d kFYd d kAY` d jyY\ d jvYZ +d jrYV d jqYP d jqYJ m j?Ys d kBYq d kDYo d kFYk d kFYg d kDYd d j?Y` +d jyY\ m jqYN d jrYP d jvYP d j~YL d kBYL d kFYN d kGYP m jvYP d j~YJ +d kDYJ d kFYL d kGYP d kGYT m joX} m kTZA m kTX} m ksZA m ksX} m l\Yd +d lVYJ m l\Yd d lXYJ m leYd d leYJ m leYd d lfYJ m lRY` d lUYd d lYYe +d llYe m lRY` d lUYb d lYYd d llYd m lRX} m ilX\ d ipX^ d itXd d itW{ +m isXb d isW{ m ilW{ d i{W{ m ifWm m jQX\ d jTX^ d jYXd d jYW{ m jWXb +d jWW{ m jQW{ d j_W{ m jKWm m jrX\ d jtXZ d jrXX d jqXZ d jqX\ d jrX` +d jtXb d jyXd d j?Xd d kDXb d kFX^ d kFXX d kDXT d j?XR d jzXR m j?Xd +d kBXb d kDX^ d kDXX d kBXT d j?XR m j?XR d kBXP d kFXM d kGXI d kGXC +d kFW? d kDW} d j?W{ d jyW{ d jtW} d jrW? d jqXC d jqXE d jrXG d jtXE +d jrXC m kDXN d kFXI d kFXC d kDW? d kBW} d j?W{ m joWm m kTXq m kTWm +m ksXq m ksWm m lRXN d lRXR d lUXV d lYXV d lZXT d lZXP d lYXG d lYXA +d lZW} d l\W{ m lWXV d lYXT d lYXP d lWXG d lWXA d lYW} d l\W{ d l^W{ +d laW} d ldXA d lgXG d lhXM d ljXV d ljX^ d lhXb d lfXd d lcXd d l`X` +d l`X\ d laXV d ldXP d lgXM d lkXI m laW} d ldXC d lfXG d lgXM d lhXV +d lhX^ d lgXb d lfXd m lRWm m ilWM d ipWO d itWT d itVl m isWS d isVl +m ilVl d i{Vl m ifV^ m jQWM d jTWO d jYWT d jYVl m jWWS d jWVl m jQVl +d j_Vl m jKV^ m j?WQ d j?Vl m kAWT d kAVl m kAWT d joVw d kIVw m jzVl +d kFVl m joV^ m kTWb m kTV^ m ksWb m ksV^ m lUVu d lWVp d lXVn d l\Vl +d l_Vl d ldVn d lgVs d liVy d liV? d lgWC d lfWE d lbWG d l_WG d lZWE +d lWV? d lUVy d lRV^ m l_Vl d lbVn d lfVs d lgVy d lgWA d lfWE m l_WG +d l\WE d lXV? d lWVy d lRV^ m lRV^ m ilU} d ipU? d itVE d itU\ m isVC +d isU\ m ilU\ d i{U\ m ifUO m jQU} d jTU? d jYVE d jYU\ m jWVC d jWU\ +m jQU\ d j_U\ m jKUO m jtVE d jqUr m jqUr d jtUv d jyUx d j~Ux d kBUv +d kFUr d kGUl d kGUh d kFUb d kBU^ d j~U\ d jyU\ d jtU^ d jrU` d jqUd +d jqUf d jrUh d jtUf d jrUd m j~Ux d kAUv d kDUr d kFUl d kFUh d kDUb +d kAU^ d j~U\ m jtVE d kDVE m jtVC d j|VC d kDVE m joUO m kTVS m kTUO +m ksVS m ksUO m llUx d l\Ux d lXUv d lUUp d lSUj d lSUd d lUU` d lVU^ +d lYU\ d l\U\ d laU^ d ldUd d lfUj d lfUp d ldUt d lcUv d l_Ux m l\Ux +d lYUv d lVUp d lUUj d lUUb d lVU^ m l\U\ d l_U^ d lcUd d ldUj d ldUr +d lcUv m lcUv d llUv m lRUO m ilTn d ipTp d itTv d itTM m isTt d isTM +m ilTM d i{TM m ifS? m jQTn d jTTp d jYTv d jYTM m jWTt d jWTM m jQTM +d j_TM m jKS? m kDTp d kBTn d kDTl d kFTn d kFTp d kDTt d kATv d j|Tv +d jwTt d jtTp d jrTl d jqTd d jqTY d jrTS d jvTO d jzTM d j~TM d kBTO +d kFTS d kGTY d kGT[ d kFT` d kBTd d j~Tf d j|Tf d jwTd d jtT` d jrT[ +m j|Tv d jyTt d jvTp d jtTl d jrTd d jrTY d jtTS d jwTO d jzTM m j~TM +d kATO d kDTS d kFTY d kFT[ d kDT` d kATd d j~Tf m joS? m kTUC m kTS? +m ksUC m ksS? m l`Tf d l[TM m l`Tf d l]TM m lRTb d lUTf d lZTh d lkTh +m lRTb d lUTd d lZTf d lkTf m lRS? m ilS_ d ipSa d itSf d itR~ m isSe +d isR~ m ilR~ d i{R~ m ifRp m jQS_ d jTSa d jYSf d jYR~ m jWSe d jWR~ +m jQR~ d j_R~ m jKRp m jqSf d jqS[ m jqS_ d jrSc d jvSf d jySf d kASa +d kDSa d kFSc d kGSf m jrSc d jvSe d jySe d kASa m kGSf d kGSa d kFS[ +d j?SQ d j~SM d j|SG d j|R~ m kFS[ d j~SQ d j|SM d jzSG d jzR~ m joRp +m kTSt m kTRp m ksSt m ksRp m lRSQ d lRSU d lUSY d lZSY d l[SW d l[SS +d lXSG d lXSB d l[R~ m lXSY d lZSW d lZSS d lWSG d lWSB d lXS@ d l[R~ +d l]R~ d lbS@ d leSC d lhSI d ljSO d ljSU d lhSY d lfSW d lhSU d ljSO +m lhSI d ljSU m lRRp m ilRO d ipRQ d itRW d itQn m isRU d isQn m ilQn +d i{Qn m ifQa m jQRO d jTRQ d jYRW d jYQn m jWRU d jWQn m jQQn d j_Qn +m jKQa m jyRW d jtRU d jrRQ d jrRK d jtRH d jyRF d j?RF d kDRH d kFRK +d kFRQ d kDRU d j?RW d jyRW m jyRW d jvRU d jtRQ d jtRK d jvRH d jyRF +m j?RF d kBRH d kDRK d kDRQ d kBRU d j?RW m jyRF d jtRD d jrRB d jqQ~ +d jqQv d jrQr d jtQp d jyQn d j?Qn d kDQp d kFQr d kGQv d kGQ~ d kFRB +d kDRD d j?RF m jyRF d jvRD d jtRB d jrQ~ d jrQv d jtQr d jvQp d jyQn +m j?Qn d kBQp d kDQr d kFQv d kFQ~ d kDRB d kBRD d j?RF m joQa m kTRe +m kTQa m ksRe m ksQa m lRRe m lRQa m ilQ@ d ipQB d itQH d itP_ m isQF +d isP_ m ilP_ d i{P_ +stroke +m i{P_ m ifPQ m jQQ@ d jTQB d jYQH d jYP_ m jWQF d jWP_ m jQP_ d j_P_ +m jKPQ m kFPz d kDPt d kAPq d j|Po d jzPo d jvPq d jrPt d jqPz d jqP| +d jrQB d jvQF d jzQH d j~QH d kBQF d kFQB d kGP| d kGPq d kFPi d kDPe +d kAPa d j|P_ d jwP_ d jtPa d jrPe d jrPg d jtPi d jvPg d jtPe m jzPo +d jwPq d jtPt d jrPz d jrP| d jtQB d jwQF d jzQH m j~QH d kAQF d kDQB +d kFP| d kFPq d kDPi d kBPe d j?Pa d j|P_ m joPQ m kTQU m kTPQ m ksQU +m ksPQ m lUPr d lWPv d l\Px d lZPz d lWPx d lUPr d lSPm d lSPg d lUPa +d lVP_ d lYP_ d l\Pa d l^Pg d l`Pm m lSPg d lUPc d lVPa d lYPa d l\Pc +d l^Pg m l^Pm d l^Pg d l`Pa d laP_ d ldP_ d lgPa d ljPg d lkPm d lkPr +d ljPx d lhPz d lgPx d ljPv d lkPr m l^Pg d l`Pc d laPa d ldPa d lgPc +d ljPg m lRPQ m ilOq d ipOs d itOy d itOP m isOw d isOP m ilOP d i{OP +m ifOB m jNOq d jOOo d jNOm d jLOo d jLOq d jNOu d jOOw d jTOy d j[Oy +d j_Ow d jaOu d jbOq d jbOm d jaOi d j\Oe d jTOa d jQO_ d jNO[ d jLOV +d jLOP m j[Oy d j^Ow d j_Ou d jaOq d jaOm d j_Oi d j[Oe d jTOa m jLOT +d jNOV d jQOV d jYOR d j^OR d jaOT d jbOV m jQOV d jYOP d j_OP d jaOR +d jbOV d jbOY m jKOB m jzOy d jvOw d jrOq d jqOg d jqOa d jrOW d jvOR +d jzOP d j~OP d kBOR d kFOW d kGOa d kGOg d kFOq d kBOw d j~Oy d jzOy +m jzOy d jwOw d jvOu d jtOq d jrOg d jrOa d jtOW d jvOT d jwOR d jzOP +m j~OP d kAOR d kBOT d kDOW d kFOa d kFOg d kDOq d kBOu d kAOw d j~Oy +m joOB m kTPF m kTOB m ksPF m ksOB m lbOy d l^Ow d l]Ou d l]Os d l^Oq +d ldOo d liOo m ldOo d l]Om d lYOk d lWOg d lWOc d l[O_ d l`O] d lfO] +m ldOo d l^Om d l[Ok d lYOg d lYOc d l]O_ d l`O] m l`O] d lYO[ d lUOY +d lTOV d lTOR d lWON d l`OJ d lbOH d lbOD d l^OB d l[OB m l`O] d l[O[ +d lWOY d lUOV d lUOR d lYON d l`OJ m lROB m ilNa d ipNc d itNi d itN@ +m isNg d isN@ m ilN@ d i{N@ m ifMs m jNNa d jON_ d jNN] d jLN_ d jLNa +d jNNe d jONg d jTNi d j[Ni d j_Ng d jaNe d jbNa d jbN] d jaNZ d j\NV +d jTNR d jQNP d jNNL d jLNF d jLN@ m j[Ni d j^Ng d j_Ne d jaNa d jaN] +d j_NZ d j[NV d jTNR m jLND d jNNF d jQNF d jYNB d j^NB d jaND d jbNF +m jQNF d jYN@ d j_N@ d jaNB d jbNF d jbNJ m jKMs m jvNa d jyNc d j~Ni +d j~N@ m j|Ng d j|N@ m jvN@ d kDN@ m joMs m kTNw m kTMs m ksNw m ksMs +m ldNi d l\Ms m lfNi d lZMs m lRNT d lRNX d lUN[ d lYN[ d lZNZ d lZNV +d lYNL d lYNF d l\NB d l`NB d lcND d lgNJ d ljNP m lWN[ d lYNZ d lYNV +d lWNL d lWNF d lYNB d l\N@ d l`N@ d lcNB d lfNF d lhNL d ljNP d lmN[ +m lRMs m ilMR d ipMT d itMZ d itLq m isMX d isLq m ilLq d i{Lq m ifLc +m jNMR d jOMP d jNMN d jLMP d jLMR d jNMV d jOMX d jTMZ d j[MZ d j_MX +d jaMV d jbMR d jbMN d jaMJ d j\MF d jTMC d jQMA d jNL} d jLLw d jLLq +m j[MZ d j^MX d j_MV d jaMR d jaMN d j_MJ d j[MF d jTMC m jLLu d jNLw +d jQLw d jYLs d j^Ls d jaLu d jbLw m jQLw d jYLq d j_Lq d jaLs d jbLw +d jbL{ m jKLc m jrMR d jtMP d jrMN d jqMP d jqMR d jrMV d jtMX d jyMZ +d j?MZ d kDMX d kFMV d kGMR d kGMN d kFMJ d kAMF d jyMC d jvMA d jrL} +d jqLw d jqLq m j?MZ d kBMX d kDMV d kFMR d kFMN d kDMJ d j?MF d jyMC +m jqLu d jrLw d jvLw d j~Ls d kBLs d kFLu d kGLw m jvLw d j~Lq d kDLq +d kFLs d kGLw d kGL{ m joLc m kTMg m kTLc m ksMg m ksLc m laMZ d l^MX +d l\MV d l\MT d l^MR d lcMP d llMP d llMR d lfMP d l`ML d lZMH d lUMC +d lSL} d lSLy d lULu d lZLq d l`Lm d laLi d laLe d l`Lc d l\Lc d lZLe +m lcMN d l\MH d lWMC d lUL} d lULy d lWLu d lZLq m lRLc m ilLC d ipLE +d itLK d itKb m isLI d isKb m ilKb d i{Kb m ifKT m jNLC d jOLA d jNK? +d jLLA d jLLC d jNLG d jOLI d jTLK d j[LK d j_LI d jaLG d jbLC d jbK? +d jaK{ d j\Kw d jTKs d jQKq d jNKm d jLKg d jLKb m j[LK d j^LI d j_LG +d jaLC d jaK? d j_K{ d j[Kw d jTKs m jLKf d jNKg d jQKg d jYKd d j^Kd +d jaKf d jbKg m jQKg d jYKb d j_Kb d jaKd d jbKg d jbKk m jKKT m jrLC +d jtLA d jrK? d jqLA d jqLC d jrLG d jtLI d jyLK d j?LK d kDLI d kFLE +d kFK? d kDK{ d j?Ky d jzKy m j?LK d kBLI d kDLE d kDK? d kBK{ d j?Ky +m j?Ky d kBKw d kFKs d kGKo d kGKi d kFKf d kDKd d j?Kb d jyKb d jtKd +d jrKf d jqKi d jqKk d jrKm d jtKk d jrKi m kDKu d kFKo d kFKi d kDKf +d kBKd d j?Kb m joKT m kTLX m kTKT m ksLX m ksKT m l`LR d l\LP d lZLN +d lXLK d lXLG d lZLC d l\LA d l^K} d l^Ky d lZKu m l\LP d lZLL d lZLI +d l\LE d l^LC d l`K? d l`K{ d l^Kw d lVKs d l^Ko d l`Kk d l`Kg d l^Kd +d l\Kb d lZK^ d lZKZ d l\KV m lZKq d l^Km d l^Ki d l\Kf d lZKd d lXK` +d lXK\ d lZKX d l\KV d l`KT m lRKT m ilJs d ipJu d itJ{ d itJR m isJy +d isJR m ilJR d i{JR m ifJE m jNJs d jOJq d jNJo d jLJq d jLJs d jNJw +d jOJy d jTJ{ d j[J{ d j_Jy d jaJw d jbJs d jbJo d jaJl d j\Jh d jTJd +d jQJb d jNJ^ d jLJX d jLJR m j[J{ d j^Jy +stroke +m j^Jy d j_Jw d jaJs d jaJo d j_Jl d j[Jh d jTJd m jLJV d jNJX d jQJX +d jYJT d j^JT d jaJV d jbJX m jQJX d jYJR d j_JR d jaJT d jbJX d jbJ\ +m jKJE m j?Jw d j?JR m kAJ{ d kAJR m kAJ{ d joJ^ d kIJ^ m jzJR d kFJR +m joJE m kTKI m kTJE m ksKI m ksJE m lVKC d lVJE m lbKC d lbJE m lRJE +m ilId d ipIf d itIl d itIC m isIj d isIC m ilIC d i{IC m ifHu m jNId +d jOIb d jNI` d jLIb d jLId d jNIh d jOIj d jTIl d j[Il d j_Ij d jaIh +d jbId d jbI` d jaI\ d j\IX d jTIT d jQIS d jNIO d jLII d jLIC m j[Il +d j^Ij d j_Ih d jaId d jaI` d j_I\ d j[IX d jTIT m jLIG d jNII d jQII +d jYIE d j^IE d jaIG d jbII m jQII d jYIC d j_IC d jaIE d jbII d jbIM +m jKHu m jtIl d jqIX m jqIX d jtI\ d jyI^ d j~I^ d kBI\ d kFIX d kGIS +d kGIO d kFII d kBIE d j~IC d jyIC d jtIE d jrIG d jqIK d jqIM d jrIO +d jtIM d jrIK m j~I^ d kAI\ d kDIX d kFIS d kFIO d kDII d kAIE d j~IC +m jtIl d kDIl m jtIj d j|Ij d kDIl m joHu m kTIy m kTHu m ksIy m ksHu +m lXIt d l\Ir d l^Ip d l`Il d l`Ih d l^Id d l\Ib d lZI^ d lZIZ d l^IV +m l\Ir d l^In d l^Ij d l\If d lZId d lXI` d lXI\ d lZIX d lbIT d lZIQ +d lXIM d lXII d lZIE d l\IC d l^H? d l^H{ d l\Hw m l^IS d lZIO d lZIK +d l\IG d l^IE d l`IA d l`H} d l^Hy d l\Hw d lXHu m lRHu m ilHU d ipHW +d itH\ d itGt m isH[ d isGt m ilGt d i{Gt m ifGf m jNHU d jOHS d jNHQ +d jLHS d jLHU d jNHY d jOH[ d jTH\ d j[H\ d j_H[ d jaHY d jbHU d jbHQ +d jaHM d j\HI d jTHE d jQHC d jNG? d jLGy d jLGt m j[H\ d j^H[ d j_HY +d jaHU d jaHQ d j_HM d j[HI d jTHE m jLGx d jNGy d jQGy d jYGv d j^Gv +d jaGx d jbGy m jQGy d jYGt d j_Gt d jaGv d jbGy d jbG} m jKGf m kDHW +d kBHU d kDHS d kFHU d kFHW d kDH[ d kAH\ d j|H\ d jwH[ d jtHW d jrHS +d jqHK d jqG? d jrGy d jvGv d jzGt d j~Gt d kBGv d kFGy d kGG? d kGHA +d kFHG d kBHK d j~HM d j|HM d jwHK d jtHG d jrHA m j|H\ d jyH[ d jvHW +d jtHS d jrHK d jrG? d jtGy d jwGv d jzGt m j~Gt d kAGv d kDGy d kFG? +d kFHA d kDHG d kAHK d j~HM m joGf m kTHj m kTGf m ksHj m ksGf m lXHI +d lTHE d lXHA m l\HO d lVHE d l\G{ m lVHE d lkHE m lRGf m ilGE d ipGG +d itGM d itFd m isGK d isFd m ilFd d i{Fd m ifFW m jNGE d jOGC d jNGA +d jLGC d jLGE d jNGI d jOGK d jTGM d j[GM d j_GK d jaGI d jbGE d jbGA +d jaF~ d j\Fz d jTFv d jQFt d jNFp d jLFj d jLFd m j[GM d j^GK d j_GI +d jaGE d jaGA d j_F~ d j[Fz d jTFv m jLFh d jNFj d jQFj d jYFf d j^Ff +d jaFh d jbFj m jQFj d jYFd d j_Fd d jaFf d jbFj d jbFn m jKFW m jqGM +d jqGA m jqGE d jrGI d jvGM d jyGM d kAGG d kDGG d kFGI d kGGM m jrGI +d jvGK d jyGK d kAGG m kGGM d kGGG d kFGA d j?Fx d j~Ft d j|Fn d j|Fd +m kFGA d j~Fx d j|Ft d jzFn d jzFd m joFW m kTG[ m kTFW m ksG[ m ksFW +m Fwcf d Fwcd d Fycd d Fycf d Fwcf m Fwch d Fych d Fzcf d Fzcd d Fycb +d Fwcb d Fvcd d Fvcf d Fwcj d Fycl d F~cn d GDcn d GIcl d GJch d GJcb +d GIc^ d GDc\ m GGcl d GIch d GIcb d GGc^ m GBcn d GEcl d GGch d GGcb +d GEc^ d GBc\ m F?c\ d GDc\ d GGcZ d GJcV d GLcS d GLcM d GJcI d GIcG +d GDcE d F~cE d FycG d FwcI d FvcM d FvcO d FwcQ d FycQ d FzcO d FzcM +d FycK d FwcK m GIcV d GJcS d GJcM d GIcI m GBc\ d GEcZ d GGcX d GIcS +d GIcM d GGcG d GDcE m FwcO d FwcM d FycM d FycO d FwcO m Ftbw m G\cf +d G\cd d G]cd d G]cf d G\cf m G\ch d G]ch d G_cf d G_cd d G]cb d G\cb +d GZcd d GZcf d G\cj d G]cl d Gbcn d Gicn d Gmcl d Gocj d Gpcf d Gpcb +d Goc^ d GjcZ d GbcV d G_cU d G\cQ d GZcK d GZcE m Gmcj d Gocf d Gocb +d Gmc^ m Gicn d Glcl d Gmcf d Gmcb d Glc^ d GicZ d GbcV m GZcI d G\cK +d G_cK d GgcI d GmcI d GpcK m G_cK d GgcG d GmcG d GocI m G_cK d GgcE +d GmcE d GocG d GpcK d GpcO m GYbw m G}c{ m G}bw m H\c{ m H\bw m FwbW +d FwbU d FybU d FybW d FwbW m FwbY d FybY d FzbW d FzbU d FybS d FwbS +d FvbU d FvbW d Fwb[ d Fyb] d F~b^ d GDb^ d GIb] d GJbY d GJbS d GIbO +d GDbM m GGb] d GIbY d GIbS d GGbO m GBb^ d GEb] d GGbY d GGbS d GEbO +d GBbM m F?bM d GDbM d GGbK d GJbG d GLbC d GLa} d GJaz d GIax d GDav +d F~av d Fyax d Fwaz d Fva} d Fva? d FwbA d FybA d Fza? d Fza} d Fya{ +d Fwa{ m GIbG d GJbC d GJa} d GIaz m GBbM d GEbK d GGbI d GIbC d GIa} +d GGax d GDav m Fwa? d Fwa} d Fya} d Fya? d Fwa? m Ftah m G\bW d G\bU +d G]bU d G]bW d G\bW m G\bY d G]bY d G_bW d G_bU d G]bS d G\bS d GZbU +d GZbW d G\b[ d G]b] d Gbb^ d Gib^ d Gmb] d GobY d GobS d GmbO d GibM +m Glb] d GmbY d GmbS d GlbO m Ggb^ d Gjb] d GlbY d GlbS d GjbO d GgbM +m GdbM d GibM d GlbK d GobG d GpbC d Gpa} d Goaz d Gmax d Giav d Gbav +d G]ax d G\az d GZa} d GZa? d G\bA d G]bA d G_a? d G_a} d G]a{ d G\a{ +m GmbG d GobC d Goa} d Gmaz m GgbM d GjbK d GlbI d GmbC d Gma} d Glax +d Giav m G\a? d G\a} d G]a} d G]a? d G\a? m GYah m G}bl m G}ah m H\bl +m H\ah m H{bl m H{ah m IZbl m IZah m Iybl m Iyah m J_b^ d J]b] d J]bY +d J_bI m J_b^ d J_bC +stroke +m J_bC d JbbC m J_b^ d Jbb^ d JbbC m Jbb^ d Jdb] d JdbY d JbbI m J_a{ +d J]az d J]ax d J_av d Jbav d Jdax d Jdaz d Jba{ d J_a{ m J_az d J_ax +d Jbax d Jbaz d J_az m JXah m FwaG d FwaE d FyaE d FyaG d FwaG m FwaI +d FyaI d FzaG d FzaE d FyaC d FwaC d FvaE d FvaG d FwaK d FyaM d F~aO +d GDaO d GIaM d GJaI d GJaC d GIa@ d GD`~ m GGaM d GIaI d GIaC d GGa@ +m GBaO d GEaM d GGaI d GGaC d GEa@ d GB`~ m F?`~ d GD`~ d GG`| d GJ`x +d GL`t d GL`n d GJ`j d GI`h d GD`f d F~`f d Fy`h d Fw`j d Fv`n d Fv`p +d Fw`r d Fy`r d Fz`p d Fz`n d Fy`l d Fw`l m GI`x d GJ`t d GJ`n d GI`j +m GB`~ d GE`| d GG`z d GI`t d GI`n d GG`h d GD`f m Fw`p d Fw`n d Fy`n +d Fy`p d Fw`p m Ft`Y m GgaI d Gg`f m GiaK d Gi`h m GjaO d Gj`f m GjaO +d GY`r d Gr`r m Gb`f d Go`f m Gg`h d Gd`f m Gg`j d Ge`f m Gj`j d Gl`f +m Gj`h d Gm`f m GY`Y m G}a] m G}`Y m H\a] m H\`Y m H{a] m H{`Y m IZa] +m IZ`Y m Iya] m Iy`Y m J]aO d J[aM d J[aB m J]aM d J[aB m J]aO d J_aM +d J[aB m JlaO d JkaM d JkaB m JlaM d JkaB m JlaO d JnaM d JkaB m JX`Y +m Fw_x d Fw_v d Fy_v d Fy_x d Fw_x m Fw_z d Fy_z d Fz_x d Fz_v d Fy_t +d Fw_t d Fv_v d Fv_x d Fw_| d Fy_~ d F~`@ d GD`@ d GI_~ d GJ_z d GJ_t +d GI_p d GD_n m GG_~ d GI_z d GI_t d GG_p m GB`@ d GE_~ d GG_z d GG_t +d GE_p d GB_n m F?_n d GD_n d GG_l d GJ_i d GL_e d GL__ d GJ_[ d GI_Y +d GD_W d F~_W d Fy_Y d Fw_[ d Fv__ d Fv_a d Fw_c d Fy_c d Fz_a d Fz__ +d Fy_] d Fw_] m GI_i d GJ_e d GJ__ d GI_[ m GB_n d GE_l d GG_j d GI_e +d GI__ d GG_Y d GD_W m Fw_a d Fw__ d Fy__ d Fy_a d Fw_a m Ft_I m G]`@ +d GZ_l d G]_p d Gb_r d Gg_r d Gl_p d Go_l d Gp_g d Gp_c d Go_] d Gl_Y +d Gg_W d Gb_W d G]_Y d G\_[ d GZ__ d GZ_a d G\_c d G]_c d G__a d G___ +d G]_] d G\_] m Gm_l d Go_i d Go_a d Gm_] m Gg_r d Gj_p d Gl_n d Gm_i +d Gm_a d Gl_[ d Gj_Y d Gg_W m G\_a d G\__ d G]__ d G]_a d G\_a m G]`@ +d Gm`@ m G]_~ d Gj_~ m G]_| d Gd_| d Gj_~ d Gm`@ m GY_I m G}`M m G}_I +m H\`M m H\_I m H{`M m H{_I m IZ`M m IZ_I m Iy`M m Iy_I m Je`@ d J[_I +m Jn`@ d Jd_I m J[_j d Jp_j m JY__ d Jn__ m JX_I m Fw^i d Fw^g d Fy^g +d Fy^i d Fw^i m Fw^k d Fy^k d Fz^i d Fz^g d Fy^e d Fw^e d Fv^g d Fv^i +d Fw^m d Fy^o d F~^p d GD^p d GI^o d GJ^k d GJ^e d GI^a d GD^_ m GG^o +d GI^k d GI^e d GG^a m GB^p d GE^o d GG^k d GG^e d GE^a d GB^_ m F?^_ +d GD^_ d GG^] d GJ^Y d GL^U d GL^O d GJ^K d GI^J d GD^H d F~^H d Fy^J +d Fw^K d Fv^O d Fv^Q d Fw^S d Fy^S d Fz^Q d Fz^O d Fy^M d Fw^M m GI^Y +d GJ^U d GJ^O d GI^K m GB^_ d GE^] d GG^[ d GI^U d GI^O d GG^J d GD^H +m Fw^Q d Fw^O d Fy^O d Fy^Q d Fw^Q m Ft]z m Gl^k d Gl^i d Gm^i d Gm^k +d Gl^k m Gm^m d Gl^m d Gj^k d Gj^i d Gl^g d Gm^g d Go^i d Go^k d Gm^o +d Gj^p d Ge^p d Ga^o d G]^k d G\^g d GZ^_ d GZ^S d G\^M d G_^J d Gd^H +d Gg^H d Gl^J d Go^M d Gp^S d Gp^U d Go^[ d Gl^_ d Gg^a d Gd^a d Ga^_ +d G_^] d G]^Y m G_^k d G]^g d G\^_ d G\^S d G]^M d G_^K m Gm^M d Go^Q +d Go^W d Gm^[ m Ge^p d Gb^o d Ga^m d G_^i d G]^a d G]^S d G_^M d Ga^J +d Gd^H m Gg^H d Gj^J d Gl^K d Gm^Q d Gm^W d Gl^] d Gj^_ d Gg^a m GY]z +m G}^~ m G}]z m H\^~ m H\]z m H{^~ m H{]z m IZ^~ m IZ]z m Iy^~ m Iy]z +m Ja^x d Ja^@ m Jg^x d Jg^@ m Jn^g d Jn^i d Jl^i d Jl^e d Jo^e d Jo^i +d Jn^m d Jl^o d Jg^p d Ja^p d J\^o d JY^k d JY^e d J[^a d J`^] d Ji^Y +d Jl^W d Jn^S d Jn^M d Jl^J m J[^e d J\^a d J`^_ d Ji^[ d Jl^Y d Jn^U +m J\^o d J[^k d J[^g d J\^c d J`^a d Ji^] d Jn^Y d Jo^U d Jo^O d Jn^K +d Jl^J d Jg^H d Ja^H d J\^J d J[^K d JY^O d JY^S d J\^S d J\^O d J[^O +d J[^Q m JX]z m Fw]Y d Fw]W d Fy]W d Fy]Y d Fw]Y m Fw][ d Fy][ d Fz]Y +d Fz]W d Fy]U d Fw]U d Fv]W d Fv]Y d Fw]] d Fy]_ d F~]a d GD]a d GI]_ +d GJ][ d GJ]U d GI]R d GD]P m GG]_ d GI][ d GI]U d GG]R m GB]a d GE]_ +d GG][ d GG]U d GE]R d GB]P m F?]P d GD]P d GG]N d GJ]J d GL]F d GL]@ +d GJ\| d GI\z d GD\x d F~\x d Fy\z d Fw\| d Fv]@ d Fv]B d Fw]D d Fy]D +d Fz]B d Fz]@ d Fy\~ d Fw\~ m GI]J d GJ]F d GJ]@ d GI\| m GB]P d GE]N +d GG]L d GI]F d GI]@ d GG\z d GD\x m Fw]B d Fw]@ d Fy]@ d Fy]B d Fw]B +m Ft\k m GZ]a d GZ]U m Gp]a d Gp][ d Go]U d Gi]L d Gg]H d Ge]@ d Ge\x +m Gg]J d Ge]F d Gd]@ d Gd\x m Go]U d Gg]L d Gd]F d Gb]@ d Gb\x d Ge\x +m GZ]Y d G\]] d G_]a d Gb]a d Gj][ d Gm][ d Go]] d Gp]a m G]]] d G_]_ +d Gb]_ d Ge]] m GZ]Y d G\][ d G_]] d Gb]] d Gj][ m GY\k m G}]o m G}\k +m H\]o m H\\k m H{]o m H{\k m IZ]o m IZ\k m Iy]o m Iy\k m Jr]a d JY\x +m J`]a d Jc]] d Jc]Y d Ja]U d J^]S d J\]S d JY]W d JY][ d JZ]_ d J]]a +d J`]a d Jc]_ d Jg]] d Jk]] d Jo]_ d Jr]a m Jl]F d Ji]D d Jh]@ d Jh\| +d Jk\x d Jn\x d Jp\z d Jr\~ d Jr]B d Jo]F d Jl]F m JX\k m Fw\J d Fw\H +d Fy\H d Fy\J d Fw\J m Fw\L d Fy\L d Fz\J d Fz\H d Fy\F d Fw\F d Fv\H +d Fv\J d Fw\N d Fy\P d F~\R d GD\R d GI\P d GJ\L d GJ\F d GI\B d GD\@ +m GG\P d GI\L d GI\F d GG\B m GB\R d GE\P d GG\L d GG\F d GE\B d GB\@ +m F?\@ d GD\@ d GG[~ d GJ[{ d GL[w +stroke +m GL[w d GL[q d GJ[m d GI[k d GD[i d F~[i d Fy[k d Fw[m d Fv[q d Fv[s +d Fw[u d Fy[u d Fz[s d Fz[q d Fy[o d Fw[o m GI[{ d GJ[w d GJ[q d GI[m +m GB\@ d GE[~ d GG[| d GI[w d GI[q d GG[k d GD[i m Fw[s d Fw[q d Fy[q +d Fy[s d Fw[s m Ft[[ m Gb\R d G]\P d G\\L d G\\F d G]\B d Gb\@ d Gi\@ +d Gm\B d Go\F d Go\L d Gm\P d Gi\R d Gb\R m G_\P d G]\L d G]\F d G_\B +m Gl\B d Gm\F d Gm\L d Gl\P m Gb\R d Ga\P d G_\L d G_\F d Ga\B d Gb\@ +m Gi\@ d Gj\B d Gl\F d Gl\L d Gj\P d Gi\R m Gb\@ d G][~ d G\[| d GZ[y +d GZ[q d G\[m d G][k d Gb[i d Gi[i d Gm[k d Go[m d Gp[q d Gp[y d Go[| +d Gm[~ d Gi\@ m G][| d G\[y d G\[q d G][m m Gm[m d Go[q d Go[y d Gm[| +m Gb\@ d G_[~ d G][y d G][q d G_[k d Gb[i m Gi[i d Gl[k d Gm[q d Gm[y +d Gl[~ d Gi\@ m GY[[ m G}\_ m G}[[ m H\\_ m H\[[ m H{\_ m H{[[ m IZ\_ +m IZ[[ m Iy\_ m Iy[[ m Jq\@ d Jq\B d Jp\B d Jp[~ d Js[~ d Js\B d Jq\D +d Jp\D d Jo\B d Jm[~ d Jk[u d Jh[o d Jf[k d Jc[i d J^[i d J[[k d JZ[o +d JZ[u d J[[y d Jc\@ d Jf\D d Jg\H d Jg\L d Jf\P d Jc\R d Ja\P d J_\L +d J_\F d Ja\@ d Jc[{ d Jh[q d Jl[k d Jo[i d Jq[i d Js[m d Js[o m J][k +d J[[o d J[[u d J][y d J^[{ m Jf\D d Jg\L m Jg\H d Jf\P m Ja\P d J_\H +m Ja\B d Jc[| d Jh[s d Jl[m d Jo[k m Ja[i d J^[k d J][o d J][u d J^[y +d Jc\@ m J_\L d Ja\D d Jd[| d Jj[s d Jm[m d Jp[k d Jq[k d Js[m m JX[[ +m FwZ{ d FwZy d FyZy d FyZ{ d FwZ{ m FwZ} d FyZ} d FzZ{ d FzZy d FyZw +d FwZw d FvZy d FvZ{ d FwZ? d Fy[A d F~[C d GD[C d GI[A d GJZ} d GJZw +d GIZs d GDZq m GG[A d GIZ} d GIZw d GGZs m GB[C d GE[A d GGZ} d GGZw +d GEZs d GBZq m F?Zq d GDZq d GGZo d GJZk d GLZg d GLZa d GJZ^ d GIZ\ +d GDZZ d F~ZZ d FyZ\ d FwZ^ d FvZa d FvZc d FwZe d FyZe d FzZc d FzZa +d FyZ` d FwZ` m GIZk d GJZg d GJZa d GIZ^ m GBZq d GEZo d GGZm d GIZg +d GIZa d GGZ\ d GDZZ m FwZc d FwZa d FyZa d FyZc d FwZc m FtZL m G]Za +d G]Z` d G_Z` d G_Za d G]Za m GmZq d GlZm d GjZk d GgZi d GdZi d G_Zk +d G\Zo d GZZu d GZZw d G\Z} d G_[A d Gd[C d Gg[C d Gl[A d GoZ} d GpZw +d GpZk d GoZc d GmZ` d GjZ\ d GeZZ d GaZZ d G]Z\ d G\Z` d G\Za d G]Zc +d G_Zc d GaZa d GaZ` d G_Z^ d G]Z^ m G]Zo d G\Zs d G\Zy d G]Z} m GlZ? +d GmZ} d GoZw d GoZk d GmZc d GlZ` m GdZi d GaZk d G_Zm d G]Zs d G]Zy +d G_Z? d Ga[A d Gd[C m Gg[C d Gj[A d GlZ} d GmZw d GmZi d GlZa d GjZ^ +d GiZ\ d GeZZ m GYZL m G}[P m G}ZL m H\[P m H\ZL m H{[P m H{ZL m IZ[P +m IZZL m Iy[P m IyZL m JdZ? d JbZ} d J_Z} d J]Z? d J][A d J_[C d Jb[C +d Jd[A d JdZ{ d JbZw d J]Zu m J_[A d J_Z? d JbZ? d Jb[A d J_[A m JbZ} +d JdZ{ m JdZ? d JbZw m JXZL m GBYm d GBYJ m GDYo d GDYL m GEYs d GEYJ +m GEYs d FtYV d GMYV m F~YJ d GJYJ m GBYL d F?YJ m GBYN d GAYJ m GEYN +d GGYJ m GEYL d GIYJ m FtX} m GdYs d G_Yq d G\Yk d GZYb d GZY\ d G\YR +d G_YL d GdYJ d GgYJ d GlYL d GoYR d GpY\ d GpYb d GoYk d GlYq d GgYs +d GdYs m G_Yo d G]Yk d G\Yd d G\YZ d G]YR d G_YN m GlYN d GmYR d GoYZ +d GoYd d GmYk d GlYo m GdYs d GaYq d G_Ym d G]Yd d G]YZ d G_YP d GaYL +d GdYJ m GgYJ d GjYL d GlYP d GmYZ d GmYd d GlYm d GjYq d GgYs m GYX} +m G}ZA m G}X} m H\ZA m H\X} m H{ZA m H{X} m IZZA m IZX} m IyZA m IyX} +m JhY{ d JdYw d J`Yq d J\Yi d JZY` d JZYX d J\YN d J`YF d JdYA d JhX} +m J`Yo d J^Yi d J\Yb d J\YV d J^YN d J`YH m JdYw d JbYs d J`Ym d J^Yb +d J^YV d J`YJ d JbYE d JdYA m JXX} m GBX^ d GBW{ m GDX` d GDW} m GEXd +d GEW{ m GEXd d FtXG d GMXG m F~W{ d GJW{ m GBW} d F?W{ m GBW? d GAW{ +m GEW? d GGW{ m GEW} d GIW{ m FtWm m GdX` d GdW{ m GeX` d GeW} m GgXd +d GgW{ m GgXd d GbX^ d G_X\ m G]W{ d GmW{ m GdW} d GaW{ m GdW? d GbW{ +m GgW? d GiW{ m GgW} d GjW{ m GYWm m G}Xq m G}Wm m H\Xq m H\Wm m H{Xq +m H{Wm m IZXq m IZWm m IyXq m IyWm m J\Xl d J`Xh d JdXb d JhXZ d JjXP +d JjXI d JhW? d JdWw d J`Wq d J\Wm m JdX` d JfXZ d JhXR d JhXG d JfW? +d JdWy m J`Xh d JbXd d JdX^ d JfXR d JfXG d JdW{ d JbWu d J`Wq m JXWm +m GBWO d GBVl m GDWQ d GDVn m GEWT d GEVl m GEWT d FtVw d GMVw m F~Vl +d GJVl m GBVn d F?Vl m GBVp d GAVl m GEVp d GGVl m GEVn d GIVl m FtV^ +m G\WM d G\WK d G]WK d G]WM d G\WM m G\WO d G]WO d G_WM d G_WK d G]WI +d G\WI d GZWK d GZWM d G\WQ d G]WS d GbWT d GiWT d GmWS d GoWQ d GpWM +d GpWI d GoWE d GjWA d GbV} d G_V{ d G\Vw d GZVq d GZVl m GmWQ d GoWM +d GoWI d GmWE m GiWT d GlWS d GmWM d GmWI d GlWE d GiWA d GbV} m GZVp +d G\Vq d G_Vq d GgVp d GmVp d GpVq m G_Vq d GgVn d GmVn d GoVp m G_Vq +d GgVl d GmVl d GoVn d GpVq d GpVu m GYV^ m G}Wb m G}V^ m H\Wb m H\V^ +m H{Wb m H{V^ m IZWb m IZV^ m IyWb m IyV^ m JcWT d JaWS d JeV? d JcV} +m JcWT d JcV} m JcWT d JeWS d JaV? d JcV} m JZWO d J[WO d JkWC d JlWC +m JZWO d JlWC m JZWO d JZWM d JlWE d JlWC m JlWO d JkWO d J[WC d JZWC +m JlWO d JZWC m JlWO d JlWM d JZWE d JZWC m JXV^ m GBU? d GBU\ m GDVA +d GDU^ m GEVE d GEU\ m GEVE d FtUh d GMUh m F~U\ d GJU\ m GBU^ d F?U\ +m GBU` d GAU\ m GEU` d GGU\ m GEU^ d GIU\ m FtUO m G\U} d G\U{ d G]U{ +d G]U} d G\U} m G\U? d G]U? d G_U} d G_U{ d G]Uy d G\Uy d GZU{ d GZU} +d G\VA d G]VC d GbVE d GiVE d GmVC d GoU? d GoUy d GmUv d GiUt m GlVC +d GmU? d GmUy d GlUv m GgVE d GjVC d GlU? d GlUy d GjUv d GgUt m GdUt +d GiUt d GlUr d GoUn d GpUj d GpUd d GoU` +stroke +m GoU` d GmU^ d GiU\ d GbU\ d G]U^ d G\U` d GZUd d GZUf d G\Uh d G]Uh +d G_Uf d G_Ud d G]Ub d G\Ub m GmUn d GoUj d GoUd d GmU` m GgUt d GjUr +d GlUp d GmUj d GmUd d GlU^ d GiU\ m G\Uf d G\Ud d G]Ud d G]Uf d G\Uf +m GYUO m G}VS m G}UO m H\VS m H\UO m H{VS m H{UO m IZVS m IZUO m IyVS +m IyUO m JeU? d JeU^ d JfU^ m JeU? d JfU? d JfU^ m JZUp d JqUp d JqUn +m JZUp d JZUn d JqUn m JXUO m GBTp d GBTM m GDTr d GDTO m GETv d GETM +m GETv d FtTY d GMTY m F~TM d GJTM m GBTO d F?TM m GBTQ d GATM m GETQ +d GGTM m GETO d GITM m FtS? m GgTp d GgTM m GiTr d GiTO m GjTv d GjTM +m GjTv d GYTY d GrTY m GbTM d GoTM m GgTO d GdTM m GgTQ d GeTM m GjTQ +d GlTM m GjTO d GmTM m GYS? m G}UC m G}S? m H\UC m H\S? m H{UC m H{S? +m IZUC m IZS? m IyUC m IyS? m JdTO d JbTM d J_TM d J]TO d J]TQ d J_TS +d JbTS d JdTQ d JdTK d JbTG d J]TE m J_TQ d J_TO d JbTO d JbTQ d J_TQ +m JbTM d JdTK m JdTO d JbTG m JXS? m GBSa d GBR~ m GDSc d GDS@ m GESf +d GER~ m GESf d FtSI d GMSI m F~R~ d GJR~ m GBS@ d F?R~ m GBSB d GAR~ +m GESB d GGR~ m GES@ d GIR~ m FtRp m G]Sf d GZSS d G]SW d GbSY d GgSY +d GlSW d GoSS d GpSM d GpSI d GoSC d GlS@ d GgR~ d GbR~ d G]S@ d G\SB +d GZSE d GZSG d G\SI d G]SI d G_SG d G_SE d G]SC d G\SC m GmSS d GoSO +d GoSG d GmSC m GgSY d GjSW d GlSU d GmSO d GmSG d GlSB d GjS@ d GgR~ +m G\SG d G\SE d G]SE d G]SG d G\SG m G]Sf d GmSf m G]Se d GjSe m G]Sc +d GdSc d GjSe d GmSf m GYRp m G}St m G}Rp m H\St m H\Rp m H{St m H{Rp +m IZSt m IZRp m IySt m IyRp m JZSQ d JqSQ d JqSO m JZSQ d JZSO d JqSO +m JXRp m GBRQ d GBQn m GDRS d GDQp m GERW d GEQn m GERW d FtQz d GMQz +m F~Qn d GJQn m GBQp d F?Qn m GBQr d GAQn m GEQr d GGQn m GEQp d GIQn +m FtQa m GlRQ d GlRO d GmRO d GmRQ d GlRQ m GmRS d GlRS d GjRQ d GjRO +d GlRM d GmRM d GoRO d GoRQ d GmRU d GjRW d GeRW d GaRU d G]RQ d G\RM +d GZRF d GZQz d G\Qt d G_Qp d GdQn d GgQn d GlQp d GoQt d GpQz d GpQ| +d GoRB d GlRF d GgRH d GdRH d GaRF d G_RD d G]R@ m G_RQ d G]RM d G\RF +d G\Qz d G]Qt d G_Qr m GmQt d GoQx d GoQ~ d GmRB m GeRW d GbRU d GaRS +d G_RO d G]RH d G]Qz d G_Qt d GaQp d GdQn m GgQn d GjQp d GlQr d GmQx +d GmQ~ d GlRD d GjRF d GgRH m GYQa m G}Re m G}Qa m H\Re m H\Qa m H{Re +m H{Qa m IZRe m IZQa m IyRe m IyQa m J_Qt d J]Qr d J]Qp d J_Qn d JbQn +d JdQp d JdQr d JbQt d J_Qt m J_Qr d J_Qp d JbQp d JbQr d J_Qr m JXQa +m GBQB d GBP_ m GDQD d GDPa m GEQH d GEP_ m GEQH d FtPk d GMPk m F~P_ +d GJP_ m GBPa d F?P_ m GBPc d GAP_ m GEPc d GGP_ m GEPa d GIP_ m FtPQ +m GZQH d GZP| m GpQH d GpQB d GoP| d GiPr d GgPo d GePg d GeP_ m GgPq +d GePm d GdPg d GdP_ m GoP| d GgPr d GdPm d GbPg d GbP_ d GeP_ m GZQ@ +d G\QD d G_QH d GbQH d GjQB d GmQB d GoQD d GpQH m G]QD d G_QF d GbQF +d GeQD m GZQ@ d G\QB d G_QD d GbQD d GjQB m GYPQ m G}QU m G}PQ m H\QU +m H\PQ m H{QU m H{PQ m IZQU m IZPQ m IyQU m IyPQ m JqQP d JXPQ d JYPQ +m JqQP d JsQP d JYPQ m JXPQ m GBOs d GBOP m GDOu d GDOR m GEOy d GEOP +m GEOy d FtO[ d GMO[ m F~OP d GJOP m GBOR d F?OP m GBOT d GAOP m GEOT +d GGOP m GEOR d GIOP m FtOB m GbOy d G]Ow d G\Os d G\Om d G]Oi d GbOg +d GiOg d GmOi d GoOm d GoOs d GmOw d GiOy d GbOy m G_Ow d G]Os d G]Om +d G_Oi m GlOi d GmOm d GmOs d GlOw m GbOy d GaOw d G_Os d G_Om d GaOi +d GbOg m GiOg d GjOi d GlOm d GlOs d GjOw d GiOy m GbOg d G]Oe d G\Oc +d GZO_ d GZOW d G\OT d G]OR d GbOP d GiOP d GmOR d GoOT d GpOW d GpO_ +d GoOc d GmOe d GiOg m G]Oc d G\O_ d G\OW d G]OT m GmOT d GoOW d GoO_ +d GmOc m GbOg d G_Oe d G]O_ d G]OW d G_OR d GbOP m GiOP d GlOR d GmOW +d GmO_ d GlOe d GiOg m GYOB m G}PF m G}OB m H\PF m H\OB m H{PF m H{OB +m IZPF m IZOB m IyPF m IyOB m JcOy d J^Ow d J[Oq d JYOg d JYOa d J[OW +d J^OR d JcOP d JfOP d JkOR d JnOW d JoOa d JoOg d JnOq d JkOw d JfOy +d JcOy m J^Ou d J\Oq d J[Oi d J[O_ d J\OW d J^OT m JkOT d JlOW d JnO_ +d JnOi d JlOq d JkOu m JcOy d J`Ow d J^Os d J\Oi d J\O_ d J^OV d J`OR +d JcOP m JfOP d JiOR d JkOV d JlO_ d JlOi d JkOs d JiOw d JfOy m JXOB +m GBNc d GBN@ m GDNe d GDNB m GENi d GEN@ m GENi d FtNL d GMNL m F~N@ +d GJN@ m GBNB d F?N@ m GBND d GAN@ m GEND d GGN@ m GENB d GIN@ m FtMs +m G]NH d G]NF d G_NF d G_NH d G]NH m GmNX d GlNT d GjNR d GgNP d GdNP +d G_NR d G\NV d GZN[ d GZN] d G\Nc d G_Ng d GdNi d GgNi d GlNg d GoNc +d GpN] d GpNR d GoNJ d GmNF d GjNB d GeN@ d GaN@ d G]NB d G\NF d G\NH +d G]NJ d G_NJ d GaNH d GaNF d G_ND d G]ND m G]NV d G\NZ d G\N_ d G]Nc +m GlNe d GmNc d GoN] d GoNR d GmNJ d GlNF m GdNP d GaNR d G_NT d G]NZ +d G]N_ d G_Ne d GaNg d GdNi m GgNi d GjNg d GlNc d GmN] d GmNP d GlNH +d GjND d GiNB d GeN@ m GYMs m G}Nw m G}Ms m H\Nw m H\Ms m H{Nw m H{Ms +m IZNw m IZMs m IyNw m IyMs m JcNe d JcN@ m JdNe d JdNB m JfNi d JfN@ +m JfNi d JaNc d J^Na m J\N@ d JlN@ m JcNB d J`N@ m JcND d JaN@ m JfND +d JgN@ m JfNB d JiN@ m JXMs m FyMZ d FvMF d FyMJ d F~ML d GBML d GGMJ +d GJMF d GLMA d GLL} d GJLw d GGLs d GBLq d F~Lq d FyLs d FwLu d FvLy +d FvL{ d FwL} d FyL} d FzL{ d FzLy d FyLw d FwLw m GIMF d GJMC d GJL{ +d GILw m GBML d GEMJ d GGMH d GIMC d GIL{ d GGLu d GELs d GBLq m FwL{ +d FwLy d FyLy d FyL{ d FwL{ m FyMZ d GIMZ m FyMX d GEMX m FyMV d F?MV +d GEMX d GIMZ m FtLc m GdMZ d G_MX d G\MR d GZMH d GZMC d G\Ly d G_Ls +d GdLq d GgLq d GlLs d GoLy d GpMC d GpMH d GoMR d GlMX d GgMZ d GdMZ +m G_MV d G]MR d G\MJ d G\MA d G]Ly d G_Lu m GlLu d GmLy d GoMA d GoMJ +d GmMR d GlMV m GdMZ d GaMX d G_MT d G]MJ d G]MA d G_Lw d GaLs d GdLq +m GgLq d GjLs d GlLw d GmMA d GmMJ d GlMT d GjMX +stroke +m GjMX d GgMZ m GYLc m G}Mg m G}Lc m H\Mg m H\Lc m H{Mg m H{Lc m IZMg +m IZLc m IyMg m IyLc m J[MR d J[MP d J\MP d J\MR d J[MR m J[MT d J\MT +d J^MR d J^MP d J\MN d J[MN d JYMP d JYMR d J[MV d J\MX d JaMZ d JgMZ +d JlMX d JnMV d JoMR d JoMN d JnMJ d JiMF d JaMC d J^MA d J[L} d JYLw +d JYLq m JlMV d JnMR d JnMN d JlMJ m JgMZ d JkMX d JlMR d JlMN d JkMJ +d JgMF d JaMC m JYLu d J[Lw d J^Lw d JfLu d JlLu d JoLw m J^Lw d JfLs +d JlLs d JnLu m J^Lw d JfLq d JlLq d JnLs d JoLw d JoL{ m JXLc m FyLK +d FvKw d FyK{ d F~K} d GBK} d GGK{ d GJKw d GLKq d GLKm d GJKg d GGKd +d GBKb d F~Kb d FyKd d FwKf d FvKi d FvKk d FwKm d FyKm d FzKk d FzKi +d FyKg d FwKg m GIKw d GJKs d GJKk d GIKg m GBK} d GEK{ d GGKy d GIKs +d GIKk d GGKf d GEKd d GBKb m FwKk d FwKi d FyKi d FyKk d FwKk m FyLK +d GILK m FyLI d GELI m FyLG d F?LG d GELI d GILK m FtKT m GdLG d GdKb +m GeLG d GeKd m GgLK d GgKb m GgLK d GbLE d G_LC m G]Kb d GmKb m GdKd +d GaKb m GdKf d GbKb m GgKf d GiKb m GgKd d GjKb m GYKT m G}LX m G}KT +m H\LX m H\KT m H{LX m H{KT m IZLX m IZKT m IyLX m IyKT m J[LC d J[LA +d J\LA d J\LC d J[LC m J[LE d J\LE d J^LC d J^LA d J\K? d J[K? d JYLA +d JYLC d J[LG d J\LI d JaLK d JgLK d JlLI d JnLE d JnK? d JlK{ d JgKy +m JkLI d JlLE d JlK? d JkK{ m JfLK d JiLI d JkLE d JkK? d JiK{ d JfKy +m JcKy d JgKy d JkKw d JnKs d JoKo d JoKi d JnKf d JlKd d JgKb d JaKb +d J\Kd d J[Kf d JYKi d JYKk d J[Km d J\Km d J^Kk d J^Ki d J\Kg d J[Kg +m JlKs d JnKo d JnKi d JlKf m JfKy d JiKw d JkKu d JlKo d JlKi d JkKd +d JgKb m J[Kk d J[Ki d J\Ki d J\Kk d J[Kk m JXKT m FyJ{ d FvJh d FyJl +d F~Jn d GBJn d GGJl d GJJh d GLJb d GLJ^ d GJJX d GGJT d GBJR d F~JR +d FyJT d FwJV d FvJZ d FvJ\ d FwJ^ d FyJ^ d FzJ\ d FzJZ d FyJX d FwJX +m GIJh d GJJd d GJJ\ d GIJX m GBJn d GEJl d GGJj d GIJd d GIJ\ d GGJV +d GEJT d GBJR m FwJ\ d FwJZ d FyJZ d FyJ\ d FwJ\ m FyJ{ d GIJ{ m FyJy +d GEJy m FyJw d F?Jw d GEJy d GIJ{ m FtJE m G\Js d G\Jq d G]Jq d G]Js +d G\Js m G\Ju d G]Ju d G_Js d G_Jq d G]Jo d G\Jo d GZJq d GZJs d G\Jw +d G]Jy d GbJ{ d GiJ{ d GmJy d GoJw d GpJs d GpJo d GoJl d GjJh d GbJd +d G_Jb d G\J^ d GZJX d GZJR m GmJw d GoJs d GoJo d GmJl m GiJ{ d GlJy +d GmJs d GmJo d GlJl d GiJh d GbJd m GZJV d G\JX d G_JX d GgJV d GmJV +d GpJX m G_JX d GgJT d GmJT d GoJV m G_JX d GgJR d GmJR d GoJT d GpJX +d GpJ\ m GYJE m G}KI m G}JE m H\KI m H\JE m H{KI m H{JE m IZKI m IZJE +m IyKI m IyJE m JfJu d JfJR m JgJw d JgJT m JiJ{ d JiJR m JiJ{ d JXJ^ +d JqJ^ m JaJR d JnJR m JfJT d JcJR m JfJV d JdJR m JiJV d JkJR m JiJT +d JlJR m JXJE m FyIl d FvIX d FyI\ d F~I^ d GBI^ d GGI\ d GJIX d GLIS +d GLIO d GJII d GGIE d GBIC d F~IC d FyIE d FwIG d FvIK d FvIM d FwIO +d FyIO d FzIM d FzIK d FyII d FwII m GIIX d GJIT d GJIM d GIII m GBI^ +d GEI\ d GGIZ d GIIT d GIIM d GGIG d GEIE d GBIC m FwIM d FwIK d FyIK +d FyIM d FwIM m FyIl d GIIl m FyIj d GEIj m FyIh d F?Ih d GEIj d GIIl +m FtHu m G\Id d G\Ib d G]Ib d G]Id d G\Id m G\If d G]If d G_Id d G_Ib +d G]I` d G\I` d GZIb d GZId d G\Ih d G]Ij d GbIl d GiIl d GmIj d GoIf +d GoI` d GmI\ d GiIZ m GlIj d GmIf d GmI` d GlI\ m GgIl d GjIj d GlIf +d GlI` d GjI\ d GgIZ m GdIZ d GiIZ d GlIX d GoIT d GpIQ d GpIK d GoIG +d GmIE d GiIC d GbIC d G]IE d G\IG d GZIK d GZIM d G\IO d G]IO d G_IM +d G_IK d G]II d G\II m GmIT d GoIQ d GoIK d GmIG m GgIZ d GjIX d GlIV +d GmIQ d GmIK d GlIE d GiIC m G\IM d G\IK d G]IK d G]IM d G\IM m GYHu +m G}Iy m G}Hu m H\Iy m H\Hu m H{Iy m H{Hu m IZIy m IZHu m IyIy m IyHu +m J\Il d JYIX d J\I\ d JaI^ d JfI^ d JkI\ d JnIX d JoIS d JoIO d JnII +d JkIE d JfIC d JaIC d J\IE d J[IG d JYIK d JYIM d J[IO d J\IO d J^IM +d J^IK d J\II d J[II m JlIX d JnIT d JnIM d JlII m JfI^ d JiI\ d JkIZ +d JlIT d JlIM d JkIG d JiIE d JfIC m J[IM d J[IK d J\IK d J\IM d J[IM +m J\Il d JlIl m J\Ij d JiIj m J\Ih d JcIh d JiIj d JlIl m JXHu m FyH\ +d FvHI d FyHM d F~HO d GBHO d GGHM d GJHI d GLHC d GLG? d GJGy d GGGv +d GBGt d F~Gt d FyGv d FwGx d FvG{ d FvG} d FwG? d FyG? d FzG} d FzG{ +d FyGy d FwGy m GIHI d GJHE d GJG} d GIGy m GBHO d GEHM d GGHK d GIHE +d GIG} d GGGx d GEGv d GBGt m FwG} d FwG{ d FyG{ d FyG} d FwG} m FyH\ +d GIH\ m FyH[ d GEH[ m FyHY d F?HY d GEH[ d GIH\ m FtGf m GgHW d GgGt +m GiHY d GiGv m GjH\ d GjGt m GjH\ d GYG? d GrG? m GbGt d GoGt m GgGv +d GdGt m GgGx d GeGt m GjGx d GlGt m GjGv d GmGt m GYGf m G}Hj m G}Gf +m H\Hj m H\Gf m H{Hj m H{Gf m IZHj m IZGf m IyHj m IyGf m JkHW d JkHU +d JlHU d JlHW d JkHW m JlHY d JkHY d JiHW d JiHU d JkHS d JlHS d JnHU +d JnHW d JlH[ d JiH\ d JdH\ d J`H[ d J\HW d J[HS d JYHK d JYG? d J[Gy +d J^Gv d JcGt d JfGt d JkGv d JnGy d JoG? d JoHA d JnHG d JkHK d JfHM +d JcHM d J`HK d J^HI d J\HE m J^HW d J\HS d J[HK d J[G? d J\Gy d J^Gx +m JlGy d JnG} d JnHC d JlHG m JdH\ d JaH[ d J`HY d J^HU d J\HM d J\G? +d J^Gy d J`Gv d JcGt m JfGt d JiGv d JkGx d JlG} d JlHC d JkHI d JiHK +d JfHM m JXGf m FyGM d FvFz d FyF~ d F~G@ d GBG@ +stroke +m GBG@ d GGF~ d GJFz d GLFt d GLFp d GJFj d GGFf d GBFd d F~Fd d FyFf +d FwFh d FvFl d FvFn d FwFp d FyFp d FzFn d FzFl d FyFj d FwFj m GIFz +d GJFv d GJFn d GIFj m GBG@ d GEF~ d GGF| d GIFv d GIFn d GGFh d GEFf +d GBFd m FwFn d FwFl d FyFl d FyFn d FwFn m FyGM d GIGM m FyGK d GEGK +m FyGI d F?GI d GEGK d GIGM m FtFW m G]GM d GZFz d G]F~ d GbG@ d GgG@ +d GlF~ d GoFz d GpFt d GpFp d GoFj d GlFf d GgFd d GbFd d G]Ff d G\Fh +d GZFl d GZFn d G\Fp d G]Fp d G_Fn d G_Fl d G]Fj d G\Fj m GmFz d GoFv +d GoFn d GmFj m GgG@ d GjF~ d GlF| d GmFv d GmFn d GlFh d GjFf d GgFd +m G\Fn d G\Fl d G]Fl d G]Fn d G\Fn m G]GM d GmGM m G]GK d GjGK m G]GI +d GdGI d GjGK d GmGM m GYFW m G}G[ m G}FW m H\G[ m H\FW m H{G[ m H{FW +m IZG[ m IZFW m IyG[ m IyFW m JYGM d JYGA m JoGM d JoGG d JnGA d JgFx +d JfFt d JdFl d JdFd m JfFv d JdFr d JcFl d JcFd m JnGA d JfFx d JcFr +d JaFl d JaFd d JdFd m JYGE d J[GI d J^GM d JaGM d JiGG d JlGG d JnGI +d JoGM m J\GI d J^GK d JaGK d JdGI m JYGE d J[GG d J^GI d JaGI d JiGG +m JXFW m RTcn d RQcZ d RTc^ d RYc` d R^c` d Rbc^ d RfcZ d RgcU d RgcQ +d RfcK d RbcG d R^cE d RYcE d RTcG d RRcI d RQcM d RQcO d RRcQ d RTcQ +d RVcO d RVcM d RTcK d RRcK m RdcZ d RfcV d RfcO d RdcK m R^c` d Rac^ +d Rbc\ d RdcV d RdcO d RbcI d RacG d R^cE m RRcO d RRcM d RTcM d RTcO +d RRcO m RTcn d Rdcn m RTcl d Racl m RTcj d RZcj d Racl d Rdcn m RObw +m SGch d SGcf d SIcf d SIch d SGch m SIcj d SGcj d SEch d SEcf d SGcd +d SIcd d SJcf d SJch d SIcl d SEcn d SAcn d R|cl d Rych d Rwcd d Rvc\ +d RvcQ d RwcK d RzcG d R?cE d SBcE d SGcG d SJcK d SLcQ d SLcS d SJcX +d SGc\ d SBc^ d R?c^ d R|c\ d RzcZ d RycV m Rzch d Rycd d Rwc\ d RwcQ +d RycK d RzcI m SIcK d SJcO d SJcU d SIcX m SAcn d R~cl d R|cj d Rzcf +d Ryc^ d RycQ d RzcK d R|cG d R?cE m SBcE d SEcG d SGcI d SIcO d SIcU +d SGcZ d SEc\ d SBc^ m Rtbw m SYc{ m SYbw m Sxc{ m Sxbw m TVc{ m TVbw +m Tuc{ m Tubw m UTc{ m UTbw m U}cn d Uxcl d Uvch d Uvcb d Uxc^ d U}c\ +d VCc\ d VHc^ d VIcb d VIch d VHcl d VCcn d U}cn m Uycl d Uxch d Uxcb +d Uyc^ m VFc^ d VHcb d VHch d VFcl m U}cn d U{cl d Uych d Uycb d U{c^ +d U}c\ m VCc\ d VDc^ d VFcb d VFch d VDcl d VCcn m U}c\ d UxcZ d UvcX +d UucU d UucM d UvcI d UxcG d U}cE d VCcE d VHcG d VIcI d VKcM d VKcU +d VIcX d VHcZ d VCc\ m UxcX d UvcU d UvcM d UxcI m VHcI d VIcM d VIcU +d VHcX m U}c\ d UycZ d UxcU d UxcM d UycG d U}cE m VCcE d VFcG d VHcM +d VHcU d VFcZ d VCc\ m Usbw m RTb^ d RQbK d RTbO d RYbQ d R^bQ d RbbO +d RfbK d RgbE d RgbA d Rfa{ d Rbax d R^av d RYav d RTax d RRaz d RQa} +d RQa? d RRbA d RTbA d RVa? d RVa} d RTa{ d RRa{ m RdbK d RfbG d Rfa? +d Rda{ m R^bQ d RabO d RbbM d RdbG d Rda? d Rbaz d Raax d R^av m RRa? +d RRa} d RTa} d RTa? d RRa? m RTb^ d Rdb^ m RTb] d Rab] m RTb[ d RZb[ +d Rab] d Rdb^ m ROah m Rvb^ d RvbS m SLb^ d SLbY d SJbS d SDbI d SBbE +d SAa} d SAav m SBbG d SAbC d R?a} d R?av m SJbS d SBbI d R?bC d R~a} +d R~av d SAav m RvbW d Rwb[ d Rzb^ d R~b^ d SEbY d SIbY d SJb[ d SLb^ +m Ryb[ d Rzb] d R~b] d SAb[ m RvbW d RwbY d Rzb[ d R~b[ d SEbY m Rtah +m SYbl m SYah m Sxbl m Sxah m TVbl m TVah m Tubl m Tuah m UTbl m UTah +m Uxa} d Uxa{ d Uya{ d Uya} d Uxa} m VHbM d VFbI d VDbG d VAbE d U~bE +d UybG d UvbK d UubQ d UubS d UvbY d Uyb] d U~b^ d VAb^ d VFb] d VIbY +d VKbS d VKbG d VIa? d VHa{ d VDax d V@av d U{av d Uxax d Uva{ d Uva} +d Uxa? d Uya? d U{a} d U{a{ d Uyaz d Uxaz m UxbK d UvbO d UvbU d UxbY +m VFb[ d VHbY d VIbS d VIbG d VHa? d VFa{ m U~bE d U{bG d UybI d UxbO +d UxbU d Uyb[ d U{b] d U~b^ m VAb^ d VDb] d VFbY d VHbS d VHbE d VFa} +d VDaz d VCax d V@av m Usah m RTaO d RQ`| d RTa@ d RYaB d R^aB d Rba@ +d Rf`| d Rg`v d Rg`r d Rf`l d Rb`h d R^`f d RY`f d RT`h d RR`j d RQ`n +d RQ`p d RR`r d RT`r d RV`p d RV`n d RT`l d RR`l m Rd`| d Rf`x d Rf`p +d Rd`l m R^aB d Raa@ d Rb`~ d Rd`x d Rd`p d Rb`j d Ra`h d R^`f m RR`p +d RR`n d RT`n d RT`p d RR`p m RTaO d RdaO m RTaM d RaaM m RTaK d RZaK +d RaaM d RdaO m RO`Y m R~aO d RyaM d RwaI d RwaC d Rya@ d R~`~ d SD`~ +d SIa@ d SJaC d SJaI d SIaM d SDaO d R~aO m RzaM d RyaI d RyaC d Rza@ +m SGa@ d SIaC d SIaI d SGaM m R~aO d R|aM d RzaI d RzaC d R|a@ d R~`~ +m SD`~ d SEa@ d SGaC d SGaI d SEaM d SDaO m R~`~ d Ry`| d Rw`z d Rv`v +d Rv`n d Rw`j d Ry`h d R~`f d SD`f d SI`h d SJ`j d SL`n d SL`v d SJ`z +d SI`| d SD`~ m Ry`z d Rw`v d Rw`n d Ry`j m SI`j d SJ`n d SJ`v d SI`z +m R~`~ d Rz`| d Ry`v d Ry`n d Rz`h d R~`f m SD`f d SG`h d SI`n d SI`v +d SG`| d SD`~ m Rt`Y m SYa] m SY`Y m Sxa] m Sx`Y m TVa] m TV`Y m Tua] +m Tu`Y m UTa] m UT`Y m UzaB d Uxa@ d Ux`~ d Uz`| d U}`| d U?`~ d U?a@ +d U}aB d UzaB m Uza@ d Uz`~ d U}`~ d U}a@ d Uza@ m Uz`l d Ux`j d Ux`h +d Uz`f d U}`f d U?`h d U?`j d U}`l d Uz`l m Uz`j d Uz`h d U}`h +stroke +m U}`h d U}`j d Uz`j m Us`Y m RT`@ d RQ_l d RT_p d RY_r d R^_r d Rb_p +d Rf_l d Rg_g d Rg_c d Rf_] d Rb_Y d R^_W d RY_W d RT_Y d RR_[ d RQ__ +d RQ_a d RR_c d RT_c d RV_a d RV__ d RT_] d RR_] m Rd_l d Rf_i d Rf_a +d Rd_] m R^_r d Ra_p d Rb_n d Rd_i d Rd_a d Rb_[ d Ra_Y d R^_W m RR_a +d RR__ d RT__ d RT_a d RR_a m RT`@ d Rd`@ m RT_~ d Ra_~ m RT_| d RZ_| +d Ra_~ d Rd`@ m RO_I m Ry__ d Ry_] d Rz_] d Rz__ d Ry__ m SI_n d SG_j +d SE_i d SB_g d R?_g d Rz_i d Rw_l d Rv_r d Rv_t d Rw_z d Rz_~ d R?`@ +d SB`@ d SG_~ d SJ_z d SL_t d SL_i d SJ_a d SI_] d SE_Y d SA_W d R|_W +d Ry_Y d Rw_] d Rw__ d Ry_a d Rz_a d R|__ d R|_] d Rz_[ d Ry_[ m Ry_l +d Rw_p d Rw_v d Ry_z m SG_| d SI_z d SJ_t d SJ_i d SI_a d SG_] m R?_g +d R|_i d Rz_j d Ry_p d Ry_v d Rz_| d R|_~ d R?`@ m SB`@ d SE_~ d SG_z +d SI_t d SI_g d SG__ d SE_[ d SD_Y d SA_W m Rt_I m SY`M m SY_I m Sx`M +m Sx_I m TV`M m TV_I m Tu`M m Tu_I m UT`M m UT_I m Uz_r d Ux_p d Ux_n +d Uz_l d U}_l d U?_n d U?_p d U}_r d Uz_r m Uz_p d Uz_n d U}_n d U}_p +d Uz_p m U?_Y d U}_W d Uz_W d Ux_Y d Ux_[ d Uz_] d U}_] d U?_[ d U?_U +d U}_Q d Ux_O m Uz_[ d Uz_Y d U}_Y d U}_[ d Uz_[ m U}_W d U?_U m U?_Y +d U}_Q m Us_I m Rb^k d Rb^i d Rd^i d Rd^k d Rb^k m Rd^m d Rb^m d Ra^k +d Ra^i d Rb^g d Rd^g d Rf^i d Rf^k d Rd^o d Ra^p d R\^p d RW^o d RT^k +d RR^g d RQ^_ d RQ^S d RR^M d RV^J d RZ^H d R^^H d Rb^J d Rf^M d Rg^S +d Rg^U d Rf^[ d Rb^_ d R^^a d RZ^a d RW^_ d RV^] d RT^Y m RV^k d RT^g +d RR^_ d RR^S d RT^M d RV^K m Rd^M d Rf^Q d Rf^W d Rd^[ m R\^p d RY^o +d RW^m d RV^i d RT^a d RT^S d RV^M d RW^J d RZ^H m R^^H d Ra^J d Rb^K +d Rd^Q d Rd^W d Rb^] d Ra^_ d R^^a m RO]z m R?^p d Rz^o d Rw^i d Rv^_ +d Rv^Y d Rw^O d Rz^J d R?^H d SB^H d SG^J d SJ^O d SL^Y d SL^_ d SJ^i +d SG^o d SB^p d R?^p m Rz^m d Ry^i d Rw^a d Rw^W d Ry^O d Rz^K m SG^K +d SI^O d SJ^W d SJ^a d SI^i d SG^m m R?^p d R|^o d Rz^k d Ry^a d Ry^W +d Rz^M d R|^J d R?^H m SB^H d SE^J d SG^M d SI^W d SI^a d SG^k d SE^o +d SB^p m Rt]z m SY^~ m SY]z m Sx^~ m Sx]z m TV^~ m TV]z m Tu^~ m Tu]z +m UT^~ m UT]z m VL^k d Uv^Y d VL^H m Us]z m Rb][ d Rb]Y d Rd]Y d Rd][ +d Rb][ m Rd]] d Rb]] d Ra][ d Ra]Y d Rb]W d Rd]W d Rf]Y d Rf][ d Rd]_ +d Ra]a d R\]a d RW]_ d RT][ d RR]W d RQ]P d RQ]D d RR\~ d RV\z d RZ\x +d R^\x d Rb\z d Rf\~ d Rg]D d Rg]F d Rf]L d Rb]P d R^]R d RZ]R d RW]P +d RV]N d RT]J m RV][ d RT]W d RR]P d RR]D d RT\~ d RV\| m Rd\~ d Rf]B +d Rf]H d Rd]L m R\]a d RY]_ d RW]] d RV]Y d RT]R d RT]D d RV\~ d RW\z +d RZ\x m R^\x d Ra\z d Rb\| d Rd]B d Rd]H d Rb]N d Ra]P d R^]R m RO\k +m R?]] d R?\x m SA]] d SA\z m SB]a d SB\x m SB]a d R~][ d Rz]Y m Ry\x +d SI\x m R?\z d R|\x m R?\| d R~\x m SB\| d SD\x m SB\z d SE\x m Rt\k +m SY]o m SY\k m Sx]o m Sx\k m TV]o m TV\k m Tu]o m Tu\k m UT]o m UT\k +m Uv]S d VL]S d VL]R m Uv]S d Uv]R d VL]R m Uv]D d VL]D d VL]B m Uv]D +d Uv]B d VL]B m Us\k m Rb\L d Rb\J d Rd\J d Rd\L d Rb\L m Rd\N d Rb\N +d Ra\L d Ra\J d Rb\H d Rd\H d Rf\J d Rf\L d Rd\P d Ra\R d R\\R d RW\P +d RT\L d RR\H d RQ\@ d RQ[u d RR[o d RV[k d RZ[i d R^[i d Rb[k d Rf[o +d Rg[u d Rg[w d Rf[| d Rb\@ d R^\B d RZ\B d RW\@ d RV[~ d RT[{ m RV\L +d RT\H d RR\@ d RR[u d RT[o d RV[m m Rd[o d Rf[s d Rf[y d Rd[| m R\\R +d RY\P d RW\N d RV\J d RT\B d RT[u d RV[o d RW[k d RZ[i m R^[i d Ra[k +d Rb[m d Rd[s d Rd[y d Rb[~ d Ra\@ d R^\B m RO[[ m Rw\J d Rw\H d Ry\H +d Ry\J d Rw\J m Rw\L d Ry\L d Rz\J d Rz\H d Ry\F d Rw\F d Rv\H d Rv\J +d Rw\N d Ry\P d R~\R d SD\R d SI\P d SJ\N d SL\J d SL\F d SJ\B d SE[~ +d R~[{ d Rz[y d Rw[u d Rv[o d Rv[i m SI\N d SJ\J d SJ\F d SI\B m SD\R +d SG\P d SI\J d SI\F d SG\B d SD[~ d R~[{ m Rv[m d Rw[o d Rz[o d SB[m +d SI[m d SL[o m Rz[o d SB[k d SI[k d SJ[m m Rz[o d SB[i d SI[i d SJ[k +d SL[o d SL[s m Rt[[ m SY\_ m SY[[ m Sx\_ m Sx[[ m TV\_ m TV[[ m Tu\_ +m Tu[[ m UT\_ m UT[[ m Uv\L d VL[{ d Uv[i m Us[[ m RbZ} d RbZ{ d RdZ{ +d RdZ} d RbZ} m RdZ? d RbZ? d RaZ} d RaZ{ d RbZy d RdZy d RfZ{ d RfZ} +d Rd[A d Ra[C d R\[C d RW[A d RTZ} d RRZy d RQZq d RQZe d RRZ` d RVZ\ +d RZZZ d R^ZZ d RbZ\ d RfZ` d RgZe d RgZg d RfZm d RbZq d R^Zs d RZZs +d RWZq d RVZo d RTZk m RVZ} d RTZy d RRZq d RRZe d RTZ` d RVZ^ m RdZ` +d RfZc d RfZi d RdZm m R\[C d RY[A d RWZ? d RVZ{ d RTZs d RTZe d RVZ` +d RWZ\ d RZZZ m R^ZZ d RaZ\ d RbZ^ d RdZc d RdZi d RbZo d RaZq d R^Zs +m ROZL m RwZ{ d RwZy d RyZy d RyZ{ d RwZ{ m RwZ} d RyZ} d RzZ{ d RzZy +d RyZw d RwZw d RvZy d RvZ{ d RwZ? d Ry[A d R~[C d SD[C d SI[A d SJZ} +d SJZw d SIZs d SDZq m SG[A d SIZ} d SIZw d SGZs m SB[C d SE[A d SGZ} +d SGZw d SEZs d SBZq m R?Zq d SDZq d SGZo d SJZk d SLZg d SLZa d SJZ^ +d SIZ\ d SDZZ d R~ZZ d RyZ\ d RwZ^ d RvZa d RvZc d RwZe d RyZe d RzZc +d RzZa d RyZ` d RwZ` +stroke +m RwZ` m SIZk d SJZg d SJZa d SIZ^ m SBZq d SEZo d SGZm d SIZg d SIZa +d SGZ\ d SDZZ m RwZc d RwZa d RyZa d RyZc d RwZc m RtZL m SY[P m SYZL +m Sx[P m SxZL m TV[P m TVZL m Tu[P m TuZL m UT[P m UTZL m UvZy d UvZ{ +d UxZ{ d UxZw d UuZw d UuZ{ d UvZ? d Ux[A d U{[C d VB[C d VG[A d VHZ? +d VJZ{ d VJZw d VHZs d VGZq d V@Zm m VGZ? d VHZ} d VHZu d VGZs m VB[C +d VE[A d VGZ} d VGZu d VEZq d VDZo m U?Zm d U?Zg d V@Zg d V@Zm d U?Zm +m U?Z` d U}Z^ d U}Z\ d U?ZZ d V@ZZ d VBZ\ d VBZ^ d V@Z` d U?Z` m U?Z^ +d U?Z\ d V@Z\ d V@Z^ d U?Z^ m UsZL m RbYm d RbYk d RdYk d RdYm d RbYm +m RdYo d RbYo d RaYm d RaYk d RbYi d RdYi d RfYk d RfYm d RdYq d RaYs +d R\Ys d RWYq d RTYm d RRYi d RQYb d RQYV d RRYP d RVYL d RZYJ d R^YJ +d RbYL d RfYP d RgYV d RgYX d RfY^ d RbYb d R^Yd d RZYd d RWYb d RVY` +d RTY\ m RVYm d RTYi d RRYb d RRYV d RTYP d RVYN m RdYP d RfYT d RfYZ +d RdY^ m R\Ys d RYYq d RWYo d RVYk d RTYd d RTYV d RVYP d RWYL d RZYJ +m R^YJ d RaYL d RbYN d RdYT d RdYZ d RbY` d RaYb d R^Yd m ROX} m SBYm +d SBYJ m SDYo d SDYL m SEYs d SEYJ m SEYs d RtYV d SMYV m R~YJ d SJYJ +m SBYL d R?YJ m SBYN d SAYJ m SEYN d SGYJ m SEYL d SIYJ m RtX} m SYZA +m SYX} m SxZA m SxX} m TVZA m TVX} m TuZA m TuX} m UTZA m UTX} m VGYd +d VFYg d VCYi d U?Yi d U}Yg d U|Ye d UzY` d UzYZ d U|YV d U~YT d VBYT +d VDYV d VFYZ m U?Yi d U}Ye d U|Y` d U|YZ d U}YV d U~YT m VGYi d VFYZ +d VFYV d VHYT d VKYT d VMYX d VNY^ d VNYb d VMYg d VLYk d VIYo d VGYq +d VCYs d U?Ys d U|Yq d UyYo d UwYk d UuYg d UtYb d UtY\ d UuYV d UwYR +d UyYN d U|YL d U?YJ d VCYJ d VGYL d VIYN d VKYP m VHYi d VGYZ d VGYV +d VHYT m UsX} m RbX^ d RbX\ d RdX\ d RdX^ d RbX^ m RdX` d RbX` d RaX^ +d RaX\ d RbXZ d RdXZ d RfX\ d RfX^ d RdXb d RaXd d R\Xd d RWXb d RTX^ +d RRXZ d RQXR d RQXG d RRXA d RVW} d RZW{ d R^W{ d RbW} d RfXA d RgXG +d RgXI d RfXN d RbXR d R^XT d RZXT d RWXR d RVXP d RTXM m RVX^ d RTXZ +d RRXR d RRXG d RTXA d RVW? m RdXA d RfXE d RfXK d RdXN m R\Xd d RYXb +d RWX` d RVX\ d RTXT d RTXG d RVXA d RWW} d RZW{ m R^W{ d RaW} d RbW? +d RdXE d RdXK d RbXP d RaXR d R^XT m ROWm m RyXd d RvXP d RyXT d R~XV +d SBXV d SGXT d SJXP d SLXK d SLXG d SJXA d SGW} d SBW{ d R~W{ d RyW} +d RwW? d RvXC d RvXE d RwXG d RyXG d RzXE d RzXC d RyXA d RwXA m SIXP +d SJXM d SJXE d SIXA m SBXV d SEXT d SGXR d SIXM d SIXE d SGW? d SEW} +d SBW{ m RwXE d RwXC d RyXC d RyXE d RwXE m RyXd d SIXd m RyXb d SEXb +m RyX` d R?X` d SEXb d SIXd m RtWm m SYXq m SYWm m SxXq m SxWm m TVXq +m TVWm m TuXq m TuWm m UTXq m UTWm m V@Xd d UuW} m U~X^ d VHW{ m V@X^ +d VIW{ m V@Xd d VKW{ m UxXG d VFXG m UsW{ d U{W{ m VCW{ d VNW{ m UuW} +d UsW{ m UuW} d UxW{ m VHW} d VDW{ m VHW? d VFW{ m VIW? d VLW{ m UsWm +m RbWO d RbWM d RdWM d RdWO d RbWO m RdWQ d RbWQ d RaWO d RaWM d RbWK +d RdWK d RfWM d RfWO d RdWS d RaWT d R\WT d RWWS d RTWO d RRWK d RQWC +d RQVw d RRVq d RVVn d RZVl d R^Vl d RbVn d RfVq d RgVw d RgVy d RfV? +d RbWC d R^WE d RZWE d RWWC d RVWA d RTV} m RVWO d RTWK d RRWC d RRVw +d RTVq d RVVp m RdVq d RfVu d RfV{ d RdV? m R\WT d RYWS d RWWQ d RVWM +d RTWE d RTVw d RVVq d RWVn d RZVl m R^Vl d RaVn d RbVp d RdVu d RdV{ +d RbWA d RaWC d R^WE m ROV^ m SGWO d SGWM d SIWM d SIWO d SGWO m SIWQ +d SGWQ d SEWO d SEWM d SGWK d SIWK d SJWM d SJWO d SIWS d SEWT d SAWT +d R|WS d RyWO d RwWK d RvWC d RvVw d RwVq d RzVn d R?Vl d SBVl d SGVn +d SJVq d SLVw d SLVy d SJV? d SGWC d SBWE d R?WE d R|WC d RzWA d RyV} +m RzWO d RyWK d RwWC d RwVw d RyVq d RzVp m SIVq d SJVu d SJV{ d SIV? +m SAWT d R~WS d R|WQ d RzWM d RyWE d RyVw d RzVq d R|Vn d R?Vl m SBVl +d SEVn d SGVp d SIVu d SIV{ d SGWA d SEWC d SBWE m RtV^ m SYWb m SYV^ +m SxWb m SxV^ m TVWb m TVV^ m TuWb m TuV^ m UTWb m UTV^ m UwWT d UwVl +m UyWS d UyVn m UzWT d UzVl m UsWT d VEWT d VIWS d VKWQ d VLWM d VLWI +d VKWE d VIWC d VEWA m VIWQ d VKWM d VKWI d VIWE m VEWT d VHWS d VIWO +d VIWG d VHWC d VEWA m UzWA d VEWA d VIV? d VKV} d VLVy d VLVs d VKVp +d VIVn d VEVl d UsVl m VIV} d VKVy d VKVs d VIVp m VEWA d VHV? d VIV{ +d VIVq d VHVn d VEVl m UtWT d UwWS m UvWT d UwWQ m U|WT d UzWQ m U}WT +d UzWS m UwVn d UtVl m UwVp d UvVl m UzVp d U|Vl m UzVn d U}Vl m UsV^ +m RbU? d RbU} d RdU} d RdU? d RbU? m RdVA d RbVA d RaU? d RaU} d RbU{ +d RdU{ d RfU} d RfU? d RdVC d RaVE d R\VE d RWVC d RTU? d RRU{ d RQUt +d RQUh d RRUb d RVU^ d RZU\ d R^U\ d RbU^ d RfUb d RgUh d RgUj d RfUp +d RbUt d R^Uv d RZUv d RWUt d RVUr d RTUn m RVU? d RTU{ d RRUt d RRUh +d RTUb d RVU` m RdUb d RfUf d RfUl d RdUp m R\VE d RYVC d RWVA d RVU} +d RTUv d RTUh d RVUb d RWU^ d RZU\ m R^U\ d RaU^ d RbU` d RdUf d RdUl +d RbUr d RaUt d R^Uv m ROUO m RvVE d RvUy m SLVE d SLU? d SJUy d SDUp +d SBUl d SAUd d SAU\ m SBUn d SAUj d R?Ud d R?U\ m SJUy d SBUp d R?Uj +d R~Ud d R~U\ d SAU\ m RvU} d RwVA d RzVE d R~VE d SEU? d SIU? +stroke +m SIU? d SJVA d SLVE m RyVA d RzVC d R~VC d SAVA m RvU} d RwU? d RzVA +d R~VA d SEU? m RtUO m SYVS m SYUO m SxVS m SxUO m TVVS m TVUO m TuVS +m TuUO m UTVS m UTUO m VJU? d VKVE d VKUy d VJU? d VGVC d VDVE d U?VE +d U{VC d UxU? d UvU{ d UtUv d UtUl d UvUf d UxUb d U{U^ d U?U\ d VDU\ +d VGU^ d VJUb d VKUf m UyU? d UxU{ d UvUv d UvUl d UxUf d UyUb m U?VE +d U|VC d UyU} d UxUv d UxUl d UyUd d U|U^ d U?U\ m UsUO m RbTp d RbTn +d RdTn d RdTp d RbTp m RdTr d RbTr d RaTp d RaTn d RbTl d RdTl d RfTn +d RfTp d RdTt d RaTv d R\Tv d RWTt d RTTp d RRTl d RQTd d RQTY d RRTS +d RVTO d RZTM d R^TM d RbTO d RfTS d RgTY d RgT[ d RfT` d RbTd d R^Tf +d RZTf d RWTd d RVTb d RTT^ m RVTp d RTTl d RRTd d RRTY d RTTS d RVTQ +m RdTS d RfTW d RfT] d RdT` m R\Tv d RYTt d RWTr d RVTn d RTTf d RTTY +d RVTS d RWTO d RZTM m R^TM d RaTO d RbTQ d RdTW d RdT] d RbTb d RaTd +d R^Tf m ROS? m R~Tv d RyTt d RwTp d RwTj d RyTf d R~Td d SDTd d SITf +d SJTj d SJTp d SITt d SDTv d R~Tv m RzTt d RyTp d RyTj d RzTf m SGTf +d SITj d SITp d SGTt m R~Tv d R|Tt d RzTp d RzTj d R|Tf d R~Td m SDTd +d SETf d SGTj d SGTp d SETt d SDTv m R~Td d RyTb d RwT` d RvT] d RvTU +d RwTQ d RyTO d R~TM d SDTM d SITO d SJTQ d SLTU d SLT] d SJT` d SITb +d SDTd m RyT` d RwT] d RwTU d RyTQ m SITQ d SJTU d SJT] d SIT` m R~Td +d RzTb d RyT] d RyTU d RzTO d R~TM m SDTM d SGTO d SITU d SIT] d SGTb +d SDTd m RtS? m SYUC m SYS? m SxUC m SxS? m TVUC m TVS? m TuUC m TuS? +m UTUC m UTS? m UwTv d UwTM m UyTt d UyTO m UzTv d UzTM m UsTv d VBTv +d VFTt d VITp d VKTl d VLTf d VLT] d VKTW d VITS d VFTO d VBTM d UsTM +m VHTp d VITl d VKTf d VKT] d VITW d VHTS m VBTv d VETt d VHTn d VITf +d VIT] d VHTU d VETO d VBTM m UtTv d UwTt m UvTv d UwTr m U|Tv d UzTr +m U}Tv d UzTt m UwTO d UtTM m UwTQ d UvTM m UzTQ d U|TM m UzTO d U}TM +m UsS? m RbSa d RbS_ d RdS_ d RdSa d RbSa m RdSc d RbSc d RaSa d RaS_ +d RbS] d RdS] d RfS_ d RfSa d RdSe d RaSf d R\Sf d RWSe d RTSa d RRS] +d RQSU d RQSI d RRSC d RVS@ d RZR~ d R^R~ d RbS@ d RfSC d RgSI d RgSK +d RfSQ d RbSU d R^SW d RZSW d RWSU d RVSS d RTSO m RVSa d RTS] d RRSU +d RRSI d RTSC d RVSB m RdSC d RfSG d RfSM d RdSQ m R\Sf d RYSe d RWSc +d RVS_ d RTSW d RTSI d RVSC d RWS@ d RZR~ m R^R~ d RaS@ d RbSB d RdSG +d RdSM d RbSS d RaSU d R^SW m RORp m RySE d RySC d RzSC d RzSE d RySE +m SISU d SGSQ d SESO d SBSM d R?SM d RzSO d RwSS d RvSY d RvS[ d RwSa +d RzSe d R?Sf d SBSf d SGSe d SJSa d SLS[ d SLSO d SJSG d SISC d SES@ +d SAR~ d R|R~ d RyS@ d RwSC d RwSE d RySG d RzSG d R|SE d R|SC d RzSB +d RySB m RySS d RwSW d RwS] d RySa m SGSc d SISa d SJS[ d SJSO d SISG +d SGSC m R?SM d R|SO d RzSQ d RySW d RyS] d RzSc d R|Se d R?Sf m SBSf +d SESe d SGSa d SIS[ d SISM d SGSE d SESB d SDS@ d SAR~ m RtRp m SYSt +m SYRp m SxSt m SxRp m TVSt m TVRp m TuSt m TuRp m UTSt m UTRp m UxSf +d UxR~ m UySe d UyS@ m U{Sf d U{R~ m UsSf d VKSf d VKS[ m U{SS d VDSS +m VDS[ d VDSK m UsR~ d VKR~ d VKSI m UtSf d UxSe m UvSf d UxSc m U|Sf +d U{Sc m U~Sf d U{Se m VDSf d VKSe m VGSf d VKSc m VHSf d VKSa m VJSf +d VKS[ m VDS[ d VBSS d VDSK m VDSW d VASS d VDSO m VDSU d U~SS d VDSQ +m UxS@ d UtR~ m UxSB d UvR~ m U{SB d U|R~ m U{S@ d U~R~ m VDR~ d VKS@ +m VGR~ d VKSB m VHR~ d VKSC m VJR~ d VKSI m UsRp m RQRW d RQRK m RgRW +d RgRQ d RfRK d R_RB d R^Q~ d R\Qv d R\Qn m R^R@ d R\Q| d RZQv d RZQn +m RfRK d R^RB d RZQ| d RYQv d RYQn d R\Qn m RQRO d RRRS d RVRW d RYRW +d RaRQ d RdRQ d RfRS d RgRW m RTRS d RVRU d RYRU d R\RS m RQRO d RRRQ +d RVRS d RYRS d RaRQ m ROQa m R?RW d RzRU d RwRO d RvRF d RvR@ d RwQv +d RzQp d R?Qn d SBQn d SGQp d SJQv d SLR@ d SLRF d SJRO d SGRU d SBRW +d R?RW m RzRS d RyRO d RwRH d RwQ~ d RyQv d RzQr m SGQr d SIQv d SJQ~ +d SJRH d SIRO d SGRS m R?RW d R|RU d RzRQ d RyRH d RyQ~ d RzQt d R|Qp +d R?Qn m SBQn d SEQp d SGQt d SIQ~ d SIRH d SGRQ d SERU d SBRW m RtQa +m SYRe m SYQa m SxRe m SxQa m TVRe m TVQa m TuRe m TuQa m UTRe m UTQa +m UxRW d UxQn m UyRU d UyQp m U{RW d U{Qn m UsRW d VLRW d VLRK m U{RD +d VDRD m VDRK d VDQ| m UsQn d V@Qn m UuRW d UxRU m UvRW d UxRS m U}RW +d U{RS m U~RW d U{RU m VDRW d VLRU m VHRW d VLRS m VIRW d VLRQ m VKRW +d VLRK m VDRK d VCRD d VDQ| m VDRH d VARD d VDR@ m VDRF d U~RD d VDRB +m UxQp d UuQn m UxQr d UvQn m U{Qr d U}Qn m U{Qp d U~Qn m UsQa m RQQH +d RQP| m RgQH d RgQB d RfP| d R_Pr d R^Po d R\Pg d R\P_ m R^Pq d R\Pm +d RZPg d RZP_ m RfP| d R^Pr d RZPm d RYPg d RYP_ d R\P_ m RQQ@ d RRQD +d RVQH d RYQH d RaQB d RdQB d RfQD d RgQH m RTQD d RVQF d RYQF d R\QD +m RQQ@ d RRQB d RVQD d RYQD d RaQB m ROPQ m R?QD d R?P_ m SAQD d SAPa +m SBQH d SBP_ m SBQH d R~QB d RzQ@ m RyP_ d SIP_ m R?Pa d R|P_ m R?Pc +d R~P_ m SBPc d SDP_ m SBPa d SEP_ m RtPQ m SYQU m SYPQ m SxQU m SxPQ +m TVQU m TVPQ m TuQU m TuPQ m UTQU m UTPQ m VHQB d VJQH d VJP| d VHQB +d VEQF d VCQH d U~QH d UzQF d UwQB d UvP~ d UtPx d UtPo d UvPi d UwPe +d UzPa d U~P_ d VCP_ d VEPa d VHPa d VJP_ d VJPo m UyQB d UwP~ d UvPx +d UvPo d UwPi d UyPe m U~QH d U{QF d UyQ@ d UwPx d UwPo d UyPg d U{Pa +d U~P_ m VHPm d VHPc m VGPo d VGPc d VEPa m VCPo d VNPo m VDPo d VGPm +m VEPo d VGPk m VKPo d VJPk m VLPo d VJPm m UsPQ m RQOy d RQOm m RgOy +d RgOs d RfOm d R_Oc +stroke +m R_Oc d R^O_ d R\OW d R\OP m R^Oa d R\O] d RZOW d RZOP m RfOm d R^Oc +d RZO] d RYOW d RYOP d R\OP m RQOq d RROu d RVOy d RYOy d RaOs d RdOs +d RfOu d RgOy m RTOu d RVOw d RYOw d R\Ou m RQOq d RROs d RVOu d RYOu +d RaOs m ROOB m RwOq d RwOo d RyOo d RyOq d RwOq m RwOs d RyOs d RzOq +d RzOo d RyOm d RwOm d RvOo d RvOq d RwOu d RyOw d R~Oy d SDOy d SIOw +d SJOu d SLOq d SLOm d SJOi d SEOe d R~Oa d RzO_ d RwO[ d RvOV d RvOP +m SIOu d SJOq d SJOm d SIOi m SDOy d SGOw d SIOq d SIOm d SGOi d SDOe +d R~Oa m RvOT d RwOV d RzOV d SBOT d SIOT d SLOV m RzOV d SBOR d SIOR +d SJOT m RzOV d SBOP d SIOP d SJOR d SLOV d SLOY m RtOB m SYPF m SYOB +m SxPF m SxOB m TVPF m TVOB m TuPF m TuOB m UTPF m UTOB m UwOy d UwOP +m UxOw d UxOR m UzOy d UzOP m VHOy d VHOP m VIOw d VIOR m VJOy d VJOP +m UsOy d U~Oy m VCOy d VNOy m UzOe d VHOe m UsOP d U~OP m VCOP d VNOP +m UtOy d UwOw m UvOy d UwOu m U{Oy d UzOu m U}Oy d UzOw m VEOy d VHOw +m VFOy d VHOu m VLOy d VJOu m VMOy d VJOw m UwOR d UtOP m UwOT d UvOP +m UzOT d U{OP m UzOR d U}OP m VHOR d VEOP m VHOT d VFOP m VJOT d VLOP +m VJOR d VMOP m UsOB m RQNi d RQN] m RgNi d RgNc d RfN] d R_NT d R^NP +d R\NH d R\N@ m R^NR d R\NN d RZNH d RZN@ m RfN] d R^NT d RZNN d RYNH +d RYN@ d R\N@ m RQNa d RRNe d RVNi d RYNi d RaNc d RdNc d RfNe d RgNi +m RTNe d RVNg d RYNg d R\Ne m RQNa d RRNc d RVNe d RYNe d RaNc m ROMs +m RwNa d RwN_ d RyN_ d RyNa d RwNa m RwNc d RyNc d RzNa d RzN_ d RyN] +d RwN] d RvN_ d RvNa d RwNe d RyNg d R~Ni d SDNi d SINg d SJNc d SJN] +d SINZ d SDNX m SGNg d SINc d SIN] d SGNZ m SBNi d SENg d SGNc d SGN] +d SENZ d SBNX m R?NX d SDNX d SGNV d SJNR d SLNN d SLNH d SJND d SINB +d SDN@ d R~N@ d RyNB d RwND d RvNH d RvNJ d RwNL d RyNL d RzNJ d RzNH +d RyNF d RwNF m SINR d SJNN d SJNH d SIND m SBNX d SENV d SGNT d SINN +d SINH d SGNB d SDN@ m RwNJ d RwNH d RyNH d RyNJ d RwNJ m RtMs m SYNw +m SYMs m SxNw m SxMs m TVNw m TVMs m TuNw m TuMs m UTNw m UTMs m UzNi +d UzN@ m U|Ng d U|NB m U?Ni d U?N@ m UsNi d VFNi m UsN@ d VFN@ m UuNi +d UzNg m UxNi d UzNe m VANi d U?Ne m VCNi d U?Ng m UzNB d UuN@ m UzND +d UxN@ m U?ND d VAN@ m U?NB d VCN@ m UsMs m RQMZ d RQMN m RgMZ d RgMT +d RfMN d R_MD d R^MA d R\Ly d R\Lq m R^MC d R\L? d RZLy d RZLq m RfMN +d R^MD d RZL? d RYLy d RYLq d R\Lq m RQMR d RRMV d RVMZ d RYMZ d RaMT +d RdMT d RfMV d RgMZ m RTMV d RVMX d RYMX d R\MV m RQMR d RRMT d RVMV +d RYMV d RaMT m ROLc m SBMT d SBLq m SDMV d SDLs m SEMZ d SELq m SEMZ +d RtL} d SML} m R~Lq d SJLq m SBLs d R?Lq m SBLu d SALq m SELu d SGLq +m SELs d SILq m RtLc m SYMg m SYLc m SxMg m SxLc m TVMg m TVLc m TuMg +m TuLc m UTMg m UTLc m V@MZ d V@Ly d U~Ls d U|Lq m VBMX d VBLy d V@Ls +m VDMZ d VDLy d VBLs d U|Lq d UyLq d UuLs d UsLw d UsL{ d UuL} d UwL} +d UyL{ d UyLy d UwLw d UuLw m UuL{ d UuLy d UwLy d UwL{ d UuL{ m U{MZ +d VJMZ m U|MZ d V@MX m U~MZ d V@MV m VFMZ d VDMV m VHMZ d VDMX m UsLc +m RQLK d RQK? m RgLK d RgLE d RfK? d R_Ku d R^Kq d R\Ki d R\Kb m R^Ks +d R\Ko d RZKi d RZKb m RfK? d R^Ku d RZKo d RYKi d RYKb d R\Kb m RQLC +d RRLG d RVLK d RYLK d RaLE d RdLE d RfLG d RgLK m RTLG d RVLI d RYLI +d R\LG m RQLC d RRLE d RVLG d RYLG d RaLE m ROKT m RyLK d RvKw d RyK{ +d R~K} d SBK} d SGK{ d SJKw d SLKq d SLKm d SJKg d SGKd d SBKb d R~Kb +d RyKd d RwKf d RvKi d RvKk d RwKm d RyKm d RzKk d RzKi d RyKg d RwKg +m SIKw d SJKs d SJKk d SIKg m SBK} d SEK{ d SGKy d SIKs d SIKk d SGKf +d SEKd d SBKb m RwKk d RwKi d RyKi d RyKk d RwKk m RyLK d SILK m RyLI +d SELI m RyLG d R?LG d SELI d SILK m RtKT m SYLX m SYKT m SxLX m SxKT +m TVLX m TVKT m TuLX m TuKT m UTLX m UTKT m UwLK d UwKb m UyLI d UyKd +m UzLK d UzKb m VKLI d UzKs m U?Kw d VIKb m V@Kw d VKKb m V@K{ d VLKb +m UsLK d U?LK m VFLK d VOLK m UsKb d U?Kb m VEKb d VOKb m UtLK d UwLI +m UvLK d UwLG m U|LK d UzLG m U}LK d UzLI m VILK d VKLI m VMLK d VKLI +m UwKd d UtKb m UwKf d UvKb m UzKf d U|Kb m UzKd d U}Kb m VIKf d VFKb +m VIKf d VMKb m UsKT m RQJ{ d RQJo m RgJ{ d RgJu d RfJo d R_Jf d R^Jb +d R\JZ d R\JR m R^Jd d R\J` d RZJZ d RZJR m RfJo d R^Jf d RZJ` d RYJZ +d RYJR d R\JR m RQJs d RRJw d RVJ{ d RYJ{ d RaJu d RdJu d RfJw d RgJ{ +m RTJw d RVJy d RYJy d R\Jw m RQJs d RRJu d RVJw d RYJw d RaJu m ROJE +m SGJu d SGJs d SIJs d SIJu d SGJu m SIJw d SGJw d SEJu d SEJs d SGJq +d SIJq d SJJs d SJJu d SIJy d SEJ{ d SAJ{ d R|Jy d RyJu d RwJq d RvJj +d RvJ^ d RwJX d RzJT d R?JR d SBJR d SGJT d SJJX d SLJ^ d SLJ` d SJJf +d SGJj d SBJl d R?Jl d R|Jj d RzJh d RyJd m RzJu d RyJq d RwJj d RwJ^ +d RyJX d RzJV m SIJX d SJJ\ d SJJb d SIJf m SAJ{ d R~Jy d R|Jw d RzJs +d RyJl d RyJ^ d RzJX d R|JT d R?JR m SBJR d SEJT d SGJV d SIJ\ d SIJb +d SGJh d SEJj d SBJl m RtJE m SYKI m SYJE m SxKI m SxJE m TVKI m TVJE +m TuKI m TuJE m UTKI m UTJE m UxJ{ d UxJR m UzJy d UzJT m U|J{ d U|JR +m UsJ{ d VAJ{ m UsJR d VMJR d VMJ^ m UuJ{ d UxJy m UvJ{ d UxJw m U}J{ +d U|Jw m U?J{ d U|Jy m UxJT d UuJR m UxJV d UvJR m U|JV d U}JR m U|JT +d U?JR m VDJR d VMJT m VHJR d VMJV m VIJR d VMJX m VKJR d VMJ^ m UsJE +m RQIl d RQI` m RgIl d RgIf d RfI` d R_IV d R^IS d R\IK d R\IC m R^IT +d R\IQ d RZIK d RZIC m RfI` d R^IV d RZIQ d RYIK d RYIC d R\IC m RQId +d RRIh d RVIl d RYIl d RaIf d RdIf d RfIh d RgIl m RTIh d RVIj d RYIj +d R\Ih m RQId d RRIf d RVIh d RYIh d RaIf m ROHu m RvIl d RvI` m SLIl +d SLIf d SJI` d SDIV d SBIS d SAIK d SAIC m SBIT d SAIQ d R?IK d R?IC +m SJI` d SBIV d R?IQ d R~IK d R~IC d SAIC m RvId d RwIh d RzIl d R~Il +d SEIf +stroke +m SEIf d SIIf d SJIh d SLIl m RyIh d RzIj d R~Ij d SAIh m RvId d RwIf +d RzIh d R~Ih d SEIf m RtHu m SYIy m SYHu m SxIy m SxHu m TVIy m TVHu +m TuIy m TuHu m UTIy m UTHu m UwIl d UwIE m UwIl d V@IC m UxIl d V@II +m UyIl d VAII m VIIl d V@IC m VIIl d VIIC m VJIj d VJIE m VKIl d VKIC +m UsIl d UyIl m VIIl d VOIl m UsIC d U{IC m VEIC d VOIC m UtIl d UwIj +m VMIl d VKIh m VNIl d VKIj m UwIE d UtIC m UwIE d UyIC m VIIE d VFIC +m VIIG d VHIC m VKIG d VMIC m VKIE d VNIC m UsHu m RQH\ d RQHQ m RgH\ +d RgHW d RfHQ d R_HG d R^HC d R\G{ d R\Gt m R^HE d R\HA d RZG{ d RZGt +m RfHQ d R^HG d RZHA d RYG{ d RYGt d R\Gt m RQHU d RRHY d RVH\ d RYH\ +d RaHW d RdHW d RfHY d RgH\ m RTHY d RVH[ d RYH[ d R\HY m RQHU d RRHW +d RVHY d RYHY d RaHW m ROGf m R~H\ d RyH[ d RwHW d RwHQ d RyHM d R~HK +d SDHK d SIHM d SJHQ d SJHW d SIH[ d SDH\ d R~H\ m RzH[ d RyHW d RyHQ +d RzHM m SGHM d SIHQ d SIHW d SGH[ m R~H\ d R|H[ d RzHW d RzHQ d R|HM +d R~HK m SDHK d SEHM d SGHQ d SGHW d SEH[ d SDH\ m R~HK d RyHI d RwHG +d RvHC d RvG{ d RwGx d RyGv d R~Gt d SDGt d SIGv d SJGx d SLG{ d SLHC +d SJHG d SIHI d SDHK m RyHG d RwHC d RwG{ d RyGx m SIGx d SJG{ d SJHC +d SIHG m R~HK d RzHI d RyHC d RyG{ d RzGv d R~Gt m SDGt d SGGv d SIG{ +d SIHC d SGHI d SDHK m RtGf m SYHj m SYGf m SxHj m SxGf m TVHj m TVGf +m TuHj m TuGf m UTHj m UTGf m UwH\ d UwGv m UwH\ d VJGt m UxH\ d VIGy +m UzH\ d VJGy m VJH[ d VJGt m UsH\ d UzH\ m VFH\ d VNH\ m UsGt d U{Gt +m UtH\ d UwH[ m VHH\ d VJH[ m VMH\ d VJH[ m UwGv d UtGt m UwGv d UzGt +m UsGf m RQGM d RQGA m RgGM d RgGG d RfGA d R_Fx d R^Ft d R\Fl d R\Fd +m R^Fv d R\Fr d RZFl d RZFd m RfGA d R^Fx d RZFr d RYFl d RYFd d R\Fd +m RQGE d RRGI d RVGM d RYGM d RaGG d RdGG d RfGI d RgGM m RTGI d RVGK +d RYGK d R\GI m RQGE d RRGG d RVGI d RYGI d RaGG m ROFW m RyFl d RyFj +d RzFj d RzFl d RyFl m SIF| d SGFx d SEFv d SBFt d R?Ft d RzFv d RwFz +d RvG@ d RvGA d RwGG d RzGK d R?GM d SBGM d SGGK d SJGG d SLGA d SLFv +d SJFn d SIFj d SEFf d SAFd d R|Fd d RyFf d RwFj d RwFl d RyFn d RzFn +d R|Fl d R|Fj d RzFh d RyFh m RyFz d RwF~ d RwGC d RyGG m SGGI d SIGG +d SJGA d SJFv d SIFn d SGFj m R?Ft d R|Fv d RzFx d RyF~ d RyGC d RzGI +d R|GK d R?GM m SBGM d SEGK d SGGG d SIGA d SIFt d SGFl d SEFh d SDFf +d SAFd m RtFW m SYG[ m SYFW m SxG[ m SxFW m TVG[ m TVFW m TuG[ m TuFW +m UTG[ m UTFW m U?GM d UzGK d UwGG d UvGC d UtF| d UtFv d UvFn d UwFj +d UzFf d U?Fd d VBFd d VFFf d VIFj d VKFn d VLFv d VLF| d VKGC d VIGG +d VFGK d VBGM d U?GM m UyGG d UwGC d UvF~ d UvFt d UwFn d UyFj m VHFj +d VIFn d VKFt d VKF~ d VIGC d VHGG m U?GM d U|GK d UyGE d UwF~ d UwFt +d UyFl d U|Ff d U?Fd m VBFd d VEFf d VHFl d VIFt d VIF~ d VHGE d VEGK +d VBGM m UsFW m ]Kc{ m ]Kbw m ]scn d ]ocl d ]mch d ]mcb d ]oc^ d ]sc\ +d ]zc\ d ]~c^ d ^@cb d ^@ch d ]~cl d ]zcn d ]scn m ]pcl d ]och d ]ocb +d ]pc^ m ]}c^ d ]~cb d ]~ch d ]}cl m ]scn d ]rcl d ]pch d ]pcb d ]rc^ +d ]sc\ m ]zc\ d ]{c^ d ]}cb d ]}ch d ]{cl d ]zcn m ]sc\ d ]ocZ d ]mcX +d ]kcU d ]kcM d ]mcI d ]ocG d ]scE d ]zcE d ]~cG d ^@cI d ^BcM d ^BcU +d ^@cX d ]~cZ d ]zc\ m ]ocX d ]mcU d ]mcM d ]ocI m ]~cI d ^@cM d ^@cU +d ]~cX m ]sc\ d ]pcZ d ]ocU d ]ocM d ]pcG d ]scE m ]zcE d ]}cG d ]~cM +d ]~cU d ]}cZ d ]zc\ m ]jbw m ^Zcn d ^Ucl d ^Rcf d ^Pc\ d ^PcV d ^RcM +d ^UcG d ^ZcE d ^]cE d ^bcG d ^ecM d ^fcV d ^fc\ d ^ecf d ^bcl d ^]cn +d ^Zcn m ^Ucj d ^Scf d ^Rc^ d ^RcU d ^ScM d ^UcI m ^bcI d ^ccM d ^ecU +d ^ec^ d ^ccf d ^bcj m ^Zcn d ^Vcl d ^Uch d ^Sc^ d ^ScU d ^UcK d ^VcG +d ^ZcE m ^]cE d ^`cG d ^bcK d ^ccU d ^cc^ d ^bch d ^`cl d ^]cn m ^Obw +m ^sc{ m ^sbw m _Rc{ m _Rbw m _qc{ m _qbw m `Pc{ m `Pbw m `oc{ m `obw +m aRcn d aRcE m aScl d aScG m aUcn d aUcE m aNcn d a_cn d adcl d aecj +d afcf d afc` d aec\ d adcZ d a_cX d aUcX m adcj d aecf d aec` d adc\ +m a_cn d abcl d adch d adc^ d abcZ d a_cX m aNcE d aYcE m aOcn d aRcl +m aPcn d aRcj m aVcn d aUcj m aXcn d aUcl m aRcG d aOcE m aRcI d aPcE +m aUcI d aVcE m aUcG d aXcE m aNbw m ]Kbl m ]Kah m ]sb^ d ]ob] d ]mbY +d ]mbS d ]obO d ]sbM d ]zbM d ]~bO d ^@bS d ^@bY d ]~b] d ]zb^ d ]sb^ +m ]pb] d ]obY d ]obS d ]pbO m ]}bO d ]~bS d ]~bY d ]}b] m ]sb^ d ]rb] +d ]pbY d ]pbS d ]rbO d ]sbM m ]zbM d ]{bO d ]}bS d ]}bY d ]{b] d ]zb^ +m ]sbM d ]obK d ]mbI d ]kbE d ]ka} d ]maz d ]oax d ]sav d ]zav d ]~ax +d ^@az d ^Ba} d ^BbE d ^@bI d ]~bK d ]zbM m ]obI d ]mbE d ]ma} d ]oaz +m ]~az d ^@a} d ^@bE d ]~bI m ]sbM d ]pbK d ]obE d ]oa} d ]pax d ]sav +m ]zav d ]}ax d ]~a} d ]~bE d ]}bK d ]zbM m ]jah m ^Zb[ d ^Zav m ^[b[ +d ^[ax m ^]b^ d ^]av m ^]b^ d ^XbY d ^UbW m ^Sav d ^cav m ^Zax d ^Vav +m ^Zaz d ^Xav m ^]az d ^^av m ^]ax d ^`av m ^Oah m ^sbl m ^sah m _Rbl +m _Rah m _qbl m _qah m `Pbl m `Pah m `obl m `oah m aYb^ d aUb] d aRbY +d aPbU d aObM d aObG d aPa? d aRa{ d aUax d aYav d a\av d aaax d ada{ +d aea? d afbG d afbM d aebU d adbY d aab] d a\b^ d aYb^ m aSbY d aRbU +d aPbO d aPbE d aRa? d aSa{ m aba{ d ada? d aebE d aebO d adbU d abbY +m aYb^ d aVb] d aSbW d aRbO d aRbE d aSa} d aVax d aYav m a\av d a_ax +d aba} d adbE d adbO d abbW d a_b] d a\b^ m aUa{ d aVa? d aYbA d a[bA +d a^a? d a_a{ d aaap d abal d aeal d afap d afat +stroke +m afat m aaat d abap d adan d aean m a_a{ d abar d adap d aeap d afar +m aNah m ]Ka] m ]K`Y m ]saO d ]oaM d ]maI d ]maC d ]oa@ d ]s`~ d ]z`~ +d ]~a@ d ^@aC d ^@aI d ]~aM d ]zaO d ]saO m ]paM d ]oaI d ]oaC d ]pa@ +m ]}a@ d ]~aC d ]~aI d ]}aM m ]saO d ]raM d ]paI d ]paC d ]ra@ d ]s`~ +m ]z`~ d ]{a@ d ]}aC d ]}aI d ]{aM d ]zaO m ]s`~ d ]o`| d ]m`z d ]k`v +d ]k`n d ]m`j d ]o`h d ]s`f d ]z`f d ]~`h d ^@`j d ^B`n d ^B`v d ^@`z +d ]~`| d ]z`~ m ]o`z d ]m`v d ]m`n d ]o`j m ]~`j d ^@`n d ^@`v d ]~`z +m ]s`~ d ]p`| d ]o`v d ]o`n d ]p`h d ]s`f m ]z`f d ]}`h d ]~`n d ]~`v +d ]}`| d ]z`~ m ]j`Y m ^RaG d ^RaE d ^SaE d ^SaG d ^RaG m ^RaI d ^SaI +d ^UaG d ^UaE d ^SaC d ^RaC d ^PaE d ^PaG d ^RaK d ^SaM d ^XaO d ^^aO +d ^caM d ^eaK d ^faG d ^faC d ^ea@ d ^``| d ^X`x d ^U`v d ^R`r d ^P`l +d ^P`f m ^caK d ^eaG d ^eaC d ^ca@ m ^^aO d ^baM d ^caG d ^caC d ^ba@ +d ^^`| d ^X`x m ^P`j d ^R`l d ^U`l d ^]`j d ^c`j d ^f`l m ^U`l d ^]`h +d ^c`h d ^e`j m ^U`l d ^]`f d ^c`f d ^e`h d ^f`l d ^f`p m ^O`Y m ^sa] +m ^s`Y m _Ra] m _R`Y m _qa] m _q`Y m `Pa] m `P`Y m `oa] m `o`Y m aRaO +d aR`f m aSaM d aS`h m aUaO d aU`f m aNaO d a_aO d adaM d aeaK d afaG +d afaC d aea@ d ad`~ d a_`| d aU`| m adaK d aeaG d aeaC d ada@ m a_aO +d abaM d adaI d adaB d ab`~ d a_`| m a[`| d a^`z d a_`v d ab`j d ad`f +d af`f d ah`j d ah`n m ab`n d ad`j d ae`h d af`h m a^`z d a_`x d ad`l +d ae`j d af`j d ah`l m aN`f d aY`f m aOaO d aRaM m aPaO d aRaK m aVaO +d aUaK m aXaO d aUaM m aR`h d aO`f m aR`j d aP`f m aU`j d aV`f m aU`h +d aX`f m aN`Y m ]K`M m ]K_I m ]s`@ d ]o_~ d ]m_z d ]m_t d ]o_p d ]s_n +d ]z_n d ]~_p d ^@_t d ^@_z d ]~_~ d ]z`@ d ]s`@ m ]p_~ d ]o_z d ]o_t +d ]p_p m ]}_p d ]~_t d ]~_z d ]}_~ m ]s`@ d ]r_~ d ]p_z d ]p_t d ]r_p +d ]s_n m ]z_n d ]{_p d ]}_t d ]}_z d ]{_~ d ]z`@ m ]s_n d ]o_l d ]m_j +d ]k_g d ]k__ d ]m_[ d ]o_Y d ]s_W d ]z_W d ]~_Y d ^@_[ d ^B__ d ^B_g +d ^@_j d ]~_l d ]z_n m ]o_j d ]m_g d ]m__ d ]o_[ m ]~_[ d ^@__ d ^@_g +d ]~_j m ]s_n d ]p_l d ]o_g d ]o__ d ]p_Y d ]s_W m ]z_W d ]}_Y d ]~__ +d ]~_g d ]}_l d ]z_n m ]j_I m ^R_x d ^R_v d ^S_v d ^S_x d ^R_x m ^R_z +d ^S_z d ^U_x d ^U_v d ^S_t d ^R_t d ^P_v d ^P_x d ^R_| d ^S_~ d ^X`@ +d ^^`@ d ^c_~ d ^e_z d ^e_t d ^c_p d ^^_n m ^b_~ d ^c_z d ^c_t d ^b_p +m ^]`@ d ^`_~ d ^b_z d ^b_t d ^`_p d ^]_n m ^Z_n d ^^_n d ^b_l d ^e_i +d ^f_e d ^f__ d ^e_[ d ^c_Y d ^^_W d ^X_W d ^S_Y d ^R_[ d ^P__ d ^P_a +d ^R_c d ^S_c d ^U_a d ^U__ d ^S_] d ^R_] m ^c_i d ^e_e d ^e__ d ^c_[ +m ^]_n d ^`_l d ^b_j d ^c_e d ^c__ d ^b_Y d ^^_W m ^R_a d ^R__ d ^S__ +d ^S_a d ^R_a m ^O_I m ^s`M m ^s_I m _R`M m _R_I m _q`M m _q_I m `P`M +m `P_I m `o`M m `o_I m ad_z d ae`@ d ae_t d ad_z d aa_~ d a\`@ d aW`@ +d aR_~ d aO_z d aO_t d aQ_p d aU_l d a__i d ab_g d ad_c d ad_] d ab_Y +m aQ_t d aR_p d aU_n d a__j d ab_i d ad_e m aR_~ d aQ_z d aQ_v d aR_r +d aU_p d a__l d ad_i d ae_e d ae__ d ad_[ d ab_Y d a]_W d aY_W d aT_Y +d aQ_] d aO_c d aO_W d aQ_] m aN_I m ]K^~ m ]K]z m ]s^p d ]o^o d ]m^k +d ]m^e d ]o^a d ]s^_ d ]z^_ d ]~^a d ^@^e d ^@^k d ]~^o d ]z^p d ]s^p +m ]p^o d ]o^k d ]o^e d ]p^a m ]}^a d ]~^e d ]~^k d ]}^o m ]s^p d ]r^o +d ]p^k d ]p^e d ]r^a d ]s^_ m ]z^_ d ]{^a d ]}^e d ]}^k d ]{^o d ]z^p +m ]s^_ d ]o^] d ]m^[ d ]k^W d ]k^O d ]m^K d ]o^J d ]s^H d ]z^H d ]~^J +d ^@^K d ^B^O d ^B^W d ^@^[ d ]~^] d ]z^_ m ]o^[ d ]m^W d ]m^O d ]o^K +m ]~^K d ^@^O d ^@^W d ]~^[ m ]s^_ d ]p^] d ]o^W d ]o^O d ]p^J d ]s^H +m ]z^H d ]}^J d ]~^O d ]~^W d ]}^] d ]z^_ m ]j]z m ^]^k d ^]^H m ^^^m +d ^^^J m ^`^p d ^`^H m ^`^p d ^O^S d ^h^S m ^X^H d ^e^H m ^]^J d ^Z^H +m ^]^K d ^[^H m ^`^K d ^b^H m ^`^J d ^c^H m ^O]z m ^s^~ m ^s]z m _R^~ +m _R]z m _q^~ m _q]z m `P^~ m `P]z m `o^~ m `o]z m aN^p d aN^e m aY^p +d aY^H m aZ^o d aZ^J m a\^p d a\^H m ag^p d ag^e m aN^p d ag^p m aT^H +d aa^H m aO^p d aN^e m aQ^p d aN^k m aR^p d aN^m m aU^p d aN^o m a_^p +d ag^o m ab^p d ag^m m ad^p d ag^k m ae^p d ag^e m aY^J d aU^H m aY^K +d aW^H m a\^K d a]^H m a\^J d a_^H m aN]z m ]K]o m ]K\k m ]s]a d ]o]_ +d ]m][ d ]m]U d ]o]R d ]s]P d ]z]P d ]~]R d ^@]U d ^@][ d ]~]_ d ]z]a +d ]s]a m ]p]_ d ]o][ d ]o]U d ]p]R m ]}]R d ]~]U d ]~][ d ]}]_ m ]s]a +d ]r]_ d ]p][ d ]p]U d ]r]R d ]s]P m ]z]P d ]{]R d ]}]U d ]}][ d ]{]_ +d ]z]a m ]s]P d ]o]N d ]m]L d ]k]H d ]k]@ d ]m\| d ]o\z d ]s\x d ]z\x +d ]~\z d ^@\| d ^B]@ d ^B]H d ^@]L d ]~]N d ]z]P m ]o]L d ]m]H d ]m]@ +d ]o\| m ]~\| d ^@]@ d ^@]H d ]~]L m ]s]P d ]p]N d ]o]H d ]o]@ d ]p\z +d ]s\x m ]z\x d ]}\z d ]~]@ d ]~]H d ]}]N d ]z]P m ]j\k m ^S]a d ^P]N +d ^S]R d ^X]S d ^]]S d ^b]R d ^e]N d ^f]H d ^f]D d ^e\~ d ^b\z d ^]\x +d ^X\x d ^S\z d ^R\| d ^P]@ d ^P]B d ^R]D d ^S]D d ^U]B d ^U]@ d ^S\~ +d ^R\~ m ^c]N d ^e]J d ^e]B d ^c\~ m ^]]S d ^`]R d ^b]P d ^c]J d ^c]B +d ^b\| d ^`\z d ^]\x m ^R]B d ^R]@ d ^S]@ d ^S]B d ^R]B m ^S]a d ^c]a +m ^S]_ d ^`]_ m ^S]] d ^Z]] d ^`]_ d ^c]a m ^O\k m ^s]o m ^s\k m _R]o +m _R\k m _q]o m _q\k m `P]o m `P\k m `o]o m `o\k m aR]a d aR]D d aS\~ +d aV\z d aZ\x d a]\x d aa\z d ac\~ d ae]D d ae]_ m aS]_ d aS]B +stroke +m aS]B d aT\~ m aT]a d aT]B d aV\| d aW\z d aZ\x m aN]a d aX]a m aa]a +d ai]a m aO]a d aR]_ m aP]a d aR]] m aV]a d aT]] m aW]a d aT]_ m ab]a +d ae]_ m ag]a d ae]_ m aN\k m ]K\_ m ]K[[ m ]s\R d ]o\P d ]m\L d ]m\F +d ]o\B d ]s\@ d ]z\@ d ]~\B d ^@\F d ^@\L d ]~\P d ]z\R d ]s\R m ]p\P +d ]o\L d ]o\F d ]p\B m ]}\B d ]~\F d ]~\L d ]}\P m ]s\R d ]r\P d ]p\L +d ]p\F d ]r\B d ]s\@ m ]z\@ d ]{\B d ]}\F d ]}\L d ]{\P d ]z\R m ]s\@ +d ]o[~ d ]m[| d ]k[y d ]k[q d ]m[m d ]o[k d ]s[i d ]z[i d ]~[k d ^@[m +d ^B[q d ^B[y d ^@[| d ]~[~ d ]z\@ m ]o[| d ]m[y d ]m[q d ]o[m m ]~[m +d ^@[q d ^@[y d ]~[| m ]s\@ d ]p[~ d ]o[y d ]o[q d ]p[k d ]s[i m ]z[i +d ]}[k d ]~[q d ]~[y d ]}[~ d ]z\@ m ]j[[ m ^b\L d ^b\J d ^c\J d ^c\L +d ^b\L m ^c\N d ^b\N d ^`\L d ^`\J d ^b\H d ^c\H d ^e\J d ^e\L d ^c\P +d ^`\R d ^[\R d ^V\P d ^S\L d ^R\H d ^P\@ d ^P[u d ^R[o d ^U[k d ^Z[i +d ^][i d ^b[k d ^e[o d ^f[u d ^f[w d ^e[| d ^b\@ d ^]\B d ^Z\B d ^V\@ +d ^U[~ d ^S[{ m ^U\L d ^S\H d ^R\@ d ^R[u d ^S[o d ^U[m m ^c[o d ^e[s +d ^e[y d ^c[| m ^[\R d ^X\P d ^V\N d ^U\J d ^S\B d ^S[u d ^U[o d ^V[k +d ^Z[i m ^][i d ^`[k d ^b[m d ^c[s d ^c[y d ^b[~ d ^`\@ d ^]\B m ^O[[ +m ^s\_ m ^s[[ m _R\_ m _R[[ m _q\_ m _q[[ m `P\_ m `P[[ m `o\_ m `o[[ +m aO\R d aZ[i m aQ\R d aZ[o d aZ[i m aR\R d a\[o m ae\P d aZ[i m aN\R +d aW\R m a_\R d ai\R m aN\R d aQ\N m aT\R d aR\N m aU\R d aR\P m ab\R +d ae\P m ag\R d ae\P m aN[[ m ]K[P m ]KZL m ]s[C d ]o[A d ]mZ} d ]mZw +d ]oZs d ]sZq d ]zZq d ]~Zs d ^@Zw d ^@Z} d ]~[A d ]z[C d ]s[C m ]p[A +d ]oZ} d ]oZw d ]pZs m ]}Zs d ]~Zw d ]~Z} d ]}[A m ]s[C d ]r[A d ]pZ} +d ]pZw d ]rZs d ]sZq m ]zZq d ]{Zs d ]}Zw d ]}Z} d ]{[A d ]z[C m ]sZq +d ]oZo d ]mZm d ]kZi d ]kZa d ]mZ^ d ]oZ\ d ]sZZ d ]zZZ d ]~Z\ d ^@Z^ +d ^BZa d ^BZi d ^@Zm d ]~Zo d ]zZq m ]oZm d ]mZi d ]mZa d ]oZ^ m ]~Z^ +d ^@Za d ^@Zi d ]~Zm m ]sZq d ]pZo d ]oZi d ]oZa d ]pZ\ d ]sZZ m ]zZZ +d ]}Z\ d ]~Za d ]~Zi d ]}Zo d ]zZq m ]jZL m ^P[C d ^PZw m ^f[C d ^fZ} +d ^eZw d ^^Zm d ^]Zi d ^[Za d ^[ZZ m ^]Zk d ^[Zg d ^ZZa d ^ZZZ m ^eZw +d ^]Zm d ^ZZg d ^XZa d ^XZZ d ^[ZZ m ^PZ{ d ^RZ? d ^U[C d ^X[C d ^`Z} +d ^cZ} d ^eZ? d ^f[C m ^SZ? d ^U[A d ^X[A d ^[Z? m ^PZ{ d ^RZ} d ^UZ? +d ^XZ? d ^`Z} m ^OZL m ^s[P m ^sZL m _R[P m _RZL m _q[P m _qZL m `P[P +m `PZL m `o[P m `oZL m aP[C d aVZZ m aR[C d aVZc d aVZZ m aS[C d aWZc +m a[[C d aWZc d aVZZ m a[[C d aaZZ m a][C d aaZc d aaZZ m a^[C d abZc +m af[A d abZc d aaZZ m aN[C d aW[C m a[[C d a^[C m ab[C d aj[C m aN[C +d aR[A m aO[C d aRZ? m aT[C d aSZ? m aV[C d aS[A m ac[C d af[A m ai[C +d af[A m aNZL m ]KZA m ]KX} m ]sYs d ]oYq d ]mYm d ]mYg d ]oYd d ]sYb +d ]zYb d ]~Yd d ^@Yg d ^@Ym d ]~Yq d ]zYs d ]sYs m ]pYq d ]oYm d ]oYg +d ]pYd m ]}Yd d ]~Yg d ]~Ym d ]}Yq m ]sYs d ]rYq d ]pYm d ]pYg d ]rYd +d ]sYb m ]zYb d ]{Yd d ]}Yg d ]}Ym d ]{Yq d ]zYs m ]sYb d ]oY` d ]mY^ +d ]kYZ d ]kYR d ]mYN d ]oYL d ]sYJ d ]zYJ d ]~YL d ^@YN d ^BYR d ^BYZ +d ^@Y^ d ]~Y` d ]zYb m ]oY^ d ]mYZ d ]mYR d ]oYN m ]~YN d ^@YR d ^@YZ +d ]~Y^ m ]sYb d ]pY` d ]oYZ d ]oYR d ]pYL d ]sYJ m ]zYJ d ]}YL d ]~YR +d ]~YZ d ]}Y` d ]zYb m ]jX} m ^XYs d ^SYq d ^RYm d ^RYg d ^SYd d ^XYb +d ^^Yb d ^cYd d ^eYg d ^eYm d ^cYq d ^^Ys d ^XYs m ^UYq d ^SYm d ^SYg +d ^UYd m ^bYd d ^cYg d ^cYm d ^bYq m ^XYs d ^VYq d ^UYm d ^UYg d ^VYd +d ^XYb m ^^Yb d ^`Yd d ^bYg d ^bYm d ^`Yq d ^^Ys m ^XYb d ^SY` d ^RY^ +d ^PYZ d ^PYR d ^RYN d ^SYL d ^XYJ d ^^YJ d ^cYL d ^eYN d ^fYR d ^fYZ +d ^eY^ d ^cY` d ^^Yb m ^SY^ d ^RYZ d ^RYR d ^SYN m ^cYN d ^eYR d ^eYZ +d ^cY^ m ^XYb d ^UY` d ^SYZ d ^SYR d ^UYL d ^XYJ m ^^YJ d ^bYL d ^cYR +d ^cYZ d ^bY` d ^^Yb m ^OX} m ^sZA m ^sX} m _RZA m _RX} m _qZA m _qX} +m `PZA m `PX} m `oZA m `oX} m aOYs d abYJ m aQYs d adYJ m aRYs d aeYJ +m adYq d aQYL m aNYs d aWYs m a_Ys d aiYs m aNYJ d aUYJ m a]YJ d aiYJ +m aNYs d aRYo m aTYs d aRYo m aUYs d aRYq m aaYs d adYq m agYs d adYq +m aQYL d aNYJ m aQYL d aTYJ m abYL d a_YJ m abYN d aaYJ m abYN d agYJ +m aNX} m ]KXq m ]KWm m ]sXd d ]oXb d ]mX^ d ]mXX d ]oXT d ]sXR d ]zXR +d ]~XT d ^@XX d ^@X^ d ]~Xb d ]zXd d ]sXd m ]pXb d ]oX^ d ]oXX d ]pXT +m ]}XT d ]~XX d ]~X^ d ]}Xb m ]sXd d ]rXb d ]pX^ d ]pXX d ]rXT d ]sXR +m ]zXR d ]{XT d ]}XX d ]}X^ d ]{Xb d ]zXd m ]sXR d ]oXP d ]mXN d ]kXK +d ]kXC d ]mW? d ]oW} d ]sW{ d ]zW{ d ]~W} d ^@W? d ^BXC d ^BXK d ^@XN +d ]~XP d ]zXR m ]oXN d ]mXK d ]mXC d ]oW? m ]~W? d ^@XC d ^@XK d ]~XN +m ]sXR d ]pXP d ]oXK d ]oXC d ]pW} d ]sW{ m ]zW{ d ]}W} d ]~XC d ]~XK +d ]}XP d ]zXR m ]jWm m ^SXC d ^SXA d ^UXA d ^UXC d ^SXC m ^cXR d ^bXN +d ^`XM d ^]XK d ^ZXK d ^UXM d ^RXP d ^PXV d ^PXX d ^RX^ d ^UXb d ^ZXd +d ^]Xd d ^bXb d ^eX^ d ^fXX d ^fXM d ^eXE d ^cXA d ^`W} d ^[W{ d ^VW{ +d ^SW} d ^RXA d ^RXC d ^SXE d ^UXE d ^VXC d ^VXA d ^UW? d ^SW? m ^SXP +d ^RXT d ^RXZ d ^SX^ m ^bX` d ^cX^ d ^eXX d ^eXM d ^cXE d ^bXA m ^ZXK +d ^VXM d ^UXN d ^SXT d ^SXZ d ^UX` d ^VXb d ^ZXd m ^]Xd d ^`Xb d ^bX^ +d ^cXX d ^cXK d ^bXC d ^`W? d ^^W} d ^[W{ m ^OWm m ^sXq m ^sWm m _RXq +m _RWm m _qXq m _qWm m `PXq m `PWm m `oXq m `oWm m aOXd d aYXN d aYW{ +m aPXd d a[XN d a[W} m aRXd d a\XN d a\W{ m aeXb d a\XN m aNXd d aVXd +m aaXd d aiXd m aUW{ d aaW{ m aNXd d aPXb +stroke +m aPXb m aUXd d aRXb m abXd d aeXb m ahXd d aeXb m aYW} d aVW{ m aYW? +d aXW{ m a\W? d a^W{ m a\W} d a_W{ m aNWm m ]KWb m ]KV^ m ]oVs d ]oVq +d ]pVq d ]pVs d ]oVs m ]~WC d ]}V? d ]{V} d ]xV{ d ]uV{ d ]pV} d ]mWA +d ]kWG d ]kWI d ]mWO d ]pWS d ]uWT d ]xWT d ]}WS d ^@WO d ^BWI d ^BV} +d ^@Vu d ]~Vq d ]{Vn d ]vVl d ]rVl d ]oVn d ]mVq d ]mVs d ]oVu d ]pVu +d ]rVs d ]rVq d ]pVp d ]oVp m ]oWA d ]mWE d ]mWK d ]oWO m ]}WQ d ]~WO +d ^@WI d ^@V} d ]~Vu d ]}Vq m ]uV{ d ]rV} d ]pV? d ]oWE d ]oWK d ]pWQ +d ]rWS d ]uWT m ]xWT d ]{WS d ]}WO d ]~WI d ]~V{ d ]}Vs d ]{Vp d ]zVn +d ]vVl m ]jV^ m ^ZWT d ^UWS d ^RWM d ^PWC d ^PV} d ^RVs d ^UVn d ^ZVl +d ^]Vl d ^bVn d ^eVs d ^fV} d ^fWC d ^eWM d ^bWS d ^]WT d ^ZWT m ^UWQ +d ^SWM d ^RWE d ^RV{ d ^SVs d ^UVp m ^bVp d ^cVs d ^eV{ d ^eWE d ^cWM +d ^bWQ m ^ZWT d ^VWS d ^UWO d ^SWE d ^SV{ d ^UVq d ^VVn d ^ZVl m ^]Vl +d ^`Vn d ^bVq d ^cV{ d ^cWE d ^bWO d ^`WS d ^]WT m ^OV^ m ^sWb m ^sV^ +m _RWb m _RV^ m _qWb m _qV^ m `PWb m `PV^ m `oWb m `oV^ m aeWT d aOWT +d aOWI m abWT d aOVl m adWT d aQVl m aeWT d aRVl m aOVl d aeVl d aeVw +m aQWT d aOWI m aRWT d aOWO m aTWT d aOWQ m aWWT d aOWS m a]Vl d aeVn +m aaVl d aeVp m abVl d aeVq m adVl d aeVw m aNV^ m ]KVS m ]KUO m ]oUd +d ]oUb d ]pUb d ]pUd d ]oUd m ]~Ut d ]}Up d ]{Un d ]xUl d ]uUl d ]pUn +d ]mUr d ]kUx d ]kUy d ]mU? d ]pVC d ]uVE d ]xVE d ]}VC d ^@U? d ^BUy +d ^BUn d ^@Uf d ]~Ub d ]{U^ d ]vU\ d ]rU\ d ]oU^ d ]mUb d ]mUd d ]oUf +d ]pUf d ]rUd d ]rUb d ]pU` d ]oU` m ]oUr d ]mUv d ]mU{ d ]oU? m ]}VA +d ]~U? d ^@Uy d ^@Un d ]~Uf d ]}Ub m ]uUl d ]rUn d ]pUp d ]oUv d ]oU{ +d ]pVA d ]rVC d ]uVE m ]xVE d ]{VC d ]}U? d ]~Uy d ]~Ul d ]}Ud d ]{U` +d ]zU^ d ]vU\ m ]jUO m ^ZVA d ^ZU\ m ^[VA d ^[U^ m ^]VE d ^]U\ m ^]VE +d ^XU? d ^UU} m ^SU\ d ^cU\ m ^ZU^ d ^VU\ m ^ZU` d ^XU\ m ^]U` d ^^U\ +m ^]U^ d ^`U\ m ^OUO m ^sVS m ^sUO m _RVS m _RUO m _qVS m _qUO m `PVS +m `PUO m `oVS m `oUO m aRVM d aRUO m aTVM d aTUO m aRVM d a`VM m aRUO +d a`UO m aNUO m ]KUC m ]KS? m ]oTU d ]oTS d ]pTS d ]pTU d ]oTU m ]~Td +d ]}T` d ]{T^ d ]xT] d ]uT] d ]pT^ d ]mTb d ]kTh d ]kTj d ]mTp d ]pTt +d ]uTv d ]xTv d ]}Tt d ^@Tp d ^BTj d ^BT^ d ^@TW d ]~TS d ]{TO d ]vTM +d ]rTM d ]oTO d ]mTS d ]mTU d ]oTW d ]pTW d ]rTU d ]rTS d ]pTQ d ]oTQ +m ]oTb d ]mTf d ]mTl d ]oTp m ]}Tr d ]~Tp d ^@Tj d ^@T^ d ]~TW d ]}TS +m ]uT] d ]rT^ d ]pT` d ]oTf d ]oTl d ]pTr d ]rTt d ]uTv m ]xTv d ]{Tt +d ]}Tp d ]~Tj d ]~T] d ]}TU d ]{TQ d ]zTO d ]vTM m ]jS? m ^RTn d ^RTl +d ^STl d ^STn d ^RTn m ^RTp d ^STp d ^UTn d ^UTl d ^STj d ^RTj d ^PTl +d ^PTn d ^RTr d ^STt d ^XTv d ^^Tv d ^cTt d ^eTr d ^fTn d ^fTj d ^eTf +d ^`Tb d ^XT^ d ^UT] d ^RTY d ^PTS d ^PTM m ^cTr d ^eTn d ^eTj d ^cTf +m ^^Tv d ^bTt d ^cTn d ^cTj d ^bTf d ^^Tb d ^XT^ m ^PTQ d ^RTS d ^UTS +d ^]TQ d ^cTQ d ^fTS m ^UTS d ^]TO d ^cTO d ^eTQ m ^UTS d ^]TM d ^cTM +d ^eTO d ^fTS d ^fTW m ^OS? m ^sUC m ^sS? m _RUC m _RS? m _qUC m _qS? +m `PUC m `PS? m `oUC m `oS? m aNTv d agTG m aNS? m ]KSt m ]KRp m ]oSE +d ]oSC d ]pSC d ]pSE d ]oSE m ]~SU d ]}SQ d ]{SO d ]xSM d ]uSM d ]pSO +d ]mSS d ]kSY d ]kS[ d ]mSa d ]pSe d ]uSf d ]xSf d ]}Se d ^@Sa d ^BS[ +d ^BSO d ^@SG d ]~SC d ]{S@ d ]vR~ d ]rR~ d ]oS@ d ]mSC d ]mSE d ]oSG +d ]pSG d ]rSE d ]rSC d ]pSB d ]oSB m ]oSS d ]mSW d ]mS] d ]oSa m ]}Sc +d ]~Sa d ^@S[ d ^@SO d ]~SG d ]}SC m ]uSM d ]rSO d ]pSQ d ]oSW d ]oS] +d ]pSc d ]rSe d ]uSf m ]xSf d ]{Se d ]}Sa d ]~S[ d ]~SM d ]}SE d ]{SB +d ]zS@ d ]vR~ m ]jRp m ^RS_ d ^RS] d ^SS] d ^SS_ d ^RS_ m ^RSa d ^SSa +d ^US_ d ^US] d ^SS[ d ^RS[ d ^PS] d ^PS_ d ^RSc d ^SSe d ^XSf d ^^Sf +d ^cSe d ^eSa d ^eS[ d ^cSW d ^^SU m ^bSe d ^cSa d ^cS[ d ^bSW m ^]Sf +d ^`Se d ^bSa d ^bS[ d ^`SW d ^]SU m ^ZSU d ^^SU d ^bSS d ^eSO d ^fSK +d ^fSE d ^eSB d ^cS@ d ^^R~ d ^XR~ d ^SS@ d ^RSB d ^PSE d ^PSG d ^RSI +d ^SSI d ^USG d ^USE d ^SSC d ^RSC m ^cSO d ^eSK d ^eSE d ^cSB m ^]SU +d ^`SS d ^bSQ d ^cSK d ^cSE d ^bS@ d ^^R~ m ^RSG d ^RSE d ^SSE d ^SSG +d ^RSG m ^ORp m ^sSt m ^sRp m _RSt m _RRp m _qSt m _qRp m `PSt m `PRp +m `oSt m `oRp m a\Sn d a\Rp m a^Sn d a^Rp m aPSn d a^Sn m aPRp d a^Rp +m aNRp m ]KRe m ]KQa m ]oQv d ]oQt d ]pQt d ]pQv d ]oQv m ]~RF d ]}RB +d ]{R@ d ]xQ~ d ]uQ~ d ]pR@ d ]mRD d ]kRJ d ]kRK d ]mRQ d ]pRU d ]uRW +d ]xRW d ]}RU d ^@RQ d ^BRK d ^BR@ d ^@Qx d ]~Qt d ]{Qp d ]vQn d ]rQn +d ]oQp d ]mQt d ]mQv d ]oQx d ]pQx d ]rQv d ]rQt d ]pQr d ]oQr m ]oRD +d ]mRH d ]mRM d ]oRQ m ]}RS d ]~RQ d ^@RK d ^@R@ d ]~Qx d ]}Qt m ]uQ~ +d ]rR@ d ]pRB d ]oRH d ]oRM d ]pRS d ]rRU d ]uRW m ]xRW d ]{RU d ]}RQ +d ]~RK d ]~Q~ d ]}Qv d ]{Qr d ]zQp d ]vQn m ]jQa m ^]RQ d ^]Qn m ^^RS +d ^^Qp m ^`RW d ^`Qn m ^`RW d ^OQz d ^hQz m ^XQn d ^eQn m ^]Qp d ^ZQn +m ^]Qr d ^[Qn m ^`Qr d ^bQn m ^`Qp d ^cQn m ^OQa m ^sRe m ^sQa m _RRe +m _RQa m _qRe m _qQa m `PRe m `PQa m `oRe m `oQa m aURK d aYRQ d a]RK +m aORF d aYRO d abRF m aYRO d aYQn m aNQa m ]KQU m ]KPQ m ]oPg d ]oPe +d ]pPe d ]pPg d ]oPg m ]~Pv d ]}Pr d ]{Pq d ]xPo d ]uPo d ]pPq d ]mPt +d ]kPz d ]kP| d ]mQB d ]pQF d ]uQH d ]xQH d ]}QF d ^@QB d ^BP| d ^BPq +d ^@Pi d ]~Pe d ]{Pa d ]vP_ +stroke +m ]vP_ d ]rP_ d ]oPa d ]mPe d ]mPg d ]oPi d ]pPi d ]rPg d ]rPe d ]pPc +d ]oPc m ]oPt d ]mPx d ]mP~ d ]oQB m ]}QD d ]~QB d ^@P| d ^@Pq d ]~Pi +d ]}Pe m ]uPo d ]rPq d ]pPr d ]oPx d ]oP~ d ]pQD d ]rQF d ]uQH m ]xQH +d ]{QF d ]}QB d ]~P| d ]~Po d ]}Pg d ]{Pc d ]zPa d ]vP_ m ]jPQ m ^SQH +d ^PPt d ^SPx d ^XPz d ^]Pz d ^bPx d ^ePt d ^fPo d ^fPk d ^ePe d ^bPa +d ^]P_ d ^XP_ d ^SPa d ^RPc d ^PPg d ^PPi d ^RPk d ^SPk d ^UPi d ^UPg +d ^SPe d ^RPe m ^cPt d ^ePq d ^ePi d ^cPe m ^]Pz d ^`Px d ^bPv d ^cPq +d ^cPi d ^bPc d ^`Pa d ^]P_ m ^RPi d ^RPg d ^SPg d ^SPi d ^RPi m ^SQH +d ^cQH m ^SQF d ^`QF m ^SQD d ^ZQD d ^`QF d ^cQH m ^OPQ m ^sQU m ^sPQ +m _RQU m _RPQ m _qQU m _qPQ m `PQU m `PPQ m `oQU m `oPQ m aNP[ d ahP[ +m aNPQ m ]KPF m ]KOB m ]oOW d ]oOV d ]pOV d ]pOW d ]oOW m ]~Og d ]}Oc +d ]{Oa d ]xO_ d ]uO_ d ]pOa d ]mOe d ]kOk d ]kOm d ]mOs d ]pOw d ]uOy +d ]xOy d ]}Ow d ^@Os d ^BOm d ^BOa d ^@OY d ]~OV d ]{OR d ]vOP d ]rOP +d ]oOR d ]mOV d ]mOW d ]oOY d ]pOY d ]rOW d ]rOV d ]pOT d ]oOT m ]oOe +d ]mOi d ]mOo d ]oOs m ]}Ou d ]~Os d ^@Om d ^@Oa d ]~OY d ]}OV m ]uO_ +d ]rOa d ]pOc d ]oOi d ]oOo d ]pOu d ]rOw d ]uOy m ]xOy d ]{Ow d ]}Os +d ]~Om d ]~O_ d ]}OW d ]{OT d ]zOR d ]vOP m ]jOB m ^bOs d ^bOq d ^cOq +d ^cOs d ^bOs m ^cOu d ^bOu d ^`Os d ^`Oq d ^bOo d ^cOo d ^eOq d ^eOs +d ^cOw d ^`Oy d ^[Oy d ^VOw d ^SOs d ^ROo d ^POg d ^PO[ d ^ROV d ^UOR +d ^ZOP d ^]OP d ^bOR d ^eOV d ^fO[ d ^fO] d ^eOc d ^bOg d ^]Oi d ^ZOi +d ^VOg d ^UOe d ^SOa m ^UOs d ^SOo d ^ROg d ^RO[ d ^SOV d ^UOT m ^cOV +d ^eOY d ^eO_ d ^cOc m ^[Oy d ^XOw d ^VOu d ^UOq d ^SOi d ^SO[ d ^UOV +d ^VOR d ^ZOP m ^]OP d ^`OR d ^bOT d ^cOY d ^cO_ d ^bOe d ^`Og d ^]Oi +m ^OOB m ^sPF m ^sOB m _RPF m _ROB m _qPF m _qOB m `PPF m `POB m `oPF +m `oOB m aZOy d aUOw d aROs d aROm d aUOk d aWOk d aZOm d aZOo d aWOq +d aUOq d aROo m aUOo d aUOm d aWOm d aWOo d aUOo m aUOw d aROo m aROs +d aUOq m aNOB m ]KNw m ]KMs m ]oNH d ]oNF d ]pNF d ]pNH d ]oNH m ]~NX +d ]}NT d ]{NR d ]xNP d ]uNP d ]pNR d ]mNV d ]kN[ d ]kN] d ]mNc d ]pNg +d ]uNi d ]xNi d ]}Ng d ^@Nc d ^BN] d ^BNR d ^@NJ d ]~NF d ]{NB d ]vN@ +d ]rN@ d ]oNB d ]mNF d ]mNH d ]oNJ d ]pNJ d ]rNH d ]rNF d ]pND d ]oND +m ]oNV d ]mNZ d ]mN_ d ]oNc m ]}Ne d ]~Nc d ^@N] d ^@NR d ]~NJ d ]}NF +m ]uNP d ]rNR d ]pNT d ]oNZ d ]oN_ d ]pNe d ]rNg d ]uNi m ]xNi d ]{Ng +d ]}Nc d ]~N] d ]~NP d ]}NH d ]{ND d ]zNB d ]vN@ m ]jMs m ^PNi d ^PN] +m ^fNi d ^fNc d ^eN] d ^^NT d ^]NP d ^[NH d ^[N@ m ^]NR d ^[NN d ^ZNH +d ^ZN@ m ^eN] d ^]NT d ^ZNN d ^XNH d ^XN@ d ^[N@ m ^PNa d ^RNe d ^UNi +d ^XNi d ^`Nc d ^cNc d ^eNe d ^fNi m ^SNe d ^UNg d ^XNg d ^[Ne m ^PNa +d ^RNc d ^UNe d ^XNe d ^`Nc m ^OMs m ^sNw m ^sMs m _RNw m _RMs m _qNw +m _qMs m `PNw m `PMs m `oNw m `oMs m aRNV d aRNX d aTNX d aTNT d aQNT +d aQNX d aRNZ d aUN[ d a\N[ d a_NZ d aaNX d abNT d abNF d adNB d aeN@ +m a_NX d aaNT d aaNF d abNB m a\N[ d a]NZ d a_NV d a_NF d aaNB d aeN@ +d agN@ m a_NR d a]NP d aUNN d aQNL d aONH d aONF d aQNB d aUN@ d aZN@ +d a]NB d a_NF m aRNL d aQNH d aQNF d aRNB m a]NP d aWNN d aTNL d aRNH +d aRNF d aTNB d aUN@ m aNMs m ]KMg m ]KLc m ]oLy d ]oLw d ]pLw d ]pLy +d ]oLy m ]~MH d ]}MD d ]{MC d ]xMA d ]uMA d ]pMC d ]mMF d ]kML d ]kMN +d ]mMT d ]pMX d ]uMZ d ]xMZ d ]}MX d ^@MT d ^BMN d ^BMC d ^@L{ d ]~Lw +d ]{Ls d ]vLq d ]rLq d ]oLs d ]mLw d ]mLy d ]oL{ d ]pL{ d ]rLy d ]rLw +d ]pLu d ]oLu m ]oMF d ]mMJ d ]mMP d ]oMT m ]}MV d ]~MT d ^@MN d ^@MC +d ]~L{ d ]}Lw m ]uMA d ]rMC d ]pMD d ]oMJ d ]oMP d ]pMV d ]rMX d ]uMZ +m ]xMZ d ]{MX d ]}MT d ]~MN d ]~MA d ]}Ly d ]{Lu d ]zLs d ]vLq m ]jLc +m ^XMZ d ^SMX d ^RMT d ^RMN d ^SMJ d ^XMH d ^^MH d ^cMJ d ^eMN d ^eMT +d ^cMX d ^^MZ d ^XMZ m ^UMX d ^SMT d ^SMN d ^UMJ m ^bMJ d ^cMN d ^cMT +d ^bMX m ^XMZ d ^VMX d ^UMT d ^UMN d ^VMJ d ^XMH m ^^MH d ^`MJ d ^bMN +d ^bMT d ^`MX d ^^MZ m ^XMH d ^SMF d ^RMD d ^PMA d ^PLy d ^RLu d ^SLs +d ^XLq d ^^Lq d ^cLs d ^eLu d ^fLy d ^fMA d ^eMD d ^cMF d ^^MH m ^SMD +d ^RMA d ^RLy d ^SLu m ^cLu d ^eLy d ^eMA d ^cMD m ^XMH d ^UMF d ^SMA +d ^SLy d ^ULs d ^XLq m ^^Lq d ^bLs d ^cLy d ^cMA d ^bMF d ^^MH m ^OLc +m ^sMg m ^sLc m _RMg m _RLc m _qMg m _qLc m `PMg m `PLc m `oMg m `oLc +m aRMZ d aRLq d aTLs d aWLs m aTMX d aTLu m aNMZ d aUMZ d aULs m aUMF +d aWMJ d aZML d a]ML d aaMJ d adMF d afMA d afL} d adLw d aaLs d a]Lq +d aZLq d aWLs d aULw m acMF d adMC d adL{ d acLw m a]ML d a`MJ d aaMH +d acMC d acL{ d aaLu d a`Ls d a]Lq m aOMZ d aRMX m aQMZ d aRMV m aNLc +m ]KLX m ]KKT m ]oKi d ]oKg d ]pKg d ]pKi d ]oKi m ]~Ky d ]}Ku d ]{Ks +d ]xKq d ]uKq d ]pKs d ]mKw d ]kK} d ]kK? d ]mLE d ]pLI d ]uLK d ]xLK +d ]}LI d ^@LE d ^BK? d ^BKs d ^@Kk d ]~Kg d ]{Kd d ]vKb d ]rKb d ]oKd +d ]mKg d ]mKi d ]oKk d ]pKk d ]rKi d ]rKg d ]pKf +stroke +m ]pKf d ]oKf m ]oKw d ]mK{ d ]mLA d ]oLE m ]}LG d ]~LE d ^@K? d ^@Ks +d ]~Kk d ]}Kg m ]uKq d ]rKs d ]pKu d ]oK{ d ]oLA d ]pLG d ]rLI d ]uLK +m ]xLK d ]{LI d ]}LE d ]~K? d ]~Kq d ]}Ki d ]{Kf d ]zKd d ]vKb m ]jKT +m ^SKi d ^SKg d ^UKg d ^UKi d ^SKi m ^cKy d ^bKu d ^`Ks d ^]Kq d ^ZKq +d ^UKs d ^RKw d ^PK} d ^PK? d ^RLE d ^ULI d ^ZLK d ^]LK d ^bLI d ^eLE +d ^fK? d ^fKs d ^eKk d ^cKg d ^`Kd d ^[Kb d ^VKb d ^SKd d ^RKg d ^RKi +d ^SKk d ^UKk d ^VKi d ^VKg d ^UKf d ^SKf m ^SKw d ^RK{ d ^RLA d ^SLE +m ^bLG d ^cLE d ^eK? d ^eKs d ^cKk d ^bKg m ^ZKq d ^VKs d ^UKu d ^SK{ +d ^SLA d ^ULG d ^VLI d ^ZLK m ^]LK d ^`LI d ^bLE d ^cK? d ^cKq d ^bKi +d ^`Kf d ^^Kd d ^[Kb m ^OKT m ^sLX m ^sKT m _RLX m _RKT m _qLX m _qKT +m `PLX m `PKT m `oLX m `oKT m acKu d acKw d aaKw d aaKs d aeKs d aeKw +d aaK{ d a^K} d aYK} d aTK{ d aQKw d aOKq d aOKm d aQKg d aTKd d aYKb +d a\Kb d aaKd d aeKg m aRKw d aQKs d aQKk d aRKg m aYK} d aVK{ d aTKy +d aRKs d aRKk d aTKf d aVKd d aYKb m aNKT m ]VJw d ]VJR m ]XJw d ]XJT +m ]YJ{ d ]YJR m ]YJ{ d ]TJu d ]QJs m ]PJR d ]`JR m ]VJT d ]SJR m ]VJV +d ]TJR m ]YJV d ][JR m ]YJT d ]\JR m ]KJE m ]{J{ d ]vJy d ]sJs d ]qJj +d ]qJd d ]sJZ d ]vJT d ]{JR d ]~JR d ^CJT d ^FJZ d ^GJd d ^GJj d ^FJs +d ^CJy d ]~J{ d ]{J{ m ]vJw d ]tJs d ]sJl d ]sJb d ]tJZ d ]vJV m ^CJV +d ^DJZ d ^FJb d ^FJl d ^DJs d ^CJw m ]{J{ d ]xJy d ]vJu d ]tJl d ]tJb +d ]vJX d ]xJT d ]{JR m ]~JR d ^AJT d ^CJX d ^DJb d ^DJl d ^CJu d ^AJy +d ]~J{ m ]pJE m ^_J{ d ^[Jy d ^WJs d ^VJj d ^VJd d ^WJZ d ^[JT d ^_JR +d ^cJR d ^gJT d ^kJZ d ^lJd d ^lJj d ^kJs d ^gJy d ^cJ{ d ^_J{ m ^[Jw +d ^YJs d ^WJl d ^WJb d ^YJZ d ^[JV m ^gJV d ^iJZ d ^kJb d ^kJl d ^iJs +d ^gJw m ^_J{ d ^\Jy d ^[Ju d ^YJl d ^YJb d ^[JX d ^\JT d ^_JR m ^cJR +d ^fJT d ^gJX d ^iJb d ^iJl d ^gJu d ^fJy d ^cJ{ m ^TJE m ^yKI m ^yJE +m _XKI m _XJE m _wKI m _wJE m `VKI m `VJE m `tKI m `tJE m afJ{ d afJR +d amJR m agJy d agJT m aaJ{ d aiJ{ d aiJR m afJh d adJl d aaJn d a^Jn +d aYJl d aVJh d aUJb d aUJ^ d aVJX d aYJT d a^JR d aaJR d adJT d afJX +m aXJh d aVJd d aVJ\ d aXJX m a^Jn d a[Jl d aYJj d aXJd d aXJ\ d aYJV +d a[JT d a^JR m acJ{ d afJy m adJ{ d afJw m aiJV d ajJR m aiJT d alJR +m aSJE m ]VIh d ]VIC m ]XIh d ]XIE m ]YIl d ]YIC m ]YIl d ]TIf d ]QId +m ]PIC d ]`IC m ]VIE d ]SIC m ]VIG d ]TIC m ]YIG d ][IC m ]YIE d ]\IC +m ]KHu m ]{Il d ]vIj d ]sId d ]qIZ d ]qIT d ]sIK d ]vIE d ]{IC d ]~IC +d ^CIE d ^FIK d ^GIT d ^GIZ d ^FId d ^CIj d ]~Il d ]{Il m ]vIh d ]tId +d ]sI\ d ]sIS d ]tIK d ]vIG m ^CIG d ^DIK d ^FIS d ^FI\ d ^DId d ^CIh +m ]{Il d ]xIj d ]vIf d ]tI\ d ]tIS d ]vII d ]xIE d ]{IC m ]~IC d ^AIE +d ^CII d ^DIS d ^DI\ d ^CIf d ^AIj d ]~Il m ]pHu m ^_Ih d ^_IC m ^aIh +d ^aIE m ^cIl d ^cIC m ^cIl d ^^If d ^[Id m ^YIC d ^iIC m ^_IE d ^\IC +m ^_IG d ^^IC m ^cIG d ^dIC m ^cIE d ^fIC m ^THu m ^yIy m ^yHu m _XIy +m _XHu m _wIy m _wHu m `VIy m `VHu m `tIy m `tHu m aXIS d ajIS d ajIV +d aiIZ d agI\ d abI^ d a_I^ d aZI\ d aWIX d aUIS d aUIO d aWII d aZIE +d a_IC d abIC d agIE d ajII m aiIT d aiIV d agIZ m aXIX d aWIT d aWIM +d aXII m agIS d agIX d aeI\ d abI^ m a_I^ d a\I\ d aZIZ d aXIT d aXIM +d aZIG d a\IE d a_IC m aSHu m ]VHY d ]VGt m ]XHY d ]XGv m ]YH\ d ]YGt +m ]YH\ d ]THW d ]QHU m ]PGt d ]`Gt m ]VGv d ]SGt m ]VGx d ]TGt m ]YGx +d ][Gt m ]YGv d ]\Gt m ]KGf m ]{H\ d ]vH[ d ]sHU d ]qHK d ]qHE d ]sG{ +d ]vGv d ]{Gt d ]~Gt d ^CGv d ^FG{ d ^GHE d ^GHK d ^FHU d ^CH[ d ]~H\ +d ]{H\ m ]vHY d ]tHU d ]sHM d ]sHC d ]tG{ d ]vGx m ^CGx d ^DG{ d ^FHC +d ^FHM d ^DHU d ^CHY m ]{H\ d ]xH[ d ]vHW d ]tHM d ]tHC d ]vGy d ]xGv +d ]{Gt m ]~Gt d ^AGv d ^CGy d ^DHC d ^DHM d ^CHW d ^AH[ d ]~H\ m ]pGf +m ^WHU d ^WHS d ^YHS d ^YHU d ^WHU m ^WHW d ^YHW d ^[HU d ^[HS d ^YHQ +d ^WHQ d ^VHS d ^VHU d ^WHY d ^YH[ d ^^H\ d ^dH\ d ^iH[ d ^kHY d ^lHU +d ^lHQ d ^kHM d ^fHI d ^^HE d ^[HC d ^WG? d ^VGy d ^VGt m ^iHY d ^kHU +d ^kHQ d ^iHM m ^dH\ d ^gH[ d ^iHU d ^iHQ d ^gHM d ^dHI d ^^HE m ^VGx +d ^WGy d ^[Gy d ^cGx d ^iGx d ^lGy m ^[Gy d ^cGv d ^iGv d ^kGx m ^[Gy +d ^cGt d ^iGt d ^kGv d ^lGy d ^lG} m ^TGf m ^yHj m ^yGf m _XHj m _XGf +m _wHj m _wGf m `VHj m `VGf m `tHj m `tGf m ahHY d ahH[ d afH[ d afHW +d ajHW d ajH[ d ahH\ d abH\ d a^H[ d a\HY d aZHS d aZGt m a^HY d a\HS +d a\Gv m abH\ d a`H[ d a^HW d a^Gt m aSHO d afHO m aSGt d adGt m aZGv +d aUGt m aZGx d aXGt m a^Gx d a`Gt m a^Gv d abGt m aSGf m ]VGI d ]VFd +m ]XGI d ]XFf m ]YGM d ]YFd m ]YGM d ]TGG d ]QGE m ]PFd d ]`Fd m ]VFf +d ]SFd m ]VFh d ]TFd m ]YFh d ][Fd m ]YFf d ]\Fd m ]KFW m ]{GM d ]vGK +d ]sGE d ]qF| d ]qFv d ]sFl d ]vFf d ]{Fd d ]~Fd d ^CFf d ^FFl d ^GFv +d ^GF| d ^FGE d ^CGK d ]~GM d ]{GM m ]vGI d ]tGE d ]sF~ d ]sFt d ]tFl +d ]vFh m ^CFh d ^DFl d ^FFt d ^FF~ d ^DGE d ^CGI m ]{GM d ]xGK d ]vGG +d ]tF~ d ]tFt d ]vFj d ]xFf d ]{Fd m ]~Fd d ^AFf d ^CFj d ^DFt d ^DF~ +d ^CGG d ^AGK d ]~GM m ]pFW m ^WGE d ^WGC d ^YGC d ^YGE d ^WGE m ^WGG +d ^YGG d ^[GE d ^[GC d ^YGA d ^WGA d ^VGC d ^VGE d ^WGI d ^YGK d ^^GM +d ^dGM d ^iGK d ^kGG d ^kGA d ^iF~ d ^dF| m ^gGK d ^iGG +stroke +m ^iGG d ^iGA d ^gF~ m ^cGM d ^fGK d ^gGG d ^gGA d ^fF~ d ^cF| m ^_F| +d ^dF| d ^gFz d ^kFv d ^lFr d ^lFl d ^kFh d ^iFf d ^dFd d ^^Fd d ^YFf +d ^WFh d ^VFl d ^VFn d ^WFp d ^YFp d ^[Fn d ^[Fl d ^YFj d ^WFj m ^iFv +d ^kFr d ^kFl d ^iFh m ^cF| d ^fFz d ^gFx d ^iFr d ^iFl d ^gFf d ^dFd +m ^WFn d ^WFl d ^YFl d ^YFn d ^WFn m ^TFW m ^yG[ m ^yFW m _XG[ m _XFW +m _wG[ m _wFW m `VG[ m `VFW m `tG[ m `tFW m aiF~ d ajF| d alF~ d ajG@ +d aiG@ d aeF~ d adF| m a]G@ d aZF~ d aXF| d aWFx d aWFt d aXFp d aZFn +d a]Fl d aaFl d adFn d aeFp d agFt d agFx d aeF| d adF~ d aaG@ d a]G@ +m aZF| d aXFx d aXFt d aZFp m adFp d aeFt d aeFx d adF| m a]G@ d a\F~ +d aZFz d aZFr d a\Fn d a]Fl m aaFl d abFn d adFr d adFz d abF~ d aaG@ +m aXFp d aWFn d aUFj d aUFh d aWFd d aXFb d a]F` d adF` d aiF_ d ajF] +m aXFd d a]Fb d adFb d aiF` m aUFh d aWFf d a\Fd d adFd d aiFb d ajF_ +d ajF] d aiFY d adFW d aZFW d aUFY d aSF] d aSF_ d aUFb d aZFd m aZFW +d aWFY d aUF] d aUF_ d aWFb d aZFd m aSFW m iqcj d iqcE m iscj d iscG +m itcn d itcE m itcn d ipch d ilcf m ikcE d i{cE m iqcG d incE m iqcI +d ipcE m itcI d ivcE m itcG d iwcE m ifbw m jVcn d jQcl d jNcf d jLc\ +d jLcV d jNcM d jQcG d jVcE d jYcE d j^cG d jacM d jbcV d jbc\ d jacf +d j^cl d jYcn d jVcn m jQcj d jOcf d jNc^ d jNcU d jOcM d jQcI m j^cI +d j_cM d jacU d jac^ d j_cf d j^cj m jVcn d jScl d jQch d jOc^ d jOcU +d jQcK d jScG d jVcE m jYcE d j\cG d j^cK d j_cU d j_c^ d j^ch d j\cl +d jYcn m jKbw m j~ch d j~cE m j?cj d j?cG m kAcn d kAcE m kAcn d jocQ +d kIcQ m jycE d kFcE m j~cG d jzcE m j~cI d j|cE m kAcI d kBcE m kAcG +d kDcE m jobw m kTc{ m kTbw m ksc{ m ksbw m lRc{ m lRbw m lqc{ m lqbw +m mPc{ m mPbw m mscn d mscE m mtcl d mtcG m mncn d mucn d mucE m mucX +d mwc\ d mxc^ d m{c` d m?c` d nBc^ d nDc\ d nEcV d nEcE m nBc\ d nDcV +d nDcG m m?c` d nAc^ d nBcX d nBcE m mncE d mzcE m m~cE d nIcE m mpcn +d mscl m mqcn d mscj m mscG d mpcE m mscI d mqcE m mucI d mwcE m mucG +d mxcE m nBcG d m?cE m nBcI d nAcE m nEcI d nFcE m nEcG d nHcE m mnbw +m iqb[ d iqav m isb[ d isax m itb^ d itav m itb^ d ipbY d ilbW m ikav +d i{av m iqax d inav m iqaz d ipav m itaz d ivav m itax d iwav m ifah +m jVb^ d jQb] d jNbW d jLbM d jLbG d jNa} d jQax d jVav d jYav d j^ax +d jaa} d jbbG d jbbM d jabW d j^b] d jYb^ d jVb^ m jQb[ d jObW d jNbO +d jNbE d jOa} d jQaz m j^az d j_a} d jabE d jabO d j_bW d j^b[ m jVb^ +d jSb] d jQbY d jObO d jObE d jQa{ d jSax d jVav m jYav d j\ax d j^a{ +d j_bE d j_bO d j^bY d j\b] d jYb^ m jKah m jtb^ d jqbK d jtbO d jybQ +d j~bQ d kBbO d kFbK d kGbE d kGbA d kFa{ d kBax d j~av d jyav d jtax +d jraz d jqa} d jqa? d jrbA d jtbA d jva? d jva} d jta{ d jra{ m kDbK +d kFbG d kFa? d kDa{ m j~bQ d kAbO d kBbM d kDbG d kDa? d kBaz d kAax +d j~av m jra? d jra} d jta} d jta? d jra? m jtb^ d kDb^ m jtb] d kAb] +m jtb[ d jzb[ d kAb] d kDb^ m joah m kTbl m kTah m ksbl m ksah m lRbl +m lRah m lqbl m lqah m mPbl m mPah m mub^ d mub[ d mzb[ d mzb^ d mub^ +m mxb^ d mxb[ m mub] d mzb] m mubQ d muav m mxbO d mxax m mnbQ d mzbQ +d mzav m mnav d nAav m mqbQ d mubO m msbQ d mubM m muax d mqav m muaz +d msav m mzaz d m|av m mzax d m?av m mnah m iqaK d iq`f m isaK d is`h +m itaO d it`f m itaO d ipaI d ilaG m ik`f d i{`f m iq`h d in`f m iq`j +d ip`f m it`j d iv`f m it`h d iw`f m if`Y m jVaO d jQaM d jNaG d jL`~ +d jL`x d jN`n d jQ`h d jV`f d jY`f d j^`h d ja`n d jb`x d jb`~ d jaaG +d j^aM d jYaO d jVaO m jQaK d jOaG d jNa@ d jN`v d jO`n d jQ`j m j^`j +d j_`n d ja`v d jaa@ d j_aG d j^aK m jVaO d jSaM d jQaI d jOa@ d jO`v +d jQ`l d jS`h d jV`f m jY`f d j\`h d j^`l d j_`v d j_a@ d j^aI d j\aM +d jYaO m jK`Y m kBaI d kBaG d kDaG d kDaI d kBaI m kDaK d kBaK d kAaI +d kAaG d kBaE d kDaE d kFaG d kFaI d kDaM d kAaO d j|aO d jwaM d jtaI +d jraE d jq`~ d jq`r d jr`l d jv`h d jz`f d j~`f d kB`h d kF`l d kG`r +d kG`t d kF`z d kB`~ d j~a@ d jza@ d jw`~ d jv`| d jt`x m jvaI d jtaE +d jr`~ d jr`r d jt`l d jv`j m kD`l d kF`p d kF`v d kD`z m j|aO d jyaM +d jwaK d jvaG d jta@ d jt`r d jv`l d jw`h d jz`f m j~`f d kA`h d kB`j +d kD`p d kD`v d kB`| d kA`~ d j~a@ m jo`Y m kTa] m kT`Y m ksa] m ks`Y +m lRa] m lR`Y m lqa] m lq`Y m mPa] m mP`Y m myaO d myaK d m~aK d m~aO +d myaO m m|aO d m|aK m myaM d m~aM m myaB d my`a d mw`[ d mu`Y m m|a@ +d m|`b d my`] m msaB d m~aB d m~`b d m|`] d my`[ d mu`Y d mn`Y d mn`[ +d mn`_ d mq`_ d mq`[ d mn`[ d mn`] m muaB d mya@ m mwaB d my`~ m mn`Y +m iq_| d iq_W m is_| d is_Y m it`@ d it_W m it`@ d ip_z d il_x m ik_W +d i{_W m iq_Y d in_W m iq_[ d ip_W m it_[ d iv_W m it_Y d iw_W m if_I +m jV`@ d jQ_~ d jN_x d jL_n d jL_i d jN__ d jQ_Y d jV_W d jY_W d j^_Y +d ja__ d jb_i d jb_n d ja_x d j^_~ d jY`@ d jV`@ m jQ_| d jO_x d jN_p +d jN_g d jO__ d jQ_[ m j^_[ d j___ d ja_g d ja_p d j__x d j^_| m jV`@ +d jS_~ d jQ_z d jO_p d jO_g d jQ_] d jS_Y d jV_W m jY_W d j\_Y d j^_] +d j__g d j__p d j^_z d j\_~ d jY`@ m jK_I m jq`@ d jq_t m kG`@ d kG_z +d kF_t d j?_j d j~_g d j|__ d j|_W m j~_i d j|_e d jz__ d jz_W m kF_t +d j~_j d jz_e d jy__ d jy_W d j|_W m jq_x d jr_| d jv`@ d jy`@ d kA_z +d kD_z d kF_| d kG`@ m jt_| d jv_~ d jy_~ d j|_| m jq_x d jr_z +stroke +m jr_z d jv_| d jy_| d kA_z m jo_I m kT`M m kT_I m ks`M m ks_I m lR`M +m lR_I m lq`M m lq_I m mP`M m mP_I m ms`@ d ms_W m mt_~ d mt_Y m mn`@ +d mv`@ d mv_W m nC_p d mv__ m m|_g d nF_W m m|_e d nD_W m mz_e d nC_W +m m~_r d nI_r m mn_W d mz_W m m~_W d nI_W m mp`@ d ms_~ m mq`@ d ms_| +m n@_r d nC_p m nG_r d nC_p m ms_Y d mp_W m ms_[ d mq_W m mv_[ d mw_W +m mv_Y d my_W m nC_[ d n@_W m nA_[ d nG_W m mn_I m iq^m d iq^H m is^m +d is^J m it^p d it^H m it^p d ip^k d il^i m ik^H d i{^H m iq^J d in^H +m iq^K d ip^H m it^K d iv^H m it^J d iw^H m if]z m jV^p d jQ^o d jN^i +d jL^_ d jL^Y d jN^O d jQ^J d jV^H d jY^H d j^^J d ja^O d jb^Y d jb^_ +d ja^i d j^^o d jY^p d jV^p m jQ^m d jO^i d jN^a d jN^W d jO^O d jQ^K +m j^^K d j_^O d ja^W d ja^a d j_^i d j^^m m jV^p d jS^o d jQ^k d jO^a +d jO^W d jQ^M d jS^J d jV^H m jY^H d j\^J d j^^M d j_^W d j_^a d j^^k +d j\^o d jY^p m jK]z m jy^p d jt^o d jr^k d jr^e d jt^a d jy^_ d j?^_ +d kD^a d kF^e d kF^k d kD^o d j?^p d jy^p m jv^o d jt^k d jt^e d jv^a +m kB^a d kD^e d kD^k d kB^o m jy^p d jw^o d jv^k d jv^e d jw^a d jy^_ +m j?^_ d kA^a d kB^e d kB^k d kA^o d j?^p m jy^_ d jt^] d jr^[ d jq^W +d jq^O d jr^K d jt^J d jy^H d j?^H d kD^J d kF^K d kG^O d kG^W d kF^[ +d kD^] d j?^_ m jt^[ d jr^W d jr^O d jt^K m kD^K d kF^O d kF^W d kD^[ +m jy^_ d jv^] d jt^W d jt^O d jv^J d jy^H m j?^H d kB^J d kD^O d kD^W +d kB^] d j?^_ m jo]z m kT^~ m kT]z m ks^~ m ks]z m lR^~ m lR]z m lq^~ +m lq]z m mP^~ m mP]z m mu^p d mu^H m mx^o d mx^J m mn^p d mz^p d mz^H +m mn^H d nA^H m mq^p d mu^o m ms^p d mu^m m mu^J d mq^H m mu^K d ms^H +m mz^K d m|^H m mz^J d m?^H m mn]z m iq]] d iq\x m is]] d is\z m it]a +d it\x m it]a d ip][ d il]Y m ik\x d i{\x m iq\z d in\x m iq\| d ip\x +m it\| d iv\x m it\z d iw\x m if\k m jV]a d jQ]_ d jN]Y d jL]P d jL]J +d jN]@ d jQ\z d jV\x d jY\x d j^\z d ja]@ d jb]J d jb]P d ja]Y d j^]_ +d jY]a d jV]a m jQ]] d jO]Y d jN]R d jN]H d jO]@ d jQ\| m j^\| d j_]@ +d ja]H d ja]R d j_]Y d j^]] m jV]a d jS]_ d jQ][ d jO]R d jO]H d jQ\~ +d jS\z d jV\x m jY\x d j\\z d j^\~ d j_]H d j_]R d j^][ d j\]_ d jY]a +m jK\k m jt]@ d jt\~ d jv\~ d jv]@ d jt]@ m kD]P d kB]L d kA]J d j~]H +d jz]H d jv]J d jr]N d jq]S d jq]U d jr][ d jv]_ d jz]a d j~]a d kB]_ +d kF][ d kG]U d kG]J d kF]B d kD\~ d kA\z d j|\x d jw\x d jt\z d jr\~ +d jr]@ d jt]B d jv]B d jw]@ d jw\~ d jv\| d jt\| m jt]N d jr]R d jr]W +d jt][ m kB]] d kD][ d kF]U d kF]J d kD]B d kB\~ m jz]H d jw]J d jv]L +d jt]R d jt]W d jv]] d jw]_ d jz]a m j~]a d kA]_ d kB][ d kD]U d kD]H +d kB]@ d kA\| d j?\z d j|\x m jo\k m kT]o m kT\k m ks]o m ks\k m lR]o +m lR\k m lq]o m lq\k m mP]o m mP\k m mr]S d mr\x m ms]R d ms\z m mn]S +d mt]S d mt\x m mt]L d mv]P d mw]R d mz]S d m}]S d n@]R d nA]P d nB]J +d nB\x m n@]P d nA]J d nA\z m m}]S d m~]R d n@]L d n@\x m nB]L d nC]P +d nE]R d nG]S d nK]S d nM]R d nO]P d nP]J d nP\x m nM]P d nO]J d nO\z +m nK]S d nL]R d nM]L d nM\x m mn\x d mx\x m m|\x d nF\x m nJ\x d nT\x +m mp]S d mr]R m mq]S d mr]P m mr\z d mp\x m mr\| d mq\x m mt\| d mv\x +m mt\z d mw\x m n@\z d m}\x m n@\| d m~\x m nB\| d nC\x m nB\z d nE\x +m nM\z d nK\x m nM\| d nL\x m nP\| d nQ\x m nP\z d nR\x m mn\k m iq\N +d iq[i m is\N d is[k m it\R d it[i m it\R d ip\L d il\J m ik[i d i{[i +m iq[k d in[i m iq[m d ip[i m it[m d iv[i m it[k d iw[i m if[[ m jV\N +d jV[i m jW\N d jW[k m jY\R d jY[i m jY\R d jT\L d jQ\J m jO[i d j_[i +m jV[k d jS[i m jV[m d jT[i m jY[m d j[[i m jY[k d j\[i m jK[[ m jz\R +d jv\P d jr\J d jq\@ d jq[{ d jr[q d jv[k d jz[i d j~[i d kB[k d kF[q +d kG[{ d kG\@ d kF\J d kB\P d j~\R d jz\R m jv\N d jt\J d jr\B d jr[y +d jt[q d jv[m m kB[m d kD[q d kF[y d kF\B d kD\J d kB\N m jz\R d jw\P +d jv\L d jt\B d jt[y d jv[o d jw[k d jz[i m j~[i d kA[k d kB[o d kD[y +d kD\B d kB\L d kA\P d j~\R m jo[[ m kT\_ m kT[[ m ks\_ m ks[[ m lR\_ +m lR[[ m lq\_ m lq[[ m mP\_ m mP[[ m ms\D d ms[i m mt\B d mt[k m mn\D +d mu\D d mu[i m mu[| d mw\@ d mx\B d m{\D d m?\D d nB\B d nD\@ d nE[{ +d nE[i m nB\@ d nD[{ d nD[k m m?\D d nA\B d nB[| d nB[i m mn[i d mz[i +m m~[i d nI[i m mp\D d ms\B m mq\D d ms\@ m ms[k d mp[i m ms[m d mq[i +m mu[m d mw[i m mu[k d mx[i m nB[k d m?[i m nB[m d nA[i m nE[m d nF[i +m nE[k d nH[i m mn[[ m iqZ? d iqZZ m isZ? d isZ\ m it[C d itZZ m it[C +d ipZ} d ilZ{ m ikZZ d i{ZZ m iqZ\ d inZZ m iqZ^ d ipZZ m itZ^ d ivZZ +m itZ\ d iwZZ m ifZL m jVZ? d jVZZ m jWZ? d jWZ\ m jY[C d jYZZ m jY[C +d jTZ} d jQZ{ m jOZZ d j_ZZ m jVZ\ d jSZZ m jVZ^ d jTZZ m jYZ^ d j[ZZ +m jYZ\ d j\ZZ m jKZL m jzZ? d jzZZ m j|Z? d j|Z\ m j~[C d j~ZZ m j~[C +d jyZ} d jvZ{ m jtZZ d kDZZ m jzZ\ d jwZZ m jzZ^ d jyZZ m j~Z^ d j?ZZ +m j~Z\ d kAZZ m joZL m kT[P m kTZL m ks[P m ksZL m lR[P m lRZL m lq[P +m lqZL m mP[P m mPZL m myZu d muZs d mqZo d mpZi d mpZe d mqZ` d muZ\ +d myZZ d m}ZZ d nAZ\ d nEZ` d nFZe d nFZi d nEZo d nAZs d m}Zu d myZu +m msZo d mqZk d mqZc d msZ` m nCZ` d nEZc d nEZk d nCZo m myZu d mvZs +d muZq d msZk d msZc d muZ^ d mvZ\ d myZZ m m}ZZ d n@Z\ d nAZ^ d nCZc +d nCZk d nAZq d n@Zs d m}Zu m mnZL m iqYo d iqYJ m isYo d isYL m itYs +d itYJ m itYs d ipYm d ilYk m ikYJ d i{YJ m iqYL d inYJ m iqYN d ipYJ +m itYN d ivYJ m itYL d iwYJ m ifX} m jVYo d jVYJ m jWYo d jWYL m jYYs +d jYYJ m jYYs d jTYm d jQYk m jOYJ d j_YJ m jVYL d jSYJ m jVYN d jTYJ +m jYYN d j[YJ m jYYL d j\YJ m jKX} m jrYk d jrYi d jtYi d jtYk d jrYk +m jrYm d jtYm d jvYk d jvYi d jtYg d jrYg d jqYi d jqYk d jrYo d jtYq +d jyYs d j?Ys d kDYq d kFYo d kGYk d kGYg d kFYd d kAY` d jyY\ d jvYZ +d jrYV d jqYP d jqYJ m kDYo d kFYk d kFYg d kDYd m j?Ys d kBYq d kDYk +d kDYg d kBYd d j?Y` d jyY\ m jqYN d jrYP d jvYP d j~YN d kDYN d kGYP +stroke +m kGYP m jvYP d j~YL d kDYL d kFYN m jvYP d j~YJ d kDYJ d kFYL d kGYP +d kGYT m joX} m kTZA m kTX} m ksZA m ksX} m lRZA m lRX} m lqZA m lqX} +m mPZA m mPX} m msYe d msX} m mtYd d mtX? m mnYe d mvYe d mvX} m mvY` +d mwYd d m{Ye d m~Ye d nBYd d nEY` d nGYZ d nGYV d nEYP d nBYL d m~YJ +d m{YJ d mwYL d mvYP m nDY` d nEY\ d nEYT d nDYP m m~Ye d nAYd d nBYb +d nDY\ d nDYT d nBYN d nAYL d m~YJ m mnX} d m{X} m mpYe d msYd m mqYe +d msYb m msX? d mpX} m msYA d mqX} m mvYA d mwX} m mvX? d myX} m mnX} +m iqX` d iqW{ m isX` d isW} m itXd d itW{ m itXd d ipX^ d ilX\ m ikW{ +d i{W{ m iqW} d inW{ m iqW? d ipW{ m itW? d ivW{ m itW} d iwW{ m ifWm +m jVX` d jVW{ m jWX` d jWW} m jYXd d jYW{ m jYXd d jTX^ d jQX\ m jOW{ +d j_W{ m jVW} d jSW{ m jVW? d jTW{ m jYW? d j[W{ m jYW} d j\W{ m jKWm +m jrX\ d jrXZ d jtXZ d jtX\ d jrX\ m jrX^ d jtX^ d jvX\ d jvXZ d jtXX +d jrXX d jqXZ d jqX\ d jrX` d jtXb d jyXd d j?Xd d kDXb d kFX^ d kFXX +d kDXT d j?XR m kBXb d kDX^ d kDXX d kBXT m j~Xd d kAXb d kBX^ d kBXX +d kAXT d j~XR m jzXR d j?XR d kBXP d kFXM d kGXI d kGXC d kFW? d kDW} +d j?W{ d jyW{ d jtW} d jrW? d jqXC d jqXE d jrXG d jtXG d jvXE d jvXC +d jtXA d jrXA m kDXM d kFXI d kFXC d kDW? m j~XR d kAXP d kBXN d kDXI +d kDXC d kBW} d j?W{ m jrXE d jrXC d jtXC d jtXE d jrXE m joWm m kTXq +m kTWm m ksXq m ksWm m lRXq m lRWm m lqXq m lqWm m mPXq m mPWm m nAXT +d nAWm m nCXR d nCWo m n@XT d nCXT d nEXV d nEWm m nAXP d n@XT d m}XV +d myXV d muXT d mqXP d mpXK d mpXG d mqXA d muW} d myW{ d m}W{ d n@W} +d nAXA m msXP d mqXM d mqXE d msXA m myXV d mvXT d muXR d msXM d msXE +d muW? d mvW} d myW{ m m}Wm d nIWm m nAWo d m~Wm m nAWq d n@Wm m nEWq +d nFWm m nEWo d nHWm m mnWm m iqWQ d iqVl m isWQ d isVn m itWT d itVl +m itWT d ipWO d ilWM m ikVl d i{Vl m iqVn d inVl m iqVp d ipVl m itVp +d ivVl m itVn d iwVl m ifV^ m jVWQ d jVVl m jWWQ d jWVn m jYWT d jYVl +m jYWT d jTWO d jQWM m jOVl d j_Vl m jVVn d jSVl m jVVp d jTVl m jYVp +d j[Vl m jYVn d j\Vl m jKV^ m j~WO d j~Vl m j?WQ d j?Vn m kAWT d kAVl +m kAWT d joVw d kIVw m jyVl d kFVl m j~Vn d jzVl m j~Vp d j|Vl m kAVp +d kBVl m kAVn d kDVl m joV^ m kTWb m kTV^ m ksWb m ksV^ m lRWb m lRV^ +m lqWb m lqV^ m mPWb m mPV^ m mtWG d mtVl m mvWE d mvVn m mnWG d mwWG +d mwVl m nDWC d nDWE d nBWE d nBWA d nFWA d nFWE d nDWG d n@WG d m}WE +d myWA d mwV{ m mnVl d m}Vl m mpWG d mtWE m mrWG d mtWC m mtVn d mpVl +m mtVp d mrVl m mwVp d myVl m mwVn d m{Vl m mnV^ m iqVA d iqU\ m isVA +d isU^ m itVE d itU\ m itVE d ipU? d ilU} m ikU\ d i{U\ m iqU^ d inU\ +m iqU` d ipU\ m itU` d ivU\ m itU^ d iwU\ m ifUO m jVVA d jVU\ m jWVA +d jWU^ m jYVE d jYU\ m jYVE d jTU? d jQU} m jOU\ d j_U\ m jVU^ d jSU\ +m jVU` d jTU\ m jYU` d j[U\ m jYU^ d j\U\ m jKUO m jtVE d jqUr d jtUv +d jyUx d j~Ux d kBUv d kFUr d kGUl d kGUh d kFUb d kBU^ d j~U\ d jyU\ +d jtU^ d jrU` d jqUd d jqUf d jrUh d jtUh d jvUf d jvUd d jtUb d jrUb +m kDUr d kFUn d kFUf d kDUb m j~Ux d kAUv d kBUt d kDUn d kDUf d kBU` +d kAU^ d j~U\ m jrUf d jrUd d jtUd d jtUf d jrUf m jtVE d kDVE m jtVC +d kAVC m jtVA d jzVA d kAVC d kDVE m joUO m kTVS m kTUO m ksVS m ksUO +m lRVS m lRUO m lqVS m lqUO m mPVS m mPUO m nBUt d nDUx d nDUp d nBUt +d n@Uv d m}Ux d mvUx d mrUv d mpUt d mpUp d mrUl d mvUj d m?Uh d nBUf +d nDU` m mrUv d mpUp m mrUn d mvUl d m?Uj d nBUh m nDUf d nBU^ m mpUt +d mrUp d mvUn d m?Ul d nBUj d nDUf d nDU` d nBU^ d m?U\ d mwU\ d mtU^ +d mrU` d mpUd d mpU\ d mrU` m mnUO m iqTr d iqTM m isTr d isTO m itTv +d itTM m itTv d ipTp d ilTn m ikTM d i{TM m iqTO d inTM m iqTQ d ipTM +m itTQ d ivTM m itTO d iwTM m ifS? m jVTr d jVTM m jWTr d jWTO m jYTv +d jYTM m jYTv d jTTp d jQTn m jOTM d j_TM m jVTO d jSTM m jVTQ d jTTM +m jYTQ d j[TM m jYTO d j\TM m jKS? m kBTp d kBTn d kDTn d kDTp d kBTp +m kDTr d kBTr d kATp d kATn d kBTl d kDTl d kFTn d kFTp d kDTt d kATv +d j|Tv d jwTt d jtTp d jrTl d jqTd d jqTY d jrTS d jvTO d jzTM d j~TM +d kBTO d kFTS d kGTY d kGT[ d kFT` d kBTd d j~Tf d jzTf d jwTd d jvTb +d jtT^ m jvTp d jtTl d jrTd d jrTY d jtTS d jvTQ m kDTS d kFTW d kFT] +d kDT` m j|Tv d jyTt d jwTr d jvTn d jtTf d jtTY d jvTS d jwTO d jzTM +m j~TM d kATO d kBTQ d kDTW d kDT] d kBTb d kATd d j~Tf m joS? m kTUC +m kTS? m ksUC m ksS? m lRUC m lRS? m lqUC m lqS? m mPUC m mPS? m mtTr +d mtTW d mvTQ d mxTO d m|TM d n@TM d nDTO d nFTS m mvTr d mvTU d mxTQ +m mtTr d mxTv d mxTU d mzTO d m|TM m mnTh d n@Th m mnS? m iqSc d iqR~ +m isSc d isS@ m itSf d itR~ m itSf d ipSa d ilS_ m ikR~ d i{R~ m iqS@ +d inR~ m iqSB d ipR~ m itSB d ivR~ m itS@ d iwR~ m ifRp m jVSc d jVR~ +m jWSc d jWS@ m jYSf d jYR~ m jYSf d jTSa d jQS_ m jOR~ d j_R~ m jVS@ +d jSR~ m jVSB d jTR~ m jYSB d j[R~ m jYS@ d j\R~ m jKRp m jqSf d jqS[ +m kGSf d kGSa d kFS[ d j?SQ d j~SM d j|SE d j|R~ m j~SO d j|SK d jzSE +d jzR~ m kFS[ d j~SQ d jzSK d jySE d jyR~ d j|R~ m jqS_ d jrSc d jvSf +d jySf d kASa d kDSa d kFSc d kGSf m jtSc d jvSe d jySe d j|Sc m jqS_ +d jrSa d jvSc d jySc d kASa m joRp m kTSt m kTRp m ksSt m ksRp m lRSt +m lRRp m lqSt m lqRp m mPSt m mPRp m msSY d msSG d mtSB d muS@ d mxR~ +d m}R~ d m?S@ d nASB d nBSE m mtSW d mtSE d muSB m mnSY d muSY d muSE +d mwS@ d mxR~ m nBSY d nBR~ d nIR~ m nDSW d nDS@ m m~SY d nESY d nER~ +m mpSY d msSW m mqSY d msSU m nESB d nFR~ m nES@ d nHR~ m mnRp m iqRS +d iqQn m isRS d isQp m itRW d itQn m itRW d ipRQ d ilRO m ikQn d i{Qn +m iqQp d inQn m iqQr d ipQn m itQr d ivQn m itQp d iwQn m ifQa m jVRS +d jVQn m jWRS d jWQp m jYRW d jYQn m jYRW d jTRQ d jQRO m jOQn d j_Qn +m jVQp d jSQn m jVQr d jTQn m jYQr d j[Qn m jYQp d j\Qn m jKQa m jyRW +d jtRU d jrRQ d jrRK d jtRH d jyRF d j?RF d kDRH d kFRK d kFRQ d kDRU +d j?RW d jyRW m jvRU d jtRQ d jtRK d jvRH m kBRH d kDRK d kDRQ d kBRU +m jyRW d jwRU d jvRQ d jvRK d jwRH d jyRF m j?RF d kARH d kBRK d kBRQ +d kARU d j?RW m jyRF d jtRD d jrRB +stroke +m jrRB d jqQ~ d jqQv d jrQr d jtQp d jyQn d j?Qn d kDQp d kFQr d kGQv +d kGQ~ d kFRB d kDRD d j?RF m jtRB d jrQ~ d jrQv d jtQr m kDQr d kFQv +d kFQ~ d kDRB m jyRF d jvRD d jtQ~ d jtQv d jvQp d jyQn m j?Qn d kBQp +d kDQv d kDQ~ d kBRD d j?RF m joQa m kTRe m kTQa m ksRe m ksQa m lRRe +m lRQa m lqRe m lqQa m mPRe m mPQa m mpRJ d mzQn m mrRJ d mzQr m mtRJ +d m|Qr m nERH d m|Qr d mzQn m mnRJ d myRJ m m~RJ d nHRJ m mnRJ d mtRF +m mwRJ d mtRH m nARJ d nERH m nFRJ d nERH m mnQa m iqQD d iqP_ m isQD +d isPa m itQH d itP_ m itQH d ipQB d ilQ@ m ikP_ d i{P_ m iqPa d inP_ +m iqPc d ipP_ m itPc d ivP_ m itPa d iwP_ m ifPQ m jVQD d jVP_ m jWQD +d jWPa m jYQH d jYP_ m jYQH d jTQB d jQQ@ m jOP_ d j_P_ m jVPa d jSP_ +m jVPc d jTP_ m jYPc d j[P_ m jYPa d j\P_ m jKPQ m jtPg d jtPe d jvPe +d jvPg d jtPg m kDPv d kBPr d kAPq d j~Po d jzPo d jvPq d jrPt d jqPz +d jqP| d jrQB d jvQF d jzQH d j~QH d kBQF d kFQB d kGP| d kGPq d kFPi +d kDPe d kAPa d j|P_ d jwP_ d jtPa d jrPe d jrPg d jtPi d jvPi d jwPg +d jwPe d jvPc d jtPc m jtPt d jrPx d jrP~ d jtQB m kBQD d kDQB d kFP| +d kFPq d kDPi d kBPe m jzPo d jwPq d jvPr d jtPx d jtP~ d jvQD d jwQF +d jzQH m j~QH d kAQF d kBQB d kDP| d kDPo d kBPg d kAPc d j?Pa d j|P_ +m joPQ m kTQU m kTPQ m ksQU m ksPQ m lRQU m lRPQ m lqQU m lqPQ m mPQU +m mPPQ m mqPz d mwP_ m mrPz d mwPe m mtPz d mxPe m m|Pz d mxPe d mwP_ +m m|Pz d nAP_ m m}Pz d nAPe m m|Pz d m?Pz d nCPe m nGPx d nCPe d nAP_ +m mnPz d mxPz m nCPz d nKPz m mnPz d mrPx m mwPz d mtPx m nDPz d nGPx +m nJPz d nGPx m mnPQ m iqOu d iqOP m isOu d isOR m itOy d itOP m itOy +d ipOs d ilOq m ikOP d i{OP m iqOR d inOP m iqOT d ipOP m itOT d ivOP +m itOR d iwOP m ifOB m jNOq d jNOo d jOOo d jOOq d jNOq m jNOs d jOOs +d jQOq d jQOo d jOOm d jNOm d jLOo d jLOq d jNOu d jOOw d jTOy d j[Oy +d j_Ow d jaOu d jbOq d jbOm d jaOi d j\Oe d jTOa d jQO_ d jNO[ d jLOV +d jLOP m j_Ou d jaOq d jaOm d j_Oi m j[Oy d j^Ow d j_Oq d j_Om d j^Oi +d j[Oe d jTOa m jLOT d jNOV d jQOV d jYOT d j_OT d jbOV m jQOV d jYOR +d j_OR d jaOT m jQOV d jYOP d j_OP d jaOR d jbOV d jbOY m jKOB m jzOy +d jvOw d jrOq d jqOg d jqOa d jrOW d jvOR d jzOP d j~OP d kBOR d kFOW +d kGOa d kGOg d kFOq d kBOw d j~Oy d jzOy m jvOu d jtOq d jrOi d jrO_ +d jtOW d jvOT m kBOT d kDOW d kFO_ d kFOi d kDOq d kBOu m jzOy d jwOw +d jvOs d jtOi d jtO_ d jvOV d jwOR d jzOP m j~OP d kAOR d kBOV d kDO_ +d kDOi d kBOs d kAOw d j~Oy m joOB m kTPF m kTOB m ksPF m ksOB m lRPF +m lROB m lqPF m lqOB m mPPF m mPOB m mqOk d nAOP m msOk d nCOP m muOk +d nEOP m nCOi d msOR m mnOk d myOk m m~Ok d nHOk m mnOP d mxOP m m}OP +d nHOP m mpOk d msOi m mxOk d muOi m n@Ok d nCOi m nFOk d nCOi m msOR +d mpOP m msOR d mvOP m nAOR d m~OP m nCOR d nFOP m mnOB m iqNe d iqN@ +m isNe d isNB m itNi d itN@ m itNi d ipNc d ilNa m ikN@ d i{N@ m iqNB +d inN@ m iqND d ipN@ m itND d ivN@ m itNB d iwN@ m ifMs m jNNa d jNN_ +d jON_ d jONa d jNNa m jNNc d jONc d jQNa d jQN_ d jON] d jNN] d jLN_ +d jLNa d jNNe d jONg d jTNi d j[Ni d j_Ng d jaNe d jbNa d jbN] d jaNZ +d j\NV d jTNR d jQNP d jNNL d jLNF d jLN@ m j_Ne d jaNa d jaN] d j_NZ +m j[Ni d j^Ng d j_Na d j_N] d j^NZ d j[NV d jTNR m jLND d jNNF d jQNF +d jYND d j_ND d jbNF m jQNF d jYNB d j_NB d jaND m jQNF d jYN@ d j_N@ +d jaNB d jbNF d jbNJ m jKMs m jzNe d jzN@ m j|Ne d j|NB m j~Ni d j~N@ +m j~Ni d jyNc d jvNa m jtN@ d kDN@ m jzNB d jwN@ m jzND d jyN@ m j~ND +d j?N@ m j~NB d kAN@ m joMs m kTNw m kTMs m ksNw m ksMs m lRNw m lRMs +m lqNw m lqMs m mPNw m mPMs m mrN[ d m|N@ m msN[ d m|ND m muN[ d m}ND +m nENZ d m}ND d mxMy d muMu d mrMs d mnMs d mnMu d mnMy d mpMy d mpMu +d mnMu d mnMw m mnN[ d mzN[ m m?N[ d nIN[ m mpN[ d muNX m mxN[ d muNZ +m nBN[ d nENZ m nGN[ d nENZ m mnMs m iqMV d iqLq m isMV d isLs m itMZ +d itLq m itMZ d ipMT d ilMR m ikLq d i{Lq m iqLs d inLq m iqLu d ipLq +m itLu d ivLq m itLs d iwLq m ifLc m jNMR d jNMP d jOMP d jOMR d jNMR +m jNMT d jOMT d jQMR d jQMP d jOMN d jNMN d jLMP d jLMR d jNMV d jOMX +d jTMZ d j[MZ d j_MX d jaMV d jbMR d jbMN d jaMJ d j\MF d jTMC d jQMA +d jNL} d jLLw d jLLq m j_MV d jaMR d jaMN d j_MJ m j[MZ d j^MX d j_MR +d j_MN d j^MJ d j[MF d jTMC m jLLu d jNLw d jQLw d jYLu d j_Lu d jbLw +m jQLw d jYLs d j_Ls d jaLu m jQLw d jYLq d j_Lq d jaLs d jbLw d jbL{ +m jKLc m jrMR d jrMP d jtMP d jtMR d jrMR m jrMT d jtMT d jvMR d jvMP +d jtMN d jrMN d jqMP d jqMR d jrMV d jtMX d jyMZ d j?MZ d kDMX d kFMV +d kGMR d kGMN d kFMJ d kAMF d jyMC d jvMA d jrL} d jqLw d jqLq m kDMV +d kFMR d kFMN d kDMJ m j?MZ d kBMX d kDMR d kDMN d kBMJ d j?MF d jyMC +m jqLu d jrLw d jvLw d j~Lu d kDLu d kGLw m jvLw d j~Ls d kDLs d kFLu +m jvLw d j~Lq d kDLq d kFLs d kGLw d kGL{ m joLc m kTMg m kTLc m ksMg +m ksLc m lRMg m lRLc m lqMg m lqLc m mPMg m mPLc m nAML d mpLq m nCML +d mrLq m nEML d mtLq m nEML d mpML d mpMD m mpLq d nELq d nELy m mrML +d mpMD m mtML d mpMF m muML d mpMH m myML d mpMJ m m|Lq d nELs m n@Lq +d nELu m nALq d nELw m nCLq d nELy m mnLc m iqLG d iqKb m isLG d isKd +m itLK d itKb m itLK d ipLE d ilLC m ikKb d i{Kb m iqKd d inKb m iqKf +d ipKb m itKf d ivKb m itKd d iwKb m ifKT m jNLC d jNLA d jOLA d jOLC +d jNLC m jNLE d jOLE d jQLC d jQLA d jOK? d jNK? d jLLA d jLLC d jNLG +d jOLI d jTLK d j[LK d j_LI d jaLG d jbLC d jbK? d jaK{ d j\Kw d jTKs +d jQKq d jNKm d jLKg d jLKb m j_LG d jaLC d jaK? d j_K{ m j[LK d j^LI +d j_LC d j_K? d j^K{ d j[Kw d jTKs m jLKf d jNKg d jQKg d jYKf d j_Kf +d jbKg m jQKg d jYKd d j_Kd d jaKf m jQKg d jYKb d j_Kb d jaKd +stroke +m jaKd d jbKg d jbKk m jKKT m jrLC d jrLA d jtLA d jtLC d jrLC m jrLE +d jtLE d jvLC d jvLA d jtK? d jrK? d jqLA d jqLC d jrLG d jtLI d jyLK +d j?LK d kDLI d kFLE d kFK? d kDK{ d j?Ky m kBLI d kDLE d kDK? d kBK{ +m j~LK d kALI d kBLE d kBK? d kAK{ d j~Ky m jzKy d j?Ky d kBKw d kFKs +d kGKo d kGKi d kFKf d kDKd d j?Kb d jyKb d jtKd d jrKf d jqKi d jqKk +d jrKm d jtKm d jvKk d jvKi d jtKg d jrKg m kDKs d kFKo d kFKi d kDKf +m j~Ky d kAKw d kBKu d kDKo d kDKi d kBKd d j?Kb m jrKk d jrKi d jtKi +d jtKk d jrKk m joKT m kTLX m kTKT m ksLX m ksKT m lRLX m lRKT m lqLX +m lqKT m mPLX m mPKT m m}LR d myLP d mwLN d muLK d muLG d mwLC d myLA +d m{K} d m{Ky d mwKu m myLP d mwLL d mwLI d myLE d m{LC d m}K? d m}K{ +d m{Kw d msKs d m{Ko d m}Kk d m}Kg d m{Kd d myKb d mwK^ d mwKZ d myKV +m mwKq d m{Km d m{Ki d myKf d mwKd d muK` d muK\ d mwKX d myKV d m}KT +m mnKT m iqJw d iqJR m isJw d isJT m itJ{ d itJR m itJ{ d ipJu d ilJs +m ikJR d i{JR m iqJT d inJR m iqJV d ipJR m itJV d ivJR m itJT d iwJR +m ifJE m jNJs d jNJq d jOJq d jOJs d jNJs m jNJu d jOJu d jQJs d jQJq +d jOJo d jNJo d jLJq d jLJs d jNJw d jOJy d jTJ{ d j[J{ d j_Jy d jaJw +d jbJs d jbJo d jaJl d j\Jh d jTJd d jQJb d jNJ^ d jLJX d jLJR m j_Jw +d jaJs d jaJo d j_Jl m j[J{ d j^Jy d j_Js d j_Jo d j^Jl d j[Jh d jTJd +m jLJV d jNJX d jQJX d jYJV d j_JV d jbJX m jQJX d jYJT d j_JT d jaJV +m jQJX d jYJR d j_JR d jaJT d jbJX d jbJ\ m jKJE m j~Ju d j~JR m j?Jw +d j?JT m kAJ{ d kAJR m kAJ{ d joJ^ d kIJ^ m jyJR d kFJR m j~JT d jzJR +m j~JV d j|JR m kAJV d kBJR m kAJT d kDJR m joJE m kTKI m kTJE m ksKI +m ksJE m lRKI m lRJE m lqKI m lqJE m mPKI m mPJE m mtKC d mtJE m mnJE +m iqIh d iqIC m isIh d isIE m itIl d itIC m itIl d ipIf d ilId m ikIC +d i{IC m iqIE d inIC m iqIG d ipIC m itIG d ivIC m itIE d iwIC m ifHu +m jNId d jNIb d jOIb d jOId d jNId m jNIf d jOIf d jQId d jQIb d jOI` +d jNI` d jLIb d jLId d jNIh d jOIj d jTIl d j[Il d j_Ij d jaIh d jbId +d jbI` d jaI\ d j\IX d jTIT d jQIS d jNIO d jLII d jLIC m j_Ih d jaId +d jaI` d j_I\ m j[Il d j^Ij d j_Id d j_I` d j^I\ d j[IX d jTIT m jLIG +d jNII d jQII d jYIG d j_IG d jbII m jQII d jYIE d j_IE d jaIG m jQII +d jYIC d j_IC d jaIE d jbII d jbIM m jKHu m jtIl d jqIX d jtI\ d jyI^ +d j~I^ d kBI\ d kFIX d kGIS d kGIO d kFII d kBIE d j~IC d jyIC d jtIE +d jrIG d jqIK d jqIM d jrIO d jtIO d jvIM d jvIK d jtII d jrII m kDIX +d kFIT d kFIM d kDII m j~I^ d kAI\ d kBIZ d kDIT d kDIM d kBIG d kAIE +d j~IC m jrIM d jrIK d jtIK d jtIM d jrIM m jtIl d kDIl m jtIj d kAIj +m jtIh d jzIh d kAIj d kDIl m joHu m kTIy m kTHu m ksIy m ksHu m lRIy +m lRHu m lqIy m lqHu m mPIy m mPHu m muIt d myIr d m{Ip d m}Il d m}Ih +d m{Id d myIb d mwI^ d mwIZ d m{IV m myIr d m{In d m{Ij d myIf d mwId +d muI` d muI\ d mwIX d m?IT d mwIQ d muIM d muII d mwIE d myIC d m{H? +d m{H{ d myHw m m{IS d mwIO d mwIK d myIG d m{IE d m}IA d m}H} d m{Hy +d myHw d muHu m mnHu m iqHY d iqGt m isHY d isGv m itH\ d itGt m itH\ +d ipHW d ilHU m ikGt d i{Gt m iqGv d inGt m iqGx d ipGt m itGx d ivGt +m itGv d iwGt m ifGf m jNHU d jNHS d jOHS d jOHU d jNHU m jNHW d jOHW +d jQHU d jQHS d jOHQ d jNHQ d jLHS d jLHU d jNHY d jOH[ d jTH\ d j[H\ +d j_H[ d jaHY d jbHU d jbHQ d jaHM d j\HI d jTHE d jQHC d jNG? d jLGy +d jLGt m j_HY d jaHU d jaHQ d j_HM m j[H\ d j^H[ d j_HU d j_HQ d j^HM +d j[HI d jTHE m jLGx d jNGy d jQGy d jYGx d j_Gx d jbGy m jQGy d jYGv +d j_Gv d jaGx m jQGy d jYGt d j_Gt d jaGv d jbGy d jbG} m jKGf m kBHW +d kBHU d kDHU d kDHW d kBHW m kDHY d kBHY d kAHW d kAHU d kBHS d kDHS +d kFHU d kFHW d kDH[ d kAH\ d j|H\ d jwH[ d jtHW d jrHS d jqHK d jqG? +d jrGy d jvGv d jzGt d j~Gt d kBGv d kFGy d kGG? d kGHA d kFHG d kBHK +d j~HM d jzHM d jwHK d jvHI d jtHE m jvHW d jtHS d jrHK d jrG? d jtGy +d jvGx m kDGy d kFG} d kFHC d kDHG m j|H\ d jyH[ d jwHY d jvHU d jtHM +d jtG? d jvGy d jwGv d jzGt m j~Gt d kAGv d kBGx d kDG} d kDHC d kBHI +d kAHK d j~HM m joGf m kTHj m kTGf m ksHj m ksGf m lRHj m lRGf m lqHj +m lqGf m mPHj m mPGf m mpG? d mpHC d mqHI d mtHK d mwHK d myHI d m?HC +d nAHA d nDHA d nGHC d nHHG m mpHC d mqHG d mtHI d mwHI d myHG d m?HA +d nAG? d nDG? d nGHA d nHHG d nHHK m mnGf m iqGI d iqFd m isGI d isFf +m itGM d itFd m itGM d ipGG d ilGE m ikFd d i{Fd m iqFf d inFd m iqFh +d ipFd m itFh d ivFd m itFf d iwFd m ifFW m jNGE d jNGC d jOGC d jOGE +d jNGE m jNGG d jOGG d jQGE d jQGC d jOGA d jNGA d jLGC d jLGE d jNGI +d jOGK d jTGM d j[GM d j_GK d jaGI d jbGE d jbGA d jaF~ d j\Fz d jTFv +d jQFt d jNFp d jLFj d jLFd m j_GI d jaGE d jaGA d j_F~ m j[GM d j^GK +d j_GE d j_GA d j^F~ d j[Fz d jTFv m jLFh d jNFj d jQFj d jYFh d j_Fh +d jbFj m jQFj d jYFf d j_Ff d jaFh m jQFj d jYFd d j_Fd d jaFf d jbFj +d jbFn m jKFW m jqGM d jqGA m kGGM d kGGG d kFGA d j?Fx d j~Ft d j|Fl +d j|Fd m j~Fv d j|Fr d jzFl d jzFd m kFGA d j~Fx d jzFr d jyFl d jyFd +d j|Fd m jqGE d jrGI d jvGM d jyGM d kAGG d kDGG d kFGI d kGGM +stroke +m kGGM m jtGI d jvGK d jyGK d j|GI m jqGE d jrGG d jvGI d jyGI d kAGG +m joFW m kTG[ m kTFW m ksG[ m ksFW +stroke +/Times-Roman findfont 24 scalefont setfont +initmatrix +-1 72 mul 300 div 1 72 mul 300 div scale +-2409 88 translate +1600 3150 moveto +[1 0 0 -1 0 0] concat +(NOAO/IRAF fitz@pisces Mon Jun 30 10:37:53 1997 +) show +showpage diff --git a/vendor/x11iraf/cdl/doc/vximtool.man b/vendor/x11iraf/cdl/doc/vximtool.man new file mode 100644 index 00000000..66f2afb7 --- /dev/null +++ b/vendor/x11iraf/cdl/doc/vximtool.man @@ -0,0 +1,276 @@ +.\" @(#)vximtool.1 1.1 18-Jun-97 MJF +.TH VXIMTOOL 1 "18 Jun 1997" "IRAF Project" +.SH NAME +vximtool \-- A virtual and/or proxy display server for IRAF IIS protocol clients +.SH SYNOPSIS +\fBvximtool\fP [ \fIoptions\fP ...] +.br +\fBvximtool\fP -proxy [ \fIoptions ...] server [ server\fP ... ] + +.SH "DESCRIPTION" +.LP +\fIVXIMTOOL\fR is a image display server process much like \fIXIMTOOL\fR, +except that all it normally does is respond to datastream requests +to read and write to internal frame buffers maintained as arrays in memory. +Multiple frame buffers and frame buffer configurations are supported. It +can be used to debug IIS protocol client programs by printing out the +protocol packets recieved, or can simply be used as a dummy server in cases +where no image display is really needed. By enabling the \fI-proxy\fR +flag the server can also be used to repeat the datastream requests to a +list of other servers, effectively splitting the image display to a number +of other servers. See below for details on using the program in this +manner. + +The \fI-verbose\fR flag will log all datastream requests to the stderr, +otherwise the task runs silently except for error messages. The process is +terminated with an EOF on the stdin, if the task is intended to be run +as a background job the \fI-background\fR flag should be enabled to shut +off the check of the stdin and avoid a "waiting for tty input" message that +would suspend the background job. Frame buffers are maintained as rasters +in memory, up to four frames may currently be defined. If it not necessary +to keep the displayed images in memory (i.e. the client will not need to +read back any subrasters such as when doing overlay graphics), the +\fI-noraster\fR flag can be used to disable the memory rasters. In this +case any image readback will return an array of zero values. + +The default frame buffer size is 512x512, with 2 frames defined initially. +The \fI-config\fR and \fI-nframes\fR flags can be used to change the +startup frame buffers used. The frame buffer configuration table is normally +taken to be /usr/local/lib/imtoolrc but can be overridden by using an +IMTOOLRC environment variable, a \fI$HOME/.imtoolrc\fR file, or +the \fI-imtoolrc\fR command-line flag respectively. The format of the +frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + +and so on. At most 128 frame buffer sizes may be defined, each configuration +may define up to 4 frames, configuration numbers need not be sequential. + +.SH OPTIONS +.TP 5 +.B "-background" +The task will be run in the background so don't listen to STDIN for an +EOF to quit gracefully. +.TP 5 +.B "-config \fInum\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-interactive" +Allow cursor value strings to be typed into the STDIN in response to cursor +read requests from the client. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-noraster" +If set no client data will be stored in memory, and image readback will +return an array of zeroes unless used as a proxy server. +.TP 5 +.B "-nframes \fInum\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-port \fInum\fP" +Set the primary port to listen on for client connections. The default +is 5137 except when used as a proxy server in which case the default is +5136. +.TP 5 +.B "-proxy" +Run as a proxy server by repeating client requests to each of the +\fIserver\fR remote server arguments. See the section on proxy usage +below for details. +.TP 5 +.B "-verbose" +If set, print information about all IIS packets headers recieved to the +STDERR stream. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "CLIENT CONNECTIONS" + +\fIVXImtool\fR allows clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument. Values should be specified as the root +pathname to a pair of fifo pipes whose last character is 'i' or 'o', +these characters will be added automatically when opening the pipes. +For example, to use the default pipes the path would be specified as simply +"/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch. +This permits connecting to the server over a remote network connection +anywhere on the Internet. When used as a proxy server the default port +number is 5136 so as to avoid a conflict with an XImtool running on the +same machine, other connections are disabled unless otherwise overridden +by a command line option following the \fI-proxy\fR flag to reset the +connection. A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch. Legal values should be specified as a filename to be +used for the socket, up to two "%d" fields are allowed and will be replaced +by the userid. An empty string value disables this connection. +.LP +By default \fIvximtool\fR listens simultaneously for client connections on all +three types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + +.SH "COMMUNICATIONS PROTOCOL" + +Clients communicate with \fIvximtool\fR using a protocol developed originally +for IIS (International Imaging Systems) Frame Buffer hardware, the so-called +"IIS protocol"; other more modern protocols will likely be supported in the +future. The IIS protocol is basically a command packet stream with a header +describing the operation to be performed (select frame, load display, read +cursor, etc), and an optional data packet containing e.g. pixels. It is +beyond the scope of this document to describe fully the details of the +protocol; interested users should contact \fIiraf@noao.edu\fP for further +information or see the \fIA Reference Guide for the IRAF Client Display +Library\fR for details. + +.SH "PROXY USAGE" + +The \fIvximtool\fR may also be used as a proxy server by enabling the +\fI-proxy\fR command line flag. In this mode the program acts as +a relay for the IIS datastream packets, sending image data, frame requests, +etc. to a list of other servers specified on the command line. The effect +of this is to allow a client to display to this program which then +re-displays to each of the other named servers. A maximum of 8 servers +may be named, they may be either on the local host or a remote machine +and connections can be established using either fifos or sockets. See +below for details on how to specify the server connection. + +The current implementation has a few restrictions users should keep in mind: +.IP +Cursor and image readback are done by sending the request \fIonly\fR to +the first server named on the command line. This is done to avoid forcing +a cursor mode on all servers which cannot be terminated when a response is +received from only one server, and means that the first server named should +be the one used to control interactive sessions. The remaining servers +however can still respond to cursor requests from other applications connected +to that server on another channel. +.IP +All named servers must be running prior to starting the proxy server. The +connection to the remote servers is established when this task is first run +and if no server is running that connection will be ignored. The task will +exit if no remote servers can be found for display. +.IP +Any connected server that shuts down while the proxy server is running is +likely to cause the program to crash on the next display. + +.SH "SPECIFYING THE REMOTE SERVER CONNECTION" + +The syntax for the server argument used in proxy mode is as follows: + + \fI :
\fR + +where is one of \fBinet\fR (internet tcp/ip socket), \fBunix\fR +(unix domain socket) or \fBfifo\fR (named pipe). The form of the address +depends upon the domain, as illustrated in the examples below. + +.TP 30 +inet:5137 +Connect to port 5137 on the local host. +.TP 30 +inet:5137:foo.bar.edu +Client connection to port 5137 on internet host \fIfoo.bar.edu\fR. +The dotted (numeric) form of address may also be used. +.TP 30 +unix:/tmp/.IMT212 +Unix domain socket with the given pathname. IPC method, local host only. +.TP 30 +fifo:/dev/imt1i:/dev/imt1o +FIFO or named pipe with the given pathname. IPC method, local host only. +Two pathnames are required, one for input and one for output, since FIFOs +are not bidirectional. +.LP +The address field may contain up to two "%d" fields. If present, the +user's UID will be substituted (e.g. "unix:/tmp/.IMT%d"). + +.SH "EXAMPLES" + +.TP 5 +1) Run the vximtool, logging output to the file named "spool": + + \f(CW% vximtool -verbose >& spool\fR +.TP 5 +2) Run the vximtool in the background, connect only on unix sockets, no output: + + \f(CW% vximtool -b -unix_only &\fR +.TP 5 +3) Don't store images in memory, start with initial 1024x1024 frame buffer: + + \f(CW% vximtool -noraster -config 3\fR +.TP 5 +4) Run the vximtool in the background, taking cursor input from a file: + + \f(CW% vximtool -i < cursor_file &\fR +.TP 5 +5) Run as a proxy server, displaying to both a local and a remote XImtool, log output to stderr: + + \fI...start all XImtool servers to be used\fP + \f(CW% vximtool -v -proxy unix:/tmp/.IMT%d inet:5137:pisces + Connected to server on unix:/tmp/.IMT359 + Connected to server on inet:5137:pisces + Open to accept input on inet: port 5136\fR + +.LP +To display to the proxy server the client should connect to the vximtool on +\fIinet:5136\fP, the proxy in turn will relay data to the servers listed on +the command line. Note that in this last example any cursor requests from +the client connected to the vximtool will be handled by the +ximtool connected on a unix socket on the local machine (i.e. the first +server argument). The remote ximtool +on the machine pisces could simultaneously be used by another client on +that machine connected by some other means. In this case it will only +display images coming from the \fIvximtool\fR proxy, but could be used in +an interactive IRAF session running on pisces to examine the images. + +.SH SEE ALSO +ximtool(1) +.br +\fIA Reference Guide for the IRAF Client Display Library (CDL)\fR +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/cdl/doc/vximtool.ps b/vendor/x11iraf/cdl/doc/vximtool.ps new file mode 100644 index 00000000..70cae4f5 --- /dev/null +++ b/vendor/x11iraf/cdl/doc/vximtool.ps @@ -0,0 +1,2472 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Tue Mar 3 16:57:09 1998 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/C{/Courier FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(vximtool)S +1652(\261-)S +1765(A)S +1867(virtual)S +2158(and/or)S +2443(proxy)S +2706(display)S +3025(server)S +3298(for)S +3444(IRAF)S +3702(IIS)S +3854(protocol)S +4217(clients)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(vximtool)S +10 R +1662([)S +10 I +1725(options)S +10 R +2050(...])S +1488 V +10 B +1260(vximtool)S +10 R +1662(-proxy)S +1958([)S +10 I +2021(options)S +2346(...])S +2490(server)S +2769([)S +2838(server)S +10 R +3117(...)S +3222(])S +1776 V +9 B +900(DESCRIPTION)S +1896 V +10 I +1260(VXIMTOOL)S +10 R +1793(is)S +1899(a)S +1982(image)S +2265(display)S +2593(server)S +2875(process)S +3213(much)S +3475(like)S +10 I +3665(XIMTOOL)S +10 R +4098(,)S +4163(except)S +4463(that)S +4653(all)S +4793(it)S +4889(normally)S +5290(does)S +5513(is)S +2016 V +1260(respond)S +1632(to)S +1766(datastream)S +2254(requests)S +2637(to)S +2770(read)S +2996(and)S +3195(write)S +3455(to)S +3588(internal)S +3948(frame)S +4235(bu)S +4335 H + (f)show 10 -.5 mul h (f)show +10 R +4396(ers)S +4567(maintained)S +5066(as)S +5204(arrays)S +5502(in)S +2136 V +1260(memory.)S +1682(Multiple)S +2062(frame)S +2329(bu)S +2429 H + (f)show 10 -.5 mul h (f)show +10 R +2490(ers)S +2641(and)S +2820(frame)S +3087(bu)S +3187 H + (f)show 10 -.5 mul h (f)show +10 R +3248(er)S +3360(con\256gurations)S +3967(are)S +4123(supported.)S +4607(It)S +4703(can)S +4876(be)S +5005(used)S +5223(to)S +5336(debug)S +2256 V +1260(IIS)S +1424(protocol)S +1799(client)S +2063(programs)S +2482(by)S +2624(printing)S +2983(out)S +3153(the)S +3317(protocol)S +3692(packets)S +4033(recieved,)S +4436(or)S +4560(can)S +4739(simply)S +5053(be)S +5188(used)S +5412(as)S +5536(a)S +2376 V +1260(dummy)S +1602(server)S +1881(in)S +1995(cases)S +2241(where)S +2520(no)S +2656(image)S +2936(display)S +3261(is)S +3364(really)S +3627(needed.)S +4000(By)S +4154(enabling)S +4535(the)S +10 I +4694(-proxy)S +10 R +4991(\257ag)S +5178(the)S +5337(server)S +2496 V +1260(can)S +1431(also)S +1625(be)S +1752(used)S +1968(to)S +2079(repeat)S +2355(the)S +2510(datastream)S +2975(requests)S +3335(to)S +3446(a)S +3522(list)S +3677(of)S +3792(other)S +4029(servers,)S +4368(e)S +4412 H + (f)show 10 -.5 mul h (f)show +10 R +4473(ectively)S +4821(splitting)S +5182(the)S +5336(image)S +2616 V +1260(display)S +1579(to)S +1687(a)S +1761(number)S +2096(of)S +2209(other)S +2444(servers.)S +2811(See)S +2985(below)S +3259(for)S +3405(details)S +3696(on)S +3826(using)S +4073(the)S +4225(program)S +4593(in)S +4701(this)S +4876(manner.)S +2856 V +1260(The)S +10 I +1448(-verbose)S +10 R +1824(\257ag)S +2007(will)S +2196(log)S +2357(all)S +2490(datastream)S +2955(requests)S +3315(to)S +3426(the)S +3581(stderr,)S +3866(otherwise)S +4287(the)S +4442(task)S +4636(runs)S +4841(silently)S +5170(except)S +5464(for)S +2976 V +1260(error)S +1485(messages.)S +1949(The)S +2136(process)S +2467(is)S +2566(terminated)S +3025(with)S +3234(an)S +3359(EOF)S +3579(on)S +3710(the)S +3863(stdin,)S +4114(if)S +4206(the)S +4359(task)S +4551(is)S +4649(intended)S +5024(to)S +5133(be)S +5258(run)S +5422(as)S +5536(a)S +3096 V +1260(background)S +1772(job)S +1941(the)S +10 I +2104(-background)S +10 R +2655(\257ag)S +2846(should)S +3154(be)S +3289(enabled)S +3640(to)S +3760(shut)S +3969(o)S +4019 H + (f)show 10 -.5 mul h (f)show +10 R +4122(the)S +4286(check)S +4560(of)S +4685(the)S +4849(stdin)S +5086(and)S +5272(avoid)S +5536(a)S +3216 V +1260("waiting)S +1634(for)S +1783(tty)S +1922(input")S +2202(message)S +2573(that)S +2756(would)S +3039(suspend)S +3394(the)S +3549(background)S +4053(job.)S +4269(Frame)S +4557(bu)S +4657 H + (f)show 10 -.5 mul h (f)show +10 R +4718(ers)S +4867(are)S +5021(maintained)S +5497(as)S +3336 V +1260(rasters)S +1554(in)S +1666(memory,)S +2058(up)S +2192(to)S +2305(four)S +2506(frames)S +2812(may)S +3019(currently)S +3414(be)S +3543(de\256ned.)S +3927(If)S +4028(it)S +4119(not)S +4282(necessary)S +4704(to)S +4817(keep)S +5040(the)S +5197(displayed)S +3456 V +1260(images)S +1580(in)S +1695(memory)S +2065(\(i.e.)S +2257(the)S +2416(client)S +2675(will)S +2868(not)S +3033(need)S +3258(to)S +3373(read)S +3581(back)S +3806(any)S +3987(subrasters)S +4423(such)S +4643(as)S +4763(when)S +5016(doing)S +5281(overlay)S +3576 V +1260(graphics\),)S +1690(the)S +10 I +1846(-noraster)S +10 R +2252(\257ag)S +2436(can)S +2608(be)S +2736(used)S +2953(to)S +3066(disable)S +3384(the)S +3541(memory)S +3909(rasters.)S +4259(In)S +4377(this)S +4557(case)S +4763(any)S +4942(image)S +5221(readback)S +3696 V +1260(will)S +1446(return)S +1714(an)S +1838(array)S +2072(of)S +2185(zero)S +2386(values.)S +3936 V +1260(The)S +1448(default)S +1758(frame)S +2023(bu)S +2123 H + (f)show 10 -.5 mul h (f)show +10 R +2184(er)S +2295(size)S +2484(is)S +2585(512x512,)S +2994(with)S +3206(2)S +3290(frames)S +3595(de\256ned)S +3923(initially.)S +4324(The)S +10 I +4513(-con\256g)S +10 R +4824(and)S +10 I +5002(-nframes)S +10 R +5391(\257ags)S +4056 V +1260(can)S +1437(be)S +1570(used)S +1792(to)S +1909(change)S +2230(the)S +2391(startup)S +2702(frame)S +2973(bu)S +3073 H + (f)show 10 -.5 mul h (f)show +10 R +3134(ers)S +3289(used.)S +3566(The)S +3760(frame)S +4031(bu)S +4131 H + (f)show 10 -.5 mul h (f)show +10 R +4192(er)S +4308(con\256guration)S +4880(table)S +5113(is)S +5219(normally)S +4176 V +1260(taken)S +1507(to)S +1616(be)S +1741(/usr/local/lib/imtoolrc)S +2645(but)S +2804(can)S +2973(be)S +3098(overridden)S +3561(by)S +3692(using)S +3941(an)S +4067(IMTOOLRC)S +4621(environment)S +5158(variable,)S +5536(a)S +4296 V +10 I +1260($HOME/.imtoolrc)S +10 R +2029(\256le,)S +2221(or)S +2343(the)S +10 I +2504(-imtoolrc)S +10 R +2915(command-line)S +3531(\257ag)S +3719(respectively.)S +4294(The)S +4487(format)S +4791(of)S +4912(the)S +5072(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +4416 V +1260(con\256guration)S +1823(\256le)S +1981(is)S +4656 V +10 I +1410(con\256gno)S +1784(nframes)S +2136(width)S +2389(height)S +2669([extra)S +2943(\256elds])S +4776 V +10 R +1290(e.g.)S +4896 V +1560(1)S +1670(2)S +1780(512)S +1990(512)S +5016 V +1560(2)S +1670(2)S +1780(800)S +1990(800)S +5136 V +1560(3)S +1670(1)S +1750(1024)S +1980(1024)S +2480(#)S +2560(comment)S +5376 V +1260(and)S +1434(so)S +1553(on.)S +1738(At)S +1868(most)S +2093(128)S +2273(frame)S +2536(bu)S +2636 H + (f)show 10 -.5 mul h (f)show +10 R +2697(er)S +2805(sizes)S +3030(may)S +3233(be)S +3358(de\256ned,)S +3708(each)S +3921(con\256guration)S +4485(may)S +4688(de\256ne)S +4963(up)S +5094(to)S +5203(4)S +5284(frames,)S +5496 V +1260(con\256guration)S +1823(numbers)S +2197(need)S +2415(not)S +2573(be)S +2697(sequential.)S +5784 V +9 B +900(OPTIONS)S +5904 V +10 B +1260(-background)S +6024 V +10 R +1510(The)S +1695(task)S +1886(will)S +2072(be)S +2196(run)S +2359(in)S +2467(the)S +2619(background)S +3120(so)S +3239(don't)S +3480(listen)S +3727(to)S +3835(STDIN)S +4159(for)S +4305(an)S +4429(EOF)S +4648(to)S +4756(quit)S +4942(gracefully.)S +6192 V +10 B +1260(-con\256g)S +10 I +1579(num)S +6312 V +10 R +1510(Initial)S +1799(frame)S +2081(bu)S +2181 H + (f)show 10 -.5 mul h (f)show +10 R +2242(er)S +2369(con\256guration)S +2952(number.)S +3362(The)S +3567(default)S +3894(value)S +4160(is)S +4277(1,)S +4402(indicating)S +4852(a)S +4947(512x512)S +5348(frame)S +6432 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(er)S +1778(with)S +1986(2)S +2066(frames.)S +2422(See)S +2596(below)S +2870(for)S +3016(information)S +3518(on)S +3648(the)S +3800(frame)S +4062(bu)S +4162 H + (f)show 10 -.5 mul h (f)show +10 R +4223(ers.)S +6600 V +10 B +1260(-\256fo)S +10 I +1462(pipe)S +6720 V +10 R +1510(Speci\256es)S +1901(the)S +2053(name)S +2299(of)S +2412(the)S +2564(\256fo)S +2733(pipe)S +2936(to)S +3045(be)S +3170(used,)S +3409(the)S +10 I +3562(i)S +10 R +3621(and)S +10 I +3796(o)S +10 R +3877(su)S +3966 H + (f)show 10 -.5 mul h (\256)show +10 R +4050(xes)S +4214(will)S +4401(be)S +4526(added)S +4795(automatically.)S +5425(The)S +6840 V +1510(default)S +1817(pipe)S +2019(names)S +2304(will)S +2490(be)S +2614(/dev/imt1i)S +3056(\(input)S +3325(pipe\))S +3560(and)S +3734(/dev/imt1o)S +4198(\(output)S +4517(pipe\).)S +7008 V +10 B +1260(-\256fo_only)S +7128 V +10 R +1510(If)S +1615(set,)S +1790(only)S +2007(\256fo)S +2185(pipes)S +2435(will)S +2630(be)S +2763(used)S +2985(for)S +3140(communication)S +3801(with)S +4018(a)S +4101(client)S +4363(program,)S +4766(sockets)S +5100(will)S +5296(be)S +5430(dis-)S +7248 V +1510(abled.)S +7728 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(1)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(-help)S +10 R +1510(Print)S +1735(a)S +1809(summary)S +2211(of)S +2324(command)S +2748(line)S +2928(options)S +3253(to)S +3361(the)S +3513(screen.)S +1128 V +10 B +1260(-interactive)S +1248 V +10 R +1510(Allow)S +1792(cursor)S +2073(value)S +2321(strings)S +2620(to)S +2730(be)S +2856(typed)S +3110(into)S +3299(the)S +3454(STDIN)S +3781(in)S +3892(response)S +4274(to)S +4385(cursor)S +4667(read)S +4871(requests)S +5231(from)S +5458(the)S +1368 V +1510(client.)S +1536 V +10 B +1260(-imtoolrc)S +10 I +1683(\256le)S +1656 V +10 R +1510(Speci\256es)S +1923(the)S +2097(frame)S +2381(bu)S +2481 H + (f)show 10 -.5 mul h (f)show +10 R +2542(er)S +2671(con\256guration)S +3257(\256le)S +3438(to)S +3569(be)S +3716(used.)S +4007(See)S +4204(below)S +4501(for)S +4670(information)S +5195(on)S +5348(frame)S +1776 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(ers.)S +1944 V +10 B +1260(-inet_only)S +2064 V +10 R +1510(If)S +1611(set,)S +1782(only)S +1995(inet)S +2180(sockets)S +2509(will)S +2700(be)S +2829(used)S +3047(for)S +3198(communication)S +3855(with)S +4068(a)S +4147(client)S +4404(program,)S +4802(\256fo)S +4976(pipes)S +5222(and)S +5402(unix)S +2184 V +1510(sockets)S +1834(will)S +2020(be)S +2144(disabled.)S +2352 V +10 B +1260(-noraster)S +2472 V +10 R +1510(If)S +1614(set)S +1763(no)S +1901(client)S +2162(data)S +2367(will)S +2562(be)S +2695(stored)S +2978(in)S +3095(memory,)S +3492(and)S +3675(image)S +3958(readback)S +4356(will)S +4551(return)S +4828(an)S +4961(array)S +5204(of)S +5326(zeroes)S +2592 V +1510(unless)S +1790(used)S +2003(as)S +2116(a)S +2190(proxy)S +2453(server.)S +2760 V +10 B +1260(-nframes)S +10 I +1672(num)S +2880 V +10 R +1510(Speci\256es)S +1913(the)S +2077(number)S +2424(of)S +2549(frame)S +2823(bu)S +2923 H + (f)show 10 -.5 mul h (f)show +10 R +2984(ers)S +3142(to)S +3262(con\256gure)S +3681(at)S +3795(startup.)S +4164(By)S +4323(default)S +4642(there)S +4883(will)S +5081(be)S +5217(2)S +5309(frames)S +3000 V +1510(available,)S +1925(a)S +1999(maximum)S +2435(of)S +2548(4)S +2628(frames)S +2929(are)S +3080(allowed.)S +3168 V +10 B +1260(-port_only)S +3288 V +10 R +1510(Same)S +1770(as)S +10 I +1891(-inet_only)S +10 R +2334(option.)S +2683(If)S +2787(set,)S +2961(only)S +3177(inet)S +3365(sockets)S +3697(will)S +3891(be)S +4023(used)S +4244(for)S +4398(communication)S +5058(with)S +5275(a)S +5358(client)S +3408 V +1510(program.)S +3576 V +10 B +1260(-port)S +10 I +1506(num)S +3696 V +10 R +1510(Set)S +1670(the)S +1825(primary)S +2174(port)S +2368(to)S +2479(listen)S +2729(on)S +2862(for)S +3011(client)S +3266(connections.)S +3831(The)S +4019(default)S +4329(is)S +4429(5137)S +4662(except)S +4955(when)S +5204(used)S +5420(as)S +5536(a)S +3816 V +1510(proxy)S +1773(server)S +2046(in)S +2154(which)S +2428(case)S +2629(the)S +2781(default)S +3088(is)S +3185(5136.)S +3984 V +10 B +1260(-proxy)S +4104 V +10 R +1510(Run)S +1714(as)S +1834(a)S +1915(proxy)S +2186(server)S +2467(by)S +2605(repeating)S +3014(client)S +3274(requests)S +3639(to)S +3755(each)S +3975(of)S +4096(the)S +10 I +4256(server)S +10 R +4543(remote)S +4858(server)S +5139(arguments.)S +4224 V +1510(See)S +1684(the)S +1836(section)S +2149(on)S +2279(proxy)S +2542(usage)S +2799(below)S +3073(for)S +3219(details.)S +4392 V +10 B +1260(-verbose)S +4512 V +10 R +1510(If)S +1606(set,)S +1772(print)S +1991(information)S +2493(about)S +2745(all)S +2875(IIS)S +3027(packets)S +3356(headers)S +3690(recieved)S +4057(to)S +4165(the)S +4317(STDERR)S +4731(stream.)S +4680 V +10 B +1260(-unix)S +10 I +1513(name)S +4800 V +10 R +1510(Speci\256es)S +1909(the)S +2069(unix)S +2285(domain)S +2623(socket)S +2916(name)S +3170(to)S +3286(use.)S +3512(A)S +3622("%d")S +3876(in)S +3993(the)S +4154(\256lename)S +4537(will)S +4732(be)S +4865(replaced)S +5241(with)S +5458(the)S +4920 V +1510(user)S +1706(id.)S +5088 V +10 B +1260(-unix_only)S +5208 V +10 R +1510(If)S +1607(set,)S +1774(only)S +1983(unix)S +2192(domain)S +2523(sockets)S +2848(will)S +3035(be)S +3160(used)S +3374(for)S +3521(communication)S +4174(with)S +4383(a)S +4458(client)S +4711(program,)S +5105(inet)S +5286(sockets)S +5328 V +1510(and)S +1684(\256fos)S +1892(will)S +2078(be)S +2202(disabled.)S +5616 V +9 B +900(CLIENT)S +1272(CONNECTIONS)S +5736 V +10 I +1260(VXImtool)S +10 R +1673(allows)S +1964(clients)S +2255(to)S +2363(connect)S +2703(in)S +2811(any)S +2985(of)S +3098(the)S +3250(following)S +3669(ways:)S +5904 V +10 B +1260(\256fo)S +1429(pipes)S +6024 V +10 R +1510(The)S +1706(traditional)S +2158(approach.)S +2589(The)S +2785(default)S +3103(global)S +3394(/dev/imt1[io])S +3963(pipes)S +4215(may)S +4428(be)S +4564(used,)S +4814(or)S +4939(a)S +5025(private)S +5344(set)S +5497(of)S +6144 V +1510(\256fos)S +1731(can)S +1911(be)S +2047(speci\256ed)S +2444(using)S +2703(the)S +10 I +2867(-\256fo)S +10 R +3070(command)S +3506(line)S +3698(argument.)S +4172(Values)S +4491(should)S +4800(be)S +4936(speci\256ed)S +5333(as)S +5458(the)S +6264 V +1510(root)S +1701(pathname)S +2119(to)S +2227(a)S +2301(pair)S +2486(of)S +2599(\256fo)S +2768(pipes)S +3009(whose)S +3294(last)S +3463(character)S +3857(is)S +3954('i')S +4078(or)S +4191('o',)S +4362(these)S +4597(characters)S +5030(will)S +5217(be)S +5342(added)S +6384 V +1510(automatically)S +2099(when)S +2360(opening)S +2727(the)S +2894(pipes.)S +3175(For)S +3359(example,)S +3767(to)S +3890(use)S +4068(the)S +4234(default)S +4555(pipes)S +4810(the)S +4976(path)S +5192(would)S +5486(be)S +6504 V +1510(speci\256ed)S +1895(as)S +2008(simply)S +2311("/dev/imt1".)S +2832(A)S +2934(value)S +3180(of)S +3293("none")S +3599(disables)S +3951(this)S +4126(connection.)S +6672 V +10 B +1260(tcp/ip)S +1535(sockets)S +6792 V +10 R +1510(Clients)S +1836(connect)S +2188(via)S +2352(a)S +2438(tcp/ip)S +2708(socket.)S +3030(The)S +3227(default)S +3546(port)S +3749(is)S +10 I +3858(5137)S +10 R +4058(,)S +4125(or)S +4250(a)S +4337(custom)S +4669(port)S +4873(may)S +5088(be)S +5225(speci\256ed)S +6912 V +1510(using)S +1760(the)S +10 I +1915(-port)S +10 R +2148(command)S +2575(line)S +2758(switch.)S +3107(This)S +3318(permits)S +3650(connecting)S +4120(to)S +4230(the)S +4384(server)S +4659(over)S +4868(a)S +4944(remote)S +5253(network)S +7032 V +1510(connection)S +1992(anywhere)S +2423(on)S +2567(the)S +2734(Internet.)S +3174(When)S +3457(used)S +3685(as)S +3813(a)S +3902(proxy)S +4180(server)S +4468(the)S +4635(default)S +4957(port)S +5163(number)S +5513(is)S +7152 V +1510(5136)S +1742(so)S +1863(as)S +1978(to)S +2088(avoid)S +2342(a)S +2418(con\257ict)S +2750(with)S +2960(an)S +3086(XImtool)S +3457(running)S +3800(on)S +3932(the)S +4085(same)S +4321(machine,)S +4715(other)S +4951(connections)S +5459(are)S +7272 V +1510(disabled)S +1881(unless)S +2169(otherwise)S +2595(overridden)S +3065(by)S +3203(a)S +3285(command)S +3717(line)S +3905(option)S +4199(following)S +4626(the)S +10 I +4787(-proxy)S +10 R +5086(\257ag)S +5275(to)S +5392(reset)S +7752 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(2)S +7920 V +EP +%%Page: 3 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(the)S +1662(connection.)S +2185(A)S +2287(port)S +2478(number)S +2813(of)S +2926(0)S +3006(\(zero\))S +3273(disables)S +3625(this)S +3800(connection.)S +1128 V +10 B +1260(unix)S +1480(domain)S +1833(sockets)S +1248 V +10 R +1510(Like)S +1733(a)S +1817(tcp/ip)S +2085(socket,)S +2405(but)S +2573(limited)S +2898(to)S +3017(a)S +3102(single)S +3382(host)S +3590(system.)S +3934(Usually)S +4286(faster)S +4548(than)S +4761(a)S +4846(tcp/ip)S +5115(socket,)S +5436(and)S +1368 V +1510(comparable)S +2008(to)S +2119(a)S +2196(\256fo.)S +2393(By)S +2543(default)S +2853(each)S +3068(user)S +3267(gets)S +3460(their)S +3675(own)S +3879(unix)S +4089(domain)S +4421(socket,)S +4733(so)S +4854(this)S +5031(option)S +5319(allows)S +1488 V +1510(multiple)S +1882(users)S +2125(to)S +2241(run)S +2413(ximtools)S +2803(on)S +2942(the)S +3103(same)S +3347(host)S +3553(without)S +3898(having)S +4209(to)S +4326(customize)S +4770(things.)S +5109(The)S +5303(default)S +1608 V +1510(value)S +1758(is)S +1857("/tmp/.IMT%d",)S +2549(other)S +2785(sockets)S +3110(may)S +3313(be)S +3438(de\256ned)S +3763(using)S +4011(the)S +10 I +4164(-unix)S +10 R +4400(command)S +4825(line)S +5006(switch.)S +5353(Legal)S +1728 V +1510(values)S +1813(should)S +2128(be)S +2270(speci\256ed)S +2673(as)S +2804(a)S +2896(\256lename)S +3288(to)S +3414(be)S +3557(used)S +3789(for)S +3954(the)S +4125(socket,)S +4454(up)S +4603(to)S +4730(two)S +4929("%d")S +5193(\256elds)S +5459(are)S +1848 V +1510(allowed)S +1856(and)S +2030(will)S +2216(be)S +2340(replaced)S +2707(by)S +2837(the)S +2989(userid.)S +3288(An)S +3440(empty)S +3720(string)S +3978(value)S +4224(disables)S +4576(this)S +4751(connection.)S +2016 V +1260(By)S +1408(default)S +10 I +1716(vximtool)S +10 R +2091(listens)S +2378(simultaneously)S +3015(for)S +3162(client)S +3415(connections)S +3923(on)S +4054(all)S +4186(three)S +4417(types)S +4660(of)S +4775(ports.)S +5092(Clients)S +5408(may)S +2136 V +1260(connect)S +1614(simultaneously)S +2264(by)S +2408(di)S +2486 H + (f)show 10 -.5 mul h (f)show +10 R +2547(erent)S +2790(means)S +3089(allowing)S +3483(up)S +3627(to)S +3748(three)S +3990(di)S +4068 H + (f)show 10 -.5 mul h (f)show +10 R +4129(erent)S +4371(displays)S +4742(to)S +4863(be)S +5000(loading)S +5343(at)S +5458(the)S +2256 V +1260(same)S +1495(time)S +1703(into)S +1889(di)S +1967 H + (f)show 10 -.5 mul h (f)show +10 R +2028(erent)S +2257(frames.)S +2544 V +9 B +900(COMMUNICATIONS)S +1807(PROTOCOL)S +2664 V +10 R +1260(Clients)S +1583(communicate)S +2160(with)S +10 I +2377(vximtool)S +10 R +2760(using)S +3016(a)S +3099(protocol)S +3471(developed)S +3920(originally)S +4348(for)S +4503(IIS)S +4664(\(International)S +5247(Imaging)S +2784 V +1260(Systems\))S +1659(Frame)S +1946(Bu)S +2063 H + (f)show 10 -.5 mul h (f)show +10 R +2124(er)S +2232(hardware,)S +2658(the)S +2811(so-called)S +3202("IIS)S +3396(protocol";)S +3829(other)S +4065(more)S +4301(modern)S +4637(protocols)S +5040(will)S +5227(likely)S +5486(be)S +2904 V +1260(supported)S +1687(in)S +1798(the)S +1953(future.)S +2279(The)S +2467(IIS)S +2622(protocol)S +2988(is)S +3088(basically)S +3476(a)S +3553(command)S +3981(packet)S +4275(stream)S +4575(with)S +4787(a)S +4865(header)S +5164(describing)S +3024 V +1260(the)S +1421(operation)S +1837(to)S +1954(be)S +2087(performed)S +2541(\(select)S +2840(frame,)S +3136(load)S +3347(display,)S +3700(read)S +3910(cursor,)S +4223(etc\),)S +4436(and)S +4618(an)S +4750(optional)S +5116(data)S +5320(packet)S +3144 V +1260(containing)S +1712(e.g.)S +1886(pixels.)S +2180(It)S +2271(is)S +2368(beyond)S +2692(the)S +2844(scope)S +3101(of)S +3214(this)S +3390(document)S +3815(to)S +3924(describe)S +4287(fully)S +4507(the)S +4660(details)S +4952(of)S +5066(the)S +5219(protocol;)S +3264 V +1260(interested)S +1688(users)S +1933(should)S +2240(contact)S +10 I +2568(iraf@noao.edu)S +10 R +3214(for)S +3370(further)S +3681(information)S +4193(or)S +4316(see)S +4482(the)S +10 I +4643(A)S +4743(Reference)S +5180(Guide)S +5463(for)S +3384 V +1260(the)S +1412(IRAF)S +1658(Client)S +1933(Display)S +2274(Library)S +10 R +2610(for)S +2756(details.)S +3672 V +9 B +900(PROXY)S +1247(USAGE)S +3792 V +10 R +1260(The)S +10 I +1445(vximtool)S +10 R +1819(may)S +2021(also)S +2212(be)S +2336(used)S +2549(as)S +2663(a)S +2738(proxy)S +3002(server)S +3276(by)S +3407(enabling)S +3782(the)S +10 I +3935(-proxy)S +10 R +4226(command)S +4651(line)S +4832(\257ag.)S +5068(In)S +5182(this)S +5358(mode)S +3912 V +1260(the)S +1420(program)S +1796(acts)S +1989(as)S +2110(a)S +2191(relay)S +2427(for)S +2580(the)S +2739(IIS)S +2898(datastream)S +3367(packets,)S +3728(sending)S +4076(image)S +4357(data,)S +4585(frame)S +4854(requests,)S +5243(etc.)S +5421(to)S +5536(a)S +4032 V +1260(list)S +1421(of)S +1542(other)S +1785(servers)S +2105(speci\256ed)S +2498(on)S +2636(the)S +2796(command)S +3228(line.)S +3471(The)S +3664(e)S +3708 H + (f)show 10 -.5 mul h (f)show +10 R +3769(ect)S +3923(of)S +4045(this)S +4229(is)S +4335(to)S +4452(allow)S +4713(a)S +4796(client)S +5057(to)S +5174(display)S +5502(to)S +4152 V +1260(this)S +1436(program)S +1805(which)S +2080(then)S +2283(re-displays)S +2752(to)S +2861(each)S +3074(of)S +3188(the)S +3341(other)S +3577(named)S +3874(servers.)S +4241(A)S +4343(maximum)S +4779(of)S +4892(8)S +4972(servers)S +5284(may)S +5486(be)S +4272 V +1260(named,)S +1594(they)S +1809(may)S +2024(be)S +2161(either)S +2431(on)S +2574(the)S +2740(local)S +2978(host)S +3189(or)S +3316(a)S +3404(remote)S +3725(machine)S +4107(and)S +4295(connections)S +4816(can)S +4998(be)S +5136(established)S +4392 V +1260(using)S +1507(either)S +1764(\256fos)S +1972(or)S +2085(sockets.)S +2464(See)S +2638(below)S +2912(for)S +3058(details)S +3349(on)S +3479(how)S +3681(to)S +3789(specify)S +4107(the)S +4259(server)S +4532(connection.)S +4632 V +1260(The)S +1445(current)S +1757(implementation)S +2415(has)S +2578(a)S +2652(few)S +2831(restrictions)S +3305(users)S +3540(should)S +3837(keep)S +4055(in)S +4163(mind:)S +4800 V +1620(Cursor)S +1924(and)S +2100(image)S +2376(readback)S +2767(are)S +2920(done)S +3146(by)S +3278(sending)S +3621(the)S +3775(request)S +10 I +4095(only)S +10 R +4299(to)S +4409(the)S +4563(\256rst)S +4751(server)S +5026(named)S +5325(on)S +5458(the)S +4920 V +1620(command)S +2049(line.)S +2289(This)S +2502(is)S +2604(done)S +2833(to)S +2946(avoid)S +3203(forcing)S +3526(a)S +3605(cursor)S +3889(mode)S +4146(on)S +4281(all)S +4416(servers)S +4733(which)S +5012(cannot)S +5313(be)S +5442(ter-)S +5040 V +1620(minated)S +1973(when)S +2220(a)S +2295(response)S +2675(is)S +2773(received)S +3141(from)S +3366(only)S +3576(one)S +3752(server,)S +4052(and)S +4228(means)S +4515(that)S +4697(the)S +4851(\256rst)S +5039(server)S +5314(named)S +5160 V +1620(should)S +1924(be)S +2055(the)S +2214(one)S +2395(used)S +2615(to)S +2730(control)S +3050(interactive)S +3507(sessions.)S +3926(The)S +4117(remaining)S +4558(servers)S +4876(however)S +5255(can)S +5429(still)S +5280 V +1620(respond)S +1966(to)S +2074(cursor)S +2353(requests)S +2710(from)S +2934(other)S +3169(applications)S +3682(connected)S +4116(to)S +4224(that)S +4404(server)S +4677(on)S +4807(another)S +5136(channel.)S +5448 V +1620(All)S +1792(named)S +2102(servers)S +2428(must)S +2667(be)S +2805(running)S +3160(prior)S +3398(to)S +3520(starting)S +3864(the)S +4031(proxy)S +4309(server.)S +4652(The)S +4852(connection)S +5335(to)S +5458(the)S +5568 V +1620(remote)S +1934(servers)S +2253(is)S +2357(established)S +2838(when)S +3091(this)S +3273(task)S +3471(is)S +3575(\256rst)S +3768(run)S +3937(and)S +4117(if)S +4214(no)S +4350(server)S +4629(is)S +4732(running)S +5079(that)S +5265(connec-)S +5688 V +1620(tion)S +1806(will)S +1992(be)S +2116(ignored.)S +2506(The)S +2691(task)S +2882(will)S +3068(exit)S +3248(if)S +3339(no)S +3469(remote)S +3776(servers)S +4088(can)S +4256(be)S +4380(found)S +4643(for)S +4789(display.)S +5856 V +1620(Any)S +1832(connected)S +2276(server)S +2559(that)S +2749(shuts)S +2995(down)S +3257(while)S +3519(the)S +3682(proxy)S +3956(server)S +4240(is)S +4348(running)S +4700(is)S +4808(likely)S +5077(to)S +5196(cause)S +5458(the)S +5976 V +1620(program)S +1988(to)S +2096(crash)S +2336(on)S +2466(the)S +2618(next)S +2820(display.)S +6264 V +9 B +900(SPECIFYING)S +1482(THE)S +1699(REMOTE)S +2126(SERVER)S +2518(CONNECTION)S +6384 V +10 R +1260(The)S +1445(syntax)S +1736(for)S +1882(the)S +2034(server)S +2307(argument)S +2714(used)S +2927(in)S +3035(proxy)S +3298(mode)S +3550(is)S +3647(as)S +3760(follows:)S +6624 V +10 I +1620()S +2086(:)S +2149(
)S +6864 V +10 R +1260(where)S +1539()S +1988(is)S +2092(one)S +2273(of)S +10 B +2393(inet)S +10 R +2591(\(internet)S +2966(tcp/ip)S +3231(socket\),)S +10 B +3581(unix)S +10 R +3808(\(unix)S +4056(domain)S +4393(socket\))S +4718(or)S +10 B +4838(\256fo)S +10 R +5014(\(named)S +5350(pipe\).)S +6984 V +1260(The)S +1445(form)S +1669(of)S +1782(the)S +1934(address)S +2263(depends)S +2620(upon)S +2850(the)S +3002(domain,)S +3357(as)S +3470(illustrated)S +3900(in)S +4008(the)S +4160(examples)S +4567(below.)S +7272 V +1260(inet:5137)S +2760(Connect)S +3123(to)S +3231(port)S +3422(5137)S +3652(on)S +3782(the)S +3934(local)S +4158(host.)S +7752 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(3)S +7920 V +EP +%%Page: 4 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(inet:5137:foo.bar.edu)S +2760(Client)S +3055(connection)S +3543(to)S +3671(port)S +3882(5137)S +4133(on)S +4284(internet)S +4640(host)S +10 I +4858(foo.bar.edu)S +10 R +5319(.)S +5425(The)S +1080 V +2760(dotted)S +3040(\(numeric\))S +3463(form)S +3687(of)S +3800(address)S +4129(may)S +4331(also)S +4522(be)S +4646(used.)S +1248 V +1260(unix:/tmp/.IMT212)S +2760(Unix)S +3010(domain)S +3360(socket)S +3665(with)S +3893(the)S +4066(given)S +4339(pathname.)S +4803(IPC)S +5010(method,)S +5386(local)S +1368 V +2760(host)S +2957(only.)S +1536 V +1260(\256fo:/dev/imt1i:/dev/imt1o)S +2760(FIFO)S +3021(or)S +3148(named)S +3458(pipe)S +3674(with)S +3896(the)S +4062(given)S +4328(pathname.)S +4815(IPC)S +5016(method,)S +5386(local)S +1656 V +2760(host)S +2969(only.)S +3244(Two)S +3469(pathnames)S +3938(are)S +4101(required,)S +4500(one)S +4686(for)S +4844(input)S +5092(and)S +5278(one)S +5464(for)S +1776 V +2760(output,)S +3071(since)S +3306(FIFOs)S +3592(are)S +3743(not)S +3901(bidirectional.)S +1944 V +1260(The)S +1450(address)S +1784(\256eld)S +1997(may)S +2204(contain)S +2533(up)S +2668(to)S +2781(two)S +2966("%d")S +3216(\256elds.)S +3523(If)S +3624(present,)S +3972(the)S +4129(user's)S +4402(UID)S +4614(will)S +4805(be)S +4934(substituted)S +5403(\(e.g.)S +2064 V +1260("unix:/tmp/.IMT%d"\).)S +2352 V +9 B +900(EXAMPLES)S +2472 V +10 R +1260(1\))S +1373(Run)S +1570(the)S +1722(vximtool,)S +2139(logging)S +2475(output)S +2761(to)S +2869(the)S +3021(\256le)S +3179(named)S +3475("spool":)S +2712 V +10 C +1750(%)S +1870(vximtool)S +2410(-verbose)S +2950(>&)S +3130(spool)S +2880 V +10 R +1260(2\))S +1373(Run)S +1570(the)S +1722(vximtool)S +2114(in)S +2222(the)S +2374(background,)S +2900(connect)S +3240(only)S +3448(on)S +3578(unix)S +3786(sockets,)S +4135(no)S +4265(output:)S +3120 V +10 C +1750(%)S +1870(vximtool)S +2410(-b)S +2590(-unix_only)S +3250(&)S +3288 V +10 R +1260(3\))S +1373(Don't)S +1636(store)S +1860(images)S +2173(in)S +2281(memory,)S +2669(start)S +2871(with)S +3079(initial)S +3343(1024x1024)S +3823(frame)S +4085(bu)S +4185 H + (f)show 10 -.5 mul h (f)show +10 R +4246(er:)S +3528 V +10 C +1750(%)S +1870(vximtool)S +2410(-noraster)S +3010(-config)S +3490(3)S +3696 V +10 R +1260(4\))S +1373(Run)S +1570(the)S +1722(vximtool)S +2114(in)S +2222(the)S +2374(background,)S +2900(taking)S +3180(cursor)S +3459(input)S +3695(from)S +3919(a)S +3993(\256le:)S +3936 V +10 C +1750(%)S +1870(vximtool)S +2410(-i)S +2590(<)S +2710(cursor_file)S +3430(&)S +4104 V +10 R +1260(5\))S +1373(Run)S +1570(as)S +1683(a)S +1757(proxy)S +2020(server,)S +2318(displaying)S +2765(to)S +2873(both)S +3081(a)S +3155(local)S +3379(and)S +3553(a)S +3627(remote)S +3934(XImtool,)S +4328(log)S +4486(output)S +4772(to)S +4880(stderr:)S +4344 V +10 I +1750(...start)S +2039(all)S +2175(XImtool)S +2527(servers)S +2845(to)S +2953(be)S +3077(used)S +4464 V +10 C +1750(%)S +1870(vximtool)S +2410(-v)S +2590(-proxy)S +3010(unix:/tmp/.IMT%d)S +4030(inet:5137:pisces)S +4584 V +1750(Connected)S +2350(to)S +2530(server)S +2950(on)S +3130(unix:/tmp/.IMT359)S +4704 V +1750(Connected)S +2350(to)S +2530(server)S +2950(on)S +3130(inet:5137:pisces)S +4824 V +1750(Open)S +2050(to)S +2230(accept)S +2650(input)S +3010(on)S +3190(inet:)S +3550(port)S +3850(5136)S +5112 V +10 R +1260(To)S +1407(display)S +1732(to)S +1846(the)S +2004(proxy)S +2273(server)S +2552(the)S +2710(client)S +2969(should)S +3273(connect)S +3620(to)S +3735(the)S +3894(vximtool)S +4293(on)S +10 I +4430(inet:5136)S +10 R +4813(,)S +4875(the)S +5034(proxy)S +5304(in)S +5419(turn)S +5232 V +1260(will)S +1463(relay)S +1709(data)S +1922(to)S +2047(the)S +2216(servers)S +2545(listed)S +2809(on)S +2956(the)S +3125(command)S +3566(line.)S +3818(Note)S +4059(that)S +4256(in)S +4381(this)S +4572(last)S +4757(example)S +5141(any)S +5331(cursor)S +5352 V +1260(requests)S +1626(from)S +1859(the)S +2020(client)S +2281(connected)S +2724(to)S +2841(the)S +3002(vximtool)S +3403(will)S +3598(be)S +3731(handled)S +4086(by)S +4225(the)S +4386(ximtool)S +4737(connected)S +5180(on)S +5319(a)S +5402(unix)S +5472 V +1260(socket)S +1554(on)S +1693(the)S +1854(local)S +2087(machine)S +2464(\(i.e.)S +2658(the)S +2819(\256rst)S +3014(server)S +3296(argument\).)S +3800(The)S +3994(remote)S +4310(ximtool)S +4661(on)S +4800(the)S +4960(machine)S +5336(pisces)S +5592 V +1260(could)S +1516(simultaneously)S +2156(be)S +2284(used)S +2501(by)S +2635(another)S +2968(client)S +3224(on)S +3358(that)S +3542(machine)S +3914(connected)S +4352(by)S +4486(some)S +4732(other)S +4972(means.)S +5317(In)S +5435(this)S +5712 V +1260(case)S +1476(it)S +1576(will)S +1776(only)S +1998(display)S +2331(images)S +2658(coming)S +3002(from)S +3240(the)S +10 I +3406(vximtool)S +10 R +3794(proxy,)S +4096(but)S +4268(could)S +4534(be)S +4672(used)S +4899(in)S +5021(an)S +5159(interactive)S +5832 V +1260(IRAF)S +1518(session)S +1837(running)S +2178(on)S +2308(pisces)S +2582(to)S +2690(examine)S +3058(the)S +3210(images.)S +6120 V +9 B +900(SEE)S +1112(ALSO)S +6240 V +10 R +1260(ximtool\(1\))S +6360 V +10 I +1260(A)S +1351(Reference)S +1779(Guide)S +2053(for)S +2200(the)S +2352(IRAF)S +2598(Client)S +2873(Display)S +3214(Library)S +3550(\(CDL\))S +6528 V +9 B +900(COPYRIGHT)S +6648 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(4)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier +%%Pages: 4 + \ No newline at end of file diff --git a/vendor/x11iraf/cdl/eps.c b/vendor/x11iraf/cdl/eps.c new file mode 100644 index 00000000..19c79230 --- /dev/null +++ b/vendor/x11iraf/cdl/eps.c @@ -0,0 +1,2187 @@ +#include +#include +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + +#ifdef __STDC__ +#include +#include +#endif + +#ifdef SOLARIS +#include +#endif + +#ifdef SVR4 +#include +#include +#endif + + +/* + * EPS.C -- EPS hardcopy routines. This code takes an input structure + * containing the pixels, colormap, and output specifications and creates + * and Encapsulated PostScript file. + * + * #include "eps.h" # flags, macro defs, etc. + * + * psim = eps_init () + * eps_print (psim, fp, &data, xdim, ydim, depth, pad) + * eps_close (psim) + * + * eps_setPage (psim, orient, paper_size, scale, flags) + * eps_setCmap (psim, &r, &g, &b, ncolors) + * eps_setCompress (psim, ctype) + * eps_setColorType (psim, otype) + * eps_setLabel (psim, &label) + * eps_setTransform (psim, z1, z2, ztype, offset, slope, cmap_name) + * eps_setCorners (psim, llx, lly, urx, ury) + * + * eps_getImageSize (psim, xdim, ydim, &width, &height) + * eps_getImagePos (psim, xdim, ydim, &llx, &llx) + * + * # Read-only Macro functions: Result type + * ---------------------------- ----------- + * Orientation (psim) EPS_PORTRAIT | EPS_LANDSCAPE + * Scale (psim) float scale value + * MaxScale (psim) float maxaspect scale value + * DoAutoScale (psim) bool + * DoAutoRotate (psim) bool + * DoMaxAspect (psim) bool + * PageType (psim) EPS_LETTER | EPS_LEGAL | ... + * PageXdim (psim) page pixel width + * PageYdim (psim) page pixel height + * PageWidth (psim) page size in inches + * PageHeight (psim) page size in inches + * + * The first three routines are all that's required to output an array of + * pixels to an open file descriptor. The default output produced is a + * grayscale EPS file, centered in a portrait orientation (unless a rotation + * is required to make it fit on the page) and auto scaled to fit on a normal + * 8.5"x11" page. + * + * The remaining routines can be used to set various options, new colormaps + * labels, etc. They are not required unless you need to override one or + * more of the output defaults. + */ + +#define MAX_LENLABEL 256 +#define SZ_EPSBUF 8193 + +#undef min +#undef max + +static char *hextab = "0123456789abcdef"; +static int pixnum = 0, lpix = 0; +static uchar *pixbuf; + + +#define PageXdim(ps) ( PageInfo[ps->page.page_type].npixx ) +#define PageYdim(ps) ( PageInfo[ps->page.page_type].npixy ) +#define PageWidth(ps) ( PageInfo[ps->page.page_type].sizex ) +#define PageHeight(ps) ( PageInfo[ps->page.page_type].sizey ) + +typedef struct { + float sizex, sizey; /* page size in inches */ + int npixx, npixy; /* pix resolution at 72 dpi */ +} PSPageInfo; + +static PSPageInfo PageInfo[] = { /* assumes 300 dpi */ + { 8.500, 11.000, /* US NORMAL, aka LETTER */ + 612, 762 + }, + { 8.500, 14.000, /* US LEGAL */ + 612, 1008 + }, + { 8.267, 11.811, /* A4 */ + 595, 850 + }, + { 7.283, 10.630, /* B5 */ + 524, 765 + }, + {11.000, 17.000, /* B-size */ + 762, 1224 + }, + { 3.875, 4.875, /* 4 by 5 */ + 279, 351 + }, + { 0.945, 1.417, /* 35mm (24x36) */ + 68, 102 + } +}; + + + +#ifdef ANSI_FUNC + +static void eps_pageParams(PSImagePtr psim, float *llx, float *lly, int *icols, int *irows, int *scols, int *srows, int *turnflag); +static void eps_writePix(FILE *fp, uchar *pix, PSCmap *cmap, int npix, int xdim, int pad); +static void eps_writeMono(FILE *fp, uchar *pix, PSCmap *cmap, int npix, int xdim, int pad); +static void eps_writeMonoRGB(FILE *fp, uchar *pix, int npix, int xdim, int depth, int pad); +static void eps_writeRGB(FILE *fp, uchar *pix, PSCmap *cmap, int npix, int xdim, int depth, int pad); +static void eps_writeCmap(PSCmap *cmap, FILE *fp); +static void eps_simpleHeader(PSImagePtr psim, FILE *fp); +static void eps_annotate(PSImagePtr psim, FILE *fp); +static void eps_portLabels(FILE *fp, PSImagePtr psim, int scols, int srows, int icols, int irows, float llx, float lly); +static void eps_landLabels(FILE *fp, PSImagePtr psim, int scols, int srows, int icols, int irows, float llx, float lly); +static void eps_doColorbar(FILE *fp, PSImagePtr psim, int scols, int srows, float llx, float lly, int turnflag); +static void eps_colorHeader(PSImagePtr psim, FILE *fp); +static void eps_writeTrailer(FILE *fp); +static void eps_simpleTrailer(FILE *fp); +static void eps_flushPix(FILE *fp); +static float ticstep(float range, int nsteps); +static char *make_label(void); + +#else + +static void eps_simpleHeader(), eps_colorHeader(); +static void eps_pageParams(), eps_simpleTrailer(); +static void eps_writeCmap(), eps_writeTrailer(); +static void eps_writeMono(), eps_writePix(); +static void eps_writeMonoRGB(), eps_writeRGB(); +static void eps_putPix(), eps_flushPix(); +static void eps_annotate(), eps_portLabels(), eps_landLabels(); +static void eps_doColorbar(); +static float ticstep(); +static char *make_label(); + +#endif + + +static int debug = 0; + + +/* EPS_INIT -- Allocate and return an initialized pointer to a structure + * containing the default output setup. + */ +#ifdef ANSI_FUNC + +PSImage * +eps_init (void) +#else + +PSImage * +eps_init() +#endif +{ + register int i; + register PSImage *ps; + + /* Allocate the structure. */ + ps = (PSImage *) calloc ((unsigned)1, sizeof (PSImage)); + + /* Initialize the structure. */ + ps->cols = 0; + ps->rows = 0; + ps->colorClass = EPS_GRAYSCALE; + ps->compression = NoCompression; + ps->annotate = 1; + ps->label = (char *) calloc (MAX_LENLABEL, sizeof (uchar)); + ps->z1 = 0.0; + ps->z2 = 255.0; + ps->ztype = 0; + + /* Set up a default grayscale colormap. */ + ps->cmap.ncolors = 256; + for (i=0; icmap.ncolors; i++) + ps->cmap.r[i] = ps->cmap.g[i] = ps->cmap.b[i] = i; + ps->cmap.IsDefault = 1; + + /* Load the page information defaults. */ + eps_setPage (ps, EPS_PORTRAIT, EPS_LETTER, 100, EPS_AUTOSCALE); + + /* Initialize the pixel buffer array */ + pixbuf = (uchar *) calloc (SZ_EPSBUF, sizeof (uchar)); + + return (ps); +} + + +/* EPS_PRINT -- Dump the given array of pixels to the output file as an EPS + * format file. The data array may contain 8-bit, 24-bit RGB triplets, or + * 32-bit RGBA pixels. + */ +#ifdef ANSI_FUNC + +void +eps_print ( + PSImage *psim, /* EPS image structure */ + FILE *fp, /* output file descriptor */ + uchar *data, /* array of image pixels */ + int xdim, + int ydim, /* image dimensions */ + int depth, /* bits / pixel, must be 8,24, or 32 */ + int pad /* bytes per line of padding */ +) +#else + +void +eps_print (psim, fp, data, xdim, ydim, depth, pad) +PSImage *psim; /* EPS image structure */ +FILE *fp; /* output file descriptor */ +uchar *data; /* array of image pixels */ +int xdim, ydim; /* image dimensions */ +int depth; /* bits / pixel, must be 8,24, or 32 */ +int pad; /* bytes per line of padding */ +#endif +{ + int npix = xdim * ydim; + uchar *pix = data; + + psim->cols = xdim; /* save it for the headers */ + psim->rows = ydim; + + if (debug) + fprintf (stderr, "eps_print: w=%d h=%d d=%d pad=%d\n", + xdim, ydim, depth, pad); + + switch (psim->colorClass) { + case EPS_GRAYSCALE: + /* Regardless of the color type desired we'll either write the + * pixels directly or convert from pseudocolor or RGB. For a + * start dump the header. + */ + eps_simpleHeader (psim, fp); + + if (psim->cmap.IsDefault && depth == 8) { + /* We're using the default grayscale colormap with an + * 8-bit image, so just dump the pixels. + */ + if (debug) + fprintf (stderr,"eps_print: straight grayscale.\n"); + eps_writePix (fp, pix, &psim->cmap, npix, xdim, pad); + + } else if (!psim->cmap.IsDefault && depth == 8) { + /* We're using an arbitrary colormap with an 8-bit image, + * so convert to grayscale and write the pixels. + */ + if (debug) + fprintf (stderr,"eps_print: pseudo cnv to grayscale.\n"); + eps_writeMono (fp, pix, &psim->cmap, npix, xdim, pad); + + } else { + /* Convert RGBA to grayscale. */ + if (debug) + fprintf (stderr,"eps_print: RGB cnv to grayscale.\n"); + eps_writeMonoRGB (fp, pix, npix, xdim, depth, pad); + + } + + /* Now that the image is out we restore the graphics context. */ + fprintf (fp, "grestore\n" ); + + /* Write the colorbar. */ + if (psim->annotate) + eps_annotate (psim, fp); + + /* Write the trailer. */ + eps_simpleTrailer (fp); + break; + + case EPS_PSEUDOCOLOR: + /* Write the color prolog header. */ + eps_colorHeader (psim, fp); + + /* Dump the colormap. */ + eps_writeCmap (&psim->cmap, fp); + + /* Write color indices. */ + eps_writePix (fp, pix, &psim->cmap, npix, xdim, pad); + + /* Write the colorbar. */ + if (psim->annotate) + eps_annotate (psim, fp); + + /* Write the trailer to finish it off. */ + eps_writeTrailer (fp); + break; + + case EPS_TRUECOLOR: + /* Write the seudocolor prolog header. */ + eps_colorHeader (psim, fp); + + eps_writeRGB (fp, pix, &psim->cmap, npix, xdim, depth, pad); + + /* Write the colorbar. */ + if (psim->annotate) + eps_annotate (psim, fp); + + /* Write the trailer to finish it off. */ + eps_writeTrailer (fp); + break; + + default: + perror ("Bad colorClass specification.\n"); + break; + } + + fflush (fp); +} + + +/* EPS_CLOSE -- Close down the EPS output structure. + */ +#ifdef ANSI_FUNC + +void +eps_close ( + PSImage *psim /* EPS image structure */ +) +#else + +void +eps_close (psim) +PSImage *psim; /* EPS image structure */ +#endif +{ + if (psim->label) + (void) free ((char *) psim->label); + (void) free ((char *) pixbuf); + (void) free (psim); +} + + +/* EPS_SETPAGE -- Inialize the page setup with a different size, orientation, + * or scale options. + */ +#ifdef ANSI_FUNC + +void +eps_setPage ( + PSImage *psim, /* EPS image structure */ + int orientation, /* page orientation flag */ + int paper_size, /* paper size flag */ + int scale, /* image scale percentage */ + int flags /* option flags */ +) +#else + +void +eps_setPage (psim, orientation, paper_size, scale, flags) +PSImage *psim; /* EPS image structure */ +int orientation; /* page orientation flag */ +int paper_size; /* paper size flag */ +int scale; /* image scale percentage */ +int flags; /* option flags */ +#endif +{ + int NPageTypes = sizeof (PageInfo) / sizeof (PSPageInfo); + + /* Set the orientation of the output */ + if (orientation == EPS_PORTRAIT) + psim->page.orientation = EPS_PORTRAIT; + else if (orientation == EPS_LANDSCAPE) + psim->page.orientation = EPS_LANDSCAPE; + else + perror ("eps_setPage: Invalid orientation."); + + /* Set the output paper size */ + if (paper_size >= 0 && paper_size <= NPageTypes) + psim->page.page_type = paper_size; + else + perror ("eps_setPage: Invalid paper size."); + + /* Set scale and recompute dpi resolution. */ + psim->page.scale = (float) scale / 100.0; + psim->page.maxscale = (float) scale / 100.0; + psim->page.dpi = 72; /* need to recalculate */ + + /* Set the option flags */ + psim->page.flags = flags; + + if (debug) { + fprintf (stderr, + "eps_setPage: orientation:%d size:%d scale:%g\n", + Orientation(psim), PageType(psim), Scale(psim)); + fprintf (stderr,"\tautoscale:%d autorotate:%d maxaspect:%d\n", + DoAutoScale(psim), DoAutoRotate(psim), DoMaxAspect(psim)); + } +} + + +/* EPS_SETCMAP -- Define a given colormap to be used on output. + */ +#ifdef ANSI_FUNC + +void +eps_setCmap ( + PSImage *psim, /* EPS image structure */ + uchar *r, + uchar *g, + uchar *b, /* color components */ + int ncolors /* number of colors in colormap */ +) +#else + +void +eps_setCmap (psim, r, g, b, ncolors) +PSImage *psim; /* EPS image structure */ +uchar *r, *g, *b; /* color components */ +int ncolors; /* number of colors in colormap */ +#endif +{ + register int i = 0; + + /* Load the colormap. */ + psim->cmap.ncolors = ncolors; + /* for (i=0; i < ncolors; i++) { */ + for (i=0; i < 256; i++) { + psim->cmap.r[i] = r[i]; + psim->cmap.g[i] = g[i]; + psim->cmap.b[i] = b[i]; + } + + psim->cmap.IsDefault = 0; +} + + +/* EPS_SETCOMPRESS -- Define the type of output compression to use. + */ +#ifdef ANSI_FUNC + +void +eps_setCompress ( + PSImage *psim, /* EPS image structure */ + int compress /* compression type flag */ +) +#else + +void +eps_setCompress (psim, compress) +PSImage *psim; /* EPS image structure */ +int compress; /* compression type flag */ +#endif +{ + /* Set the compression type to use. */ + switch (compress) { + case NoCompression: + case RLECompression: + psim->compression = compress; + break; + case LZWCompression: + case JPEGCompression: + default: + perror ("eps_setCompress: Invalid compression type."); + } +} + + +/* EPS_SETCOLORTYPE -- Set the type of output image to be written, e.g. even + * though we have an RGB or pseudocolor image we may wish to coerce it to + * a grayscale on output. + */ +#ifdef ANSI_FUNC + +void +eps_setColorType ( + PSImage *psim, /* EPS image structure */ + int color_class /* output color class */ +) +#else + +void +eps_setColorType (psim, color_class) +PSImage *psim; /* EPS image structure */ +int color_class; /* output color class */ +#endif +{ + /* Set the compression type to use. */ + switch (color_class) { + case EPS_GRAYSCALE: + case EPS_PSEUDOCOLOR: + case EPS_TRUECOLOR: + psim->colorClass = color_class; + break; + default: + perror ("eps_setColorType: Invalid output color type."); + } +} + + +/* EPS_SETLABEL -- Set the output label to be used in annotation. + */ +#ifdef ANSI_FUNC + +void +eps_setLabel ( + register PSImage *psim, /* EPS image structure */ + char *label /* Label string */ +) +#else + +void +eps_setLabel (psim, label) +register PSImage *psim; /* EPS image structure */ +char *label; /* Label string */ +#endif +{ + register int maxlen = MAX_LENLABEL; + + if (!psim->label) + psim->label = (char *) malloc (maxlen); + + (void) strncpy (psim->label, label, maxlen-1); + psim->label[maxlen-1] = '\0'; +} + + +/* EPS_SETTRANSFORM -- Set the color transformation parameters, i.e. the + * z1/z2 values that map the image pixel values being displayed to the number + * of colors we have available. This is used in the annotation when labeling + * the colorbar. + */ +#ifdef ANSI_FUNC + +void +eps_setTransform ( + PSImage *psim, /* EPS image structure */ + float z1, + float z2, /* zscale values */ + int ztype, /* Transformation type */ + float offset, + float scale, /* brightness/contrast values */ + char *cmap_name /* colormap name */ +) +#else + +void +eps_setTransform (psim, z1, z2, ztype, offset, scale, cmap_name) +PSImage *psim; /* EPS image structure */ +float z1, z2; /* zscale values */ +int ztype; /* Transformation type */ +float offset, scale; /* brightness/contrast values */ +char *cmap_name; /* colormap name */ +#endif +{ + psim->z1 = z1; + psim->z2 = z2; + psim->ztype = ztype; + psim->offset = offset; + psim->scale = scale; + if (!psim->cmap.cmap_name) + psim->cmap.cmap_name = (char *) malloc (16); + strcpy (psim->cmap.cmap_name, cmap_name); + + if (debug) { + fprintf (stderr, + "setTransform: z1=%g z2=%g zt=%d offset=%g scale=%g name='%s'\n", + psim->z1, psim->z2, psim->ztype, + psim->offset, psim->scale, + psim->cmap.cmap_name); + } +} + + +/* EPS_SETCORNERS -- Set the image corner values. + */ +#ifdef ANSI_FUNC + +void +eps_setCorners ( + PSImage *psim, /* EPS image structure */ + int llx, + int lly, + int urx, + int ury /* image corners */ +) +#else + +void +eps_setCorners (psim, llx, lly, urx, ury) +PSImage *psim; /* EPS image structure */ +int llx, lly, urx, ury; /* image corners */ +#endif +{ + psim->llx = llx; + psim->lly = lly; + psim->urx = urx; + psim->ury = ury; +} + + +/* EPS_GETIMAGESIZE -- Given the current page parameters and image dimensions, + * compute the size of the image (in inches) on the page. + */ +#ifdef ANSI_FUNC + +void +eps_getImageSize ( + PSImagePtr psim, /* EPS image struct */ + int xdim, + int ydim, /* image dimensions */ + float *width, + float *height /* width x height of image on page */ +) +#else + +void +eps_getImageSize (psim, xdim, ydim, width, height) +PSImagePtr psim; /* EPS image struct */ +int xdim, ydim; /* image dimensions */ +float *width, *height; /* width x height of image on page */ +#endif +{ + int icols, irows, scols, srows, turnflag; + float llx, lly; + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + *width = (scols / (float) psim->page.dpi); + *height = (srows / (float) psim->page.dpi); +} + + +/* EPS_GETIMAGEPOS -- Given the current page parameters and image dimensions, + * compute the position of the image (in pixels) on the page. + */ +#ifdef ANSI_FUNC + +void +eps_getImagePos ( + PSImagePtr psim, /* EPS image struct */ + int xdim, + int ydim, /* image dimensions */ + int *llx, + int *lly /* LL coords for centered image */ +) +#else + +void +eps_getImagePos (psim, xdim, ydim, llx, lly) +PSImagePtr psim; /* EPS image struct */ +int xdim, ydim; /* image dimensions */ +int *llx, *lly; /* LL coords for centered image */ +#endif +{ + int icols, irows, scols, srows, turnflag; + float lx, ly; + + /* Get the common page parameters. */ + eps_pageParams (psim, &lx, &ly, &icols, &irows, &scols, &srows, + &turnflag); + + *llx = (int) lx; + *lly = (int) ly; +} + + +/************************ + * Private Procedures * + ************************/ + + +/* EPS_PAGEPARAMS -- Compute the EPS page parameters. + */ +#ifdef ANSI_FUNC + +static void +eps_pageParams ( + PSImagePtr psim, /* EPS image struct */ + float *llx, + float *lly, /* LL coords for centered image */ + int *icols, + int *irows, /* final image rows/cols */ + int *scols, + int *srows, /* scaled rows/cols */ + int *turnflag /* turn the image? */ +) +#else + +static void +eps_pageParams (psim, llx, lly, icols, irows, scols, srows, turnflag) +PSImagePtr psim; /* EPS image struct */ +float *llx, *lly; /* LL coords for centered image */ +int *icols, *irows; /* final image rows/cols */ +int *scols, *srows; /* scaled rows/cols */ +int *turnflag; /* turn the image? */ +#endif +{ + int devpix, pwidth, pheight, cols=0, rows=0; + float pixfac, scale = Scale(psim), margin; + + /* See if we need to rotate the image to fit on the page. */ + margin = (psim->annotate ? 0.9 : 0.95); + pwidth = (int) PageXdim(psim) * margin; + pheight = (int) PageYdim(psim) * margin; + *icols = cols = psim->cols; + *irows = rows = psim->rows; + *turnflag = 0; + if (DoAutoRotate(psim)) { + if (psim->cols > psim->rows && (scale * psim->cols) > pwidth) { + if (debug) fprintf (stderr, "Rotating image....\n"); + *turnflag = 1; + cols = *irows; + rows = *icols; + } + } else if (psim->page.orientation == EPS_LANDSCAPE) { + if (debug) fprintf (stderr, "Rotating image....\n"); + *turnflag = 1; + cols = *irows; + rows = *icols; + } + + if (turnflag) { + margin = (turnflag ? 0.825 : margin); + pwidth = (int) PageXdim(psim) * margin; + pheight = (int) PageYdim(psim) * margin; + } + + /* Figure out the image size. */ + devpix = psim->page.dpi / 72.0 + 0.5; /* device pixels per unit */ + pixfac = 72.0 / psim->page.dpi * devpix; + *scols = psim->page.scale * cols * pixfac; + *srows = psim->page.scale * rows * pixfac; + + /* See if we need to fiddle with the size to get it on the page + * the way we want. + */ + if (debug) { + fprintf (stderr, "before: scale=%g scols=%d srows=%d pixfac=%g\n", + scale, *scols, *srows, pixfac); + fprintf (stderr, "\tpwidth=%d pheight=%d\n", pwidth, pheight); + fprintf (stderr,"\tautoscale:%d autorotate:%d maxaspect:%d\n", + DoAutoScale(psim), DoAutoRotate(psim), DoMaxAspect(psim)); + } + if ( *scols > pwidth || *srows > pheight ) { + + /* Image is larger than we think will fit on the page. If we're + * autoscaling reset the scale. + */ + if (DoAutoScale(psim)) { + if (debug) + fprintf (stderr, "Image too big, autoscaling...\n"); + if ( *scols >= pwidth ) { + if (*scols >= *srows) { + scale *= (float)PageXdim(psim) / (float)*scols * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } else { + scale *= (float)PageYdim(psim) / (float)*srows * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } + } + if (debug) + fprintf (stderr, ": scale=%f scols=%d srows=%d pixfac=%g\n", + scale, *scols, *srows, pixfac); + if ( *srows >= pheight ) { + if (*scols >= *srows) { + scale *= (float)PageXdim(psim) / (float)*scols * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } else { + scale *= (float)PageYdim(psim) / (float)*srows * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } + } + if (debug) + fprintf (stderr, ": scale=%f scols=%d srows=%d pixfac=%g\n", + scale, *scols, *srows, pixfac); + psim->page.maxscale = scale; /* update new scale factor */ + + } else { + /* Notify user that the image won't fit and suggest a scale. */ + if ( *scols > pwidth ) + scale *= (float) PageXdim(psim) / (float) *scols * margin; + if ( *srows > pheight ) + scale *= (float) PageYdim(psim) / (float) *srows * margin; + psim->page.maxscale = scale; /* update new scale factor */ + + fprintf (stderr, + "Image too big for the page, no autoscaling set...\n"); + fprintf (stderr, "Reset autoscale flag or use scale < %g\n", + scale); + } + + } + + if (DoMaxAspect(psim)) { + /* Image will fit on page, but blow it up to a maximum size for + * the page orientation but retain the image aspect. + */ + if (debug) + fprintf (stderr, "Doing max aspect..."); + if ( *scols >= *srows ) { + scale *= (float) PageXdim(psim) / (float) *scols * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } else if ( *srows > *scols ) { + scale *= (float) PageYdim(psim) / (float) *srows * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } + psim->page.maxscale = scale; /* update new scale factor */ + } + + /* Center it on the page. */ + *llx = (PageXdim(psim) - *scols) / 2 - (*turnflag ? 10 : 0); + *lly = (PageYdim(psim) - *srows) / 2 + (*turnflag ? 0 : 10); + + if (debug) { + fprintf(stderr,"after: scale=%g scols=%d srows=%d ", + scale, *scols, *srows); + fprintf(stderr,"icols=%d irows=%d llx=%g lly=%g\n", + *icols, *irows, *llx, *lly); + } +} + + +/* EPS_WRITEPIX -- Write the pixels or color indices directly. + */ +#ifdef ANSI_FUNC + +static void +eps_writePix (FILE *fp, uchar *pix, PSCmap *cmap, int npix, int xdim, int pad) +#else + +static void +eps_writePix (fp, pix, cmap, npix, xdim, pad) +FILE *fp; +uchar *pix; +PSCmap *cmap; +int npix; +int xdim; +int pad; +#endif +{ + register int i, min, max; + + min = *pix; + max = *pix; + while (npix > 0) { + min = (min > *pix ? *pix : min); + max = (max < *pix ? *pix : max); + + /* Write the pixels. */ + for (i=0; i < PIX_PER_LINE && npix--; i+=2) { + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1)) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + /* Skip the pad chars. */ + for (i=0; imin = min; + cmap->max = max; + eps_flushPix (fp); +} + + +/* EPS_WRITEMONO -- Write a pseudocolor image and convert to grayscale. + */ +#ifdef ANSI_FUNC + +static void +eps_writeMono (FILE *fp, uchar *pix, PSCmap *cmap, int npix, int xdim, int pad) +#else + +static void +eps_writeMono (fp, pix, cmap, npix, xdim, pad) +FILE *fp; +uchar *pix; +PSCmap *cmap; +int npix; +int xdim; +int pad; +#endif +{ + register int i, min, max; + register uchar pval; + + min = *pix; + max = *pix; + while (npix > 0) { + min = (min > *pix ? *pix : min); + max = (max < *pix ? *pix : max); + + /* Write the pixels. */ + for (i=0; i < PIX_PER_LINE && npix; i+=2, npix-- ) { + pval = (uchar) MONO (cmap->r[*pix], + cmap->g[*pix], + cmap->b[*pix++]); + pixbuf[pixnum++] = (uchar) hextab[(pval >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[(pval & 0x0F)]; + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1) || !npix) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + /* skip the pad chars */ + for (i=0; imin = min; + cmap->max = max; + eps_flushPix (fp); +} + + +/* EPS_WRITEMONORGB -- Write RGB data converted to grayscale. + */ +#ifdef ANSI_FUNC + +static void +eps_writeMonoRGB (FILE *fp, uchar *pix, int npix, int xdim, int depth, int pad) +#else + +static void +eps_writeMonoRGB (fp, pix, npix, xdim, depth, pad) +FILE *fp; +uchar *pix; +int npix; +int xdim; +int depth; +int pad; +#endif +{ + register int i; + register uchar pval; + + while (npix > 0) { + /* Write the pixels. */ + if (depth < 24) { + for (i=0; i < PIX_PER_LINE && npix; i+=2, npix-=3 ) { + pval = (uchar) MONO (*pix++, *pix++, *pix++); + pixbuf[pixnum++] = (uchar) hextab[(pval >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[(pval & 0x0F)]; + } + } else { + /* Skip alpha channel in the loop */ + for (i=0; i < PIX_PER_LINE && npix; i+=2, npix-=3, pix++ ) { + pval = (uchar) MONO (*pix++, *pix++, *pix++); + pixbuf[pixnum++] = (uchar) hextab[(pval >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[(pval & 0x0F)]; + } + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1)) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + /* skip the pad chars */ + for (i=0; i 0) { + min = (min > *pix ? *pix : min); + max = (max < *pix ? *pix : max); + + /* Write the pixels. */ + if (depth < 24) { + for (i=0; i < PIX_PER_LINE && npix; i+=6, npix--, pix++ ) { + val = (uchar) cmap->r[*pix]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val & 0x0F)]; + val = (uchar) cmap->g[*pix]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val & 0x0F)]; + val = (uchar) cmap->b[*pix]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val & 0x0F)]; + } + } else { + /* Skip alpha channel in the loop */ + for (i=0; i < PIX_PER_LINE && npix; i+=6, npix-=3, pix++ ) { + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + } + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1)) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + + /* skip the pad chars */ + for (i=0; imin = min; + cmap->max = max; + eps_flushPix (fp); +} + + +/* EPS_WRITECMAP -- Output Postscript colormap. + */ +#ifdef ANSI_FUNC + +static void +eps_writeCmap (PSCmap *cmap, FILE *fp) +#else + +static void +eps_writeCmap (cmap, fp) +PSCmap *cmap; +FILE *fp; +#endif +{ + register int i, j; + + /* Dump number of colors and colormap used. */ + fprintf (fp, "256\n"); + for (i=0; i < 256; ) { + for (j=0; j < 10 && i < 256; i++, j++) { + fprintf (fp, "%02x%02x%02x", + cmap->r[i], cmap->g[i], cmap->b[i]); + } + fprintf (fp, "\n"); + } +} + + +/* EPS_SIMPLEHEADER -- Output simple Postscript header. + */ +static char *EPSSimpleRLEProlog[]= { + "/rlestr1 1 string def\n", + "/readrlestring { /* s -- nr */\n", + " /rlestr exch def /* - */\n", + " currentfile rlestr1 readhexstring pop /* s1 */\n", + " 0 get /* c */\n", + " dup 127 le { /* c */\n", + " currentfile rlestr 0 /* c f s 0 */\n", + " 4 3 roll /* f s 0 c */\n", + " 1 add getinterval /* f s */\n", + " readhexstring pop /* s */\n", + " length /* nr */\n", + " } { /* c */\n", + " 256 exch sub dup /* n n */\n", + " currentfile rlestr1 readhexstring pop /* n n s1 */\n", + " 0 get /* n n c */\n", + " exch 0 exch 1 exch 1 sub { /* n c 0 1 n-1*/\n", + " rlestr exch 2 index put\n", + " } for /* n c */\n", + " pop /* nr */\n", + " } ifelse /* nr */\n", + "} bind def\n", + "/readstring { /* s -- s */\n", + " dup length 0 { /* s l 0 */\n", + " 3 copy exch /* s l n s n l*/\n", + " 1 index sub /* s l n s n r*/\n", + " getinterval /* s l n ss */\n", + " readrlestring /* s l n nr */\n", + " add /* s l n */\n", + " 2 copy le { exit } if /* s l n */\n", + " } loop /* s l l */\n", + " pop pop /* s */\n", + "} bind def\n", + NULL +}; + +#ifdef ANSI_FUNC + +static void +eps_simpleHeader (PSImagePtr psim, FILE *fp) +#else + +static void +eps_simpleHeader (psim, fp) +PSImagePtr psim; +FILE *fp; +#endif +{ + register char **line; + int icols=0, irows=0, scols=0, srows=0, turnflag=0; + float llx = 0.0, lly = 0.0; + time_t timer; + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + /* Now write header and prolog stuff */ + fprintf (fp, "%%!PS-Adobe-3.0 EPSF-3.0\n" ); + fprintf (fp, "%%%%Title: XImtool Screen Hardcopy\n"); + fprintf (fp, "%%%%Creator: XImtool\n"); + timer = time ((time_t *) NULL); + (void) localtime (&timer); + fprintf (fp, "%%%%CreationDate: %s", ctime(&timer)); + if (psim->annotate) + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - X_ANNOT_MARGIN)), + (int) (MAX (0, lly - Y_ANNOT_MARGIN)), + (int) ( llx + scols + 0.5 + X_ANNOT_MARGIN), + (int) ( lly + srows + 0.5 + Y_ANNOT_MARGIN) ); + else + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - 10)), + (int) (MAX (0, lly - 10)), + (int) ( llx + scols + 0.5 + 10), + (int) ( lly + srows + 0.5 + 10) ); + fprintf (fp, "%%%%Pages: 1\n"); + fprintf (fp, "%%%%EndComments\n" ); + + if ( psim->compression == RLECompression ) { + for (line = EPSSimpleRLEProlog; *line; line++) + fprintf (fp, "%s\n",*line); + } else { + fprintf (fp, "/readstring {\n" ); /* s -- s */ + fprintf (fp, " currentfile exch readhexstring pop\n" ); + fprintf (fp, "} bind def\n" ); + } + + if (psim->colorClass == EPS_TRUECOLOR) { + fprintf (fp, "/rpicstr %d string def\n", icols ); + fprintf (fp, "/gpicstr %d string def\n", icols ); + fprintf (fp, "/bpicstr %d string def\n", icols ); + } else + fprintf (fp, "/picstr %d string def\n", icols ); + fprintf (fp, "%%%%EndProlog\n" ); + fprintf (fp, "%%%%Page: 1 1\n" ); + fprintf (fp, "gsave\n" ); + + fprintf (fp, "%g %g translate\n", llx, lly ); + fprintf (fp, "%d %d scale\n", scols, srows ); + if ( turnflag ) { + if (debug) fprintf (stderr, "turnflag enabled....\n"); + fprintf (fp, "0.5 0.5 translate 90 rotate -0.5 -0.5 translate\n"); + } + fprintf (fp, "%d %d 8\n", icols, irows); + fprintf (fp, "[ %d 0 0 -%d 0 %d ]\n", icols, irows, irows ); + + if (psim->colorClass == EPS_TRUECOLOR) { + fprintf (fp, "{ rpicstr readstring }\n" ); + fprintf (fp, "{ gpicstr readstring }\n" ); + fprintf (fp, "{ bpicstr readstring }\n" ); + fprintf (fp, "true 3\n" ); + fprintf (fp, "colorimage\n" ); + } else { + fprintf (fp, "{ picstr readstring }\n" ); + fprintf (fp, "image\n" ); + } +} + + +/* EPS_ANNOTATE -- Annotate the main image window with axis labels, + * colorbars, and the title string. + */ + +#ifdef ANSI_FUNC + +static void +eps_annotate (PSImagePtr psim, FILE *fp) +#else + +static void +eps_annotate (psim, fp) +PSImagePtr psim; +FILE *fp; +#endif +{ + int icols=0, irows=0, scols=0, srows=0, turnflag=0; + int cbar_size; + float llx = 0.0, lly = 0.0; + + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + /* Write the annotation prolog stufd. */ + fprintf (fp, "gsave\n" ); + + /* Main image title. */ + if (psim->label != NULL) { + fprintf (fp, + "/labelfont /NewCenturySchlbk-Roman findfont 16 scalefont def\n"); + if (turnflag) { + fprintf (fp, "/label { moveto labelfont setfont\n"); + fprintf (fp, " 90 rotate show -90 rotate\n} def\n" ); + fprintf (fp, "(%s) %g %g label\n", psim->label, + llx - TITLE_OFFSET, + lly + (srows/2) - 8.25*(strlen(psim->label)/2) ); + } else { + fprintf (fp, "/label { moveto labelfont setfont show } def\n" ); + fprintf (fp, "(%s) %g %g label\n", psim->label, + llx + (scols/2) - 8.25*(strlen(psim->label)/2), + lly + srows + TITLE_OFFSET); + } + } + + /* A border for the image axes. */ + fprintf (fp, "/imBorder {\n"); + fprintf (fp, " %-4d %-4d moveto %% Outer axis\n", + (int)(llx - AXIS_OOFFSET), + (int)(lly - AXIS_OOFFSET)); + fprintf (fp, " 0 %-4d rlineto\n", srows + (2 * AXIS_OOFFSET)); + fprintf (fp, " %-4d 0 rlineto\n", scols + (2 * AXIS_OOFFSET)); + fprintf (fp, " 0 -%-4d rlineto\n", srows + (2 * AXIS_OOFFSET)); + fprintf (fp, " closepath\n"); + fprintf (fp, " %g setlinewidth\n", AXIS_OWIDTH); + fprintf (fp, " stroke\n"); + + fprintf (fp, " %-4d %-4d moveto %% Inner axis\n", + (int)(llx - AXIS_IOFFSET), + (int)(lly - AXIS_IOFFSET)); + fprintf (fp, " 0 %-4d rlineto\n", srows + (2 * AXIS_IOFFSET)); + fprintf (fp, " %-4d 0 rlineto\n", scols + (2 * AXIS_IOFFSET)); + fprintf (fp, " 0 -%-4d rlineto\n", srows + (2 * AXIS_IOFFSET)); + fprintf (fp, " closepath\n"); + fprintf (fp, " %g setlinewidth\n", AXIS_IWIDTH); + fprintf (fp, " stroke\n"); + + fprintf (fp, "} def\n"); + fprintf (fp, "imBorder\n"); + + /* Axis label font definitions. */ + fprintf (fp, "/axlabelfont /Times-Roman findfont 8 scalefont def\n"); + fprintf (fp, "/axlabel { moveto axlabelfont setfont %s show %s } def\n", + (turnflag ? "90 rotate" : " "), + (turnflag ? "-90 rotate" : " ")); + + /* Axis ticmark procedures. */ + fprintf (fp, "/xMajorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " 0 %d rlineto ", MAJOR_TICK_SIZE); + fprintf (fp, " 0 %d rmoveto ", + srows + MAJOR_TICK_SIZE + (2 * AXIS_IOFFSET) ); + fprintf (fp, " 0 -%d rlineto\n", MAJOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MAJOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + fprintf (fp, "/yMajorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " %d 0 rlineto ", MAJOR_TICK_SIZE); + fprintf (fp, " %d 0 rmoveto ", + scols + MAJOR_TICK_SIZE + (2 * AXIS_IOFFSET) ); + fprintf (fp, " -%d 0 rlineto\n", MAJOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MAJOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + fprintf (fp, "/xMinorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " 0 %d rlineto ", MINOR_TICK_SIZE); + fprintf (fp, " 0 %d rmoveto ", + srows + MAJOR_TICK_SIZE + (2*AXIS_IOFFSET) + + (MAJOR_TICK_SIZE - MINOR_TICK_SIZE) ); + fprintf (fp, " 0 -%d rlineto\n", MINOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MINOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + fprintf (fp, "/yMinorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " %d 0 rlineto ", MINOR_TICK_SIZE); + fprintf (fp, " %d 0 rmoveto ", + scols + MAJOR_TICK_SIZE + (2*AXIS_IOFFSET) + + (MAJOR_TICK_SIZE - MINOR_TICK_SIZE) ); + fprintf (fp, " -%d 0 rlineto\n", MINOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MINOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + + /* The axis labeling. */ + if (turnflag) + eps_landLabels (fp, psim, scols, srows, icols, irows, llx, lly); + else + eps_portLabels (fp, psim, scols, srows, icols, irows, llx, lly); + fprintf (fp, "grestore\n"); + + /* The colorbar. */ + eps_doColorbar (fp, psim, scols, srows, llx, lly, turnflag); + + /* Print the transform information. */ + fprintf (fp, "gsave\n"); + fprintf (fp, "/Times-Roman findfont 8 scalefont setfont\n"); + if (turnflag) { + cbar_size = MIN (512, MAX (256, srows + 2)); + fprintf (fp, "%d %d moveto\n", + (int)llx + scols + 26, + (int)lly + (srows/2) - (cbar_size/2) - (cbar_size==256?5:1)); + } else { + cbar_size = MIN (512, MAX (256, scols + 2)); + fprintf (fp, "%d %d moveto\n", + (int)llx + (scols/2) - (cbar_size/2) - (cbar_size==256?5:1), + (int)(lly-29)); + } + fprintf (fp, "(z1=%.2f z2=%.2f ztrans=%s Con=%.2f Brt=%.2f cmap=%s ncolors=%d) %s show %s\n", + psim->z1, psim->z2, + (psim->ztype==EPS_UNITARY ? "unitary": + (psim->ztype==EPS_LINEAR ? "linear" : "log")), + psim->scale, psim->offset, + psim->cmap.cmap_name, + psim->cmap.max - psim->cmap.min + 1, + (turnflag ? "90 rotate" : " "), + (turnflag ? "-90 rotate" : " ")); + fprintf (fp, "grestore\n"); + + /* Print the timestamp. */ + fprintf (fp, "gsave\n"); + fprintf (fp, "/Times-Roman findfont 6 scalefont setfont\n"); + fprintf (fp, "20 15 moveto\n(%s) show\n", make_label()); + fprintf (fp, "grestore\n"); + + if (debug) { + fprintf (stderr, "colormap: min/max = %d/%d\n", + psim->cmap.min, psim->cmap.max); + fprintf (stderr, "label: '%s'", make_label()); + } +} + + +/* EPS_PORTRAITLABELS -- Write out the labeling procedures for a portrait + * mode image. + */ +#ifdef ANSI_FUNC + +static void +eps_portLabels (FILE *fp, PSImagePtr psim, int scols, int srows, int icols, int irows, float llx, float lly) +#else + +static void +eps_portLabels (fp, psim, scols, srows, icols, irows, llx, lly) +FILE *fp; +PSImagePtr psim; +int scols, srows; +int icols, irows; +float llx, lly; +#endif +{ + int start, end, range, nlabels; + float xpos, xstep, ypos, ystep; + float Mval, xval=0.0, yval=0.0, tic, mtic, Mtic; + + /* X Axis labeling and ticmarks. */ + nlabels = (scols > 256 ? 5 : 3); + fprintf (fp, "/axLabelX {\n"); + if (psim->urx > psim->llx) { + start = psim->llx; + end = psim->urx; + } else { + start = psim->urx; + end = psim->llx; + } + range = end - start + 1; + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + xval = ( (int)(start + mtic) / (int) mtic) * mtic; + xstep = mtic * ((float)scols/(float)(range)); + if (psim->urx > psim->llx) + xpos = llx + ( (float)(xval - start) / (float)range * scols); + else { + xpos = (llx + scols) - ((float)(xval-start) / (float)range * scols); + xstep = -xstep; + } + while (xval <= end) { + if ( xval == Mval ) { + fprintf (fp, " %4d %4d xMajorTicmark\t", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + fprintf (fp, " (%g) %d %d axlabel\n", + xval, + (int)xpos-(xval>=1000?8:(xval>=100?5:2)), + (int)(lly-14)); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d xMinorTicmark\n", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + xval += mtic; + xpos += xstep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelX\n"); + + /* Y Axis labeling and ticmarks. */ + nlabels = (srows > 256 ? 5 : 3); + fprintf (fp, "/axLabelY {\n"); + if (psim->ury > psim->lly) { + start = psim->lly; + end = psim->ury; + } else { + start = psim->ury; + end = psim->lly; + } + range = end - start + 1; + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + yval = ( (int)(start + mtic) / (int) mtic) * mtic; + ystep = mtic * ((float)srows/(float)(range)); + if (psim->ury > psim->lly) + ypos = lly + ( (float)(yval - start) / (float)range * srows); + else { + ypos = (lly + srows) - ((float)(yval-start) / (float)range * srows); + ystep = -ystep; + } + while (yval <= end) { + if ( yval == Mval ) { + fprintf (fp, " %4d %4d yMajorTicmark\t", + (int)(llx-AXIS_OOFFSET), (int)ypos); + fprintf (fp, " (%g) %d %d axlabel\n", + yval, + (int)(llx-(yval>=1000?27:(yval>=100?20:16))), + (int)ypos-2); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d yMinorTicmark\n", + (int)(llx-AXIS_OOFFSET), (int)ypos); + yval += mtic; + ypos += ystep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelY\n"); +} + + +/* EPS_LANDSCAPELABELS -- Write out the labeling procedures for a landscape + * mode image. + */ +#ifdef ANSI_FUNC + +static void +eps_landLabels (FILE *fp, PSImagePtr psim, int scols, int srows, int icols, int irows, float llx, float lly) +#else + +static void +eps_landLabels (fp, psim, scols, srows, icols, irows, llx, lly) +FILE *fp; +PSImagePtr psim; +int scols, srows; +int icols, irows; +float llx, lly; +#endif +{ + float xpos, xstep, ypos, ystep; + int start, end, range, nlabels; + float Mval, xval=0.0, yval=0.0, tic, mtic, Mtic; + + /* X Axis labeling and ticmarks. */ + nlabels = (srows > 256 ? 5 : 3); + fprintf (fp, "/axLabelX {\n"); + if (psim->ury > psim->lly) { + start = psim->lly; + end = psim->ury; + } else { + start = psim->ury; + end = psim->lly; + } + range = end - start + 1; + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + xval = ( (int)(start + mtic) / (int) mtic) * mtic; + xstep = mtic * ((float)scols/(float)(range)); + if (psim->ury > psim->lly) + xpos = (llx + scols) - ((float)(xval-start) / (float)range * scols); + else { + xpos = llx + ((float)(xval-start) / (float)range * scols); + xstep = -xstep; + } + while (xval <= end ) { + if ( xval == Mval ) { + fprintf (fp, " %4d %4d xMajorTicmark\t", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + fprintf (fp, " (%g) %d %d axlabel\n", + xval, + (int)xpos+2, + (int)(lly-(yval>=1000?30:(yval>=100?25:20))) ); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d xMinorTicmark\n", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + xval += mtic; + xpos -= xstep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelX\n"); + + /* Y Axis labeling and ticmarks. */ + nlabels = (srows > 256 ? 5 : 3); + fprintf (fp, "/axLabelY {\n"); + if (psim->urx > psim->llx) { + start = psim->llx; + end = psim->urx; + } else { + start = psim->urx; + end = psim->llx; + } + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + yval = ( (int)(start + mtic) / (int) mtic) * mtic; + ystep = mtic * ((float)scols/(float)(range)); + if (psim->urx > psim->llx) + ypos = lly + ( (float)(yval - start) / (float)range * scols); + else { + ypos = (lly + srows) - ((float)(yval-start) / (float)range * scols); + ystep = -ystep; + } + while (yval <= end) { + if ( yval == Mval ) { + fprintf (fp, " %4d %4d yMajorTicmark\t", + (int)(llx-AXIS_OOFFSET), (int)ypos); + fprintf (fp, " (%g) %d %d axlabel\n", + yval, + (int)(llx+scols+(2*AXIS_OOFFSET)+2), + (int)ypos-(yval>=1000?9:(yval>=100?6:2)) ); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d yMinorTicmark\n", + (int)(llx-AXIS_OOFFSET), (int)ypos); + yval += mtic; + ypos += ystep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelY\n"); +} + + +/* EPS_DOCOLORBAR -- Annotate the image with a colorbar. + */ + +#ifdef ANSI_FUNC + +static void +eps_doColorbar (FILE *fp, PSImagePtr psim, int scols, int srows, float llx, float lly, int turnflag) +#else + +static void +eps_doColorbar (fp, psim, scols, srows, llx, lly, turnflag) +FILE *fp; +PSImagePtr psim; +int scols, srows; +float llx, lly; +int turnflag; +#endif +{ + register int i, j, cbar_size; + int ncolors, nlabels, pos, step, cmel, cmstep, val; + + /* Colorbar label font definitions. */ + fprintf (fp, "/cblabelfont /Times-Roman findfont 10 scalefont def\n"); + fprintf (fp, "/cblabel { moveto cblabelfont setfont %s show %s } def\n", + (turnflag ? "90 rotate" : " "), + (turnflag ? "-90 rotate" : " ")); + + /* A border for the colorbar. */ + fprintf (fp, "/cbarBorder {\n"); + if (turnflag) { + cbar_size = MIN (512, MAX (256, srows + 2)) - 1; + fprintf (fp, " %4d %4d moveto\n", + (int)llx + scols + 31, + (int)lly + (srows/2) - (cbar_size/2) - 1); + fprintf (fp, " 17 0 rlineto\n"); + fprintf (fp, " 0 %4d rlineto\n", cbar_size + 3); + fprintf (fp, " -17 0 rlineto\n"); + } else { + cbar_size = MIN (512, MAX (256, scols + 2)); + fprintf (fp, " %-4d %4d moveto\n", + (int)llx + (scols/2) - (cbar_size/2) - 1, + (int)(lly - 46)); + fprintf (fp, " 0 14 rlineto\n"); + fprintf (fp, " %-4d 0 rlineto\n", cbar_size + 3); + fprintf (fp, " 0 -14 rlineto\n"); + } + fprintf (fp, " closepath\n"); + fprintf (fp, " 1 setlinewidth\n"); + fprintf (fp, " stroke\n"); + fprintf (fp, "} def\n"); + fprintf (fp, "cbarBorder\n"); + + /* Draw the colorbar labels, but only for grayscale images. */ + ncolors = psim->cmap.max - psim->cmap.min + 1; + nlabels = 5; + if (turnflag) + pos = (int)lly + (srows/2) - (cbar_size/2); + else + pos = (int)llx + (scols/2) - (cbar_size/2); + step = cbar_size / nlabels; + cmel = psim->cmap.min; + cmstep = ncolors / nlabels; + for (i=0; i <= nlabels; i++) { + val = MONO(psim->cmap.r[cmel], /* get grayscale value */ + psim->cmap.g[cmel], + psim->cmap.b[cmel]); + if (psim->z1 != 0.0 && psim->z2 != 0.0) { + /* We have a transformation defined, convert the grayscale + * value to original image values. Assumes a linear + * transformation, for a log transformation the wcsbox + * reports only screen units so we'll do that here as well. + */ + if (psim->ztype == EPS_LINEAR) + val = ((psim->z2-psim->z1)/(float)ncolors)*cmel + psim->z1; + } + + if (turnflag) + fprintf (fp, "(%d) %d %d cblabel\n", + val, + (int)llx + scols + 57, + pos-(val<100?3:6)); + else + fprintf (fp, "(%d) %d %d cblabel\n", + val, + pos-(val<100?3:6), + (int)(lly-55)); + cmel += cmstep; + cmel = (cmel < psim->cmap.max ? cmel : psim->cmap.max); + pos += step; + } + + /* Draw the colorbar. */ + if (psim->colorClass == EPS_GRAYSCALE) { + fprintf (fp, "/cbarstr %d string def\n", ncolors); + fprintf (fp, "gsave\n" ); + if (turnflag) { + fprintf (fp, "%d %d translate\n", + (int)(llx + scols + 45), + (int)(lly + (srows/2) - (cbar_size/2)) + 1); + fprintf (fp, + "0.5 0.5 translate 90 rotate -0.5 -0.5 translate\n"); + } else { + fprintf (fp, "%g %g translate\n", + llx + (scols/2) - (cbar_size/2) + 1, + lly - 45 ); + } + fprintf (fp, "%d 12 scale\n", cbar_size); + fprintf (fp, "%d 1 8 [ %d 0 0 1 0 0 ]\n", ncolors, ncolors); + + fprintf (fp, "{ cbarstr readstring }\n" ); + fprintf (fp, "image\n" ); + + } else { + fprintf (fp, "DisplayImage\n" ); + if (turnflag) { + fprintf (fp, "%d %d\n", + (int)(llx + scols + 34), + (int)(lly + (srows/2) - (cbar_size/2))); + fprintf (fp, "12 %d\n", cbar_size); + } else { + fprintf (fp, "%d %d\n", + (int)llx + (scols/2) - (cbar_size/2), + (int)lly - 45 ); + fprintf (fp, "%d 12\n", cbar_size); + } + fprintf (fp, "%d 1\n", ncolors); + fprintf (fp, "%d\n", turnflag); + fprintf (fp, "0\n"); + fprintf (fp, "1\n"); + } + + /* Write out the colormap used. */ + if (psim->colorClass == EPS_GRAYSCALE) { + for (i=psim->cmap.min; i <= psim->cmap.max; i++ ) { + fprintf (fp, "%02x", + MONO(psim->cmap.r[i],psim->cmap.g[i], psim->cmap.b[i])); + if ((i+1) % 32 == 0) + fprintf (fp, "\n"); + } + fprintf (fp, "\n"); + fprintf (fp, "grestore\n"); + } else { + for (j=1, i=psim->cmap.min; i <= psim->cmap.max; i++, j++ ) + fprintf (fp, "%02x%02x%02x\n", + psim->cmap.r[i],psim->cmap.g[i], psim->cmap.b[i]); + if (j % 12 ==0) + fprintf (fp, "\n"); + } +} + + +/* EPS_COLORHEADER - Write the pseudocolor header prolog and compute EPS page + * parameters. + */ +static char *EPSColorProlog[]= + { + "%%BeginProlog", + "%", + "% Display a color image. The image is displayed in color on", + "% Postscript viewers or printers that support color, otherwise", + "% it is displayed as grayscale.", + "%", + "/buffer 512 string def", + "/byte 1 string def", + "/color_packet 3 string def", + "/pixels 768 string def", + "", + "/DirectClassPacket", + "{", + " %", + " % Get a DirectClass packet.", + " %", + " % Parameters: ", + " % red.", + " % green.", + " % blue.", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile color_packet readhexstring pop pop", + " compression 0 gt", + " {", + " /number_pixels 3 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add 3 mul def", + " } ifelse", + " 0 3 number_pixels 1 sub", + " {", + " pixels exch color_packet putinterval", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/DirectClassImage", + "{", + " %", + " % Display a DirectClass image.", + " %", + " systemdict /colorimage known", + " {", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { DirectClassPacket } false 3 colorimage", + " }", + " {", + " %", + " % No colorimage operator; convert to grayscale.", + " %", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { GrayDirectClassPacket } image", + " } ifelse", + "} bind def", + "", + "/GrayDirectClassPacket", + "{", + " %", + " % Get a DirectClass packet; convert to grayscale.", + " %", + " % Parameters: ", + " % red", + " % green", + " % blue", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile color_packet readhexstring pop pop", + " color_packet 0 get 0.299 mul", + " color_packet 1 get 0.587 mul add", + " color_packet 2 get 0.114 mul add", + " cvi", + " /gray_packet exch def", + " compression 0 gt", + " {", + " /number_pixels 1 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add def", + " } ifelse", + " 0 1 number_pixels 1 sub", + " {", + " pixels exch gray_packet put", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/GrayPseudoClassPacket", + "{", + " %", + " % Get a PseudoClass packet; convert to grayscale.", + " %", + " % Parameters: ", + " % index: index into the colormap.", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile byte readhexstring pop 0 get", + " /offset exch 3 mul def", + " /color_packet colormap offset 3 getinterval def", + " color_packet 0 get 0.299 mul", + " color_packet 1 get 0.587 mul add", + " color_packet 2 get 0.114 mul add", + " cvi", + " /gray_packet exch def", + " compression 0 gt", + " {", + " /number_pixels 1 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add def", + " } ifelse", + " 0 1 number_pixels 1 sub", + " {", + " pixels exch gray_packet put", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/PseudoClassPacket", + "{", + " %", + " % Get a PseudoClass packet.", + " %", + " % Parameters: ", + " % index: index into the colormap.", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile byte readhexstring pop 0 get", + " /offset exch 3 mul def", + " /color_packet colormap offset 3 getinterval def", + " compression 0 gt", + " {", + " /number_pixels 3 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add 3 mul def", + " } ifelse", + " 0 3 number_pixels 1 sub", + " {", + " pixels exch color_packet putinterval", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/PseudoClassImage", + "{", + " %", + " % Display a PseudoClass image.", + " %", + " % Parameters: ", + " % colors: number of colors in the colormap.", + " % colormap: red, green, blue color packets.", + " %", + " currentfile buffer readline pop", + " token pop /colors exch def pop", + " /colors colors 3 mul def", + " /colormap colors string def", + " currentfile colormap readhexstring pop pop", + " systemdict /colorimage known", + " {", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { PseudoClassPacket } false 3 colorimage", + " }", + " {", + " %", + " % No colorimage operator; convert to grayscale.", + " %", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { GrayPseudoClassPacket } image", + " } ifelse", + "} bind def", + "", + "/DisplayImage", + "{", + " %", + " % Display a DirectClass or PseudoClass image.", + " %", + " % Parameters: ", + " % x & y translation.", + " % x & y scale.", + " % image columns & rows.", + " % orientation: 0-Portrait or 1-Landscape", + " % class: 0-DirectClass or 1-PseudoClass.", + " % compression: 0-RunlengthEncodedCompression or 1-NoCompression.", + " % hex color packets.", + " %", + " gsave", + " currentfile buffer readline pop", + " token pop /x exch def", + " token pop /y exch def pop", + " x y translate", + " currentfile buffer readline pop", + " token pop /x exch def", + " token pop /y exch def pop", + " x y scale", + " currentfile buffer readline pop", + " token pop /columns exch def", + " token pop /rows exch def pop", + " currentfile buffer readline pop", + " token pop /orient exch def pop", + " orient 0 gt { 0.5 0.5 translate 90 rotate -0.5 -0.5 translate } if", + " currentfile buffer readline pop", + " token pop /class exch def pop", + " currentfile buffer readline pop", + " token pop /compression exch def pop", + " class 0 gt { PseudoClassImage } { DirectClassImage } ifelse", + " grestore", + "} bind def", + "%%EndProlog", + "%%Page: 1 1", + NULL +}; + + +#ifdef ANSI_FUNC + +static void +eps_colorHeader (PSImagePtr psim, FILE *fp) +#else + +static void +eps_colorHeader (psim, fp) +PSImagePtr psim; +FILE *fp; +#endif +{ + register char **line; + int icols=0, irows=0, scols=0, srows=0, turnflag=0; + float llx = 0.0, lly = 0.0; + time_t timer; + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + /* Now write header and prolog stuff */ + fprintf (fp, "%%!PS-Adobe-3.0 EPSF-3.0\n"); + fprintf (fp, "%%%%Title: XImtool Screen Hardcopy\n"); + fprintf (fp, "%%%%Creator: XImtool\n"); + timer = time ((time_t *) NULL); + (void) localtime (&timer); + fprintf (fp, "%%%%CreationDate: %s", ctime(&timer)); + if (psim->annotate) + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - X_ANNOT_MARGIN)), + (int) (MAX (0, lly - Y_ANNOT_MARGIN)), + (int) ( llx + scols + 0.5 + X_ANNOT_MARGIN), + (int) ( lly + srows + 0.5 + Y_ANNOT_MARGIN) ); + else + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - 10)), + (int) (MAX (0, lly - 10)), + (int) ( llx + scols + 0.5 + 10), + (int) ( lly + srows + 0.5 + 10) ); + fprintf (fp, "%%%%Pages: 1\n"); + fprintf (fp, "%%%%EndComments\n"); + + /* Output remaining Postscript prolog commands. */ + for (line = EPSColorProlog; *line; line++) + fprintf (fp, "%s\n",*line); + fprintf (fp, "userdict begin\n"); + fprintf (fp, "%%%%BeginData:\n"); + + fprintf (fp, "DisplayImage\n"); + + /* Now write the image display parameters, specifically + * + * x & y translation. + * x & y scale. + * image columns & rows. + * orientation: 0-Portrait or 1-Landscape + * class: 0-DirectClass or 1-PseudoClass. + * compression: 0-RunlengthEncodedCompression or 1-NoCompression. + * hex color packets. + */ + + fprintf (fp, "%d %d\n%u %u\n%u %u\n%d\n%d\n%d\n", + (int) llx, (int) lly, + (int) scols, (int) srows, + psim->cols, psim->rows, + turnflag, + psim->colorClass == EPS_PSEUDOCOLOR, + psim->compression == NoCompression); +} + + +/* EPS_WRITETRAILER -- Output Postscript trailer blurb. + */ +#ifdef ANSI_FUNC + +static void +eps_writeTrailer (FILE *fp) +#else + +static void +eps_writeTrailer (fp) +FILE *fp; +#endif +{ + fprintf (fp, "\n"); + fprintf (fp, "showpage\n"); + fprintf (fp, "%%%%EndData\n"); + fprintf (fp, "end\n"); + fprintf (fp, "%%%%PageTrailer\n"); + fprintf (fp, "%%%%Trailer\n"); + fprintf (fp, "%%%%EOF\n"); +} + + +/* EPS_SIMPLETRAILER -- Output Postscript trailer blurb. + */ +#ifdef ANSI_FUNC + +static void +eps_simpleTrailer (FILE *fp) +#else + +static void +eps_simpleTrailer (fp) +FILE *fp; +#endif +{ + fprintf (fp, "showpage\n"); +} + + +#ifdef ANSI_FUNC + +static void +eps_flushPix (FILE *fp) +#else + +static void +eps_flushPix (fp) +FILE *fp; +#endif +{ + pixbuf[pixnum] = '\0'; + fprintf (fp, "%s", pixbuf); + pixnum = 0; + lpix = 0; +} + + +/* Utility Routines. + */ + +/* TICSTEP -- calculate nice intervals for the ticmarks. + */ +#ifdef ANSI_FUNC + +static float +ticstep (float range, int nsteps) +#else + +static float +ticstep (range,nsteps) +float range; +int nsteps; +#endif +{ + double df, t2, t5, p1, p2, p3; + float ticstep; + int logtic; + + df = range / (float)(nsteps + 1); + t2 = 0.301029996; + t5 = 0.698970004; + p1 = log10 ((double)(df > 0.0 ? df : -df)); + p2 = (int) p1; + p3 = p1 - p2; + if(p3 < 0.) { + p3 = p2 + 1.; + p2 = p2 - 1.; + } + + if (p3 < 1.0e-10) + ticstep = pow((double)10.0,(double)(p2)); + else if (p3 > 0. && p3 <= t2) + ticstep = pow((double)10.0,(double)(p2+t2)); + else if (p3 > t2 && p3 <= t5) + ticstep = pow((double)10.0,(double)(p2+t5)); + else if (p3 > t5 && p3 <= 1.) + ticstep = pow((double)10.0,(double)(p2+1.)); + else + ticstep = df; + + logtic = (int) log10(ticstep) - 1; + ticstep = (int)( (ticstep / pow((double)10.,(double)logtic)) * + pow((double)10.,(double)logtic) ); + + if (ticstep < 0.1) ticstep = 0.10; + + return (ticstep); +} + + +/* MAKE_LABEL -- Generate the label for the output printer page. + */ +#ifdef ANSI_FUNC + +static char * +make_label (void) +#else + +static char * +make_label() +#endif +{ + struct tm *lt; + static char label_buffer[256]; + char hostname[32], username[32]; + struct passwd *pw; + time_t clock; + +#ifdef SOLARIS + sysinfo (SI_HOSTNAME, hostname, 32); +#else + gethostname (hostname, 32); +#endif + + clock = time(0); + pw = getpwuid (getuid()); + strcpy (username, pw->pw_name); + endpwent(); + + lt = localtime (&clock); + sprintf (label_buffer, "NOAO/IRAF %s@%s %s", + username, hostname, (char *)asctime(lt)); + + return (label_buffer); +} diff --git a/vendor/x11iraf/cdl/eps.h b/vendor/x11iraf/cdl/eps.h new file mode 100644 index 00000000..c65ed4b4 --- /dev/null +++ b/vendor/x11iraf/cdl/eps.h @@ -0,0 +1,109 @@ +/* + * EPS.H -- Include definitions for EPS hardcopy routines. + */ + + +/* Handy macro definitions */ + +#define MONO(rd,gn,bl) ((int)(rd*11 + gn*16 + bl*5) >> 5) /*.33R+ .5G+ .17B*/ +#undef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#undef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + + +#define Orientation(ps) ( ps->page.orientation ) +#define Scale(ps) ( ps->page.scale ) +#define MaxScale(ps) ( ps->page.maxscale ) +#define PageType(ps) ( ps->page.page_type ) +#define DoAutoScale(ps) ( ps->page.flags & EPS_AUTOSCALE ) +#define DoAutoRotate(ps) ( ps->page.flags & EPS_AUTOROTATE ) +#define DoMaxAspect(ps) ( ps->page.flags & EPS_MAXASPECT ) + +#define PIX_PER_LINE 72 + +/* Compression options. */ +#define NoCompression 0 /* Don't compress image */ +#define RLECompression 1 /* RLE compression */ +#define LZWCompression 2 /* LZW compression (not implemted) */ +#define JPEGCompression 3 /* JPEG compression (not implemted) */ + +/* Output color classes. */ +#define EPS_GRAYSCALE 0 /* Write a grayscale image */ +#define EPS_PSEUDOCOLOR 1 /* Write a pseudocolor image */ +#define EPS_TRUECOLOR 2 /* Write a RGB image */ + +/* Page option flags. */ +#define EPS_PORTRAIT 0 /* Page orientations */ +#define EPS_LANDSCAPE 1 +#define EPS_AUTOSCALE 0x01 /* Auto scale to fit on page */ +#define EPS_AUTOROTATE 0x02 /* Auto rotate to fit on page */ +#define EPS_MAXASPECT 0x04 /* Increase scale to max aspect */ + +/* Transformation parameters. */ +#define EPS_UNITARY 0 +#define EPS_LINEAR 1 +#define EPS_LOG 2 + +/* Page layout structure. */ +typedef struct { + int orientation; /* page orioentation */ + float scale; /* image scale factor */ + float maxscale; /* maxaspect image scale factor */ + int dpi; /* dpi resolution */ + int page_type; /* type of paper being used */ + int flags; /* option flags */ +} PSPage, *PSPagePtr; + +/* Colormap structure. */ +typedef struct { + int IsDefault; /* Are we using the default colormap? */ + int ncolors; /* number of colormap colors */ + int min, max; /* image min/max */ + unsigned char r[256]; /* red colormap */ + unsigned char g[256]; /* green colormap */ + unsigned char b[256]; /* blue colormap */ + char *cmap_name; /* colormap name */ +} PSCmap, *PSCmapPtr; + +/* Main EPS structure. */ +typedef struct { + int cols; /* num output columns */ + int rows; /* num output rows */ + int colorClass; /* output color class */ + int compression; /* output compression type */ + int annotate; /* annotate the output image? */ + int llx, lly, urx, ury; /* image coordinate corners */ + float z1, z2; /* zscale transform values */ + int ztype; /* type of transformation */ + float offset, scale; /* brightness/contrast values */ + char *label; /* label string */ + + PSPage page; /* Page layout structure */ + PSCmap cmap; /* Colormap struct */ +} PSImage, *PSImagePtr; + + +/* Page sizes and resolution information. */ +#define EPS_LETTER 0 +#define EPS_LEGAL 1 +#define EPS_A4 2 +#define EPS_B5 3 +#define EPS_BSIZE 4 +#define EPS_4BY5 5 +#define EPS_35MM 6 + +/* Page layout definitions. */ +#define X_ANNOT_MARGIN 30 /* margin in pixels for annotation */ +#define Y_ANNOT_MARGIN 60 /* margin in pixels for annotation */ +#define TITLE_OFFSET 20 /* Offset for title string */ +#define AXIS_OOFFSET 7 /* Outer offset for axis */ +#define AXIS_IOFFSET 2 /* Inner offset for axis */ +#define AXIS_OWIDTH 1.5 /* Outer axis width */ +#define AXIS_IWIDTH 1.0 /* Inner axis width */ +#define MAJOR_TICK_SIZE 5 /* Size of major tic mark */ +#define MAJOR_TICK_WIDTH 1.5 /* Width of major tic mark */ +#define MINOR_TICK_SIZE 3 /* Size of major tic mark */ +#define MINOR_TICK_WIDTH 0.5 /* Width of major tic mark */ +#define NTICMARKS 5 /* Number of major tick marks */ + diff --git a/vendor/x11iraf/cdl/examples/Imakefile b/vendor/x11iraf/cdl/examples/Imakefile new file mode 100644 index 00000000..ef6c3d97 --- /dev/null +++ b/vendor/x11iraf/cdl/examples/Imakefile @@ -0,0 +1,36 @@ +# +# IMakefile for CDL Example tasks. +# + +X11IRAFDIR = ../../ +#include <../../X11IRAF.tmpl> + + + CDEBUGFLAGS = -g + FCFLAGS = -g + CDLDIR = ../ + INCLUDES = -I. -I$(CDLDIR) + LOCAL_LDFLAGS = -L$(CDLDIR) + LIBS = -lcdl + + +AllTarget(animate display mosaic tvmark fdisplay ftvmark) + +NormalFortranObjectRule() + +NormalProgramTarget(animate,animate.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(display,display.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(mosaic,mosaic.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(tvmark,tvmark.o,../libcdl.a,$(LIBS),-lm) + +fdisplay: fdisplay.o ../libcdl.a + f77 -o fdisplay fdisplay.o ../libcdl.a -lm $(LDLIBS) + +ftvmark: ftvmark.o ../libcdl.a + f77 -o ftvmark ftvmark.o ../libcdl.a -lm $(LDLIBS) + +clean:: + $(RM) fdisplay ftvmark + +DependTarget() +LintTarget() diff --git a/vendor/x11iraf/cdl/examples/Imakefile.standalone b/vendor/x11iraf/cdl/examples/Imakefile.standalone new file mode 100644 index 00000000..8886ae9e --- /dev/null +++ b/vendor/x11iraf/cdl/examples/Imakefile.standalone @@ -0,0 +1,54 @@ +# +# IMakefile for CDL Example tasks. +# + + CDEBUGFLAGS = -g + FCFLAGS = -g + CDLDIR = ../ + INCLUDES = -I. -I$(CDLDIR) + LOCAL_LDFLAGS = -L$(CDLDIR) + LIBS = -lcdl + + +# Hack to compile under SunPRO V4 on Solaris +#if defined (SunArchitecture) && OSMajorVersion >= 5 && HasSunC +#if OSMinorVersion <= 5 +#if !defined (i386Architecture) + CCOPTIONS = -Xs +EXTRA_LDOPTIONS = -xildoff +#endif +#else + CCOPTIONS = +EXTRA_LDOPTIONS = -xildoff +#endif + +#else +#if defined (UltrixArchitecture) + CCOPTIONS = -DULTRIX +#endif +#if defined (OSF1Architecture) && OSMajorVersion >= 4 + CCOPTIONS = -DOSF1 +#endif +#endif + + +AllTarget(animate display mosaic tvmark fdisplay ftvmark) + +NormalFortranObjectRule() + +NormalProgramTarget(animate,animate.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(display,display.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(mosaic,mosaic.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(tvmark,tvmark.o,../libcdl.a,$(LIBS),-lm) + +fdisplay: fdisplay.o ../libcdl.a + f77 -o fdisplay fdisplay.o ../libcdl.a -lm $(LDLIBS) + +ftvmark: ftvmark.o ../libcdl.a + f77 -o ftvmark ftvmark.o ../libcdl.a -lm $(LDLIBS) + +clean:: + $(RM) fdisplay ftvmark + +DependTarget() +LintTarget() diff --git a/vendor/x11iraf/cdl/examples/Makefile.generic b/vendor/x11iraf/cdl/examples/Makefile.generic new file mode 100644 index 00000000..fae978aa --- /dev/null +++ b/vendor/x11iraf/cdl/examples/Makefile.generic @@ -0,0 +1,102 @@ +# +# Generic Makefile for CDL Example tasks. +# + + CDEBUGFLAGS = -g + FCFLAGS = -g + RM = rm + CDLDIR = ../ + INCLUDES = -I. -I$(CDLDIR) + LDFLAGS = -L$(CDLDIR) + LIBS = -lcdl + + LDLIBS = + +all:: display mosaic tvmark fdisplay ftvmark + +.c.o: + $(RM) -f $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $*.c + +.f.o: + $(RM) -f $@ + $(FC) -c $(FCFLAGS) $*.f + +display: display.o ../libcdl.a + $(RM) -f $@ + $(CC) -o $@ display.o $(LDFLAGS) $(LDOPTIONS) $(LIBS) $(LDLIBS) -lm + +clean:: + $(RM) -f display + +mosaic: mosaic.o ../libcdl.a + $(RM) -f $@ + $(CC) -o $@ mosaic.o $(LDFLAGS) $(LDOPTIONS) $(LIBS) $(LDLIBS) -lm + +clean:: + $(RM) -f mosaic + +tvmark: tvmark.o ../libcdl.a + $(RM) -f $@ + $(CC) -o $@ tvmark.o $(LDFLAGS) $(LDOPTIONS) $(LIBS) $(LDLIBS) -lm + +clean:: + $(RM) -f tvmark + +fdisplay: fdisplay.o ../libcdl.a + f77 -o fdisplay fdisplay.o ../libcdl.a -lm $(LDLIBS) + +ftvmark: ftvmark.o ../libcdl.a + f77 -o ftvmark ftvmark.o ../libcdl.a -lm $(LDLIBS) + +clean:: + $(RM) -f fdisplay ftvmark + +depend:: + +lint: + $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) +lint1: + $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) + +clean:: + $(RM) -f *.o + +# ------------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +emptyrule:: + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) -f Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +saber: + # load $(ALLDEFINES) $(SRCS) + +osaber: + # load $(ALLDEFINES) $(OBJS) + +# ------------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +# ------------------------------------------------------------------------- +# dependencies generated by makedepend + +# DO NOT DELETE diff --git a/vendor/x11iraf/cdl/examples/README b/vendor/x11iraf/cdl/examples/README new file mode 100644 index 00000000..fb0f58de --- /dev/null +++ b/vendor/x11iraf/cdl/examples/README @@ -0,0 +1,25 @@ +CDL PACKAGE EXAMPLES -- This directory contains several example programs +to demostrate usage of the Client Display library. Programs are available +in both C and Fortran. These are working examples but perhaps not the most +highly efficient code since they're meant to demonstrate how the package +might be used. Tasks available so far include + + DISPLAY.C - C program to display an image. Demonstrates how + to use the high level format display calls, the + midlevel raw pixel display, and the lowest level + raw raster display methods. + TVMARK.C - C program to display and image and overlay with + point marks, optional interactive marking available. + Demonstrates usage of cursor reads and call for + the various marking routines. + MOSAIC.C - C program to mosaic several images on the display. + Demonstrates the use of low-level raster I/O to + do more complex display operations. + + FDISPLAY.F - Fortran equivalent of the DISPLAY task above. + FTVMARK.F - Fortran equivalent of the TVMARK task above. + +Misc Files in This Directory: + + DPIX.FITS - 512x512 test image of M51 + COORDS - sample coordinate file for tvmark task diff --git a/vendor/x11iraf/cdl/examples/animate.c b/vendor/x11iraf/cdl/examples/animate.c new file mode 100644 index 00000000..66f487d9 --- /dev/null +++ b/vendor/x11iraf/cdl/examples/animate.c @@ -0,0 +1,153 @@ +#include +#include +#include +#include "cdl.h" + +/* ANIMATE -- Example task to demonstrate rapid display of rasters such as + * would be done in an animation sequence, or in an acquisition system + * which needs to display guider images repeatedly (the actual inspiration + * for this demo. + * + * Examples: + * Display a scrolling test pattern: + * % animate + * + * Usage: + * animate [-nx N] [-ny N] [-fbconfig N] + * + * Note that your choice of frame buffer is important since if it's + * larger than the image size you're spending a lot of overhead in writing + * blank pixels around the actual image. When writing a true subraster of + * the image/frame buffer, the routine first reads back the pixels in the + * affected rows, edits the pixels in the subraster columns and then writes + * back the entire row. If the subraster width is the same size as the + * frame buffer width it does a straight write which will speed up the dis- + * play since you avoid the readback overhead. It may be worth defining a + * custom frame buffer the size of your image to speed things up. + */ + +#define DIAGONAL 0 /* test pattern flags */ +#define VERTICAL 1 +#define HORIZONTAL 2 + +#define max(a,b) (a > b ? a : b) /* Utility macros */ +#define min(a,b) (a < b ? a : b) + + +CDLPtr cdl; +uchar *pix = NULL; + +main (argc, argv) +int argc; +char *argv[]; +{ + register int i, frame=1; + int nx=256, ny=256, fbconfig=0; + int status=0, fb_w, fb_h, nf, lx, ly; + uchar *line; + + /* Handle command line args. */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strcmp (argv[i], "-nx") == 0) + nx = atoi (argv[++i]); + else if (strcmp (argv[i], "-ny") == 0) + ny = atoi (argv[++i]); + else if (strcmp (argv[i], "-fbconfig") == 0) + fbconfig = atoi (argv[++i]); + } + } + + /* Open the package and a connection to the server. */ + if (!(cdl = cdl_open ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* Make a test pattern. */ + pix = (uchar *) malloc (nx * ny); + makeTestPattern (pix, nx, ny, DIAGONAL); + + /* Now select a frame buffer large enough for the image. The + * fbconfig number is passed in the WCS packet, but the display + * calls below will compute the correct WCS for the image and + * transmit that prior to display, all we're doing here is + * setting up the FB to be used. + */ + if (fbconfig == 0) + cdl_selectFB (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 1); + else + cdl_lookupFBSize (cdl, fbconfig, &fb_w, &fb_h, &nf); + + + /* For the WCS we assume a simple linear transform where the image is + * Y-flipped, the (x,y) translation is computed so it is correct + * for an frame buffer >= than the image size. The Z-transform is + * fixed since we're using a test pattern with known values. + */ + cdl_setWCS (cdl, "test pattern", "", 1., 0., 0., -1., + (float) (nx / 2) - (fb_w / 2) + 1, /* X translation */ + (float) (fb_h / 2) + (ny / 2), /* Y translation */ + 0.0, 200.0, CDL_LINEAR); /* Z transform */ + + + /* Select and clear the initial frame prior to display. */ + cdl_setFrame (cdl, frame); + cdl_clearFrame (cdl); + + /* Now display the pixels. We'll compute the image placement + * ourselves and write the image as a raw subraster of the frame + * buffer in the center of the display. + */ + lx = (fb_w / 2) - (nx / 2); + ly = fb_h - ((fb_h / 2) + (ny / 2)); + status = cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix); + + /* Now animate the image. */ + line = (uchar *) malloc (nx); + while (1) { + /* Shift the image down one line, roll the botton line to the + * top and redisplay the subraster/ + */ + memcpy (pix, line, nx); + memmove (pix+nx, pix, (ny-1)*nx); + memcpy (line, pix+((ny-1)*nx), nx); + + status = cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix); + } + + + cdl_close (cdl); /* close the package */ + free ((unsigned char *) pix); /* free the raster */ + exit (status); +} + + +/* Make a test pattern. */ + +makeTestPattern (raster, nx, ny, pattern) +uchar *raster; +int nx, ny, pattern; +{ + register uchar pix; + register int i, j; + register float scale; + + for (i = 0; i < nx; i++) { + for (j = 0; j < ny; j++) { + switch (pattern) { + case DIAGONAL: /* Diagonal ramp */ + scale = 200. / (float)(ny) / 2.; + pix = (uchar) max(2, (min(200,(scale*i + scale*j)))); + break; + case VERTICAL: /* Vertical ramp */ + scale = 200. / (float)(ny); + pix = (uchar) max(2, (min(200,(scale * i)))); + break; + case HORIZONTAL: /* Horizontal ramp */ + scale = 200. / (float)(nx); + pix = (uchar) max(2, (min(200,(scale * j)))); + break; + } + raster[i * nx + j] = pix; + } + } +} diff --git a/vendor/x11iraf/cdl/examples/coords b/vendor/x11iraf/cdl/examples/coords new file mode 100644 index 00000000..7f6fcdf5 --- /dev/null +++ b/vendor/x11iraf/cdl/examples/coords @@ -0,0 +1,42 @@ + 49 343 + 59 226 + 68 459 + 87 481 + 92 319 + 97 106 +113 143 +126 117 +133 391 +134 109 +134 221 +144 345 +150 83 +179 355 +182 63 +211 328 +218 439 +219 314 +225 129 +241 403 +265 340 +269 355 +288 133 +292 104 +294 178 +320 327 +321 32 +329 409 +338 325 +348 231 +349 188 +364 325 +365 124 +377 368 +381 67 +405 274 +415 187 +442 409 +452 212 +466 62 +472 232 +508 445 diff --git a/vendor/x11iraf/cdl/examples/display.c b/vendor/x11iraf/cdl/examples/display.c new file mode 100644 index 00000000..67b52c97 --- /dev/null +++ b/vendor/x11iraf/cdl/examples/display.c @@ -0,0 +1,257 @@ +#include +#ifdef ULTRIX +#include +#endif +#include +#include +#include "cdl.h" + +/* + * DISPLAY -- Example task to display an image as a command-line task. + * This task is meant to show three ways the CDL can be used to display + * and image, it is functional but perhaps not highly efficient for this + * reason. See the code comments for a description of each method. + * + * Examples: + * To display a simple IRAF or FITS file: + * % ./display -frame 2 image.imh + * % ./display image.fits + * + * To display a FITS file as a raw image: + * % ./display -nx 512 -ny 512 -depth 16 -hskip 5760 -raw dpix.fits + * + * Usage: + * display [-depth N] [-fits] [-frame N] [-fbconfig N] [-hskip N] + * [-iraf] [-nozscale] [-nx N] [-ny N] [-raw] [-zscale] + * [-ns N] [-nl N] [-log] file + */ + +#define NONE -1 +#define IRAF 0 +#define FITS 1 +#define RAW 2 + +#define ABS(x) (x > 0 ? x : -x) + +#ifdef SOLARIS +char *getcwd(); +#else +char *getwd(); +#endif + + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname; + int i, log = 0, status = 0, frame = 1, fbconfig = 0, zscale = 1; + int format = NONE, nx = 0, ny = 0, depth = 8, hskip = 0; + int ns = -1, nl = -1; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + char *path_prefix = (char *) calloc (1025, sizeof(char)); + char *path = (char *) calloc (512, sizeof(char)); + char *node = (char *) calloc (512, sizeof(char)); + + + /* Process the command line options. */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strcmp (argv[i], "-depth") == 0) + depth = atoi (argv[++i]); + else if (strcmp (argv[i], "-fits") == 0) + format = FITS; + else if (strcmp (argv[i], "-frame") == 0) + frame = atoi (argv[++i]); + else if (strcmp (argv[i], "-fbconfig") == 0) + fbconfig = atoi (argv[++i]); + else if (strcmp (argv[i], "-hskip") == 0) + hskip = atoi (argv[++i]); + else if (strcmp (argv[i], "-iraf") == 0) + format = IRAF; + else if (strcmp (argv[i], "-log") == 0) + log++; + else if (strcmp (argv[i], "-nozscale") == 0) + zscale = 0; + else if (strcmp (argv[i], "-ns") == 0) + ns = atoi (argv[++i]); + else if (strcmp (argv[i], "-nl") == 0) + nl = atoi (argv[++i]); + else if (strcmp (argv[i], "-nx") == 0) + nx = atoi (argv[++i]); + else if (strcmp (argv[i], "-ny") == 0) + ny = atoi (argv[++i]); + else if (strcmp (argv[i], "-raw") == 0) + format = RAW; + else if (strcmp (argv[i], "-zscale") == 0) + zscale = 1; + } + } + + /* Open the package and a connection to the server. */ + if (!(cdl = cdl_open ((char *)getenv("IMTDEV"))) ) + exit (-1); + + fname = argv[argc-1]; + + if (ns > 0) cdl_setSample (cdl, ns); + if (nl > 0) cdl_setSampleLines (cdl, nl); + if (log > 0) cdl_setZTrans (cdl, CDL_LOG); + + /* METHOD 1: Displays the image using the high-level format display + * call. Display as an IRAF image if the option was set indicating + * this is the format, otherwise test the file to see if it is anyway. + */ + if (format == IRAF || (format == NONE && cdl_isIRAF (fname))) { + status = cdl_displayIRAF (cdl, fname, 1, frame, + (fbconfig==0 ? FB_AUTO : fbconfig), zscale); + + + /* METHOD 2: Uses the CDL procedure for getting image pixels from + * a known format, minimal work required to display an image. The + * point here is that you can use this mthod to process the image + * yourself prior to display, e.g. subsample the pixels, apply a user + * LUT, etc but still use the CDL to get the raw image and do the + * display. + */ + } else if (format == FITS || (format == NONE && cdl_isFITS (fname))) { + float *bscale, *bzero; + char title[80]; + + /* Get the FITS image pixels, exit w/ an error status if something + * went wrong, the procedure will print what that was. + */ + if (cdl_readFITS (fname, &pix, &nx, &ny, &depth, title)) { + cdl_close (cdl); /* close the package */ + exit (1); /* exit w/ error code */ + } + + /* Now select a frame buffer large enough for the image. The + * fbconfig number is passed in the WCS packet, but the display + * call below will compute the correct WCS for the image and + * transmit that prior to display, all we're doing here is + * setting up the FB to be used. + */ + if (fbconfig == 0) + cdl_selectFB (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 0); + + /* Lastly, display the pixels to the requested frame, do any + * zscaling requested using the CDL procedure. + */ + (void) cdl_setTitle (cdl, title); + (void) cdl_setName (cdl, fname); + if (cdl_displayPix(cdl, pix, nx, ny, depth, frame, fbconfig,zscale)) + status = 1; + + /* Now just free the pixel pointer to clean up. + */ + free ((unsigned char *) pix); + + + /* METHOD 3: Displays an image of raw pixels. The client code is + * responsible for reading the image and calling all the procedures + * needed for image display, initialize the frame, zscaling pix, etc. + * While we assume a simple raster format in this program, the user + * code can read a compressed image format such as GIF, mosaic multiple + * images for display as a single image, or just about anything that + * produces a raster for display. The intent here is to show all the + * lowest level calls needed for displaying the image. + */ + } else if (format == RAW) { + FILE *fd; + int lx, ly; + + if (nx == 0 || ny == 0) { + fprintf (stderr, "No size given for raw data.\n"); + exit (1); + } + + /* Open the image file if we can. */ + if (fd = fopen (fname, "r")) { + + /* Seek to the offset specified. */ + lseek (fileno(fd), (off_t) hskip, SEEK_SET); + + /* Allocate the pixel pointer and read the data. */ + pix = (unsigned char *) malloc (nx * ny * (ABS(depth) / 8)); + fread (pix, ABS(depth)/8, nx * ny, fd); + + /* If we're zscaling and depth is more than 8-bits, do that. */ + if (zscale && ABS(depth) > 8) { + cdl_computeZscale (cdl, pix, nx, ny, depth, &z1, &z2); + cdl_zscaleImage (cdl, &pix, nx, ny, depth, z1, z2); + } + + /* Select and clear the requested frame prior to display. */ + cdl_setFrame (cdl, frame); + cdl_clearFrame (cdl); + + /* Now select a frame buffer large enough for the image. + * We'll ask that this be reset but the change won't go to + * the server until we send in the WCS below. + */ + cdl_selectFB (cdl, nx, ny, &fbconfig, &fb_w, &fb_h, &nf, 1); + + /* Compute the image placement so it's centered in the frame, + * but note the cdl_writeSubRaster() routine can place an + * arbitrary raster anywhere in the frame buffer. + lx = (fb_w / 2) - (nx / 2); + ly = fb_h - ((fb_h / 2) + (ny / 2)); + + /* Set the mapping we'll send with the WCS which must be + * called before the cdl_setWCS() call since the data is sent + * with the WCS and not as a separate call. + */ + + /* First we must compose a node!path prefix for the image */ + gethostname (node, 512); +#ifdef SOLARIS + (void) getcwd (path, 512); +#else + (void) getwd (path); +#endif + if (*fname == '/') + (void) sprintf (path_prefix, "%s!%s", node, fname); + else + (void) sprintf (path_prefix, "%s!%s/%s", node, path, fname); + + cdl_setMapping (cdl, "image", 0., 0., nx, ny, lx, ly, nx, ny, + path_prefix); + + /* For the WCS we assume a simple linear transform where the + * image is Y-flipped, the (x,y) translation is computed so + * it is correct for an frame buffer >= than the image size. + */ + cdl_setWCS (cdl, fname, "", 1., 0., 0., -1., + (float) (nx / 2) - (fb_w / 2) + 1, /* X trans. */ + (float) (fb_h / 2) + (ny / 2), /* Y trans. */ + z1, z2, CDL_LINEAR); /* Z transform */ + + + /* Now display the pixels. + */ + if (cdl_writeSubRaster (cdl, lx, ly, nx, ny, pix)) + status = 1; + + /* Now just free the pixel pointer to clean up. + */ + free ((unsigned char *) pix); + fclose (fd); + + } else + status = 1; + + } else { + if (access (fname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\n", fname); + else + fprintf (stderr, "'%s': image does not exist.\n", fname); + status = 1; + } + + cdl_close (cdl); /* close the package */ + exit (status); +} diff --git a/vendor/x11iraf/cdl/examples/dpix.fits b/vendor/x11iraf/cdl/examples/dpix.fits new file mode 100644 index 00000000..33c19cb3 Binary files /dev/null and b/vendor/x11iraf/cdl/examples/dpix.fits differ diff --git a/vendor/x11iraf/cdl/examples/fdisplay.f b/vendor/x11iraf/cdl/examples/fdisplay.f new file mode 100644 index 00000000..d14633f6 --- /dev/null +++ b/vendor/x11iraf/cdl/examples/fdisplay.f @@ -0,0 +1,65 @@ +C ======================================================================== +C = +C FDISPLAY -- Example fortran program showing the use of the Client = +C Display Library (CDL) Fortran interface for displaying images. In = +C this simple program all input is prompted for on the command line. = +C = +C ======================================================================== + + + program fdisplay + character*132 imname + character*132 imtdev + +C -------------------------- +C Initialize the CDL package +C -------------------------- + call getenv('IMTDEV',imtdev) + call cfopen(imtdev, ier) + if (ier .gt. 0) then + write (*,*) 'open: Error return from CDL' + goto 999 + endif + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C ---------------------------------------------------------- +C If we've got a FITS format image, go ahead and display it. +C ---------------------------------------------------------- + call cfisfits (imname, isfits) + if (isfits .gt. 0) then + call cfdisplayfits (imname, iframe, ifb, 1, ier) + if (ier .gt. 0) then + write (*,*) 'displayFITS: Error return from CDL' + goto 999 + endif + else +C -------------------------------------------------------- +C We've got an IRAF format image, go ahead and display it. +C -------------------------------------------------------- + call cfisiraf (imname, isiraf) + if (isiraf .gt. 0) then + call cfdisplayiraf (imname, 1, iframe, ifb, 1, ier) + if (ier .gt. 0) then + write (*,*) 'displayIRAF: Error return from CDL' + goto 999 + endif + else +C ---------------------------------- +C Unrecognized image, punt and exit. +C ---------------------------------- + write (*,*) 'Unrecognized image format' + endif + endif + +C ------------------ +C Clean up and exit. +C ------------------ +999 continue + call cfclose (ier) + end diff --git a/vendor/x11iraf/cdl/examples/ftvmark.f b/vendor/x11iraf/cdl/examples/ftvmark.f new file mode 100644 index 00000000..a530895d --- /dev/null +++ b/vendor/x11iraf/cdl/examples/ftvmark.f @@ -0,0 +1,301 @@ +C ========================================================================== +C = +C FTVMARK -- Example fortran program showing the use of the Client = +C Display Library (CDL) Fortran interface for doing graphics overlay. In = +C this simple program all input is prompted for on the command line. = +C = +C ========================================================================== + + + program ftvmark + include "../cdlftn.inc" + character*64 imname + character*132 imtdev + +C -------------------------- +C Initialize the CDL package +C -------------------------- + call getenv('IMTDEV',imtdev) + call cfopen(imtdev, ier) + if (ier .gt. 0) then + write (*,*) 'open: Error return from CDL' + goto 999 + endif + + write (*, "('Image Name: ', $)") + read (5, *) imname + write (*, "('Frame Number: ', $)") + read (5, *) iframe + write (*, "('Frame buffer configuration number: ', $)") + read (5, *) ifb + +C ---------------------------------------------------------- +C If we've got a FITS format image, go ahead and display it. +C ---------------------------------------------------------- + call cfisfits (imname, isfits) + if (isfits .gt. 0) then + call cfdisplayfits (imname, iframe, ifb, 1, ier) + if (ier .gt. 0) then + write (*,*) 'displayFITS: Error return from CDL' + goto 999 + endif + else + +C -------------------------------------------------------- +C We've got an IRAF format image, go ahead and display it. +C -------------------------------------------------------- + call cfisiraf (imname, isiraf) + if (isiraf .gt. 0) then + call cfdisplayiraf (imname, 1, iframe, ifb, 1, ier) + if (ier .gt. 0) then + write (*,*) 'displayIRAF: Error return from CDL' + goto 999 + endif + else +C ------------------------------------------------------------- +C No valid image given, so map the current display for marking. +C ------------------------------------------------------------- + call cfmapframe (iframe) + endif + endif + +C --------------------------------------------------------------- +C Now that we've got an image displayed or mapped, enter a cursor +C loop to mark the image. We do this in a subroutine so all the +C parameters needed are together. +C --------------------------------------------------------------- + call markInteractive () + +C ----------------- +C Clean up and exit +C ----------------- +999 continue + call cfclose (ier) + end + + +C ======================================================================= +C = +C MARKINTERACTIVE -- Subroutine for processing the cursor loop. = +C = +C ======================================================================= + + subroutine markInteractive () + include "../cdlftn.inc" + real angle, rx, ry, txsize + integer nx, ny, x, y, x2, y2, fill, size, color + integer number, radius, xrad, yrad, nannuli, sep + character key + character*64 cmd, str + +C ----------------------------------------------------------------- +C Allocate a 1024x1024 array for pixels. This is the largest frame +C buffer we support in this example task +C ----------------------------------------------------------------- + character pix(1048576) + +C -------------------------------- +C Initialize the parameters to use +C -------------------------------- + color = 205 + size = 10 + fill = 0 + angle = 0.0 + txsize = 1.0 + number = 1 + radius = 11 + xrad = 11 + yrad = 6 + nannuli = 3 + sep = 5 + +C ---------------------------------------------- +C Read a cursor keystroke telling us what to do. +C ---------------------------------------------- +10 call cfreadcursor (0, rx, ry, key, ier) + if (ier .gt. 0) then + write (*,*) 'cfreadCursor: Error return from CDL' + goto 998 + endif + +C ---------------------------------------------------------- +C Round the real cursor position to integer pixel positions. +C ---------------------------------------------------------- + x = nint (rx + 0.5) + y = nint (ry + 0.5) + +C -------------------------------------------------------------- +C Check the keystroke and take the appropriate action. Don't go +C looking for an error condition. +C -------------------------------------------------------------- + +C -------------- +C Colon Commands +C -------------- + if (key .eq. ':') then +C ---------------------------------------------- +C Read a three character command and value field +C ---------------------------------------------- + read (*,'(A3, i4)') cmd, ival + +C ------------------------- +C Process the colon command +C ------------------------- + if (cmd(1:3) .eq. 'ang') then + angle = real (ival) + else if (cmd(1:3) .eq. 'col') then + color = ival + else if (cmd(1:3) .eq. 'fil') then + fill = ival + else if (cmd(1:3) .eq. 'num') then + number = ival + else if (cmd(1:3) .eq. 'nan') then + nannuli = ival + else if (cmd(1:3) .eq. 'lab') then + label = ival + else if (cmd(1:3) .eq. 'sep') then + sep = ival + else if (cmd(1:3) .eq. 'siz') then + size = ival + else if (cmd(1:3) .eq. 'txs') then + txsize = ival + else if (cmd(1:3) .eq. 'xra') then + xrad = ival + else if (cmd(1:3) .eq. 'yra') then + yraf = ival + else if (cmd(1:3) .eq. 'pri') then + call cfreadframebuffer (pix, nx, ny, ier) + call cfprintpix ("lpr", pix, nx, ny, 1, ier) + else if (cmd(1:3) .eq. 'sta') then + print 201, angle, color + print 202, fill, number + print 203, nannuli, sep + print 204, size, txsize + print 205, xrad, yrad + print 206, label +201 format ('angle = ',F5.3, t25, 'color = ',I5) +202 format ('fill = ',I5, t25, 'number = ',I5) +203 format ('nannuli = ',I5, t25, 'sep = ',I5) +204 format ('size = ',I5, t25, 'txsize = ',F5.3) +205 format ('xrad = ',I5, t25, 'yrad = ',I5) +206 format ('fill = ',I5) + endif + +C ------------- +C Point Markers +C ------------- + else if (key .eq. 'p') then + call cfmarkpoint (x, y, 1, size, M_PLUS, color, ier) + else if (key .eq. 'x') then + call cfmarkpoint (x, y, 1, size, M_CROSS, color, ier) + else if (key .eq. '.') then + call cfmarkpoint (x, y, 1, size, M_POINT, color, ier) + else if (key .eq. '*') then + call cfmarkpoint (x, y, 1, size, M_STAR, color, ier) + else if (key .eq. '_') then + call cfmarkpoint (x, y, 1, size, M_HBLINE, color, ier) + else if (key .eq. '|') then + call cfmarkpoint (x, y, 1, size, M_VBLINE, color, ier) + else if (key .eq. 'o') then + call cfmarkpoint (x, y, 1, size, ior(M_CIRCLE,fill), + & color, ier) + else if (key .eq. 's') then + call cfmarkpoint (x, y, 1, size, ior(M_BOX,fill), color, + & ier) + else if (key .eq. 'v') then + call cfmarkpoint (x, y, 1, size, ior(M_DIAMOND,fill), + & color, ier) + +C ------------- +C Other Markers +C ------------- + + else if (key .eq. 'b') then + print '("Hit another key to define the box ....")' + call cfreadcursor (0, rx, ry, key, ier) + x2 = nint (rx + 0.5) + y2 = nint (ry + 0.5) + call cfmarkbox (x, y, x2, y2, fill, color, ier) + else if (key .eq. 'c') then + print '("Hit another key to set the radius ....")' + call cfreadcursor (0, rx, ry, key, ier) + x2 = nint (rx + 0.5) + y2 = nint (ry + 0.5) + radius = nint (sqrt (real((x2-x)**2 + (y2-y)**2))) + call cfmarkcircle (x, y, radius, fill, color, ier) + else if (key .eq. 'd') then + call cfdeletemark (x, y, ier) + else if (key .eq. 'e') then + call cfmarkellipse (x, y, xrad, yrad, angle, fill, color, ier) + else if (key .eq. 'l') then + print '("Hit another key to set line endpoint ....")' + call cfreadcursor (0, rx, ry, key, ier) + x2 = nint (rx + 0.5) + y2 = nint (ry + 0.5) + call cfmarkline (x, y, x2, y2, color, ier) + else if (key .eq. 't') then + print '("Test string: ", $)' + read (*,'(A64)') str + call cfmarktext (x, y, str, txsize, angle, color, ier) + else if (key .eq. 'C') then + call cfmarkcircannuli (x, y, radius, nannuli, sep, ier) + else if (key .eq. 'D') then + call cfclearoverlay (ier) + else if (key .eq. 'E') then + call cfmarkellipannuli (x, y, xrad, yrad, angle, nannuli, + & sep, ier) + +C ------------- +C Misc Commands +C ------------- + else if (key .eq. '?') then + call printHelp () + else if (key .eq. 'q') then + goto 998 + endif + +C Loop back until we want to quit + goto 10 + +998 continue + end + + +C ======================================================================= +C = +C PRINTHELP -- Utility subroutine to print a help summary for the task. = +C = +C ======================================================================= + + subroutine printHelp () + print '(" Command Summary")' + print '(" ")' + print '(" :angle - set ellipse or text angle")' + print '(" :color - set marker color")' + print '(" :fill <0|1> - set fill option (zero or one)")' + print '(" :number - set point number")' + print '(" :nannuli - set number of annuli")' + print '(" :label <0|1> - set point label option")' + print '(" :sep - set annuli separation (pixels)")' + print '(" :size - set point marker size")' + print '(" :txsize - set relative text size")' + print '(" :xrad - set ellipse x radius")' + print '(" :yrad - set ellipse y radius")' + print '(" :status - print current settings")' + print '(" :snap - snap frame buffer as EPS to file")' + print '(" :print - print FB to default printer")' + print '(" ")' + print '("Point Markers:")' + print '(" v - diamond mark p - plus mark x - cross mark")' + print '(" . - point mark * - star mark _ - horiz dash")' + print '(" | - vert dash o - circle mark s - square mark")' + print '(" ")' + print '("Misc. Commands")' + print '(" ? - Print Help q - Quit")' + print '(" b - Box c - Circle")' + print '(" d - Delete marker e - Ellipse marker")' + print '(" l - Line t - Text string")' + print '(" C - Circular annuli D - Delete all markers")' + print '(" E - Elliptical annuli")' + print '(" ")' + end diff --git a/vendor/x11iraf/cdl/examples/mosaic.c b/vendor/x11iraf/cdl/examples/mosaic.c new file mode 100644 index 00000000..e31ee264 --- /dev/null +++ b/vendor/x11iraf/cdl/examples/mosaic.c @@ -0,0 +1,219 @@ +#include +#include +#include "cdl.h" + +/* MOSAIC -- Example task to demostrate a possible mosaic display + * application. Image names may optionally be drawn on each tile of + * the mosaic by specifying the -label and -color flags. The -pad flag + * can be used to put a space between images, -sample is used to sub- + * sample an image before display. Assumes all images are the same size. + * + * Examples: + * To display four images with a gap in a 1600x1600 frame buffer + * % mosaic -nx 2 -ny 2 -fbconfig 4 -pad 20 foo[1234].imh + * To display a set of images, subsampling each by 4 pixels + * % mosaic -nx 2 -ny 2 -pad -10 -sample 4 foo[1234].imh + * + * Usage: + * mosaic [-fbconfig N] [-frame N] [-color N] [-label] [-nozscale] + * [-raw -xdim N -ydim N -bitpix N [-hskip N] ] + * [-nx N] [-ny N] [-pad N] [-sample N]image1 image2 ..... + */ + +#define ABS(x) (x > 0 ? x : -x) + + +main (argc, argv) +int argc; +char **argv; +{ + CDLPtr cdl; + char *fname = NULL, title[128]; + int i, j, k, status=0, label=0, frame=1, fb=FB_AUTO, zscale=1; + int sample=1, pad=0, col=204, imx=0, imy=0, nimages, nim; + int ii, xinit, rowx, rowy, nnx, nny, fb_w, fb_h, nf, mx, my; + int raw = 0, bitpix=0, hskip=0; + int nx = 1, ny = 1; + float z1, z2; + unsigned char *pix = NULL; + + + /* Process the command line options. */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp (argv[i], "-fbconfig",3) == 0) + fb = atoi (argv[++i]); + else if (strncmp (argv[i], "-frame",3) == 0) + frame = atoi (argv[++i]); + else if (strncmp (argv[i], "-color",3) == 0) + col = atoi (argv[++i]); + else if (strncmp (argv[i], "-label",4) == 0) + label = 1; + else if (strncmp (argv[i], "-nozscale",4) == 0) + zscale = 0; + else if (strncmp (argv[i], "-nx",3) == 0) + nx = atoi (argv[++i]); + else if (strncmp (argv[i], "-ny",3) == 0) + ny = atoi (argv[++i]); + else if (strncmp (argv[i], "-pad",4) == 0) + pad = atoi (argv[++i]); + else if (strncmp (argv[i], "-raw",4) == 0) + raw++; + else if (strncmp (argv[i], "-xdim",4) == 0) + imx = atoi (argv[++i]); + else if (strncmp (argv[i], "-ydim",4) == 0) + imy = atoi (argv[++i]); + else if (strncmp (argv[i], "-bitpix",4) == 0) + bitpix = atoi (argv[++i]); + else if (strncmp (argv[i], "-hskip",4) == 0) + hskip = atoi (argv[++i]); + else if (strncmp (argv[i], "-sample",4) == 0) { + sample = atoi (argv[++i]); + if (sample % 2) { + fprintf (stderr, "ERROR: Sample size must be even\n"); + exit (-1); + } + } else + break; + } + } else { + printf("Usage:\n\tmosaic "); + printf("[-fbconfig N] [-frame N] [-color N] [-label] [-nozscale]"); + printf("\n\t[-raw -xdim N -ydim N -bitpix N [-hskip N] ]"); + printf("\n\t[-nx N] [-ny N] [-pad N] [-sample N] image1 ....\n"); + exit (1); + } + nimages = argc - i; + + + /* Open the package and a connection to the server. */ + if (!(cdl = cdl_open ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* Clear the frame to begin. */ + (void) cdl_clearFrame (cdl); + + /* Loop over each of the images in the list. */ + nim = 0; + rowx = rowy = 0; + nnx = nny = 0; + for (k=0; k < ny && nim < nimages; k++) { + rowy += nny + pad; + for (rowx = xinit, j=0; j < nx && nim < nimages; j++) { + + /* Get the image name for display. */ + fname = argv[i++]; + + /* Figure out what kind of image it is and get the pixels. */ + if (!raw && cdl_isIRAF (fname)) + status = cdl_readIRAF (fname, 1, &pix, &imx, &imy, &bitpix, + title); + else if (!raw && cdl_isFITS (fname)) + status = cdl_readFITS (fname, &pix, &imx, &imy, &bitpix, + title); + else { + if (raw) { + /* It's a raw data array, be sure we have everyting + * we need in order to read it. + */ + if (imx == 0 || imy == 0 || bitpix == 0) { + fprintf(stderr, "ERROR: Use of '-raw' requires "); + fprintf(stderr, "'-xdim', '-ydim' and '-bitpix'\n"); + status = 1; + } else { + FILE *fd; + + /* Open the image file if we can. */ + if (fd = fopen (fname, "r")) { + + /* Seek to the offset specified. */ + lseek (fileno(fd), (off_t) hskip, SEEK_SET); + + /* Allocate the pixel pointer and read data. */ + pix = (pix ? pix : (uchar *) malloc ( + imx*imy*(ABS(bitpix) / 8)) ); + fread (pix, ABS(bitpix)/8, imx*imy, fd); + fclose (fd); + } else + status = 1; + } + } else { + /* Didn't set the raw flag, and we don't know what + * it is....punt. + */ + if (access (fname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\n", + fname); + else + fprintf (stderr, "'%s': image doesn't exist.\n", fname); + status = 1; + } + } + if (status) goto err_; + + /* Compute subsampled image size. */ + if (sample > 1) + nnx = imx / sample, nny = imy / sample; + else + nnx = imx, nny = imy; + + /* Unless we asked for a specific FB size find one large enough + * to handle the mosaic. We don't check to be sure what's + * returned is really large enough. + */ + if (nim == 0 && fb == FB_AUTO) { + cdl_selectFB (cdl, nx*nnx+(pad*(nx-1)), ny*nny+(pad*(ny-1)), + &fb, &fb_w, &fb_h, &nf, 1); + } else { + cdl_setFBConfig (cdl, fb); + cdl_lookupFBSize (cdl, fb, &fb_w, &fb_h, &nf); + } + + /* Define a WCS for the frame. */ + cdl_setWCS (cdl, "image mosaic", "", 1., 0., 0., -1., 0., + (float) ny*imy+(pad*(ny+1)), 1., 255., 1); + + /* The first time through figure out the placement so the + * entire mosaic is centered in the frame. + */ + if (nim == 0) { + mx = (nx * nnx) + pad * (nx-1); + my = (ny * nny) + pad * (ny-1); + rowy = (fb_h - my) / 2; + xinit = rowx = (fb_w - mx) / 2; + } + + /* Compute the zscaled imaged pixels. */ + if (zscale) { + cdl_computeZscale (cdl, pix, imx ,imy, bitpix, &z1, &z2); + printf ("%s: z1=%g z2=%g\n", fname, z1, z2); + cdl_zscaleImage (cdl, &pix, imx ,imy, bitpix, z1, z2); + } + + /* Subsample the image if requested. */ + if (sample > 1) { + int l, m, n; + + for (l=0, n=0; l < imy; l+=sample) + for (m=0; m < imx; m+=sample) + pix[n++] = pix[(l*imx)+m]; + } + + /* Write the image to the frame buffer. */ + if (cdl_writeSubRaster (cdl, rowx, rowy, nnx, nny, pix)) + goto err_; + + /* Draw the image name as a label. */ + if (label) + cdl_markText (cdl, rowx+10, rowy+10, fname, 1., 0., col); + + nim++; + rowx += nnx + pad; + } + } + + /* Close the package and clean up. */ +err_: cdl_close (cdl); + free ( (char *) pix); + exit (status); +} diff --git a/vendor/x11iraf/cdl/examples/tvmark.c b/vendor/x11iraf/cdl/examples/tvmark.c new file mode 100644 index 00000000..db4413ce --- /dev/null +++ b/vendor/x11iraf/cdl/examples/tvmark.c @@ -0,0 +1,397 @@ +#include +#include +#include +#include +#include "cdl.h" + +/* + * TVMARK -- Example task for displaying an marking images. This program + * can be used to either display an image and overlay points defined in + * a coordinate file, map an existing display frame for marking, or option- + * ally enter a cursor command loop after either of these providing other + * marking capability. All options support minimum match. + * + * Examples: + * % tvmark dpix.fits + * % tvmark -coords coords -color 205 dpix.fits + * % tvmark -frame 2 + * % tvmark -coords coords -interactive dpix.fits + * + * Usage: + * tvmark [-frame N] [-fbconfig N] [-coords ] [-size N] [-color N] + * [-nolabel] [-fill] [-interactive] [image] + */ + + +static void tvmInteractive(), tvmPrintHelp(); + +#define SZ_NAME 128 + + +/* typedef unsigned char uchar; */ /* Defined in 'cdl.h' */ + + +main (argc, argv) +int argc; +char *argv[]; +{ + CDLPtr cdl; + char *fname = NULL, *cfname = NULL; + int i, status = 0, fill = 0, frame = 1, fb = FB_AUTO, zscale = 1; + int color = 201, label = 1, size = 9, interactive = 0; + float z1, z2; + int fb_w, fb_h, nf; + unsigned char *pix = NULL; + + /* Process the command line options. */ + if (argc > 1) { + for (i=1; i < argc; i++) { + if (strncmp (argv[i], "-color",4) == 0) + color = atoi (argv[++i]); + else if (strncmp (argv[i], "-coords",4) == 0) + cfname = argv[++i]; + else if (strncmp (argv[i], "-fbconfig",3) == 0) + fb = atoi (argv[++i]); + else if (strncmp (argv[i], "-fill",4) == 0) + fill = 1; + else if (strncmp (argv[i], "-frame",3) == 0) + frame = atoi (argv[++i]); + else if (strncmp (argv[i], "-interactive",2) == 0) + interactive = 1; + else if (strncmp (argv[i], "-nolabel",4) == 0) + label = 0; + else if (strncmp (argv[i], "-nozscale",4) == 0) + zscale = 0; + else if (strncmp (argv[i], "-size",2) == 0) + size = atoi (argv[++i]); + else + fname = argv[i]; + } + } + + /* Open the package and a connection to the server. */ + if (!(cdl = cdl_open ((char *)getenv("IMTDEV"))) ) + exit (-1); + + /* If an image was specified display it first, otherwise assume the + * image has already been loaded in the frame and mark that. + */ + if (fname) { + if (cdl_isIRAF (fname)) + status = cdl_displayIRAF (cdl, fname, 1, frame, fb, zscale); + else if (cdl_isFITS (fname)) + status = cdl_displayFITS (cdl, fname, frame, fb, zscale); + else { + if (access (cfname, F_OK) == 0) + fprintf (stderr, "'%s': unknown image format.\n", fname); + else + fprintf (stderr, "'%s': image doesn't exist.\n", fname); + status = 1; + } + if (status) goto err_; + } else { + + /* If we've requested a special frame buffer, set it now. */ + if (fb > 0) + cdl_setFBConfig (cdl, fb); + + /* Map the current display frame for use as an image. */ + cdl_mapFrame (cdl, frame); + } + + /* If a coordinate file was specified read the file and mark those + * coords with points. + */ + if (cfname) + (void) cdl_markCoordsFile (cdl, cfname, M_STAR, size, color, label); + + /* Lastly, start up an interactive cursor loop if needed. */ + if (interactive) + tvmInteractive (cdl, label, fill, color, size); + + /* Close the package and clean up. */ +err_: cdl_close (cdl); + exit (status); +} + + +/* TVMINTERACTIVE -- Process commands interactively. */ + +static void +tvmInteractive (cdl, label, fill, color, size) +CDLPtr cdl; +int label, fill, color, size; +{ + float angle = 0.0, rx, ry, txsize = 1.5, off = 0.5; + int nx, ny, i, x, y, x2, y2, font = F_ROMAN, mag = 3; + int number=1, radius=11, xrad=11, yrad=6, nannuli=3, sep=5; + int linewidth = 1, textwidth = 1, linestyle = 0, wcs = 0; + char key, *cp, cmd[SZ_NAME], str[SZ_NAME]; + unsigned char *pix; + + + /* Process commands until a 'q' keystrke is hit. + */ + while (cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key) != 'q') { + x = (int) (rx + off); /* convert to int pixels */ + y = (int) (ry + off); + + switch (key) { + case ':': /* process a colon command */ + putchar (':'); + fgets (str, 64, stdin); + for (i=0; str[i] != ' ' && str[i]; i++) + cmd[i] = str[i]; + cmd[i++] = '\0'; + + if (strcmp (cmd, "angle") == 0) + angle = atof (&str[i]); + else if (strcmp (cmd, "color") == 0) + color = atoi (&str[i]); + else if (strcmp (cmd, "fill") == 0) + fill = atoi (&str[i]); + else if (strcmp (cmd, "font") == 0) { + switch (str[i]) { + case 'r': font = F_ROMAN; break; + case 'g': font = F_GREEK; break; + case 't': font = F_TIMES; break; + case 'f': font = F_FUTURA; break; + } + cdl_setFont (cdl, font); + } else if (strcmp (cmd, "number") == 0) + number = atoi (&str[i]); + else if (strcmp (cmd, "nannuli") == 0) + nannuli = atoi (&str[i]); + else if (strcmp (cmd, "label") == 0) + label = atoi (&str[i]); + else if (strcmp (cmd, "mag") == 0) + mag = atoi (&str[i]); + else if (strcmp (cmd, "sep") == 0) + sep = atoi (&str[i]); + else if (strcmp (cmd, "size") == 0) + size = atoi (&str[i]); + else if (strcmp (cmd, "txsize") == 0) + txsize = atof (&str[i]); + else if (strcmp (cmd, "radius") == 0) + radius = atoi (&str[i]); + else if (strcmp (cmd, "xrad") == 0) + xrad = atoi (&str[i]); + else if (strcmp (cmd, "yrad") == 0) + yrad = atoi (&str[i]); + else if (strcmp (cmd, "linewidth") == 0 || + strcmp (cmd, "width") == 0) { + linewidth = atoi (&str[i]); + cdl_setLineWidth (cdl, linewidth); + } else if (strcmp (cmd, "linestyle") == 0 || + strcmp (cmd, "style") == 0) { + linestyle = atoi (&str[i]); + cdl_setLineStyle (cdl, linestyle); + } else if (strcmp (cmd, "textwidth") == 0) { + textwidth = atoi (&str[i]); + cdl_setTextWidth (cdl, textwidth); + } else if (strcmp (cmd, "print") == 0) { + cdl_readFrameBuffer (cdl, &pix, &nx, &ny); + cdl_printPix (cdl, NULL, pix, nx, ny, 1); + } else if (strcmp (cmd, "snap") == 0) { + cdl_readFrameBuffer (cdl, &pix, &nx, &ny); + cdl_printPixToFile (cdl, &str[i], pix, nx, ny, 1); + } else if (strcmp (cmd, "status") == 0) { + printf ("angle = %-5.3g\tcolor = %d\t",angle, color); + printf ("fill = %-5d\tnumber = %d\n",fill, number); + printf ("nannuli = %-5d\tsep = %d\t",nannuli, sep); + printf ("size = %-5d\ttxsize = %g\n",size, txsize); + printf ("xrad = %-5d\tyrad = %d\t",xrad, yrad); + printf ("label = %-5d\tfont = %d\n",label, font); + printf ("linewidth = %-5d\tmag = %d\n",linewidth, mag); + printf ("textwidth = %-5d\tstyle = %d\n", + textwidth, linestyle); + } + break; + + case '?': + tvmPrintHelp (); + break; + + case 'p': /* plus mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_PLUS, color); + break; + case 'x': /* cross mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_CROSS, color); + break; + case '.': /* point mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_POINT, color); + break; + case '*': /* star mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_STAR, color); + break; + case '_': /* horiz dash mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_HBLINE, color); + break; + case '|': /* vert dash mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_VBLINE, color); + break; + case 'o': /* circle mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_CIRCLE|fill, color); + break; + case 's': /* square mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_BOX|fill, color); + break; + case 'v': /* diamond mark */ + cdl_markPoint (cdl, x, y, (label ? number++ : 0), size, + M_DIAMOND|fill, color); + break; + + case 'b': /* Box */ + printf ("Hit another key to define the box...\n"); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + off); y2 = (int) (ry + off); + cdl_markBox (cdl, x, y, x2, y2, fill, color); + break; + case 'c': /* Circle */ + /* + printf ("Hit another key to set radius ...\n"); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + off); y2 = (int) (ry + off); + radius = (int) sqrt ((double) ((x2-x)*(x2-x) + (y2-y)*(y2-y))); + */ + cdl_markCircle (cdl, x, y, radius, fill, color); + break; + case 'd': /* Delete marker */ + cdl_deleteMark (cdl, x, y); + break; + case 'e': /* Ellipse */ + cdl_markEllipse (cdl, x, y, xrad, yrad, angle, fill, color); + break; + case 'l': /* Line */ + printf ("Hit another key to set line endpoint...\n"); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + off); y2 = (int) (ry + off); + cdl_markLine (cdl, x, y, x2, y2, color); + break; + case 't': /* Text string */ + printf ("Text string: "); + fgets (str, 64, stdin); + for (cp = (char *)str; *cp != NULL && (char)*cp != '\n'; cp++) + ; + *cp = '\0'; + cdl_markText (cdl, x, y, str, txsize, angle, color); + break; + case 'C': /* Circular annuli */ + cdl_markCircAnnuli (cdl, x, y, radius, nannuli, sep, color); + break; + case 'D': /* Delete all markers */ + cdl_clearOverlay (cdl); + break; + case 'E': /* Elliptical annuli */ + cdl_markEllipAnnuli (cdl, x, y, xrad, yrad, angle, nannuli, + sep, color); + break; + case 'P': /* Polygon */ + break; + + + case 'z': + /* A more complex example to display a rectangular region + * 'size' pixels wide to an area 'mag' times bigger on each + * side. The first keystroke in the center of the zoomed + * region, the second is the center of the magnified area. + * Corners are connected and boxes drawn around each area. + * An expensive oepration but you can a cute result. + */ + printf ("Hit another key to position zoomed raster...\n"); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + x2 = (int) (rx + off); y2 = (int) (ry + off); + + { register int i, j, ii, jj; + int llx = x - size / 2, lly = y - size / 2, + urx = x + size / 2, ury = y + size / 2; + int zllx = x2 - (mag*size) / 2, zlly = y2 - (mag*size) / 2, + zurx = x2 + (mag*size) / 2, zury = y2 + (mag*size) / 2; + uchar *ras = (uchar *) malloc (size*size); + uchar *zoom = (uchar *) malloc ((mag*size)*(mag*size)); + uchar *rp, *zp, *line; + + /* Read the image pixels and magnify it. */ + cdl_readSubRaster (cdl, llx, lly, size, size, &ras); + rp = ras, zp = zoom; + for (i=0; i < size; i++) { + line = ras + i * size; + for (ii=0; ii < mag; ii++) { + for (j=0; j < size; j++) { + for (jj=0; jj < mag; jj++) + *zp++ = *rp; + rp++; + } + rp = line; + } + } + + /* Draw a box around the zoom area and connect the corners + * to the zoomed subraster. */ + cdl_markBox (cdl, llx, lly, urx, ury, 0, color); + cdl_markLine (cdl, llx, lly, zllx, zlly, color); + cdl_markLine (cdl, llx, ury, zllx, zury, color); + cdl_markLine (cdl, urx, lly, zurx, zlly, color); + cdl_markLine (cdl, urx, ury, zurx, zury, color); + + /* Now draw the magnified raster and put a box around it.*/ + cdl_writeSubRaster (cdl,zllx,zlly,mag*size,mag*size,zoom); + cdl_markBox (cdl, zllx, zlly, zurx, zury, 0, color); + } + + default: + break; + } + } +} + + +/* TVMPRINTHELP -- Print a help summary. */ + +static void +tvmPrintHelp () +{ + printf ("\t\t\tCommand Summary\n"); + printf ("\n"); + printf (" :angle - set ellipse of text rotation angle\n"); + printf (" :color - set marker color\n"); + printf (" :fill <0|1> - set fill option (zero or one)\n"); + printf (" :font - set text font (roman, greek, times)\n"); + printf (" :number - set point number\n"); + printf (" :nannuli - set number of annuli\n"); + printf (" :label <0|1> - set point label option\n"); + printf (" :linewidth - set line width\n"); + printf (" :linestyle - set line style\n"); + printf (" :textwidth - set text width\n"); + printf (" :mag - set magnify value for 'z' keystroke\n"); + printf (" :sep - set annuli separation (pixels)\n"); + printf (" :size - set point marker size\n"); + printf (" :txsize - set relative text size\n"); + printf (" :xrad - set ellipse x radius\n"); + printf (" :yrad - set ellipse y radius\n"); + printf (" :status - print current settings\n"); + printf (" :snap - snap frame buffer as EPS to file\n"); + printf (" :print - print frame buffer to default printer\n"); + printf ("\n"); + printf ("Point Markers:\n"); + printf (" v - diamond mark \tp - plus mark \t\tx - cross mark\n"); + printf (" . - point mark \t* - star mark \t\t_ - horiz dash mark\n"); + printf (" | - vert dash mark o - circle mark \ts - square mark\n"); + printf ("\n"); + printf ("Misc. Commands\n"); + printf (" ? - Print Help \tq - Quit\n"); + printf (" b - Box\t\tc - Circle\n"); + printf (" d - Delete marker\te - Ellipse marker\n"); + printf (" l - Line\t\tt - Text string\n"); + printf (" C - Circular annuli D - Delete all markers\n"); + printf (" E - Elliptical annuli\n"); + printf (" z - zoom in on region\n"); +} diff --git a/vendor/x11iraf/cdl/imd.c b/vendor/x11iraf/cdl/imd.c new file mode 100644 index 00000000..e1630ac3 --- /dev/null +++ b/vendor/x11iraf/cdl/imd.c @@ -0,0 +1,2095 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + + +/* + * IMAGE DISPLAY -- The image display interface is responsible for actually + * displaying an image to the server, for reading back a raster from the + * server, and cursor positioning. This is a mid-level interface for + * handling the steps necessary for image display operations without dealing + * directly with the details of communicating with the server. + * + * imd = imd_open (imtdev) + * imd_displayImage (imd, pix, nx, ny, frame, fbconfig, comp_wcs) + * imd_readCursor (imd, sample, &x, &y, &wcs, &key) + * imd_[set|get]WCS (imd, name, title, a, b, c, d, tx, ty, z1, z2, zt) + * imd_[set|get]Mapping (imd, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) + * imd_close (imd) + * + * Low Level Procedures + * -------------------- + * imd_writeImage (imd, pix, nx, ny, lx, ly) + * imd_readImage (imd, &pix, &nx, &ny) + * imd_readFrameBuffer (imd, &pix, &nx, &ny) + * imd_setFrame (imd, frame) + * imd_setFBConfig (imd, configno) + * imd_getFBConfig (imd, &configno, &width, &height, &nframes)) + * imd_setName (imd, name) + * imd_setTitle (imd, title) + * imd_setCursor (imd, x, y, wcs) + * imd_clearFrame (imd) + * imd_writeSubRaster (imd, lx, ly, nx, ny, pix) + * imd_readSubRaster (imd, lx, ly, nx, ny, &pix) + * + * We leave it to the higher level procedures to handle Z-scale trans- + * formations, spatial scaling, and high level image I/O. All display pixels + * are assumed to be scaled to 8-bits already. + */ + +/* Function prototypes */ +#ifdef __STDC__ +#include +#include +#endif + +#define SZ_BLOCK 16384 + +/* Types of coordinate and greyscale transformations. */ +#define W_UNITARY 0 /* values map without change */ +#define W_LINEAR 1 /* linear mapping */ +#define W_LOG 2 /* logarithmic mapping */ +#define W_USER 3 /* user transformation */ + +/* Connection types. */ +#define UNIX 10 +#define INET 11 +#define FIFO 12 + +/* Default Values. */ +#define DEF_FBCONFIG 1 /* default frame buffer config */ +#define DEF_OSDEV_1 "unix:/tmp/.IMT%d" +#define DEF_OSDEV_2 "fifo:/dev/imt1i:/dev/imt1o" + +/* Frame buffer configuration file definitions. */ +#define FBCONFIG_1 ".imtoolrc" +#define FBCONFIG_2 "/usr/local/lib/imtoolrc" +#define FBCONFIG_ENV1 "imtoolrc" +#define FBCONFIG_ENV2 "IMTOOLRC" +#define DEF_FRAME_WIDTH 512 +#define DEF_FRAME_HEIGHT 512 + + +int imd_debug = 0; /* deug flag */ +char buf[SZ_LINE]; /* temp buffer */ + + +#ifdef ANSI_FUNC + +static int imd_writeLine(IMDPtr imd, uchar *pix, int nbytes, int x, int y); +static int imd_readLine(IMDPtr imd, uchar *pix, int nbytes, int x, int y); +static int imd_writeRawBuf(IMDPtr imd, uchar *pix, int nbytes, int x, int y, int nx, int ny); +static int imd_readRawBuf(IMDPtr imd, uchar *pix, int nbytes, int x, int y, int nx, int ny); +static IMDPtr imd_initialize(int fdin, int fdout, int domain); +static int imd_parseImtdev(char *imtdev, char *unixaddr, unsigned short *host_port, unsigned long *host_addr, char *ififo, char *ofifo); +static int imd_loadImtoolrc(IMDPtr imd); +static int imd_getstr(char **ipp, char *obuf, int maxch); +static void imd_minmax(uchar *pix, int nbytes, int *pmin, int *pmax); +static int imd_wcsVersion (IMDPtr imd); + +#else + +static IMDPtr imd_initialize(); +static int imd_writeLine(), imd_readLine(); +static int imd_writeRawBuf(), imd_readRawBuf(); +static int imd_parseImtdev(), imd_loadImtoolrc(), imd_getstr(); +static int imd_writeLine(), imd_readLine(), imd_wcsVersion(); +static void imd_minmax(); + +#endif + +#ifndef __STDC__ + char *getenv(); +#endif + + + +/* IMD_OPEN -- Open a connection to the display server. The caller may + * either specify a connection at device open time, or the procedure will + * attempt to first connect on a unix socket or fifo pipe if that fails. + * The syntax for the imtdev argument is as follows: + * + * :
+ * + * where is one of "inet" (internet tcp/ip socket), "unix" (unix + * domain socket) or "fifo" (named pipe). The form of the address depends + * upon the domain, as illustrated in the examples below. + * + * inet:5137 Server connection to port 5137 on the local + * host. For a client, a connection to the + * given port on the local host. + * + * inet:5137:foo.bar.edu Client connection to port 5137 on internet + * host foo.bar.edu. The dotted form of address + * may also be used. + * + * unix:/tmp/.IMT212 Unix domain socket with the given pathname + * IPC method, local host only. + * + * fifo:/dev/imt1i:/dev/imt1o FIFO or named pipe with the given pathname. + * IPC method, local host only. Two pathnames + * are required, one for input and one for + * output, since FIFOs are not bidirectional. + * For a client the first fifo listed will be + * the client's input fifo; for a server the + * first fifo will be the server's output fifo. + * This allows the same address to be used for + * both the client and the server, as for the + * other domains. + * + * The address field may contain up to two "%d" fields. If present, the + * user's UID will be substituted (e.g. "unix:/tmp/.IMT%d"). The default + * connection if no imtdev is specified is "unix:/tmp/.IMT%d", failing that, + * a connection is attempted on the /dev/imt1[io] named fifo pipes. + */ + +#ifdef ANSI_FUNC + +IMDPtr +imd_open ( + char *imtdev /* connection type */ +) +#else + +IMDPtr +imd_open (imtdev) +char *imtdev; /* connection type */ +#endif +{ + IMDPtr imd; + int domain, fd, fdin, fdout, free_imtdev=0, model; + unsigned short host_port; + unsigned long host_addr; + char unixaddr[SZ_NAME]; + char input_fifo[SZ_NAME], output_fifo[SZ_NAME]; + + + if (imtdev == NULL) { + struct sockaddr_un sockaddr; + + /* Try first to connect on a unix socket. */ + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { + imtdev = DEF_OSDEV_2; + if (imd_debug) + printf ("Can't get unix socket...\n"); + goto retry; + } + + /* Compose network address. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + sprintf (sockaddr.sun_path, "/tmp/.IMT%d", (int)getuid()); + + if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))<0){ + close (fd); + imtdev = DEF_OSDEV_2; + if (imd_debug) + printf ("Can't connect to socket '%s'\n",sockaddr.sun_path); + goto retry; /* no connection */ + } else { + imtdev = (char *) calloc (SZ_IMTDEV, sizeof(char)); + free_imtdev++; + strcpy (imtdev, sockaddr.sun_path); + fdin = fdout = fd; + } + model = DEF_MODEL; + + } else { +retry: domain = imd_parseImtdev (imtdev, unixaddr, &host_port, &host_addr, + input_fifo, output_fifo, &model); + + switch (domain) { + case FIFO: + /* Open the fifos. */ + if ((fdin = open (input_fifo, O_RDONLY|O_NDELAY)) != ERR) + fcntl (fdin, F_SETFL, O_RDONLY); + if ((fdout = open (output_fifo, O_WRONLY|O_NDELAY)) != ERR) + fcntl (fdout, F_SETFL, O_WRONLY); + + /* Clean up if there is an error. */ + if (fdin < 0 || fdout < 0) { + (void) close (fdin); + (void) close (fdout); + if (imd_debug) + printf ("Can't connect to fifo '%s'\n",input_fifo); + goto err; + } + break; + + case UNIX: + { struct sockaddr_un sockaddr; + + /* Try first to connect on a unix socket. */ + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { + if (imd_debug) + printf ("Can't get unix socket...\n"); + goto err; + } + + /* Compose network address. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strcpy (sockaddr.sun_path, unixaddr); + + if (connect(fd, (struct sockaddr *)&sockaddr, + sizeof(sockaddr))<0){ + close (fd); + if (imd_debug) + printf ("Can't connect to socket '%s'\n", + sockaddr.sun_path); + goto err; /* no connection */ + } else + fdin = fdout = fd; + } + break; + + case INET: + { struct sockaddr_in sockaddr; + + /* Get socket. */ + if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { + if (imd_debug) + printf ("Can't get inet socket...\n"); + goto err; + } + + /* Compose network address. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = host_port; + bcopy ((char *)&host_addr, (char *)&sockaddr.sin_addr, + sizeof(host_addr)); + + /* Connect to server. */ + if (connect (fd, (struct sockaddr *)&sockaddr, + sizeof(sockaddr)) < 0) { + close (fd); + if (imd_debug) + printf ("Can't connect to socket '%s'\n", + (char *)sockaddr.sin_addr.s_addr); + goto err; + } else + fdin = fdout = fd; + } + break; + + default: + goto err; + } + } + + /* Allocate and initialize imd structure. */ + imd = imd_initialize (fdin, fdout, domain, model); + + + if (imd_debug) + fprintf (stderr, "Connection established on '%s'\n", imtdev); + if (free_imtdev) + free ((char *)imtdev); + return (imd); + +err: + fprintf (stderr, "Cannot open server connection on '%s'.\n", imtdev); + if (free_imtdev) + free ((char *)imtdev); + return NULL; +} + + +/* IMD_DISPLAYIMAGE -- Display an image to the server, setting the WCS and + * frame as needed. This is a high-level procedure used to make image + * display easy. It is assumed that the pixel array has already been scaled + * to 8-bits. + */ + +int +imd_displayImage (imd, pix, nx, ny, frame, fbconfig, comp_wcs) +IMDPtr imd; /* package pointer */ +uchar *pix; /* pixels to display */ +int nx, ny; /* dimensions */ +int frame; /* frame to display */ +int fbconfig; /* fb config number */ +int comp_wcs; /* compute a WCS */ +{ + register uchar *ip = pix; + register uchar *bp, *pp; + register int i, nnx = nx, nny = ny; + int status, use_subras = 0; + int pmin, pmax, x_off = 0, y_off = 0, lx, ly; + int fbwidth = imd->fbtab[fbconfig-1]->width; + int fbheight = imd->fbtab[fbconfig-1]->height; + int imd_writeImage(); + + if (imd_debug) + printf ("[imd_displayImage] frame=%d fb=%d->[%d,%d] %dx%d bytes\n", + frame, fbconfig, fbwidth, fbheight, nx, ny); + + imd_setFrame (imd, frame); /* select frame */ + imd_clearFrame (imd); /* erase frame */ + imd_setFBConfig (imd, fbconfig); /* set fbconfig */ + + /* Check to see if the image to be displayed is larger than the + * current frame buffer. If so we'll need to pull out a subraster + * the size of the FB for display. + */ + if (nx > fbwidth || ny > fbheight) { + nnx = min(nx, fbwidth); /* get new dimensions */ + nny = min(ny, fbheight); + bp = ip = (uchar *) calloc (nnx * nny, sizeof (uchar)); + use_subras++; + + /* Pull out the subraster for display */ + x_off = (nx>fbwidth ? ((nx - fbwidth) / 2 - 1) : 0); + y_off = (ny>fbheight ? ((ny - fbheight) / 2 - 1) : 0); + pp = pix + (y_off * nx) + x_off; + for (i=0; i < nny; i++) { + bcopy (pp, bp, nnx); + pp += nx; + bp += nnx; + } + } + + if (imd_debug) + printf("[imd_displayImage] nnx=%d nny=%d xo=%d yo=%d\n", + nnx, nny, x_off, y_off); + + /* Center the placement in user coords. + */ + lx = (fbwidth / 2) - (nnx / 2); + ly = fbheight - ((fbheight / 2) + (nny / 2)); + + /* Compute a WCS for this image if it's not already defined. */ + if (comp_wcs) { + imd->a = 1.0; + imd->b = 0.0; + imd->c = 0.0; + imd->d = -1.0; + imd->tx = (float) (nnx / 2) - (fbwidth / 2) + 1 + (float) x_off; + imd->ty = (float) (fbheight / 2) + (nny / 2) + (float) y_off; + + if (imd->z1 == INDEF || imd->z2 == INDEF) { + imd_minmax (pix, nnx*nny, &pmin, &pmax); + imd->z1 = (imd->z1 == INDEF) ? (float) pmin : imd->z1; + imd->z2 = (imd->z2 == INDEF) ? (float) pmax : imd->z2; + } + imd->ztrans = W_LINEAR; + + /* Initialize the mapping. */ + imd->sx = 1.0; + imd->sy = 1.0; + imd->snx = nnx; + imd->sny = nny; + imd->dx = lx; + imd->dy = ly; + imd->dnx = nnx; + imd->dny = nny; + imd->iis_valid = 1; + + if (imd_setWCS (imd, imd->name, imd->title, imd->a, imd->b, imd->c, + imd->d, imd->tx, imd->ty, imd->z1, imd->z2, imd->ztrans)) + return (ERR); + } + + /* Finally, display the image. + */ + status = imd_writeImage (imd, ip, nnx, nny, lx, ly); + + if (use_subras) + free ((char *)ip); + return (status); +} + + +/* IMD_READCURSOR -- Read the current cursor position. If sample is defined + * logical cursor position will be sampled and returned immediately, otherwise + * the server will block until a key is hit and we return that value as well. + */ + +#ifdef ANSI_FUNC + +int +imd_readCursor ( + IMDPtr imd, /* package pointer */ + int sample, /* wait for keystroke? */ + float *x, + float *y, /* position */ + int *wcs, /* WCS */ + char *key /* keystroke */ +) +#else + +int +imd_readCursor (imd, sample, x, y, wcs, key) +IMDPtr imd; /* package pointer */ +int sample; /* wait for keystroke? */ +float *x, *y; /* position */ +int *wcs; /* WCS */ +char *key; /* keystroke */ +#endif +{ + if (imd_debug) + printf ("[imd_readCursor]\n"); + + return (com_readCursor(imd->datain, imd->dataout, + sample, x, y, wcs, key)); +} + + +/* IMD_SETWCS -- Set the WCS of the screen. The WCS is passed in a string + * defined as: + * Image_Name_String\n a b c d tx ty z1 z2 zt + * where: + * X' = a*X + c*Y + tx + * Y' = b*X + d*Y + ty + * + * z1 is the minimum pixel value, z2 is the maximum pixel value, zt + * defines the type of transformation to use. + */ + +#ifdef ANSI_FUNC + +int +imd_setWCS ( + IMDPtr imd, /* package pointer */ + char *name, /* name string */ + char *title, /* title string */ + float a, + float b, + float c, + float d, /* WCS values */ + float tx, + float ty, /* translation */ + float z1, + float z2, /* zscale values */ + int zt /* transformation type */ +) +#else + +int +imd_setWCS (imd, name, title, a, b, c, d, tx, ty, z1, z2, zt) +IMDPtr imd; /* package pointer */ +char *name; /* name string */ +char *title; /* title string */ +float a, b, c, d; /* WCS values */ +float tx, ty; /* translation */ +float z1, z2; /* zscale values */ +int zt; /* transformation type */ +#endif +{ + int nbytes = 0, status = 0, version = imd->iis_version; + char old_wcs[SZ_OLD_WCSBUF], mapping[SZ_OLD_WCSBUF]; + char wcstext[SZ_WCSBUF]; + + + /* Format the string to set world coordinate parameters. */ + (void) sprintf (old_wcs, "%s%s%s\n%g %g %g %g %g %g %g %g %d\n", + (*name ? name : " "), (title ? " - " : " "), (*title ? title : " "), + a, b, c, d, tx, ty, z1, z2, zt); + + if (imd->iis_version > 0 && imd->iis_valid) { + char *path_prefix, *node, *path; +#ifdef SOLARIS + char *getcwd(); +#else + char *getwd(); +#endif + + path_prefix = (char *) calloc (1025, sizeof(char)); + path = (char *) calloc (512, sizeof(char)); + node = (char *) calloc (512, sizeof(char)); + + + /* Get a node!path prefix for the data file. */ + gethostname (node, SZ_FNAME); + +#ifdef SOLARIS + (void) getcwd (path, 511); +#else + (void) getwd (path); +#endif + if (*name == '/') + (void) sprintf (path_prefix, "%s!%s", node, name); + else + (void) sprintf (path_prefix, "%s!%s/%s", node, path, name); + + (void) sprintf (mapping, "%s %g %g %d %d %d %d %d %d\n%s\n", + (*imd->region ? imd->region : "image"), + imd->sx, imd->sy, imd->snx, imd->sny, + imd->dx, imd->dy, imd->dnx, imd->dny, + (*imd->ref ? imd->ref : path_prefix)); + + (void) sprintf (wcstext, "%s%s", old_wcs, mapping); + + free ((char *)path_prefix); + free ((char *)path); + free ((char *)node); + + } else + (void) strcpy (wcstext, old_wcs); + + + if (imd_debug) { printf ("[imd_setWCS] wcs='%s'\n", wcstext); } + + /* Send the WCS buffer. */ + nbytes = strlen (wcstext) + 1; + status = com_writeWCS (imd->dataout, wcstext, nbytes, version); + + /* Invalidate the mapping once it's been sent. */ + imd->iis_valid = 0; + + return (status); +} + + +#ifdef USE_OLD_GETWCS + +/* IMD_OLDGETWCS -- Get the current display frame WCS information. + */ + +#ifdef ANSI_FUNC + +int +imd_getWCS ( + IMDPtr imd, /* package pointer */ + int wcs, /* WCS number to get */ + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt /* transformation type */ +) +#else + +int +imd_getWCS (imd, wcs, name, title, a, b, c, d, tx, ty, z1, z2, zt) +IMDPtr imd; /* package pointer */ +int wcs; /* WCS number to get */ +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +#endif +{ + int datain = imd->datain; + int dataout = imd->dataout; + int nbytes = 0, version = imd->iis_version; + int tokens, status = 0; + char wcs_info[SZ_WCSBUF]; + + + /* Read the WCS from the server. */ + if (com_readWCS (datain, dataout, wcs_info, &nbytes, wcs, version)) + return (ERR); + + /* Parse the return buffer. */ + name[0] = title[0] = '\0'; + if (version == 0) { + tokens = sscanf (wcs_info, "%[^\n]\n%g%g%g%g%g%g%g%g%d", + buf, a, b, c, d, tx, ty, z1, z2, zt); + if (tokens == EOF) { + /* Had no WCS info, can't even get name, but no error. */ + *a = *b = *c = *d = *tx = *ty = *z1 = *z2 = *zt = 0; + + } else if (tokens < 10) { + /* partial read, something must be wrong. */ + return (ERR); + } + sscanf (buf, "%s - %s", name, title); + } + + if (imd_debug) { + printf ("[imd_getWCS] wcs=%d wcsbuf='%s'\n", wcs, wcsbuf); + } + + return (OK); +} +#endif + + +/* IMD_GETWCS -- Get the current display frame WCS information. + */ + +#ifdef ANSI_FUNC + +int +imd_getWCS ( + IMDPtr imd, /* package pointer */ + int wcs, /* WCS number to get */ + char *name, /* name string */ + char *title, /* title string */ + float *a, + float *b, + float *c, + float *d, /* WCS values */ + float *tx, + float *ty, /* translation */ + float *z1, + float *z2, /* zscale values */ + int *zt /* transformation type */ +) +#else + +int +imd_getWCS (imd, wcs, name, title, a, b, c, d, tx, ty, z1, z2, zt) +IMDPtr imd; /* package pointer */ +int wcs; /* WCS number to get */ +char *name; /* name string */ +char *title; /* title string */ +float *a, *b, *c, *d; /* WCS values */ +float *tx, *ty; /* translation */ +float *z1, *z2; /* zscale values */ +int *zt; /* transformation type */ +#endif +{ + int fbwidth = imd->fbtab[imd->fbconfig-1]->width; + int fbheight = imd->fbtab[imd->fbconfig-1]->height; + int datain = imd->datain; + int dataout = imd->dataout; + int nbytes = 0, version = imd->iis_version; + int tokens, status = 0; + char wcsbuf[SZ_WCSBUF]; + + + /* Read the WCS from the server. */ + if (com_readWCS (datain, dataout, wcsbuf, &nbytes, wcs, version)) + return (ERR); + + if (imd_debug) { + printf ("[imd_getWCS] wcs=%d wcsbuf='%s'\n", wcs, wcsbuf); + } + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, a, b, c, d, tx, ty, z1, z2, zt) < 7) { + + strcpy (title, "[NO WCS]\n"); + *a = *d = 1; + *b = *c = 0; + *tx = *ty = 0; + *zt = 0; + } else { + if (name == NULL) + name = imd->name; + if (title == NULL) + title = imd->title; + sscanf (buf, "%s - %s", name, title); + } + + /* Now try to read the mapping if we're expecting one, otherwise + * set up a default mapping of the entire frame buffer. + */ + if (imd->iis_version > 0) { + register int i, j; + + /* Skip over the first two lines of WCS data. */ + strcpy (buf, wcsbuf); + for (i=0, j=0; j < 2 && buf[i]; i++) + if (buf[i] == '\n') j++; + + /* Attempt to read the mapping. */ + imd->ref[0] = '\0'; + imd->region[0] = '\0'; + if (sscanf (&buf[i], "%s%f%f%d%d%d%d%d%d\n%s\n", + imd->region, &imd->sx, &imd->sy, &imd->snx, &imd->sny, + &imd->dx, &imd->dy, &imd->dnx, &imd->dny, imd->ref) < 10) { + + /* Error in the read, set a default. */ + strcpy (imd->region, "none"); + strcpy (imd->ref, "none"); + imd->sx = 1.0; + imd->sy = 1.0; + imd->snx = fbwidth; + imd->sny = fbheight; + imd->dx = 1; + imd->dy = 1; + imd->dnx = fbwidth; + imd->dny = fbheight; + + imd->iis_valid = 0; + return (ERR); + } else + imd->iis_valid = 1; + } + + return (OK); +} + + +/* IMD_SETMAPPING -- Set the mapping information to be sent with the next + * imd_setWcs() call. + */ +#ifdef ANSI_FUNC + +int +imd_setMapping ( + IMDPtr imd, /* package ptr */ + char *region, /* region name */ + float sx, /* source rect */ + float sy, + int snx, /* source extent */ + int sny, + int dx, /* dest rect */ + int dy, + int dnx, /* dest extent */ + int dny, + char *ref /* reference name */ +) +#else + +int +imd_setMapping (imd, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +IMDPtr imd; /* package ptr */ +char *region; /* region name */ +float sx, sy; /* source rect */ +int snx, sny; /* source extent */ +int dx, dy; /* dest rect */ +int dnx, dny; /* dest extent */ +char *ref; /* reference name */ +#endif +{ + if (imd_debug) { + printf ("[imd_setMapping] region='%s' ref='%s'\n", + ( region ? region : ""), (ref ? ref : "")); + printf ("\tsrc = %g,%g%d,%d dest = %d,%d,%d,%d\n", + sx, sy, snx, sny, dx, dy, dnx, dny); + } + + strcpy (imd->region, (region ? region : "")); + strcpy (imd->ref, (ref ? ref : "")); + imd->sx = sx; + imd->sy = sy; + imd->snx = snx; + imd->sny = sny; + imd->dx = dx; + imd->dy = dy; + imd->dnx = dnx; + imd->dny = dny; + + return ((imd->iis_valid = 1)); +} + + +/* IMD_GETMAPPING -- Get the mapping information returned with the last + * imd_getWcs() call. + */ +#ifdef ANSI_FUNC +int +imd_getMapping ( + IMDPtr imd, /* package ptr */ + char *region, /* region name */ + float *sx, /* source rect */ + float *sy, + int *snx, /* source extent */ + int *sny, + int *dx, /* dest rect */ + int *dy, + int *dnx, /* dest extent */ + int *dny, + char *ref /* reference name */ +) + +#else +int +imd_getMapping (imd, region, sx,sy,snx,sny, dx,dy,dnx,dny, ref) +IMDPtr imd; /* package ptr */ +char *region; /* region name */ +float *sx, *sy; /* source rect */ +int *snx, *sny; /* source extent */ +int *dx, *dy; /* dest rect */ +int *dnx, *dny; /* dest extent */ +char *ref; /* reference name */ +#endif +{ + if (imd->iis_valid) { + strcpy (region, imd->region); + *sx = imd->sx; + *sy = imd->sy; + *snx = imd->snx; + *sny = imd->sny; + *dx = imd->dx; + *dy = imd->dy; + *dnx = imd->dnx; + *dny = imd->dny; + strcpy (ref, imd->ref); + } + + if (imd_debug) { + printf ("[imd_getMapping] valid=%d region='%s' ref='%s'\n", + imd->iis_valid, (region ? region : ""), (ref ? ref : "")); + printf ("\tsrc = %g,%g,%d,%d dest = %d,%d,%d,%d\n", + *sx, *sy, *snx, *sny, *dx, *dy, *dnx, *dny); + } + + return (imd->iis_valid); +} + + +/* IMD_CLOSE -- Close the connection to the display server. + */ + +#ifdef ANSI_FUNC + +int +imd_close ( + IMDPtr imd /* package pointer */ +) +#else + +int +imd_close (imd) +IMDPtr imd; /* package pointer */ +#endif +{ + if (imd_debug) + printf ("[imd_close]\n"); + + if (imd) { + register int i; + + /* Close the connection. */ + if (imd->datain) + close (imd->datain); + if (imd->dataout) + close (imd->dataout); + + /* Free the frame buffer configuration table. */ + for (i=0; i < MAX_FBCONFIG; i++) + free ((char *)imd->fbtab[i]); + + /* Free the pointers in the imd structure. */ + free (imd->title); + free (imd->name); + free (imd->region); + free (imd->ref); + free (imd); + } + + return (OK); +} + + +/* -------------------- + * Low-Level Procedures + * --------------------*/ + +/* IMD_WRITEIMAGE -- Display a raw pixel array to the server given the array + * dimensions, and a location. We use this instead of imd_writeSubRaster() + * since we can assume the frame is blank and we wish to avoid the overhead + * having to read back the frame buffer. The image corner position is given + * in user coords where the [0,0] origin is in the LL of the display window, + * we convert this to frame buffer coords where the origin is in the UL. + */ + +int +imd_writeImage (imd, pix, nx, ny, llx, lly) +IMDPtr imd; /* package pointer */ +uchar *pix; /* pixels to display */ +int nx, ny; /* dimensions */ +int llx, lly; /* LL corner of image */ +{ + register int i, j, k, y, nbytes, nl = ny, imline; + register int nnx = nx, nny = ny, block_has_data = 0; + register uchar *ip = pix; + register uchar *bp, *block, *ep; + register int lx, ly, nblocks, lines_per_block, fbline; + int x_off = 0, y_off = 0; + int fbwidth = imd->fbtab[imd->fbconfig-1]->width; + int fbheight = imd->fbtab[imd->fbconfig-1]->height; + + + /* Check to see if the image to be displayed is larger than the + * current frame buffer. + */ + if (nx > fbwidth || ny > fbheight) { + nnx = min(nx, fbwidth); /* get new dimensions */ + nny = min(ny, fbheight); + x_off = (nx>fbwidth ? ((nx - fbwidth) / 2 - 1) : 0); + y_off = (ny>fbheight ? ((ny - fbheight) / 2 - 1) : 0); + } + + /* Now see whether the image extends over the boundaries of the + * frame buffer in any direction. If so we'll set up to write + * only those pixels on the frame buffer. + */ + if (llx < 0) { /* image is left of frame */ + x_off = -llx; + nnx = nx + llx; + } + if (lly < 0) { /* image is below frame */ + y_off = -lly; + nny = ny + lly; + } + if ((llx + nx) > fbwidth) /* image overflows frame to right */ + nnx = fbwidth - llx; + if ((lly + ny) > fbheight) /* image overflows frame at top */ + nny = fbheight - lly; + ip = pix + (y_off * nx) + x_off; + + /* Convert corner position to frame buffer coords. */ + lx = max (0, llx); + ly = min (fbheight - 1, fbheight - lly - 1); + + /* Compute the corner points in user units. */ + imd->xs = llx; + imd->xe = llx + nnx - 1; + imd->ys = lly; + imd->ye = lly + nny - 1; + + if (imd_debug) { + printf("[imd_writeImage] %dx%d bytes at [%d,%d] of [%d,%d]\n", + nx, ny, lx, ly, fbwidth, fbheight); + printf("[imd_writeImage] Xends = [%d,%d] Yends = [%d,%d]\n", + imd->xs, imd->xe, imd->ys, imd->ye); + printf("[imd_writeImage] nnx=%d nny=%d llx=%d lly=%d xo=%d yo=%d\n", + nnx, nny, llx, lly, x_off, y_off); + imd_debug = 1; + } + + /* Display image. */ + lines_per_block = (int) (SZ_BLOCK / fbwidth); + nblocks = (int) (fbheight / lines_per_block); + nbytes = fbwidth * lines_per_block; + block = (uchar *) calloc (nbytes, sizeof (uchar)); + + if (imd_debug) { + printf ("height=%d nblocks=%d lines/block=%d\n", + fbheight, nblocks, lines_per_block); + } + + /* For each of the blocks we're sending.... */ + fbline = fbheight - 1; + imline = ly; + ep = ip + nx * ny; + for (i=0, y = fbheight - lines_per_block; i < nblocks; i++) { + bp = block + (lines_per_block - 1) * fbwidth; + block_has_data = 0; + + if (nnx != fbwidth || nny != fbheight) + /* Clear the block array */ + for (k=0; k < nbytes; k++) + block[k] = 0; + + /* Map image pixels to the data block. */ + for (j=0; j < lines_per_block && nl >= 0; j++) { + if (fbline == imline && ip < ep) { + block_has_data = 1; + bcopy (ip, bp+lx, nnx); + ip += nx; + imline--; + nl--; + } + bp -= fbwidth; + fbline--; + } + + if (block_has_data) + if (imd_writeLine(imd, block, nbytes, 0, y)) + return (ERR); + y -= lines_per_block; + } + + /* Now take care of any remaining pixels in the frame buffer. */ + nbytes = (fbwidth * fbheight) - (nblocks * nbytes); + if (nbytes && nl >= 0) { + lines_per_block = nbytes / fbwidth; + bp = block + (lines_per_block - 1) * fbwidth; + + if (nnx != fbwidth || nny != fbheight) { + /* Clear the block array */ + for (k=0; k < nbytes; k++) + block[k] = 0; + } + + /* Map image pixels to the data block. */ + if (nl >= 0) { + for (j=0; j < lines_per_block && nl >= 0; j++) { + if (fbline == imline) { + bcopy (ip, bp+lx, nnx); + ip += nx; + imline--; + nl--; + } + bp -= fbwidth; + fbline--; + } + if (imd_writeLine(imd, block, nbytes, 0, 0)) + return (ERR); + } + } + + free ((char *)block); + return (OK); +} + + +/* IMD_READIMAGE -- Read the currently displayed image and return a pointer to + * the array and it's dimensions. Since we know where the image was written + * in the frame buffer this is really just a large subregion read. + */ + +int +imd_readImage (imd, pix, nx, ny) +IMDPtr imd; /* package pointer */ +uchar *pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +{ + *nx = (imd->xe - imd->xs + 1); + *ny = (imd->ye - imd->ys + 1); + + if (imd_debug) + printf ("[imd_readImage] nx=%d ny=%d at [%d,%d]\n", + *nx, *ny, imd->xs, imd->ys); + + /* Read the image region buffer. */ + if (!pix) + pix = (uchar *) malloc ((*nx) * (*ny)); + return (imd_readSubRaster(imd, imd->xs, imd->ys, *nx, *ny, pix)); +} + + +/* IMD_READFRAMEBUFFER -- Read the contents of the entire frame buffer and + * return a pointer to the array and it's dimensions. + */ + +int +imd_readFrameBuffer (imd, pix, nx, ny) +IMDPtr imd; /* package pointer */ +uchar *pix; /* image pixels (output)*/ +int *nx, *ny; /* dimensions (output) */ +{ + if (imd_debug) + printf ("[imd_readFrameBuffer]\n"); + + *nx = imd->fbtab[imd->fbconfig-1]->width; + *ny = imd->fbtab[imd->fbconfig-1]->height; + + if (imd_debug) + printf ("[imd_readFrameBuffer] nx=%d ny=%d at [%d,%d]\n", + *nx, *ny, 0, 0); + + /* Read the frame buffer. */ + if (!pix) + pix = (uchar *) malloc ((*nx) * (*ny)); + return (imd_readSubRaster(imd, 0, 0, *nx, *ny, pix)); +} + + +/* IMD_SETFRAME -- Set the current display frame. + */ + +#ifdef ANSI_FUNC + +int +imd_setFrame ( + IMDPtr imd, /* package pointer */ + int frame /* frame number */ +) +#else + +int +imd_setFrame (imd, frame) +IMDPtr imd; /* package pointer */ +int frame; /* frame number */ +#endif +{ + if (imd_debug) + printf ("[imd_setFrame] frame = %d\n", frame); + + imd->frame = frame; + return (com_setFrame (imd->dataout, imd->frame)); +} + + +/* IMD_SETFBCONFIG -- Select the frame buffer configuration. + */ + +#ifdef ANSI_FUNC + +int +imd_setFBConfig ( + IMDPtr imd, /* package pointer */ + int configno /* frame config number */ +) +#else + +int +imd_setFBConfig (imd, configno) +IMDPtr imd; /* package pointer */ +int configno; /* frame config number */ +#endif +{ + if (imd_debug) + printf ("[imd_setFBConfig] config = %d\n", configno); + + imd->fbconfig = configno; + return (com_setFBConfig (imd->dataout, imd->fbconfig)); +} + + +/* IMD_GETFBCONFIG -- Get the current frame buffer config info used by the + * the interface. + */ + +#ifdef ANSI_FUNC + +int +imd_getFBConfig ( + IMDPtr imd, /* package pointer */ + int *configno, /* frame config number */ + int *width, + int *height, /* frame buffer size */ + int *nframes /* number of frames */ +) +#else + +int +imd_getFBConfig (imd, configno, width, height, nframes) +IMDPtr imd; /* package pointer */ +int *configno; /* frame config number */ +int *width, *height; /* frame buffer size */ +int *nframes; /* number of frames */ +#endif +{ + *configno = imd->fbconfig; + *width = imd->fbtab[imd->fbconfig-1]->width; + *height = imd->fbtab[imd->fbconfig-1]->height; + *nframes = imd->fbtab[imd->fbconfig-1]->nframes; + if (imd_debug) + printf ("[imd_getFBConfig] config=%d w=%d h=%d nf=%d\n", + *configno, *width, *height, *nframes); + + return (com_setFBConfig (imd->dataout, imd->fbconfig)); +} + + +/* IMD_SETNAME -- Set the current image name (for the WCS string); + */ + +#ifdef ANSI_FUNC + +int +imd_setName ( + IMDPtr imd, /* package pointer */ + char *name /* image name */ +) +#else + +int +imd_setName (imd, name) +IMDPtr imd; /* package pointer */ +char *name; /* image name */ +#endif +{ + if (imd_debug) + printf ("[imd_setName] Name = %s\n", name); + + strcpy (imd->name, name); + return (OK); +} + + +/* IMD_SETTITLE -- Set the current image title (for the WCS string) + */ + +#ifdef ANSI_FUNC + +int +imd_setTitle ( + IMDPtr imd, /* package pointer */ + char *title /* image title */ +) +#else + +int +imd_setTitle (imd, title) +IMDPtr imd; /* package pointer */ +char *title; /* image title */ +#endif +{ + if (imd_debug) + printf ("[imd_setTitle] title = %s\n", title); + + strcpy (imd->title, title); + return (OK); +} + + +/* IMD_SETCURSOR -- Set the image cursor position. + */ + +#ifdef ANSI_FUNC + +int +imd_setCursor ( + IMDPtr imd, /* package pointer */ + int x, + int y, /* position */ + int wcs /* cursor wcs */ +) +#else + +int +imd_setCursor (imd, x, y, wcs) +IMDPtr imd; /* package pointer */ +int x, y; /* position */ +int wcs; /* cursor wcs */ +#endif +{ + if (imd_debug) + printf ("[imd_setCursor] position = [%d,%d]\n", x, y); + + /* need to convert to frame coords? */ + + return (com_setCursor(imd->dataout, x, y, wcs)); +} + + +/* IMD_CLEARFRAME -- Clear the current display frame. + */ + +#ifdef ANSI_FUNC + +int +imd_clearFrame ( + IMDPtr imd /* package pointer */ +) +#else + +int +imd_clearFrame (imd) +IMDPtr imd; /* package pointer */ +#endif +{ + if (imd_debug) + printf ("[imd_eraseFrame]\n"); + + return (com_eraseFrame(imd->dataout)); +} + + +/* IMD_READSUBRASTER -- Read a rectangular region of the frame buffer. + */ + +int +imd_readSubRaster (imd, llx, lly, nx, ny, pix) +IMDPtr imd; /* package pointer */ +int llx, lly; /* region corner */ +int nx, ny; /* dimensions */ +uchar *pix; /* image pixels (output)*/ +{ + register int i, j, nl, y, nbytes, lx, ly; + register uchar *ip = NULL, *bp = NULL, *block = NULL; + register int nblocks, lines_per_block; + register int nnx = nx, nny = ny, x_off = 0, y_off = 0; + int fbwidth = imd->fbtab[imd->fbconfig-1]->width; + int fbheight = imd->fbtab[imd->fbconfig-1]->height; + + + /* Make sure we've got a reasonable request. */ + if (nx > fbwidth || ny > fbheight) { + fprintf (stderr, + "Error: attempt to read raster larger than display.\n"); + return (ERR); + } + + /* Now see whether the raster extends over the boundaries of the + * frame buffer in any direction. If so we'll clip the raster to + * write only those pixels on the frame buffer. + */ + + if (-llx > imd->xs) { /* raster overflows bottom */ + x_off = -llx + imd->xs; + nnx = nx - x_off; + } + if (-lly > imd->ys) { /* raster overflows left */ + y_off = -lly + imd->ys; + nny = ny - y_off; + } + if ((llx + nx) > fbwidth) { /* raster overflows right */ + nnx = fbwidth - llx; + } + if ((lly + ny) > fbheight) { /* raster overflows top */ + nny = fbheight - lly; + /*y_off = ny - nny;*/ + } + + /* Allocate the pointer if needed. Clear the output array if we're + * clipping to guarantee zero values. + */ + if (!pix) + pix = (uchar *) calloc (nx * ny, sizeof (uchar)); + + /* Convert corner position to frame buffer coords. */ + lx = max (0, llx + imd->xs); + ly = min (fbheight - 1, fbheight - (lly + imd->ys) - 0); + + if (imd_debug) { + printf ("[imd_readSubRas] %d bytes at [%d,%d] orig [%d,%d]\n", + nx*ny, lx, ly, llx, lly); + printf ("[imd_readSubRas] img corner at [%d,%d] -> [%d,%d]\n", + imd->xs, imd->ys, imd->xe, imd->ye); + } + + /* Figure out how many reads we'll need. */ + if (imd->model == MOD_NORMAL) { + lines_per_block = min (nny, (int)(SZ_BLOCK / fbwidth)); + nbytes = fbwidth * lines_per_block; + } else { + lines_per_block = min (nny, (int)(SZ_BLOCK / nx)); + nbytes = nx * lines_per_block; + } + nblocks = (int) (nny / lines_per_block); + block = (uchar *) calloc (nbytes, sizeof (uchar)); + + if (imd_debug) { + printf("[imd_readSubRas] ny=%d nblks=%d lin/bl=%d nbytes=%d\n", + ny, nblocks, lines_per_block, nbytes); + printf("[imd_readSubRas] nnx=%d nny=%d llx=%d lly=%d xo=%d yo=%d\n", + nnx, nny, llx, lly, x_off, y_off); + } + + + /* Loop over each of the blocks needed to get the region. */ + nl = nny; + ip = pix + (y_off * nx) + x_off; + y = ly - lines_per_block + 1; + for (i=0; i < nblocks; i++, y -= lines_per_block) { + if (imd_readLine(imd, block, nbytes, 0, y)) + return (ERR); + + /* Pull the requested pixels from the block. */ + bp = block + (lines_per_block - 1) * fbwidth; + for (j=0; j < lines_per_block && nl; j++) { + /*bcopy (bp+lx+x_off-1, ip, nnx);*/ + bcopy (bp+lx, ip, nnx); + bp -= fbwidth; + ip += nx; + nl--; + } + } + + /* Take care of the remaining pixels. */ + if (nl) { + nbytes = nl * fbwidth; + y += lines_per_block - nl + 1; + + /* Read the last block. */ + if (imd_readLine(imd, block, nbytes, 0, y)) + return (ERR); + + /* Pull the requested pixels from the block. */ + bp = block + (nl - 1) * fbwidth; + for (j=0; j < nl; j++) { + /*bcopy (bp+lx+x_off-1, ip, nx);*/ + bcopy (bp+lx, ip, nnx); + bp -= fbwidth; + ip += nx; + } + } + + free ((char *)block); + return (OK); +} + + +/* IMD_WRITESUBRASTER -- Write a rectangular region of the frame buffer. + */ + +int +imd_writeSubRaster (imd, llx, lly, nx, ny, pix) +IMDPtr imd; /* package pointer */ +int llx, lly; /* region corner */ +int nx, ny; /* dimensions */ +uchar *pix; /* subraster pixels */ +{ + register int i, j, nl, y, nbytes, lx, ly; + register uchar *ip = NULL, *bp = NULL, *block = NULL; + register int nblocks, lines_per_block; + register int nnx = nx, nny = ny, x_off = 0, y_off = 0; + int fbwidth = imd->fbtab[imd->fbconfig-1]->width; + int fbheight = imd->fbtab[imd->fbconfig-1]->height; + + + /* Make sure at least part of the raster is on the frame buffer, + * otherwise it's an error. + */ + if (llx > fbwidth || lly > fbheight || (llx+nx) < 0 || (lly+ny) < 0) { + fprintf (stderr, "Error: attempt to write raster out of bounds.\n"); + return (ERR); + } + + /* Now see whether the raster extends over the boundaries of the + * frame buffer in any direction. If so we'll clip the raster to + * write only those pixels on the frame buffer. + */ + if (-llx > imd->xs) { /* raster overflows bottom */ + x_off = -llx + imd->xs; + nnx = nx - x_off; + } + if (-lly > imd->ys) { /* raster overflows left */ + y_off = -lly + imd->ys; + nny = ny - y_off; + } + if ((llx + nx) > fbwidth) /* raster overflows right */ + nnx = fbwidth - llx; + if ((lly + ny) > fbheight) /* raster overflows top */ + nny = fbheight - lly; + + /* Check to see if the image to be displayed is larger than the + * current frame buffer. + */ + if (nx > fbwidth || ny > fbheight) { + nnx = min(nx, fbwidth); /* get new dimensions */ + nny = min(ny, fbheight); + x_off = (nx>fbwidth ? ((nx - fbwidth) / 2 - 1) : 0); + y_off = (ny>fbheight ? ((ny - fbheight) / 2 - 1) : 0); + } + + ip = pix + (y_off * nx) + x_off; + + /* Convert corner position to frame buffer coords. */ + lx = max (0, llx + imd->xs); + ly = min (fbheight - 1, fbheight - (lly + imd->ys) - 0); + + if (imd_debug) + printf ("[imd_writeSubRaster] %d bytes at [%d,%d] of [%d,%d]\n", + nx*ny, lx, ly, fbwidth, fbheight); + + /* Figure out how many reads we'll need. */ + if (imd->model == MOD_NORMAL) { + lines_per_block = min (nny, (int)(SZ_BLOCK / fbwidth)); + nbytes = fbwidth * lines_per_block; + } else { + lines_per_block = min (nny, (int)(SZ_BLOCK / nx)); + nbytes = nx * lines_per_block; + } + nblocks = (int) (nny / lines_per_block); + block = (uchar *) calloc (nbytes, sizeof (uchar)); + + if (imd_debug) { + printf ("\tnnx=%d nny=%d llx=%d lly=%d xo=%d yo=%d xs=%d ys=%d\n", + nnx, nny, llx, lly, x_off, y_off, imd->xs, imd->ys); + printf ("\tny=%d nblocks=%d lines/block=%d nbytes=%d\n", + ny, nblocks, lines_per_block, nbytes); + } + + /* Loop over each of the blocks needed to get the region. */ + nl = nny; + y = ly - lines_per_block + 1; + for (i=0; i < nblocks; i++, y -= lines_per_block) { + + if (imd->model == MOD_NORMAL) { + + /* Read a block of data containing the subraster but only if + * we need to. + */ + if (nnx != fbwidth) + if (imd_readLine(imd, block, nbytes, 0, y)) + return (ERR); + + /* Copy the subraster pixels to the block just read. */ + bp = block + (lines_per_block - 1) * fbwidth; + for (j=0; j < lines_per_block && nl; j++) { + bcopy (ip, bp+lx, nnx); + bp -= fbwidth; + ip += nx; + nl--; + } + + /* Write the edited block back to the server. */ + if (imd_writeLine(imd, block, nbytes, 0, y)) + return (ERR); + + } else { + /* Copy the subraster pixels to the block just read. */ + bp = block + (lines_per_block - 1) * nx; + for (j=0; j < lines_per_block && nl; j++) { + bcopy (ip, bp, nnx); + bp -= nx; + ip += nx; + nl--; + } + + /* Write the edited block back to the server. */ + nbytes = lines_per_block * ny; + if (imd_writeRawBuf(imd, block, nbytes, lx, y, + nx, lines_per_block)) + return (ERR); + } + } + + /* Take care of the remaining pixels. */ + if (nl) { + nbytes = nl * fbwidth; + + /* Read the last block. */ + y += lines_per_block - nl; + + + if (imd->model == MOD_NORMAL) { + if (nnx != fbwidth) + if (imd_readLine(imd, block, nbytes, 0, y)) + return (ERR); + + /* Copy the subraster pixels to the block just read. */ + bp = block + (nl - 1) * fbwidth; + for (j=0; j < nl; j++) { + bcopy (ip, bp+lx, nnx); + bp -= fbwidth; + ip += nx; + } + + /* Write the edited block back to the server. */ + if (imd_writeLine(imd, block, nbytes, 0, y)) + return (ERR); + + } else { + /* Copy the subraster pixels to the block just read. */ + bp = block + (nl - 1) * nx; + for (j=0; j < nl; j++) { + bcopy (ip, bp, nnx); + bp -= nx; + ip += nx; + } + + /* Write the edited block back to the server. */ + nbytes = nl * ny; + if (imd_writeRawBuf(imd, block, nbytes, lx, y, nx, nl)) + return (ERR); + } + } + + free ((char *)block); + return (OK); +} + + +/* IMD_SETDEBUG -- Set the state of the debug flag. + */ + +#ifdef ANSI_FUNC + +int +imd_setDebug (int state) +#else + +int +imd_setDebug (state) +int state; +#endif +{ + imd_debug = state; + return (OK); +} + + + +/* ------------------ + * PRIVATE PROCEDURES + * ------------------*/ + +/* IMD_WRITELINE -- Send the command to write a block of pixels to the + * server. This is a low-level routine called to either write a single + * line of data, or when the number of bytes exceeds the frame buffer width + * it can be used to send a complete "block" in the image display. + */ + +static int +imd_writeLine (imd, pix, nbytes, x, y) +IMDPtr imd; /* package pointer */ +uchar *pix; /* pixel array */ +int nbytes; /* npix to write */ +int x, y; /* coords for start */ +{ + register short sx=x, sy=y; + + if (imd_debug > 1) + printf ("[imd_writeLine] %d bytes at [%d,%d]\n", nbytes, x, y); + + return (com_writeData(imd->dataout, sx, sy, pix, nbytes)); +} + + +/* IMD_READLINE -- Send the command to read a sequential block of pixels + * from the server. + */ + +static int +imd_readLine (imd, pix, nbytes, x, y) +IMDPtr imd; /* package pointer */ +uchar *pix; /* pixel array */ +int nbytes; /* npix to write */ +int x, y; /* coords for start */ +{ + register short sx=x, sy=y; + + if (imd_debug) + printf ("[imd_readLine] %d bytes at [%d,%d]\n", nbytes, x, y); + + return (com_readData(imd->datain, imd->dataout, sx, sy, pix, &nbytes)); +} + + +/* IMD_WRITERAWBUF -- Send the command to write a block of pixels to the + * server. This is a low-level routine called to either write a single + * line of data, or when the number of bytes exceeds the frame buffer width + * it can be used to send a complete "block" in the image display. + */ + +static int +imd_writeRawBuf (imd, pix, nbytes, x, y, nx, ny) +IMDPtr imd; /* package pointer */ +uchar *pix; /* pixel array */ +int nbytes; /* npix to write */ +int x, y; /* coords for start */ +int nx, ny; /* dimensions of buf */ +{ + register short sx=x, sy=y; + + if (imd_debug > 1) + printf ("[imd_writeRawBuf] %d bytes at [%d,%d][%d,%d]\n", + nbytes, x, y, nx, ny); + + return (com_writeSubraster(imd->dataout, sx, sy, pix, nx, ny)); +} + + +/* IMD_READRAWBUF -- Send the command to write a block of pixels to the + * server. This is a low-level routine called to either write a single + * line of data, or when the number of bytes exceeds the frame buffer width + * it can be used to send a complete "block" in the image display. + */ + +static int +imd_readRawBuf (imd, pix, nbytes, x, y, nx, ny) +IMDPtr imd; /* package pointer */ +uchar *pix; /* pixel array */ +int nbytes; /* npix to read */ +int x, y; /* coords for start */ +int nx, ny; /* dimensions of buf */ +{ + register short sx=x, sy=y; + + if (imd_debug > 1) + printf ("[imd_readRawBuf] %d bytes at [%d,%d][%d,%d]\n", + nbytes, x, y, nx, ny); + + return (com_readSubraster(imd->dataout, sx, sy, pix, nx, ny)); +} + + +/* IMD_INITIALIZE -- Allocate and initialize the imd package structure. + */ + +#ifdef ANSI_FUNC + +static IMDPtr +imd_initialize ( + int fdin, + int fdout, /* device descriptors */ + int domain, /* connection type */ + int model /* subraster model */ +) +#else + +static IMDPtr +imd_initialize (fdin, fdout, domain, model) +int fdin, fdout; /* device descriptors */ +int domain; /* connection type */ +int model; /* subraster model */ +#endif +{ + IMDPtr imd; + + /* Allocate and initialize imd structure. */ + imd = (struct IMD *) calloc (1, sizeof (struct IMD)); + + imd->datain = fdin; + imd->dataout = fdout; + imd->domain = domain; + imd->ztrans = W_LINEAR; + imd->frame = 1; + imd->fbconfig = 1; + + /* Initialize a WCS, set the defaults for 512x512 framebuffer. */ + imd->a = 1.0; + imd->b = 0.0; + imd->c = 0.0; + imd->d = -1.0; + imd->tx = 1.0; + imd->ty = 512.0; + imd->z1 = 0.0; + imd->z2 = 255.0; + + /* Initialize the mapping. */ + imd->sx = 1.0; + imd->sy = 1.0; + imd->snx = 512; + imd->sny = 512; + imd->dx = 0; + imd->dy = 0; + imd->dnx = 511; + imd->dny = 511; + imd->iis_valid = 0; + + /* Allocate the structure pointers. */ + imd->name = (char *) calloc (SZ_NAME, sizeof(char)); + imd->title = (char *) calloc (SZ_NAME, sizeof(char)); + imd->region = (char *) calloc (SZ_NAME, sizeof(char)); + imd->ref = (char *) calloc (SZ_NAME, sizeof(char)); + + /* Get the server IIS version number. */ + imd->iis_version = imd_wcsVersion (imd); + +printf ("init: model = %d\n", model); + if (imd->iis_version > 10) { + /* Server supports fast subraster writes. + */ + if (model == MOD_NORMAL) + imd->model = MOD_FAST; + } else { + if (model == MOD_FAST) + imd->model = MOD_NORMAL; + } +printf ("\n\niis_version=%d model=%d -> %d\n", imd->iis_version, model, +imd->model); + + /* Load the frame buffer configuration file. */ + imd_loadImtoolrc (imd); + + return (imd); +} + + +/* IMD_PARSEIMTDEV -- Parse an IMTDEV device string, returning the domain + * type as the function value and loading the path/host information as + * needed. + */ + +#ifdef ANSI_FUNC + +static int +imd_parseImtdev ( + char *imtdev, /* device string */ + char *unixaddr, /* unix socket path */ + unsigned short *host_port, /* inet port number */ + unsigned long *host_addr, /* inet host address */ + char *ififo, /* fifo paths */ + char *ofifo, + int *model /* subraster display model */ +) +#else + +static int +imd_parseImtdev (imtdev, unixaddr, host_port, host_addr, ififo, ofifo, model) +char *imtdev; /* device string */ +char *unixaddr; /* unix socket path */ +unsigned short *host_port; /* inet port number */ +unsigned long *host_addr; /* inet host address */ +char *ififo, *ofifo; /* fifo paths */ +int *model; /* subraster display model */ +#endif +{ + char *ip, *dp; + char osfn[SZ_LINE*2]; + + + if (imtdev == NULL) + return ERR; + else { + /* Extract any subraster display model option from the IMTDEV + ** string. This will be the word "fast:" or "normal:" prefixed + ** to the device string. A missing option will use the default + ** model, either way we'll update the device string before parsing + ** for the connection. + */ + if (strncmp (imtdev, "fast:", 5) == 0) { + *model = MOD_FAST; + dp = &imtdev[5]; + } else if (strncmp (imtdev, "normal:", 5) == 0) { + *model = MOD_NORMAL; + dp = &imtdev[7]; + } else { + *model = DEF_MODEL; + dp = imtdev; + } +printf ("parse: model = %d (def=%d)\n", *model, DEF_MODEL); + + + /* Expand any %d fields in the network address to the UID. */ + sprintf (osfn, (char *)dp, getuid(), getuid()); + + if (strncmp (osfn, "fifo:", 5) == 0) { + /* FIFO (named pipe) connection. */ + ip = osfn + 5; + if (!imd_getstr (&ip, ififo, SZ_NAME)) + return ERR; + if (!imd_getstr (&ip, ofifo, SZ_NAME)) + return ERR; + + return FIFO; + + } else if (strncmp (osfn, "inet:", 5) == 0) { + + /* Internet connection. */ + char port_str[SZ_NAME], host_str[SZ_NAME]; + unsigned short port; + struct servent *sv; + struct hostent *hp; + + /* Get port number. This may be specified either as a service + * name or as a decimal port number. + */ + ip = osfn + 5; + if (imd_getstr (&ip, port_str, SZ_NAME) <= 0) + return ERR; + if (isdigit (port_str[0])) { + port = atoi (port_str); + *host_port = htons (port); + } else if ((sv = getservbyname(port_str,"tcp"))) { + *host_port = sv->s_port; + } else + return ERR; + + /* Get host address. This may be specified either has a host + * name or as an Internet address in dot notation. If no host + * name is specified default to the local host. + */ + if (imd_getstr (&ip, host_str, SZ_NAME) <= 0) + strcpy (host_str, "localhost"); + if (isdigit (host_str[0])) { + *host_addr = inet_addr (host_str); + if ((int)*host_addr == -1) + return ERR; + } else if ((hp = gethostbyname(host_str))) { + bcopy (hp->h_addr, (char *)host_addr, sizeof(*host_addr)); + } else + return ERR; + + return INET; + + } else if (strncmp (osfn, "unix:", 5) == 0) { + /* Unix domain socket connection. */ + ip = osfn + 5; + if (!imd_getstr (&ip, unixaddr, SZ_NAME)) + return ERR; + + return UNIX; + } + } + + + return (ERR); +} + + +/* IMD_WCSVERSION -- Query the server for the support IIS WCS version. + */ + +#ifdef ANSI_FUNC + +static int +imd_wcsVersion ( + IMDPtr imd /* package pointer */ +) +#else + +static int +imd_wcsVersion (imd) +IMDPtr imd; /* package pointer */ +#endif +{ + /* Allow the user to disable the use of maps. */ + if (getenv ("CDL_NOMAPS")) + return (0); + else + return (com_wcsVersion (imd->datain, imd->dataout)); +} + + +/* IMD_LOADIMTOOLRC -- Load the frame buffer configuration table into a + * runtime table. An error is returned if the table cannot be found and + * a default frame buffer size of 512x512 with 2 frames is available (this + * is all the server will have abvailable anyway). + */ + +#ifdef ANSI_FUNC + +static int +imd_loadImtoolrc ( + IMDPtr imd /* package pointer */ +) +#else + +static int +imd_loadImtoolrc (imd) +IMDPtr imd; /* package pointer */ +#endif +{ + register char *ip; + register FILE *fp = NULL; + int config, nframes, width, height, i; + char *fname; + + + /* Initialize the config table. */ + for (i=0; i < MAX_FBCONFIG; i++) { + imd->fbtab[i] = (FBTab *) calloc (sizeof(FBTab), sizeof(char)); + imd->fbtab[i]->config = i; + imd->fbtab[i]->nframes = 2; + imd->fbtab[i]->width = DEF_FRAME_WIDTH; + imd->fbtab[i]->height = DEF_FRAME_HEIGHT; + } + + /* Attempt to open the config file. */ + if ((fname=getenv(FBCONFIG_ENV1)) || (fname=getenv(FBCONFIG_ENV2))) { + fp = fopen (fname, "r"); + if (imd_debug) + printf ("Using IMTOOLRC='%s'...\n", fname); + } + if (!fp && (fname = getenv ("HOME"))) { + if (imd_debug) + printf ("$IMTOOLRC not found...\n"); + sprintf (buf, "%s/%s", fname, FBCONFIG_1); + fp = fopen (fname = buf, "r"); + if (fp && imd_debug) + printf ("Using $HOME/.imtoolrc...\n"); + } + if (!fp) { + if (imd_debug) + printf ("$HOME/.imtoolrc not found...\n"); + fp = fopen ((fname = FBCONFIG_2), "r"); + if (fp && imd_debug) + printf ("Using /usr/local/lib/imtoolrc...\n"); + } + if (!fp) { + fprintf (stderr, + "Warning: cannot find frame buffer configuration table.\n"); + return (ERR); + } + + /* Scan the frame buffer configuration file. + */ + while (fgets (buf, SZ_LINE, fp) != NULL) { + /* Skip comment lines and blank lines. */ + for (ip=buf; *ip == ' ' || *ip == '\t'; ip++) + ; + if (*ip == '\n' || *ip == '#') + continue; + if (!isdigit (*ip)) + continue; + switch (sscanf (ip, "%d%d%d%d",&config,&nframes,&width,&height)) { + case 4: + break; /* normal case */ + case 3: + height = width; /* default to square format */ + break; + default: + fprintf (stderr, "Warning: bad config `%s'\n", ip); + continue; + } + + nframes = max (1, nframes); + width = max (1, width); + height = max (1, height); + + /* Since the frame buffer is stored in a memory pixrect + * (effectively), the line length should be an integral number + * of 16 bit words. + */ + if (width & 1) { + fprintf (stderr, "Warning: fb config %d [%d-%dx%d] - ", + config, nframes, width, height); + fprintf (stderr, "frame width should be even, reset to %d\n", + --width); + } + + imd->fbtab[config-1]->config = max(1,min(MAX_FBCONFIG, config)); + imd->fbtab[config-1]->nframes = nframes; + imd->fbtab[config-1]->width = width; + imd->fbtab[config-1]->height = height; + + if (imd_debug > 1) + printf ("%3d %2d %6d %6d\n", config, nframes, width, height); + } + + fclose (fp); + return (OK); +} + + +/* IMD_GETSTR -- Internal routine to extract a colon delimited string from a + * network filename. + */ +#ifdef ANSI_FUNC + +static int +imd_getstr (char **ipp, char *obuf, int maxch) +#else + +static int +imd_getstr (ipp, obuf, maxch) +char **ipp; +char *obuf; +int maxch; +#endif +{ + register char *ip = *ipp, *op = obuf; + register char *otop = obuf + maxch; + char *start; + + while (isspace(*ip)) + ip++; + for (start=ip; *ip; ip++) { + if (*ip == ':') { + ip++; + break; + } else if (op && op < otop) + *op++ = *ip; + } + + if (op) + *op = '\0'; + *ipp = ip; + + return (ip - start); +} + + +/* IMD_MINMAX -- Compute the min/max values of an array. + */ + +static void +imd_minmax (pix, nbytes, pmin, pmax) +uchar *pix; +int nbytes; +int *pmin, *pmax; +{ + register int i; + + *pmin = *pmax = pix[0]; + for (i=1; i + + + CDLDIR = ../ + INCLUDES = -I. -I$(CDLDIR) + LOCAL_LDFLAGS = -L$(CDLDIR) + LIBS = -lcdl + + +AllTarget(cdltest imdtest) + +NormalProgramTarget(cdltest,cdltest.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(imdtest,imdtest.o,../libcdl.a,$(LIBS),-lm) + +depend:: + +LintTarget() diff --git a/vendor/x11iraf/cdl/test/Imakefile.standalone b/vendor/x11iraf/cdl/test/Imakefile.standalone new file mode 100644 index 00000000..ff6fd3fa --- /dev/null +++ b/vendor/x11iraf/cdl/test/Imakefile.standalone @@ -0,0 +1,39 @@ +# +# IMakefile for CDL Test tasks. +# + + CDLDIR = ../ + INCLUDES = -I. -I$(CDLDIR) + LOCAL_LDFLAGS = -L$(CDLDIR) + LIBS = -lcdl + + +# Hack to compile under SunPRO V4 on Solaris +#if defined (SunArchitecture) && OSMajorVersion >= 5 && HasSunC +#if OSMinorVersion <= 5 +#if !defined (i386Architecture) + CCOPTIONS = -Xs +EXTRA_LDOPTIONS = -xildoff +#endif +#else + CCOPTIONS = +EXTRA_LDOPTIONS = -xildoff +#endif + +#else +#if defined (UltrixArchitecture) + CCOPTIONS = -DULTRIX +#endif +#if defined (OSF1Architecture) && OSMajorVersion >= 4 + CCOPTIONS = -DOSF1 +#endif +#endif + +AllTarget(cdltest imdtest) + +NormalProgramTarget(cdltest,cdltest.o,../libcdl.a,$(LIBS),-lm) +NormalProgramTarget(imdtest,imdtest.o,../libcdl.a,$(LIBS),-lm) + +depend:: + +LintTarget() diff --git a/vendor/x11iraf/cdl/test/Makefile.generic b/vendor/x11iraf/cdl/test/Makefile.generic new file mode 100644 index 00000000..c64c90b2 --- /dev/null +++ b/vendor/x11iraf/cdl/test/Makefile.generic @@ -0,0 +1,76 @@ +# +# Generic Makefile for CDL Test tasks. +# + + CDLDIR = ../ + RM = rm + CFLAGS = -I. -I$(CDLDIR) + LDFLAGS = -L$(CDLDIR) + LIBS = -lcdl + + LDLIBS = + + +all:: cdltest imdtest + +cdltest: cdltest.o ../libcdl.a + $(RM) -f $@ + $(CC) -o $@ cdltest.o $(LDFLAGS) $(LDOPTIONS) $(LIBS) $(LDLIBS) -lm + +clean:: + $(RM) -f cdltest + +imdtest: imdtest.o ../libcdl.a + $(RM) -f $@ + $(CC) -o $@ imdtest.o $(LDFLAGS) $(LDOPTIONS) $(LIBS) $(LDLIBS) -lm + +clean:: + $(RM) -f imdtest + +depend:: + +lint: + $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) +lint1: + $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) + +clean:: + $(RM) -f *.o + +# ------------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +emptyrule:: + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) -f Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +saber: + # load $(ALLDEFINES) $(SRCS) + +osaber: + # load $(ALLDEFINES) $(OBJS) + +# ------------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +# ------------------------------------------------------------------------- +# dependencies generated by makedepend + diff --git a/vendor/x11iraf/cdl/test/cdltest.c b/vendor/x11iraf/cdl/test/cdltest.c new file mode 100644 index 00000000..85c4b590 --- /dev/null +++ b/vendor/x11iraf/cdl/test/cdltest.c @@ -0,0 +1,635 @@ +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + +/* CDLTEST -- Test routines for the CDL package. + */ + +#define TEST_PATTERN -1 + +/* Utility macros. */ +#define max(a,b) (a > b ? a : b) +#define min(a,b) (a < b ? a : b) + +extern int cdl_debug; + +main() +{ + CDLPtr cdl; + char key, cmd[2], name[SZ_NAME], title[SZ_NAME], obj[SZ_NAME]; + int i, j, zt=1, frame=1, fbconfig=1, color=3, lwidth=1, twidth=1; + int debug = 0, nx, ny, bitpix, ix=128, iy=128, lstyle=0; + int lx, ly, ux, uy; + int fb_w, fb_h, nframes, wcs; + int xarray[1024], yarray[1024]; + float rx=128., ry=128., sx, sy; + float a, b, c, d, tx, ty, z1=0.0, z2=0.0; + int snx, sny, dnx, dny, dx, dy; + uchar *pix, *c_ras; + double sin(); + + cdl = cdl_open ((char *)getenv("IMTDEV")); + if (cdl == (CDLPtr) NULL) + exit (); + + c_ras = (uchar *) malloc (1024 * 1024); + + cmd[0] = 'f'; + cmd[1] = '\n'; + print_help(); + do { + switch (cmd[0]) { + case '<': /* ENABLE DEBUG */ + cdl_setDebug (1); + break; + + case '>': /* DISABLE DEBUG */ + cdl_setDebug (0); + break; + + case 'S': /* SAMPLE CURSOR */ + (void) cdl_readCursor (cdl, 1, &rx, &ry, &wcs, &key); + printf ("cursor: x=%g y=%g wcs=%d key='%d' (%c)\n", + rx, ry, wcs, key, key); + break; + + case 'C': /* CLIP TEST TOP */ + if (cdl_readSubRaster (cdl, 128, -32, 128, 128, &c_ras)) + printf ("...read returns an error\n"); + if (cdl_writeSubRaster (cdl, 128, -32, 128, 128, c_ras)) + printf ("...write returns an error\n"); + if (cdl_readSubRaster (cdl, 128, -8, 16, 16, &c_ras)) + printf ("...read returns an error\n"); + for (i=0;i<16;i++) { + for (j=0; j<16; j++) + printf ("%3d ", c_ras[i*16+j]); + printf ("\n"); + } + printf ("\n"); + if (cdl_readSubRaster (cdl, 128, 504, 16, 16, &c_ras)) + printf ("...read returns an error\n"); + for (i=0;i<16;i++) { + for (j=0; j<16; j++) + printf ("%3d ", c_ras[i*16+j]); + printf ("\n"); + } + break; + + case 'c': /* CLEAR FRAME */ + if (cdl_clearFrame (cdl)) + printf ("...returns an error\n"); + break; + + case 'd': /* DELETE MARKER */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_deleteMark (cdl, ix, iy)) + printf ("...returns an error\n"); + break; + + case 'D': /* DELETE OVERLAY */ + (void) cdl_clearOverlay (cdl); + break; + + case 'f': /* DISPLAY FITS */ + if (cdl_displayFITS (cdl, "dpix.fits", frame, FB_AUTO, 1)) + printf ("...returns an error\n"); + break; + + case 'g': /* READ IMAGE */ + if (cdl_readImage (cdl, &c_ras, &nx, &ny)) + printf ("...returns an error\n"); + printf ("corners: nx=%d ny=%d LL = [%d] UR = [%d]\n", + nx, ny, c_ras[0], c_ras[nx*ny-1]); + if (cdl_displayPix (cdl, c_ras, nx, ny, 8, frame, FB_AUTO, 0)) + printf ("...returns an error\n"); + break; + + case 'G': /* READ FB */ + if (cdl_readFrameBuffer (cdl, &c_ras, &nx, &ny)) + printf ("...returns an error\n"); + printf ("fb corners: nx=%d ny=%d LL = [%d] UR = [%d]\n", + nx, ny, c_ras[0], c_ras[nx*ny-1]); + if (cdl_displayPix (cdl, c_ras, nx, ny, 8, frame, FB_AUTO, 0)) + printf ("...returns an error\n"); + break; + + case 'i': /* DISPLAY IRAF */ + if (cdl_displayIRAF (cdl, "examples/dpix.imh", 1, frame, + FB_AUTO, 0)) + printf ("...returns an error\n"); + break; + + case 'm': /* MARK POINT */ + i = 1; + while (cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key) != 'q') { + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", + rx, ix, ry, iy, key); + if (cdl_markPoint (cdl, ix, iy, i++, 7, M_STAR, C_GREEN)) + printf ("...returns an error\n"); + } + break; + + case 'n': /* NEXT FRAME */ + frame = (frame+1 > 16 ? 1 : frame+1); + cdl_setFrame (cdl, frame); + printf ("set cdl->frame = %d\n", cdl->frame); + cdl_getFrame (cdl, &frame); + printf ("get cdl->frame = %d\n", frame); + break; + + case 'N': /* NEXT CONFIG */ + fbconfig = (fbconfig+1 > 12 ? 1 : fbconfig+1); + cdl_setFBConfig (cdl, fbconfig); + i = cdl->fbconfig - 1; + printf ("cdl->fbconfig = %d/%d [%d %d %d %d]\n", cdl->fbconfig, + i, cdl->imd->fbtab[i]->config, cdl->imd->fbtab[i]->nframes, + cdl->imd->fbtab[i]->width, cdl->imd->fbtab[i]->height); + break; + + case 'p': /* PREVIOUS FRAME */ + frame = (frame-1 < 1 ? 4 : frame-1); + cdl_setFrame (cdl, frame); + printf ("set cdl->frame = %d\n", cdl->frame); + cdl_getFrame (cdl, &frame); + printf ("get cdl->frame = %d\n", frame); + break; + + case 'P': /* PREV CONFIG */ + cdl_setFBConfig (cdl, fbconfig); + fbconfig = (fbconfig-1 < 1 ? 12 : fbconfig)-1; + i = cdl->fbconfig - 1; + printf ("cdl->fbconfig = %d/%d [%d %d %d %d]\n", cdl->fbconfig, + i, cdl->imd->fbtab[i]->config, cdl->imd->fbtab[i]->nframes, + cdl->imd->fbtab[i]->width, cdl->imd->fbtab[i]->height); + break; + + case 'q': /* QUIT */ + goto quit; + + case 'r': /* READ CURSOR */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf("cursor: x=%g/%d y=%g/%d wcs = %d key='%c' frame=%d\n", + rx, ix, ry, iy, wcs, key, wcs / 100); + break; + + case 's': /* TEXT STRING */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + if (cdl_markText (cdl, -20, iy, "testing 123", 1., 0.0, C_RED)) + printf ("...returns an error\n"); + break; + + case 't': /* TEST IMAGE */ + printf ("creating raster....\n"); + make_raster (c_ras, 512, 512, TEST_PATTERN); + cdl_setName (cdl, "test image"); + cdl_setTitle (cdl, "test title"); + printf ("displaying raster....\n"); + if (cdl_displayPix (cdl, c_ras, 512, 512, 8, frame,fbconfig,0)) + printf ("...returns an error\n"); + break; + + case 'T': /* TEST TILE */ + if (cdl_readFITS ("dpix.fits", &pix, &nx, &ny, + &bitpix, obj)) + printf ("...returns an error\n"); + printf ("nx=%d ny=%d bitpix=%d\n", nx, ny, bitpix); + cdl_clearFrame (cdl); + cdl_selectFB (cdl, 2*nx, 2*ny, &fbconfig, &fb_w, &fb_h, + &nframes, 1); + if (cdl_setWCS (cdl, "imaname", "imtitle", 1., 0., 0., -1., 0., + (float) 2*ny, 1., 255., 1)) + printf ("...returns an error\n"); + cdl_computeZscale (cdl, pix, nx ,ny, bitpix, &z1, &z2); + cdl_zscaleImage (cdl, &pix, nx ,ny, bitpix, z1, z2); + if (cdl_writeSubRaster (cdl, 0, 0, nx, ny, pix)) + printf ("...returns an error\n"); + if (cdl_writeSubRaster (cdl, nx, 0, nx, ny, pix)) + printf ("...returns an error\n"); + if (cdl_writeSubRaster (cdl, 0, ny, nx, ny, pix)) + printf ("...returns an error\n"); + if (cdl_writeSubRaster (cdl, nx, ny, nx, ny, pix)) + printf ("...returns an error\n"); + break; + + case 'w': /* SET WCS */ + if (cdl_setWCS (cdl, "imname", "imtitle", 1., 0., 0., -1., 0., + 512., 1., 255., 1)) + printf ("...returns an error\n"); + break; + + case 'W': /* GET WCS */ + if (cdl_getWCS (cdl, name, title, &a, &b, &c, &d, &tx, &ty, + &z1, &z2, &zt)) + printf ("...returns an error\n"); + printf ("name='%s' title='%s'\n a=%g b=%g c=%g d=%g ", + name, title, a, b, c, d); + printf ("tx=%g ty=%g z1=%g z2=%g zt=%d\n", tx, ty, z1, z2, zt); + break; + + case 'b': /* MARK BOX */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + lx = (int) (rx + 0.5); ly = (int) (ry + 0.5); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ux = (int) (rx + 0.5); uy = (int) (ry + 0.5); + printf ("cursor: x=%d/%d y=%d/%d\n", lx,ux,ly,uy); + if (cdl_markBox (cdl, lx, ly, ux, uy, 0, C_RED)) + printf ("...returns an error\n"); + break; + + case 'B': /* FILL BOX */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + lx = (int) (rx + 0.5); ly = (int) (ry + 0.5); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ux = (int) (rx + 0.5); uy = (int) (ry + 0.5); + printf ("cursor: x=%d/%d y=%d/%d\n", lx,ux,ly,uy); + if (cdl_markBox (cdl, lx, ly, ux, uy, 1, C_RED)) + printf ("...returns an error\n"); + break; + + case 'L': /* MARK LINE STYLES */ + break; + + case 'l': /* MARK LINE */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + lx = (int) (rx + 0.5); ly = (int) (ry + 0.5); + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ux = (int) (rx + 0.5); uy = (int) (ry + 0.5); + printf ("cursor: x=%d/%d y=%d/%d\n", lx,ux,ly,uy); + if (cdl_markLine (cdl, lx, ly, ux, uy, C_YELLOW)) + printf ("...returns an error\n"); + break; + + case '[': + cdl_setTextWidth (cdl, twidth = (twidth-1 < 1 ? 1 : --twidth)); + break; + + case ']': + cdl_setTextWidth (cdl, ++twidth); + break; + + case ',': + cdl_setLineWidth (cdl, lwidth = (lwidth-1 < 1 ? 1 : --lwidth)); + break; + + case '.': + cdl_setLineWidth (cdl, ++lwidth); + break; + + case '{': + cdl_setLineStyle (cdl, lstyle = (lstyle-1 < 1 ? 1 : --lstyle)); + break; + + case '}': + cdl_setLineStyle (cdl, ++lstyle); + break; + + case '(': /* MARK POLYLINE */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + for (i=0; i < 145; i++) { + xarray[i] = ix + i; + yarray[i] = iy + (int)(32*sin((double)(i*0.17453))); + } + if (cdl_markPolyline (cdl, xarray, yarray, 145, C_GREEN)) + printf ("...returns an error\n"); + break; + + case ')': /* MARK POLYGON */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + xarray[0] = ix - 9; yarray[0] = iy - 9; + xarray[1] = ix + 0; yarray[1] = iy + 9; + xarray[2] = ix + 9; yarray[2] = iy - 9; + if (cdl_markPolygon (cdl, xarray, yarray, 3, 1, C_GREEN)) + printf ("...returns an error\n"); + break; + + case 'e': /* MARK ELLIPSE */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markEllipse (cdl, ix, iy, 11, 7, 45.0, 0, C_RED)) + printf ("...returns an error\n"); + break; + + case 'E': /* MARK ELLIPSE */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markEllipAnnuli (cdl, ix, iy, 11, 7, 45.0, 2, 5, C_RED)) + printf ("...returns an error\n"); + break; + + case 'o': /* MARK CIRCLE */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markCircle (cdl, ix, iy, 27, 0, C_YELLOW)) + printf ("...returns an error\n"); + break; + + case 'O': /* MARK CIRCLE */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markCircAnnuli (cdl, ix, iy, 13, 2, 5, C_YELLOW)) + printf ("...returns an error\n"); + break; + + case 'M': /* MARK ALL PTS */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + cdl_markPoint (cdl,ix+00,iy, 0,13, M_BOX, C_GREEN); + cdl_markPoint (cdl,ix+15,iy, 0,13, M_PLUS, C_GREEN); + cdl_markPoint (cdl,ix+30,iy, 0,13, M_CROSS, C_GREEN); + cdl_markPoint (cdl,ix+45,iy, 0,13, M_DIAMOND,C_GREEN); + cdl_markPoint (cdl,ix+60,iy, 0,13, M_CIRCLE, C_GREEN); + cdl_markPoint (cdl,ix+75,iy, 0,13, M_STAR, C_GREEN); + cdl_markPoint (cdl,ix+90,iy, 0,13, M_HLINE, C_GREEN); + cdl_markPoint (cdl,ix+105,iy, 0,13, M_VLINE, C_GREEN); + cdl_markPoint (cdl,ix+120,iy, 0,13, M_HBLINE, C_GREEN); + cdl_markPoint (cdl,ix+135,iy, 0,13, M_VBLINE, C_GREEN); + cdl_markPoint (cdl,ix+00,iy-16,0,13, M_FILL|M_BOX, C_GREEN); + cdl_markPoint (cdl,ix+45,iy-16,0,13, M_FILL|M_DIAMOND,C_GREEN); + cdl_markPoint (cdl,ix+60,iy-16,0,13, M_FILL|M_CIRCLE, C_GREEN); + cdl_markPoint (cdl,ix+90,iy-16,0,13, M_VLINE|M_HLINE, C_GREEN); + cdl_markPoint (cdl,ix+105,iy-16,0,13, M_VLINE|M_HLINE, C_GREEN); + cdl_markPoint (cdl,ix+120,iy-16,0,13,M_VBLINE|M_HBLINE,C_GREEN); + cdl_markPoint (cdl,ix+135,iy-16,0,13,M_VBLINE|M_HBLINE,C_GREEN); + cdl_markPoint (cdl,ix+00,iy-32,0,13, M_PLUS|M_BOX, C_GREEN); + cdl_markPoint (cdl,ix+45,iy-32,0,13, M_PLUS|M_DIAMOND,C_GREEN); + cdl_markPoint (cdl,ix+60,iy-32,0,13, M_PLUS|M_CIRCLE, C_GREEN); + cdl_markPoint (cdl,ix+90,iy-32,0,13, M_HLINE|M_POINT, C_GREEN); + cdl_markPoint (cdl,ix+105,iy-32,0,13, M_VLINE|M_POINT, C_GREEN); + cdl_markPoint (cdl,ix+120,iy-32,0,13, M_HBLINE|M_POINT,C_GREEN); + cdl_markPoint (cdl,ix+135,iy-32,0,13, M_VBLINE|M_POINT,C_GREEN); + cdl_markPoint (cdl,ix+00,iy-48,0,13, M_CROSS|M_BOX, C_GREEN); + cdl_markPoint (cdl,ix+45,iy-48,0,13, M_CROSS|M_DIAMOND,C_GREEN); + cdl_markPoint (cdl,ix+60,iy-48,0,13, M_CROSS|M_CIRCLE, C_GREEN); + cdl_markPoint (cdl,ix+90,iy-48,0,13, M_VLINE|M_HLINE|M_POINT, + C_GREEN); + cdl_markPoint (cdl,ix+105,iy-48,0,13, M_HLINE|M_VLINE|M_POINT, + C_GREEN); + cdl_markPoint (cdl,ix+120,iy-48,0,13, M_VBLINE|M_HBLINE|M_POINT, + C_GREEN); + cdl_markPoint (cdl,ix+135,iy-48,0,13, M_HBLINE|M_VBLINE|M_POINT, + C_GREEN); + break; + + case '+': /* MARK PLUS */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markPoint (cdl, ix, iy, 1, 7, M_PLUS, C_KHAKI)) + printf ("...returns an error\n"); + break; + + case 'x': /* MARK CROSS */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markPoint (cdl, ix, iy, 1, 7, M_CROSS, C_CYAN)) + printf ("...returns an error\n"); + break; + + case '*': /* MARK STAR */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", rx,ix,ry,iy,key); + if (cdl_markPoint (cdl, ix, iy, 1, 7, M_STAR, C_GREEN)) + printf ("...returns an error\n"); + break; + + case '-': + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + (void) cdl_markPoint (cdl,ix, iy, 0, 30, M_HBLINE, C_RED); + break; + + case '|': + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + (void) cdl_markPoint (cdl,ix, iy, 0, 30, M_VBLINE, C_RED); + break; + + case '=': + cdl_readFrameBuffer (cdl, &pix, &nx, &ny); + cdl_printPixToFile (cdl, "foo.eps", pix, nx, ny, 1); + break; + + case '&': + clock (); + for (i=0, ix=16, iy=16; i < 512; i++) { + ix = xarray[i] = (ix+10 > 500 ? 16 : ix + 10); + iy = yarray[i] = (ix == 16 ? iy + 16: iy); + } + for (i=0; i < 512; i++) { + if (cdl_markPoint (cdl, xarray[i], yarray[i], 0, 7, + M_PLUS, C_RED)) + printf ("...returns an error\n"); + } + printf ("takes %d microseconds\n", clock()); + break; + + case 'Q': + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + printf("cursor: x=%g/%d y=%g/%d wcs = %d key='%c' frame=%d\n", + rx, ix, ry, iy, wcs, key, wcs / 100); + + (void) cdl_queryMap (cdl, wcs, name, &sx, &sy, &snx, &sny, + &dx, &dy, &dnx, &dny, obj); + printf ("\tregion='%s' ref='%s'\n", name, obj); + printf ("\tsrc = %g,%g,%d,%d dest = %d,%d,%d,%d\n", + sx, sy, snx, sny, dx, dy, dnx, dny); + + break; + + case '?': + print_help(); + break; + + case '1': /* TEXT STRING */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + if (cdl_markText (cdl, ix, iy, "test", 2, 0.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-5, iy+15, "test", 2, 45.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-20, iy+30, "test", 2, 90.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-35, iy+30, "test", 2, 135.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-40, iy+15, "test", 2, 180.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-40, iy-10, "test", 2, 225.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-30, iy-25, "test", 2, 270.0, C_GREEN)) + printf ("...returns an error\n"); + if (cdl_markText (cdl, ix-15, iy-15, "test", 2, 315.0, C_GREEN)) + printf ("...returns an error\n"); + break; + + case '2': /* TEXT STRING */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + if (cdl_markText (cdl, ix, iy, "testing", 2, 180.0, C_GREEN)) + printf ("...returns an error\n"); + break; + + case '3': /* BLINKING MARKER */ + (void) cdl_readCursor (cdl, 0, &rx, &ry, &wcs, &key); + ix = (int) (rx + 0.5); iy = (int) (ry + 0.5); + cdl_blinkCircle (cdl, ix, iy, 10, C_YELLOW, 5); + break; + + case '4': /* BLINKING MARKER */ + (void) cdl_setCursor (cdl, 100, 100, 0); + break; + } + printf ("Command: "); + + /* gets(cmd); */ + scanf ("%s", cmd); + } while (cmd[0] != 'q'); + +quit: (void) cdl_close (cdl); +} + +cdl_blinkCircle (cdl, x, y, r, color, nblinks) +CDLPtr cdl; +int x; +int y; +int r; +int color; +int nblinks; +{ + char *init, *mark, *blink; + int i, dim = 2*r + 2, DIM=4*r + 2; + + init = (char *) malloc (DIM*DIM); + mark = (char *) malloc (dim*dim); + blink = (char *) malloc (DIM*DIM); + + cdl_readSubRaster (cdl, x-dim, y-dim, DIM, DIM, &init); + + cdl_setLineWidth (cdl, 3); + cdl_markCircle (cdl, x, y, 2*r-1, 0, color); + cdl_readSubRaster (cdl, x-dim, y-dim, DIM, DIM, &blink); + cdl_setLineWidth (cdl, 1); + + cdl_markCircle (cdl, x, y, r, 0, color); + cdl_readSubRaster (cdl, x-r, y-r, 2*r, 2*r, &mark); + + for (i=0; i - enable debug "); printf ("\n"); + printf (" < - disable debug "); + printf (" ? - help "); + printf (" , - dec linewidth "); printf ("\n"); + printf (" . - inc linewidth "); + printf (" [ - dec textwidth "); + printf (" ] - inc textwidth "); printf ("\n"); + printf (" { - dec linestyle "); + printf (" } - inc linestyle "); + printf (" Q - query mapping "); printf ("\n"); +} + + +make_raster (raster, nx, ny, color) +uchar *raster; +int nx, ny, color; +{ + register uchar pix; + register int i, j; + register float scale; + + if (color > 0) { + /* Build a solid color */ + for (i = 0; i < nx; i++) { + for (j = 0; j < ny; j++) { + raster[i * nx + j] = (uchar) color; + } + } + } else { + /* Make a test pattern. */ + for (i = 0; i < nx; i++) { + for (j = 0; j < ny; j++) { +/* Diagonal ramp +*/ + scale = 200. / (float)(ny) / 2.; + pix = (uchar) max(2, (min(200,(scale*i + scale*j)))); +/* Vertical ramp + scale = 200. / (float)(ny); + pix = (uchar) max(2, (min(200,(scale * i)))); +*/ +/* Horizontal ramp + scale = 200. / (float)(nx); + pix = (uchar) max(2, (min(200,(scale * j)))); +*/ + raster[i * nx + j] = pix; + } + } + } +} + diff --git a/vendor/x11iraf/cdl/test/coords b/vendor/x11iraf/cdl/test/coords new file mode 100644 index 00000000..7f6fcdf5 --- /dev/null +++ b/vendor/x11iraf/cdl/test/coords @@ -0,0 +1,42 @@ + 49 343 + 59 226 + 68 459 + 87 481 + 92 319 + 97 106 +113 143 +126 117 +133 391 +134 109 +134 221 +144 345 +150 83 +179 355 +182 63 +211 328 +218 439 +219 314 +225 129 +241 403 +265 340 +269 355 +288 133 +292 104 +294 178 +320 327 +321 32 +329 409 +338 325 +348 231 +349 188 +364 325 +365 124 +377 368 +381 67 +405 274 +415 187 +442 409 +452 212 +466 62 +472 232 +508 445 diff --git a/vendor/x11iraf/cdl/test/imdtest.c b/vendor/x11iraf/cdl/test/imdtest.c new file mode 100644 index 00000000..d43c023e --- /dev/null +++ b/vendor/x11iraf/cdl/test/imdtest.c @@ -0,0 +1,336 @@ +#include +#define CDL_LIBRARY_SOURCE +#include "cdl.h" + +#define TEST_PATTERN -1 + +/* Utility macros. */ +#define max(a,b) (a > b ? a : b) +#define min(a,b) (a < b ? a : b) + + +/* IMDTEST -- Test routines for the IMD package. + */ + +main() +{ + IMDPtr imd, imd_open(); + char key, cmd[2], name[SZ_NAME], title[SZ_NAME]; + int i, j, zt=1, frame=1, fbconfig=2, color=201; + int debug = 1, nx, ny, ix=128, iy=128, wcs=0; + int xarray[1024], yarray[1024]; + float rx=128., ry=128.; + float a, b, c, d, tx, ty, z1, z2; + uchar pix, raster[1024*1024]; + + imd_setDebug (debug); + com_setDebug (debug); + if ((imd = imd_open ((char *)getenv("IMTDEV"))) == (IMDPtr) NULL) + exit (); + + cmd[0] = 'd'; + cmd[1] = '\n'; + print_help(); + do { + switch (cmd[0]) { + case '+': /* ENABLE DEBUG */ + imd_setDebug (++debug); + break; + + case '-': /* DISABLE DEBUG */ + imd_setDebug (--debug); + break; + + case 's': /* SAMPLE CURSOR */ + sleep (2); + if (imd_readCursor (imd, 1, &rx, &ry, &wcs, &key)) + printf ("...returns an error\n"); + printf ("cursor: x=%g y=%g key='%c'\n", rx, ry, key); + break; + + case 'c': /* SET CURSOR */ + sleep (2); + if (imd_setCursor (imd, 256, 256)) + printf ("...returns an error\n"); + break; + + case 'C': /* READ CURSOR */ + if (imd_readCursor (imd, 0, &rx, &ry, &wcs, &key)) + printf ("...returns an error\n"); + ix = (int) rx; + iy = (int) ry; + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", + rx, ix, ry, iy, key); + break; + + case 'd': /* WRITE IMAGE */ + printf ("creating raster....\n"); + /* + make_raster (raster, 1024, 1024, TEST_PATTERN); + */ + make_raster (raster, 512, 512, TEST_PATTERN); + imd_setName (imd, "test image"); + imd_setTitle (imd, "test title"); + printf ("displaying raster....\n"); + /* + if (imd_displayImage(imd,raster,1024,1024,frame,fbconfig,1)) + printf ("...returns an error\n"); + */ + if (imd_displayImage(imd,raster,512,512,frame,fbconfig,1)) + printf ("...returns an error\n"); + break; + + case 'D': /* READ IMAGE */ + if (imd_readImage (imd, raster, &nx, &ny)) + printf ("...returns an error\n"); + printf ("corners: nx=%d ny=%d LL = [%d] UR = [%d]\n", + nx, ny, raster[0], raster[nx*ny-1]); + if (imd_displayImage(imd,raster,nx,ny,frame,fbconfig,1)) + printf ("...returns an error\n"); + break; + + case 'e': /* ERASE FRAME */ + if (imd_clearFrame (imd)) + printf ("...returns an error\n"); + break; + + case 'F': /* READ FB */ + if (imd_readFrameBuffer (imd, raster, &nx, &ny)) + printf ("...returns an error\n"); + printf ("fb corners: nx=%d ny=%d LL = [%d] UR = [%d]\n", + nx, ny, raster[0], raster[nx*ny-1]); + if (imd_displayImage(imd,raster,nx,ny,frame,fbconfig,1)) + printf ("...returns an error\n"); + break; + + case 'm': /* MARK POINT */ + for (key='z'; key != 'q'; ) { + if (imd_readCursor (imd, 0, &rx, &ry, &wcs, &key)) + printf ("...returns an error\n"); + ix = (int) rx; + iy = (int) ry; + printf ("cursor: x=%g/%d y=%g/%d key='%c'\n", + rx, ix, ry, iy, key); + make_raster (raster, 16, 16, color); + color = (color+1 > 209 ? 201 : color+1); + if (imd_writeSubRaster (imd, ix-8, iy-8, 16, 16, raster)) + printf ("...returns an error\n"); + } + break; + + case 'n': /* NEXT FRAME */ + frame = (frame+1 > 4 ? 1 : frame+1); + if (imd_setFrame (imd, frame)) + printf ("...returns an error\n"); + printf ("imd->frame = %d\n", imd->frame); + break; + + case 'N': /* NEXT CONFIG */ + fbconfig = (fbconfig+1 > 12 ? 1 : fbconfig+1); + if (imd_setFBConfig (imd, fbconfig)) + printf ("...returns an error\n"); + i = imd->fbconfig - 1; + printf ("imd->fbconfig = %d/%d [%d %d %d %d]\n", imd->fbconfig, + i, imd->fbtab[i]->config, imd->fbtab[i]->nframes, + imd->fbtab[i]->width, imd->fbtab[i]->height); + break; + + case 'p': /* PREVIOUS FRAME */ + frame = (frame-1 < 1 ? 4 : frame-1); + if (imd_setFrame (imd, frame)) + printf ("...returns an error\n"); + printf ("imd->frame = %d\n", imd->frame); + break; + + case 'P': /* PREV CONFIG */ + if (imd_setFBConfig (imd, fbconfig)) + printf ("...returns an error\n"); + fbconfig = (fbconfig-1 < 1 ? 12 : fbconfig)-1; + i = imd->fbconfig - 1; + printf ("imd->fbconfig = %d/%d [%d %d %d %d]\n", imd->fbconfig, + i, imd->fbtab[i]->config, imd->fbtab[i]->nframes, + imd->fbtab[i]->width, imd->fbtab[i]->height); + break; + + case 'q': /* QUIT */ + goto quit; + case 'f': /* (FAST) REGION */ + make_raster (raster, 256, 256, TEST_PATTERN); + for (i=0; i < 256; i++) /* diagonal */ + (void) imd_writeSubRaster(imd,i,i,256,256,raster); + for (; i > 0; i--) /* left */ + (void) imd_writeSubRaster(imd,i,256,256,256,raster); + for (i=256; i > 0; i--) /* down */ + (void) imd_writeSubRaster(imd,0,i,256,256,raster); + for (i=0; i < 256; i++) /* right */ + (void) imd_writeSubRaster(imd,i,0,256,256,raster); + for (i=0; i < 256; i++) /* up */ + (void) imd_writeSubRaster(imd,256,i,256,256,raster); + break; + case 'r': /* WRITE REGION */ + make_raster (raster, 256, 256, TEST_PATTERN); + for (i=0; i < 100; i++) { + if (imd_writeSubRaster (imd,103+i,103+i,256,256,raster)) { + printf ("...returns an error\n"); + break; + } + } + + /* Old test to make sure we clip properly. + + make_raster (raster, 32, 32, color); + if (imd_writeSubRaster (imd, -16, -16, 32, 32, raster)) + printf ("...returns an error\n"); + if (imd_writeSubRaster (imd, -16, 496, 32, 32, raster)) + printf ("...returns an error\n"); + if (imd_writeSubRaster (imd, 496, -16, 32, 32, raster)) + printf ("...returns an error\n"); + if (imd_writeSubRaster (imd, 496, 496, 32, 32, raster)) + printf ("...returns an error\n"); + */ + color = (color+1 > 209 ? 201 : color+1); + break; + + case 'R': /* READ REGION */ + if (imd_readSubRaster (imd, -8, -8, 16, 16, raster)) + printf ("...returns an error\n"); + for (i=15; i > 0; i--) { + for (j=0; j < 16; j++) { + printf ("%3d ", raster[i * 16 + j]); + raster[i * 16 + j] = 0; + } + printf ("\n"); + } + if (imd_writeSubRaster (imd, -8, -8, 16, 16, raster)) + printf ("...returns an error\n"); + break; + + case 'w': /* SET WCS */ + if (imd_setWCS (imd, "imaname", "imtitle", 1., 0., 0., -1., 0., + 0., 1., 255., 1)) + printf ("...returns an error\n"); + break; + + case 'W': /* GET WCS */ + if (imd_setWCS (imd, name, title, &a, &b, &c, &d, &tx, &ty, + &z1, &z2, &zt)) + printf ("...returns an error\n"); + printf ("name='%s' title='%s'\n a=%g b=%g c=%g d=%g tx=%g ty=%g z1=%g z2=%g zt=%d\n", name, title, a, b, c, d, tx, ty, z1, z2, zt); + break; + + case '?': + print_help(); + break; + + case '1': /* WRITE CLIPPING */ + printf ("creating raster....\n"); + make_raster (raster, 512, 512, TEST_PATTERN); + imd_setFrame (imd, frame); + imd_clearFrame (imd); + imd_setFBConfig (imd, fbconfig); + imd_setName (imd, "test image"); + imd_setTitle (imd, "test title"); + printf ("displaying raster....\n"); + if (imd_writeImage(imd,raster,512,512,-8, -8)) + printf ("...returns an error\n"); + break; + + case '2': /* READ CLIPPING */ + if (imd_readSubRaster (imd, -8, -8, 16, 16, raster)) + printf ("...returns an error\n"); + for (i=15; i >= 0; i--) { + for (j=0; j < 16; j++) + printf ("%3d ", raster[i * 16 + j]); + printf ("\n"); + } + if (imd_writeSubRaster (imd, -8, -8, 16, 16, raster)) + printf ("...returns an error\n"); + break; + + case 'a': + clock (); + for (i=0, ix=16, iy=16; i < 1024; i++) { + ix = xarray[i] = (ix+10 > 500 ? 16 : ix + 10); + iy = yarray[i] = (ix == 16 ? iy + 16: iy); + } + for (i=0; i < 1024; i++) { + make_raster (raster, 8, 8, color); + color = (color+1 > 209 ? 201 : color+1); + if (imd_writeSubRaster (imd, xarray[i], yarray[i], + 8, 8, raster)) + printf ("...returns an error\n"); + } + printf ("takes %d microseconds\n", clock()); + } + printf ("Command: "); + + scanf ("%s", cmd); + } while (cmd[0] != 'q'); + +quit: (void) imd_close (imd); +} + + +print_help () +{ + printf ("\n"); + printf (" c - set cursor "); + printf (" C - read cursor "); + printf (" d - write image "); printf ("\n"); + printf (" D - read image "); + printf (" e - erase frame "); + printf (" F - read frame buf "); printf ("\n"); + printf (" m - mark points "); + printf (" n - next frame "); + printf (" N - next config "); printf ("\n"); + printf (" p - previous frame "); + printf (" P - prev config "); + printf (" q - quit "); printf ("\n"); + printf (" r - write region "); + printf (" R - read region "); + printf (" s - sample cursor "); printf ("\n"); + printf (" w - set wcs "); + printf (" W - get wcs "); + printf (" ? - print help "); printf ("\n"); + printf (" + - enable debug "); + printf (" - - disable debug "); printf ("\n"); +} + + +make_raster (raster, nx, ny, color) +uchar *raster; +int nx, ny, color; +{ + register uchar pix; + register int i, j; + register float scale; + + if (color > 0) { + /* Build a solid color */ + for (i = 0; i < nx; i++) { + for (j = 0; j < ny; j++) { + raster[i * nx + j] = (uchar) color; + } + } + } else { + /* Make a test pattern. */ + for (i = 0; i < nx; i++) { + for (j = 0; j < ny; j++) { +/* Diagonal ramp +*/ + scale = 200. / (float)(ny) / 2.; + pix = (uchar) max(2, (min(200,(scale*i + scale*j)))); +/* Vertical ramp + scale = 200. / (float)(ny); + pix = (uchar) max(2, (min(200,(scale * i)))); +*/ +/* Horizontal ramp + scale = 200. / (float)(nx); + pix = (uchar) max(2, (min(200,(scale * j)))); +*/ + raster[i * nx + j] = pix; + } + } + } +} + diff --git a/vendor/x11iraf/cdl/test/zzdebug.x b/vendor/x11iraf/cdl/test/zzdebug.x new file mode 100644 index 00000000..352b0657 --- /dev/null +++ b/vendor/x11iraf/cdl/test/zzdebug.x @@ -0,0 +1,44 @@ +include "../cdlspp.h" + +# ZZDEBUG -- Quickie demo tasks of the CDL SPP language binding. + + +task display = t_display, + tvmark = t_tvmark, + rimcur = t_rimcur + + +procedure t_display () +int ier +begin + call cdl_open ("", ier) + call cdl_displayIRAF ("/iraf/iraf/dev/pix.imh", 1, 1, 1, 1, ier) + call cdl_close () +end + +procedure t_tvmark () +int ier +begin + call cdl_open ("", ier) + call cdl_displayIRAF ("/iraf/iraf/dev/pix.imh", 1, 1, 1, 1, ier) + call cdl_markCoordsFile ("coords", M_PLUS, 11, C_GREEN, YES, ier) + call cdl_close () +end + +procedure t_rimcur () +int ier +char key +real x, y +begin + call cdl_open ("", ier) + key = 'a' + while (key != 'q' && key != EOS) { + call cdl_readCursor (0, x, y, key, ier) + call printf ("x=%.2g y=%.2g key='%c' ier=%d\n") + call pargr (x) + call pargr (y) + call pargc (key) + call pargi (ier) + } + call cdl_close () +end diff --git a/vendor/x11iraf/cdl/vximtool.c b/vendor/x11iraf/cdl/vximtool.c new file mode 100644 index 00000000..e0b4b0fe --- /dev/null +++ b/vendor/x11iraf/cdl/vximtool.c @@ -0,0 +1,2130 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#include +#include +#include +#if defined(AIX) || defined(AIXV3) || defined (AIXV4) +#include +#endif +#include +#include +#include +#include +#include +#include + + +#ifdef HAVE_CDL /* If we have the CDL we can build a proxy server. */ +#include "cdl.h" +#endif + + +/* + * VXIMTOOL.C -- Virtual image display server. This is a server process much + * like XIMTOOL, except that all the process does is respond to datastream + * requests to read and write to internal frame buffers maintained as arrays + * in memory. Multiple frame buffers and frame buffer configurations are + * supported. A log is kept to the stderr of all datastream requests. The + * process is terminated with an EOF on the stdin. + * + * + * To build: cc vximtool.c -o vximtool + * cc vximtool.c -o vximtool -lsocket # For Solaris systems + * cc -DANSI_FUNC vximtool.c # Use ANSI function prototypes + * + * Usage: vximtool -verbose >& spool # run server, log output + * vximtool -i # run interactively + * vximtool -noraster # don't store images in memory + * vximtool -i < cursor_file # take cursor input from file + * + * Options + * + * vximtool [-background] [-config ] [-fifo ] [-fifo_only] [-help] + * [-i] [-imtoolrc ] [-inet_only | -port_only] [-noraster] + * [-nframes ] [-port ] [-proxy] [-verbose] [-unix ] + * [-unix_only] + * + * + * Minimal match for command line options may be used. In interactive mode, + * cursor value strings may be typed in on the server stdin in response to + * cursor read requests from the client. Otherwise, a constant cursor value + * "1.0 1.0 101 q" is returned. + */ + + +/* Default values, size limiting values. + */ +#define MAX_FBCONFIG 128 /* max possible frame buf sizes */ +#ifndef HAVE_CDL +#define MAX_FRAMES 16 /* max number of frames */ +#endif +#define MAX_MAPPINGS 32 /* max number mappings/frame */ +#define MAX_CLIENTS 8 /* max display server clients */ +#define DEF_NFRAMES 1 /* save memory; only one frame */ +#define DEF_FRAME_WIDTH 512 /* 512 square frame */ +#define DEF_FRAME_HEIGHT 512 /* 512 square frame */ + +#define SZ_LABEL 256 /* main frame label string */ +#define SZ_IMTITLE 128 /* image title string */ +#define SZ_FIFOBUF 4000 /* transfer size for FIFO i/o */ +#define SZ_FNAME 256 +#define SZ_LINE 256 + +/* Magic numbers. */ +#define DEF_PORT 5137 /* default tcp/ip socket */ +#define DEF_PROXY_PORT 5136 /* default proxy socket */ +#define I_DEVNAME "/dev/imt1o" /* pseudo device names */ +#define O_DEVNAME "/dev/imt1i" /* our IN is client's OUT */ +#define DEF_UNIXADDR "/tmp/.IMT%d" /* default unix socket */ +#define FBCONFIG_1 ".imtoolrc" +#define FBCONFIG_2 "/usr/local/lib/imtoolrc" +#define FBCONFIG_ENV1 "imtoolrc" +#define FBCONFIG_ENV2 "IMTOOLRC" + +/* IIS definitions. */ +#define IO_TIMEOUT 30 +#define MAXCONN 5 +#define SZ_IOBUF 65536 /* max size data transfer */ +#define SZ_FIFOBUF 4000 +#define SZ_OLD_WCSBUF 320 /* old WCS text buffer size */ +#define SZ_WCSBUF 1024 /* WCS text buffer size */ +#define SZ_FNAME 256 +#define SZ_IMCURVAL 160 + +#define IIS_VERSION 10 /* version 10 -> 1.0 */ + +#define MEMORY 01 /* frame buffer i/o */ +#define LUT 02 /* lut i/o */ +#define FEEDBACK 05 /* used for frame clears */ +#define IMCURSOR 020 /* logical image cursor */ +#define WCS 021 /* used to set WCS */ + +#define PACKED 0040000 +#define COMMAND 0100000 +#define IIS_READ 0100000 +#define IMC_SAMPLE 0040000 +#define IMT_FBCONFIG 077 +#define XYMASK 077777 + +struct iism70 { /* DO NOT change the order of */ + short tid; /* this structure. */ + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; +}; + +/* IIS data pixel values. */ +#define CMS_DATASTART 1 +#define CMS_DATAEND 200 +#define CMS_DATARANGE 200 + +/* WCS definitions. */ +#define W_UNITARY 0 +#define W_LINEAR 1 +#define W_LOG 2 +#define W_DEFFORMAT " %7.2f %7.2f %7.1f%c" + +/* Rotation matrix defining world coordinate system (WCS) of a frame. */ +typedef struct { + int valid; /* has WCS been set? */ + float a, b; /* x, y scale factors */ + float c, d; /* x, y cross factors */ + float tx, ty; /* x, y translation */ + float z1, z2; /* greyscale range */ + int zt; /* greyscale mapping */ + char format[32]; /* wcs output format */ + char imtitle[SZ_IMTITLE+1]; /* image title from WCS */ +} Ctran, *CtranPtr; + +/* Coordinate mappings on each frame buffer. */ +typedef struct { + int id; /* object id */ + Ctran ctran; /* world coordinate system */ + char ref[SZ_FNAME+1]; /* image reference from WCS */ + int regid; /* region id */ + char region[SZ_FNAME+1]; /* region name from WCS */ + float sx, sy; /* source rect */ + int snx, sny; + int dx, dy; /* destination rect */ + int dnx, dny; +} Mapping, *MappingPtr; + +/* The frame buffers. */ +typedef struct { + int frameno; /* frame number */ + char *framebuf; /* frame buffer raster */ + char label[SZ_LABEL+1]; /* frame label string */ + Ctran ctran; /* world coordinate system */ + char wcsbuf[SZ_WCSBUF]; /* wcs info string */ + Mapping mapping[MAX_MAPPINGS]; /* coordinate mappings */ + int nmaps; /* number of defined mappings */ +} FrameBuf, *FrameBufPtr; + +/* Possible frame buffer sizes. */ +typedef struct { + int nframes; /* number of frames */ + int width; /* frame buffer width */ + int height; /* frame buffer height */ +} FbConfig, *FbConfigPtr; + +/* Client I/O channel. */ +typedef struct { + void *vxim; /* backpointer to vxim descriptor */ + int type; /* channel type */ + int listen_fd; /* socket server fd */ + int datain; /* input channel */ + int dataout; /* output channel */ + int keepalive; /* used to keep input fifo ready */ + int connected; /* channel is connected to client */ + int port; /* inet port number */ + char path[SZ_FNAME+1]; /* for unix sockets */ + int reference_frame; /* reference (cmd i/o) frame */ + int version; /* flags capability of client */ + FrameBufPtr rf_p; /* reference frame descriptor */ +} IoChan, *IoChanPtr; + +#define IO_FIFO 1 +#define IO_INET 2 +#define IO_UNIX 3 + + +/* Application runtime descriptor. + * -------------------------------- + */ +typedef struct { + int def_config; /* default FB config */ + int def_nframes; /* default number of frames */ + char *imtoolrc; /* imtoolrc file name */ + char *input_fifo; /* client's output */ + char *output_fifo; /* client's input */ + char *unixaddr; /* format for unix socket path */ + int port; /* port for INET socket */ + + /* Internal state. */ + int display_frame; /* currently displayed frame */ + int fb_configno; /* current config number */ + int nframes; /* current number of frame bufs */ + int width, height; /* current width, height */ + IoChan chan[MAX_CLIENTS]; /* client i/o descriptors */ + FrameBufPtr df_p; /* display frame descriptor */ + FrameBuf frames[MAX_FRAMES]; /* array of frame descriptors */ + FbConfig fb_config[MAX_FBCONFIG]; /* fb config table */ + +} VXimData, *VXimDataPtr; + + +/* Initialize the structure with out starting values. These can be reset + * with command line options. + */ +VXimData server_data = { + 1, /* def_config */ + DEF_NFRAMES, /* def_nframes */ + FBCONFIG_2, /* def_imtoolrc */ + O_DEVNAME, /* input_fifo */ + I_DEVNAME, /* output_fifo */ + DEF_UNIXADDR, /* unixaddr */ + DEF_PORT, /* port */ + 1, /* display_frame */ + 1, /* fb_configno */ + 2, /* nframes */ + 512, 512 /* width, height */ +}; + +/* Functions. + */ +#ifndef abs +#define abs(a) (((a)<0)?(-(a)):(a)) +#endif +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef max +#define max(a,b) ((a)<(b)?(b):(a)) +#endif + +#ifdef SOLARIS +#define bzero(a,n) memset(a,0,n) +#define bcopy(a,b,n) memmove(b,a,n) +#endif + +#define SELWIDTH 32 + +#ifdef HAVE_CDL +static int proxy = 0; +static int nclients = 0; +CDLPtr cdl[MAX_CLIENTS]; +#endif +static int keep_raster = 1; +extern int errno; +static int background = 0; +static int objid = 0; +static int verbose = 0; +static int interactive = 0; +static float cursor_x = 1.0, cursor_y = 1.0; +static fd_set fds, allset; + + +#ifdef ANSI_FUNC + +int main(int argc, char **argv); +static int vx_iisopen(register VXimDataPtr vxim); +static void vx_iisclose(register VXimDataPtr vxim); +static IoChanPtr open_fifo(register VXimDataPtr vxim); +static IoChanPtr open_inet(register VXimDataPtr vxim); +static IoChanPtr open_unix(register VXimDataPtr vxim); +static void vx_connectClient(IoChanPtr chan, int *source); +static void vx_disconnectClient(register IoChanPtr chan); +static IoChanPtr get_iochan(register VXimDataPtr vxim); +static void vx_iisio(IoChanPtr chan, int *fd_addr, int source); +static void set_fbconfig(IoChanPtr chan, int config, int frame); +static int decode_frameno(register int z); +static void bswap2(char *a, char *b, int nbytes); +static void vx_retCursorVal(register int dataout, float sx, float sy, + int wcs, int key, char *strval); +static CtranPtr wcs_update(register VXimDataPtr vxim, FrameBufPtr fr); +static void vx_initialize(register VXimDataPtr vxim, int config, + int nframes, int reset); +static void vx_initFrame(register VXimDataPtr vxim, int frame, + int nframes, FbConfigPtr config); +static void vx_eraseFrame(register VXimDataPtr vxim, int frame); +static void get_fbconfig(register VXimDataPtr vxim); +static void Usage(void); +static void printoption(char *st); +static void add_mapping(register VXimDataPtr vxim, CtranPtr ctran, + char *wcsbuf, FrameBufPtr fr); +#ifdef HAVE_CDL +static void vx_flip(char *buffer, int nx, int ny); +#endif +static int iis_read (int fd, void *vptr, int nbytes); +static int iis_write (int fd, void *vptr, int nbytes); + +#else + +static void vx_iisclose(), vx_connectClient(), vx_disconnectClient(); +static void vx_iisio(), set_fbconfig(), vx_retCursorVal(); +static void vx_initialize(), vx_initFrame(), vx_eraseFrame(); +static void get_fbconfig(), Usage(), printoption(); +static void add_mapping(); +#ifdef HAVE_CDL +static void vx_flip(); +#endif +static int vx_iisopen(), decode_frameno(), iis_read(), iis_write(); +static void bswap2(); +static IoChanPtr open_fifo(), open_inet(), open_unix(), get_iochan(); +static CtranPtr wcs_update(); + +#endif + + +/* + * VXIMTOOL -- Virtual display server process. This task is an image display + * server like XImtool, responding to datastream requests on fifo pipes, + * inet sockets, or unix sockets. Up to 16 frames are supported, frame + * buffers may be any of the defined frames in the imtoolrc file. Images + * are stored in memory, allowing readback by the client. Cursor input can + * come from stdin (or a redirected file) allowing the user to respond to + * client cursor requests. The task is terminated with an EOF on stdin. + */ + +#ifdef ANSI_FUNC + +int +main (int argc, char **argv) +#else + +main (argc, argv) +int argc; +char **argv; +#endif +{ + register VXimDataPtr vxim = &server_data; + register IoChanPtr chan; + register int i, nopen, n; + char buf[SZ_FNAME]; + int fd; + + /* Process the command line arguments. */ + for (i=1; i < argc; i++) { + +#ifdef HAVE_CDL + /* Anything without a '-' is a client device to add to the proxy + * list. Format of the arg must be a valid IMTDEV string. + */ + if (proxy && argv[i][0] != '-') { + if ((cdl[nclients++] = cdl_open (argv[i])) == (CDLPtr) NULL) + nclients--; + else if (verbose) + printf ("Connected to server on %s\n", argv[i]); + continue; + } +#endif + if (strncmp (argv[i], "-background", 2) == 0) { + background = 1; + } else if (strncmp (argv[i], "-config", 2) == 0) { + vxim->def_config = atoi (argv[++i]); + } else if (strncmp (argv[i], "-fifo_only", 6) == 0) { + vxim->unixaddr = "none"; + vxim->port = 0; + } else if (strncmp (argv[i], "-fifo", 5) == 0) { + vxim->input_fifo = (char *) calloc (SZ_FNAME, sizeof(char)); + vxim->output_fifo = (char *) calloc (SZ_FNAME, sizeof(char)); + sprintf (vxim->input_fifo, "%si", argv[++i]); + sprintf (vxim->output_fifo, "%so", argv[i]); + } else if (strncmp (argv[i], "-help", 2) == 0) { + Usage (); + exit (0); + } else if (strncmp (argv[i], "-imtoolrc", 3) == 0) { + vxim->imtoolrc = argv[++i]; + } else if (strncmp (argv[i], "-inet_only", 3) == 0) { + vxim->input_fifo = ""; + vxim->unixaddr = "none"; + } else if (strcmp (argv[i], "-i") == 0) { + interactive++; + } else if (strncmp (argv[i], "-noraster", 3) == 0) { + keep_raster = 0; + } else if (strncmp (argv[i], "-nframes", 3) == 0) { + i++; + vxim->def_nframes = min (MAX_FRAMES, atoi (argv[i])); + } else if (strncmp (argv[i], "-port_only", 6) == 0) { + vxim->input_fifo = ""; + vxim->unixaddr = "none"; + } else if (strncmp (argv[i], "-port", 5) == 0) { + vxim->port = atoi (argv[++i]); +#ifdef HAVE_CDL + } else if (strncmp (argv[i], "-proxy", 5) == 0) { + proxy = 1; + vxim->port = DEF_PROXY_PORT; /* re-assign port */ + vxim->input_fifo = ""; /* shut off other connections */ + vxim->unixaddr = "none"; +#endif + } else if (strncmp (argv[i], "-verbose", 2) == 0) { + verbose = 1; + } else if (strncmp (argv[i], "-unix_only", 6) == 0) { + vxim->input_fifo = ""; + vxim->port = 0; + } else if (strncmp (argv[i], "-unix", 5) == 0) { + vxim->unixaddr = argv[++i]; + } + } + +#ifdef HAVE_CDL + /* If we're acting as a proxy server, but can't connect to anything, + * exit. In this case it is required that the servers be running + * before starting the proxy program so we have a connection waiting. + */ + if (!nclients && proxy) { + fprintf (stderr, "Error: No servers available for display.\007\n"); + exit (-1); + } +#endif + + /* Initialize the frame buffers */ + vx_initialize (vxim, vxim->def_config, vxim->def_nframes, 1); + + /* Listen for a client connection and initialize the fdset. */ + if (!(nopen = vx_iisopen (vxim))) { + fprintf (stderr, "Error: Cannot open client communications.\007\n"); + exit (-1); + } + FD_ZERO (&allset); + for (i=0; i < nopen; i++) { + chan = &vxim->chan[i]; + FD_SET (chan->datain, &allset); + } + if (!background || interactive) + FD_SET (fileno(stdin), &allset); + + /* Sit in a loop waiting on input, processing the events. */ + while (1) { + fds = allset; /* reset the FD set on each pass */ + + if ((n = select (SELWIDTH, &fds, NULL, NULL, NULL)) > 0) { + + /* Loop over each of the open connections, checking for and + * processing input on any that are ready. + */ + for (i=0; i < nopen; i++) { + chan = &vxim->chan[i]; + fd = chan->datain; + if (FD_ISSET(fd, &fds)) { + + /* Connect the client if not already connected. */ + if (!chan->connected) { + if (verbose) { + if (chan->type == IO_UNIX) + fprintf (stderr, + "connecting client on %s\n", + chan->path); + else if (chan->type == IO_INET) + fprintf (stderr, + "connecting client on port %d\n", + vxim->port); + } + vx_connectClient (chan, &chan->datain); + } + + /* Process any waiting input. */ + vx_iisio (chan, &chan->datain, chan->type); + fflush (stdout); fflush (stderr); + } + } + + /* Check the stdin for an EOF so we can quit gracefully. */ + if (!background) { + if (FD_ISSET(fileno(stdin), &fds)) { + if ((n = read (fileno(stdin), buf, SZ_FNAME)) <= 0) { + /* Shut it down. */ + vx_iisclose (vxim); + exit (0); + } + } + } + + } else if (n < 0) { + fprintf (stderr, "Error: select error\007\n"); + exit (-1); + } + } +} + + + +/* VX_IISOPEN -- Initialize the IIS protocol module and ready the module to + * accept client connections and begin processing client requests. Clients + * may connect to the server using a fifo connection or an internet or + * UNIX domain socket connection. All three types of server ports are + * simultaneously ready to receive client connections. + */ +#ifdef ANSI_FUNC + +static int +vx_iisopen (register VXimDataPtr vxim) +#else + +static int +vx_iisopen (vxim) +register VXimDataPtr vxim; +#endif +{ + int nopen = 0; + + if (open_fifo (vxim)) + nopen++; + if (open_inet (vxim)) + nopen++; + if (open_unix (vxim)) + nopen++; + + return (nopen); +} + + +/* VX_IISCLOSE -- Close down the IIS protocol module. + */ +#ifdef ANSI_FUNC + +static void +vx_iisclose (register VXimDataPtr vxim) +#else + +static void +vx_iisclose (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan = NULL; + register FrameBufPtr fb; + register int i, j; + + for (i=0; i < (sizeof(vxim->chan) / sizeof(vxim->chan[0])); i++) { + chan = &vxim->chan[i]; + + /* Free the in-memory frame buffer rasters. */ + for (j=0; j < vxim->nframes; j++) { + fb = &vxim->frames[j]; + if (keep_raster && fb->framebuf) + free (fb->framebuf); + } + + /* Close the I/O channels. */ + switch (chan->type) { + case IO_FIFO: + if (chan->keepalive >= 0) + close (chan->keepalive); + if (chan->datain >= 0) + close (chan->datain); + if (chan->dataout >= 0) + close (chan->dataout); + chan->type = 0; + if (verbose) + fprintf (stderr, "vximtool: closing fifo connection\n"); + break; + + case IO_INET: + close (chan->datain); + chan->type = 0; + if (verbose) + fprintf (stderr, "vximtool: closing inet socket\n"); + break; + + case IO_UNIX: + close (chan->datain); + unlink (chan->path); + chan->type = 0; + if (verbose) + fprintf (stderr, "vximtool: closing unix socket\n"); + break; + } + } +} + + +/* OPEN_FIFO -- Open the server fifo port and make ready to accept client + * connections and begin processing client requests. There is no client + * yet at this stage. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_fifo (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_fifo (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan; + int datain, dataout; + int keepalive; + + /* Setting the input fifo to "none" or the null string disables + * fifo support. + */ + if (!vxim->input_fifo[0] || strcmp(vxim->input_fifo,"none")==0) + return (NULL); + + datain = dataout = -1; + + /* Open the output fifo (which is the client's input fifo). We have + * to open it ourselves first as a client to get around the fifo + * open-no-client error. + */ + if ((datain = open (vxim->input_fifo, O_RDONLY|O_NDELAY)) != -1) { + if ((dataout = open (vxim->input_fifo, O_WRONLY|O_NDELAY)) != -1) + fcntl (dataout, F_SETFL, O_WRONLY); + else + goto done; + close (datain); + } else + goto done; + + /* Open the input stream, a FIFO pseudodevice file used by + * applications to send us commands and data. + */ + if ((datain = open (vxim->output_fifo, O_RDONLY|O_NDELAY)) == -1) + goto done; + else { + /* Clear O_NDELAY for reading. */ + fcntl (datain, F_SETFL, O_RDONLY); + + /* Open the client's output fifo as a pseudo-client to make it + * appear that a client is connected. + */ + keepalive = open (vxim->output_fifo, O_WRONLY); + } +done: + /* Allocate and fill in i/o channel descriptor. */ + if (datain > 0 && dataout > 0 && (chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_FIFO; + chan->datain = datain; + chan->dataout = dataout; + chan->keepalive = keepalive; + chan->connected = 1; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + } else { + fprintf (stderr, "Warning: cannot open %s\n", vxim->output_fifo); + chan = NULL; + } + + /* Register input callback. */ + if (!chan) { + if (datain > 0) + close (datain); + if (dataout > 0) + close (dataout); + } else if (verbose) { + fprintf (stderr, + "vximtool: Open to accept input on fifo: %s\n", vxim->input_fifo); + } + + return (chan); +} + + +/* OPEN_INET -- Set up a port to be used for incoming client connections + * using internet domain sockets. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_inet (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_inet (vxim) +register VXimDataPtr vxim; +#endif +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_in sockaddr; + + /* Setting the port to zero disables inet socket support. */ + if (vxim->port <= 0) + return (NULL); + + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons((short)vxim->port); + sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if ((chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_INET; + chan->port = vxim->port; + chan->datain = s; + chan->dataout = s; + chan->listen_fd = s; + chan->connected = 0; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + if (verbose) + fprintf (stderr, + "vximtool: Open to accept input on inet: port %d\n", + vxim->port); + return (chan); + } +err: + fprintf (stderr, "vximtool: cannot open socket on port %d, errno=%d\n", + vxim->port, errno); + if (s) + close (s); + return (NULL); +} + + +/* OPEN_UNIX -- Set up a port to be used for incoming client connections + * using unix domain sockets. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_unix (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_unix (vxim) +register VXimDataPtr vxim; +#endif +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_un sockaddr; + char path[256]; + + /* Setting the addr to "none" or the null string disables unix + * socket support. + */ + if (!vxim->unixaddr[0] || strcmp(vxim->unixaddr,"none")==0) + return (NULL); + + /* Get path to be used for the unix domain socket. */ + sprintf (path, vxim->unixaddr, getuid()); + unlink (path); + + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strcpy (sockaddr.sun_path, path); + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if ((chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_UNIX; + chan->datain = s; + chan->dataout = s; + chan->listen_fd = s; + chan->connected = 0; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + strncpy (chan->path, path, SZ_FNAME); + if (verbose) + fprintf (stderr, + "vximtool: Open to accept input on unix: %s\n", path); + return (chan); + } +err: + fprintf (stderr, "vximtool: cannot open socket on port %s, errno=%d\n", + path, errno); + if (s) + close (s); + return (NULL); +} + + +/* VX_CONNECTCLIENT -- Called when a client has attempted a connection on + * a socket port. Accept the connection and set up a new i/o channel to + * communicate with the new client. + */ +#ifdef ANSI_FUNC + +static void +vx_connectClient (IoChanPtr chan, int *source) +#else + +static void +vx_connectClient (chan, source) +IoChanPtr chan; +int *source; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register int s; + + /* Accept connection. */ + if ((s = accept ((int)*source, (struct sockaddr *)0, (int *)0)) < 0) + return; +/* + if (fcntl (s, F_SETFD, O_RDWR|O_NDELAY) < 0) { + close (s); + return; + } +*/ + + /* Allocate and fill in i/o channel descriptor. */ + FD_SET(s, &allset); + chan->datain = s; + chan->dataout = s; + chan->connected = 1; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + + switch (chan->type) { + case IO_INET: + if (verbose) + fprintf (stderr, + "connecting client on port %d\n", chan->port); + case IO_UNIX: + if (verbose && chan->type == IO_UNIX) + fprintf (stderr, + "connecting client on %s\n", chan->path); + } +} + + +/* VX_DISCONNECTCLIENT -- Called to close a client connection when EOF is + * seen on the input port. Close the connection and free the channel + * descriptor. + */ +#ifdef ANSI_FUNC + +static void +vx_disconnectClient (register IoChanPtr chan) +#else + +static void +vx_disconnectClient (chan) +register IoChanPtr chan; +#endif +{ + switch (chan->type) { + case IO_INET: + if (verbose) + fprintf (stderr, + "disconnecting client on port %d\n", chan->port); + case IO_UNIX: + if (verbose && chan->type == IO_UNIX) + fprintf (stderr, + "disconnecting client on %s\n", chan->path); + FD_CLR(chan->datain, &allset); + close (chan->datain); + chan->datain = chan->dataout = chan->listen_fd; + chan->connected = 0; + break; + default: + break; + } +} + + +/* GET_IOCHAN --- Get an i/o channel descriptor. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +get_iochan (register VXimDataPtr vxim) +#else + +static IoChanPtr +get_iochan (vxim) +register VXimDataPtr vxim; +#endif +{ + register int i; + + for (i=0; i < MAX_CLIENTS; i++) + if (!vxim->chan[i].type) + return (&vxim->chan[i]); + + return (NULL); +} + + +/* VX_IISIO -- File i/o callback procedure, called when there is input + * pending on the data stream to the vximtool client. + */ +#ifdef ANSI_FUNC + +static void +vx_iisio (IoChanPtr chan, int *fd_addr, int source) +#else + +static void +vx_iisio (chan, fd_addr, source) +IoChanPtr chan; +int *fd_addr; +int source; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register int sum, i; + register short *p; + int datain = *fd_addr; + int dataout = chan->dataout; + int ndatabytes, nbytes, n, ntrys=0; + struct iism70 iis; + char buf[SZ_FIFOBUF]; + static int errmsg=0, bswap=0; + + + /* Get the IIS header. */ + if ((n = iis_read (datain, (char *)&iis, sizeof(iis))) < sizeof(iis)) { + if (n != 0) + fprintf (stderr, + "vximtool: command input read error, n=%d of %d, errno=%d\n", + n, sizeof(iis), errno); + if (n <= 0) + vx_disconnectClient (chan); + return; + } else if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + + /* Verify the checksum. If it fails swap the bytes and try again. + */ + for (;;) { + for (i=0, sum=0, p=(short *)&iis; i < 8; i++) + sum += *p++; + if ((sum & 0177777) == 0177777) + break; + + if (ntrys++) { + if (!errmsg++) { + fprintf (stderr, "vximtool: bad data header checksum\n"); + if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, "noswap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, " swap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + } + break; + + } else { + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + bswap = !bswap; + } + } + + ndatabytes = -iis.thingct; + if (!(iis.tid & PACKED)) + ndatabytes *= 2; + + if (verbose) { + fprintf (stderr, "%s: ", (source == IO_FIFO ? "fifo" : + (source == IO_INET ? "inet" : "unix"))); + fprintf (stderr, + "subunit=%03o tid=%06o nbytes=%6d x=%06o y=%06o z=%06o t=%06o\n", + iis.subunit & 077, + iis.tid, + ndatabytes, + iis.x & 0177777, + iis.y & 0177777, + iis.z & 0177777, + iis.t & 0177777); + fflush (stdout); + } + + + switch (iis.subunit & 077) { + case FEEDBACK: + /* The feedback unit is used only to clear a frame. + */ + chan->reference_frame = decode_frameno (iis.z & 07777); + vx_eraseFrame (vxim, chan->reference_frame); +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) + cdl_clearFrame (cdl[i]); + } +#endif + if (verbose) + fprintf (stderr, "erase frame %d - ref = %d\n", + decode_frameno(iis.z & 0177777), chan->reference_frame); + break; + + case LUT: + /* Data mode writes to the frame lookup tables are not implemented. + * A command mode write to the LUT subunit is used to connect + * image memories up to the RGB channels, i.e., to select the frame + * to be displayed. We ignore any attempt to assign multiple + * frames to multiple color channels, and just do a simple frame + * select. + */ + if (iis.subunit & COMMAND) { + int frame, z, n; + short x[14]; + + if (iis_read (datain, (char *)x, ndatabytes) == ndatabytes) { + if (bswap) + bswap2 ((char *)x, (char *)x, ndatabytes); + + z = x[0]; + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + frame = max (1, n + 1); + if (frame > vxim->nframes) { + if (frame <= MAX_FRAMES) { +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) { + cdl_setFBConfig (cdl[i], vxim->fb_configno); + cdl_setFrame (cdl[i], frame); + } + } +#endif + set_fbconfig (chan, vxim->fb_configno, frame); + if (verbose) + fprintf (stderr, "set_fbconfig (%d, %d)\n", + vxim->fb_configno, frame); + } else { + fprintf (stderr, "imtool warning: "); + fprintf (stderr, + "attempt to display nonexistent frame %d\n", + frame); + return; + } + } + + vxim->display_frame = frame; + if (verbose) + fprintf (stderr, "set_frame (%d)\n", frame); + return; + } + } + + case MEMORY: + /* Load data into the frame buffer. Data is assumed to be byte + * packed. + */ + if (iis.tid & IIS_READ) { + /* Read from the display. + */ + register FrameBufPtr fb; + unsigned char *ip, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be read from. */ + chan->reference_frame = decode_frameno (iis.z & 0177777); + fb = &vxim->frames[chan->reference_frame-1]; + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + if (x < 0 || x >= vxim->width || y < 0 || y >= vxim->height) { + fprintf (stderr, + "vximtool: attempted read out of bounds on framebuf\n"); + fprintf (stderr, + "read %d bytes at [%d,%d]\n", nbytes, x, y); + memset ((void *)iobuf, 0, min(SZ_IOBUF,nbytes)); + } else { + if (verbose) + fprintf (stderr, "read %d bytes at [%d,%d]\n", + nbytes, x, y); + if (keep_raster) + bcopy(&fb->framebuf[(y * vxim->width)+x], iobuf,nbytes); + else + bzero (iobuf, nbytes); +#ifdef HAVE_CDL + if (proxy) { + unsigned char *pix = (unsigned char *)malloc(SZ_IOBUF); + cdl_readSubRaster (cdl[0], x, + (vxim->height-y-max(1, nbytes/vxim->width)), + min(vxim->width, nbytes), + max(1, nbytes/vxim->width), + &pix); + bcopy(pix, iobuf, nbytes); + vx_flip ((char *)iobuf, min(vxim->width, nbytes), + max(1, nbytes/vxim->width)); + free ((char *)pix); + } +#endif + } + + /* Return the data from the frame buffer. */ + starttime = time(0); + for (nleft=nbytes, ip=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = iis_write (dataout, ip, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) { + fprintf (stderr, "IMTOOL: timeout on write\n"); + break; + } + } else + ip += n; + } + + return; + + } else { + /* Write to the display. + */ + register FrameBufPtr fb; + unsigned char *op, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be written into (encoded with a bit for + * each frame, 01 is frame 1, 02 is frame 2, 04 is frame 3, + * and so on). + */ + chan->reference_frame = decode_frameno (iis.z & 0177777); + fb = &vxim->frames[chan->reference_frame-1]; + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + /* Read the data into the frame buffer. + */ + starttime = time(0); + for (nleft=nbytes, op=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = iis_read (datain, op, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) + break; + } else + op += n; + } + + if (x < 0 || x >= vxim->width || y < 0 || y >= vxim->height) { + fprintf (stderr, + "vximtool: attempted write out of bounds on framebuf\n"); + fprintf (stderr, + "write %d bytes at [%d,%d]\n", nbytes, x, y); + bzero ((void *)iobuf, nbytes); + } else { + if (verbose) + fprintf (stderr, "write %d bytes at x=%d, y=%d\n", + nbytes, x, y); + if (keep_raster) + bcopy(iobuf, &fb->framebuf[(y * vxim->width)+x],nbytes); +#ifdef HAVE_CDL + if (proxy) { + vx_flip ((char *)iobuf, min(vxim->width, nbytes), + max(1, nbytes/vxim->width)); + for (i=0; i < nclients; i++) + cdl_writeSubRaster (cdl[i], x, + (vxim->height-y-max(1, nbytes/vxim->width)), + min(vxim->width, nbytes), + max(1, nbytes/vxim->width), + iobuf); + } +#endif + } + + return; + } + break; + + case WCS: + /* Read or write the WCS for a frame. The frame number to + * which the WCS applies is passed in Z and the frame buffer + * configuration in T. The client changes the frame buffer + * configuration in a WCS set. The WCS text follows the header + * as byte packed ASCII data. + */ + if (iis.tid & IIS_READ) { + /* Return the WCS for the referenced frame. + */ + char emsg[SZ_FNAME]; + char *text; + int frame; + + if ((iis.y & 0177777)) { + /* This is a check by the client on our capabilities. + * Return with a version number which can be used by the + * client. However we write back using the old WCS + * buffer size for compatability. + */ + sprintf (text=emsg, "version=%d", IIS_VERSION); + chan->version = IIS_VERSION; + + iis_write (dataout, text, SZ_OLD_WCSBUF); + if (verbose) + fprintf (stderr, "version query wcs: %s\n",text); + + } else { + frame = decode_frameno (iis.z & 0177777); + chan->reference_frame = frame; + + if (chan->rf_p->frameno <= 0) + strcpy (text=emsg, "[NOSUCHFRAME]\n"); + else + text = chan->rf_p->wcsbuf; + + if ((iis.x & 0177777)) + iis_write (dataout, text, SZ_WCSBUF); + else + iis_write (dataout, text, SZ_OLD_WCSBUF); + + if (verbose) { + fprintf (stderr, "query wcs:\n"); + write (2, text, SZ_WCSBUF); + } + } + + } else { + /* Set the WCS for the referenced frame. + */ + register CtranPtr ct; + int fb_config, frame, new_wcs = 0; + + frame = decode_frameno (iis.z & 0177777); + fb_config = (iis.t & 0777) + 1; + new_wcs = (iis.t & 0777); + + /* See if we need to change the frame buffer configuration, + * or allocate a new frame. + */ + if (fb_config != vxim->fb_configno) { + set_fbconfig (chan, fb_config, frame); +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) { + cdl_setFBConfig (cdl[i], fb_config); + cdl_setFrame (cdl[i], frame); + } + } +#endif + } else if (frame > vxim->nframes && frame < MAX_FRAMES) { + set_fbconfig (chan, vxim->fb_configno, frame); +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) { + cdl_setFBConfig (cdl[i], vxim->fb_configno); + cdl_setFrame (cdl[i], frame); + } + } +#endif + } + + /* Read in and set up the WCS. */ + chan->reference_frame = frame; + memset ((char *)buf, 0, SZ_WCSBUF); + if (iis_read (datain, buf, ndatabytes) == ndatabytes) + strncpy (chan->rf_p->wcsbuf, buf, + (new_wcs ? SZ_WCSBUF : SZ_OLD_WCSBUF)); + + if (verbose) { + fprintf (stderr, "set wcs: nbytes=%d\n", ndatabytes); + write (2, buf, ndatabytes); + } + + strcpy (chan->rf_p->ctran.format, W_DEFFORMAT); + chan->rf_p->ctran.imtitle[0] = '\0'; + chan->rf_p->ctran.valid = 0; + ct = wcs_update (vxim, chan->rf_p); + +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) + cdl_setWCS (cdl[i], " ", ct->imtitle, + ct->a, ct->b, ct->c, ct->d, + ct->tx, ct->ty, ct->z1, ct->z2, ct->zt); + } +#endif + + /* Add the mapping information. */ + add_mapping (vxim, ct, chan->rf_p->wcsbuf, + &vxim->frames[chan->reference_frame-1]); + } + return; + + case IMCURSOR: + /* Read or write the logical image cursor. This is an extension + * added to provide a high level cursor read facility; this is + * not the same as a low level access to the IIS cursor subunit. + * Cursor reads may be either nonblocking (immediate) or blocking, + * using the keyboard or mouse to terminate the read, and + * coordinates may be returned in either image (world) or frame + * buffer pixel coordinates. + */ + if (iis.tid & IIS_READ) { + /* Read the logical image cursor. In the case of a blocking + * read all we do is initiate a cursor read; completion occurs + * when the user hits a key or button. + */ + float sx, sy; + + if (verbose) + fprintf (stderr, "read cursor position\n"); + if (iis.tid & IMC_SAMPLE) { + /* Sample the cursor position and return the cursor value + * on the output datastream encoded in a fixed size + * ascii buffer. + */ + int wcs = iis.z; + + sx = cursor_x; + sy = cursor_y; +#ifdef HAVE_CDL + if (proxy) { + char key = ' '; + char curval[SZ_IMCURVAL], keystr[20]; + + cdl_readCursor (cdl[0], 1, &sx, &sy, &key); + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n", + sx, sy, 1, keystr, ""); + } + iis_write (dataout, curval, sizeof(curval)); + } else +#endif + vx_retCursorVal (chan->dataout, sx, sy, wcs, 0, ""); + + } else { + /* Initiate a user triggered cursor read. */ + char key = 'q'; +#ifdef HAVE_CDL + if (proxy) { + char curval[SZ_IMCURVAL], keystr[20]; + + cdl_readCursor (cdl[0], 0, &sx, &sy, &key); + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n\0", + sx, sy, 1, keystr, ""); + } + iis_write (chan->dataout, curval, sizeof(curval)); + } else +#endif + vx_retCursorVal (chan->dataout, 1., 1., 101, key, ""); + } + + } else { + /* Write (set) the logical image cursor position. */ + register CtranPtr ct; + int sx = iis.x, sy = iis.y; + float wx = sx, wy = sy; + int wcs = iis.z; + + if (verbose) + fprintf (stderr, "write cursor position: [%d,%d]\n", sx,sy); + if (wcs) { + ct = wcs_update (vxim, vxim->df_p); + if (ct->valid) { + if (abs(ct->a) > .001) + sx = (wx - ct->tx) / ct->a; + if (abs(ct->d) > .001) + sy = (wy - ct->ty) / ct->d; + } + } + + cursor_x = sx; + cursor_y = sy; +#ifdef HAVE_CDL + if (proxy) + cdl_setCursor (cdl[0], sx, sy, wcs); +#endif + } + return; + + default: + /* Ignore unsupported command input. + */ + fprintf (stderr, "unsupported input: subunit=%03o\n", + iis.subunit & 077); + break; + } + + /* Discard any data following the header. */ + if (!(iis.tid & IIS_READ)) + for (nbytes = ndatabytes; nbytes > 0; nbytes -= n) { + n = (nbytes < SZ_FIFOBUF) ? nbytes : SZ_FIFOBUF; + if ((n = iis_read (datain, buf, n)) <= 0) + break; + } +} + + +/* SET_FBCONFIG -- Set the frame buffer configuration, or add additional + * frames to the current configuration. + */ +#ifdef ANSI_FUNC + +static void +set_fbconfig (IoChanPtr chan, int config, int frame) +#else + +static void +set_fbconfig (chan, config, frame) +IoChanPtr chan; +int config; +int frame; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register FrameBufPtr fb = &vxim->frames[frame-1]; + register int i; + + if (config != vxim->fb_configno) { + /* Change the frame buffer configuration. */ + vx_initialize (vxim, config, + max (vxim->fb_config[config-1].nframes, frame), 1); + + } else if (frame > vxim->nframes) { + /* Add additional frames. */ + for (i=1; i <= frame; i++) { + fb = &vxim->frames[i-1]; + if (fb->frameno != i) + vx_initFrame (vxim, i, frame, &vxim->fb_config[config-1]); + } + } + + chan->reference_frame = frame; +} + + +/* DECODE_FRAMENO -- Decode encoded IIS register frame number. + */ +#ifdef ANSI_FUNC + +static int +decode_frameno (register int z) +#else + +static int +decode_frameno (z) +register int z; +#endif +{ + register int n; + + /* Get the frame number, encoded with a bit for each frame, 01 is + * frame 1, 02 is frame 2, 04 is frame 3, and so on. + */ + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + return (max (1, n + 1)); +} + + +/* BSWAP2 - Move bytes from array "a" to array "b", swapping successive + * pairs of bytes. The two arrays may be the same but may not be offset + * and overlapping. + */ +#ifdef ANSI_FUNC + +static void +bswap2 ( + char *a, + char *b, /* input array */ + int nbytes /* number of bytes to swap */ +) +#else + +static void +bswap2 (a, b, nbytes) +char *a, *b; /* input array */ +int nbytes; /* number of bytes to swap */ +#endif +{ + register char *ip=a, *op=b, *otop; + register unsigned temp; + + /* Swap successive pairs of bytes. + */ + for (otop = op + (nbytes & ~1); op < otop; ) { + temp = *ip++; + *op++ = *ip++; + *op++ = temp; + } + + /* If there is an odd byte left, move it to the output array. + */ + if (nbytes & 1) + *op = *ip; +} + + +/* VX_RETCURSORVAL -- Return the cursor value on the output datastream to + * the client which requested the cursor read. + */ +#ifdef ANSI_FUNC + +static void +vx_retCursorVal ( + register int dataout, + float sx, + float sy, /* cursor screen coordinates */ + int wcs, /* nonzero if WCS coords desired */ + int key, /* keystroke used as trigger */ + char *strval /* optional string value */ +) +#else + +static void +vx_retCursorVal (dataout, sx, sy, wcs, key, strval) +register int dataout; +float sx, sy; /* cursor screen coordinates */ +int wcs; /* nonzero if WCS coords desired */ +int key; /* keystroke used as trigger */ +char *strval; /* optional string value */ +#endif +{ + char curval[SZ_IMCURVAL]; + char keystr[20]; + + /* If running SERVER in interactive mode, allow the user to type + * in the cursor value on the standard input. + */ + if (interactive) { + printf ("enter cursor value string (x y wcs key str): "); + fflush (stdout); + if (fgets (curval, SZ_IMCURVAL, stdin) != NULL) + goto ret; + } + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n", + sx, sy, wcs, keystr, strval); + } +ret: + fprintf (stderr, "%s", curval); + + /* Send it to the client program and terminate cursor mode. */ + write (dataout, curval, sizeof(curval)); +} + + +/* WCS_UPDATE -- Load the screen WCS, if not yet validated, from the user + * wcs file, if any. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". + */ +#ifdef ANSI_FUNC + +static CtranPtr +wcs_update (register VXimDataPtr vxim, FrameBufPtr fr) +#else + +static CtranPtr +wcs_update (vxim, fr) +register VXimDataPtr vxim; +FrameBufPtr fr; +#endif +{ + register CtranPtr ct = &fr->ctran; + char buf[1024], *format; + + /* Get the new WCS. */ + if (!ct->valid) { + fr->label[0] = '\0'; + ct->zt = W_UNITARY; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (fr->wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (fr->wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->valid++; + } + + /* Determine best format for wcs output. */ + if (ct->valid && ct->zt == W_LINEAR) { + float z1, z2, zrange; + z1 = ct->z1; + z2 = ct->z2; + zrange = (z1 > z2) ? z1 - z2 : z2 - z1; + if (zrange < 100.0 && (abs(z1) + abs(z2)) / 2.0 < 200.0) + format = " %7.2f %7.2f %7.3f%c"; + else if (zrange > 99999.0 || (abs(z1) + abs(z2)) / 2.0 > 99999.0) + format = " %7.2f %7.2f %7.3g%c"; + else + format = W_DEFFORMAT; + } else + format = " %7.2f %7.2f %7.0f%c"; + + strcpy (ct->format, format); + return (ct); +} + + +/* VX_INITIALIZE -- Initialize the imaging subsystem. Read the config file + * and create the frame buffers, mappings, and colormaps. + */ +#ifdef ANSI_FUNC + +static void +vx_initialize (register VXimDataPtr vxim, int config, int nframes, int reset) +#else + +static void +vx_initialize (vxim, config, nframes, reset) +register VXimDataPtr vxim; +int config; +int nframes; +int reset; +#endif +{ + if (reset) + get_fbconfig (vxim); + + vxim->fb_configno = config; + vxim->nframes = vxim->fb_config[config].nframes; + vxim->width = vxim->fb_config[config].width; + vxim->height = vxim->fb_config[config].height; + vx_initFrame (vxim, vxim->display_frame, nframes, + &vxim->fb_config[config-1]); +} + + +/* VX_INITFRAME -- Initialize a frame buffer. + */ +#ifdef ANSI_FUNC + +static void +vx_initFrame (register VXimDataPtr vxim, int frame, int nframes, FbConfigPtr config) +#else + +static void +vx_initFrame (vxim, frame, nframes, config) +register VXimDataPtr vxim; +int frame, nframes; +FbConfigPtr config; +#endif +{ + register FrameBufPtr fb = &vxim->frames[frame-1]; + + if (frame < 1 || frame > MAX_FRAMES) + return; + + /* Create the frame buffer. */ + fb->frameno = frame; + if (keep_raster) { + if (fb->framebuf) + free (fb->framebuf); + fb->framebuf = (char *) malloc (config->width * config->height); + } + vxim->width = config->width; + vxim->height = config->height; + vxim->nframes = nframes; +} + +/* VX_ERASEFRAME -- Erase a frame. + */ +#ifdef ANSI_FUNC + +static void +vx_eraseFrame (register VXimDataPtr vxim, int frame) +#else + +static void +vx_eraseFrame (vxim, frame) +register VXimDataPtr vxim; +int frame; +#endif +{ + register FrameBufPtr fb = &vxim->frames[frame-1]; + + if (keep_raster) + bzero (fb->framebuf, vxim->width * vxim->height); +} + + +/* GET_FBCONFIG -- Read the XIMTOOL startup file to get the set of possible + * frame buffer sizes. + * + * File format: configno nframes width height [extra fields] + * e.g., 1 2 512 512 + * 2 2 800 800 + * 3 1 1024 1024 # comment + */ +#ifdef ANSI_FUNC + +static void +get_fbconfig (register VXimDataPtr vxim) +#else + +static void +get_fbconfig (vxim) +register VXimDataPtr vxim; +#endif +{ + register char *ip; + register FILE *fp = NULL; + int config, nframes, width, height, i; + char lbuf[SZ_LINE+1], *fname; + static char *fb_paths[] = { + "/usr/local/lib/imtoolrc", + "/opt/local/lib/imtoolrc", + "/iraf/iraf/dev/imtoolrc", + "/local/lib/imtoolrc", + "/usr/iraf/dev/imtoolrc", + "/usr/local/iraf/dev/imtoolrc", + NULL}; + + /* Initialize the config table. */ + vxim->fb_configno = 1; + for (i=0; i < MAX_FBCONFIG; i++) { + vxim->fb_config[i].nframes = 1; + vxim->fb_config[i].width = DEF_FRAME_WIDTH; + vxim->fb_config[i].height = DEF_FRAME_HEIGHT; + } + + /* Now add in some defaults for commonly used sizes based on the + * standard IRAF imtoolrc file, we'll avoid any instrument specific + * configurations. + */ + vxim->fb_config[0].width = vxim->fb_config[0].height = 512; + vxim->fb_config[1].width = vxim->fb_config[1].height = 800; + vxim->fb_config[2].width = vxim->fb_config[2].height = 1024; + vxim->fb_config[3].width = vxim->fb_config[3].height = 1600; + vxim->fb_config[4].width = vxim->fb_config[4].height = 2048; + vxim->fb_config[5].width = vxim->fb_config[5].height = 4096; + + /* Attempt to open the config file. */ + if ((fname=getenv(FBCONFIG_ENV1)) || (fname=getenv(FBCONFIG_ENV2))) + fp = fopen (fname, "r"); + if (!fp && (fname = getenv ("HOME"))) { + sprintf (lbuf, "%s/%s", fname, FBCONFIG_1); + fp = fopen (fname = lbuf, "r"); + if (fp) { + vxim->imtoolrc = (char *) calloc (strlen(fname+1),sizeof(char)); + strncpy (vxim->imtoolrc, fname, strlen(fname)); + } + } + if (!fp) + fp = fopen (fname = vxim->imtoolrc, "r"); + for (i=0; !fp && fb_paths[i]; i++) { + if ((fp = fopen (fname = fb_paths[i], "r"))) { + vxim->imtoolrc = (char *) calloc (strlen(fb_paths[i]+1), + sizeof(char)); + strncpy (vxim->imtoolrc, fb_paths[i],strlen(fb_paths[i])); + break; + } + } + if (!fp) { + fprintf (stderr, + "Warning: No frame buffer configuration file found.\n"); + return; + } + + + /* Scan the frame buffer configuration file. + */ + while (fgets (lbuf, SZ_LINE, fp) != NULL) { + /* Skip comment lines and blank lines. */ + for (ip=lbuf; *ip == ' ' || *ip == '\t'; ip++) + ; + if (*ip == '\n' || *ip == '#') + continue; + if (!isdigit (*ip)) + continue; + switch (sscanf (ip, "%d%d%d%d", &config,&nframes,&width,&height)) { + case 4: + break; /* normal case */ + case 3: + height = width; /* default to square format */ + break; + default: + fprintf (stderr, "vximtool: bad config `%s'\n", ip); + continue; + } + + nframes = max (1, nframes); + width = max (1, width); + height = max (1, height); + + /* Since the frame buffer is stored in a memory pixrect + * (effectively), the line length should be an integral number + * of 16 bit words. + */ + if (width & 1) { + fprintf (stderr, "imtool warning: fb config %d [%d-%dx%d] - ", + config, nframes, width, height); + fprintf (stderr, "frame width should be even, reset to %d\n", + --width); + } + + config = max(1, min(MAX_FBCONFIG, config)) - 1; + vxim->fb_config[config].nframes = nframes; + vxim->fb_config[config].width = width; + vxim->fb_config[config].height = height; + } + + fclose (fp); +} + + + +/* USAGE -- Print a list of command-line options. + */ +#ifdef ANSI_FUNC + +static void +Usage (void) +#else + +static void +Usage () +#endif +{ + fprintf (stderr, "Usage:\n\n"); + printoption (" vximtool"); + printoption ("[-background]"); /* run in background */ + printoption ("[-config ]"); /* initial config */ + printoption ("[-fifo ]"); /* fifo pipe */ + printoption ("[-fifo_only]"); /* use fifo only */ + printoption ("[-help]"); /* Print help */ + printoption ("[-i]"); /* interactive */ + printoption ("[-imtoolrc ]"); /* fbconfig file */ + printoption ("[-inet_only | -port_only]"); /* use inet only */ + printoption ("[-noraster]"); /* don't save pix */ + printoption ("[-nframes ]"); /* # of frames */ + printoption ("[-port ]"); /* inet port */ + printoption ("[-proxy]"); /* run a proxy server */ + printoption ("[-verbose]"); /* verbose output */ + printoption ("[-unix ]"); /* unix socket */ + printoption ("[-unix_only]"); /* use unix only */ + fprintf (stderr,"\n"); +} + + +/* PRINTOPTION -- Pretty-print an option string. + */ +static int cpos = 0; +#ifdef ANSI_FUNC + +static void +printoption (char *st) +#else + +static void +printoption(st) +char *st; +#endif +{ + if (strlen(st) + cpos > 78) { + fprintf (stderr,"\n\t"); + cpos = 8; + } + fprintf (stderr,"%s ",st); + cpos = cpos + strlen(st) + 1; +} + + +#ifdef HAVE_CDL +/* VX_FLIP -- Reverse order of lines in raster. + */ + +#ifdef ANSI_FUNC + +static void +vx_flip (char *buffer, int nx, int ny) +#else + +static void +vx_flip (buffer, nx, ny) +char *buffer; +int nx; +int ny; +#endif +{ + register int i, j, v; + register char *buff1, *buff2; + + for (i = 0; i < ny / 2; i++) { + buff1 = &buffer[i*nx]; + buff2 = &buffer[(ny-1-i)*nx]; + for (j = 0; j < nx; j++) { + v = *buff1; + *(buff1++) = *buff2; + *(buff2++) = v; + } + } +} +#endif + + +/* ADD_MAPPING -- Add a mapping for the current frame. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt \n + * region_name sx sy snx sny dx dy dnx dny\n + * object_ref + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". Mapping information is parsed + * elsewhere if needed, our only purpose here is to extract the frame WCS. + */ + +static void +add_mapping (vxim, ctran, wcsbuf, fr) +register VXimDataPtr vxim; +CtranPtr ctran; +char *wcsbuf; +FrameBufPtr fr; +{ + register MappingPtr mp = &fr->mapping[fr->nmaps]; + register CtranPtr ct = &mp->ctran; + register int i, j; + char buf[SZ_WCSBUF], *format; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->zt = W_UNITARY; + ct->valid = 1; + + + mp->ref[0] = '\0'; + mp->region[0] = '\0'; + + /* Skip over the first two lines of WCS data. + */ + strcpy (buf, wcsbuf); + for (i=0, j=0; j < 2 && buf[i]; i++) + if (buf[i] == '\n') + j++; + + /* Attempt to read the mapping. + */ + mp->id = mp->regid = ++objid; + if (sscanf (&buf[i], "%s%f%f%d%d%d%d%d%d\n%s\n", + mp->region, &mp->sx, &mp->sy, &mp->snx, &mp->sny, + &mp->dx, &mp->dy, &mp->dnx, &mp->dny, mp->ref) < 10) { + + if (!wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS mapping\n"); + strncpy (mp->ref, "none", SZ_IMTITLE); + + mp->sx = 1.0; + mp->sy = 1.0; + mp->snx = vxim->width; + mp->sny = vxim->height; + mp->dx = 1; + mp->dy = 1; + mp->dnx = vxim->width; + mp->dny = vxim->height; + } + memmove (ctran, &mp->ctran, sizeof (Ctran)); + + fr->nmaps++; +} + + +/* PRINT_MAPPINGS -- Debug routine to print all mappings on a frame. + */ +print_mappings (fr) +FrameBufPtr fr; +{ + MappingPtr mp; + register int i; + + if (fr->nmaps == 0) printf ("No mappings for frame %d\n", fr->frameno); + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + printf ("Mapping %d frame=%d:\n", fr->nmaps, fr->frameno); + printf ("\t%s %f %f %d %d %d %d %d %d\n\t%s\n", + mp->region, mp->sx, mp->sy, mp->snx, mp->sny, + mp->dx, mp->dy, mp->dnx, mp->dny, mp->ref); + } +} + + +/* IIS_READ -- Read exactly "n" bytes from a descriptor. + */ + +#ifdef ANSI_FUNC +static int +iis_read (int fd, void *vptr, int nbytes) + +#else +static int +iis_read (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +#endif +{ + char *ptr = vptr; + int nread = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = read(fd, ptr, nleft)) < 0) { + if (errno == EINTR) + nb = 0; /* and call read() again */ + else + return(-1); + } else if (nb == 0) + break; /* EOF */ + nleft -= nb; + ptr += nb; + nread += nb; + } + return (nread); /* return no. of bytes read */ +} + + +/* IIS_WRITE -- Write exactly "n" bytes to a descriptor. + */ +#ifdef ANSI_FUNC +static int +iis_write (int fd, void *vptr, int nbytes) + +#else + +static int +iis_write (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +#endif + +{ + char *ptr = vptr; + int nwritten = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = write(fd, ptr, nleft)) <= 0) { + if (errno == EINTR) + nb = 0; /* and call write() again */ + else + return(-1); /* error */ + } + nleft -= nb; + ptr += nb; + nwritten += nb; + } + return (nwritten); +} diff --git a/vendor/x11iraf/doc/cdlref.ps b/vendor/x11iraf/doc/cdlref.ps new file mode 100644 index 00000000..f192e0b1 --- /dev/null +++ b/vendor/x11iraf/doc/cdlref.ps @@ -0,0 +1,19799 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Sat Aug 11 21:36:49 2001 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/C{/Courier FF}def +%% Troff special characters not on Symbol font +%% Copyright (C) 1986 by Pipeline Associates, Inc. +%% Version 1.1 +/altRTD 20 dict def +altRTD begin +/s{setcachedevice}def +/C{1000 1000 scale}def +/m{moveto}def +/c{curveto}def +/S{stroke}def +/l{lineto}def +/a{arcto}def +/p{pop}def +/sl{setlinewidth}def +end +/F_Troff 17 dict def F_Troff begin +systemdict /currentpacking known +{/SavePacking currentpacking def true setpacking}if +/PaintType 0 def +/FontType 3 def +/StrokeWidth 0 def +/UniqueID 8277003 def +/FontMatrix [.001000 0 0 .001000 0 0] def +/FontBBox [-12 -105 942 855 ] def +/Encoding 256 array def +/CD 256 1 add dict def +/FontInfo 3 dict def FontInfo begin +/UnderlinePosition -133 def /UnderlineThickness 20 def end +/FontName (Troff) def +0 1 256 1 sub{Encoding exch /.notdef put}for +CD /.notdef{500 0 setcharwidth{}}put +Encoding (1) 0 get /br put +%% bold vertical rule used by tbl +CD /br{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +0 .9 l +{S} +}put +Encoding (2) 0 get /ul put +%% underline used by tbl +CD /ul{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +.5 -.1 l +{S} +}put +Encoding (3) 0 get /ru put +%% baseline rule +CD /ru{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +m0 +.5 0 l +{S} +}put +Encoding (4) 0 get /vr put +%% vertical rule +CD /vr{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +m0 +0 1 l +{S} +}put +Encoding (5) 0 get /sq put +%% square +CD /sq{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{S} +}put +Encoding (6) 0 get /bx put +%% solid box +CD /bx{ +C +.5 0 -.5 -.5 1 1 s +np +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{fill} +}put +Encoding (7) 0 get /rn put +%% radical extender +CD /rn{ +C +.5 0 -.5 -.5 1 1 s +np +.03 sl +-.03 .9 m +.5 0 rl +{S} +}put +Encoding (8) 0 get /GR put +%% gray mask +CD /GR{ +C +.5 0 setcharwidth +.5 setgray +np +0 -.1 m +0 1 rl +.5 0 rl +0 -1 rl +-.5 0 rl +closepath +{fill} +}put +Encoding 97 /a put +CD /a{1000 0 0 66 942 421 s 430 415 +m 578 406 678 349 662 319 c 655 306 614 287 583 +296 c 570 300 466 340 438 332 c 365 309 335 213 +270 209 c 0 310 m 108 310 l 108 114 l 0 +114 l 0 310 l 42 161 m 42 134 l 66 134 l 66 +161 l 42 161 l 47 155 m 47 140 l 62 140 l 62 +155 l 47 155 l 110 133 m 226 113 300 66 410 +80 c 497 91 550 69 634 76 c 645 76 663 92 669 +107 c 677 125 673 141 668 160 c 725 334 m 758 +332 734 253 701 250 c 501 325 m 475 316 476 309 +473 302 c 465 282 482 263 499 257 c 552 236 615 +253 689 253 c 701 253 713 236 713 218 c 712 194 +702 168 678 161 c 671 159 663 160 655 160 c 591 +158 516 156 479 168 c 461 173 453 191 453 210 c 453 +224 456 235 466 244 c 476 253 490 252 503 255 c 459 +84 m 447 96 435 106 435 123 c 435 136 440 145 447 +155 c 453 163 462 168 469 173 c 110 293 m 173 +318 300 421 435 415 c 609 407 852 416 885 411 c 898 +409 924 411 930 380 c 942 316 828 339 742 334 c 731 +334 730 335 725 335 c 701 336 685 336 660 336 c{S}}put +Encoding 98 /b put +CD /b{1000 0 -12 66 930 421 s 500 +415 m 352 406 252 349 268 319 c 275 306 316 287 +347 296 c 360 300 464 340 492 332 c 565 309 595 +213 660 209 c 930 310 m 822 310 l 822 114 l 930 +114 l 930 310 l 888 161 m 888 134 l 864 134 +l 864 161 l 888 161 l 883 155 m 883 140 l 868 +140 l 868 155 l 883 155 l 820 133 m 704 113 +630 66 520 80 c 433 91 380 69 296 76 c 285 76 +267 92 261 107 c 253 125 257 141 262 160 c 205 +334 m 172 332 196 253 229 250 c 429 325 m 455 +316 454 309 457 302 c 465 282 448 263 431 257 c 378 +236 315 253 241 253 c 229 253 217 236 217 218 c 218 +194 228 168 252 161 c 259 159 267 160 275 160 c 339 +158 414 156 451 168 c 469 173 477 191 477 210 c 477 +224 474 235 464 244 c 454 253 440 252 427 255 c 471 +84 m 483 96 495 106 495 123 c 495 136 490 145 483 +155 c 477 163 468 168 461 173 c 820 293 m 757 +318 630 421 495 415 c 321 407 78 416 45 411 c 32 +409 6 411 0 380 c -12 316 102 339 188 334 c 199 +334 200 335 205 335 c 229 336 245 336 270 336 c{S}}put +Encoding 99 /c put +CD /c{1000 0 184 0 827 627 s 185 315 +m 186 488 332 627 505 625 c 682 623 827 467 815 +290 c 804 124 666 0 500 0 c 327 0 184 142 185 +315 c{S}}put +Encoding 100 /d put +CD /d{590 0 134 158 477 500 s 300 +160 m 208 162 134 238 135 330 c 136 423 212 500 +305 500 c 397 500 473 427 475 335 c 477 239 396 +158 300 160 c{fill}}put +Encoding 101 /e put % Bell Symbol +CD /e{1010 0 -100 -210 1010 1010 s 100 sl 0 setlinecap +420 300 450 0 360 arc +420 650 m 420 575 l S +newpath 120 125 m 720 125 l 75 sl S +420 125 m 420 25 l S +220 400 m 220 175 120 175 100 a p p p p +220 400 m 220 550 420 550 80 a p p p p +620 400 m 620 175 720 175 100 a p p p p +620 400 m 620 550 420 550 80 a p p p p +295 550 m 545 550 l{S}}put +/BuildChar{altRTD /BuildChar get exec}def end +altRTD begin /BuildChar{altRTD begin +/char exch def /fontdict exch def save +/charname fontdict /Encoding get char get def +fontdict /StrokeWidth get sl +fontdict /CD get dup charname known +{charname}{/.notdef}ifelse get newpath exec +fontdict /PaintType get 0 eq{exec}{p S}ifelse +restore end}def end +systemdict /currentpacking known{F_Troff /SavePacking get setpacking}if +/Troff F_Troff definefont pop +/Y1{/Troff FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +1230 V +12 B +1419(A)S +1541(Reference)S +2088(Guide)S +2439(for)S +2628(the)S +2824(IRAF)S +3152(Client)S +3502(Display)S +3926(Library)S +4369(\(CDL\))S +1470 V +10 I +2662(Michael)S +3019(Fitzpatrick)S +1650 V +10 R +2645(NOAO/IRAF)S +3219(Group)S +1890 V +2765(February)S +3155(1997)S +2130 V +10 I +2619(Revised:)S +2992(August)S +3300(2001)S +2250 V +2479(Current)S +2826(Version:)S +3230(CDL)S +3455(V1.8)S +2850 V +2823(ABSTRACT)S +3090 V +11 R +1510(The)S +1713(Client)S +2016(Display)S +2391(Library)S +2752(\(CDL\))S +3077(is)S +3184(a)S +3265(host)S +3482(interface)S +3896(for)S +4056(C,)S +4192(Fortran)S +4549(or)S +4674(SPP)S +3210 V +1260(programs)S +1707(allowing)S +2125(them)S +2378(to)S +2497(display)S +2848(images)S +3192(or)S +3316(overlay)S +3677(graphics)S +4081(to)S +4200(display)S +4551(servers)S +3330 V +1260(such)S +1513(as)S +11 I +1656(XImtool)S +11 R +2010(,)S +11 I +2090(DS9)S +11 R +2279(,)S +2359(or)S +11 I +2502(SAOimage)S +3023(/)S +3106(SAOtng)S +11 R +3448(.)S +3562(High-level)S +4084(procedures)S +4616(allow)S +3450 V +1260(IRAF)S +1545(or)S +1670(FITS)S +1931(images)S +2276(to)S +2396(be)S +2533(displayed)S +2988(simply,)S +3351(other)S +3610(routines)S +3998(permit)S +4319(access)S +4631(to)S +4750(all)S +3570 V +1260(other)S +1537(server)S +1855(functions)S +2316(\(e.g.)S +2563(cursor)S +2888(and)S +3098(image)S +3418(readback,)S +3891(frame)S +4198(selection,)S +4669(etc\).)S +3690 V +1260(The)S +1470(library)S +1802(also)S +2019(features)S +2404(a)S +2492(number)S +2867(of)S +2997(functions)S +3445(for)S +3611(doing)S +3901(image)S +4208(overlay)S +4575(graph-)S +3810 V +1260(ics;)S +1451(supported)S +1922(graphics)S +2331(primitives)S +2816(include)S +3177(numerous)S +3648(point)S +3913(shapes,)S +4272(lines,)S +4547(circles,)S +3930 V +1260(ellipses,)S +1651(polygons,)S +2116(annular)S +2477(shapes,)S +2830(and)S +3021(text.)S +4410 V +10 R +900(August)S +1219(11,)S +1374(2001)S +7920 V +EP +%%Page: 1 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +840 V +13 B +2810(Contents)S +1200 V +10 R +900(1)S +10 B +1080(Introduction)S +10 R +1632(....................................................................................................................................)S +5032(1)S +1380 V +900(2)S +10 B +1080(Getting)S +1432(Started)S +10 R +1757(...............................................................................................................................)S +5032(1)S +1560 V +900(3)S +10 B +1080(Server)S +1392(Connections)S +10 R +1932(........................................................................................................................)S +5032(2)S +1680 V +1080(3.1)S +1440(Domain)S +1792(Sockets)S +2107(.................................................................................................................)S +5032(2)S +1800 V +1080(3.2)S +1440(Named)S +1758(FIFO)S +2005(Pipes)S +2232(............................................................................................................)S +5032(3)S +1920 V +1080(3.3)S +1440(Inet)S +1625(Sockets)S +1957(.......................................................................................................................)S +5032(3)S +2040 V +1080(3.4)S +1440(User-De\256ned)S +2007(Connections.................................................................................................)S +5032(3)S +2220 V +900(4)S +10 B +1080(Image)S +1376(Display)S +10 R +1707(.................................................................................................................................)S +5032(3)S +2340 V +1080(4.1)S +1440(Overview)S +1863(of)S +1976(the)S +2128(Display)S +2469(Process)S +2782(......................................................................................)S +5032(3)S +2460 V +1080(4.2)S +1440(Displaying)S +1909(IRAF)S +2167(Images)S +2457(...................................................................................................)S +5032(4)S +2580 V +1080(4.3)S +1440(Displaying)S +1909(FITS)S +2145(Images)S +2457(...................................................................................................)S +5032(5)S +2700 V +1080(4.4)S +1440(Displaying)S +1909(Raw)S +2122(Pixels)S +2382(......................................................................................................)S +5032(5)S +2820 V +1080(4.5)S +1440(Frame)S +1725(Selection)S +2107(.................................................................................................................)S +5032(5)S +2940 V +1080(4.6)S +1440(Clearing)S +1814(the)S +1966(Display)S +2282(..........................................................................................................)S +5032(5)S +3060 V +1080(4.7)S +1440(Frame)S +1725(Bu)S +1842 H + (f)show 10 -.5 mul h (f)show +10 R +1903(er)S +2010(Selection......................................................................................................)S +5032(6)S +3180 V +1188(4.7.1)S +1584(Automatic)S +2036(Selection)S +2432(....................................................................................................)S +5032(6)S +3300 V +1188(4.7.2)S +1584(The)S +1769(Frame)S +2054(Bu)S +2171 H + (f)show 10 -.5 mul h (f)show +10 R +2232(er)S +2339(Con\256guration)S +2925(File)S +3082(..........................................................................)S +5032(6)S +3420 V +1080(4.8)S +1440(Image)S +1719(WCS)S +1966(Description....................................................................................................)S +5032(7)S +3540 V +1188(4.8.1)S +1584(Image)S +1863(Mappings)S +2282(..........................................................................................................)S +5032(7)S +3660 V +1080(4.9)S +1440(Image)S +1719(Colormaps)S +2182(..............................................................................................................)S +5032(8)S +3780 V +1188(4.9.1)S +1584(Imtool)S +1881(Color)S +2139(Model)S +2407(.....................................................................................................)S +5032(9)S +3900 V +1080(4.10)S +1440(ZScale)S +1747(Intensity)S +2127(Mapping)S +2507(.................................................................................................)S +5032(9)S +4020 V +1080(4.11)S +1440(Image)S +1719(Hardcopy)S +2132(................................................................................................................)S +4982(10)S +4140 V +1080(4.12)S +1440(Image)S +1719(Cursor)S +2007(.....................................................................................................................)S +4982(10)S +4260 V +1188(4.12.1)S +1584(Cursor)S +1886(Sampling)S +2282(..........................................................................................................)S +4982(11)S +4380 V +1080(4.13)S +1440(Image)S +1719(Readout)S +2057(...................................................................................................................)S +4982(11)S +4500 V +1080(4.14)S +1440(Subraster)S +1847(I/O)S +1982(......................................................................................................................)S +4982(11)S +4680 V +900(5)S +10 B +1080(Graphics)S +1505(Overlay)S +10 R +1857(...........................................................................................................................)S +4982(11)S +4800 V +1080(5.1)S +1440(Marker)S +1763(Coordinates)S +2257(...........................................................................................................)S +4982(11)S +4920 V +1080(5.2)S +1440(Mapping)S +1831(a)S +1905(Previously)S +2363(Displayed)S +2798(Image)S +3057(...........................................................................)S +4982(11)S +5040 V +1080(5.3)S +1440(Marking)S +1814(a)S +1888(Coordinate)S +2362(File)S +2532(................................................................................................)S +4982(12)S +5160 V +1080(5.4)S +1440(Marker)S +1763(Colors)S +2032(....................................................................................................................)S +4982(12)S +5280 V +1080(5.5)S +1440(Marker)S +1763(Types.....................................................................................................................)S +4982(12)S +5400 V +1188(5.5.1)S +1584(Point)S +1807(.............................................................................................................................)S +4982(13)S +5520 V +1188(5.5.2)S +1584(Line)S +1782(..............................................................................................................................)S +4982(13)S +5640 V +1188(5.5.3)S +1584(Box)S +1757(...............................................................................................................................)S +4982(13)S +5760 V +1188(5.5.4)S +1584(Circle)S +1832(............................................................................................................................)S +4982(13)S +5880 V +1188(5.5.5)S +1584(Polyline)S +1932(........................................................................................................................)S +4982(14)S +6000 V +1188(5.5.6)S +1584(Polygon)S +1932(........................................................................................................................)S +4982(14)S +6120 V +1188(5.5.7)S +1584(Ellipse)S +1882(..........................................................................................................................)S +4982(14)S +6240 V +1188(5.5.8)S +1584(Circular)S +1941(Annuli)S +2232(............................................................................................................)S +4982(14)S +6360 V +1188(5.5.9)S +1584(Elliptical)S +1981(Annuli)S +2282(..........................................................................................................)S +4982(14)S +6480 V +1188(5.5.10)S +1584(Text)S +1782(..............................................................................................................................)S +4982(14)S +6600 V +1080(5.6)S +1440(Text)S +1653(Fonts)S +1882(..........................................................................................................................)S +4982(15)S +6720 V +1188(5.6.1)S +1584(In-line)S +1880(Font)S +2094(Changes)S +2457(...................................................................................................)S +4982(15)S +6840 V +1080(5.7)S +1440(Line)S +1653(Widths)S +1972(and)S +2146(Styles)S +2407(.....................................................................................................)S +4982(15)S +6960 V +1080(5.8)S +1440(Deleting)S +1814(Markers)S +2157(...............................................................................................................)S +4982(16)S +7080 V +1188(5.8.1)S +1584(Individual)S +2025(Markers.......................................................................................................)S +4982(16)S +7200 V +1188(5.8.2)S +1584(The)S +1769(Entire)S +2043(Overlay)S +2382(......................................................................................................)S +4982(16)S +7920 V +EP +%%Page: 2 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +11 R +2963(- 2 -)S +840 V +10 R +1080(5.9)S +1440(Redrawing)S +1908(the)S +2060(Overlay)S +2382(......................................................................................................)S +4982(16)S +1020 V +900(6)S +10 B +1080(ANSI)S +1349(C)S +1451(Function)S +1865(Prototypes)S +10 R +2332(........................................................................................................)S +4982(17)S +1200 V +900(7)S +10 B +1080(Fortran)S +1448(Language)S +1901(Binding)S +2272(Notes)S +10 R +2532(................................................................................................)S +4982(17)S +1380 V +900(8)S +10 B +1080(SPP)S +1288(Language)S +1741(Binding)S +2112(Notes)S +10 R +2357(.......................................................................................................)S +4982(18)S +1560 V +900(9)S +10 B +1080(IIS)S +1244(Protocol)S +1634(Description)S +10 R +2132(................................................................................................................)S +4982(18)S +1740 V +900(10)S +10 B +1080(VXIMTOOL)S +1677(Proxy/Display)S +2313(Server)S +2625(Usage)S +10 R +2882(..................................................................................)S +4982(19)S +1920 V +900(11)S +10 B +1080(C)S +1182(Interface)S +1599(Summary)S +10 R +2032(....................................................................................................................)S +4982(21)S +2100 V +900(12)S +10 B +1080(C)S +1182(Example)S +1590(Tasks)S +10 R +1857(...........................................................................................................................)S +4982(23)S +2220 V +1080(12.1)S +1440(Display)S +1781(Example)S +2157(...............................................................................................................)S +4982(23)S +2340 V +1080(12.2)S +1440(Interactive)S +1896(Graphics)S +2286(Overlay)S +2637(Example)S +3007(.............................................................................)S +4982(27)S +2460 V +1080(12.3)S +1440(Image)S +1719(Mosaic)S +2043(Example)S +2407(.....................................................................................................)S +4982(31)S +2640 V +900(13)S +10 B +1080(Fortran)S +1448(Interface)S +1865(Summary)S +10 R +2307(.........................................................................................................)S +4982(33)S +2820 V +900(14)S +10 B +1080(Fortran)S +1448(Example)S +1856(Tasks)S +10 R +2107(.................................................................................................................)S +4982(35)S +2940 V +1080(14.1)S +1440(Display)S +1781(Example)S +2157(...............................................................................................................)S +4982(35)S +3060 V +1080(14.2)S +1440(Interactive)S +1896(Graphics)S +2286(Overlay)S +2637(Example)S +3007(.............................................................................)S +4982(36)S +3240 V +900(15)S +10 B +1080(SPP)S +1288(Interface)S +1705(Summary)S +10 R +2132(................................................................................................................)S +4982(38)S +7920 V +EP +%%Page: 1 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +1230 V +12 B +1419(A)S +1541(Reference)S +2088(Guide)S +2439(for)S +2628(the)S +2824(IRAF)S +3152(Client)S +3502(Display)S +3926(Library)S +4369(\(CDL\))S +1470 V +10 I +2662(Michael)S +3019(Fitzpatrick)S +1650 V +10 R +2645(NOAO/IRAF)S +3219(Group)S +1890 V +2765(February)S +3155(1997)S +2130 V +10 I +2619(Revised:)S +2992(August)S +3300(2001)S +2250 V +2479(Current)S +2826(Version:)S +3230(CDL)S +3455(V1.8)S +2730 V +11 B +900(1.)S +1049(Introduction)S +2886 V +11 R +1175(For)S +1368(more)S +1633(than)S +1862(a)S +1950(decade)S +2292(IRAF)S +2583(has)S +2769(used)S +3010(a)S +11 I +3098(display)S +3456(server)S +11 R +3769(as)S +3900(the)S +4075(primary)S +4463(means)S +4784(for)S +4952(image)S +3006 V +900(display.)S +1320(IRAF)S +1612(client)S +1897(tasks)S +2158(connect)S +2539(to)S +2666(the)S +2840(server)S +3146(and)S +3344(send)S +3585(or)S +3716(read)S +3943(data)S +4165(using)S +4444(a)S +4532(modi\256cation)S +5129(of)S +3126 V +900(the)S +1081(IIS)S +1262(Model)S +1596(70)S +1753(protocol,)S +2194(originally)S +2669(through)S +3058(named)S +3397(\256fo)S +3597(pipes)S +3876(but)S +4064(more)S +4337(recently)S +4737(using)S +5024(unix)S +3246 V +900(domain)S +1268(or)S +1397(inet)S +1600(sockets.)S +2022(The)S +2230(advantage)S +2710(to)S +2833(this)S +3030(approach)S +3467(was)S +3674(that)S +3876(IRAF)S +4164(client)S +4445(tasks)S +4702(could)S +4983(make)S +3366 V +900(use)S +1083(of)S +1211(the)S +1383(image)S +1689(display)S +2045(functionality)S +2645(without)S +3020(duplicating)S +3553(the)S +3725(code)S +3969(needed)S +4316(for)S +4481(actually)S +4866(display-)S +3486 V +900(ing)S +1078(the)S +1249(image.)S +1615(The)S +1822(longtime)S +2251(disadvantage)S +2859(was)S +3065(that)S +3266(the)S +3436(IIS)S +3606(protocol)S +4008(used)S +4245(was)S +4451(arcane)S +4770(and)S +4964(undo-)S +3606 V +900(cumented)S +1375(and)S +1582(therefore)S +2024(largely)S +2377(unavailable)S +2931(to)S +3066(applications)S +3646(outside)S +4013(of)S +4153(the)S +4336(IRAF)S +4636(project.)S +5050(The)S +3726 V +900(Client)S +1213(Display)S +1598(Library)S +1969(\(CDL\))S +2304(provides)S +2725(a)S +2816(public)S +3134(C)S +3251(and)S +3451(Fortran)S +3816(interface)S +4239(for)S +4408(displaying)S +4909(images)S +3846 V +900(and)S +1091(overlay)S +1452(graphics)S +1856(that)S +2054(is)S +2161(independent)S +2730(of)S +2854(the)S +3021(underlying)S +3530(protocol)S +3929(used.)S +4002 V +1175(Unlike)S +1512(the)S +1684(interface)S +2103(used)S +2342(by)S +2490(IRAF)S +2779(applications,)S +3376(the)S +3548(CDL)S +3807(is)S +3920(meant)S +4227(to)S +4352(provide)S +4726(an)S +4868(easy-to-)S +4122 V +900(use,)S +1109(fully)S +1351(featured)S +1742(interface)S +2157(for)S +2318(applications)S +2883(that)S +3082(can)S +3267(be)S +3404(easily)S +3694(evolved)S +4075(for)S +4236(future)S +4531(display)S +4883(servers,)S +4242 V +900(communications)S +1675(schemes,)S +2122(or)S +2261(display)S +2627(functionality.)S +3298(Indeed,)S +3671(the)S +3853(CDL)S +4121(is)S +4244(independent)S +4829(of)S +4969(IRAF)S +4362 V +900(itself)S +1163(\(as)S +1333(are)S +1508(the)S +1685(display)S +2046(servers\))S +2434(so)S +2575(display)S +2936(tasks)S +3199(can)S +3393(be)S +3539(written)S +3893(for)S +4063(any)S +4264(discipline)S +4735(or)S +4868(applica-)S +4482 V +900(tion.)S +4638 V +1175(While)S +1478(this)S +1673(guide)S +1952(assumes)S +2353(programs)S +2802(are)S +2969(written)S +3315(in)S +3436(C,)S +3573(Fortran)S +3931(programmers)S +4550(should)S +4879(\256nd)S +5086(the)S +4758 V +900(translation)S +1408(straightforward)S +2127(by)S +2281(referring)S +2706(to)S +2836(the)S +3014(Fortran)S +3381(interface)S +3806(summary.)S +4320(The)S +4534(package)S +4935(source)S +4878 V +900(\256les)S +1117(include)S +1473(example)S +1877(tasks)S +2130(as)S +2254(does)S +2488(this)S +2681(guide;)S +2989(users)S +3247(with)S +3477(problems,)S +3948(questions,)S +4426(or)S +4551(bug)S +4750(reports)S +5088(are)S +4998 V +900(encouraged)S +1444(to)S +1571(contact)S +11 I +1928(iraf@noao.edu)S +11 R +2595(.)S +2697(A)S +2817(small)S +3097(code)S +3344(sample)S +3696(demonstrating)S +4365(the)S +4539(problem)S +4945(would)S +5118 V +900(be)S +1036(very)S +1263(helpful)S +1607(in)S +1726(\256nding)S +2072(a)S +2153(solution)S +2542(to)S +2661(any)S +2852(reported)S +3249(problems.)S +5478 V +11 B +900(2.)S +1049(Getting)S +1436(Started)S +5634 V +11 R +1175(All)S +1358(C)S +1474(programs)S +1930(must)S +2188(include)S +2554(the)S +2731(header)S +3064(\256le)S +11 B +3248("cdl.h")S +11 R +3646(in)S +3775(order)S +4048(to)S +4177(get)S +4354(package)S +4754(de\256nitions)S +5754 V +900(for)S +1084(constants)S +1550(such)S +1808(as)S +1956(colors)S +2281(and)S +2496(structure)S +2936(de\256nitions)S +3459(used.)S +3778(The)S +4005(Fortran)S +4385(interface)S +4822(does)S +5079(not)S +5874 V +11 I +900(require)S +11 R +1257(anything)S +1676(similar,)S +2045(however)S +2456(for)S +2618(fortran)S +2950(compilers)S +3418(which)S +3721(support)S +4086(an)S +11 C +4257(include)S +11 R +4754(directive)S +5172(a)S +5994 V +11 B +900(cdlftn.inc)S +11 R +1383(\256le)S +1562(may)S +1789(be)S +1930(used)S +2169(to)S +2293(de\256ne)S +2599(symbolic)S +3041(constants)S +3488(passed)S +3818(to)S +3942(procedures,)S +4487(this)S +4685(\256le)S +4864(must)S +5117(be)S +6114 V +900(included)S +1320(by)S +1472(each)S +1713(procedure)S +2191(using)S +2472(the)S +2648(CDL.)S +2971(Fortran)S +3336(programs)S +3792(not)S +3975(using)S +4257(this)S +4460(\256le)S +4644(must)S +4902(pass)S +5134(in)S +6234 V +900(the)S +1077(constants)S +1529(explicitly,)S +2016(needed)S +2368(values)S +2690(are)S +2864(found)S +3162(throughout)S +3687(this)S +3889(manual.)S +4315(C)S +4431(procedures)S +4952(which)S +6354 V +900(return)S +1199(an)S +1340(integer)S +1682(value)S +1957(will)S +2167(return)S +2466(a)S +2552(positive)S +2939(number)S +3312(to)S +3436(indicate)S +3821(an)S +3962(error)S +4211(has)S +4395(occurred)S +4815(and)S +5012(print)S +6474 V +900(an)S +1036(error)S +1280(message,)S +1712(otherwise)S +2171(zero)S +2391(is)S +2498(returned.)S +6630 V +1175(The)S +11 B +1381(cdl_open\(\))S +11 R +1912(procedure)S +2384(is)S +2494(used)S +2731(to)S +2853(establish)S +3274(a)S +3358(connection)S +3875(to)S +3997(the)S +4167(server)S +4469(and)S +4664(initialize)S +5086(the)S +6750 V +900(package,)S +1323(it)S +1423(returns)S +1765(a)S +1851(CDL)S +2108(structure)S +2528(pointer)S +2876(that)S +3078(is)S +3189(passed)S +3518(to)S +3641(other)S +3903(CDL)S +4160(procedures.)S +4737(For)S +4927(C)S +5038(pro-)S +6870 V +900(grams)S +1207(this)S +1406(means)S +1726(a)S +1814(separate)S +2211(pointer)S +2562(may)S +2791(be)S +2934(maintained)S +3462(for)S +3629(each)S +3868(server)S +4174(connection,)S +4723(the)S +4897(Fortran)S +6990 V +900(interface)S +1329(is)S +1451(limited)S +1812(to)S +1946(only)S +2190(one)S +2396(server)S +2710(connection)S +3239(per)S +3425(process)S +3800(since)S +4072(the)S +4253(pointer)S +4611(is)S +4732(maintained)S +7110 V +900(internally.)S +1428(The)S +1644(connection)S +2171(is)S +2291(terminated)S +2806(using)S +3091(the)S +11 B +3271(cdl_close\(\))S +11 R +3810(procedure.)S +4353(Between)S +4783(these)S +5055(two)S +7230 V +900(calls)S +1158(may)S +1404(be)S +1564(any)S +1779(combination)S +2385(of)S +2532(CDL)S +2808(procedure)S +3300(calls)S +3557(for)S +3740(doing)S +4047(image)S +4371(display)S +4745(or)S +4892(overlay)S +7920 V +EP +%%Page: 2 5 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 2 -)S +840 V +900(graphics.)S +996 V +1175(For)S +1376(example,)S +1823(the)S +2005(simplest)S +2421(possible)S +2830(program)S +3249(for)S +3424(displaying)S +3931(an)S +4083(IRAF)S +4383(image)S +4700(would)S +5024(look)S +1116 V +900(something)S +1392(like:)S +1296 V +11 C +1450(#include)S +2044("cdl.h")S +1536 V +1450(main)S +1780(\(int)S +2110(argc,)S +2506(char)S +2836(*argv[]\))S +1656 V +1450({)S +1776 V +1714(CDLPtr)S +2176(cdl)S +2440(=)S +2572(cdl_open)S +3166(\(\(char)S +3628(*\)0\);)S +1896 V +1714(cdl_displayIRAF)S +2770(\(cdl,)S +3166(argv[1],)S +3760(1,)S +3958(1,)S +4156(1,)S +4354(1\);)S +2016 V +1714(cdl_close)S +2374(\(cdl\);)S +2136 V +1450(})S +2352 V +11 R +900(This)S +1131(program)S +1537(displays)S +1933(band)S +2181(one)S +2374(of)S +2500(an)S +2638(image)S +2941(named)S +3268(on)S +3413(the)S +3582(command)S +4050(line)S +4250(to)S +4372(the)S +4542(server)S +4844(in)S +4966(frame)S +2472 V +900(one)S +1092(using)S +1365(the)S +1533(default)S +1871(512x512)S +2290(frame)S +2577(bu)S +2687 H + (f)show 11 -.5 mul h (f)show +11 R +2754(er,)S +2899(zscaling)S +3291(the)S +3458(pixels)S +3754(to)S +3873(8-bit)S +4114(values)S +4427(automatically.)S +5086(No)S +2592 V +900(error)S +1146(checking)S +1576(is)S +1685(performed)S +2175(to)S +2296(verify)S +2592(that)S +2792(a)S +2875(connection)S +3391(was)S +3596(established)S +4119(or)S +4245(that)S +4445(the)S +4614(argument)S +5063(is)S +5172(a)S +2712 V +900(valid)S +1163(IRAF)S +1457(image.)S +1829(Most)S +2099(programs)S +2555(will)S +2769(be)S +2914(more)S +3181(complex)S +3601(than)S +3832(this)S +4034(but)S +4217(it)S +4321(should)S +4657(be)S +4802(clear)S +5055(that)S +2832 V +900(image)S +1201(display)S +1552(from)S +1798(client)S +2075(applications)S +2639(is)S +2746(a)S +2827(now)S +3049(trivial)S +3345(operation.)S +3072 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3252 V +11 C +1175(#include)S +1769("cdl.h")S +3492 V +1175(CDLPtr)S +1637(cdl_open)S +2231(\(char)S +2627(*imtdev\))S +3612 V +1175(void)S +1505(cdl_close)S +2165(\(CDLPtr)S +2693(cdl\))S +3972 V +11 B +900(3.)S +1049(Server)S +1391(Connections)S +4128 V +11 R +1175(The)S +11 B +1391(cdl_open\(\))S +11 R +1932(procedure)S +2414(takes)S +2685(a)S +2779(single)S +3088(argument)S +3548(specifying)S +4051(the)S +4232(type)S +4468(of)S +4606(connection)S +5134(to)S +4248 V +900(make)S +1175(to)S +1298(the)S +1469(server,)S +1800(this)S +1997(routine)S +2345(also)S +2559(initializes)S +3024(the)S +3195(CDL)S +3452(package.)S +3907(If)S +4016(this)S +4213(is)S +4324(a)S +4409(NULL)S +4738(pointer)S +5086(the)S +4368 V +900(CDL)S +1171(will)S +1395(attempt)S +1777(to)S +1915(\256rst)S +2139(connect)S +2531(on)S +2693(a)S +2793(unix)S +3041(domain)S +3423(socket,)S +3783(if)S +3902(that)S +4119(fails)S +4360(the)S +4546(standard)S +4969(IRAF)S +4488 V +900(/dev/imt1*)S +1411(\256fo)S +1597(pipes)S +1862(are)S +2027(tried.)S +2322(The)S +2525(syntax)S +2845(for)S +3005(the)S +11 I +3172(imtdev)S +11 R +3497(argument)S +3944(is)S +4051(as)S +4175(follows:)S +4668 V +11 C +2000()S +2594(:)S +2726(
)S +4884 V +11 R +900(where)S +1204()S +1696(is)S +1808(one)S +2004(of)S +2133(")S +11 B +2178(inet)S +11 R +2355(")S +2438(\(internet)S +2847(tcp/ip)S +3136(socket\),)S +3518(")S +11 B +3563(unix)S +11 R +3773(")S +3856(\(unix)S +4126(domain)S +4494(socket\))S +4848(or)S +4977(")S +11 B +5022(\256fo)S +11 R +5175(")S +5004 V +900(\(named)S +1264(pipe\).)S +1586(The)S +1792(form)S +2041(of)S +2168(the)S +2338(address)S +2702(depends)S +3097(upon)S +3353(the)S +3522(domain,)S +3915(as)S +4041(illustrated)S +4516(in)S +4637(the)S +4806(examples)S +5124 V +900(below.)S +1264(The)S +1469(address)S +1832(\256eld)S +2063(may)S +2288(contain)S +2647(up)S +2793(to)S +2915(two)S +3116("%d")S +3388(\256elds.)S +3724(If)S +3832(present,)S +4212(the)S +4382(user's)S +4679(UID)S +4909(will)S +5117(be)S +5244 V +900(substituted)S +1440(\(e.g.)S +1697("unix:/tmp/.IMT%d"\).)S +2749(The)S +2981(default)S +3347(connection)S +3890(if)S +4019(no)S +4191(imtdev)S +4559(is)S +4695(speci\256ed)S +5146(is)S +5364 V +900("unix:/tmp/.IMT%d",)S +1909(failing)S +2251(that)S +2471(a)S +2574(connection)S +3110(is)S +3239(attempted)S +3727(on)S +3892(the)S +4082(/dev/imt1[io])S +4719(named)S +5067(\256fo)S +5484 V +900(pipes.)S +5724 V +11 B +900(3.1.)S +1132(Domain)S +1538(Sockets)S +5880 V +11 R +1175(Domain)S +1576(sockets)S +1946(are)S +2125(sockets)S +2495(created)S +2856(on)S +3013(the)S +3194(local)S +3454(host.)S +3746(The)S +3963(connection)S +4491(is)S +4612(usually)S +4978(faster)S +6000 V +900(than)S +1130(an)S +1274(inet)S +1479(socket)S +1799(and)S +1997(comparable)S +2547(to)S +2673(a)S +2761(\256fo.)S +3015(If)S +3127(the)S +3301(socket)S +3621(name)S +3898(is)S +4012(speci\256ed)S +4442(with)S +4678(a)S +4766('%d')S +5024(\256eld)S +6120 V +900(the)S +1073(client)S +1356(can)S +1546(be)S +1688(assured)S +2055(of)S +2185(a)S +2272(unique)S +2610(socket)S +2929(name)S +3205(for)S +3371(each)S +3609(user)S +3831(allowing)S +4256(multiple)S +4664(clients)S +4991(to)S +5117(be)S +6240 V +900(run)S +1079(on)S +1222(the)S +1389(same)S +1647(host)S +1864(by)S +2007(di)S +2093 H + (f)show 11 -.5 mul h (f)show +11 R +2160(erent)S +2411(users.)S +6396 V +900(Example)S +11 Y1 +900(2)S +905(2222222)S +6696 V +11 C +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(local)S +2825(host)S +3155(using)S +3551(socket)S +4013(domain)S +4475(socket.)S +5003(*/)S +6816 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("unix:/tmp/.IMT%d"\)\))S +3947(==)S +4145(NULL\))S +4541({)S +6936 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(domain)S +3947(socket)S +4409(connection\\n"\);)S +7056 V +1505(exit)S +1835(\(1\);)S +7176 V +1175(})S +7920 V +EP +%%Page: 3 6 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2963(- 3 -)S +840 V +11 B +900(3.2.)S +1132(Named)S +1500(FIFO)S +1796(Pipes)S +996 V +11 R +1175(This)S +1426(is)S +1555(the)S +1744(traditional)S +2251(approach,)S +2734(and)S +2947(the)S +3136(only)S +3387(one)S +3600(supported)S +4089(by)S +4255(SAOimage)S +4799(\(although)S +1116 V +900(recent)S +1208(versions)S +1616(contain)S +1981(support)S +2353(for)S +2522(sockets\).)S +2951(Any)S +3182(named)S +3516(\256fo)S +3711(pipe)S +3942(may)S +4173(be)S +4318(used,)S +4589(the)S +4765(syntax)S +5093(for)S +1236 V +900(the)S +11 I +1067(imtdev)S +11 R +1392(string)S +1676(in)S +1795(this)S +1988(case)S +2208(is)S +1416 V +11 B +1450(\256fo:)S +11 C +1639()S +11 B +2431(:)S +11 C +2467()S +1632 V +11 R +900(Example)S +11 Y1 +900(2)S +905(2222222)S +1812 V +11 C +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(local)S +2825(host)S +3155(using)S +3551(named)S +3947(fifo)S +4277(pipes.)S +4739(*/)S +1932 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("fifo:/dev/imt1i:/dev/imt1o"\)\))S +4607(==)S +4805(NULL\))S +5201({)S +2052 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(fifo)S +3815(pipe)S +4145(connection\\n"\);)S +2172 V +1505(exit)S +1835(\(1\);)S +2292 V +1175(})S +2532 V +11 B +900(3.3.)S +1132(Inet)S +1354(Sockets)S +2688 V +11 R +1175(Inet)S +1378(sockets)S +1734(are)S +1899(connections)S +2456(between)S +2854(hosts)S +3115(via)S +3283(a)S +3365(tcp/ip)S +3650(socket.)S +4025(This)S +4255(permits)S +4619(connecting)S +5134(to)S +2808 V +900(the)S +1067(server)S +1366(over)S +1593(a)S +1674(remote)S +2011(network)S +2403(connection)S +2917(anywhere)S +3374(on)S +3517(the)S +3684(Internet.)S +2964 V +900(Example)S +11 Y1 +900(2)S +905(2222222)S +3144 V +11 C +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(local)S +2825(host)S +3155(using)S +3551(socket)S +4013(5137.)S +4409(*/)S +3264 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("inet:5137"\)\))S +3485(==)S +3683(NULL\))S +4079({)S +3384 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(inet)S +3815(socket)S +4277(connection\\n"\);)S +3504 V +1505(exit)S +1835(\(1\);)S +3624 V +1175(})S +3864 V +1175(/*)S +1373(Connection)S +2099(to)S +2297(a)S +2429(remote)S +2891(internet)S +3485(host)S +3815(using)S +4211(socket)S +4673(5137.)S +5069(*/)S +3984 V +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\("inet:5137:foo.bar.edu"\)\))S +4277(==)S +4475(NULL\))S +4871({)S +4104 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(inet)S +3815(socket)S +4277(connection\\n"\);)S +4224 V +1505(exit)S +1835(\(1\);)S +4344 V +1175(})S +4584 V +11 B +900(3.4.)S +1132(User-De\256ned)S +1780(Connections)S +4740 V +11 R +1175(Since)S +1465(IRAF)S +1762(V2.10.3)S +2163(client)S +2453(tasks)S +2719(have)S +2971(been)S +3223(able)S +3451(to)S +3583(use)S +3775(an)S +11 B +3924(IMTDEV)S +11 R +4422(unix)S +4665(environment)S +4860 V +900(variable)S +1286(to)S +1406(set)S +1562(the)S +1730(connection)S +2245(type,)S +2496(the)S +2663(syntax)S +2983(of)S +3107(this)S +3300(variable)S +3685(is)S +3792(the)S +3959(same)S +4217(as)S +4341(described)S +4793(above.)S +5148(If)S +4980 V +900(the)S +11 I +1069(cdl_open\(\))S +11 R +1578(procedure)S +2049(is)S +2158(called)S +2454(with)S +2685(a)S +2768(NULL)S +3095(pointer)S +3441(the)S +3610(IMTDEV)S +4071(environment)S +4661(variable)S +5048(will)S +5100 V +900(automatically)S +1544(be)S +1693(checked.)S +2157(To)S +2325(explicitly)S +2787(use)S +2979(this)S +3185(\(or)S +3358(any)S +3562(other\))S +3868(variable)S +4265(in)S +4396(the)S +4575(client)S +4864(task)S +5086(the)S +5220 V +11 I +900(cdl_open\(\))S +11 R +1407(procedure)S +1876(may)S +2098(be)S +2234(called)S +2528(as)S +2652(e.g.)S +5400 V +11 C +1175(if)S +1373(\(\(cdl)S +1769(=)S +1901(cdl_open)S +2495(\(getenv\("IMTDEV"\)\)\))S +3815(==)S +4013(NULL\))S +4409({)S +5520 V +1505(fprintf)S +2033(\(stderr,)S +2627("cannot)S +3155(open)S +3485(server)S +3947(connection\\n"\);)S +5640 V +1505(exit)S +1835(\(1\);)S +5760 V +1175(})S +6000 V +11 B +900(4.)S +1049(Image)S +1374(Display)S +6240 V +900(4.1.)S +1132(Overview)S +1615(of)S +1739(the)S +1918(Display)S +2307(Process)S +6396 V +11 R +1175(Basic)S +1492(image)S +1833(display)S +2224(is)S +2371(done)S +2658(most)S +2947(easily)S +3277(using)S +3590(the)S +3798(high-level)S +11 B +4317(cdl_displayIRAF\(\))S +11 R +5192(,)S +6516 V +11 B +900(cdl_displayFITS\(\))S +11 R +1807(and)S +11 B +2018(cdl_displayPix\(\))S +11 R +2831(procedures.)S +3424(These)S +3738(routines)S +4145(automatically)S +4796(de\256ne)S +5117(an)S +6636 V +900(image)S +1218(WCS)S +1507(and)S +1715(mapping,)S +2178(clear)S +2439(the)S +2623(frame,)S +2955(set)S +3127(the)S +3311(frame)S +3615(bu)S +3725 H + (f)show 11 -.5 mul h (f)show +11 R +3792(er)S +3926(con\256guration)S +4562(and)S +4770(center)S +5086(the)S +6756 V +900(image)S +1237(in)S +1392(the)S +1595(display.)S +2043(For)S +2265(most)S +2549(applications)S +3149(these)S +3443(are)S +3644(all)S +3823(that)S +4057(will)S +4298(be)S +4470(needed,)S +4876(but)S +5086(the)S +6876 V +11 B +900(cdl_writeSubRaster\(\))S +11 R +1940(procedure)S +2411(can)S +2597(also)S +2809(be)S +2947(used)S +3183(to)S +3304(display)S +3657(an)S +3795(image.)S +4159(For)S +4347(example,)S +4781(to)S +4902(display)S +6996 V +900(one)S +1109(image)S +1428(in)S +1565(a)S +1664(mosaic)S +2026(or)S +2168(other)S +2444(cases)S +2725(where)S +3042(the)S +3226(task)S +3453(needs)S +3752(low-level)S +4216(access)S +4544(to)S +4680(position)S +5086(the)S +7116 V +900(image)S +1201(or)S +1325(write)S +1583(raw)S +1779(pixel)S +2032(values.)S +7920 V +EP +%%Page: 4 7 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 4 -)S +840 V +1175(In)S +1322(these)S +1603(cases)S +1889(it)S +2007(is)S +2137(the)S +2328(responsibility)S +2985(of)S +3133(the)S +3324(client)S +3625(program)S +4053(to)S +4196(prepare)S +4579(the)S +4770(server)S +5093(for)S +960 V +900(display.)S +1312(The)S +1515(basic)S +1773(steps)S +2026(involved)S +2444(in)S +2563(displaying)S +3055(an)S +3191(image)S +3492(include)S +1200 V +11 B +1407(Operation)S +3773(CDL)S +4038(Procedure)S +1210 V +11 Y1 +1407(2)S +1413(222222222222222222222222222222222222222222222222222222222222)S +1330 V +11 R +1407(Selecting)S +1849(the)S +2016(frame)S +11 I +3773(cdl_setFrame\(\))S +1450 V +11 R +1407(Clear)S +1677(the)S +1844(frame)S +11 I +3773(cdl_clearFrame\(\))S +1570 V +11 R +1407(Select)S +1708(the)S +1875(frame)S +2162(bu)S +2272 H + (f)show 11 -.5 mul h (f)show +11 R +2339(er)S +2456(con\256guration)S +11 I +3773(cdl_selectFB\(\))S +1690 V +11 R +1407(Set)S +1581(the)S +1748(frame)S +2035(bu)S +2145 H + (f)show 11 -.5 mul h (f)show +11 R +2212(er)S +2329(con\256guration)S +11 I +3773(cdl_setFBCon\256g\(\))S +1810 V +11 R +1407(Scale)S +1677(the)S +1844(image)S +2145(pixels)S +2441(to)S +2560(201)S +2758(display)S +3109(values)S +11 I +3773(cdl_zscaleImage\(\))S +1930 V +11 R +1407(Compute)S +1844(the)S +2011(raster)S +2286(placement)S +2769(in)S +2888(the)S +3055(frame)S +3342(bu)S +3452 H + (f)show 11 -.5 mul h (f)show +11 R +3519(er)S +2050 V +1407(Construct)S +1868(a)S +11 I +1949(node!path)S +11 R +2427(image)S +2728(path)S +2170 V +1407(Set)S +1581(the)S +1748(image)S +2049(mapping)S +11 I +3773(cdl_setMapping\(\))S +2290 V +11 R +1407(De\256ne)S +1732(the)S +1899(image)S +2200(WCS)S +2410 V +1407(Set)S +1581(the)S +1748(image)S +2049(WCS)S +11 I +3773(cdl_setWCS\(\))S +2530 V +11 R +1407(Write)S +1689(the)S +1856(pixels)S +2152(to)S +2271(the)S +2438(display)S +11 I +3773(cdl_writeSubRaster\(\))S +2770 V +11 R +900(In)S +1044(cases)S +1328(like)S +1547(a)S +1649(mosaic)S +2014(display,)S +2414(obviously)S +2903(some)S +3189(steps)S +3463(\(e.g.)S +3712(clearing)S +4118(the)S +4306(frame,)S +4642(selecting)S +5086(the)S +2890 V +900(con\256guration,)S +1548(etc\))S +1745(will)S +1950(only)S +2179(need)S +2418(to)S +2537(be)S +2673(done)S +2919(once.)S +3219(XImtool)S +3625(V1.3)S +3875(and)S +4066(later)S +4293(version)S +4649(support)S +5012(mul-)S +3010 V +900(tiple)S +1147(WCSs)S +1480(in)S +1617(a)S +1716(single)S +2030(frame)S +2335(so)S +2484(each)S +2734(piece)S +3015(of)S +3157(the)S +3342(mosaic)S +3704(should)S +4050(de\256ne)S +4370(a)S +4470(mapping)S +4907(and)S +5117(an)S +3130 V +900(independent)S +1487(WCS.)S +1838(The)S +2058(last)S +2261(step)S +2488(in)S +2624(the)S +2808(display)S +3176(here)S +3413(should)S +3757(be)S +3910(a)S +4008(single)S +4321(WCS)S +4610(for)S +4787(the)S +4971(entire)S +3250 V +900(mosaic)S +1264(such)S +1518(as)S +1662(")S +11 I +1707(detector)S +2119(coordinates)S +11 R +2638(",)S +2764(without)S +3154(this)S +3367(the)S +3555(coordinates)S +4114(used)S +4369(by)S +4533(default)S +4891(will)S +5117(be)S +3370 V +900(based)S +1195(on)S +1351(the)S +1530(last)S +1728(WCS)S +2012(sent)S +2234(to)S +2365(the)S +2544(display.)S +2968(Servers)S +3341(which)S +3654(do)S +3809(not)S +3995(support)S +4370(mappings)S +4843(will)S +5060(just)S +3490 V +900(ignore)S +1227(the)S +1408(mapping)S +1840(information,)S +2434(but)S +2622(may)S +2858(still)S +3072(require)S +3428(a)S +3523(frame)S +3824(bu)S +3934 H + (f)show 11 -.5 mul h (f)show +11 R +4001(er)S +4132(WCS)S +4418(for)S +4593(other)S +4866(tasks)S +5134(to)S +3610 V +900(operate)S +1269(correctly.)S +1766(For)S +1967(simple)S +2309(displays)S +2718(of)S +2857(single)S +3168(images,)S +3555(the)S +3737(high-level)S +4230(routines)S +4632(handle)S +4972(all)S +5129(of)S +3730 V +900(these)S +1164(steps)S +1423(automatically,)S +2088(they)S +2316(are)S +2487(included)S +2904(here)S +3130(as)S +3260(checklist)S +3689(of)S +3819(what)S +4071(must)S +4326(be)S +4469(considered)S +4983(when)S +3850 V +900(using)S +1172(the)S +1339(CDL)S +1592(for)S +1752(low-level)S +2199(display.)S +4090 V +11 B +900(4.2.)S +1132(Displaying)S +1669(IRAF)S +1970(Images)S +4246 V +11 R +1175(The)S +11 B +1379(cdl_displayIRAF\(\))S +11 R +2288(procedure)S +2758(can)S +2943(be)S +3080(used)S +3315(to)S +3435(display)S +3787(an)S +3924(IRAF)S +4209(OIF)S +4420(format)S +4746(image)S +5049(\(i.e.)S +4366 V +900(images)S +1252(with)S +1489(a)S +11 I +1578(.imh)S +11 R +1812(extension\))S +2310(by)S +2461(simply)S +2803(passing)S +3174(in)S +3300(the)S +3474(image)S +3782(name.)S +4120(Pixel)S +4387(\256les)S +4611(for)S +4778(the)S +4952(image)S +4486 V +900(must)S +1150(be)S +1288(accessible)S +1766(from)S +2014(the)S +2183(local)S +2431(machine)S +2837(but)S +3013(can)S +3199(be)S +3337(in)S +3458(any)S +3651(directory,)S +4109(the)S +4278(HDR$)S +4600(syntax)S +4923(for)S +5086(the)S +4606 V +900(imdir)S +1174(is)S +1283(also)S +1495(recognized.)S +2070(Images)S +2421(may)S +2645(be)S +2783(three)S +3036(dimensional,)S +3637(the)S +11 I +3806(band)S +11 R +4060(argument)S +4508(is)S +4616(used)S +4851(to)S +4971(select)S +4726 V +900(the)S +1073(image)S +1380(band)S +1632(to)S +1757(be)S +1899(displayed.)S +2420(The)S +11 I +2629(frame)S +11 R +2924(and)S +11 I +3121(fbcon\256g)S +11 R +3514(arguments)S +4011(select)S +4300(the)S +4474(frame)S +4768(and)S +4966(frame)S +4846 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1210(size)S +1429(respectively,)S +2035(the)S +2218(special)S +2571(symbolic)S +3024(value)S +11 B +3310(FB_AUTO)S +11 R +3872(may)S +4109(be)S +4260(used)S +4509(for)S +4684(the)S +11 I +4866(fbcon\256g)S +4966 V +11 R +900(argument)S +1358(to)S +1488(have)S +1738(the)S +1916(procedure)S +2396(automatically)S +3038(select)S +3331(the)S +3509(frame)S +3807(bu)S +3917 H + (f)show 11 -.5 mul h (f)show +11 R +3984(er)S +4112(most)S +4371(appropriate)S +4914(for)S +5086(the)S +5086 V +900(image)S +1208(size.)S +1479(If)S +1591(the)S +11 I +1765(zscale)S +11 R +2073(\257ag)S +2278(is)S +2392(greater)S +2734(than)S +2963(zero)S +3190(the)S +3364(image)S +3672(will)S +3884(automatically)S +4522(be)S +4664(converted)S +5134(to)S +5206 V +900(8-bit)S +1154(values)S +1480(using)S +1765(the)S +1945(zscale)S +2257(mapping)S +2688(algorithm.)S +3223(The)S +3439(function)S +3851(returns)S +4201(a)S +4295(positive)S +4690(value)S +4973(if)S +5086(the)S +5326 V +900(image)S +1201(cannot)S +1526(be)S +1662(accessed)S +2076(or)S +2200(displayed)S +2654(for)S +2814(any)S +3005(reason,)S +3351(an)S +3487(error)S +3731(message)S +4135(will)S +4340(be)S +4476(printed.)S +5482 V +1175(The)S +11 I +1393(cdl_isIRAF\(\))S +11 R +2013(procedure)S +2497(returns)S +2849(a)S +2946(positive)S +3344(value)S +3630(if)S +3746(the)S +3929(\256lename)S +4356(argument)S +4819(is)S +4942(recog-)S +5602 V +900(nized)S +1177(as)S +1308(an)S +1451(IRAF)S +1742(image,)S +2078(it)S +2180(does)S +2421(not)S +2602(check)S +2896(whether)S +3288(the)S +3462(pixel)S +3722(\256le)S +3903(can)S +4094(be)S +4236(successfully)S +4811(accessed.)S +5722 V +900(For)S +1086(simply)S +1420(reading)S +1781(the)S +1948(pixels)S +2244(from)S +2490(an)S +2626(IRAF)S +2910(image)S +3211(the)S +11 B +3378(cdl_readIRAF\(\))S +11 R +4161(procedure)S +4631(may)S +4854(be)S +4991(used.)S +5842 V +900(The)S +1114(function)S +1524(returns)S +1872(a)S +1964(zero)S +2195(value)S +2475(and)S +2676(sets)S +2884(the)S +3061(output)S +3386(pixel)S +3649(array,)S +3943(image)S +4254(dimensions)S +4799(and)S +5000(pixel)S +5962 V +900(size)S +1117(if)S +1231(successful,)S +1756(otherwise)S +2229(the)S +2410(function)S +2823(returns)S +3175(a)S +3271(positive)S +3668(value.)S +4014(Note)S +4275(that)S +4488(the)S +4670(output)S +5000(pixel)S +6082 V +900(values)S +1213(may)S +1435(need)S +1674(to)S +1793(be)S +1929(scaled)S +2235(before)S +2546(they)S +2768(can)S +2952(be)S +3088(displayed.)S +6322 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6442 V +11 C +1175(int)S +1439(cdl_displayIRAF)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(char)S +3683(*fname,)S +4211(int)S +4475(band,)S +6562 V +1439(int)S +1703(frame,)S +2165(int)S +2429(fbconfig,)S +3089(int)S +3353(zscale\))S +6682 V +1175(int)S +1439(cdl_isIRAF)S +2165(\(char)S +2561(*fname\))S +6802 V +1175(int)S +1439(cdl_readIRAF)S +2297(\(char)S +2693(*fname,)S +3221(int)S +3485(band,)S +3881(uchar)S +4277(**pix,)S +6922 V +1439(int)S +1703(*nx,)S +2033(int)S +2297(*ny,)S +2627(int)S +2891(*bitpix,)S +3485(char)S +3815(*title\))S +7920 V +EP +%%Page: 5 8 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2963(- 5 -)S +840 V +11 B +900(4.3.)S +1132(Displaying)S +1669(FITS)S +1948(Images)S +996 V +11 R +1175(The)S +11 B +1385(cdl_displayFITS\(\))S +11 R +2278(procedure)S +2754(can)S +2945(be)S +3088(used)S +3329(to)S +3455(display)S +3813(a)S +11 I +3901(simple)S +11 R +4228(FITS)S +4495(image)S +4804(by)S +4955(name.)S +1116 V +900(A)S +1016("simple")S +1437(FITS)S +1701(\256le)S +1879(is)S +1990(assumed)S +2405(to)S +2528(be)S +2668(one)S +2863(containing)S +3364(a)S +3449(single)S +3749(image)S +4053(and)S +4247(having)S +4582(no)S +4728(extensions.)S +1236 V +900(Other)S +1183(types)S +1449(of)S +1574(FITS)S +1835(\256les)S +2053(may)S +2276(of)S +2401(course)S +2720(be)S +2857(displayed)S +3312(but)S +3487(the)S +3655(client)S +3933(will)S +4139(have)S +4379(to)S +4499(use)S +4680(other)S +4940(means)S +1356 V +900(to)S +1026(import)S +1360(the)S +1534(pixels.)S +1898(FITS)S +2164(image)S +2471(extensions)S +2974(may)S +3202(be)S +3344(supported)S +3816(in)S +3941(a)S +4028(future)S +4328(release)S +4669(of)S +4799(the)S +4972(CDL.)S +1476 V +900(The)S +11 I +1110(frame)S +11 R +1406(and)S +11 I +1605(fbcon\256g)S +11 R +2000(arguments)S +2498(select)S +2788(the)S +2963(frame)S +3258(and)S +3457(frame)S +3752(bu)S +3862 H + (f)show 11 -.5 mul h (f)show +11 R +3929(er)S +4054(size)S +4265(respectively,)S +4863(the)S +5038(spe-)S +1596 V +900(cial)S +1103(symbolic)S +1552(value)S +11 B +1834(FB_AUTO)S +11 R +2393(may)S +2627(be)S +2775(used)S +3021(for)S +3192(the)S +11 I +3370(fbcon\256g)S +11 R +3768(argument)S +4226(to)S +4356(have)S +4606(the)S +4784(procedure)S +1716 V +900(automatically)S +1540(select)S +1831(the)S +2007(frame)S +2303(bu)S +2413 H + (f)show 11 -.5 mul h (f)show +11 R +2480(er)S +2606(most)S +2863(appropriate)S +3403(for)S +3573(the)S +3750(image)S +4061(size.)S +4335(If)S +4450(the)S +11 I +4627(zscale)S +11 R +4938(\257ag)S +5146(is)S +1836 V +900(greater)S +1236(than)S +1459(zero)S +1680(the)S +1847(image)S +2148(will)S +2353(automatically)S +2984(be)S +3120(converted)S +3584(to)S +3703(8-bit)S +3944(values)S +4257(using)S +4529(the)S +4696(zscale)S +4995(map-)S +1956 V +900(ping)S +1154(algorithm.)S +1702(The)S +1931(function)S +2356(returns)S +2719(a)S +2826(positive)S +3234(value)S +3530(if)S +3656(the)S +3849(image)S +4176(cannot)S +4527(be)S +4689(accessed)S +5129(or)S +2076 V +900(displayed)S +1354(for)S +1514(any)S +1705(reason,)S +2051(an)S +2187(error)S +2431(message)S +2835(will)S +3040(be)S +3176(printed.)S +2232 V +1175(The)S +11 I +1378(cdl_isFITS\(\))S +11 R +1966(procedure)S +2435(returns)S +2772(a)S +2853(positive)S +3235(value)S +3505(if)S +3605(the)S +3773(\256lename)S +4185(argument)S +4633(is)S +4741(recognized)S +2352 V +900(as)S +1037(a)S +1131(simple)S +1470(FITS)S +1742(image.)S +2116(For)S +2314(simply)S +2660(reading)S +3033(the)S +3212(image)S +3525(pixels)S +3833(the)S +11 B +4012(cdl_readFITS\(\))S +11 R +4784(procedure)S +2472 V +900(may)S +1123(be)S +1260(used.)S +1556(The)S +1760(output)S +2076(pixel)S +2330(array,)S +2615(image)S +2917(dimensions)S +3453(and)S +3645(pixel)S +3899(size)S +4103(are)S +4269(returned)S +4668(if)S +4770(successful)S +2592 V +900(otherwise)S +1362(the)S +1532(function)S +1934(returns)S +2274(a)S +2358(positive)S +2743(value.)S +3077(Note)S +3326(that)S +3527(the)S +3697(returned)S +4097(pixel)S +4353(values)S +4669(may)S +4893(need)S +5134(to)S +2712 V +900(be)S +1036(scaled)S +1342(before)S +1653(they)S +1875(can)S +2059(be)S +2195(displayed.)S +2952 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3072 V +11 C +1175(int)S +1439(cdl_displayFITS)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(char)S +3683(*fname,)S +4211(int)S +4475(frame,)S +3192 V +1439(int)S +1703(fbconfig,)S +2363(int)S +2627(zscale\))S +3312 V +1175(int)S +1439(cdl_isFITS)S +2165(\(char)S +2561(*fname\))S +3432 V +1175(int)S +1439(cdl_readFITS)S +2297(\(char)S +2693(*fname,)S +3221(uchar)S +3617(**pix,)S +4079(int)S +4343(*nx,)S +4673(int)S +4937(*ny,)S +3552 V +1439(int)S +1703(*bitpix,)S +2297(char)S +2627(*title\))S +3792 V +11 B +900(4.4.)S +1132(Displaying)S +1669(Raw)S +1915(Pixels)S +3948 V +11 R +1175(The)S +11 B +1381(cdl_displayPix\(\))S +11 R +2177(procedure)S +2649(can)S +2837(be)S +2977(used)S +3215(to)S +3338(display)S +3693(an)S +3833(arbitrary)S +4246(array)S +4506(of)S +4634(pixels)S +4934(of)S +5062(any)S +4068 V +900(size.)S +1166(The)S +11 I +1371(nx)S +11 R +1509(and)S +11 I +1701(ny)S +11 R +1838(arguments)S +2329(are)S +2495(the)S +2663(raster)S +2939(dimensions,)S +3503(and)S +11 I +3695(bitpix)S +11 R +3980(is)S +4088(the)S +4256(pixel)S +4510(size)S +4714(and)S +4906(has)S +5086(the)S +4188 V +900(same)S +1178(meaning)S +1609(as)S +1753(the)S +1940(FITS)S +2220(BITPIX)S +2627(keyword.)S +3124(The)S +11 I +3347(frame)S +11 R +3656(and)S +11 I +3867(fbcon\256g)S +11 R +4274(arguments)S +4784(select)S +5086(the)S +4308 V +900(frame)S +1199(and)S +1402(frame)S +1701(bu)S +1811 H + (f)show 11 -.5 mul h (f)show +11 R +1878(er)S +2007(size)S +2222(respectively,)S +2824(the)S +3003(special)S +3352(symbolic)S +3800(value)S +11 B +4081(FB_AUTO)S +11 R +4639(may)S +4872(be)S +5019(used)S +4428 V +900(for)S +1082(the)S +11 I +1271(fbcon\256g)S +11 R +1680(argument)S +2149(to)S +2290(have)S +2551(the)S +2740(procedure)S +3231(automatically)S +3884(select)S +4188(the)S +4378(frame)S +4688(bu)S +4798 H + (f)show 11 -.5 mul h (f)show +11 R +4865(er)S +5005(most)S +4548 V +900(appropriate)S +1441(for)S +1611(the)S +1788(image)S +2099(size.)S +2372(If)S +2486(the)S +11 I +2662(zscale)S +11 R +2972(\257ag)S +3179(is)S +3295(greater)S +3639(than)S +3870(zero)S +4099(the)S +4275(image)S +4585(will)S +4799(automati-)S +4668 V +900(cally)S +1146(be)S +1282(converted)S +1746(to)S +1865(8-bit)S +2106(values)S +2419(using)S +2691(the)S +2858(zscale)S +3157(mapping)S +3575(algorithm.)S +4908 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5028 V +11 C +1175(int)S +1439(cdl_displayPix)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(uchar)S +3683(*pix,)S +4079(int)S +4343(nx,)S +4607(int)S +4871(ny,)S +5148 V +1439(int)S +1703(bitpix,)S +2231(int)S +2495(frame,)S +2957(int)S +3221(fbconfig,)S +3881(int)S +4145(zscale\))S +5388 V +11 B +900(4.5.)S +1132(Frame)S +1474(Selection)S +5544 V +11 R +1175(Frame)S +1495(selection)S +1925(is)S +2039(normally)S +2476(done)S +2729(as)S +2860(an)S +3003(argument)S +3457(to)S +3583(one)S +3781(of)S +3913(the)S +4088(display)S +4447(procedures,)S +4995(how-)S +5664 V +900(ever)S +1127(frames)S +1464(may)S +1693(be)S +1836(explicitly)S +2292(selected)S +2684(using)S +2963(the)S +11 B +3136(cdl_setFrame\(\))S +11 R +3879(procedure.)S +4415(This)S +4650(allows)S +4976(client)S +5784 V +900(programs)S +1361(to)S +1494(essentially)S +2005("blink")S +2370(frames)S +2715(independently,)S +3413(as)S +3552(long)S +3796(as)S +3935(the)S +4117(server)S +4431(supports)S +4852(multiple)S +5904 V +900(frames.)S +1291(The)S +11 B +1494(cdl_getFrame\(\))S +11 R +2243(procedure)S +2712(may)S +2934(be)S +3070(used)S +3304(to)S +3423(get)S +3590(the)S +3757(current)S +4099(frame)S +4386(set)S +4541(in)S +4660(the)S +4827(server.)S +6144 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6264 V +11 C +1175(void)S +1505(cdl_setFrame)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(frame\))S +6384 V +1175(void)S +1505(cdl_getFrame)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(*frame\))S +6624 V +11 B +900(4.6.)S +1132(Clearing)S +1574(the)S +1753(Display)S +6780 V +11 R +1175(The)S +1400(current)S +1764(display)S +2137(frame)S +2446(may)S +2690(be)S +2848(explicitly)S +3320(cleared)S +3690(using)S +3985(the)S +11 B +4175(cdl_clearFrame\(\))S +11 R +5038(pro-)S +6900 V +900(cedure.)S +1329(The)S +1577(frame)S +1909(is)S +2061(also)S +2316(cleared)S +2707(prior)S +2997(to)S +3160(displaying)S +3696(new)S +3955(images)S +4343(by)S +4530(the)S +4741(procedures)S +7020 V +11 B +900(cdl_displayPix\(\))S +11 R +1660(,)S +11 B +1721(cdl_displayFITS\(\))S +11 R +2574(,)S +2635(and)S +11 B +2826(cdl_displayIRAF\(\))S +11 R +3701(.)S +7260 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7920 V +EP +%%Page: 6 9 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 6 -)S +840 V +11 C +1175(int)S +1439(cdl_clearFrame)S +2429(\(CDLPtr)S +2957(cdl\))S +1080 V +11 B +900(4.7.)S +1132(Frame)S +1474(Bu)S +1610 H + (f)show 11 -.5 mul h (f)show +11 B +1677(er)S +1806(Selection)S +1236 V +11 R +1175(The)S +1415(default)S +1789(frame)S +2113(bu)S +2223 H + (f)show 11 -.5 mul h (f)show +11 R +2290(er)S +2444(used)S +2715(is)S +2859(512x512,)S +3342(other)S +3637(sizes)S +3920(may)S +4179(be)S +4353(selected)S +4776(using)S +5086(the)S +1356 V +11 B +900(cdl_setFBCon\256g\(\))S +11 R +1796(procedure.)S +2340(To)S +2509(set)S +2678(the)S +2859(frame)S +3160(bu)S +3270 H + (f)show 11 -.5 mul h (f)show +11 R +3337(er)S +3467(size)S +3683(the)S +3863(client)S +4153(passes)S +4479(the)S +4659(frame)S +4959(bu)S +5069 H + (f)show 11 -.5 mul h (f)show +11 R +5136(er)S +1476 V +900(number)S +1284(as)S +1424(de\256ned)S +1796(in)S +1931(the)S +2114(frame)S +2417(bu)S +2527 H + (f)show 11 -.5 mul h (f)show +11 R +2594(er)S +2727(con\256guration)S +3362(\256le)S +3552(\(see)S +3776(below\))S +4130(while)S +4424(setting)S +4768(the)S +4952(image)S +1596 V +900(WCS.)S +1243(It)S +1353(is)S +1470(important)S +1941(to)S +2069(note)S +2300(that)S +2507(the)S +2683(frame)S +2979(bu)S +3089 H + (f)show 11 -.5 mul h (f)show +11 R +3156(er)S +3282(isn't)S +3520(actually)S +3909(changed)S +4315(in)S +4443(the)S +4619(server)S +4927(until)S +5172(a)S +1716 V +900(subsequent)S +11 B +1431(cdl_setWCS\(\))S +11 R +2120(call,)S +2349(either)S +2641(directly)S +3019(or)S +3154(through)S +3540(some)S +3816(other)S +4085(procedure)S +4565(which)S +4877(sets)S +5086(the)S +1836 V +900(WCS)S +1172(\(e.g.)S +1400(one)S +1591(of)S +1715(the)S +1882(display)S +2233(procedures\).)S +1992 V +1175(To)S +1384(get)S +1605(the)S +1827(size)S +2085(of)S +2264(the)S +2486(currently)S +2969(de\256ned)S +3380(frame)S +3722(bu)S +3832 H + (f)show 11 -.5 mul h (f)show +11 R +3899(er)S +4071(the)S +4293(user)S +4563(may)S +4840(call)S +5086(the)S +2112 V +11 B +900(cdl_getFBCon\256g\(\))S +11 R +1803(procedure.)S +2342(This)S +2580(returns)S +2926(not)S +3109(only)S +3347(the)S +3523(current)S +3873(con\256guration)S +4500(number,)S +4904(but)S +5086(the)S +2232 V +900(size)S +1121(as)S +1263(well.)S +1564(To)S +1737(get)S +1922(the)S +2107(size)S +2328(and)S +2537(any)S +2746(arbitrary)S +3173(con\256guration)S +3810(without)S +4199(actually)S +4598(setting)S +4944(it,)S +5086(the)S +2352 V +11 B +900(cdl_lookupFBSize\(\))S +11 R +1880(procedure)S +2371(may)S +2615(be)S +2773(used.)S +3090(Any)S +3333(con\256guration)S +3973(not)S +4168(actually)S +4569(de\256ned)S +4946(in)S +5086(the)S +2472 V +900(frame)S +1187(bu)S +1297 H + (f)show 11 -.5 mul h (f)show +11 R +1364(er)S +1481(con\256guration)S +2100(\256le)S +2274(is)S +2381(returned)S +2778(as)S +2902(the)S +3069(default)S +3406(512x512)S +3824(size.)S +2712 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2832 V +11 C +1175(void)S +1505(cdl_setFBConfig)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(int)S +3683(configno\))S +2952 V +1175(void)S +1505(cdl_getFBConfig)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(int)S +3683(*configno,)S +4409(int)S +4673(*width,)S +3072 V +1439(int)S +1703(*height,)S +2297(int)S +2561(*nframes\))S +3192 V +1175(void)S +1505(cdl_lookupFBSize)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(configno,)S +4409(int)S +4673(*width,)S +3312 V +1439(int)S +1703(*height,)S +2297(int)S +2561(*nframes\))S +3552 V +11 B +900(4.7.1.)S +1215(Automatic)S +1741(Selection)S +3708 V +11 R +1175(The)S +11 B +1383(cdl_selectFB\(\))S +11 R +2084(procedure)S +2558(may)S +2785(be)S +2926(used)S +3165(to)S +3289(select)S +3577(the)S +3750(most)S +4004(appropriate)S +4541(frame)S +4834(bu)S +4944 H + (f)show 11 -.5 mul h (f)show +11 R +5011(er)S +5134(to)S +3828 V +900(use)S +1085(for)S +1251(a)S +1338(given)S +1621(image)S +1928(size.)S +2198(If)S +2309(possible)S +2709(a)S +2796(frame)S +3089(bu)S +3199 H + (f)show 11 -.5 mul h (f)show +11 R +3266(er)S +3389(the)S +3562(same)S +3825(size)S +4033(as)S +4162(the)S +4334(image)S +4640(will)S +4850(be)S +4991(used,)S +3948 V +900(otherwise)S +1364(one)S +1560(that)S +1763(is)S +1875(larger)S +2167(will)S +2377(be)S +2518(chosen.)S +2922(Rather)S +3253(than)S +3481(simply)S +3821(selecting)S +4250(the)S +4423(\256rst)S +4634(con\256guration)S +4068 V +900(larger)S +1192(than)S +1419(the)S +1590(image,)S +1923(the)S +2094(procedure)S +2567(searches)S +2973(the)S +3144(entire)S +3430(con\256guration)S +4053(\256le)S +4231(selecting)S +4658(the)S +4829(one)S +5024(with)S +4188 V +900(the)S +1067(least)S +1302(empty)S +1611(space)S +1887(in)S +2007(both)S +2237(dimensions.)S +2834(If)S +2940(the)S +11 I +3108(reset)S +11 R +3355(\257ag)S +3554(is)S +3662(non-zero)S +4084(this)S +4278(frame)S +4566(is)S +4674(set)S +4830(automat-)S +4308 V +900(ically)S +1184(by)S +1334(the)S +1508(procedure,)S +2012(otherwise)S +2478(the)S +2652(selected)S +3044(dimension)S +3543(is)S +3657(simply)S +3998(returned)S +4402(to)S +4527(the)S +4700(calling)S +5038(pro-)S +4428 V +900(gram.)S +1227(In)S +1359(either)S +1649(case)S +1877(the)S +2052(new)S +2275(frame)S +2570(bu)S +2680 H + (f)show 11 -.5 mul h (f)show +11 R +2747(er)S +2872(will)S +3085(not)S +3267(take)S +3490(e)S +3538 H + (f)show 11 -.5 mul h (f)show +11 R +3605(ect)S +3773(until)S +4017(a)S +4107(new)S +4331(WCS)S +4612(is)S +4728(de\256ned)S +5093(for)S +4548 V +900(the)S +1067(frame.)S +4788 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4908 V +11 C +1175(void)S +1505(cdl_selectFB)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(nx,)S +3749(int)S +4013(ny,)S +4277(int)S +4541(*fb,)S +5028 V +1450(int)S +1714(*w,)S +1978(int)S +2242(*h,)S +2506(int)S +2770(*nf,)S +3100(int)S +3364(reset\))S +5268 V +11 B +900(4.7.2.)S +1215(The)S +1432(Frame)S +1774(Bu)S +1910 H + (f)show 11 -.5 mul h (f)show +11 B +1977(er)S +2106(Con\256guration)S +2801(File)S +5424 V +11 R +1175(The)S +1378(size)S +1581(of)S +1705(the)S +1872(frame)S +2160(bu)S +2270 H + (f)show 11 -.5 mul h (f)show +11 R +2337(er)S +2455(is)S +2563(not)S +2738(passed)S +3064(directly)S +3433(to)S +3553(the)S +3721(server)S +4021(since)S +4280(this)S +4474(is)S +4582(not)S +4757(part)S +4961(of)S +5086(the)S +5544 V +900(communications)S +1675(protocol)S +2089(used.)S +2399(Instead,)S +2790(the)S +2971(frame)S +3272(bu)S +3382 H + (f)show 11 -.5 mul h (f)show +11 R +3449(er)S +3580(number)S +3962(is)S +4083(sent)S +4307(as)S +4445(part)S +4662(of)S +4800(the)S +4981(WCS)S +5664 V +900(header)S +1247(packet.)S +1650(So)S +1824(that)S +2046(both)S +2299(the)S +2490(server)S +2813(and)S +3028(client)S +3330(can)S +3539(know)S +3841(that)S +4064(a)S +4170(particular)S +4647(frame)S +4959(bu)S +5069 H + (f)show 11 -.5 mul h (f)show +11 R +5136(er)S +5784 V +900(number)S +1277(corresponds)S +1848(to)S +1976(a)S +2066(speci\256c)S +2443(size,)S +2683(a)S +11 I +2773(frame)S +3071(bu)S +3181 H + (f)show 11 -.5 mul h (f)show +11 I +3237(er)S +3370(con\256guration)S +4005(\256le)S +11 R +4181(is)S +4297(used)S +4540(which)S +4849(both)S +5086(the)S +5904 V +900(client)S +1177(and)S +1368(server)S +1667(read.)S +6060 V +1175(The)S +1383(default)S +1725(con\256guration)S +2349(\256le)S +2528(is)S +2640(/usr/local/lib/imtoolrc,)S +3667(this)S +3865(can)S +4055(be)S +4197(overridden)S +4710(by)S +4859(de\256ning)S +6180 V +900(an)S +11 B +1038(IMTOOLRC)S +11 R +1697(environment)S +2287(variable)S +2674(naming)S +3039(the)S +3208(\256le)S +3384(to)S +3505(be)S +3643(used,)S +3907(or)S +4032(by)S +4176(creating)S +4562(a)S +4644(.imtoolrc)S +5079(\256le)S +6300 V +900(in)S +1022(your)S +1259(home)S +1539(directory.)S +2031(Since)S +2311(the)S +2481(server)S +2783(must)S +3034(also)S +3247(read)S +3470(the)S +3640(same)S +3901(\256le,)S +4106(this)S +4302(must)S +4553(be)S +4692(done)S +4942(before)S +6420 V +900(starting)S +1263(both)S +1492(the)S +1659(client)S +1936(and)S +2127(server)S +2426(applications.)S +6576 V +900(The)S +1103(format)S +1428(of)S +1552(the)S +1719(frame)S +2006(bu)S +2116 H + (f)show 11 -.5 mul h (f)show +11 R +2183(er)S +2300(con\256guration)S +2919(\256le)S +3093(is)S +6756 V +11 I +1175(con\256gno)S +1586(nframes)S +1973(width)S +2252(height)S +2560([extra)S +2861(\256elds])S +6936 V +11 R +900(e.g.)S +7116 V +1230(1)S +1351(2)S +1472(512)S +1703(512)S +7236 V +1230(2)S +1351(2)S +1472(800)S +1703(800)S +7920 V +EP +%%Page: 7 10 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 7 -)S +840 V +1230(3)S +1351(1)S +1439(1024)S +1692(1024)S +2242(#)S +2330(comment)S +960 V +1230(:)S +1327(:)S +1457(:)S +1620(:)S +1200 V +900(At)S +1050(most)S +1305(128)S +1510(frame)S +1804(bu)S +1914 H + (f)show 11 -.5 mul h (f)show +11 R +1981(er)S +2105(sizes)S +2358(may)S +2587(be)S +2730(de\256ned,)S +3121(each)S +3360(con\256guration)S +3986(may)S +4215(de\256ne)S +4523(up)S +4673(to)S +4799(4)S +4895(frames,)S +1320 V +900(con\256guration)S +1519(numbers)S +1930(need)S +2169(not)S +2343(be)S +2479(sequential)S +2957(but)S +3131(should)S +3458(be)S +3594(in)S +3713(ascending)S +4184(order.)S +1560 V +11 B +900(4.8.)S +1132(Image)S +1457(WCS)S +1741(Description)S +1716 V +11 R +1175(The)S +1380(image)S +1683(WCS)S +1957(is)S +2066(de\256ned)S +2424(using)S +2698(the)S +11 B +2868(cdl_setWCS\(\))S +11 R +3550(procedure.)S +4083(The)S +4289(WCS)S +4564(de\256nes)S +4911(a)S +4995(map-)S +1836 V +900(ping)S +1137(between)S +1542(any)S +1741(linear)S +2031(coordinate)S +2534(system)S +2881(and)S +3080(the)S +3254(image)S +3562(pixels,)S +3893(for)S +4060(our)S +4246(purposes)S +4676(we)S +4843(will)S +5055(dis-)S +1956 V +900(cuss)S +1126(how)S +1352(the)S +1523(WCS)S +1799(is)S +1910(used)S +2148(to)S +2271(map)S +2497(the)S +2668(frame)S +2959(bu)S +3069 H + (f)show 11 -.5 mul h (f)show +11 R +3136(er)S +3257(pixels)S +3557(to)S +3680(image)S +3985(coordinates.)S +4588(It)S +4692(is)S +4804(passed)S +5134(to)S +2076 V +900(the)S +1067(server)S +1366(in)S +1485(a)S +1566(string)S +1850(of)S +1974(the)S +2141(form:)S +2256 V +11 I +1428(name)S +11 R +1698(-)S +11 I +1767(title)S +11 R +1939(\\n)S +2376 V +1450(a)S +1531(b)S +1619(c)S +1700(d)S +1788(tx)S +1907(ty)S +2026(z1)S +2162(z2)S +2298(zt)S +2520 V +900(where:)S +2664 V +11 B +1362(X)S +11 R +1441(')S +1510(=)S +1605(a)S +1686(*)S +11 B +1774(X)S +11 R +1886(+)S +1981(c)S +2062(*)S +11 B +2150(Y)S +11 R +2262(+)S +2357(tx)S +2784 V +11 B +1362(Y)S +11 R +1441(')S +1510(=)S +1605(b)S +1693(*)S +11 B +1781(X)S +11 R +1893(+)S +1988(d)S +2076(*)S +11 B +2164(Y)S +11 R +2276(+)S +2371(ty)S +3024 V +900(The)S +1111(terms)S +11 I +1396(a,)S +1520(b,)S +1644(c)S +11 R +1692(,)S +1761(and)S +11 I +1960(d)S +11 R +2056(de\256ne)S +2366(a)S +2456(rotation)S +2840(of)S +2973(the)S +3149(WCS)S +3430(wrt)S +3618(the)S +3794(pixel)S +4056(\(i.e.)S +4269(frame)S +4565(bu)S +4675 H + (f)show 11 -.5 mul h (f)show +11 R +4742(er\))S +4904(coordi-)S +3144 V +900(nates,)S +1195(the)S +11 I +1371(tx)S +11 R +1492(and)S +11 I +1692(ty)S +11 R +1813(values)S +2135(are)S +2309(translation)S +2815(terms)S +3101(relative)S +3471(to)S +3599(the)S +3775(upper-left)S +4248(corner)S +4567(of)S +4699(the)S +4874(display.)S +3264 V +900(The)S +1134(remaining)S +1643(three)S +1925(values)S +2269(de\256ne)S +2601(the)S +2799(intensity)S +3243(mapping)S +3692(of)S +3847(the)S +4045(display)S +4427(pixels;)S +11 I +4785(z1)S +11 R +4947(is)S +5086(the)S +3384 V +900(minimum)S +1373(pixel)S +1636(value)S +1916(used)S +2160(in)S +2289(the)S +2466(transformation,)S +11 I +3183(z2)S +11 R +3324(is)S +3441(the)S +3618(maximum)S +4108(value,)S +4416(and)S +11 I +4617(zt)S +11 R +4733(de\256nes)S +5086(the)S +3504 V +900(type)S +1122(of)S +1246(transformation)S +1925(used)S +2159(\(0)S +2283(for)S +2443(none,)S +2717(1)S +2805(for)S +2965(linear,)S +3275(2)S +3363(for)S +3523(log10\).)S +3660 V +1175(The)S +1391(WCS)S +1676(may)S +1911(be)S +2060(set)S +2228(explicitly)S +2690(by)S +2846(the)S +3026(calling)S +3371(program)S +3788(or)S +3925(a)S +4019(default)S +4369(appropriate)S +4913(for)S +5086(the)S +3780 V +900(image)S +1209(will)S +1422(be)S +1566(set)S +1729(automatically)S +2368(by)S +2519(the)S +2694(high-level)S +3180(display)S +3539(procedures,)S +4086(otherwise)S +4552(a)S +4640(WCS)S +4919(for)S +5086(the)S +3900 V +900(frame)S +1200(bu)S +1310 H + (f)show 11 -.5 mul h (f)show +11 R +1377(er)S +1507(is)S +1627(de\256ned)S +1996(\(i.e.)S +2213(returned)S +2623(coordinates)S +3174(are)S +3352(frame)S +3652(bu)S +3762 H + (f)show 11 -.5 mul h (f)show +11 R +3829(er)S +3959(coords\).)S +4394(As)S +4562(an)S +4711(example)S +5129(of)S +4020 V +900(how)S +1134(the)S +1313(WCS)S +1597(is)S +1716(de\256ned,)S +2112(the)S +2291(default)S +2640(WCS)S +2924(for)S +3096(an)S +3244(image)S +11 I +3557(IMX)S +11 R +3796(x)S +11 I +3896(IMY)S +11 R +4130(pixels)S +4438(in)S +4569(a)S +4661(frame)S +4959(bu)S +5069 H + (f)show 11 -.5 mul h (f)show +11 R +5136(er)S +4140 V +11 I +900(FBX)S +11 R +1134(x)S +11 I +1222(FBY)S +11 R +1451(pixels)S +1747(is)S +1854(de\256ned)S +2210(as)S +4320 V +11 C +1428(a)S +1626(=)S +1824(1.0;)S +3738(/*)S +3936(no)S +4134(rotation)S +4728(*/)S +4440 V +1428(b)S +1626(=)S +1824(0.0;)S +4560 V +1428(c)S +1626(=)S +1824(0.0;)S +4680 V +1428(d)S +1626(=)S +1758(-1.0;)S +4800 V +1428(tx)S +1626(=)S +1758(\()S +11 I +1824(IMX)S +11 C +2084(/)S +2216(2\))S +2414(-)S +2546(\()S +11 I +2612(FBX)S +11 C +2879(/)S +3011(2\))S +3209(+)S +3341(1;)S +3737(/*)S +3935(center)S +4397(in)S +4595(FB)S +4793(*/)S +4920 V +1428(ty)S +1626(=)S +1758(\()S +11 I +1824(FBY)S +11 C +2086(/)S +2218(2\))S +2416(+)S +2548(\()S +11 I +2614(IMY)S +11 C +2869(/)S +3001(2\);)S +5040 V +1428(z1)S +1626(=)S +1758(z1;)S +3738(/*)S +3936(zscale)S +4398(values)S +4860(*/)S +5160 V +1428(z2)S +1626(=)S +1758(z2;)S +5280 V +1428(zt)S +1626(=)S +1758(1;)S +5520 V +11 R +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5640 V +11 C +1175(int)S +1439(cdl_setWCS)S +2165(\(CDLPtr)S +2693(cdl,)S +3023(char)S +3353(*name,)S +3815(char)S +4145(*title,)S +5760 V +1439(float)S +1835(a,)S +2033(float)S +2429(b,)S +2627(float)S +3023(c,)S +3221(float)S +3617(d,)S +3815(float)S +4211(tx,)S +4475(float)S +4871(ty,)S +5880 V +1439(float)S +1835(z1,)S +2099(float)S +2495(z2,)S +2759(int)S +3023(zt\))S +6000 V +1175(int)S +1439(cdl_getWCS)S +2165(\(CDLPtr)S +2693(cdl,)S +3023(char)S +3353(*name,)S +3815(char)S +4145(*title,)S +6120 V +1439(float)S +1835(*a,)S +2099(float)S +2495(*b,)S +2759(float)S +3155(*c,)S +3419(float)S +3815(*d,)S +4079(float)S +4475(*tx,)S +4805(float)S +5201(*ty,)S +6240 V +1439(float)S +1835(*z1,)S +2165(float)S +2561(*z2,)S +2891(int)S +3155(*zt\))S +6480 V +11 B +900(4.8.1.)S +1215(Image)S +1540(Mappings)S +6636 V +11 R +1175(Beginning)S +1668(with)S +11 B +1898(X11IRAF)S +2389(V1.3)S +11 R +2640(the)S +11 I +2808(XImtool)S +11 R +3196(display)S +3549(server)S +3850(has)S +4031(had)S +4224(the)S +4393(ability)S +4710(to)S +4831(use)S +5012(mul-)S +6756 V +900(tiple)S +1135(world)S +1430(coordinate)S +1931(systems)S +2319(in)S +2444(a)S +2531(frame)S +2824(\(e.g.)S +3058(subrasters)S +3535(of)S +3664(a)S +3750(mosaic)S +4099(display\).)S +4552(To)S +4712(do)S +4860(this,)S +5086(the)S +6876 V +11 B +900(IRAF)S +11 R +1214(and)S +11 B +1418(CDL)S +11 R +1696(display)S +2060(interfaces)S +2530(were)S +2787(modi\256ed)S +3225(to)S +3357(pass)S +3593(in)S +3726(extra)S +3991(information)S +4557(with)S +4800(the)S +4981(WCS)S +6996 V +900(string)S +1188(to)S +1311(de\256ne)S +1616(the)S +1787(mapping)S +2209(of)S +2337(the)S +2508(image)S +2813(pixels)S +3112(to)S +3234(the)S +3404(frame)S +3694(bu)S +3804 H + (f)show 11 -.5 mul h (f)show +11 R +3871(er)S +3991(pixels.)S +4351(This)S +4583(extra)S +4837(informa-)S +7116 V +900(tion)S +1119(allows)S +1453(the)S +1634(XImtool)S +2055(to)S +2189(know)S +2481(when)S +2766(the)S +2948(cursor)S +3269(in)S +3403(within)S +3733(one)S +3939(of)S +4078(the)S +4260(image)S +4576(subrasters)S +5062(and)S +7236 V +900(compute)S +1321(coordinates)S +1869(appropriately.)S +2557(\(See)S +2794(the)S +11 I +2971(XImtool)S +11 R +3368(documentation)S +4063(for)S +4232(details)S +4561(on)S +4713(how)S +4944(this)S +5146(is)S +7920 V +EP +%%Page: 8 11 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 8 -)S +840 V +900(done)S +1146(exactly\).)S +996 V +1175(The)S +1391(CDL)S +1657(will)S +1875(automatically)S +2519(determine)S +3003(when)S +3286(the)S +3466(connection)S +3993(is)S +4114(\256rst)S +4333(established)S +4868(whether)S +1116 V +900(the)S +1068(server)S +1368(is)S +1476(aware)S +1768(of)S +1892(this)S +2085(new)S +2300(mapping)S +2718(information.)S +3331(Calls)S +3591(to)S +3710(send)S +3944(or)S +4068(receive)S +4415(mapping)S +4833(data)S +5048(will)S +1236 V +900(be)S +1036(ignored)S +1404(for)S +1564(servers)S +1906(which)S +2208(are)S +2374(not)S +2549(aware)S +2842(of)S +2967(the)S +3135(extra)S +3387(data)S +3603(in)S +3723(the)S +3891(string.)S +4237(For)S +4424(servers)S +4767(which)S +5069(can)S +1356 V +900(use)S +1079(the)S +1246(mappings,)S +1735(and)S +1926(where)S +2225(a)S +2306(mapping)S +2724(has)S +2903(been)S +3142(provided,)S +3626(the)S +3793(WCS)S +4065(string)S +4349(now)S +4571(looks)S +4843(like)S +1536 V +11 I +1428(name)S +11 R +1698(-)S +11 I +1767(title)S +11 R +1939(\\n)S +1656 V +1450(a)S +1531(b)S +1619(c)S +1700(d)S +1788(tx)S +1907(ty)S +2026(z1)S +2162(z2)S +2298(zt\\n)S +1776 V +11 B +1450(region_name)S +2093(sx)S +2224(sy)S +2355(snx)S +2548(sny)S +2741(dx)S +2891(dy)S +3041(dnx)S +3253(dny\\n)S +1896 V +1450(object_refR)S +2076 V +900(where)S +1218(the)S +1397(new)S +1619(parameters)S +2186(are)S +2370(de\256ned)S +2747(to)S +2871(be:)S +2280 V +1606(region_name)S +11 I +2546(User-de\256ned)S +3144(name)S +3414(for)S +3576(the)S +3743(region.)S +2400 V +11 B +1606(sx,)S +1765(sy,)S +1924(snx,)S +2145(sny)S +11 I +2546(Source)S +2883(rect)S +3086(in)S +3205(the)S +3372(object.)S +2520 V +11 B +1606(dx,)S +1784(dy,)S +1962(dnx,)S +2202(dny)S +11 I +2546(Destination)S +3093(rect)S +3296(in)S +3415(the)S +3582(display)S +3933(frame)S +4222(bu)S +4332 H + (f)show 11 -.5 mul h (f)show +11 I +4388(er.)S +2640 V +11 B +1606(object_ref)S +11 I +2546(Full)S +2763(node!/path)S +3272(image)S +3573(speci\256cation.)S +2820 V +11 B +900(The)S +11 I +1124(object_ref)S +11 R +1609(should)S +1943(be)S +2086(a)S +2174(complete)S +2616(node!path)S +3094(speci\256cation)S +3689(to)S +3815(the)S +3989(image)S +4297(including)S +4753(any)S +4952(image)S +2940 V +900(section)S +1253(or)S +1385(extension.)S +1908(This)S +2145(is)S +2260(needed)S +2610(by)S +2761(the)S +2936(XImtool)S +3350(coordinate/pixel)S +4104(plug-in)S +4463(to)S +4590(map)S +4820(the)S +4995(same)S +3060 V +900(image)S +1206(as)S +1335(was)S +1543(displayed)S +2002(by)S +2150(the)S +2322(client.)S +2665(The)S +2873(path)S +3100(and)S +3296(node)S +3547(are)S +3717(required)S +4119(to)S +4244(ensure)S +4568(the)S +4741(image)S +5048(will)S +3180 V +900(be)S +1041(found)S +1335(properly.)S +1805(The)S +11 I +2013(region_name)S +11 R +2630(can)S +2819(be)S +2960(anything)S +3383(such)S +3621(as)S +11 I +3749(image)S +11 R +4017(,)S +11 I +4082(subraster1)S +11 R +4553(,)S +4618(or)S +11 I +4746(ccd3)S +11 R +4952(.)S +5050(The)S +3300 V +900(purpose)S +1294(of)S +1432(this)S +1639(\256eld)S +1883(is)S +2005(to)S +2139(provide)S +2522(some)S +2802(named)S +3142(value)S +3427(for)S +3602(the)S +3784(mapping)S +4217(that)S +4430(may)S +4667(be)S +4818(useful)S +5134(to)S +3420 V +900(other)S +1159(client)S +1437(programs)S +1885(needing)S +2266(to)S +2386(access)S +2698(the)S +2865(mapping.)S +11 I +3344(Source)S +11 R +3681(coordinates)S +4219(refer)S +4456(to)S +4575(the)S +4742(image)S +5043(pix-)S +3540 V +900(els,)S +11 I +1083(destination)S +11 R +1606(coordinates)S +2144(refer)S +2381(to)S +2500(the)S +2667(frame)S +2954(bu)S +3064 H + (f)show 11 -.5 mul h (f)show +11 R +3131(er.)S +3696 V +1175(Because)S +1580(we)S +1748(did)S +1930(not)S +2112(wish)S +2361(to)S +2488(change)S +2838(any)S +3037(of)S +3169(the)S +3344(existing)S +3734(interfaces,)S +4227(mappings)S +4696(must)S +4953(be)S +5098(set)S +3816 V +900(prior)S +1152(to)S +1277(the)S +11 B +1449(cdl_setWCS\(\))S +11 R +2133(call)S +2362(using)S +2639(the)S +11 B +2811(cdl_setMapping\(\))S +11 R +3674(procedure.)S +4209(The)S +4417(mapping)S +4840(is)S +4952(stored)S +3936 V +900(until)S +1147(the)S +1325(WCS)S +1608(is)S +1726(actually)S +2117(sent.)S +2399(Similarly,)S +2882(a)S +2974(mapping)S +3403(may)S +3636(be)S +3783(retrieved)S +11 I +4216(after)S +11 R +4469(a)S +11 B +4562(cdl_getWCS\(\))S +4056 V +11 R +900(call)S +1124(using)S +1428(the)S +11 B +1627(cdl_getMapping\(\))S +11 R +2529(procedure)S +3030(to)S +3181(return)S +3507(the)S +3706(values)S +4051(read)S +4303(with)S +4564(the)S +4763(last)S +4981(WCS)S +4176 V +900(retrieval.)S +1359(Since)S +1637(there)S +1889(can)S +2074(at)S +2187(times)S +2460(be)S +2597(more)S +2856(than)S +3079(one)S +3271(WCS)S +3545(in)S +3666(a)S +3749(frame,)S +4066(it's)S +4242(also)S +4454(possible)S +4850(to)S +4971(query)S +4296 V +900(the)S +1074(mapping)S +1499(for)S +1665(a)S +1752(particular)S +2210(WCS)S +2488(by)S +2637(number)S +3011(\(e.g.)S +3245(the)S +3418(WCS)S +3696(number)S +4070(returned)S +4473(in)S +4598(a)S +4685(cursor)S +4997(read\))S +4416 V +900(using)S +1178(the)S +11 I +1351(cdl_queryMap\(\))S +11 R +2101(procedure.)S +2637(See)S +2834(the)S +3008(sample)S +3359(programs)S +3813(in)S +3939(the)S +4113(appendices)S +4639(for)S +4806(examples)S +4536 V +900(of)S +1024(how)S +1246(these)S +1504(procedures)S +2016(might)S +2307(be)S +2443(called.)S +4776 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4896 V +11 C +1175(int)S +1439(cdl_getMapping\(CDLPtr)S +2891(cdl,)S +3221(char)S +3551(*region,)S +5016 V +1439(float)S +1835(*sx,)S +2165(float)S +2561(*sy,)S +2891(int)S +3155(*snx,)S +3551(int)S +3815(*sny,)S +5136 V +1439(int)S +1703(*dx,)S +2033(int)S +2297(*dy,)S +2627(int)S +2891(*dnx,)S +3287(int)S +3551(*dny,)S +3947(char)S +4277(*ref\);)S +5256 V +1175(int)S +1439(cdl_setMapping\(CDLPtr)S +2891(cdl,)S +3221(char)S +3551(*region,)S +5376 V +1439(float)S +1835(sx,)S +2099(float)S +2495(sy,)S +2759(int)S +3023(snx,)S +3353(int)S +3617(sny,)S +5496 V +1439(int)S +1703(dx,)S +1967(int)S +2231(dy,)S +2495(int)S +2759(dnx,)S +3089(int)S +3353(dny,)S +3683(char)S +4013(*ref\);)S +5616 V +1175(int)S +1439(cdl_queryMap\(CDLPtr)S +2759(cdl,)S +3089(int)S +3353(wcs,)S +3683(char)S +4013(*region,)S +5736 V +1439(float)S +1835(*sx,)S +2165(float)S +2561(*sy,)S +2891(int)S +3155(*snx,)S +3551(int)S +3815(*sny,)S +5856 V +1439(int)S +1703(*dx,)S +2033(int)S +2297(*dy,)S +2627(int)S +2891(*dnx,)S +3287(int)S +3551(*dny,)S +3947(char)S +4277(*objref\);)S +6216 V +11 B +900(4.9.)S +1132(Image)S +1457(Colormaps)S +6372 V +11 R +1175(The)S +1395(IIS)S +1579(protocol)S +1996(used)S +2248(does)S +2500(not)S +2692(permit)S +3030(the)S +3215(downloading)S +3840(of)S +3982(user-de\256ned)S +4574(colormaps,)S +5110(all)S +6492 V +900(images)S +1255(are)S +1431(loaded)S +1767(as)S +1902(raw)S +2109(grayscale)S +2565(values)S +2889(according)S +3364(to)S +3494(the)S +3672(XImtool)S +4089(colormap)S +4547(model)S +4866(used)S +5110(by)S +6612 V +900(currently)S +1348(supported)S +1834(servers.)S +2257(All)S +2451(images)S +2815(containing)S +3332(private)S +3689(colormaps)S +4200(or)S +4345(more)S +4624(than)S +4867(the)S +5055(201)S +6732 V +900(grayscale)S +1355(values)S +1678(de\256ned)S +2043(by)S +2195(the)S +2371(Imtool)S +2707(colormap)S +3163(model)S +3480(must)S +3737(either)S +4028(convert)S +4398(the)S +4574(image)S +4884(to)S +5012(8-bit)S +6852 V +900(grayscale)S +1418(values)S +1804(by)S +2020(calling)S +2425(the)S +2665(CDL)S +2991(zscale)S +3364(procedures)S +3950(\()S +11 B +3986(cdl_computeZscale\(\))S +11 R +5062(and)S +6972 V +11 B +900(cdl_zscaleImage\(\))S +11 R +1733(\))S +1814(or)S +1950(scale)S +2213(the)S +2392(images)S +2748(in)S +2879(client)S +3168(code)S +3419(with)S +3660(user)S +3887(LUTs.)S +4249(The)S +4464(CDL)S +4728(zscale)S +5038(pro-)S +7092 V +900(cedures)S +1276(scale)S +1537(image)S +1849(to)S +1979(201)S +2188(grayscale)S +2644(values)S +2968(so)S +3110(that)S +3319(they)S +3552(are)S +3728(displayed)S +4193(to)S +4323(the)S +4501(full)S +4698(8-bit)S +4950(range,)S +7212 V +900(user)S +1135(LUT)S +1401(transformations)S +2143(or)S +2287(user)S +2522(code)S +2781(for)S +2961(converting)S +3483(to)S +3621(grayscale)S +4085(from)S +4350(a)S +4450(private)S +4806(colormap)S +7920 V +EP +%%Page: 9 12 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2963(- 9 -)S +840 V +900(procedures)S +1412(should)S +1739(do)S +1882(the)S +2049(same.)S +1080 V +11 B +900(4.9.1.)S +1215(Imtool)S +1559(Color)S +1860(Model)S +1236 V +11 R +1175(The)S +1383(IMTOOL)S +1847(color)S +2110(model)S +2423(de\256nes)S +2772(at)S +2889(most)S +3142(201)S +3345(grayscale)S +3795(values)S +4113(for)S +4278(use)S +4463(in)S +4588(displaying)S +5086(the)S +1356 V +900(image,)S +1239(a)S +1330(set)S +1495(of)S +1629(16)S +1782(static)S +2057(colors)S +2368(are)S +2543(also)S +2763(de\256ned)S +3129(for)S +3299(overlay)S +3670(graphics.)S +4145(Pixel)S +4415(values)S +4738(sent)S +4958(to)S +5086(the)S +1476 V +900(server)S +1200(should)S +1528(be)S +1665(already)S +2020(scaled)S +2327(to)S +2447(this)S +2641(model,)S +2978(i.e.)S +3147(the)S +3315(image)S +3617(pixels)S +3914(should)S +4242(be)S +4380(scaled)S +4688(to)S +4809(the)S +4978(range)S +1596 V +900(1-200,)S +1231(values)S +1558(above)S +1866(this)S +2073(will)S +2292(either)S +2588(represent)S +3035(the)S +3216(overlay)S +3591(colors)S +3906(or)S +4044(will)S +4263(wrap)S +4528(around)S +4879(to)S +5012(8-bit)S +1716 V +900(values.)S +1286(The)S +1501(CDL)S +1766(zscale)S +2077(procedures)S +2601(will)S +2818(automatically)S +3461(scale)S +3724(arbitrary)S +4145(pixel)S +4410(values)S +4736(to)S +4868(use)S +5060(this)S +1836 V +900(color)S +1169(model,)S +1516(the)S +1694(overlay)S +2066(procedures)S +2589(assume)S +2956(color)S +3224(values)S +3547(are)S +3722(de\256ned)S +4088(for)S +4258(the)S +4435(static)S +4710(color)S +4978(range)S +1956 V +900(201-217)S +1299(but)S +1473(any)S +1664(8-bit)S +1905(value)S +2175(may)S +2397(be)S +2533(used.)S +2112 V +1175(A)S +1287(summary)S +1729(of)S +1853(the)S +2020(color)S +2278(model)S +2586(values)S +2899(is)S +3006(included)S +3417(below:)S +2292 V +11 B +1593(Color)S +2080(Description)S +3337(Color)S +3819(Description)S +2412 V +11 R +1593(0)S +2080(Background)S +3388(208)S +3819(Cyan)S +2532 V +1593(1)S +1681(-)S +1750(200)S +2080(Image)S +2386(data)S +3388(209)S +3819(Magenta)S +2652 V +1593(201)S +2080(Cursor)S +2412(\(white\))S +3388(210)S +3819(Coral)S +2772 V +1593(202)S +2080(Background)S +2649(\(black\))S +3388(211)S +3819(Maroon)S +2892 V +1593(203)S +2080(White)S +3388(212)S +3819(Orange)S +3012 V +1593(204)S +2080(Red)S +3388(213)S +3819(Khaki)S +3132 V +1593(205)S +2080(Green)S +3388(214)S +3819(Orchid)S +3252 V +1593(206)S +2080(Blue)S +3388(215)S +3819(Turquoise)S +3372 V +1593(207)S +2080(Yellow)S +3388(216)S +3819(Violet)S +3492 V +1593(217)S +2080(Wheat)S +3288(218-255)S +3819(unde\256ned)S +3792 V +11 B +900(4.10.)S +1187(ZScale)S +1538(Intensity)S +1987(Mapping)S +3948 V +11 R +1175(Since)S +1455(most)S +1706(display)S +2060(servers)S +2405(are)S +2573(only)S +2805(capable)S +3174(of)S +3301(displaying)S +3796(8-bit)S +4041(pixel)S +4298(values,)S +4676(images)S +5024(with)S +4068 V +900(more)S +1172(than)S +1408(8-bits)S +1706(per)S +1892(pixel)S +2159(must)S +2421(be)S +2571(scaled)S +2891(prior)S +3151(to)S +3284(display.)S +3710(For)S +3910(linear)S +4205(transformations)S +4940(this)S +5146(is)S +4188 V +900(typically)S +1334(done)S +1596(using)S +1885(a)S +1983(simple)S +2327(conversion)S +2858(of)S +2999(the)S +3183(image)S +3501(min/max)S +3943(values)S +4273(to)S +4409(the)S +4593(256)S +4808(grayscale)S +4308 V +900(values,)S +1247(however)S +1662(this)S +1861(doesn't)S +2223(produce)S +2614(very)S +2847(good)S +3106(results)S +3432(when)S +3708(most)S +3962(pixel)S +4220(values)S +4538(are)S +4708(near)S +4933(one)S +5129(of)S +4428 V +900(the)S +1088(extremes)S +1537(\(usually)S +1945(the)S +2133(image)S +2455(min)S +2681(for)S +2862(astronomical)S +3483(images\).)S +3945(To)S +4121(solve)S +4407(this)S +4622(IRAF)S +4928(uses)S +5172(a)S +4548 V +11 I +900(zscale)S +11 R +1218(mapping)S +1653(algorithm)S +2131(where)S +2447(a)S +2544(sampling)S +2997(grid)S +3223(is)S +3346(used)S +3596(to)S +3731(approximate)S +4328(the)S +4511(image)S +4828(min/max)S +4668 V +900(values)S +1214(rather)S +1502(than)S +1725(computing)S +2230(it)S +2326(directly,)S +2723(a)S +2806(line)S +3006(is)S +3115(then)S +3339(\256t)S +3467(to)S +3588(these)S +3848(sample)S +4194(pixels)S +4492(to)S +4613(determine)S +5086(the)S +4788 V +900(optimal)S +1274(transformation)S +1957(to)S +2080(the)S +2251(display)S +2606(values.)S +2984(This)S +3217(is)S +3328(not)S +3506(only)S +3739(more)S +4001(e)S +4049 H + (f)show 11 -.5 mul h (\256)show +11 R +4141(cient)S +4390(but)S +4567(maps)S +4835(the)S +5005(most)S +4908 V +900(common)S +1318(pixel)S +1571(values)S +1884(to)S +2003(the)S +2170(display)S +2521(range)S +2796(producing)S +3274(a)S +3355(better)S +3637(image.)S +5064 V +1175(The)S +1379(CDL)S +1633(has)S +1813(several)S +2156(routines)S +2544(for)S +2705(doing)S +2991(the)S +3160(same)S +3420(transformation:)S +4132(the)S +11 I +4301(cdl_computeZscale\(\))S +5184 V +11 R +900(procedure)S +1383(is)S +1504(used)S +1752(to)S +1885(compute)S +2310(the)S +2491(optimal)S +11 I +2875(z1)S +11 R +3020(and)S +11 I +3225(z2)S +11 R +3370(values)S +3697(\(the)S +3914(min/max)S +4353(used)S +4601(for)S +4774(the)S +4954(zscale)S +5304 V +900(transform\))S +1402(for)S +1569(an)S +1712(image)S +2020(of)S +2151(any)S +2349(pixel)S +2609(size.)S +2880(The)S +11 I +3090(bitpix)S +11 R +3381(argument)S +3835(is)S +3949(the)S +4123(number)S +4498(of)S +4629(bits-per-pixel)S +5424 V +900(for)S +1086(the)S +1279(input)S +1565(array)S +1847(and)S +2063(has)S +2267(the)S +2459(same)S +2742(meaning)S +3178(as)S +3327(for)S +3512(the)S +3704(FITS)S +11 I +3989(BITPIX)S +11 R +4382(keyword.)S +4851(To)S +5031(then)S +5544 V +900(transform)S +1361(the)S +1530(image)S +1833(using)S +2107(these)S +2368(values)S +2684(\(or)S +2847(user-de\256ned)S +3424(values\))S +3776(the)S +11 I +3946(cdl_zscaleImage\(\))S +11 R +4784(procedure)S +5664 V +900(is)S +1015(used.)S +1318(The)S +1528(input)S +1795(pixels)S +2098(are)S +2270(modi\256ed)S +2702(by)S +2852(this)S +3052(procedure)S +3528(but)S +3709(the)S +3883(array)S +4146(is)S +4260(not)S +4441(reallocated)S +4960(to)S +5086(the)S +5784 V +900(smaller)S +1273(size)S +1493(needed)S +1852(by)S +2012(an)S +2166(8-bit)S +2425(array.)S +2760(The)S +11 B +2981(cdl_setSample\(\))S +11 R +3776(and)S +11 B +3985(cdl_setSampleLines\(\))S +11 R +5038(pro-)S +5904 V +900(cedures)S +1278(can)S +1474(be)S +1622(used)S +1868(to)S +1999(change)S +2352(the)S +2530(sampling)S +2978(grid)S +3199(and)S +3401(number)S +3780(of)S +3915(sample)S +4270(points)S +4584(\(the)S +4798(default)S +5146(is)S +6024 V +900(600)S +1099(points)S +1403(on)S +1547(5)S +1636(lines\).)S +1975(The)S +11 B +2179(cdl_setContrast\(\))S +11 R +3022(procedure)S +3493(can)S +3679(be)S +3817(used)S +4053(to)S +4174(change)S +4518(the)S +4687(default)S +5026(con-)S +6144 V +900(trast)S +1128(adjustment)S +1650(to)S +1775(the)S +1948(slope)S +2219(used)S +2459(in)S +2584(the)S +2757(transformation)S +3442(\(the)S +3651(default)S +3993(is)S +4105(0.25\).)S +4433(If)S +4543(a)S +4629(value)S +4904(of)S +5033(zero)S +6264 V +900(is)S +1007(given)S +1284(then)S +1506(the)S +1673(minimum)S +2136(and)S +2327(maximum)S +2807(of)S +2931(the)S +3098(intensity)S +3511(sample)S +3855(is)S +3962(used)S +4196(as)S +4320(the)S +4487(z1/z2)S +4757(value.)S +6420 V +1175(Each)S +1440(of)S +1578(the)S +1759(CDL)S +2026(display)S +2391(procedures)S +2917(has)S +3110(a)S +11 I +3205(zscale)S +11 R +3520(\257ag)S +3732(to)S +3865(automatically)S +4510(scale)S +4775(the)S +4957(pixels)S +6540 V +900(prior)S +1151(to)S +1275(display.)S +1691(Applications)S +2290(wishing)S +2676(to)S +2799(set)S +2958(their)S +3196(own)S +3422(z1/z2)S +3696(values)S +4013(will)S +4222(need)S +4465(to)S +4588(call)S +4783(the)S +4954(zscale)S +6660 V +900(procedures)S +1421(and)S +1621(disable)S +1974(this)S +2176(\257ag.)S +2444(By)S +2615(default)S +2961(cdl_zscaleImage\(\))S +3803(will)S +4017(use)S +4206(a)S +4297(linear)S +4589(transform,)S +5086(the)S +6780 V +11 B +900(cdl_setZTrans\(\))S +11 R +1764(procedure)S +2312(may)S +2613(be)S +2828(used)S +3141(to)S +3339(change)S +3760(this.)S +4093(Acceptable)S +4696(values)S +5088(are)S +6900 V +11 B +900(CDL_UNITARY)S +11 R +1733(\(zero\))S +2026(for)S +2187(a)S +2269(unitary)S +2614(transform,)S +11 B +3102(CDL_LINEAR)S +11 R +3851(\(one\))S +4115(for)S +4276(a)S +4358(linear)S +4641(transform,)S +5129(or)S +7020 V +11 B +900(CDL_LOG)S +11 R +1466(\(two\))S +1736(for)S +1896(a)S +1977(log10)S +2261(transform.)S +7260 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7920 V +EP +%%Page: 10 13 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 10 -)S +840 V +11 C +1175(void)S +1505(cdl_computeZscale)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(uchar)S +3947(*pix,)S +4343(int)S +4607(nx,)S +960 V +1439(int)S +1703(ny,)S +1967(int)S +2231(bitpix,)S +2759(float)S +3155(*z1,)S +3485(float)S +3881(*z2\))S +1080 V +1175(void)S +1505(cdl_zscaleImage)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(uchar)S +3815(**pix,)S +4277(int)S +4541(nx,)S +1200 V +1439(int)S +1703(ny,)S +1967(int)S +2231(bitpix,)S +2759(float)S +3155(z1,)S +3419(float)S +3815(z2\))S +1440 V +1175(void)S +1505(cdl_setZTrans)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(ztrans\))S +1560 V +1175(void)S +1505(cdl_getZTrans)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(*ztrans\))S +1680 V +1175(void)S +1505(cdl_setZScale)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(float)S +3683(z1,)S +3947(float)S +4343(z2\))S +1800 V +1175(void)S +1505(cdl_getZScale)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(float)S +3683(*z1,)S +4013(float)S +4409(*z2\))S +2040 V +1175(void)S +1505(cdl_setSample)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(nsample\))S +2160 V +1175(void)S +1505(cdl_setSampleLines)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(int)S +3881(nlines\))S +2280 V +1175(void)S +1505(cdl_setContrast)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(float)S +3815(contrast\))S +2400 V +1175(void)S +1505(cdl_getSample)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(*nsample\))S +2520 V +1175(void)S +1505(cdl_getSampleLines)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(int)S +3881(*nlines\))S +2640 V +1175(void)S +1505(cdl_getContrast)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(float)S +3815(*contrast\))S +3000 V +11 B +900(4.11.)S +1187(Image)S +1512(Hardcopy)S +3156 V +11 R +1175(While)S +1479(most)S +1731(servers)S +2077(include)S +2437(some)S +2706(hardcopy)S +3150(capability)S +3620(of)S +3748(their)S +3986(own)S +4212(the)S +4383(CDL)S +4640(provides)S +5055(two)S +3276 V +900(procedures)S +1428(for)S +1603(creating)S +2003(hardcopy)S +2458(images)S +2817(from)S +3078(the)S +3260(client)S +3552(\(e.g.)S +3795(for)S +3970(a)S +4066(batch)S +4351(processing)S +4868(applica-)S +3396 V +900(tion\).)S +1207(The)S +1415(client)S +1697(will)S +1907(typically)S +2330(read)S +2555(back)S +2799(the)S +2971(entire)S +3258(image,)S +3592(frame)S +3884(bu)S +3994 H + (f)show 11 -.5 mul h (f)show +11 R +4061(er,)S +4212(of)S +4342(just)S +4541(a)S +4628(subraster)S +5062(and)S +3516 V +900(pass)S +1134(those)S +1411(pixels)S +1718(to)S +1848(the)S +2026(print)S +2278(procedure.)S +2819(Images)S +3179(will)S +3395(be)S +3542(written)S +3897(as)S +4032(Pseudocolor)S +4619(Postscript)S +5098(\(to)S +3636 V +900(preserve)S +1376(the)S +1617(overlay)S +2052(marker)S +2468(colors\))S +2879(and)S +3144(may)S +3440(be)S +3650(disposed)S +4142(to)S +4335(a)S +4490(\256le)S +4739(using)S +5086(the)S +3756 V +11 B +900(cdl_printPixToFile\(\))S +11 R +1903(procedure)S +2376(or)S +2504(to)S +2627(any)S +2822(command)S +3292(string)S +3580(accepting)S +4036(input)S +4299(from)S +11 I +4548(stdin)S +11 R +4799(\(typically)S +3876 V +900(just)S +1093(an)S +1229('lpr')S +1456(command\))S +1958(by)S +2101(using)S +2373(the)S +11 B +2540(cdl_printPix\(\))S +11 R +3233(procedure.)S +4116 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4236 V +11 C +1175(int)S +1439(cdl_printPix)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(char)S +3485(*cmd,)S +3881(uchar)S +4277(*pix,)S +4673(int)S +4937(nx,)S +4356 V +1439(int)S +1703(ny,)S +1967(int)S +2231(annotate\))S +4476 V +1175(int)S +1439(cdl_printPixToFile)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(char)S +3881(*fname,)S +4409(uchar)S +4805(*pix,)S +4596 V +1439(int)S +1703(nx,)S +1967(int)S +2231(ny,)S +2495(int)S +2759(annotate\))S +4836 V +11 B +900(4.12.)S +1187(Image)S +1512(Cursor)S +4992 V +11 R +1175(The)S +1390(image)S +1703(cursor)S +2021(is)S +2140(read)S +2372(using)S +2656(the)S +11 B +2835(cdl_readCursor\(\))S +11 R +3696(procedure.)S +4238(The)S +4453(returned)S +4863(value)S +5146(is)S +5112 V +900(the)S +1082(cursor)S +11 I +1403(\(x,y\))S +11 R +1647(position)S +2051(as)S +2190(\257oating)S +2575(point)S +2850(value)S +3135(in)S +3269(terms)S +3561(of)S +3700(the)S +3881(currently)S +4323(de\256ne)S +4638(image)S +4953(WCS.)S +5232 V +900(Note)S +1149(that)S +1350(this)S +1546(position)S +1938(must)S +2189(be)S +2328(converted)S +2796(to)S +2919(integer)S +3260(if)S +3364(it)S +3463(is)S +3574(to)S +3697(be)S +3837(used)S +4075(in)S +4198(one)S +4393(of)S +4521(the)S +4692(marker)S +5038(pro-)S +5352 V +900(cedures.)S +5592 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5712 V +11 C +1175(int)S +1439(cdl_readCursor)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(sample,)S +4079(float)S +4475(*x,)S +5832 V +1439(float)S +1835(*y,)S +2099(int)S +2363(*wcs,)S +2759(char)S +3089(*key\))S +6072 V +11 R +900(The)S +11 I +1103(wcs)S +11 R +1301(argument)S +1748(is)S +1855(de\256ned)S +2211(as)S +6312 V +1164(wcs)S +1367(=)S +1462(frame)S +1749(*)S +1837(100)S +2035(+)S +2130(wcs_number)S +6552 V +900(\(where)S +1247(wcs_number=0)S +1969(for)S +2141(frame)S +2440(bu)S +2550 H + (f)show 11 -.5 mul h (f)show +11 R +2617(er)S +2746(coords)S +3083(and)S +3286(1)S +3386(for)S +3558(image)S +3872(coords\).)S +4307(So,)S +4498(you)S +4709(can)S +4906(get)S +5086(the)S +6672 V +900(frame)S +1187(as)S +1311(simply)S +6912 V +1164(frame)S +1451(=)S +1546(\(int\))S +1768(\(wcs)S +2007(/)S +2071(100\))S +7920 V +EP +%%Page: 11 14 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 11 -)S +840 V +11 B +900(4.12.1.)S +1270(Cursor)S +1638(Sampling)S +996 V +11 R +1175(If)S +1307(the)S +1501(cdl_readCursor\(\))S +11 I +2308(sample)S +11 R +2680(\257ag)S +2906(is)S +3041(non-zero)S +3490(the)S +11 I +3685(logical)S +4052(image)S +4381(cursor)S +11 R +4729(position)S +5146(is)S +1116 V +900(returned)S +1300(immediately,)S +1914(otherwise)S +2376(the)S +2545(display)S +2898(server)S +3199(will)S +3406(wait)S +3630(for)S +3792(a)S +3875(keystroke)S +4336(before)S +4649(returning)S +5086(the)S +1236 V +900(cursor)S +1214(position.)S +1672(The)S +1883(logical)S +2223(image)S +2532(cursor)S +2846(is)S +2961(the)S +3136(last)S +3330(value)S +3609(set)S +3773(by)S +3925(a)S +11 I +4015(cdl_setCursor\(\))S +11 R +4753(call)S +4953(or)S +5086(the)S +1356 V +900(last)S +1101(value)S +1386(returned)S +1798(by)S +1956(a)S +11 I +2051(cdl_readCursor\(\))S +11 R +2873(call.)S +3139(When)S +3447(sampling)S +3898(the)S +4079(cursor)S +4399(position)S +4802(the)S +4983(keys-)S +1476 V +900(troke)S +1158(value)S +1428(is)S +1535(unde\256ned.)S +1716 V +11 B +900(4.13.)S +1187(Image)S +1512(Readout)S +1872 V +11 R +1175(The)S +1390(CDL)S +1655(maintains)S +2128(an)S +2276(internal)S +2657(knowledge)S +3184(of)S +3321(where)S +3633(an)S +3782(image)S +4096(has)S +4288(been)S +4540(positioned)S +5045(if)S +5158(it)S +1992 V +900(was)S +1110(displayed)S +1571(using)S +1850(one)S +2048(of)S +2179(the)S +11 I +2353(cdl_display*)S +11 R +2955(procedures.)S +3535(The)S +11 B +3744(cdl_readImage\(\))S +11 R +4556(procedure)S +5031(may)S +2112 V +900(be)S +1046(used)S +1290(to)S +1419(read)S +1649(back)S +1899(the)S +2077(entire)S +2370(image)S +2682(pixels)S +2989(from)S +3246(the)S +3424(server)S +3734(ignoring)S +4151(the)S +4329(region)S +4653(of)S +4788(the)S +4966(frame)S +2232 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1203(outside)S +1563(of)S +1696(the)S +1872(image,)S +2209(the)S +11 B +2384(cdl_readFrameBu)S +3238 H + (f)show 11 -.5 mul h (f)show +11 B +3305(er\(\))S +11 R +3514(procedure)S +3991(will)S +4204(read)S +4432(back)S +4679(the)S +4854(contents)S +2352 V +900(of)S +1024(the)S +1191(entire)S +1473(frame)S +1760(bu)S +1870 H + (f)show 11 -.5 mul h (f)show +11 R +1937(er.)S +2115(The)S +2318(dimensions)S +2853(of)S +2977(the)S +3144(array)S +3400(are)S +3565(returned)S +3962(in)S +4081(the)S +11 I +4248(nx)S +11 R +4384(and)S +11 I +4575(ny)S +11 R +4711(arguments.)S +2592 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2712 V +11 C +1175(int)S +1439(cdl_readImage)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(uchar)S +3617(**pix,)S +4079(int)S +4343(*nx,)S +2832 V +1439(int)S +1703(*ny\)R)S +2952 V +1175(int)S +1439(cdl_readFrameBuffer)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(uchar)S +4013(**pix,)S +3072 V +1439(int)S +1703(*nx,)S +2033(int)S +2297(*ny\)R)S +3312 V +11 B +900(4.14.)S +1187(Subraster)S +1684(I/O)S +3468 V +11 R +1175(The)S +11 B +1379(cdl_writeSubRaster\(\))S +11 R +2418(procedure)S +2888(is)S +2996(used)S +3231(to)S +3351(write)S +3610(an)S +3747(arbitrary)S +4157(raster)S +4433(to)S +4553(any)S +4745(location)S +5134(in)S +3588 V +900(the)S +1069(display.)S +1483(Similarly)S +1929(the)S +11 B +2098(cdl_readSubRaster\(\))S +11 R +3109(procedure)S +3580(is)S +3689(used)S +3925(to)S +4046(read)S +4268(back)S +4509(an)S +4647(arbitrary)S +5057(ras-)S +3708 V +900(ter.)S +1127(When)S +1439(an)S +1593(image)S +1912(has)S +2109(previously)S +2624(been)S +2881(displayed)S +3353(the)S +3538(subraster)S +3984(position)S +4392(is)S +4518(given)S +4814(in)S +4952(image)S +3828 V +900(coordinates)S +1446(\(e.g.)S +1682(when)S +1960(writing)S +2319(a)S +2408(subregion)S +2882(of)S +3014(edited)S +3323(pixels\),)S +3690(otherwise)S +4156(the)S +4330(position)S +4726(is)S +4840(in)S +4966(frame)S +3948 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1256(coordinates)S +1856(\(e.g.)S +2146(to)S +2327(display)S +2740(multiple)S +3203(images)S +3609(per)S +3843(frame)S +4193(you)S +4454(should)S +4844(use)S +5086(the)S +4068 V +900(cdl_writeSubRaster\(\))S +1885(call\).)S +2187(See)S +2392(the)S +2573(section)S +2931(on)S +11 I +3088(Marker)S +3463(Coordinates)S +11 R +4055(for)S +4228(further)S +4571(explanation)S +5129(of)S +4188 V +900(the)S +1067(coordinate)S +1562(systems)S +1944(used.)S +4428 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4548 V +11 C +1175(int)S +1439(cdl_writeSubRaster)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(int)S +3815(lx,)S +4079(int)S +4343(ly,)S +4607(int)S +4871(nx,)S +4668 V +1439(int)S +1703(ny,)S +1967(uchar)S +2363(*pix\))S +4788 V +1175(int)S +1439(cdl_readSubRaster)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(lx,)S +4013(int)S +4277(ly,)S +4541(int)S +4805(nx,)S +4908 V +1439(int)S +1703(ny,)S +1967(uchar)S +2363(**pix\))S +5148 V +11 B +900(5.)S +1049(Graphics)S +1517(Overlay)S +5388 V +900(5.1.)S +1132(Marker)S +1529(Coordinates)S +5544 V +11 R +1175(All)S +1369(marker)S +1731(positions)S +2183(are)S +2368(assumed)S +2799(to)S +2938(be)S +3094(image)S +3415(pixel)S +3688(coordinates,)S +4274(although)S +4712(there)S +4983(is)S +5110(no)S +5664 V +900(requirement)S +1465(that)S +1666(the)S +1836(position)S +2227(be)S +2365(on)S +2510(the)S +2679(image)S +2982(itself.)S +3298(When)S +3594(an)S +3732(image)S +4035(WCS)S +4309(is)S +4418(de\256ned)S +4776(\(using)S +5086(the)S +5784 V +900(CDL)S +1162(display)S +1522(procedures)S +2043(or)S +2176(explicitly\))S +2670(the)S +2846(origin)S +3151(of)S +3284(the)S +3460(coordinates)S +4007(used)S +4251(shifts)S +4533(from)S +4789(the)S +4966(frame)S +5904 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1205(lower-left)S +1680(to)S +1810(the)S +1988(lower-left)S +2463(of)S +2598(the)S +2776(image)S +3088(as)S +3222(displayed)S +3686(in)S +3815(the)S +3992(frame.)S +4383(Negative)S +4821(positions)S +6024 V +900(are)S +1069(allowed)S +1453(and)S +1648(will)S +1857(either)S +2144(refer)S +2386(to)S +2510(empty)S +2823(pixels)S +3124(if)S +3229(the)S +3401(frame)S +3693(bu)S +3803 H + (f)show 11 -.5 mul h (f)show +11 R +3870(er)S +3992(is)S +4104(larger)S +4396(than)S +4623(the)S +4795(image,)S +5129(or)S +6144 V +900(pixels)S +1213(outside)S +1581(the)S +1765(frame)S +2069(bu)S +2179 H + (f)show 11 -.5 mul h (f)show +11 R +2246(er)S +2380(boundaries.)S +2971(Raster)S +3300(I/O)S +3495(requests)S +3903(will)S +4124(be)S +4276(clipped)S +4648(to)S +4783(the)S +4966(frame)S +6264 V +900(bu)S +1010 H + (f)show 11 -.5 mul h (f)show +11 R +1077(er)S +1194(endpoints,)S +1683(a)S +1764(request)S +2113(completely)S +2634(outside)S +2985(the)S +3152(frame)S +3439(bu)S +3549 H + (f)show 11 -.5 mul h (f)show +11 R +3616(er)S +3733(is)S +3840(an)S +3976(error.)S +6504 V +11 B +900(5.2.)S +1132(Mapping)S +1595(a)S +1683(Previously)S +2211(Displayed)S +2710(Image)S +6660 V +11 R +1175(Ideally)S +1512(any)S +1703(application)S +2224(wishing)S +2606(to)S +2725(draw)S +2976(markers)S +3361(on)S +3504(an)S +3641(image)S +3943(will)S +4149(have)S +4389(also)S +4600(displayed)S +5055(that)S +6780 V +900(image,)S +1242(however)S +1664(the)S +11 B +1844(cdl_mapFrame\(\))S +11 R +2675(procedure)S +3157(may)S +3392(be)S +3540(used)S +3786(to)S +3917(map)S +4151(the)S +4330(requested)S +4794(frame)S +5093(for)S +6900 V +900(marker)S +1247(overlay.)S +1674(It)S +1779(does)S +2018(this)S +2216(by)S +2365(reading)S +2732(the)S +2905(WCS)S +3183(de\256ned)S +3545(for)S +3711(that)S +3915(frame)S +4208(and)S +4405(assumes)S +4810(an)S +4952(image)S +7020 V +900(has)S +1089(been)S +1338(displayed)S +1802(and)S +2003(centered)S +2415(in)S +2544(the)S +2721(frame)S +3018(bu)S +3128 H + (f)show 11 -.5 mul h (f)show +11 R +3195(er,)S +3350(then)S +3582(resets)S +3874(the)S +4051(internal)S +4428(CDL)S +4690(image)S +5000(posi-)S +7140 V +900(tion.)S +1200(For)S +1387(this)S +1581(reason)S +1900(it)S +1997(should)S +2326(not)S +2502(be)S +2640(used)S +2876(when)S +3148(multiple)S +3551(image)S +3854(mappings)S +4317(have)S +4558(been)S +4799(displayed)S +7260 V +900(to)S +1026(a)S +1114(frame)S +1408(unless)S +1723(the)S +1897(marker)S +2246(overlay)S +2614(can)S +2805(be)S +2948(done)S +3201(reliably)S +3576(using)S +3855(the)S +4029(last)S +4222(WCS)S +4501(displayed)S +4961(to)S +5086(the)S +7920 V +EP +%%Page: 12 15 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 12 -)S +840 V +900(frame)S +1191(bu)S +1301 H + (f)show 11 -.5 mul h (f)show +11 R +1368(er.)S +1550(If)S +1659(no)S +1807(image)S +2113(has)S +2297(been)S +2541(displayed)S +3000(the)S +3172(frame)S +3464(bu)S +3574 H + (f)show 11 -.5 mul h (f)show +11 R +3641(er)S +3763(is)S +3875(mapped)S +4260(directly.)S +4694(This)S +4928(can)S +5117(be)S +960 V +900(used)S +1142(for)S +1310(example)S +1722(to)S +1849(map)S +2079(an)S +2223(empty)S +2539(frame)S +2834(for)S +3002(displaying)S +3502(just)S +3703(the)S +3878(markers)S +4271(without)S +4649(an)S +4793(image,)S +5129(or)S +1080 V +900(for)S +1063(mapping)S +1484(another)S +1849(frame's)S +2219(WCS)S +2495(for)S +2659(use)S +2842(on)S +2989(the)S +3160(current)S +3506(display.)S +3922(The)S +4129(frame)S +4420(is)S +4531(not)S +4709(changed)S +5110(by)S +1200 V +900(the)S +1067(procedure)S +1536(call)S +1727(however)S +2136(the)S +2303(current)S +2645(WCS)S +11 I +2917(is)S +11 R +3024(changed.)S +1440 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +1560 V +11 C +1175(int)S +1439(cdl_mapFrame)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(frame\))S +1800 V +11 B +900(5.3.)S +1132(Marking)S +1581(a)S +1669(Coordinate)S +2233(File)S +1956 V +11 R +1175(Since)S +1465(a)S +1559(common)S +1990(function)S +2402(for)S +2576(programs)S +3037(will)S +3256(be)S +3406(to)S +3539(mark)S +3811(a)S +3906(list)S +4089(of)S +4227(coordinates,)S +4807(the)S +4988(high-)S +2076 V +900(level)S +11 B +1158(cdl_markCoordsFile\(\))S +11 R +2246(procedure)S +2727(is)S +2846(provided)S +3281(to)S +3412(make)S +3693(this)S +3897(easier.)S +4256(The)S +4470(input)S +4741(parameters)S +2196 V +900(include)S +1273(a)S +1371(\256lename)S +1799(expected)S +2237(to)S +2373(contain)S +2747(a)S +2846(set)S +3019(of)S +3161(\(x,y\))S +3422(points)S +3743(\(real)S +3993(or)S +4135(integer\),)S +4554(and)S +4763(arguments)S +2316 V +900(specifying)S +1395(the)S +1567(point)S +1832(type,)S +2087(size)S +2294(and)S +2489(color)S +2751(to)S +2874(draw.)S +3190(If)S +3299(the)S +11 I +3470(label)S +11 R +3727(argument)S +4178(is)S +4289(positive)S +4675(each)S +4911(marker)S +2436 V +900(point)S +1160(will)S +1365(be)S +1501(labeled)S +1850(with)S +2079(it's)S +2254(relative)S +2616(number)S +2985(in)S +3105(the)S +3273(\256le.)S +3509(The)S +3713(size,)S +3945(type)S +4168(and)S +4360(color)S +4619(arguments)S +5110(all)S +2556 V +900(have)S +1139(the)S +1306(same)S +1564(meaning)S +1975(as)S +2099(for)S +2259(the)S +11 B +2426(cdl_markPoint\(\))S +11 R +3234(procedure)S +3703(described)S +4155(below.)S +2796 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2916 V +11 C +1175(int)S +1439(cdl_markCoordsFile)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(char)S +3881(*fname,)S +4409(int)S +4673(type,)S +3036 V +1439(int)S +1703(size,)S +2099(int)S +2363(color,)S +2825(int)S +3089(label\))S +3276 V +11 B +900(5.4.)S +1132(Marker)S +1529(Colors)S +3432 V +11 R +1175(Markers)S +1576(may)S +1802(be)S +1942(drawn)S +2252(using)S +2528(any)S +2723(8-bit)S +2969(value,)S +3272(in)S +3396(order)S +3664(to)S +3788(use)S +3972(the)S +4144(static)S +4414(overlay)S +4780(colors)S +5086(the)S +3552 V +900(color)S +1174(must)S +1438(be)S +1589(in)S +1723(the)S +1905(range)S +2195(201-217)S +2609(\(see)S +2832(above)S +3141(for)S +3316(notes)S +3596(on)S +3754(the)S +3936(XImtool)S +4357(color)S +4630(model\).)S +5050(The)S +3672 V +900(")S +11 I +945(cdl.h)S +11 R +1162(")S +1272(include)S +1660(\256le)S +1866(for)S +2059(C)S +2199(programs,)S +2707(the)S +2907(")S +11 I +2952(cdlftn.inc)S +11 R +3365(")S +3476(include)S +3865(for)S +4058(fortran)S +4421(programs,)S +4929(or)S +5086(the)S +3792 V +900(")S +11 I +945(cdlspp.h)S +11 R +1315(")S +1402(include)S +1767(for)S +1936(SPP)S +2164(programs,)S +2648(de\256nes)S +3001(the)S +3177(following)S +3647(symbolic)S +4093(constants)S +4544(for)S +4713(each)S +4954(of)S +5086(the)S +3912 V +900(static)S +1165(overlay)S +1526(colors:)S +4152 V +11 B +1730(C_BLACK)S +11 R +2603(202)S +11 B +3263(C_CORAL)S +11 R +4224(210)S +4272 V +11 B +1730(C_WHITE)S +11 R +2603(203)S +11 B +3263(C_MAROON)S +11 R +4224(211)S +4392 V +11 B +1730(C_RED)S +11 R +2603(204)S +11 B +3263(C_ORANGE)S +11 R +4224(212)S +4512 V +11 B +1730(C_GREEN)S +11 R +2603(205)S +11 B +3263(C_KHAKI)S +11 R +4224(213)S +4632 V +11 B +1730(C_BLUE)S +11 R +2603(206)S +11 B +3263(C_ORCHID)S +11 R +4224(214)S +4752 V +11 B +1730(C_YELLOW)S +11 R +2603(207)S +11 B +3263(C_TURQUOISE)S +11 R +4224(215)S +4872 V +11 B +1730(C_CYAN)S +11 R +2603(208)S +11 B +3263(C_VIOLET)S +11 R +4224(216)S +4992 V +11 B +1730(C_MAGENTA)S +11 R +2603(209)S +11 B +3263(C_WHEAT)S +11 R +4224(217)S +5292 V +11 B +900(5.5.)S +1132(Marker)S +1529(Types)S +5448 V +11 R +1175(Currently)S +1629(supported)S +2095(marker)S +2437(types)S +2702(include:)S +5628 V +11 I +1534(Point)S +1974(Line)S +2846(Box)S +3317(Polyline)S +4220(Polygon)S +5748 V +1534(Circle)S +1974(Circular)S +2387(Annuli)S +2846(Ellipse)S +3317(Elliptical)S +3761(Annuli)S +4220(Text)S +5964 V +11 R +1175(The)S +1386(")S +11 I +1431(cdl.h)S +11 R +1648(")S +1734(include)S +2099(\256le)S +2282(for)S +2451(C)S +2567(programs,)S +3051(the)S +3227(")S +11 I +3272(cdlftn.inc)S +11 R +3685(")S +3772(include)S +4137(for)S +4306(fortran)S +4645(programs,)S +5129(or)S +6084 V +900(the)S +1075(")S +11 I +1120(cdlspp.h)S +11 R +1490(")S +1576(include)S +1940(\256le)S +2122(SPP)S +2349(programs,)S +2832(de\256nes)S +3184(the)S +3359(following)S +3828(symbolic)S +4273(constants)S +4723(for)S +4890(each)S +5129(of)S +6204 V +900(the)S +1067(de\256ned)S +11 I +1423(Point)S +11 R +1695(marker)S +2037(types:)S +6384 V +11 B +1835(M_FILL)S +11 R +2761(1)S +11 B +3311(M_CIRCLE)S +11 R +4174(64)S +6504 V +11 B +1835(M_POINT)S +11 R +2761(2)S +11 B +3311(M_STAR)S +11 R +4119(128)S +6624 V +11 B +1835(M_BOX)S +11 R +2761(4)S +11 B +3311(M_HLINE)S +11 R +4119(256)S +6744 V +11 B +1835(M_PLUS)S +11 R +2761(8)S +11 B +3311(M_VLINE)S +11 R +4119(512)S +6864 V +11 B +1835(M_CROSS)S +11 R +2706(16)S +11 B +3311(M_HBLINE)S +11 R +4064(1024)S +6984 V +11 B +1835(M_DIAMOND)S +11 R +2706(32)S +11 B +3311(M_VBLINE)S +11 R +4064(2048)S +7920 V +EP +%%Page: 13 16 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 13 -)S +840 V +1175(Point)S +1449(markers)S +1841(are)S +2013(drawn)S +2326(using)S +2605(the)S +11 B +2779(cdl_markPoint\(\))S +11 R +3594(procedure,)S +4098(point)S +4365(types)S +4638(may)S +4868(be)S +5012(logi-)S +960 V +900(cally)S +11 I +1156(OR)S +11 R +1302('d)S +1436(to)S +1565(create)S +1867(composite)S +2362(markers,)S +2784(closed)S +3106(shapes)S +3440(such)S +3683(as)S +3816(a)S +3906(circles,)S +4261(diamonds,)S +4759(or)S +4892(squares)S +1080 V +900(may)S +1122(be)S +11 I +1258(OR)S +11 R +1404('d)S +1528(with)S +1757(the)S +1924(M_FILL)S +2342(\257ag)S +2540(to)S +2659(\257ood-\256ll)S +3079(the)S +3246(point)S +3506(with)S +3735(the)S +3902(current)S +4244(overlay)S +4605(color.)S +1320 V +11 B +900(5.5.1.)S +1215(Point)S +1476 V +11 R +1175(The)S +11 B +1384(cdl_markPoint\(\))S +11 R +2199(procedure)S +2675(is)S +2789(used)S +3030(to)S +3156(mark)S +3421(a)S +3509(speci\256c)S +3884(point)S +4151(on)S +4301(the)S +4475(image)S +4783(using)S +5062(one)S +1596 V +900(of)S +1033(the)S +1209(marker)S +1560(types)S +1834(listed)S +2115(above.)S +2479(The)S +2691(marker)S +3042(is)S +3158(centered)S +3569(at)S +3690(the)S +3866(coordinates)S +4413(speci\256ed)S +4845(by)S +4997(the)S +11 I +5172(x)S +1716 V +11 R +900(and)S +11 I +1099(y)S +11 R +1188(arguments,)S +11 I +1714(type)S +11 R +1937(is)S +2052(an)S +2196(integer)S +2542(\257ag)S +2749(indicating)S +3231(what)S +3486(kind)S +3724(of)S +3857(marker)S +4208(to)S +4336(draw)S +4596(and)S +4796(may)S +5027(be)S +5172(a)S +1836 V +900(composite)S +1393(type)S +1623(by)S +1774(logically)S +2200(ORing)S +2535(two)S +2741(or)S +2873(more)S +3138(marker)S +3487(types.)S +11 I +3820(Size)S +11 R +4037(is)S +4151(the)S +4325(width)S +4616(and)S +4814(height)S +5129(of)S +1956 V +900(the)S +1082(marker)S +1439(measured)S +1906(in)S +2040(pixel)S +2308(unxits,)S +2654(and)S +11 I +2860(color)S +11 R +3140(is)S +3262(the)S +3444(color)S +3717(used)S +3966(to)S +4100(draw)S +4366(the)S +4548(marker.)S +4966(If)S +5086(the)S +2076 V +11 I +900(number)S +11 R +1280(argument)S +1739(is)S +1858(greater)S +2205(than)S +2439(zero)S +2671(that)S +2881(number)S +3260(will)S +3476(be)S +3623(drawn)S +3940(next)S +4173(to)S +4303(the)S +4481(point)S +4752(as)S +4887(a)S +4979(label,)S +2196 V +900(creating)S +1285(text)S +1483(labels)S +1772(for)S +1932(point)S +2192(markers)S +2577(can)S +2761(be)S +2897(done)S +3143(using)S +3415(the)S +11 I +3582(cdl_markPointLabel)S +11 R +4519(procedure.)S +2352 V +1175(Most)S +1466(marker)S +1839(names)S +2183(are)S +2379(fairly)S +2680(obvious)S +3093(but)S +3299(several)S +3673(are)S +3870(worth)S +4191(special)S +4560(mention:)S +5050(The)S +2472 V +900(M_DIAMOND,)S +1676(M_CIRCLE)S +2287(and)S +2511(M_BOX)S +2962(marker)S +3337(types)S +3635(may)S +3890(be)S +4059(logically)S +11 I +4510(OR)S +11 R +4656(ed)S +4825(with)S +5086(the)S +2592 V +900(M_FILL)S +1331(\257ag)S +1542(to)S +1674(produce)S +2072(a)S +2166(\256lled)S +2439(marker)S +2794(type.)S +3090(Unless)S +11 I +3435(OR)S +11 R +3581(d)S +3682(with)S +3924(the)S +4104(M_POINT)S +4626(\257ag)S +4837(all)S +4993(point)S +2712 V +900(markers)S +1306(will)S +1531(leave)S +1814(the)S +2001(center)S +2320(pixel)S +2593(unchanged.)S +3181(The)S +3404(M_HLINE)S +3938(and)S +4149(M_VLINE)S +4683(markers)S +5088(are)S +2832 V +900(most)S +1149(useful)S +1451(in)S +1571(astronomical)S +2172(applications)S +2737(to)S +2857(mark)S +3116(an)S +3253(individual)S +3734(star,)S +3954(they)S +4177(are)S +4343(horizontal)S +4822(and)S +5014(vert-)S +2952 V +900(ical)S +1117(lines)S +1384(respectively)S +1971(with)S +2225(a)S +2331(gap)S +2547(in)S +2691(the)S +2883(middle)S +3247(third)S +3513(of)S +3662(the)S +3854(marker)S +4221(\(the)S +4449(M_HBLINE)S +5062(and)S +3072 V +900(M_VBLINE)S +1488(are)S +1653(identical)S +2064(but)S +2238(with)S +2467(a)S +2548(width)S +2832(of)S +2956(3)S +3044(pixels\).)S +3252 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3372 V +11 C +1175(int)S +1439(cdl_markPoint)S +2363(\(CDLPtr)S +2891(cdl,)S +3221(int)S +3485(x,)S +3683(int)S +3947(y,)S +4145(int)S +4409(number,)S +3492 V +1439(int)S +1703(size,)S +2099(int)S +2363(type,)S +2759(int)S +3023(color\))S +3612 V +1175(int)S +1439(cdl_markPointLabel)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(int)S +3815(x,)S +4013(int)S +4277(y,)S +4475(char)S +4805(*label)S +3732 V +1439(int)S +1703(size,)S +2099(int)S +2363(type,)S +2759(int)S +3023(color\))S +3972 V +11 B +900(5.5.2.)S +1215(Line)S +4128 V +11 R +1175(The)S +11 B +1399(cdl_markLine\(\))S +11 R +2192(procedure)S +2682(is)S +2810(used)S +3065(to)S +3205(draw)S +3477(a)S +3579(line)S +3798(of)S +3943(the)S +4131(speci\256ed)S +4576(color)S +4856(between)S +4248 V +900(points)S +1203(\()S +11 I +1239(xs,ys)S +11 R +1449(\))S +1518(and)S +1709(\()S +11 I +1745(xe,ye)S +11 R +1965(\).)S +4428 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4548 V +11 C +1175(int)S +1439(cdl_markLine)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(xs,)S +3683(int)S +3947(ys,)S +4211(int)S +4475(xe,)S +4739(int)S +5003(ye,)S +4668 V +1439(int)S +1703(color\))S +4908 V +11 B +900(5.5.3.)S +1215(Box)S +5064 V +11 R +1175(The)S +11 B +1378(cdl_markBox\(\))S +11 R +2120(procedure)S +2590(is)S +2698(used)S +2933(to)S +3053(draw)S +3305(a)S +3387(box)S +3586(of)S +3711(the)S +3879(speci\256ed)S +4303(color)S +4562(with)S +4792(endpoints)S +5184 V +900(speci\256ed)S +1323(by)S +1466(\()S +11 I +1502(lx,ly)S +11 R +1688(\))S +1757(and)S +1948(\()S +11 I +1984(ux,uy)S +11 R +2218(\).)S +2348(If)S +2453(the)S +11 I +2620(\256ll)S +11 R +2770(\257ag)S +2968(is)S +3075(set)S +3230(the)S +3397(box)S +3595(will)S +3800(be)S +3936(\256lled)S +4196(with)S +4425(the)S +4592(marker)S +4934(color.)S +5364 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5484 V +11 C +1175(int)S +1439(cdl_markBox)S +2231(\(CDLPtr)S +2759(cdl,)S +3089(int)S +3353(lx,)S +3617(int)S +3881(ly,)S +4145(int)S +4409(ux,)S +4673(int)S +4937(uy,)S +5604 V +1439(int)S +1703(fill,)S +2099(int)S +2363(color\))S +5844 V +11 B +900(5.5.4.)S +1215(Circle)S +6000 V +11 R +1175(The)S +11 B +1393(cdl_markCircle\(\))S +11 R +2250(procedure)S +2734(is)S +2856(used)S +3105(to)S +3239(draw)S +3505(a)S +3601(circle)S +3891(of)S +4031(the)S +4214(speci\256ed)S +4653(color)S +4927(with)S +5172(a)S +6120 V +900(center)S +1209(at)S +1331(\()S +11 I +1367(x,y)S +11 R +1491(\))S +1570(and)S +1771(radius)S +11 I +2082(radius)S +11 R +2364(.)S +2468(If)S +2583(the)S +11 I +2760(\256ll)S +11 R +2920(\257ag)S +3128(is)S +3245(set)S +3409(the)S +3585(circle)S +3869(will)S +4083(be)S +4228(\256lled)S +4497(with)S +4735(the)S +4911(marker)S +6240 V +900(color.)S +6420 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6540 V +11 C +1175(int)S +1439(cdl_markCircle)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(x,)S +3749(int)S +4013(y,)S +4211(int)S +4475(radius,)S +6660 V +1439(int)S +1703(fill,)S +2099(int)S +2363(color\))S +7920 V +EP +%%Page: 14 17 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2936(- 14 -)S +840 V +11 B +900(5.5.5.)S +1215(Polyline)S +996 V +11 R +1175(The)S +11 B +1401(cdl_markPolyline\(\))S +11 R +2361(procedure)S +2853(is)S +2983(used)S +3240(to)S +3382(draw)S +3656(a)S +3760(line)S +3981(connecting)S +4518(the)S +11 I +4709(npts)S +11 R +4950(points)S +1116 V +900(speci\256ed)S +1323(by)S +1466(the)S +11 I +1633(xpts)S +11 R +1843(and)S +11 I +2034(ypts)S +11 R +2244(array)S +2500(in)S +2619(the)S +2786(desired)S +11 I +3135(color)S +11 R +3367(.)S +1296 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +1416 V +11 C +1175(int)S +1439(cdl_markPolyline)S +2561(\(CDLPtr)S +3089(cdl,)S +3419(int)S +3683(*xpts,)S +4145(int)S +4409(*ypts,)S +1536 V +1439(int)S +1703(npts,)S +2099(int)S +2363(color\))S +1776 V +11 B +900(5.5.6.)S +1215(Polygon)S +1932 V +11 R +1175(The)S +11 B +1390(cdl_markPolygon\(\))S +11 R +2339(procedure)S +2820(is)S +2939(used)S +3185(to)S +3316(draw)S +3579(a)S +3673(closed)S +3999(polygon)S +4406(consisting)S +4899(of)S +11 I +5036(npts)S +2052 V +11 R +900(vertices)S +1275(speci\256ed)S +1700(by)S +1845(the)S +11 I +2014(xpts)S +11 R +2226(and)S +11 I +2418(ypts)S +11 R +2629(array)S +2886(in)S +3006(the)S +3174(desired)S +11 I +3524(color)S +11 R +3756(.)S +3851(The)S +4055(last)S +4242(point)S +4503(in)S +4623(the)S +4791(array)S +5048(will)S +2172 V +900(automatically)S +1542(be)S +1689(connected)S +2176(to)S +2306(the)S +2484(\256rst)S +2700(point)S +2971(by)S +3125(the)S +3303(procedure.)S +3845(If)S +3962(the)S +11 I +4141(\256ll)S +11 R +4303(\257ag)S +4513(is)S +4632(set)S +4799(the)S +4978(circle)S +2292 V +900(will)S +1105(be)S +1241(\256lled)S +1501(with)S +1730(the)S +1897(marker)S +2239(color.)S +2472 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +2592 V +11 C +1175(int)S +1439(cdl_markPolygon)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(int)S +3617(*xpts,)S +4079(int)S +4343(*ypts,)S +2712 V +1439(int)S +1703(npts,)S +2099(int)S +2363(fill,)S +2759(int)S +3023(color\))S +2952 V +11 B +900(5.5.7.)S +1215(Ellipse)S +3108 V +11 R +1175(The)S +11 B +1383(cdl_markEllipse\(\))S +11 R +2265(procedure)S +2739(is)S +2851(used)S +3091(to)S +3216(draw)S +3473(an)S +3615(ellipse)S +3941(of)S +4071(the)S +4244(speci\256ed)S +4673(color)S +4937(with)S +5172(a)S +3228 V +900(center)S +1207(at)S +1327(\()S +11 I +1363(x,y)S +11 R +1487(\))S +1563(and)S +1761(semimajor-axis)S +11 I +2478(xrad)S +11 R +2719(and)S +2917(semiminor-axis)S +11 I +3641(yrad)S +11 R +3882(pixels)S +4185(long.)S +4482(A)S +4601(rotation)S +4983(angle)S +3348 V +900(for)S +1063(the)S +1233(ellipse)S +1556(may)S +1781(be)S +1920(speci\256ed)S +2346(by)S +2492(passing)S +2858(a)S +2942(non-zero)S +11 I +3366(angle)S +11 R +3646(argument,)S +4124(the)S +4294(angle)S +4567(is)S +4678(measured)S +5134(in)S +3468 V +900(degrees)S +1276(from)S +1532(the)S +1709(positive)S +2101(x-axis.)S +2473(If)S +2587(the)S +11 I +2763(\256ll)S +11 R +2922(\257ag)S +3129(is)S +3245(set)S +3409(the)S +3585(circle)S +3869(will)S +4083(be)S +4228(\256lled)S +4497(with)S +4735(the)S +4911(marker)S +3588 V +900(color.)S +3768 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +3888 V +11 C +1175(int)S +1439(cdl_markEllipse)S +2495(\(CDLPtr)S +3023(cdl,)S +3353(int)S +3617(x,)S +3815(int)S +4079(y,)S +4277(int)S +4541(xrad,)S +4008 V +1439(int)S +1703(yrad,)S +2099(float)S +2495(ang,)S +2825(int)S +3089(fill,)S +3485(int)S +3749(color\))S +4248 V +11 B +900(5.5.8.)S +1215(Circular)S +1650(Annuli)S +4404 V +11 R +1175(The)S +11 B +1391(cdl_markCircAnnuli\(\))S +11 R +2494(procedure)S +2976(is)S +3096(used)S +3344(to)S +3477(draw)S +11 I +3742(nannuli)S +11 R +4126(circles)S +4458(separated)S +4917(by)S +11 I +5074(sep)S +4524 V +11 R +900(pixels)S +1196(each.)S +1489(The)S +1692(circle)S +1967(is)S +2074(centered)S +2476(at)S +2588(\()S +11 I +2624(x,y)S +11 R +2748(\))S +2817(with)S +3046(an)S +3182(initial)S +3473(radius)S +3774(of)S +11 I +3898(radius)S +11 R +4213(pixels.)S +4704 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +4824 V +11 C +1175(int)S +1439(cdl_markCircAnnuli)S +2693(\(CDLPtr)S +3221(cdl,)S +3551(int)S +3815(x,)S +4013(int)S +4277(y,)S +4475(int)S +4739(radius,)S +4944 V +1439(int)S +1703(nannuli,)S +2297(int)S +2561(sep,)S +2891(int)S +3155(color\))S +5184 V +11 B +900(5.5.9.)S +1215(Elliptical)S +1678(Annuli)S +5340 V +11 R +1175(The)S +11 B +1385(cdl_markEllipAnnuli\(\))S +11 R +2505(procedure)S +2981(is)S +3095(used)S +3336(to)S +3462(draw)S +11 I +3721(nannuli)S +11 R +4099(ellipses)S +4470(separated)S +4923(by)S +11 I +5074(sep)S +5460 V +11 R +900(pixels)S +1220(each.)S +1537(The)S +1764(ellipse)S +2108(is)S +2239(centered)S +2665(at)S +2801(\()S +11 I +2837(x,y)S +11 R +2961(\))S +3054(with)S +3307(an)S +3467(initial)S +3782(semimajor)S +4302(and)S +4516(semiminor)S +5043(axis)S +5580 V +900(speci\256ed)S +1335(by)S +1490(the)S +11 I +1669(xrad)S +11 R +1915(and)S +11 I +2118(yrad)S +11 R +2364(arguments.)S +2927(Each)S +3190(ellipse)S +3522(will)S +3739(be)S +3887(optionally)S +4379(rotate)S +4673(by)S +4828(an)S +11 I +4976(angle)S +5700 V +11 R +900(degrees)S +1266(as)S +1390(measured)S +1842(from)S +2088(the)S +2255(positive)S +2637(x-axis.)S +5880 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6000 V +11 C +1175(int)S +1439(cdl_markEllipAnnuli)S +2759(\(CDLPtr)S +3287(cdl,)S +3617(x,)S +3815(y,)S +4013(xrad,)S +4409(yrad,)S +4805(ang,)S +6120 V +1439(int)S +1703(nannuli,)S +2297(int)S +2561(sep,)S +2891(int)S +3155(color\))S +6360 V +11 B +900(5.5.10.)S +1270(Text)S +6516 V +11 R +1175(The)S +11 B +1393(cdl_markText\(\))S +11 R +2178(procedure)S +2662(is)S +2784(used)S +3033(to)S +3167(draw)S +3433(a)S +3529(text)S +3742(string)S +4042(speci\256ed)S +4481(by)S +11 I +4640(str)S +11 R +4806(argument)S +6636 V +900(with)S +1142(an)S +1291(initial)S +1595(position)S +1997(at)S +2121(\()S +11 I +2157(x,y)S +11 R +2281(\))S +2362(and)S +2565(optionally)S +3057(rotated)S +3406(by)S +11 I +3561(angle)S +11 R +3850(degrees)S +4228(as)S +4364(measured)S +4828(from)S +5086(the)S +6756 V +900(positive)S +1288(x-axis.)S +1657(The)S +1867(default)S +11 I +2211(size)S +11 R +2416(is)S +2530(1.0)S +2708(and)S +2906(is)S +3020(approximately)S +3694(a)S +3782(6x13)S +4042(font,)S +4287(the)S +4461(font)S +4678(size)S +4888(may)S +5117(be)S +6876 V +900(scaled)S +1206(by)S +1349(any)S +1540(fractional)S +1992(amount.)S +7056 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7176 V +11 C +1175(int)S +1439(cdl_markText)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(x,)S +3617(int)S +3881(y,)S +4079(char)S +4409(*str,)S +7296 V +1439(float)S +1835(size,)S +2231(float)S +2627(angle,)S +3089(int)S +3353(color\))S +7920 V +EP +%%Page: 15 18 +BP +/slant 0 def +/height 1.000000 def +11 C +11 C +480 V +11 R +2936(- 15 -)S +840 V +11 B +900(5.6.)S +1132(Text)S +1378(Fonts)S +996 V +11 R +1175(The)S +11 B +1382(cdl_setFont\(\))S +11 R +2034(procedure)S +2507(is)S +2618(used)S +2856(to)S +2979(choose)S +3320(between)S +3721(one)S +3917(of)S +4046(four)S +4266(available)S +4699(fonts)S +4957(as)S +5086(the)S +1116 V +900(text)S +1099(marker)S +1442(default:)S +1811(Roman,)S +2191(Greek,)S +2518(Futura,)S +2866(Bold)S +3114(and)S +3305(Times)S +3613(respectively.)S +4236(By)S +4398(default)S +4735(the)S +4902(Roman)S +1236 V +900(font)S +1110(will)S +1315(be)S +1451(used.)S +1713(The)S +1916(width)S +2200(of)S +2324(the)S +2491(lines)S +2732(used)S +2966(to)S +3085(draw)S +3336(the)S +3503(text)S +3701(may)S +3923(also)S +4133(be)S +4269(set.)S +1416 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +1536 V +11 C +1175(void)S +1505(cdl_setFont)S +2297(\(CDLPtr)S +2825(cdl,)S +3155(int)S +3419(font\))S +1656 V +1175(void)S +1505(cdl_setTextWidth)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(width\))S +1836 V +11 R +900(A)S +1023(complete)S +1469(listing)S +1790(of)S +1925(the)S +2103(Greek)S +2413(character)S +2856(mappings)S +3329(can)S +3525(be)S +3673(found)S +3974(in)S +4105(the)S +4284(\256le)S +4470('greek.ps')S +4955(in)S +5086(the)S +1956 V +900('doc')S +1173(subdirectory)S +1764(of)S +1898(the)S +2074(CDL)S +2336(distribution.)S +3223(The)S +11 I +3435(Roman)S +11 R +3788(font)S +4007(is)S +4123(the)S +4299(font)S +4518(implemented)S +5134(in)S +2076 V +900(the)S +1084(original)S +1476(version)S +1849(of)S +1990(the)S +2174(CDL)S +2444(and)S +2652(works)S +2970(well)S +3209(for)S +3386(most)S +3651(applications.)S +4294(Both)S +4560(the)S +11 I +4745(Greek)S +11 R +5062(and)S +2196 V +11 I +900(Times)S +11 R +1211(fonts)S +1479(are)S +1659(hi-resolution)S +2269(fonts)S +2537(which)S +2853(work)S +3126(best)S +3351(for)S +3526(larger)S +3828(frame)S +4130(bu)S +4240 H + (f)show 11 -.5 mul h (f)show +11 R +4307(ers)S +4482(but)S +4670(can)S +4868(produce)S +2316 V +900(publication)S +1429(quality)S +1769(text.)S +2029(The)S +11 I +2233(Futura)S +11 R +2573(font)S +2784(is)S +2892(a)S +2974(simpler)S +3338(font)S +3549(which)S +3852(can)S +4038(produce)S +4425(better)S +4709(results)S +5031(than)S +2436 V +900(the)S +1072(default)S +1414(on)S +1562(small)S +1839(size)S +2047(frame)S +2339(bu)S +2449 H + (f)show 11 -.5 mul h (f)show +11 R +2516(ers.)S +2742(A)S +11 I +2859(Bold)S +11 R +3105(font)S +3320(automatically)S +3956(increases)S +4394(the)S +4565(text)S +4767(line)S +4969(width)S +2556 V +900(by)S +1043(one)S +1234(pixel)S +1487(over)S +1714(the)S +1881(current)S +2223(setting)S +2550(and)S +2741(may)S +2963(be)S +3099(used)S +3333(with)S +3562(any)S +3753(font.)S +2796 V +11 B +900(5.6.1.)S +1215(In-Line)S +1604(Font)S +1857(Changes)S +2952 V +11 R +1175(Text)S +1421(markers)S +1818(are)S +1995(drawn)S +2314(using)S +2599(the)S +2779(font)S +3002(selected)S +3400(with)S +3642(the)S +11 I +3822(cdl_setFont\(\))S +11 R +4459(routine,)S +4844(however)S +3072 V +900(fonts)S +1174(may)S +1417(be)S +1573(change)S +1935(within)S +2270(a)S +2371(string)S +2675(itself)S +2948(\(e.g.)S +3196(to)S +3335(set)S +3510(a)S +3611(Greek)S +3930(character\))S +4417(using)S +4709(a)S +4810(\\f)S +4930(escape)S +3192 V +900(sequence.)S +1399(The)S +1608(escape)S +1937(is)S +2050(followed)S +2479(by)S +2628(the)S +2801(character)S +3238('R')S +3423(to)S +3548(set)S +3709(a)S +3796(Roman)S +4153(font,)S +4397('G')S +4587(for)S +4753(Greek,)S +5086('F')S +3312 V +900(for)S +1061(futura,)S +1384('B')S +1564(for)S +1725(bold)S +1954(and)S +2145('T')S +2317(for)S +2477(Times.)S +2846(Any)S +3068(number)S +3436(of)S +3560(escapes)S +3926(are)S +4091(permitted)S +4545(within)S +4860(a)S +4941(string,)S +3432 V +900(the)S +1071(font)S +1285(change)S +1631(will)S +1840(remain)S +2181(in)S +2304(e)S +2352 H + (f)show 11 -.5 mul h (f)show +11 R +2419(ect)S +2583(until)S +2823(it)S +2922(is)S +3033(changed,)S +3462(or)S +3590(the)S +3761(end)S +3956(of)S +4085(string)S +4374(at)S +4491(which)S +4797(point)S +5062(any)S +3552 V +900(subsequent)S +1431(strings)S +1768(will)S +1982(again)S +2261(be)S +2406(drawn)S +2721(with)S +2959(the)S +3135(default)S +3481(font.)S +3761(Additionally)S +4360(a)S +4450('P')S +4626(in)S +4754(the)S +4930(escape)S +3672 V +900(sequence)S +1333(will)S +1538(change)S +1880(the)S +2047(font)S +2257(to)S +2376(the)S +2543(one)S +2734(previously)S +3231(used,)S +3493(whatever)S +3926(that)S +4124(may)S +4346(be.)S +3828 V +1175(The)S +1382(CDL)S +1639(also)S +1853(supports)S +2263(a)S +2348(sub/superscripting)S +3191(of)S +3319(text)S +3521(which)S +3826(can)S +4014(only)S +4247(be)S +4387(done)S +4637(with)S +4871(the)S +5043(font)S +3948 V +900(escapes.)S +1337(In)S +1471(this)S +1674(case)S +1904(the)S +2081(escape)S +2414(character)S +2855(followed)S +3288(by)S +3441(a)S +3532('U')S +3726(produces)S +4164(a)S +4255(superscript)S +4779(and)S +4979(a)S +5069('D')S +4068 V +900(produces)S +1334(a)S +1421(subscript.)S +1918(The)S +2127(changes)S +2518(may)S +2746(be)S +2889(nested)S +3209(permitting)S +3708(several)S +4057(levels)S +4353(of)S +4484(sub/superscripts,)S +4188 V +900(these)S +1159(escapes)S +1526(may)S +1749(also)S +1960(be)S +2097(used)S +2332(in)S +2452(conjunction)S +3005(with)S +3235(a)S +3317(font)S +3528(change)S +3871(to)S +3991(cause)S +4267(the)S +4435(sub/superscript)S +5134(to)S +4308 V +900(be)S +1045(drawn)S +1360(with)S +1598(a)S +1688(di)S +1774 H + (f)show 11 -.5 mul h (f)show +11 R +1841(erent)S +2101(font.)S +2381(A)S +2502(superscript)S +3025(escape)S +3357(will)S +3571(remain)S +3917(in)S +4045(e)S +4093 H + (f)show 11 -.5 mul h (f)show +11 R +4160(ect)S +4329(until)S +4574(the)S +4751(end)S +4952(of)S +5086(the)S +4428 V +900(string)S +1188(or)S +1316(a)S +1401(\\fD)S +1584(escape)S +1911(is)S +2022(seen.)S +2314(Similarly)S +2762(a)S +2847(subscript)S +3281(remains)S +3665(in)S +3788(e)S +3836 H + (f)show 11 -.5 mul h (f)show +11 R +3903(ect)S +4067(until)S +4307(the)S +4478(end)S +4672(of)S +4799(the)S +4969(string)S +4548 V +900(of)S +1028(a)S +1113(\\fU)S +1296(escape.)S +1684(Sub/superscripted)S +2508(text)S +2710(is)S +2821(drawn)S +3131(using)S +3407(a)S +3492(smaller)S +3852(font)S +4066(size,)S +4302(there)S +4558(is)S +4670(presently)S +5110(no)S +4668 V +900(way)S +1115(to)S +1234(specify)S +1583(a)S +1664(di)S +1750 H + (f)show 11 -.5 mul h (f)show +11 R +1817(erent)S +2068(size)S +2271(for)S +2431(the)S +2598(sub/superscripted)S +3399(text.)S +4848 V +11 B +2436(Summary)S +2933(of)S +3057(Font)S +3310(Escapes)S +5028 V +11 R +2179(\\fR)S +2521(change)S +2863(to)S +2982(Roman)S +3333(font)S +5148 V +2179(\\fG)S +2521(change)S +2863(to)S +2982(Greek)S +3281(font)S +5268 V +2179(\\fF)S +2521(change)S +2863(to)S +2982(Futura)S +3302(font)S +5388 V +2179(\\fT)S +2521(change)S +2863(to)S +2982(Times)S +3290(font)S +5508 V +2179(\\fB)S +2521(change)S +2863(to)S +2982(bold)S +3211(font)S +5628 V +2179(\\fP)S +2521(change)S +2863(to)S +2982(previous)S +3393(font)S +5748 V +2179(\\fU)S +2521(begin)S +2798(relative)S +3159(superscripted)S +3776(text)S +5868 V +2179(\\fD)S +2521(begin)S +2798(relative)S +3159(subscripted)S +3692(text)S +6168 V +11 B +900(5.7.)S +1132(Line)S +1380(Widths)S +1757(and)S +1969(Styles)S +6324 V +11 R +1175(The)S +11 B +1407(cdl_setLineWidth\(\))S +11 R +2380(procedure)S +2878(can)S +3091(be)S +3256(used)S +3519(to)S +3667(set)S +3851(the)S +4047(line)S +4275(width)S +4589(used)S +4853(to)S +5002(draw)S +6444 V +900(polygon)S +1306(or)S +1442(polyline)S +1848(markers,)S +2273(point)S +2544(markers)S +2940(will)S +3156(not)S +3341(be)S +3488(a)S +3536 H + (f)show 11 -.5 mul h (f)show +11 R +3603(ected.)S +3938(The)S +11 B +4152(cdl_setLineStyle\(\))S +11 R +5038(pro-)S +6564 V +900(cedure)S +1223(is)S +1330(used)S +1564(to)S +1683(set)S +1838(a)S +1919(line)S +2117(style)S +2358(other)S +2616(than)S +2838(solid.)S +6744 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6864 V +11 C +1175(void)S +1505(cdl_setLineWidth)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(width\))S +6984 V +1175(void)S +1505(cdl_setLineStyle)S +2627(\(CDLPtr)S +3155(cdl,)S +3485(int)S +3749(style\))S +7140 V +11 R +1175(The)S +1386(")S +11 I +1431(cdl.h)S +11 R +1648(")S +1734(include)S +2099(\256le)S +2282(for)S +2451(C)S +2567(programs,)S +3051(the)S +3227(")S +11 I +3272(cdlftn.inc)S +11 R +3685(")S +3772(include)S +4137(for)S +4306(fortran)S +4645(programs,)S +5129(or)S +7260 V +900(the)S +1075(")S +11 I +1120(cdlspp.h)S +11 R +1490(")S +1576(include)S +1940(\256le)S +2122(SPP)S +2349(programs,)S +2832(de\256nes)S +3184(the)S +3359(following)S +3828(symbolic)S +4273(constants)S +4723(for)S +4890(each)S +5129(of)S +7920 V +EP +%%Page: 16 19 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 16 -)S +840 V +900(the)S +1067(de\256ned)S +1423(line)S +1621(styles:)S +1020 V +11 B +1933(L_SOLID)S +11 R +2743(0)S +11 B +3293(L_DASHED)S +11 R +4132(1)S +1140 V +11 B +1933(L_DOTTED)S +11 R +2743(2)S +11 B +3293(L_DOTDASH)S +11 R +4132(3)S +1260 V +11 B +1933(L_HOLLOW)S +11 R +2743(4)S +11 B +3293(L_SHADOW)S +11 R +4132(5)S +1476 V +1175(The)S +11 I +1379(hollow)S +11 R +1714(line)S +1913(style)S +2155(is)S +2263(drawn)S +2571(with)S +2802(a)S +2885(linewidth)S +3336(of)S +3462(\256ve)S +3662(pixels,)S +3988(two)S +4188(pixels)S +4486(of)S +4612(color,)S +4900(a)S +4983(black)S +1596 V +900(line,)S +1132(and)S +1329(two)S +1533(pixels)S +1835(of)S +1965(color.)S +2290(It)S +2396(is)S +2509(best)S +2725(used)S +2965(when)S +3241(the)S +3414(marker)S +3761(will)S +3971(traverse)S +4354(extreme)S +4744(changes)S +5134(in)S +1716 V +900(brightness,)S +1414(due)S +1606(to)S +1726(the)S +1894(thickness)S +2337(of)S +2462(the)S +2630(line)S +2829(it)S +2925(may)S +3148(work)S +3407(best)S +3618(with)S +3848(larger)S +4137(frame)S +4426(bu)S +4536 H + (f)show 11 -.5 mul h (f)show +11 R +4603(ers.)S +4826(The)S +11 I +5031(sha-)S +1836 V +900(dow)S +11 R +1128(linestyle)S +1545(is)S +1663(drawn)S +1980(as)S +2115(two)S +2324(pixels)S +2631(of)S +2766(color)S +3035(and)S +3237(two)S +3445(pixels)S +3751(of)S +3885(black)S +4165(and)S +4366(should)S +4703(be)S +4849(used)S +5093(for)S +1956 V +900(similar)S +1240(brightness)S +1726(variations,)S +2221(however)S +2631(it)S +2727(e)S +2775 H + (f)show 11 -.5 mul h (f)show +11 R +2842(ectively)S +3223(shows)S +3532(up)S +3676(as)S +3802(a)S +3885(line)S +4085(only)S +4316(two)S +4516(pixels)S +4814(wide)S +5062(and)S +2076 V +900(may)S +1122(be)S +1258(preferred)S +1689(for)S +1849(medium)S +2243(or)S +2367(smaller)S +2723(frame)S +3010(bu)S +3120 H + (f)show 11 -.5 mul h (f)show +11 R +3187(ers.)S +2232 V +1175(The)S +1390(three)S +1654(dashed)S +2004(linestyles)S +2466(are)S +2644(drawn)S +2963(using)S +3248("gap")S +3542(spacings)S +3966(of)S +4103(5)S +4204(pixels)S +4513(in)S +4645(between)S +5055(line)S +2352 V +900(segments.)S +1405(Whether)S +1816(or)S +1942(not)S +2118(these)S +2378(gaps)S +2614(are)S +2781(resolved)S +3187(depends)S +3581(on)S +3726(the)S +3895(size)S +4100(of)S +4225(the)S +4393(frame)S +4681(bu)S +4791 H + (f)show 11 -.5 mul h (f)show +11 R +4858(er)S +4976(being)S +2472 V +900(used)S +1150(and)S +1358(the)S +1542(magni\256cation)S +2197(used)S +2448(in)S +2584(the)S +2768(display)S +3136(server.)S +3513(By)S +3692(default)S +4046(they)S +4285(should)S +4629(resolve)S +4995(com-)S +2592 V +900(pletely)S +1271(using)S +1582(frame)S +1908(bu)S +2018 H + (f)show 11 -.5 mul h (f)show +11 R +2085(ers)S +2284(up)S +2466(to)S +2624(1024x1024)S +3191(pixels,)S +3554(or)S +3717(magni\256cation)S +4393(factors)S +4761(displaying)S +2712 V +900(1024x1024)S +1428(pixels.)S +1785(If)S +1890(larger)S +2177(sizes)S +2423(are)S +2588(needed)S +2930(the)S +3097(image)S +3398(should)S +3725(be)S +3862(subsampled)S +4415(prior)S +4662(to)S +4782(display)S +5134(to)S +2832 V +900(maintain)S +1318(the)S +1485(marker)S +1827(resolution)S +2300(needed)S +2642(for)S +2802(these)S +3060(linestyles.)S +3192 V +11 B +900(5.8.)S +1132(Deleting)S +1555(Markers)S +3348 V +11 R +1175(When)S +1481(markers)S +1878(are)S +2055(drawn)S +2373(the)S +2552(underlying)S +3073(subraster)S +3514(is)S +3634(\256rst)S +3852(saved)S +4147(to)S +4279(an)S +4428(internal)S +4809(structure,)S +3468 V +900(erasure)S +1268(is)S +1396(done)S +1663(by)S +1827(simply)S +2181(redisplaying)S +2777(the)S +2964(saved)S +3266(raster.)S +3622(Problems)S +4091(can)S +4295(arise)S +4554(however)S +4983(when)S +3588 V +900(markers)S +1295(overlap;)S +1730(when)S +2010(deleting)S +2407(a)S +2498(marker)S +2850(that)S +3058(is)S +11 I +3175(under)S +11 R +3474(another)S +3845(marker)S +4198(the)S +4376(original)S +4762(pixels)S +5069(can)S +3708 V +900(overwrite)S +1372(the)S +1559(pixels)S +1875(of)S +2019(the)S +2206(marker)S +2568(on)S +2731(top.)S +2986(This)S +3235(is)S +3362(an)S +3517(unfortunate)S +4074(side)S +4303(e)S +4351 H + (f)show 11 -.5 mul h (f)show +11 R +4418(ect)S +4597(of)S +4740(the)S +4926(simple)S +3828 V +900(scheme)S +1268(used)S +1509(in)S +1635(this)S +1835(version)S +2198(of)S +2329(the)S +2503(package,)S +2928(users)S +3193(can)S +3384(call)S +3582(the)S +11 B +3757(cdl_redrawOverlay\(\))S +11 R +4784(procedure)S +3948 V +900(to)S +1019(help)S +1241(clean)S +1504(up)S +1647(any)S +1838(artifacts)S +2223(left)S +2402(behind.)S +4188 V +11 B +900(5.8.1.)S +1215(Individual)S +1742(Markers)S +4344 V +11 R +1175(The)S +11 B +1396(cdl_deleteMark\(\))S +11 R +2257(procedure)S +2745(is)S +2871(used)S +3124(to)S +3262(delete)S +3575(a)S +3675(single)S +3990(marker)S +4351(from)S +4616(the)S +4802(display\(\).)S +4464 V +900(The)S +1107(\()S +11 I +1143(x,y)S +11 R +1267(\))S +1340(argument)S +1791(is)S +1902(either)S +2188(the)S +2358(center)S +2660(position)S +3052(of)S +3179(the)S +3349(marker)S +3694(if)S +3797(that)S +3998(is)S +4108(know)S +4388(by)S +4534(the)S +4704(application,)S +4584 V +900(more)S +1162(typically)S +1584(it)S +1683(will)S +1893(be)S +2034(an)S +2175(approximate)S +2761(position.)S +3216(In)S +3345(the)S +3517(latter)S +3780(case)S +4005(the)S +4177(marker)S +4524(whose)S +4842(center)S +5146(is)S +4704 V +900(closest)S +1234(to)S +1355(this)S +1550(position)S +1941(will)S +2148(be)S +2286(deleted.)S +2698(For)S +2886(markers)S +3273(with)S +3504(no)S +3648(de\256ned)S +4005(center)S +4338(the)S +4506(distance)S +4899(used)S +5134(to)S +4824 V +900(decide)S +1220(if)S +1323(the)S +1493(marker)S +1838(should)S +2168(be)S +2307(deleted)S +2659(is)S +2769(the)S +2939(distance)S +3334(from)S +3583(the)S +3753(argument)S +4203(position)S +4595(to)S +4717(the)S +4887(edge)S +5129(of)S +4944 V +900(the)S +1075(marker.)S +1486(For)S +1680(example,)S +2120(distance)S +2520(from)S +2774(a)S +2863(box)S +3069(or)S +3201(polygon)S +3603(is)S +3718(measured)S +4177(as)S +4308(the)S +4482(distance)S +4881(from)S +5134(to)S +5064 V +900(one)S +1103(of)S +1239(the)S +1418(sides,)S +1711(for)S +1883(text)S +2093(it)S +2200(is)S +2319(the)S +2498(distance)S +2902(to)S +3033(the)S +3212(start)S +3446(of)S +3582(the)S +3761(text)S +3972(string.)S +4330(There)S +4630(is)S +4750(no)S +4906(way)S +5134(to)S +5184 V +11 I +900(un)S +11 R +1010(delete)S +1304(a)S +1385(marker)S +1727(other)S +1985(than)S +2207(to)S +2326(redraw)S +2661(it.)S +5364 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +5484 V +11 C +1175(int)S +1439(cdl_deleteMark)S +2429(\(CDLPtr)S +2957(cdl,)S +3287(int)S +3551(x,)S +3749(int)S +4013(y\))S +5724 V +11 B +900(5.8.2.)S +1215(The)S +1432(Entire)S +1764(Overlay)S +5880 V +11 R +1175(To)S +1337(erase)S +1600(all)S +1750(markers)S +2142(currently)S +2577(displayed)S +3039(use)S +3226(the)S +11 B +3401(cdl_clearOverlay\(\))S +11 R +4318(procedure.)S +4856(Markers)S +6000 V +900(are)S +1069(erased)S +1383(in)S +1505(the)S +1675(reverse)S +2025(order)S +2291(they)S +2516(were)S +2763(drawn)S +3072(to)S +3194(help)S +3419(reduce)S +3745(the)S +3915(chance)S +4253(that)S +4454(overlaying)S +4959(mark-)S +6120 V +900(ers)S +1060(will)S +1265(leave)S +1528(stray)S +1774(pixels.)S +6300 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +6420 V +11 C +1175(int)S +1439(cdl_clearOverlay)S +2561(\(CDLPtr)S +3089(cdl\))S +6660 V +11 B +900(5.9.)S +1132(Redraw)S +6816 V +11 R +1175(The)S +11 B +1389(cdl_redrawOverlay\(\))S +11 R +2419(procedure)S +2899(can)S +3094(be)S +3241(used)S +3486(to)S +3616(redraw)S +3963(all)S +4118(markers)S +4515(currently)S +4955(in)S +5086(the)S +6936 V +900(display)S +1271(list.)S +1520(This)S +1768(is)S +1894(sometimes)S +2417(needed)S +2778(when)S +3067(subraster)S +3514(I/O)S +3712(procedures)S +4243(are)S +4427(used)S +4680(to)S +4818(redisplay)S +7056 V +900(subregions)S +1409(and)S +1600(overwrite)S +2052(existing)S +2434(markers.)S +7236 V +900(Synopsis)S +11 Y1 +900(2)S +914(2222222)S +7920 V +EP +%%Page: 17 20 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 17 -)S +840 V +11 C +1175(int)S +1439(cdl_redrawOverlay)S +2627(\(CDLPtr)S +3155(cdl\))S +1080 V +11 B +900(6.)S +1049(ANSI)S +1345(C)S +1457(Function)S +1913(Prototypes)S +1236 V +11 R +1175(The)S +1387(current)S +1738(release)S +2082(of)S +2215(CDL)S +2477(provides)S +2897(full)S +3092(ANSI)S +3390(C)S +3506(function)S +3914(prototypes)S +4421(for)S +4591(all)S +4744(public)S +5062(and)S +1356 V +900(private)S +1244(procedures.)S +1824(By)S +1993(default)S +2337(these)S +2602(will)S +2814(not)S +2994(be)S +3136(used)S +3376(even)S +3621(on)S +3770(systems)S +4158(with)S +4393(native)S +4700(ANSI)S +4995(com-)S +1476 V +900(pilers,)S +1227(however.)S +1719(To)S +1896(make)S +2188(use)S +2389(of)S +2535(the)S +2724(CDL)S +3000(prototypes)S +3520(users)S +3801(will)S +4029(need)S +4291(to)S +4433(de\256ne)S +4757(the)S +4947(macro)S +1596 V +11 B +900(CDL_ANSIC)S +11 R +1566(either)S +1852(when)S +2126(compiling)S +2609(the)S +2779(program)S +3186(\(using)S +3497(the)S +3667(-D)S +3818(option)S +4136(to)S +4258(the)S +4428(compiler\),)S +4918(or)S +5045(as)S +5172(a)S +1716 V +900(de\256nition)S +1356(in)S +1475(the)S +1642(program)S +2046(source)S +2364(preceding)S +2828(the)S +2995('cdl.h')S +3317(include)S +3673(directive.)S +1872 V +1175(For)S +1361(example,)S +2052 V +11 C +1175(#define)S +1769(CDL_ANSIC)S +2172 V +1175(#include)S +1769("cdl.h")S +2292 V +1505(:)S +2412 V +1175(main)S +1505(\(int)S +1835(argc,)S +2231(char)S +2561(**argv\))S +2532 V +1505(:)S +2712 V +11 R +900(or)S +1024(when)S +1294(compiling)S +1774(using)S +2046(something)S +2538(like)S +2892 V +11 C +1175(cc)S +1373(-DCDL_ANSIC)S +2165(client.c)S +2759(libcdl.a)S +3353(-lm)S +3072 V +11 R +1175(Note)S +1424(that)S +1625(when)S +1898(using)S +2173(CDL_ANSIC)S +2814(to)S +2936(build)S +3199(the)S +3370(client)S +3651(program)S +4059(it)S +4158(is)S +4269(also)S +4483(required)S +4884(that)S +5086(the)S +3192 V +900(CDL)S +1163(itself)S +1426(be)S +1572(built)S +1818(in)S +1946(the)S +2122(same)S +2389(way)S +2613(to)S +2741(avoid)S +3027(confusing)S +3502(FPE)S +3735(errors.)S +4092(Similarly,)S +4573(when)S +4852(building)S +3312 V +900(client)S +1178(tasks)S +1432(that)S +11 I +1631(do)S +1775(not)S +11 R +1950(use)S +2130(CDL_ANSIC)S +2769(you)S +2968(must)S +3217(use)S +3397(a)S +3479(version)S +3836(of)S +3961(the)S +4130(library)S +4457(that)S +4657(has)S +4838(not)S +5014(been)S +3432 V +900(compiled)S +1342(with)S +1571(prototypes.)S +3588 V +1175(The)S +1378(reason)S +1696(is)S +1803(that)S +2001(the)S +2168(\257oat)S +2397(args)S +2612(to)S +2731(the)S +2898(CDL)S +3151(procedures)S +3663(in)S +3782(the)S +3949(library,)S +4302(or)S +4426(in)S +4545(your)S +4780(task)S +4991(calls,)S +3708 V +900(are)S +1071(promoted)S +1531(to)S +1656(doubles)S +2037(when)S +2313(compiling)S +2799(those)S +3070(procedures,)S +3616(but)S +3796(may)S +4023(only)S +4257(be)S +4398(passed)S +4728(as)S +4857(\257oats)S +5134(in)S +3828 V +900(your)S +1134(code)S +1373(\(or)S +1533(as)S +1657(double)S +1989(where)S +2288(the)S +2455(CDL)S +2709(is)S +2817(expecting)S +3277(\257oat\).)S +3571(This)S +3801(means)S +4115(the)S +4283(argument)S +4731(stack)S +4990(is)S +5098(o)S +5153 H + (f)show 11 -.5 mul h (f)show +11 R +3948 V +900(by)S +1045(4)S +1135(bytes)S +1402(for)S +1564(each)S +1798(\257oat)S +2029(arg)S +2203(and)S +2396(the)S +2565(values)S +2880(interpreted)S +3389(by)S +3534(the)S +3703(CDL)S +3958(procedure)S +4429(will)S +4636(be)S +4773(corrupted.)S +4068 V +900(If)S +1031(you're)S +1376(going)S +1687(to)S +1833(use)S +2039(the)S +2233(prototypes)S +2757(you'll)S +3080(need)S +3346(to)S +3492(edit)S +3717(the)S +3911(CDL)S +4191(Imake\256le)S +4665(to)S +4811(de\256ne)S +5139("-)S +4188 V +900(DCDL_ANSIC")S +1665(in)S +1787(the)S +1957(EXTRA_DEFINES)S +2865(so)S +2998(it)S +3095(will)S +3302(use)S +3483(the)S +3652(prototypes)S +4151(and)S +4344(everything)S +4848(will)S +5055(line)S +4308 V +900(up.)S +1104(You)S +1326(will)S +1531(then)S +1753(need)S +1992(to)S +2111(rebuild)S +2455(the)S +2622(libcdl.a)S +2982(as)S +3106(well)S +3328(as)S +3452(relink)S +3741(your)S +3975(program.)S +4548 V +11 B +900(7.)S +1049(Fortran)S +1453(Language)S +1952(Binding)S +2362(Notes)S +4704 V +11 R +1175(The)S +1396(Fortran)S +1770(language)S +2216(binding)S +2604(routines)S +3009(are)S +3193(implemented)S +3819(in)S +3957(C)S +4083(but)S +4276(should)S +4622(be)S +4777(accessible)S +4824 V +900(from)S +1155(any)S +1355(fortran)S +1694(program)S +2107(as)S +2240(though)S +2588(they)S +2819(were)S +3072(real)S +3277(fortran)S +3616(subroutines.)S +4226(The)S +4437(calling)S +4777(sequences)S +4944 V +900(are)S +1065(the)S +1232(same)S +1490(as)S +1614(with)S +1843(the)S +2010(C)S +2117(library)S +2442(routines)S +2829(with)S +3058(the)S +3225(following)S +3686(exceptions:)S +5100 V +11 Y1 +1150(d)S +11 R +1289(The)S +1500(CDL)S +1761(package)S +2159(pointer)S +2511(is)S +2626(maintained)S +3155(internally)S +3617(so)S +3756(no)S +3907('cdl')S +4155(pointer)S +4508(is)S +4624(passed)S +4958(in)S +5086(the)S +5220 V +1150(fortran)S +1480(interface.)S +5376 V +11 Y1 +1150(d)S +11 R +1289(All)S +1471(routines)S +1866(which)S +2175(are)S +2348(integer)S +2693(procedures)S +3213(in)S +3340(the)S +3515(C)S +3630(interface)S +4053(return)S +4356(an)S +4501(extra)S +4761('ier')S +4990(argu-)S +5496 V +1150(ment)S +1403(to)S +1522(contain)S +1878(the)S +2045(error)S +2289(\257ag.)S +2548(All)S +2722(Fortran)S +3078(functions)S +3520(are)S +3685(implemented)S +4292(as)S +4416(subroutines.)S +5652 V +11 Y1 +1150(d)S +11 R +1281(The)S +1485(procedure)S +1955(names)S +2269(are)S +2435(the)S +2603(same)S +2862(except)S +3181(that)S +11 I +3380(cdl_)S +11 R +3603(has)S +3783(been)S +4023(replaced)S +4426(with)S +11 I +4656(cf)S +11 R +4769(in)S +4889(the)S +5057(for-)S +5772 V +1150(tran)S +1353(binding.)S +1784(If)S +1889(your)S +2123(compiler)S +2546(is)S +2653(case-sensitive)S +3294(then)S +3516(use)S +3695(all)S +3838(lower)S +4120(case)S +4340(letters.)S +5928 V +900(The)S +1117(binding)S +1501(has)S +1695(been)S +1949(tested)S +2253(on)S +2411(a)S +2507(number)S +2890(of)S +3029(di)S +3115 H + (f)show 11 -.5 mul h (f)show +11 R +3182(erent)S +3448(platforms)S +3917(without)S +4302(problems.)S +4820(The)S +5038(pro-)S +6048 V +900(cedure)S +1243(names)S +1576(haven't)S +1957(been)S +2216(restricted)S +2676(to)S +2815(the)S +3002(traditional)S +3506(6-character)S +4047(fortran)S +4396(names)S +4728(since)S +5005(most)S +6168 V +900(modern)S +1278(compilers)S +1754(can)S +1948(handle)S +2283(longer)S +2606(names,)S +2957(if)S +3067(yours)S +3354(isn't)S +3593(one)S +3794(of)S +3929(them)S +4193(contact)S +11 I +4553(iraf@noao.edu)S +6288 V +11 R +900(for)S +1060(help)S +1282(in)S +1401(changing)S +1836(the)S +2003(names.)S +6444 V +1175(Since)S +1456(the)S +1627(CDL)S +1884(is)S +1995(implemented)S +2606(as)S +2734(a)S +2819(set)S +2978(of)S +3106(C)S +3217(routines,)S +3637(the)S +3809(one)S +4005(aspect)S +4316(that)S +4519(cannot)S +4849(be)S +4990(over-)S +6564 V +900(looked)S +1245(in)S +1377(the)S +1557(fortran)S +1900(binding)S +2283(is)S +2403(the)S +2583(between)S +2993(Fortran)S +3362(and)S +3566(C)S +3686(storage)S +4048(order)S +4324(for)S +4497(arrays.)S +4869(In)S +5005(most)S +6684 V +900(cases)S +1166(this)S +1362(will)S +1570(not)S +1747(be)S +1886(a)S +1970(problem)S +2372(since)S +2633(the)S +2803(CDL)S +3059(routines)S +3449(are)S +3617(just)S +3813(passing)S +4179(around)S +4519(pointers)S +4910(even)S +5153(if)S +6804 V +900(they)S +1136(live)S +1348(for)S +1522(a)S +1617(short)S +1884(while)S +2174(in)S +2306(a)S +2400(fortran)S +2743(program.)S +3221(The)S +3437(problem)S +3849(comes)S +4175(when)S +4458(using)S +4743(the)S +4923(fortran)S +6924 V +900(program)S +1313(to)S +1441(read)S +1670(the)S +1846(arrays,)S +2183(for)S +2353(example)S +2767(in)S +2896(using)S +3178(the)S +3355(array)S +3621(returned)S +4028(by)S +4181(the)S +11 B +4358(cfreadIRAF\(\))S +11 R +5038(pro-)S +7044 V +900(cedure,)S +1254(or)S +1381(when)S +1654(passing)S +2020(in)S +2142(arrays)S +2444(for)S +2607(display)S +2961(that)S +3162(originated)S +3643(in)S +3765(the)S +3935(user's)S +4232(fortran)S +4565(code.)S +4868(In)S +4995(these)S +7164 V +900(cases)S +1179(the)S +1362(array)S +11 B +1634(must)S +11 R +1915(be)S +2067(transposed)S +2585(to)S +2720(be)S +2872(interpreted)S +3395(correctly.)S +3893(It)S +4009(was)S +4228(assumed)S +4655(that)S +4869(in)S +5005(most)S +7284 V +900(applications)S +1481(arrays)S +1797(returned)S +2211(by)S +2371(CDL)S +2641(procedures)S +3170(would)S +3495(be)S +3648(immediately)S +4248(passed)S +4590(to)S +4726(other)S +5000(CDL)S +7920 V +EP +%%Page: 18 21 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 18 -)S +840 V +900(procedures)S +1415(so)S +1549(having)S +1885(the)S +2056(binding)S +2430(routines)S +2821(transpose)S +3272(the)S +3443(array)S +3703(to/from)S +4070(Fortran)S +4430(storage)S +4783(order)S +5050(was)S +960 V +900(unnecessarily)S +1529(ine)S +1663 H + (f)show 11 -.5 mul h (\256)show +11 R +1755(cient.)S +2062(This)S +2291(may)S +2513(be)S +2649(changed)S +3046(in)S +3165(later)S +3392(releases)S +3770(if)S +3870(required.)S +1320 V +11 B +900(8.)S +1049(SPP)S +1278(Language)S +1777(Binding)S +2187(Notes)S +1476 V +11 R +1175(The)S +1390(SPP)S +1621(language)S +2061(binding)S +2443(is)S +2562(experimental)S +3179(and)S +3382(is)S +3501(intended)S +3924(to)S +4055(provide)S +4436(a)S +4530(way)S +4758(to)S +4890(quickly)S +1596 V +900(prototype)S +1356(tasks,)S +1639(it)S +1736(should)S +2065(not)S +2241(be)S +2379(used)S +2615(in)S +2736(production)S +3247(code)S +3488(as)S +3614(it)S +3711(may)S +3935(not)S +4111(be)S +4249(as)S +4375(portable)S +4769(as)S +4894(the)S +5062(rest)S +1716 V +900(of)S +1033(the)S +1209(task.)S +1489(In)S +1622(essence)S +1997(this)S +2200(binding)S +2580(is)S +2697(a)S +2788(layer)S +3049(on)S +3202(top)S +3386(of)S +3520(the)S +3697(Fortran)S +4063(binding)S +4443(since)S +4711(most)S +4969(IRAF)S +1836 V +900(platforms)S +1357(still)S +1560(use)S +1742(Fortran)S +2101(as)S +2228(the)S +2398(intermediate)S +2982(code.)S +3285(The)S +3490(calling)S +3824(sequences)S +4302(are)S +4469(the)S +4638(same)S +4898(as)S +5024(with)S +1956 V +900(the)S +1067(Fortran)S +1423(library)S +1748(routines)S +2135(with)S +2364(the)S +2531(following)S +2992(caveats:)S +2112 V +11 Y1 +1150(d)S +11 R +1290(The)S +1502('cdlspp.h')S +1986(SPP)S +2214(include)S +2579(\256le)S +2762(is)S +2878(required)S +3284(by)S +3437(all)S +3590(\256les)S +3817(which)S +4128(call)S +4329(CDL)S +4592(routines.)S +5050(The)S +2232 V +1150(binding)S +1535(names)S +1863(are)S +2043(actually)S +2438(SPP)S +2672(macros)S +3036(to)S +3170(resolve)S +3534(the)S +3716(current)S +4073(6)S +4176(character)S +4622(limit)S +4880(on)S +5038(pro-)S +2352 V +1150(cedure)S +1473(names.)S +2508 V +11 Y1 +1150(d)S +11 R +1287(All)S +1467(character)S +1904(string)S +2194(arguments)S +2690(must)S +2944(be)S +3086(dimensioned)S +3687(to)S +3812(at)S +3930(least)S +4170(SZ_FNAME)S +4779(characters)S +2628 V +1150(in)S +1269(length.)S +2784 V +11 Y1 +1150(d)S +11 R +1289(The)S +1500(CDL)S +1761(package)S +2159(pointer)S +2511(is)S +2626(maintained)S +3155(internally)S +3617(so)S +3756(no)S +3907('cdl')S +4155(pointer)S +4508(is)S +4624(passed)S +4958(in)S +5086(the)S +2904 V +1150(fortran)S +1480(interface.)S +3060 V +11 Y1 +1150(d)S +11 R +1289(All)S +1471(routines)S +1866(which)S +2175(are)S +2348(integer)S +2693(procedures)S +3213(in)S +3340(the)S +3515(C)S +3630(interface)S +4053(return)S +4356(an)S +4501(extra)S +4761('ier')S +4990(argu-)S +3180 V +1150(ment)S +1403(to)S +1522(contain)S +1878(the)S +2045(error)S +2289(\257ag.)S +2548(All)S +2722(SPP)S +2941(functions)S +3383(are)S +3548(implemented)S +4155(as)S +4279(subroutines.)S +3336 V +11 Y1 +1150(d)S +11 R +1293(On)S +1472(HPUX)S +1816(or)S +1952(IBM)S +2205(RS6000)S +2606(systems)S +3001(the)S +3181('cdlspp.h')S +3669(\256le)S +3856(must)S +4117(be)S +4266(edited)S +4580(to)S +4712(remove)S +5086(the)S +3456 V +1150(trailing)S +1507(underscores)S +2068(from)S +2320(the)S +2493(procedure)S +2968(name)S +3244(macros.)S +3659(This)S +3893(is)S +4005(because)S +4388(on)S +4536(these)S +4799(platforms)S +3576 V +1150(the)S +1319(fortran)S +1652(compiler)S +2078(will)S +2286(not)S +2463(append)S +2815(an)S +2954(underscore)S +3469(to)S +3591(the)S +3761(SPP)S +3983(symbols)S +4387(as)S +4514(it)S +4612(does)S +4849(on)S +4995(other)S +3696 V +1150(platforms.)S +4056 V +11 B +900(9.)S +1049(IIS)S +1230(Protocol)S +1658(Description)S +4212 V +11 R +1175(The)S +1383(communications)S +2148(protocol)S +2552(used)S +2791(by)S +2939(the)S +3111(CDL)S +3369(and)S +3565(servers)S +3913(such)S +4153(as)S +11 I +4283(XImtool)S +11 R +4676(and)S +11 I +4873(SAOim-)S +4332 V +900(age)S +11 R +1058(,)S +1121(is)S +1230(a)S +1313(slightly)S +1679(modi\256ed)S +2105(version)S +2462(of)S +2587(that)S +2786(used)S +3021(by)S +3165(the)S +3333(IIS)S +3501(Model)S +3822(70.)S +4027(All)S +4202(operations)S +4693(are)S +4859(initiated)S +4452 V +900(by)S +1051(sending)S +1434(a)S +1523(header)S +1855(packet)S +2182(containing)S +2688(a)S +11 I +2778(thing)S +3047(id)S +11 R +3175(\(tid\))S +3406(and)S +11 I +3606(subunit)S +11 R +3973(selecting)S +4405(the)S +4581(function)S +4989(to)S +5117(be)S +4572 V +900(performed,)S +1429(optionally)S +1922(followed)S +2358(by)S +2514(data)S +2742(up)S +2897(to)S +3028(32K)S +3262(bytes)S +3539(long.)S +3841(The)S +4056(IIS)S +4235(header)S +4570(packet)S +4900(used)S +5146(is)S +4692 V +900(de\256ned)S +1256(as)S +4812 V +11 C +1450(struct)S +1978(iism70)S +2440({)S +4932 V +1725(short)S +2253(tid;)S +5052 V +1725(short)S +2253(thingct;)S +5172 V +1725(short)S +2253(subunit;)S +5292 V +1725(short)S +2253(checksum;)S +5412 V +1725(short)S +2253(x,)S +2451(y,)S +2649(z;)S +5532 V +1725(short)S +2253(t;)S +5652 V +1450(};)S +5892 V +11 R +900(The)S +11 I +1109(thing)S +1375(count)S +11 R +1658(\256eld)S +1893(contains)S +2299(the)S +2473(negative)S +2884(number)S +3259(of)S +3390(bytes)S +3662(of)S +3793(data)S +4015(that)S +4220(will)S +4432(be)S +4575(sent)S +4792(following)S +6012 V +900(the)S +1067(header)S +1390(packet.)S +1769(The)S +1972(IIS)S +2139(header)S +2462(checksum)S +2933(is)S +3040(computed)S +3506(as)S +6252 V +11 C +1164(checksum)S +1758(=)S +1890(0177777)S +2418(-)S +2550(\(tid)S +2880(+)S +3012(subunit)S +3540(+)S +3672(thingct)S +4200(+)S +4332(x)S +4464(+)S +4596(y)S +4728(+)S +4860(z)S +4992(+)S +5124(t\);)S +6492 V +11 R +900(The)S +1112(four)S +1336(IIS)S +1512(registers)S +1925(are)S +2099(set)S +2263(di)S +2349 H + (f)show 11 -.5 mul h (f)show +11 R +2416(erently)S +2762(depending)S +3261(on)S +3414(the)S +3591(operation,)S +4076(a)S +4167(summary)S +4619(of)S +4753(the)S +4930(header)S +6612 V +900(packets)S +1261(for)S +1421(each)S +1653(operation)S +2100(is)S +2207(summarized)S +2776(below.)S +7920 V +EP +%%Page: 19 22 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 19 -)S +840 V +11 B +2373(IIS)S +2554(Header)S +2934(Packet)S +3283(Summary)S +1020 V +11 R +2296(TID)S +3291(Subunit)S +4061(Tct)S +4394(X)S +4638(Y)S +4933(Z)S +5268(T)S +5575(Data)S +1030 V +11 Y1 +1805(2)S +1845(2222222222222222222222222222222222222222222222222222222222222222222222222)S +1150 V +11 R +900(Read)S +1158(Data)S +1887(IIS_READ)S +11 B +2375(|)S +11 R +2399(PACKED)S +3052(MEMORY)S +4040(-NB)S +4406(x)S +4650(y)S +4882(fr)S +5217(-)S +5552(NB)S +1270 V +900(Write)S +1182(Data)S +1887(IIS_WRITE)S +11 B +2423(|)S +11 R +2447(PACKED)S +3052(MEMORY)S +4040(-NB)S +4406(x)S +4650(y)S +4882(fr)S +5217(-)S +5552(NB)S +1390 V +900(Read)S +1158(Cursor)S +1887(IIS_READ)S +3052(IMCURSOR)S +4116(-)S +4415(-)S +4659(-)S +4882(-)S +5217(-)S +5552(-)S +1510 V +900(Write)S +1182(Cursor)S +1887(IIS_WRITE)S +3052(IMCURSOR)S +4116(-)S +4406(x)S +4650(y)S +4882(wcs)S +5217(-)S +5552(-)S +1630 V +900(Set)S +1074(Frame)S +1887(IIS_WRITE)S +3052(LUT)S +11 B +3265(|)S +11 R +3289(COMMAND)S +4089(-1)S +4415(-)S +4659(-)S +4882(-)S +5217(-)S +5552(2)S +1750 V +900(Erase)S +1175(Frame)S +1887(IIS_WRITE)S +11 B +2456(|)S +11 R +2513(fb)S +3052(FEEDBACK)S +4116(-)S +4415(-)S +4659(-)S +4882(fr)S +5217(-)S +5552(-)S +1990 V +900(Old)S +1098(Write)S +1380(WCS)S +1887(IIS_WRITE)S +11 B +2423(|)S +11 R +2447(PACKED)S +3052(WCS)S +4077(-N)S +4415(-)S +4659(-)S +4882(fr)S +5217(fb)S +5552(320)S +2110 V +900(Old)S +1098(Read)S +1356(WCS)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4415(-)S +4659(-)S +4882(fr)S +5217(wcs)S +5552(320)S +2350 V +900(WCS)S +1172(Version?)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4406(1)S +4650(1)S +4882(-)S +5217(-)S +5552(320)S +2470 V +900(WCS)S +1172(by)S +1315(Number?)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4406(1)S +4659(-)S +4882(fr)S +5217(wcs)S +5552(1024)S +2590 V +900(New)S +1139(Write)S +1421(WCS)S +1887(IIS_WRITE)S +11 B +2423(|)S +11 R +2447(PACKED)S +3052(WCS)S +4077(-N)S +4406(1)S +4659(-)S +4882(fr)S +5217(fb)S +5552(1024)S +2710 V +900(New)S +1139(Read)S +1397(WCS)S +1887(IIS_READ)S +3052(WCS)S +4116(-)S +4406(1)S +4659(-)S +4882(fr)S +5217(wcs)S +5552(1024)S +2720 V +11 Y1 +1805(2)S +1845(2222222222222222222222222222222222222222222222222222222222222222222222222)S +1804(1)S +2680 V +1804(1)S +2570 V +1804(1)S +2460 V +1804(1)S +2350 V +1804(1)S +2240 V +1804(1)S +2130 V +1804(1)S +2020 V +1804(1)S +1910 V +1804(1)S +1800 V +1804(1)S +1690 V +1804(1)S +1580 V +1804(1)S +1470 V +1804(1)S +1360 V +1804(1)S +1250 V +1804(1)S +1140 V +1804(1)S +2720 V +2969(1)S +2680 V +2969(1)S +2570 V +2969(1)S +2460 V +2969(1)S +2350 V +2969(1)S +2240 V +2969(1)S +2130 V +2969(1)S +2020 V +2969(1)S +1910 V +2969(1)S +1800 V +2969(1)S +1690 V +2969(1)S +1580 V +2969(1)S +1470 V +2969(1)S +1360 V +2969(1)S +1250 V +2969(1)S +1140 V +2969(1)S +2720 V +3957(1)S +2680 V +3957(1)S +2570 V +3957(1)S +2460 V +3957(1)S +2350 V +3957(1)S +2240 V +3957(1)S +2130 V +3957(1)S +2020 V +3957(1)S +1910 V +3957(1)S +1800 V +3957(1)S +1690 V +3957(1)S +1580 V +3957(1)S +1470 V +3957(1)S +1360 V +3957(1)S +1250 V +3957(1)S +1140 V +3957(1)S +2720 V +4311(1)S +2680 V +4311(1)S +2570 V +4311(1)S +2460 V +4311(1)S +2350 V +4311(1)S +2240 V +4311(1)S +2130 V +4311(1)S +2020 V +4311(1)S +1910 V +4311(1)S +1800 V +4311(1)S +1690 V +4311(1)S +1580 V +4311(1)S +1470 V +4311(1)S +1360 V +4311(1)S +1250 V +4311(1)S +1140 V +4311(1)S +2720 V +4555(1)S +2680 V +4555(1)S +2570 V +4555(1)S +2460 V +4555(1)S +2350 V +4555(1)S +2240 V +4555(1)S +2130 V +4555(1)S +2020 V +4555(1)S +1910 V +4555(1)S +1800 V +4555(1)S +1690 V +4555(1)S +1580 V +4555(1)S +1470 V +4555(1)S +1360 V +4555(1)S +1250 V +4555(1)S +1140 V +4555(1)S +2720 V +4799(1)S +2680 V +4799(1)S +2570 V +4799(1)S +2460 V +4799(1)S +2350 V +4799(1)S +2240 V +4799(1)S +2130 V +4799(1)S +2020 V +4799(1)S +1910 V +4799(1)S +1800 V +4799(1)S +1690 V +4799(1)S +1580 V +4799(1)S +1470 V +4799(1)S +1360 V +4799(1)S +1250 V +4799(1)S +1140 V +4799(1)S +2720 V +5134(1)S +2680 V +5134(1)S +2570 V +5134(1)S +2460 V +5134(1)S +2350 V +5134(1)S +2240 V +5134(1)S +2130 V +5134(1)S +2020 V +5134(1)S +1910 V +5134(1)S +1800 V +5134(1)S +1690 V +5134(1)S +1580 V +5134(1)S +1470 V +5134(1)S +1360 V +5134(1)S +1250 V +5134(1)S +1140 V +5134(1)S +2720 V +5469(1)S +2680 V +5469(1)S +2570 V +5469(1)S +2460 V +5469(1)S +2350 V +5469(1)S +2240 V +5469(1)S +2130 V +5469(1)S +2020 V +5469(1)S +1910 V +5469(1)S +1800 V +5469(1)S +1690 V +5469(1)S +1580 V +5469(1)S +1470 V +5469(1)S +1360 V +5469(1)S +1250 V +5469(1)S +1140 V +5469(1)S +2720 V +5860(1)S +2680 V +5860(1)S +2570 V +5860(1)S +2460 V +5860(1)S +2350 V +5860(1)S +2240 V +5860(1)S +2130 V +5860(1)S +2020 V +5860(1)S +1910 V +5860(1)S +1800 V +5860(1)S +1690 V +5860(1)S +1580 V +5860(1)S +1470 V +5860(1)S +1360 V +5860(1)S +1250 V +5860(1)S +1140 V +5860(1)S +2960 V +11 R +900(Where)S +1355(NB)S +2218(=)S +2313(number)S +2681(of)S +2805(bytes)S +3070(expected)S +3491(or)S +3615(written)S +3080 V +1355(x)S +2218(=)S +2313(x)S +2401(position)S +2790(of)S +2914(operation)S +3361(in)S +3480(frame)S +3767(bu)S +3877 H + (f)show 11 -.5 mul h (f)show +11 R +3944(er)S +4061(coords)S +3200 V +1355(y)S +2218(=)S +2313(y)S +2401(position)S +2790(of)S +2914(operation)S +3361(in)S +3480(frame)S +3767(bu)S +3877 H + (f)show 11 -.5 mul h (f)show +11 R +3944(er)S +4061(coords)S +3320 V +1355(fr)S +2218(=)S +2313(frame)S +2600(number)S +2968(\(passed)S +3329(as)S +3453(bit\257ag)S +3768(\(i.e.)S +3972(1,)S +4088(2)S +4176(,4)S +4292(8,)S +4408(etc\))S +3440 V +1355(fb)S +2218(=)S +2313(frame)S +2600(bu)S +2710 H + (f)show 11 -.5 mul h (f)show +11 R +2777(er)S +2894(con\256g)S +3202(number)S +3570(\(zero)S +3826(indexed\))S +3560 V +1355(N)S +2218(=)S +2313(length)S +2621(of)S +2745(WCS)S +3017(string)S +3680 V +1355(wcs)S +2218(=)S +2313(WCS)S +2585(number)S +2953(\(usually)S +3340(zero\))S +3800 V +1355(Data)S +2218(=)S +2313(the)S +2480(number)S +2848(of)S +2972(bytes)S +3237(of)S +3361(data)S +3576(to)S +3695(be)S +3831(read)S +4051(or)S +4175(written)S +4519(following)S +4980(the)S +5147(header)S +5470(packet.)S +4040 V +1355(IIS_WRITE)S +2251(=)S +2346(0400000)S +4160 V +1355(IIS_READ)S +2251(=)S +2346(0100000)S +4280 V +1355(COMMAND)S +2251(=)S +2346(0100000)S +4400 V +1355(PACKED)S +2251(=)S +2346(0040000)S +4520 V +1355(IMC_SAMPLE)S +2251(=)S +2346(0040000)S +4760 V +1355(MEMORY)S +2251(=)S +2346(001)S +4880 V +1355(LUT)S +2251(=)S +2346(002)S +5000 V +1355(FEEDBACK)S +2251(=)S +2346(005)S +5120 V +1355(IMCURSOR)S +2251(=)S +2346(020)S +5240 V +1355(WCS)S +2251(=)S +2346(021)S +5456 V +900(TID)S +1119(\256elds)S +1395(can)S +1583(be)S +1723(logically)S +2145(OR'd)S +2426(with)S +2659(the)S +2830(PACKED)S +3307(\257ag)S +3509(indicating)S +3986(the)S +4157(number)S +4529(of)S +4657(data)S +4876(bytes)S +5146(is)S +5576 V +900(exactly)S +11 I +1252(thingct)S +11 R +1594(bytes)S +1862(long,)S +2122(otherwise)S +11 I +2584(thingct)S +11 R +2926(must)S +3177(be)S +3316(speci\256ed)S +3742(as)S +3869(half)S +4075(the)S +4245(number)S +4616(of)S +4743(data)S +4960(bytes.)S +5696 V +900(In)S +1028(a)S +1113(cursor)S +1423(read,)S +1675(if)S +1779(the)S +1951(IIS_READ)S +2477(\257ag)S +2680(is)S +2792(OR'd)S +3074(with)S +3308(IMC_SAMPLE)S +4044(the)S +4216(logical)S +4553(cursor)S +4864(position)S +5816 V +900(\(i.e.)S +1153(the)S +1336(last)S +1538(value)S +1824(read)S +2060(or)S +2200(set\))S +2407(is)S +2530(returned)S +2943(immediately,)S +3570(otherwise)S +4044(the)S +4226(server)S +4540(will)S +4760(wait)S +4997(for)S +5172(a)S +5936 V +900(keystroke)S +1366(to)S +1492(be)S +1635(hit)S +1792(before)S +2110(returning)S +2552(a)S +2640(string)S +2932(containing)S +3437(the)S +3612(\(x,y\))S +3863(position,)S +4288(wcs)S +4499(of)S +4631(the)S +4806(read,)S +5062(and)S +6056 V +900(the)S +1072(keystroke.)S +1597(When)S +1896(setting)S +2228(the)S +2400(frame)S +2692(you)S +2895(must)S +3148(send)S +3387(a)S +3473(short)S +3731(integer)S +4072(in)S +4195(the)S +4366(data)S +4585(containing)S +5086(the)S +6176 V +900(frame)S +1187(selected.)S +6536 V +11 B +900(10.)S +1104(VXIMTOOL)S +1761(Proxy/Display)S +2461(Server)S +2803(Usage)S +6692 V +11 I +900(VXIMTOOL)S +11 R +1481(is)S +1593(a)S +1679(image)S +1986(display)S +2343(server)S +2648(process)S +3015(much)S +3298(like)S +11 I +3502(XIMTOOL)S +11 R +3978(,)S +4045(except)S +4369(that)S +4573(all)S +4722(it)S +4823(normally)S +6812 V +900(does)S +1139(is)S +1251(respond)S +1636(to)S +1760(datastream)S +2272(requests)S +2669(to)S +2793(read)S +3018(and)S +3214(write)S +3477(to)S +3600(internal)S +3972(frame)S +4263(bu)S +4373 H + (f)show 11 -.5 mul h (f)show +11 R +4440(ers)S +4604(maintained)S +5129(as)S +6932 V +900(arrays)S +1201(in)S +1322(memory.)S +1784(Multiple)S +2199(frame)S +2488(bu)S +2598 H + (f)show 11 -.5 mul h (f)show +11 R +2665(ers)S +2827(and)S +3020(frame)S +3309(bu)S +3419 H + (f)show 11 -.5 mul h (f)show +11 R +3486(er)S +3605(con\256gurations)S +4269(are)S +4436(supported.)S +4966(It)S +5069(can)S +7052 V +900(be)S +1038(used)S +1274(to)S +1395(debug)S +1698(CDL)S +1953(programs)S +2402(by)S +2547(printing)S +2931(out)S +3107(the)S +3276(protocol)S +3677(packets)S +4040(received,)S +4472(or)S +4597(can)S +4782(simply)S +5117(be)S +7172 V +900(used)S +1148(as)S +1286(a)S +1381(dummy)S +1766(server)S +2080(in)S +2214(cases)S +2492(where)S +2806(no)S +2964(image)S +3280(display)S +3646(is)S +3768(really)S +4065(needed.)S +4483(By)S +4660(enabling)S +5086(the)S +7292 V +11 I +900(-proxy)S +11 R +1219(\257ag)S +1418(the)S +1585(server)S +1884(can)S +2068(also)S +2278(be)S +2414(used)S +2648(to)S +2767(repeat)S +3066(the)S +3233(datastream)S +3740(requests)S +4132(to)S +4251(a)S +4332(list)S +4501(of)S +4625(other)S +4883(servers,)S +7920 V +EP +%%Page: 20 23 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 20 -)S +840 V +900(e)S +948 H + (f)show 11 -.5 mul h (f)show +11 R +1015(ectively)S +1399(splitting)S +1799(the)S +1970(image)S +2275(display)S +2630(to)S +2753(a)S +2838(number)S +3210(of)S +3338(other)S +3600(servers.)S +4007(See)S +4202(the)S +11 I +4373(vximtool)S +11 R +4788(man)S +5014(page)S +960 V +900(for)S +1060(details)S +1380(on)S +1523(other)S +1781(command-line)S +2448(arguments)S +2938(and)S +3129(usage.)S +1116 V +900(The)S +1116(program)S +1533(was)S +1749(originally)S +2223(intended)S +2647(as)S +2785(a)S +2880(debugging)S +3391(tool,)S +3638(either)S +3934(in)S +4067(the)S +4248(development)S +4862(of)S +5000(CDL)S +1236 V +900(clients)S +1233(directly)S +1614(or)S +1751(in)S +1883(cases)S +2159(where)S +2471(the)S +2651(display)S +3015(may)S +3249(need)S +3500(to)S +3631(go)S +3786(to)S +3917(separate)S +4319(screens)S +4685(as)S +4821(part)S +5036(of)S +5172(a)S +1356 V +900(larger)S +1207(project.)S +1625(For)S +1832(example,)S +2285(engineers)S +2758(may)S +3001(wish)S +3263(to)S +3403("eavesdrop")S +3990(on)S +4154(the)S +4342(system)S +4702(by)S +4866(viewing)S +1476 V +900(images)S +1249(displayed)S +1708(by)S +1856(CDL)S +2114(clients)S +2439(used)S +2678(as)S +2807(part)S +3015(of)S +3144(a)S +3230(data)S +3449(acquisition)S +3969(system.)S +4373(It)S +4477(can)S +4665(also)S +4879(be)S +5019(used)S +1596 V +900(as)S +1036(a)S +1129(memory-only)S +1772(display)S +2135(server)S +2446(for)S +2618(CDL)S +2883(clients)S +3215(which)S +3529(need)S +3781(to)S +3913(be)S +4062(run)S +4254(in)S +4386(the)S +4566(background)S +5129(as)S +1716 V +900(part)S +1103(of)S +1227(a)S +1308(pipeline)S +1695(processing)S +2197(system)S +2536(requiring)S +2971(a)S +3052(frame)S +3339(bu)S +3449 H + (f)show 11 -.5 mul h (f)show +11 R +3516(er)S +3633(for)S +3793(image)S +4094(marking.)S +1872 V +900(In)S +1031(proxy)S +1327(mode)S +1611(the)S +1785(program)S +2197(acts)S +2408(as)S +2540(a)S +2629(relay)S +2888(for)S +3056(the)S +3231(IIS)S +3406(datastream)S +3921(packets,)S +4318(sending)S +4701(image)S +5010(data,)S +1992 V +900(frame)S +1188(requests,)S +1609(etc.)S +1798(to)S +1918(a)S +2000(list)S +2169(of)S +2293(other)S +2551(servers)S +2893(speci\256ed)S +3316(on)S +3459(the)S +3626(command)S +4092(line.)S +4351(The)S +4554(e)S +4602 H + (f)show 11 -.5 mul h (f)show +11 R +4669(ect)S +4829(of)S +4953(this)S +5146(is)S +2112 V +900(to)S +1027(allow)S +1312(a)S +1402(client)S +1688(to)S +1816(display)S +2176(to)S +2304(this)S +2506(program)S +2919(which)S +3229(then)S +3460(re-displays)S +3983(to)S +4111(each)S +4352(of)S +4485(the)S +4661(other)S +4928(named)S +2232 V +900(servers.)S +1289(Of)S +1456(course)S +1793(CDL)S +2065(clients)S +2404(can)S +2607(also)S +2836(do)S +2998(this)S +3210(internally)S +3683(by)S +3844(opening)S +4249(multiple)S +4668(connections,)S +2352 V +900(using)S +11 I +1185(vximtool)S +11 R +1609(in)S +1741(proxy)S +2044(mode)S +2335(adds)S +2583(the)S +2764(functionality)S +3373(to)S +3506(programs)S +3967(which)S +4282(may)S +4518(use)S +4711(this)S +4918(feature)S +2472 V +900(only)S +1132(ocasionally.)S +1729(A)S +1844(maximum)S +2327(of)S +2453(8)S +2543(servers)S +2887(may)S +3111(be)S +3249(named,)S +3604(they)S +3828(may)S +4052(be)S +4190(either)S +4474(on)S +4619(the)S +4788(local)S +5036(host)S +2592 V +900(or)S +1024(a)S +1105(remote)S +1442(machine)S +1846(and)S +2037(connections)S +2594(can)S +2779(be)S +2916(established)S +3438(using)S +3711(either)S +3994(\256fos)S +4224(or)S +4349(sockets.)S +4767(See)S +4959(above)S +2712 V +900(or)S +1024(the)S +11 I +1191(vximtool)S +11 R +1602(man)S +1824(page)S +2063(for)S +2223(details)S +2543(on)S +2686(how)S +2908(to)S +3027(specify)S +3376(the)S +3543(server)S +3842(connection.)S +2868 V +900(The)S +1103(current)S +1445(implementation)S +2169(has)S +2348(a)S +2429(few)S +2625(restrictions)S +3146(users)S +3404(should)S +3731(keep)S +3970(in)S +4089(mind:)S +3024 V +11 Y1 +1150(d)S +11 R +1288(The)S +1498(time)S +1734(to)S +1860(display)S +2218(an)S +2361(image)S +2669(or)S +2801(perform)S +3194(any)S +3393(output)S +3716(operation)S +4171(scales)S +4473(with)S +4710(the)S +4885(number)S +3144 V +1150(of)S +1285(connected)S +1772(hosts.)S +2104(Each)S +2366(IIS)S +2544(packet)S +2873(is)S +2991(forwarded)S +3483(to)S +3612(each)S +3854(host)S +4081(in)S +4210(turn)S +4430(before)S +4751(processing)S +3264 V +1150(the)S +1317(next)S +1539(input)S +1799(packet,)S +2145(and)S +2336(connection)S +2850(over)S +3077(a)S +3158(slow)S +3399(network)S +3791(will)S +3996(delay)S +4266(the)S +4433(entire)S +4715(process.)S +3420 V +11 Y1 +1150(d)S +11 R +1298(Cursor)S +1647(and)S +1855(image)S +2173(readback)S +2616(are)S +2799(done)S +3063(by)S +3224(sending)S +3617(the)S +3802(request)S +11 I +4169(only)S +11 R +4409(to)S +4546(the)S +4731(\256rst)S +4954(server)S +3540 V +1150(named)S +1483(on)S +1634(the)S +1809(command)S +2283(line.)S +2550(This)S +2787(is)S +2902(done)S +3156(to)S +3283(avoid)S +3568(forcing)S +3925(a)S +4014(cursor)S +4327(mode)S +4611(on)S +4761(all)S +4911(servers)S +3660 V +1150(which)S +1455(cannot)S +1784(be)S +1924(terminated)S +2430(when)S +2705(a)S +2791(response)S +3212(is)S +3324(received)S +3731(from)S +3982(only)S +4216(one)S +4412(server,)S +4744(and)S +4940(means)S +3780 V +1150(that)S +1365(the)S +1549(\256rst)S +1771(server)S +2087(named)S +2429(should)S +2773(be)S +2926(the)S +3110(one)S +3318(used)S +3569(to)S +3705(control)S +4066(interactive)S +4578(sessions.)S +5050(The)S +3900 V +1150(remaining)S +1648(servers)S +2010(however)S +2439(can)S +2643(still)S +2863(respond)S +3263(to)S +3403(cursor)S +3730(requests)S +4143(from)S +4410(other)S +4689(applications)S +4020 V +1150(connected)S +1626(to)S +1745(that)S +1943(server)S +2242(on)S +2385(another)S +2746(channel.)S +4176 V +11 Y1 +1150(d)S +11 R +1282(All)S +1457(named)S +1783(servers)S +2126(must)S +2375(be)S +2513(running)S +2890(prior)S +3138(to)S +3259(starting)S +3624(the)S +3793(proxy)S +4084(server.)S +4413(The)S +4618(connection)S +5134(to)S +4296 V +1150(the)S +1321(remote)S +1661(servers)S +2006(is)S +2116(established)S +2640(when)S +2913(this)S +3109(task)S +3322(is)S +3432(\256rst)S +3640(run)S +3822(and)S +4016(if)S +4119(no)S +4265(server)S +4567(is)S +4677(running)S +5055(that)S +4416 V +1150(connection)S +1687(will)S +1915(be)S +2074(ignored.)S +2493(The)S +2719(task)S +2952(will)S +3180(exit)S +3401(if)S +3524(no)S +3690(remote)S +4050(servers)S +4415(can)S +4622(be)S +4781(found)S +5093(for)S +4536 V +1150(display.)S +4692 V +11 Y1 +1150(d)S +11 R +1295(Any)S +1531(connected)S +2021(server)S +2334(that)S +2546(shuts)S +2820(down)S +3111(while)S +3402(the)S +3583(proxy)S +3887(server)S +4201(is)S +4323(running)S +4713(is)S +4835(likely)S +5134(to)S +4812 V +1150(cause)S +1425(the)S +1592(program)S +1996(to)S +2115(crash)S +2378(on)S +2521(the)S +2688(next)S +2910(display.)S +7920 V +EP +%%Page: 21 24 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 21 -)S +840 V +11 B +900(11.)S +1104(C)S +1216(Interface)S +1673(Summary)S +996 V +11 R +1260(#include)S +1704(")S +11 B +1749(cdl.h)S +11 R +1980(")S +1296 V +1537(CDLPtr)S +11 B +1919(cdl_open)S +11 R +2507(\(imtdev\))S +1416 V +1504(int)S +11 B +1654(cdl_displayPix)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny,)S +3282(bitpix,)S +3601(frame,)S +3916(fbcon\256g,)S +4343(zscale\))S +1536 V +1378(char)S +11 B +1598(cdl_readCursor)S +11 R +2507(\(cdl,)S +2738(sample,)S +3110(x,)S +3226(y,)S +3342(wcs,)S +3573(key\))S +1656 V +1534(int)S +11 B +1684(cdl_setCursor)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(wcs\))S +1776 V +1618(int)S +11 B +1768(cdl_setWCS)S +11 R +2507(\(cdl,)S +2738(name,)S +3036(title,)S +3269(a,)S +3378(b,)S +3494(c,)S +3603(d,)S +3719(tx,)S +3866(ty,)S +4013(z1,)S +4177(z2,)S +4341(zt\))S +1896 V +1606(int)S +11 B +1756(cdl_getWCS)S +11 R +2507(\(cdl,)S +2738(name,)S +3036(title,)S +3269(a,)S +3378(b,)S +3494(c,)S +3603(d,)S +3719(tx,)S +3866(ty,)S +4013(z1,)S +4177(z2,)S +4341(zt\))S +2016 V +1481(void)S +11 B +1710(cdl_setFrame)S +11 R +2507(\(cdl,)S +2738(frame\))S +2136 V +1457(int)S +11 B +1607(cdl_clearFrame)S +11 R +2507(\(cdl\))S +2256 V +1692(void)S +11 B +1921(cdl_close)S +11 R +2507(\(cdl\))S +2496 V +1439(int)S +11 B +1589(cdl_setMapping)S +11 R +2507(\(cdl,)S +2738(region,)S +3079(sx,sy,snx,sny,)S +3726(dx,dy,dnx,dny,)S +4421(ref\))S +2616 V +1427(int)S +11 B +1577(cdl_getMapping)S +11 R +2507(\(cdl,)S +2738(region,)S +3079(sx,sy,snx,sny,)S +3726(dx,dy,dnx,dny,)S +4421(ref\))S +2736 V +1501(int)S +11 B +1651(cdl_queryMap)S +11 R +2507(\(cdl,)S +2738(wcs,)S +2969(region,)S +3310(sx,sy,snx,sny,)S +3957(dx,dy,dnx,dny,)S +4652(objref\))S +2976 V +1389(int)S +11 B +1539(cdl_displayIRAF)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(band,)S +3346(frame,)S +3661(fbcon\256g,)S +4088(zscale\))S +3096 V +1654(int)S +11 B +1804(cdl_isIRAF)S +11 R +2507(\(fname\))S +3216 V +1515(int)S +11 B +1665(cdl_readIRAF)S +11 R +2507(\(fname,)S +2877(band,)S +3151(pix,)S +3353(nx,)S +3524(ny,)S +3695(bitpix,)S +4014(title\))S +3456 V +1411(int)S +11 B +1561(cdl_displayFITS)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(frame,)S +3387(fbcon\256g,)S +3814(zscale\))S +3576 V +1676(int)S +11 B +1826(cdl_isFITS)S +11 R +2507(\(fname\))S +3696 V +1537(int)S +11 B +1687(cdl_readFITS)S +11 R +2507(\(fname,)S +2877(pix,)S +3079(nx,)S +3250(ny,)S +3421(bitpix,)S +3740(title\))S +3936 V +1216(void)S +11 B +1445(cdl_computeZscale)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny,)S +3282(bitpix,)S +3601(z1,)S +3765(z2\))S +4056 V +1352(void)S +11 B +1581(cdl_zscaleImage)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny,)S +3282(bitpix,)S +3601(z1,)S +3765(z2\))S +4296 V +1604(int)S +11 B +1754(cdl_printPix)S +11 R +2507(\(cdl,)S +2738(cmd,)S +2988(pix,)S +3190(nx,)S +3361(ny,)S +3532(annotate\))S +4416 V +1298(int)S +11 B +1448(cdl_printPixToFile)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(pix,)S +3274(nx,)S +3445(ny,)S +3616(annotate\))S +4656 V +1491(int)S +11 B +1641(cdl_readImage)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny\))S +4776 V +1175(int)S +11 B +1325(cdl_readFrameBu)S +2179 H + (f)show 11 -.5 mul h (f)show +11 B +2246(er)S +11 R +2507(\(cdl,)S +2738(pix,)S +2940(nx,)S +3111(ny\))S +4896 V +1288(int)S +11 B +1438(cdl_readSubRaster)S +11 R +2507(\(cdl,)S +2738(lx,)S +2885(ly,)S +3032(nx,)S +3203(ny,)S +3374(pix\))S +5016 V +1259(int)S +11 B +1409(cdl_writeSubRaster)S +11 R +2507(\(cdl,)S +2738(lx,)S +2885(ly,)S +3032(nx,)S +3203(ny,)S +3374(pix\))S +5256 V +1522(void)S +11 B +1751(cdl_selectFB)S +11 R +2507(\(cdl,)S +2738(nx,)S +2909(ny,)S +3080(fb,)S +3232(w,)S +3372(h,)S +3488(nf,)S +3640(reset\))S +5376 V +1336(void)S +11 B +1565(cdl_setFBCon\256g)S +11 R +2507(\(cdl,)S +2738(con\256gno\))S +5496 V +1324(void)S +11 B +1553(cdl_getFBCon\256g)S +11 R +2507(\(cdl,)S +2738(con\256gno,)S +3184(w,)S +3324(h,)S +3440(nf\))S +5616 V +1260(void)S +11 B +1489(cdl_lookupFBSize)S +11 R +2507(\(cdl,)S +2738(con\256gno,)S +3184(w,)S +3324(h,)S +3440(nf\))S +5856 V +1434(void)S +11 B +1663(cdl_setZTrans)S +11 R +2507(\(cdl,)S +2738(ztrans\))S +5976 V +1472(void)S +11 B +1701(cdl_setZScale)S +11 R +2507(\(cdl,)S +2738(z1,)S +2902(z2\))S +6096 V +1441(void)S +11 B +1670(cdl_setSample)S +11 R +2507(\(cdl,)S +2738(nsample\))S +6216 V +1183(void)S +11 B +1412(cdl_setSampleLines)S +11 R +2507(\(cdl,)S +2738(nlines\))S +6336 V +1376(void)S +11 B +1605(cdl_setContrast)S +11 R +2507(\(cdl,)S +2738(contrast\))S +6456 V +1517(void)S +11 B +1746(cdl_setName)S +11 R +2507(\(cdl,)S +2738(imname\))S +6576 V +1570(void)S +11 B +1799(cdl_setTitle)S +11 R +2507(\(cdl,)S +2738(imtitle\))S +6816 V +1469(void)S +11 B +1698(cdl_getFrame)S +11 R +2507(\(cdl,)S +2738(frame\))S +6936 V +1422(void)S +11 B +1651(cdl_getZTrans)S +11 R +2507(\(cdl,)S +2738(ztrans\))S +7056 V +1460(void)S +11 B +1689(cdl_getZScale)S +11 R +2507(\(cdl,)S +2738(z1,)S +2902(z2\))S +7176 V +1429(void)S +11 B +1658(cdl_getSample)S +11 R +2507(\(cdl,)S +2738(nsample\))S +7296 V +1171(void)S +11 B +1400(cdl_getSampleLines)S +11 R +2507(\(cdl,)S +2738(nlines\))S +7920 V +EP +%%Page: 22 25 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 22 -)S +840 V +1364(void)S +11 B +1593(cdl_getContrast)S +11 R +2507(\(cdl,)S +2738(contrast\))S +960 V +1505(void)S +11 B +1734(cdl_getName)S +11 R +2507(\(cdl,)S +2738(imname\))S +1080 V +1558(void)S +11 B +1787(cdl_getTitle)S +11 R +2507(\(cdl,)S +2738(imtitle\))S +1320 V +1479(int)S +11 B +1629(cdl_mapFrame)S +11 R +2507(\(cdl,)S +2738(frame\))S +1440 V +1221(int)S +11 B +1371(cdl_markCoordsFile)S +11 R +2507(\(cdl,)S +2738(fname,)S +3072(type,)S +3322(size,)S +3553(color,)S +3839(label\))S +1560 V +1489(int)S +11 B +1639(cdl_markPoint)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(number,)S +3366(size,)S +3597(type,)S +3847(color\))S +1680 V +1219(int)S +11 B +1369(cdl_markPointLabel)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(label,)S +3244(size,)S +3475(type,)S +3725(color\))S +1800 V +1525(int)S +11 B +1675(cdl_markLine)S +11 R +2507(\(cdl,)S +2738(xs,)S +2897(ys,)S +3056(xe,)S +3220(ye,)S +3384(color\))S +1920 V +1556(int)S +11 B +1706(cdl_markBox)S +11 R +2507(\(cdl,)S +2738(lx,)S +2885(ly,)S +3032(ux,)S +3203(uy,)S +3374(\256ll,)S +3559(color\))S +2040 V +1360(int)S +11 B +1510(cdl_markPolygon)S +11 R +2507(\(cdl,)S +2738(xarray,)S +3077(yarray,)S +3416(npts,)S +3661(\256ll,)S +3846(color\))S +2160 V +1360(int)S +11 B +1510(cdl_markPolyline)S +11 R +2507(\(cdl,)S +2738(xarray,)S +3077(yarray,)S +3416(npts,)S +3661(color\))S +2280 V +1455(int)S +11 B +1605(cdl_markCircle)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(radius,)S +3299(\256ll,)S +3484(color\))S +2400 V +1207(int)S +11 B +1357(cdl_markCircAnnuli)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(radius,)S +3299(nannuli,)S +3690(sep,)S +3897(color\))S +2520 V +1420(int)S +11 B +1570(cdl_markEllipse)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(xrad,)S +3225(yrad,)S +3480(rotang,)S +3821(\256ll,)S +4006(color\))S +2640 V +1184(int)S +11 B +1334(cdl_markEllipAnnuli)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(xrad,)S +3225(yrad,)S +3480(ang,)S +3699(nannuli,)S +4090(sep,)S +4297(color\))S +2760 V +1527(int)S +11 B +1677(cdl_markText)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y,)S +2970(str,)S +3141(size,)S +3372(angle,)S +3670(color\))S +2880 V +1649(int)S +11 B +1799(cdl_setFont)S +11 R +2507(\(cdl,)S +2738(font\))S +3000 V +1355(int)S +11 B +1505(cdl_setTextWidth)S +11 R +2507(\(cdl,)S +2738(width\))S +3120 V +1353(int)S +11 B +1503(cdl_setLineWidth)S +11 R +2507(\(cdl,)S +2738(width\))S +3240 V +1422(int)S +11 B +1572(cdl_setLineStyle)S +11 R +2507(\(cdl,)S +2738(style\))S +3360 V +1455(int)S +11 B +1605(cdl_deleteMark)S +11 R +2507(\(cdl,)S +2738(x,)S +2854(y\))S +3480 V +1355(int)S +11 B +1505(cdl_clearOverlay)S +11 R +2507(\(cdl\))S +3600 V +1245(int)S +11 B +1395(cdl_redrawOverlay)S +11 R +2507(\(cdl\))S +7920 V +EP +%%Page: 23 26 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 23 -)S +840 V +11 B +900(12.)S +1104(C)S +1216(Example)S +1665(Tasks)S +996 V +11 R +1175(The)S +1381(examples)S +1831(shown)S +2154(here)S +2377(are)S +2545(for)S +2708(demonstration)S +3374(purposes)S +3801(only.)S +4095(They)S +4357(are)S +4526(based)S +4812(on)S +4959(work-)S +1116 V +900(ing)S +1079(example)S +1488(tasks)S +1746(in)S +1870(the)S +2042(CDL)S +2300(source)S +11 I +2622(examples)S +11 R +3066(subdirectory,)S +3679(see)S +3855(the)S +4026(programs)S +4477(there)S +4732(for)S +4896(the)S +5067(full)S +1236 V +900(program)S +1304(listing.)S +1596 V +11 B +900(12.1.)S +1187(Display)S +1576(Example)S +1832 V +9 C +900(#include)S +1386()S +1932 V +900(#include)S +1386()S +2032 V +900(#include)S +1386("cdl.h")S +2232 V +900(/*)S +9 I +1116(DISPLAY)S +1493(--)S +1580(Example)S +1922(task)S +2094(to)S +2191(display)S +2478(an)S +2595(image)S +2842(as)S +2949(a)S +3021(command-line)S +3563(task.)S +2332 V +954(*)S +1053(This)S +1235(task)S +1407(is)S +1494(meant)S +1741(to)S +1838(show)S +2050(three)S +2262(ways)S +2469(the)S +2606(CDL)S +2808(can)S +2965(be)S +3077(used)S +3269(to)S +3366(display)S +2432 V +954(*)S +1053(an)S +1170(image,)S +1440(see)S +1582(the)S +1719(code)S +1916(comments)S +2303(for)S +2435(a)S +2507(description)S +2939(of)S +3036(each)S +3233(method.)S +2532 V +954(*)S +2632 V +954(*)S +1053(Examples:)S +2732 V +954(*)S +1161(To)S +1283(display)S +1570(a)S +1642(simple)S +1904(IRAF)S +2126(or)S +2233(FITS)S +2440(\256le:)S +2832 V +954(*)S +1283(%)S +1385(./display)S +1720(-frame)S +1987(2)S +2059(image.imh)S +2932 V +954(*)S +1242(%)S +1344(./display)S +1679(image.\256ts)S +3032 V +954(*)S +3132 V +954(*)S +1161(To)S +1283(display)S +1570(a)S +1642(FITS)S +1849(\256le)S +1986(as)S +2093(a)S +2165(raw)S +2332(image:)S +3232 V +954(*)S +1269(%)S +1371(./display)S +1706(-nx)S +1848(512)S +2010(-ny)S +2152(512)S +2314(-depth)S +2571(16)S +2688(-hskip)S +2935(5760)S +3142(-raw)S +3339(dpix.\256ts)S +3332 V +954(*)S +3432 V +954(*)S +1053(Usage:)S +3532 V +954(*)S +1175(display)S +1462([-depth)S +1754(N])S +1876([-\256ts])S +2108([-frame)S +2410(N])S +2532([-fbcon\256g)S +2914(N])S +3036([-hskip)S +3318(N])S +3632 V +954(*)S +1283([-iraf])S +1540([-nozscale])S +1977([-nx)S +2154(N])S +2276([-ny)S +2453(N])S +2575([-raw])S +2842([-zscale])S +3189(\256le)S +3732 V +9 C +954(*/)S +3932 V +900(#define)S +1332(NONE)S +1725(-1)S +4032 V +900(#define)S +1450(IRAF)S +1779(0)S +4132 V +900(#define)S +1450(FITS)S +1779(1)S +4232 V +900(#define)S +1450(RAW)S +1779(2)S +4432 V +900(main)S +1170(\(argc,)S +1548(argv\))S +4532 V +900(int)S +1175(argc;)S +4632 V +900(char)S +1175(*argv[];)S +4732 V +900({)S +4832 V +1175(CDLPtr)S +1725(cdl;)S +4932 V +1175(char)S +1450(*fname,)S +1882(title[128];)S +5032 V +1175(int)S +1450(i,)S +1612(status)S +1990(=)S +2098(0,)S +2260(frame)S +2584(=)S +2692(1,)S +2854(fbconfig)S +3340(=)S +3448(0,)S +3610(zscale)S +3988(=)S +4096(1;)S +5132 V +1175(int)S +1450(format)S +1828(=)S +1936(NONE,)S +2260(nx)S +2422(=)S +2530(0,)S +2692(ny)S +2854(=)S +2962(0,)S +3124(depth)S +3448(=)S +3556(8,)S +3718(hskip)S +4042(=)S +4150(0;)S +5232 V +1175(float)S +1725(z1,)S +1941(z2;)S +5332 V +1175(int)S +1450(fb_w,)S +1774(fb_h,)S +2098(nf;)S +5432 V +1175(unsigned)S +1661(char)S +1931(*pix)S +2201(=)S +2309(NULL;)S +5632 V +1175(/*)S +9 I +1337(Process)S +1649(the)S +1786(command)S +2163(line)S +2325(options.)S +9 C +2667(*/)S +5732 V +1175(if)S +1337(\(argc)S +1661(>)S +1769(1\))S +1931({)S +5832 V +1391(for)S +1607(\(i=1;)S +1931(i)S +2039(<)S +2147(argc;)S +2471(i++\))S +2741({)S +5932 V +1548(if)S +1710(\(strcmp)S +2142(\(argv[i],)S +2682("-depth"\))S +3222(==)S +3384(0\))S +3978(depth)S +4302(=)S +4410(atoi)S +4680(\(argv[++i]\);)S +6032 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-fits"\))S +3438(==)S +3600(0\))S +3978(format)S +4356(=)S +4464(FITS;)S +6132 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-frame"\))S +3492(==)S +3654(0\))S +3978(frame)S +4302(=)S +4410(atoi)S +4680(\(argv[++i]\);)S +6232 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-fbconfig"\))S +3654(==)S +3816(0\))S +3978(fbconfig)S +4464(=)S +4572(atoi)S +4842(\(argv[++i]\);)S +6332 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-hskip"\))S +3492(==)S +3654(0\))S +3978(hskip)S +4302(=)S +4410(atoi)S +4680(\(argv[++i]\);)S +6432 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-iraf"\))S +3438(==)S +3600(0\))S +3978(format)S +4356(=)S +4464(IRAF;)S +6532 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-nozscale"\))S +3654(==)S +3816(0\))S +3978(zscale)S +4356(=)S +4464(0;)S +6632 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-nx"\))S +3330(==)S +3492(0\))S +3978(nx)S +4140(=)S +4248(atoi)S +4518(\(argv[++i]\);)S +6732 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-ny"\))S +3330(==)S +3492(0\))S +3978(ny)S +4140(=)S +4248(atoi)S +4518(\(argv[++i]\);)S +6832 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-raw"\))S +3384(==)S +3546(0\))S +3978(format)S +4356(=)S +4464(RAW;)S +6932 V +1548(else)S +1818(if)S +1980(\(strcmp)S +2412(\(argv[i],)S +2952("-zscale"\))S +3546(==)S +3708(0\))S +3978(zscale)S +4356(=)S +4464(1;)S +7032 V +1391(})S +7132 V +1175(})S +7920 V +EP +%%Page: 24 27 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 24 -)S +820 V +9 C +1175(/*)S +9 I +1337(Open)S +1559(the)S +1696(package)S +2023(and)S +2185(a)S +2257(connection)S +2679(to)S +2776(the)S +2913(server.)S +9 C +3215(*/)S +920 V +1175(if)S +1337(\(!\(cdl)S +1715(=)S +9 B +1823(cdl_open)S +9 C +2222(\(\(char)S +2600(*\)getenv\("IMTDEV"\)\)\))S +3734(\))S +1020 V +1337(exit)S +1607(\(-1\);)S +1220 V +1175(fname)S +1499(=)S +1607(argv[argc-1];)S +1420 V +1175(/*)S +9 I +1337(METHOD)S +1739(1:)S +1868(Displays)S +2210(the)S +2347(image)S +2594(using)S +2816(the)S +2953(high-level)S +3340(format)S +3607(display)S +1520 V +1229(*)S +1301(call.)S +1513(Display)S +1820(as)S +1927(an)S +2044(IRAF)S +2266(image)S +2513(if)S +2590(the)S +2727(option)S +2984(was)S +3151(set)S +3278(indicating)S +1620 V +1229(*)S +1301(this)S +1458(is)S +1545(the)S +1682(format,)S +1972(otherwise)S +2349(test)S +2501(the)S +2638(\256le)S +2775(to)S +2872(see)S +3014(if)S +3091(it)S +3168(is)S +3255(anyway.)S +1720 V +9 C +1229(*/)S +1820 V +1175(if)S +1337(\(format)S +1769(==)S +1931(IRAF)S +2201(||)S +2363(\(format)S +2795(==)S +2957(NONE)S +3227(&&)S +9 B +3389(cdl_isIRAF)S +9 C +3883(\(fname\)\)\))S +4423({)S +1920 V +1391(status)S +1769(=)S +9 B +1877(cdl_displayIRAF)S +9 C +2586(\(cdl,)S +2910(fname,)S +3288(1,)S +3450(frame,)S +3828(FB_AUTO,)S +4314(zscale\);)S +2120 V +1175(/*)S +9 I +1337(METHOD)S +1739(2:)S +1868(Uses)S +2070(the)S +2207(CDL)S +2409(procedure)S +2806(for)S +2938(getting)S +3215(image)S +3462(pixels)S +3699(from)S +2220 V +1229(*)S +1301(a)S +1373(known)S +1635(format,)S +1925(minimal)S +2247(work)S +2454(required)S +2791(to)S +2888(display)S +3175(an)S +3292(image.)S +3589(The)S +2320 V +1229(*)S +1301(point)S +1513(here)S +1700(is)S +1787(that)S +1954(you)S +2111(can)S +2268(use)S +2415(this)S +2572(method)S +2864(to)S +2961(process)S +3263(the)S +3400(image)S +2420 V +1229(*)S +1301(yourself)S +1618(prior)S +1830(to)S +1927(display,)S +2237(e.g.)S +2395(subsample)S +2802(the)S +2939(pixels,)S +3199(apply)S +3426(a)S +3498(user)S +2520 V +1229(*)S +1301(LUT,)S +1516(etc)S +1648(but)S +1790(still)S +1952(use)S +2099(the)S +2236(CDL)S +2438(to)S +2535(get)S +2672(the)S +2809(raw)S +2976(image)S +3223(and)S +3385(do)S +3502(the)S +2620 V +1229(*)S +1301(display.)S +2720 V +9 C +1229(*/)S +2820 V +1175(})S +1283(else)S +1553(if)S +1715(\(format)S +2147(==)S +2309(FITS)S +2579(||)S +2741(\(format)S +3173(==)S +3335(NONE)S +3605(&&)S +9 B +3767(cdl_isFITS)S +9 C +4241(\(fname\)\)\))S +4781({)S +3020 V +1391(/*)S +9 I +1553(Get)S +1710(the)S +1847(FITS)S +2054(image)S +2301(pixels,)S +2561(exit)S +2718(w/)S +2830(an)S +2947(error)S +3164(status)S +3401(if)S +3478(something)S +3120 V +1445(*)S +1517(went)S +1714(wrong,)S +1994(the)S +2131(procedure)S +2528(will)S +2690(print)S +2892(what)S +3094(that)S +3261(was.)S +3220 V +9 C +1445(*/)S +3320 V +1391(if)S +1553(\()S +9 B +1607(cdl_readFITS)S +9 C +2196(\(fname,)S +2628(&pix,)S +2952(&nx,)S +3222(&ny,)S +3492(&depth,)S +3924(title\)\))S +4356({)S +3420 V +9 B +1450(cdl_close)S +9 C +1849(\(cdl\);)S +2550(/*)S +9 I +2712(close)S +2924(the)S +3061(package)S +9 C +3469(*/)S +3520 V +1450(exit)S +1720(\(1\);)S +2550(/*)S +9 I +2712(exit)S +2869(w/)S +2981(error)S +3198(code)S +9 C +3422(*/)S +3620 V +1391(})S +3820 V +1391(/*)S +9 I +1553(Now)S +1745(select)S +1977(a)S +2049(frame)S +2286(bu)S +2376 H + (f)show 9 -.5 mul h (f)show +9 I +2422(er)S +2524(large)S +2741(enough)S +3033(for)S +3165(the)S +3302(image.)S +3572(The)S +3920 V +1445(*)S +1517(fbcon\256g)S +1834(number)S +2136(is)S +2223(passed)S +2495(in)S +2592(the)S +2729(WCS)S +2936(packet,)S +3221(but)S +3363(the)S +3500(display)S +4020 V +1445(*)S +1517(call)S +1679(below)S +1921(will)S +2083(compute)S +2415(the)S +2552(correct)S +2839(WCS)S +3046(for)S +3178(the)S +3315(image)S +3562(and)S +4120 V +1445(*)S +1517(transmit)S +1844(that)S +2011(prior)S +2223(to)S +2320(display,)S +2630(all)S +2752(we're)S +2984(doing)S +3216(here)S +3403(is)S +4220 V +1445(*)S +1517(setting)S +1784(up)S +1901(the)S +2038(FB)S +2175(to)S +2272(be)S +2384(used.)S +4320 V +9 C +1445(*/)S +4420 V +1391(if)S +1553(\(fbconfig)S +2093(==)S +2255(0\))S +4520 V +9 B +1607(cdl_selectFB)S +9 C +2146(\(cdl,)S +2470(nx,)S +2686(ny,)S +2902(&fbconfig,)S +3496(&fb_w,)S +3874(&fb_h,)S +4252(&nf,)S +4522(0\);)S +4720 V +1391(/*)S +9 I +1553(Lastly,)S +1823(display)S +2110(the)S +2247(pixels)S +2484(to)S +2581(the)S +2718(requested)S +3095(frame,)S +3355(do)S +3472(any)S +4820 V +1445(*)S +1517(zscaling)S +1839(requested)S +2216(using)S +2438(the)S +2575(CDL)S +2777(procedure.)S +4920 V +9 C +1445(*/)S +5020 V +1391(status)S +1769(=)S +9 B +1877(cdl_displayPix)S +9 C +2491(\(cdl,)S +2815(pix,)S +3085(nx,)S +3301(ny,)S +3517(depth,)S +3895(frame,)S +5120 V +1450(fbconfig,)S +1990(zscale\);)S +5320 V +1175(/*)S +9 I +1337(METHOD)S +1739(3:)S +1868(Displays)S +2210(an)S +2327(image)S +2574(of)S +2671(raw)S +2838(pixels.)S +3125(The)S +3287(client)S +3514(code)S +3711(is)S +5420 V +1229(*)S +1301(responsible)S +1743(for)S +1875(reading)S +2182(the)S +2319(image)S +2566(and)S +2728(calling)S +3005(all)S +3127(the)S +3264(procedures)S +5520 V +1229(*)S +1301(needed)S +1583(for)S +1715(image)S +1962(display,)S +2272(initialize)S +2614(the)S +2751(frame,)S +3011(zscaling)S +3333(pix,)S +3493(etc.)S +5620 V +1229(*)S +1301(While)S +1538(we)S +1665(assume)S +1957(a)S +2029(simple)S +2291(raster)S +2533(format)S +2800(in)S +2897(this)S +3054(program,)S +3419(the)S +3556(user)S +5720 V +1229(*)S +1301(code)S +1498(can)S +1655(read)S +1847(a)S +1919(compressed)S +2371(image)S +2618(format)S +2885(such)S +3077(as)S +3184(GIF,)S +3384(mosaic)S +3666(multiple)S +5820 V +1229(*)S +1301(images)S +1583(for)S +1715(display)S +2002(as)S +2109(a)S +2181(single)S +2423(image,)S +2693(or)S +2800(just)S +2957(about)S +3189(anything)S +3531(that)S +5920 V +1229(*)S +1301(produces)S +1658(a)S +1730(raster)S +1972(for)S +2104(display.)S +2414(The)S +2576(intent)S +2808(here)S +2995(is)S +3082(to)S +3179(show)S +3391(all)S +3513(the)S +6020 V +1229(*)S +1301(lowest)S +1558(level)S +1755(calls)S +1952(needed)S +2234(for)S +2366(displaying)S +2768(the)S +2905(image.)S +6120 V +9 C +1229(*/)S +6220 V +1175(})S +1283(else)S +1553(if)S +1715(\(format)S +2147(==)S +2309(RAW\))S +2579({)S +6320 V +1391(FILE)S +1725(*fd;)S +6420 V +1391(int)S +2000(lx,)S +2216(ly;)S +6620 V +1391(if)S +1553(\(nx)S +1769(==)S +1931(0)S +2039(||)S +2201(ny)S +2363(==)S +2525(0\))S +2687({)S +6720 V +1607(fprintf)S +2039(\(stderr,)S +2525("No)S +2741(size)S +3011(given)S +3335(for)S +3551(raw)S +3767(data.\\n"\);)S +6820 V +1607(exit)S +1877(\(1\);)S +6920 V +1391(})S +7120 V +1391(/*)S +9 I +1553(Open)S +1775(the)S +1912(image)S +2159(\256le)S +2296(if)S +2373(we)S +2500(can.)S +9 C +2707(*/)S +7220 V +1391(if)S +1553(\(fd)S +1769(=)S +1877(fopen)S +2201(\(fname,)S +2633("r"\)\))S +2957({)S +7920 V +EP +%%Page: 25 28 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 25 -)S +820 V +9 C +1450(/*)S +9 I +1612(Seek)S +1804(to)S +1901(the)S +2038(o)S +2083 H + (f)show 9 -.5 mul h (f)show +9 I +2129(set)S +2256(speci\256ed.)S +9 C +2648(*/)S +920 V +1450(lseek)S +1774(\(fileno\(fd\),)S +2476(\(off_t\))S +2908(hskip,)S +3286(SEEK_SET\);)S +1120 V +1450(/*)S +9 I +1612(Allocate)S +1939(the)S +2076(pixel)S +2278(pointer)S +2565(and)S +2727(read)S +2919(the)S +3056(data.)S +9 C +3293(*/)S +1220 V +1450(pix)S +1666(=)S +1774(\(unsigned)S +2314(char)S +2584(*\))S +2746(malloc)S +3124(\(nx)S +3340(*)S +3448(ny)S +3610(*)S +3718(\(depth)S +4096(/)S +4204(8\)\);)S +1320 V +1450(fread)S +1774(\(pix,)S +2098(depth/8,)S +2584(nx)S +2746(*)S +2854(ny,)S +3070(fd\);)S +1520 V +1450(/*)S +9 I +1612(If)S +1694(we're)S +1926(zscaling)S +2248(and)S +2410(depth)S +2637(is)S +2724(more)S +2936(than)S +3123(8-bits,)S +3378(do)S +3495(that.)S +9 C +3712(*/)S +1620 V +1450(if)S +1612(\(zscale)S +2044(&&)S +2206(depth)S +2530(>)S +2638(8\))S +2800({)S +1720 V +9 B +1666(cdl_computeZscale)S +9 C +2455(\(cdl,)S +2779(pix,)S +3049(nx,)S +3265(ny,)S +3481(depth,)S +3859(&z1,)S +4129(&z2\);)S +1820 V +9 B +1666(cdl_zscaleImage)S +9 C +2345(\(cdl,)S +2669(&pix,)S +2993(nx,)S +3209(ny,)S +3425(depth,)S +3803(z1,)S +4019(z2\);)S +1920 V +1450(})S +2120 V +1450(/*)S +9 I +1612(Now)S +1804(select)S +2036(a)S +2108(frame)S +2345(bu)S +2435 H + (f)show 9 -.5 mul h (f)show +9 I +2481(er)S +2583(large)S +2800(enough)S +3092(for)S +3224(the)S +3361(image.)S +2220 V +1477(*)S +1549(We'll)S +1771(ask)S +1918(that)S +2085(this)S +2242(be)S +2354(reset)S +2556(but)S +2698(the)S +2835(change)S +3122(won't)S +3354(go)S +3471(to)S +2320 V +1477(*)S +1549(the)S +1686(server)S +1938(until)S +2130(we)S +2257(send)S +2449(in)S +2546(the)S +2683(WCS)S +2890(below.)S +2420 V +9 C +1504(*/)S +2520 V +9 B +1450(cdl_selectFB)S +9 C +1989(\(cdl,)S +2313(nx,)S +2529(ny,)S +2745(&fbconfig,)S +3339(&fb_w,)S +3717(&fb_h,)S +4095(&nf,)S +4365(1\);)S +2720 V +1450(/*)S +9 I +1612(Compute)S +1964(the)S +2101(image)S +2348(placement)S +2745(so)S +2852(it's)S +2994(centered)S +3331(in)S +3428(the)S +3565(frame,)S +2820 V +1477(*)S +1549(but)S +1691(note)S +1873(the)S +2010(cdl_writeSubRaster\(\))S +2807(routine)S +3094(can)S +3251(place)S +3473(an)S +2920 V +1477(*)S +1549(arbitrary)S +1906(raster)S +2148(anywhere)S +2525(in)S +2622(the)S +2759(frame)S +2996(bu)S +3086 H + (f)show 9 -.5 mul h (f)show +9 I +3132(er.)S +3020 V +9 C +1450(lx)S +1612(=)S +1720(\(fb_w)S +2044(/)S +2152(2\))S +2314(-)S +2422(\(nx)S +2638(/)S +2746(2\);)S +3120 V +1450(ly)S +1612(=)S +1720(fb_h)S +1990(-)S +2098(\(\(fb_h)S +2476(/)S +2584(2\))S +2746(+)S +2854(\(ny)S +3070(/)S +3178(2\)\);)S +3320 V +1450(/*)S +9 I +1612(Set)S +1749(the)S +1886(mapping)S +2228(we'll)S +2435(send)S +2627(with)S +2809(the)S +2946(WCS)S +3153(which)S +3395(must)S +3592(be)S +3420 V +1477(*)S +1549(called)S +1796(before)S +2053(the)S +2190(cdl_setWCS\(\))S +2712(call)S +2874(since)S +3086(the)S +3223(data)S +3410(is)S +3497(sent)S +3520 V +1477(*)S +1549(with)S +1731(the)S +1868(WCS)S +2075(and)S +2237(not)S +2379(as)S +2486(a)S +2558(separate)S +2895(call.)S +3620 V +9 C +1504(*)S +3720 V +1504(*)S +9 R +1612(First)S +1804(we)S +1936(must)S +2138(compose)S +2485(a)S +2552(node!path)S +2939(pre\256x)S +3176(for)S +3308(the)S +3445(image.)S +9 C +3742(*/)S +3820 V +1504(*/)S +3920 V +1450(gethostname)S +2098(\(node,)S +2476(512\);)S +4020 V +1450(\(void\))S +1828(getcwd)S +2206(\(path,)S +2584(512\);)S +4120 V +1450(if)S +1612(\(*fname)S +2044(==)S +2206('/'\))S +4220 V +1666(\(void\))S +2044(sprintf)S +2476(\(path_prefix,)S +3232("%s!%s",)S +3718(node,)S +4042(fname\);)S +4320 V +1450(else)S +4420 V +1666(\(void\))S +2044(sprintf)S +2476(\(path_prefix,)S +3232("%s!%s/%s",)S +3880(node,)S +4204(path,)S +4528(fname\);)S +4620 V +9 B +1450(cdl_setMapping)S +9 C +2119(\(cdl,)S +2443("image",)S +2929(0.,)S +3145(0.,)S +3361(nx,)S +3577(ny,)S +3793(lx,)S +4009(ly,)S +4225(nx,)S +4441(ny,)S +4720 V +1612(path_prefix\);)S +4920 V +1450(/*)S +9 I +1612(For)S +1774(the)S +1911(WCS)S +2118(we)S +2245(assume)S +2537(a)S +2609(simple)S +2871(linear)S +3113(transform)S +3495(where)S +3742(the)S +5020 V +1477(*)S +1549(image)S +1796(is)S +1883(Y-\257ipped,)S +2258(the)S +2395(\(x,y\))S +2585(translation)S +3007(is)S +3094(computed)S +3471(so)S +5120 V +1477(*)S +1549(it)S +1626(is)S +1713(correct)S +2000(for)S +2132(an)S +2249(frame)S +2486(bu)S +2576 H + (f)show 9 -.5 mul h (f)show +9 I +2622(er)S +2724(>=)S +2873(than)S +3060(the)S +3197(image)S +3444(size.)S +5220 V +9 C +1504(*/)S +5320 V +9 B +1450(cdl_setWCS)S +9 C +1974(\(cdl,)S +2298(fname,)S +2676("",)S +2892(1.,)S +3108(0.,)S +3324(0.,)S +3540(-1.,)S +5420 V +1666(\(float\))S +2098(\(nx)S +2314(/)S +2422(2\))S +2584(-)S +2692(\(fb_w)S +3016(/)S +3124(2\))S +3286(+)S +3394(1,)S +3826(/*)S +9 I +3988(X)S +4070(trans.)S +9 C +4494(*/)S +5520 V +1666(\(float\))S +2098(\(fb_h)S +2422(/)S +2530(2\))S +2692(+)S +2800(\(ny)S +3016(/)S +3124(2\),)S +3826(/*)S +9 I +3988(Y)S +4065(trans.)S +9 C +4489(*/)S +5620 V +1666(z1,)S +1882(z2,)S +2098(CDL_LINEAR\);)S +3826(/*)S +9 I +3988(Z)S +4065(transform)S +9 C +4474(*/)S +5820 V +1450(/*)S +9 I +1612(Finally,)S +1922(display)S +2209(the)S +2346(pixels.)S +9 C +2687(*/)S +5920 V +1450(if)S +1612(\()S +9 B +1666(cdl_writeSubRaster)S +9 R +2458(\(cdl,)S +2648(lx,)S +2768(ly,)S +2888(nx,)S +3028(ny,)S +3168(pix\)\))S +6020 V +1558(status)S +1790(=)S +1867(1;)S +6120 V +1283(})S +1353(else)S +6220 V +1450(status)S +1682(=)S +1759(1;)S +6320 V +1175(})S +1245(else)S +1412({)S +6420 V +1283(if)S +1365(\(access)S +1652(\(fname,)S +1957(F_OK\))S +2239(==)S +2366(0\))S +6520 V +1450(fprintf)S +1707(\(stderr,)S +1992("'%s':)S +2251(unknown)S +2613(image)S +2860(format.\\n",)S +3280(fname\);)S +6620 V +1283(else)S +6720 V +1450(fprintf)S +1707(\(stderr,)S +1992("'%s':)S +2251(image)S +2498(does)S +2690(not)S +2832(exist.\\n",)S +3182(fname\);)S +6820 V +1283(status)S +1515(=)S +1592(1;)S +6920 V +1175(})S +7120 V +1175(/*)S +9 I +1272(Now)S +1464(just)S +1621(free)S +1788(the)S +1925(pixel)S +2127(pointer)S +2414(to)S +2511(clean)S +2733(up.)S +9 R +2873(*/)S +7220 V +1175(if)S +1257(\(pix\))S +7920 V +EP +%%Page: 26 29 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +460 V +11 R +2936(- 26 -)S +820 V +9 R +1283(free)S +1450(\(\(unsigned)S +1862(char)S +2044(*\))S +2146(pix\);)S +920 V +9 B +1175(cdl_close)S +9 R +1547(\(cdl\);)S +2275(/*)S +9 I +2372(close)S +2584(the)S +2721(package)S +9 R +3048(*/)S +1020 V +1175(exit)S +1337(\(status\);)S +1120 V +900(})S +7920 V +EP +%%Page: 27 30 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +480 V +11 R +2936(- 27 -)S +840 V +11 B +900(12.2.)S +1187(Interactive)S +1730(Graphics)S +2198(Overlay)S +2609(Example)S +1076 V +9 C +900(#include)S +1386()S +1176 V +900(#include)S +1386()S +1276 V +900(#include)S +1386()S +1376 V +900(#include)S +1386("cdl.h")S +1576 V +900(/*)S +1676 V +9 I +954(*)S +1053(TVMARK)S +1430(--)S +1517(Example)S +1859(task)S +2031(for)S +2163(displaying)S +2565(an)S +2682(marking)S +3009(images.)S +3341(This)S +3523(program)S +1776 V +954(*)S +1053(can)S +1210(be)S +1322(used)S +1514(to)S +1611(either)S +1848(display)S +2135(an)S +2252(image)S +2499(and)S +2661(overlay)S +2958(points)S +3205(de\256ned)S +3492(in)S +1876 V +954(*)S +1053(a)S +1125(coordinate)S +1542(\256le,)S +1702(map)S +1884(an)S +2001(existing)S +2308(display)S +2595(frame)S +2832(for)S +2964(marking,)S +3314(or)S +3421(option-)S +1976 V +954(*)S +1053(ally)S +1215(enter)S +1427(a)S +1499(cursor)S +1761(command)S +2138(loop)S +2325(after)S +2522(either)S +2759(of)S +2856(these)S +3068(providing)S +3445(other)S +2076 V +954(*)S +1053(marking)S +1380(capability.)S +1817(All)S +1949(options)S +2241(support)S +2543(minimum)S +2905(match.)S +2176 V +954(*)S +2276 V +954(*)S +1053(Examples:)S +2376 V +954(*)S +1175(%)S +1277(tvmark)S +1554(dpix.\256ts)S +2476 V +954(*)S +1175(%)S +1277(tvmark)S +1554(-coords)S +1856(coords)S +2128(-color)S +2375(205)S +2537(dpix.\256ts)S +2576 V +954(*)S +1175(%)S +1277(tvmark)S +1554(-frame)S +1821(2)S +2676 V +954(*)S +1175(%)S +1277(tvmark)S +1554(-coords)S +1856(coords)S +2128(-interactive)S +2570(dpix.\256ts)S +2776 V +954(*)S +2876 V +954(*)S +1053(Usage:)S +2976 V +954(*)S +1175(tvmark)S +1452([-frame)S +1754(N])S +1876([-fbcon\256g)S +2258(N])S +2380([-coords)S +2717(<\256le>])S +3011([-size)S +3238(N])S +3360([-color)S +3642(N])S +3076 V +954(*)S +1310([-nolabel])S +1707([-\256ll])S +1929([-interactive])S +2441([image])S +3176 V +9 C +954(*/)S +3376 V +900(main)S +1170(\(argc,)S +1548(argv\))S +3476 V +900(int)S +1175(argc;)S +3576 V +900(char)S +1175(*argv[];)S +3676 V +900({)S +3776 V +1175(CDLPtr)S +1725(cdl;)S +3876 V +1175(char)S +1450(*fname)S +1828(=)S +1936(NULL,)S +2260(*cfname)S +2692(=)S +2800(NULL;)S +3976 V +1175(int)S +1450(i,)S +1612(status)S +1990(=)S +2098(0,)S +2260(fill)S +2530(=)S +2638(0,)S +2800(frame)S +3124(=)S +3232(1,)S +3394(fb)S +3556(=)S +3664(FB_AUTO,)S +4150(zscale)S +4528(=)S +4636(1;)S +4076 V +1175(int)S +1450(color)S +1774(=)S +1882(201,)S +2152(label)S +2476(=)S +2584(1,)S +2746(size)S +3016(=)S +3124(9,)S +3286(interactive)S +3934(=)S +4042(0;)S +4176 V +1175(float)S +1725(z1,)S +1941(z2;)S +4276 V +1175(int)S +1450(fb_w,)S +1774(fb_h,)S +2098(nf;)S +4376 V +1175(unsigned)S +1661(char)S +1931(*pix)S +2201(=)S +2309(NULL;)S +4576 V +1175(/*)S +9 I +1337(Process)S +1649(the)S +1786(command)S +2163(line)S +2325(options.)S +9 C +2667(*/)S +4676 V +1175(if)S +1337(\(argc)S +1661(>)S +1769(1\))S +1931({)S +4776 V +1391(for)S +1607(\(i=1;)S +1931(i)S +2039(<)S +2147(argc;)S +2471(i++\))S +2741({)S +4876 V +1548(if)S +1710(\(strncmp\(argv[i],)S +2682("-color",4\))S +3330(==)S +3492(0\))S +3654(color)S +3978(=)S +4086(atoi)S +4356(\(argv[++i]\);)S +4976 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-coords",4\))S +3654(==)S +3816(0\))S +3978(cfname)S +4356(=)S +4464(argv[++i];)S +5076 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-fbconfig",3\))S +3762(==)S +3924(0\))S +4086(fb)S +4248(=)S +4356(atoi)S +4626(\(argv[++i]\);)S +5176 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-fill",4\))S +3546(==)S +3708(0\))S +3870(fill)S +4140(=)S +4248(1;)S +5276 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-frame",3\))S +3600(==)S +3762(0\))S +3924(frame)S +4248(=)S +4356(atoi)S +4626(\(argv[++i]\);)S +5376 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-interactive",4\))S +3924(==)S +4086(0\))S +4248(interactive)S +4896(=)S +5004(1;)S +5476 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-nolabel",4\))S +3708(==)S +3870(0\))S +4032(label)S +4356(=)S +4464(0;)S +5576 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-nozscale",4\))S +3762(==)S +3924(0\))S +4086(zscale)S +4464(=)S +4572(0;)S +5676 V +1548(else)S +1818(if)S +1980(\(strncmp\(argv[i],)S +2952("-size",2\))S +3546(==)S +3708(0\))S +3870(size)S +4140(=)S +4248(atoi)S +4518(\(argv[++i]\);)S +5776 V +1391(else)S +5876 V +1607(fname)S +1931(=)S +2039(argv[i];)S +5976 V +1391(})S +6076 V +1175(})S +6276 V +1175(/*)S +9 I +1337(Open)S +1559(the)S +1696(package)S +2023(and)S +2185(a)S +2257(connection)S +2679(to)S +2776(the)S +2913(server.)S +9 C +3215(*/)S +6376 V +1175(if)S +1337(\(!\(cdl)S +1715(=)S +9 B +1823(cdl_open)S +9 C +2222(\(\(char)S +2600(*\)getenv\("IMTDEV"\)\)\))S +3734(\))S +6476 V +1337(exit)S +1607(\(-1\);)S +6676 V +1175(/*)S +9 I +1337(If)S +1419(an)S +1536(image)S +1783(was)S +1950(speci\256ed)S +2292(display)S +2579(it)S +2656(\256rst,)S +2846(otherwise)S +3223(assume)S +3515(the)S +6776 V +1229(*)S +1301(image)S +1548(has)S +1700(already)S +2002(been)S +2199(loaded)S +2471(in)S +2568(the)S +2705(frame)S +2942(and)S +3104(mark)S +3316(that.)S +6876 V +9 C +1229(*/)S +6976 V +1175(if)S +1337(\(fname\))S +1769({)S +7076 V +1391(if)S +1553(\()S +9 B +1607(cdl_isIRAF)S +9 C +2101(\(fname\)\))S +7176 V +1607(status)S +1985(=)S +9 B +2093(cdl_displayIRAF)S +9 C +2802(\(cdl,)S +3126(fname,)S +3504(1,)S +3666(frame,)S +4044(fb,)S +4260(zscale\);)S +7276 V +1391(else)S +1661(if)S +1823(\()S +9 B +1877(cdl_isFITS)S +9 C +2351(\(fname\)\))S +7920 V +EP +%%Page: 28 31 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 28 -)S +820 V +9 C +1607(status)S +1985(=)S +9 B +2093(cdl_displayFITS)S +9 C +2782(\(cdl,)S +3106(fname,)S +3484(frame,)S +3862(fb,)S +4078(zscale\);)S +920 V +1391(else)S +1661({)S +1020 V +1450(if)S +1612(\(access)S +2044(\(cfname,)S +2530(F_OK\))S +2854(==)S +3016(0\))S +1120 V +1823(fprintf)S +2255(\(stderr,)S +2741("'%s':)S +3119(unknown)S +3551(image)S +3875(format.\\n",)S +4523(fname\);)S +1220 V +1450(else)S +1320 V +1823(fprintf)S +2255(\(stderr,)S +2741("'%s':)S +3119(image)S +3443(doesn't)S +3875(exist.\\n",)S +4469(fname\);)S +1420 V +1607(status)S +1985(=)S +2093(1;)S +1520 V +1391(})S +1620 V +1391(if)S +1553(\(status\))S +2093(goto)S +2363(err_;)S +1720 V +1175(})S +1283(else)S +1553({)S +1920 V +1391(/*)S +9 I +1553(If)S +1635(we've)S +1872(requested)S +2249(a)S +2321(special)S +2603(frame)S +2840(bu)S +2930 H + (f)show 9 -.5 mul h (f)show +9 I +2976(er,)S +3101(set)S +3228(it)S +3305(now.)S +9 C +3532(*/)S +2020 V +1391(if)S +1553(\(fb)S +1769(>)S +1877(0\))S +2120 V +9 B +1558(cdl_setFBCon\256g)S +9 C +2247(\(cdl,)S +2571(fb\);)S +2320 V +1391(/*)S +9 I +1553(Map)S +1745(the)S +1882(current)S +2174(display)S +2461(frame)S +2698(for)S +2830(use)S +2977(as)S +3084(an)S +3201(image.)S +9 C +3498(*/)S +2420 V +9 B +1391(cdl_mapFrame)S +9 C +2030(\(cdl,)S +2354(frame\);)S +2520 V +1175(})S +2720 V +1175(/*)S +9 I +1337(If)S +1419(a)S +1491(coordinate)S +1908(\256le)S +2045(was)S +2212(speci\256ed)S +2554(read)S +2746(the)S +2883(\256le)S +3020(and)S +3182(mark)S +3394(those)S +2820 V +1229(*)S +1301(coords)S +1573(with)S +1755(points.)S +2920 V +9 C +1229(*/)S +3020 V +1175(if)S +1337(\(cfname\))S +3120 V +9 B +1548(cdl_markCoordsFile)S +9 C +2397(\(cdl,)S +2721(cfname,)S +3153(M_STAR,)S +3585(size,)S +3909(color,)S +4287(label\);)S +3320 V +1175(/*)S +9 I +1337(Lastly,)S +1607(start)S +1799(up)S +1916(an)S +2033(interactive)S +2445(cursor)S +2707(loop)S +2894(if)S +2971(needed.)S +9 C +3303(*/)S +3420 V +1175(if)S +1337(\(interactive\))S +3520 V +1391(tvmInteractive)S +2201(\(cdl,)S +2525(label,)S +2903(fill,)S +3227(color,)S +3605(size\);)S +3720 V +1175(/*)S +9 I +1337(Close)S +1569(the)S +1706(package)S +2033(and)S +2195(clean)S +2417(up.)S +9 C +2584(*/)S +3820 V +900(err_:)S +9 B +1175(cdl_close)S +9 C +1574(\(cdl\);)S +3920 V +1175(exit)S +1445(\(status\);)S +4020 V +900(})S +4220 V +900(/*)S +9 I +1116(TVMINTERACTIVE)S +1878(--)S +1965(Process)S +2277(commands)S +2689(interactively.)S +9 C +3270(*/)S +4420 V +900(tvmInteractive)S +1710(\(cdl,)S +2034(label,)S +2412(fill,)S +2736(color,)S +3114(size\))S +4520 V +900(CDLPtr)S +1450(cdl;)S +4620 V +900(int)S +1175(label,)S +1553(fill,)S +1877(color,)S +2255(size;)S +4720 V +900({)S +4820 V +1175(float)S +1607(angle)S +1931(=)S +2039(0.0,)S +2309(rx,)S +2525(ry,)S +2741(txsize)S +3119(=)S +3227(1.;)S +4920 V +1175(int)S +1607(nx,)S +1823(ny,)S +2039(i,)S +2201(x,)S +2363(y,)S +2525(x2,)S +2741(y2,)S +2957(wcs;)S +5020 V +1175(int)S +1607(number=1,)S +2147(radius=11,)S +2741(xrad=11,)S +3227(yrad=6,)S +3659(nannuli=3,)S +4253(sep=5;)S +5120 V +1175(char)S +1607(key,)S +1877(cmd[SZ_NAME],)S +2633(str[SZ_NAME];)S +5220 V +1175(unsigned)S +1661(char)S +1931(*pix;)S +5420 V +1175(/*)S +9 I +1337(Process)S +1649(commands)S +2061(until)S +2253(a)S +2325('q')S +2457(keystroke)S +2824(is)S +2911(hit.)S +9 C +3083(*/)S +5520 V +1175(while)S +1499(\()S +9 B +1553(cdl_readCursor)S +9 C +2217(\(cdl,)S +2541(0,)S +2703(&rx,)S +2973(&ry,)S +3243(&wcs,)S +3567(&key\))S +3891(!=)S +4053('q'\))S +4323({)S +5620 V +1391(x)S +1499(=)S +1607(\(int\))S +1931(\(rx)S +2147(+)S +2255(0.5\);)S +2550(/*)S +9 I +2712(convert)S +3009(to)S +3106(int)S +3228(pixels)S +9 C +3492(*/)S +5720 V +1391(y)S +1499(=)S +1607(\(int\))S +1931(\(ry)S +2147(+)S +2255(0.5\);)S +5920 V +1391(switch)S +1769(\(key\))S +2093({)S +6020 V +1391(case)S +1661(':':)S +2550(/*)S +9 I +2712(process)S +3014(a)S +3086(colon)S +3313(command)S +9 C +3717(*/)S +6120 V +1450(putchar)S +1882(\(':'\);)S +6220 V +1450(gets)S +1720(\(str\);)S +6320 V +1450(for)S +1666(\(i=0;)S +1990(str[i])S +2368(!=)S +2530(')S +2638(')S +2746(&&)S +2908(str[i];)S +3340(i++\))S +6420 V +1666(cmd[i])S +2044(=)S +2152(str[i];)S +6520 V +1450(cmd[i++])S +1936(=)S +2044(')S +2152(';)S +6720 V +1450(if)S +1612(\(strcmp)S +2044(\(cmd,)S +2368("angle"\))S +2854(==)S +3016(0\))S +3556(angle)S +3880(=)S +3988(atof)S +4258(\(&str[i]\);)S +6820 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("color"\))S +3124(==)S +3286(0\))S +3556(color)S +3880(=)S +3988(atoi)S +4258(\(&str[i]\);)S +6920 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("fill"\))S +3070(==)S +3232(0\))S +3556(fill)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +7020 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("number"\))S +3178(==)S +3340(0\))S +3556(number)S +3934(=)S +4042(atoi)S +4312(\(&str[i]\);)S +7120 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("nannuli"\))S +3232(==)S +3394(0\))S +3556(nannuli)S +3988(=)S +4096(atoi)S +4366(\(&str[i]\);)S +7220 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("label"\))S +3124(==)S +3286(0\))S +3556(label)S +3880(=)S +3988(atoi)S +4258(\(&str[i]\);)S +7920 V +EP +%%Page: 29 32 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 29 -)S +820 V +9 C +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("sep"\))S +3016(==)S +3178(0\))S +3556(sep)S +3772(=)S +3880(atoi)S +4150(\(&str[i]\);)S +920 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("size"\))S +3070(==)S +3232(0\))S +3556(size)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +1020 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("txsize"\))S +3178(==)S +3340(0\))S +3556(txsize)S +3934(=)S +4042(atof)S +4312(\(&str[i]\);)S +1120 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("xrad"\))S +3070(==)S +3232(0\))S +3556(xrad)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +1220 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("yrad"\))S +3070(==)S +3232(0\))S +3556(yrad)S +3826(=)S +3934(atoi)S +4204(\(&str[i]\);)S +1320 V +1450(else)S +1720(if)S +1882(\(strcmp)S +2314(\(cmd,)S +2638("print"\))S +3124(==)S +3286(0\))S +3448({)S +1420 V +9 B +1666(cdl_readFrameBu)S +2366 H + (f)show 9 -.5 mul h (f)show +9 B +2421(er)S +9 C +2555(\(cdl,)S +2879(&pix,)S +3203(&nx,)S +3473(&ny\);)S +1520 V +9 B +1666(cdl_printPix)S +9 C +2200(\(cdl,)S +2524(NULL,)S +2848(pix,)S +3118(nx,)S +3334(ny,)S +3550(1\);)S +1620 V +1450(})S +1558(else)S +1828(if)S +1990(\(strcmp)S +2422(\(cmd,)S +2746("snap"\))S +3178(==)S +3340(0\))S +3502({)S +1720 V +9 B +1666(cdl_readFrameBu)S +2366 H + (f)show 9 -.5 mul h (f)show +9 B +2421(er)S +9 C +2555(\(cdl,)S +2879(&pix,)S +3203(&nx,)S +3473(&ny\);)S +1820 V +9 B +1666(cdl_printPixToFile)S +9 C +2450(\(cdl,)S +2774(&str[i],)S +3260(pix,)S +3530(nx,)S +3746(ny,)S +3962(1\);)S +1920 V +1450(})S +1558(else)S +1828(if)S +1990(\(strcmp)S +2422(\(cmd,)S +2746("status"\))S +3286(==)S +3448(0\))S +3610({)S +2020 V +1666(printf)S +2044(\("angle)S +2550(=)S +2658(%-5.3gcolor)S +3375(=)S +3483(%d",)S +3753(angle,)S +4131(color\);)S +2120 V +1666(printf)S +2044(\("fill)S +2550(=)S +2658(%-5dnumber)S +3375(=)S +3483(%d\\n",)S +3861(fill,)S +4185(number\);)S +2220 V +1666(printf)S +2044(\("nannuli)S +2550(=)S +2658(%-5dsep)S +3100(=)S +3208(%d",)S +3478(nannuli,)S +3964(sep\);)S +2320 V +1666(printf)S +2044(\("size)S +2550(=)S +2658(%-5dtxsize)S +3375(=)S +3483(%g\\n",)S +3861(size,)S +4185(txsize\);)S +2420 V +1666(printf)S +2044(\("xrad)S +2550(=)S +2658(%-5dyrad)S +3100(=)S +3208(%d",)S +3478(xrad,)S +3802(yrad\);)S +2520 V +1666(printf)S +2044(\("label)S +2550(=)S +2658(%-5d\\n",)S +3144(label\);)S +2620 V +1450(})S +2720 V +1450(break;)S +2920 V +1391(case)S +1661('?':)S +3020 V +1450(/*)S +1612(......)S +9 I +1936(help)S +2118(procedures)S +9 C +2577(*/)S +3120 V +1450(break;)S +3320 V +1391(case)S +1661('p':)S +2825(/*)S +9 I +2987(plus)S +3164(mark)S +9 C +3375(*/)S +3420 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_PLUS,)S +4779(color\);)S +3520 V +1450(break;)S +3620 V +1391(case)S +1661('x':)S +2825(/*)S +9 I +2987(cross)S +3204(mark)S +9 C +3650(*/)S +3720 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_CROSS,)S +4833(color\);)S +3820 V +1450(break;)S +3920 V +1391(case)S +1661('.':)S +2825(/*)S +9 I +2987(point)S +3199(mark)S +9 C +3650(*/)S +4020 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_POINT,)S +4833(color\);)S +4120 V +1450(break;)S +4220 V +1391(case)S +1661('*':)S +2825(/*)S +9 I +2987(star)S +3154(mark)S +9 C +3375(*/)S +4320 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_STAR,)S +4779(color\);)S +4420 V +1450(break;)S +4520 V +1391(case)S +1661('_':)S +2825(/*)S +9 I +2987(horiz)S +3199(dash)S +3396(mark)S +9 C +3581(*/)S +4620 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_HBLINE,)S +4887(color\);)S +4720 V +1450(break;)S +4820 V +1391(case)S +1661('|':)S +2825(/*)S +9 I +2987(vert)S +3154(dash)S +3351(mark)S +9 C +3650(*/)S +4920 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_VBLINE,)S +4887(color\);)S +5020 V +1450(break;)S +5120 V +1391(case)S +1661('o':)S +2825(/*)S +9 I +2987(circle)S +3219(mark)S +9 C +3650(*/)S +5220 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_CIRCLE|fill,)S +5157(color\);)S +5320 V +1450(break;)S +5420 V +1391(case)S +1661('s':)S +2825(/*)S +9 I +2987(square)S +3259(mark)S +9 C +3650(*/)S +5520 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_BOX|fill,)S +4995(color\);)S +5620 V +1450(break;)S +5720 V +1391(case)S +1661('v':)S +2825(/*)S +9 I +2987(diamond)S +3329(mark)S +9 C +3650(*/)S +5820 V +9 B +1450(cdl_markPoint)S +9 C +2079(\(cdl,)S +2403(x,)S +2565(y,)S +2727(\(label)S +3105(?)S +3213(number++)S +3699(:)S +3807(0\),)S +4023(size,)S +4347(M_DIAMOND|fill,)S +5211(color\);)S +5920 V +1450(break;)S +6120 V +1391(case)S +1661('b':)S +2825(/*)S +9 I +2987(Box)S +9 C +3650(*/)S +6220 V +1450(printf)S +1828(\("Hit)S +2152(another)S +2584(key)S +2800(to)S +2962(define)S +3340(the)S +3556(box...\\n"\);)S +6320 V +1450(\(void\))S +9 B +1828(cdl_readCursor)S +9 C +2492(\(cdl,)S +2816(0,)S +2978(&rx,)S +3248(&ry,)S +3518(&wcs,)S +3842(&key\);)S +6420 V +1450(x2)S +1612(=)S +1720(\(int\))S +2044(\(rx)S +2260(+)S +2368(0.5\);)S +3100(y2)S +3262(=)S +3370(\(int\))S +3694(\(ry)S +3910(+)S +4018(0.5\);)S +6520 V +9 B +1450(cdl_markBox)S +9 C +2024(\(cdl,)S +2348(x,)S +2510(y,)S +2672(x2,)S +2888(y2,)S +3104(fill,)S +3428(color\);)S +6620 V +1450(break;)S +6720 V +1391(case)S +1661('c':)S +2825(/*)S +9 I +2987(Circle)S +9 C +3650(*/)S +6820 V +1450(printf)S +1828(\("Hit)S +2152(another)S +2584(key)S +2800(to)S +2962(set)S +3178(radius)S +3556(...\\n"\);)S +6920 V +1450(\(void\))S +9 B +1828(cdl_readCursor)S +9 C +2492(\(cdl,)S +2816(0,)S +2978(&rx,)S +3248(&ry,)S +3518(&wcs,)S +3842(&key\);)S +7020 V +1450(x2)S +1612(=)S +1720(\(int\))S +2044(\(rx)S +2260(+)S +2368(0.5\);)S +3100(y2)S +3262(=)S +3370(\(int\))S +3694(\(ry)S +3910(+)S +4018(0.5\);)S +7120 V +1450(radius)S +1828(=)S +1936(\(int\))S +2260(sqrt)S +2530(\(\(double\))S +3070(\(\(x2-x\)*\(x2-x\))S +3880(+)S +3988(\(y2-y\)*\(y2-y\)\)\);)S +7220 V +9 B +1450(cdl_markCircle)S +9 C +2109(\(cdl,)S +2433(x,)S +2595(y,)S +2757(radius,)S +3189(fill,)S +3513(color\);)S +7920 V +EP +%%Page: 30 33 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 30 -)S +820 V +9 C +1450(break;)S +920 V +1391(case)S +1661('d':)S +2825(/*)S +9 I +2987(Delete)S +3249(marker)S +9 C +3650(*/)S +1020 V +9 B +1450(cdl_deleteMark)S +9 C +2109(\(cdl,)S +2433(x,)S +2595(y\);)S +1120 V +1450(break;)S +1220 V +1391(case)S +1661('e':)S +2825(/*)S +9 I +2987(Ellipse)S +9 C +3375(*/)S +1320 V +9 B +1450(cdl_markEllipse)S +9 C +2134(\(cdl,)S +2458(x,)S +2620(y,)S +2782(xrad,)S +3106(yrad,)S +3430(angle,)S +3808(fill,)S +4132(color\);)S +1420 V +1450(break;)S +1520 V +1391(case)S +1661('l':)S +2825(/*)S +9 I +2987(Line)S +9 C +3650(*/)S +1620 V +1450(printf)S +1828(\("Hit)S +2152(another)S +2584(key)S +2800(to)S +2962(set)S +3178(line)S +3448(endpoint...\\n"\);)S +1720 V +1450(\(void\))S +9 B +1828(cdl_readCursor)S +9 C +2492(\(cdl,)S +2816(0,)S +2978(&rx,)S +3248(&ry,)S +3518(&wcs,)S +3842(&key\);)S +1820 V +1450(x2)S +1612(=)S +1720(\(int\))S +2044(\(rx)S +2260(+)S +2368(0.5\);)S +3100(y2)S +3262(=)S +3370(\(int\))S +3694(\(ry)S +3910(+)S +4018(0.5\);)S +1920 V +9 B +1450(cdl_markLine)S +9 C +2049(\(cdl,)S +2373(x,)S +2535(y,)S +2697(x2,)S +2913(y2,)S +3129(color\);)S +2020 V +1450(break;)S +2120 V +1391(case)S +1661('t':)S +2825(/*)S +9 I +2987(Text)S +3169(string)S +9 C +3650(*/)S +2220 V +1450(printf)S +1828(\("Text)S +2206(string:)S +2638("\);)S +2320 V +1450(gets)S +1720(\(str\);)S +2420 V +9 B +1450(cdl_markText)S +9 C +2049(\(cdl,)S +2373(x,)S +2535(y,)S +2697(str,)S +2967(txsize,)S +3399(angle,)S +3777(color\);)S +2520 V +1450(break;)S +2620 V +1391(case)S +1661('C':)S +2825(/*)S +9 I +2987(Circular)S +3324(annuli)S +9 C +3554(*/)S +2720 V +9 B +1450(cdl_markCircAnnuli)S +9 C +2309(\(cdl,)S +2633(x,)S +2795(y,)S +2957(radius,)S +3389(nannuli,)S +3875(sep,)S +4145(color\);)S +2820 V +1450(break;)S +2920 V +1391(case)S +1661('D':)S +2825(/*)S +9 I +2987(Delete)S +3249(all)S +3371(markers)S +9 C +3666(*/)S +3020 V +9 B +1450(cdl_clearOverlay)S +9 C +2164(\(cdl\);)S +3120 V +1450(break;)S +3220 V +1391(case)S +1661('E':)S +2825(/*)S +9 I +2987(Elliptical)S +3349(annuli)S +9 C +3579(*/)S +3320 V +9 B +1450(cdl_markEllipAnnuli)S +9 C +2324(\(cdl,)S +2648(x,)S +2810(y,)S +2972(xrad,)S +3296(yrad,)S +3620(angle,)S +3998(nannuli,)S +4484(sep,)S +4754(color\);)S +3420 V +1450(break;)S +3520 V +1391(default:)S +3620 V +1450(break;)S +3720 V +1391(})S +3820 V +1175(})S +3920 V +900(})S +7920 V +EP +%%Page: 31 34 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +480 V +11 R +2936(- 31 -)S +840 V +11 B +900(12.3.)S +1187(Image)S +1512(Mosaic)S +1880(Example)S +976 V +9 R +1260(#include)S +1597()S +1076 V +1260(#include)S +1597()S +1176 V +1260(#)S +9 B +1305(include)S +1612("cdl.h")S +1376 V +9 R +1260(/*)S +9 I +1357(MOSAIC)S +1714(--)S +1801(Example)S +2143(task)S +2315(to)S +2412(mosaic)S +2694(several)S +2981(images)S +3263(on)S +3380(a)S +3452(display.)S +3762(Demonstrates)S +1476 V +1287(*)S +1359(usage)S +1596(of)S +1693(low-level)S +2050(routines)S +2372(for)S +2504(complex)S +2831(display)S +3118(operations.)S +1576 V +9 R +1287(*/)S +1776 V +1260(main)S +1467(\(argc,)S +1702(argv\))S +1876 V +1260(int)S +1535(argc;)S +1976 V +1260(char)S +1535(*argv[];)S +2076 V +1260({)S +2176 V +1535(CDLPtr)S +2085(cdl;)S +2276 V +1535(char)S +1810(*fname)S +2107(=)S +2184(NULL,)S +2474(title[128];)S +2376 V +1535(int)S +1810(i,)S +1885(j,)S +1960(k,)S +2055(status=0,)S +2405(label=0,)S +2725(frame=1,)S +3080(fb=FB_AUTO,)S +3660(zscale=1;)S +2476 V +1535(int)S +1810(sample=1,)S +2210(pad=0,)S +2485(col=204,)S +2830(imx,)S +3020(imy,)S +3210(bitpix,)S +3470(nimages,)S +3820(nim;)S +2576 V +1535(int)S +1810(ii,)S +1910(xinit,)S +2125(rowx,)S +2360(rowy,)S +2595(nnx,)S +2780(nny,)S +2965(fb_w,)S +3200(fb_h,)S +3415(nf,)S +3540(mx,)S +3705(my,)S +3870(nx,)S +4010(ny;)S +2676 V +1535(\257oat)S +1810(z1,)S +1945(z2;)S +2776 V +1535(unsigned)S +1887(char)S +2069(*pix)S +2256(=)S +2333(NULL;)S +2976 V +1535(/*)S +9 I +1632(Process)S +1944(the)S +2081(command)S +2458(line)S +2620(options.)S +9 R +2935(*/)S +3076 V +1535(if)S +1617(\(argc)S +1829(>)S +1906(1\))S +2008({)S +3176 V +1589(for)S +1721(\(i=1;)S +1923(i)S +1975(<)S +2052(argc;)S +2259(i++\))S +2441({)S +3276 V +1584(if)S +1666(\(strncmp)S +2013(\(argv[i],)S +2338("-fbcon\256g",3\))S +2867(==)S +2994(0\))S +3096(fb=atoi\(argv[++i]\);)S +3376 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-frame",3\))S +2976(==)S +3103(0\))S +3205(frame=atoi\(argv[++i]\);)S +3476 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-color",3\))S +2951(==)S +3078(0\))S +3180(col=atoi\(argv[++i]\);)S +3576 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-label",4\))S +2941(==)S +3068(0\))S +3170(label=1;)S +3676 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-nozscale",4\))S +3076(==)S +3203(0\))S +3305(zscale=0;)S +3776 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-nx",3\))S +2856(==)S +2983(0\))S +3085(nx=atoi\(argv[++i]\);)S +3876 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-ny",3\))S +2856(==)S +2983(0\))S +3085(ny=atoi\(argv[++i]\);)S +3976 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-pad",4\))S +2896(==)S +3023(0\))S +3125(pad=atoi\(argv[++i]\);)S +4076 V +1643(else)S +1810(if)S +1892(\(strncmp)S +2239(\(argv[i],"-sample",4\))S +3021(==)S +3148(0\))S +3250(sample=atoi\(argv[++i]\);)S +4176 V +1643(else)S +4276 V +1751(break;)S +4376 V +1589(})S +4476 V +1535(})S +4576 V +1535(nimages)S +1862(=)S +1939(argc)S +2121(-)S +2178(i;)S +4776 V +1535(/*)S +9 I +1632(Open)S +1854(the)S +1991(package)S +2318(and)S +2480(a)S +2552(connection)S +2974(to)S +3071(the)S +3208(server.)S +9 R +3483(*/)S +4876 V +1535(if)S +1617(\(!\(cdl)S +1844(=)S +9 B +1921(cdl_open)S +9 R +2293(\(\(char)S +2535(*\)getenv\("IMTDEV"\)\)\))S +3421(\))S +4976 V +1616(exit)S +1778(\(-1\);)S +5176 V +1535(/*)S +9 I +1632(Clear)S +1864(the)S +2001(frame)S +2238(to)S +2335(begin.)S +9 R +2585(*/)S +5276 V +1535(\(void\))S +9 B +1782(cdl_clearFrame)S +9 R +2414(\(cdl\);)S +5476 V +1535(/*)S +9 I +1632(Loop)S +1844(over)S +2031(each)S +2228(of)S +2325(the)S +2462(images)S +2744(in)S +2841(the)S +2978(list.)S +9 R +3138(*/)S +5576 V +1535(nim)S +1702(=)S +1779(rowx)S +1991(=)S +2068(rowy)S +2280(=)S +2357(nnx)S +2519(=)S +2596(nny)S +2758(=)S +2835(0;)S +5676 V +1535(for)S +1667(\(k=0;)S +1889(k)S +1961(<)S +2038(ny)S +2155(&&)S +2322(nim)S +2489(<)S +2566(nimages;)S +2918(k++\))S +3120({)S +5776 V +1643(rowy)S +1855(+=)S +1982(nny)S +2144(+)S +2221(pad;)S +5876 V +1643(for)S +1775(\(rowx)S +2017(=)S +2094(xinit,)S +2309(j=0;)S +2481(j)S +2533(<)S +2610(nx)S +2727(&&)S +2894(nim)S +3061(<)S +3138(nimages;)S +3490(j++\))S +3672({)S +6076 V +1810(/*)S +9 I +1907(Get)S +2064(the)S +2201(image)S +2448(name)S +2670(for)S +2802(display.)S +9 R +3112(*/)S +6176 V +1810(fname)S +2062(=)S +2139(argv[i++];)S +6376 V +1810(/*)S +9 I +1907(Figure)S +2179(out)S +2321(what)S +2523(kind)S +2705(of)S +2802(image)S +3049(it)S +3126(is)S +3213(and)S +3375(get)S +3512(the)S +3649(pixels.)S +9 R +3909(*/)S +6476 V +1810(if)S +1892(\(cdl_isIRAF)S +2369(\(fname\)\))S +6576 V +1918(status)S +2150(=)S +9 B +2227(cdl_readIRAF)S +9 R +2809(\(fname,)S +3114(1,)S +3209(&pix,)S +3444(&imx,)S +3704(&imy,)S +3964(&bitpix,)S +4294(title\);)S +6676 V +1810(else)S +1977(if)S +2059(\(cdl_isFITS)S +2516(\(fname\)\))S +6776 V +1918(status)S +2150(=)S +9 B +2227(cdl_readFITS)S +9 R +2789(\(fname,)S +3094(&pix,)S +3329(&imx,)S +3589(&imy,)S +3849(&bitpix,)S +4179(title\);)S +6876 V +1810(else)S +1977({)S +6976 V +1918(fprintf\(stderr,)S +2433("'%s':)S +2692(unknown)S +3054(or)S +3156(nonexistant)S +3598(image.\\n",)S +3998(fname\);)S +7076 V +1918(status)S +2150(=)S +2227(1;)S +7176 V +1810(})S +7276 V +1810(if)S +1892(\(status\))S +2211(goto)S +2398(err_;)S +7920 V +EP +%%Page: 32 35 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +460 V +11 R +2936(- 32 -)S +820 V +9 R +1810(/*)S +9 I +1907(Compute)S +2259(subsampled)S +2711(image)S +2958(size.)S +9 R +3143(*/)S +920 V +1810(if)S +1892(\(sample)S +2204(>)S +2281(1\))S +1020 V +1918(nnx)S +2080(=)S +2157(imx)S +2324(/)S +2376(sample,)S +2681(nny)S +2843(=)S +2920(imy)S +3087(/)S +3139(sample;)S +1120 V +1810(else)S +1220 V +1918(nnx)S +2080(=)S +2157(imx,)S +2347(nny)S +2509(=)S +2586(imy;)S +1420 V +1810(/*)S +9 I +1907(Unless)S +2179(we)S +2306(asked)S +2538(for)S +2670(a)S +2742(speci\256c)S +3039(FB)S +3176(size)S +3338(\256nd)S +3500(one)S +3657(large)S +3874(enough)S +1520 V +1837(*)S +1909(to)S +2006(handle)S +2278(the)S +2415(mosaic.)S +2747(We)S +2889(don't)S +3106(check)S +3338(to)S +3435(be)S +3547(sure)S +3729(what's)S +1620 V +1837(*)S +1909(returned)S +2246(is)S +2333(really)S +2570(large)S +2787(enough.)S +1720 V +9 R +1837(*/)S +1820 V +1810(if)S +1892(\(nim)S +2089(==)S +2216(0)S +2288(&&)S +2455(fb)S +2557(==)S +2684(FB_AUTO\))S +1920 V +9 B +1918(cdl_selectFB)S +9 R +2430(\(cdl,)S +2620(nx*nnx+\(pad*\(nx-1\)\),)S +3450(ny*nny+\(pad*\(ny-1\)\),)S +4280(&fb,)S +4475(&fb_w,)S +4780(&fb_h,)S +5065(&nf,)S +5260(1\);)S +2020 V +1810(else)S +1977({)S +2120 V +9 B +1918(cdl_setFBCon\256g)S +9 R +2580(\(cdl,)S +2770(fb\);)S +2220 V +9 B +1918(cdl_lookupFBSize)S +9 R +2640(\(cdl,)S +2830(fb,)S +2955(&fb_w,)S +3260(&fb_h,)S +3545(&nf\);)S +2320 V +1810(})S +2520 V +1810(/*)S +9 I +1907(De\256ne)S +2169(a)S +2241(WCS)S +2448(for)S +2580(the)S +2717(frame.)S +9 R +2977(*/)S +2620 V +9 B +1810(cdl_setWCS)S +9 R +2307(\(cdl,)S +2497("image)S +2781(mosaic",)S +3123(title,)S +3313(1.,)S +3431(0.,)S +3549(0.,)S +3667(-1.,)S +3815(0.,)S +3933(\(\257oat\))S +4180(ny*imy+\(pad*\(ny+1\)\),)S +5035(1.,)S +5153(255.,)S +5361(1\);)S +2820 V +1810(/*)S +9 I +1907(The)S +2069(\256rst)S +2236(time)S +2418(through)S +2730(\256gure)S +2967(out)S +3109(the)S +3246(placement)S +3643(so)S +3750(the)S +2920 V +1837(*)S +1909(entire)S +2146(mosaic)S +2428(is)S +2515(centered)S +2852(in)S +2949(the)S +3086(frame.)S +3020 V +9 R +1837(*/)S +3120 V +1810(if)S +1919(\(nim)S +2116(==)S +2243(0\))S +2345({)S +3220 V +1918(mx)S +2060(=)S +2137(\(nx)S +2284(*)S +2356(nnx\))S +2548(+)S +2625(pad)S +2782(*)S +2854(\(nx-1\);)S +3320 V +1918(my)S +2060(=)S +2137(\(ny)S +2284(*)S +2356(nny\))S +2548(+)S +2625(pad)S +2782(*)S +2854(\(ny-1\);)S +3420 V +1918(rowy)S +2130(=)S +2207(\(fb_h)S +2429(-)S +2486(my\))S +2658(/)S +2710(2;)S +3520 V +1918(xinit)S +2110(=)S +2187(rowx)S +2399(=)S +2476(\(fb_w)S +2718(-)S +2775(mx\))S +2947(/)S +2999(2;)S +3620 V +1810(})S +3820 V +1810(/*)S +9 I +1907(Compute)S +2259(the)S +2396(zscaled)S +2688(imaged)S +2980(pixels.)S +9 R +3240(*/)S +3920 V +1810(if)S +1892(\(zscale\))S +2199({)S +4020 V +9 B +1918(cdl_computeZscale)S +9 R +2680(\(cdl,)S +2870(pix,)S +3035(imx)S +3202(,imy,)S +3415(bitpix,)S +3675(&z1,)S +3880(&z2\);)S +4120 V +9 B +1918(cdl_zscaleImage)S +9 R +2570(\(cdl,)S +2760(&pix,)S +2995(imx)S +3162(,imy,)S +3375(bitpix,)S +3635(z1,)S +3770(z2\);)S +4220 V +1810(})S +4420 V +1810(/*)S +9 I +1907(Subsample)S +2324(the)S +2461(image)S +2708(if)S +2785(requested.)S +9 R +3185(*/)S +4520 V +1810(if)S +1892(\(sample)S +2204(>)S +2281(1\))S +2383({)S +4620 V +1918(int)S +2040(l,)S +2115(m,)S +2235(n=0;)S +4720 V +1918(for)S +2050(\(l=0;)S +2252(l)S +2304(<)S +2381(imy;)S +2573(l+=sample\))S +4820 V +2026(for)S +2158(\(m=0;)S +2405(m)S +2502(<)S +2579(imx;)S +2771(m+=sample\))S +4920 V +2134(pix[n++])S +2481(=)S +2558(pix[\(l*imx\)+m];)S +5020 V +1810(})S +5220 V +1810(/*)S +9 I +1907(Write)S +2134(the)S +2271(image)S +2518(to)S +2615(the)S +2752(frame)S +2989(bu)S +3079 H + (f)show 9 -.5 mul h (f)show +9 I +3125(er.)S +9 R +3250(*/)S +5320 V +1810(if)S +1892(\()S +9 B +1922(cdl_writeSubRaster)S +9 R +2714(\(cdl,)S +2904(rowx,)S +3139(rowy,)S +3374(nnx,)S +3559(nny,)S +3744(pix\)\))S +3946(goto)S +4133(err_;)S +5520 V +1810(/*)S +9 I +1907(Draw)S +2139(the)S +2276(image)S +2523(name)S +2745(as)S +2852(a)S +2924(label.)S +9 R +3154(*/)S +5620 V +1810(if)S +1892(\(label\))S +9 B +2154(cdl_markText)S +9 R +2726(\(cdl,)S +2916(rowx+10,)S +3291(rowy+10,)S +3666(fname,)S +3941(1.,)S +4059(0.,)S +4177(col\);)S +5820 V +1810(nim++;)S +2360(rowx)S +2572(+=)S +2699(nnx)S +2861(+)S +2938(pad;)S +5920 V +1643(})S +6020 V +1535(})S +6220 V +1535(/*)S +9 I +1632(Close)S +1864(the)S +2001(package)S +2328(and)S +2490(clean)S +2712(up.)S +9 R +2852(*/)S +6320 V +1260(err_:)S +9 B +1535(cdl_close)S +9 R +1907(\(cdl\);)S +6420 V +1535(exit)S +1697(\(status\);)S +6520 V +1260(})S +7920 V +EP +%%Page: 33 36 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +480 V +11 R +2936(- 33 -)S +840 V +11 B +900(13.)S +1104(Fortran)S +1541(Interface)S +1998(Summary)S +996 V +11 R +1260(include)S +1649(")S +11 B +1694(cdlftn.inc)S +11 R +2138(")S +1296 V +11 B +1910(cfopen)S +11 R +2386(\(imtdev,)S +2789(ier\))S +1416 V +11 B +1645(cfdisplayPix)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(bitpix,)S +3285(frame,)S +3600(fbcon\256g,)S +4027(zscale,)S +4354(ier\))S +1536 V +11 B +1589(cfreadCursor)S +11 R +2386(\(sample,)S +2794(x,)S +2910(y,)S +3026(key,)S +3245(ier\))S +1656 V +11 B +1675(cfsetCursor)S +11 R +2386(\(x,)S +2538(y,)S +2654(wcs,)S +2885(ier\))S +1776 V +11 B +1759(cfsetWCS)S +11 R +2386(\(name,)S +2720(title,)S +2953(a,)S +3062(b,)S +3178(c,)S +3287(d,)S +3403(tx,)S +3550(ty,)S +3697(z1,)S +3861(z2,)S +4025(zt,)S +4165(ier\))S +1896 V +11 B +1747(cfgetWCS)S +11 R +2386(\(name,)S +2720(title,)S +2953(a,)S +3062(b,)S +3178(c,)S +3287(d,)S +3403(tx,)S +3550(ty,)S +3697(z1,)S +3861(z2,)S +4025(zt,)S +4165(ier\))S +2016 V +11 B +1701(cfsetFrame)S +11 R +2386(\(frame\))S +2136 V +11 B +1598(cfclearFrame)S +11 R +2386(\(ier\))S +2256 V +11 B +1912(cfclose)S +11 R +2386(\(\))S +2496 V +11 B +1580(cfsetMapping)S +11 R +2386(\(region,)S +2763(sx,sy,snx,sny,)S +3410(dx,dy,dnx,dny,)S +4105(ref,)S +4286(ier\))S +2616 V +11 B +1568(cfgetMapping)S +11 R +2386(\(region,)S +2763(sx,sy,snx,sny,)S +3410(dx,dy,dnx,dny,)S +4105(ref,)S +4286(ier\))S +2736 V +11 B +1642(cfqueryMap)S +11 R +2386(\(wcs,)S +2653(region,)S +2994(sx,sy,snx,sny,)S +3641(dx,dy,dnx,dny,)S +4336(objref,)S +4658(ier\))S +2976 V +11 B +1530(cfdisplayIRAF)S +11 R +2386(\(fname,)S +2756(band,)S +3030(frame,)S +3345(fbcon\256g,)S +3772(zscale,)S +4099(ier\))S +3096 V +11 B +1800(c\256sIRAF)S +11 R +2386(\(fname,)S +2756(isiraf\))S +3216 V +11 B +1656(cfreadIRAF)S +11 R +2386(\(fname,)S +2756(band,)S +3030(pix,)S +3232(nx,)S +3403(ny,)S +3574(bitpix,)S +3893(title,)S +4126(ier\))S +3456 V +11 B +1552(cfdisplayFITS)S +11 R +2386(\(fname,)S +2756(frame,)S +3071(fbcon\256g,)S +3498(zscale,)S +3825(ier\))S +3576 V +11 B +1822(c\256sFITS)S +11 R +2386(\(fname,)S +2756(is\256ts\))S +3696 V +11 B +1678(cfreadFITS)S +11 R +2386(\(fname,)S +2756(pix,)S +2958(nx,)S +3129(ny,)S +3300(bitpix,)S +3619(title,)S +3852(ier\))S +3936 V +11 B +1436(cfcomputeZscale)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(bitpix,)S +3285(z1,)S +3449(z2\))S +4056 V +11 B +1572(cfzscaleImage)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(bitpix,)S +3285(z1,)S +3449(z2\))S +4296 V +11 B +1745(cfprintPix)S +11 R +2386(\(cmd,)S +2672(pix,)S +2874(nx,)S +3045(ny,)S +3216(annotate,)S +3648(ier\))S +4416 V +11 B +1439(cfprintPixToFile)S +11 R +2386(\(fname,)S +2756(pix,)S +2958(nx,)S +3129(ny,)S +3300(annotate,)S +3732(ier\))S +4656 V +11 B +1632(cfreadImage)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(ier\))S +4776 V +11 B +1316(cfreadFrameBu)S +2058 H + (f)show 11 -.5 mul h (f)show +11 B +2125(er)S +11 R +2386(\(pix,)S +2624(nx,)S +2795(ny,)S +2966(ier\))S +4896 V +11 B +1429(cfreadSubRaster)S +11 R +2386(\(lx,)S +2569(ly,)S +2716(nx,)S +2887(ny,)S +3058(pix,)S +3260(ier\))S +5016 V +11 B +1400(cfwriteSubRaster)S +11 R +2386(\(lx,)S +2569(ly,)S +2716(nx,)S +2887(ny,)S +3058(pix,)S +3260(ier\))S +5256 V +11 B +1742(cfselectFB)S +11 R +2386(\(nx,)S +2593(ny,)S +2764(fb,)S +2916(w,)S +3056(h,)S +3172(nf,)S +3324(reset\))S +5376 V +11 B +1556(cfsetFBCon\256g)S +11 R +2386(\(con\256gno\))S +5496 V +11 B +1544(cfgetFBCon\256g)S +11 R +2386(\(con\256gno,)S +2868(w,)S +3008(h,)S +3124(nf\))S +5616 V +11 B +1485(c\257ookupFBSize)S +11 R +2386(\(con\256gno,)S +2868(w,)S +3008(h,)S +3124(nf\))S +5856 V +11 B +1654(cfsetZTrans)S +11 R +2386(\(ztrans\))S +5976 V +11 B +1692(cfsetZScale)S +11 R +2386(\(z1,)S +2586(z2\))S +6096 V +11 B +1661(cfsetSample)S +11 R +2386(\(nsample\))S +6216 V +11 B +1403(cfsetSampleLines)S +11 R +2386(\(nlines\))S +6336 V +11 B +1596(cfsetContrast)S +11 R +2386(\(contrast\))S +6456 V +11 B +1737(cfsetName)S +11 R +2386(\(imname\))S +6576 V +11 B +1790(cfsetTitle)S +11 R +2386(\(imtitle\))S +6816 V +11 B +1689(cfgetFrame)S +11 R +2386(\(frame\))S +6936 V +11 B +1642(cfgetZTrans)S +11 R +2386(\(ztrans\))S +7056 V +11 B +1680(cfgetZScale)S +11 R +2386(\(z1,)S +2586(z2\))S +7176 V +11 B +1649(cfgetSample)S +11 R +2386(\(nsample\))S +7296 V +11 B +1391(cfgetSampleLines)S +11 R +2386(\(nlines\))S +7920 V +EP +%%Page: 34 37 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 34 -)S +840 V +11 B +1584(cfgetContrast)S +11 R +2386(\(contrast\))S +960 V +11 B +1725(cfgetName)S +11 R +2386(\(imname\))S +1080 V +11 B +1778(cfgetTitle)S +11 R +2386(\(imtitle\))S +1320 V +11 B +1620(cfmapFrame)S +11 R +2386(\(frame,)S +2737(ier\))S +1440 V +11 B +1630(cfmarkPoint)S +11 R +2386(\(x,)S +2538(y,)S +2654(number,)S +3050(size,)S +3281(type,)S +3531(color,)S +3817(ier\))S +1560 V +11 B +1429(cfmarkcoords\256le)S +11 R +2386(\(fname,)S +2756(type,)S +3006(size,)S +3237(color,)S +3523(label,)S +3797(ier\))S +1680 V +11 B +1360(cfmarkPointLabel)S +11 R +2386(\(x,)S +2538(y,)S +2654(label,)S +2928(size,)S +3159(type,)S +3409(color,)S +3695(ier\))S +1800 V +11 B +1666(cfmarkLine)S +11 R +2386(\(xs,)S +2581(ys,)S +2740(xe,)S +2904(ye,)S +3068(color,)S +3354(ier\))S +1920 V +11 B +1697(cfmarkBox)S +11 R +2386(\(lx,)S +2569(ly,)S +2716(ux,)S +2887(uy,)S +3058(\256ll,)S +3243(color,)S +3529(ier\))S +2040 V +11 B +1501(cfmarkPolygon)S +11 R +2386(\(xarray,)S +2761(yarray,)S +3100(npts,)S +3345(\256ll,)S +3530(color,)S +3816(ier\))S +2160 V +11 B +1501(cfmarkPolyline)S +11 R +2386(\(xarray,)S +2761(yarray,)S +3100(npts,)S +3345(color,)S +3631(ier\))S +2280 V +11 B +1596(cfmarkCircle)S +11 R +2386(\(x,)S +2538(y,)S +2654(radius,)S +2983(\256ll,)S +3168(color,)S +3454(ier\))S +2400 V +11 B +1348(cfmarkCircAnnuli)S +11 R +2386(\(x,)S +2538(y,)S +2654(radius,)S +2983(nannuli,)S +3374(sep,)S +3581(color,)S +3867(ier\))S +2520 V +11 B +1561(cfmarkEllipse)S +11 R +2386(\(x,)S +2538(y,)S +2654(xrad,)S +2909(yrad,)S +3164(rotang,)S +3505(\256ll,)S +3690(color,)S +3976(ier\))S +2640 V +11 B +1325(cfmarkEllipAnnuli)S +11 R +2386(\(x,)S +2538(y,)S +2654(xrad,)S +2909(yrad,)S +3164(ang,)S +3383(nannuli,)S +3774(sep,)S +3981(color,)S +4267(ier\))S +2760 V +11 B +1668(cfmarkText)S +11 R +2386(\(x,)S +2538(y,)S +2654(str,)S +2825(size,)S +3056(angle,)S +3354(color,)S +3640(ier\))S +2880 V +11 B +1821(cfsetfont)S +3000 V +1565(cfsettextwidth)S +11 R +2386(\(width\))S +3120 V +11 B +1709(cfsetlwidth)S +11 R +2386(\(width\))S +3240 V +11 B +1766(cfsetlstyle)S +11 R +2386(\(style\))S +3360 V +11 B +1596(cfdeleteMark)S +11 R +2386(\(x,)S +2538(y,)S +2654(ier\))S +3480 V +11 B +1529(cfclearOverlay)S +11 R +2386(\(ier\))S +3600 V +11 B +1419(cfredrawOverlay)S +11 R +2386(\(ier\))S +7920 V +EP +%%Page: 35 38 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 35 -)S +840 V +11 B +900(14.)S +1104(Fortran)S +1508(Example)S +1957(Tasks)S +996 V +11 R +1175(The)S +1381(examples)S +1831(shown)S +2154(here)S +2377(are)S +2545(for)S +2708(demonstration)S +3374(purposes)S +3801(only.)S +4095(They)S +4357(are)S +4526(based)S +4812(on)S +4959(work-)S +1116 V +900(ing)S +1079(example)S +1488(tasks)S +1746(in)S +1870(the)S +2042(CDL)S +2300(source)S +11 I +2622(examples)S +11 R +3066(subdirectory,)S +3679(see)S +3855(the)S +4026(programs)S +4477(there)S +4732(for)S +4896(the)S +5067(full)S +1236 V +900(program)S +1304(listing.)S +1596 V +11 B +900(14.1.)S +1187(Display)S +1576(Example)S +1796 V +9 C +1260(C)S +1368(========================================================================)S +1896 V +1260(C)S +1422(FDISPLAY)S +1908(--)S +2070(Example)S +2502(fortran)S +2934(program)S +3366(showing)S +3798(the)S +4014(use)S +4230(of)S +4392(the)S +4608(Client)S +1996 V +1260(C)S +1422(Display)S +1854(Library)S +2286(\(CDL\))S +2610(Fortran)S +3042(interface)S +3582(for)S +3798(displaying)S +4392(images.)S +2096 V +1260(C)S +1368(========================================================================)S +2296 V +1535(PROGRAM)S +1967(FDISPLAY)S +2396 V +1535(character*64)S +2345(imname)S +2596 V +1260(C)S +9 I +1535(Initialize)S +1882(the)S +2019(CDL)S +2221(package)S +2696 V +9 C +1535(call)S +9 B +1805(cfopen)S +9 C +2114(\(0,)S +2330(ier\))S +2796 V +1535(if)S +1697(\(ier)S +1967(.gt.)S +2237(0\))S +2399(then)S +2896 V +1751(write)S +2075(\(*,*\))S +2399('open:)S +2777(Error)S +3101(return)S +3479(from)S +3749(CDL')S +2996 V +1751(goto)S +2021(999)S +3096 V +1535(endif)S +3296 V +1535(write)S +1859(\(*,)S +2075("\('Image)S +2561(Name:)S +2885(',)S +3047($\)"\))S +3396 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(imname)S +3496 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(Number:)S +2993(',)S +3155($\)"\))S +3596 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(iframe)S +3696 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(buffer)S +2939(configuration)S +3695(number:)S +4127(',)S +4289($\)"\))S +3796 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(ifb)S +3996 V +1260(C)S +9 I +1535(If)S +1617(we've)S +1854(got)S +1996(a)S +2068(FITS)S +2275(format)S +2542(image,)S +2812(go)S +2929(ahead)S +3176(and)S +3338(display)S +3625(it.)S +4096 V +9 C +1535(call)S +9 B +1805(c\256sFITS)S +9 C +2184(\(imname,)S +2670(isfits\))S +4196 V +1535(if)S +1697(\(isfits)S +2129(.gt.)S +2399(0\))S +2561(then)S +4296 V +1751(call)S +9 B +2021(cfdisplayFITS)S +9 C +2620(\(imname,)S +3106(iframe,)S +3538(ifb,)S +3808(1,)S +3970(ier\))S +4396 V +1535(else)S +4496 V +1260(C)S +9 I +1751(We've)S +2003(got)S +2145(an)S +2262(IRAF)S +2484(format)S +2751(image,)S +3021(go)S +3138(ahead)S +3385(and)S +3547(display)S +3834(it.)S +4596 V +9 C +1751(call)S +9 B +2021(c\256sIRAF)S +9 C +2420(\(imname,)S +2906(isiraf\))S +4696 V +1751(if)S +1913(\(isiraf)S +2345(.gt.)S +2615(0\))S +2777(then)S +4796 V +1967(call)S +9 B +2237(cfdisplayIRAF)S +9 C +2856(\(imname,)S +3342(1,)S +3504(iframe,)S +3936(ifb,)S +4206(1,)S +4368(ier\))S +4896 V +1751(else)S +4996 V +1260(C)S +9 I +1810(Unrecognized)S +2342(image,)S +2612(punt)S +2799(and)S +2961(exit.)S +5096 V +9 C +1967(write)S +2291(\(*,*\))S +2615('Unrecognized)S +3371(image)S +3695(format')S +5196 V +1751(endif)S +5296 V +1535(endif)S +5496 V +1260(C)S +9 I +1535(Clean)S +1777(up)S +1894(and)S +2056(exit.)S +5596 V +9 C +1260(999)S +1535(continue)S +5696 V +1535(call)S +9 B +1805(cfclose)S +9 C +2114(\(ier\))S +5796 V +1535(end)S +7920 V +EP +%%Page: 36 39 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +480 V +11 R +2936(- 36 -)S +840 V +11 B +900(14.2.)S +1187(Interactive)S +1730(Graphics)S +2198(Overlay)S +2609(Example)S +1040 V +9 C +1260(C)S +1368(==========================================================================)S +1140 V +1260(C)S +1422(FTVMARK)S +1854(--)S +2070(Example)S +2502(fortran)S +2934(program)S +3366(showing)S +3798(the)S +4014(use)S +4230(of)S +4392(the)S +4608(Client)S +1240 V +1260(C)S +1422(Display)S +1854(Library)S +2286(\(CDL\))S +2610(Fortran)S +3042(interface)S +3582(for)S +3798(doing)S +4122(graphics)S +4608(overlay.)S +5094(No)S +1340 V +1260(C)S +1422(checking)S +1908(of)S +2070(the)S +2286(error)S +2610(flag)S +2880(is)S +3042(done)S +3312(here)S +3582(for)S +3798(space)S +4122(considerations.)S +1440 V +1260(C)S +1368(==========================================================================)S +1640 V +1535(PROGRAM)S +1967(FTVMARK)S +1740 V +1535(include)S +2085(")S +9 B +2139(cdlftn.inc)S +9 C +2502(")S +1840 V +1535(character*64)S +2360(imname)S +2040 V +1260(C)S +9 I +1535(Initialize)S +1882(the)S +2019(CDL)S +2221(package)S +2140 V +9 C +1535(call)S +9 B +1805(cfopen)S +9 C +2114(\(0,)S +2330(ier\))S +2340 V +1535(write)S +1859(\(*,)S +2075("\('Image)S +2561(Name:)S +2885(',)S +3047($\)"\))S +2440 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(imname)S +2540 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(Number:)S +2993(',)S +3155($\)"\))S +2640 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(iframe)S +2740 V +1535(write)S +1859(\(*,)S +2075("\('Frame)S +2561(buffer)S +2939(configuration)S +3695(number:)S +4127(',)S +4289($\)"\))S +2840 V +1535(read)S +1805(\(5,)S +2021(*\))S +2183(ifb)S +3040 V +1260(C)S +9 I +1535(If)S +1617(we've)S +1854(got)S +1996(a)S +2068(FITS)S +2275(format)S +2542(image,)S +2812(go)S +2929(ahead)S +3176(and)S +3338(display)S +3625(it.)S +3140 V +9 C +1535(call)S +9 B +1805(c\256sFITS)S +9 C +2184(\(imname,)S +2670(isfits\))S +3240 V +1535(if)S +1697(\(isfits)S +2129(.gt.)S +2399(0\))S +2561(then)S +3340 V +1751(call)S +9 B +2021(cfdisplayFITS)S +9 C +2620(\(imname,)S +3106(iframe,)S +3538(ifb,)S +3808(1,)S +3970(ier\))S +3440 V +1535(else)S +3540 V +1260(C)S +9 I +1751(We've)S +2003(got)S +2145(an)S +2262(IRAF)S +2484(format)S +2751(image,)S +3021(go)S +3138(ahead)S +3385(and)S +3547(display)S +3834(it.)S +3640 V +9 C +1751(call)S +9 B +2021(c\256sIRAF)S +9 C +2420(\(imname,)S +2906(isiraf\))S +3740 V +1751(if)S +1913(\(isiraf)S +2345(.gt.)S +2615(0\))S +2777(then)S +3840 V +1967(call)S +9 B +2237(cfdisplayIRAF)S +9 C +2856(\(imname,)S +3342(1,)S +3504(iframe,)S +3936(ifb,)S +4206(1,)S +4368(ier\))S +3940 V +1751(else)S +4040 V +1260(C)S +9 I +1967(No)S +2099(valid)S +2306(image)S +2553(given,)S +2798(so)S +2905(map)S +3087(the)S +3224(current)S +3516(display)S +3803(for)S +3935(marking.)S +4140 V +9 C +1967(call)S +9 B +2237(cfmapFrame)S +9 C +2786(\(iframe\))S +4240 V +1751(endif)S +4340 V +1535(endif)S +4540 V +1260(C)S +9 I +1535(Now)S +1727(that)S +1894(we've)S +2131(got)S +2273(an)S +2390(image)S +2637(displayed)S +3009(or)S +3116(mapped,)S +3451(enter)S +3663(a)S +3735(cursor)S +3997(loop)S +4184(to)S +4281(mark)S +4493(the)S +4630(image.)S +4640 V +9 C +1535(call)S +1805(markInteractive)S +2669(\(\))S +4840 V +1260(C)S +9 I +1535(Clean)S +1777(up)S +1894(and)S +2056(exit)S +4940 V +9 C +1260(999)S +1535(continue)S +5040 V +1535(call)S +9 B +1805(cfclose)S +9 C +2114(\(ier\))S +5140 V +1535(end)S +5340 V +1260(C)S +9 I +1476(MARKINTERACTIVE)S +2303(--)S +2390(Subroutine)S +2812(for)S +2944(processing)S +3361(the)S +3498(cursor)S +3760(loop.)S +5440 V +9 C +1535(subroutine)S +2129(markInteractive)S +2993(\(\))S +5540 V +1535(include)S +2085(")S +9 B +2139(cdlftn.inc)S +9 C +2502(")S +5640 V +1535(real)S +2085(angle,)S +2463(rx,)S +2679(ry,)S +2895(txsize)S +5740 V +1535(integer)S +2360(nx,)S +2576(ny,)S +2792(x,)S +2954(y,)S +3116(x2,)S +3332(y2,)S +3548(fill,)S +3872(size,)S +4196(color)S +5840 V +1535(integer)S +2360(number,)S +2792(radius,)S +3224(xrad,)S +3548(yrad,)S +3872(nannuli,)S +4358(sep)S +5940 V +1535(character)S +2085(key)S +6040 V +1535(character*64)S +2360(cmd,)S +2630(str)S +6240 V +1260(C)S +9 I +1535(Allocate)S +1862(a)S +1934(1024x1024)S +2361(array)S +2588(for)S +2720(pixels.)S +6340 V +9 C +1535(character)S +2085(pix\(1048576\))S +6540 V +1260(C)S +9 I +1535(....Initialize)S +1974(the)S +2111(local)S +2318(parameters)S +2755(to)S +2852(use)S +6740 V +9 C +1260(C)S +9 I +1535(Read)S +1747(a)S +1819(cursor)S +2081(keystroke)S +2448(telling)S +2705(us)S +2812(what)S +3014(to)S +3111(do.)S +6840 V +9 C +1260(10)S +1535(call)S +9 B +1805(cfreadCursor)S +9 C +2379(\(0,)S +2595(rx,)S +2811(ry,)S +3027(key,)S +3297(ier\))S +7040 V +1260(C)S +9 I +1535(Round)S +1797(the)S +1934(real)S +2106(cursor)S +2368(position)S +2685(to)S +2782(integer)S +3064(pixel)S +3266(positions.)S +7140 V +9 C +1751(x)S +1859(=)S +1967(nint)S +2237(\(rx)S +2453(+)S +2561(0.5\))S +7240 V +1751(y)S +1859(=)S +1967(nint)S +2237(\(ry)S +2453(+)S +2561(0.5\))S +7920 V +EP +%%Page: 37 40 +BP +/slant 0 def +/height 1.000000 def +9 C +9 C +460 V +11 R +2936(- 37 -)S +820 V +9 C +1260(C)S +9 I +1535(Check)S +1787(the)S +1924(keystroke)S +2291(and)S +2453(take)S +2630(the)S +2767(appropriate)S +3224(action.)S +920 V +9 C +1260(C)S +9 I +1751(Colon)S +1998(Commands)S +1020 V +9 C +1751(if)S +1913(\(key)S +2183(.eq.)S +2453(':'\))S +2723(then)S +1120 V +1260(C)S +9 I +1810(Read)S +2022(a)S +2094(three)S +2306(character)S +2683(command)S +3060(and)S +3222(value)S +3444(\256eld)S +3626(and)S +3788(process)S +4090(the)S +4227(colon)S +4454(command)S +1220 V +9 C +1810(read)S +2080(\(*,'\(A3,)S +2566(i4\)'\))S +2890(cmd,)S +3160(ival)S +1320 V +1810(if)S +1972(\(cmd\(1:3\))S +2512(.eq.)S +2782('ang'\))S +3160(then)S +1420 V +2026(angle)S +2350(=)S +2458(real)S +2728(\(ival\))S +1520 V +1810(else)S +2080(if)S +2242(\(cmd\(1:3\))S +2782(.eq.)S +3052('col'\))S +3430(then)S +1620 V +2026(color)S +2350(=)S +2458(ival)S +1720 V +1810(else)S +2080(if)S +2242(\(cmd\(1:3\))S +2782(.eq.)S +3052('fil'\))S +3430(then)S +1820 V +2026(fill)S +2296(=)S +2404(ival)S +1920 V +9 I +2085(:)S +2020 V +2085(....and)S +2339(so)S +2446(on)S +2563(to)S +2660(set)S +2787(local)S +2994(variables)S +2120 V +2085(:)S +2220 V +9 R +1810(else)S +1977(if)S +2059(\(cmd\(1:3\))S +2446(.eq.)S +2604('pri'\))S +2821(then)S +2320 V +1260(C)S +9 I +1918(Print)S +2130(contents)S +2457(of)S +2554(the)S +2691(current)S +2983(frame)S +3220(bu)S +3310 H + (f)show 9 -.5 mul h (f)show +9 I +3356(er)S +2420 V +9 R +1918(call)S +9 B +2075(cfreadFrameBu)S +2685 H + (f)show 9 -.5 mul h (f)show +9 B +2740(er)S +9 R +2847(\(pix,)S +3042(nx,)S +3182(ny,)S +3322(ier\))S +2520 V +1918(call)S +9 B +2075(cfprintPix)S +9 R +2492(\("lpr",)S +2746(pix,)S +2911(nx,)S +3051(ny,)S +3191(1,)S +3286(ier\))S +2620 V +1810(else)S +1977(if)S +2059(\(cmd\(1:3\))S +2446(.eq.)S +2604('sta'\))S +2821(then)S +2720 V +9 I +2085(....print)S +2379(out)S +2521(the)S +2658(status)S +2895(\(value\))S +3177(of)S +3274(variables)S +2820 V +9 R +1810(endif)S +3020 V +1260(C)S +9 I +1643(Point)S +1865(Markers)S +3120 V +9 R +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('p'\))S +2399(then)S +3220 V +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(M_PLUS,)S +3379(color,)S +3614(ier\))S +3320 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('x'\))S +2399(then)S +3420 V +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(M_CROSS,)S +3444(color,)S +3679(ier\))S +3520 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('_'\))S +2399(then)S +3620 V +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(M_HBLINE,)S +3489(color,)S +3724(ier\))S +3720 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('o'\))S +2399(then)S +3820 V +1260(C)S +9 I +1810(Example)S +2152(of)S +2249(a)S +2321(\256lled)S +2528(point)S +2740(marker)S +3920 V +9 R +1810(call)S +9 B +1967(cfmarkPoint)S +9 R +2479(\(x,)S +2604(y,)S +2699(1,)S +2794(size,)S +2984(or\(M_CIRCLE,\256ll\),)S +3737(color,)S +3972(ier\))S +4020 V +9 I +2085(:)S +4120 V +2085(....and)S +2339(so)S +2446(on)S +2563(to)S +2660(set)S +2787(other)S +3004(types)S +3216(of)S +3313(point)S +3525(markers)S +4320 V +9 R +1260(C)S +9 I +1643(Other)S +1880(Markers)S +4420 V +9 R +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('b'\))S +2399(then)S +4520 V +1810(print)S +2007('\("Hit)S +2246(another)S +2543(key)S +2700(to)S +2797(de\256ne)S +3044(the)S +3181(box)S +3343(...."\)')S +4620 V +1810(call)S +9 B +1967(cfreadCursor)S +9 R +2514(\(0,)S +2639(rx,)S +2764(ry,)S +2889(key,)S +3069(ier\))S +4720 V +1810(x2)S +1927(=)S +2004(nint)S +2171(\(rx)S +2303(+)S +2380(0.5\))S +4820 V +1810(y2)S +1927(=)S +2004(nint)S +2171(\(ry)S +2303(+)S +2380(0.5\))S +4920 V +1810(call)S +9 B +1967(cfmarkBox)S +9 R +2424(\(x,)S +2549(y,)S +2644(x2,)S +2784(y2,)S +2924(\256ll,)S +3074(color,)S +3309(ier\))S +5020 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('d'\))S +2399(then)S +5120 V +1810(call)S +9 B +1967(cfdeleteMark)S +9 R +2509(\(x,)S +2634(y,)S +2729(ier\))S +5220 V +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('e'\))S +2394(then)S +5320 V +1810(call)S +9 B +1967(cfmarkEllipse)S +9 R +2534(\(x,)S +2659(y,)S +2754(xrad,)S +2964(yrad,)S +3174(angle,)S +3419(\256ll,)S +3569(color,)S +3804(ier\))S +5420 V +1584(else)S +1751(if)S +1833(\(key)S +2020(.eq.)S +2178('t'\))S +2320(then)S +5520 V +1692(print)S +1889('\("Text)S +2178(string:)S +2462(",)S +2549($\)')S +5620 V +1692(read)S +1874(\(*,'\(A64\)'\))S +2304(str)S +5720 V +1692(call)S +9 B +1849(cfmarkText)S +9 R +2331(\(x,)S +2456(y,)S +2551(str,)S +2691(txsize,)S +2951(angle,)S +3196(color,)S +3431(ier\))S +5820 V +9 I +2085(:)S +5920 V +2085(....and)S +2339(so)S +2446(on)S +2563(to)S +2660(set)S +2787(other)S +3004(types)S +3216(of)S +3313(markers)S +6120 V +9 R +1260(C)S +9 I +1643(Quit)S +6220 V +9 R +1643(else)S +1810(if)S +1892(\(key)S +2079(.eq.)S +2237('q'\))S +2399(then)S +6320 V +1810(goto)S +1997(998)S +6420 V +1643(endif)S +6620 V +1260(C)S +9 I +1535(Loop)S +1747(back)S +1944(until)S +2136(we)S +2263(want)S +2465(to)S +2562(quit)S +6720 V +9 R +1535(goto)S +1722(10)S +6820 V +1260(998)S +1535(continue)S +6920 V +1535(end)S +7920 V +EP +%%Page: 38 41 +BP +/slant 0 def +/height 1.000000 def +9 R +9 R +480 V +11 R +2936(- 38 -)S +840 V +11 B +900(15.)S +1104(SPP)S +1333(Interface)S +1790(Summary)S +996 V +11 R +1260(#include)S +1704(")S +11 B +1749(cdlspp.h)S +11 R +2147(")S +1296 V +11 B +1854(cdl_open)S +11 R +2442(\(imtdev,)S +2845(ier\))S +1416 V +11 B +1589(cdl_displayPix)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(bitpix,)S +3341(frame,)S +3656(fbcon\256g,)S +4083(zscale,)S +4410(ier\))S +1536 V +11 B +1533(cdl_readCursor)S +11 R +2442(\(sample,)S +2850(x,)S +2966(y,)S +3082(wcs,)S +3313(key,)S +3532(ier\))S +1656 V +11 B +1619(cdl_setCursor)S +11 R +2442(\(x,)S +2594(y,)S +2710(wcs,)S +2941(ier\))S +1776 V +11 B +1703(cdl_setWCS)S +11 R +2442(\(name,)S +2776(title,)S +3009(a,)S +3118(b,)S +3234(c,)S +3343(d,)S +3459(tx,)S +3606(ty,)S +3753(z1,)S +3917(z2,)S +4081(zt,)S +4221(ier\))S +1896 V +11 B +1691(cdl_getWCS)S +11 R +2442(\(name,)S +2776(title,)S +3009(a,)S +3118(b,)S +3234(c,)S +3343(d,)S +3459(tx,)S +3606(ty,)S +3753(z1,)S +3917(z2,)S +4081(zt,)S +4221(ier\))S +2016 V +11 B +1645(cdl_setFrame)S +11 R +2442(\(frame\))S +2136 V +11 B +1542(cdl_clearFrame)S +11 R +2442(\(ier\))S +2256 V +11 B +1856(cdl_close)S +11 R +2442(\(\))S +2496 V +11 B +1524(cdl_setMapping)S +11 R +2442(\(region,)S +2819(sx,sy,snx,sny,)S +3466(dx,dy,dnx,dny,)S +4161(ref,)S +4342(ier\))S +2616 V +11 B +1512(cdl_getMapping)S +11 R +2442(\(region,)S +2819(sx,sy,snx,sny,)S +3466(dx,dy,dnx,dny,)S +4161(ref,)S +4342(ier\))S +2736 V +11 B +1586(cdl_queryMap)S +11 R +2442(\(wcs,)S +2709(region,)S +3050(sx,sy,snx,sny,)S +3697(dx,dy,dnx,dny,)S +4392(objref,)S +4714(ier\))S +2976 V +11 B +1474(cdl_displayIRAF)S +11 R +2442(\(fname,)S +2812(band,)S +3086(frame,)S +3401(fbcon\256g,)S +3828(zscale,)S +4155(ier\))S +3096 V +11 B +1739(cdl_isIRAF)S +11 R +2442(\(fname,)S +2812(isiraf\))S +3216 V +11 B +1600(cdl_readIRAF)S +11 R +2442(\(fname,)S +2812(band,)S +3086(pix,)S +3288(nx,)S +3459(ny,)S +3630(bitpix,)S +3949(title,)S +4182(ier\))S +3456 V +11 B +1496(cdl_displayFITS)S +11 R +2442(\(fname,)S +2812(frame,)S +3127(fbcon\256g,)S +3554(zscale,)S +3881(ier\))S +3576 V +11 B +1761(cdl_isFITS)S +11 R +2442(\(fname,)S +2812(is\256ts\))S +3696 V +11 B +1622(cdl_readFITS)S +11 R +2442(\(fname,)S +2812(pix,)S +3014(nx,)S +3185(ny,)S +3356(bitpix,)S +3675(title,)S +3908(ier\))S +3936 V +11 B +1380(cdl_computeZscale)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(bitpix,)S +3341(z1,)S +3505(z2\))S +4056 V +11 B +1516(cdl_zscaleImage)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(bitpix,)S +3341(z1,)S +3505(z2\))S +4296 V +11 B +1689(cdl_printPix)S +11 R +2442(\(cmd,)S +2728(pix,)S +2930(nx,)S +3101(ny,)S +3272(annotate,)S +3704(ier\))S +4416 V +11 B +1383(cdl_printPixToFile)S +11 R +2442(\(fname,)S +2812(pix,)S +3014(nx,)S +3185(ny,)S +3356(annotate,)S +3788(ier\))S +4656 V +11 B +1576(cdl_readImage)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(ier\))S +4776 V +11 B +1260(cdl_readFrameBu)S +2114 H + (f)show 11 -.5 mul h (f)show +11 B +2181(er)S +11 R +2442(\(pix,)S +2680(nx,)S +2851(ny,)S +3022(ier\))S +4896 V +11 B +1373(cdl_readSubRaster)S +11 R +2442(\(lx,)S +2625(ly,)S +2772(nx,)S +2943(ny,)S +3114(pix,)S +3316(ier\))S +5016 V +11 B +1344(cdl_writeSubRaster)S +11 R +2442(\(lx,)S +2625(ly,)S +2772(nx,)S +2943(ny,)S +3114(pix,)S +3316(ier\))S +5256 V +11 B +1686(cdl_selectFB)S +11 R +2442(\(nx,)S +2649(ny,)S +2820(fb,)S +2972(w,)S +3112(h,)S +3228(nf,)S +3380(reset\))S +5376 V +11 B +1500(cdl_setFBCon\256g)S +11 R +2442(\(con\256gno\))S +5496 V +11 B +1488(cdl_getFBCon\256g)S +11 R +2442(\(con\256gno,)S +2924(w,)S +3064(h,)S +3180(nf\))S +5616 V +11 B +1424(cdl_lookupFBSize)S +11 R +2442(\(con\256gno,)S +2924(w,)S +3064(h,)S +3180(nf\))S +5856 V +11 B +1598(cdl_setZTrans)S +11 R +2442(\(ztrans\))S +5976 V +11 B +1636(cdl_setZScale)S +11 R +2442(\(z1,)S +2642(z2\))S +6096 V +11 B +1605(cdl_setSample)S +11 R +2442(\(nsample\))S +6216 V +11 B +1347(cdl_setSampleLines)S +11 R +2442(\(nlines\))S +6336 V +11 B +1540(cdl_setContrast)S +11 R +2442(\(contrast\))S +6456 V +11 B +1681(cdl_setName)S +11 R +2442(\(imname\))S +6576 V +11 B +1734(cdl_setTitle)S +11 R +2442(\(imtitle\))S +6816 V +11 B +1633(cdl_getFrame)S +11 R +2442(\(frame\))S +6936 V +11 B +1586(cdl_getZTrans)S +11 R +2442(\(ztrans\))S +7056 V +11 B +1624(cdl_getZScale)S +11 R +2442(\(z1,)S +2642(z2\))S +7176 V +11 B +1593(cdl_getSample)S +11 R +2442(\(nsample\))S +7296 V +11 B +1335(cdl_getSampleLines)S +11 R +2442(\(nlines\))S +7920 V +EP +%%Page: 39 42 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +2936(- 39 -)S +840 V +11 B +1528(cdl_getContrast)S +11 R +2442(\(contrast\))S +960 V +11 B +1669(cdl_getName)S +11 R +2442(\(imname\))S +1080 V +11 B +1722(cdl_getTitle)S +11 R +2442(\(imtitle\))S +1320 V +11 B +1564(cdl_mapFrame)S +11 R +2442(\(frame,)S +2793(ier\))S +1440 V +11 B +1306(cdl_markCoordsFile)S +11 R +2442(\(fname,)S +2812(type,)S +3062(size,)S +3293(color,)S +3579(label,)S +3853(ier\))S +1560 V +11 B +1574(cdl_markPoint)S +11 R +2442(\(x,)S +2594(y,)S +2710(number,)S +3106(size,)S +3337(type,)S +3587(color,)S +3873(ier\))S +1680 V +11 B +1304(cdl_markPointLabel)S +11 R +2442(\(x,)S +2594(y,)S +2710(label,)S +2984(size,)S +3215(type,)S +3465(color,)S +3751(ier\))S +1800 V +11 B +1610(cdl_markLine)S +11 R +2442(\(xs,)S +2637(ys,)S +2796(xe,)S +2960(ye,)S +3124(color,)S +3410(ier\))S +1920 V +11 B +1641(cdl_markBox)S +11 R +2442(\(lx,)S +2625(ly,)S +2772(ux,)S +2943(uy,)S +3114(\256ll,)S +3299(color,)S +3585(ier\))S +2040 V +11 B +1445(cdl_markPolygon)S +11 R +2442(\(xarray,)S +2817(yarray,)S +3156(npts,)S +3401(\256ll,)S +3586(color,)S +3872(ier\))S +2160 V +11 B +1445(cdl_markPolyline)S +11 R +2442(\(xarray,)S +2817(yarray,)S +3156(npts,)S +3401(color,)S +3687(ier\))S +2280 V +11 B +1540(cdl_markCircle)S +11 R +2442(\(x,)S +2594(y,)S +2710(radius,)S +3039(\256ll,)S +3224(color,)S +3510(ier\))S +2400 V +11 B +1292(cdl_markCircAnnuli)S +11 R +2442(\(x,)S +2594(y,)S +2710(radius,)S +3039(nannuli,)S +3430(sep,)S +3637(color,)S +3923(ier\))S +2520 V +11 B +1505(cdl_markEllipse)S +11 R +2442(\(x,)S +2594(y,)S +2710(xrad,)S +2965(yrad,)S +3220(rotang,)S +3561(\256ll,)S +3746(color,)S +4032(ier\))S +2640 V +11 B +1269(cdl_markEllipAnnuli)S +11 R +2442(\(x,)S +2594(y,)S +2710(xrad,)S +2965(yrad,)S +3220(ang,)S +3439(nannuli,)S +3830(sep,)S +4037(color,)S +4323(ier\))S +2760 V +11 B +1612(cdl_markText)S +11 R +2442(\(x,)S +2594(y,)S +2710(str,)S +2881(size,)S +3112(angle,)S +3410(color,)S +3696(ier\))S +2880 V +11 B +1734(cdl_setFont)S +11 R +2442(\(font\))S +3000 V +11 B +1440(cdl_setTextWidth)S +11 R +2442(\(width\))S +3120 V +11 B +1438(cdl_setLineWidth)S +11 R +2442(\(width\))S +3240 V +11 B +1507(cdl_setLineStyle)S +11 R +2442(\(style\))S +3360 V +11 B +1540(cdl_deleteMark)S +11 R +2442(\(x,)S +2594(y,)S +2710(ier\))S +3480 V +11 B +1473(cdl_clearOverlay)S +11 R +2442(\(ier\))S +3600 V +11 B +1363(cdl_redrawOverlay)S +11 R +2442(\(ier\))S +3720 V +11 B +1648(cdl_setDebug)S +11 R +2442(\(level\))S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier Troff +%%Pages: 42 + \ No newline at end of file diff --git a/vendor/x11iraf/doc/obmsh.ps b/vendor/x11iraf/doc/obmsh.ps new file mode 100644 index 00000000..3a7a3d86 --- /dev/null +++ b/vendor/x11iraf/doc/obmsh.ps @@ -0,0 +1,552 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Thu Sep 11 15:23:56 1997 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/Y{/Symbol FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(OBMSH)S +1272(\()S +1321(1)S +1387(\))S +2787(USER COMMANDS )S +5060(OBMSH)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(obmsh)S +1557(\261)S +1637(Object)S +1933(Manager)S +2317(GUI)S +2524(script)S +2776(interpreter)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(obmsh)S +10 R +1574([)S +10 I +1607(\256le)S +10 R +1729(])S +1536 V +9 B +900(DESCRIPTION)S +1656 V +10 B +1260(Obmsh)S +10 R +1611(is)S +1717(a)S +1800(GUI)S +2016(command)S +2449(interpreter)S +2903(for)S +3058(the)S +3219(IRAF)S +3486(Widget)S +3819(Server)S +4118(/)S +4185(Object)S +4491(Manager)S +4885(\(OBM\))S +5219(that)S +5409(exe-)S +1776 V +1260(cutes)S +1499(commands)S +1966(read)S +2171(from)S +2399(the)S +2555(standard)S +2927(input)S +3167(or)S +3284(from)S +3512(a)S +3590(\256le.)S +3807(As)S +3952(with)S +4164(other)S +4403(shell)S +4626(interpreters)S +5114(such)S +5331(as)S +10 I +5447(csh)S +1896 V +10 R +1260(if)S +1360(the)S +1521(program)S +1898(is)S +2004(a)S +2087(\256le)S +2254(beginning)S +2693(with)S +10 B +2910(#!)S +10 R +2993(,)S +3057(the)S +3218(remainder)S +3661(of)S +3783(the)S +3944(\256rst)S +4139(line)S +4329(speci\256es)S +4713(an)S +4847(interpreter)S +5302(for)S +5458(the)S +2016 V +1260(program,)S +1653(usually)S +1972(the)S +2124(path)S +2326(to)S +2434(the)S +2586(obmsh)S +2883(executable.)S +3394(There)S +3656(are)S +3807(no)S +3937(arguments.)S +2256 V +1260(OBM)S +1524(programs)S +1937(are)S +2095(Tcl)S +2265(scripts)S +2563(consisting)S +3006(of)S +3126(application)S +3607(widgets)S +3955(to)S +4070(be)S +4201(created,)S +4550(resource)S +4924(values)S +5216(for)S +5369(those)S +2376 V +1260(widgets,)S +1644(callback)S +2024(procedures,)S +2534(and)S +2726(OBM-speci\256c)S +3340(functions)S +3760(needed)S +4090(to)S +4216(create)S +4501(and)S +4692(activate)S +5049(the)S +5218(GUI.)S +5497(In)S +2496 V +1260(applications)S +1776(such)S +1992(as)S +10 I +2108(Ximtool)S +10 R +2458(the)S +2613(GUI)S +2823(interacts)S +3194(with)S +3405(an)S +3532(underlying)S +3998(client)S +4253(program)S +4624(by)S +4757(passing)S +5091(messages)S +5502(to)S +2616 V +1260(the)S +1414(client,)S +1693(server)S +1967(\(the)S +2153(object)S +2428(manager)S +2802(itself\))S +3066(or)S +3180(various)S +3505(parameters)S +3973(or)S +4087(widgets)S +4429(in)S +4538(the)S +4691(script.)S +4999(Obmsh)S +5319(scripts)S +2736 V +1260(have)S +1484(no)S +1620(client)S +1878(but)S +2042(will)S +2234(execute)S +2574(a)S +2655(default)S +2969(callback)S +3338(that)S +3525(outputs)S +3857(the)S +4016(client)S +4275(message)S +4650(to)S +4765(the)S +4924(standard)S +5299(output,)S +2856 V +1260(the)S +1412(script)S +1664(will)S +1850(continue)S +2224(to)S +2332(run)S +2495(until)S +2709(a)S +2783('q')S +2929(keystroke)S +3347(is)S +3444(detected)S +3806(in)S +3914(a)S +3988(client)S +4240(message.)S +3096 V +1260(Obmsh)S +1594(script)S +1861(support)S +2206(all)S +2351(features)S +2711(of)S +2840(the)S +3008(Tcl)S +3187(language)S +3593(but)S +3767(also)S +3974(provide)S +4325(a)S +4415(builtin)S +4723(GUI)S +4946(capability.)S +5441(For)S +3216 V +1260(applications)S +1787(which)S +2075(do)S +2219(not)S +2391(require)S +2717(a)S +2805(client)S +3070(to)S +3191(perform)S +3555(more)S +3803(complex)S +4190(operations,)S +4674(the)S +4839(obmsh)S +5149(provides)S +5536(a)S +3336 V +1260(fully)S +1482(featured)S +1841(GUI)S +2051(scripting)S +2434(language.)S +2882(For)S +3054(more)S +3292(information)S +3797(on)S +3930(the)S +4085(IRAF)S +4346(Widget)S +4674(Server)S +4968(/)S +5030(OBM)S +5292(contact)S +3456 V +1260(iraf@noao.edu)S +1883(or)S +1996(see)S +2153(Tody,)S +2419(D.)S +2546(1995,)S +2801(in)S +2909(ADASS)S +3267(IV)S +3402(Proceedings,)S +3945(ASP)S +4159(Conf.)S +4414(Ser,)S +4602(Vol)S +4782(77,)S +4937(p.)S +5042(89.)S +3744 V +9 B +900(EXAMPLE)S +3864 V +10 R +1260(The)S +1445(following)S +1864(GUI)S +2071(script)S +2323(program)S +2691(demonstrates)S +3248(a)S +3322(simple)S +3619("hello)S +3890(world")S +4194(application:)S +4104 V +1380(#!/usr/local/bin/obmsh)S +4344 V +1380(reset-server)S +4464 V +1380(appInitialize)S +1909(hello)S +2139(Hello)S +2391({)S +4584 V +1500(!)S +1563(Application)S +2065(defaults)S +2411(for)S +2557(the)S +2709(hello)S +2939(world)S +3202(program.)S +4704 V +1500(Hello)S +10 Y +1722(*)S +10 R +1772(objects:\\)S +4824 V +1740(toplevel)S +2700(Form)S +3157(helloForm\\)S +4944 V +1740(helloForm)S +2700(Label)S +3137(helloLabel\\)S +5064 V +1740(helloForm)S +2700(Command)S +3267(quitButton)S +5304 V +10 Y +1500(*)S +10 R +1550(background:)S +2559(bisque)S +5424 V +10 Y +1500(*)S +10 R +1550(helloLabel.label:)S +2554(Hello,)S +2831(world!)S +5544 V +10 Y +1500(*)S +10 R +1550(quitButton.fromHoriz:)S +2663(helloLabel)S +5664 V +10 Y +1500(*)S +10 R +1550(quitButton.label:)S +2556(Quit)S +5784 V +1380(})S +6024 V +1380(createObjects)S +6144 V +1380(proc)S +1587(quit)S +1773(args)S +1969({)S +2047(send)S +2260(client)S +2512(gkey)S +2736(q;)S +2844(deactivate)S +3278(unmap)S +3580(})S +6264 V +1380(send)S +1593(quitButton)S +2052(addCallback)S +2581(quit)S +6384 V +1380(activate)S +6624 V +1260(If)S +1361(the)S +1519(\256le)S +1683(has)S +1852(execute)S +2192(permissions)S +2706(set)S +2853(the)S +10 B +3011(#!)S +10 R +3130(will)S +3322(invoke)S +3630(the)S +3788(obmsh)S +4091(to)S +4205(execute)S +4545(the)S +4703(\256le,)S +4892(otherwise)S +5316(it)S +5408(may)S +6744 V +1260(be)S +1384(running)S +1725(using)S +1972(either)S +6984 V +1620(%)S +1733(obmsh)S +2030(hello.gui)S +2700(or)S +3090(%)S +3203(obmsh)S +3500(<)S +3586(hello.gui)S +7680 V +900(X11IRAF Project)S +2703(Last change: 28 Aug 1997)S +5530(1)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(OBMSH)S +1272(\()S +1321(1)S +1387(\))S +2787(USER COMMANDS )S +5060(OBMSH)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(SEE)S +1112(ALSO)S +1080 V +10 R +1260(xgterm\(1\),)S +1714(ximtool\(1\))S +1248 V +9 B +900(COPYRIGHT)S +1368 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 28 Aug 1997)S +5530(2)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol +%%Pages: 2 + \ No newline at end of file diff --git a/vendor/x11iraf/doc/vximtool.ps b/vendor/x11iraf/doc/vximtool.ps new file mode 100644 index 00000000..70cae4f5 --- /dev/null +++ b/vendor/x11iraf/doc/vximtool.ps @@ -0,0 +1,2472 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Tue Mar 3 16:57:09 1998 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/C{/Courier FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(vximtool)S +1652(\261-)S +1765(A)S +1867(virtual)S +2158(and/or)S +2443(proxy)S +2706(display)S +3025(server)S +3298(for)S +3444(IRAF)S +3702(IIS)S +3854(protocol)S +4217(clients)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(vximtool)S +10 R +1662([)S +10 I +1725(options)S +10 R +2050(...])S +1488 V +10 B +1260(vximtool)S +10 R +1662(-proxy)S +1958([)S +10 I +2021(options)S +2346(...])S +2490(server)S +2769([)S +2838(server)S +10 R +3117(...)S +3222(])S +1776 V +9 B +900(DESCRIPTION)S +1896 V +10 I +1260(VXIMTOOL)S +10 R +1793(is)S +1899(a)S +1982(image)S +2265(display)S +2593(server)S +2875(process)S +3213(much)S +3475(like)S +10 I +3665(XIMTOOL)S +10 R +4098(,)S +4163(except)S +4463(that)S +4653(all)S +4793(it)S +4889(normally)S +5290(does)S +5513(is)S +2016 V +1260(respond)S +1632(to)S +1766(datastream)S +2254(requests)S +2637(to)S +2770(read)S +2996(and)S +3195(write)S +3455(to)S +3588(internal)S +3948(frame)S +4235(bu)S +4335 H + (f)show 10 -.5 mul h (f)show +10 R +4396(ers)S +4567(maintained)S +5066(as)S +5204(arrays)S +5502(in)S +2136 V +1260(memory.)S +1682(Multiple)S +2062(frame)S +2329(bu)S +2429 H + (f)show 10 -.5 mul h (f)show +10 R +2490(ers)S +2641(and)S +2820(frame)S +3087(bu)S +3187 H + (f)show 10 -.5 mul h (f)show +10 R +3248(er)S +3360(con\256gurations)S +3967(are)S +4123(supported.)S +4607(It)S +4703(can)S +4876(be)S +5005(used)S +5223(to)S +5336(debug)S +2256 V +1260(IIS)S +1424(protocol)S +1799(client)S +2063(programs)S +2482(by)S +2624(printing)S +2983(out)S +3153(the)S +3317(protocol)S +3692(packets)S +4033(recieved,)S +4436(or)S +4560(can)S +4739(simply)S +5053(be)S +5188(used)S +5412(as)S +5536(a)S +2376 V +1260(dummy)S +1602(server)S +1881(in)S +1995(cases)S +2241(where)S +2520(no)S +2656(image)S +2936(display)S +3261(is)S +3364(really)S +3627(needed.)S +4000(By)S +4154(enabling)S +4535(the)S +10 I +4694(-proxy)S +10 R +4991(\257ag)S +5178(the)S +5337(server)S +2496 V +1260(can)S +1431(also)S +1625(be)S +1752(used)S +1968(to)S +2079(repeat)S +2355(the)S +2510(datastream)S +2975(requests)S +3335(to)S +3446(a)S +3522(list)S +3677(of)S +3792(other)S +4029(servers,)S +4368(e)S +4412 H + (f)show 10 -.5 mul h (f)show +10 R +4473(ectively)S +4821(splitting)S +5182(the)S +5336(image)S +2616 V +1260(display)S +1579(to)S +1687(a)S +1761(number)S +2096(of)S +2209(other)S +2444(servers.)S +2811(See)S +2985(below)S +3259(for)S +3405(details)S +3696(on)S +3826(using)S +4073(the)S +4225(program)S +4593(in)S +4701(this)S +4876(manner.)S +2856 V +1260(The)S +10 I +1448(-verbose)S +10 R +1824(\257ag)S +2007(will)S +2196(log)S +2357(all)S +2490(datastream)S +2955(requests)S +3315(to)S +3426(the)S +3581(stderr,)S +3866(otherwise)S +4287(the)S +4442(task)S +4636(runs)S +4841(silently)S +5170(except)S +5464(for)S +2976 V +1260(error)S +1485(messages.)S +1949(The)S +2136(process)S +2467(is)S +2566(terminated)S +3025(with)S +3234(an)S +3359(EOF)S +3579(on)S +3710(the)S +3863(stdin,)S +4114(if)S +4206(the)S +4359(task)S +4551(is)S +4649(intended)S +5024(to)S +5133(be)S +5258(run)S +5422(as)S +5536(a)S +3096 V +1260(background)S +1772(job)S +1941(the)S +10 I +2104(-background)S +10 R +2655(\257ag)S +2846(should)S +3154(be)S +3289(enabled)S +3640(to)S +3760(shut)S +3969(o)S +4019 H + (f)show 10 -.5 mul h (f)show +10 R +4122(the)S +4286(check)S +4560(of)S +4685(the)S +4849(stdin)S +5086(and)S +5272(avoid)S +5536(a)S +3216 V +1260("waiting)S +1634(for)S +1783(tty)S +1922(input")S +2202(message)S +2573(that)S +2756(would)S +3039(suspend)S +3394(the)S +3549(background)S +4053(job.)S +4269(Frame)S +4557(bu)S +4657 H + (f)show 10 -.5 mul h (f)show +10 R +4718(ers)S +4867(are)S +5021(maintained)S +5497(as)S +3336 V +1260(rasters)S +1554(in)S +1666(memory,)S +2058(up)S +2192(to)S +2305(four)S +2506(frames)S +2812(may)S +3019(currently)S +3414(be)S +3543(de\256ned.)S +3927(If)S +4028(it)S +4119(not)S +4282(necessary)S +4704(to)S +4817(keep)S +5040(the)S +5197(displayed)S +3456 V +1260(images)S +1580(in)S +1695(memory)S +2065(\(i.e.)S +2257(the)S +2416(client)S +2675(will)S +2868(not)S +3033(need)S +3258(to)S +3373(read)S +3581(back)S +3806(any)S +3987(subrasters)S +4423(such)S +4643(as)S +4763(when)S +5016(doing)S +5281(overlay)S +3576 V +1260(graphics\),)S +1690(the)S +10 I +1846(-noraster)S +10 R +2252(\257ag)S +2436(can)S +2608(be)S +2736(used)S +2953(to)S +3066(disable)S +3384(the)S +3541(memory)S +3909(rasters.)S +4259(In)S +4377(this)S +4557(case)S +4763(any)S +4942(image)S +5221(readback)S +3696 V +1260(will)S +1446(return)S +1714(an)S +1838(array)S +2072(of)S +2185(zero)S +2386(values.)S +3936 V +1260(The)S +1448(default)S +1758(frame)S +2023(bu)S +2123 H + (f)show 10 -.5 mul h (f)show +10 R +2184(er)S +2295(size)S +2484(is)S +2585(512x512,)S +2994(with)S +3206(2)S +3290(frames)S +3595(de\256ned)S +3923(initially.)S +4324(The)S +10 I +4513(-con\256g)S +10 R +4824(and)S +10 I +5002(-nframes)S +10 R +5391(\257ags)S +4056 V +1260(can)S +1437(be)S +1570(used)S +1792(to)S +1909(change)S +2230(the)S +2391(startup)S +2702(frame)S +2973(bu)S +3073 H + (f)show 10 -.5 mul h (f)show +10 R +3134(ers)S +3289(used.)S +3566(The)S +3760(frame)S +4031(bu)S +4131 H + (f)show 10 -.5 mul h (f)show +10 R +4192(er)S +4308(con\256guration)S +4880(table)S +5113(is)S +5219(normally)S +4176 V +1260(taken)S +1507(to)S +1616(be)S +1741(/usr/local/lib/imtoolrc)S +2645(but)S +2804(can)S +2973(be)S +3098(overridden)S +3561(by)S +3692(using)S +3941(an)S +4067(IMTOOLRC)S +4621(environment)S +5158(variable,)S +5536(a)S +4296 V +10 I +1260($HOME/.imtoolrc)S +10 R +2029(\256le,)S +2221(or)S +2343(the)S +10 I +2504(-imtoolrc)S +10 R +2915(command-line)S +3531(\257ag)S +3719(respectively.)S +4294(The)S +4487(format)S +4791(of)S +4912(the)S +5072(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +4416 V +1260(con\256guration)S +1823(\256le)S +1981(is)S +4656 V +10 I +1410(con\256gno)S +1784(nframes)S +2136(width)S +2389(height)S +2669([extra)S +2943(\256elds])S +4776 V +10 R +1290(e.g.)S +4896 V +1560(1)S +1670(2)S +1780(512)S +1990(512)S +5016 V +1560(2)S +1670(2)S +1780(800)S +1990(800)S +5136 V +1560(3)S +1670(1)S +1750(1024)S +1980(1024)S +2480(#)S +2560(comment)S +5376 V +1260(and)S +1434(so)S +1553(on.)S +1738(At)S +1868(most)S +2093(128)S +2273(frame)S +2536(bu)S +2636 H + (f)show 10 -.5 mul h (f)show +10 R +2697(er)S +2805(sizes)S +3030(may)S +3233(be)S +3358(de\256ned,)S +3708(each)S +3921(con\256guration)S +4485(may)S +4688(de\256ne)S +4963(up)S +5094(to)S +5203(4)S +5284(frames,)S +5496 V +1260(con\256guration)S +1823(numbers)S +2197(need)S +2415(not)S +2573(be)S +2697(sequential.)S +5784 V +9 B +900(OPTIONS)S +5904 V +10 B +1260(-background)S +6024 V +10 R +1510(The)S +1695(task)S +1886(will)S +2072(be)S +2196(run)S +2359(in)S +2467(the)S +2619(background)S +3120(so)S +3239(don't)S +3480(listen)S +3727(to)S +3835(STDIN)S +4159(for)S +4305(an)S +4429(EOF)S +4648(to)S +4756(quit)S +4942(gracefully.)S +6192 V +10 B +1260(-con\256g)S +10 I +1579(num)S +6312 V +10 R +1510(Initial)S +1799(frame)S +2081(bu)S +2181 H + (f)show 10 -.5 mul h (f)show +10 R +2242(er)S +2369(con\256guration)S +2952(number.)S +3362(The)S +3567(default)S +3894(value)S +4160(is)S +4277(1,)S +4402(indicating)S +4852(a)S +4947(512x512)S +5348(frame)S +6432 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(er)S +1778(with)S +1986(2)S +2066(frames.)S +2422(See)S +2596(below)S +2870(for)S +3016(information)S +3518(on)S +3648(the)S +3800(frame)S +4062(bu)S +4162 H + (f)show 10 -.5 mul h (f)show +10 R +4223(ers.)S +6600 V +10 B +1260(-\256fo)S +10 I +1462(pipe)S +6720 V +10 R +1510(Speci\256es)S +1901(the)S +2053(name)S +2299(of)S +2412(the)S +2564(\256fo)S +2733(pipe)S +2936(to)S +3045(be)S +3170(used,)S +3409(the)S +10 I +3562(i)S +10 R +3621(and)S +10 I +3796(o)S +10 R +3877(su)S +3966 H + (f)show 10 -.5 mul h (\256)show +10 R +4050(xes)S +4214(will)S +4401(be)S +4526(added)S +4795(automatically.)S +5425(The)S +6840 V +1510(default)S +1817(pipe)S +2019(names)S +2304(will)S +2490(be)S +2614(/dev/imt1i)S +3056(\(input)S +3325(pipe\))S +3560(and)S +3734(/dev/imt1o)S +4198(\(output)S +4517(pipe\).)S +7008 V +10 B +1260(-\256fo_only)S +7128 V +10 R +1510(If)S +1615(set,)S +1790(only)S +2007(\256fo)S +2185(pipes)S +2435(will)S +2630(be)S +2763(used)S +2985(for)S +3140(communication)S +3801(with)S +4018(a)S +4101(client)S +4363(program,)S +4766(sockets)S +5100(will)S +5296(be)S +5430(dis-)S +7248 V +1510(abled.)S +7728 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(1)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(-help)S +10 R +1510(Print)S +1735(a)S +1809(summary)S +2211(of)S +2324(command)S +2748(line)S +2928(options)S +3253(to)S +3361(the)S +3513(screen.)S +1128 V +10 B +1260(-interactive)S +1248 V +10 R +1510(Allow)S +1792(cursor)S +2073(value)S +2321(strings)S +2620(to)S +2730(be)S +2856(typed)S +3110(into)S +3299(the)S +3454(STDIN)S +3781(in)S +3892(response)S +4274(to)S +4385(cursor)S +4667(read)S +4871(requests)S +5231(from)S +5458(the)S +1368 V +1510(client.)S +1536 V +10 B +1260(-imtoolrc)S +10 I +1683(\256le)S +1656 V +10 R +1510(Speci\256es)S +1923(the)S +2097(frame)S +2381(bu)S +2481 H + (f)show 10 -.5 mul h (f)show +10 R +2542(er)S +2671(con\256guration)S +3257(\256le)S +3438(to)S +3569(be)S +3716(used.)S +4007(See)S +4204(below)S +4501(for)S +4670(information)S +5195(on)S +5348(frame)S +1776 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(ers.)S +1944 V +10 B +1260(-inet_only)S +2064 V +10 R +1510(If)S +1611(set,)S +1782(only)S +1995(inet)S +2180(sockets)S +2509(will)S +2700(be)S +2829(used)S +3047(for)S +3198(communication)S +3855(with)S +4068(a)S +4147(client)S +4404(program,)S +4802(\256fo)S +4976(pipes)S +5222(and)S +5402(unix)S +2184 V +1510(sockets)S +1834(will)S +2020(be)S +2144(disabled.)S +2352 V +10 B +1260(-noraster)S +2472 V +10 R +1510(If)S +1614(set)S +1763(no)S +1901(client)S +2162(data)S +2367(will)S +2562(be)S +2695(stored)S +2978(in)S +3095(memory,)S +3492(and)S +3675(image)S +3958(readback)S +4356(will)S +4551(return)S +4828(an)S +4961(array)S +5204(of)S +5326(zeroes)S +2592 V +1510(unless)S +1790(used)S +2003(as)S +2116(a)S +2190(proxy)S +2453(server.)S +2760 V +10 B +1260(-nframes)S +10 I +1672(num)S +2880 V +10 R +1510(Speci\256es)S +1913(the)S +2077(number)S +2424(of)S +2549(frame)S +2823(bu)S +2923 H + (f)show 10 -.5 mul h (f)show +10 R +2984(ers)S +3142(to)S +3262(con\256gure)S +3681(at)S +3795(startup.)S +4164(By)S +4323(default)S +4642(there)S +4883(will)S +5081(be)S +5217(2)S +5309(frames)S +3000 V +1510(available,)S +1925(a)S +1999(maximum)S +2435(of)S +2548(4)S +2628(frames)S +2929(are)S +3080(allowed.)S +3168 V +10 B +1260(-port_only)S +3288 V +10 R +1510(Same)S +1770(as)S +10 I +1891(-inet_only)S +10 R +2334(option.)S +2683(If)S +2787(set,)S +2961(only)S +3177(inet)S +3365(sockets)S +3697(will)S +3891(be)S +4023(used)S +4244(for)S +4398(communication)S +5058(with)S +5275(a)S +5358(client)S +3408 V +1510(program.)S +3576 V +10 B +1260(-port)S +10 I +1506(num)S +3696 V +10 R +1510(Set)S +1670(the)S +1825(primary)S +2174(port)S +2368(to)S +2479(listen)S +2729(on)S +2862(for)S +3011(client)S +3266(connections.)S +3831(The)S +4019(default)S +4329(is)S +4429(5137)S +4662(except)S +4955(when)S +5204(used)S +5420(as)S +5536(a)S +3816 V +1510(proxy)S +1773(server)S +2046(in)S +2154(which)S +2428(case)S +2629(the)S +2781(default)S +3088(is)S +3185(5136.)S +3984 V +10 B +1260(-proxy)S +4104 V +10 R +1510(Run)S +1714(as)S +1834(a)S +1915(proxy)S +2186(server)S +2467(by)S +2605(repeating)S +3014(client)S +3274(requests)S +3639(to)S +3755(each)S +3975(of)S +4096(the)S +10 I +4256(server)S +10 R +4543(remote)S +4858(server)S +5139(arguments.)S +4224 V +1510(See)S +1684(the)S +1836(section)S +2149(on)S +2279(proxy)S +2542(usage)S +2799(below)S +3073(for)S +3219(details.)S +4392 V +10 B +1260(-verbose)S +4512 V +10 R +1510(If)S +1606(set,)S +1772(print)S +1991(information)S +2493(about)S +2745(all)S +2875(IIS)S +3027(packets)S +3356(headers)S +3690(recieved)S +4057(to)S +4165(the)S +4317(STDERR)S +4731(stream.)S +4680 V +10 B +1260(-unix)S +10 I +1513(name)S +4800 V +10 R +1510(Speci\256es)S +1909(the)S +2069(unix)S +2285(domain)S +2623(socket)S +2916(name)S +3170(to)S +3286(use.)S +3512(A)S +3622("%d")S +3876(in)S +3993(the)S +4154(\256lename)S +4537(will)S +4732(be)S +4865(replaced)S +5241(with)S +5458(the)S +4920 V +1510(user)S +1706(id.)S +5088 V +10 B +1260(-unix_only)S +5208 V +10 R +1510(If)S +1607(set,)S +1774(only)S +1983(unix)S +2192(domain)S +2523(sockets)S +2848(will)S +3035(be)S +3160(used)S +3374(for)S +3521(communication)S +4174(with)S +4383(a)S +4458(client)S +4711(program,)S +5105(inet)S +5286(sockets)S +5328 V +1510(and)S +1684(\256fos)S +1892(will)S +2078(be)S +2202(disabled.)S +5616 V +9 B +900(CLIENT)S +1272(CONNECTIONS)S +5736 V +10 I +1260(VXImtool)S +10 R +1673(allows)S +1964(clients)S +2255(to)S +2363(connect)S +2703(in)S +2811(any)S +2985(of)S +3098(the)S +3250(following)S +3669(ways:)S +5904 V +10 B +1260(\256fo)S +1429(pipes)S +6024 V +10 R +1510(The)S +1706(traditional)S +2158(approach.)S +2589(The)S +2785(default)S +3103(global)S +3394(/dev/imt1[io])S +3963(pipes)S +4215(may)S +4428(be)S +4564(used,)S +4814(or)S +4939(a)S +5025(private)S +5344(set)S +5497(of)S +6144 V +1510(\256fos)S +1731(can)S +1911(be)S +2047(speci\256ed)S +2444(using)S +2703(the)S +10 I +2867(-\256fo)S +10 R +3070(command)S +3506(line)S +3698(argument.)S +4172(Values)S +4491(should)S +4800(be)S +4936(speci\256ed)S +5333(as)S +5458(the)S +6264 V +1510(root)S +1701(pathname)S +2119(to)S +2227(a)S +2301(pair)S +2486(of)S +2599(\256fo)S +2768(pipes)S +3009(whose)S +3294(last)S +3463(character)S +3857(is)S +3954('i')S +4078(or)S +4191('o',)S +4362(these)S +4597(characters)S +5030(will)S +5217(be)S +5342(added)S +6384 V +1510(automatically)S +2099(when)S +2360(opening)S +2727(the)S +2894(pipes.)S +3175(For)S +3359(example,)S +3767(to)S +3890(use)S +4068(the)S +4234(default)S +4555(pipes)S +4810(the)S +4976(path)S +5192(would)S +5486(be)S +6504 V +1510(speci\256ed)S +1895(as)S +2008(simply)S +2311("/dev/imt1".)S +2832(A)S +2934(value)S +3180(of)S +3293("none")S +3599(disables)S +3951(this)S +4126(connection.)S +6672 V +10 B +1260(tcp/ip)S +1535(sockets)S +6792 V +10 R +1510(Clients)S +1836(connect)S +2188(via)S +2352(a)S +2438(tcp/ip)S +2708(socket.)S +3030(The)S +3227(default)S +3546(port)S +3749(is)S +10 I +3858(5137)S +10 R +4058(,)S +4125(or)S +4250(a)S +4337(custom)S +4669(port)S +4873(may)S +5088(be)S +5225(speci\256ed)S +6912 V +1510(using)S +1760(the)S +10 I +1915(-port)S +10 R +2148(command)S +2575(line)S +2758(switch.)S +3107(This)S +3318(permits)S +3650(connecting)S +4120(to)S +4230(the)S +4384(server)S +4659(over)S +4868(a)S +4944(remote)S +5253(network)S +7032 V +1510(connection)S +1992(anywhere)S +2423(on)S +2567(the)S +2734(Internet.)S +3174(When)S +3457(used)S +3685(as)S +3813(a)S +3902(proxy)S +4180(server)S +4468(the)S +4635(default)S +4957(port)S +5163(number)S +5513(is)S +7152 V +1510(5136)S +1742(so)S +1863(as)S +1978(to)S +2088(avoid)S +2342(a)S +2418(con\257ict)S +2750(with)S +2960(an)S +3086(XImtool)S +3457(running)S +3800(on)S +3932(the)S +4085(same)S +4321(machine,)S +4715(other)S +4951(connections)S +5459(are)S +7272 V +1510(disabled)S +1881(unless)S +2169(otherwise)S +2595(overridden)S +3065(by)S +3203(a)S +3285(command)S +3717(line)S +3905(option)S +4199(following)S +4626(the)S +10 I +4787(-proxy)S +10 R +5086(\257ag)S +5275(to)S +5392(reset)S +7752 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(2)S +7920 V +EP +%%Page: 3 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(the)S +1662(connection.)S +2185(A)S +2287(port)S +2478(number)S +2813(of)S +2926(0)S +3006(\(zero\))S +3273(disables)S +3625(this)S +3800(connection.)S +1128 V +10 B +1260(unix)S +1480(domain)S +1833(sockets)S +1248 V +10 R +1510(Like)S +1733(a)S +1817(tcp/ip)S +2085(socket,)S +2405(but)S +2573(limited)S +2898(to)S +3017(a)S +3102(single)S +3382(host)S +3590(system.)S +3934(Usually)S +4286(faster)S +4548(than)S +4761(a)S +4846(tcp/ip)S +5115(socket,)S +5436(and)S +1368 V +1510(comparable)S +2008(to)S +2119(a)S +2196(\256fo.)S +2393(By)S +2543(default)S +2853(each)S +3068(user)S +3267(gets)S +3460(their)S +3675(own)S +3879(unix)S +4089(domain)S +4421(socket,)S +4733(so)S +4854(this)S +5031(option)S +5319(allows)S +1488 V +1510(multiple)S +1882(users)S +2125(to)S +2241(run)S +2413(ximtools)S +2803(on)S +2942(the)S +3103(same)S +3347(host)S +3553(without)S +3898(having)S +4209(to)S +4326(customize)S +4770(things.)S +5109(The)S +5303(default)S +1608 V +1510(value)S +1758(is)S +1857("/tmp/.IMT%d",)S +2549(other)S +2785(sockets)S +3110(may)S +3313(be)S +3438(de\256ned)S +3763(using)S +4011(the)S +10 I +4164(-unix)S +10 R +4400(command)S +4825(line)S +5006(switch.)S +5353(Legal)S +1728 V +1510(values)S +1813(should)S +2128(be)S +2270(speci\256ed)S +2673(as)S +2804(a)S +2896(\256lename)S +3288(to)S +3414(be)S +3557(used)S +3789(for)S +3954(the)S +4125(socket,)S +4454(up)S +4603(to)S +4730(two)S +4929("%d")S +5193(\256elds)S +5459(are)S +1848 V +1510(allowed)S +1856(and)S +2030(will)S +2216(be)S +2340(replaced)S +2707(by)S +2837(the)S +2989(userid.)S +3288(An)S +3440(empty)S +3720(string)S +3978(value)S +4224(disables)S +4576(this)S +4751(connection.)S +2016 V +1260(By)S +1408(default)S +10 I +1716(vximtool)S +10 R +2091(listens)S +2378(simultaneously)S +3015(for)S +3162(client)S +3415(connections)S +3923(on)S +4054(all)S +4186(three)S +4417(types)S +4660(of)S +4775(ports.)S +5092(Clients)S +5408(may)S +2136 V +1260(connect)S +1614(simultaneously)S +2264(by)S +2408(di)S +2486 H + (f)show 10 -.5 mul h (f)show +10 R +2547(erent)S +2790(means)S +3089(allowing)S +3483(up)S +3627(to)S +3748(three)S +3990(di)S +4068 H + (f)show 10 -.5 mul h (f)show +10 R +4129(erent)S +4371(displays)S +4742(to)S +4863(be)S +5000(loading)S +5343(at)S +5458(the)S +2256 V +1260(same)S +1495(time)S +1703(into)S +1889(di)S +1967 H + (f)show 10 -.5 mul h (f)show +10 R +2028(erent)S +2257(frames.)S +2544 V +9 B +900(COMMUNICATIONS)S +1807(PROTOCOL)S +2664 V +10 R +1260(Clients)S +1583(communicate)S +2160(with)S +10 I +2377(vximtool)S +10 R +2760(using)S +3016(a)S +3099(protocol)S +3471(developed)S +3920(originally)S +4348(for)S +4503(IIS)S +4664(\(International)S +5247(Imaging)S +2784 V +1260(Systems\))S +1659(Frame)S +1946(Bu)S +2063 H + (f)show 10 -.5 mul h (f)show +10 R +2124(er)S +2232(hardware,)S +2658(the)S +2811(so-called)S +3202("IIS)S +3396(protocol";)S +3829(other)S +4065(more)S +4301(modern)S +4637(protocols)S +5040(will)S +5227(likely)S +5486(be)S +2904 V +1260(supported)S +1687(in)S +1798(the)S +1953(future.)S +2279(The)S +2467(IIS)S +2622(protocol)S +2988(is)S +3088(basically)S +3476(a)S +3553(command)S +3981(packet)S +4275(stream)S +4575(with)S +4787(a)S +4865(header)S +5164(describing)S +3024 V +1260(the)S +1421(operation)S +1837(to)S +1954(be)S +2087(performed)S +2541(\(select)S +2840(frame,)S +3136(load)S +3347(display,)S +3700(read)S +3910(cursor,)S +4223(etc\),)S +4436(and)S +4618(an)S +4750(optional)S +5116(data)S +5320(packet)S +3144 V +1260(containing)S +1712(e.g.)S +1886(pixels.)S +2180(It)S +2271(is)S +2368(beyond)S +2692(the)S +2844(scope)S +3101(of)S +3214(this)S +3390(document)S +3815(to)S +3924(describe)S +4287(fully)S +4507(the)S +4660(details)S +4952(of)S +5066(the)S +5219(protocol;)S +3264 V +1260(interested)S +1688(users)S +1933(should)S +2240(contact)S +10 I +2568(iraf@noao.edu)S +10 R +3214(for)S +3370(further)S +3681(information)S +4193(or)S +4316(see)S +4482(the)S +10 I +4643(A)S +4743(Reference)S +5180(Guide)S +5463(for)S +3384 V +1260(the)S +1412(IRAF)S +1658(Client)S +1933(Display)S +2274(Library)S +10 R +2610(for)S +2756(details.)S +3672 V +9 B +900(PROXY)S +1247(USAGE)S +3792 V +10 R +1260(The)S +10 I +1445(vximtool)S +10 R +1819(may)S +2021(also)S +2212(be)S +2336(used)S +2549(as)S +2663(a)S +2738(proxy)S +3002(server)S +3276(by)S +3407(enabling)S +3782(the)S +10 I +3935(-proxy)S +10 R +4226(command)S +4651(line)S +4832(\257ag.)S +5068(In)S +5182(this)S +5358(mode)S +3912 V +1260(the)S +1420(program)S +1796(acts)S +1989(as)S +2110(a)S +2191(relay)S +2427(for)S +2580(the)S +2739(IIS)S +2898(datastream)S +3367(packets,)S +3728(sending)S +4076(image)S +4357(data,)S +4585(frame)S +4854(requests,)S +5243(etc.)S +5421(to)S +5536(a)S +4032 V +1260(list)S +1421(of)S +1542(other)S +1785(servers)S +2105(speci\256ed)S +2498(on)S +2636(the)S +2796(command)S +3228(line.)S +3471(The)S +3664(e)S +3708 H + (f)show 10 -.5 mul h (f)show +10 R +3769(ect)S +3923(of)S +4045(this)S +4229(is)S +4335(to)S +4452(allow)S +4713(a)S +4796(client)S +5057(to)S +5174(display)S +5502(to)S +4152 V +1260(this)S +1436(program)S +1805(which)S +2080(then)S +2283(re-displays)S +2752(to)S +2861(each)S +3074(of)S +3188(the)S +3341(other)S +3577(named)S +3874(servers.)S +4241(A)S +4343(maximum)S +4779(of)S +4892(8)S +4972(servers)S +5284(may)S +5486(be)S +4272 V +1260(named,)S +1594(they)S +1809(may)S +2024(be)S +2161(either)S +2431(on)S +2574(the)S +2740(local)S +2978(host)S +3189(or)S +3316(a)S +3404(remote)S +3725(machine)S +4107(and)S +4295(connections)S +4816(can)S +4998(be)S +5136(established)S +4392 V +1260(using)S +1507(either)S +1764(\256fos)S +1972(or)S +2085(sockets.)S +2464(See)S +2638(below)S +2912(for)S +3058(details)S +3349(on)S +3479(how)S +3681(to)S +3789(specify)S +4107(the)S +4259(server)S +4532(connection.)S +4632 V +1260(The)S +1445(current)S +1757(implementation)S +2415(has)S +2578(a)S +2652(few)S +2831(restrictions)S +3305(users)S +3540(should)S +3837(keep)S +4055(in)S +4163(mind:)S +4800 V +1620(Cursor)S +1924(and)S +2100(image)S +2376(readback)S +2767(are)S +2920(done)S +3146(by)S +3278(sending)S +3621(the)S +3775(request)S +10 I +4095(only)S +10 R +4299(to)S +4409(the)S +4563(\256rst)S +4751(server)S +5026(named)S +5325(on)S +5458(the)S +4920 V +1620(command)S +2049(line.)S +2289(This)S +2502(is)S +2604(done)S +2833(to)S +2946(avoid)S +3203(forcing)S +3526(a)S +3605(cursor)S +3889(mode)S +4146(on)S +4281(all)S +4416(servers)S +4733(which)S +5012(cannot)S +5313(be)S +5442(ter-)S +5040 V +1620(minated)S +1973(when)S +2220(a)S +2295(response)S +2675(is)S +2773(received)S +3141(from)S +3366(only)S +3576(one)S +3752(server,)S +4052(and)S +4228(means)S +4515(that)S +4697(the)S +4851(\256rst)S +5039(server)S +5314(named)S +5160 V +1620(should)S +1924(be)S +2055(the)S +2214(one)S +2395(used)S +2615(to)S +2730(control)S +3050(interactive)S +3507(sessions.)S +3926(The)S +4117(remaining)S +4558(servers)S +4876(however)S +5255(can)S +5429(still)S +5280 V +1620(respond)S +1966(to)S +2074(cursor)S +2353(requests)S +2710(from)S +2934(other)S +3169(applications)S +3682(connected)S +4116(to)S +4224(that)S +4404(server)S +4677(on)S +4807(another)S +5136(channel.)S +5448 V +1620(All)S +1792(named)S +2102(servers)S +2428(must)S +2667(be)S +2805(running)S +3160(prior)S +3398(to)S +3520(starting)S +3864(the)S +4031(proxy)S +4309(server.)S +4652(The)S +4852(connection)S +5335(to)S +5458(the)S +5568 V +1620(remote)S +1934(servers)S +2253(is)S +2357(established)S +2838(when)S +3091(this)S +3273(task)S +3471(is)S +3575(\256rst)S +3768(run)S +3937(and)S +4117(if)S +4214(no)S +4350(server)S +4629(is)S +4732(running)S +5079(that)S +5265(connec-)S +5688 V +1620(tion)S +1806(will)S +1992(be)S +2116(ignored.)S +2506(The)S +2691(task)S +2882(will)S +3068(exit)S +3248(if)S +3339(no)S +3469(remote)S +3776(servers)S +4088(can)S +4256(be)S +4380(found)S +4643(for)S +4789(display.)S +5856 V +1620(Any)S +1832(connected)S +2276(server)S +2559(that)S +2749(shuts)S +2995(down)S +3257(while)S +3519(the)S +3682(proxy)S +3956(server)S +4240(is)S +4348(running)S +4700(is)S +4808(likely)S +5077(to)S +5196(cause)S +5458(the)S +5976 V +1620(program)S +1988(to)S +2096(crash)S +2336(on)S +2466(the)S +2618(next)S +2820(display.)S +6264 V +9 B +900(SPECIFYING)S +1482(THE)S +1699(REMOTE)S +2126(SERVER)S +2518(CONNECTION)S +6384 V +10 R +1260(The)S +1445(syntax)S +1736(for)S +1882(the)S +2034(server)S +2307(argument)S +2714(used)S +2927(in)S +3035(proxy)S +3298(mode)S +3550(is)S +3647(as)S +3760(follows:)S +6624 V +10 I +1620()S +2086(:)S +2149(
)S +6864 V +10 R +1260(where)S +1539()S +1988(is)S +2092(one)S +2273(of)S +10 B +2393(inet)S +10 R +2591(\(internet)S +2966(tcp/ip)S +3231(socket\),)S +10 B +3581(unix)S +10 R +3808(\(unix)S +4056(domain)S +4393(socket\))S +4718(or)S +10 B +4838(\256fo)S +10 R +5014(\(named)S +5350(pipe\).)S +6984 V +1260(The)S +1445(form)S +1669(of)S +1782(the)S +1934(address)S +2263(depends)S +2620(upon)S +2850(the)S +3002(domain,)S +3357(as)S +3470(illustrated)S +3900(in)S +4008(the)S +4160(examples)S +4567(below.)S +7272 V +1260(inet:5137)S +2760(Connect)S +3123(to)S +3231(port)S +3422(5137)S +3652(on)S +3782(the)S +3934(local)S +4158(host.)S +7752 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(3)S +7920 V +EP +%%Page: 4 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(inet:5137:foo.bar.edu)S +2760(Client)S +3055(connection)S +3543(to)S +3671(port)S +3882(5137)S +4133(on)S +4284(internet)S +4640(host)S +10 I +4858(foo.bar.edu)S +10 R +5319(.)S +5425(The)S +1080 V +2760(dotted)S +3040(\(numeric\))S +3463(form)S +3687(of)S +3800(address)S +4129(may)S +4331(also)S +4522(be)S +4646(used.)S +1248 V +1260(unix:/tmp/.IMT212)S +2760(Unix)S +3010(domain)S +3360(socket)S +3665(with)S +3893(the)S +4066(given)S +4339(pathname.)S +4803(IPC)S +5010(method,)S +5386(local)S +1368 V +2760(host)S +2957(only.)S +1536 V +1260(\256fo:/dev/imt1i:/dev/imt1o)S +2760(FIFO)S +3021(or)S +3148(named)S +3458(pipe)S +3674(with)S +3896(the)S +4062(given)S +4328(pathname.)S +4815(IPC)S +5016(method,)S +5386(local)S +1656 V +2760(host)S +2969(only.)S +3244(Two)S +3469(pathnames)S +3938(are)S +4101(required,)S +4500(one)S +4686(for)S +4844(input)S +5092(and)S +5278(one)S +5464(for)S +1776 V +2760(output,)S +3071(since)S +3306(FIFOs)S +3592(are)S +3743(not)S +3901(bidirectional.)S +1944 V +1260(The)S +1450(address)S +1784(\256eld)S +1997(may)S +2204(contain)S +2533(up)S +2668(to)S +2781(two)S +2966("%d")S +3216(\256elds.)S +3523(If)S +3624(present,)S +3972(the)S +4129(user's)S +4402(UID)S +4614(will)S +4805(be)S +4934(substituted)S +5403(\(e.g.)S +2064 V +1260("unix:/tmp/.IMT%d"\).)S +2352 V +9 B +900(EXAMPLES)S +2472 V +10 R +1260(1\))S +1373(Run)S +1570(the)S +1722(vximtool,)S +2139(logging)S +2475(output)S +2761(to)S +2869(the)S +3021(\256le)S +3179(named)S +3475("spool":)S +2712 V +10 C +1750(%)S +1870(vximtool)S +2410(-verbose)S +2950(>&)S +3130(spool)S +2880 V +10 R +1260(2\))S +1373(Run)S +1570(the)S +1722(vximtool)S +2114(in)S +2222(the)S +2374(background,)S +2900(connect)S +3240(only)S +3448(on)S +3578(unix)S +3786(sockets,)S +4135(no)S +4265(output:)S +3120 V +10 C +1750(%)S +1870(vximtool)S +2410(-b)S +2590(-unix_only)S +3250(&)S +3288 V +10 R +1260(3\))S +1373(Don't)S +1636(store)S +1860(images)S +2173(in)S +2281(memory,)S +2669(start)S +2871(with)S +3079(initial)S +3343(1024x1024)S +3823(frame)S +4085(bu)S +4185 H + (f)show 10 -.5 mul h (f)show +10 R +4246(er:)S +3528 V +10 C +1750(%)S +1870(vximtool)S +2410(-noraster)S +3010(-config)S +3490(3)S +3696 V +10 R +1260(4\))S +1373(Run)S +1570(the)S +1722(vximtool)S +2114(in)S +2222(the)S +2374(background,)S +2900(taking)S +3180(cursor)S +3459(input)S +3695(from)S +3919(a)S +3993(\256le:)S +3936 V +10 C +1750(%)S +1870(vximtool)S +2410(-i)S +2590(<)S +2710(cursor_file)S +3430(&)S +4104 V +10 R +1260(5\))S +1373(Run)S +1570(as)S +1683(a)S +1757(proxy)S +2020(server,)S +2318(displaying)S +2765(to)S +2873(both)S +3081(a)S +3155(local)S +3379(and)S +3553(a)S +3627(remote)S +3934(XImtool,)S +4328(log)S +4486(output)S +4772(to)S +4880(stderr:)S +4344 V +10 I +1750(...start)S +2039(all)S +2175(XImtool)S +2527(servers)S +2845(to)S +2953(be)S +3077(used)S +4464 V +10 C +1750(%)S +1870(vximtool)S +2410(-v)S +2590(-proxy)S +3010(unix:/tmp/.IMT%d)S +4030(inet:5137:pisces)S +4584 V +1750(Connected)S +2350(to)S +2530(server)S +2950(on)S +3130(unix:/tmp/.IMT359)S +4704 V +1750(Connected)S +2350(to)S +2530(server)S +2950(on)S +3130(inet:5137:pisces)S +4824 V +1750(Open)S +2050(to)S +2230(accept)S +2650(input)S +3010(on)S +3190(inet:)S +3550(port)S +3850(5136)S +5112 V +10 R +1260(To)S +1407(display)S +1732(to)S +1846(the)S +2004(proxy)S +2273(server)S +2552(the)S +2710(client)S +2969(should)S +3273(connect)S +3620(to)S +3735(the)S +3894(vximtool)S +4293(on)S +10 I +4430(inet:5136)S +10 R +4813(,)S +4875(the)S +5034(proxy)S +5304(in)S +5419(turn)S +5232 V +1260(will)S +1463(relay)S +1709(data)S +1922(to)S +2047(the)S +2216(servers)S +2545(listed)S +2809(on)S +2956(the)S +3125(command)S +3566(line.)S +3818(Note)S +4059(that)S +4256(in)S +4381(this)S +4572(last)S +4757(example)S +5141(any)S +5331(cursor)S +5352 V +1260(requests)S +1626(from)S +1859(the)S +2020(client)S +2281(connected)S +2724(to)S +2841(the)S +3002(vximtool)S +3403(will)S +3598(be)S +3731(handled)S +4086(by)S +4225(the)S +4386(ximtool)S +4737(connected)S +5180(on)S +5319(a)S +5402(unix)S +5472 V +1260(socket)S +1554(on)S +1693(the)S +1854(local)S +2087(machine)S +2464(\(i.e.)S +2658(the)S +2819(\256rst)S +3014(server)S +3296(argument\).)S +3800(The)S +3994(remote)S +4310(ximtool)S +4661(on)S +4800(the)S +4960(machine)S +5336(pisces)S +5592 V +1260(could)S +1516(simultaneously)S +2156(be)S +2284(used)S +2501(by)S +2635(another)S +2968(client)S +3224(on)S +3358(that)S +3542(machine)S +3914(connected)S +4352(by)S +4486(some)S +4732(other)S +4972(means.)S +5317(In)S +5435(this)S +5712 V +1260(case)S +1476(it)S +1576(will)S +1776(only)S +1998(display)S +2331(images)S +2658(coming)S +3002(from)S +3240(the)S +10 I +3406(vximtool)S +10 R +3794(proxy,)S +4096(but)S +4268(could)S +4534(be)S +4672(used)S +4899(in)S +5021(an)S +5159(interactive)S +5832 V +1260(IRAF)S +1518(session)S +1837(running)S +2178(on)S +2308(pisces)S +2582(to)S +2690(examine)S +3058(the)S +3210(images.)S +6120 V +9 B +900(SEE)S +1112(ALSO)S +6240 V +10 R +1260(ximtool\(1\))S +6360 V +10 I +1260(A)S +1351(Reference)S +1779(Guide)S +2053(for)S +2200(the)S +2352(IRAF)S +2598(Client)S +2873(Display)S +3214(Library)S +3550(\(CDL\))S +6528 V +9 B +900(COPYRIGHT)S +6648 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(4)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier +%%Pages: 4 + \ No newline at end of file diff --git a/vendor/x11iraf/doc/xgterm.ps b/vendor/x11iraf/doc/xgterm.ps new file mode 100644 index 00000000..f3615da4 --- /dev/null +++ b/vendor/x11iraf/doc/xgterm.ps @@ -0,0 +1,7083 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Mon Apr 10 21:27:16 2000 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +%% Troff special characters not on Symbol font +%% Copyright (C) 1986 by Pipeline Associates, Inc. +%% Version 1.1 +/altRTD 20 dict def +altRTD begin +/s{setcachedevice}def +/C{1000 1000 scale}def +/m{moveto}def +/c{curveto}def +/S{stroke}def +/l{lineto}def +/a{arcto}def +/p{pop}def +/sl{setlinewidth}def +end +/F_Troff 17 dict def F_Troff begin +systemdict /currentpacking known +{/SavePacking currentpacking def true setpacking}if +/PaintType 0 def +/FontType 3 def +/StrokeWidth 0 def +/UniqueID 8277003 def +/FontMatrix [.001000 0 0 .001000 0 0] def +/FontBBox [-12 -105 942 855 ] def +/Encoding 256 array def +/CD 256 1 add dict def +/FontInfo 3 dict def FontInfo begin +/UnderlinePosition -133 def /UnderlineThickness 20 def end +/FontName (Troff) def +0 1 256 1 sub{Encoding exch /.notdef put}for +CD /.notdef{500 0 setcharwidth{}}put +Encoding (1) 0 get /br put +%% bold vertical rule used by tbl +CD /br{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +0 .9 l +{S} +}put +Encoding (2) 0 get /ul put +%% underline used by tbl +CD /ul{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +.5 -.1 l +{S} +}put +Encoding (3) 0 get /ru put +%% baseline rule +CD /ru{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +m0 +.5 0 l +{S} +}put +Encoding (4) 0 get /vr put +%% vertical rule +CD /vr{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +m0 +0 1 l +{S} +}put +Encoding (5) 0 get /sq put +%% square +CD /sq{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{S} +}put +Encoding (6) 0 get /bx put +%% solid box +CD /bx{ +C +.5 0 -.5 -.5 1 1 s +np +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{fill} +}put +Encoding (7) 0 get /rn put +%% radical extender +CD /rn{ +C +.5 0 -.5 -.5 1 1 s +np +.03 sl +-.03 .9 m +.5 0 rl +{S} +}put +Encoding (8) 0 get /GR put +%% gray mask +CD /GR{ +C +.5 0 setcharwidth +.5 setgray +np +0 -.1 m +0 1 rl +.5 0 rl +0 -1 rl +-.5 0 rl +closepath +{fill} +}put +Encoding 97 /a put +CD /a{1000 0 0 66 942 421 s 430 415 +m 578 406 678 349 662 319 c 655 306 614 287 583 +296 c 570 300 466 340 438 332 c 365 309 335 213 +270 209 c 0 310 m 108 310 l 108 114 l 0 +114 l 0 310 l 42 161 m 42 134 l 66 134 l 66 +161 l 42 161 l 47 155 m 47 140 l 62 140 l 62 +155 l 47 155 l 110 133 m 226 113 300 66 410 +80 c 497 91 550 69 634 76 c 645 76 663 92 669 +107 c 677 125 673 141 668 160 c 725 334 m 758 +332 734 253 701 250 c 501 325 m 475 316 476 309 +473 302 c 465 282 482 263 499 257 c 552 236 615 +253 689 253 c 701 253 713 236 713 218 c 712 194 +702 168 678 161 c 671 159 663 160 655 160 c 591 +158 516 156 479 168 c 461 173 453 191 453 210 c 453 +224 456 235 466 244 c 476 253 490 252 503 255 c 459 +84 m 447 96 435 106 435 123 c 435 136 440 145 447 +155 c 453 163 462 168 469 173 c 110 293 m 173 +318 300 421 435 415 c 609 407 852 416 885 411 c 898 +409 924 411 930 380 c 942 316 828 339 742 334 c 731 +334 730 335 725 335 c 701 336 685 336 660 336 c{S}}put +Encoding 98 /b put +CD /b{1000 0 -12 66 930 421 s 500 +415 m 352 406 252 349 268 319 c 275 306 316 287 +347 296 c 360 300 464 340 492 332 c 565 309 595 +213 660 209 c 930 310 m 822 310 l 822 114 l 930 +114 l 930 310 l 888 161 m 888 134 l 864 134 +l 864 161 l 888 161 l 883 155 m 883 140 l 868 +140 l 868 155 l 883 155 l 820 133 m 704 113 +630 66 520 80 c 433 91 380 69 296 76 c 285 76 +267 92 261 107 c 253 125 257 141 262 160 c 205 +334 m 172 332 196 253 229 250 c 429 325 m 455 +316 454 309 457 302 c 465 282 448 263 431 257 c 378 +236 315 253 241 253 c 229 253 217 236 217 218 c 218 +194 228 168 252 161 c 259 159 267 160 275 160 c 339 +158 414 156 451 168 c 469 173 477 191 477 210 c 477 +224 474 235 464 244 c 454 253 440 252 427 255 c 471 +84 m 483 96 495 106 495 123 c 495 136 490 145 483 +155 c 477 163 468 168 461 173 c 820 293 m 757 +318 630 421 495 415 c 321 407 78 416 45 411 c 32 +409 6 411 0 380 c -12 316 102 339 188 334 c 199 +334 200 335 205 335 c 229 336 245 336 270 336 c{S}}put +Encoding 99 /c put +CD /c{1000 0 184 0 827 627 s 185 315 +m 186 488 332 627 505 625 c 682 623 827 467 815 +290 c 804 124 666 0 500 0 c 327 0 184 142 185 +315 c{S}}put +Encoding 100 /d put +CD /d{590 0 134 158 477 500 s 300 +160 m 208 162 134 238 135 330 c 136 423 212 500 +305 500 c 397 500 473 427 475 335 c 477 239 396 +158 300 160 c{fill}}put +Encoding 101 /e put % Bell Symbol +CD /e{1010 0 -100 -210 1010 1010 s 100 sl 0 setlinecap +420 300 450 0 360 arc +420 650 m 420 575 l S +newpath 120 125 m 720 125 l 75 sl S +420 125 m 420 25 l S +220 400 m 220 175 120 175 100 a p p p p +220 400 m 220 550 420 550 80 a p p p p +620 400 m 620 175 720 175 100 a p p p p +620 400 m 620 550 420 550 80 a p p p p +295 550 m 545 550 l{S}}put +/BuildChar{altRTD /BuildChar get exec}def end +altRTD begin /BuildChar{altRTD begin +/char exch def /fontdict exch def save +/charname fontdict /Encoding get char get def +fontdict /StrokeWidth get sl +fontdict /CD get dup charname known +{charname}{/.notdef}ifelse get newpath exec +fontdict /PaintType get 0 eq{exec}{p S}ifelse +restore end}def end +systemdict /currentpacking known{F_Troff /SavePacking get setpacking}if +/Troff F_Troff definefont pop +/Y1{/Troff FF}def +/Y{/Symbol FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +120 V +1260(#)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(1)S +7920 V +EP +%%Page: 1 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(xgterm)S +1573(\261)S +1653(terminal)S +2016(emulator)S +2401(for)S +2547(X)S +2649(with)S +2857(graphics)S +3225(and)S +3399(imaging)S +3757(capability)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(xgterm)S +10 R +1594([\261)S +10 I +1677(toolkitoption)S +10 R +2219(...])S +2357([\261)S +10 I +2440(option)S +10 R +2726(...])S +1536 V +9 B +900(DESCRIPTION)S +1656 V +10 R +1260(The)S +10 I +1449(xgterm)S +10 R +1760(program)S +2132(is)S +2233(a)S +2311(terminal)S +2678(emulator)S +3067(for)S +3217(the)S +3373(X)S +3480(Window)S +3859(System)S +4189(based)S +4451(largely)S +4763(on)S +10 I +4898(xterm)S +10 R +5160(but)S +5323(with)S +5536(a)S +1776 V +1260(completely)S +1745(new)S +1952(graphics)S +2331(and)S +2516(imaging)S +2885(widget.)S +3223(It)S +3325(provides)S +3710(DEC)S +3951(VT102)S +4275(and)S +4460(Tektronix)S +4895(4014)S +5136(compatible)S +1896 V +1260(terminals)S +1665(for)S +1814(programs)S +2224(that)S +2407(can't)S +2639(use)S +2806(the)S +2962(window)S +3318(system)S +3630(directly.)S +10 I +4024(XGterm)S +10 R +4374(also)S +4569(serves)S +4852(as)S +4969(a)S +5047(prototype)S +5464(for)S +2016 V +1260(the)S +10 I +1417(Widget)S +1735(Server)S +10 R +2030(being)S +2287(developed)S +2732(by)S +2867(the)S +3024(IRAF)S +3287(Project)S +3605(at)S +3712(NOAO.)S +4089(The)S +10 I +4278(Object)S +4578(Manager)S +4978(Library)S +10 R +5318(it)S +5408(uses)S +2136 V +1260(implements)S +1777(a)S +1872(window)S +2245(system)S +2574(toolkit)S +2887(as)S +3021(an)S +3166(interpreted)S +3649(window-object)S +4299(language,)S +4735(allowing)S +5136(application)S +2256 V +1260(GUIs)S +1514(to)S +1630(be)S +1762(de\256ned)S +2094(and)S +2276(executed)S +2668(at)S +2778(runtime)S +3126(without)S +3469(compiling)S +3912(any)S +4093(code,)S +4343(and)S +4524(with)S +4739(minimal)S +5110(dependence)S +2376 V +1260(upon)S +1496(the)S +1654(underlying)S +2123(window)S +2481(system)S +2795(toolkit)S +3093(library.)S +3450(We)S +3624(will)S +3816(concentrate)S +4311(here,)S +4543(however,)S +4947(on)S +5083(it's)S +5247(use)S +5416(as)S +5536(a)S +2496 V +1260(terminal)S +1623(emulator)S +2008(and)S +2182(a)S +2256(description)S +2730(of)S +2843(the)S +2995(new)S +10 I +3191(Gterm)S +10 R +3476(widget.)S +2664 V +1260(The)S +1460(Gterm)S +1760(graphics)S +2143(window)S +2510(operates)S +2887(almost)S +3199(identically)S +3666(to)S +3790(the)S +10 I +3958(xterm)S +10 R +4231(Tek)S +4432(window,)S +4825(however)S +5214(there)S +5459(are)S +2784 V +1260(extensions)S +1729(for)S +1892(implementing)S +2495(full-screen)S +2968(cursors,)S +3328(imaging,)S +3728(area)S +3940(\256lls,)S +4163(colors,)S +4479(graphics)S +4863(erasure,)S +5221(a)S +5311("status)S +2904 V +1260(line")S +1482(and)S +1657(so)S +1778(on.)S +1965(Any)S +2169(graphics)S +2539(application)S +3015(capable)S +3351(of)S +3466(running)S +3809(under)S +4068(an)S +10 I +4194(xterm)S +10 R +4453(Tek)S +4640(window)S +4994(should)S +5293(also)S +5486(be)S +3024 V +1260(able)S +1458(to)S +1568(use)S +10 I +1733(xgterm)S +10 R +2042(as)S +2157(well.)S +2416(Client)S +2693(programs)S +3102(wishing)S +3451(to)S +3561(make)S +3809(use)S +3973(of)S +4087(the)S +4240(extended)S +4631(features,)S +5002(or)S +5116(those)S +5358(wish-)S +3144 V +1260(ing)S +1418(to)S +1526(implement)S +1984(a)S +2058(GUI,)S +2291(are)S +2443(advised)S +2779(to)S +2888(use)S +3052(the)S +3205(OBM)S +3464(\()S +10 I +3497(Object)S +3794(Manager)S +10 R +4160(\))S +4224(library)S +4521(supplied)S +4891(with)S +5100(the)S +5253(XGterm)S +3264 V +1260(source)S +1552(as)S +1667(part)S +1854(of)S +1968(the)S +2121(X11IRAF)S +2552(package.)S +2964(This)S +3173(provides)S +3548(a)S +3623(much)S +3876(better)S +4134(programmatic)S +4725(interface)S +5104(to)S +5213(all)S +5344(of)S +5458(the)S +3384 V +1260(features)S +1615(available;)S +2043(however,)S +2451(as)S +2574(of)S +2697(this)S +2882(writing)S +3211(it)S +3307(is)S +3414(not)S +3582(yet)S +3744(fully)S +3973(documented.)S +4556(Users)S +4823(are)S +4984(referred)S +5339(to)S +5458(the)S +3504 V +10 I +1260(XImtool)S +10 R +1616(task)S +1810(as)S +1926(an)S +2053(example)S +2424(of)S +2540(a)S +2617(more)S +2855(complex)S +3232(application)S +3709(using)S +3959(the)S +10 I +4114(OBM)S +4363(Library)S +10 R +4702(and)S +10 I +4879(Gterm)S +10 R +5167(widget,)S +5497(as)S +3624 V +1260(well)S +1466(as)S +1583(demo)S +1839(tasks)S +2073(in)S +2185(the)S +10 I +2341(guidemo)S +10 R +2719(directory)S +3114(of)S +3232(the)S +3389(X11IRAF)S +3824(sources.)S +4213(Questions)S +4648(or)S +4766(comments)S +5212(may)S +5419(also)S +3744 V +1260(be)S +1384(sent)S +1575(to)S +10 I +1683(iraf@noao.edu)S +10 R +2289(.)S +3912 V +1260(The)S +1473(VT102)S +1814(text)S +2022(window)S +2402(is)S +2527(unchanged)S +3017(from)S +3269(the)S +3449(original)S +10 I +3819(xterm)S +10 R +4105(application.)S +4663(All)S +4850(of)S +4992(it's)S +5179(resources,)S +4032 V +1260(command-line)S +1872(options)S +2202(and)S +2381(operation)S +2793(are)S +2949(identical)S +3328(to)S +3441(that)S +3626(used)S +3844(by)S +10 I +3979(xterm)S +10 R +4206(.)S +4296(The)S +10 I +4486(termcap\(5\))S +10 R +4964(entry)S +5203(for)S +10 I +5353(xterm)S +4152 V +10 R +1260(may)S +1462(be)S +1586(used)S +1799(for)S +10 I +1945(xgterm)S +10 R +2252(as)S +2365(well.)S +2622(See)S +2796(the)S +10 I +2948(xterm\(1\))S +10 R +3321(man)S +3523(page)S +3741(for)S +3887(details.)S +4320 V +9 B +900(OPTIONS)S +4440 V +10 R +1260(All)S +10 I +1418(xterm\(1\))S +10 R +1791(and)S +1965(X)S +2067(Toolkit)S +2392(command)S +2816(line)S +2996(options)S +3321(are)S +3472(supported,)S +3921(there)S +4150(are)S +4301(no)S +4431(additional)S +4861(options.)S +4608 V +9 B +900(RESOURCES)S +4728 V +10 R +1260(The)S +1447(program)S +1817(understands)S +2326(all)S +2458(of)S +2573(the)S +2727(core)S +2930(X)S +3035(Toolkit)S +3363(resource)S +3733(names)S +4021(and)S +4198(classes,)S +4533(all)S +4666(text)S +4849(window)S +5204(resources)S +4848 V +1260(known)S +1578(to)S +10 I +1701(xterm\(1\))S +10 R +2044(,)S +2114(as)S +2242(well)S +2459(as)S +2587(the)S +10 I +2754(Gterm)S +10 R +3054(\(graphics)S +3470(and)S +3659(imaging)S +4032(widget\))S +4382(resources.)S +4858(The)S +5058(proper)S +5363(Class)S +4968 V +1260(name)S +1513(for)S +1666(all)S +1803(resources)S +2216(described)S +2635(here)S +2843(is)S +10 I +2947(Gterm)S +10 R +3202(.)S +3294(A)S +3403(table)S +3635(of)S +3756(available)S +10 I +4154(Gterm)S +10 R +4447(resources)S +4861(and)S +5043(their)S +5264(defaults)S +5088 V +1260(may)S +1462(be)S +1586(found)S +1849(below,)S +2148(some)S +2389(of)S +2502(the)S +2654(more)S +2889(interesting)S +3341(resources)S +3747(are)S +3898(described)S +4310(here)S +4511(in)S +4619(detail:)S +5256 V +10 I +1260(basePixel)S +5376 V +10 R +1510(Base)S +1743(cell)S +1926(of)S +2049(the)S +2211(custom)S +2540(colormap.)S +3012(This)S +3230(essentially)S +3692(allows)S +3993(you)S +4183(to)S +4301(reserve)S +10 I +4628(basePixel)S +10 R +5056(colors)S +5340(in)S +5458(the)S +5496 V +1510(global)S +1793(colormap)S +2203(for)S +2352(other)S +2590(applications.)S +3161(The)S +3349(default)S +3659(is)S +3758(38,)S +3915(if)S +4008(changed)S +4372(you'll)S +4643(need)S +4863(to)S +4973(also)S +5166(enable)S +5458(the)S +5616 V +10 I +1510(cmapInitialize)S +10 R +2116(resource)S +2487(to)S +2599(force)S +2838(the)S +2995(Gterm)S +3285(widget)S +3592(to)S +3705(update)S +4006(it's)S +4169(global)S +4454(colormap)S +4866(resource)S +5238(in)S +5351(the)S +5508(X)S +5736 V +1510(server.)S +5904 V +10 I +1260(cmapInitialize)S +6024 V +10 R +1510(Initialize)S +1901(the)S +2059(ximtool)S +2407(colormap)S +2820(at)S +2928(startup.)S +3291(When)S +3565(resetting)S +3945(the)S +10 I +4103(basePixel)S +10 R +4527(resource)S +4901(or)S +5021(colormap)S +5435(this)S +6144 V +1510(is)S +1621(required)S +1997(in)S +2119(order)S +2373(to)S +2495(force)S +2743(the)S +2909(Gterm)S +3208(widget)S +3524(to)S +3646(update)S +3956(it's)S +4128(global)S +4422(colormap)S +4842(resource)S +5222(in)S +5343(the)S +5508(X)S +6264 V +1510(server.)S +1838(The)S +2023(default)S +2330(is)S +2427(False.)S +6432 V +10 I +1260(cmapInterpolate)S +6552 V +10 R +1510(Interpolate)S +1972(the)S +2124(colormap)S +2531(to)S +2639(the)S +2791(number)S +3126(of)S +3239(display)S +3558(colors.)S +3887(The)S +4072(default)S +4379(is)S +4476(True.)S +6720 V +10 I +1260(cmapName)S +6840 V +10 R +1510(Name)S +1784(used)S +2003(for)S +2156(private)S +2470(colormap.)S +2939(The)S +3131(default)S +3445(for)S +3598(all)S +3735(IRAF)S +4000(imaging)S +4365(applications)S +4885(is)S +10 I +4989(image)S +10 R +5233(.)S +5325(Gterm)S +6960 V +1510(widget)S +1822(based)S +2089(imaging)S +2457(applications)S +2980(which)S +3264(have)S +3492(the)S +3654(same)S +3899(value)S +4155(of)S +4277(cmapName)S +4770(will)S +4965(share)S +5214(the)S +5375(same)S +7080 V +1510(colormap,)S +1950(minimizing)S +2450(colormap)S +2865(\257ashing)S +3220(and)S +3402(allowing)S +3790(multiple)S +4162(applications)S +4683(to)S +4799(be)S +4931(run)S +5103(at)S +5214(the)S +5375(same)S +7200 V +1510(time.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(1)S +7920 V +EP +%%Page: 2 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 I +1260(color0)S +1080 V +10 R +1510(The)S +1695(widget)S +1997(background)S +2498(color.)S +2788(The)S +2973(default)S +3280(is)S +3377(black.)S +1248 V +10 I +1260(color1)S +1368 V +10 R +1510(The)S +1695(widget)S +1997(foreground)S +2470(color.)S +2760(The)S +2945(default)S +3252(is)S +3349(white.)S +1536 V +10 I +1260(color2)S +10 R +1581(thru)S +10 I +1802(color9)S +1656 V +10 R +1510(Optional)S +1892(drawing)S +2251(colors.)S +2582(The)S +2769(line)S +2951(color)S +3189(used)S +3405(for)S +3554(graphics)S +3925(is)S +4025(set)S +4169(using)S +4419(an)S +4546(escape)S +4844(sequence)S +5242(to)S +5353(select)S +1776 V +1510(the)S +1662(current)S +1974(color)S +2209(index.)S +2516(See)S +10 I +2690(Gterm)S +2975(I/O)S +3138(Escape)S +3456(Sequences)S +10 R +3901(below)S +4175(for)S +4321(more)S +4556(details.)S +1944 V +10 I +1260(crosshairCursorColor)S +2064 V +10 R +1510(Color)S +1768(of)S +1881(the)S +2033(full)S +2202(screen)S +2486(crosshair)S +2876(cursor.)S +2232 V +10 I +1260(defaultMarker)S +2352 V +10 R +1510(Default)S +1867(marker)S +2208(type.)S +2494(Options)S +2870(include)S +10 I +3223(text)S +10 R +3367(,)S +10 I +3451(line)S +10 R +3601(,)S +10 I +3685(polyline)S +10 R +4007(,)S +10 I +4091(rectangle)S +10 R +4468(,)S +10 I +4552(box)S +10 R +4696(,)S +10 I +4780(circle)S +10 R +5007(,)S +10 I +5091(ellipse)S +10 R +5352(,)S +5436(and)S +2472 V +10 I +1510(polygon)S +10 R +1832(.)S +1917(The)S +2102(default)S +2409(is)S +10 I +2506(rectangle)S +10 R +2883(.)S +2640 V +10 I +1260(deiconifyWindow)S +2760 V +10 R +1510(De-iconify)S +1972(the)S +2124(Gterm)S +2409(graphics)S +2777(window)S +3129(when)S +3375(activated.)S +3820(The)S +4005(default)S +4312(is)S +4409(False.)S +2928 V +10 I +1260(dialogBgColor)S +3048 V +10 R +1510(Dialog)S +1817(box)S +2002(\(i.e.)S +2192(the)S +2349(status)S +2612(line\))S +2830(background)S +3336(color.)S +3631(Dialog)S +3938(text)S +4123(is)S +4225(text)S +4410(which)S +4689(is)S +4791(drawn)S +5075(into)S +5267(the)S +5425(dia-)S +3168 V +1510(log)S +1670(area)S +1867(at)S +1971(the)S +2124(bottom)S +2439(of)S +2553(the)S +2706(gterm)S +2970(window,)S +3348(it)S +3435(is)S +3533(transient)S +3908(and)S +4083(is)S +4181(not)S +4340(a)S +4415(permanent)S +4867(part)S +5053(of)S +5167(the)S +5320(graph-)S +3288 V +1510(ics)S +1654(being)S +1909(drawn.)S +2246(Dialog)S +2551(text)S +2734(is)S +2834(normally)S +3228(used)S +3444(to)S +3555(interact)S +3887(with)S +4098(the)S +4253(user)S +4452(or)S +4568(to)S +4680(display)S +5003(messages)S +5414(dur-)S +3408 V +1510(ing)S +1668(program)S +2036(operation,)S +2468(without)S +2804(a)S +2848 H + (f)show 10 -.5 mul h (f)show +10 R +2909(ecting)S +3183(the)S +3335(graphics)S +3703(being)S +3955(drawn.)S +3576 V +10 I +1260(dialogFgColor)S +3696 V +10 R +1510(Dialog)S +1812(box)S +1992(\(i.e.)S +2177(status)S +2435(line\))S +2648(foreground)S +3121(color.)S +3864 V +10 I +1260(ginmodeBlinkInterval)S +3984 V +10 R +1510(Graphics)S +1900(cursor)S +2179(blink)S +2415(interval,)S +2775(time)S +2983(is)S +3080(speci\256ed)S +3465(in)S +3573(milliseconds.)S +4164(The)S +4349(default)S +4656(is)S +4753(0.)S +4152 V +10 I +1260(ginmodeCursor)S +4272 V +10 R +1510(Graphics)S +1900(mode)S +2152(cursor)S +2431(type.)S +2688(The)S +2873(default)S +3180(is)S +3277(a)S +3351(full)S +3520(screen)S +3804(cursor)S +4083(custom)S +4402(to)S +4510(the)S +4662(widget.)S +4440 V +10 I +1260(height)S +4560 V +10 R +1510(Height)S +1812(of)S +1925(the)S +2077(Gterm)S +2362(window.)S +2769(The)S +2954(default)S +3261(is)S +3358(480.)S +4728 V +10 I +1260(idleCursor)S +4848 V +10 R +1510(Cursor)S +1812(to)S +1920(use)S +2083(when)S +2329(not)S +2487(in)S +2595(graphics)S +2963(mode.)S +3270(The)S +3455(default)S +3762(is)S +3859(a)S +3933(plus)S +4130(sign.)S +5016 V +10 I +1260(markerHighlightColor)S +5136 V +10 R +1510(Highlight)S +1926(color)S +2163(for)S +2311(the)S +2465(active)S +2735(marker.)S +3104(When)S +3374(the)S +3528(pointer)S +3843(moves)S +4136(into)S +4324(a)S +4400(marker)S +4714(is)S +4814(it)S +4903(marked)S +5235("active",)S +5256 V +1510(the)S +1662(highlight)S +2054(color)S +2289(and)S +2463(width)S +2721(change)S +3033(to)S +3141(which)S +3415(marker)S +3727(is)S +3824(active.)S +4147(The)S +4332(default)S +4639(is)S +4736(green.)S +5424 V +10 I +1260(markerHighlightWidth)S +5544 V +10 R +1510(Highlight)S +1924(width)S +2182(for)S +2328(the)S +2480(active)S +2748(marker.)S +3085(The)S +3270(default)S +3577(is)S +3674(2.)S +5712 V +10 I +1260(maxColors)S +5832 V +10 R +1510(The)S +1702(maximum)S +2145(number)S +2487(of)S +2607(colors)S +2888(to)S +3003(use)S +3173(in)S +3288(the)S +3447(private)S +3761(global)S +4048(colormap,)S +4487(the)S +4646(default)S +4961(is)S +5066(216.)S +5309(Out)S +5497(of)S +5952 V +1510(this)S +1686(number)S +2022(10)S +2153(colors)S +2427(\(the)S +10 I +2612(color0)S +10 R +2903(thru)S +10 I +3094(color9)S +10 R +3385(values\))S +3703(are)S +3854(reserved)S +4221(by)S +4351(the)S +4503(widget)S +4805(as)S +4918(static)S +5159(colors,)S +5458(the)S +6072 V +1510(remainder)S +1944(may)S +2146(be)S +2270(allocated)S +2660(for)S +2806(images.)S +6240 V +10 I +1260(raiseWindow)S +6360 V +10 R +1510(Raise)S +1762(the)S +1914(window)S +2266(when)S +2512(active.)S +2835(The)S +3020(default)S +3327(is)S +3424(False.)S +6528 V +10 I +1260(warpCursor)S +6648 V +10 R +1510(Warp)S +1761(the)S +1913(cursor)S +2192(to)S +2300(the)S +2452(window)S +2804(when)S +3050(active.)S +3373(The)S +3558(default)S +3865(is)S +3962(False.)S +6816 V +10 I +1260(width)S +6936 V +10 R +1510(Width)S +1790(of)S +1903(the)S +2055(Gterm)S +2340(window.)S +2747(The)S +2932(default)S +3239(is)S +3336(640.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(2)S +7920 V +EP +%%Page: 3 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(GTERM)S +1267(WIDGET)S +1674(RESOURCES)S +1080 V +1080(Class)S +1312(Hierarchy)S +1200 V +10 B +1260(Core)S +1500(->)S +1620(Gterm)S +1368 V +9 B +1080(Resources)S +1488 V +10 R +1260(When)S +1533(creating)S +1889(a)S +1969(Gterm)S +2260(widget)S +2568(instance,)S +2956(the)S +3114(following)S +3539(resources)S +3951(are)S +4108(retrieved)S +4498(from)S +4728(the)S +4886(arguments)S +5338(list)S +5497(or)S +1608 V +1260(from)S +1484(the)S +1636(resource)S +2003(database:)S +1848 V +10 B +1219(Name)S +2357(Class)S +2615(Type)S +3002(Default)S +3701(Description)S +1858 V +10 Y1 +1219(2)S +1221(2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222)S +1878 V +1219(2)S +1221(2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222)S +1988 V +10 R +1219(alphaFont1)S +2357(XFontStruct)S +3002(nil2)S +3701(Graphics)S +4091(fonts)S +2108 V +1219(alphaFont2)S +2357(XFontStruct)S +3002(5x8)S +3881(")S +2228 V +1219(alphaFont3)S +2357(XFontStruct)S +3002(6x10)S +3881(")S +2348 V +1219(alphaFont4)S +2357(XFontStruct)S +3002(7x13)S +3881(")S +2468 V +1219(alphaFont5)S +2357(XFontStruct)S +3002(8x13)S +3881(")S +2588 V +1219(alphaFont6)S +2357(XFontStruct)S +3002(9x15)S +3881(")S +2708 V +1219(alphaFont7)S +2357(XFontStruct)S +3002(9x15)S +3881(")S +2828 V +1219(alphaFont8)S +2357(XFontStruct)S +3002(9x15)S +3881(")S +2948 V +1219(basePixel)S +2357(Int)S +3002(38)S +3701(Base)S +3925(of)S +4038(private)S +4345(global)S +4625(colormap)S +3068 V +1219(busyCursor)S +2357(String)S +3002(watch)S +3701(Cursor)S +4003(to)S +4111(use)S +4274(when)S +4520(application)S +4994(is)S +5091(busy)S +3188 V +1219(busyCursorBgColor)S +2357(Foreground)S +3002(white)S +3701(Busy)S +3937(cursor)S +4216(background)S +4717(color)S +3308 V +1219(busyCursorFgColor)S +2357(Foreground)S +3002(black)S +3701(Busy)S +3937(cursor)S +4216(foreground)S +4689(color)S +3428 V +1219(cacheRasters)S +2357(String)S +3002(whenNeeded)S +3701(Save)S +3925(rasters)S +4215(as)S +4328(server)S +4601(pixmaps)S +4970(for)S +5116(faster)S +5367(access)S +3548 V +1219(cmapInitialize)S +2357(Boolean)S +3002(False)S +3701(Initialize)S +4086(colormap)S +4493(at)S +4595(startup)S +3668 V +1219(cmapInterpolate)S +2357(Boolean)S +3002(True)S +3701(Interpolate)S +4163(colormap)S +3788 V +1219(cmapName)S +2357(String)S +3002(default)S +3701(Custom)S +4043(colormap)S +4450(name)S +3908 V +1219(cmapShadow)S +2357(Int)S +3002(10)S +3701(Colormap)S +4131(shadow)S +4466(interval)S +4028 V +1219(cmapUpdate)S +2357(Int)S +3002(60)S +3701(Colormap)S +4131(update)S +4427(interval)S +4148 V +1219(color0)S +2357(Background)S +3002(black)S +3701(Default)S +4030(graphics)S +4398(background)S +4899(color)S +4268 V +1219(color1)S +2357(Foreground)S +3002(white)S +3701(Default)S +4030(graphics)S +4398(foreground)S +4871(color)S +4388 V +1219(color2)S +2357(Foreground)S +3002(red)S +3701(Optional)S +4081(drawing)S +4438(color)S +4508 V +1219(color3)S +2357(Foreground)S +3002(green)S +3881(")S +4628 V +1219(color4)S +2357(Foreground)S +3002(blue)S +3881(")S +4748 V +1219(color5)S +2357(Foreground)S +3002(cyan)S +3881(")S +4868 V +1219(color6)S +2357(Foreground)S +3002(yellow)S +3881(")S +4988 V +1219(color7)S +2357(Foreground)S +3002(magenta)S +3881(")S +5108 V +1219(color8)S +2357(Foreground)S +3002(purple)S +3881(")S +5228 V +1219(color9)S +2357(Foreground)S +3002(darkslategray)S +3881(")S +5348 V +1219(copyOnResize)S +2357(Boolean)S +3002(True)S +3701(Copy)S +3948(raster)S +4199(when)S +4445(resized)S +5468 V +1219(crosshairCursorColor)S +2357(Foreground)S +3002(red)S +3701(Full-screen)S +4180(cursor)S +4459(color)S +5588 V +1219(defaultMarker)S +2357(String)S +3002(rectangle)S +3701(Default)S +4030(marker)S +4342(type)S +5708 V +1219(deiconifyWindow)S +2357(Boolean)S +3002(False)S +3701(Deiconify)S +4130(window)S +4482(when)S +4728(active)S +5828 V +1219(dialogBgColor)S +2357(Foreground)S +3002(yellow)S +3701(Status)S +3976(line)S +4156(background)S +4657(color)S +5948 V +1219(dialogFgColor)S +2357(Foreground)S +3002(black)S +3701(Status)S +3976(line)S +4156(foreground)S +4629(color)S +6068 V +1219(dialogFont1)S +2357(XFontStruct)S +3002(nil2)S +3701(Status)S +3976(line)S +4156(fonts)S +6188 V +1219(dialogFont2)S +2357(XFontStruct)S +3002(5x8)S +3881(")S +6308 V +1219(dialogFont3)S +2357(XFontStruct)S +3002(6x10)S +3881(")S +6428 V +1219(dialogFont4)S +2357(XFontStruct)S +3002(7x13)S +3881(")S +6548 V +1219(dialogFont5)S +2357(XFontStruct)S +3002(8x13)S +3881(")S +6668 V +1219(dialogFont6)S +2357(XFontStruct)S +3002(9x15)S +3881(")S +6788 V +1219(dialogFont7)S +2357(XFontStruct)S +3002(9x15)S +3881(")S +6908 V +1219(dialogFont8)S +2357(XFontStruct)S +3002(9x15)S +3881(")S +7028 V +1219(ginmodeBlinkInterval)S +2357(Int)S +3002(0)S +3701(Graphics)S +4091(cursor)S +4370(blink)S +4606(interval)S +7148 V +1219(ginmodeCursor)S +2357(String)S +3002(full_crosshair)S +3701(Graphics)S +4091(cursor)S +4370(type)S +7268 V +1219(ginmodeCursorBgColor)S +2357(Foreground)S +3002(black)S +3701(Graphics)S +4091(cursor)S +4370(background)S +4871(color)S +7748 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(3)S +7920 V +EP +%%Page: 4 5 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +1219(ginmodeCursorFgColor)S +2357(Foreground)S +3002(white)S +3701(Graphics)S +4091(cursor)S +4370(foreground)S +4843(color)S +1080 V +1219(height)S +2357(Dimension)S +3002(480)S +3701(Height)S +4003(of)S +4116(graphics)S +4484(window)S +1200 V +1219(idleCursor)S +2357(String)S +3002(Plus)S +3701(Idle)S +3886(cursor)S +4165(type)S +1320 V +1219(idleCursorBgColor)S +2357(Foreground)S +3002(white)S +3701(Idle)S +3886(cursor)S +4165(background)S +4666(color)S +1440 V +1219(idleCursorFgColor)S +2357(Foreground)S +3002(black)S +3701(Idle)S +3886(cursor)S +4165(foreground)S +4638(color)S +1560 V +1219(markerBoxKnotColor)S +2357(Foreground)S +3002(blue)S +3701(Vertex)S +4002(knot)S +4210(color)S +1680 V +1219(markerBoxKnotSize)S +2357(Int)S +3002(0)S +3701(Vertex)S +4002(knot)S +4210(size)S +1800 V +1219(markerBoxLineColor)S +2357(Foreground)S +3002(green)S +3701(Marker)S +4024(border)S +4314(color)S +1920 V +1219(markerCircleKnotColor)S +2357(Foreground)S +3002(blue)S +3701(Vertex)S +4002(knot)S +4210(color)S +2040 V +1219(markerCircleKnotSize)S +2357(Int)S +3002(0)S +3701(Vertex)S +4002(knot)S +4210(size)S +2160 V +1219(markerCircleLineColor)S +2357(Foreground)S +3002(green)S +3701(Marker)S +4024(border)S +4314(color)S +2280 V +1219(markerCursorBgColor)S +2357(Foreground)S +3002(black)S +3701(Cursor)S +4003(background)S +4504(when)S +4750(in)S +4858(marker)S +2400 V +1219(markerCursorFgColor)S +2357(Foreground)S +3002(yellow)S +3701(Cursor)S +4003(foreground)S +4476(when)S +4722(in)S +4830(marker)S +2520 V +1219(markerEllipseKnotColor)S +2357(Foreground)S +3002(blue)S +3701(Vertex)S +4002(knot)S +4210(color)S +2640 V +1219(markerEllipseKnotSize)S +2357(Int)S +3002(0)S +3701(Vertex)S +4002(knot)S +4210(size)S +2760 V +1219(markerEllipseLineColor)S +2357(Foreground)S +3002(green)S +3701(Marker)S +4024(border)S +4314(color)S +2880 V +1219(markerFill)S +2357(Boolean)S +3002(False)S +3701(Flood)S +3965(\256ll)S +4107(marker)S +4419(area)S +4614(with)S +10 I +4822(markerFillColor)S +3000 V +10 R +1219(markerFillBgColor)S +2357(Foreground)S +3002(black)S +3701(Fill)S +3871(area)S +4066(background)S +4567(color)S +3120 V +1219(markerFillColor)S +2357(Foreground)S +3002(slategray)S +3701(Flood)S +3965(\256ll)S +4107(color)S +3240 V +1219(markerFillStyle)S +2357(Int)S +3002(FillSolid)S +3701(Fill)S +3871(area)S +4066(style)S +3360 V +1219(markerHighlightColor)S +2357(Foreground)S +3002(green)S +3701(Marker)S +4024(highlight)S +4416(color)S +3480 V +1219(markerHighlightWidth)S +2357(Int)S +3002(2)S +3701(Marker)S +4024(highlight)S +4416(line)S +4596(width)S +3600 V +1219(markerLineKnotColor)S +2357(Foreground)S +3002(blue)S +3701(Vertex)S +4002(knot)S +4210(color)S +3720 V +1219(markerLineKnotSize)S +2357(Int)S +3002(5)S +3701(Vertex)S +4002(knot)S +4210(size)S +3840 V +1219(markerLineLineColor)S +2357(Foreground)S +3002(green)S +3701(Line)S +3914(marker)S +4226(color)S +3960 V +1219(markerLineStyle)S +2357(Int)S +3002(LineSolid)S +3701(Line)S +3914(marker)S +4226(line)S +4406(style)S +4080 V +1219(markerLineWidth)S +2357(Int)S +3002(1)S +3701(Line)S +3914(marker)S +4226(width)S +4200 V +1219(markerPgonKnotColor)S +2357(Foreground)S +3002(blue)S +3701(Vertex)S +4002(knot)S +4210(color)S +4320 V +1219(markerPgonKnotSize)S +2357(Int)S +3002(5)S +3701(Vertex)S +4002(knot)S +4210(size)S +4440 V +1219(markerPgonLineColor)S +2357(Foreground)S +3002(green)S +3701(Marker)S +4024(border)S +4314(color)S +4560 V +1219(markerRectKnotColor)S +2357(Foreground)S +3002(blue)S +3701(Vertex)S +4002(knot)S +4210(color)S +4680 V +1219(markerRectKnotSize)S +2357(Int)S +3002(0)S +3701(Vertex)S +4002(knot)S +4210(size)S +4800 V +1219(markerRectLineColor)S +2357(Foreground)S +3002(green)S +3701(Marker)S +4024(border)S +4314(color)S +4920 V +1219(markerTextBgColor)S +2357(Foreground)S +3002(slategray)S +3701(Text)S +3914(marker)S +4226(background)S +4727(color)S +5040 V +1219(markerTextBorder)S +2357(Int)S +3002(2)S +3701(Text)S +3914(marker)S +4226(border)S +4516(width)S +5160 V +1219(markerTextColor)S +2357(Foreground)S +3002(yellow)S +3701(Text)S +3914(marker)S +4226(text)S +4406(color)S +5280 V +1219(markerTextFont)S +2357(XFontStruct)S +3002(6x13)S +3701(Text)S +3914(marker)S +4226(font)S +5400 V +1219(markerTextLineColor)S +2357(Foreground)S +3002(green)S +3701(Text)S +3914(marker)S +4226(line)S +4406(color)S +5520 V +1219(markerTextString)S +2357(String)S +3002(NULL)S +3701(Text)S +3914(string)S +5640 V +1219(markerTranslations)S +2357(String)S +3002(default)S +3701(Marker)S +4024(event-to-actions)S +4697(translations)S +5760 V +1219(maxColors)S +2357(Int)S +3002(216)S +3701(Max)S +3914(colors)S +4188(in)S +4296(custom)S +4615(colormap)S +5880 V +1219(maxMappings)S +2357(Int)S +3002(32)S +3701(Max)S +3914(image)S +4188(mappings)S +6000 V +1219(maxRasters)S +2357(Int)S +3002(512)S +3701(Max)S +3914(image)S +4188(rasters)S +6120 V +1219(nearEdge)S +2357(Int)S +3002(1)S +3701(Distance,)S +4164(in)S +4331(pixels,)S +4684(between)S +5105(pointer)S +5477(and)S +6240 V +3701(marker)S +4014(edge)S +4232(required)S +4594(for)S +4740(translation)S +5192(actions)S +5505(for)S +6360 V +3701(be)S +3825(in)S +3933(e)S +3977 H + (f)show 10 -.5 mul h (f)show +10 R +4038(ect.)S +6480 V +1219(nearVertex)S +2357(Int)S +3002(4)S +3701(Distance,)S +4106(in)S +4215(pixels)S +4485(between)S +4848(pointer)S +5163(and)S +5339(marker)S +6600 V +3701(vertex)S +4039(\(i.e.)S +10 I +4282(knot)S +10 R +4454(\))S +4575(required)S +4995(for)S +5199(translation)S +6720 V +3701(actions)S +4014(for)S +4160(be)S +4284(in)S +4392(e)S +4436 H + (f)show 10 -.5 mul h (f)show +10 R +4497(ect.)S +6840 V +1219(raiseWindow)S +2357(Boolean)S +3002(False)S +3701(Raise)S +3953(window)S +4305(when)S +4551(active)S +6960 V +1219(translations)S +2357(String)S +3002(default)S +3701(Event-to-actions)S +4391(translations)S +7080 V +1219(useTimers)S +2357(Boolean)S +3002(True)S +3701(Ok)S +3853(to)S +3961(use)S +4124(timers)S +7200 V +1219(warpCursor)S +2357(Boolean)S +3002(False)S +3701(Enable)S +4008(warp)S +4237(cursor)S +4516(when)S +4762(active)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(4)S +7920 V +EP +%%Page: 5 6 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +1219(width)S +2357(Dimension)S +3002(640)S +3701(Height)S +4003(of)S +4116(graphics)S +4484(window)S +1080 V +1219(xorFill)S +2357(Boolean)S +3002(False)S +3701(Fill)S +3871(with)S +4079(GXxor)S +1200 V +1219(xorFillBgColor)S +2357(Int)S +3002(255)S +3701(Xor-\256ll)S +4031(background)S +4532(color)S +1320 V +1219(xorFillColor)S +2357(Int)S +3002(2)S +3701(Xor-\256ll)S +4031(color)S +1608 V +9 B +900(GTERM)S +1267(WIDGET)S +1674(TRANSLATIONS)S +2411(AND)S +2633(ACTIONS)S +1728 V +10 R +1260(The)S +1445(default)S +1752(translations)S +2243(for)S +2389(a)S +2463(Gterm)S +2748(window)S +3100(are:)S +1848 V +2808(:)S +3537(m_create\(\))S +1968 V +2808(:)S +3537(crosshair\(on\))S +2088 V +2757(:)S +3537(crosshair\(on\))S +2208 V +2930(:)S +3537(crosshair\(o)S +3980 H + (f)show 10 -.5 mul h (f)show +10 R +4041(\))S +2328 V +2687(:)S +3537(enter-window\(\))S +2448 V +2660(:)S +3537(leave-window\(\))S +2568 V +2870(:)S +3537(graphics-input\(\))S +2688 V +2952(:)S +3537(track-cursor\(\))S +2856 V +1260(The)S +1445(available)S +1835(action)S +2109(procedures)S +2576(for)S +2722(a)S +2796(Gterm)S +3081(window)S +3433(are:)S +3024 V +10 I +1620(ignore\(\))S +10 R +2620(Ignore)S +2910(an)S +3034(event.)S +3192 V +10 I +1620(graphics-input\(\))S +10 R +2620(Handle)S +2938(a)S +3012(graphics)S +3380(input)S +3616(request.)S +3360 V +10 I +1620(crosshair\(on|o)S +2209 H + (f)show 10 -.5 mul h (f)show +10 I +2260(\))S +10 R +2620(Display)S +2961(a)S +3035(crosshair)S +3425(cursor.)S +3528 V +10 I +1620(track-cursor\(\))S +10 R +2620(Track)S +2882(crosshair)S +3272(cursor)S +3551(position.)S +3696 V +10 I +1620(enter-window\(\))S +10 R +2620(Handle)S +2938(an)S +3062(EnterWindow)S +3652(event.)S +3864 V +10 I +1620(leave-window\(\))S +10 R +2620(Handle)S +2938(an)S +3062(LeaveWindow)S +3679(event.)S +4032 V +10 I +1620(reset\(\))S +10 R +2620(Do)S +2772(a)S +2846(soft)S +3026(reset)S +3244(of)S +3357(the)S +3509(Gterm)S +3794(widget.)S +4200 V +10 I +1620(m_create\(\))S +10 R +2620(Create)S +2910(a)S +2984(new)S +3180(marker.)S +3547(Valid)S +3799(types)S +4040(include)S +4320 V +10 I +3343(text)S +3643(line)S +4014(polyline)S +4492(rectangle)S +4440 V +3343(box)S +3643(circle)S +4014(ellipse)S +4492(polygon)S +4560 V +10 R +2620(The)S +2806(default)S +3114(is)S +10 I +3212(rectangle)S +10 R +3589(,)S +3645(if)S +3737(no)S +3869(type)S +4073(is)S +4172(given)S +4426(the)S +4580(default)S +4889(type)S +5093(speci\256ed)S +5480(by)S +4680 V +2620(the)S +10 I +2772(markerType)S +10 R +3284(resource)S +3651(will)S +3837(be)S +3961(used.)S +4968 V +9 B +900(GTERM)S +1267(MARKER)S +1704(TRANSLATIONS)S +2441(AND)S +2663(ACTIONS)S +5088 V +10 R +1260(The)S +1445(default)S +1752(translations)S +2243(for)S +2389(a)S +2463(marker)S +2775(are:)S +5328 V +2318(!Shift)S +2576(:)S +3356(m_rotateResize\(\))S +5448 V +2576(:)S +3356(m_moveResize\(\))S +5568 V +2369(!Shift)S +2627(:)S +3356(m_raise\(\))S +3798(m_markpos\(\))S +5688 V +2627(:)S +3356(m_raise\(\))S +3798(m_markposAdd\(\))S +5808 V +2749(:)S +3356(m_redraw\(\))S +3856(m_destroyNull\(\))S +5928 V +2627(:)S +3356(m_lower\(\))S +6048 V +2457(BackSpace:)S +3356(m_deleteDestroy\(\))S +6168 V +2640(Delete:)S +3356(m_deleteDestroy\(\))S +6288 V +2689(:)S +3356(m_input\(\))S +6408 V +2771(:)S +3356(track-cursor\(\))S +6648 V +1260(Translations)S +1802(a)S +1846 H + (f)show 10 -.5 mul h (f)show +10 R +1907(ect)S +2071(only)S +2297(the)S +2467(currently)S +2875(active)S +3162(marker,)S +3518(the)S +3689(cursor)S +3987(must)S +4231(be)S +4374(within)S +10 I +4679(nearEdge)S +10 R +5116(pixels)S +5404(of)S +5536(a)S +6768 V +1260(marker)S +1572(edge,)S +1815(or)S +10 I +1928(nearVertex)S +10 R +2401(pixels)S +2670(of)S +2783(a)S +2857(marker)S +3169(vertex)S +3448(to)S +3556(take)S +3752(e)S +3796 H + (f)show 10 -.5 mul h (f)show +10 R +3857(ect.)S +7008 V +1260(The)S +1445(available)S +1835(action)S +2109(procedures)S +2576(for)S +2722(a)S +2796(marker)S +3108(are)S +7176 V +10 I +1620(m_create\(type\))S +10 R +2520(Create)S +2810(a)S +2884(new)S +3080(marker.)S +3447(Valid)S +3699(types)S +3940(include)S +7296 V +10 I +3293(text)S +3593(line)S +3964(polyline)S +4442(rectangle)S +7776 V +10 R +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(5)S +7920 V +EP +%%Page: 6 7 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 I +3293(box)S +3593(circle)S +3964(ellipse)S +4442(polygon)S +1080 V +10 R +2520(The)S +2714(default)S +3030(is)S +10 I +3136(rectangle)S +10 R +3513(,)S +3577(if)S +3677(no)S +3816(type)S +4027(is)S +4133(given)S +4394(the)S +4556(default)S +4873(type)S +5085(speci\256ed)S +5480(by)S +1200 V +2520(the)S +10 I +2672(markerType)S +10 R +3184(resource)S +3551(will)S +3737(be)S +3861(used.)S +1368 V +10 I +1620(m_destroy\(\))S +10 R +2520(Destroy)S +2866(the)S +3018(active)S +3286(marker.)S +1536 V +10 I +1620(m_destroyNull\(\))S +10 R +2520(Destroy)S +2866(the)S +3018(active)S +3286(marker)S +3598(if)S +3689(it)S +3775(is)S +3872(null)S +4058(sized.)S +1704 V +10 I +1620(m_set\(attribute,)S +2286(value,)S +2557(....\))S +1824 V +10 R +2520(Set)S +2678(a)S +2752(marker)S +3064(attribute.)S +3482(Valid)S +3734(attributes)S +4136(include)S +2064 V +10 I +2862(activated)S +3390(autoRedraw)S +4130(\256ll)S +4775(\256llBgColor)S +2184 V +2862(\256llColor)S +3390(\256llPattern)S +4130(\256llStyle)S +4775(font)S +2304 V +2862(height)S +3390(highlightColor)S +4130(imageText)S +4775(knotColor)S +2424 V +2862(knotSize)S +3390(lineColor)S +4130(lineStyle)S +4775(lineWidth)S +2544 V +2862(rotangle)S +3390(sensitive)S +4130(textBgColor)S +4775(textBorder)S +2664 V +2862(textColor)S +3390(translations)S +4130(type)S +4775(visible)S +2784 V +2862(width)S +3390(x)S +4130(y)S +2952 V +1620(m_raise\(\))S +10 R +2520(Raise)S +2772(the)S +2924(active)S +3192(marker)S +3504(to)S +3612(the)S +3764(top)S +3922(of)S +4035(the)S +4187(display)S +4506(list.)S +3120 V +10 I +1620(m_lower\(\))S +10 R +2520(Lower)S +2810(the)S +2962(active)S +3230(marker)S +3542(to)S +3650(the)S +3802(bottom)S +4116(of)S +4229(the)S +4381(display)S +4700(list.)S +3288 V +10 I +1620(m_notify\(event,)S +2268(event,)S +2533(....\))S +3408 V +10 R +2520(Notify)S +2821(any)S +3005(clients)S +3306(that)S +3496(have)S +3724(registered)S +4157(callbacks)S +4568(for)S +4725(the)S +4888(speci\256ed)S +5284(type)S +5497(of)S +3528 V +2520(events.)S +2860(Recognized)S +3361(events)S +3646(include)S +3648 V +10 I +3317(notify)S +3761(moveResize)S +4376(modify)S +3768 V +3317(redraw)S +3761(destroy)S +4376(input)S +3888 V +3317(focusIn)S +3761(focusOut)S +4376(constraint)S +4056 V +1620(m_input\(\))S +10 R +2520(Notify)S +2819(any)S +3001(clients)S +3300(that)S +3489(have)S +3716(registered)S +4148(a)S +4231(input)S +4476(callback)S +4847(that)S +5036(a)S +5119(input)S +5364(event)S +4176 V +2520(has)S +2683(occurred.)S +4344 V +10 I +1620(m_markpos\(\))S +10 R +2520(Mark)S +2766(the)S +2918(current)S +3230(position)S +3583(of)S +3696(the)S +3848(marker,)S +4185(e.g.,)S +4384(so)S +4503(that)S +4683(it)S +4769(can)S +4937(later)S +5144(be)S +5268(erased.)S +4512 V +10 I +1620(m_markposAdd\(\))S +10 R +2520(Execute)S +2871(either)S +3128(the)S +3280(markpos)S +3654(or)S +3767(add)S +3941(action,)S +4240(depending)S +4686(upon)S +4916(the)S +5068(pointer)S +5381(loca-)S +4632 V +2520(tion.)S +2772(If)S +2879(the)S +3042(pointer)S +3366(is)S +3474(over)S +3692(an)S +3827(active)S +4106(marker)S +4429(at)S +4542(a)S +4627(location)S +4990(where)S +5274(the)S +5436(add)S +4752 V +2520(action)S +2802(can)S +2978(be)S +3110(executed)S +3502(this)S +3685(is)S +3791(done,)S +4049(otherwise)S +4476(the)S +4637(markpos)S +5020(action)S +5303(is)S +5409(exe-)S +4872 V +2520(cuted.)S +5040 V +10 I +1620(m_redraw\(\))S +10 R +2520(Redraw)S +2860(the)S +3012(active)S +3280(marker.)S +5208 V +10 I +1620(m_addPt\(\))S +10 R +2520(Add)S +2722(a)S +2796(point)S +3032(\(i.e.)S +3217(vertex)S +3496(knot\).)S +10 I +3762(Polyline)S +10 R +4125(and)S +10 I +4299(polygon)S +10 R +4651(markers)S +5002(only.)S +5376 V +10 I +1620(m_deletePt\(\))S +10 R +2520(Delete)S +2810(a)S +2884(point)S +3120(\(i.e.)S +3305(vertex)S +3584(knot\).)S +5544 V +10 I +1620(m_movePt\(\))S +10 R +2520(Move)S +2783(a)S +2857(point)S +3093(\(i.e.)S +3278(vertex)S +3557(knot\).)S +10 I +3823(Polyline)S +10 R +4186(and)S +10 I +4360(polygon)S +10 R +4712(markers)S +5063(only.)S +5712 V +10 I +1620(m_deleteDestroy\(\))S +10 R +2520(Delete)S +2810(a)S +2884(point)S +3120(or)S +3233(destroy)S +3557(a)S +3631(marker,)S +3968(depending)S +4414(upon)S +4644(the)S +4796(pointer)S +5109(position.)S +5880 V +10 I +1620(m_move\(\))S +10 R +2520(Move)S +2783(a)S +2857(marker.)S +6048 V +10 I +1620(m_resize\(\))S +10 R +2520(Resize)S +2816(a)S +2890(marker.)S +6216 V +10 I +1620(m_moveResize\(\))S +10 R +2520(Move)S +2794(a)S +2879(point)S +3126(or)S +3250(marker,)S +3599(or)S +3724(resize)S +3998(a)S +4084(marker,)S +4433(depending)S +4891(upon)S +5133(the)S +5297(pointer)S +6336 V +2520(position.)S +6504 V +10 I +1620(m_rotate\(\))S +10 R +2520(Rotate)S +2811(a)S +2885(marker.)S +6672 V +10 I +1620(m_rotateResize\(\))S +10 R +2520(Rotate)S +2820(or)S +2942(resize)S +3213(a)S +3296(marker.)S +3672(A)S +3783(marker)S +4104(is)S +4210(rotated)S +4526(if)S +4626(near)S +4837(a)S +4921(vertex)S +5210(know,)S +5497(or)S +6792 V +2520(resized)S +2832(if)S +2923(near)S +3124(an)S +3248(edge.)S +7080 V +9 B +900(GTERM)S +1267(I/O)S +1424(ESCAPE)S +1806(SEQUENCES)S +7200 V +10 R +1260(XGterm)S +1638(uses)S +1861(escape)S +2177(sequences)S +2632(to)S +2761(provide)S +3117(graphics)S +3506(emulation.)S +4012(This)S +4241(protocol)S +4625(is)S +4743(an)S +4888(extension)S +5323(of)S +5458(the)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(6)S +7920 V +EP +%%Page: 7 8 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(Tektronix)S +1703(4012)S +1952(graphics)S +2339(protocol.)S +2775(The)S +2978(basic)S +3231(extensions)S +3701(are)S +3870(patterned)S +4289(after)S +4519(the)S +4689(Retrographics)S +5297(VT640)S +1080 V +1260(graphics)S +1634(terminal,)S +2028(using)S +2282(GS)S +2447(\(octal)S +2711(\\035,)S +2951(aka)S +3126(Ctrl-]\))S +3418(and)S +3599(CAN)S +3847(\(octal)S +4111(\\030,)S +4351(aka)S +4526(Ctrl-x\))S +4835(to)S +4950(switch)S +5248(between)S +1200 V +1260(vt100)S +1522(and)S +1700(graphics)S +2071(modes.)S +2420(Additional)S +2881(extensions)S +3336(are)S +3490(de\256ned)S +3817(to)S +3928(support)S +4261(advanced)S +4670(features)S +5018(such)S +5234(as)S +5350(color,)S +1320 V +1260(area)S +1466(\256lls,)S +1683(graphics)S +2062(erasure,)S +2415(setting)S +2723(the)S +2886(cursor)S +3176(location)S +3540(under)S +3809(program)S +4189(control,)S +4539(interactive)S +5002(dialog)S +5294(via)S +5458(the)S +1440 V +1260("status)S +1559(line",)S +1805(and)S +1979(so)S +2098(on.)S +1680 V +1260(While)S +1543(these)S +1787(escape)S +2092(sequences)S +2536(can)S +2714(be)S +2848(used)S +3071(directly,)S +3441(the)S +3603(best)S +3804(programmatic)S +4404(interface)S +4792(is)S +4899(to)S +5017(use)S +5190(the)S +5352(OBM)S +1800 V +1260(\()S +10 I +1293(Object)S +1612(Manager)S +10 R +1978(\))S +2064(library)S +2383(supplied)S +2775(with)S +3006(the)S +3181(XGterm)S +3560(source)S +3872(as)S +4007(part)S +4214(of)S +4349(the)S +4523(X11IRAF)S +4975(package.)S +5408(Any)S +1920 V +1260(Tektronix-compatible)S +2191(graphics)S +2590(library)S +2917(will)S +3134(su)S +3223 H + (f)show 10 -.5 mul h (\256)show +10 R +3307(ce)S +3456(for)S +3633(producing)S +4099(vector)S +4409(graphics,)S +4833(the)S +5016(added)S +5315(escape)S +2040 V +1260(sequences)S +1694(used)S +1907(by)S +2037(the)S +2189(Gterm)S +2474(widget)S +2776(are)S +2927(required)S +3289(to)S +3397(make)S +3643(use)S +3806(of)S +3919(imaging,)S +4302(area)S +4497(\256lls,)S +4703(the)S +4855(status)S +5113(line,)S +5318(etc.)S +2280 V +1260(All)S +1439(escape)S +1755(sequences)S +2210(begin)S +2483(with)S +2712(an)S +10 B +2857(ESC)S +10 R +3103(character)S +3518(\(octal)S +3797(\\033\),)S +4085(followed)S +4492(by)S +4644(up)S +4796(to)S +4926(three)S +5177(characters)S +2400 V +1260(de\256ning)S +1619(the)S +1772(action)S +2047(to)S +2156(be)S +2281(taken.)S +2583(All)S +2742(strings)S +3040(in)S +3149(capital)S +3446(letters)S +3721(refer)S +3939(to)S +4048(the)S +4201(ASCII)S +4493(code)S +4712(\(e.g.)S +10 I +4920(LF)S +10 R +5068(is)S +5166(the)S +5319(ASCII)S +2520 V +1260(linefeed)S +1612(code\),)S +1889(a)S +1965(three)S +2196(digit)S +2412(number)S +2749(preceeded)S +3184(by)S +3316(a)S +3392('\302)S +3490(refers)S +3748(to)S +3858(an)S +3984(octal)S +4210(code)S +4430(\(e.g.)S +4669(")S +4760(12")S +4933(is)S +5032(octal)S +5258(12\))S +5423(,)S +5480(all)S +2640 V +1260(others)S +1534(are)S +1685(characters)S +2118(in)S +2226(the)S +2378(escape)S +2673(code)S +2891(\(e.g.)S +3128("/bc")S +3362(are)S +3513(the)S +3665(three)S +3894(characters)S +4327('/',)S +4476('b',)S +4647(and)S +4821('c'\).)S +2928 V +9 B +1080(ESCAPE)S +1462(SEQUENCES)S +3048 V +10 B +1620(US)S +3156 V +1620(CR)S +10 R +2370(Switch)S +2690(to)S +2810(alpha)S +3068(mode.)S +3387(Characters)S +3855(are)S +4019(drawn)S +4311(in)S +4432(the)S +4597(graphics)S +4978(window)S +5343(at)S +5458(the)S +3276 V +2370("current")S +2766(position)S +3121(\(normally)S +3547(set)S +3690(beforehand)S +4170(with)S +4380(a)S +4456(GS/US)S +4772(vector)S +5052(move\),)S +5363(using)S +3396 V +2370(the)S +2537(alpha)S +2798(mode)S +3065(font.)S +3296(Receipt)S +3646(of)S +3774(any)S +3963(control)S +4292(code)S +4526(causes)S +4832(alpha)S +5094(mode)S +5362(to)S +5486(be)S +3516 V +2370(exited.)S +3804 V +10 B +1620(GS)S +10 R +2370(Switch)S +2678(to)S +2786(vector)S +3065(polyline)S +3423(mode.)S +3912 V +10 B +1620(FS)S +10 R +2370(Switch)S +2678(to)S +2786(vector)S +3065(polypoint)S +3479(mode.)S +4020 V +10 B +1620(RS)S +10 R +2370(Switch)S +2678(to)S +2786(vector)S +3065(mode,)S +3342(vertices)S +3682(are)S +3833(joined)S +4113(as)S +4226(a)S +4300(polygon.)S +4260 V +2370(With)S +2622(all)S +2774(three)S +3025(codes,)S +3329(vertices)S +3691(and)S +3888(points)S +4186(are)S +4360(accumulated)S +4917(in)S +5048(a)S +5145(bu)S +5245 H + (f)show 10 -.5 mul h (f)show +10 R +5306(er)S +5436(and)S +4380 V +2370(displayed)S +2792(when)S +3047(the)S +3208(bu)S +3308 H + (f)show 10 -.5 mul h (f)show +10 R +3369(er)S +3485(\256lls)S +3675(or)S +3797(when)S +4052(vector)S +4340(mode)S +4601(is)S +4706(terminated)S +5171(by)S +5309(receipt)S +4500 V +2370(of)S +2483(any)S +2658(control)S +2972(code.)S +3246(A)S +3349(workstation)S +3852(open)S +4077(will)S +4264(be)S +4389(done)S +4614(if)S +4706(it)S +4793(hasn't)S +5068(already)S +5392(been)S +4620 V +2370(opened,)S +2736(no-op)S +3022(sequences)S +3479(GS-CAN)S +3904(are)S +4078(\256ltered)S +4414(out,)S +4619(since)S +4876(they)S +5100(would)S +5402(only)S +4740 V +2370(cause)S +2622(a)S +2698(pointless)S +3086(switch)S +3379(to)S +3489(the)S +3643(graphics)S +4013(frame)S +4277(and)S +4453(back)S +4673(without)S +5011(drawing.)S +5425(The)S +4860 V +2370(open)S +2610(workstation)S +3128(sequence)S +3539(is)S +3652(GS,US,)S +4003(or)S +4131(by)S +4276(the)S +10 I +4443(xterm)S +10 R +4715(graphics)S +5098(start)S +5315(escape)S +4980 V +2370(sequence)S +2765("[?38h".)S +5268 V +10 B +1620(EM)S +10 R +2370(Enter)S +2623(message)S +2998(mode.)S +3312(In)S +3432(message)S +3807(mode)S +4066(input)S +4309(text)S +4497(is)S +4602(accumulated)S +5144(in)S +5260(a)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +5388 V +2370(and)S +2558(eventually)S +3017(passed)S +3326(to)S +3447(the)S +3612(object)S +3899(manager,)S +4310(which)S +4597(delivers)S +4956(the)S +5121(message)S +5502(to)S +5508 V +2370(the)S +2525(referenced)S +2977(object.)S +3309(Messages)S +3730(are)S +3884(used)S +4100(to)S +4211(download)S +4638(the)S +4793(user)S +4992(interface)S +5374(to)S +5486(be)S +5628 V +2370(executed)S +2763(by)S +2902(the)S +3063(object)S +3346(manager.)S +3783(During)S +4105(execution,)S +4557(messages)S +4973(are)S +5132(used)S +5353(to)S +5469(set)S +5748 V +2370(the)S +2524(values)S +2811(of)S +2926(user)S +3124(interface)S +3504(parameters)S +3973(to)S +4083(allow)S +4337(the)S +4491(UI)S +4628(to)S +4739(track)S +4971(the)S +5126(state)S +5342(of)S +5458(the)S +5868 V +2370(client)S +2622(application.)S +6156 V +10 B +1620(CAN)S +10 R +2370(Close)S +2628(workstation)S +3130(and)S +3304(enter)S +3533(command)S +3957(mode.)S +6324 V +10 B +1620(BEL)S +10 R +2370(Ring)S +2595(the)S +2747(screen)S +3031(bell.)S +6612 V +10 B +1620(ENQ)S +10 R +2370(Return)S +2676(terminal)S +3043(status.)S +3360(Returned)S +3760(values)S +4049(include)S +4378(the)S +4535(terminal)S +4903(mode,)S +5185(and)S +5364(alpha)S +6732 V +2370(cursor)S +2649(x)S +2729(and)S +2903(y)S +2983(position.)S +6900 V +10 B +1620(SUB)S +10 R +2370(Initiate)S +2683(a)S +2757(cursor)S +3036(read,)S +3262(values)S +3547(are)S +3698(returned)S +4060(in)S +4168(window)S +4520(coordinates.)S +7068 V +10 B +1620(/SUB)S +10 R +2370(Return)S +2672(window)S +3024(cursor)S +3303(position)S +3656(in)S +3764(raster)S +4015(coordinates.)S +7236 V +10 B +1620(FF)S +10 R +2370(Clear)S +2616(the)S +2768(screen.)S +7716 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(7)S +7920 V +EP +%%Page: 8 9 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1620(/f)S +10 R +2370(Set)S +2528(current)S +2840(cursor)S +3119(position.)S +1128 V +10 B +1620(0)S +10 R +2370(Set)S +2528(character)S +2922(size)S +3107(0.)S +3212(\(Currently)S +3658(ignored\).)S +1236 V +10 B +1620(1)S +10 R +2370(Set)S +2528(character)S +2922(size)S +3107(1.)S +3212(\(Currently)S +3658(ignored\).)S +1344 V +10 B +1620(2)S +10 R +2370(Set)S +2528(character)S +2922(size)S +3107(2.)S +3212(\(Currently)S +3658(ignored\).)S +1452 V +10 B +1620(3)S +10 R +2370(Set)S +2528(character)S +2922(size)S +3107(3.)S +3212(\(Currently)S +3658(ignored\).)S +1620 V +10 B +1620(/0d)S +10 R +2370(Set)S +2528(color)S +2763(index.)S +1728 V +10 B +1620(/1d)S +10 R +2370(Clear)S +2616(graphics)S +2984(screen.)S +1836 V +10 B +1620(/2d)S +10 R +2370(Invert)S +2638(graphics)S +3006(screen)S +2004 V +10 B +1620(`)S +10 R +2370(Select)S +2644(line)S +2824(style)S +3043(0.)S +3148(\(Solid\))S +2112 V +10 B +1620(a)S +10 R +2370(Select)S +2644(line)S +2824(style)S +3043(1.)S +3148(\(Dashed\))S +2220 V +10 B +1620(b)S +10 R +2370(Select)S +2644(line)S +2824(style)S +3043(2.)S +3148(\(Dotted\))S +2328 V +10 B +1620(c)S +10 R +2370(Select)S +2644(line)S +2824(style)S +3043(3.)S +3148(\(DashDot\))S +2436 V +10 B +1620(d)S +10 R +2370(Select)S +2644(line)S +2824(style)S +3043(4.)S +3148(\(Dash3Dot\))S +2604 V +10 B +1620(/0w)S +10 R +2370(Select)S +2644(line)S +2824(width)S +3082(0.)S +2712 V +10 B +1620(/1w)S +10 R +2370(Select)S +2644(line)S +2824(width)S +3082(1.)S +2820 V +10 B +1620(/2w)S +10 R +2370(Select)S +2644(line)S +2824(width)S +3082(2.)S +2928 V +10 B +1620(/nw)S +10 R +2370(Select)S +2644(line)S +2824(width)S +3082(3.)S +3096 V +10 B +1620(/0c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(0.)S +3204 V +10 B +1620(/1c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(1.)S +3312 V +10 B +1620(/2c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(2.)S +3420 V +10 B +1620(/3c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(3.)S +3528 V +10 B +1620(/4c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(4.)S +3636 V +10 B +1620(/5c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(5.)S +3744 V +10 B +1620(/6c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(6.)S +3852 V +10 B +1620(/7c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(7.)S +3960 V +10 B +1620(/8c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(8.)S +4068 V +10 B +1620(/9c)S +10 R +2370(Select)S +2644(line)S +2824(color)S +3059(9.)S +4356 V +9 B +1080(IMAGING)S +1532(ESCAPE)S +1914(SEQUENCES)S +4476 V +10 R +1260(These)S +1528(are)S +1679(encoded)S +2041(as)S +2154(follows:)S +4716 V +10 B +2169(ESC)S +10 R +2394()S +2724([)S +10 I +2787(P)S +2878(;)S +2941(P)S +10 R +3032(;)S +3090(...)S +3195(])S +3258(<)S +10 I +3314(parameters)S +10 R +3769(>)S +4956 V +1260(where)S +10 I +1533(code)S +10 R +1751(is)S +1848(a)S +1922(character)S +2316(sequence)S +2711(and)S +10 I +2885(P)S +10 R +2976(is)S +3073(an)S +3197(ASCII)S +3488(encoded)S +3850(parameter)S +4278(described)S +4690(below.)S +5124 V +10 B +1620(/nc)S +10 R +2370(Select)S +2644(line)S +2824(color.)S +3114(Parameter)S +3548(is)S +3645(the)S +3797(color)S +4032(number)S +4367(in)S +4475(the)S +4627(range)S +4878(0-9.)S +5292 V +10 B +1620(sre)S +10 I +2370(Reset)S +10 R +2586(.)S +2671(Parameters)S +3144(are)S +3295("reset-str".)S +5460 V +10 B +1620(ssz)S +10 I +2370(Resize)S +10 R +2625(.)S +2680(Parameters)S +3153(are)S +3304("resize-str".)S +5628 V +10 B +1620(rir)S +10 I +2370(Initialize)S +2756(raster)S +10 R +2995(.)S +5796 V +10 B +1620(rcr)S +10 I +2370(Create)S +2675(a)S +2758(raster)S +10 R +2997(.)S +3085(Parameters)S +3561(are)S +3715(raster)S +3969(number,)S +4332(type,)S +4562(width,)S +4848(height,)S +5156(and)S +5333(depth.)S +5916 V +2370(Type)S +2613(is)S +2718(1)S +2806(for)S +2960(a)S +3041(normal)S +3361(\(client\))S +3686(raster,)S +3969(2)S +4056(for)S +4209(cached)S +4522(in)S +4637(server)S +4917(memory,)S +5312(or)S +5432(0)S +5519(if)S +6036 V +2370(you)S +2550(don't)S +2791(care.)S +3041(Depth)S +3315(may)S +3517(be)S +3641(1,)S +3746(8,)S +3851(16,)S +4006(or)S +4119(32.)S +6204 V +10 B +1620(rde)S +10 I +2370(Destroy)S +2716(a)S +2796(raster)S +10 R +3035(.)S +3120(Parameter)S +3554(is)S +3651(raster)S +3902(number.)S +6372 V +10 B +1620(rqr)S +10 I +2370(Query)S +2666(a)S +2763(raster)S +10 R +3002(.)S +3104(Parameter)S +3555(is)S +3670(raster)S +3939(number.)S +4347(Output)S +4673(parameters)S +5158(are)S +5327(status,)S +6492 V +2370(type,)S +2737(width,)S +3160(height,)S +3605(and)S +3919(depth)S +4311(encoded)S +4813(in)S +5061(the)S +5352(string)S +6612 V +2370(""\\033[5;%d;%d;%d;%d;%d]".)S +6780 V +10 B +1620(rsr)S +10 I +2370(Select)S +2638(a)S +2718(raster)S +10 R +2957(.)S +3042(Parameter)S +3476(is)S +3573(raster)S +3824(number.)S +6948 V +10 B +1620(rwr)S +10 I +2370(Write)S +2654(pixels)S +2949(to)S +3089(a)S +3201(rectangular)S +3735(region)S +4058(of)S +4199(a)S +4312(raster)S +10 R +4551(.)S +4669(Parameters)S +5175(are)S +5359(raster)S +7068 V +2370(number,)S +2752(encoding)S +3170(type)S +3394(\(not)S +3607(used\),)S +3900(x1,)S +4077(y1,)S +4254(nx,)S +4430(ny,)S +4606(and)S +4801(depth)S +5074(followed)S +5480(by)S +7188 V +2370(\(nx)S +10 Y +2503(*)S +10 R +2553(ny\))S +2716(data)S +2912(pixels.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(8)S +7920 V +EP +%%Page: 9 10 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1620(rrd)S +10 I +2370(Read)S +2620(from)S +2854(a)S +2949(rectangular)S +3466(region)S +3772(of)S +3895(a)S +3990(raster)S +10 R +4229(.)S +4329(Parameters)S +4817(are)S +4983(raster)S +5250(number,)S +1080 V +2370(encoding)S +2772(type)S +2980(\(not)S +3177(used\),)S +3454(x1,)S +3615(y1,)S +3776(nx,)S +3937(ny,)S +4098(and)S +4278(depth)S +4536(followed)S +4927(by)S +5063(\(nx)S +10 Y +5196(*)S +10 R +5246(ny\))S +5414(data)S +1200 V +2370(pixels.)S +1368 V +10 B +1620(rrp)S +10 I +2370(Refresh)S +2722(raster)S +3008(pixels)S +10 R +3241(.)S +3343(Parameters)S +3833(are)S +4001(raster)S +4269(number,)S +4646(coordinate)S +5114(type)S +5333(\(0)S +5464(for)S +1488 V +2370(pixel,)S +2625(1)S +2705(for)S +2851(NDC\),)S +3150(x1,)S +3305(y1,)S +3460(nx,)S +3615(ny.)S +1656 V +10 B +1620(rsp)S +10 I +2370(Set)S +2533(all)S +2680(the)S +2843(raster)S +3123(pixels)S +3397(in)S +3516(a)S +3607(region)S +3910(to)S +4030(a)S +4122(single)S +4403(color)S +10 R +4614(.)S +4711(Parameters)S +5196(are)S +5359(raster)S +1776 V +2370(number,)S +2740(coordinate)S +3201(type)S +3413(\(0)S +3536(for)S +3692(pixel,)S +3957(1)S +4047(for)S +4203(NDC\),)S +4511(x1,)S +4675(y1,)S +4839(nx,)S +5003(ny,)S +5167(color,)S +5436(and)S +1896 V +2370(raster)S +2631(operand.)S +3047(If)S +3153(nx=ny=0)S +3555(the)S +3717(entire)S +3984(raster)S +4245(will)S +4441(be)S +4575(written.)S +4924(Raster)S +5220(operands)S +2016 V +2370(include)S +2714(transient)S +3108(\(octal)S +3385(020\),)S +3643(refresh_all)S +4119(\(octal)S +4395(040\),)S +4652(or)S +4784(refresh_none)S +5353(\(octal)S +2136 V +2370(100\).)S +2304 V +10 B +1620(rco)S +10 I +2370(Copy)S +2633(a)S +2735(region)S +3048(of)S +3178(the)S +3353(source)S +3672(raster)S +3964(to)S +4095(a)S +4198(region)S +4512(of)S +4643(the)S +4818(destination)S +5316(raster)S +10 R +5555(.)S +2424 V +2370(Parameters)S +2864(are)S +3035(raster)S +3306(operand,)S +3702(source)S +4012(raster)S +4283(number,)S +4663(source)S +4973(type,)S +5220(source)S +5530(x)S +2544 V +2370(coord,)S +2657(source)S +2952(y)S +3038(coord,)S +3326(source)S +3622(width,)S +3911(source)S +4207(height,)S +4518(destination)S +4993(raster)S +5250(number,)S +2664 V +2370(destination)S +2854(type,)S +3096(destination)S +3580(x)S +3675(coord,)S +3971(destination)S +4454(y)S +4548(coord,)S +4844(destination)S +5327(width,)S +2784 V +2370(destination)S +2851(height,)S +3168(If)S +3276(the)S +3440(input)S +3689(and)S +3876(output)S +4175(regions)S +4512(are)S +4676(not)S +4847(the)S +5012(same)S +5260(size)S +5458(the)S +2904 V +2370(subimage)S +2793(is)S +2899(automatically)S +3482(scaled)S +3770(to)S +3887(\256t)S +4010(the)S +4171(destination)S +4649(region.)S +4998(If)S +5103(the)S +5264(destina-)S +3024 V +2370(tion)S +2565(extent)S +2848(DNX)S +3103(or)S +3225(DNY)S +3480(is)S +3587(negative,)S +3990(the)S +4152(image)S +4436(is)S +4543(\257ipped)S +4861(in)S +4979(that)S +5169(axis.)S +5425(The)S +3144 V +2370(type)S +2589(of)S +2719(spatial)S +3026(scaling)S +3355(performed)S +3816(is)S +3929(determined)S +4424(by)S +4570(the)S +4738(scale)S +4983(factors)S +5300(\(zoom,)S +3264 V +2370(dezoom,)S +2742(or)S +2856(no)S +2987(scaling\).)S +3389(The)S +3575(rasterop)S +3927(argument)S +4335(is)S +4433(used)S +4647(to)S +4757(exercise)S +5115(\256ne)S +5297(control)S +3384 V +2370(over)S +2582(how)S +2789(the)S +2946(mapping)S +3331(is)S +3433(performed,)S +3908(e.g.)S +4087(to)S +4200(force)S +4439(a)S +4517(refresh,)S +4852(implement)S +5314(a)S +5392(tran-)S +3504 V +2370(sient)S +2596(mapping,)S +3008(or)S +3128(in)S +3243(the)S +3402(case)S +3610(of)S +3730(a)S +3812(dezoom)S +4166(\(many-to-one\))S +4780(mapping,)S +5193(select)S +5458(the)S +3624 V +2370(antialiasing)S +2861(technique)S +3279(to)S +3387(be)S +3511(used.)S +3792 V +10 B +1620(rwc)S +10 I +2370(Write)S +2652(a)S +2762(colormap)S +10 R +3145(.)S +3260(Parameters)S +3763(are)S +3944(colormap)S +4381(number,)S +4771(\256rst)S +4987(color)S +5253(and)S +5458(the)S +3912 V +2370(number)S +2705(of)S +2818(colors)S +3092(followed)S +3477(by)S +3607(NC)S +3776(colors)S +4050(triples)S +4330(in)S +4438(the)S +4590(data.)S +4080 V +10 B +1620(rrc)S +10 I +2370(Return)S +2673(the)S +2826(color)S +3068(assignments)S +3588(for)S +3736(a)S +3817(region)S +4109(of)S +4218(the)S +4371(named)S +4668(colormap)S +10 R +5051(.)S +5137(Parameters)S +4200 V +2370(are)S +2536(colormap)S +2957(number,)S +3331(\256rst)S +3531(color)S +3780(and)S +3968(the)S +4134(number)S +4483(of)S +4610(colors)S +4898(followed)S +5297(by)S +5441(NC)S +4320 V +2370(colors)S +2644(triples)S +2924(in)S +3032(the)S +3184(data.)S +4488 V +10 B +1620(rlc)S +10 I +2370(Load)S +2609(a)S +2692(colormap)S +3108(into)S +3297(the)S +3452(display)S +10 R +3741(,)S +3799(optionally)S +4238(scaling)S +4554(the)S +4709(colormap)S +5119(via)S +5275(a)S +5353(linear)S +4608 V +2370(transformation)S +2992(in)S +3103(the)S +3258(process.)S +3645(Parameters)S +4121(are)S +4275(the)S +4430(colormap)S +4840(number,)S +5203(the)S +5358(o)S +5408 H + (f)show 10 -.5 mul h (f)show +10 R +5469(set)S +4728 V +2370(value,)S +2656(and)S +2845(the)S +3012(cursor)S +3306(x)S +3401(and)S +3590(Y)S +3707(coordinates)S +4212(in)S +4336(NDC)S +4593(units.)S +4889(The)S +5090(colormap)S +5513(is)S +4848 V +2370(una)S +2514 H + (f)show 10 -.5 mul h (f)show +10 R +2575(ected)S +2836(if)S +2948(o)S +2998 H + (f)show 10 -.5 mul h (f)show +10 R +3059(set=0.5,)S +3427(scale=1.0.)S +3912(A)S +4034(negative)S +4422(scale)S +4671(inverts)S +4993(the)S +5165(image.)S +5514(If)S +4968 V +2370(map=0)S +2678(the)S +2830(linear)S +3087(transformation)S +3705(is)S +3802(applied)S +4126(directly)S +4461(to)S +4569(the)S +4721(display)S +5040(colormap.)S +5136 V +10 B +1620(rfc)S +10 I +2370(Free)S +2588(a)S +2668(colormap)S +10 R +3051(.)S +3136(Parameter)S +3570(is)S +3667(the)S +3819(colormap)S +4226(number.)S +5304 V +10 B +1620(rwo)S +10 I +2370(Write)S +2626(the)S +2782(IOmap)S +10 R +3059(.)S +3118(Parameters)S +3595(are)S +3750(the)S +3907(\256rst)S +4098(color)S +4338(and)S +4517(the)S +4674(number)S +5014(of)S +5132(colors,)S +5436(fol-)S +5424 V +2370(lowed)S +2651(by)S +2788(NC)S +2964(color)S +3206(triples)S +3493(in)S +3608(the)S +3767(data.)S +4025(An)S +4184(iomap)S +4471(is)S +4575(an)S +4706(optional)S +5071(lookup)S +5386(table)S +5544 V +2370(used)S +2600(to)S +2725(isolate)S +3033(the)S +3202(client)S +3471(application)S +3962(from)S +4203(the)S +4372(color)S +4625(model)S +4923(used)S +5154(within)S +5458(the)S +5664 V +2370(Gterm)S +2656(widget.)S +3014(To)S +3156(simplify)S +3521(color)S +3757(allocation)S +4182(the)S +4334(Gterm)S +4619(widget)S +4921(de\256nes)S +5234(a)S +5308(logical)S +5784 V +2370(color)S +2612(space)S +2870(where)S +3150(color)S +3392(0)S +3479(is)S +3583(the)S +3742(background,)S +4275(1)S +4362(the)S +4522(foreground,)S +5028(2-N)S +5221(are)S +5380(stati-)S +5904 V +2370(cally)S +2613(allocated)S +3022(standard)S +3409(colors,)S +3727(and)S +3920(colors)S +4213(N+1)S +4439(and)S +4631(above)S +4917(are)S +5086(dynamically)S +6024 V +2370(allocated)S +2772(by)S +2914(the)S +3078(graphics)S +3458(application.)S +3999(Less-demanding)S +4701(applications)S +5226(use)S +5402(only)S +6144 V +2370(the)S +2529(statically)S +2927(allocated,)S +3349(shared)S +3646(colors.)S +3982(The)S +4174(widget)S +4483(internally)S +4903(maps)S +5150(these)S +5391(logi-)S +6264 V +2370(cal)S +2538(colors)S +2834(to)S +2964(whatever)S +3381(the)S +3555(window)S +3929(system)S +4259(requires,)S +4657(but)S +4837(providing)S +5278(a)S +5375(well-)S +6384 V +2370(de\256ned)S +2701(logical)S +3010(color)S +3252(space)S +3510(isolates)S +3847(the)S +4006(client)S +4264(from)S +4494(the)S +4652(details)S +4949(of)S +5068(color)S +5309(alloca-)S +6504 V +2370(tion)S +2556(in)S +2664(the)S +2816(underlying)S +3279(window)S +3631(system.)S +6744 V +2370(An)S +2534(iomap)S +2826(can)S +3006(be)S +3142(used)S +3367(to)S +3487(de\256ne)S +3773(a)S +3859(mapping)S +4251(between)S +4626(the)S +4791(color)S +5039(model)S +5332(of)S +5458(the)S +6864 V +2370(client)S +2629(application)S +3110(and)S +3291(the)S +3450(Gterm)S +3742(color)S +3984(model)S +4271(\(when)S +4557(we)S +4710(say)S +4880(color)S +5122(model)S +5409(here)S +6984 V +2370(we)S +2538(mean)S +2806(color)S +3063(allocation)S +3509(schemes)S +3899(for)S +4067(8)S +4170(bit)S +4329(pseudocolor\).)S +4958(By)S +5128(default)S +5458(the)S +7104 V +2370(iomap)S +2667(is)S +2781(one-to-one.)S +3315(The)S +3517(use)S +3697(of)S +3827(an)S +3968(iomap)S +4265(frees)S +4505(the)S +4674(client)S +4943(from)S +5184(having)S +5502(to)S +7224 V +2370(worry)S +2646(about)S +2907(color)S +3151(index)S +3412(translations,)S +3937(and)S +4120(allows)S +4420(color)S +4664(tables)S +4936(to)S +5053(be)S +5186(combined)S +7704 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5530(9)S +7920 V +EP +%%Page: 10 11 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +2370(in)S +2481(the)S +2635(widget)S +2939(for)S +3087(greater)S +3395(e)S +3439 H + (f)show 10 -.5 mul h (\256)show +10 R +3523(ciency)S +3815(when)S +4063(color)S +4300(tables)S +4565(are)S +4718(serially)S +5044(applied.)S +5425(The)S +1080 V +2370(iomap)S +2670(applies)S +3003(to)S +3131(all)S +3281(color)S +3536(indices)S +3870(or)S +4004(pixel)S +4255(values)S +4561(passed)S +4878(in)S +5007(i/o)S +5164(operations)S +1200 V +2370(between)S +2732(the)S +2884(client)S +3136(and)S +3310(the)S +3462(Gterm)S +3747(widget.)S +1368 V +10 B +1620(rro)S +10 I +2370(Read)S +2613(the)S +2773(IOmap)S +10 R +3050(.)S +3143(Return)S +3453(values)S +3746(are)S +3905(the)S +4065(\256rst)S +4259(color)S +4502(and)S +4684(the)S +4845(number)S +5189(of)S +5311(colors,)S +1488 V +2370(followed)S +2755(by)S +2885(NC)S +3054(color)S +3289(triples)S +3569(in)S +3677(the)S +3829(data.)S +1656 V +10 B +1620(rim)S +10 I +2370(Delete)S +2660(all)S +2796(mappings)S +10 R +3215(and)S +3389(initialize)S +3769(the)S +3921(mapping)S +4301(subsystem.)S +1824 V +10 B +1620(rsm)S +10 I +2370(De\256ne)S +2669(a)S +2758(new)S +2958(mapping)S +3347(function)S +10 R +3675(,)S +3739(or)S +3861(modify)S +4189(an)S +4322(old)S +4489(one.)S +4727(If)S +4833(a)S +4917(new)S +5123(mapping)S +5513(is)S +1944 V +2370(de\256ned)S +2701(it)S +2794(is)S +2898(merely)S +3212(enabled,)S +3584(and)S +3765(no)S +3902(refreshing)S +4342(of)S +4461(the)S +4619(screen)S +4909(takes)S +5150(place)S +5396(until)S +2064 V +2370(either)S +2635(some)S +2885(mapped)S +3240(data)S +3445(is)S +3551(written)S +3873(to)S +3990(or)S +4112(the)S +4273(mapping)S +4662(is)S +4768(explicitly)S +5185(refreshed.)S +2184 V +2370(If)S +2478(an)S +2614(existing)S +2973(mapping)S +3365(is)S +3474(modi\256ed)S +3872(the)S +4036(old)S +4206(and)S +4392(new)S +4600(mappings)S +5030(are)S +5192(examined)S +2304 V +2370(and)S +2546(only)S +2756(those)S +2999(portions)S +3359(of)S +3475(the)S +3630(destination)S +4102(rect)S +4284(for)S +4433(which)S +4710(the)S +4865(mapping)S +5248(changed)S +2424 V +2370(are)S +2526(updated.)S +2932(This)S +3144(permits)S +3478(minor)S +3751(changes)S +4106(to)S +4218(a)S +4296(mapping)S +4680(\(e.g.)S +4891(moving)S +5231(an)S +5359(edge\))S +2544 V +2370(without)S +2713(having)S +3022(to)S +3137(redraw)S +3451(the)S +3611(entire)S +3876(region.)S +4224(Regions)S +4590(of)S +4711(the)S +4871(destination)S +5348(draw-)S +2664 V +2370(able)S +2573(which)S +2854(were)S +3084(previously)S +3543(covered)S +3895(by)S +4032(the)S +4191(mapping)S +4578(but)S +4743(which)S +5024(were)S +5253(exposed)S +2784 V +2370(by)S +2500(modifying)S +2947(the)S +3099(mapping)S +3479(are)S +3630(redrawn.)S +2952 V +10 B +1620(rgm)S +10 I +2370(Return)S +2697(the)S +2874(external)S +3257(parameters)S +3768(of)S +3902(a)S +4008(mapping)S +10 R +4358(.)S +4469(Parameter)S +4929(is)S +5052(the)S +5230(mapping)S +3072 V +2370(number,)S +2739(values)S +3033(returned)S +3404(\(in)S +3554(the)S +3714(string)S +3980("\\033[6;%d;%d)S +4642(%d;%d;%d;%d;%d;%d)S +3192 V +2370(%d;%d;%d;%d;%d;%d]"\))S +3452(are)S +3610(the)S +3769(mapping)S +4156(number,)S +4523(rasterop,)S +4907(source)S +5205(mapping,)S +3312 V +2370(type,)S +2622(x,)S +2752(y,)S +2882(width,)S +3190(height,)S +3520(and)S +3719(destination)S +4213(mapping,)S +4643(type,)S +4895(x,)S +5025(y,)S +5154(width)S +5436(and)S +3432 V +2370(height.)S +3600 V +10 B +1620(rem)S +10 I +2370(Enable)S +2698(a)S +2793(mapping)S +10 R +3143(.)S +3213(Parameters)S +3701(are)S +3867(the)S +4034(mapping)S +4429(number)S +4779(and)S +4968(an)S +5107(integer)S +5430(\257ag)S +3720 V +2370(indicating)S +2800(whether)S +3151(to)S +3259(refresh)S +3565(the)S +3717(mapping.)S +3888 V +10 B +1620(rdm)S +10 I +2370(Disable)S +2749(a)S +2867(mapping)S +10 R +3217(.)S +3310(Disabling)S +3768(a)S +3881(mapping)S +4300(does)S +4552(not)S +4749(a)S +4793 H + (f)show 10 -.5 mul h (f)show +10 R +4854(ect)S +5039(the)S +5230(mapping)S +4008 V +2370(de\256nition,)S +2822(hence)S +3097(a)S +3184(disabled)S +3559(mapping)S +3951(may)S +4165(later)S +4384(be)S +4520(reenabled.)S +4974(Parameters)S +5459(are)S +4128 V +2370(the)S +2528(mapping)S +2914(number)S +3255(and)S +3435(an)S +3565(integer)S +3878(\257ag)S +4065(indicating)S +4502(whether)S +4860(to)S +4975(erase)S +5216(the)S +5375(map-)S +4248 V +2370(ping.)S +4416 V +10 B +1620(rrm)S +10 I +2370(Refresh)S +2705(a)S +2785(mapping)S +10 R +3135(.)S +3190(Parameter)S +3624(is)S +3721(the)S +3873(mapping)S +4253(number.)S +4584 V +10 B +1620(rfm)S +10 I +2370(Free)S +2588(a)S +2668(mapping)S +10 R +3018(.)S +3073(Parameter)S +3507(is)S +3604(the)S +3756(mapping)S +4136(number.)S +4872 V +9 B +900(MORE)S +1207(ON)S +1369(IMAGING)S +4992 V +10 R +1260(The)S +1457(imaging)S +1827(model)S +2119(of)S +2244(the)S +2408(Gterm)S +2705(widget)S +3019(de\256nes)S +3344(the)S +3508(following)S +3939(key)S +4125(object)S +4412(or)S +4538(data)S +4747(types:)S +10 I +5029(rasters)S +10 R +5307(,)S +10 I +5375(map-)S +5112 V +1260(pings)S +10 R +1477(,)S +1532(and)S +10 I +1706(colors)S +10 R +1956(.)S +5280 V +10 B +1260(raster)S +10 R +1760(A)S +1867(raster)S +2123(is)S +2225(a)S +2304(MxN)S +2550(array)S +2789(of)S +2907(pixels.)S +3236(At)S +3371(present)S +3694(pixels)S +3968(are)S +4124(8)S +4209(bits)S +4389(deep)S +4612(but)S +4775(hooks)S +5049(are)S +5205(built)S +5424(into)S +5400 V +1760(the)S +1915(widget)S +2220(to)S +2331(expand)S +2652(this)S +2830(in)S +2941(the)S +3096(future.)S +3422(Pixel)S +3661(values)S +3949(are)S +4103(indices)S +4419(into)S +4608(the)S +4762(Gterm)S +5049(virtual)S +5342(color-)S +5520 V +1760(map,)S +2004(with)S +2230(values)S +2533(starting)S +2881(at)S +3001(zero.)S +3275(A)S +3395(raster)S +3664(may)S +3884(be)S +4026(any)S +4218(size.)S +4476(A)S +4596(raster)S +4865(is)S +4980(merely)S +5305(a)S +5397(two-)S +5640 V +1760(dimensional)S +2284(array)S +2523(in)S +2636(the)S +2793(graphics)S +3166(server;)S +3472(it)S +3563(is)S +3665(not)S +3828(displayed)S +4246(unless)S +4530(mapped.)S +4935(An)S +5091(exception)S +5513(is)S +5760 V +1760(raster)S +2019(zero,)S +2253(which)S +2535(is)S +2640(the)S +2800(graphics)S +3176(window.)S +3592(Rasters)S +3925(are)S +4085(referred)S +4438(to)S +4555(by)S +4694(number,)S +5063(starting)S +5402(with)S +5880 V +1760(zero.)S +2029(Initially)S +2389(only)S +2610(raster)S +2874(zero)S +3088(exists;)S +3387(new)S +3595(rasters)S +3897(are)S +4060(created)S +4389(with)S +4609(the)S +4773(create)S +5052(raster)S +5315(escape)S +6000 V +1760(code)S +10 B +1980(rcr)S +10 R +2112(.)S +2199(Space)S +2469(for)S +2617(rasters)S +2909(may)S +3113(be)S +3239(allocated)S +3631(either)S +3890(in)S +4000(the)S +4154(graphics)S +4524(server,)S +4825(or)S +4941(in)S +5052(the)S +5207(X)S +5312(server.)S +6120 V +1760(This)S +1978(has)S +2151(implications)S +2686(on)S +2826(performance)S +3369(but)S +3537(is)S +3644(otherwise)S +4071(transparent)S +4553(to)S +4670(the)S +4831(client.)S +5147(By)S +5303(default)S +6240 V +1760(rasters)S +2050(are)S +2201(allocated)S +2591(in)S +2699(the)S +2851(graphics)S +3219(server,)S +3517(i.e.,)S +3694(in)S +3802(the)S +3954(X)S +4056(client.)S +6408 V +10 B +1260(mapping)S +10 R +1760(A)S +1863(mapping)S +2244(de\256nes)S +2558(a)S +2633(projection)S +3069(of)S +3183(a)S +3258(rectangle)S +3654(of)S +3768(the)S +3921(source)S +4212(raster)S +4464(onto)S +4673(a)S +4748(rectangle)S +5145(of)S +5260(the)S +5414(des-)S +6528 V +1760(tination)S +2110(raster.)S +2430(Mappings)S +2873(may)S +3088(be)S +3225(either)S +3495(enabled)S +3848(\(active\))S +4195(or)S +4321(disabled.)S +4752(When)S +5033(a)S +5120(mapping)S +5513(is)S +6648 V +1760(enabled,)S +2133(any)S +2315(change)S +2635(to)S +2751(a)S +2833(pixel)S +3072(in)S +3189(the)S +3350(source)S +3649(rect)S +3837(will)S +4032(cause)S +4292(the)S +4453(corresponding)S +5063(pixels)S +5341(in)S +5458(the)S +6768 V +1760(destination)S +2239(rect)S +2428(to)S +2546(be)S +2680(updated.)S +3090(Mappings)S +3529(are)S +3689(referred)S +4042(to)S +4159(by)S +4298(number)S +4642(starting)S +4981(with)S +5198(one.)S +5436(Ini-)S +6888 V +1760(tially)S +2005(no)S +2144(mappings)S +2572(are)S +2732(de\256ned.)S +3120(If)S +3225(the)S +3386(size)S +3580(of)S +3702(the)S +3863(input)S +4108(and)S +4291(output)S +4587(rect)S +4776(is)S +4883(not)S +5051(the)S +5213(same)S +5458(the)S +7008 V +1760(input)S +2010(rect)S +2203(will)S +2402(be)S +2539(scaled)S +2831(by)S +2974(pixel)S +3217(replication)S +3687(or)S +3813(subsampling)S +4362(to)S +4483(\256ll)S +4638(the)S +4803(output)S +5102(rect.)S +5349(If)S +5458(the)S +7128 V +1760(argument)S +2174(DW)S +2377(\(destination)S +2886(width\))S +3184(or)S +3304(DH)S +3485(\(destination)S +3994(height\))S +4314(of)S +4434(the)S +4593(destination)S +5069(rect)S +5255(is)S +5359(nega-)S +7248 V +1760(tive,)S +1969(the)S +2125(image)S +2403(will)S +2593(be)S +2721(\257ipped)S +3033(around)S +3344(the)S +3500(corresponding)S +4105(axis)S +4299(when)S +4548(copied)S +4847(to)S +4958(the)S +5113(destination;)S +7728 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5480(10)S +7920 V +EP +%%Page: 11 12 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +1760(the)S +1919(region)S +2211(of)S +2331(the)S +2490(destination)S +2966(drawn)S +3252(into)S +3445(is)S +3550(the)S +3710(same)S +3953(in)S +4069(either)S +4334(case.)S +4598(Multiple)S +4981(mappings)S +5408(may)S +1080 V +1760(reference)S +2162(the)S +2317(same)S +2555(source)S +2848(or)S +2964(destination)S +3436(raster.)S +3745(Mappings)S +4178(are)S +4332(refreshed)S +4735(in)S +4846(order)S +5089(by)S +5221(the)S +5375(map-)S +1200 V +1760(ping)S +1972(number.)S +2366(Modifying)S +2828(a)S +2907(mapping)S +3292(causes)S +3587(the)S +3744(changed)S +4111(regions)S +4440(of)S +4558(the)S +4715(destination)S +5189(rect)S +5373(to)S +5486(be)S +1320 V +1760(refreshed.)S +1488 V +10 B +1260(color)S +10 R +1760(The)S +10 I +1964(Gterm)S +10 R +2268(widget)S +2590(provides)S +2984(a)S +3078(\256xed)S +3328(number)S +3683(of)S +3816(preassigned)S +4337(colors)S +4631(corresponding)S +5252(to)S +5380(pixel)S +1608 V +1760(values)S +2058(0)S +2151(through)S +2505(9.)S +2623(Zero)S +2854(is)S +2964(the)S +3129(background)S +3643(color,)S +3916(one)S +4103(is)S +4213(the)S +4378(foreground)S +4864(color,)S +5136(and)S +5322(2-9)S +5497(\(8)S +1728 V +1760(colors\))S +2075(are)S +2234(arbitrary)S +2615(colors)S +2897(de\256ned)S +3230(by)S +3369(Gterm)S +3663(widget)S +3974(resources.)S +4444(These)S +4721(static)S +4971(colors)S +5254(are)S +5414(nor-)S +1848 V +1760(mally)S +2021(used)S +2237(to)S +2348(draw)S +2580(the)S +2735(background,)S +3264(frame,)S +3554(axes,)S +3789(titles,)S +4042(etc.)S +4216(of)S +4332(a)S +4409(plot,)S +4623(or)S +4739(to)S +4850(draw)S +5082(color)S +5320(graph-)S +1968 V +1760(ics)S +1904(within)S +2193(the)S +2348(drawing)S +2708(area.)S +2961(The)S +3149(advantage)S +3586(of)S +3702(static)S +3946(colors)S +4223(is)S +4324(that)S +4508(they)S +4714(are)S +4869(shared)S +5163(with)S +5375(other)S +2088 V +1760(X)S +1867(clients,)S +2188(and)S +2367(the)S +2524(values)S +2814(of)S +2932(these)S +3172(colors)S +3451(may)S +3658(be)S +3787(assigned)S +4166(by)S +4301(the)S +4458(user)S +4658(to)S +4770(personalize)S +5258(the)S +5414(way)S +2208 V +1760(plots)S +1985(look.)S +2448 V +1760(The)S +10 I +1956(Gterm)S +10 R +2252(widget)S +2565(also)S +2767(allows)S +3069(any)S +3254(number)S +3600(\(up)S +3774(to)S +3893(about)S +4157(200)S +4349(or)S +4474(so\))S +4638(additional)S +5080(colors)S +5366(to)S +5486(be)S +2568 V +1760(de\256ned)S +2086(at)S +2190(runtime)S +2532(by)S +2663(the)S +2816(client)S +3069(application.)S +3599(These)S +3868(color)S +4104(values)S +4390(start)S +4593(at)S +4696(pixel)S +4927(value)S +5174(10)S +5305(and)S +5480(go)S +2688 V +1760(up)S +1891(to)S +2000(the)S +2153(maximum)S +2590(pixel)S +2821(value)S +3068(assigned)S +3443(by)S +3575(the)S +3729(client.)S +4038(The)S +4225(client)S +4479(application)S +4955(allocates)S +5336(colors)S +2808 V +1760(with)S +1985(the)S +2154(write)S +2406(colormap)S +2830(escape)S +3142(code)S +10 B +3377(rwc)S +10 R +3537(.)S +3638(Attempts)S +4051(to)S +4175(overwrite)S +4603(the)S +4771(values)S +5072(of)S +5201(the)S +5369(static)S +2928 V +1760(colors)S +2045(are)S +2207(ignored.)S +2608(The)S +2804(values)S +3100(of)S +3225(already)S +3560(allocated)S +3962(colors)S +4248(may)S +4462(be)S +4598(changed)S +4972(dynamically)S +5508(at)S +3048 V +1760(runtime)S +2101(using)S +2348(write)S +2583(colormap)S +2990(code)S +3208(to)S +3316(write)S +3551(the)S +3703(desired)S +4021(range)S +4272(of)S +4385(color)S +4620(values.)S +3288 V +1760(Applications)S +2320(should)S +2636(not)S +2813(assume)S +3157(that)S +3357(there)S +3606(are)S +3777(10)S +3927(static)S +4188(colors)S +4482(and)S +4676(200)S +4876(or)S +5009(so)S +5148(allocatable)S +3408 V +1760(colors.)S +2106(The)S +2308(IRAF)S +2583(graphcap)S +2994(entry)S +3245(for)S +3407(the)S +3575(logical)S +3893(device)S +4199(in)S +4323(use,)S +4527(and)S +4717(resources)S +5139(set)S +5296(for)S +5458(the)S +3528 V +1760(widget,)S +2095(de\256nes)S +2416(these)S +2659(parameters)S +3134(for)S +3288(the)S +3449(device.)S +3803(Alternatively,)S +4394(the)S +4555(read)S +4765(colormap)S +5181(code)S +5408(may)S +3648 V +1760(be)S +1901(used)S +2131(to)S +2256(dynamically)S +2797(determine)S +3243(how)S +3462(many)S +3731(colors)S +4022(the)S +4191(server)S +4481(has)S +4661(preallocated)S +5195(when)S +5458(the)S +3768 V +1760(application)S +2234(starts)S +2475(up.)S +4008 V +1760(An)S +1913(image)S +2188(may)S +2391(use)S +2555(either)S +2813(static)S +3055(and)S +3230(dynamic)S +3605(pixel)S +3836(values)S +4122(or)S +4236(both)S +4445(types)S +4688(of)S +4803(values,)S +5115(but)S +5275(in)S +5385(most)S +4128 V +1760(cases)S +2006(imaging)S +2370(applications)S +2889(involve)S +3225(smoothly)S +3634(shaded)S +3947(surfaces)S +4309(hence)S +4577(will)S +4769(require)S +5086(dynamically)S +4248 V +1760(assigned)S +2134(private)S +2441(colors.)S +4488 V +1760(If)S +1878(for)S +2046(some)S +2309(reason)S +2621(the)S +2795(client)S +3069(application)S +3565(cannot)S +3883(use)S +4068(the)S +10 I +4242(Gterm)S +10 R +4549(widget)S +4873(color)S +5130(model,)S +5458(the)S +4608 V +1760(IOMAP)S +2116(feature)S +2426(can)S +2598(be)S +2726(used)S +2943(to)S +3055(make)S +3305(the)S +3461(widget)S +3767(appear)S +4065(to)S +4176(have)S +4397(some)S +4641(externally)S +5073(de\256ned)S +5400(\(i.e.,)S +4728 V +1760(client)S +2012(de\256ned\))S +2369(color)S +2604(model.)S +4896 V +1260(The)S +1459(maximum)S +1910(number)S +2260(of)S +2388(rasters)S +2693(and)S +2882(maximum)S +3333(number)S +3683(of)S +3811(mappings)S +4245(is)S +4357(de\256ned)S +4696(by)S +4841(the)S +5008(Gterm)S +5308(widget)S +5016 V +1260(resources)S +10 I +1671(maxRaster)S +10 R +2133(and)S +10 I +2311(maxMappings)S +10 R +2911(\(or)S +3061(in)S +3173(the)S +3329(GUI)S +3540(\256le\))S +3735(when)S +3985(the)S +4141(graphics)S +4513(application)S +4991(starts)S +5236(up.)S +5425(The)S +5136 V +1260(maximum)S +1698(values)S +1985(should)S +2284(be)S +2410(much)S +2664(larger)S +2928(than)S +3132(most)S +3359(applications)S +3874(require.)S +4244(Applications)S +4788(should)S +5088(allocate)S +5431(ras-)S +5256 V +1260(ter)S +1396(or)S +1510(mapping)S +1891(numbers)S +2266(sequentially)S +2780(starting)S +3111(at)S +3214(1)S +3295(\(more)S +3564(or)S +3678(less\))S +3892(to)S +4001(avoid)S +4254(running)S +4595(out)S +4753(of)S +4866(raster)S +5117(or)S +5230(mapping)S +5376 V +1260(descriptors.)S +5616 V +1260(The)S +1448({read|write}pixels)S +2212(escape)S +2510(codes)S +2770(operate)S +3096(directly)S +3434(on)S +3567(raster)S +3821(pixels.)S +4148(The)S +4336(mapping)S +4720(escape)S +5019(codes)S +5280(support)S +5736 V +1260(two)S +1449(alternative)S +1909(coordinate)S +2369(systems,)S +2750(raster)S +3010(pixels)S +3288(and)S +3470(NDC)S +3719(\(normalized)S +4239(device)S +4537(coordinates\),)S +5093(as)S +5214(indicated)S +5856 V +1260(by)S +1391(the)S +1544(ST)S +1692(or)S +1806(DT)S +1971(argument)S +2380(\(source)S +2705(or)S +2820(destination)S +3291(coordinate)S +3744(type\).)S +4036(Note)S +4262(that)S +4444(the)S +4598(origin)S +4869(of)S +4984(the)S +5138(pixel)S +5370(coor-)S +5976 V +1260(dinate)S +1548(system)S +1870(is)S +1981(the)S +2147(upper)S +2418(left)S +2595(corner)S +2893(of)S +3020(the)S +3186(display)S +3519(window)S +3885(\(consistent)S +4362(with)S +4584(most)S +4823(graphics)S +5205(systems\),)S +6096 V +1260(whereas)S +1616(the)S +1768(origin)S +2037(of)S +2150(the)S +2302(NDC)S +2543(coordinate)S +2994(system)S +3302(is)S +3399(the)S +3551(lower)S +3808(left)S +3971(corner)S +4255(\(consistent)S +4718(with)S +4926(IRAF\).)S +6336 V +1260(Pixel)S +1503(coordinates)S +2000(allow)S +2259(precise)S +2578(control)S +2898(of)S +3018(imaging)S +3383(but)S +3548(require)S +3867(the)S +4026(application)S +4507(to)S +4622(know)S +4881(the)S +5040(window)S +5400(size,)S +6456 V +1260(and)S +1443(may)S +1654(result)S +1915(in)S +2032(complications)S +2632(e.g.)S +2815(if)S +2915(the)S +3075(window)S +3435(is)S +3540(resized.)S +3915(NDC)S +4164(coordinates)S +4662(pretty)S +4933(much)S +5193(guarantee)S +6576 V +1260(that)S +1450(a)S +1535(mapping)S +1926(will)S +2123(involve)S +2464(sampling,)S +2897(hence)S +3170(are)S +3332(not)S +3501(the)S +3664(most)S +3900(e)S +3944 H + (f)show 10 -.5 mul h (\256)show +10 R +4028(cient,)S +4288(but)S +4457(the)S +4620(graphics)S +4999(will)S +5196(be)S +5331(drawn)S +6696 V +1260(correctly)S +1656(no)S +1798(matter)S +2095(how)S +2308(the)S +2471(window)S +2834(is)S +2942(resized)S +3265(and)S +3450(for)S +3607(most)S +3843(applications)S +4367(the)S +4530(performance)S +5074(di)S +5152 H + (f)show 10 -.5 mul h (f)show +10 R +5213(erence)S +5513(is)S +6816 V +1260(negligible.)S +1754(Most)S +1999(applications)S +2521(should)S +2827(use)S +2999(NDC)S +3249(coordinates)S +3748(for)S +3903(raster)S +4163(0)S +4252(\(the)S +4447(display)S +4776(window\),)S +5196(and)S +5380(pixel)S +6936 V +1260(coordinates)S +1750(for)S +1896(rasters)S +2186(1-N.)S +7176 V +1260(Although)S +1672(the)S +1828(size)S +2017(of)S +2134(rasters)S +2428(1)S +2512(and)S +2690(higher)S +2979(are)S +3134(de\256ned)S +3462(by)S +3596(the)S +3752(client)S +4008(application,)S +4511(the)S +4667(size)S +4856(of)S +4973(raster)S +5228(zero,)S +5458(the)S +7296 V +1260(actual)S +1533(gterm)S +1801(display)S +2125(window,)S +2507(is)S +2609(subject)S +2927(to)S +3040(the)S +3197(constraints)S +3665(of)S +3783(the)S +3940(window)S +4296(system.)S +4663(The)S +4852(client)S +5108(can)S +5280(attempt)S +7776 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5480(11)S +7920 V +EP +%%Page: 12 13 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(to)S +1369(reset)S +1588(the)S +1741(size)S +1927(of)S +2041(the)S +2194(gterm)S +2458(window)S +2811(using)S +3059(create)S +3327(raster)S +3579(escape)S +3875(with)S +4084(raster=0,)S +4467(however)S +4842(the)S +4996(Gterm)S +5283(widget,)S +1080 V +1260(UI)S +1398(containing)S +1853(the)S +10 I +2008(Gterm)S +10 R +2296(widget,)S +2626(and)S +2803(the)S +2958(window)S +3313(manager)S +3689(are)S +3843(all)S +3976(free)S +4163(to)S +4274(deny)S +4500(such)S +4715(a)S +4791(request.)S +5166(The)S +5353(query)S +1200 V +1260(raster)S +1511(escape)S +1806(should)S +2103(be)S +2227(called)S +2495(to)S +2603(determine)S +3032(the)S +3184(actual)S +3452(size)S +3637(of)S +3750(the)S +3902(window)S +4254(one)S +4428(will)S +4614(be)S +4738(drawing)S +5095(into.)S +1488 V +9 B +1080(AN)S +1252(EXAMPLE)S +1744(IMAGING)S +2211(APPLICATION)S +1608 V +10 R +1260(An)S +1413(example)S +1782(of)S +1896(a)S +1972(simple)S +2271(imaging)S +2631(application)S +3107(might)S +3373(be)S +3499(one)S +3675(that)S +3857(downloads)S +4322(an)S +4448(image)S +4724(and)S +4900(displays)S +5260(it)S +5348(in)S +5458(the)S +1728 V +1260(gterm)S +1530(window,)S +1914(\256lling)S +2191(the)S +2350(window.)S +2764(This)S +2979(could)S +3238(be)S +3368(done)S +3598(as)S +3717(follows)S +4053(\(following)S +4511(a)S +4591(graphics)S +4965(open)S +5195(and)S +5375(other)S +1848 V +1260(escape)S +1555(codes)S +1812(to)S +1920(prepare)S +2248(the)S +2400(drawing)S +2757(surface\).)S +2136 V +10 I +1260(create)S +1539(raster)S +10 R +2010(Create)S +2301(raster)S +2554(1)S +2636(the)S +2790(size)S +2977(of)S +3092(the)S +3246(pixel)S +3478(array)S +3714(to)S +3824(be)S +3950(displayed.)S +4390(This)S +4600(need)S +4820(not)S +4980(be)S +5106(the)S +5260(same)S +5497(as)S +2256 V +2010(the)S +2162(size)S +2347(of)S +2460(the)S +2612(gterm)S +2875(display)S +3194(window.)S +2424 V +10 I +1260(set)S +1401(mapping)S +10 R +2010(De\256ne)S +2309(a)S +2386(mapping)S +2769(between)S +3134(raster)S +3388(1)S +3472(and)S +3650(raster)S +3905(0,)S +4014(the)S +4170(display)S +4493(window,)S +4874(using)S +5125(NDC)S +5370(coor-)S +2544 V +2010(dinates)S +2324(to)S +2433(de\256ne)S +2708(the)S +2861(region)S +3147(of)S +3261(the)S +3414(display)S +3734(window)S +4087(to)S +4196(be)S +4321(\256lled.)S +4613(The)S +4798(mapping)S +5178(number)S +5513(is)S +2664 V +2010(arbitrary)S +2394(but)S +2564(mappings)S +2995(should)S +3304(normally)S +3707(be)S +3843(allocated)S +4245(starting)S +4587(with)S +4807(1.)S +4924(The)S +5121(mapping)S +5513(is)S +2784 V +2010(automatically)S +2584(enabled)S +2924(when)S +3170(\256rst)S +3356(de\256ned.)S +2952 V +10 I +1260(write)S +1496(colormap)S +10 R +2010(\(Optional\).)S +2511(De\256ne)S +2807(the)S +2959(pixel)S +3189(value)S +3435(to)S +3543(RGB)S +3779(color)S +4014(assignments)S +4533(for)S +4679(the)S +4831(image)S +5105(pixels.)S +3120 V +10 I +1260(write)S +1496(pixels)S +10 R +2010(This)S +2221(escape)S +2519(is)S +2619(called)S +2890(one)S +3067(or)S +3183(more)S +3421(times)S +3672(to)S +3784(write)S +4023(pixels)S +4296(into)S +4486(raster)S +4741(1.)S +4850(At)S +4984(most)S +5213(32K)S +5419(pix-)S +3240 V +2010(els)S +2152(can)S +2321(be)S +2446(written)S +2760(in)S +2869(each)S +3082(call.)S +3312(As)S +3454(each)S +3666(write)S +3901(is)S +3998(made)S +4244(the)S +4396(a)S +4440 H + (f)show 10 -.5 mul h (f)show +10 R +4501(ected)S +4741(region)S +5026(of)S +5139(the)S +5291(display)S +3360 V +2010(window)S +2362(will)S +2548(be)S +2672(updated.)S +3528 V +1260(Alternatively,)S +1855(one)S +2042(could)S +2307(write)S +2555(the)S +2720(pixels)S +3002(and)S +3189(then)S +3404(de\256ne)S +3692(the)S +3858(mapping)S +4252(to)S +4374(cause)S +4639(the)S +4805(entire)S +5076(image)S +5364(to)S +5486(be)S +3648 V +1260(displayed)S +1673(at)S +1775(once.)S +3888 V +1260(Note)S +1487(that)S +1670(the)S +1825(imaging)S +2186(escape)S +2484(can)S +2655(be)S +2782(combined)S +3209(with)S +3420(normal)S +3736(graphics)S +4107(to)S +4219(draw)S +4452(text)S +4636(and)S +4814(graphics)S +5186(around)S +5497(or)S +4008 V +1260(on)S +1407(top)S +1581(of)S +1710(an)S +1850(image)S +2140(region.)S +2496(The)S +2697(order)S +2953(in)S +3077(which)S +3367(drawing)S +3740(operations)S +4202(occur)S +4469(is)S +4582(important,)S +5042(e.g.,)S +5257(to)S +5381(draw)S +4128 V +1260(graphics)S +1628(or)S +1741(text)S +1921(on)S +2051(top)S +2209(of)S +2322(an)S +2446(image)S +2720(the)S +2872(image)S +3146(should)S +3443(be)S +3567(drawn)S +3846(\256rst.)S +4416 V +9 B +900(MARKERS)S +4536 V +10 R +1260(Markers)S +1625(are)S +1780(a)S +1858(general)S +2185(feature)S +2495(of)S +2612(the)S +10 I +2768(Gterm)S +10 R +3057(widget)S +3363(and)S +3541(are)S +3696(used)S +3913(more)S +4152(extensively)S +4641(in)S +4753(other)S +4992(programs)S +5403(\(e.g.)S +4656 V +1260(the)S +1413(prototype)S +1827(IRAF)S +2086(science)S +2410(GUI)S +2618(applications\),)S +3190(but)S +3349(they)S +3552(have)S +3771(no)S +3902(real)S +4082(use)S +4246(in)S +10 I +4354(xgterm)S +10 R +4661(when)S +4907(used)S +5120(as)S +5233(simply)S +5536(a)S +4776 V +1260(graphics)S +1634(terminal.)S +2028(All)S +2192(markers)S +2549(share)S +2795(some)S +3043(of)S +3163(the)S +3322(same)S +3564(characteristics,)S +4196(so)S +4322(it)S +4415(is)S +4519(worthwhile)S +5011(learning)S +5375(basic)S +4896 V +1260(marker)S +1593(manipulation)S +2172(keystrokes)S +2650(\(as)S +2817(de\256ned)S +3162(using)S +3430(the)S +3603(default)S +3930(marker)S +4262(translations\),)S +4831(especially)S +5280(how)S +5502(to)S +5016 V +1260(delete)S +1528(an)S +1652(accidentally)S +2164(created)S +2481(marker:)S +5184 V +10 B +1620(o)S +10 I +1770(Delete)S +10 R +2060(or)S +10 I +2173(Backspace)S +10 R +2629(in)S +2737(a)S +2811(marker)S +3123(deletes)S +3430(it.)S +5352 V +10 B +1620(o)S +10 R +1770(MB1)S +2006(anywhere)S +2423(inside)S +2692(a)S +2766(marker)S +3078(may)S +3280(be)S +3404(used)S +3617(to)S +3725(drag)S +3932(the)S +4084(marker.)S +5520 V +10 B +1620(o)S +10 R +1770(MB1)S +2006(near)S +2207(a)S +2281(marker)S +2593(corner)S +2877(or)S +2990(edge,)S +3233(depending)S +3679(on)S +3809(the)S +3961(type)S +4163(of)S +4276(marker,)S +4613(resizes)S +4914(the)S +5066(marker.)S +5688 V +10 B +1620(o)S +10 R +1770(Shift-MB1)S +2234(on)S +2364(the)S +2516(corner)S +2800(of)S +2913(most)S +3138(markers)S +3489(will)S +3675(rotate)S +3932(the)S +4084(marker.)S +5856 V +10 B +1620(o)S +10 R +1770(Markers)S +2138(stack,)S +2404(if)S +2501(you)S +2687(have)S +2911(several)S +3230(markers)S +3588(and)S +3769(you)S +3956(put)S +4121(one)S +4302(on)S +4439(top)S +4604(of)S +4724(the)S +4883(other.)S +5150(The)S +5342(active)S +5976 V +1770(marker)S +2086(is)S +2187(highlighted)S +2677(to)S +2788(tell)S +2949(you)S +3132(which)S +3409(of)S +3525(the)S +3680(stacked)S +4012(markers)S +4366(is)S +4466(active.)S +4762(If)S +4861(the)S +5016(markers)S +5370(over-)S +6096 V +1770(lap,)S +1947(this)S +2122(will)S +2308(be)S +2432(marker)S +2744("on)S +2915(top")S +3114(in)S +3222(the)S +3374(stacking)S +3737(order.)S +6264 V +10 B +1620(o)S +10 R +1770(MB2)S +2006(in)S +2115(the)S +2268(body)S +2499(of)S +2613(a)S +2688(marker)S +3001("lowers")S +3380(the)S +3533(marker,)S +3871(i.e.)S +4024(moves)S +4316(it)S +4403(to)S +4512(the)S +4665(bottom)S +4980(of)S +5094(the)S +5247(stacking)S +6384 V +1770(order.)S +6672 V +9 B +900(ENVIRONMENT)S +6792 V +10 I +1260(XGterm)S +10 R +1614(sets)S +1802(the)S +1963(environment)S +2507(variables)S +2906(``TERM'')S +3355(and)S +3538(``TERMCAP'')S +4182(properly)S +4559(for)S +4714(the)S +4875(size)S +5069(window)S +5430(you)S +6912 V +1260(have)S +1496(created.)S +1886(It)S +1995(also)S +2204(uses)S +2424(and)S +2616(sets)S +2814(the)S +2983(environment)S +3535(variable)S +3903(``DISPLAY'')S +4504(to)S +4629(specify)S +4964(which)S +5255(bit)S +5408(map)S +7032 V +1260(display)S +1582(terminal)S +1948(to)S +2059(use.)S +2280(The)S +2468(environment)S +3007(variable)S +3362(``WINDOWID'')S +4070(is)S +4171(set)S +4316(to)S +4428(the)S +4584(X)S +4690(window)S +5046(id)S +5158(number)S +5497(of)S +7152 V +1260(the)S +10 I +1412(xgterm)S +10 R +1719(window.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5480(12)S +7920 V +EP +%%Page: 13 14 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XGTERM)S +1338(\()S +1387(1)S +1453(\))S +2787(USER COMMANDS )S +4994(XGTERM)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(SEE)S +1097(ALSO)S +1080 V +10 R +1260(xterm\(1\),)S +1664(resize\(1\),)S +2067(X\(1\),)S +2310(pty\(4\),)S +2609(tty\(4\))S +1200 V +10 I +1260(Xterm)S +1534(Control)S +1876(Sequences)S +10 R +2321(\(in)S +2462(the)S +10 I +2614(xterm)S +10 R +2871(source)S +3161(directory\))S +1488 V +9 B +900(BUGS)S +1608 V +10 R +1260(Many)S +1523(of)S +1636(the)S +1788(same)S +2023(bugs)S +2242(a)S +2286 H + (f)show 10 -.5 mul h (f)show +10 R +2347(ecting)S +10 I +2621(xterm)S +10 R +2878(also)S +3069(apply)S +3321(here.)S +1848 V +10 I +1260(Xgterm)S +10 R +1592(is)S +1698(not)S +1865(normally)S +2265(installed)S +2643(with)S +2860(setuid)S +3138(permissions.)S +3710(On)S +3871(some)S +4121(Linux)S +4399(systems,)S +4780(for)S +4935(example,)S +5337(where)S +1968 V +1260(the)S +1415(/dev/tty)S +1754(and)S +1930(/dev/pty)S +2290(devices)S +2621(have)S +2841(root)S +3034(ownership)S +3482(and)S +3658(permission)S +4129(600)S +4311(this)S +4488(can)S +4658(cause)S +4911(problems.)S +5370(Wor-)S +2088 V +1260(karounds)S +1659(are)S +1813(to)S +1924(either)S +2184(install)S +10 I +2462(XGterm)S +10 R +2811(with)S +3022(setuid)S +3294(permissions)S +3805(or)S +3922(modify)S +4245(the)S +4401(/dev/tty)S +4741(and)S +4919(/dev/pty)S +5281(devices)S +2208 V +1260(to)S +1368(have)S +1586(permission)S +2055(666.)S +2496 V +9 B +900(COPYRIGHT)S +2616 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 16 Dec 1996)S +5480(13)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol Troff +%%Pages: 14 + \ No newline at end of file diff --git a/vendor/x11iraf/doc/ximtool.ps b/vendor/x11iraf/doc/ximtool.ps new file mode 100644 index 00000000..336513cf --- /dev/null +++ b/vendor/x11iraf/doc/ximtool.ps @@ -0,0 +1,16410 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Sun Aug 12 22:32:59 2001 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/Y{/Symbol FF}def +/C{/Courier FF}def +%% Troff special characters not on Symbol font +%% Copyright (C) 1986 by Pipeline Associates, Inc. +%% Version 1.1 +/altRTD 20 dict def +altRTD begin +/s{setcachedevice}def +/C{1000 1000 scale}def +/m{moveto}def +/c{curveto}def +/S{stroke}def +/l{lineto}def +/a{arcto}def +/p{pop}def +/sl{setlinewidth}def +end +/F_Troff 17 dict def F_Troff begin +systemdict /currentpacking known +{/SavePacking currentpacking def true setpacking}if +/PaintType 0 def +/FontType 3 def +/StrokeWidth 0 def +/UniqueID 8277003 def +/FontMatrix [.001000 0 0 .001000 0 0] def +/FontBBox [-12 -105 942 855 ] def +/Encoding 256 array def +/CD 256 1 add dict def +/FontInfo 3 dict def FontInfo begin +/UnderlinePosition -133 def /UnderlineThickness 20 def end +/FontName (Troff) def +0 1 256 1 sub{Encoding exch /.notdef put}for +CD /.notdef{500 0 setcharwidth{}}put +Encoding (1) 0 get /br put +%% bold vertical rule used by tbl +CD /br{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +0 .9 l +{S} +}put +Encoding (2) 0 get /ul put +%% underline used by tbl +CD /ul{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +.5 -.1 l +{S} +}put +Encoding (3) 0 get /ru put +%% baseline rule +CD /ru{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +m0 +.5 0 l +{S} +}put +Encoding (4) 0 get /vr put +%% vertical rule +CD /vr{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +m0 +0 1 l +{S} +}put +Encoding (5) 0 get /sq put +%% square +CD /sq{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{S} +}put +Encoding (6) 0 get /bx put +%% solid box +CD /bx{ +C +.5 0 -.5 -.5 1 1 s +np +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{fill} +}put +Encoding (7) 0 get /rn put +%% radical extender +CD /rn{ +C +.5 0 -.5 -.5 1 1 s +np +.03 sl +-.03 .9 m +.5 0 rl +{S} +}put +Encoding (8) 0 get /GR put +%% gray mask +CD /GR{ +C +.5 0 setcharwidth +.5 setgray +np +0 -.1 m +0 1 rl +.5 0 rl +0 -1 rl +-.5 0 rl +closepath +{fill} +}put +Encoding 97 /a put +CD /a{1000 0 0 66 942 421 s 430 415 +m 578 406 678 349 662 319 c 655 306 614 287 583 +296 c 570 300 466 340 438 332 c 365 309 335 213 +270 209 c 0 310 m 108 310 l 108 114 l 0 +114 l 0 310 l 42 161 m 42 134 l 66 134 l 66 +161 l 42 161 l 47 155 m 47 140 l 62 140 l 62 +155 l 47 155 l 110 133 m 226 113 300 66 410 +80 c 497 91 550 69 634 76 c 645 76 663 92 669 +107 c 677 125 673 141 668 160 c 725 334 m 758 +332 734 253 701 250 c 501 325 m 475 316 476 309 +473 302 c 465 282 482 263 499 257 c 552 236 615 +253 689 253 c 701 253 713 236 713 218 c 712 194 +702 168 678 161 c 671 159 663 160 655 160 c 591 +158 516 156 479 168 c 461 173 453 191 453 210 c 453 +224 456 235 466 244 c 476 253 490 252 503 255 c 459 +84 m 447 96 435 106 435 123 c 435 136 440 145 447 +155 c 453 163 462 168 469 173 c 110 293 m 173 +318 300 421 435 415 c 609 407 852 416 885 411 c 898 +409 924 411 930 380 c 942 316 828 339 742 334 c 731 +334 730 335 725 335 c 701 336 685 336 660 336 c{S}}put +Encoding 98 /b put +CD /b{1000 0 -12 66 930 421 s 500 +415 m 352 406 252 349 268 319 c 275 306 316 287 +347 296 c 360 300 464 340 492 332 c 565 309 595 +213 660 209 c 930 310 m 822 310 l 822 114 l 930 +114 l 930 310 l 888 161 m 888 134 l 864 134 +l 864 161 l 888 161 l 883 155 m 883 140 l 868 +140 l 868 155 l 883 155 l 820 133 m 704 113 +630 66 520 80 c 433 91 380 69 296 76 c 285 76 +267 92 261 107 c 253 125 257 141 262 160 c 205 +334 m 172 332 196 253 229 250 c 429 325 m 455 +316 454 309 457 302 c 465 282 448 263 431 257 c 378 +236 315 253 241 253 c 229 253 217 236 217 218 c 218 +194 228 168 252 161 c 259 159 267 160 275 160 c 339 +158 414 156 451 168 c 469 173 477 191 477 210 c 477 +224 474 235 464 244 c 454 253 440 252 427 255 c 471 +84 m 483 96 495 106 495 123 c 495 136 490 145 483 +155 c 477 163 468 168 461 173 c 820 293 m 757 +318 630 421 495 415 c 321 407 78 416 45 411 c 32 +409 6 411 0 380 c -12 316 102 339 188 334 c 199 +334 200 335 205 335 c 229 336 245 336 270 336 c{S}}put +Encoding 99 /c put +CD /c{1000 0 184 0 827 627 s 185 315 +m 186 488 332 627 505 625 c 682 623 827 467 815 +290 c 804 124 666 0 500 0 c 327 0 184 142 185 +315 c{S}}put +Encoding 100 /d put +CD /d{590 0 134 158 477 500 s 300 +160 m 208 162 134 238 135 330 c 136 423 212 500 +305 500 c 397 500 473 427 475 335 c 477 239 396 +158 300 160 c{fill}}put +Encoding 101 /e put % Bell Symbol +CD /e{1010 0 -100 -210 1010 1010 s 100 sl 0 setlinecap +420 300 450 0 360 arc +420 650 m 420 575 l S +newpath 120 125 m 720 125 l 75 sl S +420 125 m 420 25 l S +220 400 m 220 175 120 175 100 a p p p p +220 400 m 220 550 420 550 80 a p p p p +620 400 m 620 175 720 175 100 a p p p p +620 400 m 620 550 420 550 80 a p p p p +295 550 m 545 550 l{S}}put +/BuildChar{altRTD /BuildChar get exec}def end +altRTD begin /BuildChar{altRTD begin +/char exch def /fontdict exch def save +/charname fontdict /Encoding get char get def +fontdict /StrokeWidth get sl +fontdict /CD get dup charname known +{charname}{/.notdef}ifelse get newpath exec +fontdict /PaintType get 0 eq{exec}{p S}ifelse +restore end}def end +systemdict /currentpacking known{F_Troff /SavePacking get setpacking}if +/Troff F_Troff definefont pop +/Y1{/Troff FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +120 V +1260(#)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(1)S +7920 V +EP +%%Page: 1 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(ximtool)S +1602(\261)S +1682(interactive)S +2133(image)S +2407(display)S +2726(program)S +3094(for)S +3240(the)S +3392(X)S +3494(Window)S +3868(System)S +1308 V +9 B +900(SYNOPSIS)S +1428 V +10 B +1260(ximtool)S +1612([\261)S +10 I +1695(toolkitoption)S +10 B +2237(...])S +2375([)S +10 I +2438(options)S +10 B +2763(...])S +1656 V +9 B +900(OPTIONS)S +1776 V +10 B +1260(-basePixel)S +10 I +1723(N)S +1896 V +10 R +1510(The)S +1709(base)S +1930(colormap)S +2351(cell)S +2539(used)S +2766(by)S +2910(the)S +3076(colormap.)S +3552(This)S +3774(essentially)S +4240(allows)S +4545(you)S +4739(to)S +4861(reserve)S +10 I +5192(basePixel)S +2016 V +10 R +1510(colors)S +1793(in)S +1910(the)S +2071(global)S +2360(colormap)S +2776(for)S +2931(other)S +3175(applications.)S +3752(The)S +3946(default)S +4262(is)S +4367(64,)S +4530(if)S +4629(changed)S +4999(you'll)S +5276(need)S +5502(to)S +2136 V +1510(also)S +1701(specify)S +2019(the)S +10 I +2171(-cmapInitialize)S +10 R +2806(option)S +3092(or)S +3205(resource.)S +2304 V +10 B +1260(-cmap1)S +10 I +1606(\256le)S +2424 V +10 R +1510(User)S +1728(colormap)S +2135(1.)S +2270(This)S +2478(\257ag)S +2658(allows)S +2949(you)S +3129(to)S +3237(specify)S +3555(a)S +3629(colormap)S +4036(to)S +4144(be)S +4268(made)S +4514(available)S +4904(at)S +5006(task)S +5197(startup.)S +2592 V +10 B +1260(-cmap2)S +10 I +1606(\256le)S +2712 V +10 R +1510(User)S +1734(colormap)S +2147(2.)S +2288(This)S +2502(\257ag)S +2688(allows)S +2985(you)S +3171(to)S +3285(specify)S +3609(a)S +3689(second)S +4002(colormap)S +4415(to)S +4529(be)S +4660(made)S +4913(available)S +5310(at)S +5419(task)S +2832 V +1510(startup.)S +3000 V +10 B +1260(-cmapDir1)S +10 I +1750(dir)S +3120 V +10 R +1510(User)S +1728(colormap)S +2135(directory)S +2525(1.)S +2660(Speci\256es)S +3051(a)S +3125(directory)S +3515(to)S +3623(be)S +3747(searched)S +4125(for)S +4271(colormaps.)S +3288 V +10 B +1260(-cmapDir2)S +10 I +1750(dir)S +3408 V +10 R +1510(User)S +1742(colormap)S +2164(directory)S +2569(2.)S +2719(Speci\256es)S +3125(a)S +3214(directory)S +3619(to)S +3742(be)S +3881(searched)S +4274(for)S +4435(colormaps.)S +4951(By)S +5113(default)S +5435(this)S +3528 V +1510(points)S +1790(to)S +1903(the)S +2060(system)S +2373(directory)S +2768(/usr/local/lib/imtoolcmap,)S +3840(allowing)S +4225(a)S +4304(set)S +4450(of)S +4568(site)S +4741(default)S +5052(colormaps)S +5502(to)S +3648 V +1510(be)S +1634(de\256ned)S +1958(here.)S +3816 V +10 B +1260(-cmapInitialize)S +10 I +1934(bool)S +3936 V +10 R +1510(Initialize)S +1908(the)S +2073(ximtool)S +2428(colormap)S +2848(at)S +2963(startup.)S +3333(When)S +3614(setting)S +3924(the)S +10 I +4089(basePixel)S +10 R +4520(option)S +4819(or)S +4945(resource)S +5325(this)S +5513(is)S +4056 V +1510(required)S +1876(in)S +1988(order)S +2232(to)S +2344(force)S +2582(the)S +2738(Gterm)S +3027(widget)S +3333(to)S +3445(update)S +3745(its)S +3874(global)S +4158(colormap)S +4569(resource)S +4940(in)S +5052(the)S +5207(X)S +5312(server.)S +4176 V +1510(The)S +1695(default)S +2002(is)S +10 I +2099(false)S +10 R +2288(.)S +4344 V +10 B +1260(-cmapName)S +10 I +1805(name)S +4464 V +10 R +1510(Name)S +1784(used)S +2003(for)S +2156(private)S +2470(colormap.)S +2939(The)S +3131(default)S +3445(for)S +3598(all)S +3735(IRAF)S +4000(imaging)S +4365(applications)S +4885(is)S +10 I +4989(image)S +10 R +5233(.)S +5325(Gterm)S +4584 V +1510(widget)S +1822(based)S +2089(imaging)S +2457(applications)S +2980(which)S +3264(have)S +3492(the)S +3654(same)S +3899(value)S +4155(of)S +4277(cmapName)S +4770(will)S +4965(share)S +5214(the)S +5375(same)S +4704 V +1510(colormap,)S +1950(minimizing)S +2450(colormap)S +2865(\257ashing)S +3220(and)S +3402(allowing)S +3790(multiple)S +4162(applications)S +4683(to)S +4799(be)S +4931(run)S +5103(at)S +5214(the)S +5375(same)S +4824 V +1510(time.)S +4992 V +10 B +1260(-con\256g)S +10 I +1579(N)S +5112 V +10 R +1510(Initial)S +1799(frame)S +2081(bu)S +2181 H + (f)show 10 -.5 mul h (f)show +10 R +2242(er)S +2369(con\256guration)S +2952(number.)S +3362(The)S +3567(default)S +3894(value)S +4160(is)S +4277(1,)S +4402(indicating)S +4852(a)S +4947(512x512)S +5348(frame)S +5232 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(er)S +1778(with)S +1986(2)S +2066(frames.)S +2422(See)S +2596(below)S +2870(for)S +3016(information)S +3518(on)S +3648(the)S +3800(frame)S +4062(bu)S +4162 H + (f)show 10 -.5 mul h (f)show +10 R +4223(ers.)S +5400 V +10 B +1260(-defgui)S +5520 V +10 R +1510(Print)S +1737(the)S +1892(default)S +2202(GUI)S +2412(to)S +2523(the)S +2678(stdout.)S +3011(The)S +3199(GUI)S +3409(is)S +3509(a)S +3586(Tcl)S +3752(program)S +4123(that)S +4306(may)S +4511(be)S +4638(customized)S +5126(by)S +5259(the)S +5414(user)S +5640 V +1510(and)S +1684(reloaded)S +2057(using)S +2304(the)S +10 I +2456(-gui)S +10 R +2647(option)S +2933(or)S +3046(the)S +10 I +3198(gui)S +10 R +3356(resource)S +3723(parameter.)S +5808 V +10 B +1260(-displayPanner)S +10 I +1941(bool)S +5928 V +10 R +1510(Display)S +1859(panner)S +2168(marker)S +2488(window)S +2848(at)S +2958(startup.)S +3323(If)S +3427(set,)S +3601(a)S +3683(panner)S +3993(window)S +4354(showing)S +4732(the)S +4893(full)S +5071(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +6048 V +1510(will)S +1696(appear)S +1991(in)S +2099(the)S +2251(upper-right)S +2730(side)S +2921(of)S +3034(the)S +3186(main)S +3416(display)S +3735(window.)S +6216 V +10 B +1260(-displayCoords)S +10 I +1941(bool)S +6336 V +10 R +1510(Display)S +1855(WCS)S +2106(coordinate)S +2561(marker)S +2877(window)S +3233(at)S +3339(startup.)S +3700(If)S +3800(set,)S +3970(a)S +4048(coordinate)S +4503(readout)S +4836(text)S +5020(marker)S +5336(show-)S +6456 V +1510(ing)S +1668(will)S +1854(appear)S +2149(in)S +2257(the)S +2409(lower-right)S +2888(side)S +3079(of)S +3192(the)S +3344(main)S +3574(display)S +3893(window.)S +6624 V +10 B +1260(-\256fo)S +10 I +1462(pipe)S +6744 V +10 R +1510(Speci\256es)S +1901(the)S +2053(name)S +2299(of)S +2412(the)S +2564(\256fo)S +2733(pipe)S +2936(to)S +3045(be)S +3170(used,)S +3409(the)S +10 I +3562(i)S +10 R +3621(and)S +10 I +3796(o)S +10 R +3877(su)S +3966 H + (f)show 10 -.5 mul h (\256)show +10 R +4050(xes)S +4214(will)S +4401(be)S +4526(added)S +4795(automatically.)S +5425(The)S +6864 V +1510(default)S +1817(pipe)S +2019(names)S +2304(will)S +2490(be)S +2614(/dev/imt1i)S +3056(\(input)S +3325(pipe\))S +3560(and)S +3734(/dev/imt1o)S +4198(\(output)S +4517(pipe\).)S +7032 V +10 B +1260(-\256fo_only)S +7152 V +10 R +1510(If)S +1615(set,)S +1790(only)S +2007(\256fo)S +2185(pipes)S +2435(will)S +2630(be)S +2763(used)S +2985(for)S +3140(communication)S +3801(with)S +4018(a)S +4101(client)S +4363(program,)S +4766(sockets)S +5100(will)S +5296(be)S +5430(dis-)S +7272 V +1510(abled.)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(1)S +7920 V +EP +%%Page: 2 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(-gui)S +10 I +1457(\256le)S +1080 V +10 R +1510(Speci\256es)S +1901(the)S +2053(GUI)S +2260(\256le)S +2418(to)S +2526(be)S +2650(used.)S +1248 V +10 B +1260(-help)S +10 R +1510(Print)S +1735(a)S +1809(summary)S +2211(of)S +2324(command)S +2748(line)S +2928(options)S +3253(to)S +3361(the)S +3513(screen.)S +1416 V +10 B +1260(-imtoolrc)S +10 I +1683(\256le)S +1536 V +10 R +1510(Speci\256es)S +1923(the)S +2097(frame)S +2381(bu)S +2481 H + (f)show 10 -.5 mul h (f)show +10 R +2542(er)S +2671(con\256guration)S +3257(\256le)S +3438(to)S +3569(be)S +3716(used.)S +4007(See)S +4204(below)S +4501(for)S +4670(information)S +5195(on)S +5348(frame)S +1656 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(ers.)S +1824 V +10 B +1260(-inet_only)S +1944 V +10 R +1510(If)S +1611(set,)S +1782(only)S +1995(inet)S +2180(sockets)S +2509(will)S +2700(be)S +2829(used)S +3047(for)S +3198(communication)S +3855(with)S +4068(a)S +4147(client)S +4404(program,)S +4802(\256fo)S +4976(pipes)S +5222(and)S +5402(unix)S +2064 V +1510(sockets)S +1834(will)S +2020(be)S +2144(disabled.)S +2232 V +10 B +1260(-invert)S +2352 V +10 R +1510(Start)S +1748(XImtool)S +2136(using)S +2402(inverted)S +2778(colormaps.)S +3298(When)S +3585(set,)S +3770(a)S +3863("normalized")S +4443(display)S +4781(will)S +4987(always)S +5314(be)S +5458(the)S +2472 V +1510(inverse)S +1828(of)S +1941(the)S +2093(selected)S +2444(colormap.)S +2640 V +10 B +1260(-ismdev)S +10 I +1623(dev)S +2760 V +10 R +1510(Speci\256es)S +1914(the)S +2079(plug-in)S +2411(ISM)S +2633(connection)S +3115(socket.)S +3469(This)S +3691(should)S +4002(be)S +4140(a)S +4228(unix)S +4450(domain)S +4794(socket)S +5093(of)S +5220(the)S +5386(form)S +2880 V +1510(")S +10 I +1551(/tmp/.ISM%d)S +10 R +2081(",)S +2189(where)S +2474(the)S +10 I +2638(%d)S +10 R +2813(will)S +3011(be)S +3147(replaced)S +3526(by)S +3667(the)S +3830(user)S +4037(id.)S +4211(Once)S +4462(an)S +4597(ISM)S +4816(has)S +4990(connected)S +5435(this)S +3000 V +1510(port)S +1701(is)S +1798(freed)S +2032(to)S +2140(accept)S +2424(other)S +2659(connections.)S +3168 V +10 B +1260(-maxColors)S +10 I +1789(N)S +3288 V +10 R +1510(Specify)S +1845(the)S +1997(max)S +2199(number)S +2534(of)S +2647(colors)S +2921(to)S +3029(be)S +3153(used)S +3366(for)S +3512(the)S +3664(display.)S +3456 V +10 B +1260(-memModel)S +10 I +1805(type)S +3576 V +10 R +1510(Determines)S +2003(how)S +2208(ximtool)S +2553(uses)S +2758(memory)S +3125(in)S +3237(the)S +3393(ximtool)S +3739(client)S +3995(and)S +4173(the)S +4329(X)S +4435(server.)S +4737(The)S +4926(options)S +5255(are)S +10 I +5410(fast)S +10 R +5555(,)S +3696 V +10 I +1510(beNiceToServer)S +10 R +2153(,)S +2220(and)S +10 I +2406(small)S +10 R +2623(.)S +2720(The)S +2917(default)S +3236(is)S +10 I +3345(fast)S +10 R +3490(,)S +3557(which)S +3843(uses)S +4057(server)S +4342(pixmaps)S +4723(to)S +4843(make)S +5101(frame)S +5374(blink)S +3816 V +1510(fast.)S +1742(This)S +1953(is)S +2053(recommended)S +2651(unless)S +2934(server)S +3210(memory)S +3576(is)S +3676(very)S +3886(limited.)S +4258(Note)S +4485(that)S +4668(even)S +4889(in)S +5000(fast)S +5177(mode,)S +5458(the)S +3936 V +1510(server)S +1792(pixmap)S +2131(is)S +2237(only)S +2454(the)S +2615(size)S +2808(of)S +2929(the)S +3089(display)S +3416(window,)S +3801(so)S +3928(memory)S +4299(usage)S +4564(is)S +4669(reasonable)S +5133(even)S +5359(if)S +5458(the)S +4056 V +1510(frame)S +1772(bu)S +1872 H + (f)show 10 -.5 mul h (f)show +10 R +1933(er)S +2040(is)S +2137(very)S +2344(large.)S +4224 V +10 B +1260(-nframes)S +10 I +1672(N)S +4344 V +10 R +1510(Speci\256es)S +1913(the)S +2077(number)S +2424(of)S +2549(frame)S +2823(bu)S +2923 H + (f)show 10 -.5 mul h (f)show +10 R +2984(ers)S +3142(to)S +3262(con\256gure)S +3681(at)S +3795(startup.)S +4164(By)S +4323(default)S +4642(there)S +4883(will)S +5081(be)S +5217(2)S +5309(frames)S +4464 V +1510(available,)S +1925(a)S +1999(maximum)S +2435(of)S +2548(4)S +2628(frames)S +2929(are)S +3080(allowed.)S +4632 V +10 B +1260(-port)S +10 I +1506(N)S +4752 V +10 R +1510(Speci\256es)S +1901(the)S +2053(port)S +2244(number)S +2579(to)S +2687(use)S +2850(when)S +3096(connecting)S +3564(through)S +3905(an)S +4029(inet)S +4209(socket.)S +4920 V +10 B +1260(-port_only)S +5040 V +10 R +1510(Same)S +1770(as)S +10 I +1891(-inet_only)S +10 R +2334(option.)S +2683(If)S +2787(set,)S +2961(only)S +3177(inet)S +3365(sockets)S +3697(will)S +3891(be)S +4023(used)S +4244(for)S +4398(communication)S +5058(with)S +5275(a)S +5358(client)S +5160 V +1510(program.)S +5328 V +10 B +1260(-printCon\256g)S +10 I +1824(name)S +5448 V +10 R +1510(Speci\256es)S +1916(the)S +2083(printer)S +2394(con\256guration)S +2973(\256le)S +3147(to)S +3271(use.)S +3505(By)S +3668(default)S +3991(this)S +4182(will)S +4384(be)S +4524(/usr/local/lib/ximprint.cfg.)S +5568 V +1510(See)S +1684(below)S +1958(for)S +2104(more)S +2339(information)S +2841(on)S +2971(con\256guring)S +3462(output)S +3748(devices.)S +5736 V +10 B +1260(-tile)S +10 R +1510(The)S +1695(default)S +2002(display)S +2321(mode)S +2573(is)S +2670(to)S +2778(view)S +3002(one)S +3177(frame)S +3440(at)S +3543(a)S +3618(time.)S +3852(In)S +3966(tile)S +4125(frames)S +4427(mode,)S +4705(2)S +4786(or)S +4900(4)S +4981(frames)S +5283(may)S +5486(be)S +5856 V +1510(viewed)S +1834(simultaneously)S +2476(in)S +2590(the)S +2748(display)S +3073(window.)S +3486(All)S +3650(the)S +3808(usual)S +4055(operations)S +4507(\(zoom)S +4798(and)S +4977(pan,)S +5181(colortable)S +5976 V +1510(enhancement,)S +2091(cursor)S +2370(readback,)S +2784(etc.\))S +3018(still)S +3199(work)S +3434(for)S +3580(each)S +3792(frame)S +4054(even)S +4272(when)S +4518(in)S +4626(tile)S +4784(frames)S +5085(mode.)S +6144 V +10 B +1260(-unix)S +10 I +1513(name)S +6264 V +10 R +1510(Speci\256es)S +1909(the)S +2069(unix)S +2285(domain)S +2623(socket)S +2916(name)S +3170(to)S +3286(use.)S +3512(A)S +3622("%d")S +3876(in)S +3993(the)S +4154(\256lename)S +4537(will)S +4732(be)S +4865(replaced)S +5241(with)S +5458(the)S +6384 V +1510(user)S +1706(id.)S +6552 V +10 B +1260(-unix_only)S +6672 V +10 R +1510(If)S +1607(set,)S +1774(only)S +1983(unix)S +2192(domain)S +2523(sockets)S +2848(will)S +3035(be)S +3160(used)S +3374(for)S +3521(communication)S +4174(with)S +4383(a)S +4458(client)S +4711(program,)S +5105(inet)S +5286(sockets)S +6792 V +1510(and)S +1684(\256fos)S +1892(will)S +2078(be)S +2202(disabled.)S +7080 V +9 B +900(APPLICATION)S +1557(RESOURCES)S +7200 V +10 R +1260(XImtool)S +1629(is)S +1726(implemented)S +2278(as)S +2391(a)S +2465(client)S +2717(program)S +3085(which)S +3359(is)S +3456(responsible)S +3941(for)S +4087(loading)S +4418(the)S +4571(frame)S +4834(bu)S +4934 H + (f)show 10 -.5 mul h (f)show +10 R +4995(ers/colormaps,)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(2)S +7920 V +EP +%%Page: 3 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(communicating)S +1917(with)S +2130(clients,)S +2451(etc,)S +2627(and)S +2806(a)S +2885(user-modi\256able)S +3547(GUI)S +3759(\256le)S +3922(written)S +4240(as)S +4358(a)S +4437(Tcl)S +4605(script)S +4862(which)S +5141(handles)S +5480(all)S +1080 V +1260(the)S +1412(user)S +1608(interface)S +1986(details.)S +2332(The)S +10 I +2517(client)S +2770(resources)S +10 R +3189(described)S +3602(below)S +3877(will)S +4064(be)S +4189(common)S +4570(to)S +4679(any)S +4854(user-de\256ned)S +5378(GUI,)S +1200 V +1260(the)S +10 I +1426(gui)S +1598(resources)S +10 R +2030(may)S +2246(change)S +2572(depending)S +3032(on)S +3176(how)S +3392(extensively)S +3890(the)S +4055(GUI)S +4275(has)S +4451(been)S +4682(modi\256ed)S +5081(by)S +5224(the)S +5389(user.)S +1320 V +1260(Each)S +1495(of)S +1615(these)S +1857(components)S +2377(has)S +2547(its)S +2679(own)S +2888(set)S +3036(of)S +3156(resources,)S +3594(but)S +3759(to)S +3874(the)S +4033(user)S +4236(setting)S +4540(them)S +4777(is)S +4881(the)S +5040(same)S +5282(as)S +5402(with)S +1440 V +1260(any)S +1434(other)S +1669(application.)S +1680 V +10 I +1260(Gterm)S +10 R +1548(widget)S +1853(resources)S +2262(\(i.e.)S +2450(those)S +2694(for)S +2844(the)S +3000(main)S +3234(image)S +3512(window)S +3868(or)S +3985(colorbar\))S +4384(may)S +4590(be)S +4718(set)S +4863(as)S +4980(either)S +5241(client)S +5497(or)S +1800 V +1260(GUI)S +1467(resources.)S +1928(See)S +2102(the)S +10 I +2254(xgterm\(1\))S +10 R +2677(man)S +2879(page)S +3097(for)S +3243(a)S +3317(complete)S +3713(description)S +4187(of)S +10 I +4300(Gterm)S +10 R +4585(widget)S +4887(resources.)S +2088 V +9 B +1080(CLIENT)S +1452(RESOURCES)S +2208 V +10 R +1260(The)S +1445(client)S +1697(resources)S +2103(generally)S +2504(de\256ne)S +2778(the)S +2930(initial)S +3194(state)S +3407(of)S +3520(the)S +3672(application)S +4146(or)S +4259(set)S +4400(con\256guration)S +4963(parameters.)S +2376 V +10 B +1620(Resource)S +2043(Name)S +2870(Default)S +3216(Value)S +2484 V +10 R +1620(defCon\256g)S +2870(1)S +2592 V +1620(defNFrames)S +2870(0)S +2700 V +1620(tileBorderWidth)S +2870(3)S +2808 V +1620(tileBorderColor)S +2870(9)S +2916 V +1620(autoscale)S +2870(false)S +3024 V +1620(antialias)S +2870(false)S +3132 V +1620(antialiasType)S +2870(boxcar)S +3240 V +1620(tileFrames)S +2870(false)S +3348 V +1620(highlightFrames)S +2870(true)S +3456 V +1620(gui)S +2870(default)S +3564 V +1620(imtoolrc)S +2870(/usr/local/lib/imtoolrc)S +3672 V +1620(invert)S +2870(false)S +3780 V +1620(memModel)S +2870(fast)S +3888 V +1620(basePixel:)S +2870(64)S +3996 V +1620(maxColors:)S +2870(216)S +4104 V +1620(cmapInitialize:)S +2870(false)S +4212 V +1620(cmap1)S +2870(none)S +4320 V +1620(cmap2)S +2870(none)S +4428 V +1620(cmapDir1)S +2870(none)S +4536 V +1620(cmapDir2)S +2870(/usr/local/lib/imtoolcmap)S +4644 V +1620(input_\256fo)S +2870(/dev/imt1i)S +4752 V +1620(output_\256fo)S +2870(/dev/imt1o)S +4860 V +1620(unixaddr)S +2870(/tmp/.IMT%d)S +4968 V +1620(port)S +2870(5137)S +5076 V +1620(ism_addr)S +2870(/tmp/.ISM%d)S +5184 V +1620(ism_task)S +2870("ism_wcspix.e)S +3488(wcspix)S +3801(&")S +5424 V +1260(Description)S +1756(of)S +1869(ximtool)S +2211(client)S +2463(resources:)S +5712 V +10 B +1260(defCon\256g)S +10 R +2160(Default)S +2499(frame)S +2772(bu)S +2872 H + (f)show 10 -.5 mul h (f)show +10 R +2933(er)S +3051(con\256guration)S +3625(number)S +3971(on)S +4112(startup.)S +4480(See)S +4665(below)S +4950(for)S +5107(more)S +5353(infor-)S +5832 V +2160(mation)S +2468(on)S +2598(frame)S +2860(bu)S +2960 H + (f)show 10 -.5 mul h (f)show +10 R +3021(ers.)S +6000 V +10 B +1260(defNFrames)S +10 R +2160(Default)S +2496(number)S +2838(of)S +2958(frames)S +3266(on)S +3403(startup.)S +3767(Set)S +3932(to)S +4047(zero)S +4255(to)S +4371(use)S +4542(the)S +4702(value)S +4956(from)S +5188(the)S +5348(frame)S +6120 V +2160(bu)S +2260 H + (f)show 10 -.5 mul h (f)show +10 R +2321(er)S +2428(con\256guration)S +2991(\()S +10 I +3024(imtoolrc)S +10 R +3363(\))S +3426(\256le.)S +6288 V +10 B +1260(tileBorderWidth)S +6396 V +1260(tileBorderColor)S +10 R +2160(Used)S +2401(by)S +2537(the)S +2695(tile)S +2859(frames)S +3166(option.)S +3513(Speci\256es)S +3910(how)S +4118(far)S +4264(apart)S +4499(to)S +4613(space)S +4870(the)S +5029(frames)S +5337(in)S +5452(tile)S +6516 V +2160(frames)S +2484(mode.)S +2814(Color)S +3095("9")S +3280(refers)S +3559(to)S +3690(the)S +3865(Gterm)S +4172(widget)S +4496(resource)S +4885(color9,)S +5217(which)S +5513(is)S +6636 V +2160(assigned)S +2534(a)S +2608(color)S +2843(with)S +3051(its)S +3176(own)S +3378(resource.)S +6804 V +10 B +1260(autoscale)S +10 R +2160(Enable/disable)S +2778(the)S +2930(autoscale)S +3331(option.)S +6972 V +10 B +1260(antialias)S +10 R +2160(Enable/disable)S +2778(the)S +2930(antialias)S +3293(option.)S +7140 V +10 B +1260(antialiasType)S +10 R +2160(Type)S +2419(of)S +2556(antialiasing.)S +3126(Options)S +3497(include)S +10 I +3846(boxcar)S +10 R +4178(\(default\),)S +10 I +4601(bilinear)S +10 R +4918(,)S +10 I +4998(nearest)S +10 R +5292(,)S +10 I +5372(area)S +10 R +5555(,)S +7260 V +10 I +2160(blkavg)S +10 R +2426(,)S +10 I +2481(lowpass)S +10 R +2804(,)S +2859(and)S +10 I +3033(gaussian)S +10 R +3389(.)S +7740 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(3)S +7920 V +EP +%%Page: 4 5 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(tileFrames)S +10 R +2160(Enable/disable)S +2778(the)S +2930(tile)S +3088(frames)S +3389(option.)S +1128 V +10 B +1260(highlightFrames)S +10 R +2160(Determines)S +2650(whether)S +3001(the)S +3153(current)S +3465(frame)S +3727(is)S +3824(highlighted)S +4310(when)S +4556(in)S +4664(tile)S +4822(frames)S +5123(mode.)S +1296 V +10 B +1260(gui)S +10 R +2160(The)S +2349(GUI)S +2560(to)S +2672(be)S +2800(executed.)S +3243("default")S +3636(refers)S +3896(to)S +4008(the)S +4164(default,)S +4500(builtin)S +4796(ximtool)S +5142(GUI.)S +5408(You)S +1416 V +2160(can)S +2341(replace)S +2671(this)S +2859(with)S +3080(your)S +3306(own)S +3521(GUI)S +3741(\256le)S +3911(if)S +4014(you)S +4206(are)S +4369(bold)S +4589(enough,)S +4950(and)S +5136(completely)S +1536 V +2160(change)S +2472(the)S +2624(look)S +2832(and)S +3006(functionality)S +3547(of)S +3660(the)S +3812(GUI)S +4019(if)S +4110(desired.)S +1704 V +10 B +1260(imtoolrc)S +10 R +2160(Where)S +2496(to)S +2645(\256nd)S +2872(the)S +3065(imtoolrc)S +3475(\256le.)S +3730(This)S +3980(de\256nes)S +4335(the)S +4529(recognized)S +5038(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +1824 V +2160(con\256gurations.)S +1992 V +10 B +1260(invert)S +10 R +2160(Start)S +2388(Ximtool)S +2761(using)S +3017(an)S +3150(inverted)S +3516(colormap.)S +3987(When)S +4264(set,)S +4440(a)S +4524("normalized")S +5095(display)S +5424(will)S +2112 V +2160(always)S +2467(be)S +2591(the)S +2743(inverse)S +3061(of)S +3174(the)S +3326(selected)S +3677(colormap.)S +2280 V +10 B +1260(memModel)S +10 R +2160(Determines)S +2656(how)S +2864(ximtool)S +3212(uses)S +3420(memory)S +3789(in)S +3904(the)S +4063(ximtool)S +4412(client)S +4671(and)S +4852(the)S +5011(X)S +5120(server.)S +5425(The)S +2400 V +2160(options)S +2491(are)S +10 I +2648(fast)S +10 R +2793(,)S +10 I +2853(beNiceToServer)S +10 R +3496(,)S +3556(and)S +10 I +3735(small)S +10 R +3952(.)S +4042(The)S +4232(default)S +4544(is)S +10 I +4646(fast)S +10 R +4791(,)S +4851(which)S +5130(uses)S +5337(server)S +2520 V +2160(pixmaps)S +2536(to)S +2651(make)S +2904(frame)S +3173(blink)S +3416(fast.)S +3652(This)S +3867(is)S +3971(recommended)S +4573(unless)S +4861(server)S +5142(memory)S +5513(is)S +2640 V +2160(very)S +2369(limited.)S +2740(Note)S +2966(that)S +3148(even)S +3368(in)S +3478(fast)S +3654(mode,)S +3933(the)S +4087(server)S +4362(pixmap)S +4694(is)S +4793(only)S +5003(the)S +5157(size)S +5344(of)S +5458(the)S +2760 V +2160(display)S +2491(window,)S +2880(so)S +3012(memory)S +3388(usage)S +3658(is)S +3768(reasonable)S +4237(even)S +4468(if)S +4572(the)S +4737(frame)S +5012(bu)S +5112 H + (f)show 10 -.5 mul h (f)show +10 R +5173(er)S +5293(is)S +5403(very)S +2880 V +2160(large.)S +2988 V +10 B +1260(basePixel)S +3096 V +1260(maxColors)S +10 R +2160(These)S +2434(two)S +2620(resources)S +3032(determine)S +3467(the)S +3626(region)S +3918(of)S +4038(colormap)S +4452(space)S +4710(used)S +4930(to)S +5045(render)S +5336(image)S +3216 V +2160(pixels.)S +3384 V +10 B +1260(cmapInitialize)S +10 R +2160(Initialize)S +2545(the)S +2697(ximtool)S +3039(colormap)S +3446(at)S +3548(startup.)S +3905(This)S +4113(is)S +4210(a)S +4284(required)S +4646(resource)S +5013(to)S +5121(clear)S +5345(a)S +5420(pre-)S +3504 V +2160(vious)S +2407(ximtool)S +2749(colormap)S +3156(allowing)S +3536(a)S +3610(new)S +10 B +3806(basePixel)S +10 R +4236(and)S +10 B +4410(maxColors)S +10 R +4906(to)S +5014(take)S +5210(e)S +5254 H + (f)show 10 -.5 mul h (f)show +10 R +5315(ect.)S +3672 V +10 B +1260(cmap1)S +3780 V +1260(cmap2)S +10 R +2160(User)S +2389(colormap)S +2807(\256les.)S +3070(The)S +3266(intent)S +3535(here)S +3748(is)S +3857(to)S +3977(allow)S +4241(individual)S +4689(colormaps)S +5147(to)S +5267(be)S +5403(con-)S +3900 V +2160(veniently)S +2562(speci\256ed)S +2947(as)S +3060(a)S +3134(resource.)S +4068 V +10 B +1260(cmapDir1)S +4176 V +1260(cmapDir2)S +10 R +2160(User)S +2393(or)S +2521(system)S +2844(colormap)S +3266(directories.)S +3788(By)S +3951(default)S +4274(cmapDir2)S +4719(points)S +5010(to)S +5134(the)S +5302(system)S +4296 V +2160(directory)S +2564(/usr/local/lib/imtoolcmap,)S +3644(allowing)S +4037(a)S +4124(set)S +4278(of)S +4404(site)S +4586(default)S +4906(colormaps)S +5365(to)S +5486(be)S +4416 V +2160(de\256ned)S +2484(here.)S +2740(This)S +2948(leaves)S +3227(cmapDir1)S +3656(available)S +4046(to)S +4154(a)S +4228(user)S +4424(colormap)S +4831(directory.)S +4584 V +10 B +1260(input_\256fo)S +4692 V +1260(output_\256fo)S +10 R +2160(The)S +2354(input)S +2600(and)S +2784(output)S +3080(\256fos)S +3298(for)S +3454(\256fo)S +3633(i/o.)S +3834("Input")S +4167(and)S +4351("output")S +4729(are)S +4890(from)S +5124(the)S +5286(client's)S +4812 V +2160(point)S +2396(of)S +2509(view.)S +2788(Note)S +3012(that)S +3192(only)S +3400(one)S +3574(display)S +3893(server)S +4166(can)S +4334(use)S +4497(a)S +4571(\256fo-pair)S +4928(at)S +5030(one)S +5204(time.)S +4980 V +10 B +1260(unixaddr)S +10 R +2160(Template)S +2569(address)S +2900(for)S +3048(unix)S +3258(domain)S +3591(socket.)S +3934(The)S +4122(user)S +4321(must)S +4549(have)S +4770(write)S +5008(permission)S +5480(on)S +5100 V +2160(this)S +2338(directory,)S +2756(or)S +2872(the)S +3027(\256le)S +3188(must)S +3416(already)S +3742(exist.)S +10 I +4019(%d)S +10 R +4152(,)S +4210(if)S +4304(given,)S +4584(is)S +4684(replaced)S +5054(by)S +5187(the)S +5342(user's)S +5220 V +2160(UID.)S +5388 V +10 B +1260(port)S +10 R +2160(TCP/IP)S +2500(port)S +2700(for)S +2855(the)S +3017(server.)S +3355(Note)S +3589(that)S +3779(only)S +3997(one)S +4181(server)S +4464(can)S +4642(listen)S +4899(on)S +5039(a)S +5123(port)S +5324(at)S +5436(one)S +5508 V +2160(time,)S +2402(so)S +2530(if)S +2630(multiple)S +3003(ximtool)S +3354(servers)S +3675(are)S +3835(desired)S +4161(on)S +4299(the)S +4459(same)S +4702(machine,)S +5103(they)S +5313(should)S +5628 V +2160(be)S +2284(given)S +2536(di)S +2614 H + (f)show 10 -.5 mul h (f)show +10 R +2675(erent)S +2904(ports.)S +5796 V +10 B +1260(ism_addr)S +10 R +2160(Template)S +2576(address)S +2914(for)S +3070(ISM)S +3288(unix)S +3506(domain)S +3846(socket.)S +4166(The)S +4361(user)S +4567(must)S +4802(have)S +5030(write)S +5275(permis-)S +5916 V +2160(sion)S +2367(on)S +2507(this)S +2692(directory,)S +3116(or)S +3238(the)S +3399(\256le)S +3566(must)S +3800(already)S +4132(exist.)S +10 I +4415(%d)S +10 R +4548(,)S +4612(if)S +4712(given,)S +4998(is)S +5104(replaced)S +5480(by)S +6036 V +2160(the)S +2312(user's)S +2580(UID.)S +6204 V +10 B +1260(ism_task)S +10 R +2160(Command)S +2616(string)S +2883(to)S +3000(execute)S +3343(for)S +3498(the)S +3660(real-time)S +4060(pixel)S +4300(and)S +4484(WCS)S +4741(readout)S +5080(ISM)S +5298(\(Image)S +6324 V +2160(Support)S +2507(Module\))S +2881(task.)S +6612 V +9 B +1080(GUI)S +1277(RESOURCES)S +6732 V +10 R +1260(In)S +1394(principle)S +1800(ximtool)S +2163(can)S +2352(have)S +2592(any)S +2788(number)S +3145(of)S +3280(di)S +3358 H + (f)show 10 -.5 mul h (f)show +10 R +3419(erent)S +3670(GUIs,)S +3963(each)S +4197(of)S +4332(which)S +4628(de\256nes)S +4963(its)S +5110(own)S +5334(set)S +5497(of)S +6852 V +1260(resources.)S +1733(GUIs)S +1991(typically)S +2383(de\256ne)S +2669(a)S +2755(great)S +2996(many)S +3260(resources,)S +3703(but)S +3873(most)S +4110(of)S +4234(these)S +4480(are)S +4642(not)S +4811(really)S +5079(intended)S +5464(for)S +6972 V +1260(modi\256cation)S +1796(by)S +1926(the)S +2078(user)S +2274(\(although)S +2687(one)S +2861(can)S +3029(modify)S +3348(them)S +3578(if)S +3669(desired\).)S +7212 V +1260(The)S +1455(following)S +1884(are)S +2045(some)S +2296(of)S +2419(the)S +2581(more)S +2826(useful)S +3110(resources)S +3526(used)S +3749(by)S +3889(the)S +4051(default)S +4369(ximtool)S +4722(GUI.)S +4995(The)S +10 I +5191(imagewin)S +7692 V +10 R +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(4)S +7920 V +EP +%%Page: 5 6 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(resources)S +1666(are)S +1817(Gterm)S +2102(widget)S +2404(resources.)S +1248 V +10 B +1620(Main)S +1878(Display)S +2231(Gterm)S +2543(Widget)S +2884(Resources)S +1416 V +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +1524 V +10 Y +1650(*)S +10 R +1700(imagewin.cmapName:)S +3370(image)S +1632 V +10 Y +1650(*)S +10 R +1700(imagewin.basePixel:)S +3370(64)S +1740 V +10 Y +1650(*)S +10 R +1700(imagewin.warpCursor:)S +3370(True)S +1848 V +10 Y +1650(*)S +10 R +1700(imagewin.raiseWindow:)S +3370(True)S +1956 V +10 Y +1650(*)S +10 R +1700(imagewin.deiconifyWindow:)S +3370(True)S +2064 V +10 Y +1650(*)S +10 R +1700(imagewin.ginmodeCursor:)S +3370(circle)S +2172 V +10 Y +1650(*)S +10 R +1700(imagewin.ginmodeBlinkInterval:)S +3370(500)S +2280 V +10 Y +1650(*)S +10 R +1700(imagewin.color0)S +2404(\(background\):)S +3370(black)S +2388 V +10 Y +1650(*)S +10 R +1700(imagewin.color1)S +2404(\(foreground\):)S +3370(white)S +2496 V +10 Y +1650(*)S +10 R +1700(imagewin.color8)S +2404(\(panner)S +2738(highlight\):)S +3370(#7c8498)S +2604 V +10 Y +1650(*)S +10 R +1700(imagewin.color9)S +2404(\(tileFrame)S +2850(color\):)S +3370(SteelBlue)S +2712 V +10 Y +1650(*)S +10 R +1700(imagewin.width:)S +3370(512)S +2820 V +10 Y +1650(*)S +10 R +1700(imagewin.height:)S +3370(512)S +3108 V +10 B +1620(GUI)S +1839(Resources)S +3276 V +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +3384 V +10 Y +1650(*)S +10 R +1700(autoscale:)S +3370(True)S +3492 V +10 Y +1650(*)S +10 R +1700(zoomfactors:)S +3370(1)S +3450(2)S +3530(4)S +3610(8)S +3600 V +10 Y +1650(*)S +10 R +1700(displayCoords:)S +3370(True)S +3708 V +10 Y +1650(*)S +10 R +1700(displayPanner:)S +3370(True)S +3816 V +10 Y +1650(*)S +10 R +1700(displayMagni\256er:)S +3370(True)S +3924 V +10 Y +1650(*)S +10 R +1700(blinkRate:)S +3370(1.0)S +4032 V +10 Y +1650(*)S +10 R +1700(pannerArea:)S +3370(150)S +10 Y +3520(*)S +10 R +3570(150)S +4140 V +10 Y +1650(*)S +10 R +1700(pannerGeom:)S +3370(-5+5)S +4248 V +10 Y +1650(*)S +10 R +1700(magni\256erArea:)S +3370(100)S +10 Y +3520(*)S +10 R +3570(100)S +4356 V +10 Y +1650(*)S +10 R +1700(magni\256erGeom:)S +3370(+5+5)S +4464 V +10 Y +1650(*)S +10 R +1700(wcsboxGeom:)S +3370(-5-5)S +4572 V +10 Y +1650(*)S +10 R +1700(maxContrast:)S +3370(5.0)S +4680 V +10 Y +1650(*)S +10 R +1700(warnings:)S +3370(True)S +4788 V +10 Y +1650(*)S +10 R +1700(centerBoxSize:)S +3370(5)S +4896 V +10 Y +1650(*)S +10 R +1700(peakCentroid:)S +3370(True)S +5184 V +10 B +1620(Alternate)S +2054(GUI)S +2273(Resources)S +5352 V +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +5460 V +10 Y +1650(*)S +10 R +1700(showToolBar:)S +3370(False)S +5568 V +10 Y +1650(*)S +10 R +1700(showPanelBar:)S +3370(False)S +5808 V +1260(Description)S +1756(of)S +1869(selected)S +2220(resources:)S +6096 V +10 Y +1260(*)S +10 B +1310(cmapName)S +10 R +2360(Name)S +2638(used)S +2861(for)S +3018(private)S +3336(colormap.)S +3809(The)S +4005(default)S +4323(for)S +4480(all)S +4621(IRAF)S +4890(imaging)S +5259(applica-)S +6216 V +2360(tions)S +2601(is)S +2714("image".)S +3141(Gterm)S +3442(widget)S +3760(based)S +4033(imaging)S +4407(applications)S +4936(which)S +5225(have)S +5458(the)S +6336 V +2360(same)S +2597(value)S +2845(of)S +2961(cmapName)S +3448(will)S +3637(share)S +3880(the)S +4035(same)S +4273(colormap,)S +4708(minimizing)S +5203(colormap)S +6456 V +2360(\257ashing)S +2707(and)S +2881(allowing)S +3261(multiple)S +3625(applications)S +4138(to)S +4246(be)S +4370(run)S +4533(at)S +4635(the)S +4787(same)S +5022(time.)S +6624 V +10 Y +1260(*)S +10 B +1310(basePixel)S +10 R +2360(The)S +2545(base)S +2752(colormap)S +3159(cell)S +3333(used)S +3546(by)S +3676(the)S +3828(display)S +4147(colormap.)S +6792 V +10 Y +1260(*)S +10 B +1310(imagewin.warpCursor)S +10 R +2360(Warp)S +2611(pointer)S +2924(into)S +3110(image)S +3384(window)S +3736(when)S +3982(initiating)S +4374(a)S +4448(cursor)S +4727(read.)S +6960 V +10 Y +1260(*)S +10 B +1310(imagewin.raiseWindow)S +10 R +2360(Raise)S +2612(image)S +2886(window)S +3238(when)S +3484(initiating)S +3876(a)S +3950(cursor)S +4229(read.)S +7128 V +10 Y +1260(*)S +10 B +1310(imagewin.deiconifyWindow)S +7248 V +10 R +2360(Deiconify)S +2789(image)S +3063(window)S +3415(if)S +3506(necessary)S +3923(when)S +4169(initiating)S +4561(a)S +4635(cursor)S +4914(read.)S +7728 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(5)S +7920 V +EP +%%Page: 6 7 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 Y +1260(*)S +10 B +1310(imagewin.ginmodeCursor)S +1080 V +10 R +2360(Type)S +2596(of)S +2710(cursor)S +2990(when)S +3237(a)S +3312(cursor)S +3592(read)S +3795(is)S +3894(in)S +4004(progress.)S +4429(The)S +4616(default)S +4925(is)S +5024(a)S +5100(circle.)S +5408(Any)S +1200 V +2360(selection)S +2800(from)S +3079(the)S +3285(X)S +3441(cursor)S +3774(font)S +4019(can)S +4241(be)S +4419(used.)S +4741(A)S +4897(special)S +5258(case)S +5513(is)S +1320 V +2360("full_crosshair")S +3021(which)S +3295(is)S +3392(the)S +3544(full)S +3713(crosshair)S +4103(cursor)S +4382(of)S +4495(the)S +4647(Gterm)S +4932(widget.)S +1488 V +10 Y +1260(*)S +10 B +1310(imagewin.ginmodeBlinkInterval)S +1608 V +10 R +2360(Determines)S +2857(whether)S +3215(the)S +3374(cursor)S +3660(blinks)S +3942(when)S +4195(a)S +4277(cursor)S +4564(read)S +4773(is)S +4878(in)S +4994(progress.)S +5425(The)S +1728 V +2360(value)S +2606(is)S +2703(given)S +2955(in)S +3063(milliseconds.)S +1896 V +10 Y +1260(*)S +10 B +1310(imagewin.color0)S +10 R +2360(Background)S +2878(color.)S +2064 V +10 Y +1260(*)S +10 B +1310(imagewin.color1)S +10 R +2360(Foreground)S +2856(color.)S +2232 V +10 Y +1260(*)S +10 B +1310(imagewin.color8)S +10 R +2360(Color)S +2618(assigned)S +2992(the)S +3144(panner)S +3445(window.)S +2400 V +10 Y +1260(*)S +10 B +1310(imagewin.color9)S +10 R +2360(Color)S +2618(used)S +2831(for)S +2977(the)S +3129(tileFrames)S +3581(highlight.)S +2568 V +10 Y +1260(*)S +10 B +1310(imagewin.width)S +10 R +2360(Width)S +2640(of)S +2753(the)S +2905(main)S +3135(image)S +3409(window.)S +2736 V +10 Y +1260(*)S +10 B +1310(imagewin.height)S +10 R +2360(Height)S +2662(of)S +2775(the)S +2927(main)S +3157(image)S +3431(window.)S +2904 V +10 Y +1260(*)S +10 B +1310(pannerArea)S +10 R +2360(Area)S +2583(in)S +2691(pixels)S +2960(of)S +3073(the)S +3225(panner)S +3526(window.)S +3072 V +10 Y +1260(*)S +10 B +1310(pannerGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(panner)S +3456(window.)S +3240 V +10 Y +1260(*)S +10 B +1310(wcsboxGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(coords)S +3451(box.)S +3408 V +10 Y +1260(*)S +10 B +1310(maxContrast)S +10 R +2360(Maximum)S +2807(contrast)S +3153(value.)S +3816 V +9 B +900(DESCRIPTION)S +3936 V +10 R +1260(As)S +1401(a)S +1475(display)S +1794(server,)S +2092(XImtool)S +2461(is)S +2558(started)S +2854(as)S +2967(a)S +3041(separate)S +3397(process)S +3726(from)S +3950(client)S +4202(software)S +4575(such)S +4788(as)S +4901(IRAF.)S +5185(Once)S +5426(it)S +5513(is)S +4056 V +1260(running)S +1606(it)S +1697(will)S +1888(accept)S +2177(client)S +2434(connections)S +2946(simultaneously)S +3587(on)S +3721(\256fo)S +3894(pipes,)S +4164(unix)S +4376(domain)S +4710(sockets,)S +5063(or)S +5180(inet)S +5364(sock-)S +4176 V +1260(ets.)S +1427(A)S +1530(display)S +1850(client)S +2103(like)S +2285(the)S +2439(IRAF)S +10 I +2699(DISPLAY)S +10 R +3120(task)S +3313(makes)S +3600(a)S +3676(connection)S +4146(and)S +4322(sends)S +4576(the)S +4730(image)S +5006(across)S +5287(using)S +5536(a)S +4296 V +1260(modi\256ed)S +1660(IIS)S +1826(Model)S +2131(70)S +2274(protocol.)S +2705(Once)S +2958(the)S +3123(image)S +3410(is)S +3520(loaded)S +3829(in)S +3950(the)S +4115(display)S +4447(bu)S +4547 H + (f)show 10 -.5 mul h (f)show +10 R +4608(er)S +4728(it)S +4827(may)S +5042(be)S +5179(enhanced,)S +4416 V +1260(saved)S +1521(to)S +1633(a)S +1711(disk)S +1912(\256le)S +2074(in)S +2186(a)S +2264(number)S +2603(of)S +2720(di)S +2798 H + (f)show 10 -.5 mul h (f)show +10 R +2859(erent)S +3092(formats,)S +3456(or)S +3573(printed)S +3890(as)S +4007(Encapsulated)S +4574(Postscript)S +5004(to)S +5117(a)S +5196(printer)S +5497(or)S +4536 V +1260(disk)S +1475(\256le.)S +1706(Up)S +1876(to)S +2002(sixteen)S +2332(frame)S +2611(bu)S +2711 H + (f)show 10 -.5 mul h (f)show +10 R +2772(ers)S +2935(are)S +3103(allowed,)S +3491(these)S +3743(may)S +3962(be)S +4103(displayed)S +4533(simultaneously)S +5186(in)S +5311(a)S +5402(tiled)S +4656 V +1260(mode,)S +1537(or)S +1650(blinked)S +1980(frame-to-frame.)S +2673(Each)S +2902(frame)S +3164(may)S +3366(have)S +3584(its)S +3710(own)S +3913(colormap)S +4321(or)S +4435(brightness/contrast)S +5221(enhance-)S +4776 V +1260(ment.)S +1545(Pan/Zoom)S +1992(and)S +2166(cursor)S +2445(readout)S +2774(are)S +2925(permitted)S +3338(using)S +10 I +3585(markers)S +10 R +3912(,)S +3967(on-line)S +4280(help)S +4482(is)S +4579(also)S +4770(available.)S +5016 V +1260(When)S +1540(run)S +1715(in)S +1835(standalone)S +2304(mode,)S +2593(images)S +2918(\(currently)S +3353(IRAF)S +3623(OIF,)S +3851(GIF,)S +4079(Sun)S +4277(Raster\256les)S +4741(or)S +4866(simple)S +5176(FITS)S +5425(\(i.e.)S +5136 V +1260(excluding)S +1693(MEF)S +1938(\256les\))S +2177(formats)S +2521(are)S +2681(permitted\))S +3136(may)S +3347(be)S +3479(loaded)S +3783(on)S +3921(the)S +4081(command)S +4513(line)S +4701(or)S +4822(by)S +4960(using)S +5215(the)S +5375(Load)S +5256 V +1260(Panel.)S +1558(This)S +1787(allows)S +2099(you)S +2300(to)S +2430(browse)S +2770(images)S +3105(and)S +3301(perform)S +3674(the)S +3848(same)S +4105(manipulations)S +4724(as)S +4859(if)S +4972(they)S +5196(had)S +5392(been)S +5376 V +1260(displayed)S +1673(by)S +1803(a)S +1877(client.)S +5664 V +9 B +1080(MOUSE)S +1437(OPERATIONS)S +5784 V +10 R +1260(Clicking)S +1648(and)S +1835(dragging)S +2233(MB1)S +2482(\(mouse)S +2819(button)S +3118(1\))S +3244(in)S +3365(the)S +3530(main)S +3773(image)S +4060(window)S +4425(creates)S +4745(a)S +4833(rectangular)S +5325(region)S +5904 V +1260(marker,)S +1604(used)S +1824(to)S +1939(select)S +2203(a)S +2284(region)S +2576(of)S +2696(the)S +2855(image.)S +3161(If)S +3264(you)S +3451(do)S +3588(this)S +3770(accidentally)S +4289(and)S +4470(don't)S +4718(want)S +4949(the)S +5108(marker,)S +5452(put)S +6024 V +1260(the)S +1419(pointer)S +1739(in)S +1854(the)S +2013(marker)S +2332(and)S +2513(type)S +2722(DELETE)S +3137(or)S +3258(BACKSPACE)S +3886(to)S +4002(delete)S +4278(the)S +4438(marker.)S +4783(With)S +5021(the)S +5181(pointer)S +5502(in)S +6144 V +1260(the)S +1417(marker,)S +1759(MB3)S +2000(will)S +2191(call)S +2370(up)S +2505(a)S +2584(marker)S +2901(menu)S +3158(listing)S +3444(some)S +3690(things)S +3970(you)S +4155(can)S +4328(do)S +4463(with)S +4676(the)S +4833(marker,)S +5174(like)S +5358(zoom)S +6264 V +1260(the)S +1420(outlined)S +1786(region.)S +2104(MB1)S +2348(can)S +2524(be)S +2656(used)S +2877(to)S +2993(drag)S +3208(or)S +3329(resize)S +3599(the)S +3759(marker.)S +4104(See)S +4287(below)S +4570(for)S +4725(more)S +4969(information)S +5480(on)S +6384 V +1260(markers.)S +6624 V +1260(Clicking)S +1642(on)S +1779(MB2)S +2022(in)S +2137(the)S +2296(main)S +2533(image)S +2814(window)S +3173(pans)S +3394(\(one)S +3609(click\))S +3874(or)S +3995(zooms)S +4294(\(two)S +4515(clicks\))S +4819(the)S +4979(image.)S +5286(Further)S +6744 V +1260(clicks)S +1529(cycle)S +1775(through)S +2122(the)S +2280(builtin)S +2578(zoom)S +2836(factors.)S +3198(Moving)S +3551(the)S +3709(pointer)S +4028(to)S +4142(a)S +4222(new)S +4424(location)S +4782(and)S +4962(clicking)S +5319(moves)S +6864 V +1260(the)S +1423(feature)S +1741(under)S +2010(the)S +2174(pointer)S +2499(to)S +2619(the)S +2783(center)S +3068(of)S +3193(the)S +3357(display)S +3688(window.)S +4137(Holding)S +4507(down)S +4771(the)S +4935(Shift)S +5172(key)S +5358(while)S +6984 V +1260(clicking)S +1620(MB2)S +1864(will)S +2058(cause)S +2317(a)S +2399(full-screen)S +2863(crosshair)S +3261(cursor)S +3547(to)S +3662(appear)S +3964(until)S +4185(the)S +4344(button)S +4637(is)S +4741(released,)S +5129(this)S +5311(can)S +5486(be)S +7104 V +1260(useful)S +1534(for)S +1680(\256ne)S +1860(positioning)S +2341(of)S +2454(the)S +2606(cursor.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(6)S +7920 V +EP +%%Page: 7 8 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(MB3)S +1507(is)S +1615(used)S +1839(to)S +1958(adjust)S +2238(the)S +2401(contrast)S +2758(and)S +2943(brightness)S +3395(of)S +3519(the)S +3682(displayed)S +4106(image.)S +4446(The)S +4643(position)S +5008(of)S +5133(the)S +5297(pointer)S +1080 V +1260(within)S +1560(the)S +1726(display)S +2059(window)S +2425(determines)S +2906(the)S +3071(contrast)S +3430(and)S +3617(brightness)S +4071(values.)S +4394(Click)S +4654(once)S +4885(to)S +5006(set)S +5160(the)S +5325(values)S +1200 V +1260(corresponding)S +1861(to)S +1969(the)S +2121(pointer)S +2434(location,)S +2811(or)S +2924(click)S +3148(and)S +3322(drag)S +3529(to)S +3637(continuously)S +4184(adjust)S +4453(the)S +4605(display.)S +1488 V +9 B +1080(KEYSTROKE)S +1677(ACCELERATORS)S +1608 V +10 R +1260(The)S +1445(following)S +1864(keystrokes)S +2321(are)S +2472(currently)S +2862(de\256ned)S +3186(in)S +3294(the)S +3446(GUI:)S +1848 V +1620(--------------------)S +10 B +2310(Misc)S +2545(Functions)S +10 R +2998(---------------------)S +1992 V +10 B +1620(Ctrl-b)S +10 R +2620(Previous)S +3000(\(back\))S +3284(frame)S +2100 V +10 B +1620(Ctrl-c)S +10 R +2620(Center)S +2916(frame)S +2208 V +10 B +1620(Ctrl-f)S +10 R +2620(Forward)S +2988(frame)S +2316 V +10 B +1620(Ctrl-i)S +10 R +2620(Invert)S +2888(colormap)S +2424 V +10 B +1620(Ctrl-m)S +10 R +2620(Toggle)S +2933(magni\256er)S +2532 V +10 B +1620(Ctrl-n)S +10 R +2620(Normalize)S +2640 V +10 B +1620(Ctrl-p)S +10 R +2620(Toggle)S +2933(panner)S +2748 V +10 B +1620(Ctrl-r)S +10 R +2620(Register)S +2856 V +10 B +1620(Ctrl-s)S +10 R +2620(Match)S +2905(LUT)S +3129(scaling)S +2964 V +10 B +1620(Ctrl-t)S +10 R +2620(Tile)S +2811(frames)S +3112(toggle)S +3072 V +10 B +1620(Ctrl-u)S +10 R +2620(Unzoom)S +2994(\(zoom=1\))S +3180 V +10 B +1620(Ctrl-x)S +10 R +2620(Flip)S +2812(X)S +3288 V +10 B +1620(Ctrl-y)S +10 R +2620(Flip)S +2812(Y)S +3456 V +10 B +1620(Ctrl-=)S +10 R +2620(Print)S +2845(using)S +3092(current)S +3404(setup)S +3564 V +10 B +1620(Ctrl-<)S +10 R +2620(Decrease)S +3014(blink)S +3250(rate)S +3429(\(blink)S +3698(faster\))S +3672 V +10 B +1620(Ctrl->)S +10 R +2620(Increase)S +2981(blink)S +3217(rate)S +3396(\(blink)S +3665(slower\))S +3780 V +10 B +1620(Ctrl-+)S +10 R +2620(Zoom)S +2889(in)S +3888 V +10 B +1620(Ctrl--)S +10 R +2620(Zoom)S +2889(out)S +4056 V +10 B +1620(Alt-1)S +1866(thru)S +2085(Alt-4)S +10 R +2620(Set)S +2778(frame)S +3040(to)S +3148(be)S +3272(displayed)S +4164 V +10 B +1620(Ctrl-1)S +1910(thru)S +2129(Ctrl9)S +10 R +2620(Set)S +2778(integer)S +3085(zoom)S +3337(factor)S +4332 V +10 B +1620(Ctrl-Alt-q)S +10 R +2620(Quit)S +4440 V +10 B +1620(Ctrl-Alt-f)S +10 R +2620(Fitframe)S +4608 V +1620(---------------------)S +10 B +2343(Panel)S +2612(Toggles)S +10 R +2970(---------------------)S +4752 V +10 B +1620(Alt-b)S +10 R +2620(Blink)S +2873(frames)S +4860 V +10 B +1620(Alt-c)S +10 R +2620(Control)S +2956(panel)S +4968 V +10 B +1620(Alt-h)S +10 R +2620(Help)S +2844(popup)S +5076 V +10 B +1620(Alt-i)S +10 R +2620(Info)S +2816(box)S +2996(popup)S +5184 V +10 B +1620(Alt-l)S +10 R +2620(Load)S +2855(\256le)S +3013(popup)S +5292 V +10 B +1620(Alt-p)S +10 R +2620(Print)S +2845(popup)S +5400 V +10 B +1620(Alt-s)S +10 R +2620(Save)S +2844(popup)S +5508 V +10 B +1620(Alt-t)S +10 R +2620(TclShell)S +2989(popup)S +5736 V +1620(-------------------)S +10 B +2277(Cursor)S +2612(Positioning)S +10 R +3121(------------------)S +5880 V +10 B +1620(Ctrl-h)S +1916(/)S +1974(Ctrl-Left)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(left)S +5988 V +10 B +1620(Ctrl-j)S +1893(/)S +1951(Ctrl-Down)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(down)S +6096 V +10 B +1620(Ctrl-k)S +1916(/)S +1974(Ctrl-Up)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(up)S +6204 V +10 B +1620(Ctrl-l)S +1888(/)S +1946(Ctrl-Right)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(right)S +6372 V +10 B +1620(Shift-Ctrl-h)S +2155(/)S +2213(Shift-Ctrl-Left)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(left)S +6480 V +10 B +1620(Shift-Ctrl-j)S +2132(/)S +2190(Shift-Ctrl-Down)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(down)S +6588 V +10 B +1620(Shift-Ctrl-k)S +2155(/)S +2213(Shift-Ctrl-Up)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(up)S +6696 V +10 B +1620(Shift-Ctrl-l)S +2127(/)S +2185(Shift-Ctrl-Right)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(right)S +6924 V +1620(-------------------)S +10 B +2277(Auto-Registration)S +10 R +3078(-------------------)S +7068 V +10 B +1620(Ctrl-a)S +10 R +2620(Toggle)S +2933(auto-registration)S +7176 V +10 B +1620(Ctrl-o)S +10 R +2620(Set)S +2778(frame)S +3040(o)S +3090 H + (f)show 10 -.5 mul h (f)show +10 R +3151(set)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(7)S +7920 V +EP +%%Page: 8 9 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1620(--------------------)S +10 B +2310(Frame)S +2622(Positioning)S +10 R +3131(------------------)S +1104 V +10 B +1620(Ctrl-Left)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(left)S +1212 V +10 B +1620(Ctrl-Down)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(down)S +1320 V +10 B +1620(Ctrl-Up)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(up)S +1428 V +10 B +1620(Ctrl-Right)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(right)S +1596 V +10 B +1620(Ctrl-Alt-Left)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(left)S +1704 V +10 B +1620(Ctrl-Alt-Down)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(down)S +1812 V +10 B +1620(Ctrl-Alt-Up)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(up)S +1920 V +10 B +1620(Ctrl-Alt-Right)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(right)S +2148 V +1620(-------------------)S +10 B +2277(Peak-Up)S +2679(Centroiding)S +10 R +3226(-----------------)S +2292 V +10 B +1620(Ctrl-[)S +10 R +2620(Decrease)S +3014(centroiding)S +3499(box)S +3679(size)S +2400 V +10 B +1620(Ctrl-])S +10 R +2620(Increase)S +2981(centroiding)S +3466(box)S +3646(size)S +2508 V +10 B +1620(Ctrl-0)S +1910(\(zero\))S +10 R +2620(Centroid/\256nd)S +3184(local)S +3408(maximum)S +2616 V +10 B +1620(Alt-Ctrl-0)S +2076(\(zero\))S +10 R +2620(Find)S +2834(local)S +3058(minimum)S +2844 V +1620(------------------)S +10 B +2244(Mouse)S +2557(Button)S +2882(Events)S +10 R +3201(------------------)S +2988 V +10 B +1620(Shift-Btn1Down)S +10 R +2620(Turn)S +2844(on)S +2974(magni\256er)S +3096 V +10 B +1620(Shift-Btn1Up)S +10 R +2620(Turn)S +2844(o)S +2894 H + (f)show 10 -.5 mul h (f)show +10 R +2985(magni\256er)S +3204 V +10 B +1620(Shift-Btn2Down)S +10 R +2620(Turn)S +2844(on)S +2974(crosshair)S +3364(cursor)S +3312 V +10 B +1620(Shift-Btn2Up)S +10 R +2620(Turn)S +2844(o)S +2894 H + (f)show 10 -.5 mul h (f)show +10 R +2985(crosshair)S +3375(cursor)S +3480 V +10 B +1620(Btn1Down)S +10 R +2620(Create)S +2910(a)S +2984(Marker)S +3588 V +10 B +1620(Btn1Motion)S +10 R +2620(Resize)S +2916(marker)S +3228(being)S +3480(created)S +3696 V +10 B +1620(Btn2Down)S +10 R +2620(Zoom/center)S +3160(on)S +3290(cursor)S +3569(position)S +3804 V +10 B +1620(Btn3Down/Motion)S +10 R +2620(Brightness/contrast)S +3422(scale)S +3651(the)S +3803(image)S +3972 V +10 B +1620(Ctrl-Btn1Down)S +10 R +2620(Create)S +2910(Ruler)S +3162(Marker)S +4080 V +10 B +1620(Ctrl-Btn1Motion)S +10 R +2620(Resize)S +2916(Ruler)S +3168(Marker)S +3491(being)S +3743(created)S +4188 V +10 B +1620(Ctrl-Btn1Up)S +10 R +2620(Destroy)S +2966(Ruler)S +3218(Marker)S +4356 V +10 B +1620(Alt-Motion)S +10 R +2620(Freeze)S +2915(cursor)S +3194(readout)S +4644 V +10 B +1260(NOTE:)S +10 R +1612(These)S +1885(keystrokes)S +2347(only)S +2560(work)S +2800(with)S +3013(the)S +3170(cursor)S +3454(in)S +3567(the)S +3724(main)S +3959(image)S +4238(window,)S +4620(only)S +4833(a)S +4913(few)S +5098(of)S +5217(the)S +5375(com-)S +4764 V +1260(mands)S +1563(are)S +1726(implemented)S +2290(to)S +2410(work)S +2657(within)S +2954(subwindows)S +3495(or)S +3619(markers)S +3981(to)S +4100(avoid)S +4363(con\257icts)S +4743(with)S +4962(translations)S +5464(for)S +4884 V +1260(those)S +1501(objects.)S +1869(If)S +1965(a)S +2039(command)S +2464(does)S +2678(not)S +2837(work,)S +3098(check)S +3361(the)S +3514(cursor)S +3794(location)S +4147(and)S +4322(try)S +4464(it)S +4551(again)S +4798(in)S +4907(the)S +5060(main)S +5291(display)S +5004 V +1260(window.)S +5292 V +9 B +900(FRAME)S +1257(BUFFER)S +1644(CONFIGURATIONS)S +5412 V +10 R +1260(XImtool)S +1634(starts)S +1880(up)S +2015(using)S +2267(default)S +2579(frame)S +2846(bu)S +2946 H + (f)show 10 -.5 mul h (f)show +10 R +3007(er)S +3120(size)S +3311(of)S +3430(512x512)S +3816(pixels,)S +4116(two)S +4302(\(of)S +4454(16)S +4590(possible\))S +4987(frames)S +5294(will)S +5486(be)S +5532 V +1260(created.)S +1608(When)S +1882(loading)S +2218(disk)S +2421(images)S +2740(\(i.e.)S +2961(run)S +3130(in)S +3244(standalone)S +3706(mode\))S +3996(the)S +4153(frame)S +4420(bu)S +4520 H + (f)show 10 -.5 mul h (f)show +10 R +4581(er)S +4693(con\256guration)S +5261(\256le)S +5424(will)S +5652 V +1260(be)S +1385(searched)S +1764(for)S +1911(a)S +1986(de\256ned)S +2311(frame)S +2574(bu)S +2674 H + (f)show 10 -.5 mul h (f)show +10 R +2735(er)S +2843(that)S +3024(is)S +3122(the)S +3275(same)S +3511(size)S +3697(or)S +3811(larger)S +4074(than)S +4277(the)S +4430(current)S +4743(image,)S +5044(if)S +5137(no)S +5269(suitable)S +5772 V +1260(bu)S +1360 H + (f)show 10 -.5 mul h (f)show +10 R +1421(er)S +1529(can)S +1698(be)S +1822(found)S +2085(a)S +2159(custom)S +2478(frame)S +2740(bu)S +2840 H + (f)show 10 -.5 mul h (f)show +10 R +2901(er)S +3008(the)S +3160(same)S +3395(size)S +3580(as)S +3693(the)S +3845(image)S +4119(will)S +4305(be)S +4429(created)S +4746(in)S +4854(an)S +4978(unused)S +5291(portion)S +5892 V +1260(of)S +1373(the)S +1525(con\256guration)S +2088(table.)S +2367(When)S +2635(used)S +2848(as)S +2962(a)S +3037(display)S +3357(server)S +3631(the)S +3784(frame)S +4047(bu)S +4147 H + (f)show 10 -.5 mul h (f)show +10 R +4208(er)S +4316(con\256guration)S +4880(number)S +5216(is)S +5314(passed)S +6012 V +1260(in)S +1381(by)S +1524(the)S +1689(client)S +1954(and)S +2140(loaded)S +2448(explicitly)S +2868(even)S +3098(if)S +3201(it)S +3299(means)S +3596(clipping)S +3966(the)S +4130(image.)S +4471(If)S +4579(a)S +4665(new)S +4873(frame)S +5147(bu)S +5247 H + (f)show 10 -.5 mul h (f)show +10 R +5308(er)S +5427(is)S +5536(a)S +6132 V +1260(di)S +1338 H + (f)show 10 -.5 mul h (f)show +10 R +1399(erent)S +1635(size)S +1827(than)S +2036(previously)S +2495(de\256ned)S +2826(frames,)S +3159(all)S +3296(available)S +3693(frames)S +4001(will)S +4194(be)S +4325(initialized)S +4763(and)S +4945(cleared)S +5270(prior)S +5502(to)S +6252 V +1260(the)S +1422(display.)S +1806(The)S +2001(default)S +2318(frame)S +2590(bu)S +2690 H + (f)show 10 -.5 mul h (f)show +10 R +2751(er)S +2868(con\256guration)S +3441(\256le)S +3609(is)S +3716(/usr/local/lib/imtoolrc,)S +4654(this)S +4838(can)S +5015(be)S +5148(overridden)S +6372 V +1260(by)S +1407(de\256ning)S +1782(a)S +1874(IMTOOLRC)S +2444(environment)S +2997(variable)S +3366(naming)S +3714(the)S +3884(\256le)S +4060(to)S +4186(be)S +4328(used,)S +4584(by)S +4732(creating)S +5101(a)S +5193(using)S +5458(the)S +6492 V +10 I +1260(-imtoolrc)S +10 R +1662(command)S +2086(line)S +2266(\257ag)S +2446(or)S +10 I +2559(imtoolrc)S +10 R +2928(application)S +3402(resource.)S +6732 V +1260(The)S +1445(format)S +1741(of)S +1854(the)S +2006(frame)S +2268(bu)S +2368 H + (f)show 10 -.5 mul h (f)show +10 R +2429(er)S +2536(con\256guration)S +3099(\256le)S +3257(is)S +6972 V +10 I +1410(con\256gno)S +1784(nframes)S +2136(width)S +2389(height)S +2669([extra)S +2943(\256elds])S +7092 V +10 R +1290(e.g.)S +7212 V +1560(1)S +1670(2)S +1780(512)S +1990(512)S +7692 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(8)S +7920 V +EP +%%Page: 9 10 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1560(2)S +1670(2)S +1780(800)S +1990(800)S +1080 V +1560(3)S +1670(1)S +1750(1024)S +1980(1024)S +2480(#)S +2560(comment)S +1200 V +1560(:)S +1648(:)S +1766(:)S +1914(:)S +1440 V +1260(At)S +1417(most)S +1669(128)S +1876(frame)S +2165(bu)S +2265 H + (f)show 10 -.5 mul h (f)show +10 R +2326(er)S +2460(sizes)S +2711(may)S +2940(be)S +3092(de\256ned,)S +3469(each)S +3709(con\256guration)S +4300(may)S +4530(de\256ne)S +4832(up)S +4990(to)S +5126(16)S +5284(frames,)S +1560 V +1260(con\256guration)S +1823(numbers)S +2197(need)S +2415(not)S +2573(be)S +2697(sequential.)S +1848 V +10 B +1260(NOTE:)S +10 R +1640(When)S +1911(de\256ning)S +2272(a)S +2349(new)S +2548(frame)S +2813(bu)S +2913 H + (f)show 10 -.5 mul h (f)show +10 R +2974(er)S +3084(for)S +3233(use)S +3399(with)S +3610(client)S +3865(software)S +4241(such)S +4457(as)S +4573(IRAF)S +4834(the)S +4990(user)S +5190(must)S +5419(also)S +1968 V +1260(remember)S +1694(to)S +1802(de\256ne)S +2076(those)S +2317(frame)S +2579(bu)S +2679 H + (f)show 10 -.5 mul h (f)show +10 R +2740(ers)S +2886(in)S +2994(the)S +3146(IRAF)S +10 I +3404(dev$graphcap)S +10 R +4005(\256le.)S +2256 V +9 B +1080(SUPPORT)S +1527(FOR)S +1744(16)S +1861(DISPLAY)S +2283(FRAMES)S +2376 V +10 R +1260(As)S +1402(part)S +1588(of)S +1702(the)S +1855(extensive)S +2263(GUI)S +2471(changes)S +2823(with)S +3032(the)S +3185(V1.3)S +3413(release,)S +3745(support)S +4076(for)S +4223(the)S +4376(full)S +4546(16)S +4677(frames)S +4979(allowed)S +5326(by)S +5458(the)S +2496 V +1260(IIS)S +1418(protocol)S +1787(is)S +1890(now)S +2098(available.)S +2549(IRAF)S +2813(V2.11.4)S +3171(or)S +3290(later)S +3503(client)S +3761(tasks)S +3997(\(and)S +4209(CDL)S +4444(library\))S +4778(are)S +4934(required)S +5301(to)S +5414(take)S +2616 V +1260(advantage)S +1695(of)S +1809(this)S +1985(frames.)S +2342(All)S +2501(changes)S +2853(are)S +3005(backwards)S +3462(compatible,)S +3962(older)S +4198(versions)S +4563(of)S +4678(IRAF)S +4938(will)S +5126(continue)S +5502(to)S +2736 V +1260(work)S +1503(but)S +1669(cannot)S +1973(access)S +2265(more)S +2508(than)S +2718(the)S +2877(original)S +3225(four)S +3428(frames.)S +3791(The)S +3983(new)S +4186(DISPLAY)S +4645(task)S +4843(will)S +5036(automatically)S +2856 V +1260(sense)S +1513(whether)S +1872(the)S +2032(display)S +2359(server)S +2640(being)S +2900(used)S +3121(supports)S +3498(16)S +3636(frames)S +3945(or)S +4066(the)S +4226(original)S +4575(4)S +4663(and)S +4845(adjust)S +5122(the)S +5282('frame')S +2976 V +1260(parameter)S +1688(maximum)S +2124(accordingly.)S +2680(The)S +2865(changes)S +3216(are)S +3367(fully)S +3586(backwards)S +4042(compatible)S +4516(for)S +4662(other)S +4897(servers.)S +3216 V +1260(More)S +1527(frames)S +1849(are)S +2021(possible)S +2400(if)S +2512(needed)S +2845(but)S +3024(will)S +3231(require)S +3564(further)S +3886(changes)S +4258(to)S +4388(the)S +4562(client)S +4836(IRAF)S +5116(code)S +5356(to)S +5486(be)S +3336 V +1260(e)S +1304 H + (f)show 10 -.5 mul h (f)show +10 R +1365(ective.)S +1698(Allowing)S +2116(creation)S +2477(of)S +2600(more)S +2845(than)S +3056(16)S +3195(frames)S +3505(by)S +3644(the)S +3805(Load)S +4049(panel)S +4304(can)S +4481(be)S +4614(done)S +4847(independently)S +5452(but)S +3456 V +1260(would)S +1547(also)S +1745(require)S +2064(numerous)S +2495(code)S +2720(change)S +3039(to)S +3154(XImtool.)S +3585(Please)S +3877(contact)S +4202(site)S +4378(support)S +4715(if)S +4814(there)S +5051(is)S +5156(a)S +5238(need)S +5464(for)S +3576 V +1260(this,)S +1460(or)S +1573(for)S +1719(workaround)S +2231(suggestions)S +2728(depending)S +3174(on)S +3304(your)S +3517(application.)S +3864 V +9 B +900(MARKERS)S +3984 V +10 R +1260(Although)S +1668(ximtool)S +2010(doesn't)S +2334(do)S +2464(much)S +2717(with)S +2926(markers)S +3278(currently,)S +3694(they)S +3897(are)S +4049(a)S +4124(general)S +4448(feature)S +4755(of)S +4869(the)S +10 I +5022(Gterm)S +10 R +5308(widget)S +4104 V +1260(and)S +1450(are)S +1616(used)S +1844(more)S +2094(extensively)S +2594(in)S +2717(other)S +2967(programs)S +3389(\(e.g.)S +3611(the)S +3778(prototype)S +4206(IRAF)S +4479(science)S +4817(GUI)S +5039(applications\).)S +4224 V +1260(XImtool)S +1645(uses)S +1863(markers)S +2230(for)S +2392(the)S +2560(marker)S +2888(zoom)S +3156(feature)S +3478(discussed)S +3908(above,)S +4218(and)S +4409(also)S +4617(for)S +4780(the)S +4949(panner)S +5267(and)S +5458(the)S +4344 V +1260(coords)S +1559(box.)S +1767(All)S +1928(markers)S +2282(share)S +2525(some)S +2769(of)S +2885(the)S +3040(same)S +3278(characteristics,)S +3906(so)S +4028(it)S +4116(is)S +4215(worthwhile)S +4702(learning)S +5061(basic)S +5298(marker)S +4464 V +1260(manipulation)S +1818(keystrokes.)S +4632 V +10 B +1260(o)S +10 R +1410(MB1)S +1646(anywhere)S +2063(inside)S +2332(a)S +2406(marker)S +2718(may)S +2920(be)S +3044(used)S +3257(to)S +3365(drag)S +3572(the)S +3724(marker.)S +4800 V +10 B +1260(o)S +10 R +1410(MB1)S +1646(near)S +1847(a)S +1921(marker)S +2233(corner)S +2517(or)S +2630(edge,)S +2873(depending)S +3319(on)S +3449(the)S +3601(type)S +3803(of)S +3916(marker,)S +4253(resizes)S +4554(the)S +4706(marker.)S +4968 V +10 B +1260(o)S +10 R +1410(Shift-MB1)S +1874(on)S +2004(the)S +2156(corner)S +2440(of)S +2553(most)S +2778(markers)S +3129(will)S +3315(rotate)S +3572(the)S +3724(marker.)S +5136 V +10 B +1260(o)S +10 R +1410(Markers)S +1775(stack,)S +2038(if)S +2132(you)S +2315(have)S +2536(several)S +2851(markers)S +3205(and)S +3382(you)S +3565(put)S +3726(one)S +3903(on)S +4037(top)S +4199(of)S +4316(the)S +4472(other.)S +4736(The)S +4925(active)S +5197(marker)S +5513(is)S +5256 V +1410(highlighted)S +1909(to)S +2030(tell)S +2201(you)S +2394(which)S +2681(of)S +2807(the)S +2972(stacked)S +3314(markers)S +3678(is)S +3788(active.)S +4094(If)S +4203(the)S +4368(markers)S +4732(overlap,)S +5099(this)S +5287(will)S +5486(be)S +5376 V +1410(marker)S +1722("on)S +1893(top")S +2092(in)S +2200(the)S +2352(stacking)S +2715(order.)S +5544 V +10 B +1260(o)S +10 R +1410(MB2)S +1646(in)S +1754(the)S +1906(body)S +2136(of)S +2249(a)S +2323(marker)S +2635("lowers")S +3013(the)S +3165(marker,)S +3502(i.e.)S +3654(moves)S +3945(it)S +4031(to)S +4139(the)S +4291(bottom)S +4605(of)S +4718(the)S +4870(stacking)S +5233(order.)S +5712 V +10 B +1260(o)S +10 R +1410(Delete)S +1700(or)S +1813(backspace)S +2252(in)S +2360(a)S +2434(marker)S +2746(deletes)S +3053(it.)S +5880 V +10 B +1260(o)S +10 R +1410(Markers)S +1789(have)S +2024(their)S +2254(own)S +2473(translation)S +2942(resources)S +3365(and)S +3557(so)S +3694(the)S +3864(default)S +4189(keystroke)S +4625(commands)S +5106(will)S +5310(not)S +5486(be)S +6000 V +1410(recognized)S +1877(when)S +2123(the)S +2275(cursor)S +2554(is)S +2651(in)S +2759(a)S +2833(marker.)S +6240 V +1410(For)S +1585(example,)S +1984(try)S +2131(placing)S +2461(the)S +2619(pointer)S +2938(anywhere)S +3361(in)S +3476(the)S +3635(coords)S +3938(box,)S +4150(then)S +4359(press)S +4601(MB1)S +4844(and)S +5025(hold)S +5240(it)S +5333(down,)S +6360 V +1410(and)S +1587(drag)S +1797(the)S +1951(coords)S +2249(box)S +2431(marker)S +2745(somewhere)S +3231(else)S +3418(on)S +3550(the)S +3704(screen.)S +4015(You)S +4219(can)S +4389(also)S +4582(resize)S +4846(the)S +5000(coords)S +5298(box)S +5480(by)S +6480 V +1410(dragging)S +1796(a)S +1871(corner,)S +2181(or)S +2296(delete)S +2566(it)S +2654(with)S +2864(the)S +3018(delete)S +3288(or)S +3403(backspace)S +3844(key.)S +4045(\(The)S +4265(Initialize)S +4652(button)S +4940(will)S +5128(get)S +5282(the)S +5436(ori-)S +6600 V +1410(ginal)S +1640(coords)S +1936(box)S +2116(back)S +2334(if)S +2425(you)S +2605(delete)S +2873(it,)S +2984(or)S +3097(you)S +3277(can)S +3445(reset)S +3663(the)S +3815(toggle)S +4095(in)S +4203(the)S +4355(control)S +4668(panel\).)S +6888 V +9 B +1080(PANNER)S +1482(MARKER)S +7008 V +10 R +1260(The)S +1449(panner)S +1754(window)S +2110(always)S +2421(displays)S +2783(the)S +2939(full)S +3112(frame)S +3379(bu)S +3479 H + (f)show 10 -.5 mul h (f)show +10 R +3540(er.)S +3677(Try)S +3856(setting)S +4158(the)S +4315(frame)S +4582(bu)S +4682 H + (f)show 10 -.5 mul h (f)show +10 R +4743(er)S +4855(con\256guration)S +5423(to)S +5536(a)S +7128 V +1260(nonsquare)S +1708(frame)S +1978(bu)S +2078 H + (f)show 10 -.5 mul h (f)show +10 R +2139(er)S +2254(\(e.g.)S +2469(imtcryo\))S +2851(and)S +3033(then)S +3243(displaying)S +3698(a)S +3780(square)S +4078(image)S +4360(\(e.g.)S +4575(dev$pix\))S +4968(and)S +5150(the)S +5309(panner)S +7248 V +1260(will)S +1446(show)S +1687(you)S +1867(exactly)S +2185(where)S +2458(the)S +2610(image)S +2884(has)S +3047(been)S +3265(loaded)S +3561(into)S +3747(the)S +3899(frame.)S +7728 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(9)S +7920 V +EP +%%Page: 10 11 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(The)S +1450(panner)S +1756(window)S +2113(uses)S +2321(two)S +2507(markers,)S +2889(one)S +3069(for)S +3221(the)S +3379(window)S +3737(border)S +4033(and)S +4213(one)S +4393(to)S +4507(mark)S +4748(the)S +4906(displayed)S +5325(region)S +1080 V +1260(of)S +1379(the)S +1537(frame.)S +1830(Most)S +2072(of)S +2191(the)S +2349(usual)S +2596(marker)S +2914(keystrokes)S +3377(mentioned)S +3835(below)S +4115(apply)S +4373(to)S +4487(these)S +4728(markers)S +5085(as)S +5204(well,)S +5436(e.g.)S +1200 V +1260(you)S +1443(can)S +1614(use)S +1780(MB1)S +2019(to)S +2130(reposition)S +2563(on)S +2696(the)S +2851(panner)S +3156(window)S +3512(within)S +3802(the)S +3958(main)S +4192(image)S +4470(display)S +4793(window,)S +5174(or)S +5291(to)S +5403(drag)S +1320 V +1260(the)S +1414(region)S +1701(marker)S +2015(within)S +2303(the)S +2457(panner)S +2760(\(pan)S +2969(the)S +3123(image\).)S +3456(Resizing)S +3837(the)S +3990(region)S +4276(marker)S +4589(zooms)S +4881(the)S +5034(image;)S +5337(this)S +5513(is)S +1440 V +1260(a)S +1336(non-aspect)S +1800(constrained)S +2292(zoom.)S +2571(The)S +2758(panner)S +3061(window)S +3415(itself)S +3647(can)S +3817(be)S +3943(resized)S +4257(by)S +4389(dragging)S +4776(a)S +4852(corner)S +5138(with)S +5349(MB1.)S +1560 V +1260(Typing)S +1579(delete)S +1847(or)S +1960(backspace)S +2399(anywhere)S +2816(in)S +2924(the)S +3076(panner)S +3377(window)S +3729(deletes)S +4036(the)S +4188(panner.)S +1800 V +1260(A)S +1362(special)S +1669(case)S +1870(is)S +1967(MB2.)S +2228(Hitting)S +2542(MB2)S +2778(anywhere)S +3195(in)S +3303(the)S +3455(panner)S +3757(window)S +4110(pans)S +4324(the)S +4477(image)S +4752(to)S +4861(that)S +5042(point.)S +5304(This)S +5513(is)S +1920 V +1260(analogous)S +1695(to)S +1803(hitting)S +2095(MB2)S +2331(in)S +2439(the)S +2591(main)S +2821(display)S +3140(window)S +3492(to)S +3600(pan)S +3774(the)S +3926(image.)S +2160 V +1260(The)S +1447(panner)S +1750(marker)S +2064(can)S +2234(be)S +2360(disabled)S +2725(by)S +2857(de\256ning)S +3218(the)S +10 I +3373(displayPanner)S +10 R +3989(GUI)S +4199(resource,)S +4594(its)S +4722(size)S +4910(and)S +5087(location)S +5442(can)S +2280 V +1260(be)S +1384(controlled)S +1819(using)S +2066(the)S +10 I +2218(pannerArea)S +10 R +2725(and)S +10 I +2899(pannerGeom)S +10 R +3450(GUI)S +3657(resources)S +4063(respectively.)S +2568 V +9 B +1080(MAGNIFIER)S +1642(MARKER)S +2688 V +10 R +1260(The)S +1445(magni\256er)S +1858(marker)S +2170(can)S +2338(be)S +2462(used)S +2676(to)S +2785(zoom)S +3038(in)S +3147(on)S +3278(a)S +3353(small)S +3601(area)S +3797(around)S +4105(the)S +4258(cursor.)S +4593(It)S +4685(will)S +4872(be)S +4997(updated)S +5344(as)S +5458(the)S +2808 V +1260(cursor)S +1552(moves)S +1856(but)S +2027(only)S +2248(for)S +2407(small)S +2666(motions)S +3031(\(either)S +3333(mouse)S +3636(movement)S +4100(or)S +4225(with)S +4445(the)S +4609(cursor)S +4900(movement)S +5364(keys-)S +2928 V +1260(trokes\))S +1570(to)S +1681(minimize)S +2092(the)S +2247(impact)S +2552(on)S +2685(the)S +2840(system.)S +3207(The)S +3396(zoom)S +3652(factor)S +3918(is)S +4019(expressed)S +4446(as)S +4563(some)S +4808(fraction)S +5152(of)S +5269(the)S +5425(size)S +3048 V +1260(of)S +1381(the)S +1541(magni\256er)S +1962(marker)S +2282(itself.)S +2575(The)S +2768(default)S +3083(zoom)S +3343(is)S +3448(4,)S +3561(i.e.)S +3721(the)S +3881(area)S +4084(in)S +4200(the)S +4359(marker)S +4678(represents)S +5119(and)S +5300(area)S +5502(in)S +3168 V +1260(the)S +1417(image)S +1696(that's)S +1953(one-fourth)S +2409(the)S +2566(size)S +2756(of)S +2874(the)S +3031(marker.)S +3403(Other)S +3665(zoom)S +3922(factors)S +4228(may)S +4435(be)S +4564(selected)S +4920(using)S +5172(the)S +5330(popup)S +3288 V +1260(menu)S +1512(created)S +1829(by)S +1959(hitting)S +2251(MB1)S +2487(in)S +2595(the)S +2747(marker.)S +3528 V +1260(By)S +1414(default)S +1728(the)S +1887(magni\256er)S +2307(marker)S +2626(is)S +2730(not)S +2895(visible,)S +3224(to)S +3339(toggle)S +3626(it)S +3720(select)S +3985(the)S +10 I +4145(Magni\256er)S +10 R +4577(option)S +4871(from)S +5103(the)S +10 I +5263(Options)S +3648 V +10 R +1260(menubar)S +1660(button.)S +2022(Alternatively,)S +2625(for)S +2792(just)S +2988(a)S +3083(quick)S +3356(look)S +3584(holding)S +3940(down)S +4212(the)S +4384(Shift)S +4629(and)S +4823(MB1)S +5079(buttons)S +5424(will)S +3768 V +1260(display)S +1579(the)S +1731(marker)S +2043(until)S +2257(the)S +2409(button)S +2695(is)S +2792(released.)S +4008 V +1260(The)S +1453(magni\256er)S +1874(marker)S +2194(can)S +2370(be)S +2502(disabled)S +2873(by)S +3011(de\256ning)S +3377(the)S +10 I +3537(displayMagni\256er)S +10 R +4258(GUI)S +4473(resource,)S +4873(its)S +5006(size)S +5199(and)S +5381(loca-)S +4128 V +1260(tion)S +1446(can)S +1614(be)S +1738(controlled)S +2173(using)S +2420(the)S +10 I +2572(magni\256erArea)S +10 R +3179(and)S +10 I +3353(magni\256erGeom)S +10 R +4004(GUI)S +4211(resources)S +4617(respectively.)S +4416 V +9 B +1080(COORDS)S +1492(BOX)S +1714(MARKER)S +4536 V +10 R +1260(XImtool)S +1629(provides)S +2003(a)S +2077(limited)S +2391(notion)S +2677(of)S +2790(world)S +3054(coordinates,)S +3570(allowing)S +3951(frame)S +4214(bu)S +4314 H + (f)show 10 -.5 mul h (f)show +10 R +4375(er)S +4483(pixel)S +4714(coordinates)S +5205(and)S +5380(pixel)S +4656 V +1260(values)S +1546(to)S +1655(be)S +1780(converted)S +2204(to)S +2312(some)S +2553(arbitrary)S +2926(linear)S +3183(client-de\256ned)S +3762(coordinate)S +4213(system.)S +4546(The)S +4731(coords)S +5027(box)S +5207(feature)S +5513(is)S +4776 V +1260(used)S +1473(to)S +1581(display)S +1900(these)S +2135(world)S +2398(coordinates)S +2888(as)S +3001(the)S +3153(pointer)S +3466(is)S +3563(moved)S +3865(about)S +4117(in)S +4225(the)S +4377(image)S +4651(window.)S +5016 V +1260(The)S +1445(quantities)S +1865(displayed)S +2279(in)S +2388(the)S +2541(coords)S +2838(box)S +3019(are)S +3171(X,)S +3299(Y,)S +3427(and)S +3602(Z:)S +3722(the)S +3875(X,Y)S +4075(world)S +4339(coordinates)S +4830(of)S +4944(the)S +5097(pointer,)S +5436(and)S +5136 V +1260(Z,)S +1379(the)S +1534(world)S +1800(equivalent)S +2249(of)S +2365(the)S +2520(pixel)S +2753(value)S +3002(under)S +3262(the)S +3417(pointer.)S +3758(All)S +3919(coordinate)S +4373(systems)S +4723(are)S +4877(linear.)S +5161(The)S +5348(preci-)S +5256 V +1260(sion)S +1466(of)S +1588(a)S +1671(displayed)S +2093(quantity)S +2460(is)S +2566(limited)S +2889(by)S +3028(the)S +3189(range)S +3449(of)S +3571(values)S +3865(of)S +3988(the)S +4150(associated)S +4600(raw)S +4789(frame)S +5061(bu)S +5161 H + (f)show 10 -.5 mul h (f)show +10 R +5222(er)S +5339(value.)S +5376 V +1260(For)S +1431(example,)S +1826(if)S +1919(the)S +2073(display)S +2394(window)S +2748(is)S +2846(512x512)S +3227(only)S +3436(512)S +3617(coordinate)S +4069(values)S +4355(are)S +4507(possible)S +4866(in)S +4975(either)S +5233(axis)S +5425(\(the)S +5496 V +1260(positional)S +1687(precision)S +2085(can)S +2256(be)S +2383(increased)S +2792(however)S +3168(by)S +3301(zooming)S +3684(the)S +3839(image\).)S +4174(More)S +4423(seriously,)S +4842(at)S +4947(most)S +5175(about)S +5430(200)S +5616 V +1260(pixel)S +1501(values)S +1797(can)S +1976(be)S +2111(displayed)S +2534(since)S +2779(this)S +2964(is)S +3071(the)S +3233(limit)S +3463(on)S +3603(the)S +3765(range)S +4026(of)S +4149(pixel)S +4389(values)S +4684(loaded)S +4990(into)S +5186(the)S +5348(frame)S +5736 V +1260(bu)S +1360 H + (f)show 10 -.5 mul h (f)show +10 R +1421(er.)S +1553(If)S +1649(a)S +1723(display)S +2042(pixel)S +2272(is)S +2369(saturated)S +2759(a)S +2833("+")S +3001(will)S +3187(be)S +3311(displayed)S +3724(after)S +3936(the)S +4088(intensity)S +4463(value.)S +5976 V +1260(The)S +1446(coords)S +1743(box)S +1924(is)S +2022(a)S +2097(text)S +2278(marker,)S +2616(it)S +2703(can)S +2872(be)S +2997(moved)S +3300(and)S +3475(resized)S +3788(with)S +3997(the)S +4150(pointer)S +4464(like)S +4645(any)S +4820(other)S +5056(marker.)S +5425(The)S +6096 V +1260(coords)S +1561(box)S +1746(marker)S +2063(can)S +2236(be)S +2365(disabled)S +2733(by)S +2868(de\256ning)S +3231(the)S +10 I +3388(displayCoords)S +10 R +4007(GUI)S +4219(resource,)S +4616(its)S +4746(location)S +5103(can)S +5275(be)S +5403(con-)S +6216 V +1260(trolled)S +1551(by)S +1681(the)S +10 I +1833(wcsboxGeom)S +10 R +2395(GUI)S +2602(resource.)S +6504 V +9 B +1080(MARKER)S +1517(MENU)S +1819(OPTIONS)S +6624 V +10 R +1260(Except)S +1575(for)S +1729(the)S +1889(panner)S +2198(and)S +2380(WCS)S +2635(markers,)S +3019(MB3)S +3263(\(mouse)S +3595(button)S +3889(3\))S +4010(calls)S +4231(up)S +4369(the)S +4529(marker)S +4849(menu)S +5109(providing)S +5536(a)S +6744 V +1260(limited)S +1574(set)S +1715(of)S +1828(functions)S +2230(common)S +2610(to)S +2718(all)S +2848(markers:)S +6912 V +10 B +1260(o)S +10 R +1410(Zoom)S +1686(does)S +1906(an)S +2037(equal)S +2291(aspect)S +2578(zoom)S +2838(of)S +2959(the)S +3119(region)S +3412(outlined)S +3778(by)S +3916(the)S +4076(marker.)S +4421(In)S +4542(this)S +4725(way)S +4929(you)S +5117(can)S +5293(mark)S +5536(a)S +7032 V +1410(region)S +1695(of)S +1808(the)S +1960(image)S +2234(and)S +2408(zoom)S +2660(it)S +2746(up.)S +7200 V +10 B +1260(o)S +10 R +1410(Fill)S +1597(exactly)S +1933(zooms)S +2242(the)S +2412(area)S +2625(outlined)S +3001(by)S +3149(the)S +3319(marker,)S +3674(making)S +4022(it)S +4126(\256ll)S +4286(the)S +4456(display)S +4793(window.)S +5188(Since)S +5458(the)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(10)S +7920 V +EP +%%Page: 11 12 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1410(marker)S +1722(is)S +1819(not)S +1977(likely)S +2235(to)S +2343(be)S +2467(exactly)S +2785(square,)S +3100(the)S +3252(aspect)S +3531(ratio)S +3744(of)S +3857(the)S +4009(resultant)S +4383(image)S +4657(will)S +4843(not)S +5001(be)S +5125(unitary.)S +1128 V +10 B +1260(o)S +10 R +1410(Print)S +1643(prints)S +1909(the)S +2069(region)S +2362(outlined)S +2728(by)S +2866(the)S +3027(marker)S +3348(to)S +3465(the)S +3626(printer)S +3931(or)S +4053(\256le)S +4220(currently)S +4619(con\256gured)S +5085(by)S +5224(the)S +5385(Print)S +1248 V +1410(Panel.)S +1416 V +10 B +1260(o)S +10 R +1410(Save)S +1634(saves)S +1880(the)S +2032(region)S +2317(outlined)S +2675(by)S +2805(the)S +2957(marker)S +3269(to)S +3377(the)S +3529(\256le)S +3687(currently)S +4077(con\256gured)S +4534(by)S +4664(the)S +4816(Save)S +5040(Panel.)S +1584 V +10 B +1260(o)S +10 R +1410(Info)S +1606(prints)S +1864(a)S +1938(description)S +2412(of)S +2525(the)S +2677(marked)S +3006(region.)S +3316(The)S +3501(text)S +3681(is)S +3778(printed)S +4091(in)S +4199(the)S +4351(Info)S +4547(Panel.)S +1752 V +10 B +1260(o)S +10 R +1410(Unrotate)S +1789(unrotates)S +2185(a)S +2259(rotated)S +2566(marker.)S +1920 V +10 B +1260(o)S +10 R +1410(Color)S +1668(is)S +1765(a)S +1839(menu)S +2091(of)S +2204(possible)S +2562(marker)S +2874(colors.)S +2088 V +10 B +1260(o)S +10 R +1410(Type)S +1651(is)S +1754(a)S +1834(menu)S +2092(of)S +2211(possible)S +2575(marker)S +2893(types.)S +3165(This)S +3379(is)S +3482(still)S +3669(a)S +3749(little)S +3969(buggy)S +4256(and)S +4437(it)S +4530(isn't)S +4745(very)S +4959(useful,)S +5265(but)S +5430(you)S +2208 V +1410(can)S +1578(use)S +1741(it)S +1827(to)S +1935(play)S +2137(with)S +2345(di)S +2423 H + (f)show 10 -.5 mul h (f)show +10 R +2484(erent)S +2713(types)S +2954(of)S +3067(markers.)S +2376 V +10 B +1260(o)S +10 R +1410(Destroy)S +1760(destroys)S +2127(the)S +2283(marker.)S +2624(You)S +2830(can)S +3002(also)S +3197(hit)S +3337(the)S +3493(delete)S +3766(or)S +3884(backspace)S +4328(key)S +4507(in)S +4620(a)S +4699(marker)S +5016(to)S +5129(destroy)S +5458(the)S +2496 V +1410(marker.)S +2784 V +9 B +1080(RULER)S +1422(MARKERS)S +2904 V +10 R +1260(Holding)S +1629(down)S +1892(the)S +2055(Ctrl)S +2252(key)S +2437(and)S +2622(the)S +2785(Left-Mouse-Button)S +3603(while)S +3866(moving)S +4213(the)S +4376(mouse)S +4678(will)S +4876(drag)S +5095(out)S +5265(a)S +5351("ruler)S +3024 V +1260(marker")S +1622(measuring)S +2077(the)S +2238(distance)S +2604(from)S +2837(the)S +2998(initial)S +3271(point)S +3516(to)S +3633(the)S +3794(current)S +4115(mouse)S +4415(position.)S +4832(Releasing)S +5264(the)S +5424(Ctrl)S +3144 V +1260(key)S +1450(before)S +1750(lifting)S +2041(the)S +2209(mouse)S +2516(button)S +2818(will)S +3020(leave)S +3276(the)S +3444(marker)S +3772(on)S +3918(the)S +4086(display,)S +4446(otherwise)S +4880(it)S +4982(will)S +5185(be)S +5326(erased)S +3264 V +1260(automatically)S +1849(once)S +2082(the)S +2249(mouse)S +2555(button)S +2856(is)S +2968(released.)S +3394(Any)S +3611(number)S +3961(of)S +4088(ruler)S +4320(markers)S +4685(can)S +4867(be)S +5005(created)S +5336(in)S +5458(the)S +3384 V +1260(frame.)S +3624 V +1260(Distances)S +1684(are)S +1841(measured)S +2259(by)S +2395(default)S +2708(in)S +2822(image)S +3102(logical)S +3410(pixels)S +3685(however)S +4064(the)S +4222(Right-Mouse-Button)S +5092(can)S +5266(be)S +5397(used)S +3744 V +1260(inside)S +1529(the)S +1681(marker)S +1993(to)S +2101(popup)S +2381(a)S +2455(menu)S +2707(of)S +2820(options:)S +4032 V +10 B +1260(Sticky)S +10 R +2260(By)S +2430(default)S +2760(rulers)S +3040(are)S +3214(destroyed)S +3655(whenever)S +4095(the)S +4270(display)S +4612(changes)S +4986(due)S +5183(to)S +5314(a)S +5411(pan,)S +4152 V +2260(zoom,)S +2545(\257ip,)S +2742(or)S +2863(frame)S +3133(change.)S +3508(This)S +3724(option)S +4017(will)S +4210(make)S +4463(the)S +4622(ruler)S +4847("sticky")S +5205(so)S +5331(it)S +5424(will)S +4272 V +2260(not)S +2420(be)S +2546(erased,)S +2857(subsequent)S +3333(use)S +3498(of)S +3613(the)S +3767(menu)S +4021(to)S +4132(shows)S +4415(this)S +4593(option)S +4882(to)S +4993(be)S +5120("UnSticky")S +4392 V +2260(to)S +2368(remove)S +2697(this)S +2872(feature.)S +4560 V +10 B +1260(Units)S +10 R +2260(Sub-menu)S +2703(to)S +2813(select)S +3072(the)S +3226(units)S +3453(of)S +3569(the)S +3724(display.)S +4101(If)S +4200(the)S +4355(ISM)S +4566(is)S +4666(enabled)S +5009(and)S +5186(a)S +5263(WCS)S +5513(is)S +4680 V +2260(present)S +2590(in)S +2709(the)S +2872(image)S +3157(and)S +3342(selected)S +3704(as)S +3828(one)S +4013(of)S +4137(the)S +4300(readout)S +4640(options,)S +5001(distances)S +5408(may)S +4800 V +2260(also)S +2467(be)S +2608(read)S +2826(out)S +3001(in)S +3126(units)S +3368(of)S +3498(arcseconds,)S +4007(arcminutes,)S +4517(or)S +4647(degrees)S +4998(instead)S +5328(of)S +5458(the)S +4920 V +2260(default)S +2579(logical)S +2893(pixels.)S +3199(All)S +3369(markers)S +3731(created)S +4059(after)S +4282(the)S +4445(unit)S +4642(change)S +4965(will)S +5162(readout)S +5502(in)S +5040 V +2260(the)S +2412(new)S +2608(units)S +2833(as)S +2946(their)S +3159(default.)S +5208 V +10 B +1260(Color)S +10 R +2260(Select)S +2534(the)S +2686(color)S +2921(of)S +3034(the)S +3186(marker.)S +5376 V +10 B +1260(Draw)S +1528(into)S +1725(Frame)S +10 R +2260(\()S +10 I +2293(Not)S +2495(Yet)S +2680(Implemented)S +10 R +3195(\))S +3315(Draw)S +3593(the)S +3773(marker)S +4113(as)S +4254(overlay)S +4611(graphics)S +5007(in)S +5143(the)S +5323(frame.)S +5496 V +2260(Doing)S +2540(so)S +2659(will)S +2845(retain)S +3102(the)S +3254(marker)S +3566(when)S +3812(printing)S +4159(a)S +4233(hardcopy)S +4634(of)S +4747(the)S +4899(display.)S +5664 V +10 B +1260(Destroy)S +10 R +2260(Destroy)S +2606(the)S +2758(marker.)S +5904 V +2260(The)S +2452(marker)S +2771(can)S +2946(also)S +3144(be)S +3275(destroyed)S +3700(by)S +3837(hitting)S +4136(the)S +4295(Delete)S +4592(or)S +4712(Backspace)S +5176(key)S +5358(while)S +6024 V +2260(the)S +2419(cursor)S +2705(is)S +2809(in)S +2924(the)S +3083(marker.)S +3457(There)S +3726(is)S +3830(presently)S +4233(no)S +4370(way)S +4573(to)S +4688(move)S +4946(the)S +5104(marker)S +5422(to)S +5536(a)S +6144 V +2260(new)S +2456(position)S +2809(in)S +2917(the)S +3069(frame.)S +6432 V +9 B +900(REAL-TIME)S +1447(WCS/PIXEL-VALUE)S +2324(READOUT)S +6552 V +10 R +1260(XImtool)S +1629(now)S +1831(has)S +1994(the)S +2146(ability)S +2433(to)S +2542(display)S +2862(the)S +3015(actual)S +3284(pixel)S +3515(value)S +3762(of)S +3876(an)S +4001(image)S +4276(\(as)S +4423(well)S +4626(as)S +4740(the)S +4893(scaled)S +5173(value)S +5420(pre-)S +6672 V +1260(viously)S +1590(shown\))S +1919(and)S +2098(the)S +2255(cursor)S +2538(position)S +2895(in)S +3007(image)S +3285(WCS)S +3536(values)S +3825(\(e.g.)S +4036(RA/DEC,)S +4462(GLAT/GLONG,)S +5164(etc\).)S +5402(This)S +6792 V +1260(is)S +1358(done)S +1583(using)S +1831(an)S +1956(external)S +2309(task)S +2502(\(the)S +2689('ism_wcspix.e')S +3334(binary)S +3621(in)S +3731(the)S +3885(new)S +4083(distribution\))S +4610(to)S +4720(access)S +5006(the)S +5160(image)S +5436(and)S +6912 V +1260(pass)S +1462(the)S +1614(coordinate/pixel)S +2293(information)S +2795(to)S +2903(the)S +3055(GUI.)S +7152 V +1260(WCS)S +1513(readout)S +1848(is)S +1951(enabled)S +2297(by)S +2433(default)S +2746(but)S +2910(can)S +3084(be)S +3214(toggled)S +3550(or)S +3669(reset)S +3893(using)S +4146(the)S +10 I +4304(WCS/Pix)S +10 R +4702(button)S +4995(on)S +5132(the)S +5291(Coords)S +7272 V +1260(tab)S +1414(in)S +1524(the)S +1678(control)S +1993(panel)S +2241(or)S +2356(the)S +10 I +2510(ISM)S +10 R +2708(toggle)S +2990(on)S +3122(the)S +3276(alt-gui)S +3569(menubar.)S +4005(When)S +4275(enabled,)S +4642(images)S +4957(currently)S +5349(in)S +5458(the)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(11)S +7920 V +EP +%%Page: 12 13 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(server)S +1537(or)S +1654(subsequently)S +2210(displayed)S +2627(will)S +2817(be)S +2945(passed)S +3245(to)S +3357(the)S +3513(external)S +3868(process)S +4201(where)S +4478(they)S +4684(are)S +4839(cached)S +5150(for)S +5301(access.)S +1080 V +1260(Cursor)S +1579(movements)S +2086(generate)S +2469(an)S +2609(event)S +2871(that)S +3067(maps)S +3324(the)S +3492(current)S +3820(frame)S +4098(bu)S +4198 H + (f)show 10 -.5 mul h (f)show +10 R +4259(er)S +4382(position)S +4751(to)S +4875(a)S +4965(position)S +5334(in)S +5458(the)S +1200 V +1260(cached)S +1566(image.)S +1895(The)S +2080(ISM)S +2288(\(ISM)S +2529(is)S +2626(Image)S +2905(Support)S +3252(Module\))S +3626(task)S +3817(then)S +4019(reads)S +4260(the)S +4413(image)S +4688(to)S +4797(determine)S +5227(the)S +5380(pixel)S +1320 V +1260(value)S +1507(\(or)S +1654(a)S +1729(small)S +1977(table)S +2202(of)S +2316(values)S +2602(around)S +2910(the)S +3063(current)S +3376(position\),)S +3787(and)S +3961(computes)S +4374(one)S +4548(or)S +4661(more)S +4896(coordinates)S +5386(from)S +1440 V +1260(the)S +1428(image)S +1718(position.)S +2142(The)S +2343(ISM)S +2567(task)S +2774(also)S +2981(has)S +3160(access)S +3460(to)S +3584(the)S +3752(associated)S +4209(BPM)S +4468(images)S +4798(and)S +4989(can)S +5174(optionally)S +1560 V +1260(return)S +1528(bad)S +1702(pixel)S +1932(information)S +2434(during)S +2725(the)S +2877(cursor)S +3156(readout.)S +1800 V +1260(By)S +1418(default,)S +1761(the)S +1924(logical)S +2237(and)S +2422(world)S +2696(image)S +2981(coordinates)S +3482(are)S +3644(displayed)S +4068(to)S +4187(both)S +4406(the)S +4569(Coords)S +4899(panel)S +5156(readout)S +5497(as)S +1920 V +1260(well)S +1468(as)S +1587(the)S +1745(main)S +1981(display)S +2306(window)S +2664(wcsbox)S +3005(text)S +3191(marker.)S +3564(Alternate)S +3971(coordinate)S +4428(systems)S +4780(\(e.g.)S +4992(transformation)S +2040 V +1260(of)S +1375(equatorial)S +1806(to)S +1916(galactic)S +2258(coordinates)S +2750(or)S +2865(some)S +3108(other)S +3345(sky)S +3516(system,)S +3852(physical)S +4218(coords,)S +4542(ampli\256er)S +4936(coords,)S +5260(etc\))S +5442(can)S +2160 V +1260(be)S +1391(selected)S +1748(for)S +1900(display)S +2225(by)S +2361(hitting)S +2659(the)S +10 I +2817(Options)S +10 R +3170(toggle)S +3456(on)S +3592(the)S +3750(Coords)S +4075(panel.)S +4382(Available)S +4806(coordinate)S +5263(systems)S +2280 V +1260(are)S +1422(chosen)S +1740(using)S +1999(the)S +10 I +2163(Type)S +10 R +2399(menu)S +2663(on)S +2805(the)S +2969(panel,)S +3252(the)S +3416(readout)S +3757(format)S +4065(\(sexigesimal,)S +4637(degrees,)S +5008(etc\))S +5199(using)S +5458(the)S +2400 V +10 I +1260(Format)S +10 R +1591(menu,)S +1869(and)S +2044(the)S +2197(display)S +2517(to)S +2626(the)S +2779(current)S +3092(panel)S +3339(or)S +3453(main)S +3684(image)S +3959(window)S +4311(using)S +4558(the)S +4710(remaining)S +5145(toggles)S +5464(for)S +2520 V +1260(each)S +1478(WCS.)S +1786(Up)S +1944(to)S +2058(four)S +2261(systems)S +2615(may)S +2824(be)S +2955(displayed)S +3375(at)S +3484(one)S +3665(time,)S +3905(the)S +4064(coordinate)S +4522(panel)S +4775(and)S +4956(wcsbox)S +5298(marker)S +2640 V +1260(will)S +1446(adjust)S +1715(size)S +1900(automatically)S +2474(depending)S +2920(on)S +3050(the)S +3202(display.)S +2880 V +1260(By)S +1408(selecting)S +1794(the)S +10 I +1947(BPM)S +2183(Data)S +10 R +2414(toggle)S +2695(from)S +2920(the)S +3073(Coords.Options)S +3735(panel)S +3983(ximtool)S +4327(is)S +4426(able)S +4624(to)S +4734(\257ag)S +4916(pixels)S +5187(in)S +5297(images)S +3000 V +1260(with)S +1474(an)S +1604(associated)S +2050(bad)S +2230(pixel)S +2466(mask.)S +2768(This)S +2982(bad)S +3162(pixel)S +3398(mask)S +3645(is)S +3748(currently)S +4144(assumed)S +4523(to)S +4636(be)S +4765(named)S +5066(in)S +5179(the)S +5336(image)S +3120 V +1260(header)S +1566("BPM")S +1901(keyword)S +2291(by)S +2432(convention.)S +2972(If)S +3080(the)S +3244(cursor)S +3535(passes)S +3832(over)S +4051(a)S +4137(bad)S +4323(pixel)S +4565(in)S +4685(the)S +4849(mask,)S +5127(the)S +5291(Coords)S +3240 V +1260(bpm)S +1487(display)S +1825(as)S +1957(well)S +2178(as)S +2310(the)S +2481(main)S +2730(window)S +3101(wcsbox)S +3455(will)S +3660(change)S +3990(to)S +4116(a)S +4208(red)S +4383(background)S +4902(color.)S +5210(Only)S +5458(the)S +3360 V +1260(Coords)S +1579(display)S +1898(will)S +2084(show)S +2325(the)S +2477(value,)S +2748(any)S +2922(non-zero)S +3306(value)S +3552(will)S +3738(be)S +3862(\257agged)S +4186(with)S +4394(the)S +4546(color)S +4781(change.)S +3600 V +1260(With)S +1490(the)S +1642(ISM)S +1850(enabled)S +2190(the)S +2342(Compass)S +2739(indicator)S +3124(will)S +3310(display)S +3629(a)S +3703(set)S +3844(of)S +3957(arrows)S +4259(showing)S +4629(North-East)S +5098(if)S +5190(a)S +5265(WCS)S +5513(is)S +3720 V +1260(available,)S +1678(otherwise)S +2099(just)S +2277(the)S +2432(current)S +2747(X-Y)S +2957(axes)S +3167(are)S +3321(shown.)S +3669(The)S +3856(pixel)S +4088(table)S +4314(will)S +4502(display)S +4823(actual)S +5093(pixel)S +5325(values)S +3840 V +1260(from)S +1484(the)S +1636(image,)S +1935(with)S +2143(the)S +2295(ISM)S +2503(o)S +2553 H + (f)show 10 -.5 mul h (f)show +10 R +2644(the)S +2796(pixel)S +3026(table)S +3250(displays)S +3608(the)S +3760(scaled)S +4039(image)S +4313(values)S +4598(from)S +4822(the)S +4974(frame)S +5236(bu)S +5336 H + (f)show 10 -.5 mul h (f)show +10 R +5397(er.)S +4128 V +9 B +900(FREEZING)S +1397(CURSOR)S +1804(READOUT)S +4248 V +10 R +1260(Holding)S +1618(down)S +1871(the)S +2024(Alt)S +2183(key)S +2358(will)S +2545(now)S +2748(freeze)S +3021(the)S +3174(cursor)S +3454(display)S +3774(readout)S +4104(and)S +4279(draw)S +4509(crosshairs)S +4939(on)S +5070(the)S +5223(screen)S +5508(at)S +4368 V +1260(the)S +1424(last)S +1605(position.)S +2025(This)S +2245(can)S +2425(be)S +2561(used)S +2786(for)S +2944(example)S +3324(to)S +3444(position)S +3809(the)S +3973(cursor)S +4264(but)S +4434(then)S +4648(allow)S +4912(the)S +5076(cursor)S +5367(to)S +5486(be)S +4488 V +1260(moved)S +1568(to)S +1682(another)S +2017(window)S +2375(\(to)S +2522(enter)S +2757(text,)S +2968(start)S +3176(a)S +3256(program,)S +3655(whatever\))S +4089(without)S +4431(losing)S +4712(the)S +4871(position)S +5231(informa-)S +4608 V +1260(tion)S +1446(displayed)S +1859(on)S +1989(the)S +2141(screen.)S +4896 V +9 B +900(CUT-GRAPHS)S +5016 V +10 R +1260(XImtool)S +1635(now)S +1843(has)S +2013(the)S +2172(ability)S +2465(to)S +2580(display)S +2906(horizontal)S +3348(and)S +3529(vertical)S +3865(cut-graphs)S +4323(of)S +4443(the)S +4602(display,)S +4953(these)S +5195(appear)S +5497(as)S +5136 V +1260("\257ip-out")S +1672(panels)S +1962(that)S +2147(appear)S +2447(on)S +2582(the)S +2739(bottom)S +3058(and)S +3237(right)S +3461(side)S +3656(of)S +3773(the)S +3929(main)S +4163(display)S +4486(window)S +4842(and)S +5020(are)S +5175(controlled)S +5256 V +1260(by)S +1390(the)S +1542(small)S +1789("H")S +1973(and)S +2147("V")S +2331(buttons)S +2656(in)S +2764(the)S +2916(lower)S +3174(right)S +3394(corner)S +3679(of)S +3793(the)S +3946(window.)S +4354(When)S +4623(both)S +4832(panels)S +5118(are)S +5270(enabled)S +5376 V +1260(the)S +1412(corner)S +1696(area)S +1891(of)S +2004(the)S +2156(display)S +2475(also)S +2666(shows)S +2946(an)S +3070(options)S +3395(panel)S +3641(for)S +3787(the)S +3939(graphs.)S +4290(Current)S +4625(options)S +4950(are:)S +5664 V +10 B +1260(Better)S +1555(Speed)S +10 R +2260(Draw)S +2523(the)S +2687(graphics)S +3067(so)S +3198(they)S +3412(update)S +3720(at)S +3834(the)S +3998(fastest)S +4295(possible)S +4665(rate.)S +4912(This)S +5133(is)S +5243(done)S +5480(by)S +5784 V +2260(subsampling)S +2797(pixels)S +3067(to)S +3176(produce)S +3527(a)S +3601(smoother)S +4003(graph)S +4260(but)S +4418(without)S +4754(sacri\256cing)S +5200(too)S +5358(much)S +5904 V +2260(accuracy.)S +6072 V +10 B +1260(Better)S +1555(Accuracy)S +10 R +2260(Draw)S +2520(the)S +2681(graphics)S +3058(using)S +3314(all)S +3453(screen)S +3746(pixels)S +4024(to)S +4141(produce)S +4501(the)S +4662(most)S +4896(accurate)S +5266(display.)S +6192 V +2260(On)S +2427(fast)S +2615(modern)S +2964(machines)S +3385(this)S +3574(can)S +3756(be)S +3894(enabled)S +4248(with)S +4470(no)S +4614(apparent)S +5001(loss)S +5201(of)S +5328(speed,)S +6312 V +2260(however)S +2635(older)S +2873(machines)S +3283(may)S +3488(wish)S +3710(to)S +3821(use)S +3987(this)S +4165(only)S +4376(occassionally)S +4947(to)S +5058(limit)S +5281(any)S +5458(lag)S +6432 V +2260(in)S +2368(the)S +2520(cursor)S +2799(tracking.)S +6600 V +10 B +1260(Image)S +1556(Pixels)S +10 R +2260(\()S +10 I +2293(Not)S +2468(Yet)S +2626(Implemented)S +10 R +3141(\))S +6768 V +10 B +1260(Jump)S +1535(Cursor)S +10 R +2260(If)S +2367(enabled,)S +2743(large)S +2983(jumps)S +3269(of)S +3393(the)S +3556(cursor)S +3846(do)S +3987(not)S +4156(update)S +4463(the)S +4627(graphics)S +5007(display,)S +5363(small)S +6888 V +2260(movements)S +2751(around)S +3058(an)S +3182(object)S +3456(of)S +3569(interest)S +3893(will)S +4079(update)S +4375(the)S +4527(display)S +4846(continuously.)S +7056 V +10 B +1260(Smooth)S +1618(Cursor)S +10 R +2260(If)S +2356(enabled,)S +2721(all)S +2851(cursor)S +3130(movements)S +3621(cause)S +3872(the)S +4024(display)S +4343(to)S +4451(be)S +4575(updated.)S +4976(This)S +5184(is)S +5281(another)S +7176 V +2260(option)S +2550(that)S +2734(can)S +2906(be)S +3034(set)S +3179(safely)S +3451(on)S +3585(faster)S +3840(machines)S +4251(but)S +4412(will)S +4601(cause)S +4855(a)S +4932(delay)S +5181(on)S +5314(slower)S +7296 V +2260(ones.)S +7776 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(12)S +7920 V +EP +%%Page: 13 14 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(Graphics)S +1685(Cursors)S +10 R +2260(If)S +2362(enabled,)S +2733(the)S +2891(graphics)S +3265(cursors)S +3589(in)S +3703(either)S +3966(of)S +4086(the)S +4245(plots)S +4477(are)S +4635(active)S +4910(and)S +5091(can)S +5266(be)S +5397(used)S +1080 V +2260(to)S +2374(update)S +2676(the)S +2834(cursor)S +3119(readout)S +3454(on)S +3590(the)S +3748(main)S +3984(image)S +4264(window)S +4622(and)S +4802(the)S +4959(complementary)S +1200 V +2260(cut-graph.)S +2729(This)S +2939(can)S +3109(be)S +3235(used)S +3450(for)S +3598(example)S +3969(to)S +4080(freeze)S +4355(the)S +4510(cursor)S +4792(in)S +4903(the)S +5058(main)S +5291(display)S +1320 V +2260(using)S +2518(the)S +2681(Alt)S +2850(key)S +3035(\(see)S +3236(above\),)S +3573(then)S +3786(moving)S +4133(to)S +4252(one)S +4437(of)S +4561(the)S +4723(graphics)S +5101(windows)S +5502(to)S +1440 V +2260(perform)S +2611(cut)S +2763(graphs)S +3059(in)S +3167(only)S +3375(one)S +3549(axis.)S +1680 V +2260(Graphs)S +2583(are)S +2739(\(currently\))S +3200(drawn)S +3484(using)S +3736(only)S +3949(the)S +4106(scaled)S +4390(display)S +4714(values)S +5004(to)S +5117(avoid)S +5375(com-)S +1800 V +2260(plications)S +2706(of)S +2846(accessing)S +3285(multiple)S +3675(images)S +4014(in)S +4148(a)S +4248(mosaic)S +4587(display.)S +4957(Both)S +5208(plots)S +5459(are)S +1920 V +2260(labeled)S +2584(using)S +2837(the)S +2995(frame)S +3263(z1/z2)S +3515(values)S +3806(and)S +3986(contain)S +4316(cursor)S +4602(indicators)S +5033(which)S +5314(update)S +2040 V +2260(contuously.)S +2328 V +9 B +900(PEAK-UP)S +1327(CURSOR)S +1734(CENTROID)S +2246(POSITIONING)S +2448 V +10 R +1260(Several)S +1600(new)S +1807(keystroke)S +2236(commands)S +2710(are)S +2872(available)S +3273(to)S +3392(reposition)S +3833(the)S +3996(cursor)S +4286(to)S +4405(a)S +4490(centroid)S +4858(or)S +4982(min/max)S +5380(pixel)S +2568 V +1260(value)S +1515(within)S +1810(a)S +1893(bounding)S +2310(box)S +2499(of)S +2621(the)S +2782(cursor)S +3070(position,)S +3487(allowing)S +3876(you)S +4065(to)S +4182(approximate)S +4720(the)S +4881(position)S +5242(with)S +5458(the)S +2688 V +1260(mouse)S +1556(and)S +1735(\256ne)S +1920(tune)S +2127(it)S +2218(quickly)S +2553(before)S +2842(typing)S +3133(the)S +3290(application)S +3769(keystroke)S +4192(command.)S +4676(The)S +4866(initial)S +5136(box)S +5322(size)S +5513(is)S +2808 V +1260(controlled)S +1696(with)S +1905(a)S +10 I +1980(centerBoxSize)S +10 R +2576(GUI)S +2784(resource)S +3152(\(defaults)S +3531(to)S +3639(5)S +3719(pixels\))S +4021(but)S +4179(can)S +4347(be)S +4471(adjusted)S +4834(interactively)S +5363(using)S +2928 V +1260(the)S +10 B +1429(Ctrl-[)S +10 R +1719(and)S +10 B +1910(Ctrl-])S +10 R +2200(commands)S +2680(to)S +2805(descrease/increase)S +3587(the)S +3756(box)S +3953(size)S +4155(respectively.)S +4739(A)S +4858(marker)S +5187(will)S +5391(\257ash)S +3048 V +1260(brie\257y)S +1551(to)S +1659(indicate)S +2005(the)S +2157(box)S +2337(size.)S +3288 V +1260(The)S +10 B +1454(Ctrl-0)S +10 R +1754(\(zero\))S +2031(key)S +2215(\256nds)S +2450(either)S +2717(a)S +2801(centroid)S +3168(or)S +3291(the)S +3453(local)S +3687(maximum)S +4133(pixel)S +4373(value)S +4629(within)S +4925(this)S +5110(box)S +5300(region,)S +3408 V +10 B +1260(Alt-Ctrl-0)S +10 R +1724(\(zero\))S +1999(will)S +2193(\256nd)S +2387(the)S +2547(local)S +2779(minimum)S +3207(value.)S +3516(In)S +3637(either)S +3902(case)S +4111(the)S +4271(cursor)S +4558(is)S +4663(reposition)S +5101(to)S +5216(the)S +5375(com-)S +3528 V +1260(puted)S +1520(value.)S +1829(The)S +2022(default)S +2337(peak-up)S +2696(action)S +2978(is)S +3083(to)S +3199(\256nd)S +3393(the)S +3553(centroid)S +3918(position)S +4279(in)S +4395(the)S +4555(box)S +4743(however)S +5125(this)S +5309(can)S +5486(be)S +3648 V +1260(changed)S +1633(to)S +1751(\256nd)S +1947(the)S +2109(max)S +2321(pixel)S +2561(by)S +2701(selection)S +3096(the)S +3258(")S +10 I +3299(Centroid)S +3695(Peaks)S +10 R +3933(")S +4014(option)S +4310(from)S +4544(the)S +4706(main)S +4946(Display)S +5297(control)S +3768 V +1260(panel)S +1506(or)S +1619(by)S +1749(resetting)S +2123(the)S +10 I +2275(peakCentroid)S +10 R +2849(GUI)S +3056(resource)S +3423(\(defaults)S +3802(to)S +3910(True\).)S +4008 V +1260(Centroiding)S +1785(is)S +1899(done)S +2140(using)S +2404(only)S +2629(the)S +2798(scaled)S +3094(screen)S +3395(pixel)S +3642(values)S +3944(and)S +4135(only)S +4360(pixels)S +4646(above)S +4931(the)S +5100(mean)S +5364(value)S +4128 V +1260(within)S +1561(the)S +1728(box)S +1923(are)S +2089(used.)S +2372(It)S +2478(works)S +2767(best)S +2973(if)S +3078(the)S +3244(box)S +3438(size)S +3637(is)S +3748(set)S +3903(appropriately,)S +4504(the)S +4670(centroid)S +5041(position)S +5408(may)S +4248 V +1260(appear)S +1555(to)S +1663(drift)S +1865(if)S +1956(the)S +2108(box)S +2288(is)S +2385(too)S +2543(large)S +2772(and)S +2946(includes)S +3309(too)S +3467(many)S +3719(background)S +4220(pixels.)S +4536 V +9 B +1080(Command)S +1512(Summary)S +4656 V +10 B +1260(Ctrl-0)S +1550(\(zero\))S +10 R +2260(Reposition)S +2724(to)S +2832(centroid/max-pixel)S +4764 V +10 B +1260(Alt-Ctrl-0)S +1716(\(zero\))S +10 R +2260(Reposition)S +2724(to)S +2832(min-pixel)S +4872 V +10 B +1260(Ctrl-[)S +10 R +2260(Decrease)S +2654(centering)S +3055(box)S +3235(size)S +3420(\(min)S +3639(of)S +3752(5\))S +4980 V +10 B +1260(Ctrl-])S +10 R +2260(Increase)S +2621(centering)S +3022(box)S +3202(size)S +5268 V +9 B +1080(Resource)S +1462(Summary)S +5388 V +10 B +1260(peakCentroid)S +1879(=)S +1966(True)S +10 R +2260(Compute)S +2671(the)S +2837(box)S +3032(centroid)S +3404(position,)S +3797(a)S +3886('False')S +4208(value)S +4469(force)S +4718(the)S +4885(max)S +5102(value)S +5363(to)S +5486(be)S +5508 V +2260(used)S +5616 V +10 B +1260(centerBoxSize)S +1894(=)S +1981(5)S +10 R +2260(Size)S +2462(of)S +2575(the)S +2727(centroid)S +3084(box,)S +3289(used)S +3502(as)S +3615(cursor)S +3894(position)S +4247(+/-)S +4394(this)S +4569(value)S +5904 V +9 B +900(AUTO-REGISTRATION)S +1917(OF)S +2069(IMAGES)S +6024 V +10 R +1260(The)S +1451(auto-register)S +1991(feature)S +2303(allows)S +2600(you)S +2786(specify)S +3111(a)S +3192(registration)S +3684(of)S +3804(two)S +3991(or)S +4111(more)S +4353(display)S +4679(frames)S +4987(with)S +5202(an)S +5333(o)S +5383 H + (f)show 10 -.5 mul h (f)show +10 R +5444(set.)S +6144 V +1260(When)S +1538(enabled,)S +1913(this)S +2098(registration)S +2593(is)S +2700(maintained)S +3184(for)S +3340(all)S +3480(frames)S +3791(in)S +3909(the)S +4071(list)S +4234(if)S +4335(any)S +4519(one)S +4703(of)S +4825(them)S +5064(is)S +5170(panned)S +5497(or)S +6264 V +1260(zoomed)S +1606(to)S +1714(a)S +1788(new)S +1984(location)S +2336(in)S +2444(the)S +2596(frame)S +2858(bu)S +2958 H + (f)show 10 -.5 mul h (f)show +10 R +3019(er.)S +6504 V +1260(For)S +1429(example,)S +1822(to)S +1930(use)S +2093(this)S +2268(feature)S +2574(do)S +2704(the)S +2856(following:)S +6672 V +10 B +1620(1\))S +10 R +1870(Enable)S +2201(Auto-Register)S +2821(\(either)S +3135(on)S +3289(the)S +3465(Control)S +3825(Panel)S +4102(or)S +4240(the)S +4417(toolbar)S +4755(on)S +4910(the)S +5087(alt-gui\))S +5436(and)S +6792 V +1870(pan/zoom)S +2294(to)S +2402(some)S +2643(star)S +2817(of)S +2930(interest.)S +6960 V +10 B +1620(2\))S +10 R +1870(Use)S +2055(Mouse-Button-2)S +2746(to)S +2854(center)S +3127(the)S +3279(star)S +3453(in)S +3561(the)S +3713(frame.)S +7128 V +10 B +1620(3\))S +10 R +1870(Cycle)S +2134(through)S +2476(the)S +2629(frames)S +2931(and)S +3106(you)S +3287(may)S +3490(see)S +3648(a)S +3723(small)S +3971(shift)S +4180(of)S +4294(the)S +4447(star.)S +4677(For)S +4847(each)S +5061(frame,)S +5380(posi-)S +7248 V +1870(tion)S +2063(the)S +2222(cursor)S +2508(on)S +2644(the)S +2802(star)S +2982(and)S +3162(type)S +10 B +3370(Ctrl-o)S +10 R +3666(to)S +3780(o)S +3830 H + (f)show 10 -.5 mul h (f)show +10 R +3891(set)S +4038(it)S +4130(to)S +4244(the)S +4402(center.)S +4736(Repeat)S +5049(as)S +5168(necessary.)S +7728 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(13)S +7920 V +EP +%%Page: 14 15 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1870(Small)S +2141(corrections)S +2621(will)S +2814(be)S +2945(cumulatively)S +3504(added)S +3779(so)S +3905(you)S +4092(can)S +4267(use)S +4437(the)S +10 B +4597(Ctrl-0)S +10 R +4895(\(Ctrl-zero\))S +5359(peak-)S +1080 V +1870(up)S +2000(command)S +2424(to)S +2532(centroid)S +2889(each)S +3101(object)S +3375(in)S +3483(the)S +3635(frame)S +3897(before)S +4181(the)S +10 B +4333(Ctrl-o)S +10 R +4623(o)S +4673 H + (f)show 10 -.5 mul h (f)show +10 R +4734(set.)S +1248 V +10 B +1620(4\))S +10 R +1870(Pan)S +2054(around)S +2365(the)S +2521(image)S +2799(in)S +2911(one)S +3089(display)S +3412(frame,)S +3703(then)S +3909(switch)S +4204(frames)S +4509(and)S +4688(the)S +4845(new)S +5046(frame)S +5313(should)S +1368 V +1870(also)S +2061(be)S +2185(panned)S +2503(to)S +2611(the)S +2763(new)S +2959(image)S +3233(with)S +3441(the)S +3593(proper)S +3883(o)S +3933 H + (f)show 10 -.5 mul h (f)show +10 R +3994(set.)S +1536 V +10 B +1620(5\))S +10 R +1870(A)S +10 B +1995(Ctrl-a)S +10 R +2308(command)S +2755(will)S +2964(toggle)S +3267(the)S +3443(feature,)S +3798(o)S +3848 H + (f)show 10 -.5 mul h (f)show +10 R +3909(sets)S +4113(are)S +4288(only)S +4520(allowed)S +4890(when)S +5160(autoreg)S +5513(is)S +1656 V +1870(enabled.)S +1824 V +1260(Hitting)S +10 B +1577(Register)S +10 R +1964(will)S +2153(zero)S +2357(the)S +2512(o)S +2562 H + (f)show 10 -.5 mul h (f)show +10 R +2623(sets,)S +2831(as)S +2947(will)S +3136(toggling)S +3503(the)S +3658(auto-register)S +4195(function.)S +4617(What)S +4867(you)S +5051(should)S +5352(see)S +5513(is)S +1944 V +1260(the)S +1414(object)S +1690(centered)S +2059(in)S +2169(the)S +2323(frame)S +2587(and)S +2763(as)S +2878(you)S +3060(blink)S +3298(through)S +3641(it)S +3729(remains)S +4077(registered)S +4502(but)S +4662(the)S +4815(panner)S +5117(box)S +5298(marker)S +2064 V +1260(is)S +1367(moving)S +1713(around.)S +2085(Drag)S +2324(the)S +2486(panner)S +2797(around)S +3114(and)S +3298(all)S +3438(frames)S +3749(still)S +3940(remain)S +4257(registered)S +4690(with)S +4908(the)S +5070(given)S +5333(o)S +5383 H + (f)show 10 -.5 mul h (f)show +10 R +5444(set.)S +2184 V +1260(The)S +1445(control/info)S +1947(panels)S +2232(now)S +2434(display)S +2753(what)S +2977(the)S +3129(o)S +3179 H + (f)show 10 -.5 mul h (f)show +10 R +3240(set)S +3381(is)S +3478(for)S +3624(each)S +3836(frame.)S +2424 V +1260(The)S +1451(register)S +1786(display)S +2111(list)S +2270(is)S +2373(shared)S +2669(with)S +2883(the)S +3041(blink)S +3283(list)S +3442(and)S +3622(can)S +3796(be)S +3926(set)S +4074(using)S +4328(the)S +4487(Display)S +4835(control)S +5155(panel.)S +5463(By)S +2544 V +1260(default)S +1574(all)S +1711(frames)S +2019(are)S +2177(included)S +2558(in)S +2673(the)S +2832(list.)S +3047(For)S +3222(accessing)S +3640(more)S +3881(than)S +4089(four)S +4291(frames,)S +4623(use)S +4792(the)S +4950(box)S +5136(icon)S +5344(in)S +5458(the)S +2664 V +1260(Blink/Register)S +1876(box)S +2058(of)S +2173(the)S +2327(Display)S +2670(control)S +2985(panel)S +3233(to)S +3343(bring)S +3586(up)S +3718(a)S +3794(new)S +3992(window)S +4346(with)S +4556(access)S +4843(to)S +4954(all)S +5087(16)S +5220(available)S +2784 V +1260(frames.)S +3072 V +9 B +1080(Command)S +1512(Summary)S +3192 V +10 B +1260(Ctrl-o)S +10 R +2260(Set)S +2418(the)S +2570(registration)S +3055(o)S +3105 H + (f)show 10 -.5 mul h (f)show +10 R +3166(set)S +3307(from)S +3531(center)S +3300 V +10 B +1260(Ctrl-a)S +10 R +2260(Toggle)S +2573(the)S +2725(Auto-Register)S +3321(feature)S +3588 V +9 B +900(CONTROL)S +1382(PANEL)S +3708 V +10 R +1260(XImtool)S +1636(has)S +1806(a)S +1887(control)S +2207(panel)S +2460(which)S +2741(can)S +2917(be)S +3049(used)S +3270(to)S +3386(exercise)S +3750(most)S +3983(of)S +4104(the)S +4264(capabilities)S +4757(the)S +4917(program)S +5293(has)S +5464(for)S +3828 V +1260(image)S +1544(display.)S +1928(The)S +2123(control)S +2445(panel)S +2700(can)S +2877(be)S +3010(accessed)S +3397(either)S +3663(via)S +3824(the)S +10 B +3985(Options)S +10 R +4364(menu)S +4625(from)S +4858(the)S +5019(main)S +5258(window)S +3948 V +1260(menubar,)S +1666(or)S +1781(by)S +1913(pressing)S +2278(the)S +2432(leftmost)S +2792(button)S +3080(in)S +3190(the)S +3344(row)S +3531(of)S +3646(buttons)S +3973(at)S +4078(the)S +4233(upper)S +4493(right)S +4715(side)S +4909(of)S +5025(the)S +5180(display)S +5502(in)S +4068 V +1260(the)S +1416(standard)S +1788(GUI)S +1999(\(in)S +2144(the)S +2299(alternate)S +2675(GUI)S +2885(the)S +10 I +3040(Control)S +3385(Bar)S +10 R +3568(accessed)S +3949(by)S +4082(the)S +4237(rightmost)S +4654(button)S +4943(on)S +5076(the)S +5231(menubar)S +4188 V +1260(provides)S +1634(widgets)S +1975(for)S +2121(selecting)S +2506(the)S +2658(desired)S +2976(control)S +3289(panel\).)S +4428 V +1260(The)S +1455(separate)S +1821(windows)S +2222(previously)S +2684(used)S +2907(for)S +3063(Control/Print/Load/Save/etc)S +4231(have)S +4459(now)S +4671(been)S +4899(integrated)S +5339(into)S +5536(a)S +4548 V +1260(single)S +1535(window)S +1893(with)S +2107(the)S +2265(appropriate)S +2755(control)S +3074(panel)S +3326(selectable)S +3755(with)S +3969(a)S +4049(Tab)S +4240(widget.)S +4603(There)S +4871(are)S +5028(also)S +5224(new)S +5425(Tab)S +4668 V +1260(panels)S +1547(for)S +1696(setting)S +1996(the)S +2151(frame)S +2416(tile)S +2577(con\256guration)S +3143(\(see)S +3336(below\),)S +3671(more)S +3909(detailed)S +4258(information)S +4763(on)S +4896(the)S +5051(server)S +5327(status,)S +4788 V +1260(and)S +1434(selecting)S +1819(the)S +1971(WCS)S +2218(readout)S +2547(options)S +2872(\(see)S +3062(below\).)S +5076 V +9 B +1080(VIEW)S +1357(CONTROLS)S +5196 V +10 R +1260(The)S +10 B +1452(Frame)S +1771(box)S +10 R +1964(will)S +2157(list)S +2317(only)S +2532(the)S +2692(frame)S +2962(bu)S +3062 H + (f)show 10 -.5 mul h (f)show +10 R +3123(ers)S +3277(you)S +3465(currently)S +3863(have)S +4089(de\256ned.)S +4476(Currently,)S +4922(the)S +5082(only)S +5298(way)S +5502(to)S +5316 V +1260(destroy)S +1591(a)S +1672(frame)S +1941(bu)S +2041 H + (f)show 10 -.5 mul h (f)show +10 R +2102(er)S +2216(is)S +2320(to)S +2435(change)S +2754(the)S +2913(frame)S +3182(bu)S +3282 H + (f)show 10 -.5 mul h (f)show +10 R +3343(er)S +3457(con\256guration,)S +4052(new)S +4255(frame)S +4524(bu)S +4624 H + (f)show 10 -.5 mul h (f)show +10 R +4685(ers)S +4838(\(up)S +5008(to)S +5123(16\))S +5293(will)S +5486(be)S +5436 V +1260(created)S +1586(automatically)S +2169(if)S +2269(requested)S +2690(by)S +2829(the)S +2990(client.)S +3306(The)S +3500(number)S +3845(of)S +3968(frame)S +4240(bu)S +4340 H + (f)show 10 -.5 mul h (f)show +10 R +4401(ers)S +4557(created)S +4884(at)S +4996(startup)S +5308(can)S +5486(be)S +5556 V +1260(controlled)S +1695(using)S +1942(the)S +10 I +2094(-nframes)S +10 R +2479(command-line)S +3086(switch)S +3377(or)S +3490(the)S +10 I +3642(defNFrames)S +10 R +4166(resource.)S +5796 V +1260(The)S +10 B +1455(text)S +1655(display)S +10 R +2002(window)S +2364(gives)S +2615(the)S +2777(\256eld)S +2995(X,Y)S +3204(center,)S +3513(X,Y)S +3723(scale)S +3963(factors,)S +4300(the)S +4463(X,Y)S +4673(zoom)S +4936(factors,)S +5273(and)S +5458(the)S +5916 V +1260(frame)S +1538(o)S +1588 H + (f)show 10 -.5 mul h (f)show +10 R +1649(set)S +1806(used)S +2035(in)S +2159(Auto-Registration.)S +2952(The)S +3152(scale)S +3396(factor)S +3673(and)S +3862(the)S +4029(zoom)S +4296(factor)S +4573(will)S +4774(be)S +4913(the)S +5080(same)S +5330(unless)S +6036 V +10 I +1260(autoscale)S +10 R +1685(is)S +1794(enabled.)S +2171(The)S +2368(scale)S +2610(is)S +2720(in)S +2841(units)S +3079(of)S +3205(display)S +3537(pixels)S +3819(per)S +3989(frame)S +4264(bu)S +4364 H + (f)show 10 -.5 mul h (f)show +10 R +4425(er)S +4545(pixel,)S +4813(and)S +5000(is)S +5110(an)S +5247(absolute)S +6156 V +1260(measure)S +1629(\(it)S +1755(doesn't)S +2086(matter)S +2377(whether)S +2734(or)S +2853(not)S +3017(autoscale)S +3424(is)S +3527(enabled\).)S +3931(Zoom)S +4206(is)S +4309(relative)S +4644(to)S +4758(the)S +4916(autoscale)S +5323(factor,)S +6276 V +1260(which)S +1534(is)S +1631(1.0)S +1786(if)S +1877(autoscaling)S +2362(is)S +2459(disabled.)S +2847(This)S +3055(information)S +3557(is)S +3654(also)S +3845(presented)S +4257(in)S +4365(the)S +4517(Info)S +4713(panel.)S +6516 V +1260(The)S +1446(numbers)S +1821(in)S +1930(the)S +10 B +2083(Zoom)S +2364(box)S +10 R +2551(are)S +2703(zoom)S +2956(factors.)S +3283(Blue)S +3503(numbers)S +3878(zoom,)S +4156(red)S +4314(numbers)S +4689(dezoom.)S +10 I +5061(Zoom)S +5321(In)S +10 R +5436(and)S +6636 V +10 I +1260(Zoom)S +1526(Out)S +10 R +1714(may)S +1924(be)S +2055(used)S +2275(to)S +2390(go)S +2527(to)S +2642(larger)S +2911(or)S +3031(smaller)S +3362(zoom)S +3621(factors,)S +3954(e.g.)S +10 I +4135(Ctrl-5)S +10 R +4417(followed)S +4809(by)S +4946("Zoom)S +5263(In")S +5424(will)S +6756 V +1260(get)S +1421(you)S +1610(to)S +1727(zoom)S +1988(factor)S +2259(10.)S +2453(Speci\256c)S +2814(zoom)S +3075(factors)S +3385(may)S +3596(also)S +3796(be)S +3929(accessed)S +4316(directly)S +4660(as)S +4782(Control)S +5128(keystrokes,)S +6876 V +1260(e.g.)S +1448(Ctrl-5)S +1731(will)S +1931(set)S +2086(zoom)S +2352(factor)S +2628(5.)S +10 I +2747(Center)S +10 R +3063(centers)S +3389(the)S +3555(\256eld.)S +10 I +3832(Toggle)S +4154(Zoom)S +10 R +4426(toggles)S +4758(between)S +5133(the)S +5298(current)S +6996 V +1260(zoom/center)S +1783(values,)S +2093(and)S +2267(the)S +2419(unzoomed)S +2865(image.)S +7236 V +10 I +1260(Aspect)S +10 R +1564(recomputes)S +2062(the)S +2222(view)S +2454(so)S +2581(that)S +2769(the)S +2929(aspect)S +3217(ratio)S +3439(is)S +3545(1.0.)S +3734(Aspect)S +4050(also)S +4250(integerizes)S +4721(the)S +4882(zoom)S +5143(factor)S +5414(\(use)S +7716 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(14)S +7920 V +EP +%%Page: 15 16 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(the)S +1412(version)S +1736(in)S +1844(the)S +1996(View)S +2242(menu)S +2494(if)S +2585(you)S +2765(don't)S +3006(want)S +3230(integerization\).)S +1200 V +10 I +1260(Fit)S +1408(Frame)S +10 R +1706(makes)S +1993(the)S +2147(display)S +2468(window)S +2822(the)S +2976(same)S +3213(size)S +3400(as)S +3515(the)S +3669(frame)S +3933(bu)S +4033 H + (f)show 10 -.5 mul h (f)show +10 R +4094(er.)S +4228(Note)S +4454(that)S +4636(autoscale)S +5039(has)S +5204(much)S +5458(the)S +1320 V +1260(same)S +1499(e)S +1543 H + (f)show 10 -.5 mul h (f)show +10 R +1604(ect,)S +1779(and)S +1957(allows)S +2252(you)S +2436(to)S +2548(resize)S +2814(the)S +2970(display)S +3293(window)S +3649(to)S +3761(any)S +3938(size)S +4126(you)S +4309(want,)S +4561(or)S +4677(view)S +4904(images)S +5220(too)S +5381(large)S +1440 V +1260(to)S +1368(\256t)S +1482(on)S +1612(the)S +1764(screen.)S +1728 V +9 B +1080(ENHANCEMENT)S +1827(CONTROLS)S +1848 V +10 R +1260(At)S +1398(the)S +1558(top)S +1724(is)S +1829(a)S +1911(scrolled)S +2265(list)S +2426(of)S +2547(all)S +2685(the)S +2845(available)S +3243(colormaps.)S +3722(Click)S +3977(on)S +4115(the)S +4275(one)S +4457(you)S +4645(want)S +4878(to)S +4995(load.)S +5231(You)S +5442(can)S +1968 V +1260(add)S +1447(your)S +1673(own)S +1888(colormaps)S +2347(to)S +2468(this)S +2656(list)S +2822(by)S +2965(de\256ning)S +3336(the)S +10 I +3501(cmap[12])S +10 R +3938(or)S +10 I +4063(cmapDir[12])S +10 R +4638(command)S +5074(line)S +5266(\257ags)S +5497(or)S +2088 V +1260(application)S +1734(resources.)S +2328 V +1260(The)S +1451(two)S +1637(sliders)S +1934(adjust)S +2209(the)S +2367(contrast)S +2719(\(upper)S +3015(slider\))S +3306(and)S +3486(brightness)S +3933(\(lower)S +4229(slider\))S +4520(of)S +4640(the)S +4799(display.)S +5150(The)S +10 I +5342(Invert)S +2448 V +10 R +1260(button)S +1549(inverts)S +1854(the)S +2009(colormap)S +2419(\(multiples)S +2858(the)S +3013(contrast)S +3362(by)S +3495(-1.0\).)S +3744(Note)S +3971(that)S +4154(due)S +4331(to)S +4442(the)S +4597(use)S +4763(of)S +4879(the)S +5033(private)S +5342(color-)S +2568 V +1260(map)S +1464(the)S +1618(sliders)S +1911(are)S +2064(a)S +2140(bit)S +2278(sluggish)S +2644(when)S +2892(dragged)S +3245(to)S +3355(window)S +3709(the)S +3863(display.)S +4209(If)S +4307(this)S +4484(is)S +4583(annoying,)S +5013(using)S +5263(MB3)S +5502(in)S +2688 V +1260(the)S +1412(display)S +1731(window)S +2083(is)S +2180(faster.)S +2928 V +1260(The)S +10 I +1454(Normalize)S +10 R +1910(button)S +2205(\(on)S +2377(the)S +2538(bottom)S +2861(of)S +2983(the)S +3145(control)S +3468(panel\))S +3757(will)S +3953(normalize)S +4392(the)S +4554(enhancement,)S +5145(i.e.)S +5307(set)S +5458(the)S +3048 V +1260(contrast)S +1613(and)S +1794(brightness)S +2242(to)S +2357(the)S +2516(default)S +2830(one-to-one)S +3299(values)S +3590(\(1.0,)S +3809(0.5\).)S +4028(This)S +4242(is)S +4345(the)S +4503(preferred)S +4903(setting)S +5206(for)S +5358(many)S +3168 V +1260(of)S +1381(the)S +1541(pseudocolor)S +2067(colortables)S +2543(and)S +2725(for)S +2879(private)S +3194(colormaps)S +3648(loaded)S +3952(from)S +4184(disk)S +4389(images.)S +4735(The)S +10 I +4929(Initialize)S +10 R +5324(button)S +3288 V +1260(does)S +1473(a)S +1547(reset)S +1765(of)S +1878(the)S +2030(server.)S +3576 V +9 B +1080(BLINK)S +1397(CONTROLS)S +3696 V +10 I +1260(Blink)S +1503(frames)S +10 R +1807(is)S +1907(the)S +2062(list)S +2218(of)S +2334(frames)S +2638(to)S +2749(be)S +2876(blinked.)S +3234(When)S +3505(blink)S +3744(mode)S +3999(is)S +4099(in)S +4210(e)S +4254 H + (f)show 10 -.5 mul h (f)show +10 R +4315(ect)S +4464(ximtool)S +4809(just)S +4987(cycles)S +5269(through)S +3816 V +1260(these)S +1498(frames)S +1802(endlessly,)S +2232(pausing)S +2576("blink)S +2856(rate")S +3079(seconds)S +3428(between)S +3793(each)S +4008(frame.)S +4298(The)S +4486(same)S +4724(frame)S +4989(can)S +5160(be)S +5287(entered)S +3936 V +1260(in)S +1369(the)S +1523(list)S +1678(more)S +1915(than)S +2119(once.)S +2394(To)S +2537(program)S +2907(an)S +3033(arbitrary)S +3408(list)S +3563(of)S +3678(blink)S +3916(frames,)S +4244(hit)S +4382(the)S +4536(Reset)S +4790(button)S +5078(and)S +5254(click)S +5480(on)S +4056 V +1260(each)S +1479(blink)S +1722(frame)S +1991(button)S +2284(until)S +2505(it)S +2597(is)S +2700(set)S +2847(to)S +2961(the)S +3119(desired)S +3443(frame)S +3711(number.)S +4107(The)S +4298(main)S +4534(control)S +4853(panel)S +5105(allows)S +5402(only)S +4176 V +1260(the)S +1416(original)S +1761(four)S +1961(frames)S +2266(to)S +2378(be)S +2506(speci\256ed)S +2895(in)S +3007(the)S +3163(blink)S +3403(list,)S +3585(however)S +3962(access)S +4250(to)S +4362(the)S +4518(full)S +4691(list)S +4849(of)S +4967(16)S +5102(frames)S +5408(now)S +4296 V +1260(supported)S +1684(is)S +1781(gained)S +2077(using)S +2324(the)S +2476(box)S +2656(icon)S +2858(button)S +3144(next)S +3346(the)S +3498(the)S +10 I +3650(Reset)S +10 R +3896(button)S +4182(to)S +4290(bring)S +4531(up)S +4661(a)S +4735(new)S +4931(control)S +5244(panel.)S +4536 V +1260(The)S +10 I +1455(Blink)S +1706(Rate)S +10 R +1929(can)S +2107(be)S +2242(adjusted)S +2616(as)S +2740(slow)S +2970(or)S +3094(as)S +3218(fast)S +3403(as)S +3527(you)S +3718(want)S +3953(using)S +4211(the)S +4374(arrow)S +4647(buttons.)S +5008(If)S +5115(you)S +5306(set)S +5458(the)S +4656 V +1260(blink)S +1496(rate)S +1675(small)S +1922(enough)S +2246(it)S +2332(will)S +2518(go)S +2648(to)S +2756(zero,)S +2982(enabling)S +3356(single)S +3625(step)S +3816(mode)S +4068(\(see)S +4258(below\).)S +4896 V +1260(The)S +10 I +1449(Register)S +10 R +1816(button)S +2106(registers)S +2478(all)S +2612(the)S +2768(blink)S +3008(frames)S +3313(with)S +3525(the)S +3681(current)S +3997(display)S +4320(frame.)S +4612(Frames)S +4941(not)S +5104(in)S +5217(the)S +5374(blink)S +5016 V +1260(list)S +1413(are)S +1564(not)S +1722(a)S +1766 H + (f)show 10 -.5 mul h (f)show +10 R +1827(ected.)S +5256 V +1260(The)S +10 I +1446(Match)S +1732(LUTs)S +10 R +1986(button)S +2273(sets)S +2454(the)S +2607(enhancement)S +3164(of)S +3278(all)S +3409(blink)S +3646(frames)S +3948(to)S +4057(the)S +4210(same)S +4446(values)S +4733(as)S +4848(the)S +5002(display)S +5323(frame.)S +5376 V +1260(Frames)S +1584(not)S +1742(in)S +1850(the)S +2002(blink)S +2238(list)S +2391(are)S +2542(not)S +2700(a)S +2744 H + (f)show 10 -.5 mul h (f)show +10 R +2805(ected.)S +5616 V +1260(The)S +10 I +1453(Blink)S +10 R +1702(button)S +1996(turns)S +2234(blink)S +2478(on)S +2616(and)S +2799(o)S +2849 H + (f)show 10 -.5 mul h (f)show +10 R +2910(.)S +2974(When)S +3251(the)S +3412(blink)S +3657(rate)S +3845(is)S +3951(set)S +4101(to)S +4218(zero)S +4428(the)S +4589(Blink)S +4851(button)S +5146(will)S +5341(single)S +5736 V +1260(step)S +1451(through)S +1792(the)S +1944(blink)S +2180(frames,)S +2506(one)S +2680(frame)S +2942(per)S +3099(button)S +3385(press.)S +5976 V +10 B +1260(NOTE:)S +10 R +1615(You)S +1825(can)S +2001(blink)S +2245(no)S +2383(matter)S +2677(what)S +2910(ximtool)S +3261(options)S +3595(are)S +3755(in)S +3872(e)S +3916 H + (f)show 10 -.5 mul h (f)show +10 R +3977(ect,)S +4157(but)S +4324(many)S +4585(of)S +4707(these)S +4951(will)S +5146(slow)S +5374(blink)S +6096 V +1260(down.)S +1541(To)S +1686(get)S +1842(the)S +1998(fastest)S +2287(blink)S +2527(you)S +2711(may)S +2917(want)S +3145(to)S +3257(turn)S +3451(o)S +3501 H + (f)show 10 -.5 mul h (f)show +10 R +3595(the)S +3750(panner)S +4054(and)S +4231(coords)S +4530(box,)S +4738(and)S +4915(match)S +5192(the)S +5347(LUTs)S +6216 V +1260(of)S +1382(all)S +1521(the)S +1682(blink)S +1927(frames.)S +2292(All)S +2459(the)S +2620(ximtool)S +2971(controls)S +3332(are)S +3492(fully)S +3721(active)S +3999(during)S +4300(blink)S +4546(mode,)S +4833(plus)S +5040(you)S +5230(can)S +5408(load)S +6336 V +1260(frames)S +1561(etc.)S +6624 V +9 B +1080(OPTIONS:)S +6744 V +10 B +1260(Panner)S +6864 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(Panner)S +3099(marker.)S +7032 V +10 B +1260(Magni\256er)S +7152 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(Magni\256er)S +3216(marker.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(15)S +7920 V +EP +%%Page: 16 17 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(Coords)S +1601(Box)S +1080 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(coordinate)S +3243(box)S +3423(marker.)S +1248 V +10 B +1260(Autoscale)S +1368 V +10 R +1510(If)S +1613(autoscale)S +2021(is)S +2126(enabled)S +2474(then)S +2684(at)S +2794(zoom=1,)S +3185(the)S +3345(frame)S +3615(bu)S +3715 H + (f)show 10 -.5 mul h (f)show +10 R +3776(er)S +3891(will)S +4085(be)S +4217(automatically)S +4799(scaled)S +5086(to)S +5202(\256t)S +5324(within)S +1488 V +1510(the)S +1667(display)S +1991(window.)S +2373(With)S +2608(autoscale)S +3014(disabled)S +3382(\(the)S +3572(default\),)S +3942(the)S +4099(image)S +4377(scale)S +4610(is)S +4711(more)S +4950(predictable,)S +5452(but)S +1608 V +1510(the)S +1662(image)S +1936(may)S +2138(be)S +2262(clipped)S +2586(by)S +2716(the)S +2868(display)S +3187(window,)S +3564(or)S +3677(may)S +3879(not)S +4037(\256ll)S +4179(the)S +4331(display)S +4650(window.)S +1776 V +10 B +1260(Antialias)S +1896 V +10 R +1510(When)S +1780(dezooming)S +2257(an)S +2384(image,)S +2686(i.e.,)S +2866(displaying)S +3316(a)S +3393(large)S +3625(image)S +3902(in)S +4013(a)S +4090(smaller)S +4417(display)S +4739(window,)S +5119(antialiasing)S +2016 V +1510(causes)S +1802(all)S +1933(the)S +2086(data)S +2283(to)S +2392(be)S +2517(used)S +2731(to)S +2840(compute)S +3215(the)S +3368(displayed)S +3782(image.)S +4082(If)S +4179(antialiasing)S +4671(is)S +4769(disabled)S +5133(then)S +5336(image)S +2136 V +1510(is)S +1607(subsampled)S +2109(to)S +2217(compute)S +2592(the)S +2745(displayed)S +3159(image.)S +3459(Antialiasing)S +3979(can)S +4148(prevent)S +4478(subsampling)S +5015(from)S +5240(omitting)S +2256 V +1510(image)S +1792(features)S +2145(that)S +2333(don't)S +2582(fall)S +2753(in)S +2869(the)S +3028(sample)S +3348(grid,)S +3571(but)S +3736(it)S +3829(is)S +3933(signi\256cantly)S +4465(slower)S +4768(than)S +4977(dezooming)S +5458(via)S +2376 V +1510(subsampling.)S +2101(The)S +2286(default)S +2593(is)S +2690(no)S +2820(antialising.)S +2544 V +10 B +1260(Tile)S +1457(Frames)S +2664 V +10 R +1510(The)S +1695(default)S +2002(display)S +2321(mode)S +2573(is)S +2670(to)S +2778(view)S +3002(one)S +3177(frame)S +3440(at)S +3543(a)S +3618(time.)S +3852(In)S +3966(tile)S +4125(frames)S +4427(mode,)S +4705(2)S +4786(or)S +4900(4)S +4981(frames)S +5283(may)S +5486(be)S +2784 V +1510(viewed)S +1834(simultaneously)S +2476(in)S +2590(the)S +2748(display)S +3073(window.)S +3486(All)S +3650(the)S +3808(usual)S +4055(operations)S +4507(\(zoom)S +4798(and)S +4977(pan,)S +5181(colortable)S +2904 V +1510(enhancement,)S +2091(cursor)S +2370(readback,)S +2784(etc.\))S +2988(still)S +3169(work)S +3404(for)S +3550(each)S +3762(frame)S +4024(even)S +4242(when)S +4488(in)S +4596(tile)S +4754(frames)S +5055(mode.)S +3072 V +10 B +1260(Warnings)S +3192 V +10 R +1510(The)S +1701(warnings)S +2103(options)S +2435(toggles)S +2761(whether)S +3119(you)S +3306(see)S +3470(warning)S +3834(dialog)S +4121(boxes)S +4391(in)S +4506(situations)S +4927(like)S +5114(overwriting)S +3312 V +1510(an)S +1634(existing)S +1981(\256le,)S +2164(clearing)S +2515(the)S +2667(frame)S +2929(bu)S +3029 H + (f)show 10 -.5 mul h (f)show +10 R +3090(er,)S +3222(etc.)S +3480 V +10 B +1260(Centroid)S +1673(Peaks)S +3600 V +10 R +1510(If)S +1608(enabled,)S +1975(the)S +10 B +2129(Ctrl-0)S +10 R +2421(keystroke)S +2841(will)S +3029(reposition)S +3461(the)S +3615(cursor)S +3896(to)S +4007(the)S +4162(computed)S +4589(centroid)S +4949(of)S +5065(the)S +5220(centroid-)S +3720 V +1510(ing)S +1668(box,)S +1873(otherwise)S +2291(the)S +2443(cursor)S +2722(is)S +2819(repositioned)S +3343(to)S +3451(the)S +3603(local)S +3827(maximum)S +4263(value)S +4509(within)S +4795(the)S +4947(box.)S +4008 V +9 B +900(LOAD)S +1187(PANEL)S +4128 V +10 R +1260(The)S +1448(Load)S +1687(Panel)S +1943(allows)S +2238(you)S +2422(load)S +2628(images)S +2945(from)S +3173(disk)S +3374(directly)S +3713(to)S +3825(the)S +3981(frame)S +4247(bu)S +4347 H + (f)show 10 -.5 mul h (f)show +10 R +4408(er,)S +4544(this)S +4723(is)S +4824(analogous)S +5263(to)S +5375(load-)S +4248 V +1260(ing)S +1439(an)S +1584(image)S +1879(on)S +2030(the)S +2203(command)S +2648(line)S +2848(except)S +3158(that)S +3358(browsing)S +3780(is)S +3897(possible.)S +4300(At)S +4450(present)S +4788(recognized)S +5275(formats)S +4368 V +1260(include)S +1587(IRAF)S +1848(OIF)S +2042(format)S +2341(\(i.e.)S +10 I +2529(.imh)S +10 R +2737(extension\),)S +3211(simple)S +3511(FITS)S +3750(\256les,)S +3975(GIF,)S +4195(and)S +4373(Sun)S +4563(raster\256les.)S +5040(The)S +5229(task)S +5424(will)S +4488 V +1260(automatically)S +1850(sense)S +2112(the)S +2280(format)S +2592(of)S +2721(the)S +2888(image)S +3177(and)S +3366(load)S +3583(it)S +3684(appropriately.)S +4286(Images)S +4619(with)S +4842(private)S +5164(colormaps)S +4608 V +1260(\(such)S +1515(as)S +1637(GIF\))S +1870(will)S +2065(be)S +2198(loaded)S +2503(using)S +2759(the)S +2920(private)S +3236(colormap)S +3652(\(meaning)S +4068(that)S +4257(changing)S +4663(the)S +4825(brightness/contrast)S +4728 V +1260(enhancements)S +1856(will)S +2043(render)S +2328(an)S +2453(apparently)S +2905(random-colored)S +3573(image\),)S +3906(all)S +4037(others)S +4312(will)S +4499(be)S +4624(loaded)S +4921(with)S +5130(a)S +5204(grayscale)S +4848 V +1260(colormap.)S +5088 V +1260(When)S +1531(loading)S +1864(new)S +2063(images)S +2379(the)S +2534(frame)S +2799(bu)S +2899 H + (f)show 10 -.5 mul h (f)show +10 R +2960(er)S +3070(con\256guration)S +3636(table)S +3863(will)S +4053(be)S +4181(searched)S +4563(for)S +4713(a)S +4791(frame)S +5057(bu)S +5157 H + (f)show 10 -.5 mul h (f)show +10 R +5218(er)S +5329(that)S +5513(is)S +5208 V +1260(the)S +1417(same)S +1657(size)S +1847(or)S +1965(larger)S +2231(than)S +2437(the)S +2593(new)S +2793(image)S +3071(size,)S +3285(if)S +3380(no)S +3514(frame)S +3780(bu)S +3880 H + (f)show 10 -.5 mul h (f)show +10 R +3941(er)S +4052(can)S +4224(be)S +4352(found)S +4619(a)S +4697(custom)S +5020(bu)S +5120 H + (f)show 10 -.5 mul h (f)show +10 R +5181(er)S +5292(exactly)S +5328 V +1260(the)S +1420(size)S +1613(of)S +1734(the)S +1894(image)S +2176(will)S +2370(be)S +2502(created.)S +2852(This)S +3068(means)S +3361(that)S +3549(the)S +3709(image)S +3991(may)S +4201(not)S +4367(\256ll)S +4517(the)S +4677(display)S +5004(window)S +5364(when)S +5448 V +1260(loaded,)S +1594(or)S +1720(you)S +1913(may)S +2128(see)S +2298(a)S +2385(subsection)S +2850(of)S +2976(the)S +3141(image)S +3428(in)S +3549(the)S +3714(main)S +3957(display)S +4288(window.)S +4707(Setting)S +5033(the)S +10 I +5197(autoscale)S +5568 V +10 R +1260(option)S +1559(on)S +1702(the)S +1867(main)S +2110(Display)S +2464(panel)S +2723(will)S +2923(scale)S +3166(the)S +3332(entire)S +3603(image)S +3891(to)S +4013(\256t)S +4141(the)S +4307(main)S +4551(display)S +4884(window,)S +5275(the)S +5441(full)S +5688 V +1260(frame)S +1522(bu)S +1622 H + (f)show 10 -.5 mul h (f)show +10 R +1683(er)S +1790(will)S +1976(always)S +2283(be)S +2407(visible)S +2704(in)S +2812(the)S +2964(Panner)S +3271(marker)S +3583(window.)S +5928 V +1260(Images)S +1578(with)S +1786(more)S +2021(colors)S +2295(than)S +2497(can)S +2665(be)S +2789(displayed)S +3202(will)S +3389(automatically)S +3964(be)S +4089(quantized)S +4508(to)S +4617(the)S +4770(number)S +5106(of)S +5220(available)S +6048 V +1260(colors)S +1540(before)S +1830(display.)S +2210(If)S +2312(the)S +10 I +2470(Auto)S +2695(Grayscale)S +10 R +3141(button)S +3433(is)S +3536(enabled)S +3882(any)S +4062(image)S +4342(colormap)S +4754(will)S +4945(be)S +5074(converted)S +5502(to)S +6168 V +1260(grayscale)S +1666(and)S +1840(loaded)S +2136(as)S +2249(the)S +2401(standard)S +2769(grayscale)S +3175(colormap.)S +6408 V +1260(Formats)S +1626(which)S +1909(permit)S +2209(pixels)S +2487(larger)S +2758(than)S +2969(8-bits/pixel)S +3464(will)S +3659(be)S +3792(sampled)S +4164(on)S +4303(a)S +4386(grid)S +4586(to)S +4703(determine)S +5141(an)S +5274(optimal)S +6528 V +1260(range)S +1519(in)S +1635(the)S +1795(data)S +1998(to)S +2113(be)S +2244(used)S +2464(to)S +2579(compute)S +2960(a)S +3041(linear)S +3305(transformation)S +3930(to)S +4045(the)S +4204(number)S +4546(of)S +4666(display)S +4992(colors.)S +5298(This)S +5513(is)S +6648 V +1260(the)S +1412(same)S +1647(z-scale)S +1954(sampling)S +2352(and)S +2527(transformation)S +3146(used)S +3360(by)S +3491(the)S +3644(IRAF)S +10 I +3903(DISPLAY)S +10 R +4323(task)S +4515(when)S +4762(computing)S +5221(the)S +10 I +5374(z1/z2)S +6768 V +10 R +1260(values)S +1556(and)S +1741(provides)S +2126(a)S +2211(much)S +2474(better)S +2741(initial)S +3015(display)S +3344(than)S +3556(simple)S +3863(truncation)S +4308(to)S +4426(8-bits.)S +4749(This)S +4967(scaling)S +5290(will)S +5486(be)S +6888 V +1260(done)S +1499(automatically)S +2088(using)S +2350(a)S +2439(grid)S +2646(of)S +10 I +2775(Nsample)S +10 R +3171(points)S +3462(if)S +3569(the)S +10 I +3737(Zscale)S +10 R +4044(option)S +4346(is)S +4459(enabled.)S +4870(Otherwise,)S +5351(if)S +5458(the)S +7008 V +10 I +1260(Zrange)S +10 R +1592(option)S +1891(is)S +2001(set)S +2155(the)S +2320(full)S +2502(data)S +2711(range)S +2974(will)S +3172(be)S +3308(used)S +3533(to)S +3653(scale)S +3894(the)S +4058(image.)S +4399(Lastly,)S +4716(is)S +4825(neither)S +10 I +5144(Zscale)S +10 R +5447(nor)S +7128 V +10 I +1260(Zrange)S +10 R +1579(are)S +1730(enabled,)S +2095(the)S +2247(z1/z2)S +2493(values)S +2778(may)S +2980(be)S +3104(set)S +3245(explicitly)S +3653(using)S +3900(the)S +4052(options)S +4377(box.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(16)S +7920 V +EP +%%Page: 17 18 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(Directory)S +1699(Browsing)S +1080 V +10 R +1510(The)S +1702(load)S +1911(panel)S +2165(contains)S +2536(a)S +2618(list)S +2779(of)S +2900(\256les)S +3105(in)S +3221(the)S +3381(current)S +3701(directory)S +4099(that)S +4287(may)S +4497(be)S +4629(selected)S +4988(for)S +5142(loading)S +5480(by)S +1200 V +1510(selecting)S +1901(with)S +2115(left)S +2284(mouse)S +2581(button.)S +2898(If)S +3000(the)S +3158(\256le)S +3322(is)S +3425(a)S +3504(directory)S +3899(the)S +4056(contents)S +4424(of)S +4542(the)S +4699(new)S +4900(directory)S +5295(will)S +5486(be)S +1320 V +1510(loaded,)S +1836(if)S +1932(it's)S +2095(a)S +2174(plain)S +2409(\256le)S +2572(an)S +2701(attempt)S +3036(will)S +3227(be)S +3356(made)S +3607(to)S +3720(load)S +3927(it)S +4018(as)S +4137(an)S +4267(image)S +4547(otherwise)S +4971(an)S +5101(error)S +5330(popup)S +1440 V +1510(will)S +1706(appear.)S +2065(Directories)S +2547(in)S +2664(the)S +2825(list)S +2987(are)S +3147(identi\256ed)S +3564(with)S +3781(a)S +3864(trailing)S +4192('/')S +4325(character,)S +4753(you)S +4942(will)S +5137(always)S +5453(see)S +1560 V +1510(any)S +1684(subdirectories)S +2274(listed)S +2521(even)S +2739(if)S +2830(a)S +2904(\256lter)S +3123(is)S +3220(speci\256ed.)S +1800 V +1510(The)S +10 I +1698(Root)S +10 R +1920(button)S +2209(will)S +2398(reset)S +2619(the)S +2774(current)S +3089(directory)S +3482(to)S +3593(the)S +3748(system)S +4059(root)S +4254(directory.)S +4673(The)S +10 I +4862(Home)S +10 R +5134(button)S +5424(will)S +1920 V +1510(reset)S +1730(the)S +1884(current)S +2198(directory)S +2590(to)S +2700(the)S +2854(user's)S +3124(login)S +3362(directory,)S +3779(the)S +10 I +3932(Up)S +10 R +4085(button)S +4372(moves)S +4664(up)S +4795(one)S +4970(directory)S +5361(level,)S +2040 V +1510(and)S +10 I +1688(Rescan)S +10 R +2010(reloads)S +2332(the)S +2488(\256le)S +2650(list)S +2807(by)S +2942(rescanning)S +3409(the)S +3566(directory.)S +3986(The)S +4176(current)S +4493(working)S +4861(directory)S +5256(is)S +5358(given)S +2160 V +1510(below)S +1784(the)S +1936(\256le)S +2094(selection)S +2479(window.)S +2400 V +1510(Selecting)S +1912(the)S +10 I +2064(List)S +2245(Image)S +2524(Headers)S +10 R +2892(option)S +3178(will)S +3364(change)S +3676(the)S +3828(display)S +4147(text)S +4328(to)S +4437(list)S +4591(all)S +4722(images)S +5036(in)S +5145(the)S +5298(current)S +2520 V +1510(directory)S +1913(which)S +2200(match)S +2486(the)S +2650(\256lename)S +3036(\256lter.)S +3322(Directory)S +3746(browsing)S +4160(is)S +4269(disabled)S +4644(while)S +4908(this)S +5095(option)S +5393(is)S +5502(in)S +2640 V +1510(e)S +1554 H + (f)show 10 -.5 mul h (f)show +10 R +1615(ect.)S +2808 V +10 B +1260(File)S +1451(Patterns)S +2928 V +10 R +1510(By)S +1661(default)S +1972(all)S +2106(\256les)S +2307(and)S +2486(directories)S +2942(will)S +3133(be)S +3262(listed.)S +3539(You)S +3746(may)S +3953(specify)S +4276(a)S +4355(\256lter)S +4579(to)S +4692(select)S +4954(only)S +5167(those)S +5413(\256les)S +3048 V +1510(with)S +1721(a)S +1798(given)S +2053(extension)S +2469(such)S +2685(as)S +2801(")S +10 Y +2842(*)S +10 R +2892(.\256ts")S +3113(using)S +3362(the)S +10 I +3516(Filter)S +10 R +3776(text)S +3958(box.)S +4195(Directories)S +4670(will)S +4858(always)S +5167(be)S +5293(seen)S +5502(in)S +3168 V +1510(the)S +1662(list)S +1815(and)S +1989(are)S +2140(identi\256ed)S +2548(with)S +2756(a)S +2830(trailing)S +3149('/')S +3273(character.)S +3692(Any)S +3894(valid)S +4124(unix)S +4332(pattern)S +4639(matching)S +5041(string)S +5299(will)S +5486(be)S +3288 V +1510(recognized,)S +2006(multiple)S +2374(templates)S +2791(may)S +2997(be)S +3125(speci\256ed)S +3514(in)S +3626(a)S +3704(comma-delimited)S +4443(list)S +4600(such)S +4817(as)S +4933(")S +10 Y +4974(*)S +10 R +5024(.imh,)S +10 Y +5230(*)S +10 R +5280(.\256ts")S +5502(to)S +3408 V +1510(list)S +1663(both)S +1871(OIF)S +2062(and)S +2236(FITS)S +2472(images.)S +3576 V +10 B +1260(Direct)S +1555(File)S +1746(Load)S +3696 V +10 R +1510(If)S +1608(you)S +1791(know)S +2046(exactly)S +2367(which)S +2644(\256le)S +2805(you)S +2988(wish)S +3210(to)S +3321(load,)S +3551(you)S +3734(may)S +3939(enter)S +4171(its)S +4299(name)S +4548(in)S +4659(the)S +10 I +4814(Load)S +5053(File)S +10 R +5247(text)S +5430(box)S +3816 V +1510(and)S +1688(either)S +1949(hit)S +2089()S +2312(or)S +2429(the)S +2585(Load)S +2824(button)S +3114(to)S +3226(load)S +3432(it.)S +3577(An)S +3733(absolute)S +4099(or)S +4215(relative)S +4547(path)S +4752(name)S +5001(may)S +5206(be)S +5333(given,)S +3936 V +1510(if)S +1601(a)S +1675(simple)S +1972(\256lename)S +2346(is)S +2443(speci\256ed)S +2828(it)S +2914(will)S +3100(be)S +3224(searched)S +3602(for)S +3748(in)S +3856(the)S +4008(current)S +4320(working)S +4683(directory.)S +4104 V +10 B +1260(Frame)S +1572(Selections)S +4224 V +10 R +1510(By)S +1666(default)S +1982(images)S +2304(will)S +2499(be)S +2632(loaded)S +2937(into)S +3132(the)S +3293(current)S +3614(frame,)S +3910(you)S +4100(may)S +4312(choose)S +4629(a)S +4713(di)S +4791 H + (f)show 10 -.5 mul h (f)show +10 R +4852(erent)S +5091(frame)S +5363(using)S +4344 V +1510(the)S +1662(Frame)S +1947(menu)S +2199(button)S +2485(to)S +2593(select)S +2850(from)S +3074(the)S +3226(available)S +3616(frames.)S +4632 V +9 B +900(SAVE)S +1167(PANEL)S +4752 V +10 R +1260(The)S +1445(Save)S +1669(Panel)S +1921(lets)S +2090(you)S +2270(save)S +2477(the)S +2629(current)S +2941(contents)S +3304(of)S +3418(the)S +3571(main)S +3802(display)S +4122(window)S +4475(to)S +4584(a)S +4659(disk)S +4857(\256le)S +5016(\(including)S +5458(the)S +4872 V +1260(Panner/Coords)S +1886(markers,)S +2264(or)S +2379(overlay)S +2710(graphics)S +3079(displayed)S +3493(by)S +3624(the)S +3777(client)S +4030(program\).)S +4457(Presently,)S +4885(only)S +5094(the)S +5247(contents)S +4992 V +1260(of)S +1377(the)S +1533(main)S +1767(display)S +2090(window)S +2446(may)S +2652(be)S +2780(saved,)S +3066(there)S +3299(is)S +3400(no)S +3534(facility)S +3851(for)S +4001(saving)S +4297(the)S +4454(undisplayed)S +4972(contents)S +5340(of)S +5458(the)S +5112 V +1260(entire)S +1527(frame)S +1799(bu)S +1899 H + (f)show 10 -.5 mul h (f)show +10 R +1960(er)S +2077(other)S +2322(than)S +2534(to)S +2651(enable)S +2950(the)S +3111(autoscale)S +3521(feature)S +3836(or)S +3958(zoom)S +4219(out)S +4386(so)S +4514(the)S +4675(whole)S +4958(bu)S +5058 H + (f)show 10 -.5 mul h (f)show +10 R +5119(er)S +5235(is)S +5341(in)S +5458(the)S +5232 V +1260(display)S +1582(window.)S +1992(A)S +2097(limited)S +2414(number)S +2752(of)S +2868(formats)S +3206(are)S +3360(currently)S +3753(available,)S +4171(others)S +4448(will)S +4637(be)S +4764(added)S +5036(in)S +5148(future)S +5420(ver-)S +5352 V +1260(sions.)S +5520 V +10 B +1260(File)S +1451(Name)S +10 R +2010(The)S +2205(File)S +2401(Name)S +2680(text)S +2871(box)S +3062(allows)S +3364(you)S +3555(to)S +3674(enter)S +3914(the)S +4077(\256le)S +4246(name)S +4503(of)S +4627(the)S +4790(saved)S +5058(\256le.)S +5252(A)S +5365("%d")S +5640 V +2010(anywhere)S +2429(in)S +2539(the)S +2693(name)S +2941(will)S +3129(be)S +3255(replaced)S +3624(by)S +3756(a)S +3831(sequence)S +4227(number)S +4563(allowing)S +4944(multiple)S +5309(frames)S +5760 V +2010(to)S +2118(be)S +2242(saved)S +2499(with)S +2707(unique)S +3009(names.)S +5928 V +10 B +1260(Format)S +10 R +2010(The)S +2203(Format)S +2530(box)S +2718(allows)S +3017(you)S +3205(to)S +3321(choose)S +3636(the)S +3796(format)S +4100(of)S +4221(the)S +4381(image)S +4663(to)S +4779(be)S +4911(created)S +5237(however)S +6048 V +2010(not)S +2187(all)S +2336(formats)S +2690(are)S +2860(currently)S +3269(implemented.)S +3895(The)S +4099(EPS)S +4321(format)S +4636(is)S +4752(similar)S +5078(to)S +5204(the)S +10 I +5374(Print)S +6168 V +10 R +2010(option)S +2296(however)S +2669(there)S +2898(is)S +2995(no)S +3125(annotation.)S +6336 V +10 B +1260(Color)S +10 R +2010(The)S +2201(Color)S +2465(box)S +2651(lets)S +2827(you)S +3014(choose)S +3328(the)S +3487(color)S +3729(type)S +3938(of)S +4058(the)S +4217(image)S +4498(to)S +4613(be)S +4744(created.)S +5093(The)S +5285(options)S +6456 V +2010(will)S +2198(change)S +2512(depending)S +2960(on)S +3092(the)S +3246(format,)S +3569(e.g.)S +3745(FITS)S +3983(doesn't)S +4309(allow)S +4562(color)S +4798(so)S +4918(no)S +5049(color)S +5285(options)S +6576 V +2010(will)S +2203(be)S +2334(enabled.)S +2736(Formats)S +3101(which)S +3382(allow)S +3641(24-bit)S +3917(images)S +4237(will)S +4430(be)S +4562(written)S +4883(using)S +5138(the)S +5298(current)S +6696 V +2010(colormap)S +2427(after)S +2649(converting)S +3116(to)S +3234(a)S +3317(24-bit)S +3595(image,)S +3903(pseudocolor)S +4430(images)S +4752(will)S +4947(be)S +5080(written)S +5402(with)S +6816 V +2010(the)S +2162(current)S +2474(colormap.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(17)S +7920 V +EP +%%Page: 18 19 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(PRINT)S +1207(PANEL)S +1080 V +10 R +1260(The)S +1449(Print)S +1678(Panel)S +1934(allows)S +2229(you)S +2413(dump)S +2675(the)S +2831(contents)S +3198(of)S +3315(the)S +3471(main)S +3706(display)S +4030(window)S +4387(as)S +4505(Encapsulated)S +5072(Postscript)S +5502(to)S +1200 V +1260(either)S +1526(a)S +1608(named)S +1912(printer)S +2216(device)S +2514(or)S +2635(to)S +2751(a)S +2833(disk)S +3038(\256le.)S +3259(The)S +10 I +3452(Print)S +3696(To)S +10 R +3840(selects)S +4144(the)S +4304(type)S +4514(of)S +4635(output,)S +4954(the)S +10 I +5114(Print)S +5358(Com-)S +1320 V +1260(mand)S +10 R +1513(box)S +1694(will)S +1881(adjust)S +2151(accordingly,)S +2678(either)S +2936(as)S +3050(a)S +3125(Unix)S +3356(printer)S +3653(command)S +4078(or)S +4192(as)S +4306(a)S +4381(\256le)S +4540(name.)S +4842(A)S +4946("%d")S +5193(anywhere)S +1440 V +1260(in)S +1372(the)S +1528(name)S +1778(for)S +1928(disk)S +2129(output)S +2419(will)S +2609(be)S +2737(replaced)S +3108(by)S +3242(a)S +3320(sequence)S +3719(number)S +4058(allowing)S +4442(multiple)S +4810(frames)S +5115(to)S +5226(be)S +5353(saved)S +1560 V +1260(with)S +1469(unique)S +1772(names.)S +2083(Selecting)S +2486(printers)S +2822(from)S +3047(the)S +3200(installed)S +3570(list)S +3724(will)S +3911(automatically)S +4486(change)S +4799(the)S +4952(command)S +5377(to)S +5486(be)S +1680 V +1260(used)S +1474(to)S +1583(generate)S +1951(the)S +2104(output.)S +2416(This)S +2625(command)S +3049(does)S +3262(not)S +3420(necessarily)S +3893(need)S +4111(to)S +4219(be)S +4343(a)S +4417(printer)S +4713(command,)S +5162(the)S +5314(printer)S +1800 V +1260(con\256guration)S +1823(\256le)S +1981(lets)S +2150(you)S +2330(de\256ne)S +2604(any)S +2778(command)S +3202(string)S +3460(to)S +3568(process)S +3897(the)S +4049(image.)S +2088 V +9 B +1080(COLOR)S +1437(OPTIONS)S +2208 V +10 R +1260(The)S +1469(Color)S +1751(box)S +1955(lets)S +2148(you)S +2352(choose)S +2683(the)S +2859(color)S +3118(type)S +3344(of)S +3481(the)S +3657(image)S +3955(to)S +4087(be)S +4235(created.)S +4631(PseudoColor)S +5203(or)S +5341(24-bit)S +2328 V +1260(postscript)S +1679(will)S +1865(be)S +1989(created)S +2306(using)S +2553(the)S +2705(current)S +3017(colormap)S +3424(and)S +3598(enhancements.)S +2616 V +9 B +1080(POSTSCRIPT)S +1672(OPTIONS)S +2736 V +10 B +1260(Orientation)S +10 R +2010(Set)S +2168(the)S +2320(page)S +2538(orientation.)S +2964 V +10 B +1260(Paper)S +1545(Size)S +10 R +2010(Select)S +2284(the)S +2436(paper)S +2687(size)S +2872(to)S +2980(be)S +3104(used.)S +3192 V +10 B +1260(Image)S +1556(Scale)S +10 R +2010(Set)S +2168(the)S +2320(scale)S +2549(factor)S +2812(used)S +3026(to)S +3135(compute)S +3510(the)S +3663(\256nal)S +3872(image)S +4147(size.)S +4388(No)S +4541(checking)S +4932(is)S +5030(done)S +5255(to)S +5364(make)S +3312 V +2010(sure)S +2206(the)S +2358(image)S +2632(will)S +2818(\256t)S +2932(correctly)S +3316(on)S +3446(the)S +3598(page.)S +3600 V +9 B +1080(PROCESSING)S +1692(OPTIONS)S +3720 V +10 B +1260(Auto)S +1501(Scale)S +3840 V +10 R +1510(Toggles)S +1865(whether)S +2219(or)S +2335(not)S +2496(the)S +2651(image)S +2928(is)S +3028(automatically)S +3605(scaled)S +3887(to)S +3998(\256t)S +4116(the)S +4272(page.)S +4549(If)S +4649(not)S +4811(enabled,)S +5180(the)S +5336(image)S +3960 V +1510(scale)S +1744(will)S +1935(be)S +2064(used)S +2282(to)S +2395(determine)S +2829(the)S +2986(output)S +3277(image)S +3556(size,)S +3771(otherwise)S +4194(the)S +4351(image)S +4629(will)S +4819(be)S +4947(scaled)S +5230(down)S +5486(\(if)S +4080 V +1510(necessary\))S +1960(to)S +2068(\256t)S +2182(on)S +2312(the)S +2464(page.)S +4248 V +10 B +1260(Auto)S +1501(Rotate)S +4368 V +10 R +1510(Determines)S +2005(whether)S +2361(or)S +2479(not)S +2642(the)S +2800(image)S +3080(will)S +3272(be)S +3402(rotated)S +3715(to)S +3829(\256t)S +3949(on)S +4085(the)S +4243(page.)S +4492(When)S +4766(set,)S +4938(an)S +5068(image)S +5348(larger)S +4488 V +1510(than)S +1717(the)S +1874(current)S +2191(orientation)S +2659(will)S +2850(be)S +2979(rotated)S +3291(and)S +3470(possibly)S +3839(scaled)S +4123(to)S +4236(\256t)S +4355(the)S +4511(page,)S +4758(otherwise)S +5180(the)S +5336(image)S +4608 V +1510(may)S +1712(be)S +1836(scaled)S +2115(so)S +2234(that)S +2414(it)S +2500(\256ts)S +2653(in)S +2761(the)S +2913(current)S +3225(orientation.)S +4776 V +10 B +1260(Max)S +1484(Aspect)S +4896 V +10 R +1510(Automatically)S +2112(increases)S +2507(the)S +2659(scale)S +2888(so)S +3007(the)S +3159(image)S +3433(\256lls)S +3614(the)S +3766(page)S +3984(in)S +4092(the)S +4244(current)S +4556(orientation.)S +5064 V +10 B +1260(Annotate)S +5184 V +10 R +1510(The)S +1696(annotate)S +2065(option)S +2352(toggles)S +2672(whether)S +3024(or)S +3138(not)S +3297(the)S +3450(\256nal)S +3660(\256le)S +3820(includes)S +4185(annotation)S +4639(such)S +4854(as)S +4969(the)S +5123(image)S +5399(title,)S +5304 V +1510(a)S +1584(colorbar,)S +1971(and)S +2145(axis)S +2336(labels.)S +2654(There)S +2916(is)S +3013(currently)S +3403(no)S +3533(option)S +3819(for)S +3965(partial)S +4250(annotation.)S +5592 V +9 B +1080(ANNOTATION)S +1727(OPTIONS)S +5712 V +10 B +1260(Annotate)S +5832 V +10 R +1510(Selects)S +1831(whether)S +2190(Postscript)S +2623(image)S +2905(is)S +3010(to)S +3126(be)S +3258(annotated.)S +10 B +3739(Title)S +10 R +3977(Annotate)S +4381(with)S +4597(a)S +4679(title)S +4873(on)S +5011(the)S +5171(top)S +5337(of)S +5458(the)S +5952 V +1510(image.)S +10 B +1850(Borders)S +10 R +2235(Annotate)S +2642(with)S +2860(borders)S +3199(surrounding)S +3722(the)S +3884(image)S +4168(giving)S +4464(image)S +4748(coordinates.)S +10 B +5303(Color-)S +6072 V +1510(bar)S +10 R +1692(Annotate)S +2090(with)S +2300(colorbar)S +2664(at)S +2768(the)S +2922(bottom)S +3238(of)S +3353(the)S +3507(image)S +10 B +3783(Title)S +4015(String)S +10 R +4315(Title)S +4537(string)S +4798(to)S +4909(use)S +5075(when)S +10 I +5324(title)S +10 R +5513(is)S +6192 V +1510(selected.)S +1920(The)S +2108(special)S +2418(value)S +10 I +2667(imtitle)S +10 R +2956(will)S +3145(force)S +3382(the)S +3537(title)S +3726(to)S +3837(be)S +3964(the)S +4119(currently)S +4512(displayed)S +4928(image)S +5205(title,)S +5419(oth-)S +6312 V +1510(erwise)S +1800(it)S +1886(will)S +2072(be)S +2196(this)S +2371(user-selected)S +2921(\256eld.)S +6600 V +9 B +1080(PRINTER)S +1512(SELECTION)S +6720 V +10 R +1260(The)S +1487(printer)S +1825(selection)S +2252(list)S +2447(lets)S +2658(choose)S +3007(the)S +3201(printer)S +3540(to)S +3691(be)S +3858(used.)S +4139(The)S +4367(printer)S +4706(con\256guration)S +5312(\256le)S +5513(is)S +6840 V +1260(/usr/local/lib/ximprint.cfg)S +2342(by)S +2493(default)S +2821(or)S +2954(may)S +3176(be)S +3320(reset)S +3558(using)S +3825(the)S +10 I +3997(-printCon\256g)S +10 R +4542(command)S +4986(line)S +5186(switch)S +5497(or)S +6960 V +10 I +1260(printCon\256g)S +10 R +1752(resource.)S +2144(The)S +2329(format)S +2625(of)S +2738(the)S +2890(\256le)S +3048(is)S +3145(simply)S +7200 V +10 I +1950(name\\tcommand)S +7680 V +10 R +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(18)S +7920 V +EP +%%Page: 19 20 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(The)S +10 I +1450(name)S +10 R +1701(value)S +1952(is)S +2054(what)S +2284(appears)S +2624(in)S +2738(the)S +2896(selection)S +3287(list)S +3446(and)S +3626(may)S +3834(be)S +3964(more)S +4205(than)S +4413(a)S +4493(single)S +4768(word,)S +5034(the)S +10 I +5192(command)S +1080 V +10 R +1260(can)S +1432(be)S +1560(any)S +1738(command)S +2166(that)S +2350(accepts)S +2677(EPS)S +2884(input)S +3124(from)S +3352(a)S +3429(pipe,)S +3659(the)S +3814(two)S +3997(\256elds)S +4247(must)S +4475(be)S +4602(separated)S +5011(by)S +5144(a)S +5221(tab)S +5376(char-)S +1200 V +1260(acter.)S +1538(Normally)S +1951(the)S +2103(command)S +2527(will)S +2713(be)S +2837(a)S +2912(simple)S +10 I +3210(lpr)S +3358(-Pfoo)S +10 R +3611(or)S +3725(some)S +3967(such,)S +4206(but)S +4365(can)S +4534(also)S +4726(include)S +5051(converters)S +5497(or)S +1320 V +1260(previewers.)S +1752(At)S +1882(most)S +2107(128)S +2287(printer)S +2583(commands)S +3046(may)S +3248(be)S +3372(used.)S +1608 V +9 B +900(INFO)S +1152(PANEL)S +1728 V +10 R +1260(The)S +1449(Info)S +1649(panel)S +1899(was)S +2088(revised)S +2410(to)S +2522(provide)S +2861(a)S +2939(greater)S +3249(variety)S +3560(of)S +3677(status)S +3939(information.)S +4500(The)S +4689(type)S +4895(of)S +5012(output)S +5302(is)S +5403(con-)S +1848 V +1260(trolled)S +1560(by)S +1699(the)S +1860(toggle)S +2149(buttons)S +2483(on)S +2622(the)S +2783(bottom)S +3106(of)S +3228(the)S +3389(frame,)S +3685(however)S +4066(all)S +4204(output)S +4498(is)S +4603(kept)S +4813(current)S +5133(as)S +5254(the)S +5414(pro-)S +1968 V +1260(gram)S +1495(runs.)S +1752(Current)S +2087(info)S +2278(options)S +2603(include:)S +2136 V +10 B +1620(Frame)S +10 R +2370(Info)S +2566(about)S +2818(the)S +2970(current)S +3282(display)S +3601(frame.)S +2304 V +10 B +1620(Server)S +10 R +2370(Info)S +2584(about)S +2854(various)S +3197(server)S +3489(options,)S +3858(e.g.)S +4051(colormaps,)S +4541(memory)S +4923(model,)S +5247(antialias)S +2424 V +2370(type,)S +2597(etc.)S +2592 V +10 B +1620(Clients)S +10 R +2370(Show)S +2650(currently)S +3062(connected)S +3518(clients.)S +3886(Lists)S +4133(available)S +4545(connection)S +5035(channels)S +5436(and)S +2712 V +2370(active)S +2638(ISM)S +2846(clients.)S +2880 V +10 B +1620(WCS)S +10 R +2370(List)S +2556(all)S +2686(WCS)S +2933(and)S +3107(mappings)S +3526(for)S +3672(the)S +3824(current)S +4136(frame.)S +3048 V +10 B +1620(ISM)S +10 R +2370(Log)S +2561(of)S +2674(various)S +2998(ISM)S +3206(status)S +3464(messages.)S +3216 V +10 B +1620(Imtoolrc)S +10 R +2370(Show)S +2628(current)S +2940(frame)S +3202(bu)S +3302 H + (f)show 10 -.5 mul h (f)show +10 R +3363(er)S +3470(con\256guration)S +4033(table.)S +3504 V +9 B +900(TILE)S +1142(PANEL)S +1474(\(NEW\))S +3624 V +10 R +1260(With)S +1493(the)S +1648(additional)S +2081(frames,)S +2410(the)S +2565(default)S +2875(tiling)S +3120(scheme)S +3452(proved)S +3762(inadequate.)S +4282(A)S +4387(new)S +4586(control)S +4903(panel)S +5153(Tile)S +5348(frame)S +3744 V +1260(now)S +1471(allows)S +1771(you)S +1960(to)S +2077(select)S +2343(from)S +2576(a)S +2659(number)S +3003(of)S +3125(tile)S +3292(con\256gurations,)S +3928(the)S +4089(list)S +4251(of)S +4373(frames)S +4682(to)S +4798(be)S +4930(tiled,)S +5171(a)S +10 I +5253(\256ll)S +5397(style)S +3864 V +10 R +1260(\(left-to-right)S +1794(or)S +1912(top-to-bottom\),)S +2561(as)S +2679(well)S +2886(as)S +3004(optional)S +3367(labels)S +3635(for)S +3786(each)S +4003(of)S +4121(the)S +4278(tiles)S +4480(\(frame)S +4780(number,)S +5145(image)S +5424(title)S +3984 V +1260(or)S +1373(image)S +1647(name\).)S +4224 V +1260(Tile)S +1452(con\256guration)S +2016(will)S +2204(make)S +2452(use)S +2617(of)S +2732(all)S +2864(frames)S +3167(currently)S +3559(selected)S +3912(in)S +4022(the)S +10 I +4176(Tile)S +4364(Frame)S +10 R +4662(group)S +4927(in)S +5037(the)S +5191(following)S +4344 V +1260(manner:)S +4512 V +10 B +1620(Disabled)S +10 R +2370(Do)S +2522(not)S +2680(tile)S +2838(the)S +2990(display.)S +4680 V +10 B +1620(Manual)S +10 R +2370(Tile)S +2561(according)S +2984(to)S +10 I +3092(Manual)S +3433(Con\256guration)S +10 R +4025(settings.)S +4848 V +10 B +1620(Best)S +10 R +2370(Optimize)S +2772(layout)S +3052(for)S +3198(frame)S +3460(bu)S +3560 H + (f)show 10 -.5 mul h (f)show +10 R +3621(er)S +3728(aspect.)S +5016 V +10 B +1620(Square)S +10 R +2370(Always)S +2705(force)S +2939(a)S +3013(square)S +3303(layout)S +3583(\(2x2,)S +3821(3x3,)S +4026(etc\).)S +5184 V +10 B +1620(Horizontal)S +10 R +2370(Preferentially)S +2943(tile)S +3101(horizontally)S +3614(\(6)S +3727(frames)S +4028(==>)S +4226(3x2\).)S +5352 V +10 B +1620(Vertical)S +10 R +2370(Preferentially)S +2943(tile)S +3101(vertically)S +3508(\(6)S +3621(frames)S +3922(==>)S +4120(2x3\).)S +5520 V +10 B +1620(One)S +1828(Row)S +10 R +2370(Tile)S +2561(all)S +2691(in)S +2799(one)S +2973(row)S +3158(\(Nx1\).)S +5688 V +10 B +1620(One)S +1828(Column)S +10 R +2370(Tile)S +2561(all)S +2691(in)S +2799(one)S +2973(column)S +3303(\(1xN\).)S +5976 V +9 B +900(COORDS)S +1312(PANEL)S +1644(\(NEW\))S +6096 V +10 R +1260(The)S +1452(Coords)S +1778(Panel)S +2037(is)S +2141(meant)S +2422(to)S +2537(provide)S +2879(a)S +2960(full-featured)S +3495(readout)S +3831(as)S +3951(well)S +4160(as)S +4280(serve)S +4527(as)S +4647(a)S +4729(control)S +5050(panel)S +5304(for)S +5458(the)S +6216 V +1260(various)S +1586(options.)S +1968(The)S +2155(display)S +2475(window)S +2828(contains)S +3192(the)S +3345(image)S +3620(name/title)S +4051(and)S +4226(frame)S +4489(bu)S +4589 H + (f)show 10 -.5 mul h (f)show +10 R +4650(er)S +4758(info,)S +4975(and)S +5150(a)S +5225(selection)S +6336 V +1260(of)S +1373(coordinate)S +1824(and)S +1998(image)S +2272(pixel)S +2502(readouts.)S +2925(The)S +3110(intent)S +3368(is)S +3466(provide)S +3802(more)S +4038(infor-)S +4296(mation)S +4605(than)S +4808(can)S +4977(\256t)S +5092(comfortably)S +6456 V +1260(on)S +1409(the)S +1580(main)S +1829(image)S +2122(window)S +2493(while)S +2764(still)S +2964(taking)S +3263(up)S +3412(as)S +3544(little)S +3777(screen)S +4080(space)S +4350(as)S +4482(possible.)S +4914(To)S +5073(this)S +5266(end)S +5458(the)S +6576 V +1260("Options")S +1692(button)S +1981(is)S +2081(used)S +2297(to)S +2408(hide)S +2613(most)S +2841(of)S +2957(the)S +3112(feature)S +3421(controls)S +3776(when)S +4025(not)S +4186(in)S +4297(use)S +4464(\(see)S +4658(below\).)S +5024(Other)S +5285(options)S +6696 V +1260(on)S +1390(the)S +1542(main)S +1772(panel)S +2018(include:)S +6984 V +10 B +1620(WCS/Pix)S +10 R +2370(Toggle)S +2683(the)S +2835(real-time)S +3225(WCS/pixel)S +3700(readout)S +4030(capability)S +4455(\(i.e.)S +4641(the)S +4794(ISM)S +5003(used)S +5217(to)S +5326(access)S +7104 V +2370(the)S +2522(disk)S +2719(image\).)S +3081(This)S +3289(must)S +3514(be)S +3638(enabled)S +3978(for)S +4124(certain)S +4425(other)S +4660(options)S +4985(to)S +5093(work.)S +7272 V +10 B +1620(Pix)S +1789(Table)S +10 R +2370(Open)S +2632(a)S +2722(panel)S +2984(showing)S +3369(an)S +3509(image)S +3800(pixel)S +4047(table.)S +4343(The)S +4545(panel)S +4808(shows)S +5105(an)S +5246(array)S +5497(of)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(19)S +7920 V +EP +%%Page: 20 21 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +2370(pixels)S +2640(surrounding)S +3154(the)S +3307(cursor)S +3587(position,)S +3966(either)S +4224(the)S +4376(actual)S +4644(pixel)S +4874(values)S +5159(if)S +5250(the)S +5402(ISM)S +1080 V +2370(is)S +2476(enabled,)S +2850(or)S +2972(scaled)S +3260(display)S +3588(values)S +3882(otherwise.)S +4365(The)S +4560(size)S +4755(of)S +4878(the)S +5040(table)S +5274(may)S +5486(be)S +1200 V +2370(selected)S +2721(from)S +2945(the)S +3097(menubar.)S +1368 V +10 B +1620(Header)S +10 R +2370(Display)S +2734(the)S +2909(current)S +3244(image)S +3541(header)S +3859(in)S +3990(a)S +4087(new)S +4306(panel.)S +4630(Both)S +4879(the)S +5055(entire)S +5336(image)S +1488 V +2370(header)S +2697(as)S +2842(well)S +3076(as)S +3221(WCS-speci\256c)S +3838(parts)S +4094(of)S +4239(the)S +4423(header)S +4750(are)S +4932(available)S +5353(under)S +1608 V +2370(di)S +2448 H + (f)show 10 -.5 mul h (f)show +10 R +2509(erent)S +2738(tabs.)S +2984(This)S +3192(option)S +3478(is)S +3575(only)S +3783(active)S +4051(when)S +4297(the)S +4449(ISM)S +4657(is)S +4754(enabled.)S +1776 V +10 B +1620(Compass)S +10 R +2370(Draw)S +2621(an)S +2745(orientation)S +3208(compass)S +3582(on)S +3712(the)S +3864(display)S +4183(panner.)S +4539(If)S +4635(the)S +4788(ISM)S +4997(is)S +5095(enabled)S +5436(and)S +1896 V +2370(a)S +2456(WCS)S +2714(is)S +2822(present)S +3151(in)S +3270(the)S +3433(header,)S +3764(the)S +3927(compass)S +4312(will)S +4509(indicate)S +4866(N/E)S +5068(according)S +5502(to)S +2016 V +2370(the)S +2522(WCS,)S +2794(otherwise)S +3212(the)S +3364(X/Y)S +3566(axes)S +3773(of)S +3886(the)S +4038(image)S +4312(are)S +4463(drawn.)S +2184 V +10 B +1620(Options)S +10 R +2370(Pop-up/down)S +2967(the)S +3147(option)S +3461(control)S +3802(portion)S +4149(of)S +4290(the)S +4470(panel.)S +4769(When)S +5065(enabled,)S +5458(the)S +2304 V +2370(Coords)S +2706(Panel)S +2975(will)S +3178(change)S +3507(size)S +3709(to)S +3834(reveal)S +4124(the)S +4293(options)S +4634(which)S +4924(can)S +5108(be)S +5248(changed)S +2424 V +2370(\(explained)S +2821(below\).)S +2712 V +1260(The)S +1457("Readout)S +1873(Values")S +2233(group)S +2508(controls)S +2872(the)S +3036(selection)S +3433(of)S +3558(WCS)S +3817(type,)S +4056(location)S +4420(and)S +4606(format)S +4914(to)S +5035(be)S +5172(displayed.)S +2832 V +1260(The)S +1455("Type")S +1782(menu)S +2044(always)S +2361(provides)S +2745(a)S +2829(selection)S +3224(of)S +3347(the)S +3509(image)S +3792(Logical,)S +4161(Physical)S +4539(or)S +4661(World)S +4955(systems,)S +5336(which)S +2952 V +1260(may)S +1472(be)S +1606(identical)S +1990(depending)S +2446(on)S +2586(the)S +2748(image)S +3032(header.)S +3392(If)S +3498(a)S +3582(World)S +3878(system)S +4197(is)S +4305(supplied)S +4685(in)S +4804(the)S +4967(image)S +5252(addition)S +3072 V +1260(entries)S +1573(for)S +1736(transformations)S +2410(to)S +2535(other)S +2787(sky)S +2973(systems,)S +3362(\(e.g.)S +3616(FK5)S +3841(to)S +3966(ICRS)S +4236(or)S +4366(galactic/ecliptic\))S +5077(will)S +5279(also)S +5486(be)S +3192 V +1260(available.)S +1706(The)S +1892(selection)S +2278(is)S +2376(dependent)S +2817(on)S +2948(whether)S +3300(the)S +3453(ISM)S +3663(is)S +3762(running)S +4105(as)S +4220(well)S +4424(as)S +4539(WCS)S +4788(information)S +5292(present)S +3312 V +1260(in)S +1369(the)S +1522(image.)S +1852(The)S +2038("Format")S +2440(menu)S +2693(allows)S +2985(the)S +3138(use)S +3302(to)S +3410(select)S +3667(a)S +3741(sexigesimal)S +4243(display,)S +4587(conversion)S +5055(to)S +5163(degrees)S +5497(or)S +3432 V +1260(radians,)S +1604(or)S +1718(whichever)S +2164(format)S +2461(is)S +2559(most)S +2785(natural)S +3093(for)S +3240(the)S +3393(coordinate)S +3846(being)S +4100(display.)S +4476(The)S +4663(two)S +4845(toggle)S +5127(to)S +5237(the)S +5391(right)S +3552 V +1260(control)S +1577(whether)S +1932(this)S +2111(WCS)S +2362(is)S +2463(to)S +2575(be)S +2703(displayed)S +3120(on)S +3254(the)S +3410(Panel)S +3666(\(i.e.)S +3855(the)S +4011(Coords)S +4333(Panel)S +4588(window\))S +4976(or)S +5092(the)S +5247(ImgWin)S +3672 V +1260(\(i.e.)S +1475(the)S +1627(text)S +1807(marker)S +2119(on)S +2249(the)S +2401(main)S +2631(image)S +2905(window\).)S +3912 V +1260(Other)S +1524(options)S +1856(below)S +2138(this)S +2321(group)S +2592(control)S +2913(whether)S +3272(or)S +3393(not)S +3559(to)S +3675(display)S +4002(the)S +4162(WCS)S +4417(labels,)S +4713(the)S +4873(image)S +5155(name/title,)S +4032 V +1260(and)S +1459(frame)S +1746(bu)S +1846 H + (f)show 10 -.5 mul h (f)show +10 R +1907(er)S +2039(information)S +2566(in)S +2699(the)S +2876(main)S +3131(Coords)S +3475(Panel)S +3751(display.)S +4149(The)S +4358("BPM)S +4665(Data")S +4948(option)S +5258(controls)S +4152 V +1260(whether)S +1613(or)S +1728(not)S +1888(the)S +2042(ISM)S +2252(will)S +2440(try)S +2583(to)S +2693(map)S +2897(any)S +3073(bad-pixel)S +3482(mask)S +3725(associated)S +4167(with)S +4377(the)S +4531(image.)S +4862(If)S +4960(enabled,)S +5327(a)S +5403(bad-)S +4272 V +1260(pixel)S +1497(mask)S +1745(speci\256ed)S +2137(by)S +2274(the)S +2433(image)S +2714(header)S +3016(BPM)S +3265(keyword)S +3651(\(currently)S +4081(\256xed)S +4317(by)S +4453(convention)S +4933(but)S +5097(this)S +5278(may)S +5486(be)S +4392 V +1260(selectable)S +1698(later\))S +1953(will)S +2154(be)S +2293(mapped)S +2654(along)S +2921(with)S +3144(the)S +3311(image.)S +3655(Aside)S +3933(from)S +4172(wcs/pixel)S +4601(readouts)S +4985(at)S +5103(each)S +5331(cursor)S +4512 V +1260(position,)S +1643(any)S +1822(BPM)S +2069(data)S +2270(values)S +2559(found)S +2826(will)S +3016(also)S +3211(be)S +3339(displayed.)S +3811(A)S +3917(non-zero)S +4305(value)S +4555(will)S +4745(cause)S +5000(the)S +5156(BPM)S +5402(\256eld)S +4632 V +1260(of)S +1384(the)S +1547(Coords)S +1877(Panel)S +2140(readout)S +2480(as)S +2604(well)S +2817(as)S +2941(the)S +3104(main)S +3345(image)S +3630(window)S +3993(marker)S +4316(to)S +4435(switch)S +4737(to)S +4856(a)S +4941(red)S +5109(background)S +4752 V +1260(color)S +1495(to)S +1603(\257ag)S +1783(the)S +1935(value.)S +4992 V +1260(The)S +1453(last)S +1630(box)S +1818(allows)S +2117(the)S +2277(user)S +2481(to)S +2597(specify)S +2923(a)S +3005(di)S +3083 H + (f)show 10 -.5 mul h (f)show +10 R +3144(erent)S +3381(ISM)S +3597(task)S +3796(to)S +3912(be)S +4044(executed)S +4436(or)S +4557(to)S +4673(reinitialize)S +5138(the)S +5298(current)S +5112 V +1260(one.)S +1497(In)S +1618(most)S +1851(cases)S +2098(this)S +2280(won't)S +2550(need)S +2775(to)S +2890(be)S +3021(changed,)S +3415(however)S +3795(a)S +3876(custom)S +4202(ISM)S +4417(could)S +4676(be)S +4807(started)S +5110(when)S +5363(using)S +5232 V +1260(special)S +1567(data)S +1763(formats.)S +2153(This)S +2361(command)S +2785(string)S +3043(can)S +3211(also)S +3402(be)S +3526(controlled)S +3961(by)S +4091(the)S +4243(application)S +4717("ism_task")S +5185(resource.)S +5520 V +9 B +900(TCLSHELL)S +5640 V +10 R +1260(The)S +10 I +1446(TclShell)S +10 R +1805(allows)S +2097(the)S +2250(user)S +2447(to)S +2556(type)S +2759(commands)S +3224(directly)S +3561(to)S +3671(the)S +3825(TCL)S +4046(interpreter,)S +4518(letting)S +4806(you)S +4988(send)S +5203(messages)S +5760 V +1260(to)S +1369(the)S +1522(object)S +1797(manager)S +2171(or)S +2284(execute)S +2618(speci\256c)S +2953(procedures)S +3420(in)S +3528(the)S +3680(TCL)S +3899(code)S +4117(that)S +4297(makes)S +4582(up)S +4712(the)S +4864(GUI.)S +5096(It)S +5187(is)S +5284(used)S +5497(as)S +5880 V +1260(a)S +1338(development)S +1888(or)S +2005(debugging)S +2461(tool)S +2651(for)S +2801(the)S +2957(GUI,)S +3193(but)S +3355(for)S +3505(an)S +3633(example)S +4005(of)S +4122(what)S +4350(it)S +4440(does,)S +4682(bring)S +4927(it)S +5017(up)S +5151(and)S +5329(type)S +5536(a)S +6000 V +1260(command)S +1684(such)S +1897(as)S +6240 V +10 I +1980(send)S +2193(\256leButton)S +2612(set)S +2753(background)S +3260(red)S +6648 V +9 B +900(COLORMAP)S +1462(SELECTION)S +6768 V +10 R +1260(By)S +1410(default)S +1721(XImtool)S +2094(will)S +2284(display)S +2607(images)S +2924(using)S +3175(either)S +3436(a)S +3514(grayscale)S +3924(colormap)S +4335(\(e.g.)S +4576(if)S +4671(loaded)S +4971(by)S +5105(a)S +5183(client\),)S +5497(or)S +6888 V +1260(a)S +1346(private)S +1665(colormap)S +2084(when)S +2342(loading)S +2684(an)S +2820(image)S +3106(from)S +3342(disk)S +3551(that)S +3743(contains)S +4118(a)S +4204(colormap.)S +4648(Each)S +4888(frame)S +5161(de\256nes)S +5485(its)S +7008 V +1260(own)S +1470(colormap)S +1885(so)S +2013(you)S +2202(can)S +2379(de\256ne)S +2662(di)S +2740 H + (f)show 10 -.5 mul h (f)show +10 R +2801(erent)S +3039(colormaps)S +3494(or)S +3616(enhancements)S +4220(for)S +4375(each)S +4596(frame,)S +4892(they)S +5103(will)S +5298(change)S +7128 V +1260(automatically)S +1834(as)S +1947(you)S +2127(cycle)S +2367(through)S +2708(the)S +2860(frames.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(20)S +7920 V +EP +%%Page: 21 22 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(BUILTIN)S +1487(COLORMAPS)S +1080 V +10 R +1260(Once)S +1501(loaded,)S +1823(the)S +1976(colormap)S +2384(may)S +2588(either)S +2847(be)S +2973(changed)S +3337(using)S +3586(the)S +3740(builtin)S +4034(colormap)S +4443(menu)S +4697(under)S +4956(the)S +5110(View)S +5358(menu)S +1200 V +1260(button)S +1559(on)S +1702(the)S +1867(main)S +2110(window,)S +2500(or)S +2625(from)S +2861(the)S +3025(Enhancement)S +3610(box)S +3802(on)S +3944(the)S +4108(control)S +4433(panel.)S +4716(XImtool)S +5097(has)S +5272(about)S +5536(a)S +1320 V +1260(dozen)S +1556(colormap)S +1991(options)S +2344(builtin,)S +2689(other)S +2952(user-de\256ned)S +3503(colormaps)S +3977(may)S +4208(optionally)S +4673(be)S +4826(loaded.)S +5206(It)S +5326(is)S +5452(not)S +1440 V +1260(presently)S +1656(possible)S +2014(to)S +2122(save)S +2329(colormaps)S +2775(for)S +2921(later)S +3128(use.)S +1728 V +9 B +1080(USER-DEFINED)S +1782(COLORMAPS)S +1848 V +10 R +1260(The)S +10 I +1454(cmap[12])S +10 R +1887(and)S +10 I +2070(cmapDir[12])S +10 R +2642(resources)S +3057(\(or)S +3212(command)S +3645(line)S +3834(arguments\))S +4322(are)S +4482(used)S +4705(to)S +4823(tell)S +4991(which)S +5275(speci\256c)S +1968 V +1260(colormaps)S +1719(to)S +1840(make)S +2099(available)S +2502(or)S +2628(where)S +2914(to)S +3035(look)S +3256(for)S +3415(colortables)S +3895(respectively.)S +4474(The)S +4671(colortables)S +5151(are)S +5314(loaded)S +2088 V +1260(when)S +1519(ximtool)S +1874(starts)S +2128(up,)S +2296(or)S +2422(when)S +2681(it)S +2780(is)S +2890(reinitialized)S +3410(\(e.g.)S +3630(by)S +3773(pressing)S +4149(the)S +4314(Initialize)S +4712(button)S +5011(in)S +5132(the)S +5297(control)S +2208 V +1260(panel\).)S +1598(XImtool)S +1971(will)S +2161(ignore)S +2450(any)S +2628(\256les)S +2829(in)S +2941(the)S +3097(colormap)S +3508(directory)S +3901(which)S +4178(do)S +4311(not)S +4472(look)S +4683(like)S +4866(colortables.)S +5392(New)S +2328 V +1260(colortables)S +1728(will)S +1914(also)S +2105(be)S +2229(added)S +2497(automatically)S +3071(for)S +3217(each)S +3429(image)S +3703(loaded)S +3999(from)S +4223(disk.)S +2568 V +1260(The)S +1451(format)S +1753(of)S +1872(a)S +1952(user)S +2154(lookup)S +2468(table)S +2698(is)S +2801(very)S +3015(simple:)S +3347(each)S +3566(row)S +3758(de\256nes)S +4078(one)S +4259(colortable)S +4695(entry,)S +4962(and)S +5143(consists)S +5497(of)S +2688 V +1260(three)S +1489(columns)S +1858(de\256ning)S +2216(the)S +2368(red,)S +2550(green,)S +2826(and)S +3000(blue)S +3202(values)S +3487(scaled)S +3766(to)S +3874(the)S +4026(range)S +4277(0.0)S +4432(\(o)S +4515 H + (f)show 10 -.5 mul h (f)show +10 R +4576(\))S +4639(to)S +4747(1.0)S +4902(\(full)S +5104(intensity\).)S +2928 V +1500(R)S +1597(G)S +1699(B)S +3048 V +1500(R)S +1597(G)S +1699(B)S +3168 V +1500(\(etc.\))S +3408 V +1260(Blank)S +1529(and)S +1703(comment)S +2105(lines)S +2324(\(lines)S +2576(beginning)S +3006(with)S +3214(a)S +3288('#'\))S +3467(are)S +3618(ignored.)S +3648 V +1260(Usually)S +1605(256)S +1789(rows)S +2017(are)S +2172(provided,)S +2586(but)S +2748(the)S +2904(number)S +3243(may)S +3449(actually)S +3799(be)S +3927(anything)S +4311(in)S +4423(the)S +4579(range)S +4834(1)S +4918(to)S +5031(256.)S +5241(XImtool)S +3768 V +1260(will)S +1451(interpolate)S +1912(the)S +2068(table)S +2296(as)S +2413(necessary)S +2834(to)S +2946(compute)S +3324(the)S +3480(colortable)S +3913(values)S +4202(used)S +4419(in)S +4531(XImtool.)S +4929(XImtool)S +5302(uses)S +5508(at)S +3888 V +1260(most)S +1485(201)S +1665(colors)S +1939(to)S +2047(render)S +2331(pixel)S +2561(data,)S +2782(so)S +2901(it)S +2987(is)S +3084(usually)S +3403(necessary)S +3820(to)S +3928(interpolate)S +4385(the)S +4537(table)S +4761(when)S +5007(it)S +5093(is)S +5190(loaded.)S +4128 V +1260(The)S +1446(name)S +1693(of)S +1807(the)S +1960(colortable)S +2390(as)S +2504(it)S +2591(will)S +2778(appear)S +3074(in)S +3183(the)S +3336(XImtool)S +3706(control)S +4020(panel)S +4267(is)S +4365(the)S +4518(root)S +4710(name)S +4957(of)S +5072(the)S +5226(\256le,)S +5411(e.g.,)S +4248 V +1260(if)S +1365(the)S +1531(\256le)S +1703(is)S +1814("rainbow.lut")S +2398(the)S +2564(colortable)S +3007(name)S +3267(will)S +3467(be)S +3605("rainbow".)S +4083(Lower)S +4387(case)S +4602(names)S +4901(are)S +5065(suggested)S +5502(to)S +4368 V +1260(avoid)S +1525(name)S +1784(collisions)S +2211(with)S +2432(the)S +2597(builtin)S +2902(colortables.)S +3408(Private)S +3734(colormaps)S +4193(for)S +4352(disk)S +4562(images)S +4888(will)S +5088(be)S +5226(have)S +5458(the)S +4488 V +1260(same)S +1497(name)S +1745(as)S +1860(the)S +2014(image)S +2290(loaded.)S +2613(If)S +2711(the)S +2865(same)S +3102(colortable)S +3533(\256le)S +3693(appears)S +4029(in)S +4139(multiple)S +4505(user)S +4703(colortable)S +5134(directories,)S +4608 V +1260(the)S +1412(\256rst)S +1598(one)S +1772(found)S +2035(will)S +2221(be)S +2345(used.)S +4896 V +9 B +1080(MINIMIZING)S +1677(COLORMAP)S +2239(CONFLICTS)S +5016 V +10 R +1260(The)S +1456(Gterm)S +1752(widget)S +2065(used)S +2289(by)S +2430(XImtool)S +2810(\(i.e.)S +3006(the)S +3169(main)S +3410(display)S +3740(window\))S +4136(uses)S +4349(a)S +4434(private)S +4753(global)S +5045(colormap)S +5464(for)S +5136 V +1260(display,)S +1615(this)S +1801(allows)S +2103(it)S +2200(to)S +2319(have)S +2548(greater)S +2865(control)S +3189(over)S +3407(color)S +3653(cell)S +3838(allocation)S +4273(but)S +4441(can)S +4619(occasionally)S +5158(also)S +5359(cause)S +5256 V +1260("colormap)S +1714(\257ashing")S +2108(as)S +2227(the)S +2385(mouse)S +2682(is)S +2785(moved)S +3093(in)S +3207(and)S +3387(out)S +3551(of)S +3670(the)S +3828(application.)S +4363(The)S +4554(problem)S +4923(here)S +5130(is)S +5234(that)S +5421(in)S +5536(a)S +5376 V +1260(system)S +1572(with)S +1784(only)S +1996(an)S +2124(8-bit)S +2347(colormap)S +2758(\(256)S +2975(colors\))S +3286(all)S +3420(applications)S +3937(must)S +4165(compete)S +4536(for)S +4685(colors,)S +4987(programs)S +5397(such)S +5496 V +1260(as)S +1380(XV)S +1561(or)S +1681(Netscape)S +2083(allocate)S +2430(colors)S +2711(from)S +2942(the)S +3102(default)S +3417(colormap)S +3832(leaving)S +4164(only)S +4380(a)S +4462(few)S +4649(free)S +4841(cells)S +5062(for)S +5216(XImtool.)S +5616 V +1260(Since)S +1513(XImtool)S +1883(de\256nes)S +2197(a)S +2271(private)S +2578(global)S +2858(colormap)S +3265(it)S +3351(is)S +3448(still)S +3629(able)S +3825(to)S +3933(allocate)S +4273(the)S +4425(needed)S +4737(cells)S +4950(rather)S +5212(than)S +5414(fail-)S +5736 V +1260(ing,)S +1449(but)S +1613(it's)S +1777(allocating)S +2207(cells)S +2426(already)S +2755(used)S +2974(by)S +3110(other)S +3351(applications.)S +3925(As)S +4072(the)S +4230(mouse)S +4527(moves)S +4824(out)S +4989(of)S +5109(the)S +5268(ximtool)S +5856 V +1260(window)S +1623(those)S +1875(cells)S +2099(are)S +2261(once)S +2490(again)S +2747(de\256ned)S +3082(in)S +3201(terms)S +3464(of)S +3587(the)S +3749(default)S +4066(colormap,)S +4508(so)S +4637(the)S +4799(ximtool)S +5151(window)S +5513(is)S +5976 V +1260(then)S +1470(using)S +1725(a)S +1807(di)S +1885 H + (f)show 10 -.5 mul h (f)show +10 R +1946(erent)S +2183(colormap.)S +2653(It)S +2752(is)S +2857(this)S +3040(switching)S +3467(of)S +3588(the)S +3748(colormap)S +4164(context)S +4497(that)S +4686(causes)S +4985(the)S +5146(\257ashing)S +5502(to)S +6096 V +1260(occur,)S +1536(but)S +1694(there)S +1923(are)S +2074(a)S +2148(few)S +2327(things)S +2602(that)S +2782(can)S +2950(be)S +3074(done)S +3298(to)S +3406(help)S +3608(minimize)S +4016(this.)S +6336 V +1260(XImtool)S +1640(logically)S +2031(de\256nes)S +2356(200)S +2548(colors)S +2834(which)S +3120(the)S +3284(client)S +3548(image)S +3834(display)S +4165(program)S +4545(can)S +4725(use)S +4900(to)S +5020(render)S +5316(pixels.)S +6456 V +1260(However,)S +1687(ximtool)S +2036(may)S +2245(or)S +2365(may)S +2574(not)S +2739(actually)S +3092(allocate)S +3439(all)S +3576(of)S +3695(those)S +3942(colors.)S +4277(By)S +4430(default)S +4743(it)S +4835(currently)S +5231(allocates)S +6576 V +1260(only)S +1479(about)S +1743(192)S +1935(colors,)S +2246(to)S +2366(reserve)S +2695(64)S +2837(colors)S +3123(for)S +3281(the)S +3445(other)S +3692(windows)S +4095(on)S +4237(the)S +4401(screen.)S +4752(You)S +4966(don't)S +5219(normally)S +6696 V +1260(notice)S +1539(this)S +1719(as)S +1837(1\))S +1955(usually)S +2279(the)S +2436(default)S +2748(screen)S +3037(colormap)S +3449(has)S +3617(enough)S +3946(free)S +4135(cells)S +4353(to)S +4466(allow)S +4722(ximtool)S +5068(to)S +5180(match)S +5458(the)S +6816 V +1260(colors,)S +1570(and)S +1755(2\))S +1879(the)S +2042(extra)S +2282(unallocated)S +2784(cells)S +3009(correspond)S +3494(to)S +3614(the)S +3778(brightest)S +4170(pixels)S +4451(in)S +4571(the)S +4735(rendered)S +5125(image,)S +5436(and)S +6936 V +1260(these)S +1496(colors)S +1771(may)S +1974(not)S +2132(be)S +2256(used)S +2469(or)S +2582(usually)S +2901(only)S +3109(correspond)S +3582(to)S +3690(a)S +3764(few)S +3943(small)S +4190(regions)S +4514(near)S +4715(the)S +4867(saturated)S +5257(cores)S +5497(of)S +7056 V +1260(bright)S +1529(objects.)S +7296 V +1260(You)S +1465(can)S +1636(eliminate)S +2041(this)S +2219(problem)S +2585(by)S +2718(setting)S +3018(the)S +10 I +3173(basePixel)S +10 R +3594(resource)S +3965(to)S +4077(e.g.)S +4285(48)S +4419(instead)S +4736(of)S +4853(64,)S +5012(which)S +5290(will)S +5480(let)S +7776 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(21)S +7920 V +EP +%%Page: 22 23 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(the)S +1428(gterm)S +1707(widget)S +2025(allocate)S +2381(all)S +2527(200)S +2723(colors.)S +3068(However,)S +3504(this)S +3695(isn't)S +3918(recommended)S +4528(for)S +4689(normal)S +5017(use)S +5195(as)S +5323(it)S +5424(will)S +1080 V +1260(increase)S +1624(the)S +1784(likelihood)S +2228(of)S +2349(colormap)S +2764(\257ashing.)S +3174(If)S +3278(you)S +3466(change)S +10 I +3787(basePixel)S +10 R +4175(,)S +4239(either)S +4505(restart)S +4793(the)S +4954(X)S +5065(server)S +5347(or)S +5469(set)S +1200 V +1260(the)S +1418(resource)S +10 I +1791(cmapInitialize)S +10 R +2363(=)S +10 I +2419(True)S +10 R +2644(to)S +2758(force)S +2998(the)S +3156(gterm)S +3425(widget)S +3732(to)S +3845(update)S +4146(its)S +4276(global)S +4561(colormap)S +4973(resource)S +5345(in)S +5458(the)S +1320 V +1260(X)S +1362(server.)S +1690(The)S +1875(colormap)S +2282(resource)S +2649(may)S +2851(also)S +3042(be)S +3166(deleted)S +3484(by)S +3614(using)S +3861(the)S +4013(command)S +1524 V +10 I +1980(xprop)S +2243(-root)S +2473(-remove)S +2829(GT_image)S +1728 V +10 R +1260(These)S +1528(options)S +1853(may)S +2055(also)S +2246(be)S +2370(set)S +2511(on)S +2641(the)S +2793(command)S +3217(line)S +3397(when)S +3643(\256rst)S +3829(starting)S +4159(up.)S +1968 V +1260(In)S +1388(general)S +1726(one)S +1915(can)S +2098(set)S +2254(the)S +2421(Gterm)S +2721(widget)S +3039(resources)S +10 I +3461(basePixel)S +10 R +3895(and)S +10 I +4085(maxColors)S +10 R +4570(to)S +4694(specify)S +5028(the)S +5196(region)S +5497(of)S +2088 V +1260(colormap)S +1680(space)S +1944(to)S +2065(be)S +2202(used)S +2428(for)S +2587(image)S +2874(display.)S +3261(If)S +3370(you)S +3563(set)S +10 I +3717(maxColors)S +10 R +4199(to)S +4320(a)S +4407(small)S +4667(value,)S +4951(the)S +5116(200)S +5308(logical)S +2208 V +1260(colors)S +1541(de\256ned)S +1872(by)S +2009(the)S +2168(widget)S +2477(will)S +2670(be)S +2801(mapped)S +3154(by)S +3291(the)S +3450(imtool)S +3749(color)S +3991(model)S +4278(into)S +4471(whatever)S +4873(number)S +5215(of)S +5336(colors)S +2328 V +1260(are)S +1417(actually)S +1769(available)S +2165(to)S +2279(the)S +2437(widget.)S +2800(For)S +2974(example,)S +3372(in)S +3485(the)S +3642(default)S +3954(setup,)S +4225(200)S +4410(color)S +4650(values)S +4940(are)S +5096(really)S +5358(being)S +2448 V +1260(mapped)S +1606(into)S +1792(192)S +1972(color)S +2207(cells)S +2420(used)S +2633(for)S +2779(display,)S +3123(the)S +3275(remaining)S +3710(colors)S +3984(are)S +4135(used)S +4348(for)S +4494(buttons,)S +4845(menus)S +5137(etc)S +5284(and)S +5459(are)S +2568 V +1260(allocated)S +1650(from)S +1874(the)S +2026(default)S +2333(colormap)S +2740(by)S +2870(the)S +3022(X)S +3124(toolkit)S +3416(when)S +3662(the)S +3814(application)S +4288(starts)S +4529(up.)S +2808 V +1260(Even)S +1501(though)S +1815(the)S +1973(Gterm)S +2264(widget)S +2572(uses)S +2780(a)S +2860(private)S +3174(colormap,)S +3613(it)S +3706(is)S +3810(a)S +3891(private)S +10 I +4205(global)S +10 R +4498(colormap)S +4912(meaning)S +5293(that)S +5480(all)S +2928 V +1260(Gterm)S +1550(widgets)S +1896(share)S +2141(the)S +2298(same)S +2537(colormap.)S +3003(An)S +3159(example)S +3531(of)S +3648(colormap)S +4059(sharing)S +4387(in)S +4499(ximtool)S +4845(is)S +4946(the)S +5102(main)S +5336(image)S +3048 V +1260(window)S +1619(and)S +1800(the)S +1959(colorbar)S +2328(window.)S +2742(These)S +3017(are)S +3175(two)S +3362(separate)S +3725(gterm)S +3995(widgets)S +4343(that)S +4530(share)S +4777(the)S +4936(same)S +5178(colormap.)S +3168 V +1260(They)S +1506(have)S +1735(to)S +1854(share)S +2105(the)S +2268(same)S +2514(colormap,)S +2957(as)S +3080(otherwise)S +3508(when)S +3764(you)S +3954(windowed)S +4410(the)S +4572(main)S +4812(image)S +5096(window)S +5458(the)S +3288 V +1260(colorbar)S +1630(window)S +1990(would)S +2278(not)S +2444(accurately)S +2891(re\257ect)S +3178(the)S +3338(modi\256ed)S +3732(colormap.)S +4203(By)S +4359(default)S +4675(two)S +4864(separate)S +5229(ximtools)S +3408 V +1260(would)S +1556(also)S +1763(share)S +2019(the)S +2186(same)S +2436(colormap)S +2858(meaning)S +3247(contrast)S +3608(enhancements)S +4218(in)S +4341(one)S +4530(window)S +4897(would)S +5192(a)S +5236 H + (f)show 10 -.5 mul h (f)show +10 R +5297(ect)S +5458(the)S +3528 V +1260(other.)S +1563(By)S +1723(resetting)S +2110(the)S +10 I +2275(cmapName)S +10 R +2767(command)S +3204(line)S +3397(option)S +3696(or)S +3822(resource)S +4203(you)S +4397(can)S +4579(change)S +4905(the)S +5071(name)S +5331(of)S +5458(the)S +3648 V +1260(private)S +1582(colormap)S +2004(used)S +2232(causing)S +2582(separate)S +2953(ximtools)S +3349(to)S +3472(use)S +3650(di)S +3728 H + (f)show 10 -.5 mul h (f)show +10 R +3789(erent)S +4033(colormaps,)S +4519(but)S +4692(note)S +4909(this)S +5099(also)S +5304(creates)S +3768 V +1260(colormap)S +1671(\257ashing)S +2022(between)S +2388(the)S +2544(two)S +2728(windows)S +3123(that)S +3307(cannot)S +3607(easily)S +3874(be)S +4002(avoided.)S +4407(By)S +4559(setting)S +4861(the)S +10 I +5018(cmapName)S +10 R +5502(to)S +3888 V +1260("default")S +1649(the)S +1801(widget)S +2103(will)S +2289(allocate)S +2629(colors)S +2903(from)S +3127(the)S +3279(default)S +3586(colormap,)S +4018(but)S +4176(this)S +4351(is)S +4448(of)S +4561(little)S +4775(use)S +4938(at)S +5040(the)S +5192(moment.)S +4128 V +1260(There)S +1524(are)S +1677(a)S +1753(number)S +2090(of)S +2205(other)S +2442(resources)S +2850(that)S +3032(can)S +3202(be)S +3328(used)S +3543(to)S +3653(modify)S +3974(the)S +4129(behavior)S +4511(of)S +4627(the)S +4782(Gterm)S +5070(widget)S +5375(color)S +4248 V +1260(management)S +1801(scheme,)S +2156(but)S +2315(these)S +2551(are)S +2703(the)S +2856(most)S +3082(useful)S +3356(ones.)S +3624(For)S +3793(question)S +4162(and)S +4336(further)S +4637(information)S +5139(feel)S +5318(free)S +5502(to)S +4368 V +1260(contact)S +10 I +1578(iraf@noao.edu)S +10 R +2184(.)S +4776 V +9 B +900(DISPLAY)S +1322(CLIENT)S +1694(CONNECTIONS)S +4896 V +10 R +1260(XImtool)S +1629(allows)S +1920(display)S +2239(clients)S +2530(to)S +2638(connect)S +2978(in)S +3086(any)S +3260(of)S +3373(the)S +3525(following)S +3944(ways:)S +5064 V +10 B +1260(\256fo)S +1429(pipes)S +5184 V +10 R +1510(The)S +1706(traditional)S +2158(approach.)S +2589(The)S +2785(default)S +3103(global)S +3394(/dev/imt1[io])S +3963(pipes)S +4215(may)S +4428(be)S +4564(used,)S +4814(or)S +4939(a)S +5025(private)S +5344(set)S +5497(of)S +5304 V +1510(\256fos)S +1728(can)S +1906(be)S +2040(speci\256ed)S +2435(using)S +2692(the)S +10 I +2854(-\256fo)S +10 R +3055(command)S +3489(line)S +3678(argument)S +4094(or)S +10 Y +4216(*)S +10 I +4266(\256fo)S +10 R +4433(resource.)S +4864(Values)S +5180(should)S +5486(be)S +5424 V +1510(speci\256ed)S +1895(as)S +2008(the)S +2160(root)S +2351(pathname)S +2769(to)S +2877(a)S +2951(pair)S +3136(of)S +3250(\256fo)S +3420(pipes)S +3662(whose)S +3948(last)S +4118(character)S +4513(is)S +4611('i')S +4736(or)S +4850('o',)S +5052(these)S +5288(charac-)S +5544 V +1510(ters)S +1687(will)S +1876(be)S +2003(added)S +2274(automatically)S +2851(when)S +3100(opening)S +3455(the)S +3610(pipes.)S +3909(For)S +4081(example,)S +4477(to)S +4587(use)S +4752(the)S +4906(default)S +5215(pipes)S +5458(the)S +5664 V +1510(path)S +1712(would)S +1992(be)S +2116(speci\256ed)S +2501(as)S +2614(simply)S +2917("/dev/imt1".)S +3438(A)S +3540(value)S +3786(of)S +3899("none")S +4205(disables)S +4557(this)S +4732(connection.)S +5832 V +10 B +1260(tcp/ip)S +1535(sockets)S +5952 V +10 R +1510(Clients)S +1836(connect)S +2188(via)S +2352(a)S +2438(tcp/ip)S +2708(socket.)S +3030(The)S +3227(default)S +3546(port)S +3749(is)S +10 I +3858(5137)S +10 R +4058(,)S +4125(or)S +4250(a)S +4337(custom)S +4669(port)S +4873(may)S +5088(be)S +5225(speci\256ed)S +6072 V +1510(using)S +1758(the)S +10 I +1911(-port)S +10 R +2142(command)S +2567(line)S +2747(switch)S +3038(or)S +3151(a)S +10 Y +3225(*)S +10 I +3275(port)S +10 R +3472(resource.)S +3864(This)S +4072(permits)S +4402(connecting)S +4870(to)S +4978(the)S +5130(server)S +5403(over)S +6192 V +1510(a)S +1584(remote)S +1891(network)S +2248(connection)S +2716(anywhere)S +3133(on)S +3263(the)S +3415(Internet.)S +3780(A)S +3883(port)S +4075(number)S +4411(of)S +4525(0)S +4606(\(zero\))S +4874(disables)S +5227(this)S +5403(con-)S +6312 V +1510(nection.)S +6480 V +10 B +1260(unix)S +1480(domain)S +1833(sockets)S +6600 V +10 R +1510(Like)S +1733(a)S +1817(tcp/ip)S +2085(socket,)S +2405(but)S +2573(limited)S +2898(to)S +3017(a)S +3102(single)S +3382(host)S +3590(system.)S +3934(Usually)S +4286(faster)S +4548(than)S +4761(a)S +4846(tcp/ip)S +5115(socket,)S +5436(and)S +6720 V +1510(comparable)S +2008(to)S +2119(a)S +2196(\256fo.)S +2393(By)S +2543(default)S +2853(each)S +3068(user)S +3267(gets)S +3460(their)S +3675(own)S +3879(unix)S +4089(domain)S +4421(socket,)S +4733(so)S +4854(this)S +5031(option)S +5319(allows)S +6840 V +1510(multiple)S +1882(users)S +2125(to)S +2241(run)S +2413(ximtools)S +2803(on)S +2942(the)S +3103(same)S +3347(host)S +3553(without)S +3898(having)S +4209(to)S +4326(customize)S +4770(things.)S +5109(The)S +5303(default)S +6960 V +1510(value)S +1761(is)S +1863("/tmp/.IMT%d",)S +2558(other)S +2798(sockets)S +3126(may)S +3332(be)S +3460(de\256ned)S +3788(using)S +4039(the)S +10 I +4195(-unix)S +10 R +4434(command)S +4862(line)S +5046(switch)S +5341(or)S +5458(the)S +7080 V +10 Y +1510(*)S +10 I +1560(unixaddr)S +10 R +1953(resource.)S +2377(Legal)S +2636(values)S +2923(should)S +3222(be)S +3348(speci\256ed)S +3735(as)S +3850(a)S +3926(\256lename)S +4302(to)S +4412(be)S +4538(used)S +4753(for)S +4901(the)S +5056(socket,)S +5369(up)S +5502(to)S +7200 V +1510(two)S +1693("%d")S +1941(\256elds)S +2190(are)S +2343(allowed)S +2691(and)S +2867(will)S +3055(be)S +3181(replaced)S +3550(by)S +3682(the)S +3836(userid.)S +4137(An)S +4291(empty)S +4573(string)S +4833(value)S +5081(disables)S +5435(this)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(22)S +7920 V +EP +%%Page: 23 24 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(connection.)S +1200 V +1510(By)S +1657(default)S +1964(ximtool)S +2306(listens)S +2592(simultaneously)S +3228(for)S +3374(client)S +3626(connections)S +4133(on)S +4263(all)S +4394(three)S +4624(types)S +4866(of)S +4980(ports.)S +5296(Clients)S +1320 V +1510(may)S +1713(connect)S +2054(simultaneously)S +2691(by)S +2822(di)S +2900 H + (f)show 10 -.5 mul h (f)show +10 R +2961(erent)S +3190(means)S +3475(allowing)S +3855(up)S +3985(to)S +4093(three)S +4322(di)S +4400 H + (f)show 10 -.5 mul h (f)show +10 R +4461(erent)S +4690(displays)S +5048(to)S +5156(be)S +5280(loading)S +1440 V +1510(at)S +1612(the)S +1764(same)S +1999(time)S +2207(into)S +2393(di)S +2471 H + (f)show 10 -.5 mul h (f)show +10 R +2532(erent)S +2761(frames.)S +1848 V +9 B +1080(COMMUNICATIONS)S +1987(PROTOCOL)S +1968 V +10 R +1260(The)S +1448(communications)S +2142(protocol)S +2508(used)S +2724(is)S +2824(a)S +2901(slightly)S +3236(modi\256ed)S +3626(version)S +3954(of)S +4071(that)S +4255(used)S +4472(by)S +4606(the)S +4762(IIS)S +4918(Model)S +5213(70;)S +5375(other)S +2088 V +1260(more)S +1503(modern)S +1846(protocols)S +2256(will)S +2450(likely)S +2716(be)S +2848(supported)S +3280(in)S +3396(the)S +3556(future.)S +3887(The)S +4080(IIS)S +4239(protocol)S +4609(is)S +4713(basically)S +5105(a)S +5186(command)S +2208 V +1260(packet)S +1562(stream)S +1870(with)S +2090(a)S +2176(header)S +2483(describing)S +2941(the)S +3105(operation)S +3524(to)S +3644(be)S +3780(performed)S +4237(\(select)S +4539(frame,)S +4838(load)S +5052(display,)S +5409(read)S +2328 V +1260(cursor,)S +1564(etc\),)S +1768(and)S +1942(an)S +2066(optional)S +2424(data)S +2620(packet)S +2910(containing)S +3362(e.g.)S +3536(pixels.)S +2568 V +1260(Beginning)S +1712(with)S +1925(XImtool)S +2299(V1.3)S +2531(the)S +2688(protocol)S +3056(was)S +3246(modi\256ed)S +3637(even)S +3860(more)S +4100(to)S +4214(allow)S +4472(extra)S +4707(text)S +4893(at)S +5001(the)S +5159(end)S +5339(of)S +5458(the)S +2688 V +1260(WCS)S +1515(string)S +1781(to)S +1897(de\256ne)S +2179(image)S +2461(mappings)S +2888(and)S +3070(to)S +3186(better)S +3451(support)S +3789(multiple)S +4161(world)S +4431(coordinate)S +4889(systems)S +5243(within)S +5536(a)S +2808 V +1260(frame.)S +1612(For)S +1786(backwards)S +2247(compatability)S +2832(none)S +3061(of)S +3179(the)S +3336(existing)S +3688(IIS)S +3845(protocols)S +4252(were)S +4480(modi\256ed)S +4871(completely,)S +5375(how-)S +2928 V +1260(ever)S +1467(we)S +1619(take)S +1821(advantage)S +2261(of)S +2380(unused)S +2699(registers)S +3073(to)S +3187(\257ag)S +3373(the)S +3531(new)S +3733(features)S +4084(in)S +4198(existing)S +4551(functions)S +4958(\(like)S +5176(read/write)S +3048 V +1260(WCS\).)S +1572(The)S +1764(WCS)S +2018(mapping)S +2405(changes)S +2763(required)S +3132(only)S +3347(that)S +3534(the)S +3693(unused)S +4013('x')S +4166(register)S +4503(be)S +4635(set)S +4784(to)S +4900(indicate)S +5254(the)S +5414(new)S +3168 V +1260(behavior)S +1639(was)S +1824(desired,)S +2167(e.g.)S +2341(the)S +2493(wcs)S +2678(text)S +2858(containing)S +3310(the)S +3462(extra)S +3691(mapping)S +4071(data.)S +3408 V +1260(We)S +1444(also)S +1651(added)S +1935(two)S +2131(new)S +2343(WCS)S +2606(calls)S +2835(that)S +3031(allow)S +3299(us)S +3434(to)S +3558(query)S +3831(the)S +4000(WCS)S +4264(version,)S +4630(or)S +4760(query)S +5034(a)S +5125(WCS)S +5389(by)S +5536(a)S +3528 V +1260(speci\256c)S +1602(number)S +1944(corresponding)S +2552(to)S +2667(a)S +2748(mapping.)S +3190(The)S +3382(WCS)S +3636(version)S +3967(query)S +4231(will)S +4423(return)S +4697(a)S +4777(string)S +5041(such)S +5260(as)S +5379("ver-)S +3648 V +1260(sion=10")S +1654(which)S +1928(can)S +2096(be)S +2220(parsed)S +2510(by)S +2640(the)S +2792(client)S +3044(to)S +3152(get)S +3304(a)S +3378(version)S +3702(number)S +4037('10')S +4233(\(corresponding)S +4867(to)S +4975(version)S +5299(1.0\).)S +3888 V +1260(Because)S +1634(of)S +1759(the)S +1923(added)S +2203(mapping)S +2595(text)S +2787(the)S +2951(WCS)S +3210(string)S +3480(length)S +3772(was)S +3969(increased)S +4387(from)S +4623(320)S +4815(to)S +4936(1024)S +5179(bytes,)S +5458(the)S +4008 V +1260(string)S +1518(length)S +1798(used)S +2011(internally)S +2424(depends)S +2781(on)S +2911(whether)S +3262(the)S +3414('x')S +3560(register)S +3889(has)S +4052(been)S +4270(set.)S +4248 V +1260(Support)S +1616(for)S +1771(the)S +1933(full)S +2112(16)S +2252(frames)S +2563(allowed)S +2919(by)S +3059(the)S +3221(bit-\257ag)S +3550('z')S +3700(register)S +4039(in)S +4157(the)S +4319(IIS)S +4481(header)S +4786(packet)S +5086(required)S +5458(the)S +4368 V +1260(masking)S +1631(values)S +1918(be)S +2044(changed)S +2408(at)S +2512(various)S +2838(places)S +3119(in)S +3229(the)S +3383(code.)S +3658(This)S +3868(was)S +4055(more)S +4291(a)S +4366(limitation)S +4787(of)S +4901(the)S +5054(initial)S +5319(imple-)S +4488 V +1260(mentation)S +1690(than)S +1892(a)S +1966(required)S +2328(change)S +2640(to)S +2748(the)S +2900(protocol.)S +4728 V +1260(A)S +1362(complete)S +1758(summary)S +2160(of)S +2273(the)S +2425(XImtool)S +2794(IIS)S +2946(protocol)S +3309(implementation)S +3967(follows.)S +5136 V +9 B +1080(IIS)S +1227(PROTOCOL)S +1769(SUMMARY)S +5256 V +10 R +1260(All)S +1427(operations)S +1882(are)S +2042(initiated)S +2409(by)S +2548(sending)S +2898(a)S +2981(header)S +3285(packet)S +3584(containing)S +4046(a)S +10 I +4130(thing)S +4376(id)S +10 R +4494(\(tid\))S +4706(and)S +10 I +4890(subunit)S +10 R +5225(selecting)S +5376 V +1260(the)S +1413(function)S +1776(to)S +1884(be)S +2008(performed,)S +2478(optionally)S +2914(followed)S +3299(by)S +3429(data)S +3625(up)S +3755(to)S +3863(32Kb)S +4115(long.)S +4378(The)S +4563(IIS)S +4715(header)S +5010(packet)S +5300(used)S +5513(is)S +5496 V +1260(de\256ned)S +1584(as)S +5616 V +10 C +1980(struct)S +2460(iism70)S +2880({)S +5736 V +2340(short)S +2820(tid;)S +5856 V +2340(short)S +2820(thingct;)S +5976 V +2340(short)S +2820(subunit;)S +6096 V +2340(short)S +2820(checksum;)S +6216 V +2340(short)S +2820(x,)S +3000(y,)S +3180(z;)S +6336 V +2340(short)S +2820(t;)S +6456 V +1980(};)S +6696 V +10 R +1260(The)S +10 I +1447(thing)S +1685(count)S +10 R +1939(\256eld)S +2149(contains)S +2514(the)S +2668(negative)S +3038(number)S +3375(of)S +3490(bytes)S +3733(of)S +3848(data)S +4046(that)S +4228(will)S +4417(be)S +4544(sent)S +4738(following)S +5160(the)S +5315(header)S +6816 V +1260(packet.)S +1605(The)S +1790(IIS)S +1942(header)S +2237(checksum)S +2666(is)S +2763(computed)S +3187(as)S +7056 V +10 C +1500(checksum)S +2040(=)S +2160(0177777)S +2640(-)S +2760(\(tid)S +3060(+)S +3180(subunit)S +3660(+)S +3780(thingct)S +4260(+)S +4380(x)S +4500(+)S +4620(y)S +4740(+)S +4860(z)S +4980(+)S +5100(t\);)S +7296 V +10 R +1260(The)S +1447(four)S +1645(IIS)S +1799(registers)S +2169(are)S +2322(set)S +2465(di)S +2543 H + (f)show 10 -.5 mul h (f)show +10 R +2604(erently)S +2913(depending)S +3361(on)S +3493(the)S +3647(operation,)S +4081(a)S +4158(summary)S +4563(of)S +4679(the)S +4834(header)S +5132(packets)S +5464(for)S +7776 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(23)S +7920 V +EP +%%Page: 24 25 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(each)S +1472(operation)S +1879(is)S +1976(summarized)S +2494(below.)S +1200 V +10 B +2795(IIS)S +2959(Header)S +3305(Packet)S +3623(Summary)S +1320 V +10 R +2530(TID)S +3436(Subunit)S +4136(Tct)S +4439(X)S +4661(Y)S +4930(Z)S +5235(T)S +5514(Data)S +1340 V +10 Y1 +2083(2)S +2123(2222222222222222222222222222222222222222222222222222222222222222222222222)S +1460 V +10 R +1260(Read)S +1495(Data)S +2158(IIS_READ)S +10 B +2602(|)S +10 R +2624(PACKED)S +3218(MEMORY)S +4117(-NB)S +4450(x)S +4672(y)S +4883(fr)S +5188(-)S +5493(NB)S +1580 V +1260(Write)S +1517(Data)S +2158(IIS_WRITE)S +10 B +2646(|)S +10 R +2668(PACKED)S +3218(MEMORY)S +4117(-NB)S +4450(x)S +4672(y)S +4883(fr)S +5188(-)S +5493(NB)S +1700 V +1260(Read)S +1495(Cursor)S +2158(IIS_READ)S +3218(IMCURSOR)S +4186(-)S +4458(-)S +4680(-)S +4883(-)S +5188(-)S +5493(-)S +1820 V +1260(Write)S +1517(Cursor)S +2158(IIS_WRITE)S +3218(IMCURSOR)S +4186(-)S +4450(x)S +4672(y)S +4883(wcs)S +5188(-)S +5493(-)S +1940 V +1260(Set)S +1418(Frame)S +2158(IIS_WRITE)S +3218(LUT)S +10 B +3412(|)S +10 R +3434(COMMAND)S +4161(-1)S +4458(-)S +4680(-)S +4883(-)S +5188(-)S +5493(2)S +2060 V +1260(Erase)S +1511(Frame)S +2158(IIS_WRITE)S +10 B +2676(|)S +10 R +2728(fb)S +3218(FEEDBACK)S +4186(-)S +4458(-)S +4680(-)S +4883(fr)S +5188(-)S +5493(-)S +2300 V +1260(Old)S +1440(Write)S +1697(WCS)S +2158(IIS_WRITE)S +10 B +2646(|)S +10 R +2668(PACKED)S +3218(WCS)S +4150(-N)S +4458(-)S +4680(-)S +4883(fr)S +5188(fb)S +5493(320)S +2420 V +1260(Old)S +1440(Read)S +1675(WCS)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4458(-)S +4680(-)S +4883(fr)S +5188(wcs)S +5493(320)S +2660 V +1260(WCS)S +1507(Version?)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4450(1)S +4672(1)S +4883(-)S +5188(-)S +5493(320)S +2780 V +1260(WCS)S +1507(by)S +1637(Number?)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4450(1)S +4680(-)S +4883(fr)S +5188(wcs)S +5493(1024)S +2900 V +1260(New)S +1478(Write)S +1735(WCS)S +2158(IIS_WRITE)S +10 B +2646(|)S +10 R +2668(PACKED)S +3218(WCS)S +4150(-N)S +4450(1)S +4680(-)S +4883(fr)S +5188(fb)S +5493(1024)S +3020 V +1260(New)S +1478(Read)S +1713(WCS)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4450(1)S +4680(-)S +4883(fr)S +5188(wcs)S +5493(1024)S +3040 V +10 Y1 +2083(2)S +2123(2222222222222222222222222222222222222222222222222222222222222222222222222)S +2083(1)S +2940 V +2083(1)S +2840 V +2083(1)S +2740 V +2083(1)S +2640 V +2083(1)S +2540 V +2083(1)S +2440 V +2083(1)S +2340 V +2083(1)S +2240 V +2083(1)S +2140 V +2083(1)S +2040 V +2083(1)S +1940 V +2083(1)S +1840 V +2083(1)S +1740 V +2083(1)S +1640 V +2083(1)S +1540 V +2083(1)S +1440 V +2083(1)S +3040 V +3143(1)S +2940 V +3143(1)S +2840 V +3143(1)S +2740 V +3143(1)S +2640 V +3143(1)S +2540 V +3143(1)S +2440 V +3143(1)S +2340 V +3143(1)S +2240 V +3143(1)S +2140 V +3143(1)S +2040 V +3143(1)S +1940 V +3143(1)S +1840 V +3143(1)S +1740 V +3143(1)S +1640 V +3143(1)S +1540 V +3143(1)S +1440 V +3143(1)S +3040 V +4042(1)S +2940 V +4042(1)S +2840 V +4042(1)S +2740 V +4042(1)S +2640 V +4042(1)S +2540 V +4042(1)S +2440 V +4042(1)S +2340 V +4042(1)S +2240 V +4042(1)S +2140 V +4042(1)S +2040 V +4042(1)S +1940 V +4042(1)S +1840 V +4042(1)S +1740 V +4042(1)S +1640 V +4042(1)S +1540 V +4042(1)S +1440 V +4042(1)S +3040 V +4364(1)S +2940 V +4364(1)S +2840 V +4364(1)S +2740 V +4364(1)S +2640 V +4364(1)S +2540 V +4364(1)S +2440 V +4364(1)S +2340 V +4364(1)S +2240 V +4364(1)S +2140 V +4364(1)S +2040 V +4364(1)S +1940 V +4364(1)S +1840 V +4364(1)S +1740 V +4364(1)S +1640 V +4364(1)S +1540 V +4364(1)S +1440 V +4364(1)S +3040 V +4586(1)S +2940 V +4586(1)S +2840 V +4586(1)S +2740 V +4586(1)S +2640 V +4586(1)S +2540 V +4586(1)S +2440 V +4586(1)S +2340 V +4586(1)S +2240 V +4586(1)S +2140 V +4586(1)S +2040 V +4586(1)S +1940 V +4586(1)S +1840 V +4586(1)S +1740 V +4586(1)S +1640 V +4586(1)S +1540 V +4586(1)S +1440 V +4586(1)S +3040 V +4808(1)S +2940 V +4808(1)S +2840 V +4808(1)S +2740 V +4808(1)S +2640 V +4808(1)S +2540 V +4808(1)S +2440 V +4808(1)S +2340 V +4808(1)S +2240 V +4808(1)S +2140 V +4808(1)S +2040 V +4808(1)S +1940 V +4808(1)S +1840 V +4808(1)S +1740 V +4808(1)S +1640 V +4808(1)S +1540 V +4808(1)S +1440 V +4808(1)S +3040 V +5113(1)S +2940 V +5113(1)S +2840 V +5113(1)S +2740 V +5113(1)S +2640 V +5113(1)S +2540 V +5113(1)S +2440 V +5113(1)S +2340 V +5113(1)S +2240 V +5113(1)S +2140 V +5113(1)S +2040 V +5113(1)S +1940 V +5113(1)S +1840 V +5113(1)S +1740 V +5113(1)S +1640 V +5113(1)S +1540 V +5113(1)S +1440 V +5113(1)S +3040 V +5418(1)S +2940 V +5418(1)S +2840 V +5418(1)S +2740 V +5418(1)S +2640 V +5418(1)S +2540 V +5418(1)S +2440 V +5418(1)S +2340 V +5418(1)S +2240 V +5418(1)S +2140 V +5418(1)S +2040 V +5418(1)S +1940 V +5418(1)S +1840 V +5418(1)S +1740 V +5418(1)S +1640 V +5418(1)S +1540 V +5418(1)S +1440 V +5418(1)S +3040 V +5773(1)S +2940 V +5773(1)S +2840 V +5773(1)S +2740 V +5773(1)S +2640 V +5773(1)S +2540 V +5773(1)S +2440 V +5773(1)S +2340 V +5773(1)S +2240 V +5773(1)S +2140 V +5773(1)S +2040 V +5773(1)S +1940 V +5773(1)S +1840 V +5773(1)S +1740 V +5773(1)S +1640 V +5773(1)S +1540 V +5773(1)S +1440 V +5773(1)S +3280 V +10 R +1260(Where)S +1675(NB)S +2459(=)S +2545(number)S +2880(of)S +2993(bytes)S +3234(expected)S +3618(or)S +3731(written)S +3400 V +1675(x)S +2459(=)S +2545(x)S +2625(position)S +2978(of)S +3091(operation)S +3498(in)S +3606(frame)S +3868(bu)S +3968 H + (f)show 10 -.5 mul h (f)show +10 R +4029(er)S +4136(coords)S +3520 V +1675(y)S +2459(=)S +2545(y)S +2625(position)S +2978(of)S +3091(operation)S +3498(in)S +3606(frame)S +3868(bu)S +3968 H + (f)show 10 -.5 mul h (f)show +10 R +4029(er)S +4136(coords)S +3640 V +1675(fr)S +2459(=)S +2545(frame)S +2807(number)S +3142(\(passed)S +3471(as)S +3584(bit\257ag)S +3870(\(i.e.)S +4055(1,)S +4160(2)S +4240(,4)S +4345(8,)S +4450(etc\))S +3760 V +1675(fb)S +2459(=)S +2545(frame)S +2807(bu)S +2907 H + (f)show 10 -.5 mul h (f)show +10 R +2968(er)S +3075(con\256g)S +3355(number)S +3690(\(zero)S +3924(indexed\))S +3880 V +1675(N)S +2459(=)S +2545(length)S +2825(of)S +2938(WCS)S +3185(string)S +4000 V +1675(wcs)S +2459(=)S +2545(WCS)S +2792(number)S +3127(\(usually)S +3479(zero\))S +4120 V +1675(Data)S +2459(=)S +2545(the)S +2697(number)S +3032(of)S +3145(bytes)S +3386(of)S +3499(data)S +3695(to)S +3803(be)S +3927(read)S +4128(or)S +4241(written)S +4554(following)S +4973(the)S +5125(header)S +5420(packet.)S +4360 V +1675(IIS_WRITE)S +2489(=)S +2575(0400000)S +4480 V +1675(IIS_READ)S +2489(=)S +2575(0100000)S +4600 V +1675(COMMAND)S +2489(=)S +2575(0100000)S +4720 V +1675(PACKED)S +2489(=)S +2575(0040000)S +4840 V +1675(IMC_SAMPLE)S +2489(=)S +2575(0040000)S +5080 V +1675(MEMORY)S +2489(=)S +2575(001)S +5200 V +1675(LUT)S +2489(=)S +2575(002)S +5320 V +1675(FEEDBACK)S +2489(=)S +2575(005)S +5440 V +1675(IMCURSOR)S +2489(=)S +2575(020)S +5560 V +1675(WCS)S +2489(=)S +2575(021)S +5800 V +1260(TID)S +1463(\256elds)S +1717(can)S +1892(be)S +2023(logically)S +2410(OR'd)S +2670(with)S +2886(the)S +3046(PACKED)S +3484(\257ag)S +3672(indicating)S +4110(the)S +4270(number)S +4613(of)S +4734(data)S +4938(bytes)S +5187(is)S +5292(exactly)S +5920 V +10 I +1260(thingct)S +10 R +1570(bytes)S +1813(long,)S +2048(otherwise)S +10 I +2468(thingct)S +10 R +2778(must)S +3005(be)S +3131(speci\256ed)S +3518(as)S +3632(half)S +3818(the)S +3971(number)S +4307(of)S +4421(data)S +4618(bytes.)S +4915(In)S +5029(a)S +5104(cursor)S +5384(read,)S +6040 V +1260(if)S +1353(the)S +1508(IIS_READ)S +1985(\257ag)S +2168(is)S +2268(OR'd)S +2523(with)S +2734(IMC_SAMPLE)S +3401(the)S +3556(logical)S +3861(cursor)S +4143(position)S +4499(\(i.e.)S +4717(the)S +4872(last)S +5044(value)S +5293(read)S +5497(or)S +6160 V +1260(set\))S +1445(is)S +1552(returned)S +1924(immediately,)S +2489(otherwise)S +2917(the)S +3079(server)S +3362(will)S +3558(wait)S +3770(for)S +3926(a)S +4010(keystroke)S +4438(to)S +4556(be)S +4690(hit)S +4836(before)S +5130(returning)S +5536(a)S +6280 V +1260(string)S +1519(containing)S +1972(the)S +2125(\(x,y\))S +2347(position,)S +2727(wcs)S +2914(of)S +3029(the)S +3183(read,)S +3411(and)S +3587(the)S +3741(keystroke.)S +4216(When)S +4486(setting)S +4785(the)S +4939(frame)S +5203(you)S +5385(must)S +6400 V +1260(send)S +1473(a)S +1547(short)S +1777(integer)S +2084(in)S +2192(the)S +2344(data)S +2540(containing)S +2992(the)S +3144(frame)S +3406(selected.)S +6688 V +9 B +900(ISM)S +1097(COMMUNICATIONS)S +6808 V +10 R +1260(The)S +1457(ISM)S +1677(\(Image)S +2001(Support)S +2360(Module\))S +2746(can)S +2926(be)S +3062(any)S +3248(external)S +3611(task)S +3814(which)S +4100(connects)S +4491(to)S +4611(XImtool)S +4993(over)S +5213(a)S +5300(socket.)S +6928 V +1260(Communications)S +1974(are)S +2125(limited)S +2439(to)S +2547(simple)S +2844(null-terminated)S +3490(text)S +3670(strings.)S +4022(In)S +4135(most)S +4360(cases)S +4600(these)S +4835(strings)S +5132(are)S +5283(just)S +5458(the)S +7048 V +1260(standard)S +1642(OBM)S +1914(messages)S +2335(sent)S +2540(to)S +2663(XImtool)S +3047(objects)S +3375(but)S +3548(can)S +3731(also)S +3937(include)S +4276(Tcl)S +4454(callback)S +4831(code)S +5064(\(either)S +5369(ISM-)S +7168 V +1260(speci\256c)S +1609(callbacks,)S +2049(procedures)S +2530(which)S +2818(can)S +3000(be)S +3137(added)S +3418(to)S +3539(the)S +3704(callback)S +4079(list)S +4245(for)S +4404(existing)S +4764(XImtool)S +5146(objects,)S +5497(or)S +7288 V +1260(even)S +1478(new)S +1674(GUI)S +1881(code)S +2099(to)S +2207(create)S +2474(panels)S +2759(and)S +2933(new)S +3129(objects\).)S +7768 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(24)S +7920 V +EP +%%Page: 25 26 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(ISM)S +1277(SOCKET)S +1679(CONNECTION)S +1080 V +10 R +1260(The)S +1482(ISM)S +1727(\256rst)S +1950(requests)S +2344(a)S +2455(connection)S +2960(to)S +3105(XImtool)S +3511(on)S +3678(a)S +3789(dedicated)S +4238(socket)S +4561(whose)S +4884(default)S +5229(value)S +5513(is)S +1200 V +1260("/tmp/.ISM%d",)S +1953(where)S +2234(the)S +2393('%d')S +2629(is)S +2733(replaced)S +3107(by)S +3244(the)S +3403(userid)S +3684(allowing)S +4071(multiple)S +4442(users)S +4684(on)S +4821(a)S +4902(machine)S +5277(to)S +5392(have)S +1320 V +1260(independent)S +1778(sockets.)S +2157(The)S +2343(XImtool)S +2713('ism_addr')S +3182(resource)S +3550(or)S +3664("-ismdev")S +4099(command-line)S +4707(option)S +4994(can)S +5163(be)S +5288(used)S +5502(to)S +1440 V +1260(change)S +1585(this)S +1773(address,)S +2140(a)S +2227(value)S +2486(of)S +2612('none')S +2915(will)S +3114(disable)S +3440(ISM)S +3661(communications.)S +4420(The)S +4618(socket)S +4916(may)S +5130(also)S +5333(be)S +5469(set)S +1560 V +1260(with)S +1468(an)S +1592(ISMDEV)S +2005(environment)S +2540(variable)S +2891(which)S +3165(will)S +3351(override)S +3713(the)S +3865(resource)S +4232(or)S +4345(command-line)S +4952(options.)S +1800 V +1260(Once)S +1502(a)S +1578(connection)S +2048(request)S +2368(is)S +2467(received,)S +2891(XImtool)S +3262(replies)S +3560(with)S +3770(a)S +3846(message)S +4217(telling)S +4506(the)S +4661(ISM)S +4872(to)S +4983(reconnect)S +5403(on)S +5536(a)S +1920 V +1260(di)S +1338 H + (f)show 10 -.5 mul h (f)show +10 R +1399(erent)S +1629(socket,)S +1940(it)S +2027(then)S +2229(frees)S +2452(the)S +2604(initial)S +2868(connection)S +3336(allowing)S +3716(multiple)S +4080(other)S +4315(ISMs)S +4562(to)S +4670(request)S +4988(their)S +5201(own)S +5403(con-)S +2040 V +1260(nection.)S +1652(The)S +1850(communications)S +2554(between)S +2929(XImtool)S +3311(and)S +3499(the)S +3665(ISM)S +3887(are)S +4052(carried)S +4372(out)S +4544(entirely)S +4893(over)S +5114(this)S +5303(second)S +2160 V +1260(negotiated)S +1723(socket.)S +2079(Once)S +2335(connected,)S +2810(the)S +2978(ISM)S +3202(appears)S +3552(as)S +3681(just)S +3872(another)S +4217(named)S +4529(object)S +4819(which)S +5109(can)S +5293(receive)S +2280 V +1260(OBM)S +1518(messages.)S +2568 V +9 B +1080(COMMUNICATIONS)S +1987(PROTOCOL)S +2688 V +10 R +1260(Messages)S +1679(from)S +1904(the)S +2057(ISM)S +2266(are)S +2418(written)S +2732(to)S +2841(the)S +2994(connection)S +3463(socket)S +3749(and)S +3924(must)S +4150(be)S +4275(preceeded)S +4709(by)S +4841(one)S +5017(of)S +5132(the)S +5286(follow-)S +2808 V +1260(ing)S +1418(keywords:)S +2976 V +10 B +1620(callback)S +10 R +2370(Negotiate)S +2788(a)S +2862(connection)S +3330(on)S +3460(another)S +3789(socket)S +3144 V +10 B +1620(ready)S +10 R +2370(Client)S +2645(is)S +2742(ready)S +2993(to)S +3101(begin)S +3353(processing)S +3312 V +10 B +1620(quit)S +10 R +2370(Client)S +2645(is)S +2742(shutting)S +3095(down)S +3347(and)S +3521(disconnecting)S +3480 V +10 B +1620(send)S +10 R +2370(Send)S +2600(a)S +2674(message)S +3042(to)S +3150(another)S +3479(object)S +3816 V +1260(Where)S +1555(messages)S +1962(are)S +2113(of)S +2226(the)S +2378(form:)S +3984 V +10 B +1620(connect)S +1977(<)S +10 I +2034(name)S +10 B +2250(>)S +10 R +3120(Request)S +3472(a)S +3546(connection)S +4014(for)S +4160(the)S +4312(<)S +10 I +4368(name)S +10 R +4584(>)S +4670(ISM)S +4152 V +10 B +1620(ready)S +1894(<)S +10 I +1951(name)S +10 B +2167(>)S +10 R +3120(Reconnection)S +3720(request)S +4060(for)S +4228(the)S +4402(<)S +10 I +4458(name)S +10 R +4674(>)S +4782(ISM)S +5012(on)S +5164(negotiated)S +4272 V +3120(socket,)S +3430(ISM)S +3638(is)S +3735(ready)S +3986(to)S +4094(processing.)S +4440 V +10 B +1620(send)S +1845(<)S +10 I +1902(obj)S +10 B +2030(>)S +2117('{')S +2252(<)S +10 I +2309(msg)S +10 B +2470(>)S +2557('}')S +10 R +3120(Send)S +3352(<)S +10 I +3408(msg)S +10 R +3569(>)S +3657(to)S +3767(the)S +3921(named)S +4219(<)S +10 I +4275(obj)S +10 R +4403(>.)S +4546(The)S +4733(message)S +5104(may)S +5309(be)S +5436(any)S +4560 V +3120(valid)S +3366(string)S +3640(that)S +3835(will)S +4036(be)S +4175(understood)S +4664(by)S +4809(the)S +4976(recipient.)S +5425(The)S +4680 V +3120(object)S +3394(may)S +3596(be)S +3720(any)S +3894(object)S +4168(in)S +4276(the)S +4428(GUI)S +4635(or)S +4748(OBM)S +5006(\(see)S +5196(below\).)S +4848 V +10 B +1620(quit)S +10 R +3120(ISM)S +3341(is)S +3451(shutting)S +3817(down.)S +4107(The)S +4306(named)S +4616(is)S +4727(determined)S +5220(from)S +5458(the)S +4968 V +3120(communications)S +3865(channel,)S +4284(ISM)S +4546(is)S +4697(responsible)S +5236(for)S +5436(any)S +5088 V +3120(cleanup)S +3460(of)S +3573(it's)S +3731(callbacks)S +4132(before)S +4416(issuing)S +4730(the)S +4882(shutdown.)S +5328 V +1260(All)S +1420(messages)S +1829(must)S +2056(be)S +2182(null-terminated.)S +2885(XImtool)S +3256(will)S +3445(bu)S +3545 H + (f)show 10 -.5 mul h (f)show +10 R +3606(er)S +3716(the)S +3871(text)S +4054(until)S +4271(a)S +4348(complete)S +4747(message)S +5118(is)S +5218(received.)S +5448 V +1260(Once)S +1500(an)S +1624(ISM)S +1832(client)S +2084(has)S +2247(delivered)S +2648(a)S +2722(QUIT)S +2990(message)S +3358(no)S +3488(further)S +3789(messages)S +4196(will)S +4382(be)S +4506(sent)S +4697(the)S +4849(that)S +5029(ISM.)S +5688 V +1260(In)S +1384(OBM)S +1653(terminology)S +2183(the)S +2346(ISM)S +2565(is)S +2673(a)S +2758(named)S +3065(Client)S +3351(class)S +3586(object,)S +3896(where)S +4180(the)S +4343(name)S +4600(is)S +4708(set)S +4860(in)S +4979(the)S +5142(connection)S +5808 V +1260(request.)S +1637(Messages)S +2058(sent)S +2252(to)S +2363(the)S +2518(ISM)S +2729(should)S +3029(use)S +3195(this)S +3373(name,)S +3647(messages)S +4057(sent)S +4251(to)S +4362("client")S +4699(are)S +4853(still)S +5037(interpreted)S +5502(to)S +5928 V +1260(mean)S +1506(the)S +1658(XImtool)S +2027(client.)S +6168 V +1260(The)S +1450(content)S +1779(of)S +1897(messages)S +2309(delivered)S +2715(to)S +2828(the)S +2985(ISM)S +3198(are)S +3354(totally)S +3645(free-form)S +4061(and)S +4240(may)S +4447(contain)S +4776(any)S +4955(text)S +5141(the)S +5299(ISM)S +5513(is)S +6288 V +1260(expected)S +1644(to)S +1752(understand.)S +6576 V +9 B +1080(GUI)S +1277(OBJECTS)S +6696 V +10 R +1260(While)S +1548(the)S +1714(ISM)S +1936(can)S +2118(send)S +2345(a)S +2433(message)S +2815(to)S +2938(any)S +3127(object)S +3416(in)S +3539(the)S +3706(task,)S +3937(there)S +4181(is)S +4293(a)S +4382(GUI)S +4604(Parameter)S +5053(object)S +5342(called)S +6816 V +1260('ism_msg')S +1723(designed)S +2113(especially)S +2547(to)S +2660(process)S +2994(messages)S +3406(from)S +3634(the)S +3790(ISM.)S +4057(The)S +4246(callback)S +4612(in)S +4724(the)S +4880(GUI)S +5091(is)S +5192(expecting)S +6936 V +1260(a)S +1334(message)S +1702(beginning)S +2132(with)S +2340(one)S +2514(of)S +2627(the)S +2779(following)S +3198(keywords:)S +7104 V +10 B +1620(source)S +10 R +2370(Source)S +2677(message)S +3045(text)S +3225(as)S +3338(Tcl)S +3501(code)S +7272 V +10 B +1620(alert)S +10 R +2370(Message)S +2749(contains)S +3112(error)S +3335(text)S +3515(to)S +3623(be)S +3747(displayed)S +4160(in)S +4268(the)S +4420(GUI)S +4627('alert')S +4900(box)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(25)S +7920 V +EP +%%Page: 26 27 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1620(deliver)S +10 R +2370(Message)S +2750(text)S +2931(should)S +3229(be)S +3354(passed)S +3651(to)S +3760(a)S +3835(callback)S +4198(routine)S +4512(speci\256c)S +4848(to)S +4957(that)S +5138(ISM.)S +5402(This)S +1080 V +2370(processing)S +2844(callback)S +3223(may)S +3442(have)S +3676(been)S +3910(previously)S +4378(uploaded.)S +4845(The)S +5046(message)S +5430(text)S +1200 V +2370(may)S +2572(be)S +2696(any)S +2870(form)S +3094(the)S +3246(processing)S +3703(callback)S +4065(is)S +4162(expected)S +4546(to)S +4654(understand.)S +1368 V +10 B +1620(info)S +10 R +2370(Message)S +2798(text)S +3027(is)S +3173(status)S +3480(output)S +3816(intended)S +4240(for)S +4436(the)S +4638(XImtool)S +5057('info')S +5364(panel)S +1488 V +2370(\(connect/disconnect)S +3198(requests,)S +3580(etc\))S +1728 V +1260(In)S +1373(all)S +1503(cases)S +1743(the)S +1895(message)S +2263(is)S +2360(expected)S +2744(to)S +2852(be)S +2976(of)S +3089(the)S +3241(form)S +1968 V +1525(<)S +10 I +1581(cmd)S +10 R +1747(>)S +1833(<)S +10 I +1889(ism_name)S +10 R +2294(>)S +2380([)S +2443(<)S +10 I +2499(arg1)S +10 R +2688(>)S +2774(<)S +10 I +2830(arg2)S +10 R +3019(>)S +3105(<...>)S +3322(])S +2208 V +1260(where)S +1539()S +1859(is)S +1962(one)S +2142(of)S +2261(the)S +2419(above)S +2693(keywords,)S +3142()S +3701(is)S +3804(the)S +3963(name)S +4216(of)S +4336(the)S +4495(ISM)S +4710(sending)S +5058(the)S +5217(message.)S +2328 V +1260(The)S +1447(remainder)S +1883(of)S +1998(the)S +2152(message)S +2522(is)S +2621(passed)S +2919(as)S +3034(an)S +3160('argv')S +3435(list)S +3590(to)S +3700(the)S +3854(processing)S +4313(callback)S +4677(uploaded)S +5075(for)S +5223(the)S +5377(ISM.)S +2448 V +1260(The)S +1445(ISM)S +1653(is)S +1750(responsible)S +2235(for)S +2381(formatting)S +2833(these)S +3068(messages.)S +2856 V +9 B +900(ENVIRONMENT)S +2976 V +10 B +1260(HOME)S +10 R +2760(Speci\256es)S +3151(user)S +3347(login)S +3583(directory)S +3084 V +10 B +1260(DISPLAY)S +10 R +2760(Speci\256es)S +3151(which)S +3425(display)S +3744(screen)S +4028(to)S +4136(use)S +3192 V +10 B +1260(IMTOOLRC)S +1857(or)S +1981(imtoolrc)S +10 R +2760(Frame)S +3045(bu)S +3145 H + (f)show 10 -.5 mul h (f)show +10 R +3206(er)S +3313(con\256guration)S +3876(\256le)S +3300 V +10 B +1260(ISMDEV)S +10 R +2760(ISM)S +2968(Connection)S +3459(socket)S +3588 V +10 B +1260(DEBUG_IIS)S +10 R +2760(Debug)S +3056(IIS)S +3208(communications)S +3899(packets)S +3696 V +10 B +1260(DEBUG_ISM)S +10 R +2760(Debug)S +3056(ISM)S +3264(communications)S +3955(packets)S +3804 V +10 B +1260(DEBUG_MAPPINGS)S +10 R +2760(Debug)S +3056(WCS)S +3303(image)S +3577(mappings)S +4032 V +9 B +900(FILES)S +4152 V +10 B +1260(/usr/local/lib/imtoolrc)S +10 R +2760(Default)S +3089(frame)S +3351(bu)S +3451 H + (f)show 10 -.5 mul h (f)show +10 R +3512(er)S +3619(con\256guration)S +4182(\256le)S +4260 V +10 B +1260(/usr/local/lib/ximprint.cfg)S +10 R +2760(Default)S +3089(printer)S +3385(con\256guration)S +3948(\256le)S +4368 V +10 B +1260(/usr/local/lib/imtoolcmap)S +10 R +2760(Default)S +3089(colormap)S +3496(directory)S +4476 V +10 B +1260(/dev/imt1i)S +10 R +2760(Default)S +3089(input)S +3325(display)S +3644(\256fo)S +4584 V +10 B +1260(/dev/imt1o)S +10 R +2760(Default)S +3089(output)S +3375(display)S +3694(\256fo)S +4692 V +10 B +1260(/tmp/.IMT%d)S +10 R +2760(Default)S +3089(unix)S +3297(display)S +3616(socket)S +4800 V +10 B +1260(/tmp/.ISM%d)S +10 R +2760(Default)S +3089(unix)S +3297(ISM)S +3505(connection)S +3973(socket)S +5028 V +9 B +900(BUGS)S +5148 V +10 R +1260(Users)S +1517(should)S +1814(report)S +2082(bugs)S +2301(to)S +10 I +2409(iraf@noao.edu)S +10 R +3015(.)S +5436 V +9 B +900(SEE)S +1112(ALSO)S +5556 V +10 R +1260(xgterm\(1\),)S +1714(xtapemon\(1\))S +5844 V +9 B +900(COPYRIGHT)S +5964 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(26)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier Symbol Troff +%%Pages: 27 + \ No newline at end of file diff --git a/vendor/x11iraf/doc/xtapemon.ps b/vendor/x11iraf/doc/xtapemon.ps new file mode 100644 index 00000000..bab4ba17 --- /dev/null +++ b/vendor/x11iraf/doc/xtapemon.ps @@ -0,0 +1,361 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.09 +%%CreationDate: Sat Apr 5 14:54:31 1997 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.09 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.09 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(XT)72 48 Q 332.94(APEMON\(1\) XT)-.93 F +(APEMON\(1\))-.93 E/F1 9/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0(XT) +108 96 Q +(apemon \255 magtape I/O status monitor and display utility for IRAF)-.8 +E F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(xtapemon)108 124.8 Q F0 +<5bad>2.5 E/F3 10/Times-Italic@0 SF(toolkitoption)A F0(...] [)2.5 E F3 +(-port)2.5 E F0( ] [)2.5 E F32.5 E F0 2.5(][)2.5 G F3(-d)A +F0(])2.5 E F1(OPTIONS)72 141.6 Q F0(In addition to the X T)108 153.6 Q +(oolkit options, the follo)-.8 E(wing are supported:)-.25 E F2(-port)108 +170.4 Q F3(port)2.5 E F0 +(Set the primary port to listen on for client connections.)133 182.4 Q +(The def)5 E(ault is 5138.)-.1 E F2(-a)108 199.2 Q F0 +(Listen on alternate port, this is the primary port number plus one.) +16.67 E(The def)5 E(ault is 5139.)-.1 E F2(-d)108 216 Q F0(Deb)16.11 E +(ug mode, pass client message to the standard out.)-.2 E(The def)5 E +(ault is f)-.1 E(alse.)-.1 E F1 2.25(XR)72 244.8 S(ESOURCES)-2.25 E F2 +(XT)108 256.8 Q(apemon)-.92 E F0 .551 +(options can appear on the command line or in your X resource \214le.) +3.051 F .55(Options on the command)5.55 F(line supercede v)108 268.8 Q +(alues speci\214ed in your X resource \214le.)-.25 E F2(port)108 297.6 Q +F0(Set the primary port to listen on for client connections.)41.67 E +(The def)5 E(ault is 5138.)-.1 E F2(alter)108 314.4 Q(nate)-.15 E F0 +(Listen on alternate port, this is the primary port number plus one.) +21.83 E(The def)5 E(ault is 5139.)-.1 E F2(deb)108 331.2 Q(ug)-.2 E F0 +(Deb)34.08 E(ug mode, pass client message to the standard out.)-.2 E +(The def)5 E(ault is f)-.1 E(alse.)-.1 E F1(DESCRIPTION)72 348 Q F0 .68 +(Xtapemon is a magtape status monitor and display utility)108 360 R 5.68 +(.Y)-.65 G .681(ou use it to display the status of a IRAF tape)-6.78 F +.746(job while it is running.)108 372 R .746(TCP/IP sock)5.746 F .746 +(ets are used for communication, so the IRAF tape job and xtapemon)-.1 F +.984(may be on the same host machine or on dif)108 384 R .984 +(ferent hosts.)-.25 F .985(All V2.10 v)5.985 F .985 +(ersions of IRAF support tape status)-.15 F 1.018(output \(including e) +108 396 R -.15(ve)-.25 G 3.517(nV).15 G 3.517(MS/IRAF\). F)-3.517 F +1.017(or e)-.15 F 1.017(xample, suppose our w)-.15 F 1.017 +(orkstation is named)-.1 F F3(cygnus)3.517 E F0 1.017(and we are)3.517 F +(running IRAF on host)108 408 Q F3 -.37(re)2.5 G(gulus)-.03 E F0 2.5(,u) +C(sing magtape de)-2.5 E(vice mta.)-.25 E +(The \214rst step is to start xtapemon on c)5 E(ygnus:)-.15 E 2.5(%x)128 +432 S(tapemon &)-2.5 E(Then in IRAF on re)108 456 Q +(gulus we might do the follo)-.15 E(wing:)-.25 E +(cl> set tapecap = ":so=c)128 480 Q(ygnus")-.15 E(cl> allocate mta)128 +492 Q(cl> re)128 504 Q(wind mta)-.25 E .578 +(At this point the IRAF magtape i/o dri)108 528 R -.15(ve)-.25 G 3.078 +(re).15 G -.15(xe)-3.228 G .578(cuting on re).15 F .579 +(gulus should open a connection to the xtapemon)-.15 F +(tape monitoring serv)108 540 Q(er running on c)-.15 E +(ygnus, and indicate that a re)-.15 E(wind operation is taking place.) +-.25 E .781(If both xtapemon and the IRAF tape job are running on the s\ +ame host then the hostname can be omitted,)108 564 R .552 +(e.g. "set tapecap = :so".)108 576 R .553 +(The use of "set tapecap" assumes that the def)5.552 F .553 +(ault IRAF tapecap is being used.)-.1 F(If)5.553 E(the user has a pri) +108 588 Q -.25(va)-.25 G(te tapecap, the syntax is).25 E +(cl> set tapecap = ":so=hostname")128 612 Q .247 +(In general you can append an)108 636 R 2.747(yn)-.15 G .247 +(umber of tapecap de)-2.747 F .247(vice capability o)-.25 F -.15(ve)-.15 +G .247(rrides \(the :xx \214elds\) to the tapecap).15 F(en)108 648 Q +(vironment speci\214cation.)-.4 E(Alternati)5 E -.15(ve)-.25 G(ly).15 E +2.5(,t)-.65 G(he :so can be speci\214ed on the command line, e.g.)-2.5 E +(cl> re)128 672 Q(wind "mta[:so=c)-.25 E(ygnus]")-.15 E +(But in general it will be more con)108 696 Q -.15(ve)-.4 G +(nient to use set tapecap.).15 E .251(It is safe to ha)108 720 R .551 +-.15(ve :)-.2 H .251(so \(status output\) enabled e).15 F -.15(ve)-.25 G +2.751(ni).15 G 2.751(ft)-2.751 G .252(here is no xtapemon serv)-2.751 F +2.752(er; IRAF)-.15 F .252(will try to mak)2.752 F 2.752(et)-.1 G(he) +-2.752 E(X11IRAF Project)72 768 Q(11 Dec 1996)137.62 E(1)203.45 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(XT)72 48 Q 332.94(APEMON\(1\) XT)-.93 F +(APEMON\(1\))-.93 E 1.227(connection b)108 84 R 1.227 +(ut will proceed without an)-.2 F 3.727(yi)-.15 G 1.227 +(ndication of an error if the status output connection cannot be)-3.727 +F(established.)108 96 Q .013(The amount of tape read or written in Mb w\ +ill be accurate only if the IRAF magtape dri)108 132 R -.15(ve)-.25 G +2.514(ra).15 G .014(ctually reads or)-2.514 F .073 +(writes all the data between the be)108 144 R .073 +(ginning of tape and the current position of the tape.)-.15 F .072 +(Hence, if one re)5.072 F(winds)-.25 E .184(the tape and then reads or \ +writes a number of tiles, the Mb used \214eld will be accurate.)108 156 +R .184(If ho)5.184 F(we)-.25 E -.15(ve)-.25 G 2.684(ro).15 G .184 +(ne does)-2.684 F 2.651(as)108 168 S .151(kip to a random \214le some) +-2.651 F .151(where f)-.25 F .151(ar do)-.1 F .15 +(wn on the tape, IRAF will not ha)-.25 F .45 -.15(ve r)-.2 H .15 +(ead the data and the tape used).15 F .736 +(\214eld will indicate only the data actually read or written.)108 180 R +-.15(Fo)5.737 G 3.237(re).15 G .737(xample, a re)-3.387 F .737 +(wind follo)-.25 F .737(wed by a)-.25 F/F1 10/Times-Italic@0 SF(mte) +3.237 E(xamine)-.2 E F0 .267 +(will reliably indicate the actual amount of data on the tape, lea)108 +192 R .267(ving the tape positioned to EO)-.2 F 4.246 -.74(T. I)-.4 H +2.766(fo).74 G .266(ne then)-2.766 F .696(appends ne)108 204 R 3.196 +<778c>-.25 G .696 +(les to the tape the tape used \214eld will still be accurate.)-3.196 F +.696(If ho)5.696 F(we)-.25 E -.15(ve)-.25 G 3.196(ro).15 G .697 +(ne pops in a ne)-3.196 F 3.197(wt)-.25 G(ape)-3.197 E +(and then appends a \214le at EO)108 216 Q 1.48 -.74(T, t)-.4 H +(ape used will be in).74 E -.25(va)-.4 G(lid as the dri).25 E .3 -.15 +(ve w)-.25 H(ill rapidly skip forw).15 E(ard to the EO)-.1 E -.74(T.)-.4 +G/F2 9/Times-Bold@0 SF(AD)72 244.8 Q -1.215(VA)-.36 G(NCED USA)1.215 E +(GE)-.495 E F0 .005(By def)108 256.8 R .004 +(ault xtapemon listens on the port 5138, called port A.)-.1 F .004 +(If when you start the xtapemon serv)5.004 F .004(er this port)-.15 F +.048(is already b)108 268.8 R(usy)-.2 E 2.548(,x)-.65 G .048(tapemon wi\ +ll automatically switch to port B instead \(the alternate port, 5139\).) +-2.548 F .049(This mak)5.049 F(es)-.1 E(it possible to monitor tw)108 +280.8 Q 2.5(ot)-.1 G(ape jobs at the same time.)-2.5 E .974(If you ha) +108 304.8 R 1.274 -.15(ve x)-.2 H .973(tapemon serv).15 F .973 +(ers running on tw)-.15 F 3.473(op)-.1 G .973 +(orts it will be necessary to tell the second IRAF tape job)-3.473 F +(what port to use, since the magtape dri)108 316.8 Q -.15(ve)-.25 G 2.5 +(rw).15 G(ill use port A by def)-2.5 E 2.5(ault. F)-.1 F(or e)-.15 E +(xample,)-.15 E(cl> set tapecap = ":so=c)128 340.8 Q(ygnus,5139" or)-.15 +E(cl> mte)128 352.8 Q(xamine "mta[:so=,5139]")-.15 E 1.423 +(If there is some problem using the b)108 376.8 R 1.423(uiltin port def) +-.2 F 1.423(aults you can use an)-.1 F 3.924(yp)-.15 G 1.424(ort you w) +-3.924 F 3.924(ant. The)-.1 F(follo)3.924 E(wing)-.25 E +(resources tell which port to use.)108 388.8 Q(XT)128 412.8 Q 58.7 +(apemon.port #)-.8 F(port A)2.5 E(XT)128 424.8 Q 40.38 +(apemon.alternate #)-.8 F(port B)2.5 E .146 +(Or you can specify the ports with the ar)108 448.8 R .145 +(gument "-port" or "-a" \(alternate\) on the command line when xtape-) +-.18 F(mon is started.)108 460.8 Q F2 -.09(BU)72 477.6 S(GS).09 E F0 +-1.1(Yo)108 489.6 S 2.69(uc)1.1 G(an')-2.69 E 2.69(tn)-.18 G .19 +(ecessarily trust displayed information such as the de)-2.69 F .19 +(vice type and tape type.)-.25 F .19(On most platforms)5.19 F 1.002 +(this information is tak)108 501.6 R 1.001 +(en from the tapecap entry for the de)-.1 F 1.001(vice, and the accurac) +-.25 F 3.501(yo)-.15 G 3.501(ft)-3.501 G 1.001(his information will) +-3.501 F .87 +(depend upon the diligence of your IRAF system adminstrator when the)108 +513.6 R 3.37(yc)-.15 G .87(on\214gured tapecap for your site)-3.37 F +(\(and on whether you use the correct logical de)108 525.6 Q +(vice name for the dri)-.25 E .3 -.15(ve a)-.25 H +(nd tape capacity you are using\).).15 E .404(Xtapemon tries to k)108 +549.6 R .403 +(eep track of the amount of tape used: the number of Mb \(me)-.1 F -.05 +(ga)-.15 G .403(bytes\) read or written is).05 F 1.953 +(displayed, along with the percent of the tape used.)108 561.6 R 1.953 +(Whether or not the percent used \214eld is accurate)6.953 F .73 +(depends upon a number of f)108 573.6 R 3.23(actors. First)-.1 F .729 +(the tape capacity gi)3.23 F -.15(ve)-.25 G 3.229(ni).15 G 3.229(nt) +-3.229 G .729(he tapecap \214le must match the actual)-3.229 F 1.336 +(tape being used.)108 585.6 R 1.336 +(Second, if data compression is in use on the dri)6.336 F -.15(ve)-.25 G +3.837(,x).15 G 1.337(tapemon will display the uncom-)-3.837 F +(pressed quantity of data written.)108 597.6 Q(On a compression dri)5 E +.3 -.15(ve p)-.25 H(ercent used can be greater than 100%!).15 E F2 +(SEE ALSO)72 614.4 Q F0(xgterm\(1\), ximtool\(1\))108 626.4 Q F2 +(COPYRIGHT)72 643.2 Q F0(Cop)108 655.2 Q +(yright\(c\) 1986 Association of Uni)-.1 E -.15(ve)-.25 G +(rsities for Research in Astronomy Inc.).15 E(X11IRAF Project)72 768 Q +(11 Dec 1996)137.62 E(2)203.45 E EP +%%Trailer +end +%%EOF diff --git a/vendor/x11iraf/guidemo/Notes b/vendor/x11iraf/guidemo/Notes new file mode 100644 index 00000000..1f868e76 --- /dev/null +++ b/vendor/x11iraf/guidemo/Notes @@ -0,0 +1,41 @@ + GUIDEMO + Design Notes + + +IMBROWSE + + imageShell TopLevelShell + panel Paned + form Form + imageTitle AsciiText + imageCloseButton Command + imagewin Gterm + + + imbrowse ApplicationShell + panel Paned + form Form + dirSelect MenuButton + dirMenu MenuShell + dir-list SmeBSB (., .., subdirs) + dirName AsciiText + helpButton Command + quitButton Command + viewport Viewport + imageList List + form + helpText + filesLabel + filesText + nextButton + prevButton + headerButton + displayButton + headerText + form + sectionLabel + sectionText + + + + diff --git a/vendor/x11iraf/guidemo/README b/vendor/x11iraf/guidemo/README new file mode 100644 index 00000000..38d4cd8a --- /dev/null +++ b/vendor/x11iraf/guidemo/README @@ -0,0 +1,6 @@ +GUIDEMO -- Demo IRAF GUI applications. These applications demonstrate how to +use the prototype widget server (xgterm) to build GUIs for IRAF applications. + + imbrowse Graphical image browser. Can navigate a directory + tree and list, display, and otherwise examine the + images therein. diff --git a/vendor/x11iraf/guidemo/frame.gui b/vendor/x11iraf/guidemo/frame.gui new file mode 100644 index 00000000..c6561a7a --- /dev/null +++ b/vendor/x11iraf/guidemo/frame.gui @@ -0,0 +1,70 @@ +# FRAME.GUI -- Test GUI for the frame and layout widgets. +# This gui can be run as "cl> hello gui=frame.gui". + +reset-server +appInitialize frame Frame { + *objects:\ + toplevel Frame frame\ + frame Layout panel\ + panel Frame label1_frame\ + label1_frame Label label1\ + panel Frame label2_frame\ + label2_frame Label label2\ + panel Command button1\ + panel Command button2 + + *background: gray + *foreground: black + + *frame.highlightThickness: 0 + *frame.frameWidth: 4 + *frame.frameType: chiseled + *frame.innerOffset: 5 + *frame.outerOffset: 5 + + *panel.debug: True + *panel.borderWidth: 0 + + *panel.layout: vertical {\ + 5 < +inf - 5 > \ + horizontal { \ + -1 \ + label1_frame < +inf * +inf > \ + -1 \ + } \ + 5 < +inf - 5 > \ + horizontal { \ + -1 \ + label2_frame < +inf * +inf > \ + -1 \ + } \ + 5 < +inf - 5 > \ + horizontal {\ + -1 < +inf > \ + button1 \ + 5 < +inf -5 > \ + button2 \ + -1 < +inf > \ + }\ + 5 < +inf - 5 > \ + } + + *Label.borderWidth: 0 + *Label.background: gray60 + *label1*shadowWidth: 0 + *label1_frame.frameType: sunken + *label1_frame.frameWidth: 2 + *label2*shadowWidth: 0 + *label2_frame.frameType: sunken + *label2_frame.frameWidth: 2 + + *allowShellResize: true + *beNiceToColormap: False +} + +# Start up the GUI. +createObjects +activate + +proc quit args { send client gkey q; deactivate unmap } +send button1 addCallback quit diff --git a/vendor/x11iraf/guidemo/gtest.gui b/vendor/x11iraf/guidemo/gtest.gui new file mode 100644 index 00000000..27e94bc3 --- /dev/null +++ b/vendor/x11iraf/guidemo/gtest.gui @@ -0,0 +1,182 @@ +# GTEST.GUI -- Graphics user interface for the "hello world" demo task, +# as modified to test the class Gterm graphics primitives. + +reset-server +appInitialize hello Hello { +! +! Application defaults for the hello world program. +! + Hello*objects:\ + toplevel Form helloForm\ + helloForm Label helloLabel\ + helloForm Command quitButton\ + helloForm Command drawButton\ + helloForm Gterm plotwin + + + Hello*helloForm*background: bisque + Hello*helloForm*helloLabel.label: Hello, world! + Hello*helloForm*quitButton.fromHoriz: helloLabel + Hello*helloForm*quitButton.label: Quit + Hello*helloForm*drawButton.fromHoriz: quitButton + Hello*helloForm*drawButton.label: Draw + Hello*helloForm*plotwin.fromHoriz: drawButton +} + +createObjects +proc quit args { send client gkey q; deactivate unmap } + +# draw -- Graphics test procedure. +proc draw args { + global R1_width R1_height R1_depth R1_colors R1_pixels R1_encoding + global R2_width R2_height R2_depth R2_colors R2_pixels R2_encoding + global R3_width R3_height R3_depth R3_colors R3_pixels R3_encoding + + send plotwin queryRaster 0 wid ht type depth + print "raster query: wid=" $wid " ht=" $ht " type= " $type " depth=" $depth + + # Test pixel i/o. + send plotwin setPixel 0 10 10 1 + send plotwin setPixel 0 11 11 3 + send plotwin setPixel 0 12 12 4 + + # Test line drawing. + send plotwin { + setLineWidth 5 + setColorIndex blue + drawPolyline { {20 20} {100 100} {200 50} {300 350} {400 250} } + } + + # Test fill polygon. + send plotwin { + setFillType solid + setColorIndex green + drawPolygon { {105 115} {174 115} {174 183} {105 183} } + } + + # Test text drawing and area fills, show static colors. + send plotwin drawAlphaText 400 100 "Gterm Graphics Test" + for {set i 0} {$i < 10} {incr i 1} { + send plotwin setPixels 0 $i pixel [expr 370+($i*20)] 105 20 20 + } + + # Test basic image raster drawing. Image R1 has its own colormap, while + # R2 uses the static colors. + + set bias [send plotwin getBias] + send plotwin "\ + writeColormap 0 \{ $R1_colors \} $bias; \ + writePixels 0 \{ $R1_pixels \} $R1_encoding $R1_depth \ + 109 118 $R1_width $R1_height $bias; \ + writePixels 0 \{ $R2_pixels \} $R2_encoding $R2_depth \ + 560 400 $R2_width $R2_height" + + # Set up for test below; also test extending colormap. + set x 20 + set bias [expr $bias + [llength $R1_colors]] + send plotwin "\ + writeColormap 0 \{ $R3_colors \} $bias; \ + writePixels 0 \{ $R3_pixels \} $R3_encoding $R3_depth \ + $x 400 $R3_width $R3_height $bias" + + # Test various image encodings. + foreach encoding {numeric hex1 hex2 hex1-rle hex2-rle} { + set pixels [send plotwin \ + readPixels 0 $encoding $R3_depth 20 400 $R3_width $R3_height $bias] + send plotwin \ + writePixels 0 $pixels $encoding $R3_depth \ + $x 400 $R3_width $R3_height $bias + incr x 64 + } +} + +send quitButton addCallback quit +send drawButton addCallback draw + +activate + +# Raster "porsche". +set R1_width 64; set R1_height 64; set R1_depth 8 +set R1_colors { + {255 255 255} { 0 0 0} {106 90 205} {255 0 0} {255 255 0} +} +set R1_encoding "hex1-rle" +set R1_pixels { + 2%861@k2@E1@k2@E114@g112@E11441@2441@2441@2441@2441@2441441441@244112@E11 + 4414414414414414414414414414414414414414@3112@E114414414414414414414414@3 + 14@314414414@3112@E11441@2441441441114441@24414@31@2441@244112@E114414@31 + 4414414414@314414@314414414@3112@E114414@31441441441441441441441441441441 + 4@3112@E114414@31@2441441441@2441@2441441441@244112@E114@g112@E1@k2@E114@ + J1@N2@E114@414441444114@31@N2@E114@31444144414@21441@N2@E114@211441141@54 + 441@N2@E114441@64@41144113@J112@E11441@24@D113@J112@E1141114@F113@J112@E1 + 14@814414@5113@J112@E114@3144414414@6113@J112@E114@214441441441@U2@E114@2 + 141@74@C1@F2@E114441@24@51@U2@E11441114@714@C1@F2@E1141114@814441114@61@F + 2@E114@7144141441@34@51@F2@E114@3144144144144141114@31413@C112@E114@21441 + 44144114@21114@211413@C112@E114441141@5414@21114@211413@C112@E11441@34@41 + 14441@344414413@C112@E1141114@8141@94413@C112@E114@C14141@74413@C112@E1@F + 41414@21@2441@F2@E1@F44414@31414414@C112@E1@F4@6114114144414414@5112@F1@E + 4@614414414414414441444112@G1@E4@5144144414144144414@2112@G1@F4@A141@8444 + 112@H113@C14@81@24@6114112@I113@D14@61@24@A112@J113@D1@64@514414@2112@K11 + 3@G114@31444144144144112@L113@F114@21444144144144112@M113@F114441141@6444 + 112@N1@I4441@24@4114112@P1@H441114@912@Q1@H41114@9112@R1@G4@C112@T1@F4441 + 41414@3112@V1@E441414144144112@X113@911441@544112@Z113@81141114@214112@b1 + 13@7114114@4112@d1113@5114@51112@f1@23@3114@31@22@i1@2333114441@22@m1@231 + 141@22@q1@62@u1@22@x112%5D +} + +# Raster "nobozos". +set R2_width 64; set R2_height 64; set R2_depth 8 +set R2_colors { } +set R2_encoding "hex1-rle" +set R2_pixels { + 1%590@91@l0@H1@e0@N1@Z0@R1@V0@V1@S0@X1@P0@b1@M0@d1@K0@F1@70@F1@I0@C1@F0@C + 1@G0@B1@J0@B1@E0@A1@N0@A1@C0@C1@N0@A1@B0@D1@O0@81@A0@F1@O0@81@80@81110@41 + @P0@71@70@41@30110@41@M0101110@31@60@510111001@30001@K00111010@41@50@3111 + 0@2101010110001@F0101010@21110@21@40@311001010@2110010@21@D00110@21010011 + 0@21@30@3101010010100010110@21@C0100010100101010@21@300011100110010010@31 + 10@21@A0@31001001100111001@20@210010001010@3110011001@A00110@310100010010 + 001110@2110100010001010001001@20@31@4010001010001000101100011100011100010 + @610@41001@3001010@310@610001110011100010010@510@31010001@700101010@310@5 + 100100110@21101010001000100010@21@90@310001000100010101100010@31110010@21 + 00010@31@B010@2100010@21001110@210@310010@510@3101@D0010@310@510010@210@3 + 1101010001000101001110@21110@211100010100010001010110@210@411100010@61011 + 0011001001100110010@610001110@310@410010@31010@31101@20101@20110@41010@31 + 0010@310@4110101110@210001110100101010010111001010@2111010110@310@51@3001 + 01010001110100100010010111001010101001@30@410@61@30101@3011101110@3111011 + 101@40101@20@610@61@B01110@B11101@B0@610@61@B01@40@51@40101@80@7110@61@A0 + 1@40@51@401001@70@61110@61@A01@50@31@5010001@60@61110@61@A011100111000111 + 00111010@21@50@61110@71@A010@21@50@210110@31@30@71@20@61@A01001001@300100 + 1010@51@20@61@30@71@901100110@3110011010@6110@71@30@71@A011001@500110110@ + 710@71@40@71@A0110@7110110@H1@50@81@9001@90010@I1@60@71@A001@700110@H1@70 + @81@B001@3001110@I1@80@81@C0@31@50@F1@A0@81@O0@D1@B0@A1@N0@C1@C0@A1@N0@A1 + @E0@B1@J0@B1@G0@C1@F0@C1@I0@F1@70@F1@K0@d1@M0@b1@P0@X1@S0@V1@V0@R1@Z0@N1@ + e0@H1@l0@91@O +} + + +# Raster "city". +set R3_width 64; set R3_height 64; set R3_depth 8 +set R3_colors { { 0 191 255} { 178 34 34} {224 224 0} } +set R3_encoding "hex1-rle" +set R3_pixels { + 0%FF%FF%FF%E610@z10@z10@P1@30@S1110@O121110@S1110@O111210@R1@30@N1@30@R1@ + 30@N121110@P1@80@K111210@P10010010010@K1@30@P10010010010@D110@3112110@P1@ + 80@D110@31@30@P1001@20010@D110@3121110@P1001@20010@D110@31@30@91@20@A1@80 + 1@9000110@3111210@910010@21@30001@2001@2010121010011000110@31@30@91@20@21 + 21010001@2001@201@9000110@31@30@910010@2121010001@8010112110001000110@310 + 0010@91@20@21@30001001@501@9000110@31@30@910010@2121110001001@50100121001 + 21001@20@2111210@91@20@2121110001@200100101@90010010@21@30@91@20@21112100 + 01@2001001010121010001001@20@2112110@91@20@2111210001@801@90010010@21@80@ + 410010@21@30001@8011001211001001@20@21@3001110@41@20@21@30001@801@9001@20 + @21@50010@41@20@2111210001@8011001210001001@20@2121@60@410010@21112100010 + 01@200101@90010010@21@3001110@21@50001@30001001@2001010100100011001@20@21 + 121@50@210@3100011121@C01@90012110@21@50010@21@500011121@6001001010121100 + 121001@20@21112100111001@70001@421@300100101@90011210@21@80010@5100012101 + 21@A010121121011001@4001112111001001@700012101@3001@501@C00111001@3001110 + 01@70001@4211001@821110012101@40001@5001001@F21@M211001110011121@40010@51 + @321@8001@4001@2001121@500121@H211121@8001@H00101001@5001@20@51@521@E2101 + 121001@7001@3001@221@D21121@6001@C2101@5001@I21@321@7001@2211100121121@42 + 1@4001@I21@P2101@521@3001@20@5121@321121@600111211001@421@201121@821@8211 + 1211121@7001@821@3001@42111001@40@51@321@G0001@521@521@6001@J211001@H2110 + 0101@3001@521@20@211121@32111001@721@3001121@621@J21@U211001%BF +} diff --git a/vendor/x11iraf/guidemo/guidemo.cl b/vendor/x11iraf/guidemo/guidemo.cl new file mode 100644 index 00000000..f00e2182 --- /dev/null +++ b/vendor/x11iraf/guidemo/guidemo.cl @@ -0,0 +1,8 @@ +#{ GUIDEMO.CL -- Define the GUI tasks. + +package guidemo + +task hello, + imbrowse = "guidemo$xx_guidemo.e" + +clbye() diff --git a/vendor/x11iraf/guidemo/hello.gui b/vendor/x11iraf/guidemo/hello.gui new file mode 100644 index 00000000..5b5df35a --- /dev/null +++ b/vendor/x11iraf/guidemo/hello.gui @@ -0,0 +1,23 @@ +# HELLO.GUI -- Graphics user interface for the "hello world" demo task. + +reset-server +appInitialize hello Hello { +! +! Application defaults for the hello world program. +! + +Hello*objects:\ + toplevel Form helloForm\ + helloForm Label helloLabel\ + helloForm Command quitButton + +Hello*helloForm*background: bisque +Hello*helloForm*helloLabel.label: Hello, world! +Hello*helloForm*quitButton.fromHoriz: helloLabel +Hello*helloForm*quitButton.label: Quit +} + +createObjects +proc quit args { send client gkey q; deactivate unmap } +send quitButton addCallback quit +activate diff --git a/vendor/x11iraf/guidemo/hello.par b/vendor/x11iraf/guidemo/hello.par new file mode 100644 index 00000000..dbcba751 --- /dev/null +++ b/vendor/x11iraf/guidemo/hello.par @@ -0,0 +1,5 @@ +# Parameters for HELLO task. + +gui,f,h,"guidemo$hello.gui",,,user interface file +coords,*gcur,h,,,,graphics cursor input +device,s,h,"stdgraph",,,graphics device for plots diff --git a/vendor/x11iraf/guidemo/hello.x b/vendor/x11iraf/guidemo/hello.x new file mode 100644 index 00000000..4e519cf1 --- /dev/null +++ b/vendor/x11iraf/guidemo/hello.x @@ -0,0 +1,39 @@ +# HELLO.X -- GUI version of IRAF hello world. + +procedure t_hello() + +pointer gp +real x, y +int wcs, key +char strval[SZ_LINE] +char device[SZ_FNAME] +char guifile[SZ_FNAME] +int clgcur() +pointer gopenui() + +begin + call clgstr ("device", device, SZ_FNAME) + call clgstr ("gui", guifile, SZ_FNAME) + + gp = gopenui (device, NEW_FILE, guifile, STDGRAPH) + while (clgcur ("coords", x, y, wcs, key, strval, SZ_LINE) != EOF) + if (key == 'q' || key == 'Q') + break + else { + if (key == ':') { + call printf ("%g %g %d %c %s\n") + call pargr (x) + call pargr (y) + call pargi (wcs) + call pargi (key) + call pargstr (strval) + } else { + call printf ("%g %g %d %c\n") + call pargr (x) + call pargr (y) + call pargi (wcs) + call pargi (key) + } + } + call gclose (gp) +end diff --git a/vendor/x11iraf/guidemo/help.gui b/vendor/x11iraf/guidemo/help.gui new file mode 100644 index 00000000..0159dc2b --- /dev/null +++ b/vendor/x11iraf/guidemo/help.gui @@ -0,0 +1,301 @@ + +# HTML.GUI -- Test HTML widget. + +reset-server +appInitialize html HTML { + *objects:\ + toplevel Layout helpLayout \ + helpLayout Layout helpMenuLayout \ + helpLayout Layout helpInfoLayout \ +\ + helpMenuLayout Command helpBack \ + helpMenuLayout Command helpForward \ + helpMenuLayout Command helpHome \ + helpMenuLayout Command helpClose \ +\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText \ +\ + helpInfoLayout Label helpIRAFLogo \ + helpInfoLayout Label helpInfo1 \ + helpInfoLayout Label helpInfo2 \ + helpInfoLayout Label helpInfo3 \ + helpInfoLayout Label helpNOAOLogo + + + *helpLayout*borderWidth: 0 + *helpLayout.background: gray + *helpLayout*Frame*frameType: sunken + *helpLayout*Frame*frameWidth: 2 + *helpLayout*Frame.background: gray + *helpLayout*Layout.background: gray + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { \ + 0 < +0 -0 > \ + helpMenuLayout < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + helpTextFrame < +inf -inf * +inf -inf > \ + 0 \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + helpInfoLayout < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + -1 \ + } + *helptext*background: white + *helptext*foreground: black + + *helpMenuLayout*background: gray + *helpMenuLayout*Command.highlightThickness: 2 + *helpMenuLayout*Command.internalHeight: 2 + *helpMenuLayout*Command.font: -*-helvetica-bold-r-normal-*-12-*-*-* + *helpMenuLayout.layout: vertical { \ + 5 \ + horizontal { \ + 5 < +0 -5 > \ + helpBack \ + 2 < +0 -2 > \ + helpForward \ + 2 < +0 -2 > \ + helpHome \ + 2 < +inf -2 > \ + helpClose \ + 5 < +0 -5 > \ + } \ + 5 \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Close + + *helpInfoLayout*background: gray + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 2 < +0 -2 > \ + vertical { \ + 5 \ + helpIRAFLogo \ + 5 \ + } \ + 1 < +0 -1 > \ + vertical { \ + 5 \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo1 \ + 0 < +inf -inf > \ + } \ + 0 < +inf -0 > \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo2 \ + 0 < +inf -inf > \ + } \ + 0 < +inf -inf > \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo3 \ + 0 < +inf -inf > \ + } \ + 5 \ + } \ + 1 < +0 -1 > \ + vertical { \ + 5 \ + helpNOAOLogo \ + 5 \ + } \ + 2 < +0 -2 > \ + } + *helpInfo1.label: XImtool V1.0 -- Released: 11/4/96 + *helpInfo2.label: iraf@noao.edu (520) 318-4160 + *helpInfo3.label: NOAO is operated by AURA under cooperative agreement with the NSF + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalheight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: steelblue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalheight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: steelblue + *helpInfoLayout.helpNOAOLogo.background: white + + *helpText.width: 450 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText.plainFont: 6x13 + +} + +createObjects +proc quit args { send client gkey q; deactivate unmap } +send helpClose addCallback quit +activate + +# Get list of viewable files in the current directory. +proc loadFile {filename} { + set fd [open $filename]; set text [read $fd]; close $fd + if {[file extension $filename] == ".html"} { + send helpText setText $text + } else { + send helpText setText "$text" + } + send helpText retestAnchors +} +# Load initial file. +loadFile [lindex [glob *.html] 0] + + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + + + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc anchorSelected {widget cbtype event text href args} { + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack set sensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward set sensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward set sensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward set sensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} { + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args { + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward set sensitive False + send helpBack set sensitive True + } else { + send helpBack set sensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args { + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack set sensitive False } + if {$linkIndex >= 0} { send helpForward set sensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args { + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward set sensitive False + send helpBack set sensitive False + send helpText retestAnchors +}; send helpHome addCallback hlpHome + diff --git a/vendor/x11iraf/guidemo/html.gui b/vendor/x11iraf/guidemo/html.gui new file mode 100644 index 00000000..86e61dbc --- /dev/null +++ b/vendor/x11iraf/guidemo/html.gui @@ -0,0 +1,113 @@ +# HTML.GUI -- Test HTML widget. + +reset-server +appInitialize html HTML { + *objects:\ + toplevel Form helloForm\ + helloForm Label helloLabel\ + helloForm Command prevButton\ + helloForm Command nextButton\ + helloForm Command quitButton\ + helloForm HTML textwin\ + helloForm TextBox info + + + *helloForm.background: bisque + *helloForm.helloLabel.background: bisque + *helloForm.Command.background: bisque + *helloForm.info*background: bisque + *helloForm.textwin*background: gray81 + *beNiceToColormap: false + + *helloLabel.label: HTML widget demo + *prevButton.fromHoriz: helloLabel + *prevButton.label: Previous File + *nextButton.fromHoriz: prevButton + *nextButton.label: Next File + *quitButton.fromHoriz: nextButton + *quitButton.label: Quit + *textwin.fromVert: helloLabel + *info.fromVert: textwin + *info.width: 500 + *info.height: 20 + *info.frameWidth: 0 + *info.frameType: sunken + *info.borderWidth: 0 + *info.outerOffset: 0 + *info.innerOffset: 0 + + *textwin.width: 500 + *textwin.height: 800 + *textwin.anchorUnderlines: 1 + *textwin.visitedAnchorUnderlines: 1 + *textwin.dashedVisitedAnchorUnderlines: true + *textwin.plainFont: 6x13 +} + +createObjects +proc quit args { send client gkey q; deactivate unmap } +send quitButton addCallback quit +activate + +# Get list of viewable files in the current directory. +set files [glob *.html *.\[cfhlsxy\] *.notes \[A-Z\]* *.gui] +set fileIndex 0 +set html [lindex $files $fileIndex] + +proc loadFile {filename} { + set fd [open $filename]; set text [read $fd]; close $fd + if {[file extension $filename] == ".html"} { + send textwin setText $text + } else { + send textwin setText "<plaintext>$text" + } + send textwin retestAnchors +} + +# Load initial file. +loadFile [lindex $files $fileIndex] + +# Stuff for keeping track of visited anchors. +set url(0) empty +proc anchorSelected {widget cbtype event text href args} { + global url + set url($href) 1 + send textwin retestAnchors +} +proc testAnchor {widget cbtype href} { + global url + return [info exists url($href)] +} +proc anchorVisited {widget cbtype href} { + send info set label $href +} +send textwin addCallback anchorVisited pointerMotion +send textwin addCallback testAnchor testAnchor +send textwin addCallback anchorSelected anchor + +# Callbacks to position forwards and backwards in file list. +proc next args { + global files fileIndex + incr fileIndex + if {$fileIndex >= [llength $files]} { + set fileIndex 0 + } + loadFile [lindex $files $fileIndex] +} +proc prev args { + global files fileIndex + if {$fileIndex <= 0} { + set fileIndex [llength $files] + } + incr fileIndex -1 + loadFile [lindex $files $fileIndex] +} +send prevButton addCallback prev +send nextButton addCallback next + +# Test submit form callback. +proc submitFormCalled {widget cbtype event attrs href method args} { + print [format "\nSubmit Form to: %s\nMethod: %s\n%s\n" \ + $href $method $attrs] +} +send textwin addCallback submitFormCalled submitForm diff --git a/vendor/x11iraf/guidemo/imbrowse.gui b/vendor/x11iraf/guidemo/imbrowse.gui new file mode 100644 index 00000000..78b339b5 --- /dev/null +++ b/vendor/x11iraf/guidemo/imbrowse.gui @@ -0,0 +1,373 @@ +# IMBROWSE.GUI -- Image browser user interface. + +reset-server +appInitialize imbrowse Imbrowse { + *objects: \ + toplevel Paned panel \ +\ + panel Box statusBox \ + statusBox MenuButton dirSelect \ + statusBox AsciiText dirName \ + statusBox Command imageButton \ + statusBox Command helpButton \ + statusBox Command quitButton \ +\ + panel Viewport objView \ + objView List objList \ +\ + panel Form controlForm \ + controlForm Label buttonHelp \ + controlForm Label templateLabel \ + controlForm AsciiText templateText \ + controlForm Command prevButton \ + controlForm Command nextButton \ + controlForm Command headerButton \ + controlForm Command displayButton \ +\ + panel AsciiText headerText \ +\ + panel Box sectionBox \ + sectionBox Label sectionLabel \ + sectionBox AsciiText sectionText \ +\ + toplevel TopLevelShell imageShell \ + imageShell Form imageForm \ + imageForm Label imageTitle \ + imageForm Gterm imageWindow \ +\ + toplevel Parameter imbrowse \ + imbrowse Parameter template \ + imbrowse Parameter section \ + imbrowse Parameter directory \ + imbrowse Parameter subdirs \ + imbrowse Parameter files \ + imbrowse Parameter image_title \ + imbrowse Parameter header \ + imbrowse Parameter errormsg \ + + *panel.orientation: vertical + *displayCaret: false + + *background: LightSkyBlue + *shapeStyle: Rectangle + *beNiceToColormap: False + *Label*shadowWidth: 2 + + *statusBox.orientation: horizontal + *statusBox.showGrip: False + *statusBox.skipAdjust: True +! *statusBox.background: gray61 + *dirSelect.label: Directory: + *dirSelect.menuName: dirMenu + *dirName*background: #a7eeff + *dirName.width: 403 + *dirName*displayCaret: True + *dirName*editType: edit + *imageButton.label: Image + *helpButton.label: Help + *helpButton.sensitive: False + *quitButton.label: Quit + + *objView.allowHoriz: False + *objView.allowVert: True + *objView.forceBars: True + *objView.min: 60 + *objView*background: #a7eeff +! *objList*height: 100 + *objList*verticalList: True + + *controlForm.showGrip: True + *controlForm.skipAdjust: True + *buttonHelp.borderWidth: 0 + *buttonHelp.width: 613 + *templateLabel.label: Images: + *templateLabel.fromVert: buttonHelp + *templateLabel.borderWidth: 0 + *templateText*background: #a7eeff + *templateText*font: 7x13bold + *templateText*width: 230 + *templateText.fromHoriz: templateLabel + *templateText.fromVert: buttonHelp + *templateText*displayCaret: True + *templateText*editType: edit + *prevButton.label: PrevIm + *prevButton.fromHoriz: templateText + *prevButton.fromVert: buttonHelp + *nextButton.label: NextIm + *nextButton.fromHoriz: prevButton + *nextButton.fromVert: buttonHelp + *headerButton.label: Show Header + *headerButton.fromHoriz: nextButton + *headerButton.fromVert: buttonHelp + *displayButton.label: Display Image + *displayButton.fromHoriz: headerButton + *displayButton.fromVert: buttonHelp + + *headerText.showGrip: False + *headerText.skipAdjust: False + *headerText.min: 100 +! *headerText.height: 100 + *headerText.scrollVertical: always + *headerText.scrollHorizontal: whenNeeded + *headerText*font: 7x13 + *headerText*background: #a7eeff + + *sectionBox.orientation: horizontal + *sectionBox.showGrip: False + *sectionBox.skipAdjust: True + *sectionLabel.label: Display image section: + *sectionLabel.borderWidth: 0 + *sectionText*background: #a7eeff + *sectionText.width: 460 + *sectionText*font: 7x13bold + *sectionText*displayCaret: True + *sectionText*editType: edit + + *imageTitle.borderWidth: 0 + *imageTitle.width: 512 + *imageWindow.cmapName: image + *imageWindow.ginmodeCursor: circle + *imageWindow.width: 512 + *imageWindow.height: 512 + *imageWindow.fromVert: imageTitle + + *imageWindow.translations: \ + <Btn1Down>: m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <Btn2Down>: call(zoom,$x,$y) \n\ + <Btn3Down>: call(windowColormap,$x,$y) \n\ + <Btn3Motion>: call(windowColormap,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() +} + +# Start up the GUI. +createObjects +send imageShell realize +send imageWindow setGterm +activate + +# Global variables. +set version "Imbrowse 0.1 - Alpha Test Version" + +# Display the program version number on startup. +send buttonHelp set label $version + +#proc reactivate {} { +#}; send server postActivateCallback reactivate + + +# Callbacks for client state variables (UI parameter objects). When the +# client's state changes it updates a UI parameter to reflect the change. +# This produces a callback to one or more of the callbacks defined below, +# used to update the GUI to reflect the changing state of the client. + +proc setTemplate {param old new} { + send templateText set string $new +}; send template addCallback setTemplate + +proc setSection {param old new} { + send sectionText set string $new +}; send section addCallback setSection + +proc setDirectory {param old new} { + send dirName set string $new +}; send directory addCallback setDirectory + +proc setImageTitle {param old new} { + send imageTitle set label $new +}; send image_title addCallback setImageTitle + +proc setFiles {param old new} { + send objList setList $new resize +}; send files addCallback setFiles + +proc setSubdirs {param old new} { + foreach dir $new { + lappend itemList "$dir f.exec \{ send client gcmd chdir $dir \}" + } + createMenu dirMenu dirSelect $itemList +}; send subdirs addCallback setSubdirs + +proc setErrormsg {param old new} { + send buttonHelp set label $new +}; send errormsg addCallback setErrormsg + +proc setHeaderText {param old new} { + send headerText set string $new +}; send header addCallback setHeaderText + + +# List widget callback. +proc select {widget cbtype item index} { + set subdirs [send subdirs getValue] + if [expr [lsearch $subdirs $item] != -1] { + send client gcmd chdir $item + } +}; send objList addCallback select + + +# Command callbacks. + +proc image args {send imageShell map} +send imageButton addCallback image + +proc help args { } +send helpButton addCallback help + +proc quit args { + #send imageShell unmap; send client gkey q; deactivate unmap + send client gkey q; deactivate unmap +}; send quitButton addCallback quit + +proc next args { + send objList getItem itemno + if {$itemno == "none"} { + send objList highlight 0 + } else { + send objList highlight [expr "$itemno + 1"] + } +}; send nextButton addCallback next + +proc prev args { + send objList getItem itemno + if {$itemno == "none"} { + send objList highlight 0 + } else { + set itemno [expr "$itemno - 1"] + if {$itemno >= 0} { + send objList highlight $itemno + } + } +}; send prevButton addCallback prev + +proc headerCallback args { + set image [send objList getItem itemno] + if {$itemno != "none"} { + printHeader $image + } +}; send headerButton addCallback headerCallback + +proc printHeader {image} { + send client gcmd header $image +} + +proc displayCallback args { + set image [send objList getItem itemno] + if {$itemno != "none"} { + displayImage $image + } +}; send displayButton addCallback displayCallback + +proc displayImage {image} { + send imageShell map + send imageWindow setGterm + send client gcmd display $image +} + +proc directoryCallback {widget cbtype text} { + send client gcmd chdir $text +}; send dirName addCallback directoryCallback + + +proc templateCallback {widget cbtype text} { + send client gcmd template $text +}; send templateText addCallback templateCallback + +proc sectionCallback {widget cbtype text} { + send client gcmd section $text +}; send sectionText addCallback sectionCallback + + +# Window the displayed image. +proc windowColormap {x y} \ +{ + set winWidth [send imageWindow get width] + set winHeight [send imageWindow get height] + + send imageWindow loadColormap 1 \ + [expr "$x.0 / $winWidth"] \ + [expr "($y.0 - $winHeight / 2.0) / $winHeight * 10.0"] +} + +# ZOOM and PAN. +set xcen 0 +set ycen 0 + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imageWindow unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + if {sqrt(pow($rx-$xcen, 2) + pow($ry-$ycen, 2)) < 4} { + send client gkey Z + } else { + send client gkey M + } + + set xcen $rx + set ycen $ry +} + + +# Button help feature. + +set help(dirName) "current directory" +set help(dirSelect) "press to get directory selection menu" +set help(displayButton) "press to display currently selected image" +set help(templateLabel) "list of image file templates" +set help(templateText) "enter new list of image templates and press return" +set help(headerButton) "press to list header of currently selected image" +set help(headerText) "the image header is displayed here" +set help(helpButton) "press to get help for imbrowse" +set help(nextButton) "advance to next image" +set help(objList) "images in current directory are listed here" +set help(prevButton) "back up to previous image" +set help(quitButton) "press to exit the imbrowse application" +set help(sectionLabel) "image section for displaying image" +set help(sectionText) "enter new image section and press return" + +set widgets { + dirSelect dirName helpButton quitButton objList templateLabel + templateText nextButton prevButton headerButton displayButton + headerText sectionLabel sectionText +} + +proc helpCallback { widget event args } { + global help + if {$event == "enterNotify"} { + send buttonHelp set label $help($widget) + } +} + +foreach widget $widgets { + send $widget addEventHandler helpCallback enterWindowMask +} + +#set timerId 0 +#set timerState 0 +#proc timer args { +# global timerId timerState +# if {$timerState} { +# send quitButton set background red +# set timerState 0 +# } else { +# send quitButton set background blue +# set timerState 1 +# } +# set timerId [postTimedCallback timer 1000] +#}; set timerId [postTimedCallback timer 1000] diff --git a/vendor/x11iraf/guidemo/imbrowse.par b/vendor/x11iraf/guidemo/imbrowse.par new file mode 100644 index 00000000..5d238db2 --- /dev/null +++ b/vendor/x11iraf/guidemo/imbrowse.par @@ -0,0 +1,10 @@ +# Parameters for IMBROWSE task. + +directory,f,a,,,,directory to be listed +uifname,f,h,"guidemo$imbrowse.gui",,,user interface file +template,s,h,"*",,,image file template +section,s,h,"",,,default image section +contrast,r,h,0.25,,,contrast adjustment for zscale algorithm +nsample_lines,i,h,5,,,number of sample lines +coords,*gcur,h,,,,graphics cursor input +device,s,h,"stdgraph",,,graphics device for plots diff --git a/vendor/x11iraf/guidemo/imbrowse.x b/vendor/x11iraf/guidemo/imbrowse.x new file mode 100644 index 00000000..10110af0 --- /dev/null +++ b/vendor/x11iraf/guidemo/imbrowse.x @@ -0,0 +1,563 @@ +include <error.h> +include <diropen.h> +include <ctype.h> +include <finfo.h> +include <imhdr.h> +include <imio.h> +include <gset.h> +include <gim.h> + +define SZ_BIGBUF 16384 +define USER_AREA Memc[($1+IMU-1)*SZ_STRUCT + 1] +define SAMPLE_SIZE 600 +define NCOLORS 200 +define MAX_INTENSITY 255 +define SWATH 32 + + +# IMBROWSE -- Image browser GUI demo task. + +procedure t_imbrowse() + +pointer gp +real x, y +int wcs, key, ip, op +char directory[SZ_PATHNAME] +char buf[SZ_LINE], cmd[SZ_FNAME], args[SZ_LINE] +char device[SZ_FNAME], uifname[SZ_PATHNAME], template[SZ_LINE] +char section[SZ_LINE], strval[SZ_LINE], curdir[SZ_PATHNAME] + +bool streq() +pointer gopenui() +int clgcur(), clgeti() +int imb_isdirectory() + +begin + # Get the start directory. + if (clgeti ("$nargs") > 0) { + call clgstr ("directory", directory, SZ_PATHNAME) + if (imb_isdirectory (directory, curdir, SZ_PATHNAME) > 0) + call strcpy (curdir, directory, SZ_PATHNAME) + else + directory[1] = EOS + } else + directory[1] = EOS + + call clgstr ("device", device, SZ_FNAME) + call clgstr ("uifname", uifname, SZ_FNAME) + call clgstr ("template", template, SZ_LINE) + call clgstr ("section", section, SZ_LINE) + + gp = gopenui (device, NEW_FILE, uifname, STDGRAPH) + call gmsg (gp, "template", template) + call gmsg (gp, "section", section) + + call fpathname (directory, curdir, SZ_PATHNAME) + call imb_setdir (gp, curdir, ".", template) + + while (clgcur ("coords", x, y, wcs, key, strval, SZ_LINE) != EOF) { + switch (key) { + case 'q', 'Q': + break + + case ':': + for (ip=1; IS_WHITE(strval[ip]); ip=ip+1) + ; + op = 1 + while (strval[ip] != EOS && !IS_WHITE(strval[ip])) { + cmd[op] = strval[ip] + op = op + 1 + ip = ip + 1 + } + cmd[op] = EOS + for ( ; IS_WHITE(strval[ip]); ip=ip+1) + ; + call strcpy (strval[ip], args, SZ_LINE) + + if (streq (cmd, "chdir")) { + call imb_setdir (gp, curdir, args, template) + + } else if (streq (cmd, "template")) { + call strcpy (args, template, SZ_LINE) + call imb_setdir (gp, curdir, ".", template) + + } else if (streq (cmd, "section")) { + call strcpy (args, section, SZ_LINE) + + } else if (streq (cmd, "header")) { + call imb_pheader (gp, curdir, args, section) + + } else if (streq (cmd, "display")) { + call imb_display (gp, curdir, args, section) + + } else { + call sprintf (buf, SZ_LINE, "unrecognized command: `%s'\n") + call pargstr (strval) + call gmsg (gp, "errormsg", buf) + } + + default: + call sprintf (buf, SZ_LINE, + "unrecognized cursor command: key=%c strval=`%s'\n") + call pargi (key) + call pargstr (strval) + call gmsg (gp, "errormsg", buf) + } + } + + call gclose (gp) +end + + +# IMB_SETDIR -- Set the current directory. + +procedure imb_setdir (gp, curdir, newdir, template) + +pointer gp #I graphics descriptor +char curdir[ARB] #I current directory +char newdir[ARB] #I new directory or subdirectory +char template[ARB] #I filename template + +pointer s_op, f_op, pt +int fd, errcode, nchars +pointer sp, lbuf, fname, subdirs, files, dirpath, ftemp + +pointer pt_compile() +int errget(), gstrcpy(), imb_isdirectory(), imb_issubdir() +int diropen(), nowhite(), getline(), access(), pt_match() +errchk fchdir, fpathname, gmsg, diropen, getline, access, pt_compile +define error_ 91 + +begin + call smark (sp) + call salloc (lbuf, SZ_LINE, TY_CHAR) + call salloc (fname, SZ_PATHNAME, TY_CHAR) + call salloc (ftemp, SZ_PATHNAME, TY_CHAR) + call salloc (subdirs, SZ_COMMAND, TY_CHAR) + call salloc (files, SZ_BIGBUF, TY_CHAR) + call salloc (dirpath, SZ_PATHNAME, TY_CHAR) + + s_op = subdirs + f_op = files + + # We should check for buffer overflow and realloc if it occurs, but + # we omit this at present in this demo program. + + iferr { + # Get pathname of new directory. + if (imb_issubdir (curdir, newdir) == YES) { + call strcpy (curdir, Memc[fname], SZ_PATHNAME) + call zfsubd (Memc[fname], SZ_PATHNAME, newdir, nchars) + } else if (imb_isdirectory(newdir,Memc[dirpath],SZ_PATHNAME) > 0) { + call fpathname (Memc[dirpath], Memc[fname], SZ_PATHNAME) + } else + call fpathname (newdir, Memc[fname], SZ_PATHNAME) + + # Read the directory and construct a list of subdirectories and + # a list of files matching the given template. + + fd = diropen (Memc[fname], PASS_HIDDEN_FILES) + call strcpy (Memc[fname], curdir, SZ_PATHNAME) + call gmsg (gp, "directory", Memc[fname]) + pt = pt_compile (template) + + s_op = s_op + gstrcpy ("/\n", Memc[s_op], ARB) + while (getline (fd, Memc[lbuf]) != EOF) { + if (nowhite (Memc[lbuf], Memc[ftemp], SZ_PATHNAME) <= 0) + next + call imb_mkfname (Memc[ftemp], curdir, Memc[fname], SZ_PATHNAME) + if (access (Memc[fname], 0, DIRECTORY_FILE) == YES) + s_op = s_op + gstrcpy (Memc[lbuf], Memc[s_op], ARB) + if (pt_match (pt, Memc[fname]) == YES) + f_op = f_op + gstrcpy (Memc[lbuf], Memc[f_op], ARB) + } + + call pt_free (pt) + call close (fd) + } then + goto error_ + + Memc[s_op] = EOS + Memc[f_op] = EOS + + call gmsg (gp, "subdirs", Memc[subdirs]) + call gmsg (gp, "files", Memc[files]) + + call sfree (sp) + return +error_ + errcode = errget (Memc[lbuf], SZ_LINE) + call gmsg (gp, "errormsg", Memc[lbuf]) + call sfree (sp) +end + + +# IMB_PHEADER -- Print an image header. + +procedure imb_pheader (gp, curdir, image, section) + +pointer gp #I graphics descriptor +char curdir[ARB] #I directory +char image[ARB] #I image name +char section[ARB] #I image section + +int in, min_lenuserarea +pointer sp, lbuf, hbuf, ip, op, im, fname +int stropen(), getline(), gstrcpy() +pointer immap() + +begin + call smark (sp) + call salloc (lbuf, SZ_LINE, TY_CHAR) + call salloc (fname, SZ_PATHNAME, TY_CHAR) + + call imb_mkfname (image, curdir, Memc[fname], SZ_PATHNAME) + iferr (im = immap (Memc[fname], READ_ONLY, 0)) { + call sprintf (Memc[lbuf], SZ_LINE, "cannot open image `%s'") + call pargstr (image) + call gmsg (gp, "errormsg", Memc[lbuf]) + call sfree (sp) + return + } + + call salloc (hbuf, IM_HDRLEN(im), TY_CHAR) + op = hbuf + + # Open user area in header. + min_lenuserarea = (LEN_IMDES + IM_LENHDRMEM(im) - IMU) * SZ_STRUCT - 1 + in = stropen (USER_AREA(im), min_lenuserarea, READ_ONLY) + + # Copy header records to the output, stripping any trailing + # whitespace and clipping at the right margin. + + while (getline (in, Memc[lbuf]) != EOF) { + for (ip=lbuf; Memc[ip] != EOS && Memc[ip] != '\n'; ip=ip+1) + ; + while (ip > lbuf && Memc[ip-1] == ' ') + ip = ip - 1 + Memc[ip] = '\n' + Memc[ip+1] = EOS + + op = op + gstrcpy (Memc[lbuf], Memc[op], ARB) + } + + call gmsg (gp, "image_title", IM_TITLE(im)) + call gmsg (gp, "header", Memc[hbuf]) + + call close (in) + call imunmap (im) + call sfree (sp) +end + + +# IMB_DISPLAY -- Display an image. + +procedure imb_display (gp, curdir, image, section) + +pointer gp #I graphics descriptor +char curdir[ARB] #I directory +char image[ARB] #I image name +char section[ARB] #I image section + +int ncols, nrows, i, v +real contrast, z1, z2, dz1, dz2 +int r[NCOLORS], g[NCOLORS], b[NCOLORS] +int nsample_lines, len_stdline, j1, j2, npix +pointer sp, im, fname, lbuf, in, out, pkras + +int clgeti() +real clgetr() +pointer immap(), imgs2r() +errchk gseti, gswind, clgeti, clgetr, zscale, malloc, imgs2r +errchk gim_createraster, gim_setmapping, gim_writecolormap, gim_writepixels + +begin + call smark (sp) + call salloc (lbuf, SZ_LINE, TY_CHAR) + call salloc (fname, SZ_PATHNAME, TY_CHAR) + + call imb_mkfname (image, curdir, Memc[fname], SZ_PATHNAME) + call strcat (section, Memc[fname], SZ_PATHNAME) + + iferr (im = immap (Memc[fname], READ_ONLY, 0)) { + call sprintf (Memc[lbuf], SZ_LINE, "cannot open image `%s%s'") + call pargstr (image) + call pargstr (section) + call gmsg (gp, "errormsg", Memc[lbuf]) + call sfree (sp) + return + } + + ncols = IM_LEN(im,1) + nrows = IM_LEN(im,2) + + call gmsg (gp, "image_title", IM_TITLE(im)) + + # Create raster to hold image. + call gim_createraster (gp, 1, 0, ncols, nrows, 8) + + # Associate a WCS with raster 1. + call gseti (gp, G_RASTER, 1) + call gswind (gp, 0.5, real(ncols) + 0.5, 0.5, real(nrows) + 0.5) + + # Set the primary raster to screen mapping. + call gim_setmapping (gp, 1, 0, + 1, CT_PIXEL, 0.0, 0.0, real(ncols), real(nrows), + 0, CT_NDC, 0.0, 0.0, 1.0, 1.0) + + # Write colormap. + do i = 1, NCOLORS { + v = MAX_INTENSITY * (real((i - 1)) / (NCOLORS - 1)) + r[i] = v; g[i] = v; b[i] = v + } + call gim_writecolormap (gp, 0, LAST_COLOR+1, NCOLORS, r, g, b) + call gim_writecolormap (gp, 1, LAST_COLOR+1, NCOLORS, r, g, b) + + contrast = clgetr ("contrast") + nsample_lines = clgeti ("nsample_lines") + len_stdline = SAMPLE_SIZE / nsample_lines + call zscale (im, z1, z2, contrast, SAMPLE_SIZE, len_stdline) + + dz1 = LAST_COLOR + 1 + dz2 = dz1 + NCOLORS - 1 + call malloc (out, ncols * SWATH, TY_REAL) + call malloc (pkras, ncols * SWATH, TY_CHAR) + + do j1 = 1, nrows, SWATH { + j2 = min (j1 + SWATH - 1, nrows) + npix = (j2 - j1 + 1) * ncols + in = imgs2r (im, 1, ncols, j1, j2) + call amapr (Memr[in], Memr[out], npix, z1, z2, dz1, dz2) + call achtrb (Memr[out], Memc[pkras], npix) + call gim_writepixels (gp, 1, + Memc[pkras], 8, 0, j1-1, ncols, j2-j1+1) + } + + call mfree (out, TY_REAL) + call mfree (pkras, TY_CHAR) + call imunmap (im) + call sfree (sp) +end + + +# IMB_MKFNAME -- Construct a filename given a directory name and the file +# name. + +procedure imb_mkfname (file, directory, fname, maxch) + +char file[ARB] #I input filename +char directory[ARB] #I directory file resides in +char fname[ARB] #O path to file +int maxch #I max chars out + +begin + call fdirname (directory, fname, maxch) + call strcat (file, fname, maxch) +end + + +# IMB_ISDIRECTORY -- Test whether the named file is a directory. Check first +# to see if it is a subdirectory of the current directory; otherwise look in +# the environment to see if it is a logical directory. If VFN is a directory, +# return the OS pathname of the directory in pathname, and the number of +# chars in the pathname as the function value. Otherwise return 0. + +int procedure imb_isdirectory (vfn, pathname, maxch) + +char vfn[ARB] # name to be tested +char pathname[ARB] # receives path of directory +int maxch # max chars out + +bool isdir +pointer sp, fname, op +int ip, fd, nchars, ch +long file_info[LEN_FINFO] +int finfo(), diropen(), gstrcpy(), strlen() +bool streq() + +begin + call smark (sp) + call salloc (fname, SZ_PATHNAME, TY_CHAR) + + # Copy the VFN string, minus any whitespace on either end. + op = fname + for (ip=1; vfn[ip] != EOS; ip=ip+1) { + ch = vfn[ip] + if (!IS_WHITE (ch)) { + Memc[op] = ch + op = op + 1 + } + } + Memc[op] = EOS + + isdir = false + if (streq (vfn, ".") || streq (vfn, "..")) { + isdir = true + + } else if (finfo (Memc[fname], file_info) != ERR) { + isdir = (FI_TYPE(file_info) == FI_DIRECTORY) + + if (isdir) { + call fdirname (Memc[fname], pathname, maxch) + nchars = strlen (pathname) + } + + } else { + # If we get here, either VFN is a logical directory (with the + # $ omitted), or it is the name of a new file. + + Memc[op] = '$' + Memc[op+1] = EOS + ifnoerr (fd = diropen (Memc[fname], 0)) { + call close (fd) + isdir = true + } + + nchars = gstrcpy (Memc[fname], pathname, maxch) + } + + call sfree (sp) + if (isdir) + return (nchars) + else { + pathname[1] = EOS + return (0) + } +end + + +# IMB_ISSUBDIR -- Test whether the named file is a subdirectory of the +# current directory. + +int procedure imb_issubdir (curdir, newdir) + +char curdir[ARB] # current directory +char newdir[ARB] # subdir name to be tested + +bool subdir +pointer sp, fname +int root, extn, nchars +long file_info[LEN_FINFO] +int finfo(), btoi() +bool streq() + +begin + call smark (sp) + call salloc (fname, SZ_PATHNAME, TY_CHAR) + + subdir = false + if (streq (newdir, ".") || streq (newdir, "..")) { + subdir = true + + } else { + call zfnbrk (newdir, root, extn) + if (root == 1) { + call strcpy (curdir, Memc[fname], SZ_PATHNAME) + call zfsubd (Memc[fname], SZ_PATHNAME, newdir, nchars) + if (finfo (Memc[fname], file_info) != ERR) + subdir = (FI_TYPE(file_info) == FI_DIRECTORY) + } + } + + call sfree (sp) + return (btoi (subdir)) +end + + +# Pattern template matching utility. +# -------------------------------------- +define MAX_PATTERNS 64 +define SZ_PATBUF SZ_LINE + +define LEN_PATDES (10 + MAX_PATTERNS * SZ_PATBUF) +define PT_NPATTERNS Memi[$1] +define PT_PATBUF Memi[$1+10+(($2)-1)*SZ_PATBUF] + +# PT_COMPILE -- Compile a pattern template into the pattern descriptor. +# A pattern template is a comma delimited list of patterns, e.g., "*.x,*.y". + +pointer procedure pt_compile (template) + +char template[ARB] #I pattern template + +pointer sp, pattern, pt, op +int junk, npatterns, ip, pch, ch +int patmake() +errchk calloc + +begin + call smark (sp) + call salloc (pattern, SZ_LINE, TY_CHAR) + + call calloc (pt, LEN_PATDES, TY_STRUCT) + npatterns = 0 + + for (ip=1; template[ip] == ',' || IS_WHITE (template[ip]); ip=ip+1) + ; + + while (template[ip] != EOS) { + # Get the next pattern. + op = pattern + Memc[op] = '^'; op = op + 1 + + pch = 0 + ch = template[ip] + + while (ch != EOS && ch != ',' && !IS_WHITE(ch)) { + if (ch == '*' && pch != ']') { + Memc[op] = '?' + op = op + 1 + } + Memc[op] = ch + op = op + 1 + ip = ip + 1 + pch = ch + ch = template[ip] + } + + Memc[op] = '$'; op = op + 1 + Memc[op] = EOS + + # Encode the pattern. + npatterns = npatterns + 1 + junk = patmake (Memc[pattern], PT_PATBUF(pt,npatterns), SZ_PATBUF) + + while (template[ip] == ',' || IS_WHITE (template[ip])) + ip = ip + 1 + } + + PT_NPATTERNS(pt) = npatterns + call sfree (sp) + return (pt) +end + + +# PT_MATCH -- Test a string to see if it matches one of the patterns in the +# compiled pattern template. + +int procedure pt_match (pt, str) + +pointer pt #I pattern template descriptor +char str[ARB] #I string to be matched against template + +int i +int patmatch() + +begin + for (i=1; i <= PT_NPATTERNS(pt); i=i+1) + if (patmatch (str, PT_PATBUF(pt,i)) > 0) + return (YES) + + return (NO) +end + + +# PT_FREE -- Free a pattern template descriptor. + +procedure pt_free (pt) + +pointer pt #I pattern template descriptor + +begin + call mfree (pt, TY_STRUCT) +end diff --git a/vendor/x11iraf/guidemo/larrow2.xbm b/vendor/x11iraf/guidemo/larrow2.xbm new file mode 100644 index 00000000..68961766 --- /dev/null +++ b/vendor/x11iraf/guidemo/larrow2.xbm @@ -0,0 +1,6 @@ +#define larrow2_width 16 +#define larrow2_height 16 +static char larrow2_bits[] = { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00}; diff --git a/vendor/x11iraf/guidemo/login.cl b/vendor/x11iraf/guidemo/login.cl new file mode 100644 index 00000000..98ffbdfa --- /dev/null +++ b/vendor/x11iraf/guidemo/login.cl @@ -0,0 +1,99 @@ +# LOGIN.CL -- User login file for the IRAF command language. + +# Identify login.cl version (checked in images.cl). +if (defpar ("logver")) + logver = "IRAF V2.11 May 1997" + +set home = "/u3/iraf/x11iraf.develop/guidemo/" +set imdir = "tucana!/d0/iraf/fitz/" +set uparm = "home$uparm/" +set userid = "fitz" + +# Set the terminal type. +if (envget("TERM") == "sun") { + if (!access (".hushiraf")) + print "setting terminal type to gterm..." + stty gterm +} else { + if (!access (".hushiraf")) + print "setting terminal type to xgterm..." + stty xgterm +} + +# Uncomment and edit to change the defaults. +#set editor = vi +#set printer = lw +#set stdimage = imt800 +#set stdimcur = stdimage +#set stdplot = lw +#set clobber = no +#set filewait = yes +#set cmbuflen = 512000 +#set min_lenuserarea = 64000 +#set imtype = "imh" + +# IMTOOL/XIMAGE stuff. Set node to the name of your workstation to +# enable remote image display. The trailing "!" is required. +#set node = "my_workstation!" + +# CL parameters you mighth want to change. +#ehinit = "nostandout eol noverify" +#epinit = "standout showall" +showtype = yes + +# Default USER package; extend or modify as you wish. Note that this can +# be used to call FORTRAN programs from IRAF. + +package user + +task $adb $bc $cal $cat $comm $cp $csh $date $dbx $df $diff = "$foreign" +task $du $find $finger $ftp $grep $lpq $lprm $ls $mail $make = "$foreign" +task $man $mon $mv $nm $od $ps $rcp $rlogin $rsh $ruptime = "$foreign" +task $rwho $sh $spell $sps $strings $su $telnet $tip $top = "$foreign" +task $touch $vi $emacs $w $wc $less $rusers $sync $pwd $gdb = "$foreign" + +task $xc $mkpkg $generic $rtar $wtar $buglog = "$foreign" +#task $fc = "$xc -h $* -limfort -lsys -lvops -los" +task $fc = ("$" // envget("iraf") // "unix/hlib/fc.csh" // + " -h $* -limfort -lsys -lvops -los") +task $nbugs = ("$(setenv EDITOR 'buglog -e';" // + "less -Cqm +G " // envget ("iraf") // "local/bugs.*)") +task $cls = "$clear;ls" + +if (access ("home$loginuser.cl")) + cl < "home$loginuser.cl" +; + +keep; clpackage + +prcache directory +cache directory page type help + +# Print the message of the day. +if (access (".hushiraf")) + menus = no +else { + clear; type hlib$motd +} + +# Delete any old MTIO lock (magtape position) files. +if (deftask ("mtclean")) + mtclean +else + delete uparm$mt?.lok,uparm$*.wcs verify- + +# List any packages you want loaded at login time, ONE PER LINE. +images # general image operators +plot # graphics tasks +dataio # data conversions, import export +lists # list processing + +# The if(deftask...) is needed for V2.9 compatibility. +if (deftask ("proto")) + proto # prototype or ad hoc tasks + +tv # image display +utilities # miscellaneous utilities +noao # optical astronomy packages + +keep diff --git a/vendor/x11iraf/guidemo/loginuser.cl b/vendor/x11iraf/guidemo/loginuser.cl new file mode 100644 index 00000000..8c3e34c3 --- /dev/null +++ b/vendor/x11iraf/guidemo/loginuser.cl @@ -0,0 +1,6 @@ +# Define the guidemo package. + +set guidemo = "/iraf/x11iraf/guidemo/" +task $guidemo.pkg = guidemo$guidemo.cl + +keep diff --git a/vendor/x11iraf/guidemo/ltree.gui b/vendor/x11iraf/guidemo/ltree.gui new file mode 100644 index 00000000..67c5dbf0 --- /dev/null +++ b/vendor/x11iraf/guidemo/ltree.gui @@ -0,0 +1,33 @@ +# LTREE.GUI -- Test the ListTree widget. + +reset-server +appInitialize lTree LTree { + +LTree*objects:\ + toplevel Form helloForm\ + helloForm ListTree list\ + + *background: ivory3 + *list.width: 300 + *list.height: 300 + *list.font: -*-helvetica-bold-r-normal-*-14-*-iso8859-1 + *list.horizontalSpacing: 10 +} + +createObjects + +send list setListTree {a1 { b1 { {a2 {a3 b3 c3 d3}} { b2 {z1 z2}} } } c1} +#send list setListTree {{x1 {y1 y2}} {z2 {a b c d}}} append +#send list setListTree {{x1 {y1 y2}} {z2 {a b c d}}} + +# a1 +# b1 +# a2 +# a3 +# b3 +# b2 +# c1 + +activate + +proc foo { args } { print $args } ; send list addCallback foo diff --git a/vendor/x11iraf/guidemo/marker.gui b/vendor/x11iraf/guidemo/marker.gui new file mode 100644 index 00000000..bb0fd489 --- /dev/null +++ b/vendor/x11iraf/guidemo/marker.gui @@ -0,0 +1,314 @@ +# MTEST.GUI -- + +reset-server +appInitialize mtest Mtest { +! +! Application defaults for the hello world program. +! + +Mtest*objects:\ + toplevel Layout imgLayout \ + imgLayout Frame imviewFrame \ + imviewFrame Gterm gterm \ + imgLayout Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command quitButton\ + + + *shrinkToFit: True + + *imgLayout*borderWidth: 0 + *imgLayout*highlightThickness: 0 + *imgLayout*background: ivory3 + *imgLayout*Frame*background: ivory3 + *imgLayout*Frame*frameWidth: 2 + *imgLayout*Command.highlightThickness: 2 + + *imgLayout.layout: vertical { \ + imviewFrame < +inf -inf * +inf -inf > \ + tclLayout < +inf -inf * +inf -inf > \ + } + + *imgLayout*imviewFrame.outerOffset: 5 + *imgLayout*imviewFrame.innerOffset: 0 + *imgLayout*imviewFrame.frameWidth: 3 + *imgLayout*imviewFrame.frameType: sunken + *gterm.cmapName: image + *gterm.width: 400 + *gterm.height: 300 + *gterm.borderColor: black + *gterm.resizable: True + *gterm.copyOnResize: False + *gterm.ginmodeCursor: circle + *gterm.dialogBgColor: cyan + *gterm.dialogFgColor: black + *gterm.crosshairCursorColor: cyan + *gterm.translations: \ + <Btn1Down>: call(polyMarker, $x, $y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) + + + ! Define a Debug Tcl shell. + !-------------------------- + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout*Frame.outerOffset: 5 + *imgLayout*tclLayout*Text*foreground: wheat2 + *imgLayout*tclLayout*Text*background: gray35 + *tclLayout*Text*height: 90 + *tclLayout*Text*editType: edit + *tclLayout.layout: vertical { \ + tclFrame < +inf -inf * > \ + tclCmdGroup < +inf -inf * > \ + } + + ! Do the command bar group resources. + !------------------------------------ + *tclCmdGroup.width: 300 + *tclCmdGroup.height: 40 + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 5 + *tclCmdGroup*Command.background: ivory3 + *tclCmd.layout: horizontal { \ + 5 \ + tclClear tclExecute \ + 50 < +inf -inf > \ + quitButton \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *quitButton.label: Quit +} + +createObjects +activate + +proc Quit args { + send client gkey q ; deactivate unmap +}; send quitButton addCallback Quit + + + +# Define some TCL debug procedures + +send tclClear addCallback "send tclEntry set string \"\"" + +proc tclExec args { + send server [send tclEntry get string] +} ; send tclExecute addCallback tclExec + + +# Define a WCS box to track coords + +proc makeWCSMarker { args } { + send gterm createMarker wcsbox { + type text + createMode noninteractive + width 20ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send gterm parseGeometry "-5-5" $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + +} ; makeWCSMarker + + +proc wcsUpdate {x y} \ +{ + # Update coords box. + set text [ format " %7.2f %7.2f " $x $y ] + send wcsbox "set text \{$text\}; redraw noerase" +} + + +createMenu markerMenu toplevel { + { "Marker Type" f.title } + { f.dblline } + { "Box" f.exec "set_mtype box" } + { "Circle" f.exec "set_mtype circle" } + { "Ellipse" f.exec "set_mtype ellipse" } + { "Polygon" f.exec "set_poly polygon" } + { "Rectangle" f.exec "set_mtype rectangle" } + { "Text" f.exec "set_mtype text" } + { f.dblline } + { "Print geometry" f.exec "print [send objmarker getRegion]" } + +} + +proc set_mtype { type } { send objmarker "markpos; set type $type; redraw" } +proc set_poly args { + send objmarker getAttributes x xcur y ycur + set poly "{ { [expr "$xcur+00"] [expr "$ycur+00"] } \ + { [expr "$xcur-50"] [expr "$ycur+20"] } \ + { [expr "$xcur-50"] [expr "$ycur-30"] } \ + { [expr "$xcur+00"] [expr "$ycur-50"] } \ + { [expr "$xcur+50"] [expr "$ycur-30"] } \ + { [expr "$xcur+50"] [expr "$ycur+20"] } }" + + send objmarker "markpos; set type polygon; redraw" + #print "input vertices=" $poly + #send objmarker setVertices $poly + #send objmarker getVertices tpoly + #print "output vertices=" $tpoly + + send objmarker getAttributes x x y y width w height h type t rotangle r +} + + +# Translations when pointer is inside a marker. Notice I have turned of +# all resizeing and rotating options +set objmarkerTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() +} + + +set mtype ellipse +set mtype text +set mtype rectangle +set mtype polygon +set mtype box +set mtype circle + +proc polyMarker { xcur ycur } { + + global objmarkerTranslations mtype + + print "marker type=" $mtype + print "position =" $xcur " " $ycur + + set posangle 0 + send gterm createMarker objmarker \ + type $mtype \ + createMode noninteractive \ + translations $objmarkerTranslations \ + lineColor red \ + knotSize 1 \ + knotColor yellow \ + x [expr $xcur + 000] \ + y [expr $ycur + 000] \ + width 50 \ + height 50 \ + rotangle $posangle \ + rotIndicator True \ + highlightColor green \ + textBgColor black \ + imageText True \ + activated True \ + visible False \ + sensitive True + + # Closed polygon. + set poly "{ { [expr "$xcur+00"] [expr "$ycur+00"] } \ + { [expr "$xcur-50"] [expr "$ycur+20"] } \ + { [expr "$xcur-50"] [expr "$ycur-30"] } \ + { [expr "$xcur+00"] [expr "$ycur-50"] } \ + { [expr "$xcur+50"] [expr "$ycur-30"] } \ + { [expr "$xcur+50"] [expr "$ycur+20"] } \ + { [expr "$xcur+00"] [expr "$ycur+00"] } }" + + # Unclosed polygon. + set poly "{ { [expr "$xcur+00"] [expr "$ycur+00"] } \ + { [expr "$xcur-50"] [expr "$ycur+20"] } \ + { [expr "$xcur-50"] [expr "$ycur-30"] } \ + { [expr "$xcur+00"] [expr "$ycur-50"] } \ + { [expr "$xcur+50"] [expr "$ycur-30"] } \ + { [expr "$xcur+50"] [expr "$ycur+20"] } }" + + if { $mtype == "polygon" } { + print "input vertices=" $poly + + # Note a setVertices resets the initial rotation angle to 0.0 + send objmarker setVertices $poly + send objmarker setAttribute rotangle $posangle + send objmarker setAttributes x $xcur y $ycur + send objmarker getVertices tpoly + print "output vertices=" $tpoly + print [send objmarker getRegion] + } + + send objmarker getAttributes x x y y width w height h type t rotangle r + print "initial attributes " $x $y $w $h $t $r + + #send objmarker addCallback markerConstraint constraint + + if { $mtype == "text" } { + set text "This is a test string" + send objmarker "set text \{$text\}; redraw noerase" + } + + send objmarker set visible True + print "AFter visible - " + print "getRegions= " [send objmarker getRegion] + send objmarker getVertices tpoly + print "getVertices= " $tpoly + + send objmarker getAttributes x x y y width w height h type t rotangle r + print "visible attributes " $x $y $w $h $t $r +} + +proc markerConstraint { marker event attributes } { + set constraints [ ] + + #print $marker $event $attributes + + # Constrain X and Y to not move. + foreach i $attributes { + set old [lindex $i 1] + set new [lindex $i 2] + switch [lindex $i 0] { + x { if {[send $marker get type] == "rectangle "} { + lappend constraints "x $old" + } else { + lappend constraints "x $new" + } + } + y { if {[send $marker get type] == "rectangle "} { + lappend constraints "y $old" + } else { + lappend constraints "y $new" + } + } + width { lappend constraints "width $new" } + height { lappend constraints "height $new" } + rotangle { lappend constraints "rotangle $new" } + } + } + return $constraints +} diff --git a/vendor/x11iraf/guidemo/mkpkg b/vendor/x11iraf/guidemo/mkpkg new file mode 100644 index 00000000..ac2bc171 --- /dev/null +++ b/vendor/x11iraf/guidemo/mkpkg @@ -0,0 +1,30 @@ +# Make the GUIDEMO package. + +$call relink +$exit + +update: + $call relink + $call install + ; + +relink: + $set LIBS = "" + + $update libpkg.a + $omake x_guidemo.x + $link x_guidemo.o libpkg.a $(LIBS) -o xx_guidemo.e + ; + +install: + $move xx_guidemo.e bin$x_guidemo.e + ; + +libpkg.a: + $set XFLAGS = "-cqfx" + + hello.x + imbrowse.x <finfo.h> <ctype.h> <diropen.h> <error.h> <gim.h>\ + <gset.h> <imhdr.h> <imio.h> + zscale.x <imhdr.h> + ; diff --git a/vendor/x11iraf/guidemo/panel.gui b/vendor/x11iraf/guidemo/panel.gui new file mode 100644 index 00000000..7e521dad --- /dev/null +++ b/vendor/x11iraf/guidemo/panel.gui @@ -0,0 +1,94 @@ +# PANEL.GUI -- Test GUI for the frame and layout widgets. +# This gui can be run as "cl> hello gui=panel.gui". + +reset-server +appInitialize panel Panel { + *objects:\ + toplevel Frame frame\ + frame Layout panel\ + panel Frame label1F\ + label1F Label label1\ + panel Frame label2F\ + label2F Label label2\ + panel Command button1\ + panel Command button2\ + panel RadioGroup color + + *background: gray + *foreground: black + + *frame.highlightThickness: 0 + *frame.frameWidth: 2 + *frame.frameType: chiseled + *frame.innerOffset: 5 + *frame.outerOffset: 5 + + *panel.debug: False + *panel.borderWidth: 0 + + *panel.layout: horizontal { \ + 0 < +inf > \ + vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + label1F < +inf * +inf > \ + -1 \ + } \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + label2F < +inf * +inf > \ + -1 \ + } \ + 5 < +inf -5 > \ + horizontal {\ + -1 < +inf > \ + button1 < +inf * +inf > \ + 5 < +inf -5 > \ + button2 < +inf * +inf > \ + -1 < +inf > \ + }\ + 5 < +inf -5 > \ + } \ + 0 < +inf > \ + color < +inf * +inf > \ + 0 < +inf > \ + } + + *Command.highlightThickness: 0 + *Label.borderWidth: 0 + *Label.background: gray60 + *label1*shadowWidth: 0 + *label1F.frameType: sunken + *label1F.frameWidth: 2 + *label2*shadowWidth: 0 + *label2F.frameType: sunken + *label2F.frameWidth: 2 + + *color.location: 0 0 100 0 + *color.shrinkToFit: True + *color.outerOffset: 5 + *color.innerOffset: 5 + *color.frameWidth: 2 + *color*offIcon: diamond0s + *color*onIcon: diamond1s + *color.red.highlightColor: red + *color.green.highlightColor: green + *color.blue.highlightColor: blue + *color.yellow.highlightColor: yellow + *color.label: Color: + *color.labels: |red|green|blue|yellow + *color.selectionStyle: multi + *color.selection: 0 + + *allowShellResize: true + *beNiceToColormap: False +} + +# Start up the GUI. +createObjects +activate + +proc quit args { send client gkey q; deactivate unmap } +send button1 addCallback quit diff --git a/vendor/x11iraf/guidemo/panel2.gui b/vendor/x11iraf/guidemo/panel2.gui new file mode 100644 index 00000000..a4c997c3 --- /dev/null +++ b/vendor/x11iraf/guidemo/panel2.gui @@ -0,0 +1,820 @@ +# PANEL.GUI -- Test GUI for the frame and layout widgets. +# This gui can be run as "cl> hello gui=panel.gui". + +reset-server + +appInitialize panel2 Panel2 { + *objects:\ + toplevel Layout panel \ + panel Group viewBox \ + panel Group enhancementBox \ + panel Group blinkBox \ + panel Group optionsBox \ + panel Frame controlBox \ +\ + viewBox Layout view \ + view Group frameSelect \ + frameSelect Layout frame \ + frame TextToggle frame1 \ + frame TextToggle frame2 \ + frame TextToggle frame3 \ + frame TextToggle frame4 \ + frame Command prevFrame \ + frame Command nextFrame \ + view Frame frameDataBox \ + frameDataBox TextBox frameData \ + view Group zoomBox \ + zoomBox Layout zoom \ + zoom TextButton toggleZoom \ + zoom TextButton zoomIn \ + zoom Command x1 \ + zoom Command z2 \ + zoom Command z3 \ + zoom Command z4 \ + zoom Command z5 \ + zoom Command z8 \ + zoom TextButton zoomOut \ + zoom TextButton centerFrame \ + zoom Command d2 \ + zoom Command d3 \ + zoom Command d4 \ + zoom Command d5 \ + zoom Command d8 \ + view Layout viewButtons \ + viewButtons Command clearFrame \ + viewButtons Command flipX \ + viewButtons Command flipY \ + viewButtons Command flipXY \ + viewButtons Command fitFrame \ +\ + enhancementBox Layout enhancement \ + enhancement Scrollbar2 colorlistScroll \ + enhancement Frame colorlistFrame \ + colorlistFrame Porthole colorlistPort \ + colorlistPort MultiList colorlist \ + enhancement Frame colordataFrame \ + colordataFrame TextBox colordata \ + enhancement Label contrastLabel \ + enhancement Slider2d contrastSlider \ + enhancement Label brightnessLabel \ + enhancement Slider2d brightnessSlider \ + enhancement Command invertButton \ + enhancement Command optimizeButton \ +\ + blinkBox Layout blink \ + blink Label blinkFramesLabel \ + blink Command blinkFrame1 \ + blink Command blinkFrame2 \ + blink Command blinkFrame3 \ + blink Command blinkFrame4 \ + blink Command blinkReset \ + blink Label blinkRateLabel \ + blink Frame BRframe \ + BRframe Layout BRlayout \ + BRlayout Arrow BRdecrease \ + BRlayout TextBox BRtext \ + BRlayout Arrow BRincrease \ + blink Command registerButton \ + blink Command matchButton \ + blink Toggle blinkButton \ +\ + optionsBox TextToggle pannerButton \ + optionsBox TextToggle coordsBoxButton \ + optionsBox TextToggle autoscaleButton \ + optionsBox TextToggle antialiasButton \ + optionsBox TextToggle tileFramesButton \ + optionsBox TextToggle warningsButton \ +\ + controlBox Layout control \ + control Command initializeButton \ + control Command normalizeButton \ + control Command doneButton \ +\ + toplevel TransientShell warning \ + warning Layout warn \ + warn Frame warnFrame \ + warnFrame Layout WFlayout \ + WFlayout Icon warnIcon \ + WFlayout TextBox warnText \ + warn TextButton warnOk \ + warn TextButton warnCancel \ + warn TextButton warnHelp + + *background: gray + *foreground: black + *TextBox.background: gray60 + *internalWidth: 0 + *borderWidth: 0 + *Command.highlightThickness: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + *blinkFrame1.font: 7x13bold + *blinkFrame2.font: 7x13bold + *blinkFrame3.font: 7x13bold + *blinkFrame4.font: 7x13bold + + *panel.debug: False + *panel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -1 \ + vertical { \ + -1 \ + blinkBox < * +inf -inf > \ + -1 \ + optionsBox < * +inf -inf > \ + -1 \ + } \ + -1 \ + } \ + controlBox < +inf * > \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 400 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 5 + + *view.debug: False + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + -1 \ + vertical { \ + 5 < -5 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 5 < -5 > \ + } \ + -1 \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 2 + *frameData.width: 130 + *frameData.height: 50 + *frameData.label:\ + -- Frame 1 --\nX center: 123.45\nY center: 345.67\nX scale: 4\nY scale: 4 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 5 + *frameSelect.innerOffset: 5 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame: + + *frame.debug: False + *frame.layout: vertical { \ + frame1 < +inf * > \ + frame2 < +inf * > \ + frame3 < +inf * > \ + frame4 < +inf * > \ + 10 < +inf -10 > \ + horizontal { \ + -1 \ + prevFrame \ + 10 < +inf -5 > \ + nextFrame \ + -1 \ + } \ + -1 \ + } + + *frame*location: 0 0 10 20 + *frame*alignment: left + *frame*frameWidth: 0 + *frame*highlightThickness: 0 + *frame*frame1.label: \ 1\ \ + *frame*frame2.label: \ 2\ \ + *frame*frame3.label: \ 3\ \ + *frame*frame4.label: \ 4\ \ + *frame*Command.width: 24 + *frame*prevFrame.label: xx + *frame*nextFrame.label: xx + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 5 + *zoomBox.shrinkToFit: True + + *zoom.debug: False + *zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { \ + toggleZoom < +inf * +inf > \ + 2 \ + } \ + 2 \ + vertical { \ + 2 < +inf > \ + z5 \ + 1 < +inf > \ + z3 \ + 0 < +inf > \ + } \ + 2 \ + vertical { \ + zoomIn < +inf * +inf > \ + 2 \ + } \ + } \ + 1 < +inf > \ + horizontal { \ + 2 < +inf > \ + d8 d4 d2 x1 z2 z4 z8 \ + 2 < +inf > \ + } \ + 1 < +inf > \ + horizontal { \ + vertical { \ + 2 \ + zoomOut < +inf * +inf > \ + } \ + 2 \ + vertical { \ + 0 < +inf > \ + d3 \ + 1 < +inf > \ + d5 \ + 2 < +inf > \ + } \ + 2 \ + vertical { \ + 2 \ + centerFrame < +inf * +inf > \ + } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 0 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 0 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *zoomIn.foreground: royalBlue3 + *z4.foreground: royalBlue3 + *z5.foreground: royalBlue3 + *z8.foreground: royalBlue3 + *z2.foreground: royalBlue3 + *z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 0 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 0 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *zoomOut.foreground: mediumVioletRed + *d2.foreground: mediumVioletRed + *d3.foreground: mediumVioletRed + *d4.foreground: mediumVioletRed + *d5.foreground: mediumVioletRed + *d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.debug: False + *viewButtons.layout: horizontal { \ + 5 < -2 > \ + flipX < +inf * > \ + 5 < -2 > \ + flipY < +inf * > \ + 5 < -2 > \ + flipXY < +inf * > \ + 5 < -2 > \ + clearFrame < +inf * > \ + 5 < -2 > \ + fitFrame < +inf * > \ + 5 < -2 > \ + } + + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 100 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 5 + + *enhancement.debug: False + *enhancement.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistScroll < * +inf -inf > \ + -1 \ + colorlistFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + -1 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { \ + -1 \ + contrastLabel \ + 3 < -3 > \ + brightnessLabel \ + -1 \ + } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhancement*Minsize: 20 + *enhancement*FrameType: sunken + *enhancement*FrameWidth: 2 + *enhancement*BorderWidth: 0 + *enhancement*Label.ShadowWidth: 0 + *enhancement*thumbColor: gray + + *colorlistScroll.location: 0 0 20 10 + *colorlistScroll.vertical: True + *colorlist.width: 100 + *colorlist.height: 78 + *colordata.width: 100 + *colordata.height: 45 + *enhancement*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 20 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 20 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + ! BLINK + ! --------------------- + *blinkBox.label: Blink + *blinkBox.location: 0 0 230 0 + *blinkBox.shrinkToFit: False + *blinkBox.outerOffset: 5 + + + *blink.debug: False + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 10 < +inf -100% > \ + horizontal { \ + 3 \ + registerButton < +inf * > \ + 5 < -5 > \ + matchButton < +inf * > \ + 5 < -5 > \ + blinkButton < +inf * > \ + 2 \ + } \ + 3 < -3 > \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *blink*internalWidth: 4 + *blink*Arrow.background: gray60 + *blink*Arrow.foreground: gray + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + *blinkFramesLabel.label: Blink Frames: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 2 + *BRtext.width: 40 + *BRtext.height: 25 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 5 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 25 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *warningsButton.label: Warnings + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 5 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.debug: False + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + doneButton < +inf * > \ + 1 \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize + *doneButton.label: Done + + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*Layout.debug: False + *warning*TextBox.frameWidth: 0 + *warning*TextBox.background: gray + *warning*TextButton.frameWidth: 2 + *warning*TextButton.width: 40 + *warning*TextButton.height: 25 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 5 < -5 > \ + warnFrame < +inf * +inf > \ + 5 < -5 > \ + } \ + 1 < -1 > \ + horizontal { \ + 5 < -5 > \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 5 < +inf -5 > \ + warnHelp < +inf * > \ + 5 < -5 > \ + } \ + 1 < -1 > \ + } + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { \ + 5 < +inf -5 > \ + warnIcon \ + 5 < +inf -5 > \ + } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 280 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 250 + *warnText.height: 60 + *warnOk.label: OK + *warnCancel.label: Cancel + *warnHelp.label: Help + *warnHelp.sensitive: False + + *allowShellResize: true + *beNiceToColormap: False +} + +# Start up the GUI. +createObjects +activate + +proc quit args { send client gkey q; deactivate unmap } +send doneButton addCallback quit + +# Initialize icons. +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00}; + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00}; + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00}; + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00}; + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness + +# Initialize sliders. +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send colorlistScroll setScrollbar 0.5 0.1 + + +# The following code doesn't do anything useful, but helps demonstrate the +# GUI and tests various callbacks and other capabilities. + +# Frame selection. +set frame 1 + +proc setFrame {widget args} { + global frame + send frame$frame set on 0 + set frame [expr [send $widget get label] + 1 - 1] + send frame$frame set on 1 +} +proc nextFrame args { + global frame + send frame$frame set on 0 + incr frame; if {$frame > 4} {set frame 1} + send frame$frame set on 1 +} +proc prevFrame args { + global frame + send frame$frame set on 0 + set frame [expr $frame - 1] + if {$frame < 1} {set frame 4} + send frame$frame set on 1 +} + +proc clearFrame args { + global warnings + if {$warnings} { + send warnText set label \ + "Clearing the frame will destroy\n\ + all data in the frame" + send warning map + } +} +proc warnDone args { + send warning unmap +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send clearFrame addCallback clearFrame +foreach w {warnOk warnCancel} { send $w addCallback warnDone } +foreach i {1 2 3 4} { send frame$i addCallback setFrame } +send frame1 set on 1 + + +# Enhancement stuff. +set scrollHeight 0 +set colortable Grayscale +set contrast 0 +set brightness 0 + +proc resizeScrollbar {widget cbtype flags x y w h cw ch} { + global scrollHeight + set newHeight [expr $ch - $h] + if {$newHeight != $scrollHeight} { + send colorlistScroll setScrollbar 0.0 [expr double($h) / $ch] + set scrollHeight $newHeight + } +}; send colorlistPort addCallback resizeScrollbar + +proc scrollColorlist {widget cbtype pos} { + global scrollHeight + send colorlist set y [expr -int($scrollHeight * $pos)] +}; send colorlistScroll addCallback scrollColorlist scroll + +proc selectColor {widget cbtype selections indices} { + global colortable + foreach selection $selections { + set colortable $selection; updateColordata + } +}; send colorlist addCallback selectColor + +proc scrollContrast {widget cbtype x y} { + global contrast; set contrast $x; updateColordata +}; send contrastSlider addCallback scrollContrast + +proc scrollBrightness {widget cbtype x y} { + global brightness; set brightness $x; updateColordata +}; send brightnessSlider addCallback scrollBrightness + +proc updateColordata args { + global colortable contrast brightness + send colordata set label [format "-- %s --\nCon %4.2f Brt %4.2f" \ + $colortable $contrast $brightness] +} + +set colortables { + "Grayscale" + "Heat" + "Halley" + "Spectrum" + "Random" + "Ramp1" + "Ramp2" +} +send colorlist setList $colortables resize +updateColordata + + +# Blink stuff. +set blinkRate 2.0 + +proc setBlinkRate {widget args} { + global blinkRate + if {$widget == "BRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate +} +foreach widget {BRincrease BRdecrease} { + send $widget addCallback setBlinkRate +} + +proc setBlinkFrame {widget args} { + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > 4} { + set frame " " + } + } + send $widget set label $frame +} +foreach i {1 2 3 4} { + send blinkFrame$i addCallback setBlinkFrame +} + +proc toggleBlink {widget args} { + global blinkRate + if {$blinkRate < 0.01} { + send $widget set state 0 + } +} + +proc resetBlink args { + global blinkRate + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + set blinkRate 2.0 + send BRtext set label $blinkRate +} + +send blinkButton addCallback toggleBlink +send blinkReset addCallback resetBlink +send BRtext set label 2.0 + + +# Options stuff. +set warnings 1 + +proc setWarnings args { + global warnings + set warnings [send warningsButton get on] +} + +send warningsButton addCallback setWarnings +send warningsButton set on 1 +send coordsBoxButton set on 1 +send autoscaleButton set on 1 diff --git a/vendor/x11iraf/guidemo/rarrow2.xbm b/vendor/x11iraf/guidemo/rarrow2.xbm new file mode 100644 index 00000000..fb9f7b80 --- /dev/null +++ b/vendor/x11iraf/guidemo/rarrow2.xbm @@ -0,0 +1,6 @@ +#define rarrow2_width 16 +#define rarrow2_height 16 +static char rarrow2_bits[] = { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/guidemo/region.gui b/vendor/x11iraf/guidemo/region.gui new file mode 100644 index 00000000..4013c890 --- /dev/null +++ b/vendor/x11iraf/guidemo/region.gui @@ -0,0 +1,197 @@ +# REGION.GUI -- Demo the use of region markers. +# This GUI can be run as "cl> hello gui=region.gui". + +reset-server +appInitialize regions Regions { + *objects:\ + toplevel Paned panel\ + panel Box control\ + panel Gterm graphics\ + panel AsciiText output\ + control Command quitButton\ + control Command measureButton\ + control Toggle skyButton + + *background: gray + *foreground: black + *menubar.showGrip: False + *menubar.skipAdjust: True + *menubar.width: 480 + *skyButton.label: Annulus + *measureButton.label: Measure + *quitButton.label: Quit + + *graphics.resizable: true + *graphics.ginmodeCursor: circle + *graphics.width: 640 + *graphics.height: 480 + + *output.width: 480 + + *graphics.translations: \ + <Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() + + *allowShellResize: true + *shapeStyle: Rectangle + *beNiceToColormap: False + *Label*shadowWidth: 2 +} + +# Start up the GUI. +createObjects +send graphics setGterm +activate + +# Global variables +set marker objMarker ;# only one marker currently +set skyGap 10 ;# gap to sky annulus +set skyWidth 15 ;# width of sky annulus + + +# Procedures. +# ------------------------- + +proc quit args { send client gkey q; deactivate unmap } +send quitButton addCallback quit + +# Get a description of the region and print it in the output window. +proc measure args { + global marker + + # getRegion unmap will reverse any mappings and return raster coords. + set region [send $marker getRegion unmap] + send output set string $region + +}; send measureButton addCallback measure + + +# Draw/erase sky annulus. Once created these are not tied to the object +# region and the user is expected to toggle the skyButton to erase and +# redraw the annulus markers if the object marker is moved. If we wanted +# to be fancier about this we could register a move callback with the object +# marker and redraw the annulus markers at the new location if the object +# marker is moved. Currently there is no way to group markers so that they +# behave as one object. + +proc annulus args { + global skyGap skyWidth + global marker + + # In this case we use getRegion with no args, which returns window coords. + set region [send $marker getRegion] + + if [send skyButton get state] { + set x [lindex $region 2] + set y [lindex $region 3] + set width [lindex $region 4] + set height [lindex $region 5] + set rotangle [lindex $region 6] + + # Create a marker outlining the inner boundary of the annulus region. + # See obm/ObmW/Gterm.h for a list of marker attributes. + + send graphics createMarker sky1 \ + type ellipse \ + createMode noninteractive \ + lineColor blue \ + highlightColor blue \ + x $x \ + y $y \ + width [expr "$width + $skyGap"] \ + height [expr "$height + $skyGap"] \ + rotangle $rotangle \ + activated True \ + visible True \ + sensitive False + + # Create a marker outlining the outer boundary of the annulus region. + send graphics createMarker sky2 \ + type ellipse \ + createMode noninteractive \ + lineColor blue \ + highlightColor blue \ + x $x \ + y $y \ + width [expr "$width + $skyGap + $skyWidth"] \ + height [expr "$height + $skyGap + $skyWidth"] \ + rotangle $rotangle \ + activated True \ + visible True \ + sensitive False + + send sky1 "redraw noerase; lower" + send sky2 "redraw noerase; lower" + + } else { + send sky1 destroy + send sky2 destroy + } + +}; send skyButton addCallback annulus + + +# Support routines. +# ------------------------- + +# Create marker action. Makes a new marker. +proc makeMarker { parent x y } \ +{ + global markerTranslations marker + + send $parent createMarker $marker \ + type ellipse \ + createMode interactive \ + translations $markerTranslations \ + lineColor green \ + x $x \ + y $y + + send $marker addCallback moveResize moveResize +} + +proc moveResize args { + print "moveResize called: $args" +} + + +# Translations when pointer is inside a marker. +set markerTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() +} + +# Popup menu in effect when inside marker. +createMenu markerMenu graphics { + { Object f.title } + { f.dblline } + { Measure f.exec { + measure + } } + { Dummy1 f.exec { + print dummy1 ;# (replace by real code) + } } + { Dummy2 f.exec { + print dummy2 ;# (replace by real code) + } } + { f.line } + { Destroy f.exec { + send $marker destroy + } } +} diff --git a/vendor/x11iraf/guidemo/table.gui b/vendor/x11iraf/guidemo/table.gui new file mode 100644 index 00000000..68d71df9 --- /dev/null +++ b/vendor/x11iraf/guidemo/table.gui @@ -0,0 +1,1958 @@ +# TABDEMO.GUI -- Test the Table widget. + +reset-server +appInitialize tabdemo Tabdemo { + + *demoObjects:\ + toplevel Layout panel \ + panel Frame panelMenuFrame \ + panelMenuFrame Layout panelMenuBar \ + panelMenuBar Command newCol \ + panelMenuBar Command newRow \ + panelMenuBar Command newTable \ + panelMenuBar Command tclShell \ + panelMenuBar Command quitButton + + + Tabdemo*background: grey + *Tabdemo.geometry: +0+0 + + *Group.shrinkToFit: True + *Command.height: 28 + *Command.shadowWidth: 1 + *Frame.frameWidth: 1 + *Frame.innerOffset: 4 + *Frame.highlightThickness: 0 + *borderWidth: 0 + *Scrollbar2.location: 0 0 17 17 + *Scrollbar.beNiceToColormap: False + + *panel.width: 600 + *panel.height: 350 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 5 < +inf > horizontal { 5 < +inf > }\ + } + + *panelMenuBar.layout: horizontal { \ + 2 newRow 1 newCol 1 newTable 1 tclShell 2 < +inf > quitButton 2 \ + } + *newCol.label: New Col + *newRow.label: New Row + *newTable.label: New Table + *tclShell.label: TclShell + *quitButton.label: Quit + +} ; createObjects demoObjects + +send quitButton addCallback "send client gkey q ; deactivate unmap" + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Create the Table objects in the OBM. + +set tabnumber 0 ;# initialize table counter + +proc doTable args { + global tabnumber + + set tab [ format "tab%d" $tabnumber ] + set objs [ tableBuildObjects panel $tab ] + +# tableSetOption $tab DefLabels no +# tableSetOption $tab RowLabels no +# tableSetOption $tab ColLabels no +# tableSetOption $tab Tracking no +# tableSetOption $tab RowScroll no +# tableSetOption $tab ColScroll no +# tableSetOption $tab DefaultTranslations no + tableSetOption $tab RowMultiSelect no + tableSetOption $tab ColMultiSelect no +# tableSetOption $tab RowLabelCols 2 +# tableSetOption $tab ColLabelRows 2 + tableSetOption $tab Background bisque3 + + # Now create the new objects. + appExtend $objs + createObjects ${tab}Objects + + # Now construct a layout for the new object. + set new "" + set panStart "vertical \{ panelMenuFrame < +inf -inf * > 5 < -5 >" + for {set i 0} {$i <= $tabnumber} {incr i} { + + # Send the existing table a small height so they'll ajust to + # fit the new table. + if {$i < $tabnumber} { send tab${i}TableFrame set height 10 } + + # Append a layout spec for the table. + set new \ + [format "%s tab%dTableFrame < +inf -inf * +inf -inf > 5 < -5 >" \ + $new $i] + } + set panEnd "\}" + set panelLayout [format "%s %s %s" $panStart $new $panEnd] + + # Send the panel the new layout incorporating the newly created Table. + send panel set layout $panelLayout + + # Now create the table itself, it should appear as if by magic. + tableCreate $tab 12 30 { } + + # Apply some default test callbacks for selection/edit events. + tableAddSelectCallback $tab Row demoSelCB + tableAddSelectCallback $tab Col demoSelCB + tableAddSelectCallback $tab Cell demoSelCB + tableAddUnSelectCallback $tab Row demoUnSelCB + tableAddUnSelectCallback $tab Col demoUnSelCB + tableAddUnSelectCallback $tab Cell demoUnSelCB + tableAddEditCallback $tab demoEditCB + + # Increment the global table counter. + incr tabnumber + +} ; send newTable addCallback doTable + +proc demoSelCB { name row col x y args } { + print "demoSelCB: name=$name r=$row c=$col x=$x y=$y args='$args'" +} + +proc demoUnSelCB { name row col x y args } { + print "demoUnSelCB: name=$name r=$row c=$col x=$x y=$y args='$args'" +} + +proc demoEditCB { name row col str args } { + print "demoEditCB: name=$name row=$row col=$col str='$str' args='$args'" +} + + +################################################################################ + +################################################################################ +# +# TABLE WIDGET PROCEDURES -- This interface provides simple access to a +# named instance of a Table "meta-widget". The "widget" is actually a +# number of widgets (Table, Scrollbars, etc) in a common layout to provide +# row/col headings, scrollable data tables, and callbacks for [gs]etting +# attributes. The meta-widget is created on-the-fly with a given named +# and parent object, it is the callers responsibility to adjust the layout +# of the parent to incorporate the new objects. +# +# The Table widget itself has various quirks and non-standard implem- +# entations so features such as editing cells or access to certain callbacks +# are not fully implemented in the OBM and hidden here. Most of what's +# needed can be handled by these procedures, however these routines may be +# used to manage multiple named tables in a GUI. +# +# +# tableBuildObjects parent tab +# tableSetOption tab option value +# tableAddSelectCallback tab type cbname +# tableAddEditCallback tab cbname +# tableDestroyObjects tab +# +# tableCreate tab nrows ncols data +# tableSetData tab data +# tableSetColumnLabels tab labels +# tableSetRowLabels tab labels +# +# tableSelectRow tab [ rownum | "all" ] +# tableUnSelectRow tab [ rownum | "all" ] +# tableSelectCol tab [ colnum | "all" ] +# tableUnSelectCol tab [ colnum | "all" ] +# tableSelectCell tab x y +# tableUnSelectCell tab x y +# list = tableGetSelected tab type +# +# tableSetRowLabelsAttr tab attr value +# value = tableGetRowLabelsAttr tab attr +# tableSetColLabelsAttr tab attr value +# value = tableGetColLabelsAttr tab attr +# tableSetRowLabelAttr tab row attr value +# value = tableGetRowLabelAttr tab row attr +# tableSetColLabelAttr tab col attr value +# value = tableGetColLabelAttr tab col attr +# +# attr = tableGetCelllAttr tab row col attr +# tableSetCelllAttr tab row col attr value +# value = tableGetRowAttr tab row attr +# tableSetRowAttr tab row attr value +# value = tableGetColAttr tab col attr +# tableSetColAttr tab col attr value +# +# tableDeleteCol tab col +# tableDeleteRow tab row +# tableAddCol tab col width [where] +# tableAddRow tab row [where] +# +# nrows = tableGetNrows tab +# ncols = tableGetNcols tab +# height = tableGetHeight tab +# width = tableGetWidth tab +# +# See obm$widget.c for a complete list of the OBM commands available +# for this widget, and procedure header comments for details about the +# interface here. +# +################################################################################ + +set tabNrows(name) 0 +set tabNcols(name) 0 +set tabData(name) 0 +set tabColLabs(name) 0 +set tabRowHeights(name,j) 0 +set tabColWidths(name,i) 0 + +set tabHeight(name) 0 +set tabWidth(name) 0 +set tabScrollSize(name,type) 0 +set tabScrollPos(name,type) 0 + +# Meta-widget options, should be set before the tableCreate call. +set tabOption(name,RowLabels) yes +set tabOption(name,ColLabels) yes +set tabOption(name,DefLabels) yes +set tabOption(name,Tracking) yes +set tabOption(name,RowScroll) yes +set tabOption(name,ColScroll) yes +set tabOption(name,Editable) yes +set tabOption(name,RowSelect) yes +set tabOption(name,ColSelect) no +set tabOption(name,CellSelect) no +set tabOption(name,DefaultTranslations) yes +set tabOption(name,Background) grey +set tabOption(name,Foreground) black +set tabOption(name,HighlightColor) grey90 +set tabOption(name,RowLabelCols) 1 +set tabOption(name,ColLabelRows) 1 + +# Selection lists. +set tabSelected(name,Row) {} +set tabSelected(name,Col) {} +set tabSelected(name,Cell) {} +set tabSelectionCB(name,Row) {} +set tabSelectionCB(name,Col) {} +set tabSelectionCB(name,Cell) {} +set tabUnSelectionCB(name,Row) {} +set tabUnSelectionCB(name,Col) {} +set tabUnSelectionCB(name,Cell) {} +set tabEditCB(name) {} + + +# TABLEBUILDOBJECTS -- Utility routine to build the object list for the meta- +# widget. +# +# Usage: +# tableBuildObjects <parent> <tab> + +proc tableBuildObjects { parent tab } { + + set objDef { + *TABObjects: \ + PARENT Frame TABTableFrame \ + TABTableFrame Layout TABFrameLayout \ + TABFrameLayout Layout TABTableLayout \ + TABTableLayout Viewport TABTabView \ + TABTabView Table TABTab \ + TABTableLayout Label TABSpacer1 \ + TABTableLayout Viewport TABRowTabView \ + TABRowTabView Table TABRowTab \ + TABTableLayout Viewport TABColTabView \ + TABColTabView Table TABColTab \ + TABFrameLayout Label TABLabel \ + TABFrameLayout Label TABSpacer2 \ + TABFrameLayout Scrollbar TABColScroll \ + TABFrameLayout Scrollbar TABRowScroll \ +\ + toplevel TopLevelShell TABEditShell \ + TABEditShell Layout TABEditLayout \ + TABEditLayout Frame TABEditMenuFrame\ + TABEditMenuFrame Layout TABEditMenuBar \ + TABEditMenuBar Command TABEditApply \ + TABEditMenuBar Command TABEditClear \ + TABEditMenuBar Command TABEditCancel \ + TABEditLayout Frame TABEditFrame \ + TABEditFrame AsciiText TABEditText \ + + + + + ! Global Table widget resources. + *Table.literalWidth: 20 + *Table.rowHeight: 18 + *Table.shadowWidth: 2 + *Table.labelShadowWidth: 1 + *Table.tableMargin: 0 + *Table.columnMargin: 0 + *Table.rowMargin: 0 + *Table.internalHeight: 0 + *Table.internalWidth: 0 + *Table*font: 7x13bold + + *TABTableFrame*Group.shrinkToFit: True + *TABTableFrame*Command.height: 28 + *TABTableFrame*Command.shadowWidth: 1 + *TABTableFrame*Frame.frameWidth: 1 + *TABTableFrame*Frame.innerOffset: 4 + *TABTableFrame*Frame.highlightThickness: 0 + *TABTableFrame*Frame.borderWidth: 0 + *TABTableFrame*Frame.shrinkToFit: True + *TABTableFrame*Table.borderWidth: 1 + *TABTableFrame*Scrollbar.beNiceToColormap: False + + *TABTableFrame.height: 10 + *TABTableFrame.width: 10 + *TABTableFrame*Layout.height: 10 + *TABTableFrame*Layout.width: 10 + *TABTableFrame*Label.height: 12 + *TABTableFrame*Label.label: + *TABTableFrame*Label.font: 6x12 + + *TABFrameLayout.TABTableLayout.height: 10 + *TABFrameLayout.TABTableLayout.width: 10 + *TABFrameLayout.TABTableLayout*Layout.height: 10 + *TABFrameLayout.TABTableLayout*Layout.width: 10 + *TABFrameLayout.TABTableLayout*Viewport.height: 20 + *TABFrameLayout.TABTableLayout*Viewport.width: 20 + *TABFrameLayout.TABTableLayout*Table.height: 20 + *TABFrameLayout.TABTableLayout*Table.width: 20 + + + ! The following resources enable the scrollbars on the Viewport + ! widget but effectively hide them from display. This allows us + ! to control the viewport manually from the Table code, e.g. to + ! scroll both the column headings and data table. + *TABFrameLayout.TABTableLayout*Viewport.allowVert: True + *TABFrameLayout.TABTableLayout*Viewport.allowHoriz: True + *TABFrameLayout.TABTableLayout*Viewport.forceBars: True + *TABFrameLayout.TABTableLayout*Viewport.useBottom: True + *TABFrameLayout.TABTableLayout*Viewport.useRight: True + *TABFrameLayout.TABTableLayout*Viewport.borderWidth: 1 + + *TABTableLayout*TABRowTabView*vertical.thickness: 1 + *TABTableLayout*TABRowTabView*horizontal.thickness: 1 + *TABTableLayout*TABColTabView*vertical.thickness: 1 + *TABTableLayout*TABColTabView*horizontal.thickness: 1 + *TABTableLayout*TABTabView*vertical.thickness: 1 + *TABTableLayout*TABTabView*horizontal.thickness: 1 + + *TABTableFrame.TABFrameLayout.TABRowScroll.thickness: 12 + *TABTableFrame.TABFrameLayout.TABRowScroll.width: 12 + *TABTableFrame.TABFrameLayout.TABRowScroll.height: 12 + *TABTableFrame.TABFrameLayout.TABRowScroll.orientation: Vertical + + *TABTableFrame.TABFrameLayout.TABColScroll.thickness: 12 + *TABTableFrame.TABFrameLayout.TABColScroll.width: 12 + *TABTableFrame.TABFrameLayout.TABColScroll.height: 12 + *TABTableFrame.TABFrameLayout.TABColScroll.orientation: Horizontal + + *TABFrameLayout.layout: horizontal { \ + vertical { \ + 2 < -2 > \ + TABTableLayout < +inf -inf * +inf -inf > \ + 2 < -2 > \ + horizontal { \ + TABLabel 1 < -1 > TABColScroll < +inf -inf * > \ + } \ + } \ + vertical { \ + TABSpacer2 1 < -1 > TABRowScroll < * +inf -inf > 22 < -22 > \ + } \ + } + *TABTableFrame.TABFrameLayout.TABLabel.label: ( 0, 0) + *TABTableFrame.TABFrameLayout.TABLabel.font: 6x12 + *TABTableFrame.TABFrameLayout.TABLabel.width: 80 + *TABTableFrame.TABFrameLayout.TABLabel.height: 12 + *TABTableFrame.TABFrameLayout*TABColScroll.height: 12 + *TABTableFrame.TABFrameLayout.TABSpacer2.height: 27 + *TABTableFrame.TABFrameLayout.TABSpacer2.shadowWidth: 0 + + *TABTableLayout.layout: horizontal { \ + vertical { \ + TABSpacer1 1 < -1 > TABRowTabView < * +inf -inf > \ + } \ + 3 < -3 > \ + vertical { \ + TABColTabView < +inf -inf * > \ + 3 < -3 > \ + TABTabView < +inf -inf * +inf -inf > \ + } \ + 3 < -3 > \ + } + *TABTableLayout.TABSpacer1.height: 27 + *TABTableLayout.TABSpacer1.shadowWidth: 0 + + !---------------------------+ + ! Set the editor resources. | + !---------------------------+ + *TABEditShell.title: Table Value Editor + *TABEditShell.width: 275 + *TABEditShell.height: 80 + *TABEditLayout*borderWidth: 0 + *TABEditLayout.layout: vertical { \ + TABEditFrame < +inf -inf * +inf -inf > \ + -2 \ + TABEditMenuFrame < +inf -inf * > \ + -2 \ + } + + *TABEditMenuBar.layout: horizontal { \ + TABEditApply 5 \ + 10 < +inf -inf > \ + TABEditClear 5 \ + 10 < +inf -inf > \ + TABEditCancel 5 \ + } + *TABEditMenuFrame.height: 80 + *TABEditMenuFrame.outerOffset: 0 + *TABEditMenuFrame.innerOffset: 5 + *TABEditMenuFrame.frameType: chiseled + *TABEditMenuFrame.frameWidth: 2 + *TABEditFrame.frameType: sunken + *TABEditFrame.frameWidth: 2 + *TABEditFrame.outerOffset: 5 + *TABEditText*scrollVertical: never + *TABEditText*scrollHorizontal: whenNeeded + *TABEditText*font: 7x13 + *TABEditText*editType: edit + *TABEditApply.label: Apply + *TABEditApply.width: 150 + *TABEditClear.label: Clear + *TABEditClear.width: 150 + *TABEditCancel.label: Cancel + *TABEditCancel.width: 150 + + } + + regsub -all TAB $objDef $tab tmp1 + regsub -all PARENT $tmp1 $parent objs + set objs [format "{ %s }" $objs] + + return $objs +} + + +# TABLEDESTROYOBJECTS -- Destroy the specified table and all it's objects. +# +# Usage: +# tableDestroyObjects <tab> + +proc tableDestroyObjects { tab } { + destroyObject ${tab}TableFrame +} + + +# TABESETOPTION -- Set an option for the Table meta-widget. +# +# Usage: +# tableSetOption <tab> <option> [yes|no] +# +# where <tab> is the table name given when the meta-widget was created, and +# <option> is one of: +# +# +# Option Name Type Default Description +# ----------- ---- ------- ----------- +# RowLabels bool yes display a row label table +# ColLabels bool yes display a column label table +# DefLabels bool yes do default labels of rows/cols +# Tracking bool yes do coord tracking in data table +# RowScroll bool yes display row scrollbar +# ColScroll bool yes display column scrollbar +# Editable bool yes table is editable +# RowSelect bool yes rows are selectable +# ColSelect bool yes cols are selectable +# CellSelect bool yes cells are selectable +# RowMultiSelect bool yes multiple rows may be selected +# ColMultiSelect bool yes multiple cols may be selected +# CellMultiSelect bool yes multiple cells may be selected +# DefaultTranslations bool yes use default table translations +# Foreground color black meta-widget foreground color +# Background color grey meta-widget background color +# HighlightColor color grey90 selected item highlight color +# RowLabelCols int 1 number of columns in row labels +# ColLabelRows int 1 number of rows in column labels +# + +proc tableSetOption { tab option value } { + global tabOption + set tabOption(${tab},${option}) $value + + # Now handle the special cases where one option may disable some other. +} + + +# TABLEADDSELECTCALLBACK -- Add a user-defined callback to be executed +# when there is a row, column, or cell selection event occurs. +# +# Usage: +# tableAddSelectCallback <tab> <type> <cbname> +# +# where <type> is "Row", "Col", or "Cell" and <cbname> specifies a procedure +# to be called whenever the specified <type> is selected. Procedures are +# called as +# <cbname> name row col x y +# +# where 'name' is the table name, 'row' and 'col' are the coordinates of the +# selection and 'x' and 'y' are the raw event coordinates. Registered proc- +# edures are required to declare all these arguments but do not need to use +# them. + +proc tableAddSelectCallback { tab type cbname } { + global tabSelectionCB + lappend tabSelectionCB(${tab},${type}) $cbname +} + + +# TABLEADDUNSELECTCALLBACK -- Add a user-defined callback to be executed +# when there is a row, column, or cell un-selection event occurs. +# +# Usage: +# tableAddUnSelectCallback <tab> <type> <cbname> +# +# where <type> is "Row", "Col", or "Cell" and <cbname> specifies a procedure +# to be called whenever the specified <type> is selected. Procedures are +# called as +# <cbname> name row col x y state +# +# where 'name' is the table name, 'row' and 'col' are the coordinates of the +# selection and 'x' and 'y' are the raw event coordinates. Registered proc- +# edures are required to declare all these arguments but do not need to use +# them. + +proc tableAddUnSelectCallback { tab type cbname } { + global tabUnSelectionCB + lappend tabUnSelectionCB(${tab},${type}) $cbname +} + + + +# TABLEADDEDITCALLBACK -- Add a user-defined callback to be executed +# when there is an edit event. +# +# Usage: +# tableAddEditCallback <tab> <cbname> +# +# <cbname> specifies a procedure to be called whenever the table editor +# Apply button has been pressed. Procedures are called as +# +# <cbname> name row col new_string +# +# where 'name' is the table name, 'row' and 'col' are the coordinates of the +# edited cell and 'new_string' is the new value inserted in the table. Reg- +# istered procedures are required to declare all these arguments but do not +# need to use them. + +proc tableAddEditCallback { tab cbname } { + global tabEditCB + lappend tabEditCB(${tab}) $cbname +} + + +# TABLECREATE -- Create a named instance of the Table meta-widget. The +# individual objects in the meta-widget are created dynamically and the +# entire thing is created as a child of the named parent object. The +# standard callbacks are assigned and the table is initialized, however +# it is the callers responsibility to adjust the parent's layout to make +# the meta-widget visible and assign any constraint callbacks. +# +# Usage: +# tableCreate <tab> <nrows> <ncols> <data> +# +# The <data> is specified as a Tcl list of the form: +# +# { {r1c1 r1c2 ... r1cN} +# {r2c1 r2c2 ... r2cN} +# : +# {rNc1 rNc2 ... rNcN} } +# +# String values must be quoted, rows/cols will be truncated or cleared if +# the specified table size does not agree with the size of the data table +# being loaded. + +set tabBGWidgets { \ + TABTab TABRowTab TABColTab TABLabel TABColScroll \ + TABRowScroll TABEditApply TABEditClear TABEditCancel \ + TABEditApply TABEditClear TABEditCancel TABEditText \ + TABEditFrame TABEditMenuBar TABEditMenuFrame \ +} +set tabFGWidgets { \ + TABTab TABRowTab TABColTab TABLabel TABColScroll \ + TABRowScroll TABEditApply TABEditClear TABEditCancel \ + TABEditApply TABEditClear TABEditCancel TABEditText \ +} + +proc tableCreate { tab nrows ncols data } { + global tabNrows tabNcols tabRowHeights tabColWidths + global tabHeight tabWidth tabDebug tabOption + global tabEditCB tabSelectionCB tabUnSelectionCB + global tabSelected tabBGWidgets tabFGWidgets + + set err "" + catch { + if { ![info exists tabOption(${tab},RowLabelCols)] } { + set tabOption(${tab},RowLabelCols) $tabOption(name,RowLabelCols) + } + } err + if {$err != ""} { + set tabOption(${tab},RowLabelCols) $tabOption(name,RowLabelCols) + } + set err "" + catch { + if { ![info exists tabOption(${tab},ColLabelRows)] } { + set tabOption(${tab},ColLabelRows) $tabOption(name,ColLabelRows) + } + } err + if {$err != ""} { + set tabOption(${tab},ColLabelRows) $tabOption(name,ColLabelRows) + } + + + set tabNrows(${tab},data) $nrows + set tabNcols(${tab},data) $ncols + set tabNrows(${tab},rows) $nrows + set tabNcols(${tab},rows) $tabOption(${tab},RowLabelCols) + set tabNrows(${tab},cols) $tabOption(${tab},ColLabelRows) + set tabNcols(${tab},cols) $ncols + set tabData($tab) $data + + # Initialize with a default row height. + set rh [send ${tab}Tab get rowHeight] + set tabRowHeights($tab,default) $rh + for {set i 1} {$i <= $nrows} {incr i} { + set tabRowHeights($tab,$i) $rh + } + + # Initialize with a default column width. + set cw [send ${tab}Tab get defaultWidth] + for {set i 1} {$i <= $ncols} {incr i} { + set tabColWidths($tab,$i) $cw + } + + # Initialize the table. + send ${tab}Tab setTable $nrows $ncols $data + + # Initialize the labels. + tableSetDefaultLabels $tab + + # Save the table dimensions. + set tabHeight($tab) [ tableGetHeight $tab ] + set tabWidth($tab) [ tableGetWidth $tab ] + + # Set the default table translations. + tableSetDefaultTranslations $tab + + # Attach the default-callbacks to the new Table. + tableAddCallbacks $tab + + # Set Default Scrollbars for the table. + tableSetDefaultScrollbars $tab yes + + # Default the colors. + set err "" + catch { + if { ![info exists tabOption(${tab},HighlightColor)] != 0 } { + set tabOption(${tab},HighlightColor) $tabOption(name,HighlightColor) + } + } err + if {$err != ""} { + set tabOption(${tab},HighlightColor) $tabOption(name,HighlightColor) + } + set err "" + catch { + if { ![info exists tabOption(${tab},Background)] != 0 } { + set tabOption(${tab},Background) $tabOption(name,Background) + } + } err + if {$err != ""} { + set tabOption(${tab},Background) $tabOption(name,Background) + } + set err "" + catch { + if { ![info exists tabOption(${tab},Foreground)] != 0 } { + set tabOption(${tab},Foreground) $tabOption(name,Foreground) + } + } err + if {$err != ""} { + set tabOption(${tab},Foreground) $tabOption(name,Foreground) + } + + regsub -all TAB $tabBGWidgets $tab bgwidgets + foreach w $bgwidgets { + send $w set background $tabOption(${tab},Background) + } + regsub -all TAB $tabFGWidgets $tab fgwidgets + foreach w $fgwidgets { + send $w set foreground $tabOption(${tab},Foreground) + } + + # Default selections. + set tabSelected(${tab},Row) {} + set tabSelected(${tab},Col) {} + set tabSelected(${tab},Cell) {} + + set tabSelectionCB(${tab},Row) {} + set tabSelectionCB(${tab},Col) {} + set tabSelectionCB(${tab},Cell) {} + set tabUnSelectionCB(${tab},Row) {} + set tabUnSelectionCB(${tab},Col) {} + set tabUnSelectionCB(${tab},Cell) {} + set tabEditCB(${tab}) {} +} + + +# TABLESETDATA -- Set the data elements of a table meta-widget. +# +# Usage: +# tableSetData <tab> <data> +# +# where <tab> is the table name given when the meta-widget was created, and +# <data> is of the form: +# +# { {r1c1 r1c2 ... r1cN} +# {r2c1 r2c2 ... r2cN} +# : +# {rNc1 rNc2 ... rNcN} } + +proc tableSetData { tab data } { + global tabNrows tabNcols + + send ${tab}Tab setTable $tabNrows(${tab},data) $tabNcols(${tab},data) $data + +# send ${tab}Tab setTable \ +# [expr ($tabNrows(${tab},data) + 20)] \ +# [expr ($tabNcols(${tab},data) + 20)] \ +# $data +} + + +# TABLESETSIZE -- Set the size of a table meta-widget. +# +# Usage: +# tableSetSize <tab> <nrows> <ncols> +# + +proc tableSetSize { tab nrows ncols } { + global tabNrows tabNcols tabOption + global tabHeight tabWidth tabRowHeights + + set tabNrows(${tab},data) $nrows + set tabNcols(${tab},data) $ncols + + set tabNrows(${tab},rows) $nrows + set tabNcols(${tab},rows) $tabOption(${tab},RowLabelCols) + set tabNrows(${tab},cols) $tabOption(${tab},ColLabelRows) + set tabNcols(${tab},cols) $ncols + + send ${tab}Tab setTableSize $nrows $ncols + send ${tab}RowTab setTableSize $tabNrows(${tab},rows) $tabNcols(${tab},rows) + send ${tab}ColTab setTableSize $tabNrows(${tab},cols) $tabNcols(${tab},cols) + + set rh [send ${tab}Tab get rowHeight] + set tabRowHeights($tab,default) $rh + for {set i 1} {$i <= $nrows} {incr i} { + set tabRowHeights($tab,$i) $rh + } + + # Save the table dimensions. + set tabHeight($tab) [ tableGetHeight $tab ] + set tabWidth($tab) [ tableGetWidth $tab ] + + #tableSetDefaultScrollbars $tab yes +} + + +# TABLESETCOLUMNLABELS -- Set the column header labels for a table. +# meta-widget. +# +# Usage: +# tableSetColumnLabels <tab> <column_labs> +# +# where <tab> is the table name given when the meta-widget was created, and +# <data> is of the form: +# +# { { r1c1 } { r1c2 } ... { r1cN } } + +proc tableSetColumnLabels { tab col_labs } { + global tabNrows tabNcols + send ${tab}ColTab \ + setTable $tabNrows(${tab},cols) $tabNcols(${tab},cols) $col_labs +} + + +# TABLESETROWLABELS -- Set the row header labels for a table. +# meta-widget. +# +# Usage: +# tableSetColumnLabels <tab> <row_labs> +# +# where <tab> is the table name given when the meta-widget was created, and +# <data> is of the form: +# +# { {r1c1 r1c2 ... r1cN} } + +proc tableSetRowLabels { tab row_labs } { + global tabNrows tabNcols + send ${tab}RowTab \ + setTable $tabNrows(${tab},rows) $tabNcols(${tab},rows) $row_labs +} + + +# TABLESETCOLLABELSATTR -- Set the column header labels for a table +# meta-widget. +# +# Usage: +# tableSetColumnLabels <tab> <attr> <value> [<row>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableSetColLabelsAttr { tab attr value args } { + if {$args != ""} { + send ${tab}ColTab setRowAttr $args $attr $value + } else { + send ${tab}ColTab setRowAttr 1 $attr $value + } +} + + +# TABLESETROWLABELSATTR -- Set the row header labels for a table meta-widget. +# +# Usage: +# tableSetRowLabelsAttr <tab> <attr> <value> [<col>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableSetRowLabelsAttr { tab attr value args } { + if {$args != ""} { + send ${tab}RowTab setColAttr $args $attr $value + } else { + send ${tab}RowTab setColAttr 1 $attr $value + } +} + + +# TABLEGETROWLABELSATTR -- Get the row header labels for a table meta-widget. +# +# Usage: +# value = tableGetRowLabelsAttr <tab> <attr> [<col>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableGetRowLabelsAttr { tab attr args } { + if {$args != ""} { + return [ send ${tab}RowTab getColAttr $args $attr ] + } else { + return [ send ${tab}RowTab getColAttr 1 $attr ] + } +} + + +# TABLEGETCOLLABELSATTR -- Get the column header labels for a table. +# meta-widget. +# +# Usage: +# value = tableGetColLabelsAttr <tab> <attr> [<row>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableGetColLabelsAttr { tab attr args } { + if {$args != ""} { + return [ send ${tab}ColTab getRowAttr $args $attr ] + } else { + return [ send ${tab}ColTab getRowAttr 1 $attr ] + } +} + + +# TABLESETROWLABELATTR -- Set the specified attribute for the row label table. +# +# Usage: +# tableSetRowLabelAttr <tab> <row> <attr> <value> [<row>] +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableSetRowLabelAttr { tab row attr value args } { + if {$args != ""} { + send ${tab}RowTab setCellAttr $row $args $attr $value + } else { + send ${tab}RowTab setCellAttr $row 1 $attr $value + } +} + + +# TABLESETCOLLABELATTR -- Get the specified attribute for the col label table. +# +# Usage: +# value = tableSetColLabelAttr <tab> <col> <attr> <value> [<row>] +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableSetColLabelAttr { tab col attr value args } { + if {$args != ""} { + send ${tab}ColTab setCellAttr $args $col $attr $value + } else { + send ${tab}ColTab setCellAttr 1 $col $attr $value + } +} + + +# TABLEGETCELLATTR -- Get the specified attribute for the cell. +# +# Usage: +# value = tableGetCellAttr <tab> <row> <col> <attr> +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableGetCellAttr { tab row col attr } { + return [ send ${tab}Tab getCellAttr $row $col $attr ] +} + + +# TABLESETCELLATTR -- Set the specified attribute for the cell. +# +# Usage: +# tableSetCellAttr <tab> <row> <col> <attr> <value> +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableSetCellAttr { tab row col attr value } { + send ${tab}Tab setCellAttr $row $col $attr $value +} + + +# TABLEGETROWATTR -- Get the specified attribute for the row. +# +# Usage: +# value = tableGetCellAttr <tab> <row> <attr> +# +# The row position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a row include: +# +# background background color +# foreground foreground color + +proc tableGetRowAttr { tab row attr } { + return [ send ${tab}Tab getRowAttr $row $attr ] +} + + +# TABLESETROWATTR -- Set the specified attribute for the row. +# +# Usage: +# tableSetRowAttr <tab> <row> <attr> <value> +# +# The row position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a row include: +# +# background background color +# foreground foreground color + +proc tableSetRowAttr { tab row attr value } { + send ${tab}Tab setRowAttr $row $attr $value +} + + +# TABLEGETCOLATTR -- Get the specified attribute for the column. +# +# Usage: +# value = tableGetColAttr <tab> <col> <attr> +# +# The column position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a column include: +# +# width column width (pixels) +# background background color (string) +# foreground foreground color (string) +# justify text justification (string) + +proc tableGetColAttr { tab col attr } { + return [ send ${tab}Tab getColAttr $col $attr ] +} + + +# TABLESETCOLATTR -- Set the specified attribute for the column. +# +# Usage: +# tableSetColAttr <tab> <col> <attr> <value> +# +# The column position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a column include: +# +# width column width (pixels) +# background background color (string) +# foreground foreground color (string) +# justify text justification (string) + +proc tableSetColAttr { tab col attr value } { + global tabColWidths tabNcols + + send ${tab}Tab setColAttr $col $attr $value + if {$attr == "width"} { + set tabColWidths(${tab},$col) $value + } +} + + +# TABLEDELETECOL -- Delete the specified column from the named table. +# +# Usage: +# tableDeleteCol <tab> <col> + +proc tableDeleteCol { tab col } { + global tabColWidths tabNcols + + send ${tab}Tab deleteCol $col + send ${tab}ColTab deleteCol $col + incr tabNcols(${tab},data) -1 + catch { unset tabColWidths(${tab},$col) } err +} + + +# TABLEDELETEROW -- Delete the specified row from the named table. +# +# Usage: +# tableDeleteRow <tab> <row> + +proc tableDeleteRow { tab row } { + global tabRowHeights tabNrows + + send ${tab}Tab deleteRow $row + send ${tab}RowTab deleteRow $row + incr tabNrows(${tab},data) -1 + catch { unset tabRowHeights(${tab},$row) } err +} + + +# TABLEDADDCOL -- Add a column to the named table at the specified position. +# +# Usage: +# tableAddCol <tab> <col> <width> + +proc tableAddCol { tab col width args} { + global tabColWidths tabNcols + + send ${tab}Tab addCol $col $width $args + send ${tab}ColTab addCol $col $width $args + incr tabNcols(${tab},data) + + set ncols $tabNcols(${tab},data) + if {$col == "first"} { + set colnum 1 + } elseif {$col == "last"} { + set colnum $tabNcols(${tab},data) + } else { + set colnum $col + } + + # Update the column widths. + for {set c $ncols} {$c > $colnum} {incr c -1} { + set tabColWidths(${tab},$c) $tabColWidths(${tab},[expr ($c - 1)]) + } + set tabColWidths(${tab},$colnum) $width +} + + +# TABLEADDROW -- Add a rows to the named table at the specified position. +# +# Usage: +# tableAddRow <tab> <row> + +proc tableAddRow { tab row args } { + global tabRowHeights tabNrows + + send ${tab}Tab addRow $row $args + send ${tab}RowTab addRow $row $args + incr tabNrows(${tab},data) + set tabRowHeights(${tab},$row) $tabRowHeights(${tab},default) +} + + +# TABLEGETNROWS -- Return the number of rows in a named table. +# +# Usage: +# nrows = tableGetNrows <tab> + +proc tableGetNrows { tab } { + global tabNrows + return $tabNrows(${tab},data) +} + + +# TABLEGETNCOLS -- Return the number of columns in a named table. +# +# Usage: +# ncols = tableGetNcols <tab> + +proc tableGetNcols { tab } { + global tabNcols + return $tabNcols(${tab},data) +} + + +# TABLEGETHEIGHT -- Compute the height of the table given varying row heights. +# +# Usage: +# height = tableGetHeight <tab> + +proc tableGetHeight { tab } { + return [ send ${tab}Tab get height ] +} + + +# TABLEGETWIDTH -- Compute the width of the table given varying column widths. +# +# Usage: +# width = tableGetWidth <tab> + +proc tableGetWidth { tab } { + return [ send ${tab}Tab get width ] +} + + +# TABLEGETSELECTED -- Return a list of the selected items. +# +# Usage: list = tableGetSelected tab type +# +# where <type> is 'Row', 'Col', or 'Cell'. + +proc tableGetSelected { tab type } { + global tabSelected + return $tabSelected(${tab},${type}) +} + + + +# TABLESELECTROW -- User-selectable row procedure. Row may be the string +# "all" in which case we select all rows in the table, otherwise may sure +# selection is unique. + +proc tableSelectRow { tab row } { + global tabSelected tabOption tabNrows + + set color $tabOption(${tab},HighlightColor) + if {$row == "all"} { + for {set i 0} {$i < $tabNrows(${tab},data)} {incr i} { + set index [lsearch $tabSelected(${tab},Row) $row ] + if {$index < 0} { + lappend tabSelected(${tab},Row) $i + tableSetRowAttr ${tab} $i background $color + tableSetRowAttr ${tab}Row $i background $color + } + } + } else { + set index [lsearch $tabSelected(${tab},Row) $row ] + if {$index < 0} { + lappend tabSelected(${tab},Row) $row + tableSetRowAttr ${tab} $row background $color + tableSetRowAttr ${tab}Row $row background $color + } + } +} + + +# TABLESELECTCOL -- User-selectable column procedure. Col may be the string +# "all" in which case we select all cols in the table, otherwise may sure +# selection is unique. + +proc tableSelectCol { tab col } { + global tabSelected tabOption tabNcols + + set color $tabOption(${tab},HighlightColor) + if {$col == "all"} { + for {set i 0} {$i < $tabNcols(${tab},data)} {incr i} { + set index [lsearch $tabSelected(${tab},Col) $col ] + if {$index < 0} { + lappend tabSelected(${tab},Col) $i + tableSetColAttr ${tab} $i background $color + tableSetColAttr ${tab}Col $i background $color + } + } + } else { + set index [lsearch $tabSelected(${tab},Col) $col ] + if {$index < 0} { + lappend tabSelected(${tab},Col) $col + tableSetRowAttr ${tab} $col background $color + tableSetRowAttr ${tab}Col $col background $color + } + } +} + + +# TABLESELECTCELL -- User-callable cell selection procedure + +proc tableSelectCell { tab col row } { + global tabSelected tabOption + + set color $tabOption(${tab},HighlightColor) + set index [lsearch $tabSelected(${tab},Col) [list $row $col] ] + if {$index < 0} { + lappend tabSelected(${tab},Cell) [list $row $col] + tableSetCellAttr ${tab} $row $col background $color + } +} + + +# TABLEUNSELECTROW -- Deselect the specified row. + +proc tableUnSelectRow { tab row } { + global tabSelected tabOption tabNrows + + set color $tabOption(${tab},Background) + if {$row == "all"} { + for {set i 0} {$i < $tabNrows(${tab},data)} {incr i} { + set index [lsearch $tabSelected(${tab},Row) $i ] + if {$index >= 0} { + set tabSelected(${tab},Row) \ + [ lreplace $tabSelected(${tab},Row) $index $index ] + tableSetRowAttr ${tab} $i background $color + tableSetRowAttr ${tab}Row $i background $color + } + } + } else { + # Delete it from the list. + set index [lsearch $tabSelected(${tab},Row) $row ] + if {$index >= 0} { + set tabSelected(${tab},Row) \ + [ lreplace $tabSelected(${tab},Row) $index $index ] + tableSetRowAttr ${tab} $row background $color + tableSetRowAttr ${tab}Row $row background $color + } + } +} + + +# TABLEUNSELECTCOL -- Deselect the specified col. + +proc tableUnSelectCol { tab col } { + global tabSelected tabOption tabNrows + + set color $tabOption(${tab},Background) + if {$col == "all"} { + for {set i 0} {$i < $tabNcols(${tab},data)} {incr i} { + set index [lsearch $tabSelected(${tab},Col) $i ] + if {$index >= 0} { + set tabSelected(${tab},Col) \ + [ lreplace $tabSelected(${tab},Col) $index $index ] + tableSetColAttr ${tab} $i background $color + tableSetColAttr ${tab}Col $i background $color + } + } + } else { + # Delete it from the list. + set index [lsearch $tabSelected(${tab},Col) $col ] + if {$index >= 0} { + set tabSelected(${tab},Col) \ + [ lreplace $tabSelected(${tab},Col) $index $index ] + tableSetColAttr ${tab} $col background $color + tableSetColAttr ${tab}Col $col background $color + } + } +} + + +# TABLEUNSELECTCELL -- Deselect the specified cell. + +proc tableUnSelectCell { tab col row } { + global tabSelected tabOption + + set val [list $row $col] + set index [lsearch $tabSelected(${tab},Cell) $val ] + set color $tabOption(${tab},Background) + + # Delete it from the list. + if {$index >= 0} { + set tabSelected(${tab},Cell) \ + [ lreplace $tabSelected(${tab},Cell) $index $index ] + tableSetCellAttr ${tab} $row $col background $color + } +} + + + +#============================================================================== +# TABLEDIT -- Enable the cell editor +#============================================================================== + +set tabEditRow 0 +set tabEditCol 0 +set tabEditValue "" + +set tableEditorUp 0 + +proc tableEdit { name x y } { + global tabEditValue tabEditRow tabEditCol tableEditCB, tableEditorUp + + regsub Tab $name "" tab + + set ry [tablePos2CellY $tab $y] + set rx [tablePos2CellX $tab $x] + + if {$rx < 0 || $ry < 0} \ + return + + set newcell 0 + if {$tabEditRow != $rx || $tabEditCol != $ry} { + set newcell 1 + } + + set tabEditCol [tablePos2CellX $tab $x] + set tabEditRow [tablePos2CellY $tab $y] + set tabEditValue [tableGetCellAttr $tab $tabEditRow $tabEditCol label] + + if {$tableEditorUp == 0 || $newcell == 1} { + send ${tab}EditApply addCallback tableEditApply + send ${tab}EditCancel addCallback tableEditCancel + send ${tab}EditClear addCallback tableEditClear + send ${tab}EditText addCallback tableEditLoad + send ${tab}EditText set string $tabEditValue + send ${tab}EditShell move $x [expr ($y + 50)] + send ${tab}EditShell map + set tableEditorUp 1 + } else { + send ${tab}EditApply deleteCallback tableEditApply + send ${tab}EditCancel deleteCallback tableEditCancel + send ${tab}EditClear deleteCallback tableEditClear + send ${tab}EditText deleteCallback tableEditLoad + send ${tab}EditShell unmap + set tableEditorUp 0 + } +} + +proc tableEditApply { button args } { + global tabEditValue tabEditRow tabEditCol tabEditCB tabEditorUp + regsub EditApply $button "" tab + + set str [send ${tab}EditText get string] + + tableSetCellAttr $tab $tabEditRow $tabEditCol label $str + set tabEditValue $str + + # Now do the user-defined selection callbacks. + if { [llength $tabEditCB(${tab})] > 0} { + foreach cb $tabEditCB(${tab}) {$cb $tab $tabEditRow $tabEditCol "$str"} + } + + # Close the window. + send ${tab}EditApply deleteCallback tableEditApply + send ${tab}EditCancel deleteCallback tableEditCancel + send ${tab}EditClear deleteCallback tableEditClear + send ${tab}EditText deleteCallback tableEditLoad + send ${tab}EditShell unmap + set tableEditorUp 0 +} + +proc tableEditLoad { widget mode pattern args } { + regsub EditText $widget "" tab + tableEditApply ${tab}EditApply +} + +proc tableEditClear { button args } { + global tabEditValue + + regsub EditClear $button "" tab + send ${tab}EditText set string "" +} + +proc tableEditCancel { button args } { + global tableEditValue tableEditorUp + + regsub EditCancel $button "" tab + send ${tab}EditShell unmap + send ${tab}EditApply deleteCallback tableEditApply + send ${tab}EditCancel deleteCallback tableEditCancel + send ${tab}EditClear deleteCallback tableEditClear + send ${tab}EditText deleteCallback tableEditLoad + set tableEditorUp 0 +} + + +############################################################################### +# +# Private Procedures +# +############################################################################### + + +# TABLEADDCALLBACKS -- Add the default widget callbacks. + +proc tableAddCallbacks { tab } { + + # Attach the scrollbars actions. + if {[ tableOption $tab RowScroll] == "yes"} { + send ${tab}RowScroll addCallback tableJumpScroll + } else { + send ${tab}RowScroll "unmap ; set width 0" + } + + if {[ tableOption $tab ColScroll] == "yes"} { + send ${tab}ColScroll addCallback tableJumpScroll + } else { + send ${tab}Label set height 0 + send ${tab}ColScroll "unmap ; set height 0" + } + + if {[tableOption $tab Tracking] == "no"} { + send ${tab}Label set label "" + send ${tab}Label set width 50 + } + + # Setup a resize handler that will adjust the scrollbars/viewports. + send ${tab}TableFrame addEventHandler tableResizeHandler structureNotifyMask +} + + +# TABLERESIZEHANDLER -- Resize callbacks, called as an eventHandler when +# the parent window or the table meta-widget changes size. All we need to +# do here is reset the scrollbars to reflect the new size. + +proc tableResizeHandler { table args } { + regsub TableFrame $table "" tab + #tableSetDefaultScrollbars $tab no + tableSetDefaultScrollbars $tab yes +} + + +# TABLETRACK -- Track the motion in the table. + +proc tableTrack { name x y } { + regsub Tab $name "" tab + if {[ tableOption $tab Tracking] == "no"} { + return + } + + set nr [tableGetNrows $tab] + set nc [tableGetNcols $tab] + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + if {$col < 0 || $row < 0} { + send ${tab}Label set label " " + } else { + send ${tab}Label set label [ format "(%3d,%3d)" $row $col ] + } +} + + +# TABLESELECT -- Do the default selection callback which applies to rows, +# columns and cells. + +proc tableSelect { name type x y } { + global tabOption tabSelected tabSelectionCB tabUnSelectionCB + + + regsub Row $name "" rc + regsub Col $name "" cc + + if {$type == "Row"} { + if {$rc == $name || [ tableOption $name RowSelect ] == "no"} \ + return + regsub ${type}Tab $name "" tab + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + set val $row + } elseif {$type == "Col"} { + if {$cc == $name || [ tableOption $name ColSelect ] == "no"} \ + return + regsub ${type}Tab $name "" tab + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + set val $col + } elseif {$type == "Cell"} { + if {$rc != $name && $cc != $name} \ + return + if {[ tableOption $name CellSelect ] == "no"} \ + return + regsub Tab $name "" tab + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + set val [list $row $col] + } + + if {$col < 0 || $row < 0} \ + return + + set index [ lsearch $tabSelected(${tab},${type}) $val ] + set color $tabOption(${tab},HighlightColor) + + # If we're doing a radio selection, turn off anything already selected. + + if {[ tableOption $tab ${type}MultiSelect] == "no"} { + if { [llength $tabSelected(${tab},${type})] == 1} { + tableSet${type}Attr ${tab} \ + [lindex $tabSelected(${tab},${type}) 0] \ + background $tabOption(${tab},Background) + tableSet${type}Attr ${tab}${type} \ + [lindex $tabSelected(${tab},${type}) 0] \ + background $tabOption(${tab},Background) + + # Now do the user-defined un-selection callbacks. + if { [llength $tabUnSelectionCB(${tab},${type})] > 0} { + foreach cb $tabUnSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 0 + } + } + + set tabSelected(${tab},${type}) [list $val ] + + if {$type == "Row"} { + foreach c $tabSelected(${tab},Col) { + tableSetColAttr ${tab} $c background $color + } + } elseif {$type == "Col"} { + foreach c $tabSelected(${tab},Row) { + tableSetRowAttr ${tab} $c background $color + } + } + } else { + lappend tabSelected(${tab},${type}) $val + } + } else { + if { $index < 0} { + lappend tabSelected(${tab},${type}) $val + } + } + + # If this has already been selected, toggle it. + if { $index >= 0} { + if {$type != "Cell"} { + tableSet${type}Attr ${tab} \ + [lindex $tabSelected(${tab},${type}) $index] \ + background $tabOption(${tab},Background) + tableSet${type}Attr ${tab}${type} \ + [lindex $tabSelected(${tab},${type}) $index] \ + background $tabOption(${tab},Background) + + # Now do the user-defined un-selection callbacks. + if { [llength $tabUnSelectionCB(${tab},${type})] > 0} { + foreach cb $tabUnSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 0 + } + } + + } else { + tableSet${type}Attr ${tab} \ + $row $col background $tabOption(${tab},Background) + + # Now do the user-defined selection callbacks. + if { [llength $tabUnSelectionCB(${tab},${type})] > 0} { + foreach cb $tabUnSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 0 + } + } + } + + # Delete it from the list + set tabSelected(${tab},${type}) \ + [ lreplace $tabSelected(${tab},${type}) $index $index ] + + # Go back and re-select the row/col intersection but don't + # generate an event for it, purely cosmetic. + if {$type == "Row"} { + foreach c $tabSelected(${tab},Col) { + tableSetColAttr ${tab} $c background $color + } + } elseif {$type == "Col"} { + foreach c $tabSelected(${tab},Row) { + tableSetRowAttr ${tab} $c background $color + } + } + + } else { + + # Highlight the selected item. + if {$type != "Cell"} { + tableSet${type}Attr ${tab} $val background $color + tableSet${type}Attr ${tab}${type} $val background $color + } else { + tableSet${type}Attr ${tab} $row $col background $color + } + + # Now do the user-defined selection callbacks. + if { [llength $tabSelectionCB(${tab},${type})] > 0} { + foreach cb $tabSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 1 + } + } + } +} + + +# TABLESETDEFAULTLABELS -- Set the default labels for the table, i.e. letters +# for columns headings and numbers for the row labels. +# +# Usage: +# tableSetDefaultLabels <tab> + +proc tableSetDefaultLabels { tab } { + # Set the default Row labels, i.e numbers + tableSetDefaultRowLabels $tab + + # Now set the default Column Labels, i.e. letters + tableSetDefaultColLabels $tab +} + + +# TABLESETDEFAULTTRANSLATIONS -- Set the default translations for the widget. + +proc tableSetDefaultTranslations { tab } { + + if {[ tableOption $tab DefaultTranslations ] == "no"} { + return + } + + # Set the coord tracking translations. + set trans1 "" + if {[ tableOption $tab Tracking ] == "yes"} { + set trans1 { \ + <Motion>:call(tableTrack,$name,$x,$y) + } + } + + set trans2 "" + if {[ tableOption $tab CellSelect ] == "yes"} { + set trans2 { \ + <Btn1Down>:call(tableSelect,$name,Cell,$x,$y) + } + } + + set trans3 "" + if {[ tableOption $tab Editable ] == "yes"} { + set trans3 { \ + <Btn3Down>:call(tableEdit,$name,$x,$y) + } + } + set trans "$trans1 $trans2 $trans3" + send ${tab}Tab set translations $trans + + + # Set the row-selectable translations. + if {[ tableOption $tab RowSelect ] == "yes"} { + send ${tab}RowTab set translations \ + "<Btn1Down>: call(tableSelect,\$name,Row,\$x,\$y)" + } + + # Set the col-selectable translations. + if {[ tableOption $tab ColSelect ] == "yes"} { + send ${tab}ColTab set translations \ + "<Btn1Down>: call(tableSelect,\$name,Col,\$x,\$y)" + } +} + + +# TABLESETDEFAULTSCROLLBARS -- Set the default scrollbar position and size +# in the meta-widget. + +proc tableSetDefaultScrollbars { tab init } { + global tabHeight tabWidth tabScrollSize tabScrollPos tabDebug + global tabNcols tabNrows tabColWidths + + + set visW [ send ${tab}TabView get width] + set visH [ send ${tab}TabView get height] + set rh [ send ${tab}Tab get rowHeight] + set sw [ send ${tab}Tab get shadowWidth] + set th [expr ($tabNrows(${tab},data) * ($rh + (2 * $sw)) )] + set tw 0 + for {set i 1} {$i <= $tabNcols(${tab},data)} {incr i} { + set w $tabColWidths(${tab},$i) + set tw [ expr ($tw + $w + (2 * $sw)) ] + } + set rowS [max 0.0 [min 1.0 [expr (double($visH)/double($th)) ]]] + set colS [max 0.0 [min 1.0 [expr (double($visW)/double($tw)) ]]] +#print "defScroll: data visW=$visW visH=$visH th=$th tw=$tw" +#print "defScroll: ($tab,$init) rowS = $rowS colS = $colS" + + set tabScrollSize($tab,row) $rowS + set tabScrollSize($tab,col) $colS + set tabScrollPos($tab,row) 0.0 + set tabScrollPos($tab,col) 0.0 + + if {[ tableOption $tab RowScroll] == "yes"} { + send ${tab}RowScroll setScrollbar 0.0 $tabScrollSize($tab,row) + } + if {[ tableOption $tab ColScroll] == "yes"} { + send ${tab}ColScroll setScrollbar 0.0 $tabScrollSize($tab,col) + } + + if {$init == "yes"} { + send ${tab}TabView setLocation 0.0 0.0 + send ${tab}ColTabView setLocation 0.0 0.0 + send ${tab}RowTabView setLocation 0.0 0.0 + } +} + + +# TABLEJUMPSCROLL -- Scroll the specified table. This scrolls both the +# data and row/column label tables. + +proc tableJumpScroll { widget cbtype pos } { + global scrollHeight tabWidth tabHeight tabDebug + global tabScrollSize tabScrollPos tabDebug + + if {$pos < 0.01} { + set pos 0.0 + } + + if { [string match *ColScroll $widget] } { + regsub ColScroll $widget "" tab + set y $tabScrollPos($tab,row) + send ${tab}TabView setLocation $pos $y + send ${tab}ColTabView setLocation $pos 0.0 + set tabScrollPos($tab,col) $pos + + } elseif { [string match *RowScroll $widget] } { + regsub RowScroll $widget "" tab + set x $tabScrollPos($tab,col) + send ${tab}TabView setLocation $x $pos + send ${tab}RowTabView setLocation 0.0 $pos + set tabScrollPos($tab,row) $pos + } +} + + +# TABLEOPTION -- Return any defined table option. + +proc tableOption { tab option } { + global tabOption + + set val yes + catch { + if {[info exists tabOption(${tab},${option}) ]} { + if { $tabOption(${tab},${option}) } { + set val yes + } else { + set val no + } + } + } err + + return $val +} + + +# TABLEPOS2CELLX -- Convert a widget position to a cell column number. + +proc tablePos2CellX { tab x } { + global tabColWidths tabNcols + + set nc [ tableGetNcols $tab ] + set cellX 1 + for {set w 0} {$w < $x && $cellX <= $nc} {incr cellX} { + set w [ expr ($w + $tabColWidths($tab,$cellX) + 3) ] + } + if {$x > $w} { + return -1 + } else { + return [ min [incr cellX -1] $tabNcols(${tab},data) ] + } +} + +# TABLEPOS2CELLY -- Convert a widget position to a cell row number. + +proc tablePos2CellY { tab y } { + global tabRowHeights tabNrows + + set nr [ tableGetNrows $tab ] + set cellY 1 + for {set h 0} {$h < $y && $cellY <= $nr} {incr cellY} { + set h [ expr ($h + $tabRowHeights($tab,$cellY)) + 2 ] + } + if {$y > $h} { + return -1 + } else { + return [ min [incr cellY -1] $tabNrows(${tab},data) ] + } +} + + +# TABLESETDEFAULTROWLABELS -- Utility to set the default row labels. + +proc tableSetDefaultRowLabels { tab args } { + global tabNrows tabOption + + # Set the default Row labels, i.e numbers + set rowlabs {} + for {set i 1} {$i <= $tabNrows(${tab},data)} {incr i} { + if {[ tableOption $tab DefLabels ] == "yes"} { + lappend rowlabs $i + } else { + lappend rowlabs {} + } + } + if {[ tableOption $tab RowLabels ] == "yes"} { + send ${tab}RowTab setTable $tabNrows(${tab},data) \ + $tabOption(${tab},RowLabelCols) $rowlabs + set cw [send ${tab}RowTab get defaultWidth] + send ${tab}RowTabView set width \ + [expr ($tabOption(${tab},RowLabelCols) * $cw)] + } else { + send ${tab}RowTab set width 0 + } +} + + +# TABLESETDEFAULTCOLLABELS -- Utility to set the default columns labels. + +proc tableSetDefaultColLabels { tab args } { + global tabNcols tabOption + + # Now set the default Column Labels, i.e. letters + set collabs "" + set j 65 + for {set i 1} {$i <= $tabNcols(${tab},data)} {incr i} { + if {[ tableOption $tab DefLabels ] == "yes"} { + if {$j > 90} { + set j 97 + set collabs [ format "%s { %c } " $collabs $j ] + } elseif {$j > 122} { + set j 1 + set collabs [ format "%s { %d } " $collabs $j ] + } else { + set collabs [ format "%s { %c } " $collabs $j ] + } + incr j + } else { + lappend collabs {} + } + } + if {[ tableOption $tab ColLabels ] == "yes"} { + send ${tab}ColTab setTable $tabOption(${tab},ColLabelRows) \ + $tabNcols(${tab},data) [ list $collabs ] + send ${tab}ColTabView set height \ + [expr ($tabOption(${tab},ColLabelRows) * 21)] + send ${tab}Spacer1 set height \ + [expr ($tabOption(${tab},ColLabelRows) * 24)] + send ${tab}Spacer2 set height \ + [expr ($tabOption(${tab},ColLabelRows) * 24)] + } else { + send ${tab}ColTab set height 0 + } +} + + +################################################################################ + + +################################################################################ + + + +activate + + +appExtend { + *tclObjects:\ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry + + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*shrinkToFit: True + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { 5 tclClear 3 tclExecute 10 < +inf -10> tclDismiss 5 } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss + +} ; createObjects tclObjects + + + +################################################ +# Define some TCL debug procedures. +################################################ + +proc tclCommandClear {widget args} { + send tclEntry set string "" +} ; send tclClear addCallback tclCommandClear + +proc tclCommandExecute {widget args} { + send server [send tclEntry {get string}] +} ; send tclExecute addCallback tclCommandExecute + +proc tclCommand {widget mode command args} { + send server $command +} ; send tclEntry addCallback tclCommand + +proc tclClose {widget args} { + send tcl_panel unmap +} ; send tclDismiss addCallback tclClose + +send tclShell addCallback "send tcl_panel map" + diff --git a/vendor/x11iraf/guidemo/table.gui.bak b/vendor/x11iraf/guidemo/table.gui.bak new file mode 100644 index 00000000..825582d5 --- /dev/null +++ b/vendor/x11iraf/guidemo/table.gui.bak @@ -0,0 +1,1682 @@ +# TABDEMO.GUI -- Test the Table widget. + +reset-server +appInitialize tabdemo Tabdemo { + + *demoObjects:\ + toplevel Layout panel \ + panel Frame panelMenuFrame \ + panelMenuFrame Layout panelMenuBar \ + panelMenuBar Command newCol \ + panelMenuBar Command newRow \ + panelMenuBar Command newTable \ + panelMenuBar Command tclShell \ + panelMenuBar Command quitButton + + + Tabdemo*background: grey + *Tabdemo.geometry: +0+0 + + *Group.shrinkToFit: True + *Command.height: 28 + *Command.shadowWidth: 1 + *Frame.frameWidth: 1 + *Frame.innerOffset: 4 + *Frame.highlightThickness: 0 + *borderWidth: 0 + *Scrollbar2.location: 0 0 17 17 + *Scrollbar.beNiceToColormap: False + + *panel.width: 600 + *panel.height: 350 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 5 < +inf > horizontal { 5 < +inf > }\ + } + + *panelMenuBar.layout: horizontal { \ + 2 newRow 1 newCol 1 newTable 1 tclShell 2 < +inf > quitButton 2 \ + } + *newCol.label: New Col + *newRow.label: New Row + *newTable.label: New Table + *tclShell.label: TclShell + *quitButton.label: Quit + +} ; createObjects demoObjects + +send quitButton addCallback "send client gkey q ; deactivate unmap" + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Create the Table objects in the OBM. + +set tabnumber 0 ;# initialize table counter + +proc doTable args { + global tabnumber + + set tab [ format "tab%d" $tabnumber ] + set objs [ tableBuildObjects panel $tab ] + +# tableSetOption $tab DefLabels no +# tableSetOption $tab RowLabels no +# tableSetOption $tab ColLabels no +# tableSetOption $tab Tracking no +# tableSetOption $tab RowScroll no +# tableSetOption $tab ColScroll no +# tableSetOption $tab DefaultTranslations no + tableSetOption $tab RowMultiSelect no + tableSetOption $tab ColMultiSelect no +# tableSetOption $tab RowLabelCols 2 +# tableSetOption $tab ColLabelRows 2 + tableSetOption $tab Background bisque3 + + # Now create the new objects. + appExtend $objs + createObjects ${tab}Objects + + # Now construct a layout for the new object. + set new "" + set panStart "vertical \{ panelMenuFrame < +inf -inf * > 5 < -5 >" + for {set i 0} {$i <= $tabnumber} {incr i} { + + # Send the existing table a small height so they'll ajust to + # fit the new table. + if {$i < $tabnumber} { send tab${i}TableFrame set height 10 } + + # Append a layout spec for the table. + set new \ + [format "%s tab%dTableFrame < +inf -inf * +inf -inf > 5 < -5 >" \ + $new $i] + } + set panEnd "\}" + set panelLayout [format "%s %s %s" $panStart $new $panEnd] + + # Send the panel the new layout incorporating the newly created Table. + send panel set layout $panelLayout + + # Now create the table itself, it should appear as if by magic. + tableCreate $tab 12 30 { } + + # Apply some default test callbacks for selection/edit events. + tableAddSelectCallback $tab Row demoSelCB + tableAddSelectCallback $tab Col demoSelCB + tableAddSelectCallback $tab Cell demoSelCB + tableAddUnSelectCallback $tab Row demoUnSelCB + tableAddUnSelectCallback $tab Col demoUnSelCB + tableAddUnSelectCallback $tab Cell demoUnSelCB + tableAddEditCallback $tab demoEditCB + + # Increment the global table counter. + incr tabnumber + +} ; send newTable addCallback doTable + +proc demoSelCB { name row col x y args } { + print "demoSelCB: name=$name r=$row c=$col x=$x y=$y args='$args'" +} + +proc demoUnSelCB { name row col x y args } { + print "demoUnSelCB: name=$name r=$row c=$col x=$x y=$y args='$args'" +} + +proc demoEditCB { name row col str args } { + print "demoEditCB: name=$name row=$row col=$col str='$str' args='$args'" +} + + +################################################################################ + + +################################################################################ +# +# TABLE WIDGET PROCEDURES -- This interface provides simple access to a +# named instance of a Table "meta-widget". The "widget" is actually a +# number of widgets (Table, Scrollbars, etc) in a common layout to provide +# row/col headings, scrollable data tables, and callbacks for [gs]etting +# attributes. The meta-widget is created on-the-fly with a given named +# and parent object, it is the callers responsibility to adjust the layout +# of the parent to incorporate the new objects. +# +# The Table widget itself has various quirks and non-standard implem- +# entations so features such as editing cells or access to certain callbacks +# are not fully implemented in the OBM and hidden here. Most of what's +# needed can be handled by these procedures, however these routines may be +# used to manage multiple named tables in a GUI. +# +# +# tableBuildObjects parent tab +# tableSetOption tab option value +# tableAddSelectCallback tab type cbname +# tableAddEditCallback tab cbname +# tableDestroyObjects tab +# +# tableCreate tab nrows ncols data +# tableSetData tab data +# tableSetColumnLabels tab labels +# tableSetRowLabels tab labels +# +# list = tableGetSelected tab type +# +# tableSetRowLabelsAttr tab attr value +# value = tableGetRowLabelsAttr tab attr +# tableSetColLabelsAttr tab attr value +# value = tableGetColLabelsAttr tab attr +# tableSetRowLabelAttr tab row attr value +# value = tableGetRowLabelAttr tab row attr +# tableSetColLabelAttr tab col attr value +# value = tableGetColLabelAttr tab col attr +# +# attr = tableGetCelllAttr tab row col attr +# tableSetCelllAttr tab row col attr value +# value = tableGetRowAttr tab row attr +# tableSetRowAttr tab row attr value +# value = tableGetColAttr tab col attr +# tableSetColAttr tab col attr value +# +# tableDeleteCol tab col +# tableDeleteRow tab row +# tableAddCol tab col width [where] +# tableAddRow tab row [where] +# +# nrows = tableGetNrows tab +# ncols = tableGetNcols tab +# height = tableGetHeight tab +# width = tableGetWidth tab +# +# See obm$widget.c for a complete list of the OBM commands available +# for this widget, and procedure header comments for details about the +# interface here. +# +################################################################################ + +set tabNrows(nmname 0 +set tabNcols(name) 0 +set tabData(name) 0 +set tabColLabs(name) 0 +set tabRowHeights(name,j) 0 +set tabColWidths(name,i) 0 + +set tabHeight(name) 0 +set tabWidth(name) 0 +set tabScrollSize(name,type) 0 +set tabScrollPos(name,type) 0 + +# Meta-widget options, should be set before the tableCreate call. +set tabOption(name,RowLabels) yes +set tabOption(name,ColLabels) yes +set tabOption(name,DefLabels) yes +set tabOption(name,Tracking) yes +set tabOption(name,RowScroll) yes +set tabOption(name,ColScroll) yes +set tabOption(name,Editable) yes +set tabOption(name,RowSelect) yes +set tabOption(name,ColSelect) no +set tabOption(name,CellSelect) no +set tabOption(name,DefaultTranslations) yes +set tabOption(name,Background) grey +set tabOption(name,Foreground) black +set tabOption(name,HighlightColor) grey90 +set tabOption(name,RowLabelCols) 1 +set tabOption(name,ColLabelRows) 1 + +# Selection lists. +set tabSelected(name,Row) {} +set tabSelected(name,Col) {} +set tabSelected(name,Cell) {} +set tabSelectionCB(name,Row) {} +set tabSelectionCB(name,Col) {} +set tabSelectionCB(name,Cell) {} +set tabUnSelectionCB(name,Row) {} +set tabUnSelectionCB(name,Col) {} +set tabUnSelectionCB(name,Cell) {} +set tabEditCB(name) {} + + +# TABLEBUILDOBJECTS -- Utility routine to build the object list for the meta- +# widget. +# +# Usage: +# tableBuildObjects <parent> <tab> + +proc tableBuildObjects { parent tab } { + + set objDef { + *TABObjects: \ + PARENT Frame TABTableFrame \ + TABTableFrame Layout TABFrameLayout \ + TABFrameLayout Layout TABTableLayout \ + TABTableLayout Viewport TABTabView \ + TABTabView Table TABTab \ + TABTableLayout Label TABSpacer \ + TABTableLayout Viewport TABRowTabView \ + TABRowTabView Table TABRowTab \ + TABTableLayout Viewport TABColTabView \ + TABColTabView Table TABColTab \ + TABFrameLayout Label TABLabel \ + TABFrameLayout Scrollbar TABColScroll \ + TABFrameLayout Scrollbar TABRowScroll \ +\ + toplevel TopLevelShell TABEditShell \ + TABEditShell Layout TABEditLayout \ + TABEditLayout Frame TABEditMenuFrame\ + TABEditMenuFrame Layout TABEditMenuBar \ + TABEditMenuBar Command TABEditApply \ + TABEditMenuBar Command TABEditClear \ + TABEditMenuBar Command TABEditCancel \ + TABEditLayout Frame TABEditFrame \ + TABEditFrame AsciiText TABEditText \ + + + + + ! Global Table widget resources. + *Table.literalWidth: 20 + *Table.rowHeight: 20 + *Table.shadowWidth: 1 + *Table.labelShadowWidth: 1 + *Table.tableMargin: 0 + *Table.columnMargin: 0 + *Table.rowMargin: 0 + *Table.internalHeight: 1 + *Table.internalWidth: 1 + + *TABTableFrame*Group.shrinkToFit: True + *TABTableFrame*Command.height: 28 + *TABTableFrame*Command.shadowWidth: 1 + *TABTableFrame*Frame.frameWidth: 1 + *TABTableFrame*Frame.innerOffset: 4 + *TABTableFrame*Frame.highlightThickness: 0 + *TABTableFrame*Frame.borderWidth: 0 + *TABTableFrame*Frame.shrinkToFit: True + *TABTableFrame*Table.borderWidth: 1 + *TABTableFrame*Scrollbar.beNiceToColormap: False + + *TABTableFrame.height: 10 + *TABTableFrame.width: 10 + *TABTableFrame*Layout.height: 10 + *TABTableFrame*Layout.width: 10 + *TABTableFrame*Label.height: 15 + *TABTableFrame*Label.label: + + *TABFrameLayout.TABTableLayout.height: 10 + *TABFrameLayout.TABTableLayout.width: 10 + *TABFrameLayout.TABTableLayout*Layout.height: 10 + *TABFrameLayout.TABTableLayout*Layout.width: 10 + *TABFrameLayout.TABTableLayout*Viewport.height: 20 + *TABFrameLayout.TABTableLayout*Viewport.width: 20 + *TABFrameLayout.TABTableLayout*Table.height: 20 + *TABFrameLayout.TABTableLayout*Table.width: 20 + + + ! The following resources enable the scrollbars on the Viewport + ! widget but effectively hide them from display. This allows us + ! to control the viewport manually from the Table code, e.g. to + ! scroll both the column headings and data table. + *TABFrameLayout.TABTableLayout*Viewport.allowVert: True + *TABFrameLayout.TABTableLayout*Viewport.allowHoriz: True + *TABFrameLayout.TABTableLayout*Viewport.forceBars: True + *TABFrameLayout.TABTableLayout*Viewport.useBottom: True + *TABFrameLayout.TABTableLayout*Viewport.useRight: True + *TABFrameLayout.TABTableLayout*Viewport.borderWidth: 1 + + *TABTableLayout*TABRowTabView*vertical.thickness: 1 + *TABTableLayout*TABRowTabView*horizontal.thickness: 1 + *TABTableLayout*TABColTabView*vertical.thickness: 1 + *TABTableLayout*TABColTabView*horizontal.thickness: 1 + *TABTableLayout*TABTabView*vertical.thickness: 1 + *TABTableLayout*TABTabView*horizontal.thickness: 1 + + *TABTableFrame.TABFrameLayout.TABRowScroll.thickness: 15 + *TABTableFrame.TABFrameLayout.TABRowScroll.width: 15 + *TABTableFrame.TABFrameLayout.TABRowScroll.height: 15 + *TABTableFrame.TABFrameLayout.TABRowScroll.orientation: Vertical + + *TABTableFrame.TABFrameLayout.TABColScroll.thickness: 15 + *TABTableFrame.TABFrameLayout.TABColScroll.width: 15 + *TABTableFrame.TABFrameLayout.TABColScroll.height: 15 + *TABTableFrame.TABFrameLayout.TABColScroll.orientation: Horizontal + + *TABFrameLayout.layout: horizontal { \ + vertical { \ + 2 < -2 > \ + TABTableLayout < +inf -inf * +inf -inf > \ + 2 < -2 > \ + horizontal { \ + TABLabel 1 < -1 > TABColScroll < +inf -inf * > \ + } \ + } \ + vertical { \ + 27 < -27 > TABRowScroll < * +inf -inf > 20 < -20 > \ + } \ + } + *TABTableFrame.TABFrameLayout.TABLabel.label: ( 0, 0) + *TABTableFrame.TABFrameLayout.TABLabel.width: 80 + + *TABTableLayout.layout: horizontal { \ + vertical { \ + TABSpacer 1 < -1 > TABRowTabView < * +inf -inf > \ + } \ + 3 < -3 > \ + vertical { \ + TABColTabView < +inf -inf * > \ + 3 < -3 > \ + TABTabView < +inf -inf * +inf -inf > \ + } \ + 3 < -3 > \ + } + *TABSpacer.height: 24 + + !---------------------------+ + ! Set the editor resources. | + !---------------------------+ + *TABEditShell.title: Table Value Editor + *TABEditShell.width: 275 + *TABEditShell.height: 80 + *TABEditLayout*borderWidth: 0 + *TABEditLayout.layout: vertical { \ + TABEditFrame < +inf -inf * +inf -inf > \ + -2 \ + TABEditMenuFrame < +inf -inf * > \ + -2 \ + } + + *TABEditMenuBar.layout: horizontal { \ + TABEditApply 5 \ + 10 < +inf -inf > \ + TABEditClear 5 \ + 10 < +inf -inf > \ + TABEditCancel 5 \ + } + *TABEditMenuFrame.height: 80 + *TABEditMenuFrame.outerOffset: 0 + *TABEditMenuFrame.innerOffset: 5 + *TABEditMenuFrame.frameType: chiseled + *TABEditMenuFrame.frameWidth: 2 + *TABEditFrame.frameType: sunken + *TABEditFrame.frameWidth: 2 + *TABEditFrame.outerOffset: 5 + *TABEditText*scrollVertical: never + *TABEditText*scrollHorizontal: whenNeeded + *TABEditText*font: 7x13 + *TABEditText*editType: edit + *TABEditApply.label: Apply + *TABEditApply.width: 150 + *TABEditClear.label: Clear + *TABEditClear.width: 150 + *TABEditCancel.label: Cancel + *TABEditCancel.width: 150 + + } + + regsub -all TAB $objDef $tab tmp1 + regsub -all PARENT $tmp1 $parent objs + set objs [format "{ %s }" $objs] + + return $objs +} + + +# TABLEDESTROYOBJECTS -- Destroy the specified table and all it's objects. +# +# Usage: +# tableDestroyObjects <tab> + +proc tableDestroyObjects { tab } { + destroyObject ${tab}TableFrame +} + + +# TABESETOPTION -- Set an option for the Table meta-widget. +# +# Usage: +# tableSetOption <tab> <option> [yes|no] +# +# where <tab> is the table name given when the meta-widget was created, and +# <option> is one of: +# +# +# Option Name Type Default Description +# ----------- ---- ------- ----------- +# RowLabels bool yes display a row label table +# ColLabels bool yes display a column label table +# DefLabels bool yes do default labels of rows/cols +# Tracking bool yes do coord tracking in data table +# RowScroll bool yes display row scrollbar +# ColScroll bool yes display column scrollbar +# Editable bool yes table is editable +# RowSelect bool yes rows are selectable +# ColSelect bool yes cols are selectable +# CellSelect bool yes cells are selectable +# RowMultiSelect bool yes multiple rows may be selected +# ColMultiSelect bool yes multiple cols may be selected +# CellMultiSelect bool yes multiple cells may be selected +# DefaultTranslations bool yes use default table translations +# Foreground color black meta-widget foreground color +# Background color grey meta-widget background color +# HighlightColor color grey90 selected item highlight color +# RowLabelCols int 1 number of columns in row labels +# ColLabelRows int 1 number of rows in column labels +# + +proc tableSetOption { tab option value } { + global tabOption + set tabOption(${tab},${option}) $value +} + + +# TABLEADDSELECTCALLBACK -- Add a user-defined callback to be executed +# when there is a row, column, or cell selection event occurs. +# +# Usage: +# tableAddSelectCallback <tab> <type> <cbname> +# +# where <type> is "Row", "Col", or "Cell" and <cbname> specifies a procedure +# to be called whenever the specified <type> is selected. Procedures are +# called as +# <cbname> name row col x y +# +# where 'name' is the table name, 'row' and 'col' are the coordinates of the +# selection and 'x' and 'y' are the raw event coordinates. Registered proc- +# edures are required to declare all these arguments but do not need to use +# them. + +proc tableAddSelectCallback { tab type cbname } { + global tabSelectionCB + lappend tabSelectionCB(${tab},${type}) $cbname +} + + +# TABLEADDUNSELECTCALLBACK -- Add a user-defined callback to be executed +# when there is a row, column, or cell un-selection event occurs. +# +# Usage: +# tableAddUnSelectCallback <tab> <type> <cbname> +# +# where <type> is "Row", "Col", or "Cell" and <cbname> specifies a procedure +# to be called whenever the specified <type> is selected. Procedures are +# called as +# <cbname> name row col x y state +# +# where 'name' is the table name, 'row' and 'col' are the coordinates of the +# selection and 'x' and 'y' are the raw event coordinates. Registered proc- +# edures are required to declare all these arguments but do not need to use +# them. + +proc tableAddUnSelectCallback { tab type cbname } { + global tabUnSelectionCB + lappend tabUnSelectionCB(${tab},${type}) $cbname +} + + + +# TABLEADDEDITCALLBACK -- Add a user-defined callback to be executed +# when there is an edit event. +# +# Usage: +# tableAddEditCallback <tab> <cbname> +# +# <cbname> specifies a procedure to be called whenever the table editor +# Apply button has been pressed. Procedures are called as +# +# <cbname> name row col new_string +# +# where 'name' is the table name, 'row' and 'col' are the coordinates of the +# edited cell and 'new_string' is the new value inserted in the table. Reg- +# istered procedures are required to declare all these arguments but do not +# need to use them. + +proc tableAddEditCallback { tab cbname } { + global tabEditCB + lappend tabEditCB(${tab}) $cbname +} + + +# TABLECREATE -- Create a named instance of the Table meta-widget. The +# individual objects in the meta-widget are created dynamically and the +# entire thing is created as a child of the named parent object. The +# standard callbacks are assigned and the table is initialized, however +# it is the callers responsibility to adjust the parent's layout to make +# the meta-widget visible and assign any constraint callbacks. +# +# Usage: +# tableCreate <tab> <nrows> <ncols> <data> +# +# The <data> is specified as a Tcl list of the form: +# +# { {r1c1 r1c2 ... r1cN} +# {r2c1 r2c2 ... r2cN} +# : +# {rNc1 rNc2 ... rNcN} } +# +# String values must be quoted, rows/cols will be truncated or cleared if +# the specified table size does not agree with the size of the data table +# being loaded. + +set tabBGWidgets { \ + TABTab TABRowTab TABColTab TABLabel TABColScroll \ + TABRowScroll TABEditApply TABEditClear TABEditCancel \ + TABEditApply TABEditClear TABEditCancel TABEditText \ + TABEditFrame TABEditMenuBar TABEditMenuFrame \ +} +set tabFGWidgets { \ + TABTab TABRowTab TABColTab TABLabel TABColScroll \ + TABRowScroll TABEditApply TABEditClear TABEditCancel \ + TABEditApply TABEditClear TABEditCancel TABEditText \ +} + +proc tableCreate { tab nrows ncols data } { + global tabNrows tabNcols tabRowHeights tabColWidths + global tabHeight tabWidth tabDebug tabOption + global tabEditCB tabSelectionCB tabUnSelectionCB + global tabSelected tabBGWidgets tabFGWidgets + + set err "" + catch { + if { ![info exists tabOption(${tab},RowLabelCols)] } { + set tabOption(${tab},RowLabelCols) $tabOption(name,RowLabelCols) + } + } err + if {$err != ""} { + set tabOption(${tab},RowLabelCols) $tabOption(name,RowLabelCols) + } + set err "" + catch { + if { ![info exists tabOption(${tab},ColLabelRows)] } { + set tabOption(${tab},ColLabelRows) $tabOption(name,ColLabelRows) + } + } err + if {$err != ""} { + set tabOption(${tab},ColLabelRows) $tabOption(name,ColLabelRows) + } + + + set tabNrows(${tab}.data) $nrows + set tabNcols(${tab}.data) $ncols + set tabNrows(${tab}.rows) $nrows + set tabNcols(${tab}.rows) $tabOption(${tab},RowLabelCols) + set tabNrows(${tab}.cols) $tabOption(${tab},ColLabelRows) + set tabNcols(${tab}.cols) $ncols + set tabData($tab) $data + + # Initialize with a default row height. + set rh [send ${tab}Tab get rowHeight] + for {set i 1} {$i <= $nrows} {incr i} { set tabRowHeights($tab,$i) $rh } + + # Initialize with a default column width. + set cw [send ${tab}Tab get defaultWidth] + for {set i 1} {$i <= $ncols} {incr i} { set tabColWidths($tab,$i) $cw } + + # Initialize the table. + send ${tab}Tab setTable $nrows $ncols $data + + # Initialize the labels. + tableSetDefaultLabels $tab + + # Save the table dimesnions. + set tabHeight($tab) [ tableGetHeight $tab ] + set tabWidth($tab) [ tableGetWidth $tab ] + + # Set the default table translations. + tableSetDefaultTranslations $tab + + # Set Default Scrollbars for the table. + tableSetDefaultScrollbars $tab + + # Attach the default-callbacks to the new Table. + tableAddCallbacks $tab + + # Default the colors. + set err "" + catch { + if { ![info exists tabOption(${tab},HighlightColor)] != 0 } { + set tabOption(${tab},HighlightColor) $tabOption(name,HighlightColor) + } + } err + if {$err != ""} { + set tabOption(${tab},HighlightColor) $tabOption(name,HighlightColor) + } + set err "" + catch { + if { ![info exists tabOption(${tab},Background)] != 0 } { + set tabOption(${tab},Background) $tabOption(name,Background) + } + } err + if {$err != ""} { + set tabOption(${tab},Background) $tabOption(name,Background) + } + set err "" + catch { + if { ![info exists tabOption(${tab},Foreground)] != 0 } { + set tabOption(${tab},Foreground) $tabOption(name,Foreground) + } + } err + if {$err != ""} { + set tabOption(${tab},Foreground) $tabOption(name,Foreground) + } + + regsub -all TAB $tabBGWidgets $tab bgwidgets + foreach w $bgwidgets { + send $w set background $tabOption(${tab},Background) + } + regsub -all TAB $tabFGWidgets $tab fgwidgets + foreach w $fgwidgets { + send $w set foreground $tabOption(${tab},Foreground) + } + + # Default selections. + set tabSelected(${tab},Row) {} + set tabSelected(${tab},Col) {} + set tabSelected(${tab},Cell) {} + + set tabSelectionCB(${tab},Row) {} + set tabSelectionCB(${tab},Col) {} + set tabSelectionCB(${tab},Cell) {} + set tabUnSelectionCB(${tab},Row) {} + set tabUnSelectionCB(${tab},Col) {} + set tabUnSelectionCB(${tab},Cell) {} + set tabEditCB(${tab}) {} +} + + +# TABLESETDATA -- Set the data elements of a table meta-widget. +# +# Usage: +# tableSetData <tab> <data> +# +# where <tab> is the table name given when the meta-widget was created, and +# <data> is of the form: +# +# { {r1c1 r1c2 ... r1cN} +# {r2c1 r2c2 ... r2cN} +# : +# {rNc1 rNc2 ... rNcN} } + +proc tableSetData { tab data } { + global tabNrows tabNcols + send ${tab}Tab setTable $tabNrows(${tab}.data) $tabNcols(${tab}.data) $data +} + + +# TABLESETCOLUMNLABELS -- Set the column header labels for a table. +# meta-widget. +# +# Usage: +# tableSetColumnLabels <tab> <column_labs> +# +# where <tab> is the table name given when the meta-widget was created, and +# <data> is of the form: +# +# { { r1c1 } { r1c2 } ... { r1cN } } + +proc tableSetColumnLabels { tab col_labs } { + global tabNrows tabNcols + send ${tab}ColTab \ + setTable $tabNrows(${tab}.cols) $tabNcols(${tab}.cols) $col_labs +} + + +# TABLESETROWLABELS -- Set the row header labels for a table. +# meta-widget. +# +# Usage: +# tableSetColumnLabels <tab> <row_labs> +# +# where <tab> is the table name given when the meta-widget was created, and +# <data> is of the form: +# +# { {r1c1 r1c2 ... r1cN} } + +proc tableSetRowLabels { tab row_labs } { + global tabNrows tabNcols + send ${tab}RowTab \ + setTable $tabNrows(${tab}.rows) $tabNcols(${tab}.rows) $row_labs +} + + +# TABLESETCOLLABELSATTR -- Set the column header labels for a table +# meta-widget. +# +# Usage: +# tableSetColumnLabels <tab> <attr> <value> [<row>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableSetColLabelsAttr { tab attr value args } { + if {$args != ""} { + send ${tab}ColTab setRowAttr $args $attr $value + } else { + send ${tab}ColTab setRowAttr 1 $attr $value + } +} + + +# TABLESETROWLABELSATTR -- Set the row header labels for a table meta-widget. +# +# Usage: +# tableSetRowLabelsAttr <tab> <attr> <value> [<col>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableSetRowLabelsAttr { tab attr value args } { + if {$args != ""} { + send ${tab}RowTab setColAttr $args $attr $value + } else { + send ${tab}RowTab setColAttr 1 $attr $value + } +} + + +# TABLEGETROWLABELSATTR -- Get the row header labels for a table meta-widget. +# +# Usage: +# value = tableGetRowLabelsAttr <tab> <attr> [<col>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableGetRowLabelsAttr { tab attr args } { + if {$args != ""} { + return [ send ${tab}RowTab getColAttr $args $attr ] + } else { + return [ send ${tab}RowTab getColAttr 1 $attr ] + } +} + + +# TABLEGETCOLLABELSATTR -- Get the column header labels for a table. +# meta-widget. +# +# Usage: +# value = tableGetColLabelsAttr <tab> <attr> [<row>] +# +# where <attr> is one of +# +# background background color +# foreground foreground color +# width column width +# justify label justification + +proc tableGetColLabelsAttr { tab attr args } { + if {$args != ""} { + return [ send ${tab}ColTab getRowAttr $args $attr ] + } else { + return [ send ${tab}ColTab getRowAttr 1 $attr ] + } +} + + +# TABLESETROWLABELATTR -- Set the specified attribute for the row label table. +# +# Usage: +# tableSetRowLabelAttr <tab> <row> <attr> <value> [<row>] +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableSetRowLabelAttr { tab row attr value args } { + if {$args != ""} { + send ${tab}RowTab setCellAttr $row $args $attr $value + } else { + send ${tab}RowTab setCellAttr $row 1 $attr $value + } +} + + +# TABLESETCOLLABELATTR -- Get the specified attribute for the col label table. +# +# Usage: +# value = tableSetColLabelAttr <tab> <col> <attr> <value> [<row>] +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableSetColLabelAttr { tab col attr value args } { + if {$args != ""} { + send ${tab}ColTab setCellAttr $args $col $attr $value + } else { + send ${tab}ColTab setCellAttr 1 $col $attr $value + } +} + + +# TABLEGETCELLATTR -- Get the specified attribute for the cell. +# +# Usage: +# value = tableGetCellAttr <tab> <row> <col> <attr> +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableGetCellAttr { tab row col attr } { + return [ send ${tab}Tab getCellAttr $row $col $attr ] +} + + +# TABLESETCELLATTR -- Set the specified attribute for the cell. +# +# Usage: +# tableSetCellAttr <tab> <row> <col> <attr> <value> +# +# The cell position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a cell include: +# +# label label text (string) +# background background color (string) +# foreground foreground color (string) + +proc tableSetCellAttr { tab row col attr value } { + send ${tab}Tab setCellAttr $row $col $attr $value +} + + +# TABLEGETROWATTR -- Get the specified attribute for the row. +# +# Usage: +# value = tableGetCellAttr <tab> <row> <attr> +# +# The row position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a row include: +# +# background background color +# foreground foreground color + +proc tableGetRowAttr { tab row attr } { + return [ send ${tab}Tab getRowAttr $row $attr ] +} + + +# TABLESETROWATTR -- Set the specified attribute for the row. +# +# Usage: +# tableSetRowAttr <tab> <row> <attr> <value> +# +# The row position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a row include: +# +# background background color +# foreground foreground color + +proc tableSetRowAttr { tab row attr value } { + send ${tab}Tab setRowAttr $row $attr $value +} + + +# TABLEGETCOLATTR -- Get the specified attribute for the column. +# +# Usage: +# value = tableGetColAttr <tab> <col> <attr> +# +# The column position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a column include: +# +# width column width (pixels) +# background background color (string) +# foreground foreground color (string) +# justify text justification (string) + +proc tableGetColAttr { tab col attr } { + return [ send ${tab}Tab getColAttr $col $attr ] +} + + +# TABLESETCOLATTR -- Set the specified attribute for the column. +# +# Usage: +# tableSetColAttr <tab> <col> <attr> <value> +# +# The column position is given as a 1-indexed array element where the UL +# of the table is cell (1,1). Allowed attributes for a column include: +# +# width column width (pixels) +# background background color (string) +# foreground foreground color (string) +# justify text justification (string) + +proc tableSetColAttr { tab col attr value } { + send ${tab}Tab setColAttr $col $attr $value +} + + +# TABLEDELETECOL -- Delete the specified column from the named table. +# +# Usage: +# tableDeleteCol <tab> <col> + +proc tableDeleteCol { tab col } { + global tabColWidths tabNcols + + send ${tab}Tab deleteCol $col + send ${tab}ColTab deleteCol $col + incr tabNcols(${tab}.data) -1 + unset tabColWidths(${tab},$col) +} + + +# TABLEDELETEROW -- Delete the specified row from the named table. +# +# Usage: +# tableDeleteRow <tab> <row> + +proc tableDeleteRow { tab row } { + global tabRowHeights tabNrows + + send ${tab}Tab deleteRow $row + send ${tab}RowTab deleteRow $row + incr tabNrows(${tab}.data) -1 + unset tabRowHeights(${tab},$row) +} + + +# TABLEDADDCOL -- Add a column to the named table at the specified position. +# +# Usage: +# tableAddCol <tab> <col> <width> + +proc tableAddCol { tab col width args} { + global tabColWidths tabNcols + + send ${tab}Tab addCol $col $width $args + send ${tab}ColTab addCol $col $width $args + incr tabNcols(${tab}.data) + + set ncols $tabNcols(${tab}.data) + if {$col == "first"} { + set colnum 1 + } elseif {$col == "last"} { + set colnum $tabNcols(${tab}.data) + } else { + set colnum $col + } + + # Update the column widths. + for {set c $ncols} {$c > $colnum} {incr c -1} { + set tabColWidths(${tab},$c) $tabColWidths(${tab},[expr ($c - 1)]) + } + set tabColWidths(${tab},$colnum) $width +} + + +# TABLEADDROW -- Add a rows to the named table at the specified position. +# +# Usage: +# tableDeleteCol <tab> <row> + +proc tableAddRow { tab row args } { + global tabRowHeights tabNrows + + send ${tab}Tab addRow $row $args + send ${tab}RowTab addRow $row $args + incr tabNrows(${tab}.data) + set tabRowHeights(${tab},$row) $tabRowHeight(${tab},1) +} + + +# TABLEGETNROWS -- Return the number of rows in a named table. +# +# Usage: +# nrows = tableGetNrows <tab> + +proc tableGetNrows { tab } { + global tabNrows + return $tabNrows(${tab}.data) +} + + +# TABLEGETNCOLS -- Return the number of columns in a named table. +# +# Usage: +# ncols = tableGetNcols <tab> + +proc tableGetNcols { tab } { + global tabNcols + return $tabNcols(${tab}.data) +} + + +# TABLEGETHEIGHT -- Compute the height of the table given varying row heights. +# +# Usage: +# height = tableGetHeight <tab> + +proc tableGetHeight { tab } { + return [ send ${tab}Tab get height ] +} + + +# TABLEGETWIDTH -- Compute the width of the table given varying column widths. +# +# Usage: +# width = tableGetWidth <tab> + +proc tableGetWidth { tab } { + return [ send ${tab}Tab get width ] +} + + +# TABLEGETSELECTED -- Return a list of the selected items. +# +# Usage: list = tableGetSelected tab type +# +# where <type> is 'Row', 'Col', or 'Cell'. + +proc tableGetSelectedRows { tab type } { + global tabSelected + return $tablSelected(${tab},${type}) +} + + +# TABLEDIT -- Enable the cell editor + +set tabEditRow 0 +set tabEditCol 0 +set tabEditValue "" + +set tableEditorUp 0 + +proc tableEdit { name x y } { + global tabEditValue tabEditRow tabEditCol tableEditCB, tableEditorUp + + regsub Tab $name "" tab + + set ry [tablePos2CellY $tab $y] + set rx [tablePos2CellX $tab $x] + + if {$rx < 0 || $ry < 0} \ + return + + set newcell 0 + if {$tabEditRow != $rx || $tabEditCol != $ry} { + set newcell 1 + } + + set tabEditCol [tablePos2CellX $tab $x] + set tabEditRow [tablePos2CellY $tab $y] + set tabEditValue [tableGetCellAttr $tab $tabEditRow $tabEditCol label] + + if {$tableEditorUp == 0 || $newcell == 1} { + send ${tab}EditApply addCallback tableEditApply + send ${tab}EditCancel addCallback tableEditCancel + send ${tab}EditClear addCallback tableEditClear + send ${tab}EditText addCallback tableEditLoad + send ${tab}EditText set string $tabEditValue + send ${tab}EditShell move $x [expr ($y + 50)] + send ${tab}EditShell map + set tableEditorUp 1 + } else { + send ${tab}EditApply deleteCallback tableEditApply + send ${tab}EditCancel deleteCallback tableEditCancel + send ${tab}EditClear deleteCallback tableEditClear + send ${tab}EditText deleteCallback tableEditLoad + send ${tab}EditShell unmap + set tableEditorUp 0 + } +} + +proc tableEditApply { button args } { + global tabEditValue tabEditRow tabEditCol tabEditCB tabEditorUp + regsub EditApply $button "" tab + + set str [send ${tab}EditText get string] + + tableSetCellAttr $tab $tabEditRow $tabEditCol label $str + set tabEditValue $str + + # Now do the user-defined selection callbacks. + if { [llength $tabEditCB(${tab})] > 0} { + foreach cb $tabEditCB(${tab}) {$cb $tab $tabEditRow $tabEditCol "$str"} + } + + # Close the window. + send ${tab}EditApply deleteCallback tableEditApply + send ${tab}EditCancel deleteCallback tableEditCancel + send ${tab}EditClear deleteCallback tableEditClear + send ${tab}EditText deleteCallback tableEditLoad + send ${tab}EditShell unmap + set tableEditorUp 0 +} + +proc tableEditLoad { widget mode pattern args } { + regsub EditText $widget "" tab + tableEditApply ${tab}EditApply +} + +proc tableEditClear { button args } { + global tabEditValue + + regsub EditClear $button "" tab + send ${tab}EditText set string "" +} + +proc tableEditCancel { button args } { + global tableEditValue tableEditorUp + + regsub EditCancel $button "" tab + send ${tab}EditShell unmap + send ${tab}EditApply deleteCallback tableEditApply + send ${tab}EditCancel deleteCallback tableEditCancel + send ${tab}EditClear deleteCallback tableEditClear + send ${tab}EditText deleteCallback tableEditLoad + set tableEditorUp 0 +} + + +############################################################################### +# +# Private Procedures +# +############################################################################### + + +# TABLEADDCALLBACKS -- Add the default widget callbacks. + +proc tableAddCallbacks { tab } { + + # Attach the scrollbars actions. + if {[ tableOption $tab RowScroll] == "yes"} { + send ${tab}RowScroll addCallback tableJumpScroll + } else { + send ${tab}RowScroll "set width 0 ; unmap" + } + + if {[ tableOption $tab ColScroll] == "yes"} { + send ${tab}ColScroll addCallback tableJumpScroll + } else { + send ${tab}Label set height 0 + send ${tab}ColScroll "set height 0 ; unmap" + } + + if {[tableOption $tab Tracking] == "no"} { + send ${tab}Label set label "" + send ${tab}Label set width 30 + } + + # Setup a resize handler that will adjust the scrollbars/viewports. + send ${tab}TableFrame addEventHandler tableResizeHandler structureNotifyMask +} + + +# TABLERESIZEHANDLER -- Resize callbacks, called as an eventHandler when +# the parent window or the table meta-widget changes size. All we need to +# do here is reset the scrollbars to reflect the new size. + +proc tableResizeHandler { table args } { + regsub TableFrame $table "" tab + tableSetDefaultScrollbars $tab +} + + +# TABLETRACK -- Track the motion in the table. + +proc tableTrack { name x y } { + regsub Tab $name "" tab + if {[ tableOption $tab Tracking] == "no"} { + return + } + + set nr [tableGetNrows $tab] + set nc [tableGetNcols $tab] + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + if {$col < 0 || $row < 0} { + send ${tab}Label set label " " + } else { + send ${tab}Label set label [ format "(%3d,%3d)" $row $col ] + } +} + + +# TABLESELECT -- Do the default selection callback which applies to rows, +# columns and cells. + +proc tableSelect { name type x y } { + global tabOption tabSelected tabSelectionCB tabUnSelectionCB + + if {$type == "Row"} { + regsub ${type}Tab $name "" tab + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + set val $row + } elseif {$type == "Col"} { + regsub ${type}Tab $name "" tab + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + set val $col + } elseif {$type == "Cell"} { + regsub Tab $name "" tab + set col [tablePos2CellX $tab $x] + set row [tablePos2CellY $tab $y] + set val [list $row $col] + } + + if {$col < 0 || $row < 0} \ + return + + set index [ lsearch $tabSelected(${tab},${type}) $val ] + set color $tabOption(${tab},HighlightColor) + + # If we're doing a radio selection, turn off anything already selected. + + if {[ tableOption $tab ${type}MultiSelect] == "no"} { + if { [llength $tabSelected(${tab},${type})] == 1} { + tableSet${type}Attr ${tab} \ + [lindex $tabSelected(${tab},${type}) 0] \ + background $tabOption(${tab},Background) + tableSet${type}Attr ${tab}${type} \ + [lindex $tabSelected(${tab},${type}) 0] \ + background $tabOption(${tab},Background) + + # Now do the user-defined un-selection callbacks. + if { [llength $tabUnSelectionCB(${tab},${type})] > 0} { + foreach cb $tabUnSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 0 + } + } + + set tabSelected(${tab},${type}) [list $val ] + + if {$type == "Row"} { + foreach c $tabSelected(${tab},Col) { + tableSetColAttr ${tab} $c background $color + } + } elseif {$type == "Col"} { + foreach c $tabSelected(${tab},Row) { + tableSetRowAttr ${tab} $c background $color + } + } + } else { + lappend tabSelected(${tab},${type}) $val + } + } else { + if { $index < 0} { + lappend tabSelected(${tab},${type}) $val + } + } + + # If this has already been selected, toggle it. + if { $index >= 0} { + if {$type != "Cell"} { + tableSet${type}Attr ${tab} \ + [lindex $tabSelected(${tab},${type}) $index] \ + background $tabOption(${tab},Background) + tableSet${type}Attr ${tab}${type} \ + [lindex $tabSelected(${tab},${type}) $index] \ + background $tabOption(${tab},Background) + + # Now do the user-defined un-selection callbacks. + if { [llength $tabUnSelectionCB(${tab},${type})] > 0} { + foreach cb $tabUnSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 0 + } + } + + } else { + tableSet${type}Attr ${tab} \ + $row $col background $tabOption(${tab},Background) + + # Now do the user-defined selection callbacks. + if { [llength $tabUnSelectionCB(${tab},${type})] > 0} { + foreach cb $tabUnSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 0 + } + } + } + + # Delete it from the list + set tabSelected(${tab},${type}) \ + [ lreplace $tabSelected(${tab},${type}) $index $index ] + + # Go back and re-select the row/col intersection but don't + # generate an event for it, purely cosmetic. + if {$type == "Row"} { + foreach c $tabSelected(${tab},Col) { + tableSetColAttr ${tab} $c background $color + } + } elseif {$type == "Col"} { + foreach c $tabSelected(${tab},Row) { + tableSetRowAttr ${tab} $c background $color + } + } + + } else { + + # Highlight the selected item. + if {$type != "Cell"} { + tableSet${type}Attr ${tab} $val background $color + tableSet${type}Attr ${tab}${type} $val background $color + } else { + tableSet${type}Attr ${tab} $row $col background $color + } + + # Now do the user-defined selection callbacks. + if { [llength $tabSelectionCB(${tab},${type})] > 0} { + foreach cb $tabSelectionCB(${tab},${type}) { + $cb $tab $row $col $x $y 1 + } + } + } +} + + +# TABLESETDEFAULTLABELS -- Set the default labels for the table, i.e. letters +# for columns headings and numbers for the row labels. +# +# Usage: +# tableSetDefaultLabels <tab> + +proc tableSetDefaultLabels { tab } { + global tabNrows tabNcols tabOption + + + # Set the default Row labels, i.e numbers + set rowlabs {} + for {set i 1} {$i <= $tabNrows(${tab}.data)} {incr i} { + if {[ tableOption $tab DefLabels ] == "yes"} { + lappend rowlabs $i + } else { + lappend rowlabs {} + } + } + if {[ tableOption $tab RowLabels ] == "yes"} { + send ${tab}RowTab setTable $tabNrows(${tab}.data) \ + $tabOption(${tab},RowLabelCols) $rowlabs + set cw [send ${tab}RowTab get defaultWidth] + send ${tab}RowTabView set width \ + [expr ($tabOption(${tab},RowLabelCols) * $cw)] + } else { + send ${tab}RowTab set width 0 + } + + # Now set the default Column Labels, i.e. letters + set collabs "" + set j 65 + for {set i 1} {$i <= $tabNcols(${tab}.data)} {incr i} { + if {[ tableOption $tab DefLabels ] == "yes"} { + if {$j > 90} { + set j 97 + set collabs [ format "%s { %c } " $collabs $j ] + } elseif {$j > 122} { + set j 1 + set collabs [ format "%s { %d } " $collabs $j ] + } else { + set collabs [ format "%s { %c } " $collabs $j ] + } + incr j + } else { + lappend rowlabs {} + } + } + if {[ tableOption $tab ColLabels ] == "yes"} { + send ${tab}ColTab setTable $tabOption(${tab},ColLabelRows) \ + $tabNcols(${tab}.data) [ list $collabs ] + send ${tab}ColTabView set height \ + [expr ($tabOption(${tab},ColLabelRows) * 22)] + send ${tab}Spacer set height \ + [expr ($tabOption(${tab},ColLabelRows) * 24)] + } else { + send ${tab}ColTab set height 0 + } +} + + +# TABLESETDEFAULTTRANSLATIONS -- Set the default translations for the widget. + +proc tableSetDefaultTranslations { tab } { + + if {[ tableOption $tab DefaultTranslations ] == "no"} { + return + } + + # Set the coord tracking translations. + set trans1 "" + if {[ tableOption $tab Tracking ] == "yes"} { + set trans1 { \ + <Motion>:call(tableTrack,$name,$x,$y) + } + } + + set trans2 "" + if {[ tableOption $tab CellSelect ] == "yes"} { + set trans2 { \ + <Btn1Down>:call(tableSelect,$name,Cell,$x,$y) + } + } + + set trans3 "" + if {[ tableOption $tab Editable ] == "yes"} { + set trans3 { \ + <Btn3Down>:call(tableEdit,$name,$x,$y) + } + } + set trans "$trans1 $trans2 $trans3" + send ${tab}Tab set translations $trans + + + # Set the row-selectable translations. + if {[ tableOption $tab RowSelect ] == "yes"} { + send ${tab}RowTab set translations \ + "<Btn1Down>: call(tableSelect,\$name,Row,\$x,\$y)" + } + + # Set the col-selectable translations. + if {[ tableOption $tab ColSelect ] == "yes"} { + send ${tab}ColTab set translations \ + "<Btn1Down>: call(tableSelect,\$name,Col,\$x,\$y)" + } +} + + +# TABLESETDEFAULTSCROLLBARS -- Set the default scrollbar position and size +# in the meta-widget. + +proc tableSetDefaultScrollbars { tab } { + global tabHeight tabWidth tabScrollSize tabScrollPos tabDebug + + set visW [ send ${tab}TabView get width] + set visH [ send ${tab}TabView get height] + set th $tabHeight($tab) + set tw $tabWidth($tab) + + set rowS [max 0.0 [min 1.0 [expr (double($visH)/double($tabHeight($tab)))]]] + set colS [max 0.0 [min 1.0 [expr (double($visW)/double($tabWidth($tab))) ]]] + + set tabScrollSize($tab,row) $rowS + set tabScrollSize($tab,col) $colS + set tabScrollPos($tab,row) 0.0 + set tabScrollPos($tab,col) 0.0 + + send ${tab}RowScroll setScrollbar 0.0 $tabScrollSize($tab,row) + send ${tab}ColScroll setScrollbar 0.0 $tabScrollSize($tab,col) +} + + +# TABLEJUMPSCROLL -- Scroll the specified table. This scrolls both the +# data and row/column label tables. + +proc tableJumpScroll { widget cbtype pos } { + global scrollHeight tabWidth tabHeight tabDebug + global tabScrollSize tabScrollPos tabDebug + + if {$pos < 0.01} { set pos 0.0 } + + if { [string match *ColScroll $widget] } { + regsub ColScroll $widget "" tab + set y $tabScrollPos($tab,row) + send ${tab}TabView setLocation $pos $y + send ${tab}ColTabView setLocation $pos 0.0 + + } elseif { [string match *RowScroll $widget] } { + regsub RowScroll $widget "" tab + set x $tabScrollPos($tab,col) + send ${tab}TabView setLocation $x $pos + send ${tab}RowTabView setLocation 0.0 $pos + } +} + + +# TABLEOPTION -- Return any defined table option. + +proc tableOption { tab option } { + global tabOption + + set val yes + catch { + if {[info exists tabOption(${tab},${option}) ]} { + if { $tabOption(${tab},${option}) } { + set val yes + } else { + set val no + } + } + } err + + return $val +} + + +# TABLEPOS2CELLX -- Convert a widget position to a cell column number. + +proc tablePos2CellX { tab x } { + global tabColWidths tabNcols + + set nc [ tableGetNcols $tab ] + set cellX 1 + for {set w 0} {$w < $x && $cellX <= $nc} {incr cellX} { + set w [ expr ($w + $tabColWidths($tab,$cellX) + 3) ] + } + if {$x > $w} { + return -1 + } else { + return [ min [incr cellX -1] $tabNcols(${tab}.data) ] + } +} + +# TABLEPOS2CELLY -- Convert a widget position to a cell row number. + +proc tablePos2CellY { tab y } { + global tabRowHeights tabNrows + + set nr [ tableGetNrows $tab ] + set cellY 1 + for {set h 0} {$h < $y && $cellY <= $nr} {incr cellY} { + set h [ expr ($h + $tabRowHeights($tab,$cellY)) + 3 ] + } + if {$y > $h} { + return -1 + } else { + return [ min [incr cellY -1] $tabNrows(${tab}.data) ] + } +} + + +################################################################################ + + + +activate + + +appExtend { + *tclObjects:\ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry + + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*shrinkToFit: True + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { 5 tclClear 3 tclExecute 10 < +inf -10> tclDismiss 5 } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss + +} ; createObjects tclObjects + + + +################################################ +# Define some TCL debug procedures. +################################################ + +proc tclCommandClear {widget args} { + send tclEntry set string "" +} ; send tclClear addCallback tclCommandClear + +proc tclCommandExecute {widget args} { + send server [send tclEntry {get string}] +} ; send tclExecute addCallback tclCommandExecute + +proc tclCommand {widget mode command args} { + send server $command +} ; send tclEntry addCallback tclCommand + +proc tclClose {widget args} { + send tcl_panel unmap +} ; send tclDismiss addCallback tclClose + +send tclShell addCallback "send tcl_panel map" + diff --git a/vendor/x11iraf/guidemo/tabs.gui b/vendor/x11iraf/guidemo/tabs.gui new file mode 100644 index 00000000..74359ec3 --- /dev/null +++ b/vendor/x11iraf/guidemo/tabs.gui @@ -0,0 +1,103 @@ +# PANEL.GUI -- Test GUI for the Tabs widget. + +reset-server +appInitialize panel Panel { + *objects:\ + toplevel Frame frame\ + frame Tabs panelTabs\ +\ + panelTabs Layout panel\ + panel Frame label1F\ + label1F Label label1\ + panel Frame label2F\ + label2F Label label2\ + panel Command button1\ + panel Command button2\ + panel RadioGroup color\ +\ + panelTabs Frame gtermFrame\ + gtermFrame Gterm gterm + + + *background: gray + *foreground: black + + *frame.highlightThickness: 0 + *frame.frameWidth: 3 + *frame.frameType: raised + *frame.innerOffset: 5 + *frame.outerOffset: 1 + + *panel.debug: False + *panel.borderWidth: 0 + *panel.tabLabel: Panel + + *gtermFrame.tabLabel: Gterm Widget + *gtermFrame.outerOffset: 7 + *gtermFrame.frameWidth: 3 + *gtermFrame.frameType: sunken + *gterm.width: 100 + *gterm.height: 100 + *gterm.maxColors: 5 + *gterm.cmapInitialize: True + + *panel.layout: horizontal { \ + vertical { \ + 5 < +inf -5 > \ + horizontal { \ + label1F < +inf * +inf > \ + } \ + 5 < +inf -5 > \ + horizontal { \ + label2F < +inf * +inf > \ + } \ + 5 < +inf -5 > \ + horizontal {\ + button1 < +inf * +inf > \ + 5 < +inf -5 > \ + button2 < +inf * +inf > \ + }\ + 5 < +inf -5 > \ + } \ + vertical { \ + 5 < +inf -5 > \ + color < +inf * +inf > \ + } \ + } + + *Command.highlightThickness: 0 + *Label.borderWidth: 0 + *Label.background: gray60 + *label1*shadowWidth: 0 + *label1F.frameType: sunken + *label1F.frameWidth: 2 + *label2*shadowWidth: 0 + *label2F.frameType: sunken + *label2F.frameWidth: 2 + + *color.location: 0 0 100 0 + *color.shrinkToFit: True + *color.outerOffset: 10 + *color.innerOffset: 5 + *color.frameWidth: 2 + *color*offIcon: diamond0s + *color*onIcon: diamond1s + *color.red.highlightColor: red + *color.green.highlightColor: green + *color.blue.highlightColor: blue + *color.yellow.highlightColor: yellow + *color.label: Color: + *color.labels: |red|green|blue|yellow + *color.selectionStyle: multi + *color.selection: 0 + + *allowShellResize: true + *beNiceToColormap: False +} + +# Start up the GUI. +createObjects +activate + +proc quit args { send client gkey q; deactivate unmap } +send button1 addCallback quit diff --git a/vendor/x11iraf/guidemo/x_guidemo.x b/vendor/x11iraf/guidemo/x_guidemo.x new file mode 100644 index 00000000..661cb0b1 --- /dev/null +++ b/vendor/x11iraf/guidemo/x_guidemo.x @@ -0,0 +1,4 @@ +# GUIDEMO package. + +task hello = t_hello, + imbrowse = t_imbrowse diff --git a/vendor/x11iraf/guidemo/ximtool.html b/vendor/x11iraf/guidemo/ximtool.html new file mode 100644 index 00000000..434edcc7 --- /dev/null +++ b/vendor/x11iraf/guidemo/ximtool.html @@ -0,0 +1,674 @@ +<HTML> <HEAD> +<TITLE>XImtool On-Line Help Summary</TITLE> +</HEAD> <BODY> +<H2>Welcome to XImtool V1.1</H2> + +XImtool is an image display server developed by the IRAF Project at the +National Optical Astronomy Observatories. To view images you need +client software (such as IRAF) to load images into the display, or it can +load images directly when run as a standalone task. XImtool is +interchangeable with older display servers such as <I>SAOimage</I> / +<I>IMTOOL</I> and with newer servers like <I>SAOtng</I>, but offers many new +features not available elsewhere. +<P> +More <a href=#toc>detailed help</a> is available on the following topics: +<DL><DL> +<DT>Basic Usage:</DT> +<UL> +<LI><A HREF="#basic">Getting Started</A> -- The basics. </LI> +<LI><A HREF="#gui">GUI Overview</A> -- What it looks like. </LI> +<LI><A HREF="#mouse">Mouse Operations</A> -- Doing stuff. </LI> +<LI><A HREF="#keystroke">Keystroke Accelerators</A> -- Keystroke summary.</LI> +<LI><A HREF="#markers">Markers</A> -- Panner/WCS markers, general markers.</LI> +<LI><A HREF="#control">Control Panel</A> -- Operating the Control panel.</LI> +<LI><A HREF="#load">Load Panel</A> -- Load panel operation and options.</LI> +<LI><A HREF="#save">Save Panel</A> -- Save panel operation and options.</LI> +<LI><A HREF="#print">Print Panel</A> -- Print panel operation and options.</LI> +<LI><A HREF="#info">Info Panel</A> -- Information panel.</LI> +</UL></DL></DL> +<DL><DL> +<DT>Advanced Features:</DT> +<UL> +<LI><A HREF="#comline">Command-line Options</A> -- Startup flags. </LI> +<LI><A HREF="#client">Client Connections</A> -- Use as a display server. </LI> +<LI><A HREF="#framebuf">Frame Buffers</A> -- Explanation of Frame buffers. </LI> +<LI><A HREF="#pprinter">Printer Configurations</A> -- Configuring output devices. </LI> +<LI><A HREF="#tclshell">TclShell</A> -- Expert-mode interactive shell.</LI> +</UL></DL></DL> +<P> +Please contact <I>iraf@noao.edu</I> with comments, bugs, or suggestions. +<P> +<HR></P> + +<a name=#toc> <h2>Table of Contents:</h2> </a> +<PRE> + <A HREF="#basic">Getting Started</A> + <A HREF="#gui">GUI Overview</A> + <A HREF="#mouse">Mouse Operations</A> + <A HREF="#keystroke">Keystroke Accelerators</A> + <A HREF="#comline">Command-line Options</A> + <A HREF="#client">Client Connections</A> + <A HREF="#framebuf">Frame Buffers</A> + <A HREF="#markers">Markers</A> + <A HREF="#panner">Panner Marker</A> + <A HREF="#coords">Coords Box Marker</A> + <A HREF="#genmark">General Markers</A> + <A HREF="#markmenu">Menu Options</A> + <A HREF="#control">Control Panel</A> + <A HREF="#cview">View Controls</A> + <A HREF="#cenhance">Enhancement Controls</A> + <A HREF="#cblink">Blink Controls</A> + <A HREF="#copts">Options:</A> + <A HREF="#cautoscale">Autoscale</A> + <A HREF="#cantialias">Antialiasing</A> + <A HREF="#ctile">Tile Frames</A> + <A HREF="#cwarnings">Warnings</A> + <A HREF="#ccmap">Colormap Selection</A> + <A HREF="#cbltin">Builtin Colormaps</A> + <A HREF="#cuser">User-defined Colormaps</A> + <A HREF="#load">Load Panel</A> + <A HREF="#lbrowse">Directory browsing</A> + <A HREF="#lpattern">File Patterns</A> + <A HREF="#lload">Direct File Load</A> + <A HREF="#lframe">Frame Selections</A> + <A HREF="#save">Save Panel</A> + <A HREF="#sfname">File Name</A> + <A HREF="#sformat">Format</A> + <A HREF="#scolor">Color</A> + <A HREF="#print">Print Panel</A> + <A HREF="#popts">Postscript Options</A> + <A HREF="#pcolors">Color Options</A> + <A HREF="#pproc">Processing Options</A> + <A HREF="#pprinter">Printer selection</A> + <A HREF="#info">Info Panel</A> + <A HREF="#tclshell">TclShell</A> +</PRE> +<P> +<HR> +<h2><a name=#basic>Getting Started</a></h2> +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept +<a href=#client>client connections</a> simultaneously on fifo pipes, unix +domain sockets, or inet sockets. A display client like the IRAF DISPLAY +task makes a connection and sends the image across using an IIS protocol +(other/different protocols may be supported in the future). Once the image +is loaded in the display buffer it may be <a href=#cenhance>enhanced</a>, +<a href=#save>saved to a disk file</a> in a number of different formats, or +<a href=#print>printed</a> as Encapsulated Postscript to a printer or disk file. +<P> +When run in standalone mode, images may be loaded on the +<a href=#comline>command line</a> or by using the <a href=#load>Load Panel</a>. +This allows you to browse images and perform the same manipulations as if +they had been displayed by a client. +<hr> + +<h2><a name=#gui>GUI Overview</a></h2> +<p> +The GUI consists of a large image display window and a number of smaller +pannels that control various specific functions such as image +<a href=#load>Load</a>, <a href=#save>Save</a> and <a href=#print>Print</a> +as well as a general purpose <a href=#control>Control Panel</a>. The main +window menubar has several menu buttons to the left: the <I>Files</I> menu +is used to load/save/print an image as well as quit the task. The <I>View</I> +menu let's you select the image orientation, zoom, colormap or frame. The +<I>Options</I> menu allows you to call up control panels, toggle markers +or blinking etc. Some of this functionality is duplicated elsewhere in +the GUI. The right side of the menubar contains command buttons to flip the +image as well as buttons for frame selection and the help button. +<p> +For more detailed information on the operation of the control panels please +see the on-line help (i.e. use the '?' button or Alt-h keystroke in the +main image window). + +<h2><a name=#mouse>Mouse Operations</a></h2> +Clicking and dragging MB1 (mouse button 1) in the main image +window creates a rectangular region <a href=#markers>marker</a>, used +to select a region of the image. If you do this accidentally and don't +want the marker, put the pointer in the marker and type DELETE or +BACKSPACE to delete the marker. With the pointer in the marker, +MB3 will call up a <a href=#markmenu>marker menu</a> listing some things + you can do with the marker, like zoom the outlined region. MB1 can be used +to drag or resize the marker. <a href=#markers>See below</a> for more +information on markers. +<p> +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. +<p> +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the display. +<hr> + +<h2><a name=#keystroke>Keystroke Accelerators</a></h2> + The following keystrokes are currently defined in the GUI: +<pre> + +Ctrl-b Backward frame Alt-b Blink frames (toggle) +Ctrl-c Center frame? Alt-c Control panel +Ctrl-f Forward frame Alt-h Help +Ctrl-i Invert? Alt-i Info box popup +Ctrl-m Match LUTs Alt-l Load file popup +Ctrl-n Normalize Alt-p Print popup +Ctrl-p Print Alt-s Save popup +Ctrl-r Register Alt-t TclShell popup +Ctrl-t Tile frames toggle +Ctrl-u Unzoom (zoom=1) +Ctrl-x Flip X Ctrl-Alt-q Quit +Ctrl-y Flip Y Ctrl-Alt-f Fitframe + +Ctrl-= Print +Ctrl-< Decrease blink rate Ctrl-+ Zoom in +Ctrl-> Increase blink rate Ctrl-- Zoom out + +Alt-1 thru Alt-4 Set frame displayed +Ctrl-1 thru Ctrl-9 Set integer zoom factor +</pre> +NOTE: These keystrokes only work with the cursor in the main image window, +not on the subwindows or in markers. +<hr> + +<h2><a name=#client>Client Connections</a></h2> +Ximtool allows clients to connect in any of the following ways: +</DL> +<DT><B>fifo pipes</B></DT> +<DD>The traditional approach. The default, global /dev/imt1[io] pipes may +be used, or a private set of fifos.</DD> +<DT><B>tcp/ip socket</B></DT> +<DD>Clients connect via a tcp/ip socket. There is a default port, or a +custom port may be specified. This permits connecting to the server over a +remote network connection anywhere on the Internet.</DD> +<DT><B>unix domain socket</B></DT> +<DD> Like a tcp/ip socket, but limited to a single host system. Usually +faster than a tcp/ip socket, and comparable to a fifo. By default each user +gets their own unix domain socket, so this option allows multiple users +to run ximtools on the same host without having to customize things.</DD> +</DL> +By default ximtool listens simultaneously for client connctions on all three +types of ports. Clients communicate with XImtool using the IIS protocol, +other protocols may be supported in the future. +<hr> + +<h2><a name=#framebuf>Frame Buffers</a></h2> +XImtool starts up using default frame buffer of 512x512 pixels. When loading +disk images the frame buffer configuration file will be searched for a +defined frame buffer that is the same size or larger than the current image, +when used as a display server the frame buffer configuration number is passed +in by the client. The default file used is /usr/local/lib/imtoolrc, this can +be overridden by defining a <b>IMTOOLRC</b> environment variable naming the +file to be used, or by creating a <b>.imtoolrc</b> file in your home +directory. +<P> +The format of the frame buffer configuration file is +<pre> + configno nframes width height [extra fields] +e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment +</pre> +At most 128 frame buffer sizes may be defined. +<hr> + +<h2><a name=#comline>Command-line Options</a></h2> + The following command-line options are currently recognized: +<pre> + -basePixel &lt num &gt Base colormap pixel number + -cmap1 &lt file &gt User cmap 1 + -cmap2 &lt file &gt User cmap 2 + -cmapDir1 &lt dir &gt User cmapDir 1 + -cmapDir1 &lt dir &gt User cmapDir 2 + -cmapInitialize &lt bool &gt Initialize colormap at startup + -cmapName &lt name &gt Private colormap name + -config &lt num &gt Initial config number + -defgui Print default GUI to stdout + -displayPanner &lt bool &gt Display panner box + -displayCoords &lt bool &gt Display wcs coords box + -fifo &lt pipe &gt Fifo pipe to use + -fifo_only Use fifo pipes only + -gui &lt file &gt GUI file to use + -help Print command-line summary + -imtoolrc &lt file &gt Frame buffer configuration file + -inet_only Use inet sockets only + -invert Invert colormap on startup? + -maxColors &lt num &gt Number of colors + -memModel &lt type &gt Memory model (fast,small,beNiceToServer) + -nframes &lt num &gt Number of frames at startup + -port &lt num &gt Inet port to use + -printConfig &lt file &gt Printer configuration file + -port_only Use inet sockets only + -tile Tile frames on startup? + -unix &lt name &gt Unix socket to use + -unix_only Use unix sockets only + &lt file &gt File to load on startup +</pre> +<hr> +<h2><a name=#markers>Markers</a></h2> +<h3><a name=#panner>Panner Marker</a></h3> +<P> +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. +<P> +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned <a href=#genmark>below</a> apply to these markers as well, e.g. +you can use MB1 to reposition on the panner window within the main image +display window, or to drag the region marker within the panner (pan the +image). Resizing the region marker zooms the image; this is a non-aspect +constrained zoom. The panner window itself can be resized by dragging a +corner with MB1. Typing delete or backspace anywhere in the panner window +deletes the panner. +<P> +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to typing MB2 in the main display +window to pan the image. + +<h3><a name=#coords>Coords Box Marker</a></h3> +<P> +Ximtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +client defined coordinate system. The coords box feature is used to display +these world coordinates as the pointer is moved about in the image window. +<P> +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated +a "+" will be displayed after the intensity value. +<P> +The coords box is a marker (text marker) and it can be moved and resized +with the pointer like any other marker. + +<h3><a name=#genmark>General Markers</a></h3> +Although ximtool doesn't do much with markers currently, they are a general +feature of the Gterm widget and are used more extensively in other programs +(e.g. the prototype IRAF science GUI applications). Ximtool uses markers +for the marker zoom feature discussed above, and also for the +<a href=#panner>panner</a> and the <a href=#coords>coords box</a>. All +markers share some of the same characteristics, so it is worthwhile learning +basic marker manipulation keystrokes. +<UL> +<LI> MB1 anywhere inside a marker may be used to drag the marker. +<LI> MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +<LI> Shift-MB1 on the corner of most markers will rotate the marker. +<LI> Markers stack, if you have several markers and you put one on top +of the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +<LI> MB2 in the body of a marker "lowers" the marker, i.e. moves it to +the bottom of the stacking order. +<LI> Delete or backspace in a marker deletes it. +<LI> Markers have their own translation resources and so the default +<a href=#keystroke>keystroke commands</a> will not be recognized when the +cursor is in a marker. +</UL> +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back if you delete it). +<P> +<h4><a name=#markmenu>Marker Menu Options</a></h4> +<UL> +<LI> MB3 (mouse button 3) calls up the marker menu (by default). +<LI> <B>Zoom</B> does an equal aspect zoom of the region outlined by the marker. +In this way you can mark a region of the image and zoom it up. +<LI> <B>Fill</B> exactly zooms the area outlined by the marker, making it fill +the display window. Since the marker is not likely to be exactly square, +the aspect ratio of the resultant image will not be unitary. +<LI> <B>Print</B> prints the region outlined by the marker to the printer or +file currently configured by the <a href=#print>Print Panel</a>. +<LI> <B>Save</B> saves the region outlined by the marker to the file currently +configured by the <a href=#save>Save Panel</a>. +<LI> <B>Info</B> prints a description of the marked region. The text is +printed in the <a href=#info>Info Panel</a>. +<LI> <B>Unrotate</B> unrotates a rotated marker. +<LI> <B>Color</B> is a menu of possible marker colors. +<LI> <B>Type</B> is a menu of possible marker types. This is still a little +buggy and it isn't very useful, but you can use it to play with different +types of markers. +<LI> <B>Destroy</B> destroys the marker. You can also hit the delete or +backspace key in a marker to destroy the marker. +</UL> + +<hr> +<h2><a name=#control>Control Panel</a></h2> +<h3><a name=#cview>View Controls</a></h3> +<P> The <b>Frame</b> box will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 4) will be created +automatically if requested by the client. +<P> The <b>text display window</b> gives the field X,Y center, X,Y scale +factors, and the X,Y zoom factors. The scale factor and the zoom factor +will be the same unless autoscale is enabled. The scale is in units of +display pixels per frame buffer pixel, and is an absolute measure (it doesn't +matter whether or not <a href=#cautoscale>autoscale</a> is enabled). Zoom is +relative to the autoscale factor, which is 1.0 if autoscaling is disabled. +This information is also presented in the <a href=#info>Info panel</a>. +<P> The numbers in the <b>Zoom</b> box are zoom factors. Blue numbers zoom, +red numbers dezoom. <b>Zoom In</b> and <b>Zoom Out</b> may be used to go to +larger or smaller zoom factors, e.g. "Ctrl-5" followed by "Zoom In" will get you +to zoom factor 10. Specific zoom factors may also be accessed directly as +Control <a href=#keystrokes>keystrokes</a>, e.g. Ctrl-5 will set zoom factor 5. +<b>Center</b> centers the field. <b>Toggle Zoom</b> toggles between the +current zoom/center values, and the unzoomed image. +<P> <b>Aspect</b> recomputes the view so that the aspect ratio is 1.0. +Aspect also integerizes the zoom factor (use the version in the View menu +if you don't want integerization). +<P> <b>Fit Frame</b> makes the display window the same size as the frame +buffer. Note that <a href=#cautoscale>autoscale</a> has much the same effect, +and allows you to resize the display window to any size you want, or view +images to large to fit on the screen. + +<h3><a name=#cenhance>Enhancement Controls</a></h3> + +<P> At the top is a scrolled list of all the <a href=#cbltin>available +colormaps</a>. Click on the one you want to load it. You can add your own +<a href=#cuser>colormaps</a> to this list. +<P> The two sliders adjust the <b>contrast</b> (upper slider) and +<b>brightness</b> (lower slider) of the display. The <b>Invert</b> button +inverts the colormap (multiples the contrast by -1.0). Note that due to the +use of the private colormap the sliders are a bit sluggish when dragged to +window the display. If this is annoying, using MB3 in the display window is +faster. +<P>The <b>Normalize</b> button (on the bottom of the control panel) will +normalize the enhancement, i.e. set the contrast and brightness to the default +one-to-one values (1.0, 0.5). This is the preferred setting for many of the +pseudocolor colortables and for private colormaps loaded from disk images. + +<h3><a name=#cblink>Blink Controls</a></h3> +<UL> +<LI> <b>Blink frames</b> is the list of frames to be blinked. When blink +mode is in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered in +the list more than once. To program an arbitrary list of blink frames, hit +the <b>Reset</b> button and click on each blink frame button until it is set +to the desired frame number. +<LI> The <b>Blink Rate</b> can be adjusted as slow or as fast as you want +using the arrow buttons. If you set the blink rate small enough it will go +to zero, enabling single step mode (see below). +<LI> The <b>Register</b> button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. +<LI> The <b>Match LUTs</b> button sets the enhancement of all blink frames to +the same values as the display frame. Frames not in the blink list are not +affected. +<LI> The <b>Blink</b> button turns blink on and off. When the blink rate is +set to zero the Blink button will single step through the blink frames, one +frame per button press. +</UL> +<P> +NOTE: you can blink no matter what ximtool options are in effect, but many +of these will slow blink down. To get the fastest blink you may want to +turn off the panner and coords box, and match the LUTs of all the blink +frames. All the ximtool controls are fully active during blink mode, plus +you can load frames etc. + + +<h3><a name=#copts>Options:</a></h3> +<DL> +<DT><b><a name=#cautoscale>Autoscale</a></b></DT> +<DD> If autoscale is enabled then at zoom=1, the frame buffer will be +automatically scaled to fit within the display window. With autoscale +disabled (the default), the image scale is more predictable, but the image +may be clipped by the display window, or may not fill the display window.</DD> + +<DT><b><a name=#cantialias>Antialiasing</a></b></DT> +<DD> When dezooming an image, i.e., displaying a large image in a smaller +display window, antialiasing causes all the data to be used to compute the +displayed image. If antialiasing is disabled then image is subsampled to +compute the displayed image. Antialiasing can prevent subsampling from +omitting image features that don't fall in the sample grid, but it is +significantly slower than dezooming via subsampling. The default is no +antialising. </DD> + +<DT><b><a name=#ctile>Tile Frames</a></b></DT> +<DD> The default display mode is to view one frame at a time. In tile frames +mode, 2 or 4 frames may be viewed simultaneously in the display window. All +the usual operations (zoom and pan, colortable enhancement, cursor readback, +etc.) still work for each frame even when in tile frames mode. </DD> + +<DT><b><a name=#cwarnings>Warnings</a></b></DT> +<DD> The warnings options toggles whether you see warning dialog boxes in +situations like overwriting an existing file, clearing the frame buffer, etc. +</DD> +</DL> + +<h3><a name=#ccmap>Colormap Selection</a></h3> +By default XImtool will display images using either a grayscale colormap +if loaded by a client, or a private colormap when loading an image from +disk that contains a colormap. Each frame defines its own colormap so +you can define different colormaps or enhancements for each frame, they +will change automatically as you cycle through the frames. + +<h4><a name=#cbltin>Builtin Colormaps</a></h4> +Once loaded, the colormap may either be changed using the builtin colormap +menu under the <b>View</b> menu button on the main window, or from the +<a href=#cenhance>Enhancement</a> box on the <a href=#control>control panel</a>. Ximtool has about a dozen colormap +options builtin, other <a href=#cuser>user-defined colormaps</a> may +optionally be loaded. + +<h4><a name=#cuser>User-defined Colormaps</a></h4> +The cmap[12] and cmapDir[12] resources (or <a href=#comline>command line +arguments</a> are used to tell ximtool which specific colormaps to make +available or where to look for colortables respectively. The colortables +are loaded when ximtool starts up, or when it is reinitialized (e.g. by +pressing the <b>Initialize</b> button in the <a href=#control>control +panel</a>). Ximtool will ignore any files in the colormap directory +which do not look like colortables. New colortables will also be added +for each images loaded from disk. +<P> +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, +and blue values scaled to the range 0.0 (off) to 1.0 (full intensity). +<PRE> + R G B + R G B + (etc.) +</PRE> +Blank lines and comment lines (# ...) are ignored. +<P> +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. Ximtool will interpolate the table as necessary to +compute the colortable values used in Ximtool. Ximtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. +<P> +The name of the colortable as it will appear in the Ximtool control panel +is the root name of the file, e.g., if the file is "rainbow.lut" the +colortable name will be "rainbow". Lower case names are suggested to avoid +name collisions with the builtin colortables. Private colormaps for disk +images will be have the same name as the image loaded. If the same colortable +file appears in multiple user colortable directories, the first one will be +used. +<P> +The directory "luts" in the ximtool source directory contains a sample set +of colortable files. This can be installed as /usr/local/lib/imtoolcmap +when ximtool is installed. +<hr> + +<h2><a name=#load>Load Panel</a></h2> +The Load Panel allows you load images from disk directly to the frame buffer, +this is analogous to loading an image on the command line except that +browsing is possible. At present recognized formats include IRAF OIF format +(i.e. .imh extension), simple FITS files, GIF, and Sun rasterfiles. The +task will automatically sense the format of the image and load it +appropriately. Images with private colormaps (such as GIF) will be loaded +using the private colormap by default (meaning that changing the +brightness/contrast enhancements will render a random-colored image). If +the <b>Grayscale</b> button is enabled the image will be converted to +grayscale and loaded with the standard grayscale colormap. +<P> +When loading new images the frame buffer configuration table +(<em>imtoolrc</em>) will be searched for a frame buffer that is the same size +or larger than the new image size, if no frame buffer can be found a custom +buffer exactly the size of the image will be created. This means that the +image may not fill the display window when loaded, or you may see a subsection +of the image in the main display window. Setting the +<a href=#cautoscale>autoscale</a> option will scale the entire image to fit +the main display window. +<P> +Images with more colors than can be displayed will automatically be quantized +to the number of available colors before display. Formats which allow more +than 8-bit pixels will be sampled to determine an optimal range in the data +to be used to compute the transformation to the number of display colors. +This is the same transformation used by the IRAF DISPLAY task. + +<DL> +<DT><B><a name=#lbrowse>Directory browsing</a></B></DT> +<DD> +The load panel contains a list of files in the current directory that may +be selected for loading by selecting with left mouse button. If the file +is a directory the contents of the new directory will be loaded, if it's +a plain file an attempt will be made to load it as an image. Directories +in the list are identified with a trailing '/' character, you will always +see any directories available even if a <a href=#lpattern>filter</a> is +specified. +<P> +The <b>Root</b> button will reset the current directory to the system root +directory. The <b>Home</b> button will reset the current directory to the +user's login directory, the <b>Up</b> button moves up one directory level, +and <b>Rescan</b> reloads the file list by rescanning the directory. The +current working directory is given below the file selection window.</DD> + +<DT><B><a name=#lpattern>File Patterns</a></B></DT> +<DD> By default all files and directories will be listed. You may specify a +filter to e.g. select only those files with a given extension like "*.fits" +to list only files with a ".fits" extension. Directories will always be seen +in the list and are identified with a trailing '/' character. Any valid +unix pattern matching string will be recognized.</DD> +<DT><B><a name=#lload>Direct File Load</a></B></DT> +<DD> If you know exactly which file you wish to load, you may enter its name +in the <b>Load File</b> text box and either hit <cr> or the Load button to +load it. An absolute or relative path name may be given, if a simple filename +is specified it will be searched for in the current working directory.</DD> +<DT><B><a name=#lframe>Frame Selections</a></B></DT> +<DD> By default images will be loaded into frame number 1, you may select a +different frame using the <b>Frame</b> menu button.</DD> +</DL> +<hr> + +<h2><a name=#save>Save Panel</a></h2> +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, any general graphics +markers, or overlay graphics displayed by the client program). Presently, +only the contents of the main display window may be saved, there is no +facility for saving the undisplayed contents of the entire frame buffer +other than to enable the <a href=#cautoscale>autoscale</a> feature. A limited +number of formats are currently available, others will be added in future +versions. +<DL> +<DT><b><a name=#sfname>File Name</a></b></DT> +<DD> The <b>File Name</b> text box allows you to enter the file name of the +saved file. A "%d" anywhere in the name will be replaced by a sequence number +allowing multiple frames to be saved with unique names. </DD> +<DT><b><a name=#sformat>Format</a></b></DT> +<DD> The <B>Format</B> box allows you to choose the format of the image to be +created. Not all formats are currently implemented. </DD> +<DT><b><a name=#scolor>Color</a></b></DT> +<DD> The <b>Color</b> box lets you choose the color type of the image to be +created. The options will change depending on the format, e.g. FITS doesn't +allow color so no color options will be allowed. Formats which allow 24-bit +images will be written using the current colormap after converting to a 24-bit +image, pseudocolor images will be written with the current colormap. </DD> +</DL> +<hr> + +<h2><a name=#print>Print Panel</a></h2> +The Print Panel allows you dump the contents of the main display window as +Enacpsulated Postscript to either a named printer device or to a disk file. +The <b>Print To</b> selects the type of output, the <b>Print Command</b> +box will adjust accordingly, either as a Unix printer command or as a file +name. A "%d" anywhere in the name for disk output will be replaced by a +sequence number allowing multiple frames to be saved with unique names. +<a href=#pprinter>Selecting printers</a> from the installed list will +automatically change the command to be used to generate the output. This +command does not necessarily need to be a printer command, the +<a href=#pprinter>printer configuration file</a> lets you define any command +string to process the image. +<h3><a name=#pcolors>Color Options</a></h3> +The <b>Color</b> box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap. +<h3><a name=#popts>Postscript Options</a></h3> +<DL> +<DT>Orientation</DT> +<DD> Set the page orientation. +<DT>Paper Size</DT> +<DD> Select the paper size to be used. +<DT>Image Scale</DT> +<DD> Set the scale factor used to compute the final image size. +</DL> +<h3><a name=#pproc>Processing Options</a></h3> +<DL> +<DT>Auto Scale</DT> +<DD> The auto scale toggles whether or not the image is automatically scaled +to fit the page. If not enabled, the <b>image scale</b> will be used to +dtermine the output image size. +<DT>Auto Rotate</DT> +<DD> Auto rotate determines whether or not the image will be rotated to fit +on the page. When set, an image larger than the current orientation will be +rotated and possibly scaled to fit the page. +<DT>Max Aspect</DT> +<DD> Max Aspect takes images smaller than the page and automatically increases +the scale so the image fills the page in the current orientation. +<DT>Annotate</DT> +<DD> The annotate option toggles whether or not the final file includes +annotation such as the image title, a colorbar, and axis labels. +</DL> +<h3><a name=#pprinter>Printer selection</a></h3> +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the <em>printConfig</em> resource. The format of the file is simply +<pre> + <b>name</b> &lt tab &gt <em>command</em> +</pre> +The <b>name</b> value is what appears in the selection list and may be more +than a single word, the <em>command</em> can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command will be +a simple 'lpr -Pfoo' or some such, but can also include converters or +previewers. At most 128 printer commands may be used. +<hr> + +<h2><a name=#info>Info Panel</a></h2> + The information panel is underused at present but is meant to provide +basic information about the frame being displayed. It is updated to be +current while changing enhancements, pan/zoom regions, or frame selection. +In cases where the image title string is truncated in the main display window, +the user can always pop up the info window to see the full title. +<hr> + +<h2><a name=#tclshell>TclShell</a></h2> + The <em>TclShell</em> is mostly used as a development or debugging +tool for the GUI. It allows the user to type commands directly to the +TCL interpreter letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. Most users will +never need this, but for an example of what it does, bring it up and type a +command such as +<pre> + send helpButton set background red +</pre> +Cool, huh. +<hr> + +<h2><a name=#acknowledgements>Acknowledgements</a></h2> + <I>XImtool</I> was developed by the IRAF Group at the National Optical +Astronomy Observatories in Tucson, AZ. For further information or to report +problems please contact <I>iraf@noao.edu</I> +<hr> +This document was last updated 11/6/96. + +</BODY> +</HTML> diff --git a/vendor/x11iraf/guidemo/zscale.x b/vendor/x11iraf/guidemo/zscale.x new file mode 100644 index 00000000..d447f446 --- /dev/null +++ b/vendor/x11iraf/guidemo/zscale.x @@ -0,0 +1,437 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <imhdr.h> + +.help zscale +.nf ___________________________________________________________________________ +ZSCALE -- Compute the optimal Z1, Z2 (range of greyscale values to be +displayed) of an image. For efficiency a statistical subsample of an image +is used. The pixel sample evenly subsamples the image in x and y. The entire +image is used if the number of pixels in the image is smaller than the desired +sample. + +The sample is accumulated in a buffer and sorted by greyscale value. +The median value is the central value of the sorted array. The slope of a +straight line fitted to the sorted sample is a measure of the standard +deviation of the sample about the median value. Our algorithm is to sort +the sample and perform an iterative fit of a straight line to the sample, +using pixel rejection to omit gross deviants near the endpoints. The fitted +straight line is the transfer function used to map image Z into display Z. +If more than half the pixels are rejected the full range is used. The slope +of the fitted line is divided by the user-supplied contrast factor and the +final Z1 and Z2 are computed, taking the origin of the fitted line at the +median value. +.endhelp ______________________________________________________________________ + +define MIN_NPIXELS 5 # smallest permissible sample +define MAX_REJECT 0.5 # max frac. of pixels to be rejected +define GOOD_PIXEL 0 # use pixel in fit +define BAD_PIXEL 1 # ignore pixel in all computations +define REJECT_PIXEL 2 # reject pixel after a bit +define KREJ 2.5 # k-sigma pixel rejection factor +define MAX_ITERATIONS 5 # maximum number of fitline iterations + + +# ZSCALE -- Sample the image and compute Z1 and Z2. + +procedure zscale (im, z1, z2, contrast, optimal_sample_size, len_stdline) + +pointer im # image to be sampled +real z1, z2 # output min and max greyscale values +real contrast # adj. to slope of transfer function +int optimal_sample_size # desired number of pixels in sample +int len_stdline # optimal number of pixels per line + +int npix, minpix, ngoodpix, center_pixel, ngrow +real zmin, zmax, median +real zstart, zslope +pointer sample, left +int zsc_sample_image(), zsc_fit_line() + +begin + # Subsample the image. + npix = zsc_sample_image (im, sample, optimal_sample_size, len_stdline) + center_pixel = max (1, (npix + 1) / 2) + + # Sort the sample, compute the minimum, maximum, and median pixel + # values. + + call asrtr (Memr[sample], Memr[sample], npix) + zmin = Memr[sample] + zmax = Memr[sample+npix-1] + + # The median value is the average of the two central values if there + # are an even number of pixels in the sample. + + left = sample + center_pixel - 1 + if (mod (npix, 2) == 1 || center_pixel >= npix) + median = Memr[left] + else + median = (Memr[left] + Memr[left+1]) / 2 + + # Fit a line to the sorted sample vector. If more than half of the + # pixels in the sample are rejected give up and return the full range. + # If the user-supplied contrast factor is not 1.0 adjust the scale + # accordingly and compute Z1 and Z2, the y intercepts at indices 1 and + # npix. + + minpix = max (MIN_NPIXELS, int (npix * MAX_REJECT)) + ngrow = max (1, nint (npix * .01)) + ngoodpix = zsc_fit_line (Memr[sample], npix, zstart, zslope, + KREJ, ngrow, MAX_ITERATIONS) + + if (ngoodpix < minpix) { + z1 = zmin + z2 = zmax + } else { + if (contrast > 0) + zslope = zslope / contrast + z1 = max (zmin, median - (center_pixel - 1) * zslope) + z2 = min (zmax, median + (npix - center_pixel) * zslope) + } + + call mfree (sample, TY_REAL) +end + + +# ZSC_SAMPLE_IMAGE -- Extract an evenly gridded subsample of the pixels from +# a two-dimensional image into a one-dimensional vector. + +int procedure zsc_sample_image (im, sample, optimal_sample_size, len_stdline) + +pointer im # image to be sampled +pointer sample # output vector containing the sample +int optimal_sample_size # desired number of pixels in sample +int len_stdline # optimal number of pixels per line + +int ncols, nlines, col_step, line_step, maxpix, line +int opt_npix_per_line, npix_per_line +int opt_nlines_in_sample, min_nlines_in_sample, max_nlines_in_sample +pointer op +pointer imgl2r() + +begin + ncols = IM_LEN(im,1) + nlines = IM_LEN(im,2) + + # Compute the number of pixels each line will contribute to the sample, + # and the subsampling step size for a line. The sampling grid must + # span the whole line on a uniform grid. + + opt_npix_per_line = max (1, min (ncols, len_stdline)) + col_step = max (1, (ncols + opt_npix_per_line-1) / opt_npix_per_line) + npix_per_line = max (1, (ncols + col_step-1) / col_step) + + # Compute the number of lines to sample and the spacing between lines. + # We must ensure that the image is adequately sampled despite its + # size, hence there is a lower limit on the number of lines in the + # sample. We also want to minimize the number of lines accessed when + # accessing a large image, because each disk seek and read is expensive. + # The number of lines extracted will be roughly the sample size divided + # by len_stdline, possibly more if the lines are very short. + + min_nlines_in_sample = max (1, optimal_sample_size / len_stdline) + opt_nlines_in_sample = max(min_nlines_in_sample, min(nlines, + (optimal_sample_size + npix_per_line-1) / npix_per_line)) + line_step = max (1, nlines / (opt_nlines_in_sample)) + max_nlines_in_sample = (nlines + line_step-1) / line_step + + # Allocate space for the output vector. Buffer must be freed by our + # caller. + + maxpix = npix_per_line * max_nlines_in_sample + call malloc (sample, maxpix, TY_REAL) + + # Extract the vector. + op = sample + do line = (line_step + 1) / 2, nlines, line_step { + call zsc_subsample (Memr[imgl2r(im,line)], Memr[op], + npix_per_line, col_step) + op = op + npix_per_line + if (op - sample + npix_per_line > maxpix) + break + } + + return (op - sample) +end + + +# ZSC_SUBSAMPLE -- Subsample an image line. Extract the first pixel and +# every "step"th pixel thereafter for a total of npix pixels. + +procedure zsc_subsample (a, b, npix, step) + +real a[ARB] +real b[npix] +int npix, step +int ip, i + +begin + if (step <= 1) + call amovr (a, b, npix) + else { + ip = 1 + do i = 1, npix { + b[i] = a[ip] + ip = ip + step + } + } +end + + +# ZSC_FIT_LINE -- Fit a straight line to a data array of type real. This is +# an iterative fitting algorithm, wherein points further than ksigma from the +# current fit are excluded from the next fit. Convergence occurs when the +# next iteration does not decrease the number of pixels in the fit, or when +# there are no pixels left. The number of pixels left after pixel rejection +# is returned as the function value. + +int procedure zsc_fit_line (data, npix, zstart, zslope, krej, ngrow, maxiter) + +real data[npix] # data to be fitted +int npix # number of pixels before rejection +real zstart # Z-value of pixel data[1] (output) +real zslope # dz/pixel (output) +real krej # k-sigma pixel rejection factor +int ngrow # number of pixels of growing +int maxiter # max iterations + +int i, ngoodpix, last_ngoodpix, minpix, niter +real xscale, z0, dz, x, z, mean, sigma, threshold +double sumxsqr, sumxz, sumz, sumx, rowrat +pointer sp, flat, badpix, normx +int zsc_reject_pixels(), zsc_compute_sigma() + +begin + call smark (sp) + + if (npix <= 0) + return (0) + else if (npix == 1) { + zstart = data[1] + zslope = 0.0 + return (1) + } else + xscale = 2.0 / (npix - 1) + + # Allocate a buffer for data minus fitted curve, another for the + # normalized X values, and another to flag rejected pixels. + + call salloc (flat, npix, TY_REAL) + call salloc (normx, npix, TY_REAL) + call salloc (badpix, npix, TY_SHORT) + call aclrs (Mems[badpix], npix) + + # Compute normalized X vector. The data X values [1:npix] are + # normalized to the range [-1:1]. This diagonalizes the lsq matrix + # and reduces its condition number. + + do i = 0, npix - 1 + Memr[normx+i] = i * xscale - 1.0 + + # Fit a line with no pixel rejection. Accumulate the elements of the + # matrix and data vector. The matrix M is diagonal with + # M[1,1] = sum x**2 and M[2,2] = ngoodpix. The data vector is + # DV[1] = sum (data[i] * x[i]) and DV[2] = sum (data[i]). + + sumxsqr = 0 + sumxz = 0 + sumx = 0 + sumz = 0 + + do i = 1, npix { + x = Memr[normx+i-1] + z = data[i] + sumxsqr = sumxsqr + (x ** 2) + sumxz = sumxz + z * x + sumz = sumz + z + } + + # Solve for the coefficients of the fitted line. + z0 = sumz / npix + dz = sumxz / sumxsqr + + # Iterate, fitting a new line in each iteration. Compute the flattened + # data vector and the sigma of the flat vector. Compute the lower and + # upper k-sigma pixel rejection thresholds. Run down the flat array + # and detect pixels to be rejected from the fit. Reject pixels from + # the fit by subtracting their contributions from the matrix sums and + # marking the pixel as rejected. + + ngoodpix = npix + minpix = max (MIN_NPIXELS, int (npix * MAX_REJECT)) + + for (niter=1; niter <= maxiter; niter=niter+1) { + last_ngoodpix = ngoodpix + + # Subtract the fitted line from the data array. + call zsc_flatten_data (data, Memr[flat], Memr[normx], npix, z0, dz) + + # Compute the k-sigma rejection threshold. In principle this + # could be more efficiently computed using the matrix sums + # accumulated when the line was fitted, but there are problems with + # numerical stability with that approach. + + ngoodpix = zsc_compute_sigma (Memr[flat], Mems[badpix], npix, + mean, sigma) + threshold = sigma * krej + + # Detect and reject pixels further than ksigma from the fitted + # line. + ngoodpix = zsc_reject_pixels (data, Memr[flat], Memr[normx], + Mems[badpix], npix, sumxsqr, sumxz, sumx, sumz, threshold, + ngrow) + + # Solve for the coefficients of the fitted line. Note that after + # pixel rejection the sum of the X values need no longer be zero. + + if (ngoodpix > 0) { + rowrat = sumx / sumxsqr + z0 = (sumz - rowrat * sumxz) / (ngoodpix - rowrat * sumx) + dz = (sumxz - z0 * sumx) / sumxsqr + } + + if (ngoodpix >= last_ngoodpix || ngoodpix < minpix) + break + } + + # Transform the line coefficients back to the X range [1:npix]. + zstart = z0 - dz + zslope = dz * xscale + + call sfree (sp) + return (ngoodpix) +end + + +# ZSC_FLATTEN_DATA -- Compute and subtract the fitted line from the data array, +# returned the flattened data in FLAT. + +procedure zsc_flatten_data (data, flat, x, npix, z0, dz) + +real data[npix] # raw data array +real flat[npix] # flattened data (output) +real x[npix] # x value of each pixel +int npix # number of pixels +real z0, dz # z-intercept, dz/dx of fitted line +int i + +begin + do i = 1, npix + flat[i] = data[i] - (x[i] * dz + z0) +end + + +# ZSC_COMPUTE_SIGMA -- Compute the root mean square deviation from the +# mean of a flattened array. Ignore rejected pixels. + +int procedure zsc_compute_sigma (a, badpix, npix, mean, sigma) + +real a[npix] # flattened data array +short badpix[npix] # bad pixel flags (!= 0 if bad pixel) +int npix +real mean, sigma # (output) + +real pixval +int i, ngoodpix +double sum, sumsq, temp + +begin + sum = 0 + sumsq = 0 + ngoodpix = 0 + + # Accumulate sum and sum of squares. + do i = 1, npix + if (badpix[i] == GOOD_PIXEL) { + pixval = a[i] + ngoodpix = ngoodpix + 1 + sum = sum + pixval + sumsq = sumsq + pixval ** 2 + } + + # Compute mean and sigma. + switch (ngoodpix) { + case 0: + mean = INDEF + sigma = INDEF + case 1: + mean = sum + sigma = INDEF + default: + mean = sum / ngoodpix + temp = sumsq / (ngoodpix - 1) - sum**2 / (ngoodpix * (ngoodpix - 1)) + if (temp < 0) # possible with roundoff error + sigma = 0.0 + else + sigma = sqrt (temp) + } + + return (ngoodpix) +end + + +# ZSC_REJECT_PIXELS -- Detect and reject pixels more than "threshold" greyscale +# units from the fitted line. The residuals about the fitted line are given +# by the "flat" array, while the raw data is in "data". Each time a pixel +# is rejected subtract its contributions from the matrix sums and flag the +# pixel as rejected. When a pixel is rejected reject its neighbors out to +# a specified radius as well. This speeds up convergence considerably and +# produces a more stringent rejection criteria which takes advantage of the +# fact that bad pixels tend to be clumped. The number of pixels left in the +# fit is returned as the function value. + +int procedure zsc_reject_pixels (data, flat, normx, badpix, npix, + sumxsqr, sumxz, sumx, sumz, threshold, ngrow) + +real data[npix] # raw data array +real flat[npix] # flattened data array +real normx[npix] # normalized x values of pixels +short badpix[npix] # bad pixel flags (!= 0 if bad pixel) +int npix +double sumxsqr,sumxz,sumx,sumz # matrix sums +real threshold # threshold for pixel rejection +int ngrow # number of pixels of growing + +int ngoodpix, i, j +real residual, lcut, hcut +double x, z + +begin + ngoodpix = npix + lcut = -threshold + hcut = threshold + + do i = 1, npix + if (badpix[i] == BAD_PIXEL) + ngoodpix = ngoodpix - 1 + else { + residual = flat[i] + if (residual < lcut || residual > hcut) { + # Reject the pixel and its neighbors out to the growing + # radius. We must be careful how we do this to avoid + # directional effects. Do not turn off thresholding on + # pixels in the forward direction; mark them for rejection + # but do not reject until they have been thresholded. + # If this is not done growing will not be symmetric. + + do j = max(1,i-ngrow), min(npix,i+ngrow) { + if (badpix[j] != BAD_PIXEL) { + if (j <= i) { + x = normx[j] + z = data[j] + sumxsqr = sumxsqr - (x ** 2) + sumxz = sumxz - z * x + sumx = sumx - x + sumz = sumz - z + badpix[j] = BAD_PIXEL + ngoodpix = ngoodpix - 1 + } else + badpix[j] = REJECT_PIXEL + } + } + } + } + + return (ngoodpix) +end diff --git a/vendor/x11iraf/include/cdl.h b/vendor/x11iraf/include/cdl.h new file mode 100644 index 00000000..8abdd8a3 --- /dev/null +++ b/vendor/x11iraf/include/cdl.h @@ -0,0 +1,336 @@ +/* + * CDL.H -- Global definitions for the Client Display Library. + */ + +#ifndef _CDL_Defined +#define _CDL_Defined + +#define CDL_VERSION "Client Display Library V1.8 07/28/01" + +/* Declare prototypes if using ANSI C */ +#ifdef CDL_ANSIC +#define ANSI_FUNC +#endif + +#define MAX_FBCONFIG 128 /* max size of FB config table */ +#define MAX_FRAMES 16 /* max frames support by server */ +#define MAX_MAPPINGS 32 /* max image mappings per frame */ +#define DEF_CONTRAST 0.25 /* default zscale contrast */ +#define DEF_NSAMPLE 600 /* default number of samples */ +#define DEF_NSAMPLINES -1 /* default no. of sample lines */ +#define INDEF -999 /* INDEF value flag */ + + +/* Include private definitions when compiling library sources. */ +#ifdef CDL_LIBRARY_SOURCE +#include "eps.h" +#include "cdlP.h" +#endif + +/* Frame buffer selection code. */ +#define FB_AUTO -1 /* autoconfig the frame buffer */ + +/* Types of greyscale transformations. */ +#define CDL_UNITARY 0 /* values map without change */ +#define CDL_LINEAR 1 /* linear mapping */ +#define CDL_LOG 2 /* logarithmic mapping */ + +/* Overlay colors. */ +#define C_BLACK 202 /* Static overlay color defs */ +#define C_WHITE 203 +#define C_RED 204 +#define C_GREEN 205 +#define C_BLUE 206 +#define C_YELLOW 207 +#define C_CYAN 208 +#define C_MAGENTA 209 +#define C_CORAL 210 +#define C_MAROON 211 +#define C_ORANGE 212 +#define C_KHAKI 213 +#define C_ORCHID 214 +#define C_TURQUOISE 215 +#define C_VIOLET 216 +#define C_WHEAT 217 + +#define M_FILL 1 /* Overlay point mark types. */ +#define M_POINT 2 +#define M_BOX 4 +#define M_PLUS 8 +#define M_CROSS 16 +#define M_DIAMOND 32 +#define M_CIRCLE 64 +#define M_STAR 128 +#define M_HLINE 256 +#define M_VLINE 512 +#define M_HBLINE 1024 +#define M_VBLINE 2048 + +#define F_ROMAN 0 /* Font types. */ +#define F_GREEK 1 +#define F_FUTURA 2 +#define F_TIMES 3 +#define F_BOLD 4 + +#define L_SOLID 0 /* Polyline attribute values. */ +#define L_DASHED 1 +#define L_DOTTED 2 +#define L_DOTDASH 3 +#define L_HOLLOW 4 +#define L_SHADOW 5 + + +#define MOD_FAST 1 /* SubRaster display model */ +#define MOD_NORMAL 2 +#define DEF_MODEL MOD_FAST + + +/* Local type definitions. */ +typedef struct CDL *CDLPtr; +typedef struct Marker *MarkerPtr; + + +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + + + +/* The main CDL package structure. + */ +struct CDL { +#ifdef CDL_LIBRARY_SOURCE + IMDPtr imd; /* IMD package pointer */ + int memModel; /* Memory model to use */ +#endif + + int frame; /* display frame number */ + int fbconfig; /* fb config number */ + int fbwidth; /* current FB width */ + int fbheight; /* current FB height */ + int fbnf; /* current FB nframes */ + + float contrast; /* zscale contrast value*/ + int nsample; /* opt. sample points */ + int nsamplines; /* opt. sample lines */ + + int im_nx; /* current image width */ + int im_ny; /* current image height */ + + /* Overlay graphics attributes. */ + int font; /* overlay text font */ + int textwidth; /* text width */ + int linewidth; /* line width */ + int linestyle; /* line style */ + + /* WCS descriptor stuff. */ + char *imname; /* image name */ + char *imtitle; /* image title */ + float a, b, c, d; /* WCS values */ + float tx, ty; /* translation values */ + float z1, z2; /* zscale values */ + int ztrans; /* Z trans type */ + + /* Coordinate mappings on the frame buffer. */ + char *ref; /* img reference */ + char *region; /* region name */ + float sx, sy; /* source rect */ + int snx, sny; + int dx, dy; /* destination rect */ + int dnx, dny; + int iis_version; /* server IIS version */ + int iis_valid; /* valid mapping flag */ +}; + + +/* A element of the display list describing the marker. We throw in the + * kitchen sinke here to cover all possible marker types, in reality only + * a few of these are used for any given marker type. + */ +struct Marker { + short type; /* marker type */ + int x, y; /* center coords */ + int number; /* label a point */ + int pt_type; /* point type */ + int size; /* point marker size */ + int fill; /* fill marker */ + int color; /* marker color */ + int *xp, *yp; /* coords */ + int npts; /* npts in array */ + int radius; /* circle radius */ + int nannuli; /* num of annuli */ + int sep; /* annulus separation */ + int xrad, yrad; /* ellipse axes */ + float ang; /* ellipse rotation */ + float txsize; /* text marker size */ + char *str; /* text marker string */ + int font; /* text font type */ + int textwidth; /* text width */ + int linewidth; /* line width */ + int linestyle; /* line style */ + + int nx, ny; /* marker region size */ + int lx, ly; /* marker LL corner */ + + unsigned char *refpix; /* orig image pixels */ + unsigned char *markpix; /* marked image pixels */ + + MarkerPtr back; /* linked list pointers */ + MarkerPtr next; + int markerID; /* assigned id number */ +}; + + +/* Marker types used internally. */ +#define MK_POINT 0 +#define MK_LINE 1 +#define MK_BOX 2 +#define MK_POLYLINE 3 +#define MK_POLYGON 4 +#define MK_CIRCLE 5 +#define MK_CIRCANN 6 +#define MK_ELLIPSE 7 +#define MK_ELLIPANN 8 +#define MK_TEXT 9 + + +/* Function definitions. */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ANSI_FUNC + +CDLPtr cdl_open(); + +char cdl_readCursor(); + +int cdl_displayPix(), cdl_displayIRAF(), cdl_displayFITS(); +int cdl_isIRAF(), cdl_isFITS(); +int cdl_readIRAF(), cdl_readFITS(), cdl_clearFrame(); +int cdl_readImage(), cdl_readFrameBuffer(), cdl_readSubRaster(); +int cdl_writeSubRaster(), cdl_setCursor(); +int cdl_printPix(), cdl_printPixToFile(); +int cdl_setWCS(), cdl_getWCS(); +int cdl_getMapping(), cdl_setMapping(), cdl_queryMap(); + +void cdl_selectFB(), cdl_close(), cdl_computeZscale(), cdl_zscaleImage(); +void cdl_setFrame(), cdl_setFBConfig(), cdl_setZTrans(), cdl_setZoom(); +void cdl_setSample(), cdl_setContrast(), cdl_setName(), cdl_setTitle(); +void cdl_getFrame(), cdl_getFBConfig(), cdl_getZTrans(), cdl_getZoom(); +void cdl_getSample(), cdl_getContrast(), cdl_getName(), cdl_getTitle(); +void cdl_getSampleLines(), cdl_setSampleLines(), cdl_zscale(); +void cdl_setZScale(), cdl_getZScale(), cdl_lookupFBSize(); +void cdl_setDebug(); + +/* Marker function definitions. */ +int cdl_markPoint(), cdl_markLine(), cdl_markBox(), cdl_markPolyline(); +int cdl_markPolygon(), cdl_markCircle(), cdl_markCircAnnuli(); +int cdl_markEllipse(), cdl_markEllipAnnuli(), cdl_markText(); +int cdl_deleteMark(), cdl_clearOverlay(), cdl_redrawOverlay(); +int cdl_markCoordsFile(), cdl_mapFrame(), cdl_markPointLabel(); + +void cdl_setFont(), cdl_setTextWidth(); +void cdl_setLineWidth(), cdl_setLineStyle(); + +#endif + + +/* Include function prototypes for all public CDL functions when using ANSI C */ + +#ifdef ANSI_FUNC + +CDLPtr cdl_open(char *imtdev); +int cdl_displayPix(CDLPtr cdl, uchar *pix, int nx, int ny, int bitpix, int frame, int fbconfig, int zscale); +char cdl_readCursor(CDLPtr cdl, int sample, float *x, float *y, int *wcs, char *key); +int cdl_setCursor(CDLPtr cdl, int x, int y, int wcs); +int cdl_setWCS(CDLPtr cdl, char *imname, char *imtitle, float a, float b, float c, float d, float tx, float ty, float z1, float z2, int zt); +int cdl_getWCS(CDLPtr cdl, char *name, char *title, float *a, float *b, float *c, float *d, float *tx, float *ty, float *z1, float *z2, int *zt); +int cdl_getMapping(CDLPtr cdl, char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *ref); +int cdl_setMapping(CDLPtr cdl, char *region, float sx, float sy, int snx, int sny, int dx, int dy, int dnx, int dny, char *ref); +int cdl_queryMap(CDLPtr cdl, int wcs, char *region, float *sx, float *sy, int *snx, int *sny, int *dx, int *dy, int *dnx, int *dny, char *objref); +int cdl_clearFrame(CDLPtr cdl); +void cdl_selectFB(CDLPtr cdl, int nx, int ny, int *fb, int *w, int *h, int *nf, int reset); +void cdl_close(CDLPtr cdl); +int cdl_readImage(CDLPtr cdl, uchar **pix, int *nx, int *ny); +int cdl_readFrameBuffer(CDLPtr cdl, uchar **pix, int *nx, int *ny); +void cdl_computeZscale(CDLPtr cdl, uchar *pix, int nx, int ny, int bitpix, float *z1, float *z2); +void cdl_zscaleImage(CDLPtr cdl, uchar **pix, int nx, int ny, int bitpix, float z1, float z2); +int cdl_printPix(CDLPtr cdl, char *cmd, uchar *pix, int nx, int ny, int annotate); +int cdl_printPixToFile(CDLPtr cdl, char *fname, uchar *pix, int nx, int ny, int annotate); +int cdl_readSubRaster(CDLPtr cdl, int lx, int ly, int nx, int ny, uchar **pix); +int cdl_writeSubRaster(CDLPtr cdl, int lx, int ly, int nx, int ny, uchar *pix); +void cdl_setFBConfig(CDLPtr cdl, int configno); +void cdl_getFBConfig(CDLPtr cdl, int *configno, int *w, int *h, int *nframes); +void cdl_lookupFBSize(CDLPtr cdl, int configno, int *w, int *h, int *nf); +void cdl_setFrame(CDLPtr cdl, int frame); +void cdl_setZTrans(CDLPtr cdl, int ztrans); +void cdl_setZScale(CDLPtr cdl, float z1, float z2); +void cdl_setSample(CDLPtr cdl, int nsample); +void cdl_setSampleLines(CDLPtr cdl, int nlines); +void cdl_setContrast(CDLPtr cdl, float contrast); +void cdl_setName(CDLPtr cdl, char *imname); +void cdl_setTitle(CDLPtr cdl, char *imtitle); +void cdl_getFrame(CDLPtr cdl, int *frame); +void cdl_getZTrans(CDLPtr cdl, int *ztrans); +void cdl_getZScale(CDLPtr cdl, float *z1, float *z2); +void cdl_getSample(CDLPtr cdl, int *nsample); +void cdl_getSampleLines(CDLPtr cdl, int *nlines); +void cdl_getContrast(CDLPtr cdl, float *contrast); +void cdl_getName(CDLPtr cdl, char *imname); +void cdl_getTitle(CDLPtr cdl, char *imtitle); +void cdl_setDebug(int state); + + +int cdl_mapFrame(CDLPtr cdl, int frame); +int cdl_markCoordsFile(CDLPtr cdl, char *fname, int type, int size, int color, int label); +int cdl_markPoint(CDLPtr cdl, int x, int y, int number, int size, int type, int color); +int cdl_markPointLabel(CDLPtr cdl, int x, int y, char *label, int size, int type, int color); +int cdl_markLine(CDLPtr cdl, int xs, int ys, int xe, int ye, int color); +int cdl_markBox(CDLPtr cdl, int lx, int ly, int ux, int uy, int fill, int color); +int cdl_markPolygon(CDLPtr cdl, int xarray[], int yarray[], int npts, int fill, int color); +int cdl_markPolyline(CDLPtr cdl, int *xarray, int *yarray, int npts, int color); +int cdl_markCircle(CDLPtr cdl, int x, int y, int radius, int fill, int color); +int cdl_markCircAnnuli(CDLPtr cdl, int x, int y, int radius, int nannuli, int sep, int color); +int cdl_markEllipse(CDLPtr cdl, int x, int y, int xrad, int yrad, float rotang, int fill, int color); +int cdl_markEllipAnnuli(CDLPtr cdl, int x, int y, int xrad, int yrad, float ang, int nannuli, int sep, int color); +int cdl_markText(CDLPtr cdl, int x, int y, char *str, float size, float angle, int color); +void cdl_setFont(CDLPtr cdl, int font); +void cdl_setTextWidth(CDLPtr cdl, int width); +void cdl_setLineWidth(CDLPtr cdl, int width); +void cdl_setLineStyle(CDLPtr cdl, int style); +int cdl_deleteMark(CDLPtr cdl, int x, int y); +int cdl_clearOverlay(CDLPtr cdl); +int cdl_redrawOverlay(CDLPtr cdl); +void cdl_beginDList(int frame); +void cdl_drawDList(int frame); +void cdl_clearDList(int frame); +void cdl_endDList(int frame, int flush); +int cdl_doTextMarker(int x, int y, char *string, float size, float angle, int color, int width, int font, uchar *pix, int lx, int ly, int nx, int ny); +int cdl_freeDisplayList(CDLPtr cdl, MarkerPtr head); + +int cdl_displayFITS(CDLPtr cdl, char *fname, int frame, int fbconfig, int zscale); +int cdl_isFITS(char *fname); +int cdl_readFITS(char *fname, uchar **pix, int *nx, int *ny, int *bitpix, +char *title); + +int cdl_displayIRAF(CDLPtr cdl, char *fname, int band, int frame, int +fbconfig, int zscale); +int cdl_isIRAF(char *fname); +int cdl_readIRAF(char *fname, int band, uchar **pix, int *nx, int *ny, int *bitpix, char *title); + +#endif + +#ifdef __cplusplus +} +#endif + + +#ifdef CDL_LIBRARY_SOURCE +#include "cdlProto.h" +#endif + +/* _CDL_Defined */ +#endif diff --git a/vendor/x11iraf/include/cdlftn.inc b/vendor/x11iraf/include/cdlftn.inc new file mode 100644 index 00000000..6adecd7d --- /dev/null +++ b/vendor/x11iraf/include/cdlftn.inc @@ -0,0 +1,79 @@ +C ======================================================================== +C = +C CDLFTN.INC -- Include file for Fortran programs to give symbolic = +C names to various constants used by the CDL. = +C = +C ======================================================================== + + integer NULL + integer FB_AUTO + integer CDL_UNITARY, CDL_LINEAR, CDL_LOG + + integer C_BLACK, C_WHITE, C_RED, C_GREEN, C_BLUE, C_YELLOW + integer C_CYAN, C_MAGENTA, C_CORAL, C_MAROON, C_ORANGE, C_KHAKI + integer C_ORCHID, C_TURQUOISE, C_VIOLET, C_WHEAT + + integer M_FILL, M_POINT, M_BOX, M_PLUS, M_CROSS, M_DIAMOND + integer M_STAR, M_HLINE, M_VLINE, M_HBLINE, M_VBLINE, M_CIRCLE + + integer F_ROMAN, F_GREEK, F_FUTURA, F_TIMES, F_BOLD + + integer L_SOLID, L_DASHED, L_DOTTED, L_DOTDASH, L_HOLLOW, L_SHADOW + +C Commonly used C constants + parameter (NULL=0) + +C Automatically select frame buffer + parameter (FB_AUTO=-1) + +C Types of greyscale transformations. + parameter (CDL_UNITARY=0) + parameter (CDL_LINEAR=1) + parameter (CDL_LOG=2) + +C Overlay colors. + parameter (C_BLACK=202) + parameter (C_WHITE=203) + parameter (C_RED=204) + parameter (C_GREEN=205) + parameter (C_BLUE=206) + parameter (C_YELLOW=207) + parameter (C_CYAN=208) + parameter (C_MAGENTA=209) + parameter (C_CORAL=210) + parameter (C_MAROON=211) + parameter (C_ORANGE=212) + parameter (C_KHAKI=213) + parameter (C_ORCHID=214) + parameter (C_TURQUOISE=215) + parameter (C_VIOLET=216) + parameter (C_WHEAT=217) + +C Overlay point mark types. + parameter (M_FILL=1) + parameter (M_POINT=2) + parameter (M_BOX=4) + parameter (M_PLUS=8) + parameter (M_CROSS=16) + parameter (M_DIAMOND=32) + parameter (M_CIRCLE=64) + parameter (M_STAR=128) + parameter (M_HLINE=256) + parameter (M_VLINE=512) + parameter (M_HBLINE=1024) + parameter (M_VBLINE=2048) + +C Font types. + parameter (F_ROMAN=0) + parameter (F_GREEK=1) + parameter (F_FUTURA=2) + parameter (F_TIMES=3) + parameter (F_BOLD=4) + +C Line styles. + parameter (L_SOLID=0) + parameter (L_DASHED=1) + parameter (L_DOTTED=2) + parameter (L_DOTDASH=3) + parameter (L_HOLLOW=4) + parameter (L_SHADOW=5) diff --git a/vendor/x11iraf/include/cdlspp.h b/vendor/x11iraf/include/cdlspp.h new file mode 100644 index 00000000..b3e78cae --- /dev/null +++ b/vendor/x11iraf/include/cdlspp.h @@ -0,0 +1,131 @@ + +# CDL_SPP.H -- Header file for the CDL SPP interface. Fortran compilers +# on various platforms may append one or more trailing underscores to +# symbol names, we'll use macros for the interface names and use defines +# to see what the symbol name is. + + +define FB_AUTO -1 # autoconfig the frame buffer + +# Types of greyscale transformations. +define CDL_UNITARY 0 # values map without change +define CDL_LINEAR 1 # linear mapping +define CDL_LOG 2 # logarithmic mapping + +# Overlay colors. +define C_BLACK 202 # static overlay color defs +define C_WHITE 203 +define C_RED 204 +define C_GREEN 205 +define C_BLUE 206 +define C_YELLOW 207 +define C_CYAN 208 +define C_MAGENTA 209 +define C_CORAL 210 +define C_MAROON 211 +define C_ORANGE 212 +define C_KHAKI 213 +define C_ORCHID 214 +define C_TURQUOISE 215 +define C_VIOLET 216 +define C_WHEAT 217 + +# Overlay point mark types. +define M_FILL 1 +define M_POINT 2 +define M_BOX 4 +define M_PLUS 8 +define M_CROSS 16 +define M_DIAMOND 32 +define M_CIRCLE 64 +define M_STAR 128 +define M_HLINE 256 +define M_VLINE 512 +define M_HBLINE 1024 +define M_VBLINE 2048 + +# Font types. +define F_ROMAN 0 +define F_GREEK 1 +define F_FUTURA 2 +define F_TIMES 3 +define F_BOLD 4 + +# Polyline attribute values. +define L_SOLID 0 +define L_DASHED 1 +define L_DOTTED 2 +define L_DOTDASH 3 +define L_HOLLOW 4 +define L_SHADOW 5 + + +# Map the SPP names to the symbols in the library. +define cdl_open cdopen_ +define cdl_displayPix cdsppx_ +define cdl_readCursor crdcur_ +define cdl_setCursor cscurs_ +define cdl_clearFrame cclfrm_ +define cdl_selectFB cselfb_ +define cdl_close cclose_ +define cdl_displayIRAF cdspir_ +define cdl_isIRAF cisirf_ +define cdl_readIRAF crdirf_ +define cdl_displayFITS cdspft_ +define cdl_isFITS cisfts_ +define cdl_readFITS crdfts_ +define cdl_compZScale ccmpzs_ +define cdl_zscaleImage czscim_ +define cdl_printPix cprpix_ +define cdl_printPixToFile cprpfl_ +define cdl_readImage crdimg_ +define cdl_readFrameBuffer crdfrb_ +define cdl_readSubRaster crsubr_ +define cdl_writesubRaster cwsubr_ +define cdl_setWCS cstwcs_ +define cdl_setFBConfig csfbcf_ +define cdl_getFBConfig cgfbcf_ +define cdl_lookupFBSize clkfbs_ +define cdl_setFrame csfram_ +define cdl_setZTrans csztrn_ +define cdl_setZScale cszscl_ +define cdl_setSample cssamp_ +define cdl_setSampleLines cssaml_ +define cdl_setContrast cscntr_ +define cdl_setName csname_ +define cdl_setTitle cstitl_ +define cdl_getWCS cgtwcs_ +define cdl_getFrame cgfram_ +define cdl_getZTrans cgztrn_ +define cdl_getZScale cgzscl_ +define cdl_getSample cgsamp_ +define cdl_getSampleLines cgsmpl_ +define cdl_getContrast cgcntr_ +define cdl_getName cgname_ +define cdl_getTitle cgtitl_ +define cdl_mapFrame cmapfr_ +define cdl_markCoordsFile cmkcfl_ +define cdl_markPoint cmkpnt_ +define cdl_markPointLabel cmkpnl_ +define cdl_markLine cmklin_ +define cdl_markBox cmkbox_ +define cdl_markPolyline cmkpln_ +define cdl_markPolygon cmkpgn_ +define cdl_markCircle cmkcrc_ +define cdl_markCircAnnuli cmkcan_ +define cdl_markEllipse cmkell_ +define cdl_markEllipAnnuli cmkela_ +define cdl_markText cmktxt_ +define cdl_setFont csfont_ +define cdl_setLineWidth cslwid_ +define cdl_setLineStyle cslsty_ +define cdl_setTextWidth cstwid_ +define cdl_deleteMark cdelmk_ +define cdl_clearOverlay cclrov_ +define cdl_redrawOverlay crdrov_ +define cdl_setDebug cstdbg_ +define cdl_setMapping cstmap_ +define cdl_getMapping cgtmap_ +define cdl_queryMap cqrmap_ + + diff --git a/vendor/x11iraf/install b/vendor/x11iraf/install new file mode 100755 index 00000000..18685c42 --- /dev/null +++ b/vendor/x11iraf/install @@ -0,0 +1,675 @@ +#!/bin/csh -f +# +# INSTALL -- Install the X11IRAF files and binaries. +# +# +#============================================================================ + +unset noclobber +onintr x11iraf_cleanup_ +unalias cd cp cmp echo ln mv rm sed set grep ls chmod chown pwd touch sort + +set path = (/sbin /usr/sbin /bin /usr/bin /usr/ucb /etc /usr/etc $path /usr /local/bin /opt/local/bin /local/bin /home/local/bin ) + + +#============================================================================ +# Global Variables. +#============================================================================ + +set hilite = 1 + + +#============================================================================ +# Utility aliases. +#============================================================================ +alias PUT "mv -f \!*; chown $user \!$ " # [MACHDEP] +alias BOLD_ON "(if ($hilite) tput bold)" +alias BOLD_OFF "(if ($hilite) tput sgr0)" +alias SO_ON "(if ($hilite) tput smso)" +alias SO_OFF "(if ($hilite) tput rmso)" + +alias DO_OK "(echo -n '[ '; BOLD_ON; echo -n ' OK '; BOLD_OFF; echo ' ]')" +alias DO_WARN "(echo -n '[ '; BOLD_ON; echo -n 'WARN'; BOLD_OFF; echo ' ]')" +alias DO_FAIL "(echo -n '[ '; SO_ON; echo -n 'FAIL'; SO_OFF; echo ' ]')" + +alias MSG "(echo -n ' ';BOLD_ON;echo -n '*** ';BOLD_OFF; echo \!*)" +alias MSGN "(echo -n ' ';BOLD_ON;echo -n '*** ';BOLD_OFF; echo -n \!*)" +alias MSGB "(echo -n ' ';BOLD_ON;echo -n '*** ';echo \!*; BOLD_OFF)" +alias MSGBN "(echo -n ' ';BOLD_ON;echo -n '*** ';echo -n \!*;BOLD_OFF)" +alias ERRMSG "(echo -n ' ';BOLD_ON;echo -n 'ERROR: ';BOLD_OFF; echo \!*)" +alias WARNING "(echo -n ' ';BOLD_ON;echo -n 'WARNING: ';BOLD_OFF; echo \!*)" +alias NEWLINE "(echo '')" + +alias PROMPT "(BOLD_ON; echo -n \!*; BOLD_OFF; echo -n ' (yes): ')" +alias PROMPT_N "(BOLD_ON; echo -n \!*; BOLD_OFF; echo -n ' (no): ')" + + +#============================================================================ +# Get the current platform architecture. +#============================================================================ + +set UNAME="" +if (-e /usr/bin/uname) then + set uname_cmd = /usr/bin/uname + set UNAME=`/usr/bin/uname | tr '[A-Z]' '[a-z]'` +else if (-e /bin/uname) then + set uname_cmd = /bin/uname + set UNAME=`/bin/uname | tr '[A-Z]' '[a-z]'` +else + set UNAME = "INDEF" +endif + + +switch ($UNAME) + case sunos: + if (`$uname_cmd -m | cut -c2-` == "86pc") then + set arch = "sunos" + else + setenv OSVERSION `uname -r | cut -c1` + if ($OSVERSION == 5) then + set arch = "ssun" + else + set arch = "sparc" + endif + endif + breaksw + case linux: + if (`$uname_cmd -m` == "ppc") then + if (-f /etc/redhat-release) then + set arch = "linuxppc" + else + set arch = "mklinux" + endif + else + if (-f /etc/redhat-release) then + set arch = "redhat" + else if (-f /etc/SuSE-release) then + set arch = "suse" + else + set arch = "linux" + endif + endif + breaksw + case darwin: + case macosx: + case macintel: + if (`$uname_cmd -m` == "i386") then + set arch = "macintel" + else + set arch = "macosx" + endif + breaksw + case freebsd: + set arch = "freebsd" + breaksw + case hp-ux: + set arch = "hp700" + breaksw + case irix: + set arch = "irix" + breaksw + case irix64: + set arch = "irix" + breaksw + case aix: + set arch = "rs6000" + breaksw + case osf1: + set arch = "alpha" + breaksw + case ultrix: + set arch = "ultrix" + breaksw + default: + echo "ERROR: No 'uname' command found to determine architecture." +bad_arch: + NEWLINE + echo -n "Enter architecture name: " + set arch = "$<" + if (! -e bin.$arch) then + echo -n "Invalid architecture, try again..." + goto bad_arch + endif + breaksw +endsw + + + +############################################################################# +# Process command line options. +############################################################################# +set exec = yes + +while ("$1" != "") + switch ("$1") + case -n: # no execute + set exec = no + breaksw + case -hl: # disable highlighting + set hilite = 0 + alias BOLD_ON "(if ($hilite) tput bold)" + alias BOLD_OFF "(if ($hilite) tput sgr0)" + alias SO_ON "(if ($hilite) tput smso)" + alias SO_OFF "(if ($hilite) tput rmso)" + breaksw + case +hl: # enable highlighting + set hilite = 1 + alias BOLD_ON "(if ($hilite) tput bold)" + alias BOLD_OFF "(if ($hilite) tput sgr0)" + alias SO_ON "(if ($hilite) tput smso)" + alias SO_OFF "(if ($hilite) tput rmso)" + breaksw + case -h: # print help summary + goto Usage + default: + echo "install: unknown argument $1" + breaksw + endsw + + if ("$2" == "") then + break + else + shift + endif +end + + +############################################################################# +# Check that we're running as 'root' +############################################################################# +if (-e /usr/bin/whoami) then + set WHOAMI = `/usr/bin/whoami` +else if (-e /usr/ucb/whoami) then + set WHOAMI = `/usr/ucb/whoami` +else if (-e /bin/whoami) then + set WHOAMI = `/bin/whoami` +endif + +if ($WHOAMI != "root" && $exec == "yes") then + clear + NEWLINE ; NEWLINE + BOLD_ON + echo "======================================================================" + echo -n "WARNING" + BOLD_OFF + echo ": This script must be run as root for changes to take effect." + echo " If you decide to proceed, the 'no-op' flag will be enabled" + echo " by default. No changes will be made to the system files," + echo " however you will be able to see what the script does." + BOLD_ON + echo "======================================================================" + BOLD_OFF + NEWLINE +no_op_proc_: + + PROMPT "Proceed with a no-op installation anyway? " + set ans = "$<" + if ("$ans" != "") then + if ($ans == 'n' || $ans == 'N' || $ans == 'no' || $ans == 'NO') then + exit 0 + endif + endif + NEWLINE + + set exec = no +endif + +############################################################################# +# Print the banner message. +############################################################################# +clear +NEWLINE +BOLD_ON +echo " X11IRAF V2.0 Installation" +echo " =========================" +BOLD_OFF +NEWLINE + +# Print a quick usage summary. +NEWLINE +echo -n " For each prompt: hit " +BOLD_ON ; echo -n "<CR>"; BOLD_OFF; +echo -n " to accept the default value, " +BOLD_ON ; echo -n "'q'" ; BOLD_OFF +echo ' to quit,' + +echo -n " or " +BOLD_ON ; echo -n "'help'"; BOLD_OFF +echo -n " or "; +BOLD_ON ; echo -n "'?'"; BOLD_OFF +echo -n " to print an explanation of the prompt." +NEWLINE +NEWLINE + + + +############################################################################# +# Get the X11IRAF distribution file directory, assume it's the local +# directory but prompt if we don't find the files we expect. +############################################################################# + +set xroot = "./" + +do_root: +if (!(-e "$xroot/bin.$arch" && \ + -e "$xroot/lib.$arch" && \ + -e "$xroot/app-defaults")) then + echo -n "Directory containing the X11IRAF distribution files ($xroot): " + set xroot = "$<" + if ("$xroot" != "") then + if (! (-d "$xroot")) then + echo "Directory $xroot not found." + NEWLINE + goto do_root + endif + else if (! (-e "$xroot/bin.$arch" && \ + -e "$xroot/lib.$arch" && \ + -e "$xroot/app-defaults")) then + echo " *** This directory doesn't appear to contains all the" + echo " *** X11IRAF distribution files for this platform." + NEWLINE + set xroot = "./" + goto do_root + endif +endif + + +############################################################################# +# Install the binaries. +############################################################################# +set xgt = `which xgterm |& grep -i "^\/"` +if ($status == 0) then + set d_xbin = $xgt:h +else + set d_xbin = /usr/local/bin +endif + +set BINFILES = \ + "ism_wcspix.e obmsh resize vximtool xgterm ximtool ximtool-alt xtapemon" + + +NEWLINE ; BOLD_ON +echo "Binary Installation:" +echo "--------------------" +NEWLINE ; BOLD_OFF + + +echo " The local commands directory is the place where the commands" +echo " such as 'xgterm' and 'ximtool' will be installed. This should" +echo " be a directory in a common search path such as /usr/local/bin." +if ("$WHOAMI" != "root") then + echo " Since you are not running as the root user the files may be" + echo " installed in a personal directory such as $HOME/bin" +endif + +do_bin: + NEWLINE + echo -n " Local commands directory ($d_xbin): " + set xbin = "$<" + if ("$xbin" == "") then + set xbin = $d_xbin + endif + +# Check whether we're going to replace the existing binary or change +# the directory. Use only xgterm as the test. +set xgt = `which xgterm |& grep -i "^\/"` +if ($status == 0) then + if ("$xgt" != $xbin/xgterm) then + NEWLINE + echo " *** Some X11IRAF commands are already installed at a" + echo " *** different location, e.g. $xgt" + NEWLINE +db_pr: + echo -n " *** Would you like to delete these first (yes/no)? " + set c = "$<" + if ("$c" != "") then + if ($c == 'y' || $c == 'Y' || $c == 'yes' || $c == 'YES') then + NEWLINE + set xgt_root = $xgt:h + echo -n " Removing old binaries from $xgt_root ... " + if ($exec == "yes") then + foreach i ($BINFILES) + /bin/rm -f $xgt_root/$i + end + endif + echo -n " " + DO_OK + else + NEWLINE ; NEWLINE + endif + else + goto db_pr + endif + endif +endif + +# Create the bin directory if needed. +if (! -e $xbin && "$exec" == "yes") then + mkdir $xbin + if ($status != 0) then + goto do_bin + endif +endif + +# Copy the bin files to the new directory. +NEWLINE +set errstat = 0 +if (-e bin.$arch) then + chdir bin.$arch + echo -n " Installing new binaries in $xbin ..." + if ("$exec" == "yes") then + foreach i (*) + cp $i $xbin >& /dev/null + if ($status == 1) then + DO_FAIL + ERRMSG "Cannot copy '$i' to $xbin" + set errstat = 1 + break + endif + end + endif + if ($errstat == 0) then + DO_OK + endif + chdir .. +else + echo " *** No bin.$arch directory found, skipping installation." +endif + + +############################################################################# +# Install the man pages. +############################################################################# +if (-e /usr/local/man/man1) then + set d_xman = /usr/local/man/man1 +else if (-e /opt/local/man/man1) then + set d_xman = /opt/local/man/man1 +else if (-e /usr/man/man1) then + set d_xman = /usr/man/man1 +else if (-e /share/man/man1) then + set d_xman = /share/man/man1 +else if (-e /usr/share/man/man1) then + set d_xman = /usr/share/man/man1 +else + set d_xman = "none found" +endif + +NEWLINE ; NEWLINE +BOLD_ON +echo "Manual Page Installation:" +echo "-------------------------" +BOLD_OFF +NEWLINE + +if ("$WHOAMI" != "root") then + echo " Since you are not running as the root user you cannot install" + echo " the manual pages for the X11IRAF tasks. These can still be" + echo " read by either formatting the pages yourself with a command" + echo " such as " + echo " % nroff -man -tbl xgterm.1 " + NEWLINE + echo " or you can define the MANPATH environment variable to search" + echo " this directory. For example," + NEWLINE + echo ' setenv MANPATH $MANPATH'":$cwd/man " +else + echo " Man pages are available for each of the X11IRAF tasks, some" + echo " tasks will also provide online documentation. Manual pages" + echo " may be installed either in the main system directory or in " + echo " a local directory as long as that is accessible through a" + echo " MANPATH environment variable." +endif + +do_man: + NEWLINE + echo -n " Local man page directory ($d_xman): " + set xman = "$<" + if ("$xman" == "") then + set xman = $d_xman + endif + +# Create the man directory if needed. +if (! -e $xman && "$exec" == "yes") then + mkdir $xman + if ($status != 0) then + goto do_man + endif +endif + +# Copy the man pages to the new directory. +NEWLINE +set errstat = 0 +if (-e man) then + chdir man + echo -n " Installing man pages at $xman ..." + if ("$exec" == "yes") then + foreach i (*) + cp $i $xman >& /dev/null + if ($status == 1) then + DO_FAIL + ERRMSG "Cannot copy '$i' to $xman" + set errstat = 1 + break + endif + end + endif + if ($errstat == 0) then + DO_OK + endif + chdir .. +else + echo " *** No 'man' directory found, skipping installation." +endif + + +############################################################################# +# Install the app-defaults files. +############################################################################# +if (-d /usr/lib/X11/app-defaults) then + set d_xapp = /usr/lib/X11/app-defaults +else if (-d /etc/X11/app-defaults) then + set d_xapp = /usr/lib/app-defaults +else if (-d /usr/X11R6/lib/app-defaults) then + set d_xapp = /usr/X11R6/lib/app-defaults +else if (-d /usr/X11R6/etc/app-defaults) then + set d_xapp = /usr/X11R6/etc/app-defaults +else if (-d /usr/openwin/lib/app-defaults) then + set d_xapp = /usr/openwin/lib/app-defaults +else if (-d /usr/lib/app-defaults) then + set d_xapp = /usr/lib/app-defaults +else + set d_xapp = "none found" +endif + +NEWLINE ; NEWLINE +BOLD_ON +echo "Application Default Resource Installation:" +echo "------------------------------------------" +BOLD_OFF +NEWLINE + +echo " The app-defaults directory contains the default X resources for" +echo " the XGterm task. This is not required for the program to work" +echo " but provides for more readable menu entries, fonts, etc." +echo " The directory is normally part of the X11 tree but may be any " +echo " directory specified in an XFILESEARCHPATH environment variable." + +do_app: + NEWLINE + echo -n " System app-defaults directory ($d_xapp): " + set xapp = "$<" + if ("$xapp" == "") then + set xapp = $d_xapp + endif + +# Create the app-defaults directory if needed. +if (! -e $xapp && "$exec" == "yes") then + mkdir $xapp + if ($status != 0) then + goto do_app + endif +endif + +# Copy the app-defaults files to the new directory. +NEWLINE +set errstat = 0 +if (-e app-defaults) then + chdir app-defaults + echo -n " Installing app-defaults in $xapp ..." + if ("$exec" == "yes") then + foreach i (*) + if($i == "XGterm" && ($arch == "macosx"||$arch == "macintel")) then + ; # no-op + else + cp $i $xapp >& /dev/null + endif + if ($status == 1) then + DO_FAIL + ERRMSG "Cannot copy '$i' to $xapp" + set errstat = 1 + break + endif + end + endif + if ($errstat == 0) then + DO_OK + endif + chdir .. +else + echo " *** No 'app-defaults' directory found, skipping installation." +endif + + + +############################################################################# +# Install the (optional) CDL library. +############################################################################# +set d_xlib = /usr/local/lib +set d_xinc = /usr/local/include + +NEWLINE ; NEWLINE +BOLD_ON +echo "Client Display Library (CDL) Installation:" +echo "------------------------------------------" +BOLD_OFF +NEWLINE + +echo " The CDL is an interface for C/Fortran programs to display images" +echo " to XImtool and compatible display servers. This library is not" +echo " required in the runtime system for XImtool but can be useful for" +echo " developing local applications needing a display capability." +echo " The local lib directory is the place where the CDL library file " +echo " will be installed, the local include directory is where the needed" +echo " nclude files for the library will be installed." + +do_lib: + NEWLINE + echo -n " Would you like to install this library? (yes): " + set ans = "$<" + set ans = `echo $ans | tr A-Z a-z` + if ("$ans" != "n" && "$ans" != "no") then + NEWLINE + echo -n " Local lib directory ($d_xlib): " + set xlib = "$<" + if ("$xlib" == "") then + set xlib = $d_xlib + endif + + # Create the local lib directory if needed. + if (! -e $xlib && "$exec" == "yes") then + mkdir $xlib + if ($status != 0) then + goto do_lib + endif + endif + + # Copy the library files to the new directory. + NEWLINE + set errstat = 0 + if (-e lib.$arch) then + chdir lib.$arch + echo -n " Installing CDL libraries in $xlib ..." + if ("$exec" == "yes") then + foreach i (libcdl.a) + cp $i $xlib >& /dev/null + if ($status == 1) then + DO_FAIL + ERRMSG "Cannot copy '$i' to $xlib" + set errstat = 1 + break + endif + end + endif + if ($errstat == 0) then + DO_OK + endif + chdir .. + else + echo " *** No lib.$arch directory found, skipping installation." + endif + + + # Install the include files. + do_inc: + NEWLINE + echo -n " Local include directory ($d_xinc): " + set xinc = "$<" + if ("$xinc" == "") then + set xinc = $d_xinc + endif + + # Create the local lib directory if needed. + if (! -e $xinc && "$exec" == "yes") then + mkdir $xinc + if ($status != 0) then + goto do_inc + endif + endif + + # Copy the include files to the new directory. + NEWLINE + set errstat = 0 + if (-e include) then + chdir include + echo -n " Installing include files in $xinc ..." + if ("$exec" == "yes") then + foreach i (cdl*) + cp $i $xinc >& /dev/null + if ($status == 1) then + DO_FAIL + ERRMSG "Cannot copy '$i' to $xlib" + set errstat = 1 + break + endif + end + endif + if ($errstat == 0) then + DO_OK + endif + chdir .. + else + echo " *** No 'include' directory found, skipping installation." + endif + + else + echo " Skipping CDL library installation." + endif + + +NEWLINE +echo "Installation complete." +NEWLINE + +x11iraf_cleanup_: + +# Normal exit. +exit 0 + +Usage: + echo "Usage: install [-n] [-h] [-hl]" + echo "" + echo " where -n # no execute" + echo " -h # print this help summary" + echo " +hl # enable highlighted text" + echo " -hl # disable highlighted text" + exit 0 diff --git a/vendor/x11iraf/lib b/vendor/x11iraf/lib new file mode 120000 index 00000000..3094672e --- /dev/null +++ b/vendor/x11iraf/lib @@ -0,0 +1 @@ +lib.generic \ No newline at end of file diff --git a/vendor/x11iraf/lib.linux/libcdl.a b/vendor/x11iraf/lib.linux/libcdl.a new file mode 100644 index 00000000..ce6ac68d Binary files /dev/null and b/vendor/x11iraf/lib.linux/libcdl.a differ diff --git a/vendor/x11iraf/lib.macintel/libcdl.a b/vendor/x11iraf/lib.macintel/libcdl.a new file mode 100644 index 00000000..a891d053 Binary files /dev/null and b/vendor/x11iraf/lib.macintel/libcdl.a differ diff --git a/vendor/x11iraf/man/obmsh.1 b/vendor/x11iraf/man/obmsh.1 new file mode 100644 index 00000000..06d7a923 --- /dev/null +++ b/vendor/x11iraf/man/obmsh.1 @@ -0,0 +1,71 @@ +.\" @(#)obmsh.1 1.1 28-Aug-97 MJF +.TH OBMSH 1 "28 Aug 1997" "X11IRAF Project" +.SH NAME +obmsh \- Object Manager GUI script interpreter +.SH SYNOPSIS +\fBobmsh\fP [\fIfile\fP] +.SH DESCRIPTION +.LP +\fBObmsh\fP is a GUI command interpreter for the IRAF Widget Server / +Object Manager (OBM) that +executes commands read from the standard input or from a file. As with +other shell interpreters such as \fIcsh\fR if the program is a file +beginning with \fB#!\fR, the remainder of the first line specifies an +interpreter for the program, usually the path to the obmsh executable. +There are no arguments. + +OBM programs are Tcl scripts consisting of application widgets to be created, +resource values for those widgets, callback procedures, and OBM-specific +functions needed to create and activate the GUI. In applications such as +\fIXimtool\fR the GUI interacts with an underlying client program by passing +messages to the client, server (the object manager itself) or various +parameters or widgets in the script. Obmsh scripts have no client but +will execute a default callback that outputs the client message to the +standard output, the script will continue to run until a 'q' keystroke is +detected in a client message. + +Obmsh script support all features of the Tcl language but also provide a +builtin GUI capability. For applications which do not require a client +to perform more complex operations, the obmsh provides a fully featured +GUI scripting language. For more information on the IRAF Widget Server / +OBM contact iraf@noao.edu or see Tody, D. 1995, in ADASS IV Proceedings, +ASP Conf. Ser, Vol 77, p. 89. + +.SH EXAMPLE +.LP +The following GUI script program demonstrates a simple "hello world" +application: +.nf + + #!/usr/local/bin/obmsh + + reset-server + appInitialize hello Hello { + ! Application defaults for the hello world program. + Hello*objects:\\ + toplevel Form helloForm\\ + helloForm Label helloLabel\\ + helloForm Command quitButton + + *background: bisque + *helloLabel.label: Hello, world! + *quitButton.fromHoriz: helloLabel + *quitButton.label: Quit + } + + createObjects + proc quit args { send client gkey q; deactivate unmap } + send quitButton addCallback quit + activate + +.fi +If the file has execute permissions set the \fB#!\fR will invoke the obmsh +to execute the file, otherwise it may be running using either +.nf + + % obmsh hello.gui or % obmsh < hello.gui +.fi +.SH SEE ALSO +xgterm(1), ximtool(1) +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/man/resize.1 b/vendor/x11iraf/man/resize.1 new file mode 100644 index 00000000..e0c83a64 --- /dev/null +++ b/vendor/x11iraf/man/resize.1 @@ -0,0 +1,72 @@ +.TH RESIZE 1 "Release 5" "X Version 11" +.SH NAME +resize \- utility to set TERMCAP and terminal settings to current window size +.SH SYNOPSIS +.B resize +[-u] [\-s [row col]] +.SH DESCRIPTION +.I Resize +prints a shell command for setting the TERM and TERMCAP environment variables +to indicate the current size of \fIxgterm\fP window from which the command +is run. For this output to take effect, \fIresize\fP must either be evaluated +as part of the command line (usually done with a shell alias or function) or +else redirected to a file which can then be read in. From the C shell (usually +known as \fI/bin/csh\fP), the following alias could be defined in the +user's \fI.cshrc\fP: +.sp +.nf + % alias rs 'set noglob; `eval resize`' +.fi +.sp +After resizing the window, the user would type: +.sp +.nf + % rs +.fi +.sp +Users of versions of the Bourne shell (usually known as \fI/bin/sh\fP) that +don't have command +functions will need to send the output to a temporary file and the read it back +in with the ``.'' command: +.sp +.nf + $ resize >/tmp/out + $ . /tmp/out +.fi +.SH OPTIONS +The following options may be used with \fIresize\fP: +.TP 8 +.B \-u +This option indicates that Bourne shell commands should be generated even if +the user's current shell isn't \fI/bin/sh\fP. +.TP 8 +.B \-c +This option indicates that C shell commands should be generated even if the +user's current shell isn't \fI/bin/csh\fP. +.TP 8 +.B \-s \fR[\fIrows columns\fP] +This option indicates that that Sun console escape sequences will be used +instead of the special \fIxgterm\fP escape code. If \fIrows\fP and +\fIcolumns\fP are given, \fIresize\fP will ask the \fIxgterm\fP to resize +itself. However, the window manager may choose to disallow the change. +.SH FILES +/etc/termcap for the base termcap entry to modify. +.br +~/.cshrc user's alias for the command. +.SH "SEE ALSO" +csh(1), tset(1), xgterm(1) +.SH AUTHORS +Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley) +.br +Copyright (c) 1984, 1985 by Massachusetts Institute of Technology. +.br +See +.IR X (1) +for a complete copyright notice. +.SH BUGS +The \fI-u\fP or \fI-c\fP must appear to the left of \fI-s\fP if both are +specified. +.PP +There should be some global notion of display size; termcap and +terminfo need to be rethought in the context of window systems. +(Fixed in 4.3BSD, and Ultrix-32 1.2) diff --git a/vendor/x11iraf/man/vximtool.1 b/vendor/x11iraf/man/vximtool.1 new file mode 100644 index 00000000..fd45b824 --- /dev/null +++ b/vendor/x11iraf/man/vximtool.1 @@ -0,0 +1,178 @@ +.\" @(#)vximtool.1 1.1 18-Jun-97 MJF +.TH VXIMTOOL 1 "18 Jun 1997" "IRAF Project" +.SH NAME +vximtool \-- A virtual display server for IRAF IIS protocol clients +.SH SYNOPSIS +\fBvximtool\fP [ \fIoptions\fP ...] + +.SH "DESCRIPTION" +.LP +\fIVXIMTOOL\fR is a image display server process much like \fIXIMTOOL\fR, +except that all it normally does is respond to datastream requests +to read and write to internal frame buffers maintained as arrays in memory. +Multiple frame buffers and frame buffer configurations are supported. It +can be used to debug IIS protocol client programs by printing out the +protocol packets recieved, or can simply be used as a dummy server in cases +where no image display is really needed. + +The \fI-verbose\fR flag will log all datastream requests to the stderr, +otherwise the task runs silently except for error messages. The process is +terminated with an EOF on the stdin, if the task is intended to be run +as a background job the \fI-background\fR flag should be enabled to shut +off the check of the stdin and avoid a "waiting for tty input" message that +would suspend the background job. Frame buffers are maintained as rasters +in memory, up to four frames may currently be defined. If it not necessary +to keep the displayed images in memory (i.e. the client will not need to +read back any subrasters such as when doing overlay graphics), the +\fI-noraster\fR flag can be used to disable the memory rasters. In this +case any image readback will return an array of zero values. + +The default frame buffer size is 512x512, with 2 frames defined initially. +The \fI-config\fR and \fI-nframes\fR flags can be used to change the +startup frame buffers used. The frame buffer configuration table is normally +taken to be /usr/local/lib/imtoolrc but can be overridden by using an +IMTOOLRC environment variable, a \fI$HOME/.imtoolrc\fR file, or +the \fI-imtoolrc\fR command-line flag respectively. The format of the +frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + +and so on. At most 128 frame buffer sizes may be defined, each configuration +may define up to 4 frames, configuration numbers need not be sequential. + +.SH OPTIONS +.TP 5 +.B "-background" +The task will be run in the background so don't listen to STDIN for an +EOF to quit gracefully. +.TP 5 +.B "-config \fInum\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-interactive" +Allow cursor value strings to be typed into the STDIN in response to cursor +read requests from the client. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-noraster" +If set no client data will be stored in memory, and image readback will +return an array of zeroes. +.TP 5 +.B "-nframes \fInum\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-port \fInum\fP" +Set the primary port to listen on for client connections. The default +is 5137. +.TP 5 +.B "-verbose" +If set, print information about all IIS packets headers recieved to the +STDERR stream. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "CLIENT CONNECTIONS" + +\fIVXImtool\fR allows clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument. Values should be specified as the root +pathname to a pair of fifo pipes whose last character is 'i' or 'o', +these characters will be added automatically when opening the pipes. +For example, to use the default pipes the path would be specified as simply +"/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch. +This permits connecting to the server over a remote network connection +anywhere on the Internet. A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch. Legal values should be specified as a filename to be +used for the socket, up to two "%d" fields are allowed and will be replaced +by the userid. An empty string value disables this connection. +.LP +By default \fIvximtool\fR listens simultaneously for client connections on all +three types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + +.SH "COMMUNICATIONS PROTOCOL" + +Clients communicate with \fIvximtool\fR using a protocol developed originally +for IIS (International Imaging Systems) Frame Buffer hardware, the so-called +"IIS protocol"; other more modern protocols will likely be supported in the +future. The IIS protocol is basically a command packet stream with a header +describing the operation to be performed (select frame, load display, read +cursor, etc), and an optional data packet containing e.g. pixels. It is +beyond the scope of this document to describe fully the details of the +protocol; interested users should contact \fIiraf@noao.edu\fP for further +information. + +.SH "EXAMPLES" + +.TP 5 +1) Run the vximtool, logging output to the file named "spool": + + \f(CW% vximtool -verbose >& spool\fR +.TP 5 +2) Run the vximtool in the background, connect only on unix sockets, no output: + + \f(CW% vximtool -b -unix_only &\fR +.TP 5 +3) Don't store images in memory, start with initial 1024x1024 frame buffer: + + \f(CW% vximtool -noraster -config 3\fR +.TP 5 +4) Run the vximtool in the background, taking cursor input from a file: + + \f(CW% vximtool -i < cursor_file &\fR + +.SH SEE ALSO +ximtool(1) +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/man/xgterm.1 b/vendor/x11iraf/man/xgterm.1 new file mode 100644 index 00000000..5ed5163d --- /dev/null +++ b/vendor/x11iraf/man/xgterm.1 @@ -0,0 +1,981 @@ +.\" @(#)xgterm.1 1.1 16-Dec-96 MJF +.TH XGTERM 1 "16 Dec 1996" "X11IRAF Project" +.SH NAME +xgterm \- terminal emulator for X with graphics and imaging capability +.SH SYNOPSIS +\fBxgterm\fP [\-\fItoolkitoption\fP ...] [\-\fIoption\fP ...] +.SH DESCRIPTION +The \fIxgterm\fP program is a terminal emulator for the X Window System +based largely on \fIxterm\fP but with a completely new graphics and imaging +widget. It provides DEC VT102 and Tektronix 4014 compatible terminals for +programs that can't use the window system directly. \fIXGterm\fP also +serves as a prototype for the \fIWidget Server\fP being developed by the +IRAF Project at NOAO. The \fIObject Manager Library\fP it uses implements a +window system toolkit as an interpreted window-object language, allowing +application GUIs to be defined and executed at runtime without compiling +any code, and with minimal dependence upon the underlying window system +toolkit library. We will concentrate here, however, on it's use as a terminal +emulator and a description of the new \fIGterm\fP widget. +.PP +The Gterm graphics window operates almost identically to the \fIxterm\fP Tek +window, however there are extensions for implementing full-screen cursors, +imaging, area fills, colors, graphics erasure, a "status line" and so on. +Any graphics application capable of running under an \fIxterm\fP Tek window +should also be able to use \fIxgterm\fP as well. Client programs wishing to +make use of the extended features, or those wishing to implement a GUI, are +advised to use the OBM (\fIObject Manager\fP) library supplied with the XGterm +source as part of the X11IRAF package. This provides a much better +programmatic interface to all of the features available; however, as of +this writing it is not yet fully documented. Users are referred to the +\fIXImtool\fP task as an example of a more complex application using the +\fIOBM Library\fP and \fIGterm\fP widget, as well as demo tasks in the +\fIguidemo\fP directory of the X11IRAF sources. Questions or comments may +also be sent to \fIiraf@noao.edu\fP. +.PP +The VT102 text window is unchanged from the original \fIxterm\fR application. +All of it's resources, command-line options and operation are identical to +that used by \fIxterm\fP. The \fItermcap(5)\fP entry for \fIxterm\fP may +be used for \fIxgterm\fP as well. See the \fIxterm(1)\fP man page for details. +.SH OPTIONS +All \fIxterm(1)\fP and X Toolkit command line options are supported, there +are no additional options. +.SH RESOURCES +The program understands all of the core X Toolkit resource names and +classes, all text window resources known to \fIxterm(1)\fP, as well as +the \fIGterm\fP (graphics and imaging widget) resources. The proper Class +name for all resources described here is \fIGterm\fP. A table of +available \fIGterm\fP resources and their defaults may be found below, +some of the more interesting resources are described here in detail: +.TP 5 +\fIbasePixel\fP +Base cell of the custom colormap. This essentially allows you +to reserve \fIbasePixel\fP colors in the global colormap for other +applications. The default is 38, if changed you'll need to also enable +the \fIcmapInitialize\fP resource to force the Gterm widget to +update it's global colormap resource in the X server. +.TP 5 +\fIcmapInitialize\fP +Initialize the ximtool colormap at startup. When resetting the \fIbasePixel\fP +resource or colormap this is required in order to force the Gterm widget to +update it's global colormap resource in the X server. The default is False. +.TP 5 +\fIcmapInterpolate\fP +Interpolate the colormap to the number of display colors. The default is +True. +.TP 5 +\fIcmapName\fP +Name used for private colormap. The default for all IRAF imaging +applications is \fIimage\fP. Gterm widget based imaging applications +which have the same value of cmapName will share the same colormap, +minimizing colormap flashing and allowing multiple applications to be +run at the same time. +.TP 5 +\fIcolor0\fP +The widget background color. The default is black. +.TP 5 +\fIcolor1\fP +The widget foreground color. The default is white. +.TP 5 +\fIcolor2\fP thru \fIcolor9\fP +Optional drawing colors. The line color used for graphics is set using +an escape sequence to select the current color index. See \fIGterm I/O +Escape Sequences\fP below for more details. +.TP 5 +\fIcrosshairCursorColor\fP +Color of the full screen crosshair cursor. +.TP 5 +\fIdefaultMarker\fP +Default marker type. Options include \fItext\fP, \fIline\fP, \fIpolyline\fP, +\fIrectangle\fP, \fIbox\fP, \fIcircle\fP, \fIellipse\fP, and \fIpolygon\fP. +The default is \fIrectangle\fP. +.TP 5 +\fIdeiconifyWindow\fP +De-iconify the Gterm graphics window when activated. The default is False. +.TP 5 +\fIdialogBgColor\fP +Dialog box (i.e. the status line) background color. Dialog text is text which +is drawn into the dialog area at the bottom of the gterm window, it is +transient and is not a permanent part of the graphics being drawn. Dialog +text is normally used to interact with the user or to display messages +during program operation, without affecting the graphics being drawn. +.TP 5 +\fIdialogFgColor\fP +Dialog box (i.e. status line) foreground color. +.TP 5 +\fIginmodeBlinkInterval\fP +Graphics cursor blink interval, time is specified in milliseconds. The +default is 0. +.TP 5 +\fIginmodeCursor\fP +Graphics mode cursor type. The default is a full screen cursor custom to +the widget. +.TP 5 +\fIheight\fP +Height of the Gterm window. The default is 480. +.TP 5 +\fIidleCursor\fP +Cursor to use when not in graphics mode. The default is a plus sign. +.TP 5 +\fImarkerHighlightColor\fP +Highlight color for the active marker. When the pointer moves into a marker +is it marked "active", the highlight color and width change to which marker +is active. The default is green. +.TP 5 +\fImarkerHighlightWidth\fP +Highlight width for the active marker. The default is 2. +.TP 5 +\fImaxColors\fP +The maximum number of colors to use in the private global colormap, the +default is 216. Out of this number 10 colors (the \fIcolor0\fP thru +\fIcolor9\fP values) are reserved by the widget as static colors, the +remainder may be allocated for images. +.TP 5 +\fIraiseWindow\fP +Raise the window when active. The default is False. +.TP 5 +\fIwarpCursor\fP +Warp the cursor to the window when active. The default is False. +.TP 5 +\fIwidth\fP +Width of the Gterm window. The default is 640. + +.SH "GTERM WIDGET RESOURCES" + +.SS "Class Hierarchy" +.PP +\fBCore -> Gterm\fP +.SS "Resources" +.PP +When creating a Gterm widget instance, the following resources are retrieved +from the arguments list or from the resource database: + +.TS +center; +lB lB lB lB +l l l l. +Name Class Type Default Description += +alphaFont1 XFontStruct nil2 Graphics fonts +alphaFont2 XFontStruct 5x8 " +alphaFont3 XFontStruct 6x10 " +alphaFont4 XFontStruct 7x13 " +alphaFont5 XFontStruct 8x13 " +alphaFont6 XFontStruct 9x15 " +alphaFont7 XFontStruct 9x15 " +alphaFont8 XFontStruct 9x15 " +basePixel Int 38 Base of private global colormap +busyCursor String watch Cursor to use when application is busy +busyCursorBgColor Foreground white Busy cursor background color +busyCursorFgColor Foreground black Busy cursor foreground color +cacheRasters String whenNeeded Save rasters as server pixmaps for faster access +cmapInitialize Boolean False Initialize colormap at startup +cmapInterpolate Boolean True Interpolate colormap +cmapName String default Custom colormap name +cmapShadow Int 10 Colormap shadow interval +cmapUpdate Int 60 Colormap update interval +color0 Background black Default graphics background color +color1 Foreground white Default graphics foreground color +color2 Foreground red Optional drawing color +color3 Foreground green " +color4 Foreground blue " +color5 Foreground cyan " +color6 Foreground yellow " +color7 Foreground magenta " +color8 Foreground purple " +color9 Foreground darkslategray " +copyOnResize Boolean True Copy raster when resized +crosshairCursorColor Foreground red Full-screen cursor color +defaultMarker String rectangle Default marker type +deiconifyWindow Boolean False Deiconify window when active +dialogBgColor Foreground yellow Status line background color +dialogFgColor Foreground black Status line foreground color +dialogFont1 XFontStruct nil2 Status line fonts +dialogFont2 XFontStruct 5x8 " +dialogFont3 XFontStruct 6x10 " +dialogFont4 XFontStruct 7x13 " +dialogFont5 XFontStruct 8x13 " +dialogFont6 XFontStruct 9x15 " +dialogFont7 XFontStruct 9x15 " +dialogFont8 XFontStruct 9x15 " +ginmodeBlinkInterval Int 0 Graphics cursor blink interval +ginmodeCursor String full_crosshair Graphics cursor type +ginmodeCursorBgColor Foreground black Graphics cursor background color +ginmodeCursorFgColor Foreground white Graphics cursor foreground color +height Dimension 480 Height of graphics window +idleCursor String Plus Idle cursor type +idleCursorBgColor Foreground white Idle cursor background color +idleCursorFgColor Foreground black Idle cursor foreground color +markerBoxKnotColor Foreground blue Vertex knot color +markerBoxKnotSize Int 0 Vertex knot size +markerBoxLineColor Foreground green Marker border color +markerCircleKnotColor Foreground blue Vertex knot color +markerCircleKnotSize Int 0 Vertex knot size +markerCircleLineColor Foreground green Marker border color +markerCursorBgColor Foreground black Cursor background when in marker +markerCursorFgColor Foreground yellow Cursor foreground when in marker +markerEllipseKnotColor Foreground blue Vertex knot color +markerEllipseKnotSize Int 0 Vertex knot size +markerEllipseLineColor Foreground green Marker border color +markerFill Boolean False Flood fill marker area with \fImarkerFillColor\fP +markerFillBgColor Foreground black Fill area background color +markerFillColor Foreground slategray Flood fill color +markerFillStyle Int FillSolid Fill area style +markerHighlightColor Foreground green Marker highlight color +markerHighlightWidth Int 2 Marker highlight line width +markerLineKnotColor Foreground blue Vertex knot color +markerLineKnotSize Int 5 Vertex knot size +markerLineLineColor Foreground green Line marker color +markerLineStyle Int LineSolid Line marker line style +markerLineWidth Int 1 Line marker width +markerPgonKnotColor Foreground blue Vertex knot color +markerPgonKnotSize Int 5 Vertex knot size +markerPgonLineColor Foreground green Marker border color +markerRectKnotColor Foreground blue Vertex knot color +markerRectKnotSize Int 0 Vertex knot size +markerRectLineColor Foreground green Marker border color +markerTextBgColor Foreground slategray Text marker background color +markerTextBorder Int 2 Text marker border width +markerTextColor Foreground yellow Text marker text color +markerTextFont XFontStruct 6x13 Text marker font +markerTextLineColor Foreground green Text marker line color +markerTextString String NULL Text string +markerTranslations String default Marker event-to-actions translations +maxColors Int 216 Max colors in custom colormap +maxMappings Int 32 Max image mappings +maxRasters Int 512 Max image rasters +nearEdge Int 1 T{ +Distance, in pixels, between pointer and marker edge required +for translation actions for be in effect. +T} +nearVertex Int 4 T{ +Distance, in pixels between pointer and marker vertex (i.e. \fIknot\fP) +required for translation actions for be in effect. +T} +raiseWindow Boolean False Raise window when active +translations String default Event-to-actions translations +useTimers Boolean True Ok to use timers +warpCursor Boolean False Enable warp cursor when active +width Dimension 640 Height of graphics window +xorFill Boolean False Fill with GXxor +xorFillBgColor Int 255 Xor-fill background color +xorFillColor Int 2 Xor-fill color +.TE + +.SH "GTERM WIDGET TRANSLATIONS AND ACTIONS" + +.LP +The default translations for a Gterm window are: +.TS +center; +r l. +<Btn1Down>: m_create() +<Btn2Down>: crosshair(on) +<Btn2Motion>: crosshair(on) +<Btn2Up>: crosshair(off) +<EnterWindow>: enter-window() +<LeaveWindow>: leave-window() +<KeyPress>: graphics-input() +<Motion>: track-cursor() +.TE +.LP +The available action procedures for a Gterm window are: +.RS +.TP 20 +\fIignore()\fP +Ignore an event. +.TP 20 +\fIgraphics-input()\fP +Handle a graphics input request. +.TP 20 +\fIcrosshair(on|off)\fP +Display a crosshair cursor. +.TP 20 +\fItrack-cursor()\fP +Track crosshair cursor position. +.TP 20 +\fIenter-window()\fP +Handle an EnterWindow event. +.TP 20 +\fIleave-window()\fP +Handle an LeaveWindow event. +.TP 20 +\fIreset()\fP +Do a soft reset of the Gterm widget. +.TP 20 +\fIm_create()\fP +Create a new marker. Valid types include +.TS +center; +l l l l. +\fItext line polyline rectangle +box circle ellipse polygon\fP +.TE +The default is \fIrectangle\fP, if no type is given the default type +specified by the \fImarkerType\fP resource will be used. +.RE + +.SH "GTERM MARKER TRANSLATIONS AND ACTIONS" + +.LP +The default translations for a marker are: + +.TS +center; +r l. +!Shift <Btn1Motion>: m_rotateResize() +<Btn1Motion>: m_moveResize() +!Shift <Btn1Down>: m_raise() m_markpos() +<Btn1Down>: m_raise() m_markposAdd() +<Btn1Up>: m_redraw() m_destroyNull() +<Btn2Down>: m_lower() +<Key>BackSpace: m_deleteDestroy() +<Key>Delete: m_deleteDestroy() +<KeyPress>: m_input() +<Motion>: track-cursor() +.TE + +Translations affect only the currently active marker, the cursor must be +within \fInearEdge\fP pixels of a marker edge, or \fInearVertex\fP pixels +of a marker vertex to take effect. + +The available action procedures for a marker are +.RS +.TP 18 +\fIm_create(type)\fP +Create a new marker. Valid types include +.TS +center; +l l l l. +\fItext line polyline rectangle +box circle ellipse polygon\fP +.TE +The default is \fIrectangle\fP, if no type is given the default type +specified by the \fImarkerType\fP resource will be used. +.TP 18 +\fIm_destroy()\fP +Destroy the active marker. +.TP 18 +\fIm_destroyNull()\fP +Destroy the active marker if it is null sized. +.TP 18 +\fIm_set(attribute, value, ....)\fP +Set a marker attribute. Valid attributes include + +.TS +center; +l l l l. +\fIactivated autoRedraw fill fillBgColor +fillColor fillPattern fillStyle font +height highlightColor imageText knotColor +knotSize lineColor lineStyle lineWidth +rotangle sensitive textBgColor textBorder +textColor translations type visible +width x y \fP +.TE +.TP 18 +\fIm_raise()\fP +Raise the active marker to the top of the display list. +.TP 18 +\fIm_lower()\fP +Lower the active marker to the bottom of the display list. +.TP 18 +\fIm_notify(event, event, ....)\fP +Notify any clients that have registered callbacks for the specified type +of events. Recognized events include +.TS +center; +l l l. +\fInotify \fImoveResize \fImodify +\fIredraw \fIdestroy \fIinput +\fIfocusIn \fIfocusOut \fIconstraint\fP +.TE +.TP 18 +\fIm_input()\fP +Notify any clients that have registered a input callback that a input event +has occurred. +.TP 18 +\fIm_markpos()\fP +Mark the current position of the marker, e.g., so that it can later be erased. +.TP 18 +\fIm_markposAdd()\fP +Execute either the markpos or add action, depending upon +the pointer location. If the pointer is over an active marker at a +location where the add action can be executed this is done, otherwise the +markpos action is executed. +.TP 18 +\fIm_redraw()\fP +Redraw the active marker. +.TP 18 +\fIm_addPt()\fP +Add a point (i.e. vertex knot). \fIPolyline\fP and \fIpolygon\fP markers only. +.TP 18 +\fIm_deletePt()\fP +Delete a point (i.e. vertex knot). +.TP 18 +\fIm_movePt()\fP +Move a point (i.e. vertex knot). \fIPolyline\fP and \fIpolygon\fP markers only. +.TP 18 +\fIm_deleteDestroy()\fP +Delete a point or destroy a marker, depending upon the pointer position. +.TP 18 +\fIm_move()\fP +Move a marker. +.TP 18 +\fIm_resize()\fP +Resize a marker. +.TP 18 +\fIm_moveResize()\fP +Move a point or marker, or resize a marker, depending upon the pointer +position. +.TP 18 +\fIm_rotate()\fP +Rotate a marker. +.TP 18 +\fIm_rotateResize()\fP +Rotate or resize a marker. A marker is rotated if near a vertex know, or +resized if near an edge. +.RE + +.SH "GTERM I/O ESCAPE SEQUENCES" +XGterm uses escape sequences to provide graphics emulation. +This protocol is an extension of the Tektronix 4012 graphics protocol. +The basic extensions are patterned after the Retrographics VT640 graphics +terminal, using GS (octal \\035, aka Ctrl-]) and CAN (octal \\030, aka +Ctrl-x) to switch between vt100 and graphics modes. +Additional extensions are defined to support advanced features such as +color, area fills, graphics erasure, setting the cursor location under +program control, interactive dialog via the "status line", and so on. + +While these escape sequences can be used directly, the best programmatic +interface is to use the OBM (\fIObject Manager\fP) library supplied with +the XGterm source as part of the X11IRAF package. Any Tektronix-compatible +graphics library will suffice for producing vector graphics, the added +escape sequences used by the Gterm widget are required to make use of +imaging, area fills, the status line, etc. + +All escape sequences begin with an \fBESC\fP character (octal \\033), followed +by up to three characters defining the action to be taken. All strings in +capital letters refer to the ASCII code (e.g. \fILF\fP is the ASCII linefeed +code), a three digit number preceeded by a '\' refers to an octal code (e.g. +"\012" is octal 12) , all others are characters in the escape code (e.g. +"/bc" are the three characters '/', 'b', and 'c'). + +.SS "ESCAPE SEQUENCES" + +.RS +.TP 15 +\fBUS\fP +.sp -0.5 +.TP 15 +\fBCR\fP +Switch to alpha mode. Characters are drawn in the graphics window at the +"current" position (normally set beforehand with a GS/US vector move), +using the alpha mode font. Receipt of any control code causes alpha mode to be +exited. + +.TP 15 +\fBGS\fP +Switch to vector polyline mode. +.sp -0.5 +.TP 15 +\fBFS\fP +Switch to vector polypoint mode. +.sp -0.5 +.TP 15 +\fBRS\fP +Switch to vector mode, vertices are joined as a polygon. + +With all three codes, vertices and points are accumulated in a buffer and +displayed when the buffer fills or when vector mode is terminated by receipt +of any control code. A workstation open will be done if it hasn't already +been opened, no-op sequences GS-CAN are filtered out, since they would only +cause a pointless switch to the graphics frame and back without drawing. +The open workstation sequence is GS,US, or by the \fIxterm\fP graphics start +escape sequence "[?38h". + +.TP 15 +\fBEM\fP +Enter message mode. In message mode input text is accumulated in a buffer +and eventually passed to the object manager, which delivers the message to +the referenced object. Messages are used to download the user interface to +be executed by the object manager. During execution, messages are used +to set the values of user interface parameters to allow the UI to track +the state of the client application. + +.TP 15 +\fBCAN\fP +Close workstation and enter command mode. +.TP 15 +\fBBEL\fP +Ring the screen bell. + +.TP 15 +\fBENQ\fP +Return terminal status. Returned values include the terminal mode, and alpha +cursor x and y position. +.TP 15 +\fBSUB\fP +Initiate a cursor read, values are returned in window coordinates. +.TP 15 +\fB/SUB\fP +Return window cursor position in raster coordinates. +.TP 15 +\fBFF\fP +Clear the screen. +.TP 15 +\fB/f\fP +Set current cursor position. +.TP 15 +\fB0\fP +Set character size 0. (Currently ignored). +.sp -0.5 +.TP 15 +\fB1\fP +Set character size 1. (Currently ignored). +.sp -0.5 +.TP 15 +\fB2\fP +Set character size 2. (Currently ignored). +.sp -0.5 +.TP 15 +\fB3\fP +Set character size 3. (Currently ignored). +.TP 15 +\fB/0d\fP +Set color index. +.sp -0.5 +.TP 15 +\fB/1d\fP +Clear graphics screen. +.sp -0.5 +.TP 15 +\fB/2d\fP +Invert graphics screen +.TP 15 +\fB`\fP +Select line style 0. (Solid) +.sp -0.5 +.TP 15 +\fBa\fP +Select line style 1. (Dashed) +.sp -0.5 +.TP 15 +\fBb\fP +Select line style 2. (Dotted) +.sp -0.5 +.TP 15 +\fBc\fP +Select line style 3. (DashDot) +.sp -0.5 +.TP 15 +\fBd\fP +Select line style 4. (Dash3Dot) +.TP 15 +\fB/0w\fP +Select line width 0. +.sp -0.5 +.TP 15 +\fB/1w\fP +Select line width 1. +.sp -0.5 +.TP 15 +\fB/2w\fP +Select line width 2. +.sp -0.5 +.TP 15 +\fB/nw\fP +Select line width 3. +.TP 15 +\fB/0c\fP +Select line color 0. +.sp -0.5 +.TP 15 +\fB/1c\fP +Select line color 1. +.sp -0.5 +.TP 15 +\fB/2c\fP +Select line color 2. +.sp -0.5 +.TP 15 +\fB/3c\fP +Select line color 3. +.sp -0.5 +.TP 15 +\fB/4c\fP +Select line color 4. +.sp -0.5 +.TP 15 +\fB/5c\fP +Select line color 5. +.sp -0.5 +.TP 15 +\fB/6c\fP +Select line color 6. +.sp -0.5 +.TP 15 +\fB/7c\fP +Select line color 7. +.sp -0.5 +.TP 15 +\fB/8c\fP +Select line color 8. +.sp -0.5 +.TP 15 +\fB/9c\fP +Select line color 9. +.RE + +.SS "IMAGING ESCAPE SEQUENCES" + +These are encoded as follows: + + \fBESC\fP <code> [ \fIP ; P\fP ; ... ] <\fIdata\fP> + +where \fIcode\fR is a character sequence and \fIP\fP is an ASCII encoded +parameter described below. +.RS +.TP 15 +\fB/nc\fP +Select line color. Parameter is the color number in the range 0-9. +.TP 15 +\fBsre\fP +\fIReset\fP. Parameters are "reset-str". +.TP 15 +\fBssz\fP +\fIResize\fP. Parameters are "resize-str". +.TP 15 +\fBrir\fP +\fIInitialize raster\fP. +.TP 15 +\fBrcr\fP +\fICreate a raster\fP. Parameters are raster number, type, width, height, and +depth. Type is 1 for a normal (client) raster, 2 for cached in server memory, +or 0 if you don't care. Depth may be 1, 8, 16, or 32. +.TP 15 +\fBrde\fP +\fIDestroy a raster\fP. Parameter is raster number. +.TP 15 +\fBrqr\fP +\fIQuery a raster\fP. Parameter is raster number. +Output parameters are status, type, width, height, and depth encoded in the +string ""\\033[5;%d;%d;%d;%d;%d]". +.TP 15 +\fBrsr\fP +\fISelect a raster\fP. Parameter is raster number. +.TP 15 +\fBrwr\fP +\fIWrite pixels to a rectangular region of a raster\fP. Parameters are raster +number, encoding type (not used), x1, y1, nx, ny, and depth followed by +(nx*ny) data pixels. +.TP 15 +\fBrrd\fP +\fIRead from a rectangular region of a raster\fP. Parameters are raster +number, encoding type (not used), x1, y1, nx, ny, and depth followed by (nx*ny) +data pixels. +.TP 15 +\fBrrp\fP +\fIRefresh raster pixels\fP. Parameters are raster number, coordinate type (0 +for pixel, 1 for NDC), x1, y1, nx, ny. +.TP 15 +\fBrsp\fP +\fISet all the raster pixels in a region to a single color\fP. Parameters are +raster number, coordinate type (0 for pixel, 1 for NDC), x1, y1, nx, ny, +color, and raster operand. If nx=ny=0 the entire raster will be written. +Raster operands include transient (octal 020), refresh_all (octal 040), +or refresh_none (octal 100). +.TP 15 +\fBrco\fP +\fICopy a region of the source raster to a region of the +destination raster\fP. Parameters are raster operand, source raster number, +source type, source x coord, source y coord, source width, source height, +destination raster number, destination type, destination x coord, destination +y coord, destination width, destination height, If the input and output +regions are not the same size the subimage is automatically scaled to fit +the destination region. If the destination extent DNX or DNY is negative, +the image is flipped in that axis. The type of spatial scaling performed is +determined by the scale factors (zoom, dezoom, or no scaling). The rasterop +argument is used to exercise fine control over how the mapping is performed, +e.g. to force a refresh, implement a transient mapping, or in the case of a +dezoom (many-to-one) mapping, select the antialiasing technique to be used. +.TP 15 +\fBrwc\fP +\fIWrite a colormap\fP. Parameters are colormap number, first color and the +number of colors followed by NC colors triples in the data. +.TP 15 +\fBrrc\fP +\fIReturn the color assignments for a region of the named colormap\fP. +Parameters are colormap number, first color and the number of colors followed +by NC colors triples in the data. +.TP 15 +\fBrlc\fP +\fILoad a colormap into the display\fP, optionally scaling the colormap via a +linear transformation in the process. Parameters are the colormap number, the +offset value, and the cursor x and Y coordinates in NDC units. The colormap is +unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. +If map=0 the linear transformation is applied directly to the display colormap. +.TP 15 +\fBrfc\fP +\fIFree a colormap\fP. Parameter is the colormap number. +.TP 15 +\fBrwo\fP +\fIWrite the IOmap\fP. Parameters are the first color and the number of colors, +followed by NC color triples in the data. An iomap is an optional lookup +table used to isolate the client application from the color model used within +the Gterm widget. To simplify color allocation the Gterm widget defines a +logical color space where color 0 is the background, 1 the foreground, 2-N are +statically allocated standard colors, and colors N+1 and above are dynamically +allocated by the graphics application. Less-demanding applications use +only the statically allocated, shared colors. The widget internally maps +these logical colors to whatever the window system requires, but providing +a well-defined logical color space isolates the client from the details of +color allocation in the underlying window system. + +An iomap can be used to define a mapping between the color model of the +client application and the Gterm color model (when we say color model here +we mean color allocation schemes for 8 bit pseudocolor). By default the +iomap is one-to-one. The use of an iomap frees the client from having to +worry about color index translations, and allows color tables to be +combined in the widget for greater efficiency when color tables are serially +applied. The iomap applies to all color indices or pixel values passed +in i/o operations between the client and the Gterm widget. +.TP 15 +\fBrro\fP +\fIRead the IOmap\fP. Return values are the first color and the number of +colors, followed by NC color triples in the data. +.TP 15 +\fBrim\fP +\fIDelete all mappings\fP and initialize the mapping subsystem. +.TP 15 +\fBrsm\fP +\fIDefine a new mapping function\fP, or modify an old one. +If a new mapping is defined it is merely enabled, and no refreshing +of the screen takes place until either some mapped data is written +to or the mapping is explicitly refreshed. If an existing mapping is +modified the old and new mappings are examined and only those portions +of the destination rect for which the mapping changed are updated. +This permits minor changes to a mapping (e.g. moving an edge) without +having to redraw the entire region. Regions of the destination drawable +which were previously covered by the mapping but which were exposed by +modifying the mapping are redrawn. +.TP 15 +\fBrgm\fP +\fIReturn the external parameters of a mapping\fP. Parameter is the mapping +number, values returned (in the string +"\\033[6;%d;%d %d;%d;%d;%d;%d;%d %d;%d;%d;%d;%d;%d]") are the mapping +number, rasterop, source mapping, type, x, y, width, height, and destination +mapping, type, x, y, width and height. +.TP 15 +\fBrem\fP +\fIEnable a mapping\fP. Parameters are the mapping number and an integer +flag indicating whether to refresh the mapping. +.TP 15 +\fBrdm\fP +\fIDisable a mapping\fP. Disabling a mapping does not +affect the mapping definition, hence a disabled mapping may later be +reenabled. Parameters are the mapping number and an integer flag indicating +whether to erase the mapping. +.TP 15 +\fBrrm\fP +\fIRefresh a mapping\fP. Parameter is the mapping number. +.TP 15 +\fBrfm\fP +\fIFree a mapping\fP. Parameter is the mapping number. +.RE + +.SH "MORE ON IMAGING" +The imaging model of the Gterm widget defines the following key object or +data types: \fIrasters\fP, \fImappings\fP, and \fIcolors\fP. +.TP 10 +.B "raster" +A raster is a MxN array of pixels. At present pixels are 8 bits deep but +hooks are built into the widget to expand this in the future. Pixel +values are indices into the Gterm virtual colormap, with values starting at +zero. A raster may be any size. A raster is merely a two-dimensional array +in the graphics server; it is not displayed unless mapped. An exception is +raster zero, which is the graphics window. Rasters are referred to by number, +starting with zero. Initially only raster zero exists; new rasters are created +with the create raster escape code \fBrcr\fP. Space for rasters may be +allocated either in the graphics server, or in the X server. This has +implications on performance but is otherwise transparent to the client. +By default rasters are allocated in the graphics server, i.e., in the X client. +.TP 10 +.B "mapping" +A mapping defines a projection of a rectangle of the source raster onto a +rectangle of the destination raster. Mappings may be either enabled (active) +or disabled. When a mapping is enabled, any change to a pixel in the source +rect will cause the corresponding pixels in the destination rect to be +updated. Mappings are referred to by number starting with one. Initially +no mappings are defined. If the size of the input and output rect is not +the same the input rect will be scaled by pixel replication or subsampling +to fill the output rect. If the argument DW (destination width) or DH +(destination height) of the destination rect is negative, the image will be +flipped around the corresponding axis when copied to the destination; the +region of the destination drawn into is the same in either case. Multiple +mappings may reference the same source or destination raster. Mappings are +refreshed in order by the mapping number. Modifying a mapping causes the +changed regions of the destination rect to be refreshed. +.TP 10 +.B "color" +The \fIGterm\fP widget provides a fixed number of preassigned colors +corresponding to pixel values 0 through 9. Zero is the background color, +one is the foreground color, and 2-9 (8 colors) are arbitrary colors defined +by Gterm widget resources. These static colors are normally used to draw +the background, frame, axes, titles, etc. of a plot, or to draw color +graphics within the drawing area. The advantage of static colors is that +they are shared with other X clients, and the values of these colors may be +assigned by the user to personalize the way plots look. + +The \fIGterm\fP widget also allows any number (up to about 200 or so) additional +colors to be defined at runtime by the client application. These color +values start at pixel value 10 and go up to the maximum pixel value assigned +by the client. The client application allocates colors with the +write colormap escape code \fBrwc\fP. Attempts to overwrite the values of +the static colors are ignored. The values of already allocated colors may +be changed dynamically at runtime using write colormap code to write the +desired range of color values. + +Applications should not assume that there are 10 static colors and 200 or +so allocatable colors. The IRAF graphcap entry for the logical device in use, +and resources set for the widget, +defines these parameters for the device. Alternatively, the read colormap +code may be used to dynamically determine how many colors the server has +preallocated when the application starts up. + +An image may use either static and dynamic pixel values or both types of +values, but in most cases imaging applications involve smoothly shaded +surfaces hence will require dynamically assigned private colors. + +If for some reason the client application cannot use the \fIGterm\fP widget +color model, the IOMAP feature can be used to make the widget appear to have +some externally defined (i.e., client defined) color model. +.LP +The maximum number of rasters and maximum number of mappings is defined by +the Gterm widget resources \fImaxRaster\fP and \fImaxMappings\fP (or in the +GUI file) when the graphics application starts up. The maximum values should +be much larger than most applications require. Applications should allocate +raster or mapping numbers sequentially starting at 1 (more or less) to avoid +running out of raster or mapping descriptors. + +The {read|write}pixels escape codes operate directly on +raster pixels. The mapping escape codes support two alternative coordinate +systems, raster pixels and NDC (normalized device coordinates), as indicated +by the ST or DT argument (source or destination coordinate type). Note +that the origin of the pixel coordinate system is the upper left corner of +the display window (consistent with most graphics systems), whereas the origin +of the NDC coordinate system is the lower left corner (consistent with IRAF). + +Pixel coordinates allow precise control of imaging but require the +application to know the window size, and may result in complications e.g. if +the window is resized. NDC coordinates pretty much guarantee that a mapping +will involve sampling, hence are not the most efficient, but the graphics +will be drawn correctly no matter how the window is resized and for most +applications the performance difference is negligible. Most applications +should use NDC coordinates for raster 0 (the display window), and pixel +coordinates for rasters 1-N. + +Although the size of rasters 1 and higher are defined by the client +application, the size of raster zero, the actual gterm display window, is +subject to the constraints of the window system. The client can attempt to +reset the size of the gterm window using create raster escape with raster=0, +however the Gterm widget, UI containing the \fIGterm\fP widget, and the window +manager are all free to deny such a request. The query raster escape should be +called to determine the actual size of the window one will be drawing into. + +.SS AN EXAMPLE IMAGING APPLICATION + +.LP +An example of a simple imaging application might be one that downloads an +image and displays it in the gterm window, filling the window. This could +be done as follows (following a graphics open and other escape codes to +prepare the drawing surface). + +.TP 15 +\fIcreate raster\fP +Create raster 1 the size of the pixel array to be displayed. This need not +be the same as the size of the gterm display window. +.TP 15 +\fIset mapping\fP +Define a mapping between raster 1 and raster 0, the display window, using +NDC coordinates to define the region of the display window to be +filled. The mapping number is arbitrary but mappings should normally be +allocated starting with 1. The mapping is automatically enabled +when first defined. +.TP 15 +\fIwrite colormap\fP +(Optional). Define the pixel value to RGB color assignments for the image +pixels. +.TP 15 +\fIwrite pixels\fP +This escape is called one or more times to write pixels into raster 1. +At most 32K pixels can be written in each call. As each write is +made the affected region of the display window will be updated. +.LP +Alternatively, one could write the pixels and then define the mapping to +cause the entire image to be displayed at once. + +Note that the imaging escape can be combined with normal graphics to draw text +and graphics around or on top of an image region. The order in which drawing +operations occur is important, e.g., to draw graphics or text on top of an +image the image should be drawn first. + +.SH "MARKERS" +Markers are a general feature of the \fIGterm\fP widget and are used more +extensively in other programs (e.g. the prototype IRAF science GUI +applications), but they have no real use in \fIxgterm\fP when used as +simply a graphics terminal. All markers share some of the same characteristics, +so it is worthwhile learning basic marker manipulation keystrokes (as defined +using the default marker translations), especially how to delete an +accidentally created marker: +.RS +.TP 3 +\fBo\fP +\fIDelete\fP or \fIBackspace\fP in a marker deletes it. +.TP 3 +\fBo\fP +MB1 anywhere inside a marker may be used to drag the marker. +.TP 3 +\fBo\fP +MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +.TP 3 +\fBo\fP +Shift-MB1 on the corner of most markers will rotate the marker. +.TP 3 +\fBo\fP +Markers stack, if you have several markers and you put one on top of +the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +.TP 3 +\fBo\fP +MB2 in the body of a marker "lowers" the marker, i.e. moves it to the +bottom of the stacking order. +.RE + +.SH ENVIRONMENT +.I XGterm +sets the environment variables ``TERM'' and ``TERMCAP'' properly for the +size window you have created. +It also uses and sets the environment +variable ``DISPLAY'' to specify which bit map display terminal to use. +The environment variable ``WINDOWID'' is set to the X window id number +of the \fIxgterm\fP window. + +.SH "SEE ALSO" +xterm(1), resize(1), X(1), pty(4), tty(4) +.br +\fIXterm Control Sequences\fP (in the \fIxterm\fP source directory) + +.SH BUGS +Many of the same bugs affecting \fIxterm\fP also apply here. + +\fIXgterm\fP is not normally installed with setuid permissions. On some +Linux systems, for example, where the /dev/tty and /dev/pty devices have +root ownership and permission 600 this can cause problems. Workarounds +are to either install \fIXGterm\fP with setuid permissions or modify the +/dev/tty and /dev/pty devices to have permission 666. + +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + diff --git a/vendor/x11iraf/man/ximtool.1 b/vendor/x11iraf/man/ximtool.1 new file mode 100644 index 00000000..2ca62eaf --- /dev/null +++ b/vendor/x11iraf/man/ximtool.1 @@ -0,0 +1,2338 @@ +.\" @(#)ximtool.1 1.1 12-Aug-2001 MJF +.TH XIMTOOL 1 "12 Aug 2001" "X11IRAF Project" +.SH NAME +ximtool \- interactive image display program for the X Window System +.sp 0.5 +.SH SYNOPSIS +.B "ximtool" [\-\fItoolkitoption\fP ...] [ \fIoptions\fP ...] [\fIimagename\fP] +.sp 0.5 +.SH OPTIONS +.TP 5 +.B "-basePixel \fIN\fP" +The base colormap cell used by the colormap. This essentially allows you +to reserve \fIbasePixel\fP colors in the global colormap for other applications. +The default is 64, if changed you'll need to also specify the +\fI-cmapInitialize\fP option or resource. +.TP 5 +.B "-cmap1 \fIfile\fP" +User colormap 1. This flag allows you to specify a colormap to be made +available at task startup. +.TP 5 +.B "-cmap2 \fIfile\fP" +User colormap 2. This flag allows you to specify a second colormap to be +made available at task startup. +.TP 5 +.B "-cmapDir1 \fIdir\fP" +User colormap directory 1. Specifies a directory to be searched for colormaps. +.TP 5 +.B "-cmapDir2 \fIdir\fP" +User colormap directory 2. Specifies a directory to be searched for colormaps. +By default this points to the system directory /usr/local/lib/imtoolcmap, +allowing a set of site default colormaps to be defined here. +.TP 5 +.B "-cmapInitialize \fIbool\fP" +Initialize the ximtool colormap at startup. When setting the \fIbasePixel\fP +option or resource this is required in order to force the Gterm widget to +update its global colormap resource in the X server. The default is +\fIfalse\fP. +.TP 5 +.B "-cmapName \fIname\fP" +Name used for private colormap. The default for all IRAF imaging +applications is \fIimage\fP. Gterm widget based imaging applications +which have the same value of cmapName will share the same colormap, +minimizing colormap flashing and allowing multiple applications to be +run at the same time. +.TP 5 +.B "-config \fIN\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-defgui" +Print the default GUI to the stdout. The GUI is a Tcl program that may be +customized by the user and reloaded using the \fI-gui\fP option or +the \fIgui\fP resource parameter. +.TP 5 +.B "-displayPanner \fIbool\fP" +Display panner marker window at startup. If set, a panner window showing +the full frame buffer will appear in the upper-right side of the main display +window. +.TP 5 +.B "-displayCoords \fIbool\fP" +Display WCS coordinate marker window at startup. If set, a coordinate +readout text marker showing will appear in the lower-right side of the main +display window. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-gui \fIfile\fP" +Specifies the GUI file to be used. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-invert" +Start XImtool using inverted colormaps. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 5 +.B "-ismdev \fIdev\fP" +Specifies the plug-in ISM connection socket. This should be a unix domain +socket of the form "\fI/tmp/.ISM%d\fP", where the \fI%d\fP will be replaced +by the user id. Once an ISM has connected this port is freed to accept +other connections. +.TP 5 +.B "-maxColors \fIN\fP" +Specify the max number of colors to be used for the display. +.TP 5 +.B "-memModel \fItype\fP" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are \fIfast\fP, \fIbeNiceToServer\fP, and \fIsmall\fP. The +default is \fIfast\fP, which uses server pixmaps to make frame blink fast. +This is recommended unless server memory is very limited. Note that even in +fast mode, the server pixmap is only the size of the display window, so memory +usage is reasonable even if the frame buffer is very large. +.TP 5 +.B "-nframes \fIN\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port \fIN\fP" +Specifies the port number to use when connecting through an inet socket. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-printConfig \fIname\fP" +Specifies the printer configuration file to use. By default this will be +/usr/local/lib/ximprint.cfg. See below for more information on configuring +output devices. +.TP 5 +.B "-tile" +The default display mode is to view one frame at a time. In tile frames mode, +2 or 4 frames may be viewed simultaneously in the display window. All the +usual operations (zoom and pan, colortable enhancement, cursor readback, etc.) +still work for each frame even when in tile frames mode. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "APPLICATION RESOURCES" +XImtool is implemented as a client program which is responsible for loading +the frame buffers/colormaps, communicating with clients, etc, and a +user-modifiable GUI file written as a Tcl script which handles all the user +interface details. The \fIclient resources\fP described below will be common +to any user-defined GUI, the \fIgui resources\fP may change depending on how +extensively the GUI has been modified by the user. Each of these components +has its own set of resources, but to the user setting them is the same as +with any other application. + +\fIGterm\fP widget resources (i.e. those for the main image window or +colorbar) may be set as either client or GUI resources. See the +\fIxgterm(1)\fP man page for a complete description of \fIGterm\fP widget +resources. + +.SS "CLIENT RESOURCES" +The client resources generally define the initial state of the application +or set configuration parameters. +.RS +.TP 25 +.B "Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 25 +defConfig +1 +.sp -0.5 +.TP 25 +defNFrames +0 +.sp -0.5 +.TP 25 +tileBorderWidth +3 +.sp -0.5 +.TP 25 +tileBorderColor +9 +.sp -0.5 +.TP 25 +autoscale +false +.sp -0.5 +.TP 25 +antialias +false +.sp -0.5 +.TP 25 +antialiasType +boxcar +.sp -0.5 +.TP 25 +tileFrames +false +.sp -0.5 +.TP 25 +highlightFrames +true +.sp -0.5 +.TP 25 +gui +default +.sp -0.5 +.TP 25 +imtoolrc +/usr/local/lib/imtoolrc +.sp -0.5 +.TP 25 +invert +false +.sp -0.5 +.TP 25 +memModel +fast +.sp -0.5 +.TP 25 +basePixel: +64 +.sp -0.5 +.TP 25 +maxColors: +216 +.sp -0.5 +.TP 25 +cmapInitialize: +false +.sp -0.5 +.TP 25 +cmap1 +none +.sp -0.5 +.TP 25 +cmap2 +none +.sp -0.5 +.TP 25 +cmapDir1 +none +.sp -0.5 +.TP 25 +cmapDir2 +/usr/local/lib/imtoolcmap +.sp -0.5 +.TP 25 +input_fifo +/dev/imt1i +.sp -0.5 +.TP 25 +output_fifo +/dev/imt1o +.sp -0.5 +.TP 25 +unixaddr +/tmp/.IMT%d +.sp -0.5 +.TP 25 +port +5137 +.sp -0.5 +.TP 25 +ism_addr +/tmp/.ISM%d +.sp -0.5 +.TP 25 +ism_task +"ism_wcspix.e wcspix &" +.RE + +Description of ximtool client resources: + +.TP 18 +.B "defConfig" +Default frame buffer configuration number on startup. See below for more +information on frame buffers. +.TP 18 +.B "defNFrames" +Default number of frames on startup. Set to zero to use the value from +the frame buffer configuration (\fIimtoolrc\fP) file. +.TP 18 +.B "tileBorderWidth" +.sp -0.5 +.TP 18 +.B "tileBorderColor" +Used by the tile frames option. Specifies how far +apart to space the frames in tile frames mode. +Color "9" refers to the Gterm widget resource color9, +which is assigned a color with its own resource. +.TP 18 +.B "autoscale" +Enable/disable the autoscale option. +.TP 18 +.B "antialias" +Enable/disable the antialias option. +.TP 18 +.B "antialiasType" +Type of antialiasing. Options include \fIboxcar\fP (default), \fIbilinear\fP, +\fInearest\fP, \fIarea\fP, \fIblkavg\fP, \fIlowpass\fP, and \fIgaussian\fP. +.TP 18 +.B "tileFrames" +Enable/disable the tile frames option. +.TP 18 +.B "highlightFrames" +Determines whether the current frame is highlighted when in tile frames mode. +.TP 18 +.B "gui" +The GUI to be executed. "default" refers to the default, builtin ximtool GUI. +You can replace this with your own GUI file if you are bold enough, and +completely change the look and functionality of the GUI if desired. +.TP 18 +.B "imtoolrc" +Where to find the imtoolrc file. This defines the +recognized frame buffer configurations. +.TP 18 +.B "invert" +Start Ximtool using an inverted colormap. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 18 +.B "memModel" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are \fIfast\fP, \fIbeNiceToServer\fP, and \fIsmall\fP. +The default is \fIfast\fP, which uses server pixmaps to make frame blink fast. +This is recommended unless server memory is very limited. Note that even in +fast mode, the server pixmap is only the size of the display window, so +memory usage is reasonable even if the frame buffer is very large. +.sp -0.5 +.TP 18 +.B "basePixel" +.sp -0.5 +.TP 18 +.B "maxColors" +These two resources determine the region of colormap space used to +render image pixels. +.TP 18 +.B "cmapInitialize" +Initialize the ximtool colormap at startup. This is a required resource to +clear a previous ximtool colormap allowing a new \fBbasePixel\fP and +\fBmaxColors\fP to take effect. +.TP 18 +.B "cmap1" +.sp -0.5 +.TP 18 +.B "cmap2" +User colormap files. The intent here is to allow individual colormaps to be +conveniently specified as a resource. +.TP 18 +.B "cmapDir1" +.sp -0.5 +.TP 18 +.B "cmapDir2" +User or system colormap directories. By default cmapDir2 points to the system +directory /usr/local/lib/imtoolcmap, allowing a set of site default colormaps +to be defined here. This leaves cmapDir1 available to a user colormap +directory. +.TP 18 +.B "input_fifo" +.sp -0.5 +.TP 18 +.B "output_fifo" +The input and output fifos for fifo i/o. "Input" and "output" are from the +client's point of view. Note that only one display server can use a +fifo-pair at one time. +.TP 18 +.B "unixaddr" +Template address for unix domain socket. The user must have write permission +on this directory, or the file must already exist. \fI%d\fP, if given, +is replaced by the user's UID. +.TP 18 +.B "port" +TCP/IP port for the server. Note that only one server can listen on a port +at one time, so if multiple ximtool servers are desired on the same +machine, they should be given different ports. +.TP 18 +.B "ism_addr" +Template address for ISM unix domain socket. The user must have write +permission on this directory, or the file must already exist. \fI%d\fP, +if given, is replaced by the user's UID. +.TP 18 +.B "ism_task" +Command string to execute for the real-time pixel and WCS readout ISM +(Image Support Module) task. + +.SS "GUI RESOURCES" + +In principle ximtool can have any number of different GUIs, each of which +defines its own set of resources. GUIs typically define a great many +resources, but most of these are not really intended for modification by +the user (although one can modify them if desired). + +The following are some of the more useful resources used by the default +ximtool GUI. The \fIimagewin\fR resources are Gterm widget resources. +.RS + +.TP -10 +.B Main Display Gterm Widget Resources +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + *imagewin.cmapName: +image +.sp -0.5 +.TP 35 + *imagewin.basePixel: +64 +.sp -0.5 +.TP 35 + *imagewin.warpCursor: +True +.sp -0.5 +.TP 35 + *imagewin.raiseWindow: +True +.sp -0.5 +.TP 35 + *imagewin.deiconifyWindow: +True +.sp -0.5 +.TP 35 + *imagewin.ginmodeCursor: +circle +.sp -0.5 +.TP 35 + *imagewin.ginmodeBlinkInterval: +500 +.sp -0.5 +.TP 35 + *imagewin.color0 (background): +black +.sp -0.5 +.TP 35 + *imagewin.color1 (foreground): +white +.sp -0.5 +.TP 35 + *imagewin.color8 (panner highlight): +#7c8498 +.sp -0.5 +.TP 35 + *imagewin.color9 (tileFrame color): +SteelBlue +.sp -0.5 +.TP 35 + *imagewin.width: +512 +.sp -0.5 +.TP 35 + *imagewin.height: +512 + +.TP -10 +.B GUI Resources + +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + *autoscale: +True +.sp -0.5 +.TP 35 + *zoomfactors: +1 2 4 8 +.sp -0.5 +.TP 35 + *displayCoords: +True +.sp -0.5 +.TP 35 + *displayPanner: +True +.sp -0.5 +.TP 35 + *displayMagnifier: +True +.sp -0.5 +.TP 35 + *blinkRate: +1.0 +.sp -0.5 +.TP 35 + *pannerArea: +150*150 +.sp -0.5 +.TP 35 + *pannerGeom: +-5+5 +.sp -0.5 +.TP 35 + *magnifierArea: +100*100 +.sp -0.5 +.TP 35 + *magnifierGeom: ++5+5 +.sp -0.5 +.TP 35 + *wcsboxGeom: +-5-5 +.sp -0.5 +.TP 35 + *maxContrast: +5.0 +.sp -0.5 +.TP 35 + *warnings: +True +.sp -0.5 +.TP 35 + *centerBoxSize: +5 +.sp -0.5 +.TP 35 + *peakCentroid: +True + +.TP -10 +.B Alternate GUI Resources +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + *showToolBar: +False +.sp -0.5 +.TP 35 + *showPanelBar: +False +.RE + +Description of selected resources: + +.TP 22 +.B "*cmapName" +Name used for private colormap. The default for all IRAF imaging applications +is "image". Gterm widget based imaging applications which have the same value +of cmapName will share the same colormap, minimizing colormap flashing and +allowing multiple applications to be run at the same time. +.TP 22 +.B "*basePixel" +The base colormap cell used by the display colormap. +.TP 22 +.B "*imagewin.warpCursor" +Warp pointer into image window when initiating a cursor read. +.TP 22 +.B "*imagewin.raiseWindow" +Raise image window when initiating a cursor read. +.TP 22 +.B "*imagewin.deiconifyWindow" +Deiconify image window if necessary when initiating a cursor read. +.TP 22 +.B "*imagewin.ginmodeCursor" +Type of cursor when a cursor read is in progress. The default is a +circle. Any selection from the X cursor font can be used. A special +case is "full_crosshair" which is the full crosshair cursor of the +Gterm widget. +.TP 22 +.B "*imagewin.ginmodeBlinkInterval" +Determines whether the cursor blinks when a cursor read is in progress. +The value is given in milliseconds. +.TP 22 +.B "*imagewin.color0" +Background color. +.TP 22 +.B "*imagewin.color1" +Foreground color. +.TP 22 +.B "*imagewin.color8" +Color assigned the panner window. +.TP 22 +.B "*imagewin.color9" +Color used for the tileFrames highlight. +.TP 22 +.B "*imagewin.width" +Width of the main image window. +.TP 22 +.B "*imagewin.height" +Height of the main image window. +.TP 22 +.B "*pannerArea" +Area in pixels of the panner window. +.TP 22 +.B "*pannerGeom" +Where to place the panner window. +.TP 22 +.B "*wcsboxGeom" +Where to place the coords box. +.TP 22 +.B "*maxContrast" +Maximum contrast value. + + +.SH DESCRIPTION + +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept client connections +simultaneously on fifo pipes, unix domain sockets, or inet sockets. A +display client like the IRAF \fIDISPLAY\fP task makes a connection and sends +the image across using a modified IIS Model 70 protocol. Once the image is +loaded in the display buffer it may be enhanced, saved to a disk file in a +number of different formats, or printed as Encapsulated Postscript to a +printer or disk file. Up to sixteen frame buffers are allowed, these may be +displayed simultaneously in a tiled mode, or blinked frame-to-frame. +Each frame may have its own colormap or brightness/contrast enhancement. +Pan/Zoom and cursor readout are permitted using \fImarkers\fP, on-line help +is also available. + +When run in standalone mode, images (currently IRAF OIF, GIF, Sun Rasterfiles +or simple FITS (i.e. excluding MEF files) formats are permitted) may be +loaded on the command line or by using the Load Panel. This allows you to +browse images and perform the same manipulations as if they had been displayed +by a client. + +.SS "MOUSE OPERATIONS" + +Clicking and dragging MB1 (mouse button 1) in the main image window creates +a rectangular region marker, used to select a region of the image. If you do +this accidentally and don't want the marker, put the pointer in the marker +and type DELETE or BACKSPACE to delete the marker. With the pointer in the +marker, MB3 will call up a marker menu listing some things you can do with +the marker, like zoom the outlined region. MB1 can be used to drag or resize +the marker. See below for more information on markers. + +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. + +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the +display. + +.SS "KEYSTROKE ACCELERATORS" + +The following keystrokes are currently defined in the GUI: + +.RS +-------------------- \fBMisc Functions\fP --------------------- +.sp -0.2 +.TP 20 +.B "Ctrl-b" +Previous (back) frame +.sp -0.5 +.TP 20 +.B "Ctrl-c" +Center frame +.sp -0.5 +.TP 20 +.B "Ctrl-f" +Forward frame +.sp -0.5 +.TP 20 +.B "Ctrl-i" +Invert colormap +.sp -0.5 +.TP 20 +.B "Ctrl-m" +Toggle magnifier +.sp -0.5 +.TP 20 +.B "Ctrl-n" +Normalize +.sp -0.5 +.TP 20 +.B "Ctrl-p" +Toggle panner +.sp -0.5 +.TP 20 +.B "Ctrl-r" +Register +.sp -0.5 +.TP 20 +.B "Ctrl-s" +Match LUT scaling +.sp -0.5 +.TP 20 +.B "Ctrl-t" +Tile frames toggle +.sp -0.5 +.TP 20 +.B "Ctrl-u" +Unzoom (zoom=1) +.sp -0.5 +.TP 20 +.B "Ctrl-x" +Flip X +.sp -0.5 +.TP 20 +.B "Ctrl-y" +Flip Y +.TP 20 +.B "Ctrl-=" +Print using current setup +.sp -0.5 +.TP 20 +.B "Ctrl-<" +Decrease blink rate (blink faster) +.sp -0.5 +.TP 20 +.B "Ctrl->" +Increase blink rate (blink slower) +.sp -0.5 +.TP 20 +.B "Ctrl-+" +Zoom in +.sp -0.5 +.TP 20 +.B "Ctrl--" +Zoom out +.TP 20 +.B "Alt-1 thru Alt-4" +Set frame to be displayed +.sp -0.5 +.TP 20 +.B "Ctrl-1 thru Ctrl9" +Set integer zoom factor +.TP 20 +.B "Ctrl-Alt-q" +Quit +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-f" +Fitframe +.TP -12 +--------------------- \fBPanel Toggles\fP --------------------- +.sp -0.2 +.TP 20 +.B "Alt-b" +Blink frames +.sp -0.5 +.TP 20 +.B "Alt-c" +Control panel +.sp -0.5 +.TP 20 +.B "Alt-h" +Help popup +.sp -0.5 +.TP 20 +.B "Alt-i" +Info box popup +.sp -0.5 +.TP 20 +.B "Alt-l" +Load file popup +.sp -0.5 +.TP 20 +.B "Alt-p" +Print popup +.sp -0.5 +.TP 20 +.B "Alt-s" +Save popup +.sp -0.5 +.TP 20 +.B "Alt-t" +TclShell popup +.sp 0.5 +.TP -12 +------------------- \fBCursor Positioning\fP ------------------ +.sp -0.2 +.TP 28 +.B "Ctrl-h / Ctrl-Left" +Move cursor one pixel left +.sp -0.5 +.TP 28 +.B "Ctrl-j / Ctrl-Down" +Move cursor one pixel down +.sp -0.5 +.TP 28 +.B "Ctrl-k / Ctrl-Up" +Move cursor one pixel up +.sp -0.5 +.TP 28 +.B "Ctrl-l / Ctrl-Right" +Move cursor one pixel right +.TP 28 +.B "Shift-Ctrl-h / Shift-Ctrl-Left" +Move cursor ten pixels left +.sp -0.5 +.TP 28 +.B "Shift-Ctrl-j / Shift-Ctrl-Down" +Move cursor ten pixels down +.sp -0.5 +.TP 28 +.B "Shift-Ctrl-k / Shift-Ctrl-Up" +Move cursor ten pixels up +.sp -0.5 +.TP 28 +.B "Shift-Ctrl-l / Shift-Ctrl-Right" +Move cursor ten pixels right +.sp 0.5 +.TP -12 +------------------- \fBAuto-Registration\fP ------------------- +.sp -0.2 +.TP 20 +.B "Ctrl-a" +Toggle auto-registration +.sp -0.5 +.TP 20 +.B "Ctrl-o" +Set frame offset +.sp 0.5 +.TP -12 +-------------------- \fBFrame Positioning\fP ------------------ +.sp -0.2 +.TP 20 +.B "Ctrl-Left" +Shift one full frame left +.sp -0.5 +.TP 20 +.B "Ctrl-Down" +Shift one full frame down +.sp -0.5 +.TP 20 +.B "Ctrl-Up" +Shift one full frame up +.sp -0.5 +.TP 20 +.B "Ctrl-Right" +Shift one full frame right +.TP 20 +.B "Ctrl-Alt-Left" +Shift one half frame left +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-Down" +Shift one half frame down +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-Up" +Shift one half frame up +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-Right" +Shift one half frame right +.sp 0.5 +.TP -12 +------------------- \fBPeak-Up Centroiding\fP ----------------- +.sp -0.2 +.TP 20 +.B "Ctrl-[" +Decrease centroiding box size +.sp -0.5 +.TP 20 +.B "Ctrl-]" +Increase centroiding box size +.sp -0.5 +.TP 20 +.B "Ctrl-0 (zero)" +Centroid/find local maximum +.sp -0.5 +.TP 20 +.B "Alt-Ctrl-0 (zero)" +Find local minimum +.sp 0.5 +.TP -12 +------------------ \fBMouse Button Events\fP ------------------ +.sp -0.2 +.TP 20 +.B "Shift-Btn1Down" +Turn on magnifier +.sp -0.5 +.TP 20 +.B "Shift-Btn1Up" +Turn off magnifier +.sp -0.5 +.TP 20 +.B "Shift-Btn2Down" +Turn on crosshair cursor +.sp -0.5 +.TP 20 +.B "Shift-Btn2Up" +Turn off crosshair cursor +.TP 20 +.B "Btn1Down" +Create a Marker +.sp -0.5 +.TP 20 +.B "Btn1Motion" +Resize marker being created +.sp -0.5 +.TP 20 +.B "Btn2Down" +Zoom/center on cursor position +.sp -0.5 +.TP 20 +.B "Btn3Down/Motion" +Brightness/contrast scale the image +.TP 20 +.B "Ctrl-Btn1Down" +Create Ruler Marker +.sp -0.5 +.TP 20 +.B "Ctrl-Btn1Motion" +Resize Ruler Marker being created +.sp -0.5 +.TP 20 +.B "Ctrl-Btn1Up" +Destroy Ruler Marker +.TP 20 +.B "Alt-Motion" +Freeze cursor readout +.RE + +.LP +\fBNOTE:\fP These keystrokes only work with the cursor in the main image +window, only a few of the commands are implemented to work within subwindows +or markers to avoid conflicts with translations for those objects. If a +command does not work, check the cursor location and try it again in the +main display window. + +.SH "FRAME BUFFER CONFIGURATIONS" + +XImtool starts up using default frame buffer size of 512x512 pixels, two +(of 16 possible) frames will be created. When loading disk images (i.e. +run in standalone mode) the frame buffer configuration file will be +searched for a defined frame buffer that is the same size or larger than +the current image, if no suitable buffer can be found a custom frame +buffer the same size as the image will be created in an unused portion of +the configuration table. When used as a display server the frame buffer +configuration number is passed in by the client and loaded explicitly even +if it means clipping the image. If a new frame buffer is a different size +than previously defined frames, all available frames will be initialized +and cleared prior to the display. The default frame buffer configuration +file is /usr/local/lib/imtoolrc, this can be overridden by defining a +IMTOOLRC environment variable naming the file to be used, by creating a +.imtoolrc file in your home directory, or a new file may be specified +using the \fI-imtoolrc\fR command line flag or \fIimtoolrc\fR application +resource. + +The format of the frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 16 frames, configuration numbers need not be sequential. + +.LP +\fBNOTE:\fR When defining a new frame buffer for use with client software +such as IRAF the user must also remember to define those frame buffers in +the IRAF \fIdev$graphcap\fR file. + +.SS "SUPPORT FOR 16 DISPLAY FRAMES" + +As part of the extensive GUI changes with the V1.3 release, support for +the full 16 frames allowed by the IIS protocol is now available. IRAF +V2.11.4 or later client tasks (and CDL library) are required to take +advantage of this frames. All changes are backwards compatible, older +versions of IRAF will continue to work but cannot access more than the +original four frames. The new DISPLAY task will automatically sense +whether the display server being used supports 16 frames or the original 4 +and adjust the 'frame' parameter maximum accordingly. The changes are +fully backwards compatible for other servers. + +More frames are possible if needed but will require further changes to the +client IRAF code to be effective. Allowing creation of more than 16 +frames by the Load panel can be done independently but would also require +numerous code change to XImtool. Please contact site support if there is +a need for this, or for workaround suggestions depending on your +application. + +.SH "MARKERS" + +Although ximtool doesn't do much with markers currently, they are a general +feature of the \fIGterm\fP widget and are used more extensively in other +programs (e.g. the prototype IRAF science GUI applications). XImtool uses +markers for the marker zoom feature discussed above, and also for the panner +and the coords box. All markers share some of the same characteristics, so it +is worthwhile learning basic marker manipulation keystrokes. +.TP 3 +\fBo\fP +MB1 anywhere inside a marker may be used to drag the marker. +.TP 3 +\fBo\fP +MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +.TP 3 +\fBo\fP +Shift-MB1 on the corner of most markers will rotate the marker. +.TP 3 +\fBo\fP +Markers stack, if you have several markers and you put one on top of +the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +.TP 3 +\fBo\fP +MB2 in the body of a marker "lowers" the marker, i.e. moves it to the +bottom of the stacking order. +.TP 3 +\fBo\fP +Delete or backspace in a marker deletes it. +.TP 3 +\fBo\fP +Markers have their own translation resources and so the default +keystroke commands will not be recognized when the cursor is in a marker. + +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back if you delete it, or you can reset the toggle in +the control panel). + +.SS "PANNER MARKER" + +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. + +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned below apply to these markers as well, e.g. you can use MB1 to +reposition on the panner window within the main image display window, or to +drag the region marker within the panner (pan the image). Resizing the +region marker zooms the image; this is a non-aspect constrained zoom. The +panner window itself can be resized by dragging a corner with MB1. Typing +delete or backspace anywhere in the panner window deletes the panner. + +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to hitting MB2 in the main display +window to pan the image. + +The panner marker can be disabled by defining the \fIdisplayPanner\fP +GUI resource, its size and location can be controlled using the +\fIpannerArea\fP and \fIpannerGeom\fP GUI resources respectively. + +.SS "MAGNIFIER MARKER" + +The magnifier marker can be used to zoom in on a small area around the +cursor. +It will be updated as the cursor moves but only for small motions (either +mouse movement or with the cursor movement keystrokes) to minimize the +impact on the system. The zoom factor is expressed as some fraction of the +size of the magnifier marker itself. The default zoom is 4, i.e. the area +in the marker represents and area in the image that's one-fourth the size +of the marker. Other zoom factors may be selected using the popup menu +created by hitting MB1 in the marker. + +By default the magnifier marker is not visible, to toggle it select the +\fIMagnifier\fR option from the \fIOptions\fR menubar button. Alternatively, +for just a quick look holding down the Shift and MB2 buttons will display +the marker until the button is released. + +The magnifier marker can be disabled by defining the \fIdisplayMagnifier\fP +GUI resource, its size and location can be controlled using the +\fImagnifierArea\fP and \fImagnifierGeom\fP GUI resources respectively. + +.SS "COORDS BOX MARKER" + +XImtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +linear client-defined coordinate system. The coords box feature is used to +display these world coordinates as the pointer is moved about in the image +window. + +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated a +"+" will be displayed after the intensity value. + +The coords box is a text marker, it can be moved and resized +with the pointer like any other marker. The coords box marker can be +disabled by defining the \fIdisplayCoords\fP GUI resource, its location +can be controlled by the \fIwcsboxGeom\fP GUI resource. + +.SS "MARKER MENU OPTIONS" + +Except for the panner and WCS markers, MB3 (mouse button 3) calls up the +marker menu providing a limited set of functions common to all markers: +.TP 3 +\fBo +Zoom\fP does an equal aspect zoom of the region outlined by the marker. In +this way you can mark a region of the image and zoom it up. +.TP 3 +\fBo +Fill\fP exactly zooms the area outlined by the marker, making it fill the +display window. Since the marker is not likely to be exactly square, +the aspect ratio of the resultant image will not be unitary. +.TP 3 +\fBo +Print\fP prints the region outlined by the marker to the printer or file +currently configured by the Print Panel. +.TP 3 +\fBo +Save\fP saves the region outlined by the marker to the file currently +configured by the Save Panel. +.TP 3 +\fBo +Info\fP prints a description of the marked region. The text is printed in +the Info Panel. +.TP 3 +\fBo +Unrotate\fP unrotates a rotated marker. +.TP 3 +\fBo +Color\fP is a menu of possible marker colors. +.TP 3 +\fBo +Type\fP is a menu of possible marker types. This is still a little buggy +and it isn't very useful, but you can use it to play with different +types of markers. +.TP 3 +\fBo +Destroy\fP destroys the marker. You can also hit the delete or backspace +key in a marker to destroy the marker. + +.SS "RULER MARKERS" + +Holding down the Ctrl key and the Left-Mouse-Button while moving +the mouse will drag out a "ruler marker" measuring the distance from the +initial point to the current mouse position. Releasing the Ctrl key before +lifting the mouse button will leave the marker on the display, otherwise +it will be erased automatically once the mouse button is released. Any +number of ruler markers can be created in the frame. + +Distances are measured by default in image logical pixels however +the Right-Mouse-Button can be used inside the marker to popup a menu of +options: + +.TP 20 +.B Sticky +By default rulers are destroyed whenever the display +changes due to a pan, zoom, flip, or frame change. +This option will make the ruler "sticky" so it will +not be erased, subsequent use of the menu to shows +this option to be "UnSticky" to remove this feature. +.TP 20 +.B Units +Sub-menu to select the units of the display. If the +ISM is enabled and a WCS is present in the image and +selected as one of the readout options, distances may +also be read out in units of arcseconds, arcminutes, +or degrees instead of the default logical pixels. All +markers created after the unit change will readout in +the new units as their default. +.TP 20 +.B Color +Select the color of the marker. +.TP 20 +.B Draw into Frame +(\fINot Yet Implemented\fP) Draw the marker as overlay +graphics in the frame. Doing so will retain the +marker when printing a hardcopy of the display. +.TP 20 +.B Destroy +Destroy the marker. + +The marker can also be destroyed by hitting the Delete or Backspace key +while the cursor is in the marker. There is presently no way to move the +marker to a new position in the frame. + +.SH "REAL-TIME WCS/PIXEL-VALUE READOUT" + +XImtool now has the ability to display the actual pixel value of an image +(as well as the scaled value previously shown) and the cursor position in +image WCS values (e.g. RA/DEC, GLAT/GLONG, etc). This is done using an +external task (the 'ism_wcspix.e' binary in the new distribution) to +access the image and pass the coordinate/pixel information to the GUI. + +WCS readout is enabled by default but can be toggled or reset using the +\fIWCS/Pix\fP button on the Coords tab in the control panel or the \fIISM\fP +toggle on the alt-gui menubar. When enabled, images currently in the +server or subsequently displayed will be passed to the external process +where they are cached for access. Cursor movements generate an event that +maps the current frame buffer position to a position in the cached image. +The ISM (ISM is Image Support Module) task then reads the image to +determine the pixel value (or a small table of values around the current +position), and computes one or more coordinates from the image position. +The ISM task also has access to the associated BPM images and can +optionally return bad pixel information during the cursor readout. + +By default, the logical and world image coordinates are displayed to both +the Coords panel readout as well as the main display window wcsbox text +marker. Alternate coordinate systems (e.g. transformation of equatorial +to galactic coordinates or some other sky system, physical coords, +amplifier coords, etc) can be selected for display by hitting the +\fIOptions\fP toggle on the Coords panel. Available coordinate systems are +chosen using the \fIType\fP menu on the panel, the readout format +(sexigesimal, degrees, etc) using the \fIFormat\fP menu, and the display to +the current panel or main image window using the remaining toggles for +each WCS. Up to four systems may be displayed at one time, the coordinate +panel and wcsbox marker will adjust size automatically depending on the +display. + +By selecting the \fIBPM Data\fP toggle from the Coords.Options panel ximtool +is able to flag pixels in images with an associated bad pixel mask. This +bad pixel mask is currently assumed to be named in the image header "BPM" +keyword by convention. If the cursor passes over a bad pixel in the mask, +the Coords bpm display as well as the main window wcsbox will change to a +red background color. Only the Coords display will show the value, any +non-zero value will be flagged with the color change. + +With the ISM enabled the Compass indicator will display a set of arrows +showing North-East if a WCS is available, otherwise just the current X-Y +axes are shown. The pixel table will display actual pixel values from the +image, with the ISM off the pixel table displays the scaled image values +from the frame buffer. + +.SH "FREEZING CURSOR READOUT" + +Holding down the Alt key will now freeze the cursor display readout +and draw crosshairs on the screen at the last position. This can be used +for example to position the cursor but then allow the cursor to be moved to +another window (to enter text, start a program, whatever) without losing +the position information displayed on the screen. + +.SH "CUT-GRAPHS" + +XImtool now has the ability to display horizontal and vertical +cut-graphs of the display, these appear as "flip-out" panels that appear +on the bottom and right side of the main display window and are controlled +by the small "H" and "V" buttons in the lower right corner of the window. +When both panels are enabled the corner area of the display also shows an +options panel for the graphs. Current options are: + +.TP 20 +.B Better Speed +Draw the graphics so they update at the fastest possible rate. This is +done by subsampling pixels to produce a smoother graph but without sacrificing +too much accuracy. +.TP 20 +.B Better Accuracy +Draw the graphics using all screen pixels to produce the most accurate +display. On fast modern machines this can be enabled with no apparent +loss of speed, however older machines may wish to use this only +occassionally to limit any lag in the cursor tracking. +.TP 20 +.B Image Pixels +(\fINot Yet Implemented\fP) +.TP 20 +.B Jump Cursor +If enabled, large jumps of the cursor do not update the graphics display, +small movements around an object of interest will update the display +continuously. +.TP 20 +.B Smooth Cursor +If enabled, all cursor movements cause the display to be updated. This +is another option that can be set safely on faster machines but will +cause a delay on slower ones. +.TP 20 +.B Graphics Cursors +If enabled, the graphics cursors in either of the plots are active and +can be used to update the cursor readout on the main image window and the +complementary cut-graph. This can be used for example to freeze +the cursor in the main display using the Alt key (see above), then moving +to one of the graphics windows to perform cut graphs in only one axis. + +Graphs are (currently) drawn using only the scaled display values +to avoid complications of accessing multiple images in a mosaic display. Both +plots are labeled using the frame z1/z2 values and contain cursor indicators +which update contuously. + +.SH "PEAK-UP CURSOR CENTROID POSITIONING" + +Several new keystroke commands are available to reposition the +cursor to a centroid or min/max pixel value within a bounding box of the +cursor position, allowing you to approximate the position with the mouse +and fine tune it quickly before typing the application keystroke command. +The initial box size is controlled with a \fIcenterBoxSize\fP GUI resource +(defaults to 5 pixels) but can be adjusted interactively using the \fBCtrl-[\fP +and \fBCtrl-]\fP commands to descrease/increase the box size respectively. A +marker will flash briefly to indicate the box size. + +The \fBCtrl-0\fP (zero) key finds either a centroid or the local maximum +pixel value within this box region, \fBAlt-Ctrl-0\fP (zero) will find the local +minimum value. In either case the cursor is reposition to the computed +value. The default peak-up action is to find the centroid position in the +box however this can be changed to find the max pixel by selection the +"\fICentroid Peaks\fP" option from the main Display control panel or by +resetting the \fIpeakCentroid\fP GUI resource (defaults to True). + +Centroiding is done using only the scaled screen pixel values and +only pixels above the mean value within the box are used. It works best +if the box size is set appropriately, the centroid position may appear to +drift if the box is too large and includes too many background pixels. + +.SS "Command Summary" +.TP 20 +.B Ctrl-0 (zero) +Reposition to centroid/max-pixel +.sp -0.5 +.TP 20 +.B Alt-Ctrl-0 (zero) +Reposition to min-pixel +.sp -0.5 +.TP 20 +.B Ctrl-[ +Decrease centering box size (min of 5) +.sp -0.5 +.TP 20 +.B Ctrl-] +Increase centering box size + +.SS "Resource Summary" +.TP 20 +.B "peakCentroid = True" +Compute the box centroid position, a 'False' value force the max value +to be used +.sp -0.5 +.TP 20 +.B "centerBoxSize = 5" +Size of the centroid box, used as cursor position +/- this value + +.SH "AUTO-REGISTRATION OF IMAGES" + +The auto-register feature allows you specify a registration of +two or more display frames with an offset. When enabled, this registration +is maintained for all frames in the list if any one of them is panned or +zoomed to a new location in the frame buffer. + +For example, to use this feature do the following: +.RS +.TP 5 +.B 1) +Enable Auto-Register (either on the Control Panel or the toolbar on the +alt-gui) and pan/zoom to some star of interest. +.TP 5 +.B 2) +Use Mouse-Button-2 to center the star in the frame. +.TP 5 +.B 3) +Cycle through the frames and you may see a small shift of the star. For +each frame, position the cursor on the star and type \fBCtrl-o\fP to +offset it to the center. Repeat as necessary. Small corrections will be +cumulatively added so you can use the \fBCtrl-0\fP (Ctrl-zero) peak-up +command to centroid each object in the frame before the \fBCtrl-o\fP offset. +.TP 5 +.B 4) +Pan around the image in one display frame, then switch frames and the new +frame should also be panned to the new image with the proper offset. +.TP 5 +.B 5) +A \fBCtrl-a\fP command will toggle the feature, offsets are only allowed +when autoreg is enabled. +.RE +.LP +Hitting \fBRegister\fP will zero the offsets, as will toggling the +auto-register function. What you should see is the object centered in +the frame and as you blink through it remains registered but the panner +box marker is moving around. Drag the panner around and all frames +still remain registered with the given offset. The control/info panels +now display what the offset is for each frame. + +The register display list is shared with the blink list and can +be set using the Display control panel. By default all frames are included +in the list. For accessing more than four frames, use the box icon in +the Blink/Register box of the Display control panel to bring up a new window +with access to all 16 available frames. + +.SS "Command Summary" +.TP 20 +.B Ctrl-o +Set the registration offset from center +.sp -0.5 +.TP 20 +.B Ctrl-a +Toggle the Auto-Register feature + +.SH "CONTROL PANEL" + +XImtool has a control panel which can be used to exercise most of the +capabilities the program has for image display. The control panel can be +accessed either via the \fBOptions\fP menu from the main window menubar, or by +pressing the leftmost button in the row of buttons at the upper right side +of the display in the standard GUI (in the alternate GUI the \fIControl +Bar\fP accessed by the rightmost button on the menubar provides widgets +for selecting the desired control panel). + +The separate windows previously used for Control/Print/Load/Save/etc +have now been integrated into a single window with the appropriate control +panel selectable with a Tab widget. There are also new Tab panels for +setting the frame tile configuration (see below), more detailed information +on the server status, and selecting the WCS readout options (see below). + +.SS "VIEW CONTROLS" + +The \fBFrame box\fP will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 16) will be created +automatically if requested by the client. The number of frame buffers +created at startup can be controlled using the \fI-nframes\fP command-line +switch or the \fIdefNFrames\fP resource. + +The \fBtext display\fP window gives the field X,Y center, X,Y scale +factors, the X,Y zoom factors, and the frame offset used in +Auto-Registration. The scale factor and the zoom factor will be the same +unless \fIautoscale\fP is enabled. The scale is in units of display pixels +per frame buffer pixel, and is an absolute measure (it doesn't matter +whether or not autoscale is enabled). Zoom is relative to the autoscale +factor, which is 1.0 if autoscaling is disabled. This information is also +presented in the Info panel. + +The numbers in the \fBZoom box\fP are zoom factors. Blue numbers zoom, red +numbers dezoom. \fIZoom In\fP and \fIZoom Out\fP may be used to go to +larger or smaller zoom factors, e.g. \fICtrl-5\fP followed by "Zoom In" +will get you to zoom factor 10. Specific zoom factors may also be +accessed directly as Control keystrokes, e.g. Ctrl-5 will set zoom factor +5. \fICenter\fP centers the field. \fIToggle Zoom\fP toggles between the +current zoom/center values, and the unzoomed image. + +\fIAspect\fP recomputes the view so that the aspect ratio is 1.0. Aspect +also integerizes the zoom factor (use the version in the View menu if you +don't want integerization). + +\fIFit Frame\fP makes the display window the same size as the frame +buffer. Note that autoscale has much the same effect, and allows you to +resize the display window to any size you want, or view images too large +to fit on the screen. + +.SS "ENHANCEMENT CONTROLS" + +At the top is a scrolled list of all the available colormaps. Click on the +one you want to load. You can add your own colormaps to this list by +defining the \fIcmap[12]\fP or \fIcmapDir[12]\fP command line flags or +application resources. + +The two sliders adjust the contrast (upper slider) and brightness (lower +slider) of the display. The \fIInvert\fP button inverts the colormap +(multiples the contrast by -1.0). Note that due to the use of the private +colormap the sliders are a bit sluggish when dragged to window the +display. If this is annoying, using MB3 in the display window is faster. + +The \fINormalize\fP button (on the bottom of the control panel) will +normalize the enhancement, i.e. set the contrast and brightness to the +default one-to-one values (1.0, 0.5). This is the preferred setting for +many of the pseudocolor colortables and for private colormaps loaded from +disk images. The \fIInitialize\fP button does a reset of the server. + +.SS "BLINK CONTROLS" + +\fIBlink frames\fP is the list of frames to be blinked. When blink mode is +in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered in +the list more than once. To program an arbitrary list of blink frames, +hit the Reset button and click on each blink frame button until it is set +to the desired frame number. The main control panel allows only the +original four frames to be specified in the blink list, however access to +the full list of 16 frames now supported is gained using the box icon +button next the the \fIReset\fP button to bring up a new control panel. + +The \fIBlink Rate\fP can be adjusted as slow or as fast as you want using +the arrow buttons. If you set the blink rate small enough it will go to +zero, enabling single step mode (see below). + +The \fIRegister\fP button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. + +The \fIMatch LUTs\fP button sets the enhancement of all blink frames to +the same values as the display frame. Frames not in the blink list are not +affected. + +The \fIBlink\fP button turns blink on and off. When the blink rate is set +to zero the Blink button will single step through the blink frames, one +frame per button press. + +\fBNOTE:\fP You can blink no matter what ximtool options are in effect, +but many of these will slow blink down. To get the fastest blink you may +want to turn off the panner and coords box, and match the LUTs of all the +blink frames. All the ximtool controls are fully active during blink +mode, plus you can load frames etc. + +.SS "OPTIONS:" +.TP 5 +.B "Panner" +Toggles whether to display the Panner marker. +.TP 5 +.B "Magnifier" +Toggles whether to display the Magnifier marker. +.TP 5 +.B "Coords Box" +Toggles whether to display the coordinate box marker. +.TP 5 +.B "Autoscale" +If autoscale is enabled then at zoom=1, the frame buffer will be +automatically scaled to fit within the display window. With autoscale +disabled (the default), the image scale is more predictable, but the +image may be clipped by the display window, or may not fill the display +window. +.TP 5 +.B "Antialias" +When dezooming an image, i.e., displaying a large image in a smaller +display window, antialiasing causes all the data to be used to compute +the displayed image. If antialiasing is disabled then image is +subsampled to compute the displayed image. Antialiasing can prevent +subsampling from omitting image features that don't fall in the sample +grid, but it is significantly slower than dezooming via subsampling. +The default is no antialising. +.TP 5 +.B "Tile Frames" +The default display mode is to view one frame at a time. In tile frames +mode, 2 or 4 frames may be viewed simultaneously in the display window. +All the usual operations (zoom and pan, colortable enhancement, cursor +readback, etc.) still work for each frame even when in tile frames mode. +.TP 5 +.B "Warnings" +The warnings options toggles whether you see warning dialog boxes in +situations like overwriting an existing file, clearing the frame +buffer, etc. +.TP 5 +.B "Centroid Peaks" +If enabled, the \fBCtrl-0\fP keystroke will reposition the cursor to the +computed centroid of the centroiding box, otherwise the cursor is +repositioned to the local maximum value within the box. + +.SH "LOAD PANEL" + +The Load Panel allows you load images from disk directly to the frame +buffer, this is analogous to loading an image on the command line except +that browsing is possible. At present recognized formats include IRAF OIF +format (i.e. \fI.imh\fP extension), simple FITS files, GIF, and Sun +rasterfiles. The task will automatically sense the format of the image +and load it appropriately. Images with private colormaps (such as GIF) +will be loaded using the private colormap (meaning that changing the +brightness/contrast enhancements will render an apparently random-colored +image), all others will be loaded with a grayscale colormap. + +When loading new images the frame buffer configuration table will be +searched for a frame buffer that is the same size or larger than the new +image size, if no frame buffer can be found a custom buffer exactly the +size of the image will be created. This means that the image may not fill +the display window when loaded, or you may see a subsection of the image +in the main display window. Setting the \fIautoscale\fP option on the main +Display panel will scale the entire image to fit the main display window, +the full frame buffer will always be visible in the Panner marker window. + +Images with more colors than can be displayed will automatically be +quantized to the number of available colors before display. +If the \fIAuto Grayscale\fP button is enabled any image colormap will be +converted to grayscale and loaded as the standard grayscale colormap. + +Formats which permit pixels larger than 8-bits/pixel will be sampled on +a grid to determine an optimal range in the data to be used to compute a +linear transformation to the number of display colors. This is the same +z-scale sampling and transformation used by the IRAF \fIDISPLAY\fR task +when computing the \fIz1/z2\fP values and provides a much better initial +display than simple truncation to 8-bits. This scaling will be done +automatically using a grid of \fINsample\fP points if the \fIZscale\fP +option is enabled. Otherwise, if the \fIZrange\fP option is set the full +data range will be used to scale the image. Lastly, is neither \fIZscale\fP +nor \fIZrange\fR are enabled, the z1/z2 values may be set explicitly using +the options box. + +.TP 5 +.B "Directory Browsing" +The load panel contains a list of files in the current directory that may +be selected for loading by selecting with left mouse button. If the file +is a directory the contents of the new directory will be loaded, if it's a +plain file an attempt will be made to load it as an image otherwise an +error popup will appear. Directories in the list are identified with a +trailing '/' character, you will always see any subdirectories listed even +if a filter is specified. + +The \fIRoot\fP button will reset the current directory to the system root +directory. The \fIHome\fP button will reset the current directory to the +user's login directory, the \fIUp\fP button moves up one directory level, and +\fIRescan\fP reloads the file list by rescanning the directory. The current +working directory is given below the file selection window. + +Selecting the \fIList Image Headers\fP option will change the display text +to list all images in the current directory which match the filename filter. +Directory browsing is disabled while this option is in effect. +.TP 5 +.B "File Patterns" +By default all files and directories will be listed. You may specify a +filter to select only those files with a given extension such as +"*.fits" using the \fIFilter\fP text box. Directories will +always be seen in the list and are identified with a trailing '/' +character. Any valid unix pattern matching string will be recognized, +multiple templates may be specified in a comma-delimited list such as +"*.imh,*.fits" to list both OIF and FITS images. +.TP 5 +.B "Direct File Load" +If you know exactly which file you wish to load, you may enter its +name in the \fILoad File\fP text box and either hit <cr> or the Load button +to load it. An absolute or relative path name may be given, if a simple +filename is specified it will be searched for in the current working directory. +.TP 5 +.B "Frame Selections" +By default images will be loaded into the current frame, you may choose +a different frame using the Frame menu button to select from the +available frames. + +.SH "SAVE PANEL" + +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, or overlay graphics +displayed by the client program). Presently, only the contents of the main +display window may be saved, there is no facility for saving the undisplayed +contents of the entire frame buffer other than to enable the autoscale feature +or zoom out so the whole buffer is in the display window. A limited number +of formats are currently available, others will be added in future versions. +.TP 15 +.B "File Name" +The File Name text box allows you to enter the file name of the saved +file. A "%d" anywhere in the name will be replaced by a sequence number +allowing multiple frames to be saved with unique names. +.TP 15 +.B "Format" +The Format box allows you to choose the format of the image to be +created however not all formats are currently implemented. The EPS format +is similar to the \fIPrint\fR option however there is no annotation. +.TP 15 +.B "Color" +The Color box lets you choose the color type of the image to be +created. The options will change depending on the format, e.g. FITS +doesn't allow color so no color options will be enabled. Formats which +allow 24-bit images will be written using the current colormap after +converting to a 24-bit image, pseudocolor images will be written with +the current colormap. + +.SH "PRINT PANEL" + +The Print Panel allows you dump the contents of the main display window as +Encapsulated Postscript to either a named printer device or to a disk file. +The \fIPrint To\fP selects the type of output, the \fIPrint Command\fP box +will adjust accordingly, either as a Unix printer command or as a file name. +A "%d" anywhere in the name for disk output will be replaced by a sequence +number allowing multiple frames to be saved with unique names. Selecting +printers from the installed list will automatically change the command to be +used to generate the output. This command does not necessarily need to be a +printer command, the printer configuration file lets you define any command +string to process the image. + +.SS "COLOR OPTIONS" + +The Color box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap +and enhancements. + +.SS "POSTSCRIPT OPTIONS" + +.TP 15 +.B "Orientation" +Set the page orientation. +.sp 0.5 +.TP 15 +.B "Paper Size" +Select the paper size to be used. +.sp 0.5 +.TP 15 +.B "Image Scale" +Set the scale factor used to compute the final image size. No checking is +done to make sure the image will fit correctly on the page. + +.SS "PROCESSING OPTIONS" +.TP 5 +.B "Auto Scale" +Toggles whether or not the image is automatically scaled +to fit the page. If not enabled, the image scale will be used to +determine the output image size, otherwise the image will be scaled down +(if necessary) to fit on the page. +.TP 5 +.B "Auto Rotate" +Determines whether or not the image will be rotated to fit +on the page. When set, an image larger than the current orientation +will be rotated and possibly scaled to fit the page, otherwise the image +may be scaled so that it fits in the current orientation. +.TP 5 +.B "Max Aspect" +Automatically increases the scale so the image fills the page in the current +orientation. +.TP 5 +.B "Annotate" +The annotate option toggles whether or not the final file includes +annotation such as the image title, a colorbar, and axis labels. There is +currently no option for partial annotation. + +.SS "ANNOTATION OPTIONS" + +.TP 5 +.B "Annotate" +Selects whether Postscript image is to be annotated. +.B "Title" +Annotate with a title on the top of the image. +.B "Borders" +Annotate with borders surrounding the image giving image coordinates. +.B "Colorbar" +Annotate with colorbar at the bottom of the image +.B "Title String" +Title string to use when \fItitle\fR is selected. The special value +\fIimtitle\fR will force the title to be the currently displayed image title, +otherwise it will be this user-selected field. + +.SS "PRINTER SELECTION" + +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the \fI-printConfig\fP command line switch or \fIprintConfig\fP +resource. The format of the file is simply + + \fIname\\tcommand\fP + +The \fIname\fP value is what appears in the selection list and may be more +than a single word, the \fIcommand\fP can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command +will be a simple \fIlpr -Pfoo\fP or some such, but can also include converters +or previewers. At most 128 printer commands may be used. + +.SH "INFO PANEL" + +The Info panel was revised to provide a greater variety of status +information. The type of output is controlled by the toggle buttons on +the bottom of the frame, however all output is kept current as the program +runs. Current info options include: +.RS +.TP 15 +.B Frame +Info about the current display frame. +.TP 15 +.B Server +Info about various server options, e.g. colormaps, memory model, +antialias type, etc. +.TP 15 +.B Clients +Show currently connected clients. Lists available connection channels +and active ISM clients. +.TP 15 +.B WCS +List all WCS and mappings for the current frame. +.TP 15 +.B ISM +Log of various ISM status messages. +.TP 15 +.B Imtoolrc +Show current frame buffer configuration table. +.RE + +.SH "TILE PANEL (NEW)" + +With the additional frames, the default tiling scheme proved inadequate. +A new control panel Tile frame now allows you to select from a number of +tile configurations, the list of frames to be tiled, a \fIfill style\fP +(left-to-right or top-to-bottom), as well as optional labels for each of +the tiles (frame number, image title or image name). + +Tile configuration will make use of all frames currently selected in the +\fITile Frame\fP group in the following manner: +.RS +.TP 15 +.B "Disabled" +Do not tile the display. +.TP 15 +.B "Manual" +Tile according to \fIManual Configuration\fP settings. +.TP 15 +.B "Best" +Optimize layout for frame buffer aspect. +.TP 15 +.B "Square" +Always force a square layout (2x2, 3x3, etc). +.TP 15 +.B "Horizontal" +Preferentially tile horizontally (6 frames ==> 3x2). +.TP 15 +.B "Vertical" +Preferentially tile vertically (6 frames ==> 2x3). +.TP 15 +.B "One Row" +Tile all in one row (Nx1). +.TP 15 +.B "One Column" +Tile all in one column (1xN). +.RE + +.SH "COORDS PANEL (NEW)" + +The Coords Panel is meant to provide a full-featured readout as well as +serve as a control panel for the various options. The display window +contains the image name/title and frame buffer info, and a selection of +coordinate and image pixel readouts. The intent is provide more infor- +mation than can fit comfortably on the main image window while still +taking up as little screen space as possible. To this end the "Options" +button is used to hide most of the feature controls when not in use (see +below). Other options on the main panel include: + +.RS +.TP 15 +.B WCS/Pix +Toggle the real-time WCS/pixel readout capability (i.e. the ISM used +to access the disk image). This must be enabled for certain other +options to work. +.TP 15 +.B "Pix Table" +Open a panel showing an image pixel table. The panel shows an array +of pixels surrounding the cursor position, either the actual pixel +values if the ISM is enabled, or scaled display values otherwise. The +size of the table may be selected from the menubar. +.TP 15 +.B Header +Display the current image header in a new panel. Both the entire image +header as well as WCS-specific parts of the header are available under +different tabs. This option is only active when the ISM is enabled. +.TP 15 +.B Compass +Draw an orientation compass on the display panner. If the ISM is enabled +and a WCS is present in the header, the compass will indicate N/E +according to the WCS, otherwise the X/Y axes of the image are drawn. +.TP 15 +.B Options +Pop-up/down the option control portion of the panel. When enabled, the +Coords Panel will change size to reveal the options which can be +changed (explained below). +.RE + +.LP +The "Readout Values" group controls the selection of WCS type, location +and format to be displayed. The "Type" menu always provides a selection +of the image Logical, Physical or World systems, which may be identical +depending on the image header. If a World system is supplied in the image +addition entries for transformations to other sky systems, (e.g. FK5 to +ICRS or galactic/ecliptic) will also be available. The selection is +dependent on whether the ISM is running as well as WCS information present +in the image. The "Format" menu allows the use to select a sexigesimal +display, conversion to degrees or radians, or whichever format is most +natural for the coordinate being display. The two toggle to the right +control whether this WCS is to be displayed on the Panel (i.e. the Coords +Panel window) or the ImgWin (i.e. the text marker on the main image +window). + +Other options below this group control whether or not to display the WCS +labels, the image name/title, and frame buffer information in the main +Coords Panel display. The "BPM Data" option controls whether or not the +ISM will try to map any bad-pixel mask associated with the image. If +enabled, a bad-pixel mask specified by the image header BPM keyword +(currently fixed by convention but this may be selectable later) will be +mapped along with the image. Aside from wcs/pixel readouts at each cursor +position, any BPM data values found will also be displayed. A non-zero +value will cause the BPM field of the Coords Panel readout as well as the +main image window marker to switch to a red background color to flag the +value. + +The last box allows the user to specify a different ISM task to be +executed or to reinitialize the current one. In most cases this won't +need to be changed, however a custom ISM could be started when using +special data formats. This command string can also be controlled by the +application "ism_task" resource. + +.SH "TCLSHELL" + +The \fITclShell\fP allows the user to type commands directly to the TCL +interpreter, letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. It is used as a +development or debugging tool for the GUI, but for an example of what it +does, bring it up and type a command such as + + \fIsend fileButton set background red\fP + + +.SH "COLORMAP SELECTION" + +By default XImtool will display images using either a grayscale colormap +(e.g. if loaded by a client), or a private colormap when loading an image +from disk that contains a colormap. Each frame defines its own colormap so +you can define different colormaps or enhancements for each frame, they +will change automatically as you cycle through the frames. + +.SS "BUILTIN COLORMAPS" + +Once loaded, the colormap may either be changed using the builtin colormap +menu under the View menu button on the main window, or from the +Enhancement box on the control panel. XImtool has about a dozen colormap +options builtin, other user-defined colormaps may optionally be loaded. +It is not presently possible to save colormaps for later use. + +.SS "USER-DEFINED COLORMAPS" + +The \fIcmap[12]\fP and \fIcmapDir[12]\fP resources (or command line +arguments) are used to tell which specific colormaps to make available or +where to look for colortables respectively. The colortables are loaded +when ximtool starts up, or when it is reinitialized (e.g. by pressing the +Initialize button in the control panel). XImtool will ignore any files in +the colormap directory which do not look like colortables. New +colortables will also be added automatically for each image loaded from +disk. + +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, and +blue values scaled to the range 0.0 (off) to 1.0 (full intensity). + + R G B + R G B + (etc.) + +Blank and comment lines (lines beginning with a '#') are ignored. + +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. XImtool will interpolate the table as necessary to +compute the colortable values used in XImtool. XImtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. + +The name of the colortable as it will appear in the XImtool control panel +is the root name of the file, e.g., if the file is "rainbow.lut" the +colortable name will be "rainbow". Lower case names are suggested to avoid +name collisions with the builtin colortables. Private colormaps for disk +images will be have the same name as the image loaded. If the same +colortable file appears in multiple user colortable directories, the first +one found will be used. + +.SS "MINIMIZING COLORMAP CONFLICTS" + +The Gterm widget used by XImtool (i.e. the main display window) uses a +private global colormap for display, this allows it to have greater +control over color cell allocation but can occasionally also cause +"colormap flashing" as the mouse is moved in and out of the application. +The problem here is that in a system with only an 8-bit colormap (256 +colors) all applications must compete for colors, programs such as XV or +Netscape allocate colors from the default colormap leaving only a few free +cells for XImtool. Since XImtool defines a private global colormap it is +still able to allocate the needed cells rather than failing, but it's +allocating cells already used by other applications. As the mouse moves +out of the ximtool window those cells are once again defined in terms of +the default colormap, so the ximtool window is then using a different +colormap. It is this switching of the colormap context that causes the +flashing to occur, but there are a few things that can be done to help +minimize this. + +XImtool logically defines 200 colors which the client image display +program can use to render pixels. However, ximtool may or may not +actually allocate all of those colors. By default it currently allocates +only about 192 colors, to reserve 64 colors for the other windows on the +screen. You don't normally notice this as 1) usually the default screen +colormap has enough free cells to allow ximtool to match the colors, and +2) the extra unallocated cells correspond to the brightest pixels in the +rendered image, and these colors may not be used or usually only +correspond to a few small regions near the saturated cores of bright +objects. + +You can eliminate this problem by setting the \fIbasePixel\fP resource to +e.g. 48 instead of 64, which will let the gterm widget allocate all 200 +colors. However, this isn't recommended for normal use as it will +increase the likelihood of colormap flashing. If you change +\fIbasePixel\fP, either restart the X server or set the resource +\fIcmapInitialize\fP=\fITrue\fP to force the gterm widget to update its +global colormap resource in the X server. The colormap resource may also +be deleted by using the command +.sp 0.7 + \fIxprop -root -remove GT_image\fP +.sp 0.7 +These options may also be set on the command line when first starting up. + +In general one can set the Gterm widget resources \fIbasePixel\fP and +\fImaxColors\fP to specify the region of colormap space to be used for +image display. If you set \fImaxColors\fP to a small value, the 200 +logical colors defined by the widget will be mapped by the imtool color +model into whatever number of colors are actually available to the +widget. For example, in the default setup, 200 color values are really +being mapped into 192 color cells used for display, the remaining colors +are used for buttons, menus etc and are allocated from the default +colormap by the X toolkit when the application starts up. + +Even though the Gterm widget uses a private colormap, it is a private +\fIglobal\fP colormap meaning that all Gterm widgets share the same +colormap. An example of colormap sharing in ximtool is the main image +window and the colorbar window. These are two separate gterm widgets that +share the same colormap. They have to share the same colormap, as +otherwise when you windowed the main image window the colorbar window +would not accurately reflect the modified colormap. By default two +separate ximtools would also share the same colormap meaning contrast +enhancements in one window would affect the other. By resetting the +\fIcmapName\fP command line option or resource you can change the name of +the private colormap used causing separate ximtools to use different +colormaps, but note this also creates colormap flashing between the two +windows that cannot easily be avoided. By setting the \fIcmapName\fR to +"default" the widget will allocate colors from the default colormap, but +this is of little use at the moment. + +There are a number of other resources that can be used to modify the +behavior of the Gterm widget color management scheme, but these are the +most useful ones. For question and further information feel free to +contact \fIiraf@noao.edu\fP. + + +.SH "DISPLAY CLIENT CONNECTIONS" + +XImtool allows display clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument or \fI*fifo\fP resource. Values should +be specified as the root pathname to a pair of fifo pipes whose last +character is 'i' or 'o', these characters will be added automatically when +opening the pipes. For example, to use the default pipes the path would +be specified as simply "/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch or +a \fI*port\fP resource. This permits connecting to the server +over a remote network connection anywhere on the Internet. +A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch or the \fI*unixaddr\fR resource. Legal values +should be specified as a filename to be used for the socket, up to two "%d" +fields are allowed and will be replaced by the userid. An empty string value +disables this connection. + +By default ximtool listens simultaneously for client connections on all three +types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + + +.SS "COMMUNICATIONS PROTOCOL" + +The communications protocol used is a slightly modified version of +that used by the IIS Model 70; other more modern protocols will likely be +supported in the future. The IIS protocol is basically a command packet +stream with a header describing the operation to be performed (select +frame, load display, read cursor, etc), and an optional data packet +containing e.g. pixels. + +Beginning with XImtool V1.3 the protocol was modified even more to allow +extra text at the end of the WCS string to define image mappings and to +better support multiple world coordinate systems within a frame. For +backwards compatability none of the existing IIS protocols were +modified completely, however we take advantage of unused registers to flag +the new features in existing functions (like read/write WCS). The WCS mapping +changes required only that the unused 'x' register be set to indicate the new +behavior was desired, e.g. the wcs text containing the extra mapping data. + +We also added two new WCS calls that allow us to query the WCS version, +or query a WCS by a specific number corresponding to a mapping. The WCS +version query will return a string such as "version=10" which can be parsed +by the client to get a version number '10' (corresponding to version 1.0). + +Because of the added mapping text the WCS string length was increased +from 320 to 1024 bytes, the string length used internally depends on whether +the 'x' register has been set. + +Support for the full 16 frames allowed by the bit-flag 'z' register +in the IIS header packet required the masking values be changed at various +places in the code. This was more a limitation of the initial implementation +than a required change to the protocol. + +A complete summary of the XImtool IIS protocol implementation follows. + + +.SS "IIS PROTOCOL SUMMARY" + +All operations are initiated by sending a +header packet containing a \fIthing id\fR (tid) and \fIsubunit\fR selecting +the function to be performed, optionally followed by data up to 32Kb long. +The IIS header packet used is defined as +.nf + \f(CWstruct iism70 { + short tid; + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; + };\fR +.fi + +The \fIthing count\fR field contains the negative number of bytes of data +that will be sent following the header packet. The IIS header checksum is +computed as +.nf +\f(CW + checksum = 0177777 - (tid + subunit + thingct + x + y + z + t); +\fR +.fi +The four IIS registers are set differently depending on the operation, a +summary of the header packets for each operation is summarized below. +.br + +.KS +.ce 1 +\fBIIS Header Packet Summary\fR +.TS +tab(:); +c c c c c c c c c. +:TID:Subunit:Tct:X:Y:Z:T:Data +.T& +l | l | l | c | c | c | l | l | l |. +:_:_:_:_:_:_:_:_ +Read Data:IIS_READ\fB|\fPPACKED:MEMORY:-NB:x:y:fr:-:NB +Write Data:IIS_WRITE\fB|\fPPACKED:MEMORY:-NB:x:y:fr:-:NB +Read Cursor:IIS_READ:IMCURSOR:-:-:-:-:-:- +Write Cursor:IIS_WRITE:IMCURSOR:-:x:y:wcs:-:- +Set Frame:IIS_WRITE:LUT\fB|\fPCOMMAND:-1:-:-:-:-:2 +Erase Frame:IIS_WRITE \fB|\fP fb:FEEDBACK:-:-:-:fr:-:- + +Old Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:-:-:fr:fb:320 +Old Read WCS:IIS_READ:WCS:-:-:-:fr:wcs:320 + +WCS Version?:IIS_READ:WCS:-:1:1:-:-:320 +WCS by Number?:IIS_READ:WCS:-:1:-:fr:wcs:1024 +New Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:1:-:fr:fb:1024 +New Read WCS:IIS_READ:WCS:-:1:-:fr:wcs:1024 +:_:_:_:_:_:_:_:_ +.TE +.KE + +.TS +l l l. +Where NB = number of bytes expected or written + x = x position of operation in frame buffer coords + y = y position of operation in frame buffer coords + fr = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 +.TE + +TID fields can be logically OR'd with the PACKED flag indicating the number +of data bytes is exactly \fIthingct\fR bytes long, otherwise \fIthingct\fR +must be specified as half the number of data bytes. In a cursor read, if +the IIS_READ flag is OR'd with IMC_SAMPLE the logical cursor position (i.e. +the last value read or set) is returned immediately, otherwise the server +will wait for a keystroke to be hit before returning a string containing the +(x,y) position, wcs of the read, and the keystroke. When setting the frame +you must send a short integer in the data containing the frame selected. + +.SH "ISM COMMUNICATIONS" + +The ISM (Image Support Module) can be any external task which +connects to XImtool over a socket. Communications are limited to simple +null-terminated text strings. In most cases these strings are just the +standard OBM messages sent to XImtool objects but can also include Tcl +callback code (either ISM-specific callbacks, procedures which can be +added to the callback list for existing XImtool objects, or even new GUI +code to create panels and new objects). + +.SS "ISM SOCKET CONNECTION" + +The ISM first requests a connection to XImtool on a dedicated +socket whose default value is "/tmp/.ISM%d", where the '%d' is replaced +by the userid allowing multiple users on a machine to have independent +sockets. The XImtool 'ism_addr' resource or "-ismdev" command-line option +can be used to change this address, a value of 'none' will disable ISM +communications. The socket may also be set with an ISMDEV environment +variable which will override the resource or command-line options. + +Once a connection request is received, XImtool replies with +a message telling the ISM to reconnect on a different socket, it then +frees the initial connection allowing multiple other ISMs to request +their own connection. The communications between XImtool and the ISM +are carried out entirely over this second negotiated socket. Once connected, +the ISM appears as just another named object which can receive OBM messages. + +.SS "COMMUNICATIONS PROTOCOL" + +Messages from the ISM are written to the connection socket and must +be preceeded by one of the following keywords: +.RS +.TP 15 +.B callback +Negotiate a connection on another socket +.TP 15 +.B ready +Client is ready to begin processing +.TP 15 +.B quit +Client is shutting down and disconnecting +.TP 15 +.B send +Send a message to another object +.RE +.sp 0.8 + +Where messages are of the form: +.RS +.TP 30 +.B connect <\fIname\fP> +Request a connection for the <\fIname\fP> ISM +.TP 30 +.B ready <\fIname\fP> +Reconnection request for the <\fIname\fP> ISM on negotiated socket, ISM is +ready to processing. +.TP 30 +.B send <\fIobj\fP> '{' <\fImsg\fP> '}' +Send <\fImsg\fP> to the named <\fIobj\fP>. The message may be any valid string that +will be understood by the recipient. The object may be any object in +the GUI or OBM (see below). +.TP 30 +.B quit +ISM is shutting down. The named is determined from the communications +channel, ISM is responsible for any cleanup of it's callbacks before +issuing the shutdown. +.RE + +All messages must be null-terminated. XImtool will buffer the text until +a complete message is received. Once an ISM client has delivered a QUIT +message no further messages will be sent the that ISM. + +In OBM terminology the ISM is a named Client class object, where the name +is set in the connection request. Messages sent to the ISM should use +this name, messages sent to "client" are still interpreted to mean the +XImtool client. + +The content of messages delivered to the ISM are totally free-form and may +contain any text the ISM is expected to understand. + +.SS "GUI OBJECTS" + +While the ISM can send a message to any object in the task, there +is a GUI Parameter object called 'ism_msg' designed especially to process +messages from the ISM. The callback in the GUI is expecting a message +beginning with one of the following keywords: +.RS +.TP 15 +.B source +Source message text as Tcl code +.TP 15 +.B alert +Message contains error text to be displayed in the GUI 'alert' box +.TP 15 +.B deliver +Message text should be passed to a callback routine specific to that ISM. +This processing callback may have been previously uploaded. The message text +may be any form the processing callback is expected to understand. +.TP 15 +.B info +Message text is status output intended for the XImtool 'info' panel +(connect/disconnect requests, etc) +.RE + +In all cases the message is expected to be of the form + + <\fIcmd\fP> <\fIism_name\fP> [ <\fIarg1\fP> <\fIarg2\fP> <...> ] + +where <cmd> is one of the above keywords, <ism_name> is the name of the +ISM sending the message. The remainder of the message is passed as an 'argv' +list to the processing callback uploaded for the ISM. The ISM is responsible +for formatting these messages. + + +.SH ENVIRONMENT +.TP 30 +.B HOME +Specifies user login directory +.sp -0.5 +.TP 30 +.B DISPLAY +Specifies which display screen to use +.sp -0.5 +.TP 30 +.B "IMTOOLRC or imtoolrc" +Frame buffer configuration file +.sp -0.5 +.TP 30 +.B "ISMDEV" +ISM Connection socket + +.TP 30 +.B "DEBUG_IIS" +Debug IIS communications packets +.sp -0.5 +.TP 30 +.B "DEBUG_ISM" +Debug ISM communications packets +.sp -0.5 +.TP 30 +.B "DEBUG_MAPPINGS" +Debug WCS image mappings +.sp -0.5 + +.SH FILES +.TP 30 +.B "/usr/local/lib/imtoolrc" +Default frame buffer configuration file +.sp -0.5 +.TP 30 +.B "/usr/local/lib/ximprint.cfg" +Default printer configuration file +.sp -0.5 +.TP 30 +.B "/usr/local/lib/imtoolcmap" +Default colormap directory +.sp -0.5 +.TP 30 +.B "/dev/imt1i" +Default input display fifo +.sp -0.5 +.TP 30 +.B "/dev/imt1o" +Default output display fifo +.sp -0.5 +.TP 30 +.B "/tmp/.IMT%d" +Default unix display socket +.sp -0.5 +.TP 30 +.B "/tmp/.ISM%d" +Default unix ISM connection socket +.sp -0.5 + +.SH BUGS +Users should report bugs to \fIiraf@noao.edu\fR. + +.SH SEE ALSO +xgterm(1), xtapemon(1) + +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/man/xtapemon.1 b/vendor/x11iraf/man/xtapemon.1 new file mode 100644 index 00000000..359c7bd3 --- /dev/null +++ b/vendor/x11iraf/man/xtapemon.1 @@ -0,0 +1,135 @@ +.\" @(#)xtapemon.1 1.1 11-Dec-96 MJF +.TH XTAPEMON 1 "11 Dec 1996" "X11IRAF Project" +.SH NAME +XTapemon \- magtape I/O status monitor and display utility for IRAF +.SH SYNOPSIS +\fBxtapemon\fP +[\-\fItoolkitoption\fP ...] [ \fI-port\fP <port> ] [ \fI\-a\fP ] [ \fI-d\fP ] +.SH OPTIONS +In addition to the X Toolkit options, the following are supported: +.TP 5 +.B "-port \fIport\fP" +Set the primary port to listen on for client connections. The default +is 5138. +.TP 5 +.B "-a" +Listen on alternate port, this is the primary port number plus one. +The default is 5139. +.TP 5 +.B "-d" +Debug mode, pass client message to the standard out. The default is false. + +.SH "X RESOURCES" +\fBXTapemon\fP options can appear on the command line or in your X +resource file. Options on the command line supercede values +specified in your X resource file. + +.TP 12 +.B "port" +Set the primary port to listen on for client connections. The default +is 5138. +.TP 12 +.B "alternate" +Listen on alternate port, this is the primary port number plus one. +The default is 5139. +.TP 12 +.B "debug" +Debug mode, pass client message to the standard out. The default is false. +.SH DESCRIPTION +.LP +Xtapemon is a magtape status monitor and display utility. You use it to +display the status of a IRAF tape job while it is running. TCP/IP sockets +are used for communication, so the IRAF tape job and xtapemon may be on +the same host machine or on different hosts. All V2.10 versions of IRAF +support tape status output (including even VMS/IRAF). For example, suppose +our workstation is named \fIcygnus\fP and we are running IRAF on host +\fIregulus\fP, using magtape device mta. The first step is to +start xtapemon on cygnus: + + % xtapemon & + +Then in IRAF on regulus we might do the following: + + cl> set tapecap = ":so=cygnus" + cl> allocate mta + cl> rewind mta + +At this point the IRAF magtape i/o driver executing on regulus should open +a connection to the xtapemon tape monitoring server running on cygnus, and +indicate that a rewind operation is taking place. + +If both xtapemon and the IRAF tape job are running on the same host then +the hostname can be omitted, e.g. "set tapecap = :so". The use of +"set tapecap" assumes that the default IRAF tapecap is being used. If +the user has a private tapecap, the syntax is + + cl> set tapecap = "<my-tapecap-file>:so=hostname" + +In general you can append any number of tapecap device capability overrides +(the :xx fields) to the tapecap environment specification. Alternatively, +the :so can be specified on the command line, e.g. + + cl> rewind "mta[:so=cygnus]" + +But in general it will be more convenient to use set tapecap. + +It is safe to have :so (status output) enabled even if there is no xtapemon +server; IRAF will try to make the connection but will proceed without any +indication of an error if the status output connection cannot be established. + + +The amount of tape read or written in Mb will be accurate only if the IRAF +magtape driver actually reads or writes all the data between the beginning +of tape and the current position of the tape. Hence, if one rewinds the +tape and then reads or writes a number of tiles, the Mb used field will be +accurate. If however one does a skip to a random file somewhere far down on +the tape, IRAF will not have read the data and the tape used field will +indicate only the data actually read or written. For example, a rewind +followed by a \fImtexamine\fP will reliably indicate the actual amount of data +on the tape, leaving the tape positioned to EOT. If one then appends new files +to the tape the tape used field will still be accurate. If however one pops +in a new tape and then appends a file at EOT, tape used will be invalid as +the drive will rapidly skip forward to the EOT. + +.SH "ADVANCED USAGE" + +By default xtapemon listens on the port 5138, called port A. If when you +start the xtapemon server this port is already busy, xtapemon will +automatically switch to port B instead (the alternate port, 5139). This +makes it possible to monitor two tape jobs at the same time. + +If you have xtapemon servers running on two ports it will be necessary to +tell the second IRAF tape job what port to use, since the magtape driver +will use port A by default. For example, + + cl> set tapecap = ":so=cygnus,5139" +or + cl> mtexamine "mta[:so=,5139]" + +If there is some problem using the builtin port defaults you can use any +port you want. The following resources tell which port to use. + + XTapemon.port # port A + XTapemon.alternate # port B + +Or you can specify the ports with the argument "-port" or "-a" (alternate) +on the command line when xtapemon is started. +.SH BUGS +You can't necessarily trust displayed information such as the device type and +tape type. On most platforms this information is taken from the tapecap +entry for the device, and the accuracy of this information will depend upon +the diligence of your IRAF system adminstrator when they configured tapecap +for your site (and on whether you use the correct logical device name for +the drive and tape capacity you are using). + +Xtapemon tries to keep track of the amount of tape used: the number of Mb +(megabytes) read or written is displayed, along with the percent of the tape +used. Whether or not the percent used field is accurate depends upon a +number of factors. First the tape capacity given in the tapecap file must +match the actual tape being used. Second, if data compression is in use on +the drive, xtapemon will display the uncompressed quantity of data written. +On a compression drive percent used can be greater than 100%! +.SH SEE ALSO +xgterm(1), ximtool(1) +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/mkarch b/vendor/x11iraf/mkarch new file mode 100755 index 00000000..ca7a24ed --- /dev/null +++ b/vendor/x11iraf/mkarch @@ -0,0 +1,182 @@ +#! /bin/csh -f +# +# MKARCH.CSH -- Install the indicated version of the binaries, i.e., +# archive the current objects and libraries, set BIN to point to bin.FFF, +# and set mkpkg to produce FFF binaries (FFF = ssun, sparc, etc.). +# Based on the IRAF hlib$mkfloat.csh script. + +set DIRS = "cdl obm obmsh vximtool xaw3d xgterm ximtool xpm xtapemon" +set new_arch = "$1" +set clean = 1 + +unalias ls rm cat grep tar cmp diff echo ln mv zcat +unset noclobber + + +# Get the current platform architecture. +set UNAME="" +if (-e /usr/bin/uname) then + set uname_cmd = /usr/bin/uname + set UNAME=`/usr/bin/uname | tr '[A-Z]' '[a-z]'` +endif +if (-e /bin/uname) then + set uname_cmd = /bin/uname + set UNAME=`/bin/uname | tr '[A-Z]' '[a-z]'` +endif + +switch ($UNAME) + case sunos: + if (`$uname_cmd -m | cut -c2-` == "86pc") then + set mach = "sunos" + else + setenv OSVERSION `uname -r | cut -c1` + if ($OSVERSION == 5) then + set mach = "ssun" + else + set mach = "sparc" + endif + endif + breaksw + case linux: + if (`$uname_cmd -m` == "ppc") then + set mach = "linuxppc" + else + if (-f /etc/redhat-release) then + set mach = "redhat" + else + set mach = "linux" + endif + endif + breaksw + case darwin: + case macosx: + case macintel: + if (`$uname_cmd -m` == "i386") then + set mach = "macintel" + else + set mach = "macosx" + endif + breaksw + case freebsd: + set mach = "freebsd" + breaksw + case cygwin: + set mach = "cygwin" + breaksw + case sunos: + set mach = "sunos" + breaksw + + case generic: + set mach = "generic" + breaksw + default: + set mach = "unknown" + breaksw +endsw + + +# Process command line options. +set cur_arch = `ls -l bin | sed -e 's+^.*bin\.++'` +if ("$1" == "-show") then + echo "System is currently configured for $cur_arch." + exit 0 + +else if ("$1" == "-arch") then + echo $cur_arch + exit 0 + +else if ("$1" == "-current") then + set new_arch = $mach + echo "Configuring X11IRAF for $new_arch..." + +else if ("$1" == "-noclean") then + set new_arch = $mach + set clean = 0 + echo "Configuring X11IRAF for $new_arch..." + +else if ($#argv > 1) then + # Get the list of directories to be changed. + shift + if ("$1" == "-d") then + set DIRS = "" + shift + while ("$1" != "") + set DIRS = "$DIRS $1" + shift + end + endif +endif + + +# See if we're already there... +if ($cur_arch == $new_arch) then + echo "System is already configured for '$new_arch'." + exit 0 +#else if ($new_arch != $mach) then +# echo "Cannot configure for '$new_arch' on a '$mach' system." +# exit 1 +endif + + +# Create the bin/lib directories if needed. +if ($new_arch != "generic") then + if (! -e bin.$new_arch) then + mkdir bin.$new_arch + endif + if (! -e lib.$new_arch) then + mkdir lib.$new_arch + endif +endif + + +# Archive the current architecture files for later use. +if ($cur_arch != "generic") then + echo "Archive and delete $cur_arch objects..." + if (-e bin.$cur_arch) then + rm -f _files + foreach i (. $DIRS) + find $i \( -name Makefile -o -name '*.[ao]' \) -print >> _files + end + tar -cf - `cat _files` | compress > bin.$cur_arch/OBJS.arc.Z + rm -f _files + + if ($clean == 1) then + echo "Cleaning Makefiles..." + rm -f Makefile */Makefile */*/Makefile + echo "Rebuilding Makefiles..." + xmkmf + make Makefiles + + echo "Cleaning..." + make clean >& /dev/null + endif + else + echo "Old objects won't be archived, no bin.$cur_arch directory found." + endif +endif + + +# Restore the old files if they exist. +if ($new_arch != "generic") then + echo "Restore archived $new_arch objects..." + if (-e bin.$new_arch/OBJS.arc.Z) then + if ({ (zcat bin.$new_arch/OBJS.arc.Z | tar -xpf -) }) then + #rm -f bin.$new_arch/OBJS.arc.Z + echo rm -f bin.$new_arch/OBJS.arc.Z + endif + else if (-e bin.$new_arch/OBJS.arc) then + if ({ (cat bin.$new_arch/OBJS.arc | tar -xpf -) }) then + #rm -f bin.$new_arch/OBJS.arc + echo rm -f bin.$new_arch/OBJS.arc + endif + else + echo "No object archive found; full sysgen will be needed." + endif +endif + + +# Set BIN to point to new directory. +rm -f bin; ln -s bin.$new_arch bin +rm -f lib; ln -s lib.$new_arch lib + diff --git a/vendor/x11iraf/obm/Imakefile b/vendor/x11iraf/obm/Imakefile new file mode 100644 index 00000000..3ee5a70f --- /dev/null +++ b/vendor/x11iraf/obm/Imakefile @@ -0,0 +1,91 @@ +XCOMM Imakefile for the Object Manager Library. +XCOMM +XCOMM Doug Tody, National Optical Astronomy Observatories, IRAF project. +XCOMM Sept93 Mar94 + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + +#define IHaveSubdirs +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + + CDEBUGFLAGS = -g + EXTRA_INCLUDES = -I. $(X11IRAF_INCLUDES) + EXTRA_DEFINES = -D_NO_PROTO + + +#if HasLargeTmp | SystemV4 + ARADD = ar ru +#else + ARADD = ar rul +#endif + + LIBDIRS = Tcl ObmW + SUBDIRS = $(LIBDIRS) + + HEADERS = Obm.h ObmP.h widget.h + SRCS = Obm.c client.c param.c server.c widget.c gterm.c marker.c \ + html.c geom.c + OBJS = Obm.o client.o param.o server.o widget.o gterm.o marker.o \ + html.o geom.o + ALL_OBJS = Tcl/[A-Za-z]*.o ObmW/[A-Za-z]*.o $(OBJS) + ALL_DONE = Tcl/DONE ObmW/DONE + RESOBJ = obmres.o + +all:: libobm.a + +World: + @echo "Building Release 1.2 of the IRAF Object Manager Library" + @date + @echo "" + $(MAKE) $(MFLAGS) Makefiles + $(MAKE) $(MFLAGS) clean + $(MAKE) $(MFLAGS) includes + $(MAKE) $(MFLAGS) depend + $(MAKE) $(MFLAGS) all + $(MAKE) $(MFLAGS) install + @date + +libobm.a: $(LIBDIRS) $(ALL_DONE) $(OBJS) + $(RM) $@ + @(cd Tcl; $(MAKE) $(MFLAGS) all X11IRAFDIR=../../) + @(cd ObmW; $(MAKE) $(MFLAGS) all X11IRAFDIR=../../) + $(AR) $@ $(OBJS) + $(ARADD) $@ $(ALL_OBJS) + RanLibrary($@) + +NormalProgramTarget (obsres,obsres.o,NullParameter,NullParameter,NullParameter) + +ForceSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +DependTarget() + +#if InstallLibraries +install-lib:: libobm.a + @(set -x; $(RM) X11irafLibDir/libobm.a) + @(set -x; $(CP) -p libobm.a X11irafLibDir/libobm.a) + +install:: libobm.a + @(set -x; $(RM) X11irafLibDir/libobm.a) + @(set -x; $(CP) -p libobm.a X11irafLibDir/libobm.a) +#endif + + +LinkFileList(linklibs,libobm.a,X11irafLibDir,ObmDir) + +includes:: + MakeDir(X11irafIncDir) + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/$$i; \ + $(CP) -p ObmDir/$$i X11irafIncDir/$$i; \ + done) + +#if InstallIncludes +install:: + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/$$i; \ + done) + for i in $(HEADERS); do \ + (set -x; $(CP) -p $$i $(DESTDIR)$(X11IRAFDIR)/include); \ + done +#endif diff --git a/vendor/x11iraf/obm/OBM.revs b/vendor/x11iraf/obm/OBM.revs new file mode 100644 index 00000000..4ed6b3cc --- /dev/null +++ b/vendor/x11iraf/obm/OBM.revs @@ -0,0 +1,350 @@ + +obm/marker.c:markerGetVertices() MF001 + When called without specifying the number of points the for loop + wouldn't execute and so no points were being returned. Changed to + loop over the ngot value to return all points found by the widget + code. (7/14/98) + +obm/marker.c:markerGetVertices() MF002 + Change the inner while loop to use *op to avoid infinite loop when + returning points. (7/14/98) + +obm/marker.c:markerGetRegion() MF003 + Change the inner while loop to use *op to avoid infinite loop + causing getRegion to hang for polygon markers. (7/29/98) + +obm/ObmW/Gterm.c:GtRefreshMapping() MF004 +obm/ObmW/Gterm.c:refresh_source() +obm/ObmW/Gterm.c:refresh_destination() +obm/ObmW/Gterm.c:GetCachedXImage() + +obm/ObmW/Gterm.c:DestroyCachedXImage() + +obm/ObmW/Gterm.c:NewCachedXImage() + + Merged in image cache code from SAORD for speeding up the magnifier + marker. This doesn't appear to have any major impact on the memory + requirements, but still it can be disabled via a #define CacheXImage + at the top of the file. Corresponds to SAOMOD_CACHE (7/31/98) + +obm/ObmW/Gterm.c:GtExtractPixmap() MF005 + Added a missing GtermWidget arg to GtDestroyRaster call (7/31/98) + +obm/ObmW/Gterm.c:GtExtractPixmap() MF006 +obm/ObmW/Gterm.c:GtInsertPixmap() + Added a missing RasterDepth arg to GtCreateRaster call (7/31/98) + +obm/ObmW/Gterm.c:GtCopyRaster() MF007 + Changed declaration for sv_mp, p_mp from Mapping to 'struct mapping' + so the agree with argument declaration type. Pre- viously routines + were being called with struct mapping ** instead of struct mapping * + (7/31/98) + +obm/ObmW/Gterm.c:Destroy() MF008 + Changed arg to GtRasterInit from 'gw' to 'w' so types agree. + (7/31/98) + +obm/ObmW/Gterm.c:gm_refocus() MF009 + Added an event type. This was the SAOMOD_PURIFY change, seemed + harmless. + +obm/ObmW/Gterm.c:M_set() MF010 + Removed XtArgVal cast of arg 2 for GmSetAttribute to agree with + function declaration. + +obm/ObmW/Gterm.c:GtSetMapping() MF011 + Not sure I should have changed this, but Eric claims it fixes a bug + although he can't remember the details. SAOMOD_BUG. + +obm/ObmW/Gterm.c:Initialize() MF012 + Added an initialization for gterm.n_wmWindows. According to Eric + this was done to fix a segvio that was never completely understood. + Even though the procedure doesn't initialize the variable it appears + to be properly set the first time the window gets a focus request so + the problem must be elsewhere, this seemed harmless so it was added + anyway. SAOMOD_MAYBE_FOCUS + +obm/ObmW/Gterm.c:GmSetVertices() MF013 + Changed the test to be an inequality rather than a greater than. + What would happen is that if a call was made with fewer points than + currently in the struct the gm->npoints value would be wrong. (e.g. + polygon markers are initialized with 4 points in a unit box, creating + a triangle marker causes a getVertices OBM call to return the wrong + number of points). + +obm/ObmW/Gterm.c:gm_select() MF014 +obm/ObmW/Gterm.c:gm_circ_init() MF015 +obm/ObmW/Gterm.c:gm_circ_updatePolygon() MF015 +obm/ObmW/Gterm.c:gm_elip_init() MF015 +obm/ObmW/Gterm.c:gm_elip_updatePolygon() MF015 + Two connected bugs: The symptom was that when changing a marker + back and forth between shapes, e.g. a rect and a circle, the marker + would lose the ability to determine focus when the mouse was moved + into it when going from a rect->circle->rect. The first bug was + that the value of ptop in gm_select() was pointing out of bounds + for the point array. Initially this would be a zero point and the + algorithm would coincidentally trap this and exit as expected, but + when you go from a circle back to a rect the point array still con- + tains the circle vertices so the algorithm was checking an invalid + line segment and finding a second crossing point and thus failing. + When ptop was set to point at the last element correctly the circle + marker suddenly lost focus: this was because the polygon points + computed for a circle is already closed, the updatePolygon and init + routines were defining an extra point to close the poly which wasn't + needed, in gm_select this produced another erroneous crossing + causing the selection to fail. Modified to use only GM_NPTSCIRCLE + points. + +obm/widget.c:widgetGet() MF016 +obm/widget.c:widgetGetFontName() + MF016 + To help with finding portable font settings I added some new code + to return an XLFD font string allowing the user to now do a "get + font" on a widget and return a readable font string. + +obm/ObmW/Gterm.c:gm_elip_updatePolygon() MF017 + The ellipse vertices were being calculated with too few points + causing a "stray" line segment when drawing a rotated ellipse. + Connected to MF015 + +obm/ObmW/Gterm.c:GmSetVertices() MF018 + When a polygon marker is created the pgon_points array is init- + ialized to a unit box, this array isn't updated with a setVertices + call later so when the marker visibility is turned on the marker + still appears as the unit box. + +obm/ObmW/Gterm.c: MF019 + Big change involving the rotation of markers: Previously when a + marker was rotated by grabbing a knot the rotation angle would + be the angle of the knot being used. This means that a square + marker with an initial zero rotation would suddenly have a rot- + angle of 45 if the user grabbed and then released the upper-right + corner, but the marker is still drawn at an angle that looks close + to zero. This could be corrected once the button is released but + not without adding another procedure (or by muddling up the markpos + procedure) and requiring it to be called on a BtnUp event. Rot- + ations were also defined in a clockwise direction and angles had + to be specified in radians. + The changes made are that 1) angles are now read/written by + the GUI in (a more natural) degrees, angles are converted inter- + nally for computation. 2) Rotation is now defined such that zero + degrees is to the right, 90 degrees is up. 3) Marker rotation is + done using the model that the user is dragging the zero axis about + the marker (x,y) pos. When the rotation is begun the marker rotates + so that the zero axis is pointing at the knot chosen, thereafter the + is set as before. This means that w/ a square marker selecting the + upper-right knot and releasing would leave the marker drawn at what + looks like the correct 45 degrees. + +obm/ObmW/Gterm.h: MF020 +obm/ObmW/GtermP.h: MF020 +obm/ObmW/Gterm.c:gm_rotate_indicator() + MF020 + Added a new 'rotIndicator' marker attribute as an option to draw + a little clock-hand indicator showing the previous and current + rotation angle. Added a gm_rotate_indicator() procedure. + +obm/ObmW/HTML.c: MF021 + Changed the declaration of the in_anchor_cursor so it's no longer + static. Previously repeated invocations of a GUI would cause the + cursor to not change shapes when entering an anchor because it was + not being initialized properly. + +obm/ObmW/Gterm.c:GmSetAttribute() MF022 +obm/ObmW/Gterm.c:GmGetAttribute() + Changed the rotangle input to automatically convert from degrees + to radians, which is what's used internally. Previously setting + any angle would be interpreted initially to be in radians and the + resulting display would be wrong. Similarly the output angle was + converted from radians to degrees for readability. + +obm/ObmW/HTML.c:HTMLAnchorToId() MF023 + Modified so that internal links can be of the form "name=foo" or + "name=#foo". + +obm/html.c:htmlIdToPosition() MF024 +obm/html.c:htmlAnchorToPosition() +obm/html.c:htmlGetHRefs() +obm/html.c:htmlGetImageSrcs() +obm/html.c:htmlGetLinks() +obm/html.c:htmlSearchText() + The Tcl_SetVar calls had arguments reversed preventing the result + from being returned correctly. + +obm/Imakefile MF025 + Typo was preventing libobm.a from being updated correctly when not + building form pure source. + +obm/ObmW/HTML.c:setScrollbar() MF026 + Changed the size of the 'topPosition' arg from Position to int. + Position is typedef'd as short and for very long HTML docs the + position exceeds the 32K short and you get a negative value which + incorrectly positions the scrollbar. + +obm/ObmW/Gterm.c:Gm[SG]etVertices() MF027 + The set/getVertices and getRegions functions were changed so that + in the case of a polygon the setVertices call will close the polygon + regardless of whether the user has alread done so. To be consitent + the 'get' routines will not return the closing point, i.e. N points + in and N points out. + +obm/ObmW/Gterm.c:gm_circ_updatePolygon() MF028 + The points array for a circle was being fully populated so when + searching through all points you would come across (0,0) values + while was throwing off the gm_select routine. Also added an abs() + call to the edge detection for safe measure. + +obm/ObmW/Gterm.c:Initialize() MF029 + Added a XSetGraphicsExposures() call to the exposeGC to disable + expose events. It was noticed in the CTIO guider project that + there was a memory leak in ximtool. The leak was traced to an + XCopyArea call in refresh_destination. This was noticed because + the application is displaying many thousands of images in an anim- + ation sequence. With each refresh an Expose/NoExpose event was being + generated which was building up in the event queue (which was never + read) at a cost of ~100 bytes each. Adding the call disables the + events which are normally on by default. + +obm/ObmW/Gterm.c:Initialize() MF030 + Commented out the XRecolorCursor calls for the idle and busy cursors. + There was a problem with xgterm blowing itself away when doing many + gflushes in a short time span. This was traced to a buildup of + BadCursor errors that eventually hit the limit in xerror() and the + program died. It's not clear why this is happening but the benefits + of these calls were minimal .... + +obm/html.c:htmlSetSelection() MF031 +obm/html.c:htmlSearchText() +obm/ObmW/HTML.c:HTMLSearchText() + Minor bug fixes to the HTML text search code. The searchText routine + now will incrementally find the next occurrence of the pattern in the + text and wrap around the page if necessary. The start location + automatically resets if the pattern changes. + +obm/ObmW/Gterm.c MF032 + Added a return to the blink_cursor() procedure so that when not in + ginmode no new timer would be started. This was necessary to avoid + having multiple timers running which would apparently make the cursor + blink faster and gradually put an increasing load on the process. + +obm/ObmP.h MF033 + Added definitions for the MenuBar widget which was defined but not + recognized as an object for receiving messages. + +obm/ObmP.h MF034 +obm/obmres.c +obm/obmres.dat +obm/widget.c +obm/ObmW/Tabs.c + +obm/ObmW/Tabs.h + +obm/ObmW/TabsP.h + +obm/ObmW/Gcs.c + +obm/ObmW/Gcs.h + +obm/ObmW/Imakefile +obm/listres/AllWidgets.c +guidemos/tabs.gui + Added a new Tabs widget which creates index tabs on widgets similar to + what's seen on many PC configuration panels. Basically each child + widget would be something like a Layout/Group or Frame and as each index + tab is selected that child is brought to the top and displayed. Each + child defines a new 'tabLabel' resource string to give the label to be + written to the Tab for that widget. See tabs.gui for an example in the + x11iraf$guidemo directory. + +obm/ObmW/Gterm.c MF035 + Added an initialize_mapping for the sv_mp struct in various routines. + This was first noticed as a failure in the GtCopyRaster routine which + would fail with a "cannot malloc" error because the sv_mp->datalen and + sv_mp->update elemets contained garbage. Once the struct was saved + GtCopyRaster would subsequently call get_pixel_mapping() which then + did the fatal alloc. It was only in GtCopyRaster that the update flag + was explicitly set where this would be a problem. (2/29/00) + +obm/geom.c MF036 + Commented out a call to XGetVisualInfo. The results weren't being used + and the pointer returned was never freed causing a small memory leak. + (3/2/00) + +obm/server.c MF037 +obm/ObmW/icon.c + Added an XtFree() to free the resource list. Another memory leak. + (3/2/00) + +obm/ObmW/Label.c MF038 + Added an XDestroyRegion to free space allocated in the expose call. + (3/2/00) + +xaw3d/Text.c MF039 +xaw3d/TextTr.c + Modified the code to make _XawDefaultTextTranslations a static array + rather than one allocated and never freed. Required changes to the + array declaration in TextTr.c, and textClassRec definition and + ClassInitialize() procedure. (3/2/00) + +obm/ObmW/Gterm.c MF040 + Added an XFree for the visual info struct in get_colormap. (3/2/00) + +obm/ObmW/Gterm.c MF041 + Added a check for raster=0 when setting the logical resolution. This + is the fix for the cursor positioning bug where the frame buffer is + larger than the screen image. (3/2/00) + +obm/Tcl/Imakefile MF042 + Removed some warning flags requested for Linux. (3/3/00) + +obm/ObmW/Gterm.c + Removed the comment chars for XRecolorCursor first done for MF030. + While these do trigger BadCursor errors these will now be ignored by + the xgterm error handler. (4/7/00) + +obm/server.c + Changed a malloc to a calloc call for the timer struct. Also deleted + an XtFree for the callback in serverTimedProc() which would corrupt + memory if the timer callback were later deleted. (7/28/00) + +obm/ObmP.h +obm/Obm.c + Added support for a new environent variable OBMOBJECTS which will help + restrict the messages printed during debugging. For example, it can be + set as + + setenv OBMOBJECTS "client imagewin" + + to have OBMDEBUG print only messages for the 'client' and 'imagewin' + objects. (8/3/00) + +obm/widget.c + Added a new 'setTop' command for the Tabs widget that can be used to + raise a particular tab from within the GUI. (8/29/00) + +obm/server.c + Commented out an XtFree() on a static array ('table') (03/05/01) + +obm/ObmP.h MF043 +obm/obmres.c +obm/obmres.dat +obm/widget.c +obm/ObmW/ListTree.c + +obm/ObmW/ListTree.h + +obm/ObmW/ListTree.h + +obm/ObmW/Imakefile +obm/listres/AllWidgets.c + Added a new ListTree widget which creates an indented list of items + in a user defined hierarchy. Selecting an item "opens" it to reveal + lower level lists. The selection callback returns the selected item + label, it's level, and a full path of all parent items. The widget + can used for things like directory browsers, or organizing documentation + into sections, subsections, etc. (8/26/02) + + +obm/ObmP.h +obm/obmres.c +obm/obmres.dat +obm/widget.c +obm/OBMW/Table.c +obm/OBMW/Table.h +obm/OBMW/color.c +obm/OBMW/TableP.h +obm/OBMW/Table3d.c +obm/OBMW/Table3d.h +obm/OBMW/TableUtil.c +obm/OBMW/TableUtil.h + Added a new Table widget and support code. The Table widget supports a + grid layout of data items with col/row selection and cell editing. It + is a bit primitive so additional code was added to improve functionality. + (09/10/02) diff --git a/vendor/x11iraf/obm/Obm.c b/vendor/x11iraf/obm/Obm.c new file mode 100644 index 00000000..d9f5e7c5 --- /dev/null +++ b/vendor/x11iraf/obm/Obm.c @@ -0,0 +1,1039 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#define Obm_Main +#include <ObmP.h> + +/* + * OBM.C -- Object manager for the graphics subsystem. + * + * obm = ObmOpen (app_context, argc, argv) + * ObmClose (obm) + * ObmInitialize (obm) + * ObmActivate (obm) + * ObmDeactivate (obm, unmap) + * status = ObmActivated (obm) + * status = ObmStatus (obm, app_name, app_class) + * status = ObmDeliverMsg (obm, object, message) + * st = ObmDeliverMsgFromFile (obm, object, fname) + * interp = ObmGetInterp (obm) + * + * Callbacks: + * + * id = ObmAddCallback (obm, callback_type, fcn, client_data) + * ObmRemoveCallback (obm, id) + * + * connect_callback (client_data, display, toplevel, state) + * activate_callback (client_data, toplevel) + * deactivate_callback (client_data, toplevel) + * setGterm_callback (client_data, gterm_widget) + * clientOutput_callback (client_data, tcl, key, string) + * + * The callback type bitflags are defined in <Obm.h> as OBMCB_connect, + * OBMCB_activate and so on. + * + * An xgterm graphics user interface (UI) consists of one or more windows + * containing an arbitrary hierarchy of widgets. These widgets and their + * runtime actions are defined by an interpreted text program downloaded + * by the client application, which does not itself deal directly with + * the window user interface. + * + * The object manager provides a higher level of abstraction for dealing + * with widgets and other UI objects. The main function of the object + * manager is to deliver messages to UI objects. Each instance of a widget + * is an object in the UI. The UI contains other types of objects however, + * including the client object (client application), the server object + * (the object manager itself), and the application specific UI parameters, + * each of which is an object with a callback list of UI procedures to be + * called when the parameter value changes. All of these UI objects can + * receive messages and take actions as a result. Messages may come from the + * client application, or as a result of actions executed by the interpreted + * UI code in response to graphics events. + * + * Object classes: + * + * Client the client application + * Server the object manager itself + * Parameter UI control parameter + * Gterm widget graphics terminal widget + * Vterm widget vt100 terminal widget + * various Xt and Athena widgets box, shell, label, text, list, etc. + * + * In addition to delivering messages to objects (ObmDeliverMsg), one of the + * functions of the object manager is to manage the hierarchy of widgets + * comprising the UI. ObmOpen opens the object manager. ObmInitialize + * initializes the object manager, destroying any existing widget hierarchy. + * ObmActivate readies the UI to receive graphics output and graphics input + * events, creating a default UI if none has been downloaded by the client. + * + * Sophisticated graphics applications will download a UI during initialization + * to define a custom graphics user interface. This is done by sending a + * message to the object manager. Naive applications assume a simple graphics + * terminal and do not download a UI; in this case, a default UI is created + * for the application when the UI is enabled with ObmEnable. The default + * UI is a single top level shell window containing a single gterm (graphics + * terminal) widget. + * + * reset-server + * appInitialize appname classname {resources} + * createObjects + * (UI specific code) + * activate + * + * A UI specification consists of a sequence of commands to be executed by + * the server object. This is downloaded by the client as a message for the + * server object. The commands should include "reset-server" (this must be + * the first executable command), "appInitialize" (defines the UI objects and + * their resources), and "createObjects" (creates the objects and the widget + * tree), followed by any UI specific commands to define and register UI + * callback procedures. Finally, "activate" is executed to activate the new + * user interface. + */ + +#define MAXOBJ 512 +static void obm_call_activate_callbacks(); + + +/* ObmOpen -- Open the object manager. + */ +ObmContext +ObmOpen (app_context, argc, argv) +XtAppContext app_context; +int argc; +char *argv[]; +{ + register ObmContext obm; + register ObjClassRec classrec; + register int i; + char *s; + + /* Initialize object manager global context. */ + obm = (ObmContext) XtCalloc (1, sizeof (struct obmContext)); + strcpy (obm->appname, "gterm-iraf"); + strcpy (obm->appclass, "Xgterm"); + obm->app_context = app_context; + obm->argc = argc; + obm->argv = argv; + obm->debug = ((s = getenv("OBMDEBUG")) != NULL); + if (s && (i = atoi(s))) + obm->debug = i; + if (s = getenv("OBMOBJECTS")) { + obm->debug_objs = (char *) XtCalloc (1, strlen(s)+1); + strcpy (obm->debug_objs, s); + } else + obm->debug_objs = (char *)NULL; + + + /* Initialize object classes. */ + for (i=0; i < XtNumber(UiObjects); i++) { + classrec = &UiObjects[i]; + if (classrec->ClassInit) + (*(classrec->ClassInit)) (obm, classrec); + } + + /* Create new server and client objects. */ + ObmInitialize (obm); + + return (global_obm_handle = obm); +} + + +/* ObmClose -- Close the object manager. + */ +void +ObmClose (obm) +ObmContext obm; +{ + register ObjClassRec classrec; + register int i; + + /* Get rid of any current UI. */ + ObmInitialize (obm); + while (obm->head) + obmDestroyObject (obm, obm->head); + + /* Delete any callback descriptors. */ + while (obm->callback_list) + obmRemoveCallback (&obm->callback_list, obm->callback_list); + + /* Free any resources associated with the class descriptors. */ + for (i=0; i < XtNumber(UiObjects); i++) { + classrec = &UiObjects[i]; + (*(classrec->ClassDestroy)) (obm, classrec); + } + + if (obm->debug_objs) + XtFree ((char *)obm->debug_objs); + XtFree ((char *)obm); +} + + +/* ObmInitialize -- Initialize the object manager, i.e., destroy any existing + * user interface. + */ +void +ObmInitialize (obm) +register ObmContext obm; +{ + register ObmObject obj, nextobj; + register ObmCallback cb; + register MenuItem ip; + ObjList lp, lp_next; + Menu mp; + int i; + + /* Destroy the UI object tree. We need to be a little careful how + * we do this as objects like to destroy child objects, execute + * destroy callbacks, unmap windows, perform geometry requests, etc. + * during destruction. The widget class code can most efficiently + * destroy the widget tree if destroy the toplevel widget first, + * so we unmap the GUI and destroy the toplevel widget-class object + * first. Then we destroy whatever else is left. + */ + obm->being_destroyed++; + if (obj = obmFindObject (obm, "toplevel")) { + obmUndisplay (obm, obj); + obmDestroyObject (obm, obj); + } + while (obm->head) + obmDestroyObject (obm, obm->head); + + /* Free any cached pixmaps. */ + for (lp = obm->pixmap_cache; lp; lp = lp_next) { + lp_next = lp->next; + freeIcon (obm, (Icon *) lp->ptr); + XtFree ((char *)lp); + } + obm->pixmap_cache = NULL; + + /* Free any cached cursors. */ + for (lp = obm->cursor_cache; lp; lp = lp_next) { + lp_next = lp->next; + XFreeCursor (obm->display, (Cursor)lp->ptr); + XtFree ((char *)lp); + } + obm->cursor_cache = NULL; + + /* Free any menu lists. */ + for (lp = obm->menu_list; lp; lp = lp_next) { + lp_next = lp->next; + freeMenu ((MenuPtr) lp->ptr); + } + obm->menu_list = NULL; + + /* Close the application specific display connection. */ + if (obm->display) { + /* Call the client's display connection callbacks if any to + * inform the client that we are about to close the display. + */ + for (cb = obm->callback_list; cb; cb = cb->next) + if ((cb->callback_type & OBMCB_connect) && cb->u.fcn) + (*cb->u.fcn) (cb->client_data, obm->display, NULL, 0); + + XFlush (obm->display); + XtCloseDisplay (obm->display); + obm->display = NULL; + } + + /* Reinitialize the global context. */ + memset ((void *)obm->objindex, 0, sizeof(obm->objindex)); + strcpy (obm->appname, "gterm-iraf"); + strcpy (obm->appclass, "Xgterm"); + obm->head = obm->tail = NULL; + obm->being_destroyed = 0; + obm->toplevel = NULL; + obm->specified = 0; + obm->activated = 0; + obm->mapped = 0; + + /* Free any callbacks that don't have the OBMCB_preserve flag set. */ + for (cb = obm->callback_list; cb; cb = cb->next) + if (!(cb->callback_type & OBMCB_preserve)) + obmRemoveCallback (&obm->callback_list, cb); + + /* Create new server and client objects. */ + obmNewObject (obm, "server", "Server", NULL, NULL, 0); + obmNewObject (obm, "client", "Client", NULL, NULL, 0); +} + + +/* ObmActivate -- Activate the UI, i.e., ensure that it is active and in + * such a state as to be ready for client i/o. + */ +void +ObmActivate (obm) +register ObmContext obm; +{ + register ObmObject obj; + char defaultUI[SZ_MESSAGE]; + + /* UI has already been activated? */ + if (obm->activated) { + if (!obm->mapped) { + if (obj = obmFindObject (obm, "toplevel")) + obmDisplay (obm, obj); + obm->mapped++; + + /* Call activate callbacks after UI has been realized. */ + obm_call_activate_callbacks (obm, 1); + } + return; + } + + if (!obm->specified) { + /* Construct a UI specification for the default UI. */ + sprintf (defaultUI, "%s %s %s {%s.objects: %s%s%s%s%s}; %s; %s\n", + "appInitialize", obm->appname, obm->appclass, + obm->appclass, "toplevel Gterm gterm\n", + ".geometry: 640x480\n", + "*gterm.warpCursor: True\n", + "*gterm.raiseWindow: True\n", + "*gterm.deiconifyWindow: True\n", + "createObjects", + "send gterm setGterm\n"); + + /* Call the server to configure the default UI. */ + ObmDeliverMsg (obm, "server", defaultUI); + } + + /* Realize the toplevel widgets. */ + if (obj = obmFindObject (obm, "toplevel")) + obmDisplay (obm, obj); + + obm->activated++; + obm->mapped++; + + XFlush (obm->display); + obm_call_activate_callbacks (obm, 1); +} + + +/* ObmDeactivate -- Deactivate the UI. Optionally unmap the UI widget + * tree and execute any deactivate callback registered by the Obm client. + * Deactivation does not affect the state of the UI, i.e. a reactivate + * will cause the UI to resume execution in the same state at which it + * was deactivated. + */ +void +ObmDeactivate (obm, unmap) +register ObmContext obm; +Boolean unmap; +{ + register ObmObject obj; + register ObmCallback cb; + ObmFunc deactivate; + + /* The Obm "activated" flag is not affected by deactivation. + * Deactivation merely means that control has temporarily been + * returned to the caller. If the activate flag has not been set + * that means we do not yet have a UI to deactivate. + */ + if (!obm->activated) + return; + + /* Call any client deactivate callbacks before unrealizing the UI. */ + obm_call_activate_callbacks (obm, 0); + + if (unmap) { + if (obj = obmFindObject (obm, "toplevel")) + obmUndisplay (obm, obj); + obm->mapped = 0; + } + + XFlush (obm->display); +} + + +/* obm_call_activate_callbacks -- Internal procedure to search the callback + * lists and call any activate/deactivate callbacks. + */ +static void +obm_call_activate_callbacks (obm, state) +register ObmContext obm; +int state; +{ + register ObmCallback cb; + register int type; + + /* Call any client activate callbacks. */ + type = state ? OBMCB_activate : OBMCB_deactivate; + for (cb = obm->callback_list; cb; cb = cb->next) + if ((cb->callback_type & type) && cb->u.fcn) + (*cb->u.fcn) (cb->client_data, obm->toplevel, state); + + /* Call any GUI activate callbacks. */ + type = state ? OBMUI_activate : OBMUI_deactivate; + for (cb = obm->callback_list; cb; cb = cb->next) + if (cb->callback_type & type) { + char message[SZ_NUMBER]; + int status; + + sprintf (message, "%d", state); + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + message, " ", + NULL); + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in activate: %s\n", + obm->tcl->errorLine, + errstr ? errstr : obm->tcl->result); + } + } +} + + +/* ObmActivated -- Test whether the GUI is activated, i.e., both defined + * and mapped. + */ +ObmActivated (obm) +register ObmContext obm; +{ + return (obm->activated && obm->mapped); +} + + +/* ObmStatus -- Get the Object Manager status. + */ +ObmStatus (obm, app_name, app_class) +register ObmContext obm; +char *app_name; +char *app_class; +{ + if (obm->specified) { + if (app_name) + strcpy (app_name, obm->appname); + if (app_class) + strcpy (app_class, obm->appclass); + + if (obm->activated) + return (obm->mapped ? OBM_ACTIVE : OBM_IDLE); + } + + return (OBM_INITIALIZED); +} + + +/* ObmGetInterp -- Get the main OBM (server object) interpreter. This can + * be used, e.g., by the calling program to extend the Tcl environment seen + * by the GUI code. + */ +XtPointer +ObmGetInterp (obm) +register ObmContext obm; +{ + return ((XtPointer)obm->tcl); +} + + +/* ObmDeliverMsg -- Deliver a message to a UI object. + */ +ObmDeliverMsg (obm, object, message) +register ObmContext obm; +char *object; +char *message; +{ + register ObmFunc evaluate; + register ObmObject obj; + int status = TCL_ERROR; + + if (obm->debug) { + if (!obm->debug_objs || strstr (obm->debug_objs, object) != NULL) { + printf ("%s: %s\n", object, message); + fflush (stdout); + } + } + + + /* Note -- the following can execute appInitialize, which initializes + * the server and creates a new Tcl, so no server context (such as + * obm->tcl) should be stored in an internal variable here unless + * updated or not used again after the evaluate call. + */ + Tcl_SetResult (obm->tcl, "", TCL_STATIC); + if (obj = obmFindObject (obm, object)) { + if (evaluate = obj->core.classrec->Evaluate) { + status = (*evaluate)(obj, message); + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error in message to %s, line %d: %s\n", + object, obm->tcl->errorLine, + errstr ? errstr : obm->tcl->result); + } + } else + status = TCL_OK; + } else { + Tcl_AppendResult (obm->tcl, + "send: could not find object ", object, NULL); + status = TCL_ERROR; + } + + return (status); +} + + +/* ObmDeliverMsgFromFile -- Deliver a message to a UI object, taking the + * message from the named text file. + */ +ObmDeliverMsgFromFile (obm, object, fname) +register ObmContext obm; +char *object; +char *fname; +{ + struct stat fs; + char *message = NULL; + int status, nchars; + int fd = -1; + + if (stat (fname, &fs) >= 0) { + nchars = fs.st_size; + if ((message = (char *) XtMalloc (nchars + 1)) == NULL) + goto err; + if ((fd = open (fname, 0)) < 0) + goto err; + if (read (fd, message, nchars) != nchars) + goto err; + + message[nchars] = '\0'; + status = ObmDeliverMsg (obm, object, message); + + close (fd); + XtFree ((char *)message); + return (status); + } +err: + printf ("cannot access file %s\n", fname); + if (fd >= 0) + close (fd); + if (message) + XtFree ((char *)message); + return (TCL_ERROR); +} + + +/* ObmAddCallback -- Add a callback of the given type to the OBM global + * callback list. + */ +XtPointer +ObmAddCallback (obm, callback_type, fcn, client_data) +register ObmContext obm; +int callback_type; +ObmFunc fcn; +XtPointer client_data; +{ + register ObmCallback cb; + + if (!(cb = obmAddCallback (&obm->callback_list))) + return (NULL); + + cb->u.fcn = fcn; + cb->callback_type = callback_type; + cb->client_data = client_data; + cb->name[0] = '\0'; +} + + +/* ObmRemoveCallback -- Remove a callback from the OBM global callback list. + */ +void +ObmRemoveCallback (obm, callback) +register ObmContext obm; +ObmCallback callback; +{ + obmRemoveCallback (&obm->callback_list, callback); +} + + +/* + * Object manager internal routines. + * ---------------------------------- + */ + +/* obmFindObject -- Lookup an object by name and return a pointer to the + * associated object descriptor. If the object name is unique only the object + * name need be given, otherwise a name such as "parent1.parent2...object" + * may be given to specify which object to use. + */ +ObmObject +obmFindObject (obm, object) +ObmContext obm; +char *object; +{ + register int hashval, n; + register char *ip, *op; + ObmObject objlist1[MAXOBJ], objlist2[MAXOBJ]; + ObmObject obj, *otemp, *objs, *pobjs; + char name[SZ_NAME]; + int nobjs; + + if (object == NULL) + return (NULL); + + objs = objlist1; + pobjs = objlist2; + pobjs[0] = objs[0] = NULL; + nobjs = 0; + + for (ip=object; *ip; ) { + /* List of objects from last run becomes the list of parent objects + * for the current run. + */ + otemp = pobjs; + pobjs = objs; + objs = otemp; + + /* Get next object name. */ + for (op=name; *ip; ) { + if (*ip == '.') { + ip++; + break; + } else + *op++ = *ip++; + } + *op = '\0'; + + /* Get list of candidate objects. */ + if (obm_nameToObjectList (obm, name, pobjs, &nobjs, objs) == 0) + return (NULL); + } + + if (nobjs <= 0) + return (NULL); + else if (nobjs > 1) + fprintf (stderr, "ambiguous object name: %s\n", object); + + return (objs[0]); +} + + +/* obm_nameToObjectList -- Return a list of objects with the given name which + * are children of one of the (possibly empty) list of parent objects. If the + * parent object list is empty the list of all objects with the given name + * is returned. + */ +obm_nameToObjectList (obm, object, pobjs, nobjs, objs) +ObmContext obm; +char *object; /* object name */ +ObmObject *pobjs; /* list of parent objects */ +int *nobjs; /* number of objects found (output) */ +ObmObject *objs; /* list of objects (output) */ +{ + register char *ip; + register int hashval, n; + register ObmObject obj; + int accept, i; + + if (object == NULL) + return (0); + + /* Compute hash value. */ + for (hashval=0, ip=object, n=MAX_HASHCHARS; --n >= 0 && *ip; ip++) + hashval += (hashval + *ip); + if (hashval < 0) + return (0); + + /* Examine any objects on the hash thread. */ + obj = obm->objindex[hashval%SZ_INDEX]; + for (n=0; obj; obj=obj->core.nexthash) { + if (strcmp (object, obj->core.name) == 0) { + accept = 0; + if (pobjs && pobjs[0]) { + for (i=0; pobjs[i]; i++) + if (obj->core.parent == pobjs[i]) { + accept++; + break; + } + } else + accept++; + + if (accept) + objs[n++] = obj; + } + } + + objs[n] = NULL; + return (*nobjs = n); +} + + +/* obmNewObject -- Create a new object of the given type. + */ +void +obmNewObject (obm, name, class, parent, args, nargs) +register ObmContext obm; +char *name; /* name of new object */ +char *class; /* name of class to which object belongs */ +char *parent; /* name of parent widget, for widget objects */ +ArgList args; /* optional argument list */ +int nargs; /* optional argument list */ +{ + register char *ip; + register int hashval, n; + ObmObject newobj, obj, pobj; + ObjClassRec classrec; + + if (obm->being_destroyed) + return; + + /* Ignore the request if parent is being destroyed. */ + pobj = obmFindObject (obm, parent); + if (parent && (!pobj || pobj->core.being_destroyed)) + return; + + /* Get class record. */ + if (!(classrec = obmGetClassrec (class))) { + fprintf (stderr, "obm: object %s has unknown class %s\n", + name, class); + return; + } + + /* Create the object. */ + + newobj = (ObmObject) (*(classrec->Create)) (obm, + name, classrec, parent, args, nargs); + if (!newobj) { + fprintf (stderr, "obm: could not create object %s class %s\n", + name, class); + return; + } + + strcpy (newobj->core.name, name); + newobj->core.classrec = classrec; + newobj->core.parent = pobj; + + /* Link the object into the object list. */ + if (!obm->head) + obm->head = newobj; + if (newobj->core.prevglob = obm->tail) + obm->tail->core.nextglob = newobj; + obm->tail = newobj; + + /* Compute hash value. */ + for (hashval=0, ip=name, n=MAX_HASHCHARS; --n >= 0 && *ip; ip++) + hashval += (hashval + *ip); + + /* Enter the object into the hash table. */ + if (obj = obm->objindex[hashval%SZ_INDEX]) { + while (obj->core.nexthash) + obj = obj->core.nexthash; + obj->core.nexthash = newobj; + } else + obm->objindex[hashval%SZ_INDEX] = newobj; + + /* Add the object to the parent's list of children. */ + if (parent) { + ObmObject pobj; + ObmObjectCore cp; + + if ((pobj = obmFindObject (obm, parent)) == NULL) { + fprintf (stderr, "obm: object %s has unknown parent %s\n", + name, parent); + return; + } else + cp = &pobj->core; + + if (cp->nchildren) { + cp->children = (ObmObject *) XtRealloc ((char *)cp->children, + (cp->nchildren + 1) * sizeof(ObmObject)); + } else + cp->children = (ObmObject *) XtMalloc (sizeof(ObmObject)); + + cp->children[cp->nchildren++] = newobj; + } +} + + +/* obmDestroyObject -- Destroy an object and all its descendents. + */ +void +obmDestroyObject (obm, object) +ObmContext obm; +ObmObject object; +{ + register ObmObjectCore cp = &object->core; + register ObmObject obj; + register int i; + int hashval, n; + char *ip; + + if (!object) + return; + if (object->core.being_destroyed) + return; + + /* Destroy the object instance itself. The object destroy class + * method is called twice when an object is destroyed, once at the + * beginning before any children are destroyed and once at the end + * after all children have been destroyed and the object descriptor + * has been unlinked from all Obm object data structures. It is + * up to the Destroy class method for the object to decide how much + * of the object to destroy in each call. Most objects just set a + * being_destroyed flag in the first call and wait until the end + * to destroy the object, in case the object descriptor is referenced + * during the destroy process. An example of a class which does + * things differently is the widget class. In the case of a widget + * the first call destroys the widget and all of its children, even + * though the object descriptors are not freed until the remainder of + * the code below is executed. This allows the window system toolkit + * code to determine the best way to destroy a widget hierarchy, + * rather than having us destroy each widget one by one from the + * bottom up. + */ + (*(object->core.classrec->Destroy)) (object); + + /* Destroy any children. Note that each time a child is destroyed the + * child list in the object descriptor is modified, so we merely loop + * until nchildren goes to zero. + */ + if (cp->nchildren) { + while (cp->nchildren > 0) + obmDestroyObject (obm, cp->children[0]); + } + + /* Remove this object from the child list of the parent. */ + if (obj = object->core.parent) { + if (obj->core.nchildren == 1) { + XtFree ((char *)obj->core.children); + obj->core.nchildren = 0; + + } else { + int nchild = obj->core.nchildren; + ObmObject *new_list, *ip, *op; + + new_list = (ObmObject *) XtMalloc (nchild * sizeof(ObmObject)); + op = new_list; + + for (ip = obj->core.children; --nchild >= 0; ip++) + if (*ip != object) + *op++ = *ip; + + XtFree ((char *)obj->core.children); + obj->core.children = new_list; + obj->core.nchildren--; + } + } + + /* Unlink the object from the global object list. */ + if (obj = object->core.prevglob) { + if (!(obj->core.nextglob = object->core.nextglob)) + obm->tail = obj; + } else + obm->head = object->core.nextglob; + + if (obj = object->core.nextglob) { + if (!(obj->core.prevglob = object->core.prevglob)) + obm->head = obj; + } else + obm->tail = object->core.prevglob; + + /* Unlink the object from the hash list. */ + ip = object->core.name; + for (hashval=0, n=MAX_HASHCHARS; --n >= 0 && *ip; ip++) + hashval += (hashval + *ip); + if (obj = obm->objindex[hashval%SZ_INDEX]) { + while (obj && obj->core.nexthash != object) + obj = obj->core.nexthash; + if (obj) + obj->core.nexthash = object->core.nexthash; + else + obm->objindex[hashval%SZ_INDEX] = NULL; + } + + /* Free the object descriptor. */ + (*(object->core.classrec->Destroy)) (object); + XtFree ((char *)object); +} + + +/* obmDisplay -- Display an entire user interface, including all top level + * shells. + */ +void +obmDisplay (obm, obj) +ObmContext obm; +ObmObject obj; +{ + register Widget w = widgetGetPointer (obj); + register ObmObject child; + register int i; + char buf[SZ_NAME]; + + for (i=0; i < obj->core.nchildren; i++) { + child = obj->core.children[i]; + if (child->core.classrec->object_type == OtShell) + obmDisplay (obm, child); + } + + /* The following isn't used anymore. */ + if (obj->core.geometry[0]) + XtVaSetValues (w, XtNgeometry, obj->core.geometry, NULL); + + XtRealizeWidget (w); + if (obj->core.mapped) + XtMapWidget (w); +} + + +/* obmUndisplay -- Undisplay an entire user interface, including all top level + * shells. + */ +void +obmUndisplay (obm, obj) +ObmContext obm; +ObmObject obj; +{ + register int i; + register ObmObject child; + register Widget w = widgetGetPointer (obj); + XWindowAttributes wa; + char *s; + + for (i=0; i < obj->core.nchildren; i++) { + child = obj->core.children[i]; + if (child->core.classrec->object_type == OtShell) + obmUndisplay (obm, child); + } + + if (XtWindow(w)) { + /* The following isn't used anymore. */ + if (s = get_geometry (obm->display, obm->screen, XtWindow(w), 1)) + strcpy (obj->core.geometry, s); + if (XGetWindowAttributes (obm->display, XtWindow(w), &wa)) + obj->core.mapped = (wa.map_state != IsUnmapped); + /* XtUnrealizeWidget (w); */ + + /* Unrealizing the widgets is too drastic, the following merely + * makes the window and icon disappear. + */ + XmuUpdateMapHints (obm->display, XtWindow(w), NULL); + XWithdrawWindow (obm->display, XtWindow(w), + XScreenNumberOfScreen(obm->screen)); + } +} + + +/* obmGetClassrec -- Get the class record for the named class. + */ +ObjClassRec +obmGetClassrec (classname) +char *classname; +{ + register ObjClassRec classrec; + register int i; + + for (i=0; i < XtNumber(UiObjects); i++) { + classrec = &UiObjects[i]; + if (strcmp (classname, classrec->name) == 0) + return (classrec); + } + + return (NULL); +} + + +/* obmGenericClassDestroy - Free any resources associated with a class record. + */ +void +obmGenericClassDestroy (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ +} + + +/* obmClass -- Test if a class record belongs to the given object class. + */ +obmClass (classrec, flag1, flag2) +register ObjClassRec classrec; +unsigned long flag1, flag2; +{ + return ((classrec->flag1 & flag1) || (classrec->flag2 & flag2)); +} + + +/* obmAddCallback -- Add a callback descriptor to a callback list. + */ +ObmCallback +obmAddCallback (callback_list) +ObmCallback *callback_list; +{ + register ObmCallback cb, last_cb; + + /* Find tail of list. */ + for (cb = last_cb = *callback_list; cb; cb = cb->next) + last_cb = cb; + + if (!(cb = (ObmCallback) XtCalloc (1, sizeof (obmCallback)))) + return (NULL); + + if (!last_cb) + *callback_list = cb; + else + last_cb->next = cb; + + return (cb); +} + + +/* obmRemoveCallback -- Remove a callback descriptor from a callback list. + */ +void +obmRemoveCallback (callback_list, callback) +ObmCallback *callback_list; +ObmCallback callback; +{ + register ObmCallback cb, last_cb; + + if (!callback) + return; + + /* Search for named callback descriptor. */ + for (cb = *callback_list, last_cb = NULL; cb; cb = cb->next) { + if (cb == callback) + break; + else + last_cb = cb; + } + + if (last_cb) + last_cb->next = cb->next; + else + *callback_list = cb->next; + + XtFree ((char *) cb); +} + + +/* obmDefined -- Test if the named function is a defined client function in + * the given Tcl interepter. + */ +obmClientCommand (tcl, commmand) +Tcl_Interp *tcl; +char *commmand; +{ + register char *ip, *op; + char name[SZ_NAME]; + Tcl_CmdInfo info; + + /* Get command name. This works even if we are passed a command + * line including arguments. + */ + for (ip=commmand; *ip && isspace(*ip); ip++) + ; + for (op=name; *ip && !isspace(*ip) && *ip != ';'; ) + *op++ = *ip++; + *op = '\0'; + if (op - name == 0) + return (False); + + /* Test if the named client command exists. This assumes that + * client commands always have the clientData field set to a + * non-NULL value. Tcl (at least in the current version) sets + * this field to NULL for the builtin commands. + */ + if (Tcl_GetCommandInfo (tcl, name, &info)) + return (info.clientData != NULL); + else + return (False); +} diff --git a/vendor/x11iraf/obm/Obm.h b/vendor/x11iraf/obm/Obm.h new file mode 100644 index 00000000..9e636437 --- /dev/null +++ b/vendor/x11iraf/obm/Obm.h @@ -0,0 +1,45 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +/* + * OBM.H -- Public definitions for the object manager. + */ + +#ifndef _Obm_Defined + +#ifndef Obm_Private +typedef struct { int dummy; } *ObmContext; +#endif + +ObmContext ObmOpen (/* app_context, argc, argv */); +void ObmClose (/* obm */); +void ObmInitialize (/* obm */); +void ObmActivate (/* obm */); +void ObmDeactivate (/* obm, unmap */); +int ObmActivated (/* obm */); +int ObmStatus (/* obm, app_name, app_class */); +XtPointer ObmGetInterp (/* obm, object */); +int ObmDeliverMsg (/* obm, object, message */); +int ObmDeliverMsgFromFile (/* obm, object, filename */); +XtPointer ObmAddCallback (/* obm, fcn, callback_type, client_data */); +void ObmRemoveCallback (/* obm, callback_id */); + +/* Callback type flags. */ +#define OBMCB_preserve 0000001 /* preserve over ObmInit */ + +#define OBMCB_connect 0000010 /* callback types */ +#define OBMCB_activate 0000020 +#define OBMCB_deactivate 0000040 +#define OBMCB_setGterm 0000100 +#define OBMCB_clientOutput 0000200 + +#define OBMUI_activate 0100000 /* internal */ +#define OBMUI_deactivate 0200000 /* internal */ + +/* ObmStatus states. */ +#define OBM_INITIALIZED 0 +#define OBM_ACTIVE 1 +#define OBM_IDLE 2 + +#define _Obm_Defined +#endif diff --git a/vendor/x11iraf/obm/ObmP.h b/vendor/x11iraf/obm/ObmP.h new file mode 100644 index 00000000..81ac52dd --- /dev/null +++ b/vendor/x11iraf/obm/ObmP.h @@ -0,0 +1,508 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +/* + * ObmP.h -- Private or internal global definitions for the Object Manager. + */ + +#include <stdio.h> +#include <ctype.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Core.h> +#include <X11/Object.h> + +#include <X11/Xaw/Cardinals.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/Box.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Dialog.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Grip.h> +#include <X11/Xaw/Label.h> +#include <X11/Xaw/List.h> +#include <X11/Xaw/MenuButton.h> +#include <X11/Xaw/Paned.h> +#include <X11/Xaw/Panner.h> +#include <X11/Xaw/Porthole.h> +#include <X11/Xaw/Repeater.h> +#include <X11/Xaw/Scrollbar.h> +#include <X11/Xaw/Simple.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/SmeLine.h> +#include <X11/Xaw/StripChart.h> +#include <X11/Xaw/Toggle.h> +#include <X11/Xaw/Tree.h> +#include <X11/Xaw/Viewport.h> + +#include <ObmW/Arrow.h> +#include <ObmW/Board.h> +#include <ObmW/Button.h> +#include <ObmW/Common.h> +#include <ObmW/Frame.h> +#include <ObmW/Group.h> +#include <ObmW/Gterm.h> +#include <ObmW/HTML.h> +#include <ObmW/Icon.h> +#include <ObmW/Label.h> +#include <ObmW/Layout.h> +#include <ObmW/ListTree.h> +#include <ObmW/MenuBar.h> +#include <ObmW/MultiList.h> +#include <ObmW/RadioGrp.h> +#include <ObmW/RowCol.h> +#include <ObmW/Scrollbar.h> +#include <ObmW/Slider2.h> +#include <ObmW/Tabs.h> +#include <ObmW/Toggle.h> + +#include <X11/Xraw/Separator.h> +#include <X11/Xraw/Table.h> + +#include <X11/xpm.h> +#include <Tcl/tcl.h> + +/* Size limiting definitions. */ +#define SZ_NAME 128 /* class or object name */ +#define SZ_LINE 256 /* line buffer */ +#define SZ_INDEX 197 /* hash index */ +#define SZ_MESSAGE 512 /* random string buffers */ +#define SZ_COMMAND 8192 /* general command buffers */ +#define SZ_NUMBER 64 /* numeric string buffers */ +#define SZ_GEOMETRY 32 /* geometry specification */ +#define MAX_RESOURCES 2048 /* max resources in application */ +#define MAX_HASHCHARS 8 /* max chars used for hashval */ +#define MAX_ARGS 128 /* scratch arg list */ +#define MAX_MENUITEMS 64 /* max items in a menu */ +#define MAX_LEVELS 128 /* recursive nesting */ +#define MAXNDC 32767 /* NDC graphics coordinates */ +#define MAXCOLORSYM 20 /* max color resources for icons */ + +#define MI_IGNORE 0 /* menu item type codes */ +#define MI_EXEC 1 +#define MI_LINE 2 +#define MI_DBLLINE 3 +#define MI_MENU 4 +#define MI_SPACE 5 +#define MI_TITLE 6 + +#define M_Insensitive 000001 /* menu attribute bitflags */ +#define M_FreeBackground 000002 +#define M_FreeForeground 000004 +#define M_FreeAccel 000010 +#define M_FreeLabel 000020 +#define M_FreeData 000040 + +/* Object class types */ +#define OtShell 1 /* shell widget class */ +#define OtNonShell 2 /* nonshell widget class */ +#define OtParameter 3 /* UI control parameter class */ +#define OtServer 4 /* UI server class */ +#define OtClient 5 /* UI client class */ +#define OtMarker 6 /* gterm marker class */ +#define OtNClasses 6 + +typedef int (*ObmFunc)(); +typedef void (*ObmMethod)(); + +extern void ServerClassInit(), ClientClassInit(), ParameterClassInit(); +extern void WidgetClassInit(), GenericClassDestroy(); +extern void GtermClassInit(), MarkerClassInit(), HTMLClassInit(); + +/* Dummy WtClass bit flag definitions for initializers. */ +#define WtServer 0, 0 +#define WtClient 0, 0 +#define WtParameter 0, 0 +#define WtMarker 0, 0 + +/* Widget class bit flags. + */ +#define WtCore 00000000000, 00000000001 +#define WtObject 00000000000, 00000000002 +#define WtSimple 00000000000, 00000000004 +#define WtShell 00000000000, 00000000010 + +#define WtAsciiSink 00000000000, 00000000020 +#define WtAsciiSrc 00000000000, 00000000040 +#define WtAsciiText 00000000000, 00000000100 +#define WtBox 00000000000, 00000000200 +#define WtCommand 00000000000, 00000000400 +#define WtDialog 00000000000, 00000001000 +#define WtForm 00000000000, 00000002000 +#define WtGrip 00000000000, 00000004000 +#define WtLabel 00000000000, 00000010000 +#define WtList 00000000000, 00000020000 +#define WtMenuButton 00000000000, 00000040000 +#define WtPaned 00000000000, 00000100000 +#define WtPanner 00000000000, 00000200000 +#define WtPorthole 00000000000, 00000400000 +#define WtRepeater 00000000000, 00001000000 +#define WtScrollbar 00000000000, 00002000000 +#define WtSimpleMenu 00000000000, 00004000000 +#define WtSme 00000000000, 00010000000 +#define WtSmeBSB 00000000000, 00020000000 +#define WtSmeLine 00000000000, 00040000000 +#define WtStripChart 00000000000, 00100000000 +#define WtToggle 00000000000, 00200000000 +#define WtTree 00000000000, 00400000000 +#define WtViewport 00000000000, 01000000000 + +#define WtGterm 00000000001, 00000000000 +#define WtLayout 00000000002, 00000000000 +#define WtHTML 00000000004, 00000000000 +#define WtArrow 00000000010, 00000000000 +#define WtBoard 00000000020, 00000000000 +#define WtScrollbar2 00000000040, 00000000000 +#define WtSlider2d 00000000100, 00000000000 +#define WtFrame 00000000200, 00000000000 +#define WtGroup 00000000400, 00000000000 +#define WtIcon 00000001000, 00000000000 +#define WtMultiList 00000002000, 00000000000 +#define WtRadioGroup 00000004000, 00000000000 +#define WtRowCol 00000010000, 00000000000 +#define WtTextBox 00000020000, 00000000000 +#define WtTextButton 00000040000, 00000000000 +#define WtTextToggle 00000100000, 00000000000 +#define WtXfwfCommon 00000200000, 00000000000 +#define WtXfwfMenuBar 00000400000, 00000000000 +#define WtTabs 00001000000, 00000000000 +#define WtListTree 00002000000, 00000000000 +#define WtSeparator 00004000000, 00000000000 +#define WtTable 00010000000, 00000000000 + +/* Object base classes. */ +typedef struct { + int class; /* class type code */ + char name[SZ_NAME]; /* class name */ +} baseClassRec, *BaseClassRec; + +/* UI object class descriptor. */ +typedef struct { + char name[SZ_NAME]; /* object class name */ + int object_type; /* widget type (shell etc.) */ + WidgetClass *widget_class; /* for Xt/Athena widgets */ + unsigned long flag1, flag2; /* widget class bit flags. */ + ObmMethod ClassInit; /* initializes class record */ + ObmMethod ClassDestroy; /* close class record */ + ObmFunc Create; /* create proc */ + ObmMethod Destroy; /* destroy proc */ + ObmFunc Evaluate; /* evaluate proc */ + XtPointer class_data; /* class specific data */ +} objClassRec, *ObjClassRec; + +/* Class descriptors for all UI object classes and subclasses. In the + * following only the class initializer function needs to be set statically, + * since the class initializer function will initialize the remaining fields + * of the class descriptor at run time when the object manager is opened. + */ +#ifdef Obm_Main +baseClassRec baseClasses[] = { + { OtShell, "Widget", }, + { OtNonShell, "Widget", }, + { OtParameter, "Parameter", }, + { OtServer, "Server", }, + { OtClient, "Client", }, + { OtMarker, "Marker", }, +}; + +objClassRec UiObjects[] = { + { "Server", OtServer, NULL, WtServer, + ServerClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Client", OtClient, NULL, WtClient, + ClientClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Parameter", OtParameter, NULL, WtParameter, + ParameterClassInit, NULL, NULL, NULL, NULL, NULL }, + + { "Core", OtNonShell, &coreWidgetClass, WtCore, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Object", OtNonShell, &objectClass, WtObject, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Simple", OtNonShell, &simpleWidgetClass, WtSimple, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Widget", OtNonShell, &coreWidgetClass, WtCore, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + + { "AsciiText", OtNonShell, &asciiTextWidgetClass, WtAsciiText, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Box", OtNonShell, &boxWidgetClass, WtBox, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Command", OtNonShell, &commandWidgetClass, WtCommand, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Dialog", OtNonShell, &dialogWidgetClass, WtDialog, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Form", OtNonShell, &formWidgetClass, WtForm, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Grip", OtNonShell, &gripWidgetClass, WtGrip, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Label", OtNonShell, &labelWidgetClass, WtLabel, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "List", OtNonShell, &listWidgetClass, WtList, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "ListTree", OtNonShell, &listtreeWidgetClass, WtListTree, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "MenuButton", OtNonShell, &menuButtonWidgetClass, WtMenuButton, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Paned", OtNonShell, &panedWidgetClass, WtPaned, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Panner", OtNonShell, &pannerWidgetClass, WtPanner, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Porthole", OtNonShell, &portholeWidgetClass, WtPorthole, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Repeater", OtNonShell, &repeaterWidgetClass, WtRepeater, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Scrollbar", OtNonShell, &scrollbarWidgetClass, WtScrollbar, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Separator", OtNonShell, &separatorWidgetClass, WtSeparator, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "SimpleMenu", OtShell, &simpleMenuWidgetClass, WtSimpleMenu, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Sme", OtNonShell, &smeObjectClass, WtSme, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "SmeBSB", OtNonShell, &smeBSBObjectClass, WtSmeBSB, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "SmeLine", OtNonShell, &smeLineObjectClass, WtSmeLine, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "StripChart", OtNonShell, &stripChartWidgetClass, WtStripChart, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Table", OtNonShell, &tableWidgetClass, WtTable, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Tabs", OtNonShell, &tabsWidgetClass, WtTabs, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Toggle", OtNonShell, &toggleWidgetClass, WtToggle, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Tree", OtNonShell, &treeWidgetClass, WtTree, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Viewport", OtNonShell, &viewportWidgetClass, WtViewport, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + + { "Gterm", OtNonShell, &gtermWidgetClass, WtGterm, + GtermClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Marker", OtMarker, NULL, WtMarker, + MarkerClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Layout", OtNonShell, &layoutWidgetClass, WtLayout, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "HTML", OtNonShell, &htmlWidgetClass, WtHTML, + HTMLClassInit, NULL, NULL, NULL, NULL, NULL }, + + { "Arrow", OtNonShell, &xfwfArrowWidgetClass, WtArrow, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Board", OtNonShell, &xfwfBoardWidgetClass, WtBoard, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Frame", OtNonShell, &xfwfFrameWidgetClass, WtFrame, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Group", OtNonShell, &xfwfGroupWidgetClass, WtGroup, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Icon", OtNonShell, &xfwfIconWidgetClass, WtIcon, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "MultiList", OtNonShell, &xfwfMultiListWidgetClass, WtMultiList, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "RadioGroup", OtNonShell,&xfwfRadioGroupWidgetClass,WtRadioGroup, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "RowCol", OtNonShell, &xfwfRowColWidgetClass, WtRowCol, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "TextBox", OtNonShell, &xfwfLabelWidgetClass, WtTextBox, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "TextButton", OtNonShell, &xfwfButtonWidgetClass, WtTextButton, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "TextToggle", OtNonShell, &xfwfToggleWidgetClass, WtTextToggle, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Scrollbar2", OtNonShell, &xfwfScrollbarWidgetClass, WtScrollbar2, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "Slider2d", OtNonShell, &xfwfSlider2WidgetClass, WtSlider2d, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + + { "Shell", OtShell, &shellWidgetClass, WtShell, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "OverrideShell", + OtShell, &overrideShellWidgetClass, WtShell, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "WMShell", + OtShell, &wmShellWidgetClass, WtShell, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "TransientShell", + OtShell, &transientShellWidgetClass, WtShell, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "TopLevelShell", + OtShell, &topLevelShellWidgetClass, WtShell, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, + { "ApplicationShell", + OtShell, &applicationShellWidgetClass, WtShell, + WidgetClassInit, NULL, NULL, NULL, NULL, NULL }, +}; +#else +extern objClassRec UiObjects[]; +extern baseClassRec baseClasses[]; +#endif + + +/* Generic object instance record, omitting the class part. The object + * instance records for the real object classes share the objectCore structure + * but have a class specific structure and are a different size. + */ +struct obmObject { + struct obmObjectCore { + char name[SZ_NAME]; /* object name */ + ObjClassRec classrec; /* class record */ + ObjClassRec superclass; /* superclass, if class is subclass */ + struct obmObject *prevglob; /* previous object in global list */ + struct obmObject *nextglob; /* next object in global list */ + struct obmObject *nexthash; /* next object in hash list */ + struct obmObject *parent; /* the object's parent */ + int nchildren; /* number of child objects */ + struct obmObject **children; /* list of child objects */ + Boolean being_destroyed; /* set by Destroy method */ + Boolean mapped; /* used to recreate shells */ + char geometry[SZ_GEOMETRY]; /* used to recreate shells */ + } core; + /* class part omitted */ +}; + +typedef struct obmObject *ObmObject; +typedef struct obmObjectCore *ObmObjectCore; + +/* Object list. */ +struct objList { + char name[SZ_NAME]; + caddr_t ptr; + struct objList *next; +}; + +/* Menu item. */ +typedef struct { + int type; + XtPointer menu; + Widget entry; + char *sbuf; + char *label; + char *data; + char *accelerator; + char *background; + char *foreground; + int justify; + Pixmap pixmap; + int flags; +} menuItem, *MenuItem; + +/* Menu descriptor. */ +typedef struct { + ObmObject obj; + Widget menuShell; + Boolean popped_up; + XtPointer obm; + int nitems; + menuItem items[MAX_MENUITEMS]; +} Menu, *MenuPtr; + +typedef struct objList *ObjList; + +/* Callback type codes. */ +#define Ctcallback 0 /* most widgets */ +#define Ctcharmode 1 /* text widget, char mode */ +#define Ctlinemode 2 /* text widget, char mode */ +#define CtgetValue 3 /* strip chart */ +#define CtjumpProc 4 /* scrollbar */ +#define CtscrollProc 5 /* scrollbar */ +#define CtpopdownCallback 6 /* shell, simpleMenu */ +#define CtpopupCallback 7 /* shell, simpleMenu */ +#define CtreportCallback 8 /* panner, porthole, viewport */ +#define CtstartCallback 9 /* repeater */ +#define CtstopCallback 10 /* repeater */ + +struct _obmCallback { + union { + ObmObject obj; + ObmFunc fcn; + } u; + int callback_type; + XtPointer client_data; + struct _obmCallback *next; + char name[SZ_NAME]; +}; + +typedef struct _obmCallback obmCallback; +typedef struct _obmCallback *ObmCallback; + +/* Object manager global context. */ +struct obmContext { + char appname[SZ_NAME]; /* application name */ + char appclass[SZ_NAME]; /* application class */ + int argc; /* args for popup shell */ + char **argv; /* args for popup shell */ + XtAppContext app_context; /* application context */ + Display *display; /* Obm private display connection */ + Screen *screen; /* Obm private display connection */ + Widget toplevel; /* toplevel shell of application */ + Tcl_Interp *tcl; /* global or server interpreter */ + ObmObject head; /* head of object list */ + ObmObject tail; /* tail of object list */ + ObmObject objindex[SZ_INDEX]; /* hash index */ + ObjList pixmap_cache; /* cached pixmaps */ + ObjList cursor_cache; /* cached cursors */ + ObjList menu_list; /* list of menu descriptors */ + ObmCallback callback_list; /* list of callback descriptors */ + Boolean being_destroyed; /* set by Destroy method */ + Boolean specified; /* UI has been specified */ + Boolean activated; /* UI has been activated */ + Boolean mapped; /* toplevel is mapped */ + + int debug; /* print debug messages */ + char *debug_objs; /* debug objects, NULL=>all objs */ +}; + +typedef struct obmContext *ObmContext; + +#ifdef Obm_Main +ObmContext global_obm_handle; /* only works if single obm */ +#else +extern ObmContext global_obm_handle; +#endif + +/* Useful macros. */ +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + +/* The following are the string values returned to Tcl for boolean values. */ +#define TRUESTR "1" +#define FALSESTR "0" + +extern ObmObject obmFindObject(); +extern ObjClassRec obmGetClassrec(); +extern Widget widgetGetPointer(); +extern ObmCallback obmAddCallback(); +extern void widget_setTTName(); +extern char *widget_getTTName(); +extern void obmRemoveCallback(); +extern void obmNewObject(); +extern void obmFreeObject(); +extern void obmDestroyObject(); +extern void obmGenericClassDestroy(); +extern void obmDisplay(), obmUndisplay(); +extern void freeMenu(); +extern void freeIcon(); +extern Pixmap findBitmap(); +extern Pixmap findPixmap(); +extern Cursor findCursor(); +extern Icon *findIcon(); +extern char *get_geometry(); + +/* Public functions. */ +#define Obm_Private +#include "Obm.h" +#undef Obm_Private + +extern char *getenv(); diff --git a/vendor/x11iraf/obm/ObmW/Arrow.c b/vendor/x11iraf/obm/ObmW/Arrow.c new file mode 100644 index 00000000..3c13146a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Arrow.c @@ -0,0 +1,465 @@ +/* Generated by wbuild from "Arrow.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "stip4.bm" +#include <stdio.h> +#include <assert.h> +#include "ArrowP.h" +static void activate_and_start_timer( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void stop_timer( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"activate_and_start_timer", activate_and_start_timer}, +{"stop_timer", stop_timer}, +}; + +static char defaultTranslations[] = "\ +<Btn1Down>: activate_and_start_timer() \n\ +<Btn1Up>: stop_timer() \n\ +"; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void timer_callback( +#if NeedFunctionPrototypes +XtPointer ,XtIntervalId * +#endif +); +static void create_arrowgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_arrowlightgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_arrowdarkgc( +#if NeedFunctionPrototypes +Widget +#endif +); +/*ARGSUSED*/static void timer_callback(client_data,timer)XtPointer client_data;XtIntervalId * timer; +{ + Widget self = (Widget) client_data; + + XtCallCallbackList(self, ((XfwfArrowWidget)self)->xfwfArrow.callback, NULL); + ((XfwfArrowWidget)self)->xfwfArrow.timer = XtAppAddTimeOut(XtWidgetToApplicationContext(self), + ((XfwfArrowWidget)self)->xfwfArrow.repeatDelay, timer_callback, self); +} +/*ARGSUSED*/static void create_arrowgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfArrowWidget)self)->xfwfArrow.arrowgc != NULL) XtReleaseGC(self, ((XfwfArrowWidget)self)->xfwfArrow.arrowgc); + mask = GCForeground; + values.foreground = ((XfwfArrowWidget)self)->xfwfArrow.foreground; + ((XfwfArrowWidget)self)->xfwfArrow.arrowgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_arrowlightgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc != NULL) XtReleaseGC(self, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc); + switch (((XfwfArrowWidget)self)->xfwfFrame.shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = ((XfwfArrowWidget)self)->xfwfFrame.topShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfArrowWidget)self)->core.background_pixel; + values.stipple = ((XfwfArrowWidget)self)->xfwfFrame.topShadowStipple; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen(self)) > 4 + && ((XfwfArrowWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfArrowWidget)self)->xfwfArrow.foreground, &values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfArrowWidget)self)->xfwfArrow.foreground; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + values.stipple = + XCreateBitmapFromData(XtDisplay(self), + RootWindowOfScreen(XtScreen(self)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_arrowdarkgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc != NULL) XtReleaseGC(self, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc); + switch (((XfwfArrowWidget)self)->xfwfFrame.shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = ((XfwfArrowWidget)self)->xfwfFrame.bottomShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.stipple = ((XfwfArrowWidget)self)->xfwfFrame.bottomShadowStipple; + values.foreground = BlackPixelOfScreen(XtScreen(self)); + values.background = ((XfwfArrowWidget)self)->core.background_pixel; + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen(self)) > 4 + && ((XfwfArrowWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfArrowWidget)self)->xfwfArrow.foreground, &values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfArrowWidget)self)->xfwfArrow.foreground; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + values.stipple = + XCreateBitmapFromData(XtDisplay(self), + RootWindowOfScreen(XtScreen(self)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc = XtGetGC(self, mask, &values); +} + +static XtResource resources[] = { +{XtNdirection,XtCDirection,XtRAlignment,sizeof(((XfwfArrowRec*)NULL)->xfwfArrow.direction),XtOffsetOf(XfwfArrowRec,xfwfArrow.direction),XtRImmediate,(XtPointer)XfwfTop }, +{XtNforeground,XtCForeground,XtRPixel,sizeof(((XfwfArrowRec*)NULL)->xfwfArrow.foreground),XtOffsetOf(XfwfArrowRec,xfwfArrow.foreground),XtRString,(XtPointer)XtDefaultBackground }, +{XtNarrowShadow,XtCArrowShadow,XtRDimension,sizeof(((XfwfArrowRec*)NULL)->xfwfArrow.arrowShadow),XtOffsetOf(XfwfArrowRec,xfwfArrow.arrowShadow),XtRImmediate,(XtPointer)2 }, +{XtNinitialDelay,XtCInitialDelay,XtRCardinal,sizeof(((XfwfArrowRec*)NULL)->xfwfArrow.initialDelay),XtOffsetOf(XfwfArrowRec,xfwfArrow.initialDelay),XtRImmediate,(XtPointer)500 }, +{XtNrepeatDelay,XtCRepeatDelay,XtRCardinal,sizeof(((XfwfArrowRec*)NULL)->xfwfArrow.repeatDelay),XtOffsetOf(XfwfArrowRec,xfwfArrow.repeatDelay),XtRImmediate,(XtPointer)200 }, +{XtNcallback,XtCCallback,XtRCallback,sizeof(((XfwfArrowRec*)NULL)->xfwfArrow.callback),XtOffsetOf(XfwfArrowRec,xfwfArrow.callback),XtRImmediate,(XtPointer)NULL }, +}; + +XfwfArrowClassRec xfwfArrowClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfBoardClassRec, +"Arrow", +sizeof(XfwfArrowRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +2, +resources, +6, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +defaultTranslations, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfArrow_class part */ +0 +}, +}; +WidgetClass xfwfArrowWidgetClass = (WidgetClass) &xfwfArrowClassRec; +/*ARGSUSED*/ +static void activate_and_start_timer(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + if (event->type != ButtonPress) { + XtWarning("The Arrow activate action isn't bound to a BtnDown event"); + return; + } + XtCallCallbackList(self, ((XfwfArrowWidget)self)->xfwfArrow.callback, NULL); + ((XfwfArrowWidget)self)->xfwfArrow.timer = XtAppAddTimeOut(XtWidgetToApplicationContext(self), + ((XfwfArrowWidget)self)->xfwfArrow.initialDelay, timer_callback, self); +} + +/*ARGSUSED*/ +static void stop_timer(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XtRemoveTimeOut(((XfwfArrowWidget)self)->xfwfArrow.timer); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfArrowWidgetClass c = (XfwfArrowWidgetClass) class; + XfwfArrowWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfArrowWidgetClass) return; + super = (XfwfArrowWidgetClass)class->core_class.superclass; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + if (((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfTop && ((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfLeft + && ((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfRight && ((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfBottom) { + XtWarning("direction of Arrow widget incorrect; set to `top'"); + ((XfwfArrowWidget)self)->xfwfArrow.direction = XfwfTop; + } + ((XfwfArrowWidget)self)->xfwfArrow.arrowgc = NULL; create_arrowgc(self); + ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc = NULL; create_arrowlightgc(self); + ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc = NULL; create_arrowdarkgc(self); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redisplay = False; + + if (((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfTop && ((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfLeft + && ((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfRight && ((XfwfArrowWidget)self)->xfwfArrow.direction != XfwfBottom) { + XtWarning("direction of Arrow widget incorrect; set to `top'"); + ((XfwfArrowWidget)self)->xfwfArrow.direction = XfwfTop; + } + if (((XfwfArrowWidget)old)->xfwfArrow.direction != ((XfwfArrowWidget)self)->xfwfArrow.direction) + need_redisplay = True; + if (((XfwfArrowWidget)old)->xfwfArrow.foreground != ((XfwfArrowWidget)self)->xfwfArrow.foreground) { + create_arrowgc(self); + need_redisplay = True; + } + if (((XfwfArrowWidget)old)->xfwfArrow.arrowShadow != ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow) + need_redisplay = True; + if (((XfwfArrowWidget)self)->xfwfFrame.shadowScheme != ((XfwfArrowWidget)old)->xfwfFrame.shadowScheme) { + create_arrowdarkgc(self); + create_arrowlightgc(self); + need_redisplay = True; + } else if (((XfwfArrowWidget)self)->xfwfFrame.shadowScheme == XfwfColor) { + if (((XfwfArrowWidget)self)->xfwfFrame.topShadowColor != ((XfwfArrowWidget)old)->xfwfFrame.topShadowColor) { + create_arrowlightgc(self); + need_redisplay = True; + } + if (((XfwfArrowWidget)self)->xfwfFrame.bottomShadowColor != ((XfwfArrowWidget)old)->xfwfFrame.bottomShadowColor) { + create_arrowdarkgc(self); + need_redisplay = True; + } + } else if (((XfwfArrowWidget)self)->xfwfFrame.shadowScheme = XfwfStipple) { + if (((XfwfArrowWidget)self)->xfwfFrame.topShadowStipple != ((XfwfArrowWidget)old)->xfwfFrame.topShadowStipple) { + create_arrowlightgc(self); + need_redisplay = True; + } + if (((XfwfArrowWidget)self)->xfwfFrame.bottomShadowStipple != ((XfwfArrowWidget)old)->xfwfFrame.bottomShadowStipple) { + create_arrowdarkgc(self); + need_redisplay = True; + } + } + return need_redisplay; +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + XPoint p1[3], p2[4], p3[4], p4[4]; + Position x, y; + Dimension width, height, a, a2, a3; + + assert(((XfwfArrowWidget)self)->xfwfArrow.direction == XfwfTop || ((XfwfArrowWidget)self)->xfwfArrow.direction == XfwfLeft + || ((XfwfArrowWidget)self)->xfwfArrow.direction == XfwfRight || ((XfwfArrowWidget)self)->xfwfArrow.direction == XfwfBottom); + + if (! XtIsRealized(self)) return; + if (region != NULL) { + XSetRegion(XtDisplay(self), ((XfwfArrowWidget)self)->xfwfArrow.arrowgc, region); + XSetRegion(XtDisplay(self), ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, region); + XSetRegion(XtDisplay(self), ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, region); + } + ((XfwfArrowWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &width, &height); + a = ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow; + switch (((XfwfArrowWidget)self)->xfwfArrow.direction) { + case XfwfTop: + a2 = (1.0 + 0.71*width/height) * a; + a3 = (1.0 + 0.83*height/width) * a; + point(p1, 0, x + width/2, y + a3); + point(p1, 1, x + a2, y + height - a); + point(p1, 2, x + width - a2, y + height - a); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowgc, p1, 3, Convex, + CoordModeOrigin); + if (a == 0) break; + point(p2, 0, x + width/2, y); + point(p2, 1, x + width/2, y + a3); + point(p2, 2, x + width - a2, y + height - a); + point(p2, 3, x + width, y + height); + + point(p3, 0, x + a2, y + height - a); + point(p3, 1, x, y + height); + point(p3, 2, x + width, y + height); + point(p3, 3, x + width - a2, y + height - a); + + point(p4, 0, x + width/2, y); + point(p4, 1, x, y + height); + point(p4, 2, x + a2, y + height - a); + point(p4, 3, x + width/2, y + a3); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, p4, 4, Convex, + CoordModeOrigin); + break; + case XfwfLeft: + a2 = (1.0 + 0.83*width/height) * a; + a3 = (1.0 + 0.71*height/width) * a; + point(p1, 0, x + a2, y + height/2); + point(p1, 1, x + width - a, y + a3); + point(p1, 2, x + width - a, y + height - a3); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowgc, p1, 3, Convex, + CoordModeOrigin); + if (((XfwfArrowWidget)self)->xfwfArrow.arrowShadow == 0) break; + point(p2, 0, x + width, y); + point(p2, 1, x, y + height/2); + point(p2, 2, x + a2, y + height/2); + point(p2, 3, x + width - a, y + a3); + + point(p3, 0, x, y + height/2); + point(p3, 1, x + width, y + height); + point(p3, 2, x + width - a, y + height - a3); + point(p3, 3, x + a2, y + height/2); + + point(p4, 0, x + width, y); + point(p4, 1, x + width - a, y + a3); + point(p4, 2, x + width - a, y + height - a3); + point(p4, 3, x + width, y + height); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, p4, 4, Convex, + CoordModeOrigin); + break; + case XfwfBottom: + a2 = (1.0 + 0.71*width/height) * a; + a3 = (1.0 + 0.83*height/width) * a; + point(p1, 0, x + width/2, y + height - a3); + point(p1, 1, x + a2, y + a); + point(p1, 2, x + width - a2, y + a); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowgc, p1, 3, Convex, + CoordModeOrigin); + if (((XfwfArrowWidget)self)->xfwfArrow.arrowShadow == 0) break; + point(p2, 0, x, y); + point(p2, 1, x + width/2, y + height); + point(p2, 2, x + width/2, y + height - a3); + point(p2, 3, x + a2, y + a); + + point(p3, 0, x + width, y); + point(p3, 1, x + width - a2, y + a); + point(p3, 2, x + width/2, y + height - a3); + point(p3, 3, x + width/2, y + height); + + point(p4, 0, x, y); + point(p4, 1, x + a2, y + a); + point(p4, 2, x + width - a2, y + a); + point(p4, 3, x + width, y); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, p4, 4, Convex, + CoordModeOrigin); + break; + case XfwfRight: + a2 = (1.0 + 0.83*width/height) * a; + a3 = (1.0 + 0.71*height/width) * a; + point(p1, 0, x + width - ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow, y + height/2); + point(p1, 1, x + ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow, y + ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow); + point(p1, 2, x + ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow, y + height - ((XfwfArrowWidget)self)->xfwfArrow.arrowShadow); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowgc, p1, 3, Convex, + CoordModeOrigin); + if (((XfwfArrowWidget)self)->xfwfArrow.arrowShadow == 0) break; + point(p2, 0, x, y + height); + point(p2, 1, x + width, y + height/2); + point(p2, 2, x + width - a2, y + height/2); + point(p2, 3, x + a, y + height - a3); + + point(p3, 0, x, y); + point(p3, 1, x + a, y + a3); + point(p3, 2, x + width - a2, y + height/2); + point(p3, 3, x + width, y + height/2); + + point(p4, 0, x, y); + point(p4, 1, x, y + height); + point(p4, 2, x + a, y + height - a3); + point(p4, 3, x + a, y + a3); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay(self), ((XfwfArrowWidget)self)->core.window, ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, p4, 4, Convex, + CoordModeOrigin); + break; + } + if (region != NULL) { + XSetClipMask(XtDisplay(self), ((XfwfArrowWidget)self)->xfwfArrow.arrowgc, None); + XSetClipMask(XtDisplay(self), ((XfwfArrowWidget)self)->xfwfArrow.arrowlightgc, None); + XSetClipMask(XtDisplay(self), ((XfwfArrowWidget)self)->xfwfArrow.arrowdarkgc, None); + } +} diff --git a/vendor/x11iraf/obm/ObmW/Arrow.h b/vendor/x11iraf/obm/ObmW/Arrow.h new file mode 100644 index 00000000..c6a2442b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Arrow.h @@ -0,0 +1,70 @@ +/* Generated by wbuild from "Arrow.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfArrow_H_ +#define _XfwfArrow_H_ +#include "Board.h" +#ifndef XtNdirection +#define XtNdirection "direction" +#endif +#ifndef XtCDirection +#define XtCDirection "Direction" +#endif +#ifndef XtRAlignment +#define XtRAlignment "Alignment" +#endif + +#ifndef XtNforeground +#define XtNforeground "foreground" +#endif +#ifndef XtCForeground +#define XtCForeground "Foreground" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNarrowShadow +#define XtNarrowShadow "arrowShadow" +#endif +#ifndef XtCArrowShadow +#define XtCArrowShadow "ArrowShadow" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNinitialDelay +#define XtNinitialDelay "initialDelay" +#endif +#ifndef XtCInitialDelay +#define XtCInitialDelay "InitialDelay" +#endif +#ifndef XtRCardinal +#define XtRCardinal "Cardinal" +#endif + +#ifndef XtNrepeatDelay +#define XtNrepeatDelay "repeatDelay" +#endif +#ifndef XtCRepeatDelay +#define XtCRepeatDelay "RepeatDelay" +#endif +#ifndef XtRCardinal +#define XtRCardinal "Cardinal" +#endif + +#ifndef XtNcallback +#define XtNcallback "callback" +#endif +#ifndef XtCCallback +#define XtCCallback "Callback" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +typedef struct _XfwfArrowClassRec *XfwfArrowWidgetClass; +typedef struct _XfwfArrowRec *XfwfArrowWidget; +externalref WidgetClass xfwfArrowWidgetClass; +#endif /*_XfwfArrow_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Arrow.man b/vendor/x11iraf/obm/ObmW/Arrow.man new file mode 100644 index 00000000..d8a7361e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Arrow.man @@ -0,0 +1,680 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfArrow +.SH DESCRIPTION +The Arrow widget is usually part of a composite scrollbar widget. It +draws a triangle pointing up, down, left or right, depending on the +\fIdirection\fP resource. It has a single callback, that is repeatedly +called as long as a mouse button -- button 1 by default -- is pressed. + +The triangle has a 3D shadow, the size of which can be controlled with +a resource. The shadow is either stippled or colored, depending on the +\fIshadowScheme\fP and associated resources (see the XfwfFrame widget). + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfArrow +Name Class Type Default +XtNdirection XtCDirection Alignment XfwfTop +XtNforeground XtCForeground Pixel XtDefaultBackground +XtNarrowShadow XtCArrowShadow Dimension 2 +XtNinitialDelay XtCInitialDelay Cardinal 500 +XtNrepeatDelay XtCRepeatDelay Cardinal 200 +XtNcallback XtCCallback Callback NULL + +.TE +.ps + +.TP +.I "XtNdirection" +The direction of the arrow (triangle) is given by the \fIdirection\fP +resource, which is of type \fIAlignment\fP. Only \fI"top"\fP (\fIXfwfTop\fP), +\fI"bottom"\fP (\fIXfwfBottom\fP), \fI"left"\fP (\fIXfwfLeft\fP) and \fI"right"\fP +(\fIXfwfRight\fP) are valid directions. Other directions result in a +warning. + +.hi + +.nf +Alignment direction = XfwfTop +.fi + +.eh + +.TP +.I "XtNforeground" +The color of the arrow also determines the color of the 3D shadow, +at least if \fIshadowScheme\fP is set to \fIXfwfAuto\fP, as it is by default. + +.hi + +.nf +Pixel foreground = <String>XtDefaultBackground +.fi + +.eh + +.TP +.I "XtNarrowShadow" +The width of the arrow's shadow is by default 2 pixels. + +.hi + +.nf +Dimension arrowShadow = 2 +.fi + +.eh + +.TP +.I "XtNinitialDelay" +When the user presses and then holds the mouse button, the action +function waits some milliseconds before it starts repeating the +callbacks. + +.hi + +.nf +Cardinal initialDelay = 500 +.fi + +.eh + +.TP +.I "XtNrepeatDelay" +Between repeated calls to the callback routines, the arrow widget +will wait a few milliseconds. + +.hi + +.nf +Cardinal repeatDelay = 200 +.fi + +.eh + +.TP +.I "XtNcallback" +The \fIcallback\fP function is called by the \fIactivate\fP action. It is +called repeatedly until the mouse button that triggered the action is +released again. + +.hi + +.nf +<Callback> XtCallbackList callback = NULL +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Translations" + +.nf +<Btn1Down>: activate_and_start_timer() +.fi + +.nf +<Btn1Up>: stop_timer() +.fi + +.hi +.SS "Actions" + +.TP +.I "activate_and_start_timer + +The \fIactivate\fP action calls the \fIcallback\fP routine once and installs +a timeout routine. + +.hi + +.nf +void activate_and_start_timer($, XEvent* event, String* params, Cardinal* num_params) +{ + if (event->type != ButtonPress) { + XtWarning("The Arrow activate action isn't bound to a BtnDown event"); + return; + } + XtCallCallbackList($, $callback, NULL); + $timer = XtAppAddTimeOut(XtWidgetToApplicationContext($), + $initialDelay, timer_callback, $); +} +.fi + +.eh + +.TP +.I "stop_timer + +.hi + +.nf +void stop_timer($, XEvent* event, String* params, Cardinal* num_params) +{ + XtRemoveTimeOut($timer); +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +The stipple for the shadows are loaded from a bitmap file. + +.nf + +.B incl + "stip4.bm" +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.nf + +.B incl + <assert.h> +.fi + +.hi + +.hi +.SS "Private variables" + +The three GC's are used for drawing the arrow and its shadows. + +.nf +GC arrowgc +.fi + +.nf +GC arrowlightgc +.fi + +.nf +GC arrowdarkgc +.fi + +The repeating callback is implemented with a time out routine. The +timer is a private variable of the widget. + +.nf +XtIntervalId timer +.fi + +.hi + +.hi +.SS "Methods" + +The \fIinitialize\fP method sets initial values for the three GC's and +checks the \fIdirection\fP resource. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + if ($direction != XfwfTop $direction != XfwfLeft + $direction != XfwfRight $direction != XfwfBottom) { + XtWarning("direction of Arrow widget incorrect; set to `top'"); + $direction = XfwfTop; + } + $arrowgc = NULL; create_arrowgc($); + $arrowlightgc = NULL; create_arrowlightgc($); + $arrowdarkgc = NULL; create_arrowdarkgc($); +} +.fi + +When the \fIforeground\fP, \fIarrowShadow\fP or \fIdirection\fP resource changes, +the widget has to be redrawn. Like in the \fIinitialize\fP method, the +\fIdirection\fP resource needs to be checked for valid values. + +If the inherited resource \fIshadowScheme\fP or one of its family changes, new +GC's need to be created. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_redisplay = False; + + if ($direction != XfwfTop $direction != XfwfLeft + $direction != XfwfRight $direction != XfwfBottom) { + XtWarning("direction of Arrow widget incorrect; set to `top'"); + $direction = XfwfTop; + } + if ($old$direction != $direction) + need_redisplay = True; + if ($old$foreground != $foreground) { + create_arrowgc($); + need_redisplay = True; + } + if ($old$arrowShadow != $arrowShadow) + need_redisplay = True; + if ($shadowScheme != $old$shadowScheme) { + create_arrowdarkgc($); + create_arrowlightgc($); + need_redisplay = True; + } else if ($shadowScheme == XfwfColor) { + if ($topShadowColor != $old$topShadowColor) { + create_arrowlightgc($); + need_redisplay = True; + } + if ($bottomShadowColor != $old$bottomShadowColor) { + create_arrowdarkgc($); + need_redisplay = True; + } + } else if ($shadowScheme = XfwfStipple) { + if ($topShadowStipple != $old$topShadowStipple) { + create_arrowlightgc($); + need_redisplay = True; + } + if ($bottomShadowStipple != $old$bottomShadowStipple) { + create_arrowdarkgc($); + need_redisplay = True; + } + } + return need_redisplay; +} +.fi + +The arrow is drawn as large as possible. The arrow is actually a triangle +with 3D shadows. \fIp1\fP is the triangle itself, \fIp2\fP, \fIp3\fP and \fIp4\fP are the +shadows. + +\fBdef\fP point(p, i, xx, yy) = +(p[i ].x =xx ),(p[i ].y =yy ) + +.nf +expose($, XEvent * event, Region region) +{ + XPoint p1[3], p2[4], p3[4], p4[4]; + Position x, y; + Dimension width, height, a, a2, a3; + + assert($direction == XfwfTop || $direction == XfwfLeft + || $direction == XfwfRight || $direction == XfwfBottom); + + if (! XtIsRealized($)) return; + if (region != NULL) { + XSetRegion(XtDisplay($), $arrowgc, region); + XSetRegion(XtDisplay($), $arrowlightgc, region); + XSetRegion(XtDisplay($), $arrowdarkgc, region); + } + $compute_inside($, x, y, width, height); + a = $arrowShadow; + switch ($direction) { + case XfwfTop: + a2 = (1.0 + 0.71*width/height) * a; + a3 = (1.0 + 0.83*height/width) * a; + point(p1, 0, x + width/2, y + a3); + point(p1, 1, x + a2, y + height - a); + point(p1, 2, x + width - a2, y + height - a); + XFillPolygon(XtDisplay($), $window, $arrowgc, p1, 3, Convex, + CoordModeOrigin); + if (a == 0) break; + point(p2, 0, x + width/2, y); + point(p2, 1, x + width/2, y + a3); + point(p2, 2, x + width - a2, y + height - a); + point(p2, 3, x + width, y + height); + + point(p3, 0, x + a2, y + height - a); + point(p3, 1, x, y + height); + point(p3, 2, x + width, y + height); + point(p3, 3, x + width - a2, y + height - a); + + point(p4, 0, x + width/2, y); + point(p4, 1, x, y + height); + point(p4, 2, x + a2, y + height - a); + point(p4, 3, x + width/2, y + a3); + XFillPolygon(XtDisplay($), $window, $arrowdarkgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowdarkgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowlightgc, p4, 4, Convex, + CoordModeOrigin); + break; + case XfwfLeft: + a2 = (1.0 + 0.83*width/height) * a; + a3 = (1.0 + 0.71*height/width) * a; + point(p1, 0, x + a2, y + height/2); + point(p1, 1, x + width - a, y + a3); + point(p1, 2, x + width - a, y + height - a3); + XFillPolygon(XtDisplay($), $window, $arrowgc, p1, 3, Convex, + CoordModeOrigin); + if ($arrowShadow == 0) break; + point(p2, 0, x + width, y); + point(p2, 1, x, y + height/2); + point(p2, 2, x + a2, y + height/2); + point(p2, 3, x + width - a, y + a3); + + point(p3, 0, x, y + height/2); + point(p3, 1, x + width, y + height); + point(p3, 2, x + width - a, y + height - a3); + point(p3, 3, x + a2, y + height/2); + + point(p4, 0, x + width, y); + point(p4, 1, x + width - a, y + a3); + point(p4, 2, x + width - a, y + height - a3); + point(p4, 3, x + width, y + height); + XFillPolygon(XtDisplay($), $window, $arrowlightgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowdarkgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowdarkgc, p4, 4, Convex, + CoordModeOrigin); + break; + case XfwfBottom: + a2 = (1.0 + 0.71*width/height) * a; + a3 = (1.0 + 0.83*height/width) * a; + point(p1, 0, x + width/2, y + height - a3); + point(p1, 1, x + a2, y + a); + point(p1, 2, x + width - a2, y + a); + XFillPolygon(XtDisplay($), $window, $arrowgc, p1, 3, Convex, + CoordModeOrigin); + if ($arrowShadow == 0) break; + point(p2, 0, x, y); + point(p2, 1, x + width/2, y + height); + point(p2, 2, x + width/2, y + height - a3); + point(p2, 3, x + a2, y + a); + + point(p3, 0, x + width, y); + point(p3, 1, x + width - a2, y + a); + point(p3, 2, x + width/2, y + height - a3); + point(p3, 3, x + width/2, y + height); + + point(p4, 0, x, y); + point(p4, 1, x + a2, y + a); + point(p4, 2, x + width - a2, y + a); + point(p4, 3, x + width, y); + XFillPolygon(XtDisplay($), $window, $arrowlightgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowdarkgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowlightgc, p4, 4, Convex, + CoordModeOrigin); + break; + case XfwfRight: + a2 = (1.0 + 0.83*width/height) * a; + a3 = (1.0 + 0.71*height/width) * a; + point(p1, 0, x + width - $arrowShadow, y + height/2); + point(p1, 1, x + $arrowShadow, y + $arrowShadow); + point(p1, 2, x + $arrowShadow, y + height - $arrowShadow); + XFillPolygon(XtDisplay($), $window, $arrowgc, p1, 3, Convex, + CoordModeOrigin); + if ($arrowShadow == 0) break; + point(p2, 0, x, y + height); + point(p2, 1, x + width, y + height/2); + point(p2, 2, x + width - a2, y + height/2); + point(p2, 3, x + a, y + height - a3); + + point(p3, 0, x, y); + point(p3, 1, x + a, y + a3); + point(p3, 2, x + width - a2, y + height/2); + point(p3, 3, x + width, y + height/2); + + point(p4, 0, x, y); + point(p4, 1, x, y + height); + point(p4, 2, x + a, y + height - a3); + point(p4, 3, x + a, y + a3); + XFillPolygon(XtDisplay($), $window, $arrowdarkgc, p2, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowlightgc, p3, 4, Convex, + CoordModeOrigin); + XFillPolygon(XtDisplay($), $window, $arrowlightgc, p4, 4, Convex, + CoordModeOrigin); + break; + } + if (region != NULL) { + XSetClipMask(XtDisplay($), $arrowgc, None); + XSetClipMask(XtDisplay($), $arrowlightgc, None); + XSetClipMask(XtDisplay($), $arrowdarkgc, None); + } +} +.fi + +.hi + +.hi +.SH "Utilities" + +The time-out calls the \fItimer_callback\fP routine. The routine +re-installs the time-out and calls the \fIcallback\fP function (but in the +reverse order, because we do not want time-outs to overtake each +other). The delay is now \fIrepeatDelay\fP instead of \fIinitialDelay\fP. + +.nf +timer_callback(XtPointer client_data, XtIntervalId * timer) +{ + Widget $ = (Widget) client_data; + + XtCallCallbackList($, $callback, NULL); + $timer = XtAppAddTimeOut(XtWidgetToApplicationContext($), + $repeatDelay, timer_callback, $); +} +.fi + +The GC for the triangle is created by a utility function. It destroys the +old GC and then creates a new one, based on the \fIforeground\fP resource. + +.nf +create_arrowgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($arrowgc != NULL) XtReleaseGC($, $arrowgc); + mask = GCForeground; + values.foreground = $foreground; + $arrowgc = XtGetGC($, mask, values); +} +.fi + +The GC for the light shadow is dependent on the inherited \fIshadowScheme\fP +resource. It is the same routine as for the shadows in the XfwfFrame widget. + +.nf +create_arrowlightgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($arrowlightgc != NULL) XtReleaseGC($, $arrowlightgc); + switch ($shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = $topShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.background = $background_pixel; + values.stipple = $topShadowStipple; + values.foreground = WhitePixelOfScreen(XtScreen($)); + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen($)) > 4 + $lighter_color($, $foreground, values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = $foreground; + values.foreground = WhitePixelOfScreen(XtScreen($)); + values.stipple = + XCreateBitmapFromData(XtDisplay($), + RootWindowOfScreen(XtScreen($)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + $arrowlightgc = XtGetGC($, mask, values); +} +.fi + +The routine for the dark part of the shadow is analogous. + +.nf +create_arrowdarkgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($arrowdarkgc != NULL) XtReleaseGC($, $arrowdarkgc); + switch ($shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = $bottomShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.stipple = $bottomShadowStipple; + values.foreground = BlackPixelOfScreen(XtScreen($)); + values.background = $background_pixel; + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen($)) > 4 + $darker_color($, $foreground, values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = $foreground; + values.foreground = WhitePixelOfScreen(XtScreen($)); + values.stipple = + XCreateBitmapFromData(XtDisplay($), + RootWindowOfScreen(XtScreen($)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + $arrowdarkgc = XtGetGC($, mask, values); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/ArrowP.h b/vendor/x11iraf/obm/ObmW/ArrowP.h new file mode 100644 index 00000000..95162708 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ArrowP.h @@ -0,0 +1,51 @@ +/* Generated by wbuild from "Arrow.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfArrowP_H_ +#define _XfwfArrowP_H_ +#include "BoardP.h" +#include "Arrow.h" +typedef struct { +/* methods */ +#define point(p, i, xx, yy) (p[i ].x =xx ),(p[i ].y =yy ) + + +/* class variables */ +int dummy; +} XfwfArrowClassPart; +typedef struct _XfwfArrowClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfArrowClassPart xfwfArrow_class; +} XfwfArrowClassRec; + +typedef struct { +/* resources */ +Alignment direction; +Pixel foreground; +Dimension arrowShadow; +Cardinal initialDelay; +Cardinal repeatDelay; +XtCallbackList callback; +/* private state */ +GC arrowgc; +GC arrowlightgc; +GC arrowdarkgc; +XtIntervalId timer; +} XfwfArrowPart; + +typedef struct _XfwfArrowRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfArrowPart xfwfArrow; +} XfwfArrowRec; + +externalref XfwfArrowClassRec xfwfArrowClassRec; + +#endif /* _XfwfArrowP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Board.c b/vendor/x11iraf/obm/ObmW/Board.c new file mode 100644 index 00000000..b6182234 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Board.c @@ -0,0 +1,393 @@ +/* Generated by wbuild from "Board.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <stdio.h> +#include <stdlib.h> +#include <X11/Shell.h> +#include "BoardP.h" +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void set_abs_location( +#if NeedFunctionPrototypes +Widget,unsigned int ,int ,int ,int ,int +#endif +); +static void resize( +#if NeedFunctionPrototypes +Widget +#endif +); +static XtGeometryResult query_geometry( +#if NeedFunctionPrototypes +Widget,XtWidgetGeometry *,XtWidgetGeometry * +#endif +); +static XtGeometryResult geometry_manager( +#if NeedFunctionPrototypes +Widget ,XtWidgetGeometry *,XtWidgetGeometry * +#endif +); +static void change_managed( +#if NeedFunctionPrototypes +Widget +#endif +); +#define ceil(r) (-(int )(-(r ))) + + +static void generate_location( +#if NeedFunctionPrototypes +Widget +#endif +); +static void get_core_geometry( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +static void set_location( +#if NeedFunctionPrototypes +Widget,unsigned int +#endif +); +#define skip_blanks(s) while (isspace (*s ))s ++ + + +static char * scan( +#if NeedFunctionPrototypes +char *,Position *,float * +#endif +); +static void interpret_location( +#if NeedFunctionPrototypes +Widget +#endif +); +/*ARGSUSED*/static void generate_location(self)Widget self; +{ + char tmp[100]; + + (void) sprintf(tmp, "%d+%f %d+%f %d+%f %d+%f", + ((XfwfBoardWidget)self)->xfwfBoard.abs_x, ((XfwfBoardWidget)self)->xfwfBoard.rel_x, ((XfwfBoardWidget)self)->xfwfBoard.abs_y, ((XfwfBoardWidget)self)->xfwfBoard.rel_y, ((XfwfBoardWidget)self)->xfwfBoard.abs_width, ((XfwfBoardWidget)self)->xfwfBoard.rel_width, + ((XfwfBoardWidget)self)->xfwfBoard.abs_height, ((XfwfBoardWidget)self)->xfwfBoard.rel_height); + XtFree(((XfwfBoardWidget)self)->xfwfBoard.location); + ((XfwfBoardWidget)self)->xfwfBoard.location = XtNewString(tmp); +} +/*ARGSUSED*/static void get_core_geometry(self,x,y,width,height)Widget self;Position * x;Position * y;Dimension * width;Dimension * height; +{ + Widget parent; + Position px, py; + Dimension pw, ph; + float h; + + parent = ((XfwfBoardWidget)self)->core.parent; + if (XtIsSubclass(((XfwfBoardWidget)self)->core.parent, xfwfBoardWidgetClass)) + ((XfwfBoardWidgetClass)parent->core.widget_class)->xfwfCommon_class.compute_inside(parent, &px, &py, &pw, &ph); + else { + px = 0; + py = 0; + pw = ((XfwfBoardWidget)parent)->core.width; + ph = ((XfwfBoardWidget)parent)->core.height; + } + + *x = ceil(((XfwfBoardWidget)self)->xfwfBoard.rel_x * pw + ((XfwfBoardWidget)self)->xfwfBoard.abs_x * ((XfwfBoardWidget)self)->xfwfBoard.hunit) + px; + *y = ceil(((XfwfBoardWidget)self)->xfwfBoard.rel_y * ph + ((XfwfBoardWidget)self)->xfwfBoard.abs_y * ((XfwfBoardWidget)self)->xfwfBoard.vunit) + py; + h = ceil(((XfwfBoardWidget)self)->xfwfBoard.rel_width * pw + ((XfwfBoardWidget)self)->xfwfBoard.abs_width * ((XfwfBoardWidget)self)->xfwfBoard.hunit); + *width = h < 1.0 ? 1 : h; + h = ceil(((XfwfBoardWidget)self)->xfwfBoard.rel_height * ph + ((XfwfBoardWidget)self)->xfwfBoard.abs_height * ((XfwfBoardWidget)self)->xfwfBoard.vunit); + *height = h < 1.0 ? 1 : h; +} +/*ARGSUSED*/static void set_location(self,flags)Widget self;unsigned int flags; +{ + Widget parent; + Position px, py; + Dimension pw, ph; + + parent = ((XfwfBoardWidget)self)->core.parent; + if (XtIsSubclass(((XfwfBoardWidget)self)->core.parent, xfwfBoardWidgetClass)) + ((XfwfBoardWidgetClass)parent->core.widget_class)->xfwfCommon_class.compute_inside(parent, &px, &py, &pw, &ph); + else { + px = 0; + py = 0; + pw = ((XfwfBoardWidget)parent)->core.width; + ph = ((XfwfBoardWidget)parent)->core.height; + } + if (flags & CWX) { + ((XfwfBoardWidget)self)->xfwfBoard.rel_x = 0.0; + ((XfwfBoardWidget)self)->xfwfBoard.abs_x = ceil((((XfwfBoardWidget)self)->core.x - px)/((XfwfBoardWidget)self)->xfwfBoard.hunit); + } + if (flags & CWY) { + ((XfwfBoardWidget)self)->xfwfBoard.rel_y = 0.0; + ((XfwfBoardWidget)self)->xfwfBoard.abs_y = ceil((((XfwfBoardWidget)self)->core.y - py)/((XfwfBoardWidget)self)->xfwfBoard.vunit); + } + if (flags & CWWidth) { + ((XfwfBoardWidget)self)->xfwfBoard.rel_width = 0.0; + ((XfwfBoardWidget)self)->xfwfBoard.abs_width = ceil(((XfwfBoardWidget)self)->core.width/((XfwfBoardWidget)self)->xfwfBoard.hunit); + } + if (flags & CWHeight) { + ((XfwfBoardWidget)self)->xfwfBoard.rel_height = 0.0; + ((XfwfBoardWidget)self)->xfwfBoard.abs_height = ceil(((XfwfBoardWidget)self)->core.height/((XfwfBoardWidget)self)->xfwfBoard.vunit); + } +} +/*ARGSUSED*/static char * scan(s,absval,relval)char * s;Position * absval;float * relval; +{ + Position n; + char *t; + Boolean minus; + extern double strtod(); + + *absval = 0; + *relval = 0.0; + n = strtol(s, &t, 0); + if (*t != '.') { /* Found an integer */ + *absval = n; + s = t; + skip_blanks(s); + if (*s != '+' && *s != '-') return s; /* Nothing follows */ + n = strtol(s + 1, &t, 0); + if (*t != '.') return s; /* It's not a float */ + minus = (*s == '-'); + *relval = (float) strtod(s + 1, &s); /* Found a float */ + if (minus) *relval = - *relval; + return s; + } else { /* Found a float */ + *relval = (float) strtod(s, &s); + skip_blanks(s); + if (*s != '+' && *s != '-') return s; /* Nothing follows */ + n = strtol(s + 1, &t, 0); + if (*t == '.') return s; /* It's not an integer */ + if (*s == '-') *absval = -n; else *absval = n; + return t; + } +} +/*ARGSUSED*/static void interpret_location(self)Widget self; +{ + char *s, *t; + + s = ((XfwfBoardWidget)self)->xfwfBoard.location; + s = scan(s, &((XfwfBoardWidget)self)->xfwfBoard.abs_x, &((XfwfBoardWidget)self)->xfwfBoard.rel_x); + s = scan(s, &((XfwfBoardWidget)self)->xfwfBoard.abs_y, &((XfwfBoardWidget)self)->xfwfBoard.rel_y); + s = scan(s, &((XfwfBoardWidget)self)->xfwfBoard.abs_width, &((XfwfBoardWidget)self)->xfwfBoard.rel_width); + s = scan(s, &((XfwfBoardWidget)self)->xfwfBoard.abs_height, &((XfwfBoardWidget)self)->xfwfBoard.rel_height); +} + +static XtResource resources[] = { +{XtNabs_x,XtCAbs_x,XtRPosition,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.abs_x),XtOffsetOf(XfwfBoardRec,xfwfBoard.abs_x),XtRImmediate,(XtPointer)0 }, +{XtNrel_x,XtCRel_x,XtRFloat,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.rel_x),XtOffsetOf(XfwfBoardRec,xfwfBoard.rel_x),XtRString,(XtPointer)"0.0"}, +{XtNabs_y,XtCAbs_y,XtRPosition,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.abs_y),XtOffsetOf(XfwfBoardRec,xfwfBoard.abs_y),XtRImmediate,(XtPointer)0 }, +{XtNrel_y,XtCRel_y,XtRFloat,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.rel_y),XtOffsetOf(XfwfBoardRec,xfwfBoard.rel_y),XtRString,(XtPointer)"0.0"}, +{XtNx,XtCX,XtRPosition,sizeof(((XfwfBoardRec*)NULL)->core.x),XtOffsetOf(XfwfBoardRec,core.x),XtRImmediate,(XtPointer)MAGICNUM }, +{XtNy,XtCY,XtRPosition,sizeof(((XfwfBoardRec*)NULL)->core.y),XtOffsetOf(XfwfBoardRec,core.y),XtRImmediate,(XtPointer)MAGICNUM }, +{XtNabs_width,XtCAbs_width,XtRPosition,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.abs_width),XtOffsetOf(XfwfBoardRec,xfwfBoard.abs_width),XtRImmediate,(XtPointer)0 }, +{XtNrel_width,XtCRel_width,XtRFloat,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.rel_width),XtOffsetOf(XfwfBoardRec,xfwfBoard.rel_width),XtRString,(XtPointer)"1.0"}, +{XtNabs_height,XtCAbs_height,XtRPosition,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.abs_height),XtOffsetOf(XfwfBoardRec,xfwfBoard.abs_height),XtRImmediate,(XtPointer)0 }, +{XtNrel_height,XtCRel_height,XtRFloat,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.rel_height),XtOffsetOf(XfwfBoardRec,xfwfBoard.rel_height),XtRString,(XtPointer)"1.0"}, +{XtNwidth,XtCWidth,XtRDimension,sizeof(((XfwfBoardRec*)NULL)->core.width),XtOffsetOf(XfwfBoardRec,core.width),XtRImmediate,(XtPointer)MAGICNUM }, +{XtNheight,XtCHeight,XtRDimension,sizeof(((XfwfBoardRec*)NULL)->core.height),XtOffsetOf(XfwfBoardRec,core.height),XtRImmediate,(XtPointer)MAGICNUM }, +{XtNhunit,XtCHunit,XtRFloat,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.hunit),XtOffsetOf(XfwfBoardRec,xfwfBoard.hunit),XtRString,(XtPointer)"1.0"}, +{XtNvunit,XtCVunit,XtRFloat,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.vunit),XtOffsetOf(XfwfBoardRec,xfwfBoard.vunit),XtRString,(XtPointer)"1.0"}, +{XtNlocation,XtCLocation,XtRString,sizeof(((XfwfBoardRec*)NULL)->xfwfBoard.location),XtOffsetOf(XfwfBoardRec,xfwfBoard.location),XtRImmediate,(XtPointer)NULL }, +}; + +XfwfBoardClassRec xfwfBoardClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfFrameClassRec, +"Board", +sizeof(XfwfBoardRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +NULL, +0, +resources, +15, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +resize, +XtInheritExpose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +query_geometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +geometry_manager, +change_managed, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +set_abs_location, +}, +}; +WidgetClass xfwfBoardWidgetClass = (WidgetClass) &xfwfBoardClassRec; +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfBoardWidgetClass c = (XfwfBoardWidgetClass) class; + XfwfBoardWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (CompositeClassExtensionRec *)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = (XtPointer)ext; + if (class == xfwfBoardWidgetClass) return; + super = (XfwfBoardWidgetClass)class->core_class.superclass; + if (c->xfwfBoard_class.set_abs_location == XtInherit_set_abs_location) + c->xfwfBoard_class.set_abs_location = super->xfwfBoard_class.set_abs_location; +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + XtWidgetGeometry reply; + int i; + + if (((XfwfBoardWidget)self)->xfwfBoard.location != ((XfwfBoardWidget)old)->xfwfBoard.location) { + XtFree(((XfwfBoardWidget)old)->xfwfBoard.location); + ((XfwfBoardWidget)self)->xfwfBoard.location = XtNewString(((XfwfBoardWidget)self)->xfwfBoard.location); + interpret_location(self); + get_core_geometry(self, &((XfwfBoardWidget)self)->core.x, &((XfwfBoardWidget)self)->core.y, &((XfwfBoardWidget)self)->core.width, &((XfwfBoardWidget)self)->core.height); + } else if (ceil(((XfwfBoardWidget)self)->xfwfBoard.abs_x*((XfwfBoardWidget)self)->xfwfBoard.hunit) != ceil(((XfwfBoardWidget)old)->xfwfBoard.abs_x*((XfwfBoardWidget)old)->xfwfBoard.hunit) + || ceil(((XfwfBoardWidget)self)->xfwfBoard.abs_width*((XfwfBoardWidget)self)->xfwfBoard.hunit) != ceil(((XfwfBoardWidget)old)->xfwfBoard.abs_width*((XfwfBoardWidget)old)->xfwfBoard.hunit) + || ceil(((XfwfBoardWidget)self)->xfwfBoard.abs_y*((XfwfBoardWidget)self)->xfwfBoard.vunit) != ceil(((XfwfBoardWidget)old)->xfwfBoard.abs_y*((XfwfBoardWidget)old)->xfwfBoard.vunit) + || ceil(((XfwfBoardWidget)self)->xfwfBoard.abs_height*((XfwfBoardWidget)self)->xfwfBoard.vunit) != ceil(((XfwfBoardWidget)old)->xfwfBoard.abs_height*((XfwfBoardWidget)old)->xfwfBoard.vunit) + || ((XfwfBoardWidget)self)->xfwfBoard.rel_x != ((XfwfBoardWidget)old)->xfwfBoard.rel_x + || ((XfwfBoardWidget)self)->xfwfBoard.rel_y != ((XfwfBoardWidget)old)->xfwfBoard.rel_y + || ((XfwfBoardWidget)self)->xfwfBoard.rel_width != ((XfwfBoardWidget)old)->xfwfBoard.rel_width + || ((XfwfBoardWidget)self)->xfwfBoard.rel_height != ((XfwfBoardWidget)old)->xfwfBoard.rel_height) { + get_core_geometry(self, &((XfwfBoardWidget)self)->core.x, &((XfwfBoardWidget)self)->core.y, &((XfwfBoardWidget)self)->core.width, &((XfwfBoardWidget)self)->core.height); + generate_location(self); + } else if (((XfwfBoardWidget)self)->core.x != ((XfwfBoardWidget)old)->core.x + || ((XfwfBoardWidget)self)->core.y != ((XfwfBoardWidget)old)->core.y + || ((XfwfBoardWidget)self)->core.width != ((XfwfBoardWidget)old)->core.width + || ((XfwfBoardWidget)self)->core.height != ((XfwfBoardWidget)old)->core.height) { + set_location(self, CWX | CWY | CWWidth | CWHeight); + generate_location(self); + } + if (((XfwfBoardWidget)self)->xfwfCommon.highlightThickness + ((XfwfBoardWidget)self)->xfwfFrame.frameWidth + ((XfwfBoardWidget)self)->xfwfFrame.outerOffset + ((XfwfBoardWidget)self)->xfwfFrame.innerOffset + != ((XfwfBoardWidget)old)->xfwfCommon.highlightThickness + ((XfwfBoardWidget)old)->xfwfFrame.frameWidth + ((XfwfBoardWidget)old)->xfwfFrame.outerOffset + + ((XfwfBoardWidget)self)->xfwfFrame.innerOffset) { + for (i = 0; i < ((XfwfBoardWidget)self)->composite.num_children; i++) { + (void) XtQueryGeometry(((XfwfBoardWidget)self)->composite.children[i], NULL, &reply); + XtConfigureWidget(((XfwfBoardWidget)self)->composite.children[i], reply.x, reply.y, reply.width, + reply.height, reply.border_width); + } + } + return False; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + if (((XfwfBoardWidget)self)->xfwfBoard.location != NULL) { + ((XfwfBoardWidget)self)->xfwfBoard.location = XtNewString(((XfwfBoardWidget)self)->xfwfBoard.location); + interpret_location(self); + get_core_geometry(self, &((XfwfBoardWidget)self)->core.x, &((XfwfBoardWidget)self)->core.y, &((XfwfBoardWidget)self)->core.width, &((XfwfBoardWidget)self)->core.height); + } else if (((XfwfBoardWidget)self)->core.x != MAGICNUM || ((XfwfBoardWidget)self)->core.y != MAGICNUM + || ((XfwfBoardWidget)self)->core.width != MAGICNUM || ((XfwfBoardWidget)self)->core.height != MAGICNUM) { + set_location(self, CWX | CWY | CWWidth | CWHeight); + generate_location(self); + } else { + generate_location(self); + get_core_geometry(self, &((XfwfBoardWidget)self)->core.x, &((XfwfBoardWidget)self)->core.y, &((XfwfBoardWidget)self)->core.width, &((XfwfBoardWidget)self)->core.height); + } +} +/*ARGSUSED*/static void set_abs_location(self,flags,x,y,w,h)Widget self;unsigned int flags;int x;int y;int w;int h; +{ + if (flags & (CWX | CWY | CWWidth | CWHeight) == 0) return; + if (flags & CWX) ((XfwfBoardWidget)self)->core.x = x; + if (flags & CWY) ((XfwfBoardWidget)self)->core.y = y; + if (flags & CWWidth) ((XfwfBoardWidget)self)->core.width = w; + if (flags & CWHeight) ((XfwfBoardWidget)self)->core.height = h; + set_location(self, flags); + generate_location(self); +} +/*ARGSUSED*/static void resize(self)Widget self; +{ + int i; + XtWidgetGeometry reply; + Widget child; + + for (i = 0; i < ((XfwfBoardWidget)self)->composite.num_children; i++) { + child = ((XfwfBoardWidget)self)->composite.children[i]; + (void) XtQueryGeometry(child, NULL, &reply); + XtConfigureWidget(child, reply.x, reply.y, reply.width, + reply.height, reply.border_width); + } +} +/*ARGSUSED*/static XtGeometryResult query_geometry(self,request,reply)Widget self;XtWidgetGeometry * request;XtWidgetGeometry * reply; +{ + reply->request_mode = CWX | CWY | CWWidth | CWHeight; + get_core_geometry(self, &reply->x, &reply->y, + &reply->width, &reply->height); + return XtGeometryAlmost; +} +/*ARGSUSED*/static XtGeometryResult geometry_manager(child,request,reply)Widget child;XtWidgetGeometry * request;XtWidgetGeometry * reply; +{ Widget self = XtParent(child); { + Widget self = XtParent(child); + Dimension wd, ht, bw; + Position x, y; + + /* Get complete geometry, from request or current value */ + x = request->request_mode & CWX ? request->x : ((XfwfBoardWidget)child)->core.x; + y = request->request_mode & CWY ? request->y : ((XfwfBoardWidget)child)->core.y; + wd = request->request_mode & CWWidth ? request->width : ((XfwfBoardWidget)child)->core.width; + ht = request->request_mode & CWHeight ? request->height : ((XfwfBoardWidget)child)->core.height; + bw = request->request_mode & CWBorderWidth ? request->border_width + : ((XfwfBoardWidget)child)->core.border_width; + + XtConfigureWidget(child, x, y, wd, ht, bw); + return XtGeometryDone; +} +} +/*ARGSUSED*/static void change_managed(self)Widget self; +{ + Widget top = self, w; + + while (! XtIsSubclass(top, shellWidgetClass)) top = XtParent(top) ; + for (w = self; w != top; w = XtParent(w)) XtInstallAllAccelerators(w, top); +} diff --git a/vendor/x11iraf/obm/ObmW/Board.h b/vendor/x11iraf/obm/ObmW/Board.h new file mode 100644 index 00000000..f38591b4 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Board.h @@ -0,0 +1,120 @@ +/* Generated by wbuild from "Board.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfBoard_H_ +#define _XfwfBoard_H_ +#include "Frame.h" +#ifndef XtNabs_x +#define XtNabs_x "abs_x" +#endif +#ifndef XtCAbs_x +#define XtCAbs_x "Abs_x" +#endif +#ifndef XtRPosition +#define XtRPosition "Position" +#endif + +#ifndef XtNrel_x +#define XtNrel_x "rel_x" +#endif +#ifndef XtCRel_x +#define XtCRel_x "Rel_x" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNabs_y +#define XtNabs_y "abs_y" +#endif +#ifndef XtCAbs_y +#define XtCAbs_y "Abs_y" +#endif +#ifndef XtRPosition +#define XtRPosition "Position" +#endif + +#ifndef XtNrel_y +#define XtNrel_y "rel_y" +#endif +#ifndef XtCRel_y +#define XtCRel_y "Rel_y" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNabs_width +#define XtNabs_width "abs_width" +#endif +#ifndef XtCAbs_width +#define XtCAbs_width "Abs_width" +#endif +#ifndef XtRPosition +#define XtRPosition "Position" +#endif + +#ifndef XtNrel_width +#define XtNrel_width "rel_width" +#endif +#ifndef XtCRel_width +#define XtCRel_width "Rel_width" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNabs_height +#define XtNabs_height "abs_height" +#endif +#ifndef XtCAbs_height +#define XtCAbs_height "Abs_height" +#endif +#ifndef XtRPosition +#define XtRPosition "Position" +#endif + +#ifndef XtNrel_height +#define XtNrel_height "rel_height" +#endif +#ifndef XtCRel_height +#define XtCRel_height "Rel_height" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNhunit +#define XtNhunit "hunit" +#endif +#ifndef XtCHunit +#define XtCHunit "Hunit" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNvunit +#define XtNvunit "vunit" +#endif +#ifndef XtCVunit +#define XtCVunit "Vunit" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNlocation +#define XtNlocation "location" +#endif +#ifndef XtCLocation +#define XtCLocation "Location" +#endif +#ifndef XtRString +#define XtRString "String" +#endif + +typedef struct _XfwfBoardClassRec *XfwfBoardWidgetClass; +typedef struct _XfwfBoardRec *XfwfBoardWidget; +externalref WidgetClass xfwfBoardWidgetClass; +#endif /*_XfwfBoard_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Board.man b/vendor/x11iraf/obm/ObmW/Board.man new file mode 100644 index 00000000..412e055c --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Board.man @@ -0,0 +1,749 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfBoard +.SH DESCRIPTION +The Board class adds one thing to the capabilities already present +in the Frame class, viz., location management. + +Location management is an improved version of the standard X geometry +management. Size and position of a Board widget (or subclass) can be +given as a combination of absolute and relative sizes. + +In contrast to its superclass Frame, Board accepts any number of +children. No layout policy is enforced, however. The children are +expected to be positioned with the help of their own geometry or +location resources. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +The location management relies on a total of ten resources plus a +string resource that combines eight of them in a more convenient and +compact notation. The location is given by two values in each of the +four dimensions (x, y, width and height). One value holds the absolute +position in pixels, the other holds the position relative to the +parent's width. E.g., When \fIabs_x\fP is 20 and \fIrel_x\fP is 0.3, the x +position of the widget will be 20 pixels plus 0.3 times the width of +the parent. For more examples, see the \fIlocation\fP resource below. + +The ninth and tenth resources are \fIhunit\fP and \fIvunit\fP. All assignments +to the \fIabs_*\fP resources are multiplied by \fIhunit\fP (horizontal) or +\fIvunit\fP (vertical). Normally the units are 1, but, e.g., a widget that +displays text might set them to the width and height of character +cells, so that \fIabs_width = 80\fP means a width of 80 characters, +instead of 80 pixels. + +The geometry resources of the Core widget (\fIx\fP, \fIy\fP, \fIwidth\fP and +\fIheight\fP are still available. When they are set, the values are +copied to the \fIabs_*\fP variables and the \fIrel_*\fP variables are set to +0.0. + +It is possible that the parent of the current widget doesn't grant the +preferred geometry. In that case the location variables and the geometry +variables will not be synchronized. The location variables will then be +taken to hold the preferred geometry, instead of the actual one. + +.TP +.I "XtNabs_x" +The position is determined by the four resources \fIabs_x\fP, \fIrel_x\fP, +\fIabs_y\fP and \fIrel_y\fP. When the parent is (a subclass of) a Board +widget, the position is not measured from the real size of the parent, +but from the size inside the frame. + +(The representation of the float values as strings seems necessary, +because the compiler can't cast a float to a pointer.) + +.hi + +.nf +Position abs_x = 0 +.fi + +.eh + +.TP +.I "XtNrel_x" + +.hi + +.nf +float rel_x = <String>"0.0" +.fi + +.eh + +.TP +.I "XtNabs_y" + +.hi + +.nf +Position abs_y = 0 +.fi + +.eh + +.TP +.I "XtNrel_y" + +.hi + +.nf +float rel_y = <String>"0.0" +.fi + +.eh + +.TP +.I "XtNMAGICNUM" +By setting default values for the \fIx\fP and \fIy\fP variables from Core +explicitly, we can be sure that the variables are synchronized from the +start. If the \fIinitialize\fP method detects a change in any of them, it can +re-synchronize them. + +.hi + +.nf + MAGICNUM = +.fi + +.eh + +.TP +.I "XtNx" + +.hi + +.nf + x = MAGICNUM +.fi + +.eh + +.TP +.I "XtNy" + +.hi + +.nf + y = MAGICNUM +.fi + +.eh + +.TP +.I "XtNabs_width" +The default values cause a Board widget to be the same size as it's +parent at all times, provided, of course, that the parent allows that. +If the parent is (a subclass of) a Board widget, the size is relative +to the area inside the parent's frame, instead of the total size of +the parent. + +.hi + +.nf +Position abs_width = 0 +.fi + +.eh + +.TP +.I "XtNrel_width" + +.hi + +.nf +float rel_width = <String>"1.0" +.fi + +.eh + +.TP +.I "XtNabs_height" + +.hi + +.nf +Position abs_height = 0 +.fi + +.eh + +.TP +.I "XtNrel_height" + +.hi + +.nf +float rel_height = <String>"1.0" +.fi + +.eh + +.TP +.I "XtNwidth" +The Core variables are given strange defaults, in the hope that the +\fIinitialize\fP method can detect a change in them. + +.hi + +.nf + width = MAGICNUM +.fi + +.eh + +.TP +.I "XtNheight" + +.hi + +.nf + height = MAGICNUM +.fi + +.eh + +.TP +.I "XtNhunit" +\fIhunit\fP is a value in pixels by which \fIabs_x\fP and \fIabs_width\fP are +multiplied; \fIabs_y\fP and \fIabs_height\fP are multiplied by \fIvunit\fP. The +results are rounded to the next larger whole number. + +.hi + +.nf +float hunit = <String>"1.0" +.fi + +.eh + +.TP +.I "XtNvunit" + +.hi + +.nf +float vunit = <String>"1.0" +.fi + +.eh + +.TP +.I "XtNlocation" +Specifying eight resources in a resource file is more easily done +with the string resource \fIlocation\fP. The string contains four +expressions of the form $x_a\pm x_r$ or $x_r\pm x_a$ or $x_a$ or +$x_r$, where $x_a$ is the absolute value and $x_r$ is the relative +value. The two are distinguished by the fact that $x_r$ {\em must} +contain a decimal point. + +Examples: \fI"0.5 - 20 5 40 1.0 - 50"\fP is a widget of fixed width (40 +units) that is horizontally centered; the height is always 50 units +less than the height of the parent. + +\fI"0 0 2.0 3.0"\fP is a widget that is twice as wide and three times as +high as its parent. + +\fI"-20 0 20 20"\fP is a widget that will be invisible, because it is +located 20 units to the left of the parent and it is also 20 units +wide. + +The initial value is \fINULL\fP, but the \fIinitialize\fP method will make sure +that the string is synchronized with the other variables. + +.hi + +.nf +String location = NULL +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.hi +.SH "Importss" + +.nf + +.B incl + <stdio.h> +.fi + +.nf + +.B incl + <stdlib.h> +.fi + +.nf + +.B incl + <X11/Shell.h> +.fi + +.hi + +.hi +.SS "Methods" + +Changes in the location resources result in changes in the core +geometry resources. If the location resources didn't change, but the +core geometry resources did, the location variables are set +accordingly. If various resources are changes at the same time, +\fIlocation\fP takes precedence, followed by the \fIabs_*\fP and \fIrel_*\fP +variables, and finally the core geometry variables \fIx\fP, \fIy\fP, \fIwidth\fP +and \fIheight\fP. + +\fIset_values\fP takes care that all these resources always correspond to +each other; even the \fIlocation\fP string is re-generated when any of the +others change. + +Since the location is handled by setting the core geometry resources, +there is never any need to redraw the widget. + +A complication arises when the frame of the Board widget changes, +since children may have sizes that are relative to the area inside the +frame. The Board widget therefore gives its children a chance to +calculate their new locations in this case. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + XtWidgetGeometry reply; + int i; + + if ($location != $old$location) { + XtFree($old$location); + $location = XtNewString($location); + interpret_location($); + get_core_geometry($, $x, $y, $width, $height); + } else if (ceil($abs_x*$hunit) != ceil($old$abs_x*$old$hunit) + || ceil($abs_width*$hunit) != ceil($old$abs_width*$old$hunit) + || ceil($abs_y*$vunit) != ceil($old$abs_y*$old$vunit) + || ceil($abs_height*$vunit) != ceil($old$abs_height*$old$vunit) + || $rel_x != $old$rel_x + || $rel_y != $old$rel_y + || $rel_width != $old$rel_width + || $rel_height != $old$rel_height) { + get_core_geometry($, $x, $y, $width, $height); + generate_location($); + } else if ($x != $old$x + || $y != $old$y + || $width != $old$width + || $height != $old$height) { + set_location($, CWX | CWY | CWWidth | CWHeight); + generate_location($); + } + if ($highlightThickness + $frameWidth + $outerOffset + $innerOffset + != $old$highlightThickness + $old$frameWidth + $old$outerOffset + + $innerOffset) { + for (i = 0; i < $num_children; i++) { + (void) XtQueryGeometry($children[i], NULL, reply); + XtConfigureWidget($children[i], reply.x, reply.y, reply.width, + reply.height, reply.border_width); + } + } + return False; +} +.fi + +The initialize method is used to synchronize the location and geometry +resources for the first time. It is difficult to find out which variables +have been set from resources and which still have their initial value, we +rely on the fact that the default value is unlikely to be used in +practice. + +If the \fIlocation\fP string has been set, it will be used to set all other +variables. If the Core geometry resources have been set, we use them, +otherwise, the location variables will determine the size and position. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + if ($location != NULL) { + $location = XtNewString($location); + interpret_location($); + get_core_geometry($, $x, $y, $width, $height); + } else if ($x != MAGICNUM || $y != MAGICNUM + || $width != MAGICNUM || $height != MAGICNUM) { + set_location($, CWX | CWY | CWWidth | CWHeight); + generate_location($); + } else { + generate_location($); + get_core_geometry($, $x, $y, $width, $height); + } +} +.fi + +The \fIset_abs_location\fP method is a convenience function for use by +subclasses. When they want to set the \fIx\fP, \fIy\fP, \fIwidth\fP or \fIheight\fP +resources, they can call this function which will than also adjust the +other location resources accordingly. The flags determine which +resources are set, it is a bitwise combination of \fICWX\fP, \fICWY\fP, +\fICWWidth\fP and \fICWHeight\fP. + +.nf +set_abs_location($, unsigned int flags, int x, int y, int w, int h) +{ + if (flags (CWX | CWY | CWWidth | CWHeight) == 0) return; + if (flags CWX) $x = x; + if (flags CWY) $y = y; + if (flags CWWidth) $width = w; + if (flags CWHeight) $height = h; + set_location($, flags); + generate_location($); +} +.fi + +The \fIresize\fP method is called when the widget is resized. The children +of the Board widget will be given a chance to re-compute their preferred +locations, which will then be granted them. It may be possible that the +parent of the current widget didn't grant the preferred geometry. In that +case the geometry variables will be different from the location variables. +The latter will not be changed, in the hope that the requested geometry +can be set later. + +.nf +resize($) +{ + int i; + XtWidgetGeometry reply; + Widget child; + + for (i = 0; i < $num_children; i++) { + child = $children[i]; + (void) XtQueryGeometry(child, NULL, reply); + XtConfigureWidget(child, reply.x, reply.y, reply.width, + reply.height, reply.border_width); + } +} +.fi + +When the Board's parent asks for this widget's preferred geometry, +simply return the geometry as indicated by the location variables. +Currently, the method always returns \fIXtGeometryAlmost\fP. It doesn't bother +to check if the preferred geometry is equal to the current geometry (in +which case it should really return \fIXtGeometryNo\fP) or if the preferred +geometry is equal to what the parent proposed (in which case a return of +\fIXtGeometryYes\fP should have been given. + +It seems that no harm is done by always returning \fIXtGeometryAlmost\fP and +letting Xt figure out what really needs to be changed. + +.nf +XtGeometryResult query_geometry($, XtWidgetGeometry * request, XtWidgetGeometry * reply) +{ + reply->request_mode = CWX | CWY | CWWidth | CWHeight; + get_core_geometry($, reply->x, reply->y, + reply->width, reply->height); + return XtGeometryAlmost; +} +.fi + +If a child requests to be resized, the request is always granted. We +ignore stacking order. + +.nf +XtGeometryResult geometry_manager(Widget child, XtWidgetGeometry * request, XtWidgetGeometry * reply) +{ + Widget $ = XtParent(child); + Dimension wd, ht, bw; + Position x, y; + + /* Get complete geometry, from request or current value */ + x = request->request_mode CWX ? request->x : $child$x; + y = request->request_mode CWY ? request->y : $child$y; + wd = request->request_mode CWWidth ? request->width : $child$width; + ht = request->request_mode CWHeight ? request->height : $child$height; + bw = request->request_mode CWBorderWidth ? request->border_width + : $child$border_width; + + XtConfigureWidget(child, x, y, wd, ht, bw); + return XtGeometryDone; +} +.fi + +If a child becomes managed or unmanaged, the Board widget is given a +change to resize or reposition the child. The Board widget doesn't do +that, but it does install all accelerators of its descendants here. + +.nf +change_managed($) +{ + Widget top = $, w; + + while (! XtIsSubclass(top, shellWidgetClass)) top = XtParent(top) ; + for (w = $; w != top; w = XtParent(w)) XtInstallAllAccelerators(w, top); +} +.fi + +.hi + +.hi +.SH "Utilities" + +\fBdef\fP ceil(r) = +(-(int )(-(r ))) + +The routine \fIgenerate_location\fP creates the string \fIlocation\fP from the +values of the location resources. + +.nf +generate_location($) +{ + char tmp[100]; + + (void) sprintf(tmp, "%d+%f %d+%f %d+%f %d+%f", + $abs_x, $rel_x, $abs_y, $rel_y, $abs_width, $rel_width, + $abs_height, $rel_height); + XtFree($location); + $location = XtNewString(tmp); +} +.fi + +To get the core geometry from the location variables, the function +\fIget_core_geometry\fP is used. It combines the relative and absolute +parts of the location and sets the result in the passed variables. +When the parent is a Board widget or a subclass thereof, the area +inside the parent's frame is used for calculations, otherwise the +whole area of the parent will be used. + +As a safeguard against possible non-positive sizes, the width and +height cannot become smaller than 1 pixel. + +.nf +get_core_geometry($, Position * x, Position * y, Dimension * width, Dimension * height) +{ + Widget parent; + Position px, py; + Dimension pw, ph; + float h; + + parent = $parent; + if (XtIsSubclass($parent, xfwfBoardWidgetClass)) + $parent$compute_inside(parent, px, py, pw, ph); + else { + px = 0; + py = 0; + pw = $parent$width; + ph = $parent$height; + } + + *x = ceil($rel_x * pw + $abs_x * $hunit) + px; + *y = ceil($rel_y * ph + $abs_y * $vunit) + py; + h = ceil($rel_width * pw + $abs_width * $hunit); + *width = h < 1.0 ? 1 : h; + h = ceil($rel_height * ph + $abs_height * $vunit); + *height = h < 1.0 ? 1 : h; +} +.fi + +The reverse operation, computing the location variables from the core +geometry is done by \fIset_location\fP. + +.nf +set_location($, unsigned int flags) +{ + Widget parent; + Position px, py; + Dimension pw, ph; + + parent = $parent; + if (XtIsSubclass($parent, xfwfBoardWidgetClass)) + $parent$compute_inside(parent, px, py, pw, ph); + else { + px = 0; + py = 0; + pw = $parent$width; + ph = $parent$height; + } + if (flags CWX) { + $rel_x = 0.0; + $abs_x = ceil(($x - px)/$hunit); + } + if (flags CWY) { + $rel_y = 0.0; + $abs_y = ceil(($y - py)/$vunit); + } + if (flags CWWidth) { + $rel_width = 0.0; + $abs_width = ceil($width/$hunit); + } + if (flags CWHeight) { + $rel_height = 0.0; + $abs_height = ceil($height/$vunit); + } +} +.fi + +Interpreting the \fIlocation\fP string is a little harder, but still +straightforward. Only numbers (with or without decimal points) and plus +and minus signs can appear in the string. + +\fIscan\fP recognizes four formats: an integer followed by a plus or minus +and a float, a float followed by a plus or minus and an integer, a single +integer, or a single float. + +\fBdef\fP skip_blanks(s) = +while (isspace (*s ))s ++ + +.nf +char * scan(char * s, Position * absval, float * relval) +{ + Position n; + char *t; + Boolean minus; + + *absval = 0; + *relval = 0.0; + n = strtol(s, t, 0); + if (*t != '.') { /* Found an integer */ + *absval = n; + s = t; + skip_blanks(s); + if (*s != '+' *s != '-') return s; /* Nothing follows */ + n = strtol(s + 1, t, 0); + if (*t != '.') return s; /* It's not a float */ + minus = (*s == '-'); + *relval = strtod(s + 1, s); /* Found a float */ + if (minus) *relval = - *relval; + return s; + } else { /* Found a float */ + *relval = strtod(s, s); + skip_blanks(s); + if (*s != '+' *s != '-') return s; /* Nothing follows */ + n = strtol(s + 1, t, 0); + if (*t == '.') return s; /* It's not an integer */ + if (*s == '-') *absval = -n; else *absval = n; + return t; + } +} +.fi + +.nf +interpret_location($) +{ + char *s, *t; + + s = $location; + s = scan(s, $abs_x, $rel_x); + s = scan(s, $abs_y, $rel_y); + s = scan(s, $abs_width, $rel_width); + s = scan(s, $abs_height, $rel_height); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/BoardP.h b/vendor/x11iraf/obm/ObmW/BoardP.h new file mode 100644 index 00000000..6824bc93 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/BoardP.h @@ -0,0 +1,56 @@ +/* Generated by wbuild from "Board.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfBoardP_H_ +#define _XfwfBoardP_H_ +#include "FrameP.h" +#include "Board.h" +typedef void (*set_abs_location_Proc)( +#if NeedFunctionPrototypes +Widget,unsigned int ,int ,int ,int ,int +#endif +); +#define XtInherit_set_abs_location ((set_abs_location_Proc) _XtInherit) +typedef struct { +/* methods */ +set_abs_location_Proc set_abs_location; +/* class variables */ +} XfwfBoardClassPart; +typedef struct _XfwfBoardClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +} XfwfBoardClassRec; + +typedef struct { +/* resources */ +Position abs_x; +float rel_x; +Position abs_y; +float rel_y; +#define MAGICNUM 12349 + + +Position abs_width; +float rel_width; +Position abs_height; +float rel_height; +float hunit; +float vunit; +String location; +/* private state */ +} XfwfBoardPart; + +typedef struct _XfwfBoardRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +} XfwfBoardRec; + +externalref XfwfBoardClassRec xfwfBoardClassRec; + +#endif /* _XfwfBoardP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Button.c b/vendor/x11iraf/obm/ObmW/Button.c new file mode 100644 index 00000000..1704a886 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Button.c @@ -0,0 +1,123 @@ +/* Generated by wbuild from "Button.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "ButtonP.h" +static void activate( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"activate", activate}, +}; + +static char defaultTranslations[] = "\ +<Btn1Down>: set_shadow(sunken) \n\ +<Btn1Down>,<Btn1Up>: activate() set_shadow() \n\ +Button1<Leave>: set_shadow() \n\ +<Key>Return: set_shadow(sunken) activate() set_shadow() \n\ +"; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); + +static XtResource resources[] = { +{XtNactivate,XtCActivate,XtRCallback,sizeof(((XfwfButtonRec*)NULL)->xfwfButton.activate),XtOffsetOf(XfwfButtonRec,xfwfButton.activate),XtRImmediate,(XtPointer)NULL }, +{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfButtonRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfButtonRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 }, +{XtNtraversalOn,XtCTraversalOn,XtRBoolean,sizeof(((XfwfButtonRec*)NULL)->xfwfCommon.traversalOn),XtOffsetOf(XfwfButtonRec,xfwfCommon.traversalOn),XtRImmediate,(XtPointer)True }, +}; + +XfwfButtonClassRec xfwfButtonClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfLabelClassRec, +"TextButton", +sizeof(XfwfButtonRec), +NULL, +_resolve_inheritance, +FALSE, +NULL, +NULL, +XtInheritRealize, +actionsList, +1, +resources, +3, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +XtInheritExpose, +NULL, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +defaultTranslations, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfLabel_class part */ +XtInherit_set_label, +}, +{ /* XfwfButton_class part */ +0 +}, +}; +WidgetClass xfwfButtonWidgetClass = (WidgetClass) &xfwfButtonClassRec; +/*ARGSUSED*/ +static void activate(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XtCallCallbackList(self, ((XfwfButtonWidget)self)->xfwfButton.activate, event); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfButtonWidgetClass c = (XfwfButtonWidgetClass) class; + XfwfButtonWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (CompositeClassExtensionRec *) XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = (XtPointer) ext; + if (class == xfwfButtonWidgetClass) return; + super = (XfwfButtonWidgetClass)class->core_class.superclass; +} diff --git a/vendor/x11iraf/obm/ObmW/Button.h b/vendor/x11iraf/obm/ObmW/Button.h new file mode 100644 index 00000000..5d75b421 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Button.h @@ -0,0 +1,20 @@ +/* Generated by wbuild from "Button.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfButton_H_ +#define _XfwfButton_H_ +#include "Label.h" +#ifndef XtNactivate +#define XtNactivate "activate" +#endif +#ifndef XtCActivate +#define XtCActivate "Activate" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +typedef struct _XfwfButtonClassRec *XfwfButtonWidgetClass; +typedef struct _XfwfButtonRec *XfwfButtonWidget; +externalref WidgetClass xfwfButtonWidgetClass; +#endif /*_XfwfButton_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Button.man b/vendor/x11iraf/obm/ObmW/Button.man new file mode 100644 index 00000000..f9aad118 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Button.man @@ -0,0 +1,264 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfButton +.SH DESCRIPTION +The \fIXfwfButton\fP widget is a simple button with a +single callback \fIactivate_callback\fP. Except for that +callback, all resources are inherited from the +\fIXfwfLabel\fP widget. Subclasses provide buttons of +other, more specialized types. \fIXfwfButton\fP inherits +its 3D frame from \fIXfwfFrame\fP, the location +specification resources from \fIXfwfBoard\fP and the +multi-line label from \fIXfwfLabel\fP. + +The implementation is also very simple, since nearly +all code is inherited from \fIXfwfLabel\fP. There are no +new or redefined methods. In fact, just six lines of +actual code suffice to implement the widget: Object +Oriented Programming at its best! + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfButton +Name Class Type Default +XtNactivate XtCActivate Callback NULL + +.TE +.ps + +.TP +.I "XtNactivate" +The \fIactivate\fP is invoked from the \fIactivate\fP +action, which is normally bound to a mouse click. The +\fIcall_data\fP argument of the callbacks routines is +filled with a pointer to the event that triggered the +action. + + + +.hi + +.nf +<Callback> XtCallbackList activate = NULL +.fi + +.eh + +.TP +.I "XtNframeWidth" +The default \fIframeWidth\fP is set to 2 pixels. + + + +.hi + +.nf +Dimension frameWidth = 2 +.fi + +.eh + +.TP +.I "XtNtraversalOn" +In contrast to its superclass XfwfLabel, a button +usually takes part in keyboard traversal. + + + +.hi + +.nf + traversalOn = True +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfLabel +Name Class Type Default +XtNlabel XtCLabel String NULL +XtNtablist XtCTablist String NULL +XtNfont XtCFont FontStruct XtDefaultFont +XtNforeground XtCForeground Pixel XtDefaultForeground +XtNalignment XtCAlignment Alignment 0 +XtNtopMargin XtCTopMargin Dimension 2 +XtNbottomMargin XtCBottomMargin Dimension 2 +XtNleftMargin XtCLeftMargin Dimension 2 +XtNrightMargin XtCRightMargin Dimension 2 +XtNshrinkToFit XtCShrinkToFit Boolean False +XtNrvStart XtCRvStart Int 0 +XtNrvLength XtCRvLength Int 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Translations" + +By default, the \fIactivate\fP action is bound to a +mouse click and to the Enter key. + + + +.nf +<Btn1Down>: set_shadow(sunken) +.fi + +.nf +<Btn1Down>,<Btn1Up>: activate() set_shadow() +.fi + +.nf +Button1<Leave>: set_shadow() +.fi + +.nf +<Key>Return: set_shadow(sunken) activate() set_shadow() +.fi + +.hi +.SS "Actions" + +.TP +.I "activate + +The \fIactivate\fP action just calls the \fIactivate\fP +callback functions, passing the \fIXEvent\fP pointer in +the \fIcall_data\fP argument. + +.hi + +.nf +void activate($, XEvent* event, String* params, Cardinal* num_params) +{ + XtCallCallbackList($, $activate, event); +} +.fi + +.eh + +.hi diff --git a/vendor/x11iraf/obm/ObmW/ButtonP.h b/vendor/x11iraf/obm/ObmW/ButtonP.h new file mode 100644 index 00000000..12a8e708 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ButtonP.h @@ -0,0 +1,41 @@ +/* Generated by wbuild from "Button.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfButtonP_H_ +#define _XfwfButtonP_H_ +#include "LabelP.h" +#include "Button.h" +typedef struct { +/* methods */ +/* class variables */ +int dummy; +} XfwfButtonClassPart; +typedef struct _XfwfButtonClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfLabelClassPart xfwfLabel_class; +XfwfButtonClassPart xfwfButton_class; +} XfwfButtonClassRec; + +typedef struct { +/* resources */ +XtCallbackList activate; +/* private state */ +} XfwfButtonPart; + +typedef struct _XfwfButtonRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfLabelPart xfwfLabel; +XfwfButtonPart xfwfButton; +} XfwfButtonRec; + +externalref XfwfButtonClassRec xfwfButtonClassRec; + +#endif /* _XfwfButtonP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/CHANGES b/vendor/x11iraf/obm/ObmW/CHANGES new file mode 100644 index 00000000..e0eefeb7 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/CHANGES @@ -0,0 +1,32 @@ +Layout widget: + + fixed bug in laylex.l code - need to trim whitespace at end of a string + token. + + this later turned out to be just a workaround for the real bug, which + was an incorrect unput(c) macro. the macro was not evaluating the (c) + but the lex code involves side effects that assume that this is done. + + there was another bug in the Layout.c code. the code that lays out + the child widgets was using the size of a VariableBox to compute the + child offsets, as if this were part of the geometry being laid out. + + +FWF widgets: + + icon.c code was modified to support new version of XPM + pixmap files for builtin icons were edited and new icons were added + modified Common.c to change algorithm which computes top/bottom shadows + compute_inside modified in Common.c and Frame.c to avoid wrap to neg + +Added sed script FWFSED which converts <Xfwf/foo.h> includes and deletes +#line references. + +Group widget + + modified layout() to resize the child in the case where there is a single + child widget (actually this was done in RowCol.c). + +Layout widget + + modified debug output to print a header containing the widget name diff --git a/vendor/x11iraf/obm/ObmW/Common.c b/vendor/x11iraf/obm/ObmW/Common.c new file mode 100644 index 00000000..4ffef4d4 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Common.c @@ -0,0 +1,770 @@ +/* Generated by wbuild from "Common.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <stdio.h> +#include <X11/Xmu/Converters.h> +#include "Converters.h" +#include "CommonP.h" +#define focus_detail(detail) (detail ==NotifyAncestor ?"NotifyAncestor":detail ==NotifyVirtual ?"NotifyVirtual":detail ==NotifyInferior ?"NotifyInferior":detail ==NotifyNonlinear ?"NotifyNonlinear":detail ==NotifyNonlinearVirtual ?"NotifyNonlinearVirtual":detail ==NotifyPointer ?"NotifyPointer":detail ==NotifyPointerRoot ?"NotifyPointerRoot":detail ==NotifyDetailNone ?"NotifyDetailNone":"???") + + +static void focusIn( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void focusOut( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseDown( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseUp( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseLeft( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseRight( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseNext( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traversePrev( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseNextTop( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseHome( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void traverseCurrent( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"focusIn", focusIn}, +{"focusOut", focusOut}, +{"traverseDown", traverseDown}, +{"traverseUp", traverseUp}, +{"traverseLeft", traverseLeft}, +{"traverseRight", traverseRight}, +{"traverseNext", traverseNext}, +{"traversePrev", traversePrev}, +{"traverseNextTop", traverseNextTop}, +{"traverseHome", traverseHome}, +{"traverseCurrent", traverseCurrent}, +}; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void class_initialize( +#if NeedFunctionPrototypes +void +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void compute_inside( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void destroy( +#if NeedFunctionPrototypes +Widget +#endif +); +static void highlight_border( +#if NeedFunctionPrototypes +Widget +#endif +); +static void unhighlight_border( +#if NeedFunctionPrototypes +Widget +#endif +); +static Boolean accept_focus( +#if NeedFunctionPrototypes +Widget,Time * +#endif +); +static Boolean would_accept_focus( +#if NeedFunctionPrototypes +Widget +#endif +); +static void traverse( +#if NeedFunctionPrototypes +Widget,TraversalDirection ,Widget ,Time * +#endif +); +static Boolean choose_color( +#if NeedFunctionPrototypes +Widget,double ,Pixel ,Pixel * +#endif +); +static Boolean lighter_color( +#if NeedFunctionPrototypes +Widget,Pixel ,Pixel * +#endif +); +static Boolean darker_color( +#if NeedFunctionPrototypes +Widget,Pixel ,Pixel * +#endif +); +#define done(type, value) do {\ + if (to->addr != NULL) {\ + if (to->size < sizeof(type)) {\ + to->size = sizeof(type);\ + return False;\ + }\ + *(type*)(to->addr) = (value);\ + } else {\ + static type static_val;\ + static_val = (value);\ + to->addr = (XtPointer)&static_val;\ + }\ + to->size = sizeof(type);\ + return True;\ + }while (0 ) + + +static Boolean cvtStringToAlignment( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +static Boolean cvtAlignmentToString( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +static char extraTranslations[] = "\ + <FocusIn>: focusIn()\n\ + <FocusOut>: focusOut()\n\ + <Key>Up: traverseUp()\n\ + <Key>Down: traverseDown()\n\ + <Key>Left: traverseLeft()\n\ + <Key>Right: traverseRight()\n\ + <Key>Next: traverseNext()\n\ + ~Shift<Key>Tab: traverseNext()\n\ + <Key>Prior: traversePrev()\n\ + Shift<Key>Tab: traversePrev()\n\ + <Key>KP_Enter: traverseNextTop()\n\ + <Key>Home: traverseHome()"; +static void create_bordergc( +#if NeedFunctionPrototypes +Widget +#endif +); +static Boolean traverse_to_direction( +#if NeedFunctionPrototypes +Widget,TraversalDirection ,int ,int ,Widget *,int * +#endif +); +static void traverse_to_next( +#if NeedFunctionPrototypes +Widget,Widget ,Time * +#endif +); +static void traverse_to_prev( +#if NeedFunctionPrototypes +Widget,Widget ,Time * +#endif +); +static void traverse_to_next_top( +#if NeedFunctionPrototypes +Widget,Widget ,Time * +#endif +); +/*ARGSUSED*/static Boolean cvtStringToAlignment(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + Alignment a = 0; + char c, *t, *s = (char*) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToAlignment", "wrongParameters", + "XtToolkitError", + "String to Alignment conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + while (*s) { + for (; isspace(*s); s++) ; + for (t = s; *t && ! isspace(*t); t++) ; + c = *t; + *t = '\0'; + if (XmuCompareISOLatin1(s, "top") == 0) a |= XfwfTop; + else if (XmuCompareISOLatin1(s, "bottom") == 0) a |= XfwfBottom; + else if (XmuCompareISOLatin1(s, "center") == 0) ; /* skip */ + else if (XmuCompareISOLatin1(s, "left") == 0) a |= XfwfLeft; + else if (XmuCompareISOLatin1(s, "right") == 0) a |= XfwfRight; + else { + XtDisplayStringConversionWarning(display, (char*) from->addr, + "Alignment"); + break; + } + *t = c; + s = t; + } + done(Alignment, a); +} +/*ARGSUSED*/static Boolean cvtAlignmentToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + Alignment *a = (Alignment*) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtAlignmentToString", "wrongParameters", + "XtToolkitError", + "Alignment to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*a) { + case XfwfCenter: done(String, "center"); + case XfwfBottom: done(String, "bottom"); + case XfwfTop: done(String, "top"); + case XfwfLeft: done(String, "left"); + case XfwfRight: done(String, "right"); + case XfwfBottom + XfwfLeft: done(String, "bottom left"); + case XfwfBottom + XfwfRight: done(String, "bottom right"); + case XfwfTop + XfwfLeft: done(String, "top left"); + case XfwfTop + XfwfRight: done(String, "top right"); + default: done(String, "unknown"); + } +} +/*ARGSUSED*/static void create_bordergc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfCommonWidget)self)->xfwfCommon.bordergc) XtReleaseGC(self, ((XfwfCommonWidget)self)->xfwfCommon.bordergc); + if (((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap != None) { + mask = GCFillStyle | GCTile; + values.fill_style = FillTiled; + values.tile = ((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap; + } else { + mask = GCFillStyle | GCForeground; + values.fill_style = FillSolid; + values.foreground = ((XfwfCommonWidget)self)->xfwfCommon.highlightColor; + } + ((XfwfCommonWidget)self)->xfwfCommon.bordergc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static Boolean traverse_to_direction(self,dir,x,y,found,distance)Widget self;TraversalDirection dir;int x;int y;Widget * found;int * distance; +{ + int i; + Widget child, w; + Position rx, ry; + int dist; + Boolean found_child = False; + + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) return False; + /* + * First recurse to all descendants + */ + for (i = 0; i < ((XfwfCommonWidget)self)->composite.num_children; i++) + if (XtIsSubclass(((XfwfCommonWidget)self)->composite.children[i], xfwfCommonWidgetClass) + && traverse_to_direction(((XfwfCommonWidget)self)->composite.children[i], dir, x, y, found, distance)) + found_child = True; + if (found_child) return True; + /* + * No child found, now check own position and distance + */ + switch (dir) { + case TraverseHome: rx = 0; ry = 0; break; + case TraverseLeft: rx = ((XfwfCommonWidget)self)->core.width; ry = ((XfwfCommonWidget)self)->core.height/2; break; + case TraverseDown: rx = ((XfwfCommonWidget)self)->core.width/2; ry = 0; break; + case TraverseRight: rx = 0; ry = ((XfwfCommonWidget)self)->core.height/2; break; + case TraverseUp: rx = ((XfwfCommonWidget)self)->core.width/2; ry = ((XfwfCommonWidget)self)->core.height; break; + } + XtTranslateCoords(self, rx, ry, &rx, &ry); + if ((dir == TraverseUp && ry > y) + || (dir == TraverseLeft && rx > x) + || (dir == TraverseDown && ry < y) + || (dir == TraverseRight && rx < x)) return False; + dist = (rx - x)*(rx - x) + (ry - y)*(ry - y); + if (dist >= *distance) return False; + /* + * We are the best so far, but do we want the focus? + */ + if (! ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.would_accept_focus(self)) return False; + *distance = dist; + *found = self; + return True; +} +/*ARGSUSED*/static void traverse_to_next(self,current,time)Widget self;Widget current;Time * time; +{ + int i = 0; + Widget parent = XtParent(self); + + while (i < ((XfwfCommonWidget)self)->composite.num_children && ((XfwfCommonWidget)self)->composite.children[i] != current) i++; + for (i++; i < ((XfwfCommonWidget)self)->composite.num_children; i++) + if (XtCallAcceptFocus(((XfwfCommonWidget)self)->composite.children[i], time)) return; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseNext, self, time); +} +/*ARGSUSED*/static void traverse_to_prev(self,current,time)Widget self;Widget current;Time * time; +{ + int i = 0; + Widget parent = XtParent(self); + + while (i < ((XfwfCommonWidget)self)->composite.num_children && ((XfwfCommonWidget)self)->composite.children[i] != current) i++; + for (i--; i >= 0; i--) + if (XtCallAcceptFocus(((XfwfCommonWidget)self)->composite.children[i], time)) return; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraversePrev, self, time); +} +/*ARGSUSED*/static void traverse_to_next_top(self,current,time)Widget self;Widget current;Time * time; +{ + Widget parent = XtParent(self); + + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseNextTop, current, time); + else + XtCallCallbackList(self, ((XfwfCommonWidget)self)->xfwfCommon.nextTop, NULL); +} + +static XtResource resources[] = { +{XtNtraversalOn,XtCTraversalOn,XtRBoolean,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.traversalOn),XtOffsetOf(XfwfCommonRec,xfwfCommon.traversalOn),XtRImmediate,(XtPointer)True }, +{XtNhighlightThickness,XtCHighlightThickness,XtRDimension,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.highlightThickness),XtOffsetOf(XfwfCommonRec,xfwfCommon.highlightThickness),XtRImmediate,(XtPointer)2 }, +{XtNhighlightColor,XtCHighlightColor,XtRPixel,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.highlightColor),XtOffsetOf(XfwfCommonRec,xfwfCommon.highlightColor),XtRString,(XtPointer)XtDefaultForeground }, +{XtNhighlightPixmap,XtCHighlightPixmap,XtRPixmap,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.highlightPixmap),XtOffsetOf(XfwfCommonRec,xfwfCommon.highlightPixmap),XtRImmediate,(XtPointer)None }, +{XtNnextTop,XtCNextTop,XtRCallback,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.nextTop),XtOffsetOf(XfwfCommonRec,xfwfCommon.nextTop),XtRImmediate,(XtPointer)NULL }, +{XtNuserData,XtCUserData,XtRPointer,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.userData),XtOffsetOf(XfwfCommonRec,xfwfCommon.userData),XtRImmediate,(XtPointer)NULL }, +}; + +XfwfCommonClassRec xfwfCommonClassRec = { +{ /* core_class part */ +(WidgetClass) &compositeClassRec, +"XfwfCommon", +sizeof(XfwfCommonRec), +class_initialize, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +11, +resources, +6, +NULLQUARK, +False , +FALSE , +False , +False , +destroy, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +accept_focus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +compute_inside, +highlight_border, +unhighlight_border, +would_accept_focus, +traverse, +choose_color, +lighter_color, +darker_color, +NULL , +}, +}; +WidgetClass xfwfCommonWidgetClass = (WidgetClass) &xfwfCommonClassRec; +/*ARGSUSED*/ +static void focusIn(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + Time time = CurrentTime; + + if (event->type != FocusIn) + XtError("focusIn action may only be bound to FocusIn events"); + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) + return; + if (event->xfocus.detail == NotifyAncestor + || event->xfocus.detail == NotifyInferior + || event->xfocus.detail == NotifyNonlinear) { + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) (void) ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.accept_focus(self, &time); + } else if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.unhighlight_border(self); + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = False; + } +} + +/*ARGSUSED*/ +static void focusOut(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + if (event->type != FocusOut) + XtError("focusOut action may only be bound to FocusOut events"); + if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.unhighlight_border(self); + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = False; + } +} + +/*ARGSUSED*/ +static void traverseDown(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseDown, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseUp(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseUp, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseLeft(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseLeft, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseRight(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseRight, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseNext(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseNext, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traversePrev(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraversePrev, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseNextTop(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseNextTop, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseHome(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseHome, self, &event->xkey.time); +} + +/*ARGSUSED*/ +static void traverseCurrent(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + Time time = CurrentTime; + + if (((XfwfCommonWidget)self)->xfwfCommon.traversalOn) (void) ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.accept_focus(self, &time); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfCommonWidgetClass c = (XfwfCommonWidgetClass) class; + XfwfCommonWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfCommonWidgetClass) return; + super = (XfwfCommonWidgetClass)class->core_class.superclass; + if (c->xfwfCommon_class.compute_inside == XtInherit_compute_inside) + c->xfwfCommon_class.compute_inside = super->xfwfCommon_class.compute_inside; + if (c->xfwfCommon_class.highlight_border == XtInherit_highlight_border) + c->xfwfCommon_class.highlight_border = super->xfwfCommon_class.highlight_border; + if (c->xfwfCommon_class.unhighlight_border == XtInherit_unhighlight_border) + c->xfwfCommon_class.unhighlight_border = super->xfwfCommon_class.unhighlight_border; + if (c->xfwfCommon_class.would_accept_focus == XtInherit_would_accept_focus) + c->xfwfCommon_class.would_accept_focus = super->xfwfCommon_class.would_accept_focus; + if (c->xfwfCommon_class.traverse == XtInherit_traverse) + c->xfwfCommon_class.traverse = super->xfwfCommon_class.traverse; + if (c->xfwfCommon_class.choose_color == XtInherit_choose_color) + c->xfwfCommon_class.choose_color = super->xfwfCommon_class.choose_color; + if (c->xfwfCommon_class.lighter_color == XtInherit_lighter_color) + c->xfwfCommon_class.lighter_color = super->xfwfCommon_class.lighter_color; + if (c->xfwfCommon_class.darker_color == XtInherit_darker_color) + c->xfwfCommon_class.darker_color = super->xfwfCommon_class.darker_color; +} +/*ARGSUSED*/static void class_initialize() +{ + static XtConvertArgRec args[] = { + { XtWidgetBaseOffset, 0, sizeof(Widget) } }; + + XtSetTypeConverter(XtRString, "Alignment", cvtStringToAlignment, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter("Alignment", XtRString, cvtAlignmentToString, + NULL, 0, XtCacheNone, NULL); + /* init_icon_quarks(); */ + XtSetTypeConverter(XtRString, "Icon", cvtStringToIcon, + args, XtNumber(args), XtCacheNone, NULL); +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + if (((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans == NULL) + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans = XtParseTranslationTable(extraTranslations); + if (((XfwfCommonWidget)self)->xfwfCommon.traversalOn) { + XtAugmentTranslations(self, ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans); + ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.visible_interest = True; + } + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = False; + ((XfwfCommonWidget)self)->xfwfCommon.bordergc = NULL; + create_bordergc(self); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redraw = False; + Widget parent = XtParent(self); + Time time = CurrentTime; + + if (((XfwfCommonWidget)self)->xfwfCommon.traversalOn != ((XfwfCommonWidget)old)->xfwfCommon.traversalOn && ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) { + XtAugmentTranslations(self, ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans); + ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.visible_interest = True; + } + if ((((XfwfCommonWidget)self)->core.sensitive != ((XfwfCommonWidget)old)->core.sensitive + || ((XfwfCommonWidget)self)->core.ancestor_sensitive != ((XfwfCommonWidget)old)->core.ancestor_sensitive + || ((XfwfCommonWidget)self)->xfwfCommon.traversalOn != ((XfwfCommonWidget)old)->xfwfCommon.traversalOn) + && ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseHome, self, &time); + } + if (((XfwfCommonWidget)self)->xfwfCommon.highlightThickness != ((XfwfCommonWidget)old)->xfwfCommon.highlightThickness) + need_redraw = True; + if (((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap != ((XfwfCommonWidget)old)->xfwfCommon.highlightPixmap) { + create_bordergc(self); + need_redraw = True; + } else if (((XfwfCommonWidget)self)->xfwfCommon.highlightColor != ((XfwfCommonWidget)old)->xfwfCommon.highlightColor) { + ((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap = None; + create_bordergc(self); + need_redraw = True; + } + return need_redraw; +} +/*ARGSUSED*/static void compute_inside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h; +{ + *x = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + *y = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + + /* 09Mar94 DCT - max(0) applied to width and height. */ + *w = max(0,((XfwfCommonWidget)self)->core.width - 2 * ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness); + *h = max(0,((XfwfCommonWidget)self)->core.height - 2 * ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness); +} + +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + if (! XtIsRealized(self)) return; + if (region != NULL) XSetRegion(XtDisplay(self), ((XfwfCommonWidget)self)->xfwfCommon.bordergc, region); + if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.highlight_border(self); + if (region != NULL) XSetClipMask(XtDisplay(self), ((XfwfCommonWidget)self)->xfwfCommon.bordergc, None); +} +/*ARGSUSED*/static void destroy(self)Widget self; +{ + Widget parent = XtParent(self); + Time time = CurrentTime; + + if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + ((XfwfCommonWidget)self)->core.sensitive = False; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseHome, self, &time); + } +} +/*ARGSUSED*/static void highlight_border(self)Widget self; +{ + XRectangle rect[4]; + + if (((XfwfCommonWidget)self)->xfwfCommon.highlightThickness == 0) return; + + rect[0].x = 0; + rect[0].y = 0; + rect[0].width = ((XfwfCommonWidget)self)->core.width; + rect[0].height = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + + rect[1].x = 0; + rect[1].y = 0; + rect[1].width = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[1].height = ((XfwfCommonWidget)self)->core.height; + + rect[2].x = ((XfwfCommonWidget)self)->core.width - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[2].y = 0; + rect[2].width = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[2].height = ((XfwfCommonWidget)self)->core.height; + + rect[3].x = 0; + rect[3].y = ((XfwfCommonWidget)self)->core.height - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[3].width = ((XfwfCommonWidget)self)->core.width; + rect[3].height = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + + XFillRectangles(XtDisplay(self), XtWindow(self), ((XfwfCommonWidget)self)->xfwfCommon.bordergc, &rect[0], 4); +} +/*ARGSUSED*/static void unhighlight_border(self)Widget self; +{ + if (((XfwfCommonWidget)self)->xfwfCommon.highlightThickness == 0) return; + + XClearArea(XtDisplay(self), XtWindow(self), + 0, 0, ((XfwfCommonWidget)self)->core.width, ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, False); + XClearArea(XtDisplay(self), XtWindow(self), + 0, 0, ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, ((XfwfCommonWidget)self)->core.height, False); + XClearArea(XtDisplay(self), XtWindow(self), + ((XfwfCommonWidget)self)->core.width - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, 0, + ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, ((XfwfCommonWidget)self)->core.height, False); + XClearArea(XtDisplay(self), XtWindow(self), + 0, ((XfwfCommonWidget)self)->core.height - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, + ((XfwfCommonWidget)self)->core.width, ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, False); +} +/*ARGSUSED*/static Boolean accept_focus(self,time)Widget self;Time * time; +{ + int i; + + if (! XtIsRealized(self) || ! ((XfwfCommonWidget)self)->core.sensitive || ! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn + || ! ((XfwfCommonWidget)self)->core.visible || ! ((XfwfCommonWidget)self)->core.ancestor_sensitive || ! ((XfwfCommonWidget)self)->core.managed + || ! ((XfwfCommonWidget)self)->core.mapped_when_managed || ((XfwfCommonWidget)self)->core.being_destroyed) return False; + for (i = 0; i < ((XfwfCommonWidget)self)->composite.num_children; i++) + if (XtCallAcceptFocus(((XfwfCommonWidget)self)->composite.children[i], time)) return True; + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + XSetInputFocus(XtDisplay(self), XtWindow(self), RevertToParent, *time); + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = True; + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.highlight_border(self); + } + return True; +} +/*ARGSUSED*/static Boolean would_accept_focus(self)Widget self; +{ + int i; + Widget child; + + if (! XtIsRealized(self) || ! ((XfwfCommonWidget)self)->core.sensitive || ! ((XfwfCommonWidget)self)->core.visible || ! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) + return False; + else { + for (i = 0; i < ((XfwfCommonWidget)self)->composite.num_children; i++) { + child = ((XfwfCommonWidget)self)->composite.children[i]; + if (XtIsSubclass(child, xfwfCommonWidgetClass) + && ((XfwfCommonWidgetClass)child->core.widget_class)->xfwfCommon_class.would_accept_focus(child)) + return False; + } + return True; + } +} +/*ARGSUSED*/static void traverse(self,dir,current,time)Widget self;TraversalDirection dir;Widget current;Time * time; +{ + Widget w, parent = XtParent(self); + Position x, y; + int distance = LARGE_NUMBER; + + if (dir == TraverseNextTop) + traverse_to_next_top(self, current, time); + else if (dir == TraverseNext) + traverse_to_next(self, current, time); + else if (dir == TraversePrev) + traverse_to_prev(self, current, time); + else if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, dir, current, time); + else { + switch (dir) { + case TraverseHome: x = 0; y = 0; break; + case TraverseLeft: x = 0; y = ((XfwfCommonWidget)current)->core.height/2; break; + case TraverseDown: x = ((XfwfCommonWidget)current)->core.width/2; y = ((XfwfCommonWidget)current)->core.height; break; + case TraverseRight: x = ((XfwfCommonWidget)current)->core.width; y = ((XfwfCommonWidget)current)->core.height/2; break; + case TraverseUp: x = ((XfwfCommonWidget)current)->core.width/2; y = 0; break; + } + if (dir != TraverseHome) XtTranslateCoords(current, x, y, &x, &y); + if (traverse_to_direction(self, dir, x, y, &w, &distance)) + XtCallAcceptFocus(w, time); + } +} +/*ARGSUSED*/static Boolean choose_color(self,factor,base,result)Widget self;double factor;Pixel base;Pixel * result; +{ + XColor color1, color2, dummy; + + color1.pixel = base; + XQueryColor(XtDisplay(self), DefaultColormapOfScreen(XtScreen(self)), &color1); + color2.red = min(65535, factor * color1.red); + color2.green = min(65535, factor * color1.green); + color2.blue = min(65535, factor * color1.blue); + if (! XAllocColor(XtDisplay(self), + DefaultColormapOfScreen(XtScreen(self)), &color2)) + return False; + if (base == color2.pixel) { + if (! XAllocNamedColor(XtDisplay(self), + DefaultColormapOfScreen(XtScreen(self)), "gray75", + &color2, &dummy)) + return False; + } + *result = color2.pixel; + return True; +} +/*ARGSUSED*/static Boolean lighter_color(self,base,result)Widget self;Pixel base;Pixel * result; +{ + /* return choose_color(self, 1.5, base, result); */ + return choose_color(self, 1.25, base, result); +} +/*ARGSUSED*/static Boolean darker_color(self,base,result)Widget self;Pixel base;Pixel * result; +{ + /* return choose_color(self, 0.667, base, result); */ + return choose_color(self, 0.500, base, result); +} +/*ARGSUSED*/void XfwfCallComputeInside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h; +{ + if (XtIsSubclass(self, xfwfCommonWidgetClass) && ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside) + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, x, y, w, h); +} diff --git a/vendor/x11iraf/obm/ObmW/Common.c.ORIG b/vendor/x11iraf/obm/ObmW/Common.c.ORIG new file mode 100644 index 00000000..7d67213f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Common.c.ORIG @@ -0,0 +1,852 @@ +/* Generated by wbuild from "Common.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#line 929 "Common.w" +#include <stdio.h> +#line 930 "Common.w" +#include <X11/Xmu/Converters.h> +#line 931 "Common.w" +#include "Converters.h" +#include "CommonP.h" +#define focus_detail(detail) (detail ==NotifyAncestor ?"NotifyAncestor":detail ==NotifyVirtual ?"NotifyVirtual":detail ==NotifyInferior ?"NotifyInferior":detail ==NotifyNonlinear ?"NotifyNonlinear":detail ==NotifyNonlinearVirtual ?"NotifyNonlinearVirtual":detail ==NotifyPointer ?"NotifyPointer":detail ==NotifyPointerRoot ?"NotifyPointerRoot":detail ==NotifyDetailNone ?"NotifyDetailNone":"???") + + +#line 800 "Common.w" +static void focusIn( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 821 "Common.w" +static void focusOut( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 837 "Common.w" +static void traverseDown( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 846 "Common.w" +static void traverseUp( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 855 "Common.w" +static void traverseLeft( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 864 "Common.w" +static void traverseRight( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 876 "Common.w" +static void traverseNext( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 885 "Common.w" +static void traversePrev( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 896 "Common.w" +static void traverseNextTop( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 905 "Common.w" +static void traverseHome( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +#line 915 "Common.w" +static void traverseCurrent( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"focusIn", focusIn}, +{"focusOut", focusOut}, +{"traverseDown", traverseDown}, +{"traverseUp", traverseUp}, +{"traverseLeft", traverseLeft}, +{"traverseRight", traverseRight}, +{"traverseNext", traverseNext}, +{"traversePrev", traversePrev}, +{"traverseNextTop", traverseNextTop}, +{"traverseHome", traverseHome}, +{"traverseCurrent", traverseCurrent}, +}; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +#line 161 "Common.w" +static void class_initialize( +#if NeedFunctionPrototypes +void +#endif +); +#line 184 "Common.w" +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +#line 206 "Common.w" +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +#line 243 "Common.w" +static void compute_inside( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +#line 254 "Common.w" +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +#line 266 "Common.w" +static void destroy( +#if NeedFunctionPrototypes +Widget +#endif +); +#line 284 "Common.w" +static void highlight_border( +#if NeedFunctionPrototypes +Widget +#endif +); +#line 313 "Common.w" +static void unhighlight_border( +#if NeedFunctionPrototypes +Widget +#endif +); +#line 338 "Common.w" +static Boolean accept_focus( +#if NeedFunctionPrototypes +Widget,Time * +#endif +); +#line 360 "Common.w" +static Boolean would_accept_focus( +#if NeedFunctionPrototypes +Widget +#endif +); +#line 470 "Common.w" +static void traverse( +#if NeedFunctionPrototypes +Widget,TraversalDirection ,Widget ,Time * +#endif +); +#line 733 "Common.w" +static Boolean choose_color( +#if NeedFunctionPrototypes +Widget,double ,Pixel ,Pixel * +#endif +); +#line 760 "Common.w" +static Boolean lighter_color( +#if NeedFunctionPrototypes +Widget,Pixel ,Pixel * +#endif +); +#line 770 "Common.w" +static Boolean darker_color( +#if NeedFunctionPrototypes +Widget,Pixel ,Pixel * +#endif +); +#line 505 "Common.w" +#define done(type, value) do {\ + if (to->addr != NULL) {\ + if (to->size < sizeof(type)) {\ + to->size = sizeof(type);\ + return False;\ + }\ + *(type*)(to->addr) = (value);\ + } else {\ + static type static_val;\ + static_val = (value);\ + to->addr = (XtPointer)&static_val;\ + }\ + to->size = sizeof(type);\ + return True;\ + }while (0 ) + + +#line 522 "Common.w" +static Boolean cvtStringToAlignment( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +#line 557 "Common.w" +static Boolean cvtAlignmentToString( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +#line 586 "Common.w" +static char extraTranslations[] = "\ + <FocusIn>: focusIn()\n\ + <FocusOut>: focusOut()\n\ + <Key>Up: traverseUp()\n\ + <Key>Down: traverseDown()\n\ + <Key>Left: traverseLeft()\n\ + <Key>Right: traverseRight()\n\ + <Key>Next: traverseNext()\n\ + ~Shift<Key>Tab: traverseNext()\n\ + <Key>Prior: traversePrev()\n\ + Shift<Key>Tab: traversePrev()\n\ + <Key>KP_Enter: traverseNextTop()\n\ + <Key>Home: traverseHome()"; +#line 604 "Common.w" +static void create_bordergc( +#if NeedFunctionPrototypes +Widget +#endif +); +#line 631 "Common.w" +static Boolean traverse_to_direction( +#if NeedFunctionPrototypes +Widget,TraversalDirection ,int ,int ,Widget *,int * +#endif +); +#line 680 "Common.w" +static void traverse_to_next( +#if NeedFunctionPrototypes +Widget,Widget ,Time * +#endif +); +#line 697 "Common.w" +static void traverse_to_prev( +#if NeedFunctionPrototypes +Widget,Widget ,Time * +#endif +); +#line 710 "Common.w" +static void traverse_to_next_top( +#if NeedFunctionPrototypes +Widget,Widget ,Time * +#endif +); +#line 522 "Common.w" +/*ARGSUSED*/static Boolean cvtStringToAlignment(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + Alignment a = 0; + char c, *t, *s = (char*) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToAlignment", "wrongParameters", + "XtToolkitError", + "String to Alignment conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + while (*s) { + for (; isspace(*s); s++) ; + for (t = s; *t && ! isspace(*t); t++) ; + c = *t; + *t = '\0'; + if (XmuCompareISOLatin1(s, "top") == 0) a |= XfwfTop; + else if (XmuCompareISOLatin1(s, "bottom") == 0) a |= XfwfBottom; + else if (XmuCompareISOLatin1(s, "center") == 0) ; /* skip */ + else if (XmuCompareISOLatin1(s, "left") == 0) a |= XfwfLeft; + else if (XmuCompareISOLatin1(s, "right") == 0) a |= XfwfRight; + else { + XtDisplayStringConversionWarning(display, (char*) from->addr, + "Alignment"); + break; + } + *t = c; + s = t; + } + done(Alignment, a); +} +#line 557 "Common.w" +/*ARGSUSED*/static Boolean cvtAlignmentToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + Alignment *a = (Alignment*) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtAlignmentToString", "wrongParameters", + "XtToolkitError", + "Alignment to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*a) { + case XfwfCenter: done(String, "center"); + case XfwfBottom: done(String, "bottom"); + case XfwfTop: done(String, "top"); + case XfwfLeft: done(String, "left"); + case XfwfRight: done(String, "right"); + case XfwfBottom + XfwfLeft: done(String, "bottom left"); + case XfwfBottom + XfwfRight: done(String, "bottom right"); + case XfwfTop + XfwfLeft: done(String, "top left"); + case XfwfTop + XfwfRight: done(String, "top right"); + default: done(String, "unknown"); + } +} +#line 604 "Common.w" +/*ARGSUSED*/static void create_bordergc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfCommonWidget)self)->xfwfCommon.bordergc) XtReleaseGC(self, ((XfwfCommonWidget)self)->xfwfCommon.bordergc); + if (((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap != None) { + mask = GCFillStyle | GCTile; + values.fill_style = FillTiled; + values.tile = ((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap; + } else { + mask = GCFillStyle | GCForeground; + values.fill_style = FillSolid; + values.foreground = ((XfwfCommonWidget)self)->xfwfCommon.highlightColor; + } + ((XfwfCommonWidget)self)->xfwfCommon.bordergc = XtGetGC(self, mask, &values); +} +#line 631 "Common.w" +/*ARGSUSED*/static Boolean traverse_to_direction(self,dir,x,y,found,distance)Widget self;TraversalDirection dir;int x;int y;Widget * found;int * distance; +{ + int i; + Widget child, w; + Position rx, ry; + int dist; + Boolean found_child = False; + + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) return False; + /* + * First recurse to all descendants + */ + for (i = 0; i < ((XfwfCommonWidget)self)->composite.num_children; i++) + if (XtIsSubclass(((XfwfCommonWidget)self)->composite.children[i], xfwfCommonWidgetClass) + && traverse_to_direction(((XfwfCommonWidget)self)->composite.children[i], dir, x, y, found, distance)) + found_child = True; + if (found_child) return True; + /* + * No child found, now check own position and distance + */ + switch (dir) { + case TraverseHome: rx = 0; ry = 0; break; + case TraverseLeft: rx = ((XfwfCommonWidget)self)->core.width; ry = ((XfwfCommonWidget)self)->core.height/2; break; + case TraverseDown: rx = ((XfwfCommonWidget)self)->core.width/2; ry = 0; break; + case TraverseRight: rx = 0; ry = ((XfwfCommonWidget)self)->core.height/2; break; + case TraverseUp: rx = ((XfwfCommonWidget)self)->core.width/2; ry = ((XfwfCommonWidget)self)->core.height; break; + } + XtTranslateCoords(self, rx, ry, &rx, &ry); + if ((dir == TraverseUp && ry > y) + || (dir == TraverseLeft && rx > x) + || (dir == TraverseDown && ry < y) + || (dir == TraverseRight && rx < x)) return False; + dist = (rx - x)*(rx - x) + (ry - y)*(ry - y); + if (dist >= *distance) return False; + /* + * We are the best so far, but do we want the focus? + */ + if (! ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.would_accept_focus(self)) return False; + *distance = dist; + *found = self; + return True; +} +#line 680 "Common.w" +/*ARGSUSED*/static void traverse_to_next(self,current,time)Widget self;Widget current;Time * time; +{ + int i = 0; + Widget parent = XtParent(self); + + while (i < ((XfwfCommonWidget)self)->composite.num_children && ((XfwfCommonWidget)self)->composite.children[i] != current) i++; + for (i++; i < ((XfwfCommonWidget)self)->composite.num_children; i++) + if (XtCallAcceptFocus(((XfwfCommonWidget)self)->composite.children[i], time)) return; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseNext, self, time); +} +#line 697 "Common.w" +/*ARGSUSED*/static void traverse_to_prev(self,current,time)Widget self;Widget current;Time * time; +{ + int i = 0; + Widget parent = XtParent(self); + + while (i < ((XfwfCommonWidget)self)->composite.num_children && ((XfwfCommonWidget)self)->composite.children[i] != current) i++; + for (i--; i >= 0; i--) + if (XtCallAcceptFocus(((XfwfCommonWidget)self)->composite.children[i], time)) return; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraversePrev, self, time); +} +#line 710 "Common.w" +/*ARGSUSED*/static void traverse_to_next_top(self,current,time)Widget self;Widget current;Time * time; +{ + Widget parent = XtParent(self); + + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseNextTop, current, time); + else + XtCallCallbackList(self, ((XfwfCommonWidget)self)->xfwfCommon.nextTop, NULL); +} + +static XtResource resources[] = { +#line 75 "Common.w" +{XtNtraversalOn,XtCTraversalOn,XtRBoolean,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.traversalOn),XtOffsetOf(XfwfCommonRec,xfwfCommon.traversalOn),XtRImmediate,(XtPointer)True }, +#line 83 "Common.w" +{XtNhighlightThickness,XtCHighlightThickness,XtRDimension,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.highlightThickness),XtOffsetOf(XfwfCommonRec,xfwfCommon.highlightThickness),XtRImmediate,(XtPointer)2 }, +#line 91 "Common.w" +{XtNhighlightColor,XtCHighlightColor,XtRPixel,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.highlightColor),XtOffsetOf(XfwfCommonRec,xfwfCommon.highlightColor),XtRString,(XtPointer)XtDefaultForeground }, +#line 98 "Common.w" +{XtNhighlightPixmap,XtCHighlightPixmap,XtRPixmap,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.highlightPixmap),XtOffsetOf(XfwfCommonRec,xfwfCommon.highlightPixmap),XtRImmediate,(XtPointer)None }, +#line 108 "Common.w" +{XtNnextTop,XtCNextTop,XtRCallback,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.nextTop),XtOffsetOf(XfwfCommonRec,xfwfCommon.nextTop),XtRImmediate,(XtPointer)NULL }, +#line 114 "Common.w" +{XtNuserData,XtCUserData,XtRPointer,sizeof(((XfwfCommonRec*)NULL)->xfwfCommon.userData),XtOffsetOf(XfwfCommonRec,xfwfCommon.userData),XtRImmediate,(XtPointer)NULL }, +}; + +XfwfCommonClassRec xfwfCommonClassRec = { +{ /* core_class part */ +(WidgetClass) &compositeClassRec, +"XfwfCommon", +sizeof(XfwfCommonRec), +class_initialize, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +11, +resources, +6, +NULLQUARK, +False , +FALSE , +False , +False , +destroy, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +accept_focus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +compute_inside, +highlight_border, +unhighlight_border, +would_accept_focus, +traverse, +choose_color, +lighter_color, +darker_color, +NULL , +}, +}; +WidgetClass xfwfCommonWidgetClass = (WidgetClass) &xfwfCommonClassRec; +/*ARGSUSED*/ +#line 800 "Common.w" +static void focusIn(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + Time time = CurrentTime; + + if (event->type != FocusIn) + XtError("focusIn action may only be bound to FocusIn events"); + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) + return; + if (event->xfocus.detail == NotifyAncestor + || event->xfocus.detail == NotifyInferior + || event->xfocus.detail == NotifyNonlinear) { + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) (void) ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.accept_focus(self, &time); + } else if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.unhighlight_border(self); + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = False; + } +} + +/*ARGSUSED*/ +#line 821 "Common.w" +static void focusOut(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + if (event->type != FocusOut) + XtError("focusOut action may only be bound to FocusOut events"); + if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.unhighlight_border(self); + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = False; + } +} + +/*ARGSUSED*/ +#line 837 "Common.w" +static void traverseDown(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseDown, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 846 "Common.w" +static void traverseUp(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseUp, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 855 "Common.w" +static void traverseLeft(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseLeft, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 864 "Common.w" +static void traverseRight(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseRight, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 876 "Common.w" +static void traverseNext(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseNext, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 885 "Common.w" +static void traversePrev(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraversePrev, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 896 "Common.w" +static void traverseNextTop(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseNextTop, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 905 "Common.w" +static void traverseHome(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traverse(self, TraverseHome, self, &event->xkey.time); +} + +/*ARGSUSED*/ +#line 915 "Common.w" +static void traverseCurrent(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + Time time = CurrentTime; + + if (((XfwfCommonWidget)self)->xfwfCommon.traversalOn) (void) ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.accept_focus(self, &time); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfCommonWidgetClass c = (XfwfCommonWidgetClass) class; + XfwfCommonWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfCommonWidgetClass) return; + super = (XfwfCommonWidgetClass)class->core_class.superclass; + if (c->xfwfCommon_class.compute_inside == XtInherit_compute_inside) + c->xfwfCommon_class.compute_inside = super->xfwfCommon_class.compute_inside; + if (c->xfwfCommon_class.highlight_border == XtInherit_highlight_border) + c->xfwfCommon_class.highlight_border = super->xfwfCommon_class.highlight_border; + if (c->xfwfCommon_class.unhighlight_border == XtInherit_unhighlight_border) + c->xfwfCommon_class.unhighlight_border = super->xfwfCommon_class.unhighlight_border; + if (c->xfwfCommon_class.would_accept_focus == XtInherit_would_accept_focus) + c->xfwfCommon_class.would_accept_focus = super->xfwfCommon_class.would_accept_focus; + if (c->xfwfCommon_class.traverse == XtInherit_traverse) + c->xfwfCommon_class.traverse = super->xfwfCommon_class.traverse; + if (c->xfwfCommon_class.choose_color == XtInherit_choose_color) + c->xfwfCommon_class.choose_color = super->xfwfCommon_class.choose_color; + if (c->xfwfCommon_class.lighter_color == XtInherit_lighter_color) + c->xfwfCommon_class.lighter_color = super->xfwfCommon_class.lighter_color; + if (c->xfwfCommon_class.darker_color == XtInherit_darker_color) + c->xfwfCommon_class.darker_color = super->xfwfCommon_class.darker_color; +} +#line 161 "Common.w" +/*ARGSUSED*/static void class_initialize() +{ + static XtConvertArgRec args[] = { + { XtWidgetBaseOffset, 0, sizeof(Widget) } }; + + XtSetTypeConverter(XtRString, "Alignment", cvtStringToAlignment, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter("Alignment", XtRString, cvtAlignmentToString, + NULL, 0, XtCacheNone, NULL); + /* init_icon_quarks(); */ + XtSetTypeConverter(XtRString, "Icon", cvtStringToIcon, + args, XtNumber(args), XtCacheNone, NULL); +} +#line 184 "Common.w" +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + if (((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans == NULL) + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans = XtParseTranslationTable(extraTranslations); + if (((XfwfCommonWidget)self)->xfwfCommon.traversalOn) { + XtAugmentTranslations(self, ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans); + ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.visible_interest = True; + } + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = False; + ((XfwfCommonWidget)self)->xfwfCommon.bordergc = NULL; + create_bordergc(self); +} +#line 206 "Common.w" +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redraw = False; + Widget parent = XtParent(self); + Time time = CurrentTime; + + if (((XfwfCommonWidget)self)->xfwfCommon.traversalOn != ((XfwfCommonWidget)old)->xfwfCommon.traversalOn && ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) { + XtAugmentTranslations(self, ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.traversal_trans); + ((XfwfCommonWidgetClass)self->core.widget_class)->core_class.visible_interest = True; + } + if ((((XfwfCommonWidget)self)->core.sensitive != ((XfwfCommonWidget)old)->core.sensitive + || ((XfwfCommonWidget)self)->core.ancestor_sensitive != ((XfwfCommonWidget)old)->core.ancestor_sensitive + || ((XfwfCommonWidget)self)->xfwfCommon.traversalOn != ((XfwfCommonWidget)old)->xfwfCommon.traversalOn) + && ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseHome, self, &time); + } + if (((XfwfCommonWidget)self)->xfwfCommon.highlightThickness != ((XfwfCommonWidget)old)->xfwfCommon.highlightThickness) + need_redraw = True; + if (((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap != ((XfwfCommonWidget)old)->xfwfCommon.highlightPixmap) { + create_bordergc(self); + need_redraw = True; + } else if (((XfwfCommonWidget)self)->xfwfCommon.highlightColor != ((XfwfCommonWidget)old)->xfwfCommon.highlightColor) { + ((XfwfCommonWidget)self)->xfwfCommon.highlightPixmap = None; + create_bordergc(self); + need_redraw = True; + } + return need_redraw; +} +#line 243 "Common.w" +/*ARGSUSED*/static void compute_inside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h; +{ + *x = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + *y = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + *w = ((XfwfCommonWidget)self)->core.width - 2 * ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + *h = ((XfwfCommonWidget)self)->core.height - 2 * ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; +} +#line 254 "Common.w" +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + if (! XtIsRealized(self)) return; + if (region != NULL) XSetRegion(XtDisplay(self), ((XfwfCommonWidget)self)->xfwfCommon.bordergc, region); + if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.highlight_border(self); + if (region != NULL) XSetClipMask(XtDisplay(self), ((XfwfCommonWidget)self)->xfwfCommon.bordergc, None); +} +#line 266 "Common.w" +/*ARGSUSED*/static void destroy(self)Widget self; +{ + Widget parent = XtParent(self); + Time time = CurrentTime; + + if (((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + ((XfwfCommonWidget)self)->core.sensitive = False; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, TraverseHome, self, &time); + } +} +#line 284 "Common.w" +/*ARGSUSED*/static void highlight_border(self)Widget self; +{ + XRectangle rect[4]; + + if (((XfwfCommonWidget)self)->xfwfCommon.highlightThickness == 0) return; + + rect[0].x = 0; + rect[0].y = 0; + rect[0].width = ((XfwfCommonWidget)self)->core.width; + rect[0].height = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + + rect[1].x = 0; + rect[1].y = 0; + rect[1].width = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[1].height = ((XfwfCommonWidget)self)->core.height; + + rect[2].x = ((XfwfCommonWidget)self)->core.width - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[2].y = 0; + rect[2].width = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[2].height = ((XfwfCommonWidget)self)->core.height; + + rect[3].x = 0; + rect[3].y = ((XfwfCommonWidget)self)->core.height - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + rect[3].width = ((XfwfCommonWidget)self)->core.width; + rect[3].height = ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness; + + XFillRectangles(XtDisplay(self), XtWindow(self), ((XfwfCommonWidget)self)->xfwfCommon.bordergc, &rect[0], 4); +} +#line 313 "Common.w" +/*ARGSUSED*/static void unhighlight_border(self)Widget self; +{ + if (((XfwfCommonWidget)self)->xfwfCommon.highlightThickness == 0) return; + + XClearArea(XtDisplay(self), XtWindow(self), + 0, 0, ((XfwfCommonWidget)self)->core.width, ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, False); + XClearArea(XtDisplay(self), XtWindow(self), + 0, 0, ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, ((XfwfCommonWidget)self)->core.height, False); + XClearArea(XtDisplay(self), XtWindow(self), + ((XfwfCommonWidget)self)->core.width - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, 0, + ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, ((XfwfCommonWidget)self)->core.height, False); + XClearArea(XtDisplay(self), XtWindow(self), + 0, ((XfwfCommonWidget)self)->core.height - ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, + ((XfwfCommonWidget)self)->core.width, ((XfwfCommonWidget)self)->xfwfCommon.highlightThickness, False); +} +#line 338 "Common.w" +/*ARGSUSED*/static Boolean accept_focus(self,time)Widget self;Time * time; +{ + int i; + + if (! XtIsRealized(self) || ! ((XfwfCommonWidget)self)->core.sensitive || ! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn + || ! ((XfwfCommonWidget)self)->core.visible || ! ((XfwfCommonWidget)self)->core.ancestor_sensitive || ! ((XfwfCommonWidget)self)->core.managed + || ! ((XfwfCommonWidget)self)->core.mapped_when_managed || ((XfwfCommonWidget)self)->core.being_destroyed) return False; + for (i = 0; i < ((XfwfCommonWidget)self)->composite.num_children; i++) + if (XtCallAcceptFocus(((XfwfCommonWidget)self)->composite.children[i], time)) return True; + if (! ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus) { + XSetInputFocus(XtDisplay(self), XtWindow(self), RevertToParent, *time); + ((XfwfCommonWidget)self)->xfwfCommon.traversal_focus = True; + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.highlight_border(self); + } + return True; +} +#line 360 "Common.w" +/*ARGSUSED*/static Boolean would_accept_focus(self)Widget self; +{ + int i; + Widget child; + + if (! XtIsRealized(self) || ! ((XfwfCommonWidget)self)->core.sensitive || ! ((XfwfCommonWidget)self)->core.visible || ! ((XfwfCommonWidget)self)->xfwfCommon.traversalOn) + return False; + else { + for (i = 0; i < ((XfwfCommonWidget)self)->composite.num_children; i++) { + child = ((XfwfCommonWidget)self)->composite.children[i]; + if (XtIsSubclass(child, xfwfCommonWidgetClass) + && ((XfwfCommonWidgetClass)child->core.widget_class)->xfwfCommon_class.would_accept_focus(child)) + return False; + } + return True; + } +} +#line 470 "Common.w" +/*ARGSUSED*/static void traverse(self,dir,current,time)Widget self;TraversalDirection dir;Widget current;Time * time; +{ + Widget w, parent = XtParent(self); + Position x, y; + int distance = LARGE_NUMBER; + + if (dir == TraverseNextTop) + traverse_to_next_top(self, current, time); + else if (dir == TraverseNext) + traverse_to_next(self, current, time); + else if (dir == TraversePrev) + traverse_to_prev(self, current, time); + else if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + ((XfwfCommonWidgetClass)parent->core.widget_class)->xfwfCommon_class.traverse(parent, dir, current, time); + else { + switch (dir) { + case TraverseHome: x = 0; y = 0; break; + case TraverseLeft: x = 0; y = ((XfwfCommonWidget)current)->core.height/2; break; + case TraverseDown: x = ((XfwfCommonWidget)current)->core.width/2; y = ((XfwfCommonWidget)current)->core.height; break; + case TraverseRight: x = ((XfwfCommonWidget)current)->core.width; y = ((XfwfCommonWidget)current)->core.height/2; break; + case TraverseUp: x = ((XfwfCommonWidget)current)->core.width/2; y = 0; break; + } + if (dir != TraverseHome) XtTranslateCoords(current, x, y, &x, &y); + if (traverse_to_direction(self, dir, x, y, &w, &distance)) + XtCallAcceptFocus(w, time); + } +} +#line 733 "Common.w" +/*ARGSUSED*/static Boolean choose_color(self,factor,base,result)Widget self;double factor;Pixel base;Pixel * result; +{ + XColor color1, color2, dummy; + + color1.pixel = base; + XQueryColor(XtDisplay(self), DefaultColormapOfScreen(XtScreen(self)), &color1); + color2.red = min(65535, factor * color1.red); + color2.green = min(65535, factor * color1.green); + color2.blue = min(65535, factor * color1.blue); + if (! XAllocColor(XtDisplay(self), + DefaultColormapOfScreen(XtScreen(self)), &color2)) + return False; + if (base == color2.pixel) { + if (! XAllocNamedColor(XtDisplay(self), + DefaultColormapOfScreen(XtScreen(self)), "gray75", + &color2, &dummy)) + return False; + } + *result = color2.pixel; + return True; +} +#line 760 "Common.w" +/*ARGSUSED*/static Boolean lighter_color(self,base,result)Widget self;Pixel base;Pixel * result; +{ + return choose_color(self, 1.5, base, result); +} +#line 770 "Common.w" +/*ARGSUSED*/static Boolean darker_color(self,base,result)Widget self;Pixel base;Pixel * result; +{ + return choose_color(self, 0.667, base, result); +} +#line 28 "Common.w" +#line 33 "Common.w" +#line 34 "Common.w" +#line 35 "Common.w" +#line 36 "Common.w" +#line 37 "Common.w" +#line 43 "Common.w" +#line 44 "Common.w" +#line 45 "Common.w" +#line 46 "Common.w" +#line 52 "Common.w" +#line 61 "Common.w" +/*ARGSUSED*/void XfwfCallComputeInside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h; +{ + if (XtIsSubclass(self, xfwfCommonWidgetClass) && ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside) + ((XfwfCommonWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, x, y, w, h); +} diff --git a/vendor/x11iraf/obm/ObmW/Common.h b/vendor/x11iraf/obm/ObmW/Common.h new file mode 100644 index 00000000..b1a9a97a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Common.h @@ -0,0 +1,108 @@ +/* Generated by wbuild from "Common.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfCommon_H_ +#define _XfwfCommon_H_ +#include <X11/Composite.h> +typedef int Alignment; + +#define XfwfCenter 0 + + +#define XfwfLeft 1 + + +#define XfwfRight 2 + + +#define XfwfTop 4 + + +#define XfwfBottom 8 + + +#define XfwfTopLeft (XfwfTop +XfwfLeft ) + + +#define XfwfTopRight (XfwfTop +XfwfRight ) + + +#define XfwfBottomLeft (XfwfBottom +XfwfLeft ) + + +#define XfwfBottomRight (XfwfBottom +XfwfRight ) + + +typedef enum { + TraverseLeft, TraverseRight, TraverseUp, TraverseDown, + TraverseNext, TraversePrev, TraverseHome, TraverseNextTop } TraversalDirection; + +void XfwfCallComputeInside( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +#ifndef XtNtraversalOn +#define XtNtraversalOn "traversalOn" +#endif +#ifndef XtCTraversalOn +#define XtCTraversalOn "TraversalOn" +#endif +#ifndef XtRBoolean +#define XtRBoolean "Boolean" +#endif + +#ifndef XtNhighlightThickness +#define XtNhighlightThickness "highlightThickness" +#endif +#ifndef XtCHighlightThickness +#define XtCHighlightThickness "HighlightThickness" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNhighlightColor +#define XtNhighlightColor "highlightColor" +#endif +#ifndef XtCHighlightColor +#define XtCHighlightColor "HighlightColor" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNhighlightPixmap +#define XtNhighlightPixmap "highlightPixmap" +#endif +#ifndef XtCHighlightPixmap +#define XtCHighlightPixmap "HighlightPixmap" +#endif +#ifndef XtRPixmap +#define XtRPixmap "Pixmap" +#endif + +#ifndef XtNnextTop +#define XtNnextTop "nextTop" +#endif +#ifndef XtCNextTop +#define XtCNextTop "NextTop" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +#ifndef XtNuserData +#define XtNuserData "userData" +#endif +#ifndef XtCUserData +#define XtCUserData "UserData" +#endif +#ifndef XtRPointer +#define XtRPointer "Pointer" +#endif + +typedef struct _XfwfCommonClassRec *XfwfCommonWidgetClass; +typedef struct _XfwfCommonRec *XfwfCommonWidget; +externalref WidgetClass xfwfCommonWidgetClass; +#endif /*_XfwfCommon_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Common.man b/vendor/x11iraf/obm/ObmW/Common.man new file mode 100644 index 00000000..b64484ab --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Common.man @@ -0,0 +1,1226 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfCommon +.SH DESCRIPTION +The Common class is not meant to be instantiated. It only serves as +the common superclass for a family of widgets, to ensure that these +widgets have some common methods and resources. The Common class +defines common types, symbolic constants, and type converters and it +also provides the basis for keyboard traversal. The code for keyboard +traversal is roughly based on that in the Xw widget set (created by +Hewlett Packard), but it uses the \fIaccept_focus\fP method. + +When the resource \fItraversalOn\fP is set to \fITrue\fP (either at creation +time, or via a \fIXtSetValues\fP later), a set of translations is added to +the widget. If the widget's parent is also a subclass of Common, these +translations will then implement keyboard traversal, using the cursor +keys (up, down, prev, etc.) Of course, when the widget already uses +these keys for other purposes, the keyboard traversal will not work. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.TP +.I "XtNtraversalOn" +The resource \fItraversalOn\fP determines whether keyboard traversal is +used. If it is \fITrue\fP initially, or if it is set to \fITrue\fP later, a +set of translations will be added to the widget. + + + +.hi + +.nf +Boolean traversalOn = True +.fi + +.eh + +.TP +.I "XtNhighlightThickness" +Keyboard focus is indicated by border highlighting. When keyboard +traversal is on and the widget receives the focus, the highlight border +is filled with the highlight color or tile. If the widget does not +have the focus, the area is left in the default background. + + + +.hi + +.nf +Dimension highlightThickness = 2 +.fi + +.eh + +.TP +.I "XtNhighlightColor" +The highlight border can have a color or it can be tiled with a +pixmap. Whichever of the resources \fIhighlightColor\fP or +\fIhighlightPixmap\fP is set latest, is used. When both are set, the +pixmap is used. + + + +.hi + +.nf +Pixel highlightColor = <String>XtDefaultForeground +.fi + +.eh + +.TP +.I "XtNhighlightPixmap" +The \fIhighlightPixmap\fP can be set to a pixmap with which the +highlight border will be tiled. Only one of \fIhighlightPixmap\fP and +\fIhighlightColor\fP can be set, see above. + + + +.hi + +.nf +Pixmap highlightPixmap = None +.fi + +.eh + +.TP +.I "XtNnextTop" +When an application has several top level windows, it should have a +way of setting the focus between windows. The Enter key in any widget +with keyboard traversal on normally invokes the \fItraverseNextTop\fP +action, that will call the callbacks of the topmost Common (or +subclass) widget in the hierarchy. The callback may set the focus to +another top level widget, with \fIXtCallAcceptFocus\fP. + + + +.hi + +.nf +<Callback> XtCallbackList nextTop = NULL +.fi + +.eh + +.TP +.I "XtNuserData" +The resource \fIuserData\fP is provided for applications that want to +attach their own data to a widget. It is not used by the widget itself +in any way. + + + +.hi + +.nf +<Pointer> XtPointer userData = NULL +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The type \fIAlignment\fP is actually an integer, but it is given a +different name to allow a type converter to be installed for it. + + + +.nf + +.B type + Alignment = int +.fi + +The symbolic constants can be added together to form an alignment. +Various widgets use this to position labels, other widgets, etcetera. + + + +\fBdef\fP XfwfCenter = 0 + +\fBdef\fP XfwfLeft = 1 + +\fBdef\fP XfwfRight = 2 + +\fBdef\fP XfwfTop = 4 + +\fBdef\fP XfwfBottom = 8 + +For convenience, the eight possible combinations also have symbolic +names. + + + +\fBdef\fP XfwfTopLeft = (XfwfTop +XfwfLeft ) + +\fBdef\fP XfwfTopRight = (XfwfTop +XfwfRight ) + +\fBdef\fP XfwfBottomLeft = (XfwfBottom +XfwfLeft ) + +\fBdef\fP XfwfBottomRight = (XfwfBottom +XfwfRight ) + +The directions of traversal are used as arguments to the \fItraverse\fP +method. They are probably only useful to subclasses. + + + +.nf + +.B type + TraversalDirection = enum { + TraverseLeft, TraverseRight, TraverseUp, TraverseDown, + TraverseNext, TraversePrev, TraverseHome, TraverseNextTop } +.fi + +To know the inside area of a Common widget might be useful to other +widgets than subclasses alone. Calling \fIXfwfCallComputeInside\fP will +call the \fIcompute_inside\fP method, if available. + +.nf +XfwfCallComputeInside( $, Position * x, Position * y, Dimension * w, Dimension * h) +.fi + +.hi +{ + if (XtIsSubclass($, xfwfCommonWidgetClass) $compute_inside) + $compute_inside($, x, y, w, h); +} +.eh + +.hi +.SS "Actions" + +When the widget receives or looses the focus, the border highlight +is drawn or removed. This action function draws the highlight border +and in case the widget has set \fItraversalOn\fP, it also sets the +keyboard focus to the widget itself, or one of its children. + +However, FocusIn events may also be so-called virtual events, meaning +that not the receiving widget, but one of its descendants gets the +real focus. When \fIfocusIn\fP receives one of those, it removes the +highlight border. + +.hi +\fBdef\fP focus_detail(detail) = +(detail ==NotifyAncestor ?"NotifyAncestor":detail ==NotifyVirtual ?"NotifyVirtual":detail ==NotifyInferior ?"NotifyInferior":detail ==NotifyNonlinear ?"NotifyNonlinear":detail ==NotifyNonlinearVirtual ?"NotifyNonlinearVirtual":detail ==NotifyPointer ?"NotifyPointer":detail ==NotifyPointerRoot ?"NotifyPointerRoot":detail ==NotifyDetailNone ?"NotifyDetailNone":"???") +.eh + +.TP +.I "focusIn + +.hi + +.nf +void focusIn($, XEvent* event, String* params, Cardinal* num_params) +{ + Time time = CurrentTime; + + if (event->type != FocusIn) + XtError("focusIn action may only be bound to FocusIn events"); + if (! $traversalOn) + return; + if (event->xfocus.detail == NotifyAncestor + || event->xfocus.detail == NotifyInferior + || event->xfocus.detail == NotifyNonlinear) { + if (! $traversal_focus) (void) $accept_focus($, time); + } else if ($traversal_focus) { + $unhighlight_border($); + $traversal_focus = False; + } +} +.fi + +.eh + +.TP +.I "focusOut + +This action removes the highlight border. + +.hi + +.nf +void focusOut($, XEvent* event, String* params, Cardinal* num_params) +{ + if (event->type != FocusOut) + XtError("focusOut action may only be bound to FocusOut events"); + if ($traversal_focus) { + $unhighlight_border($); + $traversal_focus = False; + } +} +.fi + +.eh + +.TP +.I "traverseDown + +This and the following actions all call the \fItraverse\fP method of the +widget's parent, with the appropiate direction arguments. +\fItraverseDown\fP tries to set the focus to a widget that is located +roughly below the current one. + +.hi + +.nf +void traverseDown($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseDown, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseUp + +The action tries to set the focus to a widget that is above the this +one. + +.hi + +.nf +void traverseUp($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseUp, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseLeft + +\fItraverseLeft\fP looks for a widget to the left of the current one and +sets the keyboard focus to that. + +.hi + +.nf +void traverseLeft($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseLeft, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseRight + +The action looks for a widget that will aceept the focus to the +right of the current one. + +.hi + +.nf +void traverseRight($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseRight, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseNext + +The next sibling gets the focus. The precise order is determined by +the parent, but usually is will be the order in which the widgets were +created. If there is no suitable sibling, the request is passed to the +grandparent, so that an `aunt widget' or other relation can get the +focus. + +.hi + +.nf +void traverseNext($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseNext, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traversePrev + +The previous widget gets the focus. See also the description of +\fItraverseNext\fP above. + +.hi + +.nf +void traversePrev($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraversePrev, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseNextTop + +\fItraverseNextTop\fP finds the topmost ancestor that is a subclass of +Common and lets it call the \fInextTop\fP callbacks that have been +registered there. These callbacks can be used by an application that +has multiple top level windows to set the focus to another window. + +.hi + +.nf +void traverseNextTop($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseNextTop, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseHome + +The action sets the focus to the sibling widget that is closest to +the upper left corner of the parent. + +.hi + +.nf +void traverseHome($, XEvent* event, String* params, Cardinal* num_params) +{ + $traverse($, TraverseHome, $, event->xkey.time); +} +.fi + +.eh + +.TP +.I "traverseCurrent + +The \fItraverseCurrent\fP action can be used by widgets to set the focus +to themselves. It is not used in the set of translations that is added +when \fItraversalOn\fP is set to \fITrue\fP. + +.hi + +.nf +void traverseCurrent($, XEvent* event, String* params, Cardinal* num_params) +{ + Time time = CurrentTime; + + if ($traversalOn) (void) $accept_focus($, time); +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +Most of the included files have to do with the \fIIcon\fP type. Six +icons are preloaded. + +.nf + +.B incl + <stdio.h> +.fi + +.nf + +.B incl + <X11/Xmu/Converters.h> +.fi + +.nf + +.B incl + <Xfwf/Converters.h> +.fi + +.hi + +.hi +.SS "Private variables" + +\fIabs\fP, \fImin\fP and \fImax\fP are used often enough in various subclasses +to define them here. They will end up in the private(!) header file. + + + +.nf + max +.fi + +.nf + min +.fi + +.nf + abs +.fi + +A private variable is used to track the keyboard focus, but only +while traversal is on. If \fItraversal_focus\fP is \fITrue\fP, it means that +the widget has keyboard focus and that that focus is a result of +keyboard traversal. It also means that the widget's border is +highlighted, although that is only visible if the \fIhighlightThickness\fP +is positive. + + + +.nf +Boolean traversal_focus +.fi + +The highlight border is filled with a color or a tile. + + + +.nf +GC bordergc +.fi + +.hi + +.hi +.SH "Class variables" + +\fItraversal_trans\fP holds the compiled version of the +\fIextraTranslations\fP. + + + +.nf +XtTranslations traversal_trans = NULL +.fi + +.hi + +.hi +.SS "Methods" + +The type converter \fIcvtStringToAlignment\fP is installed in the +\fIclass_initialize\fP method, after the quarks for the recognized strings +are created. + +The converter from String to Icon needs one extra argument, viz., the +widget for which the icon is loaded. An offset of 0 should give a +pointer to the widget itself. + +.nf +class_initialize() +{ + static XtConvertArgRec args[] = { + { XtWidgetBaseOffset, 0, sizeof(Widget) } }; + + XtSetTypeConverter(XtRString, "Alignment", cvtStringToAlignment, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter("Alignment", XtRString, cvtAlignmentToString, + NULL, 0, XtCacheNone, NULL); + /* init_icon_quarks(); */ + XtSetTypeConverter(XtRString, "Icon", cvtStringToIcon, + args, XtNumber(args), XtCacheNone, NULL); +} +.fi + +The \fIextraTranslations\fP are compiled into Xt's internal form and +stored in a class variable \fItraversal_trans\fP, but only if that hasn't +been done before. (It should have been done in the \fIclass_initialize\fP +method, but wbuild's `\fI$\fP' syntax doesn't work there (yet)). + +If the widget has the \fItraversalOn\fP resource set, the translations are +merged with the widgets existing translations. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + if ($traversal_trans == NULL) + $traversal_trans = XtParseTranslationTable(extraTranslations); + if ($traversalOn) { + XtAugmentTranslations($, $traversal_trans); + $visible_interest = True; + } + $traversal_focus = False; + $bordergc = NULL; + create_bordergc($); +} +.fi + +The \fIset_values\fP method checks if the keyboard traversal has been +turned on and adds the traversal translations. (It can only be turned +on, not turned off.) + +If something changes that causes the widget to loose keyboard focus, +the parent is asked to put the focus somewhere else. Otherwise the +whole application might suddenly loose keyboard focus. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_redraw = False; + Widget parent = XtParent($); + Time time = CurrentTime; + + if ($traversalOn != $old$traversalOn $traversalOn) { + XtAugmentTranslations($, $traversal_trans); + $visible_interest = True; + } + if (($sensitive != $old$sensitive + || $ancestor_sensitive != $old$ancestor_sensitive + || $traversalOn != $old$traversalOn) + $traversal_focus) { + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + $parent$traverse(parent, TraverseHome, $, time); + } + if ($highlightThickness != $old$highlightThickness) + need_redraw = True; + if ($highlightPixmap != $old$highlightPixmap) { + create_bordergc($); + need_redraw = True; + } else if ($highlightColor != $old$highlightColor) { + $highlightPixmap = None; + create_bordergc($); + need_redraw = True; + } + return need_redraw; +} +.fi + +A new method \fIcompute_inside\fP is defined, that returns the area +inside the highlight border. Subclasses should use this to compute +their drawable area, in preference to computing it from \fI$width\fP and +\fI$height\fP. Subclasses, such as the Frame widget, redefine the method +if they add more border material. + +.nf +compute_inside($, Position * x, Position * y, Dimension * w, Dimension * h) +{ + *x = $highlightThickness; + *y = $highlightThickness; + *w = $width - 2 * $highlightThickness; + *h = $height - 2 * $highlightThickness; +} +.fi + +The \fIexpose\fP method draws the highlight border, if there is one. + +.nf +expose($, XEvent * event, Region region) +{ + if (! XtIsRealized($)) return; + if (region != NULL) XSetRegion(XtDisplay($), $bordergc, region); + if ($traversal_focus) $highlight_border($); + if (region != NULL) XSetClipMask(XtDisplay($), $bordergc, None); +} +.fi + +When the widget is destroyed and the widget still has the keyboard +focus, the parent is asked to give it to another widget. + +.nf +destroy($) +{ + Widget parent = XtParent($); + Time time = CurrentTime; + + if ($traversal_focus) { + $sensitive = False; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + $parent$traverse(parent, TraverseHome, $, time); + } +} +.fi + +The border highlight is drawn and removed with two methods, although +few subclasses will want to redefine them. The methods are called by +the \fIfocusIn\fP and \fIfocusOut\fP actions and \fIhighlight_border\fP is also +called by \fIexpose\fP. + +.nf +highlight_border($) +{ + XRectangle rect[4]; + + if ($highlightThickness == 0) return; + + rect[0].x = 0; + rect[0].y = 0; + rect[0].width = $width; + rect[0].height = $highlightThickness; + + rect[1].x = 0; + rect[1].y = 0; + rect[1].width = $highlightThickness; + rect[1].height = $height; + + rect[2].x = $width - $highlightThickness; + rect[2].y = 0; + rect[2].width = $highlightThickness; + rect[2].height = $height; + + rect[3].x = 0; + rect[3].y = $height - $highlightThickness; + rect[3].width = $width; + rect[3].height = $highlightThickness; + + XFillRectangles(XtDisplay($), XtWindow($), $bordergc, rect[0], 4); +} +.fi + +.nf +unhighlight_border($) +{ + if ($highlightThickness == 0) return; + + XClearArea(XtDisplay($), XtWindow($), + 0, 0, $width, $highlightThickness, False); + XClearArea(XtDisplay($), XtWindow($), + 0, 0, $highlightThickness, $height, False); + XClearArea(XtDisplay($), XtWindow($), + $width - $highlightThickness, 0, + $highlightThickness, $height, False); + XClearArea(XtDisplay($), XtWindow($), + 0, $height - $highlightThickness, + $width, $highlightThickness, False); +} +.fi + +When the \fIaccept_focus\fP method is called, the widget should try to set +the focus to itself or one of its children. If it succeeds, it returns +\fITrue\fP else \fIFalse\fP. If there are children, each is asked in turn, +until one is found that accepts the focus. If none is found, the +widget checks it's own \fIsensitive\fP resource, to see if it can receive +keyboard events. If so, it sets the focus to itself and returns +\fITrue\fP, otherwise \fIFalse\fP. + +.nf +Boolean accept_focus($, Time * time) +{ + int i; + + if (! XtIsRealized($) || ! $sensitive || ! $traversalOn + || ! $visible || ! $ancestor_sensitive || ! $managed + || ! $mapped_when_managed || $being_destroyed) return False; + for (i = 0; i < $num_children; i++) + if (XtCallAcceptFocus($children[i], time)) return True; + if (! $traversal_focus) { + XSetInputFocus(XtDisplay($), XtWindow($), RevertToParent, *time); + $traversal_focus = True; + $highlight_border($); + } + return True; +} +.fi + +A Common widget (and most subclasses) return \fITrue\fP for +\fIwould_accept_focus\fP, if the \fIsensitive\fP, \fIvisible\fP and \fItraversalOn\fP +resources are set and none of the children wants the focus. + +.nf +Boolean would_accept_focus($) +{ + int i; + Widget child; + + if (! XtIsRealized($) || ! $sensitive || ! $visible || ! $traversalOn) + return False; + else { + for (i = 0; i < $num_children; i++) { + child = $children[i]; + if (XtIsSubclass(child, xfwfCommonWidgetClass) + $child$would_accept_focus(child)) + return False; + } + return True; + } +} +.fi + +The algorithm behind keyboard traversal + +* Handling focus events + +If a widget receives a (non-virtual) FocusIn event, this is usually +caused by the \fIaccept_focus\fP method of that widget, except in the case +that a top level widget receives the focus from the window manager. In +the first case, the window can just draw the highlight border, in the +second case, the widget should try to set the focus to one of its +children. + +To be able to distinguish the two cases, the \fIaccept_focus\fP method +sets the private instance variable \fItraversal_focus\fP to \fITrue\fP before +it calls \fIXSetInputFocus\fP. The \fIfocusIn\fP action then checks this +variable and if it is not set, calls the \fIaccept_focus\fP method. + +The \fIfocusOut\fP action resets \fItraversal_focus\fP to \fIFalse\fP. + +The \fItraversal_focus\fP variable can be interpreted to mean, that the +widget has the keyboard focus and that it is because of keyboard +traversal. At least in the Common widget, it can never be \fITrue\fP when +\fItraversalOn\fP is not set. It can also only be \fITrue\fP when the widget +actually has the focus, except in the short time between the +\fIXSetInputFocus\fP call and the delivery of the \fIFocusIn\fP event. +(However, this scheme depends on the \fIfocusOut\fP action for resetting +\fItraversal_focus\fP to \fIFalse\fP, so, if the translation for the +\fIFocusOut\fP event is overridden, it will break down.) + +* User events + +The \fItraverseXXX\fP actions can be bound to keyboard events. They call +the \fItraverse\fP method, which will try to change the focus in the +indicated direction. The directions are: Home, Up, Left, Down, Right, +Next, Prev. Each direction can be considered a constraint or +criterium for choosing the focus widget, e.g., `Up' selects the +nearest widget that is above the current widget. `Next' and `Prev' are +simpler, in that they do not check the distance, but only the order in +the list of children. + +The \fItraverseCurrent\fP action is different. It is usually bound to a +mouse click and its task is to set the focus to the widget itself. It +does this by calling \fIaccept_focus\fP on itself. + +The \fItraverse\fP method looks for a widget in the indicated direction, +within the same application. If the direction is not `Next' or `Prev', +the method first recurses upwards, to the toplevel widget. From there +it recurses down again, to all children, grandchildren, etc., looking +for the widget that best matches the criterium. If a widget is found, +the focus will be set to it with a call to \fIXSetInputFocus\fP. The +private variable \fItraversal_focus\fP will be set to \fITrue\fP to indicate +that the widget received the focus as a result of keyboard traversal, +and not from the window manager or any other source. + +If the \fIdirection\fP argument is `Next' or `Prev', \fItraverse\fP will try +to set the focus to a sister widget, using the \fIaccept_focus\fP method. +If there is no suitable sister, the parent will be asked to find an +aunt widget, and so on. + +Note that the \fItraverse\fP and \fIaccept_focus\fP methods of the Common +widget only set the focus to a child, if the widget itself has +\fItraversalOn\fP. Thus, setting \fItraversalOn\fP to \fIFalse\fP for a certain +widget not only excludes the widget itself from keyboard traversal, +but also all its children. + +The \fItraverse\fP function is a method and not a utility function, +because it is expected that a few subclasses may want to redefine it. +E.g., the (not yet existing) Group widget may want to limit traversal +to widgets within itself. (And presumably define new actions to jump +outside the group.) + +To check if a widget suits the criterium, two things must be +determined: is the widget eligible for the focus and what is the +distance between the widget and the target position. To be able to +determine if the widget can accept the focus without actually setting +it, a method \fIwould_accept_focus\fP is defined, that returns \fITrue\fP if +the widget is willing to set the focus to itself. + +If the \fIdir\fP argument to \fItraverse\fP is \fITraverseNext\fP or +\fITraversePrev\fP, the \fItraverse_to_next\fP or \fItraverse_to_prev\fP utility +functions are called. Otherwise, the \fItraverse\fP method checks the +class of the parent. If the parent is a subclass of \fIXfwfCommon\fP, it +also has a \fItraverse\fP method and the task of finding a widget to +traverse to is delegated to the parent. Otherwise, the desired widget +is looked for with the help of a utility function. + +The \fIdir\fP argument is one of Home, Up, Down, Left, Right, Next or +Prev. The \fIcurrent\fP argument holds the widget that currently has the +focus and relative to which the focus will have to move. + +\fBdef\fP LARGE_NUMBER = 2000000000 + +.nf +traverse($, TraversalDirection dir, Widget current, Time * time) +{ + Widget w, parent = XtParent($); + Position x, y; + int distance = LARGE_NUMBER; + + if (dir == TraverseNextTop) + traverse_to_next_top($, current, time); + else if (dir == TraverseNext) + traverse_to_next($, current, time); + else if (dir == TraversePrev) + traverse_to_prev($, current, time); + else if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + $parent$traverse(parent, dir, current, time); + else { + switch (dir) { + case TraverseHome: x = 0; y = 0; break; + case TraverseLeft: x = 0; y = $current$height/2; break; + case TraverseDown: x = $current$width/2; y = $current$height; break; + case TraverseRight: x = $current$width; y = $current$height/2; break; + case TraverseUp: x = $current$width/2; y = 0; break; + } + if (dir != TraverseHome) XtTranslateCoords(current, x, y, x, y); + if (traverse_to_direction($, dir, x, y, w, distance)) + XtCallAcceptFocus(w, time); + } +} +.fi + +To choose a color that is somewhat darker or lighter than another +color, the function \fIchoose_color\fP queries the RGB values of a pixel +and multiplies them with a factor. If all goes well, the function +returns \fITrue\fP. If the chosen color ends up being the same as the +original, the color gray75 is returned instead. + +It is defined as a method, to make it accessible to subclasses. There +seems to be no need to make it available globally. + +.nf +Boolean choose_color($, double factor, Pixel base, Pixel * result) +{ + XColor color1, color2, dummy; + + color1.pixel = base; + XQueryColor(XtDisplay($), DefaultColormapOfScreen(XtScreen($)), color1); + color2.red = min(65535, factor * color1.red); + color2.green = min(65535, factor * color1.green); + color2.blue = min(65535, factor * color1.blue); + if (! XAllocColor(XtDisplay($), + DefaultColormapOfScreen(XtScreen($)), color2)) + return False; + if (base == color2.pixel) { + if (! XAllocNamedColor(XtDisplay($), + DefaultColormapOfScreen(XtScreen($)), "gray75", + color2, dummy)) + return False; + } + *result = color2.pixel; + return True; +} +.fi + +The method \fIlighter_color\fP uses \fIchoose_color\fP to compute a color +that is 1.5 times as bright as the color passed in as argument. The +function result is \fITrue\fP if a color was allocated, else \fIFalse\fP. + +.nf +Boolean lighter_color($, Pixel base, Pixel * result) +{ + return choose_color($, 1.5, base, result); +} +.fi + +The method \fIdarker_color\fP uses \fIchoose_color\fP to compute a color +that is 2/3 times as bright as the color passed in as argument. The +function result is \fITrue\fP if a color was allocated, else \fIFalse\fP. + +.nf +Boolean darker_color($, Pixel base, Pixel * result) +{ + return choose_color($, 0.667, base, result); +} +.fi + +.hi + +.hi +.SH "Utilities" + +The converter \fIcvtStringToAlignment\fP converts strings like `right', +`top left' and `bottom center' to values of type \fIAlignment\fP. + +\fBdef\fP done(type, value) = +do { + if (to->addr != NULL) { + if (to->size < sizeof(type)) { + to->size = sizeof(type); + return False; + } + *(type*)(to->addr) = (value); + } else { + static type static_val; + static_val = (value); + to->addr = (XtPointer)static_val; + } + to->size = sizeof(type); + return True; + }while (0 ) + +.nf +Boolean cvtStringToAlignment(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +{ + Alignment a = 0; + char c, *t, *s = (char*) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToAlignment", "wrongParameters", + "XtToolkitError", + "String to Alignment conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + while (*s) { + for (; isspace(*s); s++) ; + for (t = s; *t ! isspace(*t); t++) ; + c = *t; + *t = '\\0'; + if (XmuCompareISOLatin1(s, "top") == 0) a |= XfwfTop; + else if (XmuCompareISOLatin1(s, "bottom") == 0) a |= XfwfBottom; + else if (XmuCompareISOLatin1(s, "center") == 0) ; /* skip */ + else if (XmuCompareISOLatin1(s, "left") == 0) a |= XfwfLeft; + else if (XmuCompareISOLatin1(s, "right") == 0) a |= XfwfRight; + else { + XtDisplayStringConversionWarning(display, (char*) from->addr, + "Alignment"); + break; + } + *t = c; + s = t; + } + done(Alignment, a); +} +.fi + +The converter \fIcvtAlignmentToString\fP does the reverse: it convertes values of type \fIAlignment\fP (\fIint\fP's) to strings. + +.nf +Boolean cvtAlignmentToString(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +{ + Alignment *a = (Alignment*) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtAlignmentToString", "wrongParameters", + "XtToolkitError", + "Alignment to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*a) { + case XfwfCenter: done(String, "center"); + case XfwfBottom: done(String, "bottom"); + case XfwfTop: done(String, "top"); + case XfwfLeft: done(String, "left"); + case XfwfRight: done(String, "right"); + case XfwfBottom + XfwfLeft: done(String, "bottom left"); + case XfwfBottom + XfwfRight: done(String, "bottom right"); + case XfwfTop + XfwfLeft: done(String, "top left"); + case XfwfTop + XfwfRight: done(String, "top right"); + default: done(String, "unknown"); + } +} +.fi + +The following string is the set of translations that will be added +to any widget that has \fItraversalOn\fP set to \fITrue\fP. The string is +compiled into Xt's internal representation by the \fIclass_initialize\fP +method. + +.nf +char extraTranslations[] = "\\ + <FocusIn>: focusIn()\\n\\ + <FocusOut>: focusOut()\\n\\ + <Key>Up: traverseUp()\\n\\ + <Key>Down: traverseDown()\\n\\ + <Key>Left: traverseLeft()\\n\\ + <Key>Right: traverseRight()\\n\\ + <Key>Next: traverseNext()\\n\\ + ~Shift<Key>Tab: traverseNext()\\n\\ + <Key>Prior: traversePrev()\\n\\ + Shift<Key>Tab: traversePrev()\\n\\ + <Key>KP_Enter: traverseNextTop()\\n\\ + <Key>Home: traverseHome()" +.fi + +The \fIcreate_bordergc\fP function creates a new GC for filling the +highlight border with. + +.nf +create_bordergc($) +{ + XtGCMask mask; + XGCValues values; + + if ($bordergc) XtReleaseGC($, $bordergc); + if ($highlightPixmap != None) { + mask = GCFillStyle | GCTile; + values.fill_style = FillTiled; + values.tile = $highlightPixmap; + } else { + mask = GCFillStyle | GCForeground; + values.fill_style = FillSolid; + values.foreground = $highlightColor; + } + $bordergc = XtGetGC($, mask, values); +} +.fi + +The \fItraverse_to_direction\fP function returns the nearest child, +grandchild, etc. in the indicated direction that is willing to accept +the focus. It returns \fIFalse\fP if no widget is found. The position is the +absolute coordinates, i.e., relative to the root window. The \fIdistance\fP +argument holds the distance from \fIx,y\fP of the best widget so far. If the +function finds a better one, it will return the new distance through +this parameter. + +.nf +Boolean traverse_to_direction($, TraversalDirection dir, int x, int y, Widget * found, int * distance) +{ + int i; + Widget child, w; + Position rx, ry; + int dist; + Boolean found_child = False; + + if (! $traversalOn) return False; + /* + * First recurse to all descendants + */ + for (i = 0; i < $num_children; i++) + if (XtIsSubclass($children[i], xfwfCommonWidgetClass) + traverse_to_direction($children[i], dir, x, y, found, distance)) + found_child = True; + if (found_child) return True; + /* + * No child found, now check own position and distance + */ + switch (dir) { + case TraverseHome: rx = 0; ry = 0; break; + case TraverseLeft: rx = $width; ry = $height/2; break; + case TraverseDown: rx = $width/2; ry = 0; break; + case TraverseRight: rx = 0; ry = $height/2; break; + case TraverseUp: rx = $width/2; ry = $height; break; + } + XtTranslateCoords($, rx, ry, rx, ry); + if ((dir == TraverseUp ry > y) + || (dir == TraverseLeft rx > x) + || (dir == TraverseDown ry < y) + || (dir == TraverseRight rx < x)) return False; + dist = (rx - x)*(rx - x) + (ry - y)*(ry - y); + if (dist >= *distance) return False; + /* + * We are the best so far, but do we want the focus? + */ + if (! $would_accept_focus($)) return False; + *distance = dist; + *found = $; + return True; +} +.fi + +The \fItraverse_to_next\fP routine looks for the \fIcurrent\fP widget among +its children. If it is found, all children following it will be tried +until one accepts the focus. If no child does, the routine will try to +ask the parent to find a sister widget instead. + +.nf +traverse_to_next($, Widget current, Time * time) +{ + int i = 0; + Widget parent = XtParent($); + + while (i < $num_children $children[i] != current) i++; + for (i++; i < $num_children; i++) + if (XtCallAcceptFocus($children[i], time)) return; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + $parent$traverse(parent, TraverseNext, $, time); +} +.fi + +\fItraverse_to_prev\fP looks for the \fIcurrent\fP widget among the children, +if it is found, all children before it will be asked in turn to accept +the focus. If none does, the parent is asked to set the focus to a +sister instead. + +.nf +traverse_to_prev($, Widget current, Time * time) +{ + int i = 0; + Widget parent = XtParent($); + + while (i < $num_children $children[i] != current) i++; + for (i--; i >= 0; i--) + if (XtCallAcceptFocus($children[i], time)) return; + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + $parent$traverse(parent, TraversePrev, $, time); +} +.fi + +.nf +traverse_to_next_top($, Widget current, Time * time) +{ + Widget parent = XtParent($); + + if (XtIsSubclass(parent, xfwfCommonWidgetClass)) + $parent$traverse(parent, TraverseNextTop, current, time); + else + XtCallCallbackList($, $nextTop, NULL); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/CommonP.h b/vendor/x11iraf/obm/ObmW/CommonP.h new file mode 100644 index 00000000..e98e2310 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/CommonP.h @@ -0,0 +1,108 @@ +/* Generated by wbuild from "Common.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfCommonP_H_ +#define _XfwfCommonP_H_ +#include <X11/CompositeP.h> +#include "Common.h" +typedef void (*compute_inside_Proc)( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +#define XtInherit_compute_inside ((compute_inside_Proc) _XtInherit) +typedef void (*highlight_border_Proc)( +#if NeedFunctionPrototypes +Widget +#endif +); +#define XtInherit_highlight_border ((highlight_border_Proc) _XtInherit) +typedef void (*unhighlight_border_Proc)( +#if NeedFunctionPrototypes +Widget +#endif +); +#define XtInherit_unhighlight_border ((unhighlight_border_Proc) _XtInherit) +typedef Boolean (*would_accept_focus_Proc)( +#if NeedFunctionPrototypes +Widget +#endif +); +#define XtInherit_would_accept_focus ((would_accept_focus_Proc) _XtInherit) +typedef void (*traverse_Proc)( +#if NeedFunctionPrototypes +Widget,TraversalDirection ,Widget ,Time * +#endif +); +#define XtInherit_traverse ((traverse_Proc) _XtInherit) +typedef Boolean (*choose_color_Proc)( +#if NeedFunctionPrototypes +Widget,double ,Pixel ,Pixel * +#endif +); +#define XtInherit_choose_color ((choose_color_Proc) _XtInherit) +typedef Boolean (*lighter_color_Proc)( +#if NeedFunctionPrototypes +Widget,Pixel ,Pixel * +#endif +); +#define XtInherit_lighter_color ((lighter_color_Proc) _XtInherit) +typedef Boolean (*darker_color_Proc)( +#if NeedFunctionPrototypes +Widget,Pixel ,Pixel * +#endif +); +#define XtInherit_darker_color ((darker_color_Proc) _XtInherit) +typedef struct { +/* methods */ +compute_inside_Proc compute_inside; +highlight_border_Proc highlight_border; +unhighlight_border_Proc unhighlight_border; +would_accept_focus_Proc would_accept_focus; +#define LARGE_NUMBER 2000000000 + + +traverse_Proc traverse; +choose_color_Proc choose_color; +lighter_color_Proc lighter_color; +darker_color_Proc darker_color; +/* class variables */ +XtTranslations traversal_trans; +} XfwfCommonClassPart; +typedef struct _XfwfCommonClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +} XfwfCommonClassRec; + +typedef struct { +/* resources */ +Boolean traversalOn; +Dimension highlightThickness; +Pixel highlightColor; +Pixmap highlightPixmap; +XtCallbackList nextTop; +XtPointer userData; +/* private state */ +#define max(a, b) ((a )>(b )?(a ):(b )) + + +#define min(a, b) ((a )<(b )?(a ):(b )) + + +#define abs(a) ((a )<0 ?-(a ):(a )) + + +Boolean traversal_focus; +GC bordergc; +} XfwfCommonPart; + +typedef struct _XfwfCommonRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +} XfwfCommonRec; + +externalref XfwfCommonClassRec xfwfCommonClassRec; + +#endif /* _XfwfCommonP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Container.c b/vendor/x11iraf/obm/ObmW/Container.c new file mode 100644 index 00000000..cc13769f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Container.c @@ -0,0 +1,346 @@ +#include <stdio.h> + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/ContainerP.h> + + + +#define UnspecifiedPixmap (Pixmap)2 +#define UndefinedGC (GC)2 + +static void InsPixel(); + +static XtResource resources[] = { +#define offset(field) XtOffsetOf(ContainerRec, container.field) + { + "top.gc", "Top.gc", XtRString, sizeof(String), + offset(top_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "bottom.gc", "Bottom.gc", XtRString, sizeof(String), + offset(bottom_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(shadow_thickness), XtRImmediate, (XtPointer) 0 + }, + { + XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(top_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(top_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(bottom_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(bottom_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRString, (caddr_t) XtDefaultForeground + }, + { + XtNuserData, XtCUserData, XtRPixmap, sizeof(Pixmap), + offset(user_data), XtRImmediate, (caddr_t) NULL + }, + { + XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, (XtPointer)0 + } + +}; +static void InsPixel(w, off, value) + Widget w; + int off; + XrmValue *value; +{ + register ContainerWidget p = (ContainerWidget) w; + static Pixel pixel; + + if (off == offset(top_shadow_color)) + { + p->container.top_shadow_GC = UndefinedGC; + } + else /*bottom_shadow_color */ + { + p->container.bottom_shadow_GC = UndefinedGC; + } + value->addr = (caddr_t) &pixel; +} + +#undef offset + + +static void ClassInitialize(); +static void ClassPartInitialize(); +static void initialize(); +static void realize(); +static void destroy(); +static void Redisplay(); + +static Boolean SetValues(); + +/*static XtGeometryResult query_geometry();*/ +/*static XtGeometryResult geometry_manager();*/ +/*static void changed_managed();*/ + +ContainerClassRec containerClassRec = { + /* Core class part */ + { + /* superclass */ (WidgetClass) &constraintClassRec, + /* class_name */ "Container", + /* widget_size */ sizeof(ContainerRec), + /* class_cnitialize */ ClassInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ initialize, + /* initialize_hook */ NULL, + /* realize */ realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ XtExposeCompressMultiple, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ destroy, + /* resize */ NULL, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ NULL, + /* query_geometry */ NULL, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + /* Composite class part */ + { + /* geometry manager */ XtInheritGeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL, + }, + /* Constraint class part */ + { + /* subresources */ NULL, + /* subresource_count */ 0, + /* constraint_size */ 0, + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL, + }, + /* Container class part */ + { + /* unused */ 0, + } +}; + +WidgetClass containerWidgetClass = (WidgetClass)&containerClassRec; + +static void +ClassInitialize() +{ +} + +static void +ClassPartInitialize(widget_class) + WidgetClass widget_class; +{ +} + +/* ARGSUSED */ +static void initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + ContainerWidget sw = (ContainerWidget)new; + ContainerPart* cp = (ContainerPart*)&(sw->container); + + + if (cp->top_shadow_pixmap == UnspecifiedPixmap) + cp->top_shadow_pixmap = None; + + if (cp->top_shadow_GC == NULL){ + if (cp->top_shadow_pixmap != None) + cp->top_shadow_GC = AllocGCFromPixmap (new, cp->top_shadow_pixmap); + else + cp->top_shadow_GC = AllocGCFromPixel (new, cp->top_shadow_color); + } else if (cp->top_shadow_GC == UndefinedGC) + cp->top_shadow_GC = MakeTopShadowGC (new, new->core.background_pixel); + + + if (cp->bottom_shadow_pixmap == UnspecifiedPixmap) + cp->bottom_shadow_pixmap = None; + + if (cp->bottom_shadow_GC == NULL){ + if (cp->bottom_shadow_pixmap != None) + cp->bottom_shadow_GC = AllocGCFromPixmap (new, cp->bottom_shadow_pixmap); + else + cp->bottom_shadow_GC = AllocGCFromPixel (new, cp->bottom_shadow_color); + } else if (cp->bottom_shadow_GC == UndefinedGC) + cp->bottom_shadow_GC =MakeBottomShadowGC (new, new->core.background_pixel); + + cp->background_GC = AllocGCFromPixel (new, new->core.background_pixel); +} + +static void destroy(w) + Widget w; +{ + register ContainerWidget c = (ContainerWidget)w; + + XtReleaseGC(w, c->container.top_shadow_GC); + XtReleaseGC(w, c->container.bottom_shadow_GC); + XtReleaseGC(w, c->container.background_GC); + +} + +static void realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + (*coreClassRec.core_class.realize) (w, valueMask, attributes); +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + ContainerWidget s_old = (ContainerWidget) current; + ContainerWidget s_new = (ContainerWidget) new; + ContainerPart* sp = (ContainerPart*)&(s_new->container); + Boolean redraw = False; + +#define NE(field) (s_new->container.field != s_old->container.field) + + if (NE(top_shadow_pixmap)) + { + + XtReleaseGC (new, sp->top_shadow_GC); + sp->top_shadow_GC = AllocGCFromPixmap (new, sp->top_shadow_pixmap); + redraw = True; + + } + else if (NE(top_shadow_color) && sp->top_shadow_pixmap == None) + { + + XtReleaseGC (new, sp->top_shadow_GC); + sp->top_shadow_GC = AllocGCFromPixel (new, sp->top_shadow_color); + redraw = True; + + } + + if (NE(bottom_shadow_pixmap)) + { + + XtReleaseGC (new, sp->bottom_shadow_GC); + sp->bottom_shadow_GC = AllocGCFromPixmap (new, sp->bottom_shadow_pixmap); + redraw = True; + + } + else if (NE(bottom_shadow_color) && sp->bottom_shadow_pixmap == None) + { + + XtReleaseGC (new, sp->bottom_shadow_GC); + sp->bottom_shadow_GC = AllocGCFromPixel (new, sp->bottom_shadow_color); + redraw = True; + + } + +#undef NE + + return redraw; +} + + +/* ARGSUSED */ +static void Redisplay(gw, event, region) + Widget gw; + XEvent *event; /* unused */ + Region region; /* unused */ +{ + register ContainerWidget c = (ContainerWidget) gw; + + XClearWindow (XtDisplay(gw), XtWindow(gw)); + + XawDrawFrame (gw, + 0, + 0, + c->core.width, + c->core.height, + XawRAISED, + c->container.shadow_thickness, + c->container.top_shadow_GC, + c->container.bottom_shadow_GC); + +} + +void _XawQueryGeometry (widget, reply_return) + Widget widget; + XtWidgetGeometry *reply_return; +{ + XtGeometryResult result; + String subs[1]; + Cardinal num_subs; + WidgetClass class; + + if (widget != (Widget)NULL) + { + + reply_return->request_mode = CWWidth | CWHeight; + + result = XtQueryGeometry (widget, NULL, reply_return); + + switch (result) + { + case XtGeometryNo : + case XtGeometryYes : + reply_return->width = widget->core.width; + reply_return->height = widget->core.height; + break; + case XtGeometryAlmost : + if (!(reply_return->request_mode & CWWidth)) + reply_return->width = widget->core.width; + + if (!(reply_return->request_mode & CWHeight)) + reply_return->height = widget->core.height; + break; + default : + class = XtClass(widget); + subs[0] = class->core_class.class_name; + num_subs = 1; + XtAppWarningMsg( + XtWidgetToApplicationContext(widget), + "QueryGeometry", + "QueryGeometry", + "WidgetToolkit", + "WidgetClass '%s' returns invalid value for XtQueryGeometry", + subs, &num_subs); + break; + } + reply_return->request_mode = CWWidth | CWHeight; + } +} + + + diff --git a/vendor/x11iraf/obm/ObmW/Container.h b/vendor/x11iraf/obm/ObmW/Container.h new file mode 100644 index 00000000..a6164a9d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Container.h @@ -0,0 +1,61 @@ +#ifndef _XawContainer_h +#define _XawContainer_h + + +#include <X11/Xraw/XawInit.h> + +/*********************************************************************** + * + * Container Widget (subclass of CompositeClass) + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/* New fields */ +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNuserData "userData" +#define XtCUserData "UserData" +#define XtNcontainerType "containerType" +#define XtCContainerType "ContainerType" +#define XtRContainerType "ContainerType" + +/* Class record constants */ + +extern WidgetClass containerWidgetClass; + +typedef struct _ContainerClassRec *ContainerWidgetClass; +typedef struct _ContainerRec *ContainerWidget; + +#endif /* _XawContainer_h */ diff --git a/vendor/x11iraf/obm/ObmW/ContainerP.h b/vendor/x11iraf/obm/ObmW/ContainerP.h new file mode 100644 index 00000000..25097a74 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ContainerP.h @@ -0,0 +1,71 @@ +#ifndef _CONTEINER_P_H_ +#define _CONTEINER_P_H_ + + +#include <X11/ConstrainP.h> +#include <X11/Xraw/Container.h> + +#define CORE(w) ((Widget)(w))->core +#define COMPOSITE(w) ((CompositeWidget)(w))->composite +#define CONTAINER(w) ((ContainerWidget)(w))->container + +typedef struct { + + /* public instance variables */ + + Pixel foreground; + + Pixel top_shadow_color; + Pixmap top_shadow_pixmap; + Pixel bottom_shadow_color; + Pixmap bottom_shadow_pixmap; + + Dimension shadow_thickness; + + XtPointer user_data; + + /* private instance variables */ + + GC bottom_shadow_GC; + GC top_shadow_GC; + GC background_GC; + +} ContainerPart; + + +typedef struct _ContainerRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; +} ContainerRec; + +typedef struct _ContainerClassPart{ + int unused; +} ContainerClassPart; + + +typedef struct _ContainerClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; +} ContainerClassRec; + +/* container constraints */ + +typedef struct _ContainerConstraintPart { + int unused; +} ContainerConstraintPart; + +typedef struct _ContainerConstraintRec { + ContainerConstraintPart container; +} ContainerCosntraintRec, *ContainerConstraintPtr; + +extern ContainerClassRec containerClassRec; + + +extern void _XawQueryGeometry Xraw_PROTO((Widget widget, + XtWidgetGeometry *reply_return)); + +#endif /* _CONTEINER_P_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Converters.h b/vendor/x11iraf/obm/ObmW/Converters.h new file mode 100644 index 00000000..45f15fad --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Converters.h @@ -0,0 +1,42 @@ +#ifndef _Converters_h +#define _Converters_h + +Boolean XfwfCvtLongToString( +#if NeedFunctionPrototypes + Display *display, + XrmValuePtr args, + Cardinal *num_args, + XrmValuePtr from, + XrmValuePtr to, + XtPointer *converter_data +#endif +); + +Boolean cvtStringToIcon( +#if NeedFunctionPrototypes + Display *dpy, + XrmValue *args, + Cardinal *num_args, + XrmValue *from, + XrmValue *to, + XtPointer *converter_data +#endif +); + +#ifndef NO_XPM + +#include <xpm.h> + +/* The |Icon| type is a convenient combination of a pixmap, a mask and +the pixmaps's attributes. Not all attributes are stored, only width +and height. */ + +typedef struct _Icon { + Pixmap pixmap; + Pixmap mask; + XpmAttributes attributes; +} Icon; + +#endif + +#endif /* _Converters_h */ diff --git a/vendor/x11iraf/obm/ObmW/DrawIString.c b/vendor/x11iraf/obm/ObmW/DrawIString.c new file mode 100644 index 00000000..6f81404e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/DrawIString.c @@ -0,0 +1,45 @@ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include "TabString.h" + +/* + * Like DrawImageString, except it takes an additional "tabs" + * argument, used to specify what horizontal pixel position to + * move to when tab characters are present in the string. If + * the "tabs" argument is NULL, works exactly like its + * counterpart. + */ +void +XfwfDrawImageString(display, drawable, gc, x, y, string, length, tabs) + Display *display; + Drawable drawable; + GC gc; + int x; + int y; + String string; + int length; + int *tabs; +{ + register char *p, *ep; + register int tx, tab; + + tab = tx = 0; + for (p = string; length; ) + { + ep = strnchr(p, '\t', length); + if (ep && tabs) + { + XDrawImageString(display, drawable, gc, x+tx, y, + p, ep - p); + tx = tabs[tab++]; + length -= ep - p + 1; + p = ep + 1; + } + else + { + XDrawImageString(display, drawable, gc, x+tx, y, + p, length); + break; + } + } +} diff --git a/vendor/x11iraf/obm/ObmW/DrawString.c b/vendor/x11iraf/obm/ObmW/DrawString.c new file mode 100644 index 00000000..280504e8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/DrawString.c @@ -0,0 +1,45 @@ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include "TabString.h" + +/* + * Like DrawString, except it takes an additional "tabs" + * argument, used to specify what horizontal pixel position to + * move to when tab characters are present in the string. If + * the "tabs" argument is NULL, works exactly like its + * counterpart. + */ +void +XfwfDrawString(display, drawable, gc, x, y, string, length, tabs) + Display *display; + Drawable drawable; + GC gc; + int x; + int y; + String string; + int length; + int *tabs; +{ + register char *p, *ep; + register int tx, tab; + + tab = tx = 0; + for (p = string; length; ) + { + ep = strnchr(p, '\t', length); + if (ep && tabs) + { + XDrawString(display, drawable, gc, x+tx, y, + p, ep - p); + tx = tabs[tab++]; + length -= ep - p + 1; + p = ep + 1; + } + else + { + XDrawString(display, drawable, gc, x+tx, y, + p, length); + break; + } + } +} diff --git a/vendor/x11iraf/obm/ObmW/DrawingArea.c b/vendor/x11iraf/obm/ObmW/DrawingArea.c new file mode 100644 index 00000000..a316b03c --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/DrawingArea.c @@ -0,0 +1,193 @@ +/* + * A minimalistic constraint widget + * + * Sun Sep 12 20:03:49 GMT 1993 Gustaf Neumann + */ + +#ifndef MOTIF + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +/* +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xaw/XawInit.h> +*/ + +#include "DrawingAreaP.h" + +/* Private Definitions */ + +static void ClassInitialize(), ClassPartInitialize(), Initialize(), Resize(); +static void ConstraintInitialize(); +static Boolean SetValues(), ConstraintSetValues(); +static XtGeometryResult GeometryManager(), PreferredGeometry(); +static void ChangeManaged(); + +DrawingAreaClassRec drawingAreaClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) &constraintClassRec, + /* class_name */ "DrawingArea", + /* widget_size */ sizeof(DrawingAreaRec), + /* class_initialize */ ClassInitialize, + /* class_part_init */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ NULL, + /* num_resources */ 0, + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ XtInheritExpose, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ PreferredGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* composite_class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ NULL, /*ChangeManaged,*/ + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, + { /* constraint_class fields */ + /* subresourses */ NULL, + /* subresource_count */ 0, + /* constraint_size */ 0, + /* initialize */ NULL, /*ConstraintInitialize,*/ + /* destroy */ NULL, + /* set_values */ NULL, /*ConstraintSetValues,*/ + /* extension */ NULL + }, + { /* DrawingArea_class fields */ + /* dummy */ 0 + } +}; + +WidgetClass drawingAreaWidgetClass = (WidgetClass)&drawingAreaClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static void ClassInitialize() +{ +} + +static void ClassPartInitialize(class) + WidgetClass class; +{ +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ +/* + DrawingAreaWidget daw = (DrawingAreaWidget)new; +*/ +} + +static void Resize(w) + Widget w; +{ +/* + DrawingAreaWidget daw = (DrawingAreaWidget)w; + WidgetList children = daw->composite.children; + int num_children = daw->composite.num_children; + Widget *childP; + Position x, y; + Dimension width, height; +*/ +} + + +/* ARGSUSED */ +static XtGeometryResult GeometryManager(w, request, reply) + Widget w; + XtWidgetGeometry *request; + XtWidgetGeometry *reply; /* RETURN */ +{ +/* + Dimension old_width, old_height; + DrawingAreaWidget daw = (DrawingAreaWidget) XtParent(w); + DrawingAreaConstraints DrawingArea = (DrawingAreaConstraints) w->core.constraints; + XtWidgetGeometry allowed; + XtGeometryResult ret_val; +*/ + return(XtGeometryNo); +} + + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + return( FALSE ); +} + + +/*ARGSUSED*/ +static Boolean ConstraintSetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ +/* + register DrawingAreaConstraints cfc = + (DrawingAreaConstraints) current->core.constraints; + register DrawingAreaConstraints nfc = + (DrawingAreaConstraints) new->core.constraints; + */ + return( FALSE ); +} + +static void ChangeManaged(w) + Widget w; +{ +/* + DrawingAreaWidget daw = (DrawingAreaWidget)w; + DrawingAreaConstraints DrawingArea; + WidgetList children, childP; + int num_children = daw->composite.num_children; + Widget child; +*/ +} + + +static XtGeometryResult PreferredGeometry( widget, request, reply ) + Widget widget; + XtWidgetGeometry *request, *reply; +{ +/* + DrawingAreaWidget w = (DrawingAreaWidget)widget; + */ + return XtGeometryNo; +} + + + +#endif diff --git a/vendor/x11iraf/obm/ObmW/DrawingArea.h b/vendor/x11iraf/obm/ObmW/DrawingArea.h new file mode 100644 index 00000000..2d8938f4 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/DrawingArea.h @@ -0,0 +1,35 @@ +#ifndef _XawDrawingArea_h +#define _XawDrawingArea_h + +/* #include <X11/Constraint.h> */ +/*********************************************************************** + * + * DrawingArea Widget + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + defaultDistance Thickness int 4 + destroyCallback Callback Pointer NULL + height Height Dimension computed at realize + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension computed at realize + x Position Position 0 + y Position Position 0 + +*/ + + +typedef struct _DrawingAreaClassRec *DrawingAreaWidgetClass; +typedef struct _DrawingAreaRec *DrawingAreaWidget; + +extern WidgetClass drawingAreaWidgetClass; + +#endif /* _XawDrawingArea_h */ diff --git a/vendor/x11iraf/obm/ObmW/DrawingAreaP.h b/vendor/x11iraf/obm/ObmW/DrawingAreaP.h new file mode 100644 index 00000000..221f7180 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/DrawingAreaP.h @@ -0,0 +1,45 @@ + +/* DrawingArea widget private definitions */ + +#ifndef _XawDrawingAreaP_h +#define _XawDrawingAreaP_h + +#include "DrawingArea.h" +#include <X11/ConstrainP.h> + +#define XtInheritLayout ((Boolean (*)())_XtInherit) + +typedef struct { + int dummy; +} DrawingAreaClassPart; + + +typedef struct _DrawingAreaClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + DrawingAreaClassPart drawingArea_class; +} DrawingAreaClassRec; + +extern DrawingAreaClassRec drawingAreaClassRec; + +typedef struct _DrawingAreaPart { + int dummy; +} DrawingAreaPart; + +typedef struct _DrawingAreaRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + DrawingAreaPart drawingArea; +} DrawingAreaRec; + +typedef struct _DrawingAreaConstraintsPart { + int dummy; +} DrawingAreaConstraintsPart; + +typedef struct _DrawingAreaConstraintsRec { + int dummy; +} DrawingAreaConstraintsRec, *DrawingAreaConstraints; + +#endif /* _XawDrawingAreaP_h */ diff --git a/vendor/x11iraf/obm/ObmW/FIXFWF b/vendor/x11iraf/obm/ObmW/FIXFWF new file mode 100755 index 00000000..23d97fa9 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/FIXFWF @@ -0,0 +1,6 @@ +#! /bin/csh +# -- Used to massage FWF widgets to fit the OBM directory structure. + +foreach i (`grep -l Xfwf *.[ch]`) + echo $i; sed -f FWFSED $i > temp; mv temp $i +end diff --git a/vendor/x11iraf/obm/ObmW/FWFSED b/vendor/x11iraf/obm/ObmW/FWFSED new file mode 100644 index 00000000..97092e37 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/FWFSED @@ -0,0 +1,17 @@ +s+<Xfwf/\(.*\)>+"\1"+ +/^#line /D +s/"XfwfArrow"/"XfwfArrow"/ +s/"XfwfBoard"/"Board"/ +s/"XfwfButton"/"TextButton"/ +s/"XfwfCommon"/"XfwfCommon"/ +s/"XfwfFrame"/"Frame"/ +s/"XfwfGroup"/"Group"/ +s/"XfwfIcon"/"Icon"/ +s/"XfwfLabel"/"TextBox"/ +s/"XfwfMenuBar"/"XfwfMenuBar"/ +s/"XfwfMultiList"/"MultiList"/ +s/"XfwfRadioGroup"/"RadioGroup"/ +s/"XfwfRowCol"/"RowCol"/ +s/"XfwfScrollbar"/"Scrollbar2"/ +s/"XfwfSlider2"/"Slider2d"/ +s/"XfwfToggle"/"TextToggle"/ diff --git a/vendor/x11iraf/obm/ObmW/Frame.c b/vendor/x11iraf/obm/ObmW/Frame.c new file mode 100644 index 00000000..47080b53 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Frame.c @@ -0,0 +1,654 @@ +/* Generated by wbuild from "Frame.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <string.h> +#include <stdio.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/CharSet.h> +#include "stip4.bm" +#include "FrameP.h" +static void set_shadow( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"set_shadow", set_shadow}, +}; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void class_initialize( +#if NeedFunctionPrototypes +void +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void realize( +#if NeedFunctionPrototypes +Widget,XtValueMask *,XSetWindowAttributes * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void compute_inside( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +static XtGeometryResult query_geometry( +#if NeedFunctionPrototypes +Widget,XtWidgetGeometry *,XtWidgetGeometry * +#endif +); +static XtGeometryResult geometry_manager( +#if NeedFunctionPrototypes +Widget ,XtWidgetGeometry *,XtWidgetGeometry * +#endif +); +static void resize( +#if NeedFunctionPrototypes +Widget +#endif +); +static void change_managed( +#if NeedFunctionPrototypes +Widget +#endif +); +#define done(type, value) do {\ + if (to->addr != NULL) {\ + if (to->size < sizeof(type)) {\ + to->size = sizeof(type);\ + return False;\ + }\ + *(type*)(to->addr) = (value);\ + } else {\ + static type static_val;\ + static_val = (value);\ + to->addr = (XtPointer)&static_val;\ + }\ + to->size = sizeof(type);\ + return True;\ + }while (0 ) + + +static char rcsid[] = "$Header: Frame.w,v 1.5 92/11/02 14:07:52 bert Exp $"; +static void create_darkgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_lightgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void compute_topcolor( +#if NeedFunctionPrototypes +Widget,int ,XrmValue * +#endif +); +static void compute_bottomcolor( +#if NeedFunctionPrototypes +Widget,int ,XrmValue * +#endif +); +/*ARGSUSED*/static void create_darkgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfFrameWidget)self)->xfwfFrame.darkgc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.darkgc); + switch (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple; + values.foreground = BlackPixelOfScreen(XtScreen(self)); + values.background = ((XfwfFrameWidget)self)->core.background_pixel; + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen(self)) > 4 + && ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfFrameWidget)self)->core.background_pixel; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4; + } + break; + } + ((XfwfFrameWidget)self)->xfwfFrame.darkgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_lightgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfFrameWidget)self)->xfwfFrame.lightgc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.lightgc); + switch (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = ((XfwfFrameWidget)self)->xfwfFrame.topShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfFrameWidget)self)->core.background_pixel; + values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen(self)) > 4 + && ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfFrameWidget)self)->core.background_pixel; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4; + } + break; + } + ((XfwfFrameWidget)self)->xfwfFrame.lightgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void compute_topcolor(self,offset,value)Widget self;int offset;XrmValue * value; +{ + static Pixel color; + ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &color); + value->addr = (XtPointer) &color; +} +/*ARGSUSED*/static void compute_bottomcolor(self,offset,value)Widget self;int offset;XrmValue * value; +{ + static Pixel color; + ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &color); + value->addr = (XtPointer) &color; +} + +static XtResource resources[] = { +{XtNcursor,XtCCursor,XtRCursor,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.cursor),XtOffsetOf(XfwfFrameRec,xfwfFrame.cursor),XtRImmediate,(XtPointer)None }, +{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfFrameRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfRaised }, +{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfFrameRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)0 }, +{XtNouterOffset,XtCOuterOffset,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.outerOffset),XtOffsetOf(XfwfFrameRec,xfwfFrame.outerOffset),XtRImmediate,(XtPointer)0 }, +{XtNinnerOffset,XtCInnerOffset,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.innerOffset),XtOffsetOf(XfwfFrameRec,xfwfFrame.innerOffset),XtRImmediate,(XtPointer)0 }, +{XtNshadowScheme,XtCShadowScheme,XtRShadowScheme,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.shadowScheme),XtOffsetOf(XfwfFrameRec,xfwfFrame.shadowScheme),XtRImmediate,(XtPointer)XfwfAuto }, +{XtNtopShadowColor,XtCTopShadowColor,XtRPixel,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.topShadowColor),XtOffsetOf(XfwfFrameRec,xfwfFrame.topShadowColor),XtRCallProc,(XtPointer)compute_topcolor }, +{XtNbottomShadowColor,XtCBottomShadowColor,XtRPixel,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.bottomShadowColor),XtOffsetOf(XfwfFrameRec,xfwfFrame.bottomShadowColor),XtRCallProc,(XtPointer)compute_bottomcolor }, +{XtNtopShadowStipple,XtCTopShadowStipple,XtRBitmap,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.topShadowStipple),XtOffsetOf(XfwfFrameRec,xfwfFrame.topShadowStipple),XtRImmediate,(XtPointer)NULL }, +{XtNbottomShadowStipple,XtCBottomShadowStipple,XtRBitmap,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.bottomShadowStipple),XtOffsetOf(XfwfFrameRec,xfwfFrame.bottomShadowStipple),XtRImmediate,(XtPointer)NULL }, +{XtNborderWidth,XtCBorderWidth,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->core.border_width),XtOffsetOf(XfwfFrameRec,core.border_width),XtRImmediate,(XtPointer)0 }, +}; + +XfwfFrameClassRec xfwfFrameClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfCommonClassRec, +"Frame", +sizeof(XfwfFrameRec), +class_initialize, +_resolve_inheritance, +FALSE, +initialize, +NULL, +realize, +actionsList, +1, +resources, +11, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +resize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +query_geometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +geometry_manager, +change_managed, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +}; +WidgetClass xfwfFrameWidgetClass = (WidgetClass) &xfwfFrameClassRec; +/*ARGSUSED*/ +static void set_shadow(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + Position x, y; + Dimension w, h; + FrameType f = XfwfSunken; + + if (*num_params == 0) f = ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type; /* Reset to old style */ + else if (strcmp("raised", params[0]) == 0) f = XfwfRaised; + else if (strcmp("sunken", params[0]) == 0) f = XfwfSunken; + else if (strcmp("chiseled", params[0]) == 0) f = XfwfChiseled; + else if (strcmp("ledged", params[0]) == 0) f = XfwfLedged; + else XtWarning("Unknown frame type in set_shadow action"); + + if (((XfwfFrameWidget)self)->xfwfFrame.frameType != f) { + ((XfwfFrameWidget)self)->xfwfFrame.frameType = f; + xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + XfwfDrawFrame(self, x + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, y + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, + w - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset, h - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset, + ((XfwfFrameWidget)self)->xfwfFrame.frameType, ((XfwfFrameWidget)self)->xfwfFrame.frameWidth, ((XfwfFrameWidget)self)->xfwfFrame.lightgc, ((XfwfFrameWidget)self)->xfwfFrame.darkgc); + } +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfFrameWidgetClass c = (XfwfFrameWidgetClass) class; + XfwfFrameWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfFrameWidgetClass) return; + super = (XfwfFrameWidgetClass)class->core_class.superclass; +} +/*ARGSUSED*/static void class_initialize() +{ + static XtConvertArgRec screenArg[] = { + {XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen*)}}; + + XtSetTypeConverter(XtRString, XtRFrameType, cvtStringToFrameType, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRFrameType, XtRString, cvtFrameTypeToString, + NULL, 0, XtCacheNone, NULL); + + XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap, + screenArg, XtNumber(screenArg)); + + XtSetTypeConverter(XtRString, XtRShadowScheme, cvtStringToShadowScheme, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRShadowScheme, XtRString, cvtShadowSchemeToString, + NULL, 0, XtCacheNone, NULL); +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + ((XfwfFrameWidget)self)->xfwfFrame.lightgc = NULL; + ((XfwfFrameWidget)self)->xfwfFrame.darkgc = NULL; + ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type = ((XfwfFrameWidget)self)->xfwfFrame.frameType; +} +/*ARGSUSED*/static void realize(self,mask,attributes)Widget self;XtValueMask * mask;XSetWindowAttributes * attributes; +{ +#ifdef USE_CWCURSOR + *mask |= CWCursor; +#endif + attributes->cursor = ((XfwfFrameWidget)self)->xfwfFrame.cursor; + xfwfCommonClassRec.core_class.realize(self, mask, attributes); + + ((XfwfFrameWidget)self)->xfwfFrame.stip4 = XCreateBitmapFromData(XtDisplay(self), XtWindow(self), + stip4_bits, stip4_width, stip4_height); + + if (! ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple) ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4; + if (! ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple) ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4; + + create_lightgc(self); + create_darkgc(self); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redisplay = False; + + if (((XfwfFrameWidget)self)->xfwfFrame.cursor != ((XfwfFrameWidget)old)->xfwfFrame.cursor && XtIsRealized(self)) + XDefineCursor(XtDisplay(self), XtWindow(self), ((XfwfFrameWidget)self)->xfwfFrame.cursor); + + if (((XfwfFrameWidget)self)->xfwfFrame.frameType == XfwfChiseled || ((XfwfFrameWidget)self)->xfwfFrame.frameType == XfwfLedged) + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth = 2 * ((int) (((XfwfFrameWidget)self)->xfwfFrame.frameWidth / 2)); + + if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme != ((XfwfFrameWidget)old)->xfwfFrame.shadowScheme) { + create_darkgc(self); + create_lightgc(self); + need_redisplay = True; + } else if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme == XfwfColor) { + if (((XfwfFrameWidget)self)->xfwfFrame.topShadowColor != ((XfwfFrameWidget)old)->xfwfFrame.topShadowColor) { + create_lightgc(self); + need_redisplay = True; + } + if (((XfwfFrameWidget)self)->xfwfFrame.bottomShadowColor != ((XfwfFrameWidget)old)->xfwfFrame.bottomShadowColor) { + create_darkgc(self); + need_redisplay = True; + } + } else if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme == XfwfStipple) { + if (((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple != ((XfwfFrameWidget)old)->xfwfFrame.topShadowStipple) { + create_lightgc(self); + need_redisplay = True; + } + if (((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple != ((XfwfFrameWidget)old)->xfwfFrame.bottomShadowStipple) { + create_darkgc(self); + need_redisplay = True; + } + } + + if (((XfwfFrameWidget)self)->xfwfFrame.outerOffset != ((XfwfFrameWidget)old)->xfwfFrame.outerOffset) + need_redisplay = True; + + if (((XfwfFrameWidget)self)->xfwfFrame.innerOffset != ((XfwfFrameWidget)old)->xfwfFrame.innerOffset) + need_redisplay = True; + + if (((XfwfFrameWidget)self)->xfwfFrame.frameType != ((XfwfFrameWidget)old)->xfwfFrame.frameType) { + ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type = ((XfwfFrameWidget)self)->xfwfFrame.frameType; + need_redisplay = True; + } + + if (((XfwfFrameWidget)self)->xfwfFrame.frameWidth != ((XfwfFrameWidget)old)->xfwfFrame.frameWidth) + need_redisplay = True; + else if (((XfwfFrameWidget)self)->xfwfFrame.frameWidth == 0) + need_redisplay = False; + + return need_redisplay; +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + Position x, y; + Dimension w, h; + + if (! XtIsRealized(self)) return; + if (region != NULL) { + XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.lightgc, region); + XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.darkgc, region); + } + xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + XfwfDrawFrame(self, x + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, y + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, w - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset, + h - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset, ((XfwfFrameWidget)self)->xfwfFrame.frameType, ((XfwfFrameWidget)self)->xfwfFrame.frameWidth, ((XfwfFrameWidget)self)->xfwfFrame.lightgc, ((XfwfFrameWidget)self)->xfwfFrame.darkgc); + if (region != NULL) { + XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.lightgc, None); + XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.darkgc, None); + } + xfwfCommonClassRec.core_class.expose(self, event, region); +} +/*ARGSUSED*/static void compute_inside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h; +{ + int ww, hh; /* DCT */ + + xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, x, y, w, h); + *x += ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset; + *y += ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset; + + /* 17Mar94 DCT - keep w,h from wrapping around to 65xxxx. */ + +/* For reasons which are not clear avoiding wrap-around here causes + * geometry management to fail in some circumstances while determining the + * initial frame size during startup. + * + * ww = *w; + * *w = max (0, ww - 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + + * ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + + * ((XfwfFrameWidget)self)->xfwfFrame.innerOffset)); + * hh = *h; + * *h = max (0, hh - 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + + * ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + + * ((XfwfFrameWidget)self)->xfwfFrame.innerOffset)); + */ + *w -= 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset); + *h -= 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset); +} + +/*ARGSUSED*/static XtGeometryResult query_geometry(self,request,reply)Widget self;XtWidgetGeometry * request;XtWidgetGeometry * reply; +{ + XtWidgetGeometry request2, reply2; + XtGeometryResult result; + Dimension h; + + if (((XfwfFrameWidget)self)->composite.num_children == 0) return XtGeometryYes; + + /* We're only interested in size and stacking order */ + reply->request_mode = + (CWWidth | CWHeight | CWStackMode) & request->request_mode; + + /* If nothing of interest is left, we can return immediately */ + if (reply->request_mode == 0) + return XtGeometryYes; + + /* Prepare a request to the child */ + h = 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset); + request2.request_mode = reply->request_mode; + request2.width = request->width - h; + request2.height = request->height - h; + request2.sibling = request->sibling; + request2.stack_mode = request->stack_mode; + + result = XtQueryGeometry(((XfwfFrameWidget)self)->composite.children[0], &request2, &reply2); + + /* If the child accepted its proposal, we accept ours */ + if (result == XtGeometryYes) return XtGeometryYes; + + /* If the child doesn't want any change, we don't want any, either */ + if (result == XtGeometryNo) return XtGeometryNo; + + /* Otherwise, ignore everything but size and stacking order */ + reply->request_mode &= reply2.request_mode; + if (reply->request_mode == 0) return XtGeometryYes; + + reply->width = reply2.width + h; + reply->height = reply2.height + h; + reply->sibling = reply2.sibling; + reply->stack_mode = reply2.stack_mode; + return XtGeometryAlmost; +} +/*ARGSUSED*/static XtGeometryResult geometry_manager(child,request,reply)Widget child;XtWidgetGeometry * request;XtWidgetGeometry * reply; +{ Widget self = XtParent(child); { + XtWidgetGeometry request2, reply2; + XtGeometryResult result; + Position x, y; + Dimension w, h, extraw, extrah; + + ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + if (! (request->request_mode & (CWWidth|CWHeight))) return XtGeometryYes; + extraw = ((XfwfFrameWidget)self)->core.width - w; + extrah = ((XfwfFrameWidget)self)->core.height - h; + request2.request_mode = request->request_mode & (CWWidth|CWHeight); + request2.width = request->width + extraw; + request2.height = request->height + extrah; + result = XtMakeGeometryRequest(self, &request2, &reply2); + if (result == XtGeometryNo) return XtGeometryNo; + if (result == XtGeometryYes) return XtGeometryYes; + reply->request_mode = reply2.request_mode & (CWWidth|CWHeight); + reply->width = reply2.width - extraw; + reply->height = reply2.height - extrah; + return XtGeometryAlmost; +} +} +/*ARGSUSED*/static void resize(self)Widget self; +{ + Position x, y; + Dimension w, h; + Widget child; + + if (((XfwfFrameWidget)self)->composite.num_children == 0) return; + ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + child = ((XfwfFrameWidget)self)->composite.children[0]; + w -= 2 * ((XfwfFrameWidget)child)->core.border_width; + h -= 2 * ((XfwfFrameWidget)child)->core.border_width; + XtConfigureWidget(child, x, y, w, h, ((XfwfFrameWidget)child)->core.border_width); +} +/*ARGSUSED*/static void change_managed(self)Widget self; +{ + XtWidgetGeometry request2, reply2; + XtGeometryResult result; + Widget child; + Position x, y; + Dimension w, h; + + if (((XfwfFrameWidget)self)->composite.num_children == 0) return; + ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + child = ((XfwfFrameWidget)self)->composite.children[0]; + request2.request_mode = CWWidth | CWHeight; + request2.width = ((XfwfFrameWidget)child)->core.width + ((XfwfFrameWidget)self)->core.width - w; + request2.height = ((XfwfFrameWidget)child)->core.height + ((XfwfFrameWidget)self)->core.height - h; + result = XtMakeGeometryRequest(self, &request2, &reply2); + ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + w -= 2 * ((XfwfFrameWidget)child)->core.border_width; + h -= 2 * ((XfwfFrameWidget)child)->core.border_width; + XtConfigureWidget(child, x, y, w, h, ((XfwfFrameWidget)child)->core.border_width); +} +/*ARGSUSED*/void XfwfDrawFrame(self,x,y,w,h,tp,t,lightgc,darkgc)Widget self;int x;int y;int w;int h;FrameType tp;int t;GC lightgc;GC darkgc; +{ + XPoint tlPoints[7], brPoints[7]; + + if (t == 0) return; + switch (tp) { + case XfwfRaised: + case XfwfSunken: + tlPoints[0].x = x; tlPoints[0].y = y; + tlPoints[1].x = x + w; tlPoints[1].y = y; + tlPoints[2].x = x + w - t; tlPoints[2].y = y + t; + tlPoints[3].x = x + t; tlPoints[3].y = y + t; + tlPoints[4].x = x + t; tlPoints[4].y = y + h - t; + tlPoints[5].x = x; tlPoints[5].y = y + h; + tlPoints[6].x = x; tlPoints[6].y = y; + brPoints[0].x = x + w; brPoints[0].y = y + h; + brPoints[1].x = x; brPoints[1].y = y + h; + brPoints[2].x = x + t; brPoints[2].y = y + h - t; + brPoints[3].x = x + w - t; brPoints[3].y = y + h - t; + brPoints[4].x = x + w - t; brPoints[4].y = y + t; + brPoints[5].x = x + w; brPoints[5].y = y; + brPoints[6].x = x + w; brPoints[6].y = y + h; + if (tp == XfwfSunken) { + XFillPolygon(XtDisplay(self), XtWindow(self), + darkgc, tlPoints, 7, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplay(self), XtWindow(self), + lightgc, brPoints, 7, Nonconvex, CoordModeOrigin); + } else { + XFillPolygon(XtDisplay(self), XtWindow(self), + lightgc, tlPoints, 7, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplay(self), XtWindow(self), + darkgc, brPoints, 7, Nonconvex, CoordModeOrigin); + } + break; + case XfwfLedged: + XfwfDrawFrame(self, x, y, w, h, XfwfRaised, t/2, lightgc, darkgc); + XfwfDrawFrame(self, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2), + XfwfSunken, t/2, lightgc, darkgc); + break; + case XfwfChiseled: + XfwfDrawFrame(self, x, y, w, h, XfwfSunken, t/2, lightgc, darkgc); + XfwfDrawFrame(self, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2), + XfwfRaised, t/2, lightgc, darkgc); + break; + } + +} +/*ARGSUSED*/Boolean cvtStringToFrameType(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToFrameType", "wrongParameters", + "XtToolkitError", + "String to frame type conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "raised") == 0) done(FrameType, XfwfRaised); + if (XmuCompareISOLatin1(s, "sunken") == 0) done(FrameType, XfwfSunken); + if (XmuCompareISOLatin1(s, "chiseled") == 0) done(FrameType, XfwfChiseled); + if (XmuCompareISOLatin1(s, "ledged") == 0) done(FrameType, XfwfLedged); + XtDisplayStringConversionWarning(display, s, XtRFrameType); + done(FrameType, XfwfRaised); +} +/*ARGSUSED*/Boolean cvtFrameTypeToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtFrameTypeToString", "wrongParameters", + "XtToolkitError", + "Fframe type to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*(FrameType*)from->addr) { + case XfwfRaised: done(String, "raised"); + case XfwfSunken: done(String, "sunken"); + case XfwfChiseled: done(String, "chiseled"); + case XfwfLedged: done(String, "ledged"); + default: XtError("Illegal FrameType"); + } +} +/*ARGSUSED*/Boolean cvtStringToShadowScheme(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToShadowScheme", "wrongParameters", + "XtToolkitError", + "String to shadow scheme conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "auto")==0) done(ShadowScheme, XfwfAuto); + if (XmuCompareISOLatin1(s, "color")==0) done(ShadowScheme, XfwfColor); + if (XmuCompareISOLatin1(s, "stipple")==0) done(ShadowScheme, XfwfStipple); + XtDisplayStringConversionWarning(display, s, XtRShadowScheme); + done(ShadowScheme, XfwfAuto); +} +/*ARGSUSED*/Boolean cvtShadowSchemeToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtShadowSchemeToString", "wrongParameters", + "XtToolkitError", + "Shadow scheme to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + switch (*(ShadowScheme*)from->addr) { + case XfwfAuto: done(String, "auto"); + case XfwfColor: done(String, "color"); + case XfwfStipple: done(String, "stipple"); + default: XtError("Illegal ShadowScheme"); + } +} diff --git a/vendor/x11iraf/obm/ObmW/Frame.h b/vendor/x11iraf/obm/ObmW/Frame.h new file mode 100644 index 00000000..eafe109c --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Frame.h @@ -0,0 +1,142 @@ +/* Generated by wbuild from "Frame.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfFrame_H_ +#define _XfwfFrame_H_ +#include "Common.h" +typedef enum { + XfwfRaised, XfwfSunken, XfwfChiseled, XfwfLedged } FrameType; + +typedef enum {XfwfAuto, XfwfColor, XfwfStipple} ShadowScheme; + +typedef Pixmap Bitmap; + +void XfwfDrawFrame( +#if NeedFunctionPrototypes +Widget,int ,int ,int ,int ,FrameType ,int ,GC ,GC +#endif +); +Boolean cvtStringToFrameType( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +Boolean cvtFrameTypeToString( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +Boolean cvtStringToShadowScheme( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +Boolean cvtShadowSchemeToString( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +#ifndef XtNcursor +#define XtNcursor "cursor" +#endif +#ifndef XtCCursor +#define XtCCursor "Cursor" +#endif +#ifndef XtRCursor +#define XtRCursor "Cursor" +#endif + +#ifndef XtNframeType +#define XtNframeType "frameType" +#endif +#ifndef XtCFrameType +#define XtCFrameType "FrameType" +#endif +#ifndef XtRFrameType +#define XtRFrameType "FrameType" +#endif + +#ifndef XtNframeWidth +#define XtNframeWidth "frameWidth" +#endif +#ifndef XtCFrameWidth +#define XtCFrameWidth "FrameWidth" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNouterOffset +#define XtNouterOffset "outerOffset" +#endif +#ifndef XtCOuterOffset +#define XtCOuterOffset "OuterOffset" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNinnerOffset +#define XtNinnerOffset "innerOffset" +#endif +#ifndef XtCInnerOffset +#define XtCInnerOffset "InnerOffset" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNshadowScheme +#define XtNshadowScheme "shadowScheme" +#endif +#ifndef XtCShadowScheme +#define XtCShadowScheme "ShadowScheme" +#endif +#ifndef XtRShadowScheme +#define XtRShadowScheme "ShadowScheme" +#endif + +#ifndef XtNtopShadowColor +#define XtNtopShadowColor "topShadowColor" +#endif +#ifndef XtCTopShadowColor +#define XtCTopShadowColor "TopShadowColor" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNbottomShadowColor +#define XtNbottomShadowColor "bottomShadowColor" +#endif +#ifndef XtCBottomShadowColor +#define XtCBottomShadowColor "BottomShadowColor" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNtopShadowStipple +#define XtNtopShadowStipple "topShadowStipple" +#endif +#ifndef XtCTopShadowStipple +#define XtCTopShadowStipple "TopShadowStipple" +#endif +#ifndef XtRBitmap +#define XtRBitmap "Bitmap" +#endif + +#ifndef XtNbottomShadowStipple +#define XtNbottomShadowStipple "bottomShadowStipple" +#endif +#ifndef XtCBottomShadowStipple +#define XtCBottomShadowStipple "BottomShadowStipple" +#endif +#ifndef XtRBitmap +#define XtRBitmap "Bitmap" +#endif + +typedef struct _XfwfFrameClassRec *XfwfFrameWidgetClass; +typedef struct _XfwfFrameRec *XfwfFrameWidget; +externalref WidgetClass xfwfFrameWidgetClass; +#endif /*_XfwfFrame_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Frame.man b/vendor/x11iraf/obm/ObmW/Frame.man new file mode 100644 index 00000000..66fdb4c3 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Frame.man @@ -0,0 +1,1062 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfFrame +.SH DESCRIPTION +The Frame widget is a composite widget that accepts just one child. +Its only purpose is to draw a frame around widgets that do not have a +frame of their own. It always uses the size of its child, with a +little extra for the frame. There are several types of frames +available, selectable with a resource. + +Widget writers can also use the Frame class as a superclass for new +widgets. The frame is drawn by the \fIexpose\fP method (which must +therefore be called by subclasses). Its width is given by +\fIXtNframeWidth\fP, the appearance by \fIXtNframeType\fP. The possible types +are: + +\item{\fIXfwfRaised\fP} Gives a beveled look. The top and left borders will +be lighter, the bottom and right sides darker. + +\item{\fIXfwfSunken\fP} Just the opposite. + +\item{\fIXfwfChiseled\fP} The border will look as if it was made with a +chisel. + +\item{\fIXfwfLedged\fP} The border will be a ledge that juts out of the +background. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.TP +.I "XtNcursor" +The cursor (when not \fINone\fP) is the mouse cursor that is displayed +when the mouse is over the Board widget. The default value \fINone\fP +causes the parent's cursor to be used. + + + +.hi + +.nf +Cursor cursor = None +.fi + +.eh + +.TP +.I "XtNframeType" +The \fIXtNframeType\fP determines how the border looks. + + + +.hi + +.nf +FrameType frameType = XfwfRaised +.fi + +.eh + +.TP +.I "XtNframeWidth" +\fIXtNframeWidth\fP gives the width of the border. The default value +of 0 shows no border at all. The border is drawn {\it inside\/} the +widget. (See also \fIXtNouterOffset\fP.) + + + +.hi + +.nf +Dimension frameWidth = 0 +.fi + +.eh + +.TP +.I "XtNouterOffset" +Normally, the border is draw along the outer edge of the widget, but +it can be moved inward. \fIXtNouterOffset\fP is the number of pixels +between the edge and the frame. + + + +.hi + +.nf +Dimension outerOffset = 0 +.fi + +.eh + +.TP +.I "XtNinnerOffset" +Between the frame and whatever is inside the widget, there is also +margin. By default, however, it is 0. + + + +.hi + +.nf +Dimension innerOffset = 0 +.fi + +.eh + +.TP +.I "XtNshadowScheme" +The colors of the top and bottom shadows can be set with the +resources \fItopShadowColor\fP and \fIbottomShadowColor\fP, but it is also +possible to use a stiple of foreground and background colors. This may +be preferable on workstations with limited or no color capabilities. +However, the easiest way (which is also the default) is to let the +widget determine its own shadow colors or stipples, based on the +widget's background color and the color capabilities of the screen. + +The resource \fIshadowScheme\fP can be set to \fIXfwfColor\fP, \fIXfwfStipple\fP +or \fIXfwfAuto\fP. The converter for the shadow pixmap accepts the strings +\fI"stipple0"\fP through \fI"stipple8"\fP, which create pixmaps of the current +background and foreground colors, with \fI"stipple0"\fP entirely +background and \fI"stipple8"\fP entirely foreground. Setting pixmaps or +colors is only useful when \fIshadowScheme\fP is set to \fIXfwfStipple\fP or +\fIXfwfColor\fP respectively. + +The values of \fItopShadowColor\fP and \fIbottomShadowColor\fP are ignored by +the Frame widget as long as \fIshadowScheme\fP is not \fIXfwfColor\fP, but the +default values are computed nevertheless, since they are useful, e.g., +when an icon uses `topShadowColor' and `bottomShadowColor' as dynamic +colors. + + + +.hi + +.nf +ShadowScheme shadowScheme = XfwfAuto +.fi + +.eh + +.TP +.I "XtNtopShadowColor" + +.hi + +.nf +Pixel topShadowColor = <CallProc>compute_topcolor +.fi + +.eh + +.TP +.I "XtNbottomShadowColor" + +.hi + +.nf +Pixel bottomShadowColor = <CallProc>compute_bottomcolor +.fi + +.eh + +.TP +.I "XtNtopShadowStipple" + +.hi + +.nf +Bitmap topShadowStipple = NULL +.fi + +.eh + +.TP +.I "XtNbottomShadowStipple" + +.hi + +.nf +Bitmap bottomShadowStipple = NULL +.fi + +.eh + +.TP +.I "XtNborder_width" +The inherited resource \fIborderWidth\fP is given a default value of 0, +instead of 1. + + + +.hi + +.nf + border_width = 0 +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +A number of new types is introduced by the Common class. The +possible types of borders are enumerated in \fIFrame3dType\fP (see the +introduction). + + + +.nf + +.B type + FrameType = enum { + XfwfRaised, XfwfSunken, XfwfChiseled, XfwfLedged } +.fi + +The shadow scheme can be used to choose colors, pixmaps or automatic +shadows. + + + +.nf + +.B type + ShadowScheme = enum {XfwfAuto, XfwfColor, XfwfStipple} +.fi + +The type \fIBitmap\fP is an alias for \fIPixmap\fP, but it is meant to +contain only bitmaps, i.e., pixmaps of depth one. + + + +.nf + +.B type + Bitmap = Pixmap +.fi + +The routine that draws the border is generally useful, so it is +exported. \fIt\fP is the thickness of the frame. The frame is drawn inside +the rectangle \fI(x, y, x+w-1, y+h-1)\fP. + +.nf +XfwfDrawFrame( $, int x, int y, int w, int h, FrameType tp, int t, GC lightgc, GC darkgc) +.fi + +.hi +{ + XPoint tlPoints[7], brPoints[7]; + + if (t == 0) return; + switch (tp) { + case XfwfRaised: + case XfwfSunken: + tlPoints[0].x = x; tlPoints[0].y = y; + tlPoints[1].x = x + w; tlPoints[1].y = y; + tlPoints[2].x = x + w - t; tlPoints[2].y = y + t; + tlPoints[3].x = x + t; tlPoints[3].y = y + t; + tlPoints[4].x = x + t; tlPoints[4].y = y + h - t; + tlPoints[5].x = x; tlPoints[5].y = y + h; + tlPoints[6].x = x; tlPoints[6].y = y; + brPoints[0].x = x + w; brPoints[0].y = y + h; + brPoints[1].x = x; brPoints[1].y = y + h; + brPoints[2].x = x + t; brPoints[2].y = y + h - t; + brPoints[3].x = x + w - t; brPoints[3].y = y + h - t; + brPoints[4].x = x + w - t; brPoints[4].y = y + t; + brPoints[5].x = x + w; brPoints[5].y = y; + brPoints[6].x = x + w; brPoints[6].y = y + h; + if (tp == XfwfSunken) { + XFillPolygon(XtDisplay($), XtWindow($), + darkgc, tlPoints, 7, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplay($), XtWindow($), + lightgc, brPoints, 7, Nonconvex, CoordModeOrigin); + } else { + XFillPolygon(XtDisplay($), XtWindow($), + lightgc, tlPoints, 7, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplay($), XtWindow($), + darkgc, brPoints, 7, Nonconvex, CoordModeOrigin); + } + break; + case XfwfLedged: + XfwfDrawFrame($, x, y, w, h, XfwfRaised, t/2, lightgc, darkgc); + XfwfDrawFrame($, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2), + XfwfSunken, t/2, lightgc, darkgc); + break; + case XfwfChiseled: + XfwfDrawFrame($, x, y, w, h, XfwfSunken, t/2, lightgc, darkgc); + XfwfDrawFrame($, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2), + XfwfRaised, t/2, lightgc, darkgc); + break; + } + +} +.eh + +\fIcvtStringToFrameType\fP converts the strings `raised', `sunken', +`chiseled' and `ledged'. Case doesn't matter. + +.nf +Boolean cvtStringToFrameType(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +.fi + +.hi +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToFrameType", "wrongParameters", + "XtToolkitError", + "String to frame type conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "raised") == 0) done(FrameType, XfwfRaised); + if (XmuCompareISOLatin1(s, "sunken") == 0) done(FrameType, XfwfSunken); + if (XmuCompareISOLatin1(s, "chiseled") == 0) done(FrameType, XfwfChiseled); + if (XmuCompareISOLatin1(s, "ledged") == 0) done(FrameType, XfwfLedged); + XtDisplayStringConversionWarning(display, s, XtRFrameType); + done(FrameType, XfwfRaised); +} +.eh + +.nf +Boolean cvtFrameTypeToString(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +.fi + +.hi +{ + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtFrameTypeToString", "wrongParameters", + "XtToolkitError", + "Fframe type to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*(FrameType*)from->addr) { + case XfwfRaised: done(String, "raised"); + case XfwfSunken: done(String, "sunken"); + case XfwfChiseled: done(String, "chiseled"); + case XfwfLedged: done(String, "ledged"); + default: XtError("Illegal FrameType"); + } +} +.eh + +The converter \fIcvtStringToShadowScheme\fP converts strings `color', +`auto' and `stipple' to \fIXfwfColor\fP, \fIXfwfAuto\fP and \fIXfwfStipple\fP. + +.nf +Boolean cvtStringToShadowScheme(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +.fi + +.hi +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToShadowScheme", "wrongParameters", + "XtToolkitError", + "String to shadow scheme conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "auto")==0) done(ShadowScheme, XfwfAuto); + if (XmuCompareISOLatin1(s, "color")==0) done(ShadowScheme, XfwfColor); + if (XmuCompareISOLatin1(s, "stipple")==0) done(ShadowScheme, XfwfStipple); + XtDisplayStringConversionWarning(display, s, XtRShadowScheme); + done(ShadowScheme, XfwfAuto); +} +.eh + +.nf +Boolean cvtShadowSchemeToString(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +.fi + +.hi +{ + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtShadowSchemeToString", "wrongParameters", + "XtToolkitError", + "Shadow scheme to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + switch (*(ShadowScheme*)from->addr) { + case XfwfAuto: done(String, "auto"); + case XfwfColor: done(String, "color"); + case XfwfStipple: done(String, "stipple"); + default: XtError("Illegal ShadowScheme"); + } +} +.eh + +.hi +.SS "Actions" + +.TP +.I "set_shadow + +Although the Frame widget has no translations, one action is +defined, that may be of use to subclasses. The action function +\fIset_shadow\fP can be used to change the shadow frame. It has zero or +one argument. Without an argument, it resets the shadow to its +original type; with an argument, it sets the shadow to the type given +in the argument. + +Warning: the function uses the \fIXfwfDrawFrame\fP routine to draw the +frames directly, instead of calling the \fIexpose\fP or even \fIset_values\fP +methods. Any subclass that defines behaviour that depends on knowing +the frame type, will have to redefine the \fIset_shadow\fP action. + +.hi + +.nf +void set_shadow($, XEvent* event, String* params, Cardinal* num_params) +{ + Position x, y; + Dimension w, h; + FrameType f = XfwfSunken; + + if (*num_params == 0) f = $old_frame_type; /* Reset to old style */ + else if (strcmp("raised", params[0]) == 0) f = XfwfRaised; + else if (strcmp("sunken", params[0]) == 0) f = XfwfSunken; + else if (strcmp("chiseled", params[0]) == 0) f = XfwfChiseled; + else if (strcmp("ledged", params[0]) == 0) f = XfwfLedged; + else XtWarning("Unknown frame type in set_shadow action"); + + if ($frameType != f) { + $frameType = f; + #compute_inside($, x, y, w, h); + XfwfDrawFrame($, x + $outerOffset, y + $outerOffset, + w - 2*$outerOffset, h - 2*$outerOffset, + $frameType, $frameWidth, $lightgc, $darkgc); + } +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +.nf + +.B incl + <string.h> +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.nf + +.B incl + <X11/Xmu/Converters.h> +.fi + +.nf + +.B incl + <X11/Xmu/CharSet.h> +.fi + +The stipple for the shadows is loaded from a bitmap file. + +.nf + +.B incl + "stip4.bm" +.fi + +.hi + +.hi +.SS "Private variables" + +The GC for drawing the light parts of the frame: + + + +.nf +GC lightgc +.fi + +The GC for drawing the dark parts of the frame: + + + +.nf +GC darkgc +.fi + +The \fIstip4\fP bitmap is used on screens with insufficient colors to +simulate light and dark shadows. It will be created by the +\fIinitialize\fP method, whether or not it is needed. Since it is but a +small bitmap, this can't hurt much. + + + +.nf +Pixmap stip4 +.fi + +The \fIold_frame_type\fP variable is used by the \fIset_shadow\fP action +function to store the original frame type, when it is temporarily +changed. + + + +.nf +FrameType old_frame_type +.fi + +.hi + +.hi +.SS "Methods" + +\fIclass_initialize\fP installs the type converters. The type converters +back to String are installed as a convenience, so resources can be +retrieved in readable form with \fIXtVaGetValues\fP. + +.nf +class_initialize() +{ + static XtConvertArgRec screenArg[] = { + {XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen*)}}; + + XtSetTypeConverter(XtRString, XtRFrameType, cvtStringToFrameType, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRFrameType, XtRString, cvtFrameTypeToString, + NULL, 0, XtCacheNone, NULL); + + XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap, + screenArg, XtNumber(screenArg)); + + XtSetTypeConverter(XtRString, XtRShadowScheme, cvtStringToShadowScheme, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRShadowScheme, XtRString, cvtShadowSchemeToString, + NULL, 0, XtCacheNone, NULL); +} +.fi + +Much of the initialization that one would expect in the \fIinitialize\fP +method is actually delegated to the \fIrealize\fP method, since a window +ID is needed for most of the initializations. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + $lightgc = NULL; + $darkgc = NULL; + $old_frame_type = $frameType; +} +.fi + +The \fIrealize\fP method uses the inherited method, but adds the cursor +attribute. + +This is also the place to create the \fIstip4\fP bitmap, that is used for +stippled shadows. It could not be created in \fIinitialize\fP, since +creating a bitmap requires a window ID. + +The GC's must be created after the \fIstip4\fP bitmaps, since they might +have to use it as a stipple. + +.nf +realize($, XtValueMask * mask, XSetWindowAttributes * attributes) +{ + *mask |= CWCursor; + attributes->cursor = $cursor; + #realize($, mask, attributes); + + $stip4 = XCreateBitmapFromData(XtDisplay($), XtWindow($), + stip4_bits, stip4_width, stip4_height); + + if (! $topShadowStipple) $topShadowStipple = $stip4; + if (! $bottomShadowStipple) $bottomShadowStipple = $stip4; + + create_lightgc($); + create_darkgc($); +} +.fi + +The \fIset_values\fP method has to create new GC's if the resources +change. It also makes sure that \fIframeWidth\fP is even if the frame type +is chiseled or ledged. + +If the frame width was and is zero, nothing needs to be drawn, +regardless of the changes in other resources. Therefore, at the end +\fIneed_redisplay\fP is set to False. + +When the cursor changes, the \fIset_values\fP method uses the +\fIXDefineCursor\fP routine to set the attribute on the widget's window, +provided the widget is realized. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_redisplay = False; + + if ($cursor != $old$cursor XtIsRealized($)) + XDefineCursor(XtDisplay($), XtWindow($), $cursor); + + if ($frameType == XfwfChiseled || $frameType == XfwfLedged) + $frameWidth = 2 * ((int) ($frameWidth / 2)); + + if ($shadowScheme != $old$shadowScheme) { + create_darkgc($); + create_lightgc($); + need_redisplay = True; + } else if ($shadowScheme == XfwfColor) { + if ($topShadowColor != $old$topShadowColor) { + create_lightgc($); + need_redisplay = True; + } + if ($bottomShadowColor != $old$bottomShadowColor) { + create_darkgc($); + need_redisplay = True; + } + } else if ($shadowScheme == XfwfStipple) { + if ($topShadowStipple != $old$topShadowStipple) { + create_lightgc($); + need_redisplay = True; + } + if ($bottomShadowStipple != $old$bottomShadowStipple) { + create_darkgc($); + need_redisplay = True; + } + } + + if ($outerOffset != $old$outerOffset) + need_redisplay = True; + + if ($innerOffset != $old$innerOffset) + need_redisplay = True; + + if ($frameType != $old$frameType) { + $old_frame_type = $frameType; + need_redisplay = True; + } + + if ($frameWidth != $old$frameWidth) + need_redisplay = True; + else if ($frameWidth == 0) + need_redisplay = False; + + return need_redisplay; +} +.fi + +The \fIexpose\fP method draws the frame, for which it uses the +\fIXfwfDrawFrame\fP routine. Before it calls the routine, it sets the clip +region. Afterwards, the clip region is reset, because we don't know +which other widgets share the same GC's. As explained in {\em X +Toolkit Intrinsics Programming Manual} (Nye \& O'Reilly, Motif +Edition, 1990, p~223), the test for \fIXtIsRealized\fP is there for the +unlikely case when an expose event arrives after the widget has been +destroyed or unrealized. + +.nf +expose($, XEvent * event, Region region) +{ + Position x, y; + Dimension w, h; + + if (! XtIsRealized($)) return; + if (region != NULL) { + XSetRegion(XtDisplay($), $lightgc, region); + XSetRegion(XtDisplay($), $darkgc, region); + } + #compute_inside($, x, y, w, h); + XfwfDrawFrame($, x + $outerOffset, y + $outerOffset, w - 2*$outerOffset, + h - 2*$outerOffset, $frameType, $frameWidth, $lightgc, $darkgc); + if (region != NULL) { + XSetClipMask(XtDisplay($), $lightgc, None); + XSetClipMask(XtDisplay($), $darkgc, None); + } + #expose($, event, region); +} +.fi + +The method \fIcompute_inside\fP is re-defined. The method now returns +the area inside the frame. It calls the superclass's method and then +decreases the area by the width of the frame. + +.nf +compute_inside($, Position * x, Position * y, Dimension * w, Dimension * h) +{ + #compute_inside($, x, y, w, h); + *x += $outerOffset + $frameWidth + $innerOffset; + *y += $outerOffset + $frameWidth + $innerOffset; + *w -= 2 * ($outerOffset + $frameWidth + $innerOffset); + *h -= 2 * ($outerOffset + $frameWidth + $innerOffset); +} +.fi + +A Frame widget passes its parent's inquiry on to its (presumably) +single child. If there is no child, the proposal is accepted. +The border and position proposals are always accepted, the stacking +order and size are left to the child to decide. + +.nf +XtGeometryResult query_geometry($, XtWidgetGeometry * request, XtWidgetGeometry * reply) +{ + XtWidgetGeometry request2, reply2; + XtGeometryResult result; + Dimension h; + + if ($num_children == 0) return XtGeometryYes; + + /* We're only interested in size and stacking order */ + reply->request_mode = + (CWWidth | CWHeight | CWStackMode) request->request_mode; + + /* If nothing of interest is left, we can return immediately */ + if (reply->request_mode == 0) + return XtGeometryYes; + + /* Prepare a request to the child */ + h = 2 * ($outerOffset + $frameWidth + $innerOffset); + request2.request_mode = reply->request_mode; + request2.width = request->width - h; + request2.height = request->height - h; + request2.sibling = request->sibling; + request2.stack_mode = request->stack_mode; + + result = XtQueryGeometry($children[0], request2, reply2); + + /* If the child accepted its proposal, we accept ours */ + if (result == XtGeometryYes) return XtGeometryYes; + + /* If the child doesn't want any change, we don't want any, either */ + if (result == XtGeometryNo) return XtGeometryNo; + + /* Otherwise, ignore everything but size and stacking order */ + reply->request_mode = reply2.request_mode; + if (reply->request_mode == 0) return XtGeometryYes; + + reply->width = reply2.width + h; + reply->height = reply2.height + h; + reply->sibling = reply2.sibling; + reply->stack_mode = reply2.stack_mode; + return XtGeometryAlmost; +} +.fi + +Requests by the child to be resized are passed on to the parent. If +the parent replies with \fIXtGeometryYes\fP, the change is accepted and +(if not \fIXtCWQueryOnly\fP) already done. In that case the Frame widget +accepts its child's request. If the parent replies with +\fIXtGeometryNo\fP, the change is denied and the denial is passed on. If +the parent replies with a different geometry, the geometry is passed +on, after compensating for the frame width. + +Requests for anything other than width or height are always granted. + +.nf +XtGeometryResult geometry_manager(Widget child, XtWidgetGeometry * request, XtWidgetGeometry * reply) +{ + XtWidgetGeometry request2, reply2; + XtGeometryResult result; + Position x, y; + Dimension w, h, extraw, extrah; + + $compute_inside($, x, y, w, h); + if (! (request->request_mode (CWWidth|CWHeight))) return XtGeometryYes; + extraw = $width - w; + extrah = $height - h; + request2.request_mode = request->request_mode (CWWidth|CWHeight); + request2.width = request->width + extraw; + request2.height = request->height + extrah; + result = XtMakeGeometryRequest($, request2, reply2); + if (result == XtGeometryNo) return XtGeometryNo; + if (result == XtGeometryYes) return XtGeometryYes; + reply->request_mode = reply2.request_mode (CWWidth|CWHeight); + reply->width = reply2.width - extraw; + reply->height = reply2.height - extrah; + return XtGeometryAlmost; +} +.fi + +The \fIresize\fP method doesn't have to recompute any private variables, +but it passes on the resize message to its child, after decreasing the +area by the amount needed for the frame. + +.nf +resize($) +{ + Position x, y; + Dimension w, h; + Widget child; + + if ($num_children == 0) return; + $compute_inside($, x, y, w, h); + child = $children[0]; + w -= 2 * $child$border_width; + h -= 2 * $child$border_width; + XtConfigureWidget(child, x, y, w, h, $child$border_width); +} +.fi + +The \fIchange_managed\fP method is called when a child becomes managed +or unmanaged. The task of the routine is enforcing the layout policy, +which in this case consists of trying to take on the size of the child +or otherwise resize the child to fit inside the frame. +If the parent of the Frame widget doesn't allow the Frame widget to be +resized, the child of the Frame widget will be resized instead. + +.nf +change_managed($) +{ + XtWidgetGeometry request2, reply2; + XtGeometryResult result; + Widget child; + Position x, y; + Dimension w, h; + + if ($num_children == 0) return; + $compute_inside($, x, y, w, h); + child = $children[0]; + request2.request_mode = CWWidth | CWHeight; + request2.width = $child$width + $width - w; + request2.height = $child$height + $height - h; + result = XtMakeGeometryRequest($, request2, reply2); + $compute_inside($, x, y, w, h); + w -= 2 * $child$border_width; + h -= 2 * $child$border_width; + XtConfigureWidget(child, x, y, w, h, $child$border_width); +} +.fi + +.hi + +.hi +.SH "Utilities" + +The converters use the following macro. + +\fBdef\fP done(type, value) = +do { + if (to->addr != NULL) { + if (to->size < sizeof(type)) { + to->size = sizeof(type); + return False; + } + *(type*)(to->addr) = (value); + } else { + static type static_val; + static_val = (value); + to->addr = (XtPointer)static_val; + } + to->size = sizeof(type); + return True; + }while (0 ) + +The variable \fIrcsid\fP isn't used for anything, except tracking of +versions. The version number is that of the specification file (this +file) from which the widget's source is build. + +.nf +char rcsid[] = "$Header: Frame.w,v 1.5 92/11/02 14:07:52 bert Exp $" +.fi + +The \fIcreate_darkgc\fP function creates the GC for the dark parts of +the frame. The contents of the GC depend on the resources +\fIshadowScheme\fP and possibly \fIbackground_pixel\fP, \fIbottomShadowColor\fP, +\fItopShadowColor\fP, \fIbottomShadowStipple\fP and \fItopShadowStipple\fP. + +.nf +create_darkgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($darkgc != NULL) XtReleaseGC($, $darkgc); + switch ($shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = $bottomShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.stipple = $bottomShadowStipple; + values.foreground = BlackPixelOfScreen(XtScreen($)); + values.background = $background_pixel; + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen($)) > 4 + $darker_color($, $background_pixel, values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = $background_pixel; + values.foreground = WhitePixelOfScreen(XtScreen($)); + values.stipple = $stip4; + } + break; + } + $darkgc = XtGetGC($, mask, values); +} +.fi + +\fIcreate_lightgc\fP does the same for the light parts of the frame. +When the \fIshadowScheme\fP resource is \fIXfwfAuto\fP, the depth of the screen +and the availability of colors determines whether colors or stipples +will be used for the frame. + +.nf +create_lightgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($lightgc != NULL) XtReleaseGC($, $lightgc); + switch ($shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = $topShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.background = $background_pixel; + values.stipple = $topShadowStipple; + values.foreground = WhitePixelOfScreen(XtScreen($)); + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen($)) > 4 + $lighter_color($, $background_pixel, values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = $background_pixel; + values.foreground = WhitePixelOfScreen(XtScreen($)); + values.stipple = $stip4; + } + break; + } + $lightgc = XtGetGC($, mask, values); +} +.fi + +The function \fIcompute_topcolor\fP is a resource default proc. It is +used to compute the value of the \fItopShadowColor\fP relative to the +\fIbackground\fP color. + +.nf +compute_topcolor($, int offset, XrmValue * value) +{ + static Pixel color; + $lighter_color($, $background_pixel, color); + value->addr = (XtPointer) color; +} +.fi + +.nf +compute_bottomcolor($, int offset, XrmValue * value) +{ + static Pixel color; + $darker_color($, $background_pixel, color); + value->addr = (XtPointer) color; +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/FrameP.h b/vendor/x11iraf/obm/ObmW/FrameP.h new file mode 100644 index 00000000..07b6779a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/FrameP.h @@ -0,0 +1,48 @@ +/* Generated by wbuild from "Frame.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfFrameP_H_ +#define _XfwfFrameP_H_ +#include "CommonP.h" +#include "Frame.h" +typedef struct { +/* methods */ +/* class variables */ +int dummy; +} XfwfFrameClassPart; +typedef struct _XfwfFrameClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +} XfwfFrameClassRec; + +typedef struct { +/* resources */ +Cursor cursor; +FrameType frameType; +Dimension frameWidth; +Dimension outerOffset; +Dimension innerOffset; +ShadowScheme shadowScheme; +Pixel topShadowColor; +Pixel bottomShadowColor; +Bitmap topShadowStipple; +Bitmap bottomShadowStipple; +/* private state */ +GC lightgc; +GC darkgc; +Pixmap stip4; +FrameType old_frame_type; +} XfwfFramePart; + +typedef struct _XfwfFrameRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +} XfwfFrameRec; + +externalref XfwfFrameClassRec xfwfFrameClassRec; + +#endif /* _XfwfFrameP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Gcs.c b/vendor/x11iraf/obm/ObmW/Gcs.c new file mode 100644 index 00000000..0074bf8f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gcs.c @@ -0,0 +1,580 @@ +static char rcsid[] = "$Id: Gcs.c,v 1.7 1999/09/08 17:44:12 falk Exp $" ; + +/* + * Gcs.c - Utility functions to allocate GCs. + * + * Author: Edward A. Falk + * falk@falconer.vip.best.com + * + * Date: Sept 29, 1998 + * + * + * $Log: Gcs.c,v $ + * Revision 1.7 1999/09/08 17:44:12 falk + * Added XtAllocateGC + * Now requires Ansi C + * + * Revision 1.6 1999/08/25 17:01:26 falk + * now sets Xcolor.flags before allocating color + * + * Revision 1.5 1999/08/24 16:00:19 falk + * removed unused variables + * + * Revision 1.4 1999/08/24 15:44:10 falk + * Added AllocShadeGC(), AllocGreyPixelC() + * + * Revision 1.3 1998/12/15 04:55:05 falk + * now uses Xmu library for stippled bitmap + * now includes font in foreground & grey GC + * + * Revision 1.2 1998/10/12 16:29:32 falk + * Now exports the allocPixel and GetGrey50 functions + * + * Revision 1.1 1998/10/12 01:38:14 falk + * Initial revision + * + */ + +/* Functions: + * + * GC AllocFgGC(w, fg, font) + * Return a GC with foreground set as specified. + * If font is None, then the returned GC is allocated with font specified + * as a "don't care" value. + * + * GC + * AllocBackgroundGC(w, font) + * Return a GC with the foreground set to the widget's background color. + * + * GC + * AllocGreyGC(w, fg, font, contrast, be_nice_to_cmap) + * Widget w ; + * Pixel fg ; + * Font font ; + * int contrast ; + * int be_nice_to_cmap ; + * + * Return a GC suitable for rendering a widget in its "inactive" color. + * Normally returns a GC with a color somewhere between the widget's + * background color and the specified foreground. If font is None, then + * the returned GC is allocated with font specified as "don't care". + * If be_nice_to_cmap is True, the returned GC is created using a 50% + * dither instead of a new color. + * + * + * GC + * AllocShadeGC(w, fg, bg, font, contrast, be_nice_to_cmap) + * Widget w ; + * Pixel fg, bg ; + * Font font ; + * int contrast ; + * int be_nice_to_cmap ; + * + * Return a GC suitable for rendering in a shade somewhere between + * bg and fg, as determined by contrast (0 = bg, 100 = fg) + * If font is None, then the returned GC is allocated with + * font specified as "don't care". If be_nice_to_cmap + * is True, the returned GC is created using a 50% dither + * instead of a new color. + * + * + * GC + * AllocTopShadowGC(w, contrast, be_nice_to_cmap) + * Return a GC suitable for rendering the "top shadow" decorations of + * a widget. Returns a GC with foreground computed from widget's + * background color and contrast. If be_nice_to_cmap is True, the + * returned GC will use a foreground color of white. If widget depth + * is 1, this function will use a foreground color of black. + * + * GC + * AllocBotShadowGC(w, contrast, be_nice_to_cmap) + * Return a GC suitable for rendering the "bottom shadow" decorations + * of a widget. Returns a GC with foreground computed from widget's + * background color and contrast. If be_nice_to_cmap is True, the + * returned GC will use a foreground color of black. + * + * GC + * AllocArmGC(w, contrast, be_nice_to_cmap) + * Return a GC suitable for rendering the "armed" decorations of a + * widget. This GC would typically be used to fill in the widget's + * background. Returns a GC with foreground computed from widget's + * background color and contrast. If be_nice_to_cmap is True, the + * returned GC will use a foreground color of black and a 50% dither. + * + * + * void + * Draw3dBox(w, x,y,wid,hgt,s, topgc, botgc) + * Utility function. Draws a raised shadow box with outside dimensions + * as specified by x,y,wid,hgt and shadow width specified by s. + * A lowered shadow box may be generated by swapping topgc and botgc. + * + */ + +#include <stdio.h> + +#include <X11/Xlib.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Drawing.h> +#include <X11/Xmu/Misc.h> + +#include "Gcs.h" + + /* Color & GC allocation. + * + * Frame widgets use the following graphics contexts: + * + * Foreground tab label text drawn this way + * Insensitive Fg foreground color greyed out. + * Background frame background color + * Top shadow upper-left highlight around widget + * Bottom shadow lower-right highlight around widget + * Arm shadow button pressed and ready to be released + * + * + * GC's are defined as follows, depending on attributes and + * window depth: + * + * Monochrome: + * Foreground = foreground color attribute or BlackPixel() + * Grey = Foreground color + 50% dither + * Background = background color attribute or WhitePixel() + * top shadow = foreground + * bottom shadow = foreground + * arm shadow = (what?) + * + * Color, beNiceToColormap=true: + * Foreground = foreground color attribute or BlackPixel() + * Grey = Foreground color + 50% dither + * Background = background color attribute or WhitePixel() + * top shadow = white + * bottom shadow = black + * arm shadow = (what?) + * + * Color, beNiceToColormap=false: + * Foreground = foreground color attribute or BlackPixel() + * Grey = (foreground color + background color)/2 + * Background = background color attribute or WhitePixel() + * top shadow = background * 1.2 + * bottom shadow = background * .6 + * arm shadow = background * .8 + * + * Special cases: + * If background is white, ?? + * if background is black, ?? + * + * + * If the widget's background is solid white or solid black, + * this code just picks some numbers. (The choice is designed + * to be compatibile with ThreeD interface.) + */ + + + +#if XtSpecificationRelease < 5 + +static GC XtAllocateGC(Widget, int, u_long, XGCValues *, u_long, u_long) ; + +#endif + + +#if NeedFunctionPrototypes +static Pixmap getDitherPixmap(Widget, int contrast) ; +#else +static Pixmap getDitherPixmap() ; +#endif + + + /* return a GC with the specified foreground and optional font */ + +GC +AllocFgGC(Widget w, Pixel fg, Font font) +{ + XGCValues values ; + u_long vmask, dcmask ; + + values.foreground = fg ; + values.font = font ; + + if( font != None ) { + vmask = GCForeground|GCFont ; + dcmask = GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode|GCBackground ; + } else { + vmask = GCForeground ; + dcmask = GCFont|GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode|GCBackground ; + } + + return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; +} + + + /* return gc with widget background color as the foreground */ + +GC +AllocBackgroundGC(Widget w, Font font) +{ + return AllocFgGC(w, w->core.background_pixel, font) ; +} + + + /* Allocate an "inactive" GC. Color is grey (possibly via + * dither pattern). + */ + +GC +AllocGreyGC(Widget w, Pixel fg, Font font, int contrast, Bool be_nice_to_cmap) +{ + return AllocShadeGC(w, fg, w->core.background_pixel, + font, contrast, be_nice_to_cmap) ; +} + + + /* Allocate a GC somewhere between two colors. */ + +GC +AllocShadeGC(Widget w, Pixel fg, Pixel bg, Font font, + int contrast, Bool be_nice_to_cmap) +{ + XGCValues values ; + u_long vmask, dcmask ; + + values.foreground = fg ; + values.background = bg ; + values.font = font ; + + if( font != None ) { + vmask = GCForeground|GCFont ; + dcmask = GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode ; + } else { + vmask = GCForeground ; + dcmask = GCFont|GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode ; + } + + if( be_nice_to_cmap || w->core.depth == 1) + { + if( contrast <= 5 ) + values.foreground = bg ; + else if( contrast >= 95 ) + values.foreground = fg ; + else { + vmask |= GCBackground|GCStipple|GCFillStyle ; + values.fill_style = FillOpaqueStippled ; + values.stipple = getDitherPixmap(w, contrast) ; + } + + return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; + } + else + { + dcmask |= GCBackground ; + values.foreground = AllocGreyPixel(w, fg, bg, contrast) ; + return XtAllocateGC(w, w->core.depth, vmask, &values, 0L, dcmask) ; + } +} + + /* return top-shadow gc. */ + +GC +AllocTopShadowGC(Widget w, int contrast, Bool be_nice_to_cmap) +{ + Screen *scr = XtScreen (w); + XGCValues values ; + + if( w->core.depth == 1 ) + values.foreground = BlackPixelOfScreen(scr) ; + else if( be_nice_to_cmap ) + values.foreground = WhitePixelOfScreen(scr) ; + else + values.foreground = AllocShadowPixel(w, 100+contrast) ; + + return XtAllocateGC(w, w->core.depth, + GCForeground, &values, + 0L, + GCBackground|GCFont|GCSubwindowMode|GCGraphicsExposures| + GCDashOffset|GCDashList|GCArcMode) ; +} + + /* return bottom-shadow gc. */ + +GC +AllocBotShadowGC(Widget w, int contrast, Bool be_nice_to_cmap) +{ + Screen *scr = XtScreen (w); + XGCValues values ; + + if( w->core.depth == 1 || be_nice_to_cmap ) + values.foreground = BlackPixelOfScreen(scr) ; + else + values.foreground = AllocShadowPixel(w, 100-contrast) ; + + return XtAllocateGC(w, w->core.depth, + GCForeground, &values, + 0L, + GCBackground|GCFont|GCSubwindowMode|GCGraphicsExposures| + GCDashOffset|GCDashList|GCArcMode) ; +} + + /* return arm-shadow gc. */ + +GC +AllocArmGC(Widget w, int contrast, Bool be_nice_to_cmap) +{ + Screen *scr = XtScreen (w); + XGCValues values ; +#ifndef USE_XMU_STIPPLE + Screen *screen = XtScreen((Widget)w); + Display *display = XtDisplay((Widget)w); + int pixmap_width = 2, pixmap_height = 2; + static unsigned char pixmap_bits[] = { + 0x02, 0x01, + }; +#endif + + /* Not clear exactly what we should do here. Take a look at + * Xaw3d to see what they do. + */ + + if( w->core.depth == 1 || be_nice_to_cmap ) + { + values.background = w->core.background_pixel ; + if( values.background == BlackPixelOfScreen(scr) ) + values.foreground = WhitePixelOfScreen(scr) ; + else + values.foreground = BlackPixelOfScreen(scr) ; + values.fill_style = FillStippled ; +#ifdef USE_XMU_STIPPLE + values.stipple = XmuCreateStippledPixmap(XtScreen(w), 1L, 0L, 1); +#else + values.stipple = XCreatePixmapFromBitmapData (display, + RootWindowOfScreen(screen), + (char *)pixmap_bits, + pixmap_width, pixmap_height, + 1L, 0L, 1); +#endif + + + return XtAllocateGC(w, w->core.depth, + GCForeground|GCBackground|GCStipple|GCFillStyle, + &values, 0L, + GCFont|GCSubwindowMode|GCGraphicsExposures| + GCDashOffset|GCDashList|GCArcMode) ; + } + else { + values.foreground = AllocShadowPixel(w, 100-contrast) ; + return XtAllocateGC(w, w->core.depth, + GCForeground, &values, + 0L, + GCBackground|GCFont|GCSubwindowMode|GCGraphicsExposures| + GCDashOffset|GCDashList|GCArcMode) ; + } +} + + +Pixel +AllocShadowPixel(Widget w, int scale) +{ + XColor get_c, set_c ; + Display *dpy = XtDisplay(w) ; + Screen *scr = XtScreen(w) ; + Colormap cmap ; + Pixel maxColor ; + + cmap = w->core.colormap ; + + get_c.pixel = w->core.background_pixel ; + if( get_c.pixel == WhitePixelOfScreen(scr) || + get_c.pixel == BlackPixelOfScreen(scr) ) + { + /* what we *ought* to do is choose gray75 as the base color, + * or perhaps gray83. Instead, we choose colors that are + * the same as ThreeD would choose. + */ + if( scale > 100 ) scale = 200 - scale ; + set_c.red = set_c.green = set_c.blue = 65535*scale/100 ; + } + else + { + XQueryColor(dpy, cmap, &get_c) ; + /* adjust scale so that brightest component does not + * exceed 65535; otherwise hue would change. + */ + if( scale > 100 ) { + maxColor = Max(get_c.red, Max(get_c.green, get_c.blue)) ; + if( scale*maxColor > 65535*100 ) + scale = 65535*100/maxColor ; + } + set_c.red = scale * get_c.red / 100 ; + set_c.green = scale * get_c.green / 100 ; + set_c.blue = scale * get_c.blue / 100 ; + } + set_c.flags = DoRed | DoGreen | DoBlue ; + if( XAllocColor(dpy, cmap, &set_c) ) + return set_c.pixel ; + else if( scale > 100 ) + return WhitePixelOfScreen(scr) ; + else + return BlackPixelOfScreen(scr) ; +} + + + /* Allocate a pixel partway between foreground and background */ + + +Pixel +AllocGreyPixel(Widget w, Pixel fg, Pixel bg, int scale) +{ + XColor get_cf, get_cb ; + Display *dpy = XtDisplay(w) ; + Colormap cmap ; + + cmap = w->core.colormap ; + + get_cf.pixel = fg ; + get_cb.pixel = bg ; + + XQueryColor(dpy, cmap, &get_cf) ; + XQueryColor(dpy, cmap, &get_cb) ; + + return AllocGreyPixelC(w, &get_cf, &get_cb, scale) ; +} + + + + /* Allocate a pixel partway between foreground and background */ + + +Pixel +AllocGreyPixelC(Widget w, XColor *fg, XColor *bg, int scale) +{ + XColor set_c ; + Display *dpy = XtDisplay(w) ; + int r,g,b ; + Colormap cmap = w->core.colormap ; + + r = (fg->red * scale + bg->red * (100-scale)) / 100 ; + g = (fg->green * scale + bg->green * (100-scale)) / 100 ; + b = (fg->blue * scale + bg->blue * (100-scale)) / 100 ; + + if( scale > 100 || scale < 0 ) /* look out for overflow */ + { + int minc, maxc ; + maxc = Max(r, Max(g,b)) ; + minc = Min(r, Min(g,b)) ; + if( maxc > 65535 ) + { + maxc /= 16 ; + r = r*(65535/16) / maxc ; + g = g*(65535/16) / maxc ; + b = b*(65535/16) / maxc ; + } + if( minc < 0 ) + { + r = Max(r,0) ; + g = Max(g,0) ; + b = Max(b,0) ; + } + } + + set_c.red = r ; set_c.green = g ; set_c.blue = b ; + set_c.flags = DoRed | DoGreen | DoBlue ; + (void)XAllocColor(dpy, cmap, &set_c) ; + return set_c.pixel ; +} + + + + + + /* draw a 3-d box */ + +void +Draw3dBox(Widget w, int x, int y, int wid, int hgt, int s, GC topgc, GC botgc) +{ + Display *dpy = XtDisplay(w) ; + Window win = XtWindow(w) ; + + if( s == 0 ) return ; + + if( s == 1 ) { + XDrawLine(dpy,win,botgc, x,y+hgt-1, x+wid-1,y+hgt-1) ; + XDrawLine(dpy,win,botgc, x+wid-1,y, x+wid-1,y+hgt-1) ; + XDrawLine(dpy,win,topgc, x,y, x,y+hgt-1) ; + XDrawLine(dpy,win,topgc, x,y, x+wid-1,y) ; + } + else + { + XPoint pts[6] ; + + /* bottom-right shadow */ + pts[0].x = x ; pts[0].y = y + hgt ; + pts[1].x = s ; pts[1].y = -s ; + pts[2].x = wid-2*s ; pts[2].y = 0 ; + pts[3].x = 0 ; pts[3].y = -(hgt-2*s) ; + pts[4].x = s ; pts[4].y = -s ; + pts[5].x = 0 ; pts[5].y = hgt ; + XFillPolygon(dpy,win,botgc, pts,6, Nonconvex,CoordModePrevious) ; + + /* top-left shadow */ + pts[0].x = x ; pts[0].y = y ; + pts[1].x = wid ; pts[1].y = 0 ; + pts[2].x = -s ; pts[2].y = s ; + pts[3].x = -wid+2*s ; pts[3].y = 0 ; + pts[4].x = 0 ; pts[4].y = hgt-2*s ; + pts[5].x = -s ; pts[5].y = s ; + XFillPolygon(dpy,win,topgc, pts,6, Nonconvex,CoordModePrevious) ; + } +} + +#if XtSpecificationRelease < 5 + +static GC +XtAllocateGC(Widget w, int depth, u_long mask, XGCValues *values, + u_long dynamic, du_long ontcare) +{ + return XtGetGC(w, mask, values) ; +} +#endif + + +static u_char screen0[2] = {0,0} ; +static u_char screen25[2] = {0,0xaa} ; +static u_char screen75[2] = {0xaa,0xff} ; +static u_char screen100[2] = {0xff,0xff} ; + +static Pixmap +getDitherPixmap(Widget w, int contrast) +{ + Display *dpy = XtDisplay(w) ; + Window win = XtWindow(w) ; +#ifndef USE_XMU_STIPPLE + Screen *screen = XtScreen((Widget)w); + Display *display = XtDisplay((Widget)w); + int pixmap_width = 2, pixmap_height = 2; + static unsigned char pixmap_bits[] = { + 0x02, 0x01, + }; +#endif + + if( contrast <= 5 ) + return XCreateBitmapFromData(dpy,win, (char *)screen0, 2,2) ; + else if( contrast <= 37 ) + return XCreateBitmapFromData(dpy,win, (char *)screen25, 2,2) ; + else if( contrast <= 62 ) +#ifdef USE_XMU_STIPPLE + return XmuCreateStippledPixmap(XtScreen(w), 1L, 0L, 1) ; +#else + return XCreatePixmapFromBitmapData (display, + RootWindowOfScreen(screen), + (char *)pixmap_bits, + pixmap_width, pixmap_height, + 1L, 0L, 1); +#endif + else if( contrast <= 95 ) + return XCreateBitmapFromData(dpy,win, (char *)screen75, 2,2) ; + else + return XCreateBitmapFromData(dpy,win, (char *)screen100, 2,2) ; +} diff --git a/vendor/x11iraf/obm/ObmW/Gcs.h b/vendor/x11iraf/obm/ObmW/Gcs.h new file mode 100644 index 00000000..93a8982b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gcs.h @@ -0,0 +1,121 @@ +#ifndef GCS_H +#define GCS_H + +/* Overview of functions provided here: + * + * AllocFgGC() + * Given a foreground pixel & a font, return an appropriate GC + * + * AllocBackgroundGC() + * Given a widget, return a GC for painting the background color + * + * AllocShadeGC() + * Given foreground, background, a contrast value & be_nice_to_colormap + * flag, return a GC suitable for rendering in an intermediate color, + * as determined by constrast. May return a dither pattern or a + * solid color, as appropriate. + * + * Contrast 0 = background color, 100 = foreground color. It is legal + * for contrast to be more than 100 or less than 0. + * + * AllocGreyGC() + * Given widget, foreground, font, contrast & be_nice_to_colormap, + * return a shade GC (see above) based on foreground and widget + * background. + * + * AllocTopShadowGC() + * Given widget, contrast & be_nice_to_colormap, return a GC suitable + * for rendering the top shadow. + * + * Contrast 0 = use background pixel. Contrast > 0 = use brighter + * colors. + * + * AllocBotShadowGC() + * Given widget, contrast & be_nice_to_colormap, return a GC suitable + * for rendering the bottom shadow. + * + * Contrast 0 = use background pixel. Contrast > 0 = use darker + * colors. + * + * AllocArmShadowGC() + * Given widget, contrast & be_nice_to_colormap, return a GC suitable + * for rendering the "armed" shadow. + * + * Contrast 0 = use background pixel. Contrast > 0 = use darker + * colors. + * + * AllocShadowPixel() + * Given a widget & scale factor, allocate & return a color darker + * or lighter than the background pixel, as determined by scale. + * + * Scale 100 = use background pixel. Scale > 100 = brighter color, + * Scale < 100 = darker color. + * + * AllocGreyPixel() + * Given two pixel values and scale factor, allocate & return a + * pixel value between them, according to scale. + * + * Scale == 0: background color + * Scale == 100: foreground color + * 0<Scale<100: intermediate color + * Scale > 100: more foreground + * Scale < 0: more background + * + * + * AllocGreyPixelC() + * Given two color values and scale factor, allocate & return a + * pixel value between them, according to scale. + * + * Scale == 0: background color + * Scale == 100: foreground color + * 0<Scale<100: intermediate color + * Scale > 100: more foreground + * Scale < 0: more background + * + * Draw3dBox() + * Given box dimensions, shadow width, top shadow GC & bottom shadow GC, + * draw a 3-d box. + */ + +#if NeedFunctionPrototypes + +extern GC AllocFgGC( Widget w, Pixel fg, Font font) ; +extern GC AllocBackgroundGC( Widget w, Font font) ; +extern GC AllocShadeGC( Widget w, Pixel fg, Pixel bg, Font, + int contrast, Bool ) ; +extern GC AllocGreyGC( Widget w, Pixel fg, Font, int, Bool ) ; +extern GC AllocTopShadowGC( Widget w, int contrast, int ) ; +extern GC AllocBotShadowGC( Widget w, int contrast, int ) ; +extern GC AllocArmGC( Widget w, int contrast, int) ; +extern Pixel AllocShadowPixel(Widget, int scale) ; +extern Pixel AllocGreyPixel(Widget, Pixel fg, Pixel bg, int scale) ; +extern Pixel AllocGreyPixelC(Widget, XColor *fg, XColor *bg, int scale) ; +extern void Draw3dBox(Widget w, int x, int y, int wid, int hgt, int s, + GC topgc, GC botgc) ; + +#if XtSpecificationRelease < 5 +extern GC XtAllocateGC(Widget, int depth, u_long mask, + XGCValues *, u_long dynamic, u_long dontcare) ; +#endif + +#else + +extern GC AllocFgGC() ; +extern GC AllocBackgroundGC() ; +extern GC AllocShadeGC() ; +extern GC AllocGreyGC() ; +extern GC AllocTopShadowGC() ; +extern GC AllocBotShadowGC() ; +extern GC AllocArmGC() ; +extern Pixel AllocShadowPixel() ; +extern Pixel AllocGreyPixel() ; +extern Pixel AllocGreyPixelC() ; +extern void Draw3dBox() ; + +#if XtSpecificationRelease < 5 +extern GC XtAllocateGC() ; +#endif + +#endif + +#endif /* GCS_H */ diff --git a/vendor/x11iraf/obm/ObmW/Group.c b/vendor/x11iraf/obm/ObmW/Group.c new file mode 100644 index 00000000..f34005ea --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Group.c @@ -0,0 +1,383 @@ +/* Generated by wbuild from "Group.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Toggle.h" +#include <stdio.h> +#include <X11/Xmu/Converters.h> +#include "Converters.h" +#include "GroupP.h" +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void class_initialize( +#if NeedFunctionPrototypes +void +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void insert_child( +#if NeedFunctionPrototypes +Widget +#endif +); +static void make_textgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void on_cb( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static void off_cb( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static void set_toggles( +#if NeedFunctionPrototypes +Widget +#endif +); +#define done(type, value) do {\ + if (to->addr != NULL) {\ + if (to->size < sizeof(type)) {\ + to->size = sizeof(type);\ + return False;\ + }\ + *(type*)(to->addr) = (value);\ + } else {\ + static type static_val;\ + static_val = (value);\ + to->addr = (XtPointer)&static_val;\ + }\ + to->size = sizeof(type);\ + return True;\ + }while (0 ) + + +static Boolean cvtStringToSelectionType( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +static Boolean cvtSelectionTypeToString( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +/*ARGSUSED*/static void make_textgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfGroupWidget)self)->xfwfGroup.textgc != NULL) XtReleaseGC(self, ((XfwfGroupWidget)self)->xfwfGroup.textgc); + values.background = ((XfwfGroupWidget)self)->core.background_pixel; + values.foreground = ((XfwfGroupWidget)self)->xfwfGroup.foreground; + values.font = ((XfwfGroupWidget)self)->xfwfGroup.font->fid; + mask = GCFont | GCBackground | GCForeground; + ((XfwfGroupWidget)self)->xfwfGroup.textgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void on_cb(toggle,client_data,call_data)Widget toggle;XtPointer client_data;XtPointer call_data; +{ + Widget self = XtParent(toggle); + Cardinal toggle_ord = (Cardinal) client_data; + Cardinal t, i, bits = sizeof(((XfwfGroupWidget)self)->xfwfGroup.selection) * 8; + + switch (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle) { + case XfwfMultipleSelection: + if (toggle_ord < bits) ((XfwfGroupWidget)self)->xfwfGroup.selection |= 1L << toggle_ord; + break; + case XfwfSingleSelection: + case XfwfOneSelection: + if (((XfwfGroupWidget)self)->xfwfGroup.selection != -1L) + for (t = 0, i = 0; i < ((XfwfGroupWidget)self)->composite.num_children; i++) + if (XtIsSubclass(((XfwfGroupWidget)self)->composite.children[i], xfwfToggleWidgetClass)) { + if (((XfwfGroupWidget)self)->xfwfGroup.selection == t) { + XtVaSetValues(((XfwfGroupWidget)self)->composite.children[i], XtNon, False, NULL); + break; + } + t++; + } + ((XfwfGroupWidget)self)->xfwfGroup.selection = toggle_ord; + break; + default: ; + } + XtCallCallbackList(self, ((XfwfGroupWidget)self)->xfwfGroup.activate, (XtPointer) ((XfwfGroupWidget)self)->xfwfGroup.selection); +} +/*ARGSUSED*/static void off_cb(toggle,client_data,call_data)Widget toggle;XtPointer client_data;XtPointer call_data; +{ + Widget self = XtParent(toggle); + Cardinal toggle_ord = (Cardinal) client_data; + Cardinal t, i, bits = sizeof(((XfwfGroupWidget)self)->xfwfGroup.selection) * 8; + + switch (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle) { + case XfwfOneSelection: + XtVaSetValues(toggle, XtNon, True, NULL); /* Undo */ + break; + case XfwfSingleSelection: + ((XfwfGroupWidget)self)->xfwfGroup.selection = -1L; /* Nothing selected */ + break; + case XfwfMultipleSelection: + if (toggle_ord < bits) ((XfwfGroupWidget)self)->xfwfGroup.selection &= ~(1L << toggle_ord); + break; + default: ; + } + XtCallCallbackList(self, ((XfwfGroupWidget)self)->xfwfGroup.activate, (XtPointer) ((XfwfGroupWidget)self)->xfwfGroup.selection); +} +/*ARGSUSED*/static void set_toggles(self)Widget self; +{ + Cardinal i, t; + + for (t = 0, i = 0; i < ((XfwfGroupWidget)self)->composite.num_children; i++) + if (XtIsSubclass(((XfwfGroupWidget)self)->composite.children[i], xfwfToggleWidgetClass)) { + switch (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle) { + case XfwfNoSelection: + break; + case XfwfSingleSelection: + case XfwfOneSelection: + XtVaSetValues(((XfwfGroupWidget)self)->composite.children[i], XtNon, t == ((XfwfGroupWidget)self)->xfwfGroup.selection, NULL); + break; + case XfwfMultipleSelection: + XtVaSetValues(((XfwfGroupWidget)self)->composite.children[i], + XtNon, (((XfwfGroupWidget)self)->xfwfGroup.selection & (1L<<t)) != 0, NULL); + break; + } + t++; + } +} +/*ARGSUSED*/static Boolean cvtStringToSelectionType(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToSelectionType", "wrongParameters", + "XtToolkitError", + "String to SelectionType conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "no") == 0) + done(SelectionType, XfwfNoSelection); + if (XmuCompareISOLatin1(s, "none") == 0) + done(SelectionType, XfwfNoSelection); + if (XmuCompareISOLatin1(s, "single") == 0) + done(SelectionType, XfwfSingleSelection); + if (XmuCompareISOLatin1(s, "one") == 0) + done(SelectionType, XfwfOneSelection); + if (XmuCompareISOLatin1(s, "multi") == 0) + done(SelectionType, XfwfMultipleSelection); + if (XmuCompareISOLatin1(s, "multiple") == 0) + done(SelectionType, XfwfMultipleSelection); + + XtDisplayStringConversionWarning(display, s, XtRSelectionType); + done(SelectionType, XfwfSingleSelection); +} +/*ARGSUSED*/static Boolean cvtSelectionTypeToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + char s[30]; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToSelectionStyle", "wrongParameters", + "XtToolkitError", + "String to SelectionStyle conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*((SelectionType*) from->addr)) { + case XfwfNoSelection: done(String, "none"); + case XfwfSingleSelection: done(String, "single"); + case XfwfOneSelection: done(String, "one"); + case XfwfMultipleSelection: done(String, "multiple"); + } + XtDisplayStringConversionWarning(display, s, XtRSelectionType); + done(String, "none"); +} + +static XtResource resources[] = { +{XtNlabel,XtCLabel,XtRString,sizeof(((XfwfGroupRec*)NULL)->xfwfGroup.label),XtOffsetOf(XfwfGroupRec,xfwfGroup.label),XtRImmediate,(XtPointer)NULL }, +{XtNfont,XtCFont,XtRFontStruct,sizeof(((XfwfGroupRec*)NULL)->xfwfGroup.font),XtOffsetOf(XfwfGroupRec,xfwfGroup.font),XtRString,(XtPointer)XtDefaultFont }, +{XtNforeground,XtCForeground,XtRPixel,sizeof(((XfwfGroupRec*)NULL)->xfwfGroup.foreground),XtOffsetOf(XfwfGroupRec,xfwfGroup.foreground),XtRString,(XtPointer)XtDefaultForeground }, +{XtNselectionStyle,XtCSelectionStyle,XtRSelectionType,sizeof(((XfwfGroupRec*)NULL)->xfwfGroup.selectionStyle),XtOffsetOf(XfwfGroupRec,xfwfGroup.selectionStyle),XtRImmediate,(XtPointer)XfwfSingleSelection }, +{XtNselection,XtCSelection,XtRLong,sizeof(((XfwfGroupRec*)NULL)->xfwfGroup.selection),XtOffsetOf(XfwfGroupRec,xfwfGroup.selection),XtRImmediate,(XtPointer)0 }, +{XtNactivate,XtCActivate,XtRCallback,sizeof(((XfwfGroupRec*)NULL)->xfwfGroup.activate),XtOffsetOf(XfwfGroupRec,xfwfGroup.activate),XtRImmediate,(XtPointer)NULL }, +{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfGroupRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfGroupRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfChiseled }, +{XtNinnerOffset,XtCInnerOffset,XtRDimension,sizeof(((XfwfGroupRec*)NULL)->xfwfFrame.innerOffset),XtOffsetOf(XfwfGroupRec,xfwfFrame.innerOffset),XtRImmediate,(XtPointer)3 }, +}; + +XfwfGroupClassRec xfwfGroupClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfRowColClassRec, +"Group", +sizeof(XfwfGroupRec), +class_initialize, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +NULL, +0, +resources, +8, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +insert_child, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfRowCol_class part */ +XtInherit_layout, +}, +{ /* XfwfGroup_class part */ +0 +}, +}; +WidgetClass xfwfGroupWidgetClass = (WidgetClass) &xfwfGroupClassRec; +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfGroupWidgetClass c = (XfwfGroupWidgetClass) class; + XfwfGroupWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfGroupWidgetClass) return; + super = (XfwfGroupWidgetClass)class->core_class.superclass; +} +/*ARGSUSED*/static void class_initialize() +{ + XtAddConverter(XtRString, XtRLong, XmuCvtStringToLong, NULL, 0); + XtSetTypeConverter(XtRLong, XtRString, XfwfCvtLongToString, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRString, XtRSelectionType, cvtStringToSelectionType, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRSelectionType, XtRString, cvtSelectionTypeToString, + NULL, 0, XtCacheNone, NULL); +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + ((XfwfGroupWidget)self)->xfwfGroup.toggle_ord = 0; + ((XfwfGroupWidget)self)->xfwfGroup.textgc = NULL; + make_textgc(self); + if (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle == XfwfOneSelection && ((XfwfGroupWidget)self)->xfwfGroup.selection == -1L) { + XtWarning + ("Illegal combination of selectionStyle and selection resources"); + ((XfwfGroupWidget)self)->xfwfGroup.selection = 0; + } +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redraw = False; + + if (((XfwfGroupWidget)old)->xfwfGroup.label != ((XfwfGroupWidget)self)->xfwfGroup.label) { + XtFree(((XfwfGroupWidget)old)->xfwfGroup.label); + ((XfwfGroupWidget)self)->xfwfGroup.label = XtNewString(((XfwfGroupWidget)self)->xfwfGroup.label); + need_redraw = True; + } + if (((XfwfGroupWidget)self)->xfwfGroup.font != ((XfwfGroupWidget)old)->xfwfGroup.font) { + make_textgc(self); + if (((XfwfGroupWidget)self)->xfwfGroup.label != NULL) need_redraw = True; + } + if (((XfwfGroupWidget)old)->xfwfGroup.selection != ((XfwfGroupWidget)self)->xfwfGroup.selection + || ((XfwfGroupWidget)old)->xfwfGroup.selectionStyle != ((XfwfGroupWidget)self)->xfwfGroup.selectionStyle) { + if (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle == XfwfOneSelection && ((XfwfGroupWidget)self)->xfwfGroup.selection == -1L) + ((XfwfGroupWidget)self)->xfwfGroup.selection = 0; + set_toggles(self); + } + return need_redraw; +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + Dimension w, h; + Position x, y; + + if (! XtIsRealized(self)) return; + xfwfRowColClassRec.core_class.expose(self, event, region); + ((XfwfGroupWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + XDrawImageString(XtDisplay(self), XtWindow(self), ((XfwfGroupWidget)self)->xfwfGroup.textgc, x + 3, + y - ((XfwfGroupWidget)self)->xfwfFrame.innerOffset, ((XfwfGroupWidget)self)->xfwfGroup.label, strlen(((XfwfGroupWidget)self)->xfwfGroup.label)); +} +/*ARGSUSED*/static void insert_child(child)Widget child; +{ Widget self = XtParent(child); { + xfwfRowColClassRec.composite_class.insert_child(child); + if (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle != XfwfNoSelection + && XtIsSubclass(child, xfwfToggleWidgetClass)) { + XtAddCallback(child, XtNonCallback, on_cb, (XtPointer) ((XfwfGroupWidget)self)->xfwfGroup.toggle_ord); + XtAddCallback(child, XtNoffCallback, off_cb, (XtPointer) ((XfwfGroupWidget)self)->xfwfGroup.toggle_ord); + switch (((XfwfGroupWidget)self)->xfwfGroup.selectionStyle) { + case XfwfOneSelection: + case XfwfSingleSelection: + XtVaSetValues(child, XtNon, ((XfwfGroupWidget)self)->xfwfGroup.toggle_ord == ((XfwfGroupWidget)self)->xfwfGroup.selection, NULL); + break; + case XfwfMultipleSelection: + XtVaSetValues(child, XtNon, + (((XfwfGroupWidget)self)->xfwfGroup.selection & (1L<<((XfwfGroupWidget)self)->xfwfGroup.toggle_ord)) != 0, NULL); + break; + default: ; + } + ((XfwfGroupWidget)self)->xfwfGroup.toggle_ord++; + } +} +} diff --git a/vendor/x11iraf/obm/ObmW/Group.h b/vendor/x11iraf/obm/ObmW/Group.h new file mode 100644 index 00000000..d63bae37 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Group.h @@ -0,0 +1,74 @@ +/* Generated by wbuild from "Group.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfGroup_H_ +#define _XfwfGroup_H_ +#include "RowCol.h" +typedef enum { + XfwfNoSelection, XfwfSingleSelection, + XfwfOneSelection, XfwfMultipleSelection } SelectionType; + +#ifndef XtNlabel +#define XtNlabel "label" +#endif +#ifndef XtCLabel +#define XtCLabel "Label" +#endif +#ifndef XtRString +#define XtRString "String" +#endif + +#ifndef XtNfont +#define XtNfont "font" +#endif +#ifndef XtCFont +#define XtCFont "Font" +#endif +#ifndef XtRFontStruct +#define XtRFontStruct "FontStruct" +#endif + +#ifndef XtNforeground +#define XtNforeground "foreground" +#endif +#ifndef XtCForeground +#define XtCForeground "Foreground" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNselectionStyle +#define XtNselectionStyle "selectionStyle" +#endif +#ifndef XtCSelectionStyle +#define XtCSelectionStyle "SelectionStyle" +#endif +#ifndef XtRSelectionType +#define XtRSelectionType "SelectionType" +#endif + +#ifndef XtNselection +#define XtNselection "selection" +#endif +#ifndef XtCSelection +#define XtCSelection "Selection" +#endif +#ifndef XtRLong +#define XtRLong "Long" +#endif + +#ifndef XtNactivate +#define XtNactivate "activate" +#endif +#ifndef XtCActivate +#define XtCActivate "Activate" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +typedef struct _XfwfGroupClassRec *XfwfGroupWidgetClass; +typedef struct _XfwfGroupRec *XfwfGroupWidget; +externalref WidgetClass xfwfGroupWidgetClass; +#endif /*_XfwfGroup_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Group.man b/vendor/x11iraf/obm/ObmW/Group.man new file mode 100644 index 00000000..7d3900bf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Group.man @@ -0,0 +1,723 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfGroup +.SH DESCRIPTION +The Group widget is a subclass of RowCol, which means that it +arranges its children in rows and columns. (See the RowCol widget for +the resources that influence the layout.) The Group widget adds two +things to the capabilities already present in RowCol, namely a label +in the upper left hand corner and the ability to make a number of +Toggle buttons act as radio buttons. + +The label is a short, one line piece of text, that is displayed over +the border in the top left corner. The border is interupted at that +point. Since this works best with `ledged' or `chiseled' border +types, the default border is \fIXfwfChiseled\fP. + +The special support for radio buttons works as follows: when a child +is added the Group widget checks if it is of class \fIXfwfToggle\fP or a +subclass thereof. If so, the Group widget installs a callback in it. +When the toggle button is then activated, the Group widget determines +which other buttons need to be turned off. All toggle buttons are +given an implicit number. The first one to be added is number 0. + +There are three selection styles, settable through the +\fIselectionStyle\fP resource: + +1) `single' (\fIXfwfSingleSelection\fP) means that at most one of the +toggle buttons may be on, but it is possible that they are all off. +When one of the buttons is turned on, all others are turned off +automatically. The resource \fIselection\fP holds the number of the button +that is on, or -1 if they are all off. + +2) `one' (\fIXfwfOneSelection\fP) means that at all times exactly one +button is turned on. It is not possible to turn buttons off, except by +toggling another one to on. The resource \fIselection\fP holds the number +of the button that is currently on. + +3) `multi' or `multiple' (\fIXfwfMultipleSelection\fP) means that any +number of buttons may be on. No buttons are turned off automatically. +The resource \fIselection\fP has one bit set for each button that is on. +Thus, if buttons 1, 4 and 5 are on, the value of \fIselection\fP is (1<<1 ++ 1<<4 + 1<<5 =) 0x62. Note that this limits the number of buttons +that is recorded in \fIselection\fP to the first 32. It is still possible +to have more buttons, but the application will then have to use +callbacks or other means to keep track of the toggle buttons. + +4) `none' (\fIXfwfNoSelection\fP) turns off any special handling of toggle +buttons. The value of the \fIselection\fP resource is undefined. + +Applications may of course install callbacks on the toggle buttons, +but a simpler way is to attach to the \fIactivateCallback\fP of the Group +widget itself, or use no callback at all and simply inspect the +\fIselection\fP resource when needed. + +It is recommended that application visually differentiate between +selection styles. One way would be to use different graphics in the +toggle buttons, e.g., the Motif convention that radiobuttons have an +empty or colored diamond, and non-exclusive toggles a square. +Suitable icons are already defined by the Common widget. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfGroup +Name Class Type Default +XtNlabel XtCLabel String NULL +XtNfont XtCFont FontStruct XtDefaultFont +XtNforeground XtCForeground Pixel XtDefaultForeground +XtNselectionStyle XtCSelectionStyle SelectionType XfwfSingleSelection +XtNselection XtCSelection Long 0 +XtNactivate XtCActivate Callback NULL + +.TE +.ps + +.TP +.I "XtNlabel" +The label must be a single line. It is displayed superimposed on the +frame, in the upper lefthand corner. Currently, it must be simple +string in a single font. + + + +.hi + +.nf +String label = NULL +.fi + +.eh + +.TP +.I "XtNfont" +The font for the label is set with \fIfont\fP. + + + +.hi + +.nf +<FontStruct> XFontStruct * font = <String>XtDefaultFont +.fi + +.eh + +.TP +.I "XtNforeground" +The foreground color is the color used to draw the text. + + + +.hi + +.nf +Pixel foreground = <String>XtDefaultForeground +.fi + +.eh + +.TP +.I "XtNselectionStyle" +The \fIselectionStyle\fP resource determines how the Group widget treats +the child widgets that are of class \fIXfwfToggle\fP or a subclass +thereof. The possible values are \fIXfwfNoSelection\fP, +\fIXfwfSingleSelection\fP (default), \fIXfwfOneSelection\fP and +\fIXfwfMultipleSelection\fP. The meaning is as explained above. There is a +converter from strings, that recognizes the strings `no', `none', +`single', `one', `multi', and `multiple', in upper or lower case. + + + +.hi + +.nf +SelectionType selectionStyle = XfwfSingleSelection +.fi + +.eh + +.TP +.I "XtNselection" +The resource \fIselection\fP holds the state of the toggle buttons (if +any). If \fIselectionType = XfwfSingleSelection\fP or \fIXfwfOneSelection\fP, +it holds the number of the buttons that is currently on, or -1 if they +are all off. If \fIselectionType = XfwfMultipleSelection\fP, it is a +bitmap with one bit set for each button that is on. (See the +introduction above for more information.) + +The value can also be set (e.g., through \fIXtSetValues\fP); the result is +that the corresponding toggle buttons will be turned on or off. + + + +.hi + +.nf +long selection = 0 +.fi + +.eh + +.TP +.I "XtNactivate" +The callback \fIactivate\fP can be used by applications that want to be +informed of any change to the state of the toggle buttons as soon as +it happens. Other applications can simply use \fIXtGetValues\fP to get the +value of the \fIselection\fP resource. The callback will be called with +the value of \fIselection\fP as \fIcall_data\fP argument. + + + +.hi + +.nf +<Callback> XtCallbackList activate = NULL +.fi + +.eh + +.TP +.I "XtNframeType" +The default border type is different from that of its superclass +RowCol. It is set to \fIXfwfChiseled\fP because that is the conventional +border type around radio buttons, and because it looks better when +there is a label superimposed on it. + + + +.hi + +.nf +FrameType frameType = XfwfChiseled +.fi + +.eh + +.TP +.I "XtNinnerOffset" +The default value for \fIinnerOffset\fP is set to 3 pixels, which makes +it a little bit more likely that the descenders of the label will stay +visible. + + + +.hi + +.nf + innerOffset = 3 +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfRowCol +Name Class Type Default +XtNstoreByRow XtCStoreByRow Boolean True +XtNrows XtCRows Int 0 +XtNcolumns XtCColumns Int 0 +XtNalignment XtCAlignment Alignment XfwfTopLeft +XtNshrinkToFit XtCShrinkToFit Boolean False + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The \fISelectionType\fP type is exported to the public header file. + + + +.nf + +.B type + SelectionType = enum { + XfwfNoSelection, XfwfSingleSelection, + XfwfOneSelection, XfwfMultipleSelection } +.fi + +.hi +.SH "Importss" + +.nf + +.B incl + <Xfwf/Toggle.h> +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.nf + +.B incl + <X11/Xmu/Converters.h> +.fi + +.nf + +.B incl + <Xfwf/Converters.h> +.fi + +.hi + +.hi +.SS "Private variables" + +The GC is used for the text. + + + +.nf +GC textgc +.fi + +The private variable \fItoggle_ord\fP holds the number that will be +assigned to the next child that is a toggle button. The first toggle +will be number 0. + + + +.nf +Cardinal toggle_ord +.fi + +.hi + +.hi +.SS "Methods" + +The type converter from String to SelectionType is installed here. + +.nf +class_initialize() +{ + XtAddConverter(XtRString, XtRLong, XmuCvtStringToLong, NULL, 0); + XtSetTypeConverter(XtRLong, XtRString, XfwfCvtLongToString, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRString, XtRSelectionType, cvtStringToSelectionType, + NULL, 0, XtCacheNone, NULL); + XtSetTypeConverter(XtRSelectionType, XtRString, cvtSelectionTypeToString, + NULL, 0, XtCacheNone, NULL); +} +.fi + +The \fIinitialize\fP method initializes the private variables. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + $toggle_ord = 0; + $textgc = NULL; + make_textgc($); + if ($selectionStyle == XfwfOneSelection $selection == -1L) { + XtWarning + ("Illegal combination of selectionStyle and selection resources"); + $selection = 0; + } +} +.fi + +The \fIset_values\fP method has to deal with changes in \fIlabel\fP, \fIfont\fP, +\fIselectionType\fP or \fIselection\fP. A change in \fIselection\fP or +\fIselectionType\fP means that all toggle buttons must be set to on or off +according to the new values. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_redraw = False; + + if ($old$label != $label) { + XtFree($old$label); + $label = XtNewString($label); + need_redraw = True; + } + if ($font != $old$font) { + make_textgc($); + if ($label != NULL) need_redraw = True; + } + if ($old$selection != $selection + || $old$selectionStyle != $selectionStyle) { + if ($selectionStyle == XfwfOneSelection $selection == -1L) + $selection = 0; + set_toggles($); + } + return need_redraw; +} +.fi + +The \fIexpose\fP method first calls the \fIexpose\fP method of its +superclass -- which basically just draws the frame -- and then adds +the label to it. + +.nf +expose($, XEvent * event, Region region) +{ + Dimension w, h; + Position x, y; + + if (! XtIsRealized($)) return; + #expose($, event, region); + $compute_inside($, x, y, w, h); + XDrawImageString(XtDisplay($), XtWindow($), $textgc, x + 3, + y - $innerOffset, $label, strlen($label)); +} +.fi + +When a child is added, the Group widget checks to see if it is a +Toggle button. If it is, and the \fIselectionStyle\fP resource is not +\fIXfwfNoSelection\fP, then the toggle button is assigned a number and two +callbacks are installed in it. The callbacks' task is to record any +changes in the state of the togle button in the Group widget's +\fIselection\fP resource and also to make sure that no more and no fewer +buttons are turned on then is allowed by the \fIselectionStyle\fP. + +It doesn't matter whether the new child is managed or not: any child +that is (a subclass of) an XfwfToggle button gets two callbacks and a +number. + +The \fIon\fP resource of the new child is also set in accordance with the +current value of the Group's \fIselection\fP resource. + +.nf +insert_child(Widget child) +{ + #insert_child(child); + if ($selectionStyle != XfwfNoSelection + XtIsSubclass(child, xfwfToggleWidgetClass)) { + XtAddCallback(child, XtNonCallback, on_cb, (XtPointer) $toggle_ord); + XtAddCallback(child, XtNoffCallback, off_cb, (XtPointer) $toggle_ord); + switch ($selectionStyle) { + case XfwfOneSelection: + case XfwfSingleSelection: + XtVaSetValues(child, XtNon, $toggle_ord == $selection, NULL); + break; + case XfwfMultipleSelection: + XtVaSetValues(child, XtNon, + ($selection (1L<<$toggle_ord)) != 0, NULL); + break; + default: ; + } + $toggle_ord++; + } +} +.fi + +.hi + +.hi +.SH "Utilities" + +The \fImake_textgc\fP routine creates the GC for the text. + +.nf +make_textgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($textgc != NULL) XtReleaseGC($, $textgc); + values.background = $background_pixel; + values.foreground = $foreground; + values.font = $font->fid; + mask = GCFont | GCBackground | GCForeground; + $textgc = XtGetGC($, mask, values); +} +.fi + +The task of the \fIon_cb\fP callback function is to record the changed +state of the toggle button and maybe turn off other toggle buttons. +When the new value of \fIselection\fP is computed, the \fIactivate\fP +callbacks are called. + +.nf +on_cb(Widget toggle, XtPointer client_data, XtPointer call_data) +{ + Widget $ = XtParent(toggle); + Cardinal toggle_ord = (Cardinal) client_data; + Cardinal t, i, bits = sizeof($selection) * 8; + + switch ($selectionStyle) { + case XfwfMultipleSelection: + if (toggle_ord < bits) $selection |= 1L << toggle_ord; + break; + case XfwfSingleSelection: + case XfwfOneSelection: + if ($selection != -1L) + for (t = 0, i = 0; i < $num_children; i++) + if (XtIsSubclass($children[i], xfwfToggleWidgetClass)) { + if ($selection == t) { + XtVaSetValues($children[i], XtNon, False, NULL); + break; + } + t++; + } + $selection = toggle_ord; + break; + default: ; + } + XtCallCallbackList($, $activate, (XtPointer) $selection); +} +.fi + +The task of the \fIoff_cb\fP callback function is to update the +\fIselection\fP resource and check if turning off the toggle button is +allowed. If the \fIselectionStyle\fP is \fIXfwfOneSelection\fP, toggles cannot +be turned off, except by turning on another one. + +.nf +off_cb(Widget toggle, XtPointer client_data, XtPointer call_data) +{ + Widget $ = XtParent(toggle); + Cardinal toggle_ord = (Cardinal) client_data; + Cardinal t, i, bits = sizeof($selection) * 8; + + switch ($selectionStyle) { + case XfwfOneSelection: + XtVaSetValues(toggle, XtNon, True, NULL); /* Undo */ + break; + case XfwfSingleSelection: + $selection = -1L; /* Nothing selected */ + break; + case XfwfMultipleSelection: + if (toggle_ord < bits) $selection = ~(1L << toggle_ord); + break; + default: ; + } + XtCallCallbackList($, $activate, (XtPointer) $selection); +} +.fi + +The function \fIset_toggles\fP is used when the \fIselection\fP resource or +the \fIselectionStyle\fP resource changes. It inspects all child widgets +in turn and turns toggles on or off according to the values of these +two resources. + +.nf +set_toggles($) +{ + Cardinal i, t; + + for (t = 0, i = 0; i < $num_children; i++) + if (XtIsSubclass($children[i], xfwfToggleWidgetClass)) { + switch ($selectionStyle) { + case XfwfNoSelection: + break; + case XfwfSingleSelection: + case XfwfOneSelection: + XtVaSetValues($children[i], XtNon, t == $selection, NULL); + break; + case XfwfMultipleSelection: + XtVaSetValues($children[i], + XtNon, ($selection (1L<<t)) != 0, NULL); + break; + } + t++; + } +} +.fi + +\fIcvtStringToSelectionType\fP converts the strings `no', `none', +`single', `one', `multi' and `multiple'. Case doesn't matter. + +\fBdef\fP done(type, value) = +do { + if (to->addr != NULL) { + if (to->size < sizeof(type)) { + to->size = sizeof(type); + return False; + } + *(type*)(to->addr) = (value); + } else { + static type static_val; + static_val = (value); + to->addr = (XtPointer)static_val; + } + to->size = sizeof(type); + return True; + }while (0 ) + +.nf +Boolean cvtStringToSelectionType(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToSelectionType", "wrongParameters", + "XtToolkitError", + "String to SelectionType conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "no") == 0) + done(SelectionType, XfwfNoSelection); + if (XmuCompareISOLatin1(s, "none") == 0) + done(SelectionType, XfwfNoSelection); + if (XmuCompareISOLatin1(s, "single") == 0) + done(SelectionType, XfwfSingleSelection); + if (XmuCompareISOLatin1(s, "one") == 0) + done(SelectionType, XfwfOneSelection); + if (XmuCompareISOLatin1(s, "multi") == 0) + done(SelectionType, XfwfMultipleSelection); + if (XmuCompareISOLatin1(s, "multiple") == 0) + done(SelectionType, XfwfMultipleSelection); + + XtDisplayStringConversionWarning(display, s, XtRSelectionType); + done(SelectionType, XfwfSingleSelection); +} +.fi + +A converter in the opposite direction. + +.nf +Boolean cvtSelectionTypeToString(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +{ + char s[30]; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToSelectionStyle", "wrongParameters", + "XtToolkitError", + "String to SelectionStyle conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + switch (*((SelectionType*) from->addr)) { + case XfwfNoSelection: done(String, "none"); + case XfwfSingleSelection: done(String, "single"); + case XfwfOneSelection: done(String, "one"); + case XfwfMultipleSelection: done(String, "multiple"); + } + XtDisplayStringConversionWarning(display, s, XtRSelectionType); + done(String, "none"); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/GroupP.h b/vendor/x11iraf/obm/ObmW/GroupP.h new file mode 100644 index 00000000..842131b4 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GroupP.h @@ -0,0 +1,48 @@ +/* Generated by wbuild from "Group.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfGroupP_H_ +#define _XfwfGroupP_H_ +#include "RowColP.h" +#include "Group.h" +typedef struct { +/* methods */ +/* class variables */ +int dummy; +} XfwfGroupClassPart; +typedef struct _XfwfGroupClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfRowColClassPart xfwfRowCol_class; +XfwfGroupClassPart xfwfGroup_class; +} XfwfGroupClassRec; + +typedef struct { +/* resources */ +String label; +XFontStruct * font; +Pixel foreground; +SelectionType selectionStyle; +long selection; +XtCallbackList activate; +/* private state */ +GC textgc; +Cardinal toggle_ord; +} XfwfGroupPart; + +typedef struct _XfwfGroupRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfRowColPart xfwfRowCol; +XfwfGroupPart xfwfGroup; +} XfwfGroupRec; + +externalref XfwfGroupClassRec xfwfGroupClassRec; + +#endif /* _XfwfGroupP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c b/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c new file mode 100644 index 00000000..03748e0e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c @@ -0,0 +1,13283 @@ +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/XawInit.h> +#include "GtermP.h" + + +#define DEBUG_GTERM 1 +#define DEBUG_TRACE 1 +#define DBG_TRACE 1 +#define DEBUG_VISUAL 1 +/* +*/ + +/* + * Gterm -- Graphics terminal widget. This widget implements only the + * window specific graphics output and graphics window input functions. + * Protocol translation (e.g. Tek emulation) and i/o is done elsewhere; + * see for example gtermio.c. + */ + +#define DefaultAlphaFont 3 +#define DefaultDialogFont 3 +#define DefaultMarkerTextFont 3 +#define ZOOM_TOL 0.0001 + +#define CacheXImage 0 /* MF004 */ + +static Dimension defXDim = DEF_WIDTH; +static Dimension defYDim = DEF_HEIGHT; + +/* Default translations for Gterm window. */ +/* Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) */ + +static char defaultGtermTranslations[] = +"\ + <Btn1Down>: m_create() \n\ + <Btn2Down>: crosshair(on) \n\ + <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() \n\ +"; + +/* Default translations when pointer is over a marker. */ +static char defaultMarkerTranslations[] = +"\ + !Shift <Btn1Motion>: m_rotateResize() \n\ + <Btn1Motion>: m_moveResize() \n\ + !Shift <Btn1Down>: m_raise() m_markpos() \n\ + <Btn1Down>: m_raise() m_markposAdd() \n\ + <Btn1Up>: m_redraw() m_destroyNull() \n\ + <Btn2Down>: m_lower() \n\ + <Key>BackSpace: m_deleteDestroy() \n\ + <Key>Delete: m_deleteDestroy() \n\ + <KeyPress>: m_input() \n\ + <Motion>: track-cursor() \n\ +"; + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defXDim}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defYDim}, + + {XtNalphaFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont1), XtRString, "nil2"}, + {XtNalphaFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont2), XtRString, "5x8"}, + {XtNalphaFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont3), XtRString, "6x10"}, + {XtNalphaFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont4), XtRString, "7x13"}, + {XtNalphaFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont5), XtRString, "8x13"}, + {XtNalphaFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont6), XtRString, "9x15"}, + {XtNalphaFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont7), XtRString, "9x15"}, + {XtNalphaFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont8), XtRString, "9x15"}, + + {XtNdialogFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont1), XtRString, "nil2"}, + {XtNdialogFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont2), XtRString, "5x8"}, + {XtNdialogFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont3), XtRString, "6x13"}, + {XtNdialogFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont4), XtRString, "7x13"}, + {XtNdialogFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont5), XtRString, "8x13"}, + {XtNdialogFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont6), XtRString, "9x15"}, + {XtNdialogFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont7), XtRString, "9x15"}, + {XtNdialogFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont8), XtRString, "9x15"}, + + {XtNdialogBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogBgColor), XtRString, "yellow"}, + {XtNdialogFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogFgColor), XtRString, "black"}, + {XtNidleCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorBgColor), XtRString, "white"}, + {XtNidleCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorFgColor), XtRString, "black"}, + {XtNbusyCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorBgColor), XtRString, "white"}, + {XtNbusyCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorFgColor), XtRString, "black"}, + {XtNginmodeCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColor), XtRString, "black"}, + {XtNginmodeCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColor), XtRString, "white"}, + {XtNginmodeBlinkInterval, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.ginmodeBlinkInterval), XtRImmediate, 0}, + {XtNcrosshairCursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.crosshairCursorColor), XtRString, "red"}, + + {XtNidleCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursor), XtRString, "plus"}, + {XtNbusyCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursor), XtRString, "watch"}, + {XtNginmodeCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursor), XtRString, "full_crosshair"}, + {XtNwarpCursor, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.warpCursor), XtRImmediate, + (caddr_t)DEF_WARPCURSOR}, + {XtNraiseWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.raiseWindow), XtRImmediate, + (caddr_t)DEF_RAISEWINDOW}, + {XtNdeiconifyWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.deiconifyWindow), XtRImmediate, + (caddr_t)DEF_DEICONIFYWINDOW}, + {XtNuseTimers, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useTimers), XtRImmediate, + (caddr_t)DEF_USETIMERS}, + + {XtNcolor0, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color0), XtRString, "black"}, + {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color1), XtRString, "white"}, + {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color2), XtRString, "red"}, + {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color3), XtRString, "green"}, + {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color4), XtRString, "blue"}, + {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color5), XtRString, "cyan"}, + {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color6), XtRString, "yellow"}, + {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color7), XtRString, "magenta"}, + {XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color8), XtRString, "purple"}, + {XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color9), XtRString, "darkslategray"}, + + {XtNcopyOnResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.copyOnResize), XtRImmediate, + (caddr_t)DEF_COPYONRESIZE}, + {XtNcmapName, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cmapName), XtRImmediate, + (caddr_t)"default"}, + {XtNuseGlobalCmap, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useGlobalCmap), XtRImmediate, + (caddr_t)FALSE}, + {XtNcmapInitialize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInitialize), XtRImmediate, + (caddr_t)FALSE}, + {XtNbasePixel, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.base_pixel), XtRImmediate, + (caddr_t)DEF_BASEPIXEL}, + {XtNcmapUpdate, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapUpdate), XtRImmediate, + (caddr_t)DEF_CMAPUPDATE}, + {XtNcmapShadow, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapShadow), XtRImmediate, + (caddr_t)DEF_CMAPSHADOW}, + {XtNcmapInterpolate, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInterpolate), XtRImmediate, + (caddr_t)True}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cacheRasters), XtRImmediate, + (caddr_t)"whenNeeded"}, + {XtNmaxRasters, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxRasters), XtRImmediate, + (caddr_t)MAX_RASTERS}, + {XtNmaxMappings, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxMappings), XtRImmediate, + (caddr_t)MAX_MAPPINGS}, + {XtNmaxColors, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxColors), XtRImmediate, + (caddr_t)DEF_MAXCOLORS}, + + {XtNmarkerTranslations, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_translations), XtRImmediate, + (caddr_t)defaultMarkerTranslations}, + {XtNdefaultMarker, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_defaultMarker), XtRImmediate, + (caddr_t)"rectangle"}, + {XtNnearEdge, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearEdge), XtRImmediate, + (caddr_t)E_DIST}, + {XtNnearVertex, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearVertex), XtRImmediate, + (caddr_t)V_DIST}, + + {XtNmarkerLineWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineWidth), XtRImmediate, + (caddr_t)1}, + {XtNmarkerLineStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineStyle), XtRImmediate, + (caddr_t)LineSolid}, + {XtNmarkerFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_fill), XtRImmediate, + (caddr_t)False}, + {XtNmarkerFillColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillColor), XtRString, + "SlateGray"}, + {XtNmarkerFillBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillBgColor), XtRString, + "black"}, + {XtNmarkerFillStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_fillStyle), XtRImmediate, + (caddr_t)FillSolid}, + {XtNxorFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_xorFill), XtRImmediate, + (caddr_t)False}, + {XtNxorFillColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillColor), XtRImmediate, + (caddr_t)2}, + {XtNxorFillBgColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillBgColor), XtRImmediate, + (caddr_t)255}, + {XtNmarkerHighlightWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_highlightWidth), XtRImmediate, + (caddr_t)2}, + {XtNmarkerHighlightColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_highlightColor), XtRString, + "green"}, + {XtNmarkerCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorFgColor), XtRString, + "yellow"}, + {XtNmarkerCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorBgColor), XtRString, + "black"}, + + {XtNmarkerLineLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineLineColor), XtRString, + "green"}, + {XtNmarkerLineKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineKnotColor), XtRString, + "blue"}, + {XtNmarkerLineKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_LineKnotSize), XtRImmediate, + (caddr_t)5}, + + {XtNmarkerTextLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextLineColor), XtRString, + "green"}, + {XtNmarkerTextColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextColor), XtRString, + "yellow"}, + {XtNmarkerTextBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextBgColor), XtRString, + "SlateGray"}, + {XtNmarkerTextBorder, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_TextBorder), XtRImmediate, + (caddr_t)2}, + {XtNmarkerTextFont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.gm_TextFont), XtRString, + "6x13"}, + {XtNmarkerTextString, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextString), XtRImmediate, + (caddr_t)NULL}, + + {XtNmarkerRectLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectLineColor), XtRString, + "green"}, + {XtNmarkerRectKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectKnotColor), XtRString, + "blue"}, + {XtNmarkerRectKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_RectKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerBoxLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxLineColor), XtRString, + "green"}, + {XtNmarkerBoxKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxKnotColor), XtRString, + "blue"}, + {XtNmarkerBoxKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_BoxKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerCircleLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleLineColor), XtRString, + "green"}, + {XtNmarkerCircleKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleKnotColor), XtRString, + "blue"}, + {XtNmarkerCircleKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_CircleKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerEllipseLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseLineColor), XtRString, + "green"}, + {XtNmarkerEllipseKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColor), XtRString, + "blue"}, + {XtNmarkerEllipseKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_EllipseKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerPgonLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonLineColor), XtRString, + "green"}, + {XtNmarkerPgonKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonKnotColor), XtRString, + "blue"}, + {XtNmarkerPgonKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_PgonKnotSize), XtRImmediate, + (caddr_t)5}, +}; + +/* extern void HandlePopupMenu(); */ +static Boolean SetValues(); +static void Initialize(), Realize(), Destroy(), Redisplay(), Resize(); +static void HandleIgnore(), HandleGraphicsInput(), HandleDisplayCrosshair(); +static void HandleSoftReset(), HandleGraphicsContext(); +static void HandleEnterWindow(), HandleLeaveWindow(); +static void color_crosshair(), color_ginmodeCursor(); +static void HandleTrackCursor(); +static void savepos(), blink_cursor(); +static void mp_linkafter(), mp_unlink(); + +Marker GmSelect(); +static void M_create(), GtMarkerFree(); +static void gm_focusin(), gm_focusout(), gm_refocus(); +static void gm_request_translations(), gm_load_translations(); +static int gm_curpos(); + +static set_default_color_index(); +static inherit_default_colormap(); +static update_default_colormap(); +static update_transients(), update_cursor(); +static request_colormap_focus(), restore_colormap_focus(); +static refresh_source(), refresh_destination(), get_regions(); +static get_rects(), scale_zoom(), scale_intzoom(), scale_boxcar(); +static lw_convolve(), bx_boxcar(), bx_extract(), bx_interp(); +static mf_getpixel(), mf_getinten(); +static scale_lowpass(), scale_nearest(), scale_bilinear(); +static save_mapping(), load_mapping(), get_pixel_mapping(); +static update_mapping(), free_mapping(), valid_mapping(), rect_intersect(); +static initialize_mapping(), draw_crosshair(), erase_crosshair(); +static DrawContext get_draw_context(); +static invalidate_draw_context(); +static XPoint *mapVector(); +static Colormap get_colormap(); +static Cursor get_cursor(); +static void init_iomap(), invalidate_cmap(); +static void gm_rotate_indicator(); /* MF020 */ +static Pixel get_pixel(), *get_cmap_in(), *get_cmap_out(); +static Pixel ColorNameToPixel (); + +/* Global Colormap declarations. + */ +#define CMAPNAME_SIZE 160 + +static char global_cmapname[CMAPNAME_SIZE]; +static Pixel global_cmap[MAX_SZCMAP]; +static XColor global_color[MAX_SZCMAP]; +static int global_ncolors; +static int global_mincolors; +static int SetGlobalCmap(), ParseGlobalCmap(); +static int GetMaxCmapColors(); +static int GetGlobalColors(); +static void SetGlobalColors(); + + +static void NewCachedXImage(); /* MF004 */ +static void DestroyCachedXImage(); /* MF004 */ +static XImage *GetCachedXImage(); /* MF004 */ + + +static char *dbg_wSize(); /* debug utils */ +static char *dbg_visStr(); + +extern double atof(); + + + +static XtActionsRec gtermActionsList[] = { + { "ignore", HandleIgnore }, + { "graphics-input", HandleGraphicsInput }, + { "crosshair", HandleDisplayCrosshair }, + { "track-cursor", HandleTrackCursor }, + { "enter-window", HandleEnterWindow }, + { "leave-window", HandleLeaveWindow }, +/* { "popup-menu", HandlePopupMenu }, */ + { "reset", HandleSoftReset }, + { "m_create", M_create }, +}; + +GtermClassRec gtermClassRec = { + { /* core fields */ + /* superclass */ &widgetClassRec, + /* class_name */ "Gterm", + /* widget_size */ sizeof(GtermRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ gtermActionsList, + /* num_actions */ XtNumber(gtermActionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ (XrmClass)NULL, + /* compress_motion */ True, + /* compress_exposure */ True, + /* compress_enterleave */ True, + /* visible_interest */ False, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultGtermTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass gtermWidgetClass = (WidgetClass) &gtermClassRec; +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +/* + * Widget class procedures. + * -------------------------- + */ + +/* ARGSUSED */ +static void +Initialize (request, new) + Widget request, new; +{ + register GtermWidget w = (GtermWidget)new; + register GC gc; + + XColor fg_color, bg_color; + XFontStruct **fp; + Font cursor_font; + Display *display; + Screen *screen; + Pixel *pp; + int i; + + XVisualInfo info; /* Deep Frame */ + XStandardColormap std, *stdcmaps; + int nstdcmaps; + XColor colors[MAX_SZCMAP]; + char property[128]; + char names[10][15]; + + + for (i=0 ; i < MAX_SZCMAP; i++) + memset (&colors[i], 0, sizeof(XColor)); + + +/* +memset (w, 0, sizeof(GtermWidget)); +*/ + strcpy(names[0],"black"); + strcpy(names[1],"white"); + strcpy(names[2],"red"); + strcpy(names[3],"green"); + strcpy(names[4],"blue"); + strcpy(names[5],"cyan"); + strcpy(names[6],"yellow"); + strcpy(names[7],"magenta"); + strcpy(names[8],"purple"); + strcpy(names[9],"darkslategray"); /* Deep Frame */ + + + + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + w->gterm.display = display = XtDisplay (w); + w->gterm.screen = screen = XtScreen (w); + w->gterm.root = RootWindowOfScreen (screen); + w->gterm.w_depth = DefaultDepth (display, DefaultScreen(display)); + w->gterm.w_visual_class = + DefaultVisual (display, DefaultScreen(display))->class; + + + /* Deep Frame */ + + /* Check if default visual is Pseudo color 8. If so, continue, else + * force a Pseudo 8 visual and new StandardColorMap. + */ + if (XMatchVisualInfo(display, DefaultScreen(display), 8, PseudoColor, + &info)) { + + /* reset some gterm and core values to reflect the new visual */ + w->core.depth = info.depth; + w->gterm.visual = info.visual; + w->gterm.forcePseudo8 = True; + + /* Find the Standard Color Map */ + + /* calculate cmap name */ + /* if default, try to extract name from 'default[n:m,name]' */ +printf ("Gterm.initialize(Pseudo8): cmapName = '%s'\n", w->gterm.cmapName); + if (!strncmp(w->gterm.cmapName,"default",7)) { + char *p; + + if (p=strstr(w->gterm.cmapName,"[")) { + if (p=strstr(p,",")) { + strcpy(global_cmapname,++p); + if (p=strstr(global_cmapname,"]")) { + *p='\0'; /* cut off the last ']' */ + strcpy(w->gterm.cmapName,global_cmapname); + } + } + } + } + + /* if that didn't work, give it a name + if (!strncmp(w->gterm.cmapName,"default",7)) + strcpy(w->gterm.cmapName,"ForcePseudo"); + */ +printf ("Gterm.initialize 2(Pseudo8): cmapName = '%s'\n", w->gterm.cmapName); + + /* create atom */ + sprintf(property, "GT_%s", w->gterm.cmapName); + w->gterm.cmapAtom = XInternAtom (display, property, False); + + w->core.colormap=0; + if (XGetRGBColormaps (display, w->gterm.root, &stdcmaps, &nstdcmaps, + w->gterm.cmapAtom)) { + if (stdcmaps[0].colormap && stdcmaps[0].visualid==info.visualid) { + w->core.colormap = stdcmaps[0].colormap; + w->gterm.base_pixel = stdcmaps[0].base_pixel; + } + } +printf ("Gterm.intialize(Pseudo8): colormap = %d\n", w->core.colormap); + + /* create Standard Color Map */ + if (!w->core.colormap && info.visual) { + w->core.colormap = XCreateColormap (display, w->gterm.root, + info.visual, AllocAll); + + /* Set the Static Colors */ +printf ("Gterm.intialize(Pseudo8): setting static colors\n"); + for (i=0; i < SZ_STATIC_CMAP; i++) { + colors[i].pixel = i; + XParseColor(display, w->core.colormap, names[i], &colors[i]); + } + XStoreColors (display, w->core.colormap, colors, SZ_STATIC_CMAP); + + /* save Standard Color Map */ + std.colormap = w->core.colormap; + std.red_max = 1; + std.red_mult = 0; + std.green_max = std.green_mult = 0; + std.blue_max = std.blue_mult = 0; + std.base_pixel = w->gterm.base_pixel; + std.visualid = info.visualid; + std.killid = 0; + XSetRGBColormaps (display, w->gterm.root, &std, 1, + w->gterm.cmapAtom); + XSetCloseDownMode (display, RetainPermanent); + } + + /* Fix Color Related Resources */ + + w->gterm.dialogBgColor = + ColorNameToPixel (w, w->gterm.dialogBgColorStr); + w->gterm.dialogFgColor = + ColorNameToPixel (w, w->gterm.dialogFgColorStr); + + w->gterm.idleCursorBgColor = + ColorNameToPixel (w, w->gterm.idleCursorBgColorStr); + w->gterm.idleCursorFgColor = + ColorNameToPixel (w, w->gterm.idleCursorFgColorStr); + + w->gterm.busyCursorBgColor = + ColorNameToPixel (w, w->gterm.busyCursorBgColorStr); + w->gterm.busyCursorFgColor = + ColorNameToPixel (w, w->gterm.busyCursorFgColorStr); + + w->gterm.ginmodeCursorBgColor = + ColorNameToPixel (w, w->gterm.ginmodeCursorBgColorStr); + w->gterm.ginmodeCursorFgColor = + ColorNameToPixel (w, w->gterm.ginmodeCursorFgColorStr); + w->gterm.crosshairCursorColor = + ColorNameToPixel (w, w->gterm.crosshairCursorColorStr); + + w->gterm.color0 = ColorNameToPixel (w, w->gterm.color0Str); + w->gterm.color1 = ColorNameToPixel (w, w->gterm.color1Str); + w->gterm.color2 = ColorNameToPixel (w, w->gterm.color2Str); + w->gterm.color3 = ColorNameToPixel (w, w->gterm.color3Str); + w->gterm.color4 = ColorNameToPixel (w, w->gterm.color4Str); + w->gterm.color5 = ColorNameToPixel (w, w->gterm.color5Str); + w->gterm.color6 = ColorNameToPixel (w, w->gterm.color6Str); + w->gterm.color7 = ColorNameToPixel (w, w->gterm.color7Str); + w->gterm.color8 = ColorNameToPixel (w, w->gterm.color8Str); + w->gterm.color9 = ColorNameToPixel (w, w->gterm.color9Str); + + w->gterm.gm_fillColor = + ColorNameToPixel (w, w->gterm.gm_fillColorStr); + w->gterm.gm_fillBgColor = + ColorNameToPixel (w, w->gterm.gm_fillBgColorStr); + + w->gterm.gm_highlightColor = + ColorNameToPixel (w, w->gterm.gm_highlightColorStr); + + w->gterm.gm_cursorFgColor = + ColorNameToPixel (w, w->gterm.gm_cursorFgColorStr); + w->gterm.gm_cursorBgColor = + ColorNameToPixel (w, w->gterm.gm_cursorBgColorStr); + + w->gterm.gm_LineLineColor = + ColorNameToPixel (w, w->gterm.gm_LineLineColorStr); + w->gterm.gm_LineKnotColor = + ColorNameToPixel (w, w->gterm.gm_LineKnotColorStr); + + w->gterm.gm_TextLineColor = + ColorNameToPixel (w, w->gterm.gm_TextLineColorStr); + w->gterm.gm_TextColor = + ColorNameToPixel (w, w->gterm.gm_TextColorStr); + w->gterm.gm_TextBgColor = + ColorNameToPixel (w, w->gterm.gm_TextBgColorStr); + + w->gterm.gm_RectLineColor = + ColorNameToPixel (w, w->gterm.gm_RectLineColorStr); + w->gterm.gm_RectKnotColor = + ColorNameToPixel (w, w->gterm.gm_RectKnotColorStr); + + w->gterm.gm_BoxLineColor = + ColorNameToPixel (w, w->gterm.gm_BoxLineColorStr); + w->gterm.gm_BoxKnotColor = + ColorNameToPixel (w, w->gterm.gm_BoxKnotColorStr); + + w->gterm.gm_CircleLineColor = + ColorNameToPixel (w, w->gterm.gm_CircleLineColorStr); + w->gterm.gm_CircleKnotColor = + ColorNameToPixel (w, w->gterm.gm_CircleKnotColorStr); + + w->gterm.gm_EllipseLineColor = + ColorNameToPixel (w, w->gterm.gm_EllipseLineColorStr); + w->gterm.gm_EllipseKnotColor = + ColorNameToPixel (w, w->gterm.gm_EllipseKnotColorStr); + + w->gterm.gm_PgonLineColor = + ColorNameToPixel (w, w->gterm.gm_PgonLineColorStr); + w->gterm.gm_PgonKnotColor = + ColorNameToPixel (w, w->gterm.gm_PgonKnotColorStr); + + /* let gterm know what we have done */ + /* will be reset later on, but put here for clarity */ + w->gterm.useDefaultCM = False; + w->gterm.useGlobalCmap = False; + w->gterm.haveColormap = True; + w->gterm.cmapInitialize = False; + + + } else { + XVisualInfo *vp, template; + int nvis; + + memset (&template, 0, sizeof (template)); + template.class = TrueColor; + + vp = XGetVisualInfo (display, VisualClassMask, &template, &nvis); + +fprintf (stderr, "NO 8-bit PSEUDO FOUND.....USING TRUECOLOR\n"); +fprintf (stderr, "nvis=%d defDepth=%d\n", nvis, w->gterm.w_depth); + + + + + + w->gterm.useDefaultCM = 1; + w->gterm.haveColormap = 0; + + w->gterm.forcePseudo8 = False; + } + +printf ("Gterm.intialize: forcePseudo8 = %d\n\n", w->gterm.forcePseudo8); + /* Deep Frame */ + + + XtVaSetValues ((Widget)w, XtNbackground, (XtArgVal)w->gterm.color0, NULL); + + /* Initialize color map. */ +/* +*/ + pp = &w->gterm.color0; + w->gterm.cmap = (Pixel *)XtCalloc(MAX_SZCMAP, sizeof(Pixel)); + w->gterm.color = (XColor *)XtCalloc(MAX_SZCMAP, sizeof(XColor)); + + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors (display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + +/* +fprintf(stderr, "Gterm.initialize: iomap[] and cmap[]\n"); +for (i=0; i < 256; i++) + fprintf(stderr, "%3d: %3d %3d\n", i, w->gterm.iomap[i], w->gterm.cmap[i]); +*/ + + /* if we have not yet allocated any colors ... The SetGlobalCmap() + ** function returns zero when useGlobalCmap is disabled, but it also + ** allocates the gterm.cmap and gterm.color pointers in this case. + */ + if (SetGlobalCmap(w) == 0) { + pp = &w->gterm.color0; + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors(display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + } else { + /* in the case of a default colormap, we might already have color + * cells. + */ + w->gterm.ncolors = GetGlobalColors (); + } + w->gterm.useDefaultCM = ParseGlobalCmap (w); + +printf ("Gterm.intialize: ncolors=%d useDefaultCM=%d\n", + w->gterm.ncolors, w->gterm.useDefaultCM); + + + + w->gterm.useDefaultCM = (strcmp (w->gterm.cmapName, "default") == 0); + w->gterm.haveColormap = w->gterm.useDefaultCM; + w->gterm.cmapLastUpdate = 0; + w->gterm.cmapLastShadow = 0; + w->gterm.in_window = 0; + w->gterm.n_wmWindows = 0; /* MF012 */ + + + if (DBG_TRACE) + fprintf (stderr,"Gterm.intialize: Clearing pixmaps and drawables ...."); + /* Get clear pixmap GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color0); + w->gterm.clearGC = gc; + XSetGraphicsExposures (display, gc, 0); /* MF029 */ + + /* Get expose GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + w->gterm.exposeGC = gc; + XSetGraphicsExposures (display, gc, 0); /* MF029 */ + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.dialogBgColor); + XSetForeground (display, gc, w->gterm.dialogFgColor); + /* XSetFunction (display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + if (DBG_TRACE) + fprintf (stderr,"done.\n"); + + /* Get special cursors. */ + if (DBG_TRACE) + fprintf (stderr,"Gterm.intialize: Getting cursors ...."); + bg_color.pixel = w->gterm.idleCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.idleCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.idle_cursor = get_cursor (w, w->gterm.idleCursor); + XRecolorCursor (display, w->gterm.idle_cursor, &fg_color, &bg_color); + /* MF030 */ + + bg_color.pixel = w->gterm.busyCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.busyCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.busy_cursor = get_cursor (w, w->gterm.busyCursor); + XRecolorCursor (display, w->gterm.busy_cursor, &fg_color, &bg_color); + /* MF030 */ + + bg_color.pixel = w->gterm.color0; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, w->core.colormap, &fg_color); + cursor_font = XLoadFont (display, "cursor"); + w->gterm.crosshair_cursor = XCreateGlyphCursor (display, + cursor_font, cursor_font, XC_crosshair, XC_crosshair, + &fg_color, &bg_color); + + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + if (strcmp (w->gterm.ginmodeCursor, "full_crosshair") != 0) { + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + XRecolorCursor (display, + w->gterm.ginmode_cursor, &fg_color, &bg_color); /* MF030 */ + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + } else + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, "full_crosshair") == 0); + if (DBG_TRACE) + fprintf (stderr,"done.\n"); + + + + /* Make sure we have all the fonts we need. */ + if (DBG_TRACE) + fprintf (stderr,"Gterm.intialize: Intiializing fonts ...."); + for (fp = &w->gterm.alphaFont1, i=0; i < NAlphaFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.alpha_fonts[i] = *fp; + } + for (fp = &w->gterm.dialogFont1, i=0; i < NDialogFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.dialog_fonts[i] = *fp; + } + if (DBG_TRACE) fprintf (stderr,"done.\n"); + + + + /* Raster initialization. */ + w->gterm.rasters = NULL; + w->gterm.nrasters = 0; + w->gterm.mappings = NULL; + w->gterm.nmappings = 0; + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + w->gterm.colormaps = NULL; + w->gterm.wa_defined = 0; + memset ((char *)&w->gterm.draw, 0, sizeof (struct drawContext)); + + /* Marker initialization. */ + w->gterm.gm_head = NULL; + w->gterm.gm_tail = NULL; + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.defTranslations = NULL; + w->gterm.nauxTrans = 0; + w->gterm.gm_defTranslations = NULL; + w->gterm.gm_curTranslations = NULL; + w->gterm.gm_reqTranslations = NULL; + w->gterm.gm_timer_id = (XtIntervalId) NULL; + w->gterm.gm_initialized = False; + + /* Set defaults (some of these are clobbered anyway by Realize/Resize). */ + w->gterm.raster = 0; + w->gterm.cur_x = 0; + w->gterm.cur_y = 0; + w->gterm.last_x = 0; + w->gterm.last_y = 0; + w->gterm.cursor_drawn = 0; + w->gterm.cursor_type = GtIdleCursor; + w->gterm.pixmap = (Pixmap)NULL; + w->gterm.d_pixmap = (Pixmap)NULL; + w->gterm.preserve_screen = 0; + w->gterm.preserve_valid = 0; + w->gterm.d_saved = 0; + w->gterm.alpha_font = DefaultAlphaFont; + w->gterm.dialog_font = DefaultDialogFont; + w->gterm.optcols = 80; + w->gterm.optrows = 35; + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + + /* Deep Frame + set_default_color_index (w); + Deep Frame */ + + /* Disable input until window is ready. */ + w->gterm.delay = 1; + + + if (DBG_TRACE) + fprintf (stderr, "Initialize[%s] RETURNING\n\n", dbg_wSize(w)); +} + +static void +Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + GtermWidget w = (GtermWidget) gw; + GC gc; + + + + if (DEBUG_TRACE) + fprintf (stderr, "Realize[%s] ENTER:\n", dbg_wSize(w)); + + /* Set default window size. */ + XtMakeResizeRequest (gw, w->core.width, w->core.height, + &w->core.width, &w->core.height); + + /* Should define pseudocolor visual here, if truecolor or directcolor + * default visual. + */ + + /* Create graphics window. */ /* Deep Frame */ + if (w->gterm.forcePseudo8) /* force Pseudo 8 visual */ + XtCreateWindow (gw, InputOutput, w->gterm.visual, *valueMask, attrs); + + else /* Default Visual is Pseudo */ + XtCreateWindow (gw, InputOutput, (Visual *)CopyFromParent, *valueMask, + attrs); /* Deep Frame */ + + + w->gterm.window = XtWindow (gw); + w->gterm.old_width = w->gterm.xres = w->core.width; + w->gterm.old_height = w->gterm.yres = w->core.height; + + + /* Deep Frame */ + /* Define GC here, so that we have a Drawable at the proper depth */ + + /* Get clear pixmap GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.color0); + w->gterm.clearGC = gc; +/* XSetGraphicsExposures (w->gterm.display, gc, 0); /* MF029 */ + + /* Get expose GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + w->gterm.exposeGC = gc; +/* XSetGraphicsExposures (w->gterm.display, gc, 0); /* MF029 */ + + /* Get graphics drawing GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.color1); + XSetLineAttributes (w->gterm.display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.dialogBgColor); + XSetForeground (w->gterm.display, gc, w->gterm.dialogFgColor); + /* XSetFunction (w->gterm.display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (w->gterm.display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + set_default_color_index (w); + if (w->gterm.forcePseudo8) { + XInstallColormap (w->gterm.display, w->core.colormap); + request_colormap_focus (w); + } + /* Deep Frame */ + + + GtRasterInit (w); + GtMarkerInit (w); + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = w->gterm.idle_cursor); + + Resize (gw); + + + if (DEBUG_TRACE) + fprintf (stderr, "Realize[%s] DONE:\n", dbg_wSize(w)); +} + +static void +Destroy (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb, *cb_next; + Display *display = w->gterm.display; + + + + if (DEBUG_TRACE) + fprintf (stderr, "Destroy[%s] ENTER:\n", dbg_wSize(w)); + + + /* Get rid of any raster stuff. */ + GtRasterInit (w); /* MF008 */ + XtFree ((char *)w->gterm.rasters); + XtFree ((char *)w->gterm.mappings); + + /* Destroy any markers. */ + GtMarkerFree (w); + + /* Can't use XtDestroyGC here; the source says it is broken and will + * work only for applications that have only 1 display, and we have 2. + * Also the documentation in Asente&Swick documents the calling sequence + * incorrectly. + */ + XFreeGC (display, w->gterm.clearGC); + XFreeGC (display, w->gterm.exposeGC); + XFreeGC (display, w->gterm.drawGC); + XFreeGC (display, w->gterm.dialogGC); + XFreeGC (display, w->gterm.cursorGC); + + /* This one also proves problematic. When there are multiple gterm + * widgets allocating the same cursor, succeeding calls for the same + * cursor return the same cursor ID. When these widgets are later + * destroyed, the first XFreeCursor succeeds but subsequent ones find + * the referenced cursor undefined and the application boms with a + * BadCursor error. This must be some problem with reference counts + * in the X server. Cursors use minor amounts of resources and they + * will probably be freed anyway when the display is closed, so we just + * leave them defined here. + * + XFreeCursor (display, w->gterm.idle_cursor); + XFreeCursor (display, w->gterm.busy_cursor); + XFreeCursor (display, w->gterm.crosshair_cursor); + if (w->gterm.ginmode_cursor != w->gterm.crosshair_cursor) + XFreeCursor (display, w->gterm.ginmode_cursor); + */ + + if (w->gterm.pixmap) + XFreePixmap (w->gterm.display, w->gterm.pixmap); + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + + /* Destroy callback lists. */ + for (cb = w->gterm.resetCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.resizeCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.inputCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + XtFree (w->gterm.ginmodeCursor); + + if (DEBUG_TRACE) + fprintf (stderr, "Destroy[%s] DONE:\n", dbg_wSize(w)); +} + +static void +Resize (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb; + int char_width, char_height, char_base; + int bestfont, fonterr, dx, dy, i; + unsigned int width, height, u_junk; + GtCallback cbl[128]; + XFontStruct *fp; + int ncb, junk; + Pixmap pixmap; + Window root; + + if (!w || !XtIsRealized(gw)) + return; + + + if (DEBUG_TRACE) + fprintf (stderr, "Resize[%s] ENTER:\n", dbg_wSize(w)); + + + /* Create new pixmap. + */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width + 1, w->core.height + 1, w->core.depth); + if (pixmap) + XFillRectangle (w->gterm.display, pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + + /* Copy old pixmap into new and free old pixmap. */ + if (w->gterm.pixmap) { + XGetGeometry (w->gterm.display, w->gterm.pixmap, + &root, &junk, &junk, &width, &height, &u_junk, &u_junk); + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.copyOnResize) + XCopyArea (w->gterm.display, w->gterm.pixmap, pixmap, + w->gterm.exposeGC, 0, 0, width-1, height-1, 0, 0); + XFreePixmap (w->gterm.display, w->gterm.pixmap); + } + + /* Install new pixmap. */ + w->gterm.pixmap = pixmap; + w->gterm.preserve_valid = 0; + + /* Redraw window. */ + if (w->gterm.pixmap) { + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, 0, 0, w->core.width, w->core.height, 0, 0); + } + + /* Pick best alpha font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NAlphaFonts; i++) { + fp = w->gterm.alpha_fonts[i]; + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + dx = (((int)w->core.width / char_width) - w->gterm.optcols) * 2; + dy = ((int)w->core.height / char_height) - w->gterm.optrows; + if (abs(dx) + abs(dy) < fonterr) { + bestfont = i; + fonterr = abs(dx) + abs(dy); + } + } + + w->gterm.alpha_font = bestfont; + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + XSetFont (w->gterm.display, w->gterm.drawGC, fp->fid); + + /* Pick best dialog font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NDialogFonts; i++) { + fp = w->gterm.dialog_fonts[i]; + char_width = fp->max_bounds.width; + dx = ((int)w->core.width / char_width) - 80; + if (abs(dx) < fonterr) { + bestfont = i; + fonterr = abs(dx); + } + } + + w->gterm.dialog_font = bestfont; + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + char_base = fp->max_bounds.ascent; + + w->gterm.d_xoff = 2; + w->gterm.d_yoff = w->core.height - char_height - 2; + w->gterm.d_height = char_height; + XSetFont (w->gterm.display, w->gterm.dialogGC, fp->fid); + + /* Create dialog save area pixmap. */ + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + w->gterm.d_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, char_height, w->core.depth); + w->gterm.d_saved = 0; + + /* Adjust cursor position to allow for change in window size. */ + w->gterm.cur_x = w->gterm.cur_x * (int)w->core.width / w->gterm.old_width; + w->gterm.cur_y = w->gterm.cur_y * (int)w->core.height / w->gterm.old_height; + w->gterm.old_width = w->core.width; + w->gterm.old_height = w->core.height; + if (w->gterm.cursor_type == GtGinmodeCursor) { + XWarpPointer (w->gterm.display, w->gterm.window, w->gterm.window, + 0,0,0,0, w->gterm.cur_x, w->gterm.cur_y); + update_cursor (w); + } + + /* Raster descriptor 0 must track the window size. */ + if (w->gterm.rasters) { + Raster rp = &w->gterm.rasters[0]; + rp->width = w->core.width; + rp->height = w->core.height; + } + + /* Mark gterm widget ready for further client input. */ + w->gterm.delay = 0; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resizeCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w); + + + if (DEBUG_TRACE) { + fprintf (stderr, "Resize[%s] DONE:\n", dbg_wSize(w)); + } +} + +/* ARGSUSED */ +static void +Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register GtermWidget w = (GtermWidget) gw; + register XExposeEvent *ev = (XExposeEvent *)event; + int x, y, width, height; + + if (!w || !XtIsRealized (gw)) + return; + + if (DEBUG_TRACE) + fprintf (stderr, "Redisplay[%s]: ENTER\n", dbg_wSize(w)); + + if (event) { + x = ev->x; + y = ev->y; + width = ev->width; + height = ev->height; + } else { + x = 0; + y = 0; + width = w->core.width; + height = w->core.height; + } + + if (w->gterm.pixmap) { + /* Clipping with the region argument does not work properly with + * the OpenLook server for some reason - the clip region is one + * pixel too small on the right and bottom. Until the reason for + * this becomes clear, we use the bounding box provided in the + * Expose event to roughly clip the refresh. + * + XSetClipOrigin (w->gterm.display, w->gterm.exposeGC, 0, 0); + XSetRegion (w->gterm.display, w->gterm.exposeGC, region); + */ + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, x, y, width, height, x, y); + } + + update_transients (w, region); + + /* A dummy expose event is used to ensure that the resize delay is + * cleared, in the event that the resize request is not granted. + */ + if (ev && ev->send_event) + w->gterm.delay = 0; + + if (DEBUG_TRACE) + fprintf (stderr, "Redisplay[%s] DONE:\n", dbg_wSize(w)); +} + +/* ARGSUSED */ +static Boolean +SetValues (current, request, set) + Widget current, request, set; +{ + GtermWidget old = (GtermWidget) current; + GtermWidget req = (GtermWidget) request; + register GtermWidget w = (GtermWidget) set; + Display *display = w->gterm.display; + Boolean redisplay = False; + register GC gc; + + if (old->gterm.dialogBgColor != req->gterm.dialogBgColor) { + gc = w->gterm.dialogGC; + XSetBackground (display, gc, w->gterm.dialogBgColor); + } + if (old->gterm.dialogFgColor != req->gterm.dialogFgColor) { + gc = w->gterm.dialogGC; + XSetForeground (display, gc, w->gterm.dialogFgColor); + } + + if (old->gterm.ginmodeCursor != req->gterm.ginmodeCursor) { + static char *full_crosshair = "full_crosshair"; + + XtFree (old->gterm.ginmodeCursor); + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + + erase_crosshair (w); + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, full_crosshair) == 0); + + if (w->gterm.full_crosshair) { + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + color_crosshair (w); + } else { + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + color_ginmodeCursor (w); + } + + if (w->gterm.cursor_type == GtGinmodeCursor && w->core.visible) + XDefineCursor (display, w->gterm.window, + w->gterm.cursor = w->gterm.ginmode_cursor); + } + + if (old->gterm.crosshairCursorColor != req->gterm.crosshairCursorColor) { + color_crosshair (w); + } + + if (old->gterm.ginmodeCursorBgColor != req->gterm.ginmodeCursorBgColor || + old->gterm.ginmodeCursorFgColor != req->gterm.ginmodeCursorFgColor) { + color_ginmodeCursor (w); + } + + return (XtIsRealized(current) ? redisplay : False); +} + +static void +color_crosshair (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + register GC gc; + + erase_crosshair (w); + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.color0; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, defcmap, &fg_color); + + gc = w->gterm.cursorGC; + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XRecolorCursor (display, w->gterm.crosshair_cursor, &fg_color, &bg_color); + + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + + update_cursor (w); +} + +static void +color_ginmodeCursor (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, defcmap, &fg_color); + + XRecolorCursor (display, w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; +} + +/* + * Action procedures. + * ----------------------- + */ + +/* ARGSUSED */ +static void HandleIgnore (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* ignore an event */ +} + +/* ARGSUSED */ +static void HandleGraphicsInput (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.inputCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, event); +} + +/* ARGSUSED */ +static void HandleDisplayCrosshair (widget, event, params, nparams) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *nparams; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XButtonEvent *ev = &event->xbutton; + + /* Ignore if cursor is in a marker. */ + if (w->gterm.gm_active) + return; + + if (*nparams && strcmp (params[0], "on") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.crosshair_cursor); + draw_crosshair (w, ev->x, ev->y); + } else if (*nparams && strcmp (params[0], "off") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, w->gterm.cursor); + } +} + +/* ARGSUSED */ +static void HandleTrackCursor (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XMotionEvent *ev = &event->xmotion; + gmSelection what; + Marker gm; + + savepos (w, (XEvent *)ev); + + if ((gm = GmSelect (w, ev->x, ev->y, &what))) + gm_focusin (w, gm, &what); + else if (w->gterm.gm_active) + gm_focusout (w, 1); + + if (w->gterm.cursor_type == GtGinmodeCursor) + if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, ev->x, ev->y); + + /* Flushing here keeps cursor tracking synchronous and tends + * to aid motion compression, by preventing crosshair draw + * requests from being queued up for transmission to the + * server. + */ + XFlush (w->gterm.display); + + } else { + w->gterm.cur_x = ev->x; + w->gterm.cur_y = ev->y; + } +} + +/* ARGSUSED */ +static void HandleEnterWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XEnterWindowEvent *ev = (XEnterWindowEvent *) event; + + /* Deep Frame */ + if (!w->gterm.useDefaultCM && w->gterm.haveColormap && + !w->gterm.forcePseudo8) { + + int update = w->gterm.cmapUpdate; + + /* To avoid excessive server queries the colormap is only updated + * every so often. Updating is disabled if cmapUpdate is set to zero. + if (update && ev->time - w->gterm.cmapLastUpdate > update * 1000) { + */ + if (update) { + inherit_default_colormap (w); + w->gterm.cmapLastUpdate = ev->time; + } + + /* Advise the window manager to load our colormap. */ + request_colormap_focus (w); + } + + w->gterm.in_window++; +} + +/* ARGSUSED */ +static void HandleLeaveWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XLeaveWindowEvent *ev = (XLeaveWindowEvent *) event; + +/*printf ("HandleLeaveWindow....");*/ + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int shadow = w->gterm.cmapShadow; + + /* The shadow option matches unused cells in the default colormap + * with the colors in our custom colormap. + if (shadow && ev->time - w->gterm.cmapLastShadow > shadow * 1000) { + */ + if (shadow) { + update_default_colormap (w); + w->gterm.cmapLastShadow = ev->time; + } + +/*printf ("restoring focus....");*/ + restore_colormap_focus (w); + } +/*printf ("\n");*/ + + w->gterm.in_window = 0; +} + +/* ARGSUSED */ +static void HandleSoftReset (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + GtReset (w); + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resetCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, NULL); +} + + +/* + * GRAPHICS routines (public functions). + * -------------------------------------- + */ + +GtActivate (w) + GtermWidget w; +{ + w->gterm.interactive = 0; + w->gterm.save_x = w->gterm.save_y = 0; +} + +GtDeactivate (w) + GtermWidget w; +{ + Display *display = w->gterm.display; + Window window = w->gterm.window; + + if (w->gterm.interactive) { + if (w->gterm.save_x > 0 && w->gterm.save_y > 0) { + if (w->gterm.warpCursor) { + /* Workaround X server bug. */ + if (w->gterm.root != w->gterm.save_root) + XWarpPointer (display,None,w->gterm.root, 0,0,0,0, + WidthOfScreen(w->gterm.screen) - 1, + HeightOfScreen(w->gterm.screen) - 1); + + /* Move pointer to saved position. */ + XWarpPointer (display, None, w->gterm.save_root, + 0,0,0,0, w->gterm.save_x, w->gterm.save_y); + } + w->gterm.save_x = 0; + w->gterm.save_y = 0; + } + w->gterm.interactive = 0; + } +} + +GtReady (w) + GtermWidget w; +{ + return (w->gterm.delay == 0); +} + +GtReset (w) + GtermWidget w; +{ + invalidate_draw_context (w); + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapButt, JoinMiter); + + /* Set defaults. */ + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.raster = 0; +} + +GtTimerInhibit (w, state) + GtermWidget w; + Boolean state; +{ + /* This is a kludge to allow a client (xgterm) to disable use of timers + * if they don't work in a given implementation. + */ + w->gterm.useTimers = !state; +} + +GtAugmentTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_augment; + w->gterm.nauxTrans++; + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtOverrideTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_override; + w->gterm.nauxTrans++; + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtFlush (w) + GtermWidget w; +{ + XFlush (w->gterm.display); +} + +GtSetLogRes (w, width, height) + GtermWidget w; + int width, height; +{ + w->gterm.xres = width; + w->gterm.yres = height; +} + +GtGetLogRes (w, width, height) + GtermWidget w; + int *width, *height; +{ + *width = w->gterm.xres; + *height = w->gterm.yres; +} + +GtGetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; /* zero for screen size */ + int *width, *height; +{ + if (raster) { + register Raster rp = &w->gterm.rasters[raster]; + *width = rp->width; + *height = rp->height; + } else { + *width = w->core.width; + *height = w->core.height; + } +} + +GtSetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; + int width, height; +{ + GtCreateRaster (w, raster, GtServer, width, height, RasterDepth); +} + +GtSetRaster (w, raster) + GtermWidget w; + int raster; +{ + if (raster >= 0 && raster < w->gterm.maxRasters) { + w->gterm.raster = raster; + invalidate_draw_context (w); + } +} + +GtGetRaster (w) + GtermWidget w; +{ + return (w->gterm.raster); +} + +/* ARGSUSED */ +GtSetTextRes (w, optrows, optcols) + GtermWidget w; + int optrows, optcols; +{ + w->gterm.optrows = optrows; + w->gterm.optcols = optcols; +} + +/* ARGSUSED */ +GtSetCharSize (w, ival) + GtermWidget w; + int ival; +{ +} + +GtSetDataLevel (w, ival) + GtermWidget w; + int ival; +{ + invalidate_draw_context (w); + + switch (ival) { + case GtSet: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[w->gterm.color_index]); + w->gterm.data_level = ival; + break; + case GtClear: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color0); + w->gterm.data_level = ival; + break; + case GtInvert: + /* This probably won't work correctly but leave it for now... */ + XSetFunction (w->gterm.display, w->gterm.drawGC, GXxor); + w->gterm.data_level = ival; + break; + } +} + + +GtSetLineWidth (w, ival) + GtermWidget w; + int ival; +{ + w->gterm.line_width = ival; + GtSetLineStyle (w, w->gterm.line_style); +} + +#define Dashed "\010\003" +#define Dotted "\002\003" +#define DashDot "\016\003\001\003" +#define Dash3Dot "\024\003\001\003\001\003\001\003" + +GtSetLineStyle (w, ival) + GtermWidget w; + int ival; +{ + int line_width = w->gterm.line_width; + int line_style = LineSolid; + int cap_style = CapButt; + int join_style = JoinMiter; + int dash_offset = 0; + char *dash_list = NULL; + int dash_list_length = 0; + + switch (ival) { + case GtSolid: + w->gterm.line_style = ival; + break; + case GtDashed: + line_style = LineOnOffDash; + dash_list = (char *)Dashed; + dash_list_length = strlen(Dashed); + w->gterm.line_style = ival; + break; + case GtDotted: + line_style = LineOnOffDash; + dash_list = (char *)Dotted; + dash_list_length = strlen(Dotted); + w->gterm.line_style = ival; + break; + case GtDashDot: + line_style = LineOnOffDash; + dash_list = (char *)DashDot; + dash_list_length = strlen(DashDot); + w->gterm.line_style = ival; + break; + case GtDash3Dot: + line_style = LineOnOffDash; + dash_list = (char *)Dash3Dot; + dash_list_length = strlen(Dash3Dot); + w->gterm.line_style = ival; + break; + } + + if (dash_list_length) + XSetDashes (w->gterm.display, w->gterm.drawGC, dash_offset, dash_list, + dash_list_length); + + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, line_width, line_style, cap_style, join_style); + + invalidate_draw_context (w); +} + +GtSetColorIndex (w, ival) + GtermWidget w; + int ival; +{ + register int color = w->gterm.iomap[ival]; + + if (color >= 0 && color < w->gterm.ncolors) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[color]); + w->gterm.color_index = color; + invalidate_draw_context (w); + } +} + +GtSetFillType (w, ival) + GtermWidget w; + int ival; +{ + switch (ival) { + case GtSolid: + case GtOutline: + w->gterm.fill_type = ival; + break; + } +} + +GtClearScreen (w) +GtermWidget w; +{ + register Mapping mp; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) + XFillRectangle (w->gterm.display, w->gterm.pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + XClearWindow (w->gterm.display, w->gterm.window); + + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color1); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapRound, JoinRound); + + w->gterm.line_width = 1; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.data_level = GtSet; + w->gterm.preserve_valid = 0; + w->gterm.gm_redisplay = 1; + w->gterm.d_saved = 0; + + /* Mark any screen mappings to be unconditionally refreshed. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp->enabled && mp->dst == 0) + mp->refresh++; + + invalidate_draw_context (w); + update_transients (w, NULL); +} + +GtDrawPolyline (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolymarker (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawPoints (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawPoints (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolygon (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + if (w->gterm.fill_type == GtOutline) { + /* Draw outline of region. + */ + int first = 0; + int last = npts - 1; + + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + + if (points[last].x != points[first].x || + points[last].y != points[first].y) { + + if (mx->use_backing_store) + XDrawLine (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + XDrawLine (w->gterm.display, mx->pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + } + } else { + /* Fill the outlined area. + */ + if (mx->use_backing_store) { + XFillPolygon (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + XFillPolygon (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + } + + update_transients (w, (Region)NULL); +} + +GtDrawMarker (w, x, y, xsize, ysize, type) + GtermWidget w; + int x, y; + int xsize, ysize; + int type; +{ +} + +GtBell (w) + GtermWidget w; +{ + XBell (w->gterm.display, 0); +} + + +/* GtSetCursorPos -- Set the cursor position to the given coordinates X,Y. + * Coordinates are specified in the current graphics coordinate system, + * defined by the current raster and logical resolution. + * + * This routine is a little more complex than one might think due to the + * complication of mappings. Screen coordinates are required to set the + * cursor, but the graphics drawing context may be defined relative to + * any raster. In the general case a graphics pipeline defines the series + * of coordinate transformations required to transform from graphics + * coordinates to screen coordinates. Things are further complicated since + * the pipeline or desired position may not map to the screen, or there + * may be multiple mappings to the screen. The first case (no mapping to + * the screen) is dealt with by ignoring the request to warp the cursor. + * The second case (one-to-many mapping) is dealt with by a heuristic: + * the most recent screen coordinates are unmapped back to the raster we + * are "drawing" into, defining a unique path through the mappings which + * we can use to map back to the screen. + * + * The simplest case occurs when we are drawing directly into the screen. + * In this case (raster=0) there may still be a logical to physical + * coordinate transformation, but there are no mappings to complicate things. + */ +GtSetCursorPos (w, x, y) + GtermWidget w; + int x, y; +{ + register MappingContext mx; + register DrawContext dx; + register Mapping mp; + + Window window = w->gterm.window; + int sv_raster = w->gterm.raster; + int sv_xres = w->gterm.xres, sv_yres = w->gterm.yres; + int rasters[256], mappings[256], nmap=0, ntrans=0; + int rx, ry, src, dst, map, i, npts = 1; + int raster = w->gterm.raster; + XPoint pv1[1], pv2[2]; + XPoint *points, pv[1]; + Raster rp; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Follow the current cursor position back to the source raster if + * possible. This gives us a default pipeline to follow in the reverse + * direction to map raster coordinates to screen coordinates, and is + * necessary to find the right mappings when multiple mappings are + * defined on a single source. + */ + rx = w->gterm.last_x; + ry = w->gterm.last_y; + src = 0; + do { + src = GtSelectRaster (w, dst=src, GtPixel,rx,ry, GtPixel,&rx,&ry,&map); + if (src != dst) { + rasters[nmap] = src; + mappings[nmap++] = map; + } + } while (src != dst && src != raster); + + /* Ray trace the point through all of the mappings to the screen. + * This isn't fully general, but gives us the capability to follow + * most graphics pipelines to a point on the screen. + */ + do { + GtSetRaster (w, raster); + if (ntrans++ || raster == 0) { /* MF041 */ + /* After the first transformation we have raster coordinates, + * so set the logical resolution to the raster dimensions. + */ + rp = &w->gterm.rasters[raster]; + GtSetLogRes (w, rp->width, rp->height); + } + + dx = get_draw_context (w); + if (!dx->nmappings) + return; + + /* Try to find the next mapping. */ + if (nmap && rasters[nmap-1] == raster) + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->mapping == mappings[nmap-1]) { + mp = mx->mp; + nmap--; + goto havemap; + } + } + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + mp = mx->mp; + if (mp && mp->dst == 0) + break; + } + if (i >= dx->nmappings) { + mx = &dx->mapContext[0]; + mp = mx->mp; + } + +havemap: + rp = &w->gterm.rasters[mp ? mp->dst : raster]; + + /* Compute the coordinates points[0].{x,y} of the point x,y in the + * destination raster. + */ + if (mx->scale) { + /* Scaling is in effect. The following subterfuge is used to + * compute the coordinates of the center of the raster pixel (x,y) + * when the image is zoomed. We want to set the cursor to the + * center of the selected pixel, not the edge. + */ + pv[0].x = x; pv[0].y = y; + mapVector (mx, pv, pv1, npts); + pv[0].x = x + 1; pv[0].y = y + 1; + mapVector (mx, pv, pv2, npts); + + pv[0].x = (pv1[0].x + pv2[0].x) / 2.0; + pv[0].y = (pv1[0].y + pv2[0].y) / 2.0; + points = pv; + + } else { + /* No scaling. */ + pv[0].x = x; pv[0].y = y; + points = pv; + } + + /* Clip to the bounds of the destination raster and generate the + * new x,y. + */ + x = max(0, min(rp->width-1, points[0].x)); + y = max(0, min(rp->height-1, points[0].y)); + + } while (mp && (raster = mp->dst)); + + XWarpPointer (w->gterm.display, window, window, 0,0,0,0, x,y); + + w->gterm.last_x = w->gterm.cur_x = x; + w->gterm.last_y = w->gterm.cur_y = y; + + GtSetRaster (w, sv_raster); + GtSetLogRes (w, sv_xres, sv_yres); +} + + +GtGetCursorPos (w, x, y) + GtermWidget w; + int *x, *y; +{ + *x = w->gterm.last_x; + *y = w->gterm.last_y; +} + +GtSetCursorType (w, type) + GtermWidget w; + int type; +{ + static XtIntervalId id = (XtIntervalId) NULL; + Display *display = w->gterm.display; + Cursor cursor; + int interval; + Widget pw; + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (w->gterm.cursor_type == type) + return; + + switch (w->gterm.cursor_type = type) { + case GtNoCursor: + case GtIdleCursor: + erase_crosshair (w); + cursor = w->gterm.idle_cursor; + break; + + case GtGinmodeCursor: + /* Begin graphics cursor mode. + */ + + /* If a screen clear or drawing operation has caused the redisplay + * flag to be set, redisplay any marker overlays. + */ + if (w->gterm.gm_redisplay) { + GmRedisplay (w, (Region)NULL); + w->gterm.gm_redisplay = False; + } + + /* Make sure the window is visible. + */ + if (w->gterm.raiseWindow || w->gterm.deiconifyWindow) + for (pw = (Widget)w; pw; pw = XtParent(pw)) + if (XtIsShell(pw)) { + if (w->gterm.deiconifyWindow) + XMapWindow (display, XtWindow(pw)); + if (w->gterm.raiseWindow) + XRaiseWindow (display, XtWindow(pw)); + XSync (display, False); + } + + /* The first time this is done after a GtActivate causes the cursor + * to be warped into the graphics window. The interactive flag is set + * to cause GtDeactivate to restore the cursor to its original position + * after the graphics interaction finishes. + */ + if (w->gterm.warpCursor) { + int root_x, root_y, win_x, win_y; + int xoff, yoff, width, height, x, y; + Window gtermwin, root, child; + unsigned int keys; + int in_window = 0; + + width = w->core.width; + height = w->core.height; + gtermwin = w->gterm.window; + XTranslateCoordinates (display, gtermwin, w->gterm.root, + w->core.x, w->core.y, &xoff, &yoff, &child); + + if (XQueryPointer (display, w->gterm.root, &root, &child, + &root_x, &root_y, &win_x, &win_y, &keys)) { + + /* Already in gterm window? */ + if ((root_x >= xoff && root_x < xoff+width) && + (root_y >= yoff && root_y < yoff+height)) { + + if (!w->gterm.interactive) { + w->gterm.save_x = 0; + w->gterm.save_y = 0; + w->gterm.interactive++; + } + x = root_x - xoff; y = root_y - yoff; + in_window++; + + } else { + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + } else { + /* Pointer not on the current screen. + */ + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + + if ((x < 5 || x > width-5) || (y < 5 || y > height-5)) { + x = width / 2; + y = height / 2; + } + + if (!in_window) { + erase_crosshair (w); + if (w->gterm.warpCursor) { + XWindowAttributes wa; + if (XGetWindowAttributes (display, gtermwin, &wa) && + wa.map_state == IsViewable) { + + /* The following should not be necessary but is needed + * to workaround an X server bug. When warping to a + * different screen the pointer is not erased on the + * old screen. It is hard to erase it, but we can + * at least move it to the corner of the screen. + */ + if (root != w->gterm.root) { + Screen *screen = w->gterm.screen; + if (XGetWindowAttributes (display, root, &wa)) + screen = wa.screen; + XWarpPointer (display,None,root, 0,0,0,0, + WidthOfScreen(screen) - 1, + HeightOfScreen(screen) - 1); + } + + /* Now warp into the gterm window. */ + XWarpPointer (display, None, gtermwin, 0,0,0,0, x,y); + } + if (w->gterm.full_crosshair) + draw_crosshair (w, x, y); + } + + } else if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, x, y); + } + } else + update_cursor (w); + + cursor = w->gterm.ginmode_cursor; + if (interval = w->gterm.ginmodeBlinkInterval) { + XtAppContext appcon = XtWidgetToApplicationContext ((Widget) w); + id = XtAppAddTimeOut (appcon, + interval, blink_cursor, (XtPointer)w); + } else + id = (XtIntervalId) NULL; + break; + + case GtBusyCursor: + /* Exit graphics cursor mode. + */ + erase_crosshair (w); + cursor = w->gterm.busy_cursor; + break; + } + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = cursor); + if (id && w->gterm.cursor_type != GtGinmodeCursor) { + XtRemoveTimeOut (id); + id = (XtIntervalId) NULL; + } +} + +static void +blink_cursor (w, id) + GtermWidget w; + XtIntervalId *id; +{ + XtAppContext app_context; + XColor bg, fg; + int interval; + + if (w->gterm.cursor_type != GtGinmodeCursor) /* MF032 */ + return; + + bg = w->gterm.ginmodeColors[1]; + fg = w->gterm.ginmodeColors[0]; + + app_context = XtWidgetToApplicationContext ((Widget) w); + XRecolorCursor (w->gterm.display, w->gterm.ginmode_cursor, &fg, &bg); + XFlush (w->gterm.display); + + w->gterm.ginmodeColors[0] = bg; + w->gterm.ginmodeColors[1] = fg; + + if (interval = w->gterm.ginmodeBlinkInterval) + XtAppAddTimeOut (app_context, + interval, (XtTimerCallbackProc) blink_cursor, (XtPointer)w); +} + +GtPostInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.inputCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.inputCallback = new; +} + +GtDeleteInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.inputCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.inputCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resetCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resetCallback = new; +} + +GtDeleteResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resetCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resetCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resizeCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resizeCallback = new; +} + +GtDeleteResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resizeCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resizeCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtDrawAlphaText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + XPoint *points, pv[1], o_pv[1]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int npts, i; + + pv[0].x = x; + pv[0].y = y; + npts = 1; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + x = points[0].x; y = points[0].y; + + if (mx->use_backing_store) + XDrawString (w->gterm.display, w->gterm.pixmap, + mx->drawGC, x, y, text, strlen(text)); + XDrawString (w->gterm.display, mx->pixmap, + mx->drawGC, x, y, text, strlen(text)); + } + + update_transients (w, (Region)NULL); +} + +GtGetAlphaTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + +GtWriteAlphaCursor (w, x, y) + GtermWidget w; + int x, y; +{ +} + +GtEraseAlphaCursor (w) + GtermWidget w; +{ +} + +GtStartDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap) + if (w->gterm.d_saved) { + GtEraseDialog (w); + } else { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.pixmap ? w->gterm.pixmap : w->gterm.window, + w->gterm.d_pixmap, w->gterm.exposeGC, + 0, w->gterm.d_yoff, w->core.width, w->gterm.d_height, 0, 0); + w->gterm.d_saved = 1; + } +} + +GtEndDialog (w) + GtermWidget w; +{ + GtEraseDialog (w); + w->gterm.d_saved = 0; +} + +GtEraseDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap && w->gterm.d_saved) { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.window, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + if (w->gterm.pixmap) + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.pixmap, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + update_transients (w, (Region)NULL); + } +} + +GtDrawDialogText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + int xpos = w->gterm.d_xoff + x; + int ypos = w->gterm.d_yoff + y; + + if (w->gterm.pixmap) + XDrawImageString (w->gterm.display, w->gterm.pixmap, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); +} + +GtGetDialogTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + + +/* + * Internal functions for above code. + * ---------------------------------------- + */ + +static +set_default_color_index (w) + GtermWidget w; +{ + /* The default color index is 1, corresponding to the foreground + * drawing color color1. Index zero is the background drawing color + * color0. The remaining NColors color table entries are the optional + * drawing colors corresponding to resources "color2" through "colorN". + * These are used only if explicitly selected by the client application. + */ + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.cmap[1]); + w->gterm.color_index = 1; + invalidate_draw_context (w); +} + + +static +draw_crosshair (w, x, y) + GtermWidget w; + int x, y; +{ + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) { + /* The preserve_screen flag is set if we need to preserve the + * exact display window contents, rather than merely refresh from + * the backing store pixmap. + */ + if (w->gterm.preserve_screen) { + if (!w->gterm.preserve_valid || y != w->gterm.cur_y) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, w->core.height); + if (!w->gterm.preserve_valid || x != w->gterm.cur_x) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + x, 0, 1, w->core.height, w->core.width, 0); + w->gterm.preserve_valid = 1; + } + + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + 0, y, w->core.width, y); + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + x, 0, x, w->core.height); + + XFlush (w->gterm.display); + w->gterm.cursor_drawn++; + } + + w->gterm.cur_x = x; + w->gterm.cur_y = y; +} + + +static +erase_crosshair (w) + GtermWidget w; +{ + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (w->gterm.cursor_drawn) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.pixmap) { + if (w->gterm.preserve_screen && w->gterm.preserve_valid) { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, w->core.height, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + w->core.width, 0, 1, w->core.height, x, 0); + } else { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + x, 0, 1, w->core.height, x, 0); + } + } + + w->gterm.cursor_drawn = 0; + w->gterm.preserve_valid = 0; + } +} + + +static +update_transients (w, region) + GtermWidget w; + Region region; +{ + /* If an explicit region is given redisplay any markers in it immediately, + * otherwise set the redisplay flag to cause a full screen redisplay when + * drawing finishes and the widget is ready for input. + */ + if ((char *)region) + GmRedisplay (w, region); + else + w->gterm.gm_redisplay = True; + + /* Update the crosshair cursor if GIN mode is in effect. */ + update_cursor (w); +} + + +static +update_cursor (w) + GtermWidget w; +{ + if (w->gterm.cursor_type == GtGinmodeCursor && w->gterm.full_crosshair) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + if (x || y) + draw_crosshair (w, x, y); + } +} + +static Cursor +get_cursor (w, cursor_name) + GtermWidget w; + String cursor_name; +{ + XrmValue from, to; + Cursor cursor; + + from.size = strlen (cursor_name) + 1; + from.addr = cursor_name; + + to.addr = (caddr_t) &cursor; + to.size = sizeof(cursor); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRCursor, &to)) + cursor = XCreateFontCursor (w->gterm.display, XC_crosshair); + + return (cursor); +} + + +static DrawContext +get_draw_context (w) + GtermWidget w; +{ + DrawContext dx = &w->gterm.draw; + + if (!dx->valid) { + int raster = w->gterm.raster; + Raster rp = &w->gterm.rasters[raster]; + register MappingContext mx = &dx->mapContext[0]; + Region clip_region, mask_region; + struct mapping *map, *mp, *np, p_mp; + int xres = w->gterm.xres; + int yres = w->gterm.yres; + float xscale, yscale; + XRectangle r; + int i, j; + + dx->raster = w->gterm.raster; + dx->rp = rp; + + if (raster == 0) { + dx->nmappings = 1; + mx->mapping = 0; + mx->mp = NULL; + mx->use_backing_store = (w->gterm.pixmap != (Pixmap)NULL); + mx->pixmap = w->gterm.window; + mx->drawGC = w->gterm.drawGC; + mx->GC_private = 0; + +/* (7/16/97) MJF - we don't scale raster 0 since it's already in screen coords. + Otherwise the cursor movement keystrokes scale incorrectly and quickly move + to (0,0). + mx->xoffset = mx->yoffset = mx->scale = 0; + [DCT] This doesn't look entirely right as it disables logical coords for + the screen. Leave as is until this can be studied more carefully. + */ + + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) + mx->scale = 0; + else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + } else { + dx->nmappings = 0; + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (!mp->enabled || mp->src != raster || + w->gterm.rasters[mp->dst].type != GtServer) + continue; + if (!valid_mapping (w, mp)) + continue; + + mx->mp = mp; + mx->mapping = mp->mapping; + mx->pixmap = w->gterm.rasters[mp->dst].r.pixmap; + mx->use_backing_store = (mp->dst == 0 && + w->gterm.pixmap && !(mp->rop & R_Transient)); + + /* Determine if any scaling is necessary. */ + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + /* Compute logical-to-raster scaling. */ + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) { + mx->xscale = mx->yscale = 1.0; + mx->scale = 0; + } else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + /* Compute overall scale factors by combining logical-to- + * raster and raster-to-screen mappings. + */ + if (map->snx != map->dnx || map->sny != map->dny || + map->sx != map->dx || map->sy != map->dy) { + + xscale = (float)map->dnx / (float)map->snx; + mx->xscale *= xscale; + if (xscale < 0) + mx->xoffset = map->dx + abs(map->dnx) - 1; + else + mx->xoffset = map->dx; + mx->xoffset -= (map->sx * xscale); + + yscale = (float)map->dny / (float)map->sny; + mx->yscale *= yscale; + if (yscale < 0) + mx->yoffset = map->dy + abs(map->dny) - 1; + else + mx->yoffset = map->dy; + mx->yoffset -= (map->sy * yscale); + + mx->scale = 1; + } + + /* Compute the clip mask which will clip graphics to the + * destination rect of the mapping, minus any regions of + * this rect covered by other mappings. + */ + clip_region = XCreateRegion(); + r.x = map->dx; r.y = map->dy; + r.width = abs(map->dnx); + r.height = abs(map->dny); + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != mp->dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + mask_region = XCreateRegion(); + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + XUnionRectWithRegion (&r, mask_region, mask_region); + + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + } + + /* Create a drawing GC which is a copy of the global drawGC + * but using the clip mask computed above. + */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.root, + 0, NULL); + + /* Deep Frame */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.window, + 0, NULL); + /* Deep Frame */ + + XCopyGC (w->gterm.display, w->gterm.drawGC, ~0, mx->drawGC); + XSetRegion (w->gterm.display, mx->drawGC, clip_region); + XDestroyRegion (clip_region); + mx->GC_private = 1; + + if (++dx->nmappings >= MAX_DRAW) + break; + else + mx++; + } + } + + dx->valid = 1; + } + + return (dx); +} + + +static +invalidate_draw_context (w) + GtermWidget w; +{ + register DrawContext dx = &w->gterm.draw; + register MappingContext mx; + register int i; + + if (dx->valid) { + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->GC_private) + XFreeGC (w->gterm.display, mx->drawGC); + } + dx->valid = 0; + } +} + +static XPoint * +mapVector (mx, pv1, pv2, npts) + register MappingContext mx; + XPoint *pv1; + XPoint *pv2; + int npts; +{ + register XPoint *ip = pv1; + register XPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x * mx->xscale + mx->xoffset; + op->y = ip->y * mx->yscale + mx->yoffset; + } + + return (pv2); +} + + +static void +savepos (w, event) + GtermWidget w; + XEvent *event; +{ + if (event == NULL) + return; + + switch (event->type) { + case KeyPress: + case KeyRelease: + w->gterm.last_x = event->xkey.x; + w->gterm.last_y = event->xkey.y; + break; + case ButtonPress: + case ButtonRelease: + w->gterm.last_x = event->xbutton.x; + w->gterm.last_y = event->xbutton.y; + break; + case MotionNotify: + w->gterm.last_x = event->xmotion.x; + w->gterm.last_y = event->xmotion.y; + break; + } +} + + +/* + * IMAGING routines. + * ----------------------- + * Our strategy here is to support a range of visuals with pseudocolor being + * preferred if available. All imaging is done internally using 8 bit images + * and a max 256 element colormap. If the display hardware has a depth less + * than 8 bits, e.g. for a monochrome display, the image is reduced to the + * screen depth by some technique before being output to the display. + * + * Images (rasters) are implemented internally in Gterm using either ximages or + * off screen pixmaps. Which format is used is decided at raster create time + * and is controlled by a Gterm resource. This is transparent to the client + * application. Currently only 8 bit rasters are supported. + * + * GtRasterInit (gt) + * GtAssignRaster (gt, raster, drawable) + * GtCreateRaster (gt, raster, type, width, height, depth) + * GtDestroyRaster (gt, raster) + * exists = GtQueryRaster (gt, raster, &type, &width, &height, &depth) + * raster = GtNextRaster (gt) + * GtSetRaster (gt, raster) + * raster = GtGetRaster (gt) + * n = GtNRasters (gt) + * + * GtWritePixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtReadPixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtSetPixels (gt, raster, ct, x1, y1, nx, ny, color, rop) + * GtRefreshPixels (gt, raster, ct, x1, y1, nx, ny) + * pixmap = GtExtractPixmap (gt, src, ct, x, y, width, height) + * GtInsertPixmap (gt, pixmap, dst, ct, x, y, width, height) + * + * colormap = GtNextColormap (gt) + * GtFreeColormap (gt, colormap) + * GtWriteColormap (gt, colormap, first, nelem, r, g, b) + * GtReadColormap (gt, colormap, first, nelem, r, g, b) + * GtLoadColormap (gt, colormap, offset, scale) + * exists = GtQueryColormap (gt, colormap, &first, &nelem, &maxelem) + * GtWriteIomap (gt, iomap, first, nelem) + * GtReadIomap (gt, iomap, first, nelem) + * pixel = GtGetClientPixel (gt, gterm_pixel) + * + * GtInitMappings (gt) + * mapping = GtNextMapping (gt) + * GtFreeMapping (gt, mapping) + * GtRaiseMapping (gt, mapping, ref|NULL) + * GtLowerMapping (gt, mapping, ref|NULL) + * int = GtCompareMappings (gt, map1, map2) + * GtEnableMapping (gt, mapping, refresh) + * GtDisableMapping (gt, mapping, erase) + * active = GtActiveMapping (gt, mapping) + * GtRefreshMapping (gt, mapping) + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mapping) + * + * GtCopyRaster (gt, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtSetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtGetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * + * GtMapVector (gt, mapping, dir, pv1, pv2, npts) + * GtPixelToNDC (gt, raster, pv1, pv2, npts) + * GtNDCToPixel (gt, raster, pv1, pv2, npts) + * + * GtDebug (gt, fp, what) + * + * In the case of CopyRaster or {Set|Get}Mapping, raster coordinates may be + * specified in either raster pixel (GtPixel) units or in normalized device + * coordinates (GtNDC) in the range 0-32767. + * --------------------------------------------------------------------------- + */ + +GtRasterInit (w) + GtermWidget w; +{ + register int i; + register Raster rp; + register struct colormap *cm; + struct colormap *next_cm; + + invalidate_draw_context (w); + + /* Destroy any existing rasters. */ + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (w->gterm.rasters[i].type) + GtDestroyRaster (w, i); + + /* Allocate the initially empty raster descriptors. */ + XtFree ((char *)w->gterm.rasters); + w->gterm.rasters = rp = + (Raster) XtCalloc (w->gterm.maxRasters, sizeof (struct raster)); + w->gterm.nrasters = 0; + w->gterm.raster = 0; + + /* Raster 0 is the display window. */ +fprintf(stderr, "GtRasterInit: Init PIXMAPRASTER (%d x %d) pixmap=0x%x\n", +w->core.width, w->core.height, w->gterm.window); + rp->type = PixmapRaster; + rp->width = w->core.width; + rp->height = w->core.height; + rp->r.pixmap = w->gterm.window; + rp->delete = 0; + w->gterm.nrasters++; +fprintf(stderr, "GtRasterInit: w->gterm.nrasters = %d\n", w->gterm.nrasters); + + /* Free any previously allocated colormap cells. */ + if (w->gterm.ncolors > SZ_STATIC_CMAP && w->gterm.useDefaultCM) { + XFreeColors (w->gterm.display, w->core.colormap, + &w->gterm.cmap[SZ_STATIC_CMAP], w->gterm.ncolors - SZ_STATIC_CMAP, + 0); + w->gterm.ncolors = SZ_STATIC_CMAP; + invalidate_cmap (w); + } + + /* Free any client defined colormaps. */ + for (cm = w->gterm.colormaps; cm; cm = next_cm) { + next_cm = cm->next; + XtFree ((char *)cm); + } + w->gterm.colormaps = NULL; + + /* Initialize the mappings. */ + GtInitMappings (w); +fprintf(stderr, "GtRasterInit: After Init Mappings...Returning\n"); +} + + +/* GtNextRaster -- Return the index of the next unused raster. + */ +GtNextRaster (w) + register GtermWidget w; +{ + register int i; + + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (!w->gterm.rasters[i].type) + return (i); + + return (-1); +} + + +/* GtNRasters -- Return the number of currently defined rasters. + */ +GtNRasters (w) + GtermWidget w; +{ + return (w->gterm.nrasters); +} + + +/* GtAssignRaster -- Assign a raster descriptor to an externally created + * drawable (window or pixmap). The raster thus created may be mapped or + * drawn into like the rasters created privately by the imaging code, but + * this allows use of this code to access other windows, or shared pixmaps. + */ +GtAssignRaster (w, raster, drawable, type) + GtermWidget w; + int raster; /* one-indexed */ + XtPointer drawable; /* object containing pixel array */ + int type; /* type of drawable [not used] */ +{ + register Raster rp; + XWindowAttributes wa; + + if (raster <= 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, (Window)drawable, &wa)) + return (ERR); + } else + wa = w->gterm.wa; + +fprintf(stderr, "GtAssignRaster: Assigning PIXMAPRASTER\n"); + rp->type = PixmapRaster; + rp->width = wa.width; + rp->height = wa.height; + rp->r.pixmap = (Pixmap) drawable; + rp->delete = 0; + + return (OK); +} + + +/* GtCreateRaster -- Create a new raster of the given size. A server pixmap + * (GtServer) or ximage (GtClient) raster will be created depending upon the + * current value of the cacheRasters resource. + */ +GtCreateRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int type; + int width, height; + int depth; +{ + register uchar *op; + register int npix, pixel; + uchar *data; + XImage *xp; + Raster rp; + int cache; + + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + /* Only rasters of depth 8 bits are currently supported. */ +fprintf (stderr, "GtCreateRaster: raster=%d type=%d (%d x %d x %d)\n", + raster, type, width, height, depth); + + if (depth && depth != 8) +{ +fprintf (stderr, "GtCreateRaster: DEPTH != 8\n\n\n\n\n\n"); + return (ERR); +} + + /* Check for a raster number in bounds. */ + if (raster < 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + /* A create on raster 0 (the display window) is treated as an attempt + * to resize the window. + */ + if (raster == 0) { + XWindowAttributes wa; + + invalidate_draw_context (w); + + /* Issue the resize request. */ + XtVaSetValues ((Widget)w, + XtNwidth, (XtArgVal)width, + XtNheight, (XtArgVal)height, + NULL); + XFlush (w->gterm.display); + + /* The following generates a round trip request to the server and + * is an attempt to allow the window system time to process the + * resize request before the client can issue a GtQueryRaster to + * see if the request has succeeded (hence causing a race condition). + * If the window is not the requested size the delay flag is set + * to cause graphics input processing to be suspended until the + * window is resized or redisplayed. A dummy expose event is + * generated to clear the delay condition in case the resize request + * is not granted. + */ + if (XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + rp->width = wa.width; + rp->height = wa.height; + + if (rp->width != width || rp->height != height) { + XExposeEvent ev; + ev.type = Expose; + ev.send_event = True; + ev.display = w->gterm.display; + ev.window = w->gterm.window; + ev.x = ev.y = 0; + ev.width = ev.height = 1; + ev.count = 0; + + XSendEvent (w->gterm.display, w->gterm.window, False, + NoEventMask, (XEvent *)&ev); + w->gterm.delay = 1; + } + } + return (OK); + } + + /* Get rid of any old raster. */ + GtDestroyRaster (w, raster); + + rp->width = width; + rp->height = height; + rp->delete = 1; + + /* Cache the raster? */ + if (strcmp (w->gterm.cacheRasters, "always") == 0) + cache = 1; + else if (strcmp (w->gterm.cacheRasters, "never") == 0) + cache = 0; + else + cache = (type == GtServer); + + +/* 24-BIT: For the moment, disable caching. We'll need to come back to +** this and fix up all the cache usage in the same way. Note the call to +** XFillRectangle() below triggers an X error. +cache = 0; +*/ + +/* 24-BIT: */ + + +fprintf(stderr,"GtCreateRaster: CACHE: %d (%dx%dx%d)\n", + cache, width, height, depth); +fprintf(stderr,"GtCreateRaster: Creating %s: %d\n", + (cache ? "PIXMAPRASTER" : "IMAGERASTER"), raster); + + /* Create new raster. */ + if (cache) { + /* Create a pixmap. */ + rp->type = PixmapRaster; + rp->r.pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + width, height, RasterDepth); + if (rp->r.pixmap == (Pixmap)NULL) + goto ximage; +/* 24-BIT + XFillRectangle (w->gterm.display, rp->r.pixmap, w->gterm.clearGC, + 0, 0, width, height); + 24-BIT */ + + } else { + /* Create an XImage. */ +ximage: + rp->type = ImageRaster; + + /* Get pixel storage. + npix = width * height; + */ + npix = width * height * (depth / 8); /* 24-bit */ + + if ((data = (uchar *) XtMalloc(npix)) == NULL) + return (ERR); + else { + for (op=data, pixel=w->gterm.color0; --npix >= 0; ) + *op++ = pixel; + } + + /* The following doesn't yet deal properly with byte and bit ordering + * differences between the server and client. + */ + rp->r.ximage = xp = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, width, height, 8, 0); + if (xp == NULL) { + rp->type = 0; + return (ERR); + } + } + + w->gterm.nrasters++; + return (OK); +} + + +/* GtDestroyRaster -- Destroy a raster. Any mappings which reference the + * raster are deactivated, and all storage associated with the raster is freed. + */ +GtDestroyRaster (w, raster) + GtermWidget w; + int raster; +{ + register Raster rp; + register Mapping mp, next; + + if (raster <= 0) + return; + + invalidate_draw_context (w); + + /* Disable any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = next) { + next = mp->next; + if (mp->src == raster || mp->dst == raster) + free_mapping (w, mp); + } + + /* Destroy the raster. */ + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (rp->delete) { + if (rp->type == ImageRaster) + XDestroyImage (rp->r.ximage); + else if (rp->type == PixmapRaster) + XFreePixmap (w->gterm.display, rp->r.pixmap); + } + w->gterm.nrasters--; + rp->type = 0; + rp->delete = 0; + } +} + + +/* GtQueryRaster -- Determine whether a raster exists and if so return its + * size. + */ +GtQueryRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int *type; + int *width, *height; + int *depth; +{ + register Raster rp; + + if (raster < 0 || raster > w->gterm.maxRasters) + return (0); + + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (type) { + if (rp->type == PixmapRaster) + *type = GtServer; + else + *type = GtClient; + } + if (width) + *width = rp->width; + if (height) + *height = rp->height; + if (depth) + *depth = RasterDepth; + return (1); + } else + return (0); +} + + +/* GtWritePixels -- Write to a rectangular region of a raster. If any + * mappings are currently defined which reference this raster as the source, + * and a mapped region is being rewritten, the affected pixels will be + * refreshed by the mapping. + */ +GtWritePixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + int bytes_per_line, i; + Mapping mp; + Raster rp; + uchar *lp; + int *rgb; /* rgb-mode pixel pointer */ + XWindowAttributes wa; + unsigned int *ras = NULL; + + + if (DBG_TRACE) + fprintf(stderr, "GtWritePixels[%s] ENTER....nbits=%d\n", + dbg_wSize(w), nbits); + + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + fprintf (stderr, "GtWritePixels: Error getting window attrs\n"); + return (ERR); + } + } else + wa = w->gterm.wa; + +#ifdef DEBUG_VISUAL + fprintf (stderr, "GtWritePixels: depth=%d RasterDepth= %d class=%s\n", + wa.depth, RasterDepth, dbg_visStr(wa.visual->class)); +#endif + + + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + XImage *ximage; + uchar *data; + int npix; + + if (DBG_TRACE) + fprintf(stderr, "GtWritePix: Doing PixmapRaster[%s]....depth=%d\n", + dbg_wSize(w), wa.depth); + + /* Get a data buffer. */ + if ((data = (uchar *)XtMalloc (npix = nx * ny)) == NULL) + return (ERR); + + /* Convert the pixel values to colormap indices. */ + cmap = get_cmap_in (w); + for (ip=pixels, op=data, n=npix; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + + if (wa.depth == ColormapDepth) { + if (DBG_TRACE) + fprintf(stderr, "GtWritePix: Creating 8-bit ximage\n"); + + ximage = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, nx, ny, 8, 0); + + } else if (wa.depth == RGBDepth) { + int i, j, p, pv; + + ras = (unsigned int *) XtMalloc (nx * ny * sizeof(int)); + memset (ras, 0, (nx * ny * sizeof (int)) ); + for (i=0; i < ny; i++) { + for (j=0; j < nx; j++) { + p = i * nx + j; /* get index */ + pv = data[p]; + ras[p] = (pv << 16) | (pv << 8) | pv ; + } + } + if (DBG_TRACE) + fprintf(stderr, "GtWritePix: Creating 24-bit ximage\n"); +/* + ximage = XCreateImage (w->gterm.display, NULL, RGBDepth, + ZPixmap, 0, (char *)ras, nx, ny, 8, 0); +*/ + ximage = XCreateImage (w->gterm.display, NULL, RGBDepth, + ZPixmap, 0, (char *)ras, nx, ny, 32, 0); + + } else { + fprintf (stderr, "GtWritePixels: Unsupported raster depth\n"); + return (ERR); + } + + if (raster == 0 && w->gterm.pixmap) { + + if (DBG_TRACE) + fprintf(stderr, "(raster == 0 && w->gterm.pixmap)\n"); + + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + if (wa.depth != ColormapDepth) + XtFree ((char *)ras); + + XCopyArea (display, w->gterm.pixmap, rp->r.pixmap, + w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + + } else { + if (DBG_TRACE) + fprintf(stderr, "raster=0 else....\n"); + XPutImage (display, rp->r.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + } + + XtFree ((char *)data); + ximage->data = NULL; + XDestroyImage (ximage); + + } else if (rp->type == ImageRaster) { +fprintf(stderr, "GtWritePix: Doing ImageRaster....bytes_per_line=%d\n", + rp->r.ximage->bytes_per_line); +fprintf(stderr, "GtWritePix: Doing ImageRaster....depth=%d\n", + rp->r.ximage->depth); +/* +*/ + + cmap = get_cmap_in (w); + bytes_per_line = rp->r.ximage->bytes_per_line; + ip = pixels; + + if (wa.depth == ColormapDepth) { +fprintf(stderr, "Doing ColormapDepth....writing to ximage\n"); + int min=256, max=0; + int min1=256, max1=0; + + + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Copy the data into the ximage data raster, converting input + * pixels to Xlib pixel values in the process. + * + * Possibly this should be done at Pixmap write time rather than + * during raster i/o so that the image pixel values are preserved. + * Otherwise reading back pixels is difficult and if the color map + * is dynamically modified the original pixel values may be lost. + * Postponing display pixel value generation woudl also make it + * easy to add support later for image depths other than 8 bit. + * Doing the conversion to display pixels here is however simpler + * and more efficient so that is how we do it for now. + */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) { + *op++ = (cmap[*ip++] & 0377); +if (*ip < min) min = *ip; if (cmap[*ip] < min1) min1 = cmap[*ip]; +if (*ip > max) max = *ip; if (cmap[*ip] > max1) max1 = cmap[*ip]; + } + lp += bytes_per_line; + } +fprintf (stderr, "CMAP MINMAX: %d %d -- %d %d\n", min, max, min1, max1); + + } else if (wa.depth == RGBDepth) { + int pv; + int min=256, max=0; + int min1=256, max1=0; + +fprintf(stderr, "Doing RGBDepth....writing to ximage\n"); + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) { +if (*ip < min) min = *ip; if (cmap[*ip] < min1) min1 = cmap[*ip]; +if (*ip > max) max = *ip; if (cmap[*ip] > max1) max1 = cmap[*ip]; + /* + *op++ = (*ip++ & 0377); + */ + *op++ = (cmap[*ip++] & 0377); + } + lp += bytes_per_line; + } +fprintf (stderr, "RGB MINMAX: pixel: %d %d -- cmap: %d %d bpl: %d\n", + min, max, min1, max1, bytes_per_line); + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + + if (DBG_TRACE) + fprintf(stderr, "GtWritePixels[%s] LEAVING....\n", dbg_wSize(w)); + + return (OK); +} + + +/* GtReadPixels -- Read a rectangular region of a raster. + */ +GtReadPixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + + int bytes_per_line, i; + int x, y, delxin = 0; + XImage *xin; + Raster rp; + uchar *lp; + + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + /* Get the input ximage. */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + + /* Read the pixmap subraster into an ximage. If we are reading the + * screen (raster == 0) and we have an off-screen backing store pixmap, + * use that instead of the screen. + */ + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? w->gterm.pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + + if (xin == NULL) + return (ERR); + + delxin++; + x = y = 0; + + } else { + xin = rp->r.ximage; + x = x1; + y = y1; + } + + cmap = get_cmap_out (w); + bytes_per_line = xin->bytes_per_line; + lp = (uchar *)xin->data + y * bytes_per_line + x; + op = pixels; + + /* Copy the data to the output buffer, converting display pixels to + * client pixels in the process. + */ + for (i=0; i < ny; i++) { + for (n=nx, ip=lp; --n >= 0; ) { + *op++ = cmap[*ip++]; + } + lp += bytes_per_line; + } + + if (delxin) + XDestroyImage (xin); + return (OK); +} + + +/* GtSetPixels -- Set all the raster pixels in a region to a single color. + * If nx=ny=0 the entire raster will be written. + */ +GtSetPixels (w, raster, ct, x1, y1, nx, ny, color, rop) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; + int color; + int rop; +{ + register Raster rp; + Mapping mp; + + /* Get raster pointer. */ + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + raster, ct, x1,y1,nx,ny); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + } + + /* Perform some range checks. */ + if (x1 == 0 && y1 == 0 && nx == 0 && ny == 0) { + nx = rp->width; + ny = rp->height; + } else { + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + } + + /* Set the pixels. + */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + GC gc = w->gterm.clearGC; + int use_backing_store; + + use_backing_store = + (raster == 0 && w->gterm.pixmap && !(rop & R_Transient)); + + XSetForeground (display, gc, get_pixel(w,color)); + XFillRectangle (display, rp->r.pixmap, gc, x1, y1, nx, ny); + if (use_backing_store) + XFillRectangle (display, w->gterm.pixmap, gc, x1, y1, nx, ny); + XSetForeground (display, gc, w->gterm.color0); + + } else { + register int n, i; + register uchar *op; + register Pixel pixel; + int bytes_per_line; + uchar *lp; + + pixel = get_pixel (w, color); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Set all pixels in the indicated region. */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = pixel; + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtRefreshPixels -- Update any mappings defined upon the given region of + * the given source raster, as if the pixel values had been set with a + * write pixels call. + */ +GtRefreshPixels (w, raster, ct, x1, y1, nx, ny) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; +{ + register Raster rp = &w->gterm.rasters[raster]; + register Mapping mp; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); + save_mapping (&sv_mp, 0, 0, + raster, ct, x1,y1,nx,ny, + 0, GtPixel, 0,0,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.sx; + y1 = p_mp.sy; + nx = p_mp.snx; + ny = p_mp.sny; + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } +} + + +/* GtExtractPixmap -- Extract a rectangular region of a raster and return + * as a pixmap. The caller is responsible for later deleting this pixmap. + */ +Pixmap +GtExtractPixmap (w, src, ctype, x, y, width, height) + GtermWidget w; + int src; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + int x1, y1, nx, ny; + String cache; + int i; + + rp = &w->gterm.rasters[src]; + if (!rp->type) + return ((Pixmap)NULL); + + /* If width and height are zero, return the full raster. */ + if (width <= 0) + width = rp->width; + if (height <= 0) + height = rp->height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + src, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Find any empty raster slot and use it to generate the output pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + cache = w->gterm.cacheRasters; + w->gterm.cacheRasters = "always"; + + if (GtCreateRaster (w, i, GtServer, nx, ny, /* MF006 */ + RasterDepth) == ERR) { + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } else if (rp->type != PixmapRaster) + goto err; + + if (GtCopyRaster (w, 0, + src,0, x1,y1,nx,ny, i,0, 0,0,nx,ny) == ERR) { +err: + GtDestroyRaster (w, i); /* MF005 */ + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } + + rp->type = 0; + w->gterm.nrasters--; + w->gterm.cacheRasters = cache; + + return (rp->r.pixmap); + } + } + + return ((Pixmap)NULL); +} + + +/* GtInsertPixmap -- Insert the contents of the given pixmap into a raster + * at the indicated coordinates. + */ +GtInsertPixmap (w, pixmap, dst, ctype, x, y, width, height) + GtermWidget w; + Pixmap pixmap; + int dst; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + XWindowAttributes wa; + int x1, y1, nx, ny; + int i; + + /* Check that the pixmap exists. */ + if (!XGetWindowAttributes (w->gterm.display, pixmap, &wa)) + return (ERR); + + /* Default to full dimensions of pixmap if no dimensions given. */ + if (width <= 0) + width = wa.width; + if (height <= 0) + height = wa.height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + dst, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Create the destination raster if none exists. */ + if (!w->gterm.rasters[dst].type) + if (GtCreateRaster (w, dst, GtDefault, nx, ny, /* MF006 */ + RasterDepth) == ERR) + return (ERR); + + /* Find an empty raster slot and use it to build a fake source raster + * using the supplied pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + rp->type = PixmapRaster; + rp->width = nx; + rp->height = ny; + rp->r.pixmap = pixmap; + + if (GtCopyRaster (w, 0, + i,0, 0,0,nx,ny, dst,0, x1,y1,nx,ny) < 0) + return (ERR); + + rp->type = 0; + return (OK); + } + } + + return (ERR); +} + + +/* GtWriteColormap -- Allocate or modify colormap cells. The Gterm widget + * colormap consists of a fixed number of preassigned, read-only color cells, + * plus a variable number of dynamically allocated application defined color + * cells. The application sees only the preassigned pixel space 0-N where + * N is the maximum pixel value. These values are mapped to Xlib pixel values + * by the CMAP vector in the main Gterm widget descriptor. The server + * colormap does the final mapping to RGB triplets. + * + * Our strategy here is as follows. If we have a monochrome screen set up a + * one-to-one fake colormap so that we preserve the input pixel values and + * render a one-bit image later. If we have a StaticGray or StaticColor + * visual allocate read-only color cells to allow X to choose the closest + * colors to what we request. If we have a GrayScale or PseudoColor visual + * allocate private read-write colors. The TrueColor and DirectColor + * visuals should not be seen here as we should have been able to set up the + * PseudoColor visual on screens that support these visuals, but if they are + * seen use a one-to-one mapping to preserve the 8 bit pixel values. + */ +GtWriteColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + XWindowAttributes wa; + register XColor *cp; + register int i, j, v, n, use_wa = 1; + unsigned long plane_masks[1]; + int req, need; + + + if (!w || !XtIsRealized ((Widget)w)) + return (ERR); + +/* +fprintf (stderr, "GtWriteColormap: entry.....\n\n"); +fprintf (stderr, "GtWriteColormap: map=%d first=%d nelem=%d\n", map, first, nelem); +*/ + if (map > 0) { + /* Create or modify a colormap descriptor. The display colormap + * is not affected. + */ + register struct colormap *cm; + struct colormap *last_cm; + register XColor *cp; + register int i; + + /* See if the colormap already exists. */ + for (cm = w->gterm.colormaps, last_cm = NULL; cm; cm = cm->next) { + last_cm = cm; + if (cm->map == map) + break; + } + + /* If not, create it. */ + if (!cm) { + if (!(cm = (struct colormap *)XtCalloc(1,sizeof(struct colormap)))) + return (ERR); + if (last_cm) + last_cm->next = cm; + else + w->gterm.colormaps = cm; + + /* Initialize static part of colormap. */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } + + cm->map = map; + cm->ncells = max (cm->ncells, first + nelem); + + /* Ignore attempts to overwrite static part of colormap. */ + for ( ; first < SZ_STATIC_CMAP; first++, nelem--) { + r++; g++; b++; + } + + if (nelem >= 0) { + memmove (&cm->r[first], r, nelem * sizeof (ushort)); + memmove (&cm->g[first], g, nelem * sizeof (ushort)); + memmove (&cm->b[first], b, nelem * sizeof (ushort)); + } + +/* +fprintf (stderr, "GtWriteColormap: map=%d == modifying colormap\n", map); +*/ + return (OK); + } + + /* Write to the display colormap. + */ + if (first < SZ_STATIC_CMAP || first + nelem > MAX_SZCMAP) + return (ERR); + + /* Invalidate the cmap cache. */ + invalidate_cmap (w); + + /* Get the window attributes. We need to do this to determine the type + * of visual used for the window, which determines our color allocation + * strategy. This is only done once since presumably the visual and + * window depth will not change after the widget has been around long + * enough to receive a GtWriteColormap call. + */ +/* +fprintf (stderr, "GtWriteColormap: w=0x%x w->gterm=0x%x defined=%d\n", + w, &w->gterm, w->gterm.wa_defined); +*/ + if (w->gterm.w_depth == 0 && w->gterm.w_visual_class == 0) { +/* +fprintf (stderr, "GtWriteColormap: doing XGetWindowAttributes\n\n"); +*/ + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) + return (ERR); + w->gterm.wa = wa; + w->gterm.wa_defined++; + + if (wa.depth == 1) + goto unitary; + } else + use_wa = 0; + + +/* + switch (wa.visual->class) { +fprintf (stderr, "GtWriteColormap: before switch\n\n"); +*/ + switch ((use_wa ? wa.visual->class : w->gterm.w_visual_class)) { + case StaticGray: + case StaticColor: + /* Allocate "best-match" colors. */ + for (i=first; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + cp->red = r[i-first]; + cp->green = g[i-first]; + cp->blue = b[i-first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (XAllocColor (w->gterm.display, wa.colormap, cp)) + w->gterm.cmap[i] = cp->pixel; + else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + } + } + break; + + case GrayScale: + case PseudoColor: + if (w->gterm.useDefaultCM) { +usedef: /* Allocate private r/w colors from default colormap. */ + need = first + nelem - w->gterm.ncolors; + + /* Allocate new color cells if needed. If we can't allocate all + * the requested cells the unallocated pixel values are set to + * black. + */ + if ((n = need) > 0) { + /* Get the colormap cells. */ + req = min(w->gterm.maxColors, first + nelem - SZ_STATIC_CMAP) - + (w->gterm.ncolors - SZ_STATIC_CMAP); + for (n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, wa.colormap, + False, plane_masks, 0, + &w->gterm.cmap[w->gterm.ncolors+n], req)) { + n += req; + } else + req /= 2; + + /* Initialize the color descriptors. */ + for (i = w->gterm.ncolors; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + if (i < w->gterm.ncolors + n) { + cp->pixel = w->gterm.cmap[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + cp->flags = 0; + } + } + w->gterm.ncolors += n; + } + + /* Assign RGB colors to the referenced cells. */ + for (i=0; i < nelem; i++) { + cp = &w->gterm.color[first+i]; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + n = w->gterm.ncolors - first; + if (n > 0) + XStoreColors (w->gterm.display, wa.colormap, + &w->gterm.color[first], n); + + } else { + /* Allocate colors in a custom colormap. If the named colormap + * does not yet exist we create one. Multiple gterm widget + * instances may share the same colormap. + */ + Colormap colormap; + long timeval, time(); + int ncolors, shadow; + + /* get_colormap will direct us to the default colormap if the + * custom colormap cannot be accessed or created. + */ + colormap = get_colormap (w); + if (w->gterm.useDefaultCM) + goto usedef; + + /* Assign RGB colors to the referenced cells. */ + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + /* Store the new colors. */ + if (ncolors > 0) + XStoreColors (w->gterm.display, + colormap, &w->gterm.color[first], ncolors); + + /* Also attempt to store the colors in the default colortable, + * by allocating, writing, and then deallocating cells. This + * helps keeps the gterm window visible when the default + * colormap is loaded. To avoid excessive server queries the + * default colormap is only updated every so often. Updating is + * disabled if cmapShadow is set to zero. If shadowing is + * enabled the update is always performed if the WriteColormap + * occurs when the pointer is not in the window (e.g., when a + * button elsewhere in the GUI is pressed) as otherwise the + * change will not be visible as the private colormap will not + * be loaded by the window manager. + */ + shadow = w->gterm.cmapShadow; + timeval = time((long *)NULL); + + if (shadow && (!w->gterm.in_window || + (timeval - w->gterm.cmapLastShadow > shadow * 1000))) { + update_default_colormap (w); + w->gterm.cmapLastShadow = timeval; + } + } + break; + + default: + /* Set up a unitary, or one-to-one mapping, to preserve the input + * pixel values so that we can render them later. + */ +unitary: + if ((first+nelem) > MAX_SZCMAP) { + fprintf (stderr, "GtWriteColormap: Error first=%d nelem=%d\n", + first, nelem); + break; + } + for (i = first; i < first+nelem; i++) { + w->gterm.cmap[i] = i; + cp = &w->gterm.color[i]; + cp->pixel = i; + cp->red = r[i+first]; + cp->green = g[i+first]; + cp->blue = b[i+first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (i+1 > w->gterm.ncolors) + w->gterm.ncolors = i + 1; + } + break; + } + +fprintf (stderr, "GtWriteColormap: leaving\n"); + return (OK); +} + + +/* GtReadColormap -- Return the color assignments for a region of the named + * colormap. + */ +GtReadColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + if (map > 0) { + /* Read from a colormap descriptor. + */ + register struct colormap *cm; + register int i, j; + + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + j = first + i; + if (j < cm->ncells) { + r[i] = cm->r[j]; + g[i] = cm->g[j]; + b[i] = cm->b[j]; + } else + break; + } + + return (i); + + } else { + /* Read the display colormap. + */ + register XColor *cp; + register int i; + + /* Return RGB values. */ + for (i=0; i < nelem; i++) + if (first+i < w->gterm.ncolors) { + cp = &w->gterm.color[first+i]; + r[i] = cp->red; + g[i] = cp->green; + b[i] = (ushort)cp->blue; + } else + break; + + return (i); + } +} + + +/* GtLoadColormap -- Load a colormap into the display, optionally scaling + * the colormap via a linear transformation in the process. The colormap is + * unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. + * If map=0 the linear transformation is applied directly to the display + * colormap. + * + * The offset refers to the center of the mapped region of the transfer + * function, which is why the center value is at 0.5. For example, if the + * range of raster pixel intensities is normalized to the range 0.0 to 1.0, + * then a transfer function of [offset=0.3,slope=3.0] will display the region + * of intenstities centered around the normalized intenstity of 0.3, with a + * contrast of 3.0 (the screen intensity changes 3 units for a unit change in + * raster pixel intensity). The transfer function [offset=0.3,slope=-3.0] + * will display the same range of pixel intensitites, but with a negative + * contrast. The transfer function [offset=0.5,slope=1.0] has intercepts + * of [0,0] and [1,1] hence it displays the full range of raster pixel + * intensities - the input colormap is used as is, without resampling. + */ +GtLoadColormap (w, map, offset, slope) + GtermWidget w; + int map; + float offset, slope; +{ + register int i; + register XColor *cp; + register struct colormap *cm; + struct colormap d_cmap, o_cmap; + int noscale, nelem, c1, c2; + float x, y, z, frac; + ushort r, g, b; + + /* Get the colormap to be loaded. + */ + if (map == 0) { + /* Create a dummy colormap struct from the screen colormap. */ + cm = &d_cmap; + cm->map = 0; + cm->next = NULL; + cm->ncells = w->gterm.ncolors; + for (i=0; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } else { + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (ERR); + } + + /* Compute the scaled colormap. Only the dynamic part of the colormap + * is scaled, the static cells are not affected. + */ + o_cmap.map = 0; + o_cmap.ncells = cm->ncells; + nelem = cm->ncells - SZ_STATIC_CMAP; + noscale = (abs(offset - 0.5) < 0.0001 && abs(slope - 1.0) < 0.0001); + + if (noscale) { + for (i=0; i < nelem; i++) { + o_cmap.r[i] = cm->r[SZ_STATIC_CMAP+i]; + o_cmap.g[i] = cm->g[SZ_STATIC_CMAP+i]; + o_cmap.b[i] = cm->b[SZ_STATIC_CMAP+i]; + } + } else { + for (i=0; i < nelem; i++) { + x = (float)i / (float)(nelem - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + r = cm->r[SZ_STATIC_CMAP]; + g = cm->g[SZ_STATIC_CMAP]; + b = cm->b[SZ_STATIC_CMAP]; + } else if (y >= 1.0) { + r = cm->r[cm->ncells-1]; + g = cm->g[cm->ncells-1]; + b = cm->b[cm->ncells-1]; + } else { + z = y * (nelem - 1) + SZ_STATIC_CMAP; + if (w->gterm.cmapInterpolate) { + c1 = (int)z; + c2 = min (cm->ncells-1, c1 + 1); + frac = z - c1; + r = cm->r[c1] * (1.0 - frac) + cm->r[c2] * frac; + g = cm->g[c1] * (1.0 - frac) + cm->g[c2] * frac; + b = cm->b[c1] * (1.0 - frac) + cm->b[c2] * frac; + } else { + c1 = (int)z; + r = cm->r[c1]; + g = cm->g[c1]; + b = cm->b[c1]; + } + } + + o_cmap.r[i] = r; + o_cmap.g[i] = g; + o_cmap.b[i] = b; + } + } + + /* Load the colormap into the display. */ + GtWriteColormap (w, 0, SZ_STATIC_CMAP, nelem, + o_cmap.r, o_cmap.g, o_cmap.b); + + /* If the colormap we loaded to the display was the display colormap, + * restore the original unscaled colors in the gterm descriptor so that + * we won't be scaling a scaled colormap in the next operation. + */ + if (map == 0) + for (i=SZ_STATIC_CMAP; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cp->red = cm->r[i]; + cp->green = cm->g[i]; + cp->blue = cm->b[i]; + } + + return (OK); +} + + +/* GtQueryColormap -- Return information on the size and state of a colormap. + */ +GtQueryColormap (w, map, first, nelem, maxelem) + register GtermWidget w; + int map; + int *first, *nelem, *maxelem; +{ + register struct colormap *cm; + int nitems; + + if (first) + *first = SZ_STATIC_CMAP; + if (nelem) + *nelem = 0; + if (maxelem) + *maxelem = min (w->gterm.maxColors, MAX_SZCMAP) - SZ_STATIC_CMAP; + + if (map > 0) { + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + if (nelem) + *nelem = cm->ncells - SZ_STATIC_CMAP; + + } else { + if (nelem) + *nelem = w->gterm.ncolors - SZ_STATIC_CMAP; + if (maxelem) { + nitems = min (MAX_SZCMAP, CellsOfScreen(w->gterm.screen)); + *maxelem = min (nitems, + min (w->gterm.maxColors, MAX_SZCMAP - w->gterm.base_pixel)); + } + } + + return (1); +} + + +/* GtNextColormap -- Return a unique colormap number. + */ +GtNextColormap (w) + register GtermWidget w; +{ + register struct colormap *cm; + register int mapno = 0; + + /* Get the next map number. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map > mapno) + mapno = cm->map; + + return (mapno + 1); +} + + +/* GtFreeColormap -- Free a colormap descriptor. + */ +GtFreeColormap (w, colormap) + register GtermWidget w; + int colormap; +{ + register struct colormap *p_cm, *cm; + + /* Find the colormap and free it. */ + for (p_cm = NULL, cm = w->gterm.colormaps; cm; p_cm = cm, cm = cm->next) + if (cm->map == colormap) { + if (p_cm) + p_cm->next = cm->next; + else + w->gterm.colormaps = cm->next; + XtFree ((char *)cm); + return; + } +} + + +/* GtWriteIomap -- An iomap is an optional lookup table used to isolate the + * client application from the color model used within the Gterm widget. + * To simplify color allocation the Gterm widget defines a logical color + * space where color 0 is the background, 1 the foreground, 2-N are statically + * allocated standard colors, and colors N+1 and above are dynamically + * allocated by the graphics application. Less-demanding applications use + * only the statically allocated, shared colors. The widget internally maps + * these logical colors to whatever the window system requires, but providing + * a well-defined logical color space isolates the client from the details of + * color allocation in the underlying window system. + * + * An iomap can be used to define a mapping between the color model of the + * client application and the Gterm color model (when we say color model here + * we mean color allocation schemes for 8 bit pseudocolor). By default the + * iomap is one-to-one. The use of an iomap frees the client from having to + * worry about color index translations, and allows color tables to be + * combined in the widget for greater efficiency when color tables are serially + * applied. The iomap applies to all color indices or pixel values passed + * in i/o operations between the client and the Gterm widget. + */ +GtWriteIomap (w, iomap, first, nelem) + register GtermWidget w; + ushort *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (&w->gterm.iomap[c1], iomap, nelem * sizeof(ushort)); + invalidate_cmap (w); +} + + +/* GtReadIomap -- Read back the contents of the iomap. + */ +GtReadIomap (w, iomap, first, nelem) + register GtermWidget w; + uchar *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (iomap, &w->gterm.iomap[c1], nelem * sizeof(ushort)); +} + + +/* init_iomap -- Initialize the iomap and the cmap cache. + */ +static void +init_iomap (w) + GtermWidget w; +{ + register ushort *iomap = w->gterm.iomap; + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + iomap[i] = i; + invalidate_cmap (w); +} + + +/* invalidate_cmap -- Invalidate the cmap cache. + */ +static void +invalidate_cmap (w) + register GtermWidget w; +{ + w->gterm.cmap_in_valid = w->gterm.cmap_out_valid = 0; +} + + +/* get_cmap_in -- Get the combined input colormap, used to transform color + * values received from the client to window system color indices. + */ +static Pixel * +get_cmap_in (w) + register GtermWidget w; +{ + register Pixel *cmap, *cmap_in = w->gterm.cmap_in; + register ushort *iomap; + register int i, j; + int ncolors; + + if (w->gterm.cmap_in_valid) + return (cmap_in); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + ncolors = w->gterm.ncolors - SZ_STATIC_CMAP; + + /* If ncolors is small wrap around so that pixel values stay within + * the mapped range of output pixels. + */ + for (i=0; i < MAX_SZCMAP; i++) { + j = iomap[i]; + if (j > SZ_STATIC_CMAP && ncolors) + j = ((j - SZ_STATIC_CMAP) % ncolors) + SZ_STATIC_CMAP; + cmap_in[i] = cmap[j]; + } + + w->gterm.cmap_in_valid++; + return (cmap_in); +} + + +/* get_cmap_out -- Get the combined output colormap, used to transform window + * system color indices to the color system of the client. Note that this is + * not necessarily a uniquely defined invertible transformation. + */ +static Pixel * +get_cmap_out (w) + GtermWidget w; +{ + register Pixel *cmap; + register ushort *iomap; + Pixel *cmap_out = w->gterm.cmap_out; + register int pixel, i; + int j; + + if (w->gterm.cmap_out_valid) + return (cmap_out); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + + /* Invert the two colormaps. This is not very efficient, but we don't + * have to do this very often (a GtReadPixels call is about the only + * case, and even then the map is cached). + */ + for (j=0; j < MAX_SZCMAP; j++) { + pixel = j; + + /* Lookup display pixel in cmap. */ + for (i=0; i < MAX_SZCMAP; i++) + if (cmap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + + /* Lookup cmap pixel in iomap. */ + if (iomap[pixel] != pixel) { + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + } + + cmap_out[j] = pixel; + } + + w->gterm.cmap_out_valid++; + return (cmap_out); +} + + +/* get_pixel -- Convert a client color index into a display pixel. + */ +static Pixel +get_pixel (w, client_pixel) + register GtermWidget w; + register int client_pixel; +{ + register Pixel *cmap = get_cmap_in (w); + + if (client_pixel < 0 || client_pixel >= MAX_SZCMAP) + return (w->gterm.cmap[1]); + else + return (cmap[client_pixel]); +} + + +/* GtGetClientPixel -- Convert a gterm pixel into a client pixel. + */ +GtGetClientPixel (w, pixel) + GtermWidget w; + register int pixel; +{ + register int i; + register ushort *iomap; + int client_pixel = 0; + + get_cmap_in (w); + iomap = w->gterm.iomap; + + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + client_pixel = i; + break; + } + + return (client_pixel); +} + + +/* GtInitMappings -- Delete all mappings and initialize the mapping subsystem. + */ +GtInitMappings (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + invalidate_draw_context (w); + + /* Free any mapping storage. */ + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (mp->defined) + free_mapping (w, mp); + } + XtFree ((char *)w->gterm.mappings); + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + } + + /* Allocate the initially empty mapping descriptors. */ + w->gterm.mappings = + (Mapping) XtCalloc (w->gterm.maxMappings, sizeof (struct mapping)); + + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + mp->mapping = i; + } + + w->gterm.nmappings = 0; +} + + +/* GtNextMapping -- Return the index of the next available mapping descriptor. + * This routine always returns a mapping index of 1 or higher. + */ +GtNextMapping (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + for (i=1; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + return (i); + } + + return (-1); +} + + +/* GtFreeMapping -- Free a mapping descriptor. + */ +GtFreeMapping (w, mapping) + register GtermWidget w; + int mapping; +{ + free_mapping (w, &w->gterm.mappings[mapping]); +} + + +/* GtRaiseMapping -- Set the stacking order of a mapping to one level + * higher than the reference mapping. If no reference mapping is given + * the mapping is raised to the top of the stacking order. + */ +GtRaiseMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = w->gterm.mp_tail; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already on top? */ + if (mp == w->gterm.mp_tail) + return; + + mp_unlink (w, mp); + mp_linkafter (w, mp, ref_mp); +} + + +/* GtLowerMapping -- Change the stacking order of a mapping relative to another + * mapping, causing the first mapping to be drawn below the second. + */ +GtLowerMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = NULL; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already lowered? */ + if (mp == w->gterm.mp_head) + return; + + /* Lower it. */ + mp_unlink (w, mp); + if (ref_mp && ref_mp->prev) + mp_linkafter (w, mp, ref_mp->prev); + else { + mp->next = w->gterm.mp_head; + w->gterm.mp_head = mp; + if (mp->next) + mp->next->prev = mp; + if (!w->gterm.mp_tail) + w->gterm.mp_tail = mp; + } +} + + +/* GtCompareMappings -- Compare the stacking order of two mappings. A + * negative value is returned if the m1 < m2, zero is returned if the + * mappings are the same, and a positive value is returned if m1 > m2. + */ +GtCompareMappings (w, map1, map2) + register GtermWidget w; + int map1, map2; +{ + register Mapping mp, mp1, mp2; + + if (map1 == map2) + return (0); + + mp1 = &w->gterm.mappings[map1]; + mp2 = &w->gterm.mappings[map2]; + + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp == mp1) + return (-1); + else if (mp == mp2) + return (1); + + return (0); +} + + +/* GtSelectRaster -- Select the raster which maps to the given raster pixel, + * and transform the coordinates back to the source raster. The raster number + * and the raster coordinates of the source raster are returned. If no raster + * maps to the given pixel, raster=src and source raster coordinates are + * returned. + * + * The raster pixel coordinate system is best explained by an example. + * Suppose we have a 10x10 raster mapped into a 500x500 window. The + * window pixel 0 on an axis has raster pixel coordinate 0.0; pixel 500 + * (which is outside the window) has raster pixel coordinate 10.0. The + * coordinates correspond to the edge of the pixel as displayed in the + * window, i.e., the left edge of the (nonflipped) window is at x=0.0, and + * the right edge at x=10.0. Due to the pixelization of the screen, the + * maximum value is a limit which is only approached as the magnification + * increases. + * + * The client application may have a different coordinate system than the + * above. For example, if the client wants an integer pixel value to be + * at the center of a pixel, the first pixel has the coordinate [1,1], and + * the raster is 10 pixels wide, the client coordinate system would range + * from 0.5 to 10.5 at the edges of the NDC space. + */ +GtSelectRaster (w, dras, dt, dx, dy, rt, rx, ry, rmap) + GtermWidget w; + int dras; /* display raster */ + int dt; /* coordinate type of input coords */ + int dx, dy; /* display raster coordinates */ + int rt; /* coordinate type for output */ + int *rx, *ry; /* raster coordinates (output) */ + int *rmap; /* mapping selected */ +{ + register Mapping mp; + float x, y, x2, y2; + int raster, mapping; + + /* Get display raster pixel coordinates. */ + if (dt != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, 0, 0,0,0,0, + 0, dt, dx,dy,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + dx = p_mp.dx; + dy = p_mp.dy; + } + + /* Search for a mapping which maps to this pixel. The mapping we are + * looking for is the mapping closest to the tail of the mapping list + * (highest stacking order) which is defined and enabled and which + * includes the given display raster pixel in its destination rect. + */ + for (mp = w->gterm.mp_tail, mapping = -1; mp; mp = mp->prev) { + if (mp->defined && mp->enabled && mp->dst == dras) { + struct mapping *map, p_mp; + int dnx, dny; + + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + if ((dnx = map->dnx) < 0) + dnx = -dnx; + if ((dny = map->dny) < 0) + dny = -dny; + + /* Is display raster pixel in destination rect for this mapping? + */ + if (dnx > 0 && dx >= map->dx && dx < map->dx + dnx && + dny > 0 && dy >= map->dy && dy < map->dy + dny) { + + /* Compute offset into destination rect and apply axis flip + * if any from mapping. + */ + x = dx - map->dx + 0.5; + if (map->dnx < 0) + x = dnx - x; + y = dy - map->dy + 0.5; + if (map->dny < 0) + y = dny - y; + + /* Compute the source raster coordinates corresponding to + * the given display pixel. This is done in floating point + * to permit fractional pixel resolution if the mapping + * zooms the raster. + */ + x = x * (float)map->snx / (float)dnx + map->sx; + y = y * (float)map->sny / (float)dny + map->sy; + + mapping = map->mapping; + raster = map->src; + x2 = w->gterm.rasters[raster].width; + y2 = w->gterm.rasters[raster].height; + + break; + } + } + } + + /* Return display raster coordinates if no mapped raster was found. + */ + if (mapping < 0) { + x = dx; y = dy; + x2 = (int)w->core.width - 1; + y2 = (int)w->core.height - 1; + raster = dras; + } + + /* Output coordinates of the requested type. The increased resolution + * of NDC coordinates allows fractional pixel coordinates to be returned + * (e.g. 1/32 of a pixel for a 1K raster). + */ + if (rt == GtPixel) { + *rx = x; + *ry = y; + } else { + *rx = ( x) / x2 * MAXNDC; + *ry = (y2 - y) / y2 * MAXNDC; /* NDC is flipped in Y */ + } + + *rmap = mapping; + return (raster); +} + + +/* GtCopyRaster -- Copy a region of the source raster to a region of the + * destination raster. If the input and output regions are not the same + * size the subimage is automatically scaled to fit the destination region. + * If the destination extent DNX or DNY is negative, the image is flipped in + * that axis. The type of spatial scaling performed is determined by the + * scale factors (zoom, dezoom, or no scaling). The rasterop argument is + * used to exercise fine control over how the mapping is performed, e.g., to + * force a refresh, implement a transient mapping, or in the case of a dezoom + * (many-to-one) mapping, select the antialiasing technique to be used. + */ +GtCopyRaster (w, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for destination raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + struct mapping sv_mp, p_mp; /* MF007 */ + int status; + + if (!w || !XtIsRealized ((Widget)w)) + return (OK); + + /* Construct a temporary mapping describing the desired raster copy. */ + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, w->gterm.maxMappings, 0, + src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + initialize_mapping (&p_mp); + get_pixel_mapping (w, &sv_mp, &p_mp, 1); + update_mapping (w, &p_mp); + + /* Refresh the destination pixels. */ +fprintf(stderr, "GtCopyRaster() -- \n"); + status = refresh_destination (w, &p_mp, dx, dy, abs(dnx), abs(dny)); + + /* Discard the temporary mapping. */ + free_mapping (w, &p_mp); + + return (status); +} + + +/* GtSetMapping -- Define a new mapping function, or modify an old one. + * If a new mapping is defined it is merely enabled, and no refreshing + * of the screen takes place until either some mapped data is written + * to or the mapping is explicitly refreshed. If an existing mapping is + * modified the old and new mappings are examined and only those portions + * of the destination rect for which the mapping changed are updated. + * This permits minor changes to a mapping (e.g. moving an edge) without + * having to redraw the entire region. Regions of the destination drawable + * which were previously covered by the mapping but which were exposed by + * modifying the mapping are redrawn. + */ +GtSetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for source raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + register int i, j; + register Mapping mp, o_mp, n_mp; + struct mapping pix_mp, new_mp; + int defined, scale_changed, offset, current, state, old_i; + int nx, xs[MAX_REGIONS], xe[MAX_REGIONS], xv[MAX_REGIONS]; + int ny, ys[MAX_REGIONS], ye[MAX_REGIONS], yv[MAX_REGIONS]; + int n_dnx, n_dny, n_xflip=0, n_yflip=0, i1, i2; + int o_dnx, o_dny, o_xflip=0, o_yflip=0; + int *o_xymap, *o_xmap, *o_ymap; + int *n_xymap, *n_xmap, *n_ymap; + int dummy_rop; /* MF011 */ + XRectangle rl[MAX_REGIONS]; + int nrect, buflen, refresh; + + /* Check mapping number in range. */ + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (ERR); + else + mp = &w->gterm.mappings[mapping]; + +fprintf (stderr, "GtSetMapping - ENTER\n"); + invalidate_draw_context (w); + initialize_mapping (&pix_mp); + initialize_mapping (&new_mp); + + /* Get local pixel space copy of old mapping, store new mapping. */ + get_pixel_mapping (w, mp, &pix_mp, 1); + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = snx; mp->sny = sny; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dnx; mp->dny = dny; + mp->rop = (rop & ~(R_RefreshNone|R_RefreshAll)); + mp->updated = 0; + + /* Newly defined mappings are linked at the tail of the mapping list, + * i.e. they stack (display) on top of any other mappings. If the + * mapping is already defined the stacking order is not changed. + */ + if (!(defined = mp->defined)) { + mp_linkafter (w, mp, w->gterm.mp_tail); + mp->defined = 1; + } + + if (!valid_mapping (w, mp)) { + mp_unlink (w, mp); + mp->defined = 0; + return (ERR); + } + update_mapping (w, mp); + + /* If we are defining a new mapping just define it and quit, without + * refreshing the window, unless R_RefreshAll is explicitly set in the + * mapping. If the mapping is not enabled merely store the new mapping. + * If the mapping is a null mapping (no pixels) do nothing. If refresh + * is disabled in the rasterop merely store the new mapping. If we are + * editing an existing mapping which is enabled with the default rasterop, + * we continue on to compare the old and new mappings and refresh any + * changed pixels in the destination rect. + */ + if (!defined || src != mp->src || dst != mp->dst) { + mp->enabled = mp->defined = 1; + mp->refresh = 0; + return (OK); + } else if (!mp->enabled) { + return (OK); + } else if (snx == 0 || sny == 0 || dnx == 0 || dny == 0) + return (OK); + + if (rop & R_RefreshNone) + return (OK); + + /* Convert input mappings to pixel coordinates, we deal with only pixel + * coordinates from here on. + */ + get_pixel_mapping (w, mp, &new_mp, 1); + load_mapping (&new_mp, &mapping, &dummy_rop, /* MF011 */ + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + update_mapping (w, n_mp = &new_mp); + update_mapping (w, o_mp = &pix_mp); + + /* + * We are editing an existing mapping. Determine what has changed in + * the mapping and refresh the changed regions. + */ + + /* Get old XY scaling maps. + */ + o_xmap = o_mp->x_srcpix; + o_ymap = o_mp->y_srcpix; + + if ((o_dnx = o_mp->dnx) < 0) { + o_dnx = -o_dnx; + o_xflip = 1; + } + if ((o_dny = o_mp->dny) < 0) { + o_dny = -o_dny; + o_yflip = 1; + } + + /* Get new XY scaling maps. + */ + n_xmap = n_mp->x_srcpix; + n_ymap = n_mp->y_srcpix; + + if (dnx < 0) { + dnx = -dnx; + n_xflip = 1; + } + if (dny < 0) { + dny = -dny; + n_yflip = 1; + } + + /* Refresh the entire region if the refresh flag is set, a flip has + * occurred, or we are doing a complex dezoom mapping. + */ + refresh = (o_mp->refresh || (rop & R_RefreshAll)); + if (n_xflip != o_xflip || n_yflip != o_yflip) + refresh = 1; + if (n_mp->scaling == M_DEZOOM) + refresh = 1; + + /* Has the spatial scale changed? */ + scale_changed = + abs (o_mp->xscale - n_mp->xscale) > 1.0E-4 || + abs (o_mp->yscale - n_mp->yscale) > 1.0E-4; + + /* If any of the above conditions are true refresh the entire mapping, + * otherwise compare the old and new mappings and refresh any subregions + * which have changed. + */ + if (refresh || scale_changed || n_mp->scaling == M_DEZOOM) { + refresh_destination (w, n_mp, dx, dy, dnx, dny); + + } else { + /* Compare the old and new mappings to see what needs to be + * refreshed. For speed reasons we only want to refresh the pixels + * which have been remapped. Any destination pixel in the new mapping + * which does not map to the same source pixel as in the old mapping + * must be refreshed. We examine each X and Y coordinate in the new + * destination rect and see if the source coordinate this maps to is + * the same as in the old mapping. If a given destination pixel [i,j] + * maps to the same pixel [i,j] in the source as it did in the + * previous mapping, we do not need to refresh that pixel. We examine + * the X and Y axis in turn and build up a list of regions which do or + * do not need to be refreshed. + */ + + /* Get a list of ranges {XS,XE,XV} in X. */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + dx, dnx, n_xmap, o_mp->dx, o_dnx, o_xmap); + + /* Get a list of ranges {YS,YE,YV} in Y. */ + ny = get_regions (ys,ye,yv, MAX_REGIONS, + dy, dny, n_ymap, o_mp->dy, o_dny, o_ymap); + + /* The list of ranges in X and Y together define a raster of arbitary + * sized subrectangles filling the destination rect. If the state + * value is nonzero (bit 1 set) in either X or Y, the subrectangle + * must be refreshed. The get_rects routine returns a list of the + * rectangular subregions matching the given condition (bit 1 set in + * either axis). Adjacent rectangles are merged to minimize the + * number of calls to refresh_destination. + */ + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 1,1); + for (i=0; i < nrect; i++) + refresh_destination (w, n_mp, + rl[i].x, rl[i].y, rl[i].width, rl[i].height); + } + + /* Refresh any lower level mappings exposed when the current mapping was + * modified. These will be regions of the old rect not present in the + * new, modified rect for the current mapping. + */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + o_mp->dx, o_dnx, o_xmap, dx, dnx, n_xmap); + ny = get_regions (ys,ye,yv, MAX_REGIONS, + o_mp->dy, o_dny, o_ymap, dy, dny, n_ymap); + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 2,2); + + for (i=0; i < nrect; i++) { + XRectangle r, in; + Mapping mp; + + /* Clear the uncovered region. */ + GtSetPixels (w, dst, GtPixel, rl[i].x, rl[i].y, rl[i].width, + rl[i].height, GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (mp = w->gterm.mp_head; mp && mp->mapping != mapping; + mp = mp->next) { + + if (mp->enabled && mp->dst == dst) { + r.x = mp->dx; + r.y = mp->dy; + r.width = mp->dnx; + r.height = mp->dny; + + if (rect_intersect (&in, &r, &rl[i])) + refresh_destination (w, mp, + in.x, in.y, in.width, in.height); + } + } + } + + free_mapping (w, n_mp); + free_mapping (w, o_mp); + mp = &w->gterm.mappings[mapping]; + mp->refresh = 0; + +fprintf (stderr, "GtSetMapping - LEAVING\n"); + return (OK); +} + + +/* GtGetMapping -- Return the external parameters of a mapping. If the + * numberd mapping is undefined -1 is returned; 0 is returned if the + * mapping is defined but not enabled, and 1 is returned if the mapping + * is active. + */ +GtGetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int *rop; /* rasterop */ + int *src; /* 0=window, >0 = raster number */ + int *st; /* coordinate type for source raster */ + int *sx,*sy,*snx,*sny; /* source raster */ + int *dst; /* 0=window, >0 = raster number */ + int *dt; /* coordinate type for source raster */ + int *dx,*dy,*dnx,*dny; /* destination raster */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (-1); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (-1); + + *rop = mp->rop; + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *snx = mp->snx; *sny = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dnx = mp->dnx; *dny = mp->dny; + + return (mp->enabled != 0); +} + + +/* GtActiveMapping -- Query whether a mapping is active. + */ +GtActiveMapping (w, mapping) + register GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (0); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (0); + + return (mp->enabled != 0); +} + + +/* GtEnableMapping -- Enable a mapping. Enabling a mapping does not + * update the destination unless the refresh flag is set. Enabling a + * mapping activates the mapping so that any changes to the source will + * be mapped to the destination. + */ +GtEnableMapping (w, mapping, refresh) + GtermWidget w; + int mapping; /* mapping number */ + int refresh; /* refresh destination */ +{ + register Mapping mp; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (!mp->enabled) { + mp->enabled = True; + if (refresh) + GtRefreshMapping (w, mapping); + } + return (OK); + } + } + return (ERR); +} + + +/* GtDisableMapping -- Disable a mapping. Disabling a mapping does not + * affect the mapping definition, hence a disabled mapping may later be + * reenabled. If the ERASE flag is set the destination region is redrawn + * with the mapping disabled. + */ +GtDisableMapping (w, mapping, erase) + GtermWidget w; + int mapping; /* mapping number */ + int erase; /* erase the destination */ +{ + register int i; + register Mapping mp, dmp; + XRectangle r, d, in; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->enabled) { + mp->enabled = False; + + if (erase) { + d.x = mp->dx; + d.y = mp->dy; + d.width = abs(mp->dnx); + d.height = abs(mp->dny); + + /* Clear the uncovered region. */ + GtSetPixels (w, mp->dst, GtPixel, + d.x, d.y, d.width, d.height, + GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (dmp = w->gterm.mp_head; + dmp && dmp->mapping != mapping; dmp = dmp->next) { + + if (dmp->enabled && dmp->dst == mp->dst) { + r.x = dmp->dx; + r.y = dmp->dy; + r.width = dmp->dnx; + r.height = dmp->dny; + + if (rect_intersect (&in, &r, &d)) + refresh_destination (w, dmp, + in.x, in.y, in.width, in.height); + } + } + } + } + return (OK); + } + } + + return (ERR); +} + + +/* GtRefreshMapping -- Refresh the destination region defined by a mapping. + */ +GtRefreshMapping (w, mapping) + GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + struct mapping p_mp; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->st != GtPixel || mp->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 1); + update_mapping (w, mp = &p_mp); + } else + update_mapping (w, mp); + + if (CacheXImage) /* MF004 */ + DestroyCachedXImage(); /* MF004 */ + +fprintf(stderr, "GtRefreshMapping() -- \n"); + refresh_destination (w, mp, + mp->dx, mp->dy, abs(mp->dnx), abs(mp->dny)); + if (mp == &p_mp) + free_mapping (w, mp); + } + } +} + + +/* GtMapVector -- Map a point vector from the coordinate system of one raster + * to another as defined by the given mapping. The mapping may be either in + * the forward direction (dir = GtMap) or the reverse (dir = GtUnmap). The + * point vector is maintained in floating point for this operation to avoid + * loss of precision. The input and output vectors may be the same vector. + */ +GtMapVector (w, mapping, dir, pv1, pv2, npts) + GtermWidget w; + int mapping; + int dir; /* GtMap, GtUnmap */ + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register DPoint *ip = pv1; + register DPoint *op = pv2; + register Mapping mp; + register int n; + + struct mapping p_mp; + double xscale, xoffset; + double yscale, yoffset; + int sx, sy; + + xscale = yscale = 1.0; + xoffset = yoffset = 0.0; + sx = sy = 0; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (valid_mapping (w, mp)) { + /* Determine the transformation coefficients. */ + get_pixel_mapping (w, mp, &p_mp, 0); + mp = &p_mp; + + xscale = (float)mp->dnx / (float)mp->snx; + if (xscale < 0) + xoffset = mp->dx + abs(mp->dnx) - 1; + else + xoffset = mp->dx; + + yscale = (float)mp->dny / (float)mp->sny; + if (yscale < 0) + yoffset = mp->dy + abs(mp->dny) - 1; + else + yoffset = mp->dy; + + sx = mp->sx; + sy = mp->sy; + } + } + + /* Map the vector. */ + if (dir == GtMap) { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - sx) * xscale + xoffset; + op->y = (ip->y - sy) * yscale + yoffset; + } + } else { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - xoffset) / xscale + sx; + op->y = (ip->y - yoffset) / yscale + sy; + } + } +} + + +/* GtPixelToNDC -- Transform a vector from pixel to NDC coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtPixelToNDC (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ( ip->x) / rp->width * MAXNDC; + op->y = (rp->height - ip->y) / rp->height * MAXNDC; + } +} + + +/* GtNDCToPixel -- Transform a vector from NDC to pixel coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtNDCToPixel (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x / MAXNDC * rp->width; + op->y = rp->height - (ip->y / MAXNDC * rp->height); + } +} + + +/* GtDebug -- Print debug info. If the file descriptor is NULL output is + * to the process stdout. The "what" argument may be used to select the + * type of output desired. If what=0 the full output is generated, + * otherwise bits are used to select what output is to be generated. + * + * "what" bitflags: + * + * 001 Widget information + * 002 List rasters + * 004 List mappings + * 010 List colormaps + * 020 List markers + * + * This routine is intended only for use during debugging. + */ +GtDebug (w, fp, what) + GtermWidget w; + FILE *fp; + int what; +{ + /* Default is to write everything to the stdout. */ + what = what ? what : 0777; + fp = fp ? fp : stdout; + + /* Print widget header. */ + if (what & 001) { + fprintf (fp, "Widget 0x%x (%s) %dx%d raster=%d\n", + w, w->core.name, w->core.width, w->core.height, w->gterm.raster); + fprintf (fp, + "--------------------------------------------------------------\n"); + } + + /* Print raster information. */ + if (what & 002) { + register int i; + register Raster rp; + + if (w->gterm.rasters) { + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) + continue; + fprintf (fp, "raster %4d type=%s delete=%d size=%dx%d\n", + i, rp->type == ImageRaster ? "client" : "server", + rp->delete, rp->width, rp->height); + } + } else + fprintf (fp, "no rasters\n"); + } + + /* Print mapping information. */ + if (what & 004) { + register int i; + register Mapping mp; + char flags[32]; + + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + continue; + + flags[0] = mp->enabled ? 'E' : 'D'; + flags[1] = mp->updated ? 'U' : ' '; + flags[2] = mp->refresh ? 'R' : ' '; + flags[3] = '\0'; + + fprintf (fp, "mapping %3d %s %8o", i, flags, mp->rop); + fprintf (fp, " %2d %s %3d %3d %3d %3d", + mp->src, mp->st == GtPixel ? "pix" : "ndc", + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (fp, " %2d %s %3d %3d %3d %3d\n", + mp->dst, mp->dt == GtPixel ? "pix" : "ndc", + mp->dx, mp->dy, mp->dnx, mp->dny); + } + } else + fprintf (fp, "no mappings\n"); + + fprintf (fp, "mappings from head: "); + for (mp = w->gterm.mp_head; mp; mp = mp->next) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + + fprintf (fp, "mappings from tail: "); + for (mp = w->gterm.mp_tail; mp; mp = mp->prev) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + } + + /* Print colormap information. */ + if (what & 010) { + register struct colormap *cm; + + fprintf (fp, "cmapName=%s ncolors=%d basePixel=%d\n", + w->gterm.cmapName, w->gterm.ncolors, w->gterm.base_pixel); + for (cm = w->gterm.colormaps; cm; cm = cm->next) + fprintf (fp, "colormap %2d ncells=%d\n", cm->map, cm->ncells); + } + + /* Print marker information. */ + if (what & 020) { + register Marker mm; + char value[256]; + + for (mm = w->gterm.gm_head; mm; mm = mm->next) { + GmGetAttribute (mm, GmType, (XtArgVal)value, XtRString); + fprintf (fp, "marker 0x%x: %10s flags=0x%x [%d %d %d %d] %0.5g\n", + mm, value, mm->flags, mm->x, mm->y, mm->width, mm->height, + mm->rotangle); + } + } +} + + +/* + * Internal procedures for the above code. + * ---------------------------------------- + */ + +/* get_colormap -- Get a private colormap. On all calls after the first + * this just returns the existing gterm widget colormap. On the first call + * we query the server for the named custom colormap, and if the colormap + * exists we modify the gterm widget to use it. If the custom colormap has + * not yet been created by some other client, we create it. + * + * This code creates a custom colormap using the "standard colormap" + * facilities provided by XLIB. Although we do not use any of the predefined + * standard colormaps, use of the standard colormap facilities allows any + * number of clients to share the same custom colormap. Use of a custom + * colormap helps avoid running out of space in the default colormap, ensures + * that the gterm widget will get the color cells it needs, and makes it + * easier for several imaging clients which share the same colormap to + * simultaneously display their windows. + * + * To minimize colormap flashing we try to avoid using the full colormap, + * setting the unused cells to the colors set in the default colormap. In + * most cases this will prevent the rest of the screen from changing color + * when the custom colormap is installed. + */ +static Colormap +get_colormap (w) + GtermWidget w; +{ + register int i, j; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + XColor def_colors[SZ_STATIC_CMAP], *cp, *c1, *c2; + XStandardColormap cm, *cm_p; + XColor colors[MAX_SZCMAP]; + int base_pixel, p1, p2; + Colormap colormap; + char property[128]; + int ncmap, nitems; + Pixel pixel; + Atom atom; + + if (w->gterm.haveColormap) + return (w->core.colormap); + + /* Map custom colormap name to atom. */ + sprintf (property, "GT_%s", w->gterm.cmapName); + atom = XInternAtom (display, property, False); + w->gterm.cmapAtom = atom; + + /* Get custom colormap. + */ + if (!w->gterm.cmapInitialize && + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom)) { + + /* Colormap aleady exists, just use it. + */ + cm = *cm_p; + colormap = cm.colormap; + w->gterm.base_pixel = cm.base_pixel; + + } else { + /* Create or reinitialize a global colormap. + */ + XVisualInfo template, *vi; + Display *d; + Screen *s; + Window root; + long mask; + + if (!(d = XOpenDisplay (DisplayString(display)))) + goto use_default; + s = DefaultScreenOfDisplay (d); + root = DefaultRootWindow (d); + + /* Try to get a pseudocolor visual. */ + mask = 0; + template.screen = DefaultScreen(d); mask |= VisualScreenMask; + template.depth = RasterDepth; mask |= VisualDepthMask; + template.class = PseudoColor; mask |= VisualClassMask; + + if (!(vi = XGetVisualInfo (d, mask, &template, &nitems))) { + XCloseDisplay (d); + goto use_default; + } + + /* Create custom colormap with all cells allocated read/write */ + colormap = XCreateColormap (d, root, vi->visual, AllocAll); + + /* Initialize colormap to be same as default colormap. */ + nitems = min (MAX_SZCMAP, CellsOfScreen(s)); + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (d, DefaultColormapOfScreen(s), colors, nitems); + XStoreColors (d, colormap, colors, nitems); + + /* Globally define permanent server custom colormap. */ + memset ((char *)&cm, 0, sizeof(cm)); + cm.colormap = colormap; + cm.base_pixel = w->gterm.base_pixel; + cm.red_max = 0; + cm.visualid = vi->visualid; + cm.killid = 1; + XSetRGBColormaps (d, root, &cm, 1, atom); + + XSetCloseDownMode (d, RetainPermanent); + XCloseDisplay (d); + w->gterm.cmapInitialize = False; + + /* Free the XVisualInfo struct. */ + if (vi) + XFree ((void *)vi); /* MF040 */ + } + + /* Save default color assignments for static colors. */ + for (i=0; i < SZ_STATIC_CMAP; i++) + def_colors[i] = w->gterm.color[i]; + + nitems = min (MAX_SZCMAP, CellsOfScreen(screen)); + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + base_pixel = w->gterm.base_pixel; + + /* Get the private colormap. */ + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (display, colormap, colors, nitems); + + /* Initialize the raster pixel to display pixel mapping and set the + * color assigned to each pixel value in the private colormap. + */ + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, base_pixel + i - SZ_STATIC_CMAP); + w->gterm.color[i] = colors[pixel]; + } + + /* Check the static part of the cmap to make sure that the pixel numbers + * aren't aliased to pixels in the dynamic part of the custom colormap. + * If this happens, reassign these color numbers to the pixels just + * preceeding the dynamic part of the custom colormap. The red_max + * field of the colormap descriptor is used to keep track of the number + * of static colors allocated by different clients. These static colors + * are shared, hence the same color will not be stored twice. + */ + p1 = p2 = base_pixel - cm.red_max; + for (i=0; i < SZ_STATIC_CMAP; i++) { + pixel = w->gterm.cmap[i]; + if (pixel >= base_pixel && pixel < base_pixel+DEF_MAXCOLORS && p1 > 2) { + /* First check to see if we already have a static entry reserved + * for this color. + */ + c1 = &def_colors[i]; + for (j=p1, cp=NULL; j < base_pixel; j++) { + c2 = &colors[j]; + if (c1->red == c2->red && c1->green == c2->green && + c1->blue == c2->blue) { + cp = c2; + break; + } + } + + /* Assign a new screen pixel value. */ + if (cp) + w->gterm.cmap[i] = cp->pixel; + else { + cp = &colors[--p1]; + *cp = def_colors[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = w->gterm.cmap[i] = p1; + cm.red_max++; + } + w->gterm.color[i].pixel = w->gterm.cmap[i]; + } + } + if (p1 < p2) { + XStoreColors (display, colormap, &colors[p1], p2 - p1); + XSetRGBColormaps (display, w->gterm.root, &cm, 1, atom); + } + + /* Assign the new colormap to the gterm widget's window. */ + XtVaSetValues ((Widget)w, XtNcolormap, (XtArgVal)colormap, NULL); + w->gterm.haveColormap++; + + /* If the pointer is in the window, advise window manager to load the + * colortable for the window. + */ + if (w->gterm.in_window) +{ printf ("get_colormap ... requesting focus...\n"); + request_colormap_focus (w); +} + + return (colormap); + +use_default: + /* Unable to create custom colormap. */ + w->gterm.useDefaultCM++; + w->gterm.haveColormap++; + return (w->core.colormap); +} + + +/* request_colormap_focus -- Modify the WM_COLORMAP_WINDOWS property on a + * widget's top level shell window to advise the window manager that the + * widget's window should have its colormap loaded. This should only be + * used for windows that have a colormap different than that of the top + * level window. + */ +static +request_colormap_focus (w) + GtermWidget w; +{ + Widget p; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Find the top level window. */ + for (p = XtParent(w); !XtIsShell(p); p = XtParent(p)) + ; + + /* Modify WM_COLORMAP_WINDOWS to give the current window priority. + */ + if (p) { + Window window = XtWindow (p); + Window *wl = NULL, n_wl[MAX_WMWIN+1]; + register int n_nw, i; + int nw; + + /* If WM_COLORMAP_WINDOWS is already set save its value, otherwise + * start a list initially containing only the top level window. + */ + w->gterm.wmTop = window; + if (XGetWMColormapWindows (w->gterm.display, window, &wl, &nw)) { + memmove (w->gterm.wmWindows, (char *)wl, nw * sizeof(int)); + w->gterm.n_wmWindows = nw = min (nw, MAX_WMWIN); + free ((char *)wl); + } else { + w->gterm.wmWindows[0] = window; + w->gterm.n_wmWindows = nw = 1; + } + + n_nw = 0; + wl = w->gterm.wmWindows; + n_wl[n_nw++] = XtWindow(w); + + for (i=0; i < nw; i++) + if (wl[i] != XtWindow(w)) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, window, n_wl, n_nw); + } +} + + +/* restore_colormap_focus -- Reset WM_COLORMAP_WINDOWS. Retain the window + * that had the focus in the list, but drop its priority one notch. This + * should follow a prior call to request_colormap_focus. + */ +static +restore_colormap_focus (w) + GtermWidget w; +{ + register int nw, n_nw, i; + Window *wl, n_wl[MAX_WMWIN+1], old; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + old = XtWindow(w); + wl = w->gterm.wmWindows; + if ((nw = w->gterm.n_wmWindows) == 0 || (nw == 1 && wl[0] == old)) + return; + + n_nw = 0; + if (wl[0] != old) + n_wl[n_nw++] = wl[0]; + n_wl[n_nw++] = old; + + for (i=1; i < nw; i++) + if (wl[i] != old) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, w->gterm.wmTop, n_wl, n_nw); +} + + +/* inherit_default_colormap -- Set any unused cells of the custom colormap + * to the colors defined for the corresponding cells of the default colormap. + * This minimizes colormap flashing when using a custom colormap, but only + * works if a few unused cells can be reserved, e.g., at the beginning of + * the colormap (which is usually where X allocates its colors). + */ +static +inherit_default_colormap (w) + GtermWidget w; +{ + register XColor *cp, *ap; + register int ncolors, i; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + Window root = w->gterm.root; + Atom atom = w->gterm.cmapAtom; + XColor colors[MAX_SZCMAP]; + XStandardColormap *cm; + int first, nitems, ncmap; + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.base_pixel <= 0) + return; /* fully allocated colormap */ + + /* We have to read the colormap property again as another client could + * have reserved more static colors (i.e.,changed red_max), and we don't + * want to clobber these colors. + */ + if (XGetRGBColormaps (display, root, &cm, &ncmap, atom)) { + /* Make sure we have the right colormap. */ + if (w->core.colormap != cm->colormap) + XtVaSetValues ((Widget)w,XtNcolormap,(XtArgVal)cm->colormap,NULL); + + /* Get lower part of default colormap. */ + ncolors = cm->base_pixel - cm->red_max; + for (cp=colors, i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = i; + } + + /* Get upper part of default colormap. */ + first = cm->base_pixel + w->gterm.ncolors - SZ_STATIC_CMAP; + ncolors = min (MAX_SZCMAP, CellsOfScreen(screen)) - first; + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = first + i; + } + + /* Inherit values from default colormap. */ + ncolors = cp - colors; + XQueryColors (display, DefaultColormapOfScreen(screen), + colors, ncolors); + XStoreColors (display, w->core.colormap, colors, ncolors); + + /* The global gterm colormap may have changed. Compare widget's + * version of color table with the global colortable and update + * the widget's state if the global colortable has changed. + */ + ncolors = w->gterm.ncolors; + memmove (colors, w->gterm.color, ncolors * sizeof(*cp)); + XQueryColors (display, w->core.colormap, colors, ncolors); + for (i=ncolors, cp=colors, ap=w->gterm.color; --i >= 0; cp++, ap++) + if (cp->red != ap->red || cp->green != ap->green || + cp->blue != ap->blue) { + memmove (w->gterm.color, colors, ncolors * sizeof(*cp)); + invalidate_cmap (w); + } + } +} + + +/* update_default_colormap -- Update the default colormap so that any + * unallocated cells mirror the widget's custom colormap. This increases + * the chance that the widget's contents will be visible when the window + * does not have the colormap focus, and minimizes flashing when the + * colormap focus changes. + */ +static +update_default_colormap (w) + GtermWidget w; +{ + register XColor *ip, *op; + register int j, n; + register Pixel v; + + XColor colors[MAX_SZCMAP]; + Pixel pixels[MAX_SZCMAP]; + char allocated[MAX_SZCMAP]; + int overflow, req, need, first, nelem, i; + unsigned long plane_masks[1]; + Colormap defcmap; + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + + first = SZ_STATIC_CMAP; + nelem = w->gterm.ncolors; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + /* need = min (MAX_SZCMAP, first + nelem - SZ_STATIC_CMAP); */ + need = MAX_SZCMAP; + + /* Get the colormap cells. */ + for (req=need, n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, defcmap, False, + plane_masks, 0, &pixels[n], req)) { + n += req; + } else + req /= 2; + + /* Perform the color matching. This is awkward as the pixel value + * assignments may be different in the two colormaps. We have to look + * up each pixel before attempting to assign a color, or XStoreColors + * below will result in a server error. + */ + memset (allocated, 0, sizeof(allocated)); + overflow = 0; + + for (i=0; i < n; i++) { + v = pixels[i]; + if (v < MAX_SZCMAP) + allocated[v] = 1; + else { + overflow++; + break; + } + } + + ip = &w->gterm.color[first]; + op = colors; + if (overflow) { + for (i=0; i < nelem; i++, ip++) + for (j=0, v = ip->pixel; j < n; j++) + if (pixels[j] == v) { + *op++ = *ip; + break; + } + } else { + for (j=0; j < nelem; j++, ip++) + if (allocated[ip->pixel]) { + allocated[ip->pixel] = 0; + *op++ = *ip; + } + } + + if (op > colors) + XStoreColors (w->gterm.display, defcmap, + colors, op - colors); + + XFreeColors (w->gterm.display, defcmap, pixels, n, 0); +} + + +/* refresh_source -- Refresh a portion of a mapping given the source rect + * to be refreshed. If the given source rect is not within the mapping, + * this is a no-op. + */ +static +refresh_source (w, mp, x1, y1, nx, ny) + GtermWidget w; + register Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of source to be refreshed */ +{ + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Compute the intersection of the modified region of the source raster + * with the rectangular region of the source raster affected by the given + * mapping. + */ + sx1 = max (x1, mp->sx); + sy1 = max (y1, mp->sy); + sx2 = min(x1 + nx, mp->sx + mp->snx) - 1; + sy2 = min(y1 + ny, mp->sy + mp->sny) - 1; + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + /* Do nothing if the rectangles do not intersect. */ + if (snx <= 0 || sny <= 0) + return (OK); + + /* Compute the destination rect affected by the mapped source rect. + */ + dx1 = mp->x_extent[sx1 - mp->sx].lo; + dx2 = mp->x_extent[sx2 - mp->sx].hi; + if (dx1 > dx2) { + dx1 = mp->x_extent[sx2 - mp->sx].lo; + dx2 = mp->x_extent[sx1 - mp->sx].hi; + } + + dy1 = mp->y_extent[sy1 - mp->sy].lo; + dy2 = mp->y_extent[sy2 - mp->sy].hi; + if (dy1 > dy2) { + dy1 = mp->y_extent[sy2 - mp->sy].lo; + dy2 = mp->y_extent[sy1 - mp->sy].hi; + } + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + if (CacheXImage) /* MF004 */ + DestroyCachedXImage(); /* MF004 */ + + /* Perform the refresh operation. */ +fprintf(stderr, "refresh_source() -- \n"); + return (refresh_destination (w, mp, dx1, dy1, dnx, dny)); +} + + +/* refresh_destination -- Refresh (redraw) the pixels in the given destination + * rect. The mapping operand defines how to generate the value of each output + * pixel. This is the routine which does all the real work of a mapping, + * computing the values of the output pixels and writing to the destination + * drawable. Note: the destination rect must be specified in raster pixel + * coordinates (no NDC). + */ +static +refresh_destination (w, mp, x1, y1, nx, ny) + GtermWidget w; + Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of destination to be refreshed */ +{ + Raster sr, dr; + Display *display = w->gterm.display; + int scaling, xflip, yflip, delxin=0, delxout=0; + int ox, oy, rop, clip, mapping, i, j; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int xoff, yoff, p1, p2, q1, q2; + float xscale, yscale; + struct mapping *np, p_mp; + XImage *xin, *xout; + int status = OK; + Pixmap pixmap; /* MF004 */ + + Region clip_region, mask_region; + uchar *old_xin_lp, *old_xout_lp; + uchar *xin_lp, *xout_lp, *op; + int xin_bpl, xout_bpl; + int *xmap, *ymap; + XRectangle r; + + + +fprintf(stderr, "ENTERING refresh_destination, x,y = %d,%d nx,ny = %d,%d\n", + x1,y1,nx,ny); + + if (!w || !XtIsRealized ((Widget)w)) + return (OK); + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + if (DEBUG_TRACE) + fprintf(stderr, "\nENTER refresh_destination\n"); + + + /* Offsets into the x_*,y_* mapping lookup tables. */ + xoff = x1 - mp->dx; + yoff = y1 - mp->dy; + + /* Get source and destination rects. */ + dst = mp->dst; + dx = x1; dy = y1; + dnx = nx; dny = ny; + + src = mp->src; + p1 = mp->x_srcpix[xoff]; + q1 = mp->y_srcpix[yoff]; + p2 = mp->x_srcpix[xoff + nx - 1]; + q2 = mp->y_srcpix[yoff + ny - 1]; + sx = min (p1, p2); + sy = min (q1, q2); + snx = abs (p2 - p1) + 1; + sny = abs (q2 - q1) + 1; + + /* Define some local variables. */ + sr = &w->gterm.rasters[src]; + dr = &w->gterm.rasters[dst]; + mapping = mp->mapping; + scaling = mp->scaling; + xscale = mp->xscale; + yscale = mp->yscale; + rop = mp->rop; + + if (!sr->type || !dr->type) + return (ERR); + if (snx <= 0 || sny <= 0 || dnx == 0 || dny == 0) + return (ERR); + if (src < 0 || src > w->gterm.maxRasters || + dst < 0 || dst > w->gterm.maxRasters) + return (ERR); + + /* Do we have a flip in X or Y? */ + xflip = mp->dnx < 0; + yflip = mp->dny < 0; + + /* Any higher numbered mappings which map to the same destination as the + * mapping MP will obscure the current mapping. Construct a clip mask + * defining the region of the destination we can write to. This will be + * the region not obscured by any higher numbered, active mappings. + */ + clip = False; + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; +#ifdef sun + /* As far as I can tell the Sun (probably in the OW X server) has an + * off by one bug affecting clipping in the server. A clip region is + * too small by one pixel at the right and bottom, causing these pixels + * to not be written when refreshing the screen (usually this shows up + * as black lines on the screen when a region is refreshed). So far + * I haven't seen this on any other platform. The problem is imperfectly + * understood and the following workaround may not completely workaround + * the problem. + */ + r.width++; r.height++; +#endif + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + + if (XRectInRegion (clip_region, + r.x, r.y, r.width, r.height) != RectangleOut) { + + mask_region = XCreateRegion(); + XUnionRectWithRegion (&r, mask_region, mask_region); + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + clip++; + } + } + + if (clip && dr->type == PixmapRaster) { + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + } + + /* Handle the special case of a pixmap to pixmap (or window) copy in + * the server with no scaling. + */ + if (!scaling && sr->type == PixmapRaster && dr->type == PixmapRaster) { + if (src == 0 && dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + +fprintf(stderr, "refresh_destination -- pixmap copy src=dst=0\n"); + if (DBG_TRACE) + fprintf(stderr, "refresh_destination -- spec_case 0\n"); + + if (w->gterm.w_depth == ColormapDepth) { + XCopyArea (display, w->gterm.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + ; + XSetClipMask (display, w->gterm.exposeGC, None); + XCopyArea (display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + ; + } + } else { + + if (DBG_TRACE) + fprintf(stderr, "refresh_destination -- spec_case 1 (d=%d)\n", + w->gterm.w_depth); + + if (w->gterm.w_depth == ColormapDepth) { +fprintf(stderr, "refresh_destination -- doing ColormapDepth\n"); + XCopyArea (display, sr->r.pixmap, dr->r.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) + XCopyArea (display, sr->r.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + } else { +fprintf(stderr, "refresh_destination -- doing TruecolorDepth\n"); + ; + XSetClipMask (display, w->gterm.exposeGC, None); + XCopyArea (display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + ; + } + } + +fprintf(stderr, "refresh_destination -- spec_case: pixmap copy no scaling\n"); + goto done; + } + + /* Any other case requires working on ximages in the client. The first + * step is to get the source ximage. + */ + if (sr->type == PixmapRaster) { +fprintf(stderr, "refresh_destination -- source type is PixmapRaster\n"); + /* Source is a pixmap but we need a local copy as either the + * destination is not a pixmap, or we need to do some scaling. + */ + if (CacheXImage) { /* MF004 */ + pixmap = (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap; + xin = GetCachedXImage (w, pixmap, sr->width, sr->height); + if (xin == NULL) { + xin = XGetImage (display, pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } else + NewCachedXImage (w, xin, pixmap, sr->width, sr->height); + } + } else { /* MF004 */ + xin = XGetImage (display, + (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } + delxin++; + } /* MF004 */ + + } else { + /* Source is an ximage. */ +fprintf(stderr, "refresh_destination -- src type is XImage (sr->r.ximage)\n"); + xin = sr->r.ximage; + } + + /* Handle the special case of a copy of an ximage to an output pixmap + * with no scaling. + */ + if (!scaling && dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + if (w->gterm.w_depth == ColormapDepth) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { +fprintf(stderr, "3 refresh_destination -- transient 24 XPutImage\n"); + render24 (w, xin_lp, xin->data, sx, sy, dx, dy, dnx, dny); + } + } else { + if (w->gterm.w_depth == ColormapDepth) { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + } else { +fprintf(stderr, "3 refresh_destination -- 24 XPutImage\n"); + render24 (w, xin->data, xin, sx, sy, dx, dy, dnx, dny); + ; + } + } + +fprintf(stderr, "refresh_destination -- spec_case: ximage to output pixmap w/ no scaling\n"); + goto done; + } + + /* Get output ximage. */ + if (dr->type == ImageRaster) { +fprintf(stderr, "refresh_destination -- dest type is XImage (dr->r.ximage)\n"); + xout = dr->r.ximage; + ox = dx; oy = dy; + } else { + uchar *data = (uchar *) XtMalloc (dnx * dny); + if (data == NULL) { + status = ERR; + goto done; + } +fprintf(stderr, "refresh_destination -- creating 8-bit ximage....\n"); + xout = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, dnx, dny, 8, 0); + if (xout == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + ox = 0; oy = 0; + delxout++; + } + + xin_lp = (uchar *)xin->data; + xout_lp = (uchar *)xout->data; + xin_bpl = xin->bytes_per_line; + xout_bpl = xout->bytes_per_line; + + /* Map a region of the input ximage XIN to the output ximage XOUT. Various + * approaches are used to generate the output data, depending upon what + * type of scaling we are doing. + */ + if (!scaling) { + /* No scaling. Copy a region of the ximage xin to xout without + * spatially scaling the image data. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + xin_lp = (uchar *)xin->data + sy * xin_bpl + sx; + xout_lp = (uchar *)xout->data + oy * xout_bpl + ox; + + for (j=0; j < dny; j++) { + memmove (xout_lp, xin_lp, dnx); + xin_lp += xin_bpl; + xout_lp += xout_bpl; + } + + } else if (scaling == M_INTZOOM) { + /* Integer zoom. The zoom factor is an integer, allowing the zoomed + * image to be calculated without using the xmap,ymap lookup tables. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + scale_intzoom (xin_lp,xin_bpl, xout_lp,xout_bpl, sx,sy, ox,oy,dnx,dny, + xflip,yflip, (int)(xscale + 0.5), (int)(yscale + 0.5)); + + } else if (scaling == M_ZOOM) { + /* We have a zoom, or one-to-many, scaling. Zoom scaling is always + * done with pixel replication. The [xy]_srcpix arrays in the mapping + * descriptor give the source pixel corresponding to each mapped pixel + * in the destination raster. + */ +zoom: + xmap = &mp->x_srcpix[xoff]; + ymap = &mp->y_srcpix[yoff]; + + scale_zoom (xin_lp, xin_bpl, xout_lp, xout_bpl, + xmap, ymap, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL); + + } else if (scaling == M_DEZOOM) { + /* We have a dezoom, or many-to-one, scaling. A block of pixels in + * the input raster are combined to generate the value of each output + * pixel, using one of several antialias algorithms to compute the + * output pixel value. + */ + float *x_src = &mp->x_src[xoff]; + float *y_src = &mp->y_src[yoff]; + int near_unitary = (xscale > 0.5 && yscale > 0.5); + int function; + + /* Get the antialising function to be applied. */ + if (!(function = (mp->rop & R_MFMask))) + function = MF_NEAREST; + + /* If the dezoom factor is small and either MF_BILINEAR or + * MF_NEAREST is enabled, use the indicated method to sample the + * input data. This uses all the data but minimizes smoothing. + */ + if ((function & (MF_BILINEAR|MF_NEAREST)) && near_unitary) + function = (function & MF_BILINEAR) ? MF_BILINEAR : MF_NEAREST; + else if (function != (function & (MF_BILINEAR|MF_NEAREST))) + function &= ~(MF_BILINEAR|MF_NEAREST); + +filter: + /* This can take a while so update the display. */ + XFlush (w->gterm.display); + + /* If the filtering operation involves any arithmetic combinations + * of pixels we must convert pixel numbers to pixel intensity values + * before performing the filtering operation. This is a case where + * we would be better off if frame buffers were maintained using + * pixel intensities rather than hardware pixel numbers. + */ + if (function != MF_NEAREST) { + uchar *data = (uchar *) XtMalloc (xin->width * xin->height); + if (data == NULL) { + status = ERR; + goto done; + } + + mf_getinten (w, + xin_lp, xin->width, xin->height, xin_bpl, sx,sy, + data, xin->width, xin->height, xin_bpl, sx,sy, snx,sny); + + if (!delxin) { + xin = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, xin->width, xin->height, 8, 0); + if (xin == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + delxin++; + } else { + XtFree ((char *)xin->data); + xin->data = (char *) data; + } + xin_lp = (uchar *)xin->data; + } + + /* Filter the source rect to the destination. */ + switch (function) { + case MF_NEAREST: + scale_nearest ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BILINEAR: + scale_bilinear ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BLKAVG: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 0, clip ? clip_region : (Region)NULL + ); + break; + case MF_BOXCAR: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 1, clip ? clip_region : (Region)NULL + ); + break; + case MF_LOWPASS: + scale_lowpass ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, clip ? clip_region : (Region)NULL + ); + break; + default: + function = MF_BILINEAR; + goto filter; + } + + /* If the operation was performed in intensity space convert back + * to pixel number. + */ + if (function != MF_NEAREST) + mf_getpixel (w, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, dnx,dny); + + } else { + status = ERR; + goto done; + } + + /* Copy the scaled ximage to the output pixmap, if any. + */ + if (dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + if (w->gterm.w_depth == ColormapDepth) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { +fprintf(stderr, "2a refresh_destination -- 24-bit XPutImage\n"); + render24 (w, xout_lp, xout, ox, oy, dx, dy, dnx, dny); + ; + } + } else { + if (w->gterm.w_depth == ColormapDepth) { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + } else { +fprintf(stderr, "3a refresh_destination -- 24-bit XPutImage\n"); + } + } + } + +done: + /* Clean up. + */ + if (delxin) + XDestroyImage (xin); + if (delxout) + XDestroyImage (xout); + + XDestroyRegion (clip_region); + if (clip && dr->type == PixmapRaster) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + + /* Execute any mappings defined on the raster just updated. */ +fprintf(stderr, "refresh_destination -- doing mappings status=%d\n",status); + if (0 &&status == OK) { + GtRefreshPixels (w, dst, GtPixel, dx, dy, dnx, dny); + + if (dst == 0) { + Region clip_region = (Region)NULL; + XRectangle r; + + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; + XUnionRectWithRegion (&r, clip_region, clip_region); + + update_transients (w, clip_region); + XDestroyRegion (clip_region); + } + } + +fprintf(stderr, "LEAVING refresh_destination, status=%d\n",status); + return (status); +} + +bob() { int i = 0; fprintf (stderr, "Hi from Bob\n"); } + + +render24 (w, data, xout, sx, sy, dx, dy, dnx, dny) +GtermWidget w; +uchar *data; +XImage *xout; +int sx, sy, dx, dy, dnx, dny; +{ + Display *display = w->gterm.display; + Visual *visual = (Visual *) DefaultVisual(display,DefaultScreen(display)); + unsigned long rp, gp, bp, rmask, gmask, bmask, xcol; + int border, bperline, bperpix; + XImage *scr = (XImage *) NULL; + uchar *val, *pp, pv; + uchar *pix = (uchar *) XtMalloc (512 * 512 * 4); + int i, j, nx = xout->width, ny=xout->height; + + int first, nelem, maxelem; + unsigned short r[256], g[256], b[256]; + unsigned short rs[256], gs[256], bs[256], iomap[256]; + + static int pmin=256, pmax=0; + static int rmin=256, rmax=0, rpix; + static int gmin=256, gmax=0, gpix; + static int bmin=256, bmax=0, bpix; + + + + if (DBG_TRACE) { + fprintf (stderr, "render24: sx/sy=%d/%d dx/dy=%d/%d dnx/dny=%d/%d\n", + sx, sy, dx, dy, dnx, dny); + } + + + /* Query and read the current colormap. */ +/* + GtQueryColormap (w, 0, &first, &nelem, &maxelem); + GtReadColormap (w, 0, first, nelem, r,g,b); + +{ + int k; + + for (k=0; k < 256; k++) + fprintf(stderr, "%3d : %3d %3d %3d\t%3d %3d %3d\n", + k, r[k]>>8, g[k]>>8, b[k]>>8, + w->gterm.iomap[k], w->gterm.cmap_in[k], w->gterm.cmap_out[k]); + fprintf(stderr, "first=%d nelem=%d ncolors=%d maxelem=%d\n", + first, nelem, w->gterm.ncolors, maxelem); + fprintf(stderr, "maxColors=%d basePixel=%d static=%d max=%d\n", + w->gterm.maxColors, w->gterm.base_pixel, SZ_STATIC_CMAP, MAX_SZCMAP); +} +*/ + +/* scr = XCreateImage (display, NULL, RGBDepth, + ZPixmap, 0, (char *) NULL, nx, ny, 8, 0); +*/ +nx = dnx; +ny = dny; + scr = XCreateImage (display, NULL, RGBDepth, + ZPixmap, 0, (char *) NULL, nx, ny, 32, 0); + scr->data = (char *)pix; + + bperline = scr->bytes_per_line; + bperpix = scr->bits_per_pixel; + border = scr->byte_order; + + nelem = GtReadColormap (w, 0, 0, MAX_SZCMAP, rs,gs,bs); + GtReadIomap (w, iomap, 0, MAX_SZCMAP); + + + /* Create the colormap. + */ + for (i=0; i < nelem; i++) { + j = iomap[i]; + r[i] = (rs[j] >> 8); + g[i] = (gs[j] >> 8); + b[i] = (bs[j] >> 8); + } + for (i=nelem; i < MAX_SZCMAP; i++) { + j = iomap[i]; + r[i] = (rs[j] >> 8); + g[i] = (gs[j] >> 8); + b[i] = (bs[j] >> 8); + } + +/* +{ + int k; + + for (k=0; k < 256; k++) + fprintf(stderr, "%3d : %3d %3d %3d\t%3d %3d %3d\n", + k, r[k], g[k], b[k], + w->gterm.iomap[k], w->gterm.cmap_in[k], w->gterm.cmap_out[k]); + fprintf(stderr, "nelem=%d ncolors=%d maxelem=%d\n", + nelem, w->gterm.ncolors, MAX_SZCMAP); +} +*/ + + val = data; + pp = pix; + if (scr->byte_order == MSBFirst) { + /* MSB First systems (e.g. MacPPC/Sun) */ + for (i=0; i < ny; i++) { + for (j=0; j < nx; j++, val++) { + pv = (int) GtGetClientPixel (w, *val); + + *pp++ = 0; + *pp++ = (uchar) ((b[pv] >> 8) & 0377); + *pp++ = (uchar) ((g[pv] >> 8) & 0377); + *pp++ = (uchar) ((r[pv] >> 8) & 0377); + } + } + } else if (scr->byte_order == LSBFirst) { + /* LSB First systems (e.g. MacIntel/Linux) */ + for (i=0; i < ny; i++) { + for (j=0; j < nx; j++, val++) { +/* + pv = (int) GtGetClientPixel (w, *val); + + *pp++ = (uchar) ((r[pv] >> 8) & 0xFF); + *pp++ = (uchar) ((g[pv] >> 8) & 0xFF); + *pp++ = (uchar) ((b[pv] >> 8) & 0xFF); + *pp++ = 0; +*/ + + + pv = (int) *val; +if (pv > pmax) pmax = pv; +if (pv < pmin) pmin = pv; +rpix = (uchar) r[pv]; +gpix = (uchar) g[pv]; +bpix = (uchar) b[pv]; + + *pp++ = (uchar) ((r[pv]) & 0xFF); + *pp++ = (uchar) ((g[pv]) & 0xFF); + *pp++ = (uchar) ((b[pv]) & 0xFF); + *pp++ = 0; + +if (rpix > rmax) rmax = rpix; if (rpix < rmin) rmin = rpix; +if (gpix > gmax) gmax = gpix; if (gpix < gmin) gmin = gpix; +if (bpix > bmax) bmax = bpix; if (bpix < bmin) bmin = bpix; + } + } + } + + /* + */ + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, scr, + sx, sy, dx, dy, dnx, dny); + + +fprintf (stderr, "pmin/pmax = %d/%d r: %d/%d g: %d/%d b: %d/%d\n", + pmin, pmax, rmin, rmax, gmin, gmax, bmin, bmax); + + XDestroyImage (scr); + /* + XtFree (pix); + */ +} + + +/* +* Find highest one bit set. +* Returns bit number + 1 of highest bit that is set, otherwise returns 0. +* High order bit is 31 (or 63 in _LP64 kernel). +*/ +int +highbit(unsigned long i) +{ + register int h = 1; + if (i == 0) + return (0); +#ifdef _LP64 + if (i & 0xffffffff00000000ul) { + h += 32; i >>= 32; +} +#endif + if (i & 0xffff0000) { + h += 16; i >>= 16; + } + if (i & 0xff00) { + h += 8; i >>= 8; + } + if (i & 0xf0) { + h += 4; i >>= 4; + } + if (i & 0xc) { + h += 2; i >>= 2; + } + if (i & 0x2) { + h += 1; + } + return (h); +} + + +/* +* Find lowest one bit set. +* Returns bit number + 1 of lowest bit that is set, otherwise returns 0. +* Low order bit is 0. +*/ +int +lowbit(unsigned long i) +{ + register int h = 1; + + if (i == 0) + return (0); + +#ifdef _LP64 + if (!(i & 0xffffffff)) { + h += 32; i >>= 32; + } +#endif + if (!(i & 0xffff)) { + h += 16; i >>= 16; + } + if (!(i & 0xff)) { + h += 8; i >>= 8; + } + if (!(i & 0xf)) { + h += 4; i >>= 4; + } + if (!(i & 0x3)) { + h += 2; i >>= 2; + } + if (!(i & 0x1)) { + h += 1; + } + return (h); +} + +/* scale_zoom -- Compute the given destination rect from the input image, + * using pixel replication and the given x and y dst->scr pixels maps. + */ +static +scale_zoom (idata,ibpl, odata,obpl, xmap,ymap, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + register int *xmap; /* src coords of each dst pixel */ + int *ymap; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i, j; + register uchar *ip, *op; + uchar *last_ip = NULL; + uchar *last_op = NULL; + + for (j=0; j < dny; j++) { + ip = idata + ymap[j] * ibpl; + op = odata + (j+dy) * obpl + dx; + + if (!clip_region) { + if (ip == last_ip) + memmove (op, last_op, dnx); + else { + for (i=0; i < dnx; i++) + op[i] = ip[xmap[i]]; + } + last_ip = ip; + last_op = op; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = ip[xmap[i]]; + } + } +} + + +/* scale_intzoom -- Compute the given destination rect from the input image, + * using pixel replication and integer scaling. This is functionally + * equivalent to scale_zoom using the lookup tables, but optimized for the + * case of integer scaling. + */ +static +scale_intzoom (idata,ibpl,odata,obpl, sx,sy,dx,dy,dnx,dny, xflip,yflip, nx,ny) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + int sx, sy; /* start coords of src rect */ + int dx, dy, dnx, dny; /* destination rect */ + int xflip, yflip; /* set if x or y is flipped */ + int nx, ny; /* replication factors */ +{ + register int n; + register int pix; + register uchar *ip, *op; + uchar *otop, *olast, *lp; + int i, j, k; + + olast = odata + (dy + dny) * obpl - dnx + dx; + + if (xflip) { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + + op = odata + (dy + (yflip ? (dny-ny-j) : j)) * obpl + dx + dnx; + otop = lp = op - dnx; + + + /* Why are the case statements below necessary, doesn't the + * default case do the same thing regardless of what nx is? MJF + */ + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *--op = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op > otop) + *--op = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } else { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = lp = odata + (dy + (yflip ? (dny-ny-j) : j)) * obpl + dx; + otop = op + dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *op++ = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op < otop) + *op++ = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } +} + + +/* scale_nearest -- Compute the given destination rect from the input image, + * using the nearest neighbor technique. + */ +static +scale_nearest (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i, j; + register uchar *op; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = y_src[j]; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* scale_bilinear -- Compute the given destination rect from the input image, + * using bilinear interpolation. + */ +static +scale_bilinear (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = x_src[i] - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = y_src[j] - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* scale_lowpass -- Apply a lowpass filter to a region of a 2D data array. + * The region ox,oy,nx,ny of the output data array is calculated by running + * a convolution kernel over the region of the input data array at ix,iy. + * The size of the convolution kernel is adjusted to match the scale factors + * xscale, yscale. + */ +static +scale_lowpass (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + Region clip_region; /* clip Region or null */ +{ + uchar *data; + + if ((data = (uchar *) XtMalloc (inx * iny)) == NULL) + return; + + /* Run a lowpass filter over the input rect. */ + lw_convolve (idata,inx,iny,ibpl, sx,sy, data,inx,iny,ibpl, sx,sy, + snx,sny, xscale,yscale); + + /* Sample the filtered data to generate the output rect. */ + scale_nearest (data,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + dx,dy,dnx,dny, clip_region); + + XtFree ((char *)data); +} + + +/* lw_convolve -- Convolution primitive for scale_lowpass. + */ +static +lw_convolve (idata,inx,iny,ibpl,ix,iy, odata,onx,ony,obpl,ox,oy, + nx, ny, xscale, yscale) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ix, iy; /* size of input array, start pos */ + int onx, ony, ox, oy; /* size of output array, start pos */ + int ibpl, obpl; /* bytes per line */ + int nx, ny; /* size of output region */ + float xscale, yscale; /* determines amount of smoothing */ +{ + register uchar *ip; + register int l, m, x, hx, pixval; + int kx, ky, hy, i, j, y; + uchar *lp[11], *op; + + /* Determine kernel size (min 3x3, max 7x7). */ + if (xscale < 0.1) + hx = 3; + else if (xscale >= 0.5) + hx = 1; + else + hx = ((int)(1.0 / xscale)) / 2; + + if (yscale < 0.1) + hy = 3; + else if (yscale >= 0.5) + hy = 1; + else + hy = ((int)(1.0 / yscale)) / 2; + + kx = hx * 2 + 1; + ky = hy * 2 + 1; + + /* Compute the output data. + */ + for (j=0; j < ny; j++) { + /* Get line pointers. */ + op = odata + (j+oy) * obpl + ox; + for (i=0; i < ky; i++) { + y = iy + j - hy + i; + if (y < 0) + y = 0; + else if (y >= iny) + y = iny - 1; + lp[i] = y * ibpl + idata; + } + + /* Compute a line of output pixels */ + for (i=0; i < nx; i++) { + x = ix + i; + pixval = 0; + + if (x < hx) { + /* Near left edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][max(0,x-hx+l)]; + } else if (x >= inx - hx) { + /* Near right edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][min(inx-1,x-hx+l)]; + } else { + /* In central region. */ + for (m=0; m < ky; m++) { + ip = lp[m] + x - hx; + for (l=0; l < kx; l++) + pixval += ip[l]; + } + } + + op[i] = (float)pixval / (float)(kx * ky) + 0.5; + } + } +} + + +/* scale_boxcar -- Apply a boxcar filter to a region of a 2D data array + * and interpolate the result to the output grid. The region ox,oy,nx,ny of + * the output data array is calculated by block averaging the corresponding + * source rect and then sampling the reduced image using bilinear interpolation + * to compute the output pixel raster. This antialiasing technique aims to + * be as fast as possible but still does a reasonable job of reducing the + * image. + */ +static +scale_boxcar (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, interp, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + int interp; /* set if interpolation is desired */ + Region clip_region; /* clip Region or null */ +{ + int xblock, yblock; + int x1, x2, y1, y2, nx, ny; + float xstep, ystep; + int xoff, yoff; + uchar *bp; + + /* Determine blocking factors. If interpolation is disabled we need + * to block one step more than for the linear interpolate case in order + * to ensure that all the data is used. + */ + xblock = max(1, (int) (1.0 / xscale)); + if (!interp && (1.0 / xscale) - xblock > ZOOM_TOL) + xblock++; + yblock = max(1, (int) (1.0 / yscale)); + if (!interp && (1.0 / yscale) - yblock > ZOOM_TOL) + yblock++; + + /* Align the input region for the given blocking factors. */ + x1 = sx / xblock * xblock; x2 = (sx + snx - 1) / xblock * xblock; + y1 = sy / yblock * yblock; y2 = (sy + sny - 1) / yblock * yblock; + nx = (x2 - x1) / xblock + 1; ny = (y2 - y1) / yblock + 1; + + /* Compute the block averaged input rect. */ + if (xblock > 1 || yblock > 1) { + if ((bp = (uchar *) XtMalloc (nx * ny)) == NULL) + return; + bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, bp, xblock, yblock); + idata = bp; + inx = ibpl = nx; + iny = ny; + xoff = x1; yoff = y1; + xstep = 1.0 / xblock; ystep = 1.0 / yblock; + } else { + bp = NULL; + xoff = yoff = 0; + xstep = ystep = 1.0; + } + + /* Interpolate the input rect to the output grid. */ + if (interp && + ((1.0 / xscale) - xblock) > ZOOM_TOL || + ((1.0 / yscale) - yblock) > ZOOM_TOL) { + + /* Use bilinear interpolation to compute the output grid. */ + bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + + } else { + /* Extract pixels from block averaged input data. */ + bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + } + + if (bp) + XtFree ((char *)bp); +} + + +/* bx_boxcar -- Block average primitive for scale_boxcar. + */ +static +bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, obuf, xblock, yblock) + uchar *idata; /* input data array */ + int inx, iny, ibpl; /* array dimensions */ + int x1,y1,x2,y2; /* region to be block averaged */ + uchar *obuf; /* output array */ + int xblock, yblock; /* blocking factors */ +{ + register uchar *ip, *op; + register int count, i, *sp; + int obpl, block, nxblocks, nyblocks, j, k; + uchar *lp, *bp; + int *sb; + + nxblocks = obpl = (x2 - x1) / xblock + 1; + nyblocks = (y2 - y1) / yblock + 1; + count = xblock * yblock; + + if ((sb = (int *) XtMalloc (obpl * sizeof(int))) == NULL) + return; + + /* I don't think the following works for pixel values allocated from the + * default colormap, as the pixel values are not sequentially allocated. + */ + for (block = 0; block < nyblocks; block++) { + lp = idata + ibpl * (block * yblock + y1) + x1; + bp = obuf + block * obpl; + + memset (sb, 0, obpl * sizeof(int)); + for (k=yblock; --k >= 0; lp += ibpl) + for (j=nxblocks, ip=lp, sp=sb; --j >= 0; sp++) + for (i=xblock; --i >= 0; ) + *sp += *ip++; + + for (i=obpl, sp=sb, op=bp; --i >= 0; ) + *op++ = *sp++ / count; + } + + XtFree ((char *)sb); +} + + +/* bx_extract -- Block extract primitive for scale_boxcar. + */ +static +bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i; + register uchar *op; + int j; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = (y_src[j] - yoff) * ystep; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* bx_interp -- Bilinear interpolation primitive for scale_boxcar. + */ +static +bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = ((x_src[i] - xoff) * xstep) - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = ((y_src[j] - yoff) * ystep) - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* mf_getinten -- Copy the source rect to the destination rect, converting + * pixel numbers to pixel intensities. + */ +static +mf_getinten (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_out (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* mf_getpixel -- Copy the source rect to the destination rect, converting + * pixel intensities to pixel numbers. + */ +static +mf_getpixel (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_in (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* get_regions -- For each pixel I in the sequence of DNX pixels starting at DX + * there is an associated value XMAP[I]. Compare this sequence to an alternate + * sequence and return a list of subregions {XS,XE,XV} for which the XMAP + * values are equal (XV=0), not equal (XV=1), or not common to (XV=2) the two + * regions. The number of regions output is returned as the function value. + */ +static +get_regions (xs,xe,xv, max_regions, dx, dnx, xmap, alt_dx, alt_dnx, alt_xmap) + int *xs, *xe, *xv, max_regions; + int dx, dnx, *xmap; + int alt_dx, alt_dnx, *alt_xmap; +{ + register int state, current; + register int nx, i; + int offset, old_i; + + offset = dx - alt_dx; + nx = 0; + + for (i=0; i < dnx; i++) { + if (nx >= max_regions-1) + return (0); + + /* Determine whether or not this pixel is mapped the same in both + * sequences. + */ + old_i = i + offset; + if (alt_dnx <= 0 || old_i < 0 || old_i >= alt_dnx) + state = 2; + else + state = (xmap[i] != alt_xmap[old_i]); + + /* When the state boundary is crossed add a range. */ + if (i == 0) { + xs[nx] = dx; + xv[nx] = current = state; + } + if (state != current) { + xe[nx] = dx + i - 1; + xs[++nx] = dx + i; + xv[nx] = current = state; + } + if (i == dnx-1) + xe[nx++] = dx + i; + } + + return (nx); +} + + +/* get_rects -- Combine two lists of regions, one in X and the other in Y, + * to produce a list of 2D rectangles defining the regions outlined by the + * region lists. Only rects for which the given condition is true in either + * X or Y are selected. Adjacent rects are combined. + */ +static +get_rects (o_rl, max_rects, xs,xe,xv,nx, ys,ye,yv,ny, xcond,ycond) + XRectangle *o_rl; /* receives list of rectangles */ + int max_rects; /* max rectangles out */ + int *xs, *xe, *xv, nx; /* X list of regions */ + int *ys, *ye, *yv, ny; /* Y list of regions */ + int xcond, ycond; /* X,Y condition bitflags */ +{ + register int i, j; + XRectangle rl[MAX_REGIONS]; + int limit = min (max_rects, MAX_REGIONS); + int o_nrects=0, nrects=0; + int i1, i2, j1, j2; + + /* Get initial list of rects matching the given X and Y conditions. + * Rects which are adjacent in X are combined to form one larger rect. + */ + for (j=0; j < ny; j++) { + for (i=0; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) { + /* Collapse rects adjacent in X. */ + for (i1 = i2 = i++; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) + i2 = i; + else + break; + } + + rl[nrects].x = xs[i1]; + rl[nrects].y = ys[j]; + rl[nrects].width = xe[i2] - xs[i1] + 1; + rl[nrects].height = ye[j] - ys[j] + 1; + + if (++nrects >= limit) + return (nrects); + } + } + } + + /* Now scan the rect list and collapse rects which are adjacent in Y + * into one larger rect. Find all the rects that are at the same X + * and write them to the output list, collapsing rects that are adjacent + * in Y in the process. + */ + for (i=0; i < nx; i++) + for (j=0; j < nrects; ) { + /* Find first rect if any. */ + for (j1=0, j2 = -1; j < nrects; j++) + if (rl[j].x == xs[i]) { + j1 = j2 = j++; + break; + } + + /* Collapse rects adjacent in Y. */ + for ( ; j < nrects; j++) + if (rl[j].x == xs[i]) + if (rl[j].y == rl[j2].y + rl[j2].height && + rl[j].width == rl[j1].width) + j2 = j; + else + break; + + /* Output the rect. */ + if (j2 >= j1) { + o_rl[o_nrects].x = rl[j1].x; + o_rl[o_nrects].y = rl[j1].y; + o_rl[o_nrects].width = rl[j1].width; + o_rl[o_nrects].height = rl[j2].y + rl[j2].height - rl[j1].y; + + if (++o_nrects >= max_rects) + return (o_nrects); + } + } + + return (o_nrects); +} + + +/* rect_intersect -- Compute the intersection of two rects. The area of + * the intersection is returned as the function value, i.e., zero is + * returned if the rects do not intersect. + */ +static +rect_intersect (in, r1, r2) + register XRectangle *in; + register XRectangle *r1, *r2; +{ + int x1, y1, x2, y2; + + x1 = max (r1->x, r2->x); + y1 = max (r1->y, r2->y); + x2 = min ((int)r1->x + (int)r1->width, (int)r2->x + (int)r2->width) - 1; + y2 = min ((int)r1->y + (int)r1->height, (int)r2->y + (int)r2->height) - 1; + + in->x = x1; + in->y = y1; + in->width = max (0, x2 - x1 + 1); + in->height = max (0, y2 - y1 + 1); + + return (in->width * in->height); +} + + +/* save_mapping -- Store a mapping in a mapping descriptor. + */ +static +save_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int mapping, rop; + int src, st, sx,sy,sw,sh; + int dst, dt, dx,dy,dw,dh; +{ + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = sw; mp->sny = sh; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dw; mp->dny = dh; + mp->defined = mp->enabled = mp->refresh = 1; + mp->mapping = mapping; + mp->rop = rop; +} + +/* load_mapping -- Load a mapping from a mapping descriptor. + */ +static +load_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int *mapping, *rop; + int *src, *st, *sx,*sy,*sw,*sh; + int *dst, *dt, *dx,*dy,*dw,*dh; +{ + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *sw = mp->snx; *sh = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dw = mp->dnx; *dh = mp->dny; + *mapping = mp->mapping; + *rop = mp->rop; +} + + +/* get_pixel_mapping -- Copy a mapping, converting to pixel coordinates in + * the process if the mapping is not already in pixel coordinates. + */ +static +get_pixel_mapping (w, mp1, mp2, update) + GtermWidget w; + register Mapping mp1; /* input mapping */ + register Mapping mp2; /* output mapping */ + int update; /* update mapping */ +{ + float maxndc = (float)MAXNDC; + + mp2->mapping = mp1->mapping; + mp2->refresh = mp1->refresh; + mp2->enabled = mp1->enabled; + mp2->rop = mp1->rop; + + if (!(mp2->defined = mp1->defined)) + return; + + mp2->src = mp1->src; + if (mp1->st == GtPixel) { + mp2->st = mp1->st; + mp2->sx = mp1->sx; mp2->sy = mp1->sy; + mp2->snx = mp1->snx; mp2->sny = mp1->sny; + } else { + float width = w->gterm.rasters[mp1->src].width; + float height = w->gterm.rasters[mp1->src].height; + mp2->sx = mp1->sx * width / maxndc; + mp2->sy = (MAXNDC - (mp1->sy + abs(mp1->sny))) * height / maxndc; + mp2->snx = mp1->snx * width / maxndc; + mp2->sny = mp1->sny * height / maxndc; /* NDC flipped in Y */ + mp2->st = GtPixel; + } + + mp2->dst = mp1->dst; + if (mp1->dt == GtPixel) { + mp2->dt = mp1->dt; + mp2->dx = mp1->dx; mp2->dy = mp1->dy; + mp2->dnx = mp1->dnx; mp2->dny = mp1->dny; + } else { + float width = w->gterm.rasters[mp1->dst].width; + float height = w->gterm.rasters[mp1->dst].height; + mp2->dx = mp1->dx * width / maxndc; + mp2->dy = (MAXNDC - (mp1->dy + abs(mp1->dny))) * height / maxndc; + mp2->dnx = mp1->dnx * width / maxndc; + mp2->dny = mp1->dny * -height / maxndc; /* NDC flipped in Y */ + mp2->dt = GtPixel; + } + + /* The lookup tables are already in pixel space, so we can propagate + * these to the new mapping if the old mapping was updated. + */ + if (update && mp1->updated) { + if (mp2->mapdata = (uchar *) XtMalloc (mp1->datalen)) { + + memmove (mp2->mapdata, mp1->mapdata, mp1->datalen); + mp2->datalen = mp1->datalen; + mp2->scaling = mp1->scaling; + mp2->xscale = mp1->xscale; + mp2->yscale = mp1->yscale; + + mp2->x_extent = (mapExtent *) + ((uchar *)mp1->x_extent - mp1->mapdata + mp2->mapdata); + mp2->y_extent = (mapExtent *) + ((uchar *)mp1->y_extent - mp1->mapdata + mp2->mapdata); + mp2->x_srcpix = (int *) + ((uchar *)mp1->x_srcpix - mp1->mapdata + mp2->mapdata); + mp2->y_srcpix = (int *) + ((uchar *)mp1->y_srcpix - mp1->mapdata + mp2->mapdata); + mp2->x_src = (float *) + ((uchar *)mp1->x_src - mp1->mapdata + mp2->mapdata); + mp2->y_src = (float *) + ((uchar *)mp1->y_src - mp1->mapdata + mp2->mapdata); + + mp2->updated = 1; + } + } else + mp2->updated = 0; +} + +/* valid_mapping -- Perform some sanity checks on a mapping to verify that + * it contains something meaningful. + */ +static +valid_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register int x, y; + int snx, sny, dnx, dny; + int s_width, s_height, d_width, d_height; + Raster sr, dr; + + if (!mp || !mp->defined) + return (False); + + if (mp->src < 0 || mp->src >= w->gterm.maxRasters) + return (False); + if (mp->dst < 0 || mp->dst >= w->gterm.maxRasters) + return (False); + + sr = &w->gterm.rasters[mp->src]; + dr = &w->gterm.rasters[mp->dst]; + if (!sr->type || !dr->type) + return (False); + + switch (mp->st) { + case GtPixel: + s_width = sr->width; s_height = sr->height; + break; + case GtNDC: + s_width = MAXNDC + 1; s_height = MAXNDC + 1; + break; + default: + return (False); + } + + switch (mp->dt) { + case GtPixel: + d_width = dr->width; d_height = dr->height; + break; + case GtNDC: + d_width = MAXNDC + 1; d_height = MAXNDC + 1; + break; + default: + return (False); + } + + snx = mp->snx; dnx = abs(mp->dnx); + sny = mp->sny; dny = abs(mp->dny); + if (snx <= 0 || dnx <= 0 || sny <= 0 || dny <= 0) + return (False); + + x = mp->sx; y = mp->sy; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + x = mp->sx + snx - 1; y = mp->sy + sny - 1; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + + x = mp->dx; y = mp->dy; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + x = mp->dx + dnx - 1; y = mp->dy + dny - 1; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + + return (True); +} + + +/* initialize_mapping -- Initialize the contents of a mapping descriptor. + */ +static +initialize_mapping (mp) + register Mapping mp; +{ + memset ((char *)mp, 0, sizeof(struct mapping)); +} + + +/* update_mapping -- Update the portion of a mapping descriptor used at + * runtime to execute the mapping. This information consists of several + * lookup tables and other parameters describing how a destination pixel + * maps back to a source pixel and vice versa. + */ +static +update_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register uchar *op; + register int i, j, k; + int snx, sny, dnx, dny, sx, sy, dx, dy; + int xmax, ymax, lo, hi, edge1, edge2; + int temp, xflip=0, yflip=0; + struct mapping p_mp; + float pixwidth, *fp; + int *ip; + + if (mp->updated) + return; + + /* The internal lookup tables are in pixel units. */ + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 0); + + if ((snx = p_mp.snx) <= 0 || (sny = p_mp.sny) <= 0) + return; + + if ((dnx = p_mp.dnx) < 0) { + dnx = -dnx; + xflip++; + } + if ((dny = p_mp.dny) < 0) { + dny = -dny; + yflip++; + } + + sx = p_mp.sx; + sy = p_mp.sy; + dx = p_mp.dx; + dy = p_mp.dy; + xmax = dnx - 1; + ymax = dny - 1; + + /* Discard the temporary mapping. + free_mapping (w, &p_mp); + */ + + /* Get scale factors. */ + mp->xscale = (float)dnx / (float)snx; + mp->yscale = (float)dny / (float)sny; + + /* Determine type of scaling to be used. */ + if (mp->xscale < 1.0 || mp->yscale < 1.0) { + mp->scaling = M_DEZOOM; + } else if (mp->xscale > 1.0 || mp->yscale > 1.0) { + mp->scaling = M_ZOOM; + if (abs(mp->xscale - (int)(mp->xscale+0.5)) < ZOOM_TOL && + abs(mp->yscale - (int)(mp->yscale+0.5)) < ZOOM_TOL) + mp->scaling = M_INTZOOM; + } else + mp->scaling = (xflip || yflip) ? M_ZOOM : M_NOSCALING; + + /* Get a data buffer for the lookup tables. */ + mp->datalen = + snx * sizeof(mapExtent) + /* xy, extent */ + sny * sizeof(mapExtent) + + dnx * sizeof(int) + /* xy, srcpix */ + dny * sizeof(int) + + dnx * sizeof(float) + /* xy, src */ + dny * sizeof(float); + + if (mp->mapdata) + mp->mapdata = (uchar *) XtRealloc ((char *)mp->mapdata, mp->datalen); + else + mp->mapdata = (uchar *) XtMalloc (mp->datalen); + if (mp->mapdata == NULL) + return; + + /* Set the table pointers. */ + op = mp->mapdata; + mp->x_extent = (mapExtent *) op; op += snx * sizeof(mapExtent); + mp->y_extent = (mapExtent *) op; op += sny * sizeof(mapExtent); + mp->x_srcpix = (int *) op; op += dnx * sizeof(int); + mp->y_srcpix = (int *) op; op += dny * sizeof(int); + mp->x_src = (float *) op; op += dnx * sizeof(float); + mp->y_src = (float *) op; op += dny * sizeof(float); + + /* Compute the backpointers to the source raster for each destination + * pixel center. + */ + for (i=0, ip = mp->x_srcpix, fp = mp->x_src; i < dnx; i++) { + fp[i] = ((xflip ? xmax - i : i) + 0.5) / mp->xscale + sx; + ip[i] = fp[i]; + } + for (i=0, ip = mp->y_srcpix, fp = mp->y_src; i < dny; i++) { + fp[i] = ((yflip ? ymax - i : i) + 0.5) / mp->yscale + sy; + ip[i] = fp[i]; + } + + /* Compute the extent arrays. These define the range of destination + * pixels affected by each source pixel. + */ + lo = dnx - 1 + dx; + hi = dx; + for (i=0; i < snx; i++) { + mp->x_extent[i].lo = lo; + mp->x_extent[i].hi = hi; + } + lo = dny - 1 + dy; + hi = dy; + for (i=0; i < sny; i++) { + mp->y_extent[i].lo = lo; + mp->y_extent[i].hi = hi; + } + + /* Map the left and right or top and bottom edges of each destination + * pixel back into the source rect and update the corresponding extent + * entries to indicate that these source pixels are used to compute the + * destination pixel. + */ + pixwidth = 1.0 - ZOOM_TOL; + + for (i=0; i < dnx; i++) { + edge1 = (xflip ? xmax - i : i) / mp->xscale; + edge2 = (xflip ? xmax - (i-pixwidth) : (i+pixwidth)) / mp->xscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (snx - 1, edge2); + + for (j=edge1, k = dx + i; j <= edge2; j++) { + if (mp->x_extent[j].lo > k) + mp->x_extent[j].lo = k; + if (mp->x_extent[j].hi < k) + mp->x_extent[j].hi = k; + } + } + + for (i=0; i < dny; i++) { + edge1 = (yflip ? ymax - i : i) / mp->yscale; + edge2 = (yflip ? ymax - (i-pixwidth) : (i+pixwidth)) / mp->yscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (sny - 1, edge2); + + for (j=edge1, k = dy + i; j <= edge2; j++) { + if (mp->y_extent[j].lo > k) + mp->y_extent[j].lo = k; + if (mp->y_extent[j].hi < k) + mp->y_extent[j].hi = k; + } + } + + mp->updated = 1; +} + + +/* free_mapping -- Free any storage used internally by a mapping descriptor, + * and deactivate the mapping. + */ +static +free_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + mp_unlink (w, mp); + mp->defined = mp->enabled = mp->updated = 0; + if (mp->mapdata) { + XtFree ((char *) mp->mapdata); + mp->mapdata = NULL; + mp->datalen = 0; + mp->x_extent = mp->y_extent = NULL; + mp->x_srcpix = mp->y_srcpix = NULL; + mp->x_src = mp->y_src = NULL; + mp->updated = 0; + } +} + +static void +mp_linkafter (w, mp, ref_mp) + register GtermWidget w; + register Mapping mp; + register Mapping ref_mp; +{ + register Mapping map; + + /* Don't use the reference mapping unless it is already linked or + * the list is empty. + */ + if (w->gterm.mp_head) { + for (map = w->gterm.mp_head; map && map != ref_mp; map = map->next) + ; + if (map != ref_mp) + ref_mp = NULL; + } + + mp->prev = ref_mp; + mp->next = ref_mp ? ref_mp->next : NULL; + if (ref_mp && ref_mp->next) + ref_mp->next->prev = mp; + if (ref_mp) + ref_mp->next = mp; + + if (!w->gterm.mp_tail || ref_mp == w->gterm.mp_tail) + w->gterm.mp_tail = mp; + if (!w->gterm.mp_head) + w->gterm.mp_head = mp; +} + + +static void +mp_unlink (w, mp) + register GtermWidget w; + register Mapping mp; +{ + if (mp->prev) + mp->prev->next = mp->next; + if (mp->next) + mp->next->prev = mp->prev; + if (w->gterm.mp_head == mp) + w->gterm.mp_head = mp->next; + if (w->gterm.mp_tail == mp) + w->gterm.mp_tail = mp->prev; + + mp->prev = mp->next = NULL; +} + + +/* + * Graphics MARKERS. + * -------------------- + * A marker is an active graphics object displayed on top of a drawing to + * mark, annotate, or outline a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. Markers are used to + * interactively define regions with the mouse, to provide a dynamic graphical + * display which doesn't interfere with the underlying graphics frame, or as a + * graphical means of command input, using callbacks to perform some operation + * when the marker is moved or resized by the user. + * + * GtMarkerInit (w) + * GtMarkerFree (w) + * + * gm = GmCreate (w, type, interactive) + * GmRedisplay (w, region|NULL) + * gm = GmCopy (gm) + * GmDestroy (gm) + * GmAddCallback (gm, events, func, client_data) + * GmDeleteCallback (gm, func, client_data) + * gm = GmSelect (gt, x, y, &what) + * + * GmMarkpos (gm) + * GmRedraw (gm, func, erase) + * GmRaise (gm, ref_gm|NULL) + * GmLower (gm, ref_gm|NULL) + * GmNotify (gm, events, event, param, nparams) + * + * GmAddPt (gm, x, y) + * GmDeletePt (gm, x, y) + * GmMovePt (gm, x, y) + * GmMove (gm, x, y) + * GmResize (gm, x, y) + * GmRotate (gm, x, y) + * + * GmSetAttributes (gm, args, nargs, type) + * GmGetAttributes (gm, args, nargs, type) + * GmSetAttribute (gm, attribute, value, type) + * GmGetAttribute (gm, attribute, value, type) + * GmSetVertices (gm, points, first, npts) + * npts = GmGetVertices (gm, points, first, maxpts) + * GmGetBoundingBox (gm, x, y, width, height) + * + * type = GmStrToType (marker_type) + * event = GmStrToEvent (event_type) + * func = GmStrToFunction (drawing_function) + * + * Markers operate in screen coordinates (raster 0). The SelectRaster + * and MapVector routines may be used to convert to and from raster + * coordinates if desired. + * + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mp) + * GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + * + * The Gm procedures above implement the main functionality of markers. User + * interaction is provided at a higher level using action procedures which + * are bound to pointer and keyboard events via translations (or by the GUI + * itself directly calling the above procedures). + */ + +static void gm_text_init(), gm_line_init(), gm_plin_init(), gm_rect_init(); +static void gm_boxx_init(), gm_circ_init(), gm_elip_init(), gm_pgon_init(); +static int gm_putint(), gm_putfloat(), gm_do_callbacks(), gm_constraint(); +static int gm_getint(), gm_getattribute(), gm_gettype(); +static double gm_getfloat(); +static char *gm_getstring(); + +static void gm_markpos(), gm_erase(), gm_redraw(), gm_setCurRect(); +static void gm_linkafter(), gm_unlink(); +static double gm_niceAngle(); +static Pixel gm_getpixel(); +static int gm_select(); +static int gm_getfillstyle(); + +static GmVMethod gm_classinit[] = { + gm_text_init, gm_line_init, gm_plin_init, gm_rect_init, + gm_boxx_init, gm_circ_init, gm_elip_init, gm_pgon_init +}; + +static Region null_region; +static XRectangle null_rect = { 0, 0, 0, 0 }; +#define NullRect(r) (!(r)->width || !(r)->height) + +#define PI_2 1.57079632679489661923 +#define PI_4 0.78539816339744830962 +#define BORDER 5 + +static void M_create(), M_destroy(), M_destroyNull(), M_set(), M_raise(); +static void M_lower(), M_notify(), M_markpos(), M_markposAdd(), M_redraw(); +static void M_addPt(), M_deletePt(), M_movePt(), M_deleteDestroy(); +static void M_move(), M_resize(), M_moveResize(), M_rotate(); +static void M_rotateResize(), M_input(); +static void gm_focusin(), gm_focusout(); + +static XtActionsRec markerActionsList[] = { + { "m_create", M_create }, + { "m_destroy", M_destroy }, + { "m_destroyNull", M_destroyNull }, + { "m_set", M_set }, + { "m_raise", M_raise }, + { "m_lower", M_lower }, + { "m_notify", M_notify }, + { "m_input", M_input }, + { "m_markpos", M_markpos }, + { "m_markposAdd", M_markposAdd }, + { "m_redraw", M_redraw }, + { "m_addPt", M_addPt }, + { "m_deletePt", M_deletePt }, + { "m_movePt", M_movePt }, + { "m_deleteDestroy", M_deleteDestroy }, + { "m_move", M_move }, + { "m_resize", M_resize }, + { "m_moveResize", M_moveResize }, + { "m_rotate", M_rotate }, + { "m_rotateResize", M_rotateResize }, +}; + + +/* GtMarkerInit -- Initialize the marker subsystem. + */ +GtMarkerInit (w) + GtermWidget w; +{ + register Marker gm, prev; + XColor fg_color, bg_color; + Display *display = w->gterm.display; + int type, i; + GC gc; + + for (gm = w->gterm.gm_tail; gm; gm = prev) { + prev = gm->prev; + GmDestroy (gm); + } + + if (!w->gterm.gm_initialized) { + /* Register some additional actions for markers. */ + XtAppAddActions (XtWidgetToApplicationContext((Widget)w), + markerActionsList, XtNumber(markerActionsList)); + + /* Get the gterm widget translations. */ + if ((char *)w->gterm.defTranslations == NULL) { + char *translations = NULL; + XtTranslations tt; + XtResource r; + int ttype, i; + + r.resource_name = XtNtranslations; + r.resource_class = XtCTranslations; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + XtGetApplicationResources ((Widget)w, &translations, &r, 1,NULL,0); + + if (translations) { + if (strncmp (translations, "#augment", 8) == 0) + ttype = T_augment; + else if (strncmp (translations, "#override", 9) == 0) + ttype = T_override; + else + ttype = T_replace; + + if (ttype == T_replace) { + w->gterm.defTranslations = + XtParseTranslationTable (translations); + } else if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = ttype; + w->gterm.nauxTrans++; + } + + } else { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + } + + /* Get the marker translations. */ + if ((char *)w->gterm.gm_defTranslations == NULL) + w->gterm.gm_defTranslations = + XtParseTranslationTable (w->gterm.gm_translations); + } + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + /* Get graphics drawing GC. */ +/* gc = XCreateGC (display, w->gterm.root, 0, NULL); */ + gc = XCreateGC (display, w->gterm.window, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, + w->gterm.gm_lineWidth, w->gterm.gm_lineStyle, CapButt, JoinMiter); + w->gterm.gm_drawGC = gc; + + /* Get graphics rubber-band GC. */ +/* gc = XCreateGC (display, w->gterm.root, 0, NULL); */ + gc = XCreateGC (display, w->gterm.window, 0, NULL); + XSetFunction (display, gc, GXxor); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, w->gterm.gm_xorFillColor); + XSetBackground (display, gc, w->gterm.gm_xorFillBgColor); + XSetLineAttributes (display, gc, + 0, LineDoubleDash, CapButt, JoinMiter); + w->gterm.gm_rubberGC = gc; + + fg_color.pixel = w->gterm.gm_cursorFgColor; + bg_color.pixel = w->gterm.gm_cursorBgColor; + XQueryColor (display, w->core.colormap, &fg_color); + XQueryColor (display, w->core.colormap, &bg_color); + + w->gterm.gm_markerCursor = XCreateFontCursor (display, XC_fleur); + XRecolorCursor (display, w->gterm.gm_markerCursor, &fg_color,&bg_color); + w->gterm.gm_edgeCursor = XCreateFontCursor (display, XC_dotbox); + XRecolorCursor (display, w->gterm.gm_edgeCursor, &fg_color,&bg_color); + w->gterm.gm_pointCursor = XCreateFontCursor (display, XC_sizing); + XRecolorCursor (display, w->gterm.gm_pointCursor, &fg_color,&bg_color); + + if (!(type = GmStrToType (w->gterm.gm_defaultMarker))) + type = Gm_Rectangle; + w->gterm.gm_defaultType = type; + + if (!null_region) + null_region = XCreateRegion(); + w->gterm.gm_initialized++; + } + + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.gm_redisplay = False; + w->gterm.preserve_screen = 0; +} + + +/* GtMarkerFree -- Free any marker subsystem resources. + */ +static void +GtMarkerFree (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + register Marker gm; + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) + GmDestroy (gm); + + if (!w->gterm.gm_initialized) + return; + + XFreeGC (display, w->gterm.gm_drawGC); + XFreeGC (display, w->gterm.gm_rubberGC); + + /* This call can fail - see comments elsewhere in this file about + * XFreeCursor. + * + XFreeCursor (display, w->gterm.gm_markerCursor); + XFreeCursor (display, w->gterm.gm_edgeCursor); + XFreeCursor (display, w->gterm.gm_pointCursor); + */ + + w->gterm.gm_initialized = 0; +} + + +/* gm_focusin -- Called when gterm window input is directed to a marker. + */ +static void +gm_focusin (w, gm, what) + register GtermWidget w; + register Marker gm; + GmSelection what; +{ + Cursor cursor; + int erase; + Marker am; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (am = w->gterm.gm_active) { + if (am != gm) + gm_focusout (w, 0); + else if (what && what->type == w->gterm.gm_selection.type) { + /* no change */ + return; + } + } + + if (what) { + switch (what->type) { + case Ge_Point: + cursor = w->gterm.gm_pointCursor; + break; + case Ge_Edge: + cursor = w->gterm.gm_edgeCursor; + break; + default: + cursor = w->gterm.gm_markerCursor; + break; + } + } else + cursor = w->gterm.gm_markerCursor; + + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, cursor); + w->gterm.gm_active = gm; + w->gterm.gm_selection = *what; + + if (gm && gm != am) { + gm_request_translations (w, gm); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusIn, NULL, NULL, 0); +} + + +/* gm_focusout -- Called to restore the normal gterm window input when the + * pointer moves off a marker. + */ +static void +gm_focusout (w, enableSetTrans) + register GtermWidget w; + int enableSetTrans; /* replace translations */ +{ + register Display *display = w->gterm.display; + register Marker gm = w->gterm.gm_active; + int erase, i; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Restore the default gterm window translations. */ + if (enableSetTrans) + gm_request_translations (w, NULL); + + XDefineCursor (display, w->gterm.window, w->gterm.cursor); + w->gterm.gm_active = NULL; + + if (gm) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusOut, NULL, NULL, 0); +} + + +/* gm_refocus -- Simulate a pointer event to recompute the marker pointer + * focus. Called when a software event changes the marker stacking order + * in some way. + */ +static void +gm_refocus (w) + GtermWidget w; +{ + XMotionEvent event; + int nparams = 0; + + event.type = MotionNotify; /* MF009 */ + event.x = w->gterm.last_x; + event.y = w->gterm.last_y; + HandleTrackCursor ((Widget)w, &event, NULL, &nparams); +} + + +/* + * Translation tables. The widget's translation table must not be replaced + * while a translation is executing. This can be a problem as it is often + * events and their translations which lead to the translation table getting + * replaced. To avoid this problem we merely queue a timer event to load + * the desired translation table, allowing any existing translation to + * finish executing before the translation table is swapped out. If multiple + * translation table load requests are issued only the final one has any + * effect. + */ + +/* gm_request_translations -- Queue a request to load the translations for the + * specified marker (or NULL to load the default gterm translations). If this + * is the first request and timers are enabled a timer is posted to load the + * translations when any current event processing is complete. If a request + * is already active then the most recent request supercedes any previous one. + */ +static void +gm_request_translations (w, gm) + register GtermWidget w; + Marker gm; +{ + w->gterm.gm_reqTranslations = gm; + + if (!w->gterm.useTimers) + gm_load_translations (w, NULL); + else if (!w->gterm.gm_timer_id) { + w->gterm.gm_timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext((Widget)w), 0, + gm_load_translations, (XtPointer)w); + } +} + + +/* gm_load_translations -- Swap out the widget's translation table. This is + * a no-op if the requested translation table is already loaded. + */ +static void +gm_load_translations (w, id) + register GtermWidget w; + XtIntervalId id; +{ + register Marker am, gm; + register int i; + + w->gterm.gm_timer_id = (XtIntervalId) NULL; + + am = w->gterm.gm_curTranslations; + gm = w->gterm.gm_reqTranslations; + if (am == gm && w->gterm.gm_initialized) + return; + + if (gm) { + /* Set the translations for the indicated marker. */ + if (!am || am->translations != gm->translations) + XtOverrideTranslations ((Widget)w, gm->translations); + } else { + /* Restore the default gterm window translations. */ + XtVaSetValues ((Widget)w, + XtNtranslations, (XtArgVal)w->gterm.defTranslations, NULL); + for (i=0; i < w->gterm.nauxTrans; i++) { + switch (w->gterm.auxTType[i]) { + case T_augment: + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + case T_override: + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + } + } + } + + w->gterm.gm_curTranslations = w->gterm.gm_reqTranslations; +} + + +/* Public marker functions. + * -------------------------- + */ + +/* GmCreate -- Create a new marker. + */ +Marker +GmCreate (w, type, interactive) + GtermWidget w; + int type; /* marker type */ + int interactive; /* use pointer to set position */ +{ + register Marker gm; + + /* Allocate descriptor. */ + if (type < 1 || type > Gm_NTypes) + return (NULL); + if (!(gm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + /* Initialize descriptor. */ + gm->w = w; + gm->type = type; + gm->flags = interactive ? (Gm_Visible|Gm_Sensitive) : 0; + gm->translations = w->gterm.gm_defTranslations; + gm->old_region = XCreateRegion(); + gm->cur_region = XCreateRegion(); + (gm_classinit[type-1]) (gm, interactive); + + /* Link marker to tail of marker list. */ + gm_linkafter (gm, w->gterm.gm_tail); + + /* If marker is being created interactive, set flag to indicate that the + * next create marker event should finish creating this marker. + */ + if (w->gterm.gm_create) + GmDestroy (w->gterm.gm_create); + w->gterm.gm_create = interactive ? gm : NULL; + + return (gm); +} + + +/* GmDestroy -- Destroy a marker. + */ +GmDestroy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + Region old_region, cur_region; + + /* GmDestroy can be called recursively during a destroy operation as a + * side effect of the destroy callback. Set the Gm_BeingDestroyed flag + * to cause these redundant destroy requests to be ignored. + */ + if (gm->flags & Gm_BeingDestroyed) + return (OK); + gm->flags |= Gm_BeingDestroyed; + + /* Release the focus if active marker. This should be done before + * proceeding to destroy the marker, i.e. before calling the destroy + * callbacks. + */ + if (w->gterm.gm_active == gm) { + gm_focusout (w, 1); + w->gterm.gm_active = NULL; + } + + /* Inform any clients that have registered a callback for this marker + * that we are about to destroy the marker. + */ + gm_do_callbacks (gm, GmEvDestroy, NULL, NULL, 0); + + /* Erase the marker from the screen. */ + GmMarkpos (gm); + gm_erase (gm); + + /* Note marker position. */ + old_region = gm->old_region; + cur_region = gm->cur_region; + + /* Free all storage and unlink the marker. */ + if (gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + if (gm->text) + XtFree ((char *)gm->text); + if (gm->pgon) + XtFree ((char *)gm->pgon); + + gm_unlink (gm); + XtFree ((char *)gm); + + /* Redraw any markers that were obscured by the deleted marker. */ + update_transients (w, old_region); + + XDestroyRegion (old_region); + XDestroyRegion (cur_region); + + /* Recompute the marker focus. */ + gm_refocus (w); + + return (OK); +} + + +/* GmCopy -- Copy a marker. + */ +Marker +GmCopy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register Marker nm; + + if (!(nm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + *nm = *gm; + nm->parent = gm; + nm->old_region = NULL; + nm->cur_region = NULL; + nm->points = NULL; + nm->pgon = NULL; + nm->text = NULL; + + /* Copy region descriptors. */ + if ((char *)(nm->old_region = XCreateRegion()) == NULL) + goto fail; + if ((char *)(nm->cur_region = XCreateRegion()) == NULL) + goto fail; + XUnionRegion (nm->old_region, gm->cur_region, nm->cur_region); + + /* Copy any polypoint data. */ + if (gm->pgon) { + nm->pgon = (DPoint *) XtMalloc (gm->npoints * sizeof(DPoint)); + if (nm->pgon == NULL) + goto fail; + memmove (nm->pgon, gm->pgon, gm->npoints * sizeof(DPoint)); + } + + /* Copy region polygon. */ + if (gm->npoints > GM_MAXVERTICES) { + if (!(nm->points = (XPoint *) XtMalloc (gm->npoints * sizeof(XPoint)))) + goto fail; + memmove (nm->points, gm->points, gm->npoints * sizeof(XPoint)); + } + + /* Copy any text data. */ + if (gm->text) { + int nchars = strlen (gm->text); + if (!(nm->text = XtMalloc (nchars + 1))) + goto fail; + memmove (nm->text, gm->text, nchars + 1); + } + + gm_linkafter (nm, w->gterm.gm_tail); + return (nm); + +fail: + if (nm->text) + XtFree (nm->text); + if (nm->pgon) + XtFree ((char *)nm->pgon); + if (nm->points && nm->points != nm->point_data) + XtFree ((char *)nm->points); + if ((char *)nm->cur_region) + XDestroyRegion (nm->cur_region); + if ((char *)nm->old_region) + XDestroyRegion (nm->old_region); + + XtFree ((char *)nm); + return (NULL); +} + + +/* GmAddCallback -- Add a callback to a marker. + */ +GmAddCallback (gm, events, func, client_data) + register Marker gm; + int events; /* events callback is to receive */ + GmIMethod func; /* function to be called */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i; + + /* Find an empty callback slot. */ + for (i=0; i < GM_MAXCALLBACKS; i++) + if (!gm->callback[i].events) + break; + + /* Register the callback. */ + if (i < GM_MAXCALLBACKS) { + cb = &gm->callback[i]; + cb->events = events; + cb->func = func; + cb->client_data = client_data; + gm->ncallbacks = max (gm->ncallbacks, i + 1); + } + + if (events & GmEvConstraint) + gm->constraints++; +} + + +/* GmDeleteCallback -- Delete a previously posted callback given the + * function pointer and client data passed when the callback was registered. + */ +GmDeleteCallback (gm, func, client_data) + register Marker gm; + GmIMethod func; /* callback function */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i, n; + + for (i=n=0; i < GM_MAXCALLBACKS; i++) { + cb = &gm->callback[i]; + + if (cb->func == func && cb->client_data == client_data) { + if (cb->events & GmEvConstraint) + gm->constraints--; + cb->events = (int)NULL; + cb->func = (GmIMethod)NULL; + cb->client_data = (XtPointer)NULL; + } else if (cb->events) + n = i; + } + + gm->ncallbacks = n + 1; +} + + +/* GmSelect -- Scan the marker list to see if the given pointer coordinates + * are within an active marker. If so, the marker descriptor is returned as + * the function value, and the "what" argument is set to indicate what part + * of the marker was selected. + */ +Marker +GmSelect (w, x, y, what) + GtermWidget w; + int x, y; + GmSelection what; +{ + register int flags = (Gm_Activated|Gm_Visible|Gm_Sensitive); + register XRectangle *r; + register Marker gm; + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) { + if (!((gm->flags & (flags|Gm_BeingDestroyed)) == flags)) + continue; + r = &gm->cur_rect; + if (x < (int)r->x || x >= (int)(r->x + r->width) || + y < (int)r->y || y >= (int)(r->y + r->height)) + continue; + if (gm->select (gm, x, y, what)) + return (gm); + } + + return (NULL); +} + + +/* GmMarkpos -- Save the current marker position, e.g., prior to modifying + * the marker. This is used to erase the old marker when the modified + * marker is later redrawn. + */ +GmMarkpos (gm) + register Marker gm; +{ + gm->markpos (gm); +} + + +/* GmRedraw -- Redraw a marker using the given drawing function. If the erase + * flag is not set (as when in rubber-band mode) the marker is merely drawn + * to the screen. Otherwise if the old marker position has been saved the + * old marker is first erased, then any markers affected by the erase are + * redrawn, and finally the current marker is redrawn at the new location. + */ +GmRedraw (gm, func, erase) + Marker gm; + int func; + int erase; +{ + register Marker mm; + register XRectangle *o, *n, *r; + int flags = (Gm_Activated|Gm_Visible); + Region clip_region, temp_region, temp; + GtermWidget w = gm->w; + int outside; + + /* Recompute marker polygon if any attributes have changed. */ + gm->update (gm); + + clip_region = XCreateRegion(); + temp_region = XCreateRegion(); + + /* Erase the previously marked region (old position). */ + if (erase) { + XUnionRegion (gm->old_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + gm_erase (gm); + } + + if (!erase && func == GXxor) + gm->redraw (gm, func); + else { + /* Draw the marker and any markers it intersects, clipping to the + * new marker region. + */ + o = &gm->old_rect; + n = &gm->cur_rect; + + XUnionRegion (gm->cur_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, clip_region); + + for (mm = gm->w->gterm.gm_head; mm; mm = mm->next) { + if (!((mm->flags & flags) == flags)) + continue; + + /* Redraw a marker if it intersects either the old rect or the + * new rect. + */ + if (mm != gm) { + r = &mm->cur_rect; + outside = 0; + if ((int)r->x >= (int)o->x + (int)o->width || + (int)r->x + (int)r->width <= (int)o->x || + (int)r->y >= (int)o->y + (int)o->height || + (int)r->y + (int)r->height <= (int)o->y) + outside++; + if ((int)r->x >= (int)n->x + (int)n->width || + (int)r->x + (int)r->width <= (int)n->x || + (int)r->y >= (int)n->y + (int)n->height || + (int)r->y + (int)r->height <= (int)n->y) + outside++; + if (outside == 2) + continue; + } + mm->redraw (mm, func); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + } + + if (erase) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XDestroyRegion (clip_region); + XDestroyRegion (temp_region); + + if (func != GXxor && gm->width > 0 && gm->height > 0) { + /* Redraw callback. */ + gm_do_callbacks (gm, GmEvRedraw, NULL, NULL, 0); + + /* Generate moveResize callback, if marker was moved or resized. + */ + if (gm->old_rect.x != gm->cur_rect.x || + gm->old_rect.y != gm->cur_rect.y || + gm->old_rect.width != gm->cur_rect.width || + gm->old_rect.height != gm->cur_rect.height) { + + char x[32], y[32]; + char width[32], height[32]; + char *argv[5]; + int argc; + + /* If the marker was just created (old_rect null) or the marker + * moved and we did a full erase and redraw, any old markpos is + * obsolete so we may as well update the saved position. + */ + if (erase || !gm->old_rect.width || !gm->old_rect.height) + GmMarkpos (gm); + + sprintf (x, "%d", gm->x); + sprintf (y, "%d", gm->y); + sprintf (width, "%d", gm->width); + sprintf (height, "%d", gm->height); + argv[0] = x; + argv[1] = y; + argv[2] = width; + argv[3] = height; + argv[4] = NULL; + argc = 4; + + gm_do_callbacks (gm, GmEvMoveResize, NULL, argv, argc); + } + } +} + + +/* GmRedisplay -- Redisplay the markers in the given region, or redisplay + * the entire window if the region is given as (char *)NULL. + */ +GmRedisplay (w, region) + GtermWidget w; + Region region; +{ + register int flags = (Gm_Activated|Gm_Visible); + register XRectangle *r; + register Marker gm; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Set the clip mask to only draw in the affected region. */ + if (region) + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, region); + + /* Draw all markers that intersect the target region. */ + for (gm = w->gterm.gm_head; gm; gm = gm->next) { + if (!((gm->flags & flags) == flags)) + continue; + + if ((char *)region) { + gm->update (gm); + r = &gm->cur_rect; + if (XRectInRegion (region, + r->x, r->y, r->width, r->height) == RectangleOut) + continue; + } + + gm->redraw (gm, GXcopy); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + w->gterm.gm_redisplay = False; +} + + +/* GmRaise -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn above the second. + */ +GmRaise (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already on top? */ + if (gm == w->gterm.gm_tail || ref_gm && ref_gm->next == gm) + return; + + /* Raise it. */ + gm_unlink (gm); + gm_linkafter (gm, ref_gm ? ref_gm : w->gterm.gm_tail); + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmLower -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn below the second. + */ +GmLower (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already lowered? */ + if (gm == w->gterm.gm_head || ref_gm && ref_gm->prev == gm) + return; + + /* Lower it. */ + gm_unlink (gm); + if (ref_gm && ref_gm->prev) + gm_linkafter (gm, ref_gm->prev); + else { + gm->next = w->gterm.gm_head; + w->gterm.gm_head = gm; + if (gm->next) + gm->next->prev = gm; + if (!w->gterm.gm_tail) + w->gterm.gm_tail = gm; + } + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmNotify -- Notify any clients that have registered callbacks that the + * given marker events have occurred. + */ +GmNotify (gm, events, event, params, nparams) + register Marker gm; + int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + gm_do_callbacks (gm, events, event, params, nparams); +} + + +/* GmAddPt -- Add a point to a marker. + */ +GmAddPt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->addPt) { + GmRedraw (gm, GXxor, erase=False); + gm->addPt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + gm_refocus (gm->w); + } +} + + +/* GmDeletePt -- Delete a point from a marker. + */ +GmDeletePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->deletePt) { + GmMarkpos (gm); + gm->deletePt (gm, x, y); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (gm->w); + } +} + + +/* GmMovePt -- Move a point within a marker. + */ +GmMovePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->movePt) { + GmRedraw (gm, GXxor, erase=False); + gm->movePt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmMove -- Move a marker. + */ +GmMove (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->move) { + GmRedraw (gm, GXxor, erase=False); + gm->move (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmResize -- Resize a marker. + */ +GmResize (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->resize) { + GmRedraw (gm, GXxor, erase=False); + gm->resize (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmRotate -- Rotate a marker. + */ +GmRotate (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->rotate) { + GmRedraw (gm, GXxor, erase=False); + gm->rotate (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmSetAttributes -- Set a list of attributes. Requires that all attribute + * values be specified in the same type. Autoredraw, if enabled, is suspended + * until all attributes have been changed. + */ +GmSetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + int autoredraw, erase; + int status = OK; + + if (autoredraw = (gm->flags & Gm_AutoRedraw)) { + gm->flags &= ~Gm_AutoRedraw; + GmMarkpos (gm); + } + + for (i=0; i < nargs; i++) { + status |= GmSetAttribute (gm, args[i].name, args[i].value, argtype); + if (strcmp (args[i].name, GmAutoRedraw) == 0) + autoredraw = gm_getint (args[i].value, argtype); + } + + if (autoredraw) { + gm->flags |= Gm_AutoRedraw; + GmRedraw (gm, GXcopy, erase=True); + } + + return (status ? ERR : OK); +} + + +/* GmSetAttribute -- Set the value of a marker attribute. + */ +GmSetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int marker_type, atType; + int erase, n, i; + + if (gm->flags & Gm_AutoRedraw) + GmMarkpos (gm); + + switch (atType = gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + marker_type = GmStrToType ((char *)value); + break; + case Gt_Int: + marker_type = gm_getint (value, type); + break; + default: + return (ERR); + } + + marker_type = max(1, min(Gm_NTypes, marker_type)); + (gm_classinit[marker_type-1]) (gm, False); + gm->flags |= Gm_Modified; + break; + + case Ga_Activated: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Activated)) { + gm->flags |= Gm_Activated; + GmRedraw (gm, GXcopy, erase=False); + } + } else { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Activated; + } + return (OK); + + case Ga_Visible: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Visible)) { + gm->flags |= Gm_Visible; + GmRedraw (gm, GXcopy, erase=False); + } + } else if (gm->flags & Gm_Visible) { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Visible; + } + return (OK); + + case Ga_Sensitive: + if (gm_getint (value, type)) + gm->flags |= Gm_Sensitive; + else + gm->flags &= ~Gm_Sensitive; + return (OK); + + case Ga_AutoRedraw: + if (gm_getint (value, type)) + gm->flags |= Gm_AutoRedraw; + else + gm->flags &= ~Gm_AutoRedraw; + return (OK); + + case Ga_Translations: + switch (gm_gettype (type)) { + case Gt_String: + gm->translations = XtParseTranslationTable ((char *)value); + break; + default: + return (ERR); + } + return (OK); + + case Ga_X: + gm->x = gm_getint (value, type); + break; + case Ga_Y: + gm->y = gm_getint (value, type); + break; + + case Ga_Width: + case Ga_Height: + /* For a text marker a size can be specified either in integer + * pixels or in characters, e.g., "40ch" or "40 chars". + */ + if (gm->type == Gm_Text && type == XtRString) { + XFontStruct *fp = gm->font; + int char_width, char_height; + int l_pix, r_pix; + char *ip; + + for (n=0, ip=(char *)value; *ip && isdigit(*ip); ip++) + n = n * 10 + (*ip - '0'); + + while (isspace (*ip)) + ip++; + if (ip[0] == 'c' && ip[1] == 'h') { + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + + if (atType == Ga_Width) + n = n * char_width + l_pix + r_pix; + else + n = n * char_height + l_pix * 2; + } + } else + n = gm_getint (value, type); + + if (atType == Ga_Width) + gm->width = n; + else + gm->height = n; + break; + + case Ga_Rotangle: /* MF022 */ + gm->rotangle = gm_getfloat (value, type) * (M_PI / (double) 180.0); + break; + + case Ga_HighlightColor: + gm->highlightColor = gm_getpixel (w, value, type); + break; + case Ga_LineColor: + gm->lineColor = gm_getpixel (w, value, type); + break; + case Ga_LineWidth: + gm->lineWidth = gm_getint (value, type); + break; + case Ga_LineStyle: + gm->lineStyle = gm_getint (value, type); + break; + + case Ga_KnotColor: + gm->knotColor = gm_getpixel (w, value, type); + break; + case Ga_KnotSize: + gm->knotSize = gm_getint (value, type); + break; + + case Ga_Fill: + gm->fill = gm_getint (value, type); + break; + case Ga_FillColor: + gm->fillColor = gm_getpixel (w, value, type); + break; + case Ga_FillBgColor: + gm->fillBgColor = gm_getpixel (w, value, type); + break; + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + gm->fillStyle = gm_getfillstyle (w, value, type); + break; + default: + break; + } + break; + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + gm->fillPattern = (Pixmap) (value); + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + gm->textColor = gm_getpixel (w, value, type); + break; + case Ga_TextBgColor: + gm->textBgColor = gm_getpixel (w, value, type); + break; + case Ga_TextBorder: + gm->textBorder = gm_getint (value, type); + break; + case Ga_ImageText: + gm->imageText = gm_getint (value, type); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + i = gm_getint (value, type); + if (i >= 0 && i < NDialogFonts) + gm->font = w->gterm.dialog_fonts[i]; + break; + case Gt_Pointer: + gm->font = (XFontStruct *) (value); + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + case Gt_String: + if (gm->text) + XtFree (gm->text); + if (!(gm->text = XtMalloc (strlen((char *)value) + 1))) + return (ERR); + strcpy (gm->text, (char *)value); + break; + default: + return (ERR); + } + break; + case Ga_RotIndicator: /* MF020 */ + gm->rotIndicator = gm_getint (value, type); + break; + + default: + return (ERR); + } + + gm->flags |= Gm_Modified; + + if (gm->flags & Gm_AutoRedraw) + GmRedraw (gm, GXcopy, erase=True); + + /* Notify client that a marker attribute has changed. */ + { char *argv[2]; + int argc; + + argv[0] = attribute; + argv[1] = NULL; + argc = 1; + + gm_do_callbacks (gm, GmEvModify, NULL, argv, argc); + } + + return (OK); +} + + +/* GmGetAttributes -- Get a list of attributes. Requires that all attribute + * values be specified in the same type. + */ +GmGetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + + for (i=0; i < nargs; i++) + GmGetAttribute (gm, args[i].name, args[i].value, argtype); +} + + +/* GmGetAttribute -- Get the value of a marker attribute. + */ +GmGetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int i; + + switch (gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->type) { + case Gm_Text: + strcpy ((char *)value, GmText); + break; + case Gm_Line: + strcpy ((char *)value, GmLine); + break; + case Gm_Polyline: + strcpy ((char *)value, GmPolyline); + break; + case Gm_Rectangle: + strcpy ((char *)value, GmRectangle); + break; + case Gm_Box: + strcpy ((char *)value, GmBox); + break; + case Gm_Circle: + strcpy ((char *)value, GmCircle); + break; + case Gm_Ellipse: + strcpy ((char *)value, GmEllipse); + break; + case Gm_Polygon: + strcpy ((char *)value, GmPolygon); + break; + default: + return (ERR); + } + break; + case Gt_Int: + if (gm_putint (gm->type, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_Activated: + if (gm_putint ((gm->flags & Gm_Activated) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Visible: + if (gm_putint ((gm->flags & Gm_Visible) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Sensitive: + if (gm_putint ((gm->flags & Gm_Sensitive) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_AutoRedraw: + if (gm_putint ((gm->flags & Gm_AutoRedraw) != 0, value, type) == ERR) + return (ERR); + break; + + case Ga_X: + if (gm_putint (gm->x, value, type) == ERR) + return (ERR); + break; + case Ga_Y: + if (gm_putint (gm->y, value, type) == ERR) + return (ERR); + break; + case Ga_Width: + if (gm_putint (gm->width, value, type) == ERR) + return (ERR); + break; + case Ga_Height: + if (gm_putint (gm->height, value, type) == ERR) + return (ERR); + break; + case Ga_Rotangle: /* MF022 */ + if (gm_putfloat(((double)180.0/M_PI)*(gm->rotangle),value,type) == ERR) + return (ERR); + break; + + case Ga_HighlightColor: + if (gm_putint ((int)gm->highlightColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineColor: + if (gm_putint ((int)gm->lineColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineWidth: + if (gm_putint (gm->lineWidth, value, type) == ERR) + return (ERR); + break; + case Ga_LineStyle: + if (gm_putint (gm->lineStyle, value, type) == ERR) + return (ERR); + break; + case Ga_KnotColor: + if (gm_putint ((int)gm->knotColor, value, type) == ERR) + return (ERR); + break; + case Ga_KnotSize: + if (gm_putint (gm->knotSize, value, type) == ERR) + return (ERR); + break; + + case Ga_Fill: + if (gm_putint (gm->fill, value, type) == ERR) + return (ERR); + break; + case Ga_FillColor: + if (gm_putint ((int)gm->fillColor, value, type) == ERR) + return (ERR); + break; + case Ga_FillBgColor: + if (gm_putint ((int)gm->fillBgColor, value, type) == ERR) + return (ERR); + break; + + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->fillStyle) { + case FillSolid: + strcpy ((char *)value, "FillSolid"); + break; + case FillTiled: + strcpy ((char *)value, "FillTiled"); + break; + case FillStippled: + strcpy ((char *)value, "FillStippled"); + break; + case FillOpaqueStippled: + strcpy ((char *)value, "FillOpaqueStippled"); + break; + default: + strcpy ((char *)value, "FillSolid"); + break; + } + break; + case Gt_Int: + if (gm_putint (gm->fillStyle, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + *(Pixmap *)value = gm->fillPattern; + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + if (gm_putint ((int)gm->textColor, value, type) == ERR) + return (ERR); + break; + case Ga_TextBorder: + if (gm_putint (gm->textBorder, value, type) == ERR) + return (ERR); + break; + case Ga_ImageText: + if (gm_putint (gm->imageText, value, type) == ERR) + return (ERR); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + for (i=0; i < NDialogFonts; i++) + if (gm->font == w->gterm.dialog_fonts[i]) { + if (gm_putint (i, value, type) == ERR) + return (ERR); + break; + } + break; + case Gt_Pointer: + *(XFontStruct **)value = gm->font; + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + *((char **)value) = gm->text; + break; + case Gt_String: + strcpy ((char *)value, gm->text); + break; + default: + return (ERR); + } + break; + case Ga_RotIndicator: /* MF020 */ + if (gm_putint (gm->rotIndicator, value, type) == ERR) + return (ERR); + break; + + + default: + return (ERR); + } + + return (OK); +} + + +/* GmSetVertices -- Set the vertices of a "poly" type object. + */ +GmSetVertices (gm, points, first, npts) + Marker gm; + DPoint *points; /* input array of points */ + int first; /* first point to be set */ + int npts; /* number of points to set */ +{ + register DPoint *ip, *pp; + register XPoint *op; + register int i; + int erase; + + /* The point vector is automatically extended if more space is needed. + * Small vectors are stored directly in the marker descriptor in the + * point_data array. + */ + if (first + npts != gm->npoints) { /* MF013 */ + if (gm->npoints > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) XtRealloc ((char *)gm->points, + first + npts)) == (XPoint *)NULL) + return; + } else if (first + npts > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) + XtMalloc (first + npts)) == (XPoint *)NULL) + return; + } else if (!gm->points) + gm->points = gm->point_data; + + gm->npoints = first + npts; + } + + /* Copy the point data. */ + ip = points; + op = &gm->points[first]; + for (i=0; i < npts; i++) { + op->x = (int) ip->x + 0.5; + op->y = (int) ip->y + 0.5; + ip++, op++; + } + + /* If we're defining the vertices of a 'poly' marker update the + * pgon[] array with the new set of points. Polygons are initialized + * with a unit rectangle and since vertices can't be set as an attribute + * the must be set with a setVertices call so we need to update the + * structure here. + */ + if (gm->type == Gm_Polygon) { /* MF018 */ + + if (gm->pgon) /* MF018 */ + XtFree ((char *)gm->pgon); + gm->pgon = (DPoint *) XtCalloc (first+npts+1, sizeof(DPoint)); + + /* Copy the point data to the polygon array. */ + op = &gm->points[0]; + pp = &gm->pgon[0]; + for (i=0; i< gm->npoints; i++, pp++, op++) { + pp->x = (double)op->x - gm->x; + pp->y = (double)op->y - gm->y; + } + gm->points[first+npts] = gm->points[0]; /* Close the polygon. */ + + gm->npoints = gm->pgon_npts = first + npts + 1; + gm->rotangle = 0.0; /* reset rotation angle */ + gm->flags |= Gm_Modified; /* marker has been modified */ + } + + /* Redraw the marker if autoredraw is enabled. */ + if (gm->flags & Gm_AutoRedraw) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } +} + + +/* GmGetVertices -- Get the vertices of a "poly" type object. The actual + * number of points output is returned as the function value. + */ +GmGetVertices (gm, points, first, maxpts) + register Marker gm; + register DPoint *points; /* output array of points */ + int first; /* first point to be returned */ + int maxpts; /* max number of points to return */ +{ + register XPoint *ip; + register DPoint *op; + register int i; + int top, nout; + + if (first >= gm->npoints) + return (0); + top = min (first + maxpts, gm->npoints); + nout = top - first; + + /* In the case of a poly object don't return the closing segment. */ + if (gm->type == Gm_Polygon) /* MF027 */ + --nout; + + if (points) { + ip = &gm->points[first]; + op = points; + for (i=0; i < nout; i++) { + op->x = ip->x; + op->y = ip->y; + ip++, op++; + } + } + + return (nout); +} + + +/* GmGetBoundingBox -- Returns a rect large enough to completely enclose a + * marker, regardless of its type or orientation. + */ +GmGetBoundingBox (gm, x, y, width, height) + register Marker gm; + int *x, *y; + int *width, *height; +{ + register XRectangle *r = &gm->cur_rect; + + *x = r->x; + *y = r->y; + *width = r->width; + *height = r->height; +} + + +/* GmStrToType -- Convert a marker type string to a marker type code. + */ +GmStrToType (marker_type) +register char *marker_type; +{ + register int type; + + if (strcmp (marker_type, GmText) == 0) + type = Gm_Text; + else if (strcmp (marker_type, GmLine) == 0) + type = Gm_Line; + else if (strcmp (marker_type, GmPolyline) == 0) + type = Gm_Polyline; + else if (strcmp (marker_type, GmRectangle) == 0) + type = Gm_Rectangle; + else if (strcmp (marker_type, GmBox) == 0) + type = Gm_Box; + else if (strcmp (marker_type, GmCircle) == 0) + type = Gm_Circle; + else if (strcmp (marker_type, GmEllipse) == 0) + type = Gm_Ellipse; + else if (strcmp (marker_type, GmPolygon) == 0) + type = Gm_Polygon; + else + type = 0; + + return (type); +} + + +/* GmStrToEvent -- Convert a marker event type string to a marker event code. + */ +GmStrToEvent (event_type) +register char *event_type; +{ + register int type; + + if (strcmp (event_type, "notify") == 0) + type = GmEvNotify; + else if (strcmp (event_type, "moveResize") == 0) + type = GmEvMoveResize; + else if (strcmp (event_type, "modify") == 0) + type = GmEvModify; + else if (strcmp (event_type, "redraw") == 0) + type = GmEvRedraw; + else if (strcmp (event_type, "destroy") == 0) + type = GmEvDestroy ; + else if (strcmp (event_type, "input") == 0) + type = GmEvInput; + else if (strcmp (event_type, "focusIn") == 0) + type = GmEvFocusIn; + else if (strcmp (event_type, "focusOut") == 0) + type = GmEvFocusOut; + else if (strcmp (event_type, "constraint") == 0) + type = GmEvConstraint; + else + type = 0; + + return (type); +} + + +/* GmStrToFunction -- Convert a drawing function string to the corresponding + * XLIB function code. + */ +GmStrToFunction (function) +register char *function; +{ + register int code; + + if (strcmp (function, "clear") == 0) + code = GXclear; + else if (strcmp (function, "and") == 0) + code = GXand; + else if (strcmp (function, "andReverse") == 0) + code = GXandReverse; + else if (strcmp (function, "copy") == 0) + code = GXcopy; + else if (strcmp (function, "andInverted") == 0) + code = GXandInverted; + else if (strcmp (function, "noop") == 0) + code = GXnoop; + else if (strcmp (function, "xor") == 0) + code = GXxor; + else if (strcmp (function, "or") == 0) + code = GXor; + else if (strcmp (function, "nor") == 0) + code = GXnor; + else if (strcmp (function, "equiv") == 0) + code = GXequiv; + else if (strcmp (function, "invert") == 0) + code = GXinvert; + else if (strcmp (function, "orReverse") == 0) + code = GXorReverse; + else if (strcmp (function, "copyInverted") == 0) + code = GXcopyInverted; + else if (strcmp (function, "orInverted") == 0) + code = GXorInverted; + else if (strcmp (function, "nand") == 0) + code = GXnand; + else if (strcmp (function, "set") == 0) + code = GXset; + else + code = -1; + + return (code); +} + + +/* Internal procedures for above code. + * ------------------------------------ + */ + +static int +gm_getint (value, type) + XtArgVal value; + char *type; +{ + register int ch; + + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + ch = *((char *)value); + if (ch == 'T' || ch == 't') + return (1); + else if (ch == 'F' || ch == 'f') + return (0); + else + return (atoi((char *)value)); + default: + return (0); + } +} + + +static Pixel +gm_getpixel (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + XrmValue from, to; + Pixel pixel; + char *str; + + switch (gm_gettype (type)) { + case Gt_Int: + /* Pixel value (colormap index). */ + return ((Pixel)value); + + case Gt_String: + /* The pixel is expressed either as a pixel number input as a string, + * or as a color name. The latter case requires a type conversion. + */ + str = (char *)value; + if (isdigit(str[0]) && (int)strlen(str) <= 3) { + int index = atoi (str); + pixel = w->gterm.cmap[index]; + return (pixel); + } + + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) { + /* Allocate color from default colormap. + */ + from.size = strlen ((char *)value) + 1; + from.addr = (char *)value; + to.addr = (caddr_t) &pixel; + to.size = sizeof(pixel); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRPixel, &to)) + pixel = w->gterm.cmap[1]; + + } else { + /* Allocate closest match from custom colormap. This is crude, + * but for the standard colors this will return an exact match. + */ + int index, min_dist, dist, i; + XColor exact, best, *cp; + + pixel = w->gterm.cmap[1]; + if (XLookupColor (w->gterm.display, + get_colormap(w), str, &exact, &best)) { + min_dist = 9999; + index = 1; + + for (i=0; i < w->gterm.ncolors; i++) { + cp = &w->gterm.color[i]; + dist = abs((int)exact.red - (int)cp->red) + + abs((int)exact.green - (int)cp->green) + + abs((int)exact.blue - (int)cp->blue); + if (dist == 0) { + index = i; + break; + } else if (dist < min_dist) { + index = i; + min_dist = dist; + } + } + + pixel = w->gterm.color[index].pixel; + } + } + return (pixel); + + default: + return (w->gterm.cmap[1]); + } +} + + +static int +gm_getfillstyle (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_String: + if (strcmp ((char *)value, "FillSolid") == 0) + return (FillSolid); + else if (strcmp ((char *)value, "FillTiled") == 0) + return (FillTiled); + else if (strcmp ((char *)value, "FillStippled") == 0) + return (FillStippled); + else if (strcmp ((char *)value, "FillOpaqueStippled") == 0) + return (FillOpaqueStippled); + break; + default: + break; + } + + return (FillSolid); +} + + +static double +gm_getfloat (value, type) + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + return (atof((char *)value)); + default: + return (0); + } +} + + +static char * +gm_getstring (value, type) + XtArgVal value; + char *type; +{ + if (strcmp (type, XtRString) == 0) + return ((char *)value); + else + return (""); +} + + +static int +gm_putint (ival, value, type) + int ival; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = ival; + break; + case Gt_DFloatP: + *(double *)value = (double) ival; + break; + case Gt_String: + sprintf ((char *)value, "%d", ival); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_putfloat (fval, value, type) + double fval; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = (int) fval; + break; + case Gt_DFloatP: + *(double *)value = fval; + break; + case Gt_String: + sprintf ((char *)value, "%g", fval); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_gettype (type) + char *type; +{ + if (strcmp (type, XtRBool) == 0) + return (Gt_Int); + else if (strcmp (type, XtRInt) == 0) + return (Gt_Int); + else if (strcmp (type, XtRFloat) == 0) + return (Gt_DFloatP); + else if (strcmp (type, XtRPointer) == 0) + return (Gt_Pointer); + else if (strcmp (type, XtRString) == 0) + return (Gt_String); + else + return (ERR); +} + + +static int +gm_getattribute (attribute) + char *attribute; +{ + if (strcmp (attribute, GmType) == 0) + return (Ga_Type); + else if (strcmp (attribute, GmActivated) == 0) + return (Ga_Activated); + else if (strcmp (attribute, GmVisible) == 0) + return (Ga_Visible); + else if (strcmp (attribute, GmSensitive) == 0) + return (Ga_Sensitive); + else if (strcmp (attribute, GmAutoRedraw) == 0) + return (Ga_AutoRedraw); + else if (strcmp (attribute, GmTranslations) == 0) + return (Ga_Translations); + else if (strcmp (attribute, GmX) == 0) + return (Ga_X); + else if (strcmp (attribute, GmY) == 0) + return (Ga_Y); + else if (strcmp (attribute, GmWidth) == 0) + return (Ga_Width); + else if (strcmp (attribute, GmHeight) == 0) + return (Ga_Height); + else if (strcmp (attribute, GmRotangle) == 0) + return (Ga_Rotangle); + else if (strcmp (attribute, GmHighlightColor) == 0) + return (Ga_HighlightColor); + else if (strcmp (attribute, GmLineColor) == 0) + return (Ga_LineColor); + else if (strcmp (attribute, GmLineWidth) == 0) + return (Ga_LineWidth); + else if (strcmp (attribute, GmLineStyle) == 0) + return (Ga_LineStyle); + else if (strcmp (attribute, GmKnotColor) == 0) + return (Ga_KnotColor); + else if (strcmp (attribute, GmKnotSize) == 0) + return (Ga_KnotSize); + else if (strcmp (attribute, GmFill) == 0) + return (Ga_Fill); + else if (strcmp (attribute, GmFillColor) == 0) + return (Ga_FillColor); + else if (strcmp (attribute, GmFillBgColor) == 0) + return (Ga_FillBgColor); + else if (strcmp (attribute, GmFillPattern) == 0) + return (Ga_FillPattern); + else if (strcmp (attribute, GmFillStyle) == 0) + return (Ga_FillStyle); + else if (strcmp (attribute, GmTextColor) == 0) + return (Ga_TextColor); + else if (strcmp (attribute, GmTextBgColor) == 0) + return (Ga_TextBgColor); + else if (strcmp (attribute, GmTextBorder) == 0) + return (Ga_TextBorder); + else if (strcmp (attribute, GmImageText) == 0) + return (Ga_ImageText); + else if (strcmp (attribute, GmFont) == 0) + return (Ga_Font); + else if (strcmp (attribute, GmText) == 0) + return (Ga_Text); + else if (strcmp (attribute, GmRotIndicator) == 0) /* MF020 */ + return (Ga_RotIndicator); + else + return (ERR); +} + +static void +gm_linkafter (gm, prev) + register Marker gm; + register Marker prev; +{ + register GtermWidget w = gm->w; + + gm->prev = prev; + gm->next = prev ? prev->next : NULL; + if (prev) + prev->next = gm; + + if (!w->gterm.gm_tail || prev == w->gterm.gm_tail) + w->gterm.gm_tail = gm; + if (!w->gterm.gm_head) + w->gterm.gm_head = gm; + + w->gterm.preserve_screen++; +} + + +static void +gm_unlink (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + + if (gm->prev) + gm->prev->next = gm->next; + if (gm->next) + gm->next->prev = gm->prev; + if (w->gterm.gm_head == gm) + w->gterm.gm_head = gm->next; + if (w->gterm.gm_tail == gm) + w->gterm.gm_tail = gm->prev; + + gm->prev = gm->next = NULL; + if (!w->gterm.gm_head) + w->gterm.preserve_screen = 0; +} + + +/* gm_do_callbacks -- Call any client callbacks registered for the given + * event type. + */ +static int +gm_do_callbacks (gm, events, event, params, nparams) + Marker gm; + register int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + register int n; + register struct markerCallback *cb; + struct markerCallback callback[GM_MAXCALLBACKS]; + int ncallbacks, status; + + /* Copy the callbacks list into local memory to ensure that it is not + * changed by executing a callback. + */ + ncallbacks = gm->ncallbacks; + memmove ((char *)callback, (char *)gm->callback, + sizeof (struct markerCallback) * GM_MAXCALLBACKS); + + for (n = ncallbacks, cb = callback; --n >= 0; cb++) + if (cb->events & events) { + status = cb->func (cb->client_data, + gm, events, event, params, nparams); + if (status) + return (status); + } + + return (0); +} + + +/* gm_constraint -- Handle the constraint callback. This is a client + * callback called when a marker position or size attribute is changed + * interactively at runtime. The purpose of the callback is to allow the + * client to apply any constraints, e.g. to keep the marker within a + * certain area or range of sizes, to forbid rotation, and so on. + */ +static int +gm_constraint (gm, new_gm, what) + register Marker gm, new_gm; + register int what; +{ + register char *ip, *op; + char argbuf[2048]; + char *argv[30]; + int argc = 0; + + /* Return immediately if there are no constraint callbacks. */ + if (!gm->constraints) + return; + + /* Prepare an argument list listing the marker attributes being changed + * and their old and new values. Each attribute is passed as three + * arg strings: name old-value new-value. Each argument string is + * allocated a fixed amount of space of SZ_NUMBER characters. + */ + op = argbuf; + if (what & Gb_X) { + strcpy (argv[argc++]=op, "x"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->x); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->x); op += SZ_NUMBER; + } + if (what & Gb_Y) { + strcpy (argv[argc++]=op, "y"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->y); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->y); op += SZ_NUMBER; + } + if (what & Gb_Width) { + strcpy (argv[argc++]=op, "width"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->width); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->width); op += SZ_NUMBER; + } + if (what & Gb_Height) { + strcpy (argv[argc++]=op, "height"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->height); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->height); op += SZ_NUMBER; + } + if (what & Gb_Rotangle) { /* MF022 */ + double rot = (gm->rotangle * ((double)180.0 / M_PI)); + double new_rot = (new_gm->rotangle * ((double)180.0 / M_PI)); + strcpy (argv[argc++]=op, "rotangle"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", rot); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", new_rot); op += SZ_NUMBER; + } + + /* Call any constraint callbacks. The argv value strings are modified + * in place. + */ + gm_do_callbacks (gm, GmEvConstraint, NULL, argv, argc); + + /* Copy the possibly edited values back into the new_gm struct. + */ + ip = argbuf + SZ_NUMBER * 2; + if (what & Gb_X) { + new_gm->x = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Y) { + new_gm->y = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Width) { + new_gm->width = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Height) { + new_gm->height = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Rotangle) { + new_gm->rotangle = atof (ip); ip += SZ_NUMBER*3; + + /* Convert back to radians.... */ + new_gm->rotangle *= (M_PI / (double)180.0); /* MF022 */ + } +} + + +static void +gm_erase (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register XRectangle *r = &gm->old_rect; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Any clipping to the marker border is set outside this routine. */ + if ((gm->flags & Gm_Visible) && !NullRect(r)) + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, r->x, r->y, r->width, r->height, r->x, r->y); +} + + +/* Marker actions. + * ------------------------- + */ + + +/* M_create -- Create a marker. + */ +static void +M_create (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int interactive, type; + gmSelection what; + + savepos (w, event); + + /* If the marker has already been created in interactive mode the event + * merely initializes the marker, otherwise we create and initialize a + * new marker. + */ + if (!(gm = w->gterm.gm_create)) { + type = w->gterm.gm_defaultType; + if (*nparams == 1) { + if (!(type = GmStrToType (params[0]))) + type = w->gterm.gm_defaultType; + } + gm = GmCreate (w, type, interactive=True); + } + + gm->x = ev->x; + gm->y = ev->y; + gm->flags |= Gm_Activated; + w->gterm.gm_create = NULL; + + what.type = (gm->type == Gm_Polygon) ? Ge_Marker : Ge_Point; + what.vertex = 0; + gm_focusin (w, gm, &what); +} + + +/* M_destroy -- Destroy a marker. + */ +static void +M_destroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmDestroy (gm); +} + + +/* M_destroyNull -- Destroy a marker if it is null sized. + */ +static void +M_destroyNull (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (gm && gm->width <= 2 && gm->height <= 2) + GmDestroy (gm); +} + + +/* M_set -- Set a marker attribute. + */ +static void +M_set (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0; i < *nparams; i += 2) + GmSetAttribute (gm, + params[i], (XtArgVal)params[i+1], XtRString); /* MF010 */ +} + + +/* M_raise -- Raise a marker to the top of the display list. + */ +static void +M_raise (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmRaise (gm, NULL); +} + + +/* M_lower -- Lower a marker to the bottom of the display list. + */ +static void +M_lower (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmLower (gm, NULL); +} + + +/* M_notify -- Notify any clients that have registered callbacks for the + * specified type of events. + */ +static void +M_notify (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int events, i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0, events=0; i < *nparams; i++) + if (strcmp (params[i], "notify") == 0) + events |= GmEvNotify; + else if (strcmp (params[i], "moveResize") == 0) + events |= GmEvMoveResize; + else if (strcmp (params[i], "modify") == 0) + events |= GmEvModify; + else if (strcmp (params[i], "redraw") == 0) + events |= GmEvRedraw; + else if (strcmp (params[i], "destroy") == 0) + events |= GmEvDestroy; + else if (strcmp (params[i], "input") == 0) + events |= GmEvInput; + else if (strcmp (params[i], "focusIn") == 0) + events |= GmEvFocusIn; + else if (strcmp (params[i], "focusOut") == 0) + events |= GmEvFocusOut; + + GmNotify (gm, events, event, params + 1, *nparams - 1); +} + + +/* M_input -- Notify any clients that have registered a input callback + * that a input event has occurred. + */ +static void +M_input (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register Marker gm; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmNotify (gm, GmEvInput, event, params, *nparams); +} + + +/* M_markpos -- Mark the current position of the marker, e.g., so that it + * can later be erased. + */ +static void +M_markpos (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmMarkpos (gm); +} + + +/* M_markposAdd -- Execute either the markpos or add action, depending upon + * the pointer location. If the pointer is over an active marker at a + * location where the add action can be executed this is done, otherwise the + * markpos action is executed. + */ +static void +M_markposAdd (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Get marker and type of active portion of marker. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Always do a markpos whether we Add or not. */ + GmMarkpos (gm); + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_redraw -- Redraw a marker. + */ +static void +M_redraw (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int erase; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + /* This redraw undoes the final Xor draw. */ + GmRedraw (gm, GXxor, erase=False); + + /* Redraw the full marker. */ + GmRedraw (gm, GXcopy, erase=True); +} + + +/* M_addPt -- Add a point. + */ +static void +M_addPt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_deletePt -- Delete a point. + */ +static void +M_deletePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (what->type == Ge_Point) + GmDeletePt (gm, ev->x, ev->y); +} + + +/* M_movePt -- Move a point. + */ +static void +M_movePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Move a point (vertex) if supported by marker type. */ + if (what->type == Ge_Point && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmMovePt (gm, ev->x, ev->y); +} + + +/* M_deleteDestroy -- Delete a point or destroy a marker, depending upon the + * pointer position. + */ +static void +M_deleteDestroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + switch (what->type) { + case Ge_Point: + GmDeletePt (gm, ev->x, ev->y); + break; + case Ge_Marker: + GmDestroy (gm); + break; + } +} + + +/* M_move -- Move a marker. + */ +static void +M_move (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmMove (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_resize -- Resize a marker. + */ +static void +M_resize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmResize (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_moveResize -- Move a point or marker, or resize a marker, depending + * upon the pointer position. + */ +static void +M_moveResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Marker: + GmMove (gm, ev->x, ev->y); + break; + case Ge_Point: + if (gm->type == Gm_Polygon || gm->type == Gm_Polyline) + GmMovePt (gm, ev->x, ev->y); + else + goto resize; + break; + case Ge_Edge: +resize: GmResize (gm, ev->x, ev->y); + break; + } + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotate -- Rotate a marker. + */ +static void +M_rotate (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmRotate (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotateResize -- Rotate or resize a marker. + */ +static void +M_rotateResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Point: + GmRotate (gm, ev->x, ev->y); + break; + case Ge_Edge: + if (gm->flags & Gm_Smooth) + GmRotate (gm, ev->x, ev->y); + else + GmResize (gm, ev->x, ev->y); + break; + default: + GmResize (gm, ev->x, ev->y); + break; + } + + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* + * Marker class code. + * --------------------- + * Each marker class implements a subset of the following procedures. The + * first set of procedures are required. The second set are optional and + * may be set to NULL in the marker descriptor if not implemented by the + * marker class. + * + * gm_xxxx_init (gm, interactive) + * bool = gm_xxxx_select (gm, x, y, &what) + * gm_xxxx_markpos (gm) + * gm_xxxx_redraw (gm, func) + * gm_xxxx_update (gm) + * + * gm_xxxx_addPt (gm, x, y) + * gm_xxxx_deletePt (gm, x, y) + * gm_xxxx_movePt (gm, x, y) + * gm_xxxx_move (gm, x, y) + * gm_xxxx_resize (gm, x, y) + * gm_xxxx_rotate (gm, x, y) + * + * where xxxx is the 4 character marker class name. + */ + +/* Marker class TEXT. + */ +static int gm_text_select(); +static void gm_text_move(), gm_text_resize(); +static void gm_text_markpos(), gm_text_redraw(); +static void gm_text_update(), gm_text_updatePolygon(); + +static void +gm_text_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Text; + if (!(gm->flags & Gm_Activated)) { + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_TextLineColor; + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->textColor = w->gterm.gm_TextColor; + gm->textBgColor = w->gterm.gm_TextBgColor; + gm->textBorder = w->gterm.gm_TextBorder; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->font = w->gterm.gm_TextFont; + gm->imageText = False; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->npoints = 4 + 1; + gm->points = gm->point_data; + + gm->select = gm_text_select; + gm->markpos = gm_text_markpos; + gm->redraw = gm_text_redraw; + gm->update = gm_text_update; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_text_move; + gm->resize = gm_text_resize; + gm->rotate = NULL; + + if (w->gterm.gm_TextString) { + if (gm->text) + XtFree (gm->text); + gm->text = (char *) XtMalloc (strlen(w->gterm.gm_TextString)+1); + strcpy (gm->text, w->gterm.gm_TextString); + } else + gm->text = NULL; +} + +static int +gm_text_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + + +static void +gm_text_markpos (gm) + register Marker gm; +{ + gm_markpos (gm); +} + + +static void +gm_text_redraw (gm, function) + register Marker gm; + int function; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + int char_width, char_height, xsize, ysize; + int breakline, l_pix, r_pix, maxch, x, y; + XFontStruct *fp = gm->font; + char *ip, *op, *otop; + char *l_ip, *l_op; + char line[1024]; + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + /* In rubber-band mode just draw the outline of the text region. */ + if (function == GXxor) { + int save_lineWidth = gm->lineWidth; + + if (gm->lineWidth <= 0) + gm->lineWidth = 1; + gm_redraw (gm, function); + gm->lineWidth = save_lineWidth; + return; + } + + /* General case. First draw the text box. */ + gm_redraw (gm, function); + + /* Now draw the text. */ + if (!gm->text) + return; + + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + xsize = gm->width; + ysize = gm->height; + + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + if ((maxch = (xsize - l_pix - r_pix) / char_width) < 1) + return; + + x = gm->x + (gm->lineWidth + 1) / 2 + gm->textBorder + 1; + y = gm->y + (gm->lineWidth + 1) / 2 + gm->textBorder + + fp->max_bounds.ascent; + + XSetForeground (w->gterm.display, w->gterm.gm_drawGC, gm->textColor); + XSetBackground (w->gterm.display, w->gterm.gm_drawGC, gm->textBgColor); + XSetFont (w->gterm.display, w->gterm.gm_drawGC, fp->fid); + + /* Fill lines in a multiline text box. + */ + l_ip = l_op = NULL; + otop = line + maxch; + breakline = 0; + + for (ip = gm->text, op=line; *ip || op > line; ) { + if (! *ip) { + breakline++; + } else if (*ip == ' ' || *ip == '\t') { + l_ip = ip; + l_op = op; + *op++ = ' '; + ip++; + } else if (*ip == '\n') { + ip++; + breakline++; + } else + *op++ = *ip++; + + if (breakline || op > otop) { + if (op > otop) { + if (l_ip && l_op) { + ip = l_ip + 1; + *l_op = '\0'; + } else { + while (op > otop) { + if (ip > gm->text && isprint (*(ip-1))) + --ip; + --op; + } + *op = '\0'; + } + } else + *op = '\0'; + + if (gm->imageText) { + while (op < otop) + *op++ = ' '; + *op = '\0'; + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } else { + XDrawString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } + + y += char_height; + if (breakline) + y += gm->textBorder; + if (y + fp->max_bounds.descent > gm->y + ysize) + break; + + op = line; + l_ip = l_op = NULL; + breakline = 0; + } + } +} + + +static void +gm_text_update (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + if (gm->flags & Gm_Modified) { + gm_text_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_text_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = max (0, x - gm->width / 2); + new_gm.y = max (0, y - gm->height / 2); + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); /* corner */ + + gm->x = new_gm.x; + gm->y = new_gm.y; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = abs (x - gm->x); + new_gm.height = abs (y - gm->y); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = new_gm.width; + gm->height = new_gm.height; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_updatePolygon (gm) + register Marker gm; +{ + register XPoint *p = gm->points; + int xsize = gm->width; + int ysize = gm->height; + + p[0].x = gm->x; p[0].y = gm->y; + p[1].x = gm->x; p[1].y = gm->y + ysize; + p[2].x = gm->x + xsize; p[2].y = gm->y + ysize; + p[3].x = gm->x + xsize; p[3].y = gm->y; + p[4].x = gm->x; p[4].y = gm->y; +} + + +/* Marker class LINE. + */ +static void +gm_line_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Line; + /* stub out for now */ +} + + +/* Marker class POLYLINE. + */ +static void +gm_plin_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Polyline; + /* stub out for now */ +} + + +/* Marker class RECTANGLE. + */ +static int gm_rect_select(); +static void gm_rect_move(), gm_rect_resize(), gm_rect_rotate(); +static void gm_rect_update(), gm_rect_updatePolygon(); + +static void +gm_rect_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Rectangle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_rect_select; + gm->markpos = gm_markpos; + gm->update = gm_rect_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_rect_move; + gm->resize = gm_rect_resize; + gm->rotate = gm_rect_rotate; +} + +static void +gm_rect_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_rect_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_rect_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_resize (gm, x, y) + register Marker gm; + int x, y; +{ +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + struct marker new_gm; + int rx, ry; + int ox = x, oy = y; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + if (rx < 0) + new_gm.x = gm->x - (-rx - gm->width) / 2; + else + new_gm.x = gm->x + (rx - gm->width) / 2; + + if (ry < 0) + new_gm.y = gm->y - (-ry - gm->height) / 2; + else + new_gm.y = gm->y + (ry - gm->height) / 2; + + new_gm.width = gm->width + (abs(rx) - gm->width) / 2; + new_gm.height = gm->height + (abs(ry) - gm->height) / 2; + + gm_constraint (gm, &new_gm, Gb_X|Gb_Y|Gb_Width|Gb_Height); + gm->x = new_gm.x; + gm->y = new_gm.y; + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + + /* V1.1 These eqns have the effect of allowing a marker to be grabbed by + * any corner but doing so resets the rotation angle the first time the + * marker is rotated. + + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + */ + + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_rect_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle);*/ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class BOX. A box marker is like a rectangle except that it is + * described and resized by the center and radius (width/height), like + * the other "centered" marker types (circle, ellipse, etc.). + */ +static int gm_boxx_select(); +static void gm_boxx_move(), gm_boxx_resize(), gm_boxx_rotate(); +static void gm_boxx_update(), gm_boxx_updatePolygon(); + +static void +gm_boxx_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Box; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_boxx_select; + gm->markpos = gm_markpos; + gm->update = gm_boxx_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_boxx_move; + gm->resize = gm_boxx_resize; + gm->rotate = gm_boxx_rotate; +} + +static void +gm_boxx_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_boxx_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_boxx_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_resize (gm, x, y) + register Marker gm; + int x, y; +{ +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + /* V1.1 + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + */ + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_boxx_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + double alpha = atan2 ((double)gm->height, (double)gm->width); + +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class CIRCLE. + */ +static int gm_circ_select(); +static void gm_circ_move(), gm_circ_resize(), gm_circ_rotate(); +static void gm_circ_update(), gm_circ_updatePolygon(); + +static void +gm_circ_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Circle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_CircleLineColor; + gm->knotColor = w->gterm.gm_CircleKnotColor; + gm->knotSize = w->gterm.gm_CircleKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + gm->width = gm->height = (gm->width + gm->height) / 2.0; + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE; /* MF015 */ + + gm->select = gm_circ_select; + gm->markpos = gm_markpos; + gm->update = gm_circ_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_circ_move; + gm->resize = gm_circ_resize; + gm->rotate = NULL; +} + +static void +gm_circ_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_circ_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_circ_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = new_gm.height = + sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = gm->height = new_gm.width; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double theta, x, y; + + /*npts = (gm->npoints - 1) / 4;*/ + npts = gm->npoints / 4; /* MF028 */ + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x + gm->x; + p[npts*0+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x + gm->x; + p[npts*1+j].y = y + gm->y; + + y = -y; j = i; + p[npts*2+j].x = x + gm->x; + p[npts*2+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x + gm->x; + p[npts*3+j].y = y + gm->y; + } + + /*p[gm->npoints-1] = p[0];*/ /* MF015 */ +} + + +/* Marker class ELLIPSE. + */ +static int gm_elip_select(); +static void gm_elip_move(), gm_elip_resize(), gm_elip_rotate(); +static void gm_elip_update(), gm_elip_updatePolygon(); + +static void +gm_elip_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Ellipse; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_EllipseLineColor; + gm->knotColor = w->gterm.gm_EllipseKnotColor; + gm->knotSize = w->gterm.gm_EllipseKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; +/* gm->npoints = GM_NPTSCIRCLE + 1;*/ + gm->npoints = GM_NPTSCIRCLE; /* MF015 */ + + gm->select = gm_elip_select; + gm->markpos = gm_markpos; + gm->update = gm_elip_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_elip_move; + gm->resize = gm_elip_resize; + gm->rotate = gm_elip_rotate; +} + +static void +gm_elip_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_elip_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_elip_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; +/* double theta = -(gm->rotangle);*/ + double theta = (gm->rotangle); /* MF019 */ + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos(theta) - y * sin(theta); + ry = x * sin(theta) + y * cos(theta); + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { +/* theta = atan2 ((double)(y - gm->y), (double)(x - gm->x));*/ + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_elip_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double cos_rotangle, sin_rotangle; + double theta, x, y; + + npts = (gm->npoints - 1) / 4 + 1; /* MF017 */ +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*0+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*1+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; j = i; + p[npts*2+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*2+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*3+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + } + + /*p[gm->npoints-1] = p[0];*/ /* MF015 */ +} + + +/* Marker class POLYGON. + */ +static int gm_pgon_select(); +static void gm_pgon_addPt(), gm_pgon_deletePt(), gm_pgon_movePt(); +static void gm_pgon_move(), gm_pgon_resize(), gm_pgon_rotate(); +static void gm_pgon_redraw(), gm_pgon_update(), gm_pgon_updatePolygon(); + +static void +gm_pgon_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + register DPoint *p; + + gm->type = Gm_Polygon; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_PgonLineColor; + gm->knotColor = w->gterm.gm_PgonKnotColor; + gm->knotSize = w->gterm.gm_PgonKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + + gm->npoints = gm->pgon_npts = 4 + 1; + gm->points = gm->point_data; + if (gm->pgon) + XtFree ((char *)gm->pgon); + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + gm->x = w->gterm.last_x; + gm->y = w->gterm.last_y; + + if (p) { + p[0].x = -1; p[0].y = -1; + p[1].x = -1; p[1].y = 1; + p[2].x = 1; p[2].y = 1; + p[3].x = 1; p[3].y = -1; + p[4].x = -1; p[4].y = -1; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + + if (interactive) + gm->flags |= Gm_PgonInit; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + /* The following gets executed when an existing non-polygon marker is + * turned into a polygon marker. + */ + if (gm->pgon && gm->pgon_npts) + gm->npoints = gm->pgon_npts; + else { + gm->npoints = gm->pgon_npts = 4 + 1; + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + + if (p) { + p[0].x = -gm->width; p[0].y = -gm->height; + p[1].x = -gm->width; p[1].y = gm->height; + p[2].x = gm->width; p[2].y = gm->height; + p[3].x = gm->width; p[3].y = -gm->height; + p[4].x = -gm->width; p[4].y = -gm->height; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + } + + gm->select = gm_select; + gm->markpos = gm_markpos; + gm->update = gm_pgon_update; + gm->redraw = gm_pgon_redraw; + gm->addPt = gm_pgon_addPt; + gm->deletePt = gm_pgon_deletePt; + gm->movePt = gm_pgon_movePt; + gm->move = gm_pgon_move; + gm->resize = gm_pgon_resize; + gm->rotate = gm_pgon_rotate; +} + +static void +gm_pgon_redraw (gm, function) + register Marker gm; + int function; +{ + /* The PgonInit flag is set when a polygon marker is interactively created + * to cause any pointer motion event to resize the marker. The first + * pointer up causes a redraw which clears the flag. + */ + if (function != GXxor && gm->width > 1 && gm->height > 1) + gm->flags &= ~Gm_PgonInit; + + gm_redraw (gm, function); +} + +static void +gm_pgon_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_pgon_addPt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + int vertex, nbytes; + double rx, ry; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Add the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + nbytes = (gm->npoints + 1) * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + + gm->pgon = pv; + memmove (&pv[vertex+2], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + pv[vertex+1].x = rx; + pv[vertex+1].y = ry; + gm->npoints++; + + nbytes = gm->npoints * sizeof (XPoint); + if (gm->npoints > GM_MAXVERTICES) { + if (gm->points != gm->point_data) + gm->points = (XPoint *) XtRealloc ((char *)gm->points, nbytes); + else + gm->points = (XPoint *) XtMalloc (nbytes); + } else + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_deletePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + int vertex, nbytes; + + if (gm->npoints <= 2) + return; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Delete the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + pv = gm->pgon; + + memmove (&pv[vertex], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + gm->npoints--; + + nbytes = gm->npoints * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + gm->pgon = pv; + + if (gm->npoints <= GM_MAXVERTICES && gm->points != gm->point_data) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_movePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + double rx, ry; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get vertex. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + + /* Edit point. */ + p->x = rx; + p->y = ry; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + gm->x = new_gm.x; gm->y = new_gm.y; + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_resize (gm, x, y) + Marker gm; + int x, y; +{ + register DPoint *p, *q; + GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double theta, scale, slope, rx, ry, x1, y1, x2, y2, xi; + int vertex, i; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get first vertex of nearest edge. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + q = p + 1; + + /* Rotate reference frame so that intercept is at y=0. */ + if (abs(rx) + abs(ry) < 1.0) + scale = 1.0; + else { + theta = atan2 (ry, rx); + cos_rotangle = cos (-theta); + sin_rotangle = sin (-theta); + + x1 = p->x * cos_rotangle - p->y * sin_rotangle; + y1 = p->x * sin_rotangle + p->y * cos_rotangle; + x2 = q->x * cos_rotangle - q->y * sin_rotangle; + y2 = q->x * sin_rotangle + q->y * cos_rotangle; + + /* Compute scale factor. */ + if (y1 == y2 || x1 == x2) + scale = 1.0; + else { + slope = (y2 - y1) / (x2 - x1); + xi = x1 - y1 / slope; + scale = sqrt (SQR(rx) + SQR(ry)) / xi; + } + } + + /* Rescale the polygon. */ + for (i=0, p=gm->pgon; i < gm->npoints; i++, p++) { + p->x *= scale; + p->y *= scale; + } + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double alpha, beta, rx, ry; + double theta = atan2 ((double)(gm->y - y), (double)(x - gm->x));/* MF019 */ + struct marker new_gm; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + if (x == gm->x && y == gm->y) + return; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + if (abs(rx) + abs(ry) < 1.0) + return; + + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + + p = &gm->pgon[vertex]; + alpha = atan2 (p->y, p->x); /* angle btw origin & selected vertex */ + beta = atan2 (ry, rx); /* angle btw origin & cursor position */ + + new_gm.rotangle = gm_niceAngle (gm->rotangle + (beta - alpha)); + + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_updatePolygon (gm) + Marker gm; +{ + register npts, i; + register DPoint *ip = gm->pgon; + register XPoint *op = gm->points; + double cos_rotangle, sin_rotangle; + int width, height, xp, xn, yp, yn; + + npts = gm->npoints; +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + xp = xn = yp = yn = 0; + + for (i=0; i < npts; i++, ip++, op++) { + /* Compute the rotated point. */ + op->x = ip->x * cos_rotangle - ip->y * sin_rotangle + gm->x + 0.5; + op->y = ip->x * sin_rotangle + ip->y * cos_rotangle + gm->y + 0.5; + + /* Compute a width/height estimate for the polygon. + */ + if (ip->x > xp) + xp = ip->x; + else if (ip->x < xn) + xn = ip->x; + + if (ip->y > yp) + yp = ip->y; + else if (ip->y < yn) + yn = ip->y; + + gm->width = (xp + -xn) / 2; + gm->height = (yp + -yn) / 2; + } + + gm->points[npts-1] = gm->points[0]; + gm->pgon_npts = gm->npoints; +} + + +/* Internal procedures for above code. + * ----------------------------------- + */ + +/* gm_select -- Determine if a point is within or near a marker, and if so, + * determine whether the point selects a vertex, edge, or the entire marker. + */ +static int +gm_select (gm, x, y, what) + Marker gm; + register int x, y; + GmSelection what; +{ + register XPoint *p, *ptop; + GtermWidget w = gm->w; + int v_dist = w->gterm.gm_nearVertex; + int e_dist = w->gterm.gm_nearEdge; + double seglen, d1, d2, s, K, frac; + int ncrossings, x0, y0; + XPoint *q; + int n; + int use_old_method = 0; + + /* Determine if the point is near a vertex. */ + for (p = gm->points, n = gm->npoints - 1; --n >= 0; p++) + if (abs (x - p->x) < v_dist && abs (y - p->y) < v_dist) { + if (what) { + what->type = Ge_Point; + what->vertex = p - gm->points; + } + return (1); + } + + /* Determine if the point is near an edge. The test is based on the + * observation that when a point is near a line segment, the sum of the + * distances from the point to either end-point of the line segment is + * nearly the same as the length of the line segment. + */ + p = gm->points; + + ptop = p + (gm->npoints - 1); /* MF014 */ + x0 = p->x; y0 = p->y; + d1 = sqrt ((double)(SQR(x - x0) + SQR(y - y0))); + + for (p++; p < ptop; p++) { + seglen = sqrt ((double)(SQR(p->x - x0) + SQR(p->y - y0))); + d2 = sqrt ((double)(SQR(x - p->x) + SQR(y - p->y))); + + if (abs(d1 + d2 - seglen) < e_dist) { /* MF028 */ + if (what) { + what->type = Ge_Edge; + what->vertex = (p - 1) - gm->points; + } + return (1); + } + + d1 = d2; + x0 = p->x; y0 = p->y; + } + + /* If the marker is one of the closed polygon types, determine if the + * point is inside the marker. + */ + switch (gm->type) { + case Gm_Line: + case Gm_Polyline: + return (0); + break; + case Gm_Circle: + d1 = sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + if (d1 < gm->width) { + if (what) what->type = Ge_Marker; + return (1); + } else + return (0); + break; + } + + if (use_old_method) { + for (p = gm->points, ncrossings=0; p < ptop; p++) { + /* Scan forward until we find a line segment that crosses Y. + */ + if (p->y > y) { + for (p++; p < ptop && p->y >= y; p++) + ; + --p; + } else if (p->y < y) { + for (p++; p < ptop && p->y <= y; p++) + ; + --p; + } + + /* The line segment p[0]:p[1] crosses the Y plane. If this lies + * entirely to the left of the X plane we can ignore it. If any + * portion of the line segment lies to the right of X we compute + * the point where the line intersects the Y plane. If this point + * is to the right of the X plane we have a crossing. + */ + q = p + 1; + if (q < ptop && p->x > x || q->x > x) { + if (q->y == p->y) + frac = (double) 0.0; + else + frac = (double)(y - p->y) / (double)(q->y - p->y); + if ((frac * (q->x - p->x) + p->x) >= x) + ncrossings++; + } + } + + } else { + float xp[64], yp[64]; + int i; + + for (i=0, p=gm->points, ncrossings=0; p <= ptop; p++, i++) { + xp[i] = (float) p->x; + yp[i] = (float) p->y; + } + ncrossings = point_in_poly (gm->npoints, xp, yp, (float)x, (float)y); + } + + if (ncrossings & 1) { + if (what) + what->type = Ge_Marker; + return (1); + } + + return (0); +} + +point_in_poly (npol, xp, yp, x, y) +int npol; +float *xp, *yp, x, y; +{ + int i, j, c = 0; + + for (i = 0, j = npol-1; i < npol; j = i++) { + if ((((yp[i] <= y) && (y < yp[j])) || + ((yp[j] <= y) && (y < yp[i]))) && + (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])) + + c = !c; + } + return c; +} + + + + +/* gm_markpos -- Mark the current position of a marker. + */ +static void +gm_markpos (gm) + register Marker gm; +{ + gm->old_rect = gm->cur_rect; + XUnionRegion (gm->cur_region, null_region, gm->old_region); +} + + +/* gm_redraw -- Redraw a marker expressed as a list of vertices. + */ +static void +gm_redraw (gm, function) + register Marker gm; + int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + int flags = (Gm_Activated|Gm_Visible); + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (!((gm->flags & flags) == flags)) + return; + + /* Fill the polygon area if indicated. */ + if (gm->fill && function != GXxor) { + if (gm->fillPattern) { + XSetStipple (display, gc, gm->fillPattern); + XSetForeground (display, gc, gm->fillColor); + XSetBackground (display, gc, gm->fillBgColor); + XSetFillStyle (display, gc, gm->fillStyle); + } else { + XSetForeground (display, gc, gm->fillColor); + XSetFillStyle (display, gc, FillSolid); + } + + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Nonconvex, CoordModeOrigin); + } + + /* Set up the drawing GC. */ + if (function != GXxor) { + XSetFunction (display, gc, function); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, (gm == w->gterm.gm_active) ? + gm->highlightColor : gm->lineColor); + + XSetLineAttributes (display, gc, + gm->lineWidth + + ((gm == w->gterm.gm_active) ? w->gterm.gm_highlightWidth : 0), + gm->lineStyle, + CapButt, + (gm->type == Gm_Polygon || gm->type == Gm_Polyline) ? + JoinBevel : JoinMiter); + } + + /* Draw the marker outline. */ + if (gm->lineWidth > 0) { + if (gm->type == Gm_Circle || + (gm->type == Gm_Ellipse && abs(gm->rotangle) < 0.01)) { + + /* Special case - use X arc drawing primitive. We could use the + * gm->points polygon instead, as this outline polygon is + * maintained for all classes of marker. + */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + } + XDrawArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + + } else { + /* Draw marker expressed as a polygon. */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Convex, CoordModeOrigin); + } + XDrawLines (display, window, gc, + gm->points, gm->npoints, CoordModeOrigin); + } + } + + /* Draw the knots if enabled. */ + if (function != GXxor && gm->knotSize > 0) { + int knotsize = gm->knotSize; + int halfsize = gm->knotSize / 2; + int i; + + XSetForeground (display, gc, gm->knotColor); + for (i=0; i < gm->npoints; i++) { + XFillRectangle (display, window, gc, + gm->points[i].x - halfsize, gm->points[i].y - halfsize, + gm->knotSize, gm->knotSize); + } + } +} + + +/* gm_rotate_indicator -- Draw a line indicating the rotation angle. + */ +static void +gm_rotate_indicator (gm, function) /* MF020 */ +Marker gm; +int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!gm->rotIndicator) + return ; + + if (function == GXxor) { + if (gm->type == Gm_Polygon || + gm->type == Gm_Ellipse || + gm->type == Gm_Box || + gm->type == Gm_Rectangle) { + int x, y, x2, y2; + double ar, cos_rotangle, sin_rotangle; + double alpha = atan2 ((double)gm->height,(double)gm->width); + + cos_rotangle = cos ((double)(-gm->rotangle - alpha)); + sin_rotangle = sin ((double)(-gm->rotangle - alpha)); + ar = (double) gm->height / (double) gm->width; + x = (int) (ar * (gm->width / 2)); + y = (int) (ar * (gm->height / 2)); + x2 = x * cos_rotangle - y * sin_rotangle + gm->x; + y2 = x * sin_rotangle + y * cos_rotangle + gm->y; + + XDrawLine (display, window, gc, gm->x, gm->y, x2, y2); + } + } else { + ; /* no-op at present */ + } +} + + +/* gm_setCurRect -- Compute a bounding rectangle which completely encloses + * a marker (assumes that the marker is expressed as list of points). + */ +static void +gm_setCurRect (gm) +Marker gm; +{ + int border; + + XDestroyRegion (gm->cur_region); + gm->cur_rect = null_rect; + + if (gm->npoints <= 0) + gm->cur_region = XCreateRegion(); + else { + gm->cur_region = XPolygonRegion (gm->points, gm->npoints, EvenOddRule); + border = (max (gm->lineWidth, gm->knotSize) + 1) / 2; + border = max (border, BORDER); + XShrinkRegion (gm->cur_region, -border, -border); + XClipBox (gm->cur_region, &gm->cur_rect); + } +} + + +/* gm_niceAngle -- Round a rotation angle to a "nice" value. + */ +static double +gm_niceAngle (alpha) + double alpha; +{ + double tol = 0.003; + double beta; + + if ( abs (alpha - PI_2*0) < tol) + beta = PI_2*0; + else if (abs (alpha - PI_2*1) < tol) + beta = PI_2*1; + else if (abs (alpha - PI_2*2) < tol) + beta = PI_2*2; + else if (abs (alpha - PI_2*3) < tol) + beta = PI_2*3; + else if (abs (alpha - PI_2*4) < tol) + beta = PI_2*0; + else + beta = alpha; + + return (beta); +} + + +static XImage *cached_ximage = NULL; /* MF004 BEGIN */ + +/* GetCachedXImage -- + */ +static XImage * +GetCachedXImage (w, pixmap, width, height) + GtermWidget w; + Pixmap pixmap; + int width; + int height; +{ + if ((cached_ximage != NULL)) { + if ((pixmap == w->gterm.pixmap) && + (width == w->core.width) && + (height == w->core.height)) { + return (cached_ximage); + } + } + return(NULL); +} + + +/* DestroyCachedXImage -- + */ +static void +DestroyCachedXImage () +{ + if (cached_ximage != NULL) { + XDestroyImage (cached_ximage); + cached_ximage = NULL; + } +} + + +/* NewCachedXImage -- + */ +static void +NewCachedXImage (w, xin, pixmap, width, height) + GtermWidget w; + XImage *xin; + Pixmap pixmap; + int width; + int height; +{ + if ((pixmap == w->gterm.pixmap) && + (width == w->core.width) && + (height == w->core.height)) { + DestroyCachedXImage(); + cached_ximage = xin; + } +} /* MF004 END */ + + +/* + * This routine will search the STATIC colors of w->core.colormap to find an + * exact match for the color name. If no match is found, the foreground is + * returned. + */ + +static Pixel +ColorNameToPixel (w, str) +GtermWidget w; +String str; +{ + int i; + XColor color; + XColor cmap[SZ_STATIC_CMAP]; + + /* Find what colors are available... */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + memset (&cmap[i], 0, sizeof(XColor)); + cmap[i].pixel = i; + } + + XQueryColors(w->gterm.display, w->core.colormap, cmap, SZ_STATIC_CMAP); + + /* ...and find a match */ + if (XParseColor(w->gterm.display, w->core.colormap, str, &color)) { + for (i=0; i<SZ_STATIC_CMAP; i++) { + if ((color.red==cmap[i].red) && + (color.green==cmap[i].green) && + (color.blue==cmap[i].blue)) { + return i; + } + } + } + + return 1; +} + + +/* Global Colormap routines. + */ +static int SetGlobalCmap(w) + GtermWidget w; +{ + static int init=0; + + if( !init ){ + strcpy(global_cmapname, XtNcmapName); + global_ncolors = 0; + global_mincolors = 0; + init = 1; + } + if( !w->gterm.useGlobalCmap ){ + w->gterm.cmap = (Pixel *)XtCalloc(MAX_SZCMAP, sizeof(Pixel)); + w->gterm.color = (XColor *)XtCalloc(MAX_SZCMAP, sizeof(XColor)); + return(0); + } + else{ + w->gterm.cmap = global_cmap; + w->gterm.color = global_color; + return(global_ncolors); + } +} + +static int ParseGlobalCmap(w) + GtermWidget w; +{ + char *s; + char *t; + char *cmapname; + int colors; + int usedefault=0; + + /* process a directive such as "default[n:m,name]", where + * n = min number of colors that must be allocated or else + * use a private map called "name". m is the max colors to + * allocate (same as maxColors). Either or both can be omitted + */ + cmapname = w->gterm.cmapName; + if( !strncmp (cmapname, "default", 7) ){ + usedefault = 1; + if( (s=strchr(cmapname,'[')) != NULL ){ + /* skip open bracket */ + s++; + /* get min number of colors */ + global_mincolors = strtol(s, &t, 10); + /* for n:m syntax, get max colors */ + if( *t == ':' ){ + s = ++t; + colors = strtol(s, &t, 10); + if( colors > 0 ) + w->gterm.maxColors = colors; + } + /* look for default name */ + if( *t == ',' ){ + t++; + } + s = t; + /* this is the new name of the cmap -- but it can't be "default"! */ + if( (strncmp(s, "default", 7)) && (*s != ']') ){ + strcpy(global_cmapname, s); + /* null out closing bracket */ + if( (s = strchr(global_cmapname, ']')) != NULL ) + *s = '\0'; + } + /* now make sure we can grab the min number of colors, + or else set up to use a private color map */ + colors = GetMaxCmapColors(w); + if( colors < global_mincolors ){ + usedefault = 0; + w->gterm.haveColormap = 0; + strcpy(w->gterm.cmapName, global_cmapname); + } + else{ + w->gterm.maxColors = min(w->gterm.maxColors, colors); + } + } + } + return(usedefault); +} + +/* + * + * GetMaxCmapColors -- try to determine how many colors we can alloc in the + * default colormap. We do this now in order set maxColors to this number, + * to avoid the situation where a larger colormap is used that repeats + * the actually-allocated colormap -- very ugly ... + * + */ +static int GetMaxCmapColors(w) + Widget w; +{ + register int n; + unsigned long plane_masks[1]; + int req; + int first, nelem, maxelem; + Pixel cmap[MAX_SZCMAP]; + Display *dpy; + Colormap colormap; + Visual *visual; + int screen; + + dpy = XtDisplay(w); + screen = XDefaultScreen(dpy); + visual = XDefaultVisual(dpy, screen); + colormap = XDefaultColormap(dpy, screen); + + /* make sure we have the right sort of visual */ + if( (visual->class != PseudoColor) && (visual->class != GrayScale) ) + return(0); + + /* get current colormap specs */ + GtQueryColormap (w, 0, &first, &nelem, &maxelem); + /* try to alloc the max size colormap */ + if ( maxelem > 0) { + req = min(MAX_SZCMAP, maxelem); + for (n=0; req > 0 && n < maxelem; ){ + if (XAllocColorCells (dpy, colormap, + False, plane_masks, 0, &cmap[n], req)) { + n += req; + } else + req /= 2; + } + /* just wondering ... don't really need this */ + XFreeColors (dpy, colormap, cmap, n, 0); +printf ("GetMaxCmapColors returning = %d\n", n); + return(n); + } + else { +printf ("GetMaxCmapColors returning = 0\n"); + return(0); + } +} + +static int GetGlobalColors() +{ +printf ("GetGlobalColors returning = %d\n", global_ncolors); + return(global_ncolors); +} + +static void SetGlobalColors(n) + int n; +{ + global_ncolors = n; +} + + + + + + +static char *dbg_wSize (GtermWidget w) +{ + static char b[32]; + + bzero (b, 32); + sprintf (b, "%dx%dx%d", w->core.width, w->core.height, w->core.depth); + return (b); +} + + +static char *dbg_visStr (int class) +{ + switch (class) { + case StaticGray: return ( "StaticGray" ); + case StaticColor: return ( "StaticColor" ); + case GrayScale: return ( "GrayScale" ); + case PseudoColor: return ( "PseudoColor" ); + case TrueColor: return ( "TrueColor" ); + default: return ( "unknown" ); + } +} + diff --git a/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c.ORIG b/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c.ORIG new file mode 100644 index 00000000..981f0d61 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.c.ORIG @@ -0,0 +1,11897 @@ +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/XawInit.h> +#include "GtermP.h" + +/* + * Gterm -- Graphics terminal widget. This widget implements only the + * window specific graphics output and graphics window input functions. + * Protocol translation (e.g. Tek emulation) and i/o is done elsewhere; + * see for example gtermio.c. + */ + +#define DefaultAlphaFont 3 +#define DefaultDialogFont 3 +#define DefaultMarkerTextFont 3 +#define ZOOM_TOL 0.0001 + +static Dimension defXDim = DEF_WIDTH; +static Dimension defYDim = DEF_HEIGHT; + +/* Default translations for Gterm window. */ +/* Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) */ + +static char defaultGtermTranslations[] = +"\ + <Btn1Down>: m_create() \n\ + <Btn2Down>: crosshair(on) \n\ + <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() \n\ +"; + +/* Default translations when pointer is over a marker. */ +static char defaultMarkerTranslations[] = +"\ + !Shift <Btn1Motion>: m_rotateResize() \n\ + <Btn1Motion>: m_moveResize() \n\ + !Shift <Btn1Down>: m_raise() m_markpos() \n\ + <Btn1Down>: m_raise() m_markposAdd() \n\ + <Btn1Up>: m_redraw() m_destroyNull() \n\ + <Btn2Down>: m_lower() \n\ + <Key>BackSpace: m_deleteDestroy() \n\ + <Key>Delete: m_deleteDestroy() \n\ + <KeyPress>: m_input() \n\ + <Motion>: track-cursor() \n\ +"; + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defXDim}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defYDim}, + + {XtNalphaFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont1), XtRString, "nil2"}, + {XtNalphaFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont2), XtRString, "5x8"}, + {XtNalphaFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont3), XtRString, "6x10"}, + {XtNalphaFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont4), XtRString, "7x13"}, + {XtNalphaFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont5), XtRString, "8x13"}, + {XtNalphaFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont6), XtRString, "9x15"}, + {XtNalphaFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont7), XtRString, "9x15"}, + {XtNalphaFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont8), XtRString, "9x15"}, + + {XtNdialogFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont1), XtRString, "nil2"}, + {XtNdialogFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont2), XtRString, "5x8"}, + {XtNdialogFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont3), XtRString, "6x13"}, + {XtNdialogFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont4), XtRString, "7x13"}, + {XtNdialogFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont5), XtRString, "8x13"}, + {XtNdialogFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont6), XtRString, "9x15"}, + {XtNdialogFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont7), XtRString, "9x15"}, + {XtNdialogFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont8), XtRString, "9x15"}, + + {XtNdialogBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogBgColor), XtRString, "yellow"}, + {XtNdialogFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogFgColor), XtRString, "black"}, + {XtNidleCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorBgColor), XtRString, "white"}, + {XtNidleCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorFgColor), XtRString, "black"}, + {XtNbusyCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorBgColor), XtRString, "white"}, + {XtNbusyCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorFgColor), XtRString, "black"}, + {XtNginmodeCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColor), XtRString, "black"}, + {XtNginmodeCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColor), XtRString, "white"}, + {XtNginmodeBlinkInterval, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.ginmodeBlinkInterval), XtRImmediate, 0}, + {XtNcrosshairCursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.crosshairCursorColor), XtRString, "red"}, + + {XtNidleCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursor), XtRString, "plus"}, + {XtNbusyCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursor), XtRString, "watch"}, + {XtNginmodeCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursor), XtRString, "full_crosshair"}, + {XtNwarpCursor, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.warpCursor), XtRImmediate, + (caddr_t)DEF_WARPCURSOR}, + {XtNraiseWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.raiseWindow), XtRImmediate, + (caddr_t)DEF_RAISEWINDOW}, + {XtNdeiconifyWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.deiconifyWindow), XtRImmediate, + (caddr_t)DEF_DEICONIFYWINDOW}, + {XtNuseTimers, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useTimers), XtRImmediate, + (caddr_t)DEF_USETIMERS}, + + {XtNcolor0, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color0), XtRString, "black"}, + {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color1), XtRString, "white"}, + {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color2), XtRString, "red"}, + {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color3), XtRString, "green"}, + {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color4), XtRString, "blue"}, + {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color5), XtRString, "cyan"}, + {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color6), XtRString, "yellow"}, + {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color7), XtRString, "magenta"}, + {XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color8), XtRString, "purple"}, + {XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color9), XtRString, "darkslategray"}, + + {XtNcopyOnResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.copyOnResize), XtRImmediate, + (caddr_t)DEF_COPYONRESIZE}, + {XtNcmapName, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cmapName), XtRImmediate, + (caddr_t)"default"}, + {XtNcmapInitialize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInitialize), XtRImmediate, + (caddr_t)FALSE}, + {XtNbasePixel, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.base_pixel), XtRImmediate, + (caddr_t)DEF_BASEPIXEL}, + {XtNcmapUpdate, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapUpdate), XtRImmediate, + (caddr_t)DEF_CMAPUPDATE}, + {XtNcmapShadow, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapShadow), XtRImmediate, + (caddr_t)DEF_CMAPSHADOW}, + {XtNcmapInterpolate, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInterpolate), XtRImmediate, + (caddr_t)True}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cacheRasters), XtRImmediate, + (caddr_t)"whenNeeded"}, + {XtNmaxRasters, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxRasters), XtRImmediate, + (caddr_t)MAX_RASTERS}, + {XtNmaxMappings, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxMappings), XtRImmediate, + (caddr_t)MAX_MAPPINGS}, + {XtNmaxColors, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxColors), XtRImmediate, + (caddr_t)DEF_MAXCOLORS}, + + {XtNmarkerTranslations, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_translations), XtRImmediate, + (caddr_t)defaultMarkerTranslations}, + {XtNdefaultMarker, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_defaultMarker), XtRImmediate, + (caddr_t)"rectangle"}, + {XtNnearEdge, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearEdge), XtRImmediate, + (caddr_t)E_DIST}, + {XtNnearVertex, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearVertex), XtRImmediate, + (caddr_t)V_DIST}, + + {XtNmarkerLineWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineWidth), XtRImmediate, + (caddr_t)1}, + {XtNmarkerLineStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineStyle), XtRImmediate, + (caddr_t)LineSolid}, + {XtNmarkerFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_fill), XtRImmediate, + (caddr_t)False}, + {XtNmarkerFillColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillColor), XtRString, + "SlateGray"}, + {XtNmarkerFillBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillBgColor), XtRString, + "black"}, + {XtNmarkerFillStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_fillStyle), XtRImmediate, + (caddr_t)FillSolid}, + {XtNxorFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_xorFill), XtRImmediate, + (caddr_t)False}, + {XtNxorFillColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillColor), XtRImmediate, + (caddr_t)2}, + {XtNxorFillBgColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillBgColor), XtRImmediate, + (caddr_t)255}, + {XtNmarkerHighlightWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_highlightWidth), XtRImmediate, + (caddr_t)2}, + {XtNmarkerHighlightColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_highlightColor), XtRString, + "green"}, + {XtNmarkerCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorFgColor), XtRString, + "yellow"}, + {XtNmarkerCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorBgColor), XtRString, + "black"}, + + {XtNmarkerLineLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineLineColor), XtRString, + "green"}, + {XtNmarkerLineKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineKnotColor), XtRString, + "blue"}, + {XtNmarkerLineKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_LineKnotSize), XtRImmediate, + (caddr_t)5}, + + {XtNmarkerTextLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextLineColor), XtRString, + "green"}, + {XtNmarkerTextColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextColor), XtRString, + "yellow"}, + {XtNmarkerTextBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextBgColor), XtRString, + "SlateGray"}, + {XtNmarkerTextBorder, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_TextBorder), XtRImmediate, + (caddr_t)2}, + {XtNmarkerTextFont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.gm_TextFont), XtRString, + "6x13"}, + {XtNmarkerTextString, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextString), XtRImmediate, + (caddr_t)NULL}, + + {XtNmarkerRectLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectLineColor), XtRString, + "green"}, + {XtNmarkerRectKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectKnotColor), XtRString, + "blue"}, + {XtNmarkerRectKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_RectKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerBoxLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxLineColor), XtRString, + "green"}, + {XtNmarkerBoxKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxKnotColor), XtRString, + "blue"}, + {XtNmarkerBoxKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_BoxKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerCircleLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleLineColor), XtRString, + "green"}, + {XtNmarkerCircleKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleKnotColor), XtRString, + "blue"}, + {XtNmarkerCircleKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_CircleKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerEllipseLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseLineColor), XtRString, + "green"}, + {XtNmarkerEllipseKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColor), XtRString, + "blue"}, + {XtNmarkerEllipseKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_EllipseKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerPgonLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonLineColor), XtRString, + "green"}, + {XtNmarkerPgonKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonKnotColor), XtRString, + "blue"}, + {XtNmarkerPgonKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_PgonKnotSize), XtRImmediate, + (caddr_t)5}, +}; + +/* extern void HandlePopupMenu(); */ +static Boolean SetValues(); +static void Initialize(), Realize(), Destroy(), Redisplay(), Resize(); +static void HandleIgnore(), HandleGraphicsInput(), HandleDisplayCrosshair(); +static void HandleSoftReset(), HandleGraphicsContext(); +static void HandleEnterWindow(), HandleLeaveWindow(); +static void color_crosshair(), color_ginmodeCursor(); +static void HandleTrackCursor(); +static void savepos(), blink_cursor(); +static void mp_linkafter(), mp_unlink(); + +Marker GmSelect(); +static void M_create(), GtMarkerFree(); +static void gm_focusin(), gm_focusout(), gm_refocus(); +static void gm_request_translations(), gm_load_translations(); +static int gm_curpos(); + +static set_default_color_index(); +static inherit_default_colormap(); +static update_default_colormap(); +static update_transients(), update_cursor(); +static request_colormap_focus(), restore_colormap_focus(); +static refresh_source(), refresh_destination(), get_regions(); +static get_rects(), scale_zoom(), scale_intzoom(), scale_boxcar(); +static lw_convolve(), bx_boxcar(), bx_extract(), bx_interp(); +static mf_getpixel(), mf_getinten(); +static scale_lowpass(), scale_nearest(), scale_bilinear(); +static save_mapping(), load_mapping(), get_pixel_mapping(); +static update_mapping(), free_mapping(), valid_mapping(), rect_intersect(); +static initialize_mapping(), draw_crosshair(), erase_crosshair(); +static DrawContext get_draw_context(); +static invalidate_draw_context(); +static XPoint *mapVector(); +static Colormap get_colormap(); +static Cursor get_cursor(); +static void init_iomap(), invalidate_cmap(); +static Pixel get_pixel(), *get_cmap_in(), *get_cmap_out(); + +extern double atof(); + +static XtActionsRec gtermActionsList[] = { + { "ignore", HandleIgnore }, + { "graphics-input", HandleGraphicsInput }, + { "crosshair", HandleDisplayCrosshair }, + { "track-cursor", HandleTrackCursor }, + { "enter-window", HandleEnterWindow }, + { "leave-window", HandleLeaveWindow }, +/* { "popup-menu", HandlePopupMenu }, */ + { "reset", HandleSoftReset }, + { "m_create", M_create }, +}; + +GtermClassRec gtermClassRec = { + { /* core fields */ + /* superclass */ &widgetClassRec, + /* class_name */ "Gterm", + /* widget_size */ sizeof(GtermRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ gtermActionsList, + /* num_actions */ XtNumber(gtermActionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ (XrmClass)NULL, + /* compress_motion */ True, + /* compress_exposure */ True, + /* compress_enterleave */ True, + /* visible_interest */ False, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultGtermTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass gtermWidgetClass = (WidgetClass) &gtermClassRec; +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +/* + * Widget class procedures. + * -------------------------- + */ + +/* ARGSUSED */ +static void +Initialize (request, new) + Widget request, new; +{ + register GtermWidget w = (GtermWidget)new; + register GC gc; + + XColor fg_color, bg_color; + XFontStruct **fp; + Font cursor_font; + Display *display; + Screen *screen; + Pixel *pp; + int i; + + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + w->gterm.display = display = XtDisplay (w); + w->gterm.screen = screen = XtScreen (w); + w->gterm.root = RootWindowOfScreen (screen); + XtVaSetValues ((Widget)w, XtNbackground, (XtArgVal)w->gterm.color0, NULL); + + /* Initialize color map. */ + pp = &w->gterm.color0; + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors (display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + w->gterm.useDefaultCM = (strcmp (w->gterm.cmapName, "default") == 0); + w->gterm.haveColormap = w->gterm.useDefaultCM; + w->gterm.cmapLastUpdate = 0; + w->gterm.cmapLastShadow = 0; + w->gterm.in_window = 0; + + /* Get clear pixmap GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color0); + w->gterm.clearGC = gc; + + /* Get expose GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + w->gterm.exposeGC = gc; + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.dialogBgColor); + XSetForeground (display, gc, w->gterm.dialogFgColor); + /* XSetFunction (display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + /* Get special cursors. */ + bg_color.pixel = w->gterm.idleCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.idleCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.idle_cursor = get_cursor (w, w->gterm.idleCursor); + XRecolorCursor (display, w->gterm.idle_cursor, &fg_color, &bg_color); + + bg_color.pixel = w->gterm.busyCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.busyCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.busy_cursor = get_cursor (w, w->gterm.busyCursor); + XRecolorCursor (display, w->gterm.busy_cursor, &fg_color, &bg_color); + + bg_color.pixel = w->gterm.color0; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, w->core.colormap, &fg_color); + cursor_font = XLoadFont (display, "cursor"); + w->gterm.crosshair_cursor = XCreateGlyphCursor (display, + cursor_font, cursor_font, XC_crosshair, XC_crosshair, + &fg_color, &bg_color); + + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + if (strcmp (w->gterm.ginmodeCursor, "full_crosshair") != 0) { + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + XRecolorCursor (display, + w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + } else + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, "full_crosshair") == 0); + + /* Make sure we have all the fonts we need. */ + for (fp = &w->gterm.alphaFont1, i=0; i < NAlphaFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.alpha_fonts[i] = *fp; + } + for (fp = &w->gterm.dialogFont1, i=0; i < NDialogFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.dialog_fonts[i] = *fp; + } + + /* Raster initialization. */ + w->gterm.rasters = NULL; + w->gterm.nrasters = 0; + w->gterm.mappings = NULL; + w->gterm.nmappings = 0; + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + w->gterm.colormaps = NULL; + w->gterm.wa_defined = 0; + memset ((char *)&w->gterm.draw, 0, sizeof (struct drawContext)); + + /* Marker initialization. */ + w->gterm.gm_head = NULL; + w->gterm.gm_tail = NULL; + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.defTranslations = NULL; + w->gterm.nauxTrans = 0; + w->gterm.gm_defTranslations = NULL; + w->gterm.gm_curTranslations = NULL; + w->gterm.gm_reqTranslations = NULL; + w->gterm.gm_timer_id = (XtIntervalId) NULL; + w->gterm.gm_initialized = False; + + /* Set defaults (some of these are clobbered anyway by Realize/Resize). */ + w->gterm.raster = 0; + w->gterm.cur_x = 0; + w->gterm.cur_y = 0; + w->gterm.last_x = 0; + w->gterm.last_y = 0; + w->gterm.cursor_drawn = 0; + w->gterm.cursor_type = GtIdleCursor; + w->gterm.pixmap = (Pixmap)NULL; + w->gterm.d_pixmap = (Pixmap)NULL; + w->gterm.preserve_screen = 0; + w->gterm.preserve_valid = 0; + w->gterm.d_saved = 0; + w->gterm.alpha_font = DefaultAlphaFont; + w->gterm.dialog_font = DefaultDialogFont; + w->gterm.optcols = 80; + w->gterm.optrows = 35; + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + set_default_color_index (w); + + /* Disable input until window is ready. */ + w->gterm.delay = 1; +} + +static void +Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + GtermWidget w = (GtermWidget) gw; + XVisualInfo rvinfo, *vinfo = (XVisualInfo *) NULL; + Visual *ourVisual = (Visual *) NULL; + int i, nvis; + + /* Set default window size. */ + XtMakeResizeRequest (gw, w->core.width, w->core.height, + &w->core.width, &w->core.height); + + /* Should define pseudocolor visual here, if truecolor or directcolor + * default visual. + */ + + /* Create graphics window. We first look for an 8-Bit PseudoColor + * visual to use, otherwise we fail. (MJF 8/22/97) + XtCreateWindow (gw, InputOutput, (Visual *)CopyFromParent, + *valueMask, attrs); + */ + vinfo = XGetVisualInfo (w->gterm.display, 0L, &rvinfo, &nvis); + for (i=0; i < nvis; i++) + if (vinfo[i].depth == 8 && vinfo[i].class == PseudoColor) + ourVisual = vinfo[i].visual; + if (ourVisual) + XtCreateWindow (gw, InputOutput, ourVisual, *valueMask, attrs); + else { + fprintf (stderr, "No 8-bit PseudoColor visual found.\n"); + exit(1); + } + + w->gterm.window = XtWindow (gw); + w->gterm.old_width = w->gterm.xres = w->core.width; + w->gterm.old_height = w->gterm.yres = w->core.height; + + GtRasterInit (w); + GtMarkerInit (w); + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = w->gterm.idle_cursor); + + Resize (gw); +} + +static void +Destroy (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb, *cb_next; + Display *display = w->gterm.display; + + /* Get rid of any raster stuff. */ + GtRasterInit (gw); + XtFree ((char *)w->gterm.rasters); + XtFree ((char *)w->gterm.mappings); + + /* Destroy any markers. */ + GtMarkerFree (w); + + /* Can't use XtDestroyGC here; the source says it is broken and will + * work only for applications that have only 1 display, and we have 2. + * Also the documentation in Asente&Swick documents the calling sequence + * incorrectly. + */ + XFreeGC (display, w->gterm.clearGC); + XFreeGC (display, w->gterm.exposeGC); + XFreeGC (display, w->gterm.drawGC); + XFreeGC (display, w->gterm.dialogGC); + XFreeGC (display, w->gterm.cursorGC); + + /* This one also proves problematic. When there are multiple gterm + * widgets allocating the same cursor, succeeding calls for the same + * cursor return the same cursor ID. When these widgets are later + * destroyed, the first XFreeCursor succeeds but subsequent ones find + * the referenced cursor undefined and the application boms with a + * BadCursor error. This must be some problem with reference counts + * in the X server. Cursors use minor amounts of resources and they + * will probably be freed anyway when the display is closed, so we just + * leave them defined here. + * + XFreeCursor (display, w->gterm.idle_cursor); + XFreeCursor (display, w->gterm.busy_cursor); + XFreeCursor (display, w->gterm.crosshair_cursor); + if (w->gterm.ginmode_cursor != w->gterm.crosshair_cursor) + XFreeCursor (display, w->gterm.ginmode_cursor); + */ + + if (w->gterm.pixmap) + XFreePixmap (w->gterm.display, w->gterm.pixmap); + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + + /* Destroy callback lists. */ + for (cb = w->gterm.resetCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.resizeCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.inputCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + XtFree (w->gterm.ginmodeCursor); +} + +static void +Resize (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb; + int char_width, char_height, char_base; + int bestfont, fonterr, dx, dy, i; + unsigned int width, height, u_junk; + GtCallback cbl[128]; + XFontStruct *fp; + int ncb, junk; + Pixmap pixmap; + Window root; + + if (!XtIsRealized(gw)) + return; + + /* Create new pixmap. */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width + 1, w->core.height + 1, w->core.depth); + if (pixmap) + XFillRectangle (w->gterm.display, pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + + /* Copy old pixmap into new and free old pixmap. */ + if (w->gterm.pixmap) { + XGetGeometry (w->gterm.display, w->gterm.pixmap, + &root, &junk, &junk, &width, &height, &u_junk, &u_junk); + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.copyOnResize) + XCopyArea (w->gterm.display, w->gterm.pixmap, pixmap, + w->gterm.exposeGC, 0, 0, width-1, height-1, 0, 0); + XFreePixmap (w->gterm.display, w->gterm.pixmap); + } + + /* Install new pixmap. */ + w->gterm.pixmap = pixmap; + w->gterm.preserve_valid = 0; + + /* Redraw window. */ + if (w->gterm.pixmap) { + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, 0, 0, w->core.width, w->core.height, 0, 0); + } + + /* Pick best alpha font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NAlphaFonts; i++) { + fp = w->gterm.alpha_fonts[i]; + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + dx = (((int)w->core.width / char_width) - w->gterm.optcols) * 2; + dy = ((int)w->core.height / char_height) - w->gterm.optrows; + if (abs(dx) + abs(dy) < fonterr) { + bestfont = i; + fonterr = abs(dx) + abs(dy); + } + } + + w->gterm.alpha_font = bestfont; + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + XSetFont (w->gterm.display, w->gterm.drawGC, fp->fid); + + /* Pick best dialog font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NDialogFonts; i++) { + fp = w->gterm.dialog_fonts[i]; + char_width = fp->max_bounds.width; + dx = ((int)w->core.width / char_width) - 80; + if (abs(dx) < fonterr) { + bestfont = i; + fonterr = abs(dx); + } + } + + w->gterm.dialog_font = bestfont; + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + char_base = fp->max_bounds.ascent; + + w->gterm.d_xoff = 2; + w->gterm.d_yoff = w->core.height - char_height - 2; + w->gterm.d_height = char_height; + XSetFont (w->gterm.display, w->gterm.dialogGC, fp->fid); + + /* Create dialog save area pixmap. */ + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + w->gterm.d_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, char_height, w->core.depth); + w->gterm.d_saved = 0; + + /* Adjust cursor position to allow for change in window size. */ + w->gterm.cur_x = w->gterm.cur_x * (int)w->core.width / w->gterm.old_width; + w->gterm.cur_y = w->gterm.cur_y * (int)w->core.height / w->gterm.old_height; + w->gterm.old_width = w->core.width; + w->gterm.old_height = w->core.height; + if (w->gterm.cursor_type == GtGinmodeCursor) { + XWarpPointer (w->gterm.display, w->gterm.window, w->gterm.window, + 0,0,0,0, w->gterm.cur_x, w->gterm.cur_y); + update_cursor (w); + } + + /* Raster descriptor 0 must track the window size. */ + if (w->gterm.rasters) { + Raster rp = &w->gterm.rasters[0]; + rp->width = w->core.width; + rp->height = w->core.height; + } + + /* Mark gterm widget ready for further client input. */ + w->gterm.delay = 0; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resizeCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w); +} + +/* ARGSUSED */ +static void +Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register GtermWidget w = (GtermWidget) gw; + register XExposeEvent *ev = (XExposeEvent *)event; + int x, y, width, height; + + if (!XtIsRealized (gw)) + return; + + if (event) { + x = ev->x; + y = ev->y; + width = ev->width; + height = ev->height; + } else { + x = 0; + y = 0; + width = w->core.width; + height = w->core.height; + } + + if (w->gterm.pixmap) { + /* Clipping with the region argument does not work properly with + * the OpenLook server for some reason - the clip region is one + * pixel too small on the right and bottom. Until the reason for + * this becomes clear, we use the bounding box provided in the + * Expose event to roughly clip the refresh. + * + XSetClipOrigin (w->gterm.display, w->gterm.exposeGC, 0, 0); + XSetRegion (w->gterm.display, w->gterm.exposeGC, region); + */ + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, x, y, width, height, x, y); + } + + update_transients (w, region); + + /* A dummy expose event is used to ensure that the resize delay is + * cleared, in the event that the resize request is not granted. + */ + if (ev && ev->send_event) + w->gterm.delay = 0; +} + +/* ARGSUSED */ +static Boolean +SetValues (current, request, set) + Widget current, request, set; +{ + GtermWidget old = (GtermWidget) current; + GtermWidget req = (GtermWidget) request; + register GtermWidget w = (GtermWidget) set; + Display *display = w->gterm.display; + Boolean redisplay = False; + register GC gc; + + if (old->gterm.dialogBgColor != req->gterm.dialogBgColor) { + gc = w->gterm.dialogGC; + XSetBackground (display, gc, w->gterm.dialogBgColor); + } + if (old->gterm.dialogFgColor != req->gterm.dialogFgColor) { + gc = w->gterm.dialogGC; + XSetForeground (display, gc, w->gterm.dialogFgColor); + } + + if (old->gterm.ginmodeCursor != req->gterm.ginmodeCursor) { + static char *full_crosshair = "full_crosshair"; + + XtFree (old->gterm.ginmodeCursor); + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + + erase_crosshair (w); + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, full_crosshair) == 0); + + if (w->gterm.full_crosshair) { + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + color_crosshair (w); + } else { + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + color_ginmodeCursor (w); + } + + if (w->gterm.cursor_type == GtGinmodeCursor && w->core.visible) + XDefineCursor (display, w->gterm.window, + w->gterm.cursor = w->gterm.ginmode_cursor); + } + + if (old->gterm.crosshairCursorColor != req->gterm.crosshairCursorColor) { + color_crosshair (w); + } + + if (old->gterm.ginmodeCursorBgColor != req->gterm.ginmodeCursorBgColor || + old->gterm.ginmodeCursorFgColor != req->gterm.ginmodeCursorFgColor) { + color_ginmodeCursor (w); + } + + return (XtIsRealized(current) ? redisplay : False); +} + +static void +color_crosshair (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + register GC gc; + + erase_crosshair (w); + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.color0; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, defcmap, &fg_color); + + gc = w->gterm.cursorGC; + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XRecolorCursor (display, w->gterm.crosshair_cursor, &fg_color, &bg_color); + + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + + update_cursor (w); +} + +static void +color_ginmodeCursor (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, defcmap, &fg_color); + + XRecolorCursor (display, w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; +} + +/* + * Action procedures. + * ----------------------- + */ + +/* ARGSUSED */ +static void HandleIgnore (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* ignore an event */ +} + +/* ARGSUSED */ +static void HandleGraphicsInput (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.inputCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, event); +} + +/* ARGSUSED */ +static void HandleDisplayCrosshair (widget, event, params, nparams) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *nparams; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XButtonEvent *ev = &event->xbutton; + + /* Ignore if cursor is in a marker. */ + if (w->gterm.gm_active) + return; + + if (*nparams && strcmp (params[0], "on") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.crosshair_cursor); + draw_crosshair (w, ev->x, ev->y); + } else if (*nparams && strcmp (params[0], "off") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, w->gterm.cursor); + } +} + +/* ARGSUSED */ +static void HandleTrackCursor (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XMotionEvent *ev = &event->xmotion; + gmSelection what; + Marker gm; + + savepos (w, (XEvent *)ev); + + if ((gm = GmSelect (w, ev->x, ev->y, &what))) + gm_focusin (w, gm, &what); + else if (w->gterm.gm_active) + gm_focusout (w, 1); + + if (w->gterm.cursor_type == GtGinmodeCursor) + if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, ev->x, ev->y); + + /* Flushing here keeps cursor tracking synchronous and tends + * to aid motion compression, by preventing crosshair draw + * requests from being queued up for transmission to the + * server. + */ + XFlush (w->gterm.display); + + } else { + w->gterm.cur_x = ev->x; + w->gterm.cur_y = ev->y; + } +} + +/* ARGSUSED */ +static void HandleEnterWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XEnterWindowEvent *ev = (XEnterWindowEvent *) event; + + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int update = w->gterm.cmapUpdate; + + /* To avoid excessive server queries the colormap is only updated + * every so often. Updating is disabled if cmapUpdate is set to zero. + if (update && ev->time - w->gterm.cmapLastUpdate > update * 1000) { + */ + if (update) { + inherit_default_colormap (w); + w->gterm.cmapLastUpdate = ev->time; + } + + /* Advise the window manager to load our colormap. */ + request_colormap_focus (w); + } + + w->gterm.in_window++; +} + +/* ARGSUSED */ +static void HandleLeaveWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XLeaveWindowEvent *ev = (XLeaveWindowEvent *) event; + + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int shadow = w->gterm.cmapShadow; + + /* The shadow option matches unused cells in the default colormap + * with the colors in our custom colormap. + if (shadow && ev->time - w->gterm.cmapLastShadow > shadow * 1000) { + */ + if (shadow) { + update_default_colormap (w); + w->gterm.cmapLastShadow = ev->time; + } + + restore_colormap_focus (w); + } + + w->gterm.in_window = 0; +} + +/* ARGSUSED */ +static void HandleSoftReset (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + GtReset (w); + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resetCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, NULL); +} + + +/* + * GRAPHICS routines (public functions). + * -------------------------------------- + */ + +GtActivate (w) + GtermWidget w; +{ + w->gterm.interactive = 0; + w->gterm.save_x = w->gterm.save_y = 0; +} + +GtDeactivate (w) + GtermWidget w; +{ + Display *display = w->gterm.display; + Window window = w->gterm.window; + + if (w->gterm.interactive) { + if (w->gterm.save_x > 0 && w->gterm.save_y > 0) { + if (w->gterm.warpCursor) { + /* Workaround X server bug. */ + if (w->gterm.root != w->gterm.save_root) + XWarpPointer (display,None,w->gterm.root, 0,0,0,0, + WidthOfScreen(w->gterm.screen) - 1, + HeightOfScreen(w->gterm.screen) - 1); + + /* Move pointer to saved position. */ + XWarpPointer (display, None, w->gterm.save_root, + 0,0,0,0, w->gterm.save_x, w->gterm.save_y); + } + w->gterm.save_x = 0; + w->gterm.save_y = 0; + } + w->gterm.interactive = 0; + } +} + +GtReady (w) + GtermWidget w; +{ + return (w->gterm.delay == 0); +} + +GtReset (w) + GtermWidget w; +{ + invalidate_draw_context (w); + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapButt, JoinMiter); + + /* Set defaults. */ + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.raster = 0; +} + +GtTimerInhibit (w, state) + GtermWidget w; + Boolean state; +{ + /* This is a kludge to allow a client (xgterm) to disable use of timers + * if they don't work in a given implementation. + */ + w->gterm.useTimers = !state; +} + +GtAugmentTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_augment; + w->gterm.nauxTrans++; + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtOverrideTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_override; + w->gterm.nauxTrans++; + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtFlush (w) + GtermWidget w; +{ + XFlush (w->gterm.display); +} + +GtSetLogRes (w, width, height) + GtermWidget w; + int width, height; +{ + w->gterm.xres = width; + w->gterm.yres = height; +} + +GtGetLogRes (w, width, height) + GtermWidget w; + int *width, *height; +{ + *width = w->gterm.xres; + *height = w->gterm.yres; +} + +GtGetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; /* zero for screen size */ + int *width, *height; +{ + if (raster) { + register Raster rp = &w->gterm.rasters[raster]; + *width = rp->width; + *height = rp->height; + } else { + *width = w->core.width; + *height = w->core.height; + } +} + +GtSetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; + int width, height; +{ + GtCreateRaster (w, raster, GtServer, width, height, RasterDepth); +} + +GtSetRaster (w, raster) + GtermWidget w; + int raster; +{ + if (raster >= 0 && raster < w->gterm.maxRasters) { + w->gterm.raster = raster; + invalidate_draw_context (w); + } +} + +GtGetRaster (w) + GtermWidget w; +{ + return (w->gterm.raster); +} + +/* ARGSUSED */ +GtSetTextRes (w, optrows, optcols) + GtermWidget w; + int optrows, optcols; +{ + w->gterm.optrows = optrows; + w->gterm.optcols = optcols; +} + +/* ARGSUSED */ +GtSetCharSize (w, ival) + GtermWidget w; + int ival; +{ +} + +GtSetDataLevel (w, ival) + GtermWidget w; + int ival; +{ + invalidate_draw_context (w); + + switch (ival) { + case GtSet: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[w->gterm.color_index]); + w->gterm.data_level = ival; + break; + case GtClear: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color0); + w->gterm.data_level = ival; + break; + case GtInvert: + /* This probably won't work correctly but leave it for now... */ + XSetFunction (w->gterm.display, w->gterm.drawGC, GXxor); + w->gterm.data_level = ival; + break; + } +} + + +GtSetLineWidth (w, ival) + GtermWidget w; + int ival; +{ + w->gterm.line_width = ival; + GtSetLineStyle (w, w->gterm.line_style); +} + +#define Dashed "\010\003" +#define Dotted "\002\003" +#define DashDot "\016\003\001\003" +#define Dash3Dot "\024\003\001\003\001\003\001\003" + +GtSetLineStyle (w, ival) + GtermWidget w; + int ival; +{ + int line_width = w->gterm.line_width; + int line_style = LineSolid; + int cap_style = CapButt; + int join_style = JoinMiter; + int dash_offset = 0; + char *dash_list = NULL; + int dash_list_length = 0; + + switch (ival) { + case GtSolid: + w->gterm.line_style = ival; + break; + case GtDashed: + line_style = LineOnOffDash; + dash_list = (char *)Dashed; + dash_list_length = strlen(Dashed); + w->gterm.line_style = ival; + break; + case GtDotted: + line_style = LineOnOffDash; + dash_list = (char *)Dotted; + dash_list_length = strlen(Dotted); + w->gterm.line_style = ival; + break; + case GtDashDot: + line_style = LineOnOffDash; + dash_list = (char *)DashDot; + dash_list_length = strlen(DashDot); + w->gterm.line_style = ival; + break; + case GtDash3Dot: + line_style = LineOnOffDash; + dash_list = (char *)Dash3Dot; + dash_list_length = strlen(Dash3Dot); + w->gterm.line_style = ival; + break; + } + + if (dash_list_length) + XSetDashes (w->gterm.display, w->gterm.drawGC, dash_offset, dash_list, + dash_list_length); + + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, line_width, line_style, cap_style, join_style); + + invalidate_draw_context (w); +} + +GtSetColorIndex (w, ival) + GtermWidget w; + int ival; +{ + register int color = w->gterm.iomap[ival]; + + if (color >= 0 && color < w->gterm.ncolors) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[color]); + w->gterm.color_index = color; + invalidate_draw_context (w); + } +} + +GtSetFillType (w, ival) + GtermWidget w; + int ival; +{ + switch (ival) { + case GtSolid: + case GtOutline: + w->gterm.fill_type = ival; + break; + } +} + +GtClearScreen (w) +GtermWidget w; +{ + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) + XFillRectangle (w->gterm.display, w->gterm.pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + XClearWindow (w->gterm.display, w->gterm.window); + + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color1); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapRound, JoinRound); + + w->gterm.line_width = 1; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.data_level = GtSet; + w->gterm.preserve_valid = 0; + w->gterm.gm_redisplay = 1; + w->gterm.d_saved = 0; + + /* Mark any screen mappings to be unconditionally refreshed. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp->enabled && mp->dst == 0) + mp->refresh++; + + invalidate_draw_context (w); + update_transients (w, NULL); +} + +GtDrawPolyline (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolymarker (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawPoints (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawPoints (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolygon (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + if (w->gterm.fill_type == GtOutline) { + /* Draw outline of region. + */ + int first = 0; + int last = npts - 1; + + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + + if (points[last].x != points[first].x || + points[last].y != points[first].y) { + + if (mx->use_backing_store) + XDrawLine (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + XDrawLine (w->gterm.display, mx->pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + } + } else { + /* Fill the outlined area. + */ + if (mx->use_backing_store) { + XFillPolygon (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + XFillPolygon (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + } + + update_transients (w, (Region)NULL); +} + +GtDrawMarker (w, x, y, xsize, ysize, type) + GtermWidget w; + int x, y; + int xsize, ysize; + int type; +{ +} + +GtBell (w) + GtermWidget w; +{ + XBell (w->gterm.display, 0); +} + + +/* GtSetCursorPos -- Set the cursor position to the given coordinates X,Y. + * Coordinates are specified in the current graphics coordinate system, + * defined by the current raster and logical resolution. + * + * This routine is a little more complex than one might think due to the + * complication of mappings. Screen coordinates are required to set the + * cursor, but the graphics drawing context may be defined relative to + * any raster. In the general case a graphics pipeline defines the series + * of coordinate transformations required to transform from graphics + * coordinates to screen coordinates. Things are further complicated since + * the pipeline or desired position may not map to the screen, or there + * may be multiple mappings to the screen. The first case (no mapping to + * the screen) is dealt with by ignoring the request to warp the cursor. + * The second case (one-to-many mapping) is dealt with by a heuristic: + * the most recent screen coordinates are unmapped back to the raster we + * are "drawing" into, defining a unique path through the mappings which + * we can use to map back to the screen. + * + * The simplest case occurs when we are drawing directly into the screen. + * In this case (raster=0) there may still be a logical to physical + * coordinate transformation, but there are no mappings to complicate things. + */ +GtSetCursorPos (w, x, y) + GtermWidget w; + int x, y; +{ + register MappingContext mx; + register DrawContext dx; + register Mapping mp; + + Window window = w->gterm.window; + int sv_raster = w->gterm.raster; + int sv_xres = w->gterm.xres, sv_yres = w->gterm.yres; + int rasters[256], mappings[256], nmap=0, ntrans=0; + int rx, ry, src, dst, map, i, npts = 1; + int raster = w->gterm.raster; + XPoint pv1[1], pv2[2]; + XPoint *points, pv[1]; + Raster rp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Follow the current cursor position back to the source raster if + * possible. This gives us a default pipeline to follow in the reverse + * direction to map raster coordinates to screen coordinates, and is + * necessary to find the right mappings when multiple mappings are + * defined on a single source. + */ + rx = w->gterm.last_x; + ry = w->gterm.last_y; + src = 0; + do { + src = GtSelectRaster (w, dst=src, GtPixel,rx,ry, GtPixel,&rx,&ry,&map); + if (src != dst) { + rasters[nmap] = src; + mappings[nmap++] = map; + } + } while (src != dst && src != raster); + + /* Ray trace the point through all of the mappings to the screen. + * This isn't fully general, but gives us the capability to follow + * most graphics pipelines to a point on the screen. + */ + do { + GtSetRaster (w, raster); + if (ntrans++) { + /* After the first transformation we have raster coordinates, + * so set the logical resolution to the raster dimensions. + */ + rp = &w->gterm.rasters[raster]; + GtSetLogRes (w, rp->width, rp->height); + } + + dx = get_draw_context (w); + if (!dx->nmappings) + return; + + /* Try to find the next mapping. */ + if (nmap && rasters[nmap-1] == raster) + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->mapping == mappings[nmap-1]) { + mp = mx->mp; + nmap--; + goto havemap; + } + } + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + mp = mx->mp; + if (mp && mp->dst == 0) + break; + } + if (i >= dx->nmappings) { + mx = &dx->mapContext[0]; + mp = mx->mp; + } + +havemap: + rp = &w->gterm.rasters[mp ? mp->dst : raster]; + + /* Compute the coordinates points[0].{x,y} of the point x,y in the + * destination raster. + */ + if (mx->scale) { + /* Scaling is in effect. The following subterfuge is used to + * compute the coordinates of the center of the raster pixel (x,y) + * when the image is zoomed. We want to set the cursor to the + * center of the selected pixel, not the edge. + */ + pv[0].x = x; pv[0].y = y; + mapVector (mx, pv, pv1, npts); + pv[0].x = x + 1; pv[0].y = y + 1; + mapVector (mx, pv, pv2, npts); + + pv[0].x = (pv1[0].x + pv2[0].x) / 2.0; + pv[0].y = (pv1[0].y + pv2[0].y) / 2.0; + points = pv; + + } else { + /* No scaling. */ + pv[0].x = x; pv[0].y = y; + points = pv; + } + + /* Clip to the bounds of the destination raster and generate the + * new x,y. + */ + x = max(0, min(rp->width-1, points[0].x)); + y = max(0, min(rp->height-1, points[0].y)); + + } while (mp && (raster = mp->dst)); + + XWarpPointer (w->gterm.display, window, window, 0,0,0,0, x,y); + + w->gterm.last_x = w->gterm.cur_x = x; + w->gterm.last_y = w->gterm.cur_y = y; + + GtSetRaster (w, sv_raster); + GtSetLogRes (w, sv_xres, sv_yres); +} + + +GtGetCursorPos (w, x, y) + GtermWidget w; + int *x, *y; +{ + *x = w->gterm.last_x; + *y = w->gterm.last_y; +} + +GtSetCursorType (w, type) + GtermWidget w; + int type; +{ + static XtIntervalId id = (XtIntervalId) NULL; + Display *display = w->gterm.display; + Cursor cursor; + int interval; + Widget pw; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.cursor_type == type) + return; + + switch (w->gterm.cursor_type = type) { + case GtNoCursor: + case GtIdleCursor: + erase_crosshair (w); + cursor = w->gterm.idle_cursor; + break; + + case GtGinmodeCursor: + /* Begin graphics cursor mode. + */ + + /* If a screen clear or drawing operation has caused the redisplay + * flag to be set, redisplay any marker overlays. + */ + if (w->gterm.gm_redisplay) { + GmRedisplay (w, (Region)NULL); + w->gterm.gm_redisplay = False; + } + + /* Make sure the window is visible. + */ + if (w->gterm.raiseWindow || w->gterm.deiconifyWindow) + for (pw = (Widget)w; pw; pw = XtParent(pw)) + if (XtIsShell(pw)) { + if (w->gterm.deiconifyWindow) + XMapWindow (display, XtWindow(pw)); + if (w->gterm.raiseWindow) + XRaiseWindow (display, XtWindow(pw)); + } + + /* The first time this is done after a GtActivate causes the cursor + * to be warped into the graphics window. The interactive flag is set + * to cause GtDeactivate to restore the cursor to its original position + * after the graphics interaction finishes. + */ + if (w->gterm.warpCursor) { + int root_x, root_y, win_x, win_y; + int xoff, yoff, width, height, x, y; + Window gtermwin, root, child; + unsigned int keys; + int in_window = 0; + + width = w->core.width; + height = w->core.height; + gtermwin = w->gterm.window; + XTranslateCoordinates (display, gtermwin, w->gterm.root, + w->core.x, w->core.y, &xoff, &yoff, &child); + + if (XQueryPointer (display, w->gterm.root, &root, &child, + &root_x, &root_y, &win_x, &win_y, &keys)) { + + /* Already in gterm window? */ + if ((root_x >= xoff && root_x < xoff+width) && + (root_y >= yoff && root_y < yoff+height)) { + + if (!w->gterm.interactive) { + w->gterm.save_x = 0; + w->gterm.save_y = 0; + w->gterm.interactive++; + } + x = root_x - xoff; y = root_y - yoff; + in_window++; + + } else { + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + } else { + /* Pointer not on the current screen. + */ + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + + if ((x < 5 || x > width-5) || (y < 5 || y > height-5)) { + x = width / 2; + y = height / 2; + } + + if (!in_window) { + erase_crosshair (w); + if (w->gterm.warpCursor) { + XWindowAttributes wa; + if (XGetWindowAttributes (display, gtermwin, &wa) && + wa.map_state == IsViewable) { + + /* The following should not be necessary but is needed + * to workaround an X server bug. When warping to a + * different screen the pointer is not erased on the + * old screen. It is hard to erase it, but we can + * at least move it to the corner of the screen. + */ + if (root != w->gterm.root) { + Screen *screen = w->gterm.screen; + if (XGetWindowAttributes (display, root, &wa)) + screen = wa.screen; + XWarpPointer (display,None,root, 0,0,0,0, + WidthOfScreen(screen) - 1, + HeightOfScreen(screen) - 1); + } + + /* Now warp into the gterm window. */ + XWarpPointer (display, None, gtermwin, 0,0,0,0, x,y); + } + if (w->gterm.full_crosshair) + draw_crosshair (w, x, y); + } + + } else if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, x, y); + } + } else + update_cursor (w); + + cursor = w->gterm.ginmode_cursor; + if (interval = w->gterm.ginmodeBlinkInterval) { + XtAppContext appcon = XtWidgetToApplicationContext ((Widget) w); + id = XtAppAddTimeOut (appcon, + interval, blink_cursor, (XtPointer)w); + } else + id = (XtIntervalId) NULL; + break; + + case GtBusyCursor: + /* Exit graphics cursor mode. + */ + erase_crosshair (w); + cursor = w->gterm.busy_cursor; + break; + } + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = cursor); + if (id && w->gterm.cursor_type != GtGinmodeCursor) { + XtRemoveTimeOut (id); + id = (XtIntervalId) NULL; + } +} + +static void +blink_cursor (w, id) + GtermWidget w; + XtIntervalId *id; +{ + XtAppContext app_context; + XColor bg, fg; + int interval; + + bg = w->gterm.ginmodeColors[1]; + fg = w->gterm.ginmodeColors[0]; + + app_context = XtWidgetToApplicationContext ((Widget) w); + XRecolorCursor (w->gterm.display, w->gterm.ginmode_cursor, &fg, &bg); + XFlush (w->gterm.display); + + w->gterm.ginmodeColors[0] = bg; + w->gterm.ginmodeColors[1] = fg; + + if (interval = w->gterm.ginmodeBlinkInterval) + XtAppAddTimeOut (app_context, + interval, (XtTimerCallbackProc) blink_cursor, (XtPointer)w); +} + +GtPostInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.inputCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.inputCallback = new; +} + +GtDeleteInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.inputCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.inputCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resetCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resetCallback = new; +} + +GtDeleteResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resetCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resetCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resizeCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resizeCallback = new; +} + +GtDeleteResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resizeCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resizeCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtDrawAlphaText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + XPoint *points, pv[1], o_pv[1]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int npts, i; + + pv[0].x = x; + pv[0].y = y; + npts = 1; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + x = points[0].x; y = points[0].y; + + if (mx->use_backing_store) + XDrawString (w->gterm.display, w->gterm.pixmap, + mx->drawGC, x, y, text, strlen(text)); + XDrawString (w->gterm.display, mx->pixmap, + mx->drawGC, x, y, text, strlen(text)); + } + + update_transients (w, (Region)NULL); +} + +GtGetAlphaTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + +GtWriteAlphaCursor (w, x, y) + GtermWidget w; + int x, y; +{ +} + +GtEraseAlphaCursor (w) + GtermWidget w; +{ +} + +GtStartDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap) + if (w->gterm.d_saved) { + GtEraseDialog (w); + } else { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.pixmap ? w->gterm.pixmap : w->gterm.window, + w->gterm.d_pixmap, w->gterm.exposeGC, + 0, w->gterm.d_yoff, w->core.width, w->gterm.d_height, 0, 0); + w->gterm.d_saved = 1; + } +} + +GtEndDialog (w) + GtermWidget w; +{ + GtEraseDialog (w); + w->gterm.d_saved = 0; +} + +GtEraseDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap && w->gterm.d_saved) { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.window, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + if (w->gterm.pixmap) + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.pixmap, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + update_transients (w, (Region)NULL); + } +} + +GtDrawDialogText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + int xpos = w->gterm.d_xoff + x; + int ypos = w->gterm.d_yoff + y; + + if (w->gterm.pixmap) + XDrawImageString (w->gterm.display, w->gterm.pixmap, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); +} + +GtGetDialogTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + + +/* + * Internal functions for above code. + * ---------------------------------------- + */ + +static +set_default_color_index (w) + GtermWidget w; +{ + /* The default color index is 1, corresponding to the foreground + * drawing color color1. Index zero is the background drawing color + * color0. The remaining NColors color table entries are the optional + * drawing colors corresponding to resources "color2" through "colorN". + * These are used only if explicitly selected by the client application. + */ + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.cmap[1]); + w->gterm.color_index = 1; + invalidate_draw_context (w); +} + + +static +draw_crosshair (w, x, y) + GtermWidget w; + int x, y; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) { + /* The preserve_screen flag is set if we need to preserve the + * exact display window contents, rather than merely refresh from + * the backing store pixmap. + */ + if (w->gterm.preserve_screen) { + if (!w->gterm.preserve_valid || y != w->gterm.cur_y) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, w->core.height); + if (!w->gterm.preserve_valid || x != w->gterm.cur_x) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + x, 0, 1, w->core.height, w->core.width, 0); + w->gterm.preserve_valid = 1; + } + + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + 0, y, w->core.width, y); + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + x, 0, x, w->core.height); + + XFlush (w->gterm.display); + w->gterm.cursor_drawn++; + } + + w->gterm.cur_x = x; + w->gterm.cur_y = y; +} + + +static +erase_crosshair (w) + GtermWidget w; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.cursor_drawn) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.pixmap) { + if (w->gterm.preserve_screen && w->gterm.preserve_valid) { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, w->core.height, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + w->core.width, 0, 1, w->core.height, x, 0); + } else { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + x, 0, 1, w->core.height, x, 0); + } + } + + w->gterm.cursor_drawn = 0; + w->gterm.preserve_valid = 0; + } +} + + +static +update_transients (w, region) + GtermWidget w; + Region region; +{ + /* If an explicit region is given redisplay any markers in it immediately, + * otherwise set the redisplay flag to cause a full screen redisplay when + * drawing finishes and the widget is ready for input. + */ + if ((char *)region) + GmRedisplay (w, region); + else + w->gterm.gm_redisplay = True; + + /* Update the crosshair cursor if GIN mode is in effect. */ + update_cursor (w); +} + + +static +update_cursor (w) + GtermWidget w; +{ + if (w->gterm.cursor_type == GtGinmodeCursor && w->gterm.full_crosshair) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + if (x || y) + draw_crosshair (w, x, y); + } +} + +static Cursor +get_cursor (w, cursor_name) + GtermWidget w; + String cursor_name; +{ + XrmValue from, to; + Cursor cursor; + + from.size = strlen (cursor_name) + 1; + from.addr = cursor_name; + + to.addr = (caddr_t) &cursor; + to.size = sizeof(cursor); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRCursor, &to)) + cursor = XCreateFontCursor (w->gterm.display, XC_crosshair); + + return (cursor); +} + + +static DrawContext +get_draw_context (w) + GtermWidget w; +{ + DrawContext dx = &w->gterm.draw; + + if (!dx->valid) { + int raster = w->gterm.raster; + Raster rp = &w->gterm.rasters[raster]; + register MappingContext mx = &dx->mapContext[0]; + Region clip_region, mask_region; + struct mapping *map, *mp, *np, p_mp; + int xres = w->gterm.xres; + int yres = w->gterm.yres; + float xscale, yscale; + XRectangle r; + int i, j; + + dx->raster = w->gterm.raster; + dx->rp = rp; + + if (raster == 0) { + dx->nmappings = 1; + mx->mapping = 0; + mx->mp = NULL; + mx->use_backing_store = (w->gterm.pixmap != (Pixmap)NULL); + mx->pixmap = w->gterm.window; + mx->drawGC = w->gterm.drawGC; + mx->GC_private = 0; + + mx->xoffset = mx->yoffset = 0; +/* (7/16/97) MJF - we don't scale raster 0 since it's already in screen coords. + if (xres == rp->width && yres == rp->height) + mx->scale = 0; + else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } +*/ + mx->scale = 0; + + } else { + dx->nmappings = 0; + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (!mp->enabled || mp->src != raster || + w->gterm.rasters[mp->dst].type != GtServer) + continue; + if (!valid_mapping (w, mp)) + continue; + + mx->mp = mp; + mx->mapping = mp->mapping; + mx->pixmap = w->gterm.rasters[mp->dst].r.pixmap; + mx->use_backing_store = (mp->dst == 0 && + w->gterm.pixmap && !(mp->rop & R_Transient)); + + /* Determine if any scaling is necessary. */ + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + /* Compute logical-to-raster scaling. */ + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) { + mx->xscale = mx->yscale = 1.0; + mx->scale = 0; + } else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + /* Compute overall scale factors by combining logical-to- + * raster and raster-to-screen mappings. + */ + if (map->snx != map->dnx || map->sny != map->dny || + map->sx != map->dx || map->sy != map->dy) { + + xscale = (float)map->dnx / (float)map->snx; + mx->xscale *= xscale; + if (xscale < 0) + mx->xoffset = map->dx + abs(map->dnx) - 1; + else + mx->xoffset = map->dx; + mx->xoffset -= (map->sx * xscale); + + yscale = (float)map->dny / (float)map->sny; + mx->yscale *= yscale; + if (yscale < 0) + mx->yoffset = map->dy + abs(map->dny) - 1; + else + mx->yoffset = map->dy; + mx->yoffset -= (map->sy * yscale); + + mx->scale = 1; + } + + /* Compute the clip mask which will clip graphics to the + * destination rect of the mapping, minus any regions of + * this rect covered by other mappings. + */ + clip_region = XCreateRegion(); + r.x = map->dx; r.y = map->dy; + r.width = abs(map->dnx); + r.height = abs(map->dny); + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != mp->dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + mask_region = XCreateRegion(); + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + XUnionRectWithRegion (&r, mask_region, mask_region); + + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + } + + /* Create a drawing GC which is a copy of the global drawGC + * but using the clip mask computed above. + */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.root, + 0, NULL); + XCopyGC (w->gterm.display, w->gterm.drawGC, ~0, mx->drawGC); + XSetRegion (w->gterm.display, mx->drawGC, clip_region); + XDestroyRegion (clip_region); + mx->GC_private = 1; + + if (++dx->nmappings >= MAX_DRAW) + break; + else + mx++; + } + } + + dx->valid = 1; + } + + return (dx); +} + + +static +invalidate_draw_context (w) + GtermWidget w; +{ + register DrawContext dx = &w->gterm.draw; + register MappingContext mx; + register int i; + + if (dx->valid) { + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->GC_private) + XFreeGC (w->gterm.display, mx->drawGC); + } + dx->valid = 0; + } +} + +static XPoint * +mapVector (mx, pv1, pv2, npts) + register MappingContext mx; + XPoint *pv1; + XPoint *pv2; + int npts; +{ + register XPoint *ip = pv1; + register XPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x * mx->xscale + mx->xoffset; + op->y = ip->y * mx->yscale + mx->yoffset; + } + + return (pv2); +} + + +static void +savepos (w, event) + GtermWidget w; + XEvent *event; +{ + if (event == NULL) + return; + + switch (event->type) { + case KeyPress: + case KeyRelease: + w->gterm.last_x = event->xkey.x; + w->gterm.last_y = event->xkey.y; + break; + case ButtonPress: + case ButtonRelease: + w->gterm.last_x = event->xbutton.x; + w->gterm.last_y = event->xbutton.y; + break; + case MotionNotify: + w->gterm.last_x = event->xmotion.x; + w->gterm.last_y = event->xmotion.y; + break; + } +} + + +/* + * IMAGING routines. + * ----------------------- + * Our strategy here is to support a range of visuals with pseudocolor being + * preferred if available. All imaging is done internally using 8 bit images + * and a max 256 element colormap. If the display hardware has a depth less + * than 8 bits, e.g. for a monochrome display, the image is reduced to the + * screen depth by some technique before being output to the display. + * + * Images (rasters) are implemented internally in Gterm using either ximages or + * off screen pixmaps. Which format is used is decided at raster create time + * and is controlled by a Gterm resource. This is transparent to the client + * application. Currently only 8 bit rasters are supported. + * + * GtRasterInit (gt) + * GtAssignRaster (gt, raster, drawable) + * GtCreateRaster (gt, raster, type, width, height, depth) + * GtDestroyRaster (gt, raster) + * exists = GtQueryRaster (gt, raster, &type, &width, &height, &depth) + * raster = GtNextRaster (gt) + * GtSetRaster (gt, raster) + * raster = GtGetRaster (gt) + * n = GtNRasters (gt) + * + * GtWritePixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtReadPixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtSetPixels (gt, raster, ct, x1, y1, nx, ny, color, rop) + * GtRefreshPixels (gt, raster, ct, x1, y1, nx, ny) + * pixmap = GtExtractPixmap (gt, src, ct, x, y, width, height) + * GtInsertPixmap (gt, pixmap, dst, ct, x, y, width, height) + * + * colormap = GtNextColormap (gt) + * GtFreeColormap (gt, colormap) + * GtWriteColormap (gt, colormap, first, nelem, r, g, b) + * GtReadColormap (gt, colormap, first, nelem, r, g, b) + * GtLoadColormap (gt, colormap, offset, scale) + * exists = GtQueryColormap (gt, colormap, &first, &nelem, &maxelem) + * GtWriteIomap (gt, iomap, first, nelem) + * GtReadIomap (gt, iomap, first, nelem) + * pixel = GtGetClientPixel (gt, gterm_pixel) + * + * GtInitMappings (gt) + * mapping = GtNextMapping (gt) + * GtFreeMapping (gt, mapping) + * GtRaiseMapping (gt, mapping, ref|NULL) + * GtLowerMapping (gt, mapping, ref|NULL) + * int = GtCompareMappings (gt, map1, map2) + * GtEnableMapping (gt, mapping, refresh) + * GtDisableMapping (gt, mapping, erase) + * active = GtActiveMapping (gt, mapping) + * GtRefreshMapping (gt, mapping) + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mapping) + * + * GtCopyRaster (gt, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtSetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtGetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * + * GtMapVector (gt, mapping, dir, pv1, pv2, npts) + * GtPixelToNDC (gt, raster, pv1, pv2, npts) + * GtNDCToPixel (gt, raster, pv1, pv2, npts) + * + * GtDebug (gt, fp, what) + * + * In the case of CopyRaster or {Set|Get}Mapping, raster coordinates may be + * specified in either raster pixel (GtPixel) units or in normalized device + * coordinates (GtNDC) in the range 0-32767. + * --------------------------------------------------------------------------- + */ + +GtRasterInit (w) + GtermWidget w; +{ + register int i; + register Raster rp; + register struct colormap *cm; + struct colormap *next_cm; + + invalidate_draw_context (w); + + /* Destroy any existing rasters. */ + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (w->gterm.rasters[i].type) + GtDestroyRaster (w, i); + + /* Allocate the initially empty raster descriptors. */ + XtFree ((char *)w->gterm.rasters); + w->gterm.rasters = rp = + (Raster) XtCalloc (w->gterm.maxRasters, sizeof (struct raster)); + w->gterm.nrasters = 0; + w->gterm.raster = 0; + + /* Raster 0 is the display window. */ + rp->type = PixmapRaster; + rp->width = w->core.width; + rp->height = w->core.height; + rp->r.pixmap = w->gterm.window; + rp->delete = 0; + w->gterm.nrasters++; + + /* Free any previously allocated colormap cells. */ + if (w->gterm.ncolors > SZ_STATIC_CMAP && w->gterm.useDefaultCM) { + XFreeColors (w->gterm.display, w->core.colormap, + &w->gterm.cmap[SZ_STATIC_CMAP], w->gterm.ncolors - SZ_STATIC_CMAP, + 0); + w->gterm.ncolors = SZ_STATIC_CMAP; + invalidate_cmap (w); + } + + /* Free any client defined colormaps. */ + for (cm = w->gterm.colormaps; cm; cm = next_cm) { + next_cm = cm->next; + XtFree ((char *)cm); + } + w->gterm.colormaps = NULL; + + /* Initialize the mappings. */ + GtInitMappings (w); +} + + +/* GtNextRaster -- Return the index of the next unused raster. + */ +GtNextRaster (w) + register GtermWidget w; +{ + register int i; + + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (!w->gterm.rasters[i].type) + return (i); + + return (-1); +} + + +/* GtNRasters -- Return the number of currently defined rasters. + */ +GtNRasters (w) + GtermWidget w; +{ + return (w->gterm.nrasters); +} + + +/* GtAssignRaster -- Assign a raster descriptor to an externally created + * drawable (window or pixmap). The raster thus created may be mapped or + * drawn into like the rasters created privately by the imaging code, but + * this allows use of this code to access other windows, or shared pixmaps. + */ +GtAssignRaster (w, raster, drawable, type) + GtermWidget w; + int raster; /* one-indexed */ + XtPointer drawable; /* object containing pixel array */ + int type; /* type of drawable [not used] */ +{ + register Raster rp; + XWindowAttributes wa; + + if (raster <= 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + if (!XGetWindowAttributes (w->gterm.display, (Window)drawable, &wa)) + return (ERR); + + rp->type = PixmapRaster; + rp->width = wa.width; + rp->height = wa.height; + rp->r.pixmap = (Pixmap) drawable; + rp->delete = 0; + + return (OK); +} + + +/* GtCreateRaster -- Create a new raster of the given size. A server pixmap + * (GtServer) or ximage (GtClient) raster will be created depending upon the + * current value of the cacheRasters resource. + */ +GtCreateRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int type; + int width, height; + int depth; +{ + register uchar *op; + register int npix, pixel; + uchar *data; + XImage *xp; + Raster rp; + int cache; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + /* Only rasters of depth 8 bits are currently supported. */ + if (depth && depth != 8) + return (ERR); + + /* Check for a raster number in bounds. */ + if (raster < 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + /* A create on raster 0 (the display window) is treated as an attempt + * to resize the window. + */ + if (raster == 0) { + XWindowAttributes wa; + + invalidate_draw_context (w); + + /* Issue the resize request. */ + XtVaSetValues ((Widget)w, + XtNwidth, (XtArgVal)width, + XtNheight, (XtArgVal)height, + NULL); + XFlush (w->gterm.display); + + /* The following generates a round trip request to the server and + * is an attempt to allow the window system time to process the + * resize request before the client can issue a GtQueryRaster to + * see if the request has succeeded (hence causing a race condition). + * If the window is not the requested size the delay flag is set + * to cause graphics input processing to be suspended until the + * window is resized or redisplayed. A dummy expose event is + * generated to clear the delay condition in case the resize request + * is not granted. + */ + if (XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + rp->width = wa.width; + rp->height = wa.height; + + if (rp->width != width || rp->height != height) { + XExposeEvent ev; + ev.type = Expose; + ev.send_event = True; + ev.display = w->gterm.display; + ev.window = w->gterm.window; + ev.x = ev.y = 0; + ev.width = ev.height = 1; + ev.count = 0; + + XSendEvent (w->gterm.display, w->gterm.window, False, + NoEventMask, (XEvent *)&ev); + w->gterm.delay = 1; + } + } + return (OK); + } + + /* Get rid of any old raster. */ + GtDestroyRaster (w, raster); + + rp->width = width; + rp->height = height; + rp->delete = 1; + + /* Cache the raster? */ + if (strcmp (w->gterm.cacheRasters, "always") == 0) + cache = 1; + else if (strcmp (w->gterm.cacheRasters, "never") == 0) + cache = 0; + else + cache = (type == GtServer); + + /* Create new raster. */ + if (cache) { + /* Create a pixmap. */ + rp->type = PixmapRaster; + rp->r.pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + width, height, RasterDepth); + if (rp->r.pixmap == (Pixmap)NULL) + goto ximage; + XFillRectangle (w->gterm.display, rp->r.pixmap, w->gterm.clearGC, + 0, 0, width, height); + + } else { + /* Create an XImage. */ +ximage: + rp->type = ImageRaster; + + /* Get pixel storage. */ + npix = width * height; + if ((data = (uchar *) XtMalloc (npix)) == NULL) + return (ERR); + else { + for (op=data, pixel=w->gterm.color0; --npix >= 0; ) + *op++ = pixel; + } + + /* The following doesn't yet deal properly with byte and bit ordering + * differences between the server and client. + */ + rp->r.ximage = xp = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, width, height, 8, 0); + if (xp == NULL) { + rp->type = 0; + return (ERR); + } + } + + w->gterm.nrasters++; + return (OK); +} + + +/* GtDestroyRaster -- Destroy a raster. Any mappings which reference the + * raster are deactivated, and all storage associated with the raster is freed. + */ +GtDestroyRaster (w, raster) + GtermWidget w; + int raster; +{ + register Raster rp; + register Mapping mp, next; + + if (raster <= 0) + return; + + invalidate_draw_context (w); + + /* Disable any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = next) { + next = mp->next; + if (mp->src == raster || mp->dst == raster) + free_mapping (w, mp); + } + + /* Destroy the raster. */ + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (rp->delete) { + if (rp->type == ImageRaster) + XDestroyImage (rp->r.ximage); + else if (rp->type == PixmapRaster) + XFreePixmap (w->gterm.display, rp->r.pixmap); + } + w->gterm.nrasters--; + rp->type = 0; + rp->delete = 0; + } +} + + +/* GtQueryRaster -- Determine whether a raster exists and if so return its + * size. + */ +GtQueryRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int *type; + int *width, *height; + int *depth; +{ + register Raster rp; + + if (raster < 0 || raster > w->gterm.maxRasters) + return (0); + + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (type) { + if (rp->type == PixmapRaster) + *type = GtServer; + else + *type = GtClient; + } + if (width) + *width = rp->width; + if (height) + *height = rp->height; + if (depth) + *depth = RasterDepth; + return (1); + } else + return (0); +} + + +/* GtWritePixels -- Write to a rectangular region of a raster. If any + * mappings are currently defined which reference this raster as the source, + * and a mapped region is being rewritten, the affected pixels will be + * refreshed by the mapping. + */ +GtWritePixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + int bytes_per_line, i; + Mapping mp; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + XImage *ximage; + uchar *data; + int npix; + + /* Get a data buffer. */ + if ((data = (uchar *)XtMalloc (npix = nx * ny)) == NULL) + return (ERR); + + /* Convert the pixel values to colormap indices. */ + cmap = get_cmap_in (w); + for (ip=pixels, op=data, n=npix; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + + ximage = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, nx, ny, 8, 0); + + if (raster == 0 && w->gterm.pixmap) { + + /* ### Someone (Mike?) added this code for some reason, but it + * does not appear to be valid. This code already writes to the + * backing store (gterm.pixmap) so use_backing_store should not + * be required. Also blindly using only the first mapping context + * and ignoring any others cannot be correct. There is code + * below which executes any mappings defined on the raster. + * In general this requires scaling, not a simple XCopyArea. + * + * DrawContext dx = get_draw_context (w); + * register MappingContext mx; + * mx = &dx->mapContext[0]; + */ + + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + /* ### (cont'd) + * if (mx->use_backing_store) + * XCopyArea (display, w->gterm.pixmap, mx->pixmap, + * w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + */ + + XCopyArea (display, w->gterm.pixmap, rp->r.pixmap, + w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + } else + XPutImage (display, rp->r.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + XtFree ((char *)data); + ximage->data = NULL; + XDestroyImage (ximage); + + } else if (rp->type == ImageRaster) { + cmap = get_cmap_in (w); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + ip = pixels; + + /* Copy the data into the ximage data raster, converting input + * pixels to Xlib pixel values in the process. + * + * Possibly this should be done at Pixmap write time rather than + * during raster i/o so that the image pixel values are preserved. + * Otherwise reading back pixels is difficult and if the color map is + * dynamically modified the original pixel values may be lost. + * Postponing display pixel value generation woudl also make it easy + * to add support later for image depths other than 8 bit. Doing the + * conversion to display pixels here is however simpler and more + * efficient so that is how we do it for now. + */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtReadPixels -- Read a rectangular region of a raster. + */ +GtReadPixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + + int bytes_per_line, i; + int x, y, delxin = 0; + XImage *xin; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + /* Get the input ximage. */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + + /* Read the pixmap subraster into an ximage. If we are reading the + * screen (raster == 0) and we have an off-screen backing store pixmap, + * use that instead of the screen. + */ + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? w->gterm.pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + + if (xin == NULL) + return (ERR); + + delxin++; + x = y = 0; + + } else { + xin = rp->r.ximage; + x = x1; + y = y1; + } + + cmap = get_cmap_out (w); + bytes_per_line = xin->bytes_per_line; + lp = (uchar *)xin->data + y * bytes_per_line + x; + op = pixels; + + /* Copy the data to the output buffer, converting display pixels to + * client pixels in the process. + */ + for (i=0; i < ny; i++) { + for (n=nx, ip=lp; --n >= 0; ) + *op++ = cmap[*ip++]; + lp += bytes_per_line; + } + + if (delxin) + XDestroyImage (xin); + return (OK); +} + + +/* GtSetPixels -- Set all the raster pixels in a region to a single color. + * If nx=ny=0 the entire raster will be written. + */ +GtSetPixels (w, raster, ct, x1, y1, nx, ny, color, rop) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; + int color; + int rop; +{ + register Raster rp; + Mapping mp; + + /* Get raster pointer. */ + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + raster, ct, x1,y1,nx,ny); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + } + + /* Perform some range checks. */ + if (x1 == 0 && y1 == 0 && nx == 0 && ny == 0) { + nx = rp->width; + ny = rp->height; + } else { + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + } + + /* Set the pixels. + */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + GC gc = w->gterm.clearGC; + int use_backing_store; + + use_backing_store = + (raster == 0 && w->gterm.pixmap && !(rop & R_Transient)); + + XSetForeground (display, gc, get_pixel(w,color)); + XFillRectangle (display, rp->r.pixmap, gc, x1, y1, nx, ny); + if (use_backing_store) + XFillRectangle (display, w->gterm.pixmap, gc, x1, y1, nx, ny); + XSetForeground (display, gc, w->gterm.color0); + + } else { + register int n, i; + register uchar *op; + register Pixel pixel; + int bytes_per_line; + uchar *lp; + + pixel = get_pixel (w, color); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Set all pixels in the indicated region. */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = pixel; + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtRefreshPixels -- Update any mappings defined upon the given region of + * the given source raster, as if the pixel values had been set with a + * write pixels call. + */ +GtRefreshPixels (w, raster, ct, x1, y1, nx, ny) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; +{ + register Raster rp = &w->gterm.rasters[raster]; + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); + save_mapping (&sv_mp, 0, 0, + raster, ct, x1,y1,nx,ny, + 0, GtPixel, 0,0,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.sx; + y1 = p_mp.sy; + nx = p_mp.snx; + ny = p_mp.sny; + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } +} + + +/* GtExtractPixmap -- Extract a rectangular region of a raster and return + * as a pixmap. The caller is responsible for later deleting this pixmap. + */ +Pixmap +GtExtractPixmap (w, src, ctype, x, y, width, height) + GtermWidget w; + int src; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + int x1, y1, nx, ny; + String cache; + int i; + + rp = &w->gterm.rasters[src]; + if (!rp->type) + return ((Pixmap)NULL); + + /* If width and height are zero, return the full raster. */ + if (width <= 0) + width = rp->width; + if (height <= 0) + height = rp->height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + src, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Find any empty raster slot and use it to generate the output pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + cache = w->gterm.cacheRasters; + w->gterm.cacheRasters = "always"; + + if (GtCreateRaster (w, i, GtServer, nx, ny) == ERR) { + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } else if (rp->type != PixmapRaster) + goto err; + + if (GtCopyRaster (w, 0, + src,0, x1,y1,nx,ny, i,0, 0,0,nx,ny) == ERR) { +err: + GtDestroyRaster (i); + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } + + rp->type = 0; + w->gterm.nrasters--; + w->gterm.cacheRasters = cache; + + return (rp->r.pixmap); + } + } + + return ((Pixmap)NULL); +} + + +/* GtInsertPixmap -- Insert the contents of the given pixmap into a raster + * at the indicated coordinates. + */ +GtInsertPixmap (w, pixmap, dst, ctype, x, y, width, height) + GtermWidget w; + Pixmap pixmap; + int dst; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + XWindowAttributes wa; + int x1, y1, nx, ny; + int i; + + /* Check that the pixmap exists. */ + if (!XGetWindowAttributes (w->gterm.display, pixmap, &wa)) + return (ERR); + + /* Default to full dimensions of pixmap if no dimensions given. */ + if (width <= 0) + width = wa.width; + if (height <= 0) + height = wa.height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + dst, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Create the destination raster if none exists. */ + if (!w->gterm.rasters[dst].type) + if (GtCreateRaster (w, dst, GtDefault, nx, ny) == ERR) + return (ERR); + + /* Find an empty raster slot and use it to build a fake source raster + * using the supplied pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + rp->type = PixmapRaster; + rp->width = nx; + rp->height = ny; + rp->r.pixmap = pixmap; + + if (GtCopyRaster (w, 0, + i,0, 0,0,nx,ny, dst,0, x1,y1,nx,ny) < 0) + return (ERR); + + rp->type = 0; + return (OK); + } + } + + return (ERR); +} + + +/* GtWriteColormap -- Allocate or modify colormap cells. The Gterm widget + * colormap consists of a fixed number of preassigned, read-only color cells, + * plus a variable number of dynamically allocated application defined color + * cells. The application sees only the preassigned pixel space 0-N where + * N is the maximum pixel value. These values are mapped to Xlib pixel values + * by the CMAP vector in the main Gterm widget descriptor. The server + * colormap does the final mapping to RGB triplets. + * + * Our strategy here is as follows. If we have a monochrome screen set up a + * one-to-one fake colormap so that we preserve the input pixel values and + * render a one-bit image later. If we have a StaticGray or StaticColor + * visual allocate read-only color cells to allow X to choose the closest + * colors to what we request. If we have a GrayScale or PseudoColor visual + * allocate private read-write colors. The TrueColor and DirectColor + * visuals should not be seen here as we should have been able to set up the + * PseudoColor visual on screens that support these visuals, but if they are + * seen use a one-to-one mapping to preserve the 8 bit pixel values. + */ +GtWriteColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + XWindowAttributes wa; + register XColor *cp; + register int i, j, v, n; + unsigned long plane_masks[1]; + int req, need; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + if (map > 0) { + /* Create or modify a colormap descriptor. The display colormap + * is not affected. + */ + register struct colormap *cm; + struct colormap *last_cm; + register XColor *cp; + register int i; + + /* See if the colormap already exists. */ + for (cm = w->gterm.colormaps, last_cm = NULL; cm; cm = cm->next) { + last_cm = cm; + if (cm->map == map) + break; + } + + /* If not, create it. */ + if (!cm) { + if (!(cm = (struct colormap *)XtCalloc(1,sizeof(struct colormap)))) + return (ERR); + if (last_cm) + last_cm->next = cm; + else + w->gterm.colormaps = cm; + + /* Initialize static part of colormap. */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } + + cm->map = map; + cm->ncells = max (cm->ncells, first + nelem); + + /* Ignore attempts to overwrite static part of colormap. */ + for ( ; first < SZ_STATIC_CMAP; first++, nelem--) { + r++; g++; b++; + } + + memmove (&cm->r[first], r, nelem * sizeof (ushort)); + memmove (&cm->g[first], g, nelem * sizeof (ushort)); + memmove (&cm->b[first], b, nelem * sizeof (ushort)); + + return (OK); + } + + /* Write to the display colormap. + */ + if (first < SZ_STATIC_CMAP || first + nelem > MAX_SZCMAP) + return (ERR); + + /* Invalidate the cmap cache. */ + invalidate_cmap (w); + + /* Get the window attributes. We need to do this to determine the type + * of visual used for the window, which determines our color allocation + * strategy. This is only done once since presumably the visual and + * window depth will not change after the widget has been around long + * enough to receive a GtWriteColormap call. + */ + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) + return (ERR); + w->gterm.wa = wa; + w->gterm.wa_defined++; + } else + wa = w->gterm.wa; + + if (wa.depth == 1) + goto unitary; + + switch (wa.visual->class) { + case StaticGray: + case StaticColor: + /* Allocate "best-match" colors. */ + for (i=first; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + cp->red = r[i-first]; + cp->green = g[i-first]; + cp->blue = b[i-first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (XAllocColor (w->gterm.display, wa.colormap, cp)) + w->gterm.cmap[i] = cp->pixel; + else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + } + } + break; + + case GrayScale: + case PseudoColor: + if (w->gterm.useDefaultCM) { +usedef: /* Allocate private r/w colors from default colormap. */ + need = first + nelem - w->gterm.ncolors; + + /* Allocate new color cells if needed. If we can't allocate all + * the requested cells the unallocated pixel values are set to + * black. + */ + if ((n = need) > 0) { + /* Get the colormap cells. */ + req = min(w->gterm.maxColors, first + nelem - SZ_STATIC_CMAP) - + (w->gterm.ncolors - SZ_STATIC_CMAP); + for (n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, wa.colormap, + False, plane_masks, 0, + &w->gterm.cmap[w->gterm.ncolors+n], req)) { + n += req; + } else + req /= 2; + + /* Initialize the color descriptors. */ + for (i = w->gterm.ncolors; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + if (i < w->gterm.ncolors + n) { + cp->pixel = w->gterm.cmap[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + cp->flags = 0; + } + } + w->gterm.ncolors += n; + } + + /* Assign RGB colors to the referenced cells. */ + for (i=0; i < nelem; i++) { + cp = &w->gterm.color[first+i]; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + n = w->gterm.ncolors - first; + if (n > 0) + XStoreColors (w->gterm.display, wa.colormap, + &w->gterm.color[first], n); + + } else { + /* Allocate colors in a custom colormap. If the named colormap + * does not yet exist we create one. Multiple gterm widget + * instances may share the same colormap. + */ + Colormap colormap; + long timeval, time(); + int ncolors, shadow; + + /* get_colormap will direct us to the default colormap if the + * custom colormap cannot be accessed or created. + */ + colormap = get_colormap (w); + if (w->gterm.useDefaultCM) + goto usedef; + + /* Assign RGB colors to the referenced cells. */ + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + /* Store the new colors. */ + if (ncolors > 0) + XStoreColors (w->gterm.display, + colormap, &w->gterm.color[first], ncolors); + + /* Also attempt to store the colors in the default colortable, + * by allocating, writing, and then deallocating cells. This + * helps keeps the gterm window visible when the default + * colormap is loaded. To avoid excessive server queries the + * default colormap is only updated every so often. Updating is + * disabled if cmapShadow is set to zero. If shadowing is + * enabled the update is always performed if the WriteColormap + * occurs when the pointer is not in the window (e.g., when a + * button elsewhere in the GUI is pressed) as otherwise the + * change will not be visible as the private colormap will not + * be loaded by the window manager. + */ + shadow = w->gterm.cmapShadow; + timeval = time((long *)NULL); + + if (shadow && (!w->gterm.in_window || + (timeval - w->gterm.cmapLastShadow > shadow))) { + + update_default_colormap (w); + w->gterm.cmapLastShadow = timeval; + } + } + break; + + default: + /* Set up a unitary, or one-to-one mapping, to preserve the input + * pixel values so that we can render them later. + */ +unitary: + for (i = first; i < first+nelem; i++) { + w->gterm.cmap[i] = i; + cp = &w->gterm.color[i]; + cp->pixel = i; + cp->red = r[i+first]; + cp->green = g[i+first]; + cp->blue = b[i+first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (i+1 > w->gterm.ncolors) + w->gterm.ncolors = i + 1; + } + break; + } + + return (OK); +} + + +/* GtReadColormap -- Return the color assignments for a region of the named + * colormap. + */ +GtReadColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + if (map > 0) { + /* Read from a colormap descriptor. + */ + register struct colormap *cm; + register int i, j; + + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + j = first + i; + if (j < cm->ncells) { + r[i] = cm->r[j]; + g[i] = cm->g[j]; + b[i] = cm->b[j]; + } else + break; + } + + return (i); + + } else { + /* Read the display colormap. + */ + register XColor *cp; + register int i; + + /* Return RGB values. */ + for (i=0; i < nelem; i++) + if (first+i < w->gterm.ncolors) { + cp = &w->gterm.color[first+i]; + r[i] = cp->red; + g[i] = cp->green; + b[i] = cp->blue; + } else + break; + + return (i); + } +} + + +/* GtLoadColormap -- Load a colormap into the display, optionally scaling + * the colormap via a linear transformation in the process. The colormap is + * unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. + * If map=0 the linear transformation is applied directly to the display + * colormap. + * + * The offset refers to the center of the mapped region of the transfer + * function, which is why the center value is at 0.5. For example, if the + * range of raster pixel intensities is normalized to the range 0.0 to 1.0, + * then a transfer function of [offset=0.3,slope=3.0] will display the region + * of intenstities centered around the normalized intenstity of 0.3, with a + * contrast of 3.0 (the screen intensity changes 3 units for a unit change in + * raster pixel intensity). The transfer function [offset=0.3,slope=-3.0] + * will display the same range of pixel intensitites, but with a negative + * contrast. The transfer function [offset=0.5,slope=1.0] has intercepts + * of [0,0] and [1,1] hence it displays the full range of raster pixel + * intensities - the input colormap is used as is, without resampling. + */ +GtLoadColormap (w, map, offset, slope) + GtermWidget w; + int map; + float offset, slope; +{ + register int i; + register XColor *cp; + register struct colormap *cm; + struct colormap d_cmap, o_cmap; + int noscale, nelem, c1, c2; + float x, y, z, frac; + ushort r, g, b; + + /* Get the colormap to be loaded. + */ + if (map == 0) { + /* Create a dummy colormap struct from the screen colormap. */ + cm = &d_cmap; + cm->map = 0; + cm->next = NULL; + cm->ncells = w->gterm.ncolors; + for (i=0; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } else { + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (ERR); + } + + /* Compute the scaled colormap. Only the dynamic part of the colormap + * is scaled, the static cells are not affected. + */ + o_cmap.map = 0; + o_cmap.ncells = cm->ncells; + nelem = cm->ncells - SZ_STATIC_CMAP; + noscale = (abs(offset - 0.5) < 0.0001 && abs(slope - 1.0) < 0.0001); + + if (noscale) { + for (i=0; i < nelem; i++) { + o_cmap.r[i] = cm->r[SZ_STATIC_CMAP+i]; + o_cmap.g[i] = cm->g[SZ_STATIC_CMAP+i]; + o_cmap.b[i] = cm->b[SZ_STATIC_CMAP+i]; + } + } else { + for (i=0; i < nelem; i++) { + x = (float)i / (float)(nelem - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + r = cm->r[SZ_STATIC_CMAP]; + g = cm->g[SZ_STATIC_CMAP]; + b = cm->b[SZ_STATIC_CMAP]; + } else if (y >= 1.0) { + r = cm->r[cm->ncells-1]; + g = cm->g[cm->ncells-1]; + b = cm->b[cm->ncells-1]; + } else { + z = y * (nelem - 1) + SZ_STATIC_CMAP; + if (w->gterm.cmapInterpolate) { + c1 = (int)z; + c2 = min (cm->ncells-1, c1 + 1); + frac = z - c1; + r = cm->r[c1] * (1.0 - frac) + cm->r[c2] * frac; + g = cm->g[c1] * (1.0 - frac) + cm->g[c2] * frac; + b = cm->b[c1] * (1.0 - frac) + cm->b[c2] * frac; + } else { + c1 = (int)z; + r = cm->r[c1]; + g = cm->g[c1]; + b = cm->b[c1]; + } + } + + o_cmap.r[i] = r; + o_cmap.g[i] = g; + o_cmap.b[i] = b; + } + } + + /* Load the colormap into the display. */ + GtWriteColormap (w, 0, SZ_STATIC_CMAP, nelem, + o_cmap.r, o_cmap.g, o_cmap.b); + + /* If the colormap we loaded to the display was the display colormap, + * restore the original unscaled colors in the gterm descriptor so that + * we won't be scaling a scaled colormap in the next operation. + */ + if (map == 0) + for (i=SZ_STATIC_CMAP; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cp->red = cm->r[i]; + cp->green = cm->g[i]; + cp->blue = cm->b[i]; + } + + return (OK); +} + + +/* GtQueryColormap -- Return information on the size and state of a colormap. + */ +GtQueryColormap (w, map, first, nelem, maxelem) + register GtermWidget w; + int map; + int *first, *nelem, *maxelem; +{ + register struct colormap *cm; + int nitems; + + if (first) + *first = SZ_STATIC_CMAP; + if (nelem) + *nelem = 0; + if (maxelem) + *maxelem = min (w->gterm.maxColors, MAX_SZCMAP) - SZ_STATIC_CMAP; + + if (map > 0) { + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + if (nelem) + *nelem = cm->ncells - SZ_STATIC_CMAP; + + } else { + if (nelem) + *nelem = w->gterm.ncolors - SZ_STATIC_CMAP; + if (maxelem) { + nitems = min (MAX_SZCMAP, CellsOfScreen(w->gterm.screen)); + *maxelem = min (nitems, + min (w->gterm.maxColors, MAX_SZCMAP - w->gterm.base_pixel)); + } + } + + return (1); +} + + +/* GtNextColormap -- Return a unique colormap number. + */ +GtNextColormap (w) + register GtermWidget w; +{ + register struct colormap *cm; + register int mapno = 0; + + /* Get the next map number. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map > mapno) + mapno = cm->map; + + return (mapno + 1); +} + + +/* GtFreeColormap -- Free a colormap descriptor. + */ +GtFreeColormap (w, colormap) + register GtermWidget w; + int colormap; +{ + register struct colormap *p_cm, *cm; + + /* Find the colormap and free it. */ + for (p_cm = NULL, cm = w->gterm.colormaps; cm; p_cm = cm, cm = cm->next) + if (cm->map == colormap) { + if (p_cm) + p_cm->next = cm->next; + else + w->gterm.colormaps = cm->next; + XtFree ((char *)cm); + return; + } +} + + +/* GtWriteIomap -- An iomap is an optional lookup table used to isolate the + * client application from the color model used within the Gterm widget. + * To simplify color allocation the Gterm widget defines a logical color + * space where color 0 is the background, 1 the foreground, 2-N are statically + * allocated standard colors, and colors N+1 and above are dynamically + * allocated by the graphics application. Less-demanding applications use + * only the statically allocated, shared colors. The widget internally maps + * these logical colors to whatever the window system requires, but providing + * a well-defined logical color space isolates the client from the details of + * color allocation in the underlying window system. + * + * An iomap can be used to define a mapping between the color model of the + * client application and the Gterm color model (when we say color model here + * we mean color allocation schemes for 8 bit pseudocolor). By default the + * iomap is one-to-one. The use of an iomap frees the client from having to + * worry about color index translations, and allows color tables to be + * combined in the widget for greater efficiency when color tables are serially + * applied. The iomap applies to all color indices or pixel values passed + * in i/o operations between the client and the Gterm widget. + */ +GtWriteIomap (w, iomap, first, nelem) + register GtermWidget w; + ushort *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (&w->gterm.iomap[c1], iomap, nelem * sizeof(ushort)); + invalidate_cmap (w); +} + + +/* GtReadIomap -- Read back the contents of the iomap. + */ +GtReadIomap (w, iomap, first, nelem) + register GtermWidget w; + uchar *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (iomap, &w->gterm.iomap[c1], nelem * sizeof(ushort)); +} + + +/* init_iomap -- Initialize the iomap and the cmap cache. + */ +static void +init_iomap (w) + GtermWidget w; +{ + register ushort *iomap = w->gterm.iomap; + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + iomap[i] = i; + invalidate_cmap (w); +} + + +/* invalidate_cmap -- Invalidate the cmap cache. + */ +static void +invalidate_cmap (w) + register GtermWidget w; +{ + w->gterm.cmap_in_valid = w->gterm.cmap_out_valid = 0; +} + + +/* get_cmap_in -- Get the combined input colormap, used to transform color + * values received from the client to window system color indices. + */ +static Pixel * +get_cmap_in (w) + register GtermWidget w; +{ + register Pixel *cmap, *cmap_in = w->gterm.cmap_in; + register ushort *iomap; + register int i, j; + int ncolors; + + if (w->gterm.cmap_in_valid) + return (cmap_in); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + ncolors = w->gterm.ncolors - SZ_STATIC_CMAP; + + /* If ncolors is small wrap around so that pixel values stay within + * the mapped range of output pixels. + */ + for (i=0; i < MAX_SZCMAP; i++) { + j = iomap[i]; + if (j > SZ_STATIC_CMAP && ncolors) + j = ((j - SZ_STATIC_CMAP) % ncolors) + SZ_STATIC_CMAP; + cmap_in[i] = cmap[j]; + } + + w->gterm.cmap_in_valid++; + return (cmap_in); +} + + +/* get_cmap_out -- Get the combined output colormap, used to transform window + * system color indices to the color system of the client. Note that this is + * not necessarily a uniquely defined invertible transformation. + */ +static Pixel * +get_cmap_out (w) + GtermWidget w; +{ + register Pixel *cmap; + register ushort *iomap; + Pixel *cmap_out = w->gterm.cmap_out; + register int pixel, i; + int j; + + if (w->gterm.cmap_out_valid) + return (cmap_out); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + + /* Invert the two colormaps. This is not very efficient, but we don't + * have to do this very often (a GtReadPixels call is about the only + * case, and even then the map is cached). + */ + for (j=0; j < MAX_SZCMAP; j++) { + pixel = j; + + /* Lookup display pixel in cmap. */ + for (i=0; i < MAX_SZCMAP; i++) + if (cmap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + + /* Lookup cmap pixel in iomap. */ + if (iomap[pixel] != pixel) { + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + } + + cmap_out[j] = pixel; + } + + w->gterm.cmap_out_valid++; + return (cmap_out); +} + + +/* get_pixel -- Convert a client color index into a display pixel. + */ +static Pixel +get_pixel (w, client_pixel) + register GtermWidget w; + register int client_pixel; +{ + register Pixel *cmap = get_cmap_in (w); + + if (client_pixel < 0 || client_pixel >= MAX_SZCMAP) + return (w->gterm.cmap[1]); + else + return (cmap[client_pixel]); +} + + +/* GtGetClientPixel -- Convert a gterm pixel into a client pixel. + */ +GtGetClientPixel (w, pixel) + GtermWidget w; + register int pixel; +{ + register int i; + register ushort *iomap; + int client_pixel = 0; + + get_cmap_in (w); + iomap = w->gterm.iomap; + + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + client_pixel = i; + break; + } + + return (client_pixel); +} + + +/* GtInitMappings -- Delete all mappings and initialize the mapping subsystem. + */ +GtInitMappings (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + invalidate_draw_context (w); + + /* Free any mapping storage. */ + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (mp->defined) + free_mapping (w, mp); + } + XtFree ((char *)w->gterm.mappings); + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + } + + /* Allocate the initially empty mapping descriptors. */ + w->gterm.mappings = + (Mapping) XtCalloc (w->gterm.maxMappings, sizeof (struct mapping)); + + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + mp->mapping = i; + } + + w->gterm.nmappings = 0; +} + + +/* GtNextMapping -- Return the index of the next available mapping descriptor. + * This routine always returns a mapping index of 1 or higher. + */ +GtNextMapping (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + for (i=1; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + return (i); + } + + return (-1); +} + + +/* GtFreeMapping -- Free a mapping descriptor. + */ +GtFreeMapping (w, mapping) + register GtermWidget w; + int mapping; +{ + free_mapping (w, &w->gterm.mappings[mapping]); +} + + +/* GtRaiseMapping -- Set the stacking order of a mapping to one level + * higher than the reference mapping. If no reference mapping is given + * the mapping is raised to the top of the stacking order. + */ +GtRaiseMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = w->gterm.mp_tail; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already on top? */ + if (mp == w->gterm.mp_tail) + return; + + mp_unlink (w, mp); + mp_linkafter (w, mp, ref_mp); +} + + +/* GtLowerMapping -- Change the stacking order of a mapping relative to another + * mapping, causing the first mapping to be drawn below the second. + */ +GtLowerMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = NULL; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already lowered? */ + if (mp == w->gterm.mp_head) + return; + + /* Lower it. */ + mp_unlink (w, mp); + if (ref_mp && ref_mp->prev) + mp_linkafter (w, mp, ref_mp->prev); + else { + mp->next = w->gterm.mp_head; + w->gterm.mp_head = mp; + if (mp->next) + mp->next->prev = mp; + if (!w->gterm.mp_tail) + w->gterm.mp_tail = mp; + } +} + + +/* GtCompareMappings -- Compare the stacking order of two mappings. A + * negative value is returned if the m1 < m2, zero is returned if the + * mappings are the same, and a positive value is returned if m1 > m2. + */ +GtCompareMappings (w, map1, map2) + register GtermWidget w; + int map1, map2; +{ + register Mapping mp, mp1, mp2; + + if (map1 == map2) + return (0); + + mp1 = &w->gterm.mappings[map1]; + mp2 = &w->gterm.mappings[map2]; + + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp == mp1) + return (-1); + else if (mp == mp2) + return (1); + + return (0); +} + + +/* GtSelectRaster -- Select the raster which maps to the given raster pixel, + * and transform the coordinates back to the source raster. The raster number + * and the raster coordinates of the source raster are returned. If no raster + * maps to the given pixel, raster=src and source raster coordinates are + * returned. + * + * The raster pixel coordinate system is best explained by an example. + * Suppose we have a 10x10 raster mapped into a 500x500 window. The + * window pixel 0 on an axis has raster pixel coordinate 0.0; pixel 500 + * (which is outside the window) has raster pixel coordinate 10.0. The + * coordinates correspond to the edge of the pixel as displayed in the + * window, i.e., the left edge of the (nonflipped) window is at x=0.0, and + * the right edge at x=10.0. Due to the pixelization of the screen, the + * maximum value is a limit which is only approached as the magnification + * increases. + * + * The client application may have a different coordinate system than the + * above. For example, if the client wants an integer pixel value to be + * at the center of a pixel, the first pixel has the coordinate [1,1], and + * the raster is 10 pixels wide, the client coordinate system would range + * from 0.5 to 10.5 at the edges of the NDC space. + */ +GtSelectRaster (w, dras, dt, dx, dy, rt, rx, ry, rmap) + GtermWidget w; + int dras; /* display raster */ + int dt; /* coordinate type of input coords */ + int dx, dy; /* display raster coordinates */ + int rt; /* coordinate type for output */ + int *rx, *ry; /* raster coordinates (output) */ + int *rmap; /* mapping selected */ +{ + register Mapping mp; + float x, y, x2, y2; + int raster, mapping; + + /* Get display raster pixel coordinates. */ + if (dt != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, 0, 0,0,0,0, + 0, dt, dx,dy,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + dx = p_mp.dx; + dy = p_mp.dy; + } + + /* Search for a mapping which maps to this pixel. The mapping we are + * looking for is the mapping closest to the tail of the mapping list + * (highest stacking order) which is defined and enabled and which + * includes the given display raster pixel in its destination rect. + */ + for (mp = w->gterm.mp_tail, mapping = -1; mp; mp = mp->prev) { + if (mp->defined && mp->enabled && mp->dst == dras) { + struct mapping *map, p_mp; + int dnx, dny; + + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + if ((dnx = map->dnx) < 0) + dnx = -dnx; + if ((dny = map->dny) < 0) + dny = -dny; + + /* Is display raster pixel in destination rect for this mapping? + */ + if (dnx > 0 && dx >= map->dx && dx < map->dx + dnx && + dny > 0 && dy >= map->dy && dy < map->dy + dny) { + + /* Compute offset into destination rect and apply axis flip + * if any from mapping. + */ + x = dx - map->dx + 0.5; + if (map->dnx < 0) + x = dnx - x; + y = dy - map->dy + 0.5; + if (map->dny < 0) + y = dny - y; + + /* Compute the source raster coordinates corresponding to + * the given display pixel. This is done in floating point + * to permit fractional pixel resolution if the mapping + * zooms the raster. + */ + x = x * (float)map->snx / (float)dnx + map->sx; + y = y * (float)map->sny / (float)dny + map->sy; + + mapping = map->mapping; + raster = map->src; + x2 = w->gterm.rasters[raster].width; + y2 = w->gterm.rasters[raster].height; + + break; + } + } + } + + /* Return display raster coordinates if no mapped raster was found. + */ + if (mapping < 0) { + x = dx; y = dy; + x2 = (int)w->core.width - 1; + y2 = (int)w->core.height - 1; + raster = dras; + } + + /* Output coordinates of the requested type. The increased resolution + * of NDC coordinates allows fractional pixel coordinates to be returned + * (e.g. 1/32 of a pixel for a 1K raster). + */ + if (rt == GtPixel) { + *rx = x; + *ry = y; + } else { + *rx = ( x) / x2 * MAXNDC; + *ry = (y2 - y) / y2 * MAXNDC; /* NDC is flipped in Y */ + } + + *rmap = mapping; + return (raster); +} + + +/* GtCopyRaster -- Copy a region of the source raster to a region of the + * destination raster. If the input and output regions are not the same + * size the subimage is automatically scaled to fit the destination region. + * If the destination extent DNX or DNY is negative, the image is flipped in + * that axis. The type of spatial scaling performed is determined by the + * scale factors (zoom, dezoom, or no scaling). The rasterop argument is + * used to exercise fine control over how the mapping is performed, e.g., to + * force a refresh, implement a transient mapping, or in the case of a dezoom + * (many-to-one) mapping, select the antialiasing technique to be used. + */ +GtCopyRaster (w, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for destination raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + Mapping sv_mp, p_mp; + int status; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Construct a temporary mapping describing the desired raster copy. */ + save_mapping (&sv_mp, w->gterm.maxMappings, 0, + src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + initialize_mapping (&p_mp); + get_pixel_mapping (w, &sv_mp, &p_mp, 1); + update_mapping (w, &p_mp); + + /* Refresh the destination pixels. */ + status = refresh_destination (w, &p_mp, dx, dy, abs(dnx), abs(dny)); + + /* Discard the temporary mapping. */ + free_mapping (w, &p_mp); + + return (status); +} + + +/* GtSetMapping -- Define a new mapping function, or modify an old one. + * If a new mapping is defined it is merely enabled, and no refreshing + * of the screen takes place until either some mapped data is written + * to or the mapping is explicitly refreshed. If an existing mapping is + * modified the old and new mappings are examined and only those portions + * of the destination rect for which the mapping changed are updated. + * This permits minor changes to a mapping (e.g. moving an edge) without + * having to redraw the entire region. Regions of the destination drawable + * which were previously covered by the mapping but which were exposed by + * modifying the mapping are redrawn. + */ +GtSetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for source raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + register int i, j; + register Mapping mp, o_mp, n_mp; + struct mapping pix_mp, new_mp; + int defined, scale_changed, offset, current, state, old_i; + int nx, xs[MAX_REGIONS], xe[MAX_REGIONS], xv[MAX_REGIONS]; + int ny, ys[MAX_REGIONS], ye[MAX_REGIONS], yv[MAX_REGIONS]; + int n_dnx, n_dny, n_xflip=0, n_yflip=0, i1, i2; + int o_dnx, o_dny, o_xflip=0, o_yflip=0; + int *o_xymap, *o_xmap, *o_ymap; + int *n_xymap, *n_xmap, *n_ymap; + XRectangle rl[MAX_REGIONS]; + int nrect, buflen, refresh; + + /* Check mapping number in range. */ + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (ERR); + else + mp = &w->gterm.mappings[mapping]; + + invalidate_draw_context (w); + initialize_mapping (&pix_mp); + initialize_mapping (&new_mp); + + /* Get local pixel space copy of old mapping, store new mapping. */ + get_pixel_mapping (w, mp, &pix_mp, 1); + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = snx; mp->sny = sny; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dnx; mp->dny = dny; + mp->rop = (rop & ~(R_RefreshNone|R_RefreshAll)); + mp->updated = 0; + + /* Newly defined mappings are linked at the tail of the mapping list, + * i.e. they stack (display) on top of any other mappings. If the + * mapping is already defined the stacking order is not changed. + */ + if (!(defined = mp->defined)) { + mp_linkafter (w, mp, w->gterm.mp_tail); + mp->defined = 1; + } + + if (!valid_mapping (w, mp)) { + mp_unlink (w, mp); + mp->defined = 0; + return (ERR); + } + update_mapping (w, mp); + + /* If we are defining a new mapping just define it and quit, without + * refreshing the window, unless R_RefreshAll is explicitly set in the + * mapping. If the mapping is not enabled merely store the new mapping. + * If the mapping is a null mapping (no pixels) do nothing. If refresh + * is disabled in the rasterop merely store the new mapping. If we are + * editing an existing mapping which is enabled with the default rasterop, + * we continue on to compare the old and new mappings and refresh any + * changed pixels in the destination rect. + */ + if (!defined || src != mp->src || dst != mp->dst) { + mp->enabled = mp->defined = 1; + mp->refresh = 0; + return; + } else if (!mp->enabled) { + return; + } else if (snx == 0 || sny == 0 || dnx == 0 || dny == 0) + return; + + if (rop & R_RefreshNone) + return; + + /* Convert input mappings to pixel coordinates, we deal with only pixel + * coordinates from here on. + */ + get_pixel_mapping (w, mp, &new_mp, 1); + load_mapping (&new_mp, &mapping, &rop, + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + update_mapping (w, n_mp = &new_mp); + update_mapping (w, o_mp = &pix_mp); + + /* + * We are editing an existing mapping. Determine what has changed in + * the mapping and refresh the changed regions. + */ + + /* Get old XY scaling maps. + */ + o_xmap = o_mp->x_srcpix; + o_ymap = o_mp->y_srcpix; + + if ((o_dnx = o_mp->dnx) < 0) { + o_dnx = -o_dnx; + o_xflip = 1; + } + if ((o_dny = o_mp->dny) < 0) { + o_dny = -o_dny; + o_yflip = 1; + } + + /* Get new XY scaling maps. + */ + n_xmap = n_mp->x_srcpix; + n_ymap = n_mp->y_srcpix; + + if (dnx < 0) { + dnx = -dnx; + n_xflip = 1; + } + if (dny < 0) { + dny = -dny; + n_yflip = 1; + } + + /* Refresh the entire region if the refresh flag is set, a flip has + * occurred, or we are doing a complex dezoom mapping. + */ + refresh = (o_mp->refresh || (rop & R_RefreshAll)); + if (n_xflip != o_xflip || n_yflip != o_yflip) + refresh = 1; + if (n_mp->scaling == M_DEZOOM) + refresh = 1; + + /* Has the spatial scale changed? */ + scale_changed = + abs (o_mp->xscale - n_mp->xscale) > 1.0E-4 || + abs (o_mp->yscale - n_mp->yscale) > 1.0E-4; + + /* If any of the above conditions are true refresh the entire mapping, + * otherwise compare the old and new mappings and refresh any subregions + * which have changed. + */ + if (refresh || scale_changed || n_mp->scaling == M_DEZOOM) { + refresh_destination (w, n_mp, dx, dy, dnx, dny); + + } else { + /* Compare the old and new mappings to see what needs to be + * refreshed. For speed reasons we only want to refresh the pixels + * which have been remapped. Any destination pixel in the new mapping + * which does not map to the same source pixel as in the old mapping + * must be refreshed. We examine each X and Y coordinate in the new + * destination rect and see if the source coordinate this maps to is + * the same as in the old mapping. If a given destination pixel [i,j] + * maps to the same pixel [i,j] in the source as it did in the + * previous mapping, we do not need to refresh that pixel. We examine + * the X and Y axis in turn and build up a list of regions which do or + * do not need to be refreshed. + */ + + /* Get a list of ranges {XS,XE,XV} in X. */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + dx, dnx, n_xmap, o_mp->dx, o_dnx, o_xmap); + + /* Get a list of ranges {YS,YE,YV} in Y. */ + ny = get_regions (ys,ye,yv, MAX_REGIONS, + dy, dny, n_ymap, o_mp->dy, o_dny, o_ymap); + + /* The list of ranges in X and Y together define a raster of arbitary + * sized subrectangles filling the destination rect. If the state + * value is nonzero (bit 1 set) in either X or Y, the subrectangle + * must be refreshed. The get_rects routine returns a list of the + * rectangular subregions matching the given condition (bit 1 set in + * either axis). Adjacent rectangles are merged to minimize the + * number of calls to refresh_destination. + */ + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 1,1); + for (i=0; i < nrect; i++) + refresh_destination (w, n_mp, + rl[i].x, rl[i].y, rl[i].width, rl[i].height); + } + + /* Refresh any lower level mappings exposed when the current mapping was + * modified. These will be regions of the old rect not present in the + * new, modified rect for the current mapping. + */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + o_mp->dx, o_dnx, o_xmap, dx, dnx, n_xmap); + ny = get_regions (ys,ye,yv, MAX_REGIONS, + o_mp->dy, o_dny, o_ymap, dy, dny, n_ymap); + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 2,2); + + for (i=0; i < nrect; i++) { + XRectangle r, in; + Mapping mp; + + /* Clear the uncovered region. */ + GtSetPixels (w, dst, GtPixel, rl[i].x, rl[i].y, rl[i].width, + rl[i].height, GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (mp = w->gterm.mp_head; mp && mp->mapping != mapping; + mp = mp->next) { + + if (mp->enabled && mp->dst == dst) { + r.x = mp->dx; + r.y = mp->dy; + r.width = mp->dnx; + r.height = mp->dny; + + if (rect_intersect (&in, &r, &rl[i])) + refresh_destination (w, mp, + in.x, in.y, in.width, in.height); + } + } + } + + free_mapping (w, n_mp); + free_mapping (w, o_mp); + mp = &w->gterm.mappings[mapping]; + mp->refresh = 0; +} + + +/* GtGetMapping -- Return the external parameters of a mapping. If the + * numberd mapping is undefined -1 is returned; 0 is returned if the + * mapping is defined but not enabled, and 1 is returned if the mapping + * is active. + */ +GtGetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int *rop; /* rasterop */ + int *src; /* 0=window, >0 = raster number */ + int *st; /* coordinate type for source raster */ + int *sx,*sy,*snx,*sny; /* source raster */ + int *dst; /* 0=window, >0 = raster number */ + int *dt; /* coordinate type for source raster */ + int *dx,*dy,*dnx,*dny; /* destination raster */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (-1); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (-1); + + *rop = mp->rop; + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *snx = mp->snx; *sny = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dnx = mp->dnx; *dny = mp->dny; + + return (mp->enabled != 0); +} + + +/* GtActiveMapping -- Query whether a mapping is active. + */ +GtActiveMapping (w, mapping) + register GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (0); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (0); + + return (mp->enabled != 0); +} + + +/* GtEnableMapping -- Enable a mapping. Enabling a mapping does not + * update the destination unless the refresh flag is set. Enabling a + * mapping activates the mapping so that any changes to the source will + * be mapped to the destination. + */ +GtEnableMapping (w, mapping, refresh) + GtermWidget w; + int mapping; /* mapping number */ + int refresh; /* refresh destination */ +{ + register Mapping mp; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (!mp->enabled) { + mp->enabled = True; + if (refresh) + GtRefreshMapping (w, mapping); + } + return (OK); + } + } + return (ERR); +} + + +/* GtDisableMapping -- Disable a mapping. Disabling a mapping does not + * affect the mapping definition, hence a disabled mapping may later be + * reenabled. If the ERASE flag is set the destination region is redrawn + * with the mapping disabled. + */ +GtDisableMapping (w, mapping, erase) + GtermWidget w; + int mapping; /* mapping number */ + int erase; /* erase the destination */ +{ + register int i; + register Mapping mp, dmp; + XRectangle r, d, in; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->enabled) { + mp->enabled = False; + + if (erase) { + d.x = mp->dx; + d.y = mp->dy; + d.width = abs(mp->dnx); + d.height = abs(mp->dny); + + /* Clear the uncovered region. */ + GtSetPixels (w, mp->dst, GtPixel, + d.x, d.y, d.width, d.height, + GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (dmp = w->gterm.mp_head; + dmp && dmp->mapping != mapping; dmp = dmp->next) { + + if (dmp->enabled && dmp->dst == mp->dst) { + r.x = dmp->dx; + r.y = dmp->dy; + r.width = dmp->dnx; + r.height = dmp->dny; + + if (rect_intersect (&in, &r, &d)) + refresh_destination (w, dmp, + in.x, in.y, in.width, in.height); + } + } + } + } + return (OK); + } + } + + return (ERR); +} + + +/* GtRefreshMapping -- Refresh the destination region defined by a mapping. + */ +GtRefreshMapping (w, mapping) + GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + struct mapping p_mp; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->st != GtPixel || mp->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 1); + update_mapping (w, mp = &p_mp); + } else + update_mapping (w, mp); + refresh_destination (w, mp, + mp->dx, mp->dy, abs(mp->dnx), abs(mp->dny)); + if (mp == &p_mp) + free_mapping (w, mp); + } + } +} + + +/* GtMapVector -- Map a point vector from the coordinate system of one raster + * to another as defined by the given mapping. The mapping may be either in + * the forward direction (dir = GtMap) or the reverse (dir = GtUnmap). The + * point vector is maintained in floating point for this operation to avoid + * loss of precision. The input and output vectors may be the same vector. + */ +GtMapVector (w, mapping, dir, pv1, pv2, npts) + GtermWidget w; + int mapping; + int dir; /* GtMap, GtUnmap */ + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register DPoint *ip = pv1; + register DPoint *op = pv2; + register Mapping mp; + register int n; + + struct mapping p_mp; + double xscale, xoffset; + double yscale, yoffset; + int sx, sy; + + xscale = yscale = 1.0; + xoffset = yoffset = 0.0; + sx = sy = 0; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (valid_mapping (w, mp)) { + /* Determine the transformation coefficients. */ + get_pixel_mapping (w, mp, &p_mp, 0); + mp = &p_mp; + + xscale = (float)mp->dnx / (float)mp->snx; + if (xscale < 0) + xoffset = mp->dx + abs(mp->dnx) - 1; + else + xoffset = mp->dx; + + yscale = (float)mp->dny / (float)mp->sny; + if (yscale < 0) + yoffset = mp->dy + abs(mp->dny) - 1; + else + yoffset = mp->dy; + + sx = mp->sx; + sy = mp->sy; + } + } + + /* Map the vector. */ + if (dir == GtMap) { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - sx) * xscale + xoffset; + op->y = (ip->y - sy) * yscale + yoffset; + } + } else { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - xoffset) / xscale + sx; + op->y = (ip->y - yoffset) / yscale + sy; + } + } +} + + +/* GtPixelToNDC -- Transform a vector from pixel to NDC coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtPixelToNDC (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ( ip->x) / rp->width * MAXNDC; + op->y = (rp->height - ip->y) / rp->height * MAXNDC; + } +} + + +/* GtNDCToPixel -- Transform a vector from NDC to pixel coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtNDCToPixel (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x / MAXNDC * rp->width; + op->y = rp->height - (ip->y / MAXNDC * rp->height); + } +} + + +/* GtDebug -- Print debug info. If the file descriptor is NULL output is + * to the process stdout. The "what" argument may be used to select the + * type of output desired. If what=0 the full output is generated, + * otherwise bits are used to select what output is to be generated. + * + * "what" bitflags: + * + * 001 Widget information + * 002 List rasters + * 004 List mappings + * 010 List colormaps + * 020 List markers + * + * This routine is intended only for use during debugging. + */ +GtDebug (w, fp, what) + GtermWidget w; + FILE *fp; + int what; +{ + /* Default is to write everything to the stdout. */ + what = what ? what : 0777; + fp = fp ? fp : stdout; + + /* Print widget header. */ + if (what & 001) { + fprintf (fp, "Widget 0x%x (%s) %dx%d raster=%d\n", + w, w->core.name, w->core.width, w->core.height, w->gterm.raster); + fprintf (fp, + "--------------------------------------------------------------\n"); + } + + /* Print raster information. */ + if (what & 002) { + register int i; + register Raster rp; + + if (w->gterm.rasters) { + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) + continue; + fprintf (fp, "raster %4d type=%s delete=%d size=%dx%d\n", + i, rp->type == ImageRaster ? "client" : "server", + rp->delete, rp->width, rp->height); + } + } else + fprintf (fp, "no rasters\n"); + } + + /* Print mapping information. */ + if (what & 004) { + register int i; + register Mapping mp; + char flags[32]; + + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + continue; + + flags[0] = mp->enabled ? 'E' : 'D'; + flags[1] = mp->updated ? 'U' : ' '; + flags[2] = mp->refresh ? 'R' : ' '; + flags[3] = '\0'; + + fprintf (fp, "mapping %3d %s %8o", i, flags, mp->rop); + fprintf (fp, " %2d %s %3d %3d %3d %3d", + mp->src, mp->st == GtPixel ? "pix" : "ndc", + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (fp, " %2d %s %3d %3d %3d %3d\n", + mp->dst, mp->dt == GtPixel ? "pix" : "ndc", + mp->dx, mp->dy, mp->dnx, mp->dny); + } + } else + fprintf (fp, "no mappings\n"); + + fprintf (fp, "mappings from head: "); + for (mp = w->gterm.mp_head; mp; mp = mp->next) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + + fprintf (fp, "mappings from tail: "); + for (mp = w->gterm.mp_tail; mp; mp = mp->prev) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + } + + /* Print colormap information. */ + if (what & 010) { + register struct colormap *cm; + + fprintf (fp, "cmapName=%s ncolors=%d basePixel=%d\n", + w->gterm.cmapName, w->gterm.ncolors, w->gterm.base_pixel); + for (cm = w->gterm.colormaps; cm; cm = cm->next) + fprintf (fp, "colormap %2d ncells=%d\n", cm->map, cm->ncells); + } + + /* Print marker information. */ + if (what & 020) { + register Marker mm; + char value[256]; + + for (mm = w->gterm.gm_head; mm; mm = mm->next) { + GmGetAttribute (mm, GmType, (XtArgVal)value, XtRString); + fprintf (fp, "marker 0x%x: %10s flags=0x%x [%d %d %d %d] %0.5g\n", + mm, value, mm->flags, mm->x, mm->y, mm->width, mm->height, + mm->rotangle); + } + } +} + + +/* + * Internal procedures for the above code. + * ---------------------------------------- + */ + +/* get_colormap -- Get a private colormap. On all calls after the first + * this just returns the existing gterm widget colormap. On the first call + * we query the server for the named custom colormap, and if the colormap + * exists we modify the gterm widget to use it. If the custom colormap has + * not yet been created by some other client, we create it. + * + * This code creates a custom colormap using the "standard colormap" + * facilities provided by XLIB. Although we do not use any of the predefined + * standard colormaps, use of the standard colormap facilities allows any + * number of clients to share the same custom colormap. Use of a custom + * colormap helps avoid running out of space in the default colormap, ensures + * that the gterm widget will get the color cells it needs, and makes it + * easier for several imaging clients which share the same colormap to + * simultaneously display their windows. + * + * To minimize colormap flashing we try to avoid using the full colormap, + * setting the unused cells to the colors set in the default colormap. In + * most cases this will prevent the rest of the screen from changing color + * when the custom colormap is installed. + */ +static Colormap +get_colormap (w) + GtermWidget w; +{ + register int i, j; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + XColor def_colors[SZ_STATIC_CMAP], *cp, *c1, *c2; + XStandardColormap cm, *cm_p; + XColor colors[MAX_SZCMAP]; + int base_pixel, p1, p2; + Colormap colormap; + char property[128]; + int ncmap, nitems; + Pixel pixel; + Atom atom; + + if (w->gterm.haveColormap) + return (w->core.colormap); + + /* Map custom colormap name to atom. */ + sprintf (property, "GT_%s", w->gterm.cmapName); + atom = XInternAtom (display, property, False); + w->gterm.cmapAtom = atom; + + /* Get custom colormap. + */ + if (!w->gterm.cmapInitialize && + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom)) { + + /* Colormap aleady exists, just use it. + */ + cm = *cm_p; + colormap = cm.colormap; + w->gterm.base_pixel = cm.base_pixel; + + } else { + /* Create or reinitialize a global colormap. + */ + XVisualInfo template, *vi; + Display *d; + Screen *s; + Window root; + long mask; + + if (!(d = XOpenDisplay (DisplayString(display)))) + goto use_default; + s = DefaultScreenOfDisplay (d); + root = DefaultRootWindow (d); + + /* Try to get a pseudocolor visual. */ + mask = 0; + template.screen = DefaultScreen(d); mask |= VisualScreenMask; + template.depth = RasterDepth; mask |= VisualDepthMask; + template.class = PseudoColor; mask |= VisualClassMask; + + if (!(vi = XGetVisualInfo (d, mask, &template, &nitems))) { + XCloseDisplay (d); + goto use_default; + } + + /* Create custom colormap with all cells allocated read/write */ + colormap = XCreateColormap (d, root, vi->visual, AllocAll); + + /* Initialize colormap to be same as default colormap. */ + nitems = min (MAX_SZCMAP, CellsOfScreen(s)); + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (d, DefaultColormapOfScreen(s), colors, nitems); + XStoreColors (d, colormap, colors, nitems); + + /* Globally define permanent server custom colormap. */ + memset ((char *)&cm, 0, sizeof(cm)); + cm.colormap = colormap; + cm.base_pixel = w->gterm.base_pixel; + cm.red_max = 0; + cm.visualid = vi->visualid; + cm.killid = 1; + XSetRGBColormaps (d, root, &cm, 1, atom); + + XSetCloseDownMode (d, RetainPermanent); + XCloseDisplay (d); + w->gterm.cmapInitialize = False; + } + + /* Save default color assignments for static colors. */ + for (i=0; i < SZ_STATIC_CMAP; i++) + def_colors[i] = w->gterm.color[i]; + + nitems = min (MAX_SZCMAP, CellsOfScreen(screen)); + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + base_pixel = w->gterm.base_pixel; + + /* Get the private colormap. */ + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (display, colormap, colors, nitems); + + /* Initialize the raster pixel to display pixel mapping and set the + * color assigned to each pixel value in the private colormap. + */ + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, base_pixel + i - SZ_STATIC_CMAP); + w->gterm.color[i] = colors[pixel]; + } + + /* Check the static part of the cmap to make sure that the pixel numbers + * aren't aliased to pixels in the dynamic part of the custom colormap. + * If this happens, reassign these color numbers to the pixels just + * preceeding the dynamic part of the custom colormap. The red_max + * field of the colormap descriptor is used to keep track of the number + * of static colors allocated by different clients. These static colors + * are shared, hence the same color will not be stored twice. + */ + p1 = p2 = base_pixel - cm.red_max; + for (i=0; i < SZ_STATIC_CMAP; i++) { + pixel = w->gterm.cmap[i]; + if (pixel >= base_pixel && pixel < base_pixel+DEF_MAXCOLORS && p1 > 2) { + /* First check to see if we already have a static entry reserved + * for this color. + */ + c1 = &def_colors[i]; + for (j=p1, cp=NULL; j < base_pixel; j++) { + c2 = &colors[j]; + if (c1->red == c2->red && c1->green == c2->green && + c1->blue == c2->blue) { + cp = c2; + break; + } + } + + /* Assign a new screen pixel value. */ + if (cp) + w->gterm.cmap[i] = cp->pixel; + else { + cp = &colors[--p1]; + *cp = def_colors[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = w->gterm.cmap[i] = p1; + cm.red_max++; + } + w->gterm.color[i].pixel = w->gterm.cmap[i]; + } + } + if (p1 < p2) { + XStoreColors (display, colormap, &colors[p1], p2 - p1); + XSetRGBColormaps (display, w->gterm.root, &cm, 1, atom); + } + + /* Assign the new colormap to the gterm widget's window. */ + XtVaSetValues ((Widget)w, XtNcolormap, (XtArgVal)colormap, NULL); + w->gterm.haveColormap++; + + /* If the pointer is in the window, advise window manager to load the + * colortable for the window. + */ + if (w->gterm.in_window) + request_colormap_focus (w); + + return (colormap); + +use_default: + /* Unable to create custom colormap. */ + w->gterm.useDefaultCM++; + w->gterm.haveColormap++; + return (w->core.colormap); +} + + +/* request_colormap_focus -- Modify the WM_COLORMAP_WINDOWS property on a + * widget's top level shell window to advise the window manager that the + * widget's window should have its colormap loaded. This should only be + * used for windows that have a colormap different than that of the top + * level window. + */ +static +request_colormap_focus (w) + GtermWidget w; +{ + Widget p; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Find the top level window. */ + for (p = XtParent(w); !XtIsShell(p); p = XtParent(p)) + ; + + /* Modify WM_COLORMAP_WINDOWS to give the current window priority. + */ + if (p) { + Window window = XtWindow (p); + Window *wl = NULL, n_wl[MAX_WMWIN+1]; + register int n_nw, i; + int nw; + + /* If WM_COLORMAP_WINDOWS is already set save its value, otherwise + * start a list initially containing only the top level window. + */ + w->gterm.wmTop = window; + if (XGetWMColormapWindows (w->gterm.display, window, &wl, &nw)) { + memmove (w->gterm.wmWindows, (char *)wl, nw * sizeof(int)); + w->gterm.n_wmWindows = nw = min (nw, MAX_WMWIN); + free ((char *)wl); + } else { + w->gterm.wmWindows[0] = window; + w->gterm.n_wmWindows = nw = 1; + } + + n_nw = 0; + wl = w->gterm.wmWindows; + n_wl[n_nw++] = XtWindow(w); + + for (i=0; i < nw; i++) + if (wl[i] != XtWindow(w)) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, window, n_wl, n_nw); + } +} + + +/* restore_colormap_focus -- Reset WM_COLORMAP_WINDOWS. Retain the window + * that had the focus in the list, but drop its priority one notch. This + * should follow a prior call to request_colormap_focus. + */ +static +restore_colormap_focus (w) + GtermWidget w; +{ + register int nw, n_nw, i; + Window *wl, n_wl[MAX_WMWIN+1], old; + + if (!XtIsRealized ((Widget)w)) + return; + + old = XtWindow(w); + wl = w->gterm.wmWindows; + if ((nw = w->gterm.n_wmWindows) == 0 || (nw == 1 && wl[0] == old)) + return; + + n_nw = 0; + if (wl[0] != old) + n_wl[n_nw++] = wl[0]; + n_wl[n_nw++] = old; + + for (i=1; i < nw; i++) + if (wl[i] != old) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, w->gterm.wmTop, n_wl, n_nw); +} + + +/* inherit_default_colormap -- Set any unused cells of the custom colormap + * to the colors defined for the corresponding cells of the default colormap. + * This minimizes colormap flashing when using a custom colormap, but only + * works if a few unused cells can be reserved, e.g., at the beginning of + * the colormap (which is usually where X allocates its colors). + */ +static +inherit_default_colormap (w) + GtermWidget w; +{ + register XColor *cp, *ap; + register int ncolors, i; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + Window root = w->gterm.root; + Atom atom = w->gterm.cmapAtom; + XColor colors[MAX_SZCMAP]; + XStandardColormap *cm; + int first, nitems, ncmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.base_pixel <= 0) + return; /* fully allocated colormap */ + + /* We have to read the colormap property again as another client could + * have reserved more static colors (i.e.,changed red_max), and we don't + * want to clobber these colors. + */ + if (XGetRGBColormaps (display, root, &cm, &ncmap, atom)) { + /* Make sure we have the right colormap. */ + if (w->core.colormap != cm->colormap) + XtVaSetValues ((Widget)w,XtNcolormap,(XtArgVal)cm->colormap,NULL); + + /* Get lower part of default colormap. */ + ncolors = cm->base_pixel - cm->red_max; + for (cp=colors, i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = i; + } + + /* Get upper part of default colormap. */ + first = cm->base_pixel + w->gterm.ncolors - SZ_STATIC_CMAP; + ncolors = min (MAX_SZCMAP, CellsOfScreen(screen)) - first; + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = first + i; + } + + /* Inherit values from default colormap. */ + ncolors = cp - colors; + XQueryColors (display, DefaultColormapOfScreen(screen), + colors, ncolors); + XStoreColors (display, w->core.colormap, colors, ncolors); + + /* The global gterm colormap may have changed. Compare widget's + * version of color table with the global colortable and update + * the widget's state if the global colortable has changed. + */ + ncolors = w->gterm.ncolors; + memmove (colors, w->gterm.color, ncolors * sizeof(*cp)); + XQueryColors (display, w->core.colormap, colors, ncolors); + for (i=ncolors, cp=colors, ap=w->gterm.color; --i >= 0; cp++, ap++) + if (cp->red != ap->red || cp->green != ap->green || + cp->blue != ap->blue) { + memmove (w->gterm.color, colors, ncolors * sizeof(*cp)); + invalidate_cmap (w); + } + } +} + + +/* update_default_colormap -- Update the default colormap so that any + * unallocated cells mirror the widget's custom colormap. This increases + * the chance that the widget's contents will be visible when the window + * does not have the colormap focus, and minimizes flashing when the + * colormap focus changes. + */ +static +update_default_colormap (w) + GtermWidget w; +{ + register XColor *ip, *op; + register int j, n; + register Pixel v; + + XColor colors[MAX_SZCMAP]; + Pixel pixels[MAX_SZCMAP]; + char allocated[MAX_SZCMAP]; + int overflow, req, need, first, nelem, i; + unsigned long plane_masks[1]; + Colormap defcmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + + first = SZ_STATIC_CMAP; + nelem = w->gterm.ncolors; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + /* need = min (MAX_SZCMAP, first + nelem - SZ_STATIC_CMAP); */ + need = MAX_SZCMAP; + + /* Get the colormap cells. */ + for (req=need, n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, defcmap, False, + plane_masks, 0, &pixels[n], req)) { + n += req; + } else + req /= 2; + + /* Perform the color matching. This is awkward as the pixel value + * assignments may be different in the two colormaps. We have to look + * up each pixel before attempting to assign a color, or XStoreColors + * below will result in a server error. + */ + memset (allocated, 0, sizeof(allocated)); + overflow = 0; + + for (i=0; i < n; i++) { + v = pixels[i]; + if (v < MAX_SZCMAP) + allocated[v] = 1; + else { + overflow++; + break; + } + } + + ip = &w->gterm.color[first]; + op = colors; + if (overflow) { + for (i=0; i < nelem; i++, ip++) + for (j=0, v = ip->pixel; j < n; j++) + if (pixels[j] == v) { + *op++ = *ip; + break; + } + } else { + for (j=0; j < nelem; j++, ip++) + if (allocated[ip->pixel]) { + allocated[ip->pixel] = 0; + *op++ = *ip; + } + } + + if (op > colors) + XStoreColors (w->gterm.display, defcmap, + colors, op - colors); + + XFreeColors (w->gterm.display, defcmap, pixels, n, 0); +} + + +/* refresh_source -- Refresh a portion of a mapping given the source rect + * to be refreshed. If the given source rect is not within the mapping, + * this is a no-op. + */ +static +refresh_source (w, mp, x1, y1, nx, ny) + GtermWidget w; + register Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of source to be refreshed */ +{ + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Compute the intersection of the modified region of the source raster + * with the rectangular region of the source raster affected by the given + * mapping. + */ + sx1 = max (x1, mp->sx); + sy1 = max (y1, mp->sy); + sx2 = min(x1 + nx, mp->sx + mp->snx) - 1; + sy2 = min(y1 + ny, mp->sy + mp->sny) - 1; + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + /* Do nothing if the rectangles do not intersect. */ + if (snx <= 0 || sny <= 0) + return (OK); + + /* Compute the destination rect affected by the mapped source rect. + */ + dx1 = mp->x_extent[sx1 - mp->sx].lo; + dx2 = mp->x_extent[sx2 - mp->sx].hi; + if (dx1 > dx2) { + dx1 = mp->x_extent[sx2 - mp->sx].lo; + dx2 = mp->x_extent[sx1 - mp->sx].hi; + } + + dy1 = mp->y_extent[sy1 - mp->sy].lo; + dy2 = mp->y_extent[sy2 - mp->sy].hi; + if (dy1 > dy2) { + dy1 = mp->y_extent[sy2 - mp->sy].lo; + dy2 = mp->y_extent[sy1 - mp->sy].hi; + } + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + /* Perform the refresh operation. */ + return (refresh_destination (w, mp, dx1, dy1, dnx, dny)); +} + + +/* refresh_destination -- Refresh (redraw) the pixels in the given destination + * rect. The mapping operand defines how to generate the value of each output + * pixel. This is the routine which does all the real work of a mapping, + * computing the values of the output pixels and writing to the destination + * drawable. Note: the destination rect must be specified in raster pixel + * coordinates (no NDC). + */ +static +refresh_destination (w, mp, x1, y1, nx, ny) + GtermWidget w; + Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of destination to be refreshed */ +{ + Raster sr, dr; + Display *display = w->gterm.display; + int scaling, xflip, yflip, delxin=0, delxout=0; + int ox, oy, rop, clip, mapping, i, j; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int xoff, yoff, p1, p2, q1, q2; + float xscale, yscale; + struct mapping *np, p_mp; + XImage *xin, *xout; + int status = OK; + + Region clip_region, mask_region; + uchar *old_xin_lp, *old_xout_lp; + uchar *xin_lp, *xout_lp, *op; + int xin_bpl, xout_bpl; + int *xmap, *ymap; + XRectangle r; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Offsets into the x_*,y_* mapping lookup tables. */ + xoff = x1 - mp->dx; + yoff = y1 - mp->dy; + + /* Get source and destination rects. */ + dst = mp->dst; + dx = x1; dy = y1; + dnx = nx; dny = ny; + + src = mp->src; + p1 = mp->x_srcpix[xoff]; + q1 = mp->y_srcpix[yoff]; + p2 = mp->x_srcpix[xoff + nx - 1]; + q2 = mp->y_srcpix[yoff + ny - 1]; + sx = min (p1, p2); + sy = min (q1, q2); + snx = abs (p2 - p1) + 1; + sny = abs (q2 - q1) + 1; + + /* Define some local variables. */ + sr = &w->gterm.rasters[src]; + dr = &w->gterm.rasters[dst]; + mapping = mp->mapping; + scaling = mp->scaling; + xscale = mp->xscale; + yscale = mp->yscale; + rop = mp->rop; + + if (!sr->type || !dr->type) + return (ERR); + if (snx <= 0 || sny <= 0 || dnx == 0 || dny == 0) + return (ERR); + if (src < 0 || src > w->gterm.maxRasters || + dst < 0 || dst > w->gterm.maxRasters) + return (ERR); + + /* Do we have a flip in X or Y? */ + xflip = mp->dnx < 0; + yflip = mp->dny < 0; + + /* Any higher numbered mappings which map to the same destination as the + * mapping MP will obscure the current mapping. Construct a clip mask + * defining the region of the destination we can write to. This will be + * the region not obscured by any higher numbered, active mappings. + */ + clip = False; + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; +#ifdef sun + /* As far as I can tell the Sun (probably in the OW X server) has an + * off by one bug affecting clipping in the server. A clip region is + * too small by one pixel at the right and bottom, causing these pixels + * to not be written when refreshing the screen (usually this shows up + * as black lines on the screen when a region is refreshed). So far + * I haven't seen this on any other platform. The problem is imperfectly + * understood and the following workaround may not completely workaround + * the problem. + */ + r.width++; r.height++; +#endif + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + + if (XRectInRegion (clip_region, + r.x, r.y, r.width, r.height) != RectangleOut) { + + mask_region = XCreateRegion(); + XUnionRectWithRegion (&r, mask_region, mask_region); + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + clip++; + } + } + + if (clip && dr->type == PixmapRaster) + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + + /* Handle the special case of a pixmap to pixmap (or window) copy in + * the server with no scaling. + */ + if (!scaling && sr->type == PixmapRaster && dr->type == PixmapRaster) { + if (src == 0 && dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XCopyArea (display, w->gterm.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XCopyArea (display, sr->r.pixmap, dr->r.pixmap, w->gterm.exposeGC, + sx, sy, snx, sny, dx, dy); + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) + XCopyArea (display, sr->r.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + } + goto done; + } + + /* Any other case requires working on ximages in the client. The first + * step is to get the source ximage. + */ + if (sr->type == PixmapRaster) { + /* Source is a pixmap but we need a local copy as either the + * destination is not a pixmap, or we need to do some scaling. + */ + xin = XGetImage (display, + (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } + delxin++; + + } else { + /* Source is an ximage. */ + xin = sr->r.ximage; + } + + /* Handle the special case of a copy of an ximage to an output pixmap + * with no scaling. + */ + if (!scaling && dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + } + goto done; + } + + /* Get output ximage. */ + if (dr->type == ImageRaster) { + xout = dr->r.ximage; + ox = dx; oy = dy; + } else { + uchar *data = (uchar *) XtMalloc (dnx * dny); + if (data == NULL) { + status = ERR; + goto done; + } + xout = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, dnx, dny, 8, 0); + if (xout == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + ox = 0; oy = 0; + delxout++; + } + + xin_lp = (uchar *)xin->data; + xout_lp = (uchar *)xout->data; + xin_bpl = xin->bytes_per_line; + xout_bpl = xout->bytes_per_line; + + /* Map a region of the input ximage XIN to the output ximage XOUT. Various + * approaches are used to generate the output data, depending upon what + * type of scaling we are doing. + */ + if (!scaling) { + /* No scaling. Copy a region of the ximage xin to xout without + * spatially scaling the image data. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + xin_lp = (uchar *)xin->data + sy * xin_bpl; + xout_lp = (uchar *)xout->data + oy * xout_bpl + ox; + + for (j=0; j < dny; j++) { + memmove (xout_lp, xin_lp, dnx); + xin_lp += xin_bpl; + xout_lp += xout_bpl; + } + + } else if (scaling == M_INTZOOM) { + /* Integer zoom. The zoom factor is an integer, allowing the zoomed + * image to be calculated without using the xmap,ymap lookup tables. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + scale_intzoom (xin_lp,xin_bpl, xout_lp,xout_bpl, sx,sy, ox,oy,dnx,dny, + xflip,yflip, (int)(xscale + 0.5), (int)(yscale + 0.5)); + + } else if (scaling == M_ZOOM) { + /* We have a zoom, or one-to-many, scaling. Zoom scaling is always + * done with pixel replication. The [xy]_srcpix arrays in the mapping + * descriptor give the source pixel corresponding to each mapped pixel + * in the destination raster. + */ +zoom: + xmap = &mp->x_srcpix[xoff]; + ymap = &mp->y_srcpix[yoff]; + + scale_zoom (xin_lp, xin_bpl, xout_lp, xout_bpl, + xmap, ymap, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL); + + } else if (scaling == M_DEZOOM) { + /* We have a dezoom, or many-to-one, scaling. A block of pixels in + * the input raster are combined to generate the value of each output + * pixel, using one of several antialias algorithms to compute the + * output pixel value. + */ + float *x_src = &mp->x_src[xoff]; + float *y_src = &mp->y_src[yoff]; + int near_unitary = (xscale > 0.5 && yscale > 0.5); + int function; + + /* Get the antialising function to be applied. */ + if (!(function = (mp->rop & R_MFMask))) + function = MF_NEAREST; + + /* If the dezoom factor is small and either MF_BILINEAR or + * MF_NEAREST is enabled, use the indicated method to sample the + * input data. This uses all the data but minimizes smoothing. + */ + if ((function & (MF_BILINEAR|MF_NEAREST)) && near_unitary) + function = (function & MF_BILINEAR) ? MF_BILINEAR : MF_NEAREST; + else if (function != (function & (MF_BILINEAR|MF_NEAREST))) + function &= ~(MF_BILINEAR|MF_NEAREST); + +filter: + /* This can take a while so update the display. */ + XFlush (w->gterm.display); + + /* If the filtering operation involves any arithmetic combinations + * of pixels we must convert pixel numbers to pixel intensity values + * before performing the filtering operation. This is a case where + * we would be better off if frame buffers were maintained using + * pixel intensities rather than hardware pixel numbers. + */ + if (function != MF_NEAREST) { + uchar *data = (uchar *) XtMalloc (xin->width * xin->height); + if (data == NULL) { + status = ERR; + goto done; + } + + mf_getinten (w, + xin_lp, xin->width, xin->height, xin_bpl, sx,sy, + data, xin->width, xin->height, xin_bpl, sx,sy, snx,sny); + + if (!delxin) { + xin = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, xin->width, xin->height, 8, 0); + if (xin == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + delxin++; + } else { + XtFree ((char *)xin->data); + xin->data = (char *) data; + } + xin_lp = (uchar *)xin->data; + } + + /* Filter the source rect to the destination. */ + switch (function) { + case MF_NEAREST: + scale_nearest ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BILINEAR: + scale_bilinear ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BLKAVG: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 0, clip ? clip_region : (Region)NULL + ); + break; + case MF_BOXCAR: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 1, clip ? clip_region : (Region)NULL + ); + break; + case MF_LOWPASS: + scale_lowpass ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, clip ? clip_region : (Region)NULL + ); + break; + default: + function = MF_BILINEAR; + goto filter; + } + + /* If the operation was performed in intensity space convert back + * to pixel number. + */ + if (function != MF_NEAREST) + mf_getpixel (w, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, dnx,dny); + + } else { + status = ERR; + goto done; + } + + /* Copy the scaled ximage to the output pixmap, if any. + */ + if (dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + } + } + +done: + /* Clean up. + */ + if (delxin) + XDestroyImage (xin); + if (delxout) + XDestroyImage (xout); + + XDestroyRegion (clip_region); + if (clip && dr->type == PixmapRaster) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + + /* Execute any mappings defined on the raster just updated. */ + if (status == OK) { + GtRefreshPixels (w, dst, GtPixel, dx, dy, dnx, dny); + + if (dst == 0) { + Region clip_region = (Region)NULL; + XRectangle r; + + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; + XUnionRectWithRegion (&r, clip_region, clip_region); + + update_transients (w, clip_region); + XDestroyRegion (clip_region); + } + } + + return (status); +} + + +/* scale_zoom -- Compute the given destination rect from the input image, + * using pixel replication and the given x and y dst->scr pixels maps. + */ +static +scale_zoom (idata,ibpl, odata,obpl, xmap,ymap, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + register int *xmap; /* src coords of each dst pixel */ + int *ymap; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i, j; + register uchar *ip, *op; + uchar *last_ip = NULL; + uchar *last_op = NULL; + + for (j=0; j < dny; j++) { + ip = idata + ymap[j] * ibpl; + op = odata + (j+dy) * obpl + dx; + + if (!clip_region) { + if (ip == last_ip) + memmove (op, last_op, dnx); + else { + for (i=0; i < dnx; i++) + op[i] = ip[xmap[i]]; + } + last_ip = ip; + last_op = op; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = ip[xmap[i]]; + } + } +} + + +/* scale_intzoom -- Compute the given destination rect from the input image, + * using pixel replication and integer scaling. This is functionally + * equivalent to scale_zoom using the lookup tables, but optimized for the + * case of integer scaling. + */ +static +scale_intzoom (idata,ibpl,odata,obpl, sx,sy,dx,dy,dnx,dny, xflip,yflip, nx,ny) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + int sx, sy; /* start coords of src rect */ + int dx, dy, dnx, dny; /* destination rect */ + int xflip, yflip; /* set if x or y is flipped */ + int nx, ny; /* replication factors */ +{ + register int n; + register int pix; + register uchar *ip, *op; + uchar *otop, *olast, *lp; + int i, j, k; + + olast = odata + (dy + dny) * obpl - dnx + dx; + + if (xflip) { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = odata + (dy + yflip ? (dny-ny-j) : j) * obpl + dx + dnx; + otop = lp = op - dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *--op = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op > otop) + *--op = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } else { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = lp = odata + (dy + yflip ? (dny-ny-j) : j) * obpl + dx; + otop = op + dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *op++ = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op < otop) + *op++ = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } +} + + +/* scale_nearest -- Compute the given destination rect from the input image, + * using the nearest neighbor technique. + */ +static +scale_nearest (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i, j; + register uchar *op; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = y_src[j]; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* scale_bilinear -- Compute the given destination rect from the input image, + * using bilinear interpolation. + */ +static +scale_bilinear (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = x_src[i] - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = y_src[j] - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* scale_lowpass -- Apply a lowpass filter to a region of a 2D data array. + * The region ox,oy,nx,ny of the output data array is calculated by running + * a convolution kernel over the region of the input data array at ix,iy. + * The size of the convolution kernel is adjusted to match the scale factors + * xscale, yscale. + */ +static +scale_lowpass (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + Region clip_region; /* clip Region or null */ +{ + uchar *data; + + if ((data = (uchar *) XtMalloc (inx * iny)) == NULL) + return; + + /* Run a lowpass filter over the input rect. */ + lw_convolve (idata,inx,iny,ibpl, sx,sy, data,inx,iny,ibpl, sx,sy, + snx,sny, xscale,yscale); + + /* Sample the filtered data to generate the output rect. */ + scale_nearest (data,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + dx,dy,dnx,dny, clip_region); + + XtFree ((char *)data); +} + + +/* lw_convolve -- Convolution primitive for scale_lowpass. + */ +static +lw_convolve (idata,inx,iny,ibpl,ix,iy, odata,onx,ony,obpl,ox,oy, + nx, ny, xscale, yscale) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ix, iy; /* size of input array, start pos */ + int onx, ony, ox, oy; /* size of output array, start pos */ + int ibpl, obpl; /* bytes per line */ + int nx, ny; /* size of output region */ + float xscale, yscale; /* determines amount of smoothing */ +{ + register uchar *ip; + register int l, m, x, hx, pixval; + int kx, ky, hy, i, j, y; + uchar *lp[11], *op; + + /* Determine kernel size (min 3x3, max 7x7). */ + if (xscale < 0.1) + hx = 3; + else if (xscale >= 0.5) + hx = 1; + else + hx = ((int)(1.0 / xscale)) / 2; + + if (yscale < 0.1) + hy = 3; + else if (yscale >= 0.5) + hy = 1; + else + hy = ((int)(1.0 / yscale)) / 2; + + kx = hx * 2 + 1; + ky = hy * 2 + 1; + + /* Compute the output data. + */ + for (j=0; j < ny; j++) { + /* Get line pointers. */ + op = odata + (j+oy) * obpl + ox; + for (i=0; i < ky; i++) { + y = iy + j - hy + i; + if (y < 0) + y = 0; + else if (y >= iny) + y = iny - 1; + lp[i] = y * ibpl + idata; + } + + /* Compute a line of output pixels */ + for (i=0; i < nx; i++) { + x = ix + i; + pixval = 0; + + if (x < hx) { + /* Near left edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][max(0,x-hx+l)]; + } else if (x >= inx - hx) { + /* Near right edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][min(inx-1,x-hx+l)]; + } else { + /* In central region. */ + for (m=0; m < ky; m++) { + ip = lp[m] + x - hx; + for (l=0; l < kx; l++) + pixval += ip[l]; + } + } + + op[i] = (float)pixval / (float)(kx * ky) + 0.5; + } + } +} + + +/* scale_boxcar -- Apply a boxcar filter to a region of a 2D data array + * and interpolate the result to the output grid. The region ox,oy,nx,ny of + * the output data array is calculated by block averaging the corresponding + * source rect and then sampling the reduced image using bilinear interpolation + * to compute the output pixel raster. This antialiasing technique aims to + * be as fast as possible but still does a reasonable job of reducing the + * image. + */ +static +scale_boxcar (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, interp, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + int interp; /* set if interpolation is desired */ + Region clip_region; /* clip Region or null */ +{ + int xblock, yblock; + int x1, x2, y1, y2, nx, ny; + float xstep, ystep; + int xoff, yoff; + uchar *bp; + + /* Determine blocking factors. If interpolation is disabled we need + * to block one step more than for the linear interpolate case in order + * to ensure that all the data is used. + */ + xblock = max(1, (int) (1.0 / xscale)); + if (!interp && (1.0 / xscale) - xblock > ZOOM_TOL) + xblock++; + yblock = max(1, (int) (1.0 / yscale)); + if (!interp && (1.0 / yscale) - yblock > ZOOM_TOL) + yblock++; + + /* Align the input region for the given blocking factors. */ + x1 = sx / xblock * xblock; x2 = (sx + snx - 1) / xblock * xblock; + y1 = sy / yblock * yblock; y2 = (sy + sny - 1) / yblock * yblock; + nx = (x2 - x1) / xblock + 1; ny = (y2 - y1) / yblock + 1; + + /* Compute the block averaged input rect. */ + if (xblock > 1 || yblock > 1) { + if ((bp = (uchar *) XtMalloc (nx * ny)) == NULL) + return; + bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, bp, xblock, yblock); + idata = bp; + inx = ibpl = nx; + iny = ny; + xoff = x1; yoff = y1; + xstep = 1.0 / xblock; ystep = 1.0 / yblock; + } else { + bp = NULL; + xoff = yoff = 0; + xstep = ystep = 1.0; + } + + /* Interpolate the input rect to the output grid. */ + if (interp && + ((1.0 / xscale) - xblock) > ZOOM_TOL || + ((1.0 / yscale) - yblock) > ZOOM_TOL) { + + /* Use bilinear interpolation to compute the output grid. */ + bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + + } else { + /* Extract pixels from block averaged input data. */ + bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + } + + if (bp) + XtFree ((char *)bp); +} + + +/* bx_boxcar -- Block average primitive for scale_boxcar. + */ +static +bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, obuf, xblock, yblock) + uchar *idata; /* input data array */ + int inx, iny, ibpl; /* array dimensions */ + int x1,y1,x2,y2; /* region to be block averaged */ + uchar *obuf; /* output array */ + int xblock, yblock; /* blocking factors */ +{ + register uchar *ip, *op; + register int count, i, *sp; + int obpl, block, nxblocks, nyblocks, j, k; + uchar *lp, *bp; + int *sb; + + nxblocks = obpl = (x2 - x1) / xblock + 1; + nyblocks = (y2 - y1) / yblock + 1; + count = xblock * yblock; + + if ((sb = (int *) XtMalloc (obpl * sizeof(int))) == NULL) + return; + + /* I don't think the following works for pixel values allocated from the + * default colormap, as the pixel values are not sequentially allocated. + */ + for (block = 0; block < nyblocks; block++) { + lp = idata + ibpl * (block * yblock + y1) + x1; + bp = obuf + block * obpl; + + memset (sb, 0, obpl * sizeof(int)); + for (k=yblock; --k >= 0; lp += ibpl) + for (j=nxblocks, ip=lp, sp=sb; --j >= 0; sp++) + for (i=xblock; --i >= 0; ) + *sp += *ip++; + + for (i=obpl, sp=sb, op=bp; --i >= 0; ) + *op++ = *sp++ / count; + } + + XtFree ((char *)sb); +} + + +/* bx_extract -- Block extract primitive for scale_boxcar. + */ +static +bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i; + register uchar *op; + int j; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = (y_src[j] - yoff) * ystep; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* bx_interp -- Bilinear interpolation primitive for scale_boxcar. + */ +static +bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = ((x_src[i] - xoff) * xstep) - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = ((y_src[j] - yoff) * ystep) - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* mf_getinten -- Copy the source rect to the destination rect, converting + * pixel numbers to pixel intensities. + */ +static +mf_getinten (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_out (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* mf_getpixel -- Copy the source rect to the destination rect, converting + * pixel intensities to pixel numbers. + */ +static +mf_getpixel (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_in (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* get_regions -- For each pixel I in the sequence of DNX pixels starting at DX + * there is an associated value XMAP[I]. Compare this sequence to an alternate + * sequence and return a list of subregions {XS,XE,XV} for which the XMAP + * values are equal (XV=0), not equal (XV=1), or not common to (XV=2) the two + * regions. The number of regions output is returned as the function value. + */ +static +get_regions (xs,xe,xv, max_regions, dx, dnx, xmap, alt_dx, alt_dnx, alt_xmap) + int *xs, *xe, *xv, max_regions; + int dx, dnx, *xmap; + int alt_dx, alt_dnx, *alt_xmap; +{ + register int state, current; + register int nx, i; + int offset, old_i; + + offset = dx - alt_dx; + nx = 0; + + for (i=0; i < dnx; i++) { + if (nx >= max_regions-1) + return (0); + + /* Determine whether or not this pixel is mapped the same in both + * sequences. + */ + old_i = i + offset; + if (alt_dnx <= 0 || old_i < 0 || old_i >= alt_dnx) + state = 2; + else + state = (xmap[i] != alt_xmap[old_i]); + + /* When the state boundary is crossed add a range. */ + if (i == 0) { + xs[nx] = dx; + xv[nx] = current = state; + } + if (state != current) { + xe[nx] = dx + i - 1; + xs[++nx] = dx + i; + xv[nx] = current = state; + } + if (i == dnx-1) + xe[nx++] = dx + i; + } + + return (nx); +} + + +/* get_rects -- Combine two lists of regions, one in X and the other in Y, + * to produce a list of 2D rectangles defining the regions outlined by the + * region lists. Only rects for which the given condition is true in either + * X or Y are selected. Adjacent rects are combined. + */ +static +get_rects (o_rl, max_rects, xs,xe,xv,nx, ys,ye,yv,ny, xcond,ycond) + XRectangle *o_rl; /* receives list of rectangles */ + int max_rects; /* max rectangles out */ + int *xs, *xe, *xv, nx; /* X list of regions */ + int *ys, *ye, *yv, ny; /* Y list of regions */ + int xcond, ycond; /* X,Y condition bitflags */ +{ + register int i, j; + XRectangle rl[MAX_REGIONS]; + int limit = min (max_rects, MAX_REGIONS); + int o_nrects=0, nrects=0; + int i1, i2, j1, j2; + + /* Get initial list of rects matching the given X and Y conditions. + * Rects which are adjacent in X are combined to form one larger rect. + */ + for (j=0; j < ny; j++) { + for (i=0; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) { + /* Collapse rects adjacent in X. */ + for (i1 = i2 = i++; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) + i2 = i; + else + break; + } + + rl[nrects].x = xs[i1]; + rl[nrects].y = ys[j]; + rl[nrects].width = xe[i2] - xs[i1] + 1; + rl[nrects].height = ye[j] - ys[j] + 1; + + if (++nrects >= limit) + return (nrects); + } + } + } + + /* Now scan the rect list and collapse rects which are adjacent in Y + * into one larger rect. Find all the rects that are at the same X + * and write them to the output list, collapsing rects that are adjacent + * in Y in the process. + */ + for (i=0; i < nx; i++) + for (j=0; j < nrects; ) { + /* Find first rect if any. */ + for (j1=0, j2 = -1; j < nrects; j++) + if (rl[j].x == xs[i]) { + j1 = j2 = j++; + break; + } + + /* Collapse rects adjacent in Y. */ + for ( ; j < nrects; j++) + if (rl[j].x == xs[i]) + if (rl[j].y == rl[j2].y + rl[j2].height && + rl[j].width == rl[j1].width) + j2 = j; + else + break; + + /* Output the rect. */ + if (j2 >= j1) { + o_rl[o_nrects].x = rl[j1].x; + o_rl[o_nrects].y = rl[j1].y; + o_rl[o_nrects].width = rl[j1].width; + o_rl[o_nrects].height = rl[j2].y + rl[j2].height - rl[j1].y; + + if (++o_nrects >= max_rects) + return (o_nrects); + } + } + + return (o_nrects); +} + + +/* rect_intersect -- Compute the intersection of two rects. The area of + * the intersection is returned as the function value, i.e., zero is + * returned if the rects do not intersect. + */ +static +rect_intersect (in, r1, r2) + register XRectangle *in; + register XRectangle *r1, *r2; +{ + int x1, y1, x2, y2; + + x1 = max (r1->x, r2->x); + y1 = max (r1->y, r2->y); + x2 = min ((int)r1->x + (int)r1->width, (int)r2->x + (int)r2->width) - 1; + y2 = min ((int)r1->y + (int)r1->height, (int)r2->y + (int)r2->height) - 1; + + in->x = x1; + in->y = y1; + in->width = max (0, x2 - x1 + 1); + in->height = max (0, y2 - y1 + 1); + + return (in->width * in->height); +} + + +/* save_mapping -- Store a mapping in a mapping descriptor. + */ +static +save_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int mapping, rop; + int src, st, sx,sy,sw,sh; + int dst, dt, dx,dy,dw,dh; +{ + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = sw; mp->sny = sh; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dw; mp->dny = dh; + mp->defined = mp->enabled = mp->refresh = 1; + mp->mapping = mapping; + mp->rop = rop; +} + +/* load_mapping -- Load a mapping from a mapping descriptor. + */ +static +load_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int *mapping, *rop; + int *src, *st, *sx,*sy,*sw,*sh; + int *dst, *dt, *dx,*dy,*dw,*dh; +{ + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *sw = mp->snx; *sh = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dw = mp->dnx; *dh = mp->dny; + *mapping = mp->mapping; + *rop = mp->rop; +} + + +/* get_pixel_mapping -- Copy a mapping, converting to pixel coordinates in + * the process if the mapping is not already in pixel coordinates. + */ +static +get_pixel_mapping (w, mp1, mp2, update) + GtermWidget w; + register Mapping mp1; /* input mapping */ + register Mapping mp2; /* output mapping */ + int update; /* update mapping */ +{ + float maxndc = (float)MAXNDC; + + mp2->mapping = mp1->mapping; + mp2->refresh = mp1->refresh; + mp2->enabled = mp1->enabled; + mp2->rop = mp1->rop; + + if (!(mp2->defined = mp1->defined)) + return; + + mp2->src = mp1->src; + if (mp1->st == GtPixel) { + mp2->st = mp1->st; + mp2->sx = mp1->sx; mp2->sy = mp1->sy; + mp2->snx = mp1->snx; mp2->sny = mp1->sny; + } else { + float width = w->gterm.rasters[mp1->src].width; + float height = w->gterm.rasters[mp1->src].height; + mp2->sx = mp1->sx * width / maxndc; + mp2->sy = (MAXNDC - (mp1->sy + abs(mp1->sny))) * height / maxndc; + mp2->snx = mp1->snx * width / maxndc; + mp2->sny = mp1->sny * height / maxndc; /* NDC flipped in Y */ + mp2->st = GtPixel; + } + + mp2->dst = mp1->dst; + if (mp1->dt == GtPixel) { + mp2->dt = mp1->dt; + mp2->dx = mp1->dx; mp2->dy = mp1->dy; + mp2->dnx = mp1->dnx; mp2->dny = mp1->dny; + } else { + float width = w->gterm.rasters[mp1->dst].width; + float height = w->gterm.rasters[mp1->dst].height; + mp2->dx = mp1->dx * width / maxndc; + mp2->dy = (MAXNDC - (mp1->dy + abs(mp1->dny))) * height / maxndc; + mp2->dnx = mp1->dnx * width / maxndc; + mp2->dny = mp1->dny * -height / maxndc; /* NDC flipped in Y */ + mp2->dt = GtPixel; + } + + /* The lookup tables are already in pixel space, so we can propagate + * these to the new mapping if the old mapping was updated. + */ + if (update && mp1->updated) { + if (mp2->mapdata = (uchar *) XtMalloc (mp1->datalen)) { + + memmove (mp2->mapdata, mp1->mapdata, mp1->datalen); + mp2->datalen = mp1->datalen; + mp2->scaling = mp1->scaling; + mp2->xscale = mp1->xscale; + mp2->yscale = mp1->yscale; + + mp2->x_extent = (mapExtent *) + ((uchar *)mp1->x_extent - mp1->mapdata + mp2->mapdata); + mp2->y_extent = (mapExtent *) + ((uchar *)mp1->y_extent - mp1->mapdata + mp2->mapdata); + mp2->x_srcpix = (int *) + ((uchar *)mp1->x_srcpix - mp1->mapdata + mp2->mapdata); + mp2->y_srcpix = (int *) + ((uchar *)mp1->y_srcpix - mp1->mapdata + mp2->mapdata); + mp2->x_src = (float *) + ((uchar *)mp1->x_src - mp1->mapdata + mp2->mapdata); + mp2->y_src = (float *) + ((uchar *)mp1->y_src - mp1->mapdata + mp2->mapdata); + + mp2->updated = 1; + } + } else + mp2->updated = 0; +} + +/* valid_mapping -- Perform some sanity checks on a mapping to verify that + * it contains something meaningful. + */ +static +valid_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register int x, y; + int snx, sny, dnx, dny; + int s_width, s_height, d_width, d_height; + Raster sr, dr; + + if (!mp || !mp->defined) + return (False); + + if (mp->src < 0 || mp->src >= w->gterm.maxRasters) + return (False); + if (mp->dst < 0 || mp->dst >= w->gterm.maxRasters) + return (False); + + sr = &w->gterm.rasters[mp->src]; + dr = &w->gterm.rasters[mp->dst]; + if (!sr->type || !dr->type) + return (False); + + switch (mp->st) { + case GtPixel: + s_width = sr->width; s_height = sr->height; + break; + case GtNDC: + s_width = MAXNDC + 1; s_height = MAXNDC + 1; + break; + default: + return (False); + } + + switch (mp->dt) { + case GtPixel: + d_width = dr->width; d_height = dr->height; + break; + case GtNDC: + d_width = MAXNDC + 1; d_height = MAXNDC + 1; + break; + default: + return (False); + } + + snx = mp->snx; dnx = abs(mp->dnx); + sny = mp->sny; dny = abs(mp->dny); + if (snx <= 0 || dnx <= 0 || sny <= 0 || dny <= 0) + return (False); + + x = mp->sx; y = mp->sy; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + x = mp->sx + snx - 1; y = mp->sy + sny - 1; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + + x = mp->dx; y = mp->dy; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + x = mp->dx + dnx - 1; y = mp->dy + dny - 1; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + + return (True); +} + + +/* initialize_mapping -- Initialize the contents of a mapping descriptor. + */ +static +initialize_mapping (mp) + register Mapping mp; +{ + memset ((char *)mp, 0, sizeof(struct mapping)); +} + + +/* update_mapping -- Update the portion of a mapping descriptor used at + * runtime to execute the mapping. This information consists of several + * lookup tables and other parameters describing how a destination pixel + * maps back to a source pixel and vice versa. + */ +static +update_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register uchar *op; + register int i, j, k; + int snx, sny, dnx, dny, sx, sy, dx, dy; + int xmax, ymax, lo, hi, edge1, edge2; + int temp, xflip=0, yflip=0; + struct mapping p_mp; + float pixwidth, *fp; + int *ip; + + if (mp->updated) + return; + + /* The internal lookup tables are in pixel units. */ + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 0); + + if ((snx = p_mp.snx) <= 0 || (sny = p_mp.sny) <= 0) + return; + + if ((dnx = p_mp.dnx) < 0) { + dnx = -dnx; + xflip++; + } + if ((dny = p_mp.dny) < 0) { + dny = -dny; + yflip++; + } + + sx = p_mp.sx; + sy = p_mp.sy; + dx = p_mp.dx; + dy = p_mp.dy; + xmax = dnx - 1; + ymax = dny - 1; + + /* Get scale factors. */ + mp->xscale = (float)dnx / (float)snx; + mp->yscale = (float)dny / (float)sny; + + /* Determine type of scaling to be used. */ + if (mp->xscale < 1.0 || mp->yscale < 1.0) { + mp->scaling = M_DEZOOM; + } else if (mp->xscale > 1.0 || mp->yscale > 1.0) { + mp->scaling = M_ZOOM; + if (abs(mp->xscale - (int)(mp->xscale+0.5)) < ZOOM_TOL && + abs(mp->yscale - (int)(mp->yscale+0.5)) < ZOOM_TOL) + mp->scaling = M_INTZOOM; + } else + mp->scaling = (xflip || yflip) ? M_ZOOM : M_NOSCALING; + + /* Get a data buffer for the lookup tables. */ + mp->datalen = + snx * sizeof(mapExtent) + /* xy, extent */ + sny * sizeof(mapExtent) + + dnx * sizeof(int) + /* xy, srcpix */ + dny * sizeof(int) + + dnx * sizeof(float) + /* xy, src */ + dny * sizeof(float); + + if (mp->mapdata) + mp->mapdata = (uchar *) XtRealloc ((char *)mp->mapdata, mp->datalen); + else + mp->mapdata = (uchar *) XtMalloc (mp->datalen); + if (mp->mapdata == NULL) + return; + + /* Set the table pointers. */ + op = mp->mapdata; + mp->x_extent = (mapExtent *) op; op += snx * sizeof(mapExtent); + mp->y_extent = (mapExtent *) op; op += sny * sizeof(mapExtent); + mp->x_srcpix = (int *) op; op += dnx * sizeof(int); + mp->y_srcpix = (int *) op; op += dny * sizeof(int); + mp->x_src = (float *) op; op += dnx * sizeof(float); + mp->y_src = (float *) op; op += dny * sizeof(float); + + /* Compute the backpointers to the source raster for each destination + * pixel center. + */ + for (i=0, ip = mp->x_srcpix, fp = mp->x_src; i < dnx; i++) { + fp[i] = ((xflip ? xmax - i : i) + 0.5) / mp->xscale + sx; + ip[i] = fp[i]; + } + for (i=0, ip = mp->y_srcpix, fp = mp->y_src; i < dny; i++) { + fp[i] = ((yflip ? ymax - i : i) + 0.5) / mp->yscale + sy; + ip[i] = fp[i]; + } + + /* Compute the extent arrays. These define the range of destination + * pixels affected by each source pixel. + */ + lo = dnx - 1 + dx; + hi = dx; + for (i=0; i < snx; i++) { + mp->x_extent[i].lo = lo; + mp->x_extent[i].hi = hi; + } + lo = dny - 1 + dy; + hi = dy; + for (i=0; i < sny; i++) { + mp->y_extent[i].lo = lo; + mp->y_extent[i].hi = hi; + } + + /* Map the left and right or top and bottom edges of each destination + * pixel back into the source rect and update the corresponding extent + * entries to indicate that these source pixels are used to compute the + * destination pixel. + */ + pixwidth = 1.0 - ZOOM_TOL; + + for (i=0; i < dnx; i++) { + edge1 = (xflip ? xmax - i : i) / mp->xscale; + edge2 = (xflip ? xmax - (i-pixwidth) : (i+pixwidth)) / mp->xscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (snx - 1, edge2); + + for (j=edge1, k = dx + i; j <= edge2; j++) { + if (mp->x_extent[j].lo > k) + mp->x_extent[j].lo = k; + if (mp->x_extent[j].hi < k) + mp->x_extent[j].hi = k; + } + } + + for (i=0; i < dny; i++) { + edge1 = (yflip ? ymax - i : i) / mp->yscale; + edge2 = (yflip ? ymax - (i-pixwidth) : (i+pixwidth)) / mp->yscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (sny - 1, edge2); + + for (j=edge1, k = dy + i; j <= edge2; j++) { + if (mp->y_extent[j].lo > k) + mp->y_extent[j].lo = k; + if (mp->y_extent[j].hi < k) + mp->y_extent[j].hi = k; + } + } + + mp->updated = 1; +} + + +/* free_mapping -- Free any storage used internally by a mapping descriptor, + * and deactivate the mapping. + */ +static +free_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + mp_unlink (w, mp); + mp->defined = mp->enabled = mp->updated = 0; + if (mp->mapdata) { + XtFree ((char *) mp->mapdata); + mp->mapdata = NULL; + mp->datalen = 0; + mp->x_extent = mp->y_extent = NULL; + mp->x_srcpix = mp->y_srcpix = NULL; + mp->x_src = mp->y_src = NULL; + mp->updated = 0; + } +} + +static void +mp_linkafter (w, mp, ref_mp) + register GtermWidget w; + register Mapping mp; + register Mapping ref_mp; +{ + register Mapping map; + + /* Don't use the reference mapping unless it is already linked or + * the list is empty. + */ + if (w->gterm.mp_head) { + for (map = w->gterm.mp_head; map && map != ref_mp; map = map->next) + ; + if (map != ref_mp) + ref_mp = NULL; + } + + mp->prev = ref_mp; + mp->next = ref_mp ? ref_mp->next : NULL; + if (ref_mp && ref_mp->next) + ref_mp->next->prev = mp; + if (ref_mp) + ref_mp->next = mp; + + if (!w->gterm.mp_tail || ref_mp == w->gterm.mp_tail) + w->gterm.mp_tail = mp; + if (!w->gterm.mp_head) + w->gterm.mp_head = mp; +} + + +static void +mp_unlink (w, mp) + register GtermWidget w; + register Mapping mp; +{ + if (mp->prev) + mp->prev->next = mp->next; + if (mp->next) + mp->next->prev = mp->prev; + if (w->gterm.mp_head == mp) + w->gterm.mp_head = mp->next; + if (w->gterm.mp_tail == mp) + w->gterm.mp_tail = mp->prev; + + mp->prev = mp->next = NULL; +} + + +/* + * Graphics MARKERS. + * -------------------- + * A marker is an active graphics object displayed on top of a drawing to + * mark, annotate, or outline a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. Markers are used to + * interactively define regions with the mouse, to provide a dynamic graphical + * display which doesn't interfere with the underlying graphics frame, or as a + * graphical means of command input, using callbacks to perform some operation + * when the marker is moved or resized by the user. + * + * GtMarkerInit (w) + * GtMarkerFree (w) + * + * gm = GmCreate (w, type, interactive) + * GmRedisplay (w, region|NULL) + * gm = GmCopy (gm) + * GmDestroy (gm) + * GmAddCallback (gm, events, func, client_data) + * GmDeleteCallback (gm, func, client_data) + * gm = GmSelect (gt, x, y, &what) + * + * GmMarkpos (gm) + * GmRedraw (gm, func, erase) + * GmRaise (gm, ref_gm|NULL) + * GmLower (gm, ref_gm|NULL) + * GmNotify (gm, events, event, param, nparams) + * + * GmAddPt (gm, x, y) + * GmDeletePt (gm, x, y) + * GmMovePt (gm, x, y) + * GmMove (gm, x, y) + * GmResize (gm, x, y) + * GmRotate (gm, x, y) + * + * GmSetAttributes (gm, args, nargs, type) + * GmGetAttributes (gm, args, nargs, type) + * GmSetAttribute (gm, attribute, value, type) + * GmGetAttribute (gm, attribute, value, type) + * GmSetVertices (gm, points, first, npts) + * npts = GmGetVertices (gm, points, first, maxpts) + * GmGetBoundingBox (gm, x, y, width, height) + * + * type = GmStrToType (marker_type) + * event = GmStrToEvent (event_type) + * func = GmStrToFunction (drawing_function) + * + * Markers operate in screen coordinates (raster 0). The SelectRaster + * and MapVector routines may be used to convert to and from raster + * coordinates if desired. + * + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mp) + * GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + * + * The Gm procedures above implement the main functionality of markers. User + * interaction is provided at a higher level using action procedures which + * are bound to pointer and keyboard events via translations (or by the GUI + * itself directly calling the above procedures). + */ + +static void gm_text_init(), gm_line_init(), gm_plin_init(), gm_rect_init(); +static void gm_boxx_init(), gm_circ_init(), gm_elip_init(), gm_pgon_init(); +static int gm_putint(), gm_putfloat(), gm_do_callbacks(), gm_constraint(); +static int gm_getint(), gm_getattribute(), gm_gettype(); +static double gm_getfloat(); +static char *gm_getstring(); + +static void gm_markpos(), gm_erase(), gm_redraw(), gm_setCurRect(); +static void gm_linkafter(), gm_unlink(); +static double gm_niceAngle(); +static Pixel gm_getpixel(); +static int gm_select(); +static int gm_getfillstyle(); + +static GmVMethod gm_classinit[] = { + gm_text_init, gm_line_init, gm_plin_init, gm_rect_init, + gm_boxx_init, gm_circ_init, gm_elip_init, gm_pgon_init +}; + +static Region null_region; +static XRectangle null_rect = { 0, 0, 0, 0 }; +#define NullRect(r) (!(r)->width || !(r)->height) + +#define PI_2 1.57079632679489661923 +#define PI_4 0.78539816339744830962 +#define BORDER 5 + +static void M_create(), M_destroy(), M_destroyNull(), M_set(), M_raise(); +static void M_lower(), M_notify(), M_markpos(), M_markposAdd(), M_redraw(); +static void M_addPt(), M_deletePt(), M_movePt(), M_deleteDestroy(); +static void M_move(), M_resize(), M_moveResize(), M_rotate(); +static void M_rotateResize(), M_input(); +static void gm_focusin(), gm_focusout(); + +static XtActionsRec markerActionsList[] = { + { "m_create", M_create }, + { "m_destroy", M_destroy }, + { "m_destroyNull", M_destroyNull }, + { "m_set", M_set }, + { "m_raise", M_raise }, + { "m_lower", M_lower }, + { "m_notify", M_notify }, + { "m_input", M_input }, + { "m_markpos", M_markpos }, + { "m_markposAdd", M_markposAdd }, + { "m_redraw", M_redraw }, + { "m_addPt", M_addPt }, + { "m_deletePt", M_deletePt }, + { "m_movePt", M_movePt }, + { "m_deleteDestroy", M_deleteDestroy }, + { "m_move", M_move }, + { "m_resize", M_resize }, + { "m_moveResize", M_moveResize }, + { "m_rotate", M_rotate }, + { "m_rotateResize", M_rotateResize }, +}; + + +/* GtMarkerInit -- Initialize the marker subsystem. + */ +GtMarkerInit (w) + GtermWidget w; +{ + register Marker gm, prev; + XColor fg_color, bg_color; + Display *display = w->gterm.display; + int type, i; + GC gc; + + for (gm = w->gterm.gm_tail; gm; gm = prev) { + prev = gm->prev; + GmDestroy (gm); + } + + if (!w->gterm.gm_initialized) { + /* Register some additional actions for markers. */ + XtAppAddActions (XtWidgetToApplicationContext((Widget)w), + markerActionsList, XtNumber(markerActionsList)); + + /* Get the gterm widget translations. */ + if ((char *)w->gterm.defTranslations == NULL) { + char *translations = NULL; + XtTranslations tt; + XtResource r; + int ttype, i; + + r.resource_name = XtNtranslations; + r.resource_class = XtCTranslations; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + XtGetApplicationResources ((Widget)w, &translations, &r, 1,NULL,0); + + if (translations) { + if (strncmp (translations, "#augment", 8) == 0) + ttype = T_augment; + else if (strncmp (translations, "#override", 9) == 0) + ttype = T_override; + else + ttype = T_replace; + + if (ttype == T_replace) { + w->gterm.defTranslations = + XtParseTranslationTable (translations); + } else if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = ttype; + w->gterm.nauxTrans++; + } + + } else { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + } + + /* Get the marker translations. */ + if ((char *)w->gterm.gm_defTranslations == NULL) + w->gterm.gm_defTranslations = + XtParseTranslationTable (w->gterm.gm_translations); + } + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, + w->gterm.gm_lineWidth, w->gterm.gm_lineStyle, CapButt, JoinMiter); + w->gterm.gm_drawGC = gc; + + /* Get graphics rubber-band GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetFunction (display, gc, GXxor); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, w->gterm.gm_xorFillColor); + XSetBackground (display, gc, w->gterm.gm_xorFillBgColor); + XSetLineAttributes (display, gc, + 0, LineDoubleDash, CapButt, JoinMiter); + w->gterm.gm_rubberGC = gc; + + fg_color.pixel = w->gterm.gm_cursorFgColor; + bg_color.pixel = w->gterm.gm_cursorBgColor; + XQueryColor (display, w->core.colormap, &fg_color); + XQueryColor (display, w->core.colormap, &bg_color); + + w->gterm.gm_markerCursor = XCreateFontCursor (display, XC_fleur); + XRecolorCursor (display, w->gterm.gm_markerCursor, &fg_color,&bg_color); + w->gterm.gm_edgeCursor = XCreateFontCursor (display, XC_dotbox); + XRecolorCursor (display, w->gterm.gm_edgeCursor, &fg_color,&bg_color); + w->gterm.gm_pointCursor = XCreateFontCursor (display, XC_sizing); + XRecolorCursor (display, w->gterm.gm_pointCursor, &fg_color,&bg_color); + + if (!(type = GmStrToType (w->gterm.gm_defaultMarker))) + type = Gm_Rectangle; + w->gterm.gm_defaultType = type; + + if (!null_region) + null_region = XCreateRegion(); + w->gterm.gm_initialized++; + } + + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.gm_redisplay = False; + w->gterm.preserve_screen = 0; +} + + +/* GtMarkerFree -- Free any marker subsystem resources. + */ +static void +GtMarkerFree (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + register Marker gm; + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) + GmDestroy (gm); + + if (!w->gterm.gm_initialized) + return; + + XFreeGC (display, w->gterm.gm_drawGC); + XFreeGC (display, w->gterm.gm_rubberGC); + + /* This call can fail - see comments elsewhere in this file about + * XFreeCursor. + * + XFreeCursor (display, w->gterm.gm_markerCursor); + XFreeCursor (display, w->gterm.gm_edgeCursor); + XFreeCursor (display, w->gterm.gm_pointCursor); + */ + + w->gterm.gm_initialized = 0; +} + + +/* gm_focusin -- Called when gterm window input is directed to a marker. + */ +static void +gm_focusin (w, gm, what) + register GtermWidget w; + register Marker gm; + GmSelection what; +{ + Cursor cursor; + int erase; + Marker am; + + if (!XtIsRealized ((Widget)w)) + return; + + if (am = w->gterm.gm_active) { + if (am != gm) + gm_focusout (w, 0); + else if (what && what->type == w->gterm.gm_selection.type) { + /* no change */ + return; + } + } + + if (what) { + switch (what->type) { + case Ge_Point: + cursor = w->gterm.gm_pointCursor; + break; + case Ge_Edge: + cursor = w->gterm.gm_edgeCursor; + break; + default: + cursor = w->gterm.gm_markerCursor; + break; + } + } else + cursor = w->gterm.gm_markerCursor; + + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, cursor); + w->gterm.gm_active = gm; + w->gterm.gm_selection = *what; + + if (gm && gm != am) { + gm_request_translations (w, gm); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusIn, NULL, NULL, 0); +} + + +/* gm_focusout -- Called to restore the normal gterm window input when the + * pointer moves off a marker. + */ +static void +gm_focusout (w, enableSetTrans) + register GtermWidget w; + int enableSetTrans; /* replace translations */ +{ + register Display *display = w->gterm.display; + register Marker gm = w->gterm.gm_active; + int erase, i; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Restore the default gterm window translations. */ + if (enableSetTrans) + gm_request_translations (w, NULL); + + XDefineCursor (display, w->gterm.window, w->gterm.cursor); + w->gterm.gm_active = NULL; + + if (gm) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusOut, NULL, NULL, 0); +} + + +/* gm_refocus -- Simulate a pointer event to recompute the marker pointer + * focus. Called when a software event changes the marker stacking order + * in some way. + */ +static void +gm_refocus (w) + GtermWidget w; +{ + XMotionEvent event; + int nparams = 0; + + event.x = w->gterm.last_x; + event.y = w->gterm.last_y; + HandleTrackCursor ((Widget)w, &event, NULL, &nparams); +} + + +/* + * Translation tables. The widget's translation table must not be replaced + * while a translation is executing. This can be a problem as it is often + * events and their translations which lead to the translation table getting + * replaced. To avoid this problem we merely queue a timer event to load + * the desired translation table, allowing any existing translation to + * finish executing before the translation table is swapped out. If multiple + * translation table load requests are issued only the final one has any + * effect. + */ + +/* gm_request_translations -- Queue a request to load the translations for the + * specified marker (or NULL to load the default gterm translations). If this + * is the first request and timers are enabled a timer is posted to load the + * translations when any current event processing is complete. If a request + * is already active then the most recent request supercedes any previous one. + */ +static void +gm_request_translations (w, gm) + register GtermWidget w; + Marker gm; +{ + w->gterm.gm_reqTranslations = gm; + + if (!w->gterm.useTimers) + gm_load_translations (w, NULL); + else if (!w->gterm.gm_timer_id) { + w->gterm.gm_timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext((Widget)w), 0, + gm_load_translations, (XtPointer)w); + } +} + + +/* gm_load_translations -- Swap out the widget's translation table. This is + * a no-op if the requested translation table is already loaded. + */ +static void +gm_load_translations (w, id) + register GtermWidget w; + XtIntervalId id; +{ + register Marker am, gm; + register int i; + + w->gterm.gm_timer_id = (XtIntervalId) NULL; + + am = w->gterm.gm_curTranslations; + gm = w->gterm.gm_reqTranslations; + if (am == gm && w->gterm.gm_initialized) + return; + + if (gm) { + /* Set the translations for the indicated marker. */ + if (!am || am->translations != gm->translations) + XtOverrideTranslations ((Widget)w, gm->translations); + } else { + /* Restore the default gterm window translations. */ + XtVaSetValues ((Widget)w, + XtNtranslations, (XtArgVal)w->gterm.defTranslations, NULL); + for (i=0; i < w->gterm.nauxTrans; i++) { + switch (w->gterm.auxTType[i]) { + case T_augment: + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + case T_override: + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + } + } + } + + w->gterm.gm_curTranslations = w->gterm.gm_reqTranslations; +} + + +/* Public marker functions. + * -------------------------- + */ + +/* GmCreate -- Create a new marker. + */ +Marker +GmCreate (w, type, interactive) + GtermWidget w; + int type; /* marker type */ + int interactive; /* use pointer to set position */ +{ + register Marker gm; + + /* Allocate descriptor. */ + if (type < 1 || type > Gm_NTypes) + return (NULL); + if (!(gm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + /* Initialize descriptor. */ + gm->w = w; + gm->type = type; + gm->flags = interactive ? (Gm_Visible|Gm_Sensitive) : 0; + gm->translations = w->gterm.gm_defTranslations; + gm->old_region = XCreateRegion(); + gm->cur_region = XCreateRegion(); + (gm_classinit[type-1]) (gm, interactive); + + /* Link marker to tail of marker list. */ + gm_linkafter (gm, w->gterm.gm_tail); + + /* If marker is being created interactive, set flag to indicate that the + * next create marker event should finish creating this marker. + */ + if (w->gterm.gm_create) + GmDestroy (w->gterm.gm_create); + w->gterm.gm_create = interactive ? gm : NULL; + + return (gm); +} + + +/* GmDestroy -- Destroy a marker. + */ +GmDestroy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + Region old_region, cur_region; + + /* GmDestroy can be called recursively during a destroy operation as a + * side effect of the destroy callback. Set the Gm_BeingDestroyed flag + * to cause these redundant destroy requests to be ignored. + */ + if (gm->flags & Gm_BeingDestroyed) + return (OK); + gm->flags |= Gm_BeingDestroyed; + + /* Release the focus if active marker. This should be done before + * proceeding to destroy the marker, i.e. before calling the destroy + * callbacks. + */ + if (w->gterm.gm_active == gm) { + gm_focusout (w, 1); + w->gterm.gm_active = NULL; + } + + /* Inform any clients that have registered a callback for this marker + * that we are about to destroy the marker. + */ + gm_do_callbacks (gm, GmEvDestroy, NULL, NULL, 0); + + /* Erase the marker from the screen. */ + GmMarkpos (gm); + gm_erase (gm); + + /* Note marker position. */ + old_region = gm->old_region; + cur_region = gm->cur_region; + + /* Free all storage and unlink the marker. */ + if (gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + if (gm->text) + XtFree ((char *)gm->text); + if (gm->pgon) + XtFree ((char *)gm->pgon); + + gm_unlink (gm); + XtFree ((char *)gm); + + /* Redraw any markers that were obscured by the deleted marker. */ + update_transients (w, old_region); + + XDestroyRegion (old_region); + XDestroyRegion (cur_region); + + /* Recompute the marker focus. */ + gm_refocus (w); + + return (OK); +} + + +/* GmCopy -- Copy a marker. + */ +Marker +GmCopy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register Marker nm; + + if (!(nm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + *nm = *gm; + nm->parent = gm; + nm->old_region = NULL; + nm->cur_region = NULL; + nm->points = NULL; + nm->pgon = NULL; + nm->text = NULL; + + /* Copy region descriptors. */ + if ((char *)(nm->old_region = XCreateRegion()) == NULL) + goto fail; + if ((char *)(nm->cur_region = XCreateRegion()) == NULL) + goto fail; + XUnionRegion (nm->old_region, gm->cur_region, nm->cur_region); + + /* Copy any polypoint data. */ + if (gm->pgon) { + nm->pgon = (DPoint *) XtMalloc (gm->npoints * sizeof(DPoint)); + if (nm->pgon == NULL) + goto fail; + memmove (nm->pgon, gm->pgon, gm->npoints * sizeof(DPoint)); + } + + /* Copy region polygon. */ + if (gm->npoints > GM_MAXVERTICES) { + if (!(nm->points = (XPoint *) XtMalloc (gm->npoints * sizeof(XPoint)))) + goto fail; + memmove (nm->points, gm->points, gm->npoints * sizeof(XPoint)); + } + + /* Copy any text data. */ + if (gm->text) { + int nchars = strlen (gm->text); + if (!(nm->text = XtMalloc (nchars + 1))) + goto fail; + memmove (nm->text, gm->text, nchars + 1); + } + + gm_linkafter (nm, w->gterm.gm_tail); + return (nm); + +fail: + if (nm->text) + XtFree (nm->text); + if (nm->pgon) + XtFree ((char *)nm->pgon); + if (nm->points && nm->points != nm->point_data) + XtFree ((char *)nm->points); + if ((char *)nm->cur_region) + XDestroyRegion (nm->cur_region); + if ((char *)nm->old_region) + XDestroyRegion (nm->old_region); + + XtFree ((char *)nm); + return (NULL); +} + + +/* GmAddCallback -- Add a callback to a marker. + */ +GmAddCallback (gm, events, func, client_data) + register Marker gm; + int events; /* events callback is to receive */ + GmIMethod func; /* function to be called */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i; + + /* Find an empty callback slot. */ + for (i=0; i < GM_MAXCALLBACKS; i++) + if (!gm->callback[i].events) + break; + + /* Register the callback. */ + if (i < GM_MAXCALLBACKS) { + cb = &gm->callback[i]; + cb->events = events; + cb->func = func; + cb->client_data = client_data; + gm->ncallbacks = max (gm->ncallbacks, i + 1); + } + + if (events & GmEvConstraint) + gm->constraints++; +} + + +/* GmDeleteCallback -- Delete a previously posted callback given the + * function pointer and client data passed when the callback was registered. + */ +GmDeleteCallback (gm, func, client_data) + register Marker gm; + GmIMethod func; /* callback function */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i, n; + + for (i=n=0; i < GM_MAXCALLBACKS; i++) { + cb = &gm->callback[i]; + + if (cb->func == func && cb->client_data == client_data) { + if (cb->events & GmEvConstraint) + gm->constraints--; + cb->events = (int)NULL; + cb->func = (GmIMethod)NULL; + cb->client_data = (XtPointer)NULL; + } else if (cb->events) + n = i; + } + + gm->ncallbacks = n + 1; +} + + +/* GmSelect -- Scan the marker list to see if the given pointer coordinates + * are within an active marker. If so, the marker descriptor is returned as + * the function value, and the "what" argument is set to indicate what part + * of the marker was selected. + */ +Marker +GmSelect (w, x, y, what) + GtermWidget w; + int x, y; + GmSelection what; +{ + register int flags = (Gm_Activated|Gm_Visible|Gm_Sensitive); + register XRectangle *r; + register Marker gm; + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) { + if (!((gm->flags & (flags|Gm_BeingDestroyed)) == flags)) + continue; + r = &gm->cur_rect; + if (x < (int)r->x || x >= (int)(r->x + r->width) || + y < (int)r->y || y >= (int)(r->y + r->height)) + continue; + if (gm->select (gm, x, y, what)) + return (gm); + } + + return (NULL); +} + + +/* GmMarkpos -- Save the current marker position, e.g., prior to modifying + * the marker. This is used to erase the old marker when the modified + * marker is later redrawn. + */ +GmMarkpos (gm) + register Marker gm; +{ + gm->markpos (gm); +} + + +/* GmRedraw -- Redraw a marker using the given drawing function. If the erase + * flag is not set (as when in rubber-band mode) the marker is merely drawn + * to the screen. Otherwise if the old marker position has been saved the + * old marker is first erased, then any markers affected by the erase are + * redrawn, and finally the current marker is redrawn at the new location. + */ +GmRedraw (gm, func, erase) + Marker gm; + int func; + int erase; +{ + register Marker mm; + register XRectangle *o, *n, *r; + int flags = (Gm_Activated|Gm_Visible); + Region clip_region, temp_region, temp; + GtermWidget w = gm->w; + int outside; + + /* Recompute marker polygon if any attributes have changed. */ + gm->update (gm); + + clip_region = XCreateRegion(); + temp_region = XCreateRegion(); + + /* Erase the previously marked region (old position). */ + if (erase) { + XUnionRegion (gm->old_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + gm_erase (gm); + } + + if (!erase && func == GXxor) + gm->redraw (gm, func); + else { + /* Draw the marker and any markers it intersects, clipping to the + * new marker region. + */ + o = &gm->old_rect; + n = &gm->cur_rect; + + XUnionRegion (gm->cur_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, clip_region); + + for (mm = gm->w->gterm.gm_head; mm; mm = mm->next) { + if (!((mm->flags & flags) == flags)) + continue; + + /* Redraw a marker if it intersects either the old rect or the + * new rect. + */ + if (mm != gm) { + r = &mm->cur_rect; + outside = 0; + if ((int)r->x >= (int)o->x + (int)o->width || + (int)r->x + (int)r->width <= (int)o->x || + (int)r->y >= (int)o->y + (int)o->height || + (int)r->y + (int)r->height <= (int)o->y) + outside++; + if ((int)r->x >= (int)n->x + (int)n->width || + (int)r->x + (int)r->width <= (int)n->x || + (int)r->y >= (int)n->y + (int)n->height || + (int)r->y + (int)r->height <= (int)n->y) + outside++; + if (outside == 2) + continue; + } + mm->redraw (mm, func); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + } + + if (erase) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XDestroyRegion (clip_region); + XDestroyRegion (temp_region); + + if (func != GXxor && gm->width > 0 && gm->height > 0) { + /* Redraw callback. */ + gm_do_callbacks (gm, GmEvRedraw, NULL, NULL, 0); + + /* Generate moveResize callback, if marker was moved or resized. + */ + if (gm->old_rect.x != gm->cur_rect.x || + gm->old_rect.y != gm->cur_rect.y || + gm->old_rect.width != gm->cur_rect.width || + gm->old_rect.height != gm->cur_rect.height) { + + char x[32], y[32]; + char width[32], height[32]; + char *argv[5]; + int argc; + + /* If the marker was just created (old_rect null) or the marker + * moved and we did a full erase and redraw, any old markpos is + * obsolete so we may as well update the saved position. + */ + if (erase || !gm->old_rect.width || !gm->old_rect.height) + GmMarkpos (gm); + + sprintf (x, "%d", gm->x); + sprintf (y, "%d", gm->y); + sprintf (width, "%d", gm->width); + sprintf (height, "%d", gm->height); + argv[0] = x; + argv[1] = y; + argv[2] = width; + argv[3] = height; + argv[4] = NULL; + argc = 4; + + gm_do_callbacks (gm, GmEvMoveResize, NULL, argv, argc); + } + } +} + + +/* GmRedisplay -- Redisplay the markers in the given region, or redisplay + * the entire window if the region is given as (char *)NULL. + */ +GmRedisplay (w, region) + GtermWidget w; + Region region; +{ + register int flags = (Gm_Activated|Gm_Visible); + register XRectangle *r; + register Marker gm; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Set the clip mask to only draw in the affected region. */ + if (region) + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, region); + + /* Draw all markers that intersect the target region. */ + for (gm = w->gterm.gm_head; gm; gm = gm->next) { + if (!((gm->flags & flags) == flags)) + continue; + + if ((char *)region) { + gm->update (gm); + r = &gm->cur_rect; + if (XRectInRegion (region, + r->x, r->y, r->width, r->height) == RectangleOut) + continue; + } + + gm->redraw (gm, GXcopy); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + w->gterm.gm_redisplay = False; +} + + +/* GmRaise -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn above the second. + */ +GmRaise (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already on top? */ + if (gm == w->gterm.gm_tail || ref_gm && ref_gm->next == gm) + return; + + /* Raise it. */ + gm_unlink (gm); + gm_linkafter (gm, ref_gm ? ref_gm : w->gterm.gm_tail); + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmLower -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn below the second. + */ +GmLower (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already lowered? */ + if (gm == w->gterm.gm_head || ref_gm && ref_gm->prev == gm) + return; + + /* Lower it. */ + gm_unlink (gm); + if (ref_gm && ref_gm->prev) + gm_linkafter (gm, ref_gm->prev); + else { + gm->next = w->gterm.gm_head; + w->gterm.gm_head = gm; + if (gm->next) + gm->next->prev = gm; + if (!w->gterm.gm_tail) + w->gterm.gm_tail = gm; + } + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmNotify -- Notify any clients that have registered callbacks that the + * given marker events have occurred. + */ +GmNotify (gm, events, event, params, nparams) + register Marker gm; + int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + gm_do_callbacks (gm, events, event, params, nparams); +} + + +/* GmAddPt -- Add a point to a marker. + */ +GmAddPt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->addPt) { + GmRedraw (gm, GXxor, erase=False); + gm->addPt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + gm_refocus (gm->w); + } +} + + +/* GmDeletePt -- Delete a point from a marker. + */ +GmDeletePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->deletePt) { + GmMarkpos (gm); + gm->deletePt (gm, x, y); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (gm->w); + } +} + + +/* GmMovePt -- Move a point within a marker. + */ +GmMovePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->movePt) { + GmRedraw (gm, GXxor, erase=False); + gm->movePt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmMove -- Move a marker. + */ +GmMove (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->move) { + GmRedraw (gm, GXxor, erase=False); + gm->move (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmResize -- Resize a marker. + */ +GmResize (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->resize) { + GmRedraw (gm, GXxor, erase=False); + gm->resize (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmRotate -- Rotate a marker. + */ +GmRotate (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->rotate) { + GmRedraw (gm, GXxor, erase=False); + gm->rotate (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmSetAttributes -- Set a list of attributes. Requires that all attribute + * values be specified in the same type. Autoredraw, if enabled, is suspended + * until all attributes have been changed. + */ +GmSetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + int autoredraw, erase; + int status = OK; + + if (autoredraw = (gm->flags & Gm_AutoRedraw)) { + gm->flags &= ~Gm_AutoRedraw; + GmMarkpos (gm); + } + + for (i=0; i < nargs; i++) { + status |= GmSetAttribute (gm, args[i].name, args[i].value, argtype); + if (strcmp (args[i].name, GmAutoRedraw) == 0) + autoredraw = gm_getint (args[i].value, argtype); + } + + if (autoredraw) { + gm->flags |= Gm_AutoRedraw; + GmRedraw (gm, GXcopy, erase=True); + } + + return (status ? ERR : OK); +} + + +/* GmSetAttribute -- Set the value of a marker attribute. + */ +GmSetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int marker_type, atType; + int erase, n, i; + + if (gm->flags & Gm_AutoRedraw) + GmMarkpos (gm); + + switch (atType = gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + marker_type = GmStrToType ((char *)value); + break; + case Gt_Int: + marker_type = gm_getint (value, type); + break; + default: + return (ERR); + } + + marker_type = max(1, min(Gm_NTypes, marker_type)); + (gm_classinit[marker_type-1]) (gm, False); + gm->flags |= Gm_Modified; + break; + + case Ga_Activated: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Activated)) { + gm->flags |= Gm_Activated; + GmRedraw (gm, GXcopy, erase=False); + } + } else { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Activated; + } + return (OK); + + case Ga_Visible: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Visible)) { + gm->flags |= Gm_Visible; + GmRedraw (gm, GXcopy, erase=False); + } + } else if (gm->flags & Gm_Visible) { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Visible; + } + return (OK); + + case Ga_Sensitive: + if (gm_getint (value, type)) + gm->flags |= Gm_Sensitive; + else + gm->flags &= ~Gm_Sensitive; + return (OK); + + case Ga_AutoRedraw: + if (gm_getint (value, type)) + gm->flags |= Gm_AutoRedraw; + else + gm->flags &= ~Gm_AutoRedraw; + return (OK); + + case Ga_Translations: + switch (gm_gettype (type)) { + case Gt_String: + gm->translations = XtParseTranslationTable ((char *)value); + break; + default: + return (ERR); + } + return (OK); + + case Ga_X: + gm->x = gm_getint (value, type); + break; + case Ga_Y: + gm->y = gm_getint (value, type); + break; + + case Ga_Width: + case Ga_Height: + /* For a text marker a size can be specified either in integer + * pixels or in characters, e.g., "40ch" or "40 chars". + */ + if (gm->type == Gm_Text && type == XtRString) { + XFontStruct *fp = gm->font; + int char_width, char_height; + int l_pix, r_pix; + char *ip; + + for (n=0, ip=(char *)value; *ip && isdigit(*ip); ip++) + n = n * 10 + (*ip - '0'); + + while (isspace (*ip)) + ip++; + if (ip[0] == 'c' && ip[1] == 'h') { + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + + if (atType == Ga_Width) + n = n * char_width + l_pix + r_pix; + else + n = n * char_height + l_pix * 2; + } + } else + n = gm_getint (value, type); + + if (atType == Ga_Width) + gm->width = n; + else + gm->height = n; + break; + + case Ga_Rotangle: + gm->rotangle = gm_getfloat (value, type); + break; + + case Ga_HighlightColor: + gm->highlightColor = gm_getpixel (w, value, type); + break; + case Ga_LineColor: + gm->lineColor = gm_getpixel (w, value, type); + break; + case Ga_LineWidth: + gm->lineWidth = gm_getint (value, type); + break; + case Ga_LineStyle: + gm->lineStyle = gm_getint (value, type); + break; + + case Ga_KnotColor: + gm->knotColor = gm_getpixel (w, value, type); + break; + case Ga_KnotSize: + gm->knotSize = gm_getint (value, type); + break; + + case Ga_Fill: + gm->fill = gm_getint (value, type); + break; + case Ga_FillColor: + gm->fillColor = gm_getpixel (w, value, type); + break; + case Ga_FillBgColor: + gm->fillBgColor = gm_getpixel (w, value, type); + break; + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + gm->fillStyle = gm_getfillstyle (w, value, type); + break; + default: + break; + } + break; + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + gm->fillPattern = (Pixmap) (value); + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + gm->textColor = gm_getpixel (w, value, type); + break; + case Ga_TextBgColor: + gm->textBgColor = gm_getpixel (w, value, type); + break; + case Ga_TextBorder: + gm->textBorder = gm_getint (value, type); + break; + case Ga_ImageText: + gm->imageText = gm_getint (value, type); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + i = gm_getint (value, type); + if (i >= 0 && i < NDialogFonts) + gm->font = w->gterm.dialog_fonts[i]; + break; + case Gt_Pointer: + gm->font = (XFontStruct *) (value); + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + case Gt_String: + if (gm->text) + XtFree (gm->text); + if (!(gm->text = XtMalloc (strlen((char *)value) + 1))) + return (ERR); + strcpy (gm->text, (char *)value); + break; + default: + return (ERR); + } + break; + + default: + return (ERR); + } + + gm->flags |= Gm_Modified; + + if (gm->flags & Gm_AutoRedraw) + GmRedraw (gm, GXcopy, erase=True); + + /* Notify client that a marker attribute has changed. */ + { char *argv[2]; + int argc; + + argv[0] = attribute; + argv[1] = NULL; + argc = 1; + + gm_do_callbacks (gm, GmEvModify, NULL, argv, argc); + } + + return (OK); +} + + +/* GmGetAttributes -- Get a list of attributes. Requires that all attribute + * values be specified in the same type. + */ +GmGetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + + for (i=0; i < nargs; i++) + GmGetAttribute (gm, args[i].name, args[i].value, argtype); +} + + +/* GmGetAttribute -- Get the value of a marker attribute. + */ +GmGetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int i; + + switch (gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->type) { + case Gm_Text: + strcpy ((char *)value, GmText); + break; + case Gm_Line: + strcpy ((char *)value, GmLine); + break; + case Gm_Polyline: + strcpy ((char *)value, GmPolyline); + break; + case Gm_Rectangle: + strcpy ((char *)value, GmRectangle); + break; + case Gm_Box: + strcpy ((char *)value, GmBox); + break; + case Gm_Circle: + strcpy ((char *)value, GmCircle); + break; + case Gm_Ellipse: + strcpy ((char *)value, GmEllipse); + break; + case Gm_Polygon: + strcpy ((char *)value, GmPolygon); + break; + default: + return (ERR); + } + break; + case Gt_Int: + if (gm_putint (gm->type, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_Activated: + if (gm_putint ((gm->flags & Gm_Activated) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Visible: + if (gm_putint ((gm->flags & Gm_Visible) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Sensitive: + if (gm_putint ((gm->flags & Gm_Sensitive) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_AutoRedraw: + if (gm_putint ((gm->flags & Gm_AutoRedraw) != 0, value, type) == ERR) + return (ERR); + break; + + case Ga_X: + if (gm_putint (gm->x, value, type) == ERR) + return (ERR); + break; + case Ga_Y: + if (gm_putint (gm->y, value, type) == ERR) + return (ERR); + break; + case Ga_Width: + if (gm_putint (gm->width, value, type) == ERR) + return (ERR); + break; + case Ga_Height: + if (gm_putint (gm->height, value, type) == ERR) + return (ERR); + break; + case Ga_Rotangle: + if (gm_putfloat (gm->rotangle, value, type) == ERR) + return (ERR); + break; + + case Ga_HighlightColor: + if (gm_putint ((int)gm->highlightColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineColor: + if (gm_putint ((int)gm->lineColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineWidth: + if (gm_putint (gm->lineWidth, value, type) == ERR) + return (ERR); + break; + case Ga_LineStyle: + if (gm_putint (gm->lineStyle, value, type) == ERR) + return (ERR); + break; + case Ga_KnotColor: + if (gm_putint ((int)gm->knotColor, value, type) == ERR) + return (ERR); + break; + case Ga_KnotSize: + if (gm_putint (gm->knotSize, value, type) == ERR) + return (ERR); + break; + + case Ga_Fill: + if (gm_putint (gm->fill, value, type) == ERR) + return (ERR); + break; + case Ga_FillColor: + if (gm_putint ((int)gm->fillColor, value, type) == ERR) + return (ERR); + break; + case Ga_FillBgColor: + if (gm_putint ((int)gm->fillBgColor, value, type) == ERR) + return (ERR); + break; + + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->fillStyle) { + case FillSolid: + strcpy ((char *)value, "FillSolid"); + break; + case FillTiled: + strcpy ((char *)value, "FillTiled"); + break; + case FillStippled: + strcpy ((char *)value, "FillStippled"); + break; + case FillOpaqueStippled: + strcpy ((char *)value, "FillOpaqueStippled"); + break; + default: + strcpy ((char *)value, "FillSolid"); + break; + } + break; + case Gt_Int: + if (gm_putint (gm->fillStyle, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + *(Pixmap *)value = gm->fillPattern; + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + if (gm_putint ((int)gm->textColor, value, type) == ERR) + return (ERR); + break; + case Ga_TextBorder: + if (gm_putint (gm->textBorder, value, type) == ERR) + return (ERR); + break; + case Ga_ImageText: + if (gm_putint (gm->imageText, value, type) == ERR) + return (ERR); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + for (i=0; i < NDialogFonts; i++) + if (gm->font == w->gterm.dialog_fonts[i]) { + if (gm_putint (i, value, type) == ERR) + return (ERR); + break; + } + break; + case Gt_Pointer: + *(XFontStruct **)value = gm->font; + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + *((char **)value) = gm->text; + break; + case Gt_String: + strcpy ((char *)value, gm->text); + break; + default: + return (ERR); + } + break; + + default: + return (ERR); + } + + return (OK); +} + + +/* GmSetVertices -- Set the vertices of a "poly" type object. + */ +GmSetVertices (gm, points, first, npts) + Marker gm; + DPoint *points; /* input array of points */ + int first; /* first point to be set */ + int npts; /* number of points to set */ +{ + register DPoint *ip; + register XPoint *op; + register int i; + int erase; + + /* The point vector is automatically extended if more space is needed. + * Small vectors are stored directly in the marker descriptor in the + * point_data array. + */ + if (first + npts > gm->npoints) { + if (gm->npoints > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) XtRealloc ((char *)gm->points, + first + npts)) == (XPoint *)NULL) + return; + } else if (first + npts > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) + XtMalloc (first + npts)) == (XPoint *)NULL) + return; + } else if (!gm->points) + gm->points = gm->point_data; + + gm->npoints = first + npts; + } + + /* Copy the point data. */ + ip = points; + op = &gm->points[first]; + for (i=0; i < npts; i++) { + op->x = (int) ip->x + 0.5; + op->y = (int) ip->y + 0.5; + ip++, op++; + } + + /* Redraw the marker if autoredraw is enabled. */ + if (gm->flags & Gm_AutoRedraw) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } +} + + +/* GmGetVertices -- Get the vertices of a "poly" type object. The actual + * number of points output is returned as the function value. + */ +GmGetVertices (gm, points, first, maxpts) + register Marker gm; + register DPoint *points; /* output array of points */ + int first; /* first point to be returned */ + int maxpts; /* max number of points to return */ +{ + register XPoint *ip; + register DPoint *op; + register int i; + int top, nout; + + if (first >= gm->npoints) + return (0); + top = min (first + maxpts, gm->npoints); + nout = top - first; + + if (points) { + ip = &gm->points[first]; + op = points; + for (i=0; i < nout; i++) { + op->x = ip->x; + op->y = ip->y; + ip++, op++; + } + } + + return (nout); +} + + +/* GmGetBoundingBox -- Returns a rect large enough to completely enclose a + * marker, regardless of its type or orientation. + */ +GmGetBoundingBox (gm, x, y, width, height) + register Marker gm; + int *x, *y; + int *width, *height; +{ + register XRectangle *r = &gm->cur_rect; + + *x = r->x; + *y = r->y; + *width = r->width; + *height = r->height; +} + + +/* GmStrToType -- Convert a marker type string to a marker type code. + */ +GmStrToType (marker_type) +register char *marker_type; +{ + register int type; + + if (strcmp (marker_type, GmText) == 0) + type = Gm_Text; + else if (strcmp (marker_type, GmLine) == 0) + type = Gm_Line; + else if (strcmp (marker_type, GmPolyline) == 0) + type = Gm_Polyline; + else if (strcmp (marker_type, GmRectangle) == 0) + type = Gm_Rectangle; + else if (strcmp (marker_type, GmBox) == 0) + type = Gm_Box; + else if (strcmp (marker_type, GmCircle) == 0) + type = Gm_Circle; + else if (strcmp (marker_type, GmEllipse) == 0) + type = Gm_Ellipse; + else if (strcmp (marker_type, GmPolygon) == 0) + type = Gm_Polygon; + else + type = 0; + + return (type); +} + + +/* GmStrToEvent -- Convert a marker event type string to a marker event code. + */ +GmStrToEvent (event_type) +register char *event_type; +{ + register int type; + + if (strcmp (event_type, "notify") == 0) + type = GmEvNotify; + else if (strcmp (event_type, "moveResize") == 0) + type = GmEvMoveResize; + else if (strcmp (event_type, "modify") == 0) + type = GmEvModify; + else if (strcmp (event_type, "redraw") == 0) + type = GmEvRedraw; + else if (strcmp (event_type, "destroy") == 0) + type = GmEvDestroy ; + else if (strcmp (event_type, "input") == 0) + type = GmEvInput; + else if (strcmp (event_type, "focusIn") == 0) + type = GmEvFocusIn; + else if (strcmp (event_type, "focusOut") == 0) + type = GmEvFocusOut; + else if (strcmp (event_type, "constraint") == 0) + type = GmEvConstraint; + else + type = 0; + + return (type); +} + + +/* GmStrToFunction -- Convert a drawing function string to the corresponding + * XLIB function code. + */ +GmStrToFunction (function) +register char *function; +{ + register int code; + + if (strcmp (function, "clear") == 0) + code = GXclear; + else if (strcmp (function, "and") == 0) + code = GXand; + else if (strcmp (function, "andReverse") == 0) + code = GXandReverse; + else if (strcmp (function, "copy") == 0) + code = GXcopy; + else if (strcmp (function, "andInverted") == 0) + code = GXandInverted; + else if (strcmp (function, "noop") == 0) + code = GXnoop; + else if (strcmp (function, "xor") == 0) + code = GXxor; + else if (strcmp (function, "or") == 0) + code = GXor; + else if (strcmp (function, "nor") == 0) + code = GXnor; + else if (strcmp (function, "equiv") == 0) + code = GXequiv; + else if (strcmp (function, "invert") == 0) + code = GXinvert; + else if (strcmp (function, "orReverse") == 0) + code = GXorReverse; + else if (strcmp (function, "copyInverted") == 0) + code = GXcopyInverted; + else if (strcmp (function, "orInverted") == 0) + code = GXorInverted; + else if (strcmp (function, "nand") == 0) + code = GXnand; + else if (strcmp (function, "set") == 0) + code = GXset; + else + code = -1; + + return (code); +} + + +/* Internal procedures for above code. + * ------------------------------------ + */ + +static int +gm_getint (value, type) + XtArgVal value; + char *type; +{ + register int ch; + + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + ch = *((char *)value); + if (ch == 'T' || ch == 't') + return (1); + else if (ch == 'F' || ch == 'f') + return (0); + else + return (atoi((char *)value)); + default: + return (0); + } +} + + +static Pixel +gm_getpixel (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + XrmValue from, to; + Pixel pixel; + char *str; + + switch (gm_gettype (type)) { + case Gt_Int: + /* Pixel value (colormap index). */ + return ((Pixel)value); + + case Gt_String: + /* The pixel is expressed either as a pixel number input as a string, + * or as a color name. The latter case requires a type conversion. + */ + str = (char *)value; + if (isdigit(str[0]) && (int)strlen(str) <= 3) { + int index = atoi (str); + pixel = w->gterm.cmap[index]; + return (pixel); + } + + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) { + /* Allocate color from default colormap. + */ + from.size = strlen ((char *)value) + 1; + from.addr = (char *)value; + to.addr = (caddr_t) &pixel; + to.size = sizeof(pixel); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRPixel, &to)) + pixel = w->gterm.cmap[1]; + + } else { + /* Allocate closest match from custom colormap. This is crude, + * but for the standard colors this will return an exact match. + */ + int index, min_dist, dist, i; + XColor exact, best, *cp; + + pixel = w->gterm.cmap[1]; + if (XLookupColor (w->gterm.display, + get_colormap(w), str, &exact, &best)) { + min_dist = 9999; + index = 1; + + for (i=0; i < w->gterm.ncolors; i++) { + cp = &w->gterm.color[i]; + dist = abs((int)exact.red - (int)cp->red) + + abs((int)exact.green - (int)cp->green) + + abs((int)exact.blue - (int)cp->blue); + if (dist == 0) { + index = i; + break; + } else if (dist < min_dist) { + index = i; + min_dist = dist; + } + } + + pixel = w->gterm.color[index].pixel; + } + } + return (pixel); + + default: + return (w->gterm.cmap[1]); + } +} + + +static int +gm_getfillstyle (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_String: + if (strcmp ((char *)value, "FillSolid") == 0) + return (FillSolid); + else if (strcmp ((char *)value, "FillTiled") == 0) + return (FillTiled); + else if (strcmp ((char *)value, "FillStippled") == 0) + return (FillStippled); + else if (strcmp ((char *)value, "FillOpaqueStippled") == 0) + return (FillOpaqueStippled); + break; + default: + break; + } + + return (FillSolid); +} + + +static double +gm_getfloat (value, type) + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + return (atof((char *)value)); + default: + return (0); + } +} + + +static char * +gm_getstring (value, type) + XtArgVal value; + char *type; +{ + if (strcmp (type, XtRString) == 0) + return ((char *)value); + else + return (""); +} + + +static int +gm_putint (ival, value, type) + int ival; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = ival; + break; + case Gt_DFloatP: + *(double *)value = (double) ival; + break; + case Gt_String: + sprintf ((char *)value, "%d", ival); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_putfloat (fval, value, type) + double fval; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = (int) fval; + break; + case Gt_DFloatP: + *(double *)value = fval; + break; + case Gt_String: + sprintf ((char *)value, "%g", fval); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_gettype (type) + char *type; +{ + if (strcmp (type, XtRBool) == 0) + return (Gt_Int); + else if (strcmp (type, XtRInt) == 0) + return (Gt_Int); + else if (strcmp (type, XtRFloat) == 0) + return (Gt_DFloatP); + else if (strcmp (type, XtRPointer) == 0) + return (Gt_Pointer); + else if (strcmp (type, XtRString) == 0) + return (Gt_String); + else + return (ERR); +} + + +static int +gm_getattribute (attribute) + char *attribute; +{ + if (strcmp (attribute, GmType) == 0) + return (Ga_Type); + else if (strcmp (attribute, GmActivated) == 0) + return (Ga_Activated); + else if (strcmp (attribute, GmVisible) == 0) + return (Ga_Visible); + else if (strcmp (attribute, GmSensitive) == 0) + return (Ga_Sensitive); + else if (strcmp (attribute, GmAutoRedraw) == 0) + return (Ga_AutoRedraw); + else if (strcmp (attribute, GmTranslations) == 0) + return (Ga_Translations); + else if (strcmp (attribute, GmX) == 0) + return (Ga_X); + else if (strcmp (attribute, GmY) == 0) + return (Ga_Y); + else if (strcmp (attribute, GmWidth) == 0) + return (Ga_Width); + else if (strcmp (attribute, GmHeight) == 0) + return (Ga_Height); + else if (strcmp (attribute, GmRotangle) == 0) + return (Ga_Rotangle); + else if (strcmp (attribute, GmHighlightColor) == 0) + return (Ga_HighlightColor); + else if (strcmp (attribute, GmLineColor) == 0) + return (Ga_LineColor); + else if (strcmp (attribute, GmLineWidth) == 0) + return (Ga_LineWidth); + else if (strcmp (attribute, GmLineStyle) == 0) + return (Ga_LineStyle); + else if (strcmp (attribute, GmKnotColor) == 0) + return (Ga_KnotColor); + else if (strcmp (attribute, GmKnotSize) == 0) + return (Ga_KnotSize); + else if (strcmp (attribute, GmFill) == 0) + return (Ga_Fill); + else if (strcmp (attribute, GmFillColor) == 0) + return (Ga_FillColor); + else if (strcmp (attribute, GmFillBgColor) == 0) + return (Ga_FillBgColor); + else if (strcmp (attribute, GmFillPattern) == 0) + return (Ga_FillPattern); + else if (strcmp (attribute, GmFillStyle) == 0) + return (Ga_FillStyle); + else if (strcmp (attribute, GmTextColor) == 0) + return (Ga_TextColor); + else if (strcmp (attribute, GmTextBgColor) == 0) + return (Ga_TextBgColor); + else if (strcmp (attribute, GmTextBorder) == 0) + return (Ga_TextBorder); + else if (strcmp (attribute, GmImageText) == 0) + return (Ga_ImageText); + else if (strcmp (attribute, GmFont) == 0) + return (Ga_Font); + else if (strcmp (attribute, GmText) == 0) + return (Ga_Text); + else + return (ERR); +} + +static void +gm_linkafter (gm, prev) + register Marker gm; + register Marker prev; +{ + register GtermWidget w = gm->w; + + gm->prev = prev; + gm->next = prev ? prev->next : NULL; + if (prev) + prev->next = gm; + + if (!w->gterm.gm_tail || prev == w->gterm.gm_tail) + w->gterm.gm_tail = gm; + if (!w->gterm.gm_head) + w->gterm.gm_head = gm; + + w->gterm.preserve_screen++; +} + + +static void +gm_unlink (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + + if (gm->prev) + gm->prev->next = gm->next; + if (gm->next) + gm->next->prev = gm->prev; + if (w->gterm.gm_head == gm) + w->gterm.gm_head = gm->next; + if (w->gterm.gm_tail == gm) + w->gterm.gm_tail = gm->prev; + + gm->prev = gm->next = NULL; + if (!w->gterm.gm_head) + w->gterm.preserve_screen = 0; +} + + +/* gm_do_callbacks -- Call any client callbacks registered for the given + * event type. + */ +static int +gm_do_callbacks (gm, events, event, params, nparams) + Marker gm; + register int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + register int n; + register struct markerCallback *cb; + struct markerCallback callback[GM_MAXCALLBACKS]; + int ncallbacks, status; + + /* Copy the callbacks list into local memory to ensure that it is not + * changed by executing a callback. + */ + ncallbacks = gm->ncallbacks; + memmove ((char *)callback, (char *)gm->callback, + sizeof (struct markerCallback) * GM_MAXCALLBACKS); + + for (n = ncallbacks, cb = callback; --n >= 0; cb++) + if (cb->events & events) { + status = cb->func (cb->client_data, + gm, events, event, params, nparams); + if (status) + return (status); + } + + return (0); +} + + +/* gm_constraint -- Handle the constraint callback. This is a client + * callback called when a marker position or size attribute is changed + * interactively at runtime. The purpose of the callback is to allow the + * client to apply any constraints, e.g. to keep the marker within a + * certain area or range of sizes, to forbid rotation, and so on. + */ +static int +gm_constraint (gm, new_gm, what) + register Marker gm, new_gm; + register int what; +{ + register char *ip, *op; + char argbuf[2048]; + char *argv[30]; + int argc = 0; + + /* Return immediately if there are no constraint callbacks. */ + if (!gm->constraints) + return; + + /* Prepare an argument list listing the marker attributes being changed + * and their old and new values. Each attribute is passed as three + * arg strings: name old-value new-value. Each argument string is + * allocated a fixed amount of space of SZ_NUMBER characters. + */ + op = argbuf; + if (what & Gb_X) { + strcpy (argv[argc++]=op, "x"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->x); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->x); op += SZ_NUMBER; + } + if (what & Gb_Y) { + strcpy (argv[argc++]=op, "y"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->y); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->y); op += SZ_NUMBER; + } + if (what & Gb_Width) { + strcpy (argv[argc++]=op, "width"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->width); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->width); op += SZ_NUMBER; + } + if (what & Gb_Height) { + strcpy (argv[argc++]=op, "height"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->height); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->height); op += SZ_NUMBER; + } + if (what & Gb_Rotangle) { + strcpy (argv[argc++]=op, "rotangle"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", gm->rotangle); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", new_gm->rotangle); op += SZ_NUMBER; + } + + /* Call any constraint callbacks. The argv value strings are modified + * in place. + */ + gm_do_callbacks (gm, GmEvConstraint, NULL, argv, argc); + + /* Copy the possibly edited values back into the new_gm struct. + */ + ip = argbuf + SZ_NUMBER * 2; + if (what & Gb_X) { + new_gm->x = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Y) { + new_gm->y = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Width) { + new_gm->width = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Height) { + new_gm->height = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Rotangle) { + new_gm->rotangle = atof (ip); ip += SZ_NUMBER*3; + } +} + + +static void +gm_erase (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register XRectangle *r = &gm->old_rect; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Any clipping to the marker border is set outside this routine. */ + if ((gm->flags & Gm_Visible) && !NullRect(r)) + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, r->x, r->y, r->width, r->height, r->x, r->y); +} + + +/* Marker actions. + * ------------------------- + */ + + +/* M_create -- Create a marker. + */ +static void +M_create (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int interactive, type; + gmSelection what; + + savepos (w, event); + + /* If the marker has already been created in interactive mode the event + * merely initializes the marker, otherwise we create and initialize a + * new marker. + */ + if (!(gm = w->gterm.gm_create)) { + type = w->gterm.gm_defaultType; + if (*nparams == 1) { + if (!(type = GmStrToType (params[0]))) + type = w->gterm.gm_defaultType; + } + gm = GmCreate (w, type, interactive=True); + } + + gm->x = ev->x; + gm->y = ev->y; + gm->flags |= Gm_Activated; + w->gterm.gm_create = NULL; + + what.type = (gm->type == Gm_Polygon) ? Ge_Marker : Ge_Point; + what.vertex = 0; + gm_focusin (w, gm, &what); +} + + +/* M_destroy -- Destroy a marker. + */ +static void +M_destroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmDestroy (gm); +} + + +/* M_destroyNull -- Destroy a marker if it is null sized. + */ +static void +M_destroyNull (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (gm && gm->width <= 2 && gm->height <= 2) + GmDestroy (gm); +} + + +/* M_set -- Set a marker attribute. + */ +static void +M_set (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0; i < *nparams; i += 2) + GmSetAttribute (gm, + (XtArgVal)params[i], (XtArgVal)params[i+1], XtRString); +} + + +/* M_raise -- Raise a marker to the top of the display list. + */ +static void +M_raise (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmRaise (gm, NULL); +} + + +/* M_lower -- Lower a marker to the bottom of the display list. + */ +static void +M_lower (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmLower (gm, NULL); +} + + +/* M_notify -- Notify any clients that have registered callbacks for the + * specified type of events. + */ +static void +M_notify (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int events, i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0, events=0; i < *nparams; i++) + if (strcmp (params[i], "notify") == 0) + events |= GmEvNotify; + else if (strcmp (params[i], "moveResize") == 0) + events |= GmEvMoveResize; + else if (strcmp (params[i], "modify") == 0) + events |= GmEvModify; + else if (strcmp (params[i], "redraw") == 0) + events |= GmEvRedraw; + else if (strcmp (params[i], "destroy") == 0) + events |= GmEvDestroy; + else if (strcmp (params[i], "input") == 0) + events |= GmEvInput; + else if (strcmp (params[i], "focusIn") == 0) + events |= GmEvFocusIn; + else if (strcmp (params[i], "focusOut") == 0) + events |= GmEvFocusOut; + + GmNotify (gm, events, event, params + 1, *nparams - 1); +} + + +/* M_input -- Notify any clients that have registered a input callback + * that a input event has occurred. + */ +static void +M_input (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register Marker gm; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmNotify (gm, GmEvInput, event, params, *nparams); +} + + +/* M_markpos -- Mark the current position of the marker, e.g., so that it + * can later be erased. + */ +static void +M_markpos (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmMarkpos (gm); +} + + +/* M_markposAdd -- Execute either the markpos or add action, depending upon + * the pointer location. If the pointer is over an active marker at a + * location where the add action can be executed this is done, otherwise the + * markpos action is executed. + */ +static void +M_markposAdd (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Get marker and type of active portion of marker. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Always do a markpos whether we Add or not. */ + GmMarkpos (gm); + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_redraw -- Redraw a marker. + */ +static void +M_redraw (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int erase; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + /* This redraw undoes the final Xor draw. */ + GmRedraw (gm, GXxor, erase=False); + + /* Redraw the full marker. */ + GmRedraw (gm, GXcopy, erase=True); +} + + +/* M_addPt -- Add a point. + */ +static void +M_addPt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_deletePt -- Delete a point. + */ +static void +M_deletePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (what->type == Ge_Point) + GmDeletePt (gm, ev->x, ev->y); +} + + +/* M_movePt -- Move a point. + */ +static void +M_movePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Move a point (vertex) if supported by marker type. */ + if (what->type == Ge_Point && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmMovePt (gm, ev->x, ev->y); +} + + +/* M_deleteDestroy -- Delete a point or destroy a marker, depending upon the + * pointer position. + */ +static void +M_deleteDestroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + switch (what->type) { + case Ge_Point: + GmDeletePt (gm, ev->x, ev->y); + break; + case Ge_Marker: + GmDestroy (gm); + break; + } +} + + +/* M_move -- Move a marker. + */ +static void +M_move (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmMove (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_resize -- Resize a marker. + */ +static void +M_resize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmResize (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_moveResize -- Move a point or marker, or resize a marker, depending + * upon the pointer position. + */ +static void +M_moveResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Marker: + GmMove (gm, ev->x, ev->y); + break; + case Ge_Point: + if (gm->type == Gm_Polygon || gm->type == Gm_Polyline) + GmMovePt (gm, ev->x, ev->y); + else + goto resize; + break; + case Ge_Edge: +resize: GmResize (gm, ev->x, ev->y); + break; + } + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotate -- Rotate a marker. + */ +static void +M_rotate (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmRotate (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotateResize -- Rotate or resize a marker. + */ +static void +M_rotateResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Point: + GmRotate (gm, ev->x, ev->y); + break; + case Ge_Edge: + if (gm->flags & Gm_Smooth) + GmRotate (gm, ev->x, ev->y); + else + GmResize (gm, ev->x, ev->y); + break; + default: + GmResize (gm, ev->x, ev->y); + break; + } + + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* + * Marker class code. + * --------------------- + * Each marker class implements a subset of the following procedures. The + * first set of procedures are required. The second set are optional and + * may be set to NULL in the marker descriptor if not implemented by the + * marker class. + * + * gm_xxxx_init (gm, interactive) + * bool = gm_xxxx_select (gm, x, y, &what) + * gm_xxxx_markpos (gm) + * gm_xxxx_redraw (gm, func) + * gm_xxxx_update (gm) + * + * gm_xxxx_addPt (gm, x, y) + * gm_xxxx_deletePt (gm, x, y) + * gm_xxxx_movePt (gm, x, y) + * gm_xxxx_move (gm, x, y) + * gm_xxxx_resize (gm, x, y) + * gm_xxxx_rotate (gm, x, y) + * + * where xxxx is the 4 character marker class name. + */ + +/* Marker class TEXT. + */ +static int gm_text_select(); +static void gm_text_move(), gm_text_resize(); +static void gm_text_markpos(), gm_text_redraw(); +static void gm_text_update(), gm_text_updatePolygon(); + +static void +gm_text_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Text; + if (!(gm->flags & Gm_Activated)) { + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_TextLineColor; + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->textColor = w->gterm.gm_TextColor; + gm->textBgColor = w->gterm.gm_TextBgColor; + gm->textBorder = w->gterm.gm_TextBorder; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->font = w->gterm.gm_TextFont; + gm->imageText = False; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->npoints = 4 + 1; + gm->points = gm->point_data; + + gm->select = gm_text_select; + gm->markpos = gm_text_markpos; + gm->redraw = gm_text_redraw; + gm->update = gm_text_update; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_text_move; + gm->resize = gm_text_resize; + gm->rotate = NULL; + + if (w->gterm.gm_TextString) { + if (gm->text) + XtFree (gm->text); + gm->text = (char *) XtMalloc (strlen(w->gterm.gm_TextString)+1); + strcpy (gm->text, w->gterm.gm_TextString); + } else + gm->text = NULL; +} + +static int +gm_text_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + + +static void +gm_text_markpos (gm) + register Marker gm; +{ + gm_markpos (gm); +} + + +static void +gm_text_redraw (gm, function) + register Marker gm; + int function; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + int char_width, char_height, xsize, ysize; + int breakline, l_pix, r_pix, maxch, x, y; + XFontStruct *fp = gm->font; + char *ip, *op, *otop; + char *l_ip, *l_op; + char line[1024]; + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + /* In rubber-band mode just draw the outline of the text region. */ + if (function == GXxor) { + int save_lineWidth = gm->lineWidth; + + if (gm->lineWidth <= 0) + gm->lineWidth = 1; + gm_redraw (gm, function); + gm->lineWidth = save_lineWidth; + return; + } + + /* General case. First draw the text box. */ + gm_redraw (gm, function); + + /* Now draw the text. */ + if (!gm->text) + return; + + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + xsize = gm->width; + ysize = gm->height; + + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + if ((maxch = (xsize - l_pix - r_pix) / char_width) < 1) + return; + + x = gm->x + (gm->lineWidth + 1) / 2 + gm->textBorder + 1; + y = gm->y + (gm->lineWidth + 1) / 2 + gm->textBorder + + fp->max_bounds.ascent; + + XSetForeground (w->gterm.display, w->gterm.gm_drawGC, gm->textColor); + XSetBackground (w->gterm.display, w->gterm.gm_drawGC, gm->textBgColor); + XSetFont (w->gterm.display, w->gterm.gm_drawGC, fp->fid); + + /* Fill lines in a multiline text box. + */ + l_ip = l_op = NULL; + otop = line + maxch; + breakline = 0; + + for (ip = gm->text, op=line; *ip || op > line; ) { + if (! *ip) { + breakline++; + } else if (*ip == ' ' || *ip == '\t') { + l_ip = ip; + l_op = op; + *op++ = ' '; + ip++; + } else if (*ip == '\n') { + ip++; + breakline++; + } else + *op++ = *ip++; + + if (breakline || op > otop) { + if (op > otop) { + if (l_ip && l_op) { + ip = l_ip + 1; + *l_op = '\0'; + } else { + while (op > otop) { + if (ip > gm->text && isprint (*(ip-1))) + --ip; + --op; + } + *op = '\0'; + } + } else + *op = '\0'; + + if (gm->imageText) { + while (op < otop) + *op++ = ' '; + *op = '\0'; + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } else { + XDrawString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } + + y += char_height; + if (breakline) + y += gm->textBorder; + if (y + fp->max_bounds.descent > gm->y + ysize) + break; + + op = line; + l_ip = l_op = NULL; + breakline = 0; + } + } +} + + +static void +gm_text_update (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + if (gm->flags & Gm_Modified) { + gm_text_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_text_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = max (0, x - gm->width / 2); + new_gm.y = max (0, y - gm->height / 2); + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); /* corner */ + + gm->x = new_gm.x; + gm->y = new_gm.y; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = abs (x - gm->x); + new_gm.height = abs (y - gm->y); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = new_gm.width; + gm->height = new_gm.height; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_updatePolygon (gm) + register Marker gm; +{ + register XPoint *p = gm->points; + int xsize = gm->width; + int ysize = gm->height; + + p[0].x = gm->x; p[0].y = gm->y; + p[1].x = gm->x; p[1].y = gm->y + ysize; + p[2].x = gm->x + xsize; p[2].y = gm->y + ysize; + p[3].x = gm->x + xsize; p[3].y = gm->y; + p[4].x = gm->x; p[4].y = gm->y; +} + + +/* Marker class LINE. + */ +static void +gm_line_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Line; + /* stub out for now */ +} + + +/* Marker class POLYLINE. + */ +static void +gm_plin_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Polyline; + /* stub out for now */ +} + + +/* Marker class RECTANGLE. + */ +static int gm_rect_select(); +static void gm_rect_move(), gm_rect_resize(), gm_rect_rotate(); +static void gm_rect_update(), gm_rect_updatePolygon(); + +static void +gm_rect_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Rectangle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_rect_select; + gm->markpos = gm_markpos; + gm->update = gm_rect_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_rect_move; + gm->resize = gm_rect_resize; + gm->rotate = gm_rect_rotate; +} + +static void +gm_rect_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_rect_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_rect_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_resize (gm, x, y) + register Marker gm; + int x, y; +{ + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + if (rx < 0) + new_gm.x = gm->x - (-rx - gm->width) / 2; + else + new_gm.x = gm->x + (rx - gm->width) / 2; + + if (ry < 0) + new_gm.y = gm->y - (-ry - gm->height) / 2; + else + new_gm.y = gm->y + (ry - gm->height) / 2; + + new_gm.width = gm->width + (abs(rx) - gm->width) / 2; + new_gm.height = gm->height + (abs(ry) - gm->height) / 2; + + gm_constraint (gm, &new_gm, Gb_X|Gb_Y|Gb_Width|Gb_Height); + gm->x = new_gm.x; + gm->y = new_gm.y; + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_rect_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class BOX. A box marker is like a rectangle except that it is + * described and resized by the center and radius (width/height), like + * the other "centered" marker types (circle, ellipse, etc.). + */ +static int gm_boxx_select(); +static void gm_boxx_move(), gm_boxx_resize(), gm_boxx_rotate(); +static void gm_boxx_update(), gm_boxx_updatePolygon(); + +static void +gm_boxx_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Box; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_boxx_select; + gm->markpos = gm_markpos; + gm->update = gm_boxx_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_boxx_move; + gm->resize = gm_boxx_resize; + gm->rotate = gm_boxx_rotate; +} + +static void +gm_boxx_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_boxx_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_boxx_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_resize (gm, x, y) + register Marker gm; + int x, y; +{ + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_boxx_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class CIRCLE. + */ +static int gm_circ_select(); +static void gm_circ_move(), gm_circ_resize(), gm_circ_rotate(); +static void gm_circ_update(), gm_circ_updatePolygon(); + +static void +gm_circ_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Circle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_CircleLineColor; + gm->knotColor = w->gterm.gm_CircleKnotColor; + gm->knotSize = w->gterm.gm_CircleKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + gm->width = gm->height = (gm->width + gm->height) / 2.0; + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE + 1; + + gm->select = gm_circ_select; + gm->markpos = gm_markpos; + gm->update = gm_circ_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_circ_move; + gm->resize = gm_circ_resize; + gm->rotate = NULL; +} + +static void +gm_circ_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_circ_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_circ_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = new_gm.height = + sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = gm->height = new_gm.width; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double theta, x, y; + + npts = (gm->npoints - 1) / 4; + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x + gm->x; + p[npts*0+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x + gm->x; + p[npts*1+j].y = y + gm->y; + + y = -y; j = i; + p[npts*2+j].x = x + gm->x; + p[npts*2+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x + gm->x; + p[npts*3+j].y = y + gm->y; + } + + p[gm->npoints-1] = p[0]; +} + + +/* Marker class ELLIPSE. + */ +static int gm_elip_select(); +static void gm_elip_move(), gm_elip_resize(), gm_elip_rotate(); +static void gm_elip_update(), gm_elip_updatePolygon(); + +static void +gm_elip_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Ellipse; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_EllipseLineColor; + gm->knotColor = w->gterm.gm_EllipseKnotColor; + gm->knotSize = w->gterm.gm_EllipseKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE + 1; + + gm->select = gm_elip_select; + gm->markpos = gm_markpos; + gm->update = gm_elip_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_elip_move; + gm->resize = gm_elip_resize; + gm->rotate = gm_elip_rotate; +} + +static void +gm_elip_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_elip_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_elip_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta = -(gm->rotangle); + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos(theta) - y * sin(theta); + ry = x * sin(theta) + y * cos(theta); + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + new_gm.rotangle = gm_niceAngle (theta); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_elip_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double cos_rotangle, sin_rotangle; + double theta, x, y; + + npts = (gm->npoints - 1) / 4; + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*0+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*1+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; j = i; + p[npts*2+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*2+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*3+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + } + + p[gm->npoints-1] = p[0]; +} + + +/* Marker class POLYGON. + */ +static int gm_pgon_select(); +static void gm_pgon_addPt(), gm_pgon_deletePt(), gm_pgon_movePt(); +static void gm_pgon_move(), gm_pgon_resize(), gm_pgon_rotate(); +static void gm_pgon_redraw(), gm_pgon_update(), gm_pgon_updatePolygon(); + +static void +gm_pgon_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + register DPoint *p; + + gm->type = Gm_Polygon; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_PgonLineColor; + gm->knotColor = w->gterm.gm_PgonKnotColor; + gm->knotSize = w->gterm.gm_PgonKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + + gm->npoints = gm->pgon_npts = 4 + 1; + gm->points = gm->point_data; + if (gm->pgon) + XtFree ((char *)gm->pgon); + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + gm->x = w->gterm.last_x; + gm->y = w->gterm.last_y; + + if (p) { + p[0].x = -1; p[0].y = -1; + p[1].x = -1; p[1].y = 1; + p[2].x = 1; p[2].y = 1; + p[3].x = 1; p[3].y = -1; + p[4].x = -1; p[4].y = -1; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + + if (interactive) + gm->flags |= Gm_PgonInit; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + /* The following gets executed when an existing non-polygon marker is + * turned into a polygon marker. + */ + if (gm->pgon && gm->pgon_npts) + gm->npoints = gm->pgon_npts; + else { + gm->npoints = gm->pgon_npts = 4 + 1; + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + + if (p) { + p[0].x = -gm->width; p[0].y = -gm->height; + p[1].x = -gm->width; p[1].y = gm->height; + p[2].x = gm->width; p[2].y = gm->height; + p[3].x = gm->width; p[3].y = -gm->height; + p[4].x = -gm->width; p[4].y = -gm->height; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + } + + gm->select = gm_select; + gm->markpos = gm_markpos; + gm->update = gm_pgon_update; + gm->redraw = gm_pgon_redraw; + gm->addPt = gm_pgon_addPt; + gm->deletePt = gm_pgon_deletePt; + gm->movePt = gm_pgon_movePt; + gm->move = gm_pgon_move; + gm->resize = gm_pgon_resize; + gm->rotate = gm_pgon_rotate; +} + +static void +gm_pgon_redraw (gm, function) + register Marker gm; + int function; +{ + /* The PgonInit flag is set when a polygon marker is interactively created + * to cause any pointer motion event to resize the marker. The first + * pointer up causes a redraw which clears the flag. + */ + if (function != GXxor && gm->width > 1 && gm->height > 1) + gm->flags &= ~Gm_PgonInit; + + gm_redraw (gm, function); +} + +static void +gm_pgon_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_pgon_addPt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + int vertex, nbytes; + double rx, ry; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Add the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + nbytes = (gm->npoints + 1) * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + + gm->pgon = pv; + memmove (&pv[vertex+2], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + pv[vertex+1].x = rx; + pv[vertex+1].y = ry; + gm->npoints++; + + nbytes = gm->npoints * sizeof (XPoint); + if (gm->npoints > GM_MAXVERTICES) { + if (gm->points != gm->point_data) + gm->points = (XPoint *) XtRealloc ((char *)gm->points, nbytes); + else + gm->points = (XPoint *) XtMalloc (nbytes); + } else + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_deletePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + int vertex, nbytes; + + if (gm->npoints <= 2) + return; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Delete the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + pv = gm->pgon; + + memmove (&pv[vertex], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + gm->npoints--; + + nbytes = gm->npoints * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + gm->pgon = pv; + + if (gm->npoints <= GM_MAXVERTICES && gm->points != gm->point_data) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_movePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double rx, ry; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get vertex. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + + /* Edit point. */ + p->x = rx; + p->y = ry; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + gm->x = new_gm.x; gm->y = new_gm.y; + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_resize (gm, x, y) + Marker gm; + int x, y; +{ + register DPoint *p, *q; + GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double theta, scale, slope, rx, ry, x1, y1, x2, y2, xi; + int vertex, i; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get first vertex of nearest edge. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + q = p + 1; + + /* Rotate reference frame so that intercept is at y=0. */ + if (abs(rx) + abs(ry) < 1.0) + scale = 1.0; + else { + theta = atan2 (ry, rx); + cos_rotangle = cos (-theta); + sin_rotangle = sin (-theta); + + x1 = p->x * cos_rotangle - p->y * sin_rotangle; + y1 = p->x * sin_rotangle + p->y * cos_rotangle; + x2 = q->x * cos_rotangle - q->y * sin_rotangle; + y2 = q->x * sin_rotangle + q->y * cos_rotangle; + + /* Compute scale factor. */ + if (y1 == y2 || x1 == x2) + scale = 1.0; + else { + slope = (y2 - y1) / (x2 - x1); + xi = x1 - y1 / slope; + scale = sqrt (SQR(rx) + SQR(ry)) / xi; + } + } + + /* Rescale the polygon. */ + for (i=0, p=gm->pgon; i < gm->npoints; i++, p++) { + p->x *= scale; + p->y *= scale; + } + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double scale, alpha, beta, rx, ry; + struct marker new_gm; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + if (x == gm->x && y == gm->y) + return; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + if (abs(rx) + abs(ry) < 1.0) + return; + + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + + p = &gm->pgon[vertex]; + alpha = atan2 (p->y, p->x); + beta = atan2 (ry, rx); + + new_gm.rotangle = gm_niceAngle (gm->rotangle + (beta - alpha)); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_updatePolygon (gm) + Marker gm; +{ + register npts, i; + register DPoint *ip = gm->pgon; + register XPoint *op = gm->points; + double cos_rotangle, sin_rotangle; + int width, height, xp, xn, yp, yn; + + npts = gm->npoints; + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + xp = xn = yp = yn = 0; + + for (i=0; i < npts; i++, ip++, op++) { + /* Compute the rotated point. */ + op->x = ip->x * cos_rotangle - ip->y * sin_rotangle + gm->x + 0.5; + op->y = ip->x * sin_rotangle + ip->y * cos_rotangle + gm->y + 0.5; + + /* Compute a width/height estimate for the polygon. + */ + if (ip->x > xp) + xp = ip->x; + else if (ip->x < xn) + xn = ip->x; + + if (ip->y > yp) + yp = ip->y; + else if (ip->y < yn) + yn = ip->y; + + gm->width = (xp + -xn) / 2; + gm->height = (yp + -yn) / 2; + } + + gm->points[npts-1] = gm->points[0]; + gm->pgon_npts = gm->npoints; +} + + +/* Internal procedures for above code. + * ----------------------------------- + */ + +/* gm_select -- Determine if a point is within or near a marker, and if so, + * determine whether the point selects a vertex, edge, or the entire marker. + */ +static int +gm_select (gm, x, y, what) + Marker gm; + register int x, y; + GmSelection what; +{ + register XPoint *p, *ptop; + GtermWidget w = gm->w; + int v_dist = w->gterm.gm_nearVertex; + int e_dist = w->gterm.gm_nearEdge; + double seglen, d1, d2, s, K, frac; + int ncrossings, x0, y0; + XPoint *q; + int n; + + /* Determine if the point is near a vertex. */ + for (p = gm->points, n = gm->npoints - 1; --n >= 0; p++) + if (abs (x - p->x) < v_dist && abs (y - p->y) < v_dist) { + if (what) { + what->type = Ge_Point; + what->vertex = p - gm->points; + } + return (1); + } + + /* Determine if the point is near an edge. The test is based on the + * observation that when a point is near a line segment, the sum of the + * distances from the point to either end-point of the line segment is + * nearly the same as the length of the line segment. + */ + p = gm->points; + ptop = p + gm->npoints; + x0 = p->x; y0 = p->y; + d1 = sqrt ((double)(SQR(x - x0) + SQR(y - y0))); + + for (p++; p < ptop; p++) { + seglen = sqrt ((double)(SQR(p->x - x0) + SQR(p->y - y0))); + d2 = sqrt ((double)(SQR(x - p->x) + SQR(y - p->y))); + + if (d1 + d2 - seglen < e_dist) { + if (what) { + what->type = Ge_Edge; + what->vertex = (p - 1) - gm->points; + } + return (1); + } + + d1 = d2; + x0 = p->x; y0 = p->y; + } + + /* If the marker is one of the closed polygon types, determine if the + * point is inside the marker. + */ + switch (gm->type) { + case Gm_Line: + case Gm_Polyline: + return (0); + } + + for (p = gm->points, ncrossings=0; p < ptop; p++) { + /* Scan forward until we find a line segment that crosses Y. + */ + if (p->y > y) { + for (p++; p < ptop && p->y >= y; p++) + ; + --p; + } else if (p->y < y) { + for (p++; p < ptop && p->y <= y; p++) + ; + --p; + } + + /* The line segment p[0]:p[1] crosses the Y plane. If this lies + * entirely to the left of the X plane we can ignore it. If any + * portion of the line segment lies to the right of X we compute + * the point where the line intersects the Y plane. If this point + * is to the right of the X plane we have a crossing. + */ + q = p + 1; + if (q < ptop && p->x > x || q->x > x) { + if (q->y == p->y) + frac = (double) 0.0; + else + frac = (double)(y - p->y) / (double)(q->y - p->y); + if ((frac * (q->x - p->x) + p->x) >= x) + ncrossings++; + } + } + + if (ncrossings & 1) { + if (what) + what->type = Ge_Marker; + return (1); + } + + return (0); +} + + +/* gm_markpos -- Mark the current position of a marker. + */ +static void +gm_markpos (gm) + register Marker gm; +{ + gm->old_rect = gm->cur_rect; + XUnionRegion (gm->cur_region, null_region, gm->old_region); +} + + +/* gm_redraw -- Redraw a marker expressed as a list of vertices. + */ +static void +gm_redraw (gm, function) + register Marker gm; + int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + int flags = (Gm_Activated|Gm_Visible); + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!XtIsRealized ((Widget)w)) + return; + if (!((gm->flags & flags) == flags)) + return; + + /* Fill the polygon area if indicated. */ + if (gm->fill && function != GXxor) { + if (gm->fillPattern) { + XSetStipple (display, gc, gm->fillPattern); + XSetForeground (display, gc, gm->fillColor); + XSetBackground (display, gc, gm->fillBgColor); + XSetFillStyle (display, gc, gm->fillStyle); + } else { + XSetForeground (display, gc, gm->fillColor); + XSetFillStyle (display, gc, FillSolid); + } + + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Nonconvex, CoordModeOrigin); + } + + /* Set up the drawing GC. */ + if (function != GXxor) { + XSetFunction (display, gc, function); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, (gm == w->gterm.gm_active) ? + gm->highlightColor : gm->lineColor); + + XSetLineAttributes (display, gc, + gm->lineWidth + + ((gm == w->gterm.gm_active) ? w->gterm.gm_highlightWidth : 0), + gm->lineStyle, + CapButt, + (gm->type == Gm_Polygon || gm->type == Gm_Polyline) ? + JoinBevel : JoinMiter); + } + + /* Draw the marker outline. */ + if (gm->lineWidth > 0) { + if (gm->type == Gm_Circle || + (gm->type == Gm_Ellipse && abs(gm->rotangle) < 0.01)) { + + /* Special case - use X arc drawing primitive. We could use the + * gm->points polygon instead, as this outline polygon is + * maintained for all classes of marker. + */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + } + XDrawArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + + } else { + /* Draw marker expressed as a polygon. */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Convex, CoordModeOrigin); + } + XDrawLines (display, window, gc, + gm->points, gm->npoints, CoordModeOrigin); + } + } + + /* Draw the knots if enabled. */ + if (function != GXxor && gm->knotSize > 0) { + int knotsize = gm->knotSize; + int halfsize = gm->knotSize / 2; + int i; + + XSetForeground (display, gc, gm->knotColor); + for (i=0; i < gm->npoints; i++) { + XFillRectangle (display, window, gc, + gm->points[i].x - halfsize, gm->points[i].y - halfsize, + gm->knotSize, gm->knotSize); + } + } +} + + +/* gm_setCurRect -- Compute a bounding rectangle which completely encloses + * a marker (assumes that the marker is expressed as list of points). + */ +static void +gm_setCurRect (gm) +Marker gm; +{ + int border; + + XDestroyRegion (gm->cur_region); + gm->cur_rect = null_rect; + + if (gm->npoints <= 0) + gm->cur_region = XCreateRegion(); + else { + gm->cur_region = XPolygonRegion (gm->points, gm->npoints, EvenOddRule); + border = (max (gm->lineWidth, gm->knotSize) + 1) / 2; + border = max (border, BORDER); + XShrinkRegion (gm->cur_region, -border, -border); + XClipBox (gm->cur_region, &gm->cur_rect); + } +} + + +/* gm_niceAngle -- Round a rotation angle to a "nice" value. + */ +static double +gm_niceAngle (alpha) + double alpha; +{ + double tol = 0.003; + double beta; + + if ( abs (alpha - PI_2*0) < tol) + beta = PI_2*0; + else if (abs (alpha - PI_2*1) < tol) + beta = PI_2*1; + else if (abs (alpha - PI_2*2) < tol) + beta = PI_2*2; + else if (abs (alpha - PI_2*3) < tol) + beta = PI_2*3; + else if (abs (alpha - PI_2*4) < tol) + beta = PI_2*0; + else + beta = alpha; + + return (beta); +} diff --git a/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.h b/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.h new file mode 100644 index 00000000..a8a4cb48 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.092408/Gterm.h @@ -0,0 +1,306 @@ +#ifndef _Gterm_h +#define _Gterm_h + +/* Parameters: +(this is not yet updated for xgterm - the rest of this file is) + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel White + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + foreground Foreground Pixel Black + height Height Dimension 240 + mappedWhenManaged MappedWhenManaged Boolean True + reverseVideo ReverseVideo Boolean False + width Width Dimension 320 + x Position Position 0 + y Position Position 0 + +*/ + +/* + * Resource definitions. + */ +#define XtCInt "Int" + +#define XtNalphaFont1 "alphaFont1" +#define XtNalphaFont2 "alphaFont2" +#define XtNalphaFont3 "alphaFont3" +#define XtNalphaFont4 "alphaFont4" +#define XtNalphaFont5 "alphaFont5" +#define XtNalphaFont6 "alphaFont6" +#define XtNalphaFont7 "alphaFont7" +#define XtNalphaFont8 "alphaFont8" + +#define XtNdialogFont1 "dialogFont1" +#define XtNdialogFont2 "dialogFont2" +#define XtNdialogFont3 "dialogFont3" +#define XtNdialogFont4 "dialogFont4" +#define XtNdialogFont5 "dialogFont5" +#define XtNdialogFont6 "dialogFont6" +#define XtNdialogFont7 "dialogFont7" +#define XtNdialogFont8 "dialogFont8" + +#define XtNdialogBgColor "dialogBgColor" +#define XtNdialogFgColor "dialogFgColor" +#define XtNidleCursorBgColor "idleCursorBgColor" +#define XtNidleCursorFgColor "idleCursorFgColor" +#define XtNbusyCursorBgColor "busyCursorBgColor" +#define XtNbusyCursorFgColor "busyCursorFgColor" +#define XtNginmodeCursorBgColor "ginmodeCursorBgColor" +#define XtNginmodeCursorFgColor "ginmodeCursorFgColor" +#define XtNginmodeBlinkInterval "ginmodeBlinkInterval" +#define XtNcrosshairCursorColor "crosshairCursorColor" + +#define XtNidleCursor "idleCursor" +#define XtNbusyCursor "busyCursor" +#define XtNginmodeCursor "ginmodeCursor" +#define XtNwarpCursor "warpCursor" +#define XtNraiseWindow "raiseWindow" +#define XtNdeiconifyWindow "deiconifyWindow" +#define XtNuseTimers "useTimers" + +#define XtNcolor0 "color0" +#define XtNcolor1 "color1" +#define XtNcolor2 "color2" +#define XtNcolor3 "color3" +#define XtNcolor4 "color4" +#define XtNcolor5 "color5" +#define XtNcolor6 "color6" +#define XtNcolor7 "color7" +#define XtNcolor8 "color8" +#define XtNcolor9 "color9" + +#define XtNcmapName "cmapName" +#define XtNuseGlobalCmap "useGlobalCmap" +#define XtNcmapInitialize "cmapInitialize" +#define XtNcopyOnResize "copyOnResize" +#define XtNbasePixel "basePixel" +#define XtNcmapUpdate "cmapUpdate" +#define XtNcmapShadow "cmapShadow" +#define XtNcmapInterpolate "cmapInterpolate" +#define XtNmaxRasters "maxRasters" +#define XtNcacheRasters "cacheRasters" +#define XtNmaxMappings "maxMappings" +#define XtNmaxColors "maxColors" + +#define XtNmarkerTranslations "markerTranslations" +#define XtNdefaultMarker "defaultMarker" +#define XtNnearEdge "nearEdge" +#define XtNnearVertex "nearVertex" +#define XtNmarkerLineWidth "markerLineWidth" +#define XtNmarkerLineStyle "markerLineStyle" +#define XtNmarkerFill "markerFill" +#define XtNmarkerFillColor "markerFillColor" +#define XtNmarkerFillBgColor "markerFillBgColor" +#define XtNmarkerFillStyle "markerFillStyle" +#define XtNxorFill "xorFill" +#define XtNxorFillColor "xorFillColor" +#define XtNxorFillBgColor "xorFillBgColor" +#define XtNmarkerHighlightWidth "markerHighlightWidth" +#define XtNmarkerHighlightColor "markerHighlightColor" +#define XtNmarkerCursorFgColor "markerCursorFgColor" +#define XtNmarkerCursorBgColor "markerCursorBgColor" +#define XtNmarkerLineLineColor "markerLineLineColor" +#define XtNmarkerLineKnotColor "markerLineKnotColor" +#define XtNmarkerLineKnotSize "markerLineKnotSize" +#define XtNmarkerTextLineColor "markerTextLineColor" +#define XtNmarkerTextColor "markerTextColor" +#define XtNmarkerTextBgColor "markerTextBgColor" +#define XtNmarkerTextBorder "markerTextBorder" +#define XtNmarkerTextFont "markerTextFont" +#define XtNmarkerTextString "markerTextString" +#define XtNmarkerRectLineColor "markerRectLineColor" +#define XtNmarkerRectKnotColor "markerRectKnotColor" +#define XtNmarkerRectKnotSize "markerRectKnotSize" +#define XtNmarkerBoxLineColor "markerBoxLineColor" +#define XtNmarkerBoxKnotColor "markerBoxKnotColor" +#define XtNmarkerBoxKnotSize "markerBoxKnotSize" +#define XtNmarkerCircleLineColor "markerCircleLineColor" +#define XtNmarkerCircleKnotColor "markerCircleKnotColor" +#define XtNmarkerCircleKnotSize "markerCircleKnotSize" +#define XtNmarkerEllipseLineColor "markerEllipseLineColor" +#define XtNmarkerEllipseKnotColor "markerEllipseKnotColor" +#define XtNmarkerEllipseKnotSize "markerEllipseKnotSize" +#define XtNmarkerPgonLineColor "markerPgonLineColor" +#define XtNmarkerPgonKnotColor "markerPgonKnotColor" +#define XtNmarkerPgonKnotSize "markerPgonKnotSize" + + +/* Deep Frame Definitions */ +#define XtNdialogBgColorStr "dialogBgColorStr" +#define XtNdialogFgColorStr "dialogFgColorStr" +#define XtNidleCursorBgColorStr "idleCursorBgColorStr" +#define XtNidleCursorFgColorStr "idleCursorFgColorStr" +#define XtNbusyCursorBgColorStr "busyCursorBgColorStr" +#define XtNbusyCursorFgColorStr "busyCursorFgColorStr" +#define XtNginmodeCursorBgColorStr "ginmodeCursorBgColorStr" +#define XtNginmodeCursorFgColorStr "ginmodeCursorFgColorStr" +#define XtNcrosshairCursorColorStr "crosshairCursorColorStr" + +#define XtNcolor0Str "color0Str" +#define XtNcolor1Str "color1Str" +#define XtNcolor2Str "color2Str" +#define XtNcolor3Str "color3Str" +#define XtNcolor4Str "color4Str" +#define XtNcolor5Str "color5Str" +#define XtNcolor6Str "color6Str" +#define XtNcolor7Str "color7Str" +#define XtNcolor8Str "color8Str" +#define XtNcolor9Str "color9Str" + +#define XtNmarkerFillColorStr "markerFillColorStr" +#define XtNmarkerFillBgColorStr "markerFillBgColorStr" + +#define XtNmarkerHighlightColorStr "markerHighlightColorStr" +#define XtNmarkerCursorFgColorStr "markerCursorFgColorStr" +#define XtNmarkerCursorBgColorStr "markerCursorBgColorStr" + +#define XtNmarkerLineLineColorStr "markerLineLineColorStr" +#define XtNmarkerLineKnotColorStr "markerLineKnotColorStr" + +#define XtNmarkerTextLineColorStr "markerTextLineColorStr" +#define XtNmarkerTextColorStr "markerTextColorStr" +#define XtNmarkerTextBgColorStr "markerTextBgColorStr" + +#define XtNmarkerRectLineColorStr "markerRectLineColorStr" +#define XtNmarkerRectKnotColorStr "markerRectKnotColorStr" + +#define XtNmarkerBoxLineColorStr "markerBoxLineColorStr" +#define XtNmarkerBoxKnotColorStr "markerBoxKnotColorStr" + +#define XtNmarkerCircleLineColorStr "markerCircleLineColorStr" +#define XtNmarkerCircleKnotColorStr "markerCircleKnotColorStr" + +#define XtNmarkerEllipseLineColorStr "markerEllipseLineColorStr" +#define XtNmarkerEllipseKnotColorStr "markerEllipseKnotColorStr" + +#define XtNmarkerPgonLineColorStr "markerPgonLineColorStr" +#define XtNmarkerPgonKnotColorStr "markerPgonKnotColorStr" + +#define XtNmarkerPointLineColorStr "markerPointLineColorStr" +#define XtNmarkerPointKnotColorStr "markerPointKnotColorStr" +/* Deep Frame Definitions */ + + + +/* + * Gterm widget flags. + */ +#define GtSet 1 /* drawing mode */ +#define GtClear 2 +#define GtInvert 3 + +#define GtOutline 1 /* line styles */ +#define GtPoint 2 +#define GtSolid 3 +#define GtDashed 4 +#define GtDotted 5 +#define GtDashDot 6 +#define GtDash3Dot 7 + +#define GtNoCursor 0 /* cursor types */ +#define GtGinmodeCursor 1 +#define GtBusyCursor 2 +#define GtIdleCursor 3 + +#define GtDefault 0 /* raster types */ +#define GtClient 1 +#define GtServer 2 + +#define GtPixel 0 /* coordinate types */ +#define GtNDC 1 + +#define GtMap 0 /* mapping direction */ +#define GtUnmap 1 + +#define GtWindow 0 /* drawable types */ +#define GtWidget 1 + +#define R_OpcodeMask 0000017 /* rasterop definitions */ +#define R_Transient 0000020 +#define R_RefreshAll 0000040 +#define R_RefreshNone 0000100 +#define R_MFMask 0777000 + +#define MF_NEAREST 0001000 /* antialiasing functions */ +#define MF_BILINEAR 0002000 +#define MF_AREA 0004000 +#define MF_BLKAVG 0010000 +#define MF_BOXCAR 0020000 +#define MF_LOWPASS 0040000 +#define MF_GAUSSIAN 0100000 + +#define GmText "text" /* graphics marker types */ +#define GmLine "line" +#define GmPolyline "polyline" +#define GmRectangle "rectangle" +#define GmBox "box" +#define GmCircle "circle" +#define GmEllipse "ellipse" +#define GmPolygon "polygon" + +#define Gm_Text 1 /* integer codes for above */ +#define Gm_Line 2 +#define Gm_Polyline 3 +#define Gm_Rectangle 4 +#define Gm_Box 5 +#define Gm_Circle 6 +#define Gm_Ellipse 7 +#define Gm_Polygon 8 +#define Gm_NTypes 8 + +#define GmType "type" /* marker attributes */ +#define GmActivated "activated" +#define GmVisible "visible" +#define GmSensitive "sensitive" +#define GmAutoRedraw "autoRedraw" +#define GmTranslations "translations" +#define GmX "x" +#define GmY "y" +#define GmWidth "width" +#define GmHeight "height" +#define GmRotangle "rotangle" +#define GmHighlightColor "highlightColor" +#define GmLineColor "lineColor" +#define GmLineWidth "lineWidth" +#define GmLineStyle "lineStyle" +#define GmKnotColor "knotColor" +#define GmKnotSize "knotSize" +#define GmFill "fill" +#define GmFillColor "fillColor" +#define GmFillBgColor "fillBgColor" +#define GmFillPattern "fillPattern" +#define GmFillStyle "fillStyle" +#define GmTextColor "textColor" +#define GmTextBgColor "textBgColor" +#define GmTextBorder "textBorder" +#define GmImageText "imageText" +#define GmFont "font" +#define GmRotIndicator "rotIndicator" /* MF020 */ + +#define GmEvNotify 00001 /* marker callback events */ +#define GmEvMoveResize 00002 +#define GmEvModify 00004 +#define GmEvRedraw 00010 +#define GmEvDestroy 00020 +#define GmEvInput 00040 +#define GmEvFocusIn 00100 +#define GmEvFocusOut 00200 +#define GmEvConstraint 00400 + +/* Double version of XPoint. */ +struct dPoint { + double x; + double y; +}; +typedef struct dPoint DPoint; + +typedef struct _GtermRec *GtermWidget; +typedef struct _GtermClassRec *GtermWidgetClass; + +extern WidgetClass gtermWidgetClass; + +#endif /* _Gterm_h */ diff --git a/vendor/x11iraf/obm/ObmW/Gterm.092408/GtermP.h b/vendor/x11iraf/obm/ObmW/Gterm.092408/GtermP.h new file mode 100644 index 00000000..12d11cd9 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.092408/GtermP.h @@ -0,0 +1,587 @@ +#ifndef _GtermP_h +#define _GtermP_h + +#include "Gterm.h" + +/* + * GtermP -- Private definitions for the Gterm graphics widget. + */ + +#define DEF_WIDTH 640 +#define DEF_HEIGHT 480 +#define MAX_RASTERS 512 +#define MAX_MAPPINGS 32 +#define SZ_NUMBER 64 +#define SZ_STATIC_CMAP 10 /* bg+fg+NColors */ +#define MAX_SZCMAP 256 /* max size colormap */ +#define DEF_MAXCOLORS 216 /* max dynamic colors */ +#define MAX_WMWIN 32 /* max WM colormaps */ +#define MAX_REGIONS 64 /* setMapping regions */ +#define MAX_AUXTRANS 8 /* auxiliary translations */ +#define DEF_BASEPIXEL 38 /* base of custom colormap */ +#define DEF_CMAPUPDATE 60 /* seconds */ +#define DEF_CMAPSHADOW 10 /* seconds */ +#define DEF_COPYONRESIZE True /* copy pixmap on resize */ +#define DEF_WARPCURSOR False /* enable warp cursor */ +#define DEF_RAISEWINDOW False /* enable raise window */ +#define DEF_DEICONIFYWINDOW False /* enable deiconfify window */ +#define DEF_USETIMERS True /* ok to use timers */ +#define MAX_DRAW 64 /* max mappings for a draw */ +#define MAX_POINTS 4096 /* max points in polyline */ +#define GM_MAXVERTICES 64 /* max GM points w/o malloc */ +#define GM_NPTSCIRCLE 48 /* npoints circle or ellipse */ +#define GM_MAXCALLBACKS 16 /* max GM callbacks */ +#define GM_UPDATE 30 /* marker update interval */ +#define MAXNDC 32767 /* GKI/NDC scale factor */ +#define V_DIST 4 /* Close to vertex, pixels */ +#define E_DIST 1 /* Close to edge, pixels */ + + +#define RasterDepth 8 +#define ColormapDepth 8 +#define RGBDepth 24 + +#define NAlphaFonts 8 +#define NDialogFonts 8 +#define NColors 8 + +typedef void (*GmVMethod)(); +typedef int (*GmIMethod)(); +#define uchar unsigned char +#define ushort unsigned short + +/* Raster definitions. */ +#define ImageRaster 1 +#define PixmapRaster 2 + +struct raster { + int type; + int delete; + int width, height; + union { + Pixmap pixmap; + XImage *ximage; + } r; +}; + +/* Colormap structure. */ +struct colormap { + int map; + int ncells; + struct colormap *next; + unsigned short r[MAX_SZCMAP]; + unsigned short g[MAX_SZCMAP]; + unsigned short b[MAX_SZCMAP]; +}; + +/* mapExtent - Range of dst pixels affected by a src pixel. */ +typedef struct { + Position lo; + Position hi; +} mapExtent, *MapExtent; + +/* Mappings map a source to a destination. A src or dst of zero refers to + * the window, a nonzero value is the raster number. + */ +struct mapping { + int mapping; /* mapping number */ + int enabled; /* update destination */ + int defined; /* mapping is defined */ + int updated; /* internal params ready */ + int refresh; /* refresh entire dest */ + int rop; /* rasterop */ + int src; /* source rect */ + int st; + int sx, sy; + int snx, sny; + int dst; /* destination rect */ + int dt; + int dx, dy; + int dnx, dny; + int scaling; /* internal parameters */ + float xscale, yscale; + mapExtent *x_extent, *y_extent; + int *x_srcpix, *y_srcpix; + float *x_src, *y_src; + uchar *mapdata; + int datalen; + struct mapping *prev; /* previous in stack order */ + struct mapping *next; /* next in stack order */ +}; + +#define M_NOSCALING 0 +#define M_ZOOM 1 +#define M_INTZOOM 2 +#define M_DEZOOM 3 + +/* The drawing context defines what happens when a drawing operation (e.g. + * polyline) takes place. In the simplest case (raster=0) one simply draws + * into the display window with no transformation or clipping. When a + * raster provides the drawing context, the graphics are drawn once for each + * active mapping defined on the raster, using the scaling and drawable + * defined by the mapping. + */ +struct drawContext { + int valid; + int raster; + struct raster *rp; + int nmappings; + struct mappingContext { + int mapping; + struct mapping *mp; + int scale; + float xoffset, xscale; + float yoffset, yscale; + int use_backing_store; + Pixmap pixmap; + GC drawGC; + int GC_private; + } mapContext[MAX_DRAW]; +}; + +/* Graphics Markers. A marker is an active graphics object displayed on + * top of a drawing to mark a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. + */ + +/* Callback descriptor. */ +struct markerCallback { + int events; + GmIMethod func; + XtPointer client_data; +}; + +/* Marker selection. */ +struct markerSelection { + int type; + int vertex; +}; + +/* Main Marker descriptor. */ +struct marker { + GtermWidget w; /* backpointer to widget */ + int type; /* marker type */ + int flags; /* bitflags */ + int x, y; /* position */ + int width, height; /* size */ + double rotangle; /* orientation */ + XtTranslations translations; /* marker translations */ + XRectangle old_rect; /* old bounding box */ + Region old_region; /* old screen region */ + XRectangle cur_rect; /* current bounding box */ + Region cur_region; /* current screen region */ + Time time; /* time of last marker edit */ + struct marker *next; /* next marker */ + struct marker *prev; /* previous marker */ + struct marker *parent; /* set if copy */ + + int lineColor, lineWidth, lineStyle; /* marker attributes */ + int highlightColor; + int knotColor, knotSize; + int fill, fillStyle; + int fillColor, fillBgColor; + Pixmap fillPattern; + int imageText, textBorder; + int textColor, textBgColor; + int rotIndicator; /* MF020 */ + XFontStruct *font; + + int npoints; /* marker data */ + XPoint *points; + XPoint point_data[GM_MAXVERTICES+1]; + struct dPoint *pgon; + int pgon_npts; + char *text; + + GmIMethod select; /* class methods */ + GmVMethod markpos; + GmVMethod redraw; + GmVMethod update; + GmVMethod addPt; + GmVMethod deletePt; + GmVMethod movePt; + GmVMethod move; + GmVMethod resize; + GmVMethod rotate; + + int ncallbacks; /* callbacks */ + struct markerCallback callback[GM_MAXCALLBACKS]; + XtIntervalId focus_id; + int constraints; +}; + +/* Graphics marker bitflags. */ +#define Gm_Activated 000001 +#define Gm_Visible 000002 +#define Gm_Sensitive 000004 +#define Gm_AutoRedraw 000010 +#define Gm_PgonInit 000020 +#define Gm_Smooth 000040 +#define Gm_Modified 000100 +#define Gm_BeingDestroyed 000200 + +/* Attribute value type codes. */ +#define Gt_Bool 1 +#define Gt_Int 2 +#define Gt_DFloatP 3 +#define Gt_Pointer 4 +#define Gt_String 5 + +/* Attribute name codes. */ +#define Ga_Type 1 +#define Ga_Activated 2 +#define Ga_Visible 3 +#define Ga_Sensitive 4 +#define Ga_AutoRedraw 5 +#define Ga_Translations 6 +#define Ga_X 7 +#define Ga_Y 8 +#define Ga_Width 9 +#define Ga_Height 10 +#define Ga_Rotangle 11 +#define Ga_HighlightColor 12 +#define Ga_LineColor 13 +#define Ga_LineWidth 14 +#define Ga_LineStyle 15 +#define Ga_KnotColor 16 +#define Ga_KnotSize 17 +#define Ga_Fill 18 +#define Ga_FillColor 19 +#define Ga_FillBgColor 20 +#define Ga_FillPattern 21 +#define Ga_FillStyle 22 +#define Ga_TextColor 23 +#define Ga_TextBgColor 24 +#define Ga_TextBorder 25 +#define Ga_ImageText 26 +#define Ga_Font 27 +#define Ga_Text 28 +#define Ga_RotIndicator 29 /* MF020 */ + +/* Bitflags for selected attributes. */ +#define Gb_X 00001 +#define Gb_Y 00002 +#define Gb_Width 00004 +#define Gb_Height 00010 +#define Gb_Rotangle 00020 + +/* Codes for marker selection types. */ +#define Ge_Marker 1 +#define Ge_Point 2 +#define Ge_Edge 3 + +/* Auxiliary translation tables. */ +#define T_replace 0 +#define T_augment 1 +#define T_override 2 + +typedef struct raster *Raster; +typedef struct mapping *Mapping; +typedef struct drawContext *DrawContext; +typedef struct mappingContext *MappingContext; +typedef struct marker *Marker; +typedef struct markerSelection gmSelection; +typedef struct markerSelection *GmSelection; + + +/* Gterm callbacks. */ +typedef void (*GtCallbackProc)(); +struct gtCallback { + GtCallbackProc proc; + XtPointer client_data; + struct gtCallback *next; +}; +typedef struct gtCallback GtCallback; + + +/* Main Gterm widget instance descriptor. + */ +typedef struct { + /* resources */ + XFontStruct *alphaFont1; /* graphics fonts */ + XFontStruct *alphaFont2; + XFontStruct *alphaFont3; + XFontStruct *alphaFont4; + XFontStruct *alphaFont5; + XFontStruct *alphaFont6; + XFontStruct *alphaFont7; + XFontStruct *alphaFont8; + + XFontStruct *dialogFont1; /* dialog fonts */ + XFontStruct *dialogFont2; + XFontStruct *dialogFont3; + XFontStruct *dialogFont4; + XFontStruct *dialogFont5; + XFontStruct *dialogFont6; + XFontStruct *dialogFont7; + XFontStruct *dialogFont8; + + Pixel dialogBgColor; /* default colors */ + Pixel dialogFgColor; + Pixel idleCursorBgColor; + Pixel idleCursorFgColor; + Pixel busyCursorBgColor; + Pixel busyCursorFgColor; + Pixel ginmodeCursorBgColor; + Pixel ginmodeCursorFgColor; + int ginmodeBlinkInterval; + XColor ginmodeColors[2]; + Pixel crosshairCursorColor; + String idleCursor; + String busyCursor; + String ginmodeCursor; + Boolean warpCursor; + Boolean raiseWindow; + Boolean deiconifyWindow; + Boolean useTimers; + + Pixel color0; + Pixel color1; + Pixel color2; + Pixel color3; + Pixel color4; + Pixel color5; + Pixel color6; + Pixel color7; + Pixel color8; + Pixel color9; + + String cacheRasters; + int maxRasters; /* raster display stuff */ + int maxMappings; + int maxColors; + + /* private state */ + Display *display; + Screen *screen; + Window window; + Window root; + + int w_depth; /* screen depth and visual */ + int w_visual_class; + + int raster; /* used for drawing context */ + int delay; /* wait for display */ + Pixmap pixmap; /* used to refresh window */ + Pixmap d_pixmap; /* used to erase dialog area */ + int d_saved; /* set when d_pixmap filled */ + GC clearGC; /* clear pixmap */ + GC exposeGC; /* copy pixmap to window */ + GC drawGC; /* graphics drawing */ + GC dialogGC; /* dialog box */ + GC cursorGC; /* crosshair cursor */ + int cursor_type; /* type of cursor to display */ + Cursor cursor; /* current cursor */ + int full_crosshair; /* crosshair enabled */ + int preserve_screen; /* cursor preserves screen */ + int preserve_valid; /* saved data is valid */ + Cursor idle_cursor; /* application is idle */ + Cursor busy_cursor; /* application is busy */ + Cursor ginmode_cursor; /* graphics input mode */ + Cursor crosshair_cursor; /* graphics input mode */ + int cursor_drawn; /* crosshair cursor drawn */ + int cur_x, cur_y; /* crosshair cursor coords */ + int old_width, old_height; /* size before resize */ + int save_root; /* root window of saved cur */ + int save_x, save_y; /* saved cursor location */ + int last_x, last_y; /* x,y of last event */ + int interactive; /* set if cursor read */ + int char_size; /* not used */ + int data_level; /* draw or erase graphics */ + int line_style; /* solid or patterned line */ + int line_width; /* width of line in pixels */ + int fill_type; /* not used */ + int color_index; /* current color index */ + int xres, yres; /* tek logical resolution */ + int d_xoff, d_yoff; /* dialog area offset */ + int d_height; /* dialog area height */ + int optcols, optrows; /* optimum screen size, chars */ + int alpha_font; /* current alpha font index */ + int dialog_font; /* current dialog font index */ + + int ncolors; /* current cmap size */ + int haveColormap; /* colormap initialized */ + Boolean copyOnResize; /* copy old pixmap on resize */ + int useDefaultCM; /* use default colormap */ + Pixel base_pixel; /* used for custom colormap */ + String cmapName; /* private colormap name */ + Boolean useGlobalCmap; /* use global data struct? */ + Boolean cmapInitialize; /* forcibly install colormap */ + Atom cmapAtom; /* atom for cmap property */ + int cmapShadow; /* update default colormap */ + Time cmapLastShadow; /* time of last update */ + Boolean cmapInterpolate; /* interpolate colormap */ + int cmapUpdate; /* update interval, seconds */ + Time cmapLastUpdate; /* time of last update */ + + Pixel *cmap; /* map color number to pixval */ + XColor *color; /* RGB color assignments */ + + ushort iomap[MAX_SZCMAP]; /* client i/o color map */ + Pixel cmap_in[MAX_SZCMAP]; /* umap and cmap combined */ + Pixel cmap_out[MAX_SZCMAP]; /* umap and cmap combined */ + int cmap_in_valid; /* set when cmap_in computed */ + int cmap_out_valid; /* set when cmap_out computed */ + struct colormap *colormaps; /* list of client colormaps */ + Window wmTop; /* top level window */ + Window wmWindows[MAX_WMWIN]; /* custom colormap windows */ + int n_wmWindows; /* number of WM windows */ + int in_window; /* pointer is in window */ + XWindowAttributes wa; /* window attributes */ + int wa_defined; /* set when above is defined */ + + + /* Deep Frame */ + Visual* visual; /* ptr to non-default visual */ + int forcePseudo8; /* force use of Pseudo 8 vis */ + /* Deep Frame */ + + + XFontStruct *alpha_fonts[NAlphaFonts]; /* alpha font index */ + XFontStruct *dialog_fonts[NDialogFonts];/* dialog font index */ + + GtCallback *resetCallback; /* client setGterm callbacks */ + GtCallback *resizeCallback; /* client resize callback */ + GtCallback *inputCallback; /* client event input cb */ + + Raster rasters; /* raster descriptors */ + int nrasters; /* number of alloced rasters */ + Mapping mappings; /* mapping descriptors */ + int nmappings; /* number of mappings */ + Mapping mp_head; /* head of mapping list */ + Mapping mp_tail; /* tail of mapping list */ + struct drawContext draw; /* drawing context */ + + /* Markers */ + Marker gm_head; /* head of marker list */ + Marker gm_tail; /* head of marker list */ + Marker gm_create; /* set if creating marker */ + Marker gm_active; /* marker that has focus */ + gmSelection gm_selection; /* active portion of marker */ + GC gm_drawGC; /* marker drawing GC */ + GC gm_rubberGC; /* marker rubber-band GC */ + Cursor gm_markerCursor; /* pointer in marker */ + Cursor gm_edgeCursor; /* pointer on marker edge */ + Cursor gm_pointCursor; /* pointer near marker point */ + int gm_redisplay; /* redisplay needed */ + int gm_initialized; /* set after init */ + + XtTranslations defTranslations; /* gterm translations */ + XtTranslations auxTrans[MAX_AUXTRANS]; /* auxiliary translations */ + int auxTType[MAX_AUXTRANS]; /* translation type */ + int nauxTrans; /* number of auxilary trans */ + String gm_translations; /* Marker translations */ + XtTranslations gm_defTranslations; /* default marker trans */ + Marker gm_curTranslations; /* current translations */ + Marker gm_reqTranslations; /* requested translations */ + XtIntervalId gm_timer_id; /* translation request timer */ + + String gm_defaultMarker; /* default marker type name */ + int gm_defaultType; /* default marker type */ + int gm_nearEdge; /* defines area near edge */ + int gm_nearVertex; /* defines area near Vertex */ + + int gm_lineWidth; /* shared attributes */ + int gm_lineStyle; + Boolean gm_fill; + Pixel gm_fillColor; + Pixel gm_fillBgColor; + int gm_fillStyle; + Boolean gm_xorFill; /* fill with GXxor */ + int gm_xorFillColor; /* xor-fill color */ + int gm_xorFillBgColor; /* xor-fill background color */ + int gm_highlightWidth; /* highlight width, pixels */ + int gm_highlightColor; /* highlight color */ + Pixel gm_cursorFgColor; /* marker cursors */ + Pixel gm_cursorBgColor; /* marker cursors */ + + Pixel gm_LineLineColor; /* Lines, Polylines */ + Pixel gm_LineKnotColor; + int gm_LineKnotSize; + Pixel gm_TextLineColor; /* Text markers */ + Pixel gm_TextColor; + Pixel gm_TextBgColor; /* bkg color, image text */ + int gm_TextBorder; /* border around text */ + XFontStruct *gm_TextFont; /* default font */ + String gm_TextString; /* default text */ + + Pixel gm_RectLineColor; /* Rectangle markers */ + Pixel gm_RectKnotColor; + int gm_RectKnotSize; + Pixel gm_BoxLineColor; /* Box markers */ + Pixel gm_BoxKnotColor; + int gm_BoxKnotSize; + Pixel gm_CircleLineColor; /* Circle markers */ + Pixel gm_CircleKnotColor; + int gm_CircleKnotSize; + Pixel gm_EllipseLineColor; /* Ellipse markers */ + Pixel gm_EllipseKnotColor; + int gm_EllipseKnotSize; + Pixel gm_PgonLineColor; /* Polygon markers */ + Pixel gm_PgonKnotColor; + int gm_PgonKnotSize; + + /* Deep Frame */ + String dialogBgColorStr; /* default colors */ + String dialogFgColorStr; + String idleCursorBgColorStr; + String idleCursorFgColorStr; + String busyCursorBgColorStr; + String busyCursorFgColorStr; + String ginmodeCursorBgColorStr; + String ginmodeCursorFgColorStr; + String crosshairCursorColorStr; + + String color0Str; + String color1Str; + String color2Str; + String color3Str; + String color4Str; + String color5Str; + String color6Str; + String color7Str; + String color8Str; + String color9Str; + + String gm_highlightColorStr; /* highlight color */ + String gm_fillColorStr; + String gm_fillBgColorStr; + String gm_cursorFgColorStr; /* marker cursors */ + String gm_cursorBgColorStr; + String gm_LineLineColorStr; /* Lines, Polylines */ + String gm_LineKnotColorStr; + String gm_TextLineColorStr; /* Text markers */ + String gm_TextColorStr; + String gm_TextBgColorStr; /* bkg color, image text */ + String gm_RectLineColorStr; /* Rectangle markers */ + String gm_RectKnotColorStr; + String gm_BoxLineColorStr; /* box */ + String gm_BoxKnotColorStr; + String gm_CircleLineColorStr; /* Circle markers */ + String gm_CircleKnotColorStr; + String gm_EllipseLineColorStr; /* Ellipse markers */ + String gm_EllipseKnotColorStr; + String gm_PgonLineColorStr; /* Polygon markers */ + String gm_PgonKnotColorStr; + String gm_PointLineColorStr; /* Point markers */ + String gm_PointKnotColorStr; + /* Deep Frame */ + +} GtermPart; + +typedef struct _GtermRec { + CorePart core; + GtermPart gterm; +} GtermRec; + +typedef struct {int dummy;} GtermClassPart; + +typedef struct _GtermClassRec { + CoreClassPart core_class; + GtermClassPart gterm_class; +} GtermClassRec; + +extern GtermClassRec gtermClassRec; + +#endif /* _GtermP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Gterm.c b/vendor/x11iraf/obm/ObmW/Gterm.c new file mode 100644 index 00000000..39118af9 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.c @@ -0,0 +1,1944 @@ +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <math.h> +#include <time.h> + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/XawInit.h> +#include "GtermP.h" + + +#define DBG_TRACE 0 +#define DBG_CMAPS 0 +#define DBG_IOMAP 0 +#define DBG_VERBOSE 0 +#define DBG_CM_VERB 0 + + + +/* + * Gterm -- Graphics terminal widget. This widget implements only the + * window specific graphics output and graphics window input functions. + * Protocol translation (e.g. Tek emulation) and i/o is done elsewhere; + * see for example gtermio.c. + */ + +#define DefaultAlphaFont 3 +#define DefaultDialogFont 3 +#define DefaultMarkerTextFont 3 +#define ZOOM_TOL 0.0001 + +#define CacheXImage False /* MF004 */ + +static Dimension defXDim = DEF_WIDTH; +static Dimension defYDim = DEF_HEIGHT; + +/* Default translations for Gterm window. */ +/* Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) */ + +static char defaultGtermTranslations[] = +"\ + <Btn1Down>: m_create() \n\ + <Btn2Down>: crosshair(on) \n\ + <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() \n\ +"; + +/* Default translations when pointer is over a marker. */ +static char defaultMarkerTranslations[] = +"\ + !Shift <Btn1Motion>: m_rotateResize() \n\ + <Btn1Motion>: m_moveResize() \n\ + !Shift <Btn1Down>: m_raise() m_markpos() \n\ + <Btn1Down>: m_raise() m_markposAdd() \n\ + <Btn1Up>: m_redraw() m_destroyNull() \n\ + <Btn2Down>: m_lower() \n\ + <Key>BackSpace: m_deleteDestroy() \n\ + <Key>Delete: m_deleteDestroy() \n\ + <KeyPress>: m_input() \n\ + <Motion>: track-cursor() \n\ +"; + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defXDim}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defYDim}, + + {XtNalphaFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont1), XtRString, "nil2"}, + {XtNalphaFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont2), XtRString, "5x8"}, + {XtNalphaFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont3), XtRString, "6x10"}, + {XtNalphaFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont4), XtRString, "7x13"}, + {XtNalphaFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont5), XtRString, "8x13"}, + {XtNalphaFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont6), XtRString, "9x15"}, + {XtNalphaFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont7), XtRString, "9x15"}, + {XtNalphaFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont8), XtRString, "9x15"}, + + {XtNdialogFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont1), XtRString, "nil2"}, + {XtNdialogFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont2), XtRString, "5x8"}, + {XtNdialogFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont3), XtRString, "6x13"}, + {XtNdialogFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont4), XtRString, "7x13"}, + {XtNdialogFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont5), XtRString, "8x13"}, + {XtNdialogFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont6), XtRString, "9x15"}, + {XtNdialogFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont7), XtRString, "9x15"}, + {XtNdialogFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont8), XtRString, "9x15"}, + + {XtNdialogBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.dialogBgColorStr), + XtRImmediate,"yellow"}, + {XtNdialogFgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.dialogFgColorStr), + XtRImmediate,"black"}, + {XtNidleCursorBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursorBgColorStr), + XtRImmediate,"white"}, + {XtNidleCursorFgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursorFgColorStr), + XtRImmediate,"black"}, + {XtNbusyCursorBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursorBgColorStr), + XtRImmediate,"white"}, + {XtNbusyCursorFgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursorFgColorStr), + XtRImmediate,"black"}, + {XtNginmodeCursorBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColorStr), + XtRImmediate,"black"}, + {XtNginmodeCursorFgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColorStr), + XtRImmediate,"white"}, + {XtNcrosshairCursorColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.crosshairCursorColorStr), + XtRImmediate,"red"}, + + {XtNdialogBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogBgColor), XtRString, "yellow"}, + {XtNdialogFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogFgColor), XtRString, "black"}, + {XtNidleCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorBgColor), XtRString, "white"}, + {XtNidleCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorFgColor), XtRString, "black"}, + {XtNbusyCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorBgColor), XtRString, "white"}, + {XtNbusyCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorFgColor), XtRString, "black"}, + {XtNginmodeCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColor), XtRString, "black"}, + {XtNginmodeCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColor), XtRString, "white"}, + {XtNginmodeBlinkInterval, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.ginmodeBlinkInterval), XtRImmediate, 0}, + {XtNcrosshairCursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.crosshairCursorColor), XtRString, "red"}, + + {XtNidleCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursor), XtRString, "plus"}, + {XtNbusyCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursor), XtRString, "watch"}, + {XtNginmodeCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursor), XtRString, "full_crosshair"}, + {XtNwarpCursor, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.warpCursor), XtRImmediate, + (caddr_t)DEF_WARPCURSOR}, + {XtNraiseWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.raiseWindow), XtRImmediate, + (caddr_t)DEF_RAISEWINDOW}, + {XtNdeiconifyWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.deiconifyWindow), XtRImmediate, + (caddr_t)DEF_DEICONIFYWINDOW}, + {XtNuseTimers, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useTimers), XtRImmediate, + (caddr_t)DEF_USETIMERS}, + + {XtNcolor0, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color0), XtRString, "black"}, + {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color1), XtRString, "white"}, + {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color2), XtRString, "red"}, + {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color3), XtRString, "green"}, + {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color4), XtRString, "blue"}, + {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color5), XtRString, "cyan"}, + {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color6), XtRString, "yellow"}, + {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color7), XtRString, "magenta"}, + {XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color8), XtRString, "purple"}, + {XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color9), XtRString, "darkslategray"}, + + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color0Str), XtRImmediate, + (caddr_t)"black"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color1Str), XtRImmediate, + (caddr_t)"white"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color2Str), XtRImmediate, + (caddr_t)"red"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color3Str), XtRImmediate, + (caddr_t)"green"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color4Str), XtRImmediate, + (caddr_t)"blue"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color5Str), XtRImmediate, + (caddr_t)"cyan"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color6Str), XtRImmediate, + (caddr_t)"yellow"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color7Str), XtRImmediate, + (caddr_t)"magenta"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color8Str), XtRImmediate, + (caddr_t)"purple"}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.color9Str), XtRImmediate, + (caddr_t)"darkslategray"}, + + {XtNmarkerFillColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_fillColorStr), + XtRImmediate,"DarkSlateGray"}, + {XtNmarkerFillBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_fillBgColorStr), XtRImmediate,"black"}, + + {XtNmarkerHighlightColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_highlightColorStr), + XtRImmediate,"green"}, + {XtNmarkerCursorFgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_cursorFgColorStr), + XtRImmediate,"yellow"}, + {XtNmarkerCursorBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_cursorBgColorStr), + XtRImmediate,"black"}, + + {XtNmarkerLineLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_LineLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerLineKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_LineKnotColorStr), + XtRImmediate,"blue"}, + + {XtNmarkerTextLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerTextColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextColorStr), XtRImmediate,"yellow"}, + {XtNmarkerTextBgColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextBgColorStr), + XtRImmediate,"DarkSlateGray"}, + + {XtNmarkerRectLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_RectLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerRectKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_RectKnotColorStr), + XtRImmediate,"blue"}, + + {XtNmarkerBoxLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_BoxLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerBoxKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_BoxKnotColorStr), XtRImmediate,"blue"}, + + {XtNmarkerCircleLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_CircleLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerCircleKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_CircleKnotColorStr), + XtRImmediate,"blue"}, + + {XtNmarkerEllipseLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_EllipseLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerEllipseKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColorStr), + XtRImmediate,"blue"}, + + {XtNmarkerPgonLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_PgonLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerPgonKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_PgonKnotColorStr), + XtRImmediate,"blue"}, + + {XtNmarkerPointLineColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_PointLineColorStr), + XtRImmediate,"green"}, + {XtNmarkerPointKnotColorStr, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_PointKnotColorStr), + XtRImmediate,"blue"}, + + + {XtNcopyOnResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.copyOnResize), XtRImmediate, + (caddr_t)DEF_COPYONRESIZE}, + {XtNcmapName, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cmapName), XtRImmediate, + (caddr_t)"default"}, + {XtNuseGlobalCmap, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useGlobalCmap), XtRImmediate, + (caddr_t)FALSE}, + {XtNcmapInitialize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInitialize), XtRImmediate, + (caddr_t)FALSE}, + {XtNbasePixel, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.base_pixel), XtRImmediate, + (caddr_t)DEF_BASEPIXEL}, + {XtNcmapUpdate, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapUpdate), XtRImmediate, + (caddr_t)DEF_CMAPUPDATE}, + {XtNcmapShadow, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapShadow), XtRImmediate, + (caddr_t)DEF_CMAPSHADOW}, + {XtNcmapInterpolate, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInterpolate), XtRImmediate, + (caddr_t)True}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cacheRasters), XtRImmediate, + (caddr_t)"whenNeeded"}, + {XtNmaxRasters, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxRasters), XtRImmediate, + (caddr_t)MAX_RASTERS}, + {XtNmaxMappings, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxMappings), XtRImmediate, + (caddr_t)MAX_MAPPINGS}, + {XtNmaxColors, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxColors), XtRImmediate, + (caddr_t)DEF_MAXCOLORS}, + + {XtNmarkerTranslations, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_translations), XtRImmediate, + (caddr_t)defaultMarkerTranslations}, + {XtNdefaultMarker, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_defaultMarker), XtRImmediate, + (caddr_t)"rectangle"}, + {XtNnearEdge, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearEdge), XtRImmediate, + (caddr_t)E_DIST}, + {XtNnearVertex, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearVertex), XtRImmediate, + (caddr_t)V_DIST}, + + {XtNmarkerLineWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineWidth), XtRImmediate, + (caddr_t)1}, + {XtNmarkerLineStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineStyle), XtRImmediate, + (caddr_t)LineSolid}, + {XtNmarkerFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_fill), XtRImmediate, + (caddr_t)False}, + {XtNmarkerFillColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillColor), XtRString, + "SlateGray"}, + {XtNmarkerFillBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillBgColor), XtRString, + "black"}, + {XtNmarkerFillStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_fillStyle), XtRImmediate, + (caddr_t)FillSolid}, + {XtNxorFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_xorFill), XtRImmediate, + (caddr_t)False}, + {XtNxorFillColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillColor), XtRImmediate, + (caddr_t)2}, + {XtNxorFillBgColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillBgColor), XtRImmediate, + (caddr_t)255}, + {XtNmarkerHighlightWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_highlightWidth), XtRImmediate, + (caddr_t)2}, + {XtNmarkerHighlightColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_highlightColor), XtRString, + "green"}, + {XtNmarkerCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorFgColor), XtRString, + "yellow"}, + {XtNmarkerCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorBgColor), XtRString, + "black"}, + + {XtNmarkerLineLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineLineColor), XtRString, + "green"}, + {XtNmarkerLineKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineKnotColor), XtRString, + "blue"}, + {XtNmarkerLineKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_LineKnotSize), XtRImmediate, + (caddr_t)5}, + + {XtNmarkerTextLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextLineColor), XtRString, + "green"}, + {XtNmarkerTextColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextColor), XtRString, + "yellow"}, + {XtNmarkerTextBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextBgColor), XtRString, + "SlateGray"}, + {XtNmarkerTextBorder, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_TextBorder), XtRImmediate, + (caddr_t)2}, + {XtNmarkerTextFont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.gm_TextFont), XtRString, + "6x13"}, + {XtNmarkerTextString, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextString), XtRImmediate, + (caddr_t)NULL}, + + {XtNmarkerRectLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectLineColor), XtRString, + "green"}, + {XtNmarkerRectKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectKnotColor), XtRString, + "blue"}, + {XtNmarkerRectKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_RectKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerBoxLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxLineColor), XtRString, + "green"}, + {XtNmarkerBoxKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxKnotColor), XtRString, + "blue"}, + {XtNmarkerBoxKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_BoxKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerCircleLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleLineColor), XtRString, + "green"}, + {XtNmarkerCircleKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleKnotColor), XtRString, + "blue"}, + {XtNmarkerCircleKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_CircleKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerEllipseLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseLineColor), XtRString, + "green"}, + {XtNmarkerEllipseKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColor), XtRString, + "blue"}, + {XtNmarkerEllipseKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_EllipseKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerPgonLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonLineColor), XtRString, + "green"}, + {XtNmarkerPgonKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonKnotColor), XtRString, + "blue"}, + {XtNmarkerPgonKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_PgonKnotSize), XtRImmediate, + (caddr_t)5}, +}; + +struct { + unsigned short index; + unsigned short r, g, b; + unsigned long value; + char *name; +} static_colors[] = { + { 0, 0, 0, 0, 0x000000, "black" },/* static colors */ + { 1, 255, 255, 255, 0xffffff, "white" }, + { 2, 255, 0, 0, 0xff0000, "red" }, + { 3, 0, 255, 0, 0x00ff00, "green" }, + { 4, 0, 0, 255, 0x0000ff, "blue" }, + { 5, 0, 255, 255, 0x00ffff, "cyan" }, + { 6, 255, 255, 0, 0xffff00, "yellow" }, + { 7, 255, 0, 255, 0xff00ff, "magenta" }, + { 8, 155, 48, 255, 0xa020f0, "purple" }, + { 9, 151, 255, 255, 0x2f4f4f, "darkslategray" }, + + { 202, 0, 0, 0, 0x000000, "black" },/* overlay colors */ + { 203, 255, 255, 255, 0xffffff, "white" }, + { 204, 255, 0, 0, 0xff0000, "red" }, + { 205, 0, 255, 0, 0x00ff00, "green" }, + { 206, 0, 0, 255, 0x0000ff, "blue" }, + { 207, 255, 255, 0, 0xffff00, "yellow" }, + { 208, 0, 255, 255, 0x00ffff, "cyan" }, + { 209, 255, 0, 255, 0xff00ff, "magenta" }, + { 210, 255, 127, 80, 0xff7f50, "coral" }, + { 211, 176, 48, 96, 0xb03060, "maroon" }, + { 212, 255, 165, 0, 0xffa500, "orange" }, + { 213, 240, 183, 107, 0xf0e68c, "khaki" }, + { 214, 218, 112, 214, 0xda70d6, "orchid" }, + { 215, 64, 224, 208, 0x40e0d0, "turquoise" }, + { 216, 238, 130, 238, 0xee82ee, "violet" }, + { 217, 245, 222, 179, 0xf5deb3, "wheat" }, + { 218, 0, 0, 0, 0x000000, "dummy" }, +}; +static int num_static_colors = 27; + +static int colormap_focus = 512; + + +/* extern void HandlePopupMenu(); */ +static Boolean SetValues(); +static void Initialize(), Realize(), Destroy(), Redisplay(), Resize(); +static void HandleIgnore(), HandleGraphicsInput(), HandleDisplayCrosshair(); +static void HandleSoftReset(), HandleGraphicsContext(); +static void HandleEnterWindow(), HandleLeaveWindow(); +static void color_crosshair(), color_ginmodeCursor(); +static void HandleTrackCursor(); +static void savepos(), blink_cursor(); +static void mp_linkafter(), mp_unlink(); + +Marker GmSelect(); +static void M_create(), GtMarkerFree(); +static void gm_focusin(), gm_focusout(), gm_refocus(); +static void gm_request_translations(), gm_load_translations(); +static int gm_curpos(); + +static set_default_color_index(); +static inherit_default_colormap(); +static update_default_colormap(); +static update_transients(), update_cursor(); +static request_colormap_focus(), restore_colormap_focus(); +static refresh_source(), refresh_destination(), get_regions(); +static get_rects(), scale_zoom(), scale_intzoom(), scale_boxcar(); +static lw_convolve(), bx_boxcar(), bx_extract(), bx_interp(); +static mf_getpixel(), mf_getinten(); +static scale_lowpass(), scale_nearest(), scale_bilinear(); +static save_mapping(), load_mapping(), get_pixel_mapping(); +static update_mapping(), free_mapping(), valid_mapping(), rect_intersect(); +static initialize_mapping(), draw_crosshair(), erase_crosshair(); +static DrawContext get_draw_context(); +static invalidate_draw_context(); +static XPoint *mapVector(); +static Colormap get_colormap(); +static Cursor get_cursor(); +static void init_iomap(), init_global_cmap(), invalidate_cmap(); +static void initColorResources (); +static void gm_rotate_indicator(); /* MF020 */ +static Pixel get_pixel(), *get_cmap_in(), *get_cmap_out(); +static Pixel ColorNameToPixel (); + + +/* Global Colormap declarations. + */ +#define CMAPNAME_SIZE 160 + +static char global_cmapname[CMAPNAME_SIZE]; +static Pixel global_cmap[MAX_SZCMAP]; +static XColor global_color[MAX_SZCMAP]; +static unsigned long global_lut[MAX_SZCMAP]; +static int global_ncolors = 0; +static int global_nstatic = SZ_STATIC_CMAP; +static int global_noverlay = SZ_OVERLAY_CMAP; +static int global_mincolors = 0; +static int valid_lut = 0; + +static int SetGlobalCmap(); +static int ParseGlobalCmap(); +static int GetMaxCmapColors(); +static int GetGlobalColors(); +static void SetGlobalColors(); + + +static void NewCachedXImage(); /* MF004 */ +static void DestroyCachedXImage(); /* MF004 */ +static XImage *GetCachedXImage(); /* MF004 */ + + +static char *dbg_wSize(); /* debug utils */ +static char *dbg_visStr(); + +extern double atof(); + + + +static XtActionsRec gtermActionsList[] = { + { "ignore", HandleIgnore }, + { "graphics-input", HandleGraphicsInput }, + { "crosshair", HandleDisplayCrosshair }, + { "track-cursor", HandleTrackCursor }, + { "enter-window", HandleEnterWindow }, + { "leave-window", HandleLeaveWindow }, +/* { "popup-menu", HandlePopupMenu }, */ + { "reset", HandleSoftReset }, + { "m_create", M_create }, +}; + +GtermClassRec gtermClassRec = { + { /* core fields */ + /* superclass */ &widgetClassRec, + /* class_name */ "Gterm", + /* widget_size */ sizeof(GtermRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ gtermActionsList, + /* num_actions */ XtNumber(gtermActionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ (XrmClass)NULL, + /* compress_motion */ True, + /* compress_exposure */ True, + /* compress_enterleave */ True, + /* visible_interest */ False, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultGtermTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass gtermWidgetClass = (WidgetClass) &gtermClassRec; +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +/* + * Widget class procedures. + * -------------------------- + */ + +/* ARGSUSED */ +static void +Initialize (request, new) + Widget request, new; +{ + register GtermWidget w = (GtermWidget)new; + register GC gc; + + XColor fg_color, bg_color; + XFontStruct **fp; + Font cursor_font; + Display *display; + Screen *screen; + Pixel *pp; + int i; + + XVisualInfo info; /* Deep Frame */ + XStandardColormap std, *stdcmaps; + int nstdcmaps; + XColor colors[MAX_SZCMAP+1]; + char property[128], cname[12]; + + + for (i=0 ; i < MAX_SZCMAP; i++) + memset (&colors[i], 0, sizeof(XColor)); /* Deep Frame */ + + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + w->gterm.display = display = XtDisplay (w); + w->gterm.screen = screen = XtScreen (w); + w->gterm.root = RootWindowOfScreen (screen); + w->gterm.w_depth = DefaultDepth (display, DefaultScreen(display)); + w->gterm.w_visual_class = + DefaultVisual (display, DefaultScreen(display))->class; + + + /* Deep Frame */ + + /* Check if default visual is Pseudo color 8. If so, continue, else + * force a Pseudo 8 visual and new StandardColorMap. + */ + if (XMatchVisualInfo (display, DefaultScreen(display), 8, PseudoColor, + &info) && info.visual == DefaultVisualOfScreen(screen)) { + + /* reset some gterm and core values to reflect the new visual */ + w->core.depth = info.depth; + w->gterm.visual = info.visual; + w->gterm.forcePseudo8 = True; + + /* Find the Standard Color Map */ + + if (DBG_TRACE) + fprintf (stderr, "Gterm.initialize(Pseudo8): cmapName = '%s'\n", + w->gterm.cmapName); + + /* calculate cmap name */ + /* if default, try to extract name from 'default[n:m,name]' */ + + if (!strncmp(w->gterm.cmapName,"default",7)) { + char *p; + + if (p=strstr(w->gterm.cmapName,"[")) { + if (p=strstr(p,",")) { + strcpy(global_cmapname,++p); + if (p=strstr(global_cmapname,"]")) { + *p='\0'; /* cut off the last ']' */ + strcpy(w->gterm.cmapName,global_cmapname); + } + } + } + } + + /* if that didn't work, give it a name + */ + if (!strncmp(w->gterm.cmapName,"default",7)) + strcpy(w->gterm.cmapName,"ForcePseudo"); + + if (DBG_TRACE) + fprintf (stderr, "Gterm.initialize 2(Pseudo8): cmapName = '%s'\n", + w->gterm.cmapName); + + /* create atom */ + sprintf(property, "GT_%s", w->gterm.cmapName); + w->gterm.cmapAtom = XInternAtom (display, property, False); + + + w->core.colormap = 0; + if (XGetRGBColormaps (display, w->gterm.root, &stdcmaps, &nstdcmaps, + w->gterm.cmapAtom)) { + if (stdcmaps[0].colormap && stdcmaps[0].visualid==info.visualid) { + w->core.colormap = stdcmaps[0].colormap; + w->gterm.base_pixel = stdcmaps[0].base_pixel; + } + } + + if (DBG_TRACE) + fprintf (stderr, + "Gterm.intialize(Pseudo8): colormap = 0x%x base=%d\n", + w->core.colormap, w->gterm.base_pixel); + + /* create Standard Color Map */ + if (!w->core.colormap && info.visual) { + w->core.colormap = XCreateColormap (display, w->gterm.root, + info.visual, AllocAll); + + /* Set the Static Colors */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + colors[i].pixel = i; + XParseColor(display, w->core.colormap, + static_colors[i].name, &colors[i]); + } + XStoreColors (display, w->core.colormap, colors, SZ_STATIC_CMAP); + + /* save Standard Color Map */ + std.colormap = w->core.colormap; + std.red_max = 1; + std.red_mult = 0; + std.green_max = std.green_mult = 0; + std.blue_max = std.blue_mult = 0; + std.base_pixel = w->gterm.base_pixel; + std.visualid = info.visualid; + std.killid = 0; + XSetRGBColormaps (display, w->gterm.root, &std, 1, + w->gterm.cmapAtom); + XSetCloseDownMode (display, RetainPermanent); + } + + if (DBG_TRACE) + fprintf (stderr, + "Gterm.initialize(Pseudo8): defDepth=%d cmap=0x%x\n", + w->gterm.w_depth, w->core.colormap); + + /* Let gterm know what we have done. + */ + /* will be reset later on, but put here for clarity */ + w->gterm.useDefaultCM = False; + w->gterm.useGlobalCmap = False; + w->gterm.haveColormap = True; + w->gterm.cmapInitialize = False; + + } else { + XVisualInfo *vp, template; + int i, j, k, nvis; + unsigned short val; + float scale; + + + memset (&template, 0, sizeof (template)); + template.class = TrueColor; + + vp = XGetVisualInfo (display, VisualClassMask, &template, &nvis); + + if (DBG_TRACE) { + fprintf (stderr, "NO 8-bit PSEUDO FOUND.....USING TRUECOLOR\n"); + fprintf (stderr, "nvis=%d defDepth=%d cmap=0x%x\n", + nvis, w->gterm.w_depth, w->core.colormap); + } + + /* Let gterm know what we have done. + */ + w->gterm.visual = vp->visual; + w->gterm.useDefaultCM = True; + w->gterm.useGlobalCmap = True; + w->gterm.haveColormap = True; + w->gterm.forcePseudo8 = False; + w->gterm.cmapInitialize = False; + w->gterm.ncolors = 200; + w->gterm.base_pixel = 0; + w->gterm.cmapName = "default"; + + /* Create a standard colormap of the static pixels. + */ + w->gterm.color0 = ColorNameToPixel (w, w->gterm.color0Str); + w->gterm.color1 = ColorNameToPixel (w, w->gterm.color1Str); + w->gterm.color2 = ColorNameToPixel (w, w->gterm.color2Str); + w->gterm.color3 = ColorNameToPixel (w, w->gterm.color3Str); + w->gterm.color4 = ColorNameToPixel (w, w->gterm.color4Str); + w->gterm.color5 = ColorNameToPixel (w, w->gterm.color5Str); + w->gterm.color6 = ColorNameToPixel (w, w->gterm.color6Str); + w->gterm.color7 = ColorNameToPixel (w, w->gterm.color7Str); + w->gterm.color8 = ColorNameToPixel (w, w->gterm.color8Str); + w->gterm.color9 = ColorNameToPixel (w, w->gterm.color9Str); + + + /* Set the Static part of the colormap. + */ + for (i=0; i < MAX_SZCMAP; i++) { + global_cmap[i] = i; + colors[i].pixel = i; + colors[i].flags = (DoRed | DoGreen | DoBlue); + } + + for (i=0; i < SZ_STATIC_CMAP; i++) { + colors[i].pixel = global_color[i].pixel = static_colors[i].index; + colors[i].red = global_color[i].red = static_colors[i].r << 8; + colors[i].green = global_color[i].green = static_colors[i].g << 8; + colors[i].blue = global_color[i].blue = static_colors[i].b << 8; + } + + /* Set the Dynamic part of the colormap. Here we scale the 255 levels + ** to the 200 levels we gets from the client. + */ + scale = 255. / 200.; + for (i=0; i < SZ_DYNAMIC_CMAP; i++) { + j = SZ_STATIC_CMAP + i; + k = i + 1; + val = ((unsigned short) ((i * scale) + 0.5)) << 8; + + colors[j].pixel = global_color[j].pixel = j; + colors[j].red = global_color[j].red = val; + colors[j].green = global_color[j].green = val; + colors[j].blue = global_color[j].blue = val; + } + + /* Set the overlay colors in the colormap. These indices are what's + ** defined in the graphcap file and can be extended as needed. + */ + for (i=0; i < SZ_OVERLAY_CMAP; i++) { + j = SZ_STATIC_CMAP + i; + k = static_colors[j].index + SZ_STATIC_CMAP; + + colors[k].pixel = global_color[k].pixel = k; + colors[k].red = global_color[k].red = static_colors[j].r << 8; + colors[k].green = global_color[k].green = static_colors[j].g << 8; + colors[k].blue = global_color[k].blue = static_colors[j].b << 8; + } + + + /* Set the Static Colors. FIXME ****** + if ((w->core.colormap = XCreateColormap (display, w->gterm.root, + vp->visual, AllocNone))) { + + for (i=0; i < MAX_SZCMAP; i++) { + sprintf (cname,"#%02x%02x%02x", + global_color[i].red, + global_color[i].green, + global_color[i].blue); + if (!XParseColor( display, w->core.colormap, cname, &colors[i])) + continue; + colors[i].pixel = i; + colors[i].flags = DoRed | DoGreen | DoBlue; + } + XStoreColors (display, w->core.colormap, colors, MAX_SZCMAP); + XSetWindowColormap (display, w->gterm.root, w->core.colormap ); + } + */ + + if (DBG_TRACE) + fprintf (stderr, + "Gterm.initialize (TrueColor): after colormap, cmap=0x%x\n", + w->core.colormap); + } + /* Deep Frame */ + + + XtVaSetValues ((Widget)w, XtNbackground, (XtArgVal)w->gterm.color0, NULL); + + /* Initialize color map. + */ + if (w->gterm.useGlobalCmap) { + w->gterm.cmap = (Pixel *) global_cmap; + w->gterm.color = (XColor *) global_color; + w->gterm.ncolors = SZ_STATIC_CMAP + SZ_DYNAMIC_CMAP + SZ_OVERLAY_CMAP; + for (i=0; i < MAX_SZCMAP; i++) + w->gterm.cmap_in[i] = w->gterm.cmap_out[i] = w->gterm.iomap[i] = i; + + } else { + pp = &w->gterm.color0; + w->gterm.cmap = (Pixel *) XtCalloc (MAX_SZCMAP, sizeof(Pixel)); + w->gterm.color = (XColor *)XtCalloc (MAX_SZCMAP, sizeof(XColor)); + + for (i=0; i < SZ_STATIC_CMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + w->gterm.color[i].red = 0; + w->gterm.color[i].green = 0; + w->gterm.color[i].blue = 0; + } + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors(display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + + init_iomap (w); + } + + if (DBG_TRACE) + fprintf (stderr, "Gterm.intialize: cmap initialized\n"); + + + /* if we have not yet allocated any colors ... The SetGlobalCmap() + ** function returns zero when useGlobalCmap is disabled, but it also + ** allocates the gterm.cmap and gterm.color pointers in this case. + */ + if (! w->gterm.useGlobalCmap) { + if (SetGlobalCmap(w) == 0 && !w->gterm.useGlobalCmap) { + pp = &w->gterm.color0; + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors (display, w->core.colormap, w->gterm.color, + SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + } else { + /* in the case of a default colormap, we might already have color + * cells. + */ + w->gterm.ncolors = GetGlobalColors (); + } + w->gterm.useDefaultCM = ParseGlobalCmap (w); + + w->gterm.useDefaultCM = (strcmp (w->gterm.cmapName, "default") == 0); + w->gterm.haveColormap = w->gterm.useDefaultCM; + + } else + i = GetGlobalColors (); + + + /* Now fix up some color resources. + */ + initColorResources (w); + + + if (DBG_TRACE) + fprintf (stderr, + "Gterm.intialize: ncolors=%d useDefaultCM=%d core.colormap=0x%x\n", + w->gterm.ncolors, w->gterm.useDefaultCM, w->core.colormap); + + w->gterm.cmapLastUpdate = 0; + w->gterm.cmapLastShadow = 0; + w->gterm.in_window = 0; + w->gterm.n_wmWindows = 0; /* MF012 */ + + + /* Get clear pixmap GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + if (w->gterm.useGlobalCmap) { + XSetBackground (display, gc, static_colors[0].value); + XSetForeground (display, gc, static_colors[0].value); + } else { + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color0); + } + w->gterm.clearGC = gc; + XSetGraphicsExposures (display, gc, 0); /* MF029 */ + + /* Get expose GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + w->gterm.exposeGC = gc; + XSetGraphicsExposures (display, gc, 0); /* MF029 */ + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + if (w->gterm.useGlobalCmap) { + XSetBackground (display, gc, static_colors[0].value); + XSetForeground (display, gc, static_colors[1].value); + } else { + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + } + XSetLineAttributes (display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.dialogBgColor); + XSetForeground (display, gc, w->gterm.dialogFgColor); + /* XSetFunction (display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + + /* Get special cursors. */ + bg_color.pixel = w->gterm.idleCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.idleCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.idle_cursor = get_cursor (w, w->gterm.idleCursor); + XRecolorCursor (display, w->gterm.idle_cursor, &fg_color, &bg_color); + /* MF030 */ + bg_color.pixel = w->gterm.busyCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.busyCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.busy_cursor = get_cursor (w, w->gterm.busyCursor); + XRecolorCursor (display, w->gterm.busy_cursor, &fg_color, &bg_color); + /* MF030 */ + bg_color.pixel = w->gterm.color0; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, w->core.colormap, &fg_color); + cursor_font = XLoadFont (display, "cursor"); + w->gterm.crosshair_cursor = XCreateGlyphCursor (display, + cursor_font, cursor_font, XC_crosshair, XC_crosshair, + &fg_color, &bg_color); + + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + if (strcmp (w->gterm.ginmodeCursor, "full_crosshair") != 0) { + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + XRecolorCursor (display, + w->gterm.ginmode_cursor, &fg_color, &bg_color); /* MF030 */ + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + } else + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, "full_crosshair") == 0); + + + /* Make sure we have all the fonts we need. */ + for (fp = &w->gterm.alphaFont1, i=0; i < NAlphaFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.alpha_fonts[i] = *fp; + } + for (fp = &w->gterm.dialogFont1, i=0; i < NDialogFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.dialog_fonts[i] = *fp; + } + + + /* Raster initialization. */ + w->gterm.rasters = NULL; + w->gterm.nrasters = 0; + w->gterm.mappings = NULL; + w->gterm.nmappings = 0; + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + w->gterm.colormaps = NULL; + w->gterm.wa_defined = 0; + memset ((char *)&w->gterm.draw, 0, sizeof (struct drawContext)); + + /* Marker initialization. */ + w->gterm.gm_head = NULL; + w->gterm.gm_tail = NULL; + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.defTranslations = NULL; + w->gterm.nauxTrans = 0; + w->gterm.gm_defTranslations = NULL; + w->gterm.gm_curTranslations = NULL; + w->gterm.gm_reqTranslations = NULL; + w->gterm.gm_timer_id = (XtIntervalId) NULL; + w->gterm.gm_initialized = False; + + /* Set defaults (some of these are clobbered anyway by Realize/Resize). */ + w->gterm.raster = 0; + w->gterm.cur_x = 0; + w->gterm.cur_y = 0; + w->gterm.last_x = 0; + w->gterm.last_y = 0; + w->gterm.cursor_drawn = 0; + w->gterm.cursor_type = GtIdleCursor; + w->gterm.pixmap = (Pixmap)NULL; + w->gterm.d_pixmap = (Pixmap)NULL; + w->gterm.preserve_screen = 0; + w->gterm.preserve_valid = 0; + w->gterm.d_saved = 0; + w->gterm.alpha_font = DefaultAlphaFont; + w->gterm.dialog_font = DefaultDialogFont; + w->gterm.optcols = 80; + w->gterm.optrows = 35; + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + + /* Deep Frame + set_default_color_index (w); + Deep Frame */ + + /* Disable input until window is ready. */ + w->gterm.delay = 1; + + if (DBG_TRACE) { + if (DBG_CM_VERB) + dbg_printCmaps(w); + fprintf (stderr, "Initialize[%s] RETURNING\n\n", dbg_wSize(w)); + } +} + + +static void +initColorResources (w) + GtermWidget w; +{ + w->gterm.color0 = ColorNameToPixel (w, w->gterm.color0Str); + w->gterm.color1 = ColorNameToPixel (w, w->gterm.color1Str); + w->gterm.color2 = ColorNameToPixel (w, w->gterm.color2Str); + w->gterm.color3 = ColorNameToPixel (w, w->gterm.color3Str); + w->gterm.color4 = ColorNameToPixel (w, w->gterm.color4Str); + w->gterm.color5 = ColorNameToPixel (w, w->gterm.color5Str); + w->gterm.color6 = ColorNameToPixel (w, w->gterm.color6Str); + w->gterm.color7 = ColorNameToPixel (w, w->gterm.color7Str); + w->gterm.color8 = ColorNameToPixel (w, w->gterm.color8Str); + w->gterm.color9 = ColorNameToPixel (w, w->gterm.color9Str); + + w->gterm.dialogBgColor = + ColorNameToPixel (w, w->gterm.dialogBgColorStr); + w->gterm.dialogFgColor = + ColorNameToPixel (w, w->gterm.dialogFgColorStr); + + w->gterm.idleCursorBgColor = + ColorNameToPixel (w, w->gterm.idleCursorBgColorStr); + w->gterm.idleCursorFgColor = + ColorNameToPixel (w, w->gterm.idleCursorFgColorStr); + + w->gterm.busyCursorBgColor = + ColorNameToPixel (w, w->gterm.busyCursorBgColorStr); + w->gterm.busyCursorFgColor = + ColorNameToPixel (w, w->gterm.busyCursorFgColorStr); + + w->gterm.ginmodeCursorBgColor = + ColorNameToPixel (w, w->gterm.ginmodeCursorBgColorStr); + w->gterm.ginmodeCursorFgColor = + ColorNameToPixel (w, w->gterm.ginmodeCursorFgColorStr); + w->gterm.crosshairCursorColor = + ColorNameToPixel (w, w->gterm.crosshairCursorColorStr); + + w->gterm.gm_fillColor = + ColorNameToPixel (w, w->gterm.gm_fillColorStr); + w->gterm.gm_fillBgColor = + ColorNameToPixel (w, w->gterm.gm_fillBgColorStr); + + w->gterm.gm_highlightColor = + ColorNameToPixel (w, w->gterm.gm_highlightColorStr); + + w->gterm.gm_cursorFgColor = + ColorNameToPixel (w, w->gterm.gm_cursorFgColorStr); + w->gterm.gm_cursorBgColor = + ColorNameToPixel (w, w->gterm.gm_cursorBgColorStr); + + w->gterm.gm_LineLineColor = + ColorNameToPixel (w, w->gterm.gm_LineLineColorStr); + w->gterm.gm_LineKnotColor = + ColorNameToPixel (w, w->gterm.gm_LineKnotColorStr); + + w->gterm.gm_TextLineColor = + ColorNameToPixel (w, w->gterm.gm_TextLineColorStr); + w->gterm.gm_TextColor = + ColorNameToPixel (w, w->gterm.gm_TextColorStr); + w->gterm.gm_TextBgColor = + ColorNameToPixel (w, w->gterm.gm_TextBgColorStr); + + w->gterm.gm_RectLineColor = + ColorNameToPixel (w, w->gterm.gm_RectLineColorStr); + w->gterm.gm_RectKnotColor = + ColorNameToPixel (w, w->gterm.gm_RectKnotColorStr); + + w->gterm.gm_BoxLineColor = + ColorNameToPixel (w, w->gterm.gm_BoxLineColorStr); + w->gterm.gm_BoxKnotColor = + ColorNameToPixel (w, w->gterm.gm_BoxKnotColorStr); + + w->gterm.gm_CircleLineColor = + ColorNameToPixel (w, w->gterm.gm_CircleLineColorStr); + w->gterm.gm_CircleKnotColor = + ColorNameToPixel (w, w->gterm.gm_CircleKnotColorStr); + + w->gterm.gm_EllipseLineColor = + ColorNameToPixel (w, w->gterm.gm_EllipseLineColorStr); + w->gterm.gm_EllipseKnotColor = + ColorNameToPixel (w, w->gterm.gm_EllipseKnotColorStr); + + w->gterm.gm_PgonLineColor = + ColorNameToPixel (w, w->gterm.gm_PgonLineColorStr); + w->gterm.gm_PgonKnotColor = + ColorNameToPixel (w, w->gterm.gm_PgonKnotColorStr); +} + + + +static void +Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + GtermWidget w = (GtermWidget) gw; + GC gc; + Pixmap pixmap; + + + + if (DBG_TRACE) + fprintf (stderr, "Realize[%s] ENTER:\n", dbg_wSize(w)); + + /* Set default window size. */ + XtMakeResizeRequest (gw, w->core.width, w->core.height, + &w->core.width, &w->core.height); + + /* Should define pseudocolor visual here, if truecolor or directcolor + * default visual. + */ + + /* Create graphics window. */ /* Deep Frame */ + if (w->gterm.forcePseudo8) /* force Pseudo 8 visual */ + XtCreateWindow (gw, InputOutput, w->gterm.visual, *valueMask, attrs); + + else /* Default Visual is Pseudo */ + XtCreateWindow (gw, InputOutput, (Visual *)CopyFromParent, *valueMask, + attrs); /* Deep Frame */ + + + w->gterm.window = XtWindow (gw); + w->gterm.old_width = w->gterm.xres = w->core.width; + w->gterm.old_height = w->gterm.yres = w->core.height; + + + /* Deep Frame */ + /* Define GC here, so that we have a Drawable at the proper depth */ + + /* Get 8-bit pixmap GC. + */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, w->core.height, RasterDepth); + gc = XCreateGC (w->gterm.display, pixmap, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.color0); + w->gterm.clear8GC = gc; + + gc = XCreateGC (w->gterm.display, pixmap, 0, NULL); + w->gterm.expose8GC = gc; + XFreePixmap (w->gterm.display, pixmap); + + + + /* Get clear pixmap GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.color0); + w->gterm.clearGC = gc; +/* XSetGraphicsExposures (w->gterm.display, gc, 0);*/ /* MF029 */ + + /* Get expose GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + w->gterm.exposeGC = gc; +/* XSetGraphicsExposures (w->gterm.display, gc, 0);*/ /* MF029 */ + + /* Get graphics drawing GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.color1); + XSetLineAttributes (w->gterm.display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.dialogBgColor); + XSetForeground (w->gterm.display, gc, w->gterm.dialogFgColor); + /* XSetFunction (w->gterm.display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (w->gterm.display, w->gterm.window, 0, NULL); + XSetBackground (w->gterm.display, gc, w->gterm.color0); + XSetForeground (w->gterm.display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (w->gterm.display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + if (DBG_TRACE) + fprintf (stderr, "Gterm.Realize: force8=%d core colormap 0x%x\n", + w->gterm.forcePseudo8, w->core.colormap); + + set_default_color_index (w); + if (w->gterm.forcePseudo8) { + XInstallColormap (w->gterm.display, w->core.colormap); + request_colormap_focus (w); + } + /* Deep Frame */ + + + GtRasterInit (w); + GtMarkerInit (w); + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = w->gterm.idle_cursor); + + Resize (gw); + + if (DBG_TRACE) + fprintf (stderr, "Realize[%s] DONE:\n", dbg_wSize(w)); +} + +static void +Destroy (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb, *cb_next; + Display *display = w->gterm.display; + + + + if (DBG_TRACE) + fprintf (stderr, "Destroy[%s] ENTER:\n", dbg_wSize(w)); + + + /* Get rid of any raster stuff. */ + GtRasterInit (w); /* MF008 */ + XtFree ((char *)w->gterm.rasters); + XtFree ((char *)w->gterm.mappings); + + /* Destroy any markers. */ + GtMarkerFree (w); + + /* Can't use XtDestroyGC here; the source says it is broken and will + * work only for applications that have only 1 display, and we have 2. + * Also the documentation in Asente&Swick documents the calling sequence + * incorrectly. + */ + XFreeGC (display, w->gterm.clearGC); + XFreeGC (display, w->gterm.clear8GC); + XFreeGC (display, w->gterm.exposeGC); + XFreeGC (display, w->gterm.drawGC); + XFreeGC (display, w->gterm.dialogGC); + XFreeGC (display, w->gterm.cursorGC); + + /* This one also proves problematic. When there are multiple gterm + * widgets allocating the same cursor, succeeding calls for the same + * cursor return the same cursor ID. When these widgets are later + * destroyed, the first XFreeCursor succeeds but subsequent ones find + * the referenced cursor undefined and the application boms with a + * BadCursor error. This must be some problem with reference counts + * in the X server. Cursors use minor amounts of resources and they + * will probably be freed anyway when the display is closed, so we just + * leave them defined here. + * + XFreeCursor (display, w->gterm.idle_cursor); + XFreeCursor (display, w->gterm.busy_cursor); + XFreeCursor (display, w->gterm.crosshair_cursor); + if (w->gterm.ginmode_cursor != w->gterm.crosshair_cursor) + XFreeCursor (display, w->gterm.ginmode_cursor); + */ + + if (w->gterm.pixmap) + XFreePixmap (w->gterm.display, w->gterm.pixmap); + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + + /* Destroy callback lists. */ + for (cb = w->gterm.resetCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.resizeCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.inputCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + XtFree (w->gterm.ginmodeCursor); + + if (DBG_TRACE) + fprintf (stderr, "Destroy[%s] DONE:\n", dbg_wSize(w)); +} + +static void +Resize (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb; + int char_width, char_height, char_base; + int bestfont, fonterr, dx, dy, i; + unsigned int width, height, u_junk; + GtCallback cbl[128]; + XFontStruct *fp; + int ncb, junk; + Pixmap pixmap; + Window root; + + + if (!w || !XtIsRealized(gw)) + return; + + if (DBG_TRACE) + fprintf (stderr, "Resize[%s] ENTER:\n", dbg_wSize(w)); + + + /* Create new pixmap. + */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width + 1, w->core.height + 1, w->core.depth); + if (pixmap) + XFillRectangle (w->gterm.display, pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + + /* Copy old pixmap into new and free old pixmap. + */ + if (w->gterm.pixmap) { + XGetGeometry (w->gterm.display, w->gterm.pixmap, + &root, &junk, &junk, &width, &height, &u_junk, &u_junk); + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.copyOnResize) + XCopyArea (w->gterm.display, w->gterm.pixmap, pixmap, + w->gterm.exposeGC, 0, 0, width-1, height-1, 0, 0); + XFreePixmap (w->gterm.display, w->gterm.pixmap); + } + + /* Install new pixmap. + */ + w->gterm.pixmap = pixmap; + w->gterm.preserve_valid = 0; + + /* Redraw window. + */ + if (w->gterm.pixmap) { + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, 0, 0, w->core.width, w->core.height, 0, 0); + } + + /* Pick best alpha font. + */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NAlphaFonts; i++) { + fp = w->gterm.alpha_fonts[i]; + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + dx = (((int)w->core.width / char_width) - w->gterm.optcols) * 2; + dy = ((int)w->core.height / char_height) - w->gterm.optrows; + if (abs(dx) + abs(dy) < fonterr) { + bestfont = i; + fonterr = abs(dx) + abs(dy); + } + } + + w->gterm.alpha_font = bestfont; + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + XSetFont (w->gterm.display, w->gterm.drawGC, fp->fid); + + /* Pick best dialog font. + */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NDialogFonts; i++) { + fp = w->gterm.dialog_fonts[i]; + char_width = fp->max_bounds.width; + dx = ((int)w->core.width / char_width) - 80; + if (abs(dx) < fonterr) { + bestfont = i; + fonterr = abs(dx); + } + } + + w->gterm.dialog_font = bestfont; + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + char_base = fp->max_bounds.ascent; + + w->gterm.d_xoff = 2; + w->gterm.d_yoff = w->core.height - char_height - 2; + w->gterm.d_height = char_height; + XSetFont (w->gterm.display, w->gterm.dialogGC, fp->fid); + + /* Create dialog save area pixmap. + */ + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + w->gterm.d_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, char_height, w->core.depth); + w->gterm.d_saved = 0; + + /* Adjust cursor position to allow for change in window size. + */ + w->gterm.cur_x = w->gterm.cur_x * (int)w->core.width / w->gterm.old_width; + w->gterm.cur_y = w->gterm.cur_y * (int)w->core.height / w->gterm.old_height; + w->gterm.old_width = w->core.width; + w->gterm.old_height = w->core.height; + if (w->gterm.cursor_type == GtGinmodeCursor) { + XWarpPointer (w->gterm.display, w->gterm.window, w->gterm.window, + 0,0,0,0, w->gterm.cur_x, w->gterm.cur_y); + update_cursor (w); + } + + /* Raster descriptor 0 must track the window size and depth. + */ + if (w->gterm.rasters) { + Raster rp = &w->gterm.rasters[0]; + rp->width = w->core.width; + rp->height = w->core.height; + rp->depth = w->core.depth; + + if (rp->shadow_pixmap) + XFreePixmap (w->gterm.display, rp->shadow_pixmap); + rp->shadow_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width+1, w->core.height+1, RasterDepth); + + if (DBG_TRACE) + fprintf (stderr, "Resize: Raster 0 => %d x %d x %d\n", + w->core.width, w->core.height, w->core.depth); + } + + + /* Mark gterm widget ready for further client input. + */ + w->gterm.delay = 0; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resizeCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w); + + + if (DBG_TRACE) + fprintf (stderr, "Resize[%s] DONE:\n", dbg_wSize(w)); +} + + +/* ARGSUSED */ +static void +Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register GtermWidget w = (GtermWidget) gw; + register XExposeEvent *ev = (XExposeEvent *)event; + int x, y, width, height; + + if (!w || !XtIsRealized (gw)) + return; + + if (DBG_TRACE) + fprintf (stderr, "Redisplay[%s]: ENTER\n", dbg_wSize(w)); + + if (event) { + x = ev->x; + y = ev->y; + width = ev->width; + height = ev->height; + } else { + x = 0; + y = 0; + width = w->core.width; + height = w->core.height; + } + + if (w->gterm.pixmap) { + /* Clipping with the region argument does not work properly with + * the OpenLook server for some reason - the clip region is one + * pixel too small on the right and bottom. Until the reason for + * this becomes clear, we use the bounding box provided in the + * Expose event to roughly clip the refresh. + * + XSetClipOrigin (w->gterm.display, w->gterm.exposeGC, 0, 0); + XSetRegion (w->gterm.display, w->gterm.exposeGC, region); + */ + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, x, y, width, height, x, y); + } + + update_transients (w, region); + + /* A dummy expose event is used to ensure that the resize delay is + * cleared, in the event that the resize request is not granted. + */ + if (ev && ev->send_event) + w->gterm.delay = 0; + + if (DBG_TRACE) + fprintf (stderr, "Redisplay[%s] DONE:\n", dbg_wSize(w)); +} + +/* ARGSUSED */ +static Boolean +SetValues (current, request, set) + Widget current, request, set; +{ + GtermWidget old = (GtermWidget) current; + GtermWidget req = (GtermWidget) request; + register GtermWidget w = (GtermWidget) set; + Display *display = w->gterm.display; + Boolean redisplay = False; + register GC gc; + + + if (old->gterm.dialogBgColor != req->gterm.dialogBgColor) { + gc = w->gterm.dialogGC; + XSetBackground (display, gc, w->gterm.dialogBgColor); + } + if (old->gterm.dialogFgColor != req->gterm.dialogFgColor) { + gc = w->gterm.dialogGC; + XSetForeground (display, gc, w->gterm.dialogFgColor); + } + + if (old->gterm.ginmodeCursor != req->gterm.ginmodeCursor) { + static char *full_crosshair = "full_crosshair"; + + XtFree (old->gterm.ginmodeCursor); + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + + erase_crosshair (w); + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, full_crosshair) == 0); + + if (w->gterm.full_crosshair) { + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + color_crosshair (w); + } else { + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + color_ginmodeCursor (w); + } + + if (w->gterm.cursor_type == GtGinmodeCursor && w->core.visible) + XDefineCursor (display, w->gterm.window, + w->gterm.cursor = w->gterm.ginmode_cursor); + } + + if (old->gterm.crosshairCursorColor != req->gterm.crosshairCursorColor) { + color_crosshair (w); + } + + if (old->gterm.ginmodeCursorBgColor != req->gterm.ginmodeCursorBgColor || + old->gterm.ginmodeCursorFgColor != req->gterm.ginmodeCursorFgColor) { + color_ginmodeCursor (w); + } + + return (XtIsRealized(current) ? redisplay : False); +} + +static void +color_crosshair (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + register GC gc; + + erase_crosshair (w); + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.color0; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, defcmap, &fg_color); + + gc = w->gterm.cursorGC; + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XRecolorCursor (display, w->gterm.crosshair_cursor, &fg_color, &bg_color); + + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + + update_cursor (w); +} + +static void +color_ginmodeCursor (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, defcmap, &fg_color); + + XRecolorCursor (display, w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; +} + +/* + * Action procedures. + * ----------------------- + */ + +/* ARGSUSED */ +static void HandleIgnore (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* ignore an event */ +} + +/* ARGSUSED */ +static void HandleGraphicsInput (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.inputCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, event); +} + +/* ARGSUSED */ +static void HandleDisplayCrosshair (widget, event, params, nparams) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *nparams; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XButtonEvent *ev = &event->xbutton; + + /* Ignore if cursor is in a marker. */ + if (w->gterm.gm_active) + return; + + if (*nparams && strcmp (params[0], "on") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.crosshair_cursor); + draw_crosshair (w, ev->x, ev->y); + } else if (*nparams && strcmp (params[0], "off") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, w->gterm.cursor); + } +} + +/* ARGSUSED */ +static void HandleTrackCursor (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XMotionEvent *ev = &event->xmotion; + gmSelection what; + Marker gm; + + savepos (w, (XEvent *)ev); + + if ((gm = GmSelect (w, ev->x, ev->y, &what))) + gm_focusin (w, gm, &what); + else if (w->gterm.gm_active) + gm_focusout (w, 1); + + if (w->gterm.cursor_type == GtGinmodeCursor) + if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, ev->x, ev->y); + + /* Flushing here keeps cursor tracking synchronous and tends + * to aid motion compression, by preventing crosshair draw + * requests from being queued up for transmission to the + * server. + */ + XFlush (w->gterm.display); + + } else { + w->gterm.cur_x = ev->x; + w->gterm.cur_y = ev->y; + } +} + +/* ARGSUSED */ +static void HandleEnterWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XEnterWindowEvent *ev = (XEnterWindowEvent *) event; + + /* Deep Frame */ + if (!w->gterm.useDefaultCM && w->gterm.haveColormap && + !w->gterm.forcePseudo8) { + + int update = w->gterm.cmapUpdate; + + /* To avoid excessive server queries the colormap is only updated + * every so often. Updating is disabled if cmapUpdate is set to zero. + if (update && ev->time - w->gterm.cmapLastUpdate > update * 1000) { + */ + if (update) { + inherit_default_colormap (w); + w->gterm.cmapLastUpdate = ev->time; + } + + /* Advise the window manager to load our colormap. */ + request_colormap_focus (w); + } + + w->gterm.in_window++; +} + +/* ARGSUSED */ +static void HandleLeaveWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XLeaveWindowEvent *ev = (XLeaveWindowEvent *) event; + +/*printf ("HandleLeaveWindow....");*/ + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int shadow = w->gterm.cmapShadow; + + /* The shadow option matches unused cells in the default colormap + * with the colors in our custom colormap. + if (shadow && ev->time - w->gterm.cmapLastShadow > shadow * 1000) { + */ + if (shadow) { + update_default_colormap (w); + w->gterm.cmapLastShadow = ev->time; + } + +/*printf ("restoring focus....");*/ + restore_colormap_focus (w); + } +/*printf ("\n");*/ + + w->gterm.in_window = 0; +} + +/* ARGSUSED */ +static void HandleSoftReset (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + GtReset (w); + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resetCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, NULL); +} + + + + +#include "GtermCnv.c" +#include "GtermGraphics.c" +#include "GtermImaging.c" +#include "GtermCmap.c" +#include "GtermMapping.c" +#include "GtermMarker.c" +#include "GtermUtil.c" +#include "GtermDebug.c" diff --git a/vendor/x11iraf/obm/ObmW/Gterm.c.ORIG b/vendor/x11iraf/obm/ObmW/Gterm.c.ORIG new file mode 100644 index 00000000..981f0d61 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.c.ORIG @@ -0,0 +1,11897 @@ +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/XawInit.h> +#include "GtermP.h" + +/* + * Gterm -- Graphics terminal widget. This widget implements only the + * window specific graphics output and graphics window input functions. + * Protocol translation (e.g. Tek emulation) and i/o is done elsewhere; + * see for example gtermio.c. + */ + +#define DefaultAlphaFont 3 +#define DefaultDialogFont 3 +#define DefaultMarkerTextFont 3 +#define ZOOM_TOL 0.0001 + +static Dimension defXDim = DEF_WIDTH; +static Dimension defYDim = DEF_HEIGHT; + +/* Default translations for Gterm window. */ +/* Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) */ + +static char defaultGtermTranslations[] = +"\ + <Btn1Down>: m_create() \n\ + <Btn2Down>: crosshair(on) \n\ + <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() \n\ +"; + +/* Default translations when pointer is over a marker. */ +static char defaultMarkerTranslations[] = +"\ + !Shift <Btn1Motion>: m_rotateResize() \n\ + <Btn1Motion>: m_moveResize() \n\ + !Shift <Btn1Down>: m_raise() m_markpos() \n\ + <Btn1Down>: m_raise() m_markposAdd() \n\ + <Btn1Up>: m_redraw() m_destroyNull() \n\ + <Btn2Down>: m_lower() \n\ + <Key>BackSpace: m_deleteDestroy() \n\ + <Key>Delete: m_deleteDestroy() \n\ + <KeyPress>: m_input() \n\ + <Motion>: track-cursor() \n\ +"; + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defXDim}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defYDim}, + + {XtNalphaFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont1), XtRString, "nil2"}, + {XtNalphaFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont2), XtRString, "5x8"}, + {XtNalphaFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont3), XtRString, "6x10"}, + {XtNalphaFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont4), XtRString, "7x13"}, + {XtNalphaFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont5), XtRString, "8x13"}, + {XtNalphaFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont6), XtRString, "9x15"}, + {XtNalphaFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont7), XtRString, "9x15"}, + {XtNalphaFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont8), XtRString, "9x15"}, + + {XtNdialogFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont1), XtRString, "nil2"}, + {XtNdialogFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont2), XtRString, "5x8"}, + {XtNdialogFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont3), XtRString, "6x13"}, + {XtNdialogFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont4), XtRString, "7x13"}, + {XtNdialogFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont5), XtRString, "8x13"}, + {XtNdialogFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont6), XtRString, "9x15"}, + {XtNdialogFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont7), XtRString, "9x15"}, + {XtNdialogFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont8), XtRString, "9x15"}, + + {XtNdialogBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogBgColor), XtRString, "yellow"}, + {XtNdialogFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogFgColor), XtRString, "black"}, + {XtNidleCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorBgColor), XtRString, "white"}, + {XtNidleCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorFgColor), XtRString, "black"}, + {XtNbusyCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorBgColor), XtRString, "white"}, + {XtNbusyCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorFgColor), XtRString, "black"}, + {XtNginmodeCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColor), XtRString, "black"}, + {XtNginmodeCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColor), XtRString, "white"}, + {XtNginmodeBlinkInterval, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.ginmodeBlinkInterval), XtRImmediate, 0}, + {XtNcrosshairCursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.crosshairCursorColor), XtRString, "red"}, + + {XtNidleCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursor), XtRString, "plus"}, + {XtNbusyCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursor), XtRString, "watch"}, + {XtNginmodeCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursor), XtRString, "full_crosshair"}, + {XtNwarpCursor, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.warpCursor), XtRImmediate, + (caddr_t)DEF_WARPCURSOR}, + {XtNraiseWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.raiseWindow), XtRImmediate, + (caddr_t)DEF_RAISEWINDOW}, + {XtNdeiconifyWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.deiconifyWindow), XtRImmediate, + (caddr_t)DEF_DEICONIFYWINDOW}, + {XtNuseTimers, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useTimers), XtRImmediate, + (caddr_t)DEF_USETIMERS}, + + {XtNcolor0, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color0), XtRString, "black"}, + {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color1), XtRString, "white"}, + {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color2), XtRString, "red"}, + {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color3), XtRString, "green"}, + {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color4), XtRString, "blue"}, + {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color5), XtRString, "cyan"}, + {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color6), XtRString, "yellow"}, + {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color7), XtRString, "magenta"}, + {XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color8), XtRString, "purple"}, + {XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color9), XtRString, "darkslategray"}, + + {XtNcopyOnResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.copyOnResize), XtRImmediate, + (caddr_t)DEF_COPYONRESIZE}, + {XtNcmapName, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cmapName), XtRImmediate, + (caddr_t)"default"}, + {XtNcmapInitialize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInitialize), XtRImmediate, + (caddr_t)FALSE}, + {XtNbasePixel, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.base_pixel), XtRImmediate, + (caddr_t)DEF_BASEPIXEL}, + {XtNcmapUpdate, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapUpdate), XtRImmediate, + (caddr_t)DEF_CMAPUPDATE}, + {XtNcmapShadow, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapShadow), XtRImmediate, + (caddr_t)DEF_CMAPSHADOW}, + {XtNcmapInterpolate, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInterpolate), XtRImmediate, + (caddr_t)True}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cacheRasters), XtRImmediate, + (caddr_t)"whenNeeded"}, + {XtNmaxRasters, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxRasters), XtRImmediate, + (caddr_t)MAX_RASTERS}, + {XtNmaxMappings, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxMappings), XtRImmediate, + (caddr_t)MAX_MAPPINGS}, + {XtNmaxColors, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxColors), XtRImmediate, + (caddr_t)DEF_MAXCOLORS}, + + {XtNmarkerTranslations, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_translations), XtRImmediate, + (caddr_t)defaultMarkerTranslations}, + {XtNdefaultMarker, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_defaultMarker), XtRImmediate, + (caddr_t)"rectangle"}, + {XtNnearEdge, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearEdge), XtRImmediate, + (caddr_t)E_DIST}, + {XtNnearVertex, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearVertex), XtRImmediate, + (caddr_t)V_DIST}, + + {XtNmarkerLineWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineWidth), XtRImmediate, + (caddr_t)1}, + {XtNmarkerLineStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineStyle), XtRImmediate, + (caddr_t)LineSolid}, + {XtNmarkerFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_fill), XtRImmediate, + (caddr_t)False}, + {XtNmarkerFillColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillColor), XtRString, + "SlateGray"}, + {XtNmarkerFillBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillBgColor), XtRString, + "black"}, + {XtNmarkerFillStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_fillStyle), XtRImmediate, + (caddr_t)FillSolid}, + {XtNxorFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_xorFill), XtRImmediate, + (caddr_t)False}, + {XtNxorFillColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillColor), XtRImmediate, + (caddr_t)2}, + {XtNxorFillBgColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillBgColor), XtRImmediate, + (caddr_t)255}, + {XtNmarkerHighlightWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_highlightWidth), XtRImmediate, + (caddr_t)2}, + {XtNmarkerHighlightColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_highlightColor), XtRString, + "green"}, + {XtNmarkerCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorFgColor), XtRString, + "yellow"}, + {XtNmarkerCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorBgColor), XtRString, + "black"}, + + {XtNmarkerLineLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineLineColor), XtRString, + "green"}, + {XtNmarkerLineKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineKnotColor), XtRString, + "blue"}, + {XtNmarkerLineKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_LineKnotSize), XtRImmediate, + (caddr_t)5}, + + {XtNmarkerTextLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextLineColor), XtRString, + "green"}, + {XtNmarkerTextColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextColor), XtRString, + "yellow"}, + {XtNmarkerTextBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextBgColor), XtRString, + "SlateGray"}, + {XtNmarkerTextBorder, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_TextBorder), XtRImmediate, + (caddr_t)2}, + {XtNmarkerTextFont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.gm_TextFont), XtRString, + "6x13"}, + {XtNmarkerTextString, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextString), XtRImmediate, + (caddr_t)NULL}, + + {XtNmarkerRectLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectLineColor), XtRString, + "green"}, + {XtNmarkerRectKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectKnotColor), XtRString, + "blue"}, + {XtNmarkerRectKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_RectKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerBoxLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxLineColor), XtRString, + "green"}, + {XtNmarkerBoxKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxKnotColor), XtRString, + "blue"}, + {XtNmarkerBoxKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_BoxKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerCircleLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleLineColor), XtRString, + "green"}, + {XtNmarkerCircleKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleKnotColor), XtRString, + "blue"}, + {XtNmarkerCircleKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_CircleKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerEllipseLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseLineColor), XtRString, + "green"}, + {XtNmarkerEllipseKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColor), XtRString, + "blue"}, + {XtNmarkerEllipseKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_EllipseKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerPgonLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonLineColor), XtRString, + "green"}, + {XtNmarkerPgonKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonKnotColor), XtRString, + "blue"}, + {XtNmarkerPgonKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_PgonKnotSize), XtRImmediate, + (caddr_t)5}, +}; + +/* extern void HandlePopupMenu(); */ +static Boolean SetValues(); +static void Initialize(), Realize(), Destroy(), Redisplay(), Resize(); +static void HandleIgnore(), HandleGraphicsInput(), HandleDisplayCrosshair(); +static void HandleSoftReset(), HandleGraphicsContext(); +static void HandleEnterWindow(), HandleLeaveWindow(); +static void color_crosshair(), color_ginmodeCursor(); +static void HandleTrackCursor(); +static void savepos(), blink_cursor(); +static void mp_linkafter(), mp_unlink(); + +Marker GmSelect(); +static void M_create(), GtMarkerFree(); +static void gm_focusin(), gm_focusout(), gm_refocus(); +static void gm_request_translations(), gm_load_translations(); +static int gm_curpos(); + +static set_default_color_index(); +static inherit_default_colormap(); +static update_default_colormap(); +static update_transients(), update_cursor(); +static request_colormap_focus(), restore_colormap_focus(); +static refresh_source(), refresh_destination(), get_regions(); +static get_rects(), scale_zoom(), scale_intzoom(), scale_boxcar(); +static lw_convolve(), bx_boxcar(), bx_extract(), bx_interp(); +static mf_getpixel(), mf_getinten(); +static scale_lowpass(), scale_nearest(), scale_bilinear(); +static save_mapping(), load_mapping(), get_pixel_mapping(); +static update_mapping(), free_mapping(), valid_mapping(), rect_intersect(); +static initialize_mapping(), draw_crosshair(), erase_crosshair(); +static DrawContext get_draw_context(); +static invalidate_draw_context(); +static XPoint *mapVector(); +static Colormap get_colormap(); +static Cursor get_cursor(); +static void init_iomap(), invalidate_cmap(); +static Pixel get_pixel(), *get_cmap_in(), *get_cmap_out(); + +extern double atof(); + +static XtActionsRec gtermActionsList[] = { + { "ignore", HandleIgnore }, + { "graphics-input", HandleGraphicsInput }, + { "crosshair", HandleDisplayCrosshair }, + { "track-cursor", HandleTrackCursor }, + { "enter-window", HandleEnterWindow }, + { "leave-window", HandleLeaveWindow }, +/* { "popup-menu", HandlePopupMenu }, */ + { "reset", HandleSoftReset }, + { "m_create", M_create }, +}; + +GtermClassRec gtermClassRec = { + { /* core fields */ + /* superclass */ &widgetClassRec, + /* class_name */ "Gterm", + /* widget_size */ sizeof(GtermRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ gtermActionsList, + /* num_actions */ XtNumber(gtermActionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ (XrmClass)NULL, + /* compress_motion */ True, + /* compress_exposure */ True, + /* compress_enterleave */ True, + /* visible_interest */ False, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultGtermTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass gtermWidgetClass = (WidgetClass) &gtermClassRec; +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +/* + * Widget class procedures. + * -------------------------- + */ + +/* ARGSUSED */ +static void +Initialize (request, new) + Widget request, new; +{ + register GtermWidget w = (GtermWidget)new; + register GC gc; + + XColor fg_color, bg_color; + XFontStruct **fp; + Font cursor_font; + Display *display; + Screen *screen; + Pixel *pp; + int i; + + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + w->gterm.display = display = XtDisplay (w); + w->gterm.screen = screen = XtScreen (w); + w->gterm.root = RootWindowOfScreen (screen); + XtVaSetValues ((Widget)w, XtNbackground, (XtArgVal)w->gterm.color0, NULL); + + /* Initialize color map. */ + pp = &w->gterm.color0; + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors (display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + w->gterm.useDefaultCM = (strcmp (w->gterm.cmapName, "default") == 0); + w->gterm.haveColormap = w->gterm.useDefaultCM; + w->gterm.cmapLastUpdate = 0; + w->gterm.cmapLastShadow = 0; + w->gterm.in_window = 0; + + /* Get clear pixmap GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color0); + w->gterm.clearGC = gc; + + /* Get expose GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + w->gterm.exposeGC = gc; + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.dialogBgColor); + XSetForeground (display, gc, w->gterm.dialogFgColor); + /* XSetFunction (display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + /* Get special cursors. */ + bg_color.pixel = w->gterm.idleCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.idleCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.idle_cursor = get_cursor (w, w->gterm.idleCursor); + XRecolorCursor (display, w->gterm.idle_cursor, &fg_color, &bg_color); + + bg_color.pixel = w->gterm.busyCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.busyCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.busy_cursor = get_cursor (w, w->gterm.busyCursor); + XRecolorCursor (display, w->gterm.busy_cursor, &fg_color, &bg_color); + + bg_color.pixel = w->gterm.color0; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, w->core.colormap, &fg_color); + cursor_font = XLoadFont (display, "cursor"); + w->gterm.crosshair_cursor = XCreateGlyphCursor (display, + cursor_font, cursor_font, XC_crosshair, XC_crosshair, + &fg_color, &bg_color); + + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + if (strcmp (w->gterm.ginmodeCursor, "full_crosshair") != 0) { + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + XRecolorCursor (display, + w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + } else + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, "full_crosshair") == 0); + + /* Make sure we have all the fonts we need. */ + for (fp = &w->gterm.alphaFont1, i=0; i < NAlphaFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.alpha_fonts[i] = *fp; + } + for (fp = &w->gterm.dialogFont1, i=0; i < NDialogFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.dialog_fonts[i] = *fp; + } + + /* Raster initialization. */ + w->gterm.rasters = NULL; + w->gterm.nrasters = 0; + w->gterm.mappings = NULL; + w->gterm.nmappings = 0; + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + w->gterm.colormaps = NULL; + w->gterm.wa_defined = 0; + memset ((char *)&w->gterm.draw, 0, sizeof (struct drawContext)); + + /* Marker initialization. */ + w->gterm.gm_head = NULL; + w->gterm.gm_tail = NULL; + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.defTranslations = NULL; + w->gterm.nauxTrans = 0; + w->gterm.gm_defTranslations = NULL; + w->gterm.gm_curTranslations = NULL; + w->gterm.gm_reqTranslations = NULL; + w->gterm.gm_timer_id = (XtIntervalId) NULL; + w->gterm.gm_initialized = False; + + /* Set defaults (some of these are clobbered anyway by Realize/Resize). */ + w->gterm.raster = 0; + w->gterm.cur_x = 0; + w->gterm.cur_y = 0; + w->gterm.last_x = 0; + w->gterm.last_y = 0; + w->gterm.cursor_drawn = 0; + w->gterm.cursor_type = GtIdleCursor; + w->gterm.pixmap = (Pixmap)NULL; + w->gterm.d_pixmap = (Pixmap)NULL; + w->gterm.preserve_screen = 0; + w->gterm.preserve_valid = 0; + w->gterm.d_saved = 0; + w->gterm.alpha_font = DefaultAlphaFont; + w->gterm.dialog_font = DefaultDialogFont; + w->gterm.optcols = 80; + w->gterm.optrows = 35; + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + set_default_color_index (w); + + /* Disable input until window is ready. */ + w->gterm.delay = 1; +} + +static void +Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + GtermWidget w = (GtermWidget) gw; + XVisualInfo rvinfo, *vinfo = (XVisualInfo *) NULL; + Visual *ourVisual = (Visual *) NULL; + int i, nvis; + + /* Set default window size. */ + XtMakeResizeRequest (gw, w->core.width, w->core.height, + &w->core.width, &w->core.height); + + /* Should define pseudocolor visual here, if truecolor or directcolor + * default visual. + */ + + /* Create graphics window. We first look for an 8-Bit PseudoColor + * visual to use, otherwise we fail. (MJF 8/22/97) + XtCreateWindow (gw, InputOutput, (Visual *)CopyFromParent, + *valueMask, attrs); + */ + vinfo = XGetVisualInfo (w->gterm.display, 0L, &rvinfo, &nvis); + for (i=0; i < nvis; i++) + if (vinfo[i].depth == 8 && vinfo[i].class == PseudoColor) + ourVisual = vinfo[i].visual; + if (ourVisual) + XtCreateWindow (gw, InputOutput, ourVisual, *valueMask, attrs); + else { + fprintf (stderr, "No 8-bit PseudoColor visual found.\n"); + exit(1); + } + + w->gterm.window = XtWindow (gw); + w->gterm.old_width = w->gterm.xres = w->core.width; + w->gterm.old_height = w->gterm.yres = w->core.height; + + GtRasterInit (w); + GtMarkerInit (w); + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = w->gterm.idle_cursor); + + Resize (gw); +} + +static void +Destroy (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb, *cb_next; + Display *display = w->gterm.display; + + /* Get rid of any raster stuff. */ + GtRasterInit (gw); + XtFree ((char *)w->gterm.rasters); + XtFree ((char *)w->gterm.mappings); + + /* Destroy any markers. */ + GtMarkerFree (w); + + /* Can't use XtDestroyGC here; the source says it is broken and will + * work only for applications that have only 1 display, and we have 2. + * Also the documentation in Asente&Swick documents the calling sequence + * incorrectly. + */ + XFreeGC (display, w->gterm.clearGC); + XFreeGC (display, w->gterm.exposeGC); + XFreeGC (display, w->gterm.drawGC); + XFreeGC (display, w->gterm.dialogGC); + XFreeGC (display, w->gterm.cursorGC); + + /* This one also proves problematic. When there are multiple gterm + * widgets allocating the same cursor, succeeding calls for the same + * cursor return the same cursor ID. When these widgets are later + * destroyed, the first XFreeCursor succeeds but subsequent ones find + * the referenced cursor undefined and the application boms with a + * BadCursor error. This must be some problem with reference counts + * in the X server. Cursors use minor amounts of resources and they + * will probably be freed anyway when the display is closed, so we just + * leave them defined here. + * + XFreeCursor (display, w->gterm.idle_cursor); + XFreeCursor (display, w->gterm.busy_cursor); + XFreeCursor (display, w->gterm.crosshair_cursor); + if (w->gterm.ginmode_cursor != w->gterm.crosshair_cursor) + XFreeCursor (display, w->gterm.ginmode_cursor); + */ + + if (w->gterm.pixmap) + XFreePixmap (w->gterm.display, w->gterm.pixmap); + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + + /* Destroy callback lists. */ + for (cb = w->gterm.resetCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.resizeCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.inputCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + XtFree (w->gterm.ginmodeCursor); +} + +static void +Resize (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb; + int char_width, char_height, char_base; + int bestfont, fonterr, dx, dy, i; + unsigned int width, height, u_junk; + GtCallback cbl[128]; + XFontStruct *fp; + int ncb, junk; + Pixmap pixmap; + Window root; + + if (!XtIsRealized(gw)) + return; + + /* Create new pixmap. */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width + 1, w->core.height + 1, w->core.depth); + if (pixmap) + XFillRectangle (w->gterm.display, pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + + /* Copy old pixmap into new and free old pixmap. */ + if (w->gterm.pixmap) { + XGetGeometry (w->gterm.display, w->gterm.pixmap, + &root, &junk, &junk, &width, &height, &u_junk, &u_junk); + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.copyOnResize) + XCopyArea (w->gterm.display, w->gterm.pixmap, pixmap, + w->gterm.exposeGC, 0, 0, width-1, height-1, 0, 0); + XFreePixmap (w->gterm.display, w->gterm.pixmap); + } + + /* Install new pixmap. */ + w->gterm.pixmap = pixmap; + w->gterm.preserve_valid = 0; + + /* Redraw window. */ + if (w->gterm.pixmap) { + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, 0, 0, w->core.width, w->core.height, 0, 0); + } + + /* Pick best alpha font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NAlphaFonts; i++) { + fp = w->gterm.alpha_fonts[i]; + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + dx = (((int)w->core.width / char_width) - w->gterm.optcols) * 2; + dy = ((int)w->core.height / char_height) - w->gterm.optrows; + if (abs(dx) + abs(dy) < fonterr) { + bestfont = i; + fonterr = abs(dx) + abs(dy); + } + } + + w->gterm.alpha_font = bestfont; + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + XSetFont (w->gterm.display, w->gterm.drawGC, fp->fid); + + /* Pick best dialog font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NDialogFonts; i++) { + fp = w->gterm.dialog_fonts[i]; + char_width = fp->max_bounds.width; + dx = ((int)w->core.width / char_width) - 80; + if (abs(dx) < fonterr) { + bestfont = i; + fonterr = abs(dx); + } + } + + w->gterm.dialog_font = bestfont; + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + char_base = fp->max_bounds.ascent; + + w->gterm.d_xoff = 2; + w->gterm.d_yoff = w->core.height - char_height - 2; + w->gterm.d_height = char_height; + XSetFont (w->gterm.display, w->gterm.dialogGC, fp->fid); + + /* Create dialog save area pixmap. */ + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + w->gterm.d_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, char_height, w->core.depth); + w->gterm.d_saved = 0; + + /* Adjust cursor position to allow for change in window size. */ + w->gterm.cur_x = w->gterm.cur_x * (int)w->core.width / w->gterm.old_width; + w->gterm.cur_y = w->gterm.cur_y * (int)w->core.height / w->gterm.old_height; + w->gterm.old_width = w->core.width; + w->gterm.old_height = w->core.height; + if (w->gterm.cursor_type == GtGinmodeCursor) { + XWarpPointer (w->gterm.display, w->gterm.window, w->gterm.window, + 0,0,0,0, w->gterm.cur_x, w->gterm.cur_y); + update_cursor (w); + } + + /* Raster descriptor 0 must track the window size. */ + if (w->gterm.rasters) { + Raster rp = &w->gterm.rasters[0]; + rp->width = w->core.width; + rp->height = w->core.height; + } + + /* Mark gterm widget ready for further client input. */ + w->gterm.delay = 0; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resizeCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w); +} + +/* ARGSUSED */ +static void +Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register GtermWidget w = (GtermWidget) gw; + register XExposeEvent *ev = (XExposeEvent *)event; + int x, y, width, height; + + if (!XtIsRealized (gw)) + return; + + if (event) { + x = ev->x; + y = ev->y; + width = ev->width; + height = ev->height; + } else { + x = 0; + y = 0; + width = w->core.width; + height = w->core.height; + } + + if (w->gterm.pixmap) { + /* Clipping with the region argument does not work properly with + * the OpenLook server for some reason - the clip region is one + * pixel too small on the right and bottom. Until the reason for + * this becomes clear, we use the bounding box provided in the + * Expose event to roughly clip the refresh. + * + XSetClipOrigin (w->gterm.display, w->gterm.exposeGC, 0, 0); + XSetRegion (w->gterm.display, w->gterm.exposeGC, region); + */ + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, x, y, width, height, x, y); + } + + update_transients (w, region); + + /* A dummy expose event is used to ensure that the resize delay is + * cleared, in the event that the resize request is not granted. + */ + if (ev && ev->send_event) + w->gterm.delay = 0; +} + +/* ARGSUSED */ +static Boolean +SetValues (current, request, set) + Widget current, request, set; +{ + GtermWidget old = (GtermWidget) current; + GtermWidget req = (GtermWidget) request; + register GtermWidget w = (GtermWidget) set; + Display *display = w->gterm.display; + Boolean redisplay = False; + register GC gc; + + if (old->gterm.dialogBgColor != req->gterm.dialogBgColor) { + gc = w->gterm.dialogGC; + XSetBackground (display, gc, w->gterm.dialogBgColor); + } + if (old->gterm.dialogFgColor != req->gterm.dialogFgColor) { + gc = w->gterm.dialogGC; + XSetForeground (display, gc, w->gterm.dialogFgColor); + } + + if (old->gterm.ginmodeCursor != req->gterm.ginmodeCursor) { + static char *full_crosshair = "full_crosshair"; + + XtFree (old->gterm.ginmodeCursor); + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + + erase_crosshair (w); + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, full_crosshair) == 0); + + if (w->gterm.full_crosshair) { + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + color_crosshair (w); + } else { + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + color_ginmodeCursor (w); + } + + if (w->gterm.cursor_type == GtGinmodeCursor && w->core.visible) + XDefineCursor (display, w->gterm.window, + w->gterm.cursor = w->gterm.ginmode_cursor); + } + + if (old->gterm.crosshairCursorColor != req->gterm.crosshairCursorColor) { + color_crosshair (w); + } + + if (old->gterm.ginmodeCursorBgColor != req->gterm.ginmodeCursorBgColor || + old->gterm.ginmodeCursorFgColor != req->gterm.ginmodeCursorFgColor) { + color_ginmodeCursor (w); + } + + return (XtIsRealized(current) ? redisplay : False); +} + +static void +color_crosshair (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + register GC gc; + + erase_crosshair (w); + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.color0; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, defcmap, &fg_color); + + gc = w->gterm.cursorGC; + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XRecolorCursor (display, w->gterm.crosshair_cursor, &fg_color, &bg_color); + + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + + update_cursor (w); +} + +static void +color_ginmodeCursor (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, defcmap, &fg_color); + + XRecolorCursor (display, w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; +} + +/* + * Action procedures. + * ----------------------- + */ + +/* ARGSUSED */ +static void HandleIgnore (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* ignore an event */ +} + +/* ARGSUSED */ +static void HandleGraphicsInput (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.inputCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, event); +} + +/* ARGSUSED */ +static void HandleDisplayCrosshair (widget, event, params, nparams) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *nparams; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XButtonEvent *ev = &event->xbutton; + + /* Ignore if cursor is in a marker. */ + if (w->gterm.gm_active) + return; + + if (*nparams && strcmp (params[0], "on") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.crosshair_cursor); + draw_crosshair (w, ev->x, ev->y); + } else if (*nparams && strcmp (params[0], "off") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, w->gterm.cursor); + } +} + +/* ARGSUSED */ +static void HandleTrackCursor (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XMotionEvent *ev = &event->xmotion; + gmSelection what; + Marker gm; + + savepos (w, (XEvent *)ev); + + if ((gm = GmSelect (w, ev->x, ev->y, &what))) + gm_focusin (w, gm, &what); + else if (w->gterm.gm_active) + gm_focusout (w, 1); + + if (w->gterm.cursor_type == GtGinmodeCursor) + if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, ev->x, ev->y); + + /* Flushing here keeps cursor tracking synchronous and tends + * to aid motion compression, by preventing crosshair draw + * requests from being queued up for transmission to the + * server. + */ + XFlush (w->gterm.display); + + } else { + w->gterm.cur_x = ev->x; + w->gterm.cur_y = ev->y; + } +} + +/* ARGSUSED */ +static void HandleEnterWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XEnterWindowEvent *ev = (XEnterWindowEvent *) event; + + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int update = w->gterm.cmapUpdate; + + /* To avoid excessive server queries the colormap is only updated + * every so often. Updating is disabled if cmapUpdate is set to zero. + if (update && ev->time - w->gterm.cmapLastUpdate > update * 1000) { + */ + if (update) { + inherit_default_colormap (w); + w->gterm.cmapLastUpdate = ev->time; + } + + /* Advise the window manager to load our colormap. */ + request_colormap_focus (w); + } + + w->gterm.in_window++; +} + +/* ARGSUSED */ +static void HandleLeaveWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XLeaveWindowEvent *ev = (XLeaveWindowEvent *) event; + + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int shadow = w->gterm.cmapShadow; + + /* The shadow option matches unused cells in the default colormap + * with the colors in our custom colormap. + if (shadow && ev->time - w->gterm.cmapLastShadow > shadow * 1000) { + */ + if (shadow) { + update_default_colormap (w); + w->gterm.cmapLastShadow = ev->time; + } + + restore_colormap_focus (w); + } + + w->gterm.in_window = 0; +} + +/* ARGSUSED */ +static void HandleSoftReset (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + GtReset (w); + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resetCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, NULL); +} + + +/* + * GRAPHICS routines (public functions). + * -------------------------------------- + */ + +GtActivate (w) + GtermWidget w; +{ + w->gterm.interactive = 0; + w->gterm.save_x = w->gterm.save_y = 0; +} + +GtDeactivate (w) + GtermWidget w; +{ + Display *display = w->gterm.display; + Window window = w->gterm.window; + + if (w->gterm.interactive) { + if (w->gterm.save_x > 0 && w->gterm.save_y > 0) { + if (w->gterm.warpCursor) { + /* Workaround X server bug. */ + if (w->gterm.root != w->gterm.save_root) + XWarpPointer (display,None,w->gterm.root, 0,0,0,0, + WidthOfScreen(w->gterm.screen) - 1, + HeightOfScreen(w->gterm.screen) - 1); + + /* Move pointer to saved position. */ + XWarpPointer (display, None, w->gterm.save_root, + 0,0,0,0, w->gterm.save_x, w->gterm.save_y); + } + w->gterm.save_x = 0; + w->gterm.save_y = 0; + } + w->gterm.interactive = 0; + } +} + +GtReady (w) + GtermWidget w; +{ + return (w->gterm.delay == 0); +} + +GtReset (w) + GtermWidget w; +{ + invalidate_draw_context (w); + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapButt, JoinMiter); + + /* Set defaults. */ + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.raster = 0; +} + +GtTimerInhibit (w, state) + GtermWidget w; + Boolean state; +{ + /* This is a kludge to allow a client (xgterm) to disable use of timers + * if they don't work in a given implementation. + */ + w->gterm.useTimers = !state; +} + +GtAugmentTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_augment; + w->gterm.nauxTrans++; + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtOverrideTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_override; + w->gterm.nauxTrans++; + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtFlush (w) + GtermWidget w; +{ + XFlush (w->gterm.display); +} + +GtSetLogRes (w, width, height) + GtermWidget w; + int width, height; +{ + w->gterm.xres = width; + w->gterm.yres = height; +} + +GtGetLogRes (w, width, height) + GtermWidget w; + int *width, *height; +{ + *width = w->gterm.xres; + *height = w->gterm.yres; +} + +GtGetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; /* zero for screen size */ + int *width, *height; +{ + if (raster) { + register Raster rp = &w->gterm.rasters[raster]; + *width = rp->width; + *height = rp->height; + } else { + *width = w->core.width; + *height = w->core.height; + } +} + +GtSetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; + int width, height; +{ + GtCreateRaster (w, raster, GtServer, width, height, RasterDepth); +} + +GtSetRaster (w, raster) + GtermWidget w; + int raster; +{ + if (raster >= 0 && raster < w->gterm.maxRasters) { + w->gterm.raster = raster; + invalidate_draw_context (w); + } +} + +GtGetRaster (w) + GtermWidget w; +{ + return (w->gterm.raster); +} + +/* ARGSUSED */ +GtSetTextRes (w, optrows, optcols) + GtermWidget w; + int optrows, optcols; +{ + w->gterm.optrows = optrows; + w->gterm.optcols = optcols; +} + +/* ARGSUSED */ +GtSetCharSize (w, ival) + GtermWidget w; + int ival; +{ +} + +GtSetDataLevel (w, ival) + GtermWidget w; + int ival; +{ + invalidate_draw_context (w); + + switch (ival) { + case GtSet: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[w->gterm.color_index]); + w->gterm.data_level = ival; + break; + case GtClear: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color0); + w->gterm.data_level = ival; + break; + case GtInvert: + /* This probably won't work correctly but leave it for now... */ + XSetFunction (w->gterm.display, w->gterm.drawGC, GXxor); + w->gterm.data_level = ival; + break; + } +} + + +GtSetLineWidth (w, ival) + GtermWidget w; + int ival; +{ + w->gterm.line_width = ival; + GtSetLineStyle (w, w->gterm.line_style); +} + +#define Dashed "\010\003" +#define Dotted "\002\003" +#define DashDot "\016\003\001\003" +#define Dash3Dot "\024\003\001\003\001\003\001\003" + +GtSetLineStyle (w, ival) + GtermWidget w; + int ival; +{ + int line_width = w->gterm.line_width; + int line_style = LineSolid; + int cap_style = CapButt; + int join_style = JoinMiter; + int dash_offset = 0; + char *dash_list = NULL; + int dash_list_length = 0; + + switch (ival) { + case GtSolid: + w->gterm.line_style = ival; + break; + case GtDashed: + line_style = LineOnOffDash; + dash_list = (char *)Dashed; + dash_list_length = strlen(Dashed); + w->gterm.line_style = ival; + break; + case GtDotted: + line_style = LineOnOffDash; + dash_list = (char *)Dotted; + dash_list_length = strlen(Dotted); + w->gterm.line_style = ival; + break; + case GtDashDot: + line_style = LineOnOffDash; + dash_list = (char *)DashDot; + dash_list_length = strlen(DashDot); + w->gterm.line_style = ival; + break; + case GtDash3Dot: + line_style = LineOnOffDash; + dash_list = (char *)Dash3Dot; + dash_list_length = strlen(Dash3Dot); + w->gterm.line_style = ival; + break; + } + + if (dash_list_length) + XSetDashes (w->gterm.display, w->gterm.drawGC, dash_offset, dash_list, + dash_list_length); + + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, line_width, line_style, cap_style, join_style); + + invalidate_draw_context (w); +} + +GtSetColorIndex (w, ival) + GtermWidget w; + int ival; +{ + register int color = w->gterm.iomap[ival]; + + if (color >= 0 && color < w->gterm.ncolors) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[color]); + w->gterm.color_index = color; + invalidate_draw_context (w); + } +} + +GtSetFillType (w, ival) + GtermWidget w; + int ival; +{ + switch (ival) { + case GtSolid: + case GtOutline: + w->gterm.fill_type = ival; + break; + } +} + +GtClearScreen (w) +GtermWidget w; +{ + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) + XFillRectangle (w->gterm.display, w->gterm.pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + XClearWindow (w->gterm.display, w->gterm.window); + + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color1); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapRound, JoinRound); + + w->gterm.line_width = 1; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.data_level = GtSet; + w->gterm.preserve_valid = 0; + w->gterm.gm_redisplay = 1; + w->gterm.d_saved = 0; + + /* Mark any screen mappings to be unconditionally refreshed. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp->enabled && mp->dst == 0) + mp->refresh++; + + invalidate_draw_context (w); + update_transients (w, NULL); +} + +GtDrawPolyline (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolymarker (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawPoints (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawPoints (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolygon (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + if (w->gterm.fill_type == GtOutline) { + /* Draw outline of region. + */ + int first = 0; + int last = npts - 1; + + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + + if (points[last].x != points[first].x || + points[last].y != points[first].y) { + + if (mx->use_backing_store) + XDrawLine (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + XDrawLine (w->gterm.display, mx->pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + } + } else { + /* Fill the outlined area. + */ + if (mx->use_backing_store) { + XFillPolygon (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + XFillPolygon (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + } + + update_transients (w, (Region)NULL); +} + +GtDrawMarker (w, x, y, xsize, ysize, type) + GtermWidget w; + int x, y; + int xsize, ysize; + int type; +{ +} + +GtBell (w) + GtermWidget w; +{ + XBell (w->gterm.display, 0); +} + + +/* GtSetCursorPos -- Set the cursor position to the given coordinates X,Y. + * Coordinates are specified in the current graphics coordinate system, + * defined by the current raster and logical resolution. + * + * This routine is a little more complex than one might think due to the + * complication of mappings. Screen coordinates are required to set the + * cursor, but the graphics drawing context may be defined relative to + * any raster. In the general case a graphics pipeline defines the series + * of coordinate transformations required to transform from graphics + * coordinates to screen coordinates. Things are further complicated since + * the pipeline or desired position may not map to the screen, or there + * may be multiple mappings to the screen. The first case (no mapping to + * the screen) is dealt with by ignoring the request to warp the cursor. + * The second case (one-to-many mapping) is dealt with by a heuristic: + * the most recent screen coordinates are unmapped back to the raster we + * are "drawing" into, defining a unique path through the mappings which + * we can use to map back to the screen. + * + * The simplest case occurs when we are drawing directly into the screen. + * In this case (raster=0) there may still be a logical to physical + * coordinate transformation, but there are no mappings to complicate things. + */ +GtSetCursorPos (w, x, y) + GtermWidget w; + int x, y; +{ + register MappingContext mx; + register DrawContext dx; + register Mapping mp; + + Window window = w->gterm.window; + int sv_raster = w->gterm.raster; + int sv_xres = w->gterm.xres, sv_yres = w->gterm.yres; + int rasters[256], mappings[256], nmap=0, ntrans=0; + int rx, ry, src, dst, map, i, npts = 1; + int raster = w->gterm.raster; + XPoint pv1[1], pv2[2]; + XPoint *points, pv[1]; + Raster rp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Follow the current cursor position back to the source raster if + * possible. This gives us a default pipeline to follow in the reverse + * direction to map raster coordinates to screen coordinates, and is + * necessary to find the right mappings when multiple mappings are + * defined on a single source. + */ + rx = w->gterm.last_x; + ry = w->gterm.last_y; + src = 0; + do { + src = GtSelectRaster (w, dst=src, GtPixel,rx,ry, GtPixel,&rx,&ry,&map); + if (src != dst) { + rasters[nmap] = src; + mappings[nmap++] = map; + } + } while (src != dst && src != raster); + + /* Ray trace the point through all of the mappings to the screen. + * This isn't fully general, but gives us the capability to follow + * most graphics pipelines to a point on the screen. + */ + do { + GtSetRaster (w, raster); + if (ntrans++) { + /* After the first transformation we have raster coordinates, + * so set the logical resolution to the raster dimensions. + */ + rp = &w->gterm.rasters[raster]; + GtSetLogRes (w, rp->width, rp->height); + } + + dx = get_draw_context (w); + if (!dx->nmappings) + return; + + /* Try to find the next mapping. */ + if (nmap && rasters[nmap-1] == raster) + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->mapping == mappings[nmap-1]) { + mp = mx->mp; + nmap--; + goto havemap; + } + } + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + mp = mx->mp; + if (mp && mp->dst == 0) + break; + } + if (i >= dx->nmappings) { + mx = &dx->mapContext[0]; + mp = mx->mp; + } + +havemap: + rp = &w->gterm.rasters[mp ? mp->dst : raster]; + + /* Compute the coordinates points[0].{x,y} of the point x,y in the + * destination raster. + */ + if (mx->scale) { + /* Scaling is in effect. The following subterfuge is used to + * compute the coordinates of the center of the raster pixel (x,y) + * when the image is zoomed. We want to set the cursor to the + * center of the selected pixel, not the edge. + */ + pv[0].x = x; pv[0].y = y; + mapVector (mx, pv, pv1, npts); + pv[0].x = x + 1; pv[0].y = y + 1; + mapVector (mx, pv, pv2, npts); + + pv[0].x = (pv1[0].x + pv2[0].x) / 2.0; + pv[0].y = (pv1[0].y + pv2[0].y) / 2.0; + points = pv; + + } else { + /* No scaling. */ + pv[0].x = x; pv[0].y = y; + points = pv; + } + + /* Clip to the bounds of the destination raster and generate the + * new x,y. + */ + x = max(0, min(rp->width-1, points[0].x)); + y = max(0, min(rp->height-1, points[0].y)); + + } while (mp && (raster = mp->dst)); + + XWarpPointer (w->gterm.display, window, window, 0,0,0,0, x,y); + + w->gterm.last_x = w->gterm.cur_x = x; + w->gterm.last_y = w->gterm.cur_y = y; + + GtSetRaster (w, sv_raster); + GtSetLogRes (w, sv_xres, sv_yres); +} + + +GtGetCursorPos (w, x, y) + GtermWidget w; + int *x, *y; +{ + *x = w->gterm.last_x; + *y = w->gterm.last_y; +} + +GtSetCursorType (w, type) + GtermWidget w; + int type; +{ + static XtIntervalId id = (XtIntervalId) NULL; + Display *display = w->gterm.display; + Cursor cursor; + int interval; + Widget pw; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.cursor_type == type) + return; + + switch (w->gterm.cursor_type = type) { + case GtNoCursor: + case GtIdleCursor: + erase_crosshair (w); + cursor = w->gterm.idle_cursor; + break; + + case GtGinmodeCursor: + /* Begin graphics cursor mode. + */ + + /* If a screen clear or drawing operation has caused the redisplay + * flag to be set, redisplay any marker overlays. + */ + if (w->gterm.gm_redisplay) { + GmRedisplay (w, (Region)NULL); + w->gterm.gm_redisplay = False; + } + + /* Make sure the window is visible. + */ + if (w->gterm.raiseWindow || w->gterm.deiconifyWindow) + for (pw = (Widget)w; pw; pw = XtParent(pw)) + if (XtIsShell(pw)) { + if (w->gterm.deiconifyWindow) + XMapWindow (display, XtWindow(pw)); + if (w->gterm.raiseWindow) + XRaiseWindow (display, XtWindow(pw)); + } + + /* The first time this is done after a GtActivate causes the cursor + * to be warped into the graphics window. The interactive flag is set + * to cause GtDeactivate to restore the cursor to its original position + * after the graphics interaction finishes. + */ + if (w->gterm.warpCursor) { + int root_x, root_y, win_x, win_y; + int xoff, yoff, width, height, x, y; + Window gtermwin, root, child; + unsigned int keys; + int in_window = 0; + + width = w->core.width; + height = w->core.height; + gtermwin = w->gterm.window; + XTranslateCoordinates (display, gtermwin, w->gterm.root, + w->core.x, w->core.y, &xoff, &yoff, &child); + + if (XQueryPointer (display, w->gterm.root, &root, &child, + &root_x, &root_y, &win_x, &win_y, &keys)) { + + /* Already in gterm window? */ + if ((root_x >= xoff && root_x < xoff+width) && + (root_y >= yoff && root_y < yoff+height)) { + + if (!w->gterm.interactive) { + w->gterm.save_x = 0; + w->gterm.save_y = 0; + w->gterm.interactive++; + } + x = root_x - xoff; y = root_y - yoff; + in_window++; + + } else { + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + } else { + /* Pointer not on the current screen. + */ + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + + if ((x < 5 || x > width-5) || (y < 5 || y > height-5)) { + x = width / 2; + y = height / 2; + } + + if (!in_window) { + erase_crosshair (w); + if (w->gterm.warpCursor) { + XWindowAttributes wa; + if (XGetWindowAttributes (display, gtermwin, &wa) && + wa.map_state == IsViewable) { + + /* The following should not be necessary but is needed + * to workaround an X server bug. When warping to a + * different screen the pointer is not erased on the + * old screen. It is hard to erase it, but we can + * at least move it to the corner of the screen. + */ + if (root != w->gterm.root) { + Screen *screen = w->gterm.screen; + if (XGetWindowAttributes (display, root, &wa)) + screen = wa.screen; + XWarpPointer (display,None,root, 0,0,0,0, + WidthOfScreen(screen) - 1, + HeightOfScreen(screen) - 1); + } + + /* Now warp into the gterm window. */ + XWarpPointer (display, None, gtermwin, 0,0,0,0, x,y); + } + if (w->gterm.full_crosshair) + draw_crosshair (w, x, y); + } + + } else if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, x, y); + } + } else + update_cursor (w); + + cursor = w->gterm.ginmode_cursor; + if (interval = w->gterm.ginmodeBlinkInterval) { + XtAppContext appcon = XtWidgetToApplicationContext ((Widget) w); + id = XtAppAddTimeOut (appcon, + interval, blink_cursor, (XtPointer)w); + } else + id = (XtIntervalId) NULL; + break; + + case GtBusyCursor: + /* Exit graphics cursor mode. + */ + erase_crosshair (w); + cursor = w->gterm.busy_cursor; + break; + } + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = cursor); + if (id && w->gterm.cursor_type != GtGinmodeCursor) { + XtRemoveTimeOut (id); + id = (XtIntervalId) NULL; + } +} + +static void +blink_cursor (w, id) + GtermWidget w; + XtIntervalId *id; +{ + XtAppContext app_context; + XColor bg, fg; + int interval; + + bg = w->gterm.ginmodeColors[1]; + fg = w->gterm.ginmodeColors[0]; + + app_context = XtWidgetToApplicationContext ((Widget) w); + XRecolorCursor (w->gterm.display, w->gterm.ginmode_cursor, &fg, &bg); + XFlush (w->gterm.display); + + w->gterm.ginmodeColors[0] = bg; + w->gterm.ginmodeColors[1] = fg; + + if (interval = w->gterm.ginmodeBlinkInterval) + XtAppAddTimeOut (app_context, + interval, (XtTimerCallbackProc) blink_cursor, (XtPointer)w); +} + +GtPostInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.inputCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.inputCallback = new; +} + +GtDeleteInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.inputCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.inputCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resetCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resetCallback = new; +} + +GtDeleteResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resetCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resetCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resizeCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resizeCallback = new; +} + +GtDeleteResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resizeCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resizeCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtDrawAlphaText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + XPoint *points, pv[1], o_pv[1]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int npts, i; + + pv[0].x = x; + pv[0].y = y; + npts = 1; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + x = points[0].x; y = points[0].y; + + if (mx->use_backing_store) + XDrawString (w->gterm.display, w->gterm.pixmap, + mx->drawGC, x, y, text, strlen(text)); + XDrawString (w->gterm.display, mx->pixmap, + mx->drawGC, x, y, text, strlen(text)); + } + + update_transients (w, (Region)NULL); +} + +GtGetAlphaTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + +GtWriteAlphaCursor (w, x, y) + GtermWidget w; + int x, y; +{ +} + +GtEraseAlphaCursor (w) + GtermWidget w; +{ +} + +GtStartDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap) + if (w->gterm.d_saved) { + GtEraseDialog (w); + } else { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.pixmap ? w->gterm.pixmap : w->gterm.window, + w->gterm.d_pixmap, w->gterm.exposeGC, + 0, w->gterm.d_yoff, w->core.width, w->gterm.d_height, 0, 0); + w->gterm.d_saved = 1; + } +} + +GtEndDialog (w) + GtermWidget w; +{ + GtEraseDialog (w); + w->gterm.d_saved = 0; +} + +GtEraseDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap && w->gterm.d_saved) { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.window, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + if (w->gterm.pixmap) + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.pixmap, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + update_transients (w, (Region)NULL); + } +} + +GtDrawDialogText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + int xpos = w->gterm.d_xoff + x; + int ypos = w->gterm.d_yoff + y; + + if (w->gterm.pixmap) + XDrawImageString (w->gterm.display, w->gterm.pixmap, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); +} + +GtGetDialogTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + + +/* + * Internal functions for above code. + * ---------------------------------------- + */ + +static +set_default_color_index (w) + GtermWidget w; +{ + /* The default color index is 1, corresponding to the foreground + * drawing color color1. Index zero is the background drawing color + * color0. The remaining NColors color table entries are the optional + * drawing colors corresponding to resources "color2" through "colorN". + * These are used only if explicitly selected by the client application. + */ + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.cmap[1]); + w->gterm.color_index = 1; + invalidate_draw_context (w); +} + + +static +draw_crosshair (w, x, y) + GtermWidget w; + int x, y; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) { + /* The preserve_screen flag is set if we need to preserve the + * exact display window contents, rather than merely refresh from + * the backing store pixmap. + */ + if (w->gterm.preserve_screen) { + if (!w->gterm.preserve_valid || y != w->gterm.cur_y) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, w->core.height); + if (!w->gterm.preserve_valid || x != w->gterm.cur_x) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + x, 0, 1, w->core.height, w->core.width, 0); + w->gterm.preserve_valid = 1; + } + + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + 0, y, w->core.width, y); + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + x, 0, x, w->core.height); + + XFlush (w->gterm.display); + w->gterm.cursor_drawn++; + } + + w->gterm.cur_x = x; + w->gterm.cur_y = y; +} + + +static +erase_crosshair (w) + GtermWidget w; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.cursor_drawn) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.pixmap) { + if (w->gterm.preserve_screen && w->gterm.preserve_valid) { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, w->core.height, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + w->core.width, 0, 1, w->core.height, x, 0); + } else { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + x, 0, 1, w->core.height, x, 0); + } + } + + w->gterm.cursor_drawn = 0; + w->gterm.preserve_valid = 0; + } +} + + +static +update_transients (w, region) + GtermWidget w; + Region region; +{ + /* If an explicit region is given redisplay any markers in it immediately, + * otherwise set the redisplay flag to cause a full screen redisplay when + * drawing finishes and the widget is ready for input. + */ + if ((char *)region) + GmRedisplay (w, region); + else + w->gterm.gm_redisplay = True; + + /* Update the crosshair cursor if GIN mode is in effect. */ + update_cursor (w); +} + + +static +update_cursor (w) + GtermWidget w; +{ + if (w->gterm.cursor_type == GtGinmodeCursor && w->gterm.full_crosshair) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + if (x || y) + draw_crosshair (w, x, y); + } +} + +static Cursor +get_cursor (w, cursor_name) + GtermWidget w; + String cursor_name; +{ + XrmValue from, to; + Cursor cursor; + + from.size = strlen (cursor_name) + 1; + from.addr = cursor_name; + + to.addr = (caddr_t) &cursor; + to.size = sizeof(cursor); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRCursor, &to)) + cursor = XCreateFontCursor (w->gterm.display, XC_crosshair); + + return (cursor); +} + + +static DrawContext +get_draw_context (w) + GtermWidget w; +{ + DrawContext dx = &w->gterm.draw; + + if (!dx->valid) { + int raster = w->gterm.raster; + Raster rp = &w->gterm.rasters[raster]; + register MappingContext mx = &dx->mapContext[0]; + Region clip_region, mask_region; + struct mapping *map, *mp, *np, p_mp; + int xres = w->gterm.xres; + int yres = w->gterm.yres; + float xscale, yscale; + XRectangle r; + int i, j; + + dx->raster = w->gterm.raster; + dx->rp = rp; + + if (raster == 0) { + dx->nmappings = 1; + mx->mapping = 0; + mx->mp = NULL; + mx->use_backing_store = (w->gterm.pixmap != (Pixmap)NULL); + mx->pixmap = w->gterm.window; + mx->drawGC = w->gterm.drawGC; + mx->GC_private = 0; + + mx->xoffset = mx->yoffset = 0; +/* (7/16/97) MJF - we don't scale raster 0 since it's already in screen coords. + if (xres == rp->width && yres == rp->height) + mx->scale = 0; + else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } +*/ + mx->scale = 0; + + } else { + dx->nmappings = 0; + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (!mp->enabled || mp->src != raster || + w->gterm.rasters[mp->dst].type != GtServer) + continue; + if (!valid_mapping (w, mp)) + continue; + + mx->mp = mp; + mx->mapping = mp->mapping; + mx->pixmap = w->gterm.rasters[mp->dst].r.pixmap; + mx->use_backing_store = (mp->dst == 0 && + w->gterm.pixmap && !(mp->rop & R_Transient)); + + /* Determine if any scaling is necessary. */ + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + /* Compute logical-to-raster scaling. */ + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) { + mx->xscale = mx->yscale = 1.0; + mx->scale = 0; + } else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + /* Compute overall scale factors by combining logical-to- + * raster and raster-to-screen mappings. + */ + if (map->snx != map->dnx || map->sny != map->dny || + map->sx != map->dx || map->sy != map->dy) { + + xscale = (float)map->dnx / (float)map->snx; + mx->xscale *= xscale; + if (xscale < 0) + mx->xoffset = map->dx + abs(map->dnx) - 1; + else + mx->xoffset = map->dx; + mx->xoffset -= (map->sx * xscale); + + yscale = (float)map->dny / (float)map->sny; + mx->yscale *= yscale; + if (yscale < 0) + mx->yoffset = map->dy + abs(map->dny) - 1; + else + mx->yoffset = map->dy; + mx->yoffset -= (map->sy * yscale); + + mx->scale = 1; + } + + /* Compute the clip mask which will clip graphics to the + * destination rect of the mapping, minus any regions of + * this rect covered by other mappings. + */ + clip_region = XCreateRegion(); + r.x = map->dx; r.y = map->dy; + r.width = abs(map->dnx); + r.height = abs(map->dny); + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != mp->dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + mask_region = XCreateRegion(); + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + XUnionRectWithRegion (&r, mask_region, mask_region); + + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + } + + /* Create a drawing GC which is a copy of the global drawGC + * but using the clip mask computed above. + */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.root, + 0, NULL); + XCopyGC (w->gterm.display, w->gterm.drawGC, ~0, mx->drawGC); + XSetRegion (w->gterm.display, mx->drawGC, clip_region); + XDestroyRegion (clip_region); + mx->GC_private = 1; + + if (++dx->nmappings >= MAX_DRAW) + break; + else + mx++; + } + } + + dx->valid = 1; + } + + return (dx); +} + + +static +invalidate_draw_context (w) + GtermWidget w; +{ + register DrawContext dx = &w->gterm.draw; + register MappingContext mx; + register int i; + + if (dx->valid) { + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->GC_private) + XFreeGC (w->gterm.display, mx->drawGC); + } + dx->valid = 0; + } +} + +static XPoint * +mapVector (mx, pv1, pv2, npts) + register MappingContext mx; + XPoint *pv1; + XPoint *pv2; + int npts; +{ + register XPoint *ip = pv1; + register XPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x * mx->xscale + mx->xoffset; + op->y = ip->y * mx->yscale + mx->yoffset; + } + + return (pv2); +} + + +static void +savepos (w, event) + GtermWidget w; + XEvent *event; +{ + if (event == NULL) + return; + + switch (event->type) { + case KeyPress: + case KeyRelease: + w->gterm.last_x = event->xkey.x; + w->gterm.last_y = event->xkey.y; + break; + case ButtonPress: + case ButtonRelease: + w->gterm.last_x = event->xbutton.x; + w->gterm.last_y = event->xbutton.y; + break; + case MotionNotify: + w->gterm.last_x = event->xmotion.x; + w->gterm.last_y = event->xmotion.y; + break; + } +} + + +/* + * IMAGING routines. + * ----------------------- + * Our strategy here is to support a range of visuals with pseudocolor being + * preferred if available. All imaging is done internally using 8 bit images + * and a max 256 element colormap. If the display hardware has a depth less + * than 8 bits, e.g. for a monochrome display, the image is reduced to the + * screen depth by some technique before being output to the display. + * + * Images (rasters) are implemented internally in Gterm using either ximages or + * off screen pixmaps. Which format is used is decided at raster create time + * and is controlled by a Gterm resource. This is transparent to the client + * application. Currently only 8 bit rasters are supported. + * + * GtRasterInit (gt) + * GtAssignRaster (gt, raster, drawable) + * GtCreateRaster (gt, raster, type, width, height, depth) + * GtDestroyRaster (gt, raster) + * exists = GtQueryRaster (gt, raster, &type, &width, &height, &depth) + * raster = GtNextRaster (gt) + * GtSetRaster (gt, raster) + * raster = GtGetRaster (gt) + * n = GtNRasters (gt) + * + * GtWritePixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtReadPixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtSetPixels (gt, raster, ct, x1, y1, nx, ny, color, rop) + * GtRefreshPixels (gt, raster, ct, x1, y1, nx, ny) + * pixmap = GtExtractPixmap (gt, src, ct, x, y, width, height) + * GtInsertPixmap (gt, pixmap, dst, ct, x, y, width, height) + * + * colormap = GtNextColormap (gt) + * GtFreeColormap (gt, colormap) + * GtWriteColormap (gt, colormap, first, nelem, r, g, b) + * GtReadColormap (gt, colormap, first, nelem, r, g, b) + * GtLoadColormap (gt, colormap, offset, scale) + * exists = GtQueryColormap (gt, colormap, &first, &nelem, &maxelem) + * GtWriteIomap (gt, iomap, first, nelem) + * GtReadIomap (gt, iomap, first, nelem) + * pixel = GtGetClientPixel (gt, gterm_pixel) + * + * GtInitMappings (gt) + * mapping = GtNextMapping (gt) + * GtFreeMapping (gt, mapping) + * GtRaiseMapping (gt, mapping, ref|NULL) + * GtLowerMapping (gt, mapping, ref|NULL) + * int = GtCompareMappings (gt, map1, map2) + * GtEnableMapping (gt, mapping, refresh) + * GtDisableMapping (gt, mapping, erase) + * active = GtActiveMapping (gt, mapping) + * GtRefreshMapping (gt, mapping) + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mapping) + * + * GtCopyRaster (gt, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtSetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtGetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * + * GtMapVector (gt, mapping, dir, pv1, pv2, npts) + * GtPixelToNDC (gt, raster, pv1, pv2, npts) + * GtNDCToPixel (gt, raster, pv1, pv2, npts) + * + * GtDebug (gt, fp, what) + * + * In the case of CopyRaster or {Set|Get}Mapping, raster coordinates may be + * specified in either raster pixel (GtPixel) units or in normalized device + * coordinates (GtNDC) in the range 0-32767. + * --------------------------------------------------------------------------- + */ + +GtRasterInit (w) + GtermWidget w; +{ + register int i; + register Raster rp; + register struct colormap *cm; + struct colormap *next_cm; + + invalidate_draw_context (w); + + /* Destroy any existing rasters. */ + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (w->gterm.rasters[i].type) + GtDestroyRaster (w, i); + + /* Allocate the initially empty raster descriptors. */ + XtFree ((char *)w->gterm.rasters); + w->gterm.rasters = rp = + (Raster) XtCalloc (w->gterm.maxRasters, sizeof (struct raster)); + w->gterm.nrasters = 0; + w->gterm.raster = 0; + + /* Raster 0 is the display window. */ + rp->type = PixmapRaster; + rp->width = w->core.width; + rp->height = w->core.height; + rp->r.pixmap = w->gterm.window; + rp->delete = 0; + w->gterm.nrasters++; + + /* Free any previously allocated colormap cells. */ + if (w->gterm.ncolors > SZ_STATIC_CMAP && w->gterm.useDefaultCM) { + XFreeColors (w->gterm.display, w->core.colormap, + &w->gterm.cmap[SZ_STATIC_CMAP], w->gterm.ncolors - SZ_STATIC_CMAP, + 0); + w->gterm.ncolors = SZ_STATIC_CMAP; + invalidate_cmap (w); + } + + /* Free any client defined colormaps. */ + for (cm = w->gterm.colormaps; cm; cm = next_cm) { + next_cm = cm->next; + XtFree ((char *)cm); + } + w->gterm.colormaps = NULL; + + /* Initialize the mappings. */ + GtInitMappings (w); +} + + +/* GtNextRaster -- Return the index of the next unused raster. + */ +GtNextRaster (w) + register GtermWidget w; +{ + register int i; + + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (!w->gterm.rasters[i].type) + return (i); + + return (-1); +} + + +/* GtNRasters -- Return the number of currently defined rasters. + */ +GtNRasters (w) + GtermWidget w; +{ + return (w->gterm.nrasters); +} + + +/* GtAssignRaster -- Assign a raster descriptor to an externally created + * drawable (window or pixmap). The raster thus created may be mapped or + * drawn into like the rasters created privately by the imaging code, but + * this allows use of this code to access other windows, or shared pixmaps. + */ +GtAssignRaster (w, raster, drawable, type) + GtermWidget w; + int raster; /* one-indexed */ + XtPointer drawable; /* object containing pixel array */ + int type; /* type of drawable [not used] */ +{ + register Raster rp; + XWindowAttributes wa; + + if (raster <= 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + if (!XGetWindowAttributes (w->gterm.display, (Window)drawable, &wa)) + return (ERR); + + rp->type = PixmapRaster; + rp->width = wa.width; + rp->height = wa.height; + rp->r.pixmap = (Pixmap) drawable; + rp->delete = 0; + + return (OK); +} + + +/* GtCreateRaster -- Create a new raster of the given size. A server pixmap + * (GtServer) or ximage (GtClient) raster will be created depending upon the + * current value of the cacheRasters resource. + */ +GtCreateRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int type; + int width, height; + int depth; +{ + register uchar *op; + register int npix, pixel; + uchar *data; + XImage *xp; + Raster rp; + int cache; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + /* Only rasters of depth 8 bits are currently supported. */ + if (depth && depth != 8) + return (ERR); + + /* Check for a raster number in bounds. */ + if (raster < 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + /* A create on raster 0 (the display window) is treated as an attempt + * to resize the window. + */ + if (raster == 0) { + XWindowAttributes wa; + + invalidate_draw_context (w); + + /* Issue the resize request. */ + XtVaSetValues ((Widget)w, + XtNwidth, (XtArgVal)width, + XtNheight, (XtArgVal)height, + NULL); + XFlush (w->gterm.display); + + /* The following generates a round trip request to the server and + * is an attempt to allow the window system time to process the + * resize request before the client can issue a GtQueryRaster to + * see if the request has succeeded (hence causing a race condition). + * If the window is not the requested size the delay flag is set + * to cause graphics input processing to be suspended until the + * window is resized or redisplayed. A dummy expose event is + * generated to clear the delay condition in case the resize request + * is not granted. + */ + if (XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + rp->width = wa.width; + rp->height = wa.height; + + if (rp->width != width || rp->height != height) { + XExposeEvent ev; + ev.type = Expose; + ev.send_event = True; + ev.display = w->gterm.display; + ev.window = w->gterm.window; + ev.x = ev.y = 0; + ev.width = ev.height = 1; + ev.count = 0; + + XSendEvent (w->gterm.display, w->gterm.window, False, + NoEventMask, (XEvent *)&ev); + w->gterm.delay = 1; + } + } + return (OK); + } + + /* Get rid of any old raster. */ + GtDestroyRaster (w, raster); + + rp->width = width; + rp->height = height; + rp->delete = 1; + + /* Cache the raster? */ + if (strcmp (w->gterm.cacheRasters, "always") == 0) + cache = 1; + else if (strcmp (w->gterm.cacheRasters, "never") == 0) + cache = 0; + else + cache = (type == GtServer); + + /* Create new raster. */ + if (cache) { + /* Create a pixmap. */ + rp->type = PixmapRaster; + rp->r.pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + width, height, RasterDepth); + if (rp->r.pixmap == (Pixmap)NULL) + goto ximage; + XFillRectangle (w->gterm.display, rp->r.pixmap, w->gterm.clearGC, + 0, 0, width, height); + + } else { + /* Create an XImage. */ +ximage: + rp->type = ImageRaster; + + /* Get pixel storage. */ + npix = width * height; + if ((data = (uchar *) XtMalloc (npix)) == NULL) + return (ERR); + else { + for (op=data, pixel=w->gterm.color0; --npix >= 0; ) + *op++ = pixel; + } + + /* The following doesn't yet deal properly with byte and bit ordering + * differences between the server and client. + */ + rp->r.ximage = xp = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, width, height, 8, 0); + if (xp == NULL) { + rp->type = 0; + return (ERR); + } + } + + w->gterm.nrasters++; + return (OK); +} + + +/* GtDestroyRaster -- Destroy a raster. Any mappings which reference the + * raster are deactivated, and all storage associated with the raster is freed. + */ +GtDestroyRaster (w, raster) + GtermWidget w; + int raster; +{ + register Raster rp; + register Mapping mp, next; + + if (raster <= 0) + return; + + invalidate_draw_context (w); + + /* Disable any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = next) { + next = mp->next; + if (mp->src == raster || mp->dst == raster) + free_mapping (w, mp); + } + + /* Destroy the raster. */ + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (rp->delete) { + if (rp->type == ImageRaster) + XDestroyImage (rp->r.ximage); + else if (rp->type == PixmapRaster) + XFreePixmap (w->gterm.display, rp->r.pixmap); + } + w->gterm.nrasters--; + rp->type = 0; + rp->delete = 0; + } +} + + +/* GtQueryRaster -- Determine whether a raster exists and if so return its + * size. + */ +GtQueryRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int *type; + int *width, *height; + int *depth; +{ + register Raster rp; + + if (raster < 0 || raster > w->gterm.maxRasters) + return (0); + + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (type) { + if (rp->type == PixmapRaster) + *type = GtServer; + else + *type = GtClient; + } + if (width) + *width = rp->width; + if (height) + *height = rp->height; + if (depth) + *depth = RasterDepth; + return (1); + } else + return (0); +} + + +/* GtWritePixels -- Write to a rectangular region of a raster. If any + * mappings are currently defined which reference this raster as the source, + * and a mapped region is being rewritten, the affected pixels will be + * refreshed by the mapping. + */ +GtWritePixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + int bytes_per_line, i; + Mapping mp; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + XImage *ximage; + uchar *data; + int npix; + + /* Get a data buffer. */ + if ((data = (uchar *)XtMalloc (npix = nx * ny)) == NULL) + return (ERR); + + /* Convert the pixel values to colormap indices. */ + cmap = get_cmap_in (w); + for (ip=pixels, op=data, n=npix; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + + ximage = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, nx, ny, 8, 0); + + if (raster == 0 && w->gterm.pixmap) { + + /* ### Someone (Mike?) added this code for some reason, but it + * does not appear to be valid. This code already writes to the + * backing store (gterm.pixmap) so use_backing_store should not + * be required. Also blindly using only the first mapping context + * and ignoring any others cannot be correct. There is code + * below which executes any mappings defined on the raster. + * In general this requires scaling, not a simple XCopyArea. + * + * DrawContext dx = get_draw_context (w); + * register MappingContext mx; + * mx = &dx->mapContext[0]; + */ + + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + /* ### (cont'd) + * if (mx->use_backing_store) + * XCopyArea (display, w->gterm.pixmap, mx->pixmap, + * w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + */ + + XCopyArea (display, w->gterm.pixmap, rp->r.pixmap, + w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + } else + XPutImage (display, rp->r.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + XtFree ((char *)data); + ximage->data = NULL; + XDestroyImage (ximage); + + } else if (rp->type == ImageRaster) { + cmap = get_cmap_in (w); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + ip = pixels; + + /* Copy the data into the ximage data raster, converting input + * pixels to Xlib pixel values in the process. + * + * Possibly this should be done at Pixmap write time rather than + * during raster i/o so that the image pixel values are preserved. + * Otherwise reading back pixels is difficult and if the color map is + * dynamically modified the original pixel values may be lost. + * Postponing display pixel value generation woudl also make it easy + * to add support later for image depths other than 8 bit. Doing the + * conversion to display pixels here is however simpler and more + * efficient so that is how we do it for now. + */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtReadPixels -- Read a rectangular region of a raster. + */ +GtReadPixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + + int bytes_per_line, i; + int x, y, delxin = 0; + XImage *xin; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + /* Get the input ximage. */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + + /* Read the pixmap subraster into an ximage. If we are reading the + * screen (raster == 0) and we have an off-screen backing store pixmap, + * use that instead of the screen. + */ + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? w->gterm.pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + + if (xin == NULL) + return (ERR); + + delxin++; + x = y = 0; + + } else { + xin = rp->r.ximage; + x = x1; + y = y1; + } + + cmap = get_cmap_out (w); + bytes_per_line = xin->bytes_per_line; + lp = (uchar *)xin->data + y * bytes_per_line + x; + op = pixels; + + /* Copy the data to the output buffer, converting display pixels to + * client pixels in the process. + */ + for (i=0; i < ny; i++) { + for (n=nx, ip=lp; --n >= 0; ) + *op++ = cmap[*ip++]; + lp += bytes_per_line; + } + + if (delxin) + XDestroyImage (xin); + return (OK); +} + + +/* GtSetPixels -- Set all the raster pixels in a region to a single color. + * If nx=ny=0 the entire raster will be written. + */ +GtSetPixels (w, raster, ct, x1, y1, nx, ny, color, rop) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; + int color; + int rop; +{ + register Raster rp; + Mapping mp; + + /* Get raster pointer. */ + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + raster, ct, x1,y1,nx,ny); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + } + + /* Perform some range checks. */ + if (x1 == 0 && y1 == 0 && nx == 0 && ny == 0) { + nx = rp->width; + ny = rp->height; + } else { + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + } + + /* Set the pixels. + */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + GC gc = w->gterm.clearGC; + int use_backing_store; + + use_backing_store = + (raster == 0 && w->gterm.pixmap && !(rop & R_Transient)); + + XSetForeground (display, gc, get_pixel(w,color)); + XFillRectangle (display, rp->r.pixmap, gc, x1, y1, nx, ny); + if (use_backing_store) + XFillRectangle (display, w->gterm.pixmap, gc, x1, y1, nx, ny); + XSetForeground (display, gc, w->gterm.color0); + + } else { + register int n, i; + register uchar *op; + register Pixel pixel; + int bytes_per_line; + uchar *lp; + + pixel = get_pixel (w, color); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Set all pixels in the indicated region. */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = pixel; + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtRefreshPixels -- Update any mappings defined upon the given region of + * the given source raster, as if the pixel values had been set with a + * write pixels call. + */ +GtRefreshPixels (w, raster, ct, x1, y1, nx, ny) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; +{ + register Raster rp = &w->gterm.rasters[raster]; + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); + save_mapping (&sv_mp, 0, 0, + raster, ct, x1,y1,nx,ny, + 0, GtPixel, 0,0,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.sx; + y1 = p_mp.sy; + nx = p_mp.snx; + ny = p_mp.sny; + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } +} + + +/* GtExtractPixmap -- Extract a rectangular region of a raster and return + * as a pixmap. The caller is responsible for later deleting this pixmap. + */ +Pixmap +GtExtractPixmap (w, src, ctype, x, y, width, height) + GtermWidget w; + int src; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + int x1, y1, nx, ny; + String cache; + int i; + + rp = &w->gterm.rasters[src]; + if (!rp->type) + return ((Pixmap)NULL); + + /* If width and height are zero, return the full raster. */ + if (width <= 0) + width = rp->width; + if (height <= 0) + height = rp->height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + src, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Find any empty raster slot and use it to generate the output pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + cache = w->gterm.cacheRasters; + w->gterm.cacheRasters = "always"; + + if (GtCreateRaster (w, i, GtServer, nx, ny) == ERR) { + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } else if (rp->type != PixmapRaster) + goto err; + + if (GtCopyRaster (w, 0, + src,0, x1,y1,nx,ny, i,0, 0,0,nx,ny) == ERR) { +err: + GtDestroyRaster (i); + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } + + rp->type = 0; + w->gterm.nrasters--; + w->gterm.cacheRasters = cache; + + return (rp->r.pixmap); + } + } + + return ((Pixmap)NULL); +} + + +/* GtInsertPixmap -- Insert the contents of the given pixmap into a raster + * at the indicated coordinates. + */ +GtInsertPixmap (w, pixmap, dst, ctype, x, y, width, height) + GtermWidget w; + Pixmap pixmap; + int dst; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + XWindowAttributes wa; + int x1, y1, nx, ny; + int i; + + /* Check that the pixmap exists. */ + if (!XGetWindowAttributes (w->gterm.display, pixmap, &wa)) + return (ERR); + + /* Default to full dimensions of pixmap if no dimensions given. */ + if (width <= 0) + width = wa.width; + if (height <= 0) + height = wa.height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + dst, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Create the destination raster if none exists. */ + if (!w->gterm.rasters[dst].type) + if (GtCreateRaster (w, dst, GtDefault, nx, ny) == ERR) + return (ERR); + + /* Find an empty raster slot and use it to build a fake source raster + * using the supplied pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + rp->type = PixmapRaster; + rp->width = nx; + rp->height = ny; + rp->r.pixmap = pixmap; + + if (GtCopyRaster (w, 0, + i,0, 0,0,nx,ny, dst,0, x1,y1,nx,ny) < 0) + return (ERR); + + rp->type = 0; + return (OK); + } + } + + return (ERR); +} + + +/* GtWriteColormap -- Allocate or modify colormap cells. The Gterm widget + * colormap consists of a fixed number of preassigned, read-only color cells, + * plus a variable number of dynamically allocated application defined color + * cells. The application sees only the preassigned pixel space 0-N where + * N is the maximum pixel value. These values are mapped to Xlib pixel values + * by the CMAP vector in the main Gterm widget descriptor. The server + * colormap does the final mapping to RGB triplets. + * + * Our strategy here is as follows. If we have a monochrome screen set up a + * one-to-one fake colormap so that we preserve the input pixel values and + * render a one-bit image later. If we have a StaticGray or StaticColor + * visual allocate read-only color cells to allow X to choose the closest + * colors to what we request. If we have a GrayScale or PseudoColor visual + * allocate private read-write colors. The TrueColor and DirectColor + * visuals should not be seen here as we should have been able to set up the + * PseudoColor visual on screens that support these visuals, but if they are + * seen use a one-to-one mapping to preserve the 8 bit pixel values. + */ +GtWriteColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + XWindowAttributes wa; + register XColor *cp; + register int i, j, v, n; + unsigned long plane_masks[1]; + int req, need; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + if (map > 0) { + /* Create or modify a colormap descriptor. The display colormap + * is not affected. + */ + register struct colormap *cm; + struct colormap *last_cm; + register XColor *cp; + register int i; + + /* See if the colormap already exists. */ + for (cm = w->gterm.colormaps, last_cm = NULL; cm; cm = cm->next) { + last_cm = cm; + if (cm->map == map) + break; + } + + /* If not, create it. */ + if (!cm) { + if (!(cm = (struct colormap *)XtCalloc(1,sizeof(struct colormap)))) + return (ERR); + if (last_cm) + last_cm->next = cm; + else + w->gterm.colormaps = cm; + + /* Initialize static part of colormap. */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } + + cm->map = map; + cm->ncells = max (cm->ncells, first + nelem); + + /* Ignore attempts to overwrite static part of colormap. */ + for ( ; first < SZ_STATIC_CMAP; first++, nelem--) { + r++; g++; b++; + } + + memmove (&cm->r[first], r, nelem * sizeof (ushort)); + memmove (&cm->g[first], g, nelem * sizeof (ushort)); + memmove (&cm->b[first], b, nelem * sizeof (ushort)); + + return (OK); + } + + /* Write to the display colormap. + */ + if (first < SZ_STATIC_CMAP || first + nelem > MAX_SZCMAP) + return (ERR); + + /* Invalidate the cmap cache. */ + invalidate_cmap (w); + + /* Get the window attributes. We need to do this to determine the type + * of visual used for the window, which determines our color allocation + * strategy. This is only done once since presumably the visual and + * window depth will not change after the widget has been around long + * enough to receive a GtWriteColormap call. + */ + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) + return (ERR); + w->gterm.wa = wa; + w->gterm.wa_defined++; + } else + wa = w->gterm.wa; + + if (wa.depth == 1) + goto unitary; + + switch (wa.visual->class) { + case StaticGray: + case StaticColor: + /* Allocate "best-match" colors. */ + for (i=first; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + cp->red = r[i-first]; + cp->green = g[i-first]; + cp->blue = b[i-first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (XAllocColor (w->gterm.display, wa.colormap, cp)) + w->gterm.cmap[i] = cp->pixel; + else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + } + } + break; + + case GrayScale: + case PseudoColor: + if (w->gterm.useDefaultCM) { +usedef: /* Allocate private r/w colors from default colormap. */ + need = first + nelem - w->gterm.ncolors; + + /* Allocate new color cells if needed. If we can't allocate all + * the requested cells the unallocated pixel values are set to + * black. + */ + if ((n = need) > 0) { + /* Get the colormap cells. */ + req = min(w->gterm.maxColors, first + nelem - SZ_STATIC_CMAP) - + (w->gterm.ncolors - SZ_STATIC_CMAP); + for (n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, wa.colormap, + False, plane_masks, 0, + &w->gterm.cmap[w->gterm.ncolors+n], req)) { + n += req; + } else + req /= 2; + + /* Initialize the color descriptors. */ + for (i = w->gterm.ncolors; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + if (i < w->gterm.ncolors + n) { + cp->pixel = w->gterm.cmap[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + cp->flags = 0; + } + } + w->gterm.ncolors += n; + } + + /* Assign RGB colors to the referenced cells. */ + for (i=0; i < nelem; i++) { + cp = &w->gterm.color[first+i]; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + n = w->gterm.ncolors - first; + if (n > 0) + XStoreColors (w->gterm.display, wa.colormap, + &w->gterm.color[first], n); + + } else { + /* Allocate colors in a custom colormap. If the named colormap + * does not yet exist we create one. Multiple gterm widget + * instances may share the same colormap. + */ + Colormap colormap; + long timeval, time(); + int ncolors, shadow; + + /* get_colormap will direct us to the default colormap if the + * custom colormap cannot be accessed or created. + */ + colormap = get_colormap (w); + if (w->gterm.useDefaultCM) + goto usedef; + + /* Assign RGB colors to the referenced cells. */ + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + /* Store the new colors. */ + if (ncolors > 0) + XStoreColors (w->gterm.display, + colormap, &w->gterm.color[first], ncolors); + + /* Also attempt to store the colors in the default colortable, + * by allocating, writing, and then deallocating cells. This + * helps keeps the gterm window visible when the default + * colormap is loaded. To avoid excessive server queries the + * default colormap is only updated every so often. Updating is + * disabled if cmapShadow is set to zero. If shadowing is + * enabled the update is always performed if the WriteColormap + * occurs when the pointer is not in the window (e.g., when a + * button elsewhere in the GUI is pressed) as otherwise the + * change will not be visible as the private colormap will not + * be loaded by the window manager. + */ + shadow = w->gterm.cmapShadow; + timeval = time((long *)NULL); + + if (shadow && (!w->gterm.in_window || + (timeval - w->gterm.cmapLastShadow > shadow))) { + + update_default_colormap (w); + w->gterm.cmapLastShadow = timeval; + } + } + break; + + default: + /* Set up a unitary, or one-to-one mapping, to preserve the input + * pixel values so that we can render them later. + */ +unitary: + for (i = first; i < first+nelem; i++) { + w->gterm.cmap[i] = i; + cp = &w->gterm.color[i]; + cp->pixel = i; + cp->red = r[i+first]; + cp->green = g[i+first]; + cp->blue = b[i+first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (i+1 > w->gterm.ncolors) + w->gterm.ncolors = i + 1; + } + break; + } + + return (OK); +} + + +/* GtReadColormap -- Return the color assignments for a region of the named + * colormap. + */ +GtReadColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + if (map > 0) { + /* Read from a colormap descriptor. + */ + register struct colormap *cm; + register int i, j; + + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + j = first + i; + if (j < cm->ncells) { + r[i] = cm->r[j]; + g[i] = cm->g[j]; + b[i] = cm->b[j]; + } else + break; + } + + return (i); + + } else { + /* Read the display colormap. + */ + register XColor *cp; + register int i; + + /* Return RGB values. */ + for (i=0; i < nelem; i++) + if (first+i < w->gterm.ncolors) { + cp = &w->gterm.color[first+i]; + r[i] = cp->red; + g[i] = cp->green; + b[i] = cp->blue; + } else + break; + + return (i); + } +} + + +/* GtLoadColormap -- Load a colormap into the display, optionally scaling + * the colormap via a linear transformation in the process. The colormap is + * unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. + * If map=0 the linear transformation is applied directly to the display + * colormap. + * + * The offset refers to the center of the mapped region of the transfer + * function, which is why the center value is at 0.5. For example, if the + * range of raster pixel intensities is normalized to the range 0.0 to 1.0, + * then a transfer function of [offset=0.3,slope=3.0] will display the region + * of intenstities centered around the normalized intenstity of 0.3, with a + * contrast of 3.0 (the screen intensity changes 3 units for a unit change in + * raster pixel intensity). The transfer function [offset=0.3,slope=-3.0] + * will display the same range of pixel intensitites, but with a negative + * contrast. The transfer function [offset=0.5,slope=1.0] has intercepts + * of [0,0] and [1,1] hence it displays the full range of raster pixel + * intensities - the input colormap is used as is, without resampling. + */ +GtLoadColormap (w, map, offset, slope) + GtermWidget w; + int map; + float offset, slope; +{ + register int i; + register XColor *cp; + register struct colormap *cm; + struct colormap d_cmap, o_cmap; + int noscale, nelem, c1, c2; + float x, y, z, frac; + ushort r, g, b; + + /* Get the colormap to be loaded. + */ + if (map == 0) { + /* Create a dummy colormap struct from the screen colormap. */ + cm = &d_cmap; + cm->map = 0; + cm->next = NULL; + cm->ncells = w->gterm.ncolors; + for (i=0; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } else { + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (ERR); + } + + /* Compute the scaled colormap. Only the dynamic part of the colormap + * is scaled, the static cells are not affected. + */ + o_cmap.map = 0; + o_cmap.ncells = cm->ncells; + nelem = cm->ncells - SZ_STATIC_CMAP; + noscale = (abs(offset - 0.5) < 0.0001 && abs(slope - 1.0) < 0.0001); + + if (noscale) { + for (i=0; i < nelem; i++) { + o_cmap.r[i] = cm->r[SZ_STATIC_CMAP+i]; + o_cmap.g[i] = cm->g[SZ_STATIC_CMAP+i]; + o_cmap.b[i] = cm->b[SZ_STATIC_CMAP+i]; + } + } else { + for (i=0; i < nelem; i++) { + x = (float)i / (float)(nelem - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + r = cm->r[SZ_STATIC_CMAP]; + g = cm->g[SZ_STATIC_CMAP]; + b = cm->b[SZ_STATIC_CMAP]; + } else if (y >= 1.0) { + r = cm->r[cm->ncells-1]; + g = cm->g[cm->ncells-1]; + b = cm->b[cm->ncells-1]; + } else { + z = y * (nelem - 1) + SZ_STATIC_CMAP; + if (w->gterm.cmapInterpolate) { + c1 = (int)z; + c2 = min (cm->ncells-1, c1 + 1); + frac = z - c1; + r = cm->r[c1] * (1.0 - frac) + cm->r[c2] * frac; + g = cm->g[c1] * (1.0 - frac) + cm->g[c2] * frac; + b = cm->b[c1] * (1.0 - frac) + cm->b[c2] * frac; + } else { + c1 = (int)z; + r = cm->r[c1]; + g = cm->g[c1]; + b = cm->b[c1]; + } + } + + o_cmap.r[i] = r; + o_cmap.g[i] = g; + o_cmap.b[i] = b; + } + } + + /* Load the colormap into the display. */ + GtWriteColormap (w, 0, SZ_STATIC_CMAP, nelem, + o_cmap.r, o_cmap.g, o_cmap.b); + + /* If the colormap we loaded to the display was the display colormap, + * restore the original unscaled colors in the gterm descriptor so that + * we won't be scaling a scaled colormap in the next operation. + */ + if (map == 0) + for (i=SZ_STATIC_CMAP; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cp->red = cm->r[i]; + cp->green = cm->g[i]; + cp->blue = cm->b[i]; + } + + return (OK); +} + + +/* GtQueryColormap -- Return information on the size and state of a colormap. + */ +GtQueryColormap (w, map, first, nelem, maxelem) + register GtermWidget w; + int map; + int *first, *nelem, *maxelem; +{ + register struct colormap *cm; + int nitems; + + if (first) + *first = SZ_STATIC_CMAP; + if (nelem) + *nelem = 0; + if (maxelem) + *maxelem = min (w->gterm.maxColors, MAX_SZCMAP) - SZ_STATIC_CMAP; + + if (map > 0) { + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + if (nelem) + *nelem = cm->ncells - SZ_STATIC_CMAP; + + } else { + if (nelem) + *nelem = w->gterm.ncolors - SZ_STATIC_CMAP; + if (maxelem) { + nitems = min (MAX_SZCMAP, CellsOfScreen(w->gterm.screen)); + *maxelem = min (nitems, + min (w->gterm.maxColors, MAX_SZCMAP - w->gterm.base_pixel)); + } + } + + return (1); +} + + +/* GtNextColormap -- Return a unique colormap number. + */ +GtNextColormap (w) + register GtermWidget w; +{ + register struct colormap *cm; + register int mapno = 0; + + /* Get the next map number. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map > mapno) + mapno = cm->map; + + return (mapno + 1); +} + + +/* GtFreeColormap -- Free a colormap descriptor. + */ +GtFreeColormap (w, colormap) + register GtermWidget w; + int colormap; +{ + register struct colormap *p_cm, *cm; + + /* Find the colormap and free it. */ + for (p_cm = NULL, cm = w->gterm.colormaps; cm; p_cm = cm, cm = cm->next) + if (cm->map == colormap) { + if (p_cm) + p_cm->next = cm->next; + else + w->gterm.colormaps = cm->next; + XtFree ((char *)cm); + return; + } +} + + +/* GtWriteIomap -- An iomap is an optional lookup table used to isolate the + * client application from the color model used within the Gterm widget. + * To simplify color allocation the Gterm widget defines a logical color + * space where color 0 is the background, 1 the foreground, 2-N are statically + * allocated standard colors, and colors N+1 and above are dynamically + * allocated by the graphics application. Less-demanding applications use + * only the statically allocated, shared colors. The widget internally maps + * these logical colors to whatever the window system requires, but providing + * a well-defined logical color space isolates the client from the details of + * color allocation in the underlying window system. + * + * An iomap can be used to define a mapping between the color model of the + * client application and the Gterm color model (when we say color model here + * we mean color allocation schemes for 8 bit pseudocolor). By default the + * iomap is one-to-one. The use of an iomap frees the client from having to + * worry about color index translations, and allows color tables to be + * combined in the widget for greater efficiency when color tables are serially + * applied. The iomap applies to all color indices or pixel values passed + * in i/o operations between the client and the Gterm widget. + */ +GtWriteIomap (w, iomap, first, nelem) + register GtermWidget w; + ushort *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (&w->gterm.iomap[c1], iomap, nelem * sizeof(ushort)); + invalidate_cmap (w); +} + + +/* GtReadIomap -- Read back the contents of the iomap. + */ +GtReadIomap (w, iomap, first, nelem) + register GtermWidget w; + uchar *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (iomap, &w->gterm.iomap[c1], nelem * sizeof(ushort)); +} + + +/* init_iomap -- Initialize the iomap and the cmap cache. + */ +static void +init_iomap (w) + GtermWidget w; +{ + register ushort *iomap = w->gterm.iomap; + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + iomap[i] = i; + invalidate_cmap (w); +} + + +/* invalidate_cmap -- Invalidate the cmap cache. + */ +static void +invalidate_cmap (w) + register GtermWidget w; +{ + w->gterm.cmap_in_valid = w->gterm.cmap_out_valid = 0; +} + + +/* get_cmap_in -- Get the combined input colormap, used to transform color + * values received from the client to window system color indices. + */ +static Pixel * +get_cmap_in (w) + register GtermWidget w; +{ + register Pixel *cmap, *cmap_in = w->gterm.cmap_in; + register ushort *iomap; + register int i, j; + int ncolors; + + if (w->gterm.cmap_in_valid) + return (cmap_in); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + ncolors = w->gterm.ncolors - SZ_STATIC_CMAP; + + /* If ncolors is small wrap around so that pixel values stay within + * the mapped range of output pixels. + */ + for (i=0; i < MAX_SZCMAP; i++) { + j = iomap[i]; + if (j > SZ_STATIC_CMAP && ncolors) + j = ((j - SZ_STATIC_CMAP) % ncolors) + SZ_STATIC_CMAP; + cmap_in[i] = cmap[j]; + } + + w->gterm.cmap_in_valid++; + return (cmap_in); +} + + +/* get_cmap_out -- Get the combined output colormap, used to transform window + * system color indices to the color system of the client. Note that this is + * not necessarily a uniquely defined invertible transformation. + */ +static Pixel * +get_cmap_out (w) + GtermWidget w; +{ + register Pixel *cmap; + register ushort *iomap; + Pixel *cmap_out = w->gterm.cmap_out; + register int pixel, i; + int j; + + if (w->gterm.cmap_out_valid) + return (cmap_out); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + + /* Invert the two colormaps. This is not very efficient, but we don't + * have to do this very often (a GtReadPixels call is about the only + * case, and even then the map is cached). + */ + for (j=0; j < MAX_SZCMAP; j++) { + pixel = j; + + /* Lookup display pixel in cmap. */ + for (i=0; i < MAX_SZCMAP; i++) + if (cmap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + + /* Lookup cmap pixel in iomap. */ + if (iomap[pixel] != pixel) { + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + } + + cmap_out[j] = pixel; + } + + w->gterm.cmap_out_valid++; + return (cmap_out); +} + + +/* get_pixel -- Convert a client color index into a display pixel. + */ +static Pixel +get_pixel (w, client_pixel) + register GtermWidget w; + register int client_pixel; +{ + register Pixel *cmap = get_cmap_in (w); + + if (client_pixel < 0 || client_pixel >= MAX_SZCMAP) + return (w->gterm.cmap[1]); + else + return (cmap[client_pixel]); +} + + +/* GtGetClientPixel -- Convert a gterm pixel into a client pixel. + */ +GtGetClientPixel (w, pixel) + GtermWidget w; + register int pixel; +{ + register int i; + register ushort *iomap; + int client_pixel = 0; + + get_cmap_in (w); + iomap = w->gterm.iomap; + + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + client_pixel = i; + break; + } + + return (client_pixel); +} + + +/* GtInitMappings -- Delete all mappings and initialize the mapping subsystem. + */ +GtInitMappings (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + invalidate_draw_context (w); + + /* Free any mapping storage. */ + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (mp->defined) + free_mapping (w, mp); + } + XtFree ((char *)w->gterm.mappings); + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + } + + /* Allocate the initially empty mapping descriptors. */ + w->gterm.mappings = + (Mapping) XtCalloc (w->gterm.maxMappings, sizeof (struct mapping)); + + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + mp->mapping = i; + } + + w->gterm.nmappings = 0; +} + + +/* GtNextMapping -- Return the index of the next available mapping descriptor. + * This routine always returns a mapping index of 1 or higher. + */ +GtNextMapping (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + for (i=1; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + return (i); + } + + return (-1); +} + + +/* GtFreeMapping -- Free a mapping descriptor. + */ +GtFreeMapping (w, mapping) + register GtermWidget w; + int mapping; +{ + free_mapping (w, &w->gterm.mappings[mapping]); +} + + +/* GtRaiseMapping -- Set the stacking order of a mapping to one level + * higher than the reference mapping. If no reference mapping is given + * the mapping is raised to the top of the stacking order. + */ +GtRaiseMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = w->gterm.mp_tail; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already on top? */ + if (mp == w->gterm.mp_tail) + return; + + mp_unlink (w, mp); + mp_linkafter (w, mp, ref_mp); +} + + +/* GtLowerMapping -- Change the stacking order of a mapping relative to another + * mapping, causing the first mapping to be drawn below the second. + */ +GtLowerMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = NULL; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already lowered? */ + if (mp == w->gterm.mp_head) + return; + + /* Lower it. */ + mp_unlink (w, mp); + if (ref_mp && ref_mp->prev) + mp_linkafter (w, mp, ref_mp->prev); + else { + mp->next = w->gterm.mp_head; + w->gterm.mp_head = mp; + if (mp->next) + mp->next->prev = mp; + if (!w->gterm.mp_tail) + w->gterm.mp_tail = mp; + } +} + + +/* GtCompareMappings -- Compare the stacking order of two mappings. A + * negative value is returned if the m1 < m2, zero is returned if the + * mappings are the same, and a positive value is returned if m1 > m2. + */ +GtCompareMappings (w, map1, map2) + register GtermWidget w; + int map1, map2; +{ + register Mapping mp, mp1, mp2; + + if (map1 == map2) + return (0); + + mp1 = &w->gterm.mappings[map1]; + mp2 = &w->gterm.mappings[map2]; + + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp == mp1) + return (-1); + else if (mp == mp2) + return (1); + + return (0); +} + + +/* GtSelectRaster -- Select the raster which maps to the given raster pixel, + * and transform the coordinates back to the source raster. The raster number + * and the raster coordinates of the source raster are returned. If no raster + * maps to the given pixel, raster=src and source raster coordinates are + * returned. + * + * The raster pixel coordinate system is best explained by an example. + * Suppose we have a 10x10 raster mapped into a 500x500 window. The + * window pixel 0 on an axis has raster pixel coordinate 0.0; pixel 500 + * (which is outside the window) has raster pixel coordinate 10.0. The + * coordinates correspond to the edge of the pixel as displayed in the + * window, i.e., the left edge of the (nonflipped) window is at x=0.0, and + * the right edge at x=10.0. Due to the pixelization of the screen, the + * maximum value is a limit which is only approached as the magnification + * increases. + * + * The client application may have a different coordinate system than the + * above. For example, if the client wants an integer pixel value to be + * at the center of a pixel, the first pixel has the coordinate [1,1], and + * the raster is 10 pixels wide, the client coordinate system would range + * from 0.5 to 10.5 at the edges of the NDC space. + */ +GtSelectRaster (w, dras, dt, dx, dy, rt, rx, ry, rmap) + GtermWidget w; + int dras; /* display raster */ + int dt; /* coordinate type of input coords */ + int dx, dy; /* display raster coordinates */ + int rt; /* coordinate type for output */ + int *rx, *ry; /* raster coordinates (output) */ + int *rmap; /* mapping selected */ +{ + register Mapping mp; + float x, y, x2, y2; + int raster, mapping; + + /* Get display raster pixel coordinates. */ + if (dt != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, 0, 0,0,0,0, + 0, dt, dx,dy,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + dx = p_mp.dx; + dy = p_mp.dy; + } + + /* Search for a mapping which maps to this pixel. The mapping we are + * looking for is the mapping closest to the tail of the mapping list + * (highest stacking order) which is defined and enabled and which + * includes the given display raster pixel in its destination rect. + */ + for (mp = w->gterm.mp_tail, mapping = -1; mp; mp = mp->prev) { + if (mp->defined && mp->enabled && mp->dst == dras) { + struct mapping *map, p_mp; + int dnx, dny; + + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + if ((dnx = map->dnx) < 0) + dnx = -dnx; + if ((dny = map->dny) < 0) + dny = -dny; + + /* Is display raster pixel in destination rect for this mapping? + */ + if (dnx > 0 && dx >= map->dx && dx < map->dx + dnx && + dny > 0 && dy >= map->dy && dy < map->dy + dny) { + + /* Compute offset into destination rect and apply axis flip + * if any from mapping. + */ + x = dx - map->dx + 0.5; + if (map->dnx < 0) + x = dnx - x; + y = dy - map->dy + 0.5; + if (map->dny < 0) + y = dny - y; + + /* Compute the source raster coordinates corresponding to + * the given display pixel. This is done in floating point + * to permit fractional pixel resolution if the mapping + * zooms the raster. + */ + x = x * (float)map->snx / (float)dnx + map->sx; + y = y * (float)map->sny / (float)dny + map->sy; + + mapping = map->mapping; + raster = map->src; + x2 = w->gterm.rasters[raster].width; + y2 = w->gterm.rasters[raster].height; + + break; + } + } + } + + /* Return display raster coordinates if no mapped raster was found. + */ + if (mapping < 0) { + x = dx; y = dy; + x2 = (int)w->core.width - 1; + y2 = (int)w->core.height - 1; + raster = dras; + } + + /* Output coordinates of the requested type. The increased resolution + * of NDC coordinates allows fractional pixel coordinates to be returned + * (e.g. 1/32 of a pixel for a 1K raster). + */ + if (rt == GtPixel) { + *rx = x; + *ry = y; + } else { + *rx = ( x) / x2 * MAXNDC; + *ry = (y2 - y) / y2 * MAXNDC; /* NDC is flipped in Y */ + } + + *rmap = mapping; + return (raster); +} + + +/* GtCopyRaster -- Copy a region of the source raster to a region of the + * destination raster. If the input and output regions are not the same + * size the subimage is automatically scaled to fit the destination region. + * If the destination extent DNX or DNY is negative, the image is flipped in + * that axis. The type of spatial scaling performed is determined by the + * scale factors (zoom, dezoom, or no scaling). The rasterop argument is + * used to exercise fine control over how the mapping is performed, e.g., to + * force a refresh, implement a transient mapping, or in the case of a dezoom + * (many-to-one) mapping, select the antialiasing technique to be used. + */ +GtCopyRaster (w, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for destination raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + Mapping sv_mp, p_mp; + int status; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Construct a temporary mapping describing the desired raster copy. */ + save_mapping (&sv_mp, w->gterm.maxMappings, 0, + src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + initialize_mapping (&p_mp); + get_pixel_mapping (w, &sv_mp, &p_mp, 1); + update_mapping (w, &p_mp); + + /* Refresh the destination pixels. */ + status = refresh_destination (w, &p_mp, dx, dy, abs(dnx), abs(dny)); + + /* Discard the temporary mapping. */ + free_mapping (w, &p_mp); + + return (status); +} + + +/* GtSetMapping -- Define a new mapping function, or modify an old one. + * If a new mapping is defined it is merely enabled, and no refreshing + * of the screen takes place until either some mapped data is written + * to or the mapping is explicitly refreshed. If an existing mapping is + * modified the old and new mappings are examined and only those portions + * of the destination rect for which the mapping changed are updated. + * This permits minor changes to a mapping (e.g. moving an edge) without + * having to redraw the entire region. Regions of the destination drawable + * which were previously covered by the mapping but which were exposed by + * modifying the mapping are redrawn. + */ +GtSetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for source raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + register int i, j; + register Mapping mp, o_mp, n_mp; + struct mapping pix_mp, new_mp; + int defined, scale_changed, offset, current, state, old_i; + int nx, xs[MAX_REGIONS], xe[MAX_REGIONS], xv[MAX_REGIONS]; + int ny, ys[MAX_REGIONS], ye[MAX_REGIONS], yv[MAX_REGIONS]; + int n_dnx, n_dny, n_xflip=0, n_yflip=0, i1, i2; + int o_dnx, o_dny, o_xflip=0, o_yflip=0; + int *o_xymap, *o_xmap, *o_ymap; + int *n_xymap, *n_xmap, *n_ymap; + XRectangle rl[MAX_REGIONS]; + int nrect, buflen, refresh; + + /* Check mapping number in range. */ + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (ERR); + else + mp = &w->gterm.mappings[mapping]; + + invalidate_draw_context (w); + initialize_mapping (&pix_mp); + initialize_mapping (&new_mp); + + /* Get local pixel space copy of old mapping, store new mapping. */ + get_pixel_mapping (w, mp, &pix_mp, 1); + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = snx; mp->sny = sny; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dnx; mp->dny = dny; + mp->rop = (rop & ~(R_RefreshNone|R_RefreshAll)); + mp->updated = 0; + + /* Newly defined mappings are linked at the tail of the mapping list, + * i.e. they stack (display) on top of any other mappings. If the + * mapping is already defined the stacking order is not changed. + */ + if (!(defined = mp->defined)) { + mp_linkafter (w, mp, w->gterm.mp_tail); + mp->defined = 1; + } + + if (!valid_mapping (w, mp)) { + mp_unlink (w, mp); + mp->defined = 0; + return (ERR); + } + update_mapping (w, mp); + + /* If we are defining a new mapping just define it and quit, without + * refreshing the window, unless R_RefreshAll is explicitly set in the + * mapping. If the mapping is not enabled merely store the new mapping. + * If the mapping is a null mapping (no pixels) do nothing. If refresh + * is disabled in the rasterop merely store the new mapping. If we are + * editing an existing mapping which is enabled with the default rasterop, + * we continue on to compare the old and new mappings and refresh any + * changed pixels in the destination rect. + */ + if (!defined || src != mp->src || dst != mp->dst) { + mp->enabled = mp->defined = 1; + mp->refresh = 0; + return; + } else if (!mp->enabled) { + return; + } else if (snx == 0 || sny == 0 || dnx == 0 || dny == 0) + return; + + if (rop & R_RefreshNone) + return; + + /* Convert input mappings to pixel coordinates, we deal with only pixel + * coordinates from here on. + */ + get_pixel_mapping (w, mp, &new_mp, 1); + load_mapping (&new_mp, &mapping, &rop, + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + update_mapping (w, n_mp = &new_mp); + update_mapping (w, o_mp = &pix_mp); + + /* + * We are editing an existing mapping. Determine what has changed in + * the mapping and refresh the changed regions. + */ + + /* Get old XY scaling maps. + */ + o_xmap = o_mp->x_srcpix; + o_ymap = o_mp->y_srcpix; + + if ((o_dnx = o_mp->dnx) < 0) { + o_dnx = -o_dnx; + o_xflip = 1; + } + if ((o_dny = o_mp->dny) < 0) { + o_dny = -o_dny; + o_yflip = 1; + } + + /* Get new XY scaling maps. + */ + n_xmap = n_mp->x_srcpix; + n_ymap = n_mp->y_srcpix; + + if (dnx < 0) { + dnx = -dnx; + n_xflip = 1; + } + if (dny < 0) { + dny = -dny; + n_yflip = 1; + } + + /* Refresh the entire region if the refresh flag is set, a flip has + * occurred, or we are doing a complex dezoom mapping. + */ + refresh = (o_mp->refresh || (rop & R_RefreshAll)); + if (n_xflip != o_xflip || n_yflip != o_yflip) + refresh = 1; + if (n_mp->scaling == M_DEZOOM) + refresh = 1; + + /* Has the spatial scale changed? */ + scale_changed = + abs (o_mp->xscale - n_mp->xscale) > 1.0E-4 || + abs (o_mp->yscale - n_mp->yscale) > 1.0E-4; + + /* If any of the above conditions are true refresh the entire mapping, + * otherwise compare the old and new mappings and refresh any subregions + * which have changed. + */ + if (refresh || scale_changed || n_mp->scaling == M_DEZOOM) { + refresh_destination (w, n_mp, dx, dy, dnx, dny); + + } else { + /* Compare the old and new mappings to see what needs to be + * refreshed. For speed reasons we only want to refresh the pixels + * which have been remapped. Any destination pixel in the new mapping + * which does not map to the same source pixel as in the old mapping + * must be refreshed. We examine each X and Y coordinate in the new + * destination rect and see if the source coordinate this maps to is + * the same as in the old mapping. If a given destination pixel [i,j] + * maps to the same pixel [i,j] in the source as it did in the + * previous mapping, we do not need to refresh that pixel. We examine + * the X and Y axis in turn and build up a list of regions which do or + * do not need to be refreshed. + */ + + /* Get a list of ranges {XS,XE,XV} in X. */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + dx, dnx, n_xmap, o_mp->dx, o_dnx, o_xmap); + + /* Get a list of ranges {YS,YE,YV} in Y. */ + ny = get_regions (ys,ye,yv, MAX_REGIONS, + dy, dny, n_ymap, o_mp->dy, o_dny, o_ymap); + + /* The list of ranges in X and Y together define a raster of arbitary + * sized subrectangles filling the destination rect. If the state + * value is nonzero (bit 1 set) in either X or Y, the subrectangle + * must be refreshed. The get_rects routine returns a list of the + * rectangular subregions matching the given condition (bit 1 set in + * either axis). Adjacent rectangles are merged to minimize the + * number of calls to refresh_destination. + */ + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 1,1); + for (i=0; i < nrect; i++) + refresh_destination (w, n_mp, + rl[i].x, rl[i].y, rl[i].width, rl[i].height); + } + + /* Refresh any lower level mappings exposed when the current mapping was + * modified. These will be regions of the old rect not present in the + * new, modified rect for the current mapping. + */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + o_mp->dx, o_dnx, o_xmap, dx, dnx, n_xmap); + ny = get_regions (ys,ye,yv, MAX_REGIONS, + o_mp->dy, o_dny, o_ymap, dy, dny, n_ymap); + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 2,2); + + for (i=0; i < nrect; i++) { + XRectangle r, in; + Mapping mp; + + /* Clear the uncovered region. */ + GtSetPixels (w, dst, GtPixel, rl[i].x, rl[i].y, rl[i].width, + rl[i].height, GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (mp = w->gterm.mp_head; mp && mp->mapping != mapping; + mp = mp->next) { + + if (mp->enabled && mp->dst == dst) { + r.x = mp->dx; + r.y = mp->dy; + r.width = mp->dnx; + r.height = mp->dny; + + if (rect_intersect (&in, &r, &rl[i])) + refresh_destination (w, mp, + in.x, in.y, in.width, in.height); + } + } + } + + free_mapping (w, n_mp); + free_mapping (w, o_mp); + mp = &w->gterm.mappings[mapping]; + mp->refresh = 0; +} + + +/* GtGetMapping -- Return the external parameters of a mapping. If the + * numberd mapping is undefined -1 is returned; 0 is returned if the + * mapping is defined but not enabled, and 1 is returned if the mapping + * is active. + */ +GtGetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int *rop; /* rasterop */ + int *src; /* 0=window, >0 = raster number */ + int *st; /* coordinate type for source raster */ + int *sx,*sy,*snx,*sny; /* source raster */ + int *dst; /* 0=window, >0 = raster number */ + int *dt; /* coordinate type for source raster */ + int *dx,*dy,*dnx,*dny; /* destination raster */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (-1); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (-1); + + *rop = mp->rop; + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *snx = mp->snx; *sny = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dnx = mp->dnx; *dny = mp->dny; + + return (mp->enabled != 0); +} + + +/* GtActiveMapping -- Query whether a mapping is active. + */ +GtActiveMapping (w, mapping) + register GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (0); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (0); + + return (mp->enabled != 0); +} + + +/* GtEnableMapping -- Enable a mapping. Enabling a mapping does not + * update the destination unless the refresh flag is set. Enabling a + * mapping activates the mapping so that any changes to the source will + * be mapped to the destination. + */ +GtEnableMapping (w, mapping, refresh) + GtermWidget w; + int mapping; /* mapping number */ + int refresh; /* refresh destination */ +{ + register Mapping mp; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (!mp->enabled) { + mp->enabled = True; + if (refresh) + GtRefreshMapping (w, mapping); + } + return (OK); + } + } + return (ERR); +} + + +/* GtDisableMapping -- Disable a mapping. Disabling a mapping does not + * affect the mapping definition, hence a disabled mapping may later be + * reenabled. If the ERASE flag is set the destination region is redrawn + * with the mapping disabled. + */ +GtDisableMapping (w, mapping, erase) + GtermWidget w; + int mapping; /* mapping number */ + int erase; /* erase the destination */ +{ + register int i; + register Mapping mp, dmp; + XRectangle r, d, in; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->enabled) { + mp->enabled = False; + + if (erase) { + d.x = mp->dx; + d.y = mp->dy; + d.width = abs(mp->dnx); + d.height = abs(mp->dny); + + /* Clear the uncovered region. */ + GtSetPixels (w, mp->dst, GtPixel, + d.x, d.y, d.width, d.height, + GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (dmp = w->gterm.mp_head; + dmp && dmp->mapping != mapping; dmp = dmp->next) { + + if (dmp->enabled && dmp->dst == mp->dst) { + r.x = dmp->dx; + r.y = dmp->dy; + r.width = dmp->dnx; + r.height = dmp->dny; + + if (rect_intersect (&in, &r, &d)) + refresh_destination (w, dmp, + in.x, in.y, in.width, in.height); + } + } + } + } + return (OK); + } + } + + return (ERR); +} + + +/* GtRefreshMapping -- Refresh the destination region defined by a mapping. + */ +GtRefreshMapping (w, mapping) + GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + struct mapping p_mp; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->st != GtPixel || mp->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 1); + update_mapping (w, mp = &p_mp); + } else + update_mapping (w, mp); + refresh_destination (w, mp, + mp->dx, mp->dy, abs(mp->dnx), abs(mp->dny)); + if (mp == &p_mp) + free_mapping (w, mp); + } + } +} + + +/* GtMapVector -- Map a point vector from the coordinate system of one raster + * to another as defined by the given mapping. The mapping may be either in + * the forward direction (dir = GtMap) or the reverse (dir = GtUnmap). The + * point vector is maintained in floating point for this operation to avoid + * loss of precision. The input and output vectors may be the same vector. + */ +GtMapVector (w, mapping, dir, pv1, pv2, npts) + GtermWidget w; + int mapping; + int dir; /* GtMap, GtUnmap */ + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register DPoint *ip = pv1; + register DPoint *op = pv2; + register Mapping mp; + register int n; + + struct mapping p_mp; + double xscale, xoffset; + double yscale, yoffset; + int sx, sy; + + xscale = yscale = 1.0; + xoffset = yoffset = 0.0; + sx = sy = 0; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (valid_mapping (w, mp)) { + /* Determine the transformation coefficients. */ + get_pixel_mapping (w, mp, &p_mp, 0); + mp = &p_mp; + + xscale = (float)mp->dnx / (float)mp->snx; + if (xscale < 0) + xoffset = mp->dx + abs(mp->dnx) - 1; + else + xoffset = mp->dx; + + yscale = (float)mp->dny / (float)mp->sny; + if (yscale < 0) + yoffset = mp->dy + abs(mp->dny) - 1; + else + yoffset = mp->dy; + + sx = mp->sx; + sy = mp->sy; + } + } + + /* Map the vector. */ + if (dir == GtMap) { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - sx) * xscale + xoffset; + op->y = (ip->y - sy) * yscale + yoffset; + } + } else { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - xoffset) / xscale + sx; + op->y = (ip->y - yoffset) / yscale + sy; + } + } +} + + +/* GtPixelToNDC -- Transform a vector from pixel to NDC coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtPixelToNDC (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ( ip->x) / rp->width * MAXNDC; + op->y = (rp->height - ip->y) / rp->height * MAXNDC; + } +} + + +/* GtNDCToPixel -- Transform a vector from NDC to pixel coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtNDCToPixel (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x / MAXNDC * rp->width; + op->y = rp->height - (ip->y / MAXNDC * rp->height); + } +} + + +/* GtDebug -- Print debug info. If the file descriptor is NULL output is + * to the process stdout. The "what" argument may be used to select the + * type of output desired. If what=0 the full output is generated, + * otherwise bits are used to select what output is to be generated. + * + * "what" bitflags: + * + * 001 Widget information + * 002 List rasters + * 004 List mappings + * 010 List colormaps + * 020 List markers + * + * This routine is intended only for use during debugging. + */ +GtDebug (w, fp, what) + GtermWidget w; + FILE *fp; + int what; +{ + /* Default is to write everything to the stdout. */ + what = what ? what : 0777; + fp = fp ? fp : stdout; + + /* Print widget header. */ + if (what & 001) { + fprintf (fp, "Widget 0x%x (%s) %dx%d raster=%d\n", + w, w->core.name, w->core.width, w->core.height, w->gterm.raster); + fprintf (fp, + "--------------------------------------------------------------\n"); + } + + /* Print raster information. */ + if (what & 002) { + register int i; + register Raster rp; + + if (w->gterm.rasters) { + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) + continue; + fprintf (fp, "raster %4d type=%s delete=%d size=%dx%d\n", + i, rp->type == ImageRaster ? "client" : "server", + rp->delete, rp->width, rp->height); + } + } else + fprintf (fp, "no rasters\n"); + } + + /* Print mapping information. */ + if (what & 004) { + register int i; + register Mapping mp; + char flags[32]; + + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + continue; + + flags[0] = mp->enabled ? 'E' : 'D'; + flags[1] = mp->updated ? 'U' : ' '; + flags[2] = mp->refresh ? 'R' : ' '; + flags[3] = '\0'; + + fprintf (fp, "mapping %3d %s %8o", i, flags, mp->rop); + fprintf (fp, " %2d %s %3d %3d %3d %3d", + mp->src, mp->st == GtPixel ? "pix" : "ndc", + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (fp, " %2d %s %3d %3d %3d %3d\n", + mp->dst, mp->dt == GtPixel ? "pix" : "ndc", + mp->dx, mp->dy, mp->dnx, mp->dny); + } + } else + fprintf (fp, "no mappings\n"); + + fprintf (fp, "mappings from head: "); + for (mp = w->gterm.mp_head; mp; mp = mp->next) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + + fprintf (fp, "mappings from tail: "); + for (mp = w->gterm.mp_tail; mp; mp = mp->prev) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + } + + /* Print colormap information. */ + if (what & 010) { + register struct colormap *cm; + + fprintf (fp, "cmapName=%s ncolors=%d basePixel=%d\n", + w->gterm.cmapName, w->gterm.ncolors, w->gterm.base_pixel); + for (cm = w->gterm.colormaps; cm; cm = cm->next) + fprintf (fp, "colormap %2d ncells=%d\n", cm->map, cm->ncells); + } + + /* Print marker information. */ + if (what & 020) { + register Marker mm; + char value[256]; + + for (mm = w->gterm.gm_head; mm; mm = mm->next) { + GmGetAttribute (mm, GmType, (XtArgVal)value, XtRString); + fprintf (fp, "marker 0x%x: %10s flags=0x%x [%d %d %d %d] %0.5g\n", + mm, value, mm->flags, mm->x, mm->y, mm->width, mm->height, + mm->rotangle); + } + } +} + + +/* + * Internal procedures for the above code. + * ---------------------------------------- + */ + +/* get_colormap -- Get a private colormap. On all calls after the first + * this just returns the existing gterm widget colormap. On the first call + * we query the server for the named custom colormap, and if the colormap + * exists we modify the gterm widget to use it. If the custom colormap has + * not yet been created by some other client, we create it. + * + * This code creates a custom colormap using the "standard colormap" + * facilities provided by XLIB. Although we do not use any of the predefined + * standard colormaps, use of the standard colormap facilities allows any + * number of clients to share the same custom colormap. Use of a custom + * colormap helps avoid running out of space in the default colormap, ensures + * that the gterm widget will get the color cells it needs, and makes it + * easier for several imaging clients which share the same colormap to + * simultaneously display their windows. + * + * To minimize colormap flashing we try to avoid using the full colormap, + * setting the unused cells to the colors set in the default colormap. In + * most cases this will prevent the rest of the screen from changing color + * when the custom colormap is installed. + */ +static Colormap +get_colormap (w) + GtermWidget w; +{ + register int i, j; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + XColor def_colors[SZ_STATIC_CMAP], *cp, *c1, *c2; + XStandardColormap cm, *cm_p; + XColor colors[MAX_SZCMAP]; + int base_pixel, p1, p2; + Colormap colormap; + char property[128]; + int ncmap, nitems; + Pixel pixel; + Atom atom; + + if (w->gterm.haveColormap) + return (w->core.colormap); + + /* Map custom colormap name to atom. */ + sprintf (property, "GT_%s", w->gterm.cmapName); + atom = XInternAtom (display, property, False); + w->gterm.cmapAtom = atom; + + /* Get custom colormap. + */ + if (!w->gterm.cmapInitialize && + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom)) { + + /* Colormap aleady exists, just use it. + */ + cm = *cm_p; + colormap = cm.colormap; + w->gterm.base_pixel = cm.base_pixel; + + } else { + /* Create or reinitialize a global colormap. + */ + XVisualInfo template, *vi; + Display *d; + Screen *s; + Window root; + long mask; + + if (!(d = XOpenDisplay (DisplayString(display)))) + goto use_default; + s = DefaultScreenOfDisplay (d); + root = DefaultRootWindow (d); + + /* Try to get a pseudocolor visual. */ + mask = 0; + template.screen = DefaultScreen(d); mask |= VisualScreenMask; + template.depth = RasterDepth; mask |= VisualDepthMask; + template.class = PseudoColor; mask |= VisualClassMask; + + if (!(vi = XGetVisualInfo (d, mask, &template, &nitems))) { + XCloseDisplay (d); + goto use_default; + } + + /* Create custom colormap with all cells allocated read/write */ + colormap = XCreateColormap (d, root, vi->visual, AllocAll); + + /* Initialize colormap to be same as default colormap. */ + nitems = min (MAX_SZCMAP, CellsOfScreen(s)); + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (d, DefaultColormapOfScreen(s), colors, nitems); + XStoreColors (d, colormap, colors, nitems); + + /* Globally define permanent server custom colormap. */ + memset ((char *)&cm, 0, sizeof(cm)); + cm.colormap = colormap; + cm.base_pixel = w->gterm.base_pixel; + cm.red_max = 0; + cm.visualid = vi->visualid; + cm.killid = 1; + XSetRGBColormaps (d, root, &cm, 1, atom); + + XSetCloseDownMode (d, RetainPermanent); + XCloseDisplay (d); + w->gterm.cmapInitialize = False; + } + + /* Save default color assignments for static colors. */ + for (i=0; i < SZ_STATIC_CMAP; i++) + def_colors[i] = w->gterm.color[i]; + + nitems = min (MAX_SZCMAP, CellsOfScreen(screen)); + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + base_pixel = w->gterm.base_pixel; + + /* Get the private colormap. */ + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (display, colormap, colors, nitems); + + /* Initialize the raster pixel to display pixel mapping and set the + * color assigned to each pixel value in the private colormap. + */ + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, base_pixel + i - SZ_STATIC_CMAP); + w->gterm.color[i] = colors[pixel]; + } + + /* Check the static part of the cmap to make sure that the pixel numbers + * aren't aliased to pixels in the dynamic part of the custom colormap. + * If this happens, reassign these color numbers to the pixels just + * preceeding the dynamic part of the custom colormap. The red_max + * field of the colormap descriptor is used to keep track of the number + * of static colors allocated by different clients. These static colors + * are shared, hence the same color will not be stored twice. + */ + p1 = p2 = base_pixel - cm.red_max; + for (i=0; i < SZ_STATIC_CMAP; i++) { + pixel = w->gterm.cmap[i]; + if (pixel >= base_pixel && pixel < base_pixel+DEF_MAXCOLORS && p1 > 2) { + /* First check to see if we already have a static entry reserved + * for this color. + */ + c1 = &def_colors[i]; + for (j=p1, cp=NULL; j < base_pixel; j++) { + c2 = &colors[j]; + if (c1->red == c2->red && c1->green == c2->green && + c1->blue == c2->blue) { + cp = c2; + break; + } + } + + /* Assign a new screen pixel value. */ + if (cp) + w->gterm.cmap[i] = cp->pixel; + else { + cp = &colors[--p1]; + *cp = def_colors[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = w->gterm.cmap[i] = p1; + cm.red_max++; + } + w->gterm.color[i].pixel = w->gterm.cmap[i]; + } + } + if (p1 < p2) { + XStoreColors (display, colormap, &colors[p1], p2 - p1); + XSetRGBColormaps (display, w->gterm.root, &cm, 1, atom); + } + + /* Assign the new colormap to the gterm widget's window. */ + XtVaSetValues ((Widget)w, XtNcolormap, (XtArgVal)colormap, NULL); + w->gterm.haveColormap++; + + /* If the pointer is in the window, advise window manager to load the + * colortable for the window. + */ + if (w->gterm.in_window) + request_colormap_focus (w); + + return (colormap); + +use_default: + /* Unable to create custom colormap. */ + w->gterm.useDefaultCM++; + w->gterm.haveColormap++; + return (w->core.colormap); +} + + +/* request_colormap_focus -- Modify the WM_COLORMAP_WINDOWS property on a + * widget's top level shell window to advise the window manager that the + * widget's window should have its colormap loaded. This should only be + * used for windows that have a colormap different than that of the top + * level window. + */ +static +request_colormap_focus (w) + GtermWidget w; +{ + Widget p; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Find the top level window. */ + for (p = XtParent(w); !XtIsShell(p); p = XtParent(p)) + ; + + /* Modify WM_COLORMAP_WINDOWS to give the current window priority. + */ + if (p) { + Window window = XtWindow (p); + Window *wl = NULL, n_wl[MAX_WMWIN+1]; + register int n_nw, i; + int nw; + + /* If WM_COLORMAP_WINDOWS is already set save its value, otherwise + * start a list initially containing only the top level window. + */ + w->gterm.wmTop = window; + if (XGetWMColormapWindows (w->gterm.display, window, &wl, &nw)) { + memmove (w->gterm.wmWindows, (char *)wl, nw * sizeof(int)); + w->gterm.n_wmWindows = nw = min (nw, MAX_WMWIN); + free ((char *)wl); + } else { + w->gterm.wmWindows[0] = window; + w->gterm.n_wmWindows = nw = 1; + } + + n_nw = 0; + wl = w->gterm.wmWindows; + n_wl[n_nw++] = XtWindow(w); + + for (i=0; i < nw; i++) + if (wl[i] != XtWindow(w)) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, window, n_wl, n_nw); + } +} + + +/* restore_colormap_focus -- Reset WM_COLORMAP_WINDOWS. Retain the window + * that had the focus in the list, but drop its priority one notch. This + * should follow a prior call to request_colormap_focus. + */ +static +restore_colormap_focus (w) + GtermWidget w; +{ + register int nw, n_nw, i; + Window *wl, n_wl[MAX_WMWIN+1], old; + + if (!XtIsRealized ((Widget)w)) + return; + + old = XtWindow(w); + wl = w->gterm.wmWindows; + if ((nw = w->gterm.n_wmWindows) == 0 || (nw == 1 && wl[0] == old)) + return; + + n_nw = 0; + if (wl[0] != old) + n_wl[n_nw++] = wl[0]; + n_wl[n_nw++] = old; + + for (i=1; i < nw; i++) + if (wl[i] != old) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, w->gterm.wmTop, n_wl, n_nw); +} + + +/* inherit_default_colormap -- Set any unused cells of the custom colormap + * to the colors defined for the corresponding cells of the default colormap. + * This minimizes colormap flashing when using a custom colormap, but only + * works if a few unused cells can be reserved, e.g., at the beginning of + * the colormap (which is usually where X allocates its colors). + */ +static +inherit_default_colormap (w) + GtermWidget w; +{ + register XColor *cp, *ap; + register int ncolors, i; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + Window root = w->gterm.root; + Atom atom = w->gterm.cmapAtom; + XColor colors[MAX_SZCMAP]; + XStandardColormap *cm; + int first, nitems, ncmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.base_pixel <= 0) + return; /* fully allocated colormap */ + + /* We have to read the colormap property again as another client could + * have reserved more static colors (i.e.,changed red_max), and we don't + * want to clobber these colors. + */ + if (XGetRGBColormaps (display, root, &cm, &ncmap, atom)) { + /* Make sure we have the right colormap. */ + if (w->core.colormap != cm->colormap) + XtVaSetValues ((Widget)w,XtNcolormap,(XtArgVal)cm->colormap,NULL); + + /* Get lower part of default colormap. */ + ncolors = cm->base_pixel - cm->red_max; + for (cp=colors, i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = i; + } + + /* Get upper part of default colormap. */ + first = cm->base_pixel + w->gterm.ncolors - SZ_STATIC_CMAP; + ncolors = min (MAX_SZCMAP, CellsOfScreen(screen)) - first; + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = first + i; + } + + /* Inherit values from default colormap. */ + ncolors = cp - colors; + XQueryColors (display, DefaultColormapOfScreen(screen), + colors, ncolors); + XStoreColors (display, w->core.colormap, colors, ncolors); + + /* The global gterm colormap may have changed. Compare widget's + * version of color table with the global colortable and update + * the widget's state if the global colortable has changed. + */ + ncolors = w->gterm.ncolors; + memmove (colors, w->gterm.color, ncolors * sizeof(*cp)); + XQueryColors (display, w->core.colormap, colors, ncolors); + for (i=ncolors, cp=colors, ap=w->gterm.color; --i >= 0; cp++, ap++) + if (cp->red != ap->red || cp->green != ap->green || + cp->blue != ap->blue) { + memmove (w->gterm.color, colors, ncolors * sizeof(*cp)); + invalidate_cmap (w); + } + } +} + + +/* update_default_colormap -- Update the default colormap so that any + * unallocated cells mirror the widget's custom colormap. This increases + * the chance that the widget's contents will be visible when the window + * does not have the colormap focus, and minimizes flashing when the + * colormap focus changes. + */ +static +update_default_colormap (w) + GtermWidget w; +{ + register XColor *ip, *op; + register int j, n; + register Pixel v; + + XColor colors[MAX_SZCMAP]; + Pixel pixels[MAX_SZCMAP]; + char allocated[MAX_SZCMAP]; + int overflow, req, need, first, nelem, i; + unsigned long plane_masks[1]; + Colormap defcmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + + first = SZ_STATIC_CMAP; + nelem = w->gterm.ncolors; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + /* need = min (MAX_SZCMAP, first + nelem - SZ_STATIC_CMAP); */ + need = MAX_SZCMAP; + + /* Get the colormap cells. */ + for (req=need, n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, defcmap, False, + plane_masks, 0, &pixels[n], req)) { + n += req; + } else + req /= 2; + + /* Perform the color matching. This is awkward as the pixel value + * assignments may be different in the two colormaps. We have to look + * up each pixel before attempting to assign a color, or XStoreColors + * below will result in a server error. + */ + memset (allocated, 0, sizeof(allocated)); + overflow = 0; + + for (i=0; i < n; i++) { + v = pixels[i]; + if (v < MAX_SZCMAP) + allocated[v] = 1; + else { + overflow++; + break; + } + } + + ip = &w->gterm.color[first]; + op = colors; + if (overflow) { + for (i=0; i < nelem; i++, ip++) + for (j=0, v = ip->pixel; j < n; j++) + if (pixels[j] == v) { + *op++ = *ip; + break; + } + } else { + for (j=0; j < nelem; j++, ip++) + if (allocated[ip->pixel]) { + allocated[ip->pixel] = 0; + *op++ = *ip; + } + } + + if (op > colors) + XStoreColors (w->gterm.display, defcmap, + colors, op - colors); + + XFreeColors (w->gterm.display, defcmap, pixels, n, 0); +} + + +/* refresh_source -- Refresh a portion of a mapping given the source rect + * to be refreshed. If the given source rect is not within the mapping, + * this is a no-op. + */ +static +refresh_source (w, mp, x1, y1, nx, ny) + GtermWidget w; + register Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of source to be refreshed */ +{ + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Compute the intersection of the modified region of the source raster + * with the rectangular region of the source raster affected by the given + * mapping. + */ + sx1 = max (x1, mp->sx); + sy1 = max (y1, mp->sy); + sx2 = min(x1 + nx, mp->sx + mp->snx) - 1; + sy2 = min(y1 + ny, mp->sy + mp->sny) - 1; + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + /* Do nothing if the rectangles do not intersect. */ + if (snx <= 0 || sny <= 0) + return (OK); + + /* Compute the destination rect affected by the mapped source rect. + */ + dx1 = mp->x_extent[sx1 - mp->sx].lo; + dx2 = mp->x_extent[sx2 - mp->sx].hi; + if (dx1 > dx2) { + dx1 = mp->x_extent[sx2 - mp->sx].lo; + dx2 = mp->x_extent[sx1 - mp->sx].hi; + } + + dy1 = mp->y_extent[sy1 - mp->sy].lo; + dy2 = mp->y_extent[sy2 - mp->sy].hi; + if (dy1 > dy2) { + dy1 = mp->y_extent[sy2 - mp->sy].lo; + dy2 = mp->y_extent[sy1 - mp->sy].hi; + } + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + /* Perform the refresh operation. */ + return (refresh_destination (w, mp, dx1, dy1, dnx, dny)); +} + + +/* refresh_destination -- Refresh (redraw) the pixels in the given destination + * rect. The mapping operand defines how to generate the value of each output + * pixel. This is the routine which does all the real work of a mapping, + * computing the values of the output pixels and writing to the destination + * drawable. Note: the destination rect must be specified in raster pixel + * coordinates (no NDC). + */ +static +refresh_destination (w, mp, x1, y1, nx, ny) + GtermWidget w; + Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of destination to be refreshed */ +{ + Raster sr, dr; + Display *display = w->gterm.display; + int scaling, xflip, yflip, delxin=0, delxout=0; + int ox, oy, rop, clip, mapping, i, j; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int xoff, yoff, p1, p2, q1, q2; + float xscale, yscale; + struct mapping *np, p_mp; + XImage *xin, *xout; + int status = OK; + + Region clip_region, mask_region; + uchar *old_xin_lp, *old_xout_lp; + uchar *xin_lp, *xout_lp, *op; + int xin_bpl, xout_bpl; + int *xmap, *ymap; + XRectangle r; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Offsets into the x_*,y_* mapping lookup tables. */ + xoff = x1 - mp->dx; + yoff = y1 - mp->dy; + + /* Get source and destination rects. */ + dst = mp->dst; + dx = x1; dy = y1; + dnx = nx; dny = ny; + + src = mp->src; + p1 = mp->x_srcpix[xoff]; + q1 = mp->y_srcpix[yoff]; + p2 = mp->x_srcpix[xoff + nx - 1]; + q2 = mp->y_srcpix[yoff + ny - 1]; + sx = min (p1, p2); + sy = min (q1, q2); + snx = abs (p2 - p1) + 1; + sny = abs (q2 - q1) + 1; + + /* Define some local variables. */ + sr = &w->gterm.rasters[src]; + dr = &w->gterm.rasters[dst]; + mapping = mp->mapping; + scaling = mp->scaling; + xscale = mp->xscale; + yscale = mp->yscale; + rop = mp->rop; + + if (!sr->type || !dr->type) + return (ERR); + if (snx <= 0 || sny <= 0 || dnx == 0 || dny == 0) + return (ERR); + if (src < 0 || src > w->gterm.maxRasters || + dst < 0 || dst > w->gterm.maxRasters) + return (ERR); + + /* Do we have a flip in X or Y? */ + xflip = mp->dnx < 0; + yflip = mp->dny < 0; + + /* Any higher numbered mappings which map to the same destination as the + * mapping MP will obscure the current mapping. Construct a clip mask + * defining the region of the destination we can write to. This will be + * the region not obscured by any higher numbered, active mappings. + */ + clip = False; + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; +#ifdef sun + /* As far as I can tell the Sun (probably in the OW X server) has an + * off by one bug affecting clipping in the server. A clip region is + * too small by one pixel at the right and bottom, causing these pixels + * to not be written when refreshing the screen (usually this shows up + * as black lines on the screen when a region is refreshed). So far + * I haven't seen this on any other platform. The problem is imperfectly + * understood and the following workaround may not completely workaround + * the problem. + */ + r.width++; r.height++; +#endif + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + + if (XRectInRegion (clip_region, + r.x, r.y, r.width, r.height) != RectangleOut) { + + mask_region = XCreateRegion(); + XUnionRectWithRegion (&r, mask_region, mask_region); + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + clip++; + } + } + + if (clip && dr->type == PixmapRaster) + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + + /* Handle the special case of a pixmap to pixmap (or window) copy in + * the server with no scaling. + */ + if (!scaling && sr->type == PixmapRaster && dr->type == PixmapRaster) { + if (src == 0 && dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XCopyArea (display, w->gterm.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XCopyArea (display, sr->r.pixmap, dr->r.pixmap, w->gterm.exposeGC, + sx, sy, snx, sny, dx, dy); + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) + XCopyArea (display, sr->r.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + } + goto done; + } + + /* Any other case requires working on ximages in the client. The first + * step is to get the source ximage. + */ + if (sr->type == PixmapRaster) { + /* Source is a pixmap but we need a local copy as either the + * destination is not a pixmap, or we need to do some scaling. + */ + xin = XGetImage (display, + (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } + delxin++; + + } else { + /* Source is an ximage. */ + xin = sr->r.ximage; + } + + /* Handle the special case of a copy of an ximage to an output pixmap + * with no scaling. + */ + if (!scaling && dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + } + goto done; + } + + /* Get output ximage. */ + if (dr->type == ImageRaster) { + xout = dr->r.ximage; + ox = dx; oy = dy; + } else { + uchar *data = (uchar *) XtMalloc (dnx * dny); + if (data == NULL) { + status = ERR; + goto done; + } + xout = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, dnx, dny, 8, 0); + if (xout == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + ox = 0; oy = 0; + delxout++; + } + + xin_lp = (uchar *)xin->data; + xout_lp = (uchar *)xout->data; + xin_bpl = xin->bytes_per_line; + xout_bpl = xout->bytes_per_line; + + /* Map a region of the input ximage XIN to the output ximage XOUT. Various + * approaches are used to generate the output data, depending upon what + * type of scaling we are doing. + */ + if (!scaling) { + /* No scaling. Copy a region of the ximage xin to xout without + * spatially scaling the image data. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + xin_lp = (uchar *)xin->data + sy * xin_bpl; + xout_lp = (uchar *)xout->data + oy * xout_bpl + ox; + + for (j=0; j < dny; j++) { + memmove (xout_lp, xin_lp, dnx); + xin_lp += xin_bpl; + xout_lp += xout_bpl; + } + + } else if (scaling == M_INTZOOM) { + /* Integer zoom. The zoom factor is an integer, allowing the zoomed + * image to be calculated without using the xmap,ymap lookup tables. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + scale_intzoom (xin_lp,xin_bpl, xout_lp,xout_bpl, sx,sy, ox,oy,dnx,dny, + xflip,yflip, (int)(xscale + 0.5), (int)(yscale + 0.5)); + + } else if (scaling == M_ZOOM) { + /* We have a zoom, or one-to-many, scaling. Zoom scaling is always + * done with pixel replication. The [xy]_srcpix arrays in the mapping + * descriptor give the source pixel corresponding to each mapped pixel + * in the destination raster. + */ +zoom: + xmap = &mp->x_srcpix[xoff]; + ymap = &mp->y_srcpix[yoff]; + + scale_zoom (xin_lp, xin_bpl, xout_lp, xout_bpl, + xmap, ymap, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL); + + } else if (scaling == M_DEZOOM) { + /* We have a dezoom, or many-to-one, scaling. A block of pixels in + * the input raster are combined to generate the value of each output + * pixel, using one of several antialias algorithms to compute the + * output pixel value. + */ + float *x_src = &mp->x_src[xoff]; + float *y_src = &mp->y_src[yoff]; + int near_unitary = (xscale > 0.5 && yscale > 0.5); + int function; + + /* Get the antialising function to be applied. */ + if (!(function = (mp->rop & R_MFMask))) + function = MF_NEAREST; + + /* If the dezoom factor is small and either MF_BILINEAR or + * MF_NEAREST is enabled, use the indicated method to sample the + * input data. This uses all the data but minimizes smoothing. + */ + if ((function & (MF_BILINEAR|MF_NEAREST)) && near_unitary) + function = (function & MF_BILINEAR) ? MF_BILINEAR : MF_NEAREST; + else if (function != (function & (MF_BILINEAR|MF_NEAREST))) + function &= ~(MF_BILINEAR|MF_NEAREST); + +filter: + /* This can take a while so update the display. */ + XFlush (w->gterm.display); + + /* If the filtering operation involves any arithmetic combinations + * of pixels we must convert pixel numbers to pixel intensity values + * before performing the filtering operation. This is a case where + * we would be better off if frame buffers were maintained using + * pixel intensities rather than hardware pixel numbers. + */ + if (function != MF_NEAREST) { + uchar *data = (uchar *) XtMalloc (xin->width * xin->height); + if (data == NULL) { + status = ERR; + goto done; + } + + mf_getinten (w, + xin_lp, xin->width, xin->height, xin_bpl, sx,sy, + data, xin->width, xin->height, xin_bpl, sx,sy, snx,sny); + + if (!delxin) { + xin = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, xin->width, xin->height, 8, 0); + if (xin == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + delxin++; + } else { + XtFree ((char *)xin->data); + xin->data = (char *) data; + } + xin_lp = (uchar *)xin->data; + } + + /* Filter the source rect to the destination. */ + switch (function) { + case MF_NEAREST: + scale_nearest ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BILINEAR: + scale_bilinear ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BLKAVG: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 0, clip ? clip_region : (Region)NULL + ); + break; + case MF_BOXCAR: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 1, clip ? clip_region : (Region)NULL + ); + break; + case MF_LOWPASS: + scale_lowpass ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, clip ? clip_region : (Region)NULL + ); + break; + default: + function = MF_BILINEAR; + goto filter; + } + + /* If the operation was performed in intensity space convert back + * to pixel number. + */ + if (function != MF_NEAREST) + mf_getpixel (w, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, dnx,dny); + + } else { + status = ERR; + goto done; + } + + /* Copy the scaled ximage to the output pixmap, if any. + */ + if (dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + } + } + +done: + /* Clean up. + */ + if (delxin) + XDestroyImage (xin); + if (delxout) + XDestroyImage (xout); + + XDestroyRegion (clip_region); + if (clip && dr->type == PixmapRaster) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + + /* Execute any mappings defined on the raster just updated. */ + if (status == OK) { + GtRefreshPixels (w, dst, GtPixel, dx, dy, dnx, dny); + + if (dst == 0) { + Region clip_region = (Region)NULL; + XRectangle r; + + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; + XUnionRectWithRegion (&r, clip_region, clip_region); + + update_transients (w, clip_region); + XDestroyRegion (clip_region); + } + } + + return (status); +} + + +/* scale_zoom -- Compute the given destination rect from the input image, + * using pixel replication and the given x and y dst->scr pixels maps. + */ +static +scale_zoom (idata,ibpl, odata,obpl, xmap,ymap, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + register int *xmap; /* src coords of each dst pixel */ + int *ymap; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i, j; + register uchar *ip, *op; + uchar *last_ip = NULL; + uchar *last_op = NULL; + + for (j=0; j < dny; j++) { + ip = idata + ymap[j] * ibpl; + op = odata + (j+dy) * obpl + dx; + + if (!clip_region) { + if (ip == last_ip) + memmove (op, last_op, dnx); + else { + for (i=0; i < dnx; i++) + op[i] = ip[xmap[i]]; + } + last_ip = ip; + last_op = op; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = ip[xmap[i]]; + } + } +} + + +/* scale_intzoom -- Compute the given destination rect from the input image, + * using pixel replication and integer scaling. This is functionally + * equivalent to scale_zoom using the lookup tables, but optimized for the + * case of integer scaling. + */ +static +scale_intzoom (idata,ibpl,odata,obpl, sx,sy,dx,dy,dnx,dny, xflip,yflip, nx,ny) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + int sx, sy; /* start coords of src rect */ + int dx, dy, dnx, dny; /* destination rect */ + int xflip, yflip; /* set if x or y is flipped */ + int nx, ny; /* replication factors */ +{ + register int n; + register int pix; + register uchar *ip, *op; + uchar *otop, *olast, *lp; + int i, j, k; + + olast = odata + (dy + dny) * obpl - dnx + dx; + + if (xflip) { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = odata + (dy + yflip ? (dny-ny-j) : j) * obpl + dx + dnx; + otop = lp = op - dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *--op = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op > otop) + *--op = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } else { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = lp = odata + (dy + yflip ? (dny-ny-j) : j) * obpl + dx; + otop = op + dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *op++ = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op < otop) + *op++ = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } +} + + +/* scale_nearest -- Compute the given destination rect from the input image, + * using the nearest neighbor technique. + */ +static +scale_nearest (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i, j; + register uchar *op; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = y_src[j]; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* scale_bilinear -- Compute the given destination rect from the input image, + * using bilinear interpolation. + */ +static +scale_bilinear (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = x_src[i] - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = y_src[j] - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* scale_lowpass -- Apply a lowpass filter to a region of a 2D data array. + * The region ox,oy,nx,ny of the output data array is calculated by running + * a convolution kernel over the region of the input data array at ix,iy. + * The size of the convolution kernel is adjusted to match the scale factors + * xscale, yscale. + */ +static +scale_lowpass (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + Region clip_region; /* clip Region or null */ +{ + uchar *data; + + if ((data = (uchar *) XtMalloc (inx * iny)) == NULL) + return; + + /* Run a lowpass filter over the input rect. */ + lw_convolve (idata,inx,iny,ibpl, sx,sy, data,inx,iny,ibpl, sx,sy, + snx,sny, xscale,yscale); + + /* Sample the filtered data to generate the output rect. */ + scale_nearest (data,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + dx,dy,dnx,dny, clip_region); + + XtFree ((char *)data); +} + + +/* lw_convolve -- Convolution primitive for scale_lowpass. + */ +static +lw_convolve (idata,inx,iny,ibpl,ix,iy, odata,onx,ony,obpl,ox,oy, + nx, ny, xscale, yscale) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ix, iy; /* size of input array, start pos */ + int onx, ony, ox, oy; /* size of output array, start pos */ + int ibpl, obpl; /* bytes per line */ + int nx, ny; /* size of output region */ + float xscale, yscale; /* determines amount of smoothing */ +{ + register uchar *ip; + register int l, m, x, hx, pixval; + int kx, ky, hy, i, j, y; + uchar *lp[11], *op; + + /* Determine kernel size (min 3x3, max 7x7). */ + if (xscale < 0.1) + hx = 3; + else if (xscale >= 0.5) + hx = 1; + else + hx = ((int)(1.0 / xscale)) / 2; + + if (yscale < 0.1) + hy = 3; + else if (yscale >= 0.5) + hy = 1; + else + hy = ((int)(1.0 / yscale)) / 2; + + kx = hx * 2 + 1; + ky = hy * 2 + 1; + + /* Compute the output data. + */ + for (j=0; j < ny; j++) { + /* Get line pointers. */ + op = odata + (j+oy) * obpl + ox; + for (i=0; i < ky; i++) { + y = iy + j - hy + i; + if (y < 0) + y = 0; + else if (y >= iny) + y = iny - 1; + lp[i] = y * ibpl + idata; + } + + /* Compute a line of output pixels */ + for (i=0; i < nx; i++) { + x = ix + i; + pixval = 0; + + if (x < hx) { + /* Near left edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][max(0,x-hx+l)]; + } else if (x >= inx - hx) { + /* Near right edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][min(inx-1,x-hx+l)]; + } else { + /* In central region. */ + for (m=0; m < ky; m++) { + ip = lp[m] + x - hx; + for (l=0; l < kx; l++) + pixval += ip[l]; + } + } + + op[i] = (float)pixval / (float)(kx * ky) + 0.5; + } + } +} + + +/* scale_boxcar -- Apply a boxcar filter to a region of a 2D data array + * and interpolate the result to the output grid. The region ox,oy,nx,ny of + * the output data array is calculated by block averaging the corresponding + * source rect and then sampling the reduced image using bilinear interpolation + * to compute the output pixel raster. This antialiasing technique aims to + * be as fast as possible but still does a reasonable job of reducing the + * image. + */ +static +scale_boxcar (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, interp, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + int interp; /* set if interpolation is desired */ + Region clip_region; /* clip Region or null */ +{ + int xblock, yblock; + int x1, x2, y1, y2, nx, ny; + float xstep, ystep; + int xoff, yoff; + uchar *bp; + + /* Determine blocking factors. If interpolation is disabled we need + * to block one step more than for the linear interpolate case in order + * to ensure that all the data is used. + */ + xblock = max(1, (int) (1.0 / xscale)); + if (!interp && (1.0 / xscale) - xblock > ZOOM_TOL) + xblock++; + yblock = max(1, (int) (1.0 / yscale)); + if (!interp && (1.0 / yscale) - yblock > ZOOM_TOL) + yblock++; + + /* Align the input region for the given blocking factors. */ + x1 = sx / xblock * xblock; x2 = (sx + snx - 1) / xblock * xblock; + y1 = sy / yblock * yblock; y2 = (sy + sny - 1) / yblock * yblock; + nx = (x2 - x1) / xblock + 1; ny = (y2 - y1) / yblock + 1; + + /* Compute the block averaged input rect. */ + if (xblock > 1 || yblock > 1) { + if ((bp = (uchar *) XtMalloc (nx * ny)) == NULL) + return; + bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, bp, xblock, yblock); + idata = bp; + inx = ibpl = nx; + iny = ny; + xoff = x1; yoff = y1; + xstep = 1.0 / xblock; ystep = 1.0 / yblock; + } else { + bp = NULL; + xoff = yoff = 0; + xstep = ystep = 1.0; + } + + /* Interpolate the input rect to the output grid. */ + if (interp && + ((1.0 / xscale) - xblock) > ZOOM_TOL || + ((1.0 / yscale) - yblock) > ZOOM_TOL) { + + /* Use bilinear interpolation to compute the output grid. */ + bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + + } else { + /* Extract pixels from block averaged input data. */ + bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + } + + if (bp) + XtFree ((char *)bp); +} + + +/* bx_boxcar -- Block average primitive for scale_boxcar. + */ +static +bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, obuf, xblock, yblock) + uchar *idata; /* input data array */ + int inx, iny, ibpl; /* array dimensions */ + int x1,y1,x2,y2; /* region to be block averaged */ + uchar *obuf; /* output array */ + int xblock, yblock; /* blocking factors */ +{ + register uchar *ip, *op; + register int count, i, *sp; + int obpl, block, nxblocks, nyblocks, j, k; + uchar *lp, *bp; + int *sb; + + nxblocks = obpl = (x2 - x1) / xblock + 1; + nyblocks = (y2 - y1) / yblock + 1; + count = xblock * yblock; + + if ((sb = (int *) XtMalloc (obpl * sizeof(int))) == NULL) + return; + + /* I don't think the following works for pixel values allocated from the + * default colormap, as the pixel values are not sequentially allocated. + */ + for (block = 0; block < nyblocks; block++) { + lp = idata + ibpl * (block * yblock + y1) + x1; + bp = obuf + block * obpl; + + memset (sb, 0, obpl * sizeof(int)); + for (k=yblock; --k >= 0; lp += ibpl) + for (j=nxblocks, ip=lp, sp=sb; --j >= 0; sp++) + for (i=xblock; --i >= 0; ) + *sp += *ip++; + + for (i=obpl, sp=sb, op=bp; --i >= 0; ) + *op++ = *sp++ / count; + } + + XtFree ((char *)sb); +} + + +/* bx_extract -- Block extract primitive for scale_boxcar. + */ +static +bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i; + register uchar *op; + int j; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = (y_src[j] - yoff) * ystep; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* bx_interp -- Bilinear interpolation primitive for scale_boxcar. + */ +static +bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = ((x_src[i] - xoff) * xstep) - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = ((y_src[j] - yoff) * ystep) - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* mf_getinten -- Copy the source rect to the destination rect, converting + * pixel numbers to pixel intensities. + */ +static +mf_getinten (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_out (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* mf_getpixel -- Copy the source rect to the destination rect, converting + * pixel intensities to pixel numbers. + */ +static +mf_getpixel (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_in (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* get_regions -- For each pixel I in the sequence of DNX pixels starting at DX + * there is an associated value XMAP[I]. Compare this sequence to an alternate + * sequence and return a list of subregions {XS,XE,XV} for which the XMAP + * values are equal (XV=0), not equal (XV=1), or not common to (XV=2) the two + * regions. The number of regions output is returned as the function value. + */ +static +get_regions (xs,xe,xv, max_regions, dx, dnx, xmap, alt_dx, alt_dnx, alt_xmap) + int *xs, *xe, *xv, max_regions; + int dx, dnx, *xmap; + int alt_dx, alt_dnx, *alt_xmap; +{ + register int state, current; + register int nx, i; + int offset, old_i; + + offset = dx - alt_dx; + nx = 0; + + for (i=0; i < dnx; i++) { + if (nx >= max_regions-1) + return (0); + + /* Determine whether or not this pixel is mapped the same in both + * sequences. + */ + old_i = i + offset; + if (alt_dnx <= 0 || old_i < 0 || old_i >= alt_dnx) + state = 2; + else + state = (xmap[i] != alt_xmap[old_i]); + + /* When the state boundary is crossed add a range. */ + if (i == 0) { + xs[nx] = dx; + xv[nx] = current = state; + } + if (state != current) { + xe[nx] = dx + i - 1; + xs[++nx] = dx + i; + xv[nx] = current = state; + } + if (i == dnx-1) + xe[nx++] = dx + i; + } + + return (nx); +} + + +/* get_rects -- Combine two lists of regions, one in X and the other in Y, + * to produce a list of 2D rectangles defining the regions outlined by the + * region lists. Only rects for which the given condition is true in either + * X or Y are selected. Adjacent rects are combined. + */ +static +get_rects (o_rl, max_rects, xs,xe,xv,nx, ys,ye,yv,ny, xcond,ycond) + XRectangle *o_rl; /* receives list of rectangles */ + int max_rects; /* max rectangles out */ + int *xs, *xe, *xv, nx; /* X list of regions */ + int *ys, *ye, *yv, ny; /* Y list of regions */ + int xcond, ycond; /* X,Y condition bitflags */ +{ + register int i, j; + XRectangle rl[MAX_REGIONS]; + int limit = min (max_rects, MAX_REGIONS); + int o_nrects=0, nrects=0; + int i1, i2, j1, j2; + + /* Get initial list of rects matching the given X and Y conditions. + * Rects which are adjacent in X are combined to form one larger rect. + */ + for (j=0; j < ny; j++) { + for (i=0; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) { + /* Collapse rects adjacent in X. */ + for (i1 = i2 = i++; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) + i2 = i; + else + break; + } + + rl[nrects].x = xs[i1]; + rl[nrects].y = ys[j]; + rl[nrects].width = xe[i2] - xs[i1] + 1; + rl[nrects].height = ye[j] - ys[j] + 1; + + if (++nrects >= limit) + return (nrects); + } + } + } + + /* Now scan the rect list and collapse rects which are adjacent in Y + * into one larger rect. Find all the rects that are at the same X + * and write them to the output list, collapsing rects that are adjacent + * in Y in the process. + */ + for (i=0; i < nx; i++) + for (j=0; j < nrects; ) { + /* Find first rect if any. */ + for (j1=0, j2 = -1; j < nrects; j++) + if (rl[j].x == xs[i]) { + j1 = j2 = j++; + break; + } + + /* Collapse rects adjacent in Y. */ + for ( ; j < nrects; j++) + if (rl[j].x == xs[i]) + if (rl[j].y == rl[j2].y + rl[j2].height && + rl[j].width == rl[j1].width) + j2 = j; + else + break; + + /* Output the rect. */ + if (j2 >= j1) { + o_rl[o_nrects].x = rl[j1].x; + o_rl[o_nrects].y = rl[j1].y; + o_rl[o_nrects].width = rl[j1].width; + o_rl[o_nrects].height = rl[j2].y + rl[j2].height - rl[j1].y; + + if (++o_nrects >= max_rects) + return (o_nrects); + } + } + + return (o_nrects); +} + + +/* rect_intersect -- Compute the intersection of two rects. The area of + * the intersection is returned as the function value, i.e., zero is + * returned if the rects do not intersect. + */ +static +rect_intersect (in, r1, r2) + register XRectangle *in; + register XRectangle *r1, *r2; +{ + int x1, y1, x2, y2; + + x1 = max (r1->x, r2->x); + y1 = max (r1->y, r2->y); + x2 = min ((int)r1->x + (int)r1->width, (int)r2->x + (int)r2->width) - 1; + y2 = min ((int)r1->y + (int)r1->height, (int)r2->y + (int)r2->height) - 1; + + in->x = x1; + in->y = y1; + in->width = max (0, x2 - x1 + 1); + in->height = max (0, y2 - y1 + 1); + + return (in->width * in->height); +} + + +/* save_mapping -- Store a mapping in a mapping descriptor. + */ +static +save_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int mapping, rop; + int src, st, sx,sy,sw,sh; + int dst, dt, dx,dy,dw,dh; +{ + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = sw; mp->sny = sh; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dw; mp->dny = dh; + mp->defined = mp->enabled = mp->refresh = 1; + mp->mapping = mapping; + mp->rop = rop; +} + +/* load_mapping -- Load a mapping from a mapping descriptor. + */ +static +load_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int *mapping, *rop; + int *src, *st, *sx,*sy,*sw,*sh; + int *dst, *dt, *dx,*dy,*dw,*dh; +{ + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *sw = mp->snx; *sh = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dw = mp->dnx; *dh = mp->dny; + *mapping = mp->mapping; + *rop = mp->rop; +} + + +/* get_pixel_mapping -- Copy a mapping, converting to pixel coordinates in + * the process if the mapping is not already in pixel coordinates. + */ +static +get_pixel_mapping (w, mp1, mp2, update) + GtermWidget w; + register Mapping mp1; /* input mapping */ + register Mapping mp2; /* output mapping */ + int update; /* update mapping */ +{ + float maxndc = (float)MAXNDC; + + mp2->mapping = mp1->mapping; + mp2->refresh = mp1->refresh; + mp2->enabled = mp1->enabled; + mp2->rop = mp1->rop; + + if (!(mp2->defined = mp1->defined)) + return; + + mp2->src = mp1->src; + if (mp1->st == GtPixel) { + mp2->st = mp1->st; + mp2->sx = mp1->sx; mp2->sy = mp1->sy; + mp2->snx = mp1->snx; mp2->sny = mp1->sny; + } else { + float width = w->gterm.rasters[mp1->src].width; + float height = w->gterm.rasters[mp1->src].height; + mp2->sx = mp1->sx * width / maxndc; + mp2->sy = (MAXNDC - (mp1->sy + abs(mp1->sny))) * height / maxndc; + mp2->snx = mp1->snx * width / maxndc; + mp2->sny = mp1->sny * height / maxndc; /* NDC flipped in Y */ + mp2->st = GtPixel; + } + + mp2->dst = mp1->dst; + if (mp1->dt == GtPixel) { + mp2->dt = mp1->dt; + mp2->dx = mp1->dx; mp2->dy = mp1->dy; + mp2->dnx = mp1->dnx; mp2->dny = mp1->dny; + } else { + float width = w->gterm.rasters[mp1->dst].width; + float height = w->gterm.rasters[mp1->dst].height; + mp2->dx = mp1->dx * width / maxndc; + mp2->dy = (MAXNDC - (mp1->dy + abs(mp1->dny))) * height / maxndc; + mp2->dnx = mp1->dnx * width / maxndc; + mp2->dny = mp1->dny * -height / maxndc; /* NDC flipped in Y */ + mp2->dt = GtPixel; + } + + /* The lookup tables are already in pixel space, so we can propagate + * these to the new mapping if the old mapping was updated. + */ + if (update && mp1->updated) { + if (mp2->mapdata = (uchar *) XtMalloc (mp1->datalen)) { + + memmove (mp2->mapdata, mp1->mapdata, mp1->datalen); + mp2->datalen = mp1->datalen; + mp2->scaling = mp1->scaling; + mp2->xscale = mp1->xscale; + mp2->yscale = mp1->yscale; + + mp2->x_extent = (mapExtent *) + ((uchar *)mp1->x_extent - mp1->mapdata + mp2->mapdata); + mp2->y_extent = (mapExtent *) + ((uchar *)mp1->y_extent - mp1->mapdata + mp2->mapdata); + mp2->x_srcpix = (int *) + ((uchar *)mp1->x_srcpix - mp1->mapdata + mp2->mapdata); + mp2->y_srcpix = (int *) + ((uchar *)mp1->y_srcpix - mp1->mapdata + mp2->mapdata); + mp2->x_src = (float *) + ((uchar *)mp1->x_src - mp1->mapdata + mp2->mapdata); + mp2->y_src = (float *) + ((uchar *)mp1->y_src - mp1->mapdata + mp2->mapdata); + + mp2->updated = 1; + } + } else + mp2->updated = 0; +} + +/* valid_mapping -- Perform some sanity checks on a mapping to verify that + * it contains something meaningful. + */ +static +valid_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register int x, y; + int snx, sny, dnx, dny; + int s_width, s_height, d_width, d_height; + Raster sr, dr; + + if (!mp || !mp->defined) + return (False); + + if (mp->src < 0 || mp->src >= w->gterm.maxRasters) + return (False); + if (mp->dst < 0 || mp->dst >= w->gterm.maxRasters) + return (False); + + sr = &w->gterm.rasters[mp->src]; + dr = &w->gterm.rasters[mp->dst]; + if (!sr->type || !dr->type) + return (False); + + switch (mp->st) { + case GtPixel: + s_width = sr->width; s_height = sr->height; + break; + case GtNDC: + s_width = MAXNDC + 1; s_height = MAXNDC + 1; + break; + default: + return (False); + } + + switch (mp->dt) { + case GtPixel: + d_width = dr->width; d_height = dr->height; + break; + case GtNDC: + d_width = MAXNDC + 1; d_height = MAXNDC + 1; + break; + default: + return (False); + } + + snx = mp->snx; dnx = abs(mp->dnx); + sny = mp->sny; dny = abs(mp->dny); + if (snx <= 0 || dnx <= 0 || sny <= 0 || dny <= 0) + return (False); + + x = mp->sx; y = mp->sy; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + x = mp->sx + snx - 1; y = mp->sy + sny - 1; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + + x = mp->dx; y = mp->dy; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + x = mp->dx + dnx - 1; y = mp->dy + dny - 1; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + + return (True); +} + + +/* initialize_mapping -- Initialize the contents of a mapping descriptor. + */ +static +initialize_mapping (mp) + register Mapping mp; +{ + memset ((char *)mp, 0, sizeof(struct mapping)); +} + + +/* update_mapping -- Update the portion of a mapping descriptor used at + * runtime to execute the mapping. This information consists of several + * lookup tables and other parameters describing how a destination pixel + * maps back to a source pixel and vice versa. + */ +static +update_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register uchar *op; + register int i, j, k; + int snx, sny, dnx, dny, sx, sy, dx, dy; + int xmax, ymax, lo, hi, edge1, edge2; + int temp, xflip=0, yflip=0; + struct mapping p_mp; + float pixwidth, *fp; + int *ip; + + if (mp->updated) + return; + + /* The internal lookup tables are in pixel units. */ + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 0); + + if ((snx = p_mp.snx) <= 0 || (sny = p_mp.sny) <= 0) + return; + + if ((dnx = p_mp.dnx) < 0) { + dnx = -dnx; + xflip++; + } + if ((dny = p_mp.dny) < 0) { + dny = -dny; + yflip++; + } + + sx = p_mp.sx; + sy = p_mp.sy; + dx = p_mp.dx; + dy = p_mp.dy; + xmax = dnx - 1; + ymax = dny - 1; + + /* Get scale factors. */ + mp->xscale = (float)dnx / (float)snx; + mp->yscale = (float)dny / (float)sny; + + /* Determine type of scaling to be used. */ + if (mp->xscale < 1.0 || mp->yscale < 1.0) { + mp->scaling = M_DEZOOM; + } else if (mp->xscale > 1.0 || mp->yscale > 1.0) { + mp->scaling = M_ZOOM; + if (abs(mp->xscale - (int)(mp->xscale+0.5)) < ZOOM_TOL && + abs(mp->yscale - (int)(mp->yscale+0.5)) < ZOOM_TOL) + mp->scaling = M_INTZOOM; + } else + mp->scaling = (xflip || yflip) ? M_ZOOM : M_NOSCALING; + + /* Get a data buffer for the lookup tables. */ + mp->datalen = + snx * sizeof(mapExtent) + /* xy, extent */ + sny * sizeof(mapExtent) + + dnx * sizeof(int) + /* xy, srcpix */ + dny * sizeof(int) + + dnx * sizeof(float) + /* xy, src */ + dny * sizeof(float); + + if (mp->mapdata) + mp->mapdata = (uchar *) XtRealloc ((char *)mp->mapdata, mp->datalen); + else + mp->mapdata = (uchar *) XtMalloc (mp->datalen); + if (mp->mapdata == NULL) + return; + + /* Set the table pointers. */ + op = mp->mapdata; + mp->x_extent = (mapExtent *) op; op += snx * sizeof(mapExtent); + mp->y_extent = (mapExtent *) op; op += sny * sizeof(mapExtent); + mp->x_srcpix = (int *) op; op += dnx * sizeof(int); + mp->y_srcpix = (int *) op; op += dny * sizeof(int); + mp->x_src = (float *) op; op += dnx * sizeof(float); + mp->y_src = (float *) op; op += dny * sizeof(float); + + /* Compute the backpointers to the source raster for each destination + * pixel center. + */ + for (i=0, ip = mp->x_srcpix, fp = mp->x_src; i < dnx; i++) { + fp[i] = ((xflip ? xmax - i : i) + 0.5) / mp->xscale + sx; + ip[i] = fp[i]; + } + for (i=0, ip = mp->y_srcpix, fp = mp->y_src; i < dny; i++) { + fp[i] = ((yflip ? ymax - i : i) + 0.5) / mp->yscale + sy; + ip[i] = fp[i]; + } + + /* Compute the extent arrays. These define the range of destination + * pixels affected by each source pixel. + */ + lo = dnx - 1 + dx; + hi = dx; + for (i=0; i < snx; i++) { + mp->x_extent[i].lo = lo; + mp->x_extent[i].hi = hi; + } + lo = dny - 1 + dy; + hi = dy; + for (i=0; i < sny; i++) { + mp->y_extent[i].lo = lo; + mp->y_extent[i].hi = hi; + } + + /* Map the left and right or top and bottom edges of each destination + * pixel back into the source rect and update the corresponding extent + * entries to indicate that these source pixels are used to compute the + * destination pixel. + */ + pixwidth = 1.0 - ZOOM_TOL; + + for (i=0; i < dnx; i++) { + edge1 = (xflip ? xmax - i : i) / mp->xscale; + edge2 = (xflip ? xmax - (i-pixwidth) : (i+pixwidth)) / mp->xscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (snx - 1, edge2); + + for (j=edge1, k = dx + i; j <= edge2; j++) { + if (mp->x_extent[j].lo > k) + mp->x_extent[j].lo = k; + if (mp->x_extent[j].hi < k) + mp->x_extent[j].hi = k; + } + } + + for (i=0; i < dny; i++) { + edge1 = (yflip ? ymax - i : i) / mp->yscale; + edge2 = (yflip ? ymax - (i-pixwidth) : (i+pixwidth)) / mp->yscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (sny - 1, edge2); + + for (j=edge1, k = dy + i; j <= edge2; j++) { + if (mp->y_extent[j].lo > k) + mp->y_extent[j].lo = k; + if (mp->y_extent[j].hi < k) + mp->y_extent[j].hi = k; + } + } + + mp->updated = 1; +} + + +/* free_mapping -- Free any storage used internally by a mapping descriptor, + * and deactivate the mapping. + */ +static +free_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + mp_unlink (w, mp); + mp->defined = mp->enabled = mp->updated = 0; + if (mp->mapdata) { + XtFree ((char *) mp->mapdata); + mp->mapdata = NULL; + mp->datalen = 0; + mp->x_extent = mp->y_extent = NULL; + mp->x_srcpix = mp->y_srcpix = NULL; + mp->x_src = mp->y_src = NULL; + mp->updated = 0; + } +} + +static void +mp_linkafter (w, mp, ref_mp) + register GtermWidget w; + register Mapping mp; + register Mapping ref_mp; +{ + register Mapping map; + + /* Don't use the reference mapping unless it is already linked or + * the list is empty. + */ + if (w->gterm.mp_head) { + for (map = w->gterm.mp_head; map && map != ref_mp; map = map->next) + ; + if (map != ref_mp) + ref_mp = NULL; + } + + mp->prev = ref_mp; + mp->next = ref_mp ? ref_mp->next : NULL; + if (ref_mp && ref_mp->next) + ref_mp->next->prev = mp; + if (ref_mp) + ref_mp->next = mp; + + if (!w->gterm.mp_tail || ref_mp == w->gterm.mp_tail) + w->gterm.mp_tail = mp; + if (!w->gterm.mp_head) + w->gterm.mp_head = mp; +} + + +static void +mp_unlink (w, mp) + register GtermWidget w; + register Mapping mp; +{ + if (mp->prev) + mp->prev->next = mp->next; + if (mp->next) + mp->next->prev = mp->prev; + if (w->gterm.mp_head == mp) + w->gterm.mp_head = mp->next; + if (w->gterm.mp_tail == mp) + w->gterm.mp_tail = mp->prev; + + mp->prev = mp->next = NULL; +} + + +/* + * Graphics MARKERS. + * -------------------- + * A marker is an active graphics object displayed on top of a drawing to + * mark, annotate, or outline a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. Markers are used to + * interactively define regions with the mouse, to provide a dynamic graphical + * display which doesn't interfere with the underlying graphics frame, or as a + * graphical means of command input, using callbacks to perform some operation + * when the marker is moved or resized by the user. + * + * GtMarkerInit (w) + * GtMarkerFree (w) + * + * gm = GmCreate (w, type, interactive) + * GmRedisplay (w, region|NULL) + * gm = GmCopy (gm) + * GmDestroy (gm) + * GmAddCallback (gm, events, func, client_data) + * GmDeleteCallback (gm, func, client_data) + * gm = GmSelect (gt, x, y, &what) + * + * GmMarkpos (gm) + * GmRedraw (gm, func, erase) + * GmRaise (gm, ref_gm|NULL) + * GmLower (gm, ref_gm|NULL) + * GmNotify (gm, events, event, param, nparams) + * + * GmAddPt (gm, x, y) + * GmDeletePt (gm, x, y) + * GmMovePt (gm, x, y) + * GmMove (gm, x, y) + * GmResize (gm, x, y) + * GmRotate (gm, x, y) + * + * GmSetAttributes (gm, args, nargs, type) + * GmGetAttributes (gm, args, nargs, type) + * GmSetAttribute (gm, attribute, value, type) + * GmGetAttribute (gm, attribute, value, type) + * GmSetVertices (gm, points, first, npts) + * npts = GmGetVertices (gm, points, first, maxpts) + * GmGetBoundingBox (gm, x, y, width, height) + * + * type = GmStrToType (marker_type) + * event = GmStrToEvent (event_type) + * func = GmStrToFunction (drawing_function) + * + * Markers operate in screen coordinates (raster 0). The SelectRaster + * and MapVector routines may be used to convert to and from raster + * coordinates if desired. + * + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mp) + * GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + * + * The Gm procedures above implement the main functionality of markers. User + * interaction is provided at a higher level using action procedures which + * are bound to pointer and keyboard events via translations (or by the GUI + * itself directly calling the above procedures). + */ + +static void gm_text_init(), gm_line_init(), gm_plin_init(), gm_rect_init(); +static void gm_boxx_init(), gm_circ_init(), gm_elip_init(), gm_pgon_init(); +static int gm_putint(), gm_putfloat(), gm_do_callbacks(), gm_constraint(); +static int gm_getint(), gm_getattribute(), gm_gettype(); +static double gm_getfloat(); +static char *gm_getstring(); + +static void gm_markpos(), gm_erase(), gm_redraw(), gm_setCurRect(); +static void gm_linkafter(), gm_unlink(); +static double gm_niceAngle(); +static Pixel gm_getpixel(); +static int gm_select(); +static int gm_getfillstyle(); + +static GmVMethod gm_classinit[] = { + gm_text_init, gm_line_init, gm_plin_init, gm_rect_init, + gm_boxx_init, gm_circ_init, gm_elip_init, gm_pgon_init +}; + +static Region null_region; +static XRectangle null_rect = { 0, 0, 0, 0 }; +#define NullRect(r) (!(r)->width || !(r)->height) + +#define PI_2 1.57079632679489661923 +#define PI_4 0.78539816339744830962 +#define BORDER 5 + +static void M_create(), M_destroy(), M_destroyNull(), M_set(), M_raise(); +static void M_lower(), M_notify(), M_markpos(), M_markposAdd(), M_redraw(); +static void M_addPt(), M_deletePt(), M_movePt(), M_deleteDestroy(); +static void M_move(), M_resize(), M_moveResize(), M_rotate(); +static void M_rotateResize(), M_input(); +static void gm_focusin(), gm_focusout(); + +static XtActionsRec markerActionsList[] = { + { "m_create", M_create }, + { "m_destroy", M_destroy }, + { "m_destroyNull", M_destroyNull }, + { "m_set", M_set }, + { "m_raise", M_raise }, + { "m_lower", M_lower }, + { "m_notify", M_notify }, + { "m_input", M_input }, + { "m_markpos", M_markpos }, + { "m_markposAdd", M_markposAdd }, + { "m_redraw", M_redraw }, + { "m_addPt", M_addPt }, + { "m_deletePt", M_deletePt }, + { "m_movePt", M_movePt }, + { "m_deleteDestroy", M_deleteDestroy }, + { "m_move", M_move }, + { "m_resize", M_resize }, + { "m_moveResize", M_moveResize }, + { "m_rotate", M_rotate }, + { "m_rotateResize", M_rotateResize }, +}; + + +/* GtMarkerInit -- Initialize the marker subsystem. + */ +GtMarkerInit (w) + GtermWidget w; +{ + register Marker gm, prev; + XColor fg_color, bg_color; + Display *display = w->gterm.display; + int type, i; + GC gc; + + for (gm = w->gterm.gm_tail; gm; gm = prev) { + prev = gm->prev; + GmDestroy (gm); + } + + if (!w->gterm.gm_initialized) { + /* Register some additional actions for markers. */ + XtAppAddActions (XtWidgetToApplicationContext((Widget)w), + markerActionsList, XtNumber(markerActionsList)); + + /* Get the gterm widget translations. */ + if ((char *)w->gterm.defTranslations == NULL) { + char *translations = NULL; + XtTranslations tt; + XtResource r; + int ttype, i; + + r.resource_name = XtNtranslations; + r.resource_class = XtCTranslations; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + XtGetApplicationResources ((Widget)w, &translations, &r, 1,NULL,0); + + if (translations) { + if (strncmp (translations, "#augment", 8) == 0) + ttype = T_augment; + else if (strncmp (translations, "#override", 9) == 0) + ttype = T_override; + else + ttype = T_replace; + + if (ttype == T_replace) { + w->gterm.defTranslations = + XtParseTranslationTable (translations); + } else if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = ttype; + w->gterm.nauxTrans++; + } + + } else { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + } + + /* Get the marker translations. */ + if ((char *)w->gterm.gm_defTranslations == NULL) + w->gterm.gm_defTranslations = + XtParseTranslationTable (w->gterm.gm_translations); + } + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, + w->gterm.gm_lineWidth, w->gterm.gm_lineStyle, CapButt, JoinMiter); + w->gterm.gm_drawGC = gc; + + /* Get graphics rubber-band GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetFunction (display, gc, GXxor); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, w->gterm.gm_xorFillColor); + XSetBackground (display, gc, w->gterm.gm_xorFillBgColor); + XSetLineAttributes (display, gc, + 0, LineDoubleDash, CapButt, JoinMiter); + w->gterm.gm_rubberGC = gc; + + fg_color.pixel = w->gterm.gm_cursorFgColor; + bg_color.pixel = w->gterm.gm_cursorBgColor; + XQueryColor (display, w->core.colormap, &fg_color); + XQueryColor (display, w->core.colormap, &bg_color); + + w->gterm.gm_markerCursor = XCreateFontCursor (display, XC_fleur); + XRecolorCursor (display, w->gterm.gm_markerCursor, &fg_color,&bg_color); + w->gterm.gm_edgeCursor = XCreateFontCursor (display, XC_dotbox); + XRecolorCursor (display, w->gterm.gm_edgeCursor, &fg_color,&bg_color); + w->gterm.gm_pointCursor = XCreateFontCursor (display, XC_sizing); + XRecolorCursor (display, w->gterm.gm_pointCursor, &fg_color,&bg_color); + + if (!(type = GmStrToType (w->gterm.gm_defaultMarker))) + type = Gm_Rectangle; + w->gterm.gm_defaultType = type; + + if (!null_region) + null_region = XCreateRegion(); + w->gterm.gm_initialized++; + } + + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.gm_redisplay = False; + w->gterm.preserve_screen = 0; +} + + +/* GtMarkerFree -- Free any marker subsystem resources. + */ +static void +GtMarkerFree (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + register Marker gm; + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) + GmDestroy (gm); + + if (!w->gterm.gm_initialized) + return; + + XFreeGC (display, w->gterm.gm_drawGC); + XFreeGC (display, w->gterm.gm_rubberGC); + + /* This call can fail - see comments elsewhere in this file about + * XFreeCursor. + * + XFreeCursor (display, w->gterm.gm_markerCursor); + XFreeCursor (display, w->gterm.gm_edgeCursor); + XFreeCursor (display, w->gterm.gm_pointCursor); + */ + + w->gterm.gm_initialized = 0; +} + + +/* gm_focusin -- Called when gterm window input is directed to a marker. + */ +static void +gm_focusin (w, gm, what) + register GtermWidget w; + register Marker gm; + GmSelection what; +{ + Cursor cursor; + int erase; + Marker am; + + if (!XtIsRealized ((Widget)w)) + return; + + if (am = w->gterm.gm_active) { + if (am != gm) + gm_focusout (w, 0); + else if (what && what->type == w->gterm.gm_selection.type) { + /* no change */ + return; + } + } + + if (what) { + switch (what->type) { + case Ge_Point: + cursor = w->gterm.gm_pointCursor; + break; + case Ge_Edge: + cursor = w->gterm.gm_edgeCursor; + break; + default: + cursor = w->gterm.gm_markerCursor; + break; + } + } else + cursor = w->gterm.gm_markerCursor; + + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, cursor); + w->gterm.gm_active = gm; + w->gterm.gm_selection = *what; + + if (gm && gm != am) { + gm_request_translations (w, gm); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusIn, NULL, NULL, 0); +} + + +/* gm_focusout -- Called to restore the normal gterm window input when the + * pointer moves off a marker. + */ +static void +gm_focusout (w, enableSetTrans) + register GtermWidget w; + int enableSetTrans; /* replace translations */ +{ + register Display *display = w->gterm.display; + register Marker gm = w->gterm.gm_active; + int erase, i; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Restore the default gterm window translations. */ + if (enableSetTrans) + gm_request_translations (w, NULL); + + XDefineCursor (display, w->gterm.window, w->gterm.cursor); + w->gterm.gm_active = NULL; + + if (gm) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusOut, NULL, NULL, 0); +} + + +/* gm_refocus -- Simulate a pointer event to recompute the marker pointer + * focus. Called when a software event changes the marker stacking order + * in some way. + */ +static void +gm_refocus (w) + GtermWidget w; +{ + XMotionEvent event; + int nparams = 0; + + event.x = w->gterm.last_x; + event.y = w->gterm.last_y; + HandleTrackCursor ((Widget)w, &event, NULL, &nparams); +} + + +/* + * Translation tables. The widget's translation table must not be replaced + * while a translation is executing. This can be a problem as it is often + * events and their translations which lead to the translation table getting + * replaced. To avoid this problem we merely queue a timer event to load + * the desired translation table, allowing any existing translation to + * finish executing before the translation table is swapped out. If multiple + * translation table load requests are issued only the final one has any + * effect. + */ + +/* gm_request_translations -- Queue a request to load the translations for the + * specified marker (or NULL to load the default gterm translations). If this + * is the first request and timers are enabled a timer is posted to load the + * translations when any current event processing is complete. If a request + * is already active then the most recent request supercedes any previous one. + */ +static void +gm_request_translations (w, gm) + register GtermWidget w; + Marker gm; +{ + w->gterm.gm_reqTranslations = gm; + + if (!w->gterm.useTimers) + gm_load_translations (w, NULL); + else if (!w->gterm.gm_timer_id) { + w->gterm.gm_timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext((Widget)w), 0, + gm_load_translations, (XtPointer)w); + } +} + + +/* gm_load_translations -- Swap out the widget's translation table. This is + * a no-op if the requested translation table is already loaded. + */ +static void +gm_load_translations (w, id) + register GtermWidget w; + XtIntervalId id; +{ + register Marker am, gm; + register int i; + + w->gterm.gm_timer_id = (XtIntervalId) NULL; + + am = w->gterm.gm_curTranslations; + gm = w->gterm.gm_reqTranslations; + if (am == gm && w->gterm.gm_initialized) + return; + + if (gm) { + /* Set the translations for the indicated marker. */ + if (!am || am->translations != gm->translations) + XtOverrideTranslations ((Widget)w, gm->translations); + } else { + /* Restore the default gterm window translations. */ + XtVaSetValues ((Widget)w, + XtNtranslations, (XtArgVal)w->gterm.defTranslations, NULL); + for (i=0; i < w->gterm.nauxTrans; i++) { + switch (w->gterm.auxTType[i]) { + case T_augment: + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + case T_override: + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + } + } + } + + w->gterm.gm_curTranslations = w->gterm.gm_reqTranslations; +} + + +/* Public marker functions. + * -------------------------- + */ + +/* GmCreate -- Create a new marker. + */ +Marker +GmCreate (w, type, interactive) + GtermWidget w; + int type; /* marker type */ + int interactive; /* use pointer to set position */ +{ + register Marker gm; + + /* Allocate descriptor. */ + if (type < 1 || type > Gm_NTypes) + return (NULL); + if (!(gm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + /* Initialize descriptor. */ + gm->w = w; + gm->type = type; + gm->flags = interactive ? (Gm_Visible|Gm_Sensitive) : 0; + gm->translations = w->gterm.gm_defTranslations; + gm->old_region = XCreateRegion(); + gm->cur_region = XCreateRegion(); + (gm_classinit[type-1]) (gm, interactive); + + /* Link marker to tail of marker list. */ + gm_linkafter (gm, w->gterm.gm_tail); + + /* If marker is being created interactive, set flag to indicate that the + * next create marker event should finish creating this marker. + */ + if (w->gterm.gm_create) + GmDestroy (w->gterm.gm_create); + w->gterm.gm_create = interactive ? gm : NULL; + + return (gm); +} + + +/* GmDestroy -- Destroy a marker. + */ +GmDestroy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + Region old_region, cur_region; + + /* GmDestroy can be called recursively during a destroy operation as a + * side effect of the destroy callback. Set the Gm_BeingDestroyed flag + * to cause these redundant destroy requests to be ignored. + */ + if (gm->flags & Gm_BeingDestroyed) + return (OK); + gm->flags |= Gm_BeingDestroyed; + + /* Release the focus if active marker. This should be done before + * proceeding to destroy the marker, i.e. before calling the destroy + * callbacks. + */ + if (w->gterm.gm_active == gm) { + gm_focusout (w, 1); + w->gterm.gm_active = NULL; + } + + /* Inform any clients that have registered a callback for this marker + * that we are about to destroy the marker. + */ + gm_do_callbacks (gm, GmEvDestroy, NULL, NULL, 0); + + /* Erase the marker from the screen. */ + GmMarkpos (gm); + gm_erase (gm); + + /* Note marker position. */ + old_region = gm->old_region; + cur_region = gm->cur_region; + + /* Free all storage and unlink the marker. */ + if (gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + if (gm->text) + XtFree ((char *)gm->text); + if (gm->pgon) + XtFree ((char *)gm->pgon); + + gm_unlink (gm); + XtFree ((char *)gm); + + /* Redraw any markers that were obscured by the deleted marker. */ + update_transients (w, old_region); + + XDestroyRegion (old_region); + XDestroyRegion (cur_region); + + /* Recompute the marker focus. */ + gm_refocus (w); + + return (OK); +} + + +/* GmCopy -- Copy a marker. + */ +Marker +GmCopy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register Marker nm; + + if (!(nm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + *nm = *gm; + nm->parent = gm; + nm->old_region = NULL; + nm->cur_region = NULL; + nm->points = NULL; + nm->pgon = NULL; + nm->text = NULL; + + /* Copy region descriptors. */ + if ((char *)(nm->old_region = XCreateRegion()) == NULL) + goto fail; + if ((char *)(nm->cur_region = XCreateRegion()) == NULL) + goto fail; + XUnionRegion (nm->old_region, gm->cur_region, nm->cur_region); + + /* Copy any polypoint data. */ + if (gm->pgon) { + nm->pgon = (DPoint *) XtMalloc (gm->npoints * sizeof(DPoint)); + if (nm->pgon == NULL) + goto fail; + memmove (nm->pgon, gm->pgon, gm->npoints * sizeof(DPoint)); + } + + /* Copy region polygon. */ + if (gm->npoints > GM_MAXVERTICES) { + if (!(nm->points = (XPoint *) XtMalloc (gm->npoints * sizeof(XPoint)))) + goto fail; + memmove (nm->points, gm->points, gm->npoints * sizeof(XPoint)); + } + + /* Copy any text data. */ + if (gm->text) { + int nchars = strlen (gm->text); + if (!(nm->text = XtMalloc (nchars + 1))) + goto fail; + memmove (nm->text, gm->text, nchars + 1); + } + + gm_linkafter (nm, w->gterm.gm_tail); + return (nm); + +fail: + if (nm->text) + XtFree (nm->text); + if (nm->pgon) + XtFree ((char *)nm->pgon); + if (nm->points && nm->points != nm->point_data) + XtFree ((char *)nm->points); + if ((char *)nm->cur_region) + XDestroyRegion (nm->cur_region); + if ((char *)nm->old_region) + XDestroyRegion (nm->old_region); + + XtFree ((char *)nm); + return (NULL); +} + + +/* GmAddCallback -- Add a callback to a marker. + */ +GmAddCallback (gm, events, func, client_data) + register Marker gm; + int events; /* events callback is to receive */ + GmIMethod func; /* function to be called */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i; + + /* Find an empty callback slot. */ + for (i=0; i < GM_MAXCALLBACKS; i++) + if (!gm->callback[i].events) + break; + + /* Register the callback. */ + if (i < GM_MAXCALLBACKS) { + cb = &gm->callback[i]; + cb->events = events; + cb->func = func; + cb->client_data = client_data; + gm->ncallbacks = max (gm->ncallbacks, i + 1); + } + + if (events & GmEvConstraint) + gm->constraints++; +} + + +/* GmDeleteCallback -- Delete a previously posted callback given the + * function pointer and client data passed when the callback was registered. + */ +GmDeleteCallback (gm, func, client_data) + register Marker gm; + GmIMethod func; /* callback function */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i, n; + + for (i=n=0; i < GM_MAXCALLBACKS; i++) { + cb = &gm->callback[i]; + + if (cb->func == func && cb->client_data == client_data) { + if (cb->events & GmEvConstraint) + gm->constraints--; + cb->events = (int)NULL; + cb->func = (GmIMethod)NULL; + cb->client_data = (XtPointer)NULL; + } else if (cb->events) + n = i; + } + + gm->ncallbacks = n + 1; +} + + +/* GmSelect -- Scan the marker list to see if the given pointer coordinates + * are within an active marker. If so, the marker descriptor is returned as + * the function value, and the "what" argument is set to indicate what part + * of the marker was selected. + */ +Marker +GmSelect (w, x, y, what) + GtermWidget w; + int x, y; + GmSelection what; +{ + register int flags = (Gm_Activated|Gm_Visible|Gm_Sensitive); + register XRectangle *r; + register Marker gm; + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) { + if (!((gm->flags & (flags|Gm_BeingDestroyed)) == flags)) + continue; + r = &gm->cur_rect; + if (x < (int)r->x || x >= (int)(r->x + r->width) || + y < (int)r->y || y >= (int)(r->y + r->height)) + continue; + if (gm->select (gm, x, y, what)) + return (gm); + } + + return (NULL); +} + + +/* GmMarkpos -- Save the current marker position, e.g., prior to modifying + * the marker. This is used to erase the old marker when the modified + * marker is later redrawn. + */ +GmMarkpos (gm) + register Marker gm; +{ + gm->markpos (gm); +} + + +/* GmRedraw -- Redraw a marker using the given drawing function. If the erase + * flag is not set (as when in rubber-band mode) the marker is merely drawn + * to the screen. Otherwise if the old marker position has been saved the + * old marker is first erased, then any markers affected by the erase are + * redrawn, and finally the current marker is redrawn at the new location. + */ +GmRedraw (gm, func, erase) + Marker gm; + int func; + int erase; +{ + register Marker mm; + register XRectangle *o, *n, *r; + int flags = (Gm_Activated|Gm_Visible); + Region clip_region, temp_region, temp; + GtermWidget w = gm->w; + int outside; + + /* Recompute marker polygon if any attributes have changed. */ + gm->update (gm); + + clip_region = XCreateRegion(); + temp_region = XCreateRegion(); + + /* Erase the previously marked region (old position). */ + if (erase) { + XUnionRegion (gm->old_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + gm_erase (gm); + } + + if (!erase && func == GXxor) + gm->redraw (gm, func); + else { + /* Draw the marker and any markers it intersects, clipping to the + * new marker region. + */ + o = &gm->old_rect; + n = &gm->cur_rect; + + XUnionRegion (gm->cur_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, clip_region); + + for (mm = gm->w->gterm.gm_head; mm; mm = mm->next) { + if (!((mm->flags & flags) == flags)) + continue; + + /* Redraw a marker if it intersects either the old rect or the + * new rect. + */ + if (mm != gm) { + r = &mm->cur_rect; + outside = 0; + if ((int)r->x >= (int)o->x + (int)o->width || + (int)r->x + (int)r->width <= (int)o->x || + (int)r->y >= (int)o->y + (int)o->height || + (int)r->y + (int)r->height <= (int)o->y) + outside++; + if ((int)r->x >= (int)n->x + (int)n->width || + (int)r->x + (int)r->width <= (int)n->x || + (int)r->y >= (int)n->y + (int)n->height || + (int)r->y + (int)r->height <= (int)n->y) + outside++; + if (outside == 2) + continue; + } + mm->redraw (mm, func); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + } + + if (erase) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XDestroyRegion (clip_region); + XDestroyRegion (temp_region); + + if (func != GXxor && gm->width > 0 && gm->height > 0) { + /* Redraw callback. */ + gm_do_callbacks (gm, GmEvRedraw, NULL, NULL, 0); + + /* Generate moveResize callback, if marker was moved or resized. + */ + if (gm->old_rect.x != gm->cur_rect.x || + gm->old_rect.y != gm->cur_rect.y || + gm->old_rect.width != gm->cur_rect.width || + gm->old_rect.height != gm->cur_rect.height) { + + char x[32], y[32]; + char width[32], height[32]; + char *argv[5]; + int argc; + + /* If the marker was just created (old_rect null) or the marker + * moved and we did a full erase and redraw, any old markpos is + * obsolete so we may as well update the saved position. + */ + if (erase || !gm->old_rect.width || !gm->old_rect.height) + GmMarkpos (gm); + + sprintf (x, "%d", gm->x); + sprintf (y, "%d", gm->y); + sprintf (width, "%d", gm->width); + sprintf (height, "%d", gm->height); + argv[0] = x; + argv[1] = y; + argv[2] = width; + argv[3] = height; + argv[4] = NULL; + argc = 4; + + gm_do_callbacks (gm, GmEvMoveResize, NULL, argv, argc); + } + } +} + + +/* GmRedisplay -- Redisplay the markers in the given region, or redisplay + * the entire window if the region is given as (char *)NULL. + */ +GmRedisplay (w, region) + GtermWidget w; + Region region; +{ + register int flags = (Gm_Activated|Gm_Visible); + register XRectangle *r; + register Marker gm; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Set the clip mask to only draw in the affected region. */ + if (region) + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, region); + + /* Draw all markers that intersect the target region. */ + for (gm = w->gterm.gm_head; gm; gm = gm->next) { + if (!((gm->flags & flags) == flags)) + continue; + + if ((char *)region) { + gm->update (gm); + r = &gm->cur_rect; + if (XRectInRegion (region, + r->x, r->y, r->width, r->height) == RectangleOut) + continue; + } + + gm->redraw (gm, GXcopy); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + w->gterm.gm_redisplay = False; +} + + +/* GmRaise -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn above the second. + */ +GmRaise (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already on top? */ + if (gm == w->gterm.gm_tail || ref_gm && ref_gm->next == gm) + return; + + /* Raise it. */ + gm_unlink (gm); + gm_linkafter (gm, ref_gm ? ref_gm : w->gterm.gm_tail); + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmLower -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn below the second. + */ +GmLower (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already lowered? */ + if (gm == w->gterm.gm_head || ref_gm && ref_gm->prev == gm) + return; + + /* Lower it. */ + gm_unlink (gm); + if (ref_gm && ref_gm->prev) + gm_linkafter (gm, ref_gm->prev); + else { + gm->next = w->gterm.gm_head; + w->gterm.gm_head = gm; + if (gm->next) + gm->next->prev = gm; + if (!w->gterm.gm_tail) + w->gterm.gm_tail = gm; + } + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmNotify -- Notify any clients that have registered callbacks that the + * given marker events have occurred. + */ +GmNotify (gm, events, event, params, nparams) + register Marker gm; + int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + gm_do_callbacks (gm, events, event, params, nparams); +} + + +/* GmAddPt -- Add a point to a marker. + */ +GmAddPt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->addPt) { + GmRedraw (gm, GXxor, erase=False); + gm->addPt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + gm_refocus (gm->w); + } +} + + +/* GmDeletePt -- Delete a point from a marker. + */ +GmDeletePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->deletePt) { + GmMarkpos (gm); + gm->deletePt (gm, x, y); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (gm->w); + } +} + + +/* GmMovePt -- Move a point within a marker. + */ +GmMovePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->movePt) { + GmRedraw (gm, GXxor, erase=False); + gm->movePt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmMove -- Move a marker. + */ +GmMove (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->move) { + GmRedraw (gm, GXxor, erase=False); + gm->move (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmResize -- Resize a marker. + */ +GmResize (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->resize) { + GmRedraw (gm, GXxor, erase=False); + gm->resize (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmRotate -- Rotate a marker. + */ +GmRotate (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->rotate) { + GmRedraw (gm, GXxor, erase=False); + gm->rotate (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmSetAttributes -- Set a list of attributes. Requires that all attribute + * values be specified in the same type. Autoredraw, if enabled, is suspended + * until all attributes have been changed. + */ +GmSetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + int autoredraw, erase; + int status = OK; + + if (autoredraw = (gm->flags & Gm_AutoRedraw)) { + gm->flags &= ~Gm_AutoRedraw; + GmMarkpos (gm); + } + + for (i=0; i < nargs; i++) { + status |= GmSetAttribute (gm, args[i].name, args[i].value, argtype); + if (strcmp (args[i].name, GmAutoRedraw) == 0) + autoredraw = gm_getint (args[i].value, argtype); + } + + if (autoredraw) { + gm->flags |= Gm_AutoRedraw; + GmRedraw (gm, GXcopy, erase=True); + } + + return (status ? ERR : OK); +} + + +/* GmSetAttribute -- Set the value of a marker attribute. + */ +GmSetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int marker_type, atType; + int erase, n, i; + + if (gm->flags & Gm_AutoRedraw) + GmMarkpos (gm); + + switch (atType = gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + marker_type = GmStrToType ((char *)value); + break; + case Gt_Int: + marker_type = gm_getint (value, type); + break; + default: + return (ERR); + } + + marker_type = max(1, min(Gm_NTypes, marker_type)); + (gm_classinit[marker_type-1]) (gm, False); + gm->flags |= Gm_Modified; + break; + + case Ga_Activated: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Activated)) { + gm->flags |= Gm_Activated; + GmRedraw (gm, GXcopy, erase=False); + } + } else { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Activated; + } + return (OK); + + case Ga_Visible: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Visible)) { + gm->flags |= Gm_Visible; + GmRedraw (gm, GXcopy, erase=False); + } + } else if (gm->flags & Gm_Visible) { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Visible; + } + return (OK); + + case Ga_Sensitive: + if (gm_getint (value, type)) + gm->flags |= Gm_Sensitive; + else + gm->flags &= ~Gm_Sensitive; + return (OK); + + case Ga_AutoRedraw: + if (gm_getint (value, type)) + gm->flags |= Gm_AutoRedraw; + else + gm->flags &= ~Gm_AutoRedraw; + return (OK); + + case Ga_Translations: + switch (gm_gettype (type)) { + case Gt_String: + gm->translations = XtParseTranslationTable ((char *)value); + break; + default: + return (ERR); + } + return (OK); + + case Ga_X: + gm->x = gm_getint (value, type); + break; + case Ga_Y: + gm->y = gm_getint (value, type); + break; + + case Ga_Width: + case Ga_Height: + /* For a text marker a size can be specified either in integer + * pixels or in characters, e.g., "40ch" or "40 chars". + */ + if (gm->type == Gm_Text && type == XtRString) { + XFontStruct *fp = gm->font; + int char_width, char_height; + int l_pix, r_pix; + char *ip; + + for (n=0, ip=(char *)value; *ip && isdigit(*ip); ip++) + n = n * 10 + (*ip - '0'); + + while (isspace (*ip)) + ip++; + if (ip[0] == 'c' && ip[1] == 'h') { + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + + if (atType == Ga_Width) + n = n * char_width + l_pix + r_pix; + else + n = n * char_height + l_pix * 2; + } + } else + n = gm_getint (value, type); + + if (atType == Ga_Width) + gm->width = n; + else + gm->height = n; + break; + + case Ga_Rotangle: + gm->rotangle = gm_getfloat (value, type); + break; + + case Ga_HighlightColor: + gm->highlightColor = gm_getpixel (w, value, type); + break; + case Ga_LineColor: + gm->lineColor = gm_getpixel (w, value, type); + break; + case Ga_LineWidth: + gm->lineWidth = gm_getint (value, type); + break; + case Ga_LineStyle: + gm->lineStyle = gm_getint (value, type); + break; + + case Ga_KnotColor: + gm->knotColor = gm_getpixel (w, value, type); + break; + case Ga_KnotSize: + gm->knotSize = gm_getint (value, type); + break; + + case Ga_Fill: + gm->fill = gm_getint (value, type); + break; + case Ga_FillColor: + gm->fillColor = gm_getpixel (w, value, type); + break; + case Ga_FillBgColor: + gm->fillBgColor = gm_getpixel (w, value, type); + break; + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + gm->fillStyle = gm_getfillstyle (w, value, type); + break; + default: + break; + } + break; + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + gm->fillPattern = (Pixmap) (value); + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + gm->textColor = gm_getpixel (w, value, type); + break; + case Ga_TextBgColor: + gm->textBgColor = gm_getpixel (w, value, type); + break; + case Ga_TextBorder: + gm->textBorder = gm_getint (value, type); + break; + case Ga_ImageText: + gm->imageText = gm_getint (value, type); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + i = gm_getint (value, type); + if (i >= 0 && i < NDialogFonts) + gm->font = w->gterm.dialog_fonts[i]; + break; + case Gt_Pointer: + gm->font = (XFontStruct *) (value); + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + case Gt_String: + if (gm->text) + XtFree (gm->text); + if (!(gm->text = XtMalloc (strlen((char *)value) + 1))) + return (ERR); + strcpy (gm->text, (char *)value); + break; + default: + return (ERR); + } + break; + + default: + return (ERR); + } + + gm->flags |= Gm_Modified; + + if (gm->flags & Gm_AutoRedraw) + GmRedraw (gm, GXcopy, erase=True); + + /* Notify client that a marker attribute has changed. */ + { char *argv[2]; + int argc; + + argv[0] = attribute; + argv[1] = NULL; + argc = 1; + + gm_do_callbacks (gm, GmEvModify, NULL, argv, argc); + } + + return (OK); +} + + +/* GmGetAttributes -- Get a list of attributes. Requires that all attribute + * values be specified in the same type. + */ +GmGetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + + for (i=0; i < nargs; i++) + GmGetAttribute (gm, args[i].name, args[i].value, argtype); +} + + +/* GmGetAttribute -- Get the value of a marker attribute. + */ +GmGetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int i; + + switch (gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->type) { + case Gm_Text: + strcpy ((char *)value, GmText); + break; + case Gm_Line: + strcpy ((char *)value, GmLine); + break; + case Gm_Polyline: + strcpy ((char *)value, GmPolyline); + break; + case Gm_Rectangle: + strcpy ((char *)value, GmRectangle); + break; + case Gm_Box: + strcpy ((char *)value, GmBox); + break; + case Gm_Circle: + strcpy ((char *)value, GmCircle); + break; + case Gm_Ellipse: + strcpy ((char *)value, GmEllipse); + break; + case Gm_Polygon: + strcpy ((char *)value, GmPolygon); + break; + default: + return (ERR); + } + break; + case Gt_Int: + if (gm_putint (gm->type, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_Activated: + if (gm_putint ((gm->flags & Gm_Activated) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Visible: + if (gm_putint ((gm->flags & Gm_Visible) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Sensitive: + if (gm_putint ((gm->flags & Gm_Sensitive) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_AutoRedraw: + if (gm_putint ((gm->flags & Gm_AutoRedraw) != 0, value, type) == ERR) + return (ERR); + break; + + case Ga_X: + if (gm_putint (gm->x, value, type) == ERR) + return (ERR); + break; + case Ga_Y: + if (gm_putint (gm->y, value, type) == ERR) + return (ERR); + break; + case Ga_Width: + if (gm_putint (gm->width, value, type) == ERR) + return (ERR); + break; + case Ga_Height: + if (gm_putint (gm->height, value, type) == ERR) + return (ERR); + break; + case Ga_Rotangle: + if (gm_putfloat (gm->rotangle, value, type) == ERR) + return (ERR); + break; + + case Ga_HighlightColor: + if (gm_putint ((int)gm->highlightColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineColor: + if (gm_putint ((int)gm->lineColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineWidth: + if (gm_putint (gm->lineWidth, value, type) == ERR) + return (ERR); + break; + case Ga_LineStyle: + if (gm_putint (gm->lineStyle, value, type) == ERR) + return (ERR); + break; + case Ga_KnotColor: + if (gm_putint ((int)gm->knotColor, value, type) == ERR) + return (ERR); + break; + case Ga_KnotSize: + if (gm_putint (gm->knotSize, value, type) == ERR) + return (ERR); + break; + + case Ga_Fill: + if (gm_putint (gm->fill, value, type) == ERR) + return (ERR); + break; + case Ga_FillColor: + if (gm_putint ((int)gm->fillColor, value, type) == ERR) + return (ERR); + break; + case Ga_FillBgColor: + if (gm_putint ((int)gm->fillBgColor, value, type) == ERR) + return (ERR); + break; + + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->fillStyle) { + case FillSolid: + strcpy ((char *)value, "FillSolid"); + break; + case FillTiled: + strcpy ((char *)value, "FillTiled"); + break; + case FillStippled: + strcpy ((char *)value, "FillStippled"); + break; + case FillOpaqueStippled: + strcpy ((char *)value, "FillOpaqueStippled"); + break; + default: + strcpy ((char *)value, "FillSolid"); + break; + } + break; + case Gt_Int: + if (gm_putint (gm->fillStyle, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + *(Pixmap *)value = gm->fillPattern; + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + if (gm_putint ((int)gm->textColor, value, type) == ERR) + return (ERR); + break; + case Ga_TextBorder: + if (gm_putint (gm->textBorder, value, type) == ERR) + return (ERR); + break; + case Ga_ImageText: + if (gm_putint (gm->imageText, value, type) == ERR) + return (ERR); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + for (i=0; i < NDialogFonts; i++) + if (gm->font == w->gterm.dialog_fonts[i]) { + if (gm_putint (i, value, type) == ERR) + return (ERR); + break; + } + break; + case Gt_Pointer: + *(XFontStruct **)value = gm->font; + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + *((char **)value) = gm->text; + break; + case Gt_String: + strcpy ((char *)value, gm->text); + break; + default: + return (ERR); + } + break; + + default: + return (ERR); + } + + return (OK); +} + + +/* GmSetVertices -- Set the vertices of a "poly" type object. + */ +GmSetVertices (gm, points, first, npts) + Marker gm; + DPoint *points; /* input array of points */ + int first; /* first point to be set */ + int npts; /* number of points to set */ +{ + register DPoint *ip; + register XPoint *op; + register int i; + int erase; + + /* The point vector is automatically extended if more space is needed. + * Small vectors are stored directly in the marker descriptor in the + * point_data array. + */ + if (first + npts > gm->npoints) { + if (gm->npoints > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) XtRealloc ((char *)gm->points, + first + npts)) == (XPoint *)NULL) + return; + } else if (first + npts > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) + XtMalloc (first + npts)) == (XPoint *)NULL) + return; + } else if (!gm->points) + gm->points = gm->point_data; + + gm->npoints = first + npts; + } + + /* Copy the point data. */ + ip = points; + op = &gm->points[first]; + for (i=0; i < npts; i++) { + op->x = (int) ip->x + 0.5; + op->y = (int) ip->y + 0.5; + ip++, op++; + } + + /* Redraw the marker if autoredraw is enabled. */ + if (gm->flags & Gm_AutoRedraw) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } +} + + +/* GmGetVertices -- Get the vertices of a "poly" type object. The actual + * number of points output is returned as the function value. + */ +GmGetVertices (gm, points, first, maxpts) + register Marker gm; + register DPoint *points; /* output array of points */ + int first; /* first point to be returned */ + int maxpts; /* max number of points to return */ +{ + register XPoint *ip; + register DPoint *op; + register int i; + int top, nout; + + if (first >= gm->npoints) + return (0); + top = min (first + maxpts, gm->npoints); + nout = top - first; + + if (points) { + ip = &gm->points[first]; + op = points; + for (i=0; i < nout; i++) { + op->x = ip->x; + op->y = ip->y; + ip++, op++; + } + } + + return (nout); +} + + +/* GmGetBoundingBox -- Returns a rect large enough to completely enclose a + * marker, regardless of its type or orientation. + */ +GmGetBoundingBox (gm, x, y, width, height) + register Marker gm; + int *x, *y; + int *width, *height; +{ + register XRectangle *r = &gm->cur_rect; + + *x = r->x; + *y = r->y; + *width = r->width; + *height = r->height; +} + + +/* GmStrToType -- Convert a marker type string to a marker type code. + */ +GmStrToType (marker_type) +register char *marker_type; +{ + register int type; + + if (strcmp (marker_type, GmText) == 0) + type = Gm_Text; + else if (strcmp (marker_type, GmLine) == 0) + type = Gm_Line; + else if (strcmp (marker_type, GmPolyline) == 0) + type = Gm_Polyline; + else if (strcmp (marker_type, GmRectangle) == 0) + type = Gm_Rectangle; + else if (strcmp (marker_type, GmBox) == 0) + type = Gm_Box; + else if (strcmp (marker_type, GmCircle) == 0) + type = Gm_Circle; + else if (strcmp (marker_type, GmEllipse) == 0) + type = Gm_Ellipse; + else if (strcmp (marker_type, GmPolygon) == 0) + type = Gm_Polygon; + else + type = 0; + + return (type); +} + + +/* GmStrToEvent -- Convert a marker event type string to a marker event code. + */ +GmStrToEvent (event_type) +register char *event_type; +{ + register int type; + + if (strcmp (event_type, "notify") == 0) + type = GmEvNotify; + else if (strcmp (event_type, "moveResize") == 0) + type = GmEvMoveResize; + else if (strcmp (event_type, "modify") == 0) + type = GmEvModify; + else if (strcmp (event_type, "redraw") == 0) + type = GmEvRedraw; + else if (strcmp (event_type, "destroy") == 0) + type = GmEvDestroy ; + else if (strcmp (event_type, "input") == 0) + type = GmEvInput; + else if (strcmp (event_type, "focusIn") == 0) + type = GmEvFocusIn; + else if (strcmp (event_type, "focusOut") == 0) + type = GmEvFocusOut; + else if (strcmp (event_type, "constraint") == 0) + type = GmEvConstraint; + else + type = 0; + + return (type); +} + + +/* GmStrToFunction -- Convert a drawing function string to the corresponding + * XLIB function code. + */ +GmStrToFunction (function) +register char *function; +{ + register int code; + + if (strcmp (function, "clear") == 0) + code = GXclear; + else if (strcmp (function, "and") == 0) + code = GXand; + else if (strcmp (function, "andReverse") == 0) + code = GXandReverse; + else if (strcmp (function, "copy") == 0) + code = GXcopy; + else if (strcmp (function, "andInverted") == 0) + code = GXandInverted; + else if (strcmp (function, "noop") == 0) + code = GXnoop; + else if (strcmp (function, "xor") == 0) + code = GXxor; + else if (strcmp (function, "or") == 0) + code = GXor; + else if (strcmp (function, "nor") == 0) + code = GXnor; + else if (strcmp (function, "equiv") == 0) + code = GXequiv; + else if (strcmp (function, "invert") == 0) + code = GXinvert; + else if (strcmp (function, "orReverse") == 0) + code = GXorReverse; + else if (strcmp (function, "copyInverted") == 0) + code = GXcopyInverted; + else if (strcmp (function, "orInverted") == 0) + code = GXorInverted; + else if (strcmp (function, "nand") == 0) + code = GXnand; + else if (strcmp (function, "set") == 0) + code = GXset; + else + code = -1; + + return (code); +} + + +/* Internal procedures for above code. + * ------------------------------------ + */ + +static int +gm_getint (value, type) + XtArgVal value; + char *type; +{ + register int ch; + + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + ch = *((char *)value); + if (ch == 'T' || ch == 't') + return (1); + else if (ch == 'F' || ch == 'f') + return (0); + else + return (atoi((char *)value)); + default: + return (0); + } +} + + +static Pixel +gm_getpixel (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + XrmValue from, to; + Pixel pixel; + char *str; + + switch (gm_gettype (type)) { + case Gt_Int: + /* Pixel value (colormap index). */ + return ((Pixel)value); + + case Gt_String: + /* The pixel is expressed either as a pixel number input as a string, + * or as a color name. The latter case requires a type conversion. + */ + str = (char *)value; + if (isdigit(str[0]) && (int)strlen(str) <= 3) { + int index = atoi (str); + pixel = w->gterm.cmap[index]; + return (pixel); + } + + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) { + /* Allocate color from default colormap. + */ + from.size = strlen ((char *)value) + 1; + from.addr = (char *)value; + to.addr = (caddr_t) &pixel; + to.size = sizeof(pixel); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRPixel, &to)) + pixel = w->gterm.cmap[1]; + + } else { + /* Allocate closest match from custom colormap. This is crude, + * but for the standard colors this will return an exact match. + */ + int index, min_dist, dist, i; + XColor exact, best, *cp; + + pixel = w->gterm.cmap[1]; + if (XLookupColor (w->gterm.display, + get_colormap(w), str, &exact, &best)) { + min_dist = 9999; + index = 1; + + for (i=0; i < w->gterm.ncolors; i++) { + cp = &w->gterm.color[i]; + dist = abs((int)exact.red - (int)cp->red) + + abs((int)exact.green - (int)cp->green) + + abs((int)exact.blue - (int)cp->blue); + if (dist == 0) { + index = i; + break; + } else if (dist < min_dist) { + index = i; + min_dist = dist; + } + } + + pixel = w->gterm.color[index].pixel; + } + } + return (pixel); + + default: + return (w->gterm.cmap[1]); + } +} + + +static int +gm_getfillstyle (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_String: + if (strcmp ((char *)value, "FillSolid") == 0) + return (FillSolid); + else if (strcmp ((char *)value, "FillTiled") == 0) + return (FillTiled); + else if (strcmp ((char *)value, "FillStippled") == 0) + return (FillStippled); + else if (strcmp ((char *)value, "FillOpaqueStippled") == 0) + return (FillOpaqueStippled); + break; + default: + break; + } + + return (FillSolid); +} + + +static double +gm_getfloat (value, type) + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + return (atof((char *)value)); + default: + return (0); + } +} + + +static char * +gm_getstring (value, type) + XtArgVal value; + char *type; +{ + if (strcmp (type, XtRString) == 0) + return ((char *)value); + else + return (""); +} + + +static int +gm_putint (ival, value, type) + int ival; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = ival; + break; + case Gt_DFloatP: + *(double *)value = (double) ival; + break; + case Gt_String: + sprintf ((char *)value, "%d", ival); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_putfloat (fval, value, type) + double fval; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = (int) fval; + break; + case Gt_DFloatP: + *(double *)value = fval; + break; + case Gt_String: + sprintf ((char *)value, "%g", fval); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_gettype (type) + char *type; +{ + if (strcmp (type, XtRBool) == 0) + return (Gt_Int); + else if (strcmp (type, XtRInt) == 0) + return (Gt_Int); + else if (strcmp (type, XtRFloat) == 0) + return (Gt_DFloatP); + else if (strcmp (type, XtRPointer) == 0) + return (Gt_Pointer); + else if (strcmp (type, XtRString) == 0) + return (Gt_String); + else + return (ERR); +} + + +static int +gm_getattribute (attribute) + char *attribute; +{ + if (strcmp (attribute, GmType) == 0) + return (Ga_Type); + else if (strcmp (attribute, GmActivated) == 0) + return (Ga_Activated); + else if (strcmp (attribute, GmVisible) == 0) + return (Ga_Visible); + else if (strcmp (attribute, GmSensitive) == 0) + return (Ga_Sensitive); + else if (strcmp (attribute, GmAutoRedraw) == 0) + return (Ga_AutoRedraw); + else if (strcmp (attribute, GmTranslations) == 0) + return (Ga_Translations); + else if (strcmp (attribute, GmX) == 0) + return (Ga_X); + else if (strcmp (attribute, GmY) == 0) + return (Ga_Y); + else if (strcmp (attribute, GmWidth) == 0) + return (Ga_Width); + else if (strcmp (attribute, GmHeight) == 0) + return (Ga_Height); + else if (strcmp (attribute, GmRotangle) == 0) + return (Ga_Rotangle); + else if (strcmp (attribute, GmHighlightColor) == 0) + return (Ga_HighlightColor); + else if (strcmp (attribute, GmLineColor) == 0) + return (Ga_LineColor); + else if (strcmp (attribute, GmLineWidth) == 0) + return (Ga_LineWidth); + else if (strcmp (attribute, GmLineStyle) == 0) + return (Ga_LineStyle); + else if (strcmp (attribute, GmKnotColor) == 0) + return (Ga_KnotColor); + else if (strcmp (attribute, GmKnotSize) == 0) + return (Ga_KnotSize); + else if (strcmp (attribute, GmFill) == 0) + return (Ga_Fill); + else if (strcmp (attribute, GmFillColor) == 0) + return (Ga_FillColor); + else if (strcmp (attribute, GmFillBgColor) == 0) + return (Ga_FillBgColor); + else if (strcmp (attribute, GmFillPattern) == 0) + return (Ga_FillPattern); + else if (strcmp (attribute, GmFillStyle) == 0) + return (Ga_FillStyle); + else if (strcmp (attribute, GmTextColor) == 0) + return (Ga_TextColor); + else if (strcmp (attribute, GmTextBgColor) == 0) + return (Ga_TextBgColor); + else if (strcmp (attribute, GmTextBorder) == 0) + return (Ga_TextBorder); + else if (strcmp (attribute, GmImageText) == 0) + return (Ga_ImageText); + else if (strcmp (attribute, GmFont) == 0) + return (Ga_Font); + else if (strcmp (attribute, GmText) == 0) + return (Ga_Text); + else + return (ERR); +} + +static void +gm_linkafter (gm, prev) + register Marker gm; + register Marker prev; +{ + register GtermWidget w = gm->w; + + gm->prev = prev; + gm->next = prev ? prev->next : NULL; + if (prev) + prev->next = gm; + + if (!w->gterm.gm_tail || prev == w->gterm.gm_tail) + w->gterm.gm_tail = gm; + if (!w->gterm.gm_head) + w->gterm.gm_head = gm; + + w->gterm.preserve_screen++; +} + + +static void +gm_unlink (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + + if (gm->prev) + gm->prev->next = gm->next; + if (gm->next) + gm->next->prev = gm->prev; + if (w->gterm.gm_head == gm) + w->gterm.gm_head = gm->next; + if (w->gterm.gm_tail == gm) + w->gterm.gm_tail = gm->prev; + + gm->prev = gm->next = NULL; + if (!w->gterm.gm_head) + w->gterm.preserve_screen = 0; +} + + +/* gm_do_callbacks -- Call any client callbacks registered for the given + * event type. + */ +static int +gm_do_callbacks (gm, events, event, params, nparams) + Marker gm; + register int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + register int n; + register struct markerCallback *cb; + struct markerCallback callback[GM_MAXCALLBACKS]; + int ncallbacks, status; + + /* Copy the callbacks list into local memory to ensure that it is not + * changed by executing a callback. + */ + ncallbacks = gm->ncallbacks; + memmove ((char *)callback, (char *)gm->callback, + sizeof (struct markerCallback) * GM_MAXCALLBACKS); + + for (n = ncallbacks, cb = callback; --n >= 0; cb++) + if (cb->events & events) { + status = cb->func (cb->client_data, + gm, events, event, params, nparams); + if (status) + return (status); + } + + return (0); +} + + +/* gm_constraint -- Handle the constraint callback. This is a client + * callback called when a marker position or size attribute is changed + * interactively at runtime. The purpose of the callback is to allow the + * client to apply any constraints, e.g. to keep the marker within a + * certain area or range of sizes, to forbid rotation, and so on. + */ +static int +gm_constraint (gm, new_gm, what) + register Marker gm, new_gm; + register int what; +{ + register char *ip, *op; + char argbuf[2048]; + char *argv[30]; + int argc = 0; + + /* Return immediately if there are no constraint callbacks. */ + if (!gm->constraints) + return; + + /* Prepare an argument list listing the marker attributes being changed + * and their old and new values. Each attribute is passed as three + * arg strings: name old-value new-value. Each argument string is + * allocated a fixed amount of space of SZ_NUMBER characters. + */ + op = argbuf; + if (what & Gb_X) { + strcpy (argv[argc++]=op, "x"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->x); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->x); op += SZ_NUMBER; + } + if (what & Gb_Y) { + strcpy (argv[argc++]=op, "y"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->y); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->y); op += SZ_NUMBER; + } + if (what & Gb_Width) { + strcpy (argv[argc++]=op, "width"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->width); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->width); op += SZ_NUMBER; + } + if (what & Gb_Height) { + strcpy (argv[argc++]=op, "height"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->height); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->height); op += SZ_NUMBER; + } + if (what & Gb_Rotangle) { + strcpy (argv[argc++]=op, "rotangle"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", gm->rotangle); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", new_gm->rotangle); op += SZ_NUMBER; + } + + /* Call any constraint callbacks. The argv value strings are modified + * in place. + */ + gm_do_callbacks (gm, GmEvConstraint, NULL, argv, argc); + + /* Copy the possibly edited values back into the new_gm struct. + */ + ip = argbuf + SZ_NUMBER * 2; + if (what & Gb_X) { + new_gm->x = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Y) { + new_gm->y = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Width) { + new_gm->width = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Height) { + new_gm->height = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Rotangle) { + new_gm->rotangle = atof (ip); ip += SZ_NUMBER*3; + } +} + + +static void +gm_erase (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register XRectangle *r = &gm->old_rect; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Any clipping to the marker border is set outside this routine. */ + if ((gm->flags & Gm_Visible) && !NullRect(r)) + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, r->x, r->y, r->width, r->height, r->x, r->y); +} + + +/* Marker actions. + * ------------------------- + */ + + +/* M_create -- Create a marker. + */ +static void +M_create (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int interactive, type; + gmSelection what; + + savepos (w, event); + + /* If the marker has already been created in interactive mode the event + * merely initializes the marker, otherwise we create and initialize a + * new marker. + */ + if (!(gm = w->gterm.gm_create)) { + type = w->gterm.gm_defaultType; + if (*nparams == 1) { + if (!(type = GmStrToType (params[0]))) + type = w->gterm.gm_defaultType; + } + gm = GmCreate (w, type, interactive=True); + } + + gm->x = ev->x; + gm->y = ev->y; + gm->flags |= Gm_Activated; + w->gterm.gm_create = NULL; + + what.type = (gm->type == Gm_Polygon) ? Ge_Marker : Ge_Point; + what.vertex = 0; + gm_focusin (w, gm, &what); +} + + +/* M_destroy -- Destroy a marker. + */ +static void +M_destroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmDestroy (gm); +} + + +/* M_destroyNull -- Destroy a marker if it is null sized. + */ +static void +M_destroyNull (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (gm && gm->width <= 2 && gm->height <= 2) + GmDestroy (gm); +} + + +/* M_set -- Set a marker attribute. + */ +static void +M_set (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0; i < *nparams; i += 2) + GmSetAttribute (gm, + (XtArgVal)params[i], (XtArgVal)params[i+1], XtRString); +} + + +/* M_raise -- Raise a marker to the top of the display list. + */ +static void +M_raise (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmRaise (gm, NULL); +} + + +/* M_lower -- Lower a marker to the bottom of the display list. + */ +static void +M_lower (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmLower (gm, NULL); +} + + +/* M_notify -- Notify any clients that have registered callbacks for the + * specified type of events. + */ +static void +M_notify (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int events, i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0, events=0; i < *nparams; i++) + if (strcmp (params[i], "notify") == 0) + events |= GmEvNotify; + else if (strcmp (params[i], "moveResize") == 0) + events |= GmEvMoveResize; + else if (strcmp (params[i], "modify") == 0) + events |= GmEvModify; + else if (strcmp (params[i], "redraw") == 0) + events |= GmEvRedraw; + else if (strcmp (params[i], "destroy") == 0) + events |= GmEvDestroy; + else if (strcmp (params[i], "input") == 0) + events |= GmEvInput; + else if (strcmp (params[i], "focusIn") == 0) + events |= GmEvFocusIn; + else if (strcmp (params[i], "focusOut") == 0) + events |= GmEvFocusOut; + + GmNotify (gm, events, event, params + 1, *nparams - 1); +} + + +/* M_input -- Notify any clients that have registered a input callback + * that a input event has occurred. + */ +static void +M_input (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register Marker gm; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmNotify (gm, GmEvInput, event, params, *nparams); +} + + +/* M_markpos -- Mark the current position of the marker, e.g., so that it + * can later be erased. + */ +static void +M_markpos (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmMarkpos (gm); +} + + +/* M_markposAdd -- Execute either the markpos or add action, depending upon + * the pointer location. If the pointer is over an active marker at a + * location where the add action can be executed this is done, otherwise the + * markpos action is executed. + */ +static void +M_markposAdd (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Get marker and type of active portion of marker. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Always do a markpos whether we Add or not. */ + GmMarkpos (gm); + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_redraw -- Redraw a marker. + */ +static void +M_redraw (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int erase; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + /* This redraw undoes the final Xor draw. */ + GmRedraw (gm, GXxor, erase=False); + + /* Redraw the full marker. */ + GmRedraw (gm, GXcopy, erase=True); +} + + +/* M_addPt -- Add a point. + */ +static void +M_addPt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_deletePt -- Delete a point. + */ +static void +M_deletePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (what->type == Ge_Point) + GmDeletePt (gm, ev->x, ev->y); +} + + +/* M_movePt -- Move a point. + */ +static void +M_movePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Move a point (vertex) if supported by marker type. */ + if (what->type == Ge_Point && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmMovePt (gm, ev->x, ev->y); +} + + +/* M_deleteDestroy -- Delete a point or destroy a marker, depending upon the + * pointer position. + */ +static void +M_deleteDestroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + switch (what->type) { + case Ge_Point: + GmDeletePt (gm, ev->x, ev->y); + break; + case Ge_Marker: + GmDestroy (gm); + break; + } +} + + +/* M_move -- Move a marker. + */ +static void +M_move (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmMove (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_resize -- Resize a marker. + */ +static void +M_resize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmResize (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_moveResize -- Move a point or marker, or resize a marker, depending + * upon the pointer position. + */ +static void +M_moveResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Marker: + GmMove (gm, ev->x, ev->y); + break; + case Ge_Point: + if (gm->type == Gm_Polygon || gm->type == Gm_Polyline) + GmMovePt (gm, ev->x, ev->y); + else + goto resize; + break; + case Ge_Edge: +resize: GmResize (gm, ev->x, ev->y); + break; + } + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotate -- Rotate a marker. + */ +static void +M_rotate (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmRotate (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotateResize -- Rotate or resize a marker. + */ +static void +M_rotateResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Point: + GmRotate (gm, ev->x, ev->y); + break; + case Ge_Edge: + if (gm->flags & Gm_Smooth) + GmRotate (gm, ev->x, ev->y); + else + GmResize (gm, ev->x, ev->y); + break; + default: + GmResize (gm, ev->x, ev->y); + break; + } + + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* + * Marker class code. + * --------------------- + * Each marker class implements a subset of the following procedures. The + * first set of procedures are required. The second set are optional and + * may be set to NULL in the marker descriptor if not implemented by the + * marker class. + * + * gm_xxxx_init (gm, interactive) + * bool = gm_xxxx_select (gm, x, y, &what) + * gm_xxxx_markpos (gm) + * gm_xxxx_redraw (gm, func) + * gm_xxxx_update (gm) + * + * gm_xxxx_addPt (gm, x, y) + * gm_xxxx_deletePt (gm, x, y) + * gm_xxxx_movePt (gm, x, y) + * gm_xxxx_move (gm, x, y) + * gm_xxxx_resize (gm, x, y) + * gm_xxxx_rotate (gm, x, y) + * + * where xxxx is the 4 character marker class name. + */ + +/* Marker class TEXT. + */ +static int gm_text_select(); +static void gm_text_move(), gm_text_resize(); +static void gm_text_markpos(), gm_text_redraw(); +static void gm_text_update(), gm_text_updatePolygon(); + +static void +gm_text_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Text; + if (!(gm->flags & Gm_Activated)) { + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_TextLineColor; + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->textColor = w->gterm.gm_TextColor; + gm->textBgColor = w->gterm.gm_TextBgColor; + gm->textBorder = w->gterm.gm_TextBorder; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->font = w->gterm.gm_TextFont; + gm->imageText = False; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->npoints = 4 + 1; + gm->points = gm->point_data; + + gm->select = gm_text_select; + gm->markpos = gm_text_markpos; + gm->redraw = gm_text_redraw; + gm->update = gm_text_update; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_text_move; + gm->resize = gm_text_resize; + gm->rotate = NULL; + + if (w->gterm.gm_TextString) { + if (gm->text) + XtFree (gm->text); + gm->text = (char *) XtMalloc (strlen(w->gterm.gm_TextString)+1); + strcpy (gm->text, w->gterm.gm_TextString); + } else + gm->text = NULL; +} + +static int +gm_text_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + + +static void +gm_text_markpos (gm) + register Marker gm; +{ + gm_markpos (gm); +} + + +static void +gm_text_redraw (gm, function) + register Marker gm; + int function; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + int char_width, char_height, xsize, ysize; + int breakline, l_pix, r_pix, maxch, x, y; + XFontStruct *fp = gm->font; + char *ip, *op, *otop; + char *l_ip, *l_op; + char line[1024]; + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + /* In rubber-band mode just draw the outline of the text region. */ + if (function == GXxor) { + int save_lineWidth = gm->lineWidth; + + if (gm->lineWidth <= 0) + gm->lineWidth = 1; + gm_redraw (gm, function); + gm->lineWidth = save_lineWidth; + return; + } + + /* General case. First draw the text box. */ + gm_redraw (gm, function); + + /* Now draw the text. */ + if (!gm->text) + return; + + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + xsize = gm->width; + ysize = gm->height; + + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + if ((maxch = (xsize - l_pix - r_pix) / char_width) < 1) + return; + + x = gm->x + (gm->lineWidth + 1) / 2 + gm->textBorder + 1; + y = gm->y + (gm->lineWidth + 1) / 2 + gm->textBorder + + fp->max_bounds.ascent; + + XSetForeground (w->gterm.display, w->gterm.gm_drawGC, gm->textColor); + XSetBackground (w->gterm.display, w->gterm.gm_drawGC, gm->textBgColor); + XSetFont (w->gterm.display, w->gterm.gm_drawGC, fp->fid); + + /* Fill lines in a multiline text box. + */ + l_ip = l_op = NULL; + otop = line + maxch; + breakline = 0; + + for (ip = gm->text, op=line; *ip || op > line; ) { + if (! *ip) { + breakline++; + } else if (*ip == ' ' || *ip == '\t') { + l_ip = ip; + l_op = op; + *op++ = ' '; + ip++; + } else if (*ip == '\n') { + ip++; + breakline++; + } else + *op++ = *ip++; + + if (breakline || op > otop) { + if (op > otop) { + if (l_ip && l_op) { + ip = l_ip + 1; + *l_op = '\0'; + } else { + while (op > otop) { + if (ip > gm->text && isprint (*(ip-1))) + --ip; + --op; + } + *op = '\0'; + } + } else + *op = '\0'; + + if (gm->imageText) { + while (op < otop) + *op++ = ' '; + *op = '\0'; + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } else { + XDrawString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } + + y += char_height; + if (breakline) + y += gm->textBorder; + if (y + fp->max_bounds.descent > gm->y + ysize) + break; + + op = line; + l_ip = l_op = NULL; + breakline = 0; + } + } +} + + +static void +gm_text_update (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + if (gm->flags & Gm_Modified) { + gm_text_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_text_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = max (0, x - gm->width / 2); + new_gm.y = max (0, y - gm->height / 2); + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); /* corner */ + + gm->x = new_gm.x; + gm->y = new_gm.y; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = abs (x - gm->x); + new_gm.height = abs (y - gm->y); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = new_gm.width; + gm->height = new_gm.height; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_updatePolygon (gm) + register Marker gm; +{ + register XPoint *p = gm->points; + int xsize = gm->width; + int ysize = gm->height; + + p[0].x = gm->x; p[0].y = gm->y; + p[1].x = gm->x; p[1].y = gm->y + ysize; + p[2].x = gm->x + xsize; p[2].y = gm->y + ysize; + p[3].x = gm->x + xsize; p[3].y = gm->y; + p[4].x = gm->x; p[4].y = gm->y; +} + + +/* Marker class LINE. + */ +static void +gm_line_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Line; + /* stub out for now */ +} + + +/* Marker class POLYLINE. + */ +static void +gm_plin_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Polyline; + /* stub out for now */ +} + + +/* Marker class RECTANGLE. + */ +static int gm_rect_select(); +static void gm_rect_move(), gm_rect_resize(), gm_rect_rotate(); +static void gm_rect_update(), gm_rect_updatePolygon(); + +static void +gm_rect_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Rectangle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_rect_select; + gm->markpos = gm_markpos; + gm->update = gm_rect_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_rect_move; + gm->resize = gm_rect_resize; + gm->rotate = gm_rect_rotate; +} + +static void +gm_rect_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_rect_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_rect_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_resize (gm, x, y) + register Marker gm; + int x, y; +{ + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + if (rx < 0) + new_gm.x = gm->x - (-rx - gm->width) / 2; + else + new_gm.x = gm->x + (rx - gm->width) / 2; + + if (ry < 0) + new_gm.y = gm->y - (-ry - gm->height) / 2; + else + new_gm.y = gm->y + (ry - gm->height) / 2; + + new_gm.width = gm->width + (abs(rx) - gm->width) / 2; + new_gm.height = gm->height + (abs(ry) - gm->height) / 2; + + gm_constraint (gm, &new_gm, Gb_X|Gb_Y|Gb_Width|Gb_Height); + gm->x = new_gm.x; + gm->y = new_gm.y; + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_rect_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class BOX. A box marker is like a rectangle except that it is + * described and resized by the center and radius (width/height), like + * the other "centered" marker types (circle, ellipse, etc.). + */ +static int gm_boxx_select(); +static void gm_boxx_move(), gm_boxx_resize(), gm_boxx_rotate(); +static void gm_boxx_update(), gm_boxx_updatePolygon(); + +static void +gm_boxx_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Box; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_boxx_select; + gm->markpos = gm_markpos; + gm->update = gm_boxx_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_boxx_move; + gm->resize = gm_boxx_resize; + gm->rotate = gm_boxx_rotate; +} + +static void +gm_boxx_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_boxx_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_boxx_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_resize (gm, x, y) + register Marker gm; + int x, y; +{ + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_boxx_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class CIRCLE. + */ +static int gm_circ_select(); +static void gm_circ_move(), gm_circ_resize(), gm_circ_rotate(); +static void gm_circ_update(), gm_circ_updatePolygon(); + +static void +gm_circ_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Circle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_CircleLineColor; + gm->knotColor = w->gterm.gm_CircleKnotColor; + gm->knotSize = w->gterm.gm_CircleKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + gm->width = gm->height = (gm->width + gm->height) / 2.0; + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE + 1; + + gm->select = gm_circ_select; + gm->markpos = gm_markpos; + gm->update = gm_circ_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_circ_move; + gm->resize = gm_circ_resize; + gm->rotate = NULL; +} + +static void +gm_circ_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_circ_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_circ_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = new_gm.height = + sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = gm->height = new_gm.width; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double theta, x, y; + + npts = (gm->npoints - 1) / 4; + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x + gm->x; + p[npts*0+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x + gm->x; + p[npts*1+j].y = y + gm->y; + + y = -y; j = i; + p[npts*2+j].x = x + gm->x; + p[npts*2+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x + gm->x; + p[npts*3+j].y = y + gm->y; + } + + p[gm->npoints-1] = p[0]; +} + + +/* Marker class ELLIPSE. + */ +static int gm_elip_select(); +static void gm_elip_move(), gm_elip_resize(), gm_elip_rotate(); +static void gm_elip_update(), gm_elip_updatePolygon(); + +static void +gm_elip_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Ellipse; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_EllipseLineColor; + gm->knotColor = w->gterm.gm_EllipseKnotColor; + gm->knotSize = w->gterm.gm_EllipseKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE + 1; + + gm->select = gm_elip_select; + gm->markpos = gm_markpos; + gm->update = gm_elip_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_elip_move; + gm->resize = gm_elip_resize; + gm->rotate = gm_elip_rotate; +} + +static void +gm_elip_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_elip_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_elip_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta = -(gm->rotangle); + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos(theta) - y * sin(theta); + ry = x * sin(theta) + y * cos(theta); + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + new_gm.rotangle = gm_niceAngle (theta); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_elip_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double cos_rotangle, sin_rotangle; + double theta, x, y; + + npts = (gm->npoints - 1) / 4; + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*0+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*1+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; j = i; + p[npts*2+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*2+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*3+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + } + + p[gm->npoints-1] = p[0]; +} + + +/* Marker class POLYGON. + */ +static int gm_pgon_select(); +static void gm_pgon_addPt(), gm_pgon_deletePt(), gm_pgon_movePt(); +static void gm_pgon_move(), gm_pgon_resize(), gm_pgon_rotate(); +static void gm_pgon_redraw(), gm_pgon_update(), gm_pgon_updatePolygon(); + +static void +gm_pgon_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + register DPoint *p; + + gm->type = Gm_Polygon; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_PgonLineColor; + gm->knotColor = w->gterm.gm_PgonKnotColor; + gm->knotSize = w->gterm.gm_PgonKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + + gm->npoints = gm->pgon_npts = 4 + 1; + gm->points = gm->point_data; + if (gm->pgon) + XtFree ((char *)gm->pgon); + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + gm->x = w->gterm.last_x; + gm->y = w->gterm.last_y; + + if (p) { + p[0].x = -1; p[0].y = -1; + p[1].x = -1; p[1].y = 1; + p[2].x = 1; p[2].y = 1; + p[3].x = 1; p[3].y = -1; + p[4].x = -1; p[4].y = -1; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + + if (interactive) + gm->flags |= Gm_PgonInit; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + /* The following gets executed when an existing non-polygon marker is + * turned into a polygon marker. + */ + if (gm->pgon && gm->pgon_npts) + gm->npoints = gm->pgon_npts; + else { + gm->npoints = gm->pgon_npts = 4 + 1; + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + + if (p) { + p[0].x = -gm->width; p[0].y = -gm->height; + p[1].x = -gm->width; p[1].y = gm->height; + p[2].x = gm->width; p[2].y = gm->height; + p[3].x = gm->width; p[3].y = -gm->height; + p[4].x = -gm->width; p[4].y = -gm->height; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + } + + gm->select = gm_select; + gm->markpos = gm_markpos; + gm->update = gm_pgon_update; + gm->redraw = gm_pgon_redraw; + gm->addPt = gm_pgon_addPt; + gm->deletePt = gm_pgon_deletePt; + gm->movePt = gm_pgon_movePt; + gm->move = gm_pgon_move; + gm->resize = gm_pgon_resize; + gm->rotate = gm_pgon_rotate; +} + +static void +gm_pgon_redraw (gm, function) + register Marker gm; + int function; +{ + /* The PgonInit flag is set when a polygon marker is interactively created + * to cause any pointer motion event to resize the marker. The first + * pointer up causes a redraw which clears the flag. + */ + if (function != GXxor && gm->width > 1 && gm->height > 1) + gm->flags &= ~Gm_PgonInit; + + gm_redraw (gm, function); +} + +static void +gm_pgon_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_pgon_addPt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + int vertex, nbytes; + double rx, ry; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Add the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + nbytes = (gm->npoints + 1) * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + + gm->pgon = pv; + memmove (&pv[vertex+2], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + pv[vertex+1].x = rx; + pv[vertex+1].y = ry; + gm->npoints++; + + nbytes = gm->npoints * sizeof (XPoint); + if (gm->npoints > GM_MAXVERTICES) { + if (gm->points != gm->point_data) + gm->points = (XPoint *) XtRealloc ((char *)gm->points, nbytes); + else + gm->points = (XPoint *) XtMalloc (nbytes); + } else + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_deletePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + int vertex, nbytes; + + if (gm->npoints <= 2) + return; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Delete the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + pv = gm->pgon; + + memmove (&pv[vertex], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + gm->npoints--; + + nbytes = gm->npoints * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + gm->pgon = pv; + + if (gm->npoints <= GM_MAXVERTICES && gm->points != gm->point_data) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_movePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double rx, ry; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get vertex. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + + /* Edit point. */ + p->x = rx; + p->y = ry; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + gm->x = new_gm.x; gm->y = new_gm.y; + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_resize (gm, x, y) + Marker gm; + int x, y; +{ + register DPoint *p, *q; + GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double theta, scale, slope, rx, ry, x1, y1, x2, y2, xi; + int vertex, i; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get first vertex of nearest edge. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + q = p + 1; + + /* Rotate reference frame so that intercept is at y=0. */ + if (abs(rx) + abs(ry) < 1.0) + scale = 1.0; + else { + theta = atan2 (ry, rx); + cos_rotangle = cos (-theta); + sin_rotangle = sin (-theta); + + x1 = p->x * cos_rotangle - p->y * sin_rotangle; + y1 = p->x * sin_rotangle + p->y * cos_rotangle; + x2 = q->x * cos_rotangle - q->y * sin_rotangle; + y2 = q->x * sin_rotangle + q->y * cos_rotangle; + + /* Compute scale factor. */ + if (y1 == y2 || x1 == x2) + scale = 1.0; + else { + slope = (y2 - y1) / (x2 - x1); + xi = x1 - y1 / slope; + scale = sqrt (SQR(rx) + SQR(ry)) / xi; + } + } + + /* Rescale the polygon. */ + for (i=0, p=gm->pgon; i < gm->npoints; i++, p++) { + p->x *= scale; + p->y *= scale; + } + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double scale, alpha, beta, rx, ry; + struct marker new_gm; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + if (x == gm->x && y == gm->y) + return; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + if (abs(rx) + abs(ry) < 1.0) + return; + + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + + p = &gm->pgon[vertex]; + alpha = atan2 (p->y, p->x); + beta = atan2 (ry, rx); + + new_gm.rotangle = gm_niceAngle (gm->rotangle + (beta - alpha)); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_updatePolygon (gm) + Marker gm; +{ + register npts, i; + register DPoint *ip = gm->pgon; + register XPoint *op = gm->points; + double cos_rotangle, sin_rotangle; + int width, height, xp, xn, yp, yn; + + npts = gm->npoints; + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + xp = xn = yp = yn = 0; + + for (i=0; i < npts; i++, ip++, op++) { + /* Compute the rotated point. */ + op->x = ip->x * cos_rotangle - ip->y * sin_rotangle + gm->x + 0.5; + op->y = ip->x * sin_rotangle + ip->y * cos_rotangle + gm->y + 0.5; + + /* Compute a width/height estimate for the polygon. + */ + if (ip->x > xp) + xp = ip->x; + else if (ip->x < xn) + xn = ip->x; + + if (ip->y > yp) + yp = ip->y; + else if (ip->y < yn) + yn = ip->y; + + gm->width = (xp + -xn) / 2; + gm->height = (yp + -yn) / 2; + } + + gm->points[npts-1] = gm->points[0]; + gm->pgon_npts = gm->npoints; +} + + +/* Internal procedures for above code. + * ----------------------------------- + */ + +/* gm_select -- Determine if a point is within or near a marker, and if so, + * determine whether the point selects a vertex, edge, or the entire marker. + */ +static int +gm_select (gm, x, y, what) + Marker gm; + register int x, y; + GmSelection what; +{ + register XPoint *p, *ptop; + GtermWidget w = gm->w; + int v_dist = w->gterm.gm_nearVertex; + int e_dist = w->gterm.gm_nearEdge; + double seglen, d1, d2, s, K, frac; + int ncrossings, x0, y0; + XPoint *q; + int n; + + /* Determine if the point is near a vertex. */ + for (p = gm->points, n = gm->npoints - 1; --n >= 0; p++) + if (abs (x - p->x) < v_dist && abs (y - p->y) < v_dist) { + if (what) { + what->type = Ge_Point; + what->vertex = p - gm->points; + } + return (1); + } + + /* Determine if the point is near an edge. The test is based on the + * observation that when a point is near a line segment, the sum of the + * distances from the point to either end-point of the line segment is + * nearly the same as the length of the line segment. + */ + p = gm->points; + ptop = p + gm->npoints; + x0 = p->x; y0 = p->y; + d1 = sqrt ((double)(SQR(x - x0) + SQR(y - y0))); + + for (p++; p < ptop; p++) { + seglen = sqrt ((double)(SQR(p->x - x0) + SQR(p->y - y0))); + d2 = sqrt ((double)(SQR(x - p->x) + SQR(y - p->y))); + + if (d1 + d2 - seglen < e_dist) { + if (what) { + what->type = Ge_Edge; + what->vertex = (p - 1) - gm->points; + } + return (1); + } + + d1 = d2; + x0 = p->x; y0 = p->y; + } + + /* If the marker is one of the closed polygon types, determine if the + * point is inside the marker. + */ + switch (gm->type) { + case Gm_Line: + case Gm_Polyline: + return (0); + } + + for (p = gm->points, ncrossings=0; p < ptop; p++) { + /* Scan forward until we find a line segment that crosses Y. + */ + if (p->y > y) { + for (p++; p < ptop && p->y >= y; p++) + ; + --p; + } else if (p->y < y) { + for (p++; p < ptop && p->y <= y; p++) + ; + --p; + } + + /* The line segment p[0]:p[1] crosses the Y plane. If this lies + * entirely to the left of the X plane we can ignore it. If any + * portion of the line segment lies to the right of X we compute + * the point where the line intersects the Y plane. If this point + * is to the right of the X plane we have a crossing. + */ + q = p + 1; + if (q < ptop && p->x > x || q->x > x) { + if (q->y == p->y) + frac = (double) 0.0; + else + frac = (double)(y - p->y) / (double)(q->y - p->y); + if ((frac * (q->x - p->x) + p->x) >= x) + ncrossings++; + } + } + + if (ncrossings & 1) { + if (what) + what->type = Ge_Marker; + return (1); + } + + return (0); +} + + +/* gm_markpos -- Mark the current position of a marker. + */ +static void +gm_markpos (gm) + register Marker gm; +{ + gm->old_rect = gm->cur_rect; + XUnionRegion (gm->cur_region, null_region, gm->old_region); +} + + +/* gm_redraw -- Redraw a marker expressed as a list of vertices. + */ +static void +gm_redraw (gm, function) + register Marker gm; + int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + int flags = (Gm_Activated|Gm_Visible); + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!XtIsRealized ((Widget)w)) + return; + if (!((gm->flags & flags) == flags)) + return; + + /* Fill the polygon area if indicated. */ + if (gm->fill && function != GXxor) { + if (gm->fillPattern) { + XSetStipple (display, gc, gm->fillPattern); + XSetForeground (display, gc, gm->fillColor); + XSetBackground (display, gc, gm->fillBgColor); + XSetFillStyle (display, gc, gm->fillStyle); + } else { + XSetForeground (display, gc, gm->fillColor); + XSetFillStyle (display, gc, FillSolid); + } + + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Nonconvex, CoordModeOrigin); + } + + /* Set up the drawing GC. */ + if (function != GXxor) { + XSetFunction (display, gc, function); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, (gm == w->gterm.gm_active) ? + gm->highlightColor : gm->lineColor); + + XSetLineAttributes (display, gc, + gm->lineWidth + + ((gm == w->gterm.gm_active) ? w->gterm.gm_highlightWidth : 0), + gm->lineStyle, + CapButt, + (gm->type == Gm_Polygon || gm->type == Gm_Polyline) ? + JoinBevel : JoinMiter); + } + + /* Draw the marker outline. */ + if (gm->lineWidth > 0) { + if (gm->type == Gm_Circle || + (gm->type == Gm_Ellipse && abs(gm->rotangle) < 0.01)) { + + /* Special case - use X arc drawing primitive. We could use the + * gm->points polygon instead, as this outline polygon is + * maintained for all classes of marker. + */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + } + XDrawArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + + } else { + /* Draw marker expressed as a polygon. */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Convex, CoordModeOrigin); + } + XDrawLines (display, window, gc, + gm->points, gm->npoints, CoordModeOrigin); + } + } + + /* Draw the knots if enabled. */ + if (function != GXxor && gm->knotSize > 0) { + int knotsize = gm->knotSize; + int halfsize = gm->knotSize / 2; + int i; + + XSetForeground (display, gc, gm->knotColor); + for (i=0; i < gm->npoints; i++) { + XFillRectangle (display, window, gc, + gm->points[i].x - halfsize, gm->points[i].y - halfsize, + gm->knotSize, gm->knotSize); + } + } +} + + +/* gm_setCurRect -- Compute a bounding rectangle which completely encloses + * a marker (assumes that the marker is expressed as list of points). + */ +static void +gm_setCurRect (gm) +Marker gm; +{ + int border; + + XDestroyRegion (gm->cur_region); + gm->cur_rect = null_rect; + + if (gm->npoints <= 0) + gm->cur_region = XCreateRegion(); + else { + gm->cur_region = XPolygonRegion (gm->points, gm->npoints, EvenOddRule); + border = (max (gm->lineWidth, gm->knotSize) + 1) / 2; + border = max (border, BORDER); + XShrinkRegion (gm->cur_region, -border, -border); + XClipBox (gm->cur_region, &gm->cur_rect); + } +} + + +/* gm_niceAngle -- Round a rotation angle to a "nice" value. + */ +static double +gm_niceAngle (alpha) + double alpha; +{ + double tol = 0.003; + double beta; + + if ( abs (alpha - PI_2*0) < tol) + beta = PI_2*0; + else if (abs (alpha - PI_2*1) < tol) + beta = PI_2*1; + else if (abs (alpha - PI_2*2) < tol) + beta = PI_2*2; + else if (abs (alpha - PI_2*3) < tol) + beta = PI_2*3; + else if (abs (alpha - PI_2*4) < tol) + beta = PI_2*0; + else + beta = alpha; + + return (beta); +} diff --git a/vendor/x11iraf/obm/ObmW/Gterm.h b/vendor/x11iraf/obm/ObmW/Gterm.h new file mode 100644 index 00000000..a8a4cb48 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm.h @@ -0,0 +1,306 @@ +#ifndef _Gterm_h +#define _Gterm_h + +/* Parameters: +(this is not yet updated for xgterm - the rest of this file is) + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel White + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + foreground Foreground Pixel Black + height Height Dimension 240 + mappedWhenManaged MappedWhenManaged Boolean True + reverseVideo ReverseVideo Boolean False + width Width Dimension 320 + x Position Position 0 + y Position Position 0 + +*/ + +/* + * Resource definitions. + */ +#define XtCInt "Int" + +#define XtNalphaFont1 "alphaFont1" +#define XtNalphaFont2 "alphaFont2" +#define XtNalphaFont3 "alphaFont3" +#define XtNalphaFont4 "alphaFont4" +#define XtNalphaFont5 "alphaFont5" +#define XtNalphaFont6 "alphaFont6" +#define XtNalphaFont7 "alphaFont7" +#define XtNalphaFont8 "alphaFont8" + +#define XtNdialogFont1 "dialogFont1" +#define XtNdialogFont2 "dialogFont2" +#define XtNdialogFont3 "dialogFont3" +#define XtNdialogFont4 "dialogFont4" +#define XtNdialogFont5 "dialogFont5" +#define XtNdialogFont6 "dialogFont6" +#define XtNdialogFont7 "dialogFont7" +#define XtNdialogFont8 "dialogFont8" + +#define XtNdialogBgColor "dialogBgColor" +#define XtNdialogFgColor "dialogFgColor" +#define XtNidleCursorBgColor "idleCursorBgColor" +#define XtNidleCursorFgColor "idleCursorFgColor" +#define XtNbusyCursorBgColor "busyCursorBgColor" +#define XtNbusyCursorFgColor "busyCursorFgColor" +#define XtNginmodeCursorBgColor "ginmodeCursorBgColor" +#define XtNginmodeCursorFgColor "ginmodeCursorFgColor" +#define XtNginmodeBlinkInterval "ginmodeBlinkInterval" +#define XtNcrosshairCursorColor "crosshairCursorColor" + +#define XtNidleCursor "idleCursor" +#define XtNbusyCursor "busyCursor" +#define XtNginmodeCursor "ginmodeCursor" +#define XtNwarpCursor "warpCursor" +#define XtNraiseWindow "raiseWindow" +#define XtNdeiconifyWindow "deiconifyWindow" +#define XtNuseTimers "useTimers" + +#define XtNcolor0 "color0" +#define XtNcolor1 "color1" +#define XtNcolor2 "color2" +#define XtNcolor3 "color3" +#define XtNcolor4 "color4" +#define XtNcolor5 "color5" +#define XtNcolor6 "color6" +#define XtNcolor7 "color7" +#define XtNcolor8 "color8" +#define XtNcolor9 "color9" + +#define XtNcmapName "cmapName" +#define XtNuseGlobalCmap "useGlobalCmap" +#define XtNcmapInitialize "cmapInitialize" +#define XtNcopyOnResize "copyOnResize" +#define XtNbasePixel "basePixel" +#define XtNcmapUpdate "cmapUpdate" +#define XtNcmapShadow "cmapShadow" +#define XtNcmapInterpolate "cmapInterpolate" +#define XtNmaxRasters "maxRasters" +#define XtNcacheRasters "cacheRasters" +#define XtNmaxMappings "maxMappings" +#define XtNmaxColors "maxColors" + +#define XtNmarkerTranslations "markerTranslations" +#define XtNdefaultMarker "defaultMarker" +#define XtNnearEdge "nearEdge" +#define XtNnearVertex "nearVertex" +#define XtNmarkerLineWidth "markerLineWidth" +#define XtNmarkerLineStyle "markerLineStyle" +#define XtNmarkerFill "markerFill" +#define XtNmarkerFillColor "markerFillColor" +#define XtNmarkerFillBgColor "markerFillBgColor" +#define XtNmarkerFillStyle "markerFillStyle" +#define XtNxorFill "xorFill" +#define XtNxorFillColor "xorFillColor" +#define XtNxorFillBgColor "xorFillBgColor" +#define XtNmarkerHighlightWidth "markerHighlightWidth" +#define XtNmarkerHighlightColor "markerHighlightColor" +#define XtNmarkerCursorFgColor "markerCursorFgColor" +#define XtNmarkerCursorBgColor "markerCursorBgColor" +#define XtNmarkerLineLineColor "markerLineLineColor" +#define XtNmarkerLineKnotColor "markerLineKnotColor" +#define XtNmarkerLineKnotSize "markerLineKnotSize" +#define XtNmarkerTextLineColor "markerTextLineColor" +#define XtNmarkerTextColor "markerTextColor" +#define XtNmarkerTextBgColor "markerTextBgColor" +#define XtNmarkerTextBorder "markerTextBorder" +#define XtNmarkerTextFont "markerTextFont" +#define XtNmarkerTextString "markerTextString" +#define XtNmarkerRectLineColor "markerRectLineColor" +#define XtNmarkerRectKnotColor "markerRectKnotColor" +#define XtNmarkerRectKnotSize "markerRectKnotSize" +#define XtNmarkerBoxLineColor "markerBoxLineColor" +#define XtNmarkerBoxKnotColor "markerBoxKnotColor" +#define XtNmarkerBoxKnotSize "markerBoxKnotSize" +#define XtNmarkerCircleLineColor "markerCircleLineColor" +#define XtNmarkerCircleKnotColor "markerCircleKnotColor" +#define XtNmarkerCircleKnotSize "markerCircleKnotSize" +#define XtNmarkerEllipseLineColor "markerEllipseLineColor" +#define XtNmarkerEllipseKnotColor "markerEllipseKnotColor" +#define XtNmarkerEllipseKnotSize "markerEllipseKnotSize" +#define XtNmarkerPgonLineColor "markerPgonLineColor" +#define XtNmarkerPgonKnotColor "markerPgonKnotColor" +#define XtNmarkerPgonKnotSize "markerPgonKnotSize" + + +/* Deep Frame Definitions */ +#define XtNdialogBgColorStr "dialogBgColorStr" +#define XtNdialogFgColorStr "dialogFgColorStr" +#define XtNidleCursorBgColorStr "idleCursorBgColorStr" +#define XtNidleCursorFgColorStr "idleCursorFgColorStr" +#define XtNbusyCursorBgColorStr "busyCursorBgColorStr" +#define XtNbusyCursorFgColorStr "busyCursorFgColorStr" +#define XtNginmodeCursorBgColorStr "ginmodeCursorBgColorStr" +#define XtNginmodeCursorFgColorStr "ginmodeCursorFgColorStr" +#define XtNcrosshairCursorColorStr "crosshairCursorColorStr" + +#define XtNcolor0Str "color0Str" +#define XtNcolor1Str "color1Str" +#define XtNcolor2Str "color2Str" +#define XtNcolor3Str "color3Str" +#define XtNcolor4Str "color4Str" +#define XtNcolor5Str "color5Str" +#define XtNcolor6Str "color6Str" +#define XtNcolor7Str "color7Str" +#define XtNcolor8Str "color8Str" +#define XtNcolor9Str "color9Str" + +#define XtNmarkerFillColorStr "markerFillColorStr" +#define XtNmarkerFillBgColorStr "markerFillBgColorStr" + +#define XtNmarkerHighlightColorStr "markerHighlightColorStr" +#define XtNmarkerCursorFgColorStr "markerCursorFgColorStr" +#define XtNmarkerCursorBgColorStr "markerCursorBgColorStr" + +#define XtNmarkerLineLineColorStr "markerLineLineColorStr" +#define XtNmarkerLineKnotColorStr "markerLineKnotColorStr" + +#define XtNmarkerTextLineColorStr "markerTextLineColorStr" +#define XtNmarkerTextColorStr "markerTextColorStr" +#define XtNmarkerTextBgColorStr "markerTextBgColorStr" + +#define XtNmarkerRectLineColorStr "markerRectLineColorStr" +#define XtNmarkerRectKnotColorStr "markerRectKnotColorStr" + +#define XtNmarkerBoxLineColorStr "markerBoxLineColorStr" +#define XtNmarkerBoxKnotColorStr "markerBoxKnotColorStr" + +#define XtNmarkerCircleLineColorStr "markerCircleLineColorStr" +#define XtNmarkerCircleKnotColorStr "markerCircleKnotColorStr" + +#define XtNmarkerEllipseLineColorStr "markerEllipseLineColorStr" +#define XtNmarkerEllipseKnotColorStr "markerEllipseKnotColorStr" + +#define XtNmarkerPgonLineColorStr "markerPgonLineColorStr" +#define XtNmarkerPgonKnotColorStr "markerPgonKnotColorStr" + +#define XtNmarkerPointLineColorStr "markerPointLineColorStr" +#define XtNmarkerPointKnotColorStr "markerPointKnotColorStr" +/* Deep Frame Definitions */ + + + +/* + * Gterm widget flags. + */ +#define GtSet 1 /* drawing mode */ +#define GtClear 2 +#define GtInvert 3 + +#define GtOutline 1 /* line styles */ +#define GtPoint 2 +#define GtSolid 3 +#define GtDashed 4 +#define GtDotted 5 +#define GtDashDot 6 +#define GtDash3Dot 7 + +#define GtNoCursor 0 /* cursor types */ +#define GtGinmodeCursor 1 +#define GtBusyCursor 2 +#define GtIdleCursor 3 + +#define GtDefault 0 /* raster types */ +#define GtClient 1 +#define GtServer 2 + +#define GtPixel 0 /* coordinate types */ +#define GtNDC 1 + +#define GtMap 0 /* mapping direction */ +#define GtUnmap 1 + +#define GtWindow 0 /* drawable types */ +#define GtWidget 1 + +#define R_OpcodeMask 0000017 /* rasterop definitions */ +#define R_Transient 0000020 +#define R_RefreshAll 0000040 +#define R_RefreshNone 0000100 +#define R_MFMask 0777000 + +#define MF_NEAREST 0001000 /* antialiasing functions */ +#define MF_BILINEAR 0002000 +#define MF_AREA 0004000 +#define MF_BLKAVG 0010000 +#define MF_BOXCAR 0020000 +#define MF_LOWPASS 0040000 +#define MF_GAUSSIAN 0100000 + +#define GmText "text" /* graphics marker types */ +#define GmLine "line" +#define GmPolyline "polyline" +#define GmRectangle "rectangle" +#define GmBox "box" +#define GmCircle "circle" +#define GmEllipse "ellipse" +#define GmPolygon "polygon" + +#define Gm_Text 1 /* integer codes for above */ +#define Gm_Line 2 +#define Gm_Polyline 3 +#define Gm_Rectangle 4 +#define Gm_Box 5 +#define Gm_Circle 6 +#define Gm_Ellipse 7 +#define Gm_Polygon 8 +#define Gm_NTypes 8 + +#define GmType "type" /* marker attributes */ +#define GmActivated "activated" +#define GmVisible "visible" +#define GmSensitive "sensitive" +#define GmAutoRedraw "autoRedraw" +#define GmTranslations "translations" +#define GmX "x" +#define GmY "y" +#define GmWidth "width" +#define GmHeight "height" +#define GmRotangle "rotangle" +#define GmHighlightColor "highlightColor" +#define GmLineColor "lineColor" +#define GmLineWidth "lineWidth" +#define GmLineStyle "lineStyle" +#define GmKnotColor "knotColor" +#define GmKnotSize "knotSize" +#define GmFill "fill" +#define GmFillColor "fillColor" +#define GmFillBgColor "fillBgColor" +#define GmFillPattern "fillPattern" +#define GmFillStyle "fillStyle" +#define GmTextColor "textColor" +#define GmTextBgColor "textBgColor" +#define GmTextBorder "textBorder" +#define GmImageText "imageText" +#define GmFont "font" +#define GmRotIndicator "rotIndicator" /* MF020 */ + +#define GmEvNotify 00001 /* marker callback events */ +#define GmEvMoveResize 00002 +#define GmEvModify 00004 +#define GmEvRedraw 00010 +#define GmEvDestroy 00020 +#define GmEvInput 00040 +#define GmEvFocusIn 00100 +#define GmEvFocusOut 00200 +#define GmEvConstraint 00400 + +/* Double version of XPoint. */ +struct dPoint { + double x; + double y; +}; +typedef struct dPoint DPoint; + +typedef struct _GtermRec *GtermWidget; +typedef struct _GtermClassRec *GtermWidgetClass; + +extern WidgetClass gtermWidgetClass; + +#endif /* _Gterm_h */ diff --git a/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c b/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c new file mode 100644 index 00000000..a3f9203a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c @@ -0,0 +1,12188 @@ +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/XawInit.h> +#include "GtermP.h" + +/* + * Gterm -- Graphics terminal widget. This widget implements only the + * window specific graphics output and graphics window input functions. + * Protocol translation (e.g. Tek emulation) and i/o is done elsewhere; + * see for example gtermio.c. + */ + +#define DefaultAlphaFont 3 +#define DefaultDialogFont 3 +#define DefaultMarkerTextFont 3 +#define ZOOM_TOL 0.0001 + +#define CacheXImage 1 /* MF004 */ + +static Dimension defXDim = DEF_WIDTH; +static Dimension defYDim = DEF_HEIGHT; + +/* Default translations for Gterm window. */ +/* Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) */ + +static char defaultGtermTranslations[] = +"\ + <Btn1Down>: m_create() \n\ + <Btn2Down>: crosshair(on) \n\ + <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() \n\ +"; + +/* Default translations when pointer is over a marker. */ +static char defaultMarkerTranslations[] = +"\ + !Shift <Btn1Motion>: m_rotateResize() \n\ + <Btn1Motion>: m_moveResize() \n\ + !Shift <Btn1Down>: m_raise() m_markpos() \n\ + <Btn1Down>: m_raise() m_markposAdd() \n\ + <Btn1Up>: m_redraw() m_destroyNull() \n\ + <Btn2Down>: m_lower() \n\ + <Key>BackSpace: m_deleteDestroy() \n\ + <Key>Delete: m_deleteDestroy() \n\ + <KeyPress>: m_input() \n\ + <Motion>: track-cursor() \n\ +"; + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defXDim}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defYDim}, + + {XtNalphaFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont1), XtRString, "nil2"}, + {XtNalphaFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont2), XtRString, "5x8"}, + {XtNalphaFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont3), XtRString, "6x10"}, + {XtNalphaFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont4), XtRString, "7x13"}, + {XtNalphaFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont5), XtRString, "8x13"}, + {XtNalphaFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont6), XtRString, "9x15"}, + {XtNalphaFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont7), XtRString, "9x15"}, + {XtNalphaFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont8), XtRString, "9x15"}, + + {XtNdialogFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont1), XtRString, "nil2"}, + {XtNdialogFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont2), XtRString, "5x8"}, + {XtNdialogFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont3), XtRString, "6x13"}, + {XtNdialogFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont4), XtRString, "7x13"}, + {XtNdialogFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont5), XtRString, "8x13"}, + {XtNdialogFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont6), XtRString, "9x15"}, + {XtNdialogFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont7), XtRString, "9x15"}, + {XtNdialogFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont8), XtRString, "9x15"}, + + {XtNdialogBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogBgColor), XtRString, "yellow"}, + {XtNdialogFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogFgColor), XtRString, "black"}, + {XtNidleCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorBgColor), XtRString, "white"}, + {XtNidleCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorFgColor), XtRString, "black"}, + {XtNbusyCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorBgColor), XtRString, "white"}, + {XtNbusyCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorFgColor), XtRString, "black"}, + {XtNginmodeCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColor), XtRString, "black"}, + {XtNginmodeCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColor), XtRString, "white"}, + {XtNginmodeBlinkInterval, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.ginmodeBlinkInterval), XtRImmediate, 0}, + {XtNcrosshairCursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.crosshairCursorColor), XtRString, "red"}, + + {XtNidleCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursor), XtRString, "plus"}, + {XtNbusyCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursor), XtRString, "watch"}, + {XtNginmodeCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursor), XtRString, "full_crosshair"}, + {XtNwarpCursor, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.warpCursor), XtRImmediate, + (caddr_t)DEF_WARPCURSOR}, + {XtNraiseWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.raiseWindow), XtRImmediate, + (caddr_t)DEF_RAISEWINDOW}, + {XtNdeiconifyWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.deiconifyWindow), XtRImmediate, + (caddr_t)DEF_DEICONIFYWINDOW}, + {XtNuseTimers, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useTimers), XtRImmediate, + (caddr_t)DEF_USETIMERS}, + + {XtNcolor0, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color0), XtRString, "black"}, + {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color1), XtRString, "white"}, + {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color2), XtRString, "red"}, + {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color3), XtRString, "green"}, + {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color4), XtRString, "blue"}, + {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color5), XtRString, "cyan"}, + {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color6), XtRString, "yellow"}, + {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color7), XtRString, "magenta"}, + {XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color8), XtRString, "purple"}, + {XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color9), XtRString, "darkslategray"}, + + {XtNcopyOnResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.copyOnResize), XtRImmediate, + (caddr_t)DEF_COPYONRESIZE}, + {XtNcmapName, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cmapName), XtRImmediate, + (caddr_t)"default"}, + {XtNcmapInitialize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInitialize), XtRImmediate, + (caddr_t)FALSE}, + {XtNbasePixel, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.base_pixel), XtRImmediate, + (caddr_t)DEF_BASEPIXEL}, + {XtNcmapUpdate, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapUpdate), XtRImmediate, + (caddr_t)DEF_CMAPUPDATE}, + {XtNcmapShadow, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapShadow), XtRImmediate, + (caddr_t)DEF_CMAPSHADOW}, + {XtNcmapInterpolate, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInterpolate), XtRImmediate, + (caddr_t)True}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cacheRasters), XtRImmediate, + (caddr_t)"whenNeeded"}, + {XtNmaxRasters, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxRasters), XtRImmediate, + (caddr_t)MAX_RASTERS}, + {XtNmaxMappings, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxMappings), XtRImmediate, + (caddr_t)MAX_MAPPINGS}, + {XtNmaxColors, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxColors), XtRImmediate, + (caddr_t)DEF_MAXCOLORS}, + + {XtNmarkerTranslations, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_translations), XtRImmediate, + (caddr_t)defaultMarkerTranslations}, + {XtNdefaultMarker, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_defaultMarker), XtRImmediate, + (caddr_t)"rectangle"}, + {XtNnearEdge, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearEdge), XtRImmediate, + (caddr_t)E_DIST}, + {XtNnearVertex, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearVertex), XtRImmediate, + (caddr_t)V_DIST}, + + {XtNmarkerLineWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineWidth), XtRImmediate, + (caddr_t)1}, + {XtNmarkerLineStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineStyle), XtRImmediate, + (caddr_t)LineSolid}, + {XtNmarkerFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_fill), XtRImmediate, + (caddr_t)False}, + {XtNmarkerFillColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillColor), XtRString, + "SlateGray"}, + {XtNmarkerFillBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillBgColor), XtRString, + "black"}, + {XtNmarkerFillStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_fillStyle), XtRImmediate, + (caddr_t)FillSolid}, + {XtNxorFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_xorFill), XtRImmediate, + (caddr_t)False}, + {XtNxorFillColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillColor), XtRImmediate, + (caddr_t)2}, + {XtNxorFillBgColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillBgColor), XtRImmediate, + (caddr_t)255}, + {XtNmarkerHighlightWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_highlightWidth), XtRImmediate, + (caddr_t)2}, + {XtNmarkerHighlightColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_highlightColor), XtRString, + "green"}, + {XtNmarkerCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorFgColor), XtRString, + "yellow"}, + {XtNmarkerCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorBgColor), XtRString, + "black"}, + + {XtNmarkerLineLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineLineColor), XtRString, + "green"}, + {XtNmarkerLineKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineKnotColor), XtRString, + "blue"}, + {XtNmarkerLineKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_LineKnotSize), XtRImmediate, + (caddr_t)5}, + + {XtNmarkerTextLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextLineColor), XtRString, + "green"}, + {XtNmarkerTextColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextColor), XtRString, + "yellow"}, + {XtNmarkerTextBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextBgColor), XtRString, + "SlateGray"}, + {XtNmarkerTextBorder, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_TextBorder), XtRImmediate, + (caddr_t)2}, + {XtNmarkerTextFont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.gm_TextFont), XtRString, + "6x13"}, + {XtNmarkerTextString, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextString), XtRImmediate, + (caddr_t)NULL}, + + {XtNmarkerRectLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectLineColor), XtRString, + "green"}, + {XtNmarkerRectKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectKnotColor), XtRString, + "blue"}, + {XtNmarkerRectKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_RectKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerBoxLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxLineColor), XtRString, + "green"}, + {XtNmarkerBoxKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxKnotColor), XtRString, + "blue"}, + {XtNmarkerBoxKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_BoxKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerCircleLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleLineColor), XtRString, + "green"}, + {XtNmarkerCircleKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleKnotColor), XtRString, + "blue"}, + {XtNmarkerCircleKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_CircleKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerEllipseLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseLineColor), XtRString, + "green"}, + {XtNmarkerEllipseKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColor), XtRString, + "blue"}, + {XtNmarkerEllipseKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_EllipseKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerPgonLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonLineColor), XtRString, + "green"}, + {XtNmarkerPgonKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonKnotColor), XtRString, + "blue"}, + {XtNmarkerPgonKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_PgonKnotSize), XtRImmediate, + (caddr_t)5}, +}; + +/* extern void HandlePopupMenu(); */ +static Boolean SetValues(); +static void Initialize(), Realize(), Destroy(), Redisplay(), Resize(); +static void HandleIgnore(), HandleGraphicsInput(), HandleDisplayCrosshair(); +static void HandleSoftReset(), HandleGraphicsContext(); +static void HandleEnterWindow(), HandleLeaveWindow(); +static void color_crosshair(), color_ginmodeCursor(); +static void HandleTrackCursor(); +static void savepos(), blink_cursor(); +static void mp_linkafter(), mp_unlink(); + +Marker GmSelect(); +static void M_create(), GtMarkerFree(); +static void gm_focusin(), gm_focusout(), gm_refocus(); +static void gm_request_translations(), gm_load_translations(); +static int gm_curpos(); + +static set_default_color_index(); +static inherit_default_colormap(); +static update_default_colormap(); +static update_transients(), update_cursor(); +static request_colormap_focus(), restore_colormap_focus(); +static refresh_source(), refresh_destination(), get_regions(); +static get_rects(), scale_zoom(), scale_intzoom(), scale_boxcar(); +static lw_convolve(), bx_boxcar(), bx_extract(), bx_interp(); +static mf_getpixel(), mf_getinten(); +static scale_lowpass(), scale_nearest(), scale_bilinear(); +static save_mapping(), load_mapping(), get_pixel_mapping(); +static update_mapping(), free_mapping(), valid_mapping(), rect_intersect(); +static initialize_mapping(), draw_crosshair(), erase_crosshair(); +static DrawContext get_draw_context(); +static invalidate_draw_context(); +static XPoint *mapVector(); +static Colormap get_colormap(); +static Cursor get_cursor(); +static void init_iomap(), invalidate_cmap(); +static void gm_rotate_indicator(); /* MF020 */ +static Pixel get_pixel(), *get_cmap_in(), *get_cmap_out(); + +static void NewCachedXImage(); /* MF004 */ +static void DestroyCachedXImage(); /* MF004 */ +static XImage *GetCachedXImage(); /* MF004 */ + +extern double atof(); + +static XtActionsRec gtermActionsList[] = { + { "ignore", HandleIgnore }, + { "graphics-input", HandleGraphicsInput }, + { "crosshair", HandleDisplayCrosshair }, + { "track-cursor", HandleTrackCursor }, + { "enter-window", HandleEnterWindow }, + { "leave-window", HandleLeaveWindow }, +/* { "popup-menu", HandlePopupMenu }, */ + { "reset", HandleSoftReset }, + { "m_create", M_create }, +}; + +GtermClassRec gtermClassRec = { + { /* core fields */ + /* superclass */ &widgetClassRec, + /* class_name */ "Gterm", + /* widget_size */ sizeof(GtermRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ gtermActionsList, + /* num_actions */ XtNumber(gtermActionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ (XrmClass)NULL, + /* compress_motion */ True, + /* compress_exposure */ True, + /* compress_enterleave */ True, + /* visible_interest */ False, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultGtermTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass gtermWidgetClass = (WidgetClass) &gtermClassRec; +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +/* + * Widget class procedures. + * -------------------------- + */ + +/* ARGSUSED */ +static void +Initialize (request, new) + Widget request, new; +{ + register GtermWidget w = (GtermWidget)new; + register GC gc; + + XColor fg_color, bg_color; + XFontStruct **fp; + Font cursor_font; + Display *display; + Screen *screen; + Pixel *pp; + int i; + + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + w->gterm.display = display = XtDisplay (w); + w->gterm.screen = screen = XtScreen (w); + w->gterm.root = RootWindowOfScreen (screen); + XtVaSetValues ((Widget)w, XtNbackground, (XtArgVal)w->gterm.color0, NULL); + + /* Initialize color map. */ + pp = &w->gterm.color0; + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors (display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + w->gterm.useDefaultCM = (strcmp (w->gterm.cmapName, "default") == 0); + w->gterm.haveColormap = w->gterm.useDefaultCM; + w->gterm.cmapLastUpdate = 0; + w->gterm.cmapLastShadow = 0; + w->gterm.in_window = 0; + w->gterm.n_wmWindows = 0; /* MF012 */ + + /* Get clear pixmap GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color0); + w->gterm.clearGC = gc; + XSetGraphicsExposures (display, gc, 0); /* MF029 */ + + /* Get expose GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + w->gterm.exposeGC = gc; + XSetGraphicsExposures (display, gc, 0); /* MF029 */ + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.dialogBgColor); + XSetForeground (display, gc, w->gterm.dialogFgColor); + /* XSetFunction (display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + /* Get special cursors. */ + bg_color.pixel = w->gterm.idleCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.idleCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.idle_cursor = get_cursor (w, w->gterm.idleCursor); + XRecolorCursor (display, w->gterm.idle_cursor, &fg_color, &bg_color); + /* MF030 */ + + bg_color.pixel = w->gterm.busyCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.busyCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.busy_cursor = get_cursor (w, w->gterm.busyCursor); + XRecolorCursor (display, w->gterm.busy_cursor, &fg_color, &bg_color); + /* MF030 */ + + bg_color.pixel = w->gterm.color0; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, w->core.colormap, &fg_color); + cursor_font = XLoadFont (display, "cursor"); + w->gterm.crosshair_cursor = XCreateGlyphCursor (display, + cursor_font, cursor_font, XC_crosshair, XC_crosshair, + &fg_color, &bg_color); + + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + if (strcmp (w->gterm.ginmodeCursor, "full_crosshair") != 0) { + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + XRecolorCursor (display, + w->gterm.ginmode_cursor, &fg_color, &bg_color); /* MF030 */ + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + } else + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, "full_crosshair") == 0); + + /* Make sure we have all the fonts we need. */ + for (fp = &w->gterm.alphaFont1, i=0; i < NAlphaFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.alpha_fonts[i] = *fp; + } + for (fp = &w->gterm.dialogFont1, i=0; i < NDialogFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.dialog_fonts[i] = *fp; + } + + /* Raster initialization. */ + w->gterm.rasters = NULL; + w->gterm.nrasters = 0; + w->gterm.mappings = NULL; + w->gterm.nmappings = 0; + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + w->gterm.colormaps = NULL; + w->gterm.wa_defined = 0; + memset ((char *)&w->gterm.draw, 0, sizeof (struct drawContext)); + + /* Marker initialization. */ + w->gterm.gm_head = NULL; + w->gterm.gm_tail = NULL; + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.defTranslations = NULL; + w->gterm.nauxTrans = 0; + w->gterm.gm_defTranslations = NULL; + w->gterm.gm_curTranslations = NULL; + w->gterm.gm_reqTranslations = NULL; + w->gterm.gm_timer_id = (XtIntervalId) NULL; + w->gterm.gm_initialized = False; + + /* Set defaults (some of these are clobbered anyway by Realize/Resize). */ + w->gterm.raster = 0; + w->gterm.cur_x = 0; + w->gterm.cur_y = 0; + w->gterm.last_x = 0; + w->gterm.last_y = 0; + w->gterm.cursor_drawn = 0; + w->gterm.cursor_type = GtIdleCursor; + w->gterm.pixmap = (Pixmap)NULL; + w->gterm.d_pixmap = (Pixmap)NULL; + w->gterm.preserve_screen = 0; + w->gterm.preserve_valid = 0; + w->gterm.d_saved = 0; + w->gterm.alpha_font = DefaultAlphaFont; + w->gterm.dialog_font = DefaultDialogFont; + w->gterm.optcols = 80; + w->gterm.optrows = 35; + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + set_default_color_index (w); + + /* Disable input until window is ready. */ + w->gterm.delay = 1; +} + +static void +Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + GtermWidget w = (GtermWidget) gw; + + /* Set default window size. */ + XtMakeResizeRequest (gw, w->core.width, w->core.height, + &w->core.width, &w->core.height); + + /* Should define pseudocolor visual here, if truecolor or directcolor + * default visual. + */ + + XtCreateWindow (gw, InputOutput, (Visual *)CopyFromParent, + *valueMask, attrs); + + w->gterm.window = XtWindow (gw); + w->gterm.old_width = w->gterm.xres = w->core.width; + w->gterm.old_height = w->gterm.yres = w->core.height; + + GtRasterInit (w); + GtMarkerInit (w); + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = w->gterm.idle_cursor); + + Resize (gw); +} + +static void +Destroy (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb, *cb_next; + Display *display = w->gterm.display; + + /* Get rid of any raster stuff. */ + GtRasterInit (w); /* MF008 */ + XtFree ((char *)w->gterm.rasters); + XtFree ((char *)w->gterm.mappings); + + /* Destroy any markers. */ + GtMarkerFree (w); + + /* Can't use XtDestroyGC here; the source says it is broken and will + * work only for applications that have only 1 display, and we have 2. + * Also the documentation in Asente&Swick documents the calling sequence + * incorrectly. + */ + XFreeGC (display, w->gterm.clearGC); + XFreeGC (display, w->gterm.exposeGC); + XFreeGC (display, w->gterm.drawGC); + XFreeGC (display, w->gterm.dialogGC); + XFreeGC (display, w->gterm.cursorGC); + + /* This one also proves problematic. When there are multiple gterm + * widgets allocating the same cursor, succeeding calls for the same + * cursor return the same cursor ID. When these widgets are later + * destroyed, the first XFreeCursor succeeds but subsequent ones find + * the referenced cursor undefined and the application boms with a + * BadCursor error. This must be some problem with reference counts + * in the X server. Cursors use minor amounts of resources and they + * will probably be freed anyway when the display is closed, so we just + * leave them defined here. + * + XFreeCursor (display, w->gterm.idle_cursor); + XFreeCursor (display, w->gterm.busy_cursor); + XFreeCursor (display, w->gterm.crosshair_cursor); + if (w->gterm.ginmode_cursor != w->gterm.crosshair_cursor) + XFreeCursor (display, w->gterm.ginmode_cursor); + */ + + if (w->gterm.pixmap) + XFreePixmap (w->gterm.display, w->gterm.pixmap); + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + + /* Destroy callback lists. */ + for (cb = w->gterm.resetCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.resizeCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.inputCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + XtFree (w->gterm.ginmodeCursor); +} + +static void +Resize (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb; + int char_width, char_height, char_base; + int bestfont, fonterr, dx, dy, i; + unsigned int width, height, u_junk; + GtCallback cbl[128]; + XFontStruct *fp; + int ncb, junk; + Pixmap pixmap; + Window root; + + if (!XtIsRealized(gw)) + return; + + /* Create new pixmap. */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width + 1, w->core.height + 1, w->core.depth); + if (pixmap) + XFillRectangle (w->gterm.display, pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + + /* Copy old pixmap into new and free old pixmap. */ + if (w->gterm.pixmap) { + XGetGeometry (w->gterm.display, w->gterm.pixmap, + &root, &junk, &junk, &width, &height, &u_junk, &u_junk); + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.copyOnResize) + XCopyArea (w->gterm.display, w->gterm.pixmap, pixmap, + w->gterm.exposeGC, 0, 0, width-1, height-1, 0, 0); + XFreePixmap (w->gterm.display, w->gterm.pixmap); + } + + /* Install new pixmap. */ + w->gterm.pixmap = pixmap; + w->gterm.preserve_valid = 0; + + /* Redraw window. */ + if (w->gterm.pixmap) { + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, 0, 0, w->core.width, w->core.height, 0, 0); + } + + /* Pick best alpha font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NAlphaFonts; i++) { + fp = w->gterm.alpha_fonts[i]; + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + dx = (((int)w->core.width / char_width) - w->gterm.optcols) * 2; + dy = ((int)w->core.height / char_height) - w->gterm.optrows; + if (abs(dx) + abs(dy) < fonterr) { + bestfont = i; + fonterr = abs(dx) + abs(dy); + } + } + + w->gterm.alpha_font = bestfont; + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + XSetFont (w->gterm.display, w->gterm.drawGC, fp->fid); + + /* Pick best dialog font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NDialogFonts; i++) { + fp = w->gterm.dialog_fonts[i]; + char_width = fp->max_bounds.width; + dx = ((int)w->core.width / char_width) - 80; + if (abs(dx) < fonterr) { + bestfont = i; + fonterr = abs(dx); + } + } + + w->gterm.dialog_font = bestfont; + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + char_base = fp->max_bounds.ascent; + + w->gterm.d_xoff = 2; + w->gterm.d_yoff = w->core.height - char_height - 2; + w->gterm.d_height = char_height; + XSetFont (w->gterm.display, w->gterm.dialogGC, fp->fid); + + /* Create dialog save area pixmap. */ + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + w->gterm.d_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, char_height, w->core.depth); + w->gterm.d_saved = 0; + + /* Adjust cursor position to allow for change in window size. */ + w->gterm.cur_x = w->gterm.cur_x * (int)w->core.width / w->gterm.old_width; + w->gterm.cur_y = w->gterm.cur_y * (int)w->core.height / w->gterm.old_height; + w->gterm.old_width = w->core.width; + w->gterm.old_height = w->core.height; + if (w->gterm.cursor_type == GtGinmodeCursor) { + XWarpPointer (w->gterm.display, w->gterm.window, w->gterm.window, + 0,0,0,0, w->gterm.cur_x, w->gterm.cur_y); + update_cursor (w); + } + + /* Raster descriptor 0 must track the window size. */ + if (w->gterm.rasters) { + Raster rp = &w->gterm.rasters[0]; + rp->width = w->core.width; + rp->height = w->core.height; + } + + /* Mark gterm widget ready for further client input. */ + w->gterm.delay = 0; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resizeCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w); +} + +/* ARGSUSED */ +static void +Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register GtermWidget w = (GtermWidget) gw; + register XExposeEvent *ev = (XExposeEvent *)event; + int x, y, width, height; + + if (!XtIsRealized (gw)) + return; + + if (event) { + x = ev->x; + y = ev->y; + width = ev->width; + height = ev->height; + } else { + x = 0; + y = 0; + width = w->core.width; + height = w->core.height; + } + + if (w->gterm.pixmap) { + /* Clipping with the region argument does not work properly with + * the OpenLook server for some reason - the clip region is one + * pixel too small on the right and bottom. Until the reason for + * this becomes clear, we use the bounding box provided in the + * Expose event to roughly clip the refresh. + * + XSetClipOrigin (w->gterm.display, w->gterm.exposeGC, 0, 0); + XSetRegion (w->gterm.display, w->gterm.exposeGC, region); + */ + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, x, y, width, height, x, y); + } + + update_transients (w, region); + + /* A dummy expose event is used to ensure that the resize delay is + * cleared, in the event that the resize request is not granted. + */ + if (ev && ev->send_event) + w->gterm.delay = 0; +} + +/* ARGSUSED */ +static Boolean +SetValues (current, request, set) + Widget current, request, set; +{ + GtermWidget old = (GtermWidget) current; + GtermWidget req = (GtermWidget) request; + register GtermWidget w = (GtermWidget) set; + Display *display = w->gterm.display; + Boolean redisplay = False; + register GC gc; + + if (old->gterm.dialogBgColor != req->gterm.dialogBgColor) { + gc = w->gterm.dialogGC; + XSetBackground (display, gc, w->gterm.dialogBgColor); + } + if (old->gterm.dialogFgColor != req->gterm.dialogFgColor) { + gc = w->gterm.dialogGC; + XSetForeground (display, gc, w->gterm.dialogFgColor); + } + + if (old->gterm.ginmodeCursor != req->gterm.ginmodeCursor) { + static char *full_crosshair = "full_crosshair"; + + XtFree (old->gterm.ginmodeCursor); + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + + erase_crosshair (w); + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, full_crosshair) == 0); + + if (w->gterm.full_crosshair) { + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + color_crosshair (w); + } else { + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + color_ginmodeCursor (w); + } + + if (w->gterm.cursor_type == GtGinmodeCursor && w->core.visible) + XDefineCursor (display, w->gterm.window, + w->gterm.cursor = w->gterm.ginmode_cursor); + } + + if (old->gterm.crosshairCursorColor != req->gterm.crosshairCursorColor) { + color_crosshair (w); + } + + if (old->gterm.ginmodeCursorBgColor != req->gterm.ginmodeCursorBgColor || + old->gterm.ginmodeCursorFgColor != req->gterm.ginmodeCursorFgColor) { + color_ginmodeCursor (w); + } + + return (XtIsRealized(current) ? redisplay : False); +} + +static void +color_crosshair (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + register GC gc; + + erase_crosshair (w); + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.color0; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, defcmap, &fg_color); + + gc = w->gterm.cursorGC; + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XRecolorCursor (display, w->gterm.crosshair_cursor, &fg_color, &bg_color); + + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + + update_cursor (w); +} + +static void +color_ginmodeCursor (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, defcmap, &fg_color); + + XRecolorCursor (display, w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; +} + +/* + * Action procedures. + * ----------------------- + */ + +/* ARGSUSED */ +static void HandleIgnore (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* ignore an event */ +} + +/* ARGSUSED */ +static void HandleGraphicsInput (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.inputCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, event); +} + +/* ARGSUSED */ +static void HandleDisplayCrosshair (widget, event, params, nparams) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *nparams; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XButtonEvent *ev = &event->xbutton; + + /* Ignore if cursor is in a marker. */ + if (w->gterm.gm_active) + return; + + if (*nparams && strcmp (params[0], "on") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.crosshair_cursor); + draw_crosshair (w, ev->x, ev->y); + } else if (*nparams && strcmp (params[0], "off") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, w->gterm.cursor); + } +} + +/* ARGSUSED */ +static void HandleTrackCursor (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XMotionEvent *ev = &event->xmotion; + gmSelection what; + Marker gm; + + savepos (w, (XEvent *)ev); + + if ((gm = GmSelect (w, ev->x, ev->y, &what))) + gm_focusin (w, gm, &what); + else if (w->gterm.gm_active) + gm_focusout (w, 1); + + if (w->gterm.cursor_type == GtGinmodeCursor) + if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, ev->x, ev->y); + + /* Flushing here keeps cursor tracking synchronous and tends + * to aid motion compression, by preventing crosshair draw + * requests from being queued up for transmission to the + * server. + */ + XFlush (w->gterm.display); + + } else { + w->gterm.cur_x = ev->x; + w->gterm.cur_y = ev->y; + } +} + +/* ARGSUSED */ +static void HandleEnterWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XEnterWindowEvent *ev = (XEnterWindowEvent *) event; + +/*printf ("HandleEnterWindow....");*/ + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int update = w->gterm.cmapUpdate; + + /* To avoid excessive server queries the colormap is only updated + * every so often. Updating is disabled if cmapUpdate is set to zero. + if (update && ev->time - w->gterm.cmapLastUpdate > update * 1000) { + */ + if (update) { + inherit_default_colormap (w); + w->gterm.cmapLastUpdate = ev->time; + } + + /* Advise the window manager to load our colormap. */ +/*printf ("requesting focus....");*/ + request_colormap_focus (w); + } +/*printf ("\n");*/ + + w->gterm.in_window++; +} + +/* ARGSUSED */ +static void HandleLeaveWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XLeaveWindowEvent *ev = (XLeaveWindowEvent *) event; + +/*printf ("HandleLeaveWindow....");*/ + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int shadow = w->gterm.cmapShadow; + + /* The shadow option matches unused cells in the default colormap + * with the colors in our custom colormap. + if (shadow && ev->time - w->gterm.cmapLastShadow > shadow * 1000) { + */ + if (shadow) { + update_default_colormap (w); + w->gterm.cmapLastShadow = ev->time; + } + +/*printf ("restoring focus....");*/ + restore_colormap_focus (w); + } +/*printf ("\n");*/ + + w->gterm.in_window = 0; +} + +/* ARGSUSED */ +static void HandleSoftReset (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + GtReset (w); + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resetCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, NULL); +} + + +/* + * GRAPHICS routines (public functions). + * -------------------------------------- + */ + +GtActivate (w) + GtermWidget w; +{ + w->gterm.interactive = 0; + w->gterm.save_x = w->gterm.save_y = 0; +} + +GtDeactivate (w) + GtermWidget w; +{ + Display *display = w->gterm.display; + Window window = w->gterm.window; + + if (w->gterm.interactive) { + if (w->gterm.save_x > 0 && w->gterm.save_y > 0) { + if (w->gterm.warpCursor) { + /* Workaround X server bug. */ + if (w->gterm.root != w->gterm.save_root) + XWarpPointer (display,None,w->gterm.root, 0,0,0,0, + WidthOfScreen(w->gterm.screen) - 1, + HeightOfScreen(w->gterm.screen) - 1); + + /* Move pointer to saved position. */ + XWarpPointer (display, None, w->gterm.save_root, + 0,0,0,0, w->gterm.save_x, w->gterm.save_y); + } + w->gterm.save_x = 0; + w->gterm.save_y = 0; + } + w->gterm.interactive = 0; + } +} + +GtReady (w) + GtermWidget w; +{ + return (w->gterm.delay == 0); +} + +GtReset (w) + GtermWidget w; +{ + invalidate_draw_context (w); + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapButt, JoinMiter); + + /* Set defaults. */ + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.raster = 0; +} + +GtTimerInhibit (w, state) + GtermWidget w; + Boolean state; +{ + /* This is a kludge to allow a client (xgterm) to disable use of timers + * if they don't work in a given implementation. + */ + w->gterm.useTimers = !state; +} + +GtAugmentTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_augment; + w->gterm.nauxTrans++; + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtOverrideTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_override; + w->gterm.nauxTrans++; + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtFlush (w) + GtermWidget w; +{ + XFlush (w->gterm.display); +} + +GtSetLogRes (w, width, height) + GtermWidget w; + int width, height; +{ + w->gterm.xres = width; + w->gterm.yres = height; +} + +GtGetLogRes (w, width, height) + GtermWidget w; + int *width, *height; +{ + *width = w->gterm.xres; + *height = w->gterm.yres; +} + +GtGetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; /* zero for screen size */ + int *width, *height; +{ + if (raster) { + register Raster rp = &w->gterm.rasters[raster]; + *width = rp->width; + *height = rp->height; + } else { + *width = w->core.width; + *height = w->core.height; + } +} + +GtSetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; + int width, height; +{ + GtCreateRaster (w, raster, GtServer, width, height, RasterDepth); +} + +GtSetRaster (w, raster) + GtermWidget w; + int raster; +{ + if (raster >= 0 && raster < w->gterm.maxRasters) { + w->gterm.raster = raster; + invalidate_draw_context (w); + } +} + +GtGetRaster (w) + GtermWidget w; +{ + return (w->gterm.raster); +} + +/* ARGSUSED */ +GtSetTextRes (w, optrows, optcols) + GtermWidget w; + int optrows, optcols; +{ + w->gterm.optrows = optrows; + w->gterm.optcols = optcols; +} + +/* ARGSUSED */ +GtSetCharSize (w, ival) + GtermWidget w; + int ival; +{ +} + +GtSetDataLevel (w, ival) + GtermWidget w; + int ival; +{ + invalidate_draw_context (w); + + switch (ival) { + case GtSet: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[w->gterm.color_index]); + w->gterm.data_level = ival; + break; + case GtClear: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color0); + w->gterm.data_level = ival; + break; + case GtInvert: + /* This probably won't work correctly but leave it for now... */ + XSetFunction (w->gterm.display, w->gterm.drawGC, GXxor); + w->gterm.data_level = ival; + break; + } +} + + +GtSetLineWidth (w, ival) + GtermWidget w; + int ival; +{ + w->gterm.line_width = ival; + GtSetLineStyle (w, w->gterm.line_style); +} + +#define Dashed "\010\003" +#define Dotted "\002\003" +#define DashDot "\016\003\001\003" +#define Dash3Dot "\024\003\001\003\001\003\001\003" + +GtSetLineStyle (w, ival) + GtermWidget w; + int ival; +{ + int line_width = w->gterm.line_width; + int line_style = LineSolid; + int cap_style = CapButt; + int join_style = JoinMiter; + int dash_offset = 0; + char *dash_list = NULL; + int dash_list_length = 0; + + switch (ival) { + case GtSolid: + w->gterm.line_style = ival; + break; + case GtDashed: + line_style = LineOnOffDash; + dash_list = (char *)Dashed; + dash_list_length = strlen(Dashed); + w->gterm.line_style = ival; + break; + case GtDotted: + line_style = LineOnOffDash; + dash_list = (char *)Dotted; + dash_list_length = strlen(Dotted); + w->gterm.line_style = ival; + break; + case GtDashDot: + line_style = LineOnOffDash; + dash_list = (char *)DashDot; + dash_list_length = strlen(DashDot); + w->gterm.line_style = ival; + break; + case GtDash3Dot: + line_style = LineOnOffDash; + dash_list = (char *)Dash3Dot; + dash_list_length = strlen(Dash3Dot); + w->gterm.line_style = ival; + break; + } + + if (dash_list_length) + XSetDashes (w->gterm.display, w->gterm.drawGC, dash_offset, dash_list, + dash_list_length); + + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, line_width, line_style, cap_style, join_style); + + invalidate_draw_context (w); +} + +GtSetColorIndex (w, ival) + GtermWidget w; + int ival; +{ + register int color = w->gterm.iomap[ival]; + + if (color >= 0 && color < w->gterm.ncolors) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[color]); + w->gterm.color_index = color; + invalidate_draw_context (w); + } +} + +GtSetFillType (w, ival) + GtermWidget w; + int ival; +{ + switch (ival) { + case GtSolid: + case GtOutline: + w->gterm.fill_type = ival; + break; + } +} + +GtClearScreen (w) +GtermWidget w; +{ + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) + XFillRectangle (w->gterm.display, w->gterm.pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + XClearWindow (w->gterm.display, w->gterm.window); + + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color1); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapRound, JoinRound); + + w->gterm.line_width = 1; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.data_level = GtSet; + w->gterm.preserve_valid = 0; + w->gterm.gm_redisplay = 1; + w->gterm.d_saved = 0; + + /* Mark any screen mappings to be unconditionally refreshed. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp->enabled && mp->dst == 0) + mp->refresh++; + + invalidate_draw_context (w); + update_transients (w, NULL); +} + +GtDrawPolyline (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolymarker (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawPoints (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawPoints (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolygon (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + if (w->gterm.fill_type == GtOutline) { + /* Draw outline of region. + */ + int first = 0; + int last = npts - 1; + + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + + if (points[last].x != points[first].x || + points[last].y != points[first].y) { + + if (mx->use_backing_store) + XDrawLine (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + XDrawLine (w->gterm.display, mx->pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + } + } else { + /* Fill the outlined area. + */ + if (mx->use_backing_store) { + XFillPolygon (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + XFillPolygon (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + } + + update_transients (w, (Region)NULL); +} + +GtDrawMarker (w, x, y, xsize, ysize, type) + GtermWidget w; + int x, y; + int xsize, ysize; + int type; +{ +} + +GtBell (w) + GtermWidget w; +{ + XBell (w->gterm.display, 0); +} + + +/* GtSetCursorPos -- Set the cursor position to the given coordinates X,Y. + * Coordinates are specified in the current graphics coordinate system, + * defined by the current raster and logical resolution. + * + * This routine is a little more complex than one might think due to the + * complication of mappings. Screen coordinates are required to set the + * cursor, but the graphics drawing context may be defined relative to + * any raster. In the general case a graphics pipeline defines the series + * of coordinate transformations required to transform from graphics + * coordinates to screen coordinates. Things are further complicated since + * the pipeline or desired position may not map to the screen, or there + * may be multiple mappings to the screen. The first case (no mapping to + * the screen) is dealt with by ignoring the request to warp the cursor. + * The second case (one-to-many mapping) is dealt with by a heuristic: + * the most recent screen coordinates are unmapped back to the raster we + * are "drawing" into, defining a unique path through the mappings which + * we can use to map back to the screen. + * + * The simplest case occurs when we are drawing directly into the screen. + * In this case (raster=0) there may still be a logical to physical + * coordinate transformation, but there are no mappings to complicate things. + */ +GtSetCursorPos (w, x, y) + GtermWidget w; + int x, y; +{ + register MappingContext mx; + register DrawContext dx; + register Mapping mp; + + Window window = w->gterm.window; + int sv_raster = w->gterm.raster; + int sv_xres = w->gterm.xres, sv_yres = w->gterm.yres; + int rasters[256], mappings[256], nmap=0, ntrans=0; + int rx, ry, src, dst, map, i, npts = 1; + int raster = w->gterm.raster; + XPoint pv1[1], pv2[2]; + XPoint *points, pv[1]; + Raster rp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Follow the current cursor position back to the source raster if + * possible. This gives us a default pipeline to follow in the reverse + * direction to map raster coordinates to screen coordinates, and is + * necessary to find the right mappings when multiple mappings are + * defined on a single source. + */ + rx = w->gterm.last_x; + ry = w->gterm.last_y; + src = 0; + do { + src = GtSelectRaster (w, dst=src, GtPixel,rx,ry, GtPixel,&rx,&ry,&map); + if (src != dst) { + rasters[nmap] = src; + mappings[nmap++] = map; + } + } while (src != dst && src != raster); + + /* Ray trace the point through all of the mappings to the screen. + * This isn't fully general, but gives us the capability to follow + * most graphics pipelines to a point on the screen. + */ + do { + GtSetRaster (w, raster); + if (ntrans++ || raster == 0) { /* MF041 */ + /* After the first transformation we have raster coordinates, + * so set the logical resolution to the raster dimensions. + */ + rp = &w->gterm.rasters[raster]; + GtSetLogRes (w, rp->width, rp->height); + } + + dx = get_draw_context (w); + if (!dx->nmappings) + return; + + /* Try to find the next mapping. */ + if (nmap && rasters[nmap-1] == raster) + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->mapping == mappings[nmap-1]) { + mp = mx->mp; + nmap--; + goto havemap; + } + } + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + mp = mx->mp; + if (mp && mp->dst == 0) + break; + } + if (i >= dx->nmappings) { + mx = &dx->mapContext[0]; + mp = mx->mp; + } + +havemap: + rp = &w->gterm.rasters[mp ? mp->dst : raster]; + + /* Compute the coordinates points[0].{x,y} of the point x,y in the + * destination raster. + */ + if (mx->scale) { + /* Scaling is in effect. The following subterfuge is used to + * compute the coordinates of the center of the raster pixel (x,y) + * when the image is zoomed. We want to set the cursor to the + * center of the selected pixel, not the edge. + */ + pv[0].x = x; pv[0].y = y; + mapVector (mx, pv, pv1, npts); + pv[0].x = x + 1; pv[0].y = y + 1; + mapVector (mx, pv, pv2, npts); + + pv[0].x = (pv1[0].x + pv2[0].x) / 2.0; + pv[0].y = (pv1[0].y + pv2[0].y) / 2.0; + points = pv; + + } else { + /* No scaling. */ + pv[0].x = x; pv[0].y = y; + points = pv; + } + + /* Clip to the bounds of the destination raster and generate the + * new x,y. + */ + x = max(0, min(rp->width-1, points[0].x)); + y = max(0, min(rp->height-1, points[0].y)); + + } while (mp && (raster = mp->dst)); + + XWarpPointer (w->gterm.display, window, window, 0,0,0,0, x,y); + + w->gterm.last_x = w->gterm.cur_x = x; + w->gterm.last_y = w->gterm.cur_y = y; + + GtSetRaster (w, sv_raster); + GtSetLogRes (w, sv_xres, sv_yres); +} + + +GtGetCursorPos (w, x, y) + GtermWidget w; + int *x, *y; +{ + *x = w->gterm.last_x; + *y = w->gterm.last_y; +} + +GtSetCursorType (w, type) + GtermWidget w; + int type; +{ + static XtIntervalId id = (XtIntervalId) NULL; + Display *display = w->gterm.display; + Cursor cursor; + int interval; + Widget pw; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.cursor_type == type) + return; + + switch (w->gterm.cursor_type = type) { + case GtNoCursor: + case GtIdleCursor: + erase_crosshair (w); + cursor = w->gterm.idle_cursor; + break; + + case GtGinmodeCursor: + /* Begin graphics cursor mode. + */ + + /* If a screen clear or drawing operation has caused the redisplay + * flag to be set, redisplay any marker overlays. + */ + if (w->gterm.gm_redisplay) { + GmRedisplay (w, (Region)NULL); + w->gterm.gm_redisplay = False; + } + + /* Make sure the window is visible. + */ + if (w->gterm.raiseWindow || w->gterm.deiconifyWindow) + for (pw = (Widget)w; pw; pw = XtParent(pw)) + if (XtIsShell(pw)) { + if (w->gterm.deiconifyWindow) + XMapWindow (display, XtWindow(pw)); + if (w->gterm.raiseWindow) + XRaiseWindow (display, XtWindow(pw)); + XSync (display, False); + } + + /* The first time this is done after a GtActivate causes the cursor + * to be warped into the graphics window. The interactive flag is set + * to cause GtDeactivate to restore the cursor to its original position + * after the graphics interaction finishes. + */ + if (w->gterm.warpCursor) { + int root_x, root_y, win_x, win_y; + int xoff, yoff, width, height, x, y; + Window gtermwin, root, child; + unsigned int keys; + int in_window = 0; + + width = w->core.width; + height = w->core.height; + gtermwin = w->gterm.window; + XTranslateCoordinates (display, gtermwin, w->gterm.root, + w->core.x, w->core.y, &xoff, &yoff, &child); + + if (XQueryPointer (display, w->gterm.root, &root, &child, + &root_x, &root_y, &win_x, &win_y, &keys)) { + + /* Already in gterm window? */ + if ((root_x >= xoff && root_x < xoff+width) && + (root_y >= yoff && root_y < yoff+height)) { + + if (!w->gterm.interactive) { + w->gterm.save_x = 0; + w->gterm.save_y = 0; + w->gterm.interactive++; + } + x = root_x - xoff; y = root_y - yoff; + in_window++; + + } else { + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + } else { + /* Pointer not on the current screen. + */ + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + + if ((x < 5 || x > width-5) || (y < 5 || y > height-5)) { + x = width / 2; + y = height / 2; + } + + if (!in_window) { + erase_crosshair (w); + if (w->gterm.warpCursor) { + XWindowAttributes wa; + if (XGetWindowAttributes (display, gtermwin, &wa) && + wa.map_state == IsViewable) { + + /* The following should not be necessary but is needed + * to workaround an X server bug. When warping to a + * different screen the pointer is not erased on the + * old screen. It is hard to erase it, but we can + * at least move it to the corner of the screen. + */ + if (root != w->gterm.root) { + Screen *screen = w->gterm.screen; + if (XGetWindowAttributes (display, root, &wa)) + screen = wa.screen; + XWarpPointer (display,None,root, 0,0,0,0, + WidthOfScreen(screen) - 1, + HeightOfScreen(screen) - 1); + } + + /* Now warp into the gterm window. */ + XWarpPointer (display, None, gtermwin, 0,0,0,0, x,y); + } + if (w->gterm.full_crosshair) + draw_crosshair (w, x, y); + } + + } else if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, x, y); + } + } else + update_cursor (w); + + cursor = w->gterm.ginmode_cursor; + if (interval = w->gterm.ginmodeBlinkInterval) { + XtAppContext appcon = XtWidgetToApplicationContext ((Widget) w); + id = XtAppAddTimeOut (appcon, + interval, blink_cursor, (XtPointer)w); + } else + id = (XtIntervalId) NULL; + break; + + case GtBusyCursor: + /* Exit graphics cursor mode. + */ + erase_crosshair (w); + cursor = w->gterm.busy_cursor; + break; + } + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = cursor); + if (id && w->gterm.cursor_type != GtGinmodeCursor) { + XtRemoveTimeOut (id); + id = (XtIntervalId) NULL; + } +} + +static void +blink_cursor (w, id) + GtermWidget w; + XtIntervalId *id; +{ + XtAppContext app_context; + XColor bg, fg; + int interval; + + if (w->gterm.cursor_type != GtGinmodeCursor) /* MF032 */ + return; + + bg = w->gterm.ginmodeColors[1]; + fg = w->gterm.ginmodeColors[0]; + + app_context = XtWidgetToApplicationContext ((Widget) w); + XRecolorCursor (w->gterm.display, w->gterm.ginmode_cursor, &fg, &bg); + XFlush (w->gterm.display); + + w->gterm.ginmodeColors[0] = bg; + w->gterm.ginmodeColors[1] = fg; + + if (interval = w->gterm.ginmodeBlinkInterval) + XtAppAddTimeOut (app_context, + interval, (XtTimerCallbackProc) blink_cursor, (XtPointer)w); +} + +GtPostInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.inputCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.inputCallback = new; +} + +GtDeleteInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.inputCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.inputCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resetCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resetCallback = new; +} + +GtDeleteResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resetCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resetCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resizeCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resizeCallback = new; +} + +GtDeleteResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resizeCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resizeCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtDrawAlphaText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + XPoint *points, pv[1], o_pv[1]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int npts, i; + + pv[0].x = x; + pv[0].y = y; + npts = 1; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + x = points[0].x; y = points[0].y; + + if (mx->use_backing_store) + XDrawString (w->gterm.display, w->gterm.pixmap, + mx->drawGC, x, y, text, strlen(text)); + XDrawString (w->gterm.display, mx->pixmap, + mx->drawGC, x, y, text, strlen(text)); + } + + update_transients (w, (Region)NULL); +} + +GtGetAlphaTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + +GtWriteAlphaCursor (w, x, y) + GtermWidget w; + int x, y; +{ +} + +GtEraseAlphaCursor (w) + GtermWidget w; +{ +} + +GtStartDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap) + if (w->gterm.d_saved) { + GtEraseDialog (w); + } else { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.pixmap ? w->gterm.pixmap : w->gterm.window, + w->gterm.d_pixmap, w->gterm.exposeGC, + 0, w->gterm.d_yoff, w->core.width, w->gterm.d_height, 0, 0); + w->gterm.d_saved = 1; + } +} + +GtEndDialog (w) + GtermWidget w; +{ + GtEraseDialog (w); + w->gterm.d_saved = 0; +} + +GtEraseDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap && w->gterm.d_saved) { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.window, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + if (w->gterm.pixmap) + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.pixmap, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + update_transients (w, (Region)NULL); + } +} + +GtDrawDialogText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + int xpos = w->gterm.d_xoff + x; + int ypos = w->gterm.d_yoff + y; + + if (w->gterm.pixmap) + XDrawImageString (w->gterm.display, w->gterm.pixmap, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); +} + +GtGetDialogTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + + +/* + * Internal functions for above code. + * ---------------------------------------- + */ + +static +set_default_color_index (w) + GtermWidget w; +{ + /* The default color index is 1, corresponding to the foreground + * drawing color color1. Index zero is the background drawing color + * color0. The remaining NColors color table entries are the optional + * drawing colors corresponding to resources "color2" through "colorN". + * These are used only if explicitly selected by the client application. + */ + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.cmap[1]); + w->gterm.color_index = 1; + invalidate_draw_context (w); +} + + +static +draw_crosshair (w, x, y) + GtermWidget w; + int x, y; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) { + /* The preserve_screen flag is set if we need to preserve the + * exact display window contents, rather than merely refresh from + * the backing store pixmap. + */ + if (w->gterm.preserve_screen) { + if (!w->gterm.preserve_valid || y != w->gterm.cur_y) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, w->core.height); + if (!w->gterm.preserve_valid || x != w->gterm.cur_x) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + x, 0, 1, w->core.height, w->core.width, 0); + w->gterm.preserve_valid = 1; + } + + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + 0, y, w->core.width, y); + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + x, 0, x, w->core.height); + + XFlush (w->gterm.display); + w->gterm.cursor_drawn++; + } + + w->gterm.cur_x = x; + w->gterm.cur_y = y; +} + + +static +erase_crosshair (w) + GtermWidget w; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.cursor_drawn) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.pixmap) { + if (w->gterm.preserve_screen && w->gterm.preserve_valid) { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, w->core.height, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + w->core.width, 0, 1, w->core.height, x, 0); + } else { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + x, 0, 1, w->core.height, x, 0); + } + } + + w->gterm.cursor_drawn = 0; + w->gterm.preserve_valid = 0; + } +} + + +static +update_transients (w, region) + GtermWidget w; + Region region; +{ + /* If an explicit region is given redisplay any markers in it immediately, + * otherwise set the redisplay flag to cause a full screen redisplay when + * drawing finishes and the widget is ready for input. + */ + if ((char *)region) + GmRedisplay (w, region); + else + w->gterm.gm_redisplay = True; + + /* Update the crosshair cursor if GIN mode is in effect. */ + update_cursor (w); +} + + +static +update_cursor (w) + GtermWidget w; +{ + if (w->gterm.cursor_type == GtGinmodeCursor && w->gterm.full_crosshair) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + if (x || y) + draw_crosshair (w, x, y); + } +} + +static Cursor +get_cursor (w, cursor_name) + GtermWidget w; + String cursor_name; +{ + XrmValue from, to; + Cursor cursor; + + from.size = strlen (cursor_name) + 1; + from.addr = cursor_name; + + to.addr = (caddr_t) &cursor; + to.size = sizeof(cursor); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRCursor, &to)) + cursor = XCreateFontCursor (w->gterm.display, XC_crosshair); + + return (cursor); +} + + +static DrawContext +get_draw_context (w) + GtermWidget w; +{ + DrawContext dx = &w->gterm.draw; + + if (!dx->valid) { + int raster = w->gterm.raster; + Raster rp = &w->gterm.rasters[raster]; + register MappingContext mx = &dx->mapContext[0]; + Region clip_region, mask_region; + struct mapping *map, *mp, *np, p_mp; + int xres = w->gterm.xres; + int yres = w->gterm.yres; + float xscale, yscale; + XRectangle r; + int i, j; + + dx->raster = w->gterm.raster; + dx->rp = rp; + + if (raster == 0) { + dx->nmappings = 1; + mx->mapping = 0; + mx->mp = NULL; + mx->use_backing_store = (w->gterm.pixmap != (Pixmap)NULL); + mx->pixmap = w->gterm.window; + mx->drawGC = w->gterm.drawGC; + mx->GC_private = 0; + +/* (7/16/97) MJF - we don't scale raster 0 since it's already in screen coords. + Otherwise the cursor movement keystrokes scale incorrectly and quickly move + to (0,0). + mx->xoffset = mx->yoffset = mx->scale = 0; + [DCT] This doesn't look entirely right as it disables logical coords for + the screen. Leave as is until this can be studied more carefully. + */ + + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) + mx->scale = 0; + else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + } else { + dx->nmappings = 0; + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (!mp->enabled || mp->src != raster || + w->gterm.rasters[mp->dst].type != GtServer) + continue; + if (!valid_mapping (w, mp)) + continue; + + mx->mp = mp; + mx->mapping = mp->mapping; + mx->pixmap = w->gterm.rasters[mp->dst].r.pixmap; + mx->use_backing_store = (mp->dst == 0 && + w->gterm.pixmap && !(mp->rop & R_Transient)); + + /* Determine if any scaling is necessary. */ + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + /* Compute logical-to-raster scaling. */ + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) { + mx->xscale = mx->yscale = 1.0; + mx->scale = 0; + } else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + /* Compute overall scale factors by combining logical-to- + * raster and raster-to-screen mappings. + */ + if (map->snx != map->dnx || map->sny != map->dny || + map->sx != map->dx || map->sy != map->dy) { + + xscale = (float)map->dnx / (float)map->snx; + mx->xscale *= xscale; + if (xscale < 0) + mx->xoffset = map->dx + abs(map->dnx) - 1; + else + mx->xoffset = map->dx; + mx->xoffset -= (map->sx * xscale); + + yscale = (float)map->dny / (float)map->sny; + mx->yscale *= yscale; + if (yscale < 0) + mx->yoffset = map->dy + abs(map->dny) - 1; + else + mx->yoffset = map->dy; + mx->yoffset -= (map->sy * yscale); + + mx->scale = 1; + } + + /* Compute the clip mask which will clip graphics to the + * destination rect of the mapping, minus any regions of + * this rect covered by other mappings. + */ + clip_region = XCreateRegion(); + r.x = map->dx; r.y = map->dy; + r.width = abs(map->dnx); + r.height = abs(map->dny); + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != mp->dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + mask_region = XCreateRegion(); + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + XUnionRectWithRegion (&r, mask_region, mask_region); + + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + } + + /* Create a drawing GC which is a copy of the global drawGC + * but using the clip mask computed above. + */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.root, + 0, NULL); + XCopyGC (w->gterm.display, w->gterm.drawGC, ~0, mx->drawGC); + XSetRegion (w->gterm.display, mx->drawGC, clip_region); + XDestroyRegion (clip_region); + mx->GC_private = 1; + + if (++dx->nmappings >= MAX_DRAW) + break; + else + mx++; + } + } + + dx->valid = 1; + } + + return (dx); +} + + +static +invalidate_draw_context (w) + GtermWidget w; +{ + register DrawContext dx = &w->gterm.draw; + register MappingContext mx; + register int i; + + if (dx->valid) { + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->GC_private) + XFreeGC (w->gterm.display, mx->drawGC); + } + dx->valid = 0; + } +} + +static XPoint * +mapVector (mx, pv1, pv2, npts) + register MappingContext mx; + XPoint *pv1; + XPoint *pv2; + int npts; +{ + register XPoint *ip = pv1; + register XPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x * mx->xscale + mx->xoffset; + op->y = ip->y * mx->yscale + mx->yoffset; + } + + return (pv2); +} + + +static void +savepos (w, event) + GtermWidget w; + XEvent *event; +{ + if (event == NULL) + return; + + switch (event->type) { + case KeyPress: + case KeyRelease: + w->gterm.last_x = event->xkey.x; + w->gterm.last_y = event->xkey.y; + break; + case ButtonPress: + case ButtonRelease: + w->gterm.last_x = event->xbutton.x; + w->gterm.last_y = event->xbutton.y; + break; + case MotionNotify: + w->gterm.last_x = event->xmotion.x; + w->gterm.last_y = event->xmotion.y; + break; + } +} + + +/* + * IMAGING routines. + * ----------------------- + * Our strategy here is to support a range of visuals with pseudocolor being + * preferred if available. All imaging is done internally using 8 bit images + * and a max 256 element colormap. If the display hardware has a depth less + * than 8 bits, e.g. for a monochrome display, the image is reduced to the + * screen depth by some technique before being output to the display. + * + * Images (rasters) are implemented internally in Gterm using either ximages or + * off screen pixmaps. Which format is used is decided at raster create time + * and is controlled by a Gterm resource. This is transparent to the client + * application. Currently only 8 bit rasters are supported. + * + * GtRasterInit (gt) + * GtAssignRaster (gt, raster, drawable) + * GtCreateRaster (gt, raster, type, width, height, depth) + * GtDestroyRaster (gt, raster) + * exists = GtQueryRaster (gt, raster, &type, &width, &height, &depth) + * raster = GtNextRaster (gt) + * GtSetRaster (gt, raster) + * raster = GtGetRaster (gt) + * n = GtNRasters (gt) + * + * GtWritePixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtReadPixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtSetPixels (gt, raster, ct, x1, y1, nx, ny, color, rop) + * GtRefreshPixels (gt, raster, ct, x1, y1, nx, ny) + * pixmap = GtExtractPixmap (gt, src, ct, x, y, width, height) + * GtInsertPixmap (gt, pixmap, dst, ct, x, y, width, height) + * + * colormap = GtNextColormap (gt) + * GtFreeColormap (gt, colormap) + * GtWriteColormap (gt, colormap, first, nelem, r, g, b) + * GtReadColormap (gt, colormap, first, nelem, r, g, b) + * GtLoadColormap (gt, colormap, offset, scale) + * exists = GtQueryColormap (gt, colormap, &first, &nelem, &maxelem) + * GtWriteIomap (gt, iomap, first, nelem) + * GtReadIomap (gt, iomap, first, nelem) + * pixel = GtGetClientPixel (gt, gterm_pixel) + * + * GtInitMappings (gt) + * mapping = GtNextMapping (gt) + * GtFreeMapping (gt, mapping) + * GtRaiseMapping (gt, mapping, ref|NULL) + * GtLowerMapping (gt, mapping, ref|NULL) + * int = GtCompareMappings (gt, map1, map2) + * GtEnableMapping (gt, mapping, refresh) + * GtDisableMapping (gt, mapping, erase) + * active = GtActiveMapping (gt, mapping) + * GtRefreshMapping (gt, mapping) + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mapping) + * + * GtCopyRaster (gt, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtSetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtGetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * + * GtMapVector (gt, mapping, dir, pv1, pv2, npts) + * GtPixelToNDC (gt, raster, pv1, pv2, npts) + * GtNDCToPixel (gt, raster, pv1, pv2, npts) + * + * GtDebug (gt, fp, what) + * + * In the case of CopyRaster or {Set|Get}Mapping, raster coordinates may be + * specified in either raster pixel (GtPixel) units or in normalized device + * coordinates (GtNDC) in the range 0-32767. + * --------------------------------------------------------------------------- + */ + +GtRasterInit (w) + GtermWidget w; +{ + register int i; + register Raster rp; + register struct colormap *cm; + struct colormap *next_cm; + + invalidate_draw_context (w); + + /* Destroy any existing rasters. */ + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (w->gterm.rasters[i].type) + GtDestroyRaster (w, i); + + /* Allocate the initially empty raster descriptors. */ + XtFree ((char *)w->gterm.rasters); + w->gterm.rasters = rp = + (Raster) XtCalloc (w->gterm.maxRasters, sizeof (struct raster)); + w->gterm.nrasters = 0; + w->gterm.raster = 0; + + /* Raster 0 is the display window. */ + rp->type = PixmapRaster; + rp->width = w->core.width; + rp->height = w->core.height; + rp->r.pixmap = w->gterm.window; + rp->delete = 0; + w->gterm.nrasters++; + + /* Free any previously allocated colormap cells. */ + if (w->gterm.ncolors > SZ_STATIC_CMAP && w->gterm.useDefaultCM) { + XFreeColors (w->gterm.display, w->core.colormap, + &w->gterm.cmap[SZ_STATIC_CMAP], w->gterm.ncolors - SZ_STATIC_CMAP, + 0); + w->gterm.ncolors = SZ_STATIC_CMAP; + invalidate_cmap (w); + } + + /* Free any client defined colormaps. */ + for (cm = w->gterm.colormaps; cm; cm = next_cm) { + next_cm = cm->next; + XtFree ((char *)cm); + } + w->gterm.colormaps = NULL; + + /* Initialize the mappings. */ + GtInitMappings (w); +} + + +/* GtNextRaster -- Return the index of the next unused raster. + */ +GtNextRaster (w) + register GtermWidget w; +{ + register int i; + + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (!w->gterm.rasters[i].type) + return (i); + + return (-1); +} + + +/* GtNRasters -- Return the number of currently defined rasters. + */ +GtNRasters (w) + GtermWidget w; +{ + return (w->gterm.nrasters); +} + + +/* GtAssignRaster -- Assign a raster descriptor to an externally created + * drawable (window or pixmap). The raster thus created may be mapped or + * drawn into like the rasters created privately by the imaging code, but + * this allows use of this code to access other windows, or shared pixmaps. + */ +GtAssignRaster (w, raster, drawable, type) + GtermWidget w; + int raster; /* one-indexed */ + XtPointer drawable; /* object containing pixel array */ + int type; /* type of drawable [not used] */ +{ + register Raster rp; + XWindowAttributes wa; + + if (raster <= 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + if (!XGetWindowAttributes (w->gterm.display, (Window)drawable, &wa)) + return (ERR); + + rp->type = PixmapRaster; + rp->width = wa.width; + rp->height = wa.height; + rp->r.pixmap = (Pixmap) drawable; + rp->delete = 0; + + return (OK); +} + + +/* GtCreateRaster -- Create a new raster of the given size. A server pixmap + * (GtServer) or ximage (GtClient) raster will be created depending upon the + * current value of the cacheRasters resource. + */ +GtCreateRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int type; + int width, height; + int depth; +{ + register uchar *op; + register int npix, pixel; + uchar *data; + XImage *xp; + Raster rp; + int cache; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + /* Only rasters of depth 8 bits are currently supported. */ + if (depth && depth != 8) + return (ERR); + + /* Check for a raster number in bounds. */ + if (raster < 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + /* A create on raster 0 (the display window) is treated as an attempt + * to resize the window. + */ + if (raster == 0) { + XWindowAttributes wa; + + invalidate_draw_context (w); + + /* Issue the resize request. */ + XtVaSetValues ((Widget)w, + XtNwidth, (XtArgVal)width, + XtNheight, (XtArgVal)height, + NULL); + XFlush (w->gterm.display); + + /* The following generates a round trip request to the server and + * is an attempt to allow the window system time to process the + * resize request before the client can issue a GtQueryRaster to + * see if the request has succeeded (hence causing a race condition). + * If the window is not the requested size the delay flag is set + * to cause graphics input processing to be suspended until the + * window is resized or redisplayed. A dummy expose event is + * generated to clear the delay condition in case the resize request + * is not granted. + */ + if (XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + rp->width = wa.width; + rp->height = wa.height; + + if (rp->width != width || rp->height != height) { + XExposeEvent ev; + ev.type = Expose; + ev.send_event = True; + ev.display = w->gterm.display; + ev.window = w->gterm.window; + ev.x = ev.y = 0; + ev.width = ev.height = 1; + ev.count = 0; + + XSendEvent (w->gterm.display, w->gterm.window, False, + NoEventMask, (XEvent *)&ev); + w->gterm.delay = 1; + } + } + return (OK); + } + + /* Get rid of any old raster. */ + GtDestroyRaster (w, raster); + + rp->width = width; + rp->height = height; + rp->delete = 1; + + /* Cache the raster? */ + if (strcmp (w->gterm.cacheRasters, "always") == 0) + cache = 1; + else if (strcmp (w->gterm.cacheRasters, "never") == 0) + cache = 0; + else + cache = (type == GtServer); + + /* Create new raster. */ + if (cache) { + /* Create a pixmap. */ + rp->type = PixmapRaster; + rp->r.pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + width, height, RasterDepth); + if (rp->r.pixmap == (Pixmap)NULL) + goto ximage; + XFillRectangle (w->gterm.display, rp->r.pixmap, w->gterm.clearGC, + 0, 0, width, height); + + } else { + /* Create an XImage. */ +ximage: + rp->type = ImageRaster; + + /* Get pixel storage. */ + npix = width * height; + if ((data = (uchar *) XtMalloc (npix)) == NULL) + return (ERR); + else { + for (op=data, pixel=w->gterm.color0; --npix >= 0; ) + *op++ = pixel; + } + + /* The following doesn't yet deal properly with byte and bit ordering + * differences between the server and client. + */ + rp->r.ximage = xp = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, width, height, 8, 0); + if (xp == NULL) { + rp->type = 0; + return (ERR); + } + } + + w->gterm.nrasters++; + return (OK); +} + + +/* GtDestroyRaster -- Destroy a raster. Any mappings which reference the + * raster are deactivated, and all storage associated with the raster is freed. + */ +GtDestroyRaster (w, raster) + GtermWidget w; + int raster; +{ + register Raster rp; + register Mapping mp, next; + + if (raster <= 0) + return; + + invalidate_draw_context (w); + + /* Disable any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = next) { + next = mp->next; + if (mp->src == raster || mp->dst == raster) + free_mapping (w, mp); + } + + /* Destroy the raster. */ + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (rp->delete) { + if (rp->type == ImageRaster) + XDestroyImage (rp->r.ximage); + else if (rp->type == PixmapRaster) + XFreePixmap (w->gterm.display, rp->r.pixmap); + } + w->gterm.nrasters--; + rp->type = 0; + rp->delete = 0; + } +} + + +/* GtQueryRaster -- Determine whether a raster exists and if so return its + * size. + */ +GtQueryRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int *type; + int *width, *height; + int *depth; +{ + register Raster rp; + + if (raster < 0 || raster > w->gterm.maxRasters) + return (0); + + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (type) { + if (rp->type == PixmapRaster) + *type = GtServer; + else + *type = GtClient; + } + if (width) + *width = rp->width; + if (height) + *height = rp->height; + if (depth) + *depth = RasterDepth; + return (1); + } else + return (0); +} + + +/* GtWritePixels -- Write to a rectangular region of a raster. If any + * mappings are currently defined which reference this raster as the source, + * and a mapped region is being rewritten, the affected pixels will be + * refreshed by the mapping. + */ +GtWritePixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + int bytes_per_line, i; + Mapping mp; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + XImage *ximage; + uchar *data; + int npix; + + /* Get a data buffer. */ + if ((data = (uchar *)XtMalloc (npix = nx * ny)) == NULL) + return (ERR); + + /* Convert the pixel values to colormap indices. */ + cmap = get_cmap_in (w); + for (ip=pixels, op=data, n=npix; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + + ximage = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, nx, ny, 8, 0); + + if (raster == 0 && w->gterm.pixmap) { + + /* ### Someone (Mike?) added this code for some reason, but it + * does not appear to be valid. This code already writes to the + * backing store (gterm.pixmap) so use_backing_store should not + * be required. Also blindly using only the first mapping context + * and ignoring any others cannot be correct. There is code + * below which executes any mappings defined on the raster. + * In general this requires scaling, not a simple XCopyArea. + * + * DrawContext dx = get_draw_context (w); + * register MappingContext mx; + * mx = &dx->mapContext[0]; + */ + + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + /* ### (cont'd) + * if (mx->use_backing_store) + * XCopyArea (display, w->gterm.pixmap, mx->pixmap, + * w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + */ + + XCopyArea (display, w->gterm.pixmap, rp->r.pixmap, + w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + } else + XPutImage (display, rp->r.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + XtFree ((char *)data); + ximage->data = NULL; + XDestroyImage (ximage); + + } else if (rp->type == ImageRaster) { + cmap = get_cmap_in (w); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + ip = pixels; + + /* Copy the data into the ximage data raster, converting input + * pixels to Xlib pixel values in the process. + * + * Possibly this should be done at Pixmap write time rather than + * during raster i/o so that the image pixel values are preserved. + * Otherwise reading back pixels is difficult and if the color map is + * dynamically modified the original pixel values may be lost. + * Postponing display pixel value generation woudl also make it easy + * to add support later for image depths other than 8 bit. Doing the + * conversion to display pixels here is however simpler and more + * efficient so that is how we do it for now. + */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtReadPixels -- Read a rectangular region of a raster. + */ +GtReadPixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + + int bytes_per_line, i; + int x, y, delxin = 0; + XImage *xin; + Raster rp; + uchar *lp; + + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + /* Get the input ximage. */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + + /* Read the pixmap subraster into an ximage. If we are reading the + * screen (raster == 0) and we have an off-screen backing store pixmap, + * use that instead of the screen. + */ + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? w->gterm.pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + + if (xin == NULL) + return (ERR); + + delxin++; + x = y = 0; + + } else { + xin = rp->r.ximage; + x = x1; + y = y1; + } + + cmap = get_cmap_out (w); + bytes_per_line = xin->bytes_per_line; + lp = (uchar *)xin->data + y * bytes_per_line + x; + op = pixels; + + /* Copy the data to the output buffer, converting display pixels to + * client pixels in the process. + */ + for (i=0; i < ny; i++) { + for (n=nx, ip=lp; --n >= 0; ) { + *op++ = cmap[*ip++]; + } + lp += bytes_per_line; + } + + if (delxin) + XDestroyImage (xin); + return (OK); +} + + +/* GtSetPixels -- Set all the raster pixels in a region to a single color. + * If nx=ny=0 the entire raster will be written. + */ +GtSetPixels (w, raster, ct, x1, y1, nx, ny, color, rop) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; + int color; + int rop; +{ + register Raster rp; + Mapping mp; + + /* Get raster pointer. */ + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + raster, ct, x1,y1,nx,ny); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + } + + /* Perform some range checks. */ + if (x1 == 0 && y1 == 0 && nx == 0 && ny == 0) { + nx = rp->width; + ny = rp->height; + } else { + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + } + + /* Set the pixels. + */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + GC gc = w->gterm.clearGC; + int use_backing_store; + + use_backing_store = + (raster == 0 && w->gterm.pixmap && !(rop & R_Transient)); + + XSetForeground (display, gc, get_pixel(w,color)); + XFillRectangle (display, rp->r.pixmap, gc, x1, y1, nx, ny); + if (use_backing_store) + XFillRectangle (display, w->gterm.pixmap, gc, x1, y1, nx, ny); + XSetForeground (display, gc, w->gterm.color0); + + } else { + register int n, i; + register uchar *op; + register Pixel pixel; + int bytes_per_line; + uchar *lp; + + pixel = get_pixel (w, color); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Set all pixels in the indicated region. */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = pixel; + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtRefreshPixels -- Update any mappings defined upon the given region of + * the given source raster, as if the pixel values had been set with a + * write pixels call. + */ +GtRefreshPixels (w, raster, ct, x1, y1, nx, ny) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; +{ + register Raster rp = &w->gterm.rasters[raster]; + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); + save_mapping (&sv_mp, 0, 0, + raster, ct, x1,y1,nx,ny, + 0, GtPixel, 0,0,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.sx; + y1 = p_mp.sy; + nx = p_mp.snx; + ny = p_mp.sny; + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } +} + + +/* GtExtractPixmap -- Extract a rectangular region of a raster and return + * as a pixmap. The caller is responsible for later deleting this pixmap. + */ +Pixmap +GtExtractPixmap (w, src, ctype, x, y, width, height) + GtermWidget w; + int src; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + int x1, y1, nx, ny; + String cache; + int i; + + rp = &w->gterm.rasters[src]; + if (!rp->type) + return ((Pixmap)NULL); + + /* If width and height are zero, return the full raster. */ + if (width <= 0) + width = rp->width; + if (height <= 0) + height = rp->height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + src, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Find any empty raster slot and use it to generate the output pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + cache = w->gterm.cacheRasters; + w->gterm.cacheRasters = "always"; + + if (GtCreateRaster (w, i, GtServer, nx, ny, /* MF006 */ + RasterDepth) == ERR) { + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } else if (rp->type != PixmapRaster) + goto err; + + if (GtCopyRaster (w, 0, + src,0, x1,y1,nx,ny, i,0, 0,0,nx,ny) == ERR) { +err: + GtDestroyRaster (w, i); /* MF005 */ + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } + + rp->type = 0; + w->gterm.nrasters--; + w->gterm.cacheRasters = cache; + + return (rp->r.pixmap); + } + } + + return ((Pixmap)NULL); +} + + +/* GtInsertPixmap -- Insert the contents of the given pixmap into a raster + * at the indicated coordinates. + */ +GtInsertPixmap (w, pixmap, dst, ctype, x, y, width, height) + GtermWidget w; + Pixmap pixmap; + int dst; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + XWindowAttributes wa; + int x1, y1, nx, ny; + int i; + + /* Check that the pixmap exists. */ + if (!XGetWindowAttributes (w->gterm.display, pixmap, &wa)) + return (ERR); + + /* Default to full dimensions of pixmap if no dimensions given. */ + if (width <= 0) + width = wa.width; + if (height <= 0) + height = wa.height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + dst, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Create the destination raster if none exists. */ + if (!w->gterm.rasters[dst].type) + if (GtCreateRaster (w, dst, GtDefault, nx, ny, /* MF006 */ + RasterDepth) == ERR) + return (ERR); + + /* Find an empty raster slot and use it to build a fake source raster + * using the supplied pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + rp->type = PixmapRaster; + rp->width = nx; + rp->height = ny; + rp->r.pixmap = pixmap; + + if (GtCopyRaster (w, 0, + i,0, 0,0,nx,ny, dst,0, x1,y1,nx,ny) < 0) + return (ERR); + + rp->type = 0; + return (OK); + } + } + + return (ERR); +} + + +/* GtWriteColormap -- Allocate or modify colormap cells. The Gterm widget + * colormap consists of a fixed number of preassigned, read-only color cells, + * plus a variable number of dynamically allocated application defined color + * cells. The application sees only the preassigned pixel space 0-N where + * N is the maximum pixel value. These values are mapped to Xlib pixel values + * by the CMAP vector in the main Gterm widget descriptor. The server + * colormap does the final mapping to RGB triplets. + * + * Our strategy here is as follows. If we have a monochrome screen set up a + * one-to-one fake colormap so that we preserve the input pixel values and + * render a one-bit image later. If we have a StaticGray or StaticColor + * visual allocate read-only color cells to allow X to choose the closest + * colors to what we request. If we have a GrayScale or PseudoColor visual + * allocate private read-write colors. The TrueColor and DirectColor + * visuals should not be seen here as we should have been able to set up the + * PseudoColor visual on screens that support these visuals, but if they are + * seen use a one-to-one mapping to preserve the 8 bit pixel values. + */ +GtWriteColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + XWindowAttributes wa; + register XColor *cp; + register int i, j, v, n; + unsigned long plane_masks[1]; + int req, need; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + if (map > 0) { + /* Create or modify a colormap descriptor. The display colormap + * is not affected. + */ + register struct colormap *cm; + struct colormap *last_cm; + register XColor *cp; + register int i; + + /* See if the colormap already exists. */ + for (cm = w->gterm.colormaps, last_cm = NULL; cm; cm = cm->next) { + last_cm = cm; + if (cm->map == map) + break; + } + + /* If not, create it. */ + if (!cm) { + if (!(cm = (struct colormap *)XtCalloc(1,sizeof(struct colormap)))) + return (ERR); + if (last_cm) + last_cm->next = cm; + else + w->gterm.colormaps = cm; + + /* Initialize static part of colormap. */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } + + cm->map = map; + cm->ncells = max (cm->ncells, first + nelem); + + /* Ignore attempts to overwrite static part of colormap. */ + for ( ; first < SZ_STATIC_CMAP; first++, nelem--) { + r++; g++; b++; + } + + if (nelem >= 0) { + memmove (&cm->r[first], r, nelem * sizeof (ushort)); + memmove (&cm->g[first], g, nelem * sizeof (ushort)); + memmove (&cm->b[first], b, nelem * sizeof (ushort)); + } + + return (OK); + } + + /* Write to the display colormap. + */ + if (first < SZ_STATIC_CMAP || first + nelem > MAX_SZCMAP) + return (ERR); + + /* Invalidate the cmap cache. */ + invalidate_cmap (w); + + /* Get the window attributes. We need to do this to determine the type + * of visual used for the window, which determines our color allocation + * strategy. This is only done once since presumably the visual and + * window depth will not change after the widget has been around long + * enough to receive a GtWriteColormap call. + */ + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) + return (ERR); + w->gterm.wa = wa; + w->gterm.wa_defined++; + } else + wa = w->gterm.wa; + + if (wa.depth == 1) + goto unitary; + + switch (wa.visual->class) { + case StaticGray: + case StaticColor: + /* Allocate "best-match" colors. */ + for (i=first; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + cp->red = r[i-first]; + cp->green = g[i-first]; + cp->blue = b[i-first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (XAllocColor (w->gterm.display, wa.colormap, cp)) + w->gterm.cmap[i] = cp->pixel; + else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + } + } + break; + + case GrayScale: + case PseudoColor: + if (w->gterm.useDefaultCM) { +usedef: /* Allocate private r/w colors from default colormap. */ + need = first + nelem - w->gterm.ncolors; + + /* Allocate new color cells if needed. If we can't allocate all + * the requested cells the unallocated pixel values are set to + * black. + */ + if ((n = need) > 0) { + /* Get the colormap cells. */ + req = min(w->gterm.maxColors, first + nelem - SZ_STATIC_CMAP) - + (w->gterm.ncolors - SZ_STATIC_CMAP); + for (n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, wa.colormap, + False, plane_masks, 0, + &w->gterm.cmap[w->gterm.ncolors+n], req)) { + n += req; + } else + req /= 2; + + /* Initialize the color descriptors. */ + for (i = w->gterm.ncolors; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + if (i < w->gterm.ncolors + n) { + cp->pixel = w->gterm.cmap[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + cp->flags = 0; + } + } + w->gterm.ncolors += n; + } + + /* Assign RGB colors to the referenced cells. */ + for (i=0; i < nelem; i++) { + cp = &w->gterm.color[first+i]; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + n = w->gterm.ncolors - first; + if (n > 0) + XStoreColors (w->gterm.display, wa.colormap, + &w->gterm.color[first], n); + + } else { + /* Allocate colors in a custom colormap. If the named colormap + * does not yet exist we create one. Multiple gterm widget + * instances may share the same colormap. + */ + Colormap colormap; + long timeval, time(); + int ncolors, shadow; + + /* get_colormap will direct us to the default colormap if the + * custom colormap cannot be accessed or created. + */ + colormap = get_colormap (w); + if (w->gterm.useDefaultCM) + goto usedef; + + /* Assign RGB colors to the referenced cells. */ + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + /* Store the new colors. */ + if (ncolors > 0) + XStoreColors (w->gterm.display, + colormap, &w->gterm.color[first], ncolors); + + /* Also attempt to store the colors in the default colortable, + * by allocating, writing, and then deallocating cells. This + * helps keeps the gterm window visible when the default + * colormap is loaded. To avoid excessive server queries the + * default colormap is only updated every so often. Updating is + * disabled if cmapShadow is set to zero. If shadowing is + * enabled the update is always performed if the WriteColormap + * occurs when the pointer is not in the window (e.g., when a + * button elsewhere in the GUI is pressed) as otherwise the + * change will not be visible as the private colormap will not + * be loaded by the window manager. + */ + shadow = w->gterm.cmapShadow; + timeval = time((long *)NULL); + + if (shadow && (!w->gterm.in_window || + (timeval - w->gterm.cmapLastShadow > shadow * 1000))) { + update_default_colormap (w); + w->gterm.cmapLastShadow = timeval; + } + } + break; + + default: + /* Set up a unitary, or one-to-one mapping, to preserve the input + * pixel values so that we can render them later. + */ +unitary: + for (i = first; i < first+nelem; i++) { + w->gterm.cmap[i] = i; + cp = &w->gterm.color[i]; + cp->pixel = i; + cp->red = r[i+first]; + cp->green = g[i+first]; + cp->blue = b[i+first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (i+1 > w->gterm.ncolors) + w->gterm.ncolors = i + 1; + } + break; + } + + return (OK); +} + + +/* GtReadColormap -- Return the color assignments for a region of the named + * colormap. + */ +GtReadColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + if (map > 0) { + /* Read from a colormap descriptor. + */ + register struct colormap *cm; + register int i, j; + + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + j = first + i; + if (j < cm->ncells) { + r[i] = cm->r[j]; + g[i] = cm->g[j]; + b[i] = cm->b[j]; + } else + break; + } + + return (i); + + } else { + /* Read the display colormap. + */ + register XColor *cp; + register int i; + + /* Return RGB values. */ + for (i=0; i < nelem; i++) + if (first+i < w->gterm.ncolors) { + cp = &w->gterm.color[first+i]; + r[i] = cp->red; + g[i] = cp->green; + b[i] = (ushort)cp->blue; + } else + break; + + return (i); + } +} + + +/* GtLoadColormap -- Load a colormap into the display, optionally scaling + * the colormap via a linear transformation in the process. The colormap is + * unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. + * If map=0 the linear transformation is applied directly to the display + * colormap. + * + * The offset refers to the center of the mapped region of the transfer + * function, which is why the center value is at 0.5. For example, if the + * range of raster pixel intensities is normalized to the range 0.0 to 1.0, + * then a transfer function of [offset=0.3,slope=3.0] will display the region + * of intenstities centered around the normalized intenstity of 0.3, with a + * contrast of 3.0 (the screen intensity changes 3 units for a unit change in + * raster pixel intensity). The transfer function [offset=0.3,slope=-3.0] + * will display the same range of pixel intensitites, but with a negative + * contrast. The transfer function [offset=0.5,slope=1.0] has intercepts + * of [0,0] and [1,1] hence it displays the full range of raster pixel + * intensities - the input colormap is used as is, without resampling. + */ +GtLoadColormap (w, map, offset, slope) + GtermWidget w; + int map; + float offset, slope; +{ + register int i; + register XColor *cp; + register struct colormap *cm; + struct colormap d_cmap, o_cmap; + int noscale, nelem, c1, c2; + float x, y, z, frac; + ushort r, g, b; + + /* Get the colormap to be loaded. + */ + if (map == 0) { + /* Create a dummy colormap struct from the screen colormap. */ + cm = &d_cmap; + cm->map = 0; + cm->next = NULL; + cm->ncells = w->gterm.ncolors; + for (i=0; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } else { + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (ERR); + } + + /* Compute the scaled colormap. Only the dynamic part of the colormap + * is scaled, the static cells are not affected. + */ + o_cmap.map = 0; + o_cmap.ncells = cm->ncells; + nelem = cm->ncells - SZ_STATIC_CMAP; + noscale = (abs(offset - 0.5) < 0.0001 && abs(slope - 1.0) < 0.0001); + + if (noscale) { + for (i=0; i < nelem; i++) { + o_cmap.r[i] = cm->r[SZ_STATIC_CMAP+i]; + o_cmap.g[i] = cm->g[SZ_STATIC_CMAP+i]; + o_cmap.b[i] = cm->b[SZ_STATIC_CMAP+i]; + } + } else { + for (i=0; i < nelem; i++) { + x = (float)i / (float)(nelem - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + r = cm->r[SZ_STATIC_CMAP]; + g = cm->g[SZ_STATIC_CMAP]; + b = cm->b[SZ_STATIC_CMAP]; + } else if (y >= 1.0) { + r = cm->r[cm->ncells-1]; + g = cm->g[cm->ncells-1]; + b = cm->b[cm->ncells-1]; + } else { + z = y * (nelem - 1) + SZ_STATIC_CMAP; + if (w->gterm.cmapInterpolate) { + c1 = (int)z; + c2 = min (cm->ncells-1, c1 + 1); + frac = z - c1; + r = cm->r[c1] * (1.0 - frac) + cm->r[c2] * frac; + g = cm->g[c1] * (1.0 - frac) + cm->g[c2] * frac; + b = cm->b[c1] * (1.0 - frac) + cm->b[c2] * frac; + } else { + c1 = (int)z; + r = cm->r[c1]; + g = cm->g[c1]; + b = cm->b[c1]; + } + } + + o_cmap.r[i] = r; + o_cmap.g[i] = g; + o_cmap.b[i] = b; + } + } + + /* Load the colormap into the display. */ + GtWriteColormap (w, 0, SZ_STATIC_CMAP, nelem, + o_cmap.r, o_cmap.g, o_cmap.b); + + /* If the colormap we loaded to the display was the display colormap, + * restore the original unscaled colors in the gterm descriptor so that + * we won't be scaling a scaled colormap in the next operation. + */ + if (map == 0) + for (i=SZ_STATIC_CMAP; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cp->red = cm->r[i]; + cp->green = cm->g[i]; + cp->blue = cm->b[i]; + } + + return (OK); +} + + +/* GtQueryColormap -- Return information on the size and state of a colormap. + */ +GtQueryColormap (w, map, first, nelem, maxelem) + register GtermWidget w; + int map; + int *first, *nelem, *maxelem; +{ + register struct colormap *cm; + int nitems; + + if (first) + *first = SZ_STATIC_CMAP; + if (nelem) + *nelem = 0; + if (maxelem) + *maxelem = min (w->gterm.maxColors, MAX_SZCMAP) - SZ_STATIC_CMAP; + + if (map > 0) { + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + if (nelem) + *nelem = cm->ncells - SZ_STATIC_CMAP; + + } else { + if (nelem) + *nelem = w->gterm.ncolors - SZ_STATIC_CMAP; + if (maxelem) { + nitems = min (MAX_SZCMAP, CellsOfScreen(w->gterm.screen)); + *maxelem = min (nitems, + min (w->gterm.maxColors, MAX_SZCMAP - w->gterm.base_pixel)); + } + } + + return (1); +} + + +/* GtNextColormap -- Return a unique colormap number. + */ +GtNextColormap (w) + register GtermWidget w; +{ + register struct colormap *cm; + register int mapno = 0; + + /* Get the next map number. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map > mapno) + mapno = cm->map; + + return (mapno + 1); +} + + +/* GtFreeColormap -- Free a colormap descriptor. + */ +GtFreeColormap (w, colormap) + register GtermWidget w; + int colormap; +{ + register struct colormap *p_cm, *cm; + + /* Find the colormap and free it. */ + for (p_cm = NULL, cm = w->gterm.colormaps; cm; p_cm = cm, cm = cm->next) + if (cm->map == colormap) { + if (p_cm) + p_cm->next = cm->next; + else + w->gterm.colormaps = cm->next; + XtFree ((char *)cm); + return; + } +} + + +/* GtWriteIomap -- An iomap is an optional lookup table used to isolate the + * client application from the color model used within the Gterm widget. + * To simplify color allocation the Gterm widget defines a logical color + * space where color 0 is the background, 1 the foreground, 2-N are statically + * allocated standard colors, and colors N+1 and above are dynamically + * allocated by the graphics application. Less-demanding applications use + * only the statically allocated, shared colors. The widget internally maps + * these logical colors to whatever the window system requires, but providing + * a well-defined logical color space isolates the client from the details of + * color allocation in the underlying window system. + * + * An iomap can be used to define a mapping between the color model of the + * client application and the Gterm color model (when we say color model here + * we mean color allocation schemes for 8 bit pseudocolor). By default the + * iomap is one-to-one. The use of an iomap frees the client from having to + * worry about color index translations, and allows color tables to be + * combined in the widget for greater efficiency when color tables are serially + * applied. The iomap applies to all color indices or pixel values passed + * in i/o operations between the client and the Gterm widget. + */ +GtWriteIomap (w, iomap, first, nelem) + register GtermWidget w; + ushort *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (&w->gterm.iomap[c1], iomap, nelem * sizeof(ushort)); + invalidate_cmap (w); +} + + +/* GtReadIomap -- Read back the contents of the iomap. + */ +GtReadIomap (w, iomap, first, nelem) + register GtermWidget w; + uchar *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (iomap, &w->gterm.iomap[c1], nelem * sizeof(ushort)); +} + + +/* init_iomap -- Initialize the iomap and the cmap cache. + */ +static void +init_iomap (w) + GtermWidget w; +{ + register ushort *iomap = w->gterm.iomap; + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + iomap[i] = i; + invalidate_cmap (w); +} + + +/* invalidate_cmap -- Invalidate the cmap cache. + */ +static void +invalidate_cmap (w) + register GtermWidget w; +{ + w->gterm.cmap_in_valid = w->gterm.cmap_out_valid = 0; +} + + +/* get_cmap_in -- Get the combined input colormap, used to transform color + * values received from the client to window system color indices. + */ +static Pixel * +get_cmap_in (w) + register GtermWidget w; +{ + register Pixel *cmap, *cmap_in = w->gterm.cmap_in; + register ushort *iomap; + register int i, j; + int ncolors; + + if (w->gterm.cmap_in_valid) + return (cmap_in); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + ncolors = w->gterm.ncolors - SZ_STATIC_CMAP; + + /* If ncolors is small wrap around so that pixel values stay within + * the mapped range of output pixels. + */ + for (i=0; i < MAX_SZCMAP; i++) { + j = iomap[i]; + if (j > SZ_STATIC_CMAP && ncolors) + j = ((j - SZ_STATIC_CMAP) % ncolors) + SZ_STATIC_CMAP; + cmap_in[i] = cmap[j]; + } + + w->gterm.cmap_in_valid++; + return (cmap_in); +} + + +/* get_cmap_out -- Get the combined output colormap, used to transform window + * system color indices to the color system of the client. Note that this is + * not necessarily a uniquely defined invertible transformation. + */ +static Pixel * +get_cmap_out (w) + GtermWidget w; +{ + register Pixel *cmap; + register ushort *iomap; + Pixel *cmap_out = w->gterm.cmap_out; + register int pixel, i; + int j; + + if (w->gterm.cmap_out_valid) + return (cmap_out); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + + /* Invert the two colormaps. This is not very efficient, but we don't + * have to do this very often (a GtReadPixels call is about the only + * case, and even then the map is cached). + */ + for (j=0; j < MAX_SZCMAP; j++) { + pixel = j; + + /* Lookup display pixel in cmap. */ + for (i=0; i < MAX_SZCMAP; i++) + if (cmap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + + /* Lookup cmap pixel in iomap. */ + if (iomap[pixel] != pixel) { + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + } + + cmap_out[j] = pixel; + } + + w->gterm.cmap_out_valid++; + return (cmap_out); +} + + +/* get_pixel -- Convert a client color index into a display pixel. + */ +static Pixel +get_pixel (w, client_pixel) + register GtermWidget w; + register int client_pixel; +{ + register Pixel *cmap = get_cmap_in (w); + + if (client_pixel < 0 || client_pixel >= MAX_SZCMAP) + return (w->gterm.cmap[1]); + else + return (cmap[client_pixel]); +} + + +/* GtGetClientPixel -- Convert a gterm pixel into a client pixel. + */ +GtGetClientPixel (w, pixel) + GtermWidget w; + register int pixel; +{ + register int i; + register ushort *iomap; + int client_pixel = 0; + + get_cmap_in (w); + iomap = w->gterm.iomap; + + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + client_pixel = i; + break; + } + + return (client_pixel); +} + + +/* GtInitMappings -- Delete all mappings and initialize the mapping subsystem. + */ +GtInitMappings (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + invalidate_draw_context (w); + + /* Free any mapping storage. */ + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (mp->defined) + free_mapping (w, mp); + } + XtFree ((char *)w->gterm.mappings); + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + } + + /* Allocate the initially empty mapping descriptors. */ + w->gterm.mappings = + (Mapping) XtCalloc (w->gterm.maxMappings, sizeof (struct mapping)); + + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + mp->mapping = i; + } + + w->gterm.nmappings = 0; +} + + +/* GtNextMapping -- Return the index of the next available mapping descriptor. + * This routine always returns a mapping index of 1 or higher. + */ +GtNextMapping (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + for (i=1; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + return (i); + } + + return (-1); +} + + +/* GtFreeMapping -- Free a mapping descriptor. + */ +GtFreeMapping (w, mapping) + register GtermWidget w; + int mapping; +{ + free_mapping (w, &w->gterm.mappings[mapping]); +} + + +/* GtRaiseMapping -- Set the stacking order of a mapping to one level + * higher than the reference mapping. If no reference mapping is given + * the mapping is raised to the top of the stacking order. + */ +GtRaiseMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = w->gterm.mp_tail; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already on top? */ + if (mp == w->gterm.mp_tail) + return; + + mp_unlink (w, mp); + mp_linkafter (w, mp, ref_mp); +} + + +/* GtLowerMapping -- Change the stacking order of a mapping relative to another + * mapping, causing the first mapping to be drawn below the second. + */ +GtLowerMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = NULL; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already lowered? */ + if (mp == w->gterm.mp_head) + return; + + /* Lower it. */ + mp_unlink (w, mp); + if (ref_mp && ref_mp->prev) + mp_linkafter (w, mp, ref_mp->prev); + else { + mp->next = w->gterm.mp_head; + w->gterm.mp_head = mp; + if (mp->next) + mp->next->prev = mp; + if (!w->gterm.mp_tail) + w->gterm.mp_tail = mp; + } +} + + +/* GtCompareMappings -- Compare the stacking order of two mappings. A + * negative value is returned if the m1 < m2, zero is returned if the + * mappings are the same, and a positive value is returned if m1 > m2. + */ +GtCompareMappings (w, map1, map2) + register GtermWidget w; + int map1, map2; +{ + register Mapping mp, mp1, mp2; + + if (map1 == map2) + return (0); + + mp1 = &w->gterm.mappings[map1]; + mp2 = &w->gterm.mappings[map2]; + + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp == mp1) + return (-1); + else if (mp == mp2) + return (1); + + return (0); +} + + +/* GtSelectRaster -- Select the raster which maps to the given raster pixel, + * and transform the coordinates back to the source raster. The raster number + * and the raster coordinates of the source raster are returned. If no raster + * maps to the given pixel, raster=src and source raster coordinates are + * returned. + * + * The raster pixel coordinate system is best explained by an example. + * Suppose we have a 10x10 raster mapped into a 500x500 window. The + * window pixel 0 on an axis has raster pixel coordinate 0.0; pixel 500 + * (which is outside the window) has raster pixel coordinate 10.0. The + * coordinates correspond to the edge of the pixel as displayed in the + * window, i.e., the left edge of the (nonflipped) window is at x=0.0, and + * the right edge at x=10.0. Due to the pixelization of the screen, the + * maximum value is a limit which is only approached as the magnification + * increases. + * + * The client application may have a different coordinate system than the + * above. For example, if the client wants an integer pixel value to be + * at the center of a pixel, the first pixel has the coordinate [1,1], and + * the raster is 10 pixels wide, the client coordinate system would range + * from 0.5 to 10.5 at the edges of the NDC space. + */ +GtSelectRaster (w, dras, dt, dx, dy, rt, rx, ry, rmap) + GtermWidget w; + int dras; /* display raster */ + int dt; /* coordinate type of input coords */ + int dx, dy; /* display raster coordinates */ + int rt; /* coordinate type for output */ + int *rx, *ry; /* raster coordinates (output) */ + int *rmap; /* mapping selected */ +{ + register Mapping mp; + float x, y, x2, y2; + int raster, mapping; + + /* Get display raster pixel coordinates. */ + if (dt != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, 0, 0,0,0,0, + 0, dt, dx,dy,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + dx = p_mp.dx; + dy = p_mp.dy; + } + + /* Search for a mapping which maps to this pixel. The mapping we are + * looking for is the mapping closest to the tail of the mapping list + * (highest stacking order) which is defined and enabled and which + * includes the given display raster pixel in its destination rect. + */ + for (mp = w->gterm.mp_tail, mapping = -1; mp; mp = mp->prev) { + if (mp->defined && mp->enabled && mp->dst == dras) { + struct mapping *map, p_mp; + int dnx, dny; + + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + if ((dnx = map->dnx) < 0) + dnx = -dnx; + if ((dny = map->dny) < 0) + dny = -dny; + + /* Is display raster pixel in destination rect for this mapping? + */ + if (dnx > 0 && dx >= map->dx && dx < map->dx + dnx && + dny > 0 && dy >= map->dy && dy < map->dy + dny) { + + /* Compute offset into destination rect and apply axis flip + * if any from mapping. + */ + x = dx - map->dx + 0.5; + if (map->dnx < 0) + x = dnx - x; + y = dy - map->dy + 0.5; + if (map->dny < 0) + y = dny - y; + + /* Compute the source raster coordinates corresponding to + * the given display pixel. This is done in floating point + * to permit fractional pixel resolution if the mapping + * zooms the raster. + */ + x = x * (float)map->snx / (float)dnx + map->sx; + y = y * (float)map->sny / (float)dny + map->sy; + + mapping = map->mapping; + raster = map->src; + x2 = w->gterm.rasters[raster].width; + y2 = w->gterm.rasters[raster].height; + + break; + } + } + } + + /* Return display raster coordinates if no mapped raster was found. + */ + if (mapping < 0) { + x = dx; y = dy; + x2 = (int)w->core.width - 1; + y2 = (int)w->core.height - 1; + raster = dras; + } + + /* Output coordinates of the requested type. The increased resolution + * of NDC coordinates allows fractional pixel coordinates to be returned + * (e.g. 1/32 of a pixel for a 1K raster). + */ + if (rt == GtPixel) { + *rx = x; + *ry = y; + } else { + *rx = ( x) / x2 * MAXNDC; + *ry = (y2 - y) / y2 * MAXNDC; /* NDC is flipped in Y */ + } + + *rmap = mapping; + return (raster); +} + + +/* GtCopyRaster -- Copy a region of the source raster to a region of the + * destination raster. If the input and output regions are not the same + * size the subimage is automatically scaled to fit the destination region. + * If the destination extent DNX or DNY is negative, the image is flipped in + * that axis. The type of spatial scaling performed is determined by the + * scale factors (zoom, dezoom, or no scaling). The rasterop argument is + * used to exercise fine control over how the mapping is performed, e.g., to + * force a refresh, implement a transient mapping, or in the case of a dezoom + * (many-to-one) mapping, select the antialiasing technique to be used. + */ +GtCopyRaster (w, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for destination raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + struct mapping sv_mp, p_mp; /* MF007 */ + int status; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Construct a temporary mapping describing the desired raster copy. */ + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, w->gterm.maxMappings, 0, + src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + initialize_mapping (&p_mp); + get_pixel_mapping (w, &sv_mp, &p_mp, 1); + update_mapping (w, &p_mp); + + /* Refresh the destination pixels. */ + status = refresh_destination (w, &p_mp, dx, dy, abs(dnx), abs(dny)); + + /* Discard the temporary mapping. */ + free_mapping (w, &p_mp); + + return (status); +} + + +/* GtSetMapping -- Define a new mapping function, or modify an old one. + * If a new mapping is defined it is merely enabled, and no refreshing + * of the screen takes place until either some mapped data is written + * to or the mapping is explicitly refreshed. If an existing mapping is + * modified the old and new mappings are examined and only those portions + * of the destination rect for which the mapping changed are updated. + * This permits minor changes to a mapping (e.g. moving an edge) without + * having to redraw the entire region. Regions of the destination drawable + * which were previously covered by the mapping but which were exposed by + * modifying the mapping are redrawn. + */ +GtSetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for source raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + register int i, j; + register Mapping mp, o_mp, n_mp; + struct mapping pix_mp, new_mp; + int defined, scale_changed, offset, current, state, old_i; + int nx, xs[MAX_REGIONS], xe[MAX_REGIONS], xv[MAX_REGIONS]; + int ny, ys[MAX_REGIONS], ye[MAX_REGIONS], yv[MAX_REGIONS]; + int n_dnx, n_dny, n_xflip=0, n_yflip=0, i1, i2; + int o_dnx, o_dny, o_xflip=0, o_yflip=0; + int *o_xymap, *o_xmap, *o_ymap; + int *n_xymap, *n_xmap, *n_ymap; + int dummy_rop; /* MF011 */ + XRectangle rl[MAX_REGIONS]; + int nrect, buflen, refresh; + + /* Check mapping number in range. */ + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (ERR); + else + mp = &w->gterm.mappings[mapping]; + + invalidate_draw_context (w); + initialize_mapping (&pix_mp); + initialize_mapping (&new_mp); + + /* Get local pixel space copy of old mapping, store new mapping. */ + get_pixel_mapping (w, mp, &pix_mp, 1); + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = snx; mp->sny = sny; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dnx; mp->dny = dny; + mp->rop = (rop & ~(R_RefreshNone|R_RefreshAll)); + mp->updated = 0; + + /* Newly defined mappings are linked at the tail of the mapping list, + * i.e. they stack (display) on top of any other mappings. If the + * mapping is already defined the stacking order is not changed. + */ + if (!(defined = mp->defined)) { + mp_linkafter (w, mp, w->gterm.mp_tail); + mp->defined = 1; + } + + if (!valid_mapping (w, mp)) { + mp_unlink (w, mp); + mp->defined = 0; + return (ERR); + } + update_mapping (w, mp); + + /* If we are defining a new mapping just define it and quit, without + * refreshing the window, unless R_RefreshAll is explicitly set in the + * mapping. If the mapping is not enabled merely store the new mapping. + * If the mapping is a null mapping (no pixels) do nothing. If refresh + * is disabled in the rasterop merely store the new mapping. If we are + * editing an existing mapping which is enabled with the default rasterop, + * we continue on to compare the old and new mappings and refresh any + * changed pixels in the destination rect. + */ + if (!defined || src != mp->src || dst != mp->dst) { + mp->enabled = mp->defined = 1; + mp->refresh = 0; + return (OK); + } else if (!mp->enabled) { + return (OK); + } else if (snx == 0 || sny == 0 || dnx == 0 || dny == 0) + return (OK); + + if (rop & R_RefreshNone) + return (OK); + + /* Convert input mappings to pixel coordinates, we deal with only pixel + * coordinates from here on. + */ + get_pixel_mapping (w, mp, &new_mp, 1); + load_mapping (&new_mp, &mapping, &dummy_rop, /* MF011 */ + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + update_mapping (w, n_mp = &new_mp); + update_mapping (w, o_mp = &pix_mp); + + /* + * We are editing an existing mapping. Determine what has changed in + * the mapping and refresh the changed regions. + */ + + /* Get old XY scaling maps. + */ + o_xmap = o_mp->x_srcpix; + o_ymap = o_mp->y_srcpix; + + if ((o_dnx = o_mp->dnx) < 0) { + o_dnx = -o_dnx; + o_xflip = 1; + } + if ((o_dny = o_mp->dny) < 0) { + o_dny = -o_dny; + o_yflip = 1; + } + + /* Get new XY scaling maps. + */ + n_xmap = n_mp->x_srcpix; + n_ymap = n_mp->y_srcpix; + + if (dnx < 0) { + dnx = -dnx; + n_xflip = 1; + } + if (dny < 0) { + dny = -dny; + n_yflip = 1; + } + + /* Refresh the entire region if the refresh flag is set, a flip has + * occurred, or we are doing a complex dezoom mapping. + */ + refresh = (o_mp->refresh || (rop & R_RefreshAll)); + if (n_xflip != o_xflip || n_yflip != o_yflip) + refresh = 1; + if (n_mp->scaling == M_DEZOOM) + refresh = 1; + + /* Has the spatial scale changed? */ + scale_changed = + abs (o_mp->xscale - n_mp->xscale) > 1.0E-4 || + abs (o_mp->yscale - n_mp->yscale) > 1.0E-4; + + /* If any of the above conditions are true refresh the entire mapping, + * otherwise compare the old and new mappings and refresh any subregions + * which have changed. + */ + if (refresh || scale_changed || n_mp->scaling == M_DEZOOM) { + refresh_destination (w, n_mp, dx, dy, dnx, dny); + + } else { + /* Compare the old and new mappings to see what needs to be + * refreshed. For speed reasons we only want to refresh the pixels + * which have been remapped. Any destination pixel in the new mapping + * which does not map to the same source pixel as in the old mapping + * must be refreshed. We examine each X and Y coordinate in the new + * destination rect and see if the source coordinate this maps to is + * the same as in the old mapping. If a given destination pixel [i,j] + * maps to the same pixel [i,j] in the source as it did in the + * previous mapping, we do not need to refresh that pixel. We examine + * the X and Y axis in turn and build up a list of regions which do or + * do not need to be refreshed. + */ + + /* Get a list of ranges {XS,XE,XV} in X. */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + dx, dnx, n_xmap, o_mp->dx, o_dnx, o_xmap); + + /* Get a list of ranges {YS,YE,YV} in Y. */ + ny = get_regions (ys,ye,yv, MAX_REGIONS, + dy, dny, n_ymap, o_mp->dy, o_dny, o_ymap); + + /* The list of ranges in X and Y together define a raster of arbitary + * sized subrectangles filling the destination rect. If the state + * value is nonzero (bit 1 set) in either X or Y, the subrectangle + * must be refreshed. The get_rects routine returns a list of the + * rectangular subregions matching the given condition (bit 1 set in + * either axis). Adjacent rectangles are merged to minimize the + * number of calls to refresh_destination. + */ + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 1,1); + for (i=0; i < nrect; i++) + refresh_destination (w, n_mp, + rl[i].x, rl[i].y, rl[i].width, rl[i].height); + } + + /* Refresh any lower level mappings exposed when the current mapping was + * modified. These will be regions of the old rect not present in the + * new, modified rect for the current mapping. + */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + o_mp->dx, o_dnx, o_xmap, dx, dnx, n_xmap); + ny = get_regions (ys,ye,yv, MAX_REGIONS, + o_mp->dy, o_dny, o_ymap, dy, dny, n_ymap); + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 2,2); + + for (i=0; i < nrect; i++) { + XRectangle r, in; + Mapping mp; + + /* Clear the uncovered region. */ + GtSetPixels (w, dst, GtPixel, rl[i].x, rl[i].y, rl[i].width, + rl[i].height, GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (mp = w->gterm.mp_head; mp && mp->mapping != mapping; + mp = mp->next) { + + if (mp->enabled && mp->dst == dst) { + r.x = mp->dx; + r.y = mp->dy; + r.width = mp->dnx; + r.height = mp->dny; + + if (rect_intersect (&in, &r, &rl[i])) + refresh_destination (w, mp, + in.x, in.y, in.width, in.height); + } + } + } + + free_mapping (w, n_mp); + free_mapping (w, o_mp); + mp = &w->gterm.mappings[mapping]; + mp->refresh = 0; + + return (OK); +} + + +/* GtGetMapping -- Return the external parameters of a mapping. If the + * numberd mapping is undefined -1 is returned; 0 is returned if the + * mapping is defined but not enabled, and 1 is returned if the mapping + * is active. + */ +GtGetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int *rop; /* rasterop */ + int *src; /* 0=window, >0 = raster number */ + int *st; /* coordinate type for source raster */ + int *sx,*sy,*snx,*sny; /* source raster */ + int *dst; /* 0=window, >0 = raster number */ + int *dt; /* coordinate type for source raster */ + int *dx,*dy,*dnx,*dny; /* destination raster */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (-1); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (-1); + + *rop = mp->rop; + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *snx = mp->snx; *sny = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dnx = mp->dnx; *dny = mp->dny; + + return (mp->enabled != 0); +} + + +/* GtActiveMapping -- Query whether a mapping is active. + */ +GtActiveMapping (w, mapping) + register GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (0); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (0); + + return (mp->enabled != 0); +} + + +/* GtEnableMapping -- Enable a mapping. Enabling a mapping does not + * update the destination unless the refresh flag is set. Enabling a + * mapping activates the mapping so that any changes to the source will + * be mapped to the destination. + */ +GtEnableMapping (w, mapping, refresh) + GtermWidget w; + int mapping; /* mapping number */ + int refresh; /* refresh destination */ +{ + register Mapping mp; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (!mp->enabled) { + mp->enabled = True; + if (refresh) + GtRefreshMapping (w, mapping); + } + return (OK); + } + } + return (ERR); +} + + +/* GtDisableMapping -- Disable a mapping. Disabling a mapping does not + * affect the mapping definition, hence a disabled mapping may later be + * reenabled. If the ERASE flag is set the destination region is redrawn + * with the mapping disabled. + */ +GtDisableMapping (w, mapping, erase) + GtermWidget w; + int mapping; /* mapping number */ + int erase; /* erase the destination */ +{ + register int i; + register Mapping mp, dmp; + XRectangle r, d, in; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->enabled) { + mp->enabled = False; + + if (erase) { + d.x = mp->dx; + d.y = mp->dy; + d.width = abs(mp->dnx); + d.height = abs(mp->dny); + + /* Clear the uncovered region. */ + GtSetPixels (w, mp->dst, GtPixel, + d.x, d.y, d.width, d.height, + GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (dmp = w->gterm.mp_head; + dmp && dmp->mapping != mapping; dmp = dmp->next) { + + if (dmp->enabled && dmp->dst == mp->dst) { + r.x = dmp->dx; + r.y = dmp->dy; + r.width = dmp->dnx; + r.height = dmp->dny; + + if (rect_intersect (&in, &r, &d)) + refresh_destination (w, dmp, + in.x, in.y, in.width, in.height); + } + } + } + } + return (OK); + } + } + + return (ERR); +} + + +/* GtRefreshMapping -- Refresh the destination region defined by a mapping. + */ +GtRefreshMapping (w, mapping) + GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + struct mapping p_mp; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->st != GtPixel || mp->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 1); + update_mapping (w, mp = &p_mp); + } else + update_mapping (w, mp); + + if (CacheXImage) /* MF004 */ + DestroyCachedXImage(); /* MF004 */ + + refresh_destination (w, mp, + mp->dx, mp->dy, abs(mp->dnx), abs(mp->dny)); + if (mp == &p_mp) + free_mapping (w, mp); + } + } +} + + +/* GtMapVector -- Map a point vector from the coordinate system of one raster + * to another as defined by the given mapping. The mapping may be either in + * the forward direction (dir = GtMap) or the reverse (dir = GtUnmap). The + * point vector is maintained in floating point for this operation to avoid + * loss of precision. The input and output vectors may be the same vector. + */ +GtMapVector (w, mapping, dir, pv1, pv2, npts) + GtermWidget w; + int mapping; + int dir; /* GtMap, GtUnmap */ + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register DPoint *ip = pv1; + register DPoint *op = pv2; + register Mapping mp; + register int n; + + struct mapping p_mp; + double xscale, xoffset; + double yscale, yoffset; + int sx, sy; + + xscale = yscale = 1.0; + xoffset = yoffset = 0.0; + sx = sy = 0; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (valid_mapping (w, mp)) { + /* Determine the transformation coefficients. */ + get_pixel_mapping (w, mp, &p_mp, 0); + mp = &p_mp; + + xscale = (float)mp->dnx / (float)mp->snx; + if (xscale < 0) + xoffset = mp->dx + abs(mp->dnx) - 1; + else + xoffset = mp->dx; + + yscale = (float)mp->dny / (float)mp->sny; + if (yscale < 0) + yoffset = mp->dy + abs(mp->dny) - 1; + else + yoffset = mp->dy; + + sx = mp->sx; + sy = mp->sy; + } + } + + /* Map the vector. */ + if (dir == GtMap) { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - sx) * xscale + xoffset; + op->y = (ip->y - sy) * yscale + yoffset; + } + } else { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - xoffset) / xscale + sx; + op->y = (ip->y - yoffset) / yscale + sy; + } + } +} + + +/* GtPixelToNDC -- Transform a vector from pixel to NDC coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtPixelToNDC (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ( ip->x) / rp->width * MAXNDC; + op->y = (rp->height - ip->y) / rp->height * MAXNDC; + } +} + + +/* GtNDCToPixel -- Transform a vector from NDC to pixel coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtNDCToPixel (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x / MAXNDC * rp->width; + op->y = rp->height - (ip->y / MAXNDC * rp->height); + } +} + + +/* GtDebug -- Print debug info. If the file descriptor is NULL output is + * to the process stdout. The "what" argument may be used to select the + * type of output desired. If what=0 the full output is generated, + * otherwise bits are used to select what output is to be generated. + * + * "what" bitflags: + * + * 001 Widget information + * 002 List rasters + * 004 List mappings + * 010 List colormaps + * 020 List markers + * + * This routine is intended only for use during debugging. + */ +GtDebug (w, fp, what) + GtermWidget w; + FILE *fp; + int what; +{ + /* Default is to write everything to the stdout. */ + what = what ? what : 0777; + fp = fp ? fp : stdout; + + /* Print widget header. */ + if (what & 001) { + fprintf (fp, "Widget 0x%x (%s) %dx%d raster=%d\n", + w, w->core.name, w->core.width, w->core.height, w->gterm.raster); + fprintf (fp, + "--------------------------------------------------------------\n"); + } + + /* Print raster information. */ + if (what & 002) { + register int i; + register Raster rp; + + if (w->gterm.rasters) { + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) + continue; + fprintf (fp, "raster %4d type=%s delete=%d size=%dx%d\n", + i, rp->type == ImageRaster ? "client" : "server", + rp->delete, rp->width, rp->height); + } + } else + fprintf (fp, "no rasters\n"); + } + + /* Print mapping information. */ + if (what & 004) { + register int i; + register Mapping mp; + char flags[32]; + + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + continue; + + flags[0] = mp->enabled ? 'E' : 'D'; + flags[1] = mp->updated ? 'U' : ' '; + flags[2] = mp->refresh ? 'R' : ' '; + flags[3] = '\0'; + + fprintf (fp, "mapping %3d %s %8o", i, flags, mp->rop); + fprintf (fp, " %2d %s %3d %3d %3d %3d", + mp->src, mp->st == GtPixel ? "pix" : "ndc", + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (fp, " %2d %s %3d %3d %3d %3d\n", + mp->dst, mp->dt == GtPixel ? "pix" : "ndc", + mp->dx, mp->dy, mp->dnx, mp->dny); + } + } else + fprintf (fp, "no mappings\n"); + + fprintf (fp, "mappings from head: "); + for (mp = w->gterm.mp_head; mp; mp = mp->next) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + + fprintf (fp, "mappings from tail: "); + for (mp = w->gterm.mp_tail; mp; mp = mp->prev) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + } + + /* Print colormap information. */ + if (what & 010) { + register struct colormap *cm; + + fprintf (fp, "cmapName=%s ncolors=%d basePixel=%d\n", + w->gterm.cmapName, w->gterm.ncolors, w->gterm.base_pixel); + for (cm = w->gterm.colormaps; cm; cm = cm->next) + fprintf (fp, "colormap %2d ncells=%d\n", cm->map, cm->ncells); + } + + /* Print marker information. */ + if (what & 020) { + register Marker mm; + char value[256]; + + for (mm = w->gterm.gm_head; mm; mm = mm->next) { + GmGetAttribute (mm, GmType, (XtArgVal)value, XtRString); + fprintf (fp, "marker 0x%x: %10s flags=0x%x [%d %d %d %d] %0.5g\n", + mm, value, mm->flags, mm->x, mm->y, mm->width, mm->height, + mm->rotangle); + } + } +} + + +/* + * Internal procedures for the above code. + * ---------------------------------------- + */ + +/* get_colormap -- Get a private colormap. On all calls after the first + * this just returns the existing gterm widget colormap. On the first call + * we query the server for the named custom colormap, and if the colormap + * exists we modify the gterm widget to use it. If the custom colormap has + * not yet been created by some other client, we create it. + * + * This code creates a custom colormap using the "standard colormap" + * facilities provided by XLIB. Although we do not use any of the predefined + * standard colormaps, use of the standard colormap facilities allows any + * number of clients to share the same custom colormap. Use of a custom + * colormap helps avoid running out of space in the default colormap, ensures + * that the gterm widget will get the color cells it needs, and makes it + * easier for several imaging clients which share the same colormap to + * simultaneously display their windows. + * + * To minimize colormap flashing we try to avoid using the full colormap, + * setting the unused cells to the colors set in the default colormap. In + * most cases this will prevent the rest of the screen from changing color + * when the custom colormap is installed. + */ +static Colormap +get_colormap (w) + GtermWidget w; +{ + register int i, j; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + XColor def_colors[SZ_STATIC_CMAP], *cp, *c1, *c2; + XStandardColormap cm, *cm_p; + XColor colors[MAX_SZCMAP]; + int base_pixel, p1, p2; + Colormap colormap; + char property[128]; + int ncmap, nitems; + Pixel pixel; + Atom atom; + + if (w->gterm.haveColormap) + return (w->core.colormap); + + /* Map custom colormap name to atom. */ + sprintf (property, "GT_%s", w->gterm.cmapName); + atom = XInternAtom (display, property, False); + w->gterm.cmapAtom = atom; + + /* Get custom colormap. + */ + if (!w->gterm.cmapInitialize && + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom)) { + + /* Colormap aleady exists, just use it. + */ + cm = *cm_p; + colormap = cm.colormap; + w->gterm.base_pixel = cm.base_pixel; + + } else { + /* Create or reinitialize a global colormap. + */ + XVisualInfo template, *vi; + Display *d; + Screen *s; + Window root; + long mask; + + if (!(d = XOpenDisplay (DisplayString(display)))) + goto use_default; + s = DefaultScreenOfDisplay (d); + root = DefaultRootWindow (d); + + /* Try to get a pseudocolor visual. */ + mask = 0; + template.screen = DefaultScreen(d); mask |= VisualScreenMask; + template.depth = RasterDepth; mask |= VisualDepthMask; + template.class = PseudoColor; mask |= VisualClassMask; + + if (!(vi = XGetVisualInfo (d, mask, &template, &nitems))) { + XCloseDisplay (d); + goto use_default; + } + + /* Create custom colormap with all cells allocated read/write */ + colormap = XCreateColormap (d, root, vi->visual, AllocAll); + + /* Initialize colormap to be same as default colormap. */ + nitems = min (MAX_SZCMAP, CellsOfScreen(s)); + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (d, DefaultColormapOfScreen(s), colors, nitems); + XStoreColors (d, colormap, colors, nitems); + + /* Globally define permanent server custom colormap. */ + memset ((char *)&cm, 0, sizeof(cm)); + cm.colormap = colormap; + cm.base_pixel = w->gterm.base_pixel; + cm.red_max = 0; + cm.visualid = vi->visualid; + cm.killid = 1; + XSetRGBColormaps (d, root, &cm, 1, atom); + + XSetCloseDownMode (d, RetainPermanent); + XCloseDisplay (d); + w->gterm.cmapInitialize = False; + + /* Free the XVisualInfo struct. */ + if (vi) + XFree ((void *)vi); /* MF040 */ + } + + /* Save default color assignments for static colors. */ + for (i=0; i < SZ_STATIC_CMAP; i++) + def_colors[i] = w->gterm.color[i]; + + nitems = min (MAX_SZCMAP, CellsOfScreen(screen)); + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + base_pixel = w->gterm.base_pixel; + + /* Get the private colormap. */ + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (display, colormap, colors, nitems); + + /* Initialize the raster pixel to display pixel mapping and set the + * color assigned to each pixel value in the private colormap. + */ + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, base_pixel + i - SZ_STATIC_CMAP); + w->gterm.color[i] = colors[pixel]; + } + + /* Check the static part of the cmap to make sure that the pixel numbers + * aren't aliased to pixels in the dynamic part of the custom colormap. + * If this happens, reassign these color numbers to the pixels just + * preceeding the dynamic part of the custom colormap. The red_max + * field of the colormap descriptor is used to keep track of the number + * of static colors allocated by different clients. These static colors + * are shared, hence the same color will not be stored twice. + */ + p1 = p2 = base_pixel - cm.red_max; + for (i=0; i < SZ_STATIC_CMAP; i++) { + pixel = w->gterm.cmap[i]; + if (pixel >= base_pixel && pixel < base_pixel+DEF_MAXCOLORS && p1 > 2) { + /* First check to see if we already have a static entry reserved + * for this color. + */ + c1 = &def_colors[i]; + for (j=p1, cp=NULL; j < base_pixel; j++) { + c2 = &colors[j]; + if (c1->red == c2->red && c1->green == c2->green && + c1->blue == c2->blue) { + cp = c2; + break; + } + } + + /* Assign a new screen pixel value. */ + if (cp) + w->gterm.cmap[i] = cp->pixel; + else { + cp = &colors[--p1]; + *cp = def_colors[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = w->gterm.cmap[i] = p1; + cm.red_max++; + } + w->gterm.color[i].pixel = w->gterm.cmap[i]; + } + } + if (p1 < p2) { + XStoreColors (display, colormap, &colors[p1], p2 - p1); + XSetRGBColormaps (display, w->gterm.root, &cm, 1, atom); + } + + /* Assign the new colormap to the gterm widget's window. */ + XtVaSetValues ((Widget)w, XtNcolormap, (XtArgVal)colormap, NULL); + w->gterm.haveColormap++; + + /* If the pointer is in the window, advise window manager to load the + * colortable for the window. + */ + if (w->gterm.in_window) +{ printf ("get_colormap ... requesting focus...\n"); + request_colormap_focus (w); +} + + return (colormap); + +use_default: + /* Unable to create custom colormap. */ + w->gterm.useDefaultCM++; + w->gterm.haveColormap++; + return (w->core.colormap); +} + + +/* request_colormap_focus -- Modify the WM_COLORMAP_WINDOWS property on a + * widget's top level shell window to advise the window manager that the + * widget's window should have its colormap loaded. This should only be + * used for windows that have a colormap different than that of the top + * level window. + */ +static +request_colormap_focus (w) + GtermWidget w; +{ + Widget p; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Find the top level window. */ + for (p = XtParent(w); !XtIsShell(p); p = XtParent(p)) + ; + + /* Modify WM_COLORMAP_WINDOWS to give the current window priority. + */ + if (p) { + Window window = XtWindow (p); + Window *wl = NULL, n_wl[MAX_WMWIN+1]; + register int n_nw, i; + int nw; + + /* If WM_COLORMAP_WINDOWS is already set save its value, otherwise + * start a list initially containing only the top level window. + */ + w->gterm.wmTop = window; + if (XGetWMColormapWindows (w->gterm.display, window, &wl, &nw)) { + memmove (w->gterm.wmWindows, (char *)wl, nw * sizeof(int)); + w->gterm.n_wmWindows = nw = min (nw, MAX_WMWIN); + free ((char *)wl); + } else { + w->gterm.wmWindows[0] = window; + w->gterm.n_wmWindows = nw = 1; + } + + n_nw = 0; + wl = w->gterm.wmWindows; + n_wl[n_nw++] = XtWindow(w); + + for (i=0; i < nw; i++) + if (wl[i] != XtWindow(w)) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, window, n_wl, n_nw); + } +} + + +/* restore_colormap_focus -- Reset WM_COLORMAP_WINDOWS. Retain the window + * that had the focus in the list, but drop its priority one notch. This + * should follow a prior call to request_colormap_focus. + */ +static +restore_colormap_focus (w) + GtermWidget w; +{ + register int nw, n_nw, i; + Window *wl, n_wl[MAX_WMWIN+1], old; + + if (!XtIsRealized ((Widget)w)) + return; + + old = XtWindow(w); + wl = w->gterm.wmWindows; + if ((nw = w->gterm.n_wmWindows) == 0 || (nw == 1 && wl[0] == old)) + return; + + n_nw = 0; + if (wl[0] != old) + n_wl[n_nw++] = wl[0]; + n_wl[n_nw++] = old; + + for (i=1; i < nw; i++) + if (wl[i] != old) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, w->gterm.wmTop, n_wl, n_nw); +} + + +/* inherit_default_colormap -- Set any unused cells of the custom colormap + * to the colors defined for the corresponding cells of the default colormap. + * This minimizes colormap flashing when using a custom colormap, but only + * works if a few unused cells can be reserved, e.g., at the beginning of + * the colormap (which is usually where X allocates its colors). + */ +static +inherit_default_colormap (w) + GtermWidget w; +{ + register XColor *cp, *ap; + register int ncolors, i; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + Window root = w->gterm.root; + Atom atom = w->gterm.cmapAtom; + XColor colors[MAX_SZCMAP]; + XStandardColormap *cm; + int first, nitems, ncmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.base_pixel <= 0) + return; /* fully allocated colormap */ + + /* We have to read the colormap property again as another client could + * have reserved more static colors (i.e.,changed red_max), and we don't + * want to clobber these colors. + */ + if (XGetRGBColormaps (display, root, &cm, &ncmap, atom)) { + /* Make sure we have the right colormap. */ + if (w->core.colormap != cm->colormap) + XtVaSetValues ((Widget)w,XtNcolormap,(XtArgVal)cm->colormap,NULL); + + /* Get lower part of default colormap. */ + ncolors = cm->base_pixel - cm->red_max; + for (cp=colors, i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = i; + } + + /* Get upper part of default colormap. */ + first = cm->base_pixel + w->gterm.ncolors - SZ_STATIC_CMAP; + ncolors = min (MAX_SZCMAP, CellsOfScreen(screen)) - first; + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = first + i; + } + + /* Inherit values from default colormap. */ + ncolors = cp - colors; + XQueryColors (display, DefaultColormapOfScreen(screen), + colors, ncolors); + XStoreColors (display, w->core.colormap, colors, ncolors); + + /* The global gterm colormap may have changed. Compare widget's + * version of color table with the global colortable and update + * the widget's state if the global colortable has changed. + */ + ncolors = w->gterm.ncolors; + memmove (colors, w->gterm.color, ncolors * sizeof(*cp)); + XQueryColors (display, w->core.colormap, colors, ncolors); + for (i=ncolors, cp=colors, ap=w->gterm.color; --i >= 0; cp++, ap++) + if (cp->red != ap->red || cp->green != ap->green || + cp->blue != ap->blue) { + memmove (w->gterm.color, colors, ncolors * sizeof(*cp)); + invalidate_cmap (w); + } + } +} + + +/* update_default_colormap -- Update the default colormap so that any + * unallocated cells mirror the widget's custom colormap. This increases + * the chance that the widget's contents will be visible when the window + * does not have the colormap focus, and minimizes flashing when the + * colormap focus changes. + */ +static +update_default_colormap (w) + GtermWidget w; +{ + register XColor *ip, *op; + register int j, n; + register Pixel v; + + XColor colors[MAX_SZCMAP]; + Pixel pixels[MAX_SZCMAP]; + char allocated[MAX_SZCMAP]; + int overflow, req, need, first, nelem, i; + unsigned long plane_masks[1]; + Colormap defcmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + + first = SZ_STATIC_CMAP; + nelem = w->gterm.ncolors; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + /* need = min (MAX_SZCMAP, first + nelem - SZ_STATIC_CMAP); */ + need = MAX_SZCMAP; + + /* Get the colormap cells. */ + for (req=need, n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, defcmap, False, + plane_masks, 0, &pixels[n], req)) { + n += req; + } else + req /= 2; + + /* Perform the color matching. This is awkward as the pixel value + * assignments may be different in the two colormaps. We have to look + * up each pixel before attempting to assign a color, or XStoreColors + * below will result in a server error. + */ + memset (allocated, 0, sizeof(allocated)); + overflow = 0; + + for (i=0; i < n; i++) { + v = pixels[i]; + if (v < MAX_SZCMAP) + allocated[v] = 1; + else { + overflow++; + break; + } + } + + ip = &w->gterm.color[first]; + op = colors; + if (overflow) { + for (i=0; i < nelem; i++, ip++) + for (j=0, v = ip->pixel; j < n; j++) + if (pixels[j] == v) { + *op++ = *ip; + break; + } + } else { + for (j=0; j < nelem; j++, ip++) + if (allocated[ip->pixel]) { + allocated[ip->pixel] = 0; + *op++ = *ip; + } + } + + if (op > colors) + XStoreColors (w->gterm.display, defcmap, + colors, op - colors); + + XFreeColors (w->gterm.display, defcmap, pixels, n, 0); +} + + +/* refresh_source -- Refresh a portion of a mapping given the source rect + * to be refreshed. If the given source rect is not within the mapping, + * this is a no-op. + */ +static +refresh_source (w, mp, x1, y1, nx, ny) + GtermWidget w; + register Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of source to be refreshed */ +{ + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Compute the intersection of the modified region of the source raster + * with the rectangular region of the source raster affected by the given + * mapping. + */ + sx1 = max (x1, mp->sx); + sy1 = max (y1, mp->sy); + sx2 = min(x1 + nx, mp->sx + mp->snx) - 1; + sy2 = min(y1 + ny, mp->sy + mp->sny) - 1; + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + /* Do nothing if the rectangles do not intersect. */ + if (snx <= 0 || sny <= 0) + return (OK); + + /* Compute the destination rect affected by the mapped source rect. + */ + dx1 = mp->x_extent[sx1 - mp->sx].lo; + dx2 = mp->x_extent[sx2 - mp->sx].hi; + if (dx1 > dx2) { + dx1 = mp->x_extent[sx2 - mp->sx].lo; + dx2 = mp->x_extent[sx1 - mp->sx].hi; + } + + dy1 = mp->y_extent[sy1 - mp->sy].lo; + dy2 = mp->y_extent[sy2 - mp->sy].hi; + if (dy1 > dy2) { + dy1 = mp->y_extent[sy2 - mp->sy].lo; + dy2 = mp->y_extent[sy1 - mp->sy].hi; + } + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + if (CacheXImage) /* MF004 */ + DestroyCachedXImage(); /* MF004 */ + + /* Perform the refresh operation. */ + return (refresh_destination (w, mp, dx1, dy1, dnx, dny)); +} + + +/* refresh_destination -- Refresh (redraw) the pixels in the given destination + * rect. The mapping operand defines how to generate the value of each output + * pixel. This is the routine which does all the real work of a mapping, + * computing the values of the output pixels and writing to the destination + * drawable. Note: the destination rect must be specified in raster pixel + * coordinates (no NDC). + */ +static +refresh_destination (w, mp, x1, y1, nx, ny) + GtermWidget w; + Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of destination to be refreshed */ +{ + Raster sr, dr; + Display *display = w->gterm.display; + int scaling, xflip, yflip, delxin=0, delxout=0; + int ox, oy, rop, clip, mapping, i, j; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int xoff, yoff, p1, p2, q1, q2; + float xscale, yscale; + struct mapping *np, p_mp; + XImage *xin, *xout; + int status = OK; + Pixmap pixmap; /* MF004 */ + + Region clip_region, mask_region; + uchar *old_xin_lp, *old_xout_lp; + uchar *xin_lp, *xout_lp, *op; + int xin_bpl, xout_bpl; + int *xmap, *ymap; + XRectangle r; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Offsets into the x_*,y_* mapping lookup tables. */ + xoff = x1 - mp->dx; + yoff = y1 - mp->dy; + + /* Get source and destination rects. */ + dst = mp->dst; + dx = x1; dy = y1; + dnx = nx; dny = ny; + + src = mp->src; + p1 = mp->x_srcpix[xoff]; + q1 = mp->y_srcpix[yoff]; + p2 = mp->x_srcpix[xoff + nx - 1]; + q2 = mp->y_srcpix[yoff + ny - 1]; + sx = min (p1, p2); + sy = min (q1, q2); + snx = abs (p2 - p1) + 1; + sny = abs (q2 - q1) + 1; + + /* Define some local variables. */ + sr = &w->gterm.rasters[src]; + dr = &w->gterm.rasters[dst]; + mapping = mp->mapping; + scaling = mp->scaling; + xscale = mp->xscale; + yscale = mp->yscale; + rop = mp->rop; + + if (!sr->type || !dr->type) + return (ERR); + if (snx <= 0 || sny <= 0 || dnx == 0 || dny == 0) + return (ERR); + if (src < 0 || src > w->gterm.maxRasters || + dst < 0 || dst > w->gterm.maxRasters) + return (ERR); + + /* Do we have a flip in X or Y? */ + xflip = mp->dnx < 0; + yflip = mp->dny < 0; + + /* Any higher numbered mappings which map to the same destination as the + * mapping MP will obscure the current mapping. Construct a clip mask + * defining the region of the destination we can write to. This will be + * the region not obscured by any higher numbered, active mappings. + */ + clip = False; + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; +#ifdef sun + /* As far as I can tell the Sun (probably in the OW X server) has an + * off by one bug affecting clipping in the server. A clip region is + * too small by one pixel at the right and bottom, causing these pixels + * to not be written when refreshing the screen (usually this shows up + * as black lines on the screen when a region is refreshed). So far + * I haven't seen this on any other platform. The problem is imperfectly + * understood and the following workaround may not completely workaround + * the problem. + */ + r.width++; r.height++; +#endif + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + + if (XRectInRegion (clip_region, + r.x, r.y, r.width, r.height) != RectangleOut) { + + mask_region = XCreateRegion(); + XUnionRectWithRegion (&r, mask_region, mask_region); + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + clip++; + } + } + + if (clip && dr->type == PixmapRaster) + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + + /* Handle the special case of a pixmap to pixmap (or window) copy in + * the server with no scaling. + */ + if (!scaling && sr->type == PixmapRaster && dr->type == PixmapRaster) { + if (src == 0 && dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XCopyArea (display, w->gterm.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XCopyArea (display, sr->r.pixmap, dr->r.pixmap, w->gterm.exposeGC, + sx, sy, snx, sny, dx, dy); + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) + XCopyArea (display, sr->r.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + } + goto done; + } + + /* Any other case requires working on ximages in the client. The first + * step is to get the source ximage. + */ + if (sr->type == PixmapRaster) { + /* Source is a pixmap but we need a local copy as either the + * destination is not a pixmap, or we need to do some scaling. + */ + if (CacheXImage) { /* MF004 */ + pixmap = (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap; + xin = GetCachedXImage (w, pixmap, sr->width, sr->height); + if (xin == NULL) { + xin = XGetImage (display, pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } else + NewCachedXImage (w, xin, pixmap, sr->width, sr->height); + } + } else { /* MF004 */ + xin = XGetImage (display, + (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } + delxin++; + } /* MF004 */ + + } else { + /* Source is an ximage. */ + xin = sr->r.ximage; + } + + /* Handle the special case of a copy of an ximage to an output pixmap + * with no scaling. + */ + if (!scaling && dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + } + goto done; + } + + /* Get output ximage. */ + if (dr->type == ImageRaster) { + xout = dr->r.ximage; + ox = dx; oy = dy; + } else { + uchar *data = (uchar *) XtMalloc (dnx * dny); + if (data == NULL) { + status = ERR; + goto done; + } + xout = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, dnx, dny, 8, 0); + if (xout == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + ox = 0; oy = 0; + delxout++; + } + + xin_lp = (uchar *)xin->data; + xout_lp = (uchar *)xout->data; + xin_bpl = xin->bytes_per_line; + xout_bpl = xout->bytes_per_line; + + /* Map a region of the input ximage XIN to the output ximage XOUT. Various + * approaches are used to generate the output data, depending upon what + * type of scaling we are doing. + */ + if (!scaling) { + /* No scaling. Copy a region of the ximage xin to xout without + * spatially scaling the image data. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + xin_lp = (uchar *)xin->data + sy * xin_bpl + sx; + xout_lp = (uchar *)xout->data + oy * xout_bpl + ox; + + for (j=0; j < dny; j++) { + memmove (xout_lp, xin_lp, dnx); + xin_lp += xin_bpl; + xout_lp += xout_bpl; + } + + } else if (scaling == M_INTZOOM) { + /* Integer zoom. The zoom factor is an integer, allowing the zoomed + * image to be calculated without using the xmap,ymap lookup tables. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + scale_intzoom (xin_lp,xin_bpl, xout_lp,xout_bpl, sx,sy, ox,oy,dnx,dny, + xflip,yflip, (int)(xscale + 0.5), (int)(yscale + 0.5)); + + } else if (scaling == M_ZOOM) { + /* We have a zoom, or one-to-many, scaling. Zoom scaling is always + * done with pixel replication. The [xy]_srcpix arrays in the mapping + * descriptor give the source pixel corresponding to each mapped pixel + * in the destination raster. + */ +zoom: + xmap = &mp->x_srcpix[xoff]; + ymap = &mp->y_srcpix[yoff]; + + scale_zoom (xin_lp, xin_bpl, xout_lp, xout_bpl, + xmap, ymap, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL); + + } else if (scaling == M_DEZOOM) { + /* We have a dezoom, or many-to-one, scaling. A block of pixels in + * the input raster are combined to generate the value of each output + * pixel, using one of several antialias algorithms to compute the + * output pixel value. + */ + float *x_src = &mp->x_src[xoff]; + float *y_src = &mp->y_src[yoff]; + int near_unitary = (xscale > 0.5 && yscale > 0.5); + int function; + + /* Get the antialising function to be applied. */ + if (!(function = (mp->rop & R_MFMask))) + function = MF_NEAREST; + + /* If the dezoom factor is small and either MF_BILINEAR or + * MF_NEAREST is enabled, use the indicated method to sample the + * input data. This uses all the data but minimizes smoothing. + */ + if ((function & (MF_BILINEAR|MF_NEAREST)) && near_unitary) + function = (function & MF_BILINEAR) ? MF_BILINEAR : MF_NEAREST; + else if (function != (function & (MF_BILINEAR|MF_NEAREST))) + function &= ~(MF_BILINEAR|MF_NEAREST); + +filter: + /* This can take a while so update the display. */ + XFlush (w->gterm.display); + + /* If the filtering operation involves any arithmetic combinations + * of pixels we must convert pixel numbers to pixel intensity values + * before performing the filtering operation. This is a case where + * we would be better off if frame buffers were maintained using + * pixel intensities rather than hardware pixel numbers. + */ + if (function != MF_NEAREST) { + uchar *data = (uchar *) XtMalloc (xin->width * xin->height); + if (data == NULL) { + status = ERR; + goto done; + } + + mf_getinten (w, + xin_lp, xin->width, xin->height, xin_bpl, sx,sy, + data, xin->width, xin->height, xin_bpl, sx,sy, snx,sny); + + if (!delxin) { + xin = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, xin->width, xin->height, 8, 0); + if (xin == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + delxin++; + } else { + XtFree ((char *)xin->data); + xin->data = (char *) data; + } + xin_lp = (uchar *)xin->data; + } + + /* Filter the source rect to the destination. */ + switch (function) { + case MF_NEAREST: + scale_nearest ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BILINEAR: + scale_bilinear ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BLKAVG: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 0, clip ? clip_region : (Region)NULL + ); + break; + case MF_BOXCAR: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 1, clip ? clip_region : (Region)NULL + ); + break; + case MF_LOWPASS: + scale_lowpass ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, clip ? clip_region : (Region)NULL + ); + break; + default: + function = MF_BILINEAR; + goto filter; + } + + /* If the operation was performed in intensity space convert back + * to pixel number. + */ + if (function != MF_NEAREST) + mf_getpixel (w, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, dnx,dny); + + } else { + status = ERR; + goto done; + } + + /* Copy the scaled ximage to the output pixmap, if any. + */ + if (dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + } + } + +done: + /* Clean up. + */ + if (delxin) + XDestroyImage (xin); + if (delxout) + XDestroyImage (xout); + + XDestroyRegion (clip_region); + if (clip && dr->type == PixmapRaster) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + + /* Execute any mappings defined on the raster just updated. */ + if (status == OK) { + GtRefreshPixels (w, dst, GtPixel, dx, dy, dnx, dny); + + if (dst == 0) { + Region clip_region = (Region)NULL; + XRectangle r; + + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; + XUnionRectWithRegion (&r, clip_region, clip_region); + + update_transients (w, clip_region); + XDestroyRegion (clip_region); + } + } + + return (status); +} + + +/* scale_zoom -- Compute the given destination rect from the input image, + * using pixel replication and the given x and y dst->scr pixels maps. + */ +static +scale_zoom (idata,ibpl, odata,obpl, xmap,ymap, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + register int *xmap; /* src coords of each dst pixel */ + int *ymap; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i, j; + register uchar *ip, *op; + uchar *last_ip = NULL; + uchar *last_op = NULL; + + for (j=0; j < dny; j++) { + ip = idata + ymap[j] * ibpl; + op = odata + (j+dy) * obpl + dx; + + if (!clip_region) { + if (ip == last_ip) + memmove (op, last_op, dnx); + else { + for (i=0; i < dnx; i++) + op[i] = ip[xmap[i]]; + } + last_ip = ip; + last_op = op; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = ip[xmap[i]]; + } + } +} + + +/* scale_intzoom -- Compute the given destination rect from the input image, + * using pixel replication and integer scaling. This is functionally + * equivalent to scale_zoom using the lookup tables, but optimized for the + * case of integer scaling. + */ +static +scale_intzoom (idata,ibpl,odata,obpl, sx,sy,dx,dy,dnx,dny, xflip,yflip, nx,ny) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + int sx, sy; /* start coords of src rect */ + int dx, dy, dnx, dny; /* destination rect */ + int xflip, yflip; /* set if x or y is flipped */ + int nx, ny; /* replication factors */ +{ + register int n; + register int pix; + register uchar *ip, *op; + uchar *otop, *olast, *lp; + int i, j, k; + + olast = odata + (dy + dny) * obpl - dnx + dx; + + if (xflip) { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + + op = odata + (dy + (yflip ? (dny-ny-j) : j)) * obpl + dx + dnx; + otop = lp = op - dnx; + + + /* Why are the case statements below necessary, doesn't the + * default case do the same thing regardless of what nx is? MJF + */ + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *--op = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op > otop) + *--op = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } else { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = lp = odata + (dy + (yflip ? (dny-ny-j) : j)) * obpl + dx; + otop = op + dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *op++ = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op < otop) + *op++ = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } +} + + +/* scale_nearest -- Compute the given destination rect from the input image, + * using the nearest neighbor technique. + */ +static +scale_nearest (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i, j; + register uchar *op; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = y_src[j]; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* scale_bilinear -- Compute the given destination rect from the input image, + * using bilinear interpolation. + */ +static +scale_bilinear (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = x_src[i] - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = y_src[j] - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* scale_lowpass -- Apply a lowpass filter to a region of a 2D data array. + * The region ox,oy,nx,ny of the output data array is calculated by running + * a convolution kernel over the region of the input data array at ix,iy. + * The size of the convolution kernel is adjusted to match the scale factors + * xscale, yscale. + */ +static +scale_lowpass (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + Region clip_region; /* clip Region or null */ +{ + uchar *data; + + if ((data = (uchar *) XtMalloc (inx * iny)) == NULL) + return; + + /* Run a lowpass filter over the input rect. */ + lw_convolve (idata,inx,iny,ibpl, sx,sy, data,inx,iny,ibpl, sx,sy, + snx,sny, xscale,yscale); + + /* Sample the filtered data to generate the output rect. */ + scale_nearest (data,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + dx,dy,dnx,dny, clip_region); + + XtFree ((char *)data); +} + + +/* lw_convolve -- Convolution primitive for scale_lowpass. + */ +static +lw_convolve (idata,inx,iny,ibpl,ix,iy, odata,onx,ony,obpl,ox,oy, + nx, ny, xscale, yscale) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ix, iy; /* size of input array, start pos */ + int onx, ony, ox, oy; /* size of output array, start pos */ + int ibpl, obpl; /* bytes per line */ + int nx, ny; /* size of output region */ + float xscale, yscale; /* determines amount of smoothing */ +{ + register uchar *ip; + register int l, m, x, hx, pixval; + int kx, ky, hy, i, j, y; + uchar *lp[11], *op; + + /* Determine kernel size (min 3x3, max 7x7). */ + if (xscale < 0.1) + hx = 3; + else if (xscale >= 0.5) + hx = 1; + else + hx = ((int)(1.0 / xscale)) / 2; + + if (yscale < 0.1) + hy = 3; + else if (yscale >= 0.5) + hy = 1; + else + hy = ((int)(1.0 / yscale)) / 2; + + kx = hx * 2 + 1; + ky = hy * 2 + 1; + + /* Compute the output data. + */ + for (j=0; j < ny; j++) { + /* Get line pointers. */ + op = odata + (j+oy) * obpl + ox; + for (i=0; i < ky; i++) { + y = iy + j - hy + i; + if (y < 0) + y = 0; + else if (y >= iny) + y = iny - 1; + lp[i] = y * ibpl + idata; + } + + /* Compute a line of output pixels */ + for (i=0; i < nx; i++) { + x = ix + i; + pixval = 0; + + if (x < hx) { + /* Near left edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][max(0,x-hx+l)]; + } else if (x >= inx - hx) { + /* Near right edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][min(inx-1,x-hx+l)]; + } else { + /* In central region. */ + for (m=0; m < ky; m++) { + ip = lp[m] + x - hx; + for (l=0; l < kx; l++) + pixval += ip[l]; + } + } + + op[i] = (float)pixval / (float)(kx * ky) + 0.5; + } + } +} + + +/* scale_boxcar -- Apply a boxcar filter to a region of a 2D data array + * and interpolate the result to the output grid. The region ox,oy,nx,ny of + * the output data array is calculated by block averaging the corresponding + * source rect and then sampling the reduced image using bilinear interpolation + * to compute the output pixel raster. This antialiasing technique aims to + * be as fast as possible but still does a reasonable job of reducing the + * image. + */ +static +scale_boxcar (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, interp, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + int interp; /* set if interpolation is desired */ + Region clip_region; /* clip Region or null */ +{ + int xblock, yblock; + int x1, x2, y1, y2, nx, ny; + float xstep, ystep; + int xoff, yoff; + uchar *bp; + + /* Determine blocking factors. If interpolation is disabled we need + * to block one step more than for the linear interpolate case in order + * to ensure that all the data is used. + */ + xblock = max(1, (int) (1.0 / xscale)); + if (!interp && (1.0 / xscale) - xblock > ZOOM_TOL) + xblock++; + yblock = max(1, (int) (1.0 / yscale)); + if (!interp && (1.0 / yscale) - yblock > ZOOM_TOL) + yblock++; + + /* Align the input region for the given blocking factors. */ + x1 = sx / xblock * xblock; x2 = (sx + snx - 1) / xblock * xblock; + y1 = sy / yblock * yblock; y2 = (sy + sny - 1) / yblock * yblock; + nx = (x2 - x1) / xblock + 1; ny = (y2 - y1) / yblock + 1; + + /* Compute the block averaged input rect. */ + if (xblock > 1 || yblock > 1) { + if ((bp = (uchar *) XtMalloc (nx * ny)) == NULL) + return; + bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, bp, xblock, yblock); + idata = bp; + inx = ibpl = nx; + iny = ny; + xoff = x1; yoff = y1; + xstep = 1.0 / xblock; ystep = 1.0 / yblock; + } else { + bp = NULL; + xoff = yoff = 0; + xstep = ystep = 1.0; + } + + /* Interpolate the input rect to the output grid. */ + if (interp && + ((1.0 / xscale) - xblock) > ZOOM_TOL || + ((1.0 / yscale) - yblock) > ZOOM_TOL) { + + /* Use bilinear interpolation to compute the output grid. */ + bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + + } else { + /* Extract pixels from block averaged input data. */ + bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + } + + if (bp) + XtFree ((char *)bp); +} + + +/* bx_boxcar -- Block average primitive for scale_boxcar. + */ +static +bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, obuf, xblock, yblock) + uchar *idata; /* input data array */ + int inx, iny, ibpl; /* array dimensions */ + int x1,y1,x2,y2; /* region to be block averaged */ + uchar *obuf; /* output array */ + int xblock, yblock; /* blocking factors */ +{ + register uchar *ip, *op; + register int count, i, *sp; + int obpl, block, nxblocks, nyblocks, j, k; + uchar *lp, *bp; + int *sb; + + nxblocks = obpl = (x2 - x1) / xblock + 1; + nyblocks = (y2 - y1) / yblock + 1; + count = xblock * yblock; + + if ((sb = (int *) XtMalloc (obpl * sizeof(int))) == NULL) + return; + + /* I don't think the following works for pixel values allocated from the + * default colormap, as the pixel values are not sequentially allocated. + */ + for (block = 0; block < nyblocks; block++) { + lp = idata + ibpl * (block * yblock + y1) + x1; + bp = obuf + block * obpl; + + memset (sb, 0, obpl * sizeof(int)); + for (k=yblock; --k >= 0; lp += ibpl) + for (j=nxblocks, ip=lp, sp=sb; --j >= 0; sp++) + for (i=xblock; --i >= 0; ) + *sp += *ip++; + + for (i=obpl, sp=sb, op=bp; --i >= 0; ) + *op++ = *sp++ / count; + } + + XtFree ((char *)sb); +} + + +/* bx_extract -- Block extract primitive for scale_boxcar. + */ +static +bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i; + register uchar *op; + int j; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = (y_src[j] - yoff) * ystep; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* bx_interp -- Bilinear interpolation primitive for scale_boxcar. + */ +static +bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = ((x_src[i] - xoff) * xstep) - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = ((y_src[j] - yoff) * ystep) - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* mf_getinten -- Copy the source rect to the destination rect, converting + * pixel numbers to pixel intensities. + */ +static +mf_getinten (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_out (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* mf_getpixel -- Copy the source rect to the destination rect, converting + * pixel intensities to pixel numbers. + */ +static +mf_getpixel (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_in (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* get_regions -- For each pixel I in the sequence of DNX pixels starting at DX + * there is an associated value XMAP[I]. Compare this sequence to an alternate + * sequence and return a list of subregions {XS,XE,XV} for which the XMAP + * values are equal (XV=0), not equal (XV=1), or not common to (XV=2) the two + * regions. The number of regions output is returned as the function value. + */ +static +get_regions (xs,xe,xv, max_regions, dx, dnx, xmap, alt_dx, alt_dnx, alt_xmap) + int *xs, *xe, *xv, max_regions; + int dx, dnx, *xmap; + int alt_dx, alt_dnx, *alt_xmap; +{ + register int state, current; + register int nx, i; + int offset, old_i; + + offset = dx - alt_dx; + nx = 0; + + for (i=0; i < dnx; i++) { + if (nx >= max_regions-1) + return (0); + + /* Determine whether or not this pixel is mapped the same in both + * sequences. + */ + old_i = i + offset; + if (alt_dnx <= 0 || old_i < 0 || old_i >= alt_dnx) + state = 2; + else + state = (xmap[i] != alt_xmap[old_i]); + + /* When the state boundary is crossed add a range. */ + if (i == 0) { + xs[nx] = dx; + xv[nx] = current = state; + } + if (state != current) { + xe[nx] = dx + i - 1; + xs[++nx] = dx + i; + xv[nx] = current = state; + } + if (i == dnx-1) + xe[nx++] = dx + i; + } + + return (nx); +} + + +/* get_rects -- Combine two lists of regions, one in X and the other in Y, + * to produce a list of 2D rectangles defining the regions outlined by the + * region lists. Only rects for which the given condition is true in either + * X or Y are selected. Adjacent rects are combined. + */ +static +get_rects (o_rl, max_rects, xs,xe,xv,nx, ys,ye,yv,ny, xcond,ycond) + XRectangle *o_rl; /* receives list of rectangles */ + int max_rects; /* max rectangles out */ + int *xs, *xe, *xv, nx; /* X list of regions */ + int *ys, *ye, *yv, ny; /* Y list of regions */ + int xcond, ycond; /* X,Y condition bitflags */ +{ + register int i, j; + XRectangle rl[MAX_REGIONS]; + int limit = min (max_rects, MAX_REGIONS); + int o_nrects=0, nrects=0; + int i1, i2, j1, j2; + + /* Get initial list of rects matching the given X and Y conditions. + * Rects which are adjacent in X are combined to form one larger rect. + */ + for (j=0; j < ny; j++) { + for (i=0; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) { + /* Collapse rects adjacent in X. */ + for (i1 = i2 = i++; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) + i2 = i; + else + break; + } + + rl[nrects].x = xs[i1]; + rl[nrects].y = ys[j]; + rl[nrects].width = xe[i2] - xs[i1] + 1; + rl[nrects].height = ye[j] - ys[j] + 1; + + if (++nrects >= limit) + return (nrects); + } + } + } + + /* Now scan the rect list and collapse rects which are adjacent in Y + * into one larger rect. Find all the rects that are at the same X + * and write them to the output list, collapsing rects that are adjacent + * in Y in the process. + */ + for (i=0; i < nx; i++) + for (j=0; j < nrects; ) { + /* Find first rect if any. */ + for (j1=0, j2 = -1; j < nrects; j++) + if (rl[j].x == xs[i]) { + j1 = j2 = j++; + break; + } + + /* Collapse rects adjacent in Y. */ + for ( ; j < nrects; j++) + if (rl[j].x == xs[i]) + if (rl[j].y == rl[j2].y + rl[j2].height && + rl[j].width == rl[j1].width) + j2 = j; + else + break; + + /* Output the rect. */ + if (j2 >= j1) { + o_rl[o_nrects].x = rl[j1].x; + o_rl[o_nrects].y = rl[j1].y; + o_rl[o_nrects].width = rl[j1].width; + o_rl[o_nrects].height = rl[j2].y + rl[j2].height - rl[j1].y; + + if (++o_nrects >= max_rects) + return (o_nrects); + } + } + + return (o_nrects); +} + + +/* rect_intersect -- Compute the intersection of two rects. The area of + * the intersection is returned as the function value, i.e., zero is + * returned if the rects do not intersect. + */ +static +rect_intersect (in, r1, r2) + register XRectangle *in; + register XRectangle *r1, *r2; +{ + int x1, y1, x2, y2; + + x1 = max (r1->x, r2->x); + y1 = max (r1->y, r2->y); + x2 = min ((int)r1->x + (int)r1->width, (int)r2->x + (int)r2->width) - 1; + y2 = min ((int)r1->y + (int)r1->height, (int)r2->y + (int)r2->height) - 1; + + in->x = x1; + in->y = y1; + in->width = max (0, x2 - x1 + 1); + in->height = max (0, y2 - y1 + 1); + + return (in->width * in->height); +} + + +/* save_mapping -- Store a mapping in a mapping descriptor. + */ +static +save_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int mapping, rop; + int src, st, sx,sy,sw,sh; + int dst, dt, dx,dy,dw,dh; +{ + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = sw; mp->sny = sh; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dw; mp->dny = dh; + mp->defined = mp->enabled = mp->refresh = 1; + mp->mapping = mapping; + mp->rop = rop; +} + +/* load_mapping -- Load a mapping from a mapping descriptor. + */ +static +load_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int *mapping, *rop; + int *src, *st, *sx,*sy,*sw,*sh; + int *dst, *dt, *dx,*dy,*dw,*dh; +{ + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *sw = mp->snx; *sh = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dw = mp->dnx; *dh = mp->dny; + *mapping = mp->mapping; + *rop = mp->rop; +} + + +/* get_pixel_mapping -- Copy a mapping, converting to pixel coordinates in + * the process if the mapping is not already in pixel coordinates. + */ +static +get_pixel_mapping (w, mp1, mp2, update) + GtermWidget w; + register Mapping mp1; /* input mapping */ + register Mapping mp2; /* output mapping */ + int update; /* update mapping */ +{ + float maxndc = (float)MAXNDC; + + mp2->mapping = mp1->mapping; + mp2->refresh = mp1->refresh; + mp2->enabled = mp1->enabled; + mp2->rop = mp1->rop; + + if (!(mp2->defined = mp1->defined)) + return; + + mp2->src = mp1->src; + if (mp1->st == GtPixel) { + mp2->st = mp1->st; + mp2->sx = mp1->sx; mp2->sy = mp1->sy; + mp2->snx = mp1->snx; mp2->sny = mp1->sny; + } else { + float width = w->gterm.rasters[mp1->src].width; + float height = w->gterm.rasters[mp1->src].height; + mp2->sx = mp1->sx * width / maxndc; + mp2->sy = (MAXNDC - (mp1->sy + abs(mp1->sny))) * height / maxndc; + mp2->snx = mp1->snx * width / maxndc; + mp2->sny = mp1->sny * height / maxndc; /* NDC flipped in Y */ + mp2->st = GtPixel; + } + + mp2->dst = mp1->dst; + if (mp1->dt == GtPixel) { + mp2->dt = mp1->dt; + mp2->dx = mp1->dx; mp2->dy = mp1->dy; + mp2->dnx = mp1->dnx; mp2->dny = mp1->dny; + } else { + float width = w->gterm.rasters[mp1->dst].width; + float height = w->gterm.rasters[mp1->dst].height; + mp2->dx = mp1->dx * width / maxndc; + mp2->dy = (MAXNDC - (mp1->dy + abs(mp1->dny))) * height / maxndc; + mp2->dnx = mp1->dnx * width / maxndc; + mp2->dny = mp1->dny * -height / maxndc; /* NDC flipped in Y */ + mp2->dt = GtPixel; + } + + /* The lookup tables are already in pixel space, so we can propagate + * these to the new mapping if the old mapping was updated. + */ + if (update && mp1->updated) { + if (mp2->mapdata = (uchar *) XtMalloc (mp1->datalen)) { + + memmove (mp2->mapdata, mp1->mapdata, mp1->datalen); + mp2->datalen = mp1->datalen; + mp2->scaling = mp1->scaling; + mp2->xscale = mp1->xscale; + mp2->yscale = mp1->yscale; + + mp2->x_extent = (mapExtent *) + ((uchar *)mp1->x_extent - mp1->mapdata + mp2->mapdata); + mp2->y_extent = (mapExtent *) + ((uchar *)mp1->y_extent - mp1->mapdata + mp2->mapdata); + mp2->x_srcpix = (int *) + ((uchar *)mp1->x_srcpix - mp1->mapdata + mp2->mapdata); + mp2->y_srcpix = (int *) + ((uchar *)mp1->y_srcpix - mp1->mapdata + mp2->mapdata); + mp2->x_src = (float *) + ((uchar *)mp1->x_src - mp1->mapdata + mp2->mapdata); + mp2->y_src = (float *) + ((uchar *)mp1->y_src - mp1->mapdata + mp2->mapdata); + + mp2->updated = 1; + } + } else + mp2->updated = 0; +} + +/* valid_mapping -- Perform some sanity checks on a mapping to verify that + * it contains something meaningful. + */ +static +valid_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register int x, y; + int snx, sny, dnx, dny; + int s_width, s_height, d_width, d_height; + Raster sr, dr; + + if (!mp || !mp->defined) + return (False); + + if (mp->src < 0 || mp->src >= w->gterm.maxRasters) + return (False); + if (mp->dst < 0 || mp->dst >= w->gterm.maxRasters) + return (False); + + sr = &w->gterm.rasters[mp->src]; + dr = &w->gterm.rasters[mp->dst]; + if (!sr->type || !dr->type) + return (False); + + switch (mp->st) { + case GtPixel: + s_width = sr->width; s_height = sr->height; + break; + case GtNDC: + s_width = MAXNDC + 1; s_height = MAXNDC + 1; + break; + default: + return (False); + } + + switch (mp->dt) { + case GtPixel: + d_width = dr->width; d_height = dr->height; + break; + case GtNDC: + d_width = MAXNDC + 1; d_height = MAXNDC + 1; + break; + default: + return (False); + } + + snx = mp->snx; dnx = abs(mp->dnx); + sny = mp->sny; dny = abs(mp->dny); + if (snx <= 0 || dnx <= 0 || sny <= 0 || dny <= 0) + return (False); + + x = mp->sx; y = mp->sy; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + x = mp->sx + snx - 1; y = mp->sy + sny - 1; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + + x = mp->dx; y = mp->dy; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + x = mp->dx + dnx - 1; y = mp->dy + dny - 1; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + + return (True); +} + + +/* initialize_mapping -- Initialize the contents of a mapping descriptor. + */ +static +initialize_mapping (mp) + register Mapping mp; +{ + memset ((char *)mp, 0, sizeof(struct mapping)); +} + + +/* update_mapping -- Update the portion of a mapping descriptor used at + * runtime to execute the mapping. This information consists of several + * lookup tables and other parameters describing how a destination pixel + * maps back to a source pixel and vice versa. + */ +static +update_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register uchar *op; + register int i, j, k; + int snx, sny, dnx, dny, sx, sy, dx, dy; + int xmax, ymax, lo, hi, edge1, edge2; + int temp, xflip=0, yflip=0; + struct mapping p_mp; + float pixwidth, *fp; + int *ip; + + if (mp->updated) + return; + + /* The internal lookup tables are in pixel units. */ + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 0); + + if ((snx = p_mp.snx) <= 0 || (sny = p_mp.sny) <= 0) + return; + + if ((dnx = p_mp.dnx) < 0) { + dnx = -dnx; + xflip++; + } + if ((dny = p_mp.dny) < 0) { + dny = -dny; + yflip++; + } + + sx = p_mp.sx; + sy = p_mp.sy; + dx = p_mp.dx; + dy = p_mp.dy; + xmax = dnx - 1; + ymax = dny - 1; + + /* Discard the temporary mapping. + free_mapping (w, &p_mp); + */ + + /* Get scale factors. */ + mp->xscale = (float)dnx / (float)snx; + mp->yscale = (float)dny / (float)sny; + + /* Determine type of scaling to be used. */ + if (mp->xscale < 1.0 || mp->yscale < 1.0) { + mp->scaling = M_DEZOOM; + } else if (mp->xscale > 1.0 || mp->yscale > 1.0) { + mp->scaling = M_ZOOM; + if (abs(mp->xscale - (int)(mp->xscale+0.5)) < ZOOM_TOL && + abs(mp->yscale - (int)(mp->yscale+0.5)) < ZOOM_TOL) + mp->scaling = M_INTZOOM; + } else + mp->scaling = (xflip || yflip) ? M_ZOOM : M_NOSCALING; + + /* Get a data buffer for the lookup tables. */ + mp->datalen = + snx * sizeof(mapExtent) + /* xy, extent */ + sny * sizeof(mapExtent) + + dnx * sizeof(int) + /* xy, srcpix */ + dny * sizeof(int) + + dnx * sizeof(float) + /* xy, src */ + dny * sizeof(float); + + if (mp->mapdata) + mp->mapdata = (uchar *) XtRealloc ((char *)mp->mapdata, mp->datalen); + else + mp->mapdata = (uchar *) XtMalloc (mp->datalen); + if (mp->mapdata == NULL) + return; + + /* Set the table pointers. */ + op = mp->mapdata; + mp->x_extent = (mapExtent *) op; op += snx * sizeof(mapExtent); + mp->y_extent = (mapExtent *) op; op += sny * sizeof(mapExtent); + mp->x_srcpix = (int *) op; op += dnx * sizeof(int); + mp->y_srcpix = (int *) op; op += dny * sizeof(int); + mp->x_src = (float *) op; op += dnx * sizeof(float); + mp->y_src = (float *) op; op += dny * sizeof(float); + + /* Compute the backpointers to the source raster for each destination + * pixel center. + */ + for (i=0, ip = mp->x_srcpix, fp = mp->x_src; i < dnx; i++) { + fp[i] = ((xflip ? xmax - i : i) + 0.5) / mp->xscale + sx; + ip[i] = fp[i]; + } + for (i=0, ip = mp->y_srcpix, fp = mp->y_src; i < dny; i++) { + fp[i] = ((yflip ? ymax - i : i) + 0.5) / mp->yscale + sy; + ip[i] = fp[i]; + } + + /* Compute the extent arrays. These define the range of destination + * pixels affected by each source pixel. + */ + lo = dnx - 1 + dx; + hi = dx; + for (i=0; i < snx; i++) { + mp->x_extent[i].lo = lo; + mp->x_extent[i].hi = hi; + } + lo = dny - 1 + dy; + hi = dy; + for (i=0; i < sny; i++) { + mp->y_extent[i].lo = lo; + mp->y_extent[i].hi = hi; + } + + /* Map the left and right or top and bottom edges of each destination + * pixel back into the source rect and update the corresponding extent + * entries to indicate that these source pixels are used to compute the + * destination pixel. + */ + pixwidth = 1.0 - ZOOM_TOL; + + for (i=0; i < dnx; i++) { + edge1 = (xflip ? xmax - i : i) / mp->xscale; + edge2 = (xflip ? xmax - (i-pixwidth) : (i+pixwidth)) / mp->xscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (snx - 1, edge2); + + for (j=edge1, k = dx + i; j <= edge2; j++) { + if (mp->x_extent[j].lo > k) + mp->x_extent[j].lo = k; + if (mp->x_extent[j].hi < k) + mp->x_extent[j].hi = k; + } + } + + for (i=0; i < dny; i++) { + edge1 = (yflip ? ymax - i : i) / mp->yscale; + edge2 = (yflip ? ymax - (i-pixwidth) : (i+pixwidth)) / mp->yscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (sny - 1, edge2); + + for (j=edge1, k = dy + i; j <= edge2; j++) { + if (mp->y_extent[j].lo > k) + mp->y_extent[j].lo = k; + if (mp->y_extent[j].hi < k) + mp->y_extent[j].hi = k; + } + } + + mp->updated = 1; +} + + +/* free_mapping -- Free any storage used internally by a mapping descriptor, + * and deactivate the mapping. + */ +static +free_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + mp_unlink (w, mp); + mp->defined = mp->enabled = mp->updated = 0; + if (mp->mapdata) { + XtFree ((char *) mp->mapdata); + mp->mapdata = NULL; + mp->datalen = 0; + mp->x_extent = mp->y_extent = NULL; + mp->x_srcpix = mp->y_srcpix = NULL; + mp->x_src = mp->y_src = NULL; + mp->updated = 0; + } +} + +static void +mp_linkafter (w, mp, ref_mp) + register GtermWidget w; + register Mapping mp; + register Mapping ref_mp; +{ + register Mapping map; + + /* Don't use the reference mapping unless it is already linked or + * the list is empty. + */ + if (w->gterm.mp_head) { + for (map = w->gterm.mp_head; map && map != ref_mp; map = map->next) + ; + if (map != ref_mp) + ref_mp = NULL; + } + + mp->prev = ref_mp; + mp->next = ref_mp ? ref_mp->next : NULL; + if (ref_mp && ref_mp->next) + ref_mp->next->prev = mp; + if (ref_mp) + ref_mp->next = mp; + + if (!w->gterm.mp_tail || ref_mp == w->gterm.mp_tail) + w->gterm.mp_tail = mp; + if (!w->gterm.mp_head) + w->gterm.mp_head = mp; +} + + +static void +mp_unlink (w, mp) + register GtermWidget w; + register Mapping mp; +{ + if (mp->prev) + mp->prev->next = mp->next; + if (mp->next) + mp->next->prev = mp->prev; + if (w->gterm.mp_head == mp) + w->gterm.mp_head = mp->next; + if (w->gterm.mp_tail == mp) + w->gterm.mp_tail = mp->prev; + + mp->prev = mp->next = NULL; +} + + +/* + * Graphics MARKERS. + * -------------------- + * A marker is an active graphics object displayed on top of a drawing to + * mark, annotate, or outline a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. Markers are used to + * interactively define regions with the mouse, to provide a dynamic graphical + * display which doesn't interfere with the underlying graphics frame, or as a + * graphical means of command input, using callbacks to perform some operation + * when the marker is moved or resized by the user. + * + * GtMarkerInit (w) + * GtMarkerFree (w) + * + * gm = GmCreate (w, type, interactive) + * GmRedisplay (w, region|NULL) + * gm = GmCopy (gm) + * GmDestroy (gm) + * GmAddCallback (gm, events, func, client_data) + * GmDeleteCallback (gm, func, client_data) + * gm = GmSelect (gt, x, y, &what) + * + * GmMarkpos (gm) + * GmRedraw (gm, func, erase) + * GmRaise (gm, ref_gm|NULL) + * GmLower (gm, ref_gm|NULL) + * GmNotify (gm, events, event, param, nparams) + * + * GmAddPt (gm, x, y) + * GmDeletePt (gm, x, y) + * GmMovePt (gm, x, y) + * GmMove (gm, x, y) + * GmResize (gm, x, y) + * GmRotate (gm, x, y) + * + * GmSetAttributes (gm, args, nargs, type) + * GmGetAttributes (gm, args, nargs, type) + * GmSetAttribute (gm, attribute, value, type) + * GmGetAttribute (gm, attribute, value, type) + * GmSetVertices (gm, points, first, npts) + * npts = GmGetVertices (gm, points, first, maxpts) + * GmGetBoundingBox (gm, x, y, width, height) + * + * type = GmStrToType (marker_type) + * event = GmStrToEvent (event_type) + * func = GmStrToFunction (drawing_function) + * + * Markers operate in screen coordinates (raster 0). The SelectRaster + * and MapVector routines may be used to convert to and from raster + * coordinates if desired. + * + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mp) + * GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + * + * The Gm procedures above implement the main functionality of markers. User + * interaction is provided at a higher level using action procedures which + * are bound to pointer and keyboard events via translations (or by the GUI + * itself directly calling the above procedures). + */ + +static void gm_text_init(), gm_line_init(), gm_plin_init(), gm_rect_init(); +static void gm_boxx_init(), gm_circ_init(), gm_elip_init(), gm_pgon_init(); +static int gm_putint(), gm_putfloat(), gm_do_callbacks(), gm_constraint(); +static int gm_getint(), gm_getattribute(), gm_gettype(); +static double gm_getfloat(); +static char *gm_getstring(); + +static void gm_markpos(), gm_erase(), gm_redraw(), gm_setCurRect(); +static void gm_linkafter(), gm_unlink(); +static double gm_niceAngle(); +static Pixel gm_getpixel(); +static int gm_select(); +static int gm_getfillstyle(); + +static GmVMethod gm_classinit[] = { + gm_text_init, gm_line_init, gm_plin_init, gm_rect_init, + gm_boxx_init, gm_circ_init, gm_elip_init, gm_pgon_init +}; + +static Region null_region; +static XRectangle null_rect = { 0, 0, 0, 0 }; +#define NullRect(r) (!(r)->width || !(r)->height) + +#define PI_2 1.57079632679489661923 +#define PI_4 0.78539816339744830962 +#define BORDER 5 + +static void M_create(), M_destroy(), M_destroyNull(), M_set(), M_raise(); +static void M_lower(), M_notify(), M_markpos(), M_markposAdd(), M_redraw(); +static void M_addPt(), M_deletePt(), M_movePt(), M_deleteDestroy(); +static void M_move(), M_resize(), M_moveResize(), M_rotate(); +static void M_rotateResize(), M_input(); +static void gm_focusin(), gm_focusout(); + +static XtActionsRec markerActionsList[] = { + { "m_create", M_create }, + { "m_destroy", M_destroy }, + { "m_destroyNull", M_destroyNull }, + { "m_set", M_set }, + { "m_raise", M_raise }, + { "m_lower", M_lower }, + { "m_notify", M_notify }, + { "m_input", M_input }, + { "m_markpos", M_markpos }, + { "m_markposAdd", M_markposAdd }, + { "m_redraw", M_redraw }, + { "m_addPt", M_addPt }, + { "m_deletePt", M_deletePt }, + { "m_movePt", M_movePt }, + { "m_deleteDestroy", M_deleteDestroy }, + { "m_move", M_move }, + { "m_resize", M_resize }, + { "m_moveResize", M_moveResize }, + { "m_rotate", M_rotate }, + { "m_rotateResize", M_rotateResize }, +}; + + +/* GtMarkerInit -- Initialize the marker subsystem. + */ +GtMarkerInit (w) + GtermWidget w; +{ + register Marker gm, prev; + XColor fg_color, bg_color; + Display *display = w->gterm.display; + int type, i; + GC gc; + + for (gm = w->gterm.gm_tail; gm; gm = prev) { + prev = gm->prev; + GmDestroy (gm); + } + + if (!w->gterm.gm_initialized) { + /* Register some additional actions for markers. */ + XtAppAddActions (XtWidgetToApplicationContext((Widget)w), + markerActionsList, XtNumber(markerActionsList)); + + /* Get the gterm widget translations. */ + if ((char *)w->gterm.defTranslations == NULL) { + char *translations = NULL; + XtTranslations tt; + XtResource r; + int ttype, i; + + r.resource_name = XtNtranslations; + r.resource_class = XtCTranslations; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + XtGetApplicationResources ((Widget)w, &translations, &r, 1,NULL,0); + + if (translations) { + if (strncmp (translations, "#augment", 8) == 0) + ttype = T_augment; + else if (strncmp (translations, "#override", 9) == 0) + ttype = T_override; + else + ttype = T_replace; + + if (ttype == T_replace) { + w->gterm.defTranslations = + XtParseTranslationTable (translations); + } else if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = ttype; + w->gterm.nauxTrans++; + } + + } else { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + } + + /* Get the marker translations. */ + if ((char *)w->gterm.gm_defTranslations == NULL) + w->gterm.gm_defTranslations = + XtParseTranslationTable (w->gterm.gm_translations); + } + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, + w->gterm.gm_lineWidth, w->gterm.gm_lineStyle, CapButt, JoinMiter); + w->gterm.gm_drawGC = gc; + + /* Get graphics rubber-band GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetFunction (display, gc, GXxor); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, w->gterm.gm_xorFillColor); + XSetBackground (display, gc, w->gterm.gm_xorFillBgColor); + XSetLineAttributes (display, gc, + 0, LineDoubleDash, CapButt, JoinMiter); + w->gterm.gm_rubberGC = gc; + + fg_color.pixel = w->gterm.gm_cursorFgColor; + bg_color.pixel = w->gterm.gm_cursorBgColor; + XQueryColor (display, w->core.colormap, &fg_color); + XQueryColor (display, w->core.colormap, &bg_color); + + w->gterm.gm_markerCursor = XCreateFontCursor (display, XC_fleur); + XRecolorCursor (display, w->gterm.gm_markerCursor, &fg_color,&bg_color); + w->gterm.gm_edgeCursor = XCreateFontCursor (display, XC_dotbox); + XRecolorCursor (display, w->gterm.gm_edgeCursor, &fg_color,&bg_color); + w->gterm.gm_pointCursor = XCreateFontCursor (display, XC_sizing); + XRecolorCursor (display, w->gterm.gm_pointCursor, &fg_color,&bg_color); + + if (!(type = GmStrToType (w->gterm.gm_defaultMarker))) + type = Gm_Rectangle; + w->gterm.gm_defaultType = type; + + if (!null_region) + null_region = XCreateRegion(); + w->gterm.gm_initialized++; + } + + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.gm_redisplay = False; + w->gterm.preserve_screen = 0; +} + + +/* GtMarkerFree -- Free any marker subsystem resources. + */ +static void +GtMarkerFree (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + register Marker gm; + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) + GmDestroy (gm); + + if (!w->gterm.gm_initialized) + return; + + XFreeGC (display, w->gterm.gm_drawGC); + XFreeGC (display, w->gterm.gm_rubberGC); + + /* This call can fail - see comments elsewhere in this file about + * XFreeCursor. + * + XFreeCursor (display, w->gterm.gm_markerCursor); + XFreeCursor (display, w->gterm.gm_edgeCursor); + XFreeCursor (display, w->gterm.gm_pointCursor); + */ + + w->gterm.gm_initialized = 0; +} + + +/* gm_focusin -- Called when gterm window input is directed to a marker. + */ +static void +gm_focusin (w, gm, what) + register GtermWidget w; + register Marker gm; + GmSelection what; +{ + Cursor cursor; + int erase; + Marker am; + + if (!XtIsRealized ((Widget)w)) + return; + + if (am = w->gterm.gm_active) { + if (am != gm) + gm_focusout (w, 0); + else if (what && what->type == w->gterm.gm_selection.type) { + /* no change */ + return; + } + } + + if (what) { + switch (what->type) { + case Ge_Point: + cursor = w->gterm.gm_pointCursor; + break; + case Ge_Edge: + cursor = w->gterm.gm_edgeCursor; + break; + default: + cursor = w->gterm.gm_markerCursor; + break; + } + } else + cursor = w->gterm.gm_markerCursor; + + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, cursor); + w->gterm.gm_active = gm; + w->gterm.gm_selection = *what; + + if (gm && gm != am) { + gm_request_translations (w, gm); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusIn, NULL, NULL, 0); +} + + +/* gm_focusout -- Called to restore the normal gterm window input when the + * pointer moves off a marker. + */ +static void +gm_focusout (w, enableSetTrans) + register GtermWidget w; + int enableSetTrans; /* replace translations */ +{ + register Display *display = w->gterm.display; + register Marker gm = w->gterm.gm_active; + int erase, i; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Restore the default gterm window translations. */ + if (enableSetTrans) + gm_request_translations (w, NULL); + + XDefineCursor (display, w->gterm.window, w->gterm.cursor); + w->gterm.gm_active = NULL; + + if (gm) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusOut, NULL, NULL, 0); +} + + +/* gm_refocus -- Simulate a pointer event to recompute the marker pointer + * focus. Called when a software event changes the marker stacking order + * in some way. + */ +static void +gm_refocus (w) + GtermWidget w; +{ + XMotionEvent event; + int nparams = 0; + + event.type = MotionNotify; /* MF009 */ + event.x = w->gterm.last_x; + event.y = w->gterm.last_y; + HandleTrackCursor ((Widget)w, &event, NULL, &nparams); +} + + +/* + * Translation tables. The widget's translation table must not be replaced + * while a translation is executing. This can be a problem as it is often + * events and their translations which lead to the translation table getting + * replaced. To avoid this problem we merely queue a timer event to load + * the desired translation table, allowing any existing translation to + * finish executing before the translation table is swapped out. If multiple + * translation table load requests are issued only the final one has any + * effect. + */ + +/* gm_request_translations -- Queue a request to load the translations for the + * specified marker (or NULL to load the default gterm translations). If this + * is the first request and timers are enabled a timer is posted to load the + * translations when any current event processing is complete. If a request + * is already active then the most recent request supercedes any previous one. + */ +static void +gm_request_translations (w, gm) + register GtermWidget w; + Marker gm; +{ + w->gterm.gm_reqTranslations = gm; + + if (!w->gterm.useTimers) + gm_load_translations (w, NULL); + else if (!w->gterm.gm_timer_id) { + w->gterm.gm_timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext((Widget)w), 0, + gm_load_translations, (XtPointer)w); + } +} + + +/* gm_load_translations -- Swap out the widget's translation table. This is + * a no-op if the requested translation table is already loaded. + */ +static void +gm_load_translations (w, id) + register GtermWidget w; + XtIntervalId id; +{ + register Marker am, gm; + register int i; + + w->gterm.gm_timer_id = (XtIntervalId) NULL; + + am = w->gterm.gm_curTranslations; + gm = w->gterm.gm_reqTranslations; + if (am == gm && w->gterm.gm_initialized) + return; + + if (gm) { + /* Set the translations for the indicated marker. */ + if (!am || am->translations != gm->translations) + XtOverrideTranslations ((Widget)w, gm->translations); + } else { + /* Restore the default gterm window translations. */ + XtVaSetValues ((Widget)w, + XtNtranslations, (XtArgVal)w->gterm.defTranslations, NULL); + for (i=0; i < w->gterm.nauxTrans; i++) { + switch (w->gterm.auxTType[i]) { + case T_augment: + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + case T_override: + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + } + } + } + + w->gterm.gm_curTranslations = w->gterm.gm_reqTranslations; +} + + +/* Public marker functions. + * -------------------------- + */ + +/* GmCreate -- Create a new marker. + */ +Marker +GmCreate (w, type, interactive) + GtermWidget w; + int type; /* marker type */ + int interactive; /* use pointer to set position */ +{ + register Marker gm; + + /* Allocate descriptor. */ + if (type < 1 || type > Gm_NTypes) + return (NULL); + if (!(gm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + /* Initialize descriptor. */ + gm->w = w; + gm->type = type; + gm->flags = interactive ? (Gm_Visible|Gm_Sensitive) : 0; + gm->translations = w->gterm.gm_defTranslations; + gm->old_region = XCreateRegion(); + gm->cur_region = XCreateRegion(); + (gm_classinit[type-1]) (gm, interactive); + + /* Link marker to tail of marker list. */ + gm_linkafter (gm, w->gterm.gm_tail); + + /* If marker is being created interactive, set flag to indicate that the + * next create marker event should finish creating this marker. + */ + if (w->gterm.gm_create) + GmDestroy (w->gterm.gm_create); + w->gterm.gm_create = interactive ? gm : NULL; + + return (gm); +} + + +/* GmDestroy -- Destroy a marker. + */ +GmDestroy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + Region old_region, cur_region; + + /* GmDestroy can be called recursively during a destroy operation as a + * side effect of the destroy callback. Set the Gm_BeingDestroyed flag + * to cause these redundant destroy requests to be ignored. + */ + if (gm->flags & Gm_BeingDestroyed) + return (OK); + gm->flags |= Gm_BeingDestroyed; + + /* Release the focus if active marker. This should be done before + * proceeding to destroy the marker, i.e. before calling the destroy + * callbacks. + */ + if (w->gterm.gm_active == gm) { + gm_focusout (w, 1); + w->gterm.gm_active = NULL; + } + + /* Inform any clients that have registered a callback for this marker + * that we are about to destroy the marker. + */ + gm_do_callbacks (gm, GmEvDestroy, NULL, NULL, 0); + + /* Erase the marker from the screen. */ + GmMarkpos (gm); + gm_erase (gm); + + /* Note marker position. */ + old_region = gm->old_region; + cur_region = gm->cur_region; + + /* Free all storage and unlink the marker. */ + if (gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + if (gm->text) + XtFree ((char *)gm->text); + if (gm->pgon) + XtFree ((char *)gm->pgon); + + gm_unlink (gm); + XtFree ((char *)gm); + + /* Redraw any markers that were obscured by the deleted marker. */ + update_transients (w, old_region); + + XDestroyRegion (old_region); + XDestroyRegion (cur_region); + + /* Recompute the marker focus. */ + gm_refocus (w); + + return (OK); +} + + +/* GmCopy -- Copy a marker. + */ +Marker +GmCopy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register Marker nm; + + if (!(nm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + *nm = *gm; + nm->parent = gm; + nm->old_region = NULL; + nm->cur_region = NULL; + nm->points = NULL; + nm->pgon = NULL; + nm->text = NULL; + + /* Copy region descriptors. */ + if ((char *)(nm->old_region = XCreateRegion()) == NULL) + goto fail; + if ((char *)(nm->cur_region = XCreateRegion()) == NULL) + goto fail; + XUnionRegion (nm->old_region, gm->cur_region, nm->cur_region); + + /* Copy any polypoint data. */ + if (gm->pgon) { + nm->pgon = (DPoint *) XtMalloc (gm->npoints * sizeof(DPoint)); + if (nm->pgon == NULL) + goto fail; + memmove (nm->pgon, gm->pgon, gm->npoints * sizeof(DPoint)); + } + + /* Copy region polygon. */ + if (gm->npoints > GM_MAXVERTICES) { + if (!(nm->points = (XPoint *) XtMalloc (gm->npoints * sizeof(XPoint)))) + goto fail; + memmove (nm->points, gm->points, gm->npoints * sizeof(XPoint)); + } + + /* Copy any text data. */ + if (gm->text) { + int nchars = strlen (gm->text); + if (!(nm->text = XtMalloc (nchars + 1))) + goto fail; + memmove (nm->text, gm->text, nchars + 1); + } + + gm_linkafter (nm, w->gterm.gm_tail); + return (nm); + +fail: + if (nm->text) + XtFree (nm->text); + if (nm->pgon) + XtFree ((char *)nm->pgon); + if (nm->points && nm->points != nm->point_data) + XtFree ((char *)nm->points); + if ((char *)nm->cur_region) + XDestroyRegion (nm->cur_region); + if ((char *)nm->old_region) + XDestroyRegion (nm->old_region); + + XtFree ((char *)nm); + return (NULL); +} + + +/* GmAddCallback -- Add a callback to a marker. + */ +GmAddCallback (gm, events, func, client_data) + register Marker gm; + int events; /* events callback is to receive */ + GmIMethod func; /* function to be called */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i; + + /* Find an empty callback slot. */ + for (i=0; i < GM_MAXCALLBACKS; i++) + if (!gm->callback[i].events) + break; + + /* Register the callback. */ + if (i < GM_MAXCALLBACKS) { + cb = &gm->callback[i]; + cb->events = events; + cb->func = func; + cb->client_data = client_data; + gm->ncallbacks = max (gm->ncallbacks, i + 1); + } + + if (events & GmEvConstraint) + gm->constraints++; +} + + +/* GmDeleteCallback -- Delete a previously posted callback given the + * function pointer and client data passed when the callback was registered. + */ +GmDeleteCallback (gm, func, client_data) + register Marker gm; + GmIMethod func; /* callback function */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i, n; + + for (i=n=0; i < GM_MAXCALLBACKS; i++) { + cb = &gm->callback[i]; + + if (cb->func == func && cb->client_data == client_data) { + if (cb->events & GmEvConstraint) + gm->constraints--; + cb->events = (int)NULL; + cb->func = (GmIMethod)NULL; + cb->client_data = (XtPointer)NULL; + } else if (cb->events) + n = i; + } + + gm->ncallbacks = n + 1; +} + + +/* GmSelect -- Scan the marker list to see if the given pointer coordinates + * are within an active marker. If so, the marker descriptor is returned as + * the function value, and the "what" argument is set to indicate what part + * of the marker was selected. + */ +Marker +GmSelect (w, x, y, what) + GtermWidget w; + int x, y; + GmSelection what; +{ + register int flags = (Gm_Activated|Gm_Visible|Gm_Sensitive); + register XRectangle *r; + register Marker gm; + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) { + if (!((gm->flags & (flags|Gm_BeingDestroyed)) == flags)) + continue; + r = &gm->cur_rect; + if (x < (int)r->x || x >= (int)(r->x + r->width) || + y < (int)r->y || y >= (int)(r->y + r->height)) + continue; + if (gm->select (gm, x, y, what)) + return (gm); + } + + return (NULL); +} + + +/* GmMarkpos -- Save the current marker position, e.g., prior to modifying + * the marker. This is used to erase the old marker when the modified + * marker is later redrawn. + */ +GmMarkpos (gm) + register Marker gm; +{ + gm->markpos (gm); +} + + +/* GmRedraw -- Redraw a marker using the given drawing function. If the erase + * flag is not set (as when in rubber-band mode) the marker is merely drawn + * to the screen. Otherwise if the old marker position has been saved the + * old marker is first erased, then any markers affected by the erase are + * redrawn, and finally the current marker is redrawn at the new location. + */ +GmRedraw (gm, func, erase) + Marker gm; + int func; + int erase; +{ + register Marker mm; + register XRectangle *o, *n, *r; + int flags = (Gm_Activated|Gm_Visible); + Region clip_region, temp_region, temp; + GtermWidget w = gm->w; + int outside; + + /* Recompute marker polygon if any attributes have changed. */ + gm->update (gm); + + clip_region = XCreateRegion(); + temp_region = XCreateRegion(); + + /* Erase the previously marked region (old position). */ + if (erase) { + XUnionRegion (gm->old_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + gm_erase (gm); + } + + if (!erase && func == GXxor) + gm->redraw (gm, func); + else { + /* Draw the marker and any markers it intersects, clipping to the + * new marker region. + */ + o = &gm->old_rect; + n = &gm->cur_rect; + + XUnionRegion (gm->cur_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, clip_region); + + for (mm = gm->w->gterm.gm_head; mm; mm = mm->next) { + if (!((mm->flags & flags) == flags)) + continue; + + /* Redraw a marker if it intersects either the old rect or the + * new rect. + */ + if (mm != gm) { + r = &mm->cur_rect; + outside = 0; + if ((int)r->x >= (int)o->x + (int)o->width || + (int)r->x + (int)r->width <= (int)o->x || + (int)r->y >= (int)o->y + (int)o->height || + (int)r->y + (int)r->height <= (int)o->y) + outside++; + if ((int)r->x >= (int)n->x + (int)n->width || + (int)r->x + (int)r->width <= (int)n->x || + (int)r->y >= (int)n->y + (int)n->height || + (int)r->y + (int)r->height <= (int)n->y) + outside++; + if (outside == 2) + continue; + } + mm->redraw (mm, func); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + } + + if (erase) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XDestroyRegion (clip_region); + XDestroyRegion (temp_region); + + if (func != GXxor && gm->width > 0 && gm->height > 0) { + /* Redraw callback. */ + gm_do_callbacks (gm, GmEvRedraw, NULL, NULL, 0); + + /* Generate moveResize callback, if marker was moved or resized. + */ + if (gm->old_rect.x != gm->cur_rect.x || + gm->old_rect.y != gm->cur_rect.y || + gm->old_rect.width != gm->cur_rect.width || + gm->old_rect.height != gm->cur_rect.height) { + + char x[32], y[32]; + char width[32], height[32]; + char *argv[5]; + int argc; + + /* If the marker was just created (old_rect null) or the marker + * moved and we did a full erase and redraw, any old markpos is + * obsolete so we may as well update the saved position. + */ + if (erase || !gm->old_rect.width || !gm->old_rect.height) + GmMarkpos (gm); + + sprintf (x, "%d", gm->x); + sprintf (y, "%d", gm->y); + sprintf (width, "%d", gm->width); + sprintf (height, "%d", gm->height); + argv[0] = x; + argv[1] = y; + argv[2] = width; + argv[3] = height; + argv[4] = NULL; + argc = 4; + + gm_do_callbacks (gm, GmEvMoveResize, NULL, argv, argc); + } + } +} + + +/* GmRedisplay -- Redisplay the markers in the given region, or redisplay + * the entire window if the region is given as (char *)NULL. + */ +GmRedisplay (w, region) + GtermWidget w; + Region region; +{ + register int flags = (Gm_Activated|Gm_Visible); + register XRectangle *r; + register Marker gm; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Set the clip mask to only draw in the affected region. */ + if (region) + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, region); + + /* Draw all markers that intersect the target region. */ + for (gm = w->gterm.gm_head; gm; gm = gm->next) { + if (!((gm->flags & flags) == flags)) + continue; + + if ((char *)region) { + gm->update (gm); + r = &gm->cur_rect; + if (XRectInRegion (region, + r->x, r->y, r->width, r->height) == RectangleOut) + continue; + } + + gm->redraw (gm, GXcopy); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + w->gterm.gm_redisplay = False; +} + + +/* GmRaise -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn above the second. + */ +GmRaise (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already on top? */ + if (gm == w->gterm.gm_tail || ref_gm && ref_gm->next == gm) + return; + + /* Raise it. */ + gm_unlink (gm); + gm_linkafter (gm, ref_gm ? ref_gm : w->gterm.gm_tail); + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmLower -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn below the second. + */ +GmLower (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already lowered? */ + if (gm == w->gterm.gm_head || ref_gm && ref_gm->prev == gm) + return; + + /* Lower it. */ + gm_unlink (gm); + if (ref_gm && ref_gm->prev) + gm_linkafter (gm, ref_gm->prev); + else { + gm->next = w->gterm.gm_head; + w->gterm.gm_head = gm; + if (gm->next) + gm->next->prev = gm; + if (!w->gterm.gm_tail) + w->gterm.gm_tail = gm; + } + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmNotify -- Notify any clients that have registered callbacks that the + * given marker events have occurred. + */ +GmNotify (gm, events, event, params, nparams) + register Marker gm; + int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + gm_do_callbacks (gm, events, event, params, nparams); +} + + +/* GmAddPt -- Add a point to a marker. + */ +GmAddPt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->addPt) { + GmRedraw (gm, GXxor, erase=False); + gm->addPt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + gm_refocus (gm->w); + } +} + + +/* GmDeletePt -- Delete a point from a marker. + */ +GmDeletePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->deletePt) { + GmMarkpos (gm); + gm->deletePt (gm, x, y); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (gm->w); + } +} + + +/* GmMovePt -- Move a point within a marker. + */ +GmMovePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->movePt) { + GmRedraw (gm, GXxor, erase=False); + gm->movePt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmMove -- Move a marker. + */ +GmMove (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->move) { + GmRedraw (gm, GXxor, erase=False); + gm->move (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmResize -- Resize a marker. + */ +GmResize (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->resize) { + GmRedraw (gm, GXxor, erase=False); + gm->resize (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmRotate -- Rotate a marker. + */ +GmRotate (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->rotate) { + GmRedraw (gm, GXxor, erase=False); + gm->rotate (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmSetAttributes -- Set a list of attributes. Requires that all attribute + * values be specified in the same type. Autoredraw, if enabled, is suspended + * until all attributes have been changed. + */ +GmSetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + int autoredraw, erase; + int status = OK; + + if (autoredraw = (gm->flags & Gm_AutoRedraw)) { + gm->flags &= ~Gm_AutoRedraw; + GmMarkpos (gm); + } + + for (i=0; i < nargs; i++) { + status |= GmSetAttribute (gm, args[i].name, args[i].value, argtype); + if (strcmp (args[i].name, GmAutoRedraw) == 0) + autoredraw = gm_getint (args[i].value, argtype); + } + + if (autoredraw) { + gm->flags |= Gm_AutoRedraw; + GmRedraw (gm, GXcopy, erase=True); + } + + return (status ? ERR : OK); +} + + +/* GmSetAttribute -- Set the value of a marker attribute. + */ +GmSetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int marker_type, atType; + int erase, n, i; + + if (gm->flags & Gm_AutoRedraw) + GmMarkpos (gm); + + switch (atType = gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + marker_type = GmStrToType ((char *)value); + break; + case Gt_Int: + marker_type = gm_getint (value, type); + break; + default: + return (ERR); + } + + marker_type = max(1, min(Gm_NTypes, marker_type)); + (gm_classinit[marker_type-1]) (gm, False); + gm->flags |= Gm_Modified; + break; + + case Ga_Activated: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Activated)) { + gm->flags |= Gm_Activated; + GmRedraw (gm, GXcopy, erase=False); + } + } else { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Activated; + } + return (OK); + + case Ga_Visible: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Visible)) { + gm->flags |= Gm_Visible; + GmRedraw (gm, GXcopy, erase=False); + } + } else if (gm->flags & Gm_Visible) { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Visible; + } + return (OK); + + case Ga_Sensitive: + if (gm_getint (value, type)) + gm->flags |= Gm_Sensitive; + else + gm->flags &= ~Gm_Sensitive; + return (OK); + + case Ga_AutoRedraw: + if (gm_getint (value, type)) + gm->flags |= Gm_AutoRedraw; + else + gm->flags &= ~Gm_AutoRedraw; + return (OK); + + case Ga_Translations: + switch (gm_gettype (type)) { + case Gt_String: + gm->translations = XtParseTranslationTable ((char *)value); + break; + default: + return (ERR); + } + return (OK); + + case Ga_X: + gm->x = gm_getint (value, type); + break; + case Ga_Y: + gm->y = gm_getint (value, type); + break; + + case Ga_Width: + case Ga_Height: + /* For a text marker a size can be specified either in integer + * pixels or in characters, e.g., "40ch" or "40 chars". + */ + if (gm->type == Gm_Text && type == XtRString) { + XFontStruct *fp = gm->font; + int char_width, char_height; + int l_pix, r_pix; + char *ip; + + for (n=0, ip=(char *)value; *ip && isdigit(*ip); ip++) + n = n * 10 + (*ip - '0'); + + while (isspace (*ip)) + ip++; + if (ip[0] == 'c' && ip[1] == 'h') { + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + + if (atType == Ga_Width) + n = n * char_width + l_pix + r_pix; + else + n = n * char_height + l_pix * 2; + } + } else + n = gm_getint (value, type); + + if (atType == Ga_Width) + gm->width = n; + else + gm->height = n; + break; + + case Ga_Rotangle: /* MF022 */ + gm->rotangle = gm_getfloat (value, type) * (M_PI / (double) 180.0); + break; + + case Ga_HighlightColor: + gm->highlightColor = gm_getpixel (w, value, type); + break; + case Ga_LineColor: + gm->lineColor = gm_getpixel (w, value, type); + break; + case Ga_LineWidth: + gm->lineWidth = gm_getint (value, type); + break; + case Ga_LineStyle: + gm->lineStyle = gm_getint (value, type); + break; + + case Ga_KnotColor: + gm->knotColor = gm_getpixel (w, value, type); + break; + case Ga_KnotSize: + gm->knotSize = gm_getint (value, type); + break; + + case Ga_Fill: + gm->fill = gm_getint (value, type); + break; + case Ga_FillColor: + gm->fillColor = gm_getpixel (w, value, type); + break; + case Ga_FillBgColor: + gm->fillBgColor = gm_getpixel (w, value, type); + break; + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + gm->fillStyle = gm_getfillstyle (w, value, type); + break; + default: + break; + } + break; + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + gm->fillPattern = (Pixmap) (value); + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + gm->textColor = gm_getpixel (w, value, type); + break; + case Ga_TextBgColor: + gm->textBgColor = gm_getpixel (w, value, type); + break; + case Ga_TextBorder: + gm->textBorder = gm_getint (value, type); + break; + case Ga_ImageText: + gm->imageText = gm_getint (value, type); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + i = gm_getint (value, type); + if (i >= 0 && i < NDialogFonts) + gm->font = w->gterm.dialog_fonts[i]; + break; + case Gt_Pointer: + gm->font = (XFontStruct *) (value); + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + case Gt_String: + if (gm->text) + XtFree (gm->text); + if (!(gm->text = XtMalloc (strlen((char *)value) + 1))) + return (ERR); + strcpy (gm->text, (char *)value); + break; + default: + return (ERR); + } + break; + case Ga_RotIndicator: /* MF020 */ + gm->rotIndicator = gm_getint (value, type); + break; + + default: + return (ERR); + } + + gm->flags |= Gm_Modified; + + if (gm->flags & Gm_AutoRedraw) + GmRedraw (gm, GXcopy, erase=True); + + /* Notify client that a marker attribute has changed. */ + { char *argv[2]; + int argc; + + argv[0] = attribute; + argv[1] = NULL; + argc = 1; + + gm_do_callbacks (gm, GmEvModify, NULL, argv, argc); + } + + return (OK); +} + + +/* GmGetAttributes -- Get a list of attributes. Requires that all attribute + * values be specified in the same type. + */ +GmGetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + + for (i=0; i < nargs; i++) + GmGetAttribute (gm, args[i].name, args[i].value, argtype); +} + + +/* GmGetAttribute -- Get the value of a marker attribute. + */ +GmGetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int i; + + switch (gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->type) { + case Gm_Text: + strcpy ((char *)value, GmText); + break; + case Gm_Line: + strcpy ((char *)value, GmLine); + break; + case Gm_Polyline: + strcpy ((char *)value, GmPolyline); + break; + case Gm_Rectangle: + strcpy ((char *)value, GmRectangle); + break; + case Gm_Box: + strcpy ((char *)value, GmBox); + break; + case Gm_Circle: + strcpy ((char *)value, GmCircle); + break; + case Gm_Ellipse: + strcpy ((char *)value, GmEllipse); + break; + case Gm_Polygon: + strcpy ((char *)value, GmPolygon); + break; + default: + return (ERR); + } + break; + case Gt_Int: + if (gm_putint (gm->type, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_Activated: + if (gm_putint ((gm->flags & Gm_Activated) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Visible: + if (gm_putint ((gm->flags & Gm_Visible) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Sensitive: + if (gm_putint ((gm->flags & Gm_Sensitive) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_AutoRedraw: + if (gm_putint ((gm->flags & Gm_AutoRedraw) != 0, value, type) == ERR) + return (ERR); + break; + + case Ga_X: + if (gm_putint (gm->x, value, type) == ERR) + return (ERR); + break; + case Ga_Y: + if (gm_putint (gm->y, value, type) == ERR) + return (ERR); + break; + case Ga_Width: + if (gm_putint (gm->width, value, type) == ERR) + return (ERR); + break; + case Ga_Height: + if (gm_putint (gm->height, value, type) == ERR) + return (ERR); + break; + case Ga_Rotangle: /* MF022 */ + if (gm_putfloat(((double)180.0/M_PI)*(gm->rotangle),value,type) == ERR) + return (ERR); + break; + + case Ga_HighlightColor: + if (gm_putint ((int)gm->highlightColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineColor: + if (gm_putint ((int)gm->lineColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineWidth: + if (gm_putint (gm->lineWidth, value, type) == ERR) + return (ERR); + break; + case Ga_LineStyle: + if (gm_putint (gm->lineStyle, value, type) == ERR) + return (ERR); + break; + case Ga_KnotColor: + if (gm_putint ((int)gm->knotColor, value, type) == ERR) + return (ERR); + break; + case Ga_KnotSize: + if (gm_putint (gm->knotSize, value, type) == ERR) + return (ERR); + break; + + case Ga_Fill: + if (gm_putint (gm->fill, value, type) == ERR) + return (ERR); + break; + case Ga_FillColor: + if (gm_putint ((int)gm->fillColor, value, type) == ERR) + return (ERR); + break; + case Ga_FillBgColor: + if (gm_putint ((int)gm->fillBgColor, value, type) == ERR) + return (ERR); + break; + + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->fillStyle) { + case FillSolid: + strcpy ((char *)value, "FillSolid"); + break; + case FillTiled: + strcpy ((char *)value, "FillTiled"); + break; + case FillStippled: + strcpy ((char *)value, "FillStippled"); + break; + case FillOpaqueStippled: + strcpy ((char *)value, "FillOpaqueStippled"); + break; + default: + strcpy ((char *)value, "FillSolid"); + break; + } + break; + case Gt_Int: + if (gm_putint (gm->fillStyle, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + *(Pixmap *)value = gm->fillPattern; + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + if (gm_putint ((int)gm->textColor, value, type) == ERR) + return (ERR); + break; + case Ga_TextBorder: + if (gm_putint (gm->textBorder, value, type) == ERR) + return (ERR); + break; + case Ga_ImageText: + if (gm_putint (gm->imageText, value, type) == ERR) + return (ERR); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + for (i=0; i < NDialogFonts; i++) + if (gm->font == w->gterm.dialog_fonts[i]) { + if (gm_putint (i, value, type) == ERR) + return (ERR); + break; + } + break; + case Gt_Pointer: + *(XFontStruct **)value = gm->font; + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + *((char **)value) = gm->text; + break; + case Gt_String: + strcpy ((char *)value, gm->text); + break; + default: + return (ERR); + } + break; + case Ga_RotIndicator: /* MF020 */ + if (gm_putint (gm->rotIndicator, value, type) == ERR) + return (ERR); + break; + + + default: + return (ERR); + } + + return (OK); +} + + +/* GmSetVertices -- Set the vertices of a "poly" type object. + */ +GmSetVertices (gm, points, first, npts) + Marker gm; + DPoint *points; /* input array of points */ + int first; /* first point to be set */ + int npts; /* number of points to set */ +{ + register DPoint *ip, *pp; + register XPoint *op; + register int i; + int erase; + + /* The point vector is automatically extended if more space is needed. + * Small vectors are stored directly in the marker descriptor in the + * point_data array. + */ + if (first + npts != gm->npoints) { /* MF013 */ + if (gm->npoints > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) XtRealloc ((char *)gm->points, + first + npts)) == (XPoint *)NULL) + return; + } else if (first + npts > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) + XtMalloc (first + npts)) == (XPoint *)NULL) + return; + } else if (!gm->points) + gm->points = gm->point_data; + + gm->npoints = first + npts; + } + + /* Copy the point data. */ + ip = points; + op = &gm->points[first]; + for (i=0; i < npts; i++) { + op->x = (int) ip->x + 0.5; + op->y = (int) ip->y + 0.5; + ip++, op++; + } + + /* If we're defining the vertices of a 'poly' marker update the + * pgon[] array with the new set of points. Polygons are initialized + * with a unit rectangle and since vertices can't be set as an attribute + * the must be set with a setVertices call so we need to update the + * structure here. + */ + if (gm->type == Gm_Polygon) { /* MF018 */ + + if (gm->pgon) /* MF018 */ + XtFree ((char *)gm->pgon); + gm->pgon = (DPoint *) XtCalloc (first+npts+1, sizeof(DPoint)); + + /* Copy the point data to the polygon array. */ + op = &gm->points[0]; + pp = &gm->pgon[0]; + for (i=0; i< gm->npoints; i++, pp++, op++) { + pp->x = (double)op->x - gm->x; + pp->y = (double)op->y - gm->y; + } + gm->points[first+npts] = gm->points[0]; /* Close the polygon. */ + + gm->npoints = gm->pgon_npts = first + npts + 1; + gm->rotangle = 0.0; /* reset rotation angle */ + gm->flags |= Gm_Modified; /* marker has been modified */ + } + + /* Redraw the marker if autoredraw is enabled. */ + if (gm->flags & Gm_AutoRedraw) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } +} + + +/* GmGetVertices -- Get the vertices of a "poly" type object. The actual + * number of points output is returned as the function value. + */ +GmGetVertices (gm, points, first, maxpts) + register Marker gm; + register DPoint *points; /* output array of points */ + int first; /* first point to be returned */ + int maxpts; /* max number of points to return */ +{ + register XPoint *ip; + register DPoint *op; + register int i; + int top, nout; + + if (first >= gm->npoints) + return (0); + top = min (first + maxpts, gm->npoints); + nout = top - first; + + /* In the case of a poly object don't return the closing segment. */ + if (gm->type == Gm_Polygon) /* MF027 */ + --nout; + + if (points) { + ip = &gm->points[first]; + op = points; + for (i=0; i < nout; i++) { + op->x = ip->x; + op->y = ip->y; + ip++, op++; + } + } + + return (nout); +} + + +/* GmGetBoundingBox -- Returns a rect large enough to completely enclose a + * marker, regardless of its type or orientation. + */ +GmGetBoundingBox (gm, x, y, width, height) + register Marker gm; + int *x, *y; + int *width, *height; +{ + register XRectangle *r = &gm->cur_rect; + + *x = r->x; + *y = r->y; + *width = r->width; + *height = r->height; +} + + +/* GmStrToType -- Convert a marker type string to a marker type code. + */ +GmStrToType (marker_type) +register char *marker_type; +{ + register int type; + + if (strcmp (marker_type, GmText) == 0) + type = Gm_Text; + else if (strcmp (marker_type, GmLine) == 0) + type = Gm_Line; + else if (strcmp (marker_type, GmPolyline) == 0) + type = Gm_Polyline; + else if (strcmp (marker_type, GmRectangle) == 0) + type = Gm_Rectangle; + else if (strcmp (marker_type, GmBox) == 0) + type = Gm_Box; + else if (strcmp (marker_type, GmCircle) == 0) + type = Gm_Circle; + else if (strcmp (marker_type, GmEllipse) == 0) + type = Gm_Ellipse; + else if (strcmp (marker_type, GmPolygon) == 0) + type = Gm_Polygon; + else + type = 0; + + return (type); +} + + +/* GmStrToEvent -- Convert a marker event type string to a marker event code. + */ +GmStrToEvent (event_type) +register char *event_type; +{ + register int type; + + if (strcmp (event_type, "notify") == 0) + type = GmEvNotify; + else if (strcmp (event_type, "moveResize") == 0) + type = GmEvMoveResize; + else if (strcmp (event_type, "modify") == 0) + type = GmEvModify; + else if (strcmp (event_type, "redraw") == 0) + type = GmEvRedraw; + else if (strcmp (event_type, "destroy") == 0) + type = GmEvDestroy ; + else if (strcmp (event_type, "input") == 0) + type = GmEvInput; + else if (strcmp (event_type, "focusIn") == 0) + type = GmEvFocusIn; + else if (strcmp (event_type, "focusOut") == 0) + type = GmEvFocusOut; + else if (strcmp (event_type, "constraint") == 0) + type = GmEvConstraint; + else + type = 0; + + return (type); +} + + +/* GmStrToFunction -- Convert a drawing function string to the corresponding + * XLIB function code. + */ +GmStrToFunction (function) +register char *function; +{ + register int code; + + if (strcmp (function, "clear") == 0) + code = GXclear; + else if (strcmp (function, "and") == 0) + code = GXand; + else if (strcmp (function, "andReverse") == 0) + code = GXandReverse; + else if (strcmp (function, "copy") == 0) + code = GXcopy; + else if (strcmp (function, "andInverted") == 0) + code = GXandInverted; + else if (strcmp (function, "noop") == 0) + code = GXnoop; + else if (strcmp (function, "xor") == 0) + code = GXxor; + else if (strcmp (function, "or") == 0) + code = GXor; + else if (strcmp (function, "nor") == 0) + code = GXnor; + else if (strcmp (function, "equiv") == 0) + code = GXequiv; + else if (strcmp (function, "invert") == 0) + code = GXinvert; + else if (strcmp (function, "orReverse") == 0) + code = GXorReverse; + else if (strcmp (function, "copyInverted") == 0) + code = GXcopyInverted; + else if (strcmp (function, "orInverted") == 0) + code = GXorInverted; + else if (strcmp (function, "nand") == 0) + code = GXnand; + else if (strcmp (function, "set") == 0) + code = GXset; + else + code = -1; + + return (code); +} + + +/* Internal procedures for above code. + * ------------------------------------ + */ + +static int +gm_getint (value, type) + XtArgVal value; + char *type; +{ + register int ch; + + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + ch = *((char *)value); + if (ch == 'T' || ch == 't') + return (1); + else if (ch == 'F' || ch == 'f') + return (0); + else + return (atoi((char *)value)); + default: + return (0); + } +} + + +static Pixel +gm_getpixel (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + XrmValue from, to; + Pixel pixel; + char *str; + + switch (gm_gettype (type)) { + case Gt_Int: + /* Pixel value (colormap index). */ + return ((Pixel)value); + + case Gt_String: + /* The pixel is expressed either as a pixel number input as a string, + * or as a color name. The latter case requires a type conversion. + */ + str = (char *)value; + if (isdigit(str[0]) && (int)strlen(str) <= 3) { + int index = atoi (str); + pixel = w->gterm.cmap[index]; + return (pixel); + } + + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) { + /* Allocate color from default colormap. + */ + from.size = strlen ((char *)value) + 1; + from.addr = (char *)value; + to.addr = (caddr_t) &pixel; + to.size = sizeof(pixel); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRPixel, &to)) + pixel = w->gterm.cmap[1]; + + } else { + /* Allocate closest match from custom colormap. This is crude, + * but for the standard colors this will return an exact match. + */ + int index, min_dist, dist, i; + XColor exact, best, *cp; + + pixel = w->gterm.cmap[1]; + if (XLookupColor (w->gterm.display, + get_colormap(w), str, &exact, &best)) { + min_dist = 9999; + index = 1; + + for (i=0; i < w->gterm.ncolors; i++) { + cp = &w->gterm.color[i]; + dist = abs((int)exact.red - (int)cp->red) + + abs((int)exact.green - (int)cp->green) + + abs((int)exact.blue - (int)cp->blue); + if (dist == 0) { + index = i; + break; + } else if (dist < min_dist) { + index = i; + min_dist = dist; + } + } + + pixel = w->gterm.color[index].pixel; + } + } + return (pixel); + + default: + return (w->gterm.cmap[1]); + } +} + + +static int +gm_getfillstyle (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_String: + if (strcmp ((char *)value, "FillSolid") == 0) + return (FillSolid); + else if (strcmp ((char *)value, "FillTiled") == 0) + return (FillTiled); + else if (strcmp ((char *)value, "FillStippled") == 0) + return (FillStippled); + else if (strcmp ((char *)value, "FillOpaqueStippled") == 0) + return (FillOpaqueStippled); + break; + default: + break; + } + + return (FillSolid); +} + + +static double +gm_getfloat (value, type) + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + return (atof((char *)value)); + default: + return (0); + } +} + + +static char * +gm_getstring (value, type) + XtArgVal value; + char *type; +{ + if (strcmp (type, XtRString) == 0) + return ((char *)value); + else + return (""); +} + + +static int +gm_putint (ival, value, type) + int ival; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = ival; + break; + case Gt_DFloatP: + *(double *)value = (double) ival; + break; + case Gt_String: + sprintf ((char *)value, "%d", ival); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_putfloat (fval, value, type) + double fval; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = (int) fval; + break; + case Gt_DFloatP: + *(double *)value = fval; + break; + case Gt_String: + sprintf ((char *)value, "%g", fval); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_gettype (type) + char *type; +{ + if (strcmp (type, XtRBool) == 0) + return (Gt_Int); + else if (strcmp (type, XtRInt) == 0) + return (Gt_Int); + else if (strcmp (type, XtRFloat) == 0) + return (Gt_DFloatP); + else if (strcmp (type, XtRPointer) == 0) + return (Gt_Pointer); + else if (strcmp (type, XtRString) == 0) + return (Gt_String); + else + return (ERR); +} + + +static int +gm_getattribute (attribute) + char *attribute; +{ + if (strcmp (attribute, GmType) == 0) + return (Ga_Type); + else if (strcmp (attribute, GmActivated) == 0) + return (Ga_Activated); + else if (strcmp (attribute, GmVisible) == 0) + return (Ga_Visible); + else if (strcmp (attribute, GmSensitive) == 0) + return (Ga_Sensitive); + else if (strcmp (attribute, GmAutoRedraw) == 0) + return (Ga_AutoRedraw); + else if (strcmp (attribute, GmTranslations) == 0) + return (Ga_Translations); + else if (strcmp (attribute, GmX) == 0) + return (Ga_X); + else if (strcmp (attribute, GmY) == 0) + return (Ga_Y); + else if (strcmp (attribute, GmWidth) == 0) + return (Ga_Width); + else if (strcmp (attribute, GmHeight) == 0) + return (Ga_Height); + else if (strcmp (attribute, GmRotangle) == 0) + return (Ga_Rotangle); + else if (strcmp (attribute, GmHighlightColor) == 0) + return (Ga_HighlightColor); + else if (strcmp (attribute, GmLineColor) == 0) + return (Ga_LineColor); + else if (strcmp (attribute, GmLineWidth) == 0) + return (Ga_LineWidth); + else if (strcmp (attribute, GmLineStyle) == 0) + return (Ga_LineStyle); + else if (strcmp (attribute, GmKnotColor) == 0) + return (Ga_KnotColor); + else if (strcmp (attribute, GmKnotSize) == 0) + return (Ga_KnotSize); + else if (strcmp (attribute, GmFill) == 0) + return (Ga_Fill); + else if (strcmp (attribute, GmFillColor) == 0) + return (Ga_FillColor); + else if (strcmp (attribute, GmFillBgColor) == 0) + return (Ga_FillBgColor); + else if (strcmp (attribute, GmFillPattern) == 0) + return (Ga_FillPattern); + else if (strcmp (attribute, GmFillStyle) == 0) + return (Ga_FillStyle); + else if (strcmp (attribute, GmTextColor) == 0) + return (Ga_TextColor); + else if (strcmp (attribute, GmTextBgColor) == 0) + return (Ga_TextBgColor); + else if (strcmp (attribute, GmTextBorder) == 0) + return (Ga_TextBorder); + else if (strcmp (attribute, GmImageText) == 0) + return (Ga_ImageText); + else if (strcmp (attribute, GmFont) == 0) + return (Ga_Font); + else if (strcmp (attribute, GmText) == 0) + return (Ga_Text); + else if (strcmp (attribute, GmRotIndicator) == 0) /* MF020 */ + return (Ga_RotIndicator); + else + return (ERR); +} + +static void +gm_linkafter (gm, prev) + register Marker gm; + register Marker prev; +{ + register GtermWidget w = gm->w; + + gm->prev = prev; + gm->next = prev ? prev->next : NULL; + if (prev) + prev->next = gm; + + if (!w->gterm.gm_tail || prev == w->gterm.gm_tail) + w->gterm.gm_tail = gm; + if (!w->gterm.gm_head) + w->gterm.gm_head = gm; + + w->gterm.preserve_screen++; +} + + +static void +gm_unlink (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + + if (gm->prev) + gm->prev->next = gm->next; + if (gm->next) + gm->next->prev = gm->prev; + if (w->gterm.gm_head == gm) + w->gterm.gm_head = gm->next; + if (w->gterm.gm_tail == gm) + w->gterm.gm_tail = gm->prev; + + gm->prev = gm->next = NULL; + if (!w->gterm.gm_head) + w->gterm.preserve_screen = 0; +} + + +/* gm_do_callbacks -- Call any client callbacks registered for the given + * event type. + */ +static int +gm_do_callbacks (gm, events, event, params, nparams) + Marker gm; + register int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + register int n; + register struct markerCallback *cb; + struct markerCallback callback[GM_MAXCALLBACKS]; + int ncallbacks, status; + + /* Copy the callbacks list into local memory to ensure that it is not + * changed by executing a callback. + */ + ncallbacks = gm->ncallbacks; + memmove ((char *)callback, (char *)gm->callback, + sizeof (struct markerCallback) * GM_MAXCALLBACKS); + + for (n = ncallbacks, cb = callback; --n >= 0; cb++) + if (cb->events & events) { + status = cb->func (cb->client_data, + gm, events, event, params, nparams); + if (status) + return (status); + } + + return (0); +} + + +/* gm_constraint -- Handle the constraint callback. This is a client + * callback called when a marker position or size attribute is changed + * interactively at runtime. The purpose of the callback is to allow the + * client to apply any constraints, e.g. to keep the marker within a + * certain area or range of sizes, to forbid rotation, and so on. + */ +static int +gm_constraint (gm, new_gm, what) + register Marker gm, new_gm; + register int what; +{ + register char *ip, *op; + char argbuf[2048]; + char *argv[30]; + int argc = 0; + + /* Return immediately if there are no constraint callbacks. */ + if (!gm->constraints) + return; + + /* Prepare an argument list listing the marker attributes being changed + * and their old and new values. Each attribute is passed as three + * arg strings: name old-value new-value. Each argument string is + * allocated a fixed amount of space of SZ_NUMBER characters. + */ + op = argbuf; + if (what & Gb_X) { + strcpy (argv[argc++]=op, "x"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->x); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->x); op += SZ_NUMBER; + } + if (what & Gb_Y) { + strcpy (argv[argc++]=op, "y"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->y); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->y); op += SZ_NUMBER; + } + if (what & Gb_Width) { + strcpy (argv[argc++]=op, "width"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->width); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->width); op += SZ_NUMBER; + } + if (what & Gb_Height) { + strcpy (argv[argc++]=op, "height"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->height); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->height); op += SZ_NUMBER; + } + if (what & Gb_Rotangle) { /* MF022 */ + double rot = (gm->rotangle * ((double)180.0 / M_PI)); + double new_rot = (new_gm->rotangle * ((double)180.0 / M_PI)); + strcpy (argv[argc++]=op, "rotangle"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", rot); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", new_rot); op += SZ_NUMBER; + } + + /* Call any constraint callbacks. The argv value strings are modified + * in place. + */ + gm_do_callbacks (gm, GmEvConstraint, NULL, argv, argc); + + /* Copy the possibly edited values back into the new_gm struct. + */ + ip = argbuf + SZ_NUMBER * 2; + if (what & Gb_X) { + new_gm->x = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Y) { + new_gm->y = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Width) { + new_gm->width = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Height) { + new_gm->height = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Rotangle) { + new_gm->rotangle = atof (ip); ip += SZ_NUMBER*3; + + /* Convert back to radians.... */ + new_gm->rotangle *= (M_PI / (double)180.0); /* MF022 */ + } +} + + +static void +gm_erase (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register XRectangle *r = &gm->old_rect; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Any clipping to the marker border is set outside this routine. */ + if ((gm->flags & Gm_Visible) && !NullRect(r)) + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, r->x, r->y, r->width, r->height, r->x, r->y); +} + + +/* Marker actions. + * ------------------------- + */ + + +/* M_create -- Create a marker. + */ +static void +M_create (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int interactive, type; + gmSelection what; + + savepos (w, event); + + /* If the marker has already been created in interactive mode the event + * merely initializes the marker, otherwise we create and initialize a + * new marker. + */ + if (!(gm = w->gterm.gm_create)) { + type = w->gterm.gm_defaultType; + if (*nparams == 1) { + if (!(type = GmStrToType (params[0]))) + type = w->gterm.gm_defaultType; + } + gm = GmCreate (w, type, interactive=True); + } + + gm->x = ev->x; + gm->y = ev->y; + gm->flags |= Gm_Activated; + w->gterm.gm_create = NULL; + + what.type = (gm->type == Gm_Polygon) ? Ge_Marker : Ge_Point; + what.vertex = 0; + gm_focusin (w, gm, &what); +} + + +/* M_destroy -- Destroy a marker. + */ +static void +M_destroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmDestroy (gm); +} + + +/* M_destroyNull -- Destroy a marker if it is null sized. + */ +static void +M_destroyNull (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (gm && gm->width <= 2 && gm->height <= 2) + GmDestroy (gm); +} + + +/* M_set -- Set a marker attribute. + */ +static void +M_set (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0; i < *nparams; i += 2) + GmSetAttribute (gm, + params[i], (XtArgVal)params[i+1], XtRString); /* MF010 */ +} + + +/* M_raise -- Raise a marker to the top of the display list. + */ +static void +M_raise (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmRaise (gm, NULL); +} + + +/* M_lower -- Lower a marker to the bottom of the display list. + */ +static void +M_lower (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmLower (gm, NULL); +} + + +/* M_notify -- Notify any clients that have registered callbacks for the + * specified type of events. + */ +static void +M_notify (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int events, i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0, events=0; i < *nparams; i++) + if (strcmp (params[i], "notify") == 0) + events |= GmEvNotify; + else if (strcmp (params[i], "moveResize") == 0) + events |= GmEvMoveResize; + else if (strcmp (params[i], "modify") == 0) + events |= GmEvModify; + else if (strcmp (params[i], "redraw") == 0) + events |= GmEvRedraw; + else if (strcmp (params[i], "destroy") == 0) + events |= GmEvDestroy; + else if (strcmp (params[i], "input") == 0) + events |= GmEvInput; + else if (strcmp (params[i], "focusIn") == 0) + events |= GmEvFocusIn; + else if (strcmp (params[i], "focusOut") == 0) + events |= GmEvFocusOut; + + GmNotify (gm, events, event, params + 1, *nparams - 1); +} + + +/* M_input -- Notify any clients that have registered a input callback + * that a input event has occurred. + */ +static void +M_input (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register Marker gm; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmNotify (gm, GmEvInput, event, params, *nparams); +} + + +/* M_markpos -- Mark the current position of the marker, e.g., so that it + * can later be erased. + */ +static void +M_markpos (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmMarkpos (gm); +} + + +/* M_markposAdd -- Execute either the markpos or add action, depending upon + * the pointer location. If the pointer is over an active marker at a + * location where the add action can be executed this is done, otherwise the + * markpos action is executed. + */ +static void +M_markposAdd (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Get marker and type of active portion of marker. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Always do a markpos whether we Add or not. */ + GmMarkpos (gm); + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_redraw -- Redraw a marker. + */ +static void +M_redraw (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int erase; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + /* This redraw undoes the final Xor draw. */ + GmRedraw (gm, GXxor, erase=False); + + /* Redraw the full marker. */ + GmRedraw (gm, GXcopy, erase=True); +} + + +/* M_addPt -- Add a point. + */ +static void +M_addPt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_deletePt -- Delete a point. + */ +static void +M_deletePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (what->type == Ge_Point) + GmDeletePt (gm, ev->x, ev->y); +} + + +/* M_movePt -- Move a point. + */ +static void +M_movePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Move a point (vertex) if supported by marker type. */ + if (what->type == Ge_Point && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmMovePt (gm, ev->x, ev->y); +} + + +/* M_deleteDestroy -- Delete a point or destroy a marker, depending upon the + * pointer position. + */ +static void +M_deleteDestroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + switch (what->type) { + case Ge_Point: + GmDeletePt (gm, ev->x, ev->y); + break; + case Ge_Marker: + GmDestroy (gm); + break; + } +} + + +/* M_move -- Move a marker. + */ +static void +M_move (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmMove (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_resize -- Resize a marker. + */ +static void +M_resize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmResize (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_moveResize -- Move a point or marker, or resize a marker, depending + * upon the pointer position. + */ +static void +M_moveResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Marker: + GmMove (gm, ev->x, ev->y); + break; + case Ge_Point: + if (gm->type == Gm_Polygon || gm->type == Gm_Polyline) + GmMovePt (gm, ev->x, ev->y); + else + goto resize; + break; + case Ge_Edge: +resize: GmResize (gm, ev->x, ev->y); + break; + } + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotate -- Rotate a marker. + */ +static void +M_rotate (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmRotate (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotateResize -- Rotate or resize a marker. + */ +static void +M_rotateResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Point: + GmRotate (gm, ev->x, ev->y); + break; + case Ge_Edge: + if (gm->flags & Gm_Smooth) + GmRotate (gm, ev->x, ev->y); + else + GmResize (gm, ev->x, ev->y); + break; + default: + GmResize (gm, ev->x, ev->y); + break; + } + + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* + * Marker class code. + * --------------------- + * Each marker class implements a subset of the following procedures. The + * first set of procedures are required. The second set are optional and + * may be set to NULL in the marker descriptor if not implemented by the + * marker class. + * + * gm_xxxx_init (gm, interactive) + * bool = gm_xxxx_select (gm, x, y, &what) + * gm_xxxx_markpos (gm) + * gm_xxxx_redraw (gm, func) + * gm_xxxx_update (gm) + * + * gm_xxxx_addPt (gm, x, y) + * gm_xxxx_deletePt (gm, x, y) + * gm_xxxx_movePt (gm, x, y) + * gm_xxxx_move (gm, x, y) + * gm_xxxx_resize (gm, x, y) + * gm_xxxx_rotate (gm, x, y) + * + * where xxxx is the 4 character marker class name. + */ + +/* Marker class TEXT. + */ +static int gm_text_select(); +static void gm_text_move(), gm_text_resize(); +static void gm_text_markpos(), gm_text_redraw(); +static void gm_text_update(), gm_text_updatePolygon(); + +static void +gm_text_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Text; + if (!(gm->flags & Gm_Activated)) { + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_TextLineColor; + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->textColor = w->gterm.gm_TextColor; + gm->textBgColor = w->gterm.gm_TextBgColor; + gm->textBorder = w->gterm.gm_TextBorder; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->font = w->gterm.gm_TextFont; + gm->imageText = False; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->npoints = 4 + 1; + gm->points = gm->point_data; + + gm->select = gm_text_select; + gm->markpos = gm_text_markpos; + gm->redraw = gm_text_redraw; + gm->update = gm_text_update; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_text_move; + gm->resize = gm_text_resize; + gm->rotate = NULL; + + if (w->gterm.gm_TextString) { + if (gm->text) + XtFree (gm->text); + gm->text = (char *) XtMalloc (strlen(w->gterm.gm_TextString)+1); + strcpy (gm->text, w->gterm.gm_TextString); + } else + gm->text = NULL; +} + +static int +gm_text_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + + +static void +gm_text_markpos (gm) + register Marker gm; +{ + gm_markpos (gm); +} + + +static void +gm_text_redraw (gm, function) + register Marker gm; + int function; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + int char_width, char_height, xsize, ysize; + int breakline, l_pix, r_pix, maxch, x, y; + XFontStruct *fp = gm->font; + char *ip, *op, *otop; + char *l_ip, *l_op; + char line[1024]; + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + /* In rubber-band mode just draw the outline of the text region. */ + if (function == GXxor) { + int save_lineWidth = gm->lineWidth; + + if (gm->lineWidth <= 0) + gm->lineWidth = 1; + gm_redraw (gm, function); + gm->lineWidth = save_lineWidth; + return; + } + + /* General case. First draw the text box. */ + gm_redraw (gm, function); + + /* Now draw the text. */ + if (!gm->text) + return; + + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + xsize = gm->width; + ysize = gm->height; + + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + if ((maxch = (xsize - l_pix - r_pix) / char_width) < 1) + return; + + x = gm->x + (gm->lineWidth + 1) / 2 + gm->textBorder + 1; + y = gm->y + (gm->lineWidth + 1) / 2 + gm->textBorder + + fp->max_bounds.ascent; + + XSetForeground (w->gterm.display, w->gterm.gm_drawGC, gm->textColor); + XSetBackground (w->gterm.display, w->gterm.gm_drawGC, gm->textBgColor); + XSetFont (w->gterm.display, w->gterm.gm_drawGC, fp->fid); + + /* Fill lines in a multiline text box. + */ + l_ip = l_op = NULL; + otop = line + maxch; + breakline = 0; + + for (ip = gm->text, op=line; *ip || op > line; ) { + if (! *ip) { + breakline++; + } else if (*ip == ' ' || *ip == '\t') { + l_ip = ip; + l_op = op; + *op++ = ' '; + ip++; + } else if (*ip == '\n') { + ip++; + breakline++; + } else + *op++ = *ip++; + + if (breakline || op > otop) { + if (op > otop) { + if (l_ip && l_op) { + ip = l_ip + 1; + *l_op = '\0'; + } else { + while (op > otop) { + if (ip > gm->text && isprint (*(ip-1))) + --ip; + --op; + } + *op = '\0'; + } + } else + *op = '\0'; + + if (gm->imageText) { + while (op < otop) + *op++ = ' '; + *op = '\0'; + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } else { + XDrawString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } + + y += char_height; + if (breakline) + y += gm->textBorder; + if (y + fp->max_bounds.descent > gm->y + ysize) + break; + + op = line; + l_ip = l_op = NULL; + breakline = 0; + } + } +} + + +static void +gm_text_update (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + if (gm->flags & Gm_Modified) { + gm_text_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_text_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = max (0, x - gm->width / 2); + new_gm.y = max (0, y - gm->height / 2); + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); /* corner */ + + gm->x = new_gm.x; + gm->y = new_gm.y; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = abs (x - gm->x); + new_gm.height = abs (y - gm->y); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = new_gm.width; + gm->height = new_gm.height; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_updatePolygon (gm) + register Marker gm; +{ + register XPoint *p = gm->points; + int xsize = gm->width; + int ysize = gm->height; + + p[0].x = gm->x; p[0].y = gm->y; + p[1].x = gm->x; p[1].y = gm->y + ysize; + p[2].x = gm->x + xsize; p[2].y = gm->y + ysize; + p[3].x = gm->x + xsize; p[3].y = gm->y; + p[4].x = gm->x; p[4].y = gm->y; +} + + +/* Marker class LINE. + */ +static void +gm_line_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Line; + /* stub out for now */ +} + + +/* Marker class POLYLINE. + */ +static void +gm_plin_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Polyline; + /* stub out for now */ +} + + +/* Marker class RECTANGLE. + */ +static int gm_rect_select(); +static void gm_rect_move(), gm_rect_resize(), gm_rect_rotate(); +static void gm_rect_update(), gm_rect_updatePolygon(); + +static void +gm_rect_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Rectangle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_rect_select; + gm->markpos = gm_markpos; + gm->update = gm_rect_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_rect_move; + gm->resize = gm_rect_resize; + gm->rotate = gm_rect_rotate; +} + +static void +gm_rect_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_rect_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_rect_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_resize (gm, x, y) + register Marker gm; + int x, y; +{ +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + struct marker new_gm; + int rx, ry; + int ox = x, oy = y; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + if (rx < 0) + new_gm.x = gm->x - (-rx - gm->width) / 2; + else + new_gm.x = gm->x + (rx - gm->width) / 2; + + if (ry < 0) + new_gm.y = gm->y - (-ry - gm->height) / 2; + else + new_gm.y = gm->y + (ry - gm->height) / 2; + + new_gm.width = gm->width + (abs(rx) - gm->width) / 2; + new_gm.height = gm->height + (abs(ry) - gm->height) / 2; + + gm_constraint (gm, &new_gm, Gb_X|Gb_Y|Gb_Width|Gb_Height); + gm->x = new_gm.x; + gm->y = new_gm.y; + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + + /* V1.1 These eqns have the effect of allowing a marker to be grabbed by + * any corner but doing so resets the rotation angle the first time the + * marker is rotated. + + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + */ + + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_rect_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle);*/ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class BOX. A box marker is like a rectangle except that it is + * described and resized by the center and radius (width/height), like + * the other "centered" marker types (circle, ellipse, etc.). + */ +static int gm_boxx_select(); +static void gm_boxx_move(), gm_boxx_resize(), gm_boxx_rotate(); +static void gm_boxx_update(), gm_boxx_updatePolygon(); + +static void +gm_boxx_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Box; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_boxx_select; + gm->markpos = gm_markpos; + gm->update = gm_boxx_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_boxx_move; + gm->resize = gm_boxx_resize; + gm->rotate = gm_boxx_rotate; +} + +static void +gm_boxx_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_boxx_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_boxx_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_resize (gm, x, y) + register Marker gm; + int x, y; +{ +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + /* V1.1 + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + */ + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_boxx_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + double alpha = atan2 ((double)gm->height, (double)gm->width); + +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class CIRCLE. + */ +static int gm_circ_select(); +static void gm_circ_move(), gm_circ_resize(), gm_circ_rotate(); +static void gm_circ_update(), gm_circ_updatePolygon(); + +static void +gm_circ_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Circle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_CircleLineColor; + gm->knotColor = w->gterm.gm_CircleKnotColor; + gm->knotSize = w->gterm.gm_CircleKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + gm->width = gm->height = (gm->width + gm->height) / 2.0; + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE; /* MF015 */ + + gm->select = gm_circ_select; + gm->markpos = gm_markpos; + gm->update = gm_circ_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_circ_move; + gm->resize = gm_circ_resize; + gm->rotate = NULL; +} + +static void +gm_circ_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_circ_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_circ_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = new_gm.height = + sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = gm->height = new_gm.width; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double theta, x, y; + + /*npts = (gm->npoints - 1) / 4;*/ + npts = gm->npoints / 4; /* MF028 */ + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x + gm->x; + p[npts*0+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x + gm->x; + p[npts*1+j].y = y + gm->y; + + y = -y; j = i; + p[npts*2+j].x = x + gm->x; + p[npts*2+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x + gm->x; + p[npts*3+j].y = y + gm->y; + } + + /*p[gm->npoints-1] = p[0];*/ /* MF015 */ +} + + +/* Marker class ELLIPSE. + */ +static int gm_elip_select(); +static void gm_elip_move(), gm_elip_resize(), gm_elip_rotate(); +static void gm_elip_update(), gm_elip_updatePolygon(); + +static void +gm_elip_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Ellipse; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_EllipseLineColor; + gm->knotColor = w->gterm.gm_EllipseKnotColor; + gm->knotSize = w->gterm.gm_EllipseKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; +/* gm->npoints = GM_NPTSCIRCLE + 1;*/ + gm->npoints = GM_NPTSCIRCLE; /* MF015 */ + + gm->select = gm_elip_select; + gm->markpos = gm_markpos; + gm->update = gm_elip_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_elip_move; + gm->resize = gm_elip_resize; + gm->rotate = gm_elip_rotate; +} + +static void +gm_elip_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_elip_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_elip_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; +/* double theta = -(gm->rotangle);*/ + double theta = (gm->rotangle); /* MF019 */ + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos(theta) - y * sin(theta); + ry = x * sin(theta) + y * cos(theta); + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { +/* theta = atan2 ((double)(y - gm->y), (double)(x - gm->x));*/ + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_elip_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double cos_rotangle, sin_rotangle; + double theta, x, y; + + npts = (gm->npoints - 1) / 4 + 1; /* MF017 */ +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*0+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*1+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; j = i; + p[npts*2+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*2+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*3+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + } + + /*p[gm->npoints-1] = p[0];*/ /* MF015 */ +} + + +/* Marker class POLYGON. + */ +static int gm_pgon_select(); +static void gm_pgon_addPt(), gm_pgon_deletePt(), gm_pgon_movePt(); +static void gm_pgon_move(), gm_pgon_resize(), gm_pgon_rotate(); +static void gm_pgon_redraw(), gm_pgon_update(), gm_pgon_updatePolygon(); + +static void +gm_pgon_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + register DPoint *p; + + gm->type = Gm_Polygon; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_PgonLineColor; + gm->knotColor = w->gterm.gm_PgonKnotColor; + gm->knotSize = w->gterm.gm_PgonKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + + gm->npoints = gm->pgon_npts = 4 + 1; + gm->points = gm->point_data; + if (gm->pgon) + XtFree ((char *)gm->pgon); + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + gm->x = w->gterm.last_x; + gm->y = w->gterm.last_y; + + if (p) { + p[0].x = -1; p[0].y = -1; + p[1].x = -1; p[1].y = 1; + p[2].x = 1; p[2].y = 1; + p[3].x = 1; p[3].y = -1; + p[4].x = -1; p[4].y = -1; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + + if (interactive) + gm->flags |= Gm_PgonInit; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + /* The following gets executed when an existing non-polygon marker is + * turned into a polygon marker. + */ + if (gm->pgon && gm->pgon_npts) + gm->npoints = gm->pgon_npts; + else { + gm->npoints = gm->pgon_npts = 4 + 1; + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + + if (p) { + p[0].x = -gm->width; p[0].y = -gm->height; + p[1].x = -gm->width; p[1].y = gm->height; + p[2].x = gm->width; p[2].y = gm->height; + p[3].x = gm->width; p[3].y = -gm->height; + p[4].x = -gm->width; p[4].y = -gm->height; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + } + + gm->select = gm_select; + gm->markpos = gm_markpos; + gm->update = gm_pgon_update; + gm->redraw = gm_pgon_redraw; + gm->addPt = gm_pgon_addPt; + gm->deletePt = gm_pgon_deletePt; + gm->movePt = gm_pgon_movePt; + gm->move = gm_pgon_move; + gm->resize = gm_pgon_resize; + gm->rotate = gm_pgon_rotate; +} + +static void +gm_pgon_redraw (gm, function) + register Marker gm; + int function; +{ + /* The PgonInit flag is set when a polygon marker is interactively created + * to cause any pointer motion event to resize the marker. The first + * pointer up causes a redraw which clears the flag. + */ + if (function != GXxor && gm->width > 1 && gm->height > 1) + gm->flags &= ~Gm_PgonInit; + + gm_redraw (gm, function); +} + +static void +gm_pgon_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_pgon_addPt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + int vertex, nbytes; + double rx, ry; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Add the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + nbytes = (gm->npoints + 1) * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + + gm->pgon = pv; + memmove (&pv[vertex+2], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + pv[vertex+1].x = rx; + pv[vertex+1].y = ry; + gm->npoints++; + + nbytes = gm->npoints * sizeof (XPoint); + if (gm->npoints > GM_MAXVERTICES) { + if (gm->points != gm->point_data) + gm->points = (XPoint *) XtRealloc ((char *)gm->points, nbytes); + else + gm->points = (XPoint *) XtMalloc (nbytes); + } else + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_deletePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + int vertex, nbytes; + + if (gm->npoints <= 2) + return; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Delete the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + pv = gm->pgon; + + memmove (&pv[vertex], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + gm->npoints--; + + nbytes = gm->npoints * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + gm->pgon = pv; + + if (gm->npoints <= GM_MAXVERTICES && gm->points != gm->point_data) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_movePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + double rx, ry; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get vertex. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + + /* Edit point. */ + p->x = rx; + p->y = ry; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + gm->x = new_gm.x; gm->y = new_gm.y; + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_resize (gm, x, y) + Marker gm; + int x, y; +{ + register DPoint *p, *q; + GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double theta, scale, slope, rx, ry, x1, y1, x2, y2, xi; + int vertex, i; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get first vertex of nearest edge. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + q = p + 1; + + /* Rotate reference frame so that intercept is at y=0. */ + if (abs(rx) + abs(ry) < 1.0) + scale = 1.0; + else { + theta = atan2 (ry, rx); + cos_rotangle = cos (-theta); + sin_rotangle = sin (-theta); + + x1 = p->x * cos_rotangle - p->y * sin_rotangle; + y1 = p->x * sin_rotangle + p->y * cos_rotangle; + x2 = q->x * cos_rotangle - q->y * sin_rotangle; + y2 = q->x * sin_rotangle + q->y * cos_rotangle; + + /* Compute scale factor. */ + if (y1 == y2 || x1 == x2) + scale = 1.0; + else { + slope = (y2 - y1) / (x2 - x1); + xi = x1 - y1 / slope; + scale = sqrt (SQR(rx) + SQR(ry)) / xi; + } + } + + /* Rescale the polygon. */ + for (i=0, p=gm->pgon; i < gm->npoints; i++, p++) { + p->x *= scale; + p->y *= scale; + } + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double alpha, beta, rx, ry; + double theta = atan2 ((double)(gm->y - y), (double)(x - gm->x));/* MF019 */ + struct marker new_gm; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + if (x == gm->x && y == gm->y) + return; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + if (abs(rx) + abs(ry) < 1.0) + return; + + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + + p = &gm->pgon[vertex]; + alpha = atan2 (p->y, p->x); /* angle btw origin & selected vertex */ + beta = atan2 (ry, rx); /* angle btw origin & cursor position */ + + new_gm.rotangle = gm_niceAngle (gm->rotangle + (beta - alpha)); + + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_updatePolygon (gm) + Marker gm; +{ + register npts, i; + register DPoint *ip = gm->pgon; + register XPoint *op = gm->points; + double cos_rotangle, sin_rotangle; + int width, height, xp, xn, yp, yn; + + npts = gm->npoints; +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + xp = xn = yp = yn = 0; + + for (i=0; i < npts; i++, ip++, op++) { + /* Compute the rotated point. */ + op->x = ip->x * cos_rotangle - ip->y * sin_rotangle + gm->x + 0.5; + op->y = ip->x * sin_rotangle + ip->y * cos_rotangle + gm->y + 0.5; + + /* Compute a width/height estimate for the polygon. + */ + if (ip->x > xp) + xp = ip->x; + else if (ip->x < xn) + xn = ip->x; + + if (ip->y > yp) + yp = ip->y; + else if (ip->y < yn) + yn = ip->y; + + gm->width = (xp + -xn) / 2; + gm->height = (yp + -yn) / 2; + } + + gm->points[npts-1] = gm->points[0]; + gm->pgon_npts = gm->npoints; +} + + +/* Internal procedures for above code. + * ----------------------------------- + */ + +/* gm_select -- Determine if a point is within or near a marker, and if so, + * determine whether the point selects a vertex, edge, or the entire marker. + */ +static int +gm_select (gm, x, y, what) + Marker gm; + register int x, y; + GmSelection what; +{ + register XPoint *p, *ptop; + GtermWidget w = gm->w; + int v_dist = w->gterm.gm_nearVertex; + int e_dist = w->gterm.gm_nearEdge; + double seglen, d1, d2, s, K, frac; + int ncrossings, x0, y0; + XPoint *q; + int n; + int use_old_method = 0; + + /* Determine if the point is near a vertex. */ + for (p = gm->points, n = gm->npoints - 1; --n >= 0; p++) + if (abs (x - p->x) < v_dist && abs (y - p->y) < v_dist) { + if (what) { + what->type = Ge_Point; + what->vertex = p - gm->points; + } + return (1); + } + + /* Determine if the point is near an edge. The test is based on the + * observation that when a point is near a line segment, the sum of the + * distances from the point to either end-point of the line segment is + * nearly the same as the length of the line segment. + */ + p = gm->points; + + ptop = p + (gm->npoints - 1); /* MF014 */ + x0 = p->x; y0 = p->y; + d1 = sqrt ((double)(SQR(x - x0) + SQR(y - y0))); + + for (p++; p < ptop; p++) { + seglen = sqrt ((double)(SQR(p->x - x0) + SQR(p->y - y0))); + d2 = sqrt ((double)(SQR(x - p->x) + SQR(y - p->y))); + + if (abs(d1 + d2 - seglen) < e_dist) { /* MF028 */ + if (what) { + what->type = Ge_Edge; + what->vertex = (p - 1) - gm->points; + } + return (1); + } + + d1 = d2; + x0 = p->x; y0 = p->y; + } + + /* If the marker is one of the closed polygon types, determine if the + * point is inside the marker. + */ + switch (gm->type) { + case Gm_Line: + case Gm_Polyline: + return (0); + break; + case Gm_Circle: + d1 = sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + if (d1 < gm->width) { + if (what) what->type = Ge_Marker; + return (1); + } else + return (0); + break; + } + + if (use_old_method) { + for (p = gm->points, ncrossings=0; p < ptop; p++) { + /* Scan forward until we find a line segment that crosses Y. + */ + if (p->y > y) { + for (p++; p < ptop && p->y >= y; p++) + ; + --p; + } else if (p->y < y) { + for (p++; p < ptop && p->y <= y; p++) + ; + --p; + } + + /* The line segment p[0]:p[1] crosses the Y plane. If this lies + * entirely to the left of the X plane we can ignore it. If any + * portion of the line segment lies to the right of X we compute + * the point where the line intersects the Y plane. If this point + * is to the right of the X plane we have a crossing. + */ + q = p + 1; + if (q < ptop && p->x > x || q->x > x) { + if (q->y == p->y) + frac = (double) 0.0; + else + frac = (double)(y - p->y) / (double)(q->y - p->y); + if ((frac * (q->x - p->x) + p->x) >= x) + ncrossings++; + } + } + + } else { + float xp[64], yp[64]; + int i; + + for (i=0, p=gm->points, ncrossings=0; p <= ptop; p++, i++) { + xp[i] = (float) p->x; + yp[i] = (float) p->y; + } + ncrossings = point_in_poly (gm->npoints, xp, yp, (float)x, (float)y); + } + + if (ncrossings & 1) { + if (what) + what->type = Ge_Marker; + return (1); + } + + return (0); +} + +point_in_poly (npol, xp, yp, x, y) +int npol; +float *xp, *yp, x, y; +{ + int i, j, c = 0; + + for (i = 0, j = npol-1; i < npol; j = i++) { + if ((((yp[i] <= y) && (y < yp[j])) || + ((yp[j] <= y) && (y < yp[i]))) && + (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])) + + c = !c; + } + return c; +} + + + + +/* gm_markpos -- Mark the current position of a marker. + */ +static void +gm_markpos (gm) + register Marker gm; +{ + gm->old_rect = gm->cur_rect; + XUnionRegion (gm->cur_region, null_region, gm->old_region); +} + + +/* gm_redraw -- Redraw a marker expressed as a list of vertices. + */ +static void +gm_redraw (gm, function) + register Marker gm; + int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + int flags = (Gm_Activated|Gm_Visible); + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!XtIsRealized ((Widget)w)) + return; + if (!((gm->flags & flags) == flags)) + return; + + /* Fill the polygon area if indicated. */ + if (gm->fill && function != GXxor) { + if (gm->fillPattern) { + XSetStipple (display, gc, gm->fillPattern); + XSetForeground (display, gc, gm->fillColor); + XSetBackground (display, gc, gm->fillBgColor); + XSetFillStyle (display, gc, gm->fillStyle); + } else { + XSetForeground (display, gc, gm->fillColor); + XSetFillStyle (display, gc, FillSolid); + } + + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Nonconvex, CoordModeOrigin); + } + + /* Set up the drawing GC. */ + if (function != GXxor) { + XSetFunction (display, gc, function); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, (gm == w->gterm.gm_active) ? + gm->highlightColor : gm->lineColor); + + XSetLineAttributes (display, gc, + gm->lineWidth + + ((gm == w->gterm.gm_active) ? w->gterm.gm_highlightWidth : 0), + gm->lineStyle, + CapButt, + (gm->type == Gm_Polygon || gm->type == Gm_Polyline) ? + JoinBevel : JoinMiter); + } + + /* Draw the marker outline. */ + if (gm->lineWidth > 0) { + if (gm->type == Gm_Circle || + (gm->type == Gm_Ellipse && abs(gm->rotangle) < 0.01)) { + + /* Special case - use X arc drawing primitive. We could use the + * gm->points polygon instead, as this outline polygon is + * maintained for all classes of marker. + */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + } + XDrawArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + + } else { + /* Draw marker expressed as a polygon. */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Convex, CoordModeOrigin); + } + XDrawLines (display, window, gc, + gm->points, gm->npoints, CoordModeOrigin); + } + } + + /* Draw the knots if enabled. */ + if (function != GXxor && gm->knotSize > 0) { + int knotsize = gm->knotSize; + int halfsize = gm->knotSize / 2; + int i; + + XSetForeground (display, gc, gm->knotColor); + for (i=0; i < gm->npoints; i++) { + XFillRectangle (display, window, gc, + gm->points[i].x - halfsize, gm->points[i].y - halfsize, + gm->knotSize, gm->knotSize); + } + } +} + + +/* gm_rotate_indicator -- Draw a line indicating the rotation angle. + */ +static void +gm_rotate_indicator (gm, function) /* MF020 */ +Marker gm; +int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!gm->rotIndicator) + return ; + + if (function == GXxor) { + if (gm->type == Gm_Polygon || + gm->type == Gm_Ellipse || + gm->type == Gm_Box || + gm->type == Gm_Rectangle) { + int x, y, x2, y2; + double ar, cos_rotangle, sin_rotangle; + double alpha = atan2 ((double)gm->height,(double)gm->width); + + cos_rotangle = cos ((double)(-gm->rotangle - alpha)); + sin_rotangle = sin ((double)(-gm->rotangle - alpha)); + ar = (double) gm->height / (double) gm->width; + x = (int) (ar * (gm->width / 2)); + y = (int) (ar * (gm->height / 2)); + x2 = x * cos_rotangle - y * sin_rotangle + gm->x; + y2 = x * sin_rotangle + y * cos_rotangle + gm->y; + + XDrawLine (display, window, gc, gm->x, gm->y, x2, y2); + } + } else { + ; /* no-op at present */ + } +} + + +/* gm_setCurRect -- Compute a bounding rectangle which completely encloses + * a marker (assumes that the marker is expressed as list of points). + */ +static void +gm_setCurRect (gm) +Marker gm; +{ + int border; + + XDestroyRegion (gm->cur_region); + gm->cur_rect = null_rect; + + if (gm->npoints <= 0) + gm->cur_region = XCreateRegion(); + else { + gm->cur_region = XPolygonRegion (gm->points, gm->npoints, EvenOddRule); + border = (max (gm->lineWidth, gm->knotSize) + 1) / 2; + border = max (border, BORDER); + XShrinkRegion (gm->cur_region, -border, -border); + XClipBox (gm->cur_region, &gm->cur_rect); + } +} + + +/* gm_niceAngle -- Round a rotation angle to a "nice" value. + */ +static double +gm_niceAngle (alpha) + double alpha; +{ + double tol = 0.003; + double beta; + + if ( abs (alpha - PI_2*0) < tol) + beta = PI_2*0; + else if (abs (alpha - PI_2*1) < tol) + beta = PI_2*1; + else if (abs (alpha - PI_2*2) < tol) + beta = PI_2*2; + else if (abs (alpha - PI_2*3) < tol) + beta = PI_2*3; + else if (abs (alpha - PI_2*4) < tol) + beta = PI_2*0; + else + beta = alpha; + + return (beta); +} + + +static XImage *cached_ximage = NULL; /* MF004 BEGIN */ + +/* GetCachedXImage -- + */ +static XImage * +GetCachedXImage (w, pixmap, width, height) + GtermWidget w; + Pixmap pixmap; + int width; + int height; +{ + if ((cached_ximage != NULL)) { + if ((pixmap == w->gterm.pixmap) && + (width == w->core.width) && + (height == w->core.height)) { + return (cached_ximage); + } + } + return(NULL); +} + + +/* DestroyCachedXImage -- + */ +static void +DestroyCachedXImage () +{ + if (cached_ximage != NULL) { + XDestroyImage (cached_ximage); + cached_ximage = NULL; + } +} + + +/* NewCachedXImage -- + */ +static void +NewCachedXImage (w, xin, pixmap, width, height) + GtermWidget w; + XImage *xin; + Pixmap pixmap; + int width; + int height; +{ + if ((pixmap == w->gterm.pixmap) && + (width == w->core.width) && + (height == w->core.height)) { + DestroyCachedXImage(); + cached_ximage = xin; + } +} /* MF004 END */ + diff --git a/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c.ORIG b/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c.ORIG new file mode 100644 index 00000000..981f0d61 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.c.ORIG @@ -0,0 +1,11897 @@ +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/XawInit.h> +#include "GtermP.h" + +/* + * Gterm -- Graphics terminal widget. This widget implements only the + * window specific graphics output and graphics window input functions. + * Protocol translation (e.g. Tek emulation) and i/o is done elsewhere; + * see for example gtermio.c. + */ + +#define DefaultAlphaFont 3 +#define DefaultDialogFont 3 +#define DefaultMarkerTextFont 3 +#define ZOOM_TOL 0.0001 + +static Dimension defXDim = DEF_WIDTH; +static Dimension defYDim = DEF_HEIGHT; + +/* Default translations for Gterm window. */ +/* Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) */ + +static char defaultGtermTranslations[] = +"\ + <Btn1Down>: m_create() \n\ + <Btn2Down>: crosshair(on) \n\ + <Btn2Motion>: crosshair(on) \n\ + <Btn2Up>: crosshair(off) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() \n\ +"; + +/* Default translations when pointer is over a marker. */ +static char defaultMarkerTranslations[] = +"\ + !Shift <Btn1Motion>: m_rotateResize() \n\ + <Btn1Motion>: m_moveResize() \n\ + !Shift <Btn1Down>: m_raise() m_markpos() \n\ + <Btn1Down>: m_raise() m_markposAdd() \n\ + <Btn1Up>: m_redraw() m_destroyNull() \n\ + <Btn2Down>: m_lower() \n\ + <Key>BackSpace: m_deleteDestroy() \n\ + <Key>Delete: m_deleteDestroy() \n\ + <KeyPress>: m_input() \n\ + <Motion>: track-cursor() \n\ +"; + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defXDim}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defYDim}, + + {XtNalphaFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont1), XtRString, "nil2"}, + {XtNalphaFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont2), XtRString, "5x8"}, + {XtNalphaFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont3), XtRString, "6x10"}, + {XtNalphaFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont4), XtRString, "7x13"}, + {XtNalphaFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont5), XtRString, "8x13"}, + {XtNalphaFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont6), XtRString, "9x15"}, + {XtNalphaFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont7), XtRString, "9x15"}, + {XtNalphaFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.alphaFont8), XtRString, "9x15"}, + + {XtNdialogFont1, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont1), XtRString, "nil2"}, + {XtNdialogFont2, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont2), XtRString, "5x8"}, + {XtNdialogFont3, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont3), XtRString, "6x13"}, + {XtNdialogFont4, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont4), XtRString, "7x13"}, + {XtNdialogFont5, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont5), XtRString, "8x13"}, + {XtNdialogFont6, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont6), XtRString, "9x15"}, + {XtNdialogFont7, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont7), XtRString, "9x15"}, + {XtNdialogFont8, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.dialogFont8), XtRString, "9x15"}, + + {XtNdialogBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogBgColor), XtRString, "yellow"}, + {XtNdialogFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.dialogFgColor), XtRString, "black"}, + {XtNidleCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorBgColor), XtRString, "white"}, + {XtNidleCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.idleCursorFgColor), XtRString, "black"}, + {XtNbusyCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorBgColor), XtRString, "white"}, + {XtNbusyCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.busyCursorFgColor), XtRString, "black"}, + {XtNginmodeCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorBgColor), XtRString, "black"}, + {XtNginmodeCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.ginmodeCursorFgColor), XtRString, "white"}, + {XtNginmodeBlinkInterval, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.ginmodeBlinkInterval), XtRImmediate, 0}, + {XtNcrosshairCursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.crosshairCursorColor), XtRString, "red"}, + + {XtNidleCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.idleCursor), XtRString, "plus"}, + {XtNbusyCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.busyCursor), XtRString, "watch"}, + {XtNginmodeCursor, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.ginmodeCursor), XtRString, "full_crosshair"}, + {XtNwarpCursor, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.warpCursor), XtRImmediate, + (caddr_t)DEF_WARPCURSOR}, + {XtNraiseWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.raiseWindow), XtRImmediate, + (caddr_t)DEF_RAISEWINDOW}, + {XtNdeiconifyWindow, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.deiconifyWindow), XtRImmediate, + (caddr_t)DEF_DEICONIFYWINDOW}, + {XtNuseTimers, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.useTimers), XtRImmediate, + (caddr_t)DEF_USETIMERS}, + + {XtNcolor0, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color0), XtRString, "black"}, + {XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color1), XtRString, "white"}, + {XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color2), XtRString, "red"}, + {XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color3), XtRString, "green"}, + {XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color4), XtRString, "blue"}, + {XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color5), XtRString, "cyan"}, + {XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color6), XtRString, "yellow"}, + {XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color7), XtRString, "magenta"}, + {XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color8), XtRString, "purple"}, + {XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.color9), XtRString, "darkslategray"}, + + {XtNcopyOnResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.copyOnResize), XtRImmediate, + (caddr_t)DEF_COPYONRESIZE}, + {XtNcmapName, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cmapName), XtRImmediate, + (caddr_t)"default"}, + {XtNcmapInitialize, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInitialize), XtRImmediate, + (caddr_t)FALSE}, + {XtNbasePixel, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.base_pixel), XtRImmediate, + (caddr_t)DEF_BASEPIXEL}, + {XtNcmapUpdate, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapUpdate), XtRImmediate, + (caddr_t)DEF_CMAPUPDATE}, + {XtNcmapShadow, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.cmapShadow), XtRImmediate, + (caddr_t)DEF_CMAPSHADOW}, + {XtNcmapInterpolate, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.cmapInterpolate), XtRImmediate, + (caddr_t)True}, + {XtNcacheRasters, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.cacheRasters), XtRImmediate, + (caddr_t)"whenNeeded"}, + {XtNmaxRasters, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxRasters), XtRImmediate, + (caddr_t)MAX_RASTERS}, + {XtNmaxMappings, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxMappings), XtRImmediate, + (caddr_t)MAX_MAPPINGS}, + {XtNmaxColors, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.maxColors), XtRImmediate, + (caddr_t)DEF_MAXCOLORS}, + + {XtNmarkerTranslations, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_translations), XtRImmediate, + (caddr_t)defaultMarkerTranslations}, + {XtNdefaultMarker, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_defaultMarker), XtRImmediate, + (caddr_t)"rectangle"}, + {XtNnearEdge, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearEdge), XtRImmediate, + (caddr_t)E_DIST}, + {XtNnearVertex, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_nearVertex), XtRImmediate, + (caddr_t)V_DIST}, + + {XtNmarkerLineWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineWidth), XtRImmediate, + (caddr_t)1}, + {XtNmarkerLineStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_lineStyle), XtRImmediate, + (caddr_t)LineSolid}, + {XtNmarkerFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_fill), XtRImmediate, + (caddr_t)False}, + {XtNmarkerFillColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillColor), XtRString, + "SlateGray"}, + {XtNmarkerFillBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_fillBgColor), XtRString, + "black"}, + {XtNmarkerFillStyle, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_fillStyle), XtRImmediate, + (caddr_t)FillSolid}, + {XtNxorFill, XtCBoolean, XtRBoolean, sizeof(Boolean), + XtOffset(GtermWidget,gterm.gm_xorFill), XtRImmediate, + (caddr_t)False}, + {XtNxorFillColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillColor), XtRImmediate, + (caddr_t)2}, + {XtNxorFillBgColor, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_xorFillBgColor), XtRImmediate, + (caddr_t)255}, + {XtNmarkerHighlightWidth, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_highlightWidth), XtRImmediate, + (caddr_t)2}, + {XtNmarkerHighlightColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_highlightColor), XtRString, + "green"}, + {XtNmarkerCursorFgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorFgColor), XtRString, + "yellow"}, + {XtNmarkerCursorBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_cursorBgColor), XtRString, + "black"}, + + {XtNmarkerLineLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineLineColor), XtRString, + "green"}, + {XtNmarkerLineKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_LineKnotColor), XtRString, + "blue"}, + {XtNmarkerLineKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_LineKnotSize), XtRImmediate, + (caddr_t)5}, + + {XtNmarkerTextLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextLineColor), XtRString, + "green"}, + {XtNmarkerTextColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextColor), XtRString, + "yellow"}, + {XtNmarkerTextBgColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_TextBgColor), XtRString, + "SlateGray"}, + {XtNmarkerTextBorder, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_TextBorder), XtRImmediate, + (caddr_t)2}, + {XtNmarkerTextFont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + XtOffset(GtermWidget,gterm.gm_TextFont), XtRString, + "6x13"}, + {XtNmarkerTextString, XtCString, XtRString, sizeof(String), + XtOffset(GtermWidget,gterm.gm_TextString), XtRImmediate, + (caddr_t)NULL}, + + {XtNmarkerRectLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectLineColor), XtRString, + "green"}, + {XtNmarkerRectKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_RectKnotColor), XtRString, + "blue"}, + {XtNmarkerRectKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_RectKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerBoxLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxLineColor), XtRString, + "green"}, + {XtNmarkerBoxKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_BoxKnotColor), XtRString, + "blue"}, + {XtNmarkerBoxKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_BoxKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerCircleLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleLineColor), XtRString, + "green"}, + {XtNmarkerCircleKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_CircleKnotColor), XtRString, + "blue"}, + {XtNmarkerCircleKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_CircleKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerEllipseLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseLineColor), XtRString, + "green"}, + {XtNmarkerEllipseKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_EllipseKnotColor), XtRString, + "blue"}, + {XtNmarkerEllipseKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_EllipseKnotSize), XtRImmediate, + (caddr_t)0}, + {XtNmarkerPgonLineColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonLineColor), XtRString, + "green"}, + {XtNmarkerPgonKnotColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffset(GtermWidget,gterm.gm_PgonKnotColor), XtRString, + "blue"}, + {XtNmarkerPgonKnotSize, XtCInt, XtRInt, sizeof(int), + XtOffset(GtermWidget,gterm.gm_PgonKnotSize), XtRImmediate, + (caddr_t)5}, +}; + +/* extern void HandlePopupMenu(); */ +static Boolean SetValues(); +static void Initialize(), Realize(), Destroy(), Redisplay(), Resize(); +static void HandleIgnore(), HandleGraphicsInput(), HandleDisplayCrosshair(); +static void HandleSoftReset(), HandleGraphicsContext(); +static void HandleEnterWindow(), HandleLeaveWindow(); +static void color_crosshair(), color_ginmodeCursor(); +static void HandleTrackCursor(); +static void savepos(), blink_cursor(); +static void mp_linkafter(), mp_unlink(); + +Marker GmSelect(); +static void M_create(), GtMarkerFree(); +static void gm_focusin(), gm_focusout(), gm_refocus(); +static void gm_request_translations(), gm_load_translations(); +static int gm_curpos(); + +static set_default_color_index(); +static inherit_default_colormap(); +static update_default_colormap(); +static update_transients(), update_cursor(); +static request_colormap_focus(), restore_colormap_focus(); +static refresh_source(), refresh_destination(), get_regions(); +static get_rects(), scale_zoom(), scale_intzoom(), scale_boxcar(); +static lw_convolve(), bx_boxcar(), bx_extract(), bx_interp(); +static mf_getpixel(), mf_getinten(); +static scale_lowpass(), scale_nearest(), scale_bilinear(); +static save_mapping(), load_mapping(), get_pixel_mapping(); +static update_mapping(), free_mapping(), valid_mapping(), rect_intersect(); +static initialize_mapping(), draw_crosshair(), erase_crosshair(); +static DrawContext get_draw_context(); +static invalidate_draw_context(); +static XPoint *mapVector(); +static Colormap get_colormap(); +static Cursor get_cursor(); +static void init_iomap(), invalidate_cmap(); +static Pixel get_pixel(), *get_cmap_in(), *get_cmap_out(); + +extern double atof(); + +static XtActionsRec gtermActionsList[] = { + { "ignore", HandleIgnore }, + { "graphics-input", HandleGraphicsInput }, + { "crosshair", HandleDisplayCrosshair }, + { "track-cursor", HandleTrackCursor }, + { "enter-window", HandleEnterWindow }, + { "leave-window", HandleLeaveWindow }, +/* { "popup-menu", HandlePopupMenu }, */ + { "reset", HandleSoftReset }, + { "m_create", M_create }, +}; + +GtermClassRec gtermClassRec = { + { /* core fields */ + /* superclass */ &widgetClassRec, + /* class_name */ "Gterm", + /* widget_size */ sizeof(GtermRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ gtermActionsList, + /* num_actions */ XtNumber(gtermActionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ (XrmClass)NULL, + /* compress_motion */ True, + /* compress_exposure */ True, + /* compress_enterleave */ True, + /* visible_interest */ False, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultGtermTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass gtermWidgetClass = (WidgetClass) &gtermClassRec; +#define abs(a) (((a)<0)?(-(a)):(a)) +#define max(a,b) ((a)>=(b)?(a):(b)) +#define min(a,b) ((a)<(b)?(a):(b)) +#define ERR (-1) +#define OK 0 +#define SQR(a) ((a)*(a)) + +/* + * Widget class procedures. + * -------------------------- + */ + +/* ARGSUSED */ +static void +Initialize (request, new) + Widget request, new; +{ + register GtermWidget w = (GtermWidget)new; + register GC gc; + + XColor fg_color, bg_color; + XFontStruct **fp; + Font cursor_font; + Display *display; + Screen *screen; + Pixel *pp; + int i; + + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + w->gterm.display = display = XtDisplay (w); + w->gterm.screen = screen = XtScreen (w); + w->gterm.root = RootWindowOfScreen (screen); + XtVaSetValues ((Widget)w, XtNbackground, (XtArgVal)w->gterm.color0, NULL); + + /* Initialize color map. */ + pp = &w->gterm.color0; + for (i=0; i < SZ_STATIC_CMAP; i++) + w->gterm.color[i].pixel = w->gterm.cmap[i] = *pp++; + for ( ; i < MAX_SZCMAP; i++) { + memset ((char *)&w->gterm.color[i], 0, sizeof(XColor)); + w->gterm.color[i].pixel = w->gterm.cmap[i] = i; + } + XQueryColors (display, w->core.colormap, w->gterm.color, SZ_STATIC_CMAP); + w->gterm.ncolors = SZ_STATIC_CMAP; + init_iomap (w); + + w->gterm.useDefaultCM = (strcmp (w->gterm.cmapName, "default") == 0); + w->gterm.haveColormap = w->gterm.useDefaultCM; + w->gterm.cmapLastUpdate = 0; + w->gterm.cmapLastShadow = 0; + w->gterm.in_window = 0; + + /* Get clear pixmap GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color0); + w->gterm.clearGC = gc; + + /* Get expose GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + w->gterm.exposeGC = gc; + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, 1, LineSolid, CapButt, JoinMiter); + w->gterm.drawGC = gc; + + /* Get dialog box GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.dialogBgColor); + XSetForeground (display, gc, w->gterm.dialogFgColor); + /* XSetFunction (display, gc, GXcopyInverted); */ + w->gterm.dialogGC = gc; + + /* Get crosshair cursor GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XSetLineAttributes (display, gc, 0, LineSolid, CapButt, JoinMiter); + w->gterm.cursorGC = gc; + + /* Get special cursors. */ + bg_color.pixel = w->gterm.idleCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.idleCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.idle_cursor = get_cursor (w, w->gterm.idleCursor); + XRecolorCursor (display, w->gterm.idle_cursor, &fg_color, &bg_color); + + bg_color.pixel = w->gterm.busyCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.busyCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.busy_cursor = get_cursor (w, w->gterm.busyCursor); + XRecolorCursor (display, w->gterm.busy_cursor, &fg_color, &bg_color); + + bg_color.pixel = w->gterm.color0; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, w->core.colormap, &fg_color); + cursor_font = XLoadFont (display, "cursor"); + w->gterm.crosshair_cursor = XCreateGlyphCursor (display, + cursor_font, cursor_font, XC_crosshair, XC_crosshair, + &fg_color, &bg_color); + + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + if (strcmp (w->gterm.ginmodeCursor, "full_crosshair") != 0) { + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, w->core.colormap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, w->core.colormap, &fg_color); + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + XRecolorCursor (display, + w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + } else + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, "full_crosshair") == 0); + + /* Make sure we have all the fonts we need. */ + for (fp = &w->gterm.alphaFont1, i=0; i < NAlphaFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.alpha_fonts[i] = *fp; + } + for (fp = &w->gterm.dialogFont1, i=0; i < NDialogFonts; i++, fp++) { + if (*fp == NULL) { + *fp = XQueryFont (display, + XGContextFromGC (DefaultGCOfScreen(screen))); + } + w->gterm.dialog_fonts[i] = *fp; + } + + /* Raster initialization. */ + w->gterm.rasters = NULL; + w->gterm.nrasters = 0; + w->gterm.mappings = NULL; + w->gterm.nmappings = 0; + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + w->gterm.colormaps = NULL; + w->gterm.wa_defined = 0; + memset ((char *)&w->gterm.draw, 0, sizeof (struct drawContext)); + + /* Marker initialization. */ + w->gterm.gm_head = NULL; + w->gterm.gm_tail = NULL; + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.defTranslations = NULL; + w->gterm.nauxTrans = 0; + w->gterm.gm_defTranslations = NULL; + w->gterm.gm_curTranslations = NULL; + w->gterm.gm_reqTranslations = NULL; + w->gterm.gm_timer_id = (XtIntervalId) NULL; + w->gterm.gm_initialized = False; + + /* Set defaults (some of these are clobbered anyway by Realize/Resize). */ + w->gterm.raster = 0; + w->gterm.cur_x = 0; + w->gterm.cur_y = 0; + w->gterm.last_x = 0; + w->gterm.last_y = 0; + w->gterm.cursor_drawn = 0; + w->gterm.cursor_type = GtIdleCursor; + w->gterm.pixmap = (Pixmap)NULL; + w->gterm.d_pixmap = (Pixmap)NULL; + w->gterm.preserve_screen = 0; + w->gterm.preserve_valid = 0; + w->gterm.d_saved = 0; + w->gterm.alpha_font = DefaultAlphaFont; + w->gterm.dialog_font = DefaultDialogFont; + w->gterm.optcols = 80; + w->gterm.optrows = 35; + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + set_default_color_index (w); + + /* Disable input until window is ready. */ + w->gterm.delay = 1; +} + +static void +Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + GtermWidget w = (GtermWidget) gw; + XVisualInfo rvinfo, *vinfo = (XVisualInfo *) NULL; + Visual *ourVisual = (Visual *) NULL; + int i, nvis; + + /* Set default window size. */ + XtMakeResizeRequest (gw, w->core.width, w->core.height, + &w->core.width, &w->core.height); + + /* Should define pseudocolor visual here, if truecolor or directcolor + * default visual. + */ + + /* Create graphics window. We first look for an 8-Bit PseudoColor + * visual to use, otherwise we fail. (MJF 8/22/97) + XtCreateWindow (gw, InputOutput, (Visual *)CopyFromParent, + *valueMask, attrs); + */ + vinfo = XGetVisualInfo (w->gterm.display, 0L, &rvinfo, &nvis); + for (i=0; i < nvis; i++) + if (vinfo[i].depth == 8 && vinfo[i].class == PseudoColor) + ourVisual = vinfo[i].visual; + if (ourVisual) + XtCreateWindow (gw, InputOutput, ourVisual, *valueMask, attrs); + else { + fprintf (stderr, "No 8-bit PseudoColor visual found.\n"); + exit(1); + } + + w->gterm.window = XtWindow (gw); + w->gterm.old_width = w->gterm.xres = w->core.width; + w->gterm.old_height = w->gterm.yres = w->core.height; + + GtRasterInit (w); + GtMarkerInit (w); + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = w->gterm.idle_cursor); + + Resize (gw); +} + +static void +Destroy (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb, *cb_next; + Display *display = w->gterm.display; + + /* Get rid of any raster stuff. */ + GtRasterInit (gw); + XtFree ((char *)w->gterm.rasters); + XtFree ((char *)w->gterm.mappings); + + /* Destroy any markers. */ + GtMarkerFree (w); + + /* Can't use XtDestroyGC here; the source says it is broken and will + * work only for applications that have only 1 display, and we have 2. + * Also the documentation in Asente&Swick documents the calling sequence + * incorrectly. + */ + XFreeGC (display, w->gterm.clearGC); + XFreeGC (display, w->gterm.exposeGC); + XFreeGC (display, w->gterm.drawGC); + XFreeGC (display, w->gterm.dialogGC); + XFreeGC (display, w->gterm.cursorGC); + + /* This one also proves problematic. When there are multiple gterm + * widgets allocating the same cursor, succeeding calls for the same + * cursor return the same cursor ID. When these widgets are later + * destroyed, the first XFreeCursor succeeds but subsequent ones find + * the referenced cursor undefined and the application boms with a + * BadCursor error. This must be some problem with reference counts + * in the X server. Cursors use minor amounts of resources and they + * will probably be freed anyway when the display is closed, so we just + * leave them defined here. + * + XFreeCursor (display, w->gterm.idle_cursor); + XFreeCursor (display, w->gterm.busy_cursor); + XFreeCursor (display, w->gterm.crosshair_cursor); + if (w->gterm.ginmode_cursor != w->gterm.crosshair_cursor) + XFreeCursor (display, w->gterm.ginmode_cursor); + */ + + if (w->gterm.pixmap) + XFreePixmap (w->gterm.display, w->gterm.pixmap); + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + + /* Destroy callback lists. */ + for (cb = w->gterm.resetCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.resizeCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + for (cb = w->gterm.inputCallback; cb; cb = cb_next) { + cb_next = cb->next; + XtFree ((char *)cb); + } + w->gterm.resetCallback = NULL; + w->gterm.resizeCallback = NULL; + w->gterm.inputCallback = NULL; + + XtFree (w->gterm.ginmodeCursor); +} + +static void +Resize (gw) + Widget gw; +{ + GtermWidget w = (GtermWidget) gw; + register GtCallback *cb; + int char_width, char_height, char_base; + int bestfont, fonterr, dx, dy, i; + unsigned int width, height, u_junk; + GtCallback cbl[128]; + XFontStruct *fp; + int ncb, junk; + Pixmap pixmap; + Window root; + + if (!XtIsRealized(gw)) + return; + + /* Create new pixmap. */ + pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width + 1, w->core.height + 1, w->core.depth); + if (pixmap) + XFillRectangle (w->gterm.display, pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + + /* Copy old pixmap into new and free old pixmap. */ + if (w->gterm.pixmap) { + XGetGeometry (w->gterm.display, w->gterm.pixmap, + &root, &junk, &junk, &width, &height, &u_junk, &u_junk); + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.copyOnResize) + XCopyArea (w->gterm.display, w->gterm.pixmap, pixmap, + w->gterm.exposeGC, 0, 0, width-1, height-1, 0, 0); + XFreePixmap (w->gterm.display, w->gterm.pixmap); + } + + /* Install new pixmap. */ + w->gterm.pixmap = pixmap; + w->gterm.preserve_valid = 0; + + /* Redraw window. */ + if (w->gterm.pixmap) { + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, 0, 0, w->core.width, w->core.height, 0, 0); + } + + /* Pick best alpha font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NAlphaFonts; i++) { + fp = w->gterm.alpha_fonts[i]; + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + dx = (((int)w->core.width / char_width) - w->gterm.optcols) * 2; + dy = ((int)w->core.height / char_height) - w->gterm.optrows; + if (abs(dx) + abs(dy) < fonterr) { + bestfont = i; + fonterr = abs(dx) + abs(dy); + } + } + + w->gterm.alpha_font = bestfont; + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + XSetFont (w->gterm.display, w->gterm.drawGC, fp->fid); + + /* Pick best dialog font. */ + bestfont = 0; fonterr = 9999; + for (i=0; i < NDialogFonts; i++) { + fp = w->gterm.dialog_fonts[i]; + char_width = fp->max_bounds.width; + dx = ((int)w->core.width / char_width) - 80; + if (abs(dx) < fonterr) { + bestfont = i; + fonterr = abs(dx); + } + } + + w->gterm.dialog_font = bestfont; + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + char_base = fp->max_bounds.ascent; + + w->gterm.d_xoff = 2; + w->gterm.d_yoff = w->core.height - char_height - 2; + w->gterm.d_height = char_height; + XSetFont (w->gterm.display, w->gterm.dialogGC, fp->fid); + + /* Create dialog save area pixmap. */ + if (w->gterm.d_pixmap) + XFreePixmap (w->gterm.display, w->gterm.d_pixmap); + w->gterm.d_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, char_height, w->core.depth); + w->gterm.d_saved = 0; + + /* Adjust cursor position to allow for change in window size. */ + w->gterm.cur_x = w->gterm.cur_x * (int)w->core.width / w->gterm.old_width; + w->gterm.cur_y = w->gterm.cur_y * (int)w->core.height / w->gterm.old_height; + w->gterm.old_width = w->core.width; + w->gterm.old_height = w->core.height; + if (w->gterm.cursor_type == GtGinmodeCursor) { + XWarpPointer (w->gterm.display, w->gterm.window, w->gterm.window, + 0,0,0,0, w->gterm.cur_x, w->gterm.cur_y); + update_cursor (w); + } + + /* Raster descriptor 0 must track the window size. */ + if (w->gterm.rasters) { + Raster rp = &w->gterm.rasters[0]; + rp->width = w->core.width; + rp->height = w->core.height; + } + + /* Mark gterm widget ready for further client input. */ + w->gterm.delay = 0; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resizeCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w); +} + +/* ARGSUSED */ +static void +Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register GtermWidget w = (GtermWidget) gw; + register XExposeEvent *ev = (XExposeEvent *)event; + int x, y, width, height; + + if (!XtIsRealized (gw)) + return; + + if (event) { + x = ev->x; + y = ev->y; + width = ev->width; + height = ev->height; + } else { + x = 0; + y = 0; + width = w->core.width; + height = w->core.height; + } + + if (w->gterm.pixmap) { + /* Clipping with the region argument does not work properly with + * the OpenLook server for some reason - the clip region is one + * pixel too small on the right and bottom. Until the reason for + * this becomes clear, we use the bounding box provided in the + * Expose event to roughly clip the refresh. + * + XSetClipOrigin (w->gterm.display, w->gterm.exposeGC, 0, 0); + XSetRegion (w->gterm.display, w->gterm.exposeGC, region); + */ + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, x, y, width, height, x, y); + } + + update_transients (w, region); + + /* A dummy expose event is used to ensure that the resize delay is + * cleared, in the event that the resize request is not granted. + */ + if (ev && ev->send_event) + w->gterm.delay = 0; +} + +/* ARGSUSED */ +static Boolean +SetValues (current, request, set) + Widget current, request, set; +{ + GtermWidget old = (GtermWidget) current; + GtermWidget req = (GtermWidget) request; + register GtermWidget w = (GtermWidget) set; + Display *display = w->gterm.display; + Boolean redisplay = False; + register GC gc; + + if (old->gterm.dialogBgColor != req->gterm.dialogBgColor) { + gc = w->gterm.dialogGC; + XSetBackground (display, gc, w->gterm.dialogBgColor); + } + if (old->gterm.dialogFgColor != req->gterm.dialogFgColor) { + gc = w->gterm.dialogGC; + XSetForeground (display, gc, w->gterm.dialogFgColor); + } + + if (old->gterm.ginmodeCursor != req->gterm.ginmodeCursor) { + static char *full_crosshair = "full_crosshair"; + + XtFree (old->gterm.ginmodeCursor); + w->gterm.ginmodeCursor = XtNewString (w->gterm.ginmodeCursor); + + erase_crosshair (w); + w->gterm.full_crosshair = + (strcmp (w->gterm.ginmodeCursor, full_crosshair) == 0); + + if (w->gterm.full_crosshair) { + w->gterm.ginmode_cursor = w->gterm.crosshair_cursor; + color_crosshair (w); + } else { + w->gterm.ginmode_cursor = get_cursor (w, w->gterm.ginmodeCursor); + color_ginmodeCursor (w); + } + + if (w->gterm.cursor_type == GtGinmodeCursor && w->core.visible) + XDefineCursor (display, w->gterm.window, + w->gterm.cursor = w->gterm.ginmode_cursor); + } + + if (old->gterm.crosshairCursorColor != req->gterm.crosshairCursorColor) { + color_crosshair (w); + } + + if (old->gterm.ginmodeCursorBgColor != req->gterm.ginmodeCursorBgColor || + old->gterm.ginmodeCursorFgColor != req->gterm.ginmodeCursorFgColor) { + color_ginmodeCursor (w); + } + + return (XtIsRealized(current) ? redisplay : False); +} + +static void +color_crosshair (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + register GC gc; + + erase_crosshair (w); + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.color0; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.crosshairCursorColor; + XQueryColor (display, defcmap, &fg_color); + + gc = w->gterm.cursorGC; + XSetForeground (display, gc, w->gterm.crosshairCursorColor); + XRecolorCursor (display, w->gterm.crosshair_cursor, &fg_color, &bg_color); + + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; + + update_cursor (w); +} + +static void +color_ginmodeCursor (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + XColor fg_color, bg_color; + Colormap defcmap; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + bg_color.pixel = w->gterm.ginmodeCursorBgColor; + XQueryColor (display, defcmap, &bg_color); + fg_color.pixel = w->gterm.ginmodeCursorFgColor; + XQueryColor (display, defcmap, &fg_color); + + XRecolorCursor (display, w->gterm.ginmode_cursor, &fg_color, &bg_color); + w->gterm.ginmodeColors[0] = bg_color; + w->gterm.ginmodeColors[1] = fg_color; +} + +/* + * Action procedures. + * ----------------------- + */ + +/* ARGSUSED */ +static void HandleIgnore (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* ignore an event */ +} + +/* ARGSUSED */ +static void HandleGraphicsInput (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.inputCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, event); +} + +/* ARGSUSED */ +static void HandleDisplayCrosshair (widget, event, params, nparams) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *nparams; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XButtonEvent *ev = &event->xbutton; + + /* Ignore if cursor is in a marker. */ + if (w->gterm.gm_active) + return; + + if (*nparams && strcmp (params[0], "on") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.crosshair_cursor); + draw_crosshair (w, ev->x, ev->y); + } else if (*nparams && strcmp (params[0], "off") == 0) { + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, w->gterm.cursor); + } +} + +/* ARGSUSED */ +static void HandleTrackCursor (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + XMotionEvent *ev = &event->xmotion; + gmSelection what; + Marker gm; + + savepos (w, (XEvent *)ev); + + if ((gm = GmSelect (w, ev->x, ev->y, &what))) + gm_focusin (w, gm, &what); + else if (w->gterm.gm_active) + gm_focusout (w, 1); + + if (w->gterm.cursor_type == GtGinmodeCursor) + if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, ev->x, ev->y); + + /* Flushing here keeps cursor tracking synchronous and tends + * to aid motion compression, by preventing crosshair draw + * requests from being queued up for transmission to the + * server. + */ + XFlush (w->gterm.display); + + } else { + w->gterm.cur_x = ev->x; + w->gterm.cur_y = ev->y; + } +} + +/* ARGSUSED */ +static void HandleEnterWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XEnterWindowEvent *ev = (XEnterWindowEvent *) event; + + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int update = w->gterm.cmapUpdate; + + /* To avoid excessive server queries the colormap is only updated + * every so often. Updating is disabled if cmapUpdate is set to zero. + if (update && ev->time - w->gterm.cmapLastUpdate > update * 1000) { + */ + if (update) { + inherit_default_colormap (w); + w->gterm.cmapLastUpdate = ev->time; + } + + /* Advise the window manager to load our colormap. */ + request_colormap_focus (w); + } + + w->gterm.in_window++; +} + +/* ARGSUSED */ +static void HandleLeaveWindow (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register XLeaveWindowEvent *ev = (XLeaveWindowEvent *) event; + + if (!w->gterm.useDefaultCM && w->gterm.haveColormap) { + int shadow = w->gterm.cmapShadow; + + /* The shadow option matches unused cells in the default colormap + * with the colors in our custom colormap. + if (shadow && ev->time - w->gterm.cmapLastShadow > shadow * 1000) { + */ + if (shadow) { + update_default_colormap (w); + w->gterm.cmapLastShadow = ev->time; + } + + restore_colormap_focus (w); + } + + w->gterm.in_window = 0; +} + +/* ARGSUSED */ +static void HandleSoftReset (widget, event, params, param_count) + Widget widget; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + register GtermWidget w = (GtermWidget)widget; + register GtCallback *cb; + GtCallback cbl[128]; + int ncb, i; + + GtReset (w); + + /* Call any resize callbacks. Callbacks can delete or add callbacks, + * so make a copy of the callback list first. + */ + for (cb = w->gterm.resetCallback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = *cb; + for (i=0; i < ncb; i++) + (*cbl[i].proc) (cbl[i].client_data, w, NULL); +} + + +/* + * GRAPHICS routines (public functions). + * -------------------------------------- + */ + +GtActivate (w) + GtermWidget w; +{ + w->gterm.interactive = 0; + w->gterm.save_x = w->gterm.save_y = 0; +} + +GtDeactivate (w) + GtermWidget w; +{ + Display *display = w->gterm.display; + Window window = w->gterm.window; + + if (w->gterm.interactive) { + if (w->gterm.save_x > 0 && w->gterm.save_y > 0) { + if (w->gterm.warpCursor) { + /* Workaround X server bug. */ + if (w->gterm.root != w->gterm.save_root) + XWarpPointer (display,None,w->gterm.root, 0,0,0,0, + WidthOfScreen(w->gterm.screen) - 1, + HeightOfScreen(w->gterm.screen) - 1); + + /* Move pointer to saved position. */ + XWarpPointer (display, None, w->gterm.save_root, + 0,0,0,0, w->gterm.save_x, w->gterm.save_y); + } + w->gterm.save_x = 0; + w->gterm.save_y = 0; + } + w->gterm.interactive = 0; + } +} + +GtReady (w) + GtermWidget w; +{ + return (w->gterm.delay == 0); +} + +GtReset (w) + GtermWidget w; +{ + invalidate_draw_context (w); + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapButt, JoinMiter); + + /* Set defaults. */ + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.raster = 0; +} + +GtTimerInhibit (w, state) + GtermWidget w; + Boolean state; +{ + /* This is a kludge to allow a client (xgterm) to disable use of timers + * if they don't work in a given implementation. + */ + w->gterm.useTimers = !state; +} + +GtAugmentTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_augment; + w->gterm.nauxTrans++; + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtOverrideTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_override; + w->gterm.nauxTrans++; + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtFlush (w) + GtermWidget w; +{ + XFlush (w->gterm.display); +} + +GtSetLogRes (w, width, height) + GtermWidget w; + int width, height; +{ + w->gterm.xres = width; + w->gterm.yres = height; +} + +GtGetLogRes (w, width, height) + GtermWidget w; + int *width, *height; +{ + *width = w->gterm.xres; + *height = w->gterm.yres; +} + +GtGetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; /* zero for screen size */ + int *width, *height; +{ + if (raster) { + register Raster rp = &w->gterm.rasters[raster]; + *width = rp->width; + *height = rp->height; + } else { + *width = w->core.width; + *height = w->core.height; + } +} + +GtSetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; + int width, height; +{ + GtCreateRaster (w, raster, GtServer, width, height, RasterDepth); +} + +GtSetRaster (w, raster) + GtermWidget w; + int raster; +{ + if (raster >= 0 && raster < w->gterm.maxRasters) { + w->gterm.raster = raster; + invalidate_draw_context (w); + } +} + +GtGetRaster (w) + GtermWidget w; +{ + return (w->gterm.raster); +} + +/* ARGSUSED */ +GtSetTextRes (w, optrows, optcols) + GtermWidget w; + int optrows, optcols; +{ + w->gterm.optrows = optrows; + w->gterm.optcols = optcols; +} + +/* ARGSUSED */ +GtSetCharSize (w, ival) + GtermWidget w; + int ival; +{ +} + +GtSetDataLevel (w, ival) + GtermWidget w; + int ival; +{ + invalidate_draw_context (w); + + switch (ival) { + case GtSet: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[w->gterm.color_index]); + w->gterm.data_level = ival; + break; + case GtClear: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color0); + w->gterm.data_level = ival; + break; + case GtInvert: + /* This probably won't work correctly but leave it for now... */ + XSetFunction (w->gterm.display, w->gterm.drawGC, GXxor); + w->gterm.data_level = ival; + break; + } +} + + +GtSetLineWidth (w, ival) + GtermWidget w; + int ival; +{ + w->gterm.line_width = ival; + GtSetLineStyle (w, w->gterm.line_style); +} + +#define Dashed "\010\003" +#define Dotted "\002\003" +#define DashDot "\016\003\001\003" +#define Dash3Dot "\024\003\001\003\001\003\001\003" + +GtSetLineStyle (w, ival) + GtermWidget w; + int ival; +{ + int line_width = w->gterm.line_width; + int line_style = LineSolid; + int cap_style = CapButt; + int join_style = JoinMiter; + int dash_offset = 0; + char *dash_list = NULL; + int dash_list_length = 0; + + switch (ival) { + case GtSolid: + w->gterm.line_style = ival; + break; + case GtDashed: + line_style = LineOnOffDash; + dash_list = (char *)Dashed; + dash_list_length = strlen(Dashed); + w->gterm.line_style = ival; + break; + case GtDotted: + line_style = LineOnOffDash; + dash_list = (char *)Dotted; + dash_list_length = strlen(Dotted); + w->gterm.line_style = ival; + break; + case GtDashDot: + line_style = LineOnOffDash; + dash_list = (char *)DashDot; + dash_list_length = strlen(DashDot); + w->gterm.line_style = ival; + break; + case GtDash3Dot: + line_style = LineOnOffDash; + dash_list = (char *)Dash3Dot; + dash_list_length = strlen(Dash3Dot); + w->gterm.line_style = ival; + break; + } + + if (dash_list_length) + XSetDashes (w->gterm.display, w->gterm.drawGC, dash_offset, dash_list, + dash_list_length); + + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, line_width, line_style, cap_style, join_style); + + invalidate_draw_context (w); +} + +GtSetColorIndex (w, ival) + GtermWidget w; + int ival; +{ + register int color = w->gterm.iomap[ival]; + + if (color >= 0 && color < w->gterm.ncolors) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[color]); + w->gterm.color_index = color; + invalidate_draw_context (w); + } +} + +GtSetFillType (w, ival) + GtermWidget w; + int ival; +{ + switch (ival) { + case GtSolid: + case GtOutline: + w->gterm.fill_type = ival; + break; + } +} + +GtClearScreen (w) +GtermWidget w; +{ + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) + XFillRectangle (w->gterm.display, w->gterm.pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + XClearWindow (w->gterm.display, w->gterm.window); + + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color1); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapRound, JoinRound); + + w->gterm.line_width = 1; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.data_level = GtSet; + w->gterm.preserve_valid = 0; + w->gterm.gm_redisplay = 1; + w->gterm.d_saved = 0; + + /* Mark any screen mappings to be unconditionally refreshed. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp->enabled && mp->dst == 0) + mp->refresh++; + + invalidate_draw_context (w); + update_transients (w, NULL); +} + +GtDrawPolyline (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolymarker (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawPoints (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawPoints (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolygon (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + if (w->gterm.fill_type == GtOutline) { + /* Draw outline of region. + */ + int first = 0; + int last = npts - 1; + + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + + if (points[last].x != points[first].x || + points[last].y != points[first].y) { + + if (mx->use_backing_store) + XDrawLine (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + XDrawLine (w->gterm.display, mx->pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + } + } else { + /* Fill the outlined area. + */ + if (mx->use_backing_store) { + XFillPolygon (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + XFillPolygon (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + } + + update_transients (w, (Region)NULL); +} + +GtDrawMarker (w, x, y, xsize, ysize, type) + GtermWidget w; + int x, y; + int xsize, ysize; + int type; +{ +} + +GtBell (w) + GtermWidget w; +{ + XBell (w->gterm.display, 0); +} + + +/* GtSetCursorPos -- Set the cursor position to the given coordinates X,Y. + * Coordinates are specified in the current graphics coordinate system, + * defined by the current raster and logical resolution. + * + * This routine is a little more complex than one might think due to the + * complication of mappings. Screen coordinates are required to set the + * cursor, but the graphics drawing context may be defined relative to + * any raster. In the general case a graphics pipeline defines the series + * of coordinate transformations required to transform from graphics + * coordinates to screen coordinates. Things are further complicated since + * the pipeline or desired position may not map to the screen, or there + * may be multiple mappings to the screen. The first case (no mapping to + * the screen) is dealt with by ignoring the request to warp the cursor. + * The second case (one-to-many mapping) is dealt with by a heuristic: + * the most recent screen coordinates are unmapped back to the raster we + * are "drawing" into, defining a unique path through the mappings which + * we can use to map back to the screen. + * + * The simplest case occurs when we are drawing directly into the screen. + * In this case (raster=0) there may still be a logical to physical + * coordinate transformation, but there are no mappings to complicate things. + */ +GtSetCursorPos (w, x, y) + GtermWidget w; + int x, y; +{ + register MappingContext mx; + register DrawContext dx; + register Mapping mp; + + Window window = w->gterm.window; + int sv_raster = w->gterm.raster; + int sv_xres = w->gterm.xres, sv_yres = w->gterm.yres; + int rasters[256], mappings[256], nmap=0, ntrans=0; + int rx, ry, src, dst, map, i, npts = 1; + int raster = w->gterm.raster; + XPoint pv1[1], pv2[2]; + XPoint *points, pv[1]; + Raster rp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Follow the current cursor position back to the source raster if + * possible. This gives us a default pipeline to follow in the reverse + * direction to map raster coordinates to screen coordinates, and is + * necessary to find the right mappings when multiple mappings are + * defined on a single source. + */ + rx = w->gterm.last_x; + ry = w->gterm.last_y; + src = 0; + do { + src = GtSelectRaster (w, dst=src, GtPixel,rx,ry, GtPixel,&rx,&ry,&map); + if (src != dst) { + rasters[nmap] = src; + mappings[nmap++] = map; + } + } while (src != dst && src != raster); + + /* Ray trace the point through all of the mappings to the screen. + * This isn't fully general, but gives us the capability to follow + * most graphics pipelines to a point on the screen. + */ + do { + GtSetRaster (w, raster); + if (ntrans++) { + /* After the first transformation we have raster coordinates, + * so set the logical resolution to the raster dimensions. + */ + rp = &w->gterm.rasters[raster]; + GtSetLogRes (w, rp->width, rp->height); + } + + dx = get_draw_context (w); + if (!dx->nmappings) + return; + + /* Try to find the next mapping. */ + if (nmap && rasters[nmap-1] == raster) + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->mapping == mappings[nmap-1]) { + mp = mx->mp; + nmap--; + goto havemap; + } + } + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + mp = mx->mp; + if (mp && mp->dst == 0) + break; + } + if (i >= dx->nmappings) { + mx = &dx->mapContext[0]; + mp = mx->mp; + } + +havemap: + rp = &w->gterm.rasters[mp ? mp->dst : raster]; + + /* Compute the coordinates points[0].{x,y} of the point x,y in the + * destination raster. + */ + if (mx->scale) { + /* Scaling is in effect. The following subterfuge is used to + * compute the coordinates of the center of the raster pixel (x,y) + * when the image is zoomed. We want to set the cursor to the + * center of the selected pixel, not the edge. + */ + pv[0].x = x; pv[0].y = y; + mapVector (mx, pv, pv1, npts); + pv[0].x = x + 1; pv[0].y = y + 1; + mapVector (mx, pv, pv2, npts); + + pv[0].x = (pv1[0].x + pv2[0].x) / 2.0; + pv[0].y = (pv1[0].y + pv2[0].y) / 2.0; + points = pv; + + } else { + /* No scaling. */ + pv[0].x = x; pv[0].y = y; + points = pv; + } + + /* Clip to the bounds of the destination raster and generate the + * new x,y. + */ + x = max(0, min(rp->width-1, points[0].x)); + y = max(0, min(rp->height-1, points[0].y)); + + } while (mp && (raster = mp->dst)); + + XWarpPointer (w->gterm.display, window, window, 0,0,0,0, x,y); + + w->gterm.last_x = w->gterm.cur_x = x; + w->gterm.last_y = w->gterm.cur_y = y; + + GtSetRaster (w, sv_raster); + GtSetLogRes (w, sv_xres, sv_yres); +} + + +GtGetCursorPos (w, x, y) + GtermWidget w; + int *x, *y; +{ + *x = w->gterm.last_x; + *y = w->gterm.last_y; +} + +GtSetCursorType (w, type) + GtermWidget w; + int type; +{ + static XtIntervalId id = (XtIntervalId) NULL; + Display *display = w->gterm.display; + Cursor cursor; + int interval; + Widget pw; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.cursor_type == type) + return; + + switch (w->gterm.cursor_type = type) { + case GtNoCursor: + case GtIdleCursor: + erase_crosshair (w); + cursor = w->gterm.idle_cursor; + break; + + case GtGinmodeCursor: + /* Begin graphics cursor mode. + */ + + /* If a screen clear or drawing operation has caused the redisplay + * flag to be set, redisplay any marker overlays. + */ + if (w->gterm.gm_redisplay) { + GmRedisplay (w, (Region)NULL); + w->gterm.gm_redisplay = False; + } + + /* Make sure the window is visible. + */ + if (w->gterm.raiseWindow || w->gterm.deiconifyWindow) + for (pw = (Widget)w; pw; pw = XtParent(pw)) + if (XtIsShell(pw)) { + if (w->gterm.deiconifyWindow) + XMapWindow (display, XtWindow(pw)); + if (w->gterm.raiseWindow) + XRaiseWindow (display, XtWindow(pw)); + } + + /* The first time this is done after a GtActivate causes the cursor + * to be warped into the graphics window. The interactive flag is set + * to cause GtDeactivate to restore the cursor to its original position + * after the graphics interaction finishes. + */ + if (w->gterm.warpCursor) { + int root_x, root_y, win_x, win_y; + int xoff, yoff, width, height, x, y; + Window gtermwin, root, child; + unsigned int keys; + int in_window = 0; + + width = w->core.width; + height = w->core.height; + gtermwin = w->gterm.window; + XTranslateCoordinates (display, gtermwin, w->gterm.root, + w->core.x, w->core.y, &xoff, &yoff, &child); + + if (XQueryPointer (display, w->gterm.root, &root, &child, + &root_x, &root_y, &win_x, &win_y, &keys)) { + + /* Already in gterm window? */ + if ((root_x >= xoff && root_x < xoff+width) && + (root_y >= yoff && root_y < yoff+height)) { + + if (!w->gterm.interactive) { + w->gterm.save_x = 0; + w->gterm.save_y = 0; + w->gterm.interactive++; + } + x = root_x - xoff; y = root_y - yoff; + in_window++; + + } else { + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + } else { + /* Pointer not on the current screen. + */ + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + + if ((x < 5 || x > width-5) || (y < 5 || y > height-5)) { + x = width / 2; + y = height / 2; + } + + if (!in_window) { + erase_crosshair (w); + if (w->gterm.warpCursor) { + XWindowAttributes wa; + if (XGetWindowAttributes (display, gtermwin, &wa) && + wa.map_state == IsViewable) { + + /* The following should not be necessary but is needed + * to workaround an X server bug. When warping to a + * different screen the pointer is not erased on the + * old screen. It is hard to erase it, but we can + * at least move it to the corner of the screen. + */ + if (root != w->gterm.root) { + Screen *screen = w->gterm.screen; + if (XGetWindowAttributes (display, root, &wa)) + screen = wa.screen; + XWarpPointer (display,None,root, 0,0,0,0, + WidthOfScreen(screen) - 1, + HeightOfScreen(screen) - 1); + } + + /* Now warp into the gterm window. */ + XWarpPointer (display, None, gtermwin, 0,0,0,0, x,y); + } + if (w->gterm.full_crosshair) + draw_crosshair (w, x, y); + } + + } else if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, x, y); + } + } else + update_cursor (w); + + cursor = w->gterm.ginmode_cursor; + if (interval = w->gterm.ginmodeBlinkInterval) { + XtAppContext appcon = XtWidgetToApplicationContext ((Widget) w); + id = XtAppAddTimeOut (appcon, + interval, blink_cursor, (XtPointer)w); + } else + id = (XtIntervalId) NULL; + break; + + case GtBusyCursor: + /* Exit graphics cursor mode. + */ + erase_crosshair (w); + cursor = w->gterm.busy_cursor; + break; + } + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = cursor); + if (id && w->gterm.cursor_type != GtGinmodeCursor) { + XtRemoveTimeOut (id); + id = (XtIntervalId) NULL; + } +} + +static void +blink_cursor (w, id) + GtermWidget w; + XtIntervalId *id; +{ + XtAppContext app_context; + XColor bg, fg; + int interval; + + bg = w->gterm.ginmodeColors[1]; + fg = w->gterm.ginmodeColors[0]; + + app_context = XtWidgetToApplicationContext ((Widget) w); + XRecolorCursor (w->gterm.display, w->gterm.ginmode_cursor, &fg, &bg); + XFlush (w->gterm.display); + + w->gterm.ginmodeColors[0] = bg; + w->gterm.ginmodeColors[1] = fg; + + if (interval = w->gterm.ginmodeBlinkInterval) + XtAppAddTimeOut (app_context, + interval, (XtTimerCallbackProc) blink_cursor, (XtPointer)w); +} + +GtPostInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.inputCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.inputCallback = new; +} + +GtDeleteInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.inputCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.inputCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resetCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resetCallback = new; +} + +GtDeleteResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resetCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resetCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resizeCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resizeCallback = new; +} + +GtDeleteResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resizeCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resizeCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtDrawAlphaText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + XPoint *points, pv[1], o_pv[1]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int npts, i; + + pv[0].x = x; + pv[0].y = y; + npts = 1; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + x = points[0].x; y = points[0].y; + + if (mx->use_backing_store) + XDrawString (w->gterm.display, w->gterm.pixmap, + mx->drawGC, x, y, text, strlen(text)); + XDrawString (w->gterm.display, mx->pixmap, + mx->drawGC, x, y, text, strlen(text)); + } + + update_transients (w, (Region)NULL); +} + +GtGetAlphaTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + +GtWriteAlphaCursor (w, x, y) + GtermWidget w; + int x, y; +{ +} + +GtEraseAlphaCursor (w) + GtermWidget w; +{ +} + +GtStartDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap) + if (w->gterm.d_saved) { + GtEraseDialog (w); + } else { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.pixmap ? w->gterm.pixmap : w->gterm.window, + w->gterm.d_pixmap, w->gterm.exposeGC, + 0, w->gterm.d_yoff, w->core.width, w->gterm.d_height, 0, 0); + w->gterm.d_saved = 1; + } +} + +GtEndDialog (w) + GtermWidget w; +{ + GtEraseDialog (w); + w->gterm.d_saved = 0; +} + +GtEraseDialog (w) + GtermWidget w; +{ + if (w->gterm.d_pixmap && w->gterm.d_saved) { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.window, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + if (w->gterm.pixmap) + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.pixmap, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + update_transients (w, (Region)NULL); + } +} + +GtDrawDialogText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + int xpos = w->gterm.d_xoff + x; + int ypos = w->gterm.d_yoff + y; + + if (w->gterm.pixmap) + XDrawImageString (w->gterm.display, w->gterm.pixmap, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); +} + +GtGetDialogTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + + +/* + * Internal functions for above code. + * ---------------------------------------- + */ + +static +set_default_color_index (w) + GtermWidget w; +{ + /* The default color index is 1, corresponding to the foreground + * drawing color color1. Index zero is the background drawing color + * color0. The remaining NColors color table entries are the optional + * drawing colors corresponding to resources "color2" through "colorN". + * These are used only if explicitly selected by the client application. + */ + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.cmap[1]); + w->gterm.color_index = 1; + invalidate_draw_context (w); +} + + +static +draw_crosshair (w, x, y) + GtermWidget w; + int x, y; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) { + /* The preserve_screen flag is set if we need to preserve the + * exact display window contents, rather than merely refresh from + * the backing store pixmap. + */ + if (w->gterm.preserve_screen) { + if (!w->gterm.preserve_valid || y != w->gterm.cur_y) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, w->core.height); + if (!w->gterm.preserve_valid || x != w->gterm.cur_x) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + x, 0, 1, w->core.height, w->core.width, 0); + w->gterm.preserve_valid = 1; + } + + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + 0, y, w->core.width, y); + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + x, 0, x, w->core.height); + + XFlush (w->gterm.display); + w->gterm.cursor_drawn++; + } + + w->gterm.cur_x = x; + w->gterm.cur_y = y; +} + + +static +erase_crosshair (w) + GtermWidget w; +{ + if (!XtIsRealized ((Widget)w)) + return; + + if (w->gterm.cursor_drawn) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.pixmap) { + if (w->gterm.preserve_screen && w->gterm.preserve_valid) { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, w->core.height, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + w->core.width, 0, 1, w->core.height, x, 0); + } else { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + x, 0, 1, w->core.height, x, 0); + } + } + + w->gterm.cursor_drawn = 0; + w->gterm.preserve_valid = 0; + } +} + + +static +update_transients (w, region) + GtermWidget w; + Region region; +{ + /* If an explicit region is given redisplay any markers in it immediately, + * otherwise set the redisplay flag to cause a full screen redisplay when + * drawing finishes and the widget is ready for input. + */ + if ((char *)region) + GmRedisplay (w, region); + else + w->gterm.gm_redisplay = True; + + /* Update the crosshair cursor if GIN mode is in effect. */ + update_cursor (w); +} + + +static +update_cursor (w) + GtermWidget w; +{ + if (w->gterm.cursor_type == GtGinmodeCursor && w->gterm.full_crosshair) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + if (x || y) + draw_crosshair (w, x, y); + } +} + +static Cursor +get_cursor (w, cursor_name) + GtermWidget w; + String cursor_name; +{ + XrmValue from, to; + Cursor cursor; + + from.size = strlen (cursor_name) + 1; + from.addr = cursor_name; + + to.addr = (caddr_t) &cursor; + to.size = sizeof(cursor); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRCursor, &to)) + cursor = XCreateFontCursor (w->gterm.display, XC_crosshair); + + return (cursor); +} + + +static DrawContext +get_draw_context (w) + GtermWidget w; +{ + DrawContext dx = &w->gterm.draw; + + if (!dx->valid) { + int raster = w->gterm.raster; + Raster rp = &w->gterm.rasters[raster]; + register MappingContext mx = &dx->mapContext[0]; + Region clip_region, mask_region; + struct mapping *map, *mp, *np, p_mp; + int xres = w->gterm.xres; + int yres = w->gterm.yres; + float xscale, yscale; + XRectangle r; + int i, j; + + dx->raster = w->gterm.raster; + dx->rp = rp; + + if (raster == 0) { + dx->nmappings = 1; + mx->mapping = 0; + mx->mp = NULL; + mx->use_backing_store = (w->gterm.pixmap != (Pixmap)NULL); + mx->pixmap = w->gterm.window; + mx->drawGC = w->gterm.drawGC; + mx->GC_private = 0; + + mx->xoffset = mx->yoffset = 0; +/* (7/16/97) MJF - we don't scale raster 0 since it's already in screen coords. + if (xres == rp->width && yres == rp->height) + mx->scale = 0; + else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } +*/ + mx->scale = 0; + + } else { + dx->nmappings = 0; + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (!mp->enabled || mp->src != raster || + w->gterm.rasters[mp->dst].type != GtServer) + continue; + if (!valid_mapping (w, mp)) + continue; + + mx->mp = mp; + mx->mapping = mp->mapping; + mx->pixmap = w->gterm.rasters[mp->dst].r.pixmap; + mx->use_backing_store = (mp->dst == 0 && + w->gterm.pixmap && !(mp->rop & R_Transient)); + + /* Determine if any scaling is necessary. */ + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + /* Compute logical-to-raster scaling. */ + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) { + mx->xscale = mx->yscale = 1.0; + mx->scale = 0; + } else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + /* Compute overall scale factors by combining logical-to- + * raster and raster-to-screen mappings. + */ + if (map->snx != map->dnx || map->sny != map->dny || + map->sx != map->dx || map->sy != map->dy) { + + xscale = (float)map->dnx / (float)map->snx; + mx->xscale *= xscale; + if (xscale < 0) + mx->xoffset = map->dx + abs(map->dnx) - 1; + else + mx->xoffset = map->dx; + mx->xoffset -= (map->sx * xscale); + + yscale = (float)map->dny / (float)map->sny; + mx->yscale *= yscale; + if (yscale < 0) + mx->yoffset = map->dy + abs(map->dny) - 1; + else + mx->yoffset = map->dy; + mx->yoffset -= (map->sy * yscale); + + mx->scale = 1; + } + + /* Compute the clip mask which will clip graphics to the + * destination rect of the mapping, minus any regions of + * this rect covered by other mappings. + */ + clip_region = XCreateRegion(); + r.x = map->dx; r.y = map->dy; + r.width = abs(map->dnx); + r.height = abs(map->dny); + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != mp->dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + mask_region = XCreateRegion(); + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + XUnionRectWithRegion (&r, mask_region, mask_region); + + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + } + + /* Create a drawing GC which is a copy of the global drawGC + * but using the clip mask computed above. + */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.root, + 0, NULL); + XCopyGC (w->gterm.display, w->gterm.drawGC, ~0, mx->drawGC); + XSetRegion (w->gterm.display, mx->drawGC, clip_region); + XDestroyRegion (clip_region); + mx->GC_private = 1; + + if (++dx->nmappings >= MAX_DRAW) + break; + else + mx++; + } + } + + dx->valid = 1; + } + + return (dx); +} + + +static +invalidate_draw_context (w) + GtermWidget w; +{ + register DrawContext dx = &w->gterm.draw; + register MappingContext mx; + register int i; + + if (dx->valid) { + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->GC_private) + XFreeGC (w->gterm.display, mx->drawGC); + } + dx->valid = 0; + } +} + +static XPoint * +mapVector (mx, pv1, pv2, npts) + register MappingContext mx; + XPoint *pv1; + XPoint *pv2; + int npts; +{ + register XPoint *ip = pv1; + register XPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x * mx->xscale + mx->xoffset; + op->y = ip->y * mx->yscale + mx->yoffset; + } + + return (pv2); +} + + +static void +savepos (w, event) + GtermWidget w; + XEvent *event; +{ + if (event == NULL) + return; + + switch (event->type) { + case KeyPress: + case KeyRelease: + w->gterm.last_x = event->xkey.x; + w->gterm.last_y = event->xkey.y; + break; + case ButtonPress: + case ButtonRelease: + w->gterm.last_x = event->xbutton.x; + w->gterm.last_y = event->xbutton.y; + break; + case MotionNotify: + w->gterm.last_x = event->xmotion.x; + w->gterm.last_y = event->xmotion.y; + break; + } +} + + +/* + * IMAGING routines. + * ----------------------- + * Our strategy here is to support a range of visuals with pseudocolor being + * preferred if available. All imaging is done internally using 8 bit images + * and a max 256 element colormap. If the display hardware has a depth less + * than 8 bits, e.g. for a monochrome display, the image is reduced to the + * screen depth by some technique before being output to the display. + * + * Images (rasters) are implemented internally in Gterm using either ximages or + * off screen pixmaps. Which format is used is decided at raster create time + * and is controlled by a Gterm resource. This is transparent to the client + * application. Currently only 8 bit rasters are supported. + * + * GtRasterInit (gt) + * GtAssignRaster (gt, raster, drawable) + * GtCreateRaster (gt, raster, type, width, height, depth) + * GtDestroyRaster (gt, raster) + * exists = GtQueryRaster (gt, raster, &type, &width, &height, &depth) + * raster = GtNextRaster (gt) + * GtSetRaster (gt, raster) + * raster = GtGetRaster (gt) + * n = GtNRasters (gt) + * + * GtWritePixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtReadPixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtSetPixels (gt, raster, ct, x1, y1, nx, ny, color, rop) + * GtRefreshPixels (gt, raster, ct, x1, y1, nx, ny) + * pixmap = GtExtractPixmap (gt, src, ct, x, y, width, height) + * GtInsertPixmap (gt, pixmap, dst, ct, x, y, width, height) + * + * colormap = GtNextColormap (gt) + * GtFreeColormap (gt, colormap) + * GtWriteColormap (gt, colormap, first, nelem, r, g, b) + * GtReadColormap (gt, colormap, first, nelem, r, g, b) + * GtLoadColormap (gt, colormap, offset, scale) + * exists = GtQueryColormap (gt, colormap, &first, &nelem, &maxelem) + * GtWriteIomap (gt, iomap, first, nelem) + * GtReadIomap (gt, iomap, first, nelem) + * pixel = GtGetClientPixel (gt, gterm_pixel) + * + * GtInitMappings (gt) + * mapping = GtNextMapping (gt) + * GtFreeMapping (gt, mapping) + * GtRaiseMapping (gt, mapping, ref|NULL) + * GtLowerMapping (gt, mapping, ref|NULL) + * int = GtCompareMappings (gt, map1, map2) + * GtEnableMapping (gt, mapping, refresh) + * GtDisableMapping (gt, mapping, erase) + * active = GtActiveMapping (gt, mapping) + * GtRefreshMapping (gt, mapping) + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mapping) + * + * GtCopyRaster (gt, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtSetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtGetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * + * GtMapVector (gt, mapping, dir, pv1, pv2, npts) + * GtPixelToNDC (gt, raster, pv1, pv2, npts) + * GtNDCToPixel (gt, raster, pv1, pv2, npts) + * + * GtDebug (gt, fp, what) + * + * In the case of CopyRaster or {Set|Get}Mapping, raster coordinates may be + * specified in either raster pixel (GtPixel) units or in normalized device + * coordinates (GtNDC) in the range 0-32767. + * --------------------------------------------------------------------------- + */ + +GtRasterInit (w) + GtermWidget w; +{ + register int i; + register Raster rp; + register struct colormap *cm; + struct colormap *next_cm; + + invalidate_draw_context (w); + + /* Destroy any existing rasters. */ + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (w->gterm.rasters[i].type) + GtDestroyRaster (w, i); + + /* Allocate the initially empty raster descriptors. */ + XtFree ((char *)w->gterm.rasters); + w->gterm.rasters = rp = + (Raster) XtCalloc (w->gterm.maxRasters, sizeof (struct raster)); + w->gterm.nrasters = 0; + w->gterm.raster = 0; + + /* Raster 0 is the display window. */ + rp->type = PixmapRaster; + rp->width = w->core.width; + rp->height = w->core.height; + rp->r.pixmap = w->gterm.window; + rp->delete = 0; + w->gterm.nrasters++; + + /* Free any previously allocated colormap cells. */ + if (w->gterm.ncolors > SZ_STATIC_CMAP && w->gterm.useDefaultCM) { + XFreeColors (w->gterm.display, w->core.colormap, + &w->gterm.cmap[SZ_STATIC_CMAP], w->gterm.ncolors - SZ_STATIC_CMAP, + 0); + w->gterm.ncolors = SZ_STATIC_CMAP; + invalidate_cmap (w); + } + + /* Free any client defined colormaps. */ + for (cm = w->gterm.colormaps; cm; cm = next_cm) { + next_cm = cm->next; + XtFree ((char *)cm); + } + w->gterm.colormaps = NULL; + + /* Initialize the mappings. */ + GtInitMappings (w); +} + + +/* GtNextRaster -- Return the index of the next unused raster. + */ +GtNextRaster (w) + register GtermWidget w; +{ + register int i; + + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (!w->gterm.rasters[i].type) + return (i); + + return (-1); +} + + +/* GtNRasters -- Return the number of currently defined rasters. + */ +GtNRasters (w) + GtermWidget w; +{ + return (w->gterm.nrasters); +} + + +/* GtAssignRaster -- Assign a raster descriptor to an externally created + * drawable (window or pixmap). The raster thus created may be mapped or + * drawn into like the rasters created privately by the imaging code, but + * this allows use of this code to access other windows, or shared pixmaps. + */ +GtAssignRaster (w, raster, drawable, type) + GtermWidget w; + int raster; /* one-indexed */ + XtPointer drawable; /* object containing pixel array */ + int type; /* type of drawable [not used] */ +{ + register Raster rp; + XWindowAttributes wa; + + if (raster <= 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + if (!XGetWindowAttributes (w->gterm.display, (Window)drawable, &wa)) + return (ERR); + + rp->type = PixmapRaster; + rp->width = wa.width; + rp->height = wa.height; + rp->r.pixmap = (Pixmap) drawable; + rp->delete = 0; + + return (OK); +} + + +/* GtCreateRaster -- Create a new raster of the given size. A server pixmap + * (GtServer) or ximage (GtClient) raster will be created depending upon the + * current value of the cacheRasters resource. + */ +GtCreateRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int type; + int width, height; + int depth; +{ + register uchar *op; + register int npix, pixel; + uchar *data; + XImage *xp; + Raster rp; + int cache; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + /* Only rasters of depth 8 bits are currently supported. */ + if (depth && depth != 8) + return (ERR); + + /* Check for a raster number in bounds. */ + if (raster < 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + /* A create on raster 0 (the display window) is treated as an attempt + * to resize the window. + */ + if (raster == 0) { + XWindowAttributes wa; + + invalidate_draw_context (w); + + /* Issue the resize request. */ + XtVaSetValues ((Widget)w, + XtNwidth, (XtArgVal)width, + XtNheight, (XtArgVal)height, + NULL); + XFlush (w->gterm.display); + + /* The following generates a round trip request to the server and + * is an attempt to allow the window system time to process the + * resize request before the client can issue a GtQueryRaster to + * see if the request has succeeded (hence causing a race condition). + * If the window is not the requested size the delay flag is set + * to cause graphics input processing to be suspended until the + * window is resized or redisplayed. A dummy expose event is + * generated to clear the delay condition in case the resize request + * is not granted. + */ + if (XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + rp->width = wa.width; + rp->height = wa.height; + + if (rp->width != width || rp->height != height) { + XExposeEvent ev; + ev.type = Expose; + ev.send_event = True; + ev.display = w->gterm.display; + ev.window = w->gterm.window; + ev.x = ev.y = 0; + ev.width = ev.height = 1; + ev.count = 0; + + XSendEvent (w->gterm.display, w->gterm.window, False, + NoEventMask, (XEvent *)&ev); + w->gterm.delay = 1; + } + } + return (OK); + } + + /* Get rid of any old raster. */ + GtDestroyRaster (w, raster); + + rp->width = width; + rp->height = height; + rp->delete = 1; + + /* Cache the raster? */ + if (strcmp (w->gterm.cacheRasters, "always") == 0) + cache = 1; + else if (strcmp (w->gterm.cacheRasters, "never") == 0) + cache = 0; + else + cache = (type == GtServer); + + /* Create new raster. */ + if (cache) { + /* Create a pixmap. */ + rp->type = PixmapRaster; + rp->r.pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + width, height, RasterDepth); + if (rp->r.pixmap == (Pixmap)NULL) + goto ximage; + XFillRectangle (w->gterm.display, rp->r.pixmap, w->gterm.clearGC, + 0, 0, width, height); + + } else { + /* Create an XImage. */ +ximage: + rp->type = ImageRaster; + + /* Get pixel storage. */ + npix = width * height; + if ((data = (uchar *) XtMalloc (npix)) == NULL) + return (ERR); + else { + for (op=data, pixel=w->gterm.color0; --npix >= 0; ) + *op++ = pixel; + } + + /* The following doesn't yet deal properly with byte and bit ordering + * differences between the server and client. + */ + rp->r.ximage = xp = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, width, height, 8, 0); + if (xp == NULL) { + rp->type = 0; + return (ERR); + } + } + + w->gterm.nrasters++; + return (OK); +} + + +/* GtDestroyRaster -- Destroy a raster. Any mappings which reference the + * raster are deactivated, and all storage associated with the raster is freed. + */ +GtDestroyRaster (w, raster) + GtermWidget w; + int raster; +{ + register Raster rp; + register Mapping mp, next; + + if (raster <= 0) + return; + + invalidate_draw_context (w); + + /* Disable any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = next) { + next = mp->next; + if (mp->src == raster || mp->dst == raster) + free_mapping (w, mp); + } + + /* Destroy the raster. */ + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (rp->delete) { + if (rp->type == ImageRaster) + XDestroyImage (rp->r.ximage); + else if (rp->type == PixmapRaster) + XFreePixmap (w->gterm.display, rp->r.pixmap); + } + w->gterm.nrasters--; + rp->type = 0; + rp->delete = 0; + } +} + + +/* GtQueryRaster -- Determine whether a raster exists and if so return its + * size. + */ +GtQueryRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int *type; + int *width, *height; + int *depth; +{ + register Raster rp; + + if (raster < 0 || raster > w->gterm.maxRasters) + return (0); + + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (type) { + if (rp->type == PixmapRaster) + *type = GtServer; + else + *type = GtClient; + } + if (width) + *width = rp->width; + if (height) + *height = rp->height; + if (depth) + *depth = RasterDepth; + return (1); + } else + return (0); +} + + +/* GtWritePixels -- Write to a rectangular region of a raster. If any + * mappings are currently defined which reference this raster as the source, + * and a mapped region is being rewritten, the affected pixels will be + * refreshed by the mapping. + */ +GtWritePixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + int bytes_per_line, i; + Mapping mp; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + XImage *ximage; + uchar *data; + int npix; + + /* Get a data buffer. */ + if ((data = (uchar *)XtMalloc (npix = nx * ny)) == NULL) + return (ERR); + + /* Convert the pixel values to colormap indices. */ + cmap = get_cmap_in (w); + for (ip=pixels, op=data, n=npix; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + + ximage = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, nx, ny, 8, 0); + + if (raster == 0 && w->gterm.pixmap) { + + /* ### Someone (Mike?) added this code for some reason, but it + * does not appear to be valid. This code already writes to the + * backing store (gterm.pixmap) so use_backing_store should not + * be required. Also blindly using only the first mapping context + * and ignoring any others cannot be correct. There is code + * below which executes any mappings defined on the raster. + * In general this requires scaling, not a simple XCopyArea. + * + * DrawContext dx = get_draw_context (w); + * register MappingContext mx; + * mx = &dx->mapContext[0]; + */ + + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + /* ### (cont'd) + * if (mx->use_backing_store) + * XCopyArea (display, w->gterm.pixmap, mx->pixmap, + * w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + */ + + XCopyArea (display, w->gterm.pixmap, rp->r.pixmap, + w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + } else + XPutImage (display, rp->r.pixmap, w->gterm.exposeGC, ximage, + 0, 0, x1, y1, nx, ny); + + XtFree ((char *)data); + ximage->data = NULL; + XDestroyImage (ximage); + + } else if (rp->type == ImageRaster) { + cmap = get_cmap_in (w); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + ip = pixels; + + /* Copy the data into the ximage data raster, converting input + * pixels to Xlib pixel values in the process. + * + * Possibly this should be done at Pixmap write time rather than + * during raster i/o so that the image pixel values are preserved. + * Otherwise reading back pixels is difficult and if the color map is + * dynamically modified the original pixel values may be lost. + * Postponing display pixel value generation woudl also make it easy + * to add support later for image depths other than 8 bit. Doing the + * conversion to display pixels here is however simpler and more + * efficient so that is how we do it for now. + */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = (cmap[*ip++] & 0377); + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtReadPixels -- Read a rectangular region of a raster. + */ +GtReadPixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + + int bytes_per_line, i; + int x, y, delxin = 0; + XImage *xin; + Raster rp; + uchar *lp; + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + /* Get the input ximage. */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + + /* Read the pixmap subraster into an ximage. If we are reading the + * screen (raster == 0) and we have an off-screen backing store pixmap, + * use that instead of the screen. + */ + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? w->gterm.pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + + if (xin == NULL) + return (ERR); + + delxin++; + x = y = 0; + + } else { + xin = rp->r.ximage; + x = x1; + y = y1; + } + + cmap = get_cmap_out (w); + bytes_per_line = xin->bytes_per_line; + lp = (uchar *)xin->data + y * bytes_per_line + x; + op = pixels; + + /* Copy the data to the output buffer, converting display pixels to + * client pixels in the process. + */ + for (i=0; i < ny; i++) { + for (n=nx, ip=lp; --n >= 0; ) + *op++ = cmap[*ip++]; + lp += bytes_per_line; + } + + if (delxin) + XDestroyImage (xin); + return (OK); +} + + +/* GtSetPixels -- Set all the raster pixels in a region to a single color. + * If nx=ny=0 the entire raster will be written. + */ +GtSetPixels (w, raster, ct, x1, y1, nx, ny, color, rop) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; + int color; + int rop; +{ + register Raster rp; + Mapping mp; + + /* Get raster pointer. */ + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + raster, ct, x1,y1,nx,ny); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + } + + /* Perform some range checks. */ + if (x1 == 0 && y1 == 0 && nx == 0 && ny == 0) { + nx = rp->width; + ny = rp->height; + } else { + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + } + + /* Set the pixels. + */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + GC gc = w->gterm.clearGC; + int use_backing_store; + + use_backing_store = + (raster == 0 && w->gterm.pixmap && !(rop & R_Transient)); + + XSetForeground (display, gc, get_pixel(w,color)); + XFillRectangle (display, rp->r.pixmap, gc, x1, y1, nx, ny); + if (use_backing_store) + XFillRectangle (display, w->gterm.pixmap, gc, x1, y1, nx, ny); + XSetForeground (display, gc, w->gterm.color0); + + } else { + register int n, i; + register uchar *op; + register Pixel pixel; + int bytes_per_line; + uchar *lp; + + pixel = get_pixel (w, color); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Set all pixels in the indicated region. */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = pixel; + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtRefreshPixels -- Update any mappings defined upon the given region of + * the given source raster, as if the pixel values had been set with a + * write pixels call. + */ +GtRefreshPixels (w, raster, ct, x1, y1, nx, ny) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; +{ + register Raster rp = &w->gterm.rasters[raster]; + register Mapping mp; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); + save_mapping (&sv_mp, 0, 0, + raster, ct, x1,y1,nx,ny, + 0, GtPixel, 0,0,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.sx; + y1 = p_mp.sy; + nx = p_mp.snx; + ny = p_mp.sny; + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } +} + + +/* GtExtractPixmap -- Extract a rectangular region of a raster and return + * as a pixmap. The caller is responsible for later deleting this pixmap. + */ +Pixmap +GtExtractPixmap (w, src, ctype, x, y, width, height) + GtermWidget w; + int src; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + int x1, y1, nx, ny; + String cache; + int i; + + rp = &w->gterm.rasters[src]; + if (!rp->type) + return ((Pixmap)NULL); + + /* If width and height are zero, return the full raster. */ + if (width <= 0) + width = rp->width; + if (height <= 0) + height = rp->height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + src, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Find any empty raster slot and use it to generate the output pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + cache = w->gterm.cacheRasters; + w->gterm.cacheRasters = "always"; + + if (GtCreateRaster (w, i, GtServer, nx, ny) == ERR) { + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } else if (rp->type != PixmapRaster) + goto err; + + if (GtCopyRaster (w, 0, + src,0, x1,y1,nx,ny, i,0, 0,0,nx,ny) == ERR) { +err: + GtDestroyRaster (i); + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } + + rp->type = 0; + w->gterm.nrasters--; + w->gterm.cacheRasters = cache; + + return (rp->r.pixmap); + } + } + + return ((Pixmap)NULL); +} + + +/* GtInsertPixmap -- Insert the contents of the given pixmap into a raster + * at the indicated coordinates. + */ +GtInsertPixmap (w, pixmap, dst, ctype, x, y, width, height) + GtermWidget w; + Pixmap pixmap; + int dst; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + XWindowAttributes wa; + int x1, y1, nx, ny; + int i; + + /* Check that the pixmap exists. */ + if (!XGetWindowAttributes (w->gterm.display, pixmap, &wa)) + return (ERR); + + /* Default to full dimensions of pixmap if no dimensions given. */ + if (width <= 0) + width = wa.width; + if (height <= 0) + height = wa.height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + dst, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Create the destination raster if none exists. */ + if (!w->gterm.rasters[dst].type) + if (GtCreateRaster (w, dst, GtDefault, nx, ny) == ERR) + return (ERR); + + /* Find an empty raster slot and use it to build a fake source raster + * using the supplied pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + rp->type = PixmapRaster; + rp->width = nx; + rp->height = ny; + rp->r.pixmap = pixmap; + + if (GtCopyRaster (w, 0, + i,0, 0,0,nx,ny, dst,0, x1,y1,nx,ny) < 0) + return (ERR); + + rp->type = 0; + return (OK); + } + } + + return (ERR); +} + + +/* GtWriteColormap -- Allocate or modify colormap cells. The Gterm widget + * colormap consists of a fixed number of preassigned, read-only color cells, + * plus a variable number of dynamically allocated application defined color + * cells. The application sees only the preassigned pixel space 0-N where + * N is the maximum pixel value. These values are mapped to Xlib pixel values + * by the CMAP vector in the main Gterm widget descriptor. The server + * colormap does the final mapping to RGB triplets. + * + * Our strategy here is as follows. If we have a monochrome screen set up a + * one-to-one fake colormap so that we preserve the input pixel values and + * render a one-bit image later. If we have a StaticGray or StaticColor + * visual allocate read-only color cells to allow X to choose the closest + * colors to what we request. If we have a GrayScale or PseudoColor visual + * allocate private read-write colors. The TrueColor and DirectColor + * visuals should not be seen here as we should have been able to set up the + * PseudoColor visual on screens that support these visuals, but if they are + * seen use a one-to-one mapping to preserve the 8 bit pixel values. + */ +GtWriteColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + XWindowAttributes wa; + register XColor *cp; + register int i, j, v, n; + unsigned long plane_masks[1]; + int req, need; + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + if (map > 0) { + /* Create or modify a colormap descriptor. The display colormap + * is not affected. + */ + register struct colormap *cm; + struct colormap *last_cm; + register XColor *cp; + register int i; + + /* See if the colormap already exists. */ + for (cm = w->gterm.colormaps, last_cm = NULL; cm; cm = cm->next) { + last_cm = cm; + if (cm->map == map) + break; + } + + /* If not, create it. */ + if (!cm) { + if (!(cm = (struct colormap *)XtCalloc(1,sizeof(struct colormap)))) + return (ERR); + if (last_cm) + last_cm->next = cm; + else + w->gterm.colormaps = cm; + + /* Initialize static part of colormap. */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } + + cm->map = map; + cm->ncells = max (cm->ncells, first + nelem); + + /* Ignore attempts to overwrite static part of colormap. */ + for ( ; first < SZ_STATIC_CMAP; first++, nelem--) { + r++; g++; b++; + } + + memmove (&cm->r[first], r, nelem * sizeof (ushort)); + memmove (&cm->g[first], g, nelem * sizeof (ushort)); + memmove (&cm->b[first], b, nelem * sizeof (ushort)); + + return (OK); + } + + /* Write to the display colormap. + */ + if (first < SZ_STATIC_CMAP || first + nelem > MAX_SZCMAP) + return (ERR); + + /* Invalidate the cmap cache. */ + invalidate_cmap (w); + + /* Get the window attributes. We need to do this to determine the type + * of visual used for the window, which determines our color allocation + * strategy. This is only done once since presumably the visual and + * window depth will not change after the widget has been around long + * enough to receive a GtWriteColormap call. + */ + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) + return (ERR); + w->gterm.wa = wa; + w->gterm.wa_defined++; + } else + wa = w->gterm.wa; + + if (wa.depth == 1) + goto unitary; + + switch (wa.visual->class) { + case StaticGray: + case StaticColor: + /* Allocate "best-match" colors. */ + for (i=first; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + cp->red = r[i-first]; + cp->green = g[i-first]; + cp->blue = b[i-first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (XAllocColor (w->gterm.display, wa.colormap, cp)) + w->gterm.cmap[i] = cp->pixel; + else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + } + } + break; + + case GrayScale: + case PseudoColor: + if (w->gterm.useDefaultCM) { +usedef: /* Allocate private r/w colors from default colormap. */ + need = first + nelem - w->gterm.ncolors; + + /* Allocate new color cells if needed. If we can't allocate all + * the requested cells the unallocated pixel values are set to + * black. + */ + if ((n = need) > 0) { + /* Get the colormap cells. */ + req = min(w->gterm.maxColors, first + nelem - SZ_STATIC_CMAP) - + (w->gterm.ncolors - SZ_STATIC_CMAP); + for (n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, wa.colormap, + False, plane_masks, 0, + &w->gterm.cmap[w->gterm.ncolors+n], req)) { + n += req; + } else + req /= 2; + + /* Initialize the color descriptors. */ + for (i = w->gterm.ncolors; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + if (i < w->gterm.ncolors + n) { + cp->pixel = w->gterm.cmap[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + cp->flags = 0; + } + } + w->gterm.ncolors += n; + } + + /* Assign RGB colors to the referenced cells. */ + for (i=0; i < nelem; i++) { + cp = &w->gterm.color[first+i]; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + n = w->gterm.ncolors - first; + if (n > 0) + XStoreColors (w->gterm.display, wa.colormap, + &w->gterm.color[first], n); + + } else { + /* Allocate colors in a custom colormap. If the named colormap + * does not yet exist we create one. Multiple gterm widget + * instances may share the same colormap. + */ + Colormap colormap; + long timeval, time(); + int ncolors, shadow; + + /* get_colormap will direct us to the default colormap if the + * custom colormap cannot be accessed or created. + */ + colormap = get_colormap (w); + if (w->gterm.useDefaultCM) + goto usedef; + + /* Assign RGB colors to the referenced cells. */ + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + /* Store the new colors. */ + if (ncolors > 0) + XStoreColors (w->gterm.display, + colormap, &w->gterm.color[first], ncolors); + + /* Also attempt to store the colors in the default colortable, + * by allocating, writing, and then deallocating cells. This + * helps keeps the gterm window visible when the default + * colormap is loaded. To avoid excessive server queries the + * default colormap is only updated every so often. Updating is + * disabled if cmapShadow is set to zero. If shadowing is + * enabled the update is always performed if the WriteColormap + * occurs when the pointer is not in the window (e.g., when a + * button elsewhere in the GUI is pressed) as otherwise the + * change will not be visible as the private colormap will not + * be loaded by the window manager. + */ + shadow = w->gterm.cmapShadow; + timeval = time((long *)NULL); + + if (shadow && (!w->gterm.in_window || + (timeval - w->gterm.cmapLastShadow > shadow))) { + + update_default_colormap (w); + w->gterm.cmapLastShadow = timeval; + } + } + break; + + default: + /* Set up a unitary, or one-to-one mapping, to preserve the input + * pixel values so that we can render them later. + */ +unitary: + for (i = first; i < first+nelem; i++) { + w->gterm.cmap[i] = i; + cp = &w->gterm.color[i]; + cp->pixel = i; + cp->red = r[i+first]; + cp->green = g[i+first]; + cp->blue = b[i+first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (i+1 > w->gterm.ncolors) + w->gterm.ncolors = i + 1; + } + break; + } + + return (OK); +} + + +/* GtReadColormap -- Return the color assignments for a region of the named + * colormap. + */ +GtReadColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + if (map > 0) { + /* Read from a colormap descriptor. + */ + register struct colormap *cm; + register int i, j; + + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + j = first + i; + if (j < cm->ncells) { + r[i] = cm->r[j]; + g[i] = cm->g[j]; + b[i] = cm->b[j]; + } else + break; + } + + return (i); + + } else { + /* Read the display colormap. + */ + register XColor *cp; + register int i; + + /* Return RGB values. */ + for (i=0; i < nelem; i++) + if (first+i < w->gterm.ncolors) { + cp = &w->gterm.color[first+i]; + r[i] = cp->red; + g[i] = cp->green; + b[i] = cp->blue; + } else + break; + + return (i); + } +} + + +/* GtLoadColormap -- Load a colormap into the display, optionally scaling + * the colormap via a linear transformation in the process. The colormap is + * unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. + * If map=0 the linear transformation is applied directly to the display + * colormap. + * + * The offset refers to the center of the mapped region of the transfer + * function, which is why the center value is at 0.5. For example, if the + * range of raster pixel intensities is normalized to the range 0.0 to 1.0, + * then a transfer function of [offset=0.3,slope=3.0] will display the region + * of intenstities centered around the normalized intenstity of 0.3, with a + * contrast of 3.0 (the screen intensity changes 3 units for a unit change in + * raster pixel intensity). The transfer function [offset=0.3,slope=-3.0] + * will display the same range of pixel intensitites, but with a negative + * contrast. The transfer function [offset=0.5,slope=1.0] has intercepts + * of [0,0] and [1,1] hence it displays the full range of raster pixel + * intensities - the input colormap is used as is, without resampling. + */ +GtLoadColormap (w, map, offset, slope) + GtermWidget w; + int map; + float offset, slope; +{ + register int i; + register XColor *cp; + register struct colormap *cm; + struct colormap d_cmap, o_cmap; + int noscale, nelem, c1, c2; + float x, y, z, frac; + ushort r, g, b; + + /* Get the colormap to be loaded. + */ + if (map == 0) { + /* Create a dummy colormap struct from the screen colormap. */ + cm = &d_cmap; + cm->map = 0; + cm->next = NULL; + cm->ncells = w->gterm.ncolors; + for (i=0; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } else { + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (ERR); + } + + /* Compute the scaled colormap. Only the dynamic part of the colormap + * is scaled, the static cells are not affected. + */ + o_cmap.map = 0; + o_cmap.ncells = cm->ncells; + nelem = cm->ncells - SZ_STATIC_CMAP; + noscale = (abs(offset - 0.5) < 0.0001 && abs(slope - 1.0) < 0.0001); + + if (noscale) { + for (i=0; i < nelem; i++) { + o_cmap.r[i] = cm->r[SZ_STATIC_CMAP+i]; + o_cmap.g[i] = cm->g[SZ_STATIC_CMAP+i]; + o_cmap.b[i] = cm->b[SZ_STATIC_CMAP+i]; + } + } else { + for (i=0; i < nelem; i++) { + x = (float)i / (float)(nelem - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + r = cm->r[SZ_STATIC_CMAP]; + g = cm->g[SZ_STATIC_CMAP]; + b = cm->b[SZ_STATIC_CMAP]; + } else if (y >= 1.0) { + r = cm->r[cm->ncells-1]; + g = cm->g[cm->ncells-1]; + b = cm->b[cm->ncells-1]; + } else { + z = y * (nelem - 1) + SZ_STATIC_CMAP; + if (w->gterm.cmapInterpolate) { + c1 = (int)z; + c2 = min (cm->ncells-1, c1 + 1); + frac = z - c1; + r = cm->r[c1] * (1.0 - frac) + cm->r[c2] * frac; + g = cm->g[c1] * (1.0 - frac) + cm->g[c2] * frac; + b = cm->b[c1] * (1.0 - frac) + cm->b[c2] * frac; + } else { + c1 = (int)z; + r = cm->r[c1]; + g = cm->g[c1]; + b = cm->b[c1]; + } + } + + o_cmap.r[i] = r; + o_cmap.g[i] = g; + o_cmap.b[i] = b; + } + } + + /* Load the colormap into the display. */ + GtWriteColormap (w, 0, SZ_STATIC_CMAP, nelem, + o_cmap.r, o_cmap.g, o_cmap.b); + + /* If the colormap we loaded to the display was the display colormap, + * restore the original unscaled colors in the gterm descriptor so that + * we won't be scaling a scaled colormap in the next operation. + */ + if (map == 0) + for (i=SZ_STATIC_CMAP; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cp->red = cm->r[i]; + cp->green = cm->g[i]; + cp->blue = cm->b[i]; + } + + return (OK); +} + + +/* GtQueryColormap -- Return information on the size and state of a colormap. + */ +GtQueryColormap (w, map, first, nelem, maxelem) + register GtermWidget w; + int map; + int *first, *nelem, *maxelem; +{ + register struct colormap *cm; + int nitems; + + if (first) + *first = SZ_STATIC_CMAP; + if (nelem) + *nelem = 0; + if (maxelem) + *maxelem = min (w->gterm.maxColors, MAX_SZCMAP) - SZ_STATIC_CMAP; + + if (map > 0) { + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + if (nelem) + *nelem = cm->ncells - SZ_STATIC_CMAP; + + } else { + if (nelem) + *nelem = w->gterm.ncolors - SZ_STATIC_CMAP; + if (maxelem) { + nitems = min (MAX_SZCMAP, CellsOfScreen(w->gterm.screen)); + *maxelem = min (nitems, + min (w->gterm.maxColors, MAX_SZCMAP - w->gterm.base_pixel)); + } + } + + return (1); +} + + +/* GtNextColormap -- Return a unique colormap number. + */ +GtNextColormap (w) + register GtermWidget w; +{ + register struct colormap *cm; + register int mapno = 0; + + /* Get the next map number. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map > mapno) + mapno = cm->map; + + return (mapno + 1); +} + + +/* GtFreeColormap -- Free a colormap descriptor. + */ +GtFreeColormap (w, colormap) + register GtermWidget w; + int colormap; +{ + register struct colormap *p_cm, *cm; + + /* Find the colormap and free it. */ + for (p_cm = NULL, cm = w->gterm.colormaps; cm; p_cm = cm, cm = cm->next) + if (cm->map == colormap) { + if (p_cm) + p_cm->next = cm->next; + else + w->gterm.colormaps = cm->next; + XtFree ((char *)cm); + return; + } +} + + +/* GtWriteIomap -- An iomap is an optional lookup table used to isolate the + * client application from the color model used within the Gterm widget. + * To simplify color allocation the Gterm widget defines a logical color + * space where color 0 is the background, 1 the foreground, 2-N are statically + * allocated standard colors, and colors N+1 and above are dynamically + * allocated by the graphics application. Less-demanding applications use + * only the statically allocated, shared colors. The widget internally maps + * these logical colors to whatever the window system requires, but providing + * a well-defined logical color space isolates the client from the details of + * color allocation in the underlying window system. + * + * An iomap can be used to define a mapping between the color model of the + * client application and the Gterm color model (when we say color model here + * we mean color allocation schemes for 8 bit pseudocolor). By default the + * iomap is one-to-one. The use of an iomap frees the client from having to + * worry about color index translations, and allows color tables to be + * combined in the widget for greater efficiency when color tables are serially + * applied. The iomap applies to all color indices or pixel values passed + * in i/o operations between the client and the Gterm widget. + */ +GtWriteIomap (w, iomap, first, nelem) + register GtermWidget w; + ushort *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (&w->gterm.iomap[c1], iomap, nelem * sizeof(ushort)); + invalidate_cmap (w); +} + + +/* GtReadIomap -- Read back the contents of the iomap. + */ +GtReadIomap (w, iomap, first, nelem) + register GtermWidget w; + uchar *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (iomap, &w->gterm.iomap[c1], nelem * sizeof(ushort)); +} + + +/* init_iomap -- Initialize the iomap and the cmap cache. + */ +static void +init_iomap (w) + GtermWidget w; +{ + register ushort *iomap = w->gterm.iomap; + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + iomap[i] = i; + invalidate_cmap (w); +} + + +/* invalidate_cmap -- Invalidate the cmap cache. + */ +static void +invalidate_cmap (w) + register GtermWidget w; +{ + w->gterm.cmap_in_valid = w->gterm.cmap_out_valid = 0; +} + + +/* get_cmap_in -- Get the combined input colormap, used to transform color + * values received from the client to window system color indices. + */ +static Pixel * +get_cmap_in (w) + register GtermWidget w; +{ + register Pixel *cmap, *cmap_in = w->gterm.cmap_in; + register ushort *iomap; + register int i, j; + int ncolors; + + if (w->gterm.cmap_in_valid) + return (cmap_in); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + ncolors = w->gterm.ncolors - SZ_STATIC_CMAP; + + /* If ncolors is small wrap around so that pixel values stay within + * the mapped range of output pixels. + */ + for (i=0; i < MAX_SZCMAP; i++) { + j = iomap[i]; + if (j > SZ_STATIC_CMAP && ncolors) + j = ((j - SZ_STATIC_CMAP) % ncolors) + SZ_STATIC_CMAP; + cmap_in[i] = cmap[j]; + } + + w->gterm.cmap_in_valid++; + return (cmap_in); +} + + +/* get_cmap_out -- Get the combined output colormap, used to transform window + * system color indices to the color system of the client. Note that this is + * not necessarily a uniquely defined invertible transformation. + */ +static Pixel * +get_cmap_out (w) + GtermWidget w; +{ + register Pixel *cmap; + register ushort *iomap; + Pixel *cmap_out = w->gterm.cmap_out; + register int pixel, i; + int j; + + if (w->gterm.cmap_out_valid) + return (cmap_out); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + + /* Invert the two colormaps. This is not very efficient, but we don't + * have to do this very often (a GtReadPixels call is about the only + * case, and even then the map is cached). + */ + for (j=0; j < MAX_SZCMAP; j++) { + pixel = j; + + /* Lookup display pixel in cmap. */ + for (i=0; i < MAX_SZCMAP; i++) + if (cmap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + + /* Lookup cmap pixel in iomap. */ + if (iomap[pixel] != pixel) { + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + } + + cmap_out[j] = pixel; + } + + w->gterm.cmap_out_valid++; + return (cmap_out); +} + + +/* get_pixel -- Convert a client color index into a display pixel. + */ +static Pixel +get_pixel (w, client_pixel) + register GtermWidget w; + register int client_pixel; +{ + register Pixel *cmap = get_cmap_in (w); + + if (client_pixel < 0 || client_pixel >= MAX_SZCMAP) + return (w->gterm.cmap[1]); + else + return (cmap[client_pixel]); +} + + +/* GtGetClientPixel -- Convert a gterm pixel into a client pixel. + */ +GtGetClientPixel (w, pixel) + GtermWidget w; + register int pixel; +{ + register int i; + register ushort *iomap; + int client_pixel = 0; + + get_cmap_in (w); + iomap = w->gterm.iomap; + + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + client_pixel = i; + break; + } + + return (client_pixel); +} + + +/* GtInitMappings -- Delete all mappings and initialize the mapping subsystem. + */ +GtInitMappings (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + invalidate_draw_context (w); + + /* Free any mapping storage. */ + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (mp->defined) + free_mapping (w, mp); + } + XtFree ((char *)w->gterm.mappings); + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + } + + /* Allocate the initially empty mapping descriptors. */ + w->gterm.mappings = + (Mapping) XtCalloc (w->gterm.maxMappings, sizeof (struct mapping)); + + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + mp->mapping = i; + } + + w->gterm.nmappings = 0; +} + + +/* GtNextMapping -- Return the index of the next available mapping descriptor. + * This routine always returns a mapping index of 1 or higher. + */ +GtNextMapping (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + for (i=1; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + return (i); + } + + return (-1); +} + + +/* GtFreeMapping -- Free a mapping descriptor. + */ +GtFreeMapping (w, mapping) + register GtermWidget w; + int mapping; +{ + free_mapping (w, &w->gterm.mappings[mapping]); +} + + +/* GtRaiseMapping -- Set the stacking order of a mapping to one level + * higher than the reference mapping. If no reference mapping is given + * the mapping is raised to the top of the stacking order. + */ +GtRaiseMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = w->gterm.mp_tail; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already on top? */ + if (mp == w->gterm.mp_tail) + return; + + mp_unlink (w, mp); + mp_linkafter (w, mp, ref_mp); +} + + +/* GtLowerMapping -- Change the stacking order of a mapping relative to another + * mapping, causing the first mapping to be drawn below the second. + */ +GtLowerMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = NULL; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already lowered? */ + if (mp == w->gterm.mp_head) + return; + + /* Lower it. */ + mp_unlink (w, mp); + if (ref_mp && ref_mp->prev) + mp_linkafter (w, mp, ref_mp->prev); + else { + mp->next = w->gterm.mp_head; + w->gterm.mp_head = mp; + if (mp->next) + mp->next->prev = mp; + if (!w->gterm.mp_tail) + w->gterm.mp_tail = mp; + } +} + + +/* GtCompareMappings -- Compare the stacking order of two mappings. A + * negative value is returned if the m1 < m2, zero is returned if the + * mappings are the same, and a positive value is returned if m1 > m2. + */ +GtCompareMappings (w, map1, map2) + register GtermWidget w; + int map1, map2; +{ + register Mapping mp, mp1, mp2; + + if (map1 == map2) + return (0); + + mp1 = &w->gterm.mappings[map1]; + mp2 = &w->gterm.mappings[map2]; + + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp == mp1) + return (-1); + else if (mp == mp2) + return (1); + + return (0); +} + + +/* GtSelectRaster -- Select the raster which maps to the given raster pixel, + * and transform the coordinates back to the source raster. The raster number + * and the raster coordinates of the source raster are returned. If no raster + * maps to the given pixel, raster=src and source raster coordinates are + * returned. + * + * The raster pixel coordinate system is best explained by an example. + * Suppose we have a 10x10 raster mapped into a 500x500 window. The + * window pixel 0 on an axis has raster pixel coordinate 0.0; pixel 500 + * (which is outside the window) has raster pixel coordinate 10.0. The + * coordinates correspond to the edge of the pixel as displayed in the + * window, i.e., the left edge of the (nonflipped) window is at x=0.0, and + * the right edge at x=10.0. Due to the pixelization of the screen, the + * maximum value is a limit which is only approached as the magnification + * increases. + * + * The client application may have a different coordinate system than the + * above. For example, if the client wants an integer pixel value to be + * at the center of a pixel, the first pixel has the coordinate [1,1], and + * the raster is 10 pixels wide, the client coordinate system would range + * from 0.5 to 10.5 at the edges of the NDC space. + */ +GtSelectRaster (w, dras, dt, dx, dy, rt, rx, ry, rmap) + GtermWidget w; + int dras; /* display raster */ + int dt; /* coordinate type of input coords */ + int dx, dy; /* display raster coordinates */ + int rt; /* coordinate type for output */ + int *rx, *ry; /* raster coordinates (output) */ + int *rmap; /* mapping selected */ +{ + register Mapping mp; + float x, y, x2, y2; + int raster, mapping; + + /* Get display raster pixel coordinates. */ + if (dt != GtPixel) { + struct mapping sv_mp, p_mp; + save_mapping (&sv_mp, 0, 0, + 0, 0, 0,0,0,0, + 0, dt, dx,dy,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + dx = p_mp.dx; + dy = p_mp.dy; + } + + /* Search for a mapping which maps to this pixel. The mapping we are + * looking for is the mapping closest to the tail of the mapping list + * (highest stacking order) which is defined and enabled and which + * includes the given display raster pixel in its destination rect. + */ + for (mp = w->gterm.mp_tail, mapping = -1; mp; mp = mp->prev) { + if (mp->defined && mp->enabled && mp->dst == dras) { + struct mapping *map, p_mp; + int dnx, dny; + + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + if ((dnx = map->dnx) < 0) + dnx = -dnx; + if ((dny = map->dny) < 0) + dny = -dny; + + /* Is display raster pixel in destination rect for this mapping? + */ + if (dnx > 0 && dx >= map->dx && dx < map->dx + dnx && + dny > 0 && dy >= map->dy && dy < map->dy + dny) { + + /* Compute offset into destination rect and apply axis flip + * if any from mapping. + */ + x = dx - map->dx + 0.5; + if (map->dnx < 0) + x = dnx - x; + y = dy - map->dy + 0.5; + if (map->dny < 0) + y = dny - y; + + /* Compute the source raster coordinates corresponding to + * the given display pixel. This is done in floating point + * to permit fractional pixel resolution if the mapping + * zooms the raster. + */ + x = x * (float)map->snx / (float)dnx + map->sx; + y = y * (float)map->sny / (float)dny + map->sy; + + mapping = map->mapping; + raster = map->src; + x2 = w->gterm.rasters[raster].width; + y2 = w->gterm.rasters[raster].height; + + break; + } + } + } + + /* Return display raster coordinates if no mapped raster was found. + */ + if (mapping < 0) { + x = dx; y = dy; + x2 = (int)w->core.width - 1; + y2 = (int)w->core.height - 1; + raster = dras; + } + + /* Output coordinates of the requested type. The increased resolution + * of NDC coordinates allows fractional pixel coordinates to be returned + * (e.g. 1/32 of a pixel for a 1K raster). + */ + if (rt == GtPixel) { + *rx = x; + *ry = y; + } else { + *rx = ( x) / x2 * MAXNDC; + *ry = (y2 - y) / y2 * MAXNDC; /* NDC is flipped in Y */ + } + + *rmap = mapping; + return (raster); +} + + +/* GtCopyRaster -- Copy a region of the source raster to a region of the + * destination raster. If the input and output regions are not the same + * size the subimage is automatically scaled to fit the destination region. + * If the destination extent DNX or DNY is negative, the image is flipped in + * that axis. The type of spatial scaling performed is determined by the + * scale factors (zoom, dezoom, or no scaling). The rasterop argument is + * used to exercise fine control over how the mapping is performed, e.g., to + * force a refresh, implement a transient mapping, or in the case of a dezoom + * (many-to-one) mapping, select the antialiasing technique to be used. + */ +GtCopyRaster (w, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for destination raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + Mapping sv_mp, p_mp; + int status; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Construct a temporary mapping describing the desired raster copy. */ + save_mapping (&sv_mp, w->gterm.maxMappings, 0, + src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + initialize_mapping (&p_mp); + get_pixel_mapping (w, &sv_mp, &p_mp, 1); + update_mapping (w, &p_mp); + + /* Refresh the destination pixels. */ + status = refresh_destination (w, &p_mp, dx, dy, abs(dnx), abs(dny)); + + /* Discard the temporary mapping. */ + free_mapping (w, &p_mp); + + return (status); +} + + +/* GtSetMapping -- Define a new mapping function, or modify an old one. + * If a new mapping is defined it is merely enabled, and no refreshing + * of the screen takes place until either some mapped data is written + * to or the mapping is explicitly refreshed. If an existing mapping is + * modified the old and new mappings are examined and only those portions + * of the destination rect for which the mapping changed are updated. + * This permits minor changes to a mapping (e.g. moving an edge) without + * having to redraw the entire region. Regions of the destination drawable + * which were previously covered by the mapping but which were exposed by + * modifying the mapping are redrawn. + */ +GtSetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for source raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + register int i, j; + register Mapping mp, o_mp, n_mp; + struct mapping pix_mp, new_mp; + int defined, scale_changed, offset, current, state, old_i; + int nx, xs[MAX_REGIONS], xe[MAX_REGIONS], xv[MAX_REGIONS]; + int ny, ys[MAX_REGIONS], ye[MAX_REGIONS], yv[MAX_REGIONS]; + int n_dnx, n_dny, n_xflip=0, n_yflip=0, i1, i2; + int o_dnx, o_dny, o_xflip=0, o_yflip=0; + int *o_xymap, *o_xmap, *o_ymap; + int *n_xymap, *n_xmap, *n_ymap; + XRectangle rl[MAX_REGIONS]; + int nrect, buflen, refresh; + + /* Check mapping number in range. */ + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (ERR); + else + mp = &w->gterm.mappings[mapping]; + + invalidate_draw_context (w); + initialize_mapping (&pix_mp); + initialize_mapping (&new_mp); + + /* Get local pixel space copy of old mapping, store new mapping. */ + get_pixel_mapping (w, mp, &pix_mp, 1); + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = snx; mp->sny = sny; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dnx; mp->dny = dny; + mp->rop = (rop & ~(R_RefreshNone|R_RefreshAll)); + mp->updated = 0; + + /* Newly defined mappings are linked at the tail of the mapping list, + * i.e. they stack (display) on top of any other mappings. If the + * mapping is already defined the stacking order is not changed. + */ + if (!(defined = mp->defined)) { + mp_linkafter (w, mp, w->gterm.mp_tail); + mp->defined = 1; + } + + if (!valid_mapping (w, mp)) { + mp_unlink (w, mp); + mp->defined = 0; + return (ERR); + } + update_mapping (w, mp); + + /* If we are defining a new mapping just define it and quit, without + * refreshing the window, unless R_RefreshAll is explicitly set in the + * mapping. If the mapping is not enabled merely store the new mapping. + * If the mapping is a null mapping (no pixels) do nothing. If refresh + * is disabled in the rasterop merely store the new mapping. If we are + * editing an existing mapping which is enabled with the default rasterop, + * we continue on to compare the old and new mappings and refresh any + * changed pixels in the destination rect. + */ + if (!defined || src != mp->src || dst != mp->dst) { + mp->enabled = mp->defined = 1; + mp->refresh = 0; + return; + } else if (!mp->enabled) { + return; + } else if (snx == 0 || sny == 0 || dnx == 0 || dny == 0) + return; + + if (rop & R_RefreshNone) + return; + + /* Convert input mappings to pixel coordinates, we deal with only pixel + * coordinates from here on. + */ + get_pixel_mapping (w, mp, &new_mp, 1); + load_mapping (&new_mp, &mapping, &rop, + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + update_mapping (w, n_mp = &new_mp); + update_mapping (w, o_mp = &pix_mp); + + /* + * We are editing an existing mapping. Determine what has changed in + * the mapping and refresh the changed regions. + */ + + /* Get old XY scaling maps. + */ + o_xmap = o_mp->x_srcpix; + o_ymap = o_mp->y_srcpix; + + if ((o_dnx = o_mp->dnx) < 0) { + o_dnx = -o_dnx; + o_xflip = 1; + } + if ((o_dny = o_mp->dny) < 0) { + o_dny = -o_dny; + o_yflip = 1; + } + + /* Get new XY scaling maps. + */ + n_xmap = n_mp->x_srcpix; + n_ymap = n_mp->y_srcpix; + + if (dnx < 0) { + dnx = -dnx; + n_xflip = 1; + } + if (dny < 0) { + dny = -dny; + n_yflip = 1; + } + + /* Refresh the entire region if the refresh flag is set, a flip has + * occurred, or we are doing a complex dezoom mapping. + */ + refresh = (o_mp->refresh || (rop & R_RefreshAll)); + if (n_xflip != o_xflip || n_yflip != o_yflip) + refresh = 1; + if (n_mp->scaling == M_DEZOOM) + refresh = 1; + + /* Has the spatial scale changed? */ + scale_changed = + abs (o_mp->xscale - n_mp->xscale) > 1.0E-4 || + abs (o_mp->yscale - n_mp->yscale) > 1.0E-4; + + /* If any of the above conditions are true refresh the entire mapping, + * otherwise compare the old and new mappings and refresh any subregions + * which have changed. + */ + if (refresh || scale_changed || n_mp->scaling == M_DEZOOM) { + refresh_destination (w, n_mp, dx, dy, dnx, dny); + + } else { + /* Compare the old and new mappings to see what needs to be + * refreshed. For speed reasons we only want to refresh the pixels + * which have been remapped. Any destination pixel in the new mapping + * which does not map to the same source pixel as in the old mapping + * must be refreshed. We examine each X and Y coordinate in the new + * destination rect and see if the source coordinate this maps to is + * the same as in the old mapping. If a given destination pixel [i,j] + * maps to the same pixel [i,j] in the source as it did in the + * previous mapping, we do not need to refresh that pixel. We examine + * the X and Y axis in turn and build up a list of regions which do or + * do not need to be refreshed. + */ + + /* Get a list of ranges {XS,XE,XV} in X. */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + dx, dnx, n_xmap, o_mp->dx, o_dnx, o_xmap); + + /* Get a list of ranges {YS,YE,YV} in Y. */ + ny = get_regions (ys,ye,yv, MAX_REGIONS, + dy, dny, n_ymap, o_mp->dy, o_dny, o_ymap); + + /* The list of ranges in X and Y together define a raster of arbitary + * sized subrectangles filling the destination rect. If the state + * value is nonzero (bit 1 set) in either X or Y, the subrectangle + * must be refreshed. The get_rects routine returns a list of the + * rectangular subregions matching the given condition (bit 1 set in + * either axis). Adjacent rectangles are merged to minimize the + * number of calls to refresh_destination. + */ + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 1,1); + for (i=0; i < nrect; i++) + refresh_destination (w, n_mp, + rl[i].x, rl[i].y, rl[i].width, rl[i].height); + } + + /* Refresh any lower level mappings exposed when the current mapping was + * modified. These will be regions of the old rect not present in the + * new, modified rect for the current mapping. + */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + o_mp->dx, o_dnx, o_xmap, dx, dnx, n_xmap); + ny = get_regions (ys,ye,yv, MAX_REGIONS, + o_mp->dy, o_dny, o_ymap, dy, dny, n_ymap); + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 2,2); + + for (i=0; i < nrect; i++) { + XRectangle r, in; + Mapping mp; + + /* Clear the uncovered region. */ + GtSetPixels (w, dst, GtPixel, rl[i].x, rl[i].y, rl[i].width, + rl[i].height, GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (mp = w->gterm.mp_head; mp && mp->mapping != mapping; + mp = mp->next) { + + if (mp->enabled && mp->dst == dst) { + r.x = mp->dx; + r.y = mp->dy; + r.width = mp->dnx; + r.height = mp->dny; + + if (rect_intersect (&in, &r, &rl[i])) + refresh_destination (w, mp, + in.x, in.y, in.width, in.height); + } + } + } + + free_mapping (w, n_mp); + free_mapping (w, o_mp); + mp = &w->gterm.mappings[mapping]; + mp->refresh = 0; +} + + +/* GtGetMapping -- Return the external parameters of a mapping. If the + * numberd mapping is undefined -1 is returned; 0 is returned if the + * mapping is defined but not enabled, and 1 is returned if the mapping + * is active. + */ +GtGetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int *rop; /* rasterop */ + int *src; /* 0=window, >0 = raster number */ + int *st; /* coordinate type for source raster */ + int *sx,*sy,*snx,*sny; /* source raster */ + int *dst; /* 0=window, >0 = raster number */ + int *dt; /* coordinate type for source raster */ + int *dx,*dy,*dnx,*dny; /* destination raster */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (-1); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (-1); + + *rop = mp->rop; + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *snx = mp->snx; *sny = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dnx = mp->dnx; *dny = mp->dny; + + return (mp->enabled != 0); +} + + +/* GtActiveMapping -- Query whether a mapping is active. + */ +GtActiveMapping (w, mapping) + register GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (0); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (0); + + return (mp->enabled != 0); +} + + +/* GtEnableMapping -- Enable a mapping. Enabling a mapping does not + * update the destination unless the refresh flag is set. Enabling a + * mapping activates the mapping so that any changes to the source will + * be mapped to the destination. + */ +GtEnableMapping (w, mapping, refresh) + GtermWidget w; + int mapping; /* mapping number */ + int refresh; /* refresh destination */ +{ + register Mapping mp; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (!mp->enabled) { + mp->enabled = True; + if (refresh) + GtRefreshMapping (w, mapping); + } + return (OK); + } + } + return (ERR); +} + + +/* GtDisableMapping -- Disable a mapping. Disabling a mapping does not + * affect the mapping definition, hence a disabled mapping may later be + * reenabled. If the ERASE flag is set the destination region is redrawn + * with the mapping disabled. + */ +GtDisableMapping (w, mapping, erase) + GtermWidget w; + int mapping; /* mapping number */ + int erase; /* erase the destination */ +{ + register int i; + register Mapping mp, dmp; + XRectangle r, d, in; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->enabled) { + mp->enabled = False; + + if (erase) { + d.x = mp->dx; + d.y = mp->dy; + d.width = abs(mp->dnx); + d.height = abs(mp->dny); + + /* Clear the uncovered region. */ + GtSetPixels (w, mp->dst, GtPixel, + d.x, d.y, d.width, d.height, + GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (dmp = w->gterm.mp_head; + dmp && dmp->mapping != mapping; dmp = dmp->next) { + + if (dmp->enabled && dmp->dst == mp->dst) { + r.x = dmp->dx; + r.y = dmp->dy; + r.width = dmp->dnx; + r.height = dmp->dny; + + if (rect_intersect (&in, &r, &d)) + refresh_destination (w, dmp, + in.x, in.y, in.width, in.height); + } + } + } + } + return (OK); + } + } + + return (ERR); +} + + +/* GtRefreshMapping -- Refresh the destination region defined by a mapping. + */ +GtRefreshMapping (w, mapping) + GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + struct mapping p_mp; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->st != GtPixel || mp->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 1); + update_mapping (w, mp = &p_mp); + } else + update_mapping (w, mp); + refresh_destination (w, mp, + mp->dx, mp->dy, abs(mp->dnx), abs(mp->dny)); + if (mp == &p_mp) + free_mapping (w, mp); + } + } +} + + +/* GtMapVector -- Map a point vector from the coordinate system of one raster + * to another as defined by the given mapping. The mapping may be either in + * the forward direction (dir = GtMap) or the reverse (dir = GtUnmap). The + * point vector is maintained in floating point for this operation to avoid + * loss of precision. The input and output vectors may be the same vector. + */ +GtMapVector (w, mapping, dir, pv1, pv2, npts) + GtermWidget w; + int mapping; + int dir; /* GtMap, GtUnmap */ + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register DPoint *ip = pv1; + register DPoint *op = pv2; + register Mapping mp; + register int n; + + struct mapping p_mp; + double xscale, xoffset; + double yscale, yoffset; + int sx, sy; + + xscale = yscale = 1.0; + xoffset = yoffset = 0.0; + sx = sy = 0; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (valid_mapping (w, mp)) { + /* Determine the transformation coefficients. */ + get_pixel_mapping (w, mp, &p_mp, 0); + mp = &p_mp; + + xscale = (float)mp->dnx / (float)mp->snx; + if (xscale < 0) + xoffset = mp->dx + abs(mp->dnx) - 1; + else + xoffset = mp->dx; + + yscale = (float)mp->dny / (float)mp->sny; + if (yscale < 0) + yoffset = mp->dy + abs(mp->dny) - 1; + else + yoffset = mp->dy; + + sx = mp->sx; + sy = mp->sy; + } + } + + /* Map the vector. */ + if (dir == GtMap) { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - sx) * xscale + xoffset; + op->y = (ip->y - sy) * yscale + yoffset; + } + } else { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - xoffset) / xscale + sx; + op->y = (ip->y - yoffset) / yscale + sy; + } + } +} + + +/* GtPixelToNDC -- Transform a vector from pixel to NDC coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtPixelToNDC (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ( ip->x) / rp->width * MAXNDC; + op->y = (rp->height - ip->y) / rp->height * MAXNDC; + } +} + + +/* GtNDCToPixel -- Transform a vector from NDC to pixel coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtNDCToPixel (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x / MAXNDC * rp->width; + op->y = rp->height - (ip->y / MAXNDC * rp->height); + } +} + + +/* GtDebug -- Print debug info. If the file descriptor is NULL output is + * to the process stdout. The "what" argument may be used to select the + * type of output desired. If what=0 the full output is generated, + * otherwise bits are used to select what output is to be generated. + * + * "what" bitflags: + * + * 001 Widget information + * 002 List rasters + * 004 List mappings + * 010 List colormaps + * 020 List markers + * + * This routine is intended only for use during debugging. + */ +GtDebug (w, fp, what) + GtermWidget w; + FILE *fp; + int what; +{ + /* Default is to write everything to the stdout. */ + what = what ? what : 0777; + fp = fp ? fp : stdout; + + /* Print widget header. */ + if (what & 001) { + fprintf (fp, "Widget 0x%x (%s) %dx%d raster=%d\n", + w, w->core.name, w->core.width, w->core.height, w->gterm.raster); + fprintf (fp, + "--------------------------------------------------------------\n"); + } + + /* Print raster information. */ + if (what & 002) { + register int i; + register Raster rp; + + if (w->gterm.rasters) { + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) + continue; + fprintf (fp, "raster %4d type=%s delete=%d size=%dx%d\n", + i, rp->type == ImageRaster ? "client" : "server", + rp->delete, rp->width, rp->height); + } + } else + fprintf (fp, "no rasters\n"); + } + + /* Print mapping information. */ + if (what & 004) { + register int i; + register Mapping mp; + char flags[32]; + + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + continue; + + flags[0] = mp->enabled ? 'E' : 'D'; + flags[1] = mp->updated ? 'U' : ' '; + flags[2] = mp->refresh ? 'R' : ' '; + flags[3] = '\0'; + + fprintf (fp, "mapping %3d %s %8o", i, flags, mp->rop); + fprintf (fp, " %2d %s %3d %3d %3d %3d", + mp->src, mp->st == GtPixel ? "pix" : "ndc", + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (fp, " %2d %s %3d %3d %3d %3d\n", + mp->dst, mp->dt == GtPixel ? "pix" : "ndc", + mp->dx, mp->dy, mp->dnx, mp->dny); + } + } else + fprintf (fp, "no mappings\n"); + + fprintf (fp, "mappings from head: "); + for (mp = w->gterm.mp_head; mp; mp = mp->next) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + + fprintf (fp, "mappings from tail: "); + for (mp = w->gterm.mp_tail; mp; mp = mp->prev) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + } + + /* Print colormap information. */ + if (what & 010) { + register struct colormap *cm; + + fprintf (fp, "cmapName=%s ncolors=%d basePixel=%d\n", + w->gterm.cmapName, w->gterm.ncolors, w->gterm.base_pixel); + for (cm = w->gterm.colormaps; cm; cm = cm->next) + fprintf (fp, "colormap %2d ncells=%d\n", cm->map, cm->ncells); + } + + /* Print marker information. */ + if (what & 020) { + register Marker mm; + char value[256]; + + for (mm = w->gterm.gm_head; mm; mm = mm->next) { + GmGetAttribute (mm, GmType, (XtArgVal)value, XtRString); + fprintf (fp, "marker 0x%x: %10s flags=0x%x [%d %d %d %d] %0.5g\n", + mm, value, mm->flags, mm->x, mm->y, mm->width, mm->height, + mm->rotangle); + } + } +} + + +/* + * Internal procedures for the above code. + * ---------------------------------------- + */ + +/* get_colormap -- Get a private colormap. On all calls after the first + * this just returns the existing gterm widget colormap. On the first call + * we query the server for the named custom colormap, and if the colormap + * exists we modify the gterm widget to use it. If the custom colormap has + * not yet been created by some other client, we create it. + * + * This code creates a custom colormap using the "standard colormap" + * facilities provided by XLIB. Although we do not use any of the predefined + * standard colormaps, use of the standard colormap facilities allows any + * number of clients to share the same custom colormap. Use of a custom + * colormap helps avoid running out of space in the default colormap, ensures + * that the gterm widget will get the color cells it needs, and makes it + * easier for several imaging clients which share the same colormap to + * simultaneously display their windows. + * + * To minimize colormap flashing we try to avoid using the full colormap, + * setting the unused cells to the colors set in the default colormap. In + * most cases this will prevent the rest of the screen from changing color + * when the custom colormap is installed. + */ +static Colormap +get_colormap (w) + GtermWidget w; +{ + register int i, j; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + XColor def_colors[SZ_STATIC_CMAP], *cp, *c1, *c2; + XStandardColormap cm, *cm_p; + XColor colors[MAX_SZCMAP]; + int base_pixel, p1, p2; + Colormap colormap; + char property[128]; + int ncmap, nitems; + Pixel pixel; + Atom atom; + + if (w->gterm.haveColormap) + return (w->core.colormap); + + /* Map custom colormap name to atom. */ + sprintf (property, "GT_%s", w->gterm.cmapName); + atom = XInternAtom (display, property, False); + w->gterm.cmapAtom = atom; + + /* Get custom colormap. + */ + if (!w->gterm.cmapInitialize && + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom)) { + + /* Colormap aleady exists, just use it. + */ + cm = *cm_p; + colormap = cm.colormap; + w->gterm.base_pixel = cm.base_pixel; + + } else { + /* Create or reinitialize a global colormap. + */ + XVisualInfo template, *vi; + Display *d; + Screen *s; + Window root; + long mask; + + if (!(d = XOpenDisplay (DisplayString(display)))) + goto use_default; + s = DefaultScreenOfDisplay (d); + root = DefaultRootWindow (d); + + /* Try to get a pseudocolor visual. */ + mask = 0; + template.screen = DefaultScreen(d); mask |= VisualScreenMask; + template.depth = RasterDepth; mask |= VisualDepthMask; + template.class = PseudoColor; mask |= VisualClassMask; + + if (!(vi = XGetVisualInfo (d, mask, &template, &nitems))) { + XCloseDisplay (d); + goto use_default; + } + + /* Create custom colormap with all cells allocated read/write */ + colormap = XCreateColormap (d, root, vi->visual, AllocAll); + + /* Initialize colormap to be same as default colormap. */ + nitems = min (MAX_SZCMAP, CellsOfScreen(s)); + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (d, DefaultColormapOfScreen(s), colors, nitems); + XStoreColors (d, colormap, colors, nitems); + + /* Globally define permanent server custom colormap. */ + memset ((char *)&cm, 0, sizeof(cm)); + cm.colormap = colormap; + cm.base_pixel = w->gterm.base_pixel; + cm.red_max = 0; + cm.visualid = vi->visualid; + cm.killid = 1; + XSetRGBColormaps (d, root, &cm, 1, atom); + + XSetCloseDownMode (d, RetainPermanent); + XCloseDisplay (d); + w->gterm.cmapInitialize = False; + } + + /* Save default color assignments for static colors. */ + for (i=0; i < SZ_STATIC_CMAP; i++) + def_colors[i] = w->gterm.color[i]; + + nitems = min (MAX_SZCMAP, CellsOfScreen(screen)); + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + base_pixel = w->gterm.base_pixel; + + /* Get the private colormap. */ + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (display, colormap, colors, nitems); + + /* Initialize the raster pixel to display pixel mapping and set the + * color assigned to each pixel value in the private colormap. + */ + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, base_pixel + i - SZ_STATIC_CMAP); + w->gterm.color[i] = colors[pixel]; + } + + /* Check the static part of the cmap to make sure that the pixel numbers + * aren't aliased to pixels in the dynamic part of the custom colormap. + * If this happens, reassign these color numbers to the pixels just + * preceeding the dynamic part of the custom colormap. The red_max + * field of the colormap descriptor is used to keep track of the number + * of static colors allocated by different clients. These static colors + * are shared, hence the same color will not be stored twice. + */ + p1 = p2 = base_pixel - cm.red_max; + for (i=0; i < SZ_STATIC_CMAP; i++) { + pixel = w->gterm.cmap[i]; + if (pixel >= base_pixel && pixel < base_pixel+DEF_MAXCOLORS && p1 > 2) { + /* First check to see if we already have a static entry reserved + * for this color. + */ + c1 = &def_colors[i]; + for (j=p1, cp=NULL; j < base_pixel; j++) { + c2 = &colors[j]; + if (c1->red == c2->red && c1->green == c2->green && + c1->blue == c2->blue) { + cp = c2; + break; + } + } + + /* Assign a new screen pixel value. */ + if (cp) + w->gterm.cmap[i] = cp->pixel; + else { + cp = &colors[--p1]; + *cp = def_colors[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = w->gterm.cmap[i] = p1; + cm.red_max++; + } + w->gterm.color[i].pixel = w->gterm.cmap[i]; + } + } + if (p1 < p2) { + XStoreColors (display, colormap, &colors[p1], p2 - p1); + XSetRGBColormaps (display, w->gterm.root, &cm, 1, atom); + } + + /* Assign the new colormap to the gterm widget's window. */ + XtVaSetValues ((Widget)w, XtNcolormap, (XtArgVal)colormap, NULL); + w->gterm.haveColormap++; + + /* If the pointer is in the window, advise window manager to load the + * colortable for the window. + */ + if (w->gterm.in_window) + request_colormap_focus (w); + + return (colormap); + +use_default: + /* Unable to create custom colormap. */ + w->gterm.useDefaultCM++; + w->gterm.haveColormap++; + return (w->core.colormap); +} + + +/* request_colormap_focus -- Modify the WM_COLORMAP_WINDOWS property on a + * widget's top level shell window to advise the window manager that the + * widget's window should have its colormap loaded. This should only be + * used for windows that have a colormap different than that of the top + * level window. + */ +static +request_colormap_focus (w) + GtermWidget w; +{ + Widget p; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Find the top level window. */ + for (p = XtParent(w); !XtIsShell(p); p = XtParent(p)) + ; + + /* Modify WM_COLORMAP_WINDOWS to give the current window priority. + */ + if (p) { + Window window = XtWindow (p); + Window *wl = NULL, n_wl[MAX_WMWIN+1]; + register int n_nw, i; + int nw; + + /* If WM_COLORMAP_WINDOWS is already set save its value, otherwise + * start a list initially containing only the top level window. + */ + w->gterm.wmTop = window; + if (XGetWMColormapWindows (w->gterm.display, window, &wl, &nw)) { + memmove (w->gterm.wmWindows, (char *)wl, nw * sizeof(int)); + w->gterm.n_wmWindows = nw = min (nw, MAX_WMWIN); + free ((char *)wl); + } else { + w->gterm.wmWindows[0] = window; + w->gterm.n_wmWindows = nw = 1; + } + + n_nw = 0; + wl = w->gterm.wmWindows; + n_wl[n_nw++] = XtWindow(w); + + for (i=0; i < nw; i++) + if (wl[i] != XtWindow(w)) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, window, n_wl, n_nw); + } +} + + +/* restore_colormap_focus -- Reset WM_COLORMAP_WINDOWS. Retain the window + * that had the focus in the list, but drop its priority one notch. This + * should follow a prior call to request_colormap_focus. + */ +static +restore_colormap_focus (w) + GtermWidget w; +{ + register int nw, n_nw, i; + Window *wl, n_wl[MAX_WMWIN+1], old; + + if (!XtIsRealized ((Widget)w)) + return; + + old = XtWindow(w); + wl = w->gterm.wmWindows; + if ((nw = w->gterm.n_wmWindows) == 0 || (nw == 1 && wl[0] == old)) + return; + + n_nw = 0; + if (wl[0] != old) + n_wl[n_nw++] = wl[0]; + n_wl[n_nw++] = old; + + for (i=1; i < nw; i++) + if (wl[i] != old) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, w->gterm.wmTop, n_wl, n_nw); +} + + +/* inherit_default_colormap -- Set any unused cells of the custom colormap + * to the colors defined for the corresponding cells of the default colormap. + * This minimizes colormap flashing when using a custom colormap, but only + * works if a few unused cells can be reserved, e.g., at the beginning of + * the colormap (which is usually where X allocates its colors). + */ +static +inherit_default_colormap (w) + GtermWidget w; +{ + register XColor *cp, *ap; + register int ncolors, i; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + Window root = w->gterm.root; + Atom atom = w->gterm.cmapAtom; + XColor colors[MAX_SZCMAP]; + XStandardColormap *cm; + int first, nitems, ncmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.base_pixel <= 0) + return; /* fully allocated colormap */ + + /* We have to read the colormap property again as another client could + * have reserved more static colors (i.e.,changed red_max), and we don't + * want to clobber these colors. + */ + if (XGetRGBColormaps (display, root, &cm, &ncmap, atom)) { + /* Make sure we have the right colormap. */ + if (w->core.colormap != cm->colormap) + XtVaSetValues ((Widget)w,XtNcolormap,(XtArgVal)cm->colormap,NULL); + + /* Get lower part of default colormap. */ + ncolors = cm->base_pixel - cm->red_max; + for (cp=colors, i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = i; + } + + /* Get upper part of default colormap. */ + first = cm->base_pixel + w->gterm.ncolors - SZ_STATIC_CMAP; + ncolors = min (MAX_SZCMAP, CellsOfScreen(screen)) - first; + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = first + i; + } + + /* Inherit values from default colormap. */ + ncolors = cp - colors; + XQueryColors (display, DefaultColormapOfScreen(screen), + colors, ncolors); + XStoreColors (display, w->core.colormap, colors, ncolors); + + /* The global gterm colormap may have changed. Compare widget's + * version of color table with the global colortable and update + * the widget's state if the global colortable has changed. + */ + ncolors = w->gterm.ncolors; + memmove (colors, w->gterm.color, ncolors * sizeof(*cp)); + XQueryColors (display, w->core.colormap, colors, ncolors); + for (i=ncolors, cp=colors, ap=w->gterm.color; --i >= 0; cp++, ap++) + if (cp->red != ap->red || cp->green != ap->green || + cp->blue != ap->blue) { + memmove (w->gterm.color, colors, ncolors * sizeof(*cp)); + invalidate_cmap (w); + } + } +} + + +/* update_default_colormap -- Update the default colormap so that any + * unallocated cells mirror the widget's custom colormap. This increases + * the chance that the widget's contents will be visible when the window + * does not have the colormap focus, and minimizes flashing when the + * colormap focus changes. + */ +static +update_default_colormap (w) + GtermWidget w; +{ + register XColor *ip, *op; + register int j, n; + register Pixel v; + + XColor colors[MAX_SZCMAP]; + Pixel pixels[MAX_SZCMAP]; + char allocated[MAX_SZCMAP]; + int overflow, req, need, first, nelem, i; + unsigned long plane_masks[1]; + Colormap defcmap; + + if (!XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + + first = SZ_STATIC_CMAP; + nelem = w->gterm.ncolors; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + /* need = min (MAX_SZCMAP, first + nelem - SZ_STATIC_CMAP); */ + need = MAX_SZCMAP; + + /* Get the colormap cells. */ + for (req=need, n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, defcmap, False, + plane_masks, 0, &pixels[n], req)) { + n += req; + } else + req /= 2; + + /* Perform the color matching. This is awkward as the pixel value + * assignments may be different in the two colormaps. We have to look + * up each pixel before attempting to assign a color, or XStoreColors + * below will result in a server error. + */ + memset (allocated, 0, sizeof(allocated)); + overflow = 0; + + for (i=0; i < n; i++) { + v = pixels[i]; + if (v < MAX_SZCMAP) + allocated[v] = 1; + else { + overflow++; + break; + } + } + + ip = &w->gterm.color[first]; + op = colors; + if (overflow) { + for (i=0; i < nelem; i++, ip++) + for (j=0, v = ip->pixel; j < n; j++) + if (pixels[j] == v) { + *op++ = *ip; + break; + } + } else { + for (j=0; j < nelem; j++, ip++) + if (allocated[ip->pixel]) { + allocated[ip->pixel] = 0; + *op++ = *ip; + } + } + + if (op > colors) + XStoreColors (w->gterm.display, defcmap, + colors, op - colors); + + XFreeColors (w->gterm.display, defcmap, pixels, n, 0); +} + + +/* refresh_source -- Refresh a portion of a mapping given the source rect + * to be refreshed. If the given source rect is not within the mapping, + * this is a no-op. + */ +static +refresh_source (w, mp, x1, y1, nx, ny) + GtermWidget w; + register Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of source to be refreshed */ +{ + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Compute the intersection of the modified region of the source raster + * with the rectangular region of the source raster affected by the given + * mapping. + */ + sx1 = max (x1, mp->sx); + sy1 = max (y1, mp->sy); + sx2 = min(x1 + nx, mp->sx + mp->snx) - 1; + sy2 = min(y1 + ny, mp->sy + mp->sny) - 1; + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + /* Do nothing if the rectangles do not intersect. */ + if (snx <= 0 || sny <= 0) + return (OK); + + /* Compute the destination rect affected by the mapped source rect. + */ + dx1 = mp->x_extent[sx1 - mp->sx].lo; + dx2 = mp->x_extent[sx2 - mp->sx].hi; + if (dx1 > dx2) { + dx1 = mp->x_extent[sx2 - mp->sx].lo; + dx2 = mp->x_extent[sx1 - mp->sx].hi; + } + + dy1 = mp->y_extent[sy1 - mp->sy].lo; + dy2 = mp->y_extent[sy2 - mp->sy].hi; + if (dy1 > dy2) { + dy1 = mp->y_extent[sy2 - mp->sy].lo; + dy2 = mp->y_extent[sy1 - mp->sy].hi; + } + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + /* Perform the refresh operation. */ + return (refresh_destination (w, mp, dx1, dy1, dnx, dny)); +} + + +/* refresh_destination -- Refresh (redraw) the pixels in the given destination + * rect. The mapping operand defines how to generate the value of each output + * pixel. This is the routine which does all the real work of a mapping, + * computing the values of the output pixels and writing to the destination + * drawable. Note: the destination rect must be specified in raster pixel + * coordinates (no NDC). + */ +static +refresh_destination (w, mp, x1, y1, nx, ny) + GtermWidget w; + Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of destination to be refreshed */ +{ + Raster sr, dr; + Display *display = w->gterm.display; + int scaling, xflip, yflip, delxin=0, delxout=0; + int ox, oy, rop, clip, mapping, i, j; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int xoff, yoff, p1, p2, q1, q2; + float xscale, yscale; + struct mapping *np, p_mp; + XImage *xin, *xout; + int status = OK; + + Region clip_region, mask_region; + uchar *old_xin_lp, *old_xout_lp; + uchar *xin_lp, *xout_lp, *op; + int xin_bpl, xout_bpl; + int *xmap, *ymap; + XRectangle r; + + if (!XtIsRealized ((Widget)w)) + return (OK); + + /* Do nothing if mapping not defined and enabled. */ + if (!valid_mapping (w, mp)) + return (ERR); + if (!mp->enabled) + return (OK); + + /* Offsets into the x_*,y_* mapping lookup tables. */ + xoff = x1 - mp->dx; + yoff = y1 - mp->dy; + + /* Get source and destination rects. */ + dst = mp->dst; + dx = x1; dy = y1; + dnx = nx; dny = ny; + + src = mp->src; + p1 = mp->x_srcpix[xoff]; + q1 = mp->y_srcpix[yoff]; + p2 = mp->x_srcpix[xoff + nx - 1]; + q2 = mp->y_srcpix[yoff + ny - 1]; + sx = min (p1, p2); + sy = min (q1, q2); + snx = abs (p2 - p1) + 1; + sny = abs (q2 - q1) + 1; + + /* Define some local variables. */ + sr = &w->gterm.rasters[src]; + dr = &w->gterm.rasters[dst]; + mapping = mp->mapping; + scaling = mp->scaling; + xscale = mp->xscale; + yscale = mp->yscale; + rop = mp->rop; + + if (!sr->type || !dr->type) + return (ERR); + if (snx <= 0 || sny <= 0 || dnx == 0 || dny == 0) + return (ERR); + if (src < 0 || src > w->gterm.maxRasters || + dst < 0 || dst > w->gterm.maxRasters) + return (ERR); + + /* Do we have a flip in X or Y? */ + xflip = mp->dnx < 0; + yflip = mp->dny < 0; + + /* Any higher numbered mappings which map to the same destination as the + * mapping MP will obscure the current mapping. Construct a clip mask + * defining the region of the destination we can write to. This will be + * the region not obscured by any higher numbered, active mappings. + */ + clip = False; + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; +#ifdef sun + /* As far as I can tell the Sun (probably in the OW X server) has an + * off by one bug affecting clipping in the server. A clip region is + * too small by one pixel at the right and bottom, causing these pixels + * to not be written when refreshing the screen (usually this shows up + * as black lines on the screen when a region is refreshed). So far + * I haven't seen this on any other platform. The problem is imperfectly + * understood and the following workaround may not completely workaround + * the problem. + */ + r.width++; r.height++; +#endif + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + + if (XRectInRegion (clip_region, + r.x, r.y, r.width, r.height) != RectangleOut) { + + mask_region = XCreateRegion(); + XUnionRectWithRegion (&r, mask_region, mask_region); + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + clip++; + } + } + + if (clip && dr->type == PixmapRaster) + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + + /* Handle the special case of a pixmap to pixmap (or window) copy in + * the server with no scaling. + */ + if (!scaling && sr->type == PixmapRaster && dr->type == PixmapRaster) { + if (src == 0 && dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XCopyArea (display, w->gterm.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XCopyArea (display, sr->r.pixmap, dr->r.pixmap, w->gterm.exposeGC, + sx, sy, snx, sny, dx, dy); + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) + XCopyArea (display, sr->r.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + } + goto done; + } + + /* Any other case requires working on ximages in the client. The first + * step is to get the source ximage. + */ + if (sr->type == PixmapRaster) { + /* Source is a pixmap but we need a local copy as either the + * destination is not a pixmap, or we need to do some scaling. + */ + xin = XGetImage (display, + (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } + delxin++; + + } else { + /* Source is an ximage. */ + xin = sr->r.ximage; + } + + /* Handle the special case of a copy of an ximage to an output pixmap + * with no scaling. + */ + if (!scaling && dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xin, + sx, sy, dx, dy, dnx, dny); + } + goto done; + } + + /* Get output ximage. */ + if (dr->type == ImageRaster) { + xout = dr->r.ximage; + ox = dx; oy = dy; + } else { + uchar *data = (uchar *) XtMalloc (dnx * dny); + if (data == NULL) { + status = ERR; + goto done; + } + xout = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, dnx, dny, 8, 0); + if (xout == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + ox = 0; oy = 0; + delxout++; + } + + xin_lp = (uchar *)xin->data; + xout_lp = (uchar *)xout->data; + xin_bpl = xin->bytes_per_line; + xout_bpl = xout->bytes_per_line; + + /* Map a region of the input ximage XIN to the output ximage XOUT. Various + * approaches are used to generate the output data, depending upon what + * type of scaling we are doing. + */ + if (!scaling) { + /* No scaling. Copy a region of the ximage xin to xout without + * spatially scaling the image data. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + xin_lp = (uchar *)xin->data + sy * xin_bpl; + xout_lp = (uchar *)xout->data + oy * xout_bpl + ox; + + for (j=0; j < dny; j++) { + memmove (xout_lp, xin_lp, dnx); + xin_lp += xin_bpl; + xout_lp += xout_bpl; + } + + } else if (scaling == M_INTZOOM) { + /* Integer zoom. The zoom factor is an integer, allowing the zoomed + * image to be calculated without using the xmap,ymap lookup tables. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + scale_intzoom (xin_lp,xin_bpl, xout_lp,xout_bpl, sx,sy, ox,oy,dnx,dny, + xflip,yflip, (int)(xscale + 0.5), (int)(yscale + 0.5)); + + } else if (scaling == M_ZOOM) { + /* We have a zoom, or one-to-many, scaling. Zoom scaling is always + * done with pixel replication. The [xy]_srcpix arrays in the mapping + * descriptor give the source pixel corresponding to each mapped pixel + * in the destination raster. + */ +zoom: + xmap = &mp->x_srcpix[xoff]; + ymap = &mp->y_srcpix[yoff]; + + scale_zoom (xin_lp, xin_bpl, xout_lp, xout_bpl, + xmap, ymap, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL); + + } else if (scaling == M_DEZOOM) { + /* We have a dezoom, or many-to-one, scaling. A block of pixels in + * the input raster are combined to generate the value of each output + * pixel, using one of several antialias algorithms to compute the + * output pixel value. + */ + float *x_src = &mp->x_src[xoff]; + float *y_src = &mp->y_src[yoff]; + int near_unitary = (xscale > 0.5 && yscale > 0.5); + int function; + + /* Get the antialising function to be applied. */ + if (!(function = (mp->rop & R_MFMask))) + function = MF_NEAREST; + + /* If the dezoom factor is small and either MF_BILINEAR or + * MF_NEAREST is enabled, use the indicated method to sample the + * input data. This uses all the data but minimizes smoothing. + */ + if ((function & (MF_BILINEAR|MF_NEAREST)) && near_unitary) + function = (function & MF_BILINEAR) ? MF_BILINEAR : MF_NEAREST; + else if (function != (function & (MF_BILINEAR|MF_NEAREST))) + function &= ~(MF_BILINEAR|MF_NEAREST); + +filter: + /* This can take a while so update the display. */ + XFlush (w->gterm.display); + + /* If the filtering operation involves any arithmetic combinations + * of pixels we must convert pixel numbers to pixel intensity values + * before performing the filtering operation. This is a case where + * we would be better off if frame buffers were maintained using + * pixel intensities rather than hardware pixel numbers. + */ + if (function != MF_NEAREST) { + uchar *data = (uchar *) XtMalloc (xin->width * xin->height); + if (data == NULL) { + status = ERR; + goto done; + } + + mf_getinten (w, + xin_lp, xin->width, xin->height, xin_bpl, sx,sy, + data, xin->width, xin->height, xin_bpl, sx,sy, snx,sny); + + if (!delxin) { + xin = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, xin->width, xin->height, 8, 0); + if (xin == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + delxin++; + } else { + XtFree ((char *)xin->data); + xin->data = (char *) data; + } + xin_lp = (uchar *)xin->data; + } + + /* Filter the source rect to the destination. */ + switch (function) { + case MF_NEAREST: + scale_nearest ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BILINEAR: + scale_bilinear ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BLKAVG: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 0, clip ? clip_region : (Region)NULL + ); + break; + case MF_BOXCAR: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 1, clip ? clip_region : (Region)NULL + ); + break; + case MF_LOWPASS: + scale_lowpass ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, clip ? clip_region : (Region)NULL + ); + break; + default: + function = MF_BILINEAR; + goto filter; + } + + /* If the operation was performed in intensity space convert back + * to pixel number. + */ + if (function != MF_NEAREST) + mf_getpixel (w, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, dnx,dny); + + } else { + status = ERR; + goto done; + } + + /* Copy the scaled ximage to the output pixmap, if any. + */ + if (dr->type == PixmapRaster) { + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + XCopyArea (display, w->gterm.pixmap, dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + } else { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + } + } + +done: + /* Clean up. + */ + if (delxin) + XDestroyImage (xin); + if (delxout) + XDestroyImage (xout); + + XDestroyRegion (clip_region); + if (clip && dr->type == PixmapRaster) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + + /* Execute any mappings defined on the raster just updated. */ + if (status == OK) { + GtRefreshPixels (w, dst, GtPixel, dx, dy, dnx, dny); + + if (dst == 0) { + Region clip_region = (Region)NULL; + XRectangle r; + + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; + XUnionRectWithRegion (&r, clip_region, clip_region); + + update_transients (w, clip_region); + XDestroyRegion (clip_region); + } + } + + return (status); +} + + +/* scale_zoom -- Compute the given destination rect from the input image, + * using pixel replication and the given x and y dst->scr pixels maps. + */ +static +scale_zoom (idata,ibpl, odata,obpl, xmap,ymap, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + register int *xmap; /* src coords of each dst pixel */ + int *ymap; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i, j; + register uchar *ip, *op; + uchar *last_ip = NULL; + uchar *last_op = NULL; + + for (j=0; j < dny; j++) { + ip = idata + ymap[j] * ibpl; + op = odata + (j+dy) * obpl + dx; + + if (!clip_region) { + if (ip == last_ip) + memmove (op, last_op, dnx); + else { + for (i=0; i < dnx; i++) + op[i] = ip[xmap[i]]; + } + last_ip = ip; + last_op = op; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = ip[xmap[i]]; + } + } +} + + +/* scale_intzoom -- Compute the given destination rect from the input image, + * using pixel replication and integer scaling. This is functionally + * equivalent to scale_zoom using the lookup tables, but optimized for the + * case of integer scaling. + */ +static +scale_intzoom (idata,ibpl,odata,obpl, sx,sy,dx,dy,dnx,dny, xflip,yflip, nx,ny) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + int sx, sy; /* start coords of src rect */ + int dx, dy, dnx, dny; /* destination rect */ + int xflip, yflip; /* set if x or y is flipped */ + int nx, ny; /* replication factors */ +{ + register int n; + register int pix; + register uchar *ip, *op; + uchar *otop, *olast, *lp; + int i, j, k; + + olast = odata + (dy + dny) * obpl - dnx + dx; + + if (xflip) { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = odata + (dy + yflip ? (dny-ny-j) : j) * obpl + dx + dnx; + otop = lp = op - dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *--op = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op > otop) + *--op = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } else { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = lp = odata + (dy + yflip ? (dny-ny-j) : j) * obpl + dx; + otop = op + dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *op++ = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op < otop) + *op++ = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } +} + + +/* scale_nearest -- Compute the given destination rect from the input image, + * using the nearest neighbor technique. + */ +static +scale_nearest (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i, j; + register uchar *op; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = y_src[j]; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* scale_bilinear -- Compute the given destination rect from the input image, + * using bilinear interpolation. + */ +static +scale_bilinear (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = x_src[i] - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = y_src[j] - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* scale_lowpass -- Apply a lowpass filter to a region of a 2D data array. + * The region ox,oy,nx,ny of the output data array is calculated by running + * a convolution kernel over the region of the input data array at ix,iy. + * The size of the convolution kernel is adjusted to match the scale factors + * xscale, yscale. + */ +static +scale_lowpass (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + Region clip_region; /* clip Region or null */ +{ + uchar *data; + + if ((data = (uchar *) XtMalloc (inx * iny)) == NULL) + return; + + /* Run a lowpass filter over the input rect. */ + lw_convolve (idata,inx,iny,ibpl, sx,sy, data,inx,iny,ibpl, sx,sy, + snx,sny, xscale,yscale); + + /* Sample the filtered data to generate the output rect. */ + scale_nearest (data,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + dx,dy,dnx,dny, clip_region); + + XtFree ((char *)data); +} + + +/* lw_convolve -- Convolution primitive for scale_lowpass. + */ +static +lw_convolve (idata,inx,iny,ibpl,ix,iy, odata,onx,ony,obpl,ox,oy, + nx, ny, xscale, yscale) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ix, iy; /* size of input array, start pos */ + int onx, ony, ox, oy; /* size of output array, start pos */ + int ibpl, obpl; /* bytes per line */ + int nx, ny; /* size of output region */ + float xscale, yscale; /* determines amount of smoothing */ +{ + register uchar *ip; + register int l, m, x, hx, pixval; + int kx, ky, hy, i, j, y; + uchar *lp[11], *op; + + /* Determine kernel size (min 3x3, max 7x7). */ + if (xscale < 0.1) + hx = 3; + else if (xscale >= 0.5) + hx = 1; + else + hx = ((int)(1.0 / xscale)) / 2; + + if (yscale < 0.1) + hy = 3; + else if (yscale >= 0.5) + hy = 1; + else + hy = ((int)(1.0 / yscale)) / 2; + + kx = hx * 2 + 1; + ky = hy * 2 + 1; + + /* Compute the output data. + */ + for (j=0; j < ny; j++) { + /* Get line pointers. */ + op = odata + (j+oy) * obpl + ox; + for (i=0; i < ky; i++) { + y = iy + j - hy + i; + if (y < 0) + y = 0; + else if (y >= iny) + y = iny - 1; + lp[i] = y * ibpl + idata; + } + + /* Compute a line of output pixels */ + for (i=0; i < nx; i++) { + x = ix + i; + pixval = 0; + + if (x < hx) { + /* Near left edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][max(0,x-hx+l)]; + } else if (x >= inx - hx) { + /* Near right edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][min(inx-1,x-hx+l)]; + } else { + /* In central region. */ + for (m=0; m < ky; m++) { + ip = lp[m] + x - hx; + for (l=0; l < kx; l++) + pixval += ip[l]; + } + } + + op[i] = (float)pixval / (float)(kx * ky) + 0.5; + } + } +} + + +/* scale_boxcar -- Apply a boxcar filter to a region of a 2D data array + * and interpolate the result to the output grid. The region ox,oy,nx,ny of + * the output data array is calculated by block averaging the corresponding + * source rect and then sampling the reduced image using bilinear interpolation + * to compute the output pixel raster. This antialiasing technique aims to + * be as fast as possible but still does a reasonable job of reducing the + * image. + */ +static +scale_boxcar (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, interp, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + int interp; /* set if interpolation is desired */ + Region clip_region; /* clip Region or null */ +{ + int xblock, yblock; + int x1, x2, y1, y2, nx, ny; + float xstep, ystep; + int xoff, yoff; + uchar *bp; + + /* Determine blocking factors. If interpolation is disabled we need + * to block one step more than for the linear interpolate case in order + * to ensure that all the data is used. + */ + xblock = max(1, (int) (1.0 / xscale)); + if (!interp && (1.0 / xscale) - xblock > ZOOM_TOL) + xblock++; + yblock = max(1, (int) (1.0 / yscale)); + if (!interp && (1.0 / yscale) - yblock > ZOOM_TOL) + yblock++; + + /* Align the input region for the given blocking factors. */ + x1 = sx / xblock * xblock; x2 = (sx + snx - 1) / xblock * xblock; + y1 = sy / yblock * yblock; y2 = (sy + sny - 1) / yblock * yblock; + nx = (x2 - x1) / xblock + 1; ny = (y2 - y1) / yblock + 1; + + /* Compute the block averaged input rect. */ + if (xblock > 1 || yblock > 1) { + if ((bp = (uchar *) XtMalloc (nx * ny)) == NULL) + return; + bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, bp, xblock, yblock); + idata = bp; + inx = ibpl = nx; + iny = ny; + xoff = x1; yoff = y1; + xstep = 1.0 / xblock; ystep = 1.0 / yblock; + } else { + bp = NULL; + xoff = yoff = 0; + xstep = ystep = 1.0; + } + + /* Interpolate the input rect to the output grid. */ + if (interp && + ((1.0 / xscale) - xblock) > ZOOM_TOL || + ((1.0 / yscale) - yblock) > ZOOM_TOL) { + + /* Use bilinear interpolation to compute the output grid. */ + bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + + } else { + /* Extract pixels from block averaged input data. */ + bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + } + + if (bp) + XtFree ((char *)bp); +} + + +/* bx_boxcar -- Block average primitive for scale_boxcar. + */ +static +bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, obuf, xblock, yblock) + uchar *idata; /* input data array */ + int inx, iny, ibpl; /* array dimensions */ + int x1,y1,x2,y2; /* region to be block averaged */ + uchar *obuf; /* output array */ + int xblock, yblock; /* blocking factors */ +{ + register uchar *ip, *op; + register int count, i, *sp; + int obpl, block, nxblocks, nyblocks, j, k; + uchar *lp, *bp; + int *sb; + + nxblocks = obpl = (x2 - x1) / xblock + 1; + nyblocks = (y2 - y1) / yblock + 1; + count = xblock * yblock; + + if ((sb = (int *) XtMalloc (obpl * sizeof(int))) == NULL) + return; + + /* I don't think the following works for pixel values allocated from the + * default colormap, as the pixel values are not sequentially allocated. + */ + for (block = 0; block < nyblocks; block++) { + lp = idata + ibpl * (block * yblock + y1) + x1; + bp = obuf + block * obpl; + + memset (sb, 0, obpl * sizeof(int)); + for (k=yblock; --k >= 0; lp += ibpl) + for (j=nxblocks, ip=lp, sp=sb; --j >= 0; sp++) + for (i=xblock; --i >= 0; ) + *sp += *ip++; + + for (i=obpl, sp=sb, op=bp; --i >= 0; ) + *op++ = *sp++ / count; + } + + XtFree ((char *)sb); +} + + +/* bx_extract -- Block extract primitive for scale_boxcar. + */ +static +bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i; + register uchar *op; + int j; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = (y_src[j] - yoff) * ystep; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* bx_interp -- Bilinear interpolation primitive for scale_boxcar. + */ +static +bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = ((x_src[i] - xoff) * xstep) - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = ((y_src[j] - yoff) * ystep) - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* mf_getinten -- Copy the source rect to the destination rect, converting + * pixel numbers to pixel intensities. + */ +static +mf_getinten (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_out (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* mf_getpixel -- Copy the source rect to the destination rect, converting + * pixel intensities to pixel numbers. + */ +static +mf_getpixel (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_in (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* get_regions -- For each pixel I in the sequence of DNX pixels starting at DX + * there is an associated value XMAP[I]. Compare this sequence to an alternate + * sequence and return a list of subregions {XS,XE,XV} for which the XMAP + * values are equal (XV=0), not equal (XV=1), or not common to (XV=2) the two + * regions. The number of regions output is returned as the function value. + */ +static +get_regions (xs,xe,xv, max_regions, dx, dnx, xmap, alt_dx, alt_dnx, alt_xmap) + int *xs, *xe, *xv, max_regions; + int dx, dnx, *xmap; + int alt_dx, alt_dnx, *alt_xmap; +{ + register int state, current; + register int nx, i; + int offset, old_i; + + offset = dx - alt_dx; + nx = 0; + + for (i=0; i < dnx; i++) { + if (nx >= max_regions-1) + return (0); + + /* Determine whether or not this pixel is mapped the same in both + * sequences. + */ + old_i = i + offset; + if (alt_dnx <= 0 || old_i < 0 || old_i >= alt_dnx) + state = 2; + else + state = (xmap[i] != alt_xmap[old_i]); + + /* When the state boundary is crossed add a range. */ + if (i == 0) { + xs[nx] = dx; + xv[nx] = current = state; + } + if (state != current) { + xe[nx] = dx + i - 1; + xs[++nx] = dx + i; + xv[nx] = current = state; + } + if (i == dnx-1) + xe[nx++] = dx + i; + } + + return (nx); +} + + +/* get_rects -- Combine two lists of regions, one in X and the other in Y, + * to produce a list of 2D rectangles defining the regions outlined by the + * region lists. Only rects for which the given condition is true in either + * X or Y are selected. Adjacent rects are combined. + */ +static +get_rects (o_rl, max_rects, xs,xe,xv,nx, ys,ye,yv,ny, xcond,ycond) + XRectangle *o_rl; /* receives list of rectangles */ + int max_rects; /* max rectangles out */ + int *xs, *xe, *xv, nx; /* X list of regions */ + int *ys, *ye, *yv, ny; /* Y list of regions */ + int xcond, ycond; /* X,Y condition bitflags */ +{ + register int i, j; + XRectangle rl[MAX_REGIONS]; + int limit = min (max_rects, MAX_REGIONS); + int o_nrects=0, nrects=0; + int i1, i2, j1, j2; + + /* Get initial list of rects matching the given X and Y conditions. + * Rects which are adjacent in X are combined to form one larger rect. + */ + for (j=0; j < ny; j++) { + for (i=0; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) { + /* Collapse rects adjacent in X. */ + for (i1 = i2 = i++; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) + i2 = i; + else + break; + } + + rl[nrects].x = xs[i1]; + rl[nrects].y = ys[j]; + rl[nrects].width = xe[i2] - xs[i1] + 1; + rl[nrects].height = ye[j] - ys[j] + 1; + + if (++nrects >= limit) + return (nrects); + } + } + } + + /* Now scan the rect list and collapse rects which are adjacent in Y + * into one larger rect. Find all the rects that are at the same X + * and write them to the output list, collapsing rects that are adjacent + * in Y in the process. + */ + for (i=0; i < nx; i++) + for (j=0; j < nrects; ) { + /* Find first rect if any. */ + for (j1=0, j2 = -1; j < nrects; j++) + if (rl[j].x == xs[i]) { + j1 = j2 = j++; + break; + } + + /* Collapse rects adjacent in Y. */ + for ( ; j < nrects; j++) + if (rl[j].x == xs[i]) + if (rl[j].y == rl[j2].y + rl[j2].height && + rl[j].width == rl[j1].width) + j2 = j; + else + break; + + /* Output the rect. */ + if (j2 >= j1) { + o_rl[o_nrects].x = rl[j1].x; + o_rl[o_nrects].y = rl[j1].y; + o_rl[o_nrects].width = rl[j1].width; + o_rl[o_nrects].height = rl[j2].y + rl[j2].height - rl[j1].y; + + if (++o_nrects >= max_rects) + return (o_nrects); + } + } + + return (o_nrects); +} + + +/* rect_intersect -- Compute the intersection of two rects. The area of + * the intersection is returned as the function value, i.e., zero is + * returned if the rects do not intersect. + */ +static +rect_intersect (in, r1, r2) + register XRectangle *in; + register XRectangle *r1, *r2; +{ + int x1, y1, x2, y2; + + x1 = max (r1->x, r2->x); + y1 = max (r1->y, r2->y); + x2 = min ((int)r1->x + (int)r1->width, (int)r2->x + (int)r2->width) - 1; + y2 = min ((int)r1->y + (int)r1->height, (int)r2->y + (int)r2->height) - 1; + + in->x = x1; + in->y = y1; + in->width = max (0, x2 - x1 + 1); + in->height = max (0, y2 - y1 + 1); + + return (in->width * in->height); +} + + +/* save_mapping -- Store a mapping in a mapping descriptor. + */ +static +save_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int mapping, rop; + int src, st, sx,sy,sw,sh; + int dst, dt, dx,dy,dw,dh; +{ + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = sw; mp->sny = sh; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dw; mp->dny = dh; + mp->defined = mp->enabled = mp->refresh = 1; + mp->mapping = mapping; + mp->rop = rop; +} + +/* load_mapping -- Load a mapping from a mapping descriptor. + */ +static +load_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int *mapping, *rop; + int *src, *st, *sx,*sy,*sw,*sh; + int *dst, *dt, *dx,*dy,*dw,*dh; +{ + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *sw = mp->snx; *sh = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dw = mp->dnx; *dh = mp->dny; + *mapping = mp->mapping; + *rop = mp->rop; +} + + +/* get_pixel_mapping -- Copy a mapping, converting to pixel coordinates in + * the process if the mapping is not already in pixel coordinates. + */ +static +get_pixel_mapping (w, mp1, mp2, update) + GtermWidget w; + register Mapping mp1; /* input mapping */ + register Mapping mp2; /* output mapping */ + int update; /* update mapping */ +{ + float maxndc = (float)MAXNDC; + + mp2->mapping = mp1->mapping; + mp2->refresh = mp1->refresh; + mp2->enabled = mp1->enabled; + mp2->rop = mp1->rop; + + if (!(mp2->defined = mp1->defined)) + return; + + mp2->src = mp1->src; + if (mp1->st == GtPixel) { + mp2->st = mp1->st; + mp2->sx = mp1->sx; mp2->sy = mp1->sy; + mp2->snx = mp1->snx; mp2->sny = mp1->sny; + } else { + float width = w->gterm.rasters[mp1->src].width; + float height = w->gterm.rasters[mp1->src].height; + mp2->sx = mp1->sx * width / maxndc; + mp2->sy = (MAXNDC - (mp1->sy + abs(mp1->sny))) * height / maxndc; + mp2->snx = mp1->snx * width / maxndc; + mp2->sny = mp1->sny * height / maxndc; /* NDC flipped in Y */ + mp2->st = GtPixel; + } + + mp2->dst = mp1->dst; + if (mp1->dt == GtPixel) { + mp2->dt = mp1->dt; + mp2->dx = mp1->dx; mp2->dy = mp1->dy; + mp2->dnx = mp1->dnx; mp2->dny = mp1->dny; + } else { + float width = w->gterm.rasters[mp1->dst].width; + float height = w->gterm.rasters[mp1->dst].height; + mp2->dx = mp1->dx * width / maxndc; + mp2->dy = (MAXNDC - (mp1->dy + abs(mp1->dny))) * height / maxndc; + mp2->dnx = mp1->dnx * width / maxndc; + mp2->dny = mp1->dny * -height / maxndc; /* NDC flipped in Y */ + mp2->dt = GtPixel; + } + + /* The lookup tables are already in pixel space, so we can propagate + * these to the new mapping if the old mapping was updated. + */ + if (update && mp1->updated) { + if (mp2->mapdata = (uchar *) XtMalloc (mp1->datalen)) { + + memmove (mp2->mapdata, mp1->mapdata, mp1->datalen); + mp2->datalen = mp1->datalen; + mp2->scaling = mp1->scaling; + mp2->xscale = mp1->xscale; + mp2->yscale = mp1->yscale; + + mp2->x_extent = (mapExtent *) + ((uchar *)mp1->x_extent - mp1->mapdata + mp2->mapdata); + mp2->y_extent = (mapExtent *) + ((uchar *)mp1->y_extent - mp1->mapdata + mp2->mapdata); + mp2->x_srcpix = (int *) + ((uchar *)mp1->x_srcpix - mp1->mapdata + mp2->mapdata); + mp2->y_srcpix = (int *) + ((uchar *)mp1->y_srcpix - mp1->mapdata + mp2->mapdata); + mp2->x_src = (float *) + ((uchar *)mp1->x_src - mp1->mapdata + mp2->mapdata); + mp2->y_src = (float *) + ((uchar *)mp1->y_src - mp1->mapdata + mp2->mapdata); + + mp2->updated = 1; + } + } else + mp2->updated = 0; +} + +/* valid_mapping -- Perform some sanity checks on a mapping to verify that + * it contains something meaningful. + */ +static +valid_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register int x, y; + int snx, sny, dnx, dny; + int s_width, s_height, d_width, d_height; + Raster sr, dr; + + if (!mp || !mp->defined) + return (False); + + if (mp->src < 0 || mp->src >= w->gterm.maxRasters) + return (False); + if (mp->dst < 0 || mp->dst >= w->gterm.maxRasters) + return (False); + + sr = &w->gterm.rasters[mp->src]; + dr = &w->gterm.rasters[mp->dst]; + if (!sr->type || !dr->type) + return (False); + + switch (mp->st) { + case GtPixel: + s_width = sr->width; s_height = sr->height; + break; + case GtNDC: + s_width = MAXNDC + 1; s_height = MAXNDC + 1; + break; + default: + return (False); + } + + switch (mp->dt) { + case GtPixel: + d_width = dr->width; d_height = dr->height; + break; + case GtNDC: + d_width = MAXNDC + 1; d_height = MAXNDC + 1; + break; + default: + return (False); + } + + snx = mp->snx; dnx = abs(mp->dnx); + sny = mp->sny; dny = abs(mp->dny); + if (snx <= 0 || dnx <= 0 || sny <= 0 || dny <= 0) + return (False); + + x = mp->sx; y = mp->sy; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + x = mp->sx + snx - 1; y = mp->sy + sny - 1; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + + x = mp->dx; y = mp->dy; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + x = mp->dx + dnx - 1; y = mp->dy + dny - 1; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + + return (True); +} + + +/* initialize_mapping -- Initialize the contents of a mapping descriptor. + */ +static +initialize_mapping (mp) + register Mapping mp; +{ + memset ((char *)mp, 0, sizeof(struct mapping)); +} + + +/* update_mapping -- Update the portion of a mapping descriptor used at + * runtime to execute the mapping. This information consists of several + * lookup tables and other parameters describing how a destination pixel + * maps back to a source pixel and vice versa. + */ +static +update_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register uchar *op; + register int i, j, k; + int snx, sny, dnx, dny, sx, sy, dx, dy; + int xmax, ymax, lo, hi, edge1, edge2; + int temp, xflip=0, yflip=0; + struct mapping p_mp; + float pixwidth, *fp; + int *ip; + + if (mp->updated) + return; + + /* The internal lookup tables are in pixel units. */ + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 0); + + if ((snx = p_mp.snx) <= 0 || (sny = p_mp.sny) <= 0) + return; + + if ((dnx = p_mp.dnx) < 0) { + dnx = -dnx; + xflip++; + } + if ((dny = p_mp.dny) < 0) { + dny = -dny; + yflip++; + } + + sx = p_mp.sx; + sy = p_mp.sy; + dx = p_mp.dx; + dy = p_mp.dy; + xmax = dnx - 1; + ymax = dny - 1; + + /* Get scale factors. */ + mp->xscale = (float)dnx / (float)snx; + mp->yscale = (float)dny / (float)sny; + + /* Determine type of scaling to be used. */ + if (mp->xscale < 1.0 || mp->yscale < 1.0) { + mp->scaling = M_DEZOOM; + } else if (mp->xscale > 1.0 || mp->yscale > 1.0) { + mp->scaling = M_ZOOM; + if (abs(mp->xscale - (int)(mp->xscale+0.5)) < ZOOM_TOL && + abs(mp->yscale - (int)(mp->yscale+0.5)) < ZOOM_TOL) + mp->scaling = M_INTZOOM; + } else + mp->scaling = (xflip || yflip) ? M_ZOOM : M_NOSCALING; + + /* Get a data buffer for the lookup tables. */ + mp->datalen = + snx * sizeof(mapExtent) + /* xy, extent */ + sny * sizeof(mapExtent) + + dnx * sizeof(int) + /* xy, srcpix */ + dny * sizeof(int) + + dnx * sizeof(float) + /* xy, src */ + dny * sizeof(float); + + if (mp->mapdata) + mp->mapdata = (uchar *) XtRealloc ((char *)mp->mapdata, mp->datalen); + else + mp->mapdata = (uchar *) XtMalloc (mp->datalen); + if (mp->mapdata == NULL) + return; + + /* Set the table pointers. */ + op = mp->mapdata; + mp->x_extent = (mapExtent *) op; op += snx * sizeof(mapExtent); + mp->y_extent = (mapExtent *) op; op += sny * sizeof(mapExtent); + mp->x_srcpix = (int *) op; op += dnx * sizeof(int); + mp->y_srcpix = (int *) op; op += dny * sizeof(int); + mp->x_src = (float *) op; op += dnx * sizeof(float); + mp->y_src = (float *) op; op += dny * sizeof(float); + + /* Compute the backpointers to the source raster for each destination + * pixel center. + */ + for (i=0, ip = mp->x_srcpix, fp = mp->x_src; i < dnx; i++) { + fp[i] = ((xflip ? xmax - i : i) + 0.5) / mp->xscale + sx; + ip[i] = fp[i]; + } + for (i=0, ip = mp->y_srcpix, fp = mp->y_src; i < dny; i++) { + fp[i] = ((yflip ? ymax - i : i) + 0.5) / mp->yscale + sy; + ip[i] = fp[i]; + } + + /* Compute the extent arrays. These define the range of destination + * pixels affected by each source pixel. + */ + lo = dnx - 1 + dx; + hi = dx; + for (i=0; i < snx; i++) { + mp->x_extent[i].lo = lo; + mp->x_extent[i].hi = hi; + } + lo = dny - 1 + dy; + hi = dy; + for (i=0; i < sny; i++) { + mp->y_extent[i].lo = lo; + mp->y_extent[i].hi = hi; + } + + /* Map the left and right or top and bottom edges of each destination + * pixel back into the source rect and update the corresponding extent + * entries to indicate that these source pixels are used to compute the + * destination pixel. + */ + pixwidth = 1.0 - ZOOM_TOL; + + for (i=0; i < dnx; i++) { + edge1 = (xflip ? xmax - i : i) / mp->xscale; + edge2 = (xflip ? xmax - (i-pixwidth) : (i+pixwidth)) / mp->xscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (snx - 1, edge2); + + for (j=edge1, k = dx + i; j <= edge2; j++) { + if (mp->x_extent[j].lo > k) + mp->x_extent[j].lo = k; + if (mp->x_extent[j].hi < k) + mp->x_extent[j].hi = k; + } + } + + for (i=0; i < dny; i++) { + edge1 = (yflip ? ymax - i : i) / mp->yscale; + edge2 = (yflip ? ymax - (i-pixwidth) : (i+pixwidth)) / mp->yscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (sny - 1, edge2); + + for (j=edge1, k = dy + i; j <= edge2; j++) { + if (mp->y_extent[j].lo > k) + mp->y_extent[j].lo = k; + if (mp->y_extent[j].hi < k) + mp->y_extent[j].hi = k; + } + } + + mp->updated = 1; +} + + +/* free_mapping -- Free any storage used internally by a mapping descriptor, + * and deactivate the mapping. + */ +static +free_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + mp_unlink (w, mp); + mp->defined = mp->enabled = mp->updated = 0; + if (mp->mapdata) { + XtFree ((char *) mp->mapdata); + mp->mapdata = NULL; + mp->datalen = 0; + mp->x_extent = mp->y_extent = NULL; + mp->x_srcpix = mp->y_srcpix = NULL; + mp->x_src = mp->y_src = NULL; + mp->updated = 0; + } +} + +static void +mp_linkafter (w, mp, ref_mp) + register GtermWidget w; + register Mapping mp; + register Mapping ref_mp; +{ + register Mapping map; + + /* Don't use the reference mapping unless it is already linked or + * the list is empty. + */ + if (w->gterm.mp_head) { + for (map = w->gterm.mp_head; map && map != ref_mp; map = map->next) + ; + if (map != ref_mp) + ref_mp = NULL; + } + + mp->prev = ref_mp; + mp->next = ref_mp ? ref_mp->next : NULL; + if (ref_mp && ref_mp->next) + ref_mp->next->prev = mp; + if (ref_mp) + ref_mp->next = mp; + + if (!w->gterm.mp_tail || ref_mp == w->gterm.mp_tail) + w->gterm.mp_tail = mp; + if (!w->gterm.mp_head) + w->gterm.mp_head = mp; +} + + +static void +mp_unlink (w, mp) + register GtermWidget w; + register Mapping mp; +{ + if (mp->prev) + mp->prev->next = mp->next; + if (mp->next) + mp->next->prev = mp->prev; + if (w->gterm.mp_head == mp) + w->gterm.mp_head = mp->next; + if (w->gterm.mp_tail == mp) + w->gterm.mp_tail = mp->prev; + + mp->prev = mp->next = NULL; +} + + +/* + * Graphics MARKERS. + * -------------------- + * A marker is an active graphics object displayed on top of a drawing to + * mark, annotate, or outline a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. Markers are used to + * interactively define regions with the mouse, to provide a dynamic graphical + * display which doesn't interfere with the underlying graphics frame, or as a + * graphical means of command input, using callbacks to perform some operation + * when the marker is moved or resized by the user. + * + * GtMarkerInit (w) + * GtMarkerFree (w) + * + * gm = GmCreate (w, type, interactive) + * GmRedisplay (w, region|NULL) + * gm = GmCopy (gm) + * GmDestroy (gm) + * GmAddCallback (gm, events, func, client_data) + * GmDeleteCallback (gm, func, client_data) + * gm = GmSelect (gt, x, y, &what) + * + * GmMarkpos (gm) + * GmRedraw (gm, func, erase) + * GmRaise (gm, ref_gm|NULL) + * GmLower (gm, ref_gm|NULL) + * GmNotify (gm, events, event, param, nparams) + * + * GmAddPt (gm, x, y) + * GmDeletePt (gm, x, y) + * GmMovePt (gm, x, y) + * GmMove (gm, x, y) + * GmResize (gm, x, y) + * GmRotate (gm, x, y) + * + * GmSetAttributes (gm, args, nargs, type) + * GmGetAttributes (gm, args, nargs, type) + * GmSetAttribute (gm, attribute, value, type) + * GmGetAttribute (gm, attribute, value, type) + * GmSetVertices (gm, points, first, npts) + * npts = GmGetVertices (gm, points, first, maxpts) + * GmGetBoundingBox (gm, x, y, width, height) + * + * type = GmStrToType (marker_type) + * event = GmStrToEvent (event_type) + * func = GmStrToFunction (drawing_function) + * + * Markers operate in screen coordinates (raster 0). The SelectRaster + * and MapVector routines may be used to convert to and from raster + * coordinates if desired. + * + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mp) + * GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + * + * The Gm procedures above implement the main functionality of markers. User + * interaction is provided at a higher level using action procedures which + * are bound to pointer and keyboard events via translations (or by the GUI + * itself directly calling the above procedures). + */ + +static void gm_text_init(), gm_line_init(), gm_plin_init(), gm_rect_init(); +static void gm_boxx_init(), gm_circ_init(), gm_elip_init(), gm_pgon_init(); +static int gm_putint(), gm_putfloat(), gm_do_callbacks(), gm_constraint(); +static int gm_getint(), gm_getattribute(), gm_gettype(); +static double gm_getfloat(); +static char *gm_getstring(); + +static void gm_markpos(), gm_erase(), gm_redraw(), gm_setCurRect(); +static void gm_linkafter(), gm_unlink(); +static double gm_niceAngle(); +static Pixel gm_getpixel(); +static int gm_select(); +static int gm_getfillstyle(); + +static GmVMethod gm_classinit[] = { + gm_text_init, gm_line_init, gm_plin_init, gm_rect_init, + gm_boxx_init, gm_circ_init, gm_elip_init, gm_pgon_init +}; + +static Region null_region; +static XRectangle null_rect = { 0, 0, 0, 0 }; +#define NullRect(r) (!(r)->width || !(r)->height) + +#define PI_2 1.57079632679489661923 +#define PI_4 0.78539816339744830962 +#define BORDER 5 + +static void M_create(), M_destroy(), M_destroyNull(), M_set(), M_raise(); +static void M_lower(), M_notify(), M_markpos(), M_markposAdd(), M_redraw(); +static void M_addPt(), M_deletePt(), M_movePt(), M_deleteDestroy(); +static void M_move(), M_resize(), M_moveResize(), M_rotate(); +static void M_rotateResize(), M_input(); +static void gm_focusin(), gm_focusout(); + +static XtActionsRec markerActionsList[] = { + { "m_create", M_create }, + { "m_destroy", M_destroy }, + { "m_destroyNull", M_destroyNull }, + { "m_set", M_set }, + { "m_raise", M_raise }, + { "m_lower", M_lower }, + { "m_notify", M_notify }, + { "m_input", M_input }, + { "m_markpos", M_markpos }, + { "m_markposAdd", M_markposAdd }, + { "m_redraw", M_redraw }, + { "m_addPt", M_addPt }, + { "m_deletePt", M_deletePt }, + { "m_movePt", M_movePt }, + { "m_deleteDestroy", M_deleteDestroy }, + { "m_move", M_move }, + { "m_resize", M_resize }, + { "m_moveResize", M_moveResize }, + { "m_rotate", M_rotate }, + { "m_rotateResize", M_rotateResize }, +}; + + +/* GtMarkerInit -- Initialize the marker subsystem. + */ +GtMarkerInit (w) + GtermWidget w; +{ + register Marker gm, prev; + XColor fg_color, bg_color; + Display *display = w->gterm.display; + int type, i; + GC gc; + + for (gm = w->gterm.gm_tail; gm; gm = prev) { + prev = gm->prev; + GmDestroy (gm); + } + + if (!w->gterm.gm_initialized) { + /* Register some additional actions for markers. */ + XtAppAddActions (XtWidgetToApplicationContext((Widget)w), + markerActionsList, XtNumber(markerActionsList)); + + /* Get the gterm widget translations. */ + if ((char *)w->gterm.defTranslations == NULL) { + char *translations = NULL; + XtTranslations tt; + XtResource r; + int ttype, i; + + r.resource_name = XtNtranslations; + r.resource_class = XtCTranslations; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + XtGetApplicationResources ((Widget)w, &translations, &r, 1,NULL,0); + + if (translations) { + if (strncmp (translations, "#augment", 8) == 0) + ttype = T_augment; + else if (strncmp (translations, "#override", 9) == 0) + ttype = T_override; + else + ttype = T_replace; + + if (ttype == T_replace) { + w->gterm.defTranslations = + XtParseTranslationTable (translations); + } else if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = ttype; + w->gterm.nauxTrans++; + } + + } else { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + } + + /* Get the marker translations. */ + if ((char *)w->gterm.gm_defTranslations == NULL) + w->gterm.gm_defTranslations = + XtParseTranslationTable (w->gterm.gm_translations); + } + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + /* Get graphics drawing GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, + w->gterm.gm_lineWidth, w->gterm.gm_lineStyle, CapButt, JoinMiter); + w->gterm.gm_drawGC = gc; + + /* Get graphics rubber-band GC. */ + gc = XCreateGC (display, w->gterm.root, 0, NULL); + XSetFunction (display, gc, GXxor); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, w->gterm.gm_xorFillColor); + XSetBackground (display, gc, w->gterm.gm_xorFillBgColor); + XSetLineAttributes (display, gc, + 0, LineDoubleDash, CapButt, JoinMiter); + w->gterm.gm_rubberGC = gc; + + fg_color.pixel = w->gterm.gm_cursorFgColor; + bg_color.pixel = w->gterm.gm_cursorBgColor; + XQueryColor (display, w->core.colormap, &fg_color); + XQueryColor (display, w->core.colormap, &bg_color); + + w->gterm.gm_markerCursor = XCreateFontCursor (display, XC_fleur); + XRecolorCursor (display, w->gterm.gm_markerCursor, &fg_color,&bg_color); + w->gterm.gm_edgeCursor = XCreateFontCursor (display, XC_dotbox); + XRecolorCursor (display, w->gterm.gm_edgeCursor, &fg_color,&bg_color); + w->gterm.gm_pointCursor = XCreateFontCursor (display, XC_sizing); + XRecolorCursor (display, w->gterm.gm_pointCursor, &fg_color,&bg_color); + + if (!(type = GmStrToType (w->gterm.gm_defaultMarker))) + type = Gm_Rectangle; + w->gterm.gm_defaultType = type; + + if (!null_region) + null_region = XCreateRegion(); + w->gterm.gm_initialized++; + } + + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.gm_redisplay = False; + w->gterm.preserve_screen = 0; +} + + +/* GtMarkerFree -- Free any marker subsystem resources. + */ +static void +GtMarkerFree (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + register Marker gm; + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) + GmDestroy (gm); + + if (!w->gterm.gm_initialized) + return; + + XFreeGC (display, w->gterm.gm_drawGC); + XFreeGC (display, w->gterm.gm_rubberGC); + + /* This call can fail - see comments elsewhere in this file about + * XFreeCursor. + * + XFreeCursor (display, w->gterm.gm_markerCursor); + XFreeCursor (display, w->gterm.gm_edgeCursor); + XFreeCursor (display, w->gterm.gm_pointCursor); + */ + + w->gterm.gm_initialized = 0; +} + + +/* gm_focusin -- Called when gterm window input is directed to a marker. + */ +static void +gm_focusin (w, gm, what) + register GtermWidget w; + register Marker gm; + GmSelection what; +{ + Cursor cursor; + int erase; + Marker am; + + if (!XtIsRealized ((Widget)w)) + return; + + if (am = w->gterm.gm_active) { + if (am != gm) + gm_focusout (w, 0); + else if (what && what->type == w->gterm.gm_selection.type) { + /* no change */ + return; + } + } + + if (what) { + switch (what->type) { + case Ge_Point: + cursor = w->gterm.gm_pointCursor; + break; + case Ge_Edge: + cursor = w->gterm.gm_edgeCursor; + break; + default: + cursor = w->gterm.gm_markerCursor; + break; + } + } else + cursor = w->gterm.gm_markerCursor; + + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, cursor); + w->gterm.gm_active = gm; + w->gterm.gm_selection = *what; + + if (gm && gm != am) { + gm_request_translations (w, gm); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusIn, NULL, NULL, 0); +} + + +/* gm_focusout -- Called to restore the normal gterm window input when the + * pointer moves off a marker. + */ +static void +gm_focusout (w, enableSetTrans) + register GtermWidget w; + int enableSetTrans; /* replace translations */ +{ + register Display *display = w->gterm.display; + register Marker gm = w->gterm.gm_active; + int erase, i; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Restore the default gterm window translations. */ + if (enableSetTrans) + gm_request_translations (w, NULL); + + XDefineCursor (display, w->gterm.window, w->gterm.cursor); + w->gterm.gm_active = NULL; + + if (gm) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusOut, NULL, NULL, 0); +} + + +/* gm_refocus -- Simulate a pointer event to recompute the marker pointer + * focus. Called when a software event changes the marker stacking order + * in some way. + */ +static void +gm_refocus (w) + GtermWidget w; +{ + XMotionEvent event; + int nparams = 0; + + event.x = w->gterm.last_x; + event.y = w->gterm.last_y; + HandleTrackCursor ((Widget)w, &event, NULL, &nparams); +} + + +/* + * Translation tables. The widget's translation table must not be replaced + * while a translation is executing. This can be a problem as it is often + * events and their translations which lead to the translation table getting + * replaced. To avoid this problem we merely queue a timer event to load + * the desired translation table, allowing any existing translation to + * finish executing before the translation table is swapped out. If multiple + * translation table load requests are issued only the final one has any + * effect. + */ + +/* gm_request_translations -- Queue a request to load the translations for the + * specified marker (or NULL to load the default gterm translations). If this + * is the first request and timers are enabled a timer is posted to load the + * translations when any current event processing is complete. If a request + * is already active then the most recent request supercedes any previous one. + */ +static void +gm_request_translations (w, gm) + register GtermWidget w; + Marker gm; +{ + w->gterm.gm_reqTranslations = gm; + + if (!w->gterm.useTimers) + gm_load_translations (w, NULL); + else if (!w->gterm.gm_timer_id) { + w->gterm.gm_timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext((Widget)w), 0, + gm_load_translations, (XtPointer)w); + } +} + + +/* gm_load_translations -- Swap out the widget's translation table. This is + * a no-op if the requested translation table is already loaded. + */ +static void +gm_load_translations (w, id) + register GtermWidget w; + XtIntervalId id; +{ + register Marker am, gm; + register int i; + + w->gterm.gm_timer_id = (XtIntervalId) NULL; + + am = w->gterm.gm_curTranslations; + gm = w->gterm.gm_reqTranslations; + if (am == gm && w->gterm.gm_initialized) + return; + + if (gm) { + /* Set the translations for the indicated marker. */ + if (!am || am->translations != gm->translations) + XtOverrideTranslations ((Widget)w, gm->translations); + } else { + /* Restore the default gterm window translations. */ + XtVaSetValues ((Widget)w, + XtNtranslations, (XtArgVal)w->gterm.defTranslations, NULL); + for (i=0; i < w->gterm.nauxTrans; i++) { + switch (w->gterm.auxTType[i]) { + case T_augment: + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + case T_override: + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + } + } + } + + w->gterm.gm_curTranslations = w->gterm.gm_reqTranslations; +} + + +/* Public marker functions. + * -------------------------- + */ + +/* GmCreate -- Create a new marker. + */ +Marker +GmCreate (w, type, interactive) + GtermWidget w; + int type; /* marker type */ + int interactive; /* use pointer to set position */ +{ + register Marker gm; + + /* Allocate descriptor. */ + if (type < 1 || type > Gm_NTypes) + return (NULL); + if (!(gm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + /* Initialize descriptor. */ + gm->w = w; + gm->type = type; + gm->flags = interactive ? (Gm_Visible|Gm_Sensitive) : 0; + gm->translations = w->gterm.gm_defTranslations; + gm->old_region = XCreateRegion(); + gm->cur_region = XCreateRegion(); + (gm_classinit[type-1]) (gm, interactive); + + /* Link marker to tail of marker list. */ + gm_linkafter (gm, w->gterm.gm_tail); + + /* If marker is being created interactive, set flag to indicate that the + * next create marker event should finish creating this marker. + */ + if (w->gterm.gm_create) + GmDestroy (w->gterm.gm_create); + w->gterm.gm_create = interactive ? gm : NULL; + + return (gm); +} + + +/* GmDestroy -- Destroy a marker. + */ +GmDestroy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + Region old_region, cur_region; + + /* GmDestroy can be called recursively during a destroy operation as a + * side effect of the destroy callback. Set the Gm_BeingDestroyed flag + * to cause these redundant destroy requests to be ignored. + */ + if (gm->flags & Gm_BeingDestroyed) + return (OK); + gm->flags |= Gm_BeingDestroyed; + + /* Release the focus if active marker. This should be done before + * proceeding to destroy the marker, i.e. before calling the destroy + * callbacks. + */ + if (w->gterm.gm_active == gm) { + gm_focusout (w, 1); + w->gterm.gm_active = NULL; + } + + /* Inform any clients that have registered a callback for this marker + * that we are about to destroy the marker. + */ + gm_do_callbacks (gm, GmEvDestroy, NULL, NULL, 0); + + /* Erase the marker from the screen. */ + GmMarkpos (gm); + gm_erase (gm); + + /* Note marker position. */ + old_region = gm->old_region; + cur_region = gm->cur_region; + + /* Free all storage and unlink the marker. */ + if (gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + if (gm->text) + XtFree ((char *)gm->text); + if (gm->pgon) + XtFree ((char *)gm->pgon); + + gm_unlink (gm); + XtFree ((char *)gm); + + /* Redraw any markers that were obscured by the deleted marker. */ + update_transients (w, old_region); + + XDestroyRegion (old_region); + XDestroyRegion (cur_region); + + /* Recompute the marker focus. */ + gm_refocus (w); + + return (OK); +} + + +/* GmCopy -- Copy a marker. + */ +Marker +GmCopy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register Marker nm; + + if (!(nm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + *nm = *gm; + nm->parent = gm; + nm->old_region = NULL; + nm->cur_region = NULL; + nm->points = NULL; + nm->pgon = NULL; + nm->text = NULL; + + /* Copy region descriptors. */ + if ((char *)(nm->old_region = XCreateRegion()) == NULL) + goto fail; + if ((char *)(nm->cur_region = XCreateRegion()) == NULL) + goto fail; + XUnionRegion (nm->old_region, gm->cur_region, nm->cur_region); + + /* Copy any polypoint data. */ + if (gm->pgon) { + nm->pgon = (DPoint *) XtMalloc (gm->npoints * sizeof(DPoint)); + if (nm->pgon == NULL) + goto fail; + memmove (nm->pgon, gm->pgon, gm->npoints * sizeof(DPoint)); + } + + /* Copy region polygon. */ + if (gm->npoints > GM_MAXVERTICES) { + if (!(nm->points = (XPoint *) XtMalloc (gm->npoints * sizeof(XPoint)))) + goto fail; + memmove (nm->points, gm->points, gm->npoints * sizeof(XPoint)); + } + + /* Copy any text data. */ + if (gm->text) { + int nchars = strlen (gm->text); + if (!(nm->text = XtMalloc (nchars + 1))) + goto fail; + memmove (nm->text, gm->text, nchars + 1); + } + + gm_linkafter (nm, w->gterm.gm_tail); + return (nm); + +fail: + if (nm->text) + XtFree (nm->text); + if (nm->pgon) + XtFree ((char *)nm->pgon); + if (nm->points && nm->points != nm->point_data) + XtFree ((char *)nm->points); + if ((char *)nm->cur_region) + XDestroyRegion (nm->cur_region); + if ((char *)nm->old_region) + XDestroyRegion (nm->old_region); + + XtFree ((char *)nm); + return (NULL); +} + + +/* GmAddCallback -- Add a callback to a marker. + */ +GmAddCallback (gm, events, func, client_data) + register Marker gm; + int events; /* events callback is to receive */ + GmIMethod func; /* function to be called */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i; + + /* Find an empty callback slot. */ + for (i=0; i < GM_MAXCALLBACKS; i++) + if (!gm->callback[i].events) + break; + + /* Register the callback. */ + if (i < GM_MAXCALLBACKS) { + cb = &gm->callback[i]; + cb->events = events; + cb->func = func; + cb->client_data = client_data; + gm->ncallbacks = max (gm->ncallbacks, i + 1); + } + + if (events & GmEvConstraint) + gm->constraints++; +} + + +/* GmDeleteCallback -- Delete a previously posted callback given the + * function pointer and client data passed when the callback was registered. + */ +GmDeleteCallback (gm, func, client_data) + register Marker gm; + GmIMethod func; /* callback function */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i, n; + + for (i=n=0; i < GM_MAXCALLBACKS; i++) { + cb = &gm->callback[i]; + + if (cb->func == func && cb->client_data == client_data) { + if (cb->events & GmEvConstraint) + gm->constraints--; + cb->events = (int)NULL; + cb->func = (GmIMethod)NULL; + cb->client_data = (XtPointer)NULL; + } else if (cb->events) + n = i; + } + + gm->ncallbacks = n + 1; +} + + +/* GmSelect -- Scan the marker list to see if the given pointer coordinates + * are within an active marker. If so, the marker descriptor is returned as + * the function value, and the "what" argument is set to indicate what part + * of the marker was selected. + */ +Marker +GmSelect (w, x, y, what) + GtermWidget w; + int x, y; + GmSelection what; +{ + register int flags = (Gm_Activated|Gm_Visible|Gm_Sensitive); + register XRectangle *r; + register Marker gm; + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) { + if (!((gm->flags & (flags|Gm_BeingDestroyed)) == flags)) + continue; + r = &gm->cur_rect; + if (x < (int)r->x || x >= (int)(r->x + r->width) || + y < (int)r->y || y >= (int)(r->y + r->height)) + continue; + if (gm->select (gm, x, y, what)) + return (gm); + } + + return (NULL); +} + + +/* GmMarkpos -- Save the current marker position, e.g., prior to modifying + * the marker. This is used to erase the old marker when the modified + * marker is later redrawn. + */ +GmMarkpos (gm) + register Marker gm; +{ + gm->markpos (gm); +} + + +/* GmRedraw -- Redraw a marker using the given drawing function. If the erase + * flag is not set (as when in rubber-band mode) the marker is merely drawn + * to the screen. Otherwise if the old marker position has been saved the + * old marker is first erased, then any markers affected by the erase are + * redrawn, and finally the current marker is redrawn at the new location. + */ +GmRedraw (gm, func, erase) + Marker gm; + int func; + int erase; +{ + register Marker mm; + register XRectangle *o, *n, *r; + int flags = (Gm_Activated|Gm_Visible); + Region clip_region, temp_region, temp; + GtermWidget w = gm->w; + int outside; + + /* Recompute marker polygon if any attributes have changed. */ + gm->update (gm); + + clip_region = XCreateRegion(); + temp_region = XCreateRegion(); + + /* Erase the previously marked region (old position). */ + if (erase) { + XUnionRegion (gm->old_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + gm_erase (gm); + } + + if (!erase && func == GXxor) + gm->redraw (gm, func); + else { + /* Draw the marker and any markers it intersects, clipping to the + * new marker region. + */ + o = &gm->old_rect; + n = &gm->cur_rect; + + XUnionRegion (gm->cur_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, clip_region); + + for (mm = gm->w->gterm.gm_head; mm; mm = mm->next) { + if (!((mm->flags & flags) == flags)) + continue; + + /* Redraw a marker if it intersects either the old rect or the + * new rect. + */ + if (mm != gm) { + r = &mm->cur_rect; + outside = 0; + if ((int)r->x >= (int)o->x + (int)o->width || + (int)r->x + (int)r->width <= (int)o->x || + (int)r->y >= (int)o->y + (int)o->height || + (int)r->y + (int)r->height <= (int)o->y) + outside++; + if ((int)r->x >= (int)n->x + (int)n->width || + (int)r->x + (int)r->width <= (int)n->x || + (int)r->y >= (int)n->y + (int)n->height || + (int)r->y + (int)r->height <= (int)n->y) + outside++; + if (outside == 2) + continue; + } + mm->redraw (mm, func); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + } + + if (erase) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XDestroyRegion (clip_region); + XDestroyRegion (temp_region); + + if (func != GXxor && gm->width > 0 && gm->height > 0) { + /* Redraw callback. */ + gm_do_callbacks (gm, GmEvRedraw, NULL, NULL, 0); + + /* Generate moveResize callback, if marker was moved or resized. + */ + if (gm->old_rect.x != gm->cur_rect.x || + gm->old_rect.y != gm->cur_rect.y || + gm->old_rect.width != gm->cur_rect.width || + gm->old_rect.height != gm->cur_rect.height) { + + char x[32], y[32]; + char width[32], height[32]; + char *argv[5]; + int argc; + + /* If the marker was just created (old_rect null) or the marker + * moved and we did a full erase and redraw, any old markpos is + * obsolete so we may as well update the saved position. + */ + if (erase || !gm->old_rect.width || !gm->old_rect.height) + GmMarkpos (gm); + + sprintf (x, "%d", gm->x); + sprintf (y, "%d", gm->y); + sprintf (width, "%d", gm->width); + sprintf (height, "%d", gm->height); + argv[0] = x; + argv[1] = y; + argv[2] = width; + argv[3] = height; + argv[4] = NULL; + argc = 4; + + gm_do_callbacks (gm, GmEvMoveResize, NULL, argv, argc); + } + } +} + + +/* GmRedisplay -- Redisplay the markers in the given region, or redisplay + * the entire window if the region is given as (char *)NULL. + */ +GmRedisplay (w, region) + GtermWidget w; + Region region; +{ + register int flags = (Gm_Activated|Gm_Visible); + register XRectangle *r; + register Marker gm; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Set the clip mask to only draw in the affected region. */ + if (region) + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, region); + + /* Draw all markers that intersect the target region. */ + for (gm = w->gterm.gm_head; gm; gm = gm->next) { + if (!((gm->flags & flags) == flags)) + continue; + + if ((char *)region) { + gm->update (gm); + r = &gm->cur_rect; + if (XRectInRegion (region, + r->x, r->y, r->width, r->height) == RectangleOut) + continue; + } + + gm->redraw (gm, GXcopy); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + w->gterm.gm_redisplay = False; +} + + +/* GmRaise -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn above the second. + */ +GmRaise (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already on top? */ + if (gm == w->gterm.gm_tail || ref_gm && ref_gm->next == gm) + return; + + /* Raise it. */ + gm_unlink (gm); + gm_linkafter (gm, ref_gm ? ref_gm : w->gterm.gm_tail); + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmLower -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn below the second. + */ +GmLower (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already lowered? */ + if (gm == w->gterm.gm_head || ref_gm && ref_gm->prev == gm) + return; + + /* Lower it. */ + gm_unlink (gm); + if (ref_gm && ref_gm->prev) + gm_linkafter (gm, ref_gm->prev); + else { + gm->next = w->gterm.gm_head; + w->gterm.gm_head = gm; + if (gm->next) + gm->next->prev = gm; + if (!w->gterm.gm_tail) + w->gterm.gm_tail = gm; + } + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmNotify -- Notify any clients that have registered callbacks that the + * given marker events have occurred. + */ +GmNotify (gm, events, event, params, nparams) + register Marker gm; + int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + gm_do_callbacks (gm, events, event, params, nparams); +} + + +/* GmAddPt -- Add a point to a marker. + */ +GmAddPt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->addPt) { + GmRedraw (gm, GXxor, erase=False); + gm->addPt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + gm_refocus (gm->w); + } +} + + +/* GmDeletePt -- Delete a point from a marker. + */ +GmDeletePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->deletePt) { + GmMarkpos (gm); + gm->deletePt (gm, x, y); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (gm->w); + } +} + + +/* GmMovePt -- Move a point within a marker. + */ +GmMovePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->movePt) { + GmRedraw (gm, GXxor, erase=False); + gm->movePt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmMove -- Move a marker. + */ +GmMove (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->move) { + GmRedraw (gm, GXxor, erase=False); + gm->move (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmResize -- Resize a marker. + */ +GmResize (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->resize) { + GmRedraw (gm, GXxor, erase=False); + gm->resize (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmRotate -- Rotate a marker. + */ +GmRotate (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->rotate) { + GmRedraw (gm, GXxor, erase=False); + gm->rotate (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmSetAttributes -- Set a list of attributes. Requires that all attribute + * values be specified in the same type. Autoredraw, if enabled, is suspended + * until all attributes have been changed. + */ +GmSetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + int autoredraw, erase; + int status = OK; + + if (autoredraw = (gm->flags & Gm_AutoRedraw)) { + gm->flags &= ~Gm_AutoRedraw; + GmMarkpos (gm); + } + + for (i=0; i < nargs; i++) { + status |= GmSetAttribute (gm, args[i].name, args[i].value, argtype); + if (strcmp (args[i].name, GmAutoRedraw) == 0) + autoredraw = gm_getint (args[i].value, argtype); + } + + if (autoredraw) { + gm->flags |= Gm_AutoRedraw; + GmRedraw (gm, GXcopy, erase=True); + } + + return (status ? ERR : OK); +} + + +/* GmSetAttribute -- Set the value of a marker attribute. + */ +GmSetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int marker_type, atType; + int erase, n, i; + + if (gm->flags & Gm_AutoRedraw) + GmMarkpos (gm); + + switch (atType = gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + marker_type = GmStrToType ((char *)value); + break; + case Gt_Int: + marker_type = gm_getint (value, type); + break; + default: + return (ERR); + } + + marker_type = max(1, min(Gm_NTypes, marker_type)); + (gm_classinit[marker_type-1]) (gm, False); + gm->flags |= Gm_Modified; + break; + + case Ga_Activated: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Activated)) { + gm->flags |= Gm_Activated; + GmRedraw (gm, GXcopy, erase=False); + } + } else { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Activated; + } + return (OK); + + case Ga_Visible: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Visible)) { + gm->flags |= Gm_Visible; + GmRedraw (gm, GXcopy, erase=False); + } + } else if (gm->flags & Gm_Visible) { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Visible; + } + return (OK); + + case Ga_Sensitive: + if (gm_getint (value, type)) + gm->flags |= Gm_Sensitive; + else + gm->flags &= ~Gm_Sensitive; + return (OK); + + case Ga_AutoRedraw: + if (gm_getint (value, type)) + gm->flags |= Gm_AutoRedraw; + else + gm->flags &= ~Gm_AutoRedraw; + return (OK); + + case Ga_Translations: + switch (gm_gettype (type)) { + case Gt_String: + gm->translations = XtParseTranslationTable ((char *)value); + break; + default: + return (ERR); + } + return (OK); + + case Ga_X: + gm->x = gm_getint (value, type); + break; + case Ga_Y: + gm->y = gm_getint (value, type); + break; + + case Ga_Width: + case Ga_Height: + /* For a text marker a size can be specified either in integer + * pixels or in characters, e.g., "40ch" or "40 chars". + */ + if (gm->type == Gm_Text && type == XtRString) { + XFontStruct *fp = gm->font; + int char_width, char_height; + int l_pix, r_pix; + char *ip; + + for (n=0, ip=(char *)value; *ip && isdigit(*ip); ip++) + n = n * 10 + (*ip - '0'); + + while (isspace (*ip)) + ip++; + if (ip[0] == 'c' && ip[1] == 'h') { + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + + if (atType == Ga_Width) + n = n * char_width + l_pix + r_pix; + else + n = n * char_height + l_pix * 2; + } + } else + n = gm_getint (value, type); + + if (atType == Ga_Width) + gm->width = n; + else + gm->height = n; + break; + + case Ga_Rotangle: + gm->rotangle = gm_getfloat (value, type); + break; + + case Ga_HighlightColor: + gm->highlightColor = gm_getpixel (w, value, type); + break; + case Ga_LineColor: + gm->lineColor = gm_getpixel (w, value, type); + break; + case Ga_LineWidth: + gm->lineWidth = gm_getint (value, type); + break; + case Ga_LineStyle: + gm->lineStyle = gm_getint (value, type); + break; + + case Ga_KnotColor: + gm->knotColor = gm_getpixel (w, value, type); + break; + case Ga_KnotSize: + gm->knotSize = gm_getint (value, type); + break; + + case Ga_Fill: + gm->fill = gm_getint (value, type); + break; + case Ga_FillColor: + gm->fillColor = gm_getpixel (w, value, type); + break; + case Ga_FillBgColor: + gm->fillBgColor = gm_getpixel (w, value, type); + break; + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + gm->fillStyle = gm_getfillstyle (w, value, type); + break; + default: + break; + } + break; + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + gm->fillPattern = (Pixmap) (value); + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + gm->textColor = gm_getpixel (w, value, type); + break; + case Ga_TextBgColor: + gm->textBgColor = gm_getpixel (w, value, type); + break; + case Ga_TextBorder: + gm->textBorder = gm_getint (value, type); + break; + case Ga_ImageText: + gm->imageText = gm_getint (value, type); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + i = gm_getint (value, type); + if (i >= 0 && i < NDialogFonts) + gm->font = w->gterm.dialog_fonts[i]; + break; + case Gt_Pointer: + gm->font = (XFontStruct *) (value); + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + case Gt_String: + if (gm->text) + XtFree (gm->text); + if (!(gm->text = XtMalloc (strlen((char *)value) + 1))) + return (ERR); + strcpy (gm->text, (char *)value); + break; + default: + return (ERR); + } + break; + + default: + return (ERR); + } + + gm->flags |= Gm_Modified; + + if (gm->flags & Gm_AutoRedraw) + GmRedraw (gm, GXcopy, erase=True); + + /* Notify client that a marker attribute has changed. */ + { char *argv[2]; + int argc; + + argv[0] = attribute; + argv[1] = NULL; + argc = 1; + + gm_do_callbacks (gm, GmEvModify, NULL, argv, argc); + } + + return (OK); +} + + +/* GmGetAttributes -- Get a list of attributes. Requires that all attribute + * values be specified in the same type. + */ +GmGetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + + for (i=0; i < nargs; i++) + GmGetAttribute (gm, args[i].name, args[i].value, argtype); +} + + +/* GmGetAttribute -- Get the value of a marker attribute. + */ +GmGetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int i; + + switch (gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->type) { + case Gm_Text: + strcpy ((char *)value, GmText); + break; + case Gm_Line: + strcpy ((char *)value, GmLine); + break; + case Gm_Polyline: + strcpy ((char *)value, GmPolyline); + break; + case Gm_Rectangle: + strcpy ((char *)value, GmRectangle); + break; + case Gm_Box: + strcpy ((char *)value, GmBox); + break; + case Gm_Circle: + strcpy ((char *)value, GmCircle); + break; + case Gm_Ellipse: + strcpy ((char *)value, GmEllipse); + break; + case Gm_Polygon: + strcpy ((char *)value, GmPolygon); + break; + default: + return (ERR); + } + break; + case Gt_Int: + if (gm_putint (gm->type, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_Activated: + if (gm_putint ((gm->flags & Gm_Activated) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Visible: + if (gm_putint ((gm->flags & Gm_Visible) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Sensitive: + if (gm_putint ((gm->flags & Gm_Sensitive) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_AutoRedraw: + if (gm_putint ((gm->flags & Gm_AutoRedraw) != 0, value, type) == ERR) + return (ERR); + break; + + case Ga_X: + if (gm_putint (gm->x, value, type) == ERR) + return (ERR); + break; + case Ga_Y: + if (gm_putint (gm->y, value, type) == ERR) + return (ERR); + break; + case Ga_Width: + if (gm_putint (gm->width, value, type) == ERR) + return (ERR); + break; + case Ga_Height: + if (gm_putint (gm->height, value, type) == ERR) + return (ERR); + break; + case Ga_Rotangle: + if (gm_putfloat (gm->rotangle, value, type) == ERR) + return (ERR); + break; + + case Ga_HighlightColor: + if (gm_putint ((int)gm->highlightColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineColor: + if (gm_putint ((int)gm->lineColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineWidth: + if (gm_putint (gm->lineWidth, value, type) == ERR) + return (ERR); + break; + case Ga_LineStyle: + if (gm_putint (gm->lineStyle, value, type) == ERR) + return (ERR); + break; + case Ga_KnotColor: + if (gm_putint ((int)gm->knotColor, value, type) == ERR) + return (ERR); + break; + case Ga_KnotSize: + if (gm_putint (gm->knotSize, value, type) == ERR) + return (ERR); + break; + + case Ga_Fill: + if (gm_putint (gm->fill, value, type) == ERR) + return (ERR); + break; + case Ga_FillColor: + if (gm_putint ((int)gm->fillColor, value, type) == ERR) + return (ERR); + break; + case Ga_FillBgColor: + if (gm_putint ((int)gm->fillBgColor, value, type) == ERR) + return (ERR); + break; + + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->fillStyle) { + case FillSolid: + strcpy ((char *)value, "FillSolid"); + break; + case FillTiled: + strcpy ((char *)value, "FillTiled"); + break; + case FillStippled: + strcpy ((char *)value, "FillStippled"); + break; + case FillOpaqueStippled: + strcpy ((char *)value, "FillOpaqueStippled"); + break; + default: + strcpy ((char *)value, "FillSolid"); + break; + } + break; + case Gt_Int: + if (gm_putint (gm->fillStyle, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + *(Pixmap *)value = gm->fillPattern; + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + if (gm_putint ((int)gm->textColor, value, type) == ERR) + return (ERR); + break; + case Ga_TextBorder: + if (gm_putint (gm->textBorder, value, type) == ERR) + return (ERR); + break; + case Ga_ImageText: + if (gm_putint (gm->imageText, value, type) == ERR) + return (ERR); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + for (i=0; i < NDialogFonts; i++) + if (gm->font == w->gterm.dialog_fonts[i]) { + if (gm_putint (i, value, type) == ERR) + return (ERR); + break; + } + break; + case Gt_Pointer: + *(XFontStruct **)value = gm->font; + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + *((char **)value) = gm->text; + break; + case Gt_String: + strcpy ((char *)value, gm->text); + break; + default: + return (ERR); + } + break; + + default: + return (ERR); + } + + return (OK); +} + + +/* GmSetVertices -- Set the vertices of a "poly" type object. + */ +GmSetVertices (gm, points, first, npts) + Marker gm; + DPoint *points; /* input array of points */ + int first; /* first point to be set */ + int npts; /* number of points to set */ +{ + register DPoint *ip; + register XPoint *op; + register int i; + int erase; + + /* The point vector is automatically extended if more space is needed. + * Small vectors are stored directly in the marker descriptor in the + * point_data array. + */ + if (first + npts > gm->npoints) { + if (gm->npoints > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) XtRealloc ((char *)gm->points, + first + npts)) == (XPoint *)NULL) + return; + } else if (first + npts > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) + XtMalloc (first + npts)) == (XPoint *)NULL) + return; + } else if (!gm->points) + gm->points = gm->point_data; + + gm->npoints = first + npts; + } + + /* Copy the point data. */ + ip = points; + op = &gm->points[first]; + for (i=0; i < npts; i++) { + op->x = (int) ip->x + 0.5; + op->y = (int) ip->y + 0.5; + ip++, op++; + } + + /* Redraw the marker if autoredraw is enabled. */ + if (gm->flags & Gm_AutoRedraw) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } +} + + +/* GmGetVertices -- Get the vertices of a "poly" type object. The actual + * number of points output is returned as the function value. + */ +GmGetVertices (gm, points, first, maxpts) + register Marker gm; + register DPoint *points; /* output array of points */ + int first; /* first point to be returned */ + int maxpts; /* max number of points to return */ +{ + register XPoint *ip; + register DPoint *op; + register int i; + int top, nout; + + if (first >= gm->npoints) + return (0); + top = min (first + maxpts, gm->npoints); + nout = top - first; + + if (points) { + ip = &gm->points[first]; + op = points; + for (i=0; i < nout; i++) { + op->x = ip->x; + op->y = ip->y; + ip++, op++; + } + } + + return (nout); +} + + +/* GmGetBoundingBox -- Returns a rect large enough to completely enclose a + * marker, regardless of its type or orientation. + */ +GmGetBoundingBox (gm, x, y, width, height) + register Marker gm; + int *x, *y; + int *width, *height; +{ + register XRectangle *r = &gm->cur_rect; + + *x = r->x; + *y = r->y; + *width = r->width; + *height = r->height; +} + + +/* GmStrToType -- Convert a marker type string to a marker type code. + */ +GmStrToType (marker_type) +register char *marker_type; +{ + register int type; + + if (strcmp (marker_type, GmText) == 0) + type = Gm_Text; + else if (strcmp (marker_type, GmLine) == 0) + type = Gm_Line; + else if (strcmp (marker_type, GmPolyline) == 0) + type = Gm_Polyline; + else if (strcmp (marker_type, GmRectangle) == 0) + type = Gm_Rectangle; + else if (strcmp (marker_type, GmBox) == 0) + type = Gm_Box; + else if (strcmp (marker_type, GmCircle) == 0) + type = Gm_Circle; + else if (strcmp (marker_type, GmEllipse) == 0) + type = Gm_Ellipse; + else if (strcmp (marker_type, GmPolygon) == 0) + type = Gm_Polygon; + else + type = 0; + + return (type); +} + + +/* GmStrToEvent -- Convert a marker event type string to a marker event code. + */ +GmStrToEvent (event_type) +register char *event_type; +{ + register int type; + + if (strcmp (event_type, "notify") == 0) + type = GmEvNotify; + else if (strcmp (event_type, "moveResize") == 0) + type = GmEvMoveResize; + else if (strcmp (event_type, "modify") == 0) + type = GmEvModify; + else if (strcmp (event_type, "redraw") == 0) + type = GmEvRedraw; + else if (strcmp (event_type, "destroy") == 0) + type = GmEvDestroy ; + else if (strcmp (event_type, "input") == 0) + type = GmEvInput; + else if (strcmp (event_type, "focusIn") == 0) + type = GmEvFocusIn; + else if (strcmp (event_type, "focusOut") == 0) + type = GmEvFocusOut; + else if (strcmp (event_type, "constraint") == 0) + type = GmEvConstraint; + else + type = 0; + + return (type); +} + + +/* GmStrToFunction -- Convert a drawing function string to the corresponding + * XLIB function code. + */ +GmStrToFunction (function) +register char *function; +{ + register int code; + + if (strcmp (function, "clear") == 0) + code = GXclear; + else if (strcmp (function, "and") == 0) + code = GXand; + else if (strcmp (function, "andReverse") == 0) + code = GXandReverse; + else if (strcmp (function, "copy") == 0) + code = GXcopy; + else if (strcmp (function, "andInverted") == 0) + code = GXandInverted; + else if (strcmp (function, "noop") == 0) + code = GXnoop; + else if (strcmp (function, "xor") == 0) + code = GXxor; + else if (strcmp (function, "or") == 0) + code = GXor; + else if (strcmp (function, "nor") == 0) + code = GXnor; + else if (strcmp (function, "equiv") == 0) + code = GXequiv; + else if (strcmp (function, "invert") == 0) + code = GXinvert; + else if (strcmp (function, "orReverse") == 0) + code = GXorReverse; + else if (strcmp (function, "copyInverted") == 0) + code = GXcopyInverted; + else if (strcmp (function, "orInverted") == 0) + code = GXorInverted; + else if (strcmp (function, "nand") == 0) + code = GXnand; + else if (strcmp (function, "set") == 0) + code = GXset; + else + code = -1; + + return (code); +} + + +/* Internal procedures for above code. + * ------------------------------------ + */ + +static int +gm_getint (value, type) + XtArgVal value; + char *type; +{ + register int ch; + + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + ch = *((char *)value); + if (ch == 'T' || ch == 't') + return (1); + else if (ch == 'F' || ch == 'f') + return (0); + else + return (atoi((char *)value)); + default: + return (0); + } +} + + +static Pixel +gm_getpixel (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + XrmValue from, to; + Pixel pixel; + char *str; + + switch (gm_gettype (type)) { + case Gt_Int: + /* Pixel value (colormap index). */ + return ((Pixel)value); + + case Gt_String: + /* The pixel is expressed either as a pixel number input as a string, + * or as a color name. The latter case requires a type conversion. + */ + str = (char *)value; + if (isdigit(str[0]) && (int)strlen(str) <= 3) { + int index = atoi (str); + pixel = w->gterm.cmap[index]; + return (pixel); + } + + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) { + /* Allocate color from default colormap. + */ + from.size = strlen ((char *)value) + 1; + from.addr = (char *)value; + to.addr = (caddr_t) &pixel; + to.size = sizeof(pixel); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRPixel, &to)) + pixel = w->gterm.cmap[1]; + + } else { + /* Allocate closest match from custom colormap. This is crude, + * but for the standard colors this will return an exact match. + */ + int index, min_dist, dist, i; + XColor exact, best, *cp; + + pixel = w->gterm.cmap[1]; + if (XLookupColor (w->gterm.display, + get_colormap(w), str, &exact, &best)) { + min_dist = 9999; + index = 1; + + for (i=0; i < w->gterm.ncolors; i++) { + cp = &w->gterm.color[i]; + dist = abs((int)exact.red - (int)cp->red) + + abs((int)exact.green - (int)cp->green) + + abs((int)exact.blue - (int)cp->blue); + if (dist == 0) { + index = i; + break; + } else if (dist < min_dist) { + index = i; + min_dist = dist; + } + } + + pixel = w->gterm.color[index].pixel; + } + } + return (pixel); + + default: + return (w->gterm.cmap[1]); + } +} + + +static int +gm_getfillstyle (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_String: + if (strcmp ((char *)value, "FillSolid") == 0) + return (FillSolid); + else if (strcmp ((char *)value, "FillTiled") == 0) + return (FillTiled); + else if (strcmp ((char *)value, "FillStippled") == 0) + return (FillStippled); + else if (strcmp ((char *)value, "FillOpaqueStippled") == 0) + return (FillOpaqueStippled); + break; + default: + break; + } + + return (FillSolid); +} + + +static double +gm_getfloat (value, type) + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + return (atof((char *)value)); + default: + return (0); + } +} + + +static char * +gm_getstring (value, type) + XtArgVal value; + char *type; +{ + if (strcmp (type, XtRString) == 0) + return ((char *)value); + else + return (""); +} + + +static int +gm_putint (ival, value, type) + int ival; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = ival; + break; + case Gt_DFloatP: + *(double *)value = (double) ival; + break; + case Gt_String: + sprintf ((char *)value, "%d", ival); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_putfloat (fval, value, type) + double fval; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = (int) fval; + break; + case Gt_DFloatP: + *(double *)value = fval; + break; + case Gt_String: + sprintf ((char *)value, "%g", fval); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_gettype (type) + char *type; +{ + if (strcmp (type, XtRBool) == 0) + return (Gt_Int); + else if (strcmp (type, XtRInt) == 0) + return (Gt_Int); + else if (strcmp (type, XtRFloat) == 0) + return (Gt_DFloatP); + else if (strcmp (type, XtRPointer) == 0) + return (Gt_Pointer); + else if (strcmp (type, XtRString) == 0) + return (Gt_String); + else + return (ERR); +} + + +static int +gm_getattribute (attribute) + char *attribute; +{ + if (strcmp (attribute, GmType) == 0) + return (Ga_Type); + else if (strcmp (attribute, GmActivated) == 0) + return (Ga_Activated); + else if (strcmp (attribute, GmVisible) == 0) + return (Ga_Visible); + else if (strcmp (attribute, GmSensitive) == 0) + return (Ga_Sensitive); + else if (strcmp (attribute, GmAutoRedraw) == 0) + return (Ga_AutoRedraw); + else if (strcmp (attribute, GmTranslations) == 0) + return (Ga_Translations); + else if (strcmp (attribute, GmX) == 0) + return (Ga_X); + else if (strcmp (attribute, GmY) == 0) + return (Ga_Y); + else if (strcmp (attribute, GmWidth) == 0) + return (Ga_Width); + else if (strcmp (attribute, GmHeight) == 0) + return (Ga_Height); + else if (strcmp (attribute, GmRotangle) == 0) + return (Ga_Rotangle); + else if (strcmp (attribute, GmHighlightColor) == 0) + return (Ga_HighlightColor); + else if (strcmp (attribute, GmLineColor) == 0) + return (Ga_LineColor); + else if (strcmp (attribute, GmLineWidth) == 0) + return (Ga_LineWidth); + else if (strcmp (attribute, GmLineStyle) == 0) + return (Ga_LineStyle); + else if (strcmp (attribute, GmKnotColor) == 0) + return (Ga_KnotColor); + else if (strcmp (attribute, GmKnotSize) == 0) + return (Ga_KnotSize); + else if (strcmp (attribute, GmFill) == 0) + return (Ga_Fill); + else if (strcmp (attribute, GmFillColor) == 0) + return (Ga_FillColor); + else if (strcmp (attribute, GmFillBgColor) == 0) + return (Ga_FillBgColor); + else if (strcmp (attribute, GmFillPattern) == 0) + return (Ga_FillPattern); + else if (strcmp (attribute, GmFillStyle) == 0) + return (Ga_FillStyle); + else if (strcmp (attribute, GmTextColor) == 0) + return (Ga_TextColor); + else if (strcmp (attribute, GmTextBgColor) == 0) + return (Ga_TextBgColor); + else if (strcmp (attribute, GmTextBorder) == 0) + return (Ga_TextBorder); + else if (strcmp (attribute, GmImageText) == 0) + return (Ga_ImageText); + else if (strcmp (attribute, GmFont) == 0) + return (Ga_Font); + else if (strcmp (attribute, GmText) == 0) + return (Ga_Text); + else + return (ERR); +} + +static void +gm_linkafter (gm, prev) + register Marker gm; + register Marker prev; +{ + register GtermWidget w = gm->w; + + gm->prev = prev; + gm->next = prev ? prev->next : NULL; + if (prev) + prev->next = gm; + + if (!w->gterm.gm_tail || prev == w->gterm.gm_tail) + w->gterm.gm_tail = gm; + if (!w->gterm.gm_head) + w->gterm.gm_head = gm; + + w->gterm.preserve_screen++; +} + + +static void +gm_unlink (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + + if (gm->prev) + gm->prev->next = gm->next; + if (gm->next) + gm->next->prev = gm->prev; + if (w->gterm.gm_head == gm) + w->gterm.gm_head = gm->next; + if (w->gterm.gm_tail == gm) + w->gterm.gm_tail = gm->prev; + + gm->prev = gm->next = NULL; + if (!w->gterm.gm_head) + w->gterm.preserve_screen = 0; +} + + +/* gm_do_callbacks -- Call any client callbacks registered for the given + * event type. + */ +static int +gm_do_callbacks (gm, events, event, params, nparams) + Marker gm; + register int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + register int n; + register struct markerCallback *cb; + struct markerCallback callback[GM_MAXCALLBACKS]; + int ncallbacks, status; + + /* Copy the callbacks list into local memory to ensure that it is not + * changed by executing a callback. + */ + ncallbacks = gm->ncallbacks; + memmove ((char *)callback, (char *)gm->callback, + sizeof (struct markerCallback) * GM_MAXCALLBACKS); + + for (n = ncallbacks, cb = callback; --n >= 0; cb++) + if (cb->events & events) { + status = cb->func (cb->client_data, + gm, events, event, params, nparams); + if (status) + return (status); + } + + return (0); +} + + +/* gm_constraint -- Handle the constraint callback. This is a client + * callback called when a marker position or size attribute is changed + * interactively at runtime. The purpose of the callback is to allow the + * client to apply any constraints, e.g. to keep the marker within a + * certain area or range of sizes, to forbid rotation, and so on. + */ +static int +gm_constraint (gm, new_gm, what) + register Marker gm, new_gm; + register int what; +{ + register char *ip, *op; + char argbuf[2048]; + char *argv[30]; + int argc = 0; + + /* Return immediately if there are no constraint callbacks. */ + if (!gm->constraints) + return; + + /* Prepare an argument list listing the marker attributes being changed + * and their old and new values. Each attribute is passed as three + * arg strings: name old-value new-value. Each argument string is + * allocated a fixed amount of space of SZ_NUMBER characters. + */ + op = argbuf; + if (what & Gb_X) { + strcpy (argv[argc++]=op, "x"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->x); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->x); op += SZ_NUMBER; + } + if (what & Gb_Y) { + strcpy (argv[argc++]=op, "y"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->y); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->y); op += SZ_NUMBER; + } + if (what & Gb_Width) { + strcpy (argv[argc++]=op, "width"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->width); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->width); op += SZ_NUMBER; + } + if (what & Gb_Height) { + strcpy (argv[argc++]=op, "height"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->height); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->height); op += SZ_NUMBER; + } + if (what & Gb_Rotangle) { + strcpy (argv[argc++]=op, "rotangle"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", gm->rotangle); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", new_gm->rotangle); op += SZ_NUMBER; + } + + /* Call any constraint callbacks. The argv value strings are modified + * in place. + */ + gm_do_callbacks (gm, GmEvConstraint, NULL, argv, argc); + + /* Copy the possibly edited values back into the new_gm struct. + */ + ip = argbuf + SZ_NUMBER * 2; + if (what & Gb_X) { + new_gm->x = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Y) { + new_gm->y = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Width) { + new_gm->width = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Height) { + new_gm->height = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Rotangle) { + new_gm->rotangle = atof (ip); ip += SZ_NUMBER*3; + } +} + + +static void +gm_erase (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register XRectangle *r = &gm->old_rect; + + if (!XtIsRealized ((Widget)w)) + return; + + /* Any clipping to the marker border is set outside this routine. */ + if ((gm->flags & Gm_Visible) && !NullRect(r)) + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, r->x, r->y, r->width, r->height, r->x, r->y); +} + + +/* Marker actions. + * ------------------------- + */ + + +/* M_create -- Create a marker. + */ +static void +M_create (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int interactive, type; + gmSelection what; + + savepos (w, event); + + /* If the marker has already been created in interactive mode the event + * merely initializes the marker, otherwise we create and initialize a + * new marker. + */ + if (!(gm = w->gterm.gm_create)) { + type = w->gterm.gm_defaultType; + if (*nparams == 1) { + if (!(type = GmStrToType (params[0]))) + type = w->gterm.gm_defaultType; + } + gm = GmCreate (w, type, interactive=True); + } + + gm->x = ev->x; + gm->y = ev->y; + gm->flags |= Gm_Activated; + w->gterm.gm_create = NULL; + + what.type = (gm->type == Gm_Polygon) ? Ge_Marker : Ge_Point; + what.vertex = 0; + gm_focusin (w, gm, &what); +} + + +/* M_destroy -- Destroy a marker. + */ +static void +M_destroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmDestroy (gm); +} + + +/* M_destroyNull -- Destroy a marker if it is null sized. + */ +static void +M_destroyNull (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (gm && gm->width <= 2 && gm->height <= 2) + GmDestroy (gm); +} + + +/* M_set -- Set a marker attribute. + */ +static void +M_set (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0; i < *nparams; i += 2) + GmSetAttribute (gm, + (XtArgVal)params[i], (XtArgVal)params[i+1], XtRString); +} + + +/* M_raise -- Raise a marker to the top of the display list. + */ +static void +M_raise (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmRaise (gm, NULL); +} + + +/* M_lower -- Lower a marker to the bottom of the display list. + */ +static void +M_lower (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmLower (gm, NULL); +} + + +/* M_notify -- Notify any clients that have registered callbacks for the + * specified type of events. + */ +static void +M_notify (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int events, i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0, events=0; i < *nparams; i++) + if (strcmp (params[i], "notify") == 0) + events |= GmEvNotify; + else if (strcmp (params[i], "moveResize") == 0) + events |= GmEvMoveResize; + else if (strcmp (params[i], "modify") == 0) + events |= GmEvModify; + else if (strcmp (params[i], "redraw") == 0) + events |= GmEvRedraw; + else if (strcmp (params[i], "destroy") == 0) + events |= GmEvDestroy; + else if (strcmp (params[i], "input") == 0) + events |= GmEvInput; + else if (strcmp (params[i], "focusIn") == 0) + events |= GmEvFocusIn; + else if (strcmp (params[i], "focusOut") == 0) + events |= GmEvFocusOut; + + GmNotify (gm, events, event, params + 1, *nparams - 1); +} + + +/* M_input -- Notify any clients that have registered a input callback + * that a input event has occurred. + */ +static void +M_input (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register Marker gm; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmNotify (gm, GmEvInput, event, params, *nparams); +} + + +/* M_markpos -- Mark the current position of the marker, e.g., so that it + * can later be erased. + */ +static void +M_markpos (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmMarkpos (gm); +} + + +/* M_markposAdd -- Execute either the markpos or add action, depending upon + * the pointer location. If the pointer is over an active marker at a + * location where the add action can be executed this is done, otherwise the + * markpos action is executed. + */ +static void +M_markposAdd (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Get marker and type of active portion of marker. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Always do a markpos whether we Add or not. */ + GmMarkpos (gm); + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_redraw -- Redraw a marker. + */ +static void +M_redraw (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int erase; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + /* This redraw undoes the final Xor draw. */ + GmRedraw (gm, GXxor, erase=False); + + /* Redraw the full marker. */ + GmRedraw (gm, GXcopy, erase=True); +} + + +/* M_addPt -- Add a point. + */ +static void +M_addPt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_deletePt -- Delete a point. + */ +static void +M_deletePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (what->type == Ge_Point) + GmDeletePt (gm, ev->x, ev->y); +} + + +/* M_movePt -- Move a point. + */ +static void +M_movePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Move a point (vertex) if supported by marker type. */ + if (what->type == Ge_Point && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmMovePt (gm, ev->x, ev->y); +} + + +/* M_deleteDestroy -- Delete a point or destroy a marker, depending upon the + * pointer position. + */ +static void +M_deleteDestroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + switch (what->type) { + case Ge_Point: + GmDeletePt (gm, ev->x, ev->y); + break; + case Ge_Marker: + GmDestroy (gm); + break; + } +} + + +/* M_move -- Move a marker. + */ +static void +M_move (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmMove (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_resize -- Resize a marker. + */ +static void +M_resize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmResize (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_moveResize -- Move a point or marker, or resize a marker, depending + * upon the pointer position. + */ +static void +M_moveResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Marker: + GmMove (gm, ev->x, ev->y); + break; + case Ge_Point: + if (gm->type == Gm_Polygon || gm->type == Gm_Polyline) + GmMovePt (gm, ev->x, ev->y); + else + goto resize; + break; + case Ge_Edge: +resize: GmResize (gm, ev->x, ev->y); + break; + } + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotate -- Rotate a marker. + */ +static void +M_rotate (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmRotate (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotateResize -- Rotate or resize a marker. + */ +static void +M_rotateResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Point: + GmRotate (gm, ev->x, ev->y); + break; + case Ge_Edge: + if (gm->flags & Gm_Smooth) + GmRotate (gm, ev->x, ev->y); + else + GmResize (gm, ev->x, ev->y); + break; + default: + GmResize (gm, ev->x, ev->y); + break; + } + + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* + * Marker class code. + * --------------------- + * Each marker class implements a subset of the following procedures. The + * first set of procedures are required. The second set are optional and + * may be set to NULL in the marker descriptor if not implemented by the + * marker class. + * + * gm_xxxx_init (gm, interactive) + * bool = gm_xxxx_select (gm, x, y, &what) + * gm_xxxx_markpos (gm) + * gm_xxxx_redraw (gm, func) + * gm_xxxx_update (gm) + * + * gm_xxxx_addPt (gm, x, y) + * gm_xxxx_deletePt (gm, x, y) + * gm_xxxx_movePt (gm, x, y) + * gm_xxxx_move (gm, x, y) + * gm_xxxx_resize (gm, x, y) + * gm_xxxx_rotate (gm, x, y) + * + * where xxxx is the 4 character marker class name. + */ + +/* Marker class TEXT. + */ +static int gm_text_select(); +static void gm_text_move(), gm_text_resize(); +static void gm_text_markpos(), gm_text_redraw(); +static void gm_text_update(), gm_text_updatePolygon(); + +static void +gm_text_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Text; + if (!(gm->flags & Gm_Activated)) { + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_TextLineColor; + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->textColor = w->gterm.gm_TextColor; + gm->textBgColor = w->gterm.gm_TextBgColor; + gm->textBorder = w->gterm.gm_TextBorder; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->font = w->gterm.gm_TextFont; + gm->imageText = False; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->npoints = 4 + 1; + gm->points = gm->point_data; + + gm->select = gm_text_select; + gm->markpos = gm_text_markpos; + gm->redraw = gm_text_redraw; + gm->update = gm_text_update; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_text_move; + gm->resize = gm_text_resize; + gm->rotate = NULL; + + if (w->gterm.gm_TextString) { + if (gm->text) + XtFree (gm->text); + gm->text = (char *) XtMalloc (strlen(w->gterm.gm_TextString)+1); + strcpy (gm->text, w->gterm.gm_TextString); + } else + gm->text = NULL; +} + +static int +gm_text_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + + +static void +gm_text_markpos (gm) + register Marker gm; +{ + gm_markpos (gm); +} + + +static void +gm_text_redraw (gm, function) + register Marker gm; + int function; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + int char_width, char_height, xsize, ysize; + int breakline, l_pix, r_pix, maxch, x, y; + XFontStruct *fp = gm->font; + char *ip, *op, *otop; + char *l_ip, *l_op; + char line[1024]; + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + /* In rubber-band mode just draw the outline of the text region. */ + if (function == GXxor) { + int save_lineWidth = gm->lineWidth; + + if (gm->lineWidth <= 0) + gm->lineWidth = 1; + gm_redraw (gm, function); + gm->lineWidth = save_lineWidth; + return; + } + + /* General case. First draw the text box. */ + gm_redraw (gm, function); + + /* Now draw the text. */ + if (!gm->text) + return; + + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + xsize = gm->width; + ysize = gm->height; + + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + if ((maxch = (xsize - l_pix - r_pix) / char_width) < 1) + return; + + x = gm->x + (gm->lineWidth + 1) / 2 + gm->textBorder + 1; + y = gm->y + (gm->lineWidth + 1) / 2 + gm->textBorder + + fp->max_bounds.ascent; + + XSetForeground (w->gterm.display, w->gterm.gm_drawGC, gm->textColor); + XSetBackground (w->gterm.display, w->gterm.gm_drawGC, gm->textBgColor); + XSetFont (w->gterm.display, w->gterm.gm_drawGC, fp->fid); + + /* Fill lines in a multiline text box. + */ + l_ip = l_op = NULL; + otop = line + maxch; + breakline = 0; + + for (ip = gm->text, op=line; *ip || op > line; ) { + if (! *ip) { + breakline++; + } else if (*ip == ' ' || *ip == '\t') { + l_ip = ip; + l_op = op; + *op++ = ' '; + ip++; + } else if (*ip == '\n') { + ip++; + breakline++; + } else + *op++ = *ip++; + + if (breakline || op > otop) { + if (op > otop) { + if (l_ip && l_op) { + ip = l_ip + 1; + *l_op = '\0'; + } else { + while (op > otop) { + if (ip > gm->text && isprint (*(ip-1))) + --ip; + --op; + } + *op = '\0'; + } + } else + *op = '\0'; + + if (gm->imageText) { + while (op < otop) + *op++ = ' '; + *op = '\0'; + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } else { + XDrawString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } + + y += char_height; + if (breakline) + y += gm->textBorder; + if (y + fp->max_bounds.descent > gm->y + ysize) + break; + + op = line; + l_ip = l_op = NULL; + breakline = 0; + } + } +} + + +static void +gm_text_update (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + if (gm->flags & Gm_Modified) { + gm_text_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_text_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = max (0, x - gm->width / 2); + new_gm.y = max (0, y - gm->height / 2); + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); /* corner */ + + gm->x = new_gm.x; + gm->y = new_gm.y; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = abs (x - gm->x); + new_gm.height = abs (y - gm->y); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = new_gm.width; + gm->height = new_gm.height; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_updatePolygon (gm) + register Marker gm; +{ + register XPoint *p = gm->points; + int xsize = gm->width; + int ysize = gm->height; + + p[0].x = gm->x; p[0].y = gm->y; + p[1].x = gm->x; p[1].y = gm->y + ysize; + p[2].x = gm->x + xsize; p[2].y = gm->y + ysize; + p[3].x = gm->x + xsize; p[3].y = gm->y; + p[4].x = gm->x; p[4].y = gm->y; +} + + +/* Marker class LINE. + */ +static void +gm_line_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Line; + /* stub out for now */ +} + + +/* Marker class POLYLINE. + */ +static void +gm_plin_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Polyline; + /* stub out for now */ +} + + +/* Marker class RECTANGLE. + */ +static int gm_rect_select(); +static void gm_rect_move(), gm_rect_resize(), gm_rect_rotate(); +static void gm_rect_update(), gm_rect_updatePolygon(); + +static void +gm_rect_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Rectangle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_rect_select; + gm->markpos = gm_markpos; + gm->update = gm_rect_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_rect_move; + gm->resize = gm_rect_resize; + gm->rotate = gm_rect_rotate; +} + +static void +gm_rect_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_rect_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_rect_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_resize (gm, x, y) + register Marker gm; + int x, y; +{ + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + if (rx < 0) + new_gm.x = gm->x - (-rx - gm->width) / 2; + else + new_gm.x = gm->x + (rx - gm->width) / 2; + + if (ry < 0) + new_gm.y = gm->y - (-ry - gm->height) / 2; + else + new_gm.y = gm->y + (ry - gm->height) / 2; + + new_gm.width = gm->width + (abs(rx) - gm->width) / 2; + new_gm.height = gm->height + (abs(ry) - gm->height) / 2; + + gm_constraint (gm, &new_gm, Gb_X|Gb_Y|Gb_Width|Gb_Height); + gm->x = new_gm.x; + gm->y = new_gm.y; + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_rect_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class BOX. A box marker is like a rectangle except that it is + * described and resized by the center and radius (width/height), like + * the other "centered" marker types (circle, ellipse, etc.). + */ +static int gm_boxx_select(); +static void gm_boxx_move(), gm_boxx_resize(), gm_boxx_rotate(); +static void gm_boxx_update(), gm_boxx_updatePolygon(); + +static void +gm_boxx_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Box; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_boxx_select; + gm->markpos = gm_markpos; + gm->update = gm_boxx_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_boxx_move; + gm->resize = gm_boxx_resize; + gm->rotate = gm_boxx_rotate; +} + +static void +gm_boxx_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_boxx_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_boxx_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_resize (gm, x, y) + register Marker gm; + int x, y; +{ + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_boxx_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class CIRCLE. + */ +static int gm_circ_select(); +static void gm_circ_move(), gm_circ_resize(), gm_circ_rotate(); +static void gm_circ_update(), gm_circ_updatePolygon(); + +static void +gm_circ_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Circle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_CircleLineColor; + gm->knotColor = w->gterm.gm_CircleKnotColor; + gm->knotSize = w->gterm.gm_CircleKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + gm->width = gm->height = (gm->width + gm->height) / 2.0; + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE + 1; + + gm->select = gm_circ_select; + gm->markpos = gm_markpos; + gm->update = gm_circ_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_circ_move; + gm->resize = gm_circ_resize; + gm->rotate = NULL; +} + +static void +gm_circ_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_circ_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_circ_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = new_gm.height = + sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = gm->height = new_gm.width; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double theta, x, y; + + npts = (gm->npoints - 1) / 4; + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x + gm->x; + p[npts*0+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x + gm->x; + p[npts*1+j].y = y + gm->y; + + y = -y; j = i; + p[npts*2+j].x = x + gm->x; + p[npts*2+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x + gm->x; + p[npts*3+j].y = y + gm->y; + } + + p[gm->npoints-1] = p[0]; +} + + +/* Marker class ELLIPSE. + */ +static int gm_elip_select(); +static void gm_elip_move(), gm_elip_resize(), gm_elip_rotate(); +static void gm_elip_update(), gm_elip_updatePolygon(); + +static void +gm_elip_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Ellipse; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_EllipseLineColor; + gm->knotColor = w->gterm.gm_EllipseKnotColor; + gm->knotSize = w->gterm.gm_EllipseKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE + 1; + + gm->select = gm_elip_select; + gm->markpos = gm_markpos; + gm->update = gm_elip_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_elip_move; + gm->resize = gm_elip_resize; + gm->rotate = gm_elip_rotate; +} + +static void +gm_elip_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_elip_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_elip_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta = -(gm->rotangle); + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos(theta) - y * sin(theta); + ry = x * sin(theta) + y * cos(theta); + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + new_gm.rotangle = gm_niceAngle (theta); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_elip_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double cos_rotangle, sin_rotangle; + double theta, x, y; + + npts = (gm->npoints - 1) / 4; + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*0+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*1+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; j = i; + p[npts*2+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*2+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*3+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + } + + p[gm->npoints-1] = p[0]; +} + + +/* Marker class POLYGON. + */ +static int gm_pgon_select(); +static void gm_pgon_addPt(), gm_pgon_deletePt(), gm_pgon_movePt(); +static void gm_pgon_move(), gm_pgon_resize(), gm_pgon_rotate(); +static void gm_pgon_redraw(), gm_pgon_update(), gm_pgon_updatePolygon(); + +static void +gm_pgon_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + register DPoint *p; + + gm->type = Gm_Polygon; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_PgonLineColor; + gm->knotColor = w->gterm.gm_PgonKnotColor; + gm->knotSize = w->gterm.gm_PgonKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + + gm->npoints = gm->pgon_npts = 4 + 1; + gm->points = gm->point_data; + if (gm->pgon) + XtFree ((char *)gm->pgon); + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + gm->x = w->gterm.last_x; + gm->y = w->gterm.last_y; + + if (p) { + p[0].x = -1; p[0].y = -1; + p[1].x = -1; p[1].y = 1; + p[2].x = 1; p[2].y = 1; + p[3].x = 1; p[3].y = -1; + p[4].x = -1; p[4].y = -1; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + + if (interactive) + gm->flags |= Gm_PgonInit; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + /* The following gets executed when an existing non-polygon marker is + * turned into a polygon marker. + */ + if (gm->pgon && gm->pgon_npts) + gm->npoints = gm->pgon_npts; + else { + gm->npoints = gm->pgon_npts = 4 + 1; + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + + if (p) { + p[0].x = -gm->width; p[0].y = -gm->height; + p[1].x = -gm->width; p[1].y = gm->height; + p[2].x = gm->width; p[2].y = gm->height; + p[3].x = gm->width; p[3].y = -gm->height; + p[4].x = -gm->width; p[4].y = -gm->height; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + } + + gm->select = gm_select; + gm->markpos = gm_markpos; + gm->update = gm_pgon_update; + gm->redraw = gm_pgon_redraw; + gm->addPt = gm_pgon_addPt; + gm->deletePt = gm_pgon_deletePt; + gm->movePt = gm_pgon_movePt; + gm->move = gm_pgon_move; + gm->resize = gm_pgon_resize; + gm->rotate = gm_pgon_rotate; +} + +static void +gm_pgon_redraw (gm, function) + register Marker gm; + int function; +{ + /* The PgonInit flag is set when a polygon marker is interactively created + * to cause any pointer motion event to resize the marker. The first + * pointer up causes a redraw which clears the flag. + */ + if (function != GXxor && gm->width > 1 && gm->height > 1) + gm->flags &= ~Gm_PgonInit; + + gm_redraw (gm, function); +} + +static void +gm_pgon_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_pgon_addPt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + int vertex, nbytes; + double rx, ry; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Add the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + nbytes = (gm->npoints + 1) * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + + gm->pgon = pv; + memmove (&pv[vertex+2], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + pv[vertex+1].x = rx; + pv[vertex+1].y = ry; + gm->npoints++; + + nbytes = gm->npoints * sizeof (XPoint); + if (gm->npoints > GM_MAXVERTICES) { + if (gm->points != gm->point_data) + gm->points = (XPoint *) XtRealloc ((char *)gm->points, nbytes); + else + gm->points = (XPoint *) XtMalloc (nbytes); + } else + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_deletePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + int vertex, nbytes; + + if (gm->npoints <= 2) + return; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Delete the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + pv = gm->pgon; + + memmove (&pv[vertex], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + gm->npoints--; + + nbytes = gm->npoints * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + gm->pgon = pv; + + if (gm->npoints <= GM_MAXVERTICES && gm->points != gm->point_data) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_movePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double rx, ry; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get vertex. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + + /* Edit point. */ + p->x = rx; + p->y = ry; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + gm->x = new_gm.x; gm->y = new_gm.y; + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_resize (gm, x, y) + Marker gm; + int x, y; +{ + register DPoint *p, *q; + GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double theta, scale, slope, rx, ry, x1, y1, x2, y2, xi; + int vertex, i; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get first vertex of nearest edge. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + q = p + 1; + + /* Rotate reference frame so that intercept is at y=0. */ + if (abs(rx) + abs(ry) < 1.0) + scale = 1.0; + else { + theta = atan2 (ry, rx); + cos_rotangle = cos (-theta); + sin_rotangle = sin (-theta); + + x1 = p->x * cos_rotangle - p->y * sin_rotangle; + y1 = p->x * sin_rotangle + p->y * cos_rotangle; + x2 = q->x * cos_rotangle - q->y * sin_rotangle; + y2 = q->x * sin_rotangle + q->y * cos_rotangle; + + /* Compute scale factor. */ + if (y1 == y2 || x1 == x2) + scale = 1.0; + else { + slope = (y2 - y1) / (x2 - x1); + xi = x1 - y1 / slope; + scale = sqrt (SQR(rx) + SQR(ry)) / xi; + } + } + + /* Rescale the polygon. */ + for (i=0, p=gm->pgon; i < gm->npoints; i++, p++) { + p->x *= scale; + p->y *= scale; + } + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double scale, alpha, beta, rx, ry; + struct marker new_gm; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + if (x == gm->x && y == gm->y) + return; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + if (abs(rx) + abs(ry) < 1.0) + return; + + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + + p = &gm->pgon[vertex]; + alpha = atan2 (p->y, p->x); + beta = atan2 (ry, rx); + + new_gm.rotangle = gm_niceAngle (gm->rotangle + (beta - alpha)); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm->rotangle = new_gm.rotangle; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_updatePolygon (gm) + Marker gm; +{ + register npts, i; + register DPoint *ip = gm->pgon; + register XPoint *op = gm->points; + double cos_rotangle, sin_rotangle; + int width, height, xp, xn, yp, yn; + + npts = gm->npoints; + cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); + xp = xn = yp = yn = 0; + + for (i=0; i < npts; i++, ip++, op++) { + /* Compute the rotated point. */ + op->x = ip->x * cos_rotangle - ip->y * sin_rotangle + gm->x + 0.5; + op->y = ip->x * sin_rotangle + ip->y * cos_rotangle + gm->y + 0.5; + + /* Compute a width/height estimate for the polygon. + */ + if (ip->x > xp) + xp = ip->x; + else if (ip->x < xn) + xn = ip->x; + + if (ip->y > yp) + yp = ip->y; + else if (ip->y < yn) + yn = ip->y; + + gm->width = (xp + -xn) / 2; + gm->height = (yp + -yn) / 2; + } + + gm->points[npts-1] = gm->points[0]; + gm->pgon_npts = gm->npoints; +} + + +/* Internal procedures for above code. + * ----------------------------------- + */ + +/* gm_select -- Determine if a point is within or near a marker, and if so, + * determine whether the point selects a vertex, edge, or the entire marker. + */ +static int +gm_select (gm, x, y, what) + Marker gm; + register int x, y; + GmSelection what; +{ + register XPoint *p, *ptop; + GtermWidget w = gm->w; + int v_dist = w->gterm.gm_nearVertex; + int e_dist = w->gterm.gm_nearEdge; + double seglen, d1, d2, s, K, frac; + int ncrossings, x0, y0; + XPoint *q; + int n; + + /* Determine if the point is near a vertex. */ + for (p = gm->points, n = gm->npoints - 1; --n >= 0; p++) + if (abs (x - p->x) < v_dist && abs (y - p->y) < v_dist) { + if (what) { + what->type = Ge_Point; + what->vertex = p - gm->points; + } + return (1); + } + + /* Determine if the point is near an edge. The test is based on the + * observation that when a point is near a line segment, the sum of the + * distances from the point to either end-point of the line segment is + * nearly the same as the length of the line segment. + */ + p = gm->points; + ptop = p + gm->npoints; + x0 = p->x; y0 = p->y; + d1 = sqrt ((double)(SQR(x - x0) + SQR(y - y0))); + + for (p++; p < ptop; p++) { + seglen = sqrt ((double)(SQR(p->x - x0) + SQR(p->y - y0))); + d2 = sqrt ((double)(SQR(x - p->x) + SQR(y - p->y))); + + if (d1 + d2 - seglen < e_dist) { + if (what) { + what->type = Ge_Edge; + what->vertex = (p - 1) - gm->points; + } + return (1); + } + + d1 = d2; + x0 = p->x; y0 = p->y; + } + + /* If the marker is one of the closed polygon types, determine if the + * point is inside the marker. + */ + switch (gm->type) { + case Gm_Line: + case Gm_Polyline: + return (0); + } + + for (p = gm->points, ncrossings=0; p < ptop; p++) { + /* Scan forward until we find a line segment that crosses Y. + */ + if (p->y > y) { + for (p++; p < ptop && p->y >= y; p++) + ; + --p; + } else if (p->y < y) { + for (p++; p < ptop && p->y <= y; p++) + ; + --p; + } + + /* The line segment p[0]:p[1] crosses the Y plane. If this lies + * entirely to the left of the X plane we can ignore it. If any + * portion of the line segment lies to the right of X we compute + * the point where the line intersects the Y plane. If this point + * is to the right of the X plane we have a crossing. + */ + q = p + 1; + if (q < ptop && p->x > x || q->x > x) { + if (q->y == p->y) + frac = (double) 0.0; + else + frac = (double)(y - p->y) / (double)(q->y - p->y); + if ((frac * (q->x - p->x) + p->x) >= x) + ncrossings++; + } + } + + if (ncrossings & 1) { + if (what) + what->type = Ge_Marker; + return (1); + } + + return (0); +} + + +/* gm_markpos -- Mark the current position of a marker. + */ +static void +gm_markpos (gm) + register Marker gm; +{ + gm->old_rect = gm->cur_rect; + XUnionRegion (gm->cur_region, null_region, gm->old_region); +} + + +/* gm_redraw -- Redraw a marker expressed as a list of vertices. + */ +static void +gm_redraw (gm, function) + register Marker gm; + int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + int flags = (Gm_Activated|Gm_Visible); + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!XtIsRealized ((Widget)w)) + return; + if (!((gm->flags & flags) == flags)) + return; + + /* Fill the polygon area if indicated. */ + if (gm->fill && function != GXxor) { + if (gm->fillPattern) { + XSetStipple (display, gc, gm->fillPattern); + XSetForeground (display, gc, gm->fillColor); + XSetBackground (display, gc, gm->fillBgColor); + XSetFillStyle (display, gc, gm->fillStyle); + } else { + XSetForeground (display, gc, gm->fillColor); + XSetFillStyle (display, gc, FillSolid); + } + + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Nonconvex, CoordModeOrigin); + } + + /* Set up the drawing GC. */ + if (function != GXxor) { + XSetFunction (display, gc, function); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, (gm == w->gterm.gm_active) ? + gm->highlightColor : gm->lineColor); + + XSetLineAttributes (display, gc, + gm->lineWidth + + ((gm == w->gterm.gm_active) ? w->gterm.gm_highlightWidth : 0), + gm->lineStyle, + CapButt, + (gm->type == Gm_Polygon || gm->type == Gm_Polyline) ? + JoinBevel : JoinMiter); + } + + /* Draw the marker outline. */ + if (gm->lineWidth > 0) { + if (gm->type == Gm_Circle || + (gm->type == Gm_Ellipse && abs(gm->rotangle) < 0.01)) { + + /* Special case - use X arc drawing primitive. We could use the + * gm->points polygon instead, as this outline polygon is + * maintained for all classes of marker. + */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + } + XDrawArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + + } else { + /* Draw marker expressed as a polygon. */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Convex, CoordModeOrigin); + } + XDrawLines (display, window, gc, + gm->points, gm->npoints, CoordModeOrigin); + } + } + + /* Draw the knots if enabled. */ + if (function != GXxor && gm->knotSize > 0) { + int knotsize = gm->knotSize; + int halfsize = gm->knotSize / 2; + int i; + + XSetForeground (display, gc, gm->knotColor); + for (i=0; i < gm->npoints; i++) { + XFillRectangle (display, window, gc, + gm->points[i].x - halfsize, gm->points[i].y - halfsize, + gm->knotSize, gm->knotSize); + } + } +} + + +/* gm_setCurRect -- Compute a bounding rectangle which completely encloses + * a marker (assumes that the marker is expressed as list of points). + */ +static void +gm_setCurRect (gm) +Marker gm; +{ + int border; + + XDestroyRegion (gm->cur_region); + gm->cur_rect = null_rect; + + if (gm->npoints <= 0) + gm->cur_region = XCreateRegion(); + else { + gm->cur_region = XPolygonRegion (gm->points, gm->npoints, EvenOddRule); + border = (max (gm->lineWidth, gm->knotSize) + 1) / 2; + border = max (border, BORDER); + XShrinkRegion (gm->cur_region, -border, -border); + XClipBox (gm->cur_region, &gm->cur_rect); + } +} + + +/* gm_niceAngle -- Round a rotation angle to a "nice" value. + */ +static double +gm_niceAngle (alpha) + double alpha; +{ + double tol = 0.003; + double beta; + + if ( abs (alpha - PI_2*0) < tol) + beta = PI_2*0; + else if (abs (alpha - PI_2*1) < tol) + beta = PI_2*1; + else if (abs (alpha - PI_2*2) < tol) + beta = PI_2*2; + else if (abs (alpha - PI_2*3) < tol) + beta = PI_2*3; + else if (abs (alpha - PI_2*4) < tol) + beta = PI_2*0; + else + beta = alpha; + + return (beta); +} diff --git a/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.h b/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.h new file mode 100644 index 00000000..575c6f8b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm1.5/Gterm.h @@ -0,0 +1,247 @@ +#ifndef _Gterm_h +#define _Gterm_h + +/* Parameters: +(this is not yet updated for xgterm - the rest of this file is) + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel White + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + foreground Foreground Pixel Black + height Height Dimension 240 + mappedWhenManaged MappedWhenManaged Boolean True + reverseVideo ReverseVideo Boolean False + width Width Dimension 320 + x Position Position 0 + y Position Position 0 + +*/ + +/* + * Resource definitions. + */ +#define XtCInt "Int" + +#define XtNalphaFont1 "alphaFont1" +#define XtNalphaFont2 "alphaFont2" +#define XtNalphaFont3 "alphaFont3" +#define XtNalphaFont4 "alphaFont4" +#define XtNalphaFont5 "alphaFont5" +#define XtNalphaFont6 "alphaFont6" +#define XtNalphaFont7 "alphaFont7" +#define XtNalphaFont8 "alphaFont8" + +#define XtNdialogFont1 "dialogFont1" +#define XtNdialogFont2 "dialogFont2" +#define XtNdialogFont3 "dialogFont3" +#define XtNdialogFont4 "dialogFont4" +#define XtNdialogFont5 "dialogFont5" +#define XtNdialogFont6 "dialogFont6" +#define XtNdialogFont7 "dialogFont7" +#define XtNdialogFont8 "dialogFont8" + +#define XtNdialogBgColor "dialogBgColor" +#define XtNdialogFgColor "dialogFgColor" +#define XtNidleCursorBgColor "idleCursorBgColor" +#define XtNidleCursorFgColor "idleCursorFgColor" +#define XtNbusyCursorBgColor "busyCursorBgColor" +#define XtNbusyCursorFgColor "busyCursorFgColor" +#define XtNginmodeCursorBgColor "ginmodeCursorBgColor" +#define XtNginmodeCursorFgColor "ginmodeCursorFgColor" +#define XtNginmodeBlinkInterval "ginmodeBlinkInterval" +#define XtNcrosshairCursorColor "crosshairCursorColor" + +#define XtNidleCursor "idleCursor" +#define XtNbusyCursor "busyCursor" +#define XtNginmodeCursor "ginmodeCursor" +#define XtNwarpCursor "warpCursor" +#define XtNraiseWindow "raiseWindow" +#define XtNdeiconifyWindow "deiconifyWindow" +#define XtNuseTimers "useTimers" + +#define XtNcolor0 "color0" +#define XtNcolor1 "color1" +#define XtNcolor2 "color2" +#define XtNcolor3 "color3" +#define XtNcolor4 "color4" +#define XtNcolor5 "color5" +#define XtNcolor6 "color6" +#define XtNcolor7 "color7" +#define XtNcolor8 "color8" +#define XtNcolor9 "color9" + +#define XtNcmapName "cmapName" +#define XtNcmapInitialize "cmapInitialize" +#define XtNcopyOnResize "copyOnResize" +#define XtNbasePixel "basePixel" +#define XtNcmapUpdate "cmapUpdate" +#define XtNcmapShadow "cmapShadow" +#define XtNcmapInterpolate "cmapInterpolate" +#define XtNmaxRasters "maxRasters" +#define XtNcacheRasters "cacheRasters" +#define XtNmaxMappings "maxMappings" +#define XtNmaxColors "maxColors" + +#define XtNmarkerTranslations "markerTranslations" +#define XtNdefaultMarker "defaultMarker" +#define XtNnearEdge "nearEdge" +#define XtNnearVertex "nearVertex" +#define XtNmarkerLineWidth "markerLineWidth" +#define XtNmarkerLineStyle "markerLineStyle" +#define XtNmarkerFill "markerFill" +#define XtNmarkerFillColor "markerFillColor" +#define XtNmarkerFillBgColor "markerFillBgColor" +#define XtNmarkerFillStyle "markerFillStyle" +#define XtNxorFill "xorFill" +#define XtNxorFillColor "xorFillColor" +#define XtNxorFillBgColor "xorFillBgColor" +#define XtNmarkerHighlightWidth "markerHighlightWidth" +#define XtNmarkerHighlightColor "markerHighlightColor" +#define XtNmarkerCursorFgColor "markerCursorFgColor" +#define XtNmarkerCursorBgColor "markerCursorBgColor" +#define XtNmarkerLineLineColor "markerLineLineColor" +#define XtNmarkerLineKnotColor "markerLineKnotColor" +#define XtNmarkerLineKnotSize "markerLineKnotSize" +#define XtNmarkerTextLineColor "markerTextLineColor" +#define XtNmarkerTextColor "markerTextColor" +#define XtNmarkerTextBgColor "markerTextBgColor" +#define XtNmarkerTextBorder "markerTextBorder" +#define XtNmarkerTextFont "markerTextFont" +#define XtNmarkerTextString "markerTextString" +#define XtNmarkerRectLineColor "markerRectLineColor" +#define XtNmarkerRectKnotColor "markerRectKnotColor" +#define XtNmarkerRectKnotSize "markerRectKnotSize" +#define XtNmarkerBoxLineColor "markerBoxLineColor" +#define XtNmarkerBoxKnotColor "markerBoxKnotColor" +#define XtNmarkerBoxKnotSize "markerBoxKnotSize" +#define XtNmarkerCircleLineColor "markerCircleLineColor" +#define XtNmarkerCircleKnotColor "markerCircleKnotColor" +#define XtNmarkerCircleKnotSize "markerCircleKnotSize" +#define XtNmarkerEllipseLineColor "markerEllipseLineColor" +#define XtNmarkerEllipseKnotColor "markerEllipseKnotColor" +#define XtNmarkerEllipseKnotSize "markerEllipseKnotSize" +#define XtNmarkerPgonLineColor "markerPgonLineColor" +#define XtNmarkerPgonKnotColor "markerPgonKnotColor" +#define XtNmarkerPgonKnotSize "markerPgonKnotSize" + +/* + * Gterm widget flags. + */ +#define GtSet 1 /* drawing mode */ +#define GtClear 2 +#define GtInvert 3 + +#define GtOutline 1 /* line styles */ +#define GtPoint 2 +#define GtSolid 3 +#define GtDashed 4 +#define GtDotted 5 +#define GtDashDot 6 +#define GtDash3Dot 7 + +#define GtNoCursor 0 /* cursor types */ +#define GtGinmodeCursor 1 +#define GtBusyCursor 2 +#define GtIdleCursor 3 + +#define GtDefault 0 /* raster types */ +#define GtClient 1 +#define GtServer 2 + +#define GtPixel 0 /* coordinate types */ +#define GtNDC 1 + +#define GtMap 0 /* mapping direction */ +#define GtUnmap 1 + +#define GtWindow 0 /* drawable types */ +#define GtWidget 1 + +#define R_OpcodeMask 0000017 /* rasterop definitions */ +#define R_Transient 0000020 +#define R_RefreshAll 0000040 +#define R_RefreshNone 0000100 +#define R_MFMask 0777000 + +#define MF_NEAREST 0001000 /* antialiasing functions */ +#define MF_BILINEAR 0002000 +#define MF_AREA 0004000 +#define MF_BLKAVG 0010000 +#define MF_BOXCAR 0020000 +#define MF_LOWPASS 0040000 +#define MF_GAUSSIAN 0100000 + +#define GmText "text" /* graphics marker types */ +#define GmLine "line" +#define GmPolyline "polyline" +#define GmRectangle "rectangle" +#define GmBox "box" +#define GmCircle "circle" +#define GmEllipse "ellipse" +#define GmPolygon "polygon" + +#define Gm_Text 1 /* integer codes for above */ +#define Gm_Line 2 +#define Gm_Polyline 3 +#define Gm_Rectangle 4 +#define Gm_Box 5 +#define Gm_Circle 6 +#define Gm_Ellipse 7 +#define Gm_Polygon 8 +#define Gm_NTypes 8 + +#define GmType "type" /* marker attributes */ +#define GmActivated "activated" +#define GmVisible "visible" +#define GmSensitive "sensitive" +#define GmAutoRedraw "autoRedraw" +#define GmTranslations "translations" +#define GmX "x" +#define GmY "y" +#define GmWidth "width" +#define GmHeight "height" +#define GmRotangle "rotangle" +#define GmHighlightColor "highlightColor" +#define GmLineColor "lineColor" +#define GmLineWidth "lineWidth" +#define GmLineStyle "lineStyle" +#define GmKnotColor "knotColor" +#define GmKnotSize "knotSize" +#define GmFill "fill" +#define GmFillColor "fillColor" +#define GmFillBgColor "fillBgColor" +#define GmFillPattern "fillPattern" +#define GmFillStyle "fillStyle" +#define GmTextColor "textColor" +#define GmTextBgColor "textBgColor" +#define GmTextBorder "textBorder" +#define GmImageText "imageText" +#define GmFont "font" +#define GmRotIndicator "rotIndicator" /* MF020 */ + +#define GmEvNotify 00001 /* marker callback events */ +#define GmEvMoveResize 00002 +#define GmEvModify 00004 +#define GmEvRedraw 00010 +#define GmEvDestroy 00020 +#define GmEvInput 00040 +#define GmEvFocusIn 00100 +#define GmEvFocusOut 00200 +#define GmEvConstraint 00400 + +/* Double version of XPoint. */ +struct dPoint { + double x; + double y; +}; +typedef struct dPoint DPoint; + +typedef struct _GtermRec *GtermWidget; +typedef struct _GtermClassRec *GtermWidgetClass; + +extern WidgetClass gtermWidgetClass; + +#endif /* _Gterm_h */ diff --git a/vendor/x11iraf/obm/ObmW/Gterm1.5/GtermP.h b/vendor/x11iraf/obm/ObmW/Gterm1.5/GtermP.h new file mode 100644 index 00000000..f86d4e1c --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Gterm1.5/GtermP.h @@ -0,0 +1,524 @@ +#ifndef _GtermP_h +#define _GtermP_h + +#include "Gterm.h" + +/* + * GtermP -- Private definitions for the Gterm graphics widget. + */ + +#define DEF_WIDTH 640 +#define DEF_HEIGHT 480 +#define MAX_RASTERS 512 +#define MAX_MAPPINGS 32 +#define SZ_NUMBER 64 +#define SZ_STATIC_CMAP 10 /* bg+fg+NColors */ +#define MAX_SZCMAP 256 /* max size colormap */ +#define DEF_MAXCOLORS 216 /* max dynamic colors */ +#define MAX_WMWIN 32 /* max WM colormaps */ +#define MAX_REGIONS 64 /* setMapping regions */ +#define MAX_AUXTRANS 8 /* auxiliary translations */ +#define DEF_BASEPIXEL 38 /* base of custom colormap */ +#define DEF_CMAPUPDATE 60 /* seconds */ +#define DEF_CMAPSHADOW 10 /* seconds */ +#define DEF_COPYONRESIZE True /* copy pixmap on resize */ +#define DEF_WARPCURSOR False /* enable warp cursor */ +#define DEF_RAISEWINDOW False /* enable raise window */ +#define DEF_DEICONIFYWINDOW False /* enable deiconfify window */ +#define DEF_USETIMERS True /* ok to use timers */ +#define MAX_DRAW 64 /* max mappings for a draw */ +#define MAX_POINTS 4096 /* max points in polyline */ +#define GM_MAXVERTICES 64 /* max GM points w/o malloc */ +#define GM_NPTSCIRCLE 48 /* npoints circle or ellipse */ +#define GM_MAXCALLBACKS 16 /* max GM callbacks */ +#define GM_UPDATE 30 /* marker update interval */ +#define MAXNDC 32767 /* GKI/NDC scale factor */ +#define V_DIST 4 /* Close to vertex, pixels */ +#define E_DIST 1 /* Close to edge, pixels */ + + +#define RasterDepth 8 +#define NAlphaFonts 8 +#define NDialogFonts 8 +#define NColors 8 + +typedef void (*GmVMethod)(); +typedef int (*GmIMethod)(); +#define uchar unsigned char +#define ushort unsigned short + +/* Raster definitions. */ +#define ImageRaster 1 +#define PixmapRaster 2 + +struct raster { + int type; + int delete; + int width, height; + union { + Pixmap pixmap; + XImage *ximage; + } r; +}; + +/* Colormap structure. */ +struct colormap { + int map; + int ncells; + struct colormap *next; + unsigned short r[MAX_SZCMAP]; + unsigned short g[MAX_SZCMAP]; + unsigned short b[MAX_SZCMAP]; +}; + +/* mapExtent - Range of dst pixels affected by a src pixel. */ +typedef struct { + Position lo; + Position hi; +} mapExtent, *MapExtent; + +/* Mappings map a source to a destination. A src or dst of zero refers to + * the window, a nonzero value is the raster number. + */ +struct mapping { + int mapping; /* mapping number */ + int enabled; /* update destination */ + int defined; /* mapping is defined */ + int updated; /* internal params ready */ + int refresh; /* refresh entire dest */ + int rop; /* rasterop */ + int src; /* source rect */ + int st; + int sx, sy; + int snx, sny; + int dst; /* destination rect */ + int dt; + int dx, dy; + int dnx, dny; + int scaling; /* internal parameters */ + float xscale, yscale; + mapExtent *x_extent, *y_extent; + int *x_srcpix, *y_srcpix; + float *x_src, *y_src; + uchar *mapdata; + int datalen; + struct mapping *prev; /* previous in stack order */ + struct mapping *next; /* next in stack order */ +}; + +#define M_NOSCALING 0 +#define M_ZOOM 1 +#define M_INTZOOM 2 +#define M_DEZOOM 3 + +/* The drawing context defines what happens when a drawing operation (e.g. + * polyline) takes place. In the simplest case (raster=0) one simply draws + * into the display window with no transformation or clipping. When a + * raster provides the drawing context, the graphics are drawn once for each + * active mapping defined on the raster, using the scaling and drawable + * defined by the mapping. + */ +struct drawContext { + int valid; + int raster; + struct raster *rp; + int nmappings; + struct mappingContext { + int mapping; + struct mapping *mp; + int scale; + float xoffset, xscale; + float yoffset, yscale; + int use_backing_store; + Pixmap pixmap; + GC drawGC; + int GC_private; + } mapContext[MAX_DRAW]; +}; + +/* Graphics Markers. A marker is an active graphics object displayed on + * top of a drawing to mark a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. + */ + +/* Callback descriptor. */ +struct markerCallback { + int events; + GmIMethod func; + XtPointer client_data; +}; + +/* Marker selection. */ +struct markerSelection { + int type; + int vertex; +}; + +/* Main Marker descriptor. */ +struct marker { + GtermWidget w; /* backpointer to widget */ + int type; /* marker type */ + int flags; /* bitflags */ + int x, y; /* position */ + int width, height; /* size */ + double rotangle; /* orientation */ + XtTranslations translations; /* marker translations */ + XRectangle old_rect; /* old bounding box */ + Region old_region; /* old screen region */ + XRectangle cur_rect; /* current bounding box */ + Region cur_region; /* current screen region */ + Time time; /* time of last marker edit */ + struct marker *next; /* next marker */ + struct marker *prev; /* previous marker */ + struct marker *parent; /* set if copy */ + + int lineColor, lineWidth, lineStyle; /* marker attributes */ + int highlightColor; + int knotColor, knotSize; + int fill, fillStyle; + int fillColor, fillBgColor; + Pixmap fillPattern; + int imageText, textBorder; + int textColor, textBgColor; + int rotIndicator; /* MF020 */ + XFontStruct *font; + + int npoints; /* marker data */ + XPoint *points; + XPoint point_data[GM_MAXVERTICES+1]; + struct dPoint *pgon; + int pgon_npts; + char *text; + + GmIMethod select; /* class methods */ + GmVMethod markpos; + GmVMethod redraw; + GmVMethod update; + GmVMethod addPt; + GmVMethod deletePt; + GmVMethod movePt; + GmVMethod move; + GmVMethod resize; + GmVMethod rotate; + + int ncallbacks; /* callbacks */ + struct markerCallback callback[GM_MAXCALLBACKS]; + XtIntervalId focus_id; + int constraints; +}; + +/* Graphics marker bitflags. */ +#define Gm_Activated 000001 +#define Gm_Visible 000002 +#define Gm_Sensitive 000004 +#define Gm_AutoRedraw 000010 +#define Gm_PgonInit 000020 +#define Gm_Smooth 000040 +#define Gm_Modified 000100 +#define Gm_BeingDestroyed 000200 + +/* Attribute value type codes. */ +#define Gt_Bool 1 +#define Gt_Int 2 +#define Gt_DFloatP 3 +#define Gt_Pointer 4 +#define Gt_String 5 + +/* Attribute name codes. */ +#define Ga_Type 1 +#define Ga_Activated 2 +#define Ga_Visible 3 +#define Ga_Sensitive 4 +#define Ga_AutoRedraw 5 +#define Ga_Translations 6 +#define Ga_X 7 +#define Ga_Y 8 +#define Ga_Width 9 +#define Ga_Height 10 +#define Ga_Rotangle 11 +#define Ga_HighlightColor 12 +#define Ga_LineColor 13 +#define Ga_LineWidth 14 +#define Ga_LineStyle 15 +#define Ga_KnotColor 16 +#define Ga_KnotSize 17 +#define Ga_Fill 18 +#define Ga_FillColor 19 +#define Ga_FillBgColor 20 +#define Ga_FillPattern 21 +#define Ga_FillStyle 22 +#define Ga_TextColor 23 +#define Ga_TextBgColor 24 +#define Ga_TextBorder 25 +#define Ga_ImageText 26 +#define Ga_Font 27 +#define Ga_Text 28 +#define Ga_RotIndicator 29 /* MF020 */ + +/* Bitflags for selected attributes. */ +#define Gb_X 00001 +#define Gb_Y 00002 +#define Gb_Width 00004 +#define Gb_Height 00010 +#define Gb_Rotangle 00020 + +/* Codes for marker selection types. */ +#define Ge_Marker 1 +#define Ge_Point 2 +#define Ge_Edge 3 + +/* Auxiliary translation tables. */ +#define T_replace 0 +#define T_augment 1 +#define T_override 2 + +typedef struct raster *Raster; +typedef struct mapping *Mapping; +typedef struct drawContext *DrawContext; +typedef struct mappingContext *MappingContext; +typedef struct marker *Marker; +typedef struct markerSelection gmSelection; +typedef struct markerSelection *GmSelection; + + +/* Gterm callbacks. */ +typedef void (*GtCallbackProc)(); +struct gtCallback { + GtCallbackProc proc; + XtPointer client_data; + struct gtCallback *next; +}; +typedef struct gtCallback GtCallback; + + +/* Main Gterm widget instance descriptor. + */ +typedef struct { + /* resources */ + XFontStruct *alphaFont1; /* graphics fonts */ + XFontStruct *alphaFont2; + XFontStruct *alphaFont3; + XFontStruct *alphaFont4; + XFontStruct *alphaFont5; + XFontStruct *alphaFont6; + XFontStruct *alphaFont7; + XFontStruct *alphaFont8; + + XFontStruct *dialogFont1; /* dialog fonts */ + XFontStruct *dialogFont2; + XFontStruct *dialogFont3; + XFontStruct *dialogFont4; + XFontStruct *dialogFont5; + XFontStruct *dialogFont6; + XFontStruct *dialogFont7; + XFontStruct *dialogFont8; + + Pixel dialogBgColor; /* default colors */ + Pixel dialogFgColor; + Pixel idleCursorBgColor; + Pixel idleCursorFgColor; + Pixel busyCursorBgColor; + Pixel busyCursorFgColor; + Pixel ginmodeCursorBgColor; + Pixel ginmodeCursorFgColor; + int ginmodeBlinkInterval; + XColor ginmodeColors[2]; + Pixel crosshairCursorColor; + String idleCursor; + String busyCursor; + String ginmodeCursor; + Boolean warpCursor; + Boolean raiseWindow; + Boolean deiconifyWindow; + Boolean useTimers; + + Pixel color0; + Pixel color1; + Pixel color2; + Pixel color3; + Pixel color4; + Pixel color5; + Pixel color6; + Pixel color7; + Pixel color8; + Pixel color9; + + String cacheRasters; + int maxRasters; /* raster display stuff */ + int maxMappings; + int maxColors; + + /* private state */ + Display *display; + Screen *screen; + Window window; + Window root; + + int raster; /* used for drawing context */ + int delay; /* wait for display */ + Pixmap pixmap; /* used to refresh window */ + Pixmap d_pixmap; /* used to erase dialog area */ + int d_saved; /* set when d_pixmap filled */ + GC clearGC; /* clear pixmap */ + GC exposeGC; /* copy pixmap to window */ + GC drawGC; /* graphics drawing */ + GC dialogGC; /* dialog box */ + GC cursorGC; /* crosshair cursor */ + int cursor_type; /* type of cursor to display */ + Cursor cursor; /* current cursor */ + int full_crosshair; /* crosshair enabled */ + int preserve_screen; /* cursor preserves screen */ + int preserve_valid; /* saved data is valid */ + Cursor idle_cursor; /* application is idle */ + Cursor busy_cursor; /* application is busy */ + Cursor ginmode_cursor; /* graphics input mode */ + Cursor crosshair_cursor; /* graphics input mode */ + int cursor_drawn; /* crosshair cursor drawn */ + int cur_x, cur_y; /* crosshair cursor coords */ + int old_width, old_height; /* size before resize */ + int save_root; /* root window of saved cur */ + int save_x, save_y; /* saved cursor location */ + int last_x, last_y; /* x,y of last event */ + int interactive; /* set if cursor read */ + int char_size; /* not used */ + int data_level; /* draw or erase graphics */ + int line_style; /* solid or patterned line */ + int line_width; /* width of line in pixels */ + int fill_type; /* not used */ + int color_index; /* current color index */ + int xres, yres; /* tek logical resolution */ + int d_xoff, d_yoff; /* dialog area offset */ + int d_height; /* dialog area height */ + int optcols, optrows; /* optimum screen size, chars */ + int alpha_font; /* current alpha font index */ + int dialog_font; /* current dialog font index */ + + int ncolors; /* current cmap size */ + int haveColormap; /* colormap initialized */ + Boolean copyOnResize; /* copy old pixmap on resize */ + int useDefaultCM; /* use default colormap */ + Pixel base_pixel; /* used for custom colormap */ + String cmapName; /* private colormap name */ + Boolean cmapInitialize; /* forcibly install colormap */ + Atom cmapAtom; /* atom for cmap property */ + int cmapShadow; /* update default colormap */ + Time cmapLastShadow; /* time of last update */ + Boolean cmapInterpolate; /* interpolate colormap */ + int cmapUpdate; /* update interval, seconds */ + Time cmapLastUpdate; /* time of last update */ + Pixel cmap[MAX_SZCMAP]; /* map color number to pixval */ + XColor color[MAX_SZCMAP]; /* RGB color assignments */ + ushort iomap[MAX_SZCMAP]; /* client i/o color map */ + Pixel cmap_in[MAX_SZCMAP]; /* umap and cmap combined */ + Pixel cmap_out[MAX_SZCMAP]; /* umap and cmap combined */ + int cmap_in_valid; /* set when cmap_in computed */ + int cmap_out_valid; /* set when cmap_out computed */ + struct colormap *colormaps; /* list of client colormaps */ + Window wmTop; /* top level window */ + Window wmWindows[MAX_WMWIN]; /* custom colormap windows */ + int n_wmWindows; /* number of WM windows */ + int in_window; /* pointer is in window */ + XWindowAttributes wa; /* window attributes */ + int wa_defined; /* set when above is defined */ + + XFontStruct *alpha_fonts[NAlphaFonts]; /* alpha font index */ + XFontStruct *dialog_fonts[NDialogFonts];/* dialog font index */ + + GtCallback *resetCallback; /* client setGterm callbacks */ + GtCallback *resizeCallback; /* client resize callback */ + GtCallback *inputCallback; /* client event input cb */ + + Raster rasters; /* raster descriptors */ + int nrasters; /* number of alloced rasters */ + Mapping mappings; /* mapping descriptors */ + int nmappings; /* number of mappings */ + Mapping mp_head; /* head of mapping list */ + Mapping mp_tail; /* tail of mapping list */ + struct drawContext draw; /* drawing context */ + + /* Markers */ + Marker gm_head; /* head of marker list */ + Marker gm_tail; /* head of marker list */ + Marker gm_create; /* set if creating marker */ + Marker gm_active; /* marker that has focus */ + gmSelection gm_selection; /* active portion of marker */ + GC gm_drawGC; /* marker drawing GC */ + GC gm_rubberGC; /* marker rubber-band GC */ + Cursor gm_markerCursor; /* pointer in marker */ + Cursor gm_edgeCursor; /* pointer on marker edge */ + Cursor gm_pointCursor; /* pointer near marker point */ + int gm_redisplay; /* redisplay needed */ + int gm_initialized; /* set after init */ + + XtTranslations defTranslations; /* gterm translations */ + XtTranslations auxTrans[MAX_AUXTRANS]; /* auxiliary translations */ + int auxTType[MAX_AUXTRANS]; /* translation type */ + int nauxTrans; /* number of auxilary trans */ + String gm_translations; /* Marker translations */ + XtTranslations gm_defTranslations; /* default marker trans */ + Marker gm_curTranslations; /* current translations */ + Marker gm_reqTranslations; /* requested translations */ + XtIntervalId gm_timer_id; /* translation request timer */ + + String gm_defaultMarker; /* default marker type name */ + int gm_defaultType; /* default marker type */ + int gm_nearEdge; /* defines area near edge */ + int gm_nearVertex; /* defines area near Vertex */ + + int gm_lineWidth; /* shared attributes */ + int gm_lineStyle; + Boolean gm_fill; + Pixel gm_fillColor; + Pixel gm_fillBgColor; + int gm_fillStyle; + Boolean gm_xorFill; /* fill with GXxor */ + int gm_xorFillColor; /* xor-fill color */ + int gm_xorFillBgColor; /* xor-fill background color */ + int gm_highlightWidth; /* highlight width, pixels */ + int gm_highlightColor; /* highlight color */ + Pixel gm_cursorFgColor; /* marker cursors */ + Pixel gm_cursorBgColor; /* marker cursors */ + + Pixel gm_LineLineColor; /* Lines, Polylines */ + Pixel gm_LineKnotColor; + int gm_LineKnotSize; + Pixel gm_TextLineColor; /* Text markers */ + Pixel gm_TextColor; + Pixel gm_TextBgColor; /* bkg color, image text */ + int gm_TextBorder; /* border around text */ + XFontStruct *gm_TextFont; /* default font */ + String gm_TextString; /* default text */ + + Pixel gm_RectLineColor; /* Rectangle markers */ + Pixel gm_RectKnotColor; + int gm_RectKnotSize; + Pixel gm_BoxLineColor; /* Box markers */ + Pixel gm_BoxKnotColor; + int gm_BoxKnotSize; + Pixel gm_CircleLineColor; /* Circle markers */ + Pixel gm_CircleKnotColor; + int gm_CircleKnotSize; + Pixel gm_EllipseLineColor; /* Ellipse markers */ + Pixel gm_EllipseKnotColor; + int gm_EllipseKnotSize; + Pixel gm_PgonLineColor; /* Polygon markers */ + Pixel gm_PgonKnotColor; + int gm_PgonKnotSize; +} GtermPart; + +typedef struct _GtermRec { + CorePart core; + GtermPart gterm; +} GtermRec; + +typedef struct {int dummy;} GtermClassPart; + +typedef struct _GtermClassRec { + CoreClassPart core_class; + GtermClassPart gterm_class; +} GtermClassRec; + +extern GtermClassRec gtermClassRec; + +#endif /* _GtermP_h */ diff --git a/vendor/x11iraf/obm/ObmW/GtermCmap.c b/vendor/x11iraf/obm/ObmW/GtermCmap.c new file mode 100644 index 00000000..f4ec239e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermCmap.c @@ -0,0 +1,765 @@ + + + +/* + * Internal procedures for the above code. + * ---------------------------------------- + */ + +/* get_colormap -- Get a private colormap. On all calls after the first + * this just returns the existing gterm widget colormap. On the first call + * we query the server for the named custom colormap, and if the colormap + * exists we modify the gterm widget to use it. If the custom colormap has + * not yet been created by some other client, we create it. + * + * This code creates a custom colormap using the "standard colormap" + * facilities provided by XLIB. Although we do not use any of the predefined + * standard colormaps, use of the standard colormap facilities allows any + * number of clients to share the same custom colormap. Use of a custom + * colormap helps avoid running out of space in the default colormap, ensures + * that the gterm widget will get the color cells it needs, and makes it + * easier for several imaging clients which share the same colormap to + * simultaneously display their windows. + * + * To minimize colormap flashing we try to avoid using the full colormap, + * setting the unused cells to the colors set in the default colormap. In + * most cases this will prevent the rest of the screen from changing color + * when the custom colormap is installed. + */ +static Colormap +get_colormap (w) + GtermWidget w; +{ + register int i, j; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + XColor def_colors[SZ_STATIC_CMAP], *cp, *c1, *c2; + XStandardColormap cm, *cm_p; + XColor colors[MAX_SZCMAP]; + int base_pixel, p1, p2; + Colormap colormap; + char property[128]; + int ncmap, nitems; + Pixel pixel; + Atom atom; + + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "get_colormap: have=%d ncols=%d maxcols=%d base=%d\n", + w->gterm.haveColormap, w->gterm.ncolors, w->gterm.maxColors, + w->gterm.base_pixel); + + if (w->gterm.haveColormap || w->gterm.useGlobalCmap) + return (w->core.colormap); + + /* Map custom colormap name to atom. */ + sprintf (property, "GT_%s", w->gterm.cmapName); + atom = XInternAtom (display, property, False); + w->gterm.cmapAtom = atom; + + + /* Get custom colormap. + */ + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "get_colormap: cmapInitialize=%d GetRGB=%d of %d\n", + w->gterm.cmapInitialize, + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom), + ncmap); + + + if (!w->gterm.cmapInitialize && + XGetRGBColormaps (display, w->gterm.root, &cm_p, &ncmap, atom)) { + + /* Colormap aleady exists, just use it. + */ + cm = *cm_p; + colormap = cm.colormap; + w->gterm.base_pixel = cm.base_pixel; + + if (DBG_TRACE) + fprintf (stderr, "get_colormap: use existing cmap=0x%x; base=%d\n", + colormap, w->gterm.base_pixel); + + + } else if (w->gterm.w_depth > 8) { + + /* Setup for TrueColor visual. + */ + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "get_colormap: TrueColor gt.ncolors=%d base=%d\n", + w->gterm.ncolors, w->gterm.base_pixel); + + nitems = MAX_SZCMAP; + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + + /* Get a private colormap. + */ + for (i=0; i < MAX_SZCMAP; i++) + colors[i].pixel = i; + + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, w->gterm.base_pixel + i - SZ_STATIC_CMAP); + + w->gterm.color[i] = colors[pixel]; + } + + if (DBG_TRACE) + fprintf (stderr, + "\n\nget_colormap: gt.ncolors = %d maxcols = %d\n\n\n", + w->gterm.ncolors, w->gterm.maxColors); + + goto use_default; + + } else { + /* Create or reinitialize a global colormap. + */ + XVisualInfo template, *vi; + Display *d; + Screen *s; + Window root; + long mask; + + + if (DBG_TRACE) + fprintf (stderr, "get_colormap: ...creating colormap, ncols=%d\n", + w->gterm.ncolors); + + + if (!(d = XOpenDisplay (DisplayString(display)))) + goto use_default; + s = DefaultScreenOfDisplay (d); + root = DefaultRootWindow (d); + + /* Try to get a pseudocolor visual. */ + mask = 0; + template.screen = DefaultScreen(d); mask |= VisualScreenMask; + template.depth = RasterDepth; mask |= VisualDepthMask; + template.class = PseudoColor; mask |= VisualClassMask; + + if (!(vi = XGetVisualInfo (d, mask, &template, &nitems))) { + XCloseDisplay (d); + goto use_default; + } + + /* Create custom colormap with all cells allocated read/write */ + colormap = XCreateColormap (d, root, vi->visual, AllocAll); + + /* Initialize colormap to be same as default colormap. */ + nitems = min (MAX_SZCMAP, CellsOfScreen(s)); + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (d, DefaultColormapOfScreen(s), colors, nitems); + XStoreColors (d, colormap, colors, nitems); + + /* Globally define permanent server custom colormap. */ + memset ((char *)&cm, 0, sizeof(cm)); + cm.colormap = colormap; + cm.base_pixel = w->gterm.base_pixel; + cm.red_max = 0; + cm.visualid = vi->visualid; + cm.killid = 1; + XSetRGBColormaps (d, root, &cm, 1, atom); + + XSetCloseDownMode (d, RetainPermanent); + XCloseDisplay (d); + w->gterm.cmapInitialize = False; + + /* Free the XVisualInfo struct. */ + if (vi) + XFree ((void *)vi); /* MF040 */ + + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "get_colormap: .............creating done\n"); + } + + /* Save default color assignments for static colors. */ + for (i=0; i < SZ_STATIC_CMAP; i++) + def_colors[i] = w->gterm.color[i]; + + nitems = min (MAX_SZCMAP, CellsOfScreen(screen)); + w->gterm.ncolors = SZ_STATIC_CMAP + w->gterm.maxColors; + base_pixel = w->gterm.base_pixel; + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, + "\n\nget_colormap: gt.ncolors = %d maxcols = %d\n\n\n", + w->gterm.ncolors, w->gterm.maxColors); + + /* Get the private colormap. */ + for (i=0; i < nitems; i++) + colors[i].pixel = i; + XQueryColors (display, colormap, colors, nitems); + + /* Initialize the raster pixel to display pixel mapping and set the + * color assigned to each pixel value in the private colormap. + */ + for (i = SZ_STATIC_CMAP; i < w->gterm.ncolors; i++) { + w->gterm.color[i].pixel = w->gterm.cmap[i] = pixel = + min (nitems - 1, base_pixel + i - SZ_STATIC_CMAP); + w->gterm.color[i] = colors[pixel]; + } + + /* Check the static part of the cmap to make sure that the pixel numbers + * aren't aliased to pixels in the dynamic part of the custom colormap. + * If this happens, reassign these color numbers to the pixels just + * preceeding the dynamic part of the custom colormap. The red_max + * field of the colormap descriptor is used to keep track of the number + * of static colors allocated by different clients. These static colors + * are shared, hence the same color will not be stored twice. + */ + p1 = p2 = base_pixel - cm.red_max; + for (i=0; i < SZ_STATIC_CMAP; i++) { + pixel = w->gterm.cmap[i]; + if (pixel >= base_pixel && pixel < base_pixel+DEF_MAXCOLORS && p1 > 2) { + /* First check to see if we already have a static entry reserved + * for this color. + */ + c1 = &def_colors[i]; + for (j=p1, cp=NULL; j < base_pixel; j++) { + c2 = &colors[j]; + if (c1->red == c2->red && c1->green == c2->green && + c1->blue == c2->blue) { + cp = c2; + break; + } + } + + /* Assign a new screen pixel value. */ + if (cp) + w->gterm.cmap[i] = cp->pixel; + else { + cp = &colors[--p1]; + *cp = def_colors[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = w->gterm.cmap[i] = p1; + cm.red_max++; + } + w->gterm.color[i].pixel = w->gterm.cmap[i]; + } + } + if (p1 < p2) { + XStoreColors (display, colormap, &colors[p1], p2 - p1); + XSetRGBColormaps (display, w->gterm.root, &cm, 1, atom); + } + + /* Assign the new colormap to the gterm widget's window. */ + XtVaSetValues ((Widget)w, XtNcolormap, (XtArgVal)colormap, NULL); + w->gterm.haveColormap++; + + /* If the pointer is in the window, advise window manager to load the + * colortable for the window. + */ + if (w->gterm.in_window) + request_colormap_focus (w); + + return (colormap); + +use_default: + /* Unable to create custom colormap. */ + w->gterm.useDefaultCM++; + w->gterm.haveColormap++; + return (w->core.colormap); +} + + +/* request_colormap_focus -- Modify the WM_COLORMAP_WINDOWS property on a + * widget's top level shell window to advise the window manager that the + * widget's window should have its colormap loaded. This should only be + * used for windows that have a colormap different than that of the top + * level window. + */ +static +request_colormap_focus (w) + GtermWidget w; +{ + Widget p; + + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Find the top level window. */ + for (p = XtParent(w); !XtIsShell(p); p = XtParent(p)) + ; + + /* Modify WM_COLORMAP_WINDOWS to give the current window priority. + */ + if (p) { + Window window = XtWindow (p); + Window *wl = NULL, n_wl[MAX_WMWIN+1]; + register int n_nw, i; + int nw; + + /* If WM_COLORMAP_WINDOWS is already set save its value, otherwise + * start a list initially containing only the top level window. + */ + w->gterm.wmTop = window; + if (XGetWMColormapWindows (w->gterm.display, window, &wl, &nw)) { + memmove (w->gterm.wmWindows, (char *)wl, nw * sizeof(int)); + w->gterm.n_wmWindows = nw = min (nw, MAX_WMWIN); + free ((char *)wl); + } else { + w->gterm.wmWindows[0] = window; + w->gterm.n_wmWindows = nw = 1; + } + + n_nw = 0; + wl = w->gterm.wmWindows; + n_wl[n_nw++] = XtWindow(w); + + for (i=0; i < nw; i++) + if (wl[i] != XtWindow(w)) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, window, n_wl, n_nw); + } +} + + +/* restore_colormap_focus -- Reset WM_COLORMAP_WINDOWS. Retain the window + * that had the focus in the list, but drop its priority one notch. This + * should follow a prior call to request_colormap_focus. + */ +static +restore_colormap_focus (w) + GtermWidget w; +{ + register int nw, n_nw, i; + Window *wl, n_wl[MAX_WMWIN+1], old; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + old = XtWindow(w); + wl = w->gterm.wmWindows; + if ((nw = w->gterm.n_wmWindows) == 0 || (nw == 1 && wl[0] == old)) + return; + + n_nw = 0; + if (wl[0] != old) + n_wl[n_nw++] = wl[0]; + n_wl[n_nw++] = old; + + for (i=1; i < nw; i++) + if (wl[i] != old) + n_wl[n_nw++] = wl[i]; + + XSetWMColormapWindows (w->gterm.display, w->gterm.wmTop, n_wl, n_nw); +} + + +/* inherit_default_colormap -- Set any unused cells of the custom colormap + * to the colors defined for the corresponding cells of the default colormap. + * This minimizes colormap flashing when using a custom colormap, but only + * works if a few unused cells can be reserved, e.g., at the beginning of + * the colormap (which is usually where X allocates its colors). + */ +static +inherit_default_colormap (w) + GtermWidget w; +{ + register XColor *cp, *ap; + register int ncolors, i; + Display *display = w->gterm.display; + Screen *screen = w->gterm.screen; + Window root = w->gterm.root; + Atom atom = w->gterm.cmapAtom; + XColor colors[MAX_SZCMAP]; + XStandardColormap *cm; + int first, nitems, ncmap; + + + + if (DBG_TRACE) + fprintf (stderr, "inherit_default_cmap: ncols=%d maxcols=%d base=%d\n", + w->gterm.ncolors, w->gterm.maxColors, w->gterm.base_pixel); + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.base_pixel <= 0) + return; /* fully allocated colormap */ + + /* We have to read the colormap property again as another client could + * have reserved more static colors (i.e.,changed red_max), and we don't + * want to clobber these colors. + */ + if (XGetRGBColormaps (display, root, &cm, &ncmap, atom)) { + /* Make sure we have the right colormap. */ + if (w->core.colormap != cm->colormap) + XtVaSetValues ((Widget)w,XtNcolormap,(XtArgVal)cm->colormap,NULL); + + /* Get lower part of default colormap. */ + ncolors = cm->base_pixel - cm->red_max; + for (cp=colors, i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = i; + } + + /* Get upper part of default colormap. */ + first = cm->base_pixel + w->gterm.ncolors - SZ_STATIC_CMAP; + ncolors = min (MAX_SZCMAP, CellsOfScreen(screen)) - first; + for (i=0; i < ncolors; i++, cp++) { + cp->flags = (DoRed | DoGreen | DoBlue); + cp->pixel = first + i; + } + + /* Inherit values from default colormap. */ + ncolors = cp - colors; + XQueryColors (display, DefaultColormapOfScreen(screen), + colors, ncolors); + XStoreColors (display, w->core.colormap, colors, ncolors); + + /* The global gterm colormap may have changed. Compare widget's + * version of color table with the global colortable and update + * the widget's state if the global colortable has changed. + */ + ncolors = w->gterm.ncolors; + memmove (colors, w->gterm.color, ncolors * sizeof(*cp)); + XQueryColors (display, w->core.colormap, colors, ncolors); + for (i=ncolors, cp=colors, ap=w->gterm.color; --i >= 0; cp++, ap++) + if (cp->red != ap->red || cp->green != ap->green || + cp->blue != ap->blue) { + memmove (w->gterm.color, colors, ncolors * sizeof(*cp)); + invalidate_cmap (w); + } + + } else { + if (DBG_TRACE) + fprintf (stderr, "inherit_default_cmap: else XGetRGBColormaps\n"); + } +} + + +/* update_default_colormap -- Update the default colormap so that any + * unallocated cells mirror the widget's custom colormap. This increases + * the chance that the widget's contents will be visible when the window + * does not have the colormap focus, and minimizes flashing when the + * colormap focus changes. + */ +static +update_default_colormap (w) + GtermWidget w; +{ + register XColor *ip, *op; + register int j, n; + register Pixel v; + + XColor colors[MAX_SZCMAP]; + Pixel pixels[MAX_SZCMAP]; + char allocated[MAX_SZCMAP]; + int overflow, req, need, first, nelem, i; + unsigned long plane_masks[1]; + Colormap defcmap; + + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) + return; + if (w->gterm.useGlobalCmap) /* 24-bit */ + return; + + if (DBG_TRACE) + fprintf (stderr, "update_def_colormap: ENTER\n"); + + first = SZ_STATIC_CMAP; + nelem = w->gterm.ncolors; + + defcmap = DefaultColormapOfScreen (w->gterm.screen); + /* need = min (MAX_SZCMAP, first + nelem - SZ_STATIC_CMAP); */ + need = MAX_SZCMAP; + + /* Get the colormap cells. */ + for (req=need, n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, defcmap, False, + plane_masks, 0, &pixels[n], req)) { + n += req; + } else + req /= 2; + + /* Perform the color matching. This is awkward as the pixel value + * assignments may be different in the two colormaps. We have to look + * up each pixel before attempting to assign a color, or XStoreColors + * below will result in a server error. + */ + memset (allocated, 0, sizeof(allocated)); + overflow = 0; + + for (i=0; i < n; i++) { + v = pixels[i]; + if (v < MAX_SZCMAP) + allocated[v] = 1; + else { + overflow++; + break; + } + } + + ip = &w->gterm.color[first]; + op = colors; + if (overflow) { + for (i=0; i < nelem; i++, ip++) { + for (j=0, v = ip->pixel; j < n; j++) { + if (pixels[j] == v) { + *op++ = *ip; + break; + } + } + } + } else { + for (j=0; j < nelem; j++, ip++) { + if (allocated[ip->pixel]) { + allocated[ip->pixel] = 0; + *op++ = *ip; + } + } + } + + if (op > colors) + XStoreColors (w->gterm.display, defcmap, colors, op - colors); + + if (!w->gterm.useGlobalCmap) + XFreeColors (w->gterm.display, defcmap, pixels, n, 0); + +done: + if (DBG_TRACE) + fprintf (stderr, "update_def_colormap: LEAVING\n"); +} + + + + +/* Global Colormap routines. + */ +static int SetGlobalCmap(w) + GtermWidget w; +{ + static int init=0; + + if( !init ){ + strcpy (global_cmapname, XtNcmapName); + global_ncolors = 0; + global_mincolors = 0; + init = 1; + } + if( !w->gterm.useGlobalCmap ){ + w->gterm.cmap = (Pixel *)XtCalloc(MAX_SZCMAP, sizeof(Pixel)); + w->gterm.color = (XColor *)XtCalloc(MAX_SZCMAP, sizeof(XColor)); + + return(0); + + } else{ + w->gterm.cmap = global_cmap; + w->gterm.color = global_color; + + return(global_ncolors); + } +} + + +static int ParseGlobalCmap(w) + GtermWidget w; +{ + char *s; + char *t; + char *cmapname; + int colors; + int usedefault=0; + + /* process a directive such as "default[n:m,name]", where + * n = min number of colors that must be allocated or else + * use a private map called "name". m is the max colors to + * allocate (same as maxColors). Either or both can be omitted + */ + cmapname = w->gterm.cmapName; + if( !strncmp (cmapname, "default", 7) ){ + usedefault = 1; + if( (s=strchr(cmapname,'[')) != NULL ){ + /* skip open bracket */ + s++; + /* get min number of colors */ + global_mincolors = strtol(s, &t, 10); + /* for n:m syntax, get max colors */ + if( *t == ':' ){ + s = ++t; + colors = strtol(s, &t, 10); + if( colors > 0 ) + w->gterm.maxColors = colors; + } + /* look for default name */ + if( *t == ',' ){ + t++; + } + s = t; + /* this is the new name of the cmap -- but it can't be "default"! */ + if( (strncmp(s, "default", 7)) && (*s != ']') ){ + strcpy(global_cmapname, s); + /* null out closing bracket */ + if( (s = strchr(global_cmapname, ']')) != NULL ) + *s = '\0'; + } + /* now make sure we can grab the min number of colors, + or else set up to use a private color map */ + colors = GetMaxCmapColors(w); + if( colors < global_mincolors ){ + usedefault = 0; + w->gterm.haveColormap = 0; + strcpy(w->gterm.cmapName, global_cmapname); + } + else{ + w->gterm.maxColors = min(w->gterm.maxColors, colors); + } + } + } + return(usedefault); +} + +/* + * + * GetMaxCmapColors -- try to determine how many colors we can alloc in the + * default colormap. We do this now in order set maxColors to this number, + * to avoid the situation where a larger colormap is used that repeats + * the actually-allocated colormap -- very ugly ... + * + */ +static int GetMaxCmapColors(w) + GtermWidget w; +{ + register int n; + unsigned long plane_masks[1]; + int req; + int first, nelem, maxelem; + Pixel cmap[MAX_SZCMAP]; + Display *dpy; + Colormap colormap; + Visual *visual; + int screen; + + + dpy = XtDisplay(w); + screen = XDefaultScreen(dpy); + visual = XDefaultVisual(dpy, screen); + colormap = XDefaultColormap(dpy, screen); + + /* Make sure we have the right sort of visual. + */ + if (visual->class == TrueColor) + return (global_ncolors); + + if ((visual->class != PseudoColor) && (visual->class != GrayScale)) + return (0); + + /* Get current colormap specs. + */ + GtQueryColormap (w, 0, &first, &nelem, &maxelem); + + /* Try to alloc the max size colormap. + */ + if (maxelem > 0) { + req = min(MAX_SZCMAP, maxelem); + for (n=0; req > 0 && n < maxelem; ){ + if (XAllocColorCells (dpy, colormap, + False, plane_masks, 0, &cmap[n], req)) { + n += req; + } else + req /= 2; + } + + /* just wondering ... don't really need this. + */ + if (! w->gterm.useGlobalCmap) + XFreeColors (dpy, colormap, cmap, n, 0); + + } else + n = 0; + + return (n); +} + + +static int +GetGlobalColors() +{ + return (global_ncolors); +} + + +static void +SetGlobalColors(n) + int n; +{ + global_ncolors = n; +} + + +/* + * This routine will search the STATIC colors of w->core.colormap to find an + * exact match for the color name. If no match is found, the foreground is + * returned. + */ + +static Pixel +ColorNameToPixel (w, str) +GtermWidget w; +String str; +{ + int i; + XColor color; + XColor cmap[SZ_STATIC_CMAP]; + char *ip, *op, name[32]; + unsigned long r, g, b; + unsigned long val = 0; + + + + bzero (cmap, (SZ_STATIC_CMAP * sizeof(XColor))); + if (!str) + return (0); + + if (w->gterm.w_depth > ColormapDepth && w->gterm.useGlobalCmap) { + bzero (name, 32); + for (ip=str, op=name; ip && *ip; ) + *op++ = (char) tolower ((int)*ip++); + + + for (i=0; i < (SZ_STATIC_CMAP + SZ_OVERLAY_CMAP); i++) { + if (strcmp (name, static_colors[i].name) == 0) { + r = ((uchar)static_colors[i].r & 0xff) << 16; + g = ((uchar)static_colors[i].g & 0xff) << 8; + b = ((uchar)static_colors[i].b & 0xff); + val = static_colors[i].value; + break; + } + } + return (val); + + } else { + /* Find what colors are available... */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + memset (&cmap[i], 0, sizeof(XColor)); + cmap[i].pixel = i; + cmap[i].flags = DoRed | DoGreen | DoBlue; + } + + XQueryColors(w->gterm.display, w->core.colormap, cmap, SZ_STATIC_CMAP); + + /* ...and find a match */ + if (XParseColor(w->gterm.display, w->core.colormap, str, &color)) { + for (i=0; i<SZ_STATIC_CMAP; i++) { + if ((color.red == cmap[i].red) && + (color.green == cmap[i].green) && + (color.blue == cmap[i].blue)) { + return i; + } + } + } + + } + + return 1; +} + diff --git a/vendor/x11iraf/obm/ObmW/GtermCnv.c b/vendor/x11iraf/obm/ObmW/GtermCnv.c new file mode 100644 index 00000000..47119bb6 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermCnv.c @@ -0,0 +1,486 @@ + +/* Convenience macros. +*/ +#define GPMtoRPM gtermPM_to_rasPM /* Pixmap */ +#define RPMtoRPM rasPM_to_rasPM /* Pixmap */ +#define RPMtoGPM rasPM_to_gtermPM /* Pixmap */ + +#define IMGtoGPM ximage_to_gtermPM /* XImage */ +#define IMGtoRPM ximage_to_rasPM /* XImage */ + + +Pixmap gtermPM_to_rasPM (GtermWidget w, Raster dest); +Pixmap rasPM_to_rasPM (Raster src, Raster dest); +Pixmap rasPM_to_gtermPM (Raster src, GtermWidget w); + +XImage *ximage_to_gtermPM (GtermWidget w, XImage *xin, + int sx, int sy, int dnx, int dny); +XImage *ximage_to_rasPM (GtermWidget w, XImage *xin, Raster dest, + int sx, int sy, int dnx, int dny); + + + + + + +/* Match the destination pixmap to the Gterm pixmap. If they are the +** same depth we can simply return the gterm pixmap, otherwise return +** a copy of the Gterm pixmap at the dest raster's depth. +*/ + +Pixmap gtermPM_to_rasPM (GtermWidget w, Raster dest) +{ + if (DBG_TRACE) + fprintf (stderr, "GPMtoRPM: %d <-> %d\n", w->gterm.w_depth,dest->depth); + + /* Should be a no-op in 8-bit Pseudocolor mode. */ + if (w->gterm.w_depth == dest->depth) + return (w->gterm.pixmap); +} + + +/* Match the raster pixmap to another raster pixmap. If they are the +** same depth we can simply return the src pixmap, otherwise render the +** src pixmap to match the destination depth. +*/ + +Pixmap rasPM_to_rasPM (Raster src, Raster dest) +{ + if (DBG_TRACE) + fprintf (stderr, "RPMtoRPM: %d <-> %d\n", src->depth, dest->depth); + + /* Should be a no-op in 8-bit Pseudocolor mode. */ + if (src->depth == dest->depth) + return (src->r.pixmap); + + + if (src->depth < dest->depth) { + fprintf (stderr, "RPMtoRPM: %d < %d\n", src->depth, dest->depth); + ; + } else if (src->depth > dest->depth) { + fprintf (stderr, "RPMtoRPM: %d > %d\n", src->depth, dest->depth); + ; + } +} + + +/* Match the raster pixmap to the Gterm pixmap. If they are the +** same depth we can simply return the raster pixmap, otherwise render the +** raster pixmap to match the Gterm pixmap depth. +*/ + +Pixmap rasPM_to_gtermPM (Raster src, GtermWidget w) +{ + if (DBG_TRACE) + fprintf (stderr, "RPMtoGPM: %d <-> %d\n", src->depth, w->gterm.w_depth); + + + /* Should be a no-op in 8-bit Pseudocolor mode. */ + if (src->depth == w->gterm.w_depth) + return (src->r.pixmap); + + + if (src->depth < w->gterm.w_depth) { + fprintf (stderr, "RPMtoRPM: %d < %d\n", src->depth, w->gterm.w_depth); + ; + } else if (src->depth > w->gterm.w_depth) { + fprintf (stderr, "RPMtoRPM: %d > %d\n", src->depth, w->gterm.w_depth); + ; + } +} + + + +/* Match the input XImage to match the raster pixmap. If they are the +** same depth we can simply return the input ximage, otherwise return an +** ximage at the proper depth. +*/ + +XImage *ximage_to_rasPM (GtermWidget w, XImage *xin, Raster dest, + int sx, int sy, int dnx, int dny) +{ + uchar *renderPixels (); + XImage *cnvImg = (XImage *) NULL; + + + if (DBG_TRACE) { + fprintf (stderr, "IMGtoRPM: %d <-> %d [%d,%d] cnvImg=0x%x\n", + xin->depth, dest->depth, xin->width, xin->height, cnvImg); + fprintf (stderr, "IMGtoRPM: Map: (%d,%d) : %d %d\n", + sx, sy, dnx, dny); + } + + + /* Should be a no-op in 8-bit Pseudocolor mode. */ + if (xin->depth == dest->depth) + return (xin); + + if (xin->depth < dest->depth) { /* e.g. 8 -> 24 */ + + cnvImg = XCreateImage (w->gterm.display, NULL, RGBDepth, + ZPixmap, 0, (char *) NULL, xin->width, xin->height, 32, 0); + + cnvImg->data = + (char *) renderPixels (w, xin->data, xin->width, xin->height, + dest->depth, sx, sy, dnx, dny, cnvImg->bytes_per_line, + cnvImg->bits_per_pixel, cnvImg->byte_order); + + return (cnvImg); + + } else if (xin->depth > dest->depth) { /* shouldn't happen... */ + if (DBG_TRACE) + fprintf (stderr, "IMGtoRPM: shouldn't be here...\n"); + ; + } + + return ((XImage *) NULL); +} + + +/* Match the destination pixmap to the Gterm pixmap. If they are the +** same depth we can simply return the dest pixmap, otherwise render the +** gterm pixmap to match the destination. +*/ + +XImage *ximage_to_gtermPM (GtermWidget w, XImage *xin, + int sx, int sy, int dnx, int dny) +{ + uchar *renderPixels (); + XImage *cnvImg = (XImage *) NULL; + + + if (DBG_TRACE) { + fprintf (stderr, "IMGtoGPM: %d <-> %d [%d,%d]\n", + xin->depth, w->gterm.w_depth, xin->width, xin->height); + fprintf (stderr, "IMGtoGPM: Map: (%d,%d) : %d %d\n", + sx, sy, dnx, dny); + } + + + /* Should be a no-op in 8-bit Pseudocolor mode. */ + if (xin->depth == w->gterm.w_depth) + return (xin); + + if (xin->depth < w->gterm.w_depth) { /* e.g. 8 -> 24 */ + + cnvImg = XCreateImage (w->gterm.display, NULL, w->gterm.w_depth, + ZPixmap, 0, (char *) NULL, xin->width, xin->height, 32, 0); + + if (DBG_TRACE) + fprintf (stderr, "IMGtoGPM: bpl=%d bpp=%d border=%d\n", + cnvImg->bytes_per_line, cnvImg->bits_per_pixel, + cnvImg->byte_order); + + cnvImg->data = + (char *) renderPixels (w, xin->data, xin->width, xin->height, + w->gterm.w_depth, sx, sy, dnx, dny, cnvImg->bytes_per_line, + cnvImg->bits_per_pixel, cnvImg->byte_order); + + return (cnvImg); + + } else if (xin->depth > w->gterm.w_depth) { /* shouldn't happen... */ + if (DBG_TRACE) + fprintf (stderr, "IMGtoGPM: shouldn't be here...\n"); + } + + return ((XImage *) NULL); +} + + +/* Render the 8-bit image pixels to the specified depth. We'll allocate +** the pointer to the output pixels and assume the caller will free it. +*/ +uchar * +renderPixels (w, in, width, height, depth, sx, sy, dnx, dny, bpl, bpp, border) +GtermWidget w; +uchar *in; +int width, height, depth; +int sx, sy, dnx, dny; +int bpl, bpp, border; +{ + register int i, j, npix = (width * height); + unsigned long *lp, xcol, lval; + int nbytes = ((depth == ColormapDepth) ? 1 : 4); + uchar *ip = in, pv; + uchar *img = (uchar *) NULL; + + int min=256, max=0, cmin=256, cmax=0, xmin=0, xmax=0; + time_t start, end; + + + + if (DBG_TRACE) { + start = time ((time_t) NULL); + fprintf (stderr, "renderPix: ENTER\n"); + } + + /* Compute the lookup table for the most recent offset/scale. If this + ** hasn't changed, this is a no-op. + */ + if (init_lut (bpp, border) != OK) + return ((uchar *) NULL); + + /* Allocate the new image data. The bytes-per-line might be larger than + ** the indicated width, so use that for the size. + */ + img = (uchar *) calloc ((size_t) 1, (size_t) (bpl * height)); + + + /* Here we render only the pixels in the src rect, leaving the remainder + ** of the output XImage blank. The idea is that we process only what + ** will be visible on the screen, the input XImage still contains all the + ** off-screen pixels. + */ + ip = &in[sy * width + sx]; + lp = (unsigned long *) img; + lp += sy * width + sx; + for (i=0; i < dny; i++) { + for (j=0; j < dnx; j++) + *lp++ = global_lut[*ip++]; + + ip += (width - dnx); /* advance to next line of rect */ + lp += (width - dnx); + } + + if (DBG_TRACE) { + fprintf (stderr, + "renderPix: pix %d %d cmap %d %d xcol 0x%x 0x%x bpp = %d\n", + min,max, cmin,cmax, xmin,xmax, bpp); + end = time ((time_t) NULL); + fprintf (stderr, "renderPix: DONE time = %.5f %ld %ld\n", + difftime(start,end), (long)start, (long)end); + } + + return (img); +} + + +/* Compute the lookup table for the RGB rendering. +*/ +init_lut (bpp, border) +int bpp; +int border; +{ + register int i; + unsigned long rmask, gmask, bmask, rpix, gpix, bpix, xcol, lval; + int rshift, gshift, bshift, nbytes; + uchar *op, pv; + + + if (valid_lut) + return (OK); + + /* Compute various shifting constants that we'll need. + */ + switch (bpp) { /* should really get this from Visual */ + case 32: + case 24: + rmask = 0xff0000; gmask = 0xff00; bmask = 0xff; + rshift = -16; gshift = -8; bshift = 0; + nbytes = 4; + + /* Create the lookup table. + */ + bzero (global_lut, sizeof(long) * MAX_SZCMAP); + for (i=0; i < MAX_SZCMAP; i++) { + pv = global_cmap[i + SZ_STATIC_CMAP]; + + /* Get the color components. + */ + rpix = global_color[pv].red >> 8; + gpix = global_color[pv].green >> 8; + bpix = global_color[pv].blue >> 8; + + /* Shift and mask. + */ + rpix = (rpix << (-rshift)) & rmask; + gpix = (gpix << (-gshift)) & gmask; + bpix = (bpix << (-bshift)) & bmask; + + /* Create the pixel and load the LUT. + */ + xcol = rpix | gpix | bpix; + + op = (unsigned char *) &lval; + if (border == MSBFirst) { + *op++ = (xcol>>24) & 0xff; + *op++ = (xcol>>16) & 0xff; + *op++ = (xcol>>8) & 0xff; + *op++ = xcol & 0xff; + } else { + *op++ = xcol & 0xff; + *op++ = (xcol>>8) & 0xff; + *op++ = (xcol>>16) & 0xff; + *op++ = (xcol>>24) & 0xff; + } + global_lut[i] = lval; + } + break; + case 16: + rmask = 0x1f0000; gmask = 0x1f00; bmask = 0x1f; + rshift = -16; gshift = -8; bshift = 0; + nbytes = 2; + + /* FIXME */ + break; + case 15: + rmask = 0x1f0000; gmask = 0x1f00; bmask = 0x1f; + rshift = -10; gshift = -5; bshift = 0; + nbytes = 2; + + /* FIXME */ + break; + case 8: + /* FIXME */ + break; + default: + valid_lut = 0; + return (ERR); + } + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "init_lut: mask=(0x%x,0x%x,0x%x) shift=(%d,%d,%d)\n", + rmask, gmask, bmask, rshift, gshift, bshift); + + valid_lut = 1; + return (OK); +} + + +/* Find highest one bit set. +** Returns bit number + 1 of highest bit that is set, otherwise returns 0. +** High order bit is 31 (or 63 in _LP64 kernel). +*/ +int highbit(unsigned long i) +{ + register int h = 1; + if (i == 0) + return (0); +#ifdef _LP64 + if (i & 0xffffffff00000000ul) { h += 32; i >>= 32; } +#endif + if (i & 0xffff0000) { h += 16; i >>= 16; } + if (i & 0xff00) { h += 8; i >>= 8; } + if (i & 0xf0) { h += 4; i >>= 4; } + if (i & 0xc) { h += 2; i >>= 2; } + if (i & 0x2) { h += 1; } + + return (h); +} + + +/* Find lowest one bit set. +** Returns bit number + 1 of lowest bit that is set, otherwise returns 0. +** Low order bit is 0. +*/ +int lowbit(unsigned long i) +{ + register int h = 1; + + if (i == 0) + return (0); + +#ifdef _LP64 + if (!(i & 0xffffffff)) { h += 32; i >>= 32; } +#endif + if (!(i & 0xffff)) { h += 16; i >>= 16; } + if (!(i & 0xff)) { h += 8; i >>= 8; } + if (!(i & 0xf)) { h += 4; i >>= 4; } + if (!(i & 0x3)) { h += 2; i >>= 2; } + if (!(i & 0x1)) { h += 1; } + + return (h); +} + + +/* Debug Utilities. +*/ +bob() { int i = 0; fprintf (stderr, "Hi from Bob\n"); } + +dbg_printCmaps (GtermWidget w) +{ + int i, j, first, nelem, maxelem, nc; + unsigned short r[256], g[256], b[256]; + unsigned short rs[256], gs[256], bs[256], iomap[256]; + + + bzero (r, (256*sizeof(short))); + bzero (g, (256*sizeof(short))); + bzero (b, (256*sizeof(short))); + bzero (rs, (256*sizeof(short))); + bzero (gs, (256*sizeof(short))); + bzero (bs, (256*sizeof(short))); + bzero (iomap,(256*sizeof(short))); + + /* Get the current colormap and iomap. + */ + GtQueryColormap (w, 0, &first, &nelem, &maxelem); + nc = GtReadColormap (w, 0, 0, MAX_SZCMAP, rs, gs, bs); + GtReadIomap (w, iomap, 0, MAX_SZCMAP); + + fprintf (stderr, "cmaps: first=%d nelem=%d max=%d nc=%d\n", + first, nelem, maxelem, nc); + fprintf (stderr, "cmaps: basePixel=%d maxColors=%d ncolors=%d\n", + w->gterm.base_pixel, w->gterm.maxColors, w->gterm.ncolors); + + + for (i=0; i < nc; i++) { + j = iomap[i]; + r[i] = (rs[j] >> 8); g[i] = (gs[j] >> 8); b[i] = (bs[j] >> 8); + } + for (i=nc; i < MAX_SZCMAP; i++) { + j = iomap[i]; + r[i] = (rs[j] >> 8); g[i] = (gs[j] >> 8); b[i] = (bs[j] >> 8); + } + + fprintf (stderr, "cmap: idx iomap ReadColormap UserColormap "); + fprintf (stderr, "GlobalCmap cm in out\n"); + for (i=0; i < MAX_SZCMAP; i++) + fprintf (stderr, + "cmap: %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n", + i, iomap[i], rs[i]>>8, gs[i]>>8, bs[i]>>8, r[i], g[i], b[i], + global_color[i].red>>8, global_color[i].green>>8, + global_color[i].blue>>8, global_cmap[i], + w->gterm.cmap_in[i], w->gterm.cmap_out[i]); +} + +dbg_printMappings (GtermWidget w) +{ + Mapping mp; + char *scales[] = {"noScale", "zoom", "intZoom", "deZoom"}; + + for (mp=w->gterm.mp_head; mp; mp = mp->next) { + fprintf (stderr, "Map %2d: src=%d ty=%s s=(%d,%d) n=(%d,%d)\n", + mp->mapping, mp->src, (mp->st == GtPixel ? "GtPixel" : "GtNDC"), + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (stderr, " : dst=%d ty=%s s=(%d,%d) n=(%d,%d)\n", + mp->dst, (mp->dt == GtPixel ? "GtPixel" : "GtNDC"), + mp->dx, mp->dy, mp->dnx, mp->dny); + fprintf (stderr, " : rop=%d refresh=%d enabled=%d def=%d %s\n", + mp->rop, mp->refresh, mp->enabled, mp->defined, + scales[mp->scaling]); + fprintf (stderr, " : src=0x%x dst=0x%x pixmap=0x%x\n", + (int)&w->gterm.rasters[mp->src], (int)&w->gterm.rasters[mp->dst], + (int)&w->gterm.rasters[0]); + } +} + + +dbg_printRasters (GtermWidget w) +{ + register int i; + Raster rp; + + + for (i=0; i < w->gterm.nrasters; i++) { + rp = &w->gterm.rasters[i]; + + fprintf (stderr, "Raster %d: ty=%s size=(%d,%d,%d)\t", + i, (rp->type == 1 ? "ximage" : "pixmap"), + rp->width, rp->height, rp->depth); + fprintf (stderr, ": p=0x%x im=0x%x sh=0x%x\n", + rp->r.pixmap, rp->r.ximage, rp->shadow_pixmap); + } +} + + diff --git a/vendor/x11iraf/obm/ObmW/GtermDebug.c b/vendor/x11iraf/obm/ObmW/GtermDebug.c new file mode 100644 index 00000000..710cb6af --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermDebug.c @@ -0,0 +1,23 @@ + + +static char *dbg_wSize (GtermWidget w) +{ + static char b[32]; + + bzero (b, 32); + sprintf (b, "%dx%dx%d", w->core.width, w->core.height, w->core.depth); + return (b); +} + + +static char *dbg_visStr (int class) +{ + switch (class) { + case StaticGray: return ( "StaticGray" ); + case StaticColor: return ( "StaticColor" ); + case GrayScale: return ( "GrayScale" ); + case PseudoColor: return ( "PseudoColor" ); + case TrueColor: return ( "TrueColor" ); + default: return ( "unknown" ); + } +} diff --git a/vendor/x11iraf/obm/ObmW/GtermGraphics.c b/vendor/x11iraf/obm/ObmW/GtermGraphics.c new file mode 100644 index 00000000..1224d603 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermGraphics.c @@ -0,0 +1,1474 @@ + +/* + * GRAPHICS routines (public functions). + * -------------------------------------- + */ + +GtActivate (w) + GtermWidget w; +{ + w->gterm.interactive = 0; + w->gterm.save_x = w->gterm.save_y = 0; +} + +GtDeactivate (w) + GtermWidget w; +{ + Display *display = w->gterm.display; + Window window = w->gterm.window; + + if (w->gterm.interactive) { + if (w->gterm.save_x > 0 && w->gterm.save_y > 0) { + if (w->gterm.warpCursor) { + /* Workaround X server bug. */ + if (w->gterm.root != w->gterm.save_root) + XWarpPointer (display,None,w->gterm.root, 0,0,0,0, + WidthOfScreen(w->gterm.screen) - 1, + HeightOfScreen(w->gterm.screen) - 1); + + /* Move pointer to saved position. */ + XWarpPointer (display, None, w->gterm.save_root, + 0,0,0,0, w->gterm.save_x, w->gterm.save_y); + } + w->gterm.save_x = 0; + w->gterm.save_y = 0; + } + w->gterm.interactive = 0; + } +} + +GtReady (w) + GtermWidget w; +{ + return (w->gterm.delay == 0); +} + +GtReset (w) + GtermWidget w; +{ + invalidate_draw_context (w); + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapButt, JoinMiter); + + /* Set defaults. */ + w->gterm.line_width = 1; + w->gterm.data_level = GtSet; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.raster = 0; +} + +GtTimerInhibit (w, state) + GtermWidget w; + Boolean state; +{ + /* This is a kludge to allow a client (xgterm) to disable use of timers + * if they don't work in a given implementation. + */ + w->gterm.useTimers = !state; +} + +GtAugmentTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_augment; + w->gterm.nauxTrans++; + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtOverrideTranslations (w, translations) + register GtermWidget w; + char *translations; +{ + register int i; + + if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = T_override; + w->gterm.nauxTrans++; + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + } +} + +GtFlush (w) + GtermWidget w; +{ + XFlush (w->gterm.display); +} + +GtSetLogRes (w, width, height) + GtermWidget w; + int width, height; +{ + w->gterm.xres = width; + w->gterm.yres = height; +} + +GtGetLogRes (w, width, height) + GtermWidget w; + int *width, *height; +{ + *width = w->gterm.xres; + *height = w->gterm.yres; +} + +GtGetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; /* zero for screen size */ + int *width, *height; +{ + if (raster) { + register Raster rp = &w->gterm.rasters[raster]; + *width = rp->width; + *height = rp->height; + } else { + *width = w->core.width; + *height = w->core.height; + } +} + +GtSetPhysRes (w, raster, width, height) + GtermWidget w; + int raster; + int width, height; +{ + GtCreateRaster (w, raster, GtServer, width, height, RasterDepth); +} + +GtSetRaster (w, raster) + GtermWidget w; + int raster; +{ + if (raster >= 0 && raster < w->gterm.maxRasters) { + w->gterm.raster = raster; + invalidate_draw_context (w); + } +} + +GtGetRaster (w) + GtermWidget w; +{ + return (w->gterm.raster); +} + +/* ARGSUSED */ +GtSetTextRes (w, optrows, optcols) + GtermWidget w; + int optrows, optcols; +{ + w->gterm.optrows = optrows; + w->gterm.optcols = optcols; +} + +/* ARGSUSED */ +GtSetCharSize (w, ival) + GtermWidget w; + int ival; +{ +} + +GtSetDataLevel (w, ival) + GtermWidget w; + int ival; +{ + invalidate_draw_context (w); + + switch (ival) { + case GtSet: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + if (w->gterm.useGlobalCmap) + XSetForeground (w->gterm.display, w->gterm.drawGC, + static_colors[w->gterm.color_index].value); + else + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[w->gterm.color_index]); + w->gterm.data_level = ival; + break; + + case GtClear: + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + if (w->gterm.useGlobalCmap) + XSetForeground (w->gterm.display, w->gterm.drawGC, + static_colors[0].value); + else + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color0); + w->gterm.data_level = ival; + break; + + case GtInvert: + /* This probably won't work correctly but leave it for now... */ + XSetFunction (w->gterm.display, w->gterm.drawGC, GXxor); + w->gterm.data_level = ival; + break; + } +} + + +GtSetLineWidth (w, ival) + GtermWidget w; + int ival; +{ + w->gterm.line_width = ival; + GtSetLineStyle (w, w->gterm.line_style); +} + +#define Dashed "\010\003" +#define Dotted "\002\003" +#define DashDot "\016\003\001\003" +#define Dash3Dot "\024\003\001\003\001\003\001\003" + +GtSetLineStyle (w, ival) + GtermWidget w; + int ival; +{ + int line_width = w->gterm.line_width; + int line_style = LineSolid; + int cap_style = CapButt; + int join_style = JoinMiter; + int dash_offset = 0; + char *dash_list = NULL; + int dash_list_length = 0; + + switch (ival) { + case GtSolid: + w->gterm.line_style = ival; + break; + case GtDashed: + line_style = LineOnOffDash; + dash_list = (char *)Dashed; + dash_list_length = strlen(Dashed); + w->gterm.line_style = ival; + break; + case GtDotted: + line_style = LineOnOffDash; + dash_list = (char *)Dotted; + dash_list_length = strlen(Dotted); + w->gterm.line_style = ival; + break; + case GtDashDot: + line_style = LineOnOffDash; + dash_list = (char *)DashDot; + dash_list_length = strlen(DashDot); + w->gterm.line_style = ival; + break; + case GtDash3Dot: + line_style = LineOnOffDash; + dash_list = (char *)Dash3Dot; + dash_list_length = strlen(Dash3Dot); + w->gterm.line_style = ival; + break; + } + + if (dash_list_length) + XSetDashes (w->gterm.display, w->gterm.drawGC, dash_offset, dash_list, + dash_list_length); + + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, line_width, line_style, cap_style, join_style); + + invalidate_draw_context (w); +} + +GtSetColorIndex (w, ival) + GtermWidget w; + int ival; +{ + register int color = w->gterm.iomap[ival]; + + if (color >= 0 && color < w->gterm.ncolors) { + if (w->gterm.useGlobalCmap) { + register int i, found = 0; + + for (i=0; i < num_static_colors; i++) { + if (ival == static_colors[i].index) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + static_colors[i].value); + found++; + } + } + + /* If no match found, set the foreground color as the index. + */ + if (!found) { + XSetForeground (w->gterm.display, w->gterm.drawGC, + static_colors[1].value); + } + } else + XSetForeground (w->gterm.display, w->gterm.drawGC, + w->gterm.cmap[color]); + w->gterm.color_index = color; + invalidate_draw_context (w); + } +} + +GtSetFillType (w, ival) + GtermWidget w; + int ival; +{ + switch (ival) { + case GtSolid: + case GtOutline: + w->gterm.fill_type = ival; + break; + } +} + +GtClearScreen (w) +GtermWidget w; +{ + register Mapping mp; + + + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) + XFillRectangle (w->gterm.display, w->gterm.pixmap, + w->gterm.clearGC, 0, 0, w->core.width, w->core.height); + XClearWindow (w->gterm.display, w->gterm.window); + + set_default_color_index (w); + XSetFunction (w->gterm.display, w->gterm.drawGC, GXcopy); + if (w->gterm.useGlobalCmap) + XSetForeground (w->gterm.display, w->gterm.drawGC, + static_colors[1].value); + else + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.color1); + XSetLineAttributes (w->gterm.display, + w->gterm.drawGC, 1, LineSolid, CapRound, JoinRound); + + w->gterm.line_width = 1; + w->gterm.line_style = GtSolid; + w->gterm.fill_type = GtSolid; + w->gterm.data_level = GtSet; + w->gterm.preserve_valid = 0; + w->gterm.gm_redisplay = 1; + w->gterm.d_saved = 0; + + /* Mark any screen mappings to be unconditionally refreshed. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp->enabled && mp->dst == 0) + mp->refresh++; + + invalidate_draw_context (w); + update_transients (w, NULL); + + /* Reinitialize the display pixmap shadow. + */ + if (w->gterm.rasters) + initialize_shadow_pixmap (w, 0); +} + +GtDrawPolyline (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolymarker (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + /* Add code to support max display request size. */ + if (mx->use_backing_store) + XDrawPoints (w->gterm.display, w->gterm.pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + XDrawPoints (w->gterm.display, mx->pixmap, + mx->drawGC, points, npts, CoordModeOrigin); + } + + update_transients (w, (Region)NULL); +} + +GtDrawPolygon (w, pv, npts) + GtermWidget w; + XPoint *pv; + int npts; +{ + XPoint *points, o_pv[MAX_POINTS]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int i; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + + if (w->gterm.fill_type == GtOutline) { + /* Draw outline of region. + */ + int first = 0; + int last = npts - 1; + + if (mx->use_backing_store) + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + + if (points[last].x != points[first].x || + points[last].y != points[first].y) { + + if (mx->use_backing_store) + XDrawLine (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + XDrawLine (w->gterm.display, mx->pixmap, mx->drawGC, + points[last].x, points[last].y, + points[first].x, points[first].y); + } + } else { + /* Fill the outlined area. + */ + if (mx->use_backing_store) { + XFillPolygon (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, w->gterm.pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + XFillPolygon (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, Nonconvex, CoordModeOrigin); + XDrawLines (w->gterm.display, mx->pixmap, mx->drawGC, + points, npts, CoordModeOrigin); + } + } + + update_transients (w, (Region)NULL); +} + +GtDrawMarker (w, x, y, xsize, ysize, type) + GtermWidget w; + int x, y; + int xsize, ysize; + int type; +{ +} + +GtBell (w) + GtermWidget w; +{ + XBell (w->gterm.display, 0); +} + + +/* GtSetCursorPos -- Set the cursor position to the given coordinates X,Y. + * Coordinates are specified in the current graphics coordinate system, + * defined by the current raster and logical resolution. + * + * This routine is a little more complex than one might think due to the + * complication of mappings. Screen coordinates are required to set the + * cursor, but the graphics drawing context may be defined relative to + * any raster. In the general case a graphics pipeline defines the series + * of coordinate transformations required to transform from graphics + * coordinates to screen coordinates. Things are further complicated since + * the pipeline or desired position may not map to the screen, or there + * may be multiple mappings to the screen. The first case (no mapping to + * the screen) is dealt with by ignoring the request to warp the cursor. + * The second case (one-to-many mapping) is dealt with by a heuristic: + * the most recent screen coordinates are unmapped back to the raster we + * are "drawing" into, defining a unique path through the mappings which + * we can use to map back to the screen. + * + * The simplest case occurs when we are drawing directly into the screen. + * In this case (raster=0) there may still be a logical to physical + * coordinate transformation, but there are no mappings to complicate things. + */ +GtSetCursorPos (w, x, y) + GtermWidget w; + int x, y; +{ + register MappingContext mx; + register DrawContext dx; + register Mapping mp; + + Window window = w->gterm.window; + int sv_raster = w->gterm.raster; + int sv_xres = w->gterm.xres, sv_yres = w->gterm.yres; + int rasters[256], mappings[256], nmap=0, ntrans=0; + int rx, ry, src, dst, map, i, npts = 1; + int raster = w->gterm.raster; + XPoint pv1[1], pv2[2]; + XPoint *points, pv[1]; + Raster rp; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Follow the current cursor position back to the source raster if + * possible. This gives us a default pipeline to follow in the reverse + * direction to map raster coordinates to screen coordinates, and is + * necessary to find the right mappings when multiple mappings are + * defined on a single source. + */ + rx = w->gterm.last_x; + ry = w->gterm.last_y; + src = 0; + do { + src = GtSelectRaster (w, dst=src, GtPixel,rx,ry, GtPixel,&rx,&ry,&map); + if (src != dst) { + rasters[nmap] = src; + mappings[nmap++] = map; + } + } while (src != dst && src != raster); + + /* Ray trace the point through all of the mappings to the screen. + * This isn't fully general, but gives us the capability to follow + * most graphics pipelines to a point on the screen. + */ + do { + GtSetRaster (w, raster); + if (ntrans++ || raster == 0) { /* MF041 */ + /* After the first transformation we have raster coordinates, + * so set the logical resolution to the raster dimensions. + */ + rp = &w->gterm.rasters[raster]; + GtSetLogRes (w, rp->width, rp->height); + } + + dx = get_draw_context (w); + if (!dx->nmappings) + return; + + /* Try to find the next mapping. */ + if (nmap && rasters[nmap-1] == raster) + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->mapping == mappings[nmap-1]) { + mp = mx->mp; + nmap--; + goto havemap; + } + } + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + mp = mx->mp; + if (mp && mp->dst == 0) + break; + } + if (i >= dx->nmappings) { + mx = &dx->mapContext[0]; + mp = mx->mp; + } + +havemap: + rp = &w->gterm.rasters[mp ? mp->dst : raster]; + + /* Compute the coordinates points[0].{x,y} of the point x,y in the + * destination raster. + */ + if (mx->scale) { + /* Scaling is in effect. The following subterfuge is used to + * compute the coordinates of the center of the raster pixel (x,y) + * when the image is zoomed. We want to set the cursor to the + * center of the selected pixel, not the edge. + */ + pv[0].x = x; pv[0].y = y; + mapVector (mx, pv, pv1, npts); + pv[0].x = x + 1; pv[0].y = y + 1; + mapVector (mx, pv, pv2, npts); + + pv[0].x = (pv1[0].x + pv2[0].x) / 2.0; + pv[0].y = (pv1[0].y + pv2[0].y) / 2.0; + points = pv; + + } else { + /* No scaling. */ + pv[0].x = x; pv[0].y = y; + points = pv; + } + + /* Clip to the bounds of the destination raster and generate the + * new x,y. + */ + x = max(0, min(rp->width-1, points[0].x)); + y = max(0, min(rp->height-1, points[0].y)); + + } while (mp && (raster = mp->dst)); + + XWarpPointer (w->gterm.display, window, window, 0,0,0,0, x,y); + + w->gterm.last_x = w->gterm.cur_x = x; + w->gterm.last_y = w->gterm.cur_y = y; + + GtSetRaster (w, sv_raster); + GtSetLogRes (w, sv_xres, sv_yres); +} + + +GtGetCursorPos (w, x, y) + GtermWidget w; + int *x, *y; +{ + *x = w->gterm.last_x; + *y = w->gterm.last_y; +} + +GtSetCursorType (w, type) + GtermWidget w; + int type; +{ + static XtIntervalId id = (XtIntervalId) NULL; + Display *display = w->gterm.display; + Cursor cursor; + int interval; + Widget pw; + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (w->gterm.cursor_type == type) + return; + + switch (w->gterm.cursor_type = type) { + case GtNoCursor: + case GtIdleCursor: + erase_crosshair (w); + cursor = w->gterm.idle_cursor; + break; + + case GtGinmodeCursor: + /* Begin graphics cursor mode. + */ + + /* If a screen clear or drawing operation has caused the redisplay + * flag to be set, redisplay any marker overlays. + */ + if (w->gterm.gm_redisplay) { + GmRedisplay (w, (Region)NULL); + w->gterm.gm_redisplay = False; + } + + /* Make sure the window is visible. + */ + if (w->gterm.raiseWindow || w->gterm.deiconifyWindow) + for (pw = (Widget)w; pw; pw = XtParent(pw)) + if (XtIsShell(pw)) { + if (w->gterm.deiconifyWindow) + XMapWindow (display, XtWindow(pw)); + if (w->gterm.raiseWindow) + XRaiseWindow (display, XtWindow(pw)); + XSync (display, False); + } + + /* The first time this is done after a GtActivate causes the cursor + * to be warped into the graphics window. The interactive flag is set + * to cause GtDeactivate to restore the cursor to its original position + * after the graphics interaction finishes. + */ + if (w->gterm.warpCursor) { + int root_x, root_y, win_x, win_y; + int xoff, yoff, width, height, x, y; + Window gtermwin, root, child; + unsigned int keys; + int in_window = 0; + + width = w->core.width; + height = w->core.height; + gtermwin = w->gterm.window; + XTranslateCoordinates (display, gtermwin, w->gterm.root, + w->core.x, w->core.y, &xoff, &yoff, &child); + + if (XQueryPointer (display, w->gterm.root, &root, &child, + &root_x, &root_y, &win_x, &win_y, &keys)) { + + /* Already in gterm window? */ + if ((root_x >= xoff && root_x < xoff+width) && + (root_y >= yoff && root_y < yoff+height)) { + + if (!w->gterm.interactive) { + w->gterm.save_x = 0; + w->gterm.save_y = 0; + w->gterm.interactive++; + } + x = root_x - xoff; y = root_y - yoff; + in_window++; + + } else { + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + } else { + /* Pointer not on the current screen. + */ + if (!w->gterm.interactive) { + w->gterm.save_x = root_x; + w->gterm.save_y = root_y; + w->gterm.save_root = root; + w->gterm.interactive++; + } + x = w->gterm.cur_x; y = w->gterm.cur_y; + } + + if ((x < 5 || x > width-5) || (y < 5 || y > height-5)) { + x = width / 2; + y = height / 2; + } + + if (!in_window) { + erase_crosshair (w); + if (w->gterm.warpCursor) { + XWindowAttributes wa; + if (XGetWindowAttributes (display, gtermwin, &wa) && + wa.map_state == IsViewable) { + + /* The following should not be necessary but is needed + * to workaround an X server bug. When warping to a + * different screen the pointer is not erased on the + * old screen. It is hard to erase it, but we can + * at least move it to the corner of the screen. + */ + if (root != w->gterm.root) { + Screen *screen = w->gterm.screen; + if (XGetWindowAttributes (display, root, &wa)) + screen = wa.screen; + XWarpPointer (display,None,root, 0,0,0,0, + WidthOfScreen(screen) - 1, + HeightOfScreen(screen) - 1); + } + + /* Now warp into the gterm window. */ + XWarpPointer (display, None, gtermwin, 0,0,0,0, x,y); + } + if (w->gterm.full_crosshair) + draw_crosshair (w, x, y); + } + + } else if (w->gterm.full_crosshair) { + erase_crosshair (w); + draw_crosshair (w, x, y); + } + } else + update_cursor (w); + + cursor = w->gterm.ginmode_cursor; + if (interval = w->gterm.ginmodeBlinkInterval) { + XtAppContext appcon = XtWidgetToApplicationContext ((Widget) w); + id = XtAppAddTimeOut (appcon, + interval, blink_cursor, (XtPointer)w); + } else + id = (XtIntervalId) NULL; + break; + + case GtBusyCursor: + /* Exit graphics cursor mode. + */ + erase_crosshair (w); + cursor = w->gterm.busy_cursor; + break; + } + + if (w->core.visible) + XDefineCursor (w->gterm.display, w->gterm.window, + w->gterm.cursor = cursor); + if (id && w->gterm.cursor_type != GtGinmodeCursor) { + XtRemoveTimeOut (id); + id = (XtIntervalId) NULL; + } +} + +static void +blink_cursor (w, id) + GtermWidget w; + XtIntervalId *id; +{ + XtAppContext app_context; + XColor bg, fg; + int interval; + + if (w->gterm.cursor_type != GtGinmodeCursor) /* MF032 */ + return; + + bg = w->gterm.ginmodeColors[1]; + fg = w->gterm.ginmodeColors[0]; + + app_context = XtWidgetToApplicationContext ((Widget) w); + XRecolorCursor (w->gterm.display, w->gterm.ginmode_cursor, &fg, &bg); + XFlush (w->gterm.display); + + w->gterm.ginmodeColors[0] = bg; + w->gterm.ginmodeColors[1] = fg; + + if (interval = w->gterm.ginmodeBlinkInterval) + XtAppAddTimeOut (app_context, + interval, (XtTimerCallbackProc) blink_cursor, (XtPointer)w); +} + +GtPostInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.inputCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.inputCallback = new; +} + +GtDeleteInputProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.inputCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.inputCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resetCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resetCallback = new; +} + +GtDeleteResetProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resetCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resetCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtPostResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *new; + + new = (GtCallback *) XtMalloc (sizeof (GtCallback)); + new->proc = userfcn; + new->client_data = client_data; + new->next = NULL; + + for (cb = w->gterm.resizeCallback; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + w->gterm.resizeCallback = new; +} + +GtDeleteResizeProc (w, userfcn, client_data) + GtermWidget w; + GtCallbackProc userfcn; + XtPointer client_data; +{ + register GtCallback *cb, *prev; + + for (prev=NULL, cb = w->gterm.resizeCallback; cb; cb = cb->next) + if (cb->proc == userfcn && cb->client_data == client_data) { + if (prev) + prev->next = cb->next; + else + w->gterm.resizeCallback = cb->next; + XtFree ((char *)cb); + break; + } else + prev = cb; +} + +GtDrawAlphaText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + XPoint *points, pv[1], o_pv[1]; + DrawContext dx = get_draw_context (w); + register MappingContext mx; + register int npts, i; + + pv[0].x = x; + pv[0].y = y; + npts = 1; + + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + points = mx->scale ? mapVector(mx,pv,o_pv,npts) : pv; + x = points[0].x; y = points[0].y; + + if (mx->use_backing_store) + XDrawString (w->gterm.display, w->gterm.pixmap, + mx->drawGC, x, y, text, strlen(text)); + XDrawString (w->gterm.display, mx->pixmap, + mx->drawGC, x, y, text, strlen(text)); + } + + update_transients (w, (Region)NULL); +} + +GtGetAlphaTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.alpha_fonts[w->gterm.alpha_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + +GtWriteAlphaCursor (w, x, y) + GtermWidget w; + int x, y; +{ +} + +GtEraseAlphaCursor (w) + GtermWidget w; +{ +} + +GtStartDialog (w) + GtermWidget w; +{ + if (DBG_TRACE) + fprintf (stderr, "GtStartDialog: ENTER d_pixmap=0x%x d_saved=%d\n", + w->gterm.d_pixmap, w->gterm.d_saved); + + if (w->gterm.d_pixmap) { + if (w->gterm.d_saved) { + GtEraseDialog (w); + } else { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.pixmap ? w->gterm.pixmap : w->gterm.window, + w->gterm.d_pixmap, w->gterm.exposeGC, + 0, w->gterm.d_yoff, w->core.width, w->gterm.d_height, 0, 0); + w->gterm.d_saved = 1; + } + } + + if (DBG_TRACE) + fprintf (stderr, "GtStartDialog: LEAVING\n"); +} + +GtEndDialog (w) + GtermWidget w; +{ + GtEraseDialog (w); + w->gterm.d_saved = 0; +} + +GtEraseDialog (w) + GtermWidget w; +{ + if (DBG_TRACE) + fprintf (stderr, "GtEraseDialog: ENTER d_pixmap=0x%x d_saved=%d\n", + w->gterm.d_pixmap, w->gterm.d_saved); + + if (w->gterm.d_pixmap && w->gterm.d_saved) { + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.window, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + if (w->gterm.pixmap) + XCopyArea (w->gterm.display, + w->gterm.d_pixmap, w->gterm.pixmap, w->gterm.exposeGC, + 0, 0, w->core.width, w->gterm.d_height, 0, w->gterm.d_yoff); + update_transients (w, (Region)NULL); + } + + if (DBG_TRACE) + fprintf (stderr, "GtEraseDialog: LEAVING\n"); +} + +GtDrawDialogText (w, x, y, text) + GtermWidget w; + int x, y; + char *text; +{ + int xpos = w->gterm.d_xoff + x; + int ypos = w->gterm.d_yoff + y; + + if (w->gterm.pixmap) + XDrawImageString (w->gterm.display, w->gterm.pixmap, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.dialogGC, xpos, ypos, text, strlen(text)); +} + +GtGetDialogTextSize (w, string, width, height, base) + GtermWidget w; + char *string; + int *width, *height, *base; +{ + XFontStruct *fp; + + fp = w->gterm.dialog_fonts[w->gterm.dialog_font]; + if (string) + *width = XTextWidth (fp, string, strlen(string)); + else + *width = fp->max_bounds.width; + + *height = fp->max_bounds.ascent + fp->max_bounds.descent; + *base = fp->max_bounds.ascent; +} + + +/* + * Internal functions for above code. + * ---------------------------------------- + */ + +static +set_default_color_index (w) + GtermWidget w; +{ + /* The default color index is 1, corresponding to the foreground + * drawing color color1. Index zero is the background drawing color + * color0. The remaining NColors color table entries are the optional + * drawing colors corresponding to resources "color2" through "colorN". + * These are used only if explicitly selected by the client application. + */ + if (w->gterm.useGlobalCmap) + XSetForeground (w->gterm.display, w->gterm.drawGC, + static_colors[1].value); + else + XSetForeground (w->gterm.display, w->gterm.drawGC, w->gterm.cmap[1]); + w->gterm.color_index = 1; + invalidate_draw_context (w); +} + + +static +draw_crosshair (w, x, y) + GtermWidget w; + int x, y; +{ + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (w->gterm.pixmap) { + /* The preserve_screen flag is set if we need to preserve the + * exact display window contents, rather than merely refresh from + * the backing store pixmap. + */ + if (w->gterm.preserve_screen) { + if (!w->gterm.preserve_valid || y != w->gterm.cur_y) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, w->core.height); + if (!w->gterm.preserve_valid || x != w->gterm.cur_x) + XCopyArea (w->gterm.display, + w->gterm.window, w->gterm.pixmap, w->gterm.exposeGC, + x, 0, 1, w->core.height, w->core.width, 0); + w->gterm.preserve_valid = 1; + } + + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + 0, y, w->core.width, y); + XDrawLine (w->gterm.display, w->gterm.window, w->gterm.cursorGC, + x, 0, x, w->core.height); + + XFlush (w->gterm.display); + w->gterm.cursor_drawn++; + } + + w->gterm.cur_x = x; + w->gterm.cur_y = y; +} + + +static +erase_crosshair (w) + GtermWidget w; +{ + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (w->gterm.cursor_drawn) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + if (w->gterm.pixmap) { + if (w->gterm.preserve_screen && w->gterm.preserve_valid) { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, w->core.height, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + w->core.width, 0, 1, w->core.height, x, 0); + } else { + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + 0, y, w->core.width, 1, 0, y); + XCopyArea (w->gterm.display, + w->gterm.pixmap, w->gterm.window, w->gterm.exposeGC, + x, 0, 1, w->core.height, x, 0); + } + } + + w->gterm.cursor_drawn = 0; + w->gterm.preserve_valid = 0; + } +} + + +static +update_transients (w, region) + GtermWidget w; + Region region; +{ + /* If an explicit region is given redisplay any markers in it immediately, + * otherwise set the redisplay flag to cause a full screen redisplay when + * drawing finishes and the widget is ready for input. + */ + if ((char *)region) + GmRedisplay (w, region); + else + w->gterm.gm_redisplay = True; + + /* Update the crosshair cursor if GIN mode is in effect. */ + update_cursor (w); +} + + +static +update_cursor (w) + GtermWidget w; +{ + if (w->gterm.cursor_type == GtGinmodeCursor && w->gterm.full_crosshair) { + register int x = w->gterm.cur_x; + register int y = w->gterm.cur_y; + + if (x || y) + draw_crosshair (w, x, y); + } +} + +static Cursor +get_cursor (w, cursor_name) + GtermWidget w; + String cursor_name; +{ + XrmValue from, to; + Cursor cursor; + + from.size = strlen (cursor_name) + 1; + from.addr = cursor_name; + + to.addr = (caddr_t) &cursor; + to.size = sizeof(cursor); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRCursor, &to)) + cursor = XCreateFontCursor (w->gterm.display, XC_crosshair); + + return (cursor); +} + + +static DrawContext +get_draw_context (w) + GtermWidget w; +{ + DrawContext dx = &w->gterm.draw; + + if (!dx->valid) { + int raster = w->gterm.raster; + Raster rp = &w->gterm.rasters[raster]; + register MappingContext mx = &dx->mapContext[0]; + Region clip_region, mask_region; + struct mapping *map, *mp, *np, p_mp; + int xres = w->gterm.xres; + int yres = w->gterm.yres; + float xscale, yscale; + XRectangle r; + int i, j; + + dx->raster = w->gterm.raster; + dx->rp = rp; + + if (raster == 0) { + dx->nmappings = 1; + mx->mapping = 0; + mx->mp = NULL; + mx->use_backing_store = (w->gterm.pixmap != (Pixmap)NULL); + mx->pixmap = w->gterm.window; + mx->drawGC = w->gterm.drawGC; + mx->GC_private = 0; + +/* (7/16/97) MJF - we don't scale raster 0 since it's already in screen coords. + Otherwise the cursor movement keystrokes scale incorrectly and quickly move + to (0,0). + mx->xoffset = mx->yoffset = mx->scale = 0; + [DCT] This doesn't look entirely right as it disables logical coords for + the screen. Leave as is until this can be studied more carefully. + */ + + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) + mx->scale = 0; + else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + } else { + dx->nmappings = 0; + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (!mp->enabled || mp->src != raster || + w->gterm.rasters[mp->dst].type != GtServer) + continue; + if (!valid_mapping (w, mp)) + continue; + + mx->mp = mp; + mx->mapping = mp->mapping; + mx->pixmap = w->gterm.rasters[mp->dst].r.pixmap; + mx->use_backing_store = (mp->dst == 0 && + w->gterm.pixmap && !(mp->rop & R_Transient)); + + /* Determine if any scaling is necessary. */ + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + /* Compute logical-to-raster scaling. */ + mx->xoffset = mx->yoffset = 0; + if (xres == rp->width && yres == rp->height) { + mx->xscale = mx->yscale = 1.0; + mx->scale = 0; + } else { + mx->xscale = (float)rp->width / (float)xres; + mx->yscale = (float)rp->height / (float)yres; + mx->scale = 1; + } + + /* Compute overall scale factors by combining logical-to- + * raster and raster-to-screen mappings. + */ + if (map->snx != map->dnx || map->sny != map->dny || + map->sx != map->dx || map->sy != map->dy) { + + xscale = (float)map->dnx / (float)map->snx; + mx->xscale *= xscale; + if (xscale < 0) + mx->xoffset = map->dx + abs(map->dnx) - 1; + else + mx->xoffset = map->dx; + mx->xoffset -= (map->sx * xscale); + + yscale = (float)map->dny / (float)map->sny; + mx->yscale *= yscale; + if (yscale < 0) + mx->yoffset = map->dy + abs(map->dny) - 1; + else + mx->yoffset = map->dy; + mx->yoffset -= (map->sy * yscale); + + mx->scale = 1; + } + + /* Compute the clip mask which will clip graphics to the + * destination rect of the mapping, minus any regions of + * this rect covered by other mappings. + */ + clip_region = XCreateRegion(); + r.x = map->dx; r.y = map->dy; + r.width = abs(map->dnx); + r.height = abs(map->dny); + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != mp->dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + mask_region = XCreateRegion(); + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + XUnionRectWithRegion (&r, mask_region, mask_region); + + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + } + + /* Create a drawing GC which is a copy of the global drawGC + * but using the clip mask computed above. + */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.root, + 0, NULL); + + /* Deep Frame */ + mx->drawGC = XCreateGC (w->gterm.display, w->gterm.window, + 0, NULL); + /* Deep Frame */ + + XCopyGC (w->gterm.display, w->gterm.drawGC, ~0, mx->drawGC); + XSetRegion (w->gterm.display, mx->drawGC, clip_region); + XDestroyRegion (clip_region); + mx->GC_private = 1; + + if (++dx->nmappings >= MAX_DRAW) + break; + else + mx++; + } + } + + dx->valid = 1; + } + + return (dx); +} + + +static +invalidate_draw_context (w) + GtermWidget w; +{ + register DrawContext dx = &w->gterm.draw; + register MappingContext mx; + register int i; + + if (dx->valid) { + for (i=0; i < dx->nmappings; i++) { + mx = &dx->mapContext[i]; + if (mx->GC_private) + XFreeGC (w->gterm.display, mx->drawGC); + } + dx->valid = 0; + } +} + +static XPoint * +mapVector (mx, pv1, pv2, npts) + register MappingContext mx; + XPoint *pv1; + XPoint *pv2; + int npts; +{ + register XPoint *ip = pv1; + register XPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x * mx->xscale + mx->xoffset; + op->y = ip->y * mx->yscale + mx->yoffset; + } + + return (pv2); +} + + +static void +savepos (w, event) + GtermWidget w; + XEvent *event; +{ + if (event == NULL) + return; + + switch (event->type) { + case KeyPress: + case KeyRelease: + w->gterm.last_x = event->xkey.x; + w->gterm.last_y = event->xkey.y; + break; + case ButtonPress: + case ButtonRelease: + w->gterm.last_x = event->xbutton.x; + w->gterm.last_y = event->xbutton.y; + break; + case MotionNotify: + w->gterm.last_x = event->xmotion.x; + w->gterm.last_y = event->xmotion.y; + break; + } +} diff --git a/vendor/x11iraf/obm/ObmW/GtermImaging.c b/vendor/x11iraf/obm/ObmW/GtermImaging.c new file mode 100644 index 00000000..b2d5791c --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermImaging.c @@ -0,0 +1,3164 @@ + +/* + * IMAGING routines. + * ----------------------- + * Our strategy here is to support a range of visuals with pseudocolor being + * preferred if available. All imaging is done internally using 8 bit images + * and a max 256 element colormap. If the display hardware has a depth less + * than 8 bits, e.g. for a monochrome display, the image is reduced to the + * screen depth by some technique before being output to the display. + * + * Images (rasters) are implemented internally in Gterm using either ximages or + * off screen pixmaps. Which format is used is decided at raster create time + * and is controlled by a Gterm resource. This is transparent to the client + * application. Currently only 8 bit rasters are supported. + * + * GtRasterInit (gt) + * GtAssignRaster (gt, raster, drawable) + * GtCreateRaster (gt, raster, type, width, height, depth) + * GtDestroyRaster (gt, raster) + * exists = GtQueryRaster (gt, raster, &type, &width, &height, &depth) + * raster = GtNextRaster (gt) + * GtSetRaster (gt, raster) + * raster = GtGetRaster (gt) + * n = GtNRasters (gt) + * + * GtWritePixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtReadPixels (gt, raster, pixels, nbits, x1, y1, nx, ny) + * GtSetPixels (gt, raster, ct, x1, y1, nx, ny, color, rop) + * GtRefreshPixels (gt, raster, ct, x1, y1, nx, ny) + * pixmap = GtExtractPixmap (gt, src, ct, x, y, width, height) + * GtInsertPixmap (gt, pixmap, dst, ct, x, y, width, height) + * + * colormap = GtNextColormap (gt) + * GtFreeColormap (gt, colormap) + * GtWriteColormap (gt, colormap, first, nelem, r, g, b) + * GtReadColormap (gt, colormap, first, nelem, r, g, b) + * GtLoadColormap (gt, colormap, offset, scale) + * exists = GtQueryColormap (gt, colormap, &first, &nelem, &maxelem) + * GtWriteIomap (gt, iomap, first, nelem) + * GtReadIomap (gt, iomap, first, nelem) + * GtReadLUT (gt, lut, first, nelem) + * pixel = GtGetClientPixel (gt, gterm_pixel) + * + * GtInitMappings (gt) + * mapping = GtNextMapping (gt) + * GtFreeMapping (gt, mapping) + * GtRaiseMapping (gt, mapping, ref|NULL) + * GtLowerMapping (gt, mapping, ref|NULL) + * int = GtCompareMappings (gt, map1, map2) + * GtEnableMapping (gt, mapping, refresh) + * GtDisableMapping (gt, mapping, erase) + * active = GtActiveMapping (gt, mapping) + * GtRefreshMapping (gt, mapping) + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mapping) + * GtSetDisplayRaster (gt, mapping) + * + * GtCopyRaster (gt, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtSetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * GtGetMapping (gt, mapping, rop, + * src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + * + * GtMapVector (gt, mapping, dir, pv1, pv2, npts) + * GtPixelToNDC (gt, raster, pv1, pv2, npts) + * GtNDCToPixel (gt, raster, pv1, pv2, npts) + * + * GtDebug (gt, fp, what) + * + * In the case of CopyRaster or {Set|Get}Mapping, raster coordinates may be + * specified in either raster pixel (GtPixel) units or in normalized device + * coordinates (GtNDC) in the range 0-32767. + * --------------------------------------------------------------------------- + */ + +GtRasterInit (w) + GtermWidget w; +{ + register int i; + register Raster rp; + register struct colormap *cm; + struct colormap *next_cm; + + + invalidate_draw_context (w); + + /* Destroy any existing rasters. */ + if (w->gterm.rasters) { + for (i=1; i < w->gterm.maxRasters; i++) { + if (w->gterm.rasters[i].type) + GtDestroyRaster (w, i); + } + } + + /* Allocate the initially empty raster descriptors. */ + XtFree ((char *)w->gterm.rasters); + w->gterm.rasters = rp = + (Raster) XtCalloc (w->gterm.maxRasters, sizeof (struct raster)); + w->gterm.nrasters = 0; + w->gterm.raster = 0; + + /* Raster 0 is the display window. + */ + if (DBG_TRACE) + fprintf (stderr, + "GtRasterInit: Init display PixmapRaster (%dx%d) depth=%d\n", + w->core.width, w->core.height, w->core.depth); + + rp->type = PixmapRaster; + rp->width = w->core.width; + rp->height = w->core.height; + rp->depth = w->core.depth; + rp->r.pixmap = w->gterm.window; + rp->delete = 0; + rp->shadow_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width, w->core.height, RasterDepth); + + + /* Free any previously allocated colormap cells. */ + if (! w->gterm.useGlobalCmap) { + if (w->gterm.ncolors > SZ_STATIC_CMAP && w->gterm.useDefaultCM) { + XFreeColors (w->gterm.display, w->core.colormap, + &w->gterm.cmap[SZ_STATIC_CMAP], w->gterm.ncolors-SZ_STATIC_CMAP, + 0); + w->gterm.ncolors = SZ_STATIC_CMAP; + invalidate_cmap (w); + } + } + + /* Free any client defined colormaps. */ + for (cm = w->gterm.colormaps; cm; cm = next_cm) { + next_cm = cm->next; + XtFree ((char *)cm); + } + w->gterm.colormaps = NULL; + + /* Initialize the mappings. */ + GtInitMappings (w); + + if (DBG_TRACE) + fprintf (stderr, "GtRasterInit: After Init Mappings...Returning\n"); +} + + +initialize_shadow_pixmap (GtermWidget w, int dst) +{ + Raster rp = (Raster) NULL; + + if (w->gterm.rasters) { + rp = &w->gterm.rasters[dst]; + + if (dst == 0 || rp->type == PixmapRaster) { + XFillRectangle (w->gterm.display, rp->shadow_pixmap, + w->gterm.clear8GC, 0, 0, rp->width, rp->height); + } + } +} + + +/* GtNextRaster -- Return the index of the next unused raster. + */ +GtNextRaster (w) + register GtermWidget w; +{ + register int i; + + if (w->gterm.rasters) + for (i=1; i < w->gterm.maxRasters; i++) + if (!w->gterm.rasters[i].type) + return (i); + + return (-1); +} + + +/* GtNRasters -- Return the number of currently defined rasters. + */ +GtNRasters (w) + GtermWidget w; +{ + return (w->gterm.nrasters); +} + + +/* GtAssignRaster -- Assign a raster descriptor to an externally created + * drawable (window or pixmap). The raster thus created may be mapped or + * drawn into like the rasters created privately by the imaging code, but + * this allows use of this code to access other windows, or shared pixmaps. + */ +GtAssignRaster (w, raster, drawable, type) + GtermWidget w; + int raster; /* one-indexed */ + XtPointer drawable; /* object containing pixel array */ + int type; /* type of drawable [not used] */ +{ + register Raster rp; + XWindowAttributes wa; + + if (raster <= 0 || raster >= w->gterm.maxRasters) + return (ERR); + else + rp = &w->gterm.rasters[raster]; + + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, (Window)drawable, &wa)) + return (ERR); + } else + wa = w->gterm.wa; + + rp->type = PixmapRaster; + rp->width = wa.width; + rp->height = wa.height; + rp->depth = wa.depth; + rp->r.pixmap = (Pixmap) drawable; + rp->delete = 0; + + return (OK); +} + + +/* GtCreateRaster -- Create a new raster of the given size. A server pixmap + * (GtServer) or ximage (GtClient) raster will be created depending upon the + * current value of the cacheRasters resource. + */ +GtCreateRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int type; + int width, height; + int depth; +{ + register uchar *op; + register int npix, pixel; + uchar *data; + XImage *xp; + Raster rp; + int cache; + + + if (!XtIsRealized ((Widget)w)) + return (ERR); + + if (DBG_TRACE) { + fprintf (stderr, "GtCreateRaster: raster=%d type=%s (%dx%dx%d)\n", + raster, ((type == GtClient) ? "GtClient" : "GtServer"), + width, height, depth); + } + + + /* Only rasters of depth 8 bits are currently supported. Eventually + ** we may want to allow arbitrarily deep frame buffers (e.g. for RGB + ** composites, overlay planes, etc). + if (depth && depth != 8) { + if (DBG_TRACE) + fprintf (stderr, + "GtCreateRaster ERROR: attempt to create raster depth=%d\n", + depth); + return (ERR); + } + */ + + + /* Check for a raster number in bounds. */ + if (raster < 0 || raster >= w->gterm.maxRasters) { + if (DBG_TRACE) + fprintf (stderr, + "GtCreateRaster ERROR: invalid raster = %d\n", raster); + return (ERR); + } else + rp = &w->gterm.rasters[raster]; + + + /* A create on raster 0 (the display window) is treated as an attempt + * to resize the window. + */ + if (raster == 0) { + XWindowAttributes wa; + + invalidate_draw_context (w); + + /* Issue the resize request. */ + XtVaSetValues ((Widget)w, + XtNwidth, (XtArgVal)width, + XtNheight, (XtArgVal)height, + NULL); + XFlush (w->gterm.display); + + /* The following generates a round trip request to the server and + * is an attempt to allow the window system time to process the + * resize request before the client can issue a GtQueryRaster to + * see if the request has succeeded (hence causing a race condition). + * If the window is not the requested size the delay flag is set + * to cause graphics input processing to be suspended until the + * window is resized or redisplayed. A dummy expose event is + * generated to clear the delay condition in case the resize request + * is not granted. + */ + if (XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + rp->width = wa.width; + rp->height = wa.height; + + if (rp->width != width || rp->height != height) { + XExposeEvent ev; + ev.type = Expose; + ev.send_event = True; + ev.display = w->gterm.display; + ev.window = w->gterm.window; + ev.x = ev.y = 0; + ev.width = ev.height = 1; + ev.count = 0; + + XSendEvent (w->gterm.display, w->gterm.window, False, + NoEventMask, (XEvent *)&ev); + w->gterm.delay = 1; + } + } + return (OK); + } + + /* Get rid of any old raster. */ + GtDestroyRaster (w, raster); + + rp->width = width; + rp->height = height; + rp->depth = depth; + rp->delete = 1; + + /* Cache the raster? */ + if (strcmp (w->gterm.cacheRasters, "always") == 0) + cache = 1; + else if (strcmp (w->gterm.cacheRasters, "never") == 0) + cache = 0; + else + cache = (type == GtServer); + + + if (DBG_TRACE) { + fprintf (stderr, + "GtCreateRaster: cacheRasters = '%s' type=%s cache=%d\n", + w->gterm.cacheRasters, (type == GtServer ? "GtServer" : "GtClient"), + cache); + fprintf (stderr,"GtCreateRaster: cache=%d (%dx%dx%d)\n", + cache, width, height, depth); + fprintf (stderr,"GtCreateRaster: Creating %s: %d\n", + (cache ? "PIXMAPRASTER" : "IMAGERASTER"), raster); + } + + /* Create new raster. */ + if (cache) { + /* Create a pixmap. */ + rp->type = PixmapRaster; + rp->depth = depth; + rp->r.pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + width, height, depth); + + + if (DBG_TRACE) + fprintf (stderr, + "GtCreateRaster: [pixmap] creating shadow pixmap %dx%d\n", + w->core.width+1, w->core.height+1); + + rp->shadow_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width+1, w->core.height+1, RasterDepth); + + if (rp->r.pixmap == (Pixmap) NULL) + goto ximage; + + XFillRectangle (w->gterm.display, rp->r.pixmap, + (depth == RasterDepth ? w->gterm.clear8GC : w->gterm.clearGC), + 0, 0, width, height); + + } else { + /* Create an XImage for the raster. + */ +ximage: + rp->type = ImageRaster; + rp->depth = depth; + + /* Get pixel storage. + */ + if ((data = (uchar *) XtMalloc((npix=width*height))) == NULL) + return (ERR); + else { + for (op=data, pixel=w->gterm.color0; --npix >= 0; ) + *op++ = pixel; + } + + /* The following doesn't yet deal properly with byte and bit ordering + * differences between the server and client. + */ + rp->r.ximage = xp = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, width, height, 8, 0); + if (xp == NULL) { + rp->type = 0; + return (ERR); + } + + + if (DBG_TRACE) + fprintf (stderr, + "GtCreateRaster: [ximage] creating shadow pixmap %dx%d\n", + w->core.width+1, w->core.height+1); + + rp->shadow_pixmap = XCreatePixmap (w->gterm.display, w->gterm.window, + w->core.width+1, w->core.height+1, RasterDepth); + } + + w->gterm.nrasters++; + + if (DBG_TRACE) { + int i; + + fprintf (stderr, "GtCreateRaster: LEAVING nraster=%d\n", + w->gterm.nrasters); + + for (i=0; i < w->gterm.nrasters; i++) + fprintf (stderr, "GtCreateRaster[%d]: type=%8s %dx%d [%d]\n", + i, + (w->gterm.rasters[i].type==GtClient)?"GtClient":"GtServer", + w->gterm.rasters[i].width, w->gterm.rasters[i].height, + w->gterm.rasters[i].depth); + } + return (OK); +} + + +/* GtDestroyRaster -- Destroy a raster. Any mappings which reference the + * raster are deactivated, and all storage associated with the raster is freed. + */ +GtDestroyRaster (w, raster) + GtermWidget w; + int raster; +{ + register Raster rp; + register Mapping mp, next; + + if (raster <= 0) + return; + + invalidate_draw_context (w); + + /* Disable any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = next) { + next = mp->next; + if (mp->src == raster || mp->dst == raster) + free_mapping (w, mp); + } + + /* Destroy the raster. */ + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (rp->delete) { + if (rp->type == ImageRaster) + XDestroyImage (rp->r.ximage); + else if (rp->type == PixmapRaster) + XFreePixmap (w->gterm.display, rp->r.pixmap); + } + w->gterm.nrasters--; + rp->type = 0; + rp->delete = 0; + } +} + + +/* GtQueryRaster -- Determine whether a raster exists and if so return its + * size. + */ +GtQueryRaster (w, raster, type, width, height, depth) + GtermWidget w; + int raster; /* one-indexed */ + int *type; + int *width, *height; + int *depth; +{ + register Raster rp; + + + if (DBG_TRACE && DBG_VERBOSE) + fprintf (stderr, "GtQueryRaster: raster=%d\n", raster); + + if (raster < 0 || raster > w->gterm.maxRasters) + return (0); + + rp = &w->gterm.rasters[raster]; + if (rp->type) { + if (type) { + if (rp->type == PixmapRaster) + *type = GtServer; + else + *type = GtClient; + } + if (width) + *width = rp->width; + if (height) + *height = rp->height; + if (depth) + *depth = rp->depth; + + if (DBG_TRACE && DBG_VERBOSE) + fprintf (stderr, "GtQueryRaster: raster=%d (%s) w=%d h=%d d=%d\n", + raster, + ((*type == PixmapRaster) ? "GtServer" : "GtClient"), + *width, *height, *depth); + + + return (1); + } else + return (0); +} + + +/* GtWritePixels -- Write to a rectangular region of a raster. If any + * mappings are currently defined which reference this raster as the source, + * and a mapped region is being rewritten, the affected pixels will be + * refreshed by the mapping. + */ +GtWritePixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int i, n, bytes_per_line; + Mapping mp; + Raster rp; + uchar *lp; + XWindowAttributes wa; + unsigned int *ras = NULL; + + + rp = &w->gterm.rasters[raster]; + + if (DBG_TRACE) + fprintf(stderr, + "GtWritePixels[%s] ENTER: nbits=%d raster=%d type='%s' wa=0x%x\n", + dbg_wSize(w), nbits, raster, + (rp->type == PixmapRaster) ? "PixmapRaster" : "ImageRaster", + w->gterm.wa); + + + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + if (!w->gterm.wa_defined) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) { + fprintf (stderr, "GtWritePixels: Error getting window attrs\n"); + return (ERR); + } + } else + wa = w->gterm.wa; + + if (DBG_TRACE) + fprintf (stderr, + "GtWritePixels: window depth=%d RasterDepth= %d class=%s\n", + wa.depth, RasterDepth, dbg_visStr(wa.visual->class)); + + + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + XImage *ximage; + uchar *data; + int npix; + + if (DBG_TRACE) + fprintf(stderr, "GtWritePix: Doing PixmapRaster[%s]....depth=%d\n", + dbg_wSize(w), wa.depth); + + /* Get a data buffer. */ + if ((data = (uchar *)XtMalloc (npix = nx * ny)) == NULL) + return (ERR); + + /* Convert the pixel values to colormap indices. */ + cmap = get_cmap_in (w); + for (ip=pixels, op=data, n=npix; --n >= 0; ) { + + /* In TrueColor mode, we preserve the index values in the + ** XImage and apply the colormap when rendering. + */ + *op++ = (wa.depth == ColormapDepth ? + (cmap[*ip++] & 0377) : ((*ip++) & 0377)); + } + + + if (DBG_TRACE) + fprintf(stderr, "GtWritePix: Creating 8-bit ximage\n"); + + ximage = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, nx, ny, 8, 0); + + + if (raster == 0 && w->gterm.pixmap) { + if (DBG_TRACE) + fprintf(stderr, "GtWritePix: type = pixmap, raster=0\n"); + + XPutImage (display, w->gterm.pixmap, w->gterm.exposeGC, + IMGtoGPM(w,ximage,0,0,nx,ny), + 0, 0, x1, y1, nx, ny); + + XCopyArea (display, + GPMtoRPM(w, rp), rp->r.pixmap, + w->gterm.exposeGC, x1, y1, nx, ny, x1, y1); + + } else { + XPutImage (display, rp->r.pixmap, w->gterm.exposeGC, + IMGtoRPM (w,ximage,rp,0,0,nx,ny), + 0, 0, x1, y1, nx, ny); + } + + XtFree ((char *)data); + ximage->data = NULL; + XDestroyImage (ximage); + + } else if (rp->type == ImageRaster) { + int min=256, max=0; + int min1=256, max1=0; + + + if (DBG_TRACE) + fprintf (stderr, + "GtWritePix: ImageRaster....bytes_per_line=%d ras depth=%d\n", + rp->r.ximage->bytes_per_line, rp->r.ximage->depth); + + cmap = get_cmap_in (w); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + ip = pixels; + + if (DBG_TRACE) + fprintf(stderr, + "GtWritePix: Doing ColormapDepth....writing to ximage\n"); + + /* Copy the data into the ximage data raster, converting input + * pixels to Xlib pixel values in the process. + * + * Possibly this should be done at Pixmap write time rather than + * during raster i/o so that the image pixel values are preserved. + * Otherwise reading back pixels is difficult and if the color map + * is dynamically modified the original pixel values may be lost. + * Postponing display pixel value generation would also make it + * easy to add support later for image depths other than 8 bit. + * Doing the conversion to display pixels here is however simpler + * and more efficient so that is how we do it for now. + */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) { + if (wa.depth == ColormapDepth) + *op++ = (cmap[*ip++] & 0xFF); + else + *op++ = (*ip++ & 0xFF); + + if (DBG_TRACE) { + if (*ip < min) min = *ip; + if (*ip > max) max = *ip; + if (cmap[*ip] < min1) min1 = cmap[*ip]; + if (cmap[*ip] > max1) max1 = cmap[*ip]; + } + } + lp += bytes_per_line; + } + + if (DBG_TRACE) + fprintf (stderr, + "CMAP MINMAX: %d %d -- %d %d\n", min, max, min1, max1); + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (wa.depth != ColormapDepth) { /* FIXME */ + update_mapping (w, mp); + refresh_source (w, mp, x1, y1, nx, ny); + /* break; */ + + } else if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + if (DBG_TRACE) + fprintf(stderr, "GtWritePixels[%s] LEAVING....\n", dbg_wSize(w)); + + return (OK); +} + + +/* GtReadPixels -- Read a rectangular region of a raster. + */ +GtReadPixels (w, raster, pixels, nbits, x1, y1, nx, ny) + GtermWidget w; + int raster; + uchar *pixels; + int nbits; /* not used */ + int x1, y1; + int nx, ny; +{ + register uchar *ip, *op; + register Pixel *cmap; + register int n; + + int bytes_per_line, i, nskip = 1; + int x, y, delxin = 0; + XImage *xin; + Raster rp; + uchar *lp; + + + if (DBG_TRACE) + fprintf (stderr, "GtReadPixels: ras=%d %d %d %d %d w->depth=%d\n", + raster, x1, y1, nx, ny, w->gterm.w_depth); + + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Perform some range checks. */ + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + + /* Get the input ximage. + if (rp->type == PixmapRaster) { + */ + if (rp->type == PixmapRaster || (raster == 0 && w->gterm.w_depth > 8)) { + + Display *display = w->gterm.display; + + + if (DBG_TRACE) + fprintf (stderr, "GtReadPixels: rp->type == PixmapRaster [%d]\n", + raster); + + /* Read the pixmap subraster into an ximage. If we are reading the + * screen (raster == 0) and we have an off-screen backing store pixmap, + * use that instead of the screen. + */ + if (w->gterm.w_depth > ColormapDepth) { + Raster ras = (Raster) NULL; + + if (raster) + ras = &w->gterm.rasters[w->gterm.d_raster]; + else + ras = &w->gterm.rasters[0]; + + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? + ras->shadow_pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + + } else { + xin = XGetImage (display, + (raster == 0 && w->gterm.pixmap) ? + w->gterm.pixmap : rp->r.pixmap, + x1, y1, nx, ny, 0xff, ZPixmap); + } + + if (xin == NULL) + return (ERR); + + delxin++; + x = y = 0; + + } else { + xin = rp->r.ximage; + x = x1; + y = y1; + } + nskip = xin->bits_per_pixel / 8; + + if (DBG_TRACE) + fprintf (stderr, + "GtReadPixels: xin->bpp=%d bpl=%d nskip=%d %d,%d %dx%d\n", + xin->bits_per_pixel, xin->bytes_per_line, nskip, + x1, y1, nx, ny); + + if (w->gterm.w_depth == ColormapDepth) + cmap = get_cmap_out (w); + bytes_per_line = xin->bytes_per_line; + lp = (uchar *)xin->data + (y * bytes_per_line + (nskip * x)); + op = pixels; + + /* Copy the data to the output buffer, converting display pixels to + * client pixels in the process. + */ + for (i=0; i < ny; i++) { + for (n=nx, ip=lp; --n >= 0; ) { + if (w->gterm.w_depth == ColormapDepth) { + *op++ = cmap[*ip]; + } else { + *op++ = *ip; + } + ip += nskip; + } + lp += bytes_per_line; + } + + if (delxin) + XDestroyImage (xin); + return (OK); +} + + +/* GtSetPixels -- Set all the raster pixels in a region to a single color. + * If nx=ny=0 the entire raster will be written. + */ +GtSetPixels (w, raster, ct, x1, y1, nx, ny, color, rop) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; + int color; + int rop; +{ + register Raster rp; + Mapping mp; + + /* Get raster pointer. */ + rp = &w->gterm.rasters[raster]; + if (rp->type == 0) + return (ERR); + + /* Get pixel coordinates. */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + raster, ct, x1,y1,nx,ny); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + } + + /* Perform some range checks. */ + if (x1 == 0 && y1 == 0 && nx == 0 && ny == 0) { + nx = rp->width; + ny = rp->height; + } else { + if (x1 < 0 || x1 > rp->width || nx <= 0 || x1+nx > rp->width) + return (ERR); + if (y1 < 0 || y1 > rp->height || ny <= 0 || y1+ny > rp->height) + return (ERR); + } + + /* Set the pixels. + */ + if (rp->type == PixmapRaster) { + Display *display = w->gterm.display; + GC gc = w->gterm.clearGC; + int use_backing_store; + Raster sp = &w->gterm.rasters[0]; + + use_backing_store = + (raster == 0 && w->gterm.pixmap && !(rop & R_Transient)); + + + XSetForeground (display, gc, get_pixel(w,color)); + XFillRectangle (display, rp->r.pixmap, gc, x1, y1, nx, ny); + if (use_backing_store) { + XFillRectangle (display, w->gterm.pixmap, gc, x1, y1, nx, ny); + XFillRectangle (display, sp->shadow_pixmap, w->gterm.clear8GC, + x1, y1, nx, ny); + } + XSetForeground (display, gc, w->gterm.color0); + + } else { + register int n, i; + register uchar *op; + register Pixel pixel; + int bytes_per_line; + uchar *lp; + + pixel = get_pixel (w, color); + bytes_per_line = rp->r.ximage->bytes_per_line; + lp = (uchar *)rp->r.ximage->data + y1 * bytes_per_line + x1; + + /* Set all pixels in the indicated region. */ + for (i=0; i < ny; i++) { + for (n=nx, op=lp; --n >= 0; ) + *op++ = pixel; + lp += bytes_per_line; + } + } + + /* Execute any mappings that reference this raster. */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + return (OK); +} + + +/* GtRefreshPixels -- Update any mappings defined upon the given region of + * the given source raster, as if the pixel values had been set with a + * write pixels call. + */ +GtRefreshPixels (w, raster, ct, x1, y1, nx, ny) + GtermWidget w; + int raster; + int ct; + int x1, y1; + int nx, ny; +{ + register Raster rp = &w->gterm.rasters[raster]; + register Mapping mp; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (DBG_TRACE) + fprintf (stderr, "GtRefreshPixels: ENTER\n"); + + /* Get pixel coordinates. + */ + if (ct != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); + save_mapping (&sv_mp, 0, 0, + raster, ct, x1,y1,nx,ny, + 0, GtPixel, 0,0,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.sx; + y1 = p_mp.sy; + nx = p_mp.snx; + ny = p_mp.sny; + } + + /* Execute any mappings that reference this raster. + */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + + if (DBG_TRACE) + fprintf (stderr, "GtRefreshPixels: mp=0x%x enabled=%d src=%d/%d\n", + mp, mp->enabled, mp->src, raster); + + if (mp->enabled && mp->src == raster) { + struct mapping *map=mp, p_mp; + + if (map->st != GtPixel || map->dt != GtPixel) { + if (DBG_TRACE) + fprintf (stderr,"GtRefreshPixels: update pixtype raster\n"); + + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else { + if (DBG_TRACE) + fprintf (stderr,"GtRefreshPixels: update non-pix raster\n"); + + update_mapping (w, map); + } + + refresh_source (w, map, x1, y1, nx, ny); + if (map == &p_mp) + free_mapping (w, map); + } + } + + if (DBG_TRACE) + fprintf (stderr, "GtRefreshPixels: LEAVING\n"); +} + + +/* GtExtractPixmap -- Extract a rectangular region of a raster and return + * as a pixmap. The caller is responsible for later deleting this pixmap. + */ +Pixmap +GtExtractPixmap (w, src, ctype, x, y, width, height) + GtermWidget w; + int src; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + int x1, y1, nx, ny; + String cache; + int i; + + rp = &w->gterm.rasters[src]; + if (!rp->type) + return ((Pixmap)NULL); + + /* If width and height are zero, return the full raster. */ + if (width <= 0) + width = rp->width; + if (height <= 0) + height = rp->height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0,0,0,0, + src, ctype, x,y,width,height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Find any empty raster slot and use it to generate the output pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + cache = w->gterm.cacheRasters; + w->gterm.cacheRasters = "always"; + + if (GtCreateRaster (w, i, GtServer, nx, ny, /* MF006 */ + RasterDepth) == ERR) { + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + + } else if (rp->type != PixmapRaster) + goto err; + + if (GtCopyRaster (w, 0, + src,0, x1,y1,nx,ny, i,0, 0,0,nx,ny) == ERR) { +err: + GtDestroyRaster (w, i); /* MF005 */ + w->gterm.cacheRasters = cache; + return ((Pixmap)NULL); + } + + rp->type = 0; + w->gterm.nrasters--; + w->gterm.cacheRasters = cache; + + return (rp->r.pixmap); + } + } + + return ((Pixmap)NULL); +} + + +/* GtInsertPixmap -- Insert the contents of the given pixmap into a raster + * at the indicated coordinates. + */ +GtInsertPixmap (w, pixmap, dst, ctype, x, y, width, height) + GtermWidget w; + Pixmap pixmap; + int dst; + int ctype; + int x, y; + int width, height; +{ + register Raster rp; + XWindowAttributes wa; + int x1, y1, nx, ny; + int i; + + /* Check that the pixmap exists. */ + if (!XGetWindowAttributes (w->gterm.display, pixmap, &wa)) + return (ERR); + + /* Default to full dimensions of pixmap if no dimensions given. */ + if (width <= 0) + width = wa.width; + if (height <= 0) + height = wa.height; + + /* Get pixel coordinates. */ + if (ctype != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, GtPixel, 0, 0, 0, 0, + dst, ctype, x, y, width, height); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + x1 = p_mp.dx; + y1 = p_mp.dy; + nx = p_mp.dnx; + ny = p_mp.dny; + + } else { + x1 = x; + y1 = y; + nx = width; + ny = height; + } + + /* Create the destination raster if none exists. */ + if (!w->gterm.rasters[dst].type) + if (GtCreateRaster (w, dst, GtDefault, nx, ny, /* MF006 */ + RasterDepth) == ERR) + return (ERR); + + /* Find an empty raster slot and use it to build a fake source raster + * using the supplied pixmap. + */ + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) { + rp->type = PixmapRaster; + rp->width = nx; + rp->height = ny; + rp->r.pixmap = pixmap; + + if (GtCopyRaster (w, 0, + i,0, 0,0,nx,ny, dst,0, x1,y1,nx,ny) < 0) + return (ERR); + + rp->type = 0; + return (OK); + } + } + + return (ERR); +} + + +/* GtWriteColormap -- Allocate or modify colormap cells. The Gterm widget + * colormap consists of a fixed number of preassigned, read-only color cells, + * plus a variable number of dynamically allocated application defined color + * cells. The application sees only the preassigned pixel space 0-N where + * N is the maximum pixel value. These values are mapped to Xlib pixel values + * by the CMAP vector in the main Gterm widget descriptor. The server + * colormap does the final mapping to RGB triplets. + * + * Our strategy here is as follows. If we have a monochrome screen set up a + * one-to-one fake colormap so that we preserve the input pixel values and + * render a one-bit image later. If we have a StaticGray or StaticColor + * visual allocate read-only color cells to allow X to choose the closest + * colors to what we request. If we have a GrayScale or PseudoColor visual + * allocate private read-write colors. The TrueColor and DirectColor + * visuals should not be seen here as we should have been able to set up the + * PseudoColor visual on screens that support these visuals, but if they are + * seen use a one-to-one mapping to preserve the 8 bit pixel values. + */ +GtWriteColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + XWindowAttributes wa; + register XColor *cp; + register int i, j, v, n, use_wa = 1; + unsigned long plane_masks[1]; + int req, need, ncolors; + + Colormap colormap; + + + if (!w || !XtIsRealized ((Widget)w)) + return (ERR); + + if (DBG_TRACE) { + fprintf (stderr, "GtWriteColormap: ENTER.....\n"); + fprintf (stderr, + "GtWriteColormap: map=%d first=%d nelem=%d gt.ncols=%d\n", + map, first, nelem, w->gterm.ncolors); + } + + if (map > 0) { + /* Create or modify a colormap descriptor. The display colormap + * is not affected. + */ + register struct colormap *cm; + struct colormap *last_cm; + register XColor *cp; + register int i; + + + + if (DBG_TRACE) + fprintf (stderr, "GtWriteColormap: create/modify map = %d\n", map); + + /* See if the colormap already exists. + */ + for (cm = w->gterm.colormaps, last_cm = NULL; cm; cm = cm->next) { + last_cm = cm; + if (cm->map == map) + break; + } + + /* If not, create it. + */ + if (!cm) { + if (!(cm = (struct colormap *)XtCalloc(1,sizeof(struct colormap)))) + return (ERR); + if (last_cm) + last_cm->next = cm; + else + w->gterm.colormaps = cm; + + /* Initialize static part of colormap. */ + for (i=0; i < SZ_STATIC_CMAP; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + } + + cm->map = map; + cm->ncells = max (cm->ncells, first + nelem); + + /* Ignore attempts to overwrite static part of colormap. + */ + for ( ; first < SZ_STATIC_CMAP; first++, nelem--) { + r++; g++; b++; + } + + if (nelem >= 0) { + memmove (&cm->r[first], r, nelem * sizeof (ushort)); + memmove (&cm->g[first], g, nelem * sizeof (ushort)); + memmove (&cm->b[first], b, nelem * sizeof (ushort)); + } + + + if (DBG_TRACE) + fprintf (stderr, "GtWriteColormap: map=%d -- RETURNING\n",map); + + return (OK); + } + + /* Write to the display colormap. + */ + if (first < SZ_STATIC_CMAP || first + nelem > MAX_SZCMAP) + return (ERR); + + /* Invalidate the cmap cache. + */ + invalidate_cmap (w); + + /* Get the window attributes. We need to do this to determine the type + * of visual used for the window, which determines our color allocation + * strategy. This is only done once since presumably the visual and + * window depth will not change after the widget has been around long + * enough to receive a GtWriteColormap call. + */ + if (w->gterm.w_depth == 0 && w->gterm.w_visual_class == 0) { + if (!XGetWindowAttributes (w->gterm.display, w->gterm.window, &wa)) + return (ERR); + w->gterm.wa = wa; + w->gterm.wa_defined++; + + if (wa.depth == 1) + goto unitary; + } else + use_wa = 0; + + + switch ((use_wa ? wa.visual->class : w->gterm.w_visual_class)) { + case StaticGray: + case StaticColor: + /* Allocate "best-match" colors. */ + for (i=first; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + cp->red = r[i-first]; + cp->green = g[i-first]; + cp->blue = b[i-first]; + cp->flags = (DoRed | DoGreen | DoBlue); + if (XAllocColor (w->gterm.display, wa.colormap, cp)) { + w->gterm.cmap[i] = cp->pixel; + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + } + } + break; + + case GrayScale: + case PseudoColor: + if (DBG_TRACE) + fprintf (stderr, + "GtWriteColormap: PSEUDOCOLOR vis, defCM=%d, gt.ncols=%d\n", + w->gterm.useDefaultCM, w->gterm.ncolors); + + if (w->gterm.useDefaultCM) { +usedef: /* Allocate private r/w colors from default colormap. */ + need = first + nelem - w->gterm.ncolors; + + /* Allocate new color cells if needed. If we can't allocate all + * the requested cells the unallocated pixel values are set to + * black. + */ + if ((n = need) > 0) { + /* Get the colormap cells. */ + req = min(w->gterm.maxColors, first + nelem - SZ_STATIC_CMAP) - + (w->gterm.ncolors - SZ_STATIC_CMAP); + for (n=0; req > 0 && n < need; ) + if (XAllocColorCells (w->gterm.display, wa.colormap, + False, plane_masks, 0, + &w->gterm.cmap[w->gterm.ncolors+n], req)) { + n += req; + } else + req /= 2; + + /* Initialize the color descriptors. */ + for (i = w->gterm.ncolors; i < first+nelem; i++) { + cp = &w->gterm.color[i]; + if (i < w->gterm.ncolors + n) { + cp->pixel = w->gterm.cmap[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + } else { + w->gterm.cmap[i] = cp->pixel = + BlackPixelOfScreen (w->gterm.screen); + cp->flags = 0; + } + } + w->gterm.ncolors += n; + } + + if (DBG_TRACE) + fprintf (stderr, + "GtWriteColormap: PSEUDOCOLOR defCM, need=%d gt.ncols=%d\n", + need, w->gterm.ncolors); + + /* Assign RGB colors to the referenced cells. */ + for (i=0; i < nelem; i++) { + cp = &w->gterm.color[first+i]; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + } + + n = w->gterm.ncolors - first; + if (n > 0) + XStoreColors (w->gterm.display, wa.colormap, + &w->gterm.color[first], n); + + } else { + /* Allocate colors in a custom colormap. If the named colormap + * does not yet exist we create one. Multiple gterm widget + * instances may share the same colormap. + */ + long timeval, time(); + int shadow; + + + /* get_colormap will direct us to the default colormap if the + * custom colormap cannot be accessed or created. + */ + colormap = get_colormap (w); + if (w->gterm.useDefaultCM) + goto usedef; + + /* Assign RGB colors to the referenced cells. */ + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + if (DBG_TRACE) { + fprintf (stderr, "GtWriteColormap: PSEUDOCOLOR custom cmap\n"); + fprintf (stderr, + "GtWriteColormap: Pseudo: first=%d nelem=%d -> ncols=%d/%d\n", + first, nelem, ncolors, w->gterm.ncolors); + } + + for (i=0; i < ncolors; i++, cp++) { + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, + "GtWriteColormap: Pseudo: %3d (%3d %3d %3d) %d / %d\n", + i, r[i]>>8,g[i]>>8,b[i]>>8, w->gterm.ncolors, ncolors); + } + + if (DBG_TRACE) + fprintf (stderr, + "GtWriteColormap: first=%d nelem=%d ncol=%d %d\n", + first, nelem, ncolors, w->gterm.ncolors); + + /* Store the new colors. */ + if (ncolors > 0) + XStoreColors (w->gterm.display, + colormap, &w->gterm.color[first], ncolors); + + /* Also attempt to store the colors in the default colortable, + * by allocating, writing, and then deallocating cells. This + * helps keeps the gterm window visible when the default + * colormap is loaded. To avoid excessive server queries the + * default colormap is only updated every so often. Updating is + * disabled if cmapShadow is set to zero. If shadowing is + * enabled the update is always performed if the WriteColormap + * occurs when the pointer is not in the window (e.g., when a + * button elsewhere in the GUI is pressed) as otherwise the + * change will not be visible as the private colormap will not + * be loaded by the window manager. + */ + shadow = w->gterm.cmapShadow; + timeval = time((long *)NULL); + + if (shadow && (!w->gterm.in_window || + (timeval - w->gterm.cmapLastShadow > shadow * 1000))) { + update_default_colormap (w); + w->gterm.cmapLastShadow = timeval; + } + } + + if (DBG_TRACE) + fprintf (stderr, "GtWriteColormap: PSEUDOCOLOR DONE\n"); + break; + + default: + /* Set up a unitary, or one-to-one mapping, to preserve the input + * pixel values so that we can render them later. + */ + if (DBG_TRACE) + fprintf (stderr, "GtWriteColormap: visual default case\n"); + +unitary: + colormap = get_colormap (w); + + if ((first+nelem) > MAX_SZCMAP) + break; + + if (w->gterm.useGlobalCmap) + break; + + first = SZ_STATIC_CMAP; + ncolors = min (w->gterm.maxColors, nelem); + cp = &w->gterm.color[first]; + + if (DBG_TRACE) + fprintf (stderr, + "GtWriteColormap: unitary: first=%d nelem=%d -> ncolors=%d/%d\n", + first, nelem, ncolors, w->gterm.ncolors); + + for (i = 0; i < ncolors; i++, cp++) { + w->gterm.cmap[i] = i; + cp->pixel = i; + cp->red = r[i]; + cp->green = g[i]; + cp->blue = b[i]; + cp->flags = (DoRed | DoGreen | DoBlue); + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, + "GtWriteColormap: True: %3d: (%3d, %3d, %3d) %d / %d\n", + i, r[i]>>8, g[i]>>8, b[i]>>8, w->gterm.ncolors, ncolors); + + if (i+1 > w->gterm.ncolors) + w->gterm.ncolors = i + 1; + } + + if (DBG_TRACE) { + fprintf (stderr, + "GtWriteColormap: map=%d first=%d nelem=%d ncol=%d %d\n", + map, first, nelem, ncolors, w->gterm.ncolors); + fprintf (stderr, "GtWriteColormap: TRUECOLOR DONE\n"); + } + + break; + } + + + if (DBG_TRACE) { + dbg_printCmaps (w); + fprintf (stderr, "GtWriteColormap: LEAVING\n"); + } + + return (OK); +} + + +/* GtReadColormap -- Return the color assignments for a region of the named + * colormap. + */ +GtReadColormap (w, map, first, nelem, r, g, b) + GtermWidget w; + int map; + int first; + int nelem; + ushort *r, *g, *b; +{ + register int i; + + + if (DBG_TRACE) + fprintf (stderr, "GtReadColormap: ENTER map=%d first=%d nelem=%d\n", + map, first, nelem); + + if (w->gterm.useGlobalCmap) { + for (i=0; i < MAX_SZCMAP; i++) { + r[i] = global_color[i].red; + g[i] = global_color[i].green; + b[i] = global_color[i].blue; + } + return (SZ_STATIC_CMAP + SZ_DYNAMIC_CMAP + SZ_OVERLAY_CMAP); + } + + + /* Clear the output colormap. + */ + for (i=0; i < MAX_SZCMAP; i++) r[i] = g[i] = b[i] = 0; + + if (map > 0) { + /* Read from a colormap descriptor. + */ + register struct colormap *cm; + register int i, j; + + /* Locate colormap. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + j = first + i; + if (j < cm->ncells) { + r[i] = cm->r[j]; + g[i] = cm->g[j]; + b[i] = cm->b[j]; + } else + break; + } + + return (i); + + } else { + /* Read the display colormap. + */ + register XColor *cp; + + /* Return RGB values. */ + for (i=0; i < nelem; i++) { + if (first+i < w->gterm.ncolors) { + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "GtReadColormap: %3d %3d %3d %3d\t", + first+i, r[i]>>8, g[i]>>8, b[i]>>8); + + cp = &w->gterm.color[first+i]; + r[i] = (ushort) cp->red; + g[i] = (ushort) cp->green; + b[i] = (ushort) cp->blue; + } else + break; + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr,"%3d\t%3d %3d %3d\n",i,r[i]>>8,g[i]>>8,b[i]>>8); + } + + if (DBG_TRACE) + fprintf (stderr, "GtReadColormap: LEAVING ncolors=%d\n", i); + return (i); + } +} + + +/* GtLoadColormap -- Load a colormap into the display, optionally scaling + * the colormap via a linear transformation in the process. The colormap is + * unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. + * If map=0 the linear transformation is applied directly to the display + * colormap. + * + * The offset refers to the center of the mapped region of the transfer + * function, which is why the center value is at 0.5. For example, if the + * range of raster pixel intensities is normalized to the range 0.0 to 1.0, + * then a transfer function of [offset=0.3,slope=3.0] will display the region + * of intenstities centered around the normalized intenstity of 0.3, with a + * contrast of 3.0 (the screen intensity changes 3 units for a unit change in + * raster pixel intensity). The transfer function [offset=0.3,slope=-3.0] + * will display the same range of pixel intensitites, but with a negative + * contrast. The transfer function [offset=0.5,slope=1.0] has intercepts + * of [0,0] and [1,1] hence it displays the full range of raster pixel + * intensities - the input colormap is used as is, without resampling. + */ +GtLoadColormap (w, map, offset, slope) + GtermWidget w; + int map; + float offset, slope; +{ + register int i; + register XColor *cp; + register struct colormap *cm; + struct colormap d_cmap, o_cmap; + int noscale, nelem, c1, c2; + float x, y, z, frac; + ushort r, g, b; + + + if (DBG_TRACE) + fprintf (stderr, "GtLoadColormap: map=%d offset=%f slope=%f\n", + map, offset, slope); + + /* Get the colormap to be loaded. + */ + if (map == 0) { + /* Create a dummy colormap struct from the screen colormap. + */ +dummy: + cm = &d_cmap; + cm->map = 0; + cm->next = NULL; + cm->ncells = w->gterm.ncolors; + for (i=0; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cm->r[i] = cp->red; + cm->g[i] = cp->green; + cm->b[i] = cp->blue; + } + + } else { + /* Locate colormap. + */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + + if (DBG_TRACE) + fprintf (stderr, "GtLoadColormap: map=%d/%d cm=0x%x ncells=%d\n", + map, cm->map, cm, cm->ncells); + + if (!cm) + return (ERR); + } + + /* Compute the scaled colormap. Only the dynamic part of the colormap + ** is scaled, the static cells are not affected. + */ + o_cmap.map = 0; + o_cmap.ncells = cm->ncells; + if (w->gterm.useGlobalCmap) + nelem = SZ_DYNAMIC_CMAP; + else + nelem = cm->ncells - SZ_STATIC_CMAP; + noscale = (abs(offset - 0.5) < 0.0001 && abs(slope - 1.0) < 0.0001); + + if (noscale) { + for (i=0; i < nelem; i++) { + o_cmap.r[i] = cm->r[SZ_STATIC_CMAP+i]; + o_cmap.g[i] = cm->g[SZ_STATIC_CMAP+i]; + o_cmap.b[i] = cm->b[SZ_STATIC_CMAP+i]; + } + } else { + if (DBG_TRACE) + fprintf (stderr,"GtLoadColormap: scaling cmap; nelem=%d\n", nelem); + + for (i=0; i < nelem; i++) { + x = (float)i / (float)(nelem - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + r = cm->r[SZ_STATIC_CMAP]; + g = cm->g[SZ_STATIC_CMAP]; + b = cm->b[SZ_STATIC_CMAP]; + } else if (y >= 1.0) { + r = cm->r[cm->ncells-1]; + g = cm->g[cm->ncells-1]; + b = cm->b[cm->ncells-1]; + } else { + z = y * (nelem - 1) + SZ_STATIC_CMAP; + if (w->gterm.cmapInterpolate) { + c1 = (int)z; + c2 = min (cm->ncells-1, c1 + 1); + frac = z - c1; + r = cm->r[c1] * (1.0 - frac) + cm->r[c2] * frac; + g = cm->g[c1] * (1.0 - frac) + cm->g[c2] * frac; + b = cm->b[c1] * (1.0 - frac) + cm->b[c2] * frac; + } else { + c1 = (int)z; + r = cm->r[c1]; + g = cm->g[c1]; + b = cm->b[c1]; + } + } + + o_cmap.r[i] = r; + o_cmap.g[i] = g; + o_cmap.b[i] = b; + } + } + + if (w->gterm.useGlobalCmap) { + for (i=0; i < nelem; i++) { + global_color[i+SZ_STATIC_CMAP].red = o_cmap.r[i]; + global_color[i+SZ_STATIC_CMAP].green = o_cmap.g[i]; + global_color[i+SZ_STATIC_CMAP].blue = o_cmap.b[i]; + } + global_color[i+SZ_STATIC_CMAP-1].red = o_cmap.r[i] = o_cmap.r[i-2]; + global_color[i+SZ_STATIC_CMAP-1].green = o_cmap.g[i] = o_cmap.g[i-2]; + global_color[i+SZ_STATIC_CMAP-1].blue = o_cmap.b[i] = o_cmap.b[i-2]; + nelem = SZ_DYNAMIC_CMAP; + valid_lut = 0; + } + + /* Load the colormap into the display. + */ + if (DBG_TRACE) + fprintf (stderr, "GtLoadColormap: loading colormap into display\n"); + GtWriteColormap (w, 0, SZ_STATIC_CMAP, nelem, + o_cmap.r, o_cmap.g, o_cmap.b); + + + /* If the colormap we loaded to the display was the display colormap, + ** restore the original unscaled colors in the gterm descriptor so that + ** we won't be scaling a scaled colormap in the next operation. + */ + if (map == 0) { + for (i=SZ_STATIC_CMAP; i < cm->ncells; i++) { + cp = &w->gterm.color[i]; + cp->red = cm->r[i]; + cp->green = cm->g[i]; + cp->blue = cm->b[i]; + } + } + + if (w->gterm.useGlobalCmap) { + Mapping mp; + + /* Execute any mappings that reference this raster. + */ + for (mp = w->gterm.mp_head; mp; mp = mp->next) { + if (mp->enabled) { + struct mapping *map=mp, p_mp; + + if (map->st != GtPixel || map->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, map, &p_mp, 1); + update_mapping (w, map = &p_mp); + } else + update_mapping (w, map); + + if (colormap_focus > 0 && colormap_focus < mp->snx) { + /* If we're doing a focused update, refresh only the + ** central part of the main display. + */ + int half = colormap_focus; + int full = ((half * 2 > 512) ? 512 : half * 2); + + /* refresh_source (w, map, + mp->sx+(mp->snx/2 - 64), mp->sy+(mp->sny/2 - 64), + 128, 128); */ + + refresh_source (w, map, + mp->sx+(mp->snx/2 - half), mp->sy+(mp->sny/2 - half), + full, full); + } else { + refresh_source (w, map, mp->sx, mp->sy, mp->snx, mp->sny); + } + + if (map == &p_mp) + free_mapping (w, map); + + /* if (colormap_focus) break; */ + } + } + } + + return (OK); +} + +GtSetColormapFocus (int box_size) +{ + if (box_size != 0) + colormap_focus = ((box_size > 0 && box_size < 64) ? 64 : box_size); +} + + +/* GtQueryColormap -- Return information on the size and state of a colormap. + */ +GtQueryColormap (w, map, first, nelem, maxelem) + register GtermWidget w; + int map; + int *first, *nelem, *maxelem; +{ + register struct colormap *cm; + int nitems; + + if (first) + *first = SZ_STATIC_CMAP; + if (nelem) + *nelem = 0; + if (maxelem) + *maxelem = min (w->gterm.maxColors, MAX_SZCMAP) - SZ_STATIC_CMAP; + + if (w->gterm.useGlobalCmap) { + *first = SZ_STATIC_CMAP; + *nelem = SZ_STATIC_CMAP + SZ_DYNAMIC_CMAP + SZ_OVERLAY_CMAP; + *maxelem = SZ_STATIC_CMAP + SZ_DYNAMIC_CMAP + SZ_OVERLAY_CMAP; + + } else if (map > 0) { + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map == map) + break; + if (!cm) + return (0); + + if (nelem) + *nelem = cm->ncells - SZ_STATIC_CMAP; + + } else { + if (nelem) + *nelem = w->gterm.ncolors - SZ_STATIC_CMAP; + if (maxelem) { + nitems = min (MAX_SZCMAP, CellsOfScreen(w->gterm.screen)); + *maxelem = min (nitems, + min (w->gterm.maxColors, MAX_SZCMAP - w->gterm.base_pixel)); + } + + } + if (DBG_TRACE) + fprintf (stderr, + "GtQueryColormap: map=%d -> first=%d nelem=%d max=%d\n", + map, *first, *nelem, *maxelem); + + return (1); +} + + +/* GtNextColormap -- Return a unique colormap number. + */ +GtNextColormap (w) + register GtermWidget w; +{ + register struct colormap *cm; + register int mapno = 0; + + /* Get the next map number. */ + for (cm = w->gterm.colormaps; cm; cm = cm->next) + if (cm->map > mapno) + mapno = cm->map; + + return (mapno + 1); +} + + +/* GtFreeColormap -- Free a colormap descriptor. + */ +GtFreeColormap (w, colormap) + register GtermWidget w; + int colormap; +{ + register struct colormap *p_cm, *cm; + + /* Find the colormap and free it. */ + for (p_cm = NULL, cm = w->gterm.colormaps; cm; p_cm = cm, cm = cm->next) + if (cm->map == colormap) { + if (p_cm) + p_cm->next = cm->next; + else + w->gterm.colormaps = cm->next; + XtFree ((char *)cm); + return; + } +} + + +/* GtWriteIomap -- An iomap is an optional lookup table used to isolate the + * client application from the color model used within the Gterm widget. + * To simplify color allocation the Gterm widget defines a logical color + * space where color 0 is the background, 1 the foreground, 2-N are statically + * allocated standard colors, and colors N+1 and above are dynamically + * allocated by the graphics application. Less-demanding applications use + * only the statically allocated, shared colors. The widget internally maps + * these logical colors to whatever the window system requires, but providing + * a well-defined logical color space isolates the client from the details of + * color allocation in the underlying window system. + * + * An iomap can be used to define a mapping between the color model of the + * client application and the Gterm color model (when we say color model here + * we mean color allocation schemes for 8 bit pseudocolor). By default the + * iomap is one-to-one. The use of an iomap frees the client from having to + * worry about color index translations, and allows color tables to be + * combined in the widget for greater efficiency when color tables are serially + * applied. The iomap applies to all color indices or pixel values passed + * in i/o operations between the client and the Gterm widget. + */ +GtWriteIomap (w, iomap, first, nelem) + register GtermWidget w; + ushort *iomap; + int first, nelem; +{ + register int c1, c2; + + if (w->gterm.useGlobalCmap) + return; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + + if (DBG_TRACE) + fprintf (stderr,"GtWriteIomap: first=%d nelem=%d -> c1=%d c2=%d (%d)\n", + first, nelem, c1, c2, (c2-c1+1)); + + nelem = c2 - c1 + 1; + + memmove (&w->gterm.iomap[c1], iomap, nelem * sizeof(ushort)); + invalidate_cmap (w); + + if (DBG_IOMAP) { + int i; + for (i=0; i < MAX_SZCMAP; i++) + fprintf (stderr, "iomap[%3d] = %d\n", i, w->gterm.iomap[i]); + } +} + + +/* GtReadIomap -- Read back the contents of the iomap. + */ +GtReadIomap (w, iomap, first, nelem) + register GtermWidget w; + uchar *iomap; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (iomap, &w->gterm.iomap[c1], nelem * sizeof(ushort)); +} + + +/* GtReadLUT -- Read back the contents of the global LUT. + */ +GtReadLUT (w, lut, first, nelem) + register GtermWidget w; + unsigned long *lut; + int first, nelem; +{ + register int c1, c2; + + c1 = max(0, min(MAX_SZCMAP-1, first)); + c2 = max(0, min(MAX_SZCMAP-1, first + nelem - 1)); + nelem = c2 - c1 + 1; + + memmove (lut, &global_lut[c1], nelem * sizeof(unsigned long)); +} + + +/* init_iomap -- Initialize the iomap and the cmap cache. + */ +static void +init_iomap (w) + GtermWidget w; +{ + register ushort *iomap = w->gterm.iomap; + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + iomap[i] = i; + invalidate_cmap (w); +} + +/* init_global_map -- Initialize the global cmap; + */ +static void +init_global_cmap () +{ + register int i; + + for (i=0; i < MAX_SZCMAP; i++) + global_cmap[i] = (Pixel) i; +} + +/* invalidate_cmap -- Invalidate the cmap cache. + */ +static void +invalidate_cmap (w) + register GtermWidget w; +{ + w->gterm.cmap_in_valid = w->gterm.cmap_out_valid = 0; +} + + +/* get_cmap_in -- Get the combined input colormap, used to transform color + * values received from the client to window system color indices. + */ +static Pixel * +get_cmap_in (w) + register GtermWidget w; +{ + register Pixel *cmap, *cmap_in = w->gterm.cmap_in; + register ushort *iomap; + register int i, j; + int ncolors; + + + if (w->gterm.useGlobalCmap) + return (global_cmap); + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "get_cmap_in: valid=%d ncolors=%d\n", + w->gterm.cmap_in_valid, (w->gterm.ncolors - SZ_STATIC_CMAP)); + + if (w->gterm.cmap_in_valid) + return (cmap_in); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + ncolors = w->gterm.ncolors - SZ_STATIC_CMAP; + + /* If ncolors is small wrap around so that pixel values stay within + * the mapped range of output pixels. + */ + for (i=0; i < MAX_SZCMAP; i++) { + j = iomap[i]; + if (j > SZ_STATIC_CMAP && ncolors) + j = ((j - SZ_STATIC_CMAP) % ncolors) + SZ_STATIC_CMAP; + cmap_in[i] = cmap[j]; + } + + w->gterm.cmap_in_valid++; + return (cmap_in); +} + + +/* get_cmap_out -- Get the combined output colormap, used to transform window + * system color indices to the color system of the client. Note that this is + * not necessarily a uniquely defined invertible transformation. + */ +static Pixel * +get_cmap_out (w) + GtermWidget w; +{ + register Pixel *cmap; + register ushort *iomap; + Pixel *cmap_out = w->gterm.cmap_out; + register int pixel, i; + int j; + + + if (w->gterm.useGlobalCmap) + return (global_cmap); + + if (DBG_TRACE && DBG_CM_VERB) + fprintf (stderr, "get_cmap_out: valid=%d ncolors=%d\n", + w->gterm.cmap_out_valid, (w->gterm.ncolors - SZ_STATIC_CMAP)); + + if (w->gterm.cmap_out_valid) + return (cmap_out); + + cmap = w->gterm.cmap; + iomap = w->gterm.iomap; + + /* Invert the two colormaps. This is not very efficient, but we don't + * have to do this very often (a GtReadPixels call is about the only + * case, and even then the map is cached). + */ + for (j=0; j < MAX_SZCMAP; j++) { + pixel = j; + + /* Lookup display pixel in cmap. */ + for (i=0; i < MAX_SZCMAP; i++) + if (cmap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + + /* Lookup cmap pixel in iomap. */ + if (iomap[pixel] != pixel) { + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + pixel = i; + break; + } + if (i >= MAX_SZCMAP) { + cmap_out[j] = 0; + continue; + } + } + + cmap_out[j] = pixel; + } + + w->gterm.cmap_out_valid++; + return (cmap_out); +} + + +/* get_pixel -- Convert a client color index into a display pixel. + */ +static Pixel +get_pixel (w, client_pixel) + register GtermWidget w; + register int client_pixel; +{ + register Pixel *cmap = get_cmap_in (w); + + if (client_pixel < 0 || client_pixel >= MAX_SZCMAP) + return (w->gterm.cmap[1]); + else + return (cmap[client_pixel]); +} + + +/* GtGetClientPixel -- Convert a gterm pixel into a client pixel. + */ +GtGetClientPixel (w, pixel) + GtermWidget w; + register int pixel; +{ + register int i; + register ushort *iomap; + int client_pixel = 0; + + get_cmap_in (w); + iomap = w->gterm.iomap; + + for (i=0; i < MAX_SZCMAP; i++) + if (iomap[i] == pixel) { + client_pixel = i; + break; + } + + return (client_pixel); +} + + +/* GtInitMappings -- Delete all mappings and initialize the mapping subsystem. + */ +GtInitMappings (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + invalidate_draw_context (w); + + /* Free any mapping storage. */ + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (mp->defined) + free_mapping (w, mp); + } + XtFree ((char *)w->gterm.mappings); + w->gterm.mp_head = NULL; + w->gterm.mp_tail = NULL; + } + + /* Allocate the initially empty mapping descriptors. */ + w->gterm.mappings = + (Mapping) XtCalloc (w->gterm.maxMappings, sizeof (struct mapping)); + + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + mp->mapping = i; + } + + w->gterm.nmappings = 0; +} + + +/* GtNextMapping -- Return the index of the next available mapping descriptor. + * This routine always returns a mapping index of 1 or higher. + */ +GtNextMapping (w) + register GtermWidget w; +{ + register Mapping mp; + register int i; + + for (i=1; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + return (i); + } + + return (-1); +} + + +/* GtFreeMapping -- Free a mapping descriptor. + */ +GtFreeMapping (w, mapping) + register GtermWidget w; + int mapping; +{ + free_mapping (w, &w->gterm.mappings[mapping]); +} + + +/* GtRaiseMapping -- Set the stacking order of a mapping to one level + * higher than the reference mapping. If no reference mapping is given + * the mapping is raised to the top of the stacking order. + */ +GtRaiseMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = w->gterm.mp_tail; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already on top? */ + if (mp == w->gterm.mp_tail) + return; + + mp_unlink (w, mp); + mp_linkafter (w, mp, ref_mp); +} + + +/* GtLowerMapping -- Change the stacking order of a mapping relative to another + * mapping, causing the first mapping to be drawn below the second. + */ +GtLowerMapping (w, mapping, reference) + register GtermWidget w; + int mapping, reference; +{ + register Mapping mp, ref_mp; + + mp = &w->gterm.mappings[mapping]; + if (!mp->defined) + return; + + if (reference <= 0 || reference >= w->gterm.maxMappings) + ref_mp = NULL; + else + ref_mp = &w->gterm.mappings[reference]; + + /* Already lowered? */ + if (mp == w->gterm.mp_head) + return; + + /* Lower it. */ + mp_unlink (w, mp); + if (ref_mp && ref_mp->prev) + mp_linkafter (w, mp, ref_mp->prev); + else { + mp->next = w->gterm.mp_head; + w->gterm.mp_head = mp; + if (mp->next) + mp->next->prev = mp; + if (!w->gterm.mp_tail) + w->gterm.mp_tail = mp; + } +} + + +/* GtCompareMappings -- Compare the stacking order of two mappings. A + * negative value is returned if the m1 < m2, zero is returned if the + * mappings are the same, and a positive value is returned if m1 > m2. + */ +GtCompareMappings (w, map1, map2) + register GtermWidget w; + int map1, map2; +{ + register Mapping mp, mp1, mp2; + + if (map1 == map2) + return (0); + + mp1 = &w->gterm.mappings[map1]; + mp2 = &w->gterm.mappings[map2]; + + for (mp = w->gterm.mp_head; mp; mp = mp->next) + if (mp == mp1) + return (-1); + else if (mp == mp2) + return (1); + + return (0); +} + + +/* GtSelectRaster -- Select the raster which maps to the given raster pixel, + * and transform the coordinates back to the source raster. The raster number + * and the raster coordinates of the source raster are returned. If no raster + * maps to the given pixel, raster=src and source raster coordinates are + * returned. + * + * The raster pixel coordinate system is best explained by an example. + * Suppose we have a 10x10 raster mapped into a 500x500 window. The + * window pixel 0 on an axis has raster pixel coordinate 0.0; pixel 500 + * (which is outside the window) has raster pixel coordinate 10.0. The + * coordinates correspond to the edge of the pixel as displayed in the + * window, i.e., the left edge of the (nonflipped) window is at x=0.0, and + * the right edge at x=10.0. Due to the pixelization of the screen, the + * maximum value is a limit which is only approached as the magnification + * increases. + * + * The client application may have a different coordinate system than the + * above. For example, if the client wants an integer pixel value to be + * at the center of a pixel, the first pixel has the coordinate [1,1], and + * the raster is 10 pixels wide, the client coordinate system would range + * from 0.5 to 10.5 at the edges of the NDC space. + */ +GtSelectRaster (w, dras, dt, dx, dy, rt, rx, ry, rmap) + GtermWidget w; + int dras; /* display raster */ + int dt; /* coordinate type of input coords */ + int dx, dy; /* display raster coordinates */ + int rt; /* coordinate type for output */ + int *rx, *ry; /* raster coordinates (output) */ + int *rmap; /* mapping selected */ +{ + register Mapping mp; + float x, y, x2, y2; + int raster, mapping; + + /* Get display raster pixel coordinates. */ + if (dt != GtPixel) { + struct mapping sv_mp, p_mp; + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, 0, 0, + 0, 0, 0,0,0,0, + 0, dt, dx,dy,0,0); + get_pixel_mapping (w, &sv_mp, &p_mp, 0); + + dx = p_mp.dx; + dy = p_mp.dy; + } + + /* Search for a mapping which maps to this pixel. The mapping we are + * looking for is the mapping closest to the tail of the mapping list + * (highest stacking order) which is defined and enabled and which + * includes the given display raster pixel in its destination rect. + */ + for (mp = w->gterm.mp_tail, mapping = -1; mp; mp = mp->prev) { + if (mp->defined && mp->enabled && mp->dst == dras) { + struct mapping *map, p_mp; + int dnx, dny; + + get_pixel_mapping (w, mp, &p_mp, 0); + map = &p_mp; + + if ((dnx = map->dnx) < 0) + dnx = -dnx; + if ((dny = map->dny) < 0) + dny = -dny; + + /* Is display raster pixel in destination rect for this mapping? + */ + if (dnx > 0 && dx >= map->dx && dx < map->dx + dnx && + dny > 0 && dy >= map->dy && dy < map->dy + dny) { + + /* Compute offset into destination rect and apply axis flip + * if any from mapping. + */ + x = dx - map->dx + 0.5; + if (map->dnx < 0) + x = dnx - x; + y = dy - map->dy + 0.5; + if (map->dny < 0) + y = dny - y; + + /* Compute the source raster coordinates corresponding to + * the given display pixel. This is done in floating point + * to permit fractional pixel resolution if the mapping + * zooms the raster. + */ + x = x * (float)map->snx / (float)dnx + map->sx; + y = y * (float)map->sny / (float)dny + map->sy; + + mapping = map->mapping; + raster = map->src; + x2 = w->gterm.rasters[raster].width; + y2 = w->gterm.rasters[raster].height; + + break; + } + } + } + + /* Return display raster coordinates if no mapped raster was found. + */ + if (mapping < 0) { + x = dx; y = dy; + x2 = (int)w->core.width - 1; + y2 = (int)w->core.height - 1; + raster = dras; + } + + /* Output coordinates of the requested type. The increased resolution + * of NDC coordinates allows fractional pixel coordinates to be returned + * (e.g. 1/32 of a pixel for a 1K raster). + */ + if (rt == GtPixel) { + *rx = x; + *ry = y; + } else { + *rx = ( x) / x2 * MAXNDC; + *ry = (y2 - y) / y2 * MAXNDC; /* NDC is flipped in Y */ + } + + *rmap = mapping; + return (raster); +} + + +/* GtCopyRaster -- Copy a region of the source raster to a region of the + * destination raster. If the input and output regions are not the same + * size the subimage is automatically scaled to fit the destination region. + * If the destination extent DNX or DNY is negative, the image is flipped in + * that axis. The type of spatial scaling performed is determined by the + * scale factors (zoom, dezoom, or no scaling). The rasterop argument is + * used to exercise fine control over how the mapping is performed, e.g., to + * force a refresh, implement a transient mapping, or in the case of a dezoom + * (many-to-one) mapping, select the antialiasing technique to be used. + */ +GtCopyRaster (w, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for destination raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + struct mapping sv_mp, p_mp; /* MF007 */ + int status; + + + if (DBG_TRACE) + fprintf(stderr, "GtCopyRaster() -- ENTER\n"); + + if (!w || !XtIsRealized ((Widget)w)) + return (OK); + + /* Construct a temporary mapping describing the desired raster copy. */ + initialize_mapping (&sv_mp); /* MF035 */ + save_mapping (&sv_mp, w->gterm.maxMappings, 0, + src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + initialize_mapping (&p_mp); + get_pixel_mapping (w, &sv_mp, &p_mp, 1); + update_mapping (w, &p_mp); + + /* Refresh the destination pixels. */ + status = refresh_destination (w, &p_mp, dx, dy, abs(dnx), abs(dny)); + + /* Discard the temporary mapping. */ + free_mapping (w, &p_mp); + + + if (DBG_TRACE) + fprintf(stderr, "GtCopyRaster() -- RETURNING\n"); + + return (status); +} + + +/* GtSetMapping -- Define a new mapping function, or modify an old one. + * If a new mapping is defined it is merely enabled, and no refreshing + * of the screen takes place until either some mapped data is written + * to or the mapping is explicitly refreshed. If an existing mapping is + * modified the old and new mappings are examined and only those portions + * of the destination rect for which the mapping changed are updated. + * This permits minor changes to a mapping (e.g. moving an edge) without + * having to redraw the entire region. Regions of the destination drawable + * which were previously covered by the mapping but which were exposed by + * modifying the mapping are redrawn. + */ +GtSetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int rop; /* rasterop */ + int src; /* 0=window, >0 = raster number */ + int st; /* coordinate type for source raster */ + int sx,sy,snx,sny; /* source raster */ + int dst; /* 0=window, >0 = raster number */ + int dt; /* coordinate type for source raster */ + int dx,dy,dnx,dny; /* destination raster */ +{ + register int i, j; + register Mapping mp, o_mp, n_mp; + struct mapping pix_mp, new_mp; + int defined, scale_changed, offset, current, state, old_i; + int nx, xs[MAX_REGIONS], xe[MAX_REGIONS], xv[MAX_REGIONS]; + int ny, ys[MAX_REGIONS], ye[MAX_REGIONS], yv[MAX_REGIONS]; + int n_dnx, n_dny, n_xflip=0, n_yflip=0, i1, i2; + int o_dnx, o_dny, o_xflip=0, o_yflip=0; + int *o_xymap, *o_xmap, *o_ymap; + int *n_xymap, *n_xmap, *n_ymap; + int dummy_rop; /* MF011 */ + XRectangle rl[MAX_REGIONS]; + int nrect, buflen, refresh; + + + if (DBG_TRACE) + fprintf (stderr, "GtSetMapping - ENTER\n"); + + /* Check mapping number in range. */ + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (ERR); + else + mp = &w->gterm.mappings[mapping]; + + invalidate_draw_context (w); + initialize_mapping (&pix_mp); + initialize_mapping (&new_mp); + + /* Get local pixel space copy of old mapping, store new mapping. */ + get_pixel_mapping (w, mp, &pix_mp, 1); + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = snx; mp->sny = sny; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dnx; mp->dny = dny; + mp->rop = (rop & ~(R_RefreshNone|R_RefreshAll)); + mp->updated = 0; + + /* Newly defined mappings are linked at the tail of the mapping list, + * i.e. they stack (display) on top of any other mappings. If the + * mapping is already defined the stacking order is not changed. + */ + if (!(defined = mp->defined)) { + mp_linkafter (w, mp, w->gterm.mp_tail); + mp->defined = 1; + } + + if (!valid_mapping (w, mp)) { + mp_unlink (w, mp); + mp->defined = 0; + return (ERR); + } + update_mapping (w, mp); + + /* If we are defining a new mapping just define it and quit, without + * refreshing the window, unless R_RefreshAll is explicitly set in the + * mapping. If the mapping is not enabled merely store the new mapping. + * If the mapping is a null mapping (no pixels) do nothing. If refresh + * is disabled in the rasterop merely store the new mapping. If we are + * editing an existing mapping which is enabled with the default rasterop, + * we continue on to compare the old and new mappings and refresh any + * changed pixels in the destination rect. + */ + if (!defined || src != mp->src || dst != mp->dst) { + mp->enabled = mp->defined = 1; + mp->refresh = 0; + return (OK); + } else if (!mp->enabled) { + return (OK); + } else if (snx == 0 || sny == 0 || dnx == 0 || dny == 0) + return (OK); + + if (rop & R_RefreshNone) + return (OK); + + /* Convert input mappings to pixel coordinates, we deal with only pixel + * coordinates from here on. + */ + get_pixel_mapping (w, mp, &new_mp, 1); + load_mapping (&new_mp, &mapping, &dummy_rop, /* MF011 */ + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + update_mapping (w, n_mp = &new_mp); + update_mapping (w, o_mp = &pix_mp); + + /* + * We are editing an existing mapping. Determine what has changed in + * the mapping and refresh the changed regions. + */ + + /* Get old XY scaling maps. + */ + o_xmap = o_mp->x_srcpix; + o_ymap = o_mp->y_srcpix; + + if ((o_dnx = o_mp->dnx) < 0) { + o_dnx = -o_dnx; + o_xflip = 1; + } + if ((o_dny = o_mp->dny) < 0) { + o_dny = -o_dny; + o_yflip = 1; + } + + /* Get new XY scaling maps. + */ + n_xmap = n_mp->x_srcpix; + n_ymap = n_mp->y_srcpix; + + if (dnx < 0) { + dnx = -dnx; + n_xflip = 1; + } + if (dny < 0) { + dny = -dny; + n_yflip = 1; + } + + /* Refresh the entire region if the refresh flag is set, a flip has + * occurred, or we are doing a complex dezoom mapping. + */ + refresh = (o_mp->refresh || (rop & R_RefreshAll)); + if (n_xflip != o_xflip || n_yflip != o_yflip) + refresh = 1; + if (n_mp->scaling == M_DEZOOM) + refresh = 1; + + /* Has the spatial scale changed? */ + scale_changed = + abs (o_mp->xscale - n_mp->xscale) > 1.0E-4 || + abs (o_mp->yscale - n_mp->yscale) > 1.0E-4; + + /* If any of the above conditions are true refresh the entire mapping, + * otherwise compare the old and new mappings and refresh any subregions + * which have changed. + */ + if (refresh || scale_changed || n_mp->scaling == M_DEZOOM) { + refresh_destination (w, n_mp, dx, dy, dnx, dny); + + } else { + /* Compare the old and new mappings to see what needs to be + * refreshed. For speed reasons we only want to refresh the pixels + * which have been remapped. Any destination pixel in the new mapping + * which does not map to the same source pixel as in the old mapping + * must be refreshed. We examine each X and Y coordinate in the new + * destination rect and see if the source coordinate this maps to is + * the same as in the old mapping. If a given destination pixel [i,j] + * maps to the same pixel [i,j] in the source as it did in the + * previous mapping, we do not need to refresh that pixel. We examine + * the X and Y axis in turn and build up a list of regions which do or + * do not need to be refreshed. + */ + + /* Get a list of ranges {XS,XE,XV} in X. */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + dx, dnx, n_xmap, o_mp->dx, o_dnx, o_xmap); + + /* Get a list of ranges {YS,YE,YV} in Y. */ + ny = get_regions (ys,ye,yv, MAX_REGIONS, + dy, dny, n_ymap, o_mp->dy, o_dny, o_ymap); + + /* The list of ranges in X and Y together define a raster of arbitary + * sized subrectangles filling the destination rect. If the state + * value is nonzero (bit 1 set) in either X or Y, the subrectangle + * must be refreshed. The get_rects routine returns a list of the + * rectangular subregions matching the given condition (bit 1 set in + * either axis). Adjacent rectangles are merged to minimize the + * number of calls to refresh_destination. + */ + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 1,1); + for (i=0; i < nrect; i++) + refresh_destination (w, n_mp, + rl[i].x, rl[i].y, rl[i].width, rl[i].height); + } + + /* Refresh any lower level mappings exposed when the current mapping was + * modified. These will be regions of the old rect not present in the + * new, modified rect for the current mapping. + */ + nx = get_regions (xs,xe,xv, MAX_REGIONS, + o_mp->dx, o_dnx, o_xmap, dx, dnx, n_xmap); + ny = get_regions (ys,ye,yv, MAX_REGIONS, + o_mp->dy, o_dny, o_ymap, dy, dny, n_ymap); + nrect = get_rects (rl, MAX_REGIONS, xs,xe,xv,nx, ys,ye,yv,ny, 2,2); + + for (i=0; i < nrect; i++) { + XRectangle r, in; + Mapping mp; + + /* Clear the uncovered region. */ + GtSetPixels (w, dst, GtPixel, rl[i].x, rl[i].y, rl[i].width, + rl[i].height, GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (mp = w->gterm.mp_head; mp && mp->mapping != mapping; + mp = mp->next) { + + if (mp->enabled && mp->dst == dst) { + r.x = mp->dx; + r.y = mp->dy; + r.width = mp->dnx; + r.height = mp->dny; + + if (rect_intersect (&in, &r, &rl[i])) + refresh_destination (w, mp, + in.x, in.y, in.width, in.height); + } + } + } + + free_mapping (w, n_mp); + free_mapping (w, o_mp); + mp = &w->gterm.mappings[mapping]; + mp->refresh = 0; + + if (DBG_TRACE) + fprintf (stderr, "GtSetMapping - LEAVING\n"); + + return (OK); +} + + +/* GtGetMapping -- Return the external parameters of a mapping. If the + * numberd mapping is undefined -1 is returned; 0 is returned if the + * mapping is defined but not enabled, and 1 is returned if the mapping + * is active. + */ +GtGetMapping (w, mapping, rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny) + GtermWidget w; + int mapping; /* mapping number */ + int *rop; /* rasterop */ + int *src; /* 0=window, >0 = raster number */ + int *st; /* coordinate type for source raster */ + int *sx,*sy,*snx,*sny; /* source raster */ + int *dst; /* 0=window, >0 = raster number */ + int *dt; /* coordinate type for source raster */ + int *dx,*dy,*dnx,*dny; /* destination raster */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (-1); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (-1); + + *rop = mp->rop; + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *snx = mp->snx; *sny = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dnx = mp->dnx; *dny = mp->dny; + + return (mp->enabled != 0); +} + + +/* GtActiveMapping -- Query whether a mapping is active. + */ +GtActiveMapping (w, mapping) + register GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + + if (mapping < 0 || mapping >= w->gterm.maxMappings) + return (0); + else if (!(mp = &w->gterm.mappings[mapping])->defined) + return (0); + + return (mp->enabled != 0); +} + + +/* GtEnableMapping -- Enable a mapping. Enabling a mapping does not + * update the destination unless the refresh flag is set. Enabling a + * mapping activates the mapping so that any changes to the source will + * be mapped to the destination. + */ +GtEnableMapping (w, mapping, refresh) + GtermWidget w; + int mapping; /* mapping number */ + int refresh; /* refresh destination */ +{ + register Mapping mp; + + + if (DBG_TRACE) + fprintf (stderr, "GtEnableMapping: mapping=%d refresh=%d\n", + mapping, refresh); + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (!mp->enabled) { + mp->enabled = True; + if (refresh) + GtRefreshMapping (w, mapping); + } + return (OK); + } + } + return (ERR); +} + + +/* GtSetDisplayRaster -- Set the currently displayed raster. On TrueColor +** visuals the XImage for a frame represents the actual pixel values and +** not the colormapped image. We need this for pixel readback where the +** display pixmap (i.e. w->gterm.pixmap) is the 24-bits colormapped image +** and we have no way to get back to the pixel values. +** +*/ + +GtSetDisplayRaster (gt, raster) + GtermWidget gt; + int raster; /* raster number */ +{ + if (DBG_TRACE) + fprintf (stderr, "GtSetDisplayRaster: raster=%d\n", raster); + + gt->gterm.d_raster = (raster * 2); +} + + +/* GtDisableMapping -- Disable a mapping. Disabling a mapping does not + * affect the mapping definition, hence a disabled mapping may later be + * reenabled. If the ERASE flag is set the destination region is redrawn + * with the mapping disabled. + */ +GtDisableMapping (w, mapping, erase) + GtermWidget w; + int mapping; /* mapping number */ + int erase; /* erase the destination */ +{ + register int i; + register Mapping mp, dmp; + XRectangle r, d, in; + + invalidate_draw_context (w); + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->enabled) { + mp->enabled = False; + + if (erase) { + d.x = mp->dx; + d.y = mp->dy; + d.width = abs(mp->dnx); + d.height = abs(mp->dny); + + /* Clear the uncovered region. */ + GtSetPixels (w, mp->dst, GtPixel, + d.x, d.y, d.width, d.height, + GtGetClientPixel(w,0), 0); + + /* Refresh any lower level mappings the destination rects of + * which intersect the uncovered region. + */ + for (dmp = w->gterm.mp_head; + dmp && dmp->mapping != mapping; dmp = dmp->next) { + + if (dmp->enabled && dmp->dst == mp->dst) { + r.x = dmp->dx; + r.y = dmp->dy; + r.width = dmp->dnx; + r.height = dmp->dny; + + if (rect_intersect (&in, &r, &d)) + refresh_destination (w, dmp, + in.x, in.y, in.width, in.height); + } + } + } + } + return (OK); + } + } + + return (ERR); +} + + +/* GtRefreshMapping -- Refresh the destination region defined by a mapping. + */ +GtRefreshMapping (w, mapping) + GtermWidget w; + int mapping; /* mapping number */ +{ + register Mapping mp; + struct mapping p_mp; + + + if (DBG_TRACE) + fprintf(stderr, "GtRefreshMapping() -- ENTER\n"); + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (mp->defined) { + if (mp->st != GtPixel || mp->dt != GtPixel) { + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 1); + update_mapping (w, mp = &p_mp); + } else + update_mapping (w, mp); + + if (CacheXImage) /* MF004 */ + DestroyCachedXImage(); /* MF004 */ + + refresh_destination (w, mp, + mp->dx, mp->dy, abs(mp->dnx), abs(mp->dny)); + if (mp == &p_mp) + free_mapping (w, mp); + } + } + + if (DBG_TRACE) + fprintf(stderr, "GtRefreshMapping() -- LEAVING\n"); +} + + +/* GtMapVector -- Map a point vector from the coordinate system of one raster + * to another as defined by the given mapping. The mapping may be either in + * the forward direction (dir = GtMap) or the reverse (dir = GtUnmap). The + * point vector is maintained in floating point for this operation to avoid + * loss of precision. The input and output vectors may be the same vector. + */ +GtMapVector (w, mapping, dir, pv1, pv2, npts) + GtermWidget w; + int mapping; + int dir; /* GtMap, GtUnmap */ + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register DPoint *ip = pv1; + register DPoint *op = pv2; + register Mapping mp; + register int n; + + struct mapping p_mp; + double xscale, xoffset; + double yscale, yoffset; + int sx, sy; + + xscale = yscale = 1.0; + xoffset = yoffset = 0.0; + sx = sy = 0; + + if (mapping >= 0 && mapping < w->gterm.maxMappings) { + mp = &w->gterm.mappings[mapping]; + if (valid_mapping (w, mp)) { + /* Determine the transformation coefficients. */ + get_pixel_mapping (w, mp, &p_mp, 0); + mp = &p_mp; + + xscale = (float)mp->dnx / (float)mp->snx; + if (xscale < 0) + xoffset = mp->dx + abs(mp->dnx) - 1; + else + xoffset = mp->dx; + + yscale = (float)mp->dny / (float)mp->sny; + if (yscale < 0) + yoffset = mp->dy + abs(mp->dny) - 1; + else + yoffset = mp->dy; + + sx = mp->sx; + sy = mp->sy; + } + } + + /* Map the vector. */ + if (dir == GtMap) { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - sx) * xscale + xoffset; + op->y = (ip->y - sy) * yscale + yoffset; + } + } else { + for (n=npts; --n >= 0; ip++, op++) { + op->x = (ip->x - xoffset) / xscale + sx; + op->y = (ip->y - yoffset) / yscale + sy; + } + } +} + + +/* GtPixelToNDC -- Transform a vector from pixel to NDC coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtPixelToNDC (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ( ip->x) / rp->width * MAXNDC; + op->y = (rp->height - ip->y) / rp->height * MAXNDC; + } +} + + +/* GtNDCToPixel -- Transform a vector from NDC to pixel coordinates in the + * coordinate system of the given reference raster. The input and output + * vectors may be the same vector. + */ +GtNDCToPixel (w, raster, pv1, pv2, npts) + GtermWidget w; + int raster; + DPoint *pv1; + DPoint *pv2; + int npts; +{ + register Raster rp = &w->gterm.rasters[raster]; + register DPoint *ip = pv1; + register DPoint *op = pv2; + register int n; + + for (n=npts; --n >= 0; ip++, op++) { + op->x = ip->x / MAXNDC * rp->width; + op->y = rp->height - (ip->y / MAXNDC * rp->height); + } +} + + +/* GtDebug -- Print debug info. If the file descriptor is NULL output is + * to the process stdout. The "what" argument may be used to select the + * type of output desired. If what=0 the full output is generated, + * otherwise bits are used to select what output is to be generated. + * + * "what" bitflags: + * + * 001 Widget information + * 002 List rasters + * 004 List mappings + * 010 List colormaps + * 020 List markers + * + * This routine is intended only for use during debugging. + */ +GtDebug (w, fp, what) + GtermWidget w; + FILE *fp; + int what; +{ + /* Default is to write everything to the stdout. */ + what = what ? what : 0777; + fp = fp ? fp : stdout; + + /* Print widget header. */ + if (what & 001) { + fprintf (fp, "Widget 0x%x (%s) %dx%d raster=%d\n", + w, w->core.name, w->core.width, w->core.height, w->gterm.raster); + fprintf (fp, + "--------------------------------------------------------------\n"); + } + + /* Print raster information. */ + if (what & 002) { + register int i; + register Raster rp; + + if (w->gterm.rasters) { + for (i=0; i < w->gterm.maxRasters; i++) { + rp = &w->gterm.rasters[i]; + if (!rp->type) + continue; + fprintf (fp, "raster %4d type=%s delete=%d size=%dx%d\n", + i, rp->type == ImageRaster ? "client" : "server", + rp->delete, rp->width, rp->height); + } + } else + fprintf (fp, "no rasters\n"); + } + + /* Print mapping information. */ + if (what & 004) { + register int i; + register Mapping mp; + char flags[32]; + + if (w->gterm.mappings) { + for (i=0; i < w->gterm.maxMappings; i++) { + mp = &w->gterm.mappings[i]; + if (!mp->defined) + continue; + + flags[0] = mp->enabled ? 'E' : 'D'; + flags[1] = mp->updated ? 'U' : ' '; + flags[2] = mp->refresh ? 'R' : ' '; + flags[3] = '\0'; + + fprintf (fp, "mapping %3d %s %8o", i, flags, mp->rop); + fprintf (fp, " %2d %s %3d %3d %3d %3d", + mp->src, mp->st == GtPixel ? "pix" : "ndc", + mp->sx, mp->sy, mp->snx, mp->sny); + fprintf (fp, " %2d %s %3d %3d %3d %3d\n", + mp->dst, mp->dt == GtPixel ? "pix" : "ndc", + mp->dx, mp->dy, mp->dnx, mp->dny); + } + } else + fprintf (fp, "no mappings\n"); + + fprintf (fp, "mappings from head: "); + for (mp = w->gterm.mp_head; mp; mp = mp->next) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + + fprintf (fp, "mappings from tail: "); + for (mp = w->gterm.mp_tail; mp; mp = mp->prev) + fprintf (fp, " %d", mp->mapping); + fprintf (fp, "\n"); + } + + /* Print colormap information. */ + if (what & 010) { + register struct colormap *cm; + + fprintf (fp, "cmapName=%s ncolors=%d basePixel=%d\n", + w->gterm.cmapName, w->gterm.ncolors, w->gterm.base_pixel); + for (cm = w->gterm.colormaps; cm; cm = cm->next) + fprintf (fp, "colormap %2d ncells=%d\n", cm->map, cm->ncells); + } + + /* Print marker information. */ + if (what & 020) { + register Marker mm; + char value[256]; + + for (mm = w->gterm.gm_head; mm; mm = mm->next) { + GmGetAttribute (mm, GmType, (XtArgVal)value, XtRString); + fprintf (fp, "marker 0x%x: %10s flags=0x%x [%d %d %d %d] %0.5g\n", + mm, value, mm->flags, mm->x, mm->y, mm->width, mm->height, + mm->rotangle); + } + } +} + + diff --git a/vendor/x11iraf/obm/ObmW/GtermMapping.c b/vendor/x11iraf/obm/ObmW/GtermMapping.c new file mode 100644 index 00000000..21e4760d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermMapping.c @@ -0,0 +1,2189 @@ + + + +/* refresh_source -- Refresh a portion of a mapping given the source rect + * to be refreshed. If the given source rect is not within the mapping, + * this is a no-op. + */ +static +refresh_source (w, mp, x1, y1, nx, ny) + GtermWidget w; + register Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of source to be refreshed */ +{ + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + int valid; + + + /* Do nothing if mapping not defined and enabled. + */ + if (!(valid = valid_mapping (w, mp))) { + if (DBG_TRACE) + fprintf (stderr, "refresh_source: valid=%d\n", valid); + return (ERR); + } + if (!mp->enabled) { + if (DBG_TRACE) + fprintf (stderr, "ERROR ref_src: mapping %d not enabled\n", + mp->mapping); + return (OK); + } + + /* Compute the intersection of the modified region of the source raster + ** with the rectangular region of the source raster affected by the given + ** mapping. + */ + sx1 = max (x1, mp->sx); + sy1 = max (y1, mp->sy); + sx2 = min(x1 + nx, mp->sx + mp->snx) - 1; + sy2 = min(y1 + ny, mp->sy + mp->sny) - 1; + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + /* Do nothing if the rectangles do not intersect. + */ + if (snx <= 0 || sny <= 0) + return (OK); + + /* Compute the destination rect affected by the mapped source rect. + */ + dx1 = mp->x_extent[sx1 - mp->sx].lo; + dx2 = mp->x_extent[sx2 - mp->sx].hi; + if (dx1 > dx2) { + dx1 = mp->x_extent[sx2 - mp->sx].lo; + dx2 = mp->x_extent[sx1 - mp->sx].hi; + } + + dy1 = mp->y_extent[sy1 - mp->sy].lo; + dy2 = mp->y_extent[sy2 - mp->sy].hi; + if (dy1 > dy2) { + dy1 = mp->y_extent[sy2 - mp->sy].lo; + dy2 = mp->y_extent[sy1 - mp->sy].hi; + } + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + if (CacheXImage) /* MF004 */ + DestroyCachedXImage(); /* MF004 */ + + if (DBG_TRACE) { + fprintf(stderr, "refresh_source -- refreshing src (%d,%d) (%d,%d)\n", + sx1, sy1, snx, sny); + fprintf(stderr, "refresh_source -- refreshing dest (%d,%d) (%d,%d)\n", + dx1, dy1, dnx, dny); + dbg_printMappings (w); + } + + /* Perform the refresh operation. */ + return (refresh_destination (w, mp, dx1, dy1, dnx, dny)); +} + + +/* refresh_destination -- Refresh (redraw) the pixels in the given destination + * rect. The mapping operand defines how to generate the value of each output + * pixel. This is the routine which does all the real work of a mapping, + * computing the values of the output pixels and writing to the destination + * drawable. Note: the destination rect must be specified in raster pixel + * coordinates (no NDC). + */ +static +refresh_destination (w, mp, x1, y1, nx, ny) + GtermWidget w; + Mapping mp; /* mapping defining refresh operation */ + int x1, y1, nx, ny; /* region of destination to be refreshed */ +{ + Raster sr, dr, pr; + Display *display = w->gterm.display; + int scaling, xflip, yflip, delxin=0, delxout=0; + int ox, oy, rop, clip, mapping, i, j; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int xoff, yoff, p1, p2, q1, q2; + float xscale, yscale; + struct mapping *np, p_mp; + XImage *xin, *xout; + int status = OK; + Pixmap pixmap; /* MF004 */ + + Region clip_region, mask_region; + uchar *old_xin_lp, *old_xout_lp; + uchar *xin_lp, *xout_lp, *op; + int xin_bpl, xout_bpl; + int *xmap, *ymap, valid; + XRectangle r; + XImage *img1 = (XImage *) NULL, + *img2 = (XImage *) NULL, + *img3 = (XImage *) NULL, + *img4 = (XImage *) NULL, + *img5 = (XImage *) NULL; + + + + if (DBG_TRACE) + fprintf(stderr, "refresh_destination ENTER[0x%x]: pos=%d,%d sz=%d,%d\n", + w, x1,y1,nx,ny); + + if (!w || !XtIsRealized ((Widget)w)) + return (OK); + + /* Do nothing if mapping not defined and enabled. */ + if (!(valid = valid_mapping (w, mp))) { + if (DBG_TRACE) + fprintf (stderr, "refresh_destination: valid=%d\n", valid); + return (ERR); + } + if (!mp->enabled) { + if (DBG_TRACE) + fprintf (stderr, "ERROR ref_dst: mapping %d not enabled\n", + mp->mapping); + return (OK); + } + + + if (DBG_CMAPS && DBG_CM_VERB) + dbg_printCmaps (w); + if (DBG_TRACE) + dbg_printRasters (w); + + + /* Offsets into the x_*,y_* mapping lookup tables. */ + xoff = x1 - mp->dx; + yoff = y1 - mp->dy; + + /* Get source and destination rects. */ + dst = mp->dst; + dx = x1; dy = y1; + dnx = nx; dny = ny; + + src = mp->src; + p1 = mp->x_srcpix[xoff]; + q1 = mp->y_srcpix[yoff]; + p2 = mp->x_srcpix[xoff + nx - 1]; + q2 = mp->y_srcpix[yoff + ny - 1]; + sx = min (p1, p2); + sy = min (q1, q2); + snx = abs (p2 - p1) + 1; + sny = abs (q2 - q1) + 1; + + /* Define some local variables. */ + sr = &w->gterm.rasters[src]; + dr = &w->gterm.rasters[dst]; + pr = &w->gterm.rasters[0]; /* display pixmap raster */ + mapping = mp->mapping; + scaling = mp->scaling; + xscale = mp->xscale; + yscale = mp->yscale; + rop = mp->rop; + + if (DBG_TRACE) { + fprintf (stderr, + "refresh_destination: src,dst = %d,%d st,dt = %s[%d],%s[%d]\n", + src, dst, + (sr->type == 1 ? "image" : "pixmap"), sr->depth, + (dr->type == 1 ? "image" : "pixmap"), dr->depth); + fprintf (stderr, + "refresh: gterm.pixmap=0x%x src.pixmap=0x%x dest.pixmap=0x%x\n", + w->gterm.pixmap, sr->r.pixmap, dr->r.pixmap); + fprintf (stderr, + "refresh: gterm.pixmap=0x%x src.ximage=0x%x dest.ximage=0x%x\n", + w->gterm.pixmap, sr->r.ximage, dr->r.ximage); + fprintf (stderr, + "refresh_destination: src=>(%d,%d : %d,%d) dst=>(%d,%d : %d,%d)\n", + sx, sy, snx, sny, dx, dy, dnx, dny); + } + + + /* Basic error checking. + */ + if (!sr->type || !dr->type) { + if (DBG_TRACE) + fprintf (stderr, "ERROR: invalid src or dest type\n"); + return (ERR); + + } else if (snx <= 0 || sny <= 0 || dnx == 0 || dny == 0) { + if (DBG_TRACE) + fprintf (stderr, "ERROR: negative src position or zero size\n"); + return (ERR); + + } else if (src < 0 || src > w->gterm.maxRasters || + dst < 0 || dst > w->gterm.maxRasters) { + if (DBG_TRACE) + fprintf (stderr, "ERROR: invalid src or dest value\n"); + return (ERR); + } + + + /* Do we have a flip in X or Y? */ + xflip = mp->dnx < 0; + yflip = mp->dny < 0; + + /* Any higher numbered mappings which map to the same destination as the + * mapping MP will obscure the current mapping. Construct a clip mask + * defining the region of the destination we can write to. This will be + * the region not obscured by any higher numbered, active mappings. + */ + clip = False; + clip_region = XCreateRegion(); + r.x = dx; + r.y = dy; + r.width = dnx; + r.height = dny; +#ifdef sun + /* As far as I can tell the Sun (probably in the OW X server) has an + * off by one bug affecting clipping in the server. A clip region is + * too small by one pixel at the right and bottom, causing these pixels + * to not be written when refreshing the screen (usually this shows up + * as black lines on the screen when a region is refreshed). So far + * I haven't seen this on any other platform. The problem is imperfectly + * understood and the following workaround may not completely workaround + * the problem. + */ + r.width++; r.height++; +#endif + XUnionRectWithRegion (&r, clip_region, clip_region); + + for (np = mp->next; np; np = np->next) { + struct mapping p_np; + + if (!np->enabled || np->dst != dst) + continue; + get_pixel_mapping (w, np, &p_np, 0); + + r.x = p_np.dx; r.y = p_np.dy; + r.width = abs(p_np.dnx); + r.height = abs(p_np.dny); + + if (XRectInRegion (clip_region, + r.x, r.y, r.width, r.height) != RectangleOut) { + + mask_region = XCreateRegion(); + XUnionRectWithRegion (&r, mask_region, mask_region); + XSubtractRegion (clip_region, mask_region, clip_region); + XDestroyRegion (mask_region); + clip++; + } + } + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: xflip=%d yflip=%d clip=%d scaling=%d\n", + xflip, yflip, clip, scaling); + + if (clip && dr->type == PixmapRaster) + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + + + /* Handle the special case of a pixmap to pixmap (or window) copy in + * the server with no scaling. + */ + if (!scaling && sr->type == PixmapRaster && dr->type == PixmapRaster) { + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: pixmap-to-pixmap copy %d <-> %d\n", + src, dst); + + if (src == 0 && dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: pixmap copy src=dst=0\n"); + + XCopyArea (display, + w->gterm.pixmap, w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + + XCopyArea (display, + GPMtoRPM(w, dr), dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + + /* Update the root display shadow pixmap. + */ + XCopyArea (display, + pr->shadow_pixmap, pr->shadow_pixmap, + w->gterm.expose8GC, sx, sy, snx, sny, dx, dy); + + } else { + Raster rp = &w->gterm.rasters[src-1]; + + if (DBG_TRACE) { + fprintf (stderr, + "refresh_destination: pixmap copy src || dst != 0\n"); + fprintf (stderr, "src=%d dest=%d shadow=0x%x ximage=0x%x\n", + src, dst, dr->shadow_pixmap, rp->r.ximage); + dbg_printRasters (w); + fprintf (stderr, + "src=%d,%d %d %d dest=%d,%d %d %d (src=%d dst=%d)\n", + sx, sy, snx, sny, dx, dy, dnx, dny, src, dst); + } + + XCopyArea (display, + RPMtoRPM(sr, dr), dr->r.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + + + /* Update the shadow pixmap. + */ + XCopyArea (display, + sr->shadow_pixmap, dr->shadow_pixmap, + w->gterm.expose8GC, sx, sy, snx, sny, dx, dy); + + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) + XCopyArea (display, + RPMtoGPM (sr, w), w->gterm.pixmap, + w->gterm.exposeGC, sx, sy, snx, sny, dx, dy); + } + + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: spec_case: pixmap copy no scaling\n"); + + goto done; + } + + /* Any other case requires working on ximages in the client. The first + * step is to get the source ximage. + */ + if (sr->type == PixmapRaster) { + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: source type is PixmapRaster[%d]\n", src); + + /* Source is a pixmap but we need a local copy as either the + * destination is not a pixmap, or we need to do some scaling. + */ + if (CacheXImage) { /* MF004 */ + pixmap = (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap; + + if (DBG_TRACE) { + fprintf (stderr, "refresh_destination: xin is cached XImage "); + fprintf (stderr, " src=%d pix=0x%x dims=%d,%d\n", + src, w->gterm.pixmap, sr->width, sr->height); + } + + xin = GetCachedXImage (w, pixmap, sr->width, sr->height); + if (xin == NULL) { + xin = XGetImage (display, pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + if (xin == NULL) { + status = ERR; + goto done; + } else + NewCachedXImage (w, xin, pixmap, sr->width, sr->height); + } + + } else { /* MF004 */ + + /* + */ + if (w->gterm.w_depth > ColormapDepth) { + if (DBG_TRACE) { + fprintf (stderr, + "src=%d dst=%d d_ras=%d %d x %d pr=0x%x sr=0x%x\n", + src, dst, w->gterm.d_raster, sr->width, sr->height, + pr->shadow_pixmap, sr->shadow_pixmap); + dbg_printRasters (w); + } + + xin = XGetImage (display, sr->shadow_pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + + } else { + xin = XGetImage (display, + (src || !w->gterm.pixmap) ? sr->r.pixmap : w->gterm.pixmap, + 0, 0, sr->width, sr->height, 0xff, ZPixmap); + } + + if (DBG_TRACE) { + fprintf (stderr, "refresh_destination: xin is drawable '%s'\n", + (src || !w->gterm.pixmap) ? "sr raster" : "gterm pixmap"); + fprintf (stderr, + "refresh_destination: xin size=%d,%d bpp=%d bpl=%d\n", + xin->width, xin->height, xin->bits_per_pixel, + xin->bytes_per_line); + } + + if (xin == NULL) { + status = ERR; + goto done; + } + delxin++; + } /* MF004 */ + + } else { + /* Source is an ximage. */ + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: src type is XImage (sr->r.ximage)\n"); + + xin = sr->r.ximage; + } + + /* Handle the special case of a copy of an ximage to an output pixmap + * with no scaling. + */ + if (!scaling && dr->type == PixmapRaster) { + + if (DBG_TRACE) + fprintf (stderr, "refresh_destination: NO scaling, dest=Pixmap\n"); + + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + + if (DBG_TRACE) + fprintf (stderr, "refresh_destination: dest == 0\n"); + + XPutImage (display, + w->gterm.pixmap, w->gterm.exposeGC, + (img1=IMGtoGPM(w,xin,sx,sy,dnx,dny)), + sx, sy, dx, dy, dnx, dny); + + + if (DBG_TRACE) + fprintf (stderr, + "\n\nrefresh: gterm.pixmap=0x%x dest.pixmap=0x%x\n\n", + w->gterm.pixmap, dr->r.pixmap); + + XCopyArea (display, + GPMtoRPM (w, dr), dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + + if (w->gterm.w_depth > ColormapDepth) { + XPutImage (display, pr->shadow_pixmap, w->gterm.expose8GC, xin, + sx, sy, dx, dy, dnx, dny); + } + + } else { + + if (DBG_TRACE) { + fprintf (stderr, "refresh_destination: xin dst > 0\n"); + fprintf (stderr, + "refresh_destination: src=(%d,%d) => %d,%d : %d,%d\n", + sx, sy, dx, dy, dnx, dny); + fprintf (stderr, + "refresh_destination: dr->shadow_pixmap = 0x%x\n", + dr->shadow_pixmap); + fprintf (stderr, "refresh_destination: xin => %d x %d x %d\n", + xin->width, xin->height, xin->depth); + } + + /* Copy the 'xin' to the 'dr->r.pixmap' + */ + XPutImage (display, + dr->r.pixmap, w->gterm.exposeGC, + (img2=IMGtoRPM(w,xin,dr,sx,sy,dnx,dny)), + sx, sy, dx, dy, dnx, dny); + + + if (w->gterm.w_depth > ColormapDepth) { + XPutImage (display, dr->r.pixmap, w->gterm.exposeGC, + (img3=IMGtoRPM(w,xin,dr,sx,sy,dnx,dny)), + sx, sy, dx, dy, dnx, dny); + + /* Shadow the pixmap with an 8-bit version for readback. + */ + if (DBG_TRACE) + fprintf (stderr, + "updating shadow_pixmap........................0x%x\n", + dr->shadow_pixmap); + XPutImage (display, dr->shadow_pixmap, + w->gterm.expose8GC, xin, + sx, sy, dx, dy, dnx, dny); + } + } + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: NO scaling, dest=Pixmap -- DONE\n"); + + goto done; + } + + /* Get output ximage. + */ + if (dr->type == ImageRaster) { + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: dest type is XImage (dr->r.ximage)\n"); + + xout = dr->r.ximage; + ox = dx; + oy = dy; + + } else { + + uchar *data = (uchar *) XtCalloc (dnx * dny, sizeof(uchar)); + + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: dest type is Pixmap, create XImage\n"); + + if (data == NULL) { + status = ERR; + goto done; + } + + if (DBG_TRACE) + fprintf (stderr, + "refresh_destination: creating 8-bit ximage....%d x %d\n", + dnx, dny); + + xout = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, dnx, dny, 8, 0); + + if (xout == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + ox = 0; + oy = 0; + delxout++; + } + + xin_lp = (uchar *)xin->data; + xout_lp = (uchar *)xout->data; + xin_bpl = xin->bytes_per_line; + xout_bpl = xout->bytes_per_line; + + /* Map a region of the input ximage XIN to the output ximage XOUT. Various + * approaches are used to generate the output data, depending upon what + * type of scaling we are doing. + */ + if (DBG_TRACE) + fprintf (stderr, "refresh: scaling=%d xin=0x%x xout=0x%x\n", + scaling, xin, xout); + + if (!scaling) { + /* No scaling. Copy a region of the ximage xin to xout without + * spatially scaling the image data. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + xin_lp = (uchar *)xin->data + sy * xin_bpl + sx; + xout_lp = (uchar *)xout->data + oy * xout_bpl + ox; + + for (j=0; j < dny; j++) { + memmove (xout_lp, xin_lp, dnx); + xin_lp += xin_bpl; + xout_lp += xout_bpl; + } + + } else if (scaling == M_INTZOOM) { + /* Integer zoom. The zoom factor is an integer, allowing the zoomed + * image to be calculated without using the xmap,ymap lookup tables. + */ + if (clip && dr->type == ImageRaster) + goto zoom; + + scale_intzoom (xin_lp,xin_bpl, xout_lp,xout_bpl, sx,sy, ox,oy,dnx,dny, + xflip,yflip, (int)(xscale + 0.5), (int)(yscale + 0.5)); + + } else if (scaling == M_ZOOM) { + /* We have a zoom, or one-to-many, scaling. Zoom scaling is always + * done with pixel replication. The [xy]_srcpix arrays in the mapping + * descriptor give the source pixel corresponding to each mapped pixel + * in the destination raster. + */ +zoom: + xmap = &mp->x_srcpix[xoff]; + ymap = &mp->y_srcpix[yoff]; + + scale_zoom (xin_lp, xin_bpl, xout_lp, xout_bpl, + xmap, ymap, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL); + + } else if (scaling == M_DEZOOM) { + /* We have a dezoom, or many-to-one, scaling. A block of pixels in + * the input raster are combined to generate the value of each output + * pixel, using one of several antialias algorithms to compute the + * output pixel value. + */ + float *x_src = &mp->x_src[xoff]; + float *y_src = &mp->y_src[yoff]; + int near_unitary = (xscale > 0.5 && yscale > 0.5); + int function; + + /* Get the antialising function to be applied. */ + if (!(function = (mp->rop & R_MFMask))) + function = MF_NEAREST; + + /* If the dezoom factor is small and either MF_BILINEAR or + * MF_NEAREST is enabled, use the indicated method to sample the + * input data. This uses all the data but minimizes smoothing. + */ + if ((function & (MF_BILINEAR|MF_NEAREST)) && near_unitary) + function = (function & MF_BILINEAR) ? MF_BILINEAR : MF_NEAREST; + else if (function != (function & (MF_BILINEAR|MF_NEAREST))) + function &= ~(MF_BILINEAR|MF_NEAREST); + +filter: + /* This can take a while so update the display. */ + XFlush (w->gterm.display); + + /* If the filtering operation involves any arithmetic combinations + * of pixels we must convert pixel numbers to pixel intensity values + * before performing the filtering operation. This is a case where + * we would be better off if frame buffers were maintained using + * pixel intensities rather than hardware pixel numbers. + */ + if (function != MF_NEAREST) { + uchar *data = (uchar *) XtMalloc (xin->width * xin->height); + if (data == NULL) { + status = ERR; + goto done; + } + + mf_getinten (w, + xin_lp, xin->width, xin->height, xin_bpl, sx,sy, + data, xin->width, xin->height, xin_bpl, sx,sy, snx,sny); + + if (!delxin) { + xin = XCreateImage (w->gterm.display, NULL, RasterDepth, + ZPixmap, 0, (char *)data, xin->width, xin->height, 8, 0); + if (xin == NULL) { + XtFree ((char *)data); + status = ERR; + goto done; + } + delxin++; + } else { + XtFree ((char *)xin->data); + xin->data = (char *) data; + } + xin_lp = (uchar *)xin->data; + } + + /* Filter the source rect to the destination. + */ + switch (function) { + case MF_NEAREST: + scale_nearest ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BILINEAR: + scale_bilinear ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src, y_src, ox, oy, dnx, dny, + (clip && dr->type == ImageRaster) ? clip_region : (Region)NULL + ); + break; + case MF_BLKAVG: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 0, clip ? clip_region : (Region)NULL + ); + break; + case MF_BOXCAR: + scale_boxcar ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, 1, clip ? clip_region : (Region)NULL + ); + break; + case MF_LOWPASS: + scale_lowpass ( + xin_lp, xin->width, xin->height, xin_bpl, + xout_lp, xout->width, xout->height, xout_bpl, + x_src,y_src, sx,sy,snx,sny, ox,oy,dnx,dny, + xscale,yscale, clip ? clip_region : (Region)NULL + ); + break; + default: + function = MF_BILINEAR; + goto filter; + } + + /* If the operation was performed in intensity space convert back + * to pixel number. + */ + if (function != MF_NEAREST) + mf_getpixel (w, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, + xout_lp, xout->width, xout->height, xout_bpl, ox,oy, dnx,dny); + + } else { + status = ERR; + goto done; + } + + /* Copy the scaled ximage to the output pixmap, if any. + */ + if (dr->type == PixmapRaster) { + if (DBG_TRACE) + fprintf (stderr, "refresh_destination: COPY TO OUTPUT PIXMAP\n"); + + if (dst == 0 && w->gterm.pixmap && !(rop & R_Transient)) { + + if (DBG_TRACE) { + fprintf (stderr, "refresh_destination: dst=0\n"); + fprintf (stderr, + "refresh_destination: src=(%d,%d) => %d,%d : %d,%d\n", + ox, oy, dx, dy, dnx, dny); + } + + XPutImage (display, + w->gterm.pixmap, w->gterm.exposeGC, + (img4=IMGtoGPM(w,xout,ox,oy,dnx,dny)), + ox, oy, dx, dy, dnx, dny); + + XCopyArea (display, + GPMtoRPM (w, dr), dr->r.pixmap, + w->gterm.exposeGC, dx, dy, dnx, dny, dx, dy); + + if (w->gterm.w_depth > ColormapDepth) { + if (DBG_TRACE) { + fprintf (stderr, + "updating shadow_pixmap........................0x%x\n", + dr->shadow_pixmap); + fprintf (stderr, + "updating %d,%d to %d,%d %d %d\n", + ox, oy, dx, dy, dnx, dny); + } + XPutImage (display, dr->shadow_pixmap, + w->gterm.expose8GC, xout, ox, oy, dx, dy, dnx, dny); + } + + } else { + + if (DBG_TRACE) { + fprintf (stderr, "refresh_destination: xout dst > 0\n"); + fprintf (stderr, + "refresh_destination: src=(%d,%d) => %d,%d : %d,%d\n", + ox, oy, dx, dy, dnx, dny); + } + + XPutImage (display, + dr->r.pixmap, w->gterm.exposeGC, + (img5=IMGtoRPM(w,xout,dr,ox,oy,dnx,dny)), + ox, oy, dx, dy, dnx, dny); + + if (w->gterm.w_depth > ColormapDepth) { + /* + XPutImage (display, pr->r.pixmap, w->gterm.exposeGC, xout, + ox, oy, dx, dy, dnx, dny); + */ + + /* Shadow the pixmap with an 8-bit version for readback. + */ + if (DBG_TRACE) { + fprintf (stderr, + "updating shadow_pixmap........................0x%x\n", + dr->shadow_pixmap); + fprintf (stderr, + "updating %d,%d to %d,%d %d %d\n", + ox, oy, dx, dy, dnx, dny); + } + XPutImage (display, dr->shadow_pixmap, + w->gterm.expose8GC, xout, + ox, oy, dx, dy, dnx, dny); + } + } + } + +done: + /* Clean up. + */ + if (delxin) XDestroyImage (xin); + if (delxout) XDestroyImage (xout); + + if (img1) XDestroyImage (img1); + if (img2) XDestroyImage (img2); + if (img3) XDestroyImage (img3); + if (img4) XDestroyImage (img4); + if (img5) XDestroyImage (img5); + + XDestroyRegion (clip_region); + if (clip && dr->type == PixmapRaster) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + + if (DBG_TRACE) + fprintf (stderr, "refresh_destination: doing mappings status=%d\n", + status); + + /* Execute any mappings defined on the raster just updated. */ + if (status == OK) { + + GtRefreshPixels (w, dst, GtPixel, dx, dy, dnx, dny); + + if (dst == 0) { + Region clip_region = (Region)NULL; + XRectangle r; + + clip_region = XCreateRegion(); + r.x = dx; r.y = dy; + r.width = dnx; r.height = dny; + XUnionRectWithRegion (&r, clip_region, clip_region); + + update_transients (w, clip_region); + XDestroyRegion (clip_region); + } + } + + if (DBG_TRACE) + fprintf(stderr, "refresh_destination: LEAVING status=%d\n", status); + + return (status); +} + + +/* scale_zoom -- Compute the given destination rect from the input image, + * using pixel replication and the given x and y dst->scr pixels maps. + */ +static +scale_zoom (idata,ibpl, odata,obpl, xmap,ymap, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + register int *xmap; /* src coords of each dst pixel */ + int *ymap; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i, j; + register uchar *ip, *op; + uchar *last_ip = NULL; + uchar *last_op = NULL; + + for (j=0; j < dny; j++) { + ip = idata + ymap[j] * ibpl; + op = odata + (j+dy) * obpl + dx; + + if (!clip_region) { + if (ip == last_ip) + memmove (op, last_op, dnx); + else { + for (i=0; i < dnx; i++) { + op[i] = ip[xmap[i]]; + } + } + last_ip = ip; + last_op = op; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = ip[xmap[i]]; + } + } +} + + +/* scale_intzoom -- Compute the given destination rect from the input image, + * using pixel replication and integer scaling. This is functionally + * equivalent to scale_zoom using the lookup tables, but optimized for the + * case of integer scaling. + */ +static +scale_intzoom (idata,ibpl,odata,obpl, sx,sy,dx,dy,dnx,dny, xflip,yflip, nx,ny) + + uchar *idata, *odata; /* input, output data */ + int ibpl, obpl; /* bytes per line */ + int sx, sy; /* start coords of src rect */ + int dx, dy, dnx, dny; /* destination rect */ + int xflip, yflip; /* set if x or y is flipped */ + int nx, ny; /* replication factors */ +{ + register int n; + register int pix; + register uchar *ip, *op; + uchar *otop, *olast, *lp; + int i, j, k; + + olast = odata + (dy + dny) * obpl - dnx + dx; + + if (xflip) { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + + op = odata + (dy + (yflip ? (dny-ny-j) : j)) * obpl + dx + dnx; + otop = lp = op - dnx; + + + /* Why are the case statements below necessary, doesn't the + * default case do the same thing regardless of what nx is? MJF + */ + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; *--op = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + *--op = pix; *--op = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *--op = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op > otop) + *--op = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } else { + for (j=0, k=0; j < dny; j += ny, k++) { + ip = idata + (sy + k) * ibpl + sx; + op = lp = odata + (dy + (yflip ? (dny-ny-j) : j)) * obpl + dx; + otop = op + dnx; + + /* Replicate a block of pixels. */ + switch (nx) { + case 2: + for (n = (dnx/2); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + } + break; + case 3: + for (n = (dnx/3); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 4: + for (n = (dnx/4); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 5: + for (n = (dnx/5); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 6: + for (n = (dnx/6); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; *op++ = pix; + } + break; + case 7: + for (n = (dnx/7); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + case 8: + for (n = (dnx/8); --n >= 0; ) { + pix = *ip++; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + *op++ = pix; *op++ = pix; + } + break; + default: + for (n = (dnx/nx); --n >= 0; ) { + pix = *ip++; + for (i=nx; --i >= 0; ) + *op++ = pix; + } + break; + } + + /* Fill the last partial pixel. */ + pix = *ip++; + while (op < otop) + *op++ = pix; + + /* Replicate in Y. */ + for (n=ny, op=lp; --n > 0; ) { + op += obpl; + if (op <= olast) + memmove (op, lp, dnx); + } + } + } +} + + +/* scale_nearest -- Compute the given destination rect from the input image, + * using the nearest neighbor technique. + */ +static +scale_nearest (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i, j; + register uchar *op; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = y_src[j]; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = x_src[i]; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* scale_bilinear -- Compute the given destination rect from the input image, + * using bilinear interpolation. + */ +static +scale_bilinear (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = x_src[i] - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = y_src[j] - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* scale_lowpass -- Apply a lowpass filter to a region of a 2D data array. + * The region ox,oy,nx,ny of the output data array is calculated by running + * a convolution kernel over the region of the input data array at ix,iy. + * The size of the convolution kernel is adjusted to match the scale factors + * xscale, yscale. + */ +static +scale_lowpass (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + Region clip_region; /* clip Region or null */ +{ + uchar *data; + + if ((data = (uchar *) XtMalloc (inx * iny)) == NULL) + return; + + /* Run a lowpass filter over the input rect. */ + lw_convolve (idata,inx,iny,ibpl, sx,sy, data,inx,iny,ibpl, sx,sy, + snx,sny, xscale,yscale); + + /* Sample the filtered data to generate the output rect. */ + scale_nearest (data,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + dx,dy,dnx,dny, clip_region); + + XtFree ((char *)data); +} + + +/* lw_convolve -- Convolution primitive for scale_lowpass. + */ +static +lw_convolve (idata,inx,iny,ibpl,ix,iy, odata,onx,ony,obpl,ox,oy, + nx, ny, xscale, yscale) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ix, iy; /* size of input array, start pos */ + int onx, ony, ox, oy; /* size of output array, start pos */ + int ibpl, obpl; /* bytes per line */ + int nx, ny; /* size of output region */ + float xscale, yscale; /* determines amount of smoothing */ +{ + register uchar *ip; + register int l, m, x, hx, pixval; + int kx, ky, hy, i, j, y; + uchar *lp[11], *op; + + /* Determine kernel size (min 3x3, max 7x7). */ + if (xscale < 0.1) + hx = 3; + else if (xscale >= 0.5) + hx = 1; + else + hx = ((int)(1.0 / xscale)) / 2; + + if (yscale < 0.1) + hy = 3; + else if (yscale >= 0.5) + hy = 1; + else + hy = ((int)(1.0 / yscale)) / 2; + + kx = hx * 2 + 1; + ky = hy * 2 + 1; + + /* Compute the output data. + */ + for (j=0; j < ny; j++) { + /* Get line pointers. */ + op = odata + (j+oy) * obpl + ox; + for (i=0; i < ky; i++) { + y = iy + j - hy + i; + if (y < 0) + y = 0; + else if (y >= iny) + y = iny - 1; + lp[i] = y * ibpl + idata; + } + + /* Compute a line of output pixels */ + for (i=0; i < nx; i++) { + x = ix + i; + pixval = 0; + + if (x < hx) { + /* Near left edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][max(0,x-hx+l)]; + } else if (x >= inx - hx) { + /* Near right edge. */ + for (m=0; m < ky; m++) + for (l=0; l < kx; l++) + pixval += lp[m][min(inx-1,x-hx+l)]; + } else { + /* In central region. */ + for (m=0; m < ky; m++) { + ip = lp[m] + x - hx; + for (l=0; l < kx; l++) + pixval += ip[l]; + } + } + + op[i] = (float)pixval / (float)(kx * ky) + 0.5; + } + } +} + + +/* scale_boxcar -- Apply a boxcar filter to a region of a 2D data array + * and interpolate the result to the output grid. The region ox,oy,nx,ny of + * the output data array is calculated by block averaging the corresponding + * source rect and then sampling the reduced image using bilinear interpolation + * to compute the output pixel raster. This antialiasing technique aims to + * be as fast as possible but still does a reasonable job of reducing the + * image. + */ +static +scale_boxcar (idata,inx,iny,ibpl, odata,onx,ony,obpl, x_src,y_src, + sx,sy,snx,sny, dx,dy,dnx,dny, xscale,yscale, interp, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int sx, sy, snx, sny; /* source rect */ + int dx, dy, dnx, dny; /* destination rect */ + float xscale, yscale; /* scale factors */ + int interp; /* set if interpolation is desired */ + Region clip_region; /* clip Region or null */ +{ + int xblock, yblock; + int x1, x2, y1, y2, nx, ny; + float xstep, ystep; + int xoff, yoff; + uchar *bp; + + /* Determine blocking factors. If interpolation is disabled we need + * to block one step more than for the linear interpolate case in order + * to ensure that all the data is used. + */ + xblock = max(1, (int) (1.0 / xscale)); + if (!interp && (1.0 / xscale) - xblock > ZOOM_TOL) + xblock++; + yblock = max(1, (int) (1.0 / yscale)); + if (!interp && (1.0 / yscale) - yblock > ZOOM_TOL) + yblock++; + + /* Align the input region for the given blocking factors. */ + x1 = sx / xblock * xblock; x2 = (sx + snx - 1) / xblock * xblock; + y1 = sy / yblock * yblock; y2 = (sy + sny - 1) / yblock * yblock; + nx = (x2 - x1) / xblock + 1; ny = (y2 - y1) / yblock + 1; + + /* Compute the block averaged input rect. */ + if (xblock > 1 || yblock > 1) { + if ((bp = (uchar *) XtMalloc (nx * ny)) == NULL) + return; + bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, bp, xblock, yblock); + idata = bp; + inx = ibpl = nx; + iny = ny; + xoff = x1; yoff = y1; + xstep = 1.0 / xblock; ystep = 1.0 / yblock; + } else { + bp = NULL; + xoff = yoff = 0; + xstep = ystep = 1.0; + } + + /* Interpolate the input rect to the output grid. */ + if (interp && + ((1.0 / xscale) - xblock) > ZOOM_TOL || + ((1.0 / yscale) - yblock) > ZOOM_TOL) { + + /* Use bilinear interpolation to compute the output grid. */ + bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + + } else { + /* Extract pixels from block averaged input data. */ + bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region); + } + + if (bp) + XtFree ((char *)bp); +} + + +/* bx_boxcar -- Block average primitive for scale_boxcar. + */ +static +bx_boxcar (idata,inx,iny,ibpl, x1,y1,x2,y2, obuf, xblock, yblock) + uchar *idata; /* input data array */ + int inx, iny, ibpl; /* array dimensions */ + int x1,y1,x2,y2; /* region to be block averaged */ + uchar *obuf; /* output array */ + int xblock, yblock; /* blocking factors */ +{ + register uchar *ip, *op; + register int count, i, *sp; + int obpl, block, nxblocks, nyblocks, j, k; + uchar *lp, *bp; + int *sb; + + nxblocks = obpl = (x2 - x1) / xblock + 1; + nyblocks = (y2 - y1) / yblock + 1; + count = xblock * yblock; + + if ((sb = (int *) XtMalloc (obpl * sizeof(int))) == NULL) + return; + + /* I don't think the following works for pixel values allocated from the + * default colormap, as the pixel values are not sequentially allocated. + */ + for (block = 0; block < nyblocks; block++) { + lp = idata + ibpl * (block * yblock + y1) + x1; + bp = obuf + block * obpl; + + memset (sb, 0, obpl * sizeof(int)); + for (k=yblock; --k >= 0; lp += ibpl) + for (j=nxblocks, ip=lp, sp=sb; --j >= 0; sp++) + for (i=xblock; --i >= 0; ) + *sp += *ip++; + + for (i=obpl, sp=sb, op=bp; --i >= 0; ) + *op++ = *sp++ / count; + } + + XtFree ((char *)sb); +} + + +/* bx_extract -- Block extract primitive for scale_boxcar. + */ +static +bx_extract (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* full input array */ + int onx, ony, obpl; /* full input array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int dx, dy, dnx, dny; /* destination rect */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + Region clip_region; /* clip Region or null */ +{ + register int m, n, i; + register uchar *op; + int j; + + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + n = (y_src[j] - yoff) * ystep; + + if (!clip_region) { + for (i=0; i < dnx; i++) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) { + m = (x_src[i] - xoff) * xstep; + op[i] = idata[n * ibpl + m]; + } + } + } +} + + +/* bx_interp -- Bilinear interpolation primitive for scale_boxcar. + */ +static +bx_interp (idata,inx,iny,ibpl, odata,onx,ony,obpl, + x_src,y_src, xoff,yoff,xstep,ystep, dx,dy,dnx,dny, clip_region) + + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + float *x_src, *y_src; /* src coords of each dst pixel */ + int xoff, yoff; /* offset of input region */ + float xstep, ystep; /* scale of input region */ + int dx, dy, dnx, dny; /* destination rect */ + Region clip_region; /* clip Region or null */ +{ + register int i; + register uchar *op; + register float *lp, *w1, *w2; + int buflen, line, *px, pixel, j; + float lo_w, hi_w, x, y; + uchar *lo, *hi; + float *buf; + + buflen = (3 * dnx + 2) * sizeof(float) + dnx * sizeof(int); + if ((buf = (float *) XtMalloc (buflen)) == NULL) + return; + + lp = buf + 1; + w1 = lp + dnx + 1; + w2 = w1 + dnx; + px = (int *)(w2 + dnx); + + /* Compute the weight vectors at each point in X. */ + for (i=0; i < dnx; i++) { + x = ((x_src[i] - xoff) * xstep) - 0.5; + px[i] = (int) x; + w1[i] = 1.0 - (x - (int)x); + w2[i] = 1.0 - w1[i]; + } + + /* For each line of the destination rect first interpolate in Y to the + * y_src coordinate of the output line, then interpolate in X to compute + * the final output pixels. + */ + for (j=0; j < dny; j++) { + op = odata + (j+dy) * obpl + dx; + y = ((y_src[j] - yoff) * ystep) - 0.5; + line = (int) y; + lo = idata + line * ibpl; + hi = idata + min (iny - 1, line + 1) * ibpl; + lo_w = 1.0 - (y - line); + hi_w = 1.0 - lo_w; + + /* Interpolate in Y to the line at y_src[j]. */ + for (i=0; i < dnx; i++) { + pixel = px[i]; + lp[i] = (float)lo[pixel] * lo_w + (float)hi[pixel] * hi_w; + } + lp[-1] = lp[0]; + lp[dnx] = lp[dnx-1]; + + /* Interpolate in X to the final output pixels. */ + if (!clip_region) { + for (i=0; i < dnx; i++) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } else { + for (i=0; i < dnx; i++) + if (XPointInRegion (clip_region, i + dx, j + dy)) + op[i] = lp[i] * w1[i] + lp[i+1] * w2[i]; + } + } + + XtFree ((char *)buf); +} + + +/* mf_getinten -- Copy the source rect to the destination rect, converting + * pixel numbers to pixel intensities. + */ +static +mf_getinten (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_out (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* mf_getpixel -- Copy the source rect to the destination rect, converting + * pixel intensities to pixel numbers. + */ +static +mf_getpixel (w, idata,inx,iny,ibpl, sx,sy, odata,onx,ony,obpl, dx,dy, nx,ny) + + GtermWidget w; + uchar *idata, *odata; /* input, output data */ + int inx, iny, ibpl; /* dimensions of input array */ + int onx, ony, obpl; /* dimensions of output array */ + int sx, sy; /* source offset */ + int dx, dy; /* destination offset */ + int nx, ny; /* size of region */ +{ + register Pixel *cmap; + register uchar *ip, *op; + register int n; + int j; + + cmap = get_cmap_in (w); + for (j=0; j < ny; j++) { + ip = idata + ibpl * (sy + j) + sx; + op = odata + obpl * (dy + j) + dx; + for (n = nx; --n >= 0; ) + *op++ = (cmap[*ip++]); + } +} + + +/* get_regions -- For each pixel I in the sequence of DNX pixels starting at DX + * there is an associated value XMAP[I]. Compare this sequence to an alternate + * sequence and return a list of subregions {XS,XE,XV} for which the XMAP + * values are equal (XV=0), not equal (XV=1), or not common to (XV=2) the two + * regions. The number of regions output is returned as the function value. + */ +static +get_regions (xs,xe,xv, max_regions, dx, dnx, xmap, alt_dx, alt_dnx, alt_xmap) + int *xs, *xe, *xv, max_regions; + int dx, dnx, *xmap; + int alt_dx, alt_dnx, *alt_xmap; +{ + register int state, current; + register int nx, i; + int offset, old_i; + + offset = dx - alt_dx; + nx = 0; + + for (i=0; i < dnx; i++) { + if (nx >= max_regions-1) + return (0); + + /* Determine whether or not this pixel is mapped the same in both + * sequences. + */ + old_i = i + offset; + if (alt_dnx <= 0 || old_i < 0 || old_i >= alt_dnx) + state = 2; + else + state = (xmap[i] != alt_xmap[old_i]); + + /* When the state boundary is crossed add a range. */ + if (i == 0) { + xs[nx] = dx; + xv[nx] = current = state; + } + if (state != current) { + xe[nx] = dx + i - 1; + xs[++nx] = dx + i; + xv[nx] = current = state; + } + if (i == dnx-1) + xe[nx++] = dx + i; + } + + return (nx); +} + + +/* get_rects -- Combine two lists of regions, one in X and the other in Y, + * to produce a list of 2D rectangles defining the regions outlined by the + * region lists. Only rects for which the given condition is true in either + * X or Y are selected. Adjacent rects are combined. + */ +static +get_rects (o_rl, max_rects, xs,xe,xv,nx, ys,ye,yv,ny, xcond,ycond) + XRectangle *o_rl; /* receives list of rectangles */ + int max_rects; /* max rectangles out */ + int *xs, *xe, *xv, nx; /* X list of regions */ + int *ys, *ye, *yv, ny; /* Y list of regions */ + int xcond, ycond; /* X,Y condition bitflags */ +{ + register int i, j; + XRectangle rl[MAX_REGIONS]; + int limit = min (max_rects, MAX_REGIONS); + int o_nrects=0, nrects=0; + int i1, i2, j1, j2; + + /* Get initial list of rects matching the given X and Y conditions. + * Rects which are adjacent in X are combined to form one larger rect. + */ + for (j=0; j < ny; j++) { + for (i=0; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) { + /* Collapse rects adjacent in X. */ + for (i1 = i2 = i++; i < nx; i++) { + if ((xv[i] & xcond) || (yv[j] & ycond)) + i2 = i; + else + break; + } + + rl[nrects].x = xs[i1]; + rl[nrects].y = ys[j]; + rl[nrects].width = xe[i2] - xs[i1] + 1; + rl[nrects].height = ye[j] - ys[j] + 1; + + if (++nrects >= limit) + return (nrects); + } + } + } + + /* Now scan the rect list and collapse rects which are adjacent in Y + * into one larger rect. Find all the rects that are at the same X + * and write them to the output list, collapsing rects that are adjacent + * in Y in the process. + */ + for (i=0; i < nx; i++) + for (j=0; j < nrects; ) { + /* Find first rect if any. */ + for (j1=0, j2 = -1; j < nrects; j++) + if (rl[j].x == xs[i]) { + j1 = j2 = j++; + break; + } + + /* Collapse rects adjacent in Y. */ + for ( ; j < nrects; j++) + if (rl[j].x == xs[i]) + if (rl[j].y == rl[j2].y + rl[j2].height && + rl[j].width == rl[j1].width) + j2 = j; + else + break; + + /* Output the rect. */ + if (j2 >= j1) { + o_rl[o_nrects].x = rl[j1].x; + o_rl[o_nrects].y = rl[j1].y; + o_rl[o_nrects].width = rl[j1].width; + o_rl[o_nrects].height = rl[j2].y + rl[j2].height - rl[j1].y; + + if (++o_nrects >= max_rects) + return (o_nrects); + } + } + + return (o_nrects); +} + + +/* rect_intersect -- Compute the intersection of two rects. The area of + * the intersection is returned as the function value, i.e., zero is + * returned if the rects do not intersect. + */ +static +rect_intersect (in, r1, r2) + register XRectangle *in; + register XRectangle *r1, *r2; +{ + int x1, y1, x2, y2; + + x1 = max (r1->x, r2->x); + y1 = max (r1->y, r2->y); + x2 = min ((int)r1->x + (int)r1->width, (int)r2->x + (int)r2->width) - 1; + y2 = min ((int)r1->y + (int)r1->height, (int)r2->y + (int)r2->height) - 1; + + in->x = x1; + in->y = y1; + in->width = max (0, x2 - x1 + 1); + in->height = max (0, y2 - y1 + 1); + + return (in->width * in->height); +} + + +/* save_mapping -- Store a mapping in a mapping descriptor. + */ +static +save_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int mapping, rop; + int src, st, sx,sy,sw,sh; + int dst, dt, dx,dy,dw,dh; +{ + mp->src = src; mp->st = st; + mp->sx = sx; mp->sy = sy; mp->snx = sw; mp->sny = sh; + mp->dst = dst; mp->dt = dt; + mp->dx = dx; mp->dy = dy; mp->dnx = dw; mp->dny = dh; + mp->defined = mp->enabled = mp->refresh = 1; + mp->mapping = mapping; + mp->rop = rop; +} + +/* load_mapping -- Load a mapping from a mapping descriptor. + */ +static +load_mapping (mp, mapping, rop, src, st, sx,sy,sw,sh, dst, dt, dx,dy,dw,dh) + register Mapping mp; + int *mapping, *rop; + int *src, *st, *sx,*sy,*sw,*sh; + int *dst, *dt, *dx,*dy,*dw,*dh; +{ + *src = mp->src; *st = mp->st; + *sx = mp->sx; *sy = mp->sy; *sw = mp->snx; *sh = mp->sny; + *dst = mp->dst; *dt = mp->dt; + *dx = mp->dx; *dy = mp->dy; *dw = mp->dnx; *dh = mp->dny; + *mapping = mp->mapping; + *rop = mp->rop; +} + + +/* get_pixel_mapping -- Copy a mapping, converting to pixel coordinates in + * the process if the mapping is not already in pixel coordinates. + */ +static +get_pixel_mapping (w, mp1, mp2, update) + GtermWidget w; + register Mapping mp1; /* input mapping */ + register Mapping mp2; /* output mapping */ + int update; /* update mapping */ +{ + float maxndc = (float)MAXNDC; + + mp2->mapping = mp1->mapping; + mp2->refresh = mp1->refresh; + mp2->enabled = mp1->enabled; + mp2->rop = mp1->rop; + + if (!(mp2->defined = mp1->defined)) + return; + + mp2->src = mp1->src; + if (mp1->st == GtPixel) { + mp2->st = mp1->st; + mp2->sx = mp1->sx; mp2->sy = mp1->sy; + mp2->snx = mp1->snx; mp2->sny = mp1->sny; + } else { + float width = w->gterm.rasters[mp1->src].width; + float height = w->gterm.rasters[mp1->src].height; + mp2->sx = mp1->sx * width / maxndc; + mp2->sy = (MAXNDC - (mp1->sy + abs(mp1->sny))) * height / maxndc; + mp2->snx = mp1->snx * width / maxndc; + mp2->sny = mp1->sny * height / maxndc; /* NDC flipped in Y */ + mp2->st = GtPixel; + } + + mp2->dst = mp1->dst; + if (mp1->dt == GtPixel) { + mp2->dt = mp1->dt; + mp2->dx = mp1->dx; mp2->dy = mp1->dy; + mp2->dnx = mp1->dnx; mp2->dny = mp1->dny; + } else { + float width = w->gterm.rasters[mp1->dst].width; + float height = w->gterm.rasters[mp1->dst].height; + mp2->dx = mp1->dx * width / maxndc; + mp2->dy = (MAXNDC - (mp1->dy + abs(mp1->dny))) * height / maxndc; + mp2->dnx = mp1->dnx * width / maxndc; + mp2->dny = mp1->dny * -height / maxndc; /* NDC flipped in Y */ + mp2->dt = GtPixel; + } + + /* The lookup tables are already in pixel space, so we can propagate + * these to the new mapping if the old mapping was updated. + */ + if (update && mp1->updated) { + if (mp2->mapdata = (uchar *) XtMalloc (mp1->datalen)) { + + memmove (mp2->mapdata, mp1->mapdata, mp1->datalen); + mp2->datalen = mp1->datalen; + mp2->scaling = mp1->scaling; + mp2->xscale = mp1->xscale; + mp2->yscale = mp1->yscale; + + mp2->x_extent = (mapExtent *) + ((uchar *)mp1->x_extent - mp1->mapdata + mp2->mapdata); + mp2->y_extent = (mapExtent *) + ((uchar *)mp1->y_extent - mp1->mapdata + mp2->mapdata); + mp2->x_srcpix = (int *) + ((uchar *)mp1->x_srcpix - mp1->mapdata + mp2->mapdata); + mp2->y_srcpix = (int *) + ((uchar *)mp1->y_srcpix - mp1->mapdata + mp2->mapdata); + mp2->x_src = (float *) + ((uchar *)mp1->x_src - mp1->mapdata + mp2->mapdata); + mp2->y_src = (float *) + ((uchar *)mp1->y_src - mp1->mapdata + mp2->mapdata); + + mp2->updated = 1; + } + } else + mp2->updated = 0; +} + +/* valid_mapping -- Perform some sanity checks on a mapping to verify that + * it contains something meaningful. + */ +static +valid_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register int x, y; + int snx, sny, dnx, dny; + int s_width, s_height, d_width, d_height; + Raster sr, dr; + + if (!mp || !mp->defined) + return (False); + + if (mp->src < 0 || mp->src >= w->gterm.maxRasters) + return (False); + if (mp->dst < 0 || mp->dst >= w->gterm.maxRasters) + return (False); + + sr = &w->gterm.rasters[mp->src]; + dr = &w->gterm.rasters[mp->dst]; + if (!sr->type || !dr->type) + return (False); + + switch (mp->st) { + case GtPixel: + s_width = sr->width; s_height = sr->height; + break; + case GtNDC: + s_width = MAXNDC + 1; s_height = MAXNDC + 1; + break; + default: + return (False); + } + + switch (mp->dt) { + case GtPixel: + d_width = dr->width; d_height = dr->height; + break; + case GtNDC: + d_width = MAXNDC + 1; d_height = MAXNDC + 1; + break; + default: + return (False); + } + + snx = mp->snx; dnx = abs(mp->dnx); + sny = mp->sny; dny = abs(mp->dny); + if (snx <= 0 || dnx <= 0 || sny <= 0 || dny <= 0) + return (False); + + x = mp->sx; y = mp->sy; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + x = mp->sx + snx - 1; y = mp->sy + sny - 1; + if (x < 0 || x >= s_width || y < 0 || y >= s_height) + return (False); + + x = mp->dx; y = mp->dy; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + x = mp->dx + dnx - 1; y = mp->dy + dny - 1; + if (x < 0 || x >= d_width || y < 0 || y >= d_height) + return (False); + + return (True); +} + + +/* initialize_mapping -- Initialize the contents of a mapping descriptor. + */ +static +initialize_mapping (mp) + register Mapping mp; +{ + memset ((char *)mp, 0, sizeof(struct mapping)); +} + + +/* update_mapping -- Update the portion of a mapping descriptor used at + * runtime to execute the mapping. This information consists of several + * lookup tables and other parameters describing how a destination pixel + * maps back to a source pixel and vice versa. + */ +static +update_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + register uchar *op; + register int i, j, k; + int snx, sny, dnx, dny, sx, sy, dx, dy; + int xmax, ymax, lo, hi, edge1, edge2; + int temp, xflip=0, yflip=0; + struct mapping p_mp; + float pixwidth, *fp; + int *ip; + + if (mp->updated) + return; + + /* The internal lookup tables are in pixel units. */ + initialize_mapping (&p_mp); + get_pixel_mapping (w, mp, &p_mp, 0); + + if ((snx = p_mp.snx) <= 0 || (sny = p_mp.sny) <= 0) + return; + + if ((dnx = p_mp.dnx) < 0) { + dnx = -dnx; + xflip++; + } + if ((dny = p_mp.dny) < 0) { + dny = -dny; + yflip++; + } + + sx = p_mp.sx; + sy = p_mp.sy; + dx = p_mp.dx; + dy = p_mp.dy; + xmax = dnx - 1; + ymax = dny - 1; + + /* Discard the temporary mapping. + free_mapping (w, &p_mp); + */ + + /* Get scale factors. */ + mp->xscale = (float)dnx / (float)snx; + mp->yscale = (float)dny / (float)sny; + + /* Determine type of scaling to be used. */ + if (mp->xscale < 1.0 || mp->yscale < 1.0) { + mp->scaling = M_DEZOOM; + } else if (mp->xscale > 1.0 || mp->yscale > 1.0) { + mp->scaling = M_ZOOM; + if (abs(mp->xscale - (int)(mp->xscale+0.5)) < ZOOM_TOL && + abs(mp->yscale - (int)(mp->yscale+0.5)) < ZOOM_TOL) + mp->scaling = M_INTZOOM; + } else + mp->scaling = (xflip || yflip) ? M_ZOOM : M_NOSCALING; + + /* Get a data buffer for the lookup tables. */ + mp->datalen = + snx * sizeof(mapExtent) + /* xy, extent */ + sny * sizeof(mapExtent) + + dnx * sizeof(int) + /* xy, srcpix */ + dny * sizeof(int) + + dnx * sizeof(float) + /* xy, src */ + dny * sizeof(float); + + if (mp->mapdata) + mp->mapdata = (uchar *) XtRealloc ((char *)mp->mapdata, mp->datalen); + else + mp->mapdata = (uchar *) XtMalloc (mp->datalen); + if (mp->mapdata == NULL) + return; + + /* Set the table pointers. */ + op = mp->mapdata; + mp->x_extent = (mapExtent *) op; op += snx * sizeof(mapExtent); + mp->y_extent = (mapExtent *) op; op += sny * sizeof(mapExtent); + mp->x_srcpix = (int *) op; op += dnx * sizeof(int); + mp->y_srcpix = (int *) op; op += dny * sizeof(int); + mp->x_src = (float *) op; op += dnx * sizeof(float); + mp->y_src = (float *) op; op += dny * sizeof(float); + + /* Compute the backpointers to the source raster for each destination + * pixel center. + */ + for (i=0, ip = mp->x_srcpix, fp = mp->x_src; i < dnx; i++) { + fp[i] = ((xflip ? xmax - i : i) + 0.5) / mp->xscale + sx; + ip[i] = fp[i]; + } + for (i=0, ip = mp->y_srcpix, fp = mp->y_src; i < dny; i++) { + fp[i] = ((yflip ? ymax - i : i) + 0.5) / mp->yscale + sy; + ip[i] = fp[i]; + } + + /* Compute the extent arrays. These define the range of destination + * pixels affected by each source pixel. + */ + lo = dnx - 1 + dx; + hi = dx; + for (i=0; i < snx; i++) { + mp->x_extent[i].lo = lo; + mp->x_extent[i].hi = hi; + } + lo = dny - 1 + dy; + hi = dy; + for (i=0; i < sny; i++) { + mp->y_extent[i].lo = lo; + mp->y_extent[i].hi = hi; + } + + /* Map the left and right or top and bottom edges of each destination + * pixel back into the source rect and update the corresponding extent + * entries to indicate that these source pixels are used to compute the + * destination pixel. + */ + pixwidth = 1.0 - ZOOM_TOL; + + for (i=0; i < dnx; i++) { + edge1 = (xflip ? xmax - i : i) / mp->xscale; + edge2 = (xflip ? xmax - (i-pixwidth) : (i+pixwidth)) / mp->xscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (snx - 1, edge2); + + for (j=edge1, k = dx + i; j <= edge2; j++) { + if (mp->x_extent[j].lo > k) + mp->x_extent[j].lo = k; + if (mp->x_extent[j].hi < k) + mp->x_extent[j].hi = k; + } + } + + for (i=0; i < dny; i++) { + edge1 = (yflip ? ymax - i : i) / mp->yscale; + edge2 = (yflip ? ymax - (i-pixwidth) : (i+pixwidth)) / mp->yscale; + if (edge1 > edge2) { + temp = edge1; edge1 = edge2; edge2 = temp; + } + edge1 = max (0, edge1); + edge2 = min (sny - 1, edge2); + + for (j=edge1, k = dy + i; j <= edge2; j++) { + if (mp->y_extent[j].lo > k) + mp->y_extent[j].lo = k; + if (mp->y_extent[j].hi < k) + mp->y_extent[j].hi = k; + } + } + + mp->updated = 1; +} + + +/* free_mapping -- Free any storage used internally by a mapping descriptor, + * and deactivate the mapping. + */ +static +free_mapping (w, mp) + GtermWidget w; + register Mapping mp; +{ + mp_unlink (w, mp); + mp->defined = mp->enabled = mp->updated = 0; + if (mp->mapdata) { + XtFree ((char *) mp->mapdata); + mp->mapdata = NULL; + mp->datalen = 0; + mp->x_extent = mp->y_extent = NULL; + mp->x_srcpix = mp->y_srcpix = NULL; + mp->x_src = mp->y_src = NULL; + mp->updated = 0; + } +} + +static void +mp_linkafter (w, mp, ref_mp) + register GtermWidget w; + register Mapping mp; + register Mapping ref_mp; +{ + register Mapping map; + + /* Don't use the reference mapping unless it is already linked or + * the list is empty. + */ + if (w->gterm.mp_head) { + for (map = w->gterm.mp_head; map && map != ref_mp; map = map->next) + ; + if (map != ref_mp) + ref_mp = NULL; + } + + mp->prev = ref_mp; + mp->next = ref_mp ? ref_mp->next : NULL; + if (ref_mp && ref_mp->next) + ref_mp->next->prev = mp; + if (ref_mp) + ref_mp->next = mp; + + if (!w->gterm.mp_tail || ref_mp == w->gterm.mp_tail) + w->gterm.mp_tail = mp; + if (!w->gterm.mp_head) + w->gterm.mp_head = mp; +} + + +static void +mp_unlink (w, mp) + register GtermWidget w; + register Mapping mp; +{ + if (mp->prev) + mp->prev->next = mp->next; + if (mp->next) + mp->next->prev = mp->prev; + if (w->gterm.mp_head == mp) + w->gterm.mp_head = mp->next; + if (w->gterm.mp_tail == mp) + w->gterm.mp_tail = mp->prev; + + mp->prev = mp->next = NULL; +} + + + diff --git a/vendor/x11iraf/obm/ObmW/GtermMarker.c b/vendor/x11iraf/obm/ObmW/GtermMarker.c new file mode 100644 index 00000000..0ed4f1ca --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermMarker.c @@ -0,0 +1,4674 @@ + +/* + * Graphics MARKERS. + * -------------------- + * A marker is an active graphics object displayed on top of a drawing to + * mark, annotate, or outline a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. Markers are used to + * interactively define regions with the mouse, to provide a dynamic graphical + * display which doesn't interfere with the underlying graphics frame, or as a + * graphical means of command input, using callbacks to perform some operation + * when the marker is moved or resized by the user. + * + * GtMarkerInit (w) + * GtMarkerFree (w) + * + * gm = GmCreate (w, type, interactive) + * GmRedisplay (w, region|NULL) + * gm = GmCopy (gm) + * GmDestroy (gm) + * GmAddCallback (gm, events, func, client_data) + * GmDeleteCallback (gm, func, client_data) + * gm = GmSelect (gt, x, y, &what) + * + * GmMarkpos (gm) + * GmRedraw (gm, func, erase) + * GmRaise (gm, ref_gm|NULL) + * GmLower (gm, ref_gm|NULL) + * GmNotify (gm, events, event, param, nparams) + * + * GmAddPt (gm, x, y) + * GmDeletePt (gm, x, y) + * GmMovePt (gm, x, y) + * GmMove (gm, x, y) + * GmResize (gm, x, y) + * GmRotate (gm, x, y) + * + * GmSetAttributes (gm, args, nargs, type) + * GmGetAttributes (gm, args, nargs, type) + * GmSetAttribute (gm, attribute, value, type) + * GmGetAttribute (gm, attribute, value, type) + * GmSetVertices (gm, points, first, npts) + * npts = GmGetVertices (gm, points, first, maxpts) + * GmGetBoundingBox (gm, x, y, width, height) + * + * type = GmStrToType (marker_type) + * event = GmStrToEvent (event_type) + * func = GmStrToFunction (drawing_function) + * + * Markers operate in screen coordinates (raster 0). The SelectRaster + * and MapVector routines may be used to convert to and from raster + * coordinates if desired. + * + * raster = GtSelectRaster (gt, dras, dt, dx, dy, rt, &rx, &ry, &mp) + * GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + * + * The Gm procedures above implement the main functionality of markers. User + * interaction is provided at a higher level using action procedures which + * are bound to pointer and keyboard events via translations (or by the GUI + * itself directly calling the above procedures). + */ + +static void gm_text_init(), gm_line_init(), gm_plin_init(), gm_rect_init(); +static void gm_boxx_init(), gm_circ_init(), gm_elip_init(), gm_pgon_init(); +static int gm_putint(), gm_putfloat(), gm_do_callbacks(), gm_constraint(); +static int gm_getint(), gm_getattribute(), gm_gettype(); +static double gm_getfloat(); +static char *gm_getstring(); + +static void gm_markpos(), gm_erase(), gm_redraw(), gm_setCurRect(); +static void gm_linkafter(), gm_unlink(); +static double gm_niceAngle(); +static Pixel gm_getpixel(); +static int gm_select(); +static int gm_getfillstyle(); + +static GmVMethod gm_classinit[] = { + gm_text_init, gm_line_init, gm_plin_init, gm_rect_init, + gm_boxx_init, gm_circ_init, gm_elip_init, gm_pgon_init +}; + +static Region null_region; +static XRectangle null_rect = { 0, 0, 0, 0 }; +#define NullRect(r) (!(r)->width || !(r)->height) + +#define PI_2 1.57079632679489661923 +#define PI_4 0.78539816339744830962 +#define BORDER 5 + +static void M_create(), M_destroy(), M_destroyNull(), M_set(), M_raise(); +static void M_lower(), M_notify(), M_markpos(), M_markposAdd(), M_redraw(); +static void M_addPt(), M_deletePt(), M_movePt(), M_deleteDestroy(); +static void M_move(), M_resize(), M_moveResize(), M_rotate(); +static void M_rotateResize(), M_input(); +static void gm_focusin(), gm_focusout(); + +static XtActionsRec markerActionsList[] = { + { "m_create", M_create }, + { "m_destroy", M_destroy }, + { "m_destroyNull", M_destroyNull }, + { "m_set", M_set }, + { "m_raise", M_raise }, + { "m_lower", M_lower }, + { "m_notify", M_notify }, + { "m_input", M_input }, + { "m_markpos", M_markpos }, + { "m_markposAdd", M_markposAdd }, + { "m_redraw", M_redraw }, + { "m_addPt", M_addPt }, + { "m_deletePt", M_deletePt }, + { "m_movePt", M_movePt }, + { "m_deleteDestroy", M_deleteDestroy }, + { "m_move", M_move }, + { "m_resize", M_resize }, + { "m_moveResize", M_moveResize }, + { "m_rotate", M_rotate }, + { "m_rotateResize", M_rotateResize }, +}; + + +/* GtMarkerInit -- Initialize the marker subsystem. + */ +GtMarkerInit (w) + GtermWidget w; +{ + register Marker gm, prev; + XColor fg_color, bg_color; + Display *display = w->gterm.display; + int type, i; + GC gc; + + for (gm = w->gterm.gm_tail; gm; gm = prev) { + prev = gm->prev; + GmDestroy (gm); + } + + if (!w->gterm.gm_initialized) { + /* Register some additional actions for markers. */ + XtAppAddActions (XtWidgetToApplicationContext((Widget)w), + markerActionsList, XtNumber(markerActionsList)); + + /* Get the gterm widget translations. */ + if ((char *)w->gterm.defTranslations == NULL) { + char *translations = NULL; + XtTranslations tt; + XtResource r; + int ttype, i; + + r.resource_name = XtNtranslations; + r.resource_class = XtCTranslations; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + XtGetApplicationResources ((Widget)w, &translations, &r, 1,NULL,0); + + if (translations) { + if (strncmp (translations, "#augment", 8) == 0) + ttype = T_augment; + else if (strncmp (translations, "#override", 9) == 0) + ttype = T_override; + else + ttype = T_replace; + + if (ttype == T_replace) { + w->gterm.defTranslations = + XtParseTranslationTable (translations); + } else if ((i = w->gterm.nauxTrans) < MAX_AUXTRANS) { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + w->gterm.auxTrans[i] = + XtParseTranslationTable (translations); + w->gterm.auxTType[i] = ttype; + w->gterm.nauxTrans++; + } + + } else { + w->gterm.defTranslations = + XtParseTranslationTable (defaultGtermTranslations); + } + + /* Get the marker translations. */ + if ((char *)w->gterm.gm_defTranslations == NULL) + w->gterm.gm_defTranslations = + XtParseTranslationTable (w->gterm.gm_translations); + } + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + /* Get graphics drawing GC. */ +/* gc = XCreateGC (display, w->gterm.root, 0, NULL); */ + gc = XCreateGC (display, w->gterm.window, 0, NULL); + XSetBackground (display, gc, w->gterm.color0); + XSetForeground (display, gc, w->gterm.color1); + XSetLineAttributes (display, gc, + w->gterm.gm_lineWidth, w->gterm.gm_lineStyle, CapButt, JoinMiter); + w->gterm.gm_drawGC = gc; + + /* Get graphics rubber-band GC. */ +/* gc = XCreateGC (display, w->gterm.root, 0, NULL); */ + gc = XCreateGC (display, w->gterm.window, 0, NULL); + XSetFunction (display, gc, GXxor); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, w->gterm.gm_xorFillColor); + XSetBackground (display, gc, w->gterm.gm_xorFillBgColor); + XSetLineAttributes (display, gc, + 0, LineDoubleDash, CapButt, JoinMiter); + w->gterm.gm_rubberGC = gc; + + fg_color.pixel = w->gterm.gm_cursorFgColor; + bg_color.pixel = w->gterm.gm_cursorBgColor; + XQueryColor (display, w->core.colormap, &fg_color); + XQueryColor (display, w->core.colormap, &bg_color); + + w->gterm.gm_markerCursor = XCreateFontCursor (display, XC_fleur); + XRecolorCursor (display, w->gterm.gm_markerCursor, &fg_color,&bg_color); + w->gterm.gm_edgeCursor = XCreateFontCursor (display, XC_dotbox); + XRecolorCursor (display, w->gterm.gm_edgeCursor, &fg_color,&bg_color); + w->gterm.gm_pointCursor = XCreateFontCursor (display, XC_sizing); + XRecolorCursor (display, w->gterm.gm_pointCursor, &fg_color,&bg_color); + + if (!(type = GmStrToType (w->gterm.gm_defaultMarker))) + type = Gm_Rectangle; + w->gterm.gm_defaultType = type; + + if (!null_region) + null_region = XCreateRegion(); + w->gterm.gm_initialized++; + } + + w->gterm.gm_create = NULL; + w->gterm.gm_active = NULL; + w->gterm.gm_redisplay = False; + w->gterm.preserve_screen = 0; +} + + +/* GtMarkerFree -- Free any marker subsystem resources. + */ +static void +GtMarkerFree (w) + register GtermWidget w; +{ + register Display *display = w->gterm.display; + register Marker gm; + + /* Cancel any load translation table interval timer. */ + if (w->gterm.gm_timer_id) { + XtRemoveTimeOut (w->gterm.gm_timer_id); + w->gterm.gm_timer_id = (XtIntervalId) NULL; + } + + /* Set the default gterm window translations. */ + gm_load_translations (w, NULL); + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) + GmDestroy (gm); + + if (!w->gterm.gm_initialized) + return; + + XFreeGC (display, w->gterm.gm_drawGC); + XFreeGC (display, w->gterm.gm_rubberGC); + + /* This call can fail - see comments elsewhere in this file about + * XFreeCursor. + * + XFreeCursor (display, w->gterm.gm_markerCursor); + XFreeCursor (display, w->gterm.gm_edgeCursor); + XFreeCursor (display, w->gterm.gm_pointCursor); + */ + + w->gterm.gm_initialized = 0; +} + + +/* gm_focusin -- Called when gterm window input is directed to a marker. + */ +static void +gm_focusin (w, gm, what) + register GtermWidget w; + register Marker gm; + GmSelection what; +{ + Cursor cursor; + int erase; + Marker am; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + if (am = w->gterm.gm_active) { + if (am != gm) + gm_focusout (w, 0); + else if (what && what->type == w->gterm.gm_selection.type) { + /* no change */ + return; + } + } + + if (what) { + switch (what->type) { + case Ge_Point: + cursor = w->gterm.gm_pointCursor; + break; + case Ge_Edge: + cursor = w->gterm.gm_edgeCursor; + break; + default: + cursor = w->gterm.gm_markerCursor; + break; + } + } else + cursor = w->gterm.gm_markerCursor; + + erase_crosshair (w); + XDefineCursor (w->gterm.display, w->gterm.window, cursor); + w->gterm.gm_active = gm; + w->gterm.gm_selection = *what; + + if (gm && gm != am) { + gm_request_translations (w, gm); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusIn, NULL, NULL, 0); +} + + +/* gm_focusout -- Called to restore the normal gterm window input when the + * pointer moves off a marker. + */ +static void +gm_focusout (w, enableSetTrans) + register GtermWidget w; + int enableSetTrans; /* replace translations */ +{ + register Display *display = w->gterm.display; + register Marker gm = w->gterm.gm_active; + int erase, i; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Restore the default gterm window translations. */ + if (enableSetTrans) + gm_request_translations (w, NULL); + + XDefineCursor (display, w->gterm.window, w->gterm.cursor); + w->gterm.gm_active = NULL; + + if (gm) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } + + gm_do_callbacks (gm, GmEvFocusOut, NULL, NULL, 0); +} + + +/* gm_refocus -- Simulate a pointer event to recompute the marker pointer + * focus. Called when a software event changes the marker stacking order + * in some way. + */ +static void +gm_refocus (w) + GtermWidget w; +{ + XMotionEvent event; + int nparams = 0; + + event.type = MotionNotify; /* MF009 */ + event.x = w->gterm.last_x; + event.y = w->gterm.last_y; + HandleTrackCursor ((Widget)w, &event, NULL, &nparams); +} + + +/* + * Translation tables. The widget's translation table must not be replaced + * while a translation is executing. This can be a problem as it is often + * events and their translations which lead to the translation table getting + * replaced. To avoid this problem we merely queue a timer event to load + * the desired translation table, allowing any existing translation to + * finish executing before the translation table is swapped out. If multiple + * translation table load requests are issued only the final one has any + * effect. + */ + +/* gm_request_translations -- Queue a request to load the translations for the + * specified marker (or NULL to load the default gterm translations). If this + * is the first request and timers are enabled a timer is posted to load the + * translations when any current event processing is complete. If a request + * is already active then the most recent request supercedes any previous one. + */ +static void +gm_request_translations (w, gm) + register GtermWidget w; + Marker gm; +{ + w->gterm.gm_reqTranslations = gm; + + if (!w->gterm.useTimers) + gm_load_translations (w, NULL); + else if (!w->gterm.gm_timer_id) { + w->gterm.gm_timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext((Widget)w), 0, + gm_load_translations, (XtPointer)w); + } +} + + +/* gm_load_translations -- Swap out the widget's translation table. This is + * a no-op if the requested translation table is already loaded. + */ +static void +gm_load_translations (w, id) + register GtermWidget w; + XtIntervalId id; +{ + register Marker am, gm; + register int i; + + w->gterm.gm_timer_id = (XtIntervalId) NULL; + + am = w->gterm.gm_curTranslations; + gm = w->gterm.gm_reqTranslations; + if (am == gm && w->gterm.gm_initialized) + return; + + if (gm) { + /* Set the translations for the indicated marker. */ + if (!am || am->translations != gm->translations) + XtOverrideTranslations ((Widget)w, gm->translations); + } else { + /* Restore the default gterm window translations. */ + XtVaSetValues ((Widget)w, + XtNtranslations, (XtArgVal)w->gterm.defTranslations, NULL); + for (i=0; i < w->gterm.nauxTrans; i++) { + switch (w->gterm.auxTType[i]) { + case T_augment: + XtAugmentTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + case T_override: + XtOverrideTranslations ((Widget)w, w->gterm.auxTrans[i]); + break; + } + } + } + + w->gterm.gm_curTranslations = w->gterm.gm_reqTranslations; +} + + +/* Public marker functions. + * -------------------------- + */ + +/* GmCreate -- Create a new marker. + */ +Marker +GmCreate (w, type, interactive) + GtermWidget w; + int type; /* marker type */ + int interactive; /* use pointer to set position */ +{ + register Marker gm; + + /* Allocate descriptor. */ + if (type < 1 || type > Gm_NTypes) + return (NULL); + if (!(gm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + /* Initialize descriptor. */ + gm->w = w; + gm->type = type; + gm->flags = interactive ? (Gm_Visible|Gm_Sensitive) : 0; + gm->translations = w->gterm.gm_defTranslations; + gm->old_region = XCreateRegion(); + gm->cur_region = XCreateRegion(); + (gm_classinit[type-1]) (gm, interactive); + + /* Link marker to tail of marker list. */ + gm_linkafter (gm, w->gterm.gm_tail); + + /* If marker is being created interactive, set flag to indicate that the + * next create marker event should finish creating this marker. + */ + if (w->gterm.gm_create) + GmDestroy (w->gterm.gm_create); + w->gterm.gm_create = interactive ? gm : NULL; + + return (gm); +} + + +/* GmDestroy -- Destroy a marker. + */ +GmDestroy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + Region old_region, cur_region; + + /* GmDestroy can be called recursively during a destroy operation as a + * side effect of the destroy callback. Set the Gm_BeingDestroyed flag + * to cause these redundant destroy requests to be ignored. + */ + if (gm->flags & Gm_BeingDestroyed) + return (OK); + gm->flags |= Gm_BeingDestroyed; + + /* Release the focus if active marker. This should be done before + * proceeding to destroy the marker, i.e. before calling the destroy + * callbacks. + */ + if (w->gterm.gm_active == gm) { + gm_focusout (w, 1); + w->gterm.gm_active = NULL; + } + + /* Inform any clients that have registered a callback for this marker + * that we are about to destroy the marker. + */ + gm_do_callbacks (gm, GmEvDestroy, NULL, NULL, 0); + + /* Erase the marker from the screen. */ + GmMarkpos (gm); + gm_erase (gm); + + /* Note marker position. */ + old_region = gm->old_region; + cur_region = gm->cur_region; + + /* Free all storage and unlink the marker. */ + if (gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + if (gm->text) + XtFree ((char *)gm->text); + if (gm->pgon) + XtFree ((char *)gm->pgon); + + gm_unlink (gm); + XtFree ((char *)gm); + + /* Redraw any markers that were obscured by the deleted marker. */ + update_transients (w, old_region); + + XDestroyRegion (old_region); + XDestroyRegion (cur_region); + + /* Recompute the marker focus. */ + gm_refocus (w); + + return (OK); +} + + +/* GmCopy -- Copy a marker. + */ +Marker +GmCopy (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register Marker nm; + + if (!(nm = (Marker) XtCalloc (1, sizeof (struct marker)))) + return (NULL); + + *nm = *gm; + nm->parent = gm; + nm->old_region = NULL; + nm->cur_region = NULL; + nm->points = NULL; + nm->pgon = NULL; + nm->text = NULL; + + /* Copy region descriptors. */ + if ((char *)(nm->old_region = XCreateRegion()) == NULL) + goto fail; + if ((char *)(nm->cur_region = XCreateRegion()) == NULL) + goto fail; + XUnionRegion (nm->old_region, gm->cur_region, nm->cur_region); + + /* Copy any polypoint data. */ + if (gm->pgon) { + nm->pgon = (DPoint *) XtMalloc (gm->npoints * sizeof(DPoint)); + if (nm->pgon == NULL) + goto fail; + memmove (nm->pgon, gm->pgon, gm->npoints * sizeof(DPoint)); + } + + /* Copy region polygon. */ + if (gm->npoints > GM_MAXVERTICES) { + if (!(nm->points = (XPoint *) XtMalloc (gm->npoints * sizeof(XPoint)))) + goto fail; + memmove (nm->points, gm->points, gm->npoints * sizeof(XPoint)); + } + + /* Copy any text data. */ + if (gm->text) { + int nchars = strlen (gm->text); + if (!(nm->text = XtMalloc (nchars + 1))) + goto fail; + memmove (nm->text, gm->text, nchars + 1); + } + + gm_linkafter (nm, w->gterm.gm_tail); + return (nm); + +fail: + if (nm->text) + XtFree (nm->text); + if (nm->pgon) + XtFree ((char *)nm->pgon); + if (nm->points && nm->points != nm->point_data) + XtFree ((char *)nm->points); + if ((char *)nm->cur_region) + XDestroyRegion (nm->cur_region); + if ((char *)nm->old_region) + XDestroyRegion (nm->old_region); + + XtFree ((char *)nm); + return (NULL); +} + + +/* GmAddCallback -- Add a callback to a marker. + */ +GmAddCallback (gm, events, func, client_data) + register Marker gm; + int events; /* events callback is to receive */ + GmIMethod func; /* function to be called */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i; + + /* Find an empty callback slot. */ + for (i=0; i < GM_MAXCALLBACKS; i++) + if (!gm->callback[i].events) + break; + + /* Register the callback. */ + if (i < GM_MAXCALLBACKS) { + cb = &gm->callback[i]; + cb->events = events; + cb->func = func; + cb->client_data = client_data; + gm->ncallbacks = max (gm->ncallbacks, i + 1); + } + + if (events & GmEvConstraint) + gm->constraints++; +} + + +/* GmDeleteCallback -- Delete a previously posted callback given the + * function pointer and client data passed when the callback was registered. + */ +GmDeleteCallback (gm, func, client_data) + register Marker gm; + GmIMethod func; /* callback function */ + XtPointer client_data; /* client data for above */ +{ + register struct markerCallback *cb; + register int i, n; + + for (i=n=0; i < GM_MAXCALLBACKS; i++) { + cb = &gm->callback[i]; + + if (cb->func == func && cb->client_data == client_data) { + if (cb->events & GmEvConstraint) + gm->constraints--; + cb->events = (int)NULL; + cb->func = (GmIMethod)NULL; + cb->client_data = (XtPointer)NULL; + } else if (cb->events) + n = i; + } + + gm->ncallbacks = n + 1; +} + + +/* GmSelect -- Scan the marker list to see if the given pointer coordinates + * are within an active marker. If so, the marker descriptor is returned as + * the function value, and the "what" argument is set to indicate what part + * of the marker was selected. + */ +Marker +GmSelect (w, x, y, what) + GtermWidget w; + int x, y; + GmSelection what; +{ + register int flags = (Gm_Activated|Gm_Visible|Gm_Sensitive); + register XRectangle *r; + register Marker gm; + + for (gm = w->gterm.gm_tail; gm; gm = gm->prev) { + if (!((gm->flags & (flags|Gm_BeingDestroyed)) == flags)) + continue; + r = &gm->cur_rect; + if (x < (int)r->x || x >= (int)(r->x + r->width) || + y < (int)r->y || y >= (int)(r->y + r->height)) + continue; + if (gm->select (gm, x, y, what)) + return (gm); + } + + return (NULL); +} + + +/* GmMarkpos -- Save the current marker position, e.g., prior to modifying + * the marker. This is used to erase the old marker when the modified + * marker is later redrawn. + */ +GmMarkpos (gm) + register Marker gm; +{ + gm->markpos (gm); +} + + +/* GmRedraw -- Redraw a marker using the given drawing function. If the erase + * flag is not set (as when in rubber-band mode) the marker is merely drawn + * to the screen. Otherwise if the old marker position has been saved the + * old marker is first erased, then any markers affected by the erase are + * redrawn, and finally the current marker is redrawn at the new location. + */ +GmRedraw (gm, func, erase) + Marker gm; + int func; + int erase; +{ + register Marker mm; + register XRectangle *o, *n, *r; + int flags = (Gm_Activated|Gm_Visible); + Region clip_region, temp_region, temp; + GtermWidget w = gm->w; + int outside; + + /* Recompute marker polygon if any attributes have changed. */ + gm->update (gm); + + clip_region = XCreateRegion(); + temp_region = XCreateRegion(); + + /* Erase the previously marked region (old position). */ + if (erase) { + XUnionRegion (gm->old_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.exposeGC, clip_region); + gm_erase (gm); + } + + if (!erase && func == GXxor) + gm->redraw (gm, func); + else { + /* Draw the marker and any markers it intersects, clipping to the + * new marker region. + */ + o = &gm->old_rect; + n = &gm->cur_rect; + + XUnionRegion (gm->cur_region, clip_region, temp_region); + temp = clip_region; clip_region = temp_region; temp_region = temp; + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, clip_region); + + for (mm = gm->w->gterm.gm_head; mm; mm = mm->next) { + if (!((mm->flags & flags) == flags)) + continue; + + /* Redraw a marker if it intersects either the old rect or the + * new rect. + */ + if (mm != gm) { + r = &mm->cur_rect; + outside = 0; + if ((int)r->x >= (int)o->x + (int)o->width || + (int)r->x + (int)r->width <= (int)o->x || + (int)r->y >= (int)o->y + (int)o->height || + (int)r->y + (int)r->height <= (int)o->y) + outside++; + if ((int)r->x >= (int)n->x + (int)n->width || + (int)r->x + (int)r->width <= (int)n->x || + (int)r->y >= (int)n->y + (int)n->height || + (int)r->y + (int)r->height <= (int)n->y) + outside++; + if (outside == 2) + continue; + } + mm->redraw (mm, func); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + } + + if (erase) + XSetClipMask (w->gterm.display, w->gterm.exposeGC, None); + XDestroyRegion (clip_region); + XDestroyRegion (temp_region); + + if (func != GXxor && gm->width > 0 && gm->height > 0) { + /* Redraw callback. */ + gm_do_callbacks (gm, GmEvRedraw, NULL, NULL, 0); + + /* Generate moveResize callback, if marker was moved or resized. + */ + if (gm->old_rect.x != gm->cur_rect.x || + gm->old_rect.y != gm->cur_rect.y || + gm->old_rect.width != gm->cur_rect.width || + gm->old_rect.height != gm->cur_rect.height) { + + char x[32], y[32]; + char width[32], height[32]; + char *argv[5]; + int argc; + + /* If the marker was just created (old_rect null) or the marker + * moved and we did a full erase and redraw, any old markpos is + * obsolete so we may as well update the saved position. + */ + if (erase || !gm->old_rect.width || !gm->old_rect.height) + GmMarkpos (gm); + + sprintf (x, "%d", gm->x); + sprintf (y, "%d", gm->y); + sprintf (width, "%d", gm->width); + sprintf (height, "%d", gm->height); + argv[0] = x; + argv[1] = y; + argv[2] = width; + argv[3] = height; + argv[4] = NULL; + argc = 4; + + gm_do_callbacks (gm, GmEvMoveResize, NULL, argv, argc); + } + } +} + + +/* GmRedisplay -- Redisplay the markers in the given region, or redisplay + * the entire window if the region is given as (char *)NULL. + */ +GmRedisplay (w, region) + GtermWidget w; + Region region; +{ + register int flags = (Gm_Activated|Gm_Visible); + register XRectangle *r; + register Marker gm; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Set the clip mask to only draw in the affected region. */ + if (region) + XSetRegion (w->gterm.display, w->gterm.gm_drawGC, region); + + /* Draw all markers that intersect the target region. */ + for (gm = w->gterm.gm_head; gm; gm = gm->next) { + if (!((gm->flags & flags) == flags)) + continue; + + if ((char *)region) { + gm->update (gm); + r = &gm->cur_rect; + if (XRectInRegion (region, + r->x, r->y, r->width, r->height) == RectangleOut) + continue; + } + + gm->redraw (gm, GXcopy); + } + + XSetClipMask (w->gterm.display, w->gterm.gm_drawGC, None); + w->gterm.gm_redisplay = False; +} + + +/* GmRaise -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn above the second. + */ +GmRaise (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already on top? */ + if (gm == w->gterm.gm_tail || ref_gm && ref_gm->next == gm) + return; + + /* Raise it. */ + gm_unlink (gm); + gm_linkafter (gm, ref_gm ? ref_gm : w->gterm.gm_tail); + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmLower -- Change the stacking order of a marker relative to another + * marker, causing the first marker to be drawn below the second. + */ +GmLower (gm, ref_gm) + register Marker gm, ref_gm; +{ + register GtermWidget w = gm->w; + int erase; + + /* Already lowered? */ + if (gm == w->gterm.gm_head || ref_gm && ref_gm->prev == gm) + return; + + /* Lower it. */ + gm_unlink (gm); + if (ref_gm && ref_gm->prev) + gm_linkafter (gm, ref_gm->prev); + else { + gm->next = w->gterm.gm_head; + w->gterm.gm_head = gm; + if (gm->next) + gm->next->prev = gm; + if (!w->gterm.gm_tail) + w->gterm.gm_tail = gm; + } + + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (w); +} + + +/* GmNotify -- Notify any clients that have registered callbacks that the + * given marker events have occurred. + */ +GmNotify (gm, events, event, params, nparams) + register Marker gm; + int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + gm_do_callbacks (gm, events, event, params, nparams); +} + + +/* GmAddPt -- Add a point to a marker. + */ +GmAddPt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->addPt) { + GmRedraw (gm, GXxor, erase=False); + gm->addPt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + gm_refocus (gm->w); + } +} + + +/* GmDeletePt -- Delete a point from a marker. + */ +GmDeletePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->deletePt) { + GmMarkpos (gm); + gm->deletePt (gm, x, y); + GmRedraw (gm, GXcopy, erase=True); + gm_refocus (gm->w); + } +} + + +/* GmMovePt -- Move a point within a marker. + */ +GmMovePt (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->movePt) { + GmRedraw (gm, GXxor, erase=False); + gm->movePt (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmMove -- Move a marker. + */ +GmMove (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->move) { + GmRedraw (gm, GXxor, erase=False); + gm->move (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmResize -- Resize a marker. + */ +GmResize (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->resize) { + GmRedraw (gm, GXxor, erase=False); + gm->resize (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmRotate -- Rotate a marker. + */ +GmRotate (gm, x, y) + register Marker gm; + int x, y; +{ + int erase; + if (gm->rotate) { + GmRedraw (gm, GXxor, erase=False); + gm->rotate (gm, x, y); + GmRedraw (gm, GXxor, erase=False); + } +} + + +/* GmSetAttributes -- Set a list of attributes. Requires that all attribute + * values be specified in the same type. Autoredraw, if enabled, is suspended + * until all attributes have been changed. + */ +GmSetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + int autoredraw, erase; + int status = OK; + + if (autoredraw = (gm->flags & Gm_AutoRedraw)) { + gm->flags &= ~Gm_AutoRedraw; + GmMarkpos (gm); + } + + for (i=0; i < nargs; i++) { + status |= GmSetAttribute (gm, args[i].name, args[i].value, argtype); + if (strcmp (args[i].name, GmAutoRedraw) == 0) + autoredraw = gm_getint (args[i].value, argtype); + } + + if (autoredraw) { + gm->flags |= Gm_AutoRedraw; + GmRedraw (gm, GXcopy, erase=True); + } + + return (status ? ERR : OK); +} + + +/* GmSetAttribute -- Set the value of a marker attribute. + */ +GmSetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int marker_type, atType; + int erase, n, i; + + if (gm->flags & Gm_AutoRedraw) + GmMarkpos (gm); + + switch (atType = gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + marker_type = GmStrToType ((char *)value); + break; + case Gt_Int: + marker_type = gm_getint (value, type); + break; + default: + return (ERR); + } + + marker_type = max(1, min(Gm_NTypes, marker_type)); + (gm_classinit[marker_type-1]) (gm, False); + gm->flags |= Gm_Modified; + break; + + case Ga_Activated: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Activated)) { + gm->flags |= Gm_Activated; + GmRedraw (gm, GXcopy, erase=False); + } + } else { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Activated; + } + return (OK); + + case Ga_Visible: + if (gm_getint (value, type)) { + if (!(gm->flags & Gm_Visible)) { + gm->flags |= Gm_Visible; + GmRedraw (gm, GXcopy, erase=False); + } + } else if (gm->flags & Gm_Visible) { + GmMarkpos (gm); + gm_erase (gm); + gm->flags &= ~Gm_Visible; + } + return (OK); + + case Ga_Sensitive: + if (gm_getint (value, type)) + gm->flags |= Gm_Sensitive; + else + gm->flags &= ~Gm_Sensitive; + return (OK); + + case Ga_AutoRedraw: + if (gm_getint (value, type)) + gm->flags |= Gm_AutoRedraw; + else + gm->flags &= ~Gm_AutoRedraw; + return (OK); + + case Ga_Translations: + switch (gm_gettype (type)) { + case Gt_String: + gm->translations = XtParseTranslationTable ((char *)value); + break; + default: + return (ERR); + } + return (OK); + + case Ga_X: + gm->x = gm_getint (value, type); + break; + case Ga_Y: + gm->y = gm_getint (value, type); + break; + + case Ga_Width: + case Ga_Height: + /* For a text marker a size can be specified either in integer + * pixels or in characters, e.g., "40ch" or "40 chars". + */ + if (gm->type == Gm_Text && type == XtRString) { + XFontStruct *fp = gm->font; + int char_width, char_height; + int l_pix, r_pix; + char *ip; + + for (n=0, ip=(char *)value; *ip && isdigit(*ip); ip++) + n = n * 10 + (*ip - '0'); + + while (isspace (*ip)) + ip++; + if (ip[0] == 'c' && ip[1] == 'h') { + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + + if (atType == Ga_Width) + n = n * char_width + l_pix + r_pix; + else + n = n * char_height + l_pix * 2; + } + } else + n = gm_getint (value, type); + + if (atType == Ga_Width) + gm->width = n; + else + gm->height = n; + break; + + case Ga_Rotangle: /* MF022 */ + gm->rotangle = gm_getfloat (value, type) * (M_PI / (double) 180.0); + break; + + case Ga_HighlightColor: + gm->highlightColor = gm_getpixel (w, value, type); + break; + case Ga_LineColor: + gm->lineColor = gm_getpixel (w, value, type); + break; + case Ga_LineWidth: + gm->lineWidth = gm_getint (value, type); + break; + case Ga_LineStyle: + gm->lineStyle = gm_getint (value, type); + break; + + case Ga_KnotColor: + gm->knotColor = gm_getpixel (w, value, type); + break; + case Ga_KnotSize: + gm->knotSize = gm_getint (value, type); + break; + + case Ga_Fill: + gm->fill = gm_getint (value, type); + break; + case Ga_FillColor: + gm->fillColor = gm_getpixel (w, value, type); + break; + case Ga_FillBgColor: + gm->fillBgColor = gm_getpixel (w, value, type); + break; + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + gm->fillStyle = gm_getfillstyle (w, value, type); + break; + default: + break; + } + break; + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + gm->fillPattern = (Pixmap) (value); + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + gm->textColor = gm_getpixel (w, value, type); + break; + case Ga_TextBgColor: + gm->textBgColor = gm_getpixel (w, value, type); + break; + case Ga_TextBorder: + gm->textBorder = gm_getint (value, type); + break; + case Ga_ImageText: + gm->imageText = gm_getint (value, type); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + i = gm_getint (value, type); + if (i >= 0 && i < NDialogFonts) + gm->font = w->gterm.dialog_fonts[i]; + break; + case Gt_Pointer: + gm->font = (XFontStruct *) (value); + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + case Gt_String: + if (gm->text) + XtFree (gm->text); + if (!(gm->text = XtMalloc (strlen((char *)value) + 1))) + return (ERR); + strcpy (gm->text, (char *)value); + break; + default: + return (ERR); + } + break; + case Ga_RotIndicator: /* MF020 */ + gm->rotIndicator = gm_getint (value, type); + break; + + default: + return (ERR); + } + + gm->flags |= Gm_Modified; + + if (gm->flags & Gm_AutoRedraw) + GmRedraw (gm, GXcopy, erase=True); + + /* Notify client that a marker attribute has changed. */ + { char *argv[2]; + int argc; + + argv[0] = attribute; + argv[1] = NULL; + argc = 1; + + gm_do_callbacks (gm, GmEvModify, NULL, argv, argc); + } + + return (OK); +} + + +/* GmGetAttributes -- Get a list of attributes. Requires that all attribute + * values be specified in the same type. + */ +GmGetAttributes (gm, args, nargs, argtype) + register Marker gm; + ArgList args; + int nargs; + char *argtype; +{ + register int i; + + for (i=0; i < nargs; i++) + GmGetAttribute (gm, args[i].name, args[i].value, argtype); +} + + +/* GmGetAttribute -- Get the value of a marker attribute. + */ +GmGetAttribute (gm, attribute, value, type) + register Marker gm; + char *attribute; + XtArgVal value; + char *type; +{ + GtermWidget w = gm->w; + int i; + + switch (gm_getattribute (attribute)) { + case Ga_Type: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->type) { + case Gm_Text: + strcpy ((char *)value, GmText); + break; + case Gm_Line: + strcpy ((char *)value, GmLine); + break; + case Gm_Polyline: + strcpy ((char *)value, GmPolyline); + break; + case Gm_Rectangle: + strcpy ((char *)value, GmRectangle); + break; + case Gm_Box: + strcpy ((char *)value, GmBox); + break; + case Gm_Circle: + strcpy ((char *)value, GmCircle); + break; + case Gm_Ellipse: + strcpy ((char *)value, GmEllipse); + break; + case Gm_Polygon: + strcpy ((char *)value, GmPolygon); + break; + default: + return (ERR); + } + break; + case Gt_Int: + if (gm_putint (gm->type, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_Activated: + if (gm_putint ((gm->flags & Gm_Activated) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Visible: + if (gm_putint ((gm->flags & Gm_Visible) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_Sensitive: + if (gm_putint ((gm->flags & Gm_Sensitive) != 0, value, type) == ERR) + return (ERR); + break; + case Ga_AutoRedraw: + if (gm_putint ((gm->flags & Gm_AutoRedraw) != 0, value, type) == ERR) + return (ERR); + break; + + case Ga_X: + if (gm_putint (gm->x, value, type) == ERR) + return (ERR); + break; + case Ga_Y: + if (gm_putint (gm->y, value, type) == ERR) + return (ERR); + break; + case Ga_Width: + if (gm_putint (gm->width, value, type) == ERR) + return (ERR); + break; + case Ga_Height: + if (gm_putint (gm->height, value, type) == ERR) + return (ERR); + break; + case Ga_Rotangle: /* MF022 */ + if (gm_putfloat(((double)180.0/M_PI)*(gm->rotangle),value,type) == ERR) + return (ERR); + break; + + case Ga_HighlightColor: + if (gm_putint ((int)gm->highlightColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineColor: + if (gm_putint ((int)gm->lineColor, value, type) == ERR) + return (ERR); + break; + case Ga_LineWidth: + if (gm_putint (gm->lineWidth, value, type) == ERR) + return (ERR); + break; + case Ga_LineStyle: + if (gm_putint (gm->lineStyle, value, type) == ERR) + return (ERR); + break; + case Ga_KnotColor: + if (gm_putint ((int)gm->knotColor, value, type) == ERR) + return (ERR); + break; + case Ga_KnotSize: + if (gm_putint (gm->knotSize, value, type) == ERR) + return (ERR); + break; + + case Ga_Fill: + if (gm_putint (gm->fill, value, type) == ERR) + return (ERR); + break; + case Ga_FillColor: + if (gm_putint ((int)gm->fillColor, value, type) == ERR) + return (ERR); + break; + case Ga_FillBgColor: + if (gm_putint ((int)gm->fillBgColor, value, type) == ERR) + return (ERR); + break; + + case Ga_FillStyle: + switch (gm_gettype (type)) { + case Gt_String: + switch (gm->fillStyle) { + case FillSolid: + strcpy ((char *)value, "FillSolid"); + break; + case FillTiled: + strcpy ((char *)value, "FillTiled"); + break; + case FillStippled: + strcpy ((char *)value, "FillStippled"); + break; + case FillOpaqueStippled: + strcpy ((char *)value, "FillOpaqueStippled"); + break; + default: + strcpy ((char *)value, "FillSolid"); + break; + } + break; + case Gt_Int: + if (gm_putint (gm->fillStyle, value, type) == ERR) + return (ERR); + break; + default: + return (ERR); + } + break; + + case Ga_FillPattern: + switch (gm_gettype (type)) { + case Gt_Pointer: + *(Pixmap *)value = gm->fillPattern; + break; + default: + return (ERR); + } + break; + + case Ga_TextColor: + if (gm_putint ((int)gm->textColor, value, type) == ERR) + return (ERR); + break; + case Ga_TextBorder: + if (gm_putint (gm->textBorder, value, type) == ERR) + return (ERR); + break; + case Ga_ImageText: + if (gm_putint (gm->imageText, value, type) == ERR) + return (ERR); + break; + case Ga_Font: + switch (gm_gettype (type)) { + case Gt_Int: + for (i=0; i < NDialogFonts; i++) + if (gm->font == w->gterm.dialog_fonts[i]) { + if (gm_putint (i, value, type) == ERR) + return (ERR); + break; + } + break; + case Gt_Pointer: + *(XFontStruct **)value = gm->font; + break; + default: + return (ERR); + } + break; + case Ga_Text: + switch (gm_gettype (type)) { + case Gt_Pointer: + *((char **)value) = gm->text; + break; + case Gt_String: + strcpy ((char *)value, gm->text); + break; + default: + return (ERR); + } + break; + case Ga_RotIndicator: /* MF020 */ + if (gm_putint (gm->rotIndicator, value, type) == ERR) + return (ERR); + break; + + + default: + return (ERR); + } + + return (OK); +} + + +/* GmSetVertices -- Set the vertices of a "poly" type object. + */ +GmSetVertices (gm, points, first, npts) + Marker gm; + DPoint *points; /* input array of points */ + int first; /* first point to be set */ + int npts; /* number of points to set */ +{ + register DPoint *ip, *pp; + register XPoint *op; + register int i; + int erase; + + /* The point vector is automatically extended if more space is needed. + * Small vectors are stored directly in the marker descriptor in the + * point_data array. + */ + if (first + npts != gm->npoints) { /* MF013 */ + if (gm->npoints > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) XtRealloc ((char *)gm->points, + first + npts)) == (XPoint *)NULL) + return; + } else if (first + npts > GM_MAXVERTICES) { + if ((gm->points = (XPoint *) + XtMalloc (first + npts)) == (XPoint *)NULL) + return; + } else if (!gm->points) + gm->points = gm->point_data; + + gm->npoints = first + npts; + } + + /* Copy the point data. */ + ip = points; + op = &gm->points[first]; + for (i=0; i < npts; i++) { + op->x = (int) ip->x + 0.5; + op->y = (int) ip->y + 0.5; + ip++, op++; + } + + /* If we're defining the vertices of a 'poly' marker update the + * pgon[] array with the new set of points. Polygons are initialized + * with a unit rectangle and since vertices can't be set as an attribute + * the must be set with a setVertices call so we need to update the + * structure here. + */ + if (gm->type == Gm_Polygon) { /* MF018 */ + + if (gm->pgon) /* MF018 */ + XtFree ((char *)gm->pgon); + gm->pgon = (DPoint *) XtCalloc (first+npts+1, sizeof(DPoint)); + + /* Copy the point data to the polygon array. */ + op = &gm->points[0]; + pp = &gm->pgon[0]; + for (i=0; i< gm->npoints; i++, pp++, op++) { + pp->x = (double)op->x - gm->x; + pp->y = (double)op->y - gm->y; + } + gm->points[first+npts] = gm->points[0]; /* Close the polygon. */ + + gm->npoints = gm->pgon_npts = first + npts + 1; + gm->rotangle = 0.0; /* reset rotation angle */ + gm->flags |= Gm_Modified; /* marker has been modified */ + } + + /* Redraw the marker if autoredraw is enabled. */ + if (gm->flags & Gm_AutoRedraw) { + GmMarkpos (gm); + GmRedraw (gm, GXcopy, erase=True); + } +} + + +/* GmGetVertices -- Get the vertices of a "poly" type object. The actual + * number of points output is returned as the function value. + */ +GmGetVertices (gm, points, first, maxpts) + register Marker gm; + register DPoint *points; /* output array of points */ + int first; /* first point to be returned */ + int maxpts; /* max number of points to return */ +{ + register XPoint *ip; + register DPoint *op; + register int i; + int top, nout; + + if (first >= gm->npoints) + return (0); + top = min (first + maxpts, gm->npoints); + nout = top - first; + + /* In the case of a poly object don't return the closing segment. */ + if (gm->type == Gm_Polygon) /* MF027 */ + --nout; + + if (points) { + ip = &gm->points[first]; + op = points; + for (i=0; i < nout; i++) { + op->x = ip->x; + op->y = ip->y; + ip++, op++; + } + } + + return (nout); +} + + +/* GmGetBoundingBox -- Returns a rect large enough to completely enclose a + * marker, regardless of its type or orientation. + */ +GmGetBoundingBox (gm, x, y, width, height) + register Marker gm; + int *x, *y; + int *width, *height; +{ + register XRectangle *r = &gm->cur_rect; + + *x = r->x; + *y = r->y; + *width = r->width; + *height = r->height; +} + + +/* GmStrToType -- Convert a marker type string to a marker type code. + */ +GmStrToType (marker_type) +register char *marker_type; +{ + register int type; + + if (strcmp (marker_type, GmText) == 0) + type = Gm_Text; + else if (strcmp (marker_type, GmLine) == 0) + type = Gm_Line; + else if (strcmp (marker_type, GmPolyline) == 0) + type = Gm_Polyline; + else if (strcmp (marker_type, GmRectangle) == 0) + type = Gm_Rectangle; + else if (strcmp (marker_type, GmBox) == 0) + type = Gm_Box; + else if (strcmp (marker_type, GmCircle) == 0) + type = Gm_Circle; + else if (strcmp (marker_type, GmEllipse) == 0) + type = Gm_Ellipse; + else if (strcmp (marker_type, GmPolygon) == 0) + type = Gm_Polygon; + else + type = 0; + + return (type); +} + + +/* GmStrToEvent -- Convert a marker event type string to a marker event code. + */ +GmStrToEvent (event_type) +register char *event_type; +{ + register int type; + + if (strcmp (event_type, "notify") == 0) + type = GmEvNotify; + else if (strcmp (event_type, "moveResize") == 0) + type = GmEvMoveResize; + else if (strcmp (event_type, "modify") == 0) + type = GmEvModify; + else if (strcmp (event_type, "redraw") == 0) + type = GmEvRedraw; + else if (strcmp (event_type, "destroy") == 0) + type = GmEvDestroy ; + else if (strcmp (event_type, "input") == 0) + type = GmEvInput; + else if (strcmp (event_type, "focusIn") == 0) + type = GmEvFocusIn; + else if (strcmp (event_type, "focusOut") == 0) + type = GmEvFocusOut; + else if (strcmp (event_type, "constraint") == 0) + type = GmEvConstraint; + else + type = 0; + + return (type); +} + + +/* GmStrToFunction -- Convert a drawing function string to the corresponding + * XLIB function code. + */ +GmStrToFunction (function) +register char *function; +{ + register int code; + + if (strcmp (function, "clear") == 0) + code = GXclear; + else if (strcmp (function, "and") == 0) + code = GXand; + else if (strcmp (function, "andReverse") == 0) + code = GXandReverse; + else if (strcmp (function, "copy") == 0) + code = GXcopy; + else if (strcmp (function, "andInverted") == 0) + code = GXandInverted; + else if (strcmp (function, "noop") == 0) + code = GXnoop; + else if (strcmp (function, "xor") == 0) + code = GXxor; + else if (strcmp (function, "or") == 0) + code = GXor; + else if (strcmp (function, "nor") == 0) + code = GXnor; + else if (strcmp (function, "equiv") == 0) + code = GXequiv; + else if (strcmp (function, "invert") == 0) + code = GXinvert; + else if (strcmp (function, "orReverse") == 0) + code = GXorReverse; + else if (strcmp (function, "copyInverted") == 0) + code = GXcopyInverted; + else if (strcmp (function, "orInverted") == 0) + code = GXorInverted; + else if (strcmp (function, "nand") == 0) + code = GXnand; + else if (strcmp (function, "set") == 0) + code = GXset; + else + code = -1; + + return (code); +} + + +/* Internal procedures for above code. + * ------------------------------------ + */ + +static int +gm_getint (value, type) + XtArgVal value; + char *type; +{ + register int ch; + + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + ch = *((char *)value); + if (ch == 'T' || ch == 't') + return (1); + else if (ch == 'F' || ch == 'f') + return (0); + else + return (atoi((char *)value)); + default: + return (0); + } +} + + +static Pixel +gm_getpixel (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + XrmValue from, to; + Pixel pixel; + char *str; + + switch (gm_gettype (type)) { + case Gt_Int: + /* Pixel value (colormap index). */ + return ((Pixel)value); + + case Gt_String: + /* The pixel is expressed either as a pixel number input as a string, + * or as a color name. The latter case requires a type conversion. + */ + str = (char *)value; + if (isdigit(str[0]) && (int)strlen(str) <= 3) { + int index = atoi (str); + pixel = w->gterm.cmap[index]; + return (pixel); + } + + if (w->gterm.useDefaultCM || !w->gterm.haveColormap) { + /* Allocate color from default colormap. + */ + from.size = strlen ((char *)value) + 1; + from.addr = (char *)value; + to.addr = (caddr_t) &pixel; + to.size = sizeof(pixel); + + if (!XtConvertAndStore ((Widget)w, XtRString, &from, XtRPixel, &to)) + pixel = w->gterm.cmap[1]; + + } else { + /* Allocate closest match from custom colormap. This is crude, + * but for the standard colors this will return an exact match. + */ + int index, min_dist, dist, i; + XColor exact, best, *cp; + + pixel = w->gterm.cmap[1]; + if (XLookupColor (w->gterm.display, + get_colormap(w), str, &exact, &best)) { + min_dist = 9999; + index = 1; + + for (i=0; i < w->gterm.ncolors; i++) { + cp = &w->gterm.color[i]; + dist = abs((int)exact.red - (int)cp->red) + + abs((int)exact.green - (int)cp->green) + + abs((int)exact.blue - (int)cp->blue); + if (dist == 0) { + index = i; + break; + } else if (dist < min_dist) { + index = i; + min_dist = dist; + } + } + + pixel = w->gterm.color[index].pixel; + } + } + return (pixel); + + default: + return (w->gterm.cmap[1]); + } +} + + +static int +gm_getfillstyle (w, value, type) + GtermWidget w; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_String: + if (strcmp ((char *)value, "FillSolid") == 0) + return (FillSolid); + else if (strcmp ((char *)value, "FillTiled") == 0) + return (FillTiled); + else if (strcmp ((char *)value, "FillStippled") == 0) + return (FillStippled); + else if (strcmp ((char *)value, "FillOpaqueStippled") == 0) + return (FillOpaqueStippled); + break; + default: + break; + } + + return (FillSolid); +} + + +static double +gm_getfloat (value, type) + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + return ((int)value); + case Gt_DFloatP: + return (*(double *)value); + case Gt_String: + return (atof((char *)value)); + default: + return (0); + } +} + + +static char * +gm_getstring (value, type) + XtArgVal value; + char *type; +{ + if (strcmp (type, XtRString) == 0) + return ((char *)value); + else + return (""); +} + + +static int +gm_putint (ival, value, type) + int ival; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = ival; + break; + case Gt_DFloatP: + *(double *)value = (double) ival; + break; + case Gt_String: + sprintf ((char *)value, "%d", ival); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_putfloat (fval, value, type) + double fval; + XtArgVal value; + char *type; +{ + switch (gm_gettype (type)) { + case Gt_Bool: + case Gt_Int: + *(int *)value = (int) fval; + break; + case Gt_DFloatP: + *(double *)value = fval; + break; + case Gt_String: + sprintf ((char *)value, "%g", fval); + break; + default: + return (ERR); + } + return (OK); +} + + +static int +gm_gettype (type) + char *type; +{ + if (strcmp (type, XtRBool) == 0) + return (Gt_Int); + else if (strcmp (type, XtRInt) == 0) + return (Gt_Int); + else if (strcmp (type, XtRFloat) == 0) + return (Gt_DFloatP); + else if (strcmp (type, XtRPointer) == 0) + return (Gt_Pointer); + else if (strcmp (type, XtRString) == 0) + return (Gt_String); + else + return (ERR); +} + + +static int +gm_getattribute (attribute) + char *attribute; +{ + if (strcmp (attribute, GmType) == 0) + return (Ga_Type); + else if (strcmp (attribute, GmActivated) == 0) + return (Ga_Activated); + else if (strcmp (attribute, GmVisible) == 0) + return (Ga_Visible); + else if (strcmp (attribute, GmSensitive) == 0) + return (Ga_Sensitive); + else if (strcmp (attribute, GmAutoRedraw) == 0) + return (Ga_AutoRedraw); + else if (strcmp (attribute, GmTranslations) == 0) + return (Ga_Translations); + else if (strcmp (attribute, GmX) == 0) + return (Ga_X); + else if (strcmp (attribute, GmY) == 0) + return (Ga_Y); + else if (strcmp (attribute, GmWidth) == 0) + return (Ga_Width); + else if (strcmp (attribute, GmHeight) == 0) + return (Ga_Height); + else if (strcmp (attribute, GmRotangle) == 0) + return (Ga_Rotangle); + else if (strcmp (attribute, GmHighlightColor) == 0) + return (Ga_HighlightColor); + else if (strcmp (attribute, GmLineColor) == 0) + return (Ga_LineColor); + else if (strcmp (attribute, GmLineWidth) == 0) + return (Ga_LineWidth); + else if (strcmp (attribute, GmLineStyle) == 0) + return (Ga_LineStyle); + else if (strcmp (attribute, GmKnotColor) == 0) + return (Ga_KnotColor); + else if (strcmp (attribute, GmKnotSize) == 0) + return (Ga_KnotSize); + else if (strcmp (attribute, GmFill) == 0) + return (Ga_Fill); + else if (strcmp (attribute, GmFillColor) == 0) + return (Ga_FillColor); + else if (strcmp (attribute, GmFillBgColor) == 0) + return (Ga_FillBgColor); + else if (strcmp (attribute, GmFillPattern) == 0) + return (Ga_FillPattern); + else if (strcmp (attribute, GmFillStyle) == 0) + return (Ga_FillStyle); + else if (strcmp (attribute, GmTextColor) == 0) + return (Ga_TextColor); + else if (strcmp (attribute, GmTextBgColor) == 0) + return (Ga_TextBgColor); + else if (strcmp (attribute, GmTextBorder) == 0) + return (Ga_TextBorder); + else if (strcmp (attribute, GmImageText) == 0) + return (Ga_ImageText); + else if (strcmp (attribute, GmFont) == 0) + return (Ga_Font); + else if (strcmp (attribute, GmText) == 0) + return (Ga_Text); + else if (strcmp (attribute, GmRotIndicator) == 0) /* MF020 */ + return (Ga_RotIndicator); + else + return (ERR); +} + +static void +gm_linkafter (gm, prev) + register Marker gm; + register Marker prev; +{ + register GtermWidget w = gm->w; + + gm->prev = prev; + gm->next = prev ? prev->next : NULL; + if (prev) + prev->next = gm; + + if (!w->gterm.gm_tail || prev == w->gterm.gm_tail) + w->gterm.gm_tail = gm; + if (!w->gterm.gm_head) + w->gterm.gm_head = gm; + + w->gterm.preserve_screen++; +} + + +static void +gm_unlink (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + + if (gm->prev) + gm->prev->next = gm->next; + if (gm->next) + gm->next->prev = gm->prev; + if (w->gterm.gm_head == gm) + w->gterm.gm_head = gm->next; + if (w->gterm.gm_tail == gm) + w->gterm.gm_tail = gm->prev; + + gm->prev = gm->next = NULL; + if (!w->gterm.gm_head) + w->gterm.preserve_screen = 0; +} + + +/* gm_do_callbacks -- Call any client callbacks registered for the given + * event type. + */ +static int +gm_do_callbacks (gm, events, event, params, nparams) + Marker gm; + register int events; + XEvent *event; + String *params; + Cardinal nparams; +{ + register int n; + register struct markerCallback *cb; + struct markerCallback callback[GM_MAXCALLBACKS]; + int ncallbacks, status; + + /* Copy the callbacks list into local memory to ensure that it is not + * changed by executing a callback. + */ + ncallbacks = gm->ncallbacks; + memmove ((char *)callback, (char *)gm->callback, + sizeof (struct markerCallback) * GM_MAXCALLBACKS); + + for (n = ncallbacks, cb = callback; --n >= 0; cb++) + if (cb->events & events) { + status = cb->func (cb->client_data, + gm, events, event, params, nparams); + if (status) + return (status); + } + + return (0); +} + + +/* gm_constraint -- Handle the constraint callback. This is a client + * callback called when a marker position or size attribute is changed + * interactively at runtime. The purpose of the callback is to allow the + * client to apply any constraints, e.g. to keep the marker within a + * certain area or range of sizes, to forbid rotation, and so on. + */ +static int +gm_constraint (gm, new_gm, what) + register Marker gm, new_gm; + register int what; +{ + register char *ip, *op; + char argbuf[2048]; + char *argv[30]; + int argc = 0; + + /* Return immediately if there are no constraint callbacks. */ + if (!gm->constraints) + return; + + /* Prepare an argument list listing the marker attributes being changed + * and their old and new values. Each attribute is passed as three + * arg strings: name old-value new-value. Each argument string is + * allocated a fixed amount of space of SZ_NUMBER characters. + */ + op = argbuf; + if (what & Gb_X) { + strcpy (argv[argc++]=op, "x"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->x); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->x); op += SZ_NUMBER; + } + if (what & Gb_Y) { + strcpy (argv[argc++]=op, "y"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->y); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->y); op += SZ_NUMBER; + } + if (what & Gb_Width) { + strcpy (argv[argc++]=op, "width"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->width); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->width); op += SZ_NUMBER; + } + if (what & Gb_Height) { + strcpy (argv[argc++]=op, "height"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", gm->height); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%d", new_gm->height); op += SZ_NUMBER; + } + if (what & Gb_Rotangle) { /* MF022 */ + double rot = (gm->rotangle * ((double)180.0 / M_PI)); + double new_rot = (new_gm->rotangle * ((double)180.0 / M_PI)); + strcpy (argv[argc++]=op, "rotangle"); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", rot); op += SZ_NUMBER; + sprintf (argv[argc++]=op, "%g", new_rot); op += SZ_NUMBER; + } + + /* Call any constraint callbacks. The argv value strings are modified + * in place. + */ + gm_do_callbacks (gm, GmEvConstraint, NULL, argv, argc); + + /* Copy the possibly edited values back into the new_gm struct. + */ + ip = argbuf + SZ_NUMBER * 2; + if (what & Gb_X) { + new_gm->x = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Y) { + new_gm->y = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Width) { + new_gm->width = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Height) { + new_gm->height = atoi (ip); ip += SZ_NUMBER*3; + } + if (what & Gb_Rotangle) { + new_gm->rotangle = atof (ip); ip += SZ_NUMBER*3; + + /* Convert back to radians.... */ + new_gm->rotangle *= (M_PI / (double)180.0); /* MF022 */ + } +} + + +static void +gm_erase (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + register XRectangle *r = &gm->old_rect; + + if (!w || !XtIsRealized ((Widget)w)) + return; + + /* Any clipping to the marker border is set outside this routine. */ + if ((gm->flags & Gm_Visible) && !NullRect(r)) + XCopyArea (w->gterm.display, w->gterm.pixmap, w->gterm.window, + w->gterm.exposeGC, r->x, r->y, r->width, r->height, r->x, r->y); +} + + +/* Marker actions. + * ------------------------- + */ + + +/* M_create -- Create a marker. + */ +static void +M_create (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int interactive, type; + gmSelection what; + + savepos (w, event); + + /* If the marker has already been created in interactive mode the event + * merely initializes the marker, otherwise we create and initialize a + * new marker. + */ + if (!(gm = w->gterm.gm_create)) { + type = w->gterm.gm_defaultType; + if (*nparams == 1) { + if (!(type = GmStrToType (params[0]))) + type = w->gterm.gm_defaultType; + } + gm = GmCreate (w, type, interactive=True); + } + + gm->x = ev->x; + gm->y = ev->y; + gm->flags |= Gm_Activated; + w->gterm.gm_create = NULL; + + what.type = (gm->type == Gm_Polygon) ? Ge_Marker : Ge_Point; + what.vertex = 0; + gm_focusin (w, gm, &what); +} + + +/* M_destroy -- Destroy a marker. + */ +static void +M_destroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmDestroy (gm); +} + + +/* M_destroyNull -- Destroy a marker if it is null sized. + */ +static void +M_destroyNull (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (gm && gm->width <= 2 && gm->height <= 2) + GmDestroy (gm); +} + + +/* M_set -- Set a marker attribute. + */ +static void +M_set (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0; i < *nparams; i += 2) + GmSetAttribute (gm, + params[i], (XtArgVal)params[i+1], XtRString); /* MF010 */ +} + + +/* M_raise -- Raise a marker to the top of the display list. + */ +static void +M_raise (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmRaise (gm, NULL); +} + + +/* M_lower -- Lower a marker to the bottom of the display list. + */ +static void +M_lower (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmLower (gm, NULL); +} + + +/* M_notify -- Notify any clients that have registered callbacks for the + * specified type of events. + */ +static void +M_notify (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int events, i; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + for (i=0, events=0; i < *nparams; i++) + if (strcmp (params[i], "notify") == 0) + events |= GmEvNotify; + else if (strcmp (params[i], "moveResize") == 0) + events |= GmEvMoveResize; + else if (strcmp (params[i], "modify") == 0) + events |= GmEvModify; + else if (strcmp (params[i], "redraw") == 0) + events |= GmEvRedraw; + else if (strcmp (params[i], "destroy") == 0) + events |= GmEvDestroy; + else if (strcmp (params[i], "input") == 0) + events |= GmEvInput; + else if (strcmp (params[i], "focusIn") == 0) + events |= GmEvFocusIn; + else if (strcmp (params[i], "focusOut") == 0) + events |= GmEvFocusOut; + + GmNotify (gm, events, event, params + 1, *nparams - 1); +} + + +/* M_input -- Notify any clients that have registered a input callback + * that a input event has occurred. + */ +static void +M_input (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XKeyEvent *ev = (XKeyEvent *) event; + register Marker gm; + + savepos (w, event); + + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmNotify (gm, GmEvInput, event, params, *nparams); +} + + +/* M_markpos -- Mark the current position of the marker, e.g., so that it + * can later be erased. + */ +static void +M_markpos (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + GmMarkpos (gm); +} + + +/* M_markposAdd -- Execute either the markpos or add action, depending upon + * the pointer location. If the pointer is over an active marker at a + * location where the add action can be executed this is done, otherwise the + * markpos action is executed. + */ +static void +M_markposAdd (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Get marker and type of active portion of marker. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Always do a markpos whether we Add or not. */ + GmMarkpos (gm); + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_redraw -- Redraw a marker. + */ +static void +M_redraw (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + int erase; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + /* This redraw undoes the final Xor draw. */ + GmRedraw (gm, GXxor, erase=False); + + /* Redraw the full marker. */ + GmRedraw (gm, GXcopy, erase=True); +} + + +/* M_addPt -- Add a point. + */ +static void +M_addPt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Add a point if possible for the given marker and pointer location. */ + if (what->type == Ge_Edge && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmAddPt (gm, ev->x, ev->y); +} + + +/* M_deletePt -- Delete a point. + */ +static void +M_deletePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (what->type == Ge_Point) + GmDeletePt (gm, ev->x, ev->y); +} + + +/* M_movePt -- Move a point. + */ +static void +M_movePt (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + /* Move a point (vertex) if supported by marker type. */ + if (what->type == Ge_Point && + (gm->type == Gm_Polyline || gm->type == Gm_Polygon)) + GmMovePt (gm, ev->x, ev->y); +} + + +/* M_deleteDestroy -- Delete a point or destroy a marker, depending upon the + * pointer position. + */ +static void +M_deleteDestroy (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + switch (what->type) { + case Ge_Point: + GmDeletePt (gm, ev->x, ev->y); + break; + case Ge_Marker: + GmDestroy (gm); + break; + } +} + + +/* M_move -- Move a marker. + */ +static void +M_move (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmMove (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_resize -- Resize a marker. + */ +static void +M_resize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmResize (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_moveResize -- Move a point or marker, or resize a marker, depending + * upon the pointer position. + */ +static void +M_moveResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, what))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Marker: + GmMove (gm, ev->x, ev->y); + break; + case Ge_Point: + if (gm->type == Gm_Polygon || gm->type == Gm_Polyline) + GmMovePt (gm, ev->x, ev->y); + else + goto resize; + break; + case Ge_Edge: +resize: GmResize (gm, ev->x, ev->y); + break; + } + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotate -- Rotate a marker. + */ +static void +M_rotate (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + GmRotate (gm, ev->x, ev->y); + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* M_rotateResize -- Rotate or resize a marker. + */ +static void +M_rotateResize (widget, event, params, nparams) + Widget widget; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register GtermWidget w = (GtermWidget)widget; + register XButtonEvent *ev = (XButtonEvent *) event; + GmSelection what = &w->gterm.gm_selection; + register Marker gm; + + savepos (w, event); + + /* Determine which marker gets this event. */ + if (!(gm = w->gterm.gm_active)) + if (!(gm = GmSelect (w, ev->x, ev->y, NULL))) + return; + + if (ev->time - gm->time > GM_UPDATE) { + switch (what->type) { + case Ge_Point: + GmRotate (gm, ev->x, ev->y); + break; + case Ge_Edge: + if (gm->flags & Gm_Smooth) + GmRotate (gm, ev->x, ev->y); + else + GmResize (gm, ev->x, ev->y); + break; + default: + GmResize (gm, ev->x, ev->y); + break; + } + + XFlush (w->gterm.display); + gm->time = ev->time; + } +} + + +/* + * Marker class code. + * --------------------- + * Each marker class implements a subset of the following procedures. The + * first set of procedures are required. The second set are optional and + * may be set to NULL in the marker descriptor if not implemented by the + * marker class. + * + * gm_xxxx_init (gm, interactive) + * bool = gm_xxxx_select (gm, x, y, &what) + * gm_xxxx_markpos (gm) + * gm_xxxx_redraw (gm, func) + * gm_xxxx_update (gm) + * + * gm_xxxx_addPt (gm, x, y) + * gm_xxxx_deletePt (gm, x, y) + * gm_xxxx_movePt (gm, x, y) + * gm_xxxx_move (gm, x, y) + * gm_xxxx_resize (gm, x, y) + * gm_xxxx_rotate (gm, x, y) + * + * where xxxx is the 4 character marker class name. + */ + +/* Marker class TEXT. + */ +static int gm_text_select(); +static void gm_text_move(), gm_text_resize(); +static void gm_text_markpos(), gm_text_redraw(); +static void gm_text_update(), gm_text_updatePolygon(); + +static void +gm_text_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Text; + if (!(gm->flags & Gm_Activated)) { + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_TextLineColor; + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->textColor = w->gterm.gm_TextColor; + gm->textBgColor = w->gterm.gm_TextBgColor; + gm->textBorder = w->gterm.gm_TextBorder; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->font = w->gterm.gm_TextFont; + gm->imageText = False; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->npoints = 4 + 1; + gm->points = gm->point_data; + + gm->select = gm_text_select; + gm->markpos = gm_text_markpos; + gm->redraw = gm_text_redraw; + gm->update = gm_text_update; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_text_move; + gm->resize = gm_text_resize; + gm->rotate = NULL; + + if (w->gterm.gm_TextString) { + if (gm->text) + XtFree (gm->text); + gm->text = (char *) XtMalloc (strlen(w->gterm.gm_TextString)+1); + strcpy (gm->text, w->gterm.gm_TextString); + } else + gm->text = NULL; +} + +static int +gm_text_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + + +static void +gm_text_markpos (gm) + register Marker gm; +{ + gm_markpos (gm); +} + + +static void +gm_text_redraw (gm, function) + register Marker gm; + int function; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + int char_width, char_height, xsize, ysize; + int breakline, l_pix, r_pix, maxch, x, y; + XFontStruct *fp = gm->font; + char *ip, *op, *otop; + char *l_ip, *l_op; + char line[1024]; + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + /* In rubber-band mode just draw the outline of the text region. */ + if (function == GXxor) { + int save_lineWidth = gm->lineWidth; + + if (gm->lineWidth <= 0) + gm->lineWidth = 1; + gm_redraw (gm, function); + gm->lineWidth = save_lineWidth; + return; + } + + /* General case. First draw the text box. */ + gm_redraw (gm, function); + + /* Now draw the text. */ + if (!gm->text) + return; + + char_width = fp->max_bounds.width; + char_height = fp->max_bounds.ascent + fp->max_bounds.descent; + xsize = gm->width; + ysize = gm->height; + + l_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1; + r_pix = (gm->lineWidth + 1) / 2 + gm->textBorder - 1 - + (fp->max_bounds.width - fp->max_bounds.rbearing); + if ((maxch = (xsize - l_pix - r_pix) / char_width) < 1) + return; + + x = gm->x + (gm->lineWidth + 1) / 2 + gm->textBorder + 1; + y = gm->y + (gm->lineWidth + 1) / 2 + gm->textBorder + + fp->max_bounds.ascent; + + XSetForeground (w->gterm.display, w->gterm.gm_drawGC, gm->textColor); + XSetBackground (w->gterm.display, w->gterm.gm_drawGC, gm->textBgColor); + XSetFont (w->gterm.display, w->gterm.gm_drawGC, fp->fid); + + /* Fill lines in a multiline text box. + */ + l_ip = l_op = NULL; + otop = line + maxch; + breakline = 0; + + for (ip = gm->text, op=line; *ip || op > line; ) { + if (! *ip) { + breakline++; + } else if (*ip == ' ' || *ip == '\t') { + l_ip = ip; + l_op = op; + *op++ = ' '; + ip++; + } else if (*ip == '\n') { + ip++; + breakline++; + } else + *op++ = *ip++; + + if (breakline || op > otop) { + if (op > otop) { + if (l_ip && l_op) { + ip = l_ip + 1; + *l_op = '\0'; + } else { + while (op > otop) { + if (ip > gm->text && isprint (*(ip-1))) + --ip; + --op; + } + *op = '\0'; + } + } else + *op = '\0'; + + if (gm->imageText) { + while (op < otop) + *op++ = ' '; + *op = '\0'; + XDrawImageString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } else { + XDrawString (w->gterm.display, w->gterm.window, + w->gterm.gm_drawGC, x, y, line, strlen(line)); + } + + y += char_height; + if (breakline) + y += gm->textBorder; + if (y + fp->max_bounds.descent > gm->y + ysize) + break; + + op = line; + l_ip = l_op = NULL; + breakline = 0; + } + } +} + + +static void +gm_text_update (gm) + register Marker gm; +{ + register GtermWidget w = gm->w; + int flags = (Gm_Activated|Gm_Visible); + + if (!((gm->flags & flags) == flags)) + return; + if (gm->width <= 0 || gm->height <= 0) + return; + + if (gm->flags & Gm_Modified) { + gm_text_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_text_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = max (0, x - gm->width / 2); + new_gm.y = max (0, y - gm->height / 2); + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); /* corner */ + + gm->x = new_gm.x; + gm->y = new_gm.y; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = abs (x - gm->x); + new_gm.height = abs (y - gm->y); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = new_gm.width; + gm->height = new_gm.height; + gm_text_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_text_updatePolygon (gm) + register Marker gm; +{ + register XPoint *p = gm->points; + int xsize = gm->width; + int ysize = gm->height; + + p[0].x = gm->x; p[0].y = gm->y; + p[1].x = gm->x; p[1].y = gm->y + ysize; + p[2].x = gm->x + xsize; p[2].y = gm->y + ysize; + p[3].x = gm->x + xsize; p[3].y = gm->y; + p[4].x = gm->x; p[4].y = gm->y; +} + + +/* Marker class LINE. + */ +static void +gm_line_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Line; + /* stub out for now */ +} + + +/* Marker class POLYLINE. + */ +static void +gm_plin_init (gm, interactive) + register Marker gm; + int interactive; +{ + gm->type = Gm_Polyline; + /* stub out for now */ +} + + +/* Marker class RECTANGLE. + */ +static int gm_rect_select(); +static void gm_rect_move(), gm_rect_resize(), gm_rect_rotate(); +static void gm_rect_update(), gm_rect_updatePolygon(); + +static void +gm_rect_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Rectangle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_rect_select; + gm->markpos = gm_markpos; + gm->update = gm_rect_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_rect_move; + gm->resize = gm_rect_resize; + gm->rotate = gm_rect_rotate; +} + +static void +gm_rect_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_rect_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_rect_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_resize (gm, x, y) + register Marker gm; + int x, y; +{ +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + struct marker new_gm; + int rx, ry; + int ox = x, oy = y; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + if (rx < 0) + new_gm.x = gm->x - (-rx - gm->width) / 2; + else + new_gm.x = gm->x + (rx - gm->width) / 2; + + if (ry < 0) + new_gm.y = gm->y - (-ry - gm->height) / 2; + else + new_gm.y = gm->y + (ry - gm->height) / 2; + + new_gm.width = gm->width + (abs(rx) - gm->width) / 2; + new_gm.height = gm->height + (abs(ry) - gm->height) / 2; + + gm_constraint (gm, &new_gm, Gb_X|Gb_Y|Gb_Width|Gb_Height); + gm->x = new_gm.x; + gm->y = new_gm.y; + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_rect_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + + /* V1.1 These eqns have the effect of allowing a marker to be grabbed by + * any corner but doing so resets the rotation angle the first time the + * marker is rotated. + + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + */ + + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_rect_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_rect_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle);*/ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class BOX. A box marker is like a rectangle except that it is + * described and resized by the center and radius (width/height), like + * the other "centered" marker types (circle, ellipse, etc.). + */ +static int gm_boxx_select(); +static void gm_boxx_move(), gm_boxx_resize(), gm_boxx_rotate(); +static void gm_boxx_update(), gm_boxx_updatePolygon(); + +static void +gm_boxx_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Box; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_RectLineColor; + gm->knotColor = w->gterm.gm_RectKnotColor; + gm->knotSize = w->gterm.gm_RectKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = 4 + 1; + + gm->select = gm_boxx_select; + gm->markpos = gm_markpos; + gm->update = gm_boxx_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_boxx_move; + gm->resize = gm_boxx_resize; + gm->rotate = gm_boxx_rotate; +} + +static void +gm_boxx_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_boxx_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Edge) + what->type = Ge_Marker; + return (1); + } else + return (0); +} + +static void +gm_boxx_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_resize (gm, x, y) + register Marker gm; + int x, y; +{ +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + struct marker new_gm; + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_boxx_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + double alpha, theta; + struct marker new_gm; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { + /* V1.1 + theta = atan2 ((double)(y - gm->y), (double)(x - gm->x)); + alpha = atan2 ((double)gm->height, (double)gm->width); + new_gm.rotangle = gm_niceAngle (theta + alpha); + */ + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_boxx_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_boxx_updatePolygon (gm) + Marker gm; +{ + register x, y; + register XPoint *p = gm->points; + double cos_rotangle, sin_rotangle; + + double alpha = atan2 ((double)gm->height, (double)gm->width); + +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + x = gm->width; + y = gm->height; + + p[0].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[0].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[1].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[1].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; + p[2].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[2].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; + p[3].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[3].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + p[4] = p[0]; +} + + +/* Marker class CIRCLE. + */ +static int gm_circ_select(); +static void gm_circ_move(), gm_circ_resize(), gm_circ_rotate(); +static void gm_circ_update(), gm_circ_updatePolygon(); + +static void +gm_circ_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Circle; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_CircleLineColor; + gm->knotColor = w->gterm.gm_CircleKnotColor; + gm->knotSize = w->gterm.gm_CircleKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + gm->width = gm->height = (gm->width + gm->height) / 2.0; + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + gm->npoints = GM_NPTSCIRCLE; /* MF015 */ + + gm->select = gm_circ_select; + gm->markpos = gm_markpos; + gm->update = gm_circ_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_circ_move; + gm->resize = gm_circ_resize; + gm->rotate = NULL; +} + +static void +gm_circ_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_circ_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_circ_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.width = new_gm.height = + sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + + gm->width = gm->height = new_gm.width; + gm_circ_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_circ_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double theta, x, y; + + /*npts = (gm->npoints - 1) / 4;*/ + npts = gm->npoints / 4; /* MF028 */ + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x + gm->x; + p[npts*0+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x + gm->x; + p[npts*1+j].y = y + gm->y; + + y = -y; j = i; + p[npts*2+j].x = x + gm->x; + p[npts*2+j].y = y + gm->y; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x + gm->x; + p[npts*3+j].y = y + gm->y; + } + + /*p[gm->npoints-1] = p[0];*/ /* MF015 */ +} + + +/* Marker class ELLIPSE. + */ +static int gm_elip_select(); +static void gm_elip_move(), gm_elip_resize(), gm_elip_rotate(); +static void gm_elip_update(), gm_elip_updatePolygon(); + +static void +gm_elip_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + + gm->type = Gm_Ellipse; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_EllipseLineColor; + gm->knotColor = w->gterm.gm_EllipseKnotColor; + gm->knotSize = w->gterm.gm_EllipseKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + gm->flags |= Gm_Smooth; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; +/* gm->npoints = GM_NPTSCIRCLE + 1;*/ + gm->npoints = GM_NPTSCIRCLE; /* MF015 */ + + gm->select = gm_elip_select; + gm->markpos = gm_markpos; + gm->update = gm_elip_update; + gm->redraw = gm_redraw; + gm->addPt = NULL; + gm->deletePt = NULL; + gm->movePt = NULL; + gm->move = gm_elip_move; + gm->resize = gm_elip_resize; + gm->rotate = gm_elip_rotate; +} + +static void +gm_elip_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static int +gm_elip_select (gm, x, y, what) + register Marker gm; + int x, y; + GmSelection what; +{ + if (gm_select (gm, x, y, what)) { + if (what && what->type == Ge_Point) + what->type = Ge_Edge; + return (1); + } else + return (0); +} + +static void +gm_elip_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + + gm->x = new_gm.x; gm->y = new_gm.y; + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_resize (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; +/* double theta = -(gm->rotangle);*/ + double theta = (gm->rotangle); /* MF019 */ + int rx, ry; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos(theta) - y * sin(theta); + ry = x * sin(theta) + y * cos(theta); + + /* Compute new width and height. */ + new_gm.width = abs(rx); + new_gm.height = abs(ry); + + gm_constraint (gm, &new_gm, Gb_Width|Gb_Height); + gm->width = new_gm.width; + gm->height = new_gm.height; + + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_elip_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + double theta; + + if (x == gm->x && y == gm->y) + gm->rotangle = 0; + else { +/* theta = atan2 ((double)(y - gm->y), (double)(x - gm->x));*/ + theta = atan2 ((double)(gm->y - y), (double)(x - gm->x)); /* MF019 */ + new_gm.rotangle = gm_niceAngle (theta); + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm_elip_updatePolygon (gm); + gm_setCurRect (gm); + } +} + +static void +gm_elip_updatePolygon (gm) + Marker gm; +{ + register XPoint *p = gm->points; + register int npts, i, j; + double cos_rotangle, sin_rotangle; + double theta, x, y; + + npts = (gm->npoints - 1) / 4 + 1; /* MF017 */ +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + + for (i=0; i < npts; i++) { + theta = PI_2 / npts * i; + x = gm->width * cos(theta); + y = gm->height * sin(theta); + + j = i; + p[npts*0+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*0+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*1+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*1+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + y = -y; j = i; + p[npts*2+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*2+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + + x = -x; j = npts-1 - i; + p[npts*3+j].x = x * cos_rotangle - y * sin_rotangle + gm->x + 0.5; + p[npts*3+j].y = x * sin_rotangle + y * cos_rotangle + gm->y + 0.5; + } + + /*p[gm->npoints-1] = p[0];*/ /* MF015 */ +} + + +/* Marker class POLYGON. + */ +static int gm_pgon_select(); +static void gm_pgon_addPt(), gm_pgon_deletePt(), gm_pgon_movePt(); +static void gm_pgon_move(), gm_pgon_resize(), gm_pgon_rotate(); +static void gm_pgon_redraw(), gm_pgon_update(), gm_pgon_updatePolygon(); + +static void +gm_pgon_init (gm, interactive) + register Marker gm; + int interactive; +{ + register GtermWidget w = gm->w; + register DPoint *p; + + gm->type = Gm_Polygon; + if (!(gm->flags & Gm_Activated)) { + gm->lineWidth = w->gterm.gm_lineWidth; + gm->lineStyle = w->gterm.gm_lineStyle; + gm->highlightColor = w->gterm.gm_highlightColor; + gm->lineColor = w->gterm.gm_PgonLineColor; + gm->knotColor = w->gterm.gm_PgonKnotColor; + gm->knotSize = w->gterm.gm_PgonKnotSize; + gm->fill = w->gterm.gm_fill; + gm->fillStyle = w->gterm.gm_fillStyle; + gm->fillColor = w->gterm.gm_fillColor; + gm->fillBgColor = w->gterm.gm_fillBgColor; + + gm->npoints = gm->pgon_npts = 4 + 1; + gm->points = gm->point_data; + if (gm->pgon) + XtFree ((char *)gm->pgon); + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + gm->x = w->gterm.last_x; + gm->y = w->gterm.last_y; + + if (p) { + p[0].x = -1; p[0].y = -1; + p[1].x = -1; p[1].y = 1; + p[2].x = 1; p[2].y = 1; + p[3].x = 1; p[3].y = -1; + p[4].x = -1; p[4].y = -1; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + + if (interactive) + gm->flags |= Gm_PgonInit; + } + + if (gm->points && gm->npoints > GM_MAXVERTICES) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + /* The following gets executed when an existing non-polygon marker is + * turned into a polygon marker. + */ + if (gm->pgon && gm->pgon_npts) + gm->npoints = gm->pgon_npts; + else { + gm->npoints = gm->pgon_npts = 4 + 1; + + /* Start out with a small square polygon. */ + gm->pgon = p = (DPoint *) XtMalloc (5 * sizeof (DPoint)); + + if (p) { + p[0].x = -gm->width; p[0].y = -gm->height; + p[1].x = -gm->width; p[1].y = gm->height; + p[2].x = gm->width; p[2].y = gm->height; + p[3].x = gm->width; p[3].y = -gm->height; + p[4].x = -gm->width; p[4].y = -gm->height; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + } + } + + gm->select = gm_select; + gm->markpos = gm_markpos; + gm->update = gm_pgon_update; + gm->redraw = gm_pgon_redraw; + gm->addPt = gm_pgon_addPt; + gm->deletePt = gm_pgon_deletePt; + gm->movePt = gm_pgon_movePt; + gm->move = gm_pgon_move; + gm->resize = gm_pgon_resize; + gm->rotate = gm_pgon_rotate; +} + +static void +gm_pgon_redraw (gm, function) + register Marker gm; + int function; +{ + /* The PgonInit flag is set when a polygon marker is interactively created + * to cause any pointer motion event to resize the marker. The first + * pointer up causes a redraw which clears the flag. + */ + if (function != GXxor && gm->width > 1 && gm->height > 1) + gm->flags &= ~Gm_PgonInit; + + gm_redraw (gm, function); +} + +static void +gm_pgon_update (gm) + register Marker gm; +{ + if (gm->flags & Gm_Modified) { + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); + gm->flags &= ~Gm_Modified; + } +} + +static void +gm_pgon_addPt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + int vertex, nbytes; + double rx, ry; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Add the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + nbytes = (gm->npoints + 1) * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + + gm->pgon = pv; + memmove (&pv[vertex+2], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + pv[vertex+1].x = rx; + pv[vertex+1].y = ry; + gm->npoints++; + + nbytes = gm->npoints * sizeof (XPoint); + if (gm->npoints > GM_MAXVERTICES) { + if (gm->points != gm->point_data) + gm->points = (XPoint *) XtRealloc ((char *)gm->points, nbytes); + else + gm->points = (XPoint *) XtMalloc (nbytes); + } else + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_deletePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *pv; + register GtermWidget w = gm->w; + int vertex, nbytes; + + if (gm->npoints <= 2) + return; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Delete the point. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + pv = gm->pgon; + + memmove (&pv[vertex], &pv[vertex+1], + (gm->npoints - vertex - 1) * sizeof(DPoint)); + gm->npoints--; + + nbytes = gm->npoints * sizeof (DPoint); + if ((pv = (DPoint *) + XtRealloc ((char *)gm->pgon, nbytes)) == (DPoint *)NULL) + return; + gm->pgon = pv; + + if (gm->npoints <= GM_MAXVERTICES && gm->points != gm->point_data) + XtFree ((char *)gm->points); + gm->points = gm->point_data; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_movePt (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; +/* double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); */ + double cos_rotangle = cos ((gm->rotangle)); /* MF019 */ + double sin_rotangle = sin ((gm->rotangle)); /* MF019 */ + double rx, ry; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get vertex. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + + /* Edit point. */ + p->x = rx; + p->y = ry; + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_move (gm, x, y) + register Marker gm; + int x, y; +{ + struct marker new_gm; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + new_gm.x = x; new_gm.y = y; + gm_constraint (gm, &new_gm, Gb_X|Gb_Y); + gm->x = new_gm.x; gm->y = new_gm.y; + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_resize (gm, x, y) + Marker gm; + int x, y; +{ + register DPoint *p, *q; + GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double theta, scale, slope, rx, ry, x1, y1, x2, y2, xi; + int vertex, i; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + + /* Get first vertex of nearest edge. */ + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + p = &gm->pgon[vertex]; + q = p + 1; + + /* Rotate reference frame so that intercept is at y=0. */ + if (abs(rx) + abs(ry) < 1.0) + scale = 1.0; + else { + theta = atan2 (ry, rx); + cos_rotangle = cos (-theta); + sin_rotangle = sin (-theta); + + x1 = p->x * cos_rotangle - p->y * sin_rotangle; + y1 = p->x * sin_rotangle + p->y * cos_rotangle; + x2 = q->x * cos_rotangle - q->y * sin_rotangle; + y2 = q->x * sin_rotangle + q->y * cos_rotangle; + + /* Compute scale factor. */ + if (y1 == y2 || x1 == x2) + scale = 1.0; + else { + slope = (y2 - y1) / (x2 - x1); + xi = x1 - y1 / slope; + scale = sqrt (SQR(rx) + SQR(ry)) / xi; + } + } + + /* Rescale the polygon. */ + for (i=0, p=gm->pgon; i < gm->npoints; i++, p++) { + p->x *= scale; + p->y *= scale; + } + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_rotate (gm, x, y) + register Marker gm; + int x, y; +{ + register DPoint *p; + register GtermWidget w = gm->w; + double cos_rotangle = cos (-(gm->rotangle)); + double sin_rotangle = sin (-(gm->rotangle)); + double alpha, beta, rx, ry; + double theta = atan2 ((double)(gm->y - y), (double)(x - gm->x));/* MF019 */ + struct marker new_gm; + int vertex; + + if (gm->flags & Gm_PgonInit) { + gm_pgon_resize (gm, x, y); + return; + } + + if (x == gm->x && y == gm->y) + return; + + /* Translate to the marker reference frame. */ + x = x - gm->x; + y = y - gm->y; + + /* Rotate back to the unrotated reference frame. */ + rx = x * cos_rotangle - y * sin_rotangle; + ry = x * sin_rotangle + y * cos_rotangle; + if (abs(rx) + abs(ry) < 1.0) + return; + + vertex = w->gterm.gm_selection.vertex; + if (vertex < 0 || vertex >= gm->npoints) + return; + + p = &gm->pgon[vertex]; + alpha = atan2 (p->y, p->x); /* angle btw origin & selected vertex */ + beta = atan2 (ry, rx); /* angle btw origin & cursor position */ + + new_gm.rotangle = gm_niceAngle (gm->rotangle + (beta - alpha)); + + new_gm.rotangle = gm_niceAngle (theta); /* MF019 */ + + gm_constraint (gm, &new_gm, Gb_Rotangle); + gm_rotate_indicator (gm, GXxor); /* MF020 */ + gm->rotangle = new_gm.rotangle; + gm_rotate_indicator (gm, GXxor); /* MF020 */ + + gm_pgon_updatePolygon (gm); + gm_setCurRect (gm); +} + +static void +gm_pgon_updatePolygon (gm) + Marker gm; +{ + register npts, i; + register DPoint *ip = gm->pgon; + register XPoint *op = gm->points; + double cos_rotangle, sin_rotangle; + int width, height, xp, xn, yp, yn; + + npts = gm->npoints; +/* cos_rotangle = cos (gm->rotangle); + sin_rotangle = sin (gm->rotangle); */ + cos_rotangle = cos (-gm->rotangle); /* MF019 */ + sin_rotangle = sin (-gm->rotangle); /* MF019 */ + xp = xn = yp = yn = 0; + + for (i=0; i < npts; i++, ip++, op++) { + /* Compute the rotated point. */ + op->x = ip->x * cos_rotangle - ip->y * sin_rotangle + gm->x + 0.5; + op->y = ip->x * sin_rotangle + ip->y * cos_rotangle + gm->y + 0.5; + + /* Compute a width/height estimate for the polygon. + */ + if (ip->x > xp) + xp = ip->x; + else if (ip->x < xn) + xn = ip->x; + + if (ip->y > yp) + yp = ip->y; + else if (ip->y < yn) + yn = ip->y; + + gm->width = (xp + -xn) / 2; + gm->height = (yp + -yn) / 2; + } + + gm->points[npts-1] = gm->points[0]; + gm->pgon_npts = gm->npoints; +} + + +/* Internal procedures for above code. + * ----------------------------------- + */ + +/* gm_select -- Determine if a point is within or near a marker, and if so, + * determine whether the point selects a vertex, edge, or the entire marker. + */ +static int +gm_select (gm, x, y, what) + Marker gm; + register int x, y; + GmSelection what; +{ + register XPoint *p, *ptop; + GtermWidget w = gm->w; + int v_dist = w->gterm.gm_nearVertex; + int e_dist = w->gterm.gm_nearEdge; + double seglen, d1, d2, s, K, frac; + int ncrossings, x0, y0; + XPoint *q; + int n; + int use_old_method = 0; + + /* Determine if the point is near a vertex. */ + for (p = gm->points, n = gm->npoints - 1; --n >= 0; p++) + if (abs (x - p->x) < v_dist && abs (y - p->y) < v_dist) { + if (what) { + what->type = Ge_Point; + what->vertex = p - gm->points; + } + return (1); + } + + /* Determine if the point is near an edge. The test is based on the + * observation that when a point is near a line segment, the sum of the + * distances from the point to either end-point of the line segment is + * nearly the same as the length of the line segment. + */ + p = gm->points; + + ptop = p + (gm->npoints - 1); /* MF014 */ + x0 = p->x; y0 = p->y; + d1 = sqrt ((double)(SQR(x - x0) + SQR(y - y0))); + + for (p++; p < ptop; p++) { + seglen = sqrt ((double)(SQR(p->x - x0) + SQR(p->y - y0))); + d2 = sqrt ((double)(SQR(x - p->x) + SQR(y - p->y))); + + if (abs(d1 + d2 - seglen) < e_dist) { /* MF028 */ + if (what) { + what->type = Ge_Edge; + what->vertex = (p - 1) - gm->points; + } + return (1); + } + + d1 = d2; + x0 = p->x; y0 = p->y; + } + + /* If the marker is one of the closed polygon types, determine if the + * point is inside the marker. + */ + switch (gm->type) { + case Gm_Line: + case Gm_Polyline: + return (0); + break; + case Gm_Circle: + d1 = sqrt ((double)(SQR(x - gm->x) + SQR(y - gm->y))); + if (d1 < gm->width) { + if (what) what->type = Ge_Marker; + return (1); + } else + return (0); + break; + } + + if (use_old_method) { + for (p = gm->points, ncrossings=0; p < ptop; p++) { + /* Scan forward until we find a line segment that crosses Y. + */ + if (p->y > y) { + for (p++; p < ptop && p->y >= y; p++) + ; + --p; + } else if (p->y < y) { + for (p++; p < ptop && p->y <= y; p++) + ; + --p; + } + + /* The line segment p[0]:p[1] crosses the Y plane. If this lies + * entirely to the left of the X plane we can ignore it. If any + * portion of the line segment lies to the right of X we compute + * the point where the line intersects the Y plane. If this point + * is to the right of the X plane we have a crossing. + */ + q = p + 1; + if (q < ptop && p->x > x || q->x > x) { + if (q->y == p->y) + frac = (double) 0.0; + else + frac = (double)(y - p->y) / (double)(q->y - p->y); + if ((frac * (q->x - p->x) + p->x) >= x) + ncrossings++; + } + } + + } else { + float xp[64], yp[64]; + int i; + + for (i=0, p=gm->points, ncrossings=0; p <= ptop; p++, i++) { + xp[i] = (float) p->x; + yp[i] = (float) p->y; + } + ncrossings = point_in_poly (gm->npoints, xp, yp, (float)x, (float)y); + } + + if (ncrossings & 1) { + if (what) + what->type = Ge_Marker; + return (1); + } + + return (0); +} + +point_in_poly (npol, xp, yp, x, y) +int npol; +float *xp, *yp, x, y; +{ + int i, j, c = 0; + + for (i = 0, j = npol-1; i < npol; j = i++) { + if ((((yp[i] <= y) && (y < yp[j])) || + ((yp[j] <= y) && (y < yp[i]))) && + (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])) + + c = !c; + } + return c; +} + + + + +/* gm_markpos -- Mark the current position of a marker. + */ +static void +gm_markpos (gm) + register Marker gm; +{ + gm->old_rect = gm->cur_rect; + XUnionRegion (gm->cur_region, null_region, gm->old_region); +} + + +/* gm_redraw -- Redraw a marker expressed as a list of vertices. + */ +static void +gm_redraw (gm, function) + register Marker gm; + int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + int flags = (Gm_Activated|Gm_Visible); + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!w || !XtIsRealized ((Widget)w)) + return; + if (!((gm->flags & flags) == flags)) + return; + + /* Fill the polygon area if indicated. */ + if (gm->fill && function != GXxor) { + if (gm->fillPattern) { + XSetStipple (display, gc, gm->fillPattern); + XSetForeground (display, gc, gm->fillColor); + XSetBackground (display, gc, gm->fillBgColor); + XSetFillStyle (display, gc, gm->fillStyle); + } else { + XSetForeground (display, gc, gm->fillColor); + XSetFillStyle (display, gc, FillSolid); + } + + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Nonconvex, CoordModeOrigin); + } + + /* Set up the drawing GC. */ + if (function != GXxor) { + XSetFunction (display, gc, function); + XSetFillStyle (display, gc, FillSolid); + XSetForeground (display, gc, (gm == w->gterm.gm_active) ? + gm->highlightColor : gm->lineColor); + + XSetLineAttributes (display, gc, + gm->lineWidth + + ((gm == w->gterm.gm_active) ? w->gterm.gm_highlightWidth : 0), + gm->lineStyle, + CapButt, + (gm->type == Gm_Polygon || gm->type == Gm_Polyline) ? + JoinBevel : JoinMiter); + } + + /* Draw the marker outline. */ + if (gm->lineWidth > 0) { + if (gm->type == Gm_Circle || + (gm->type == Gm_Ellipse && abs(gm->rotangle) < 0.01)) { + + /* Special case - use X arc drawing primitive. We could use the + * gm->points polygon instead, as this outline polygon is + * maintained for all classes of marker. + */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + } + XDrawArc (display, window, gc, + gm->x - gm->width, gm->y - gm->height, + gm->width * 2, gm->height * 2, 0, 360 * 64); + + } else { + /* Draw marker expressed as a polygon. */ + if (w->gterm.gm_xorFill && function == GXxor) { + XFillPolygon (display, window, gc, + gm->points, gm->npoints, Convex, CoordModeOrigin); + } + XDrawLines (display, window, gc, + gm->points, gm->npoints, CoordModeOrigin); + } + } + + /* Draw the knots if enabled. */ + if (function != GXxor && gm->knotSize > 0) { + int knotsize = gm->knotSize; + int halfsize = gm->knotSize / 2; + int i; + + XSetForeground (display, gc, gm->knotColor); + for (i=0; i < gm->npoints; i++) { + XFillRectangle (display, window, gc, + gm->points[i].x - halfsize, gm->points[i].y - halfsize, + gm->knotSize, gm->knotSize); + } + } +} + + +/* gm_rotate_indicator -- Draw a line indicating the rotation angle. + */ +static void +gm_rotate_indicator (gm, function) /* MF020 */ +Marker gm; +int function; +{ + GtermWidget w = gm->w; + Display *display = w->gterm.display; + Window window = w->gterm.window; + GC gc = (function == GXxor) ? w->gterm.gm_rubberGC : w->gterm.gm_drawGC; + + if (!gm->rotIndicator) + return ; + + if (function == GXxor) { + if (gm->type == Gm_Polygon || + gm->type == Gm_Ellipse || + gm->type == Gm_Box || + gm->type == Gm_Rectangle) { + int x, y, x2, y2; + double ar, cos_rotangle, sin_rotangle; + double alpha = atan2 ((double)gm->height,(double)gm->width); + + cos_rotangle = cos ((double)(-gm->rotangle - alpha)); + sin_rotangle = sin ((double)(-gm->rotangle - alpha)); + ar = (double) gm->height / (double) gm->width; + x = (int) (ar * (gm->width / 2)); + y = (int) (ar * (gm->height / 2)); + x2 = x * cos_rotangle - y * sin_rotangle + gm->x; + y2 = x * sin_rotangle + y * cos_rotangle + gm->y; + + XDrawLine (display, window, gc, gm->x, gm->y, x2, y2); + } + } else { + ; /* no-op at present */ + } +} + + +/* gm_setCurRect -- Compute a bounding rectangle which completely encloses + * a marker (assumes that the marker is expressed as list of points). + */ +static void +gm_setCurRect (gm) +Marker gm; +{ + int border; + + XDestroyRegion (gm->cur_region); + gm->cur_rect = null_rect; + + if (gm->npoints <= 0) + gm->cur_region = XCreateRegion(); + else { + gm->cur_region = XPolygonRegion (gm->points, gm->npoints, EvenOddRule); + border = (max (gm->lineWidth, gm->knotSize) + 1) / 2; + border = max (border, BORDER); + XShrinkRegion (gm->cur_region, -border, -border); + XClipBox (gm->cur_region, &gm->cur_rect); + } +} + + +/* gm_niceAngle -- Round a rotation angle to a "nice" value. + */ +static double +gm_niceAngle (alpha) + double alpha; +{ + double tol = 0.003; + double beta; + + if ( abs (alpha - PI_2*0) < tol) + beta = PI_2*0; + else if (abs (alpha - PI_2*1) < tol) + beta = PI_2*1; + else if (abs (alpha - PI_2*2) < tol) + beta = PI_2*2; + else if (abs (alpha - PI_2*3) < tol) + beta = PI_2*3; + else if (abs (alpha - PI_2*4) < tol) + beta = PI_2*0; + else + beta = alpha; + + return (beta); +} + + diff --git a/vendor/x11iraf/obm/ObmW/GtermP.h b/vendor/x11iraf/obm/ObmW/GtermP.h new file mode 100644 index 00000000..9b104a05 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermP.h @@ -0,0 +1,598 @@ +#ifndef _GtermP_h +#define _GtermP_h + +#include "Gterm.h" + +/* + * GtermP -- Private definitions for the Gterm graphics widget. + */ + +#define DEF_WIDTH 640 +#define DEF_HEIGHT 480 +#define MAX_RASTERS 512 +#define MAX_MAPPINGS 32 +#define SZ_NUMBER 64 +#define SZ_STATIC_CMAP 10 /* bg+fg+NColors */ +#define SZ_DYNAMIC_CMAP 201 /* bg+fg+NColors */ +#define SZ_OVERLAY_CMAP 18 /* bg+fg+NColors */ +#define MAX_SZCMAP 256 /* max size colormap */ +#define DEF_MAXCOLORS 216 /* max dynamic colors */ +#define MAX_WMWIN 32 /* max WM colormaps */ +#define MAX_REGIONS 64 /* setMapping regions */ +#define MAX_AUXTRANS 8 /* auxiliary translations */ +#define DEF_BASEPIXEL 38 /* base of custom colormap */ +#define DEF_CMAPUPDATE 60 /* seconds */ +#define DEF_CMAPSHADOW 10 /* seconds */ +#define DEF_COPYONRESIZE True /* copy pixmap on resize */ +#define DEF_WARPCURSOR False /* enable warp cursor */ +#define DEF_RAISEWINDOW False /* enable raise window */ +#define DEF_DEICONIFYWINDOW False /* enable deiconfify window */ +#define DEF_USETIMERS True /* ok to use timers */ +#define MAX_DRAW 64 /* max mappings for a draw */ +#define MAX_POINTS 4096 /* max points in polyline */ +#define GM_MAXVERTICES 64 /* max GM points w/o malloc */ +#define GM_NPTSCIRCLE 48 /* npoints circle or ellipse */ +#define GM_MAXCALLBACKS 16 /* max GM callbacks */ +#define GM_UPDATE 30 /* marker update interval */ +#define MAXNDC 32767 /* GKI/NDC scale factor */ +#define V_DIST 4 /* Close to vertex, pixels */ +#define E_DIST 1 /* Close to edge, pixels */ + + +#define RasterDepth 8 +#define ColormapDepth 8 +#define RGBDepth 24 + +#define NAlphaFonts 8 +#define NDialogFonts 8 +#define NColors 8 + +typedef void (*GmVMethod)(); +typedef int (*GmIMethod)(); +#define uchar unsigned char +#define ushort unsigned short + +/* Raster definitions. */ +#define ImageRaster 1 +#define PixmapRaster 2 + +struct raster { + int type; + int delete; + int width, height, depth; + union { + Pixmap pixmap; + XImage *ximage; + } r; + Pixmap shadow_pixmap; /* 8-bit shadow pixmap */ +}; + +/* Colormap structure. */ +struct colormap { + int map; + int ncells; + struct colormap *next; + unsigned short r[MAX_SZCMAP]; + unsigned short g[MAX_SZCMAP]; + unsigned short b[MAX_SZCMAP]; +}; + +/* mapExtent - Range of dst pixels affected by a src pixel. */ +typedef struct { + Position lo; + Position hi; +} mapExtent, *MapExtent; + +/* Mappings map a source to a destination. A src or dst of zero refers to + * the window, a nonzero value is the raster number. + */ +struct mapping { + int mapping; /* mapping number */ + int enabled; /* update destination */ + int defined; /* mapping is defined */ + int updated; /* internal params ready */ + int refresh; /* refresh entire dest */ + int rop; /* rasterop */ + int src; /* source rect */ + int st; + int sx, sy; + int snx, sny; + int dst; /* destination rect */ + int dt; + int dx, dy; + int dnx, dny; + int scaling; /* internal parameters */ + float xscale, yscale; + mapExtent *x_extent, *y_extent; + int *x_srcpix, *y_srcpix; + float *x_src, *y_src; + uchar *mapdata; + int datalen; + struct mapping *prev; /* previous in stack order */ + struct mapping *next; /* next in stack order */ +}; + +#define M_NOSCALING 0 +#define M_ZOOM 1 +#define M_INTZOOM 2 +#define M_DEZOOM 3 + +/* The drawing context defines what happens when a drawing operation (e.g. + * polyline) takes place. In the simplest case (raster=0) one simply draws + * into the display window with no transformation or clipping. When a + * raster provides the drawing context, the graphics are drawn once for each + * active mapping defined on the raster, using the scaling and drawable + * defined by the mapping. + */ +struct drawContext { + int valid; + int raster; + struct raster *rp; + int nmappings; + struct mappingContext { + int mapping; + struct mapping *mp; + int scale; + float xoffset, xscale; + float yoffset, yscale; + int use_backing_store; + Pixmap pixmap; + GC drawGC; + int GC_private; + } mapContext[MAX_DRAW]; +}; + +/* Graphics Markers. A marker is an active graphics object displayed on + * top of a drawing to mark a region. Markers can respond to events and + * move, resize, or modify themselves, optionally executing callback + * procedures when the marker changes state. + */ + +/* Callback descriptor. */ +struct markerCallback { + int events; + GmIMethod func; + XtPointer client_data; +}; + +/* Marker selection. */ +struct markerSelection { + int type; + int vertex; +}; + +/* Main Marker descriptor. */ +struct marker { + GtermWidget w; /* backpointer to widget */ + int type; /* marker type */ + int flags; /* bitflags */ + int x, y; /* position */ + int width, height; /* size */ + double rotangle; /* orientation */ + XtTranslations translations; /* marker translations */ + XRectangle old_rect; /* old bounding box */ + Region old_region; /* old screen region */ + XRectangle cur_rect; /* current bounding box */ + Region cur_region; /* current screen region */ + Time time; /* time of last marker edit */ + struct marker *next; /* next marker */ + struct marker *prev; /* previous marker */ + struct marker *parent; /* set if copy */ + + int lineColor, lineWidth, lineStyle; /* marker attributes */ + int highlightColor; + int knotColor, knotSize; + int fill, fillStyle; + int fillColor, fillBgColor; + Pixmap fillPattern; + int imageText, textBorder; + int textColor, textBgColor; + int rotIndicator; /* MF020 */ + XFontStruct *font; + + int npoints; /* marker data */ + XPoint *points; + XPoint point_data[GM_MAXVERTICES+1]; + struct dPoint *pgon; + int pgon_npts; + char *text; + + GmIMethod select; /* class methods */ + GmVMethod markpos; + GmVMethod redraw; + GmVMethod update; + GmVMethod addPt; + GmVMethod deletePt; + GmVMethod movePt; + GmVMethod move; + GmVMethod resize; + GmVMethod rotate; + + int ncallbacks; /* callbacks */ + struct markerCallback callback[GM_MAXCALLBACKS]; + XtIntervalId focus_id; + int constraints; +}; + +/* Graphics marker bitflags. +*/ +#define Gm_Activated 000001 +#define Gm_Visible 000002 +#define Gm_Sensitive 000004 +#define Gm_AutoRedraw 000010 +#define Gm_PgonInit 000020 +#define Gm_Smooth 000040 +#define Gm_Modified 000100 +#define Gm_BeingDestroyed 000200 + +/* Attribute value type codes. +*/ +#define Gt_Bool 1 +#define Gt_Int 2 +#define Gt_DFloatP 3 +#define Gt_Pointer 4 +#define Gt_String 5 + +/* Attribute name codes. +*/ +#define Ga_Type 1 +#define Ga_Activated 2 +#define Ga_Visible 3 +#define Ga_Sensitive 4 +#define Ga_AutoRedraw 5 +#define Ga_Translations 6 +#define Ga_X 7 +#define Ga_Y 8 +#define Ga_Width 9 +#define Ga_Height 10 +#define Ga_Rotangle 11 +#define Ga_HighlightColor 12 +#define Ga_LineColor 13 +#define Ga_LineWidth 14 +#define Ga_LineStyle 15 +#define Ga_KnotColor 16 +#define Ga_KnotSize 17 +#define Ga_Fill 18 +#define Ga_FillColor 19 +#define Ga_FillBgColor 20 +#define Ga_FillPattern 21 +#define Ga_FillStyle 22 +#define Ga_TextColor 23 +#define Ga_TextBgColor 24 +#define Ga_TextBorder 25 +#define Ga_ImageText 26 +#define Ga_Font 27 +#define Ga_Text 28 +#define Ga_RotIndicator 29 /* MF020 */ + +/* Bitflags for selected attributes. +*/ +#define Gb_X 00001 +#define Gb_Y 00002 +#define Gb_Width 00004 +#define Gb_Height 00010 +#define Gb_Rotangle 00020 + +/* Codes for marker selection types. +*/ +#define Ge_Marker 1 +#define Ge_Point 2 +#define Ge_Edge 3 + +/* Auxiliary translation tables. +*/ +#define T_replace 0 +#define T_augment 1 +#define T_override 2 + +typedef struct raster *Raster; +typedef struct mapping *Mapping; +typedef struct drawContext *DrawContext; +typedef struct mappingContext *MappingContext; +typedef struct marker *Marker; +typedef struct markerSelection gmSelection; +typedef struct markerSelection *GmSelection; + + +/* Gterm callbacks. +*/ +typedef void (*GtCallbackProc)(); +struct gtCallback { + GtCallbackProc proc; + XtPointer client_data; + struct gtCallback *next; +}; +typedef struct gtCallback GtCallback; + + +/* Main Gterm widget instance descriptor. + */ +typedef struct { + /* resources */ + XFontStruct *alphaFont1; /* graphics fonts */ + XFontStruct *alphaFont2; + XFontStruct *alphaFont3; + XFontStruct *alphaFont4; + XFontStruct *alphaFont5; + XFontStruct *alphaFont6; + XFontStruct *alphaFont7; + XFontStruct *alphaFont8; + + XFontStruct *dialogFont1; /* dialog fonts */ + XFontStruct *dialogFont2; + XFontStruct *dialogFont3; + XFontStruct *dialogFont4; + XFontStruct *dialogFont5; + XFontStruct *dialogFont6; + XFontStruct *dialogFont7; + XFontStruct *dialogFont8; + + Pixel dialogBgColor; /* default colors */ + Pixel dialogFgColor; + Pixel idleCursorBgColor; + Pixel idleCursorFgColor; + Pixel busyCursorBgColor; + Pixel busyCursorFgColor; + Pixel ginmodeCursorBgColor; + Pixel ginmodeCursorFgColor; + int ginmodeBlinkInterval; + XColor ginmodeColors[2]; + Pixel crosshairCursorColor; + String idleCursor; + String busyCursor; + String ginmodeCursor; + Boolean warpCursor; + Boolean raiseWindow; + Boolean deiconifyWindow; + Boolean useTimers; + + Pixel color0; + Pixel color1; + Pixel color2; + Pixel color3; + Pixel color4; + Pixel color5; + Pixel color6; + Pixel color7; + Pixel color8; + Pixel color9; + + String cacheRasters; + int maxRasters; /* raster display stuff */ + int maxMappings; + int maxColors; + + /* private state */ + Display *display; + Screen *screen; + Window window; + Window root; + Visual* visual; /* ptr to non-default visual */ + int forcePseudo8; /* force use of Pseudo 8 vis */ + + int w_depth; /* screen depth and visual */ + int w_visual_class; + + int raster; /* used for drawing context */ + int delay; /* wait for display */ + Pixmap pixmap; /* used to refresh window */ + Pixmap d_pixmap; /* used to erase dialog area */ + int d_saved; /* set when d_pixmap filled */ + int d_raster; /* current display raster */ + + GC clearGC; /* clear pixmap */ + GC clear8GC; /* 8-bit clear pixmap */ + GC exposeGC; /* copy pixmap to window */ + GC expose8GC; /* */ + GC drawGC; /* graphics drawing */ + GC dialogGC; /* dialog box */ + GC cursorGC; /* crosshair cursor */ + + int cursor_type; /* type of cursor to display */ + Cursor cursor; /* current cursor */ + int full_crosshair; /* crosshair enabled */ + int preserve_screen; /* cursor preserves screen */ + int preserve_valid; /* saved data is valid */ + Cursor idle_cursor; /* application is idle */ + Cursor busy_cursor; /* application is busy */ + Cursor ginmode_cursor; /* graphics input mode */ + Cursor crosshair_cursor; /* graphics input mode */ + int cursor_drawn; /* crosshair cursor drawn */ + int cur_x, cur_y; /* crosshair cursor coords */ + int old_width, old_height; /* size before resize */ + int save_root; /* root window of saved cur */ + int save_x, save_y; /* saved cursor location */ + int last_x, last_y; /* x,y of last event */ + int interactive; /* set if cursor read */ + int char_size; /* not used */ + int data_level; /* draw or erase graphics */ + int line_style; /* solid or patterned line */ + int line_width; /* width of line in pixels */ + int fill_type; /* not used */ + int color_index; /* current color index */ + int xres, yres; /* tek logical resolution */ + int d_xoff, d_yoff; /* dialog area offset */ + int d_height; /* dialog area height */ + int optcols, optrows; /* optimum screen size, chars */ + int alpha_font; /* current alpha font index */ + int dialog_font; /* current dialog font index */ + + int ncolors; /* current cmap size */ + int haveColormap; /* colormap initialized */ + Boolean copyOnResize; /* copy old pixmap on resize */ + int useDefaultCM; /* use default colormap */ + Pixel base_pixel; /* used for custom colormap */ + String cmapName; /* private colormap name */ + Boolean useGlobalCmap; /* use global data struct? */ + Boolean cmapInitialize; /* forcibly install colormap */ + Atom cmapAtom; /* atom for cmap property */ + int cmapShadow; /* update default colormap */ + Time cmapLastShadow; /* time of last update */ + Boolean cmapInterpolate; /* interpolate colormap */ + int cmapUpdate; /* update interval, seconds */ + Time cmapLastUpdate; /* time of last update */ + + Pixel *cmap; /* map color number to pixval */ + XColor *color; /* RGB color assignments */ + + ushort iomap[MAX_SZCMAP]; /* client i/o color map */ + Pixel cmap_in[MAX_SZCMAP]; /* umap and cmap combined */ + Pixel cmap_out[MAX_SZCMAP]; /* umap and cmap combined */ + int cmap_in_valid; /* set when cmap_in computed */ + int cmap_out_valid; /* set when cmap_out computed */ + struct colormap *colormaps; /* list of client colormaps */ + Window wmTop; /* top level window */ + Window wmWindows[MAX_WMWIN]; /* custom colormap windows */ + int n_wmWindows; /* number of WM windows */ + int in_window; /* pointer is in window */ + XWindowAttributes wa; /* window attributes */ + int wa_defined; /* set when above is defined */ + + + XFontStruct *alpha_fonts[NAlphaFonts]; /* alpha font index */ + XFontStruct *dialog_fonts[NDialogFonts];/* dialog font index */ + + GtCallback *resetCallback; /* client setGterm callbacks */ + GtCallback *resizeCallback; /* client resize callback */ + GtCallback *inputCallback; /* client event input cb */ + + Raster rasters; /* raster descriptors */ + int nrasters; /* number of alloced rasters */ + Mapping mappings; /* mapping descriptors */ + int nmappings; /* number of mappings */ + Mapping mp_head; /* head of mapping list */ + Mapping mp_tail; /* tail of mapping list */ + struct drawContext draw; /* drawing context */ + + /* Markers */ + Marker gm_head; /* head of marker list */ + Marker gm_tail; /* head of marker list */ + Marker gm_create; /* set if creating marker */ + Marker gm_active; /* marker that has focus */ + gmSelection gm_selection; /* active portion of marker */ + GC gm_drawGC; /* marker drawing GC */ + GC gm_rubberGC; /* marker rubber-band GC */ + Cursor gm_markerCursor; /* pointer in marker */ + Cursor gm_edgeCursor; /* pointer on marker edge */ + Cursor gm_pointCursor; /* pointer near marker point */ + int gm_redisplay; /* redisplay needed */ + int gm_initialized; /* set after init */ + + XtTranslations defTranslations; /* gterm translations */ + XtTranslations auxTrans[MAX_AUXTRANS]; /* auxiliary translations */ + int auxTType[MAX_AUXTRANS]; /* translation type */ + int nauxTrans; /* number of auxilary trans */ + String gm_translations; /* Marker translations */ + XtTranslations gm_defTranslations; /* default marker trans */ + Marker gm_curTranslations; /* current translations */ + Marker gm_reqTranslations; /* requested translations */ + XtIntervalId gm_timer_id; /* translation request timer */ + + String gm_defaultMarker; /* default marker type name */ + int gm_defaultType; /* default marker type */ + int gm_nearEdge; /* defines area near edge */ + int gm_nearVertex; /* defines area near Vertex */ + + int gm_lineWidth; /* shared attributes */ + int gm_lineStyle; + Boolean gm_fill; + Pixel gm_fillColor; + Pixel gm_fillBgColor; + int gm_fillStyle; + Boolean gm_xorFill; /* fill with GXxor */ + int gm_xorFillColor; /* xor-fill color */ + int gm_xorFillBgColor; /* xor-fill background color */ + int gm_highlightWidth; /* highlight width, pixels */ + int gm_highlightColor; /* highlight color */ + Pixel gm_cursorFgColor; /* marker cursors */ + Pixel gm_cursorBgColor; /* marker cursors */ + + Pixel gm_LineLineColor; /* Lines, Polylines */ + Pixel gm_LineKnotColor; + int gm_LineKnotSize; + Pixel gm_TextLineColor; /* Text markers */ + Pixel gm_TextColor; + Pixel gm_TextBgColor; /* bkg color, image text */ + int gm_TextBorder; /* border around text */ + XFontStruct *gm_TextFont; /* default font */ + String gm_TextString; /* default text */ + + Pixel gm_RectLineColor; /* Rectangle markers */ + Pixel gm_RectKnotColor; + int gm_RectKnotSize; + Pixel gm_BoxLineColor; /* Box markers */ + Pixel gm_BoxKnotColor; + int gm_BoxKnotSize; + Pixel gm_CircleLineColor; /* Circle markers */ + Pixel gm_CircleKnotColor; + int gm_CircleKnotSize; + Pixel gm_EllipseLineColor; /* Ellipse markers */ + Pixel gm_EllipseKnotColor; + int gm_EllipseKnotSize; + Pixel gm_PgonLineColor; /* Polygon markers */ + Pixel gm_PgonKnotColor; + int gm_PgonKnotSize; + + /* Deep Frame */ + String dialogBgColorStr; /* default colors */ + String dialogFgColorStr; + String idleCursorBgColorStr; + String idleCursorFgColorStr; + String busyCursorBgColorStr; + String busyCursorFgColorStr; + String ginmodeCursorBgColorStr; + String ginmodeCursorFgColorStr; + String crosshairCursorColorStr; + + String color0Str; + String color1Str; + String color2Str; + String color3Str; + String color4Str; + String color5Str; + String color6Str; + String color7Str; + String color8Str; + String color9Str; + + String gm_highlightColorStr; /* highlight color */ + String gm_fillColorStr; + String gm_fillBgColorStr; + String gm_cursorFgColorStr; /* marker cursors */ + String gm_cursorBgColorStr; + String gm_LineLineColorStr; /* Lines, Polylines */ + String gm_LineKnotColorStr; + String gm_TextLineColorStr; /* Text markers */ + String gm_TextColorStr; + String gm_TextBgColorStr; /* bkg color, image text */ + String gm_RectLineColorStr; /* Rectangle markers */ + String gm_RectKnotColorStr; + String gm_BoxLineColorStr; /* box */ + String gm_BoxKnotColorStr; + String gm_CircleLineColorStr; /* Circle markers */ + String gm_CircleKnotColorStr; + String gm_EllipseLineColorStr; /* Ellipse markers */ + String gm_EllipseKnotColorStr; + String gm_PgonLineColorStr; /* Polygon markers */ + String gm_PgonKnotColorStr; + String gm_PointLineColorStr; /* Point markers */ + String gm_PointKnotColorStr; + /* Deep Frame */ + +} GtermPart; + +typedef struct _GtermRec { + CorePart core; + GtermPart gterm; +} GtermRec; + +typedef struct {int dummy;} GtermClassPart; + +typedef struct _GtermClassRec { + CoreClassPart core_class; + GtermClassPart gterm_class; +} GtermClassRec; + +extern GtermClassRec gtermClassRec; + +#endif /* _GtermP_h */ diff --git a/vendor/x11iraf/obm/ObmW/GtermUtil.c b/vendor/x11iraf/obm/ObmW/GtermUtil.c new file mode 100644 index 00000000..6bc0e720 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/GtermUtil.c @@ -0,0 +1,52 @@ + +static XImage *cached_ximage = NULL; /* MF004 BEGIN */ + +/* GetCachedXImage -- + */ +static XImage * +GetCachedXImage (w, pixmap, width, height) + GtermWidget w; + Pixmap pixmap; + int width; + int height; +{ + if ((cached_ximage != NULL)) { + if ((pixmap == w->gterm.pixmap) && + (width == w->core.width) && + (height == w->core.height)) { + return (cached_ximage); + } + } + return(NULL); +} + + +/* DestroyCachedXImage -- + */ +static void +DestroyCachedXImage () +{ + if (cached_ximage != NULL) { + XDestroyImage (cached_ximage); + cached_ximage = NULL; + } +} + + +/* NewCachedXImage -- + */ +static void +NewCachedXImage (w, xin, pixmap, width, height) + GtermWidget w; + XImage *xin; + Pixmap pixmap; + int width; + int height; +{ + if ((pixmap == w->gterm.pixmap) && + (width == w->core.width) && + (height == w->core.height)) { + DestroyCachedXImage(); + cached_ximage = xin; + } +} /* MF004 END */ diff --git a/vendor/x11iraf/obm/ObmW/HTML-PSformat.c b/vendor/x11iraf/obm/ObmW/HTML-PSformat.c new file mode 100644 index 00000000..011651ab --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTML-PSformat.c @@ -0,0 +1,1544 @@ +/* HTML-PSformat.c - Module for NCSA's Mosaic software + * + * Purpose: to parse Hypertext widget contents into appropriate PostScript + * + * Author: Ameet A. Raval & Frans van Hoesel + * (aar@gfdl.gov & hoesel@chem.rug.nl). + * send bugreports to hoesel@chem.rug.nl + * + * Institution: for Ameet A. Raval: + * Geophysical Fluid Dynamics Laboratory, + * National Oceanic and Atmospheric Administration, + * U.S. Department of Commerce + * P.O. Box 308 + * Princeton, NJ 08542 + * for Frans van Hoesel: + * Xtreme graphics software + * Herepoortenmolendrift 36 + * 9711 DH Groningen + * The Netherlands + * + * Date: 1 aug 1993 + * Modification: 8 nov 1993 + * o added support for bold/italics courier + * o removed unused or no longer needed stuff + * o fixed the font alignment problem + * 23 nov 1993 + * o added support for horizontal ruler + * o on request of Ameet, added a specific + * line about whome to send bugreports to + * + * Copyright: This work is the product of the United States Government, + * and is precluded from copyright protection. It is hereby + * released into the public domain. + * + * WE MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED + * WARRANTY. WE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE + * USERS OF THIS SOFTWARE. + * + * pieces of code are taken from xvps by kind + * permission of John Bradley. + */ + + +#include <string.h> +#include <stdio.h> +#include <ctype.h> +#include <math.h> +#include "HTMLP.h" + +#ifdef _GNU_SOURCE +#define USE_STDARG +#endif +#if defined(__APPLE__) || (__APPLE_CC__ > 1151) || defined(USE_STDARG) +#include <stdarg.h> +#else +#include <varargs.h> + +/* Workaround for our old varargs handling on LinuxPPC systems. +#if defined(linux) && defined(__powerpc__) +#undef va_start +#undef va_alist +#undef va_dcl + +#define va_start(AP) __va_start_common (AP, 1) +#define va_alist __va_1st_arg +#define va_dcl register int va_alist; ... +#endif +*/ +#endif + +#if !defined(__DARWIN__) +#include <malloc.h> +#endif + + +/* Fix thanks to robm. */ +/* We don't have this on our system at NOAO... + * #ifdef __alpha + * #include <Xm/VaSimple.h> + * #endif + */ + +#define CR '\015' +#define LF '\012' + +extern int SwapElements(); + +/* the next page sizes are a compromise between letter sized paper + * (215.9 x 279.4 mm) and european standard A4 sized paper (210.0 x 297.0 mm). + * Note that PAGE_WIDTH is not the actual width of the paper + */ +#define TOP_MARGIN (10*72) +#define BOT_MARGIN (0.7*72) +#define LEFT_MARGIN (0.6*72) +#define PAGE_HEIGHT (TOP_MARGIN - BOT_MARGIN) +#define PAGE_WIDTH (8*72) + +#define F_FULLCOLOR 0 +#define F_GREYSCALE 1 +#define F_BWDITHER 2 +#define F_REDUCED 3 + +#define L_PAREN '(' +#define R_PAREN ')' +#define B_SLASH '\\' +#define MAX_ASCII '\177' + +#ifdef _NO_PROTO +# define ARG0(v0) () +# define ARG1(t1,v1) (v1) t1 v1; +# define ARG2(t1,v1,t2,v2) (v1,v2) t1 v1;t2 v2; +# define ARG3(t1,v1,t2,v2,t3,v3) (v1,v2,v3) t1 v1;t2 v2;t3 v3; +# define ARG4(t1,v1,t2,v2,t3,v3,t4,v4) (v1,v2,v3,v4) t1 v1;t2 v2;t3 v3;t4 v4; +# define ARG5(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) (v1,v2,v3,v4,v5) t1 v1;t2 v2;t3 v3;t4 v4; t5 v5; +# define ARG1V(t1,v1,e2) (v1) t1 v1; +#else +# define ARG0(v0) (v0) +# define ARG1(t1,v1) (t1 v1) +# define ARG2(t1,v1,t2,v2) (t1 v1, t2 v2) +# define ARG3(t1,v1,t2,v2,t3,v3) (t1 v1, t2 v2, t3 v3) +# define ARG4(t1,v1,t2,v2,t3,v3,t4,v4) (t1 v1, t2 v2, t3 v3, t4 v4) +# define ARG5(t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) (t1 v1, t2 v2, t3 v3, t4 v4, t5 v5) +# define ARG1V(t1,v1,e2) (t1 v1, e2) +#endif /* _NO_PROTO */ + +/* MONO returns total intensity of r,g,b components .33R+ .5G+ .17B */ +#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 13) + +/* PSconst_out outputs to the postscript buffer an array of constant + * strings + */ +#define PSconst_out(txt) {\ + int n=(sizeof txt)/(sizeof txt[0]); \ + int i; \ + for (i=0; i<n; i++) { \ + PSprintf("%s\n", txt[i]) ; \ + } \ +} + + +/* for regular-font, bold-font, italic-font, fixed-font */ +typedef enum { RF, BF, IF, FF, FB, FI } PS_fontstyle; + +static int PS_size, PS_len, PS_offset, PS_curr_page, PS_start_y, PS_hexi; +static int PS_page_offset; +static char *PS_string; +static float Points_Pixel; +static int Pixels_Page; +static PS_fontstyle PS_oldfn = RF; +static int PS_fontascent = 0; +static int PS_oldfs = 0; + +static XColor fg_color, bg_color; + + +/*__________________________________________________________________________ + | + | GetDpi - return Dots-per-inch of the screen + | + | calculate the pixel density in dots per inch on the current widget + | screen + | +*/ + +static float GetDpi ARG1(HTMLWidget, hw) { + Screen *s = XtScreen(hw); + float dpi; + + dpi = 25.4 * WidthOfScreen(s) / WidthMMOfScreen(s); + /* no earthly monitor does this */ + if (dpi<1.0 || dpi>10000.0) + dpi = 72.0; + return dpi; +} + + +/*__________________________________________________________________________ + | + | PSprintf - dynamic string concatenation function. + | + | In successive calls, the formatted string will be appended to the global + | output string Sp. + | It assumes that on each call, the length of the text appended to Sp + | is less than 1024. + | The format string is used as in printf, so you can use additional + | arguments. + | + | When successful, PSprintf returns the number of characters printed + | in this call, otherwise it returns EOF (just as printf does) + | +*/ + +#ifdef BROKEN_SOLARIS_COMPILER_STDARG +/* "Looks like there's a bug in Sun's C compiler and the stdarg.h use + of va_start() in HTML-PSformat.c. Until the SunPro folks can take a + look at the problem, the following pre-ANSI code should workaround + the problem." */ +static int PSprintf ARG1V(char *,format, ...) { + va_dcl + va_list args; + int len; + char *s; + + if (PS_size - PS_len < 1024) { + PS_size += 1024; + if ((s = (char *) realloc(PS_string, PS_size)) == NULL) { + fprintf(stderr, "PSprintf malloc failed\n"); + return(EOF); + } + PS_string = s; + } + va_start(args); + len = vsprintf(PS_string+PS_len, format, args); + /* this is a hack to make it work on systems were vsprintf(s,.) + * returns s, instead of the len. + */ + if (len != EOF && len != NULL) + PS_len += strlen(PS_string+PS_len); + va_end(args); + return(len); +} +#else /* not BROKEN_SOLARIS_COMPILER_STDARG */ + +#if defined(__APPLE__) || (__APPLE_CC__ > 1151) || defined(USE_STDARG) +static int PSprintf (char *format, ... ) +#else +static int PSprintf (format, va_alist) +char* format; +va_dcl +#endif +{ + int len; + char *s; + va_list args; + + if (PS_size - PS_len < 1024) { + PS_size += 1024; + if ((s = (char *) realloc(PS_string, PS_size)) == NULL) { + fprintf(stderr, "PSprintf malloc failed\n"); + return(EOF); + } + PS_string = s; + } +#if defined(__APPLE__) || (__APPLE_CC__ > 1151) || defined(USE_STDARG) + va_start(args,format); +#else + va_start(args); +#endif + len = vsprintf(PS_string+PS_len, format, args); + /* this is a hack to make it work on systems were vsprintf(s,...) + * returns s, instead of the len. + */ + if (len != EOF && len != 0) + PS_len += strlen(PS_string+PS_len); + va_end(args); + return(len); +} +#endif /* not BROKEN_SOLARIS_COMPILER_STDARG */ + +/*__________________________________________________________________________ + | + | PShex - output hex byte + | + | Append the byte "val" to an internal string buffer in hexadecimal + | format. If the argument "flush" is True, or if the buffer has filled + | up, flush the buffer to the larger postscript output buffer (using + | PSprintf). + | +*/ + +static int PShex ARG2(unsigned char,val, int,flush) { + + static unsigned char hexline[80]; + static char digit[] = "0123456789abcdef"; + + if (!flush) { + hexline[PS_hexi++] = (char) digit[((unsigned) val >> + (unsigned) 4) & (unsigned) 0x0f]; + hexline[PS_hexi++] = (char) digit[(unsigned) val & + (unsigned) 0x0f]; + } + + /* Changed from ">78" to ">77" on advice of + debra@info.win.tue.nl (Paul De Bra). */ + if ((flush && PS_hexi) || (PS_hexi>77)) { + hexline[PS_hexi] = '\0'; + PS_hexi=0; + return (PSprintf("%s\n", hexline)); + } + return (0); +} + + +/*__________________________________________________________________________ + | PSfont - change font + | + | change local font in buf to "font" + | fontfamily indicates if the overall style is times, helvetica, century + | schoolbook or lucida. + | +*/ + +static void PSfont ARG3( HTMLWidget,hw, XFontStruct *,font, int,fontfamily) { + + PS_fontstyle fn; + int style, size; + int fs; + + static PS_fontstyle fontstyle[17] = { + RF, IF, BF, FF, BF, BF, BF, BF, BF, + BF, IF, FF, FF, FB, FI, FB, FI + }; + + static char fnchar[6][3] = {"RF", "BF", "IF", "FF", "FB", "FI"}; + + /* fontsizes as set in gui.c and in HTML.c (listing font is only + * defined in HTML.c) + */ + static int fontsizes[4][3][17] = { + /* times font sizes */ + 14, 14, 14, 14, 18, 17, 14, 12, 10, 8, 14, 12, 12, 14, 14, 12, 12, + 17, 17, 17, 17, 24, 18, 17, 14, 12, 10, 17, 14, 12, 17, 17, 14, 14, + 20, 20, 20, 20, 25, 24, 20, 18, 17, 14, 20, 18, 12, 20, 20, 18, 18, + /* helvetica sizes */ + 14, 14, 14, 14, 18, 17, 14, 12, 10, 8, + 14, 12, 12, 14, 14, 12, 12, + 17, 17, 17, 17, 24, 18, 17, 14, 12, 10, + 17, 14, 12, 17, 17, 14, 14, + 20, 20, 20, 20, 25, 24, 20, 18, 17, 14, + 20, 18, 12, 20, 20, 18, 18, + /* new century schoolbook sizes */ + 14, 14, 14, 14, 18, 17, 14, 12, 10, 8, + 14, 12, 12, 14, 14, 12, 12, + 18, 18, 18, 18, 24, 18, 17, 14, 12, 10, + 18, 14, 12, 18, 18, 14, 14, + 20, 20, 20, 20, 25, 24, 20, 18, 17, 14, + 20, 18, 12, 20, 20, 18, 18, + /* lucida sizes */ + 14, 14, 14, 14, 18, 17, 14, 12, 11, 10, + 14, 12, 12, 14, 14, 12, 12, + 17, 17, 17, 17, 24, 18, 17, 14, 12, 10, + 17, 14, 12, 17, 17, 14, 14, + 20, 20, 20, 20, 25, 24, 20, 18, 17, 14, + 20, 18, 12, 20, 20, 18, 18 + }; + + /* next is for each fontfamily the ascent value as given by the + * medium sized bold x-font (the regular font has the same + * ascent value for both the medium and the large size Century + * font). + * it is use in the check for the fontsize (small, medium, large) + */ + static int medium_fontascent[4] = { + 14, 14, 16, 15 + }; + + /* for each fontfamily, for each fontsize, and for each font style + * give the ascent value, so the output from Postscript is correct. + * If the value is given between parenthesis, then it is different + * from the value as stored in the x-font. + * Note that this is a fix, and need to be changed, if the browser + * is fixed (in the current version 1.2 the baseline of various fonts + * is not aligned very well). + */ + static int fontascent[4][3][17] = { + /*rg, itl, bld, fix, h1, h2, h3, h4, h5, h6, + add, pla, lis, fixbold, fixital, plabold, plaital, */ + /* times */ + 12 ,(11), 12 ,(10),(15),(14), 12 ,(10), (8), (6), + 11 , (9), 10, 10 , 10 , (9), (9), + (13),(13),(14),(12),(20),(15),(14), 12 ,(10), (8), + 13 ,(10), 10 ,(12),(12),(10),(10), + (16),(15),(15),(13),(21),(20),(15),(15),(14), 12 , + 15 ,(13), 10,(13),(13),(13),(13), + /* helvetica */ + (12),(12),(12),(10),(15),(14),(12),(10), (9), (7), + (12), (9), 10 ,(10),(10), (9), (9), + (14),(14),(14),(12),(22),(15),(14),(12),(10), (9), + (14),(10), 10 ,(12),(12),(10),(10), + (16),(16),(16),(13),(22),(22),(16),(15),(14),(12), + (16),(13), 10 ,(13),(13),(13),(13), + /* new century schoolbook */ + (12),(12), 13 ,(10),(16), 14 , 13 ,(10), (9), (7), + (12), (9), 10 ,(10),(10), (9), (9), + (16),(14),(16),(13),(22),(16), 14 , 13 ,(10), (9), + (14),(10), 10 ,(13),(13),(10),(10), + (17),(16),(17),(13),(22),(22),(17),(16), 14 , 13 , + (16),(13), 10 ,(13),(13),(13),(13), + /* lucida bright */ + 11 ,(11), 11 ,(11),(15),(14), 11 ,(10), (9), (7), + 11 , (9), 10, 11 , 10 , (9), (9), + (14),(15),(14),(13),(20),(15),(14), 11 ,(10), (7), + 15 ,(11), 10 ,(13),(13),(11),(10), + (17),(17),(17),(16),(21),(20),(17),(15),(14), 11 , + 17 ,(14), 10,(16),(13),(14),(13) + }; + + /* NULL case - reflush old font or the builtin default: */ + if (hw==NULL || font==NULL) { + if (PS_oldfs != 0) + PSprintf( "%2s %d SF\n", fnchar[PS_oldfn], PS_oldfs); + return; + } + /* added the next line in case xmosaic version 199.4 has more fonts */ + style = 3; + + if (font == hw->html.font) { + style = 0; + } else if (font == hw->html.italic_font) { + style = 1; + } else if (font == hw->html.bold_font) { + style = 2; + } else if (font == hw->html.fixed_font) { + style = 3; + } else if (font == hw->html.header1_font) { + style = 4; + } else if (font == hw->html.header2_font) { + style = 5; + } else if (font == hw->html.header3_font) { + style = 6; + } else if (font == hw->html.header4_font) { + style = 7; + } else if (font == hw->html.header5_font) { + style = 8; + } else if (font == hw->html.header6_font) { + style = 9; + } else if (font == hw->html.address_font) { + style = 10; + } else if (font == hw->html.plain_font) { + style = 11; + } else if (font == hw->html.listing_font) { + style = 12; + } else if (font == hw->html.fixedbold_font) { + style = 13; + } else if (font == hw->html.fixeditalic_font) { + style = 14; + } else if (font == hw->html.plainbold_font) { + style = 15; + } else if (font == hw->html.plainitalic_font) { + style = 16; + } + + /* check size, by looking at the size of the regular font */ + size = 1; + if (hw->html.bold_font->ascent > medium_fontascent[fontfamily]) { + /* large font */ + size = 2; + } else if (hw->html.bold_font->ascent < medium_fontascent[fontfamily]) { + /* small font */ + size = 0; + } + fn = fontstyle[style]; + fs = fontsizes[fontfamily][size][style]; + PS_fontascent = fontascent[fontfamily][size][style]; + + if (fn != PS_oldfn || fs != PS_oldfs) { + PSprintf( "%2s %d SF\n", fnchar[fn], fs); + PS_oldfn=fn, PS_oldfs=fs; + } +} + + +/*__________________________________________________________________________ + | + | PSshowpage - end of page function + | + | show the current page and restore any changes to the printer state + | +*/ + +static void PSshowpage ARG0(void) { + + PSprintf("showpage restore\n"); +} + + +/*__________________________________________________________________________ + | + | PSnewpage - begin a fresh page + | + | increment the page count and handle the structured comment + | conventions + | +*/ + +static void PSnewpage ARG0(void) { + + PS_curr_page++; + + /* the PostScript reference Manual states that the Page: Tag + should have a label and a ordinal; otherwise programs like + psutils fail -gustaf */ + PSprintf("%%%%Page: %d %d\n", PS_curr_page, PS_curr_page); + PSprintf("save\nNP\n"); + PSfont( NULL, NULL, 0); /* force re-flush of last font used */ +} + + +/*__________________________________________________________________________ + | + | PSinit_latin1 - handle ISO encoding + | + | print out initializing PostScript text for ISO Latin1 font encoding + | This code is copied from the Idraw program (from Stanford's InterViews + | package), courtesy of Steinar Kjaernsr|d, steinar@ifi.uio.no + | +*/ + +static void PSinit_latin1 ARG0(void) { + + static char *txt[] = { + + "/reencodeISO {", + "dup dup findfont dup length dict begin", + "{ 1 index /FID ne { def }{ pop pop } ifelse } forall", + "/Encoding ISOLatin1Encoding D", + "currentdict end definefont", + "} D", + "/ISOLatin1Encoding [", + "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", + "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", + "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", + "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", + "/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright", + "/parenleft/parenright/asterisk/plus/comma/minus/period/slash", + "/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon", + "/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N", + "/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright", + "/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m", + "/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde", + "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", + "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef", + "/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve", + "/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut", + "/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar", + "/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot", + "/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior", + "/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine", + "/guillemotright/onequarter/onehalf/threequarters/questiondown", + "/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla", + "/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex", + "/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis", + "/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute", + "/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis", + "/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave", + "/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex", + "/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis", + "/yacute/thorn/ydieresis", + "] D", + "[RF BF IF FF FB FI] {reencodeISO D} forall" + }; + + PSconst_out(txt); +} + + +/*__________________________________________________________________________ + | + | PSinit - initialize Postscript output + | + | does the initialization per html document + | +*/ + +static void PSinit ARG0(void) { + PS_size = PS_len = PS_offset = PS_hexi = PS_page_offset = 0; + PS_start_y = 0; + PS_string = (char *) malloc(1); + PS_oldfs = 0; + PS_oldfn = RF; + PS_curr_page = 0 ; +} + + +/*__________________________________________________________________________ + | + | PSheader - initialize Postscript output + | + | prints out the prolog + | +*/ + +static void PSheader ARG2(char *,title, int,font) { + + static char *fontname[] = { + /* in order: regular, bold, italic */ + "Times-Roman", "Times-Bold", "Times-Italic", + "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", + "NewCenturySchlbk-Roman", "NewCenturySchlbk-Bold", + "NewCenturySchlbk-Italic", + /* this is a nasty trick, I have put Times in place of + * Lucida, becaus emost printers don't have Lucida font + */ + "Times-Roman", "Times-Bold", "Times-Italic" + /* "Lucida", "Lucida-Bold", "Lucida-Italic" */ + }; + + static char *txt[] = { + + "%%Creator: NCSA Mosaic, Postscript by Ameet Raval & Frans van Hoesel", + "%%Pages: (atend)", + "%%EndComments", + "save", + "/D {def} def /E {exch} D", + "/M {moveto} D", + "/S {show} D", + "/R {rmoveto} D", + "/L {lineto} D", + "/RL {rlineto} D", + "/SQ {newpath 0 0 M 0 1 L 1 1 L 1 0 L closepath} D", + "/U {gsave currentpoint currentfont /FontInfo get /UnderlinePosition get", + " 0 E currentfont /FontMatrix get dtransform E pop add newpath moveto", + " dup stringwidth rlineto stroke grestore S } D", + "/B {/r E D gsave -13 0 R currentpoint ", + " newpath r 0 360 arc closepath fill grestore } D", + "/OB {/r E D gsave -13 0 R currentpoint ", + " newpath r 0 360 arc closepath stroke grestore } D", + "/NP {xmargin topmargin translate scalfac dup scale } D", + "/HR {/l E D gsave l 0 RL stroke grestore } D", + "/SF {E findfont E scalefont setfont } D", + "/FF {/Courier } D", + "/FB {/Courier-Bold } D", + "/FI {/Courier-Oblique } D" + }; + + + PSprintf("%%!PS-Adobe-1.0\n"); + if (title) + { + char *tmp; + for (tmp = title; *tmp; tmp++) + if (*tmp == CR || *tmp == LF) + *tmp = ' '; + PSprintf("%%%%Title: %s\n", title); + } + PSprintf("%%%%DocumentFonts: %s %s %s Courier Courier-Bold Courier-Oblique\n", + fontname[font*3], fontname[font*3+1], fontname[font*3+2]); + PSconst_out(txt); + PSprintf("/RF {/%s} D\n", fontname[font*3]); + PSprintf("/BF {/%s} D\n", fontname[font*3+1]); + PSprintf("/IF {/%s} D\n", fontname[font*3+2]); + + PSinit_latin1(); + + PSprintf("/xmargin %d D\n", (int) LEFT_MARGIN); + PSprintf("/topmargin %d D\n", (int) TOP_MARGIN); + PSprintf("/scalfac %.5f D\n", Points_Pixel); + PSprintf("%%%%EndProlog\n"); + +} + + +/*__________________________________________________________________________ + | + | PStrailer - write postscript trailer + | +*/ + +static void PStrailer ARG0(void) { + + PSprintf("%%%%Trailer\n"); + PSprintf("restore\n"); + PSprintf("%%%%Pages: %d\n", PS_curr_page); +} + + +/*__________________________________________________________________________ + | + | PStext - output text + | + | show text "t", and protect special characters if needed + | if Underline is non-zero, the text is underlined. + | +*/ + +static void PStext ARG2(String,t, int,underline) { + String tp, t2; + int nspecial=0, nisochar=0; + + tp=t; + /* count # of special char's in text */ + while (*tp != '\0') { + if (*tp == L_PAREN || *tp == R_PAREN || *tp == B_SLASH) + nspecial++; + else if (*(unsigned char *)tp > (unsigned char )MAX_ASCII) + nisochar++; + tp++; + } + + if (nspecial == 0 && nisochar == 0) { + /* no special char's, send out original string */ + PSprintf("(%s)%c\n", t, (underline)?'U':'S'); + return; + } + /* create t2 to hold original text + "\"'s */ + t2 = (String) malloc((tp-t) + nspecial + 3*nisochar + 1); + + if (t2==NULL) { + fprintf(stderr, "PStext malloc failed\n"); + return; + } + + /* for each char in t, if it is a special char, insert "\" + * into the new string t2, then insert the actual char + */ + tp = t2; + while (*t != '\0') { + if (*t == L_PAREN || *t == R_PAREN || *t == B_SLASH) { + *(tp++) = B_SLASH; + *(tp++) = *t; + } else if (*(unsigned char *)t > (unsigned char) MAX_ASCII) { + /* convert to octal */ + *(tp++) = B_SLASH; + *(tp++) = ((int)(*(unsigned char *)t)>>6 & 007) + '0'; + *(tp++) = ((int)(*(unsigned char *)t)>>3 & 007) + '0'; + *(tp++) = ((int)(*(unsigned char *)t) & 007) + '0'; + } else { + *(tp++) = *t; + } + t++; + } + *(tp) = '\0'; + PSprintf("(%s)%c\n", t2, (underline)?'U':'S'); + + free(t2); +} + + +/*__________________________________________________________________________ + | + | PSbullet - output a bullet + | + | the bullet is normally filled, except for a bullet with an indent level + | of two. The size of the higher level bullets is just somewhat smaller + | +*/ + +static void PSbullet ARG2( int, level, int, size) { + + if (size < 6) size = 6; + + if (level <2 ) + PSprintf( " %f B\n", size/5.5); + else if (level == 2) + PSprintf( " %f OB\n", size/5.5); + else + PSprintf(" %f B\n", size/7.5); +} + +/*__________________________________________________________________________ + | + | PShrule - draw a horizontal line with the given width + | + | nothing special, just draw a line, from the current position to + | the right side of the paper. + | +*/ + +static void PShrule ARG1(int, length) { + + PSprintf("%d HR\n", length); +} + + +/*__________________________________________________________________________ + | + | PSmoveto - move to new x,y location + | + | if the Y value does not fit on the current page, begin a new page + | (I think in the current implementation, this never happens) + | +*/ + +static void PSmoveto ARG2( int,x, int,y) { + + if (y > PS_start_y + Pixels_Page) { + PS_start_y = y; + PSshowpage(); + PSnewpage(); + } + PS_offset = 0; + PSprintf( "%d %d M\n", x, -(y - PS_start_y)); +} + + +/*__________________________________________________________________________ + | + | PSmove_offset - set Y-offset + | + | do a relative vertical move, whenever the offset changes + | +*/ + +static void PSmove_offset ARG1( int, offset) { + + if (offset != PS_offset) { + PSprintf("0 %d R\n", PS_offset - offset ); + PS_offset = offset; + } +} + + +/*__________________________________________________________________________ + | + | PSrle_encode - perform run length encoding + | + | does the run-length encoding. This is done to reduce the file size and + | therefore the time to send the file to the printer. You get longer + | processing time instead. + | + | rle is encoded as such: + | <count> <value> # 'run' of count+1 equal pixels + | <count | 0x80> <count+1 data bytes> # count+1 non-equal pixels + | count can range between 0 and 127 + | + | returns length of the rleline vector + | +*/ + +static int PSrle_encode ARG3(unsigned char *, scanline, + unsigned char *,rleline, + int,wide) +{ + int i, j, blocklen, isrun, rlen; + unsigned char block[256], pix; + + blocklen = isrun = rlen = 0; + + for (i=0; i<wide; i++) { + /* there are 5 possible states: + * 0: block empty. + * 1: block is a run, current pix == previous pix + * 2: block is a run, current pix != previous pix + * 3: block not a run, current pix == previous pix + * 4: block not a run, current pix != previous pix + */ + + pix = scanline[i]; + + if (!blocklen) { + /* case 0: empty */ + block[blocklen++] = pix; + isrun = 1; + } else if (isrun) { + if (pix == block[blocklen-1]) { + /* case 1: isrun, prev==cur */ + block[blocklen++] = pix; + } else { + /* case 2: isrun, prev!=cur */ + if (blocklen>1) { + /* we have a run block to flush */ + rleline[rlen++] = blocklen-1; + rleline[rlen++] = block[0]; + /* start new run block with pix */ + block[0] = pix; + blocklen = 1; + } else { + isrun = 0; + /* blocklen<=1, turn into non-run */ + block[blocklen++] = pix; + } + } + } else { + /* not a run */ + if (pix == block[blocklen-1]) { + /* case 3: non-run, prev==cur */ + if (blocklen>1) { + /* have a non-run block to flush */ + rleline[rlen++] = (blocklen-1) | 0x80; + for (j=0; j<blocklen; j++) + rleline[rlen++] = block[j]; + /* start new run block with pix */ + block[0] = pix; + blocklen = isrun = 1; + } else { + isrun = 1; + /* blocklen<=1 turn into a run */ + block[blocklen++] = pix; + } + } else { + /* case 4: non-run, prev!=cur */ + block[blocklen++] = pix; + } + } + + if (blocklen == 128) { /* max block length. flush */ + if (isrun) { + rleline[rlen++] = blocklen-1; + rleline[rlen++] = block[0]; + } else { + rleline[rlen++] = (blocklen-1) | 0x80; + for (j=0; j<blocklen; j++) + rleline[rlen++] = block[j]; + } + blocklen = 0; + } + } + + if (blocklen) { /* flush last block */ + if (isrun) { + rleline[rlen++] = blocklen-1; + rleline[rlen++] = block[0]; + } else { + rleline[rlen++] = (blocklen-1) | 0x80; + for (j=0; j<blocklen; j++) + rleline[rlen++] = block[j]; + } + } + + return rlen; +} + + +/*__________________________________________________________________________ + | + | PScolor_image - created postscript colorimage operator + | + | spits out code that checks if the PostScript device in question + | knows about the 'colorimage' operator. If it doesn't, it defines + | 'colorimage' in terms of image (ie, generates a greyscale image from + | RGB data) + | +*/ + +static void PScolor_image ARG0(void) { + + static char *txt[] = { + + "% define 'colorimage' if it isn't defined", + "% ('colortogray' and 'mergeprocs' come from xwd2ps", + "% via xgrab)", + "/colorimage where % do we know about 'colorimage'?", + " { pop } % yes: pop off the 'dict' returned", + " { % no: define one", + " /colortogray { % define an RGB->I function", + " /rgbdata exch store % call input 'rgbdata'", + " rgbdata length 3 idiv", + " /npixls exch store", + " /rgbindx 0 store", + " /grays npixls string store % str to hold the result", + " 0 1 npixls 1 sub {", + " grays exch", + " rgbdata rgbindx get 20 mul % Red", + " rgbdata rgbindx 1 add get 32 mul % Green", + " rgbdata rgbindx 2 add get 12 mul % Blue", + " add add 64 idiv % I = .5G + .31R + .18B", + " put", + " /rgbindx rgbindx 3 add store", + " } for", + " grays", + " } bind def\n", + /* Utility procedure for colorimage operator. + * This procedure takes two procedures off the + * stack and merges them into a single procedure + */ + " /mergeprocs { % def", + " dup length", + " 3 -1 roll dup length dup 5 1 roll", + " 3 -1 roll add array cvx dup", + " 3 -1 roll 0 exch putinterval", + " dup 4 2 roll putinterval", + " } bind def\n", + " /colorimage { % def", + /* remove 'false 3' operands */ + " pop pop", + " {colortogray} mergeprocs", + " image", + " } bind def", + /* end of 'false' case */ + " } ifelse" + }; + + PSconst_out(txt); +} + +/*__________________________________________________________________________ + | + | PScolormap - write colormap + | + | spits out code for the colormap of the following image + | if !color, it spits out a mono-ized graymap + | +*/ + +static void PScolormap ARG5(int,color, + int,nc, + int *,rmap, + int *,gmap, + int *,bmap) { + + int i; + + /* define the colormap */ + PSprintf("/cmap %d string def\n\n\n", nc * ((color) ? 3 : 1)); + + /* load up the colormap */ + PSprintf("currentfile cmap readhexstring\n"); + + for (i=0; i<nc; i++) { + if (color) + PSprintf("%02x%02x%02x ", rmap[i]>>8, + gmap[i]>>8, bmap[i]>>8); + else + PSprintf("%02x ", MONO(rmap[i], gmap[i], bmap[i])); + if ((i%10) == 9) + PSprintf("\n"); + } + PSprintf("\n"); + PSprintf("pop pop\n"); /* lose return values from readhexstring */ +} + + +/*__________________________________________________________________________ + | + | PSrle_cmapimage - define rlecmapimage operator + | +*/ + +static void PSrle_cmapimage ARG1(int,color) { + + static char *txt[] = { + + /* rlecmapimage expects to have 'w h bits matrix' on stack */ + "/rlecmapimage {", + " /buffer 1 string def", + " /rgbval 3 string def", + " /block 384 string def", + " { currentfile buffer readhexstring pop", + " /bcount exch 0 get store", + " bcount 128 ge", + " { ", + " 0 1 bcount 128 sub", + " { currentfile buffer readhexstring pop pop" + }; + + static char *txt_color[] = { + " /rgbval cmap buffer 0 get 3 mul 3 getinterval store", + " block exch 3 mul rgbval putinterval", + " } for", + " block 0 bcount 127 sub 3 mul getinterval", + " }", + " { ", + " currentfile buffer readhexstring pop pop", + " /rgbval cmap buffer 0 get 3 mul 3 getinterval store", + " 0 1 bcount { block exch 3 mul rgbval putinterval } for", + " block 0 bcount 1 add 3 mul getinterval", + " } ifelse", + " }", + " false 3 colorimage", + "} bind def" + }; + + static char *txt_gray[] = { + " /rgbval cmap buffer 0 get 1 getinterval store", + " block exch rgbval putinterval", + " } for", + " block 0 bcount 127 sub getinterval", + " }", + " { ", + " currentfile buffer readhexstring pop pop", + " /rgbval cmap buffer 0 get 1 getinterval store", + " 0 1 bcount { block exch rgbval putinterval } for", + " block 0 bcount 1 add getinterval", + " } ifelse", + " }", + " image", + "} bind def" + }; + + PSconst_out(txt); + if (color) { + PSconst_out(txt_color); + } else { + PSconst_out(txt_gray); + } +} + + +/*__________________________________________________________________________ + | + | PSwrite_bw - write B&W image + | + | Write the given image array 'pic' (B/W stippled, 1 byte per pixel, + | 0=blk,1=wht) out as hexadecimal, max of 72 hex chars per line. If + | 'flipbw', then 0=white, 1=black. Returns '0' if everythings fine, + | 'EOF' if writing failed. + | +*/ + +static int PSwrite_bw ARG4(unsigned char *,pic, int,w, int,h, int,flipbw) { + + int i, j; + int err=0; + unsigned char outbyte, bitnum, bit; + + outbyte = bitnum = 0; + for (i=0; i<h && err != EOF; i++) { + for (j=0; j<w && err != EOF; j++) { + bit = *(pic++); + outbyte = (outbyte<<1) | ((bit)&0x01); + bitnum++; + + if (bitnum==8) { + if (flipbw) + outbyte = ~outbyte & 0xff; + err=PShex(outbyte, False); + outbyte = bitnum = 0; + } + } + if (bitnum) { /* few bits left over in this row */ + outbyte <<= 8-bitnum; + if (flipbw) + outbyte = ~outbyte & 0xff; + err=PShex(outbyte, False); + outbyte = bitnum = 0; + } + } + err=PShex('\0', True); /* Flush the hex buffer if needed */ + + return err; +} + + +/*__________________________________________________________________________ + | + | PSimage - generate image Postscript code + | + | Draw the image, unless there was no image, in which case an empty grey + | rectangle is shown. + | If anchor is set, a black border is shown around the image. + | Positioning is not exactly that of Xmosaic's screen, but close enough. + | +*/ + +static void PSimage ARG2( ImageInfo *,img , int, anchor) { + + int ncolors = img->num_colors; + int i, j; + int w = img->width; + int h = img->height; + unsigned char *imgp; + int slen, colorps, colortype, bits; + int err=0; + int extra = 0; + + imgp = img->image_data; + + /* Isgray returns true if the nth color index is a gray value */ +# define Isgray(i,n) (i->reds[n]==i->greens[n] && i->reds[n]==i->blues[n]) + /* Is_bg returns true if the nth color index is the screen background */ +# define Is_bg(i,n) (i->reds[n]==bg_color.red && \ + i->greens[n]==bg_color.green && i->blues[n]==bg_color.blue) + /* Is_fg returns true if the nth color index is the screen foreground */ +# define Is_fg(i,n) (i->reds[n]==fg_color.red && \ + i->greens[n]==fg_color.green && i->blues[n]==fg_color.blue) + + + if (anchor) { + /* draw an outline by drawing a slightly larger black square + * below the actual image + */ + PSprintf("gsave currentpoint %d sub translate ", h); + PSprintf("0 -2 translate %d %d scale\n", w+4, h+4); + PSprintf("SQ fill\n"); + PSprintf("grestore\n"); + extra = 4; + } + + if (imgp == NULL) { + /* image was not available... do something instead + * draw an empty square for example + */ + PSprintf("gsave currentpoint %d sub translate", h); + if (anchor) + PSprintf(" 2 0 translate"); + else + PSprintf(" 0 2 translate"); + PSprintf(" %d %d scale\n", w, h); + PSprintf("0.9 setgray SQ fill\n"); + PSprintf("grestore\n"); + /* move currentpoint just right of image */ + PSprintf("%d 0 R\n", w+extra); + return; + } + + /* this is a hack to see if the image is Black & White, + * Greyscale or 8 bit color + * assume it's bw if it has only one or two colors, both some grey's + * assume it's greyscale if all the colors (>2) are grey + * Images with only one color do occur too. + */ + + if ((ncolors == 2 && ( (Isgray(img,0) && Isgray(img,1)) || + (Is_bg(img,0) && Is_fg(img,1)) || + (Is_fg(img,0) && Is_bg(img,1)) )) || + ncolors == 1 && (Isgray(img,0) || Is_bg(img,0) || + Is_fg(img,0))) { + colortype = F_BWDITHER; + slen = (w+7)/8; + bits = 1; + colorps = 0; + } else { + colortype = F_GREYSCALE; + slen = w; + bits = 8; + colorps = 0; + for (i=0; i<ncolors; i++) { + if (!Isgray(img,i)) { + colortype = F_REDUCED; + slen = w*3; + bits = 8; + colorps = 1; + break; + } + } + } + + /* build a temporary dictionary */ + PSprintf("20 dict begin\n\n"); + + /* define string to hold a scanline's worth of data */ + PSprintf("/pix %d string def\n\n", slen); + + /* position and scaling */ + PSprintf("gsave currentpoint %d sub translate", h); + if (anchor) + PSprintf(" 2 0 translate"); + else + PSprintf(" 0 2 translate"); + PSprintf(" %d %d scale\n", w, h); + + if (colortype == F_BWDITHER) { + /* 1-bit dither code uses 'image' */ + int flipbw = 0; + + /* set if color#0 is 'white' */ + if ((ncolors == 2 && + MONO(img->reds[0], img->greens[0],img->blues[0]) > + MONO(img->reds[1], img->greens[1], img->blues[1])) || + (ncolors == 1 && + MONO(img->reds[0], img->greens[0],img->blues[0]) > + MONO(127, 127, 127) )) { + flipbw=1; + } + + /* dimensions of data */ + PSprintf("%d %d %d\n", w, h, bits); + + /* mapping matrix */ + PSprintf("[%d 0 0 %d 0 %d]\n\n", w, -h, h); + + PSprintf("{currentfile pix readhexstring pop}\n"); + PSprintf("image\n"); + + /* write the actual image data */ + err = PSwrite_bw(imgp, w, h, flipbw); + } else { + /* all other formats */ + unsigned char *rleline = (unsigned char *) NULL; + int rlen; + + /* if we're using color, make sure 'colorimage' is defined */ + if (colorps) + PScolor_image(); + + PScolormap(colorps, ncolors, img->reds, img->greens, img->blues); + PSrle_cmapimage(colorps); + + /* dimensions of data */ + PSprintf("%d %d %d\n", w, h, bits); + /* mapping matrix */ + PSprintf("[%d 0 0 %d 0 %d]\n", w, -h, h); + PSprintf("rlecmapimage\n"); + + rleline = (unsigned char *) malloc(w * 2); + if (!rleline) { + fprintf(stderr,"failed to malloc space for rleline\n"); + return; + } + + for (i=0; i<h && err != EOF; i++) { + rlen = PSrle_encode(imgp, rleline, w); + imgp += w; + for (j=0; j<rlen && err != EOF; j++) + err=PShex(rleline[j], False); + err=PShex('\0', True); /* Flush the hex buffer */ + } + free(rleline); + } + + /* stop using temporary dictionary */ + PSprintf("end\n"); + PSprintf("grestore\n"); + + /* move currentpoint just right of image */ + PSprintf("%d 0 R\n", w + extra); + + /* forget about the macro's */ +# undef Isgray +# undef Is_fg +# undef Is_bg +} + +/*__________________________________________________________________________ + | + | ParseTextToPSString - entry point for postscript output + | + | Parse all the formatted text elements from start to end + | into an ascii text string, and return it. + | Very like ParseTextToString() except the text is prettied up + | into Postscript to show headers and the like. + | space_width and lmargin tell us how many spaces + | to indent lines. + | Because this routine is only used to print whole documents, + | some parameters are not needed at all! + | Also it assumes that you are indeed printing the whole document, and + | not just a selected portion of it. It therefore can assume that + | only for the first page the initialization is needed, and only + | the last page has the trailers. You cannot use ParseTextToPSString() + | as you can use ParseTextToString() because of this initialization code. + | +*/ + +String ParseTextToPSString(hw, elist, startp, endp, start_pos, end_pos, + space_width, lmargin, fontfamily) + HTMLWidget hw; + struct ele_rec *elist; + struct ele_rec *startp; + struct ele_rec *endp; + int start_pos, end_pos; + int space_width; + int lmargin; + int fontfamily; + { + + /* the fontfamily parameter is new + * The font is encoded as: + * 0: times (default for now) + * 1: helvetica + * 2: new century schoolbook + * 3: lucida + */ + + int xpos, ypos, epos; + int height; + int pagewidth; + int line = -1; + struct ele_rec *eptr; + struct ele_rec *start; + struct ele_rec *end; + struct ele_rec *last; + struct ele_rec *tmpptr; + + if (startp == NULL) + return(NULL); + + + /* + * Get the foreground and background colors so we can check later + * for black&white documents + */ + { + unsigned long fg_pixel, bg_pixel; + + + XtVaGetValues (hw->html.view, +#ifdef MOTIF + XtNforeground, &fg_pixel, +#endif + XtNbackground, &bg_pixel, + NULL); +#ifndef MOTIF + XtVaGetValues ((Widget)hw, + XtNforeground, &fg_pixel, + NULL); +#endif + fg_color.pixel = fg_pixel; + bg_color.pixel = bg_pixel; + XQueryColor (XtDisplay (hw->html.view), + DefaultColormap (XtDisplay (hw->html.view), + DefaultScreen (XtDisplay (hw->html.view))), + &fg_color); + XQueryColor (XtDisplay (hw->html.view), + DefaultColormap (XtDisplay (hw->html.view), + DefaultScreen (XtDisplay (hw->html.view))), + &bg_color); + } + + /* this piece of code is needed if the user selects a portion + * of the document with the mouse. + * I think it will never be used, but I left it in anyway. F. + */ + if (SwapElements(startp, endp, start_pos, end_pos)) { + start = endp; + end = startp; + epos = start_pos; + start_pos = end_pos; + end_pos = epos; + } else { + start = startp; + end = endp; + } + + /* Calculate the number of Postscript points per pixel of current + * screen, and the height of the page in pixels (used in figuring + * when we've hit the bottom of the page). + */ + Points_Pixel = 72.0 / GetDpi(hw); +#ifdef OLD + pagewidth = hw->html.doc_width; +#else /* gustaf fix */ + pagewidth = hw->html.view_width; /* seems more reasonable */ +#endif /* gustaf fix */ + + /* reduce the scaling if the width used for formatting is greater + * than 8 * 72 pixels (8 inch) + * In theory, this is not what you want for A4 paper (only 8.27 inch + * wide), but I guess that the hw->html.doc_width includes some + * left and right margins, so it seems to work in practice. + */ + if (pagewidth > PAGE_WIDTH) + Points_Pixel = Points_Pixel * (float) PAGE_WIDTH / pagewidth; + Pixels_Page = (int) (PAGE_HEIGHT / Points_Pixel); + + + PSinit(); + PSheader(hw->html.title, fontfamily); + PSnewpage(); + + last = start; + eptr = start; + + while ((eptr != NULL) && (eptr != end)) { + /* Skip the special internal text added for multi-page + * documents. + */ + if (eptr->internal == True) { + if (eptr->type == E_LINEFEED) { + PS_page_offset += eptr->line_height; + } + eptr = eptr->next; + continue; + } + /* check if this is a newline */ + if (line != eptr->line_number) { + /* calculate max height */ + height = 0; + line = eptr->line_number; + tmpptr = eptr; + while (tmpptr != NULL && tmpptr->line_number == line) { + if (tmpptr->line_height > height) + height = tmpptr->line_height; + tmpptr = tmpptr->next; + } + ypos = eptr->y - PS_page_offset ; + xpos = eptr->x - lmargin; + if (xpos < 0) + xpos = 0; + + /* check if line fits completly on page */ + if (ypos + height > PS_start_y + Pixels_Page) { + PS_start_y = ypos; + PSshowpage(); + PSnewpage(); + } + PSmoveto( xpos, ypos); + } + + switch(eptr->type) { + + case E_TEXT: { + String tptr; + int ascent; + + if (eptr == start) + tptr = (String)(eptr->edata + start_pos); + else + tptr = (String)eptr->edata; + + PSfont(hw, eptr->font, fontfamily); /* set font */ + if (PS_fontascent == 0) + ascent = eptr->font->ascent; + else + ascent = PS_fontascent; + PSmove_offset(eptr->y_offset + ascent); + PStext(tptr, eptr->underline_number); /* insert text */ + break; + } + + case E_BULLET: { + int width; + int offset; + + PSfont(hw, eptr->font, fontfamily); + width = eptr->font->max_bounds.lbearing + + eptr->font->max_bounds.rbearing; + /* the next line is a hack to get a good position of the + * bullet in most practical cases, otherwise the + * bullet may appear just a bit too low (for large fonts) + * What is does is to compare the lineheight with + * the lineheight of the next element, to correct + * for the possibly too large y_offset + */ + if (eptr->next != NULL && (eptr->next->type == E_TEXT + || eptr->next->type == E_IMAGE)) + offset = eptr->line_height - + eptr->next->line_height + + eptr->y_offset + + eptr->next->font->ascent; + else + offset = eptr->y_offset + eptr->font->ascent; + + PSmove_offset(offset - width/4); + PSbullet(eptr->indent_level, eptr->line_height); + break; + } + + case E_IMAGE: { + + PSmove_offset(eptr->y_offset); + PSimage(eptr->pic_data ,(eptr->anchorHRef != NULL)); + break; + } + + case E_LINEFEED: { + break; + } + case E_HRULE: { + PSmove_offset(eptr->y_offset); + PShrule(hw->html.doc_width); + break; + } + } + last = eptr; + eptr = eptr->next; + } + + PSshowpage(); + PStrailer(); + + return( PS_string); +} + diff --git a/vendor/x11iraf/obm/ObmW/HTML.c b/vendor/x11iraf/obm/ObmW/HTML.c new file mode 100644 index 00000000..546bfbc0 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTML.c @@ -0,0 +1,6177 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#include <stdio.h> +#include "HTMLP.h" +#ifdef MOTIF +#include <Xm/DrawingA.h> +#include <Xm/ScrollBar.h> +#else +#include "DrawingArea.h" +#include <X11/Xaw/Scrollbar.h> +#endif +#include <X11/cursorfont.h> + + +#define MARGIN_DEFAULT 20 +#define CLICK_TIME 500 +#define SELECT_THRESHOLD 3 +#define MAX_UNDERLINES 3 +#define DEFAULT_INCREMENT 18 + +#ifndef ABS +#define ABS(x) (((x) > 0) ? (x) : ((x) * -1)) +#endif + +#define W_TEXTFIELD 0 +#define W_CHECKBOX 1 +#define W_RADIOBOX 2 +#define W_PUSHBUTTON 3 +#define W_PASSWORD 4 +#define W_OPTIONMENU 5 + + +extern int FormatAll(); +extern int DocumentWidth(); +extern void PlaceLine(); +extern void TextRefresh(); +extern void ImageRefresh(); +extern void LinefeedRefresh(); +extern void RefreshTextRange(); +extern void FreeColors(); +extern void FreeImages(); +extern void HideWidgets(); +extern void MapWidgets(); +extern int SwapElements(); +extern int ElementLessThan(); +extern int IsDelayedHRef(); +extern int IsIsMapForm(); +extern int AnchoredHeight(); +extern char *ParseMarkTag(); +extern char *ParseTextToString(); +extern char *ParseTextToPrettyString(); +extern char *ParseTextToPSString(); +extern struct mark_up *HTMLParse(); +extern struct ele_rec *LocateElement(); +extern struct ele_rec **MakeLineList(); +extern void FreeHRefs(); +extern struct ref_rec *AddHRef(); +extern void FreeDelayedImages(); +extern struct delay_rec *AddDelayedImage(); +extern ImageInfo *NoImageData(); +extern void ImageSubmitForm(); + + +static void SelectStart(); +static void ExtendStart(); +static void ExtendAdjust(); +static void ExtendEnd(); +static void TrackMotion(); +static Boolean ConvertSelection(); +static void LoseSelection(); +static void SelectionDone(); +static void Scroll(); + + +#ifdef _NO_PROTO + +static void _HTMLInput() ; +#ifndef MOTIF +static void _HTMLpwdInput() ; +#endif +static void Initialize() ; +static void Realize() ; +static void Redisplay() ; +static void Resize() ; +static Boolean SetValues() ; +static XtGeometryResult GeometryManager() ; +static void RecolorInternalHRefs() ; +static Dimension VbarWidth(); +static Dimension HbarHeight(); +static void ViewRedisplay(); +static void ViewClearAndRefresh(); +static void CallLinkCallbacks(); + +#else /* _NO_PROTO */ + +static void _HTMLInput(Widget w, XEvent *event, + String *params, Cardinal *num_params); +#ifndef MOTIF +static void _HTMLpwdInput(Widget w, XEvent *event, + String *params, Cardinal *num_params); +#endif +static void Initialize(HTMLWidget request, HTMLWidget new); +static void Realize(HTMLWidget hw, Mask *valueMask, + XSetWindowAttributes *attributes); +static void Redisplay(HTMLWidget hw, XEvent *event, Region region); +static void Resize(HTMLWidget hw); +static Boolean SetValues(HTMLWidget current, HTMLWidget request, + HTMLWidget new); +static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *request, + XtWidgetGeometry *reply); +static void RecolorInternalHRefs(HTMLWidget hw, char *href); +static Dimension VbarWidth(HTMLWidget hw); +static Dimension HbarHeight(HTMLWidget hw); +static void ViewRedisplay(HTMLWidget hw, int x, int y, + int width, int height); +static void ViewClearAndRefresh(HTMLWidget hw); +static void CallLinkCallbacks(HTMLWidget hw); +#endif /* _NO_PROTO */ + + +/* + * Default translations + * Selection of text, and activate anchors. + * If motif, add manager translations. + */ +#ifdef MOTIF +static char defaultTranslations[] = +" \ +<Btn1Down>: select-start() ManagerGadgetArm()\n\ +<Btn1Motion>: extend-adjust() ManagerGadgetButtonMotion()\n\ +<Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) ManagerGadgetActivate()\n\ +<Btn2Down>: select-start()\n\ +<Btn2Motion>: extend-adjust()\n\ +<Btn2Up>: extend-end(PRIMARY, CUT_BUFFER0)\n\ +<Btn3Down>: extend-start()\n\ +<Btn3Motion>: extend-adjust()\n\ +<Btn3Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\ +<Key>f: scroll(1)\n\ +<Key>b: scroll(-1)\n\ +<Key>Prior: scroll(-1)\n\ +<Key>Next: scroll(1)\n\ +<Key>u: scroll(-0.5)\n\ +<Key>d: scroll(0.5)\n\ +<Key>Up: scroll(-0.5)\n\ +<Key>Down: scroll(0.5)\n\ +<Key>j: scroll(1ch)\n\ +<Key>k: scroll(-1ch)\n\ +<Motion>: track-motion()\n\ +<Leave>: track-motion()\n\ +<FocusOut>: track-motion()\n\ +<Expose>: track-motion()\ +"; +#else +static char defaultTranslations[] = +" \ +<Btn1Down>: select-start() \n\ +<Btn1Motion>: extend-adjust() \n\ +<Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\ +<Btn2Down>: select-start() \n\ +<Btn2Motion>: extend-adjust() \n\ +<Btn2Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\ +<Btn3Down>: extend-start()\n\ +<Btn3Motion>: extend-adjust()\n\ +<Btn3Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\ +<Key>f: scroll(1)\n\ +<Key>b: scroll(-1)\n\ +<Key>Prior: scroll(-1)\n\ +<Key>Next: scroll(1)\n\ +<Key>u: scroll(-0.5)\n\ +<Key>d: scroll(0.5)\n\ +<Key>Up: scroll(-0.5)\n\ +<Key>Down: scroll(0.5)\n\ +<Key>j: scroll(1ch)\n\ +<Key>k: scroll(-1ch)\n\ +<Motion>: track-motion()\n\ +<Leave>: track-motion()\n\ +<FocusOut>: track-motion()\n\ +<Expose>: track-motion()\ +"; +#endif /* MOTIF */ + + +static XtActionsRec actionsList[] = +{ + { "select-start", (XtActionProc) SelectStart }, + { "extend-start", (XtActionProc) ExtendStart }, + { "extend-adjust", (XtActionProc) ExtendAdjust }, + { "extend-end", (XtActionProc) ExtendEnd }, + { "track-motion", (XtActionProc) TrackMotion }, + { "scroll", (XtActionProc) Scroll }, + { "HTMLInput", (XtActionProc) _HTMLInput }, +#ifndef MOTIF + { "HTMLpwdInput", (XtActionProc) _HTMLpwdInput }, +#endif + +#ifdef MOTIF +#ifndef MOTIF1_2 + { "Arm", (XtActionProc) _XmGadgetArm }, /* Motif 1.0 */ + { "Activate", (XtActionProc) _XmGadgetActivate }, /* Motif 1.0 */ + { "Enter", (XtActionProc) _XmManagerEnter }, /* Motif 1.0 */ + { "FocusIn", (XtActionProc) _XmManagerFocusIn }, /* Motif 1.0 */ + { "Help", (XtActionProc) _XmManagerHelp }, /* Motif 1.0 */ +#endif /* not MOTIF1_2 */ +#endif /* MOTIF */ +}; + +/* + * For some reason, in Motif1.2/X11R5 the actionsList above gets corrupted + * When the parent HTML widget is created. This means we can't use + * it later with XtAppAddActions to add to the viewing area. + * So, we make a spare copy here to use with XtAppAddActions. + */ +static XtActionsRec SpareActionsList[] = +{ + { "select-start", (XtActionProc) SelectStart }, + { "extend-start", (XtActionProc) ExtendStart }, + { "extend-adjust", (XtActionProc) ExtendAdjust }, + { "extend-end", (XtActionProc) ExtendEnd }, + { "track-motion", (XtActionProc) TrackMotion }, + { "scroll", (XtActionProc) Scroll }, + { "HTMLInput", (XtActionProc) _HTMLInput }, +#ifndef MOTIF + { "HTMLpwdInput", (XtActionProc) _HTMLpwdInput }, +#endif +}; + + + +/* + * Resource definitions for HTML widget + */ + +static XtResource resources[] = +{ + /* Without Motif we need to override the borderWidth to 0 (from 1). */ +#ifndef MOTIF + { XtNborderWidth, + XtCBorderWidth, XtRDimension, sizeof (Dimension), + XtOffset (HTMLWidget, core.border_width), + XtRImmediate, (XtPointer) 0 + }, +#endif + + { WbNmarginWidth, + WbCMarginWidth, XtRDimension, sizeof (Dimension), + XtOffset (HTMLWidget, html.margin_width), + XtRImmediate, (caddr_t) MARGIN_DEFAULT + }, + + { WbNmarginHeight, + WbCMarginHeight, XtRDimension, sizeof (Dimension), + XtOffset (HTMLWidget, html.margin_height), + XtRImmediate, (caddr_t) MARGIN_DEFAULT + }, + + { WbNanchorCallback, + XtCCallback, XtRCallback, sizeof (XtCallbackList), + XtOffset (HTMLWidget, html.anchor_callback), + XtRImmediate, (caddr_t) NULL + }, + + { WbNlinkCallback, + XtCCallback, XtRCallback, sizeof (XtCallbackList), + XtOffset (HTMLWidget, html.link_callback), + XtRImmediate, (caddr_t) NULL + }, + + { WbNsubmitFormCallback, + XtCCallback, XtRCallback, sizeof (XtCallbackList), + XtOffset (HTMLWidget, html.form_callback), + XtRImmediate, (caddr_t) NULL + }, + + { WbNtext, + WbCText, XtRString, sizeof (char *), + XtOffset (HTMLWidget, html.raw_text), + XtRString, (char *) NULL + }, + + { WbNheaderText, + WbCHeaderText, XtRString, sizeof (char *), + XtOffset (HTMLWidget, html.header_text), + XtRString, (char *) NULL + }, + + { WbNfooterText, + WbCFooterText, XtRString, sizeof (char *), + XtOffset (HTMLWidget, html.footer_text), + XtRString, (char *) NULL + }, + + { WbNtitleText, + WbCTitleText, XtRString, sizeof (char *), + XtOffset (HTMLWidget, html.title), + XtRString, (char *) NULL + }, + +/* + * Without motif we need our own foreground resource instead of + * using the manager's + */ +#ifndef MOTIF + { XtNforeground, + XtCForeground, XtRPixel, sizeof (Pixel), + XtOffset (HTMLWidget, html.foreground), + XtRString, "Black" + }, +#endif + + { WbNanchorUnderlines, + WbCAnchorUnderlines, XtRInt, sizeof (int), + XtOffset (HTMLWidget, html.num_anchor_underlines), + XtRString, "0" + }, + + { WbNvisitedAnchorUnderlines, + WbCVisitedAnchorUnderlines, XtRInt, sizeof (int), + XtOffset (HTMLWidget, html.num_visitedAnchor_underlines), + XtRString, "0" + }, + + { WbNdashedAnchorUnderlines, + WbCDashedAnchorUnderlines, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.dashed_anchor_lines), + XtRString, "False" + }, + + { WbNdashedVisitedAnchorUnderlines, + WbCDashedVisitedAnchorUnderlines, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.dashed_visitedAnchor_lines), + XtRString, "False" + }, + + { WbNanchorColor, + XtCForeground, XtRPixel, sizeof (Pixel), + XtOffset (HTMLWidget, html.anchor_fg), + XtRString, "blue2" + }, + + { WbNvisitedAnchorColor, + XtCForeground, XtRPixel, sizeof (Pixel), + XtOffset (HTMLWidget, html.visitedAnchor_fg), + XtRString, "purple4" + }, + + { WbNactiveAnchorFG, + XtCBackground, XtRPixel, sizeof (Pixel), + XtOffset (HTMLWidget, html.activeAnchor_fg), + XtRString, "Red" + }, + + { WbNactiveAnchorBG, + XtCForeground, XtRPixel, sizeof (Pixel), + XtOffset (HTMLWidget, html.activeAnchor_bg), + XtRString, "White" + }, + + { WbNpercentVerticalSpace, + WbCPercentVerticalSpace, XtRInt, sizeof (int), + XtOffset (HTMLWidget, html.percent_vert_space), + XtRString, "90" + }, + + { WbNimageBorders, + WbCImageBorders, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.border_images), + XtRString, "False" + }, + + { WbNdelayImageLoads, + WbCDelayImageLoads, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.delay_images), + XtRString, "False" + }, + + { WbNfancySelections, + WbCFancySelections, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.fancy_selections), + XtRString, "False" + }, + + { WbNisIndex, + WbCIsIndex, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.is_index), + XtRString, "False" + }, + + { WbNview, + WbCView, XtRWidget, sizeof (Widget), + XtOffset (HTMLWidget, html.view), + XtRImmediate, NULL + }, + + { WbNverticalScrollBar, + WbCVerticalScrollBar, XtRWidget, sizeof (Widget), + XtOffset (HTMLWidget, html.vbar), + XtRImmediate, NULL + }, + + { WbNhorizontalScrollBar, + WbCHorizontalScrollBar, XtRWidget, sizeof (Widget), + XtOffset (HTMLWidget, html.hbar), + XtRImmediate, NULL + }, + + { WbNverticalScrollOnRight, + WbCVerticalScrollOnRight, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.vbar_right), + XtRString, "True" + }, + + { WbNhorizontalScrollOnTop, + WbCHorizontalScrollOnTop, XtRBoolean, sizeof (Boolean), + XtOffset (HTMLWidget, html.hbar_top), + XtRString, "False" + }, + + { XtNfont, + XtCFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.font), + XtRString, "-adobe-times-medium-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNitalicFont, + WbCItalicFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.italic_font), + XtRString, "-adobe-times-medium-i-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNboldFont, + WbCBoldFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.bold_font), + XtRString, "-adobe-times-bold-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNfixedFont, + WbCFixedFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.fixed_font), + XtRString, "-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNfixedboldFont, + WbCFixedboldFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.fixedbold_font), + XtRString, "-adobe-courier-bold-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNfixeditalicFont, + WbCFixeditalicFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.fixeditalic_font), + XtRString, "-adobe-courier-medium-o-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNheader1Font, + WbCHeader1Font, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.header1_font), + XtRString, "-adobe-times-bold-r-normal-*-24-*-*-*-*-*-*-*" + }, + + { WbNheader2Font, + WbCHeader2Font, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.header2_font), + XtRString, "-adobe-times-bold-r-normal-*-18-*-*-*-*-*-*-*" + }, + + { WbNheader3Font, + WbCHeader3Font, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.header3_font), + XtRString, "-adobe-times-bold-r-normal-*-17-*-*-*-*-*-*-*" + }, + + { WbNheader4Font, + WbCHeader4Font, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.header4_font), + XtRString, "-adobe-times-bold-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNheader5Font, + WbCHeader5Font, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.header5_font), + XtRString, "-adobe-times-bold-r-normal-*-12-*-*-*-*-*-*-*" + }, + + { WbNheader6Font, + WbCHeader6Font, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.header6_font), + XtRString, "-adobe-times-bold-r-normal-*-10-*-*-*-*-*-*-*" + }, + + { WbNaddressFont, + WbCAddressFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.address_font), + XtRString, "-adobe-times-medium-i-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNplainFont, + WbCPlainFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.plain_font), + XtRString, "-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNplainboldFont, + WbCPlainboldFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.plainbold_font), + XtRString, "-adobe-courier-bold-r-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNplainitalicFont, + WbCPlainitalicFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.plainitalic_font), + XtRString, "-adobe-courier-medium-o-normal-*-14-*-*-*-*-*-*-*" + }, + + { WbNlistingFont, + WbCListingFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffset (HTMLWidget, html.listing_font), + XtRString, "-adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-*" + }, + + { WbNpreviouslyVisitedTestFunction, + WbCPreviouslyVisitedTestFunction, XtRPointer, + sizeof (XtPointer), + XtOffset (HTMLWidget, html.previously_visited_test), + XtRImmediate, (caddr_t) NULL + }, + + { WbNpreviouslyVisitedTestData, + WbCPreviouslyVisitedTestData, XtRPointer, + sizeof (XtPointer), + XtOffset (HTMLWidget, html.vt_client_data), + XtRImmediate, (caddr_t) NULL + }, + + { WbNresolveImageFunction, + WbCResolveImageFunction, XtRPointer, + sizeof (XtPointer), + XtOffset (HTMLWidget, html.resolveImage), + XtRImmediate, (caddr_t) NULL + }, + + { WbNresolveDelayedImage, + WbCResolveDelayedImage, XtRPointer, + sizeof (XtPointer), + XtOffset (HTMLWidget, html.resolveDelayedImage), + XtRImmediate, (caddr_t) NULL + }, + + { + WbNpointerMotionCallback, + WbCPointerMotionCallback, XtRPointer, + sizeof (XtPointer), + XtOffset (HTMLWidget, html.pointer_motion_callback), + XtRImmediate, (caddr_t) NULL + }, + + { WbNpointerMotionData, + WbCPointerMotionData, XtRPointer, + sizeof (XtPointer), + XtOffset (HTMLWidget, html.pm_client_data), + XtRImmediate, (caddr_t) NULL + }, + +}; + + + +HTMLClassRec htmlClassRec = { + { /* core class fields */ +#ifdef MOTIF + (WidgetClass) &xmManagerClassRec, /* superclass */ +#else + (WidgetClass) &constraintClassRec, /* superclass */ +#endif /* MOTIF */ + "HTML", /* class_name */ + sizeof(HTMLRec), /* widget_size */ + NULL, /* class_initialize */ + NULL, /* class_part_init */ + FALSE, /* class_inited */ + (XtInitProc) Initialize, /* initialize */ + NULL, /* initialize_hook */ + (XtRealizeProc) Realize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + FALSE, /* compress_exposure */ + TRUE, /* compress_enterlv */ + FALSE, /* visible_interest */ + NULL, /* destroy */ + (XtWidgetProc) Resize, /* resize */ + (XtExposeProc) Redisplay, /* expose */ + (XtSetValuesFunc) SetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator*/ + NULL, /* extension */ + }, + + { /* composite_class fields */ + (XtGeometryHandler) GeometryManager, /* geometry_manager */ + NULL, /* change_managed */ + XtInheritInsertChild, /* insert_child */ + XtInheritDeleteChild, /* delete_child */ + NULL, /* extension */ + }, + + { /* constraint_class fields */ + NULL, /* resource list */ + 0, /* num resources */ + 0, /* constraint size */ + NULL, /* init proc */ + NULL, /* destroy proc */ + NULL, /* set values proc */ + NULL, /* extension */ + }, + +#ifdef MOTIF + { /* manager_class fields */ + XtInheritTranslations, /* translations */ + NULL, /* syn_resources */ + 0, /* num_syn_resources */ + NULL, /* syn_cont_resources */ + 0, /* num_syn_cont_resources */ + XmInheritParentProcess, /* parent_process */ + NULL, /* extension */ + }, +#endif /* MOTIF */ + + { /* html_class fields */ + 0 /* none */ + } +}; + +WidgetClass htmlWidgetClass = (WidgetClass)&htmlClassRec; + +/*static Cursor in_anchor_cursor = (Cursor)NULL;*/ /* MF021 */ +Cursor in_anchor_cursor = (Cursor)NULL; + + +/* + * Process an expose event in the View (or drawing area). This + * Can be a regular expose event, or perhaps a GraphicsExpose Event. + */ +static void +DrawExpose(w, data, event) + Widget w; + caddr_t data; + XEvent *event; +{ + XExposeEvent *ExEvent = (XExposeEvent *)event; + HTMLWidget hw = (HTMLWidget)data; + int x, y; + int width, height; + + if ((event->xany.type != Expose)&&(event->xany.type != GraphicsExpose)) + { + return; + } + + /* + * Make sure we have a valid GC to draw with. + */ + if (hw->html.drawGC == NULL) + { + unsigned long valuemask; + XGCValues values; + + values.function = GXcopy; + values.plane_mask = AllPlanes; +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + values.foreground = hw->manager.foreground; +#else + values.foreground = hw->html.foreground; +#endif /* MOTIF */ + values.background = hw->core.background_pixel; + + valuemask = GCFunction|GCPlaneMask|GCForeground|GCBackground; + + hw->html.drawGC = XCreateGC(XtDisplay(hw), XtWindow(hw), + valuemask, &values); + } + + x = ExEvent->x; + y = ExEvent->y; + width = (int)ExEvent->width; + height = (int)ExEvent->height; + +#ifdef DEBUG +DebugHook(x, y, width, height); +#endif + + ViewRedisplay(hw, x, y, width, height); +} + + +void +ScrollWidgets(hw) + HTMLWidget hw; +{ + WidgetInfo *wptr; + int xval, yval; + + xval = hw->html.scroll_x; + yval = hw->html.scroll_y; + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->w != NULL) + { + Widget w; + int x, y; + + w = wptr->w; + x = wptr->x; + y = wptr->y; + XtMoveWidget(w, (x - xval), (y - yval)); + } + wptr = wptr->next; + } +} + + +#ifndef MOTIF +/* + * Set the Athena Scrollbar's thumb position properly. + */ +static void +setScrollBar(sb, topPosition, totalLength, currentLength) + Widget sb; + int topPosition; /* MF026 */ + int totalLength, currentLength; /* MF026 */ +{ + float top = (float)topPosition /(float)(totalLength); + float shown = (float)currentLength/(float)(totalLength); + + XawScrollbarSetThumb(sb, top, shown); +} +#endif + + +/* + * Either the vertical or hortizontal scrollbar has been moved + */ +void +ScrollToPos(w, hw, value) + Widget w; + HTMLWidget hw; + int value; +{ + /* + * Special code incase the scrollbar is "moved" before we have a window + * (if we have a GC we have a window) + */ + if (hw->html.drawGC == NULL) + { + if (w == hw->html.vbar) + { + hw->html.scroll_y = value; + } + else if (w == hw->html.hbar) + { + hw->html.scroll_x = value; + } + return; + } + + /* + * get our widgets out of the way (No Expose events) + HideWidgets(hw); + */ + + /* + * If we've moved the vertical scrollbar + */ + if (w == hw->html.vbar) + { + /* + * We've scrolled down. Copy up the untouched part of the + * window. Then Clear and redraw the new area + * exposed. + */ + if (value > hw->html.scroll_y) + { + int dy; + + dy = value - hw->html.scroll_y; + if (dy > hw->html.view_height) + { + hw->html.scroll_y = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, 0, + hw->html.view_width, + hw->html.view_height, False); + ViewRedisplay(hw, + 0, 0, + hw->html.view_width, + hw->html.view_height); + } + else + { + XCopyArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + XtWindow(hw->html.view), + hw->html.drawGC, 0, dy, + hw->html.view_width, + hw->html.view_height - dy, + 0, 0); + hw->html.scroll_y = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, (int)hw->html.view_height - dy, + hw->html.view_width, dy, False); + ViewRedisplay(hw, + 0, (int)hw->html.view_height - dy, + hw->html.view_width, dy); + } + } + /* + * We've scrolled up. Copy down the untouched part of the + * window. Then Clear and redraw the new area + * exposed. + */ + else if (value < hw->html.scroll_y) + { + int dy; + + dy = hw->html.scroll_y - value; + if (dy > hw->html.view_height) + { + hw->html.scroll_y = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, 0, + hw->html.view_width, + hw->html.view_height, False); + ViewRedisplay(hw, + 0, 0, + hw->html.view_width, + hw->html.view_height); + } + else + { + XCopyArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + XtWindow(hw->html.view), + hw->html.drawGC, 0, 0, + hw->html.view_width, + hw->html.view_height - dy, + 0, dy); + hw->html.scroll_y = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, 0, + hw->html.view_width, dy, False); + ViewRedisplay(hw, + 0, 0, + hw->html.view_width, dy); + } + } + } + /* + * Else we've moved the horizontal scrollbar + */ + else if (w == hw->html.hbar) + { + /* + * We've scrolled right. Copy left the untouched part of the + * window. Then Clear and redraw the new area + * exposed. + */ + if (value > hw->html.scroll_x) + { + int dx; + + dx = value - hw->html.scroll_x; + if (dx > hw->html.view_width) + { + hw->html.scroll_x = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, 0, + hw->html.view_width, + hw->html.view_height, False); + ViewRedisplay(hw, + 0, 0, + hw->html.view_width, + hw->html.view_height); + } + else + { + XCopyArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + XtWindow(hw->html.view), + hw->html.drawGC, dx, 0, + hw->html.view_width - dx, + hw->html.view_height, + 0, 0); + hw->html.scroll_x = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + (int)hw->html.view_width - dx, 0, + dx, hw->html.view_height, False); + ViewRedisplay(hw, + (int)hw->html.view_width - dx, 0, + dx, hw->html.view_height); + } + } + /* + * We've scrolled left. Copy right the untouched part of the + * window. Then Clear and redraw the new area + * exposed. + */ + else if (value < hw->html.scroll_x) + { + int dx; + + dx = hw->html.scroll_x - value; + if (dx > hw->html.view_width) + { + hw->html.scroll_x = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, 0, + hw->html.view_width, + hw->html.view_height, False); + ViewRedisplay(hw, + 0, 0, + hw->html.view_width, + hw->html.view_height); + } + else + { + XCopyArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + XtWindow(hw->html.view), + hw->html.drawGC, 0, 0, + hw->html.view_width - dx, + hw->html.view_height, + dx, 0); + hw->html.scroll_x = value; + XClearArea(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + 0, 0, + dx, hw->html.view_height, False); + ViewRedisplay(hw, + 0, 0, + dx, hw->html.view_height); + } + } + } + + /* + * Move the now hidden widgets + * Flush any Copyed or Cleared text first. + XFlush(XtDisplay(hw)); + */ + ScrollWidgets(hw); + + /* + * Remap the widgets to their new location + MapWidgets(hw); + */ +} + + +/* + * Either the vertical or hortizontal scrollbar has been moved + */ +void +ScrollMove(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ +#ifdef MOTIF + XmScrollBarCallbackStruct *sc = (XmScrollBarCallbackStruct *)call_data; + + ScrollToPos(w, (HTMLWidget)client_data, sc->value); +#else + float scrollDir = (int)call_data < 0 ? -0.3 : 0.3; + HTMLWidget hw = (HTMLWidget)client_data; + int value; + int totalLength, currentLength; /* MF026 */ + + if (w == hw->html.vbar) + { + totalLength = hw->html.doc_height; + currentLength = hw->html.view_height; + value = hw->html.scroll_y + scrollDir * currentLength; + } + else + { + totalLength = hw->html.doc_width; + currentLength = hw->html.view_width; + value = hw->html.scroll_x + scrollDir * currentLength; + } + + if (value > (int)totalLength) value = totalLength; + if (value < 0) value = 0; + + setScrollBar(w, value, totalLength, currentLength); + ScrollToPos(w, hw, value); +#endif +} + + +#ifndef MOTIF +void +JumpMove(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + HTMLWidget hw = (HTMLWidget)client_data; + int value = (int)(*(float *)call_data * + (w == hw->html.vbar ? + hw->html.doc_height : + hw->html.doc_width)); + ScrollToPos(w, hw, value); +} +#endif + + +/* + * Create the horizontal and vertical scroll bars. + * Size them later. + */ +static void +#ifdef _NO_PROTO +CreateScrollbars (hw) + HTMLWidget hw ; +#else +CreateScrollbars( + HTMLWidget hw) +#endif +{ + Arg arg[20]; + Cardinal argcnt; + XtTranslations trans; + + /* + * If the user hasn't provided a viewing area Widget (which they + * should not most of the time) make a drawing are to use. + */ + if (hw->html.view == NULL) + { + argcnt = 0; + XtSetArg(arg[argcnt], XxNwidth, 10); argcnt++; + XtSetArg(arg[argcnt], XxNheight, 10); argcnt++; + hw->html.view = XtCreateWidget("View", +#ifdef MOTIF + xmDrawingAreaWidgetClass, +#else + drawingAreaWidgetClass, +#endif + (Widget)hw, arg, argcnt); + XtManageChild(hw->html.view); + } + + /* + * For the view widget catch all Expose and GraphicsExpose + * events. Replace its translations with ours, and make + * sure all the actions are in order. + */ + XtAddEventHandler((Widget)hw->html.view, ExposureMask, True, + (XtEventHandler)DrawExpose, (caddr_t)hw); + /* + * As described previoisly, for some reason with Motif1.2/X11R5 + * the list actionsList is corrupted when we get here, + * so we have to use the special copy SpareActionsList + */ + XtAppAddActions(XtWidgetToApplicationContext(hw->html.view), + SpareActionsList, XtNumber(SpareActionsList)); + trans = XtParseTranslationTable(defaultTranslations); + argcnt = 0; + XtSetArg(arg[argcnt], XtNtranslations, trans); argcnt++; + XtSetValues(hw->html.view, arg, argcnt); + + /* + * If the user hasn't provided a vertical scrollbar (which they + * should not most of the time) make one. + */ + if (hw->html.vbar == NULL) + { + argcnt = 0; +#ifdef MOTIF + XtSetArg(arg[argcnt], XmNorientation, XmVERTICAL); argcnt++; + hw->html.vbar = XtCreateWidget("Vbar", xmScrollBarWidgetClass, + (Widget)hw, arg, argcnt); +#else + XtSetArg(arg[argcnt],XtNorientation,XtorientVertical); argcnt++; + hw->html.vbar = XtCreateWidget("Vbar", scrollbarWidgetClass, + (Widget)hw, arg, argcnt); +#endif + XtManageChild(hw->html.vbar); + } + + /* + * Add callbacks to catch scrollbar changes + */ +#ifdef MOTIF + XtAddCallback(hw->html.vbar, XmNvalueChangedCallback, + (XtCallbackProc)ScrollMove, (caddr_t)hw); + XtAddCallback(hw->html.vbar, XmNdragCallback, + (XtCallbackProc)ScrollMove, (caddr_t)hw); +#else + XtAddCallback(hw->html.vbar, XtNjumpProc, + (XtCallbackProc)JumpMove, (caddr_t)hw); + XtAddCallback(hw->html.vbar, XtNscrollProc, + (XtCallbackProc)ScrollMove, (caddr_t)hw); +#endif + + /* + * If the user hasn't provided a horizontal scrollbar (which they + * should not most of the time) make one. + */ + if (hw->html.hbar == NULL) + { + argcnt = 0; +#ifdef MOTIF + XtSetArg(arg[argcnt], XmNorientation, XmHORIZONTAL); argcnt++; + hw->html.hbar = XtCreateWidget("Hbar", xmScrollBarWidgetClass, + (Widget)hw, arg, argcnt); +#else + XtSetArg(arg[argcnt], XtNorientation, XtorientHorizontal); + argcnt++; + hw->html.hbar = XtCreateWidget("Hbar", scrollbarWidgetClass, + (Widget)hw, arg, argcnt); +#endif + XtManageChild(hw->html.hbar); + } + + /* + * Add callbacks to catch scrollbar changes + */ +#ifdef MOTIF + XtAddCallback(hw->html.hbar, XmNvalueChangedCallback, + (XtCallbackProc)ScrollMove, (caddr_t)hw); + XtAddCallback(hw->html.hbar, XmNdragCallback, + (XtCallbackProc)ScrollMove, (caddr_t)hw); +#else + XtAddCallback(hw->html.hbar, XtNjumpProc, + (XtCallbackProc)JumpMove, (caddr_t)hw); + XtAddCallback(hw->html.hbar, XtNscrollProc, + (XtCallbackProc)ScrollMove, (caddr_t)hw); +#endif +} + + +/* + * Return the width of the vertical scrollbar + */ +static Dimension +#ifdef _NO_PROTO +VbarWidth (hw) + HTMLWidget hw ; +#else +VbarWidth( + HTMLWidget hw) +#endif +{ + Arg arg[4]; + Cardinal argcnt; + Dimension width; + + width = 0; + if (hw->html.vbar != NULL) + { + argcnt = 0; + XtSetArg(arg[argcnt], XxNwidth, &width); argcnt++; + XtGetValues(hw->html.vbar, arg, argcnt); + } + + return(width); +} + + +/* + * Return the height of the horizontal scrollbar + */ +static Dimension +#ifdef _NO_PROTO +HbarHeight (hw) + HTMLWidget hw ; +#else +HbarHeight( + HTMLWidget hw) +#endif +{ + Arg arg[4]; + Cardinal argcnt; + Dimension height; + + height = 0; + if (hw->html.hbar != NULL) + { + argcnt = 0; + XtSetArg(arg[argcnt], XxNheight, &height); argcnt++; + XtGetValues(hw->html.hbar, arg, argcnt); + } + + return(height); +} + + +/* + * Resize and set the min and max values of the scrollbars. Position viewing + * area based on scrollbar locations. + */ +static void +#ifdef _NO_PROTO +ConfigScrollBars (hw) + HTMLWidget hw ; +#else +ConfigScrollBars( + HTMLWidget hw) +#endif +{ +#ifdef MOTIF + Arg arg[20]; + Cardinal argcnt; +#endif + int vx, vy; + + /* + * Move and size the viewing area + */ +#ifdef MOTIF + vx = hw->manager.shadow_thickness; + vy = hw->manager.shadow_thickness; +#else + vx = vy = 0; +#endif + if ((hw->html.use_vbar == True)&&(hw->html.vbar_right == False)) + { + vx += VbarWidth(hw); + } + if ((hw->html.use_hbar == True)&&(hw->html.hbar_top == True)) + { + vy += HbarHeight(hw); + } + XtMoveWidget(hw->html.view, vx, vy); + XtResizeWidget(hw->html.view, hw->html.view_width, hw->html.view_height, + hw->html.view->core.border_width); + + /* + * Set up vertical scrollbar + */ + if (hw->html.use_vbar == True) + { + int maxv; + int ss; + + /* + * Size the vertical scrollbar to the height of + * the viewing area + */ + XtResizeWidget(hw->html.vbar, hw->html.vbar->core.width, + hw->html.view_height + (2 * +#ifdef MOTIF + hw->manager.shadow_thickness +#else + 0 +#endif + ), + hw->html.vbar->core.border_width); + + /* + * Set the slider size to be the percentage of the + * viewing area that the viewing area is of the + * document area. Or set it to 1 if that isn't possible. + */ + if (hw->html.doc_height == 0) + { + ss = 1; + } + else + { +#ifdef DEBUG +fprintf (stderr, "view_height %d, doc_height %d\n", +hw->html.view_height, hw->html.doc_height); +#endif +#ifdef NOT_RIGHT + /* Eric -- your previous equation wasn't doing it. + This isn't either... */ + ss = + (int)((float)hw->html.view_height * + ((float)hw->html.view_height / + (float)(hw->html.doc_height - (int)hw->html.view_height))); + if (ss > hw->html.view_height) + { + ss = hw->html.view_height; + } +#endif + /* Added by marca: this produces results *very* close (~1 pixel) + to the original scrolled window behavior. */ + ss = hw->html.view_height; + } + if (ss < 1) + { + ss = 1; + } +#ifdef DEBUG +fprintf (stderr, "computed ss to be %d\n", ss); +#endif + + /* + * If resizing of the document has made scroll_y + * greater than the max, we want to hold it at the max. + */ + maxv = hw->html.doc_height - (int)hw->html.view_height; + if (maxv < 0) + { + maxv = 0; + } + if (hw->html.scroll_y > maxv) + { + hw->html.scroll_y = maxv; + } + + /* + * Prevent the Motif max value and slider size + * from going to zero, which is illegal + */ + maxv = maxv + ss; + if (maxv < 1) + { + maxv = 1; + } + + /* + * Motif will not allow the actual value to be equal to + * its max value. Adjust accordingly. + * Since we might decrease scroll_y, cap it at zero. + */ + if (hw->html.scroll_y >= maxv) + { + hw->html.scroll_y = maxv - 1; + } + if (hw->html.scroll_y < 0) + { + hw->html.scroll_y = 0; + } + +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNminimum, 0); argcnt++; + XtSetArg(arg[argcnt], XmNmaximum, maxv); argcnt++; + XtSetArg(arg[argcnt], XmNvalue, hw->html.scroll_y); argcnt++; + XtSetArg(arg[argcnt], XmNsliderSize, ss); argcnt++; + XtSetArg(arg[argcnt], XmNincrement, DEFAULT_INCREMENT); argcnt++; + XtSetArg(arg[argcnt], XmNpageIncrement, + hw->html.view_height > DEFAULT_INCREMENT ? + hw->html.view_height - DEFAULT_INCREMENT : 1); argcnt++; + XtSetValues(hw->html.vbar, arg, argcnt); +#else + setScrollBar(hw->html.vbar, + hw->html.scroll_y, + hw->html.doc_height, + (int)hw->html.view_height); +#endif /* MOTIF */ + +#ifdef DEBUG +XtVaGetValues(hw->html.vbar, XmNsliderSize, &ss, NULL); +fprintf (stderr, "real slider size %d\n", ss); +#endif + } + + /* + * Set up horizontal scrollbar + */ + if (hw->html.use_hbar == True) + { + int maxv; + int ss; + + /* + * Size the horizontal scrollbar to the width of + * the viewing area + */ + XtResizeWidget(hw->html.hbar, + hw->html.view_width + (2 * +#ifdef MOTIF + hw->manager.shadow_thickness +#else + 0 +#endif /* MOTIF */ + ), + hw->html.hbar->core.height, + hw->html.hbar->core.border_width); + + /* + * Set the slider size to be the percentage of the + * viewing area that the viewing area is of the + * document area. Or set it to 1 if that isn't possible. + */ + if (hw->html.doc_width == 0) + { + ss = 1; + } + else + { +#ifdef NOT_RIGHT + ss = hw->html.view_width * + hw->html.view_width / hw->html.doc_width; + if (ss > hw->html.view_width) + { + ss = hw->html.view_width; + } +#endif + /* Added by marca: this produces results *very* close (~1 pixel) + to the original scrolled window behavior. */ + ss = hw->html.view_width; + } + if (ss < 1) + { + ss = 1; + } + + /* + * If resizing of the document has made scroll_x + * greater than the max, we want to hold it at the max. + */ + maxv = hw->html.doc_width - (int)hw->html.view_width; + if (maxv < 0) + { + maxv = 0; + } + if (hw->html.scroll_x > maxv) + { + hw->html.scroll_x = maxv; + } + + /* + * Prevent the Motif max value and slider size + * from going to zero, which is illegal + */ + maxv = maxv + ss; + if (maxv < 1) + { + maxv = 1; + } + + /* + * Motif will not allow the actual value to be equal to + * its max value. Adjust accordingly. + * Since we might decrease scroll_x, cap it at zero. + */ + if (hw->html.scroll_x >= maxv) + { + hw->html.scroll_x = maxv - 1; + } + if (hw->html.scroll_x < 0) + { + hw->html.scroll_x = 0; + } + +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNminimum, 0); argcnt++; + XtSetArg(arg[argcnt], XmNmaximum, maxv); argcnt++; + XtSetArg(arg[argcnt], XmNvalue, hw->html.scroll_x); argcnt++; + XtSetArg(arg[argcnt], XmNsliderSize, ss); argcnt++; + XtSetArg(arg[argcnt], XmNincrement, DEFAULT_INCREMENT); argcnt++; + XtSetArg(arg[argcnt], XmNpageIncrement, + hw->html.view_width > DEFAULT_INCREMENT ? + hw->html.view_width - DEFAULT_INCREMENT : 1); argcnt++; + XtSetValues(hw->html.hbar, arg, argcnt); +#else + setScrollBar(hw->html.hbar, + hw->html.scroll_x, + hw->html.doc_width, + (int)hw->html.view_width); +#endif /* MOTIF */ + } + +#ifdef DEBUG + { + int ss; +XtVaGetValues(hw->html.vbar, XmNsliderSize, &ss, NULL); +fprintf (stderr, "real slider size %d\n", ss); + } +#endif +} + + +/* + * Reformat the window and scrollbars. + * May be called because of a changed document, or because of a changed + * window size. + */ +static void +#ifdef _NO_PROTO +ReformatWindow (hw) + HTMLWidget hw ; +#else +ReformatWindow( + HTMLWidget hw) +#endif +{ + int temp; + int new_width; + Dimension swidth, sheight; + Dimension st; + + /* + * Find the current scrollbar sizes, and shadow thickness and format + * the document to the current window width + * (assume a vertical scrollbar) + */ + swidth = VbarWidth(hw); + sheight = HbarHeight(hw); +#ifdef MOTIF + st = hw->manager.shadow_thickness; +#else + st = 0; +#endif /* MOTIF */ + if (hw->core.width <= swidth) + { + hw->core.width = swidth + 10; + } + new_width = hw->core.width - swidth - (2 * st); + temp = FormatAll(hw, &new_width); + + /* + * If we need the vertical scrollbar, place and manage it, + * and store the current viewing area width. + */ + if (temp > hw->core.height - sheight) + { + hw->html.use_vbar = True; + if (hw->html.vbar_right == True) + { + XtMoveWidget(hw->html.vbar, + (hw->core.width - swidth), 0); + } + else + { + XtMoveWidget(hw->html.vbar, 0, 0); + } + XtManageChild(hw->html.vbar); + hw->html.view_width = hw->core.width - swidth - (2 * st); + } + /* + * Else we were wrong to assume a vertical scrollbar. + * Remove it, and reformat the document to the wider width. + * Save the as the current viewing are width. + */ + else + { + hw->html.use_vbar = False; + XtUnmanageChild(hw->html.vbar); + hw->html.scroll_y = 0; + new_width = hw->core.width - (2 * st); + temp = FormatAll(hw, &new_width); + hw->html.view_width = hw->core.width - (2 * st); + /* fake out later horizontal scrollbars */ + swidth = 0; + } + + /* + * Calculate the actual max width and height of the complete + * formatted document. + * The max width may exceed the preformatted width due to special + * factors in the formatting of the widget. + * Use the max of the 2 here, but leave max_pre_width unchanged + * for future formatting calls. + */ + /* + * new_width includes the margins, and hw->html.max_pre_width + * does not, fix that here. + */ + new_width = new_width - (2 * hw->html.margin_width); + if (hw->html.max_pre_width > new_width) + { + new_width = hw->html.max_pre_width; + } + /* + * If the maximum width derives from a formatted, as opposed to + * unformatted piece of text, allow a 20% of margin width slop + * over into the margin to cover up a minor glick with terminaing + * punctuation after anchors at the end of the line. + */ + else + { + new_width = new_width - (20 * hw->html.margin_width / 100); + } + + hw->html.doc_height = temp; + hw->html.doc_width = new_width + (2 * hw->html.margin_width); + if (hw->html.view_width > hw->html.doc_width) + { + hw->html.doc_width = hw->html.view_width; + } + + /* + * If we need a horizontal scrollbar + * Place it and manage it. Save the height of the current + * viewing area. + */ + if (hw->html.doc_width > hw->html.view_width) + { + hw->html.use_hbar = True; + if (hw->html.hbar_top == True) + { + if (hw->html.use_vbar == True) + { + XtMoveWidget(hw->html.vbar, + hw->html.vbar->core.x, sheight); + } + + if (hw->html.vbar_right == True) + { + XtMoveWidget(hw->html.hbar, 0, 0); + } + else + { + XtMoveWidget(hw->html.hbar, swidth, 0); + } + } + else + { + if (hw->html.vbar_right == True) + { + XtMoveWidget(hw->html.hbar, 0, + (hw->core.height - sheight)); + } + else + { + XtMoveWidget(hw->html.hbar, swidth, + (hw->core.height - sheight)); + } + } + XtManageChild(hw->html.hbar); + hw->html.view_height = hw->core.height - sheight - (2 * st); + } + /* + * Else we don't need a horizontal scrollbar. + * Remove it and save the current viewing area height. + */ + else + { + hw->html.use_hbar = False; + XtUnmanageChild(hw->html.hbar); + hw->html.scroll_x = 0; + hw->html.view_height = hw->core.height - (2 * st); + } + + /* + * Configure the scrollbar min, max, and slider sizes + */ +#ifdef DEBUG +fprintf (stderr, "calling in ReformatWindow\n"); +#endif + ConfigScrollBars(hw); +} + + +/* + * We're a happy widget. We let any child move or resize themselves + * however they want, we don't care. + */ +static XtGeometryResult +#ifdef _NO_PROTO +GeometryManager (w, request, reply) + Widget w; + XtWidgetGeometry * request; + XtWidgetGeometry * reply; +#else +GeometryManager ( + Widget w, + XtWidgetGeometry * request, + XtWidgetGeometry * reply) +#endif +{ + reply->x = request->x; + reply->y = request->y; + reply->width = request->width; + reply->height = request->height; + reply->border_width = request->border_width; + reply->request_mode = request->request_mode; + return (XtGeometryYes); +} + + +/* + * Initialize is called when the widget is first initialized. + * Check to see that all the starting resources are valid. + */ +static void +#ifdef _NO_PROTO +Initialize (request, new) + HTMLWidget request ; + HTMLWidget new ; +#else +Initialize( + HTMLWidget request, + HTMLWidget new) +#endif +{ + /* + * Make sure height and width are not zero. + */ + if (new->core.width == 0) + { + new->core.width = new->html.margin_width << 1 ; + } + if (new->core.width == 0) + { + new->core.width = 10 ; + } + if (new->core.height == 0) + { + new->core.height = new->html.margin_height << 1 ; + } + if (new->core.height == 0) + { + new->core.height = 10 ; + } + + /* + * Make sure the underline numbers are within bounds. + */ + if (new->html.num_anchor_underlines < 0) + { + new->html.num_anchor_underlines = 0; + } + if (new->html.num_anchor_underlines > MAX_UNDERLINES) + { + new->html.num_anchor_underlines = MAX_UNDERLINES; + } + if (new->html.num_visitedAnchor_underlines < 0) + { + new->html.num_visitedAnchor_underlines = 0; + } + if (new->html.num_visitedAnchor_underlines > MAX_UNDERLINES) + { + new->html.num_visitedAnchor_underlines = MAX_UNDERLINES; + } + + /* + * Parse the raw text with the HTML parser. And set the formatted + * element list to NULL. + */ + new->html.html_objects = HTMLParse(NULL, request->html.raw_text); + CallLinkCallbacks(new); + new->html.html_header_objects = + HTMLParse(NULL, request->html.header_text); + new->html.html_footer_objects = + HTMLParse(NULL, request->html.footer_text); + new->html.formatted_elements = NULL; + new->html.my_visited_hrefs = NULL; + new->html.my_delayed_images = NULL; + new->html.widget_list = NULL; + new->html.form_list = NULL; + + /* + * Blank document + */ + new->html.line_array = NULL; + new->html.line_count = 0; + + /* + * Find the max width of a preformatted + * line in this document. + */ + new->html.max_pre_width = DocumentWidth(new, new->html.html_objects); + + /* + * Create the scrollbars. + * Find their dimensions and then decide which scrollbars you + * will need, and what the dimensions of the viewing area are. + * Start assuming a vertical scrollbar and a horizontal one. + * The remove vertical if short enough, and remove horizontal + * if narrow enough. + */ + CreateScrollbars(new); + new->html.scroll_x = 0; + new->html.scroll_y = 0; + ReformatWindow(new); + + /* + * Initialize private widget resources + */ + new->html.drawGC = NULL; + new->html.select_start = NULL; + new->html.select_end = NULL; + new->html.sel_start_pos = 0; + new->html.sel_end_pos = 0; + new->html.new_start = NULL; + new->html.new_end = NULL; + new->html.new_start_pos = 0; + new->html.new_end_pos = 0; + new->html.active_anchor = NULL; + new->html.press_x = 0; + new->html.press_y = 0; + + new->html.cached_tracked_ele = NULL; + + /* Initialize cursor used when pointer is inside anchor. + if (in_anchor_cursor == (Cursor)NULL) */ + in_anchor_cursor = XCreateFontCursor (XtDisplay (new), XC_hand2); + + return; +} + +/* + * Realize is called when the widget is realized to create its window. + * We call the Realize method of our superclass and then create the drawGC + * to be used by the HTML widget. (This was added at NOAO, the NCSA + * version does not use a custom Realize method, and the drawGC is not + * created until the first Expose event occurs. This causes the widget to + * crash if a drawing routine is called before the application becomes idle + * and processes the queued input from the display server.) + */ +static void +#ifdef _NO_PROTO +Realize (hw, valueMask, attributes) + HTMLWidget hw ; + Mask *valueMask ; + XSetWindowAttributes *attributes ; +#else +Realize ( + HTMLWidget hw , + Mask *valueMask , + XSetWindowAttributes *attributes ) +#endif +{ + unsigned long valuemask; + XGCValues values; + + /* Call the Realize method of the superclass to create the window. */ + (*htmlWidgetClass->core_class.superclass->core_class.realize) + ((Widget)hw, valueMask, attributes); + + /* Create the drawGC for the HTML window (copied from Expose). */ + values.function = GXcopy; + values.plane_mask = AllPlanes; +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + values.foreground = hw->manager.foreground; +#else + values.foreground = hw->html.foreground; +#endif /* MOTIF */ + values.background = hw->core.background_pixel; + + valuemask = GCFunction|GCPlaneMask|GCForeground|GCBackground; + + hw->html.drawGC = XCreateGC(XtDisplay(hw), XtWindow(hw), + valuemask, &values); +} + + +#ifdef DEBUG +void +DebugHook(x, y, width, height) + int x, y, width, height; +{ +fprintf(stderr, "Redrawing (%d,%d) %dx%d\n", x, y, width, height); +} +#endif + + +/* + * This is called by redisplay. It is passed a rectangle + * in the viewing area, and it redisplays that portion of the + * underlying document area. + */ +static void +#ifdef _NO_PROTO +ViewRedisplay (hw, x, y, width, height) + HTMLWidget hw; + int x, y; + int width, height; +#else +ViewRedisplay( + HTMLWidget hw, + int x, + int y, + int width, + int height) +#endif +{ + int sx, sy; + int doc_x, doc_y; + int i, start, end, guess; + + /* + * Use scrollbar values to map from view space to document space. + */ + sx = sy = 0; + if (hw->html.use_vbar == True) + { + sy += hw->html.scroll_y; + } + if (hw->html.use_hbar == True) + { + sx += hw->html.scroll_x; + } + + doc_x = x + sx; + doc_y = y + sy; + + /* + * Find the lines that overlap the exposed area. + */ + start = 0; + end = hw->html.line_count - 1; + + /* + * Heuristic to speed up redraws by guessing at the starting line. + */ + guess = doc_y / (hw->html.font->max_bounds.ascent + + hw->html.font->max_bounds.descent); + if (guess > end) + { + guess = end; + } + while (guess > 0) + { + if ((hw->html.line_array[guess] != NULL)&& + (hw->html.line_array[guess]->y < doc_y)) + { + break; + } + guess--; + } + if (guess < start) + { + guess = start; + } + + for (i=guess; i<hw->html.line_count; i++) + { + if (hw->html.line_array[i] == NULL) + { + continue; + } + + if (hw->html.line_array[i]->y < doc_y) + { + start = i; + } + if (hw->html.line_array[i]->y > (doc_y + height)) + { + end = i; + break; + } + } + + /* + * If we have a GC draw the lines that overlap the exposed area. + */ + if (hw->html.drawGC != NULL) + { + for (i=start; i<=end; i++) + { + PlaceLine(hw, i); + } +#ifdef EXTRA_FLUSH + XFlush(XtDisplay(hw)); +#endif + } +} + + +static void +#ifdef _NO_PROTO +ViewClearAndRefresh (hw) + HTMLWidget hw; +#else +ViewClearAndRefresh( + HTMLWidget hw) +#endif +{ + /* + * Only refresh if we have a window already. + * (if we have a GC we have a window) + */ + if (hw->html.drawGC != NULL) + { + XClearArea(XtDisplay(hw->html.view), XtWindow(hw->html.view), + 0, 0, 0, 0, False); + ViewRedisplay(hw, 0, 0, + hw->html.view_width, hw->html.view_height); + /* + * This is a fake deal to make an Expose event tocall Redisplay + * to redraw the shadow around the view area + */ + XClearArea(XtDisplay(hw), XtWindow(hw), + 0, 0, 1, 1, True); + } +} + + +/* + * The Redisplay function is what you do with an expose event. + * Right now we call user callbacks, and then call the CompositeWidget's + * Redisplay routine. + */ +static void +#ifdef _NO_PROTO +Redisplay (hw, event, region) + HTMLWidget hw; + XEvent * event; + Region region; +#else +Redisplay( + HTMLWidget hw, + XEvent * event, + Region region) +#endif +{ + XExposeEvent *ExEvent = (XExposeEvent *)event; + int dx, dy; + +#ifdef MOTIF + /* + * find out where the shadow is based on scrollbars + */ + + Dimension st = hw->manager.shadow_thickness; +#endif /* MOTIF */ + + dx = dy = 0; + if ((hw->html.use_vbar == True)&&(hw->html.vbar_right == False)) + { + dx += VbarWidth(hw); + } + if ((hw->html.use_hbar == True)&&(hw->html.hbar_top == True)) + { + dy += HbarHeight(hw); + } + +#ifdef MOTIF + /* + * Redraw the shadow around the scrolling area which may have been + * messed up. + */ + _XmDrawShadow(XtDisplay(hw), XtWindow(hw), + hw->manager.bottom_shadow_GC, hw->manager.top_shadow_GC, + hw->manager.shadow_thickness, dx, dy, + hw->html.view_width + (2 * st),hw->html.view_height + (2 * st)); +#endif /* MOTIF */ + +#ifdef MOTIF +#ifdef MOTIF1_2 + _XmRedisplayGadgets ((Widget)hw, (XEvent*)event, region); +#else + _XmRedisplayGadgets ((CompositeWidget)hw, (XExposeEvent*)event, region); +#endif /* MOTIF1_2 */ +#endif /* MOTIF */ + + return; +} + + +/* + * Resize is called when the widget changes size. + * Mostly any resize causes a reformat, except for the special case + * where the width doesn't change, and the height doesn't change + * enought to affect the vertical scrollbar. + * It is too complex to guess exactly what needs to be redrawn, so refresh the + * whole window on any resize. + */ +static void +#ifdef _NO_PROTO +Resize (hw) + HTMLWidget hw; +#else +Resize( + HTMLWidget hw) +#endif +{ + int tempw; + Dimension swidth, sheight; + Dimension st; + + /* + * Find the new widht of the viewing area. + */ + swidth = VbarWidth(hw); + sheight = HbarHeight(hw); +#ifdef MOTIF + st = hw->manager.shadow_thickness; +#else + st = 0; +#endif /* MOTIF */ + if (hw->core.width <= swidth) + { + hw->core.width = swidth + 10 ; + } + + if (hw->html.use_vbar == True) + { + tempw = hw->core.width - swidth - (2 * st); + } + else + { + tempw = hw->core.width - (2 * st); + /* fool positioning of horz scrollbar later */ + swidth = 0; + } + + /* + * Special case where we don't have to reformat to a new width. + * The width has not changed, and the height has not changed + * significantly to change the state of the vertical scrollbar. + */ + if ((tempw == hw->html.view_width)&& + (((hw->html.use_vbar == True)&& + ((hw->core.height - sheight - (2 * st)) < hw->html.doc_height))|| + ((hw->html.use_vbar == False)&& + ((hw->core.height - sheight - (2 * st)) >= hw->html.doc_height)))) + { + /* + * Super special case where the size of the window hasn't + * changed at ALL! + */ + if (((hw->html.use_hbar == True)&&(hw->html.view_height == + (hw->core.height - sheight - (2 * st))))|| + ((hw->html.use_hbar == False)&&(hw->html.view_height == + (hw->core.height - (2 * st))))) + { + return; + } + + if (hw->html.use_hbar == True) + { + if (hw->html.hbar_top == True) + { + if (hw->html.vbar_right == True) + { + XtMoveWidget(hw->html.hbar, 0, 0); + } + else + { + XtMoveWidget(hw->html.hbar, swidth, 0); + } + } + else + { + if (hw->html.vbar_right == True) + { + XtMoveWidget(hw->html.hbar, 0, + (hw->core.height - sheight)); + } + else + { + XtMoveWidget(hw->html.hbar, swidth, + (hw->core.height - sheight)); + } + } + hw->html.view_height = hw->core.height - sheight - + (2 * st); + } + else + { + hw->html.view_height = hw->core.height - (2 * st); + } +#ifdef DEBUG +fprintf (stderr, "calling in Resize\n"); +#endif + ConfigScrollBars(hw); + ScrollWidgets(hw); + ViewClearAndRefresh(hw); + } + /* + * Otherwise we have to do a full reformat on every resize. + */ + else + { + ReformatWindow(hw); + ScrollWidgets(hw); + ViewClearAndRefresh(hw); + } + +#ifdef DEBUG + { + int ss; +XtVaGetValues(hw->html.vbar, XmNsliderSize, &ss, NULL); +fprintf (stderr, "leaving; slider size %d\n", ss); + } +#endif + + return; +} + + +/* + * Find the complete text for this the anchor that aptr is a part of + * and set it into the selection. + */ +static void +FindSelectAnchor(hw, aptr) + HTMLWidget hw; + struct ele_rec *aptr; +{ + struct ele_rec *eptr; + + eptr = aptr; + while ((eptr->prev != NULL)&& + (eptr->prev->anchorHRef != NULL)&& + (strcmp(eptr->prev->anchorHRef, eptr->anchorHRef) == 0)) + { + eptr = eptr->prev; + } + hw->html.select_start = eptr; + hw->html.sel_start_pos = 0; + + eptr = aptr; + while ((eptr->next != NULL)&& + (eptr->next->anchorHRef != NULL)&& + (strcmp(eptr->next->anchorHRef, eptr->anchorHRef) == 0)) + { + eptr = eptr->next; + } + hw->html.select_end = eptr; + hw->html.sel_end_pos = eptr->edata_len - 2; +} + + +/* + * Set as active all elements in the widget that are part of the anchor + * in the widget's start ptr. + */ +static void +SetAnchor(hw) + HTMLWidget hw; +{ + struct ele_rec *eptr; + struct ele_rec *start; + struct ele_rec *end; + unsigned long fg, bg; + unsigned long old_fg, old_bg; + + eptr = hw->html.active_anchor; + if ((eptr == NULL)||(eptr->anchorHRef == NULL)) + { + return; + } + fg = hw->html.activeAnchor_fg; + bg = hw->html.activeAnchor_bg; + + FindSelectAnchor(hw, eptr); + + start = hw->html.select_start; + end = hw->html.select_end; + + eptr = start; + while ((eptr != NULL)&&(eptr != end)) + { + if (eptr->type == E_TEXT) + { + old_fg = eptr->fg; + old_bg = eptr->bg; + eptr->fg = fg; + eptr->bg = bg; + TextRefresh(hw, eptr, + 0, (eptr->edata_len - 2)); + eptr->fg = old_fg; + eptr->bg = old_bg; + } + else if (eptr->type == E_IMAGE) + { + old_fg = eptr->fg; + old_bg = eptr->bg; + eptr->fg = fg; + eptr->bg = bg; + ImageRefresh(hw, eptr); + eptr->fg = old_fg; + eptr->bg = old_bg; + } + /* + * Linefeeds in anchor spanning multiple lines should NOT + * be highlighted! + else if (eptr->type == E_LINEFEED) + { + old_fg = eptr->fg; + old_bg = eptr->bg; + eptr->fg = fg; + eptr->bg = bg; + LinefeedRefresh(hw, eptr); + eptr->fg = old_fg; + eptr->bg = old_bg; + } + */ + eptr = eptr->next; + } + if (eptr != NULL) + { + if (eptr->type == E_TEXT) + { + old_fg = eptr->fg; + old_bg = eptr->bg; + eptr->fg = fg; + eptr->bg = bg; + TextRefresh(hw, eptr, + 0, (eptr->edata_len - 2)); + eptr->fg = old_fg; + eptr->bg = old_bg; + } + else if (eptr->type == E_IMAGE) + { + old_fg = eptr->fg; + old_bg = eptr->bg; + eptr->fg = fg; + eptr->bg = bg; + ImageRefresh(hw, eptr); + eptr->fg = old_fg; + eptr->bg = old_bg; + } + /* + * Linefeeds in anchor spanning multiple lines should NOT + * be highlighted! + else if (eptr->type == E_LINEFEED) + { + old_fg = eptr->fg; + old_bg = eptr->bg; + eptr->fg = fg; + eptr->bg = bg; + LinefeedRefresh(hw, eptr); + eptr->fg = old_fg; + eptr->bg = old_bg; + } + */ + } +} + + +/* + * Draw selection for all elements in the widget + * from start to end. + */ +static void +DrawSelection(hw, start, end, start_pos, end_pos) + HTMLWidget hw; + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; +{ + struct ele_rec *eptr; + int epos; + + if ((start == NULL)||(end == NULL)) + { + return; + } + + /* + * Keep positions within bounds (allows us to be sloppy elsewhere) + */ + if (start_pos < 0) + { + start_pos = 0; + } + if (start_pos >= start->edata_len - 1) + { + start_pos = start->edata_len - 2; + } + if (end_pos < 0) + { + end_pos = 0; + } + if (end_pos >= end->edata_len - 1) + { + end_pos = end->edata_len - 2; + } + + if (SwapElements(start, end, start_pos, end_pos)) + { + eptr = start; + start = end; + end = eptr; + epos = start_pos; + start_pos = end_pos; + end_pos = epos; + } + + eptr = start; + while ((eptr != NULL)&&(eptr != end)) + { + int p1, p2; + + if (eptr == start) + { + p1 = start_pos; + } + else + { + p1 = 0; + } + p2 = eptr->edata_len - 2; + + if (eptr->type == E_TEXT) + { + eptr->selected = True; + eptr->start_pos = p1; + eptr->end_pos = p2; + TextRefresh(hw, eptr, p1, p2); + } + else if (eptr->type == E_LINEFEED) + { + eptr->selected = True; + LinefeedRefresh(hw, eptr); + } + eptr = eptr->next; + } + if (eptr != NULL) + { + int p1, p2; + + if (eptr == start) + { + p1 = start_pos; + } + else + { + p1 = 0; + } + + if (eptr == end) + { + p2 = end_pos; + } + else + { + p2 = eptr->edata_len - 2; + } + + if (eptr->type == E_TEXT) + { + eptr->selected = True; + eptr->start_pos = p1; + eptr->end_pos = p2; + TextRefresh(hw, eptr, p1, p2); + } + else if (eptr->type == E_LINEFEED) + { + eptr->selected = True; + LinefeedRefresh(hw, eptr); + } + } +} + + +/* + * Set selection for all elements in the widget's + * start to end list. + */ +static void +SetSelection(hw) + HTMLWidget hw; +{ + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; + + start = hw->html.select_start; + end = hw->html.select_end; + start_pos = hw->html.sel_start_pos; + end_pos = hw->html.sel_end_pos; + DrawSelection(hw, start, end, start_pos, end_pos); +} + + +/* + * Erase the selection from start to end + */ +static void +EraseSelection(hw, start, end, start_pos, end_pos) + HTMLWidget hw; + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; +{ + struct ele_rec *eptr; + int epos; + + if ((start == NULL)||(end == NULL)) + { + return; + } + + /* + * Keep positoins within bounds (allows us to be sloppy elsewhere) + */ + if (start_pos < 0) + { + start_pos = 0; + } + if (start_pos >= start->edata_len - 1) + { + start_pos = start->edata_len - 2; + } + if (end_pos < 0) + { + end_pos = 0; + } + if (end_pos >= end->edata_len - 1) + { + end_pos = end->edata_len - 2; + } + + if (SwapElements(start, end, start_pos, end_pos)) + { + eptr = start; + start = end; + end = eptr; + epos = start_pos; + start_pos = end_pos; + end_pos = epos; + } + + eptr = start; + while ((eptr != NULL)&&(eptr != end)) + { + int p1, p2; + + if (eptr == start) + { + p1 = start_pos; + } + else + { + p1 = 0; + } + p2 = eptr->edata_len - 2; + + if (eptr->type == E_TEXT) + { + eptr->selected = False; + TextRefresh(hw, eptr, p1, p2); + } + else if (eptr->type == E_LINEFEED) + { + eptr->selected = False; + LinefeedRefresh(hw, eptr); + } + eptr = eptr->next; + } + if (eptr != NULL) + { + int p1, p2; + + if (eptr == start) + { + p1 = start_pos; + } + else + { + p1 = 0; + } + + if (eptr == end) + { + p2 = end_pos; + } + else + { + p2 = eptr->edata_len - 2; + } + + if (eptr->type == E_TEXT) + { + eptr->selected = False; + TextRefresh(hw, eptr, p1, p2); + } + else if (eptr->type == E_LINEFEED) + { + eptr->selected = False; + LinefeedRefresh(hw, eptr); + } + } +} + + +/* + * Clear the current selection (if there is one) + */ +static void +ClearSelection(hw) + HTMLWidget hw; +{ + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; + + start = hw->html.select_start; + end = hw->html.select_end; + start_pos = hw->html.sel_start_pos; + end_pos = hw->html.sel_end_pos; + EraseSelection(hw, start, end, start_pos, end_pos); + + if ((start == NULL)||(end == NULL)) + { + hw->html.select_start = NULL; + hw->html.select_end = NULL; + hw->html.sel_start_pos = 0; + hw->html.sel_end_pos = 0; + hw->html.active_anchor = NULL; + return; + } + + hw->html.select_start = NULL; + hw->html.select_end = NULL; + hw->html.sel_start_pos = 0; + hw->html.sel_end_pos = 0; + hw->html.active_anchor = NULL; +} + + +/* + * clear from active all elements in the widget that are part of the anchor. + * (These have already been previously set into the start and end of the + * selection. + */ +static void +UnsetAnchor(hw) + HTMLWidget hw; +{ + struct ele_rec *eptr; + + /* + * Clear any activated images + */ + eptr = hw->html.select_start; + while ((eptr != NULL)&&(eptr != hw->html.select_end)) + { + if (eptr->type == E_IMAGE) + { + ImageRefresh(hw, eptr); + } + eptr = eptr->next; + } + if ((eptr != NULL)&&(eptr->type == E_IMAGE)) + { + ImageRefresh(hw, eptr); + } + + /* + * Clear the activated anchor + */ + ClearSelection(hw); +} + + +/* + * Erase the old selection, and draw the new one in such a way + * that advantage is taken of overlap, and there is no obnoxious + * flashing. + */ +static void +ChangeSelection(hw, start, end, start_pos, end_pos) + HTMLWidget hw; + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; +{ + struct ele_rec *old_start; + struct ele_rec *old_end; + struct ele_rec *new_start; + struct ele_rec *new_end; + struct ele_rec *eptr; + int epos; + int new_start_pos, new_end_pos; + int old_start_pos, old_end_pos; + + old_start = hw->html.new_start; + old_end = hw->html.new_end; + old_start_pos = hw->html.new_start_pos; + old_end_pos = hw->html.new_end_pos; + new_start = start; + new_end = end; + new_start_pos = start_pos; + new_end_pos = end_pos; + + if ((new_start == NULL)||(new_end == NULL)) + { + return; + } + + if ((old_start == NULL)||(old_end == NULL)) + { + DrawSelection(hw, new_start, new_end, + new_start_pos, new_end_pos); + return; + } + + if (SwapElements(old_start, old_end, old_start_pos, old_end_pos)) + { + eptr = old_start; + old_start = old_end; + old_end = eptr; + epos = old_start_pos; + old_start_pos = old_end_pos; + old_end_pos = epos; + } + + if (SwapElements(new_start, new_end, new_start_pos, new_end_pos)) + { + eptr = new_start; + new_start = new_end; + new_end = eptr; + epos = new_start_pos; + new_start_pos = new_end_pos; + new_end_pos = epos; + } + + /* + * Deal with all possible intersections of the 2 selection sets. + * + ******************************************************** + * * * + * |-- * |-- * + * old--| * new--| * + * |-- * |-- * + * * * + * |-- * |-- * + * new--| * old--| * + * |-- * |-- * + * * * + ******************************************************** + * * * + * |---- * |-- * + * old--| * new--| * + * | |-- * | * + * |-+-- * |-+-- * + * | * | |-- * + * new--| * old--| * + * |-- * |---- * + * * * + ******************************************************** + * * * + * |--------- * |--------- * + * | * | * + * | |-- * | |-- * + * new--| old--| * old--| new--| * + * | |-- * | |-- * + * | * | * + * |--------- * |--------- * + * * * + ******************************************************** + * + */ + if ((ElementLessThan(old_end, new_start, old_end_pos, new_start_pos))|| + (ElementLessThan(new_end, old_start, new_end_pos, old_start_pos))) + { + EraseSelection(hw, old_start, old_end, + old_start_pos, old_end_pos); + DrawSelection(hw, new_start, new_end, + new_start_pos, new_end_pos); + } + else if ((ElementLessThan(old_start, new_start, + old_start_pos, new_start_pos))&& + (ElementLessThan(old_end, new_end, old_end_pos, new_end_pos))) + { + if (new_start_pos != 0) + { + EraseSelection(hw, old_start, new_start, + old_start_pos, new_start_pos - 1); + } + else + { + EraseSelection(hw, old_start, new_start->prev, + old_start_pos, new_start->prev->edata_len - 2); + } + if (old_end_pos < (old_end->edata_len - 2)) + { + DrawSelection(hw, old_end, new_end, + old_end_pos + 1, new_end_pos); + } + else + { + DrawSelection(hw, old_end->next, new_end, + 0, new_end_pos); + } + } + else if ((ElementLessThan(new_start, old_start, + new_start_pos, old_start_pos))&& + (ElementLessThan(new_end, old_end, new_end_pos, old_end_pos))) + { + if (old_start_pos != 0) + { + DrawSelection(hw, new_start, old_start, + new_start_pos, old_start_pos - 1); + } + else + { + DrawSelection(hw, new_start, old_start->prev, + new_start_pos, old_start->prev->edata_len - 2); + } + if (new_end_pos < (new_end->edata_len - 2)) + { + EraseSelection(hw, new_end, old_end, + new_end_pos + 1, old_end_pos); + } + else + { + EraseSelection(hw, new_end->next, old_end, + 0, old_end_pos); + } + } + else if ((ElementLessThan(new_start, old_start, + new_start_pos, old_start_pos))|| + (ElementLessThan(old_end, new_end, old_end_pos, new_end_pos))) + { + if ((new_start != old_start)||(new_start_pos != old_start_pos)) + { + if (old_start_pos != 0) + { + DrawSelection(hw, new_start, old_start, + new_start_pos, old_start_pos - 1); + } + else + { + DrawSelection(hw, new_start, old_start->prev, + new_start_pos, + old_start->prev->edata_len - 2); + } + } + if ((old_end != new_end)||(old_end_pos != new_end_pos)) + { + if (old_end_pos < (old_end->edata_len - 2)) + { + DrawSelection(hw, old_end, new_end, + old_end_pos + 1, new_end_pos); + } + else + { + DrawSelection(hw, old_end->next, new_end, + 0, new_end_pos); + } + } + } + else + { + if ((old_start != new_start)||(old_start_pos != new_start_pos)) + { + if (new_start_pos != 0) + { + EraseSelection(hw, old_start, new_start, + old_start_pos, new_start_pos - 1); + } + else + { + EraseSelection(hw, old_start, new_start->prev, + old_start_pos, + new_start->prev->edata_len - 2); + } + } + if ((new_end != old_end)||(new_end_pos != old_end_pos)) + { + if (new_end_pos < (new_end->edata_len - 2)) + { + EraseSelection(hw, new_end, old_end, + new_end_pos + 1, old_end_pos); + } + else + { + EraseSelection(hw, new_end->next, old_end, + 0, old_end_pos); + } + } + } +} + + +static void +SelectStart(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + HTMLWidget hw = (HTMLWidget)XtParent(w); + XButtonPressedEvent *BuEvent = (XButtonPressedEvent *)event; + struct ele_rec *eptr; + int epos; + + if (XtClass(XtParent(w)) != htmlWidgetClass) + { + return; + } + +#ifdef NOT_RIGHT + XUndefineCursor(XtDisplay(hw->html.view), XtWindow(hw->html.view)); +#endif + XUndefineCursor(XtDisplay(hw), XtWindow(hw)); + + /* + * Because X sucks, we can get the button pressed in the window, but + * released out of the window. This will highlight some text, but + * never complete the selection. Now on the next button press we + * have to clean up this mess. + */ + EraseSelection(hw, hw->html.new_start, hw->html.new_end, + hw->html.new_start_pos, hw->html.new_end_pos); + + /* + * We want to erase the currently selected text, but still save the + * selection internally in case we don't create a new one. + */ + EraseSelection(hw, hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos); + hw->html.new_start = hw->html.select_start; + hw->html.new_end = NULL; + hw->html.new_start_pos = hw->html.sel_start_pos; + hw->html.new_end_pos = 0; + + eptr = LocateElement(hw, BuEvent->x, BuEvent->y, &epos); + if (eptr != NULL) + { + /* + * If this is an anchor assume for now we are activating it + * and not selecting it. + */ + if (eptr->anchorHRef != NULL) + { + hw->html.active_anchor = eptr; + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; + SetAnchor(hw); + } + /* + * Else if we are on an image we can't select text so + * pretend we got eptr==NULL, and exit here. + */ + else if (eptr->type == E_IMAGE) + { + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; + hw->html.but_press_time = BuEvent->time; + return; + } + /* + * Else if we used button2, we can't select text, so exit + * here. + */ + else if (BuEvent->button == Button2) + { + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; + hw->html.but_press_time = BuEvent->time; + return; + } + /* + * Else a single click will not select a new object + * but it will prime that selection on the next mouse + * move. + * Ignore special internal text + */ + else if (eptr->internal == False) + { + hw->html.new_start = eptr; + hw->html.new_start_pos = epos; + hw->html.new_end = NULL; + hw->html.new_end_pos = 0; + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; + } + else + { + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; + } + } + else + { + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; + } + hw->html.but_press_time = BuEvent->time; +} + + +static void +ExtendStart(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + HTMLWidget hw = (HTMLWidget)XtParent(w); + XButtonPressedEvent *BuEvent = (XButtonPressedEvent *)event; + struct ele_rec *eptr; + struct ele_rec *start, *end; + struct ele_rec *old_start, *old_end; + int old_start_pos, old_end_pos; + int start_pos, end_pos; + int epos; + + if (XtClass(XtParent(w)) != htmlWidgetClass) + { + return; + } + + eptr = LocateElement(hw, BuEvent->x, BuEvent->y, &epos); + + /* + * Ignore IMAGE elements. + */ + if ((eptr != NULL)&&(eptr->type == E_IMAGE)) + { + eptr = NULL; + } + + /* + * Ignore NULL elements. + * Ignore special internal text + * documents. + */ + if ((eptr != NULL)&&(eptr->internal == False)) + { + old_start = hw->html.new_start; + old_start_pos = hw->html.new_start_pos; + old_end = hw->html.new_end; + old_end_pos = hw->html.new_end_pos; + if (hw->html.new_start == NULL) + { + hw->html.new_start = hw->html.select_start; + hw->html.new_start_pos = hw->html.sel_start_pos; + hw->html.new_end = hw->html.select_end; + hw->html.new_end_pos = hw->html.sel_end_pos; + } + else + { + hw->html.new_end = eptr; + hw->html.new_end_pos = epos; + } + + if (SwapElements(hw->html.new_start, hw->html.new_end, + hw->html.new_start_pos, hw->html.new_end_pos)) + { + if (SwapElements(eptr, hw->html.new_end, + epos, hw->html.new_end_pos)) + { + start = hw->html.new_end; + start_pos = hw->html.new_end_pos; + end = eptr; + end_pos = epos; + } + else + { + start = hw->html.new_start; + start_pos = hw->html.new_start_pos; + end = eptr; + end_pos = epos; + } + } + else + { + if (SwapElements(eptr, hw->html.new_start, + epos, hw->html.new_start_pos)) + { + start = hw->html.new_start; + start_pos = hw->html.new_start_pos; + end = eptr; + end_pos = epos; + } + else + { + start = hw->html.new_end; + start_pos = hw->html.new_end_pos; + end = eptr; + end_pos = epos; + } + } + + if (start == NULL) + { + start = eptr; + start_pos = epos; + } + + if (old_start == NULL) + { + hw->html.new_start = hw->html.select_start; + hw->html.new_end = hw->html.select_end; + hw->html.new_start_pos = hw->html.sel_start_pos; + hw->html.new_end_pos = hw->html.sel_end_pos; + } + else + { + hw->html.new_start = old_start; + hw->html.new_end = old_end; + hw->html.new_start_pos = old_start_pos; + hw->html.new_end_pos = old_end_pos; + } + ChangeSelection(hw, start, end, start_pos, end_pos); + hw->html.new_start = start; + hw->html.new_end = end; + hw->html.new_start_pos = start_pos; + hw->html.new_end_pos = end_pos; + } + else + { + if (hw->html.new_start == NULL) + { + hw->html.new_start = hw->html.select_start; + hw->html.new_start_pos = hw->html.sel_start_pos; + hw->html.new_end = hw->html.select_end; + hw->html.new_end_pos = hw->html.sel_end_pos; + } + } + hw->html.press_x = BuEvent->x; + hw->html.press_y = BuEvent->y; +} + + +static void +ExtendAdjust(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + HTMLWidget hw = (HTMLWidget)XtParent(w); + XPointerMovedEvent *MoEvent = (XPointerMovedEvent *)event; + struct ele_rec *eptr; + struct ele_rec *start, *end; + int start_pos, end_pos; + int epos; + + if (XtClass(XtParent(w)) != htmlWidgetClass) + { + return; + } + + /* + * Very small mouse motion immediately after button press + * is ignored. + */ + if ((ABS((hw->html.press_x - MoEvent->x)) <= SELECT_THRESHOLD)&& + (ABS((hw->html.press_y - MoEvent->y)) <= SELECT_THRESHOLD)) + { + return; + } + + /* + * If we have an active anchor and we got here, we have moved the + * mouse too far. Deactivate anchor, and prime a selection. + * If the anchor is internal text, don't + * prime a selection. + */ + if (hw->html.active_anchor != NULL) + { + eptr = hw->html.active_anchor; + UnsetAnchor(hw); + if (eptr->internal == False) + { + hw->html.new_start = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end = NULL; + hw->html.new_end_pos = 0; + } + } + + /* + * If we used button2, we can't select text, so + * clear selection and exit here. + */ + if ((MoEvent->state & Button2Mask) != 0) + { + hw->html.select_start = NULL; + hw->html.select_end = NULL; + hw->html.sel_start_pos = 0; + hw->html.sel_end_pos = 0; + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + return; + } + + eptr = LocateElement(hw, MoEvent->x, MoEvent->y, &epos); + + /* + * If we are on an image pretend we are nowhere + * and just return; + */ + if ((eptr != NULL)&&(eptr->type == E_IMAGE)) + { + return; + } + + /* + * Ignore NULL items. + * Ignore if the same as last selected item and position. + * Ignore special internal text + */ + if ((eptr != NULL)&& + ((eptr != hw->html.new_end)||(epos != hw->html.new_end_pos))&& + (eptr->internal == False)) + { + start = hw->html.new_start; + start_pos = hw->html.new_start_pos; + end = eptr; + end_pos = epos; + if (start == NULL) + { + start = eptr; + start_pos = epos; + } + + ChangeSelection(hw, start, end, start_pos, end_pos); + hw->html.new_start = start; + hw->html.new_end = end; + hw->html.new_start_pos = start_pos; + hw->html.new_end_pos = end_pos; + } +} + + +static void +ExtendEnd(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + HTMLWidget hw = (HTMLWidget)XtParent(w); + XButtonReleasedEvent *BuEvent = (XButtonReleasedEvent *)event; + struct ele_rec *eptr; + struct ele_rec *start, *end; + Atom *atoms; + int i, buffer; + int start_pos, end_pos; + int epos; + char *text; + + if (XtClass(XtParent(w)) != htmlWidgetClass) + { + return; + } + + eptr = LocateElement(hw, BuEvent->x, BuEvent->y, &epos); + + /* + * If we just released button one or two, and we are on an object, + * and we have an active anchor, and we are on the active anchor, + * and if we havn't waited too long. Activate that anchor. + */ + if (((BuEvent->button == Button1)||(BuEvent->button == Button2))&& + (eptr != NULL)&& + (hw->html.active_anchor != NULL)&& + (eptr == hw->html.active_anchor)&& + ((BuEvent->time - hw->html.but_press_time) < CLICK_TIME)) + { + _HTMLInput(w, event, params, num_params); + return; + } + else if (hw->html.active_anchor != NULL) + { + start = hw->html.active_anchor; + UnsetAnchor(hw); + if (start->internal == False) + { + hw->html.new_start = eptr; + hw->html.new_start_pos = epos; + hw->html.new_end = NULL; + hw->html.new_end_pos = 0; + } + } + + /* + * If we used button2, we can't select text, so clear + * selection and exit here. + */ + if (BuEvent->button == Button2) + { + hw->html.new_start = hw->html.select_start; + hw->html.new_end = NULL; + hw->html.new_start_pos = hw->html.sel_start_pos; + hw->html.new_end_pos = 0; + return; + } + + /* + * If we are on an image, pretend we are nowhere + * and NULL out the eptr + */ + if ((eptr != NULL)&&(eptr->type == E_IMAGE)) + { + eptr = NULL; + } + + /* + * If button released on a NULL item, take the last non-NULL + * item that we highlighted. + */ + if ((eptr == NULL)&&(hw->html.new_end != NULL)) + { + eptr = hw->html.new_end; + epos = hw->html.new_end_pos; + } + + if ((eptr != NULL)&&(eptr->internal == False)&& + (hw->html.new_end != NULL)) + { + start = hw->html.new_start; + start_pos = hw->html.new_start_pos; + end = eptr; + end_pos = epos; + if (start == NULL) + { + start = eptr; + start_pos = epos; + } + ChangeSelection(hw, start, end, start_pos, end_pos); + hw->html.select_start = start; + hw->html.sel_start_pos = start_pos; + hw->html.select_end = end; + hw->html.sel_end_pos = end_pos; + SetSelection(hw); + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + + atoms = (Atom *)malloc(*num_params * sizeof(Atom)); + if (atoms == NULL) + { + fprintf(stderr, "cannot allocate atom list\n"); + return; + } + XmuInternStrings(XtDisplay((Widget)hw), params, *num_params, atoms); + hw->html.selection_time = BuEvent->time; + for (i=0; i< *num_params; i++) + { + switch (atoms[i]) + { + case XA_CUT_BUFFER0: buffer = 0; break; + case XA_CUT_BUFFER1: buffer = 1; break; + case XA_CUT_BUFFER2: buffer = 2; break; + case XA_CUT_BUFFER3: buffer = 3; break; + case XA_CUT_BUFFER4: buffer = 4; break; + case XA_CUT_BUFFER5: buffer = 5; break; + case XA_CUT_BUFFER6: buffer = 6; break; + case XA_CUT_BUFFER7: buffer = 7; break; + default: buffer = -1; break; + } + if (buffer >= 0) + { + if (hw->html.fancy_selections == True) + { + text = ParseTextToPrettyString(hw, + hw->html.formatted_elements, + hw->html.select_start, + hw->html.select_end, + hw->html.sel_start_pos, + hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + else + { + text = ParseTextToString( + hw->html.formatted_elements, + hw->html.select_start, + hw->html.select_end, + hw->html.sel_start_pos, + hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + XStoreBuffer(XtDisplay((Widget)hw), + text, strlen(text), buffer); + if (text != NULL) + { + free(text); + } + } + else + { + XtOwnSelection((Widget)hw, atoms[i], + BuEvent->time, + (XtConvertSelectionProc )ConvertSelection, + (XtLoseSelectionProc )LoseSelection, + (XtSelectionDoneProc )SelectionDone); + } + } + free((char *)atoms); + } + else if (eptr == NULL) + { + hw->html.select_start = NULL; + hw->html.sel_start_pos = 0; + hw->html.select_end = NULL; + hw->html.sel_end_pos = 0; + hw->html.new_start = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end = NULL; + hw->html.new_end_pos = 0; + } +} + + +#define LEAVING_ANCHOR(hw) \ + hw->html.cached_tracked_ele = NULL; \ + (*(pointerTrackProc) \ + (hw->html.pointer_motion_callback))(hw, hw->html.pm_client_data, ""); \ + XUndefineCursor (XtDisplay (hw), XtWindow (hw)); + +/* KNOWN PROBLEM: We never get LeaveNotify or FocusOut events, + despite the fact we've requested them. Bummer. */ +static void +TrackMotion(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + HTMLWidget hw = (HTMLWidget)XtParent(w); + struct ele_rec *eptr; + int epos, x, y; + + if (XtClass(XtParent(w)) != htmlWidgetClass) + { + return; + } + + if (!hw->html.pointer_motion_callback) + return; + + if (event->type == MotionNotify) + { + x = ((XMotionEvent *)event)->x; + y = ((XMotionEvent *)event)->y; + } + else if (event->type == LeaveNotify || event->type == FocusOut || + event->type == Expose) + { + /* Wipe out. */ + if (hw->html.cached_tracked_ele) + { + LEAVING_ANCHOR (hw); + } + return; + } + else + { + return; + } + + eptr = LocateElement(hw, x, y, &epos); + + /* We're hitting a new anchor if eptr exists and + eptr != cached tracked element and anchorHRef != NULL. */ + if (eptr != NULL && eptr != hw->html.cached_tracked_ele && + eptr->anchorHRef != NULL) + { + hw->html.cached_tracked_ele = eptr; + (*(pointerTrackProc) + (hw->html.pointer_motion_callback)) + (hw, hw->html.pm_client_data, eptr->anchorHRef); + XDefineCursor (XtDisplay (hw), XtWindow (hw), in_anchor_cursor); + } + /* We're leaving an anchor if eptr exists and + a cached ele exists and we're not entering a new anchor. */ + else if (eptr != NULL && hw->html.cached_tracked_ele != NULL && + eptr->anchorHRef == NULL) + { + LEAVING_ANCHOR (hw); + } + + return; +} + + +/* + * Scroll display vertically. + */ +static void +Scroll (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + register HTMLWidget hw = (HTMLWidget)XtParent(w); +#ifdef MOTIF + int val, size, inc, pageinc; +#endif + int offset, newy; + + if (XtClass(XtParent(w)) != htmlWidgetClass) + return; + + if (*num_params > 0) { + char *s = params[0]; + double fraction; + double atof(); + int ch; + + if (strcmp (s + strlen(s) - 2, "ch") == 0) { + fraction = atof (s); + ch = (hw->html.font->max_bounds.ascent + + hw->html.font->max_bounds.descent); + offset = fraction * ch; + } else + offset = (int)hw->html.view_height * atof(s); + + } else + offset = (int)hw->html.view_height / 10; + + newy = hw->html.scroll_y + offset; + if (newy < 0) + newy = 0; + if (newy > (hw->html.doc_height - (int)hw->html.view_height)) + newy = hw->html.doc_height - (int)hw->html.view_height; + if (newy < 0) + newy = 0; + +#ifdef MOTIF + XmScrollBarGetValues(hw->html.vbar, &val, &size, &inc, &pageinc); + XmScrollBarSetValues(hw->html.vbar, newy, size, inc, pageinc, True); + XmScrollBarGetValues(hw->html.hbar, &val, &size, &inc, &pageinc); + XmScrollBarSetValues(hw->html.hbar, 0, size, inc, pageinc, True); +#else + ScrollToPos(hw->html.vbar, hw, newy); + ScrollToPos(hw->html.hbar, hw, 0); + setScrollBar(hw->html.vbar, newy, + hw->html.doc_height, + (int)hw->html.view_height); +#endif +} + + +/* + * Process mouse input to the HTML widget + * Currently only processes an anchor-activate when Button1 + * is pressed + */ +static void +#ifdef _NO_PROTO +_HTMLInput( w, event, params, num_params) + Widget w ; + XEvent *event ; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +#else +_HTMLInput( + Widget w, + XEvent *event, + String *params, /* unused */ + Cardinal *num_params) /* unused */ +#endif +{ + HTMLWidget hw = (HTMLWidget)XtParent(w); + struct ele_rec *eptr; + WbAnchorCallbackData cbdata; + int epos; +#ifdef MOTIF + Boolean on_gadget; +#endif /* MOTIF */ + + if (XtClass(XtParent(w)) != htmlWidgetClass) + { + return; + } + +#ifdef MOTIF + /* + * If motif is defined, we don't want to process this button press + * if it is on a gadget + */ +#ifdef MOTIF1_2 + on_gadget = (_XmInputForGadget((Widget)hw, +#else + on_gadget = (_XmInputForGadget((CompositeWidget)hw, +#endif /* MOTIF1_2 */ + event->xbutton.x, event->xbutton.y) != NULL); + + if (on_gadget) + { + return; + } +#endif /* MOTIF */ + + if (event->type == ButtonRelease) + { + eptr = LocateElement(hw, event->xbutton.x, event->xbutton.y, + &epos); + if (eptr != NULL) + { + if (eptr->anchorHRef != NULL) + { + char *tptr, *ptr; + + /* + * Save the anchor text, replace newlines with + * spaces. + */ + tptr = ParseTextToString(hw->html.select_start, + hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + ptr = tptr; + while ((ptr != NULL)&&(*ptr != '\0')) + { + if (*ptr == '\n') + { + *ptr = ' '; + } + ptr++; + } + + /* + * Clear the activated anchor + */ + UnsetAnchor(hw); +#ifdef EXTRA_FLUSH + XFlush(XtDisplay(hw)); +#endif + + if ((IsDelayedHRef(hw, eptr->anchorHRef))&& + (hw->html.resolveDelayedImage != NULL)) + { + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveDelayedImage))(hw, eptr->edata); + + if (eptr->pic_data == NULL) + { + eptr->pic_data = NoImageData(hw); + eptr->pic_data->delayed = 0; + eptr->pic_data->internal = 0; + } + else + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + /* + * See if this is a special + * internal image + */ + if ((eptr->edata != NULL)&& + (strncmp(eptr->edata, + INTERNAL_IMAGE, + strlen(INTERNAL_IMAGE)) == 0)) + { + eptr->pic_data->internal = 1; + } + else + { + eptr->pic_data->internal = 0; + } + } + + ReformatWindow(hw); + ScrollWidgets(hw); + ViewClearAndRefresh(hw); + } + else if ((eptr->pic_data != NULL)&& + (eptr->pic_data->delayed)&& + (eptr->anchorHRef != NULL)&& + (IsIsMapForm(hw, eptr->anchorHRef))) + { + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveDelayedImage))(hw, eptr->edata); + + if (eptr->pic_data == NULL) + { + eptr->pic_data = NoImageData(hw); + eptr->pic_data->delayed = 0; + eptr->pic_data->internal = 0; + } + else + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + /* + * See if this is a special + * internal image + */ + if ((eptr->edata != NULL)&& + (strncmp(eptr->edata, + INTERNAL_IMAGE, + strlen(INTERNAL_IMAGE)) == 0)) + { + eptr->pic_data->internal = 1; + } + else + { + eptr->pic_data->internal = 0; + } + } + + ReformatWindow(hw); + ScrollWidgets(hw); + ViewClearAndRefresh(hw); + } + else if ((eptr->pic_data != NULL)&& + (eptr->pic_data->delayed)&& + (eptr->anchorHRef != NULL)&& + (!IsDelayedHRef(hw, eptr->anchorHRef))&& + (!IsIsMapForm(hw, eptr->anchorHRef))&& + (((event->xbutton.y + hw->html.scroll_y) - + (eptr->y + eptr->y_offset)) > + AnchoredHeight(hw))) + { + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveDelayedImage))(hw, eptr->edata); + + if (eptr->pic_data == NULL) + { + eptr->pic_data = NoImageData(hw); + eptr->pic_data->delayed = 0; + eptr->pic_data->internal = 0; + } + else + { + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + /* + * See if this is a special + * internal image + */ + if ((eptr->edata != NULL)&& + (strncmp(eptr->edata, + INTERNAL_IMAGE, + strlen(INTERNAL_IMAGE)) == 0)) + { + eptr->pic_data->internal = 1; + } + else + { + eptr->pic_data->internal = 0; + } + } + eptr->pic_data->delayed = 0; + + ReformatWindow(hw); + ScrollWidgets(hw); + ViewClearAndRefresh(hw); + } + else if ((eptr->pic_data != NULL)&& + (eptr->pic_data->ismap)&& + (eptr->anchorHRef != NULL)&& + (IsIsMapForm(hw, eptr->anchorHRef))) + { + int form_x, form_y; + + form_x = event->xbutton.x + hw->html.scroll_x - + eptr->x; + form_y = event->xbutton.y + hw->html.scroll_y - + eptr->y; + ImageSubmitForm(eptr->pic_data->fptr, event, + eptr->pic_data->text, form_x, form_y); + } + else + { + /* The following is a hack to send the + * selection location along with the HRef + * for images. This allows you to + * point at a location on a map and have + * the server send you the related document. + * Tony Sanders, April 1993 <sanders@bsdi.com> + */ + int alloced = 0; + char *buf = eptr->anchorHRef; + if (eptr->type == E_IMAGE && eptr->pic_data + && eptr->pic_data->ismap) { + buf = (char *) + malloc(strlen(eptr->anchorHRef) + 256); + alloced = 1; + sprintf(buf, "%s?%d,%d", + eptr->anchorHRef, + event->xbutton.x + hw->html.scroll_x - eptr->x, + event->xbutton.y + hw->html.scroll_y - eptr->y); + } + /* + * XXX: should call a media dependent + * function that decides how to munge the + * HRef. For example mpeg data will want + * to know on what frame the event occured. + * + * cddata.href = *(eptr->eventf)(eptr, event); + */ + cbdata.event = event; + cbdata.element_id = eptr->ele_id; + cbdata.href = buf; + /* cbdata.href = eptr->anchorHRef; */ + cbdata.text = tptr; + XtCallCallbackList ((Widget)hw, + hw->html.anchor_callback, + (XtPointer)&cbdata); + if (alloced) free(buf); + if (tptr != NULL) free(tptr); + } + } + } + } + + return; +} + + +#ifndef MOTIF +#include <X11/Xaw/AsciiText.h> +/* + * Process key input passwd widgets + */ +static void +#ifdef _NO_PROTO +_HTMLpwdInput( w, event, params, num_params) + Widget w ; + XEvent *event ; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +#else +_HTMLpwdInput( + Widget w, + XEvent *event, + String *params, /* unused */ + Cardinal *num_params) /* unused */ +#endif + { + char buffer[50]; + KeySym ks; + char *keySymString; + char *star = "*"; + int length, passwdLength, i, insertPos, maxLength; + Boolean stringInPlace; + + if (event->type == KeyPress) + { + HTMLWidget hw = (HTMLWidget)XtParent(XtParent(w)); + WidgetInfo *wptr; + + if (XtClass((Widget)hw) != htmlWidgetClass) + return; /* it was not for us */ + + /* + * find the structure for this widget + */ + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->w == w) + break; + wptr = wptr->next; + } + if (wptr == NULL) + return; + + passwdLength = wptr->password ? strlen(wptr->password) : 0; + + length = XLookupString((XKeyEvent *)event, + buffer, 50, &ks, NULL); + keySymString = XKeysymToString(ks); + XtVaGetValues(w, + XtNinsertPosition,&insertPos, + XtNuseStringInPlace, &stringInPlace, + XtNlength, &maxLength, + NULL); + + if (maxLength<1) maxLength = 1000000; + + if (!strcmp("Left",keySymString)) + { + if (insertPos > 0) + XtVaSetValues(w,XtNinsertPosition,--insertPos,NULL); + return; + } + else if (!strcmp("Right",keySymString)) + { + if (insertPos < passwdLength) + XtVaSetValues(w,XtNinsertPosition,++insertPos,NULL); + return; + } + + if ((!strcmp("BackSpace",keySymString)) + || (!strcmp("Backspace",keySymString)) + || (!strcmp("Delete",keySymString)) ) + { + insertPos --; + + if (passwdLength>0) + { + char *pwd = &(wptr->password[insertPos]); + + for (i = passwdLength - insertPos; i>0; i--,pwd++) + *pwd = *(pwd+1); + +/* fprintf(stderr,"modified passwd <%s>\n", wptr->password);*/ + XtCallActionProc(w, + insertPos>-1 ? "delete-previous-character" : + "delete-next-character", + event, NULL,0); + } + /* else nothing to erase */ + return; + } + + if (length == 1) + { + buffer[1] = '\0'; + + if (passwdLength>0) + { + + if (passwdLength < maxLength) + { + char *pwd = wptr->password = + (char *)realloc(wptr->password, + sizeof(char)*(passwdLength+2)); + for (i=passwdLength+1; i>insertPos; i--) + pwd[i] = pwd[i-1]; + + pwd[insertPos] = buffer[0]; + } + } + else + { + if (wptr->password == NULL) + wptr->password = (char *)malloc(sizeof(char)*2); + + wptr->password[0] = buffer[0]; + wptr->password[1] = '\0'; + } + + if (stringInPlace && passwdLength<maxLength) + { + char *txt; + /* insert string dumps core when string in place is true */ + + XtVaGetValues(w,XtNstring,&txt,NULL); + txt[passwdLength] = star[0]; + txt[passwdLength+1] = '\0'; + + /* the combined set values command does not work */ + XtVaSetValues(w, XtNstring,txt, NULL); + XtVaSetValues(w, XtNinsertPosition,insertPos+1, NULL); + } + else + XtCallActionProc(w, "insert-string", event, &star, 1); +/* fprintf(stderr,"modified passwd <%s>\n", wptr->password); */ + } + } + } +#endif /* not MOTIF */ + + +/* + * SetValues is called when XtSetValues is used to change resources in this + * widget. + */ +static Boolean +#ifdef _NO_PROTO +SetValues (current, request, new) + HTMLWidget current ; + HTMLWidget request ; + HTMLWidget new ; +#else +SetValues( + HTMLWidget current, + HTMLWidget request, + HTMLWidget new) +#endif +{ + int reformatted; + + /* + * Make sure the underline numbers are within bounds. + */ + if (request->html.num_anchor_underlines < 0) + { + new->html.num_anchor_underlines = 0; + } + if (request->html.num_anchor_underlines > MAX_UNDERLINES) + { + new->html.num_anchor_underlines = MAX_UNDERLINES; + } + if (request->html.num_visitedAnchor_underlines < 0) + { + new->html.num_visitedAnchor_underlines = 0; + } + if (request->html.num_visitedAnchor_underlines > MAX_UNDERLINES) + { + new->html.num_visitedAnchor_underlines = MAX_UNDERLINES; + } + + reformatted = 0; + if ((request->html.raw_text != current->html.raw_text)|| + (request->html.header_text != current->html.header_text)|| + (request->html.footer_text != current->html.footer_text)) + { + /* + * Free up the old visited href list. + */ + FreeHRefs(current->html.my_visited_hrefs); + new->html.my_visited_hrefs = NULL; + + /* + * Free up the old visited delayed images list. + */ + FreeDelayedImages(current->html.my_delayed_images); + new->html.my_delayed_images = NULL; + + /* + * Free any old colors and pixmaps + */ + FreeColors(XtDisplay(current), DefaultColormapOfScreen(XtScreen(current))); + FreeImages(current); + + /* + * Hide any old widgets + */ + HideWidgets(current); + new->html.widget_list = NULL; + new->html.form_list = NULL; + + /* + * Parse the raw text with the HTML parser + */ + new->html.html_objects = HTMLParse(current->html.html_objects, + request->html.raw_text); + CallLinkCallbacks(new); + new->html.html_header_objects = + HTMLParse(current->html.html_header_objects, + request->html.header_text); + new->html.html_footer_objects = + HTMLParse(current->html.html_footer_objects, + request->html.footer_text); + + /* + * Redisplay for the changed data. + */ + { + new->html.scroll_x = 0; + new->html.scroll_y = 0; + new->html.max_pre_width = DocumentWidth(new, + new->html.html_objects); + ReformatWindow(new); + ViewClearAndRefresh(new); + reformatted = 1; + } + + /* + * Clear any previous selection + */ + new->html.select_start = NULL; + new->html.select_end = NULL; + new->html.sel_start_pos = 0; + new->html.sel_end_pos = 0; + new->html.new_start = NULL; + new->html.new_end = NULL; + new->html.new_start_pos = 0; + new->html.new_end_pos = 0; + new->html.active_anchor = NULL; + } + else if ((request->html.font != current->html.font)|| + (request->html.italic_font != current->html.italic_font)|| + (request->html.bold_font != current->html.bold_font)|| + (request->html.fixed_font != current->html.fixed_font)|| + (request->html.fixedbold_font != current->html.fixedbold_font)|| + (request->html.fixeditalic_font != current->html.fixeditalic_font)|| + (request->html.header1_font != current->html.header1_font)|| + (request->html.header2_font != current->html.header2_font)|| + (request->html.header3_font != current->html.header3_font)|| + (request->html.header4_font != current->html.header4_font)|| + (request->html.header5_font != current->html.header5_font)|| + (request->html.header6_font != current->html.header6_font)|| + (request->html.address_font != current->html.address_font)|| + (request->html.plain_font != current->html.plain_font)|| + (request->html.plainbold_font != current->html.plainbold_font)|| + (request->html.plainitalic_font != current->html.plainitalic_font)|| + (request->html.listing_font != current->html.listing_font)|| + (request->html.activeAnchor_fg != current->html.activeAnchor_fg)|| + (request->html.activeAnchor_bg != current->html.activeAnchor_bg)|| + (request->html.anchor_fg != current->html.anchor_fg)|| + (request->html.visitedAnchor_fg != current->html.visitedAnchor_fg)|| + (request->html.dashed_anchor_lines != current->html.dashed_anchor_lines)|| + (request->html.dashed_visitedAnchor_lines != current->html.dashed_visitedAnchor_lines)|| + (request->html.num_anchor_underlines != current->html.num_anchor_underlines)|| + (request->html.num_visitedAnchor_underlines != current->html.num_visitedAnchor_underlines)) + { + if ((request->html.plain_font != current->html.plain_font)|| + (request->html.listing_font != current->html.listing_font)) + { + new->html.max_pre_width = DocumentWidth(new, + new->html.html_objects); + } + + ReformatWindow(new); + ScrollWidgets(new); + ViewClearAndRefresh(new); + reformatted = 1; + } + + /* + * image borders have been changed + */ + if (request->html.border_images != current->html.border_images) + { + ReformatWindow(new); + ScrollWidgets(new); + ViewClearAndRefresh(new); + reformatted = 1; + } + + /* + * vertical space has been changed + */ + if(request->html.percent_vert_space != current->html.percent_vert_space) + { + ReformatWindow(new); + ScrollWidgets(new); + ViewClearAndRefresh(new); + reformatted = 1; + } + + /* + * Set client data for retest anchors callback. + */ + if(request->html.vt_client_data != current->html.vt_client_data) + { + new->html.vt_client_data = request->html.vt_client_data; + } + + /* + * Set client data for pointer motion callback. + */ + if(request->html.pm_client_data != current->html.pm_client_data) + { + new->html.pm_client_data = request->html.pm_client_data; + } + + return(False); +} + + +/* + * Go through the parsed marks and for all the <LINK> tags in the document + * call the LinkCallback. + */ +static void +#ifdef _NO_PROTO +CallLinkCallbacks(hw) + HTMLWidget hw; +#else +CallLinkCallbacks(HTMLWidget hw) +#endif +{ + struct mark_up *mptr; + LinkInfo l_info; + + mptr = hw->html.html_objects; + while (mptr != NULL) + { + if (mptr->type == M_BASE) + { + l_info.href = ParseMarkTag(mptr->start, MT_BASE, + "HREF"); + l_info.role = ParseMarkTag(mptr->start, MT_BASE, + "ROLE"); + XtCallCallbackList ((Widget)hw, hw->html.link_callback, + (XtPointer)&l_info); + if (l_info.href != NULL) + { + free(l_info.href); + } + if (l_info.role != NULL) + { + free(l_info.role); + } + } + mptr = mptr->next; + } +} + + +/* + * Search through the whole document, and recolor the internal elements with + * the passed HREF. + */ +static void +#ifdef _NO_PROTO +RecolorInternalHRefs(hw, href) + HTMLWidget hw; + char *href; +#else +RecolorInternalHRefs(HTMLWidget hw, char *href) +#endif +{ + struct ele_rec *start; + unsigned long fg; + + fg = hw->html.visitedAnchor_fg; + start = hw->html.formatted_elements; + while (start != NULL) + { + /* + * This one is internal + * This one has an href + * This is the href we want + */ + if ((start->internal == True)&& + (start->anchorHRef != NULL)&& + (strcmp(start->anchorHRef, href) == 0)) + { + start->fg = fg; + start->underline_number = + hw->html.num_visitedAnchor_underlines; + start->dashed_underline = + hw->html.dashed_visitedAnchor_lines; + } + start = start->next; + } +} + + +static Boolean +ConvertSelection(w, selection, target, type, value, length, format) + Widget w; + Atom *selection, *target, *type; + caddr_t *value; + unsigned long *length; + int *format; +{ + Display *d = XtDisplay(w); + HTMLWidget hw = (HTMLWidget)w; + char *text; + + if (hw->html.select_start == NULL) + { + return False; + } + + if (*target == XA_TARGETS(d)) + { + Atom *targetP; + Atom *std_targets; + unsigned long std_length; + XmuConvertStandardSelection( w, hw->html.selection_time, + selection, target, type, (caddr_t*)&std_targets, + &std_length, format); + + *length = std_length + 5; + *value = (caddr_t)XtMalloc(sizeof(Atom)*(*length)); + targetP = *(Atom**)value; + *targetP++ = XA_STRING; + *targetP++ = XA_TEXT(d); + *targetP++ = XA_COMPOUND_TEXT(d); + *targetP++ = XA_LENGTH(d); + *targetP++ = XA_LIST_LENGTH(d); + + bcopy((char*)std_targets, (char*)targetP, + sizeof(Atom)*std_length); + XtFree((char*)std_targets); + *type = XA_ATOM; + *format = 32; + return True; + } + + if (*target == XA_STRING || *target == XA_TEXT(d) || + *target == XA_COMPOUND_TEXT(d)) + { + if (*target == XA_COMPOUND_TEXT(d)) + { + *type = *target; + } + else + { + *type = XA_STRING; + } + if (hw->html.fancy_selections == True) + { + text = ParseTextToPrettyString(hw, + hw->html.formatted_elements, + hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + else + { + text = ParseTextToString(hw->html.formatted_elements, + hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + *value = text; + *length = strlen(*value); + *format = 8; + return True; + } + + if (*target == XA_LIST_LENGTH(d)) + { + *value = XtMalloc(4); + if (sizeof(long) == 4) + { + *(long*)*value = 1; + } + else + { + long temp = 1; + bcopy( ((char*)&temp)+sizeof(long)-4, (char*)*value, 4); + } + *type = XA_INTEGER; + *length = 1; + *format = 32; + return True; + } + + if (*target == XA_LENGTH(d)) + { + if (hw->html.fancy_selections == True) + { + text = ParseTextToPrettyString(hw, + hw->html.formatted_elements, + hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + else + { + text = ParseTextToString(hw->html.formatted_elements, + hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + *value = XtMalloc(4); + if (sizeof(long) == 4) + { + *(long*)*value = strlen(text); + } + else + { + long temp = strlen(text); + bcopy( ((char*)&temp)+sizeof(long)-4, (char*)*value, 4); + } + free(text); + *type = XA_INTEGER; + *length = 1; + *format = 32; + return True; + } + + if (XmuConvertStandardSelection(w, hw->html.selection_time, selection, + target, type, value, length, format)) + { + return True; + } + + return False; +} + + +static void +LoseSelection(w, selection) + Widget w; + Atom *selection; +{ + HTMLWidget hw = (HTMLWidget)w; + + ClearSelection(hw); +} + + +static void +SelectionDone(w, selection, target) + Widget w; + Atom *selection, *target; +{ + /* empty proc so Intrinsics know we want to keep storage */ +} + + +/* + ************************************************************************* + ******************************* PUBLIC FUNCTIONS ************************ + ************************************************************************* + */ + + +/* + * Convenience function to return the text of the HTML document as a plain + * ascii text string. + * This function allocates memory for the returned string, that it is up + * to the user to free. + * Extra option flags "pretty" text to be returned. + * when pretty is two or larger, Postscript is returned. The font used is + * encoded in the pretty parameter: + * pretty = 2: Times + * pretty = 3: Helvetica + * pretty = 4: New century schoolbook + * pretty = 5: Lucida Bright + */ +char * +#ifdef _NO_PROTO +HTMLGetText (w, pretty) + Widget w; + int pretty; +#else +HTMLGetText(Widget w, int pretty) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + char *text; + char *tptr, *buf; + struct ele_rec *start; + struct ele_rec *end; + + text = NULL; + start = hw->html.formatted_elements; + end = start; + while (end != NULL) + { + end = end->next; + } + + if (pretty >= 2) + { + tptr = ParseTextToPSString(hw, start, start, end, + 0, 0, + hw->html.font->max_bounds.width, + hw->html.margin_width , pretty-2); + } + else if (pretty) + { + tptr = ParseTextToPrettyString(hw, start, start, end, + 0, 0, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + else + { + tptr = ParseTextToString(start, start, end, + 0, 0, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + if (tptr != NULL) + { + if (text == NULL) + { + text = tptr; + } + else + { + buf = (char *)malloc(strlen(text) + + strlen(tptr) + 1); + strcpy(buf, text); + strcat(buf, tptr); + free(text); + free(tptr); + text = buf; + } + } + return(text); +} + + +/* + * Convenience function to return the element id of the element + * nearest to the x,y coordinates passed in. + * If there is no element there, return the first element in the + * line we are on. If there we are on no line, either return the + * beginning, or the end of the document. + */ +int +#ifdef _NO_PROTO +HTMLPositionToId(w, x, y) + Widget w; + int x, y; +#else +HTMLPositionToId(Widget w, int x, int y) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + int i; + int epos; + struct ele_rec *eptr; + + eptr = LocateElement(hw, x, y, &epos); + if (eptr == NULL) + { + x = x + hw->html.scroll_x; + y = y + hw->html.scroll_y; + eptr = hw->html.line_array[0]; + for (i=0; i<hw->html.line_count; i++) + { + if (hw->html.line_array[i] == NULL) + { + continue; + } + else if (hw->html.line_array[i]->y <= y) + { + eptr = hw->html.line_array[i]; + continue; + } + else + { + break; + } + } + } + + /* + * 0 means the very top of the document. We put you there for + * unfound elements. + * We also special case for when the scrollbar is at the + * absolute top. + */ + if ((eptr == NULL)||(hw->html.scroll_y == 0)) + { + return(0); + } + else + { + return(eptr->ele_id); + } +} + + +/* + * Convenience function to return the position of the element + * based on the element id passed in. + * Function returns 1 on success and fills in x,y pixel values. + * If there is no such element, x=0, y=0 and -1 is returned. + */ +int +#ifdef _NO_PROTO +HTMLIdToPosition(w, element_id, x, y) + Widget w; + int element_id; + int *x, *y; +#else +HTMLIdToPosition(Widget w, int element_id, int *x, int *y) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct ele_rec *start; + struct ele_rec *eptr; + + eptr = NULL; + start = hw->html.formatted_elements; + while (start != NULL) + { + if (start->ele_id == element_id) + { + eptr = start; + break; + } + start = start->next; + } + + if (eptr == NULL) + { + *x = 0; + *y = 0; + return(-1); + } + else + { + *x = eptr->x; + *y = eptr->y; + return(1); + } +} + + +/* + * Convenience function to position the element + * based on the element id passed at the top of the viewing area. + * A passed in id of 0 means goto the top. + */ +void +#ifdef _NO_PROTO +HTMLGotoId(w, element_id) + Widget w; + int element_id; +#else +HTMLGotoId(Widget w, int element_id) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct ele_rec *start; + struct ele_rec *eptr; + int newy; +#ifdef MOTIF + int val, size, inc, pageinc; +#endif + + /* + * If we have no scrollbar, just return. + */ + if (hw->html.use_vbar == False) + { + return; + } + + /* + * Find the element corrsponding to the id passed in. + */ + eptr = NULL; + start = hw->html.formatted_elements; + while (start != NULL) + { + if (start->ele_id == element_id) + { + eptr = start; + break; + } + start = start->next; + } + + /* + * No such element, do nothing. + */ + if ((element_id != 0)&&(eptr == NULL)) + { + return; + } + + if (element_id == 0) + { + newy = 0; + } + else + { + newy = eptr->y - 2; + } + if (newy < 0) + { + newy = 0; + } + if (newy > (hw->html.doc_height - (int)hw->html.view_height)) + { + newy = hw->html.doc_height - (int)hw->html.view_height; + } + if (newy < 0) + { + newy = 0; + } +#ifdef MOTIF + XmScrollBarGetValues(hw->html.vbar, &val, &size, &inc, &pageinc); + XmScrollBarSetValues(hw->html.vbar, newy, size, inc, pageinc, True); + XmScrollBarGetValues(hw->html.hbar, &val, &size, &inc, &pageinc); + XmScrollBarSetValues(hw->html.hbar, 0, size, inc, pageinc, True); +#else + ScrollToPos(hw->html.vbar, hw, newy); + ScrollToPos(hw->html.hbar, hw, 0); + setScrollBar(hw->html.vbar, newy, + hw->html.doc_height, + (int)hw->html.view_height); +#endif +} + + +/* + * Convenience function to return the position of the anchor + * based on the anchor NAME passed. + * Function returns 1 on success and fills in x,y pixel values. + * If there is no such element, x=0, y=0 and -1 is returned. + */ +int +#ifdef _NO_PROTO +HTMLAnchorToPosition(w, name, x, y) + Widget w; + char *name; + int *x, *y; +#else +HTMLAnchorToPosition(Widget w, char *name, int *x, int *y) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct ele_rec *start; + struct ele_rec *eptr; + + eptr = NULL; + start = hw->html.formatted_elements; + while (start != NULL) + { + if ((start->anchorName)&& + (strcmp(start->anchorName, name) == 0)) + { + eptr = start; + break; + } + start = start->next; + } + + if (eptr == NULL) + { + *x = 0; + *y = 0; + return(-1); + } + else + { + *x = eptr->x; + *y = eptr->y; + return(1); + } +} + + +/* + * Convenience function to return the element id of the anchor + * based on the anchor NAME passed. + * Function returns id on success. + * If there is no such element, 0 is returned. + */ +int +#ifdef _NO_PROTO +HTMLAnchorToId(w, name) + Widget w; + char *name; +#else +HTMLAnchorToId(Widget w, char *name) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct ele_rec *start; + struct ele_rec *eptr; + + /* + * Find the passed anchor name + */ + eptr = NULL; + start = hw->html.formatted_elements; + while (start != NULL) + { + if ((start->anchorName)&& /* MF023 */ + ((strcmp(start->anchorName, name) == 0) || + (*name == '#' && strcmp(start->anchorName, &(name[1])) == 0)) ) { + eptr = start; + break; + } + start = start->next; + } + + if (eptr == NULL) + { + return(0); + } + else + { + return(eptr->ele_id); + } +} + + +/* + * Convenience function to return the HREFs of all active anchors in the + * document. + * Function returns an array of strings and fills num_hrefs passed. + * If there are no HREFs NULL returned. + */ +char ** +#ifdef _NO_PROTO +HTMLGetHRefs(w, num_hrefs) + Widget w; + int *num_hrefs; +#else +HTMLGetHRefs(Widget w, int *num_hrefs) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + int cnt; + struct ele_rec *start; + struct ele_rec *list; + struct ele_rec *eptr; + char **harray; + + list = NULL; + cnt = 0; + /* + * Construct a linked list of all the diffeent hrefs, counting + * then as we go. + */ + start = hw->html.formatted_elements; + while (start != NULL) + { + /* + * This one has an HREF + */ + if (start->anchorHRef != NULL) + { + /* + * Check to see if we already have + * this HREF in our list. + */ + eptr = list; + while (eptr != NULL) + { + if (strcmp(eptr->anchorHRef, + start->anchorHRef) == 0) + { + break; + } + eptr = eptr->next; + } + /* + * This HREF is not, in our list. Add it. + * That is, if it's not an internal reference. + */ + if ((eptr == NULL)&&(start->internal == False)) + { + eptr = (struct ele_rec *) + malloc(sizeof(struct ele_rec)); + eptr->anchorHRef = start->anchorHRef; + eptr->next = list; + list = eptr; + cnt++; + } + } + start = start->next; + } + + if (cnt == 0) + { + *num_hrefs = 0; + return(NULL); + } + else + { + *num_hrefs = cnt; + harray = (char **)malloc(sizeof(char *) * cnt); + eptr = list; + cnt--; + while (eptr != NULL) + { + harray[cnt] = (char *) + malloc(strlen(eptr->anchorHRef) + 1); + strcpy(harray[cnt], eptr->anchorHRef); + start = eptr; + eptr = eptr->next; + free((char *)start); + cnt--; + } + return(harray); + } +} + + +/* + * Convenience function to return the SRCs of all images in the + * document. + * Function returns an array of strings and fills num_srcs passed. + * If there are no SRCs NULL returned. + */ +char ** +#ifdef _NO_PROTO +HTMLGetImageSrcs(w, num_srcs) + Widget w; + int *num_srcs; +#else +HTMLGetImageSrcs(Widget w, int *num_srcs) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct mark_up *mptr; + int cnt; + char *tptr; + char **harray; + + cnt = 0; + mptr = hw->html.html_objects; + while (mptr != NULL) + { + if (mptr->type == M_IMAGE) + { + tptr = ParseMarkTag(mptr->start, MT_IMAGE, "SRC"); + if ((tptr != NULL)&&(*tptr != '\0')) + { + cnt++; + free(tptr); + } + } + mptr = mptr->next; + } + + if (cnt == 0) + { + *num_srcs = 0; + return(NULL); + } + else + { + *num_srcs = cnt; + harray = (char **)malloc(sizeof(char *) * cnt); + mptr = hw->html.html_objects; + cnt = 0; + while (mptr != NULL) + { + if (mptr->type == M_IMAGE) + { + tptr = ParseMarkTag(mptr->start,MT_IMAGE,"SRC"); + if ((tptr != NULL)&&(*tptr != '\0')) + { + harray[cnt] = tptr; + cnt++; + } + } + mptr = mptr->next; + } + return(harray); + } +} + + +/* + * Convenience function to return the link information + * for all the <LINK> tags in the document. + * Function returns an array of LinkInfo structures and fills + * num_links passed. + * If there are no LINKs NULL returned. + */ +LinkInfo * +#ifdef _NO_PROTO +HTMLGetLinks(w, num_links) + Widget w; + int *num_links; +#else +HTMLGetLinks(Widget w, int *num_links) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct mark_up *mptr; + int cnt; + char *tptr; + LinkInfo *larray; + + cnt = 0; + mptr = hw->html.html_objects; + while (mptr != NULL) + { + if (mptr->type == M_BASE) + { + cnt++; + } + mptr = mptr->next; + } + + if (cnt == 0) + { + *num_links = 0; + return(NULL); + } + else + { + *num_links = cnt; + larray = (LinkInfo *)malloc(sizeof(LinkInfo) * cnt); + mptr = hw->html.html_objects; + cnt = 0; + while (mptr != NULL) + { + if (mptr->type == M_BASE) + { + tptr = ParseMarkTag(mptr->start, + MT_BASE, "HREF"); + larray[cnt].href = tptr; + tptr = ParseMarkTag(mptr->start, + MT_BASE, "ROLE"); + larray[cnt].role = tptr; + cnt++; + } + mptr = mptr->next; + } + return(larray); + } +} + + + +void * +#ifdef _NO_PROTO +HTMLGetWidgetInfo(w) + Widget w; +#else +HTMLGetWidgetInfo(Widget w) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + + return((void *)hw->html.widget_list); +} + + +void +#ifdef _NO_PROTO +HTMLFreeImageInfo(w) + Widget w; +#else +HTMLFreeImageInfo(Widget w) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + + FreeColors(XtDisplay(w), DefaultColormapOfScreen(XtScreen(w))); + FreeImages(hw); +} + + +void +#ifdef _NO_PROTO +HTMLFreeWidgetInfo(ptr) + void *ptr; +#else +HTMLFreeWidgetInfo(void *ptr) +#endif +{ + WidgetInfo *wptr = (WidgetInfo *)ptr; + WidgetInfo *tptr; + + while (wptr != NULL) + { + tptr = wptr; + wptr = wptr->next; + if (tptr->w != NULL) + { + /* + * This is REALLY DUMB, but X generates an expose event + * for the destruction of the Widgte, even if it isn't + * mapped at the time it is destroyed. + * So I move the invisible widget to -1000,-1000 + * before destroying it, to avoid a visible flash. + */ + XtMoveWidget(tptr->w, -1000, -1000); + XtDestroyWidget(tptr->w); + } + if (tptr->name != NULL) + { + free(tptr->name); + } + if ((tptr->value != NULL)&&(tptr->type != W_OPTIONMENU)) + { + free(tptr->value); + } + free((char *)tptr); + } +} + + +/* + * Convenience function to redraw all active anchors in the + * document. + * Can also pass a new predicate function to check visited + * anchors. If NULL passed for function, uses default predicate + * function. + */ +void +#ifdef _NO_PROTO +HTMLRetestAnchors(w, testFunc, client_data) + Widget w; + visitTestProc testFunc; + XtPointer client_data; +#else +HTMLRetestAnchors(Widget w, visitTestProc testFunc, XtPointer client_data) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + struct ele_rec *start; + int stat = 0; + + if (testFunc == NULL) + { + testFunc = (visitTestProc)hw->html.previously_visited_test; + client_data = hw->html.vt_client_data; + } + + /* + * Search all elements + */ + start = hw->html.formatted_elements; + while (start != NULL) + { + if ((start->internal == True)|| + (start->anchorHRef == NULL)) + { + start = start->next; + continue; + } + + if (testFunc != NULL) + { + if ((stat=(*testFunc)(hw, client_data, start->anchorHRef))) + { + start->fg = hw->html.visitedAnchor_fg; + start->underline_number = + hw->html.num_visitedAnchor_underlines; + start->dashed_underline = + hw->html.dashed_visitedAnchor_lines; + } + else + { + start->fg = hw->html.anchor_fg; + start->underline_number = + hw->html.num_anchor_underlines; + start->dashed_underline = + hw->html.dashed_anchor_lines; + } + } + else + { + start->fg = hw->html.anchor_fg; + start->underline_number = + hw->html.num_anchor_underlines; + start->dashed_underline = + hw->html.dashed_anchor_lines; + } + + /* + * Since the element may have changed, redraw it + */ + if (stat) { + switch(start->type) + { + case E_TEXT: + TextRefresh(hw, start, + 0, (start->edata_len - 2)); + break; + case E_IMAGE: + ImageRefresh(hw, start); + break; + case E_BULLET: + BulletRefresh(hw, start); + break; + case E_LINEFEED: + LinefeedRefresh(hw, start); + break; + } + } + + start = start->next; + } +} + + +void +#ifdef _NO_PROTO +HTMLClearSelection (w) + Widget w; +#else +HTMLClearSelection(Widget w) +#endif +{ + LoseSelection (w, NULL); +} + + +/* + * Set the current selection based on the ElementRefs passed in. + * Both refs must be valid. + */ +void +#ifdef _NO_PROTO +HTMLSetSelection (w, start, end) + Widget w; + ElementRef *start; + ElementRef *end; +#else +HTMLSetSelection(Widget w, ElementRef *start, ElementRef *end) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + int found; + struct ele_rec *eptr; + struct ele_rec *e_start; + struct ele_rec *e_end; + int start_pos, end_pos; + Atom *atoms; + int i, buffer; + char *text; + char *params[2]; + + /* + * If the starting position is not valid, fail the selection + */ + if ((start->id > 0)&&(start->pos >= 0)) + { + found = 0; + eptr = hw->html.formatted_elements; + + while (eptr != NULL) + { + if (eptr->ele_id == start->id) + { + e_start = eptr; + start_pos = start->pos; + found = 1; + break; + } + eptr = eptr->next; + } + if (!found) + { + return; + } + } + + /* + * If the ending position is not valid, fail the selection + */ + if ((end->id > 0)&&(end->pos >= 0)) + { + found = 0; + eptr = hw->html.formatted_elements; + + while (eptr != NULL) + { + if (eptr->ele_id == end->id) + { + e_end = eptr; + end_pos = end->pos; + found = 1; + break; + } + eptr = eptr->next; + } + if (!found) + { + return; + } + } + + LoseSelection (w, NULL); + + /* + * We expect the ElementRefs came from HTMLSearchText, so we know + * that the end_pos is one past what we want to select. + */ + end_pos = end_pos - 1; + + /* + * Sanify the position data + */ + if ((start_pos > 0)&&(start_pos >= e_start->edata_len - 1)) + { + start_pos = e_start->edata_len - 2; + } + if ((end_pos > 0)&&(end_pos >= e_end->edata_len - 1)) + { + end_pos = e_end->edata_len - 2; + } + + hw->html.select_start = e_start; + hw->html.sel_start_pos = start_pos; + hw->html.select_end = e_end; + hw->html.sel_end_pos = end_pos; + SetSelection(hw); + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + + /* + * Do all the gunk from the end of the ExtendEnd function + */ + params[0] = "PRIMARY"; + params[1] = "CUT_BUFFER0"; + atoms = (Atom *)malloc(2 * sizeof(Atom)); + if (atoms == NULL) + { + fprintf(stderr, "cannot allocate atom list\n"); + return; + } + XmuInternStrings(XtDisplay((Widget)hw), params, 2, atoms); + hw->html.selection_time = CurrentTime; + for (i=0; i< 2; i++) + { + switch (atoms[i]) + { + case XA_CUT_BUFFER0: buffer = 0; break; + case XA_CUT_BUFFER1: buffer = 1; break; + case XA_CUT_BUFFER2: buffer = 2; break; + case XA_CUT_BUFFER3: buffer = 3; break; + case XA_CUT_BUFFER4: buffer = 4; break; + case XA_CUT_BUFFER5: buffer = 5; break; + case XA_CUT_BUFFER6: buffer = 6; break; + case XA_CUT_BUFFER7: buffer = 7; break; + default: buffer = -1; break; + } + if (buffer >= 0) + { + if (hw->html.fancy_selections == True) + { + text = ParseTextToPrettyString(hw, + hw->html.formatted_elements, + hw->html.select_start, + hw->html.select_end, + hw->html.sel_start_pos, + hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + else + { + text = ParseTextToString( + hw->html.formatted_elements, + hw->html.select_start, + hw->html.select_end, + hw->html.sel_start_pos, + hw->html.sel_end_pos, + hw->html.font->max_bounds.width, + hw->html.margin_width); + } + XStoreBuffer(XtDisplay((Widget)hw), + text, strlen(text), buffer); + free(text); + } + else + { + XtOwnSelection((Widget)hw, atoms[i], CurrentTime, + (XtConvertSelectionProc )ConvertSelection, + (XtLoseSelectionProc )LoseSelection, + (XtSelectionDoneProc )SelectionDone); + } + } + free((char *)atoms); +} + + +/* + * Convenience function to return the text of the HTML document as a single + * white space separated string, with pointers to the various start and + * end points of selections. + * This function allocates memory for the returned string, that it is up + * to the user to free. + */ +char * +#ifdef _NO_PROTO +HTMLGetTextAndSelection (w, startp, endp, insertp) + Widget w; + char **startp; + char **endp; + char **insertp; +#else +HTMLGetTextAndSelection(Widget w, char **startp, char **endp, char **insertp) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + int length; + char *text; + char *tptr; + struct ele_rec *eptr; + struct ele_rec *sel_start; + struct ele_rec *sel_end; + struct ele_rec *insert_start; + int start_pos, end_pos, insert_pos; + + if (SwapElements(hw->html.select_start, hw->html.select_end, + hw->html.sel_start_pos, hw->html.sel_end_pos)) + { + sel_end = hw->html.select_start; + end_pos = hw->html.sel_start_pos; + sel_start = hw->html.select_end; + start_pos = hw->html.sel_end_pos; + } + else + { + sel_start = hw->html.select_start; + start_pos = hw->html.sel_start_pos; + sel_end = hw->html.select_end; + end_pos = hw->html.sel_end_pos; + } + + insert_start = hw->html.new_start; + insert_pos = hw->html.new_start_pos; + *startp = NULL; + *endp = NULL; + *insertp = NULL; + + length = 0; + + eptr = hw->html.formatted_elements; + while (eptr != NULL) + { + /* + * Skip the special internal text + */ + if (eptr->internal == True) + { + eptr = eptr->next; + continue; + } + + if (eptr->type == E_TEXT) + { + length = length + eptr->edata_len - 1; + } + else if (eptr->type == E_LINEFEED) + { + length = length + 1; + } + eptr = eptr->next; + } + + text = (char *)malloc(length + 1); + if (text == NULL) + { + fprintf(stderr, "No space for return string\n"); + return(NULL); + } + strcpy(text, ""); + + tptr = text; + + eptr = hw->html.formatted_elements; + while (eptr != NULL) + { + /* + * Skip the special internal text + */ + if (eptr->internal == True) + { + eptr = eptr->next; + continue; + } + + if (eptr->type == E_TEXT) + { + if (eptr == sel_start) + { + *startp = (char *)(tptr + start_pos); + } + + if (eptr == sel_end) + { + *endp = (char *)(tptr + end_pos); + } + + if (eptr == insert_start) + { + *insertp = (char *)(tptr + insert_pos); + } + + strcat(text, (char *)eptr->edata); + tptr = tptr + eptr->edata_len - 1; + } + else if (eptr->type == E_LINEFEED) + { + if (eptr == sel_start) + { + *startp = tptr; + } + + if (eptr == sel_end) + { + *endp = tptr; + } + + if (eptr == insert_start) + { + *insertp = tptr; + } + + strcat(text, " "); + tptr = tptr + 1; + } + eptr = eptr->next; + } + return(text); +} + + +/* + * Convenience function to set the raw text into the widget. + * Forces a reparse and a reformat. + * If any pointer is passed in as NULL that text is unchanged, + * if a pointer points to an empty string, that text is set to NULL; + * Also pass an element ID to set the view area to that section of the new + * text. Finally pass an anchor NAME to set position of the new text + * to that anchor. + */ +void +#ifdef _NO_PROTO +HTMLSetText (w, text, header_text, footer_text, element_id, target_anchor, ptr) + Widget w; + char *text; + char *header_text; + char *footer_text; + int element_id; + char *target_anchor; + void *ptr; +#else +HTMLSetText(Widget w, char *text, char *header_text, char *footer_text, int element_id, char *target_anchor, void *ptr) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + WidgetInfo *wptr = (WidgetInfo *)ptr; + struct ele_rec *start; + struct ele_rec *eptr; + int newy; + + if ((text == NULL)&&(header_text == NULL)&&(footer_text == NULL)) + { + return; + } + + /* + * Free up the old visited href list. + */ + FreeHRefs(hw->html.my_visited_hrefs); + hw->html.my_visited_hrefs = NULL; + + /* + * Free up the old visited delayed images list. + */ + FreeDelayedImages(hw->html.my_delayed_images); + hw->html.my_delayed_images = NULL; + + /* + * Hide any old widgets + */ + HideWidgets(hw); + hw->html.widget_list = wptr; + hw->html.form_list = NULL; + + if (text != NULL) + { + if (*text == '\0') + { + text = NULL; + } + hw->html.raw_text = text; + + /* + * Free any old colors and pixmaps + */ + FreeColors(XtDisplay(hw),DefaultColormapOfScreen(XtScreen(hw))); + FreeImages(hw); + + /* + * Parse the raw text with the HTML parser + */ + hw->html.html_objects = HTMLParse(hw->html.html_objects, + hw->html.raw_text); + CallLinkCallbacks(hw); + } + if (header_text != NULL) + { + if (*header_text == '\0') + { + header_text = NULL; + } + hw->html.header_text = header_text; + + /* + * Parse the header text with the HTML parser + */ + hw->html.html_header_objects = + HTMLParse(hw->html.html_header_objects, + hw->html.header_text); + } + if (footer_text != NULL) + { + if (*footer_text == '\0') + { + footer_text = NULL; + } + hw->html.footer_text = footer_text; + + /* + * Parse the footer text with the HTML parser + */ + hw->html.html_footer_objects = + HTMLParse(hw->html.html_footer_objects, + hw->html.footer_text); + } + + /* + * Reformat the new text + */ + hw->html.max_pre_width = DocumentWidth(hw, hw->html.html_objects); + ReformatWindow(hw); + + /* + * If a target anchor is passed, override the element id + * with the id of that anchor. + */ + if (target_anchor != NULL) + { + int id; + + id = HTMLAnchorToId(w, target_anchor); + if (id != 0) + { + element_id = id; + } + } + + /* + * Position text at id specified, or at top if no position + * specified. + * Find the element corrsponding to the id passed in. + */ + eptr = NULL; + if (element_id != 0) + { + start = hw->html.formatted_elements; + while (start != NULL) + { + if (start->ele_id == element_id) + { + eptr = start; + break; + } + start = start->next; + } + } + if (eptr == NULL) + { + newy = 0; + } + else + { + newy = eptr->y - 2; + } + if (newy < 0) + { + newy = 0; + } + if (newy > (hw->html.doc_height - (int)hw->html.view_height)) + { + newy = hw->html.doc_height - (int)hw->html.view_height; + } + if (newy < 0) + { + newy = 0; + } + hw->html.scroll_x = 0; + hw->html.scroll_y = newy; +#ifdef DEBUG +fprintf (stderr, "calling in HTMLSetText\n"); +#endif + ConfigScrollBars(hw); + ScrollWidgets(hw); + + /* + * Display the new text + */ + ViewClearAndRefresh(hw); + + /* + * Clear any previous selection + */ + hw->html.select_start = NULL; + hw->html.select_end = NULL; + hw->html.sel_start_pos = 0; + hw->html.sel_end_pos = 0; + hw->html.new_start = NULL; + hw->html.new_end = NULL; + hw->html.new_start_pos = 0; + hw->html.new_end_pos = 0; + hw->html.active_anchor = NULL; + + hw->html.cached_tracked_ele = NULL; +} + + +/* + * To use faster TOLOWER as set up in HTMLparse.c + */ +#ifdef NOT_ASCII +#define TOLOWER(x) (tolower(x)) +#else +extern char map_table[]; +#define TOLOWER(x) (map_table[x]) +#endif /* NOT_ASCII */ + + +/* + * Convenience function to search the text of the HTML document as a single + * white space separated string. Linefeeds are converted into spaces. + * + * Takes a pattern, pointers to the start and end blocks to store the + * start and end of the match into. Start is also used as the location to + * start the search from for incremental searching. If start is an invalid + * position (id = 0). Default start is the beginning of the document for + * forward searching, and the end of the document for backwards searching. + * The backward and caseless parameters I hope are self-explanatory. + * + * returns 1 on success + * (and the start and end positions of the match). + * returns -1 otherwise (and start and end are unchanged). + */ +int +#ifdef _NO_PROTO +HTMLSearchText (w, pattern, m_start, m_end, backward, caseless) + Widget w; + char *pattern; + ElementRef *m_start; + ElementRef *m_end; + int backward; + int caseless; +#else +HTMLSearchText (Widget w, char *pattern, ElementRef *m_start, ElementRef *m_end, + int backward, int caseless) +#endif +{ + HTMLWidget hw = (HTMLWidget)w; + int found, equal; + char *match; + char *tptr; + char *mptr; + char cval; + struct ele_rec *eptr; + int s_pos; + struct ele_rec *s_eptr; + ElementRef s_ref, e_ref; + ElementRef *start, *end; + + /* + * If bad parameters are passed, just fail the search + */ + if ((pattern == NULL)||(*pattern == '\0')|| + (m_start == NULL)||(m_end == NULL)) { + return(-1); + } + + /* + * If we are caseless, make a lower case copy of the pattern to + * match to use in compares. + * + * remember to free this before returning + */ + if (caseless) { + match = (char *)malloc(strlen(pattern) + 1); + tptr = pattern; + mptr = match; + while (*tptr != '\0') { + *mptr = (char)TOLOWER((int)*tptr); + mptr++; + tptr++; + } + *mptr = '\0'; + } else { + match = pattern; + } + + /* + * Slimy coding. I later decided I didn't want to change start and + * end if the search failed. Rather than changing all the code, + * I just copy it into locals here, and copy it out again if a match + * is found. + */ + start = &s_ref; + end = &e_ref; + start->id = m_start->id; + start->pos = m_start->pos; + end->id = m_end->id; + end->pos = m_end->pos; + + /* + * Find the user specified start position. + */ + if (start->id > 0) { + found = 0; + eptr = hw->html.formatted_elements; + + while (eptr != NULL) { +/* if (eptr->ele_id > start->id) {*/ /* MF031 */ + if ((!backward && eptr->ele_id > start->id) || + ( backward && eptr->ele_id == start->id)) { + s_eptr = eptr; + found = 1; + break; + } + eptr = eptr->next; + } + /* + * Bad start position, fail them out. + */ + if (!found) { + if (caseless) { + free(match); + } + return(-1); + } + /* + * Sanify the start position + */ + s_pos = start->pos; + if (s_pos >= s_eptr->edata_len - 1) { + s_pos = s_eptr->edata_len - 2; + } + if (s_pos < 0) { + s_pos = 0; + } + + } else { + /* + * Default search starts at end for backward, and + * beginning for forwards. + */ + if (backward) { + s_eptr = hw->html.formatted_elements; + while (s_eptr->next != NULL) { + s_eptr = s_eptr->next; + } + s_pos = s_eptr->edata_len - 2; + } else { + s_eptr = hw->html.formatted_elements; + s_pos = 0; + } + } + + if (backward) { + char *mend; + + /* + * Save the end of match here for easy end to start searching + */ + mend = match; + while (*mend != '\0') { + mend++; + } + if (mend > match) { + mend--; + } + found = 0; + equal = 0; + mptr = mend; + + if (s_eptr != NULL) { + eptr = s_eptr; + } else { + eptr = hw->html.formatted_elements; + while (eptr->next != NULL) { + eptr = eptr->next; + } + } + + while (eptr != NULL) { + /* + * Skip the special internal text + */ + if (eptr->internal == True) { + eptr = eptr->prev; + continue; + } + + if (eptr->type == E_TEXT) { + tptr = (char *)(eptr->edata + eptr->edata_len - 2); + if (eptr == s_eptr) { + tptr = (char *)(eptr->edata + s_pos); + } + while (tptr >= eptr->edata) { + if (equal) { + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + while ((mptr >= match)&& + (tptr >= eptr->edata)&& + (cval == *mptr)) + { + tptr--; + mptr--; + if (tptr >= eptr->edata) { + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + } + } + if (mptr < match) { + found = 1; + start->id = eptr->ele_id; + start->pos = (int) + (tptr - eptr->edata + 1); + break; + } else if (tptr < eptr->edata) { + break; + } else { + equal = 0; + } + } else { + mptr = mend; + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + while ((tptr >= eptr->edata)&& + (cval != *mptr)) + { + tptr--; + if (tptr >= eptr->edata) { + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + } + } + if ((tptr >= eptr->edata)&& + (cval == *mptr)) + { + equal = 1; + end->id = eptr->ele_id; + end->pos = (int) + (tptr - eptr->edata + 1); + } + } + } + } + /* + * Linefeeds match to single space characters. + */ + else if (eptr->type == E_LINEFEED) { + if (equal) { + if (*mptr == ' ') { + mptr--; + if (mptr < match) { + found = 1; + start->id =eptr->ele_id; + start->pos = 0; + } + } else { + equal = 0; + } + } else { + mptr = mend; + if (*mptr == ' ') { + equal = 1; + end->id = eptr->ele_id; + end->pos = 0; + mptr--; + if (mptr < match) { + found = 1; + start->id =eptr->ele_id; + start->pos = 0; + } + } + } + } + if (found) { + break; + } + eptr = eptr->prev; + } + } + else /* forward */ + { + found = 0; + equal = 0; + mptr = match; + + if (s_eptr != NULL) { + eptr = s_eptr; + } else { + eptr = hw->html.formatted_elements; + } + + while (eptr != NULL) { + /* + * Skip the special internal text + */ + if (eptr->internal == True) { + eptr = eptr->next; + continue; + } + + if (eptr->type == E_TEXT) { + tptr = eptr->edata; + if (eptr == s_eptr) { + tptr = (char *)(tptr + s_pos); + } + while (*tptr != '\0') { + if (equal) { + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + while ((*mptr != '\0')&& + (cval == *mptr)) + { + tptr++; + mptr++; + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + } + if (*mptr == '\0') { + found = 1; + end->id = eptr->ele_id; + end->pos = (int) + (tptr - eptr->edata); + break; + } else if (*tptr == '\0') { + break; + } else { + equal = 0; + } + } else { + mptr = match; + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + while ((*tptr != '\0')&& + (cval != *mptr)) + { + tptr++; + if (caseless) { + cval =(char)TOLOWER((int)*tptr); + } else { + cval = *tptr; + } + } + if (cval == *mptr) { + equal = 1; + start->id = eptr->ele_id; + start->pos = (int) + (tptr - eptr->edata); + } + } + } + } + else if (eptr->type == E_LINEFEED) { + if (equal) { + if (*mptr == ' ') { + mptr++; + if (*mptr == '\0') { + found = 1; + end->id = eptr->ele_id; + end->pos = 0; + } + } else { + equal = 0; + } + } else { + mptr = match; + if (*mptr == ' ') { + equal = 1; + start->id = eptr->ele_id; + start->pos = 0; + mptr++; + if (*mptr == '\0') { + found = 1; + end->id = eptr->ele_id; + end->pos = 0; + } + } + } + } + if (found) { + break; + } + eptr = eptr->next; + } + } + + if (found) { + m_start->id = start->id; + m_start->pos = start->pos; + m_end->id = end->id; + m_end->pos = end->pos; + } + + if (caseless) { + free(match); + } + + if (found) { + return(1); + } else { + return(-1); + } +} diff --git a/vendor/x11iraf/obm/ObmW/HTML.h b/vendor/x11iraf/obm/ObmW/HTML.h new file mode 100644 index 00000000..08fbf10e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTML.h @@ -0,0 +1,491 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#ifndef HTML_H +#define HTML_H + +#ifdef MOTIF +#include <Xm/Xm.h> +#if (XmVERSION == 1)&&(XmREVISION >= 2) +#define MOTIF1_2 +#endif +#else +#include <X11/Intrinsic.h> +#include <X11/Constraint.h> +#endif /* MOTIF */ +#include <X11/StringDefs.h> + + + +typedef int (*visitTestProc)(); +typedef void (*pointerTrackProc)(); + +typedef struct ele_ref_rec { + int id, pos; +} ElementRef; + +typedef struct link_rec { + char *href; + char *role; +} LinkInfo; + +/* + * Public functions + */ +#ifdef _NO_PROTO +extern char *HTMLGetText (); +extern char *HTMLGetTextAndSelection (); +extern char **HTMLGetHRefs (); +extern char **HTMLGetImageSrcs (); +extern void *HTMLGetWidgetInfo (); +extern void HTMLFreeWidgetInfo (); +extern void HTMLFreeImageInfo (); +extern LinkInfo *HTMLGetLinks (); +extern int HTMLPositionToId (); +extern int HTMLIdToPosition (); +extern int HTMLAnchorToPosition (); +extern int HTMLAnchorToId (); +extern void HTMLGotoId (); +extern void HTMLRetestAnchors (); +extern void HTMLClearSelection (); +extern void HTMLSetSelection (); +extern void HTMLSetText (); +extern int HTMLSearchText (); +#else +extern char *HTMLGetText (Widget w, int pretty); +extern char *HTMLGetTextAndSelection (Widget w, char **startp, char **endp, + char **insertp); +extern char **HTMLGetHRefs (Widget w, int *num_hrefs); +extern char **HTMLGetImageSrcs (Widget w, int *num_srcs); +extern void *HTMLGetWidgetInfo (Widget w); +extern void HTMLFreeWidgetInfo (void *ptr); +extern void HTMLFreeImageInfo (Widget w); +extern LinkInfo *HTMLGetLinks (Widget w, int *num_links); +extern int HTMLPositionToId(Widget w, int x, int y); +extern int HTMLIdToPosition(Widget w, int element_id, int *x, int *y); +extern int HTMLAnchorToPosition(Widget w, char *name, int *x, int *y); +extern int HTMLAnchorToId(Widget w, char *name); +extern void HTMLGotoId(Widget w, int element_id); +extern void HTMLRetestAnchors(Widget w, visitTestProc testFunc, + XtPointer client_data); +extern void HTMLClearSelection (Widget w); +extern void HTMLSetSelection (Widget w, ElementRef *start, ElementRef *end); +extern void HTMLSetText (Widget w, char *text, char *header_text, + char *footer_text, int element_id, + char *target_anchor, void *ptr); +extern int HTMLSearchText (Widget w, char *pattern, + ElementRef *m_start, ElementRef *m_end, int backward, int caseless); +#endif /* _NO_PROTO */ + + +/* + * Public Structures + */ +typedef struct acall_rec { + XEvent *event; + int element_id; + char *text; + char *href; +} WbAnchorCallbackData; + + +typedef struct fcall_rec { + XEvent *event; + char *href; + char *method; + char *enctype; + char *enc_entity; + int attribute_count; + char **attribute_names; + char **attribute_values; +} WbFormCallbackData; + + +typedef struct form_rec { + Widget hw; + char *action; + char *method; + char *enctype; + char *enc_entity; + int start, end; + struct form_rec *next; +} FormInfo; + + +typedef struct image_rec { + int ismap; + FormInfo *fptr; + int internal; + int delayed; + int fetched; + int width, height; + int num_colors; + int *reds; + int *greens; + int *blues; + unsigned char *image_data; + Pixmap image; + char *text; +} ImageInfo; + + +typedef struct wid_rec { + Widget w; + int type; + int id; + int x, y; + int width, height; + char *name; + char *value; + char *password; + char **mapping; + Boolean checked; + Boolean mapped; + struct wid_rec *next; +} WidgetInfo; + +typedef struct sel_rec { + Widget hw; + struct mark_up *mptr; + int is_value; + char *retval_buf; + char *option_buf; + char **returns; + char **options; + int option_cnt; + char **value; + int value_cnt; +} SelectInfo; + + +typedef ImageInfo *(*resolveImageProc)(); + + +/* + * defines and structures used for the formatted element list + */ + +#define E_TEXT 1 +#define E_BULLET 2 +#define E_LINEFEED 3 +#define E_IMAGE 4 +#define E_WIDGET 5 +#define E_HRULE 6 + +struct ele_rec { + int type; + ImageInfo *pic_data; + WidgetInfo *widget_data; + XFontStruct *font; + int alignment; + Boolean internal; + Boolean selected; + int indent_level; + int start_pos, end_pos; + int x, y; + int y_offset; + int width; + int line_number; + int line_height; + int ele_id; + int underline_number; + Boolean dashed_underline; + Boolean strikeout; + unsigned long fg; + unsigned long bg; + char *anchorName; + char *anchorHRef; + char *edata; + int edata_len; + struct ele_rec *next; + struct ele_rec *prev; +}; + +struct ref_rec { + char *anchorHRef; + struct ref_rec *next; +}; + +struct delay_rec { + char *src; + struct delay_rec *next; +}; + + +/* + * defines and structures used for the HTML parser, and the + * parsed object list. + */ + +/* Mark types */ +#define M_UNKNOWN -1 +#define M_NONE 0 +#define M_TITLE 1 +#define M_HEADER_1 2 +#define M_HEADER_2 3 +#define M_HEADER_3 4 +#define M_HEADER_4 5 +#define M_HEADER_5 6 +#define M_HEADER_6 7 +#define M_ANCHOR 8 +#define M_PARAGRAPH 9 +#define M_ADDRESS 10 +#define M_PLAIN_TEXT 11 +#define M_UNUM_LIST 12 +#define M_NUM_LIST 13 +#define M_LIST_ITEM 14 +#define M_DESC_LIST 15 +#define M_DESC_TITLE 16 +#define M_DESC_TEXT 17 +#define M_PREFORMAT 18 +#define M_PLAIN_FILE 19 +#define M_LISTING_TEXT 20 +#define M_INDEX 21 +#define M_MENU 22 +#define M_DIRECTORY 23 +#define M_IMAGE 24 +#define M_FIXED 25 +#define M_BOLD 26 +#define M_ITALIC 27 +#define M_EMPHASIZED 28 +#define M_STRONG 29 +#define M_CODE 30 +#define M_SAMPLE 31 +#define M_KEYBOARD 32 +#define M_VARIABLE 33 +#define M_CITATION 34 +#define M_BLOCKQUOTE 35 +#define M_STRIKEOUT 36 +#define M_INPUT 37 +#define M_FORM 38 +#define M_HRULE 39 +#define M_LINEBREAK 40 +#define M_BASE 41 +#define M_SELECT 42 +#define M_OPTION 43 +#define M_TEXTAREA 44 + +/* syntax of Mark types */ +#define MT_TITLE "title" +#define MT_HEADER_1 "h1" +#define MT_HEADER_2 "h2" +#define MT_HEADER_3 "h3" +#define MT_HEADER_4 "h4" +#define MT_HEADER_5 "h5" +#define MT_HEADER_6 "h6" +#define MT_ANCHOR "a" +#define MT_PARAGRAPH "p" +#define MT_ADDRESS "address" +#define MT_PLAIN_TEXT "xmp" +#define MT_UNUM_LIST "ul" +#define MT_NUM_LIST "ol" +#define MT_LIST_ITEM "li" +#define MT_DESC_LIST "dl" +#define MT_DESC_TITLE "dt" +#define MT_DESC_TEXT "dd" +#define MT_PREFORMAT "pre" +#define MT_PLAIN_FILE "plaintext" +#define MT_LISTING_TEXT "listing" +#define MT_INDEX "isindex" +#define MT_MENU "menu" +#define MT_DIRECTORY "dir" +#define MT_IMAGE "img" +#define MT_FIXED "tt" +#define MT_BOLD "b" +#define MT_ITALIC "i" +#define MT_EMPHASIZED "em" +#define MT_STRONG "strong" +#define MT_CODE "code" +#define MT_SAMPLE "samp" +#define MT_KEYBOARD "kbd" +#define MT_VARIABLE "var" +#define MT_CITATION "cite" +#define MT_BLOCKQUOTE "blockquote" +#define MT_STRIKEOUT "strike" +#define MT_INPUT "input" +#define MT_FORM "form" +#define MT_HRULE "hr" +#define MT_LINEBREAK "br" +#define MT_BASE "base" +#define MT_SELECT "select" +#define MT_OPTION "option" +#define MT_TEXTAREA "textarea" + + +/* anchor tags */ +#define AT_NAME "name" +#define AT_HREF "href" + + +struct mark_up { + int type; + int is_end; + char *start; + char *text; + char *end; + struct mark_up *next; +}; + + +/* + * New resource names + */ +#define WbNmarginWidth "marginWidth" +#define WbNmarginHeight "marginHeight" +#define WbNtext "text" +#define WbNheaderText "headerText" +#define WbNfooterText "footerText" +#define WbNtitleText "titleText" +#define WbNanchorUnderlines "anchorUnderlines" +#define WbNvisitedAnchorUnderlines "visitedAnchorUnderlines" +#define WbNdashedAnchorUnderlines "dashedAnchorUnderlines" +#define WbNdashedVisitedAnchorUnderlines "dashedVisitedAnchorUnderlines" +#define WbNanchorColor "anchorColor" +#define WbNvisitedAnchorColor "visitedAnchorColor" +#define WbNactiveAnchorFG "activeAnchorFG" +#define WbNactiveAnchorBG "activeAnchorBG" +#define WbNfancySelections "fancySelections" +#define WbNimageBorders "imageBorders" +#define WbNdelayImageLoads "delayImageLoads" +#define WbNisIndex "isIndex" +#define WbNitalicFont "italicFont" +#define WbNboldFont "boldFont" +#define WbNfixedFont "fixedFont" +#define WbNfixedboldFont "fixedboldFont" +#define WbNfixeditalicFont "fixeditalicFont" +#define WbNheader1Font "header1Font" +#define WbNheader2Font "header2Font" +#define WbNheader3Font "header3Font" +#define WbNheader4Font "header4Font" +#define WbNheader5Font "header5Font" +#define WbNheader6Font "header6Font" +#define WbNaddressFont "addressFont" +#define WbNplainFont "plainFont" +#define WbNplainboldFont "plainboldFont" +#define WbNplainitalicFont "plainitalicFont" +#define WbNlistingFont "listingFont" +#define WbNanchorCallback "anchorCallback" +#define WbNlinkCallback "linkCallback" +#define WbNsubmitFormCallback "submitFormCallback" +#define WbNpreviouslyVisitedTestFunction "previouslyVisitedTestFunction" +#define WbNpreviouslyVisitedTestData "previouslyVisitedTestData" +#define WbNresolveImageFunction "resolveImageFunction" +#define WbNresolveDelayedImage "resolveDelayedImage" +#define WbNpercentVerticalSpace "percentVerticalSpace" +#define WbNpointerMotionCallback "pointerMotionCallback" +#define WbNpointerMotionData "pointerMotionData" +#define WbNverticalScrollOnRight "verticalScrollOnRight" +#define WbNhorizontalScrollOnTop "horizontalScrollOnTop" +#define WbNview "view" +#define WbNverticalScrollBar "verticalScrollBar" +#define WbNhorizontalScrollBar "horizontalScrollBar" + +/* + * New resource classes + */ +#define WbCMarginWidth "MarginWidth" +#define WbCMarginHeight "MarginHeight" +#define WbCText "Text" +#define WbCHeaderText "HeaderText" +#define WbCFooterText "FooterText" +#define WbCTitleText "TitleText" +#define WbCAnchorUnderlines "AnchorUnderlines" +#define WbCVisitedAnchorUnderlines "VisitedAnchorUnderlines" +#define WbCDashedAnchorUnderlines "DashedAnchorUnderlines" +#define WbCDashedVisitedAnchorUnderlines "DashedVisitedAnchorUnderlines" +#define WbCAnchorColor "AnchorColor" +#define WbCVisitedAnchorColor "VisitedAnchorColor" +#define WbCActiveAnchorFG "ActiveAnchorFG" +#define WbCActiveAnchorBG "ActiveAnchorBG" +#define WbCFancySelections "FancySelections" +#define WbCImageBorders "ImageBorders" +#define WbCDelayImageLoads "DelayImageLoads" +#define WbCIsIndex "IsIndex" +#define WbCItalicFont "ItalicFont" +#define WbCBoldFont "BoldFont" +#define WbCFixedFont "FixedFont" +#define WbCFixedboldFont "FixedboldFont" +#define WbCFixeditalicFont "FixeditalicFont" +#define WbCHeader1Font "Header1Font" +#define WbCHeader2Font "Header2Font" +#define WbCHeader3Font "Header3Font" +#define WbCHeader4Font "Header4Font" +#define WbCHeader5Font "Header5Font" +#define WbCHeader6Font "Header6Font" +#define WbCAddressFont "AddressFont" +#define WbCPlainFont "PlainFont" +#define WbCPlainboldFont "PlainboldFont" +#define WbCPlainitalicFont "PlainitalicFont" +#define WbCListingFont "ListingFont" +#define WbCPreviouslyVisitedTestFunction "PreviouslyVisitedTestFunction" +#define WbCPreviouslyVisitedTestData "PreviouslyVisitedTestData" +#define WbCResolveImageFunction "ResolveImageFunction" +#define WbCResolveDelayedImage "ResolveDelayedImage" +#define WbCPercentVerticalSpace "PercentVerticalSpace" +#define WbCPointerMotionCallback "PointerMotionCallback" +#define WbCPointerMotionData "PointerMotionData" +#define WbCVerticalScrollOnRight "VerticalScrollOnRight" +#define WbCHorizontalScrollOnTop "HorizontalScrollOnTop" +#define WbCView "View" +#define WbCVerticalScrollBar "VerticalScrollBar" +#define WbCHorizontalScrollBar "HorizontalScrollBar" + +typedef struct _HTMLClassRec *HTMLWidgetClass; +typedef struct _HTMLRec *HTMLWidget; + +extern WidgetClass htmlWidgetClass; + + +#endif /* HTML_H */ + diff --git a/vendor/x11iraf/obm/ObmW/HTML.notes b/vendor/x11iraf/obm/ObmW/HTML.notes new file mode 100644 index 00000000..95ab1689 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTML.notes @@ -0,0 +1,72 @@ +HTML Widget + + Composite widget consisting of a drawingArea widget and horizontal and + vertical scrollbars. + +Resources + + pic_data = resolveImageFunction (w, src, noload) + pic_data = resolveDelayedImage (w, src) + + +Callbacks + + anchorCallback (w, cbdata) called when href is selected + linkCallback (w, cbdata) called during set text for <LINK> tags + submitFormCallback (w, cbdata) called when form is submitted + + LinkInfo: href role + anchorCallback: event element_id text href + formCallback: event href method enctype enc_entity + attrib_count attrib_names attrib_values + + +Public Functions + + HTMLGetText (w, pretty) # text or Postscript + HTMLPositionToId (w, x, y) # find nearest element + HTMLIdToPosition (w, element_id, x, y) # cvt id to position + HTMLGotoId (w, element_id) # scroll window to element + HTMLAnchorToPosition (w, name, x, y) # pos of anchor given name + HTMLAnchorToId (w, name) # id of anchor given name + list = HTMLGetHRefs (w, num_hrefs) # HREFs of all active anchors + HTMLGetImageSrcs (w, num_srcs) # SRCs of all images in doc + HTMLGetLinks (w, num_links) # get list of LINK tags in doc + + HTMLGetWidgetInfo (w) # get widget list + HTMLFreeImageInfo (w) # free image resources + HTMLFreeWidgetInfo (ptr) # free WidgetInfo struct + +** HTMLRetestAnchors (w, testFunc, data) # redraw all active anchors + + HTMLSetSelection (w, start, end) # set selection by ElementRef + HTMLClearSelection (w) # clear selection +HTMLGetTextAndSelection(w,startp,endp,insertp) # get selection + + HTMLSetText (w, text, header_text, # set document text + footer_text, element_id, target_anchor, ptr) + + HTMLSearchText (w, pattern, m_start, # search text -> ElementRefs + m_end, backward, caseless) + + +LOCAL REVISIONS +---------------------- + +Added a third argument (client_data for the callback function) to the +HTMLRetestAnchors function. This required changes to several files. + +Likewise, added a client_data argument to the pointer motion callback. +Mosaic in its callbacks would assume that the HTML widget was being called +from within Mosaic, but this doesn't work in a more general setting. + +Modified the HTML widget to add a custom Realize method. This calls the +realize method of the superclass and then makes a drawGC for the HTML +widget. This was necessary to avoid segvios occuring when something is +drawn in the window before the application becomes idle and the widget +processes the first Expose event, as the widget would create the GC only +in response to the expose event. + +Added a "scroll" action to the widget and modified the default HTML +translations to add u/d and j/k keys to permit vertical scrolling using the +keyboard instead of the scroll bars. diff --git a/vendor/x11iraf/obm/ObmW/HTMLP.h b/vendor/x11iraf/obm/ObmW/HTMLP.h new file mode 100644 index 00000000..6e75819e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLP.h @@ -0,0 +1,246 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#ifndef HTMLP_H +#define HTMLP_H + +#include "HTML.h" + +#ifdef MOTIF +#include <Xm/XmP.h> +# ifdef MOTIF1_2 +# include <Xm/ManagerP.h> +# endif /* MOTIF1_2 */ +#else +#include <X11/IntrinsicP.h> +#include <X11/ConstrainP.h> +#endif /* MOTIF */ + +#include <X11/Xatom.h> +#include <X11/Xmu/Atoms.h> + +#if defined(SYSV) || defined(SVR4) || defined(__svr4__) || defined(VMS) +#define bcopy(source, dest, count) memcpy(dest, source, count) +#define bzero(b, len) memset(b, 0, len) +#endif + + +/* + * Used for special images + */ +#define INTERNAL_IMAGE "internal-" + + +/* New fields for the HTML widget class */ +typedef struct _HTMLClassPart +{ + int none; /* no extra HTML class stuff */ +} HTMLClassPart; + + +typedef struct _HTMLClassRec +{ + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; +#ifdef MOTIF + XmManagerClassPart manager_class; +#endif /* MOTIF */ + HTMLClassPart html_class; +} HTMLClassRec; + + +extern HTMLClassRec htmlClassRec; + + +/* New fields for the HTML widget */ +typedef struct _HTMLPart +{ + /* Resources */ + Dimension margin_width; + Dimension margin_height; + + Widget view; + Widget hbar; + Widget vbar; + Boolean hbar_top; + Boolean vbar_right; + + XtCallbackList anchor_callback; + XtCallbackList link_callback; + XtCallbackList form_callback; + + char *title; + char *raw_text; + char *header_text; + char *footer_text; +/* + * Without motif we have to define our own forground resource + * instead of using the manager's + */ +#ifndef MOTIF + Pixel foreground; +#endif + Pixel anchor_fg; + Pixel visitedAnchor_fg; + Pixel activeAnchor_fg; + Pixel activeAnchor_bg; + int num_anchor_underlines; + int num_visitedAnchor_underlines; + Boolean dashed_anchor_lines; + Boolean dashed_visitedAnchor_lines; + Boolean fancy_selections; + Boolean border_images; + Boolean delay_images; + Boolean is_index; + int percent_vert_space; + + XFontStruct *font; + XFontStruct *italic_font; + XFontStruct *bold_font; + XFontStruct *fixed_font; + XFontStruct *fixedbold_font; + XFontStruct *fixeditalic_font; + XFontStruct *header1_font; + XFontStruct *header2_font; + XFontStruct *header3_font; + XFontStruct *header4_font; + XFontStruct *header5_font; + XFontStruct *header6_font; + XFontStruct *address_font; + XFontStruct *plain_font; + XFontStruct *plainbold_font; + XFontStruct *plainitalic_font; + XFontStruct *listing_font; + + XtPointer previously_visited_test; + XtPointer vt_client_data; + XtPointer resolveImage; + XtPointer resolveDelayedImage; + + XtPointer pointer_motion_callback; + XtPointer pm_client_data; + + /* PRIVATE */ + Dimension max_pre_width; + Dimension view_width; + Dimension view_height; + int doc_width; + int doc_height; + int scroll_x; + int scroll_y; + Boolean use_hbar; + Boolean use_vbar; + struct ele_rec *formatted_elements; + int line_count; + struct ele_rec **line_array; + struct ele_rec *select_start; + struct ele_rec *select_end; + int sel_start_pos; + int sel_end_pos; + struct ele_rec *new_start; + struct ele_rec *new_end; + int new_start_pos; + int new_end_pos; + struct ele_rec *active_anchor; + GC drawGC; + int press_x; + int press_y; + Time but_press_time; + Time selection_time; + struct mark_up *html_objects; + struct mark_up *html_header_objects; + struct mark_up *html_footer_objects; + struct ref_rec *my_visited_hrefs; + struct delay_rec *my_delayed_images; + WidgetInfo *widget_list; + FormInfo *form_list; + + struct ele_rec *cached_tracked_ele; +} HTMLPart; + + +typedef struct _HTMLRec +{ + CorePart core; + CompositePart composite; + ConstraintPart constraint; +#ifdef MOTIF + XmManagerPart manager; +#endif /* MOTIF */ + HTMLPart html; +} HTMLRec; + +/* + * to reduce the number of MOTIF/ATHENA ifdefs around the code + * we use some generalized constants + */ +#ifdef MOTIF +# define XxNx XmNx +# define XxNy XmNy +# define XxNwidth XmNwidth +# define XxNheight XmNheight +# define XxNset XmNset +# define XxNvalue XmNvalue +#else +# define XxNx XtNx +# define XxNy XtNy +# define XxNwidth XtNwidth +# define XxNheight XtNheight +# define XxNset XtNstate +# define XxNvalue XtNstring +#endif /* MOTIF */ + + +#endif /* HTMLP_H */ diff --git a/vendor/x11iraf/obm/ObmW/HTMLamp.h b/vendor/x11iraf/obm/ObmW/HTMLamp.h new file mode 100644 index 00000000..6536f806 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLamp.h @@ -0,0 +1,141 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + + +typedef struct amp_esc_rec { + char *tag; + char value; +} AmpEsc; + +static AmpEsc AmpEscapes[] = { + {"lt", '<'}, + {"LT", '<'}, + {"gt", '>'}, + {"GT", '>'}, + {"amp", '&'}, + {"AMP", '&'}, + {"quot", '\"'}, + {"QUOT", '\"'}, + {"Agrave", '\300'}, + {"Aacute", '\301'}, + {"Acirc", '\302'}, + {"Atilde", '\303'}, + {"Auml", '\304'}, + {"Aring", '\305'}, + {"AElig", '\306'}, + {"Ccedil", '\307'}, + {"Egrave", '\310'}, + {"Eacute", '\311'}, + {"Ecirc", '\312'}, + {"Euml", '\313'}, + {"Igrave", '\314'}, + {"Iacute", '\315'}, + {"Icirc", '\316'}, + {"Iuml", '\317'}, + {"ETH", '\320'}, + {"Ntilde", '\321'}, + {"Ograve", '\322'}, + {"Oacute", '\323'}, + {"Ocirc", '\324'}, + {"Otilde", '\325'}, + {"Ouml", '\326'}, + + {"?", '\327'}, /* ? */ + + {"Oslash", '\330'}, + {"Ugrave", '\331'}, + {"Uacute", '\332'}, + {"Ucirc", '\333'}, + {"Uuml", '\334'}, + {"Yacute", '\335'}, + {"THORN", '\336'}, + {"szlig", '\337'}, + {"agrave", '\340'}, + {"aacute", '\341'}, + {"acirc", '\342'}, + {"atilde", '\343'}, + {"auml", '\344'}, + {"aring", '\345'}, + {"aelig", '\346'}, + {"ccedil", '\347'}, + {"egrave", '\350'}, + {"eacute", '\351'}, + {"ecirc", '\352'}, + {"euml", '\353'}, + {"igrave", '\354'}, + {"iacute", '\355'}, + {"icirc", '\356'}, + {"iuml", '\357'}, + {"eth", '\360'}, + {"ntilde", '\361'}, + {"ograve", '\362'}, + {"oacute", '\363'}, + {"ocirc", '\364'}, + {"otilde", '\365'}, + {"ouml", '\366'}, + + {"?", '\367'}, /* ? */ + + {"oslash", '\370'}, + {"ugrave", '\371'}, + {"uacute", '\372'}, + {"ucirc", '\373'}, + {"uuml", '\374'}, + {"yacute", '\375'}, + {"thorn", '\376'}, + {"yuml", '\377'}, + + {NULL, '\0'}, +}; + diff --git a/vendor/x11iraf/obm/ObmW/HTMLformat.c b/vendor/x11iraf/obm/ObmW/HTMLformat.c new file mode 100644 index 00000000..d58eed5e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLformat.c @@ -0,0 +1,6285 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#ifdef TIMING +#include <sys/time.h> +struct timeval Tv; +struct timezone Tz; +#endif + +#include <stdio.h> +#include <ctype.h> +#include "HTMLP.h" + + +/* + * I need my own is ispunct function because I need a closing paren + * immediately after a word to act like punctuation. + */ +#define MY_ISPUNCT(val) (ispunct((int)(val)) || ((val) == ')')) + +#define INDENT_SPACES 2 +#define IMAGE_BORDER 2 + +#define D_NONE 0 +#define D_TITLE 1 +#define D_TEXT 2 +#define D_OLIST 3 +#define D_ULIST 4 + +#define ALIGN_BOTTOM 0 +#define ALIGN_MIDDLE 1 +#define ALIGN_TOP 2 + + +extern struct ele_rec *AddEle(); +extern void FreeLineList(); +extern void FreeObjList(); +extern int SwapElements(); +extern struct ele_rec **MakeLineList(); +extern char *ParseMarkTag(); +extern char *MaxTextWidth(); +extern char *IsMapForm(); +extern char *DelayedHRef(); +extern int IsDelayedHRef(); +extern int AnchoredHeight(); +extern struct mark_up *HTMLParse(); +extern struct ref_rec *FindHRef(); +extern struct delay_rec *FindDelayedImage(); +extern ImageInfo *NoImageData(); +extern ImageInfo *DelayedImageData(); +extern Pixmap NoImage(); +extern Pixmap DelayedImage(); +extern Pixmap InfoToImage(); +extern int caseless_equal(); +extern void clean_white_space(); +extern void WidgetRefresh(); +extern WidgetInfo *MakeWidget(); +extern XFontStruct *GetWidgetFont(); +extern void AddNewForm(); +extern void PrepareFormEnd(); +extern char *ComposeCommaList(); +extern void FreeCommaList(); + + +/* + * To allow arbitrary nesting of lists + */ +typedef struct dtype_rec { + int type; /* D_NONE, D_TITLE, D_TEXT, D_OLIST, D_ULIST */ + int count; + int compact; + struct dtype_rec *next; +} DescRec; + + +/* + * To allow arbitrary nesting of font changes + */ +typedef struct font_rec { + XFontStruct *font; + struct font_rec *next; +} FontRec; + +static DescRec BaseDesc; +static DescRec *DescType; +static DescRec *ListData; +static FontRec FontBase; +static FontRec *FontStack; +static XFontStruct *currentFont; +static XFontStruct *saveFont; +static unsigned long Fg; +static unsigned long Bg; +static int Width; +static int MaxWidth; +static int ElementId; +static int WidgetId; +static int LineNumber; +static int LineHeight; +static int LineBottom; +static int BaseLine; +static int TextIndent; +static int MarginW; +static int Ignore; +static int Preformat; +static int PF_LF_State; /* Pre-formatted linefeed state. Hack for bad HTMLs */ +static int NeedSpace; +static Boolean Internal; +static Boolean DashedUnderlines; +static Boolean Strikeout; +static int Underlines; +static int CharsInLine; +static int IndentLevel; +static struct ele_rec *Current; +static char *AnchorText; +static char *TitleText; +static char *TextAreaBuf; +static struct mark_up *Last; +static FormInfo *CurrentForm; +static SelectInfo *CurrentSelect; + +/* + * Turned out we were taking WAY too much time mallocing and freeing + * memory when composing the lines into elements. So this ineligent + * method minimizes all that. + */ +#define COMP_LINE_BUF_LEN 1024 +static char *CompLine = NULL; +static int CompLineLen = 0; +static char *CompWord = NULL; +static int CompWordLen = 0; + + + +/* + * Create a formatted element + */ +struct ele_rec * +CreateElement(hw, type, fp, x, y, edata) + HTMLWidget hw; + int type; + XFontStruct *fp; + int x, y; + char *edata; +{ + struct ele_rec *eptr; + int baseline; + + if (fp != NULL) + { + baseline = fp->max_bounds.ascent; + } + else + { + baseline = LineHeight; + } + + eptr = (struct ele_rec *)malloc(sizeof(struct ele_rec)); + if (eptr == NULL) + { + fprintf(stderr, "Cannot allocate space for element buffer\n"); + exit(1); + } + + eptr->type = type; + eptr->pic_data = NULL; + eptr->widget_data = NULL; + eptr->font = fp; + eptr->alignment = ALIGN_BOTTOM; + eptr->selected = False; + eptr->internal = Internal; + eptr->strikeout = Strikeout; + eptr->x = x; + eptr->y = y; + eptr->y_offset = 0; + eptr->width = 0; + eptr->line_number = LineNumber; + eptr->line_height = LineHeight; + eptr->fg = Fg; + eptr->bg = Bg; + eptr->underline_number = Underlines; + eptr->dashed_underline = DashedUnderlines; + eptr->indent_level = IndentLevel; + + switch(type) + { + case E_TEXT: + /* + * get a unique element id + */ + ElementId++; + eptr->ele_id = ElementId; + + eptr->y_offset = 0; + + eptr->edata_len = strlen(edata) + 1; + eptr->edata = (char *)malloc(eptr->edata_len); + if (eptr->edata == NULL) + { + eptr->edata_len = 0; + fprintf(stderr, "Cannot allocate space for copy of text element data\n"); + exit(1); + } + strcpy(eptr->edata, edata); + + /* + * if this is an anchor, puts its href value into + * the element. + */ + if (AnchorText != NULL) + { + eptr->anchorHRef = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + eptr->anchorName = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + break; + case E_BULLET: + eptr->ele_id = ElementId; + + if (BaseLine == -100) + { + BaseLine = baseline; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + else if (baseline < BaseLine) + { + eptr->y_offset = BaseLine - baseline; + } + + /* + * Bullets can't be underlined! + */ + eptr->underline_number = 0; + + eptr->edata = NULL; + eptr->edata_len = 0; + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + break; + case E_HRULE: + /* + * get a unique element id + */ + ElementId++; + eptr->ele_id = ElementId; + + if (BaseLine == -100) + { + BaseLine = baseline; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + else if (baseline < BaseLine) + { + eptr->y_offset = BaseLine - baseline; + } + + /* + * Rules can't be underlined! + */ + eptr->underline_number = 0; + + eptr->edata = NULL; + eptr->edata_len = 0; + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + break; + case E_LINEFEED: + eptr->ele_id = ElementId; + + eptr->y_offset = 0; + + if (BaseLine == -100) + { + BaseLine = baseline; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + + /* + * Linefeeds have to use the maximum line height. + * Deal with bad Lucidia descents. + */ +#ifdef NO_EXTRA_FILLS + eptr->line_height = eptr->font->ascent + + eptr->font->descent; +#else + eptr->line_height = LineHeight; +#endif /* NO_EXTRA_FILLS */ + if ((BaseLine + LineBottom) > eptr->line_height) + { + eptr->line_height = BaseLine + LineBottom; + } + + /* + * Linefeeds can't be underlined! + */ + eptr->underline_number = 0; + + eptr->edata = NULL; + eptr->edata_len = 0; + /* + * if this linefeed is part of a broken anchor put + * its href value into the element so we can reconnect + * it when activated. + * If it at the beginning of an anchor, don't put + * the href in, and change the color back. + */ + if (AnchorText != NULL) + { + char *tptr; + + tptr = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + if ((Current != NULL)&& + ((Current->anchorHRef == NULL)|| + (tptr == NULL)|| + (strcmp(Current->anchorHRef, tptr) != 0))) + { + if (tptr) + free(tptr); + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + eptr->fg = hw->manager.foreground; +#else + eptr->fg = hw->html.foreground; +#endif /* MOTIF */ + } + else + { + eptr->anchorHRef = tptr; + eptr->anchorName = + ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + break; + case E_IMAGE: + /* + * get a unique element id + */ + ElementId++; + eptr->ele_id = ElementId; + + /* + * Images can't be underlined! + */ + eptr->underline_number = 0; + + if (edata != NULL) + { + eptr->edata_len = strlen(edata) + 1; + eptr->edata = (char *)malloc(eptr->edata_len); + if (eptr->edata == NULL) + { + eptr->edata_len = 0; + fprintf(stderr, "Cannot allocate space for copy of image element data\n"); + exit(1); + } + strcpy(eptr->edata, edata); + } + else + { + eptr->edata_len = 0; + eptr->edata = NULL; + } + + /* + * if this image is part of an anchor put + * its href and name values into the element + * so we can reconnect it when activated. + */ + if (AnchorText != NULL) + { + eptr->anchorHRef = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + eptr->anchorName = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + + /* + * Picture stuff + */ + /* + * if we have an image resolver, use it. + */ + if (hw->html.resolveImage != NULL) + { + int internal; + + /* + * See if this is a special internal image + */ + if ((edata != NULL)&& + (strncmp(edata, INTERNAL_IMAGE, + strlen(INTERNAL_IMAGE)) == 0)) + { + internal = 1; + } + else + { + internal = 0; + } + + /* + * if we delay image fetching + * internal images are not delayed. + */ + if ((hw->html.delay_images == True)&& + (!internal)) + { + /* + * see if already cached. + */ + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveImage))(hw, edata, 1); + if (eptr->pic_data != NULL) + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + } + /* + * else, not cached. + */ + else + { + /* + * just image + */ + if (eptr->anchorHRef == NULL) + { + eptr->pic_data = DelayedImageData(hw, + False); + eptr->pic_data->delayed = 1; + eptr->anchorHRef = DelayedHRef(hw); + eptr->fg = hw->html.anchor_fg; + } + /* + * else anchor and image + */ + else + { + eptr->pic_data = DelayedImageData(hw, + True); + eptr->pic_data->delayed = 1; + } + } + } + else + { + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveImage))(hw, edata, 0); + if (eptr->pic_data != NULL) + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + } + } + if (eptr->pic_data != NULL) + { + eptr->pic_data->internal = internal; + } + } + if (eptr->pic_data == NULL) + { + eptr->pic_data = NoImageData(hw); + eptr->pic_data->delayed = 0; + eptr->pic_data->internal = 0; + } + + break; + case E_WIDGET: + /* + * get a unique element id + */ + WidgetId++; + ElementId++; + eptr->ele_id = ElementId; + + /* + * Widgets can't be underlined! + */ + eptr->underline_number = 0; + + eptr->edata = NULL; + eptr->edata_len = 0; + + /* + * if this widget is part of an anchor put + * its href and name values into the element + * so we can reconnect it when activated. + */ + if (AnchorText != NULL) + { + eptr->anchorHRef = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + eptr->anchorName = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + + /* + * Widget stuff + */ + eptr->widget_data = MakeWidget(hw, edata, + (x + IMAGE_BORDER), (y + IMAGE_BORDER), + WidgetId, CurrentForm); + + /* + * I have no idea what to do if we can't create the + * widget. It probably means we are so messed up we + * will soon be crashing. + */ + if (eptr->widget_data == NULL) + { + } + + break; + default: + fprintf(stderr, "CreateElement: Unknown type %d\n", type); + eptr->ele_id = ElementId; + + eptr->edata = NULL; + eptr->edata_len = 0; + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + break; + } + return(eptr); +} + + +/* + * Set the formatted element into the format list. Use a pre-allocated + * list position if possible, otherwise allocate a new list position. + */ +void +SetElement(hw, type, fp, x, y, edata) + HTMLWidget hw; + int type; + XFontStruct *fp; + int x, y; + char *edata; +{ + struct ele_rec *eptr; + int len; + int baseline; + + if (fp != NULL) + { + baseline = fp->max_bounds.ascent; + } + else + { + baseline = LineHeight; + } + + /* + * There is not pre-allocated format list, or we have reached + * the end of the pre-allocated list. Create a new element, and + * add it. + */ + if ((hw->html.formatted_elements == NULL)|| + ((Current != NULL)&&(Current->next == NULL))) + { + eptr = CreateElement(hw, type, fp, x, y, edata); + Current = AddEle(&(hw->html.formatted_elements), Current, eptr); + return; + } + + /* + * If current is null, but we have a pre-allocated format list, then + * this is the first SetElement() call for this formated text, and + * we must set current to the head of the formatted list. Otherwise + * we move current to the next pre-allocated list position. + */ + if (Current == NULL) + { + Current = hw->html.formatted_elements; + } + else + { + Current = Current->next; + } + + eptr = Current; + if (eptr == NULL) + { + fprintf(stderr, "SetElement: Error, setting a null element\n"); + exit(1); + } + + eptr->type = type; + eptr->pic_data = NULL; + eptr->widget_data = NULL; + eptr->font = fp; + eptr->alignment = ALIGN_BOTTOM; + eptr->selected = False; + eptr->internal = Internal; + eptr->strikeout = Strikeout; + eptr->x = x; + eptr->y = y; + eptr->y_offset = 0; + eptr->width = 0; + eptr->line_number = LineNumber; + eptr->line_height = LineHeight; + eptr->fg = Fg; + eptr->bg = Bg; + eptr->underline_number = Underlines; + eptr->dashed_underline = DashedUnderlines; + eptr->indent_level = IndentLevel; + + switch(type) + { + case E_TEXT: + /* + * get a unique element id + */ + ElementId++; + eptr->ele_id = ElementId; + + eptr->y_offset = 0; + + len = strlen(edata) + 1; + if (len > eptr->edata_len) + { + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = (char *)malloc(len); + if (eptr->edata == NULL) + { + eptr->edata_len = 0; + fprintf(stderr, "Cannot allocate space for copy of text element data\n"); + exit(1); + } + } + eptr->edata_len = len; + strcpy(eptr->edata, edata); + + /* + * if this is an anchor, puts its href and name + * values into the element. + */ + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + if (AnchorText != NULL) + { + eptr->anchorHRef = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + eptr->anchorName = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + break; + case E_BULLET: + eptr->ele_id = ElementId; + + if (BaseLine == -100) + { + BaseLine = baseline; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + else if (baseline < BaseLine) + { + eptr->y_offset = BaseLine - baseline; + } + + /* + * Bullets can't be underlined! + */ + eptr->underline_number = 0; + + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = NULL; + eptr->edata_len = 0; + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + break; + case E_HRULE: + /* + * get a unique element id + */ + ElementId++; + eptr->ele_id = ElementId; + + if (BaseLine == -100) + { + BaseLine = baseline; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + else if (baseline < BaseLine) + { + eptr->y_offset = BaseLine - baseline; + } + + /* + * Rules can't be underlined! + */ + eptr->underline_number = 0; + + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = NULL; + eptr->edata_len = 0; + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + break; + case E_LINEFEED: + eptr->ele_id = ElementId; + + eptr->y_offset = 0; + + if (BaseLine == -100) + { + BaseLine = baseline; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + + /* + * Linefeeds have to use the maximum line height. + * Deal with bad Lucidia descents. + */ +#ifdef NO_EXTRA_FILLS + eptr->line_height = eptr->font->ascent + + eptr->font->descent; +#else + eptr->line_height = LineHeight; +#endif /* NO_EXTRA_FILLS */ + if ((BaseLine + LineBottom) > eptr->line_height) + { + eptr->line_height = (BaseLine + LineBottom); + } + + /* + * Linefeeds can't be underlined! + */ + eptr->underline_number = 0; + + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = NULL; + eptr->edata_len = 0; + /* + * if this linefeed is part of a broken anchor put + * its href and name values into the element + * so we can reconnect it when activated. + * If it at the beginning of an anchor, don't put + * the href in and change the color back. + */ + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + if (AnchorText != NULL) + { + char *tptr; + + tptr = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + if ((eptr->prev != NULL)&& + ((eptr->prev->anchorHRef == NULL)|| + (tptr == NULL)|| + (strcmp(eptr->prev->anchorHRef, tptr) != 0))) + { + if (tptr) + free(tptr); + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + eptr->fg = hw->manager.foreground; +#else + eptr->fg = hw->html.foreground; +#endif /* MOTIF */ + } + else + { + eptr->anchorHRef = tptr; + eptr->anchorName = + ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + break; + case E_IMAGE: + /* + * get a unique element id + */ + ElementId++; + eptr->ele_id = ElementId; + + /* + * Images can't be underlined! + */ + eptr->underline_number = 0; + + if (edata != NULL) + { + len = strlen(edata) + 1; + if (len > eptr->edata_len) + { + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = (char *)malloc(len); + if (eptr->edata == NULL) + { + eptr->edata_len = 0; + fprintf(stderr, "Cannot allocate space for copy of text element data\n"); + exit(1); + } + } + eptr->edata_len = len; + strcpy(eptr->edata, edata); + } + else + { + eptr->edata_len = 0; + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = NULL; + } + + /* + * if this image is part of an anchor put + * its href and name values into the element + * so we can reconnect it when activated. + */ + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + if (AnchorText != NULL) + { + eptr->anchorHRef = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + eptr->anchorName = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + + /* + * Picture stuff + */ + /* + * if we have an image resolver, use it. + */ + if (hw->html.resolveImage != NULL) + { + int internal; + + /* + * See if this is a special internal image + */ + if ((edata != NULL)&& + (strncmp(edata, INTERNAL_IMAGE, + strlen(INTERNAL_IMAGE)) == 0)) + { + internal = 1; + } + else + { + internal = 0; + } + + /* + * if we delay image fetching + * internal images are not delayed. + */ + if ((hw->html.delay_images == True)&& + (!internal)) + { + /* + * see if already cached. + */ + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveImage))(hw, edata, 1); + if (eptr->pic_data != NULL) + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + } + /* + * else, not cached. + */ + else + { + /* + * just image + */ + if (eptr->anchorHRef == NULL) + { + eptr->pic_data = DelayedImageData(hw, + False); + eptr->pic_data->delayed = 1; + eptr->anchorHRef = DelayedHRef(hw); + eptr->fg = hw->html.anchor_fg; + } + /* + * else anchor and image + */ + else + { + eptr->pic_data = DelayedImageData(hw, + True); + eptr->pic_data->delayed = 1; + } + } + } + else + { + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveImage))(hw, edata, 0); + if (eptr->pic_data != NULL) + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + } + } + if (eptr->pic_data != NULL) + { + eptr->pic_data->internal = internal; + } + } + if (eptr->pic_data == NULL) + { + eptr->pic_data = NoImageData(hw); + eptr->pic_data->delayed = 0; + eptr->pic_data->internal = 0; + } + + break; + case E_WIDGET: + /* + * get a unique element id + */ + WidgetId++; + ElementId++; + eptr->ele_id = ElementId; + + /* + * Widgets can't be underlined! + */ + eptr->underline_number = 0; + + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = NULL; + eptr->edata_len = 0; + + /* + * if this widget is part of an anchor put + * its href and name values into the element + * so we can reconnect it when activated. + */ + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + if (AnchorText != NULL) + { + eptr->anchorHRef = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_HREF); + eptr->anchorName = ParseMarkTag(AnchorText, + MT_ANCHOR, AT_NAME); + } + else + { + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + } + + /* + * Widget stuff + */ + eptr->widget_data = MakeWidget(hw, edata, + (x + IMAGE_BORDER), (y + IMAGE_BORDER), + WidgetId, CurrentForm); + + /* + * I have no idea what to do if we can't create the + * widget. It probably means we are so messed up we + * will soon be crashing. + */ + if (eptr->widget_data == NULL) + { + } + + break; + default: + fprintf(stderr, "SetElement: Unknown type %d\n", type); + eptr->ele_id = ElementId; + + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + eptr->edata = NULL; + eptr->edata_len = 0; + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + eptr->anchorHRef = NULL; + eptr->anchorName = NULL; + break; + } +} + + +/* + * Change our drawing font + */ +void +NewFont(fp) + XFontStruct *fp; +{ + /* + * Deal with bad Lucidia descents. + */ + if (fp->descent > fp->max_bounds.descent) + { + LineHeight = fp->max_bounds.ascent + fp->descent; + } + else + { + LineHeight = fp->max_bounds.ascent + fp->max_bounds.descent; + } +} + + +/* + * Place a linefeed at the end of a line. + * Create and add the element record for it. + */ +void +LinefeedPlace(hw, x, y) + HTMLWidget hw; + int *x, *y; +{ + /* + * At the end of every line check if we have a new MaxWidth + */ + if ((int)(*x + hw->html.margin_width) > MaxWidth) + { + MaxWidth = *x + hw->html.margin_width; + } + + SetElement(hw, E_LINEFEED, currentFont, *x, *y, (char *)NULL); +} + + +/* + * We have encountered a line break. Incrment the line counter, + * and move down some space. + */ +void +LineFeed(hw, x, y) + HTMLWidget hw; + int *x, *y; +{ + /* + * Manipulate linefeed state for special pre-formatted linefeed + * hack for broken HTMLs + */ + if (Preformat) + { + switch(PF_LF_State) + { + /* + * First soft linefeed + */ + case 0: + PF_LF_State = 1; + break; + /* + * Collapse multiple soft linefeeds within a pre + */ + case 1: + return; + break; + /* + * Ignore soft linefeeds after hard linefeeds + * within a pre + */ + case 2: + return; + break; + default: + PF_LF_State = 1; + break; + } + } + /* + * No blank lines allowed at the start of a document. + */ + else if (ElementId == 0) + { + return; + } + /* + * For formatted documents there are 3 linefeed states. + * 0 = in the middle of a line. + * 1 = at left margin + * 2 = at left margin with blank line above + */ + else + { + PF_LF_State++; + if (PF_LF_State > 2) + { + PF_LF_State = 2; + } + } + + /* + * sanity check to set some line height if none was specified. + */ + if (BaseLine <= 0) + { + BaseLine = LineHeight; + } + + LinefeedPlace(hw, x, y); + + CharsInLine = 0; + *x = TextIndent; + *y = *y + BaseLine + LineBottom; + + LineBottom = 0; + BaseLine = -100; + + NeedSpace = 0; + LineNumber++; +} + + +/* + * We want to make sure that future text starts at the left margin. + * But if we are already there, don't put in a new line. + */ +void +ConditionalLineFeed(hw, x, y, state) + HTMLWidget hw; + int *x, *y; + int state; +{ + if (PF_LF_State < state) + { + /* + * If this funtion is being used to insert a blank line, + * we need to look at the percentVerticalSpace resource + * to see how high to make the line. + */ + if ((state == 2)&&(hw->html.percent_vert_space > 0)) + { + int l_height; + + l_height = LineHeight; + LineHeight = LineHeight * + hw->html.percent_vert_space / 100; + LineFeed(hw, x, y); + LineHeight = l_height; + } + else + { + LineFeed(hw, x, y); + } + } +} + + +/* + * hack to make broken HTMLs within pre-formatted text have nice + * looking linefeeds. + */ +void +HardLineFeed(hw, x, y) + HTMLWidget hw; + int *x, *y; +{ + /* + * Manipulate linefeed state for special pre-formatted linefeed + * hack for broken HTMLs + */ + if (Preformat) + { + switch(PF_LF_State) + { + /* + * First hard linefeed + */ + case 0: + PF_LF_State = 2; + break; + /* + * Previous soft linefeed should have been ignored, so + * ignore this hard linefeed, but set state like it + * was not ignored. + */ + case 1: + PF_LF_State = 2; + return; + break; + /* + * Honor multiple hard linefeeds. + */ + case 2: + break; + default: + PF_LF_State = 2; + break; + } + } + + /* + * sanity check to set some line height if none was specified. + */ + if (BaseLine <= 0) + { + BaseLine = LineHeight; + } + + LinefeedPlace(hw, x, y); + + CharsInLine = 0; + *x = TextIndent; + *y = *y + BaseLine + LineBottom; + + LineBottom = 0; + BaseLine = -100; + + NeedSpace = 0; + LineNumber++; +} + + +static void +AdjustBaseLine() +{ + int baseline; + + baseline = Current->font->max_bounds.ascent; + + if (BaseLine == -100) + { + BaseLine = baseline; + Current->y_offset = 0; + if (LineBottom == 0) + { + LineBottom = LineHeight - baseline; + } + else + { + /* + * It is possible (with the first item + * in a line being a top aligned image) + * for LineBottom to have already been + * set. It now needs to be + * corrected as we set a real + * BaseLine + */ + if ((LineHeight - baseline) > + (LineBottom - baseline)) + { + LineBottom = LineHeight - + baseline; + } + else + { + LineBottom = LineBottom - + baseline; + } + } + } + else if (baseline <= BaseLine) + { + if (baseline < BaseLine) + { + Current->y_offset = BaseLine - baseline; + } + else + { + Current->y_offset = 0; + } + + if ((LineHeight - baseline) > LineBottom) + { + LineBottom = LineHeight - baseline; + } + } + else + { + struct ele_rec *eptr; + int line, incy; + + incy = baseline - BaseLine; + BaseLine = baseline; + + /* + * Go back over this line + * and move everything down + * a little. + */ + eptr = Current; + line = eptr->line_number; + while ((eptr->prev != NULL)&& + (eptr->prev->line_number == line)) + { + eptr = eptr->prev; + eptr->y_offset = eptr->y_offset + incy; + } + + if ((LineHeight - baseline) > LineBottom) + { + LineBottom = LineHeight - baseline; + } + } +} + + +/* + * Place the bullet at the beginning of an unnumbered + * list item. Create and add the element record for it. + */ +void +BulletPlace(hw, x, y) + HTMLWidget hw; + int *x, *y; +{ + int width, l_height; + + /* + * Save the font's line height, and set your own for this + * element. Restore the fonts height when done. + * Deal with bad Lucidia descents. + */ + l_height = LineHeight; + if (hw->html.font->descent > hw->html.font->max_bounds.descent) + { + LineHeight = hw->html.font->max_bounds.ascent + + hw->html.font->descent; + } + else + { + LineHeight = hw->html.font->max_bounds.ascent + + hw->html.font->max_bounds.descent; + } + + NeedSpace = 0; + width = hw->html.font->max_bounds.width; + SetElement(hw, E_BULLET, hw->html.font, *x, *y, (char *)NULL); + LineHeight = l_height; +/* + * This should reall be here, but it is a hack for headers on list + * elements to work if we leave it out + PF_LF_State = 0; + */ +} + + +/* + * Place a horizontal rule across the page. + * Create and add the element record for it. + */ +void +HRulePlace(hw, x, y, width) + HTMLWidget hw; + int *x, *y; + unsigned int width; +{ + NeedSpace = 0; + *x = hw->html.margin_width; + SetElement(hw, E_HRULE, currentFont, *x, *y, (char *)NULL); + *x = *x + width - (2 * hw->html.margin_width); + NeedSpace = 1; + PF_LF_State = 0; +} + + +/* + * Place the number at the beginning of an numbered + * list item. Create and add the element record for it. + */ +void +ListNumberPlace(hw, x, y, val) + HTMLWidget hw; + int *x, *y; + int val; +{ + int width, my_x; + int dir, ascent, descent; + XCharStruct all; + char buf[20]; + + sprintf(buf, "%d.", val); + + width = hw->html.font->max_bounds.lbearing + + hw->html.font->max_bounds.rbearing; + XTextExtents(currentFont, buf, strlen(buf), &dir, + &ascent, &descent, &all); + my_x = *x - (width / 2) - all.width; + /* + * Add a space after thenumber here so it will look right when + * cut and pasted from a selection. + */ + width = strlen(buf); + buf[width] = ' '; + buf[width + 1] = '\0'; + + SetElement(hw, E_TEXT, currentFont, my_x, *y, buf); + AdjustBaseLine(); + CharsInLine = CharsInLine + strlen(buf); + + NeedSpace = 0; +/* + * This should reall be here, but it is a hack for headers on list + * elements to work if we leave it out + PF_LF_State = 0; + */ +} + + +/* + * Place a piece of pre-formatted text. Add an element record for it. + */ +void +PreformatPlace(hw, mptr, x, y, width) + HTMLWidget hw; + struct mark_up *mptr; + int *x, *y; + unsigned int width; +{ + char *text; + char *start; + char *end; + char *ptr; + char tchar; + int tab_count, char_cnt; + int dir, ascent, descent; + XCharStruct all; + char *line; + int line_x; + + text = mptr->text; + + line_x = *x; + line = CompLine; + if (line != NULL) + { + line[0] = '\0'; + } + end = text; + while (*end != '\0') + { + tab_count = 0; + char_cnt = CharsInLine; + /* + * make start and end point to one word. A word is either + * a lone linefeed, or all whitespace before a word, plus + * the text of the word itself. + */ + start = end; + /* + * Throw out carriage returns and form-feeds + */ + if ((*end == '\r')||(*end == '\f')) + { + start++; + end++; + } + else if (*end == '\n') + { + end++; + char_cnt++; + } + else + { + /* + * Should be only spaces and tabs here, so if it + * is not a tab, make it a space. + * Break on linefeeds, they must be done separately + */ + while (((int)((unsigned char)*end) < 128)&& + (isspace(*end))) + { + if (*end == '\n') + { + break; + } + else if (*end == '\t') + { + tab_count++; + char_cnt = ((char_cnt / 8) + 1) * 8; + } + else + { + *end = ' '; + char_cnt++; + } + end++; + } + while (((int)((unsigned char)*end) > 127)|| + ((!isspace(*end))&&(*end != '\0'))) + { + end++; + char_cnt++; + } + } + + /* + * Add the word to the end of this line, or insert + * a linefeed if the word is a lone linefeed. + * tabs expand to 8 spaces. + */ + if (start != end) + { + int tlen; + + tchar = *end; + *end = '\0'; + + tlen = char_cnt + 1; + if (tlen > CompWordLen) + { + CompWordLen += COMP_LINE_BUF_LEN; + if (tlen > CompWordLen) + { + CompWordLen = tlen; + } + if (CompWord != NULL) + { + free(CompWord); + } + CompWord = (char *)malloc(CompWordLen); + } + ptr = CompWord; + + /* + * If we have any tabs, expand them into spaces. + */ + if (tab_count) + { + char *p1, *p2; + int i, new; + + char_cnt = CharsInLine; + p1 = ptr; + p2 = start; + while (*p2 != '\0') + { + if (*p2 == '\t') + { + new = ((char_cnt / 8) + 1) * 8; + for (i=0; i<(new-char_cnt); i++) + { + *p1++ = ' '; + } + p2++; + char_cnt = new; + } + else + { + *p1++ = *p2++; + char_cnt++; + } + } + *p1 = '\0'; + } + else + { + strcpy(ptr, start); + } + +#ifdef ASSUME_FIXED_WIDTH_PRE + all.width = currentFont->max_bounds.width * strlen(ptr); +#else + XTextExtents(currentFont, ptr, strlen(ptr), &dir, + &ascent, &descent, &all); +#endif /* ASSUME_FIXED_WIDTH_PRE */ + + if (*start == '\n') + { + if ((line != NULL)&&(line[0] != '\0')) + { + SetElement(hw, E_TEXT, currentFont, + line_x, *y, line); + /* + * Save width here to avoid an + * XTextExtents call later. + */ + Current->width = *x - line_x + 1; + + AdjustBaseLine(); + PF_LF_State = 0; + + line[0] = '\0'; + } + + HardLineFeed(hw, x, y); + line_x = *x; + NeedSpace = 0; + } + else + { + char *tptr; + int tlen; + + if (line == NULL) + { + tlen = strlen(ptr) + 1; + } + else + { + tlen = strlen(line) + + strlen(ptr) + 1; + } + if (tlen > CompLineLen) + { + CompLineLen += COMP_LINE_BUF_LEN; + if (tlen > CompLineLen) + { + CompLineLen = tlen; + } + tptr = (char *)malloc(CompLineLen); + if (CompLine != NULL) + { + strcpy(tptr, CompLine); + free(CompLine); + } + else + { + tptr[0] = '\0'; + } + CompLine = tptr; + } + line = CompLine; + + strcat(line, ptr); + + *x = *x + all.width; + CharsInLine = CharsInLine + strlen(ptr); + NeedSpace = 1; + } + *end = tchar; + } + } + if ((line != NULL)&&(line[0] != '\0')) + { + SetElement(hw, E_TEXT, currentFont, + line_x, *y, line); + /* + * Save width here to avoid an + * XTextExtents call later. + */ + Current->width = *x - line_x + 1; + + AdjustBaseLine(); + PF_LF_State = 0; + line[0] = '\0'; + } +} + + +/* + * Format and place a piece of text. Add an element record for it. + */ +void +FormatPlace(hw, mptr, x, y, width) + HTMLWidget hw; + struct mark_up *mptr; + int *x, *y; + unsigned int width; +{ + char *text; + char *start; + char *end; + char *ptr; + char tchar; +#ifdef DOUBLE_SPACE_AFTER_PUNCT + char tchar2; +#endif /* DOUBLE_SPACE_AFTER_PUNCT */ + int stripped_space; + int added_space; + int double_space; + int dir, ascent, descent; + XCharStruct all; + char *line; + int line_x; + + text = mptr->text; + + line_x = *x; + line = CompLine; + if (line != NULL) + { + line[0] = '\0'; + } + end = text; + while (*end != '\0') + { + /* + * make start and end point to one word. + * set flag if we removed any leading white space. + * set flag if we add any leading white space. + */ + stripped_space = 0; + added_space = 0; + start = end; + while (((int)((unsigned char)*start) < 128)&&(isspace(*start))) + { + stripped_space = 1; + start++; + } + + end = start; + while (((int)((unsigned char)*end) > 127)|| + ((!isspace(*end))&&(*end != '\0'))) + { + end++; + } + + /* + * Add the word to the end of this line, or insert + * a linefeed an put the word at the start of the next line. + */ + if (start != end) + { + int nobreak; + int tlen; + + /* + * nobreak is a horrible hack that specifies special + * conditions where line breaks are just not allowed + */ + nobreak = 0; + + tchar = *end; + *end = '\0'; + + /* + * Malloc temp space if needed, leave room for + * 2 spaces and a end of string char + */ + tlen = strlen(start) + 3; + if (tlen > CompWordLen) + { + CompWordLen += COMP_LINE_BUF_LEN; + if (tlen > CompWordLen) + { + CompWordLen = tlen; + } + if (CompWord != NULL) + { + free(CompWord); + } + CompWord = (char *)malloc(CompWordLen); + } + ptr = CompWord; + + if ((NeedSpace > 0)&&(stripped_space)) + { + if (NeedSpace == 2) + { + strcpy(ptr, " "); + added_space = 2; + } + else + { + strcpy(ptr, " "); + added_space = 1; + } + } + else + { + strcpy(ptr, ""); + } + strcat(ptr, start); + +#ifdef DOUBLE_SPACE_AFTER_PUNCT + /* + * If this text ends in '.', '!', or '?' we need + * to set up the addition of two spaces after it. + */ + tchar2 = ptr[strlen(ptr) - 1]; + if ((tchar2 == '.')||(tchar2 == '!')||(tchar2 == '?')) + { + double_space = 1; + } + else + { + double_space = 0; + } +#else + double_space = 0; +#endif /* DOUBLE_SPACE_AFTER_PUNCT */ + + XTextExtents(currentFont, ptr, strlen(ptr), &dir, + &ascent, &descent, &all); + + /* + * Horrible hack for punctuation following + * font changes to not go on the next line. + */ + if ((MY_ISPUNCT(*ptr))&&(added_space == 0)) + { + char *tptr; + + /* + * Take into account whole streams of + * punctuation. + */ + nobreak = 1; + tptr = ptr; + while ((*tptr != '\0')&&(MY_ISPUNCT(*tptr))) + { + tptr++; + } + if (*tptr != '\0') + { + nobreak = 0; + } + } + + /* + * No linebreaks if this whole line is just too + * long. + */ + if (*x == TextIndent) + { + nobreak = 1; + } + + if (((*x + all.width + MarginW) <= width)||(nobreak)) + { + char *tptr; + int tlen; + + if (line == NULL) + { + tlen = strlen(ptr) + 1; + } + else + { + tlen = strlen(line) + + strlen(ptr) + 1; + } + if (tlen > CompLineLen) + { + CompLineLen += COMP_LINE_BUF_LEN; + if (tlen > CompLineLen) + { + CompLineLen = tlen; + } + tptr = (char *)malloc(CompLineLen); + if (CompLine != NULL) + { + strcpy(tptr, CompLine); + free(CompLine); + } + else + { + tptr[0] = '\0'; + } + CompLine = tptr; + } + line = CompLine; + + strcat(line, ptr); + } + else + { + char *tptr, *tptr2; + int tlen; + + if ((line != NULL)&&(line[0] != '\0')) + { + SetElement(hw, E_TEXT, currentFont, + line_x, *y, line); + /* + * Save width here to avoid an + * XTextExtents call later. + */ + Current->width = *x - line_x + 1; + + AdjustBaseLine(); + PF_LF_State = 0; + + line[0] = '\0'; + } + + LineFeed(hw, x, y); + line_x = *x; + + /* + * If we added a space before, remove it now + * since we are at the beginning of a new line + */ + if (added_space) + { + tptr2 = (char *)(ptr + added_space); + } + else + { + tptr2 = ptr; + } + XTextExtents(currentFont, tptr2, + strlen(tptr2), &dir, + &ascent, &descent, &all); + + if (line == NULL) + { + tlen = strlen(tptr2) + 1; + } + else + { + tlen = strlen(line) + + strlen(tptr2) + 1; + } + if (tlen > CompLineLen) + { + CompLineLen += COMP_LINE_BUF_LEN; + if (tlen > CompLineLen) + { + CompLineLen = tlen; + } + tptr = (char *)malloc(CompLineLen); + if (CompLine != NULL) + { + strcpy(tptr, CompLine); + free(CompLine); + } + else + { + tptr[0] = '\0'; + } + CompLine = tptr; + } + line = CompLine; + + strcat(line, tptr2); + } + + /* + * Set NeedSpace for one or 2 spaces based on + * whether we are after a '.', '!', or '?' + * or not. + */ + if (double_space) + { + NeedSpace = 2; + } + else + { + NeedSpace = 1; + } + + *x = *x + all.width; + *end = tchar; + } + /* + * Else if there is trailing whitespace, add it now + */ + else if ((NeedSpace > 0)&&(stripped_space)) + { + char *tptr; + char *spc; + int tlen; + + if (NeedSpace == 2) + { + spc = (char *)malloc(strlen(" ") + 1); + strcpy(spc, " "); + } + else + { + spc = (char *)malloc(strlen(" ") + 1); + strcpy(spc, " "); + } + + XTextExtents(currentFont, spc, strlen(spc), &dir, + &ascent, &descent, &all); + + /* + * Sigh, adding this one little space might force a + * line break. + */ + if ((*x + all.width + MarginW) <= width) + { + if (line == NULL) + { + tlen = strlen(spc) + 1; + } + else + { + tlen = strlen(line) + + strlen(spc) + 1; + } + if (tlen > CompLineLen) + { + CompLineLen += COMP_LINE_BUF_LEN; + if (tlen > CompLineLen) + { + CompLineLen = tlen; + } + tptr = (char *)malloc(CompLineLen); + if (CompLine != NULL) + { + strcpy(tptr, CompLine); + free(CompLine); + } + else + { + tptr[0] = '\0'; + } + CompLine = tptr; + } + line = CompLine; + + strcat(line, spc); + } + /* + * Ok, the space forced a linefeed, but now we must + * also drop the space since we don't want it if we + * have a linefeed here. + */ + else + { + if ((line != NULL)&&(line[0] != '\0')) + { + SetElement(hw, E_TEXT, currentFont, + line_x, *y, line); + /* + * Save width here to avoid an + * XTextExtents call later. + */ + Current->width = *x - line_x + 1; + + AdjustBaseLine(); + PF_LF_State = 0; + + line[0] = '\0'; + } + + LineFeed(hw, x, y); + line_x = *x; + + all.width = 0; + } + + *x = *x + all.width; + if (spc) + free(spc); + NeedSpace = 0; + } + } + if ((line != NULL)&&(line[0] != '\0')) + { + SetElement(hw, E_TEXT, currentFont, + line_x, *y, line); + /* + * Save width here to avoid an + * XTextExtents call later. + */ + Current->width = *x - line_x + 1; + + AdjustBaseLine(); + PF_LF_State = 0; + line[0] = '\0'; + } +} + + +/* + * Place an image. Add an element record for it. + */ +void +ImagePlace(hw, mptr, x, y, width) + HTMLWidget hw; + struct mark_up *mptr; + int *x, *y; + unsigned int width; +{ + char *tptr; + +#ifdef SPACE_HACK + /* + * If we are starting an image in formatted + * text, and it needs a preceeding space, add + * that space now. + */ + if ((!Preformat)&&(NeedSpace > 0)) + { + int dir, ascent, descent; + XCharStruct all; + + if (NeedSpace == 2) + { + tptr = (char *)malloc(strlen(" ") + 1); + strcpy(tptr, " "); + } + else + { + tptr = (char *)malloc(strlen(" ") + 1); + strcpy(tptr, " "); + } + + XTextExtents(currentFont, tptr, + strlen(tptr), &dir, &ascent, + &descent, &all); + SetElement(hw, E_TEXT, currentFont, + *x, *y, tptr); + /* + * Save width here to avoid an + * XTextExtents call later. + */ + Current->width = all.width; + + AdjustBaseLine(); + *x = *x + all.width; + CharsInLine = CharsInLine + strlen(tptr); + if (tptr) + free(tptr); + PF_LF_State = 0; + NeedSpace = 0; + } +#endif /* SPACE_HACK */ + + tptr = ParseMarkTag(mptr->start, MT_IMAGE, "SRC"); + SetElement(hw, E_IMAGE, currentFont, *x, *y, tptr); + + /* + * Only after we have placed the image do we know its dimensions. + * So now look and see if the image is too wide, and if so go + * back and insert a linebreak. + */ + if ((Current->pic_data != NULL)&&(!Preformat)) + { + int extra; + + if ((hw->html.border_images == True)|| + ((Current->anchorHRef != NULL)&& + (!Current->pic_data->internal))) + { + extra = 2 * IMAGE_BORDER; + } + else + { + extra = 0; + } + + if (((*x + Current->pic_data->width + extra + MarginW) >width)&& + (Current->prev != NULL)&& + (Current->prev->line_number == LineNumber)) + { + Current = Current->prev; + LineFeed(hw, x, y); + SetElement(hw, E_IMAGE, currentFont, *x, *y, tptr); + } + } + /* + * Clean up parsed SRC string + */ + if (tptr != NULL) + { + free(tptr); + } + + /* + * Yank out the name field, and stick it in text. + * We may use this for ALT to at some later date. + */ + if (Current->pic_data != NULL) + { + tptr = ParseMarkTag(mptr->start, MT_IMAGE, "NAME"); + Current->pic_data->text = tptr; + } + + /* + * Check if this image has the ISMAP attribute, so we know the + * x,y coordinates of the image click are important. + * Due to a special case (see below), this code can acutally + * change the size, or anchor status of the image, thus we MUST + * doit before we muck with the Baseline and stuff. + */ + if (Current->pic_data != NULL) + { + Current->pic_data->fptr = NULL; + tptr = ParseMarkTag(mptr->start, MT_IMAGE, "ISMAP"); + if (tptr != NULL) + { + free(tptr); + Current->pic_data->ismap = 1; + /* + * SUPER SPECIAL CASE! (Thanks Marc) + * If you have an ISMAP image inside a form, + * And that form doesn't already have an HREF + * by being inside an anchor, + * (Being a DelayedHRef is considered no href) + * clicking in that image will submit the form, + * adding the x,y coordinates of the click as part + * of the list of name/value pairs. + */ + if ((CurrentForm != NULL)&& + ((Current->anchorHRef == NULL)|| + (IsDelayedHRef(hw, Current->anchorHRef)))) + { + Current->pic_data->fptr = CurrentForm; + Current->anchorHRef = IsMapForm(hw); + Current->fg = hw->html.anchor_fg; + } + } + else + { + Current->pic_data->ismap = 0; + } + } + + /* + * Check if this image will be top aligned + */ + tptr = ParseMarkTag(mptr->start, MT_IMAGE, "ALIGN"); + if (caseless_equal(tptr, "TOP")) + { + Current->alignment = ALIGN_TOP; + } + else if (caseless_equal(tptr, "MIDDLE")) + { + Current->alignment = ALIGN_MIDDLE; + } + else + { + Current->alignment = ALIGN_BOTTOM; + } + /* + * Clean up parsed ALIGN string + */ + if (tptr != NULL) + { + free(tptr); + } + + /* + * Advance x position, and check the max + * line height. We need to follow this + * image with a space. + */ + if (Current->pic_data != NULL) + { + int extra; + + if ((hw->html.border_images == True)|| + ((Current->anchorHRef != NULL)&& + (!Current->pic_data->internal))) + { + extra = 2 * IMAGE_BORDER; + } + else + { + extra = 0; + } + + if (BaseLine == -100) + { + BaseLine = 0; + } + + *x = *x + Current->pic_data->width + extra; + + if (Current->alignment == ALIGN_TOP) + { + Current->y_offset = 0; + + if ((Current->pic_data->height + extra - BaseLine) > + LineBottom) + { + LineBottom = Current->pic_data->height + extra - + BaseLine; + } + } + else if (Current->alignment == ALIGN_MIDDLE) + { + int baseline; + + baseline = (Current->pic_data->height + extra) / 2; + + if (baseline <= BaseLine) + { + Current->y_offset = BaseLine - baseline; + } + else + { + struct ele_rec *eptr; + int line, incy; + + Current->y_offset = 0; + + incy = baseline - BaseLine; + BaseLine = baseline; + + /* + * Go back over this line + * and move everything down + * a little. + */ + eptr = Current; + line = eptr->line_number; + while ((eptr->prev != NULL)&& + (eptr->prev->line_number == line)) + { + eptr = eptr->prev; + eptr->y_offset = eptr->y_offset + incy; + } + } + + if ((Current->pic_data->height + extra - BaseLine) > + LineBottom) + { + LineBottom = Current->pic_data->height + extra - + BaseLine; + } + } + else if ((Current->pic_data->height + extra) <= BaseLine) + { + Current->y_offset = BaseLine - + (Current->pic_data->height + extra); + } + else if ((Current->pic_data->height + extra) > BaseLine) + { + struct ele_rec *eptr; + int line, incy; + + incy = Current->pic_data->height + extra - BaseLine; + BaseLine = Current->pic_data->height + extra; + + /* + * Go back over this line + * and move everything down + * a little. + */ + eptr = Current; + line = eptr->line_number; + while ((eptr->prev != NULL)&& + (eptr->prev->line_number == line)) + { + eptr = eptr->prev; + eptr->y_offset = eptr->y_offset + incy; + } + } + + if (BaseLine == 0) + { + BaseLine = -100; + } + } + PF_LF_State = 0; + NeedSpace = 1; +} + + +/* + * Place an Widget. Add an element record for it. + */ +void +WidgetPlace(hw, mptr, x, y, width) + HTMLWidget hw; + struct mark_up *mptr; + int *x, *y; + unsigned int width; +{ + SetElement(hw, E_WIDGET, currentFont, *x, *y, mptr->start); + + /* + * Only after we have placed the widget do we know its dimensions. + * So now look and see if the widget is too wide, and if so go + * back and insert a linebreak. + */ + if ((Current->widget_data != NULL)&&(!Preformat)) + { + int extra; + + extra = 2 * IMAGE_BORDER; + + if (((*x + Current->widget_data->width + extra + MarginW) > + width)&& + (Current->prev != NULL)&& + (Current->prev->line_number == LineNumber)) + { + WidgetId--; + Current = Current->prev; + LineFeed(hw, x, y); + SetElement(hw, E_WIDGET, currentFont, *x, *y, + mptr->start); + } + } + + /* + * Advance x position, and check BaseLine and LineBottom. + * We need to follow this widget with a space. + */ + if (Current->widget_data != NULL) + { + int extra; + int baseline; + XFontStruct *fp; + + extra = 2 * IMAGE_BORDER; + + /* + * Find the font used in this widget. Then find its baseline + */ + fp = GetWidgetFont(hw, Current->widget_data); + if (fp == NULL) + { + baseline = Current->widget_data->height + extra; + } + /* + * If no font, the baseline is the bottum of the widget + */ + else + { + int border; + + border = ((Current->widget_data->height + extra) - + (fp->max_bounds.ascent + fp->max_bounds.descent)); + baseline = (border / 2) + fp->max_bounds.ascent; + } + + /* + * Baseline == -100 is the special unset baseline value. + */ + if (BaseLine == -100) + { + BaseLine = baseline; + Current->y_offset = 0; + /* + * If linebottom isn't set, set it to + * whatever of the height is below the baseline. + */ + if (LineBottom == 0) + { + LineBottom = Current->widget_data->height + + extra - baseline; + } + /* + * Else, it is possible that a linebottom has been + * set even when we have no baseline yet (like if + * the first item in the line was a top aligned image) + * It now needs to be corrected as we set a real + * BaseLine. + */ + else + { + if ((Current->widget_data->height + + extra - baseline) > + (LineBottom - baseline)) + { + LineBottom = + Current->widget_data->height + + extra - baseline; + } + else + { + LineBottom = LineBottom - baseline; + } + } + } + /* + * Else we already have a baseline, and it is greater that + * the baseline for this widget. + * Set y_offset, and check linebottom. + */ + else if (baseline <= BaseLine) + { + if (baseline < BaseLine) + { + Current->y_offset = BaseLine - baseline; + } + else + { + Current->y_offset = 0; + } + + /* + * Our line bottom may be greater than the + * old one. + */ + if ((Current->widget_data->height + extra - baseline) > + LineBottom) + { + LineBottom = Current->widget_data->height + + extra - baseline; + } + } + else + /* + * Else we have a new baseline greater than the old baseline. + */ + { + struct ele_rec *eptr; + int line, incy; + + /* + * Figure out how much to move all the old stuff + */ + incy = baseline - BaseLine; + BaseLine = baseline; + + /* + * Go back over this line + * and move everything down + * a little. + */ + eptr = Current; + line = eptr->line_number; + while ((eptr->prev != NULL)&& + (eptr->prev->line_number == line)) + { + eptr = eptr->prev; + eptr->y_offset = eptr->y_offset + incy; + } + + /* + * Our line bottom may be greater than the + * old one. + */ + if ((Current->widget_data->height + extra - baseline) > + LineBottom) + { + LineBottom = Current->widget_data->height + + extra - baseline; + } + } + + /* + * Advance the X position. + */ + *x = *x + Current->widget_data->width + extra; + } + PF_LF_State = 0; + NeedSpace = 1; +} + + +static void +PushFont(font) + XFontStruct *font; +{ + FontRec *fptr; + + fptr = (FontRec *)malloc(sizeof(FontRec)); + if (fptr == NULL) + { + fprintf(stderr, "No memory to expand font stack!\n"); + return; + } + + fptr->font = font; + fptr->next = FontStack; + FontStack = fptr; +} + + +static XFontStruct * +PopFont() +{ + XFontStruct *font; + FontRec *fptr; + + if (FontStack->next != NULL) + { + fptr = FontStack; + FontStack = FontStack->next; + font = fptr->font; + free((char *)fptr); + } + else + { +#ifdef VERBOSE + fprintf(stderr, "Warning, popping empty font stack!\n"); +#endif + font = FontStack->font; + } + + return(font); +} + + +/* + * We've just terminated the current OPTION. + * Put it in the proper place in the SelectInfo structure. + * Move option_buf into options, and maybe copy into + * value if is_value is set. + */ +static void +ProcessOption(sptr) + SelectInfo *sptr; +{ + int i, cnt; + char **tarray; + + clean_white_space(sptr->option_buf); + tarray = sptr->options; + cnt = sptr->option_cnt + 1; + sptr->options = (char **)malloc(sizeof(char *) * cnt); + for (i=0; i<(cnt - 1); i++) + { + sptr->options[i] = tarray[i]; + } + if (tarray != NULL) + { + free((char *)tarray); + } + sptr->options[cnt - 1] = sptr->option_buf; + sptr->option_cnt = cnt; + + tarray = sptr->returns; + cnt = sptr->option_cnt; + sptr->returns = (char **)malloc(sizeof(char *) * cnt); + for (i=0; i<(cnt - 1); i++) + { + sptr->returns[i] = tarray[i]; + } + if (tarray != NULL) + { + free((char *)tarray); + } + sptr->returns[cnt - 1] = sptr->retval_buf; + + if (sptr->is_value) + { + tarray = sptr->value; + cnt = sptr->value_cnt + 1; + sptr->value = (char **)malloc(sizeof(char *) * cnt); + for (i=0; i<(cnt - 1); i++) + { + sptr->value[i] = tarray[i]; + } + if (tarray != NULL) + { + free((char *)tarray); + } + sptr->value[cnt - 1] = (char *)malloc( + strlen(sptr->option_buf) + 1); + strcpy(sptr->value[cnt - 1], sptr->option_buf); + sptr->value_cnt = cnt; + } +} + + +/* + * Horrible code for the TEXTAREA element. Escape '\' and ''' by + * putting a '\' in front of them, then replace all '"' with '''. + * This lets us safely put the resultant value between double quotes. + */ +char * +TextAreaAddValue(value, text) + char *value; + char *text; +{ + int extra; + char *buf; + char *bptr; + char *tptr; + + if ((text == NULL)||(text[0] == '\0')) + { + return(value); + } + + extra = 0; + tptr = text; + while (*tptr != '\0') + { + if (*tptr == '\\') + { + extra++; + } + else if (*tptr == '\'') + { + extra++; + } + tptr++; + } + + buf = (char *)malloc(strlen(value) + strlen(text) + extra + 1); + if (buf == NULL) + { + return(value); + } + strcpy(buf, value); + + tptr = text; + bptr = (char *)(buf + strlen(value)); + while (*tptr != '\0') + { + if ((*tptr == '\\')||(*tptr == '\'')) + { + *bptr++ = '\\'; + *bptr++ = *tptr++; + } + else if (*tptr == '\"') + { + *bptr++ = '\''; + tptr++; + } + else + { + *bptr++ = *tptr++; + } + } + *bptr = '\0'; + + free(value); + return(buf); +} + + +/* + * Make necessary changes to formatting, based on the type of the + * parsed HTML text we are formatting. + * Some calls create elements that are added to the formatted element list. + */ +void +TriggerMarkChanges(hw, mptr, x, y) + HTMLWidget hw; + struct mark_up *mptr; + int *x, *y; +{ + struct mark_up *mark; + XFontStruct *font; + int type, width; + + mark = mptr; + type = mark->type; + font = NULL; + + /* + * If Ignore is set, we ignore all further elements until we get to the + * end of the Ignore + * Let text through so we can grab the title text. + * Let title through so we can hit the end title. + * Now also used for SELECT parseing + * Let SELECT through so we can hit the end SELECT. + * Let OPTION through so we can hit the OPTIONs. + * Let TEXTAREA through so we can hit the TEXTAREAs. + */ + if ((Ignore)&&(type != M_TITLE)&&(type != M_NONE)&& + (type != M_SELECT)&&(type != M_OPTION)&& + (type != M_TEXTAREA)) + { + return; + } + + switch(type) + { + /* + * Place the text. Different functions based on whether it + * is pre-formatted or not. + */ + case M_NONE: + if ((Ignore)&&(CurrentSelect == NULL)&& + (TextAreaBuf == NULL)) + { + if (TitleText == NULL) + { + TitleText = (char *) + malloc(strlen(mptr->text) + 1); + strcpy(TitleText, mptr->text); + } + else + { + char *tptr; + + tptr = (char *) + malloc(strlen(TitleText) + + strlen(mptr->text) + 1); + strcpy(tptr, TitleText); + strcat(tptr, mptr->text); + free(TitleText); + TitleText = tptr; + } + } + else if ((Ignore)&&(CurrentSelect != NULL)) + { + if (CurrentSelect->option_buf != NULL) + { + char *tptr; + + tptr = (char *)malloc(strlen( + CurrentSelect->option_buf) + + strlen(mptr->text) + 1); + strcpy(tptr, CurrentSelect->option_buf); + strcat(tptr, mptr->text); + free(CurrentSelect->option_buf); + CurrentSelect->option_buf = tptr; + } + } + else if ((Ignore)&&(TextAreaBuf != NULL)) + { + TextAreaBuf = TextAreaAddValue(TextAreaBuf, + mptr->text); + } + else if (Preformat) + { + PreformatPlace(hw, mptr, x, y, Width); + } + else + { + FormatPlace(hw, mptr, x, y, Width); + } + break; + /* + * Titles are just set into the widget for retrieval by + * XtGetValues(). + */ + case M_TITLE: + if (mark->is_end) + { + Ignore = 0; + hw->html.title = TitleText; + TitleText = NULL; + } + else + { + Ignore = 1; + TitleText = NULL; + } + break; + /* + * Formatting commands just change the current font. + */ + case M_CODE: + case M_SAMPLE: + case M_KEYBOARD: + case M_FIXED: + if (mark->is_end) + { + font = PopFont(); + } + else + { + PushFont(currentFont); + font = hw->html.fixed_font; + } + break; + case M_STRONG: + case M_BOLD: + if (mark->is_end) + { + font = PopFont(); + } + else + { + PushFont(currentFont); + if (currentFont == hw->html.fixed_font || + currentFont == hw->html.fixeditalic_font) + font = hw->html.fixedbold_font; + else if (currentFont == hw->html.plain_font || + currentFont == hw->html.plainitalic_font) + font = hw->html.plainbold_font; + else + font = hw->html.bold_font; + } + break; + case M_EMPHASIZED: + case M_VARIABLE: + case M_CITATION: + case M_ITALIC: + if (mark->is_end) + { + font = PopFont(); + } + else + { + PushFont(currentFont); + if (currentFont == hw->html.fixed_font || + currentFont == hw->html.fixedbold_font) + font = hw->html.fixeditalic_font; + else if (currentFont == hw->html.plain_font || + currentFont == hw->html.plainbold_font) + font = hw->html.plainitalic_font; + else + font = hw->html.italic_font; + } + break; + /* + * Strikeout means draw a line through the text. + * Right now we just set a boolean flag which gets shoved + * in the element record for all elements in the + * strikeout zone. + */ + case M_STRIKEOUT: + if (mark->is_end) + { + Strikeout = False; + } + else + { + Strikeout = True; + } + break; + /* + * Headers are preceeded and followed by a linefeed, + * and the change the font. + */ + case M_HEADER_1: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 2); + PushFont(currentFont); + font = hw->html.header1_font; + } + break; + case M_HEADER_2: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 2); + PushFont(currentFont); + font = hw->html.header2_font; + } + break; + case M_HEADER_3: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 2); + PushFont(currentFont); + font = hw->html.header3_font; + } + break; + case M_HEADER_4: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 2); + PushFont(currentFont); + font = hw->html.header4_font; + } + break; + case M_HEADER_5: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 2); + PushFont(currentFont); + font = hw->html.header5_font; + } + break; + case M_HEADER_6: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 2); + PushFont(currentFont); + font = hw->html.header6_font; + } + break; + /* + * Anchors change the text color, and may set + * underlineing attributes. + * No linefeeds, so they can be imbedded anywhere. + */ + case M_ANCHOR: + if (mark->is_end) + { +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + Fg = hw->manager.foreground; +#else + Fg = hw->html.foreground; +#endif /* MOTIF */ + Underlines = 0; + DashedUnderlines = False; + AnchorText = NULL; + } + else + { + char *tptr; + + /* + * Only change the color of anchors with + * HREF tags, because other anchors are + * not active. + */ + tptr = ParseMarkTag(mark->start, + MT_ANCHOR, AT_HREF); + if (tptr != NULL) + { + /* + * If internal check our internal list + * to change color if visited before. + */ + if (Internal == True) + { + struct ref_rec *hptr; + + hptr = FindHRef( + hw->html.my_visited_hrefs, + tptr); + if (hptr != NULL) + { + Fg = hw->html.visitedAnchor_fg; + Underlines = hw->html.num_visitedAnchor_underlines; + DashedUnderlines = hw->html.dashed_visitedAnchor_lines; + } + else + { + Fg = hw->html.anchor_fg; + Underlines = hw->html.num_anchor_underlines; + DashedUnderlines = hw->html.dashed_anchor_lines; + } + } + /* + * Else we may want to send + * the href back somewhere else and + * find out if we've visited it before + */ + else if (hw->html.previously_visited_test != + NULL) + { + if ((*(visitTestProc) + (hw->html.previously_visited_test)) + (hw, hw->html.vt_client_data, tptr)) + { + Fg = hw->html.visitedAnchor_fg; + Underlines = hw->html.num_visitedAnchor_underlines; + DashedUnderlines = hw->html.dashed_visitedAnchor_lines; + } + else + { + Fg = hw->html.anchor_fg; + Underlines = hw->html.num_anchor_underlines; + DashedUnderlines = hw->html.dashed_anchor_lines; + } + } + else + { + Fg = hw->html.anchor_fg; + Underlines = hw->html.num_anchor_underlines; + DashedUnderlines = hw->html.dashed_anchor_lines; + } + if (tptr) + free(tptr); + } + AnchorText = mark->start; + } + break; + /* + * Just insert a linefeed, or ignore if this is prefomatted + * text because the <P> will be followed be a linefeed. + */ + case M_PARAGRAPH: + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + break; + /* + * Just insert the image for now + */ + case M_IMAGE: + ImagePlace(hw, mptr, x, y, Width); + break; + /* + * Can only be inside a SELECT tag. + */ + case M_OPTION: + if (CurrentSelect != NULL) + { + char *tptr; + + if (CurrentSelect->option_buf != NULL) + { + ProcessOption(CurrentSelect); + } + CurrentSelect->option_buf = (char *)malloc(1); + strcpy(CurrentSelect->option_buf, ""); + + /* + * Check if this option starts selected + */ + tptr = ParseMarkTag(mark->start, + MT_OPTION, "SELECTED"); + if (tptr != NULL) + { + CurrentSelect->is_value = 1; + free(tptr); + } + else + { + CurrentSelect->is_value = 0; + } + + /* + * Check if this option has an different + * return value field. + */ + tptr = ParseMarkTag(mark->start, + MT_OPTION, "VALUE"); + if (tptr != NULL) + { + if (*tptr != '\0') + { + CurrentSelect->retval_buf = tptr; + } + else + { + CurrentSelect->retval_buf = NULL; + free(tptr); + } + } + else + { + CurrentSelect->retval_buf = NULL; + } + } + break; + /* + * Special INPUT tag. Allows an option menu or + * a scrolled list. + * Due to a restriction in SGML, this can't just be a + * subset of the INPUT markup. However, I can treat it + * that way to avoid duplicating code. + * As a result I combine SELECT and OPTION into a faked + * up INPUT mark. + */ + case M_SELECT: + if (CurrentForm != NULL) + { + if ((mark->is_end)&&(CurrentSelect != NULL)) + { + int len; + char *buf; + char *start; + char *options, *returns, *value; + + if (CurrentSelect->option_buf != NULL) + { + ProcessOption(CurrentSelect); + } + + options = ComposeCommaList( + CurrentSelect->options, + CurrentSelect->option_cnt); + returns = ComposeCommaList( + CurrentSelect->returns, + CurrentSelect->option_cnt); + value = ComposeCommaList( + CurrentSelect->value, + CurrentSelect->value_cnt); + FreeCommaList( + CurrentSelect->options, + CurrentSelect->option_cnt); + FreeCommaList( + CurrentSelect->returns, + CurrentSelect->option_cnt); + FreeCommaList( + CurrentSelect->value, + CurrentSelect->value_cnt); + + /* + * Construct a fake INPUT tag. + */ + len = strlen(MT_INPUT) + + strlen(options) + + strlen(returns) + + strlen(value) + strlen( + " type=select options=\"\" returns=\"\" value=\"\""); + buf = (char *)malloc(len + + strlen(CurrentSelect->mptr->start) + + 1); + strcpy(buf, MT_INPUT); + strcat(buf, " type=select"); + strcat(buf, " options=\""); + strcat(buf, options); + strcat(buf, "\" returns=\""); + strcat(buf, returns); + strcat(buf, "\" value=\""); + strcat(buf, value); + strcat(buf, "\""); + strcat(buf, (char *) + (CurrentSelect->mptr->start + + strlen(MT_SELECT))); + /* + * stick the fake in, saving the + * real one. + */ + start = CurrentSelect->mptr->start; + CurrentSelect->mptr->start = buf; + WidgetPlace(hw, CurrentSelect->mptr, + x, y, Width); + /* + * free the fake, put the original back + */ + free(buf); + free(options); + free(returns); + free(value); + CurrentSelect->mptr->start = start; + + free((char *)CurrentSelect); + CurrentSelect = NULL; + Ignore = 0; + } + else if ((!mark->is_end)&&(CurrentSelect == NULL)) + { + CurrentSelect = (SelectInfo *)malloc( + sizeof(SelectInfo)); + CurrentSelect->hw = (Widget)hw; + CurrentSelect->mptr = mptr; + CurrentSelect->option_cnt = 0; + CurrentSelect->returns = NULL; + CurrentSelect->retval_buf = NULL; + CurrentSelect->options = NULL; + CurrentSelect->option_buf = NULL; + CurrentSelect->value_cnt = 0; + CurrentSelect->value = NULL; + CurrentSelect->is_value = -1; + Ignore = 1; + } + } + break; + /* + * TEXTAREA is a replacement for INPUT type=text size=rows,cols + * because SGML will not allow an arbitrary length value + * field. + */ + case M_TEXTAREA: + if (CurrentForm != NULL) + { + if ((mark->is_end)&&(TextAreaBuf != NULL)) + { + char *start; + char *buf; + + /* + * Finish a fake INPUT tag. + */ + buf = (char *)malloc( + strlen(TextAreaBuf) + 2); + strcpy(buf, TextAreaBuf); + strcat(buf, "\""); + + /* + * stick the fake in, saving the + * real one. + */ + start = mark->start; + mark->start = buf; + mark->is_end = 0; + WidgetPlace(hw, mark, x, y, Width); + + /* + * free the fake, put the original back + */ + free(buf); + free(TextAreaBuf); + mark->start = start; + mark->is_end = 1; + TextAreaBuf = NULL; + Ignore = 0; + } + else if ((!mark->is_end)&&(TextAreaBuf == NULL)) + { + char *buf; + int len; + + /* + * Construct the start of + * a fake INPUT tag. + */ + len = strlen(MT_INPUT) + + strlen( + " type=textarea value=\"\""); + buf = (char *)malloc(len + + strlen(mark->start) + + 1); + strcpy(buf, MT_INPUT); + strcat(buf, (char *) + (mark->start + + strlen(MT_TEXTAREA))); + strcat(buf, " type=textarea"); + strcat(buf, " value=\""); + + TextAreaBuf = buf; + Ignore = 1; + } + } + break; + /* + * Just insert the widget. + * Can only inside a FORM tag. + * Special case the type=image stuff to become a special + * IMG tag. + */ + case M_INPUT: + if (CurrentForm != NULL) + { + char *tptr; + char *tptr2; + + tptr = ParseMarkTag(mptr->start, + MT_INPUT, "TYPE"); + if ((tptr != NULL)&& + (strcmp(tptr, "image") == 0)) + { + free(tptr); + tptr = (char *)malloc( + strlen(mptr->start) + + strlen(" ISMAP") + + strlen(MT_IMAGE) - + strlen(MT_INPUT) + 1); + strcpy(tptr, MT_IMAGE); + strcat(tptr, (char *) + (mptr->start + strlen(MT_INPUT)) + ); + strcat(tptr, " ISMAP"); + tptr2 = mptr->start; + mptr->start = tptr; + ImagePlace(hw, mptr, x, y, Width); + mptr->start = tptr2; + free(tptr); + } + /* + * hidden inputs have no element associated + * with them, just a widget record. + */ + else if ((tptr != NULL)&& + (strcmp(tptr, "hidden") == 0)) + { + free(tptr); + WidgetId++; + (void)MakeWidget(hw, mptr->start, x, y, + WidgetId, CurrentForm); + } + else + { + if (tptr != NULL) + { + free(tptr); + } + WidgetPlace(hw, mptr, x, y, Width); + } + } + break; + /* + * Fillout forms. Cannot be nested. + */ + case M_FORM: + ConditionalLineFeed(hw, x, y, 1); + if ((mark->is_end)&&(CurrentForm != NULL)) + { + CurrentForm->end = WidgetId; + ConditionalLineFeed(hw, x, y, 2); + AddNewForm(hw, CurrentForm); + CurrentForm = NULL; + } + else if ((!mark->is_end)&&(CurrentForm == NULL)) + { + ConditionalLineFeed(hw, x, y, 2); + CurrentForm = (FormInfo *)malloc( + sizeof(FormInfo)); + CurrentForm->next = NULL; + CurrentForm->hw = (Widget)hw; + CurrentForm->action = ParseMarkTag(mark->start, + MT_FORM, "ACTION"); + CurrentForm->method = ParseMarkTag(mark->start, + MT_FORM, "METHOD"); + CurrentForm->enctype = ParseMarkTag(mark->start, + MT_FORM, "ENCTYPE"); + CurrentForm->enc_entity = ParseMarkTag( + mark->start, MT_FORM, "ENCENTITY"); + CurrentForm->start = WidgetId; + CurrentForm->end = -1; + } + break; + /* + * Addresses are just like headers. A linefeed before and + * after, and change the font. + */ + case M_ADDRESS: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + font = PopFont(); + } + else + { + PushFont(currentFont); + font = hw->html.address_font; + } + break; + /* + * Blockquotes increase the margin width. + * They cannot be nested. + */ + case M_BLOCKQUOTE: + ConditionalLineFeed(hw, x, y, 1); + if (mark->is_end) + { + MarginW = hw->html.margin_width; + /* + * Only unindent if we think we indented + * when we started the blockquote + */ + if (TextIndent <= (2 * MarginW)) + { + TextIndent = MarginW; + } + ConditionalLineFeed(hw, x, y, 2); + /* + * The linefeed should have set x to TextIndent + * but since it is conditional, it might not + * have, so check it here. + */ + if (*x > TextIndent) + { + *x = TextIndent; + } + } + else + { + MarginW = 2 * hw->html.margin_width; + /* + * Only indent if the current indent + * is less than what we want. + */ + if (TextIndent < MarginW) + { + TextIndent = MarginW; + } + ConditionalLineFeed(hw, x, y, 2); + /* + * The linefeed should have set x to TextIndent + * but since it is conditional, it might not + * have, so check it here. + */ + if (*x < TextIndent) + { + *x = TextIndent; + } + } + break; + /* + * Plain text. A single pre-formatted chunk of text + * in its own font. + */ + case M_PLAIN_TEXT: + if (mark->is_end) + { + Preformat = 0; + /* + * Properly convert the Linefeed state + * variable from preformat to formatted + * state. + */ + if (PF_LF_State == 2) + { + PF_LF_State = 1; + } + else + { + PF_LF_State = 0; + } + ConditionalLineFeed(hw, x, y, 1); + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + Preformat = 1; + PF_LF_State = 0; + PushFont(currentFont); + font = hw->html.plain_font; + } + break; + /* + * Listing text. A different pre-formatted chunk of text + * in its own font. + */ + case M_LISTING_TEXT: + if (mark->is_end) + { + Preformat = 0; + /* + * Properly convert the Linefeed state + * variable from preformat to formatted + * state. + */ + if (PF_LF_State == 2) + { + PF_LF_State = 1; + } + else + { + PF_LF_State = 0; + } + ConditionalLineFeed(hw, x, y, 1); + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + Preformat = 1; + PF_LF_State = 0; + PushFont(currentFont); + font = hw->html.listing_font; + } + break; + /* + * Plain text. The rest of the text is pre-formatted. + * There is not end for this mark. + */ + case M_PLAIN_FILE: + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + Preformat = 1; + PF_LF_State = 0; + PushFont(currentFont); + font = hw->html.plain_font; + break; + /* + * Numbered lists, Unnumbered lists, Menus. + * Currently also lump directory listings into this. + * Save state for each indent level. + * Change the value of the TxtIndent (can be nested) + * Linefeed at the end of the list. + */ + case M_NUM_LIST: + case M_UNUM_LIST: + case M_MENU: + case M_DIRECTORY: + ConditionalLineFeed(hw, x, y, 1); + width = hw->html.font->max_bounds.width; + /* + * If this is the outermost level of indentation, + * add another linefeed for more white space. + */ + if ((TextIndent <= MarginW)||((mark->is_end)&& + ((TextIndent - ((INDENT_SPACES + 1) * width)) <= + MarginW))) + { + ConditionalLineFeed(hw, x, y, 2); + } + if (mark->is_end) + { + TextIndent = TextIndent - + ((INDENT_SPACES + 1) * width); + if (TextIndent < MarginW) + { + TextIndent = MarginW; + } + IndentLevel--; + if (IndentLevel < 0) + { + IndentLevel = 0; + } + + /* + * restore the old state if there is one + */ + if (ListData->next != NULL) + { + DescRec *dptr; + + dptr = ListData; + ListData = ListData->next; + free((char *)dptr); + } + } + else + { + DescRec *dptr; + + dptr = (DescRec *)malloc(sizeof(DescRec)); + /* + * Save the old state, and start a new + */ + if (type == M_NUM_LIST) + { + dptr->type = D_OLIST; + dptr->count = 1; + } + else + { + dptr->type = D_ULIST; + dptr->count = 0; + } + dptr->next = ListData; + ListData = dptr; + + TextIndent = TextIndent + + ((INDENT_SPACES + 1) * width); + IndentLevel++; + } + *x = TextIndent; + break; + /* + * Place the bullet element at the beginning of this item. + */ + case M_LIST_ITEM: + if (!mark->is_end) + { + ConditionalLineFeed(hw, x, y, 1); + /* + * for ordered/numbered lists + * put numbers in place of bullets. + */ + if (ListData->type == D_OLIST) + { + ListNumberPlace(hw, x, y, + ListData->count); + ListData->count++; + } + else + { + BulletPlace(hw, x, y); + } + } + break; + /* + * Description lists + */ + case M_DESC_LIST: + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + width = hw->html.font->max_bounds.width; + if (mark->is_end) + { + if (DescType->type == D_TEXT) + { + TextIndent = TextIndent - + ((INDENT_SPACES + 1) * width); + if (TextIndent < MarginW) + { + TextIndent = MarginW; + } + } + /* + * restore the old state if there is one + */ + if (DescType->next != NULL) + { + DescRec *dptr; + + dptr = DescType; + DescType = DescType->next; + free((char *)dptr); + /* + * If the old state had forced an + * indent, outdent it now. + */ + if (DescType->type == D_TITLE) + { + TextIndent = TextIndent - + ((INDENT_SPACES + 1) * width); + if (TextIndent < MarginW) + { + TextIndent = MarginW; + } + } + } + } + else + { + DescRec *dptr; + char *tptr; + + dptr = (DescRec *)malloc(sizeof(DescRec)); + /* + * Check is this is a compact list + */ + tptr = ParseMarkTag(mark->start, + MT_DESC_LIST, "COMPACT"); + if (tptr != NULL) + { + free(tptr); + dptr->compact = 1; + } + else + { + dptr->compact = 0; + } + /* + * Description list stared after a title needs + * a forced indentation here + */ + if (DescType->type == D_TITLE) + { + TextIndent = TextIndent + + ((INDENT_SPACES + 1) * width); + } + /* + * Save the old state, and start a new + */ + dptr->type = D_TITLE; + dptr->next = DescType; + DescType = dptr; + } + *x = TextIndent; + break; + case M_DESC_TITLE: + ConditionalLineFeed(hw, x, y, 1); + width = hw->html.font->max_bounds.width; + /* + * Special hack. Don't indent again for + * multiple <dt>'s in a row. + */ + if (DescType->type == D_TEXT) + { + TextIndent = TextIndent - + ((INDENT_SPACES + 1) * width); + if (TextIndent < MarginW) + { + TextIndent = MarginW; + } + } + DescType->type = D_TITLE; + *x = TextIndent; + break; + case M_DESC_TEXT: + width = hw->html.font->max_bounds.width; + + /* + * For a compact list we want to stay on the same + * line if there is room and we are the first line + * after a title. + */ + if ((DescType->compact)&&(DescType->type == D_TITLE)&& + (*x < (TextIndent + (INDENT_SPACES * width)))) + { + NeedSpace = 0; + } + else + { + ConditionalLineFeed(hw, x, y, 1); + } + + /* + * Special hack. Don't indent again for + * multiple <dd>'s in a row. + */ + if (DescType->type == D_TITLE) + { + TextIndent = TextIndent + + ((INDENT_SPACES + 1) * width); + } + DescType->type = D_TEXT; + *x = TextIndent; + break; + case M_PREFORMAT: + if (mark->is_end) + { + Preformat = 0; + /* + * Properly convert the Linefeed state + * variable from preformat to formatted + * state. + */ + if (PF_LF_State == 2) + { + PF_LF_State = 1; + } + else + { + PF_LF_State = 0; + } + ConditionalLineFeed(hw, x, y, 1); + if (saveFont != NULL) + { + hw->html.font = saveFont; + saveFont = NULL; + } + font = PopFont(); + NewFont(font); + currentFont = font; + ConditionalLineFeed(hw, x, y, 2); + } + else + { + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + Preformat = 1; + PF_LF_State = 2; + if (saveFont == NULL) + { + saveFont = hw->html.font; + hw->html.font = hw->html.plain_font; + } + PushFont(currentFont); + font = hw->html.font; + } + break; + /* + * Now with forms, <INDEX> is the same as: + * <FORM> + * <HR> + * This is a searchable index. Enter search keywords: + * <INPUT NAME="isindex"> + * <HR> + * </FORM> + * Also, <INDEX> will take an ACTION tag to specify a + * different URL to submit the query to. + */ + case M_INDEX: + hw->html.is_index = True; + /* + * No index inside a form + */ + if (CurrentForm == NULL) + { + struct mark_up mark_tmp; + + /* + * Start the form + */ + ConditionalLineFeed(hw, x, y, 1); + ConditionalLineFeed(hw, x, y, 2); + CurrentForm = (FormInfo *)malloc( + sizeof(FormInfo)); + CurrentForm->next = NULL; + CurrentForm->hw = (Widget)hw; + CurrentForm->action = NULL; + CurrentForm->action = ParseMarkTag(mark->start, + MT_INDEX, "ACTION"); + CurrentForm->method = ParseMarkTag(mark->start, + MT_INDEX, "METHOD"); + CurrentForm->enctype = ParseMarkTag(mark->start, + MT_INDEX, "ENCTYPE"); + CurrentForm->enc_entity = ParseMarkTag( + mark->start, MT_INDEX, "ENCENTITY"); + CurrentForm->start = WidgetId; + CurrentForm->end = -1; + + /* + * Horizontal rule + */ + ConditionalLineFeed(hw, x, y, 1); + HRulePlace(hw, x, y, Width); + ConditionalLineFeed(hw, x, y, 1); + + /* + * Text: "This is a searchable index. + * Enter search keywords: " + */ + mark_tmp.text = (char *)malloc( + strlen("This is a searchable index. Enter search keywords: ") + 1); + strcpy(mark_tmp.text,"This is a searchable index. Enter search keywords: "); + FormatPlace(hw, &mark_tmp, x, y, Width); + + /* + * Fake up the text INPUT tag. + */ + mark_tmp.start = (char *)malloc( + strlen("input SIZE=25 NAME=\"isindex\"") + 1); + strcpy(mark_tmp.start,"input SIZE=25 NAME=\"isindex\""); + WidgetPlace(hw, &mark_tmp, x, y, Width); + +#ifdef ISINDEX_SUBMIT + /* + * Text: ";<CR> press this button to submit + * the query: " + */ + mark_tmp.text = (char *)malloc( + strlen(";\n press this button to submit the query: ") + 1); + strcpy(mark_tmp.text,";\n press this button to submit the query: "); + FormatPlace(hw, &mark_tmp, x, y, Width); + + /* + * Fake up the submit INPUT tag. + */ + mark_tmp.start = (char *)malloc( + strlen("input TYPE=\"submit\"") + 1); + strcpy(mark_tmp.start, "input TYPE=\"submit\""); + WidgetPlace(hw, &mark_tmp, x, y, Width); + + /* + * Text: ".<CR>" + */ + mark_tmp.text = (char *)malloc( + strlen(".\n") + 1); + strcpy(mark_tmp.text, ".\n"); + FormatPlace(hw, &mark_tmp, x, y, Width); +#endif /* ISINDEX_SUBMIT */ + + /* + * Horizontal rule + */ + ConditionalLineFeed(hw, x, y, 1); + HRulePlace(hw, x, y, Width); + ConditionalLineFeed(hw, x, y, 1); + + /* + * Close the form + */ + ConditionalLineFeed(hw, x, y, 1); + CurrentForm->end = WidgetId; + ConditionalLineFeed(hw, x, y, 2); + AddNewForm(hw, CurrentForm); + CurrentForm = NULL; + } + break; + case M_HRULE: + ConditionalLineFeed(hw, x, y, 1); + HRulePlace(hw, x, y, Width); + ConditionalLineFeed(hw, x, y, 1); + break; + case M_LINEBREAK: + LineFeed(hw, x, y); + break; + default: + break; + } + if ((font != NULL)&&(font != currentFont)) + { + NewFont(font); + currentFont = font; + } +} + + +/* + * Format all the objects in the passed Widget's + * parsed object list to fit the locally global Width. + * Passes in the x,y coords of where to start placing the + * formatted text. + * Returns the ending x,y in same variables. + * Title objects are ignored, and not formatted. + * + * The locally global variables are assumed to have been initialized + * before this function was called. + */ +void +FormatChunk(hw, x, y) + HTMLWidget hw; + int *x, *y; +{ + struct mark_up *mptr; + + /* + * Format all objects + */ + mptr = hw->html.html_objects; + Last = NULL; + while (mptr != NULL) + { + TriggerMarkChanges(hw, mptr, x, y); + /* + * Save last non-text mark + */ + if (mptr->type != M_NONE) + { + Last = mptr; + } + mptr = mptr->next; + } +} + + +/* + * Called by the widget to format all the objects in the + * parsed object list to fit its current window size. + * Returns the max_height of the entire document. + * Title objects are ignored, and not formatted. + */ +int +FormatAll(hw, Fwidth) + HTMLWidget hw; + int *Fwidth; +{ + int x, y; + int width; + struct mark_up *msave; +#ifdef TIMING +gettimeofday(&Tv, &Tz); +fprintf(stderr, "FormatAll enter (%d.%d)\n", Tv.tv_sec, Tv.tv_usec); +#endif + + width = *Fwidth; + MaxWidth = width; + + /* + * Clear the is_index flag + */ + hw->html.is_index = False; + + /* + * Initialize local variables, some from the widget + */ + MarginW = hw->html.margin_width; +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + Fg = hw->manager.foreground; +#else + Fg = hw->html.foreground; +#endif /* MOTIF */ + Bg = hw->core.background_pixel; + Underlines = 0; + DashedUnderlines = False; + Width = width; + TextIndent = MarginW; + ElementId = 0; + WidgetId = 0; + LineNumber = 1; + LineBottom = 0; + BaseLine = -100; + CharsInLine = 0; + IndentLevel = 0; + Ignore = 0; + Preformat = 0; + PF_LF_State = 0; + NeedSpace = 0; + Internal = False; + Strikeout = False; + AnchorText = NULL; + DescType = &BaseDesc; + ListData = &BaseDesc; + DescType->type = D_NONE; + DescType->count = 0; + DescType->compact = 0; + DescType->next = NULL; + CurrentForm = NULL; + CurrentSelect = NULL; + TextAreaBuf = NULL; + + /* + * Free the old title, if there is one. + */ + if (hw->html.title != NULL) + { + free(hw->html.title); + hw->html.title = NULL; + } + TitleText = NULL; + +#ifdef THROW_AWAY_OLD_LIST + /* + * Free up previously formatted elements + */ + FreeLineList(hw->html.formatted_elements); + hw->html.formatted_elements = NULL; +#endif + + /* + * Clear any previous selections + */ + hw->html.select_start = NULL; + hw->html.select_end = NULL; + hw->html.new_start = NULL; + hw->html.new_end = NULL; + + /* + * Set up a starting font, and starting x, y, position + */ + NewFont(hw->html.font); + currentFont = hw->html.font; + saveFont = NULL; + FontStack = &FontBase; + FontStack->font = hw->html.font; + + x = TextIndent; + y = hw->html.margin_height; + + /* + * Start a null element list, to be filled in as we go. + */ + Current = NULL; + + /* + * If we have parsed special header text, fill it in now. + */ + if (hw->html.html_header_objects != NULL) + { + msave = hw->html.html_objects; + hw->html.html_objects = hw->html.html_header_objects; + FormatChunk(hw, &x, &y); + + if (saveFont != NULL) + { + hw->html.font = saveFont; + saveFont = NULL; + } + NewFont(hw->html.font); + currentFont = hw->html.font; + + ConditionalLineFeed(hw, &x, &y, 1); + + hw->html.html_objects = msave; + } + + /* + * Format all objects for width + */ + FormatChunk(hw, &x, &y); + + /* + * If we have parsed special footer text, fill it in now. + */ + if (hw->html.html_footer_objects != NULL) + { + if (saveFont != NULL) + { + hw->html.font = saveFont; + saveFont = NULL; + } + NewFont(hw->html.font); + currentFont = hw->html.font; + + Preformat = 0; + PF_LF_State = 0; + NeedSpace = 0; + + ConditionalLineFeed(hw, &x, &y, 1); + + msave = hw->html.html_objects; + hw->html.html_objects = hw->html.html_footer_objects; + FormatChunk(hw, &x, &y); + + hw->html.html_objects = msave; + } + + /* + * Ensure a linefeed after the final element. + */ + ConditionalLineFeed(hw, &x, &y, 1); + + /* + * Restore the proper font from unterminated preformatted text + * sequences. + */ + if (saveFont != NULL) + { + hw->html.font = saveFont; + saveFont = NULL; + } + + /* + * Free any extra of the pre-allocated list. + * Terminate the element list. + */ + if ((Current != NULL)&&(Current->next != NULL)) + { + FreeLineList(Current->next); + Current->next = NULL; + } + else if ((Current == NULL)&&(hw->html.formatted_elements != NULL)) + { + FreeLineList(hw->html.formatted_elements); + hw->html.formatted_elements = NULL; + } + + /* + * Add the bottom margin to the max height. + */ + y = y + hw->html.margin_height; + + /* + * Make the line array indexed into the element list + * and store it into the widget + */ + hw->html.line_count = LineNumber; + if (hw->html.line_array != NULL) + { + free((char *)hw->html.line_array); + } + hw->html.line_array = MakeLineList(hw->html.formatted_elements, + LineNumber); + + /* + * If the passed in MaxWidth was wrong, correct it. + */ + if (MaxWidth != width) + { + *Fwidth = MaxWidth; + } + +#ifdef TIMING +gettimeofday(&Tv, &Tz); +fprintf(stderr, "FormatAll exit (%d.%d)\n", Tv.tv_sec, Tv.tv_usec); +#endif + return(y); +} + + +/* + * Redraw a linefeed. + * Basically a filled rectangle at the end of a line. + */ +void +LinefeedRefresh(hw, eptr) + HTMLWidget hw; + struct ele_rec *eptr; +{ + int x1, y1; + unsigned int width, height; + +#ifdef NO_EXTRA_FILLS + /* + * The actualt height of the rectangle to fill is strange, based + * an a differente between eptr->font->(ascent/descent) and + * eptr->font->max_bounds.(ascent/descent) which I don't quite + * understand. But it works. + * Deal with bad Lucidia descents. + */ + x1 = eptr->x; + if (x1 > (int)hw->core.width) + { + width = 0; + } + else + { + width = hw->core.width - x1; + } +#ifdef SHORT_LINEFEEDS + y1 = eptr->y + eptr->y_offset + eptr->font->max_bounds.ascent - + eptr->font->ascent; + height = eptr->font->ascent + eptr->font->descent; +#else + y1 = eptr->y + eptr->font->max_bounds.ascent - eptr->font->ascent; + height = eptr->line_height; +#endif /* SHORT_LINEFEEDS */ +#else + x1 = eptr->x; + if (x1 > (int)hw->core.width) + { + width = 0; + } + else + { + width = hw->core.width - x1; + } +#ifdef SHORT_LINEFEEDS + y1 = eptr->y + eptr->y_offset; + if (eptr->font->descent > eptr->font->max_bounds.descent) + { + height = eptr->font->max_bounds.ascent + + eptr->font->descent; + } + else + { + height = eptr->font->max_bounds.ascent + + eptr->font->max_bounds.descent; + } +#else + y1 = eptr->y; + height = eptr->line_height; +#endif /* SHORT_LINEFEEDS */ +#endif /* NO_EXTRA_FILLS */ + + x1 = x1 - hw->html.scroll_x; + y1 = y1 - hw->html.scroll_y; + + if (eptr->selected == True) + { + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg); + } + else + { + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->bg); + } + XFillRectangle(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + x1, y1, width, height); +} + + +/* + * Redraw part of a formatted text element, in the passed fg and bg + */ +void +PartialRefresh(hw, eptr, start_pos, end_pos, fg, bg) + HTMLWidget hw; + struct ele_rec *eptr; + int start_pos, end_pos; + unsigned long fg, bg; +{ + int ascent; + char *tdata; + int tlen; + int x, y, width; + int partial; + + XSetFont(XtDisplay(hw), hw->html.drawGC, eptr->font->fid); + ascent = eptr->font->max_bounds.ascent; + width = -1; + partial = 0; + + if (start_pos != 0) + { + int dir, nascent, descent; + XCharStruct all; + +#ifdef ASSUME_FIXED_WIDTH_PRE + if (eptr->font == hw->html.plain_font) + { + all.width = eptr->font->max_bounds.width * start_pos; + } + else + { + XTextExtents(eptr->font, (char *)eptr->edata, + start_pos, &dir, &nascent, &descent, &all); + } +#else + XTextExtents(eptr->font, (char *)eptr->edata, + start_pos, &dir, &nascent, &descent, &all); +#endif /* ASSUME_FIXED_WIDTH_PRE */ + x = eptr->x + all.width; + tdata = (char *)(eptr->edata + start_pos); + partial = 1; + } + else + { + x = eptr->x; + tdata = (char *)eptr->edata; + } + + if (end_pos != (eptr->edata_len - 2)) + { + tlen = end_pos - start_pos + 1; + partial = 1; + } + else + { + tlen = eptr->edata_len - start_pos - 1; + } + + y = eptr->y + eptr->y_offset; + + x = x - hw->html.scroll_x; + y = y - hw->html.scroll_y; + +#ifndef NO_EXTRA_FILLS + { + int dir, nascent, descent; + XCharStruct all; + int height; + + /* + * May be safe to used the cached full width of this + * string, and thus avoid a call to XTextExtents + */ + if ((!partial)&&(eptr->width != 0)) + { + all.width = eptr->width; + } + else + { +#ifdef ASSUME_FIXED_WIDTH_PRE + if (eptr->font == hw->html.plain_font) + { + all.width = eptr->font->max_bounds.width * tlen; + } + else + { + XTextExtents(eptr->font, (char *)tdata, + tlen, &dir, &nascent, &descent, &all); + } +#else + XTextExtents(eptr->font, (char *)tdata, + tlen, &dir, &nascent, &descent, &all); +#endif /* ASSUME_FIXED_WIDTH_PRE */ + } + + XSetForeground(XtDisplay(hw), hw->html.drawGC, bg); + + height = (eptr->font->max_bounds.ascent - eptr->font->ascent); + if (height > 0) + { + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + hw->html.drawGC, x, y, + (unsigned int)all.width, (unsigned int)height); + } + height = (eptr->font->max_bounds.descent - eptr->font->descent); + if (height > 0) + { + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + hw->html.drawGC, x, + (int)(y + eptr->font->max_bounds.ascent + + eptr->font->descent), + (unsigned int)all.width, (unsigned int)height); + } + width = all.width; + } +#endif /* NO_EXTRA_FILLS */ + + XSetForeground(XtDisplay(hw), hw->html.drawGC, fg); + XSetBackground(XtDisplay(hw), hw->html.drawGC, bg); + + XDrawImageString(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + x, y + ascent, + (char *)tdata, tlen); + + if (eptr->underline_number) + { + int i, ly; + + if (eptr->dashed_underline) + { + XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1, + LineDoubleDash, CapButt, JoinBevel); + } + else + { + XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1, + LineSolid, CapButt, JoinBevel); + } + + if (width == -1) + { + int dir, nascent, descent; + XCharStruct all; + +#ifdef ASSUME_FIXED_WIDTH_PRE + if (eptr->font == hw->html.plain_font) + { + all.width = eptr->font->max_bounds.width * tlen; + } + else + { + XTextExtents(eptr->font, (char *)tdata, + tlen, &dir, &nascent, &descent,&all); + } +#else + XTextExtents(eptr->font, (char *)tdata, + tlen, &dir, &nascent, &descent,&all); +#endif /* ASSUME_FIXED_WIDTH_PRE */ + width = all.width; + } + + ly = (int)(y + eptr->font->max_bounds.ascent + + eptr->font->descent - 1); + + for (i=0; i<eptr->underline_number; i++) + { + XDrawLine(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, ly, (int)(x + width), ly); + ly -= 2; + } + } + + if (eptr->strikeout == True) + { + int ly; + + XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1, + LineSolid, CapButt, JoinBevel); + + if (width == -1) + { + int dir, nascent, descent; + XCharStruct all; + +#ifdef ASSUME_FIXED_WIDTH_PRE + if (eptr->font == hw->html.plain_font) + { + all.width = eptr->font->max_bounds.width * tlen; + } + else + { + XTextExtents(eptr->font, (char *)tdata, + tlen, &dir, &nascent, &descent,&all); + } +#else + XTextExtents(eptr->font, (char *)tdata, + tlen, &dir, &nascent, &descent,&all); +#endif /* ASSUME_FIXED_WIDTH_PRE */ + width = all.width; + } + + ly = (int)(y + eptr->font->max_bounds.ascent + + eptr->font->descent - 1); + ly = ly - ((hw->html.font->max_bounds.ascent + + hw->html.font->descent) / 2); + + XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + x, ly, (int)(x + width), ly); + } +} + + +/* + * Redraw a formatted text element + */ +void +TextRefresh(hw, eptr, start_pos, end_pos) + HTMLWidget hw; + struct ele_rec *eptr; + int start_pos, end_pos; +{ + if (eptr->selected == False) + { + PartialRefresh(hw, eptr, start_pos, end_pos, + eptr->fg, eptr->bg); + } + else if ((start_pos >= eptr->start_pos)&&(end_pos <= eptr->end_pos)) + { + PartialRefresh(hw, eptr, start_pos, end_pos, + eptr->bg, eptr->fg); + } + else + { + if (start_pos < eptr->start_pos) + { + PartialRefresh(hw, eptr, start_pos, eptr->start_pos - 1, + eptr->fg, eptr->bg); + start_pos = eptr->start_pos; + } + if (end_pos > eptr->end_pos) + { + PartialRefresh(hw, eptr, eptr->end_pos + 1, end_pos, + eptr->fg, eptr->bg); + end_pos = eptr->end_pos; + } + PartialRefresh(hw, eptr, start_pos, end_pos, + eptr->bg, eptr->fg); + } +} + + +/* + * Redraw a formatted bullet element + */ +void +BulletRefresh(hw, eptr) + HTMLWidget hw; + struct ele_rec *eptr; +{ + int width, line_height; + int x1, y1; + +/* + width = eptr->font->max_bounds.width; +*/ + width = eptr->font->max_bounds.lbearing + + eptr->font->max_bounds.rbearing; + /* + * Deal with bad Lucidia descents. + */ + if (eptr->font->descent > eptr->font->max_bounds.descent) + { + line_height = eptr->font->max_bounds.ascent + + eptr->font->descent; + } + else + { + line_height = eptr->font->max_bounds.ascent + + eptr->font->max_bounds.descent; + } + x1 = eptr->x; + y1 = eptr->y + eptr->y_offset + (line_height / 2) - (width / 4); + x1 = x1 - hw->html.scroll_x; + y1 = y1 - hw->html.scroll_y; + XSetFont(XtDisplay(hw), hw->html.drawGC, eptr->font->fid); + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg); + XSetBackground(XtDisplay(hw), hw->html.drawGC, eptr->bg); + if (eptr->indent_level < 2) + { + XFillArc(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + (x1 - width), y1, + (width / 2), (width / 2), 0, 23040); + } + else if (eptr->indent_level == 2) + { + XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1, + LineSolid, CapButt, JoinBevel); + XDrawRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + (x1 - width), y1, + (width / 2), (width / 2)); + } + else if (eptr->indent_level > 2) + { + XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1, + LineSolid, CapButt, JoinBevel); + XDrawArc(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + (x1 - width), y1, + (width / 2), (width / 2), 0, 23040); + } +} + + +/* + * Redraw a formatted horizontal rule element + */ +void +HRuleRefresh(hw, eptr) + HTMLWidget hw; + struct ele_rec *eptr; +{ + int width, height; + int x1, y1; + + width = (int)hw->html.view_width - (int)(2 * hw->html.margin_width); + if (width < 0) + { + width = 0; + } + + x1 = eptr->x; + y1 = eptr->y; + x1 = x1 - hw->html.scroll_x; + y1 = y1 - hw->html.scroll_y; + height = eptr->line_height; + + /* blank out area */ + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->bg); + XFillRectangle(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, x1, y1, width, height); + y1 = y1 + (height / 2) - 1; + + XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1, + LineSolid, CapButt, JoinBevel); +#ifdef MOTIF + XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->manager.bottom_shadow_GC, + x1, y1, (int)(x1 + width), y1); + XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->manager.top_shadow_GC, + x1, y1 + 1, (int)(x1 + width), y1 + 1); +#else + /* changing the GC back and forth is not the most efficient way.... */ + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg); + XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + x1, y1, (int)(x1 + width), y1); + XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view), + hw->html.drawGC, + x1, y1 + 1, (int)(x1 + width), y1 + 1); +#endif +} + + +/* + * Redraw a formatted image element. + * The color of the image border reflects whether it is an active anchor + * or not. + * Actual Pixmap creation was put off until now to make sure we + * had a window. If it hasn't been already created, make the Pixmap + * now. + */ +void +ImageRefresh(hw, eptr) + HTMLWidget hw; + struct ele_rec *eptr; +{ + if (eptr->pic_data != NULL) + { + int x, y, extra; + + x = eptr->x; + y = eptr->y + eptr->y_offset; + + if ((hw->html.border_images == True)|| + ((eptr->anchorHRef != NULL)&& + (!eptr->pic_data->internal))) + { + extra = IMAGE_BORDER; + } + else + { + extra = 0; + } + + x = x - hw->html.scroll_x; + y = y - hw->html.scroll_y; + + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg); + XSetBackground(XtDisplay(hw), hw->html.drawGC, eptr->bg); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, y, + (eptr->pic_data->width + (2 * extra)), + extra); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, + (y + eptr->pic_data->height + extra), + (eptr->pic_data->width + (2 * extra)), + extra); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, y, + extra, + (eptr->pic_data->height + (2 * extra))); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + (x + eptr->pic_data->width + extra), + y, + extra, + (eptr->pic_data->height + (2 * extra))); + + if (eptr->pic_data->image == (Pixmap)NULL) + { + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->image = InfoToImage(hw, + eptr->pic_data); + } + else + { + if (eptr->pic_data->delayed) + { + if ((eptr->anchorHRef != NULL)&& + (!IsDelayedHRef(hw, eptr->anchorHRef))&& + (!IsIsMapForm(hw, eptr->anchorHRef))) + { + eptr->pic_data->image = DelayedImage( + hw, True); + } + else + { + eptr->pic_data->image = DelayedImage( + hw, False); + } + } + else + { + /* + * Could be that the user opened another + * window, and the Pixmap was freed, and + * then they overflowed the cache, + * and the XImage data was freed. + * If this image was ever successfully + * fetched, try again before giving up. + */ + if ((eptr->pic_data->fetched)&& + (hw->html.resolveDelayedImage != NULL)) + { + ImageInfo *pdata; + + pdata = eptr->pic_data; + eptr->pic_data = (*(resolveImageProc) + (hw->html.resolveDelayedImage))(hw, + eptr->edata); + if (eptr->pic_data != NULL) + { + eptr->pic_data->delayed = 0; + /* + * Mark images we have sucessfully + * loaded at least once + */ + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->fetched = 1; + } + /* + * Copy over state information from + * the last time we had this image + */ + eptr->pic_data->ismap = + pdata->ismap; + eptr->pic_data->fptr = + pdata->fptr; + eptr->pic_data->internal = + pdata->internal; + eptr->pic_data->text = + pdata->text; + } + else + { + eptr->pic_data = NoImageData(hw); + eptr->pic_data->delayed = 0; + eptr->pic_data->internal = 0; + } + } + else + { + eptr->pic_data->image = NoImage(hw); + } + } + } + } + + if (eptr->pic_data->image != (Pixmap)NULL) + { + XCopyArea(XtDisplay(hw->html.view), + eptr->pic_data->image, + XtWindow(hw->html.view), hw->html.drawGC, 0, 0, + eptr->pic_data->width, eptr->pic_data->height, + (x + extra), + (y + extra)); + + } + if ((eptr->pic_data->delayed)&&(eptr->anchorHRef != NULL)&& + (!IsDelayedHRef(hw, eptr->anchorHRef))&& + (!IsIsMapForm(hw, eptr->anchorHRef))) + { + XSetForeground(XtDisplay(hw), hw->html.drawGC, + eptr->fg); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, (y + AnchoredHeight(hw)), + (eptr->pic_data->width + (2 * extra)), + extra); + } + } +} + + +void +RefreshTextRange(hw, start, end) + HTMLWidget hw; + struct ele_rec *start; + struct ele_rec *end; +{ + struct ele_rec *eptr; + + eptr = start; + while ((eptr != NULL)&&(eptr != end)) + { + if (eptr->type == E_TEXT) + { + TextRefresh(hw, eptr, + 0, (eptr->edata_len - 2)); + } + eptr = eptr->next; + } + if (eptr != NULL) + { + if (eptr->type == E_TEXT) + { + TextRefresh(hw, eptr, + 0, (eptr->edata_len - 2)); + } + } +} + + +/* + * Refresh all elements on a single line into the widget's window + */ +void +PlaceLine(hw, line) + HTMLWidget hw; + int line; +{ + struct ele_rec *eptr; + + /* + * Item list for this line + */ + eptr = hw->html.line_array[line]; + + while ((eptr != NULL)&&(eptr->line_number == (line + 1))) + { + switch(eptr->type) + { + case E_TEXT: + TextRefresh(hw, eptr, + 0, (eptr->edata_len - 2)); + break; + case E_BULLET: + BulletRefresh(hw, eptr); + break; + case E_HRULE: + HRuleRefresh(hw, eptr); + break; + case E_LINEFEED: + LinefeedRefresh(hw, eptr); + break; + case E_IMAGE: + ImageRefresh(hw, eptr); + break; + case E_WIDGET: + WidgetRefresh(hw, eptr); + break; + } + eptr = eptr->next; + } +} + + +/* + * Locate the element (if any) that is at the passed location + * in the widget. If there is no corresponding element, return + * NULL. If an element is found return the position of the character + * you are at in the pos pointer passed. + */ +struct ele_rec * +LocateElement(hw, x, y, pos) + HTMLWidget hw; + int x, y; + int *pos; +{ + struct ele_rec *eptr; + struct ele_rec *rptr; + int i, start, end, line, guess; + int tx1, tx2, ty1, ty2; + + x = x + hw->html.scroll_x; + y = y + hw->html.scroll_y; + + /* + * Narrow the search down to a 2 line range + * before beginning to search element by element + */ + start = -1; + end = -1; + + /* + * Heuristic to speed up redraws by guessing at the starting line. + */ + guess = y / (hw->html.font->max_bounds.ascent + + hw->html.font->max_bounds.descent); + if (guess > (hw->html.line_count - 1)) + { + guess = hw->html.line_count - 1; + } + while (guess > 0) + { + if ((hw->html.line_array[guess] != NULL)&& + (hw->html.line_array[guess]->y <= y)) + { + break; + } + guess--; + } + if (guess < 0) + { + guess = 0; + } + + for (i=guess; i<hw->html.line_count; i++) + { + if (hw->html.line_array[i] == NULL) + { + continue; + } + else if (hw->html.line_array[i]->y <= y) + { + start = i; + continue; + } + else + { + end = i; + break; + } + } + + /* + * Search may have already failed, or it may be a one line + * range. + */ + if ((start == -1)&&(end == -1)) + { + return(NULL); + } + else if (start == -1) + { + start = end; + } + else if (end == -1) + { + end = start; + } + + /* + * Search element by element, for now we only search + * text elements, images, and linefeeds. + */ + eptr = hw->html.line_array[start]; + ty1 = eptr->y; + /* + * Deal with bad Lucidia descents. + */ + if (eptr->font->descent > eptr->font->max_bounds.descent) + { + ty2 = eptr->y + eptr->font->max_bounds.ascent + + eptr->font->descent; + } + else + { + ty2 = eptr->y + eptr->font->max_bounds.ascent + + eptr->font->max_bounds.descent; + } + line = eptr->line_number; + /* + * Searches on this line should extend to the top of the + * next line, if possible. Which might be far away if there + * is an image on this line. + */ + if (((line + 1) < hw->html.line_count)&& + (hw->html.line_array[line + 1] != NULL)) + { + ty2 = hw->html.line_array[line + 1]->y - 1; + } + /* + * Else we are at the last line, and need to find its height. + * The linefeed at the end should know the max height of the line. + */ + else + { + struct ele_rec *teptr; + + teptr = eptr; + while (teptr != NULL) + { + if (teptr->type == E_LINEFEED) + { + break; + } + teptr = teptr->next; + } + if (teptr != NULL) + { + ty2 = teptr->y + teptr->line_height - 1; + } + } + + rptr = NULL; + while ((eptr != NULL)&&(eptr->line_number <= (end + 1))) + { + if (eptr->line_number != line) + { + ty1 = ty2; + /* + * Deal with bad Lucidia descents. + */ + if(eptr->font->descent > eptr->font->max_bounds.descent) + { + ty2 = eptr->y + eptr->font->max_bounds.ascent + + eptr->font->descent; + } + else + { + ty2 = eptr->y + eptr->font->max_bounds.ascent + + eptr->font->max_bounds.descent; + } + line = eptr->line_number; + /* + * Searches on this line should extend to the top of + * the next line, if possible. Which might be far + * away if there is an image on this line. + */ + if (((line + 1) < hw->html.line_count)&& + (hw->html.line_array[line + 1] != NULL)) + { + ty2 = hw->html.line_array[line + 1]->y - 1; + } + /* + * Else we are at the last line, and need to find its + * height. The linefeed at the end should know the + * max height of the line. + */ + else + { + struct ele_rec *teptr; + + teptr = eptr; + while (teptr != NULL) + { + if (teptr->type == E_LINEFEED) + { + break; + } + teptr = teptr->next; + } + if (teptr != NULL) + { + ty2 = teptr->y + teptr->line_height - 1; + } + } + } + + if (eptr->type == E_TEXT) + { + int dir, ascent, descent; + XCharStruct all; + + tx1 = eptr->x; + XTextExtents(eptr->font, (char *)eptr->edata, + eptr->edata_len - 1, &dir, + &ascent, &descent, &all); + tx2 = eptr->x + all.width; + if ((x >= tx1)&&(x <= tx2)&&(y >= ty1)&&(y <= ty2)) + { + rptr = eptr; + break; + } + } + else if ((eptr->type == E_IMAGE)&&(eptr->pic_data != NULL)) + { + tx1 = eptr->x; + tx2 = eptr->x + eptr->pic_data->width; + if ((x >= tx1)&&(x <= tx2)&&(y >= ty1)&&(y <= ty2)) + { + rptr = eptr; + break; + } + } + else if (eptr->type == E_LINEFEED) + { + tx1 = eptr->x; + if ((x >= tx1)&&(y >= ty1)&&(y <= ty2)) + { + rptr = eptr; + break; + } + else if (eptr->next == NULL) + { + rptr = eptr; + break; + } + else if (eptr->next != NULL) + { + int tmpy; + + tmpy = eptr->next->y + eptr->next->line_height; + tx2 = eptr->next->x; + if ((x < tx2)&&(y >= ty2)&&(y <= tmpy)) + { + rptr = eptr; + break; + } + } + } + eptr = eptr->next; + } + + /* + * If we found an element, locate the exact character position within + * that element. + */ + if (rptr != NULL) + { + int dir, ascent, descent; + XCharStruct all; + int epos; + + /* + * Start assuming fixed width font. The real position should + * always be <= to this, but just in case, start at the end + * of the string if it is not. + */ + epos = ((x - rptr->x) / rptr->font->max_bounds.width) + 1; + if (epos >= rptr->edata_len - 1) + { + epos = rptr->edata_len - 2; + } + XTextExtents(rptr->font, (char *)rptr->edata, + (epos + 1), &dir, &ascent, &descent, &all); + if (x > (int)(rptr->x + all.width)) + { + epos = rptr->edata_len - 3; + } + else + { + epos--; + } + + while (epos >= 0) + { + XTextExtents(rptr->font, (char *)rptr->edata, + (epos + 1), &dir, &ascent, &descent, &all); + if ((int)(rptr->x + all.width) <= x) + { + break; + } + epos--; + } + epos++; + *pos = epos; + } + return(rptr); +} + + +/* + * Used by ParseTextToPrettyString to let it be sloppy about its + * string creation, and never overflow the buffer. + * It concatonates the passed string to the current string, managing + * both the current string length, and the total buffer length. + */ +void +strcpy_or_grow(str, slen, blen, add) + char **str; + int *slen; + int *blen; + char *add; +{ + int newlen; + int addlen; + char *buf; + + /* + * If necessary, initialize this string buffer + */ + if (*str == NULL) + { + *str = (char *)malloc(1024 * sizeof(char)); + if (*str == NULL) + { + return; + } + *blen = 1024; + strcpy(*str, ""); + *slen = 0; + } + + buf = *str; + if ((buf == NULL)||(add == NULL)) + { + return; + } + + addlen = strlen(add); + + newlen = *slen + addlen; + if (newlen >= *blen) + { + newlen = ((newlen / 1024) + 1) * 1024; + buf = (char *)malloc(newlen * sizeof(char)); + if (buf == NULL) + { + return; + } + bcopy(*str, buf, *blen); + free((char *)*str); + *str = buf; + *blen = newlen; + } + + bcopy(add, (char *)(buf + *slen), addlen + 1); + + *slen = *slen + addlen; +} + + +/* + * Parse all the formatted text elements from start to end + * into an ascii text string, and return it. + * space_width and lmargin tell us how many spaces + * to indent lines. + */ +char * +ParseTextToString(elist, startp, endp, start_pos, end_pos, space_width, lmargin) + struct ele_rec *elist; + struct ele_rec *startp; + struct ele_rec *endp; + int start_pos, end_pos; + int space_width; + int lmargin; +{ + int newline; + int epos; + char *text; + int t_slen, t_blen; + struct ele_rec *eptr; + struct ele_rec *start; + struct ele_rec *end; + + if (startp == NULL) + { + return(NULL); + } + + if (SwapElements(startp, endp, start_pos, end_pos)) + { + start = endp; + end = startp; + epos = start_pos; + start_pos = end_pos; + end_pos = epos; + } + else + { + start = startp; + end = endp; + } + + text = NULL; + newline = 0; + eptr = start; + while ((eptr != NULL)&&(eptr != end)) + { + /* + * Skip the special internal text + */ + if (eptr->internal == True) + { + eptr = eptr->next; + continue; + } + + if (eptr->type == E_TEXT) + { + int i, spaces; + char *tptr; + + if (eptr == start) + { + tptr = (char *)(eptr->edata + start_pos); + } + else + { + tptr = (char *)eptr->edata; + } + + if (newline) + { + spaces = (eptr->x - lmargin) / space_width; + if (spaces < 0) + { + spaces = 0; + } + for (i=0; i<spaces; i++) + { + strcpy_or_grow(&text, &t_slen, &t_blen, + " "); + } + } + strcpy_or_grow(&text, &t_slen, &t_blen, tptr); + newline = 0; + } + else if (eptr->type == E_LINEFEED) + { + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + newline = 1; + } + eptr = eptr->next; + } + if ((eptr != NULL)&&(eptr->internal == False)) + { + if (eptr->type == E_TEXT) + { + int i, spaces; + char *tptr; + char *tend, tchar; + + if (eptr == start) + { + tptr = (char *)(eptr->edata + start_pos); + } + else + { + tptr = (char *)eptr->edata; + } + + if (eptr == end) + { + tend = (char *)(eptr->edata + end_pos + 1); + tchar = *tend; + *tend = '\0'; + } + + if (newline) + { + spaces = (eptr->x - lmargin) / space_width; + if (spaces < 0) + { + spaces = 0; + } + for (i=0; i<spaces; i++) + { + strcpy_or_grow(&text, &t_slen, &t_blen, + " "); + } + } + strcpy_or_grow(&text, &t_slen, &t_blen, tptr); + newline = 0; + + if (eptr == end) + { + *tend = tchar; + } + } + else if (eptr->type == E_LINEFEED) + { + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + newline = 1; + } + } + return(text); +} + + +/* + * Parse all the formatted text elements from start to end + * into an ascii text string, and return it. + * Very like ParseTextToString() except the text is prettied up + * to show headers and the like. + * space_width and lmargin tell us how many spaces + * to indent lines. + */ +char * +ParseTextToPrettyString(hw, elist, startp, endp, start_pos, end_pos, + space_width, lmargin) + HTMLWidget hw; + struct ele_rec *elist; + struct ele_rec *startp; + struct ele_rec *endp; + int start_pos, end_pos; + int space_width; + int lmargin; +{ + int line; + int newline; + int lead_spaces; + int epos; + char *text; + int t_slen, t_blen; + char *line_buf; + int l_slen, l_blen; + char lchar; + struct ele_rec *eptr; + struct ele_rec *start; + struct ele_rec *end; + struct ele_rec *last; + + if (startp == NULL) + { + return(NULL); + } + + if (SwapElements(startp, endp, start_pos, end_pos)) + { + start = endp; + end = startp; + epos = start_pos; + start_pos = end_pos; + end_pos = epos; + } + else + { + start = startp; + end = endp; + } + + text = NULL; + line_buf = NULL; + + /* + * We need to know if we should consider the indentation or bullet + * that might be just before the first selected element to also be + * selected. This current hack looks to see if they selected the + * Whole line, and assumes if they did, they also wanted the beginning. + * + * If we are at the beginning of the list, or the beginning of + * a line, or just behind a bullett, assume this is the start of + * a line that we may want to include the indent for. + */ + if ((start_pos == 0)&& + ((start->prev == NULL)||(start->prev->type == E_BULLET)|| + (start->prev->line_number != start->line_number))) + { + eptr = start; + while ((eptr != NULL)&&(eptr != end)&& + (eptr->type != E_LINEFEED)) + { + eptr = eptr->next; + } + if ((eptr != NULL)&&(eptr->type == E_LINEFEED)) + { + newline = 1; + if ((start->prev != NULL)&& + (start->prev->type == E_BULLET)) + { + start = start->prev; + } + } + else + { + newline = 0; + } + } + else + { + newline = 0; + } + + lead_spaces = 0; + last = start; + eptr = start; + line = eptr->line_number; + while ((eptr != NULL)&&(eptr != end)) + { + /* + * Skip the special internal text + */ + if (eptr->internal == True) + { + eptr = eptr->next; + continue; + } + + if (eptr->type == E_BULLET) + { + int i, spaces; + + if (newline) + { + spaces = (eptr->x - lmargin) / space_width; + spaces -= 2; + if (spaces < 0) + { + spaces = 0; + } + lead_spaces = spaces; + for (i=0; i<spaces; i++) + { + strcpy_or_grow(&line_buf, + &l_slen, &l_blen, " "); + } + } + newline = 0; + + strcpy_or_grow(&line_buf, &l_slen, &l_blen, "o "); + lead_spaces += 2; + } + else if (eptr->type == E_TEXT) + { + int i, spaces; + char *tptr; + + if (eptr == start) + { + tptr = (char *)(eptr->edata + start_pos); + } + else + { + tptr = (char *)eptr->edata; + } + + if (newline) + { + spaces = (eptr->x - lmargin) / space_width; + if (spaces < 0) + { + spaces = 0; + } + lead_spaces = spaces; + for (i=0; i<spaces; i++) + { + strcpy_or_grow(&line_buf, + &l_slen, &l_blen, " "); + } + } + strcpy_or_grow(&line_buf, &l_slen, &l_blen, tptr); + newline = 0; + } + else if (eptr->type == E_LINEFEED) + { + strcpy_or_grow(&text, &t_slen, &t_blen, line_buf); + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + newline = 1; + lchar = '\0'; + if (eptr->font == hw->html.header1_font) + { + lchar = '*'; + } + else if (eptr->font == hw->html.header2_font) + { + lchar = '='; + } + else if (eptr->font == hw->html.header3_font) + { + lchar = '+'; + } + else if (eptr->font == hw->html.header4_font) + { + lchar = '-'; + } + else if (eptr->font == hw->html.header5_font) + { + lchar = '~'; + } + else if (eptr->font == hw->html.header6_font) + { + lchar = '.'; + } + if (lchar != '\0') + { + char *ptr; + int cnt; + + cnt = 0; + ptr = line_buf; + while ((ptr != NULL)&&(*ptr != '\0')) + { + cnt++; + if (cnt > lead_spaces) + { + *ptr = lchar; + } + ptr++; + } + strcpy_or_grow(&text,&t_slen,&t_blen, line_buf); + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + } + if (line_buf != NULL) + { + free(line_buf); + line_buf = NULL; + } + } + last = eptr; + eptr = eptr->next; + } + if ((eptr != NULL)&&(eptr->internal == False)) + { + if (eptr->type == E_BULLET) + { + int i, spaces; + + if (newline) + { + spaces = (eptr->x - lmargin) / space_width; + spaces -= 2; + if (spaces < 0) + { + spaces = 0; + } + lead_spaces = spaces; + for (i=0; i<spaces; i++) + { + strcpy_or_grow(&line_buf, + &l_slen, &l_blen, " "); + } + } + newline = 0; + + strcpy_or_grow(&line_buf, &l_slen, &l_blen, "o "); + lead_spaces += 2; + } + else if (eptr->type == E_TEXT) + { + int i, spaces; + char *tptr; + char *tend, tchar; + + if (eptr == start) + { + tptr = (char *)(eptr->edata + start_pos); + } + else + { + tptr = (char *)eptr->edata; + } + + if (eptr == end) + { + tend = (char *)(eptr->edata + end_pos + 1); + tchar = *tend; + *tend = '\0'; + } + + if (newline) + { + spaces = (eptr->x - lmargin) / space_width; + if (spaces < 0) + { + spaces = 0; + } + lead_spaces = spaces; + for (i=0; i<spaces; i++) + { + strcpy_or_grow(&line_buf, + &l_slen, &l_blen, " "); + } + } + strcpy_or_grow(&line_buf, &l_slen, &l_blen, tptr); + newline = 0; + + if (eptr == end) + { + *tend = tchar; + } + } + else if (eptr->type == E_LINEFEED) + { + strcpy_or_grow(&text, &t_slen, &t_blen, line_buf); + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + newline = 1; + lchar = '\0'; + if (eptr->font == hw->html.header1_font) + { + lchar = '*'; + } + else if (eptr->font == hw->html.header2_font) + { + lchar = '='; + } + else if (eptr->font == hw->html.header3_font) + { + lchar = '+'; + } + else if (eptr->font == hw->html.header4_font) + { + lchar = '-'; + } + else if (eptr->font == hw->html.header5_font) + { + lchar = '~'; + } + else if (eptr->font == hw->html.header6_font) + { + lchar = '.'; + } + if (lchar != '\0') + { + char *ptr; + int cnt; + + cnt = 0; + ptr = line_buf; + while ((ptr != NULL)&&(*ptr != '\0')) + { + cnt++; + if (cnt > lead_spaces) + { + *ptr = lchar; + } + ptr++; + } + strcpy_or_grow(&text,&t_slen,&t_blen, line_buf); + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + } + if (line_buf != NULL) + { + free(line_buf); + line_buf = NULL; + } + } + last = eptr; + } + if (line_buf != NULL) + { + strcpy_or_grow(&text, &t_slen, &t_blen, line_buf); + lchar = '\0'; + if (last->font == hw->html.header1_font) + { + lchar = '*'; + } + else if (last->font == hw->html.header2_font) + { + lchar = '='; + } + else if (last->font == hw->html.header3_font) + { + lchar = '+'; + } + else if (last->font == hw->html.header4_font) + { + lchar = '-'; + } + else if (last->font == hw->html.header5_font) + { + lchar = '~'; + } + else if (last->font == hw->html.header6_font) + { + lchar = '.'; + } + if (lchar != '\0') + { + char *ptr; + int cnt; + + cnt = 0; + ptr = line_buf; + while ((ptr != NULL)&&(*ptr != '\0')) + { + cnt++; + if (cnt > lead_spaces) + { + *ptr = lchar; + } + ptr++; + } + strcpy_or_grow(&text, &t_slen, &t_blen, "\n"); + strcpy_or_grow(&text, &t_slen, &t_blen, line_buf); + } + } + if (line_buf != NULL) + { + free(line_buf); + line_buf = NULL; + } + return(text); +} + + +/* + * Find the preferred width of a parsed HTML document + * Currently unformatted plain text, unformatted listing text, plain files + * and preformatted text require special width. + * Preferred width = (width of longest plain text line in document) * + * (width of that text's font) + */ +int +DocumentWidth(hw, list) + HTMLWidget hw; + struct mark_up *list; +{ + struct mark_up *mptr; + int plain_text; + int listing_text; + int pcnt, lcnt, pwidth, lwidth; + int width; + char *ptr; + + /* + * Loop through object list looking at the plain, preformatted, + * and listing text + */ + width = 0; + pwidth = 0; + lwidth = 0; + plain_text = 0; + listing_text = 0; + mptr = list; + while (mptr != NULL) + { + /* + * All text blocks between the starting and ending + * plain and pre text markers are plain text blocks. + * Manipulate flags so we recognize these blocks. + */ + if ((mptr->type == M_PLAIN_TEXT)|| + (mptr->type == M_PLAIN_FILE)|| + (mptr->type == M_PREFORMAT)) + { + if (mptr->is_end) + { + plain_text--; + if (plain_text < 0) + { + plain_text = 0; + } + } + else + { + plain_text++; + } + pcnt = 0; + lcnt = 0; + } + /* + * All text blocks between the starting and ending + * listing markers are listing text blocks. + */ + else if (mptr->type == M_LISTING_TEXT) + { + if (mptr->is_end) + { + listing_text--; + if (listing_text < 0) + { + listing_text = 0; + } + } + else + { + listing_text++; + } + lcnt = 0; + pcnt = 0; + } + /* + * If this is a plain text block, add to line length. + * Find the Max of all line lengths. + */ + else if ((plain_text)&&(mptr->type == M_NONE)) + { + ptr = mptr->text; + while ((ptr != NULL)&&(*ptr != '\0')) + { + ptr = MaxTextWidth(ptr, &pcnt); + if (pcnt > pwidth) + { + pwidth = pcnt; + } + } + } + /* + * If this is a listing text block, add to line length. + * Find the Max of all line lengths. + */ + else if ((listing_text)&&(mptr->type == M_NONE)) + { + ptr = mptr->text; + while ((ptr != NULL)&&(*ptr != '\0')) + { + ptr = MaxTextWidth(ptr, &lcnt); + if (lcnt > lwidth) + { + lwidth = lcnt; + } + } + } + mptr = mptr->next; + } + width = pwidth * hw->html.plain_font->max_bounds.width; + lwidth = lwidth * hw->html.listing_font->max_bounds.width; + if (lwidth > width) + { + width = lwidth; + } + return(width); +} + diff --git a/vendor/x11iraf/obm/ObmW/HTMLimages.c b/vendor/x11iraf/obm/ObmW/HTMLimages.c new file mode 100644 index 00000000..fe33a6ee --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLimages.c @@ -0,0 +1,891 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include "HTMLP.h" +#include "bitmaps/NoImage.xbm" +#include "bitmaps/DelayedImage.xbm" +#include "bitmaps/AnchoredImage.xbm" + + +#define IMAGE_BORDER 2 + + +ImageInfo no_image; +ImageInfo delayed_image; +ImageInfo anchored_image; + +static int allocation_index[256]; + + +/* + * Free all the colors in the default colormap that we have allocated so far. + */ +void +FreeColors(dsp, colormap) + Display *dsp; + Colormap colormap; +{ + int i, j; + unsigned long pix; + + for (i=0; i<256; i++) + { + if (allocation_index[i]) + { + pix = (unsigned long)i; + /* + * Because X is stupid, we have to Free the color + * once for each time we've allocated it. + */ + for (j=0; j<allocation_index[i]; j++) + { + XFreeColors(dsp, colormap, &pix, 1, 0L); + } + } + allocation_index[i] = 0; + } +} + + +/* + * Free up all the pixmaps allocated for this document. + */ +void +FreeImages(hw) + HTMLWidget hw; +{ + struct ele_rec *eptr; + + eptr = hw->html.formatted_elements; + while (eptr != NULL) + { + if ((eptr->type == E_IMAGE)&&(eptr->pic_data != NULL)) + { + /* + * Don't free the no_image default image + */ + if ((eptr->pic_data->image != (Pixmap)NULL)&& + (eptr->pic_data->image != delayed_image.image)&& + (eptr->pic_data->image != anchored_image.image)&& + (eptr->pic_data->image != no_image.image)) + { + /* + * Don't free internal images + */ + if ((eptr->edata != NULL)&& + (strncmp(eptr->edata, INTERNAL_IMAGE, + strlen(INTERNAL_IMAGE)) == 0)) + { + } + else + { + XFreePixmap(XtDisplay(hw), + eptr->pic_data->image); + eptr->pic_data->image = (Pixmap)NULL; + } + } + } + eptr = eptr->next; + } +} + + +/* + * Find the closest color by allocating it, or picking an already allocated + * color + */ +void +FindColor(dsp, colormap, colr) + Display *dsp; + Colormap colormap; + XColor *colr; +{ + int i, match; +#ifdef MORE_ACCURATE + double rd, gd, bd, dist, mindist; +#else + int rd, gd, bd, dist, mindist; +#endif /* MORE_ACCURATE */ + int cindx; +static XColor def_colrs[256]; +static int have_colors = 0; + int NumCells; + + match = XAllocColor(dsp, colormap, colr); + if (match == 0) + { + NumCells = DisplayCells(dsp, DefaultScreen(dsp)); + if (!have_colors) + { + for (i=0; i<NumCells; i++) + { + def_colrs[i].pixel = i; + } + XQueryColors(dsp, colormap, def_colrs, NumCells); + have_colors = 1; + } +#ifdef MORE_ACCURATE + mindist = 196608.0; /* 256.0 * 256.0 * 3.0 */ + cindx = colr->pixel; + for (i=0; i<NumCells; i++) + { + rd = (def_colrs[i].red - colr->red) / 256.0; + gd = (def_colrs[i].green - colr->green) / 256.0; + bd = (def_colrs[i].blue - colr->blue) / 256.0; + dist = (rd * rd) + + (gd * gd) + + (bd * bd); + if (dist < mindist) + { + mindist = dist; + cindx = def_colrs[i].pixel; + if (dist == 0.0) + { + break; + } + } + } +#else + mindist = 196608; /* 256 * 256 * 3 */ + cindx = colr->pixel; + for (i=0; i<NumCells; i++) + { + rd = ((int)(def_colrs[i].red >> 8) - + (int)(colr->red >> 8)); + gd = ((int)(def_colrs[i].green >> 8) - + (int)(colr->green >> 8)); + bd = ((int)(def_colrs[i].blue >> 8) - + (int)(colr->blue >> 8)); + dist = (rd * rd) + + (gd * gd) + + (bd * bd); + if (dist < mindist) + { + mindist = dist; + cindx = def_colrs[i].pixel; + if (dist == 0) + { + break; + } + } + } +#endif /* MORE_ACCURATE */ + colr->pixel = cindx; + colr->red = def_colrs[cindx].red; + colr->green = def_colrs[cindx].green; + colr->blue = def_colrs[cindx].blue; + } + else + { + /* + * Keep a count of how many times we have allocated the + * same color, so we can properly free them later. + */ + allocation_index[colr->pixel]++; + + /* + * If this is a new color, we've actually changed the default + * colormap, and may have to re-query it later. + */ + if (allocation_index[colr->pixel] == 1) + { + have_colors = 0; + } + } +} + + +static int +highbit(ul) +unsigned long ul; +{ + /* + * returns position of highest set bit in 'ul' as an integer (0-31), + * or -1 if none. + */ + + int i; + for (i=31; ((ul&0x80000000) == 0) && i>=0; i--, ul<<=1); + return i; +} + + +/* + * Make am image of appropriate depth for display from image data. + */ +XImage * +MakeImage(dsp, data, width, height, depth, img_info) + Display *dsp; + unsigned char *data; + int width, height; + int depth; + ImageInfo *img_info; +{ + int linepad, shiftnum; + int shiftstart, shiftstop, shiftinc; + int bytesperline; + int temp; + int w, h; + XImage *newimage; + unsigned char *bit_data, *bitp, *datap; + Visual *theVisual; + int bmap_order; + unsigned long c; + int rshift, gshift, bshift; + + switch(depth) + { + case 6: + case 8: + bit_data = (unsigned char *)malloc(width * height); + bcopy(data, bit_data, (width * height)); + bytesperline = width; + newimage = XCreateImage(dsp, + DefaultVisual(dsp, DefaultScreen(dsp)), + depth, ZPixmap, 0, (char *)bit_data, + width, height, 8, bytesperline); + break; + case 1: + case 2: + case 4: + if (BitmapBitOrder(dsp) == LSBFirst) + { + shiftstart = 0; + shiftstop = 8; + shiftinc = depth; + } + else + { + shiftstart = 8 - depth; + shiftstop = -depth; + shiftinc = -depth; + } + linepad = 8 - (width % 8); + bit_data = (unsigned char *)malloc(((width + linepad) * height) + + 1); + bitp = bit_data; + datap = data; + *bitp = 0; + shiftnum = shiftstart; + for (h=0; h<height; h++) + { + for (w=0; w<width; w++) + { + temp = *datap++ << shiftnum; + *bitp = *bitp | temp; + shiftnum = shiftnum + shiftinc; + if (shiftnum == shiftstop) + { + shiftnum = shiftstart; + bitp++; + *bitp = 0; + } + } + for (w=0; w<linepad; w++) + { + shiftnum = shiftnum + shiftinc; + if (shiftnum == shiftstop) + { + shiftnum = shiftstart; + bitp++; + *bitp = 0; + } + } + } + bytesperline = (width + linepad) * depth / 8; + newimage = XCreateImage(dsp, + DefaultVisual(dsp, DefaultScreen(dsp)), + depth, ZPixmap, 0, (char *)bit_data, + (width + linepad), height, 8, bytesperline); + break; + /* + * WARNING: This depth 16 code is donated code for 16 but + * TrueColor displays. I have no access to such displays, so I + * can't really test it. + * Donated by - andrew@icarus.demon.co.uk + */ + case 16: + bit_data = (unsigned char *)malloc(width * height * 2); + bitp = bit_data; + datap = data; + for (w = (width * height); w > 0; w--) + { + temp = (((img_info->reds[(int)*datap] >> 1)& 0x7c00) | + ((img_info->greens[(int)*datap] >> 6)& 0x03e0) | + ((img_info->blues[(int)*datap] >> 11)& 0x001f)); + + if (BitmapBitOrder(dsp) == MSBFirst) + { + *bitp++ = (temp >> 8) & 0xff; + *bitp++ = temp & 0xff; + } + else + { + *bitp++ = temp & 0xff; + *bitp++ = (temp >> 8) & 0xff; + } + + datap++; + } + + newimage = XCreateImage(dsp, + DefaultVisual(dsp, DefaultScreen(dsp)), + depth, ZPixmap, 0, (char *)bit_data, + width, height, 16, 0); + break; + case 24: + bit_data = (unsigned char *)malloc(width * height * 4); + + theVisual = DefaultVisual(dsp, DefaultScreen(dsp)); + rshift = highbit(theVisual->red_mask) - 7; + gshift = highbit(theVisual->green_mask) - 7; + bshift = highbit(theVisual->blue_mask) - 7; + bmap_order = BitmapBitOrder(dsp); + + bitp = bit_data; + datap = data; + for (w = (width * height); w > 0; w--) + { + c = + (((img_info->reds[(int)*datap] >> 8) & 0xff) << rshift) | + (((img_info->greens[(int)*datap] >> 8) & 0xff) << gshift) | + (((img_info->blues[(int)*datap] >> 8) & 0xff) << bshift); + + datap++; + + if (bmap_order == MSBFirst) + { + *bitp++ = (unsigned char)((c >> 24) & 0xff); + *bitp++ = (unsigned char)((c >> 16) & 0xff); + *bitp++ = (unsigned char)((c >> 8) & 0xff); + *bitp++ = (unsigned char)(c & 0xff); + } + else + { + *bitp++ = (unsigned char)(c & 0xff); + *bitp++ = (unsigned char)((c >> 8) & 0xff); + *bitp++ = (unsigned char)((c >> 16) & 0xff); + *bitp++ = (unsigned char)((c >> 24) & 0xff); + } + } + + newimage = XCreateImage(dsp, + DefaultVisual(dsp, DefaultScreen(dsp)), + depth, ZPixmap, 0, (char *)bit_data, + width, height, 32, 0); + break; + default: + fprintf(stderr, "Don't know how to format image for display of depth %d\n", depth); + return(NULL); + } + + return(newimage); +} + + +int +AnchoredHeight(hw) + HTMLWidget hw; +{ + return((int)(AnchoredImage_height + IMAGE_BORDER)); +} + + +char * +IsMapForm(hw) + HTMLWidget hw; +{ + char *str; + + str = (char *)malloc(strlen("ISMAP Form") + 1); + if (str != NULL) + { + strcpy(str, "ISMAP Form"); + } + return(str); +} + + +int +IsIsMapForm(hw, href) + HTMLWidget hw; + char *href; +{ + if ((href != NULL)&&(strcmp(href, "ISMAP Form") == 0)) + { + return(1); + } + else + { + return(0); + } +} + + +char * +DelayedHRef(hw) + HTMLWidget hw; +{ + char *str; + + str = (char *)malloc(strlen("Delayed Image") + 1); + if (str != NULL) + { + strcpy(str, "Delayed Image"); + } + return(str); +} + + +int +IsDelayedHRef(hw, href) + HTMLWidget hw; + char *href; +{ + if ((href != NULL)&&(strcmp(href, "Delayed Image") == 0)) + { + return(1); + } + else + { + return(0); + } +} + + +Pixmap +DelayedImage(hw, anchored) + HTMLWidget hw; + Boolean anchored; +{ + if (delayed_image.image == (Pixmap)NULL) + { + delayed_image.image = XCreatePixmapFromBitmapData( + XtDisplay(hw->html.view), + XtWindow(hw->html.view), DelayedImage_bits, + DelayedImage_width, DelayedImage_height, +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + hw->manager.foreground, +#else + hw->html.foreground, +#endif /* MOTIF */ + hw->core.background_pixel, + DefaultDepthOfScreen(XtScreen(hw))); + } + + if ((anchored == True)&&(anchored_image.image == (Pixmap)NULL)) + { + Pixmap pix; + + anchored_image.image = XCreatePixmapFromBitmapData( + XtDisplay(hw->html.view), + XtWindow(hw->html.view), AnchoredImage_bits, + AnchoredImage_width, AnchoredImage_height, +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + hw->manager.foreground, +#else + hw->html.foreground, +#endif /* MOTIF */ + hw->core.background_pixel, + DefaultDepthOfScreen(XtScreen(hw))); + pix = XCreatePixmap( + XtDisplay(hw->html.view), + XtWindow(hw->html.view), + DelayedImage_width, + (DelayedImage_height + AnchoredImage_height + + IMAGE_BORDER), + DefaultDepthOfScreen(XtScreen(hw))); + XSetForeground(XtDisplay(hw), hw->html.drawGC, + hw->core.background_pixel); + XFillRectangle(XtDisplay(hw->html.view), pix, + hw->html.drawGC, 0, 0, + DelayedImage_width, + (DelayedImage_height + AnchoredImage_height + + IMAGE_BORDER)); + XCopyArea(XtDisplay(hw->html.view), + anchored_image.image, pix, hw->html.drawGC, + 0, 0, AnchoredImage_width, AnchoredImage_height, + 0, 0); + XCopyArea(XtDisplay(hw->html.view), + delayed_image.image, pix, hw->html.drawGC, + 0, 0, DelayedImage_width, DelayedImage_height, + 0, (AnchoredImage_height + IMAGE_BORDER)); + XFreePixmap(XtDisplay(hw->html.view), anchored_image.image); + anchored_image.image = pix; + + return(anchored_image.image); + } + + return(delayed_image.image); +} + + +ImageInfo * +DelayedImageData(hw, anchored) + HTMLWidget hw; + Boolean anchored; +{ + delayed_image.delayed = 1; + delayed_image.internal = 0; + delayed_image.fetched = 0; + delayed_image.width = DelayedImage_width; + delayed_image.height = DelayedImage_height; + delayed_image.num_colors = 0; + delayed_image.reds = NULL; + delayed_image.greens = NULL; + delayed_image.blues = NULL; + delayed_image.image_data = NULL; + delayed_image.image = (Pixmap)NULL; + + if (anchored == True) + { + anchored_image.delayed = 0; + anchored_image.internal = 0; + anchored_image.fetched = 0; + anchored_image.width = DelayedImage_width; + anchored_image.height = DelayedImage_height + + AnchoredImage_height + IMAGE_BORDER; + anchored_image.num_colors = 0; + anchored_image.reds = NULL; + anchored_image.greens = NULL; + anchored_image.blues = NULL; + anchored_image.image_data = NULL; + anchored_image.image = (Pixmap)NULL; + + return(&anchored_image); + } + + return(&delayed_image); +} + + +Pixmap +NoImage(hw) + HTMLWidget hw; +{ + if (no_image.image == (Pixmap)NULL) + { + no_image.image = XCreatePixmapFromBitmapData( + XtDisplay(hw->html.view), + XtWindow(hw->html.view), NoImage_bits, + NoImage_width, NoImage_height, +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ +#ifdef MOTIF + hw->manager.foreground, +#else + hw->html.foreground, +#endif /* MOTIF */ + hw->core.background_pixel, + DefaultDepthOfScreen(XtScreen(hw))); + } + return(no_image.image); +} + + +ImageInfo * +NoImageData(hw) + HTMLWidget hw; +{ + no_image.delayed = 0; + no_image.internal = 0; + no_image.fetched = 0; + no_image.width = NoImage_width; + no_image.height = NoImage_height; + no_image.num_colors = 0; + no_image.reds = NULL; + no_image.greens = NULL; + no_image.blues = NULL; + no_image.image_data = NULL; + no_image.image = (Pixmap)NULL; + + return(&no_image); +} + + +Pixmap +InfoToImage(hw, img_info) + HTMLWidget hw; + ImageInfo *img_info; +{ + int i, size; + int delta, not_right_col, not_last_row; + Pixmap Img; + XImage *tmpimage; + XColor tmpcolr; + int *Mapping; + unsigned char *tmpdata; + unsigned char *ptr; + unsigned char *ptr2; + int Vclass; + XVisualInfo vinfo, *vptr; + Boolean need_to_dither; + unsigned long black_pixel; + unsigned long white_pixel; + + /* find the visual class. */ + vinfo.visualid = XVisualIDFromVisual(DefaultVisual(XtDisplay(hw), + DefaultScreen(XtDisplay(hw)))); + vptr = XGetVisualInfo(XtDisplay(hw), VisualIDMask, &vinfo, &i); + Vclass = vptr->class; + if (vptr->depth == 1) + { + need_to_dither = True; + black_pixel = BlackPixel(XtDisplay(hw), + DefaultScreen(XtDisplay(hw))); + white_pixel = WhitePixel(XtDisplay(hw), + DefaultScreen(XtDisplay(hw))); + } + else + { + need_to_dither = False; + } + XFree((char *)vptr); + + Mapping = (int *)malloc(img_info->num_colors * sizeof(int)); + + for (i=0; i < img_info->num_colors; i++) + { + tmpcolr.red = img_info->reds[i]; + tmpcolr.green = img_info->greens[i]; + tmpcolr.blue = img_info->blues[i]; + tmpcolr.flags = DoRed|DoGreen|DoBlue; + if ((Vclass == TrueColor) || (Vclass == DirectColor)) + { + Mapping[i] = i; + } + else if (need_to_dither == True) + { + Mapping[i] = (int)((tmpcolr.red>>5)*11 + + (tmpcolr.green>>5)*16 + + (tmpcolr.blue>>5)*5) / (65504/64); + } + else + { + FindColor(XtDisplay(hw), + DefaultColormapOfScreen(XtScreen(hw)), + &tmpcolr); + Mapping[i] = tmpcolr.pixel; + } + } + + /* + * Special case: For 2 color non-black&white images, instead + * of 2 dither patterns, we will always drop them to be + * black on white. + */ + if ((need_to_dither == True)&&(img_info->num_colors == 2)) + { + if (Mapping[0] < Mapping[1]) + { + Mapping[0] = 0; + Mapping[1] = 64; + } + else + { + Mapping[0] = 64; + Mapping[1] = 0; + } + } + + size = img_info->width * img_info->height; + if (size == 0) + { + tmpdata = NULL; + } + else + { + tmpdata = (unsigned char *)malloc(size); + } + if (tmpdata == NULL) + { + tmpimage = NULL; + Img = (Pixmap)NULL; + } + else + { + ptr = img_info->image_data; + ptr2 = tmpdata; + + if (need_to_dither == True) + { + int cx, cy; + + for (ptr2 = tmpdata, ptr = img_info->image_data; + ptr2 < tmpdata+(size-1); ptr2++, ptr++) + { + *ptr2 = Mapping[(int)*ptr]; + } + + ptr2 = tmpdata; + for (cy=0; cy < img_info->height; cy++) + { + for (cx=0; cx < img_info->width; cx++) + { + /* + * Assume high numbers are + * really negative. + */ + if (*ptr2 > 128) + { + *ptr2 = 0; + } + if (*ptr2 > 64) + { + *ptr2 = 64; + } + + /* + * Traditional Floyd-Steinberg + */ + if (*ptr2 < 32) + { + delta = *ptr2; + *ptr2 = black_pixel; + } + else + { + delta = *ptr2 - 64; + *ptr2 = white_pixel; + } + if (not_right_col = + (cx < (img_info->width-1))) + { + *(ptr2+1) += delta*7 >> 4; + } + + if (not_last_row = + (cy < (img_info->height-1))) + { + (*(ptr2+img_info->width)) += + delta*5 >> 4; + } + + if (not_right_col && not_last_row) + { + (*(ptr2+img_info->width+1)) += + delta >> 4; + } + + if (cx && not_last_row) + { + (*(ptr2+img_info->width-1)) += + delta*3 >> 4; + } + ptr2++; + } + } + } /* end if (need_to_dither==True) */ + else + { + + for (i=0; i < size; i++) + { + *ptr2++ = (unsigned char)Mapping[(int)*ptr]; + ptr++; + } + } + + tmpimage = MakeImage(XtDisplay(hw), tmpdata, + img_info->width, img_info->height, + DefaultDepthOfScreen(XtScreen(hw)), img_info); + + /* Caught by Purify; should be OK. */ + free (tmpdata); + + Img = XCreatePixmap(XtDisplay(hw->html.view), + XtWindow(hw->html.view), + img_info->width, img_info->height, + DefaultDepthOfScreen(XtScreen(hw))); + } + + if ((tmpimage == NULL)||(Img == (Pixmap)NULL)) + { + if (tmpimage != NULL) + { + XDestroyImage(tmpimage); + } + if (Img != (Pixmap)NULL) + { + XFreePixmap(XtDisplay(hw), Img); + } + img_info->width = NoImage_width; + img_info->height = NoImage_height; + Img = NoImage(hw); + } + else + { + XPutImage(XtDisplay(hw), Img, hw->html.drawGC, tmpimage, 0, 0, + 0, 0, img_info->width, img_info->height); + XDestroyImage(tmpimage); + } + + /* Caught by Purify; should be OK. */ + free((char *)Mapping); + + return(Img); +} + diff --git a/vendor/x11iraf/obm/ObmW/HTMLjot.c b/vendor/x11iraf/obm/ObmW/HTMLjot.c new file mode 100644 index 00000000..75efb2b3 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLjot.c @@ -0,0 +1,642 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ +/* #ifdef MOTIF */ + +#include <stdio.h> +#include "inkstore.h" +#include "HTMLP.h" + +#include <sys/types.h> +#include <netinet/in.h> + +typedef struct stroke_rec { + Boolean draw; + int x, y; + struct stroke_rec *next; +} Stroke; + +typedef struct jot_rec { + Widget w; + int width, height; + Pixmap pix; + Boolean drawing; + int last_x, last_y; + int min_x, min_y; + int max_x, max_y; + int stroke_cnt; + Stroke *strokes; + Stroke *last_stroke; + struct jot_rec *next; +} JotInfo; + + +static JotInfo *JotList = NULL; +static JotInfo *JotCurrent = NULL; + + + +void +NewJot(w, width, height) + Widget w; + int width, height; +{ + if (JotCurrent == NULL) + { + JotList = (JotInfo *)malloc(sizeof(JotInfo)); + JotCurrent = JotList; + JotCurrent->w = w; + JotCurrent->width = width; + JotCurrent->height = height; + JotCurrent->pix = NULL; + JotCurrent->drawing = False; + JotCurrent->strokes = NULL; + JotCurrent->last_stroke = NULL; + JotCurrent->stroke_cnt = 0; + JotCurrent->min_x = width; + JotCurrent->max_x = 0; + JotCurrent->min_y = height; + JotCurrent->max_y = 0; + JotCurrent->next = NULL; + } + else + { + JotCurrent->next = (JotInfo *)malloc(sizeof(JotInfo)); + JotCurrent = JotCurrent->next; + JotCurrent->w = w; + JotCurrent->width = width; + JotCurrent->height = height; + JotCurrent->pix = NULL; + JotCurrent->drawing = False; + JotCurrent->strokes = NULL; + JotCurrent->last_stroke = NULL; + JotCurrent->stroke_cnt = 0; + JotCurrent->min_x = width; + JotCurrent->max_x = 0; + JotCurrent->min_y = height; + JotCurrent->max_y = 0; + JotCurrent->next = NULL; + } +} + + +JotInfo * +GetJot(w) + Widget w; +{ + JotInfo *jptr; + + jptr = JotList; + while (jptr != NULL) + { + if (jptr->w == w) + { + break; + } + jptr = jptr->next; + } + return(jptr); +} + + +void +FreeStrokes(sptr) + Stroke *sptr; +{ + Stroke *tptr; + + while (sptr != NULL) + { + tptr = sptr; + sptr = sptr->next; + tptr->next = NULL; + free((char *)tptr); + } +} + + +void +ClearJot(hw, w, width, height) + HTMLWidget hw; + Widget w; + int width, height; +{ + JotInfo *jptr; + + XClearArea(XtDisplay(w), XtWindow(w), + 0, 0, width, height, False); + + jptr = GetJot(w); + if (jptr == NULL) + { + return; + } + + if (jptr->pix != NULL) + { + XSetForeground(XtDisplay(w), hw->html.drawGC, + hw->core.background_pixel); + XFillRectangle(XtDisplay(w), jptr->pix, + hw->html.drawGC, + 0, 0, jptr->width, jptr->height); + } + + FreeStrokes(jptr->strokes); + jptr->strokes = NULL; + jptr->last_stroke = NULL; + jptr->stroke_cnt = 0; + jptr->drawing = False; + jptr->min_x = width; + jptr->max_x = 0; + jptr->min_y = height; + jptr->max_y = 0; +} + + +void +AddStroke(jptr, sptr, drawing) + JotInfo *jptr; + Stroke *sptr; + Boolean drawing; +{ + if (jptr->strokes == NULL) + { + jptr->strokes = sptr; + jptr->last_stroke = jptr->strokes; + jptr->last_stroke->next = NULL; + } + else + { + jptr->last_stroke->next = sptr; + jptr->last_stroke = jptr->last_stroke->next; + jptr->last_stroke->next = NULL; + } + jptr->last_x = sptr->x; + jptr->last_y = sptr->y; + jptr->drawing = drawing; + if (sptr->x < jptr->min_x) + { + jptr->min_x = sptr->x; + } + if (sptr->x > jptr->max_x) + { + jptr->max_x = sptr->x; + } + if (sptr->y < jptr->min_y) + { + jptr->min_y = sptr->y; + } + if (sptr->y > jptr->max_y) + { + jptr->max_y = sptr->y; + } + jptr->stroke_cnt++; +} + + +void +EVJotExpose(w, data, event) + Widget w; + XtPointer data; + XEvent *event; +{ + XExposeEvent *ExEvent = (XExposeEvent *)event; + HTMLWidget hw = (HTMLWidget)data; + JotInfo *jptr; + + jptr = GetJot(w); + if (jptr == NULL) + { + return; + } + + if (jptr->pix == NULL) + { + jptr->pix = XCreatePixmap(XtDisplay(w), XtWindow(w), + jptr->width, jptr->height, + XDefaultDepth(XtDisplay(w), XDefaultScreen(XtDisplay(w)))); + if (jptr->pix == NULL) + { + return; + } + XSetForeground(XtDisplay(w), hw->html.drawGC, + hw->core.background_pixel); + XFillRectangle(XtDisplay(w), jptr->pix, + hw->html.drawGC, + 0, 0, jptr->width, jptr->height); + } + + XCopyArea(XtDisplay(w), jptr->pix, XtWindow(w), + hw->html.drawGC, + ExEvent->x, ExEvent->y, + ExEvent->width, ExEvent->height, + ExEvent->x, ExEvent->y); +} + + +void +EVJotPress(w, data, event) + Widget w; + XtPointer data; + XEvent *event; +{ + XButtonPressedEvent *BuEvent = (XButtonPressedEvent *)event; + HTMLWidget hw = (HTMLWidget)data; + JotInfo *jptr; + Stroke *sptr; + + jptr = GetJot(w); + if (jptr == NULL) + { + return; + } + + sptr = (Stroke *)malloc(sizeof(Stroke)); + if (sptr == NULL) + { + return; + } + sptr->x = BuEvent->x; + sptr->y = BuEvent->y; + sptr->draw = False; + sptr->next = NULL; + +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ + XSetForeground(XtDisplay(w), hw->html.drawGC, +#ifdef MOTIF + hw->manager.foreground); +#else + hw->html.foreground); +#endif /* MOTIF */ + XDrawPoint(XtDisplay(w), XtWindow(w), + hw->html.drawGC, sptr->x, sptr->y); + if (jptr->pix != NULL) + { + XDrawPoint(XtDisplay(w), jptr->pix, + hw->html.drawGC, sptr->x, sptr->y); + } + + AddStroke(jptr, sptr, True); +} + + +void +EVJotMove(w, data, event) + Widget w; + XtPointer data; + XEvent *event; +{ + XPointerMovedEvent *MoEvent = (XPointerMovedEvent *)event; + HTMLWidget hw = (HTMLWidget)data; + JotInfo *jptr; + Stroke *sptr; + + jptr = GetJot(w); + if (jptr == NULL) + { + return; + } + + if (jptr->drawing == False) + { + return; + } + + sptr = (Stroke *)malloc(sizeof(Stroke)); + if (sptr == NULL) + { + return; + } + sptr->x = MoEvent->x; + sptr->y = MoEvent->y; + sptr->draw = True; + sptr->next = NULL; + +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ + XSetForeground(XtDisplay(w), hw->html.drawGC, +#ifdef MOTIF + hw->manager.foreground); +#else + hw->html.foreground); +#endif /* MOTIF */ + XDrawLine(XtDisplay(w), XtWindow(w), hw->html.drawGC, + jptr->last_x, jptr->last_y, sptr->x, sptr->y); + if (jptr->pix != NULL) + { + XDrawLine(XtDisplay(w), jptr->pix, hw->html.drawGC, + jptr->last_x, jptr->last_y, sptr->x, sptr->y); + } + + AddStroke(jptr, sptr, True); +} + + +void +EVJotRelease(w, data, event) + Widget w; + XtPointer data; + XEvent *event; +{ + XButtonReleasedEvent *BuEvent = (XButtonReleasedEvent *)event; + HTMLWidget hw = (HTMLWidget)data; + JotInfo *jptr; + Stroke *sptr; + + jptr = GetJot(w); + if (jptr == NULL) + { + return; + } + + if (jptr->drawing == False) + { + return; + } + + sptr = (Stroke *)malloc(sizeof(Stroke)); + if (sptr == NULL) + { + return; + } + sptr->x = BuEvent->x; + sptr->y = BuEvent->y; + sptr->draw = True; + sptr->next = NULL; + +/* + * Without motif we use our own foreground resource instead of + * using the manager's + */ + XSetForeground(XtDisplay(w), hw->html.drawGC, +#ifdef MOTIF + hw->manager.foreground); +#else + hw->html.foreground); +#endif /* MOTIF */ + XDrawLine(XtDisplay(w), XtWindow(w), hw->html.drawGC, + jptr->last_x, jptr->last_y, sptr->x, sptr->y); + if (jptr->pix != NULL) + { + XDrawLine(XtDisplay(w), jptr->pix, hw->html.drawGC, + jptr->last_x, jptr->last_y, sptr->x, sptr->y); + } + + AddStroke(jptr, sptr, True); +} + + +char * +EJB_JOTfromJot(w) + Widget w; +{ + int i, cnt; + int dlen, total; + u_long val; + unsigned char uchar; + JotInfo *jptr; + Stroke *sptr; + unsigned char *data; + unsigned char *dptr; + unsigned char *buffer; + unsigned char *bptr; + + jptr = GetJot(w); + if (jptr == NULL) + { + return(NULL); + } + + dlen = (2 * sizeof(u_long) + sizeof(char)) * jptr->stroke_cnt; + data = (unsigned char *)malloc(dlen); + + cnt = 0; + sptr = jptr->strokes; + dptr = data; + while ((sptr != NULL)&&(cnt < jptr->stroke_cnt)) + { + val = htonl((u_long)sptr->x); + bcopy((char *)&val, (char *)dptr, sizeof(u_long)); + dptr = dptr + sizeof(u_long); + + val = htonl((u_long)sptr->y); + bcopy((char *)&val, (char *)dptr, sizeof(u_long)); + dptr = dptr + sizeof(u_long); + + if (sptr->draw == False) + { + uchar = 0; + } + else + { + uchar = 1; + } + *dptr++ = uchar; + + cnt++; + sptr = sptr->next; + } + for (i=cnt; i<jptr->stroke_cnt; i++) + { + val = 0; + bcopy((char *)&val, (char *)dptr, sizeof(u_long)); + dptr = dptr + sizeof(u_long); + val = 0; + bcopy((char *)&val, (char *)dptr, sizeof(u_long)); + dptr = dptr + sizeof(u_long); + uchar = 0; + *dptr++ = uchar; + } +fprintf(stderr, "Packaging up %d points\n", jptr->stroke_cnt); + + cnt = 0; + dptr = data; + for (i=0; i<dlen; i++) + { + if ((*dptr == 0)||(*dptr == 1)) + { + cnt++; + } + dptr++; + } + + total = dlen + cnt + 1; + buffer = (unsigned char *)malloc(total); + bptr = buffer; + dptr = data; + for (i=0; i<dlen; i++) + { + if (*dptr == 0) + { + *bptr++ = (unsigned char)'o'; + *bptr++ = (unsigned char)'O'; + } + else if (*dptr == 'o') + { + *bptr++ = (unsigned char)'o'; + *bptr++ = (unsigned char)'o'; + } + else + { + *bptr++ = *dptr; + } + dptr++; + } + *bptr = (unsigned char)'\0'; + free((char *)data); + + return((char *)buffer); +} + + + +typedef struct my_INK_POINT { + XY32 position; + INK_BUTTONS buttons; +} MY_INK_POINT; + + +unsigned char * +JOTfromJot(w, buffer_len) + Widget w; + int *buffer_len; +{ + int i, cnt; + int dlen, total; + JotInfo *jptr; + Stroke *sptr; + MY_INK_POINT *dataArray; + INK_BUNDLE_RECORD *iptr; + INK_PENDATA_RECORD *pptr; + INK_END_RECORD *eptr; + unsigned char *buffer; + + jptr = GetJot(w); + if (jptr == NULL) + { + return(NULL); + } + + dlen = sizeof(MY_INK_POINT) * jptr->stroke_cnt; + + dataArray = (MY_INK_POINT *)malloc(dlen); + cnt = 0; + sptr = jptr->strokes; + while ((sptr != NULL)&&(cnt < jptr->stroke_cnt)); + { + dataArray[cnt].position.x = sptr->x; + dataArray[cnt].position.y = sptr->y; + dataArray[cnt].buttons = inkPointDefaultButtons; + dataArray[cnt].buttons |= flag0; + if ((sptr->next != NULL)&&(sptr->next->draw == False)) + { + } + else + { + dataArray[cnt].buttons |= flag1; + } + cnt++; + sptr = sptr->next; + } + for (i=cnt; i<jptr->stroke_cnt; i++) + { + dataArray[i].position.x = 0; + dataArray[i].position.y = 0; + dataArray[i].buttons = inkPointDefaultButtons; + } + + iptr = (INK_BUNDLE_RECORD *)malloc(inkRecordBundleSize); + iptr->header.recordType = inkRecordBundle; + iptr->header.recordLength = inkRecordBundleSize; + iptr->version = inkPointDefaultVersion; + iptr->compactionType = inkNoCompression; + iptr->flags = (inkPointDefaultBundleFlags | inkButtonDataPresent); + iptr->penUnitsPerX = inkPointDefaultPenUnitsPerX; + iptr->penUnitsPerY = inkPointDefaultPenUnitsPerY; + + pptr = (INK_PENDATA_RECORD *)malloc(inkRecordPenDataSize(dlen)); + pptr->header.recordType = inkRecordPenData; + pptr->header.recordLength = inkRecordPenDataSize(dlen); + pptr->bounds.origin.x = jptr->min_x; + pptr->bounds.origin.y = jptr->min_y; + pptr->bounds.size.w = jptr->max_x - jptr->min_x + 1; + pptr->bounds.size.h = jptr->max_y - jptr->min_y + 1; + bcopy((char *)dataArray, (char *)pptr->inkData, dlen); + free((char *)dataArray); +/* + pptr->inkData = dataArray; +*/ + + eptr = (INK_END_RECORD *)malloc(inkRecordEndSize); + eptr->header.recordType = inkRecordEnd; + + total = inkRecordBundleSize + inkRecordPenDataSize(dlen) + + inkRecordEndSize; + buffer = (unsigned char *)malloc(total); + bcopy((char *)iptr, buffer, inkRecordBundleSize); + bcopy((char *)pptr, (char *)(buffer + inkRecordBundleSize), + inkRecordPenDataSize(dlen)); + bcopy((char *)eptr, (char *)(buffer + inkRecordBundleSize + + inkRecordPenDataSize(dlen)), inkRecordEndSize); + free((char *)iptr); + free((char *)pptr); + free((char *)eptr); + *buffer_len = total; + return(buffer); +} +/* #endif /* MOTIF */ diff --git a/vendor/x11iraf/obm/ObmW/HTMLlists.c b/vendor/x11iraf/obm/ObmW/HTMLlists.c new file mode 100644 index 00000000..dfe3578d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLlists.c @@ -0,0 +1,897 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#include <stdio.h> +#include "HTML.h" + +/* + * Code to manage a linked list of parsed HTML objects generated + * from a raw text file. + * Also code to manage a linked list of formatted elements that + * make up a page of a formatted document. + */ + + +/* + * Free up the passed linked list of parsed elements, freeing + * all memory associates with each element. + */ +void +FreeObjList(List) + struct mark_up *List; +{ + struct mark_up *current; + struct mark_up *mptr; + + current = List; + while (current != NULL) + { + mptr = current; + current = current->next; + mptr->next = NULL; + if (mptr->start != NULL) + { + free((char *)mptr->start); + } + if (mptr->text != NULL) + { + free((char *)mptr->text); + } + if (mptr->end != NULL) + { + free((char *)mptr->end); + } + free((char *)mptr); + } +} + + +/* + * Add an object to the parsed object list. + * return a pointer to the current (end) position in the list. + * If the object is a normal text object containing nothing but + * white space, throw it out, unless we have been told to keep + * white space. + */ +struct mark_up * +AddObj(listp, current, mark, keep_wsp) + struct mark_up **listp; + struct mark_up *current; + struct mark_up *mark; + int keep_wsp; +{ + if (mark == NULL) + { + return(current); + } + + /* + * Throw out normal text blocks that are only white space, + * unless keep_wsp is set. + */ + if ((mark->type == M_NONE)&&(!keep_wsp)) + { + char *ptr; + + ptr = mark->text; + if (ptr == NULL) + { + free((char *)mark); + return(current); + } + +/* + * No longer throw out whitespace, it is important to keep + * white space between tags. + while ((*ptr == ' ')||(*ptr == '\t')||(*ptr == '\n')) + { + ptr++; + } + * + */ + + if (*ptr == '\0') + { + free(mark->text); + free((char *)mark); + return(current); + } + } + + /* + * Add object to either the head of the list for a new list, + * or at the end after the current pointer. + */ + if (*listp == NULL) + { + *listp = mark; + current = *listp; + } + else + { + current->next = mark; + current = current->next; + } + + current->next = NULL; + + return(current); +} + + +#ifdef DEBUG + +/* + * Convert type number to a printed string for debug + */ +void +PrintType(type) + int type; +{ + switch(type) + { + case M_NONE: + printf("M_NONE"); + break; + case M_TITLE: + printf("M_TITLE"); + break; + case M_FIXED: + printf("M_FIXED"); + break; + case M_BOLD: + printf("M_BOLD"); + break; + case M_ITALIC: + printf("M_ITALIC"); + break; + case M_EMPHASIZED: + printf("M_EMPHASIZED"); + break; + case M_STRONG: + printf("M_STRONG"); + break; + case M_CODE: + printf("M_CODE"); + break; + case M_SAMPLE: + printf("M_SAMPLE"); + break; + case M_KEYBOARD: + printf("M_KEYBOARD"); + break; + case M_VARIABLE: + printf("M_VARIABLE"); + break; + case M_CITATION: + printf("M_CITATION"); + break; + case M_STRIKEOUT: + printf("M_STRIKEOUT"); + break; + case M_HEADER_1: + printf("M_HEADER_1"); + break; + case M_HEADER_2: + printf("M_HEADER_2"); + break; + case M_HEADER_3: + printf("M_HEADER_3"); + break; + case M_HEADER_4: + printf("M_HEADER_4"); + break; + case M_HEADER_5: + printf("M_HEADER_5"); + break; + case M_HEADER_6: + printf("M_HEADER_6"); + break; + case M_ANCHOR: + printf("M_ANCHOR"); + break; + case M_PARAGRAPH: + printf("M_PARAGRAPH"); + break; + case M_ADDRESS: + printf("M_ADDRESS"); + break; + case M_PLAIN_TEXT: + printf("M_PLAIN_TEXT"); + break; + case M_LISTING_TEXT: + printf("M_LISTING_TEXT"); + break; + case M_UNUM_LIST: + printf("M_UNUM_LIST"); + break; + case M_NUM_LIST: + printf("M_NUM_LIST"); + break; + case M_MENU: + printf("M_MENU"); + break; + case M_DIRECTORY: + printf("M_DIRECTORY"); + break; + case M_LIST_ITEM: + printf("M_LIST_ITEM"); + break; + case M_DESC_LIST: + printf("M_DESC_LIST"); + break; + case M_DESC_TITLE: + printf("M_DESC_TITLE"); + break; + case M_DESC_TEXT: + printf("M_DESC_TEXT"); + break; + case M_IMAGE: + printf("M_IMAGE"); + break; + case M_SELECT: + printf("M_SELECT"); + break; + case M_OPTION: + printf("M_OPTION"); + break; + case M_INPUT: + printf("M_INPUT"); + break; + case M_TEXTAREA: + printf("M_TEXTAREA"); + break; + case M_FORM: + printf("M_FORM"); + break; + case M_INDEX: + printf("M_INDEX"); + break; + case M_HRULE: + printf("M_HRULE"); + break; + case M_BASE: + printf("M_BASE"); + break; + case M_LINEBREAK: + printf("M_LINEBREAK"); + break; + case M_BLOCKQUOTE: + printf("M_BLOCKQUOTE"); + break; + default: + printf("UNKNOWN %d", type); + break; + } +} + + +/* + * Print the contents of a parsed object list, for debug + */ +void +PrintList(list) + struct mark_up *list; +{ + struct mark_up *mptr; + + mptr = list; + while (mptr != NULL) + { + PrintType(mptr->type); + if (mptr->is_end) + { + printf(" END"); + } + else + { + printf(" START"); + } + if (mptr->text != NULL) + { + printf("\n{\n\t"); + printf("%s", mptr->text); + printf("}\n"); + } + else + { + printf("\n"); + } + mptr = mptr->next; + } +} + +#endif /* DEBUG */ + + +/* + * Used to find the longest line (in characters) in a collection + * of text blocks. cnt is the running count of characters, and + * txt is the pointer to the current text block. Since we are + * finding line widths, a newline resets the width count. + */ +char * +MaxTextWidth(txt, cnt) + char *txt; + int *cnt; +{ + char *start; + char *end; + int width; + + if (txt == NULL) + { + return(NULL); + } + + width = *cnt; + start = txt; + + /* + * If this blocks starts with a newline, reset the width + * count, and skip the newline. + */ + if (*start == '\n') + { + width = 0; + start++; + } + + end = start; + + /* + * count characters, stoping either at a newline, or at the + * end of this text block. Expand tabs. + */ + while ((*end != '\0')&&(*end != '\n')) + { + if (*end == '\t') + { + width = ((width / 8) + 1) * 8; + } + else + { + width++; + } + end++; + } + + *cnt = width; + return(end); +} + + +/* + * Free up the passed linked list of formatted elements, freeing + * all memory associates with each element. + */ +void +FreeLineList(list) + struct ele_rec *list; +{ + struct ele_rec *current; + struct ele_rec *eptr; + + current = list; + while (current != NULL) + { + eptr = current; + current = current->next; + eptr->next = NULL; + if (eptr->edata != NULL) + { + free((char *)eptr->edata); + } + if (eptr->anchorHRef != NULL) + { + free((char *)eptr->anchorHRef); + } + if (eptr->anchorName != NULL) + { + free((char *)eptr->anchorName); + } + free((char *)eptr); + } +} + + +/* + * Add an element to the linked list of formatted elements. + * return a pointer to the current (end) position in the list. + */ +struct ele_rec * +AddEle(elistp, current, eptr) + struct ele_rec **elistp; + struct ele_rec *current; + struct ele_rec *eptr; +{ + if (eptr == NULL) + { + return(current); + } + + /* + * Add object to either the head of the list for a new list, + * or at the end after the current pointer. + */ + if (*elistp == NULL) + { + *elistp = eptr; + (*elistp)->next = NULL; + (*elistp)->prev = NULL; + current = *elistp; + } + else + { + current->next = eptr; + eptr->prev = current; + current = current->next; + current->next = NULL; + } + return(current); +} + + +/* + * Contruct and return an array of pointers into the element list that + * indexes the elements by line number. + * Note, lines containing only while space will have NULL pointers + * into the element list. + */ +struct ele_rec ** +MakeLineList(elist, max_line) + struct ele_rec *elist; + int max_line; +{ + int i; + struct ele_rec *eptr; + struct ele_rec **ll; + + /* + * malloc index array + */ + ll = (struct ele_rec **)malloc(sizeof(struct ele_rec *) * max_line); + if (ll == NULL) + { + fprintf(stderr, "cannot allocate space for line list\n"); + exit(1); + } + + /* + * zero the index array + */ + for (i=0; i<max_line; i++) + { + ll[i] = NULL; + } + + /* + * fill in pointers to beginning of the lines + */ + eptr = elist; + while (eptr != NULL) + { + if (eptr->line_number > max_line) + { + break; + } + + if (ll[eptr->line_number - 1] == NULL) + { + ll[eptr->line_number - 1] = eptr; + } + + eptr = eptr->next; + } + return(ll); +} + + +/* + * Passed in 2 element pointers, and element positions. + * Function should return 1 if if start occurs before end. + * Otherwise return 0. + */ +int +ElementLessThan(start, end, start_pos, end_pos) + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; +{ + struct ele_rec *current; + + /* + * Deal with start or end being NULL + */ + if ((start == NULL)&&(end == NULL)) + { + return(0); + } + else if ((start == NULL)&&(end != NULL)) + { + return(1); + } + else if ((start != NULL)&&(end == NULL)) + { + return(0); + } + + /* + * Deal with easy identical case + */ + if (start == end) + { + if (start_pos < end_pos) + { + return(1); + } + else + { + return(0); + } + } + + /* + * We know element Ids are always equal or increasing within a + * list. + */ + if (start->ele_id < end->ele_id) + { + return(1); + } + else if (start->ele_id == end->ele_id) + { + current = start; + while (current != NULL) + { + if (current->ele_id != start->ele_id) + { + break; + } + else if (current == end) + { + break; + } + current = current->next; + } + if (current == end) + { + return(1); + } + else + { + return(0); + } + } + else + { + return(0); + } +} + + +/* + * Passed in 2 element pointers, and element positions. + * Function should return 1 if they need to be swapped in order for then + * to proceed left to right and top to bottom in the text. + * Otherwise return 0. + */ +int +SwapElements(start, end, start_pos, end_pos) + struct ele_rec *start; + struct ele_rec *end; + int start_pos, end_pos; +{ + struct ele_rec *current; + + /* + * Deal with start or end being NULL + */ + if ((start == NULL)&&(end == NULL)) + { + return(0); + } + else if ((start == NULL)&&(end != NULL)) + { + return(1); + } + else if ((start != NULL)&&(end == NULL)) + { + return(0); + } + + /* + * Deal with easy identical case + */ + if (start == end) + { + if (start_pos > end_pos) + { + return(1); + } + else + { + return(0); + } + } + + /* + * We know element Ids are always equal or increasing within a + * list. + */ + if (start->ele_id < end->ele_id) + { + return(0); + } + else if (start->ele_id == end->ele_id) + { + current = start; + while (current != NULL) + { + if (current->ele_id != start->ele_id) + { + break; + } + else if (current == end) + { + break; + } + current = current->next; + } + if (current == end) + { + return(0); + } + else + { + return(1); + } + } + else + { + return(1); + } +} + + +/* + * Free up the allocated list of internal hrefs. + */ +void +FreeHRefs(list) + struct ref_rec *list; +{ + struct ref_rec *hptr; + struct ref_rec *tptr; + + hptr = list; + while (hptr != NULL) + { + tptr = hptr; + hptr = hptr->next; + if (tptr->anchorHRef != NULL) + { + free((char *)tptr->anchorHRef); + } + free((char *)tptr); + } +} + + +/* + * Find an element in the linked list of Internal HREFS. + * return a pointer to the element, or NULL if not found. + */ +struct ref_rec * +FindHRef(list, href) + struct ref_rec *list; + char *href; +{ + struct ref_rec *hptr; + + if (href == NULL) + { + return(NULL); + } + + hptr = list; + while (hptr != NULL) + { + if (strcmp(hptr->anchorHRef, href) == 0) + { + break; + } + hptr = hptr->next; + } + return(hptr); +} + + +/* + * Add an element to the linked list of Internal HREFS we + * have visited before. + * return a pointer to the head of the new list. + */ +struct ref_rec * +AddHRef(list, href) + struct ref_rec *list; + char *href; +{ + struct ref_rec *hptr; + + if (href == NULL) + { + return(list); + } + + hptr = FindHRef(list, href); + + if (hptr == NULL) + { + hptr = (struct ref_rec *)malloc(sizeof(struct ref_rec)); + if (hptr == NULL) + { + fprintf(stderr, "cannot extend internal href list\n"); + return(list); + } + hptr->anchorHRef = (char *)malloc(strlen(href) + 1); + if (hptr->anchorHRef == NULL) + { + free((char *)hptr); + fprintf(stderr, "cannot extend internal href list\n"); + return(list); + } + strcpy(hptr->anchorHRef, href); + hptr->next = list; + list = hptr; + } + + return(list); +} + + +/* + * Free up the allocated list of visited delayed images + */ +void +FreeDelayedImages(list) + struct delay_rec *list; +{ + struct delay_rec *iptr; + struct delay_rec *tptr; + + iptr = list; + while (iptr != NULL) + { + tptr = iptr; + iptr = iptr->next; + if (tptr->src != NULL) + { + free((char *)tptr->src); + } + free((char *)tptr); + } +} + + +/* + * Find an element in the linked list of visited delayed images. + * return a pointer to the element, or NULL if not found. + */ +struct delay_rec * +FindDelayedImage(list, src) + struct delay_rec *list; + char *src; +{ + struct delay_rec *iptr; + + if (src == NULL) + { + return(NULL); + } + + iptr = list; + while (iptr != NULL) + { + if (strcmp(iptr->src, src) == 0) + { + break; + } + iptr = iptr->next; + } + return(iptr); +} + + +/* + * Add an element to the linked list of visited delayed images. + * return a pointer to the head of the new list. + */ +struct delay_rec * +AddDelayedImage(list, src) + struct delay_rec *list; + char *src; +{ + struct delay_rec *iptr; + + if (src == NULL) + { + return(list); + } + + iptr = FindDelayedImage(list, src); + + if (iptr == NULL) + { + iptr = (struct delay_rec *)malloc(sizeof(struct delay_rec)); + if (iptr == NULL) + { + fprintf(stderr, "cannot extend visited delayed images list\n"); + return(list); + } + iptr->src = (char *)malloc(strlen(src) + 1); + if (iptr->src == NULL) + { + free((char *)iptr); + fprintf(stderr, "cannot extend visited delayed images list\n"); + return(list); + } + strcpy(iptr->src, src); + iptr->next = list; + list = iptr; + } + + return(list); +} + diff --git a/vendor/x11iraf/obm/ObmW/HTMLparse.c b/vendor/x11iraf/obm/ObmW/HTMLparse.c new file mode 100644 index 00000000..4b603c98 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLparse.c @@ -0,0 +1,1373 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#ifdef TIMING +#include <sys/time.h> +struct timeval Tv; +struct timezone Tz; +#endif + +#include <stdio.h> +#include <ctype.h> +#ifndef sun +/* To get atoi. */ +#include <stdlib.h> +#endif +#include "HTML.h" +#include "HTMLamp.h" + + +extern void FreeObjList(); +extern struct mark_up *AddObj(); + + +#ifdef NOT_ASCII +#define TOLOWER(x) (tolower(x)) +#else + +/* + * A hack to speed up caseless_equal. Thanks to Quincey Koziol for + * developing it for me + */ +unsigned char map_table[256]={ + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44, + 45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98, + 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115, + 116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102, + 103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119, + 120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136, + 137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153, + 154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170, + 171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187, + 188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204, + 205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221, + 222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, + 239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; + +#define TOLOWER(x) (map_table[x]) +#endif /* NOT_ASCII */ + + +/* + * Check if two strings are equal, ignoring case. + * The strings must be of the same length to be equal. + * return 1 if equal, 0 otherwise. + */ +int +caseless_equal(str1, str2) + char *str1; + char *str2; +{ + if ((str1 == NULL)||(str2 == NULL)) + { + return(0); + } + + while ((*str1 != '\0')&&(*str2 != '\0')) + { + if (TOLOWER(*str1) != TOLOWER(*str2)) + { + return(0); + } + str1++; + str2++; + } + + if ((*str1 == '\0')&&(*str2 == '\0')) + { + return(1); + } + else + { + return(0); + } +} + + +/* + * Check if two strings are equal in the first count characters, ignoring case. + * The strings must both be at least of length count to be equal. + * return 1 if equal, 0 otherwise. + */ +int +caseless_equal_prefix(str1, str2, cnt) + char *str1; + char *str2; + int cnt; +{ + int i; + + if ((str1 == NULL)||(str2 == NULL)) + { + return(0); + } + + if (cnt < 1) + { + return(1); + } + + for (i=0; i < cnt; i++) + { + if (TOLOWER(*str1) != TOLOWER(*str2)) + { + return(0); + } + str1++; + str2++; + } + + return(1); +} + + +/* + * Clean up the white space in a string. + * Remove all leading and trailing whitespace, and turn all + * internal whitespace into single spaces separating words. + * The cleaning is done by rearranging the chars in the passed + * txt buffer. The resultant string will probably be shorter, + * it can never get longer. + */ +void +clean_white_space(txt) + char *txt; +{ + char *ptr; + char *start; + + start = txt; + ptr = txt; + + /* + * Remove leading white space + */ + while (isspace((int)*ptr)) + { + ptr++; + } + + /* + * find a word, copying if we removed some space already + */ + if (start == ptr) + { + while ((!isspace((int)*ptr))&&(*ptr != '\0')) + { + ptr++; + } + start = ptr; + } + else + { + while ((!isspace((int)*ptr))&&(*ptr != '\0')) + { + *start++ = *ptr++; + } + } + + while (*ptr != '\0') + { + /* + * Remove trailing whitespace. + */ + while (isspace((int)*ptr)) + { + ptr++; + } + if (*ptr == '\0') + { + break; + } + + /* + * If there are more words, insert a space and if space was + * removed move up remaining text. + */ + *start++ = ' '; + if (start == ptr) + { + while ((!isspace((int)*ptr))&&(*ptr != '\0')) + { + ptr++; + } + start = ptr; + } + else + { + while ((!isspace((int)*ptr))&&(*ptr != '\0')) + { + *start++ = *ptr++; + } + } + } + + *start = '\0'; +} + + +/* + * parse an amperstand escape, and return the appropriate character, or + * '\0' on error. + * we should really only use caseless_equal_prefix for unterminated, and use + * caseless_equal otherwise, but since there are so many escapes, and I + * don't want to type everything twice, I always use caseless_equal_prefix + * Turns out the escapes are case sensitive, use strncmp. + * termination states: + * 0: terminated with a ';' + * 1: unterminated + * 2: terminated with whitespace + */ +char +ExpandEscapes(esc, endp, termination) + char *esc; + char **endp; + int termination; +{ + int cnt; + char val; + int unterminated; + + unterminated = (termination & 0x01); + + esc++; + if (*esc == '#') + { + if (unterminated) + { + char *tptr; + char tchar; + + tptr = (char *)(esc + 1); + while (isdigit((int)*tptr)) + { + tptr++; + } + tchar = *tptr; + *tptr = '\0'; + val = (char)atoi((esc + 1)); + *tptr = tchar; + *endp = tptr; + } + else + { + val = (char)atoi((esc + 1)); + *endp = (char *)(esc + strlen(esc)); + } + } + else + { + cnt = 0; + while (AmpEscapes[cnt].tag != NULL) + { + if (strncmp(esc, AmpEscapes[cnt].tag, + strlen(AmpEscapes[cnt].tag)) == 0) + { + val = AmpEscapes[cnt].value; + *endp = (char *)(esc + + strlen(AmpEscapes[cnt].tag)); + break; + } + cnt++; + } + if (AmpEscapes[cnt].tag == NULL) + { +#ifdef VERBOSE + fprintf(stderr, "Error bad & string\n"); +#endif + val = '\0'; + *endp = (char *)NULL; + } + } + + return(val); +} + + +/* + * Clean the special HTML character escapes out of the text and replace + * them with the appropriate characters "&lt;" = "<", "&gt;" = ">", + * "&amp;" = "&" + * GAG: apperantly &lt etc. can be left unterminated, what a nightmare. + * Ok, better, they have to be terminated with white-space or ';'. + * the '&' character must be immediately followed by a letter to be + * a valid escape sequence. Other &'s are left alone. + * The cleaning is done by rearranging chars in the passed txt buffer. + * if any escapes are replaced, the string becomes shorter. + */ +void +clean_text(txt) + char *txt; +{ + int unterminated; + int space_terminated; + char *ptr; + char *ptr2; + char *start; + char *text; + char *tend; + char tchar; + char val; + + if (txt == NULL) + { + return; + } + + /* + * Quick scan to find escape sequences. + * Escape is '&' followed by a letter (or a hash mark). + * return if there are none. + */ + ptr = txt; + while (*ptr != '\0') + { + if ((*ptr == '&')&& + ((isalpha((int)*(ptr + 1)))||(*(ptr + 1) == '#'))) + { + break; + } + ptr++; + } + if (*ptr == '\0') + { + return; + } + + /* + * Loop, replaceing escape sequences, and moving up remaining + * text. + */ + ptr2 = ptr; + while (*ptr != '\0') + { + + unterminated = 0; + space_terminated = 0; + /* + * Extract the escape sequence from start to ptr + */ + start = ptr; + while ((*ptr != ';')&&(!isspace((int)*ptr))&&(*ptr != '\0')) + { + ptr++; + } + if (*ptr == '\0') + { +#ifdef VERBOSE + fprintf(stderr, "warning: unterminated & (%s)\n", + start); +#endif + unterminated = 1; + } + else if (isspace((int)*ptr)) + { + space_terminated = 1; + } + + /* + * Copy the escape sequence into a separate buffer. + * Then clean spaces so the "& lt ;" = "&lt;" etc. + * The cleaning should be unnecessary. + */ + tchar = *ptr; + *ptr = '\0'; + text = (char *)malloc(strlen(start) + 1); + if (text == NULL) + { + fprintf(stderr, "Cannot malloc space for & text\n"); + *ptr = tchar; + return; + } + strcpy(text, start); + *ptr = tchar; + clean_white_space(text); + + /* + * Replace escape sequence with appropriate character + */ + val = ExpandEscapes(text, &tend, + ((space_terminated << 1) + unterminated)); + if (val != '\0') + { + if (unterminated) + { + tchar = *tend; + *tend = '\0'; + ptr = (char *)(start + strlen(text) - 1); + *tend = tchar; + } + else if (space_terminated) + { + ptr--; + } + *ptr2 = val; + unterminated = 0; + space_terminated = 0; + } + /* + * invalid escape sequence. skip it. + */ + else + { +#ifdef VERBOSE + fprintf(stderr, "Error bad & string\n"); +#endif + ptr = start; + *ptr2 = *ptr; + } + free(text); + + /* + * Copy forward remaining text until you find the next + * escape sequence + */ + ptr2++; + ptr++; + while (*ptr != '\0') + { + if ((*ptr == '&')&& + ((isalpha((int)*(ptr + 1)))||(*(ptr + 1) == '#'))) + { + break; + } + *ptr2++ = *ptr++; + } + } + *ptr2 = '\0'; +} + + +/* + * Get a block of text from a HTML document. + * All text from start to the end, or the first mark + * (a mark is '<' or '</' followed by any letter or a '!') + * is returned in a malloced buffer. Also, endp returns + * a pointer to the next '<' or '\0' + * The returned text has already expanded '&' escapes. + */ +char * +get_text(start, endp) + char *start; + char **endp; +{ + char *ptr; + char *text; + char tchar; + + if (start == NULL) + { + return(NULL); + } + + /* + * Copy text up to beginning of a mark, or the end + */ + ptr = start; + while (*ptr != '\0') + { + if (*ptr == '<') + { + if (isalpha((int)(*(ptr + 1)))) + { + break; + } + else if (*(ptr + 1) == '/') + { + if (isalpha((int)(*(ptr + 2)))) + { + break; + } + } + else if (*(ptr + 1) == '!') /* a comment */ + { + break; + } + } + ptr++; + } + *endp = ptr; + + if (ptr == start) + { + return(NULL); + } + + /* + * Copy the text into its own buffer, and clean it + * of escape sequences. + */ + tchar = *ptr; + *ptr = '\0'; + text = (char *)malloc(strlen(start) + 1); + if (text == NULL) + { + fprintf(stderr, "Cannot malloc space for text\n"); + *ptr = tchar; + return(NULL); + } + strcpy(text, start); + *ptr = tchar; + clean_text(text); + + return(text); +} + + +/* + * Get the mark text between '<' and '>'. From the text, determine + * its type, and fill in a mark_up structure to return. Also returns + * endp pointing to the ttrailing '>' in the original string. + */ +struct mark_up * +get_mark(start, endp) + char *start; + char **endp; +{ + char *ptr; + char *text; + char tchar; + struct mark_up *mark; + + if (start == NULL) + { + return(NULL); + } + + if (*start != '<') + { + return(NULL); + } + + start++; + + mark = (struct mark_up *)malloc(sizeof(struct mark_up)); + if (mark == NULL) + { + fprintf(stderr, "Cannot malloc space for mark_up struct\n"); + return(NULL); + } + + /* + * Grab the mark text + */ + ptr = start; + while ((*ptr != '>')&&(*ptr != '\0')) + { + ptr++; + } + *endp = ptr; + + if (*ptr != '>') + { +#ifdef VERBOSE + fprintf(stderr, "error: bad mark format\n"); +#endif + return(NULL); + } + + /* + * Copy the mark text to its own buffer, and + * clean it of escapes, and odd white space. + */ + tchar = *ptr; + *ptr = '\0'; + text = (char *)malloc(strlen(start) + 1); + if (text == NULL) + { + fprintf(stderr, "Cannot malloc space for mark\n"); + *ptr = tchar; + return(NULL); + } + strcpy(text, start); + *ptr = tchar; + clean_text(text); +/* + * No longer needed because the parsing code is now smarter + * + clean_white_space(text); + * + */ + + /* + * Set whether this is the start or end of a mark + * block, as well as determining its type. + */ + if (*text == '/') + { + mark->is_end = 1; + mark->type = ParseMarkType((char *)(text + 1)); + mark->start = NULL; + mark->text = NULL; + mark->end = text; + } + else + { + mark->is_end = 0; + mark->type = ParseMarkType(text); + mark->start = text; + mark->text = NULL; + mark->end = NULL; + } + mark->text = NULL; + mark->next = NULL; + + return(mark); +} + + +/* + * Special version of get_text. It reads all text up to the + * end of the plain text mark, or the end of the file. + */ +char * +get_plain_text(start, endp) + char *start; + char **endp; +{ + char *ptr; + char *text; + char tchar; + + if (start == NULL) + { + return(NULL); + } + + /* + * Read until stopped by end plain text mark. + */ + ptr = start; + while (*ptr != '\0') + { + /* + * Beginning of a mark is '<' followed by any letter, + * or followed by '!' for a comment, + * or '</' followed by any letter. + */ + if ((*ptr == '<')&& + ((isalpha((int)(*(ptr + 1))))|| + (*(ptr + 1) == '!')|| + ((*(ptr + 1) == '/')&&(isalpha((int)(*(ptr + 2))))))) + { + struct mark_up *mp; + char *ep; + + /* + * We think we found a mark. If it is the + * end of plain text, break out + */ + mp = get_mark(ptr, &ep); + if (mp != NULL) + { + if (((mp->type == M_PLAIN_TEXT)|| + (mp->type == M_LISTING_TEXT))&&(mp->is_end)) + { + if (mp->end != NULL) + { + free((char *)mp->end); + } + free((char *)mp); + break; + } + if (mp->start != NULL) + { + free((char *)mp->start); + } + if (mp->end != NULL) + { + free((char *)mp->end); + } + free((char *)mp); + } + } + ptr++; + } + *endp = ptr; + + if (ptr == start) + { + return(NULL); + } + + /* + * Copy text to its own malloced buffer, and clean it of + * HTML escapes. + */ + tchar = *ptr; + *ptr = '\0'; + text = (char *)malloc(strlen(start) + 1); + if (text == NULL) + { + fprintf(stderr, "Cannot malloc space for text\n"); + *ptr = tchar; + return(NULL); + } + strcpy(text, start); + *ptr = tchar; + clean_text(text); + + return(text); +} + + +/* + * Main parser of HTML text. Takes raw text, and produces a linked + * list of mark objects. Mark objects are either text strings, or + * starting and ending mark delimiters. + * The old list is passed in so it can be freed, and in the future we + * may want to add code to append to the old list. + */ +struct mark_up * +HTMLParse(old_list, str) + struct mark_up *old_list; + char *str; +{ + int preformat; + char *start, *end; + char *text, *tptr; + struct mark_up *mark; + struct mark_up *list; + struct mark_up *current; +#ifdef TIMING +gettimeofday(&Tv, &Tz); +fprintf(stderr, "HTMLParse enter (%d.%d)\n", Tv.tv_sec, Tv.tv_usec); +#endif + + preformat = 0; + + /* + * Free up the previous Object List if one exists + */ + FreeObjList(old_list); + + if (str == NULL) + { + return(NULL); + } + + list = NULL; + current = NULL; + + start = str; + end = str; + + mark = NULL; + while (*start != '\0') + { + /* + * Get some text (if any). If our last mark was + * a begin plain text we call different function + * If last mark was <PLAINTEXT> we lump all the rest of + * the text in. + */ + if ((mark != NULL)&&(mark->type == M_PLAIN_FILE)&& + (!mark->is_end)) + { + text = start; + end = text; + while (*end != '\0') + { + end++; + } + /* + * Copy text to its own malloced buffer, and clean it of + * HTML escapes. + */ + tptr = (char *)malloc(strlen(text) + 1); + if (tptr == NULL) + { + fprintf(stderr, + "Cannot malloc space for text\n"); + return(list); + } + strcpy(tptr, text); + text = tptr; + } + else if ((mark != NULL)&& + ((mark->type == M_PLAIN_TEXT)|| + (mark->type == M_LISTING_TEXT))&& + (!mark->is_end)) + { + text = get_plain_text(start, &end); + } + else + { + text = get_text(start, &end); + } + + /* + * If text is OK, put it into a mark structure, and add + * it to the linked list. + */ + if (text == NULL) + { + if (start != end) + { + fprintf(stderr, "error parsing text, bailing out\n"); + return(list); + } + } + else + { + mark = (struct mark_up *)malloc(sizeof(struct mark_up)); + if (mark == NULL) + { + fprintf(stderr, "Cannot malloc for mark_up struct\n"); + return(list); + } + mark->type = M_NONE; + mark->is_end = 0; + mark->start = NULL; + mark->text = text; + mark->end = NULL; + mark->next = NULL; + current = AddObj(&list, current, mark, preformat); + } + start = end; + + if (*start == '\0') + { + break; + } + + /* + * Get the next mark if any, and if it is + * valid, add it to the linked list. + */ + mark = get_mark(start, &end); + if (mark == NULL) + { + if (start != end) + { + fprintf(stderr, "error parsing mark, bailing out\n"); + return(list); + } + } + else + { + mark->next = NULL; + current = AddObj(&list, current, mark, preformat); + } + + start = (char *)(end + 1); + + if ((mark != NULL)&&(mark->type == M_PLAIN_FILE)&& + (!mark->is_end)) + { + /* + * A linefeed immediately after the <PLAINTEXT> + * mark is to be ignored. + */ + if (*start == '\n') + { + start++; + } + } + else if ((mark != NULL)&&((mark->type == M_PLAIN_TEXT)|| + (mark->type == M_LISTING_TEXT))&& + (!mark->is_end)) + { + /* + * A linefeed immediately after the <XMP> + * or <LISTING> mark is to be ignored. + */ + if (*start == '\n') + { + start++; + } + } + /* + * If we are parsing pre-formatted text we need to set a + * flag so we don't throw out needed linefeeds. + */ + else if ((mark != NULL)&&(mark->type == M_PREFORMAT)) + { + if (mark->is_end) + { + preformat = 0; + } + else + { + preformat = 1; + /* + * A linefeed immediately after the <PRE> + * mark is to be ignored. + */ + if (*start == '\n') + { + start++; + } + } + } + } +#ifdef TIMING +gettimeofday(&Tv, &Tz); +fprintf(stderr, "HTMLParse exit (%d.%d)\n", Tv.tv_sec, Tv.tv_usec); +#endif + return(list); +} + + +/* + * Determine mark type from the identifying string passed + */ +int +ParseMarkType(str) + char *str; +{ + int type; + char *tptr; + char tchar; + + if (str == NULL) + { + return(M_NONE); + } + + type = M_UNKNOWN; + tptr = str; + while (*tptr != '\0') + { + if (isspace((int)*tptr)) + { + break; + } + tptr++; + } + tchar = *tptr; + *tptr = '\0'; + + if (caseless_equal(str, MT_ANCHOR)) + { + type = M_ANCHOR; + } + else if (caseless_equal(str, MT_TITLE)) + { + type = M_TITLE; + } + else if (caseless_equal(str, MT_FIXED)) + { + type = M_FIXED; + } + else if (caseless_equal(str, MT_BOLD)) + { + type = M_BOLD; + } + else if (caseless_equal(str, MT_ITALIC)) + { + type = M_ITALIC; + } + else if (caseless_equal(str, MT_EMPHASIZED)) + { + type = M_EMPHASIZED; + } + else if (caseless_equal(str, MT_STRONG)) + { + type = M_STRONG; + } + else if (caseless_equal(str, MT_CODE)) + { + type = M_CODE; + } + else if (caseless_equal(str, MT_SAMPLE)) + { + type = M_SAMPLE; + } + else if (caseless_equal(str, MT_KEYBOARD)) + { + type = M_KEYBOARD; + } + else if (caseless_equal(str, MT_VARIABLE)) + { + type = M_VARIABLE; + } + else if (caseless_equal(str, MT_CITATION)) + { + type = M_CITATION; + } + else if (caseless_equal(str, MT_STRIKEOUT)) + { + type = M_STRIKEOUT; + } + else if (caseless_equal(str, MT_HEADER_1)) + { + type = M_HEADER_1; + } + else if (caseless_equal(str, MT_HEADER_2)) + { + type = M_HEADER_2; + } + else if (caseless_equal(str, MT_HEADER_3)) + { + type = M_HEADER_3; + } + else if (caseless_equal(str, MT_HEADER_4)) + { + type = M_HEADER_4; + } + else if (caseless_equal(str, MT_HEADER_5)) + { + type = M_HEADER_5; + } + else if (caseless_equal(str, MT_HEADER_6)) + { + type = M_HEADER_6; + } + else if (caseless_equal(str, MT_ADDRESS)) + { + type = M_ADDRESS; + } + else if (caseless_equal(str, MT_PLAIN_TEXT)) + { + type = M_PLAIN_TEXT; + } + else if (caseless_equal(str, MT_LISTING_TEXT)) + { + type = M_LISTING_TEXT; + } + else if (caseless_equal(str, MT_PLAIN_FILE)) + { + type = M_PLAIN_FILE; + } + else if (caseless_equal(str, MT_PARAGRAPH)) + { + type = M_PARAGRAPH; + } + else if (caseless_equal(str, MT_UNUM_LIST)) + { + type = M_UNUM_LIST; + } + else if (caseless_equal(str, MT_NUM_LIST)) + { + type = M_NUM_LIST; + } + else if (caseless_equal(str, MT_MENU)) + { + type = M_MENU; + } + else if (caseless_equal(str, MT_DIRECTORY)) + { + type = M_DIRECTORY; + } + else if (caseless_equal(str, MT_LIST_ITEM)) + { + type = M_LIST_ITEM; + } + else if (caseless_equal(str, MT_DESC_LIST)) + { + type = M_DESC_LIST; + } + else if (caseless_equal(str, MT_DESC_TITLE)) + { + type = M_DESC_TITLE; + } + else if (caseless_equal(str, MT_DESC_TEXT)) + { + type = M_DESC_TEXT; + } + else if (caseless_equal(str, MT_PREFORMAT)) + { + type = M_PREFORMAT; + } + else if (caseless_equal(str, MT_BLOCKQUOTE)) + { + type = M_BLOCKQUOTE; + } + else if (caseless_equal(str, MT_INDEX)) + { + type = M_INDEX; + } + else if (caseless_equal(str, MT_HRULE)) + { + type = M_HRULE; + } + else if (caseless_equal(str, MT_BASE)) + { + type = M_BASE; + } + else if (caseless_equal(str, MT_LINEBREAK)) + { + type = M_LINEBREAK; + } + else if (caseless_equal(str, MT_IMAGE)) + { + type = M_IMAGE; + } + else if (caseless_equal(str, MT_SELECT)) + { + type = M_SELECT; + } + else if (caseless_equal(str, MT_OPTION)) + { + type = M_OPTION; + } + else if (caseless_equal(str, MT_INPUT)) + { + type = M_INPUT; + } + else if (caseless_equal(str, MT_TEXTAREA)) + { + type = M_TEXTAREA; + } + else if (caseless_equal(str, MT_FORM)) + { + type = M_FORM; + } + else + { +#ifdef VERBOSE + fprintf(stderr, "warning: unknown mark (%s)\n", str); +#endif + type = M_UNKNOWN; + } + + *tptr = tchar; + return(type); +} + + +/* + * Parse a single anchor tag. ptrp is a pointer to a pointer to the + * string to be parsed. On return, the ptr should be changed to + * point to after the text we have parsed. + * On return start and end should point to the beginning, and just + * after the end of the tag's name in the original anchor string. + * Finally the function returns the tag value in a malloced buffer. + */ +char * +AnchorTag(ptrp, startp, endp) + char **ptrp; + char **startp; + char **endp; +{ + char *tag_val; + char *ptr; + char *start; + char tchar; + int quoted; + int has_value; + + quoted = 0; + + /* + * remove leading spaces, and set start + */ + ptr = *ptrp; + while (isspace((int)*ptr)) + { + ptr++; + } + *startp = ptr; + + /* + * Find and set the end of the tag + */ + while ((!isspace((int)*ptr))&&(*ptr != '=')&&(*ptr != '\0')) + { + ptr++; + } + *endp = ptr; + + if (*ptr == '\0') + { + *ptrp = ptr; + return(NULL); + } + + /* + * Move to the start of the tag value, if there is one. + * set the has_value flag. + */ + has_value = 0; + while ((isspace((int)*ptr))||(*ptr == '=')) + { + if (*ptr == '=') + { + has_value = 1; + } + ptr++; + } + + /* + * For a tag with no value, this is a boolean flag. + * Return the string "1" so we know the tag is there. + */ + if (!has_value) + { + *ptrp = *endp; + /* + * set a tag value of 1. + */ + tag_val = (char *)malloc(strlen("1") + 1); + if (tag_val == NULL) + { + fprintf(stderr, "can't malloc space for tag value\n"); + return(NULL); + } + strcpy(tag_val, "1"); + + return(tag_val); + } + + if (*ptr == '\"') + { + quoted = 1; + ptr++; + } + + start = ptr; + /* + * Get tag value. Either a quoted string or a single word + */ + if (quoted) + { + while ((*ptr != '\"')&&(*ptr != '\0')) + { + ptr++; + } + } + else + { + while ((!isspace((int)*ptr))&&(*ptr != '\0')) + { + ptr++; + } + } + if ((quoted)&&(*ptr == '\0')) + { + *ptrp = ptr; + return(NULL); + } + + /* + * Copy the tag value out into a malloced string + */ + tchar = *ptr; + *ptr = '\0'; + tag_val = (char *)malloc(strlen(start) + 1); + if (tag_val == NULL) + { + fprintf(stderr, "can't malloc space for tag value\n"); + *ptr = tchar; + *ptrp = ptr; + return(NULL); + } + strcpy(tag_val, start); + *ptr = tchar; + if (quoted) + { + ptr++; + } + *ptrp = ptr; + + return(tag_val); +} + + +/* + * Parse mark text for the value associated with the + * passed mark tag. + * If the passed tag is not found, return NULL. + * If the passed tag is found but has no value, return "". + */ +char * +ParseMarkTag(text, mtext, mtag) + char *text; + char *mtext; + char *mtag; +{ + char *ptr; + char *start; + char *end; + char *tag_val; + char tchar; + + if ((text == NULL)||(mtext == NULL)||(mtag == NULL)) + { + return(NULL); + } + + ptr = (char *)(text + strlen(mtext)); + + while (*ptr != '\0') + { + tag_val = AnchorTag(&ptr, &start, &end); + + tchar = *end; + *end = '\0'; + if (caseless_equal(start, mtag)) + { + *end = tchar; + if (tag_val == NULL) + { + tag_val = (char *)malloc(1); + *tag_val = '\0'; + return(tag_val); + } + else + { + return(tag_val); + } + } + *end = tchar; + if (tag_val != NULL) + { + free(tag_val); + } + } + return(NULL); +} + diff --git a/vendor/x11iraf/obm/ObmW/HTMLwidgets.c b/vendor/x11iraf/obm/ObmW/HTMLwidgets.c new file mode 100644 index 00000000..a4195c45 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/HTMLwidgets.c @@ -0,0 +1,4014 @@ +/**************************************************************************** + * NCSA Mosaic for the X Window System * + * Software Development Group * + * National Center for Supercomputing Applications * + * University of Illinois at Urbana-Champaign * + * 605 E. Springfield, Champaign IL 61820 * + * mosaic@ncsa.uiuc.edu * + * * + * Copyright (C) 1993, Board of Trustees of the University of Illinois * + * * + * NCSA Mosaic software, both binary and source (hereafter, Software) is * + * copyrighted by The Board of Trustees of the University of Illinois * + * (UI), and ownership remains with the UI. * + * * + * The UI grants you (hereafter, Licensee) a license to use the Software * + * for academic, research and internal business purposes only, without a * + * fee. Licensee may distribute the binary and source code (if released) * + * to third parties provided that the copyright notice and this statement * + * appears on all copies and that no charge is associated with such * + * copies. * + * * + * Licensee may make derivative works. However, if Licensee distributes * + * any derivative work based on or derived from the Software, then * + * Licensee will (1) notify NCSA regarding its distribution of the * + * derivative work, and (2) clearly notify users that such derivative * + * work is a modified version and not the original NCSA Mosaic * + * distributed by the UI. * + * * + * Any Licensee wishing to make commercial use of the Software should * + * contact the UI, c/o NCSA, to negotiate an appropriate license for such * + * commercial use. Commercial use includes (1) integration of all or * + * part of the source code into a product for sale or license by or on * + * behalf of Licensee to third parties, or (2) distribution of the binary * + * code or source code to third parties that need it to utilize a * + * commercial product sold or licensed by or on behalf of Licensee. * + * * + * UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR * + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED * + * WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE * + * USERS OF THIS SOFTWARE. * + * * + * By using or copying this Software, Licensee agrees to abide by the * + * copyright law and all other applicable laws of the U.S. including, but * + * not limited to, export control laws, and the terms of this license. * + * UI shall have the right to terminate this license immediately by * + * written notice upon Licensee's breach of, or non-compliance with, any * + * of its terms. Licensee may be held legally responsible for any * + * copyright infringement that is caused or encouraged by Licensee's * + * failure to abide by the terms of this license. * + * * + * Comments and questions are welcome and can be sent to * + * mosaic-x@ncsa.uiuc.edu. * + ****************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#ifdef MOTIF +#include <Xm/Xm.h> +#include <Xm/Frame.h> +#include <Xm/DrawingA.h> +#include <Xm/ScrolledW.h> +#include <Xm/Text.h> +#include <Xm/TextF.h> +#include <Xm/ToggleB.h> +#include <Xm/PushB.h> +#include <Xm/RowColumn.h> +#include <Xm/List.h> +#else +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Xaw/Toggle.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/List.h> +#include <X11/Xaw/Viewport.h> +#include <X11/Xaw/MenuButton.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#endif /* MOTIF */ +#include "HTMLP.h" + + +#ifdef MOTIF +#define STRING XmString +#else +#define STRING String +#endif /* MOTIF */ + +#define X_NAME "x" +#define Y_NAME "y" + +#define W_TEXTFIELD 0 +#define W_CHECKBOX 1 +#define W_RADIOBOX 2 +#define W_PUSHBUTTON 3 +#define W_PASSWORD 4 +#define W_OPTIONMENU 5 +#define W_TEXTAREA 6 +#define W_LIST 7 +#define W_JOT 8 +#define W_HIDDEN 9 + + +extern void NewJot(); +extern void ClearJot(); +extern void EVJotExpose(); +extern void EVJotPress(); +extern void EVJotMove(); +extern void EVJotRelease(); +extern char *EJB_JOTfromJot(); +extern char *ParseMarkTag(); + + +#ifdef MOTIF +static Boolean ModifyIgnore = False; +#endif /* MOTIF */ + + +char **ParseCommaList(); +void FreeCommaList(); +char *MapOptionReturn(); + + +#ifndef MOTIF +#define FONTHEIGHT(font) (font->max_bounds.ascent + font->max_bounds.descent) + +void +setTextSize(w, columns, lines) + Widget w; + int columns; + int lines; +{ + XFontStruct *font; + Position lm, rm, tm, bm; + int width, height; + + XtVaGetValues(w, XtNfont, &font, + XtNleftMargin, &lm, + XtNrightMargin, &rm, + XtNtopMargin, &tm, + XtNbottomMargin, &bm, + NULL); + width = rm + lm + columns * XTextWidth(font, "0", 1); + height = tm + bm + lines * FONTHEIGHT(font); + XtVaSetValues(w, + XtNwidth, width, + XtNheight, height, + NULL); +} + +void +CBListDestroy(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + char **string_list, **p; + int item_count; + + XtVaGetValues(w, + XtNlist, string_list, + XtNnumberStrings, item_count, + NULL); + + p = string_list; + while(item_count > 0) + { + free(*p++); + item_count--; + } + free(string_list); +} + + +void +CBTextDestroy(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + char *txt = (char *)client_data; + free(txt); +} + + +void +CBoption(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + Widget menuButton = (Widget)client_data; + char *label; + + XtVaGetValues(menuButton, XtNlabel, &label, NULL); + XtVaGetValues(w, XtNlabel, &label, NULL); + XtVaSetValues(menuButton, XtNlabel, label, NULL); +} +#endif /* not MOTIF */ + + +void +AddNewForm(hw, fptr) + HTMLWidget hw; + FormInfo *fptr; +{ + FormInfo *ptr; + + ptr = hw->html.form_list; + if (ptr == NULL) + { + hw->html.form_list = fptr; + fptr->next = NULL; + } + else + { + while (ptr->next != NULL) + { + ptr = ptr->next; + } + ptr->next = fptr; + fptr->next = NULL; + } +} + + +int +CollectSubmitInfo(fptr, name_list, value_list) + FormInfo *fptr; + char ***name_list; + char ***value_list; +{ + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WbFormCallbackData cbdata; + WidgetInfo *wptr; + int cnt; +#ifndef MOTIF + Boolean state; +#endif + + if (fptr->end == -1) /* unterminated FORM tag */ + { + wptr = hw->html.widget_list; + cnt = 0; + while (wptr != NULL) + { + cnt++; + wptr = wptr->next; + } + cbdata.attribute_count = cnt; + } + else + { + cbdata.attribute_count = fptr->end - fptr->start; + } + cbdata.attribute_names = (char **)malloc(cbdata.attribute_count * + sizeof(char *)); + cbdata.attribute_values = (char **)malloc(cbdata.attribute_count * + sizeof(char *)); + + if (fptr->start == 0) + { + wptr = hw->html.widget_list; + } + else + { + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->id == fptr->start) + { + wptr = wptr->next; + break; + } + wptr = wptr->next; + } + } + + cnt = 0; + + while ((wptr != NULL)&&(cnt < cbdata.attribute_count)) + { + if ((wptr->name)&&(wptr->type != W_PUSHBUTTON)) + { + Widget child; + STRING *str_list; + int list_cnt; + char *val; +#ifdef MOTIF + STRING label; + Cardinal argcnt; + Arg arg[5]; +#else + XawListReturnStruct *currentSelection; +#endif /* MOTIF */ + + cbdata.attribute_names[cnt] = wptr->name; + switch(wptr->type) + { + case W_TEXTFIELD: +#ifdef MOTIF + cbdata.attribute_values[cnt] = + XmTextFieldGetString(wptr->w); +#else + XtVaGetValues(wptr->w, XtNstring, + &(cbdata.attribute_values[cnt]), + NULL); +#endif /* MOTIF */ + if ((cbdata.attribute_values[cnt] != NULL)&& + (cbdata.attribute_values[cnt][0] == '\0')) + { + cbdata.attribute_values[cnt] = NULL; + } + break; + case W_TEXTAREA: +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNworkWindow, &child); + argcnt++; + XtGetValues(wptr->w, arg, argcnt); + cbdata.attribute_values[cnt] = + XmTextGetString(child); +#else + XtVaGetValues(wptr->w, XtNstring, + &(cbdata.attribute_values[cnt]), + NULL); +#endif /* MOTIF */ + if ((cbdata.attribute_values[cnt] != NULL)&& + (cbdata.attribute_values[cnt][0] == '\0')) + { + cbdata.attribute_values[cnt] = NULL; + } + break; + case W_PASSWORD: + cbdata.attribute_values[cnt] = wptr->password; + if ((cbdata.attribute_values[cnt] != NULL)&& + (cbdata.attribute_values[cnt][0] == '\0')) + { + cbdata.attribute_values[cnt] = NULL; + } + break; + case W_LIST: + /* + * First get the Widget ID of the proper + * list element + */ +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNworkWindow, &child); + argcnt++; + XtGetValues(wptr->w, arg, argcnt); +#else + { + WidgetList wl; + XtVaGetValues(wptr->w, XtNchildren, + &wl, NULL); + child = *++wl; + } +#endif /* MOTIF */ + + /* + * Now get the list of selected items. + */ +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNselectedItemCount, + &list_cnt); + argcnt++; + XtSetArg(arg[argcnt], XmNselectedItems, + &str_list); + argcnt++; + XtGetValues(child, arg, argcnt); +#else + currentSelection = XawListShowCurrent(child); + list_cnt = + currentSelection->list_index == XAW_LIST_NONE? + 0 : 1; + str_list = &(currentSelection->string); +#endif /* MOTIF */ + + if (list_cnt == 0) + { + cnt--; + cbdata.attribute_count--; + } + else /* list_cnt >= 1 */ + { + int j, new_cnt; + char **names; + char **values; + + if (list_cnt > 1) + { + new_cnt = cbdata.attribute_count + + list_cnt - 1; + names = (char **)malloc(new_cnt * + sizeof(char *)); + values = (char **)malloc(new_cnt * + sizeof(char *)); + for (j=0; j<cnt; j++) + { + names[j] = + cbdata.attribute_names[j]; + values[j] = + cbdata.attribute_values[j]; + } + free((char *) + cbdata.attribute_names); + free((char *) + cbdata.attribute_values); + cbdata.attribute_names = names; + cbdata.attribute_values = values; + cbdata.attribute_count = new_cnt; + } + + for (j=0; j<list_cnt; j++) + { + cbdata.attribute_names[cnt + j] + = wptr->name; +#ifdef MOTIF + XmStringGetLtoR(str_list[j], + XmSTRING_DEFAULT_CHARSET, + &val); +#else + val = str_list[j]; +#endif /* MOTIF */ + if ((val != NULL)&& + (val[0] == '\0')) + { + val = NULL; + } + else if (val != NULL) + { + val = MapOptionReturn( + val, + wptr->mapping); + } + cbdata.attribute_values[cnt + j] + = val; + } + cnt = cnt + list_cnt - 1; + } + break; + /* + * For an option menu, first get the label gadget + * which holds the current value. + * Now get the text from that label as a character + * string. + */ + case W_OPTIONMENU: +#ifdef MOTIF + child = XmOptionButtonGadget(wptr->w); + argcnt = 0; + XtSetArg(arg[argcnt], XmNlabelString, &label); + argcnt++; + XtGetValues(child, arg, argcnt); + val = NULL; + XmStringGetLtoR(label, XmSTRING_DEFAULT_CHARSET, + &val); +#else + XtVaGetValues(wptr->w, XtNlabel, &val, NULL); +#endif /* MOTIF */ + if ((val != NULL)&&(val[0] == '\0')) + { + val = NULL; + } + else if (val != NULL) + { + val = MapOptionReturn(val, + wptr->mapping); + } + cbdata.attribute_values[cnt] = val; + if ((cbdata.attribute_values[cnt] != NULL)&& + (cbdata.attribute_values[cnt][0] == '\0')) + { + cbdata.attribute_values[cnt] = NULL; + } + break; + case W_CHECKBOX: + case W_RADIOBOX: +#ifdef MOTIF + if (XmToggleButtonGetState(wptr->w) == True) +#else + XtVaGetValues(wptr->w, XtNstate, &state, NULL); + if (state) +#endif /* MOTIF */ + { + cbdata.attribute_values[cnt] = wptr->value; + } + else + { + cnt--; + cbdata.attribute_count--; + } + break; + case W_HIDDEN: + cbdata.attribute_values[cnt] = wptr->value; + break; +#ifdef MOTIF + case W_JOT: + argcnt = 0; + XtSetArg(arg[argcnt], XmNuserData, + (XtPointer *)&child); + argcnt++; + XtGetValues(wptr->w, arg, argcnt); + cbdata.attribute_values[cnt] = + EJB_JOTfromJot(child); + break; +#endif /* MOTIF */ + default: + cbdata.attribute_values[cnt] = NULL; + break; + } + cnt++; + } + else + { + cbdata.attribute_count--; + } + wptr = wptr->next; + } + cbdata.attribute_count = cnt; + + *name_list = cbdata.attribute_names; + *value_list = cbdata.attribute_values; + return(cbdata.attribute_count); +} + + +void +ImageSubmitForm(fptr, event, name, x, y) + FormInfo *fptr; + XEvent *event; + char *name; + int x, y; +{ + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WbFormCallbackData cbdata; + int i, cnt; + char **name_list; + char **value_list; + char valstr[100]; + + cbdata.event = event; + cbdata.href = fptr->action; + cbdata.method = fptr->method; + cbdata.enctype = fptr->enctype; + cbdata.enc_entity = fptr->enc_entity; + + name_list = NULL; + value_list = NULL; + cnt = CollectSubmitInfo(fptr, &name_list, &value_list); + + cbdata.attribute_count = cnt + 2; + cbdata.attribute_names = (char **)malloc(cbdata.attribute_count * + sizeof(char *)); + cbdata.attribute_values = (char **)malloc(cbdata.attribute_count * + sizeof(char *)); + for (i=0; i<cnt; i++) + { + cbdata.attribute_names[i] = name_list[i]; + cbdata.attribute_values[i] = value_list[i]; + } + if (name_list != NULL) + { + free((char *)name_list); + } + if (value_list != NULL) + { + free((char *)value_list); + } + + if ((name != NULL)&&(name[0] != '\0')) + { + cbdata.attribute_names[cnt] = (char *)malloc(strlen(name) + + strlen(X_NAME) + 2); + strcpy(cbdata.attribute_names[cnt], name); + strcat(cbdata.attribute_names[cnt], "."); + strcat(cbdata.attribute_names[cnt], X_NAME); + } + else + { + cbdata.attribute_names[cnt] = (char *)malloc(strlen(X_NAME) +1); + strcpy(cbdata.attribute_names[cnt], X_NAME); + } + sprintf(valstr, "%d", x); + cbdata.attribute_values[cnt] = (char *)malloc(strlen(valstr) + 1); + strcpy(cbdata.attribute_values[cnt], valstr); + + cnt++; + if ((name != NULL)&&(name[0] != '\0')) + { + cbdata.attribute_names[cnt] = (char *)malloc(strlen(name) + + strlen(Y_NAME) + 2); + strcpy(cbdata.attribute_names[cnt], name); + strcat(cbdata.attribute_names[cnt], "."); + strcat(cbdata.attribute_names[cnt], Y_NAME); + } + else + { + cbdata.attribute_names[cnt] = (char *)malloc(strlen(Y_NAME) +1); + strcpy(cbdata.attribute_names[cnt], Y_NAME); + } + sprintf(valstr, "%d", y); + cbdata.attribute_values[cnt] = (char *)malloc(strlen(valstr) + 1); + strcpy(cbdata.attribute_values[cnt], valstr); + + XtCallCallbackList ((Widget)hw, hw->html.form_callback, + (XtPointer)&cbdata); +} + + +void +CBSubmitForm(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + FormInfo *fptr = (FormInfo *)client_data; + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WbFormCallbackData cbdata; +#ifdef MOTIF + XmPushButtonCallbackStruct *pb = + (XmPushButtonCallbackStruct *)call_data; +#endif /* MOTIF */ + +#ifdef MOTIF + cbdata.event = pb->event; +#else + /******* WE HAVE NO EVENT in ATHENA *******/ + cbdata.event = NULL; +#endif /* MOTIF */ + cbdata.href = fptr->action; + cbdata.method = fptr->method; + cbdata.enctype = fptr->enctype; + cbdata.enc_entity = fptr->enc_entity; + + cbdata.attribute_count = CollectSubmitInfo(fptr, + &cbdata.attribute_names, &cbdata.attribute_values); + + XtCallCallbackList ((Widget)hw, hw->html.form_callback, + (XtPointer)&cbdata); +} + + +/* + * A radio buttom was toggled on in a form. + * If there are other radios of the same name, turn them off. + */ +void +CBChangeRadio(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + FormInfo *fptr = (FormInfo *)client_data; + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WidgetInfo *wptr; + WidgetInfo *wtmp; + char *name; + int cnt, count; +#ifdef MOTIF + XmToggleButtonCallbackStruct *tb = + (XmToggleButtonCallbackStruct *)call_data; +#else + Boolean state; +#endif /* MOTIF */ + +#ifdef MOTIF + /* + * Bad button + */ + if (tb == NULL) + { + return; + } +#endif /* MOTIF */ + + /* + * Only do stuff when the button is turned on. + * Don't let the button be turned off, by clicking on + * it, as that would leave all buttons off. + */ +#ifdef MOTIF + if ((tb == NULL)||(tb->set == False)) + { + XmToggleButtonSetState(w, True, False); + return; + } +#else + XtVaGetValues(w, XtNstate, &state, NULL); + if (!state) + { + XtVaSetValues(w, XtNstate, 1, NULL); + return; + } +#endif /* MOTIF */ + + /* + * Terminate the form if it was never properly terminated. + */ + if (fptr->end == -1) /* unterminated FORM tag */ + { + wptr = hw->html.widget_list; + cnt = 0; + while (wptr != NULL) + { + cnt++; + wptr = wptr->next; + } + count = cnt; + } + else + { + count = fptr->end - fptr->start; + } + + /* + * Locate the start of the form. + */ + if (fptr->start == 0) + { + wptr = hw->html.widget_list; + } + else + { + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->id == fptr->start) + { + wptr = wptr->next; + break; + } + wptr = wptr->next; + } + } + + /* + * Find the name of the toggle button just pressed. + */ + name = NULL; + wtmp = wptr; + while (wtmp != NULL) + { + if (wtmp->w == w) + { + name = wtmp->name; + break; + } + wtmp = wtmp->next; + } + + /* + * Check for other checked radioboxes of the same name. + */ + cnt = 0; + while ((wptr != NULL)&&(cnt < count)) + { +#ifdef MOTIF + if ((wptr->type == W_RADIOBOX)&& + (wptr->w != w)&& + (XmToggleButtonGetState(wptr->w) == True)&& + (wptr->name != NULL)&& + (name != NULL)&& + (strcmp(wptr->name, name) == 0)) + { + XmToggleButtonSetState(wptr->w, False, False); + } +#else + if ((wptr->type == W_RADIOBOX)&& + (wptr->w != w)&& + (wptr->name != NULL)&& + (name != NULL)&& + (strcmp(wptr->name, name) == 0)) + { + XtVaGetValues(wptr->w, XtNstate, &state, NULL); + if (state) + { + XtVaSetValues(wptr->w, XtNstate, 0, NULL); + } + } +#endif /* MOTIF */ + cnt++; + wptr = wptr->next; + } +} + + +#ifdef MOTIF +/* + * Catch all attempted modifications to the textfield for password + * entry. This is so we can prevent the password from showing + * uponm the screen. + * I would prefer that for all insereted characters a random 1-3 '*'s + * were added, and any delete deleted the whole string, but due to + * bugs in somve version of Motif 1.1 this won't work. + */ +void +CBPasswordModify(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + FormInfo *fptr = (FormInfo *)client_data; + XmTextVerifyCallbackStruct *tv =(XmTextVerifyCallbackStruct *)call_data; + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WidgetInfo *wptr; + int i, len; + + /* + * by default accept nothing + tv->doit = False; + */ + + /* + * Ignore when ModifyIgnore is true + */ + if (ModifyIgnore == True) + { + return; + } + + /* + * only accept text modification of password fields + */ + if (tv->reason != XmCR_MODIFYING_TEXT_VALUE) + { + return; + } + + /* + * find the structure for this widget + */ + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->w == w) + { + break; + } + wptr = wptr->next; + } + if (wptr == NULL) + { + return; + } + + /* + * Deletion. + */ + if (tv->text->ptr == NULL) + { + tv->doit = True; + + /* + * Only can delete if we have stuff to delete. + */ + if ((wptr->password != NULL)&&(wptr->password[0] != '\0')) + { + int start; + char *tptr; + + len = strlen(wptr->password); + /* + * Find the start of the chunk of text to + * delete. + */ + if (tv->startPos < len) + { + start = tv->startPos; + } + else + { + start = len - 1; + } + + /* + * might be more stuff after the end that we + * want to move up + */ + if (tv->endPos > len) + { + tptr = &(wptr->password[len]); + } + else + { + tptr = &(wptr->password[tv->endPos]); + } + wptr->password[start] = '\0'; + strcat(wptr->password, tptr); + } + } + /* + * Else insert character. + */ + else if (tv->text->length >= 1) + { + int maxlength, plen; + Cardinal argcnt; + Arg arg[5]; + + /* + * No insertion if it makes you exceed maxLength + */ + if (wptr->password == NULL) + { + plen = 0; + } + else + { + plen = strlen(wptr->password); + } + maxlength = 1000000; + argcnt = 0; + XtSetArg(arg[argcnt], XmNmaxLength, &maxlength); argcnt++; + XtGetValues(w, arg, argcnt); + if ((plen + tv->text->length) > maxlength) + { + return; + } + + if (wptr->password == NULL) + { + wptr->password = (char *)malloc(tv->text->length + 1); + for (i=0; i < tv->text->length; i++) + { + wptr->password[i] = tv->text->ptr[i]; + } + wptr->password[tv->text->length] = '\0'; + } + /* + * else insert a char somewhere. + * Make a new buffer. Put everything from before the insert + * postion into it. Now insert the character. + * Finally append any remaining text. + */ + else + { + char *buf; + char *tptr; + char tchar; + int start; + + len = strlen(wptr->password); + if (tv->startPos < len) + { + start = tv->startPos; + } + else + { + start = len; + } + tptr = &(wptr->password[start]); + tchar = *tptr; + *tptr = '\0'; + buf = (char *)malloc(len + tv->text->length + 1); + strcpy(buf, wptr->password); + for (i=0; i < tv->text->length; i++) + { + buf[start + i] = tv->text->ptr[i]; + } + buf[start + tv->text->length] = '\0'; + *tptr = tchar; + strcat(buf, tptr); + free(wptr->password); + wptr->password = buf; + } + + tv->doit = True; + /* + * make a '*' show up instead of what they typed + */ + for (i=0; i < tv->text->length; i++) + { + tv->text->ptr[i] = '*'; + } + } +} +#endif /* MOTIF */ + + + +/* + * RETURN was hit in a textfield in a form. + * If this is the only textfield in this form, submit the form. + */ +void +CBActivateField(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + FormInfo *fptr = (FormInfo *)client_data; + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WidgetInfo *wptr; + int cnt, count; +#ifdef MOTIF + XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *)call_data; +#endif /* MOTIF */ + + /* + * Terminate the form if it was never properly terminated. + */ + if (fptr->end == -1) /* unterminated FORM tag */ + { + wptr = hw->html.widget_list; + cnt = 0; + while (wptr != NULL) + { + cnt++; + wptr = wptr->next; + } + count = cnt; + } + else + { + count = fptr->end - fptr->start; + } + + /* + * Locate the start of the form. + */ + if (fptr->start == 0) + { + wptr = hw->html.widget_list; + } + else + { + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->id == fptr->start) + { + wptr = wptr->next; + break; + } + wptr = wptr->next; + } + } + + /* + * Count the textfields in this form. + */ + cnt = 0; + while ((wptr != NULL)&&(cnt < count)) + { + if ((wptr->type == W_TEXTFIELD)||(wptr->type == W_PASSWORD)) + { + cnt++; + } + wptr = wptr->next; + } + + /* + * If this is the only textfield in this form, submit the form. + */ + if (cnt == 1) + { + CBSubmitForm(w, client_data, call_data); + } +} + + +void +CBResetForm(w, client_data, call_data) + Widget w; + caddr_t client_data; + caddr_t call_data; +{ + FormInfo *fptr = (FormInfo *)client_data; + HTMLWidget hw = (HTMLWidget)(fptr->hw); + WidgetInfo *wptr; + int widget_count, cnt; +#ifdef MOTIF + XmPushButtonCallbackStruct *pb = + (XmPushButtonCallbackStruct *)call_data; +#endif /* MOTIF */ + + if (fptr->end == -1) /* unterminated FORM tag */ + { + wptr = hw->html.widget_list; + cnt = 0; + while (wptr != NULL) + { + cnt++; + wptr = wptr->next; + } + widget_count = cnt; + } + else + { + widget_count = fptr->end - fptr->start; + } + + if (fptr->start == 0) + { + wptr = hw->html.widget_list; + } + else + { + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if (wptr->id == fptr->start) + { + wptr = wptr->next; + break; + } + wptr = wptr->next; + } + } + + cnt = 0; + while ((wptr != NULL)&&(cnt < widget_count)) + { + Widget child; + STRING label; +#ifdef MOTIF + Cardinal argcnt; + Arg arg[5]; +#else + char *txt = NULL; + int length = 0; + Boolean stringInPlace; +#endif /* MOTIF */ + + switch(wptr->type) + { + case W_TEXTFIELD: +#ifdef MOTIF + if (wptr->value == NULL) + { + XmTextFieldSetString(wptr->w, ""); + } + else + { + XmTextFieldSetString(wptr->w, wptr->value); + } +#else + XtVaGetValues(wptr->w, + XtNuseStringInPlace, &stringInPlace, + XtNlength, &length, + NULL); + if (stringInPlace) + { + XtVaGetValues(wptr->w, + XtNstring, &txt, + NULL); + } + if (wptr->value == NULL) + { + if (stringInPlace) + { + if (txt) *txt = '\0'; + XtVaSetValues(wptr->w, + XtNstring, txt, NULL); + } + else + { + XtVaSetValues(wptr->w, + XtNstring, "", NULL); + } + } + else + { + if (stringInPlace) + { + strncpy(txt,wptr->value,length); + XtVaSetValues(wptr->w, + XtNstring, txt, NULL); + } + else + { + XtVaSetValues(wptr->w, + XtNstring, wptr->value, + NULL); + } + } +#endif /* MOTIF */ + break; + case W_TEXTAREA: +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNworkWindow, &child); + argcnt++; + XtGetValues(wptr->w, arg, argcnt); + if (wptr->value == NULL) + { + XmTextSetString(child, ""); + } + else + { + XmTextSetString(child, wptr->value); + } +#else + XtVaSetValues(wptr->w, XtNstring, + wptr->value ? wptr->value : "", + NULL); +#endif /* MOTIF */ + break; + case W_PASSWORD: + if (wptr->value == NULL) + { +#ifdef MOTIF + /* + * Due to errors in Motif1.1, I can't + * call XmTextFieldSetString() here. + * Because I have a modifyVerify callback + * registered for this widget. + * I don't know if this error exists + * in Motif1.2 or not. + */ + argcnt = 0; + XtSetArg(arg[argcnt], XmNvalue, ""); + argcnt++; + XtSetValues(wptr->w, arg, argcnt); +#else + XtVaSetValues(wptr->w, + XtNstring, "", NULL); +#endif /* MOTIF */ + if (wptr->password != NULL) + { + free(wptr->password); + wptr->password = NULL; + } + } + else + { + int i, len; + + if (wptr->password != NULL) + { + free(wptr->password); + wptr->password = NULL; + } + len = strlen(wptr->value); + wptr->password = (char *)malloc(len + 1); + for (i=0; i<len; i++) + { + wptr->password[i] = '*'; + } + wptr->password[len] = '\0'; +#ifdef MOTIF + XmTextFieldSetString(wptr->w, + wptr->password); +#else + XtVaSetValues(wptr->w, + XtNstring, wptr->password, + NULL); +#endif /* MOTIF */ + strcpy(wptr->password, wptr->value); + } + break; + case W_LIST: + { + char **vlist; + int vlist_cnt; + STRING *val_list; + int i; + +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNworkWindow, &child); + argcnt++; + XtGetValues(wptr->w, arg, argcnt); +#else + WidgetList wl; + char **string_list; + int list_cnt; + + XtVaGetValues(wptr->w, XtNchildren, &wl, NULL); + child = *++wl; + XtVaGetValues(child, + XtNlist, &string_list, + XtNnumberStrings, &list_cnt, NULL); +#endif /* MOTIF */ + + if (wptr->value != NULL) + { + vlist = ParseCommaList(wptr->value, + &vlist_cnt); + val_list = (STRING *)malloc(vlist_cnt * + sizeof(STRING)); +#ifdef MOTIF + XmListDeselectAllItems(child); + for (i=0; i<vlist_cnt; i++) + { + val_list[i] = + XmStringCreateSimple(vlist[i]); + } +#else + XawListUnhighlight(child); + for (i=0; i<vlist_cnt; i++) + { + val_list[i] = + XtNewString(vlist[i]); + } +#endif /* MOTIF */ + FreeCommaList(vlist, vlist_cnt); +#ifdef MOTIF + if (vlist_cnt > 0) + { + argcnt = 0; + XtSetArg(arg[argcnt], XmNselectedItems, + val_list); + argcnt++; + XtSetArg(arg[argcnt], + XmNselectedItemCount, + vlist_cnt); + argcnt++; + XtSetValues(child, arg, argcnt); + } + for (i=0; i<vlist_cnt; i++) + { + XmStringFree(val_list[i]); + } +#else + if (vlist_cnt > 0) + { + if (vlist_cnt > 1) + { + fprintf(stderr, + "HTML: only a single selection allowed!\n"); + } + + for (i=0; i<list_cnt; i++) + { + if (!strcmp(string_list[i], + val_list[0])) + { + XawListHighlight(child, i); + break; + } + } + } + for (i=0; i<vlist_cnt; i++) + { + free(val_list[i]); + } +#endif /* MOTIF */ + if (val_list != NULL) + { + free((char *)val_list); + } + } + else + { +#ifdef MOTIF + XmListDeselectAllItems(child); +#else + XawListUnhighlight(child); +#endif /* MOTIF */ + } + } + break; + /* + * gack, we saved the widget id of the starting default + * into the value character pointer, just so we could + * yank it out here, and restore the default. + */ + case W_OPTIONMENU: + if (wptr->value != NULL) + { + Widget hist = (Widget)wptr->value; +#ifdef MOTIF + Cardinal argcnt; + Arg arg[5]; + + argcnt = 0; + XtSetArg(arg[argcnt], XmNmenuHistory, + hist); + argcnt++; + XtSetValues(wptr->w, arg, argcnt); +#else + char *txt; + + XtVaGetValues(hist, XtNlabel,&txt,NULL); + XtVaSetValues(wptr->w,XtNlabel,txt,NULL); +#endif /* MOTIF */ + } + break; + case W_CHECKBOX: + case W_RADIOBOX: +#ifdef MOTIF + if (wptr->checked == True) + { + XmToggleButtonSetState(wptr->w, True, False); + } + else + { + XmToggleButtonSetState(wptr->w, False, False); + } +#else + XtVaSetValues(wptr->w, + XtNstate, wptr->checked, NULL); +#endif /* MOTIF */ + break; + case W_HIDDEN: + break; +#ifdef MOTIF + case W_JOT: + argcnt = 0; + XtSetArg(arg[argcnt], XmNuserData, + (XtPointer *)&child); + argcnt++; + XtGetValues(wptr->w, arg, argcnt); + ClearJot(hw, child, wptr->width, wptr->height); + break; +#endif /* MOTIF */ + default: + break; + } + cnt++; + wptr = wptr->next; + } +} + + +void +PrepareFormEnd(hw, w, fptr) + HTMLWidget hw; + Widget w; + FormInfo *fptr; +{ +#ifdef MOTIF + XtAddCallback(w, XmNactivateCallback, + (XtCallbackProc)CBSubmitForm, (caddr_t)fptr); +#else + XtAddCallback(w, XtNcallback, + (XtCallbackProc)CBSubmitForm, (caddr_t)fptr); +#endif /* MOTIF */ +} + + +void +PrepareFormReset(hw, w, fptr) + HTMLWidget hw; + Widget w; + FormInfo *fptr; +{ +#ifdef MOTIF + XtAddCallback(w, XmNactivateCallback, + (XtCallbackProc)CBResetForm, (caddr_t)fptr); +#else + XtAddCallback(w, XtNcallback, + (XtCallbackProc)CBResetForm, (caddr_t)fptr); +#endif /* MOTIF */ +} + + +void +HideWidgets(hw) + HTMLWidget hw; +{ + WidgetInfo *wptr; + XEvent event; + +#ifdef MOTIF + /* + * Make sure all expose events have been dealt with first. + */ + XmUpdateDisplay((Widget)hw); +#endif /* MOTIF */ + + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if ((wptr->w != NULL)&&(wptr->mapped == True)) + { + XtSetMappedWhenManaged(wptr->w, False); + wptr->mapped = False; + } + wptr = wptr->next; + } + + /* + * Force the exposure events into the queue + */ + XSync(XtDisplay(hw), False); + + /* + * Remove all Expose events for the view window + */ + while (XCheckWindowEvent(XtDisplay(hw->html.view), + XtWindow(hw->html.view), ExposureMask, &event) == True) + { + } +} + + +void +MapWidgets(hw) + HTMLWidget hw; +{ + WidgetInfo *wptr; + + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if ((wptr->w != NULL)&&(wptr->mapped == False)) + { + wptr->mapped = True; + XtSetMappedWhenManaged(wptr->w, True); + } + wptr = wptr->next; + } +} + + +Boolean +AlreadyChecked(hw, fptr, name) + HTMLWidget hw; + FormInfo *fptr; + char *name; +{ + WidgetInfo *wptr; + Boolean radio_checked; + + radio_checked = False; + wptr = hw->html.widget_list; + while (wptr != NULL) + { + if ((wptr->id >= fptr->start)&& + (wptr->type == W_RADIOBOX)&& + (wptr->checked == True)&& + (wptr->name != NULL)&& + (name != NULL)&& + (strcmp(wptr->name, name) == 0)) + { + radio_checked = True; + break; + } + wptr = wptr->next; + } + return(radio_checked); +} + + +WidgetInfo * +AddNewWidget(hw, fptr, w, type, id, x, y, width, height, name, value, mapping, checked) + HTMLWidget hw; + FormInfo *fptr; + Widget w; + int type; + int id; + int x, y; + int width, height; + char *name; + char *value; + char **mapping; + Boolean checked; +{ + WidgetInfo *wptr; + + wptr = hw->html.widget_list; + if (wptr == NULL) + { + wptr = (WidgetInfo *)malloc(sizeof(WidgetInfo)); + wptr->w = w; + wptr->type = type; + wptr->id = id; + wptr->x = x; + wptr->y = y; + wptr->width = width; + wptr->height = height; + wptr->name = name; + wptr->value = value; + wptr->password = NULL; + wptr->mapping = mapping; + wptr->checked = checked; + wptr->mapped = False; + wptr->next = NULL; + hw->html.widget_list = wptr; + } + else + { + while (wptr->next != NULL) + { + wptr = wptr->next; + } + wptr->next = (WidgetInfo *)malloc(sizeof(WidgetInfo)); + wptr = wptr->next; + wptr->w = w; + wptr->type = type; + wptr->id = id; + wptr->x = x; + wptr->y = y; + wptr->width = width; + wptr->height = height; + wptr->name = name; + wptr->value = value; + wptr->password = NULL; + wptr->mapping = mapping; + wptr->checked = checked; + wptr->mapped = False; + wptr->next = NULL; + } + + if ((wptr->type == W_PASSWORD)&&(wptr->value != NULL)) + { + wptr->password = (char *)malloc(strlen(wptr->value) + 1); + strcpy(wptr->password, wptr->value); + } + + return(wptr); +} + + +/* + * For the various widgets, return their fon structures so + * we can use the font's baseline to place them. + */ +XFontStruct * +GetWidgetFont(hw, wptr) + HTMLWidget hw; + WidgetInfo *wptr; +{ + Widget child; + XFontStruct *font; +#ifdef MOTIF + Boolean ret; + Cardinal argcnt; + Arg arg[5]; + XmFontList font_list = (XmFontList)NULL; + XmFontContext font_context; + XmStringCharSet charset; +#endif /* MOTIF */ + + /* + * For option menus we have to first get the child that has the + * font info. + */ + if (wptr->type == W_OPTIONMENU) + { +#ifdef MOTIF + child = XmOptionButtonGadget(wptr->w); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNfontList, &font_list); argcnt++; + XtGetValues(child, arg, argcnt); +#else + XtVaGetValues(wptr->w, XtNfont, &font, NULL); +#endif /* MOTIF */ + } + else + { +#ifdef MOTIF + if ((wptr->type == W_TEXTAREA)||(wptr->type == W_LIST)) + { + child = NULL; + argcnt = 0; + XtSetArg(arg[argcnt], XmNworkWindow, &child); argcnt++; + XtGetValues(wptr->w, arg, argcnt); + argcnt = 0; + XtSetArg(arg[argcnt], XmNfontList,&font_list); argcnt++; + XtGetValues(child, arg, argcnt); + } +#else + if (wptr->type == W_LIST) + { + WidgetList wl; + int nc; + XtVaGetValues(wptr->w, + XtNchildren, &wl, XtNnumChildren, &nc, NULL); + child = *++wl; + XtVaGetValues(child, XtNfont, &font, NULL); + } +#endif /* MOTIF */ + else + { +#ifdef MOTIF + argcnt = 0; + XtSetArg(arg[argcnt], XmNfontList,&font_list); argcnt++; + XtGetValues(wptr->w, arg, argcnt); +#else + XtVaGetValues(wptr->w, XtNfont, &font, NULL); +#endif /* MOTIF */ + } + } + +#ifdef MOTIF + if (font_list == (XmFontList)NULL) + { + return((XFontStruct *)NULL); + } + + ret = XmFontListInitFontContext(&font_context, font_list); + if (ret == False) + { + return((XFontStruct *)NULL); + } + + ret = XmFontListGetNextFont(font_context, &charset, &font); + if (ret == False) + { + return((XFontStruct *)NULL); + } + else + { + XmFontListFreeFontContext(font_context); + free((char *)charset); + return(font); + } +#else + return(font); +#endif /* MOTIF */ +} + + +/* + * Get the next value in a comma separated list. + * Also unescape the '\' escaping done in ComposeCommaList + * and convert the single ''' characters back to '"' + * characters + */ +char * +NextComma(string) + char *string; +{ + char *tptr; + + tptr = string; + while (*tptr != '\0') + { + if (*tptr == '\\') + { + *tptr = '\0'; + strcat(string, (char *)(tptr + 1)); + tptr++; + } + else if (*tptr == '\'') + { + *tptr = '\"'; + tptr++; + } + else if (*tptr == ',') + { + return(tptr); + } + else + { + tptr++; + } + } + return(tptr); +} + + +char ** +ParseCommaList(str, count) + char *str; + int *count; +{ + char *str_copy; + char **list; + char **tlist; + char *tptr; + char *val; + int i, cnt; + int max_cnt; + + *count = 0; + if ((str == NULL)||(*str == '\0')) + { + return((char **)NULL); + } + str_copy = (char *)malloc(strlen(str) + 1); + if (str_copy == NULL) + { + return((char **)NULL); + } + strcpy(str_copy, str); + + list = (char **)malloc(50 * sizeof(char *)); + if (list == NULL) + { + return((char **)NULL); + } + max_cnt = 50; + + /* + * This loop counts the number of objects + * in this list. + * As a side effect, NextComma() unescapes in place so + * "\\" becomes '\' and "\," becomes ',' and "\"" becomes '"' + */ + cnt = 0; + val = str_copy; + tptr = NextComma(val); + while (*tptr != '\0') + { + if ((cnt + 1) == max_cnt) + { + tlist = (char **)malloc((max_cnt +50) * sizeof(char *)); + if (tlist == NULL) + { + return((char **)NULL); + } + for (i=0; i<cnt; i++) + { + tlist[i] = list[i]; + } + free((char *)list); + list = tlist; + max_cnt += 50; + } + *tptr = '\0'; + list[cnt] = (char *)malloc(strlen(val) + 1); + if (list[cnt] == NULL) + { + return((char **)NULL); + } + strcpy(list[cnt], val); + cnt++; + + val = (char *)(tptr + 1); + tptr = NextComma(val); + } + list[cnt] = (char *)malloc(strlen(val) + 1); + if (list[cnt] == NULL) + { + return((char **)NULL); + } + strcpy(list[cnt], val); + cnt++; + + free(str_copy); + tlist = (char **)malloc(cnt * sizeof(char *)); + if (tlist == NULL) + { + return((char **)NULL); + } + for (i=0; i<cnt; i++) + { + tlist[i] = list[i]; + } + free((char *)list); + list = tlist; + + *count = cnt; + return(list); +} + + +/* + * Compose a single string comma separated list from + * an array of strings. Any '\', or ',' in the + * list are escaped with a prepending '\'. + * So they become '\\' and '\,' + * Also we want to allow '"' characters in the list, but + * they would get eaten by the later parsing code, so we will + * turn '"' into ''', and turn ''' into '\'' + */ +char * +ComposeCommaList(list, cnt) + char **list; + int cnt; +{ + int i; + char *fail; + char *buf; + char *tbuf; + int len, max_len; + + fail = (char *)malloc(1); + *fail = '\0'; + + if (cnt == 0) + { + return(fail); + } + + buf = (char *)malloc(1024); + if (buf == NULL) + { + return(fail); + } + max_len = 1024; + len = 0; + buf[0] = '\0'; + + for (i=0; i<cnt; i++) + { + char *option; + char *tptr; + int olen; + + option = list[i]; + if (option == NULL) + { + olen = 0; + } + else + { + olen = strlen(option); + } + if ((len + (olen * 2)) >= max_len) + { + tbuf = (char *)malloc(max_len + olen + 1024); + if (tbuf == NULL) + { + return(fail); + } + strcpy(tbuf, buf); + free(buf); + buf = tbuf; + max_len = max_len + olen + 1024; + } + tptr = (char *)(buf + len); + while ((option != NULL)&&(*option != '\0')) + { + if ((*option == '\\')||(*option == ',')|| + (*option == '\'')) + { + *tptr++ = '\\'; + *tptr++ = *option++; + len += 2; + } + else if (*option == '\"') + { + *tptr++ = '\''; + option++; + len++; + } + else + { + *tptr++ = *option++; + len++; + } + } + if (i != (cnt - 1)) + { + *tptr++ = ','; + len++; + } + *tptr = '\0'; + } + + tbuf = (char *)malloc(len + 1); + if (tbuf == NULL) + { + return(fail); + } + strcpy(tbuf, buf); + free(buf); + buf = tbuf; + free(fail); + return(buf); +} + + +void +FreeCommaList(list, cnt) + char **list; + int cnt; +{ + int i; + + for (i=0; i<cnt; i++) + { + if (list[i] != NULL) + { + free(list[i]); + } + } + if (list != NULL) + { + free((char *)list); + } +} + + +/* + * Clean up the mucked value field for a TEXTAREA. + * Unescape the things with '\' in front of them, and transform + * lone ' back to " + */ +void +UnMuckTextAreaValue(value) + char *value; +{ + char *tptr; + + if ((value == NULL)||(value[0] == '\0')) + { + return; + } + + tptr = value; + while (*tptr != '\0') + { + if (*tptr == '\\') + { + *tptr = '\0'; + strcat(value, (char *)(tptr + 1)); + tptr++; + } + else if (*tptr == '\'') + { + *tptr = '\"'; + tptr++; + } + else + { + tptr++; + } + } +} + + +char * +MapOptionReturn(val, mapping) + char *val; + char **mapping; +{ + int cnt; + + if (mapping == NULL) + { + return(val); + } + + cnt = 0; + while (mapping[cnt] != NULL) + { + if (strcmp(mapping[cnt], val) == 0) + { + return(mapping[cnt + 1]); + } + cnt += 2; + } + return(val); +} + + +char ** +MakeOptionMappings(list1, list2, list_cnt) + char **list1; + char **list2; + int list_cnt; +{ + int i, cnt; + char **list; + + /* + * pass through to see how many mappings we have. + */ + cnt = 0; + for (i=0; i<list_cnt; i++) + { + if ((list2[i] != NULL)&&(*list2[i] != '\0')) + { + cnt++; + } + } + + if (cnt == 0) + { + return(NULL); + } + + list = (char **)malloc(((2 * cnt) + 1) * sizeof(char *)); + if (list == NULL) + { + return(NULL); + } + + cnt = 0; + for (i=0; i<list_cnt; i++) + { + if ((list2[i] != NULL)&&(*list2[i] != '\0')) + { + list[cnt] = (char *)malloc(strlen(list1[i]) + 1); + list[cnt + 1] = (char *)malloc(strlen(list2[i]) + 1); + if ((list[cnt] == NULL)||(list[cnt + 1] == NULL)) + { + return(NULL); + } + strcpy(list[cnt], list1[i]); + strcpy(list[cnt + 1], list2[i]); + cnt += 2; + } + } + list[cnt] = NULL; + + return(list); +} + + +#ifdef MOTIF +/********** MOTIF VERSION *************/ +/* + * Make the appropriate widget for this tag, and fill in an + * WidgetInfo structure and return it. + */ +WidgetInfo * +MakeWidget(hw, text, x, y, id, fptr) + HTMLWidget hw; + char *text; + int x, y; + int id; + FormInfo *fptr; +{ + Arg arg[30]; + Cardinal argcnt; + Widget w; + WidgetInfo *wlist; + WidgetInfo *wptr; + Dimension width, height; + + wlist = hw->html.widget_list; + while (wlist != NULL) + { + if (wlist->id == id) + { + break; + } + wlist = wlist->next; + } + + /* + * If this widget is not on the list, we have never + * used it before. Create it now. + */ + if (wlist == NULL) + { + char widget_name[100]; + char **mapping; + char *tptr; + char *value; + char *name; + char *type_str; + int type; + short size; + int maxlength; + Boolean checked; + + mapping = NULL; + + checked = False; + name = ParseMarkTag(text, MT_INPUT, "NAME"); + + /* + * We may need to shorten the name for the widgets, + * which can't handle long names. + */ + if (name == NULL) + { + widget_name[0] = '\0'; + } + else if (strlen(name) > 99) + { + strncpy(widget_name, name, 99); + widget_name[99] = '\0'; + } + else + { + strcpy(widget_name, name); + } + + type_str = ParseMarkTag(text, MT_INPUT, "TYPE"); + if ((type_str != NULL)&&(strcmp(type_str, "checkbox") == 0)) + { + XmString label; + + type = W_CHECKBOX; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if (value == NULL) + { + value = (char *)malloc(strlen("on") + 1); + strcpy(value, "on"); + } + + tptr = ParseMarkTag(text, MT_INPUT, "CHECKED"); + + /* We want no text on our toggles */ + label = XmStringCreateSimple(""); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNlabelString, label); argcnt++; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + if (tptr != NULL) + { + XtSetArg(arg[argcnt], XmNset, True); argcnt++; + checked = True; + free(tptr); + } + w = XmCreateToggleButton(hw->html.view, widget_name, + arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + + XmStringFree(label); + } + else if ((type_str != NULL)&&(strcmp(type_str, "hidden") == 0)) + { + type = W_HIDDEN; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if (value == NULL) + { + value = (char *)malloc(1); + value[0] = '\0'; + } + + w = NULL; + } + else if ((type_str != NULL)&&(strcmp(type_str, "radio") == 0)) + { + XmString label; + + type = W_RADIOBOX; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if (value == NULL) + { + value = (char *)malloc(strlen("on") + 1); + strcpy(value, "on"); + } + + /* + * Only one checked radio button with the + * same name per form + */ + tptr = ParseMarkTag(text, MT_INPUT, "CHECKED"); + if ((tptr != NULL)&& + (AlreadyChecked(hw, fptr, name) == True)) + { + free(tptr); + tptr = NULL; + } + + /* We want no text on our toggles */ + label = XmStringCreateSimple(""); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNlabelString, label); argcnt++; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + XtSetArg(arg[argcnt], XmNindicatorType, XmONE_OF_MANY); + argcnt++; + if (tptr != NULL) + { + XtSetArg(arg[argcnt], XmNset, True); argcnt++; + checked = True; + free(tptr); + } + w = XmCreateToggleButton(hw->html.view, widget_name, + arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + XtAddCallback(w, XmNvalueChangedCallback, + (XtCallbackProc)CBChangeRadio, (caddr_t)fptr); + + XmStringFree(label); + } + else if ((type_str != NULL)&&(strcmp(type_str, "submit") == 0)) + { + XmString label; + + type = W_PUSHBUTTON; + label = NULL; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if ((value == NULL)||(*value == '\0')) + { + value = (char *)malloc(strlen("Submit Query") + + 1); + strcpy(value, "Submit Query"); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + if (value != NULL) + { + label = XmStringCreateSimple(value); + XtSetArg(arg[argcnt], XmNlabelString, label); + argcnt++; + } + w = XmCreatePushButton(hw->html.view, widget_name, + arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + if (label != NULL) + { + XmStringFree(label); + } + PrepareFormEnd(hw, w, fptr); + } + else if ((type_str != NULL)&&(strcmp(type_str, "reset") == 0)) + { + XmString label; + + type = W_PUSHBUTTON; + label = NULL; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if ((value == NULL)||(*value == '\0')) + { + value = (char *)malloc(strlen("Reset") + 1); + strcpy(value, "Reset"); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + if (value != NULL) + { + label = XmStringCreateSimple(value); + XtSetArg(arg[argcnt], XmNlabelString, label); + argcnt++; + } + w = XmCreatePushButton(hw->html.view, widget_name, + arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + if (label != NULL) + { + XmStringFree(label); + } + PrepareFormReset(hw, w, fptr); + } + else if ((type_str != NULL)&&(strcmp(type_str, "button") == 0)) + { + XmString label; + + type = W_PUSHBUTTON; + label = NULL; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + if (value != NULL) + { + label = XmStringCreateSimple(value); + XtSetArg(arg[argcnt], XmNlabelString, label); + argcnt++; + } + w = XmCreatePushButton(hw->html.view, widget_name, + arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + if (label != NULL) + { + XmStringFree(label); + } + } + else if ((type_str != NULL)&&(strcmp(type_str, "jot") == 0)) + { + XmString label; + Dimension width, height; + Widget frame; + char **list; + int list_cnt; + + type = W_JOT; + label = NULL; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + /* + * SIZE is WIDTH,HEIGHT + */ + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + list = ParseCommaList(tptr, &list_cnt); + if (tptr != NULL) + { + free(tptr); + } + + width = 200; + height = 50; + if (list_cnt == 1) + { + width = atoi(list[0]); + } + else if (list_cnt > 1) + { + width = atoi(list[0]); + height = atoi(list[1]); + } + FreeCommaList(list, list_cnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + XtSetArg(arg[argcnt], XmNshadowType, XmSHADOW_IN); + argcnt++; + frame = XmCreateFrame(hw->html.view, "Frame", + arg, argcnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNwidth, width); argcnt++; + XtSetArg(arg[argcnt], XmNheight, height); argcnt++; + w = XmCreateDrawingArea(frame, widget_name, + arg, argcnt); + XtManageChild(w); + + NewJot(w, width, height); + XtAddEventHandler(w, ExposureMask, 0, + EVJotExpose, (XtPointer)hw); + XtAddEventHandler(w, ButtonPressMask, 0, + EVJotPress, (XtPointer)hw); + XtAddEventHandler(w, ButtonMotionMask, 0, + EVJotMove, (XtPointer)hw); + XtAddEventHandler(w, ButtonReleaseMask, 0, + EVJotRelease, (XtPointer)hw); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNuserData, (XtPointer)w); + argcnt++; + XtSetValues(frame, arg, argcnt); + + w = frame; + + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + if (label != NULL) + { + XmStringFree(label); + } + } + else if ((type_str != NULL)&&(strcmp(type_str, "select") == 0)) + { + XmString label; + Widget scroll; + Widget pulldown, button, hist; + char *options; + char *returns; + char **list; + int list_cnt; + char **ret_list; + int return_cnt; + char **vlist; + int vlist_cnt; + int i, mult, size; + + type = -1; + tptr = ParseMarkTag(text, MT_INPUT, "HINT"); + if ((tptr != NULL)&&(strcmp(tptr, "list") == 0)) + { + type = W_LIST; + } + else if ((tptr != NULL)&&(strcmp(tptr, "menu") == 0)) + { + type = W_OPTIONMENU; + } + if (tptr != NULL) + { + free(tptr); + } + + size = 5; + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + if (tptr != NULL) + { + size = atoi(tptr); + if ((size > 1)&&(type == -1)) + { + type = W_LIST; + } + free(tptr); + } + + mult = 0; + tptr = ParseMarkTag(text, MT_INPUT, "MULTIPLE"); + if (tptr != NULL) + { + if (type == -1) + { + type = W_LIST; + } + mult = 1; + free(tptr); + } + + if (type == -1) + { + type = W_OPTIONMENU; + } + + label = NULL; + hist = NULL; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + options = ParseMarkTag(text, MT_INPUT, "OPTIONS"); + returns = ParseMarkTag(text, MT_INPUT, "RETURNS"); + list = ParseCommaList(options, &list_cnt); + if (options != NULL) + { + free(options); + } + + ret_list = ParseCommaList(returns, &return_cnt); + if (returns != NULL) + { + free(returns); + } + + /* + * If return_cnt is less than list_cnt, the user made + * a serious error. Try to recover by padding out + * ret_list with NULLs + */ + if (list_cnt > return_cnt) + { + int rcnt; + char **rlist; + + rlist = (char **)malloc(list_cnt * + sizeof(char *)); + for (rcnt = 0; rcnt < return_cnt; rcnt++) + { + rlist[rcnt] = ret_list[rcnt]; + } + for (rcnt = return_cnt; rcnt < list_cnt; rcnt++) + { + rlist[rcnt] = NULL; + } + if (ret_list != NULL) + { + free((char *)ret_list); + } + ret_list = rlist; + } + + vlist = ParseCommaList(value, &vlist_cnt); + + if (size > list_cnt) + { + size = list_cnt; + } + if (size < 1) + { + size = 1; + } + + mapping = MakeOptionMappings(list, ret_list, list_cnt); + + if (type == W_OPTIONMENU) + { + Widget child; + XmString xmstr; + argcnt = 0; + pulldown = XmCreatePulldownMenu(hw->html.view, + widget_name, arg, argcnt); + + for (i=0; i<list_cnt; i++) + { + char bname[30]; + + sprintf(bname, "Button%d", (i + 1)); + label = XmStringCreateSimple(list[i]); + argcnt = 0; + XtSetArg(arg[argcnt], XmNlabelString, + label); + argcnt++; + button = XmCreatePushButton(pulldown, + bname, arg, argcnt); + XtManageChild(button); + XmStringFree(label); + + if ((vlist_cnt > 0)&& + (vlist[0] != NULL)&& + (strcmp(vlist[0], list[i]) ==0)) + { + hist = button; + } + + /* + * Start hist out as the first button + * so that if the user didn't set a + * default we always default to the + * first element. + */ + if ((i == 0)&&(hist == NULL)) + { + hist = button; + } + } + + FreeCommaList(list, list_cnt); + FreeCommaList(ret_list, list_cnt); + FreeCommaList(vlist, vlist_cnt); + if (value != NULL) + { + free(value); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + XtSetArg(arg[argcnt], XmNsubMenuId, pulldown); + argcnt++; + if (hist != NULL) + { + XtSetArg(arg[argcnt], XmNmenuHistory, + hist); + argcnt++; + /* + * A gaggage. Value is used to later + * restore defaults. For option menu + * this means we need to save a child + * widget id as opposed to the + * character string everyone else uses. + */ + value = (char *)hist; + } + w = XmCreateOptionMenu(hw->html.view, + widget_name, arg, argcnt); + argcnt = 0; + xmstr = XmStringCreateSimple (""); + XtSetArg(arg[argcnt], XmNlabelString, + (XtArgVal)xmstr); + argcnt++; + child = XmOptionLabelGadget (w); + XtSetValues (child, arg, argcnt); + XmStringFree (xmstr); + } + else /* type == W_LIST */ + { + XmString *string_list; + XmString *val_list; + + if ((!mult)&&(vlist_cnt > 1)) + { + free(value); + value = (char *)malloc( + strlen(vlist[0]) + 1); + strcpy(value, vlist[0]); + } + + string_list = (XmString *)malloc(list_cnt * + sizeof(XmString)); + val_list = (XmString *)malloc(vlist_cnt * + sizeof(XmString)); + + for (i=0; i<list_cnt; i++) + { + string_list[i] = + XmStringCreateSimple(list[i]); + } + for (i=0; i<vlist_cnt; i++) + { + val_list[i] = + XmStringCreateSimple(vlist[i]); + } + + FreeCommaList(list, list_cnt); + FreeCommaList(ret_list, list_cnt); + FreeCommaList(vlist, vlist_cnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + scroll = XmCreateScrolledWindow(hw->html.view, + "Scroll", arg, argcnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNitems, string_list); + argcnt++; + XtSetArg(arg[argcnt], XmNitemCount, list_cnt); + argcnt++; + XtSetArg(arg[argcnt], XmNvisibleItemCount,size); + argcnt++; + if (mult) + { + XtSetArg(arg[argcnt],XmNselectionPolicy, + XmEXTENDED_SELECT); + argcnt++; + } + else + { + XtSetArg(arg[argcnt],XmNselectionPolicy, + XmBROWSE_SELECT); + argcnt++; + } + if ((vlist_cnt > 0)&&(mult)) + { + XtSetArg(arg[argcnt], XmNselectedItems, + val_list); + argcnt++; + XtSetArg(arg[argcnt], + XmNselectedItemCount, + vlist_cnt); + argcnt++; + } + else if ((vlist_cnt > 0)&&(!mult)) + { + XtSetArg(arg[argcnt], XmNselectedItems, + &val_list[0]); + argcnt++; + XtSetArg(arg[argcnt], + XmNselectedItemCount, 1); + argcnt++; + } + w = XmCreateList(scroll, widget_name, + arg, argcnt); + XtManageChild(w); + w = scroll; + + for (i=0; i<list_cnt; i++) + { + XmStringFree(string_list[i]); + } + if (string_list != NULL) + { + free((char *)string_list); + } + for (i=0; i<vlist_cnt; i++) + { + XmStringFree(val_list[i]); + } + if (val_list != NULL) + { + free((char *)val_list); + } + } + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else if ((type_str != NULL)&&(strcmp(type_str, "password") ==0)) + { + type = W_PASSWORD; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + size = -1; + maxlength = -1; + + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + if (tptr != NULL) + { + size = atoi(tptr); + free(tptr); + } + + tptr = ParseMarkTag(text, MT_INPUT, "MAXLENGTH"); + if (tptr != NULL) + { + maxlength = atoi(tptr); + free(tptr); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + if (size > 0) + { + XtSetArg(arg[argcnt], XmNcolumns, size); + argcnt++; + } + if (maxlength > 0) + { + XtSetArg(arg[argcnt], XmNmaxLength, maxlength); + argcnt++; + } + if (value != NULL) + { + int i, len; + char *bval; + + len = strlen(value); + bval = (char *)malloc(len + 1); + for (i=0; i<len; i++) + { + bval[i] = '*'; + } + bval[len] = '\0'; + XtSetArg(arg[argcnt], XmNvalue, bval); + argcnt++; + } + w = XmCreateTextField(hw->html.view, widget_name, + arg, argcnt); +/* + * The proper order here is XtSetMappedWhenManaged, XtManageChild. But a bug + * in some versions of Motif1.1 makes us do it the other way. All versions + * of 1.2 should have this fixed + */ +#ifdef MOTIF1_2 + XtSetMappedWhenManaged(w, False); + XtManageChild(w); +#else + XtManageChild(w); + XtSetMappedWhenManaged(w, False); +#endif /* MOTIF1_2 */ + XtAddCallback(w, XmNactivateCallback, + (XtCallbackProc)CBActivateField, (caddr_t)fptr); + XtAddCallback(w, XmNmodifyVerifyCallback, + (XtCallbackProc)CBPasswordModify, (caddr_t)fptr); + } + else if ((type_str != NULL)&&(strcmp(type_str, "textarea") ==0)) + { + char **list; + int list_cnt; + int rows, cols; + Widget scroll; + + type = W_TEXTAREA; + + /* + * If there is no SIZE, look for ROWS and COLS + * directly. + * SIZE is COLUMNS,ROWS parse the list + */ + rows = -1; + cols = -1; + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + if (tptr == NULL) + { + tptr = ParseMarkTag(text, MT_INPUT, "ROWS"); + if (tptr != NULL) + { + rows = atoi(tptr); + free(tptr); + } + tptr = ParseMarkTag(text, MT_INPUT, "COLS"); + if (tptr != NULL) + { + cols = atoi(tptr); + free(tptr); + } + } + else + { + list = ParseCommaList(tptr, &list_cnt); + free(tptr); + + if (list_cnt == 1) + { + cols = atoi(list[0]); + } + else if (list_cnt > 1) + { + cols = atoi(list[0]); + rows = atoi(list[1]); + } + FreeCommaList(list, list_cnt); + } + + /* + * Grab the starting value of the text here. + * NULL if none. + */ + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + UnMuckTextAreaValue(value); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + scroll = XmCreateScrolledWindow(hw->html.view, + "Scroll", arg, argcnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNeditMode, XmMULTI_LINE_EDIT); + argcnt++; + if (cols > 0) + { + XtSetArg(arg[argcnt], XmNcolumns, cols); + argcnt++; + } + if (rows > 0) + { + XtSetArg(arg[argcnt], XmNrows, rows); + argcnt++; + } + if (value != NULL) + { + XtSetArg(arg[argcnt], XmNvalue, value); + argcnt++; + } + w = XmCreateText(scroll, widget_name, arg, argcnt); + XtManageChild(w); + w = scroll; + + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else /* if no type, assume type=text */ + { + char **list; + int list_cnt; + int rows, cols; + Widget scroll; + + /* + * SIZE can be either COLUMNS or COLUMNS,ROWS + * we assume COLUMNS,ROWS and parse the list + */ + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + list = ParseCommaList(tptr, &list_cnt); + if (tptr != NULL) + { + free(tptr); + } + + /* + * If only COLUMNS specified, or SIZE not specified + * assume a TEXTFIELD + * Otherwise a TEXTAREA. + */ + if (list_cnt <= 1) + { + type = W_TEXTFIELD; + if (list_cnt == 1) + { + cols = atoi(list[0]); + } + else + { + cols = -1; + } + } + else + { + type = W_TEXTAREA; + cols = atoi(list[0]); + rows = atoi(list[1]); + } + /* + * Now that we have cols, and maybe rows, free the list + */ + FreeCommaList(list, list_cnt); + + /* + * Grab the starting value of the text here. + * NULL if none. + */ + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + /* + * For textfileds parse maxlength and + * set up the widget. + */ + if (type == W_TEXTFIELD) + { + maxlength = -1; + tptr = ParseMarkTag(text, MT_INPUT,"MAXLENGTH"); + if (tptr != NULL) + { + maxlength = atoi(tptr); + free(tptr); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + if (cols > 0) + { + XtSetArg(arg[argcnt], XmNcolumns, cols); + argcnt++; + } + if (maxlength > 0) + { + XtSetArg(arg[argcnt], XmNmaxLength, + maxlength); + argcnt++; + } + if (value != NULL) + { + XtSetArg(arg[argcnt], XmNvalue, value); + argcnt++; + } + w = XmCreateTextField(hw->html.view, + widget_name, arg, argcnt); + } + /* + * Else this is a TEXTAREA. Maxlength is ignored, + * and we set up the scrolled window + */ + else + { + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + scroll = XmCreateScrolledWindow(hw->html.view, + "Scroll", arg, argcnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XmNeditMode, + XmMULTI_LINE_EDIT); + argcnt++; + if (cols > 0) + { + XtSetArg(arg[argcnt], XmNcolumns, cols); + argcnt++; + } + if (rows > 0) + { + XtSetArg(arg[argcnt], XmNrows, rows); + argcnt++; + } + if (value != NULL) + { + XtSetArg(arg[argcnt], XmNvalue, value); + argcnt++; + } + w = XmCreateText(scroll, widget_name, + arg, argcnt); + XtManageChild(w); + w = scroll; + } + +/* + * The proper order here is XtSetMappedWhenManaged, XtManageChild. But a bug + * in some versions of Motif1.1 makes us do it the other way. All versions + * of 1.2 should have this fixed + */ +#ifdef MOTIF1_2 + XtSetMappedWhenManaged(w, False); + XtManageChild(w); +#else + XtManageChild(w); + XtSetMappedWhenManaged(w, False); +#endif /* MOTIF1_2 */ + + /* + * For textfields, a CR might be an activate + */ + if (type == W_TEXTFIELD) + { + XtAddCallback(w, XmNactivateCallback, + (XtCallbackProc)CBActivateField, (caddr_t)fptr); + } + } + if (type_str != NULL) + { + free(type_str); + } + + /* + * Don't want to do GetValues if this is HIDDEN input + * tag with no widget. + */ + if (w != NULL) + { + argcnt = 0; + XtSetArg(arg[argcnt], XmNwidth, &width); argcnt++; + XtSetArg(arg[argcnt], XmNheight, &height); argcnt++; + XtGetValues(w, arg, argcnt); + } + else + { + width = 0; + height = 0; + } + + wptr = AddNewWidget(hw, fptr, w, type, id, x, y, width, height, + name, value, mapping, checked); + } + else + /* + * We found this widget on the list of already created widgets. + * Put it in place for reuse. + */ + { + wlist->x = x; + wlist->y = y; + + /* + * Don't want to SetValues if type HIDDEN which + * has no widget. + */ + if (wlist->w != NULL) + { + argcnt = 0; + XtSetArg(arg[argcnt], XmNx, x); argcnt++; + XtSetArg(arg[argcnt], XmNy, y); argcnt++; + XtSetValues(wlist->w, arg, argcnt); + } + + wptr = wlist; + } + + return(wptr); +} +#else +/********** ATHENA VERSION *************/ +/* + * Make the appropriate widget for this tag, and fill in an + * WidgetInfo structure and return it. + */ +WidgetInfo * +MakeWidget(hw, text, x, y, id, fptr) + HTMLWidget hw; + char *text; + int x, y; + int id; + FormInfo *fptr; +{ + Arg arg[30]; + Cardinal argcnt; + Widget w; + WidgetInfo *wlist; + WidgetInfo *wptr; + Dimension width, height; + + wlist = hw->html.widget_list; + while (wlist != NULL) + { + if (wlist->id == id) + { + break; + } + wlist = wlist->next; + } + + /* + * If this widget is not on the list, we have never + * used it before. Create it now. + */ + if (wlist == NULL) + { + char *tptr; + char *value; + char *name; + char *type_str; + int type; + short size; + int maxlength; + Boolean checked; + + checked = False; + name = ParseMarkTag(text, MT_INPUT, "NAME"); + + type_str = ParseMarkTag(text, MT_INPUT, "TYPE"); + if ((type_str != NULL)&&(strcmp(type_str, "checkbox") == 0)) + { + type = W_CHECKBOX; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if (value == NULL) + { + value = (char *)malloc(strlen("on") + 1); + strcpy(value, "on"); + } + + tptr = ParseMarkTag(text, MT_INPUT, "CHECKED"); + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + if (tptr != NULL) + { + XtSetArg(arg[argcnt], XtNstate, True); argcnt++; + checked = True; + free(tptr); + } + XtSetArg(arg[argcnt], XtNlabel, ""); argcnt++; + w = XtCreateWidget(name, toggleWidgetClass, + hw->html.view, arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else if ((type_str != NULL)&&(strcmp(type_str, "hidden") == 0)) + { + type = W_HIDDEN; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if (value == NULL) + { + value = (char *)malloc(1); + value[0] = '\0'; + } + + w = NULL; + } + else if ((type_str != NULL)&&(strcmp(type_str, "radio") == 0)) + { + type = W_RADIOBOX; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if (value == NULL) + { + value = (char *)malloc(strlen("on") + 1); + strcpy(value, "on"); + } + + /* + * Only one checked radio button with the + * same name per form + */ + tptr = ParseMarkTag(text, MT_INPUT, "CHECKED"); + if ((tptr != NULL)&& + (AlreadyChecked(hw, fptr, name) == True)) + { + free(tptr); + tptr = NULL; + } + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + if (tptr != NULL) + { + XtSetArg(arg[argcnt], XtNstate, True); argcnt++; + checked = True; + free(tptr); + } + XtSetArg(arg[argcnt], XtNlabel, ""); argcnt++; + w = XtCreateWidget(name, toggleWidgetClass, + hw->html.view, arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + XtAddCallback(w, XtNcallback, + (XtCallbackProc)CBChangeRadio, (caddr_t)fptr); + } + else if ((type_str != NULL)&&(strcmp(type_str, "submit") == 0)) + { + type = W_PUSHBUTTON; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if ((value == NULL)||(*value == '\0')) + { + value = (char *)malloc(strlen("Submit Query") + + 1); + strcpy(value, "Submit Query"); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + if (value != NULL) + { + XtSetArg(arg[argcnt], XtNlabel, value); + argcnt++; + } + w = XtCreateWidget(name, commandWidgetClass, + hw->html.view, arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + PrepareFormEnd(hw, w, fptr); + } + else if ((type_str != NULL)&&(strcmp(type_str, "reset") == 0)) + { + type = W_PUSHBUTTON; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + if ((value == NULL)||(*value == '\0')) + { + value = (char *)malloc(strlen("Reset") + 1); + strcpy(value, "Reset"); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + if (value != NULL) + { + XtSetArg(arg[argcnt], XtNlabel, value); + argcnt++; + } + w = XtCreateWidget(name, commandWidgetClass, + hw->html.view, arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + PrepareFormReset(hw, w, fptr); + } + else if ((type_str != NULL)&&(strcmp(type_str, "button") == 0)) + { + type = W_PUSHBUTTON; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + if (value != NULL) + { + XtSetArg(arg[argcnt], XtNlabel, value); + argcnt++; + } + w = XtCreateWidget(name, commandWidgetClass, + hw->html.view, arg, argcnt); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else if ((type_str != NULL)&&(strcmp(type_str, "select") == 0)) + { + STRING label; + Widget scroll; + Widget pulldown, button, hist; + char *options; + char **list; + int list_cnt; + char **vlist; + int vlist_cnt; + int i, mult, size; + + type = -1; + tptr = ParseMarkTag(text, MT_INPUT, "HINT"); + if ((tptr != NULL)&&(strcmp(tptr, "list") == 0)) + { + type = W_LIST; + } + else if ((tptr != NULL)&&(strcmp(tptr, "menu") == 0)) + { + type = W_OPTIONMENU; + } + if (tptr != NULL) + { + free(tptr); + } + + size = 5; + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + if (tptr != NULL) + { + size = atoi(tptr); + if ((size > 1)&&(type == -1)) + { + type = W_LIST; + } + free(tptr); + } + + mult = 0; + tptr = ParseMarkTag(text, MT_INPUT, "MULTIPLE"); + if (tptr != NULL) + { + if (type == -1) + { + type = W_LIST; + } + mult = 1; + free(tptr); + } + + if (type == -1) + { + type = W_OPTIONMENU; + } + + label = NULL; + hist = NULL; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + options = ParseMarkTag(text, MT_INPUT, "OPTIONS"); + list = ParseCommaList(options, &list_cnt); + if (options != NULL) + { + free(options); + } + + vlist = ParseCommaList(value, &vlist_cnt); + + if (size > list_cnt) + { + size = list_cnt; + } + if (size < 1) + { + size = 1; + } + + if (type == W_OPTIONMENU) + { + XFontStruct *font; + Dimension maxWidth = 0, width, iW; + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + w = XtCreateWidget(name, + menuButtonWidgetClass, + hw->html.view, arg, argcnt); + argcnt = 0; + pulldown = XtCreatePopupShell("menu", + simpleMenuWidgetClass, w, + arg, argcnt); + + for (i=0; i<list_cnt; i++) + { + char bname[30]; + + sprintf(bname, "Button%d", (i + 1)); + argcnt = 0; + XtSetArg(arg[argcnt], XtNlabel, + list[i]); + argcnt++; + button = XtCreateWidget(bname, + smeBSBObjectClass, + pulldown, arg, argcnt); + XtManageChild(button); + + XtAddCallback(button, XtNcallback, + CBoption, (XtPointer)w); + + if (i==0) + { + XtVaGetValues(w, + XtNfont, &font, + XtNinternalWidth, &iW, + NULL); + } + + width = XTextWidth(font, list[i], + strlen(list[i])); + + if (width > maxWidth) maxWidth = width; + + if ((vlist_cnt > 0)&& + (vlist[0] != NULL)&& + (strcmp(vlist[0], list[i]) ==0)) + { + hist = button; + XtVaSetValues(w, + XtNlabel, + XtNewString(list[i]), + NULL); + } + + /* + * Start hist out as the first button + * so that if the user didn't set a + * default we always default to the + * first element. + */ + if ((i == 0)&&(hist == NULL)) + { + hist = button; + } + } + + XtVaSetValues(w, XtNwidth, maxWidth + (4 * iW), + NULL); + + FreeCommaList(vlist, vlist_cnt); + if (value != NULL) + { + free(value); + } + + if (hist != NULL) + { + /* + * A gaggage. Value is used to later + * restore defaults. For option menu + * this means we need to save a child + * widget id as opposed to the + * character string everyone else uses. + */ + value = (char *)hist; + } + } + else /* type == W_LIST */ + { + STRING *string_list; + STRING *val_list; + + if ((!mult)&&(vlist_cnt > 1)) + { + free(value); + value = (char *)malloc( + strlen(vlist[0]) + 1); + strcpy(value, vlist[0]); + } + + string_list = (STRING *)malloc(list_cnt * + sizeof(STRING)); + val_list = (STRING *)malloc(vlist_cnt * + sizeof(STRING)); + + for (i=0; i<list_cnt; i++) + { + string_list[i] = + XtNewString(list[i]); + } + for (i=0; i<vlist_cnt; i++) + { + val_list[i] = + XtNewString(vlist[i]); + } + + FreeCommaList(list, list_cnt); + FreeCommaList(vlist, vlist_cnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + XtSetArg(arg[argcnt], XtNallowVert, True); + argcnt++; + scroll = XtCreateWidget("Scroll", + viewportWidgetClass, + hw->html.view, arg, argcnt); + + argcnt = 0; + XtSetArg(arg[argcnt], XtNdefaultColumns, 1); + argcnt++; + w = XtCreateWidget(name, + listWidgetClass, + scroll, arg, argcnt); + XtManageChild(w); + + XtAddCallback(w, XtNdestroyCallback, + CBListDestroy, NULL); + + XawListChange(w, string_list, list_cnt, + 0, True); + + if (vlist_cnt > 0) + { + if (vlist_cnt > 1) + { + fprintf(stderr, + "HTML: only a single selection allowed!\n"); + } + + for (i=0; i<list_cnt; i++) + { + if (!strcmp(string_list[i],val_list[0])) + { + XawListHighlight(w, i); + break; + } + } + } + + if (size>list_cnt) size=list_cnt; + if (size>1) + { + XFontStruct *font; + Dimension h,width, s; + + XtVaGetValues(w, XtNfont, &font, + XtNinternalHeight, &h, + XtNwidth, &width, + XtNrowSpacing, &s, + NULL); + XtVaSetValues(scroll, + XtNheight, + h + size*(s+FONTHEIGHT(font)), + XtNwidth, width + 20, + NULL); + } + + w = scroll; + + for (i=0; i<vlist_cnt; i++) + { + free(val_list[i]); + } + if (val_list != NULL) + { + free((char *)val_list); + } + } + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else if ((type_str != NULL)&&(strcmp(type_str, "password") ==0)) + { + char *txt; + + type = W_PASSWORD; + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + size = -1; + maxlength = -1; + + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + if (tptr != NULL) + { + size = atoi(tptr); + free(tptr); + } + + tptr = ParseMarkTag(text, MT_INPUT, "MAXLENGTH"); + if (tptr != NULL) + { + maxlength = atoi(tptr); + free(tptr); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); + argcnt++; + + if (maxlength > 0) + { + if (value) + { + txt = XtNewString(value); + txt = (char*)realloc(txt, + sizeof(char)*(maxlength+1)); + } + else + { + txt = (char *)malloc(sizeof(char)* + (maxlength+1)); + *txt = '\0'; + } + XtSetArg(arg[argcnt], XtNuseStringInPlace, 1); + argcnt++; + XtSetArg(arg[argcnt], XtNlength, maxlength); + argcnt++; + } + else + { + XtSetArg(arg[argcnt], XtNuseStringInPlace, 0); + argcnt++; + } + + + if (value != NULL) + { + int i, len; + char *bval; + + len = strlen(value); + if (maxlength > 0) + { + bval = txt; + if (maxlength<len) len = maxlength+1; + } + else + { + bval = (char *)malloc(len + 1); + } + for (i=0; i<len; i++) + { + bval[i] = '*'; + } + bval[len] = '\0'; + XtSetArg(arg[argcnt], XtNstring, bval); + argcnt++; + } + else /* value == NULL */ + { + if (maxlength>0) /* stringInPlace */ + { + XtSetArg(arg[argcnt], XtNstring, txt); + argcnt++; + } + } + + w = XtCreateWidget(name, asciiTextWidgetClass, + hw->html.view, arg, argcnt); + + if (maxlength > 0) + { + XtAddCallback(w, XtNdestroyCallback, + (XtCallbackProc)CBTextDestroy, + (caddr_t)txt); + } + + XtOverrideTranslations(w, + XtParseTranslationTable("<Key>: HTMLpwdInput()")); + XtOverrideTranslations(w, + XtParseTranslationTable("<Key>Return: no-op(RingBell)")); + + setTextSize(w,size<1?20:size,1); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else if ((type_str != NULL)&&(strcmp(type_str, "textarea") ==0)) + { + char **list; + int list_cnt; + int rows, cols; + + type = W_TEXTAREA; + + /* + * If there is no SIZE, look for ROWS and COLS + * directly. + * SIZE is COLUMNS,ROWS parse the list + */ + rows = -1; + cols = -1; + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + if (tptr == NULL) + { + tptr = ParseMarkTag(text, MT_INPUT, "ROWS"); + if (tptr != NULL) + { + rows = atoi(tptr); + free(tptr); + } + tptr = ParseMarkTag(text, MT_INPUT, "COLS"); + if (tptr != NULL) + { + cols = atoi(tptr); + free(tptr); + } + } + else + { + list = ParseCommaList(tptr, &list_cnt); + free(tptr); + + if (list_cnt == 1) + { + cols = atoi(list[0]); + } + else if (list_cnt > 1) + { + cols = atoi(list[0]); + rows = atoi(list[1]); + } + FreeCommaList(list, list_cnt); + } + + /* + * Grab the starting value of the text here. + * NULL if none. + */ + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + UnMuckTextAreaValue(value); + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); + argcnt++; + + if (value != NULL) + { + XtSetArg(arg[argcnt], XtNstring, value); + argcnt++; + } + w = XtCreateWidget(name, asciiTextWidgetClass, + hw->html.view, arg, argcnt); + + setTextSize(w,cols>0?cols:20,rows>0?rows:1); + + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + else /* if no type, assume type=text */ + { + char **list; + int list_cnt; + int rows, cols; + + /* + * SIZE can be either COLUMNS or COLUMNS,ROWS + * we assume COLUMNS,ROWS and parse the list + */ + tptr = ParseMarkTag(text, MT_INPUT, "SIZE"); + list = ParseCommaList(tptr, &list_cnt); + if (tptr != NULL) + { + free(tptr); + } + + /* + * If only COLUMNS specified, or SIZE not specified + * assume a TEXTFIELD + * Otherwise a TEXTAREA. + */ + if (list_cnt <= 1) + { + type = W_TEXTFIELD; + if (list_cnt == 1) + { + cols = atoi(list[0]); + } + else + { + cols = -1; + } + } + else + { + type = W_TEXTAREA; + cols = atoi(list[0]); + rows = atoi(list[1]); + } + /* + * Now that we have cols, and maybe rows, free the list + */ + FreeCommaList(list, list_cnt); + + /* + * Grab the starting value of the text here. + * NULL if none. + */ + value = ParseMarkTag(text, MT_INPUT, "VALUE"); + + /* + * For textfileds parse maxlength and + * set up the widget. + */ + if (type == W_TEXTFIELD) + { + char *txt; + + maxlength = -1; + tptr = ParseMarkTag(text, MT_INPUT,"MAXLENGTH"); + if (tptr != NULL) + { + maxlength = atoi(tptr); + free(tptr); + } + + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + + if (maxlength > 0) + { + if (value) + { + txt = XtNewString(value); + txt = (char *)realloc(txt, + maxlength); + } + else + { + txt = (char *)malloc(maxlength); + *txt = '\0'; + } + XtSetArg(arg[argcnt], + XtNuseStringInPlace,1); + argcnt++; + XtSetArg(arg[argcnt], + XtNlength, maxlength); + argcnt++; + XtSetArg(arg[argcnt], XtNstring, txt); + argcnt++; + } + else + { + if (value != NULL) + { + XtSetArg(arg[argcnt], + XtNuseStringInPlace,0); + argcnt++; + txt = value; + XtSetArg(arg[argcnt], + XtNstring, txt); + argcnt++; + } + } + + XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); + argcnt++; + w = XtCreateWidget(name, + asciiTextWidgetClass, + hw->html.view, arg, argcnt); + + if (maxlength > 0) + { + XtAddCallback(w, XtNdestroyCallback, + CBTextDestroy, (caddr_t)txt); + } + + XtOverrideTranslations(w, + XtParseTranslationTable( + "<Key>Return: no-op(RingBell)")); + setTextSize(w,cols>0?cols:20,1); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + /* + * Else this is a TEXTAREA. Maxlength is ignored, + * and we set up the scrolled window + */ + else + { + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); + argcnt++; + + if (value != NULL) + { + XtSetArg(arg[argcnt], XtNstring, value); + argcnt++; + } + w = XtCreateWidget(name, + asciiTextWidgetClass, + hw->html.view, arg, argcnt); + setTextSize(w,cols>0?cols:20,rows>0?rows:1); + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + + XtSetMappedWhenManaged(w, False); + XtManageChild(w); + } + if (type_str != NULL) + { + free(type_str); + } + + /* + * Don't want to do GetValues if this is HIDDEN input + * tag with no widget. + */ + if (w != NULL) + { + argcnt = 0; + XtSetArg(arg[argcnt], XtNwidth, &width); argcnt++; + XtSetArg(arg[argcnt], XtNheight, &height); argcnt++; + XtGetValues(w, arg, argcnt); + } + else + { + width = 0; + height = 0; + } + + wptr = AddNewWidget(hw, fptr, w, type, id, x, y, width, height, + name, value, checked); + } + else + /* + * We found this widget on the list of already created widgets. + * Put it in place for reuse. + */ + { + wlist->x = x; + wlist->y = y; + + /* + * Don't want to SetValues if type HIDDEN which + * has no widget. + */ + if (wlist->w != NULL) + { + XtUnmanageChild(wlist->w); + argcnt = 0; + XtSetArg(arg[argcnt], XtNx, x); argcnt++; + XtSetArg(arg[argcnt], XtNy, y); argcnt++; + XtSetValues(wlist->w, arg, argcnt); + XtManageChild(wlist->w); + } + + wptr = wlist; + } + + return(wptr); +} +#endif /* MOTIF */ + + +void +WidgetRefresh(hw, eptr) + HTMLWidget hw; + struct ele_rec *eptr; +{ + if ((eptr->widget_data != NULL)&&(eptr->widget_data->mapped == False)&& + (eptr->widget_data->w != NULL)) + { + eptr->widget_data->mapped = True; + XtSetMappedWhenManaged(eptr->widget_data->w, True); + } + +#if 0 + if (eptr->pic_data != NULL) + { + int x, y, extra; + + x = eptr->x; + y = eptr->y + eptr->y_offset; + + if ((hw->html.border_images == True)|| + (eptr->anchorHRef != NULL)) + { + extra = IMAGE_BORDER; + } + else + { + extra = 0; + } + + x = x - hw->html.scroll_x; + y = y - hw->html.scroll_y; + XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg); + XSetBackground(XtDisplay(hw), hw->html.drawGC, eptr->bg); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, y, + (eptr->pic_data->width + (2 * extra)), + extra); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, + (y + eptr->pic_data->height + extra), + (eptr->pic_data->width + (2 * extra)), + extra); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + x, y, + extra, + (eptr->pic_data->height + (2 * extra))); + XFillRectangle(XtDisplay(hw->html.view), + XtWindow(hw->html.view), hw->html.drawGC, + (x + eptr->pic_data->width + extra), + y, + extra, + (eptr->pic_data->height + (2 * extra))); + + if (eptr->pic_data->image == (Pixmap)NULL) + { + if (eptr->pic_data->image_data != NULL) + { + eptr->pic_data->image = InfoToImage(hw, + eptr->pic_data); + } + else + { + eptr->pic_data->image = NoImage(hw); + } + } + + if (eptr->pic_data->image != (Pixmap)NULL) + { + XCopyArea(XtDisplay(hw->html.view), + eptr->pic_data->image, + XtWindow(hw->html.view), hw->html.drawGC, 0, 0, + eptr->pic_data->width, eptr->pic_data->height, + (x + extra), + (y + extra)); + } + } +#endif +} + diff --git a/vendor/x11iraf/obm/ObmW/Icon.c b/vendor/x11iraf/obm/ObmW/Icon.c new file mode 100644 index 00000000..b4696665 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Icon.c @@ -0,0 +1,224 @@ +/* Generated by wbuild from "Icon.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/extensions/shape.h> +#include <stdio.h> +#include "IconP.h" +static void activate( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"activate", activate}, +}; + +static char defaultTranslations[] = "\ +<Btn1Down>,<Btn1Up>: activate() \n\ +<Key>Return: activate() \n\ +"; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void realize( +#if NeedFunctionPrototypes +Widget,XtValueMask *,XSetWindowAttributes * +#endif +); +static void create_image_gc( +#if NeedFunctionPrototypes +Widget +#endif +); +/*ARGSUSED*/static void create_image_gc(self)Widget self; +{ + Dimension wd, ht; + Position x, y; + XtGCMask mask = GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; + XGCValues values; + + if (((XfwfIconWidget)self)->xfwfIcon.image_gc != NULL) XtReleaseGC(self, ((XfwfIconWidget)self)->xfwfIcon.image_gc); + ((XfwfIconWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &wd, &ht); + if (((XfwfIconWidget)self)->xfwfIcon.image && ((XfwfIconWidget)self)->xfwfIcon.image->pixmap != None) { + values.tile = ((XfwfIconWidget)self)->xfwfIcon.image->pixmap; + mask |= GCTile; + } + values.fill_style = FillTiled; + values.ts_x_origin = x; + values.ts_y_origin = y; + ((XfwfIconWidget)self)->xfwfIcon.image_gc = XtGetGC(self, mask, &values); +} + +static XtResource resources[] = { +{XtNimage,XtCImage,XtRIcon,sizeof(((XfwfIconRec*)NULL)->xfwfIcon.image),XtOffsetOf(XfwfIconRec,xfwfIcon.image),XtRImmediate,(XtPointer)NULL }, +{XtNactivate,XtCActivate,XtRCallback,sizeof(((XfwfIconRec*)NULL)->xfwfIcon.activate),XtOffsetOf(XfwfIconRec,xfwfIcon.activate),XtRImmediate,(XtPointer)NULL }, +{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfIconRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfIconRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)0 }, +}; + +XfwfIconClassRec xfwfIconClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfBoardClassRec, +"Icon", +sizeof(XfwfIconRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +realize, +actionsList, +1, +resources, +3, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +defaultTranslations, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfIcon_class part */ +0 +}, +}; +WidgetClass xfwfIconWidgetClass = (WidgetClass) &xfwfIconClassRec; +/*ARGSUSED*/ +static void activate(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XtCallCallbackList(self, ((XfwfIconWidget)self)->xfwfIcon.activate, event); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfIconWidgetClass c = (XfwfIconWidgetClass) class; + XfwfIconWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfIconWidgetClass) return; + super = (XfwfIconWidgetClass)class->core_class.superclass; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Dimension dummy1, dummy2; + Position x, y; + + ((XfwfIconWidget)self)->xfwfIcon.image_gc = NULL; + create_image_gc(self); + if (((XfwfIconWidget)self)->xfwfIcon.image && (((XfwfIconWidget)self)->xfwfIcon.image->attributes.valuemask & XpmSize) != 0) { + ((XfwfIconWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &dummy1, &dummy2); + XtVaSetValues(self, XtNwidth, ((XfwfIconWidget)self)->xfwfIcon.image->attributes.width + 2*x, + XtNheight, ((XfwfIconWidget)self)->xfwfIcon.image->attributes.height + 2*y, NULL); + } +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + Dimension wd, ht; + Position x, y; + + if (! XtIsRealized(self)) return; + if (((XfwfIconWidget)self)->xfwfIcon.image && ((XfwfIconWidget)self)->xfwfIcon.image->pixmap != None) { + ((XfwfIconWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &wd, &ht); + XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfIconWidget)self)->xfwfIcon.image_gc, x, y, wd, ht); + } + xfwfBoardClassRec.core_class.expose(self, event, region); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Dimension dummy1, dummy2; + Position x, y; + Boolean need_redraw = False; + + if (((XfwfIconWidget)old)->xfwfFrame.frameWidth != ((XfwfIconWidget)self)->xfwfFrame.frameWidth + || ((XfwfIconWidget)old)->xfwfFrame.outerOffset != ((XfwfIconWidget)self)->xfwfFrame.outerOffset + || ((XfwfIconWidget)old)->xfwfIcon.image != ((XfwfIconWidget)self)->xfwfIcon.image) { + create_image_gc(self); + need_redraw = True; + } + if (((XfwfIconWidget)old)->xfwfIcon.image != ((XfwfIconWidget)self)->xfwfIcon.image && ((XfwfIconWidget)self)->xfwfIcon.image) { + ((XfwfIconWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &dummy1, &dummy2); + if ((((XfwfIconWidget)self)->xfwfIcon.image->attributes.valuemask & XpmSize) != 0) + ((XfwfIconWidgetClass)self->core.widget_class)->xfwfBoard_class.set_abs_location(self, CWWidth | CWHeight, 0, 0, + ((XfwfIconWidget)self)->xfwfIcon.image->attributes.width + 2*x, + ((XfwfIconWidget)self)->xfwfIcon.image->attributes.height + 2*y); + if (((XfwfIconWidget)self)->xfwfIcon.image->mask != None && XtIsRealized(self)) + XShapeCombineMask(XtDisplay(self), XtWindow(self), ShapeBounding, + x, y, ((XfwfIconWidget)self)->xfwfIcon.image->mask, ShapeSet); + need_redraw = True; + } + return need_redraw; +} +/*ARGSUSED*/static void realize(self,mask,attributes)Widget self;XtValueMask * mask;XSetWindowAttributes * attributes; +{ + Dimension wd, ht; + Position x, y; + + xfwfBoardClassRec.core_class.realize(self, mask, attributes); + ((XfwfIconWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &wd, &ht); + if (((XfwfIconWidget)self)->xfwfIcon.image && ((XfwfIconWidget)self)->xfwfIcon.image->mask != None) + XShapeCombineMask(XtDisplay(self), XtWindow(self), ShapeBounding, + x, y, ((XfwfIconWidget)self)->xfwfIcon.image->mask, ShapeSet); +} diff --git a/vendor/x11iraf/obm/ObmW/Icon.h b/vendor/x11iraf/obm/ObmW/Icon.h new file mode 100644 index 00000000..966ee3e5 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Icon.h @@ -0,0 +1,31 @@ +/* Generated by wbuild from "Icon.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfIcon_H_ +#define _XfwfIcon_H_ +#include "Board.h" +#include "Converters.h" +#ifndef XtNimage +#define XtNimage "image" +#endif +#ifndef XtCImage +#define XtCImage "Image" +#endif +#ifndef XtRIcon +#define XtRIcon "Icon" +#endif + +#ifndef XtNactivate +#define XtNactivate "activate" +#endif +#ifndef XtCActivate +#define XtCActivate "Activate" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +typedef struct _XfwfIconClassRec *XfwfIconWidgetClass; +typedef struct _XfwfIconRec *XfwfIconWidget; +externalref WidgetClass xfwfIconWidgetClass; +#endif /*_XfwfIcon_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Icon.man b/vendor/x11iraf/obm/ObmW/Icon.man new file mode 100644 index 00000000..0a77db34 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Icon.man @@ -0,0 +1,392 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfIcon +.SH DESCRIPTION +The XfwfIcon widget displays an image. The preferred width and +height of the widget will be set to the width and height of the loaded +image, plus space for the frame. The widget has a callback +\fIactivateCallback\fP, that is by default bound to a click of the left +mouse button. + +The image is a \fIPixmap\fP, optionally accompanied by a mask, to make +parts of the image transparent. When the image has a mask, the frame +around the widget will not be shown. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfIcon +Name Class Type Default +XtNimage XtCImage Icon * NULL +XtNactivate XtCActivate Callback NULL + +.TE +.ps + +.TP +.I "XtNimage" +The image must be in \fIPixmap\fP format. The width and height of the +image will be used to set the width and height of the widget. There +is a converter for strings (defined in the Common widget), which will +try to interpret a string as a file name and load the file. The file +must be in XPM format. The converter also knows about some built-in +images, called \fI"FATAL"\fP, \fI"ERROR"\fP, \fI"WARNING"\fP, \fI"QUESTION"\fP, +\fI"INFO"\fP and \fI"NONE"\fP. + + + +.hi + +.nf +Icon * image = NULL +.fi + +.eh + +.TP +.I "XtNactivate" +The callback is called by the \fIactivate\fP action, which is by default +bound to a click of mouse button 1. + + + +.hi + +.nf +<Callback> XtCallbackList activate = NULL +.fi + +.eh + +.TP +.I "XtNframeWidth" +By default, icons do not have a frame. + + + +.hi + +.nf + frameWidth = 0 +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The type \fIIcon\fP is defined in \fIConverters.h\fP + +.nf + +.B incl + <Xfwf/Converters.h> +.fi + +.SS "Translations" + +By default, the \fIactivate\fP action is bound to a mouse click and to +the Return key. + + + +.nf +<Btn1Down>,<Btn1Up>: activate() +.fi + +.nf +<Key>Return: activate() +.fi + +.hi +.SS "Actions" + +.TP +.I "activate + +The \fIactivate\fP action just calls the \fIactivate\fP callback functions, +passing the \fIXEvent\fP pointer in the \fIcall_data\fP argument. + +.hi + +.nf +void activate($, XEvent* event, String* params, Cardinal* num_params) +{ + XtCallCallbackList($, $activate, event); +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +.nf + +.B incl + <X11/extensions/shape.h> +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.hi + +.hi +.SS "Private variables" + +The GC for drawing the image. + + + +.nf +GC image_gc +.fi + +.hi + +.hi +.SS "Methods" + +The \fIinitialize\fP sets the (desired and actual) size of the widget to +the size of the image. The GC is initialized. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + Dimension dummy1, dummy2; + Position x, y; + + $image_gc = NULL; + create_image_gc($); + if ($image ($image->attributes.valuemask XpmSize) != 0) { + $compute_inside($, x, y, dummy1, dummy2); + XtVaSetValues($, XtNwidth, $image->attributes.width + 2*x, + XtNheight, $image->attributes.height + 2*y, NULL); + } +} +.fi + +The \fIexpose\fP method simply draws the image (if any) against the top +left corner of the widget. The window is first masked with the image's +mask. After that the images is drawn with a call to \fIXFillRectangle\fP. +The GC is queried first, to see if the origin needs changing. +Unfortunately, this involves a round trip to the server. Finally, +\fIexpose\fP calls the superclass's \fIexpose\fP method to draw the frame. + +.nf +expose($, XEvent * event, Region region) +{ + Dimension wd, ht; + Position x, y; + + if (! XtIsRealized($)) return; + if ($image $image->pixmap != None) { + $compute_inside($, x, y, wd, ht); + XFillRectangle(XtDisplay($), XtWindow($), $image_gc, x, y, wd, ht); + } + #expose($, event, region); +} +.fi + +A change of image also causes a change in size. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Dimension dummy1, dummy2; + Position x, y; + Boolean need_redraw = False; + + if ($old$frameWidth != $frameWidth + || $old$outerOffset != $outerOffset + || $old$image != $image) { + create_image_gc($); + need_redraw = True; + } + if ($old$image != $image $image) { + $compute_inside($, x, y, dummy1, dummy2); + if (($image->attributes.valuemask XpmSize) != 0) + $set_abs_location($, CWWidth | CWHeight, 0, 0, + $image->attributes.width + 2*x, + $image->attributes.height + 2*y); + if ($image->mask != None XtIsRealized($)) + XShapeCombineMask(XtDisplay($), XtWindow($), ShapeBounding, + x, y, $image->mask, ShapeSet); + need_redraw = True; + } + return need_redraw; +} +.fi + +When the Widget is realized, the window is immediately combined with +the icon's mask. + +.nf +realize($, XtValueMask * mask, XSetWindowAttributes * attributes) +{ + Dimension wd, ht; + Position x, y; + + #realize($, mask, attributes); + $compute_inside($, x, y, wd, ht); + if ($image $image->mask != None) + XShapeCombineMask(XtDisplay($), XtWindow($), ShapeBounding, + x, y, $image->mask, ShapeSet); +} +.fi + +.hi + +.hi +.SH "Utilities" + +The GC is created by a utility function. It sets the fill style to +\fIFillTiled\fP and the origin to the coordinates just inside the widget's +frame + +.nf +create_image_gc($) +{ + Dimension wd, ht; + Position x, y; + XtGCMask mask = GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; + XGCValues values; + + if ($image_gc != NULL) XtReleaseGC($, $image_gc); + $compute_inside($, x, y, wd, ht); + if ($image $image->pixmap != None) { + values.tile = $image->pixmap; + mask |= GCTile; + } + values.fill_style = FillTiled; + values.ts_x_origin = x; + values.ts_y_origin = y; + $image_gc = XtGetGC($, mask, values); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/IconP.h b/vendor/x11iraf/obm/ObmW/IconP.h new file mode 100644 index 00000000..1089db47 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/IconP.h @@ -0,0 +1,41 @@ +/* Generated by wbuild from "Icon.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfIconP_H_ +#define _XfwfIconP_H_ +#include "BoardP.h" +#include "Icon.h" +typedef struct { +/* methods */ +/* class variables */ +int dummy; +} XfwfIconClassPart; +typedef struct _XfwfIconClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfIconClassPart xfwfIcon_class; +} XfwfIconClassRec; + +typedef struct { +/* resources */ +Icon * image; +XtCallbackList activate; +/* private state */ +GC image_gc; +} XfwfIconPart; + +typedef struct _XfwfIconRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfIconPart xfwfIcon; +} XfwfIconRec; + +externalref XfwfIconClassRec xfwfIconClassRec; + +#endif /* _XfwfIconP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Imakefile b/vendor/x11iraf/obm/ObmW/Imakefile new file mode 100644 index 00000000..7bb51686 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Imakefile @@ -0,0 +1,241 @@ +XCOMM Imakefile for the Object Manager special widget library. +XCOMM 05-Sep-93, Doug Tody NOAO/IRAF. + +X11IRAFDIR = ../../ +#include <../../X11IRAF.tmpl> + + EXTRA_INCLUDES = -I../../include + EXTRA_DEFINES = -D_NO_PROTO + +# Hack to compile under SunPRO V4 on Solaris +#if defined (SunArchitecture) && HasSunC && OSMajorVersion >= 5 +#if OSMinorVersion <= 5 +#if !defined (i386Architecture) + CCOPTIONS = -Xs + EXTRA_LDOPTIONS = -xildoff +#endif +#endif +#endif + +#if defined (PpcDarwinArchitecture) || defined (TenonServer) + CCOPTIONS = -traditional-cpp +#endif + +#if ((GccMajorVersion == 3) && (GccMinorVersion >= 1)) + CCOPTIONS = -DUSE_STDARG +#else + CCOPTIONS = +#endif + + + +HEADERS = \ + Arrow.h ArrowP.h Board.h BoardP.h Button.h ButtonP.h \ + Common.h CommonP.h Converters.h DrawingArea.h DrawingAreaP.h \ + Frame.h FrameP.h Group.h GroupP.h Gterm.h GtermP.h HTML.h HTMLP.h \ + HTMLamp.h Icon.h IconP.h Label.h LabelP.h Layout.h LayoutP.h \ + MenuBar.h MenuBarP.h MultiList.h MultiListP.h RadioGrp.h RadioGrpP.h \ + RowCol.h RowColP.h Scrollbar.h ScrollbarP.h Slider2.h Slider2P.h \ + TabString.h Toggle.h ToggleP.h done.h inkstore.h laygram.h scroll.h \ + Tabs.h TabsP.h Gcs.h ListTree.h ListTreeP.h + +XRAW_HEADERS = \ + 3d.h AllWidgets.h Arrow.h ArrowP.h AsciiSink.h AsciiSinkP.h \ + AsciiSrc.h AsciiSrcP.h AsciiText.h AsciiTextP.h Box.h BoxP.h \ + Cardinals.h Clock.h ClockP.h Command.h CommandP.h Container.h \ + ContainerP.h Dialog.h DialogP.h Form.h FormP.h Frame.h FrameP.h \ + Grip.h GripP.h Label.h LabelP.h List.h ListP.h Logo.h LogoP.h \ + Mailbox.h MailboxP.h MenuButtoP.h MenuButton.h Object.h Paned.h \ + PanedP.h Panner.h PannerP.h Porthole.h PortholeP.h Repeater.h \ + RepeaterP.h Reports.h Scrollbar.h ScrollbarP.h ScrolledTable.h \ + ScrolledTableP.h Separator.h SeparatorP.h Simple.h SimpleMenP.h \ + SimpleMenu.h SimpleP.h Sme.h SmeBSB.h SmeBSBP.h SmeLine.h SmeLineP.h \ + SmeP.h StripCharP.h StripChart.h Table.h Table3d.h TableP.h \ + TableUtil.h Template.h TemplateP.h Text.h TextP.h TextSink.h \ + TextSinkP.h TextSrc.h TextSrcP.h Toggle.h ToggleP.h Tree.h TreeP.h \ + Viewport.h ViewportP.h XawAll.h XawInit.h Xosdefs.h XrawInit.h \ + color.h xraw_table.h + +SRCS = \ + Arrow.c Board.c Button.c Common.c DrawIString.c DrawString.c \ + DrawingArea.c Frame.c Group.c Gterm.c HTML-PSformat.c HTML.c \ + HTMLformat.c HTMLimages.c HTMLjot.c HTMLlists.c HTMLparse.c \ + HTMLwidgets.c Icon.c Label.c Layout.c MenuBar.c MultiList.c \ + RadioGrp.c RowCol.c Scrollbar.c Slider2.c Tablist2Tabs.c TextWidth.c \ + Toggle.c cvtLong.c iconutil.c laygram.c laylex.c scroll.c strnchr.c \ + Tabs.c Gcs.c ListTree.c Separator.c Table.c Table3d.c TableUtil.c \ + Container.c color.c + +OBJS = \ + Arrow.o Board.o Button.o Common.o DrawIString.o DrawString.o \ + DrawingArea.o Frame.o Group.o Gterm.o HTML-PSformat.o HTML.o \ + HTMLformat.o HTMLimages.o HTMLjot.o HTMLlists.o HTMLparse.o \ + HTMLwidgets.o Icon.o Label.o Layout.o MenuBar.o MultiList.o \ + RadioGrp.o RowCol.o Scrollbar.o Slider2.o Tablist2Tabs.o TextWidth.o \ + Toggle.o cvtLong.o iconutil.o laygram.o laylex.o scroll.o strnchr.o \ + Tabs.o Gcs.o ListTree.o Separator.o Table.o Table3d.o TableUtil.o \ + Container.o color.o + +#ifdef LexCmd +LEX=LexCmd +#endif +#ifdef YaccCmd +YACC=YaccCmd +#endif + + +depend:: laygram.c laylex.c +all:: laygram.c laylex.c + +SubdirLibraryRule($(OBJS)) +NormalLintTarget($(SRCS)) +LintLibraryTarget(ar,$(SRCS)) + +# Turn off compiler warnings for the HTML and FWF widgets. + FWFCFLAGS = $(CFLAGS) -c -w + +HTML.o: HTML.c + $(CC) $(FWFCFLAGS) HTML.c +HTML-PSformat.o: HTML-PSformat.c + $(CC) $(FWFCFLAGS) HTML-PSformat.c +HTMLformat.o: HTMLformat.c + $(CC) $(FWFCFLAGS) HTMLformat.c +HTMLimages.o: HTMLimages.c + $(CC) $(FWFCFLAGS) HTMLimages.c +HTMLjot.o: HTMLjot.c + $(CC) $(FWFCFLAGS) HTMLjot.c +HTMLlists.o: HTMLlists.c + $(CC) $(FWFCFLAGS) HTMLlists.c +HTMLparse.o: HTMLparse.c + $(CC) $(FWFCFLAGS) HTMLparse.c +HTMLwidgets.o: HTMLwidgets.c + $(CC) $(FWFCFLAGS) HTMLwidgets.c + + +Arrow.o: + $(CC) $(FWFCFLAGS) Arrow.c +Board.o: + $(CC) $(FWFCFLAGS) Board.c +Button.o: + $(CC) $(FWFCFLAGS) Button.c +Common.o: + $(CC) $(FWFCFLAGS) Common.c +DrawIString.o: + $(CC) $(FWFCFLAGS) DrawIString.c +DrawString.o: + $(CC) $(FWFCFLAGS) DrawString.c +Frame.o: + $(CC) $(FWFCFLAGS) Frame.c +Group.o: + $(CC) $(FWFCFLAGS) Group.c +Icon.o: + $(CC) $(FWFCFLAGS) Icon.c +Label.o: + $(CC) $(FWFCFLAGS) Label.c +MenuBar.o: + $(CC) $(FWFCFLAGS) MenuBar.c +MultiList.o: + $(CC) $(FWFCFLAGS) MultiList.c +RadioGrp.o: + $(CC) $(FWFCFLAGS) RadioGrp.c +RowCol.o: + $(CC) $(FWFCFLAGS) RowCol.c +Scrollbar.o: + $(CC) $(FWFCFLAGS) Scrollbar.c +Slider2.o: + $(CC) $(FWFCFLAGS) Slider2.c +Tablist2Tabs.o: + $(CC) $(FWFCFLAGS) Tablist2Tabs.c +TextWidth.o: + $(CC) $(FWFCFLAGS) TextWidth.c +Toggle.o: + $(CC) $(FWFCFLAGS) Toggle.c +cvtLong.o: + $(CC) $(FWFCFLAGS) cvtLong.c +iconutil.o: + $(CC) $(FWFCFLAGS) iconutil.c +laylex.o: + $(CC) $(FWFCFLAGS) laylex.c + +laygram.c laygram.h : laygram.y + yacc -d laygram.y + sed 's/yy/LayYY/g' y.tab.c > laygram.c + sed 's/yy/LayYY/g' y.tab.h > laygram.h + rm y.tab.c y.tab.h + +# Hack to compile under systems which don't have strict ANSI compilers. +#if defined (SunArchitecture) && HasSunC && OSMajorVersion >= 5 +#if !defined (i386Architecture) +Tabs.o: + $(CC) -Xc $(EXTRA_INCLUDES) -c Tabs.c +ListTree.o: + $(CC) -Xc $(EXTRA_INCLUDES) -c ListTree.c +#endif +#else +#if defined (SunArchitecture) && OSMajorVersion == 4 +Tabs.o: + acc -w $(EXTRA_INCLUDES) -DSUNOS -c Tabs.c +Gcs.o: + acc -w $(EXTRA_INCLUDES) -c Gcs.c +ListTree.o: + acc -w $(EXTRA_INCLUDES) -c ListTree.c +#else +#if defined (HPArchitecture) +Tabs.o: + c89 -w $(CFLAGS) $(EXTRA_INCLUDES) -c Tabs.c +Gcs.o: + c89 -w $(CFLAGS) $(EXTRA_INCLUDES) -c Gcs.c +ListTree.o: + c89 -w $(CFLAGS) $(EXTRA_INCLUDES) -c ListTree.c +#else +#if defined (AlphaArchitecture) && OSMajorVersion >= 4 +Tabs.o: + $(CC) -std $(CFLAGS) $(EXTRA_INCLUDES) -c Tabs.c +ListTree.o: + $(CC) -std $(CFLAGS) $(EXTRA_INCLUDES) -c ListTree.c +#endif +#endif +#endif +#endif + + +# Hack to compile under SunPRO V4 on Solaris +#if defined (SunArchitecture) && HasSunC && OSMajorVersion >= 5 +laygram.o: + $(CC) $(EXTRA_INCLUDES) -c laygram.c +#endif + +clean:: + -rm -f laygram.c laygram.h + +laylex.c: laylex.l + $(LEX) laylex.l + sed 's/yy/LayYY/g' lex.yy.c > laylex.c + rm lex.yy.c + +clean:: + -rm -f laylex.c + +includes:: laygram.h + MakeDir(X11irafIncDir/ObmW) + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/ObmW/$$i; \ + $(CP) -p $$i X11irafIncDir/ObmW/$$i; \ + done) + MakeDir(X11irafIncDir/X11/Xraw) + @(set -x; for i in $(XRAW_HEADERS); do \ + $(RM) X11irafIncDir/X11/Xraw/$$i; \ + $(CP) -p Xraw/$$i X11irafIncDir/X11/Xraw/$$i; \ + done) + +#if InstallIncludes +install:: + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/ObmW/$$i; \ + done) + for i in $(HEADERS); do \ + (set -x; $(CP) -p $$i X11irafIncDir/ObmW); \ + done +#endif + +DependTarget() diff --git a/vendor/x11iraf/obm/ObmW/Label.c b/vendor/x11iraf/obm/ObmW/Label.c new file mode 100644 index 00000000..116ee13e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Label.c @@ -0,0 +1,345 @@ +/* Generated by wbuild from "Label.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "stip4.bm" +#include <stdio.h> +#include "TabString.h" +#include "LabelP.h" +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void set_label( +#if NeedFunctionPrototypes +Widget,String +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void make_gc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void make_graygc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void count_lines( +#if NeedFunctionPrototypes +Widget +#endif +); +/*ARGSUSED*/static void make_gc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfLabelWidget)self)->xfwfLabel.gc != NULL) XtReleaseGC(self, ((XfwfLabelWidget)self)->xfwfLabel.gc); + values.background = ((XfwfLabelWidget)self)->core.background_pixel; + values.foreground = ((XfwfLabelWidget)self)->xfwfLabel.foreground; + values.font = ((XfwfLabelWidget)self)->xfwfLabel.font->fid; + mask = GCFont | GCBackground | GCForeground; + ((XfwfLabelWidget)self)->xfwfLabel.gc = XtGetGC(self, mask, &values); + + if (((XfwfLabelWidget)self)->xfwfLabel.rv_gc != NULL) XtReleaseGC(self, ((XfwfLabelWidget)self)->xfwfLabel.rv_gc); + values.foreground = ((XfwfLabelWidget)self)->core.background_pixel; + values.background = ((XfwfLabelWidget)self)->xfwfLabel.foreground; + values.font = ((XfwfLabelWidget)self)->xfwfLabel.font->fid; + mask = GCFont | GCBackground | GCForeground; + ((XfwfLabelWidget)self)->xfwfLabel.rv_gc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void make_graygc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfLabelWidget)self)->xfwfLabel.graygc != NULL) XtReleaseGC(self, ((XfwfLabelWidget)self)->xfwfLabel.graygc); + values.foreground = ((XfwfLabelWidget)self)->core.background_pixel; + values.stipple = + XCreateBitmapFromData(XtDisplay(self), + RootWindowOfScreen(XtScreen(self)), + stip4_bits, stip4_width, stip4_height); + values.fill_style = FillStippled; + mask = GCForeground | GCStipple | GCFillStyle; + ((XfwfLabelWidget)self)->xfwfLabel.graygc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void count_lines(self)Widget self; +{ + String p, s; + int w; + + ((XfwfLabelWidget)self)->xfwfLabel.nlines = 0; + ((XfwfLabelWidget)self)->xfwfLabel.label_width = 0; + if (((XfwfLabelWidget)self)->xfwfLabel.label) { + for (p = ((XfwfLabelWidget)self)->xfwfLabel.label, ((XfwfLabelWidget)self)->xfwfLabel.nlines = 1, s = ((XfwfLabelWidget)self)->xfwfLabel.label; *s; s++) { + if (*s == '\n') { + ((XfwfLabelWidget)self)->xfwfLabel.nlines++; + w = XfwfTextWidth(((XfwfLabelWidget)self)->xfwfLabel.font, p, s - p, ((XfwfLabelWidget)self)->xfwfLabel.tabs); + p = s + 1; + if (w > ((XfwfLabelWidget)self)->xfwfLabel.label_width) ((XfwfLabelWidget)self)->xfwfLabel.label_width = w; + } + } + w = XfwfTextWidth(((XfwfLabelWidget)self)->xfwfLabel.font, p, s - p, ((XfwfLabelWidget)self)->xfwfLabel.tabs); + if (w > ((XfwfLabelWidget)self)->xfwfLabel.label_width) ((XfwfLabelWidget)self)->xfwfLabel.label_width = w; + } + ((XfwfLabelWidget)self)->xfwfLabel.label_height = ((XfwfLabelWidget)self)->xfwfLabel.nlines * (((XfwfLabelWidget)self)->xfwfLabel.font->ascent + ((XfwfLabelWidget)self)->xfwfLabel.font->descent); + ((XfwfLabelWidget)self)->xfwfLabel.label_width += ((XfwfLabelWidget)self)->xfwfLabel.leftMargin + ((XfwfLabelWidget)self)->xfwfLabel.rightMargin; + ((XfwfLabelWidget)self)->xfwfLabel.label_height += ((XfwfLabelWidget)self)->xfwfLabel.topMargin + ((XfwfLabelWidget)self)->xfwfLabel.bottomMargin; +} + +static XtResource resources[] = { +{XtNlabel,XtCLabel,XtRString,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.label),XtOffsetOf(XfwfLabelRec,xfwfLabel.label),XtRImmediate,(XtPointer)NULL }, +{XtNtablist,XtCTablist,XtRString,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.tablist),XtOffsetOf(XfwfLabelRec,xfwfLabel.tablist),XtRImmediate,(XtPointer)NULL }, +{XtNfont,XtCFont,XtRFontStruct,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.font),XtOffsetOf(XfwfLabelRec,xfwfLabel.font),XtRString,(XtPointer)XtDefaultFont }, +{XtNforeground,XtCForeground,XtRPixel,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.foreground),XtOffsetOf(XfwfLabelRec,xfwfLabel.foreground),XtRString,(XtPointer)XtDefaultForeground }, +{XtNalignment,XtCAlignment,XtRAlignment,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.alignment),XtOffsetOf(XfwfLabelRec,xfwfLabel.alignment),XtRImmediate,(XtPointer)0 }, +{XtNtopMargin,XtCTopMargin,XtRDimension,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.topMargin),XtOffsetOf(XfwfLabelRec,xfwfLabel.topMargin),XtRImmediate,(XtPointer)2 }, +{XtNbottomMargin,XtCBottomMargin,XtRDimension,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.bottomMargin),XtOffsetOf(XfwfLabelRec,xfwfLabel.bottomMargin),XtRImmediate,(XtPointer)2 }, +{XtNleftMargin,XtCLeftMargin,XtRDimension,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.leftMargin),XtOffsetOf(XfwfLabelRec,xfwfLabel.leftMargin),XtRImmediate,(XtPointer)2 }, +{XtNrightMargin,XtCRightMargin,XtRDimension,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.rightMargin),XtOffsetOf(XfwfLabelRec,xfwfLabel.rightMargin),XtRImmediate,(XtPointer)2 }, +{XtNshrinkToFit,XtCShrinkToFit,XtRBoolean,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.shrinkToFit),XtOffsetOf(XfwfLabelRec,xfwfLabel.shrinkToFit),XtRImmediate,(XtPointer)False }, +{XtNrvStart,XtCRvStart,XtRInt,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.rvStart),XtOffsetOf(XfwfLabelRec,xfwfLabel.rvStart),XtRImmediate,(XtPointer)0 }, +{XtNrvLength,XtCRvLength,XtRInt,sizeof(((XfwfLabelRec*)NULL)->xfwfLabel.rvLength),XtOffsetOf(XfwfLabelRec,xfwfLabel.rvLength),XtRImmediate,(XtPointer)0 }, +{XtNtraversalOn,XtCTraversalOn,XtRBoolean,sizeof(((XfwfLabelRec*)NULL)->xfwfCommon.traversalOn),XtOffsetOf(XfwfLabelRec,xfwfCommon.traversalOn),XtRImmediate,(XtPointer)False }, +}; + +XfwfLabelClassRec xfwfLabelClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfBoardClassRec, +"TextBox", +sizeof(XfwfLabelRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +NULL, +0, +resources, +13, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfLabel_class part */ +set_label, +}, +}; +WidgetClass xfwfLabelWidgetClass = (WidgetClass) &xfwfLabelClassRec; +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfLabelWidgetClass c = (XfwfLabelWidgetClass) class; + XfwfLabelWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfLabelWidgetClass) return; + super = (XfwfLabelWidgetClass)class->core_class.superclass; + if (c->xfwfLabel_class.set_label == XtInherit_set_label) + c->xfwfLabel_class.set_label = super->xfwfLabel_class.set_label; +} +/*ARGSUSED*/static void set_label(self,newlabel)Widget self;String newlabel; +{ + Position x, y; + Dimension w, h; + + XtFree(((XfwfLabelWidget)self)->xfwfLabel.label); + ((XfwfLabelWidget)self)->xfwfLabel.label = XtNewString(newlabel); + count_lines(self); + if (XtIsRealized(self)) { + ((XfwfLabelWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + XClearArea(XtDisplay(self), XtWindow(self), x, y, w, h, True); + /* $expose($, NULL, NULL); */ + } +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redisplay = False, need_count = False; + Position x, y; + Dimension w, h, wd, ht; + + if (((XfwfLabelWidget)self)->core.background_pixel != ((XfwfLabelWidget)old)->core.background_pixel) + make_graygc(self); + + if (((XfwfLabelWidget)self)->xfwfLabel.tablist != ((XfwfLabelWidget)old)->xfwfLabel.tablist) { + XtFree((String) ((XfwfLabelWidget)old)->xfwfLabel.tabs); + ((XfwfLabelWidget)self)->xfwfLabel.tabs = XfwfTablist2Tabs(((XfwfLabelWidget)self)->xfwfLabel.tablist); + if (((XfwfLabelWidget)self)->xfwfLabel.label != NULL) need_count = True; + } + + if (((XfwfLabelWidget)self)->xfwfLabel.font != ((XfwfLabelWidget)old)->xfwfLabel.font) { + make_gc(self); + if (((XfwfLabelWidget)self)->xfwfLabel.label != NULL) need_count = True; + } + if (((XfwfLabelWidget)self)->xfwfLabel.foreground != ((XfwfLabelWidget)old)->xfwfLabel.foreground + || ((XfwfLabelWidget)self)->core.background_pixel != ((XfwfLabelWidget)old)->core.background_pixel) { + make_gc(self); + if (((XfwfLabelWidget)self)->xfwfLabel.label != NULL) need_redisplay = True; + } + if (((XfwfLabelWidget)self)->xfwfLabel.topMargin != ((XfwfLabelWidget)old)->xfwfLabel.topMargin + || ((XfwfLabelWidget)self)->xfwfLabel.bottomMargin != ((XfwfLabelWidget)old)->xfwfLabel.bottomMargin + || ((XfwfLabelWidget)self)->xfwfLabel.leftMargin != ((XfwfLabelWidget)old)->xfwfLabel.leftMargin + || ((XfwfLabelWidget)self)->xfwfLabel.rightMargin != ((XfwfLabelWidget)old)->xfwfLabel.rightMargin) + need_count = True; + + if (((XfwfLabelWidget)self)->core.sensitive != ((XfwfLabelWidget)old)->core.sensitive) + if (((XfwfLabelWidget)self)->xfwfLabel.label != NULL) need_redisplay = True; + + if (((XfwfLabelWidget)self)->xfwfLabel.rvStart != ((XfwfLabelWidget)old)->xfwfLabel.rvStart || ((XfwfLabelWidget)self)->xfwfLabel.rvLength != ((XfwfLabelWidget)old)->xfwfLabel.rvLength) + if (((XfwfLabelWidget)self)->xfwfLabel.label != NULL) need_redisplay = True; + + if (((XfwfLabelWidget)self)->xfwfLabel.label != ((XfwfLabelWidget)old)->xfwfLabel.label) { + XtFree(((XfwfLabelWidget)old)->xfwfLabel.label); + ((XfwfLabelWidget)self)->xfwfLabel.label = XtNewString(((XfwfLabelWidget)self)->xfwfLabel.label); + need_count = True; + } + if (need_count) { + count_lines(self); + need_redisplay = True; + } + if (need_count && ((XfwfLabelWidget)self)->xfwfLabel.shrinkToFit) { + ((XfwfLabelWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + wd = ((XfwfLabelWidget)self)->xfwfLabel.label_width + ((XfwfLabelWidget)self)->core.width - w; + ht = ((XfwfLabelWidget)self)->xfwfLabel.label_height + ((XfwfLabelWidget)self)->core.height - h; + if (wd != ((XfwfLabelWidget)self)->core.width || ht != ((XfwfLabelWidget)self)->core.height) { + ((XfwfLabelWidgetClass)self->core.widget_class)->xfwfBoard_class.set_abs_location(self, CWWidth | CWHeight, 0, 0, wd, ht); + need_redisplay = False; + } + } + return need_redisplay; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + char *s; + Position x, y; + Dimension w, h, wd, ht; + + if (((XfwfLabelWidget)self)->xfwfLabel.label) ((XfwfLabelWidget)self)->xfwfLabel.label = XtNewString(((XfwfLabelWidget)self)->xfwfLabel.label); + count_lines(self); + ((XfwfLabelWidget)self)->xfwfLabel.gc = NULL; + ((XfwfLabelWidget)self)->xfwfLabel.rv_gc = NULL; + ((XfwfLabelWidget)self)->xfwfLabel.graygc = NULL; + make_gc(self); + make_graygc(self); + ((XfwfLabelWidget)self)->xfwfLabel.tabs = XfwfTablist2Tabs(((XfwfLabelWidget)self)->xfwfLabel.tablist); + if (((XfwfLabelWidget)self)->xfwfLabel.shrinkToFit) { + ((XfwfLabelWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + wd = ((XfwfLabelWidget)self)->xfwfLabel.label_width + ((XfwfLabelWidget)self)->core.width - w; + ht = ((XfwfLabelWidget)self)->xfwfLabel.label_height + ((XfwfLabelWidget)self)->core.height - h; + ((XfwfLabelWidgetClass)self->core.widget_class)->xfwfBoard_class.set_abs_location(self, CWWidth | CWHeight, 0, 0, wd, ht); + } +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + Region reg; + XRectangle rect; + int baseline; + int w1, w2, w3; + char *s, *t; + int x, y, i, j, rstart, rend; + + if (! XtIsRealized(self)) return; + xfwfBoardClassRec.core_class.expose(self, event, region); + if (((XfwfLabelWidget)self)->xfwfLabel.label != NULL) { + baseline = ((XfwfLabelWidget)self)->xfwfLabel.font->ascent + ((XfwfLabelWidget)self)->xfwfLabel.font->descent; + ((XfwfLabelWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &rect.x, &rect.y, &rect.width, &rect.height); + rect.x += ((XfwfLabelWidget)self)->xfwfLabel.leftMargin; rect.width -= ((XfwfLabelWidget)self)->xfwfLabel.leftMargin + ((XfwfLabelWidget)self)->xfwfLabel.rightMargin; + rect.y += ((XfwfLabelWidget)self)->xfwfLabel.topMargin; rect.height -= ((XfwfLabelWidget)self)->xfwfLabel.topMargin + ((XfwfLabelWidget)self)->xfwfLabel.bottomMargin; + reg = XCreateRegion(); + XUnionRectWithRegion(&rect, reg, reg); + if (region != NULL) XIntersectRegion(region, reg, reg); + XSetRegion(XtDisplay(self), ((XfwfLabelWidget)self)->xfwfLabel.gc, reg); + XSetRegion(XtDisplay(self), ((XfwfLabelWidget)self)->xfwfLabel.rv_gc, reg); + if (((XfwfLabelWidget)self)->xfwfLabel.alignment & XfwfTop) + y = rect.y + ((XfwfLabelWidget)self)->xfwfLabel.font->ascent; + else if (((XfwfLabelWidget)self)->xfwfLabel.alignment & XfwfBottom) + y = rect.y + rect.height - ((XfwfLabelWidget)self)->xfwfLabel.nlines * baseline + ((XfwfLabelWidget)self)->xfwfLabel.font->ascent; + else + y = rect.y + (rect.height - ((XfwfLabelWidget)self)->xfwfLabel.nlines * baseline)/2 + ((XfwfLabelWidget)self)->xfwfLabel.font->ascent; + for (i = 0, j = 0; ((XfwfLabelWidget)self)->xfwfLabel.label[i]; i++) { + if (((XfwfLabelWidget)self)->xfwfLabel.label[i] == '\n') { + draw_line(XtDisplay(self), XtWindow(self), j, i); + j = i + 1; + y += baseline; + } + } + draw_line(XtDisplay(self), XtWindow(self), j, i); + + /* Gray out if not sensitive */ + if (! ((XfwfLabelWidget)self)->core.sensitive) { + XSetRegion(XtDisplay(self), ((XfwfLabelWidget)self)->xfwfLabel.graygc, reg); + XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfLabelWidget)self)->xfwfLabel.graygc, rect.x, + rect.y, rect.width, rect.height); + XSetClipMask(XtDisplay(self), ((XfwfLabelWidget)self)->xfwfLabel.graygc, None); + } + XSetClipMask(XtDisplay(self), ((XfwfLabelWidget)self)->xfwfLabel.gc, None); + XSetClipMask(XtDisplay(self), ((XfwfLabelWidget)self)->xfwfLabel.rv_gc, None); + + XDestroyRegion (reg); /* MF038 */ + } +} diff --git a/vendor/x11iraf/obm/ObmW/Label.h b/vendor/x11iraf/obm/ObmW/Label.h new file mode 100644 index 00000000..b23fc0a1 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Label.h @@ -0,0 +1,130 @@ +/* Generated by wbuild from "Label.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfLabel_H_ +#define _XfwfLabel_H_ +#include "Board.h" +#ifndef XtNlabel +#define XtNlabel "label" +#endif +#ifndef XtCLabel +#define XtCLabel "Label" +#endif +#ifndef XtRString +#define XtRString "String" +#endif + +#ifndef XtNtablist +#define XtNtablist "tablist" +#endif +#ifndef XtCTablist +#define XtCTablist "Tablist" +#endif +#ifndef XtRString +#define XtRString "String" +#endif + +#ifndef XtNfont +#define XtNfont "font" +#endif +#ifndef XtCFont +#define XtCFont "Font" +#endif +#ifndef XtRFontStruct +#define XtRFontStruct "FontStruct" +#endif + +#ifndef XtNforeground +#define XtNforeground "foreground" +#endif +#ifndef XtCForeground +#define XtCForeground "Foreground" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNalignment +#define XtNalignment "alignment" +#endif +#ifndef XtCAlignment +#define XtCAlignment "Alignment" +#endif +#ifndef XtRAlignment +#define XtRAlignment "Alignment" +#endif + +#ifndef XtNtopMargin +#define XtNtopMargin "topMargin" +#endif +#ifndef XtCTopMargin +#define XtCTopMargin "TopMargin" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNbottomMargin +#define XtNbottomMargin "bottomMargin" +#endif +#ifndef XtCBottomMargin +#define XtCBottomMargin "BottomMargin" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNleftMargin +#define XtNleftMargin "leftMargin" +#endif +#ifndef XtCLeftMargin +#define XtCLeftMargin "LeftMargin" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNrightMargin +#define XtNrightMargin "rightMargin" +#endif +#ifndef XtCRightMargin +#define XtCRightMargin "RightMargin" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNshrinkToFit +#define XtNshrinkToFit "shrinkToFit" +#endif +#ifndef XtCShrinkToFit +#define XtCShrinkToFit "ShrinkToFit" +#endif +#ifndef XtRBoolean +#define XtRBoolean "Boolean" +#endif + +#ifndef XtNrvStart +#define XtNrvStart "rvStart" +#endif +#ifndef XtCRvStart +#define XtCRvStart "RvStart" +#endif +#ifndef XtRInt +#define XtRInt "Int" +#endif + +#ifndef XtNrvLength +#define XtNrvLength "rvLength" +#endif +#ifndef XtCRvLength +#define XtCRvLength "RvLength" +#endif +#ifndef XtRInt +#define XtRInt "Int" +#endif + +typedef struct _XfwfLabelClassRec *XfwfLabelWidgetClass; +typedef struct _XfwfLabelRec *XfwfLabelWidget; +externalref WidgetClass xfwfLabelWidgetClass; +#endif /*_XfwfLabel_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Label.man b/vendor/x11iraf/obm/ObmW/Label.man new file mode 100644 index 00000000..bd1e223c --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Label.man @@ -0,0 +1,732 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfLabel +.SH DESCRIPTION +The Label class has the capability to display one or more lines of +text in a single font. Otherwise it is the same as the Board class. +The text can be left, right or center justified and it can be centered +vertically or put against the top or the bottom of the widget. There +is also a resource to set tab stops. + +The text is `grayed out' when the widget becomes insensitive +(resource: \fIsensitive\fP), even though a Label widget has no actions of +its own. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfLabel +Name Class Type Default +XtNlabel XtCLabel String NULL +XtNtablist XtCTablist String NULL +XtNfont XtCFont FontStruct XtDefaultFont +XtNforeground XtCForeground Pixel XtDefaultForeground +XtNalignment XtCAlignment Alignment 0 +XtNtopMargin XtCTopMargin Dimension 2 +XtNbottomMargin XtCBottomMargin Dimension 2 +XtNleftMargin XtCLeftMargin Dimension 2 +XtNrightMargin XtCRightMargin Dimension 2 +XtNshrinkToFit XtCShrinkToFit Boolean False +XtNrvStart XtCRvStart Int 0 +XtNrvLength XtCRvLength Int 0 + +.TE +.ps + +.TP +.I "XtNlabel" +The text is a single string, which may contain embedded newlines. +There is no provision for changing fonts in the middle of a text. + + + +.hi + +.nf +String label = NULL +.fi + +.eh + +.TP +.I "XtNtablist" +A tablist can be provided for tabbing to particular columns +within the label. + + + +.hi + +.nf +String tablist = NULL +.fi + +.eh + +.TP +.I "XtNfont" +The text is drawn in the font which is give as the \fIfont\fP resource. + + + +.hi + +.nf +<FontStruct> XFontStruct * font = <String>XtDefaultFont +.fi + +.eh + +.TP +.I "XtNforeground" +The foreground color is the color used to draw the text. + + + +.hi + +.nf +Pixel foreground = <String>XtDefaultForeground +.fi + +.eh + +.TP +.I "XtNalignment" +The text can be aligned in the widget in nine ways: left, right or +center, combined with top, center or bottom. Symbolic constants +\fIXfwfTop\fP, \fIXfwfBottom\fP, \fIXfwfLeft\fP and \fIXfwfRight\fP can be added together to +get the desired alignment. The alignment is actually a four-bit +number made up of two parts of 2 bits added together: 1 is left, 2 is +right, 0 is center, 4 is top, 8 is bottom, 0 is vertical center. Thus +5 (= 1 + 4) means top left and 2 (= 2 + 0) means center right. For +easier specification, there is also a converter from strings, that +accepts string like `top left' or `center right'. + + + +.hi + +.nf +Alignment alignment = 0 +.fi + +.eh + +.TP +.I "XtNtopMargin" +The \fItopmargin\fP is only used when the text is not centered. It gives +the number of pixels between the frame and the top of the text. + + + +.hi + +.nf +Dimension topMargin = 2 +.fi + +.eh + +.TP +.I "XtNbottomMargin" +The \fIbottomMargin\fP is only used to compute the preferred size of the +button in case \fIshrinkToFit = True\fP. + + + +.hi + +.nf +Dimension bottomMargin = 2 +.fi + +.eh + +.TP +.I "XtNleftMargin" +The \fIleftMargin\fP is only used when the text is not centered. It +gives the number of pixels between the frame and the left edge of the +text, and if possible also between the frame and the right edge of the +text. + + + +.hi + +.nf +Dimension leftMargin = 2 +.fi + +.eh + +.TP +.I "XtNrightMargin" +The \fIrightMargin\fP is only used to compute the preferred size of the +button in case \fIshrinkToFit = True\fP. + + + +.hi + +.nf +Dimension rightMargin = 2 +.fi + +.eh + +.TP +.I "XtNshrinkToFit" +Buttons will normally not occupy the full area of their parents. +Most likely they will be a fixed size or a size depending on the +label. By setting the \fIshrinkToFit\fP resource to True, the width and +height are recomputed with every new label. + + + +.hi + +.nf +Boolean shrinkToFit = False +.fi + +.eh + +.TP +.I "XtNrvStart" +It is possible to set a part of the label apart by drawing it in +reverse. The \fIrvStart\fP resource gives the index of the first +character to draw in reverse video. + + + +.hi + +.nf +int rvStart = 0 +.fi + +.eh + +.TP +.I "XtNrvLength" +The \fIrvLength\fP resource contains the number of characters to +draw in reverse video. + + + +.hi + +.nf +int rvLength = 0 +.fi + +.eh + +.TP +.I "XtNtraversalOn" +A label normally needs no keyboard interface, therefore traversal is +turned off. + + + +.hi + +.nf + traversalOn = False +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.hi +.SH "Importss" + +.nf + +.B incl + "stip4.bm" +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.nf + +.B incl + <Xfwf/TabString.h> +.fi + +.hi + +.hi +.SS "Private variables" + +For faster drawing, the number of lines in the text is stored in a +private variable by the \fIset_values\fP and \fIinitialize\fP methods. + + + +.nf +int nlines +.fi + +The tablist is converted from string format to a list of int's for speed. + + + +.nf +int * tabs +.fi + +For drawing the text, this GC is used. + + + +.nf +GC gc +.fi + +This GC is for the text that is drawn in reverse video. + + + +.nf +GC rv_gc +.fi + +For graying out the text, another GC is used. + + + +.nf +GC graygc +.fi + +When the \fIshrinkToFit\fP resource is set, we need the minimum area +necessary for the complete label to be visible. \fIlabel_width\fP and +\fIlabel_height\fP include the size of \fImargin\fP. + + + +.nf +Dimension label_width +.fi + +.nf +Dimension label_height +.fi + +.hi + +.hi +.SS "Methods" + +The new method \fIset_label\fP makes a copy of the string that is passed +in, counts the number of lines and also draws the new label. This +could have been done in \fIset_values\fP, but it is expected that +subclasses will redraw the label frequently, so a more efficient way +is provided. + +Note that this method does not resize the widget in case \fIshrinkToFit\fP +is set. + +.nf +set_label($, String newlabel) +{ + Position x, y; + Dimension w, h; + + XtFree($label); + $label = XtNewString(newlabel); + count_lines($); + if (XtIsRealized($)) { + $compute_inside($, x, y, w, h); + XClearArea(XtDisplay($), XtWindow($), x, y, w, h, True); + /* $expose($, NULL, NULL); */ + } +} +.fi + +The \fIset_values\fP method checks the \fIbackground\fP resource, because is +is used in the GC \fIgraygc\fP. When the text or the font change, the +private variables \fInlines\fP, \fIlabel_height\fP and \fIlabel_width\fP are +updated. + +\fIneed_count\fP is set to \fITrue\fP if the size of the label changes. +\fIneed_count\fP implies \fIneed_redisplay\fP. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_redisplay = False, need_count = False; + Position x, y; + Dimension w, h, wd, ht; + + if ($background_pixel != $old$background_pixel) + make_graygc($); + + if ($tablist != $old$tablist) { + XtFree((String) $old$tabs); + $tabs = XfwfTablist2Tabs($tablist); + if ($label != NULL) need_count = True; + } + + if ($font != $old$font) { + make_gc($); + if ($label != NULL) need_count = True; + } + if ($foreground != $old$foreground + || $background_pixel != $old$background_pixel) { + make_gc($); + if ($label != NULL) need_redisplay = True; + } + if ($topMargin != $old$topMargin + || $bottomMargin != $old$bottomMargin + || $leftMargin != $old$leftMargin + || $rightMargin != $old$rightMargin) + need_count = True; + + if ($sensitive != $old$sensitive) + if ($label != NULL) need_redisplay = True; + + if ($rvStart != $old$rvStart || $rvLength != $old$rvLength) + if ($label != NULL) need_redisplay = True; + + if ($label != $old$label) { + XtFree($old$label); + $label = XtNewString($label); + need_count = True; + } + if (need_count) { + count_lines($); + need_redisplay = True; + } + if (need_count $shrinkToFit) { + $compute_inside($, x, y, w, h); + wd = $label_width + $width - w; + ht = $label_height + $height - h; + if (wd != $width || ht != $height) { + $set_abs_location($, CWWidth | CWHeight, 0, 0, wd, ht); + need_redisplay = False; + } + } + return need_redisplay; +} +.fi + +The \fIinitialize\fP methods creates the first GC's and initializes the +private variables. It sets the GC's to \fINULL\fP and calls two utility +routines to actually create them. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + char *s; + Position x, y; + Dimension w, h, wd, ht; + + if ($label) $label = XtNewString($label); + count_lines($); + $gc = NULL; + $rv_gc = NULL; + $graygc = NULL; + make_gc($); + make_graygc($); + $tabs = XfwfTablist2Tabs($tablist); + if ($shrinkToFit) { + $compute_inside($, x, y, w, h); + wd = $label_width + $width - w; + ht = $label_height + $height - h; + $set_abs_location($, CWWidth | CWHeight, 0, 0, wd, ht); + } +} +.fi + +The \fIexpose\fP method is responsible for drawing the text. The text is +put in the position given in \fIalignment\fP. The text is always kept +within the frame. If necessary, the text is clipped. The routine ends +by calling the \fIexpose\fP method from the superclass, which is +responsible for drawing the frame. + +The part of the text that is to appear in reverse video is drawn with +the \fIrv_gc\fP GC. + +\fBdef\fP draw_line(dpy, win, from, to) = +do { + if ($rvStart >= to) rstart = to; + else rstart = max($rvStart, from); + if ($rvStart + $rvLength <= from) rend = rstart; + else rend = min($rvStart + $rvLength, to); + w1 = XfwfTextWidth($font, $label + from, rstart - from, $tabs); + w2 = XfwfTextWidth($font, $label + rstart, rend - rstart, $tabs); + w3 = XfwfTextWidth($font, $label + rend, to - rend, $tabs); + if ($alignment XfwfLeft) + x = rect.x; + else if ($alignment XfwfRight) + x = rect.x + rect.width - w1 - w2 - w3; + else + x = rect.x + (rect.width - w1 - w2 - w3)/2; + if (w1) + XfwfDrawImageString(dpy, win, $gc, x, y, $label + from, + rstart - from, $tabs); + if (w2) + XfwfDrawImageString(dpy, win, $rv_gc, x + w1, y, $label + + rstart, rend - rstart, $tabs); + if (w3) + XfwfDrawImageString(dpy, win, $gc, x + w1 + w2, y, $label + + rend, to - rend, $tabs); + }while (0 ) + +.nf +expose($, XEvent * event, Region region) +{ + Region reg; + XRectangle rect; + int baseline; + int w1, w2, w3; + char *s, *t; + int x, y, i, j, rstart, rend; + + if (! XtIsRealized($)) return; + #expose($, event, region); + if ($label != NULL) { + baseline = $font->ascent + $font->descent; + $compute_inside($, rect.x, rect.y, rect.width, rect.height); + rect.x += $leftMargin; rect.width -= $leftMargin + $rightMargin; + rect.y += $topMargin; rect.height -= $topMargin + $bottomMargin; + reg = XCreateRegion(); + XUnionRectWithRegion(rect, reg, reg); + if (region != NULL) XIntersectRegion(region, reg, reg); + XSetRegion(XtDisplay($), $gc, reg); + XSetRegion(XtDisplay($), $rv_gc, reg); + if ($alignment XfwfTop) + y = rect.y + $font->ascent; + else if ($alignment XfwfBottom) + y = rect.y + rect.height - $nlines * baseline + $font->ascent; + else + y = rect.y + (rect.height - $nlines * baseline)/2 + $font->ascent; + for (i = 0, j = 0; $label[i]; i++) { + if ($label[i] == '\\n') { + draw_line(XtDisplay($), XtWindow($), j, i); + j = i + 1; + y += baseline; + } + } + draw_line(XtDisplay($), XtWindow($), j, i); + + /* Gray out if not sensitive */ + if (! $sensitive) { + XSetRegion(XtDisplay($), $graygc, reg); + XFillRectangle(XtDisplay($), XtWindow($), $graygc, rect.x, + rect.y, rect.width, rect.height); + XSetClipMask(XtDisplay($), $graygc, None); + } + XSetClipMask(XtDisplay($), $gc, None); + XSetClipMask(XtDisplay($), $rv_gc, None); + } +} +.fi + +.hi + +.hi +.SH "Utilities" + +The \fImake_gc\fP routine creates the GC for the text. + +.nf +make_gc($) +{ + XtGCMask mask; + XGCValues values; + + if ($gc != NULL) XtReleaseGC($, $gc); + values.background = $background_pixel; + values.foreground = $foreground; + values.font = $font->fid; + mask = GCFont | GCBackground | GCForeground; + $gc = XtGetGC($, mask, values); + + if ($rv_gc != NULL) XtReleaseGC($, $rv_gc); + values.foreground = $background_pixel; + values.background = $foreground; + values.font = $font->fid; + mask = GCFont | GCBackground | GCForeground; + $rv_gc = XtGetGC($, mask, values); +} +.fi + +The \fImake_graygc\fP routine creates a GC for graying out the text. It +contains a stipple in the background color, that will be applied over +the text. + +.nf +make_graygc($) +{ + XtGCMask mask; + XGCValues values; + + if ($graygc != NULL) XtReleaseGC($, $graygc); + values.foreground = $background_pixel; + values.stipple = + XCreateBitmapFromData(XtDisplay($), + RootWindowOfScreen(XtScreen($)), + stip4_bits, stip4_width, stip4_height); + values.fill_style = FillStippled; + mask = GCForeground | GCStipple | GCFillStyle; + $graygc = XtGetGC($, mask, values); +} +.fi + +The funtion \fIcount_lines\fP computes the correct values for the +private variables \fInlines\fP, \fIlabel_width\fP and \fIlabel_height\fP. + +.nf +count_lines($) +{ + String p, s; + int w; + + $nlines = 0; + $label_width = 0; + if ($label) { + for (p = $label, $nlines = 1, s = $label; *s; s++) { + if (*s == '\\n') { + $nlines++; + w = XfwfTextWidth($font, p, s - p, $tabs); + p = s + 1; + if (w > $label_width) $label_width = w; + } + } + w = XfwfTextWidth($font, p, s - p, $tabs); + if (w > $label_width) $label_width = w; + } + $label_height = $nlines * ($font->ascent + $font->descent); + $label_width += $leftMargin + $rightMargin; + $label_height += $topMargin + $bottomMargin; +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/LabelP.h b/vendor/x11iraf/obm/ObmW/LabelP.h new file mode 100644 index 00000000..962b20ee --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/LabelP.h @@ -0,0 +1,89 @@ +/* Generated by wbuild from "Label.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfLabelP_H_ +#define _XfwfLabelP_H_ +#include "BoardP.h" +#include "Label.h" +typedef void (*set_label_Proc)( +#if NeedFunctionPrototypes +Widget,String +#endif +); +#define XtInherit_set_label ((set_label_Proc) _XtInherit) +typedef struct { +/* methods */ +set_label_Proc set_label; +#define draw_line(dpy, win, from, to) do {\ + if (((XfwfLabelWidget)self)->xfwfLabel.rvStart >= to) rstart = to;\ + else rstart = max(((XfwfLabelWidget)self)->xfwfLabel.rvStart, from);\ + if (((XfwfLabelWidget)self)->xfwfLabel.rvStart + ((XfwfLabelWidget)self)->xfwfLabel.rvLength <= from) rend = rstart;\ + else rend = min(((XfwfLabelWidget)self)->xfwfLabel.rvStart + ((XfwfLabelWidget)self)->xfwfLabel.rvLength, to);\ + w1 = XfwfTextWidth(((XfwfLabelWidget)self)->xfwfLabel.font, ((XfwfLabelWidget)self)->xfwfLabel.label + from, rstart - from, ((XfwfLabelWidget)self)->xfwfLabel.tabs);\ + w2 = XfwfTextWidth(((XfwfLabelWidget)self)->xfwfLabel.font, ((XfwfLabelWidget)self)->xfwfLabel.label + rstart, rend - rstart, ((XfwfLabelWidget)self)->xfwfLabel.tabs);\ + w3 = XfwfTextWidth(((XfwfLabelWidget)self)->xfwfLabel.font, ((XfwfLabelWidget)self)->xfwfLabel.label + rend, to - rend, ((XfwfLabelWidget)self)->xfwfLabel.tabs);\ + if (((XfwfLabelWidget)self)->xfwfLabel.alignment & XfwfLeft)\ + x = rect.x;\ + else if (((XfwfLabelWidget)self)->xfwfLabel.alignment & XfwfRight)\ + x = rect.x + rect.width - w1 - w2 - w3;\ + else\ + x = rect.x + (rect.width - w1 - w2 - w3)/2;\ + if (w1)\ + XfwfDrawImageString(dpy, win, ((XfwfLabelWidget)self)->xfwfLabel.gc, x, y, ((XfwfLabelWidget)self)->xfwfLabel.label + from,\ + rstart - from, ((XfwfLabelWidget)self)->xfwfLabel.tabs);\ + if (w2)\ + XfwfDrawImageString(dpy, win, ((XfwfLabelWidget)self)->xfwfLabel.rv_gc, x + w1, y, ((XfwfLabelWidget)self)->xfwfLabel.label\ + + rstart, rend - rstart, ((XfwfLabelWidget)self)->xfwfLabel.tabs);\ + if (w3)\ + XfwfDrawImageString(dpy, win, ((XfwfLabelWidget)self)->xfwfLabel.gc, x + w1 + w2, y, ((XfwfLabelWidget)self)->xfwfLabel.label +\ + rend, to - rend, ((XfwfLabelWidget)self)->xfwfLabel.tabs);\ + }while (0 ) + + +/* class variables */ +} XfwfLabelClassPart; +typedef struct _XfwfLabelClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfLabelClassPart xfwfLabel_class; +} XfwfLabelClassRec; + +typedef struct { +/* resources */ +String label; +String tablist; +XFontStruct * font; +Pixel foreground; +Alignment alignment; +Dimension topMargin; +Dimension bottomMargin; +Dimension leftMargin; +Dimension rightMargin; +Boolean shrinkToFit; +int rvStart; +int rvLength; +/* private state */ +int nlines; +int * tabs; +GC gc; +GC rv_gc; +GC graygc; +Dimension label_width; +Dimension label_height; +} XfwfLabelPart; + +typedef struct _XfwfLabelRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfLabelPart xfwfLabel; +} XfwfLabelRec; + +externalref XfwfLabelClassRec xfwfLabelClassRec; + +#endif /* _XfwfLabelP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Layout.c b/vendor/x11iraf/obm/ObmW/Layout.c new file mode 100644 index 00000000..e623320e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Layout.c @@ -0,0 +1,965 @@ +/* + * $XConsortium: Layout.c,v 1.1 91/09/13 18:51:44 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/Converters.h> + +#include "LayoutP.h" + +#include <ctype.h> +#include <stdio.h> + +/***************************************************************************** + * + * Full instance record declaration + * + ****************************************************************************/ + +#define offset(field) XtOffsetOf(LayoutRec, layout.field) + +static XtResource resources[] = { + {XtNlayout, XtCLayout, XtRLayout, sizeof (BoxPtr), + offset(layout), XtRLayout, NULL }, + {XtNdebug, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(debug), XtRImmediate, (XtPointer) FALSE}, +}; + +#undef offset + +static void ClassInitialize(), Initialize(); +static void Resize(); +static Boolean SetValues(); +static XtGeometryResult GeometryManager(); +static void ChangeManaged(); +static void InsertChild(); +static XtGeometryResult QueryGeometry (); +static void GetDesiredSize (); + +static void LayoutLayout (); +static void LayoutGetNaturalSize (); +static void LayoutFreeLayout (); + +extern void LayYYsetsource(), LayYYsetdest(); +extern int LayYYparse(); + +#define SuperClass ((ConstraintWidgetClass)&constraintClassRec) + +LayoutClassRec layoutClassRec = { + { +/* core class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class name */ "Layout", + /* size */ sizeof(LayoutRec), + /* class_initialize */ ClassInitialize, + /* class_part init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ 0, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, { +/* composite class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ InsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, { +/* constraint class fields */ + /* subresources */ NULL, + /* subresource_count */ 0, + /* constraint_size */ sizeof(LayoutConstraintsRec), + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL + } +}; + +WidgetClass layoutWidgetClass = (WidgetClass) &layoutClassRec; + +#define ForAllChildren(pw, childP) \ + for ( (childP) = (pw)->composite.children ; \ + (childP) < (pw)->composite.children + (pw)->composite.num_children ; \ + (childP)++ ) if (!XtIsManaged(*childP)) ; else + +/************************************************************ + * + * Semi-public routines. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: The Layout widgets class initialization proc. + * Arguments: none. + * Returns: none. + */ + +/*ARGSUSED*/ +static Boolean +CvtStringToLayout (dpy, args, num_args, from, to, converter_data) + Display *dpy; + XrmValue *args; + Cardinal *num_args; + XrmValue *from, *to; + XtPointer *converter_data; +{ + static BoxPtr tmp; + LayYYsetsource ((char *) from->addr); + if (!to->addr) to->addr = (XtPointer)&tmp; + LayYYsetdest ((BoxPtr *) to->addr); + to->size = sizeof (BoxPtr *); + if (LayYYparse () == 0) + return TRUE; + else + return FALSE; +} + +/*ARGSUSED*/ +static void +DisposeLayout (app, to, data, args, num_args) + XtAppContext app; + XrmValue *to; + XtPointer data; + XrmValuePtr args; + Cardinal *num_args; +{ + LayoutFreeLayout (* (LayoutPtr *) to->addr); +} + +static void +ClassInitialize() +{ + XtSetTypeConverter ( XtRString, XtRLayout, CvtStringToLayout, + (XtConvertArgList)NULL, (Cardinal)0, XtCacheNone, + DisposeLayout ); +} + +/*ARGSUSED*/ +static XtGeometryResult GeometryManager(child, request, reply) + Widget child; + XtWidgetGeometry *request, *reply; +{ + LayoutWidget w = (LayoutWidget) XtParent(child); + SubInfoPtr p = SubInfo(child); + int bw; + Bool changed, bwChanged; + + bw = p->naturalBw; + changed = FALSE; + bwChanged = FALSE; + if (request->request_mode & CWBorderWidth && + request->border_width != child->core.border_width) + { + p->naturalBw = bw; + bw = request->border_width; + changed = TRUE; + bwChanged = TRUE; + } + if (bwChanged || ((request->request_mode & CWWidth) && + request->width != child->core.width)) + { + p->naturalSize[LayoutHorizontal] = request->width + bw * 2; + changed = TRUE; + } + if (bwChanged || ((request->request_mode & CWHeight) && + request->height != child->core.height)) + { + p->naturalSize[LayoutVertical] = request->height + bw * 2; + changed = TRUE; + } + if (changed) + LayoutLayout (w, TRUE); + return XtGeometryDone; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ +/* LayoutWidget w = (LayoutWidget)new; */ +} + +static void ChangeManaged(gw) + Widget gw; +{ + LayoutWidget w = (LayoutWidget) gw; + Widget *children; + + ForAllChildren (w, children) + GetDesiredSize (*children); + LayoutLayout ((LayoutWidget) w, TRUE); +} + +static void +GetDesiredSize (child) + Widget child; +{ + XtWidgetGeometry desired; + SubInfoPtr p; + + XtQueryGeometry (child, (XtWidgetGeometry *) NULL, &desired); + p = SubInfo (child); + p->naturalBw = desired.border_width; + p->naturalSize[LayoutHorizontal] = desired.width + desired.border_width * 2; + p->naturalSize[LayoutVertical] = desired.height + desired.border_width * 2; +} + +static void InsertChild (child) + Widget child; +{ + (*SuperClass->composite_class.insert_child) (child); + GetDesiredSize (child); +} + +static void +Resize(gw) + Widget gw; +{ + LayoutLayout ((LayoutWidget) gw, FALSE); +} + +/* ARGSUSED */ +static Boolean +SetValues(gold, greq, gnew, args, num_args) + Widget gold, greq, gnew; + ArgList args; + Cardinal *num_args; +{ + LayoutWidget old = (LayoutWidget) gold, + new = (LayoutWidget) gnew; + + if (old->layout.layout != new->layout.layout) + LayoutLayout (new, TRUE); + return FALSE; +} /* SetValues */ + +static XtGeometryResult +QueryGeometry (gw, request, prefered_return) + Widget gw; + XtWidgetGeometry *request, *prefered_return; +{ + LayoutWidget w = (LayoutWidget) gw; + XtGeometryResult result; + XtWidgetGeometry prefered_size; + + if (request && !(request->request_mode & (CWWidth|CWHeight))) + return XtGeometryYes; + LayoutGetNaturalSize (w, &prefered_size.width, &prefered_size.height); + prefered_return->request_mode = 0; + result = XtGeometryYes; + if (!request) { + prefered_return->width = prefered_size.width; + prefered_return->height= prefered_size.height; + if (prefered_size.width != w->core.width) { + prefered_return->request_mode |= CWWidth; + result = XtGeometryAlmost; + } + if (prefered_size.height != w->core.height) { + prefered_return->request_mode |= CWHeight; + result = XtGeometryAlmost; + } + } else { + if (request->request_mode & CWWidth) { + if (prefered_size.width > request->width) + { + if (prefered_size.width == w->core.width) + result = XtGeometryNo; + else if (result != XtGeometryNo) { + result = XtGeometryAlmost; + prefered_return->request_mode |= CWWidth; + prefered_return->width = prefered_size.width; + } + } + } + if (request->request_mode & CWHeight) { + if (prefered_size.height > request->height) + { + if (prefered_size.height == w->core.height) + result = XtGeometryNo; + else if (result != XtGeometryNo) { + result = XtGeometryAlmost; + prefered_return->request_mode |= CWHeight; + prefered_return->height = prefered_size.height; + } + } + } + } + return result; +} + +/* + * Layout section. Exports LayoutGetNaturalSize and + * LayoutLayout to above section + */ + +static void +PrintGlue (g) + GlueRec g; +{ + if (g.order == 0 || g.value != 1.0) + (void) printf ("%g", g.value); + if (g.order > 0) + { + (void) printf ("%s", " inf"); + if (g.order > 1) + (void) printf (" %d", g.order); + } +} + +static void +PrintDirection (dir) + LayoutDirection dir; +{ + switch (dir) { + case LayoutHorizontal: + (void) printf ("%s", "horizontal"); + break; + case LayoutVertical: + (void) printf ("%s", "vertical"); + break; + default: + (void) printf ("Unknown layout direction %d\n", dir); + break; + + } +} + +static void +TabTo(level) + int level; +{ + while (level--) + (void) printf ("%s", " "); +} + +static void +PrintBox (box, level) + BoxPtr box; + int level; +{ + BoxPtr child; + + TabTo (level); + (void) printf ("%s", "< "); + (void) printf ("%s", " + "); + PrintGlue (box->params.stretch[LayoutHorizontal]); + (void) printf ("%s", " - "); + PrintGlue (box->params.shrink[LayoutHorizontal]); + (void) printf ("%s", " * "); + (void) printf ("%s", " + "); + PrintGlue (box->params.stretch[LayoutVertical]); + (void) printf ("%s", " - "); + PrintGlue (box->params.shrink[LayoutVertical]); + (void) printf ("%s", " >"); + (void) printf (" size: %d x %d", box->size[0], box->size[1]); + (void) printf (" natural: %d x %d ", box->natural[0], box->natural[1]); + switch (box->type) { + case BoxBox: + PrintDirection (box->u.box.dir); + (void) printf ("%s\n", ""); + for (child = box->u.box.firstChild; child; child = child->nextSibling) + PrintBox (child, level+1); + break; + case WidgetBox: + (void) printf (" %s\n", XrmQuarkToString (box->u.widget.quark)); + break; + case GlueBox: + (void) printf ("%s\n", " glue"); + break; + case VariableBox: + (void) printf (" variable %s\n", XrmQuarkToString (box->u.variable.quark)); + break; + } +} + +static ExprPtr +LookupVariable (child, quark) + BoxPtr child; + XrmQuark quark; +{ + BoxPtr parent, box; + + while ((parent = child->parent)) + { + for (box = parent->u.box.firstChild; + box != child; + box = box->nextSibling) + { + if (box->type == VariableBox && box->u.variable.quark == quark) + return box->u.variable.expr; + } + child = parent; + } + return 0; +} + +static double +Evaluate (l, box, expr, natural) + LayoutWidget l; + BoxPtr box; + ExprPtr expr; + double natural; +{ + double left, right, down; + Widget widget; + SubInfoPtr info; + + switch (expr->type) { + case Constant: + return expr->u.constant; + case Binary: + left = Evaluate (l, box, expr->u.binary.left, natural); + right = Evaluate (l, box, expr->u.binary.right, natural); + switch (expr->u.binary.op) { + case Plus: + return left + right; + case Minus: + return left - right; + case Times: + return left * right; + case Divide: + return left / right; + case Percent: + return right * left / 100.0; + } + case Unary: + down = Evaluate (l, box, expr->u.unary.down, natural); + switch (expr->u.unary.op) { + case Percent: + return natural * down / 100.0; + case Minus: + return -down; + case Plus: + case Times: + case Divide: + break; + } + case Width: + widget = QuarkToWidget (l, expr->u.width); + if (!widget) + return 0; + info = SubInfo (widget); + return info->naturalSize[LayoutHorizontal]; + case Height: + widget = QuarkToWidget (l, expr->u.height); + if (!widget) + return 0; + info = SubInfo (widget); + return info->naturalSize[LayoutVertical]; + case Variable: + expr = LookupVariable (box, expr->u.variable); + if (!expr) + { + char buf[256]; + (void) sprintf (buf, "Layout: undefined variable %s\n", + XrmQuarkToString (expr->u.variable)); + XtError (buf); + return 0.0; + } + return Evaluate (l, box, expr, natural); + } + return 0.0; +} + +static void +DisposeExpr (expr) + ExprPtr expr; +{ + if (!expr) + return; + switch (expr->type) { + case Constant: + break; + case Binary: + DisposeExpr (expr->u.binary.left); + DisposeExpr (expr->u.binary.right); + break; + case Unary: + DisposeExpr (expr->u.unary.down); + break; + case Width: + case Height: + case Variable: + break; + } + Dispose (expr); +} + +#define CheckGlue(l, box, glue, n) { \ + if (glue.expr) \ + glue.value = Evaluate (l, box, glue.expr, n); \ + if (glue.order == 0 && glue.value == 0) \ + glue.order = -1; \ + else if (glue.order == -1 && glue.value != 0) \ + glue.order = 0; \ +} + +#define DoStretch(l, box, dir) \ + CheckGlue (l, box, box->params.stretch[dir], (double) box->natural[dir]); + +#define DoShrink(l, box, dir) \ + CheckGlue (l, box, box->params.shrink[dir], (double) box->natural[dir]) + +/* compute the natural sizes of a box */ +static void +ComputeNaturalSizes (l, box, dir) + LayoutWidget l; + BoxPtr box; + LayoutDirection dir; +{ + BoxPtr child; + Widget w; + SubInfoPtr info; + int minStretchOrder, minShrinkOrder; + LayoutDirection thisDir; + + switch (box->type) { + case WidgetBox: + w = box->u.widget.widget = QuarkToWidget (l, box->u.widget.quark); + if (!w) + { + box->natural[LayoutHorizontal] = 0; + box->natural[LayoutVertical] = 0; + } + else + { + info = SubInfo (w); + box->natural[LayoutHorizontal] = info->naturalSize[LayoutHorizontal]; + box->natural[LayoutVertical] = info->naturalSize[LayoutVertical]; + } + DoStretch (l, box, dir); + DoShrink (l, box, dir); + DoStretch (l, box, !dir); + DoShrink (l, box, !dir); + break; + case GlueBox: + box->natural[dir] = Evaluate (l, box, box->u.glue.expr, 0.0); + box->natural[!dir] = 0; + DoStretch (l, box, dir); + DoShrink (l, box, dir); + break; + case BoxBox: + thisDir = box->u.box.dir; + box->natural[0] = 0; + box->natural[1] = 0; + minStretchOrder = 100000; + minShrinkOrder = 100000; + ZeroGlue (box->params.shrink[thisDir]); + ZeroGlue (box->params.stretch[thisDir]); + box->params.shrink[!thisDir].order = 100000; + box->params.stretch[!thisDir].order = 100000; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + + ComputeNaturalSizes (l, child, thisDir); + /* + * along box axis: + * normal size += child normal size + * shrink += child shrink + * stretch += child stretch + */ + box->natural[thisDir] += child->natural[thisDir]; + AddGlue (box->params.shrink[thisDir], + box->params.shrink[thisDir], + child->params.shrink[thisDir]); + AddGlue (box->params.stretch[thisDir], + box->params.stretch[thisDir], + child->params.stretch[thisDir]); + /* + * normal to box axis: + * normal size = maximum child normal size of minimum shrink order + * shrink = difference between normal size and minimum shrink + * stretch = minimum child stretch + */ + if (box->natural[!thisDir] >= child->natural[!thisDir]) + { + if (child->params.stretch[!thisDir].order < minShrinkOrder) + { + box->natural[!thisDir] = child->natural[!thisDir]; + minStretchOrder = child->params.stretch[!thisDir].order; + if (child->params.shrink[!thisDir].order < minShrinkOrder) + minShrinkOrder = child->params.shrink[!thisDir].order; + } + } + else + { + if (child->params.shrink[!thisDir].order <= minStretchOrder) + { + box->natural[!thisDir] = child->natural[!thisDir]; + minShrinkOrder = child->params.shrink[!thisDir].order; + if (child->params.stretch[!thisDir].order < minStretchOrder) + minStretchOrder = child->params.stretch[!thisDir].order; + } + } + MinGlue (box->params.stretch[!thisDir], + box->params.stretch[!thisDir], + child->params.stretch[!thisDir]); + MinGlue (box->params.shrink[!thisDir], + box->params.shrink[!thisDir], + child->params.shrink[!thisDir]); + } + if (box->params.shrink[!thisDir].order <= 0) + { + int minSize; + int largestMinSize; + + largestMinSize = 0; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + + if (child->params.shrink[!thisDir].order <= 0) + { + minSize = child->natural[!thisDir] - + child->params.shrink[!thisDir].value; + if (minSize > largestMinSize) + largestMinSize = minSize; + } + } + box->params.shrink[!thisDir].value = box->natural[!thisDir] - + largestMinSize; + if (box->params.shrink[!thisDir].value == 0) + box->params.shrink[!thisDir].order = -1; + else + box->params.shrink[!thisDir].order = 0; + } + /* 24Jan97 MJF - VariableBox is excluded above. + break; + case VariableBox: + break; + */ + } +} + +/* given the boxs geometry, set the geometry of the pieces */ + +#define GluePart(a,b,dist) ((a) ? ((int) (((a) * (dist)) / (b) + \ + ((dist >= 0) ? 0.5 : -0.5))) : 0) + +static Bool +ComputeSizes (box) + BoxPtr box; +{ + LayoutDirection dir; + BoxPtr child; + GlueRec stretch; + GlueRec shrink; + GlueRec totalGlue[2]; + double remainingGlue; + GluePtr glue; + int size; + int totalSizes; + int totalChange[2]; + int change; + int remainingChange; + Bool shrinking; + Bool happy; + int i; + int maxGlue; + + dir = box->u.box.dir; + size = box->size[dir]; + + stretch = box->params.stretch[dir]; + shrink = box->params.shrink[dir]; + + /* pick the correct adjustment parameters based on the change direction */ + + totalChange[0] = size - box->natural[dir]; + + shrinking = totalChange[0] < 0; + + totalChange[1] = 0; + totalGlue[1].order = 100000; + totalGlue[1].value = 0; + maxGlue = 1; + if (shrinking) + { + totalGlue[0] = shrink; + /* for first-order infinites, shrink it to zero and then + * shrink the zero-orders + */ + if (shrink.order == 1) { + totalSizes = 0; + remainingGlue = 0; + for (child = box->u.box.firstChild; + child; + child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + + switch (child->params.shrink[dir].order) { + case 0: + remainingGlue += child->params.shrink[dir].value; + break; + case 1: + totalSizes += child->natural[dir]; + break; + } + } + if (totalSizes < -totalChange[0]) + { + totalGlue[1] = shrink; + totalGlue[0].order = 0; + totalGlue[0].value = remainingGlue; + totalChange[1] = -totalSizes; + totalChange[0] = totalChange[0] - totalChange[1]; + maxGlue = 2; + } + } + if (totalGlue[0].order <= 0 && + totalChange[0] > totalGlue[0].value) + { + totalChange[0] = totalGlue[0].value; + } + } + else + totalGlue[0] = stretch; + + /* adjust each box */ + totalSizes = 0; + remainingGlue = totalGlue[0].value + totalGlue[1].value; + remainingChange = totalChange[0] + totalChange[1]; + happy = True; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* never add glue or stretch to a VariableBox! */ + if (child->type == VariableBox) continue; + + if (shrinking) + glue = &child->params.shrink[dir]; + else + glue = &child->params.stretch[dir]; + + child->size[dir] = child->natural[dir]; + for (i = 0; i < maxGlue; i++) + { + if (glue->order == totalGlue[i].order) + { + remainingGlue -= glue->value; + if (remainingGlue <= 0) + change = remainingChange; + else + change = GluePart (glue->value, + totalGlue[i].value, + totalChange[i]); + child->size[dir] += change; + remainingChange -= change; + } + } + child->size[!dir] = box->size[!dir]; + totalSizes += child->size[dir]; + if (child->type == BoxBox) + if (!ComputeSizes (child)) + happy = False; + } + return totalSizes == box->size[dir] && happy; +} + +static void +SetSizes (box, x, y) + BoxPtr box; + Position x, y; +{ + BoxPtr child; + int width, height; + int bw; + Widget w; + SubInfoPtr info; + + switch (box->type) { + case WidgetBox: + w = box->u.widget.widget; + if (w) + { + info = SubInfo(w); + /* info = (SubInfoPtr) w->core.constraints; */ + width = box->size[LayoutHorizontal]; + height = box->size[LayoutVertical]; + bw = info->naturalBw; + width -= bw * 2; + height -= bw * 2; + /* Widgets which grow too small are placed off screen */ + if (width <= 0 || height <= 0) + { + width = 1; + height = 1; + bw = 0; + x = -1; + y = -1; + } + XtConfigureWidget (w, x, y, + (Dimension)width, (Dimension)height, + (Dimension)bw); + } + break; + case BoxBox: + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 18Mar94 DCT - omit VariableBox here. */ + if (child->type != VariableBox) { + SetSizes (child, x, y); + if (box->u.box.dir == LayoutHorizontal) + x += child->size[LayoutHorizontal]; + else + y += child->size[LayoutVertical]; + } + } + break; + case GlueBox: + case VariableBox: + break; + } +} + +static void +LayoutFreeLayout (box) + BoxPtr box; +{ + BoxPtr child, next; + + switch (box->type) { + case BoxBox: + for (child = box->u.box.firstChild; child; child = next) + { + next = child->nextSibling; + LayoutFreeLayout (child); + } + break; + case GlueBox: + DisposeExpr (box->u.glue.expr); + break; + case WidgetBox: + case VariableBox: + default: + break; + } + DisposeExpr (box->params.stretch[LayoutHorizontal].expr); + DisposeExpr (box->params.shrink[LayoutHorizontal].expr); + DisposeExpr (box->params.stretch[LayoutVertical].expr); + DisposeExpr (box->params.shrink[LayoutVertical].expr); + Dispose (box); +} + + +static void +LayoutGetNaturalSize (l, widthp, heightp) + LayoutWidget l; + Dimension *widthp, *heightp; +{ + BoxPtr box; + + box = l->layout.layout; + if (box) + { + ComputeNaturalSizes (l, box, LayoutHorizontal); + *widthp = box->natural[LayoutHorizontal]; + *heightp = box->natural[LayoutVertical]; + } + else + { + *widthp = 0; + *heightp = 0; + } +} + +static void +LayoutLayout (l, attemptResize) + LayoutWidget l; + Bool attemptResize; +{ + BoxPtr box; + Dimension width, height; + Dimension prefered_width, prefered_height; + + box = l->layout.layout; + if (!box) + return; + LayoutGetNaturalSize (l, &prefered_width, &prefered_height); + if (l->core.width == 0 || l->core.height == 0) + { + l->core.width = prefered_width; + l->core.height = prefered_height; + } + box->size[LayoutHorizontal] = l->core.width; + box->size[LayoutVertical] = l->core.height; + if (!ComputeSizes (box) && attemptResize) + { + XtMakeResizeRequest ((Widget) l, + prefered_width, prefered_height, + &width, &height); + if (width != box->size[LayoutHorizontal] || + height != box->size[LayoutVertical]) + { + box->size[LayoutHorizontal] = width; + box->size[LayoutVertical] = height; + ComputeSizes (box); + } + } + if (l->layout.debug) + { + printf ("------------------- %s layout ------------------\n", + l->core.name); + PrintBox (box, 0); + fflush (stdout); + } + SetSizes (box, 0, 0); +} + diff --git a/vendor/x11iraf/obm/ObmW/Layout.c.ORIG b/vendor/x11iraf/obm/ObmW/Layout.c.ORIG new file mode 100644 index 00000000..d11b036a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Layout.c.ORIG @@ -0,0 +1,952 @@ +/* + * $XConsortium: Layout.c,v 1.1 91/09/13 18:51:44 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/Converters.h> + +#include "LayoutP.h" + +#include <ctype.h> +#include <stdio.h> + +/***************************************************************************** + * + * Full instance record declaration + * + ****************************************************************************/ + +#define offset(field) XtOffsetOf(LayoutRec, layout.field) + +static XtResource resources[] = { + {XtNlayout, XtCLayout, XtRLayout, sizeof (BoxPtr), + offset(layout), XtRLayout, NULL }, + {XtNdebug, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(debug), XtRImmediate, (XtPointer) FALSE}, +}; + +#undef offset + +static void ClassInitialize(), Initialize(); +static void Resize(); +static Boolean SetValues(); +static XtGeometryResult GeometryManager(); +static void ChangeManaged(); +static void InsertChild(); +static XtGeometryResult QueryGeometry (); +static void GetDesiredSize (); + +static void LayoutLayout (); +static void LayoutGetNaturalSize (); +static void LayoutFreeLayout (); + +extern void LayYYsetsource(), LayYYsetdest(); +extern int LayYYparse(); + +#define SuperClass ((ConstraintWidgetClass)&constraintClassRec) + +LayoutClassRec layoutClassRec = { + { +/* core class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class name */ "Layout", + /* size */ sizeof(LayoutRec), + /* class_initialize */ ClassInitialize, + /* class_part init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ FALSE, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, { +/* composite class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ InsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, { +/* constraint class fields */ + /* subresources */ NULL, + /* subresource_count */ 0, + /* constraint_size */ sizeof(LayoutConstraintsRec), + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL + } +}; + +WidgetClass layoutWidgetClass = (WidgetClass) &layoutClassRec; + +#define ForAllChildren(pw, childP) \ + for ( (childP) = (pw)->composite.children ; \ + (childP) < (pw)->composite.children + (pw)->composite.num_children ; \ + (childP)++ ) if (!XtIsManaged(*childP)) ; else + +/************************************************************ + * + * Semi-public routines. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: The Layout widgets class initialization proc. + * Arguments: none. + * Returns: none. + */ + +/*ARGSUSED*/ +static Boolean +CvtStringToLayout (dpy, args, num_args, from, to, converter_data) + Display *dpy; + XrmValue *args; + Cardinal *num_args; + XrmValue *from, *to; + XtPointer *converter_data; +{ + LayYYsetsource ((char *) from->addr); + LayYYsetdest ((BoxPtr *) to->addr); + if (LayYYparse () == 0) + return TRUE; + else + return FALSE; +} + +/*ARGSUSED*/ +static void +DisposeLayout (app, to, data, args, num_args) + XtAppContext app; + XrmValue *to; + XtPointer data; + XrmValuePtr args; + Cardinal *num_args; +{ + LayoutFreeLayout (* (LayoutPtr *) to->addr); +} + +static void +ClassInitialize() +{ + XtSetTypeConverter ( XtRString, XtRLayout, CvtStringToLayout, + (XtConvertArgList)NULL, (Cardinal)0, XtCacheNone, + DisposeLayout ); +} + +/*ARGSUSED*/ +static XtGeometryResult GeometryManager(child, request, reply) + Widget child; + XtWidgetGeometry *request, *reply; +{ + LayoutWidget w = (LayoutWidget) XtParent(child); + SubInfoPtr p = SubInfo(child); + int bw; + Bool changed, bwChanged; + + bw = p->naturalBw; + changed = FALSE; + bwChanged = FALSE; + if (request->request_mode & CWBorderWidth && + request->border_width != child->core.border_width) + { + p->naturalBw = bw; + bw = request->border_width; + changed = TRUE; + bwChanged = TRUE; + } + if (bwChanged || request->request_mode & CWWidth && + request->width != child->core.width) + { + p->naturalSize[LayoutHorizontal] = request->width + bw * 2; + changed = TRUE; + } + if (bwChanged || request->request_mode & CWHeight && + request->height != child->core.height) + { + p->naturalSize[LayoutVertical] = request->height + bw * 2; + changed = TRUE; + } + if (changed) + LayoutLayout (w, TRUE); + return XtGeometryDone; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ +/* LayoutWidget w = (LayoutWidget)new; */ +} + +static void ChangeManaged(gw) + Widget gw; +{ + LayoutWidget w = (LayoutWidget) gw; + Widget *children; + + ForAllChildren (w, children) + GetDesiredSize (*children); + LayoutLayout ((LayoutWidget) w, TRUE); +} + +static void +GetDesiredSize (child) + Widget child; +{ + XtWidgetGeometry desired; + SubInfoPtr p; + + XtQueryGeometry (child, (XtWidgetGeometry *) NULL, &desired); + p = SubInfo (child); + p->naturalBw = desired.border_width; + p->naturalSize[LayoutHorizontal] = desired.width + desired.border_width * 2; + p->naturalSize[LayoutVertical] = desired.height + desired.border_width * 2; +} + +static void InsertChild (child) + Widget child; +{ + (*SuperClass->composite_class.insert_child) (child); + GetDesiredSize (child); +} + +static void +Resize(gw) + Widget gw; +{ + LayoutLayout ((LayoutWidget) gw, FALSE); +} + +/* ARGSUSED */ +static Boolean +SetValues(gold, greq, gnew, args, num_args) + Widget gold, greq, gnew; + ArgList args; + Cardinal *num_args; +{ + LayoutWidget old = (LayoutWidget) gold, + new = (LayoutWidget) gnew; + + if (old->layout.layout != new->layout.layout) + LayoutLayout (new, TRUE); + return FALSE; +} /* SetValues */ + +static XtGeometryResult +QueryGeometry (gw, request, prefered_return) + Widget gw; + XtWidgetGeometry *request, *prefered_return; +{ + LayoutWidget w = (LayoutWidget) gw; + XtGeometryResult result; + XtWidgetGeometry prefered_size; + + if (request && !(request->request_mode & CWWidth|CWHeight)) + return XtGeometryYes; + LayoutGetNaturalSize (w, &prefered_size.width, &prefered_size.height); + prefered_return->request_mode = 0; + result = XtGeometryYes; + if (!request) { + prefered_return->width = prefered_size.width; + prefered_return->height= prefered_size.height; + if (prefered_size.width != w->core.width) { + prefered_return->request_mode |= CWWidth; + result = XtGeometryAlmost; + } + if (prefered_size.height != w->core.height) { + prefered_return->request_mode |= CWHeight; + result = XtGeometryAlmost; + } + } else { + if (request->request_mode & CWWidth) { + if (prefered_size.width > request->width) + { + if (prefered_size.width == w->core.width) + result = XtGeometryNo; + else if (result != XtGeometryNo) { + result = XtGeometryAlmost; + prefered_return->request_mode |= CWWidth; + prefered_return->width = prefered_size.width; + } + } + } + if (request->request_mode & CWHeight) { + if (prefered_size.height > request->height) + { + if (prefered_size.height == w->core.height) + result = XtGeometryNo; + else if (result != XtGeometryNo) { + result = XtGeometryAlmost; + prefered_return->request_mode |= CWHeight; + prefered_return->height = prefered_size.height; + } + } + } + } + return result; +} + +/* + * Layout section. Exports LayoutGetNaturalSize and + * LayoutLayout to above section + */ + +static void +PrintGlue (g) + GlueRec g; +{ + if (g.order == 0 || g.value != 1.0) + (void) printf ("%g", g.value); + if (g.order > 0) + { + (void) printf ("%s", " inf"); + if (g.order > 1); + (void) printf (" %d", g.order); + } +} + +static void +PrintDirection (dir) + LayoutDirection dir; +{ + switch (dir) { + case LayoutHorizontal: + (void) printf ("%s", "horizontal"); + break; + case LayoutVertical: + (void) printf ("%s", "vertical"); + break; + default: + (void) printf ("Unknown layout direction %d\n", dir); + break; + + } +} + +static void +TabTo(level) + int level; +{ + while (level--) + (void) printf ("%s", " "); +} + +static void +PrintBox (box, level) + BoxPtr box; + int level; +{ + BoxPtr child; + + TabTo (level); + (void) printf ("%s", "< "); + (void) printf ("%s", " + "); + PrintGlue (box->params.stretch[LayoutHorizontal]); + (void) printf ("%s", " - "); + PrintGlue (box->params.shrink[LayoutHorizontal]); + (void) printf ("%s", " * "); + (void) printf ("%s", " + "); + PrintGlue (box->params.stretch[LayoutVertical]); + (void) printf ("%s", " - "); + PrintGlue (box->params.shrink[LayoutVertical]); + (void) printf ("%s", " >"); + (void) printf (" size: %d x %d", box->size[0], box->size[1]); + (void) printf (" natural: %d x %d ", box->natural[0], box->natural[1]); + switch (box->type) { + case BoxBox: + PrintDirection (box->u.box.dir); + (void) printf ("%s\n", ""); + for (child = box->u.box.firstChild; child; child = child->nextSibling) + PrintBox (child, level+1); + break; + case WidgetBox: + (void) printf (" %s\n", XrmQuarkToString (box->u.widget.quark)); + break; + case GlueBox: + (void) printf ("%s\n", " glue"); + break; + case VariableBox: + (void) printf (" variable %s\n", XrmQuarkToString (box->u.variable.quark)); + break; + } +} + +ExprPtr +LookupVariable (child, quark) + BoxPtr child; + XrmQuark quark; +{ + BoxPtr parent, box; + + while (parent = child->parent) + { + for (box = parent->u.box.firstChild; + box != child; + box = box->nextSibling) + { + if (box->type == VariableBox && box->u.variable.quark == quark) + return box->u.variable.expr; + } + child = parent; + } + return 0; +} + +static double +Evaluate (l, box, expr, natural) + LayoutWidget l; + BoxPtr box; + ExprPtr expr; + double natural; +{ + double left, right, down; + Widget widget; + SubInfoPtr info; + + switch (expr->type) { + case Constant: + return expr->u.constant; + case Binary: + left = Evaluate (l, box, expr->u.binary.left, natural); + right = Evaluate (l, box, expr->u.binary.right, natural); + switch (expr->u.binary.op) { + case Plus: + return left + right; + case Minus: + return left - right; + case Times: + return left * right; + case Divide: + return left / right; + case Percent: + return right * left / 100.0; + } + case Unary: + down = Evaluate (l, box, expr->u.unary.down, natural); + switch (expr->u.unary.op) { + case Percent: + return natural * down / 100.0; + case Minus: + return -down; + } + case Width: + widget = QuarkToWidget (l, expr->u.width); + if (!widget) + return 0; + info = SubInfo (widget); + return info->naturalSize[LayoutHorizontal]; + case Height: + widget = QuarkToWidget (l, expr->u.height); + if (!widget) + return 0; + info = SubInfo (widget); + return info->naturalSize[LayoutVertical]; + case Variable: + expr = LookupVariable (box, expr->u.variable); + if (!expr) + { + char buf[256]; + (void) sprintf (buf, "Layout: undefined variable %s\n", + XrmQuarkToString (expr->u.variable)); + XtError (buf); + return 0.0; + } + return Evaluate (l, box, expr, natural); + } +} + +static void +DisposeExpr (expr) + ExprPtr expr; +{ + if (!expr) + return; + switch (expr->type) { + case Constant: + break; + case Binary: + DisposeExpr (expr->u.binary.left); + DisposeExpr (expr->u.binary.right); + break; + case Unary: + DisposeExpr (expr->u.unary.down); + break; + case Width: + break; + case Height: + break; + + } + Dispose (expr); +} + +#define CheckGlue(l, box, glue, n) { \ + if (glue.expr) \ + glue.value = Evaluate (l, box, glue.expr, n); \ + if (glue.order == 0 && glue.value == 0) \ + glue.order = -1; \ + else if (glue.order == -1 && glue.value != 0) \ + glue.order = 0; \ +} + +#define DoStretch(l, box, dir) \ + CheckGlue (l, box, box->params.stretch[dir], (double) box->natural[dir]); + +#define DoShrink(l, box, dir) \ + CheckGlue (l, box, box->params.shrink[dir], (double) box->natural[dir]) + +/* compute the natural sizes of a box */ +static void +ComputeNaturalSizes (l, box, dir) + LayoutWidget l; + BoxPtr box; + LayoutDirection dir; +{ + BoxPtr child; + Widget w; + SubInfoPtr info; + int minStretchOrder, minShrinkOrder; + LayoutDirection thisDir; + + switch (box->type) { + case VariableBox: + box->natural[LayoutHorizontal] = 0; + box->natural[LayoutVertical] = 0; + break; + + case WidgetBox: + w = box->u.widget.widget = QuarkToWidget (l, box->u.widget.quark); + if (!w) + { + box->natural[LayoutHorizontal] = 0; + box->natural[LayoutVertical] = 0; + } + else + { + info = SubInfo (w); + box->natural[LayoutHorizontal] = info->naturalSize[LayoutHorizontal]; + box->natural[LayoutVertical] = info->naturalSize[LayoutVertical]; + } + DoStretch (l, box, dir); + DoShrink (l, box, dir); + DoStretch (l, box, !dir); + DoShrink (l, box, !dir); + break; + case GlueBox: + box->natural[dir] = Evaluate (l, box, box->u.glue.expr, 0.0); + box->natural[!dir] = 0; + DoStretch (l, box, dir); + DoShrink (l, box, dir); + break; + case BoxBox: + thisDir = box->u.box.dir; + box->natural[0] = 0; + box->natural[1] = 0; + minStretchOrder = 100000; + minShrinkOrder = 100000; + ZeroGlue (box->params.shrink[thisDir]); + ZeroGlue (box->params.stretch[thisDir]); + box->params.shrink[!thisDir].order = 100000; + box->params.stretch[!thisDir].order = 100000; + + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + + ComputeNaturalSizes (l, child, thisDir); + /* + * along box axis: + * normal size += child normal size + * shrink += child shrink + * stretch += child stretch + */ + box->natural[thisDir] += child->natural[thisDir]; + AddGlue (box->params.shrink[thisDir], + box->params.shrink[thisDir], + child->params.shrink[thisDir]); + AddGlue (box->params.stretch[thisDir], + box->params.stretch[thisDir], + child->params.stretch[thisDir]); + /* + * normal to box axis: + * normal size = maximum child normal size of minimum shrink order + * shrink = difference between normal size and minimum shrink + * stretch = minimum child stretch + */ + if (box->natural[!thisDir] >= child->natural[!thisDir]) + { + if (child->params.stretch[!thisDir].order < minShrinkOrder) + { + box->natural[!thisDir] = child->natural[!thisDir]; + minStretchOrder = child->params.stretch[!thisDir].order; + if (child->params.shrink[!thisDir].order < minShrinkOrder) + minShrinkOrder = child->params.shrink[!thisDir].order; + } + } + else + { + if (child->params.shrink[!thisDir].order <= minStretchOrder) + { + box->natural[!thisDir] = child->natural[!thisDir]; + minShrinkOrder = child->params.shrink[!thisDir].order; + if (child->params.stretch[!thisDir].order < minStretchOrder) + minStretchOrder = child->params.stretch[!thisDir].order; + } + } + MinGlue (box->params.stretch[!thisDir], + box->params.stretch[!thisDir], + child->params.stretch[!thisDir]); + MinGlue (box->params.shrink[!thisDir], + box->params.shrink[!thisDir], + child->params.shrink[!thisDir]); + } + if (box->params.shrink[!thisDir].order <= 0) + { + int minSize; + int largestMinSize; + + largestMinSize = 0; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + if (child->params.shrink[!thisDir].order <= 0) + { + minSize = child->natural[!thisDir] - + child->params.shrink[!thisDir].value; + if (minSize > largestMinSize) + largestMinSize = minSize; + } + } + box->params.shrink[!thisDir].value = box->natural[!thisDir] - + largestMinSize; + if (box->params.shrink[!thisDir].value == 0) + box->params.shrink[!thisDir].order = -1; + else + box->params.shrink[!thisDir].order = 0; + } + } +} + +/* given the boxs geometry, set the geometry of the pieces */ + +#define GluePart(a,b,dist) ((a) ? ((int) (((a) * (dist)) / (b) + \ + ((dist >= 0) ? 0.5 : -0.5))) : 0) + +static Bool +ComputeSizes (box) + BoxPtr box; +{ + LayoutDirection dir; + BoxPtr child; + GlueRec stretch; + GlueRec shrink; + GlueRec totalGlue[2]; + double remainingGlue; + GluePtr glue; + int size; + int totalSizes; + int totalChange[2]; + int change; + int remainingChange; + Bool shrinking; + Bool happy; + int i; + int maxGlue; + + dir = box->u.box.dir; + size = box->size[dir]; + + stretch = box->params.stretch[dir]; + shrink = box->params.shrink[dir]; + + /* pick the correct adjustment parameters based on the change direction */ + + totalChange[0] = size - box->natural[dir]; + + shrinking = totalChange[0] < 0; + + totalChange[1] = 0; + totalGlue[1].order = 100000; + totalGlue[1].value = 0; + maxGlue = 1; + if (shrinking) + { + totalGlue[0] = shrink; + /* for first-order infinites, shrink it to zero and then + * shrink the zero-orders + */ + if (shrink.order == 1) { + totalSizes = 0; + remainingGlue = 0; + for (child = box->u.box.firstChild; + child; + child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + switch (child->params.shrink[dir].order) { + case 0: + remainingGlue += child->params.shrink[dir].value; + break; + case 1: + totalSizes += child->natural[dir]; + break; + } + } + if (totalSizes < -totalChange[0]) + { + totalGlue[1] = shrink; + totalGlue[0].order = 0; + totalGlue[0].value = remainingGlue; + totalChange[1] = -totalSizes; + totalChange[0] = totalChange[0] - totalChange[1]; + maxGlue = 2; + } + } + if (totalGlue[0].order <= 0 && + totalChange[0] > totalGlue[0].value) + { + totalChange[0] = totalGlue[0].value; + } + } + else + totalGlue[0] = stretch; + + /* adjust each box */ + totalSizes = 0; + remainingGlue = totalGlue[0].value + totalGlue[1].value; + remainingChange = totalChange[0] + totalChange[1]; + happy = True; + + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 02Jan95 DCT - omit VariableBox here. */ + if (child->type == VariableBox) + continue; + + if (shrinking) + glue = &child->params.shrink[dir]; + else + glue = &child->params.stretch[dir]; + + child->size[dir] = child->natural[dir]; + for (i = 0; i < maxGlue; i++) + { + if (glue->order == totalGlue[i].order) + { + remainingGlue -= glue->value; + if (remainingGlue <= 0) + change = remainingChange; + else + change = GluePart (glue->value, + totalGlue[i].value, + totalChange[i]); + child->size[dir] += change; + remainingChange -= change; + } + } + child->size[!dir] = box->size[!dir]; + totalSizes += child->size[dir]; + if (child->type == BoxBox) + if (!ComputeSizes (child)) + happy = False; + } + return totalSizes == box->size[dir] && happy; +} + +static void +SetSizes (box, x, y) + BoxPtr box; + Position x, y; +{ + BoxPtr child; + int width, height; + int bw; + Widget w; + SubInfoPtr info; + + switch (box->type) { + case WidgetBox: + w = box->u.widget.widget; + if (w) + { + info = (SubInfoPtr) w->core.constraints; + width = box->size[LayoutHorizontal]; + height = box->size[LayoutVertical]; + bw = info->naturalBw; + width -= bw * 2; + height -= bw * 2; + /* Widgets which grow too small are placed off screen */ + if (width <= 0 || height <= 0) + { + width = 1; + height = 1; + bw = 0; + x = -1; + y = -1; + } + XtConfigureWidget (w, x, y, + (Dimension)width, (Dimension)height, + (Dimension)bw); + } + break; + case GlueBox: + break; + case BoxBox: + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* 18Mar94 DCT - omit VariableBox here. */ + if (child->type != VariableBox) { + SetSizes (child, x, y); + if (box->u.box.dir == LayoutHorizontal) + x += child->size[LayoutHorizontal]; + else + y += child->size[LayoutVertical]; + } + } + break; + } +} + +static void +LayoutFreeLayout (box) + BoxPtr box; +{ + BoxPtr child, next; + + switch (box->type) { + case BoxBox: + for (child = box->u.box.firstChild; child; child = next) + { + next = child->nextSibling; + LayoutFreeLayout (child); + } + break; + case GlueBox: + DisposeExpr (box->u.glue.expr); + break; + } + DisposeExpr (box->params.stretch[LayoutHorizontal].expr); + DisposeExpr (box->params.shrink[LayoutHorizontal].expr); + DisposeExpr (box->params.stretch[LayoutVertical].expr); + DisposeExpr (box->params.shrink[LayoutVertical].expr); + Dispose (box); +} + + +static void +LayoutGetNaturalSize (l, widthp, heightp) + LayoutWidget l; + Dimension *widthp, *heightp; +{ + BoxPtr box; + + box = l->layout.layout; + if (box) + { + ComputeNaturalSizes (l, box, LayoutHorizontal); + *widthp = box->natural[LayoutHorizontal]; + *heightp = box->natural[LayoutVertical]; + } + else + { + *widthp = 0; + *heightp = 0; + } +} + +static void +LayoutLayout (l, attemptResize) + LayoutWidget l; + Bool attemptResize; +{ + BoxPtr box; + Dimension width, height; + Dimension prefered_width, prefered_height; + + box = l->layout.layout; + if (!box) + return; + LayoutGetNaturalSize (l, &prefered_width, &prefered_height); + if (l->core.width == 0 || l->core.height == 0) + { + l->core.width = prefered_width; + l->core.height = prefered_height; + } + box->size[LayoutHorizontal] = l->core.width; + box->size[LayoutVertical] = l->core.height; + if (!ComputeSizes (box) && attemptResize) + { + XtMakeResizeRequest ((Widget) l, + prefered_width, prefered_height, + &width, &height); + if (width != box->size[LayoutHorizontal] || + height != box->size[LayoutVertical]) + { + box->size[LayoutHorizontal] = width; + box->size[LayoutVertical] = height; + ComputeSizes (box); + } + } + if (l->layout.debug) + { + printf ("------------------- %s layout ------------------\n", l->core.name); + PrintBox (box, 0); + fflush (stdout); + } + SetSizes (box, 0, 0); +} + diff --git a/vendor/x11iraf/obm/ObmW/Layout.ex b/vendor/x11iraf/obm/ObmW/Layout.ex new file mode 100644 index 00000000..828fae45 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Layout.ex @@ -0,0 +1,463 @@ +Sample layout resources from various app-defaults files. +---------------------------- + +*layout: vertical { \ + NormalSpace = (25 % of height cards) \ + NormalAdjust = 25% \ + horizontal {\ + $NormalSpace < +infinity -$NormalSpace > \ + label1 label2 label3 \ + $NormalSpace < +infinity -$NormalSpace > \ + } \ + horizontal {\ + cards < * +infinity -$NormalAdjust > \ + 0 < +infinity > \ + } \ + } + +*menuBar.layout: vertical { \ + 5 < -5 >\ + horizontal { \ + 5 < -5 > \ + fileMenuButton \ + 5 < -5 > \ + newGame \ + 5 < -5 > \ + undo \ + 5 < -5 > \ + hint \ + 5 < -5 > \ + score \ + 5 < -5 > \ + pileAll \ + 5 <+inf -inf> \ + baseRank \ + 5 < -5 > \ + } \ + 5 < -5 > \ +} + +*frame.layout: vertical {\ + -1 \ + horizontal {\ + -1 \ + menuBar < +inff -100% * >\ + -1 \ + } \ + 10 < -inf > \ + horizontal { \ + 0 < +inf -inf > \ + vertical { \ + 0 < +inf -inf > \ + logo \ + 0 < +inf -inf > \ + } \ + 0 < +inf -inf > \ + foundation < -100% * -90% > \ + 10 < -inf > \ + } \ + 10 < -inf > \ + horizontal {\ + 10 < -inf > \ + vertical { \ + horizontal { \ + stock < -75% * -90% > \ + 0 < +inf > \ + } \ + 10 < -inf > \ + talon < -75% * -90% > \ + } \ + 10 < +inf -inf > \ + tableau < -50% * +inf -50% > \ + 10 < -inf > \ + } \ + horizontal { \ + -1 \ + message < +inff -100% * > \ + -1 \ + } \ + -1 \ +} + +*menuBar.layout: vertical { \ + 5 < -5 >\ + horizontal { \ + 5 < -5 > \ + fileMenuButton \ + 5 < -5 > \ + newGame \ + 5 < -5 > \ + undo \ + 5 < -5 > \ + hint \ + 5 < -5 > \ + score \ + 5 < -5 > \ + pileAll \ + 0 <+inf -inf> \ + } \ + 5 < -5 > \ +} + +*frame.layout: vertical {\ + -1 \ + horizontal {\ + -1 \ + menuBar < +inff -100% * >\ + -1 \ + } \ + 10 < -inf > \ + horizontal { \ + 10 < -inf > \ + deck < -75% * -90% > \ + 10 < +inf -inf > \ + piles < -100% * -90% > \ + 10 < -inf > \ + } \ + 10 < -inf > \ + stacks < -50% * +inf -50% > \ + horizontal { \ + -1 \ + message < +inff -100% * > \ + -1 \ + } \ + -1 \ +} + +*menuBar.layout: vertical { \ + 5 < -5 >\ + horizontal { \ + 5 < -5 > \ + fileMenuButton \ + 5 < -5 > \ + deal \ + 5 < -5 > \ + newGame \ + 5 < -5 > \ + undo \ + 5 < -5 > \ + score \ + 0 <+inf -inf> \ + } \ + 5 < -5 > \ +} + +*frame.layout: vertical {\ + -1 \ + horizontal {\ + -1 \ + menuBar < +inff -100% * >\ + -1 \ + } \ + 10 < -inf > \ + cards < +100% -100% * +100% -100% > \ + horizontal { \ + -1 \ + dealDisplay < -100% * > \ + -1 \ + message < +inff -100% * > \ + -1 \ + } \ + -1 \ +} + +*menuBar.layout: vertical { \ + 5 < -5 >\ + horizontal { \ + 5 < -5 > \ + fileMenuButton \ + 5 < -5 > \ + newGame \ + 5 < -5 > \ + undo \ + 5 < -5 > \ + hint \ + 5 < -5 > \ + score \ + 0 <+inf -inf> \ + } \ + 5 < -5 > \ +} + +*frame.layout: vertical {\ + -1 \ + horizontal {\ + -1 \ + menuBar < +inff -100% * >\ + -1 \ + } \ + 10 < -inf > \ + horizontal { \ + 10 < -inf > \ + deck < -75% * -90% > \ + 10 < +inf -inf > \ + piles < -100% * -90% > \ + 10 < -inf > \ + } \ + 10 < -inf > \ + stacks < -50% * +inf -50% > \ + horizontal { \ + -1 \ + message < +inff -100% * > \ + -1 \ + } \ + -1 \ +} + +*menuBar.layout: vertical { \ + 5 < -5 >\ + horizontal { \ + 5 < -5 > \ + fileMenuButton \ + 5 < -5 > \ + newGame \ + 5 < -5 > \ + undo \ + 5 < -5 > \ + hint \ + 5 < -5 > \ + score \ + 0 <+inf -inf> \ + } \ + 5 < -5 > \ +} + +*frame.layout: vertical {\ + -1 \ + horizontal {\ + -1 \ + menuBar < +inff -100% * >\ + -1 \ + } \ + 10 < -inf > \ + horizontal { \ + 10 < -inf > \ + vertical { \ + stacks < -50% * +inf -50% > \ + 10 < -inf > \ + horizontal { \ + vertical { \ + 10 < +inf -inf > \ + draw < +inf -100% * -90% > \ + } \ + 10 < -inf > \ + vertical { \ + deckCount < +inf -inf * > \ + deck < -75% * -90% > \ + } \ + } \ + } \ + 10 < -inf > \ + vertical { \ + piles < -50% * -50% > \ + 0 < +inf > \ + } \ + 10 < -inf > \ + } \ + horizontal { \ + -1 \ + message < +inff -100% * > \ + -1 \ + } \ + -1 \ +} + +*menuBar.layout: vertical { \ + 5 < -5 >\ + horizontal { \ + 5 < -5 > \ + fileMenuButton \ + 5 < -5 > \ + newGame \ + 5 < -5 > \ + undo \ + 5 < -5 > \ + hint \ + 5 < -5 > \ + score \ + 5 < -5 > \ + pileAll \ + 0 <+inf -inf> \ + } \ + 5 < -5 > \ +} + +*frame.layout: vertical {\ + -1 \ + horizontal {\ + -1 \ + menuBar < +inff -100% * >\ + -1 \ + } \ + 10 < -inf > \ + horizontal { \ + 10 < -inf > \ + suits < -75% * -90% > \ + 10 < +inf -inf > \ + piles < -100% * -90% > \ + 10 < -inf > \ + } \ + 10 < -inf > \ + stacks < -50% * +inf -50% > \ + horizontal { \ + -1 \ + message < +inff -100% * > \ + -1 \ + } \ + -1 \ +} + +*layout.layout: horizontal {\n \ + -1 \n \ + vertical { \n \ + -1 \n \ + reversi < +inff -100% * +inff -100% > \n \ + -1 \n \ + error < +inff -100% * > \ + -1 \n \ + } \n \ + vertical { \n \ + 10 < +10 -100% > \n \ + horizontal { \ + 5 < +inf -100% > \n \ + quit \n \ + 5 < +inf -100% > \n \ + hint \n \ + 5 < +inf -100% > \n \ + undo \n \ + 5 < +inf -100% > \n \ + restart \n \ + 5 < +inf -100% > \n \ + } \n \ + 10 < +10 -100% > \n \ + horizontal { \n \ + 5 < -100% > \n \ + vertical { \n \ + horizontal { \n \ + playerLabel \n \ + 0 < +inf > \n \ + } \ + 10 < +10 - 100% > \n \ + horizontal { \n \ + playWhite \n \ + 5 < +inf -100% > \n \ + playBlack \n \ + 5 < +inf -100% > \n \ + playBoth \n \ + 5 < +inf -100% > \n \ + playNeither \n \ + } \n \ + } \n \ + 5 < +inf -100% > \n \ + } \n \ + 10 < +10 -100% > \n \ + horizontal { \n \ + 5 < -100% > \n \ + vertical { \ + 0 < +inf > \n \ + levelLabel \n \ + 0 < +inf > \n \ + } \n \ + 10 < -100% > \n \ + levelValue \n \ + 5 < +inf -100% > \n \ + } \n \ + 10 < +10 -100% > \n \ + horizontal { \n \ + 5 < -100% > \n \ + turn \n \ + 5 < +inf -100% > \n \ + } \n \ + 10 < +1000 -100% > \n \ + } \n \ +} + +*layout.layout: vertical {\ +MenuBarBorderWidth = 1\ +HumanHandBorderWidth = 1\ +-$MenuBarBorderWidth \ +horizontal { \ + -$MenuBarBorderWidth menuBar < +inf -100% * > -$MenuBarBorderWidth \ +} \ +horizontal { \ + vertical { \ + MinPlayHeight = 20 \ + MinPlayWidth = 550 \ + PlayVertShrink = (100% - $MinPlayHeight) \ + PlayHorzShrink = (100% - $MinPlayWidth) \ + computerPlay < -$PlayHorzShrink * +inf -$PlayVertShrink > \ + horizontal { \ + -1 \ + vertical { \ + computerMiles < +1 -100% * >\ + horizontal { \ + 0 < +inf > \ + vertical { \ + message \ + errors \ + 0 < +1 > \ + }\ + vertical { \ + deckCount < +inf -100% * >\ + deck < -100% * -100% > \ + 0 < +1 > \ + } \ + (width deck / 4) < -inf > \ + } \ + humanMiles < +1 -100% * > \ + } \ + 10 < -inf > \ + score < +1 * +1 > \ + } \ + humanPlay < -$PlayHorzShrink * +inf -$PlayVertShrink > \ + horizontal { \ + -$HumanHandBorderWidth \ + humanHand < -$PlayHorzShrink * -$PlayVertShrink > \ + } \ + -$HumanHandBorderWidth \ + } \ + vertical { \ + computerSafeties < -150% * -100% > \ + computerSafetyLabel < +inf -inf * > \ + 0 < +inf >\ + humanSafeties < -150% * -100% > \ + humanSafetyLabel < +inf -inf * >\ + } \ + 0 < +inf > \ +} \ +} + +*yesOrNoDialog.layout: vertical {\ + Spacing = (50 % of height yesOrNoLabel) \ + $Spacing < +inf -inf > \ + yesOrNoLabel \ + $Spacing < +inf -inf > \ + horizontal { \ + $Spacing < -inf > \ + yesOrNoOk \ + $Spacing < +inf -inf > \ + yesOrNoNo \ + $Spacing < -inf > \ + } \ + $Spacing < +inf -inf > \ +} + +*promptedDialog.layout: vertical {\ + Spacing = (20 % of height promptedLabel) \ + $Spacing < +inf -inf > \ + promptedLabel \ + $Spacing < +inf -inf > \ + horizontal { \ + $Spacing < -inf > \ + promptedValue \ + $Spacing < +inf -inf > \ + } \ + horizontal { \ + $Spacing < -inf > \ + promptedOk \ + $Spacing < +inf -inf > \ + promptedCancel \ + $Spacing < -inf > \ + } \ + $Spacing < +inf -inf > \ +} diff --git a/vendor/x11iraf/obm/ObmW/Layout.h b/vendor/x11iraf/obm/ObmW/Layout.h new file mode 100644 index 00000000..7d9e636a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Layout.h @@ -0,0 +1,94 @@ +/* + * $XConsortium: Layout.h,v 1.2 92/01/22 18:03:05 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + + +#ifndef _XawLayout_h +#define _XawLayout_h + +#include <X11/Constraint.h> +#include <X11/Xfuncproto.h> + +/**************************************************************** + * + * Layout Widget (SubClass of CompositeClass) + * + ****************************************************************/ + +/* RESOURCES: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + layout Layout Layout NULL + +*/ + +/* + * Syntax of layout resource + * + * *layout:\ + * <widget-name>.<edge>,<widget-name>.<edge>: distance + stretch-factor\n\ + * ... + * where the null widget-name is taken to be the Layout widget + * + * e.g: + * + * *label-1.hStretch: 0 + * *label-2.vStretch: 1 + * *layout:\ + * .left, label-1.left: 10 + 0\n\ + * label-1.right, label-2.left: 10 + 1\n\ + * label-2.right, .right: 10 + 0 + * + * This layout causes label-1 to be set 10 pixels from the left edge + * and be whatever size the label widget requests, while label-2 will + * be set 10 pixels from the right edge, and take up half of the remaining + * space to 10 pixels from the right edge of label-1. + */ + +/* New Fields */ +#define XtNlayout "layout" +#define XtCLayout "Layout" +#define XtRLayout "Layout" +#define XtNdebug "debug" + +/* Class record constant */ + +extern WidgetClass layoutWidgetClass; + +typedef struct _LayoutClassRec *LayoutWidgetClass; +typedef struct _LayoutRec *LayoutWidget; + +#endif /* _Layout_h */ diff --git a/vendor/x11iraf/obm/ObmW/Layout.ps.gz.mip b/vendor/x11iraf/obm/ObmW/Layout.ps.gz.mip new file mode 100644 index 00000000..e49074c6 Binary files /dev/null and b/vendor/x11iraf/obm/ObmW/Layout.ps.gz.mip differ diff --git a/vendor/x11iraf/obm/ObmW/LayoutP.h b/vendor/x11iraf/obm/ObmW/LayoutP.h new file mode 100644 index 00000000..d7cbb318 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/LayoutP.h @@ -0,0 +1,213 @@ +/* + * $XConsortium: LayoutP.h,v 1.2 92/01/22 18:03:08 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _XawLayoutP_h +#define _XawLayoutP_h + +#include "Layout.h" +#include <X11/ConstrainP.h> + +#define GlueEqual(a,b) ((a).order == (b).order && (a).value == (b).value) + +#define AddGlue(r,a,b) if (a.order == b.order) { \ + r.order = a.order; \ + r.value = a.value + b.value; \ + } else { \ + if (a.order > b.order) \ + r = a; \ + else \ + r = b; \ + } + +#define MinGlue(r,a,b) if (a.order == b.order) { \ + r.order = a.order; \ + if (a.value > b.value) \ + r.value = b.value; \ + else \ + r.value = a.value; \ + } else { \ + if (a.order > b.order) \ + r = b; \ + else \ + r = a; \ + } + +#define SubGlue(r,a,b) if (a.order == b.order) { \ + r.order = a.order; \ + r.value = a.value - b.value; \ + } else { \ + if (a.order > b.order) \ + r = a; \ + else { \ + r.order = b.order; \ + r.value = -b.value; \ + } \ + } + +#define ZeroGlue(g) ((g).value = 0, (g).order = 0, (g).expr = 0) +#define IsZeroGlue(g) ((g).value == 0) + +#define QuarkToWidget(l,q) XtNameToWidget((Widget) l, \ + (char *) XrmQuarkToString(q)); + +typedef enum _BoxType { BoxBox, WidgetBox, GlueBox, VariableBox } BoxType; + +typedef enum _LayoutDirection { + LayoutHorizontal = 0, LayoutVertical = 1 +} LayoutDirection; + +typedef enum _Operator { + Plus, Minus, Times, Divide, Percent +} Operator; + +typedef enum _ExprType { + Constant, + Binary, + Unary, + Width, + Height, + Variable +} ExprType; + +typedef struct _Expr *ExprPtr; + +typedef struct _Expr { + ExprType type; + union { + double constant; + struct { + Operator op; + ExprPtr left, right; + } binary; + struct { + Operator op; + ExprPtr down; + } unary; + XrmQuark width; + XrmQuark height; + XrmQuark variable; + } u; +} ExprRec; + +typedef struct _Glue { + int order; + double value; + ExprPtr expr; +} GlueRec, *GluePtr; + +typedef struct _BoxParams { + GlueRec stretch[2]; + GlueRec shrink[2]; +} BoxParamsRec, *BoxParamsPtr; + +typedef struct _Box *BoxPtr; + +typedef BoxPtr LayoutPtr; + +typedef struct _Box { + BoxPtr nextSibling; + BoxPtr parent; + BoxParamsRec params; + int size[2]; + int natural[2]; + BoxType type; + union { + struct { + BoxPtr firstChild; + LayoutDirection dir; + } box; + struct { + XrmQuark quark; + Widget widget; + } widget; + struct { + ExprPtr expr; + } glue; + struct { + XrmQuark quark; + ExprPtr expr; + } variable; + } u; +} LBoxRec; /* this conflicted with Box's BoxRec, besides, it's not used anywhere */ + +typedef struct _SubInfo { + int naturalSize[2]; + int naturalBw; +} SubInfoRec, *SubInfoPtr; + +#define New(t) (t *) XtCalloc(1,sizeof (t)) +#define Dispose(p) XtFree((char *) p) +#define Some(t,n) (t*) XtCalloc(1,sizeof(t) * n) +#define More(p,t,n) ((p)? (t *) XtRealloc((char *) p, sizeof(t)*n):Some(t,n) + +/********************************************************************* + * + * Layout Widget Private Data + * + *********************************************************************/ + +/* New fields for the Layout widget class record */ + +typedef struct _LayoutClassPart { + int foo; /* keep compiler happy. */ +} LayoutClassPart; + +/* Full Class record declaration */ +typedef struct _LayoutClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + LayoutClassPart layout_class; +} LayoutClassRec; + +extern LayoutClassRec layoutClassRec; + +typedef struct _LayoutConstraintsRec { + SubInfoRec layout; +} LayoutConstraintsRec, *LayoutConstraints; + +#define SubInfo(w) (&(((LayoutConstraints) (w)->core.constraints)->layout)) + +/* New Fields for the Layout widget record */ + +typedef struct { + /* resources */ + LayoutPtr layout; + Boolean debug; +} LayoutPart; + +/************************************************************************** + * + * Full instance record declaration + * + **************************************************************************/ + +typedef struct _LayoutRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + LayoutPart layout; +} LayoutRec; +#endif diff --git a/vendor/x11iraf/obm/ObmW/ListTree.c b/vendor/x11iraf/obm/ObmW/ListTree.c new file mode 100644 index 00000000..23d67475 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ListTree.c @@ -0,0 +1,2265 @@ +/*----------------------------------------------------------------------------- +** ListTree.c A Specialized List widget +** +** Widget source code +** +** Copyright (c) 1995 Robert W. McMullen +** +** Permission to use, copy, modify, distribute, and sell this software and its +** documentation for any purpose is hereby granted without fee, provided that +** the above copyright notice appear in all copies and that both that +** copyright notice and this permission notice appear in supporting +** documentation. The author makes no representations about the suitability +** of this software for any purpose. It is provided "as is" without express +** or implied warranty. +** +** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +** ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +** THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +** ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +** SOFTWARE. +*/ + +#define _ListTree_ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <stdio.h> +/*#include <stdlib.h> */ + +#include "ListTreeP.h" +#ifdef USE_RDD +#include "rdd.h" +#endif + + +#define USE_FOLDERS + +#ifdef USE_FOLDERS +#define folder_width 16 +#define folder_height 12 +static unsigned char folder_bits[] = +{ + 0x00, 0x1f, 0x80, 0x20, 0x7c, 0x5f, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, + 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0xfc, 0x3f, +}; + +#define folderopen_width 16 +#define folderopen_height 12 +static unsigned char folderopen_bits[] = +{ + 0x00, 0x3e, 0x00, 0x41, 0xf8, 0xd5, 0xac, 0xaa, 0x54, 0xd5, 0xfe, 0xaf, + 0x01, 0xd0, 0x02, 0xa0, 0x02, 0xe0, 0x04, 0xc0, 0x04, 0xc0, 0xf8, 0x7f, +}; + +#define document_width 9 +#define document_height 14 +static unsigned char document_bits[] = +{ + 0x1f, 0x00, 0x31, 0x00, 0x51, 0x00, 0x91, 0x00, 0xf1, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0xff, 0x01,}; + +#else +#define folder_width 12 +#define folder_height 12 +static unsigned char folder_bits[] = { + 0xff, 0x0f, 0x01, 0x08, 0x61, 0x08, 0x61, 0x08, 0x61, 0x08, 0xfd, 0x0b, + 0xfd, 0x0b, 0x61, 0x08, 0x61, 0x08, 0x61, 0x08, 0x01, 0x08, 0xff, 0x0f}; + +#define folderopen_width 12 +#define folderopen_height 12 +static unsigned char folderopen_bits[] = { + 0xff, 0x0f, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0xfd, 0x0b, + 0xfd, 0x0b, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0xff, 0x0f}; + +#define document_width 12 +#define document_height 12 +static unsigned char document_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xf0, 0x01, 0xf8, 0x03, + 0xf8, 0x03, 0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00}; + +#endif + +#define offset(field) XtOffsetOf(ListTreeRec, list.field) +static XtResource resources[] = +{ + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground_pixel), XtRString, XtDefaultForeground}, + {XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), + offset(Margin), XtRString, "2"}, + {XtNindent, XtCMargin, XtRDimension, sizeof(Dimension), + offset(Indent), XtRString, "0"}, + {XtNhorizontalSpacing, XtCMargin, XtRDimension, sizeof(Dimension), + offset(HSpacing), XtRString, "2"}, + {XtNverticalSpacing, XtCMargin, XtRDimension, sizeof(Dimension), + offset(VSpacing), XtRString, "0"}, + {XtNlineWidth, XtCMargin, XtRDimension, sizeof(Dimension), + offset(LineWidth), XtRString, "0"}, + {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + offset(font), XtRString, XtDefaultFont}, + {XtNbranchPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), + offset(Closed.bitmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, + {XtNbranchOpenPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), + offset(Open.bitmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, + {XtNleafPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), + offset(Leaf.bitmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, + {XtNleafOpenPixmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), + offset(LeafOpen.bitmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, + {XtNleafCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(LeafCallback), XtRCallback, NULL}, + {XtNbranchCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(BranchCallback), XtRCallback, NULL}, + {XtNpathCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(PathCallback), XtRCallback, NULL}, + {XtNhighlightCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(HighlightCallback), XtRCallback, NULL}, + {XtNactivateCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(ActivateCallback), XtRCallback, NULL}, +}; + +#undef offset + +static void Initialize(); +static void Destroy(); +static void Redisplay(); +static void Resize(); +static void ChangeSize(); +static XtGeometryResult QueryGeometry(); +static Boolean SetValues(); +static void Draw(); +static void DrawAll(); +static void DrawItemHighlight(), DrawItemHighlightClear(); +static ListTreeItem *GetItem(); +static void Select(), Notify(), Unset(), Extend(); +static void DeleteChildren(); +static Boolean Layout(); + +#ifdef USE_RDD +static void StartDrag(), EndDrag(), Drop(); + +#endif + +#ifdef USE_RDD +static char defaultTranslations[] = +"<Btn2Down>: StartDrag()\n\ +<Btn2Motion>: rddDragAction()\n\ +<Btn2Up>: EndDrag()\n\ +<Btn1Up>: Notify()\n\ +<Btn1Down>: Select()\n\ +Button1 <Btn1Motion>: Extend()"; + +#else +static char defaultTranslations[] = +"<Btn1Down>: Select()\n\ +<Btn1Up>: Notify()\n\ +Button1 <Btn1Motion>: Extend()"; + +#endif + +static XtActionsRec actions[] = +{ + {"Notify", Notify}, + {"Select", Select}, + {"Extend", Extend}, + {"Unset", Unset}, +#ifdef USE_RDD + {"StartDrag", StartDrag}, + {"EndDrag", EndDrag}, +#endif +}; + +ListTreeClassRec listtreeClassRec = +{ + { + /* core_class fields */ + /* superclass */ (WidgetClass) & widgetClassRec, + /* class_name */ "ListTree", + /* widget_size */ sizeof(ListTreeRec), + /* class_initialize */ NULL, + /* class_part_initialize */ NULL, + /* class_inited */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ True, + /* compress_exposure */ XtExposeCompressMultiple, + /* compress_enterleave */ True, + /* visible_interest */ True, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { + /* some stupid compilers barf on empty structures */ 0 + } +}; + +WidgetClass listtreeWidgetClass = (WidgetClass) & listtreeClassRec; + +static void +MakePixmap(w, pix) +ListTreeWidget w; +Pixinfo *pix; +{ + Window root; + int x, y; + unsigned int width, height, bw, depth; + + if (pix->bitmap && XGetGeometry(XtDisplay((Widget) w), pix->bitmap, + &root, &x, &y, &width, &height, &bw, &depth)) { + pix->width = (int) width; + pix->height = (int) height; + if (depth == 1) { + pix->pix = XmuCreatePixmapFromBitmap(XtDisplay((Widget) w), + RootWindowOfScreen(XtScreen((Widget) w)), + pix->bitmap, + width, height, w->core.depth, + w->list.foreground_pixel, + w->core.background_pixel); + } + else + pix->pix = pix->bitmap; + } + else { + pix->width = pix->height = 0; + pix->pix = (Pixmap) NULL; + } +} + +static void +FreePixmap(w, pix) +ListTreeWidget w; +Pixinfo *pix; +{ + if (pix->pix) + XFreePixmap(XtDisplay((Widget) w), pix->pix); +} + + +static void +Initialize(treq, tnew, args, num) +Widget treq, tnew; +ArgList args; +Cardinal *num; +{ + ListTreeWidget new; + XGCValues values; + XtGCMask mask; + + new = (ListTreeWidget) tnew; + + values.line_style = LineSolid; + values.line_width = new->list.LineWidth; + values.fill_style = FillSolid; + values.font = new->list.font->fid; + values.background = new->core.background_pixel; + values.foreground = new->list.foreground_pixel; + + mask = GCLineStyle | GCLineWidth | GCFillStyle | GCForeground | GCBackground | GCFont; + new->list.drawGC = XtGetGC((Widget) new, mask, &values); + + values.function = GXinvert; + mask = GCLineStyle | GCLineWidth | GCFillStyle | GCForeground | GCBackground | GCFont | GCFunction; + new->list.eorGC = XtGetGC((Widget) new, mask, &values); + + values.background = new->list.foreground_pixel; + values.foreground = new->core.background_pixel; + mask = GCLineStyle | GCLineWidth | GCFillStyle | GCForeground | GCBackground | GCFont; + new->list.highlightGC = XtGetGC((Widget) new, mask, &values); + + new->list.ret_item_list=NULL; + new->list.ret_item_alloc=0; + new->list.first = new->list.highlighted = NULL; + new->list.Refresh = True; + + new->list.timer_id = (XtIntervalId) 0; + new->list.multi_click_time = XtGetMultiClickTime(XtDisplay((Widget) new)); + + if (new->list.Closed.bitmap == XtUnspecifiedPixmap) + new->list.Closed.bitmap = XCreateBitmapFromData(XtDisplay((Widget) new), + RootWindowOfScreen(XtScreen((Widget) new)), + (char *)folder_bits, + folder_width, folder_height); + MakePixmap(new, &new->list.Closed); + + if (new->list.Open.bitmap == XtUnspecifiedPixmap) + new->list.Open.bitmap = XCreateBitmapFromData(XtDisplay((Widget) new), + RootWindowOfScreen(XtScreen((Widget) new)), + (char *)folderopen_bits, + folderopen_width, folderopen_height); + MakePixmap(new, &new->list.Open); + + if (new->list.Leaf.bitmap == XtUnspecifiedPixmap) + new->list.Leaf.bitmap = XCreateBitmapFromData(XtDisplay((Widget) new), + RootWindowOfScreen(XtScreen((Widget) new)), + (char *)document_bits, + document_width, document_height); + MakePixmap(new, &new->list.Leaf); + + if (new->list.LeafOpen.bitmap == XtUnspecifiedPixmap) + new->list.LeafOpen.bitmap = XCreateBitmapFromData(XtDisplay((Widget) new), + RootWindowOfScreen(XtScreen((Widget) new)), + (char *)document_bits, + document_width, document_height); + MakePixmap(new, &new->list.LeafOpen); + + new->list.pixWidth = new->list.Closed.width; + if (new->list.Open.width > new->list.pixWidth) + new->list.pixWidth = new->list.Open.width; + if (new->list.Leaf.width > new->list.pixWidth) + new->list.pixWidth = new->list.Leaf.width; + if (new->list.LeafOpen.width > new->list.pixWidth) + new->list.pixWidth = new->list.LeafOpen.width; + new->list.Closed.xoff = (new->list.pixWidth - new->list.Closed.width) / 2; + new->list.Open.xoff = (new->list.pixWidth - new->list.Open.width) / 2; + new->list.Leaf.xoff = (new->list.pixWidth - new->list.Leaf.width) / 2; + new->list.LeafOpen.xoff = (new->list.pixWidth - new->list.LeafOpen.width) / 2; + + if (new->core.height<2) new->core.height=2; + if (new->core.width<2) new->core.width=2; +} + +static void +Destroy(w) +ListTreeWidget w; +{ + ListTreeItem *item, *sibling; + + XtReleaseGC((Widget) w, w->list.drawGC); + XtReleaseGC((Widget) w, w->list.highlightGC); + item = w->list.first; + while (item) { + if (item->firstchild) { + DeleteChildren(w, item->firstchild); + } + sibling = item->nextsibling; + XtFree((char *) item->text); + XtFree((char *) item); + item = sibling; + } + FreePixmap(w, &w->list.Closed); + FreePixmap(w, &w->list.Open); + FreePixmap(w, &w->list.Leaf); + FreePixmap(w, &w->list.LeafOpen); +} + +static void +Redisplay(w, event, region) +Widget w; +XExposeEvent *event; +Region region; +{ + ListTreeWidget lw = (ListTreeWidget) w; + + if (!XtIsRealized(w)) + return; + + if (event) { + Draw(lw, (Boolean) True, (int) event->y, (int) event->height); + } + else { /* event==NULL ==> repaint the entire list */ + DrawAll(lw); + } +} + +static Boolean +SetValues(current, request, new, args, nargs) +Widget current, request, new; +ArgList args; +Cardinal *nargs; +{ + if (!XtIsRealized(current)) + return False; + + return True; +} + + +static void +Resize(w) +Widget w; +{ + ListTreeWidget lw = (ListTreeWidget) w; + Dimension width, height; + + if (!XtIsRealized(w)) + return; + width = lw->list.preferredWidth; + height = lw->list.preferredHeight; + +/* w->core.width=width; */ +/* w->core.height=height; */ + + if (Layout(w, FALSE, FALSE, &width, &height)) + XtAppWarning(XtWidgetToApplicationContext(w), + "ListTree Widget: Size changed when it shouldn't have when resising."); +} + +/* Display functions */ + +#define FontHeight(f) (int)(f->max_bounds.ascent + f->max_bounds.descent) +#define FontDescent(f) (int)(f->max_bounds.descent) +#define FontAscent(f) (int)(f->max_bounds.ascent) +#define FontTextWidth(f,c) (int)XTextWidth(f, c, strlen(c)) + +static void +PreferredSize(lw, w, h) +ListTreeWidget lw; +Dimension *w, *h; +{ + *w = (Dimension) lw->list.preferredWidth; + *h = (Dimension) lw->list.preferredHeight; +} + +/* #define DEBUG_GEOM */ +static void +ChangeSize(w) +ListTreeWidget w; +{ + XtWidgetGeometry request, reply; + + request.request_mode = CWHeight | CWWidth; + request.height = (Dimension) w->list.preferredHeight; + request.width = (Dimension) w->list.preferredWidth; + +/* printf("requesting w=%d h=%d\n",request.width,request.height); */ +/* XtMakeGeometryRequest((Widget)w, &request, &reply); */ +/* printf("replying w=%d h=%d\n",reply.width,reply.height); */ +/* return; */ + +#ifdef DEBUG_GEOM + printf("requesting w=%d h=%d\n", request.width, request.height); +#endif + switch (XtMakeGeometryRequest((Widget) w, &request, &reply)) { + case XtGeometryYes: + case XtGeometryNo: +#ifdef DEBUG_GEOM + printf("Yes/No: replying w=%d h=%d\n", reply.width, reply.height); +#endif + break; + case XtGeometryAlmost: +#ifdef DEBUG_GEOM + printf("Almost: replying w=%d h=%d\n", reply.width, reply.height); +#endif + PreferredSize(w, &(reply.width), &(reply.height)); + request = reply; + switch (XtMakeGeometryRequest((Widget) w, &request, &reply)) { + case XtGeometryYes: + case XtGeometryNo: + break; + case XtGeometryAlmost: +#ifdef DEBUG_GEOM + printf("Almost again: replying w=%d h=%d\n", reply.width, reply.height); +#endif + request = reply; + request.request_mode = CWHeight | CWWidth; + XtMakeGeometryRequest((Widget) w, &request, &reply); + break; + default: + break; + } + break; + default: + break; + } +} + +#ifdef OLD_QUERY +static XtGeometryResult +oldQueryGeometry(widget, intended, reply) +Widget widget; +XtWidgetGeometry *intended, *reply; +{ + ListTreeWidget lw = (ListTreeWidget) widget; + Dimension w, h; + +/*#ifdef DEBUG_GEOM */ +/*printf("Querying geometry...\n"); */ +/*#endif */ +/**/ +/* if (intended->request_mode & (~(CWWidth | CWHeight))) */ +/* return (XtGeometryYes); */ + + PreferredSize(lw, &w, &h); + + if (w == 0) + w = lw->core.width; + if (h == 0) + h = lw->core.height; + +#ifdef DEBUG_GEOM + printf("Querying geometry... intended=(%d,%d) preferred=(%d,%d)\n", + (int) intended->width, (int) intended->height, + (int) w, (int) h); +#endif + + if (intended->request_mode & CWWidth && + intended->width == w && + intended->request_mode & CWHeight && + intended->height == h) + return (XtGeometryYes); + + if (w == widget->core.width && + h == widget->core.height) + return (XtGeometryNo); + + reply->request_mode = CWWidth | CWHeight; + reply->width = w; + reply->height = h; + return XtGeometryAlmost; +} +#endif + +static Boolean +Layout(w, xfree, yfree, width, height) +Widget w; +Boolean xfree, yfree; +Dimension *width, *height; +{ + ListTreeWidget lw = (ListTreeWidget) w; + Boolean change = FALSE; + +#ifdef DEBUG_GEOM + printf("Layout... xfree=%d yfree=%d size=(%d,%d)\n", + (int) xfree, (int) yfree, (int) (*width), (int) (*height)); +#endif +/* + * If both width and height are free to change the use default_cols + * to determine the number columns and set new width and height to + * just fit the window. + */ + + if (xfree && yfree) { + *width = lw->list.preferredWidth; + *height = lw->list.preferredHeight; + change = TRUE; + } + +/* + * If the width is fixed then use it to determine the number of columns. + * If the height is free to move (width still fixed) then resize the height + * of the widget to fit the current list exactly. + */ + else if (!xfree) { + if (yfree) { + *height = lw->list.preferredHeight; + change = TRUE; + } + } + +/* + * The last case is xfree and !yfree we use the height to determine + * the number of rows and then set the width to just fit the resulting + * number of columns. + */ + else if (!yfree) { /* xfree must be TRUE. */ + *width = lw->list.preferredWidth; + change = TRUE; + } + return (change); +} + +static XtGeometryResult +QueryGeometry(lw, parent_idea, our_idea) +ListTreeWidget lw; +XtWidgetGeometry *parent_idea, *our_idea; +{ + Dimension nw, nh; + Boolean parent_wants_w, parent_wants_h, we_changed_size; + + parent_wants_w = (parent_idea->request_mode) & CWWidth; + parent_wants_h = (parent_idea->request_mode) & CWHeight; + + if (parent_wants_w) + nw = parent_idea->width; + else + nw = (Dimension) lw->list.preferredWidth; + + if (parent_wants_h) + nh = parent_idea->height; + else + nh = (Dimension) lw->list.preferredHeight; + +#ifdef DEBUG_GEOM + printf("Querying geometry... intended=(%d,%d) preferred=(%d,%d)\n", + (int) parent_idea->width, (int) parent_idea->height, + (int) nw, (int) nh); +#endif + + our_idea->request_mode = 0; + if (!parent_wants_w && !parent_wants_h) + return (XtGeometryYes); + + we_changed_size = Layout(lw, !parent_wants_w, !parent_wants_h, &nw, &nh); + our_idea->request_mode |= (CWWidth | CWHeight); + our_idea->width = nw; + our_idea->height = nh; + + if (we_changed_size) + return (XtGeometryAlmost); + else + return (XtGeometryYes); +} /* End PreferredGeometry */ + + +/* DEBUGGING FUNCTIONS */ + +#ifdef DEBUG_TREE +void +ItemCheck(ListTreeWidget w, ListTreeItem * item) +{ + ListTreeItem *p; + char text[1024]; + + p = item; +/* if (p->parent) fprintf(stderr,"%x %x \t",p,p->parent); */ +/* else fprintf(stderr,"%x 00000000 \t",p); */ +/* while (p) { fprintf(stderr," "); p=p->parent; } */ +/* p=item; */ +/* while (p) { */ +/* fprintf(stderr,"%s/",p->text); */ +/* p=p->parent; */ +/* } */ +/* fprintf(stderr,"\n"); */ + + if (strcmp(item->text, "pixmaps") == 0) { + fprintf(stderr, "parent: %x\n", item->parent); + fprintf(stderr, "firstchild: %x\n", item->firstchild); + fprintf(stderr, "prevsibling: %x\n", item->prevsibling); + fprintf(stderr, "nextsibling: %x\n", item->nextsibling); + } +} + +void +ChildrenCheck(ListTreeWidget w, ListTreeItem * item) +{ + while (item) { + ItemCheck(w, item); + if (item->firstchild) + ChildrenCheck(w, item->firstchild); + item = item->nextsibling; + } +} + +void +TreeCheck(ListTreeWidget w, char *txt) +{ + ListTreeItem *item; + + fprintf(stderr, "\n\n%s\n", txt); + item = w->list.first; + while (item) { + ItemCheck(w, item); + if (item->firstchild) + ChildrenCheck(w, item->firstchild); + item = item->nextsibling; + } +} +#else +#define TreeCheck(a,b) +#endif + +/* Highlighting Utilities ----------------------------------------------- */ + +static void +HighlightItem(ListTreeWidget w, ListTreeItem * item, Boolean state, Boolean draw) +{ + if (item) { + if (item == w->list.highlighted && !state) { + w->list.highlighted = NULL; + if (draw) + DrawItemHighlightClear(w, item); + } + else if (state != item->highlighted) { + /* printf("Highlighting '%s' state=%d x=%d y=%d\n", item->text, draw, item->x, item->ytext); */ + item->highlighted = state; + if (draw) + DrawItemHighlightClear(w, item); + } + } +} + +static void +HighlightChildren(ListTreeWidget w, ListTreeItem * item, Boolean state, Boolean draw) +{ + while (item) { + HighlightItem(w, item, state, draw); + if (item->firstchild) { + Boolean drawkids; + + if (item->open) + drawkids = draw; + else + drawkids = False; + HighlightChildren(w, item->firstchild, state, drawkids); + } + item = item->nextsibling; + } +} + +static void +HighlightAll(ListTreeWidget w, Boolean state, Boolean draw) +{ + ListTreeItem *item; + + item = w->list.first; + while (item) { + HighlightItem(w, item, state, draw); + if (item->firstchild) { + Boolean drawkids; + + if (item->open) + drawkids = draw; + else + drawkids = False; + HighlightChildren(w, item->firstchild, state, drawkids); + } + item = item->nextsibling; + } +} + +static void +HighlightVisibleChildren(ListTreeWidget w, ListTreeItem * item, Boolean state, Boolean draw) +{ + while (item) { + HighlightItem(w, item, state, draw); + if (item->firstchild && item->open) { + HighlightVisibleChildren(w, item->firstchild, state, draw); + } + item = item->nextsibling; + } +} + +static void +HighlightAllVisible(ListTreeWidget w, Boolean state, Boolean draw) +{ + ListTreeItem *item; + + item = w->list.first; + while (item) { + HighlightItem(w, item, state, draw); + if (item->firstchild && item->open) { + HighlightVisibleChildren(w, item->firstchild, state, draw); + } + item = item->nextsibling; + } +} + +static void +AddItemToReturnList(ListTreeWidget w, ListTreeItem * item,int loc) +{ + if (loc>=w->list.ret_item_alloc) { + w->list.ret_item_alloc+=ListTreeRET_ALLOC; + w->list.ret_item_list=(ListTreeItem **)XtRealloc((char *)w->list.ret_item_list,w->list.ret_item_alloc*sizeof(ListTreeItem *)); + } + w->list.ret_item_list[loc]=item; +} + +static void +MultiAddToReturn(ListTreeWidget w, ListTreeItem * item, ListTreeMultiReturnStruct * ret) +{ + AddItemToReturnList(w,item,ret->count); + ret->items=w->list.ret_item_list; + ret->count++; +} + +static void +HighlightCount(ListTreeWidget w, ListTreeItem * item, ListTreeMultiReturnStruct * ret) +{ + while (item) { + if (item->highlighted) + MultiAddToReturn(w,item,ret); + if (item->firstchild && item->open) + HighlightCount(w,item->firstchild,ret); + item = item->nextsibling; + } +} + +static void +MakeMultiCallbackStruct(ListTreeWidget w,ListTreeMultiReturnStruct * ret) +{ + ListTreeItem *item; + + ret->items=NULL; + ret->count = 0; + item = w->list.first; + while (item) { + if (item->highlighted) + MultiAddToReturn(w,item,ret); + if (item->firstchild && item->open) + HighlightCount(w,item->firstchild,ret); + item = item->nextsibling; + } +} + +static void +HighlightDoCallback(ListTreeWidget w) +{ + ListTreeMultiReturnStruct ret; + + if (w->list.HighlightCallback) { + MakeMultiCallbackStruct(w,&ret); + XtCallCallbacks((Widget) w, XtNhighlightCallback, &ret); + } +} + +/* Events ------------------------------------------------------------------ */ + + +static ListTreeReturnStruct * +MakeV1CallbackStruct(w, item) +ListTreeWidget w; +ListTreeItem *item; +{ + ListTreeItem *parent; + ListTreeReturnStruct *ret; + int count, size; + char *ptr; + + TreeCheck(w, "in MakeV1CallbackStruct"); + count = 1; + parent = item; + while (parent->parent) { + parent = parent->parent; + count++; + } + size = sizeof(ListTreeReturnStruct) + ((count + 1) * sizeof(ListTreeItem *)); + ptr = (char *) XtMalloc(size); + ret = (ListTreeReturnStruct *) ptr; + ret->path = (ListTreeItem **) (ptr + + (((sizeof(ListTreeReturnStruct) + + sizeof(ListTreeItem *) - 1) / + sizeof(ListTreeItem *)) * + sizeof(ListTreeItem *))); +/* fprintf(stderr,"ret=%x ret->path=%x\n",ret,ret->path); */ + ret->item = item; + ret->count = count; + ret->open = item->open; + while (count > 0) { + count--; + ret->path[count] = item; + item = item->parent; + } + + TreeCheck(w, "exiting MakeV1CallbackStruct"); + return ret; +} + +/* Do the historical callbacks. After Further Review, I don't really + like requiring the user to free the data. But, I don't want to + break everybody's code, so I will mark these routines as HISTORICAL. + + MIGRATE TO THE NEW CALLBACKS! */ +static void +HistoricalCallbacks(ListTreeWidget w) +{ + ListTreeReturnStruct *ret; + + if (w->list.PathCallback) { + ret = MakeV1CallbackStruct(w, w->list.timer_item); + if (w->list.timer_item->firstchild) + ret->reason = XtBRANCH; + else + ret->reason = XtLEAF; + XtCallCallbacks((Widget) w, XtNpathCallback, (XtPointer) ret); + } + if (w->list.BranchCallback && w->list.timer_item->firstchild) { + ret = MakeV1CallbackStruct(w, w->list.timer_item); + ret->reason = XtBRANCH; + XtCallCallbacks((Widget) w, XtNbranchCallback, (XtPointer) ret); + } + else if (w->list.LeafCallback && !w->list.timer_item->firstchild) { + ret = MakeV1CallbackStruct(w, w->list.timer_item); + ret->reason = XtLEAF; + XtCallCallbacks((Widget) w, XtNleafCallback, (XtPointer) ret); + } +} + +static void +MakeActivateCallbackStruct(ListTreeWidget w, ListTreeItem *item,ListTreeActivateStruct *ret) +{ + int count; + ListTreeItem *parent; + + count = 1; + parent = item; + while (parent->parent) { + parent = parent->parent; + count++; + } + + ret->item = item; + ret->count = count; + ret->open = item->open; + if (item->firstchild) + ret->reason = XtBRANCH; + else + ret->reason = XtLEAF; + while (count > 0) { + count--; + AddItemToReturnList(w,item,count); + item = item->parent; + } + ret->path=w->list.ret_item_list; +} + +static void +SelectDouble(ListTreeWidget w) +{ + ListTreeActivateStruct ret; + + TreeCheck(w, "in SelectDouble"); + if (w->list.timer_item) { + w->list.timer_type=TIMER_DOUBLE; + w->list.timer_item->open = !w->list.timer_item->open; + w->list.highlighted = w->list.timer_item; + HighlightAll(w, False, True); + w->list.timer_item->highlighted = True; + DrawAll(w); + + if (w->list.ActivateCallback) { + MakeActivateCallbackStruct(w, w->list.timer_item,&ret); + XtCallCallbacks((Widget) w, XtNactivateCallback, (XtPointer) &ret); + } + + HistoricalCallbacks(w); + } + TreeCheck(w, "exiting SelectDouble"); +} + +/* ARGSUSED */ +static void +SelectSingle(XtPointer client_data, XtIntervalId * idp) +{ + ListTreeWidget w = (ListTreeWidget) client_data; + + w->list.timer_id = (XtIntervalId) 0; +/* + if (w->list.timer_x<w->list.timer_item->x) { +*/ + SelectDouble(w); +/* + } + else { + HighlightAll(w, False, True); + HighlightItem(w, w->list.timer_item, True, True); + if (w->list.timer_type!=TIMER_CLEAR) + HighlightDoCallback(w); + w->list.timer_type=TIMER_SINGLE; + } +*/ +} + +/* ARGSUSED */ +static void +Select(aw, event, params, num_params) +Widget aw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeWidget w = (ListTreeWidget) aw; + + w->list.timer_type=TIMER_WAITING; + w->list.timer_item = GetItem(w, event->xbutton.y); + w->list.timer_x=event->xbutton.x; + w->list.timer_y=event->xbutton.y; + if (!w->list.timer_item) { + if (w->list.timer_id) { + XtRemoveTimeOut(w->list.timer_id); + w->list.timer_id = (XtIntervalId) 0; + } + } + else { + if (w->list.timer_id) { + XtRemoveTimeOut(w->list.timer_id); + w->list.timer_id = (XtIntervalId) 0; + SelectDouble(w); + } + else { + w->list.timer_id = XtAppAddTimeOut( + XtWidgetToApplicationContext((Widget) w), + (unsigned long) w->list.multi_click_time, + SelectSingle, + (XtPointer) w); + + } + } +} + +/* ARGSUSED */ +static void +Extend(aw, event, params, num_params) +Widget aw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeItem *item; + ListTreeWidget w = (ListTreeWidget) aw; + int y, yend; + +/* If we are waiting for a double click, return before doing anything */ + if (w->list.timer_id) + return; + +/* We need the timer_item to be pointing to the first selection in this */ +/* group. If we got here without it being set, something is very wrong. */ + if (!w->list.timer_item) + return; + + y = w->list.timer_y; + yend = event->xbutton.y; + item = GetItem(w, y); + if (y < yend) { + while (item && y < yend && y < w->core.height) { + if (item) { + HighlightItem(w, item, True, True); + y += item->height; + } + item = GetItem(w, y); + } + } + else { + while (item && y > yend && y > 0) { + if (item) { + HighlightItem(w, item, True, True); + y -= item->height; + } + item = GetItem(w, y); + } + } +/* HighlightDoCallback(w); */ +} + +/* ARGSUSED */ +static void +Unset(aw, event, params, num_params) +Widget aw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeItem *item; + ListTreeWidget w = (ListTreeWidget) aw; + + item = GetItem(w, event->xbutton.y); + if (item) { +/* item->open=False; */ +/* lw->list.highlighted=item; */ +/* DrawAll(lw); */ +/* ListTreeDelete(lw,item); */ + } +} + +/* ARGSUSED */ +static void +Notify(aw, event, params, num_params) +Widget aw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeWidget w = (ListTreeWidget) aw; + ListTreeItem *item; + + + /* don't call highlightCallback if we are waiting for a double click */ +/* + if (w->list.timer_id) { + } + else if (w->list.timer_type==TIMER_WAITING) { +*/ + HighlightAll(w, False, True); + item = GetItem(w, event->xbutton.y); + HighlightItem(w, item, True, True); + HighlightDoCallback(w); + w->list.timer_type=TIMER_CLEAR; +/* + } +*/ +} + +/* ListTree private drawing functions */ + +static void +DrawItemHighlight(w, item) +ListTreeWidget w; +ListTreeItem *item; +{ + int width; + + if (item->highlighted || item == w->list.highlighted) { + width = w->core.width - item->x; + XFillRectangle(XtDisplay(w), XtWindow(w), + w->list.drawGC, + item->x, item->ytext, + width, FontHeight(w->list.font)); + XDrawString(XtDisplay(w), XtWindow(w), w->list.highlightGC, + item->x, item->ytext + FontAscent(w->list.font), + item->text, item->length); + } + else { + XDrawString(XtDisplay(w), XtWindow(w), w->list.drawGC, + item->x, item->ytext + FontAscent(w->list.font), + item->text, item->length); + } +} + +static void +DrawItemHighlightClear(w, item) +ListTreeWidget w; +ListTreeItem *item; +{ + int width; + + width = w->core.width - item->x; + if (item->highlighted || item == w->list.highlighted) { + XFillRectangle(XtDisplay(w), XtWindow(w), + w->list.drawGC, + item->x, item->ytext, + width, FontHeight(w->list.font)); + XDrawString(XtDisplay(w), XtWindow(w), w->list.highlightGC, + item->x, item->ytext + FontAscent(w->list.font), + item->text, item->length); + } + else { + XFillRectangle(XtDisplay(w), XtWindow(w), + w->list.highlightGC, + item->x, item->ytext, + width, FontHeight(w->list.font)); + XDrawString(XtDisplay(w), XtWindow(w), w->list.drawGC, + item->x, item->ytext + FontAscent(w->list.font), + item->text, item->length); + } +} + +static void +DrawItem(w, draw, item, x, y, xroot, yroot, retwidth, retheight) +ListTreeWidget w; +Boolean draw; +ListTreeItem *item; +int x, y; +int *xroot, *yroot, *retwidth, *retheight; +{ + int height, xpix, ypix, xbranch, ybranch, xtext, ytext, yline; + Pixinfo *pix; + +/* Select the pixmap to use, if any */ + if (item->firstchild) { + if (item->open) + pix = &w->list.Open; + else + pix = &w->list.Closed; + } + else { + if (item->open) + pix = &w->list.LeafOpen; + else + pix = &w->list.Leaf; + } + +/* Compute the height of this line */ + height = FontHeight(w->list.font); + xpix = x - w->list.pixWidth + pix->xoff; + xtext = x + (int) w->list.HSpacing; + if (pix) { + if (pix->height > height) { + ytext = y + ((pix->height - height) / 2); + height = pix->height; + ypix = y; + } + else { + ytext = y; + ypix = y + ((height - pix->height) / 2); + } + xbranch = xpix + (w->list.pixWidth / 2); + ybranch = ypix + pix->height; + yline = ypix + (pix->height / 2); + } + else { + ypix = ytext = y; + xbranch = xpix + (w->list.pixWidth / 2); + yline = ybranch = ypix + (height / 2); + yline = ypix + (height / 2); + } + +/* Save the basic graphics info for use by other functions */ + item->x = xtext; + item->y = y; + item->ytext = ytext; + item->height = height; + + if ((*xroot >= 0) && + ((*yroot >= w->list.exposeTop && *yroot <= w->list.exposeBot) || + (yline >= w->list.exposeTop && yline <= w->list.exposeBot) || + (*yroot < w->list.exposeTop && yline > w->list.exposeBot))) + XDrawLine(XtDisplay(w), XtWindow(w), w->list.drawGC, + *xroot, *yroot, + *xroot, yline); + if (draw && y >= w->list.exposeTop && y <= w->list.exposeBot) { + if (*xroot >= 0) + XDrawLine(XtDisplay(w), XtWindow(w), w->list.drawGC, + *xroot, yline, + xbranch, yline); + if (pix && pix->pix) + XCopyArea(XtDisplay(w), pix->pix, XtWindow(w), + w->list.drawGC, + 0, 0, pix->width, pix->height, + xpix, ypix); +/*if (1) { */ +/*ListTreeItem *p; */ +/*char text[1024]; */ +/**/ +/*p=item;*/ +/*if (p->parent) printf("%x %x \t",p,p->parent); */ +/*else printf("%x 00000000 \t",p); */ +/*while (p) { printf(" "); p=p->parent; } */ +/*p=item; */ +/*while (p) { */ +/*printf("%s/",p->text); */ +/*p=p->parent; */ +/*} */ +/*printf("\n"); */ +/*} */ + DrawItemHighlight(w, item); + } + *xroot = xbranch; + *yroot = ybranch; + *retwidth = FontTextWidth(w->list.font, item->text); + *retheight = height; +} + +static int +DrawChildren(w, draw, item, x, y, xroot, yroot) +ListTreeWidget w; +Boolean draw; +ListTreeItem *item; +int x, y, xroot, yroot; +{ + int width, height; + int xbranch, ybranch; + + x += (int) w->list.Indent + w->list.pixWidth; + while (item) { + xbranch = xroot; + ybranch = yroot; + DrawItem(w, draw, item, x, y, &xbranch, &ybranch, &width, &height); + + width += x + (int) w->list.HSpacing + (int) w->list.Margin; + + if (width > w->list.preferredWidth) + w->list.preferredWidth = width; + + y += height + (int) w->list.VSpacing; + if ((item->firstchild) && (item->open)) + y = DrawChildren(w, draw, item->firstchild, + x, y, xbranch, ybranch); + + item = item->nextsibling; + } + return y; +} + +static void +Draw(w, draw, yevent, hevent) +ListTreeWidget w; +Boolean draw; +int yevent, hevent; +{ + int x, y, height, width; + int xbranch, ybranch; + ListTreeItem *item; + int saveheight, savewidth; + + TreeCheck(w, "Draw"); +#ifdef DEBUG_GEOM + printf("Draw: y=%d h=%d\n", yevent, hevent); +#endif +/* Overestimate the expose region to be sure to draw an item that gets */ +/* cut by the region */ + w->list.exposeTop = yevent - FontHeight(w->list.font); + w->list.exposeBot = yevent + hevent + FontHeight(w->list.font); + saveheight = w->list.preferredHeight; + savewidth = w->list.preferredWidth; + w->list.preferredWidth = w->list.preferredHeight = 2; + + x = (int) w->list.Margin + w->list.pixWidth; + y = (int) w->list.Margin; + item = w->list.first; + while (item) { + xbranch = -1; + DrawItem(w, draw, item, x, y, &xbranch, &ybranch, &width, &height); + + width += x + (int) w->list.HSpacing + (int) w->list.Margin; + + if (width > w->list.preferredWidth) + w->list.preferredWidth = width; + + y += height + (int) w->list.VSpacing; + if ((item->firstchild) && (item->open)) + y = DrawChildren(w, draw, item->firstchild, + x, y, xbranch, ybranch); + + item = item->nextsibling; + } + w->list.preferredHeight = y + (int) w->list.Margin; + if (draw && (saveheight != w->list.preferredHeight || + savewidth != w->list.preferredWidth)) + ChangeSize(w); +} + + +static void +DrawAll(w) +ListTreeWidget w; +{ + XClearWindow(XtDisplay((Widget) w), XtWindow((Widget) w)); + Draw(w, (Boolean) True, 0, (int) w->core.height); +} + + +/* Private Functions --------------------------------------------------------- */ + + +/* This function removes the specified item from the linked list. It does */ +/* not do anything with the data contained in the item, though. */ +static void +RemoveReference(w, item) +ListTreeWidget w; +ListTreeItem *item; +{ + +/* If there exists a previous sibling, just skip over item to be dereferenced */ + if (item->prevsibling) { + item->prevsibling->nextsibling = item->nextsibling; + if (item->nextsibling) + item->nextsibling->prevsibling = item->prevsibling; + } +/* If not, then the deleted item is the first item in some branch. */ + else { + if (item->parent) + item->parent->firstchild = item->nextsibling; + else + w->list.first = item->nextsibling; + if (item->nextsibling) + item->nextsibling->prevsibling = NULL; + } +} + +static void +DeleteChildren(w, item) +ListTreeWidget w; +ListTreeItem *item; +{ + ListTreeItem *sibling; + + while (item) { + if (item->firstchild) { + DeleteChildren(w, item->firstchild); + item->firstchild = NULL; + } + sibling = item->nextsibling; + XtFree((char *) item->text); + XtFree((char *) item); + item = sibling; + } +} + +static void +InsertChild(w, parent, item) +ListTreeWidget w; +ListTreeItem *parent; +ListTreeItem *item; +{ + ListTreeItem *i; + + item->parent = parent; + item->nextsibling = item->prevsibling = NULL; + if (parent) { + if (parent->firstchild) { + i = parent->firstchild; + while (i->nextsibling) { + i = i->nextsibling; + } + i->nextsibling = item; + item->prevsibling = i; + } + else { + parent->firstchild = item; + } + + } + else { /* if parent==NULL, this is a top level entry */ + if (w->list.first) { + i = w->list.first; + while (i->nextsibling) { + i = i->nextsibling; + } + i->nextsibling = item; + item->prevsibling = i; + } + else { + w->list.first = item; + } + } +} + +/* Insert a list of ALREADY LINKED children into another list */ +static void +InsertChildren(w, parent, item) +ListTreeWidget w; +ListTreeItem *parent; +ListTreeItem *item; +{ + ListTreeItem *next, *newnext; + +/* while (item) { */ +/* next=item->nextsibling; */ +/* InsertChild(w,parent,item); */ +/* item=next; */ +/* } */ +/* return; */ + + +/* Save the reference for the next item in the new list */ + next = item->nextsibling; + +/* Insert the first item in the new list into the existing list */ + InsertChild(w, parent, item); + +/* The first item is inserted, with its prev and next siblings updated */ +/* to fit into the existing list. So, save the existing list reference */ + newnext = item->nextsibling; + +/* Now, mark the first item's next sibling to point back to the new list */ + item->nextsibling = next; + +/* Mark the parents of the new list to the new parent. The order of the */ +/* rest of the new list should be OK, and the second item should still */ +/* point to the first, even though the first was reparented. */ + while (item->nextsibling) { + item->parent = parent; + item = item->nextsibling; + } + +/* Fit the end of the new list back into the existing list */ + item->nextsibling = newnext; + if (newnext) + newnext->prevsibling = item; +} + +static int +SearchChildren(w, item, y, findy, finditem) +ListTreeWidget w; +ListTreeItem *item; +ListTreeItem **finditem; +int y, findy; +{ + int height; + Pixinfo *pix; + + while (item) { +/* Select the pixmap to use, if any */ + if (item->firstchild) { + if (item->open) + pix = &w->list.Open; + else + pix = &w->list.Closed; + } + else { + if (item->open) + pix = &w->list.LeafOpen; + else + pix = &w->list.Leaf; + } + +/* Compute the height of this line */ + height = FontHeight(w->list.font); + if (pix && pix->height > height) + height = pix->height; + + if (findy >= y && findy <= y + height) { + *finditem = item; + return -1; + } + y += height + (int) w->list.VSpacing; + if ((item->firstchild) && (item->open)) { + y = SearchChildren(w, item->firstchild, + y, findy, finditem); + if (*finditem) + return -1; + } + item = item->nextsibling; + } + return y; +} + +static ListTreeItem * +GetItem(w, findy) +ListTreeWidget w; +int findy; +{ + int y, height; + ListTreeItem *item, *finditem; + Pixinfo *pix; + + TreeCheck(w, "in GetItem"); + y = (int) w->list.Margin; + item = w->list.first; + finditem = NULL; + while (item && !finditem) { +/* Select the pixmap to use, if any */ + if (item->firstchild) { + if (item->open) + pix = &w->list.Open; + else + pix = &w->list.Closed; + } + else { + if (item->open) + pix = &w->list.LeafOpen; + else + pix = &w->list.Leaf; + } + +/* Compute the height of this line */ + height = FontHeight(w->list.font); + if (pix && pix->height > height) + height = pix->height; + + if (findy >= y && findy <= y + height) + return item; + y += height + (int) w->list.VSpacing; + if ((item->firstchild) && (item->open)) { + y = SearchChildren(w, item->firstchild, + y, findy, &finditem); +/* if (finditem) return finditem; */ + } + item = item->nextsibling; + } + TreeCheck(w, "exiting GetItem"); + return finditem; +} + +static int +SearchPosition(w, item, y, finditem, found) +ListTreeWidget w; +ListTreeItem *item, *finditem; +int y; +Boolean *found; +{ + int height; + Pixinfo *pix; + + while (item) { +/* printf("Checking y=%d item=%s\n",y,item->text); */ + if (item == finditem) { + *found = True; + return y; + } + +/* Select the pixmap to use, if any */ + if (item->firstchild) { + if (item->open) + pix = &w->list.Open; + else + pix = &w->list.Closed; + } + else { + if (item->open) + pix = &w->list.LeafOpen; + else + pix = &w->list.Leaf; + } + +/* Compute the height of this line */ + height = FontHeight(w->list.font); + if (pix && pix->height > height) + height = pix->height; + + y += height + (int) w->list.VSpacing; + if ((item->firstchild) && (item->open)) { + y = SearchPosition(w, item->firstchild, y, finditem, found); + if (*found) + return y; + } + item = item->nextsibling; + } + return y; +} + +static Position +GetPosition(w, finditem) +ListTreeWidget w; +ListTreeItem *finditem; +{ + int y, height; + ListTreeItem *item; + Pixinfo *pix; + Boolean found; + + TreeCheck(w, "in GetPosition"); + y = (int) w->list.Margin; + item = w->list.first; + found = False; + while (item && item != finditem) { + +/* printf("Checking y=%d item=%s\n",y,item->text); */ +/* Select the pixmap to use, if any */ + if (item->firstchild) { + if (item->open) + pix = &w->list.Open; + else + pix = &w->list.Closed; + } + else { + if (item->open) + pix = &w->list.LeafOpen; + else + pix = &w->list.Leaf; + } + +/* Compute the height of this line */ + height = FontHeight(w->list.font); + if (pix && pix->height > height) + height = pix->height; + + y += height + (int) w->list.VSpacing; + if ((item->firstchild) && (item->open)) { + y = SearchPosition(w, item->firstchild, y, finditem, &found); + if (found) + return (Position) y; + } + item = item->nextsibling; + } + TreeCheck(w, "exiting GetPosition"); + if (item != finditem) + y = 0; + return (Position) y; +} + + +#ifdef USE_RDD +/* -------------------------------------------------------------------------- + ** ListTree drag & drop operations + */ + +/* ARGSUSED */ +static void +StartDrag(w, event, params, num_params) +Widget w; +XButtonEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeItem *item; + ListTreeWidget lw = (ListTreeWidget) w; + static Pixmap pixmap; + Display *dpy = XtDisplay(w); + static Dimension wid = 40, hgt = 40; + static GC gc; + + item = lw->list.highlighted; + if (item) { + printf("Drag %s\n", item->text); + } + + rddStartAction(w, event, params, num_params); /* then use default action */ +} + +/* ARGSUSED */ +static void +EndDrag(w, event, params, num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeItem *item; + ListTreeWidget lw = (ListTreeWidget) w; + ListTreeReturnStruct *ret; + + item = lw->list.highlighted; + if (item) { + printf("Ending %s\n", item->text); + + ret = MakeV1CallbackStruct(w, item); + rddSetDropDataType(ret, sizeof(ListTreeReturnStruct), + RDD_LISTTREE_TYPE); + + /* then use default action */ + rddDropAction(w, event, params, num_params); + } +} + +/* ARGSUSED */ +void +ListTreeHighlightDrop(w, event, params, num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + ListTreeItem *item; + ListTreeWidget lw = (ListTreeWidget) w; + + if (event && event->xbutton.state) { + item = GetItem(lw, event->xbutton.y); + if (item) { + printf("highlighting %d,%d item=%s\n", + event->xbutton.x, event->xbutton.y, item->text); + if (lw->list.drop_highlighted) + XDrawRectangle(XtDisplay(w), XtWindow(w), + lw->list.eorGC, + lw->list.drop_highlighted->x, + lw->list.drop_highlighted->ytext, + FontTextWidth(lw->list.font, lw->list.drop_highlighted->text), + FontHeight(lw->list.font)); + XDrawRectangle(XtDisplay(w), XtWindow(w), + lw->list.eorGC, + item->x, item->ytext, + FontTextWidth(lw->list.font, item->text), + FontHeight(lw->list.font)); + lw->list.drop_highlighted = item; + } + } + else if (lw->list.drop_highlighted) { + XDrawRectangle(XtDisplay(w), XtWindow(w), + lw->list.eorGC, + lw->list.drop_highlighted->x, + lw->list.drop_highlighted->ytext, + FontTextWidth(lw->list.font, lw->list.drop_highlighted->text), + FontHeight(lw->list.font)); + lw->list.drop_highlighted = NULL; + } +} + + +ListTreeReturnStruct * +ListTreeGetDrop(Widget w) +{ + ListTreeWidget lw = (ListTreeWidget) w; + ListTreeReturnStruct *ret; + + if (lw->list.drop_highlighted) { + ret = MakeV1CallbackStruct(w, lw->list.drop_highlighted); + ListTreeHighlightDrop(w, NULL, NULL, 0); + } + else + ret = NULL; + return ret; +} +#endif + +/* Public Functions --------------------------------------------------------- */ + +void +ListTreeRefresh(ListTreeWidget w) +{ + if (XtIsRealized((Widget) w) && w->list.Refresh) + DrawAll(w); +} + +void +ListTreeRefreshOff(ListTreeWidget w) +{ + w->list.Refresh = False; +} + +void +ListTreeRefreshOn(ListTreeWidget w) +{ + w->list.Refresh = True; + ListTreeRefresh(w); +} + +ListTreeItem * +ListTreeAdd(ListTreeWidget w,ListTreeItem *parent,char *string) +{ + ListTreeItem *item; + int len; + char *copy; + + TreeCheck(w, "in ListTreeAdd"); + len = strlen(string); + item = (ListTreeItem *) XtMalloc(sizeof(ListTreeItem)); + copy = (char *) XtMalloc(len + 1); + strcpy(copy, string); + item->text = copy; + item->length = len; + item->parent = parent; + item->open = False; + item->highlighted = False; + item->firstchild = item->prevsibling = item->nextsibling = NULL; + InsertChild(w, parent, item); + + ListTreeRefresh(w); + + return item; +} + +void +ListTreeRenameItem(ListTreeWidget w,ListTreeItem *item,char *string) +{ + int len; + char *copy; + + TreeCheck(w, "in ListTreeRename"); + XtFree(item->text); + len = strlen(string); + copy = (char *) XtMalloc(len + 1); + strcpy(copy, string); + item->text = copy; + item->length = len; + + ListTreeRefresh(w); +} + +int +ListTreeDelete(ListTreeWidget w,ListTreeItem *item) +{ + if (item->firstchild) + DeleteChildren(w, item->firstchild); + item->firstchild = NULL; + + RemoveReference(w, item); + + XtFree((char *) item->text); + XtFree((char *) item); + + ListTreeRefresh(w); + + return 1; +} + +int +ListTreeDeleteChildren(ListTreeWidget w,ListTreeItem *item) +{ + if (item->firstchild) + DeleteChildren(w, item->firstchild); + item->firstchild = NULL; + + ListTreeRefresh(w); + + return 1; +} + +int +ListTreeReparent(ListTreeWidget w, ListTreeItem *item,ListTreeItem *newparent) +{ + TreeCheck(w, "in ListTreeReparent"); +/* Remove the item from its old location. */ + RemoveReference(w, item); + +/* The item is now unattached. Reparent it. */ + InsertChild(w, newparent, item); + + ListTreeRefresh(w); + + return 1; +} + +int +ListTreeReparentChildren(ListTreeWidget w, ListTreeItem *item,ListTreeItem *newparent) +{ + ListTreeItem *first; + + TreeCheck(w, "in ListTreeReparentChildren"); + if (item->firstchild) { + first = item->firstchild; + item->firstchild = NULL; + + InsertChildren(w, newparent, first); + + ListTreeRefresh(w); + return 1; + } + return 0; +} + +int +AlphabetizeItems(const void *item1, const void *item2) +{ + return strcmp((*((ListTreeItem **) item1))->text, + (*((ListTreeItem **) item2))->text); +} + +int +ListTreeUserOrderSiblings(ListTreeWidget w, ListTreeItem *item,int (*func)()) +{ + ListTreeItem *first, *parent, **list; + size_t i, count, size; + + TreeCheck(w, "in ListTreeUserOrderSiblings"); +/* Get first child in list; */ + while (item->prevsibling) + item = item->prevsibling; + first = item; + parent = first->parent; + +/* Count the children */ + count = 1; + while (item->nextsibling) + item = item->nextsibling, count++; + if (count <= 1) + return 1; + + size = sizeof(ListTreeItem *); + list = (ListTreeItem **) XtMalloc(size * count); + list[0] = first; + count = 1; + while (first->nextsibling) { + list[count] = first->nextsibling; + count++; + first = first->nextsibling; + } + + qsort(list, count, size, func); + + list[0]->prevsibling = NULL; + for (i = 0; i < count; i++) { + if (i < count - 1) + list[i]->nextsibling = list[i + 1]; + if (i > 0) + list[i]->prevsibling = list[i - 1]; + } + list[count - 1]->nextsibling = NULL; + if (parent) + parent->firstchild = list[0]; + else + w->list.first = list[0]; + XtFree((char *) list); + + ListTreeRefresh(w); + TreeCheck(w, "exiting ListTreeOrderSiblings"); + + return 1; +} + +int +ListTreeOrderSiblings(ListTreeWidget w, ListTreeItem *item) +{ + TreeCheck(w, "in ListTreeOrderSiblings"); + return ListTreeUserOrderSiblings(w, item, AlphabetizeItems); +} + +int +ListTreeUserOrderChildren(ListTreeWidget w, ListTreeItem *item,int (*func)()) +{ + ListTreeItem *first; + + TreeCheck(w, "in ListTreeUserOrderChildren"); + if (item) { + first = item->firstchild; + if (first) + ListTreeUserOrderSiblings(w, first, func); + } + else { + if (w->list.first) + ListTreeUserOrderSiblings(w, w->list.first, func); + } + TreeCheck(w, "exiting ListTreeUserOrderChildren"); + return 1; +} + +int +ListTreeOrderChildren(ListTreeWidget w, ListTreeItem *item) +{ + ListTreeItem *first; + + TreeCheck(w, "in ListTreeOrderChildren"); + if (item) { + first = item->firstchild; + if (first) + ListTreeOrderSiblings(w, first); + } + else { + if (w->list.first) + ListTreeOrderSiblings(w, w->list.first); + } + TreeCheck(w, "exiting ListTreeOrderChildren"); + return 1; +} + +ListTreeItem * +ListTreeFindSiblingName(ListTreeWidget w, ListTreeItem *item, char *name) +{ + ListTreeItem *first; + + TreeCheck(w, "in ListTreeFindSiblingName"); +/* Get first child in list; */ + if (item) { + while (item->prevsibling) + item = item->prevsibling; + first = item; + + while (item) { + if (strcmp(item->text, name) == 0) + return item; + item = item->nextsibling; + } + return item; + } + return NULL; +} + +ListTreeOpen(ListTreeWidget w, ListTreeItem *item) +{ + item->open = True; + ListTreeRefresh(w); +} + +ListTreeClose(ListTreeWidget w, ListTreeItem *item) +{ + item->open = False; + ListTreeRefresh(w); +} + +ListTreeOpenAll(ListTreeWidget w, ListTreeItem *start, int child_only) +{ + ListTreeItem *item; + + /* Get first child in list; */ + if (start == (ListTreeItem *)NULL) + item = w->list.first; + else + item = start; + + while (item) { + if (item->firstchild) + ChildrenOpen (w, item->firstchild); + item->open = True; + item = item->nextsibling; + if (child_only) + break; + } + ListTreeRefresh(w); +} + +ChildrenOpen (ListTreeWidget w, ListTreeItem *item) +{ + while (item) { + if (item->firstchild) + ChildrenOpen(w, item->firstchild); + item->open = True; + item = item->nextsibling; + } +} + + +ListTreeCloseAll(ListTreeWidget w, ListTreeItem *start, int child_only) +{ + ListTreeItem *item; + + /* Get first child in list; */ + if (start == (ListTreeItem *)NULL) + item = w->list.first; + else + item = start; + + while (item) { + if (item->firstchild) + ChildrenClose (w, item->firstchild); + item->open = False; + item = item->nextsibling; + if (child_only) + break; + } + ListTreeRefresh(w); +} + +ChildrenClose (ListTreeWidget w, ListTreeItem *item) +{ + while (item) { + if (item->firstchild) + ChildrenClose(w, item->firstchild); + item->open = False; + item = item->nextsibling; + } +} + + +ListTreeItem * +ListTreeFindChildName(ListTreeWidget w, ListTreeItem *item, char *name) +{ + TreeCheck(w, "in ListTreeFindChildName"); +/* Get first child in list; */ + if (item && item->firstchild) { + item = item->firstchild; + } + else if (!item && w->list.first){ + item =w->list.first; + } + else item=NULL; + + while (item) { + if (strcmp(item->text, name) == 0) + return item; + item = item->nextsibling; + } + return NULL; +} + + +ListTreeItem * +ListTreeFindChildNameInTree(ListTreeWidget w, ListTreeItem *item, char *name) +{ + ListTreeItem *found = (ListTreeItem *)NULL, *ChildFind(); + + TreeCheck(w, "in ListTreeFindChildName"); +/* Get first child in list; */ + if (item && item->firstchild) + item = item->firstchild; + else if (!item && w->list.first) + item =w->list.first; + else + item=NULL; + + while (item) { + if (item && strcmp(item->text, name) == 0) + return item; + if (item->firstchild) { + found = ChildFind(w, item->firstchild, name); + if (found) + return found; + } + item = item->nextsibling; + } + return NULL; +} + +ListTreeItem * +ChildFind (ListTreeWidget w, ListTreeItem *item, char*name) +{ + ListTreeItem *found = (ListTreeItem *)NULL, *ChildFind(); + + while (item) { + if (item && strcmp(item->text, name) == 0) + return item; + if (item->firstchild) { + found = ChildFind(w, item->firstchild, name); + if (found) + return found; + } + item = item->nextsibling; + } + return NULL; +} + + +void +ListTreeHighlightItem(ListTreeWidget w, ListTreeItem *item) +{ + HighlightAll(w,False,False); + HighlightItem(w,item,True,False); + ListTreeRefresh(w); +} + +void +ListTreeHighlightAll(ListTreeWidget w) +{ + HighlightAllVisible(w,True,False); + ListTreeRefresh(w); +} + +void +ListTreeClearHighlighted(ListTreeWidget w) +{ + HighlightAll(w,False,False); + ListTreeRefresh(w); +} + +void +ListTreeGetHighlighted(ListTreeWidget w,ListTreeMultiReturnStruct *ret) +{ + if (ret) MakeMultiCallbackStruct(w,ret); +} + +void +ListTreeSetHighlighted(ListTreeWidget w,ListTreeItem **items,int count,Boolean clear) +{ + if (clear) HighlightAll(w,False,False); + if (count<0) { + while (*items) { + HighlightItem(w,*items,True,False); + items++; + } + } + else { + int i; + + for (i=0; i<count; i++){ + HighlightItem(w,items[i],True,False); + } + } + ListTreeRefresh(w); +} + +ListTreeItem * +ListTreeFirstItem(w) +ListTreeWidget w; +{ + ListTreeItem *first; + +/* Get first child in widget */ + first = w->list.first; + return first; +} + +Position +ListTreeGetItemPosition(ListTreeWidget w, ListTreeItem *item) +{ + return GetPosition(w, item); +} + +void +ListTreeGetPathname(ListTreeReturnStruct * ret, char *dir) +{ + int count; + + if (*ret->path[0]->text != '/') + strcpy(dir, "/"); + else + strcpy(dir, ""); + strcat(dir, ret->path[0]->text); + count = 1; + while (count < ret->count) { + strcat(dir, "/"); + strcat(dir, ret->path[count]->text); + count++; + } +} + +void +ListTreeGetPathnameFromItem(ListTreeItem *item, char *dir) +{ + char tmppath[1024]; + + *dir='\0'; + while (item) { + sprintf(tmppath,"/%s%s",item->text,dir); + strcpy(dir,tmppath); + item=item->parent; + } +} diff --git a/vendor/x11iraf/obm/ObmW/ListTree.h b/vendor/x11iraf/obm/ObmW/ListTree.h new file mode 100644 index 00000000..833d6d57 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ListTree.h @@ -0,0 +1,123 @@ +/*----------------------------------------------------------------------------- +** ListTree.c A Specialized List widget +** +** Public header file +** +** Copyright (c) 1995 Robert W. McMullen +** +** Permission to use, copy, modify, distribute, and sell this software and its +** documentation for any purpose is hereby granted without fee, provided that +** the above copyright notice appear in all copies and that both that +** copyright notice and this permission notice appear in supporting +** documentation. The author makes no representations about the suitability +** of this software for any purpose. It is provided "as is" without express +** or implied warranty. +** +** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +** ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +** THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +** ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +** SOFTWARE. +*/ + +#ifndef _ListTree_H +#define _ListTree_H + +#include <X11/Core.h> + +#define _ListTree_WIDGET_VERSION 2.0 + +#define XtNmargin "margin" +#define XtNindent "indent" +#define XtNhorizontalSpacing "horizontalSpacing" +#define XtNverticalSpacing "verticalSpacing" +#define XtNlineWidth "lineWidth" +#define XtNbranchPixmap "branchPixmap" +#define XtNbranchOpenPixmap "branchOpenPixmap" +#define XtNleafPixmap "leafPixmap" +#define XtNleafOpenPixmap "leafOpenPixmap" +#define XtNbranchCallback "branchCallback" +#define XtNleafCallback "leafCallback" +#define XtNpathCallback "pathCallback" +#define XtNhighlightCallback "highlightCallback" +#define XtNactivateCallback "activateCallback" + +#define XtBRANCH 1 +#define XtLEAF 2 + +extern WidgetClass listtreeWidgetClass; + +typedef struct _ListTreeClassRec *ListTreeWidgetClass; +typedef struct _ListTreeRec *ListTreeWidget; + +typedef struct _ListTreeItem { + Boolean open; + Boolean highlighted; + char *text; + int length; + int x,y,ytext; + Dimension height; + struct _ListTreeItem *parent, + *firstchild, + *prevsibling,*nextsibling; + XtPointer user_data; +} ListTreeItem; + +typedef struct _ListTreeReturnStruct { + int reason; + ListTreeItem *item; + ListTreeItem **path; + int count; + Boolean open; +} ListTreeReturnStruct; + +typedef struct _ListTreeMultiReturnStruct { + ListTreeItem **items; + int count; +} ListTreeMultiReturnStruct; + +typedef struct _ListTreeActivateStruct { + int reason; + ListTreeItem *item; + Boolean open; + ListTreeItem **path; + int count; +} ListTreeActivateStruct; + +/* +** Public function declarations +*/ +#ifndef _ListTree_ +#if __STDC__ || defined(__cplusplus) +#define P_(s) s +#else +#define P_(s) () +#endif + +/* ListTree.c */ +void ListTreeRefresh P_((Widget w)); +void ListTreeRefreshOff P_((Widget w)); +void ListTreeRefreshOn P_((Widget w)); +ListTreeItem *ListTreeAdd P_((Widget w, ListTreeItem *parent, char *string)); +void ListTreeRenameItem P_((Widget w, ListTreeItem *item, char *string)); +int ListTreeDelete P_((Widget w, ListTreeItem *item)); +int ListTreeDeleteChildren P_((Widget w, ListTreeItem *item)); +int ListTreeReparent P_((Widget w, ListTreeItem *item, ListTreeItem *newparent)); +int ListTreeReparentChildren P_((Widget w, ListTreeItem *item, ListTreeItem *newparent)); +int ListTreeOrderSiblings P_((Widget w, ListTreeItem *item)); +int ListTreeOrderChildren P_((Widget w, ListTreeItem *item)); +ListTreeItem *ListTreeFindSiblingName P_((Widget w, ListTreeItem *item, char *name)); +ListTreeItem *ListTreeFindChildName P_((Widget w, ListTreeItem *item, char *name)); +void ListTreeHighlightItem P_((Widget w, ListTreeItem *item)); +ListTreeItem *ListTreeFirstItem P_((Widget w)); +#ifdef USE_RDD +void ListTreeHighlightDrop P_((Widget w, XEvent *event, String *params, Cardinal *num_params)); +ListTreeReturnStruct *ListTreeGetDrop P_((Widget w)); +#endif + +#undef P_ +#endif + +#endif /* _ListTree_H */ diff --git a/vendor/x11iraf/obm/ObmW/ListTreeP.h b/vendor/x11iraf/obm/ObmW/ListTreeP.h new file mode 100644 index 00000000..a6e369fe --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ListTreeP.h @@ -0,0 +1,109 @@ +/*----------------------------------------------------------------------------- +** ListTree.c A Specialized List widget +** +** Private header file +** +** Copyright (c) 1995 Robert W. McMullen +** +** Permission to use, copy, modify, distribute, and sell this software and its +** documentation for any purpose is hereby granted without fee, provided that +** the above copyright notice appear in all copies and that both that +** copyright notice and this permission notice appear in supporting +** documentation. The author makes no representations about the suitability +** of this software for any purpose. It is provided "as is" without express +** or implied warranty. +** +** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +** ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +** THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +** ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +** SOFTWARE. +*/ + +#ifndef _ListTreeP_H +#define _ListTreeP_H + +#include <X11/Core.h> + +#include "ListTree.h" +#define ListTreeRET_ALLOC 10 + +#define TIMER_CLEAR 0 +#define TIMER_SINGLE 1 +#define TIMER_DOUBLE 2 +#define TIMER_WAITING 3 + +typedef struct { + int dummy; /* keep compiler happy with dummy field */ +} ListTreeClassPart; + +typedef struct _ListTreeClassRec { + CoreClassPart core_class; + ListTreeClassPart ListTree_class; +} ListTreeClassRec; + +extern ListTreeClassRec listtreeClassRec; + +typedef struct { + Pixmap bitmap; + Pixmap pix; + int width,height; + int xoff; +} Pixinfo; + +typedef struct { + /* Public stuff ... */ + long foreground_pixel; + XFontStruct *font; + int NumItems; + Dimension HSpacing; + Dimension VSpacing; +/* Dimension LabelSpacing;*/ + Dimension Margin; + Dimension Indent; + Pixinfo Open; + Pixinfo Closed; + Pixinfo Leaf; + Pixinfo LeafOpen; + Dimension LineWidth; + XtCallbackList BranchCallback; + XtCallbackList LeafCallback; + XtCallbackList PathCallback; + XtCallbackList HighlightCallback; + XtCallbackList ActivateCallback; + + /* Private stuff ... */ + GC drawGC; + GC eraseGC; + GC eorGC; + GC highlightGC; + int exposeTop,exposeBot; + int pixWidth; + int preferredWidth,preferredHeight; + ListTreeItem *first, /* always points to a top level entry */ + *highlighted, + *drop_highlighted; + + XtIntervalId timer_id; /* timer for double click test */ + ListTreeItem *timer_item; /* item to make sure both clicks */ + /* occurred on the same item */ + int timer_type; /* flag for type of click that just happened */ + int timer_y; + int timer_x; + int multi_click_time; + + ListTreeItem **ret_item_list; + int ret_item_alloc; + + Boolean Refresh; +} ListTreePart; + +typedef struct _ListTreeRec { + CorePart core; + ListTreePart list; +} ListTreeRec; + + +#endif /* _ListTreeP_H */ diff --git a/vendor/x11iraf/obm/ObmW/Makefile b/vendor/x11iraf/obm/ObmW/Makefile new file mode 100644 index 00000000..ce258853 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Makefile @@ -0,0 +1,1192 @@ +# Makefile generated by imake - do not edit! +# $Xorg: imake.c,v 1.6 2001/02/09 02:03:15 xorgcvs Exp $ + +# ---------------------------------------------------------------------- +# Makefile generated from "Imake.tmpl" and </tmp/IIf.rEU2JZ> +# $Xorg: Imake.tmpl,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/Imake.tmpl,v 3.138 2002/12/10 03:20:41 dawes Exp $ +# ---------------------------------------------------------------------- + +all:: + +.SUFFIXES: .i + +# $Xorg: Imake.cf,v 1.4 2000/08/17 19:41:45 cpqbld Exp $ + +# $XFree86: xc/config/cf/Imake.cf,v 3.80 2003/01/15 02:52:12 dawes Exp $ + +# Keep cpp from replacing path elements containing i486/i586/i686 + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that need to come before +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# $XFree86: xc/config/cf/xf86site.def,v 3.181 2002/02/22 21:32:33 dawes Exp $ + +# ---------------------------------------------------------------------- +# platform-specific configuration parameters - edit linux.cf to change + +# platform: $Xorg: linux.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ + +# platform: $XFree86: xc/config/cf/linux.cf,v 3.201tsi Exp $ + +# operating system: Linux 2.4.29-4aslsmp i686 [ELF] (2.4.29) +# libc: (6.3.2) +# binutils: (213) + +# $Xorg: lnxLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.rules,v 3.43 2002/04/04 14:05:33 eich Exp $ + +# $XFree86: xc/config/cf/xfree86.cf,v 3.439.2.1 2003/03/13 04:10:40 tsi Exp $ + +# $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ + +VENDORMANNAME = XFree86 +VENDORMANVERSION = `echo 4 3 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + +AFB_DEFS = -DUSE_AFB + +DRIVERSDKDIR = $(USRLIBDIR)/Server +DRIVERSDKMODULEDIR = $(USRLIBDIR)/Server/modules +DRIVERSDKINCLUDEDIR = $(USRLIBDIR)/Server/include + + XF86SRC = $(SERVERSRC)/hw/xfree86 + XF86COMSRC = $(XF86SRC)/common + XF86PARSERSRC = $(XF86SRC)/parser + XF86OSSRC = $(XF86SRC)/os-support + XF86DRIVERSRC = $(XF86SRC)/drivers + DRIVERSRC = $(XF86DRIVERSRC) + + XFREE86DOCDIR = $(DOCDIR) + XFREE86PSDOCDIR = $(DOCPSDIR) + XFREE86HTMLDOCDIR = $(DOCHTMLDIR) +XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese + +# $Xorg: xf86.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ + +# $XFree86: xc/config/cf/xf86.rules,v 3.33 2001/01/17 16:38:51 dawes Exp $ + +# ---------------------------------------------------------------------- +# site-specific configuration parameters that go after +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# --------------------------------------------------------------------- +# Imake rules for building libraries, programs, scripts, and data files +# rules: $Xorg: Imake.rules,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# rules: $XFree86: xc/config/cf/Imake.rules,v 3.112 2002/11/14 21:01:13 tsi Exp $ + + _NULLCMD_ = @ echo -n + +GLIDE2INCDIR = /usr/include/glide + +GLIDE3INCDIR = /usr/include/glide3 + +GLIDE3LIBNAME = glide3 + +TKLIBNAME = + +TKLIBDIR = + +TCLLIBNAME = + +TCLIBDIR = + + PATHSEP = / + SHELL = /bin/sh -e + + TOP = ../.. + CURRENT_DIR = obm/ObmW + + IMAKE = imake + DEPEND = gccmakedep + MKDIRHIER = mkdir -p + REVPATH = revpath + EXPORTLISTGEN = + RMAN = rman + RMANBASENAME = rman + RMANOPTIONS = -f HTML + CONFIGSRC = $(TOP)/config + IMAKESRC = $(CONFIGSRC)/imake + DEPENDSRC = $(CONFIGSRC)/util + + INCROOT = /usr/X11R6/include + USRLIBDIR = /usr/X11R6/lib + VARDIR = /var + VARLIBDIR = $(VARDIR)/lib + SYSTEMUSRLIBDIR = /usr/lib + SYSTEMUSRINCDIR = /usr/include + SHLIBDIR = /usr/X11R6/lib + LINTLIBDIR = $(USRLIBDIR)/lint + MANPATH = /usr/X11R6/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(MANSOURCEPATH)1 + LIBMANDIR = $(MANSOURCEPATH)3 + FILEMANDIR = $(MANSOURCEPATH)5 + MISCMANDIR = $(MANSOURCEPATH)7 + DRIVERMANDIR = $(MANSOURCEPATH)4 + ICONDIR = /usr/share/icons + XCURSORPATH = "~/.icons:/usr/share/icons:/usr/share/pixmaps" + LOGDIRECTORY = $(VARDIR)/log + + VARRUNDIR = $(VARDIR)/run + + VARDBDIR = $(VARDIR)/lib + + AR = ar clq + +# Nice try but useless: make will inherit BOOTSTRAPCFLAGS +# from top Makefile + BOOTSTRAPCFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -pipe + + CC = gcc -m32 + AS = gcc -m32 -c -x assembler + +.SUFFIXES: .cc + + CXX = c++ -m32 + + CXXFILT = c++filt + CXXLIB = + CXXDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe +CXXDEPENDINCLUDES = + CXXEXTRA_DEFINES = +CXXEXTRA_INCLUDES = + CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(CXXPROJECT_DEFINES) + CXXOPTIONS = + CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) + CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(DEFINES) $(CXXEXTRA_DEFINES) + CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) + + COMPRESS = compress + GZIPCMD = gzip + + CPP = /usr/bin/cpp $(STD_CPP_DEFINES) + RAWCPP = /usr/bin/cpp -undef $(STD_CPP_OPTIONS) + PREPROCESSCMD = gcc -m32 -E $(STD_CPP_DEFINES) + + INSTALL = install + INSTALLFLAGS = -c + + LD = gcc -m32 -nostdlib + + LEX = flex -l + M4 = m4 + M4FLAGS = + LEXLIB = -lfl + YACC = bison -y + CCYACC = bison -y + + LINT = lint + + LINTLIBFLAG = -C + LINTOPTS = -axz + LN = ln -s + MAKE = make + MV = mv -f + CP = cp + + RANLIB = ranlib + + RANLIBINSTFLAGS = + + RM = rm -f + PERL = perl + PERLOPTS = + MANSUFFIX = 1x + LIBMANSUFFIX = 3x + FILEMANSUFFIX = 5x + MISCMANSUFFIX = 7x + DRIVERMANSUFFIX = 4x + MANSRCSUFFIX = man + MANNEWSUFFIX = _man + MANDEFS = -D__apploaddir__=$(XAPPLOADDIR) -D__filemansuffix__=$(FILEMANSUFFIX) -D__libmansuffix__=$(LIBMANSUFFIX) -D__miscmansuffix__=$(MISCMANSUFFIX) -D__drivermansuffix__=$(DRIVERMANSUFFIX) -D__projectroot__=$(PROJECTROOT) $(XORGMANDEFS) $(VENDORMANDEFS) + + COMPRESSMANCMD = gzip -n + + TROFF = groff -Tps + NROFF = nroff + MSMACROS = -ms + MANMACROS = -man + TBL = tbl + EQN = eqn + NEQN = neqn + COL = col + COLFLAGS = -b + + MODCC = gcc -m32 + + MODCPP = /usr/bin/cpp + MODCFLAGS = $(CFLAGS) + MODAS = gcc -m32 -c -x assembler + MODASFLAGS = + + MODLD = gcc -m32 -nostdlib + + MODLDFLAGS = +MODLDCOMBINEFLAGS = -r + MODAR = ar clq + + MODRANLIB = ranlib + + STD_INCLUDES = + STD_CPP_OPTIONS = -traditional + STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) + STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) + EXTRA_LOAD_FLAGS = + EXTRA_LDOPTIONS = + EXTRA_LIBRARIES = + TAGS = ctags + + PARALLELMFLAGS = + + SHAREDCODEDEF = + SHLIBDEF = + + SHLIBLDFLAGS = -shared $(SHLIBGLOBALSFLAGS) + + PICFLAGS = -fPIC + + CXXPICFLAGS = -fPIC + + PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO + + INSTPGMFLAGS = + + INSTBINFLAGS = -m 0755 + INSTUIDFLAGS = -m 4711 + INSTLIBFLAGS = -m 0644 + INSTINCFLAGS = -m 0444 + INSTMANFLAGS = -m 0444 + INSTDATFLAGS = -m 0444 + INSTKMEMFLAGS = -m 4711 + + PROJECTROOT = /usr/X11R6 + + CDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe + CCOPTIONS = + + ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) + LDPRELIB = -L$(USRLIBDIR) $(INSTALLED_LIBS) + LDPOSTLIB = + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + + LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + + CCLINK = $(CC) + + CXXLINK = $(CXX) + + LDSTRIPFLAGS = -x + LDCOMBINEFLAGS = -r + DEPENDFLAGS = + DEPEND_DEFINES = + +# Not sure this belongs here + TKLIBDIR = + TKINCDIR = + TKLIBNAME = + TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME) + TCLLIBDIR = + TCLINCDIR = + TCLLIBNAME = + TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME) + + MACROFILE = linux.cf + RM_CMD = $(RM) + + IMAKE_DEFINES = + IMAKE_WARNINGS = -Wundef + + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_WARNINGS) + + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) + +# $Xorg: X11.rules,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/X11.rules,v 1.5 2000/11/06 19:24:00 dawes Exp $ + +# ---------------------------------------------------------------------- +# X Window System Build Parameters and Rules +# $Xorg: X11.tmpl,v 1.6 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/X11.tmpl,v 1.196.2.2 2003/09/17 05:58:15 herrb Exp $ + +XORGRELSTRING = Release 6.6 +XORGMANNAME = X Version 11 + +VENDORMANNAME = XFree86 +VENDORMANVERSION = `echo 4 3 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + +STICKY_DEFINES = -DHAS_STICKY_DIR_BIT + +FCHOWN_DEFINES = -DHAS_FCHOWN + +# ----------------------------------------------------------------------- +# X Window System make variables; these need to be coordinated with rules + + XTOP = $(TOP) + BINDIR = /usr/X11R6/bin + BUILDINCROOT = $(TOP)/exports + BUILDINCDIR = $(BUILDINCROOT)/include + BUILDINCTOP = ../.. + BUILDLIBDIR = $(TOP)/exports/lib + BUILDLIBTOP = ../.. + BUILDBINDIR = $(TOP)/exports/bin + BUILDBINTOP = ../.. + BUILDMODULEDIR = $(BUILDLIBDIR)/modules + BUILDMODULETOP = $(BUILDLIBTOP)/.. + XBUILDINCROOT = $(XTOP)/exports + XBUILDINCDIR = $(XBUILDINCROOT)/include/X11 + XBUILDINCTOP = ../../.. + XBUILDBINDIR = $(XBUILDINCROOT)/bin + INCDIR = $(INCROOT) + ADMDIR = /var/log + LIBDIR = /usr/X11R6/lib/X11 + LIBEXECDIR = /usr/X11R6/libexec + MODULEDIR = $(USRLIBDIR)/modules + TOP_X_INCLUDES = + + ETCX11DIR = /etc/X11 + + CONFDIR = $(ETCX11DIR) + + DOCDIR = $(LIBDIR)/doc + DOCHTMLDIR = $(DOCDIR)/html + DOCPSDIR = $(DOCDIR)/PostScript + FONTDIR = $(LIBDIR)/fonts + ENCODINGSDIR = $(FONTDIR)/encodings + XINITDIR = /etc/X11/xinit + XDMDIR = /etc/X11/xdm + XDMVARDIR = $(VARLIBDIR)/xdm + TWMDIR = $(LIBDIR)/twm + XSMDIR = $(LIBDIR)/xsm + NLSDIR = $(LIBDIR)/nls + XLOCALEDIR = $(LIBDIR)/locale + PEXAPIDIR = $(LIBDIR)/PEX + LBXPROXYDIR = /etc/X11/lbxproxy + PROXYMANAGERDIR = /etc/X11/proxymngr + XPRINTDIR = /etc/X11/xserver + XAPPLOADDIR = $(LIBDIR)/app-defaults + FONTCFLAGS = -t + + INSTAPPFLAGS = $(INSTDATFLAGS) + + RGB = $(BINDIR)/rgb + FONTC = $(BINDIR)/bdftopcf + MKFONTDIR = $(BINDIR)/mkfontdir + MKHTMLINDEX = $(BINDIR)/mkhtmlindex + UCS2ANY = $(BINDIR)/ucs2any + BDFTRUNCATE = $(BINDIR)/bdftruncate + UCSMAPPREFIX = $(FONTDIR)/util/map- + XCURSORGEN = $(BINDIR)/xcursorgen + + HTMLINDEXCMD = HtmlIndexCmd + + DOCUTILSRC = $(XTOP)/doc/util + CLIENTSRC = $(TOP)/clients + DEMOSRC = $(TOP)/demos + XDOCMACROS = $(DOCUTILSRC)/macros.t + XIDXMACROS = $(DOCUTILSRC)/indexmacros.t + PROGRAMSRC = $(TOP)/programs + LIBSRC = $(XTOP)/lib + FONTSRC = $(XTOP)/fonts + ENCODINGSSRC = $(FONTSRC)/encodings + INCLUDESRC = $(BUILDINCROOT)/include + XINCLUDESRC = $(INCLUDESRC)/X11 + SERVERSRC = $(XTOP)/programs/Xserver + CONTRIBSRC = $(XTOP)/../contrib + UNSUPPORTEDSRC = $(XTOP)/unsupported + DOCSRC = $(XTOP)/doc + RGBSRC = $(XTOP)/programs/rgb + BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf + MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir + FONTSERVERSRC = $(PROGRAMSRC)/xfs + FONTINCSRC = $(XTOP)/include/fonts + EXTINCSRC = $(XTOP)/include/extensions + FTSOURCEDIR = $(TOP)/extras/FreeType + XTTSOURCEDIR = $(TOP)/extras/X-TrueType + MESASRCDIR = $(TOP)/extras/Mesa + OGLSAMPLESRCDIR = $(TOP)/extras/ogl-sample + PSWRAPSRC = $(XTOP)/config/pswrap + TRANSCOMMSRC = $(LIBSRC)/xtrans + TRANS_INCLUDES = -I$(TRANSCOMMSRC) + CONNECTION_FLAGS = -DUNIXCONN -DTCPCONN $(STICKY_DEFINES) $(FCHOWN_DEFINES) + + XORGMANDEFS = -D__xorgversion__='"$(XORGRELSTRING)" "$(XORGMANNAME)"' + VENDORMANDEFS = -D__vendorversion__="\"Version $(VENDORMANVERSION)\" $(VENDORMANNAME)" + + XENVLIBDIR = $(USRLIBDIR) + CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR) + +# $Xorg: lnxLib.tmpl,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.tmpl,v 3.13 2001/01/17 16:22:32 dawes Exp $ + + XLIBSRC = $(LIBSRC)/X11 + +SOXLIBREV = 6.2 +DEPXONLYLIB = +XONLYLIB = -lX11 + +LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln + + XLIBONLY = $(XONLYLIB) + + XEXTLIBSRC = $(LIBSRC)/Xext + +SOXEXTREV = 6.4 +DEPEXTENSIONLIB = +EXTENSIONLIB = -lXext + +LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln + +LINTEXTENSIONLIB = $(LINTEXTENSION) + DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) + XLIB = $(EXTENSIONLIB) $(XONLYLIB) + LINTXLIB = $(LINTXONLYLIB) + + XSSLIBSRC = $(LIBSRC)/Xss + +DEPXSSLIB = $(USRLIBDIR)/libXss.a +XSSLIB = -lXss + +LINTXSS = $(LINTLIBDIR)/llib-lXss.ln + + XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc + +DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a +XXF86MISCLIB = -lXxf86misc + +LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln + + XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm + +DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a +XXF86VMLIB = -lXxf86vm + +LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln + + XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga + +DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a +XXF86DGALIB = -lXxf86dga + +LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln + + XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush + +DEPXXF86RUSHLIB = $(USRLIBDIR)/libXxf86rush.a +XXF86RUSHLIB = -lXxf86rush + +LINTXXF86RUSH = $(LINTLIBDIR)/llib-lXxf86rush.ln + + XVLIBSRC = $(LIBSRC)/Xv + +SOXVREV = 1.0 +DEPXVLIB = +XVLIB = -lXv + +LINTXV = $(LINTLIBDIR)/llib-lXv.ln + + XVMCLIBSRC = $(LIBSRC)/XvMC + +DEPXVMCLIB = $(USRLIBDIR)/libXvMC.a +XVMCLIB = -lXvMC + +LINTXVMC = $(LINTLIBDIR)/llib-lXvMC.ln + + XINERAMALIBSRC = $(LIBSRC)/Xinerama + +DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a +XINERAMALIB = -lXinerama + +LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln + + XRESLIBSRC = $(LIBSRC)/XRes + +DEPXRESLIB = $(USRLIBDIR)/libXRes.a +XRESLIB = -lXRes + +LINTXRES = $(LINTLIBDIR)/llib-lXRes.ln + + DPSLIBSRC = $(LIBSRC)/dps + +SODPSREV = 1.0 +DEPDPSLIB = +DPSLIB = -ldps + +LINTDPS = $(LINTLIBDIR)/llib-ldps.ln + + DPSTKLIBSRC = $(LIBSRC)/dpstk + +SODPSTKREV = 1.0 +DEPDPSTKLIB = +DPSTKLIB = -ldpstk + +LINTDPSTK = $(LINTLIBDIR)/llib-ldpstk.ln + + PSRESLIBSRC = $(LIBSRC)/psres + +SOPSRESREV = 1.0 +DEPPSRESLIB = +PSRESLIB = -lpsres + +LINTPSRES = $(LINTLIBDIR)/llib-lpsres.ln + + GLULIBSRC = $(LIBSRC)/GLU + +SOGLUREV = 1.3 +DEPGLULIB = +GLULIB = -lGLU + +LINTGLU = $(LINTLIBDIR)/llib-lGLU.ln + + GLXLIBSRC = $(LIBSRC)/GL + +SOGLREV = 1.2 +DEPGLXLIB = +GLXLIB = -lGL + +LINTGLX = $(LINTLIBDIR)/llib-lGL.ln + + GLWIDGETSRC = $(LIBSRC)/GLw + +DEPGLWLIB = $(USRLIBDIR)/libGLw.a +GLWLIB = -lGLw + +LINTGLW = $(LINTLIBDIR)/llib-lGLw.ln + + XRENDERLIBSRC = $(LIBSRC)/Xrender + +SOXRENDERREV = 1.2 +DEPXRENDERLIB = +XRENDERLIB = -lXrender + +LINTXRENDER = $(LINTLIBDIR)/llib-lXrender.ln + + XRANDRRLIBSRC = $(LIBSRC)/Xrandr + +SOXRANDRREV = 2.0 +DEPXRANDRLIB = +XRANDRLIB = -lXrandr + +LINTXRANDR = $(LINTLIBDIR)/llib-lXrandr.ln + + XCURSORRLIBSRC = $(LIBSRC)/Xcursor + +SOXCURSORREV = 1.0 +DEPXCURSORLIB = +XCURSORLIB = -lXcursor + +LINTXCURSOR = $(LINTLIBDIR)/llib-lXcursor.ln + + XFONTCACHELIBSRC = $(LIBSRC)/Xfontcache + +DEPXFONTCACHELIB = $(USRLIBDIR)/libXfontcache.a +XFONTCACHELIB = -lXfontcache + +LINTXFONTCACHE = $(LINTLIBDIR)/llib-lXfontcache.ln + + XAUTHSRC = $(LIBSRC)/Xau + +DEPXAUTHLIB = $(USRLIBDIR)/libXau.a +XAUTHLIB = -lXau + +LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln + + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + +DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a +XDMCPLIB = -lXdmcp + +LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln + + XMUSRC = $(LIBSRC)/Xmu + +SOXMUREV = 6.2 +DEPXMULIB = +XMULIB = -lXmu + +LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln + + XMUUSRC = $(LIBSRC)/Xmuu + +SOXMUUREV = 1.0 +DEPXMUULIB = +XMUULIB = -lXmuu + +LINTXMUU = $(LINTLIBDIR)/llib-lXmuu.ln + + OLDXLIBSRC = $(LIBSRC)/oldX + +DEPOLDXLIB = $(USRLIBDIR)/liboldX.a +OLDXLIB = -loldX + +LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln + + XPLIBSRC = $(LIBSRC)/Xp + +SOXPREV = 6.2 +DEPXPLIB = +XPLIB = -lXp + +LINTXP = $(LINTLIBDIR)/llib-lXp.ln + + TOOLKITSRC = $(LIBSRC)/Xt + +SOXTREV = 6.0 +DEPXTOOLONLYLIB = +XTOOLONLYLIB = -lXt + +LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln + + DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) + XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) + LINTXTOOLLIB = $(LINTXTOOLONLYLIB) + + XALIBSRC = $(LIBSRC)/Xa + +SOXAREV = 1.0 +DEPXALIB = +XALIB = -lXa + +LINTXA = $(LINTLIBDIR)/llib-lXa.ln + + AWIDGETSRC = $(LIBSRC)/Xaw + +SOXAWREV = 7.0 +DEPXAWLIB = +XAWLIB = -lXaw + +LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln + + AWIDGET6SRC = $(LIBSRC)/Xaw6 + +SOXAW6REV = 6.1 +DEPXAW6LIB = +XAW6LIB = -lXaw + +LINTXAW6 = $(LINTLIBDIR)/llib-lXaw.ln + + XILIBSRC = $(LIBSRC)/Xi + +SOXINPUTREV = 6.0 +DEPXILIB = +XILIB = -lXi + +LINTXI = $(LINTLIBDIR)/llib-lXi.ln + + XTESTLIBSRC = $(LIBSRC)/Xtst + +SOXTESTREV = 6.1 +DEPXTESTLIB = +XTESTLIB = -lXtst + +LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln + + PEXLIBSRC = $(LIBSRC)/PEX5 + +SOPEXREV = 6.0 +DEPPEXLIB = +PEXLIB = -lPEX5 + +LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln + + XIELIBSRC = $(LIBSRC)/XIE + +SOXIEREV = 6.0 +DEPXIELIB = +XIELIB = -lXIE + +LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln + + PHIGSLIBSRC = $(LIBSRC)/PHIGS + +DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a +PHIGSLIB = -lphigs + +LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln + +DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a +XBSDLIB = -lXbsd + +LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln + + ICESRC = $(LIBSRC)/ICE + +SOICEREV = 6.3 +DEPICELIB = +ICELIB = -lICE + +LINTICE = $(LINTLIBDIR)/llib-lICE.ln + + SMSRC = $(LIBSRC)/SM + +SOSMREV = 6.0 +DEPSMLIB = +SMLIB = -lSM + +LINTSM = $(LINTLIBDIR)/llib-lSM.ln + + XKEYSRC = $(LIBSRC)/Xkey + +SOXKEYREV = 6.0 +DEPXKEYLIB = +XKEYLIB = -lXkey + +LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln + + FSLIBSRC = $(LIBSRC)/FS + +DEPFSLIB = $(USRLIBDIR)/libFS.a +FSLIB = -lFS + +LINTFS = $(LINTLIBDIR)/llib-lFS.ln + + FONTLIBSRC = $(LIBSRC)/font + +SOFONTREV = 1.4 +DEPFONTLIB = +FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln +# +SOFONTREV = 1.4 +DEPXFONTLIB = +XFONTLIB = -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln + + FONTSTUBLIBSRC = $(FONTLIBSRC)/stubs + +DEPFONTSTUBLIB = $(USRLIBDIR)/libfntstubs.a +FONTSTUBLIB = -lfntstubs + +LINTFONTSTUB = $(LINTLIBDIR)/llib-lfntstubs.ln + DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) + FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) $(FONTFT2LIB) + + FONTENCLIBSRC = $(LIBSRC)/fontenc + +DEPXFONTENCLIB = $(USRLIBDIR)/libfontenc.a +XFONTENCLIB = -lfontenc + +LINTXFONTENC = $(LINTLIBDIR)/llib-lfontenc.ln + + XPMLIBSRC = $(LIBSRC)/Xpm + +SOXPMREV = 4.11 +DEPXPMLIB = +XPMLIB = -lXpm + +LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln + +FREETYPE2DIR = /usr +FREETYPE2LIBDIR = /usr/lib +FREETYPE2INCDIR = /usr/include/freetype2 + +FREETYPE2LIB = -lfreetype + +FREETYPE2INCLUDES = -I$(FREETYPE2INCDIR) +FREETYPE2DEFINES = -DFREETYPE2 + + EXPATLIBSRC = $(LIBSRC)/expat + +SOEXPATREV = 1.0 +DEPEXPATLIB = +EXPATLIB = -lexpat + +LINTEXPAT = $(LINTLIBDIR)/llib-lexpat.ln + +EXPATDIR = /usr +EXPATLIBDIR = /usr/lib +EXPATINCDIR = /usr/include + +EXPATINCLUDES = + +EXPATLIB = -lexpat + +EXPATDEFINES = -DEXPAT + + XFT1LIBSRC = $(LIBSRC)/Xft1 + +SOXFT1REV = 1.1 +DEPXFT1LIB = +XFT1LIB = -lXft + +LINTXFT1 = $(LINTLIBDIR)/llib-lXft.ln + + XFTLIBSRC = $(LIBSRC)/Xft + +SOXFTREV = 2.1 +DEPXFTLIB = +XFTLIB = -lXft + +LINTXFT = $(LINTLIBDIR)/llib-lXft.ln + +XFTINCLUDES=$(FONTCONFIGINCLUDES) $(FREETYPE2INCLUDES) + +FONTCONFIGDIR = /usr +FONTCONFIGLIBDIR = /usr/lib +FONTCONFIGINCDIR = /usr/include +FONTCONFIGBINDIR = /usr/bin + +FONTCONFIGLIB = -lfontconfig + +FONTCONFIGINCLUDES = + +FCCACHE = $(FONTCONFIGBINDIR)/fc-cache + +FONTCONFIGDEFINES = -DFONTCONFIG + +LIBPNGINCDIR = /usr/include + +LIBPNGINC= + +LIBPNGDIR = /usr +LIBPNGLIBDIR = /usr/lib +LIBPNGINCDIR = /usr/include + +LIBPNGLIB = -lpng + + XKBFILELIBSRC = $(LIBSRC)/xkbfile + +DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a +XKBFILELIB = -lxkbfile + +LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln + + XKBCOMPCMD = $(BINDIR)/xkbcomp + + XKBUILIBSRC = $(LIBSRC)/xkbui + +DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a +XKBUILIB = -lxkbui + +LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln + + XTRAPLIBSRC = $(LIBSRC)/XTrap + +SOXTRAPREV = 6.4 +DEPXTRAPLIB = +XTRAPLIB = -lXTrap + +LINTXTRAP = $(LINTLIBDIR)/llib-lXTrap.ln + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + + DEPLIBS1 = $(DEPLIBS) + DEPLIBS2 = $(DEPLIBS) + DEPLIBS3 = $(DEPLIBS) + DEPLIBS4 = $(DEPLIBS) + DEPLIBS5 = $(DEPLIBS) + DEPLIBS6 = $(DEPLIBS) + DEPLIBS7 = $(DEPLIBS) + DEPLIBS8 = $(DEPLIBS) + DEPLIBS9 = $(DEPLIBS) + DEPLIBS10 = $(DEPLIBS) + +XMULIBONLY = -lXmu +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) + + CONFIGDIR = $(LIBDIR)/config + + USRLIBDIRPATH = $(USRLIBDIR) + LDPRELIBS = -L$(USRLIBDIR) $(INSTALLED_LIBS) + LDPOSTLIBS = + TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES) + PROJECT_DEFINES = + +CXXPROJECT_DEFINES = + +# ---------------------------------------------------------------------- +# start of Imakefile + +# Imakefile for the Object Manager special widget library. +# 05-Sep-93, Doug Tody NOAO/IRAF. + +X11IRAFDIR = ../../ + +# $Xorg: Library.tmpl,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/Library.tmpl,v 3.20 2002/11/25 14:04:47 eich Exp $ + + CC = gcc -m32 + + CCOPTIONS = +STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) +CDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe +CLIBDEBUGFLAGS = + CFLAGS = $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) + +LIB_MT_DEFINES = LibraryMTDefines + +SOSYMLINK = true + + X11IRAFBINDIR = $(X11IRAFDIR)/bin + X11IRAFMANDIR = $(X11IRAFDIR)/man + X11IRAFLIBDIR = $(X11IRAFDIR)/lib + X11IRAFINCDIR = $(X11IRAFDIR)/include + + XGTERMDIR = $(X11IRAFDIR)/xgterm + XIMTOOLDIR = $(X11IRAFDIR)/ximtool + XTAPEMONDIR = $(X11IRAFDIR)/xtapemon + OBMSHDIR = $(X11IRAFDIR)/obmsh + OBMDIR = $(X11IRAFDIR)/obm + XPMDIR = $(X11IRAFDIR)/xpm + XAW3DDIR = $(X11IRAFDIR)/xaw3d + CDLDIR = $(X11IRAFDIR)/cdl + + DEPLIBOBM = $(OBMDIR)/libobm.a + LIBOBM = -lobm + DEPLIBXPM = $(XPMDIR)/libXpm.a + LIBXPM = -lXpm + DEPLIBXAW3D = $(XAW3DDIR)/libXaw3d.a + LIBXAW3D = -lXaw3d + LIBCDL = -lcdl + + X11IRAF_LDFLAGS = -L$(X11IRAFDIR)/lib -L../lib + X11IRAF_INCLUDES = -I$(X11IRAFDIR)/include -I../include + + CP = cp -p + + EXTRA_INCLUDES = -I../../include + EXTRA_DEFINES = -D_NO_PROTO + +# Hack to compile under SunPRO V4 on Solaris + + CCOPTIONS = -DUSE_STDARG + +HEADERS = Arrow.h ArrowP.h Board.h BoardP.h Button.h ButtonP.h Common.h CommonP.h Converters.h DrawingArea.h DrawingAreaP.h Frame.h FrameP.h Group.h GroupP.h Gterm.h GtermP.h HTML.h HTMLP.h HTMLamp.h Icon.h IconP.h Label.h LabelP.h Layout.h LayoutP.h MenuBar.h MenuBarP.h MultiList.h MultiListP.h RadioGrp.h RadioGrpP.h RowCol.h RowColP.h Scrollbar.h ScrollbarP.h Slider2.h Slider2P.h TabString.h Toggle.h ToggleP.h done.h inkstore.h laygram.h scroll.h Tabs.h TabsP.h Gcs.h ListTree.h ListTreeP.h + +XRAW_HEADERS = 3d.h AllWidgets.h Arrow.h ArrowP.h AsciiSink.h AsciiSinkP.h AsciiSrc.h AsciiSrcP.h AsciiText.h AsciiTextP.h Box.h BoxP.h Cardinals.h Clock.h ClockP.h Command.h CommandP.h Container.h ContainerP.h Dialog.h DialogP.h Form.h FormP.h Frame.h FrameP.h Grip.h GripP.h Label.h LabelP.h List.h ListP.h Logo.h LogoP.h Mailbox.h MailboxP.h MenuButtoP.h MenuButton.h Object.h Paned.h PanedP.h Panner.h PannerP.h Porthole.h PortholeP.h Repeater.h RepeaterP.h Reports.h Scrollbar.h ScrollbarP.h ScrolledTable.h ScrolledTableP.h Separator.h SeparatorP.h Simple.h SimpleMenP.h SimpleMenu.h SimpleP.h Sme.h SmeBSB.h SmeBSBP.h SmeLine.h SmeLineP.h SmeP.h StripCharP.h StripChart.h Table.h Table3d.h TableP.h TableUtil.h Template.h TemplateP.h Text.h TextP.h TextSink.h TextSinkP.h TextSrc.h TextSrcP.h Toggle.h ToggleP.h Tree.h TreeP.h Viewport.h ViewportP.h XawAll.h XawInit.h Xosdefs.h XrawInit.h color.h xraw_table.h + +SRCS = Arrow.c Board.c Button.c Common.c DrawIString.c DrawString.c DrawingArea.c Frame.c Group.c Gterm.c HTML-PSformat.c HTML.c HTMLformat.c HTMLimages.c HTMLjot.c HTMLlists.c HTMLparse.c HTMLwidgets.c Icon.c Label.c Layout.c MenuBar.c MultiList.c RadioGrp.c RowCol.c Scrollbar.c Slider2.c Tablist2Tabs.c TextWidth.c Toggle.c cvtLong.c iconutil.c laygram.c laylex.c scroll.c strnchr.c Tabs.c Gcs.c ListTree.c Separator.c Table.c Table3d.c TableUtil.c Container.c color.c + +OBJS = Arrow.o Board.o Button.o Common.o DrawIString.o DrawString.o DrawingArea.o Frame.o Group.o Gterm.o HTML-PSformat.o HTML.o HTMLformat.o HTMLimages.o HTMLjot.o HTMLlists.o HTMLparse.o HTMLwidgets.o Icon.o Label.o Layout.o MenuBar.o MultiList.o RadioGrp.o RowCol.o Scrollbar.o Slider2.o Tablist2Tabs.o TextWidth.o Toggle.o cvtLong.o iconutil.o laygram.o laylex.o scroll.o strnchr.o Tabs.o Gcs.o ListTree.o Separator.o Table.o Table3d.o TableUtil.o Container.o color.o + +LEX=flex -l + +YACC=bison -y + +depend:: laygram.c laylex.c +all:: laygram.c laylex.c + +all:: DONE + +DONE: $(OBJS) + $(RM) $@ + touch $@ + +cleandir:: + $(RM) DONE + +lint: + $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) +lint1: + $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) + +lintlib:: llib-lar.ln + +llib-lar.ln: $(SRCS) $(EXTRALIBRARYDEPS) + $(RM) $@ + $(LINT) $(LINTLIBFLAG)ar $(LINTFLAGS) $(SRCS) + +# Turn off compiler warnings for the HTML and FWF widgets. + FWFCFLAGS = $(CFLAGS) -c -w + +HTML.o: HTML.c + $(CC) $(FWFCFLAGS) HTML.c +HTML-PSformat.o: HTML-PSformat.c + $(CC) $(FWFCFLAGS) HTML-PSformat.c +HTMLformat.o: HTMLformat.c + $(CC) $(FWFCFLAGS) HTMLformat.c +HTMLimages.o: HTMLimages.c + $(CC) $(FWFCFLAGS) HTMLimages.c +HTMLjot.o: HTMLjot.c + $(CC) $(FWFCFLAGS) HTMLjot.c +HTMLlists.o: HTMLlists.c + $(CC) $(FWFCFLAGS) HTMLlists.c +HTMLparse.o: HTMLparse.c + $(CC) $(FWFCFLAGS) HTMLparse.c +HTMLwidgets.o: HTMLwidgets.c + $(CC) $(FWFCFLAGS) HTMLwidgets.c + +Arrow.o: + $(CC) $(FWFCFLAGS) Arrow.c +Board.o: + $(CC) $(FWFCFLAGS) Board.c +Button.o: + $(CC) $(FWFCFLAGS) Button.c +Common.o: + $(CC) $(FWFCFLAGS) Common.c +DrawIString.o: + $(CC) $(FWFCFLAGS) DrawIString.c +DrawString.o: + $(CC) $(FWFCFLAGS) DrawString.c +Frame.o: + $(CC) $(FWFCFLAGS) Frame.c +Group.o: + $(CC) $(FWFCFLAGS) Group.c +Icon.o: + $(CC) $(FWFCFLAGS) Icon.c +Label.o: + $(CC) $(FWFCFLAGS) Label.c +MenuBar.o: + $(CC) $(FWFCFLAGS) MenuBar.c +MultiList.o: + $(CC) $(FWFCFLAGS) MultiList.c +RadioGrp.o: + $(CC) $(FWFCFLAGS) RadioGrp.c +RowCol.o: + $(CC) $(FWFCFLAGS) RowCol.c +Scrollbar.o: + $(CC) $(FWFCFLAGS) Scrollbar.c +Slider2.o: + $(CC) $(FWFCFLAGS) Slider2.c +Tablist2Tabs.o: + $(CC) $(FWFCFLAGS) Tablist2Tabs.c +TextWidth.o: + $(CC) $(FWFCFLAGS) TextWidth.c +Toggle.o: + $(CC) $(FWFCFLAGS) Toggle.c +cvtLong.o: + $(CC) $(FWFCFLAGS) cvtLong.c +iconutil.o: + $(CC) $(FWFCFLAGS) iconutil.c +laylex.o: + $(CC) $(FWFCFLAGS) laylex.c + +laygram.c laygram.h : laygram.y + yacc -d laygram.y + sed 's/yy/LayYY/g' y.tab.c > laygram.c + sed 's/yy/LayYY/g' y.tab.h > laygram.h + rm y.tab.c y.tab.h + +# Hack to compile under systems which don't have strict ANSI compilers. + +# Hack to compile under SunPRO V4 on Solaris + +cleandir:: + -rm -f laygram.c laygram.h + +laylex.c: laylex.l + $(LEX) laylex.l + sed 's/yy/LayYY/g' lex.yy.c > laylex.c + rm lex.yy.c + +cleandir:: + -rm -f laylex.c + +includes:: laygram.h + @if [ -d $(X11IRAFDIR)/include/ObmW ]; then \ + set +x; \ + else \ + if [ -h $(X11IRAFDIR)/include/ObmW ]; then \ + (set -x; rm -f $(X11IRAFDIR)/include/ObmW); \ + fi; \ + (set -x; $(MKDIRHIER) $(X11IRAFDIR)/include/ObmW); \ + fi + @(set -x; for i in $(HEADERS); do $(RM) $(X11IRAFDIR)/include/ObmW/$$i; $(CP) -p $$i $(X11IRAFDIR)/include/ObmW/$$i; done) + + @if [ -d $(X11IRAFDIR)/include/X11/Xraw ]; then \ + set +x; \ + else \ + if [ -h $(X11IRAFDIR)/include/X11/Xraw ]; then \ + (set -x; rm -f $(X11IRAFDIR)/include/X11/Xraw); \ + fi; \ + (set -x; $(MKDIRHIER) $(X11IRAFDIR)/include/X11/Xraw); \ + fi + @(set -x; for i in $(XRAW_HEADERS); do $(RM) $(X11IRAFDIR)/include/X11/Xraw/$$i; $(CP) -p Xraw/$$i $(X11IRAFDIR)/include/X11/Xraw/$$i; done) + +install:: + @(set -x; for i in $(HEADERS); do $(RM) $(X11IRAFDIR)/include/ObmW/$$i; done) + + for i in $(HEADERS); do (set -x; $(CP) -p $$i $(X11IRAFDIR)/include/ObmW); done + +depend:: + $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) + +# ---------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +.c.i: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ + +.SUFFIXES: .s + +.c.s: + $(RM) $@ + $(CC) -S $(CFLAGS) $(_NOOP_) $*.c + +emptyrule:: + +cleandir:: + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +man_keywords:: + +html_index:: + +clean:: cleandir + +distclean:: cleandir + +# ---------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +install.sdk:: + @echo "install.sdk in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +depend:: + +distclean:: + $(RM) Makefile Makefile.dep + +# ---------------------------------------------------------------------- +# dependencies generated by makedepend + diff --git a/vendor/x11iraf/obm/ObmW/MenuBar.c b/vendor/x11iraf/obm/ObmW/MenuBar.c new file mode 100644 index 00000000..f13a1d13 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MenuBar.c @@ -0,0 +1,183 @@ +/* Generated by wbuild from "MenuBar.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +/* #include "PullDown.h" */ +#include <X11/Shell.h> +#include <stdio.h> +#include "MenuBarP.h" +static void menu_popdown( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"menu_popdown", menu_popdown}, +}; + +static char defaultTranslations[] = "\ +<Btn1Up>: menu_popdown() \n\ +"; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void process_menu( +#if NeedFunctionPrototypes +Widget,Widget ,Cursor +#endif +); +static void popdown_cb( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +/*ARGSUSED*/static void popdown_cb(menu,client_data,call_data)Widget menu;XtPointer client_data;XtPointer call_data; +{ + Widget self = (Widget) client_data; + + XtRemoveCallback(menu, XtNpopdownCallback, popdown_cb, self); +/* + XtUngrabKey(menu, AnyKey, AnyModifier); + XtUngrabButton(menu, AnyButton, AnyModifier); + XtRemoveGrab($); +*/ + ((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu = NULL; +} + +static XtResource resources[] = { +{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfMenuBarRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfMenuBarRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfRaised }, +{XtNtraversalOn,XtCTraversalOn,XtRBoolean,sizeof(((XfwfMenuBarRec*)NULL)->xfwfCommon.traversalOn),XtOffsetOf(XfwfMenuBarRec,xfwfCommon.traversalOn),XtRImmediate,(XtPointer)False }, +}; + +XfwfMenuBarClassRec xfwfMenuBarClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfRowColClassRec, +"XfwfMenuBar", +sizeof(XfwfMenuBarRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +1, +resources, +2, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +XtInheritExpose, +NULL, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +defaultTranslations, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfRowCol_class part */ +XtInherit_layout, +}, +{ /* XfwfMenuBar_class part */ +process_menu, +}, +}; +WidgetClass xfwfMenuBarWidgetClass = (WidgetClass) &xfwfMenuBarClassRec; +/*ARGSUSED*/ +static void menu_popdown(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + if (((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu != NULL) { + XtPopdown(((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu); + ((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu = NULL; + } +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfMenuBarWidgetClass c = (XfwfMenuBarWidgetClass) class; + XfwfMenuBarWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfMenuBarWidgetClass) return; + super = (XfwfMenuBarWidgetClass)class->core_class.superclass; + if (c->xfwfMenuBar_class.process_menu == XtInherit_process_menu) + c->xfwfMenuBar_class.process_menu = super->xfwfMenuBar_class.process_menu; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + ((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu = NULL; +} +/*ARGSUSED*/static void process_menu(self,menu,cursor)Widget self;Widget menu;Cursor cursor; +{ + if (menu == ((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu) return; + if (((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu) XtPopdown(((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu); + XtAddGrab(self, True, False); +/* + XtGrabButton(menu, AnyButton, AnyModifier, True, ButtonPressMask | + ButtonReleaseMask | EnterWindowMask | LeaveWindowMask + | PointerMotionMask, GrabModeAsync, GrabModeAsync, + None, cursor); + XtGrabKey(menu, AnyKey, AnyModifier, True, GrabModeAsync, + GrabModeAsync); +*/ + XtAddCallback(menu, XtNpopdownCallback, popdown_cb, self); + ((XfwfMenuBarWidget)self)->xfwfMenuBar.current_menu = menu; + XtPopup(menu, XtGrabNonexclusive); +} +/*ARGSUSED*/Boolean XfwfCallProcessMenu(self,menu,cursor)Widget self;Widget menu;Cursor cursor; +{ + if (XtIsSubclass(self, xfwfMenuBarWidgetClass) && ((XfwfMenuBarWidgetClass)self->core.widget_class)->xfwfMenuBar_class.process_menu) { + ((XfwfMenuBarWidgetClass)self->core.widget_class)->xfwfMenuBar_class.process_menu(self, menu, cursor); + return True; + } else + return False; +} diff --git a/vendor/x11iraf/obm/ObmW/MenuBar.h b/vendor/x11iraf/obm/ObmW/MenuBar.h new file mode 100644 index 00000000..a9c9c847 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MenuBar.h @@ -0,0 +1,15 @@ +/* Generated by wbuild from "MenuBar.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfMenuBar_H_ +#define _XfwfMenuBar_H_ +#include "RowCol.h" +Boolean XfwfCallProcessMenu( +#if NeedFunctionPrototypes +Widget,Widget ,Cursor +#endif +); +typedef struct _XfwfMenuBarClassRec *XfwfMenuBarWidgetClass; +typedef struct _XfwfMenuBarRec *XfwfMenuBarWidget; +externalref WidgetClass xfwfMenuBarWidgetClass; +#endif /*_XfwfMenuBar_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/MenuBar.man b/vendor/x11iraf/obm/ObmW/MenuBar.man new file mode 100644 index 00000000..3ee2018f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MenuBar.man @@ -0,0 +1,365 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfMenuBar +.SH DESCRIPTION +The MenuBar widget is a special kind of RowCol widget. It assumes +that all its children are PullDown buttons or other widgets that pop +up a menu. (But nothing will break if they are not.) By default, the +children are arranged in a row, wrapping to the next row if the width +is not enough for all of them. But other arrangements are possible, +see the resources of the XfwfRowCol(3) widget. + +The MenuBar attaches itself to the \fIpopup\fP callback of the menu shell +that is popped up by the children, and inserts itself in the list of +pointer grabs that Xt maintains. This is necessary to be able to drag +the mouse from one menu into another, popping down the first one and +popping up the second. If you use a RowCol widget instead of a +MenuBar, you will find that switching from one menu to the next +involves releasing the mouse and then pressing it again. + +To find the menu shell, the children are asked for their \fIpopup\fP +resource. PullDown buttons have this resource, others may not. + +The MenuBar widget introduces no new resources. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfMenuBar +Name Class Type Default + +.TE +.ps + +.TP +.I "XtNframeType" + +.hi + +.nf + frameType = XfwfRaised +.fi + +.eh + +.TP +.I "XtNtraversalOn" + +.hi + +.nf + traversalOn = False +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfRowCol +Name Class Type Default +XtNstoreByRow XtCStoreByRow Boolean True +XtNrows XtCRows Int 0 +XtNcolumns XtCColumns Int 0 +XtNalignment XtCAlignment Alignment XfwfTopLeft +XtNshrinkToFit XtCShrinkToFit Boolean False + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The MenuBar widget has a method \fIprocess_menu\fP that can be used by +children (usually PullDown buttons) to pop up a menu and to register +it with the menu bar. If they do so, the menu bar is able to process +events elsewhere in the menu bar and pop down the menu in favour of +another one, when the user moves the mouse to another button in the +menu bar. A menu or a button is unable to do this by itself, since +they do not know what other menus are present. + +To call the \fIprocess_menu\fP method, widgets should use the +\fIXfwfCallProcessMenu\fP function, which will check that the receiver of +the call is indeed a MenuBar widget. It returns \fITrue\fP if the +\fIprocess_menu\fP method could be called, otherwise \fIFalse\fP. + +The value for \fIcursor\fP can also be \fINone\fP, in which case the cursor +from the menu's parent (the root window, usually) will be used +instead. + +.nf +Boolean XfwfCallProcessMenu( $, Widget menu, Cursor cursor) +.fi + +.hi +{ + if (XtIsSubclass($, xfwfMenuBarWidgetClass) $process_menu) { + $process_menu($, menu, cursor); + return True; + } else + return False; +} +.eh + +.SS "Translations" + +Since the MenuBar widget adds itself to the list of cascaded popups +that is maintained by Xt, it will receive pointer events when a menu +is popped up. If the event is a button release, the current menu will +have to be popped down. + + + +.nf +<Btn1Up>: menu_popdown() +.fi + +.hi +.SS "Actions" + +.TP +.I "menu_popdown + +The \fImenu_popdown\fP action calls \fIXtPopdown\fP for the current menu, +if there is one. + +.hi + +.nf +void menu_popdown($, XEvent* event, String* params, Cardinal* num_params) +{ + if ($current_menu != NULL) { + XtPopdown($current_menu); + $current_menu = NULL; + } +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +.nf + +.B incl + <Xfwf/PullDown.h> +.fi + +.nf + +.B incl + <X11/Shell.h> +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.hi + +.hi +.SS "Private variables" + +A pointer to the currently popped up menu is kept in a private +variable \fIcurrent_menu\fP. The variable is set in the \fIprocess_menu\fP +method. + + + +.nf +Widget current_menu +.fi + +.hi + +.hi +.SS "Methods" + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + $current_menu = NULL; +} +.fi + +The \fIprocess_menu\fP method is provided for use by children (usually +PullDown buttons) to pop up their menus. If they call this method +instead of popping up the menu themselves, the menu bar has a chance +to intercept events for other buttons in the menu bar and pop down the +menu when the user clicks on another button in the menubar. + +The method adds the appropriate (passive) global grabs, establishes an +Xt local grab and adds a callback to the menu, so that the menu bar +will be informed when the menu is popped down again. + +.nf +process_menu($, Widget menu, Cursor cursor) +{ + if (menu == $current_menu) return; + if ($current_menu) XtPopdown($current_menu); + XtAddGrab($, True, False); +/* + XtGrabButton(menu, AnyButton, AnyModifier, True, ButtonPressMask | + ButtonReleaseMask | EnterWindowMask | LeaveWindowMask + | PointerMotionMask, GrabModeAsync, GrabModeAsync, + None, cursor); + XtGrabKey(menu, AnyKey, AnyModifier, True, GrabModeAsync, + GrabModeAsync); +*/ + XtAddCallback(menu, XtNpopdownCallback, popdown_cb, $); + $current_menu = menu; + XtPopup(menu, XtGrabNonexclusive); +} +.fi + +.hi + +.hi +.SH "Utilities" + +The \fIpopdown_cb\fP routine is a callback that is attached to the +currently popped up menu. When the menu pops down, the routine removes +the grabs and resets \fIcurrent_menu\fP to \fINULL\fP. + +.nf +popdown_cb(Widget menu, XtPointer client_data, XtPointer call_data) +{ + Widget $ = (Widget) client_data; + + XtRemoveCallback(menu, XtNpopdownCallback, popdown_cb, $); +/* + XtUngrabKey(menu, AnyKey, AnyModifier); + XtUngrabButton(menu, AnyButton, AnyModifier); + XtRemoveGrab($); +*/ + $current_menu = NULL; +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/MenuBarP.h b/vendor/x11iraf/obm/ObmW/MenuBarP.h new file mode 100644 index 00000000..9b74d5e1 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MenuBarP.h @@ -0,0 +1,47 @@ +/* Generated by wbuild from "MenuBar.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfMenuBarP_H_ +#define _XfwfMenuBarP_H_ +#include "RowColP.h" +#include "MenuBar.h" +typedef void (*process_menu_Proc)( +#if NeedFunctionPrototypes +Widget,Widget ,Cursor +#endif +); +#define XtInherit_process_menu ((process_menu_Proc) _XtInherit) +typedef struct { +/* methods */ +process_menu_Proc process_menu; +/* class variables */ +} XfwfMenuBarClassPart; +typedef struct _XfwfMenuBarClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfRowColClassPart xfwfRowCol_class; +XfwfMenuBarClassPart xfwfMenuBar_class; +} XfwfMenuBarClassRec; + +typedef struct { +/* resources */ +/* private state */ +Widget current_menu; +} XfwfMenuBarPart; + +typedef struct _XfwfMenuBarRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfRowColPart xfwfRowCol; +XfwfMenuBarPart xfwfMenuBar; +} XfwfMenuBarRec; + +externalref XfwfMenuBarClassRec xfwfMenuBarClassRec; + +#endif /* _XfwfMenuBarP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/MultiList.c b/vendor/x11iraf/obm/ObmW/MultiList.c new file mode 100644 index 00000000..1c67b2de --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MultiList.c @@ -0,0 +1,1793 @@ +/**************************************************************************** + + MultiList.c + + This file contains the implementation of the Picasso List + widget. Its functionality is intended to be similar to + The Athena List widget, with some extra features added. + + This code is loosely based on the Athena List source which + is why the MIT copyright notice appears below. + + The code was changed substantially in V3.4 to change the + action/callback interface which was unnecessarily ugly. Code + using some features of the old interface may need to be changed. + Hope the changes don't make people's lives too miserable. + + ****************************************************************************/ + +/* + * Author: + * Brian Totty + * Department of Computer Science + * University Of Illinois at Urbana-Champaign + * 1304 West Springfield Avenue + * Urbana, IL 61801 + * + * totty@cs.uiuc.edu + * + */ + +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Original Athena Author: Chris D. Peterson, MIT X Consortium + */ + +#include <stdio.h> +#include <ctype.h> + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include "MultiListP.h" +#include "TabString.h" + +/*===========================================================================* + + D E C L A R A T I O N S A N D D E F I N I T I O N S + + *===========================================================================*/ + +Pixmap XmuCreateStippledPixmap(); +extern void XawInitializeWidgetSet(); + +#define SUPERCLASS &(simpleClassRec) + +#define FontAscent(f) ((f)->max_bounds.ascent) +#define FontDescent(f) ((f)->max_bounds.descent) +#define FontH(f) (FontAscent(f) + FontDescent(f) + 2) +#define FontW(f,s,w) (XfwfTextWidth(f,s,strlen(s), MultiListTabs(w)) + 1) +#define FontMaxCharW(f) ((f)->max_bounds.rbearing-(f)->min_bounds.lbearing+1) + +#ifndef abs +#define abs(a) ((a) < 0 ? -(a) : (a)) +#endif + +#define max(a,b) ((a) > (b) ? (a) : (b)) +#define min(a,b) ((a) < (b) ? (a) : (b)) +#define XtStrlen(s) ((s) ? strlen(s) : 0) + +#define TypeAlloc(t,n) (t *)malloc(sizeof(t) * n) +#define StrCopy(s) strcpy(TypeAlloc(char,strlen(s)+1),s) +#define StrCopyRetLength(s,lp) strcpy(TypeAlloc(char,(*lp=(strlen(s)+1))),s) + +#define CoreFieldOffset(f) XtOffset(Widget,core.f) +#define SimpleFieldOffset(f) XtOffset(XfwfMultiListWidget,simple.f) +#define MultiListFieldOffset(f) XtOffset(XfwfMultiListWidget,multiList.f) + +/*===========================================================================* + + I N T E R N A L P R O C E D U R E D E C L A R A T I O N S + + *===========================================================================*/ + +#if (!NeedFunctionPrototypes) + +static void Initialize(); +static void Redisplay(); +static XtGeometryResult PreferredGeometry(); +static void Resize(); +static Boolean SetValues(); + +static void DestroyOldData(); +static void InitializeNewData(); +static void CreateNewGCs(); + +static void RecalcCoords(); +static void NegotiateSizeChange(); +static Boolean Layout(); + +static void RedrawAll(); +static void RedrawItem(); +static void RedrawRowColumn(); + +static void PixelToRowColumn(); +static void RowColumnToPixels(); +static Boolean RowColumnToItem(); +static Boolean ItemToRowColumn(); + +static void Select(); +static void Unselect(); +static void Toggle(); +static void Extend(); +static void Notify(); + +#else + +static void Initialize(Widget request, Widget new); +static void Redisplay(XfwfMultiListWidget mlw, + XEvent *event, Region rectangle_union); +static XtGeometryResult PreferredGeometry(XfwfMultiListWidget mlw, + XtWidgetGeometry *parent_idea, + XtWidgetGeometry *our_idea); +static void Resize(XfwfMultiListWidget mlw); +static Boolean SetValues(XfwfMultiListWidget cpl, + XfwfMultiListWidget rpl, + XfwfMultiListWidget npl); +static void DestroyOldData(XfwfMultiListWidget mlw); +static void InitializeNewData(XfwfMultiListWidget mlw); +static void CreateNewGCs(XfwfMultiListWidget mlw); +static void RecalcCoords(XfwfMultiListWidget mlw, + Boolean width_changeable, + Boolean height_changeable); +static void NegotiateSizeChange(XfwfMultiListWidget mlw, + Dimension width, Dimension height); +static Boolean Layout(XfwfMultiListWidget mlw, + Boolean w_changeable, Boolean h_changeable, + Dimension *w_ptr, Dimension *h_ptr); +static void RedrawAll(XfwfMultiListWidget mlw); +static void RedrawItem(XfwfMultiListWidget mlw, int item_index); +static void RedrawRowColumn(XfwfMultiListWidget mlw, + int row, int column); +static void PixelToRowColumn(XfwfMultiListWidget mlw, + int x, int y, int *row_ptr, int *column_ptr); +static void RowColumnToPixels(XfwfMultiListWidget mlw, + int row, int col, int *x_ptr, int *y_ptr, + int *w_ptr, int *h_ptr); +static Boolean RowColumnToItem(XfwfMultiListWidget mlw, + int row, int column, int *item_ptr); +static Boolean ItemToRowColumn(XfwfMultiListWidget mlw, + int item_index, int *row_ptr, int *column_ptr); +static void Select(XfwfMultiListWidget mlw, XEvent *event, + String *params, Cardinal *num_params); +static void Unselect(XfwfMultiListWidget mlw, XEvent *event, + String *params, Cardinal *num_params); +static void Toggle(XfwfMultiListWidget mlw, XEvent *event, + String *params, Cardinal *num_params); +static void Extend(XfwfMultiListWidget mlw, XEvent *event, + String *params, Cardinal *num_params); +static void Notify(XfwfMultiListWidget mlw, XEvent *event, + String *params, Cardinal *num_params); +#endif + +/*===========================================================================* + + R E S O U R C E I N I T I A L I Z A T I O N + + *===========================================================================*/ + +static XtResource resources[] = +{ + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + CoreFieldOffset(width), XtRString, "0"}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + CoreFieldOffset(height), XtRString, "0"}, + {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), + CoreFieldOffset(background_pixel),XtRString,"XtDefaultBackground"}, + + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + SimpleFieldOffset(cursor), XtRString, "left_ptr"}, + + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + MultiListFieldOffset(foreground), XtRString,"XtDefaultForeground"}, + {XtNhighlightForeground, XtCHForeground, XtRPixel, sizeof(Pixel), + MultiListFieldOffset(highlight_fg), XtRString, "XtDefaultBackground"}, + {XtNhighlightBackground, XtCHBackground, XtRPixel, sizeof(Pixel), + MultiListFieldOffset(highlight_bg), XtRString, "XtDefaultForeground"}, + {XtNcolumnSpacing, XtCSpacing, XtRDimension, sizeof(Dimension), + MultiListFieldOffset(column_space), XtRImmediate, (caddr_t)8}, + {XtNrowSpacing, XtCSpacing, XtRDimension, sizeof(Dimension), + MultiListFieldOffset(row_space), XtRImmediate, (caddr_t)0}, + {XtNdefaultColumns, XtCColumns, XtRInt, sizeof(int), + MultiListFieldOffset(default_cols), XtRImmediate, (caddr_t)1}, + {XtNforceColumns, XtCColumns, XtRBoolean, sizeof(Boolean), + MultiListFieldOffset(force_cols), XtRString, (caddr_t) "False"}, + {XtNpasteBuffer, XtCBoolean, XtRBoolean, sizeof(Boolean), + MultiListFieldOffset(paste), XtRString, (caddr_t) "False"}, + {XtNverticalList, XtCBoolean, XtRBoolean, sizeof(Boolean), + MultiListFieldOffset(row_major), XtRString, (caddr_t) "False"}, + {XtNlongest, XtCLongest, XtRInt, sizeof(int), + MultiListFieldOffset(longest), XtRImmediate, (caddr_t)0}, + {XtNnumberStrings, XtCNumberStrings, XtRInt, sizeof(int), + MultiListFieldOffset(nitems), XtRImmediate, (caddr_t)0}, + {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + MultiListFieldOffset(font),XtRString, "XtDefaultFont"}, + {XtNlist, XtCList, XtRPointer, sizeof(char **), + MultiListFieldOffset(list), XtRString, NULL}, + {XtNsensitiveArray, XtCList, XtRPointer, sizeof(Boolean *), + MultiListFieldOffset(sensitive_array), XtRString, NULL}, + {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t), + MultiListFieldOffset(callback), XtRCallback, NULL}, + {XtNmaxSelectable, XtCValue, XtRInt, sizeof(int), + MultiListFieldOffset(max_selectable), XtRImmediate, (caddr_t) 1}, + + {XtNshadeSurplus, XtCBoolean, XtRBoolean, sizeof(Boolean), + MultiListFieldOffset(shade_surplus), XtRString, "True"}, + + {XtNcolumnWidth, XtCValue, XtRDimension, sizeof(Dimension), + MultiListFieldOffset(col_width), XtRImmediate, (caddr_t)0}, + {XtNrowHeight, XtCValue, XtRDimension, sizeof(Dimension), + MultiListFieldOffset(row_height), XtRImmediate, (caddr_t)0}, + + {XtNtablist, XtCTablist, XtRString, sizeof(int *), + MultiListFieldOffset(tablist), XtRImmediate, (XtPointer)NULL }, + +}; + +/*===========================================================================* + + A C T I O N A N D T R A N S L A T I O N T A B L E S + + *===========================================================================*/ + + +static char defaultTranslations[] = +" Shift <Btn1Down>: Toggle()\n\ + Ctrl <Btn1Down>: Unselect()\n\ + <Btn1Down>: Select()\n\ + Button1 <Btn1Motion>: Extend()\n\ + <Btn1Up>: Notify()"; + +static XtActionsRec actions[] = +{ + {"Select", (XtActionProc)Select}, + {"Unselect", (XtActionProc)Unselect}, + {"Toggle", (XtActionProc)Toggle}, + {"Extend", (XtActionProc)Extend}, + {"Notify", (XtActionProc)Notify}, + {NULL, (XtActionProc)NULL} +}; + +/*===========================================================================* + + C L A S S A L L O C A T I O N + + *===========================================================================*/ + +XfwfMultiListClassRec xfwfMultiListClassRec = +{ + { + /* superclass */ (WidgetClass)SUPERCLASS, + /* class_name */ "MultiList", + /* widget_size */ sizeof(XfwfMultiListRec), + /* class_initialize */ NULL, + /* class_part_initialize*/ NULL, + /* class_inited */ FALSE, + /* initialize */ (XtInitProc)Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ (XtWidgetProc)Resize, + /* expose */ (XtExposeProc)Redisplay, + /* set_values */ (XtSetValuesFunc)SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ (XtGeometryHandler) + PreferredGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, /* Core Part */ + { + /* change_sensitive */ XtInheritChangeSensitive + } +}; + +WidgetClass xfwfMultiListWidgetClass = (WidgetClass)&xfwfMultiListClassRec; + +/*===========================================================================* + + T O O L K I T M E T H O D S + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + Initialize() + + This procedure is called by the X toolkit to initialize + the widget instance. The hook to this routine is in the + initialize part of the core part of the class. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Initialize(request,new) +Widget request,new; +{ + XfwfMultiListWidget mlw; + + mlw = (XfwfMultiListWidget)new; + CreateNewGCs(mlw); + InitializeNewData(mlw); + MultiListTabs(mlw) = XfwfTablist2Tabs(MultiListTabList(mlw)); + RecalcCoords(mlw,(MultiListWidth(mlw) == 0), + (MultiListHeight(mlw) == 0)); +} /* Initialize */ + + +/*---------------------------------------------------------------------------* + + Redisplay(mlw,event,rectangle_union) + + This routine redraws the MultiList widget <mlw> based on the exposure + region requested in <event>. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Redisplay(mlw,event,rectangle_union) +XfwfMultiListWidget mlw; +XEvent *event; +Region rectangle_union; +{ + GC shade_gc; + int i,x1,y1,w,h,x2,y2,row,col,ul_row,ul_col,lr_row,lr_col; + + if (MultiListShadeSurplus(mlw)) + shade_gc = MultiListGrayGC(mlw); + else + shade_gc = MultiListEraseGC(mlw); + if (event == NULL) + { + XFillRectangle(XtDisplay(mlw),XtWindow(mlw),shade_gc,0,0, + MultiListWidth(mlw),MultiListHeight(mlw)); + for (i = 0; i < MultiListNumItems(mlw); i++) RedrawItem(mlw,i); + } + else + { + x1 = event->xexpose.x; + y1 = event->xexpose.y; + w = event->xexpose.width; + h = event->xexpose.height; + x2 = x1 + w; + y2 = y1 + h; + XFillRectangle(XtDisplay(mlw),XtWindow(mlw), + shade_gc,x1,y1,w,h); + PixelToRowColumn(mlw,x1,y1,&ul_row,&ul_col); + PixelToRowColumn(mlw,x2,y2,&lr_row,&lr_col); + lr_row = min(lr_row,MultiListNumRows(mlw) - 1); + lr_col = min(lr_col,MultiListNumCols(mlw) - 1); + for (col = ul_col; col <= lr_col; col++) + { + for (row = ul_row; row <= lr_row; row++) + { + RedrawRowColumn(mlw,row,col); + } + } + } +} /* End Redisplay */ + + +/*---------------------------------------------------------------------------* + + PreferredGeometry(mlw,parent_idea,our_idea) + + This routine is called by the parent to tell us about the + parent's idea of our width and/or height. We then suggest + our preference through <our_idea> and return the information + to the parent. + + *---------------------------------------------------------------------------*/ + +static XtGeometryResult PreferredGeometry(mlw,parent_idea,our_idea) +XfwfMultiListWidget mlw; +XtWidgetGeometry *parent_idea,*our_idea; +{ + Dimension nw,nh; + Boolean parent_wants_w,parent_wants_h,we_changed_size; + + parent_wants_w = (parent_idea->request_mode) & CWWidth; + parent_wants_h = (parent_idea->request_mode) & CWHeight; + + if (parent_wants_w) + nw = parent_idea->width; + else + nw = MultiListWidth(mlw); + + if (parent_wants_h) + nh = parent_idea->height; + else + nh = MultiListHeight(mlw); + + our_idea->request_mode = 0; + if (!parent_wants_w && !parent_wants_h) return(XtGeometryYes); + + we_changed_size = Layout(mlw,!parent_wants_w,!parent_wants_h,&nw,&nh); + our_idea->request_mode |= (CWWidth | CWHeight); + our_idea->width = nw; + our_idea->height = nh; + + if (we_changed_size) + return(XtGeometryAlmost); + else + return(XtGeometryYes); +} /* End PreferredGeometry */ + + +/*---------------------------------------------------------------------------* + + Resize(mlw) + + This function is called when the widget is being resized. It + recalculates the layout of the widget. + + *---------------------------------------------------------------------------*/ + +static void Resize(mlw) +XfwfMultiListWidget mlw; +{ + Dimension width,height; + + width = MultiListWidth(mlw); + height = MultiListHeight(mlw); + Layout(mlw,False,False,&width,&height); +} /* End Resize */ + + +/*---------------------------------------------------------------------------* + + SetValues(cpl,rpl,npl) + + This routine is called when the user is changing resources. <cpl> + is the current widget before the user's changes have been instituted. + <rpl> includes the original changes as requested by the user. <npl> + is the new resulting widget with the requested changes and with all + superclass changes already made. + + *---------------------------------------------------------------------------*/ + +/*ARGSUSED*/ +static Boolean SetValues(cpl,rpl,npl) +XfwfMultiListWidget cpl,rpl,npl; +{ + Boolean redraw,recalc; + + redraw = False; + recalc = False; + + /* Graphic Context Changes */ + + if ((MultiListFG(cpl) != MultiListFG(npl)) || + (MultiListBG(cpl) != MultiListBG(npl)) || + (MultiListHighlightFG(cpl) != MultiListHighlightFG(npl)) || + (MultiListHighlightBG(cpl) != MultiListHighlightBG(npl)) || + (MultiListFont(cpl) != MultiListFont(npl))) + { + XtDestroyGC(MultiListEraseGC(cpl)); + XtDestroyGC(MultiListDrawGC(cpl)); + XtDestroyGC(MultiListHighlightForeGC(cpl)); + XtDestroyGC(MultiListHighlightBackGC(cpl)); + XtDestroyGC(MultiListGrayGC(cpl)); + CreateNewGCs(npl); + redraw = True; + } + + /* Changes That Require Redraw */ + + if ((MultiListSensitive(cpl) != MultiListSensitive(npl)) || + (MultiListAncesSensitive(cpl) != MultiListAncesSensitive(npl))) + { + redraw = True; + } + + /* Changes That Require Selection Changes */ + + if ((MultiListMaxSelectable(cpl) != MultiListMaxSelectable(npl))) + { + XtWarning("Dynamic change to maxSelectable unimplemented"); + } + + /* Changes That Require Data Initialization */ + + if ((MultiListList(cpl) != MultiListList(npl)) || + (MultiListNumItems(cpl) != MultiListNumItems(npl)) || + (MultiListSensitiveArray(cpl) != MultiListSensitiveArray(npl))) + { + DestroyOldData(cpl); + InitializeNewData(npl); + recalc = True; + redraw = True; + } + + if (MultiListTabList(cpl) != MultiListTabList(npl)) + { + if (MultiListTabs(cpl)) + XtFree( (char *) MultiListTabs(cpl)); + MultiListTabs(npl) = XfwfTablist2Tabs(MultiListTabList(npl)); + } + + /* Changes That Require Recalculating Coordinates */ + + if ((MultiListWidth(cpl) != MultiListWidth(npl)) || + (MultiListHeight(cpl) != MultiListHeight(npl)) || + (MultiListColumnSpace(cpl) != MultiListColumnSpace(npl)) || + (MultiListRowSpace(cpl) != MultiListRowSpace(npl)) || + (MultiListDefaultCols(cpl) != MultiListDefaultCols(npl)) || + ((MultiListForceCols(cpl) != MultiListForceCols(npl)) && + (MultiListNumCols(cpl) != MultiListNumCols(npl))) || + (MultiListRowMajor(cpl) != MultiListRowMajor(npl)) || + (MultiListFont(cpl) != MultiListFont(npl)) || + (MultiListLongest(cpl) != MultiListLongest(npl))) + { + recalc = True; + redraw = True; + } + + if (MultiListColWidth(cpl) != MultiListColWidth(npl)) + { + XtWarning("columnWidth Resource Is Read-Only"); + MultiListColWidth(npl) = MultiListColWidth(cpl); + } + if (MultiListRowHeight(cpl) != MultiListRowHeight(npl)) + { + XtWarning("rowHeight Resource Is Read-Only"); + MultiListRowHeight(npl) = MultiListRowHeight(cpl); + } + + if (recalc) + { + RecalcCoords(npl,!MultiListWidth(npl),!MultiListHeight(npl)); + } + + if (!XtIsRealized((Widget)cpl)) + return(False); + else + return(redraw); +} /* End SetValues */ + +/*===========================================================================* + + D A T A I N I T I A L I Z A T I O N + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + DestroyOldData(mlw) + + This routine frees the internal list item array and sets the + item count to 0. This is normally done immediately before + calling InitializeNewData() to rebuild the internal item + array from new user specified arrays. + + *---------------------------------------------------------------------------*/ + +static void DestroyOldData(mlw) +XfwfMultiListWidget mlw; +{ + int i; + + if (MultiListItemArray(mlw) != NULL) /* Free Old List */ + { + for (i = 0; i < MultiListNumItems(mlw); i++) + { + free(MultiListItemString(MultiListNthItem(mlw,i))); + } + free((char *)MultiListItemArray(mlw)); + } + if (MultiListSelArray(mlw) != NULL) + free((char *)MultiListSelArray(mlw)); + MultiListSelArray(mlw) = NULL; + MultiListNumSelected(mlw) = 0; + MultiListItemArray(mlw) = NULL; + MultiListNumItems(mlw) = 0; +} /* End DestroyOldData */ + + +/*---------------------------------------------------------------------------* + + InitializeNewData(mlw) + + This routine takes a MultiList widget <mlw> and builds up new + data item tables based on the string list and the sensitivity array. + All previous data should have already been freed. If the number + of items is 0, they will be counted, so the array must be NULL + terminated. If the list of strings is NULL, this is treated as + a list of 0 elements. If the sensitivity array is NULL, all + items are treated as sensitive. + + When this routine is done, the string list and sensitivity array + fields will all be set to NULL, and the widget will not reference + them again. + + *---------------------------------------------------------------------------*/ + +static void InitializeNewData(mlw) +XfwfMultiListWidget mlw; +{ + int i; + XfwfMultiListItem *item; + String *string_array; + + string_array = MultiListList(mlw); + if (string_array == NULL) MultiListNumItems(mlw) = 0; + + if (MultiListNumItems(mlw) == 0) /* Count Elements */ + { + if (string_array == NULL) /* No elements */ + { + MultiListNumItems(mlw) = 0; + } + else + { + for (i = 0; string_array[i] != NULL; i++); + MultiListNumItems(mlw) = i; + } + } + if (MultiListNumItems(mlw) == 0) /* No Items */ + { + MultiListItemArray(mlw) = NULL; + } + else + { + MultiListItemArray(mlw) = + TypeAlloc(XfwfMultiListItem,MultiListNumItems(mlw)); + for (i = 0; i < MultiListNumItems(mlw); i++) + { + item = MultiListNthItem(mlw,i); + if (MultiListSensitiveArray(mlw) == NULL || + (MultiListSensitiveArray(mlw)[i] == True)) + { + MultiListItemSensitive(item) = True; + } + else + { + MultiListItemSensitive(item) = False; + } + MultiListItemString(item) = StrCopy(string_array[i]); + MultiListItemHighlighted(item) = False; + } + } + if (MultiListMaxSelectable(mlw) == 0) + { + MultiListSelArray(mlw) = NULL; + MultiListNumSelected(mlw) = 0; + } + else + { + MultiListSelArray(mlw) = + TypeAlloc(int,MultiListMaxSelectable(mlw)); + MultiListNumSelected(mlw) = 0; + } + + MultiListList(mlw) = NULL; + MultiListSensitiveArray(mlw) = NULL; +} /* End InitializeNewData */ + + +/*---------------------------------------------------------------------------* + + CreateNewGCs(mlw) + + This routine takes a MultiList widget <mlw> and creates a new set of + graphic contexts for the widget based on the colors, fonts, etc. + in the widget. Any previous GCs are assumed to have already been + destroyed. + + *---------------------------------------------------------------------------*/ + +static void CreateNewGCs(mlw) +XfwfMultiListWidget mlw; +{ + XGCValues values; + unsigned int attribs; +#ifndef USE_XMU_STIPPLE + Screen *screen = XtScreen((Widget)mlw); + Display *display = XtDisplay((Widget)mlw); + int pixmap_width = 2, pixmap_height = 2; + static unsigned char pixmap_bits[] = { + 0x02, 0x01, + }; +#endif + + attribs = GCForeground | GCBackground | GCFont; + values.foreground = MultiListFG(mlw); + values.background = MultiListBG(mlw); + values.font = MultiListFont(mlw)->fid; + MultiListDrawGC(mlw) = XtGetGC((Widget)mlw,attribs,&values); + + values.foreground = MultiListBG(mlw); + MultiListEraseGC(mlw) = XtGetGC((Widget)mlw,attribs,&values); + + values.foreground = MultiListHighlightFG(mlw); + values.background = MultiListHighlightBG(mlw); + MultiListHighlightForeGC(mlw) = XtGetGC((Widget)mlw,attribs,&values); + + values.foreground = MultiListHighlightBG(mlw); + values.background = MultiListHighlightBG(mlw); + MultiListHighlightBackGC(mlw) = XtGetGC((Widget)mlw,attribs,&values); + + attribs |= GCTile | GCFillStyle; + values.foreground = MultiListFG(mlw); + values.background = MultiListBG(mlw); + values.fill_style = FillTiled; +#ifdef USE_XMU_STIPPLE + values.tile = XmuCreateStippledPixmap(XtScreen(mlw), + MultiListFG(mlw), + MultiListBG(mlw), + MultiListDepth(mlw)); +#else + values.tile = XCreatePixmapFromBitmapData (display, + RootWindowOfScreen(screen), + (char *)pixmap_bits, + pixmap_width, pixmap_height, + MultiListFG(mlw), + MultiListBG(mlw), + MultiListDepth(mlw)); +#endif + MultiListGrayGC(mlw) = XtGetGC((Widget)mlw,attribs,&values); +} /* End CreateNewGCs */ + +/*===========================================================================* + + L A Y O U T A N D G E O M E T R Y M A N A G E M E N T + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + RecalcCoords(mlw,width_changeable,height_changeable) + + This routine takes a MultiList widget <mlw> and recalculates + the coordinates, and item placement based on the current + width, height, and list of items. The <width_changeable> and + <height_changeable> indicate if the width and/or height can + be arbitrarily set. + + This routine requires that the internal list data be initialized. + + *---------------------------------------------------------------------------*/ + +#if NeedFunctionPrototypes +static void +RecalcCoords(XfwfMultiListWidget mlw, + Boolean width_changeable, Boolean height_changeable) +#else +static void +RecalcCoords(mlw,width_changeable,height_changeable) +XfwfMultiListWidget mlw; +Boolean width_changeable,height_changeable; +#endif +{ + String str; + Dimension width,height; + register int i,text_width; + + width = MultiListWidth(mlw); + height = MultiListHeight(mlw); + if (MultiListNumItems(mlw) != 0 && MultiListLongest(mlw) == 0) + { + for (i = 0; i < MultiListNumItems(mlw); i++) + { + str = MultiListItemString(MultiListNthItem(mlw,i)); + text_width = FontW(MultiListFont(mlw),str,mlw); + MultiListLongest(mlw) = max(MultiListLongest(mlw), + text_width); + } + } + if (Layout(mlw,width_changeable,height_changeable,&width,&height)) + { + NegotiateSizeChange(mlw,width,height); + } +} /* End RecalcCoords */ + + +/*---------------------------------------------------------------------------* + + NegotiateSizeChange(mlw,width,height) + + This routine tries to change the MultiList widget <mlw> to have the + new size <width> by <height>. A negotiation will takes place + to try to change the size. The resulting size is not necessarily + the requested size. + + *---------------------------------------------------------------------------*/ + +#if NeedFunctionPrototypes +static void +NegotiateSizeChange(XfwfMultiListWidget mlw, Dimension width, Dimension height) +#else +static void +NegotiateSizeChange(mlw,width,height) +XfwfMultiListWidget mlw; +Dimension width,height; +#endif +{ + int attempt_number; + Boolean w_fixed,h_fixed; + Dimension *w_ptr,*h_ptr; + + XtWidgetGeometry request,reply; + + request.request_mode = CWWidth | CWHeight; + request.width = width; + request.height = height; + + for (attempt_number = 1; attempt_number <= 3; attempt_number++) + { + switch (XtMakeGeometryRequest((Widget)mlw,&request,&reply)) + { + case XtGeometryYes: + case XtGeometryNo: + return; + case XtGeometryAlmost: + switch (attempt_number) + { + case 1: + w_fixed = (request.width != reply.width); + h_fixed = (request.height != reply.height); + w_ptr = &(reply.width); + h_ptr = &(reply.height); + Layout(mlw,!w_fixed,!h_fixed,w_ptr,h_ptr); + break; + case 2: + w_ptr = &(reply.width); + h_ptr = &(reply.height); + Layout(mlw,False,False,w_ptr,h_ptr); + break; + case 3: + return; + } + break; + default: + XtAppWarning(XtWidgetToApplicationContext((Widget)mlw), + "MultiList Widget: Unknown geometry return."); + break; + } + request = reply; + } +} /* End NegotiateSizeChange */ + + +/*---------------------------------------------------------------------------* + + Boolean Layout(mlw,w_changeable,h_changeable,w_ptr,h_ptr) + + This routine tries to generate a layout for the MultiList widget + <mlw>. The Layout routine is free to arbitrarily set the width + or height if the corresponding variables <w_changeable> and + <h_changeable> are set True. Otherwise the original width or + height in <w_ptr> and <h_ptr> are used as fixed values. The + resulting new width and height are stored back through the + <w_ptr> and <h_ptr> pointers. False is returned if no size + change was done, True is returned otherwise. + + *---------------------------------------------------------------------------*/ + +#if NeedFunctionPrototypes +static Boolean +Layout(XfwfMultiListWidget mlw, Boolean w_changeable, Boolean h_changeable, + Dimension *w_ptr, Dimension *h_ptr) +#else +static Boolean +Layout(mlw,w_changeable,h_changeable,w_ptr,h_ptr) +XfwfMultiListWidget mlw; +Boolean w_changeable,h_changeable; +Dimension *w_ptr,*h_ptr; +#endif +{ + Boolean size_changed = False; + + /* + * If force columns is set, then always use the number + * of columns specified by default_cols. + */ + + MultiListColWidth(mlw) = MultiListLongest(mlw) + + MultiListColumnSpace(mlw); + MultiListRowHeight(mlw) = FontH(MultiListFont(mlw)) + + MultiListRowSpace(mlw); + if (MultiListForceCols(mlw)) + { + MultiListNumCols(mlw) = max(MultiListDefaultCols(mlw),1); + if (MultiListNumItems(mlw) == 0) + MultiListNumRows(mlw) = 1; + else + MultiListNumRows(mlw) = (MultiListNumItems(mlw) - 1) / + MultiListNumCols(mlw) + 1; + if (w_changeable) + { + *w_ptr = MultiListNumCols(mlw) * + MultiListColWidth(mlw); + size_changed = True; + } + else + { + MultiListColWidth(mlw) = *w_ptr / + (Dimension)MultiListNumCols(mlw); + } + if (h_changeable) + { + *h_ptr = MultiListNumRows(mlw) * + MultiListRowHeight(mlw); + size_changed = True; + } + return(size_changed); + } + + /* + * If both width and height are free to change then use + * default_cols to determine the number of columns and set + * the new width and height to just fit the window. + */ + + if (w_changeable && h_changeable) + { + MultiListNumCols(mlw) = max(MultiListDefaultCols(mlw),1); + if (MultiListNumItems(mlw) == 0) + MultiListNumRows(mlw) = 1; + else + MultiListNumRows(mlw) = (MultiListNumItems(mlw) - 1) / + MultiListNumCols(mlw) + 1; + *w_ptr = MultiListNumCols(mlw) * MultiListColWidth(mlw); + *h_ptr = MultiListNumRows(mlw) * MultiListRowHeight(mlw); + return(True); + } + + /* + * If the width is fixed then use it to determine the + * number of columns. If the height is free to move + * (width still fixed) then resize the height of the + * widget to fit the current MultiList exactly. + */ + + if (!w_changeable) + { + MultiListNumCols(mlw) = *w_ptr / MultiListColWidth(mlw); + MultiListNumCols(mlw) = max(MultiListNumCols(mlw),1); + MultiListNumRows(mlw) = (MultiListNumItems(mlw) - 1) / + MultiListNumCols(mlw) + 1; + MultiListColWidth(mlw) = *w_ptr / (Dimension)MultiListNumCols(mlw); + if (h_changeable) + { + *h_ptr = MultiListNumRows(mlw) * MultiListRowHeight(mlw); + size_changed = True; + } + return(size_changed); + } + + /* + * The last case is xfree and !yfree we use the height to + * determine the number of rows and then set the width to + * just fit the resulting number of columns. + */ + + MultiListNumRows(mlw) = *h_ptr / MultiListRowHeight(mlw); + MultiListNumRows(mlw) = max(MultiListNumRows(mlw),1); + MultiListNumCols(mlw) = (MultiListNumItems(mlw) - 1) / + MultiListNumRows(mlw) + 1; + *w_ptr = MultiListNumCols(mlw) * MultiListColWidth(mlw); + return(True); +} /* End Layout */ + +/*===========================================================================* + + R E D R A W R O U T I N E S + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + RedrawAll(mlw) + + This routine simple calls Redisplay to redraw the entire + MultiList widget <mlw>. + + *---------------------------------------------------------------------------*/ + +static void RedrawAll(mlw) +XfwfMultiListWidget mlw; +{ + Redisplay(mlw,NULL,NULL); +} /* End RedrawAll */ + + +/*---------------------------------------------------------------------------* + + RedrawItem(mlw,item_index) + + This routine redraws the item with index <item_index> in the + MultiList widget <mlw>. If the item number is bad, nothing is drawn. + + *---------------------------------------------------------------------------*/ + +static void RedrawItem(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +{ + int row,column; + + if (ItemToRowColumn(mlw,item_index,&row,&column)) + { + RedrawRowColumn(mlw,row,column); + } +} /* End RedrawItem */ + + +/*---------------------------------------------------------------------------* + + RedrawRowColumn(mlw,row,column) + + This routine paints the item in row/column position <row>,<column> + on the MultiList widget <mlw>. If the row/column coordinates are + outside the widget, nothing is drawn. If the position is empty, + blank space is drawn. + + *---------------------------------------------------------------------------*/ + +static void RedrawRowColumn(mlw,row,column) +XfwfMultiListWidget mlw; +int row,column; +{ + GC bg_gc,fg_gc; + XfwfMultiListItem *item; + int ul_x,ul_y,str_x,str_y,w,h,item_index,has_item,text_h; + + if (!XtIsRealized((Widget)mlw)) return; + has_item = RowColumnToItem(mlw,row,column,&item_index); + RowColumnToPixels(mlw,row,column,&ul_x,&ul_y,&w,&h); + + if (has_item == False) /* No Item */ + { + if (MultiListShadeSurplus(mlw)) + bg_gc = MultiListGrayGC(mlw); + else + bg_gc = MultiListEraseGC(mlw); + } + else + { + item = MultiListNthItem(mlw,item_index); + if ((!MultiListSensitive(mlw)) || + (!MultiListItemSensitive(item))) /* Insensitive */ + { + if (MultiListItemHighlighted(item)) /* Selected */ + { + bg_gc = MultiListGrayGC(mlw); + fg_gc = MultiListEraseGC(mlw); + } + else /* !Selected */ + { + bg_gc = MultiListEraseGC(mlw); + fg_gc = MultiListGrayGC(mlw); + } + } + else /* Sensitive */ + { + if (MultiListItemHighlighted(item)) /* Selected */ + { + bg_gc = MultiListHighlightBackGC(mlw); + fg_gc = MultiListHighlightForeGC(mlw); + } + else /* !Selected */ + { + bg_gc = MultiListEraseGC(mlw); + fg_gc = MultiListDrawGC(mlw); + } + } + } + XFillRectangle(XtDisplay(mlw),XtWindow(mlw),bg_gc,ul_x,ul_y,w,h); + if (has_item == True) + { + text_h = min(FontH(MultiListFont(mlw)) + + (int)MultiListRowSpace(mlw),(int)MultiListRowHeight(mlw)); + str_x = ul_x + MultiListColumnSpace(mlw) / 2; + str_y = ul_y + FontAscent(MultiListFont(mlw)) + + ((int)MultiListRowHeight(mlw) - text_h) / 2; + XfwfDrawString(XtDisplay(mlw),XtWindow(mlw),fg_gc, + str_x,str_y,MultiListItemString(item), + strlen(MultiListItemString(item)), + MultiListTabs(mlw)); + } +} /* End RedrawRowColumn */ + +/*===========================================================================* + + I T E M L O C A T I O N R O U T I N E S + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + void PixelToRowColumn(mlw,x,y,row_ptr,column_ptr) + + This routine takes pixel coordinates <x>, <y> and converts + the pixel coordinate into a row/column coordinate. This row/column + coordinate can then easily be converted into the specific item + in the list via the function RowColumnToItem(). + + If the pixel lies in blank space outside of the items, the + row & column numbers will be outside of the range of normal + row & columns numbers, but will correspond to the row & column + of the item, if an item was actually there. + + *---------------------------------------------------------------------------*/ + +static void PixelToRowColumn(mlw,x,y,row_ptr,column_ptr) +XfwfMultiListWidget mlw; +int x,y,*row_ptr,*column_ptr; +{ + *row_ptr = y / (int)MultiListRowHeight(mlw); + *column_ptr = x / (int)MultiListColWidth(mlw); +} /* End PixelToRowColumn */ + +/*---------------------------------------------------------------------------* + + void RowColumnToPixels(mlw,row,col,x_ptr,y_ptr,w_ptr,h_ptr) + + This routine takes a row/column coordinate <row>,<col> and + converts it into the bounding pixel rectangle which is returned. + + *---------------------------------------------------------------------------*/ + +static void RowColumnToPixels(mlw,row,col,x_ptr,y_ptr,w_ptr,h_ptr) +XfwfMultiListWidget mlw; +int row,col,*x_ptr,*y_ptr,*w_ptr,*h_ptr; +{ + *x_ptr = col * MultiListColWidth(mlw); + *y_ptr = row * MultiListRowHeight(mlw); + *w_ptr = MultiListColWidth(mlw); + *h_ptr = MultiListRowHeight(mlw); +} /* End RowColumnToPixels */ + +/*---------------------------------------------------------------------------* + + Boolean RowColumnToItem(mlw,row,column,item_ptr) + + This routine takes a row number <row> and a column number <column> + and tries to resolve this row and column into the index of the + item in this position of the MultiList widget <mlw>. The resulting + item index is placed through <item_ptr>. If there is no item at + this location, False is returned, else True is returned. + + *---------------------------------------------------------------------------*/ + +static Boolean RowColumnToItem(mlw,row,column,item_ptr) +XfwfMultiListWidget mlw; +int row,column,*item_ptr; +{ + register int x_stride,y_stride; + + if (row < 0 || row >= MultiListNumRows(mlw) || + column < 0 || column >= MultiListNumCols(mlw)) + { + return(False); + } + if (MultiListRowMajor(mlw)) + { + x_stride = 1; + y_stride = MultiListNumCols(mlw); + } + else + { + x_stride = MultiListNumRows(mlw); + y_stride = 1; + } + *item_ptr = row * y_stride + column * x_stride; + if (*item_ptr >= MultiListNumItems(mlw)) + return(False); + else + return(True); +} /* End RowColumnToItem */ + + +/*---------------------------------------------------------------------------* + + Boolean ItemToRowColumn(mlw,item_index,row_ptr,column_ptr) + + This routine takes an item number <item_index> and attempts + to convert the index into row and column numbers stored through + <row_ptr> and <column_ptr>. If the item number does not + corespond to a valid item, False is returned, else True is + returned. + + *---------------------------------------------------------------------------*/ + +static Boolean ItemToRowColumn(mlw,item_index,row_ptr,column_ptr) +XfwfMultiListWidget mlw; +int item_index,*row_ptr,*column_ptr; +{ + if (item_index < 0 || item_index >= MultiListNumItems(mlw)) + { + return(False); + } + if (MultiListRowMajor(mlw)) + { + *row_ptr = item_index / MultiListNumCols(mlw); + *column_ptr = item_index % MultiListNumCols(mlw); + } + else + { + *row_ptr = item_index % MultiListNumRows(mlw); + *column_ptr = item_index / MultiListNumRows(mlw); + } + return(True); +} /* End ItemToRowColumn */ + +/*===========================================================================* + + E V E N T A C T I O N H A N D L E R S + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + Select(mlw,event,params,num_params) + + This action handler is called when a user selects an item in the + MultiList. This action first unselects all previously selected + items, then selects the item under the mouse, if it is not a + background gap, and if it is sensitive. + + The MultiListMostRecentItem(mlw) variable will be set to the + item clicked on, or -1 if the item is background or insensitive. + The MultiListMostRecentAct(mlw) variable will be set to + XfwfMultiListActionHighlight, in case the selection region is extended. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Select(mlw,event,params,num_params) +XfwfMultiListWidget mlw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + int click_x,click_y; + int status,item_index,row,column; + + click_x = event->xbutton.x; + click_y = event->xbutton.y; + PixelToRowColumn(mlw,click_x,click_y,&row,&column); + XfwfMultiListUnhighlightAll(mlw); + MultiListMostRecentAct(mlw) = XfwfMultiListActionHighlight; + status = RowColumnToItem(mlw,row,column,&item_index); + if ((status == False) || + (!MultiListItemSensitive(MultiListNthItem(mlw,item_index)))) + { + MultiListMostRecentItem(mlw) = -1; + } + else + { + MultiListMostRecentItem(mlw) = item_index; + XfwfMultiListHighlightItem(mlw,item_index); + } +} /* End Select */ + + +/*---------------------------------------------------------------------------* + + Unselect(mlw,event,params,num_params) + + This function unselects the single text item pointed to by the + mouse, if any. Any remaining selected entries are left selected. + + The MultiListMostRecentItem(mlw) variable will be set to -1, and + the MultiListMostRecentAct(mlw) variable will be set to + XfwfMultiListActionUnhighlight, in case the deselection region is + extended. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Unselect(mlw,event,params,num_params) +XfwfMultiListWidget mlw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + int click_x,click_y; + int status,item_index,row,column; + + click_x = event->xbutton.x; + click_y = event->xbutton.y; + PixelToRowColumn(mlw,click_x,click_y,&row,&column); + MultiListMostRecentItem(mlw) = -1; + MultiListMostRecentAct(mlw) = XfwfMultiListActionUnhighlight; + status = RowColumnToItem(mlw,row,column,&item_index); + if ((status == True) && + (MultiListItemSensitive(MultiListNthItem(mlw,item_index)))) + /* ### NOAO #### (was ListHighlight) */ + XfwfMultiListUnhighlightItem(mlw,item_index); +} /* End Unselect */ + + +/*---------------------------------------------------------------------------* + + Toggle(mlw,event,params,num_params) + + This action handler implements the toggling of selection status + for a single item. Any remaining selected entries are left selected. + + If the mouse is not over a selectable text item, the + MultiListMostRecentAct(mlw) variable is set to + XfwfMultiListActionHighlight, in case the region is extended into + selectable items later. MultiListMostRecentItem(mlw) is set to -1. + + If the mouse is over a selectable text item, the item highlight is + toggled. If the item is currently selected, it becomes deselected. + If unselected, the item becomes selected. At the same time, the + MultiListMostRecentAct(mlw) variable is set to + XfwfMultiListActionHighlight if the item was not previously selected, + or XfwfMultiListActionUnhighlight if the item was previously selected. + MultiListMostRecentItem(mlw) is set to the index of the item clicked + on if the item is selected, or -1 if it is unselected. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Toggle(mlw,event,params,num_params) +XfwfMultiListWidget mlw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + int click_x,click_y; + int status,item_index,row,column; + + click_x = event->xbutton.x; + click_y = event->xbutton.y; + PixelToRowColumn(mlw,click_x,click_y,&row,&column); + status = RowColumnToItem(mlw,row,column,&item_index); + if ((status == False) || + (!MultiListItemSensitive(MultiListNthItem(mlw,item_index)))) + { + MultiListMostRecentAct(mlw) = XfwfMultiListActionHighlight; + MultiListMostRecentItem(mlw) = -1; + } + else + { + MultiListMostRecentAct(mlw) = + XfwfMultiListToggleItem(mlw,item_index); + MultiListMostRecentItem(mlw) = item_index; + } +} /* End Toggle */ + + +/*---------------------------------------------------------------------------* + + Extend(mlw,event,params,num_params) + + This action handler implements the extension of a selection/ + deselection region. + + The MultiListMostRecentAct(mlw) variable is used to determine + if items are to be selected or unselected. This routine performs + select or unselect actions on each item it is called on. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Extend(mlw,event,params,num_params) +XfwfMultiListWidget mlw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + int click_x,click_y; + int status,item_index,row,column; + + click_x = ((XMotionEvent*)event)->x; + click_y = ((XMotionEvent*)event)->y; + PixelToRowColumn(mlw,click_x,click_y,&row,&column); + status = RowColumnToItem(mlw,row,column,&item_index); + if ((status == True) && + (MultiListItemSensitive(MultiListNthItem(mlw,item_index)))) + { + MultiListMostRecentItem(mlw) = item_index; + if (MultiListMostRecentAct(mlw) == XfwfMultiListActionHighlight) + XfwfMultiListHighlightItem(mlw,item_index); + else + XfwfMultiListUnhighlightItem(mlw,item_index); + } +} /* End Extend */ + + +/*---------------------------------------------------------------------------* + + Notify(mlw,event,params,num_params) + + This function performs the Notify action, which issues a callback + after a selection/unselection has completed. All callbacks on the + callback list are invoked, and a XfxfMultiListReturnStruct describing + the selection state is returned. + + In addition, if the XtNpasteBuffer resource is true and at least one + text item is selected, all the selected items are placed in the X + cut buffer (buf(0)) separated by newlines. + + *---------------------------------------------------------------------------*/ + +/* ARGSUSED */ +static void Notify(mlw,event,params,num_params) +XfwfMultiListWidget mlw; +XEvent *event; +String *params; +Cardinal *num_params; +{ + char *buffer; + String string; + int i,byte_count,item_index; + XfwfMultiListReturnStruct ret_value; + + if ((MultiListNumSelected(mlw) != 0) && MultiListPaste(mlw)) + { + byte_count = 0; + for (i = 0; i < MultiListNumSelected(mlw); i++) + { + item_index = MultiListSelArray(mlw)[i]; + string = MultiListItemString(MultiListNthItem(mlw, + item_index)); + byte_count = byte_count + strlen(string) + 1; + } + buffer = (char *)malloc(byte_count); + buffer[0] = '\0'; + for (i = 0; i < MultiListNumSelected(mlw); i++) + { + if (i != 0) strcat(buffer,"\n"); + item_index = MultiListSelArray(mlw)[i]; + string = MultiListItemString(MultiListNthItem(mlw, + item_index)); + strcat(buffer,string); + } + XStoreBytes(XtDisplay(mlw),buffer,byte_count); + free(buffer); + } + + ret_value.action = MultiListMostRecentAct(mlw); + ret_value.item = MultiListMostRecentItem(mlw); + if (ret_value.item == -1) + ret_value.string = NULL; + else + ret_value.string = MultiListItemString(MultiListNthItem(mlw, + ret_value.item)); + ret_value.num_selected = MultiListNumSelected(mlw); + ret_value.selected_items = MultiListSelArray(mlw); + XtCallCallbacks((Widget)mlw,XtNcallback,(caddr_t)&ret_value); +} /* End Notify */ + +/*===========================================================================* + + U S E R C A L L A B L E U T I L I T Y R O U T I N E S + + *===========================================================================*/ + +/*---------------------------------------------------------------------------* + + Boolean XfwfMultiListHighlightItem(mlw,item_index) + + This routine selects an item with index <item_index> in the + MultiList widget <mlw>. If a maximum number of selections is specified + and exceeded, the earliest selection will be unselected. If + <item_index> doesn't correspond to an item the most recently + clicked item will be set to -1 and this routine will immediately + return, otherwise the most recently clicked item will be set to the + current item. If the clicked on item is not sensitive, or if the + click is not on an item, False is returned, else True is returned. + + *---------------------------------------------------------------------------*/ + +Boolean XfwfMultiListHighlightItem(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +{ + XfwfMultiListItem *item; + + if (MultiListMaxSelectable(mlw) == 0) return(False); + if (item_index < 0 || item_index >= MultiListNumItems(mlw)) + { + MultiListMostRecentItem(mlw) = -1; + return(False); + } + item = MultiListNthItem(mlw,item_index); + if (MultiListItemSensitive(item) == False) return(False); + MultiListMostRecentItem(mlw) = item_index; + if (MultiListItemHighlighted(item) == True) return(True); + if (MultiListNumSelected(mlw) == MultiListMaxSelectable(mlw)) + { + XfwfMultiListUnhighlightItem(mlw,MultiListSelArray(mlw)[0]); + } + MultiListItemHighlighted(item) = True; + MultiListSelArray(mlw)[MultiListNumSelected(mlw)] = item_index; + ++ MultiListNumSelected(mlw); + RedrawItem(mlw,item_index); + return(True); +} /* End XfwfMultiListHighlightItem */ + + +/*---------------------------------------------------------------------------* + + XfwfMultiListHighlightAll(mlw) + + This routine highlights all highlightable items in the MultiList + widget <mlw>, up to the maximum number of allowed highlightable + items; + + *---------------------------------------------------------------------------*/ + +void XfwfMultiListHighlightAll(mlw) +XfwfMultiListWidget mlw; +{ + int i; + XfwfMultiListItem *item; + + MultiListNumSelected(mlw) = 0; + for (i = 0; i < MultiListNumItems(mlw); i++) + { + item = MultiListNthItem(mlw,i); + MultiListItemHighlighted(item) = False; + } + for (i = 0; i < MultiListNumItems(mlw); i++) + { + if (MultiListNumSelected(mlw) == MultiListMaxSelectable(mlw)) + break; + item = MultiListNthItem(mlw,i); + if (MultiListItemSensitive(item) == False) continue; + MultiListItemHighlighted(item) = True; + MultiListSelArray(mlw)[MultiListNumSelected(mlw)] = i; + ++ MultiListNumSelected(mlw); + } + RedrawAll(mlw); +} /* End XfwfMultiListHighlightAll */ + + +/*---------------------------------------------------------------------------* + + XfwfMultiListUnhighlightItem(mlw,item_index) + + This routine unselects the item with index <item_index> in the + MultiList widget <mlw>. If <item_index> doesn't correspond to a + selected item, then nothing will happen. Otherwise, the item + is unselected and the selection array and count are updated. + + *---------------------------------------------------------------------------*/ + +void XfwfMultiListUnhighlightItem(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +{ + int i; + XfwfMultiListItem *item; + + if (MultiListMaxSelectable(mlw) == 0) return; + if (item_index < 0 || item_index >= MultiListNumItems(mlw)) return; + item = MultiListNthItem(mlw,item_index); + if (MultiListItemHighlighted(item) == False) return; + MultiListItemHighlighted(item) = False; + + for (i = 0; i < MultiListNumSelected(mlw); i++) + if (MultiListSelArray(mlw)[i] == item_index) break; + for (i = i + 1; i < MultiListNumSelected(mlw); i++) + MultiListSelArray(mlw)[i - 1] = MultiListSelArray(mlw)[i]; + -- MultiListNumSelected(mlw); + + RedrawItem(mlw,item_index); +} /* End XfwfMultiListUnhighlightItem */ + + +/*---------------------------------------------------------------------------* + + XfwfMultiListUnhighlightAll(mlw) + + This routine unhighlights all items in the MultiList widget <mlw>. + + *---------------------------------------------------------------------------*/ + +void XfwfMultiListUnhighlightAll(mlw) +XfwfMultiListWidget mlw; +{ + int i; + XfwfMultiListItem *item; + + for (i = 0; i < MultiListNumItems(mlw); i++) + { + item = MultiListNthItem(mlw,i); + if (MultiListItemHighlighted(item)) + XfwfMultiListUnhighlightItem(mlw,i); + } + MultiListNumSelected(mlw) = 0; +} /* End XfwfMultiListUnhighlightAll */ + + +/*---------------------------------------------------------------------------* + + int XfwfMultiListToggleItem(mlw,item_index) + + This routine highlights the item with index <item_index> + if it is unhighlighted and unhighlights it if it is already + highlighted. The action performed by the toggle is returned + (XfwfMultiListActionHighlight or XfwfMultiListActionUnhighlight). + + *---------------------------------------------------------------------------*/ + +int XfwfMultiListToggleItem(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +{ + XfwfMultiListItem *item; + + if (MultiListMaxSelectable(mlw) == 0) + return(XfwfMultiListActionNothing); + if (item_index < 0 || item_index >= MultiListNumItems(mlw)) + return(XfwfMultiListActionNothing); + item = MultiListNthItem(mlw,item_index); + if (MultiListItemSensitive(item) == False) + return(XfwfMultiListActionNothing); + if (MultiListItemHighlighted(item)) + { + XfwfMultiListUnhighlightItem(mlw,item_index); + return(XfwfMultiListActionUnhighlight); + } + else + { + XfwfMultiListHighlightItem(mlw,item_index); + return(XfwfMultiListActionHighlight); + } +} /* End XfwfMultiListToggleItem */ + + +/*---------------------------------------------------------------------------* + + XfwfMultiListReturnStruct *XfwfMultiListGetHighlighted(mlw) + + This routine takes a MultiList widget <mlw> and returns a + XfwfMultiListReturnStruct whose num_selected and selected_items + fields contain the highlight information. The action field + is set to MULTILIST_ACTION_STATUS, and the item_index and string + fields are invalid. + + *---------------------------------------------------------------------------*/ + +XfwfMultiListReturnStruct *XfwfMultiListGetHighlighted(mlw) +XfwfMultiListWidget mlw; +{ + XfwfMultiListItem *item; + static XfwfMultiListReturnStruct ret_value; + + ret_value.action = XfwfMultiListActionStatus; + if (MultiListNumSelected(mlw) == 0) + { + ret_value.item = -1; + ret_value.string = NULL; + } + else + { + ret_value.item = MultiListSelArray(mlw) + [MultiListNumSelected(mlw) - 1]; + item = MultiListNthItem(mlw,ret_value.item); + ret_value.string = MultiListItemString(item); + } + ret_value.num_selected = MultiListNumSelected(mlw); + ret_value.selected_items = MultiListSelArray(mlw); + return(&ret_value); +} /* End XfwfMultiListGetHighlighted */ + + +/*---------------------------------------------------------------------------* + + Boolean XfwfMultiListIsHighlighted(mlw,item_index) + + This routine checks if the item with index <item_index> + is highlighted and returns True or False depending. If + <item_index> is invalid, False is returned. + + *---------------------------------------------------------------------------*/ + +Boolean XfwfMultiListIsHighlighted(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +{ + XfwfMultiListItem *item; + + if (item_index < 0 || item_index >= MultiListNumItems(mlw)) + return(False); + item = MultiListNthItem(mlw,item_index); + return(MultiListItemHighlighted(item)); +} /* End XfwfMultiListIsHighlighted */ + + +/*---------------------------------------------------------------------------* + + Boolean XfwfMultiListGetItemInfo(mlw,item_index,str_ptr,h_ptr,s_ptr) + + This routine returns the string, highlight status and + sensitivity information for the item with index <item_index> + via the pointers <str_ptr>, <h_ptr> and <s_ptr>. If the item + index is invalid, False is returned, else True is returned. + + *---------------------------------------------------------------------------*/ + +Boolean XfwfMultiListGetItemInfo(mlw,item_index,str_ptr,h_ptr,s_ptr) +XfwfMultiListWidget mlw; +int item_index; +String *str_ptr; +Boolean *h_ptr,*s_ptr; +{ + XfwfMultiListItem *item; + + if (item_index < 0 || item_index >= MultiListNumItems(mlw)) + return(False); + item = MultiListNthItem(mlw,item_index); + *str_ptr = MultiListItemString(item); + *h_ptr = MultiListItemHighlighted(item); + *s_ptr = MultiListItemSensitive(item); + return(True); +} /* End XfwfMultiListGetItemInfo */ + + +/*---------------------------------------------------------------------------* + + XfwfMultiListSetNewData(mlw,list,nitems,longest,resize, + sensitivity_array) + + This routine will set a new set of strings <list> into the + MultiList widget <mlw>. If <resize> is True, the MultiList widget will + try to resize itself. + + *---------------------------------------------------------------------------*/ + +#if NeedFunctionPrototypes +void +XfwfMultiListSetNewData(XfwfMultiListWidget mlw, String *list, + int nitems, int longest, Boolean resize, + Boolean *sensitivity_array) +#else +void +XfwfMultiListSetNewData(mlw,list,nitems,longest,resize,sensitivity_array) +XfwfMultiListWidget mlw; +String *list; +int nitems,longest; +int resize; +Boolean *sensitivity_array; +#endif +{ + DestroyOldData(mlw); + MultiListList(mlw) = list; + MultiListNumItems(mlw) = max(nitems,0); + MultiListLongest(mlw) = max(longest,0); + MultiListSensitiveArray(mlw) = sensitivity_array; + InitializeNewData(mlw); + RecalcCoords(mlw,resize,resize); + if (XtIsRealized((Widget)mlw)) Redisplay(mlw,NULL,NULL); +} /* End XfwfMultiListSetNewData */ diff --git a/vendor/x11iraf/obm/ObmW/MultiList.h b/vendor/x11iraf/obm/ObmW/MultiList.h new file mode 100644 index 00000000..1727a454 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MultiList.h @@ -0,0 +1,279 @@ +/**************************************************************************** + + MultiList.h + + This file is the public header file for the MultiList widget, an + extension to the Athena List widget. + + This code is loosely based on the Athena List source which + is why the MIT copyright notice appears below. + + The code was changed substantially in V3.4 to change the + action/callback interface which was unnecessarily ugly. Code + using some features of the old interface may need to be changed. + Hope the changes don't make people's lives too miserable. + + ****************************************************************************/ + +/* + * Author: + * Brian Totty + * Department of Computer Science + * University Of Illinois at Urbana-Champaign + * 1304 West Springfield Avenue + * Urbana, IL 61801 + * + * totty@cs.uiuc.edu + * + */ + +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Original Athena Author: Chris D. Peterson, MIT X Consortium + */ + +#ifndef _MULTILIST_H_ +#define _MULTILIST_H_ + +#include <X11/Xaw/Simple.h> + +/*---------------------------------------------------------------------------* + + R E S O U R C E D E S C R I P T I O N S A N D N O T E S + + *---------------------------------------------------------------------------*/ + +/* + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback XtCallbackList NULL *1 + columnWidth Width Dimension 0 *9 + columnSpacing Spacing Dimension 8 + cursor Cursor Cursor left_ptr + defaultColumns Columns int 1 *2 + destroyCallback Callback Pointer NULL + font Font XFontStruct* XtDefaultFont + forceColumns Columns Boolean False *2 + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 0 *3 + highlightBackground HBackground Pixel XtDefaultForeground *4 + highlightForeground HForeground Pixel XtDefaultBackground *4 + insensitiveBorder Insensitive Pixmap Gray + list List String * NULL *5 + longest Longest int 0 *6 + mappedWhenManaged MappedWhenManaged Boolean True + maxSelectable Value int 1 *7 + numberStrings NumberStrings int 0 *5 + pasteBuffer Boolean Boolean False + rowHeight Height Dimension 0 *9 + rowSpacing Spacing Dimension 2 + sensitive Sensitive Boolean True + sensitiveArray List Boolean * NULL *8 + shadeSurplus Boolean Boolean True *10 + verticalList Boolean Boolean False + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + + *1 - The callback functions are called whenever a highlight or unhighlight + takes place. More precisely, a callback occurs whenever the Notify() + action is triggered. By default, this occurs when the mouse button is + lifted after a selection or deselection occurred. The callback returns + an XfwfMultiListReturnStruct data structure which contains numerous + fields describing the selection state. The most important fields + indicate the total number of items selected, and a list of those items. + + *2 - The defaultColumns resource is used in two cases. If forceColumns + is true, the widget will set the number of columns to the value of + default columns. If the widget width is unconstrained by the parent + widgets, the defaultColumns is also used to determine the number of + columns and the resulting width. Otherwise, the number of columns + will be calcultaed based on the current width and will be changed to + an appropriate value. + + *3 - If the width or height is set to zero (0), which is the default case, + then the widget will calculate the size of that dimension to be just + large enough to hold the contents of the widget. + + *4 - The highlightForeground and highlightBackground colors specify the + colors used to highlight the text (foreground) and the surrounding + background space of a list item when it is selected (highlighted). + The default is the reverse of the default foreground and background + colors. + + *5 - The list resource is an array of strings (char * array) which tell + the names of each item of the list. The number of elements of this + array are indicated by the resource numberStrings. If numberStrings + is set to 0 (the default), then the MultiList widget will count the + number of strings in the list. This requires that the list be + NULL terminated. If list is NULL, then the widget treats it as an + empty list. Once the list is set the list resource is set to NULL, + so you won't be able to read back the list after it has been set. The + widgets copies the strings internally, so the user can free the list + storage after setting it. + + *6 - This resource represent the longest string in pixels. If this + resource is zero (0), which is the default and probably the value + most people should use, the longest string length is calculated + and the resource is updated. + + *7 - The maxSelectable resource indicates the maximum number of items + which can be selected at any one time. In the original Athena + widget, you could have at most one item selected at a time. In + this widget, you can choose how many will be selected at a time. + + *8 - Each item in the MultiList can be made insensitive, so it is printed in + gray shading and can not be highlighted. This can be done by + setting the sensitivity list, which is an array of Booleans which + indicate whether or not the corresponding item is sensitive (can be + selected). If sensitivity list is NULL, all items are sensitive. The + widget copies the sensitivity information, so the user can delete the + sensitivity array storage after setting it. The widget sets the + resource to NULL after it has been set, so the user cannot read the + old list back. + + *9 - These values are intended for reading only. They indicate the pixel + width/height of the column/row. + + *10 - If the list height is made larger than the sum of the list entry + heights, the surplus space is shaded in the background color if + shadeSurplus is False, or in a gray stipple pattern if shadeSurplus + is True. + +*/ + +/*---------------------------------------------------------------------------* + + S T R I N G D E F I N I T I O N S + + *---------------------------------------------------------------------------*/ + +#define XtCList "List" +#define XtCSpacing "Spacing" +#define XtCColumns "Columns" +#define XtCLongest "Longest" +#define XtCNumberStrings "NumberStrings" +#define XtCHForeground "HForeground" +#define XtCHBackground "HBackground" + +#ifndef XtNcursor +#define XtNcursor "cursor" +#endif + +#define XtNhighlightForeground "highlightForeground" +#define XtNhighlightBackground "highlightBackground" +#define XtNcolumnSpacing "columnSpacing" +#define XtNrowSpacing "rowSpacing" +#define XtNdefaultColumns "defaultColumns" +#define XtNforceColumns "forceColumns" +#define XtNpasteBuffer "pasteBuffer" +#define XtNverticalList "verticalList" +#define XtNlongest "longest" +#define XtNnumberStrings "numberStrings" +#define XtNlist "list" +#define XtNsensitiveArray "sensitiveArray" +#define XtNmaxSelectable "maxSelectable" +#define XtNshadeSurplus "shadeSurplus" + +#define XtNrowHeight "rowHeight" +#define XtNcolumnWidth "columnWidth" + +#ifndef XtNtablist +#define XtNtablist "tablist" +#endif +#ifndef XtCTablist +#define XtCTablist "Tablist" +#endif + + /* Class Record Constants */ + +extern WidgetClass xfwfMultiListWidgetClass; + +typedef struct _XfwfMultiListClassRec *XfwfMultiListWidgetClass; +typedef struct _XfwfMultiListRec *XfwfMultiListWidget; + +/*---------------------------------------------------------------------------* + + R E T U R N S T R U C T U R E + + *---------------------------------------------------------------------------*/ + +#define XfwfMultiListActionNothing 0 +#define XfwfMultiListActionHighlight 1 +#define XfwfMultiListActionUnhighlight 2 +#define XfwfMultiListActionStatus 3 + +typedef struct _XfwfMultiListReturnStruct +{ + int num_selected; /* Number Of Items Now Selected */ + int *selected_items; /* Indexes Of Selected Items */ + + int action; /* Last Action Performed */ + int item; /* Last Item Index Modified */ + String string; /* String Of Last Index Modified */ +} XfwfMultiListReturnStruct; + +/*---------------------------------------------------------------------------* + + U T I L I T Y R O U T I N E S + + *---------------------------------------------------------------------------*/ + +#if (!NeedFunctionPrototypes) + +extern Boolean XfwfMultiListHighlightItem(); +extern void XfwfMultiListHighlightAll(); +extern void XfwfMultiListUnhighlightItem(); +extern void XfwfMultiListUnhighlightAll(); +extern int XfwfMultiListToggleItem(); +extern XfwfMultiListReturnStruct * + XfwfMultiListGetHighlighted(); +extern Boolean XfwfMultiListIsHighlighted(); +extern Boolean XfwfMultiListGetItemInfo(); +extern void XfwfMultiListSetNewData(); + +#else + +extern Boolean XfwfMultiListHighlightItem(XfwfMultiListWidget mlw, + int item_index); +extern void XfwfMultiListHighlightAll(XfwfMultiListWidget mlw); +extern void XfwfMultiListUnhighlightItem(XfwfMultiListWidget mlw, + int item_index); +extern void XfwfMultiListUnhighlightAll(XfwfMultiListWidget mlw); +extern int XfwfMultiListToggleItem(XfwfMultiListWidget mlw, + int item_index); +extern XfwfMultiListReturnStruct * + XfwfMultiListGetHighlighted(XfwfMultiListWidget mlw); +extern Boolean XfwfMultiListIsHighlighted(XfwfMultiListWidget mlw, + int item_index); +extern Boolean XfwfMultiListGetItemInfo(XfwfMultiListWidget mlw, + int item_index, String *str_ptr, + Boolean *h_ptr, Boolean *s_ptr); +extern void XfwfMultiListSetNewData(XfwfMultiListWidget mlw, + String *list, int nitems, int longest, + Boolean resize, Boolean *sensitivity_array); + +#endif +#endif diff --git a/vendor/x11iraf/obm/ObmW/MultiList.man b/vendor/x11iraf/obm/ObmW/MultiList.man new file mode 100644 index 00000000..ee8f532a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MultiList.man @@ -0,0 +1,207 @@ +'\" t +.TH "MultiList" "3" "19 May 1992" "Version 3.4" "Free Widget Foundation" +.SH Name +MultiList \- list from which multiple entries can be selected +.SH Synopsis +#include <X11/Intrinsic.h> +#include <X11/MultiList.h> + +widget = XtCreateManagedWidget(name, multiListWidgetClass, ...); +.SH Class Hierarchy +Core-->Simple-->MultiList +.SH Description + +MultiList is a replacement for the Athena List widget, which allows +multiple selections to be made. The aesthetics have also been +slightly improved: the highlight colors can now be selected, and the +selection extends across the entire width of the column rather than +just the length of the string. + +The maximum number of multiple selections can be specified. Items are +selected and unselected by an action interface. By default, mouse +button 1 is used to select, unselect, and toggle items. When the +mouse button is lifted, any callbacks in the callback list are called +with a data structure which describes the count of select items, and +lists the indices of the selected items. The return structure +contains some additional information describing the last item modified +and the last action performed, which will probably not be of general +use, and I'd love to delete if I was sure that people didn't use them. +(The behavior of these fields has changed slightly in V3.4). + +.SH Resources +In addition to the resources defined by superclasses, this widget +defines the following: +.TS +tab(/) ; +lB lB lB lB. +Name/Class/Type/Default +.T& +lB l l l. +XtNbackground/Background/Pixel/XtDefaultBackground +XtNborder/BorderColor/Pixel/XtDefaultForeground +XtNborderWidth/BorderWidth/Dimension/1 +XtNcallback/Callback/XtCallbackList/NULL +XtNcolumnWidth/Width/Dimension/0 +XtNcolumnSpacing/Spacing/Dimension/8 +XtNcursor/Cursor/Cursor/left_ptr +XtNdefaultColumns/Columns/int/1 +XtNdestroyCallback/Callback/Pointer/NULL +XtNfont/Font/XFontStruct/XtDefaultFont +XtNforceColumns/Columns/Boolean/False +XtNforeground/Foreground/Pixel/XtDefaultForeground +XtNheight/Height/Dimension/0 +XtNhighlightBackground/HBackground/Pixel/XtDefaultForeground +XtNhighlightForeground/HForeground/Pixel/XtDefaultBackground +XtNinsensitiveBorder/Insensitive/Pixmap/Gray +XtNlist/List/String/NULL +XtNlongest/Longest/int/0 +XtNmappedWhenManaged/MappedWhenManaged/Boolean/True +XtNmaxSelectable/Value/int/1 +XtNnumberStrings/NumberStrings/int/0 +XtNpasteBuffer/Boolean/Boolean/False +XtNrowHeight/Height/Dimension/0 +XtNrowSpacing/Spacing/Dimension/2 +XtNsensitive/Sensitive/Boolean/True +XtNsensitiveArray/List/Boolean/NULL +XtNtablist/String/String/NULL +XtNtabs/List/int/NULL +XtNverticalList/Boolean/Boolean/False +XtNwidth/Width/Dimension/0 +XtNx/Position/Position/0 +XtNy/Position/Position/0 +.TE +.ne 4 +.SH Public Functions +.nf +.ta 3i +void XfwfMultiListHighlightItem(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +.fi +.sp +.RS 5 +This routine selects an item with index <item_index> in the MultiList +widget <mlw>. If a maximum number of selections is specified and +exceeded, the earliest selection will be unselected. If <item_index> +doesn't correspond to an item the most recently clicked item will be +set to -1 and this routine will immediately return, otherwise the most +recently clicked item will be set to the current item. +.RE +.sp +.nf +void XfwfMultiListHighlightAll(mlw) +XfwfMultiListWidget mlw; +.fi +.sp +.RS 5 +This routine highlights all highlightable items in the MultiList +widget <mlw>, up to the maximum number of allowed highlightable items; +.RE +.sp +.nf +void XfwfMultiListUnhighlightItem(mlw,item_index) +XfwfMultiListWidget mlw; +int item_index; +.fi +.sp +.RS 5 +This routine unselects the item with index <item_index> in the +MultiList widget <mlw>. If <item_index> doesn't correspond to a +selected item, then nothing will happen. Otherwise, the item is +unselected and the selection array and count are updated. +.RE +.sp +.nf +void XfwfMultiListUnhighlightAll(mlw) +XfwfMultiListWidget mlw; +.fi +.sp +.RS 5 +This routine unhighlights all items in the MultiList widget <mlw>. +.RE +.sp +.nf +int XfwfMultiListToggleItem(mlw,item_index) +XfwfMultiListWidget mlw; +.fi +.sp +.RS 5 +This routine highlights the item with index <item_index> if it is +unhighlighted and unhighlights it if it is already highlighted. The +action performed by the toggle is returned (XfwfMultiListActionHighlight +or XfwfMultiListActionUnhighlight). +.RE +.sp +.nf +XfwfMultiListReturnStruct *MultiListGetHighlighted(mlw) +XfwfMultiListWidget mlw; +.fi +.sp +.RS 5 +This routine takes a MultiList widget <mlw> and returns a +MultiListReturnStruct whose num_selected and selected_items fields +contain the highlight information. The action field is set to +XfwfMultiListActionStatus, and the item_index and string fields are +invalid. +.RE +.sp +.nf +Boolean XfwfMultiListIsHighlighted(plw,item_index) +XfwfMultiListWidget mlw; +int item_index; +.fi +.sp +.RS 5 +This routine checks if the item with index <item_index> is highlighted +and returns True or False depending. If <item_index> is invalid, +False is returned. +.RE +.sp +.nf +Boolean XfwfMultiListGetItemInfo(mlw,item_index,str_ptr,h_ptr,s_ptr) +XfwfMultiListWidget mlw; +int item_index; +String *str_ptr; +Boolean *h_ptr,*s_ptr; +.fi +.sp +.RS 5 +This routine returns the string, highlight status and sensitivity +information for the item with index <item_index> via the pointers +<str_ptr>, <h_ptr> and <s_ptr>. If the item index is invalid, False +is returned, else True is returned. +.RE +.sp +.nf +void XfwfMultiListSetNewData(mlw,list,nitems,longest,resize,sensitivity_array) +MultiListWidget mlw; +String *list; +int nitems,longest; +Boolean resize; +Boolean *sensitivity_array; +.fi +.sp +.RS 5 +This routine will set a new set of strings <list> into the MultiList +widget <mlw>. If <resize> is True, the MultiList widget will try to +resize itself. +.RE +.sp +.nf +.ne 4 +.SH Restrictions +.LP +There are likely to be inadequacies in this code. Specifically, I am +not sure what the callback interface should look like when you can +select and unselect multiple items. This is the reason for the +confusing return structure fields. Please send bug reports and +feature requests to the email address below. +.SH Author +.sp +.nf +Brian Totty, \fItotty@cs.uiuc.edu\fR +Department of Computer Science, +University of Illinois at Urbana-Champaign +1304 W. Springfield Avenue +Urbana, IL 61801 +.fi diff --git a/vendor/x11iraf/obm/ObmW/MultiListP.h b/vendor/x11iraf/obm/ObmW/MultiListP.h new file mode 100644 index 00000000..5e3982e8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/MultiListP.h @@ -0,0 +1,200 @@ +/**************************************************************************** + + MultiListP.h + + This file is the private header file for the MultiList widget, an + extension to the Athena List widget. + + This code is loosely based on the Athena List source which + is why the MIT copyright notice appears below. + + The code was changed substantially in V3.4 to change the + action/callback interface which was unnecessarily ugly. Code + using some features of the old interface may need to be changed. + Hope the changes don't make people's lives too miserable. + + ****************************************************************************/ + +/* + * Author: + * Brian Totty + * Department of Computer Science + * University Of Illinois at Urbana-Champaign + * 1304 West Springfield Avenue + * Urbana, IL 61801 + * + * totty@cs.uiuc.edu + * + */ + +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Original Athena Author: Chris D. Peterson, MIT X Consortium + */ + +#ifndef _MULTILISTP_H_ +#define _MULTILISTP_H_ + +#include <X11/Xaw/SimpleP.h> +#include "MultiList.h" + +/*---------------------------------------------------------------------------* + + L O C A L D A T A S T R U C T U R E D E F I N I T I O N S + + *---------------------------------------------------------------------------*/ + +typedef struct +{ + Boolean sensitive; + Boolean highlighted; + String string; +} XfwfMultiListItem; + +/*---------------------------------------------------------------------------* + + W I D G E T D A T A S T R U C T U R E D E F I N I T I O N S + + *---------------------------------------------------------------------------*/ + +typedef struct +{ + int foo; +} XfwfMultiListClassPart; + +typedef struct _XfwfMultiListClassRec +{ + CoreClassPart core_class; + SimpleClassPart simple_class; + XfwfMultiListClassPart multiList_class; +} XfwfMultiListClassRec; + +extern XfwfMultiListClassRec xfwfMultiListClassRec; + +typedef struct +{ + Pixel foreground; + Pixel highlight_fg; + Pixel highlight_bg; + Dimension column_space; + Dimension row_space; + int default_cols; + Boolean force_cols; + Boolean paste; + Boolean row_major; + int longest; + int nitems; + XFontStruct *font; + String *list; + Boolean *sensitive_array; + XtCallbackList callback; + int max_selectable; + Boolean shade_surplus; + Dimension col_width; + Dimension row_height; + + int right_padding; + int bottom_padding; + int nrows; + int ncols; + int most_recent_clicked_item; + int most_recent_action; + GC erase_gc; + GC draw_gc; + GC highlight_bg_gc; + GC highlight_fg_gc; + GC gray_gc; + XfwfMultiListItem *item_array; + int num_selected; + int *sel_array; + + char *tablist; + int *tabs; +} XfwfMultiListPart; + +typedef struct _XfwfMultiListRec +{ + CorePart core; + SimplePart simple; + XfwfMultiListPart multiList; +} XfwfMultiListRec; + +/*---------------------------------------------------------------------------* + + D A T A S T R U C T U R E A C C E S S M A C R O S + + *---------------------------------------------------------------------------*/ + +#define MultiListItemSensitive(i) ((i)->sensitive) +#define MultiListItemHighlighted(i) ((i)->highlighted) +#define MultiListItemString(i) ((i)->string) + +#define InstanceCore(w) (&((w)->core)) +#define InstanceSimple(w) (&((w)->simple)) +#define InstanceMultiList(w) (&((w)->multiList)) + +#define MultiListWidth(w) (InstanceCore(w)->width) +#define MultiListHeight(w) (InstanceCore(w)->height) +#define MultiListBG(w) (InstanceCore(w)->background_pixel) +#define MultiListSensitive(w) (InstanceCore(w)->sensitive) +#define MultiListAncesSensitive(w) (InstanceCore(w)->ancestor_sensitive) +#define MultiListDepth(w) (InstanceCore(w)->depth) + +#define MultiListFG(w) (InstanceMultiList(w)->foreground) +#define MultiListHighlightFG(w) (InstanceMultiList(w)->highlight_fg) +#define MultiListHighlightBG(w) (InstanceMultiList(w)->highlight_bg) +#define MultiListColumnSpace(w) (InstanceMultiList(w)->column_space) +#define MultiListRowSpace(w) (InstanceMultiList(w)->row_space) +#define MultiListDefaultCols(w) (InstanceMultiList(w)->default_cols) +#define MultiListForceCols(w) (InstanceMultiList(w)->default_cols) +#define MultiListPaste(w) (InstanceMultiList(w)->paste) +#define MultiListRowMajor(w) (InstanceMultiList(w)->row_major) +#define MultiListLongest(w) (InstanceMultiList(w)->longest) +#define MultiListNumItems(w) (InstanceMultiList(w)->nitems) +#define MultiListFont(w) (InstanceMultiList(w)->font) +#define MultiListList(w) (InstanceMultiList(w)->list) +#define MultiListSensitiveArray(w) (InstanceMultiList(w)->sensitive_array) +#define MultiListCallback(w) (InstanceMultiList(w)->callback) +#define MultiListMaxSelectable(w) (InstanceMultiList(w)->max_selectable) +#define MultiListShadeSurplus(w) (InstanceMultiList(w)->shade_surplus) + +#define MultiListColWidth(w) (InstanceMultiList(w)->col_width) +#define MultiListRowHeight(w) (InstanceMultiList(w)->row_height) +#define MultiListRightPadding(w) (InstanceMultiList(w)->right_padding) +#define MultiListBottomPadding(w) (InstanceMultiList(w)->bottom_padding) +#define MultiListNumRows(w) (InstanceMultiList(w)->nrows) +#define MultiListNumCols(w) (InstanceMultiList(w)->ncols) +#define MultiListMostRecentItem(w) (InstanceMultiList(w)->most_recent_clicked_item) +#define MultiListMostRecentAct(w) (InstanceMultiList(w)->most_recent_action) +#define MultiListEraseGC(w) (InstanceMultiList(w)->erase_gc) +#define MultiListDrawGC(w) (InstanceMultiList(w)->draw_gc) +#define MultiListHighlightForeGC(w) (InstanceMultiList(w)->highlight_fg_gc) +#define MultiListHighlightBackGC(w) (InstanceMultiList(w)->highlight_bg_gc) +#define MultiListGrayGC(w) (InstanceMultiList(w)->gray_gc) +#define MultiListItemArray(w) (InstanceMultiList(w)->item_array) +#define MultiListNthItem(w,n) (&(MultiListItemArray(w)[n])) +#define MultiListSelArray(w) (InstanceMultiList(w)->sel_array) +#define MultiListNumSelected(w) (InstanceMultiList(w)->num_selected) + +#define MultiListTabList(w) (InstanceMultiList(w)->tablist) +#define MultiListTabs(w) (InstanceMultiList(w)->tabs) + +#endif diff --git a/vendor/x11iraf/obm/ObmW/Notes b/vendor/x11iraf/obm/ObmW/Notes new file mode 100644 index 00000000..fe635b21 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Notes @@ -0,0 +1,191 @@ + GUI WORK NOTES - November 1993 + +TODO + + enhance mapping code in Gterm widget (see below) + ximtool enhancements + locator, magnifier, control panel, socket support, etc. + clean up xgterm + - beta release - + obm enhancements + more gui bindings, new widgets + imbrowse, movie demos + obm documentation + + +1. MAPPINGS + + src rect -> dst rect + + construct pixel level mappings for each axis + this source pixel maps to these destination pixels + this destination pixel maps to these source pixels + + in general (zoom/dezoom) the mapping is not one-to-one + when one source pixel maps to several destination pixels, pixel replication + is used to draw the destination pixels + when one destination pixel maps to several source pixels the destination + pixel value may be computed by any of several different techniques + + major cases + + mapping is one-to-one + mapping is one-to-many zoom mapping (pixel replication) + mapping is many-to-one dezoom mapping (antialias) + + antialiasing techniques + + nearest nearest neighbor + bilinear 2x2 distance weighted sum + + area included area weighted sum + lowpass convolve followed by nearest neighbor + gaussian gaussian weighted sum over NxN pixels + + All of these involve projecting the center of each destination + pixel back into the source raster. The antialiasing technique + applied to the NxN neighborhood around the source coordinate + then determines the value of the destination pixel. + + Reasonable choices + nearest fastest, but no antialiasing + bilinear mininum smoothing if mag < 2 + lowpass not bad for mag < 3 + area,gaussian best for large demagnification ratios + + Nearest and bilinear (NB) are mutually exclusive and may be selected + independently of area, lowpass, or gaussian (ALG). If one of ALG is + selected and one of NB is also selected, the antialias code will use + one or the other technique depending upon the scaling. If one of NB + or ALG is selected but not both, the specified technique will be + used regardless of the scaling. + + setMapping should compute scaling maps + copyRaster uses these to compute the destination pixels + refreshRaster uses these to compute region of source rect + + computing a mapping + rasterop + src rect, dst rect + coordinate types + flags: enabled, defined, refresh + scaling type (unitary, zoom, dezoom) + backprojection array maps dst pixel to src pixel + integer mapping (1-1, zoom): pixel number, integer + antialias mapping (dezoom): pixel center, floating + extent array gives range of dst pixels affected by a given + src pixel - 2 values per source pixel + xscale, yscale (forward direction) + + +2. PSEUDOCODE + +procedure copyRaster (src, src rect, dst, dst rect) +begin + create temporary mapping + refresh entire mapping +end + +procedure writePixels (dst, dst rect, pixels) +begin + modify source raster pixels + update any mappings that intersect source rect +end + +procedure setMapping (mapping, mapping data) +begin + if (new mapping, mapping not enabled, or refreshNone set) + merely store new mapping + else { + # Edit and refresh a mapping. + if (scale is unchanged) { + compare old, new mappings + refresh only changed regions + store new mapping + } else { + store new mapping + refresh entire mapping + } + refresh any uncovered regions + } + + if (mapping is one-to-one) { + scaling = none + } else if (mapping is one-to-many) { + compute integer dst->src scaling maps + scaling = zoom + } else if (mapping is many-to-one) { + compute array of back projected dst->src pixel centers + scaling = dezoom + } +end + +procedure refresh_source (mapping, source rect) +begin + compute destination rect + refresh_destination (mapping, destination rect) +end + +procedure refresh_destination (mapping, destination rect) +begin + set clip mask in GC to prevent drawing into any mapped regions + which cover the mapping being refreshed + + # Special case of pixmap to pixmap copy with no scaling. + if (no scaling and src is pixmap and dst is pixmap) { + do direct XCopyArea + goto done + } + + # Get source ximage. + if (src is pixmap) { + xin = ximage returned by XGetImage + set del_xin flag + } else + xin = src ximage + + # Special case of ximage to pixmap copy with no scaling. + if (no scaling and dst is pixmap) { + do XPutImage to write xin to dst pixmap + goto done + } + + # Get destination ximage. + if (dst is pixmap) { + xout = create an ximage of the required size + set del_xout flag + } else + xout = dst ximage + + # Copy src ximage to dst ximage. + if (mapping is one to one) { + copy region of xin to xout without scaling + + } else if (mapping is one to many - zoom) { + for (each line of destination) + if (mapped src Y same as previous line) + copy previous dst line + else { + for (each destination pixel) + pixel = get pixel from xin using dst->src map + } + + } else (mapping is many to one - dezoom) { + if (function is lowpass) { + compute lowpass xin + set function to nearest neighbor + } + + for (each line of destination) + for (each destination pixel) + pixel = antialias_function (src, x, y, nx, ny) + } + + if (dst is pixmap) + do XPutImage to write xout to dst pixmap + + clear clip mask in GC +end + + + diff --git a/vendor/x11iraf/obm/ObmW/README b/vendor/x11iraf/obm/ObmW/README new file mode 100644 index 00000000..b75418d3 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/README @@ -0,0 +1,83 @@ +ObmW -- Custom widgets used by the Object Manager. This directory contains +standalone X toolkit widgets; these are not tied to the Object Manager in any +way. The widgets in this collection are included here if they are used in +the Object Manager but are not part of any standard toolkit. + +To interface a new widget to the Object Manager, one can add the widget +source to this directory and modify ObmP.h and obmres.dat (which is generated +using obmres.c) in the OBM root directory to tell OBM about the widget and +its resources. One may optionally wish to subclass the OBM Widget class to +make any widget-specific functions available to interpreted GUI code. + +Widets: + + Gterm Gterm gterm-image widget (2D graphics and imaging) + Layout Layout geometry widget, uses layout description language + + Arrow Arrow arrow widget, as in a scrollbar + Board Board geometry widget, organizes children by coordinate + Frame Frame draws a frame around a child widget + Group Group organize multiple children into a group + Icon Icon display a color pixmap + MultiList MultiList list widget with multiple selections + RadioGrp RadioGroup radio group, subclass of Group + RowCol RowCol geometry widget, arranges children in a table + Scrollbar Scrollbar2 alternative to Athena scrollbar widget + Slider2 Slider2D 2D slider widget (can be used as 1D slider) + Label TextBox framed box with formatted text + Button TextButton TextBox as a button with callback + Toggle TextToggle button with on,off bitmap to the left + + Common XfwfCommon used internally by all FWF widgets + MenuBar MenuBar doesn't work, placeholder for now + + +Notes on widget callbacks (used internally by OBM, not GUIs). +-------------------------------------------------------------- + +FWF widgets: + + Boolean XfwfMultiListGetItemInfo (mlw,item_index,str_ptr,h_ptr,s_ptr) + Boolean XfwfMultiListHighlightItem (mlw,item_index) + Boolean XfwfMultiListIsHighlighted (mlw,item_index) + struct = XfwfMultiListGetHighlighted (mlw) + XfwfMultiListSetNewData (mlw,list,nitems,longest,resize, + sensitivity_array) + + int XfwfMultiListToggleItem (mlw,item_index) + XfwfMultiListHighlightAll (mlw) + XfwfMultiListUnhighlightAll (mlw) + XfwfMultiListUnhighlightItem (mlw,item_index) + + XfwfGetThumb (self,info) + XfwfMoveThumb (self,x,y) + XfwfResizeThumb (self,wd,ht) + XfwfSetScrollbar (self,pos,size) + + void XfwfConnectScrollingWidgets (w1, w2) + + +Athena widgets: + + char* XawDialogGetValueString (w) + XtFormDoLayout (w, do_layout) + + XawListChange (w, list, nitems, longest, resize) + XawListHighlight (w, item) + XawListUnhighlight (w) + XawListShowCurrent (w) + + XawScrollbarSetThumb (w, top, shown) + + Panner: Callback when panner moves. + Porthole: Multiple children, only one managed at a time. Single + callback called when child is moved or resized. + Repeater: Repeating version of command widget. Two callbacks, start + callback and stop callback. + Scrollbar: Callbacks: jumpProc, scrollProc + StripChart: getValue callback called to get new data point + Tree: No special callbacks or functions + Viewport: Report callback called if child moved or resized + + All geometry widgets have a function to disable/force layout of the + children, used to disable layout when multiple children are modified. diff --git a/vendor/x11iraf/obm/ObmW/RadioGrp.c b/vendor/x11iraf/obm/ObmW/RadioGrp.c new file mode 100644 index 00000000..14d39924 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RadioGrp.c @@ -0,0 +1,239 @@ +/* Generated by wbuild from "RadioGrp.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Toggle.h" +#include "RadioGrpP.h" +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void class_initialize( +#if NeedFunctionPrototypes +void +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void create_toggles( +#if NeedFunctionPrototypes +Widget +#endif +); +#define done(type, value) do {\ + if (to->addr != NULL) {\ + if (to->size < sizeof(type)) {\ + to->size = sizeof(type);\ + return False;\ + }\ + *(type*)(to->addr) = (value);\ + } else {\ + static type static_val;\ + static_val = (value);\ + to->addr = (XtPointer)&static_val;\ + }\ + to->size = sizeof(type);\ + return True;\ + }while (0 ) + + +static Boolean cvtStringToStringArray( +#if NeedFunctionPrototypes +Display *,XrmValuePtr ,Cardinal *,XrmValuePtr ,XrmValuePtr ,XtPointer * +#endif +); +static StringArray newStringArray( +#if NeedFunctionPrototypes +StringArray +#endif +); +static void freeStringArray( +#if NeedFunctionPrototypes +StringArray +#endif +); +/*ARGSUSED*/static void create_toggles(self)Widget self; +{ + Cardinal i; + StringArray s; + + for (i = 0; i < ((XfwfRadioGroupWidget)self)->composite.num_children; i++) + XtDestroyWidget(((XfwfRadioGroupWidget)self)->composite.children[i]); + + if (((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels == NULL) return; + + for (s = ((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels, i = 0; s[i] != NULL; i++) { + (void) XtVaCreateManagedWidget + (s[i], xfwfToggleWidgetClass, self, XtNlabel, s[i], XtNshrinkToFit, + True, XtNborderWidth, 0, XtNframeWidth, 0, NULL); + } +} +/*ARGSUSED*/static Boolean cvtStringToStringArray(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr args;Cardinal * num_args;XrmValuePtr from;XrmValuePtr to;XtPointer * converter_data; +{ + String t, s; + StringArray a = NULL; + Cardinal i; + char delim; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToStringArray", "wrongParameters", + "XtToolkitError", + "String to StringArray conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + delim = ((String) from->addr)[0]; + s = XtNewString((String) from->addr + 1); + i = 0; + while (s && *s) { + t = strchr(s, delim); + if (t) *t = '\0'; + a = (StringArray) XtRealloc((String) a, (i + 1) * sizeof(*a)); + a[i] = s; + i++; + s = t ? t + 1 : NULL; + } + a = (StringArray) XtRealloc((String) a, (i + 1) * sizeof(*a)); + a[i] = NULL; + done(StringArray, a); +} +/*ARGSUSED*/static StringArray newStringArray(a)StringArray a; +{ + Cardinal n, i; + StringArray s; + + if (!a) return NULL; + for (s = a, n = 0; s[n]; n++) ; + s = (StringArray) XtMalloc((n + 1) * sizeof(*s)); + for (i = 0; i < n; i++) s[i] = XtNewString(a[i]); + s[n] = NULL; + return s; +} +/*ARGSUSED*/static void freeStringArray(a)StringArray a; +{ + Cardinal i; + + if (!a) return; + for (i = 0; a[i]; i++) XtFree(a[i]); + XtFree((String) a); +} + +static XtResource resources[] = { +{XtNlabels,XtCLabels,XtRStringArray,sizeof(((XfwfRadioGroupRec*)NULL)->xfwfRadioGroup.labels),XtOffsetOf(XfwfRadioGroupRec,xfwfRadioGroup.labels),XtRImmediate,(XtPointer)NULL }, +}; + +XfwfRadioGroupClassRec xfwfRadioGroupClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfGroupClassRec, +"RadioGroup", +sizeof(XfwfRadioGroupRec), +class_initialize, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +NULL, +0, +resources, +1, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +XtInheritExpose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfRowCol_class part */ +XtInherit_layout, +}, +{ /* XfwfGroup_class part */ +0 +}, +{ /* XfwfRadioGroup_class part */ +0 +}, +}; +WidgetClass xfwfRadioGroupWidgetClass = (WidgetClass) &xfwfRadioGroupClassRec; +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfRadioGroupWidgetClass c = (XfwfRadioGroupWidgetClass) class; + XfwfRadioGroupWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfRadioGroupWidgetClass) return; + super = (XfwfRadioGroupWidgetClass)class->core_class.superclass; +} +/*ARGSUSED*/static void class_initialize() +{ + XtSetTypeConverter(XtRString, "StringArray", cvtStringToStringArray, + NULL, 0, XtCacheNone, NULL); +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + ((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels = newStringArray(((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels); + create_toggles(self); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + if (((XfwfRadioGroupWidget)old)->xfwfRadioGroup.labels != ((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels) { + freeStringArray(((XfwfRadioGroupWidget)old)->xfwfRadioGroup.labels); + ((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels = newStringArray(((XfwfRadioGroupWidget)self)->xfwfRadioGroup.labels); + create_toggles(self); + } + return False; +} diff --git a/vendor/x11iraf/obm/ObmW/RadioGrp.h b/vendor/x11iraf/obm/ObmW/RadioGrp.h new file mode 100644 index 00000000..9724e570 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RadioGrp.h @@ -0,0 +1,22 @@ +/* Generated by wbuild from "RadioGrp.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfRadioGroup_H_ +#define _XfwfRadioGroup_H_ +#include "Group.h" +typedef String * StringArray; + +#ifndef XtNlabels +#define XtNlabels "labels" +#endif +#ifndef XtCLabels +#define XtCLabels "Labels" +#endif +#ifndef XtRStringArray +#define XtRStringArray "StringArray" +#endif + +typedef struct _XfwfRadioGroupClassRec *XfwfRadioGroupWidgetClass; +typedef struct _XfwfRadioGroupRec *XfwfRadioGroupWidget; +externalref WidgetClass xfwfRadioGroupWidgetClass; +#endif /*_XfwfRadioGroup_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/RadioGrp.man b/vendor/x11iraf/obm/ObmW/RadioGrp.man new file mode 100644 index 00000000..769547ef --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RadioGrp.man @@ -0,0 +1,384 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfRadioGroup +.SH DESCRIPTION +The RadioGroup widget is a simple specialization of the Group +widget. It has an extra resource, \fIlabels\fP, which holds the labels of +the toggle buttons that are created automatically. For the common case +that a Group widget contains only radio buttons, the RadioGroup widget +is much more convenient. It is also much less flexible. E.g., it is +very difficult to change resources of the radio buttons, when the +defaults are not satisfactory. + +In particular, the Toggle widgets are created with the following +hardcoded resources: \fIshrinkToFit = True\fP, \fIborder_width = 0\fP, +\fIframeWidth = 0\fP. The names of the Toggle widgets are equal to their +labels. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfRadioGroup +Name Class Type Default +XtNlabels XtCLabels StringArray NULL + +.TE +.ps + +.TP +.I "XtNlabels" +The \fIlabels\fP resource is an array of strings. Each string will +become the label of a toggle button. The last member of the array must +be a \fINULL\fP pointer. + +There is a converter that allows the list of strings to be entered as +a single string, with any character as separator. + + + +.hi + +.nf +StringArray labels = NULL +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfGroup +Name Class Type Default +XtNlabel XtCLabel String NULL +XtNfont XtCFont FontStruct XtDefaultFont +XtNforeground XtCForeground Pixel XtDefaultForeground +XtNselectionStyle XtCSelectionStyle SelectionType XfwfSingleSelection +XtNselection XtCSelection Long 0 +XtNactivate XtCActivate Callback NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfRowCol +Name Class Type Default +XtNstoreByRow XtCStoreByRow Boolean True +XtNrows XtCRows Int 0 +XtNcolumns XtCColumns Int 0 +XtNalignment XtCAlignment Alignment XfwfTopLeft +XtNshrinkToFit XtCShrinkToFit Boolean False + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The type \fIStringArray\fP represents an array of \fIString\fPs, with the +proviso that by convention the last member of a \fIStringArray\fP is +always a \fINULL\fP pointer. There is a converter that can construct a +\fIStringArray\fP from a single string. + + + +.nf + +.B type + StringArray = String * +.fi + +.hi +.SH "Importss" + +.nf + +.B incl + <Xfwf/Toggle.h> +.fi + +.hi + +.hi +.SS "Methods" + +\fIclass_initialize\fP registers the type converter. + +.nf +class_initialize() +{ + XtSetTypeConverter(XtRString, "StringArray", cvtStringToStringArray, + NULL, 0, XtCacheNone, NULL); +} +.fi + +In the \fIinitialize\fP method, the utility function \fIcreate_toggles\fP is +called, which creates toggle widgets for each label in the \fIlabels\fP +resource. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + $labels = newStringArray($labels); + create_toggles($); +} +.fi + +The \fIset_values\fP method makes a private copy of the \fIlabels\fP +resource and calls \fIcreate_labels\fP. Since the RadioGroup doesn't draw +anything itself, the return value is always \fIFalse\fP. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + if ($old$labels != $labels) { + freeStringArray($old$labels); + $labels = newStringArray($labels); + create_toggles($); + } + return False; +} +.fi + +.hi + +.hi +.SH "Utilities" + +The function \fIcreate_toggles\fP first destroys all existing children +and then creates new ones. For each string in the \fIlabels\fP resource +there will be an XfwfToggle button. + +.nf +create_toggles($) +{ + Cardinal i; + StringArray s; + + for (i = 0; i < $num_children; i++) + XtDestroyWidget($children[i]); + + if ($labels == NULL) return; + + for (s = $labels, i = 0; s[i] != NULL; i++) { + (void) XtVaCreateManagedWidget + (s[i], xfwfToggleWidgetClass, $, XtNlabel, s[i], XtNshrinkToFit, + True, XtNborderWidth, 0, XtNframeWidth, 0, NULL); + } +} +.fi + +The converter from \fIString\fP to \fIStringArray\fP makes a copy of the +passed string and then replaces all occurences of the delimiter with +a nul byte. The \fIStringArray\fP a is filled with pointers to the parts +of the string. + +The delimiter character is the first character in the string. + +\fBdef\fP done(type, value) = +do { + if (to->addr != NULL) { + if (to->size < sizeof(type)) { + to->size = sizeof(type); + return False; + } + *(type*)(to->addr) = (value); + } else { + static type static_val; + static_val = (value); + to->addr = (XtPointer)static_val; + } + to->size = sizeof(type); + return True; + }while (0 ) + +.nf +Boolean cvtStringToStringArray(Display * display, XrmValuePtr args, Cardinal * num_args, XrmValuePtr from, XrmValuePtr to, XtPointer * converter_data) +{ + String t, s; + StringArray a = NULL; + Cardinal i; + char delim; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToStringArray", "wrongParameters", + "XtToolkitError", + "String to StringArray conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + delim = ((String) from->addr)[0]; + s = XtNewString((String) from->addr + 1); + i = 0; + while (s *s) { + t = strchr(s, delim); + if (t) *t = '\\0'; + a = (StringArray) XtRealloc((String) a, (i + 1) * sizeof(*a)); + a[i] = s; + i++; + s = t ? t + 1 : NULL; + } + a = (StringArray) XtRealloc((String) a, (i + 1) * sizeof(*a)); + a[i] = NULL; + done(StringArray, a); +} +.fi + +The function \fInewStringArray\fP makes a copy of a \fIStringArray\fP. It +allocates new space for the array itself and for the strings that it +contains. + +.nf +StringArray newStringArray(StringArray a) +{ + Cardinal n, i; + StringArray s; + + if (!a) return NULL; + for (s = a, n = 0; s[n]; n++) ; + s = (StringArray) XtMalloc((n + 1) * sizeof(*s)); + for (i = 0; i < n; i++) s[i] = XtNewString(a[i]); + s[n] = NULL; + return s; +} +.fi + +\fIfreeStringArray\fP deallocates the array and all strings it contains. + +.nf +freeStringArray(StringArray a) +{ + Cardinal i; + + if (!a) return; + for (i = 0; a[i]; i++) XtFree(a[i]); + XtFree((String) a); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/RadioGrpP.h b/vendor/x11iraf/obm/ObmW/RadioGrpP.h new file mode 100644 index 00000000..be994fa8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RadioGrpP.h @@ -0,0 +1,43 @@ +/* Generated by wbuild from "RadioGrp.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfRadioGroupP_H_ +#define _XfwfRadioGroupP_H_ +#include "GroupP.h" +#include "RadioGrp.h" +typedef struct { +/* methods */ +/* class variables */ +int dummy; +} XfwfRadioGroupClassPart; +typedef struct _XfwfRadioGroupClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfRowColClassPart xfwfRowCol_class; +XfwfGroupClassPart xfwfGroup_class; +XfwfRadioGroupClassPart xfwfRadioGroup_class; +} XfwfRadioGroupClassRec; + +typedef struct { +/* resources */ +StringArray labels; +/* private state */ +} XfwfRadioGroupPart; + +typedef struct _XfwfRadioGroupRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfRowColPart xfwfRowCol; +XfwfGroupPart xfwfGroup; +XfwfRadioGroupPart xfwfRadioGroup; +} XfwfRadioGroupRec; + +externalref XfwfRadioGroupClassRec xfwfRadioGroupClassRec; + +#endif /* _XfwfRadioGroupP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/RowCol.c b/vendor/x11iraf/obm/ObmW/RowCol.c new file mode 100644 index 00000000..c37fed43 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RowCol.c @@ -0,0 +1,346 @@ +/* Generated by wbuild from "RowCol.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "RowColP.h" +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void change_managed( +#if NeedFunctionPrototypes +Widget +#endif +); +static void layout( +#if NeedFunctionPrototypes +Widget,int +#endif +); +static XtGeometryResult geometry_manager( +#if NeedFunctionPrototypes +Widget ,XtWidgetGeometry *,XtWidgetGeometry * +#endif +); +static void resize( +#if NeedFunctionPrototypes +Widget +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static char rcsid[] = "$Header: RowCol.w,v 1.1 92/10/14 18:36:36 bert Exp $"; +static void align_child( +#if NeedFunctionPrototypes +Widget,int ,int ,int ,int ,Alignment +#endif +); +/*ARGSUSED*/static void align_child(self,cx,cy,width,height,alignment)Widget self;int cx;int cy;int width;int height;Alignment alignment; +{ + Position x, y; + + if (alignment & XfwfLeft) x = cx; + else if (alignment & XfwfRight) x = cx + width - ((XfwfRowColWidget)self)->core.width; + else x = cx + (width - ((XfwfRowColWidget)self)->core.width) / 2; + if (alignment & XfwfTop) y = cy; + else if (alignment & XfwfBottom) y = cy + height - ((XfwfRowColWidget)self)->core.height; + else y = cy + (height - ((XfwfRowColWidget)self)->core.height) / 2; + XtMoveWidget(self, x, y); +} + +static XtResource resources[] = { +{XtNstoreByRow,XtCStoreByRow,XtRBoolean,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.storeByRow),XtOffsetOf(XfwfRowColRec,xfwfRowCol.storeByRow),XtRImmediate,(XtPointer)True }, +{XtNrows,XtCRows,XtRInt,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.rows),XtOffsetOf(XfwfRowColRec,xfwfRowCol.rows),XtRImmediate,(XtPointer)0 }, +{XtNcolumns,XtCColumns,XtRInt,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.columns),XtOffsetOf(XfwfRowColRec,xfwfRowCol.columns),XtRImmediate,(XtPointer)0 }, +{XtNalignment,XtCAlignment,XtRAlignment,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.alignment),XtOffsetOf(XfwfRowColRec,xfwfRowCol.alignment),XtRImmediate,(XtPointer)XfwfTopLeft }, +{XtNshrinkToFit,XtCShrinkToFit,XtRBoolean,sizeof(((XfwfRowColRec*)NULL)->xfwfRowCol.shrinkToFit),XtOffsetOf(XfwfRowColRec,xfwfRowCol.shrinkToFit),XtRImmediate,(XtPointer)False }, +{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfRowColRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfRowColRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfSunken }, +{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfRowColRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfRowColRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 }, +}; + +XfwfRowColClassRec xfwfRowColClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfBoardClassRec, +"RowCol", +sizeof(XfwfRowColRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +NULL, +0, +resources, +7, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +resize, +XtInheritExpose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +geometry_manager, +change_managed, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfRowCol_class part */ +layout, +}, +}; +WidgetClass xfwfRowColWidgetClass = (WidgetClass) &xfwfRowColClassRec; +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfRowColWidgetClass c = (XfwfRowColWidgetClass) class; + XfwfRowColWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfRowColWidgetClass) return; + super = (XfwfRowColWidgetClass)class->core_class.superclass; + if (c->xfwfRowCol_class.layout == XtInherit_layout) + c->xfwfRowCol_class.layout = super->xfwfRowCol_class.layout; +} +/*ARGSUSED*/static void change_managed(self)Widget self; +{ + ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit); +} +/*ARGSUSED*/static void layout(self,shrink)Widget self;int shrink; +{ + int nrows, ncols, i, nchild, n; + Position left, top, x, y; + Dimension width, height, w, h; + Widget child; + + nchild = 0; + ((XfwfRowColWidget)self)->xfwfRowCol.max_width = 0; + ((XfwfRowColWidget)self)->xfwfRowCol.max_height = 0; + + for (i = 0; i < ((XfwfRowColWidget)self)->composite.num_children; i++) { + child = ((XfwfRowColWidget)self)->composite.children[i]; + if (! XtIsManaged(child)) continue; + nchild++; + ((XfwfRowColWidget)self)->xfwfRowCol.max_width = + max(((XfwfRowColWidget)self)->xfwfRowCol.max_width, + ((XfwfRowColWidget)child)->core.width + + 2*((XfwfRowColWidget)child)->core.border_width); + ((XfwfRowColWidget)self)->xfwfRowCol.max_height = + max(((XfwfRowColWidget)self)->xfwfRowCol.max_height, + ((XfwfRowColWidget)child)->core.height + + 2*((XfwfRowColWidget)child)->core.border_width); + } + + ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &left, &top, &width, &height); + + /* If there is a single child resize it to fill the window instead of + * laying out multiple child widgets. This allows a group widget to be + * used to draw a labeled frame around a composite child. 09Mar94 DCT. + */ + if (((XfwfRowColWidget)self)->composite.num_children == 1) { + if (width > 0 && width < 16384 && height > 0 && height < 16384) { + /* Don't resize child if parent doesn't have a size yet. + */ + child = ((XfwfRowColWidget)self)->composite.children[0]; + w = width - 2 * child->core.border_width; + h = height - 2 * child->core.border_width; + + XtResizeWidget (child, w, h, + ((XfwfRowColWidget)child)->core.border_width); + align_child (child, left, top, w, h, XfwfLeft|XfwfTop); + + ((XfwfRowColWidget)self)->xfwfRowCol.max_width = + child->core.width - 2 * child->core.border_width; + ((XfwfRowColWidget)self)->xfwfRowCol.max_height = + child->core.height - 2 * child->core.border_width; + + nrows = ncols = 1; + goto do_shrink; + } + } + + if (((XfwfRowColWidget)self)->xfwfRowCol.columns != 0) { + ncols = ((XfwfRowColWidget)self)->xfwfRowCol.columns; + nrows = (nchild + ncols - 1)/ncols; + } else if (((XfwfRowColWidget)self)->xfwfRowCol.rows != 0) { + nrows = ((XfwfRowColWidget)self)->xfwfRowCol.rows; + ncols = (nchild + nrows - 1)/nrows; + } else if (((XfwfRowColWidget)self)->composite.num_children == 1) { + /* 09Mar94 DCT */ + nrows = ncols = 1; + } else { + ncols = ((XfwfRowColWidget)self)->xfwfRowCol.max_width != 0 ? width/((XfwfRowColWidget)self)->xfwfRowCol.max_width : 1; + if (ncols == 0) ncols = 1; + nrows = (nchild + ncols - 1)/ncols; + } + + x = left; + y = top; + n = 0; + if (((XfwfRowColWidget)self)->xfwfRowCol.storeByRow) { + for (i = 0; i < ((XfwfRowColWidget)self)->composite.num_children; i++) { + child = ((XfwfRowColWidget)self)->composite.children[i]; + if (! XtIsManaged(child)) continue; + align_child(child, x, y, ((XfwfRowColWidget)self)->xfwfRowCol.max_width, ((XfwfRowColWidget)self)->xfwfRowCol.max_height, ((XfwfRowColWidget)self)->xfwfRowCol.alignment); + n++; + if (n == ncols) { + n = 0; + x = left; + y += ((XfwfRowColWidget)self)->xfwfRowCol.max_height; + } else + x += ((XfwfRowColWidget)self)->xfwfRowCol.max_width; + } + } else { + for (i = 0; i < ((XfwfRowColWidget)self)->composite.num_children; i++) { + child = ((XfwfRowColWidget)self)->composite.children[i]; + if (! XtIsManaged(child)) continue; + align_child(child, x, y, ((XfwfRowColWidget)self)->xfwfRowCol.max_width, ((XfwfRowColWidget)self)->xfwfRowCol.max_height, ((XfwfRowColWidget)self)->xfwfRowCol.alignment); + n++; + if (n == nrows) { + n = 0; + y = top; + x += ((XfwfRowColWidget)self)->xfwfRowCol.max_width; + } else + y += ((XfwfRowColWidget)self)->xfwfRowCol.max_height; + } + } + +do_shrink: + if (shrink) { + w = 2*left + ncols * ((XfwfRowColWidget)self)->xfwfRowCol.max_width; + h = 2*top + nrows * ((XfwfRowColWidget)self)->xfwfRowCol.max_height; + if (((XfwfRowColWidget)self)->xfwfRowCol.columns != 0) + XtVaSetValues(self, XtNwidth, w, XtNheight, h, NULL); + else + XtVaSetValues(self, XtNheight, h, NULL); + } +} + + +/*ARGSUSED*/static XtGeometryResult +geometry_manager (child,request,reply) +Widget child; +XtWidgetGeometry * request; +XtWidgetGeometry * reply; +{ + Widget self = XtParent(child); + Dimension newwd, newht, newbd; + + if (request->request_mode & (CWX | CWY)) + return XtGeometryNo; + if (request->request_mode & XtCWQueryOnly) + return XtGeometryYes; + + newwd = request->request_mode & CWWidth ? + request->width : ((XfwfRowColWidget)child)->core.width; + newht = request->request_mode & CWHeight ? + request->height : ((XfwfRowColWidget)child)->core.height; + newbd = request->request_mode & CWBorderWidth ? + request->border_width : ((XfwfRowColWidget)child)->core.border_width; + + if (newwd == ((XfwfRowColWidget)child)->core.width && + newht == ((XfwfRowColWidget)child)->core.height && + newbd == ((XfwfRowColWidget)child)->core.border_width) + return XtGeometryNo; + + XtResizeWidget(child, newwd, newht, newbd); + + ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout + (self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit); + + /* Since layout can resize the child widget it isn't appropriate to just + * return XtGeometryDone here, as the FWF code does. 17Mar94 DCT. + */ + if (newwd == ((XfwfRowColWidget)child)->core.width && + newht == ((XfwfRowColWidget)child)->core.height && + newbd == ((XfwfRowColWidget)child)->core.border_width) { + + return XtGeometryDone; + + } else { + reply->request_mode = 0; + if (newwd != child->core.width) { + reply->request_mode |= CWWidth; + reply->width = child->core.width; + } + if (newht != child->core.height) { + reply->request_mode |= CWHeight; + reply->height = child->core.height; + } + + return XtGeometryAlmost; + } +} + +/*ARGSUSED*/static void resize(self)Widget self; +{ + if (((XfwfRowColWidget)self)->xfwfRowCol.rows == 0 && ((XfwfRowColWidget)self)->xfwfRowCol.columns == 0) ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, False); +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + ((XfwfRowColWidget)self)->xfwfRowCol.max_width = ((XfwfRowColWidget)self)->xfwfRowCol.max_height = 0; +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_layout = False; + Boolean need_redisplay = False; + + if (((XfwfRowColWidget)old)->xfwfRowCol.storeByRow != ((XfwfRowColWidget)self)->xfwfRowCol.storeByRow) need_layout = True; + if (((XfwfRowColWidget)old)->xfwfRowCol.rows != ((XfwfRowColWidget)self)->xfwfRowCol.rows) need_layout = True; + if (((XfwfRowColWidget)old)->xfwfRowCol.columns != ((XfwfRowColWidget)self)->xfwfRowCol.columns) need_layout = True; + if (((XfwfRowColWidget)old)->xfwfRowCol.alignment != ((XfwfRowColWidget)self)->xfwfRowCol.alignment) need_layout = True; + if (((XfwfRowColWidget)old)->xfwfRowCol.shrinkToFit != ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit) need_layout = True; + if (need_layout) { + ((XfwfRowColWidgetClass)self->core.widget_class)->xfwfRowCol_class.layout(self, ((XfwfRowColWidget)self)->xfwfRowCol.shrinkToFit); + need_redisplay = True; + } + return need_redisplay; +} diff --git a/vendor/x11iraf/obm/ObmW/RowCol.h b/vendor/x11iraf/obm/ObmW/RowCol.h new file mode 100644 index 00000000..4542d7a7 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RowCol.h @@ -0,0 +1,60 @@ +/* Generated by wbuild from "RowCol.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfRowCol_H_ +#define _XfwfRowCol_H_ +#include "Board.h" +#ifndef XtNstoreByRow +#define XtNstoreByRow "storeByRow" +#endif +#ifndef XtCStoreByRow +#define XtCStoreByRow "StoreByRow" +#endif +#ifndef XtRBoolean +#define XtRBoolean "Boolean" +#endif + +#ifndef XtNrows +#define XtNrows "rows" +#endif +#ifndef XtCRows +#define XtCRows "Rows" +#endif +#ifndef XtRInt +#define XtRInt "Int" +#endif + +#ifndef XtNcolumns +#define XtNcolumns "columns" +#endif +#ifndef XtCColumns +#define XtCColumns "Columns" +#endif +#ifndef XtRInt +#define XtRInt "Int" +#endif + +#ifndef XtNalignment +#define XtNalignment "alignment" +#endif +#ifndef XtCAlignment +#define XtCAlignment "Alignment" +#endif +#ifndef XtRAlignment +#define XtRAlignment "Alignment" +#endif + +#ifndef XtNshrinkToFit +#define XtNshrinkToFit "shrinkToFit" +#endif +#ifndef XtCShrinkToFit +#define XtCShrinkToFit "ShrinkToFit" +#endif +#ifndef XtRBoolean +#define XtRBoolean "Boolean" +#endif + +typedef struct _XfwfRowColClassRec *XfwfRowColWidgetClass; +typedef struct _XfwfRowColRec *XfwfRowColWidget; +externalref WidgetClass xfwfRowColWidgetClass; +#endif /*_XfwfRowCol_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/RowCol.man b/vendor/x11iraf/obm/ObmW/RowCol.man new file mode 100644 index 00000000..1d719b38 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RowCol.man @@ -0,0 +1,482 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfRowCol +.SH DESCRIPTION +The RowCol widget forces all its children into rows and columns. The +children keep their preferred size, but the preferred position is +ignored. Resources determine how many rows or columns their should be +(or as many as will fit) and if the children should be layed out in +rows or in columns. In both methods, the children are placed on a +grid, the size of which is determined by the width (height) of the +widest (tallest) child. + +The children can be aligned in several ways: they can be placed in the +center of their grid cell or against the edges. This is controlled by +a resource of type \fIAlignment\fP. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfRowCol +Name Class Type Default +XtNstoreByRow XtCStoreByRow Boolean True +XtNrows XtCRows Int 0 +XtNcolumns XtCColumns Int 0 +XtNalignment XtCAlignment Alignment XfwfTopLeft +XtNshrinkToFit XtCShrinkToFit Boolean False + +.TE +.ps + +.TP +.I "XtNstoreByRow" +The child widgets can be layed out in rows (left to right) or in +columns (top to bottom). The resource \fIstoreByRow\fP can be \fITrue\fP or +\fIFalse\fP. \fITrue\fP means children are added to the right of the previous +one until the row is full, like words are added to a text. \fIFalse\fP +means children are added below the previous one, until the column is +full. + +.hi + +.nf +Boolean storeByRow = True +.fi + +.eh + +.TP +.I "XtNrows" +The number of rows can be set with \fIrows\fP, or the number of columns +can be set with \fIcolumns\fP. If both are non-zero, \fIrows\fP will be +ignored. If \fIrows\fP is zero, there will be as many rows as needed. If +\fIcolumns\fP is zero, there will be as many columns as needed. However, +if both are zero, there will be as many columns as will fit in the +current width of the RowCol widget. By default, both \fIrows\fP and +\fIcolumns\fP are zero. + +.hi + +.nf +int rows = 0 +.fi + +.eh + +.TP +.I "XtNcolumns" + +.hi + +.nf +int columns = 0 +.fi + +.eh + +.TP +.I "XtNalignment" +The area of the RowCol widget is partitioned into rectangular cells +(a grid). The cells are just large enough to contain the widest and +the tallest of the children. Within the cell, the children can be put +in the top left corner (the default) or against one of the edges or in +the center. This is set with the \fIalignment\fP resource. The type +\fIAlignment\fP is defined in the ancestor class `Common'. + +.hi + +.nf +Alignment alignment = XfwfTopLeft +.fi + +.eh + +.TP +.I "XtNshrinkToFit" +The resource \fIshrinkToFit\fP determines how the size of the RowCol +widget itself is computed. When it is \fIFalse\fP (default), the +\fIlocation\fP resource is used to compute the widget's preferred size. +When the value is \fITrue\fP, the preferred size is computed fromthe total +width and height of the children. For example, when the widest child +has a width of \fIw\fP and \fIcolumns > 0\fP, the preferred width will be +\fIcolumns * w +\fP frame width. A similar computation is used for the +height. If \fIcolumns > 0\fP, only the height is computed this way. If +\fIcolumns = 0, rows > 0\fP, only the width is computed. + +.hi + +.nf +Boolean shrinkToFit = False +.fi + +.eh + +.TP +.I "XtNframeType" +The inherited resource \fIframeType\fP is given a default value of +\fIXfwfSunken\fP, instead of the inherited default \fIXfwfRaised\fP. The frame +width is set to a default of 2 pixels, instead of 0. + +.hi + +.nf + frameType = XfwfSunken +.fi + +.eh + +.TP +.I "XtNframeWidth" + +.hi + +.nf + frameWidth = 2 +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.hi +.SS "Private variables" + +The width of the widest and the height of the tallest child are kept +in private variables, for quicker access. + +.nf +Dimension max_width +.fi + +.nf +Dimension max_height +.fi + +.hi + +.hi +.SS "Methods" + +If a child becomes managed or unmanaged, the RowCol widget +recomputes the positions of all managed children. That is done by a +method \fIlayout\fP. In the process, the widget may ask its parent for a +different size if \fIshrinkToFit = True\fP. + +.nf +change_managed($) +{ + $layout($, $shrinkToFit); +} +.fi + +The \fIlayout\fP function is responsible for moving the children to their +positions in the grid. It is called from \fIchange_managed\fP, +\fIgeometry_manager\fP and \fIresize\fP. + +The function first computes the maximum width and height of all the +children, including their borders. Then it computes the number of rows +and columns. All children are moved to their proper positions with the +help of a utility function \fIalign_child\fP, which aligns a child widget +to the grid. + +If \fIshrink = True\fP, the RowCol widget also asks its parent for a new +width and/or height, depending on the resulting layout. + +.nf +layout($, int shrink) +{ + int nrows, ncols, i, nchild, n; + Position left, top, x, y; + Dimension width, height, w, h; + Widget child; + + nchild = 0; + $max_width = 0; + $max_height = 0; + for (i = 0; i < $num_children; i++) { + child = $children[i]; + if (! XtIsManaged(child)) continue; + nchild++; + $max_width = max($max_width, $child$width + 2*$child$border_width); + $max_height = max($max_height, $child$height + 2*$child$border_width); + + } + + $compute_inside($, left, top, width, height); + + if ($columns != 0) { + ncols = $columns; + nrows = (nchild + ncols - 1)/ncols; + } else if ($rows != 0) { + nrows = $rows; + ncols = (nchild + nrows - 1)/nrows; + } else { + ncols = $max_width != 0 ? width/$max_width : 1; + if (ncols == 0) ncols = 1; + nrows = (nchild + ncols - 1)/ncols; + } + + x = left; + y = top; + n = 0; + if ($storeByRow) { + for (i = 0; i < $num_children; i++) { + child = $children[i]; + if (! XtIsManaged(child)) continue; + align_child(child, x, y, $max_width, $max_height, $alignment); + n++; + if (n == ncols) { + n = 0; + x = left; + y += $max_height; + } else + x += $max_width; + } + } else { + for (i = 0; i < $num_children; i++) { + child = $children[i]; + if (! XtIsManaged(child)) continue; + align_child(child, x, y, $max_width, $max_height, $alignment); + n++; + if (n == nrows) { + n = 0; + y = top; + x += $max_width; + } else + y += $max_height; + } + } + + if (shrink) { + w = 2*left + ncols * $max_width; + h = 2*top + nrows * $max_height; + if ($columns != 0) + XtVaSetValues($, XtNwidth, w, XtNheight, h, NULL); + else + XtVaSetValues($, XtNheight, h, NULL); + } +} +.fi + +When a child wants to change its size or border width, it calls its +parent's \fIgeometry_manager\fP method (through a call to +\fIXtMakeGeometryRequest\fP or \fIXtMakeResizeRequest\fP.) The RowCol widget +always grants size changes to its children. The size change is carried +out immediately and a new layout is computed. If a child requests a +change of position, the request is denied. A request for a change in +stacking order is ignored. + +.nf +XtGeometryResult geometry_manager(Widget child, XtWidgetGeometry * request, XtWidgetGeometry * reply) +{ + Dimension newwd, newht, newbd; + + if (request->request_mode (CWX | CWY)) return XtGeometryNo; + if (request->request_mode XtCWQueryOnly) return XtGeometryYes; + + newwd = request->request_mode CWWidth ? request->width : $child$width; + newht = request->request_mode CWHeight ? request->height : $child$height; + newbd = request->request_mode CWBorderWidth + ? request->border_width : $child$border_width; + + if (newwd == $child$width newht == $child$height + newbd == $child$border_width) return XtGeometryNo; + + XtResizeWidget(child, newwd, newht, newbd); + $layout($, $shrinkToFit); + return XtGeometryDone; +} +.fi + +The \fIresize\fP method is called when the widget is resized. If the +\fIrows\fP and \fIcolumns\fP resources are both zero, the children will have +to be be re-aligned. In this case, there is no sense in asking the +parent for a new size, so \fIlayout\fP is passed a value of \fIFalse\fP. + +.nf +resize($) +{ + if ($rows == 0 $columns == 0) $layout($, False); +} +.fi + +The initialize method sets the private variables, in this case only +\fImax_width\fP and \fImax_height\fP. There is no need to check if the resources +have sensible values. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + $max_width = $max_height = 0; +} +.fi + +The RowCol widget needs to recompute the positions of the children +when one of the resources changes. When the layout changes, the widget +also needs to be redrawn, of course. The private variables are not +dependent on the resources, so they don't need recomputing. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_layout = False; + Boolean need_redisplay = False; + + if ($old$storeByRow != $storeByRow) need_layout = True; + if ($old$rows != $rows) need_layout = True; + if ($old$columns != $columns) need_layout = True; + if ($old$alignment != $alignment) need_layout = True; + if ($old$shrinkToFit != $shrinkToFit) need_layout = True; + if (need_layout) { + $layout($, $shrinkToFit); + need_redisplay = True; + } + return need_redisplay; +} +.fi + +.hi + +.hi +.SH "Utilities" + +.nf +char rcsid[] = "$Header: RowCol.w,v 1.1 92/10/14 18:36:36 bert Exp $" +.fi + +\fIalign_child\fP puts a widget in the proper position in the cell given by +\fIcx\fP, \fIcy\fP, \fIwidth\fP and \fIheight\fP. + +.nf +align_child($, int cx, int cy, int width, int height, Alignment alignment) +{ + Position x, y; + + if (alignment XfwfLeft) x = cx; + else if (alignment XfwfRight) x = cx + width - $width; + else x = cx + (width - $width) / 2; + if (alignment XfwfTop) y = cy; + else if (alignment XfwfBottom) y = cy + height - $height; + else y = cy + (height - $height) / 2; + XtMoveWidget($, x, y); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/RowColP.h b/vendor/x11iraf/obm/ObmW/RowColP.h new file mode 100644 index 00000000..2ddd950d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/RowColP.h @@ -0,0 +1,51 @@ +/* Generated by wbuild from "RowCol.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfRowColP_H_ +#define _XfwfRowColP_H_ +#include "BoardP.h" +#include "RowCol.h" +typedef void (*layout_Proc)( +#if NeedFunctionPrototypes +Widget,int +#endif +); +#define XtInherit_layout ((layout_Proc) _XtInherit) +typedef struct { +/* methods */ +layout_Proc layout; +/* class variables */ +} XfwfRowColClassPart; +typedef struct _XfwfRowColClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfRowColClassPart xfwfRowCol_class; +} XfwfRowColClassRec; + +typedef struct { +/* resources */ +Boolean storeByRow; +int rows; +int columns; +Alignment alignment; +Boolean shrinkToFit; +/* private state */ +Dimension max_width; +Dimension max_height; +} XfwfRowColPart; + +typedef struct _XfwfRowColRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfRowColPart xfwfRowCol; +} XfwfRowColRec; + +externalref XfwfRowColClassRec xfwfRowColClassRec; + +#endif /* _XfwfRowColP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Scrollbar.c b/vendor/x11iraf/obm/ObmW/Scrollbar.c new file mode 100644 index 00000000..bec84d33 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Scrollbar.c @@ -0,0 +1,427 @@ +/* Generated by wbuild from "Scrollbar.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Arrow.h" +#include "Slider2.h" +#include <stdio.h> +#include "ScrollbarP.h" +static void Scroll( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"Scroll", Scroll}, +}; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void resize( +#if NeedFunctionPrototypes +Widget +#endif +); +static void insert_child( +#if NeedFunctionPrototypes +Widget +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void scroll_response( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static char rcsid[] = "$Header: Scrollbar.w,v 1.1 92/11/02 14:08:00 bert Exp $"; +static void up( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static void down( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static void thumbscroll( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static void copy_background( +#if NeedFunctionPrototypes +Widget,int ,XrmValue * +#endif +); +/*ARGSUSED*/static void up(arrow,client_data,call_data)Widget arrow;XtPointer client_data;XtPointer call_data; +{ + Widget self = (Widget) client_data; + XfwfScrollInfo info; + + XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info); + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) { + info.reason = XfwfSUp; + info.flags = XFWF_VPOS; + info.vpos = max(0.0, info.vpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + } else { + info.reason = XfwfSLeft; + info.flags = XFWF_HPOS; + info.hpos = max(0.0, info.hpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + } + XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, &info); +} +/*ARGSUSED*/static void down(arrow,client_data,call_data)Widget arrow;XtPointer client_data;XtPointer call_data; +{ + Widget self = (Widget) client_data; + XfwfScrollInfo info; + + XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info); + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) { + info.reason = XfwfSDown; + info.flags = XFWF_VPOS; + info.vpos = min(1.0, info.vpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + } else { + info.reason = XfwfSRight; + info.flags = XFWF_HPOS; + info.hpos = min(1.0, info.hpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + } + XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, &info); +} +/*ARGSUSED*/static void thumbscroll(w,client_data,call_data)Widget w;XtPointer client_data;XtPointer call_data; +{ + Widget self = (Widget) client_data; + XfwfScrollInfo *info = (XfwfScrollInfo*) call_data; + + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) + info->flags &= XFWF_VPOS; + else + info->flags &= XFWF_HPOS; + XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, info); +} +/*ARGSUSED*/static void copy_background(self,offset,value)Widget self;int offset;XrmValue * value; +{ + value->addr = (XtPointer) &((XfwfScrollbarWidget)self)->core.background_pixel; +} + +static XtResource resources[] = { +{XtNvertical,XtCVertical,XtRBoolean,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.vertical),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.vertical),XtRImmediate,(XtPointer)True }, +{XtNscrollCallback,XtCScrollCallback,XtRCallback,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.scrollCallback),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.scrollCallback),XtRImmediate,(XtPointer)NULL }, +{XtNscrollResponse,XtCScrollResponse,XtRXTCallbackProc,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.scrollResponse),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.scrollResponse),XtRImmediate,(XtPointer)scroll_response }, +{XtNinitialDelay,XtCInitialDelay,XtRCardinal,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.initialDelay),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.initialDelay),XtRImmediate,(XtPointer)500 }, +{XtNrepeatDelay,XtCRepeatDelay,XtRCardinal,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.repeatDelay),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.repeatDelay),XtRImmediate,(XtPointer)50 }, +{XtNincrement,XtCIncrement,XtRFloat,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.increment),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.increment),XtRString,(XtPointer)"0.05"}, +{XtNscrollbarForeground,XtCScrollbarForeground,XtRPixel,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.scrollbarForeground),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.scrollbarForeground),XtRCallProc,(XtPointer)copy_background }, +{XtNshadow,XtCShadow,XtRDimension,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.shadow),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.shadow),XtRImmediate,(XtPointer)2 }, +{XtNminsize,XtCMinsize,XtRDimension,sizeof(((XfwfScrollbarRec*)NULL)->xfwfScrollbar.minsize),XtOffsetOf(XfwfScrollbarRec,xfwfScrollbar.minsize),XtRImmediate,(XtPointer)20 }, +{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfScrollbarRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfScrollbarRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 }, +{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfScrollbarRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfScrollbarRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfSunken }, +}; + +XfwfScrollbarClassRec xfwfScrollbarClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfBoardClassRec, +"Scrollbar2", +sizeof(XfwfScrollbarRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +1, +resources, +11, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +resize, +XtInheritExpose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +NULL, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +insert_child, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfScrollbar_class part */ +scroll_response, +}, +}; +WidgetClass xfwfScrollbarWidgetClass = (WidgetClass) &xfwfScrollbarClassRec; +/*ARGSUSED*/ +static void Scroll(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XfwfScrollInfo info; + + XfwfGetThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, &info); + info.reason = XfwfCvtStringToScrollReason(params[0]); + switch (info.reason) { + case XfwfSUp: + info.flags = XFWF_VPOS; + info.vpos = max(0.0, info.vpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + break; + case XfwfSDown: + info.flags = XFWF_VPOS; + info.vpos = min(1.0, info.vpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + break; + case XfwfSLeft: + info.flags = XFWF_HPOS; + info.hpos = max(0.0, info.hpos - ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + break; + case XfwfSRight: + info.flags = XFWF_HPOS; + info.hpos = min(1.0, info.hpos + ((XfwfScrollbarWidget)self)->xfwfScrollbar.increment); + break; + case XfwfSPageUp: + info.flags = XFWF_VPOS; + info.vpos = max(0.0, info.vpos - info.vsize); + break; + case XfwfSPageDown: + info.flags = XFWF_VPOS; + info.vpos = min(1.0, info.vpos + info.vsize); + break; + case XfwfSPageLeft: + info.flags = XFWF_HPOS; + info.hpos = max(0.0, info.hpos - info.hsize); + break; + case XfwfSPageRight: + info.flags = XFWF_HPOS; + info.hpos = min(1.0, info.hpos + info.hsize); + break; + case XfwfSTop: + info.flags = XFWF_VPOS; + info.vpos = 0.0; + break; + case XfwfSBottom: + info.flags = XFWF_VPOS; + info.vpos = 1.0; + break; + case XfwfSLeftSide: + info.flags = XFWF_HPOS; + info.hpos = 0.0; + break; + case XfwfSRightSide: + info.flags = XFWF_HPOS; + info.hpos = 1.0; + break; + default: break; /* Not understood */ + } + XtCallCallbackList(self, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollCallback, &info); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfScrollbarWidgetClass c = (XfwfScrollbarWidgetClass) class; + XfwfScrollbarWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfScrollbarWidgetClass) return; + super = (XfwfScrollbarWidgetClass)class->core_class.superclass; + if (c->xfwfScrollbar_class.scroll_response == XtInherit_scroll_response) + c->xfwfScrollbar_class.scroll_response = super->xfwfScrollbar_class.scroll_response; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Position x, y, xa2, xslider, ya2, yslider; + Dimension w, h, wa, ha, wslider, hslider; + + ((XfwfScrollbarWidget)self)->xfwfScrollbar.initializing = True; + ((XfwfScrollbarWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) { + ha = wa = wslider = w; + xa2 = xslider = x; + hslider = (h - 2*ha > 0) ? h - 2*ha : 10; + yslider = y + ha; + ya2 = yslider + hslider; + } else { + wa = ha = hslider = h; + ya2 = yslider = y; + wslider = (w - 2*wa > 0) ? w - 2*wa : 10; + xslider = x + wa; + xa2 = xslider + wslider; + } + ((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1 = XtVaCreateManagedWidget + ("_arrow1", xfwfArrowWidgetClass, self, + XtNx, x, + XtNy, y, + XtNwidth, wa, + XtNheight, ha, + XtNframeWidth, 0, + XtNforeground, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, + XtNinitialDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.initialDelay, + XtNrepeatDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.repeatDelay, + XtNtraversalOn, False, + XtNhighlightThickness, 0, + XtNdirection, ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical?XfwfTop:XfwfLeft, + XtNouterOffset, 0, + XtNborderWidth, 0, + NULL); + XtAddCallback(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNcallback, up, self); + ((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2 = XtVaCreateManagedWidget + ("_arrow2", xfwfArrowWidgetClass, self, + XtNx, xa2, + XtNy, ya2, + XtNwidth, wa, + XtNheight, ha, + XtNframeWidth, 0, + XtNforeground, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, + XtNinitialDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.initialDelay, + XtNrepeatDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.repeatDelay, + XtNtraversalOn, False, + XtNhighlightThickness, 0, + XtNdirection, ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical?XfwfBottom:XfwfRight, + XtNouterOffset, 0, + XtNborderWidth, 0, + NULL); + XtAddCallback(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNcallback, down, self); + ((XfwfScrollbarWidget)self)->xfwfScrollbar.slider = XtVaCreateManagedWidget + ("_slider", xfwfSlider2WidgetClass, self, + XtNx, xslider, + XtNy, yslider, + XtNwidth, wslider, + XtNheight, hslider, + XtNthumbColor, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, + XtNframeWidth, 0, + XtNinitialDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.initialDelay, + XtNrepeatDelay, ((XfwfScrollbarWidget)self)->xfwfScrollbar.repeatDelay, + XtNtraversalOn, False, + XtNhighlightThickness, 0, + XtNouterOffset, 0, + XtNborderWidth, 0, + NULL); + XtAddCallback(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNscrollCallback, thumbscroll, self); + XtVaGetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNscrollResponse, &((XfwfScrollbarWidget)self)->xfwfScrollbar.slider_scroll, NULL); + ((XfwfScrollbarWidget)self)->xfwfScrollbar.initializing = False; +} +/*ARGSUSED*/static void resize(self)Widget self; +{ + Position x, y, xa2, xslider, ya2, yslider; + Dimension w, h, wa, ha, wslider, hslider; + + ((XfwfScrollbarWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) { + wa = wslider = w; + xa2 = xslider = x; + ha = 2 * (wa + 1)/3; + hslider = (h - 2*ha > 0) ? h - 2*ha : 10; + yslider = y + ha; + ya2 = yslider + hslider; + } else { + ha = hslider = h; + ya2 = yslider = y; + wa = 2 * (ha + 1)/3; + wslider = (w - 2*wa > 0) ? w - 2*wa : 10; + xslider = x + wa; + xa2 = xslider + wslider; + } + XtConfigureWidget(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, x, y, wa, ha, 0); + XtConfigureWidget(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, xa2, ya2, wa, ha, 0); + XtConfigureWidget(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, xslider, yslider, wslider, hslider, 0); +} +/*ARGSUSED*/static void insert_child(child)Widget child; +{ Widget self = XtParent(child); { + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.initializing) + xfwfBoardClassRec.composite_class.insert_child(child); + else { + char s[500]; + (void)sprintf(s, "Cannot add children to a scrollbar (\"%s\"->\"%s\")", + XtName(child), XtName(self)); + XtWarning(s); + } +} +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + if (((XfwfScrollbarWidget)old)->xfwfScrollbar.vertical != ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) { + XtWarning("Cannot change the \"vertical\" resource of a scrollbar\n"); + ((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical = ((XfwfScrollbarWidget)old)->xfwfScrollbar.vertical; + } + if (((XfwfScrollbarWidget)old)->xfwfScrollbar.scrollbarForeground != ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground) { + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNthumbColor, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, NULL); + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNforeground, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, NULL); + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNforeground, ((XfwfScrollbarWidget)self)->xfwfScrollbar.scrollbarForeground, NULL); + } + if (((XfwfScrollbarWidget)old)->xfwfScrollbar.shadow != ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow) { + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNthumbFrameWidth, ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow, NULL); + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow1, XtNarrowShadow, ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow, NULL); + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.arrow2, XtNarrowShadow, ((XfwfScrollbarWidget)self)->xfwfScrollbar.shadow, NULL); + } + if (((XfwfScrollbarWidget)old)->xfwfScrollbar.minsize != ((XfwfScrollbarWidget)self)->xfwfScrollbar.minsize) { + XtVaSetValues(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, XtNminsize, ((XfwfScrollbarWidget)self)->xfwfScrollbar.minsize, NULL); + } + return False; +} +/*ARGSUSED*/static void scroll_response(wdg,client_data,call_data)Widget wdg;XtPointer client_data;XtPointer call_data; +{ + Widget self = (Widget) client_data; + + ((XfwfScrollbarWidget)self)->xfwfScrollbar.slider_scroll(wdg, ((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, call_data); +} +/*ARGSUSED*/void XfwfSetScrollbar(self,pos,size)Widget self;double pos;double size; +{ + if (! XtIsSubclass(self, xfwfScrollbarWidgetClass)) + XtError("XfwfSetScrollbar called with incorrect widget type"); + if (pos < 0.0 || pos > 1.0 || size < 0.0 || size > 1.0) + XtError("XfwfSetScrollbar called with incorrect arguments"); + if (((XfwfScrollbarWidget)self)->xfwfScrollbar.vertical) { + XfwfResizeThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, 1.0, size); + XfwfMoveThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, 0.0, pos); + } else { + XfwfResizeThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, size, 1.0); + XfwfMoveThumb(((XfwfScrollbarWidget)self)->xfwfScrollbar.slider, pos, 0.0); + } +} diff --git a/vendor/x11iraf/obm/ObmW/Scrollbar.h b/vendor/x11iraf/obm/ObmW/Scrollbar.h new file mode 100644 index 00000000..9c5c62e8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Scrollbar.h @@ -0,0 +1,105 @@ +/* Generated by wbuild from "Scrollbar.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfScrollbar_H_ +#define _XfwfScrollbar_H_ +#include "Board.h" +void XfwfSetScrollbar( +#if NeedFunctionPrototypes +Widget,double ,double +#endif +); +#ifndef XtNvertical +#define XtNvertical "vertical" +#endif +#ifndef XtCVertical +#define XtCVertical "Vertical" +#endif +#ifndef XtRBoolean +#define XtRBoolean "Boolean" +#endif + +#ifndef XtNscrollCallback +#define XtNscrollCallback "scrollCallback" +#endif +#ifndef XtCScrollCallback +#define XtCScrollCallback "ScrollCallback" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +#ifndef XtNscrollResponse +#define XtNscrollResponse "scrollResponse" +#endif +#ifndef XtCScrollResponse +#define XtCScrollResponse "ScrollResponse" +#endif +#ifndef XtRXTCallbackProc +#define XtRXTCallbackProc "XTCallbackProc" +#endif + +#ifndef XtNinitialDelay +#define XtNinitialDelay "initialDelay" +#endif +#ifndef XtCInitialDelay +#define XtCInitialDelay "InitialDelay" +#endif +#ifndef XtRCardinal +#define XtRCardinal "Cardinal" +#endif + +#ifndef XtNrepeatDelay +#define XtNrepeatDelay "repeatDelay" +#endif +#ifndef XtCRepeatDelay +#define XtCRepeatDelay "RepeatDelay" +#endif +#ifndef XtRCardinal +#define XtRCardinal "Cardinal" +#endif + +#ifndef XtNincrement +#define XtNincrement "increment" +#endif +#ifndef XtCIncrement +#define XtCIncrement "Increment" +#endif +#ifndef XtRFloat +#define XtRFloat "Float" +#endif + +#ifndef XtNscrollbarForeground +#define XtNscrollbarForeground "scrollbarForeground" +#endif +#ifndef XtCScrollbarForeground +#define XtCScrollbarForeground "ScrollbarForeground" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNshadow +#define XtNshadow "shadow" +#endif +#ifndef XtCShadow +#define XtCShadow "Shadow" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNminsize +#define XtNminsize "minsize" +#endif +#ifndef XtCMinsize +#define XtCMinsize "Minsize" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +typedef struct _XfwfScrollbarClassRec *XfwfScrollbarWidgetClass; +typedef struct _XfwfScrollbarRec *XfwfScrollbarWidget; +externalref WidgetClass xfwfScrollbarWidgetClass; +#endif /*_XfwfScrollbar_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Scrollbar.man b/vendor/x11iraf/obm/ObmW/Scrollbar.man new file mode 100644 index 00000000..46c2b29f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Scrollbar.man @@ -0,0 +1,812 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfScrollbar +.SH DESCRIPTION +The scrollbar widget helps the user to view data that is too large +to be displayed all at once. They are often used through a +ScrolledWindow (see there), where they are put next to and/or below +the widget that contains the data. The scrollbar controls which part +is visible. By manipulating the scrollbar the user can move (`scroll') +the data within the other widget. + +A scrollbar consists of two arrows placed at each end of a rectangle, +either at the top and bottom or at the left and right. The former is +called a vertical scrollbar, the latter a horizontal one. A smaller +rectangle, called the thumb or slider, is placed within the larger +one. It can move up and down (vertical scrollbar) or left/right +(horizontal scrollbar). Clicking an arrow moves the data in that +direction. Pressing the mouse button on an arrow and holding it, moves +the data by small increments as long as the mouse button is down. +Dragging the slider moves the data proportionally with the slider, +either along with the movement of the mouse, or all at once when the +mouse button is released. Pressing the mouse button onthe rectangle +outside the slider moves the data in larger increments. + +The ratio of the slider size to the scroll region size typically +corresponds to the relationship between the size of the visible data +and the total size of the data. For example, if 10 percent of the +data is visible, the slider typically occupies 10 percent of the +scroll region. This provides the user with a visual clue to the size +of the invisible data. + +The scrollbar widget can be configured as either horizontal or +vertical. It is made up of two XfwfArrow widgets and an XfwfSlider2 +widget. Therefore, many of the scrollbar's resources are actually +resources for these, nameless, widgets. The scrollbar has the +same callback list as the slider. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfScrollbar +Name Class Type Default +XtNvertical XtCVertical Boolean True +XtNscrollCallback XtCScrollCallback Callback NULL +XtNscrollResponse XtCScrollResponse XTCallbackProc scroll_response +XtNinitialDelay XtCInitialDelay Cardinal 500 +XtNrepeatDelay XtCRepeatDelay Cardinal 50 +XtNincrement XtCIncrement Float "0.05" +XtNscrollbarForeground XtCScrollbarForeground Pixel copy_background +XtNshadow XtCShadow Dimension 2 +XtNminsize XtCMinsize Dimension 20 + +.TE +.ps + +.TP +.I "XtNvertical" +The orientation of the scrollbar is set with the \fIvertical\fP +resource. \fITrue\fP means vertical, \fIFalse\fP horizontal. This resource may +only be set during initialization. Any changes via \fIXtVaSetValues\fP +result in a warning and are then ignored. + + + +.hi + +.nf +Boolean vertical = True +.fi + +.eh + +.TP +.I "XtNscrollCallback" +The user can interact with the scrollbar in many ways, but there is +only a single callback list: \fIscrollCallback\fP. The callback uses the +\fIcall_data\fP parameter to pass a pointer to an \fIXfwfScrollInfo\fP +structure: \fIstruct {XfwfSReason reason; XfwfSFlags flags; float vpos, +vsize, hpos, hsize;}\fP The \fIflags\fP field is a bitwise combination of +\fIXFWF_VPOS\fP, \fIXFWF_HPOS\fP, \fIXFWF_VSIZE\fP and \fIXFWF_HSIZE\fP. The +structure contains a field \fIreason\fP, which can have the following +values (there exist other values, but they are not used by the +scrollbar): + +\item{-} \fIXfwfSUp\fP: if the user clicked (or holds) the up arrow. +\item{-} \fIXfwfSLeft\fP: ditto left arrow. +\item{-} \fIXfwfSDown\fP: ditto down arrow. +\item{-} \fIXfwfSRight\fP: ditto right arrow. +\item{-} \fIXfwfSPageUp\fP: ditto area above thumb. +\item{-} \fIXfwfSPageDown\fP: ditto area below thumb. +\item{-} \fIXfwfSPageLeft\fP: ditto area left of thumb. +\item{-} \fIXfwfSPageRight\fP: ditto area right of thumb. +\item{-} \fIXfwfSDrag\fP: if the user drags the thumb. +\item{-} \fIXfwfSMove\fP: if the user stops dragging the thumb. + +The other four fields contain the new position of the thumb, as +numbers between 0.0 and 1.0 inclusive. In the case of drag and drop +actions, the position and size reflect the thumb's {\em actual} +position at the end of the dragging. In the other cases, the position +is the {\em suggested} new position. In these latter cases, the +callback routine should compute the new position and use a call to the +function in the \fIScrollResponse\fP resource (or, more conveniently, to +\fIXfwfSetScrollbar\fP) to update the scrollbar. + + + +.hi + +.nf +<Callback> XtCallbackList scrollCallback = NULL +.fi + +.eh + +.TP +.I "XtNscrollResponse" +The standard way to update the scrollbar is with a call to the +function that is knwon as the \fIscrollResponse\fP function. To get a +pointer to that function, you should use \fIXtGetValues\fP or +\fIXtVaGetValues\fP on the \fIXtNscrollResponse\fP resource. But from an +application it might be easier to use the \fIXfwfSetScrollbar\fP +convenience function instead. + +The \fIscrollResponse\fP routine has the same format as a callback +procedure. The first argument is a widget, this argument is ignored. +The second argument is \fIXtPointer client_data\fP, it must point to the +scrollbar that is to be updated. The third argument is \fIXtPointer +call_data\fP, it must be a pointer to an \fIXfwfScrollInfo\fP structure (see +above). + + + +.hi + +.nf +XtCallbackProc scrollResponse = scroll_response +.fi + +.eh + +.TP +.I "XtNinitialDelay" +When the user presses and then holds the mouse button on an arrow or +on an area outside the thumb, the scrollbar waits some milliseconds +before it starts repeating the callbacks. + + + +.hi + +.nf +Cardinal initialDelay = 500 +.fi + +.eh + +.TP +.I "XtNrepeatDelay" +Between repeated calls to the callback routines, the scrollbar will +wait a few milliseconds. + + + +.hi + +.nf +Cardinal repeatDelay = 50 +.fi + +.eh + +.TP +.I "XtNincrement" +Some widgets may be simple enough that they can scroll a fixed +amount whenever the user clicks on one of the arrow buttons. If that +is the case, they can let the scrollbar compute the new position. It +will be passed in the \fIXfwfScrollInfo\fP structure as the suggested new +position. Any receiver is free to ignore the suggestion, however. The +default is to add or subtract 0.05. + + + +.hi + +.nf +float increment = <String>"0.05" +.fi + +.eh + +.TP +.I "XtNscrollbarForeground" +The color of the arrow and the thumb also determines the color of +the 3D shadow, at least if \fIshadowScheme\fP is set to \fIXfwfAuto\fP, as it +is by default. The default value is determined dynamically, it is +copied from the \fIbackground\fP resource. + + + +.hi + +.nf +Pixel scrollbarForeground = <CallProc>copy_background +.fi + +.eh + +.TP +.I "XtNshadow" +The width of the arrow's and thumb's shadow is by default 2 pixels. + + + +.hi + +.nf +Dimension shadow = 2 +.fi + +.eh + +.TP +.I "XtNminsize" +The minimum size of the thumb is by default 20 pixels. It can be set +with the \fIminsize\fP resource. + + + +.hi + +.nf +Dimension minsize = 20 +.fi + +.eh + +.TP +.I "XtNframeWidth" +The slider and the two arrows frame will be forced to 0 pixels. The +only frame is that of the whole scrollbar. The default frame width is +changed from 0 to 2. + + + +.hi + +.nf + frameWidth = 2 +.fi + +.eh + +.TP +.I "XtNframeType" +The default frame type is now \fIXfwfSunken\fP. + + + +.hi + +.nf + frameType = XfwfSunken +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The \fIXfwfSetScrollbar\fP convenience function can be used to set the +position and size of a scrollbar. The two arguments must be between +0.0 and 1.0 (inclusive). + +.nf +XfwfSetScrollbar( $, double pos, double size) +.fi + +.hi +{ + if (! XtIsSubclass($, xfwfScrollbarWidgetClass)) + XtError("XfwfSetScrollbar called with incorrect widget type"); + if (pos < 0.0 || pos > 1.0 || size < 0.0 || size > 1.0) + XtError("XfwfSetScrollbar called with incorrect arguments"); + if ($vertical) { + XfwfResizeThumb($slider, 1.0, size); + XfwfMoveThumb($slider, 0.0, pos); + } else { + XfwfResizeThumb($slider, size, 1.0); + XfwfMoveThumb($slider, pos, 0.0); + } +} +.eh + +.hi +.SS "Actions" + +.TP +.I "Scroll + +The following action is not used by default, but it is defined here, +because someone might want to bind it to keys. For example, the +subclasses \fIXfwfVScrollbar\fP and \fIXfwfHScrollbar\fP do that. + +.hi + +.nf +void Scroll($, XEvent* event, String* params, Cardinal* num_params) +{ + XfwfScrollInfo info; + + XfwfGetThumb($slider, info); + info.reason = XfwfCvtStringToScrollReason(params[0]); + switch (info.reason) { + case XfwfSUp: + info.flags = XFWF_VPOS; + info.vpos = max(0.0, info.vpos - $increment); + break; + case XfwfSDown: + info.flags = XFWF_VPOS; + info.vpos = min(1.0, info.vpos + $increment); + break; + case XfwfSLeft: + info.flags = XFWF_HPOS; + info.hpos = max(0.0, info.hpos - $increment); + break; + case XfwfSRight: + info.flags = XFWF_HPOS; + info.hpos = min(1.0, info.hpos + $increment); + break; + case XfwfSPageUp: + info.flags = XFWF_VPOS; + info.vpos = max(0.0, info.vpos - info.vsize); + break; + case XfwfSPageDown: + info.flags = XFWF_VPOS; + info.vpos = min(1.0, info.vpos + info.vsize); + break; + case XfwfSPageLeft: + info.flags = XFWF_HPOS; + info.hpos = max(0.0, info.hpos - info.hsize); + break; + case XfwfSPageRight: + info.flags = XFWF_HPOS; + info.hpos = min(1.0, info.hpos + info.hsize); + break; + case XfwfSTop: + info.flags = XFWF_VPOS; + info.vpos = 0.0; + break; + case XfwfSBottom: + info.flags = XFWF_VPOS; + info.vpos = 1.0; + break; + case XfwfSLeftSide: + info.flags = XFWF_HPOS; + info.hpos = 0.0; + break; + case XfwfSRightSide: + info.flags = XFWF_HPOS; + info.hpos = 1.0; + break; + default: break; /* Not understood */ + } + XtCallCallbackList($, $scrollCallback, info); +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +.nf + +.B incl + <Xfwf/Arrow.h> +.fi + +.nf + +.B incl + <Xfwf/Slider2.h> +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.hi + +.hi +.SS "Private variables" + +The three children of the scrollbar are stored in private variables. + + + +.nf +Widget arrow1 +.fi + +.nf +Widget arrow2 +.fi + +.nf +Widget slider +.fi + +During the \fIinitialize\fP method, the variable \fIinitializing\fP will be +\fITrue\fP, so that \fIinsert_child\fP can check whether a child should be +inserted or not. + + + +.nf +Boolean initializing +.fi + +The \fIscrollResponse\fP function of the Slider2 that implements the +thumb is stored in a private variable. + + + +.nf +XtCallbackProc slider_scroll +.fi + +.hi + +.hi +.SS "Methods" + +The \fIinitialize\fP method creates the three widgets that make up the +scrollbar: two arrows and a slider. It sets the resources of these +widgets and redirects the callbacks. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + Position x, y, xa2, xslider, ya2, yslider; + Dimension w, h, wa, ha, wslider, hslider; + + $initializing = True; + $compute_inside($, x, y, w, h); + if ($vertical) { + ha = wa = wslider = w; + xa2 = xslider = x; + hslider = (h - 2*ha > 0) ? h - 2*ha : 10; + yslider = y + ha; + ya2 = yslider + hslider; + } else { + wa = ha = hslider = h; + ya2 = yslider = y; + wslider = (w - 2*wa > 0) ? w - 2*wa : 10; + xslider = x + wa; + xa2 = xslider + wslider; + } + $arrow1 = XtVaCreateManagedWidget + ("_arrow1", xfwfArrowWidgetClass, $, + XtNx, x, + XtNy, y, + XtNwidth, wa, + XtNheight, ha, + XtNframeWidth, 0, + XtNforeground, $scrollbarForeground, + XtNinitialDelay, $initialDelay, + XtNrepeatDelay, $repeatDelay, + XtNtraversalOn, False, + XtNhighlightThickness, 0, + XtNdirection, $vertical?XfwfTop:XfwfLeft, + XtNouterOffset, 0, + XtNborderWidth, 0, + NULL); + XtAddCallback($arrow1, XtNcallback, up, $); + $arrow2 = XtVaCreateManagedWidget + ("_arrow2", xfwfArrowWidgetClass, $, + XtNx, xa2, + XtNy, ya2, + XtNwidth, wa, + XtNheight, ha, + XtNframeWidth, 0, + XtNforeground, $scrollbarForeground, + XtNinitialDelay, $initialDelay, + XtNrepeatDelay, $repeatDelay, + XtNtraversalOn, False, + XtNhighlightThickness, 0, + XtNdirection, $vertical?XfwfBottom:XfwfRight, + XtNouterOffset, 0, + XtNborderWidth, 0, + NULL); + XtAddCallback($arrow2, XtNcallback, down, $); + $slider = XtVaCreateManagedWidget + ("_slider", xfwfSlider2WidgetClass, $, + XtNx, xslider, + XtNy, yslider, + XtNwidth, wslider, + XtNheight, hslider, + XtNthumbColor, $scrollbarForeground, + XtNframeWidth, 0, + XtNinitialDelay, $initialDelay, + XtNrepeatDelay, $repeatDelay, + XtNtraversalOn, False, + XtNhighlightThickness, 0, + XtNouterOffset, 0, + XtNborderWidth, 0, + NULL); + XtAddCallback($slider, XtNscrollCallback, thumbscroll, $); + XtVaGetValues($slider, XtNscrollResponse, $slider_scroll, NULL); + $initializing = False; +} +.fi + +When the scrollbar is resized, the children must be resized also. + +.nf +resize($) +{ + Position x, y, xa2, xslider, ya2, yslider; + Dimension w, h, wa, ha, wslider, hslider; + + $compute_inside($, x, y, w, h); + if ($vertical) { + wa = wslider = w; + xa2 = xslider = x; + ha = 2 * (wa + 1)/3; + hslider = (h - 2*ha > 0) ? h - 2*ha : 10; + yslider = y + ha; + ya2 = yslider + hslider; + } else { + ha = hslider = h; + ya2 = yslider = y; + wa = 2 * (ha + 1)/3; + wslider = (w - 2*wa > 0) ? w - 2*wa : 10; + xslider = x + wa; + xa2 = xslider + wslider; + } + XtConfigureWidget($arrow1, x, y, wa, ha, 0); + XtConfigureWidget($arrow2, xa2, ya2, wa, ha, 0); + XtConfigureWidget($slider, xslider, yslider, wslider, hslider, 0); +} +.fi + +\fIinsert_child\fP is redefined here only to be able to give a warning +when a child is inserted beyond the three that are created in the +\fIinitialize\fP method. + +.nf +insert_child(Widget child) +{ + if ($initializing) + #insert_child(child); + else { + char s[500]; + (void)sprintf(s, "Cannot add children to a scrollbar (\\"%s\\"->\\"%s\\")", + XtName(child), XtName($)); + XtWarning(s); + } +} +.fi + +The \fIset_values\fP method passes resource values on to the three +children. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + if ($old$vertical != $vertical) { + XtWarning("Cannot change the \\"vertical\\" resource of a scrollbar\\n"); + $vertical = $old$vertical; + } + if ($old$scrollbarForeground != $scrollbarForeground) { + XtVaSetValues($slider, XtNthumbColor, $scrollbarForeground, NULL); + XtVaSetValues($arrow1, XtNforeground, $scrollbarForeground, NULL); + XtVaSetValues($arrow2, XtNforeground, $scrollbarForeground, NULL); + } + if ($old$shadow != $shadow) { + XtVaSetValues($slider, XtNthumbFrameWidth, $shadow, NULL); + XtVaSetValues($arrow1, XtNarrowShadow, $shadow, NULL); + XtVaSetValues($arrow2, XtNarrowShadow, $shadow, NULL); + } + if ($old$minsize != $minsize) { + XtVaSetValues($slider, XtNminsize, $minsize, NULL); + } + return False; +} +.fi + +The \fIscroll_response\fP method is accessed via the \fIscrollResponse\fP +resource. It is passed the scrollbar itself as the \fIclient_data\fP +argument and a pointer to an \fIXfwfScrollInfo\fP record as \fIcall_data\fP. + +The scrollbar passes on the call to the Slider2 widget that is +managing the thumb. + +.nf +scroll_response(Widget wdg, XtPointer client_data, XtPointer call_data) +{ + Widget $ = (Widget) client_data; + + $slider_scroll(wdg, $slider, call_data); +} +.fi + +.hi + +.hi +.SH "Utilities" + +.nf +char rcsid[] = "$Header: Scrollbar.w,v 1.1 92/11/02 14:08:00 bert Exp $" +.fi + +The \fIup\fP routine is a callback for the first arrow. It invokes the +scrollbar's callback. + +.nf +up(Widget arrow, XtPointer client_data, XtPointer call_data) +{ + Widget $ = (Widget) client_data; + XfwfScrollInfo info; + + XfwfGetThumb($slider, info); + if ($vertical) { + info.reason = XfwfSUp; + info.flags = XFWF_VPOS; + info.vpos = max(0.0, info.vpos - $increment); + } else { + info.reason = XfwfSLeft; + info.flags = XFWF_HPOS; + info.hpos = max(0.0, info.hpos - $increment); + } + XtCallCallbackList($, $scrollCallback, info); +} +.fi + +The \fIdown\fP routine is the callback for the second arrow. It invokes the +scrollbar's callback. + +.nf +down(Widget arrow, XtPointer client_data, XtPointer call_data) +{ + Widget $ = (Widget) client_data; + XfwfScrollInfo info; + + XfwfGetThumb($slider, info); + if ($vertical) { + info.reason = XfwfSDown; + info.flags = XFWF_VPOS; + info.vpos = min(1.0, info.vpos + $increment); + } else { + info.reason = XfwfSRight; + info.flags = XFWF_HPOS; + info.hpos = min(1.0, info.hpos + $increment); + } + XtCallCallbackList($, $scrollCallback, info); +} +.fi + +The \fIthumbscroll\fP routine is the callback for the scroll callback of +the slider. It invokes the scrollbar's \fIscrollCallback\fP, after making +sure that only appropriate position information is passed. (The +Slider2 might pass horizontal position where only vertical position is +relevant, and vice versa.) + +.nf +thumbscroll(Widget w, XtPointer client_data, XtPointer call_data) +{ + Widget $ = (Widget) client_data; + XfwfScrollInfo *info = (XfwfScrollInfo*) call_data; + + if ($vertical) + info->flags = XFWF_VPOS; + else + info->flags = XFWF_HPOS; + XtCallCallbackList($, $scrollCallback, info); +} +.fi + +The \fIcopy_background\fP routine is resource default procedure. It is +called to initialize the default value of the \fIforeground\fP resource. + +.nf +copy_background($, int offset, XrmValue * value) +{ + value->addr = (XtPointer) $background_pixel; +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/ScrollbarP.h b/vendor/x11iraf/obm/ObmW/ScrollbarP.h new file mode 100644 index 00000000..111ee455 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ScrollbarP.h @@ -0,0 +1,58 @@ +/* Generated by wbuild from "Scrollbar.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfScrollbarP_H_ +#define _XfwfScrollbarP_H_ +#include "BoardP.h" +#include "Scrollbar.h" +typedef void (*scroll_response_Proc)( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +#define XtInherit_scroll_response ((scroll_response_Proc) _XtInherit) +typedef struct { +/* methods */ +scroll_response_Proc scroll_response; +/* class variables */ +} XfwfScrollbarClassPart; +typedef struct _XfwfScrollbarClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfScrollbarClassPart xfwfScrollbar_class; +} XfwfScrollbarClassRec; + +typedef struct { +/* resources */ +Boolean vertical; +XtCallbackList scrollCallback; +XtCallbackProc scrollResponse; +Cardinal initialDelay; +Cardinal repeatDelay; +float increment; +Pixel scrollbarForeground; +Dimension shadow; +Dimension minsize; +/* private state */ +Widget arrow1; +Widget arrow2; +Widget slider; +Boolean initializing; +XtCallbackProc slider_scroll; +} XfwfScrollbarPart; + +typedef struct _XfwfScrollbarRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfScrollbarPart xfwfScrollbar; +} XfwfScrollbarRec; + +externalref XfwfScrollbarClassRec xfwfScrollbarClassRec; + +#endif /* _XfwfScrollbarP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Separator.c b/vendor/x11iraf/obm/ObmW/Separator.c new file mode 100644 index 00000000..f7669a76 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Separator.c @@ -0,0 +1,357 @@ +/* + * Separator.c - Separator widget Vladimir Romanovski + * + */ +#include <X11/IntrinsicP.h> +#include <X11/RectObjP.h> +#include <X11/StringDefs.h> +#include <X11/Xos.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/SeparatorP.h> + +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xmu/Drawing.h> + +#include <stdio.h> +#include <ctype.h> + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +#define offset(field) XtOffsetOf(SeparatorRec, field) + +static XtResource resources[] = { + { + XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), + offset(separator.orientation), XtRImmediate, (XtPointer) XtorientHorizontal + }, + { + XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), + offset(separator.margin), XtRImmediate, (caddr_t)1 + }, + { + XtNseparatorType, XtCSeparatorType, XtRSeparatorType, + sizeof(XawSeparatorType), offset(separator.separatorType), + XtRImmediate,(caddr_t)XawSHADOW_ETCHED_IN + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(simple.shadow_thickness), XtRImmediate, (XtPointer)0 + } +}; +#undef offset + +static void Initialize(); +static void Resize(); +static void Redisplay(); +static Boolean SetValues(); +static void ClassInitialize(); +static void Destroy(); + +SeparatorClassRec separatorClassRec = { + { + /* core_class fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "Separator", + /* widget_size */ sizeof(SeparatorRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* Simple class fields initialization */ + /* change_sensitive */ XtInheritChangeSensitive, + /* display_rect */ XtInheritDisplayRectProc, + /* extension */ NULL + }, + { /* Separator class fields initialization */ + /* ignore */ 0 + } +}; + +WidgetClass separatorWidgetClass = (WidgetClass)&separatorClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +/*---------------------------------------------*/ +#define done( type, value ) \ +{ \ + if ( toVal->addr != NULL ) \ + { \ + if ( toVal->size < sizeof( type ) ) \ + { \ + toVal->size = sizeof( type ); \ + return False; \ + } \ + *(type*)(toVal->addr) = (value); \ + } \ + else \ + { \ + static type static_val; \ + static_val = (value); \ + toVal->addr = (caddr_t)&static_val; \ + } \ + toVal->size = sizeof(type); \ + return True; \ +} \ +/*---------------------------------------------*/ + +static XrmQuark QSingle, QDouble, QShadowIn, QShadowOut; + +/* ARGSUSED */ +static Boolean +CvtStringToSeparatorType(dpy, args, num_args, fromVal, toVal, convData) + Display *dpy; + XrmValuePtr args; /* unused */ + Cardinal *num_args; /* unused */ + XrmValuePtr fromVal; + XrmValuePtr toVal; + XtPointer *convData; /* unused */ +{ + static XawSeparatorType separatorType; + XrmQuark q; + char lowerName[BUFSIZ]; + + XmuCopyISOLatin1Lowered (lowerName, (char *)fromVal->addr); + q = XrmStringToQuark(lowerName); + + separatorType = XawSINGLE_LINE; + + if (q == QSingle) separatorType = XawSINGLE_LINE; + else if (q == QDouble) separatorType = XawDOUBLE_LINE; + else if (q == QShadowIn) separatorType = XawSHADOW_ETCHED_IN; + else if (q == QShadowOut) separatorType = XawSHADOW_ETCHED_OUT; + else + XtDisplayStringConversionWarning( dpy, (char *)fromVal->addr, + XtRSeparatorType); + + done(XawSeparatorType, separatorType); +} +#undef done + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtSetTypeConverter( XtRString, XtRSeparatorType, CvtStringToSeparatorType, + (XtConvertArgList)NULL, (Cardinal)0, + XtCacheNone, (XtDestructor)NULL); + + QSingle = XrmStringToQuark(XawSingle_Line); + QDouble = XrmStringToQuark(XawDouble_Line); + QShadowIn = XrmStringToQuark(XawShadow_Etched_In); + QShadowOut = XrmStringToQuark(XawShadow_Etched_Out); +} + +static void GetGC(sw) + SeparatorWidget sw; +{ + XGCValues values; + unsigned long mask; + + values.foreground = sw->simple.foreground; + values.line_width = 0; + mask = GCForeground | GCLineWidth; + + sw->separator.gc = XtGetGC ((Widget)sw, mask, (XGCValues*)&values); +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + SeparatorWidget newsw = (SeparatorWidget) new; + + if (newsw->core.width == 0) + newsw->core.width = 8 + 2*SIMPLE_MARGIN(new); + + if (newsw->core.height == 0) + newsw->core.height = 8 + 2*SIMPLE_MARGIN(new); + + GetGC(newsw); + +} + +static void Resize(w) + Widget w; +{ + /* If widget is realized, clear and redisplay it */ + + if (XtIsRealized(w)) { + XClearWindow(XtDisplay(w), XtWindow(w)); + (*separatorClassRec.core_class.expose) (w, (XEvent*)NULL, (Region)NULL); + } +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + SeparatorWidget cursw = (SeparatorWidget) current; + SeparatorWidget newsw = (SeparatorWidget) new; + Boolean redisplay = False; + +#define NE(field) (cursw->separator.field != newsw->separator.field) + + if (newsw->core.width == 0) + newsw->core.width = 8 + 2*SIMPLE_MARGIN(new); + + if (newsw->core.height == 0) + newsw->core.height = 8 + 2*SIMPLE_MARGIN(new); + + if (NE(margin) || NE(separatorType)) + redisplay = True; + + if (cursw->simple.foreground != newsw->simple.foreground) + { + XtReleaseGC(new, cursw->separator.gc); + GetGC(newsw); + redisplay = True; + } + + return redisplay; +} + +static void Destroy(w) + Widget w; +{ + XtReleaseGC( w, ((SeparatorWidget)w)->separator.gc ); +} + +static void Redisplay(gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register SeparatorWidget sw = (SeparatorWidget) gw; + int x1, y1, x2, y2; + + if (!XtIsRealized(gw)) + return; + + if (sw->simple.shadow_thickness > 0) + (*simpleWidgetClass->core_class.expose) (gw, event, region); + + if (sw->separator.orientation == XtorientHorizontal) { + x1 = sw->separator.margin; + x2 = sw->core.width - (x1 * 2); + + switch(sw->separator.separatorType) { + + case XawSHADOW_ETCHED_IN : + y1 = (sw->core.height - 2) / 2; + y2 = y1 + 1; + + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y1, x2, y1); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x1, y2, x2, y2); + break; + case XawSHADOW_ETCHED_OUT: + y1 = (sw->core.height - 2) / 2; + y2 = y1 + 1; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y2, x2, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x1, y1, x2, y1); + break; + + case XawDOUBLE_LINE: + y1 = (sw->core.height - 2)/ 2; + y2 = y1 + 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x2, y1); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y2, x2, y2); + break; + + case XawSINGLE_LINE : + y1 = sw->core.height / 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x2, y1); + default: + break; + } + } else { + y1 = sw->separator.margin; + y2 = sw->core.height - (y1 * 2); + + switch(sw->separator.separatorType) { + + case XawSHADOW_ETCHED_IN : + x1 = (sw->core.width - 2) / 2; + x2 = x1 + 1; + + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y1, x1, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x2, y1, x2, y2); + break; + case XawSHADOW_ETCHED_OUT: + x1 = (sw->core.width - 2) / 2; + x2 = x1 + 1; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y1, x1, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x2, y1, x2, y2); + break; + + case XawDOUBLE_LINE: + x1 = (sw->core.width - 2)/ 2; + x2 = x1 + 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x1, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x2, y1, x2, y2); + break; + + case XawSINGLE_LINE : + x1 = sw->core.width / 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x1, y2); + default: + break; + } + } +} + + diff --git a/vendor/x11iraf/obm/ObmW/Separator.h b/vendor/x11iraf/obm/ObmW/Separator.h new file mode 100644 index 00000000..e6d6eff8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Separator.h @@ -0,0 +1,98 @@ +#ifndef _XawSeparator_h +#define _XawSeparator_h + +/*********************************************************************** + * + * Separator Widget + * + ***********************************************************************/ + +#include "XrawInit.h" + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + mappedWhenManaged MappedWhenManaged Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + + + + +typedef enum { + XawSINGLE_LINE = Xraw_SEPARATOR, + XawDOUBLE_LINE, + XawSHADOW_ETCHED_IN, + XawSHADOW_ETCHED_OUT +} XawSeparatorType; + + +#define XawSingle_Line "singleline" +#define XawDouble_Line "doubleline" +#define XawShadow_Etched_In "shadowetchedin" +#define XawShadow_Etched_Out "shadowetchedout" + + + +#ifndef XtNmargin +#define XtNmargin "margin" +#endif + +#ifndef XtCMargin +#define XtCMargin "Margin" +#endif + +#ifndef XtNseparatorType +#define XtNseparatorType "separatorType" +#endif + +#ifndef XtCSeparatorType +#define XtCSeparatorType "SeparatorType" +#endif + +#ifndef XtRSeparatorType +#define XtRSeparatorType "SeparatorType" +#endif + +#define XawTextEncoding8bit 0 +#define XawTextEncodingChar2b 1 + +#define XtNleftBitmap "leftBitmap" +#define XtCLeftBitmap "LeftBitmap" +#define XtNencoding "encoding" +#define XtCEncoding "Encoding" + +#ifndef _XtStringDefs_h_ +#define XtNbitmap "bitmap" +#define XtNforeground "foreground" +#define XtNseparator "separator" +#define XtNfont "font" +#define XtNinternalWidth "internalWidth" +#define XtNinternalHeight "internalHeight" +#define XtNresize "resize" +#define XtCResize "Resize" +#define XtCBitmap "Bitmap" +#endif + +/* Class record constants */ + +extern WidgetClass separatorWidgetClass; + +typedef struct _SeparatorClassRec *SeparatorWidgetClass; +typedef struct _SeparatorRec *SeparatorWidget; + +#endif /* _XawSeparator_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/SeparatorP.h b/vendor/x11iraf/obm/ObmW/SeparatorP.h new file mode 100644 index 00000000..35aa3bae --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/SeparatorP.h @@ -0,0 +1,62 @@ +/* + * SeparatorP.h - Private definitions for Separator widget + * + */ + +#ifndef _XawSeparatorP_h +#define _XawSeparatorP_h + +/*********************************************************************** + * + * Separator Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> + +#include "XrawInit.h" +#include "Separator.h" + + +/* New fields for the Separator widget class record */ + +typedef struct {int foo;} SeparatorClassPart; + +/* Full class record declaration */ +typedef struct _SeparatorClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + SeparatorClassPart separator_class; +} SeparatorClassRec; + +extern SeparatorClassRec separatorClassRec; + +/* New fields for the Separator widget record */ + +typedef struct { + + /* Public Resources */ + XtOrientation orientation; + Dimension margin; + XawSeparatorType separatorType; + + /* Private part */ + GC gc; + +} SeparatorPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SeparatorRec { + CorePart core; + SimplePart simple; +#include <X11/Xaw3d/Simple.h> + SeparatorPart separator; +} SeparatorRec; + +#endif /* _XawSeparatorP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Simple.c b/vendor/x11iraf/obm/ObmW/Simple.c new file mode 100644 index 00000000..83797833 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Simple.c @@ -0,0 +1,489 @@ +#include <stdio.h> + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Drawing.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/ContainerP.h> + +#define UnspecifiedPixmap (Pixmap)2 +#define UndefinedGC (GC)2 + +static void InsPixel(); + +static XtResource resources[] = { +#define offset(field) XtOffset(SimpleWidget, simple.field) + { + XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, (XtPointer) None + }, + { + XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), + offset(insensitive_border), XtRImmediate, (XtPointer) None + }, + { + XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRImmediate, (XtPointer) XtDefaultForeground + }, + { + "top.gc", "Top.gc", XtRString, sizeof(String), + offset(top_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "bottom.gc", "Bottom.gc", XtRString, sizeof(String), + offset(bottom_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "highlight.gc", "Highlight.gc", XtRString, sizeof(String), + offset(highlight_GC), XtRImmediate, (XtPointer)NULL + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(shadow_thickness), XtRImmediate, (XtPointer) 0 + }, + { + XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(top_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(top_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(bottom_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(bottom_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNhighlightPixmap, XtCHighlightPixmap, XtRPixmap, sizeof(Pixmap), + offset(highlight_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNhighlightPixel, XtCHighlightPixel, XtRPixel, sizeof(Pixel), + offset(highlight_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNhighlightThickness, XtCHighlightThickness, XtRDimension, + sizeof(Dimension), + offset(highlight_thickness), XtRImmediate, (XtPointer) 2 + }, + { + XtNuserData, XtCUserData, XtRPixmap, sizeof(Pixmap), + offset(user_data), XtRImmediate, (XtPointer) NULL + }, + { + XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, (XtPointer)0 + } + +}; + +static void InsPixel(w, off, value) + Widget w; + int off; + XrmValue *value; +{ + register SimpleWidget p = (SimpleWidget) w; + static Pixel pixel; + + if (off == offset(top_shadow_color)) + { + p->simple.top_shadow_GC = UndefinedGC; + } + else if (off == offset(bottom_shadow_color)) + { + p->simple.bottom_shadow_GC = UndefinedGC; + } + else + { + p->simple.highlight_GC = UndefinedGC; + } + value->addr = (XtPointer) &pixel; +} + +#undef offset + +static void ClasstInitialize(); +static void ClassPartInitialize(); +static void Initialize(); +static void Realize(); +static void Redisplay(); +static void Destroy(); + +static Boolean SetValues(); +static Boolean DisplayRectProc(); +static Boolean ChangeSensitive(); + +static XtGeometryResult QueryGeometry(); + +SimpleClassRec simpleClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "Simple", + /* widget_size */ sizeof(SimpleRec), + /* class_initialize */ ClasstInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ NULL, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ ChangeSensitive, + /* display_rect */ DisplayRectProc, + /* extension */ NULL + } +}; + +WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; + +static void ClasstInitialize() +{ +/* EMPTY */ +} + +static void ClassPartInitialize(class) + WidgetClass class; +{ + register SimpleWidgetClass c = (SimpleWidgetClass)class; + + if (c->simple_class.change_sensitive == NULL) + { + char buf[BUFSIZ]; + + sprintf(buf, + "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", + c->core_class.class_name); + XtWarning(buf); + c->simple_class.change_sensitive = ChangeSensitive; + } + + if (c->simple_class.change_sensitive == XtInheritChangeSensitive) + c->simple_class.change_sensitive = ChangeSensitive; + + if (c->simple_class.display_rect == XtInheritDisplayRectProc) + c->simple_class.display_rect = DisplayRectProc; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + SimpleWidget sw = (SimpleWidget)new; + SimplePart* sp = (SimplePart*)&(sw->simple); + + if (sp->top_shadow_pixmap == UnspecifiedPixmap) + sp->top_shadow_pixmap = None; + + if (sp->top_shadow_GC == NULL){ + if (sp->top_shadow_pixmap != None) + sp->top_shadow_GC = AllocGCFromPixmap (new, sp->top_shadow_pixmap); + else + sp->top_shadow_GC = AllocGCFromPixel (new, sp->top_shadow_color); + } else if (sp->top_shadow_GC == UndefinedGC) + sp->top_shadow_GC = MakeTopShadowGC (new, new->core.background_pixel); + + + if (sp->bottom_shadow_pixmap == UnspecifiedPixmap) + sp->bottom_shadow_pixmap = None; + + if (sp->bottom_shadow_GC == NULL){ + if (sp->bottom_shadow_pixmap != None) + sp->bottom_shadow_GC = AllocGCFromPixmap (new, sp->bottom_shadow_pixmap); + else + sp->bottom_shadow_GC = AllocGCFromPixel (new, sp->bottom_shadow_color); + } else if (sp->bottom_shadow_GC == UndefinedGC) + sp->bottom_shadow_GC =MakeBottomShadowGC (new, new->core.background_pixel); + + + if (sp->highlight_pixmap == UnspecifiedPixmap) + sp->highlight_pixmap = None; + + if (sp->highlight_GC == NULL){ + if (sp->highlight_pixmap != None) + sp->highlight_GC = AllocGCFromPixmap (new, sp->highlight_pixmap); + else + sp->highlight_GC = AllocGCFromPixel (new, sp->highlight_color); + } else if (sp->highlight_GC == UndefinedGC) + sp->highlight_GC = MakeBottomShadowGC (new, new->core.background_pixel); + +} + +static void Realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + Pixmap border_pixmap; + + if (!XtIsSensitive(w)) + { + /* change border to gray; have to remember the old one, + * so XtDestroyWidget deletes the proper one */ + if (((SimpleWidget)w)->simple.insensitive_border == None) + ((SimpleWidget)w)->simple.insensitive_border = + XmuCreateStippledPixmap(XtScreen(w), + w->core.border_pixel, + w->core.background_pixel, + w->core.depth); + border_pixmap = w->core.border_pixmap; + attributes->border_pixmap = + w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; + + *valueMask |= CWBorderPixmap; + *valueMask &= ~CWBorderPixel; + } + + if ((attributes->cursor = ((SimpleWidget)w)->simple.cursor) != None) + *valueMask |= CWCursor; + + XtCreateWindow( w, (unsigned int)InputOutput, (Visual *)CopyFromParent, + *valueMask, attributes ); + + if (!XtIsSensitive(w)) + w->core.border_pixmap = border_pixmap; +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + SimpleWidget s_old = (SimpleWidget) current; + SimpleWidget s_new = (SimpleWidget) new; + SimplePart* sp = (SimplePart*)&(s_new->simple); + Boolean redraw = False; + +#define NE(field) (s_new->simple.field != s_old->simple.field) + + if ( XtIsSensitive(current) != XtIsSensitive(new) ) + (*((SimpleWidgetClass)XtClass(new))-> + simple_class.change_sensitive) ( new ); + + if ( NE(cursor) && XtIsRealized(new)) + XDefineCursor(XtDisplay(new), XtWindow(new), s_new->simple.cursor); + + if (NE(top_shadow_pixmap)) + { + XtReleaseGC (new, sp->top_shadow_GC); + sp->top_shadow_GC = AllocGCFromPixmap (new, sp->top_shadow_pixmap); + redraw = True; + } + else if (NE(top_shadow_color) && sp->top_shadow_pixmap == None) + { + XtReleaseGC (new, sp->top_shadow_GC); + sp->top_shadow_GC = AllocGCFromPixel (new, sp->top_shadow_color); + redraw = True; + } + + if (NE(bottom_shadow_pixmap)) + { + XtReleaseGC (new, sp->bottom_shadow_GC); + sp->bottom_shadow_GC = AllocGCFromPixmap (new, sp->bottom_shadow_pixmap); + redraw = True; + } + else if (NE(bottom_shadow_color) && sp->bottom_shadow_pixmap == None) + { + XtReleaseGC (new, sp->bottom_shadow_GC); + sp->bottom_shadow_GC = AllocGCFromPixel (new, sp->bottom_shadow_color); + redraw = True; + } + + if (NE(highlight_pixmap)) + { + XtReleaseGC (new, sp->highlight_GC); + sp->highlight_GC = AllocGCFromPixmap (new, sp->highlight_pixmap); + redraw = True; + } + else if (NE(highlight_color) && sp->highlight_pixmap) + { + XtReleaseGC (new, sp->highlight_GC); + sp->highlight_GC = AllocGCFromPixel (new, sp->highlight_color); + redraw = True; + } + +#undef NE + + return redraw; +} + + +static void Unhighlight (gw) + Widget gw; +{ + register Dimension thick = ((SimpleWidget)gw)->simple.highlight_thickness; + register Dimension width = gw->core.width; + register Dimension height = gw->core.height; + + if (!XtIsRealized(gw)) + return; + + if ( XtIsSubclass(XtParent(gw), containerWidgetClass)) + { + XRectangle rectangles[4]; + GC gc = ((ContainerWidget) XtParent(gw))->container.background_GC; + +#define SET_RECTANGLE(I,X,Y,W,H) \ + rectangles[I].x = X; rectangles[I].y = Y; \ + rectangles[I].width = W; rectangles[I].height = H + + SET_RECTANGLE(0, 0, 0, thick, height); + SET_RECTANGLE(1, 0, height - thick, width, thick); + SET_RECTANGLE(2, 0, 0, width, thick); + SET_RECTANGLE(3, width - thick, 0, thick, height); + + XFillRectangles (XtDisplay(gw), XtWindow(gw), gc, rectangles, 4); + + } + else + { + Display *dpy = XtDisplay(gw); + Window win = XtWindow(gw); + + XClearArea( dpy, win, 0, 0, thick, height, False); + XClearArea( dpy, win, 0, height - thick, width, thick, False); + XClearArea( dpy, win, 0, 0, width, thick, False); + XClearArea( dpy, win, width - thick, 0, thick, height, False); + } +} + + +/* ARGSUSED */ +static void Redisplay( gw, event, region ) + Widget gw; + XEvent *event; + Region region; +{ + register SimpleWidget s = (SimpleWidget)gw; + + if (XtIsRealized(gw)) + { + Unhighlight (gw); + + if (s->simple.shadow_thickness) + XawDrawFrame (gw, + s->simple.highlight_thickness, + s->simple.highlight_thickness, + s->core.width - 2 * s->simple.highlight_thickness, + s->core.height - 2 * s->simple.highlight_thickness, + XawRAISED, + s->simple.shadow_thickness, + s->simple.top_shadow_GC, + s->simple.bottom_shadow_GC); + } +} + +static void Destroy(w) + Widget w; +{ + register SimpleWidget s = (SimpleWidget)w; + + XtReleaseGC(w, s->simple.top_shadow_GC); + XtReleaseGC(w, s->simple.bottom_shadow_GC); +} + +static Boolean DisplayRectProc (w, rect) + Widget w; + XRectangle *rect; +{ + register SimpleWidget s = (SimpleWidget)w; + + rect->x = + rect->y = s->simple.highlight_thickness + s->simple.shadow_thickness; + rect->width = s->core.width - 2 * rect->x; + rect->height = s->core.height - 2 * rect->y; + + return True; +} + + +static XtGeometryResult QueryGeometry(w, intended, preferred) + Widget w; + XtWidgetGeometry *intended, *preferred; +{ + register SimpleWidget sw = (SimpleWidget)w; + + + preferred->request_mode = CWWidth | CWHeight; + + preferred->width = preferred->height = 2 * SIMPLE_MARGIN(sw) + 1; + +#define WIDTH_HEIGHT (CWWidth | CWHeight) + + if (intended + && ((intended->request_mode & WIDTH_HEIGHT) == WIDTH_HEIGHT) + && intended->width == preferred->width + && intended->height == preferred->height) + { + return XtGeometryYes; + } + else if (preferred->width == w->core.width + && preferred->height == w->core.height) + { + return XtGeometryNo; + } + else + { + return XtGeometryAlmost; + } +} + + +static Boolean ChangeSensitive(w) + register Widget w; +{ + if (XtIsRealized(w)) { + if (XtIsSensitive(w)) + if (w->core.border_pixmap != UnspecifiedPixmap) + XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), + w->core.border_pixmap ); + else + XSetWindowBorder( XtDisplay(w), XtWindow(w), + w->core.border_pixel ); + else { + if (((SimpleWidget)w)->simple.insensitive_border == None) + ((SimpleWidget)w)->simple.insensitive_border = + XmuCreateStippledPixmap(XtScreen(w), + w->core.border_pixel, + w->core.background_pixel, + w->core.depth); + XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), + ((SimpleWidget)w)-> + simple.insensitive_border ); + } + } + return False; +} diff --git a/vendor/x11iraf/obm/ObmW/SimpleMenu.c b/vendor/x11iraf/obm/ObmW/SimpleMenu.c new file mode 100644 index 00000000..eeade452 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/SimpleMenu.c @@ -0,0 +1,1467 @@ +/* $XConsortium: SimpleMenu.c,v 1.32 89/12/11 15:01:50 kit Exp $ */ + +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * SimpleMenu.c - Source code file for SimpleMenu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * -------------------------------- + * + * Date: Jul 4, 1995 + * + * Changes: Vladimir T. Romanovski + * romsky@hp1.oea.ihep.su // IHEP (Russia) + * romsky@munin.ucsf.edu // University of California San Francisco + * + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/SimpleMenP.h> +#include <X11/Xraw/SmeBSB.h> +#include <X11/Xraw/Cardinals.h> +#include <X11/Xraw/SmeLineP.h> + +#include <X11/Xmu/Initer.h> +#include <X11/Xmu/CharSet.h> + +#define CORE(w) (w)->core + +#define ForAllChildren(smw, childP) \ + for ( (childP) = (SmeObject *) (smw)->composite.children ; \ + (childP) < (SmeObject *) ((smw)->composite.children + \ + (smw)->composite.num_children ) ; \ + (childP)++ ) + + +#define UnspecifiedPixmap (Pixmap)2 +#define UndefinedGC (GC)2 + +static void InsPixel(); + +static XtResource resources[] = { +#define offset(field) XtOffset(SimpleMenuWidget, simple_menu.field) + { + "top.gc", "Top.gc", XtRString, sizeof(String), + offset(top_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "bottom.gc", "Bottom.gc", XtRString, sizeof(String), + offset(bottom_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(shadow_thickness), XtRImmediate, (XtPointer) 2 + }, + { + XtNbsbShadowWidth, XtCBsbShadowWidth, XtRDimension, sizeof(Dimension), + offset(bsb_shadow_thickness), XtRImmediate, (XtPointer) 2 + }, + { + XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(top_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(top_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(bottom_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(bottom_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNuserData, XtCUserData, XtRPixmap, sizeof(Pixmap), + offset(user_data), XtRImmediate, (XtPointer) NULL + }, + { + XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, (XtPointer)0 + }, + { + XtNframeType, XtCFrameType, XtRFrameType, sizeof(XawFrameType), + offset(frame_type), XtRImmediate, (XtPointer) XawRAISED + }, + +/* + * Label Resources. + */ + + { + XtNlabel, XtCLabel, XtRString, sizeof(String), + offset(label_string), XtRString, NULL + }, + { + XtNlabelClass, XtCLabelClass, XtRPointer, sizeof(WidgetClass), + offset(label_class), XtRImmediate, (XtPointer) NULL + }, + +/* + * Layout Resources. + */ + + { + XtNrowHeight, XtCRowHeight, XtRDimension, sizeof(Dimension), + offset(row_height), XtRImmediate, (XtPointer) 0 + }, + { + XtNtopMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension), + offset(top_margin), XtRImmediate, (XtPointer) 0 + }, + { + XtNbottomMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension), + offset(bottom_margin), XtRImmediate, (XtPointer) 0 + }, + +/* + * Misc. Resources + */ + + { + XtNallowShellResize, XtCAllowShellResize, XtRBoolean, sizeof(Boolean), + XtOffset(SimpleMenuWidget, shell.allow_shell_resize), + XtRImmediate, (XtPointer) TRUE + }, + { + XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, (XtPointer) None + }, + { + XtNmenuOnScreen, XtCMenuOnScreen, XtRBoolean, sizeof(Boolean), + offset(menu_on_screen), XtRImmediate, (XtPointer) TRUE + }, + { + XtNpopupOnEntry, XtCPopupOnEntry, XtRWidget, sizeof(Widget), + offset(popup_entry), XtRWidget, NULL + }, + { + XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), + offset(backing_store), XtRImmediate, + (XtPointer) (Always + WhenMapped + NotUseful) + } +}; + +static void InsPixel(w, off, value) + Widget w; + int off; + XrmValue *value; +{ + register SimpleMenuWidget p = (SimpleMenuWidget) w; + static Pixel pixel; + + if (off == offset(top_shadow_color)) + { + p->simple_menu.top_shadow_GC = UndefinedGC; + } + else if (off == offset(bottom_shadow_color)) + { + p->simple_menu.bottom_shadow_GC = UndefinedGC; + } + value->addr = (XtPointer) &pixel; +} + +#undef offset + +static char defaultTranslations[] = + "<EnterWindow>: highlight() \n\ + <LeaveWindow>: unhighlight() \n\ + <BtnMotion>: highlight() \n\ + <BtnUp>: MenuPopdown() notify() unhighlight()"; + +/* + * Semi Public function definitions. + */ + +static void Redisplay(), Realize(), Resize(), ChangeManaged(); +static void Initialize(), ClassInitialize(), ClassPartInitialize(); +static Boolean SetValues(), SetValuesHook(); +static XtGeometryResult GeometryManager(); + +/* + * Action Routine Definitions + */ + +static void Highlight(), Unhighlight(), Notify(), PositionMenuAction(); + +/* + * Private Function Definitions. + */ + +static void MakeSetValuesRequest(), CreateLabel(), Layout(); +static void AddPositionAction(), PositionMenu(); +static Dimension GetMenuWidth(), GetMenuHeight(); +static Widget FindMenu(); +static SmeObject GetEventEntry(); + +static XtActionsRec actionsList[] = +{ + {"notify", Notify}, + {"highlight", Highlight}, + {"unhighlight", Unhighlight} +}; + +CompositeClassExtensionRec extension_rec = { + /* next_extension */ NULL, + /* record_type */ NULLQUARK, + /* version */ XtCompositeExtensionVersion, + /* record_size */ sizeof(CompositeClassExtensionRec), + /* accepts_objects */ TRUE, +}; + +#define superclass (&overrideShellClassRec) + +SimpleMenuClassRec simpleMenuClassRec = { + { + /* superclass */ (WidgetClass) superclass, + /* class_name */ "SimpleMenu", + /* size */ sizeof(SimpleMenuRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize*/ ClassPartInitialize, + /* Class init'ed */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actionsList, + /* num_actions */ XtNumber(actionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ False, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ SetValuesHook, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ NULL, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + },{ + /* Shell extension */ NULL + },{ + /* Override extension */ NULL + },{ + /* Simple Menu extension*/ NULL + } +}; + +WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec; + +/************************************************************ + * + * Semi-Public Functions. + * + ************************************************************/ +#define done(type, value) \ + { \ + if (to->addr != NULL) { \ + if (to->size < sizeof(type)) { \ + to->size = sizeof(type); \ + return False; \ + } \ + *(type*)(to->addr) = (value); \ + } else { \ + static type static_val; \ + static_val = (value); \ + to->addr = (XtPointer)&static_val; \ + } \ + to->size = sizeof(type); \ + return True; \ + } + + +/* ARGSUSED */ +static Boolean +cvtStringToFrameType ( display, args, num_args, from, to, converter_data) + Display *display; + XrmValuePtr args; + Cardinal *num_args; + XrmValuePtr from; + XrmValuePtr to; + XtPointer *converter_data; +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToFrameType", "wrongParameters", + "XtToolkitError", + "String to frame type conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "raised") == 0) done(XawFrameType, XawRAISED); + if (XmuCompareISOLatin1(s, "sunken") == 0) done(XawFrameType, XawSUNKEN); + if (XmuCompareISOLatin1(s, "chiseled") == 0) done(XawFrameType, XawCHISELED); + if (XmuCompareISOLatin1(s, "ledged") == 0) done(XawFrameType, XawLEDGED); + if (XmuCompareISOLatin1(s, "tack") == 0) done(XawFrameType, XawTACK); + + XtDisplayStringConversionWarning(display, s, XtRFrameType); + printf("SimpleMenu.c"); + + done(XawFrameType, XawRAISED); +} + +/* Function Name: ClassInitialize + * Description: Class Initialize routine, called only once. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, + NULL, 0 ); + XmuAddInitializer( AddPositionAction, NULL); + + XtSetTypeConverter(XtRString, XtRFrameType, cvtStringToFrameType, + NULL, 0, XtCacheNone, NULL); +} + +/* Function Name: ClassPartInitialize + * Description: Class Part Initialize routine, called for every + * subclass. Makes sure that the subclasses pick up + * the extension record. + * Arguments: wc - the widget class of the subclass. + * Returns: none. + */ + +static void +ClassPartInitialize(wc) +WidgetClass wc; +{ + SimpleMenuWidgetClass smwc = (SimpleMenuWidgetClass) wc; + +/* + * Make sure that our subclass gets the extension rec too. + */ + + extension_rec.next_extension = smwc->composite_class.extension; + smwc->composite_class.extension = (XtPointer) &extension_rec; +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new) +Widget request, new; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) new; + register SimpleMenuPart* smwp = (SimpleMenuPart*)&smw->simple_menu; + + XmuCallInitializers(XtWidgetToApplicationContext(new)); + + if (smwp->label_class == NULL) + smwp->label_class = smeBSBObjectClass; + + smwp->label = NULL; + smwp->entry_set = NULL; + smwp->recursive_set_values = False; + + if (smwp->label_string != NULL) + CreateLabel(new); + + smwp->menu_width = TRUE; + + if (smw->core.width == 0) + { + smwp->menu_width = False; + smw->core.width = GetMenuWidth(new, NULL); + } + + smwp->menu_height = TRUE; + + if (smw->core.height == 0) + { + smwp->menu_height = False; + smw->core.height = GetMenuHeight(new); + } + + + /* + * Top & Bottom Shadow GCs + */ + + if (smwp->top_shadow_pixmap == UnspecifiedPixmap) + smwp->top_shadow_pixmap = None; + + if (smwp->top_shadow_GC == NULL){ + if (smwp->top_shadow_pixmap != None) + smwp->top_shadow_GC = AllocGCFromPixmap (new, smwp->top_shadow_pixmap); + else + smwp->top_shadow_GC = AllocGCFromPixel (new, smwp->top_shadow_color); + } else if (smwp->top_shadow_GC == UndefinedGC) + smwp->top_shadow_GC = MakeTopShadowGC (new, new->core.background_pixel); + + + if (smwp->bottom_shadow_pixmap == UnspecifiedPixmap) + smwp->bottom_shadow_pixmap = None; + + if (smwp->bottom_shadow_GC == NULL){ + if (smwp->bottom_shadow_pixmap != None) + smwp->bottom_shadow_GC = + AllocGCFromPixmap (new, smwp->bottom_shadow_pixmap); + else + smwp->bottom_shadow_GC = + AllocGCFromPixel (new, smwp->bottom_shadow_color); + } else if (smwp->bottom_shadow_GC == UndefinedGC) + smwp->bottom_shadow_GC = + MakeBottomShadowGC (new, new->core.background_pixel); +} + +/* Function Name: Redisplay + * Description: Redisplays the contents of the widget. + * Arguments: w - the simple menu widget. + * event - the X event that caused this redisplay. + * region - the region the needs to be repainted. + * Returns: none. + */ + +/* ARGSUSED */ +static void Redisplay(w, event, region) + Widget w; + XEvent * event; + Region region; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + SmeObjectClass class; + + if (region == NULL) + XClearWindow(XtDisplay(w), XtWindow(w)); + + /* + * Check and Paint each of the entries + */ + + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget)*entry)) + { + class = (SmeObjectClass) (*entry)->object.widget_class; + + if (class->rect_class.expose) + (*class->rect_class.expose) ((Widget)*entry, NULL, region); + } + + XawDrawFrame(w, + 0, 0, CORE(w).width, CORE(w).height, + SMW(w).frame_type, + SMW(w).shadow_thickness, + SMW(w).top_shadow_GC, + SMW(w).bottom_shadow_GC); + +} + +/* Function Name: Realize + * Description: Realizes the widget. + * Arguments: w - the simple menu widget. + * mask - value mask for the window to create. + * attrs - attributes for the window to create. + * Returns: none + */ + +static void +Realize(w, mask, attrs) +Widget w; +XtValueMask * mask; +XSetWindowAttributes * attrs; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + attrs->cursor = smw->simple_menu.cursor; + *mask |= CWCursor; + if ((smw->simple_menu.backing_store == Always) || + (smw->simple_menu.backing_store == NotUseful) || + (smw->simple_menu.backing_store == WhenMapped) ) { + *mask |= CWBackingStore; + attrs->backing_store = smw->simple_menu.backing_store; + } + else + *mask &= ~CWBackingStore; + + *mask |= CWSaveUnder; + attrs->save_under = True; + + (*superclass->core_class.realize) (w, mask, attrs); +} + +/* Function Name: Resize + * Description: Handle the menu being resized bigger. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void Resize(w) + Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + + if ( !XtIsRealized(w) ) return; + + ForAllChildren(smw, entry) /* reset width of all entries. */ + if (XtIsManaged( (Widget) *entry)) { + (*entry)->rectangle.width = smw->core.width - + 2 * SMW(w).shadow_thickness; + (*entry)->rectangle.x = SMW(w).shadow_thickness; + } + + XClearWindow(XtDisplay(w), XtWindow(w)); + + Redisplay(w, (XEvent *) NULL, (Region) NULL); + +} + +/* Function Name: SetValues + * Description: Relayout the menu when one of the resources is changed. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: none + */ + +/* ARGSUSED */ +static Boolean SetValues(current, request, new) + Widget current; + Widget request; + Widget new; +{ + SimpleMenuWidget smw_old = (SimpleMenuWidget) current; + SimpleMenuWidget smw_new = (SimpleMenuWidget) new; + register SimpleMenuPart* smwp = (SimpleMenuPart*)&smw_new->simple_menu; + Boolean ret_val = False; + Boolean layout = False; + Boolean redisplay = False; + +#define NE(name) (smw_old->simple_menu.name != smw_new->simple_menu.name) + + if (!XtIsRealized(current)) + return False; + + if (!smw_new->simple_menu.recursive_set_values) + { + if (smw_new->core.width != smw_old->core.width) + { + smw_new->simple_menu.menu_width = (smw_new->core.width != 0); + layout = TRUE; + } + if (smw_new->core.height != smw_old->core.height) + { + smw_new->simple_menu.menu_height = (smw_new->core.height != 0); + layout = TRUE; + } + } + + if (NE(cursor)) + XDefineCursor(XtDisplay(new), + XtWindow(new), smw_new->simple_menu.cursor); + + if (NE(label_string)) + if (smw_new->simple_menu.label_string == NULL) /* Destroy. */ + XtDestroyWidget((Widget)smw_old->simple_menu.label); + else if (smw_old->simple_menu.label_string == NULL) /* Create. */ + CreateLabel(new); + else /* Change. */ + XtVaSetValues((Widget)smw_new->simple_menu.label, + XtNlabel, smw_new->simple_menu.label_string, + NULL); + + if (NE(label_class)) + XtAppWarning(XtWidgetToApplicationContext(new), + "No Dynamic class change of the SimpleMenu Label."); + + if (NE(top_margin) || NE(bottom_margin)) /* filler................. */ + { + layout = TRUE; + ret_val = TRUE; + } + + if (layout) + Layout(new, NULL, NULL); + { + + if ( NE(shadow_thickness) ) + redisplay = TRUE; + + if (NE(top_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->top_shadow_GC); + smwp->top_shadow_GC = AllocGCFromPixmap (new, smwp->top_shadow_pixmap); + redisplay = True; + + } + else if (NE(top_shadow_color && smwp->top_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->top_shadow_GC); + smwp->top_shadow_GC = AllocGCFromPixel (new, smwp->top_shadow_color); + redisplay = True; + + } + + if (NE(bottom_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->bottom_shadow_GC); + smwp->bottom_shadow_GC = + AllocGCFromPixmap (new, smwp->bottom_shadow_pixmap); + + redisplay = True; + + } + else if (NE(bottom_shadow_color && smwp->bottom_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->bottom_shadow_GC); + smwp->bottom_shadow_GC = + AllocGCFromPixel (new, smwp->bottom_shadow_color); + redisplay = True; + + } + +#undef NE + } + + return(ret_val || redisplay); +} + +/* Function Name: SetValuesHook + * Description: To handle a special case, this is passed the + * actual arguments. + * Arguments: w - the menu widget. + * arglist - the argument list passed to XtSetValues. + * num_args - the number of args. + * Returns: none + */ + +/* + * If the user actually passed a width and height to the widget + * then this MUST be used, rather than our newly calculated width and + * height. + */ + +static Boolean +SetValuesHook(w, arglist, num_args) +Widget w; +ArgList arglist; +Cardinal *num_args; +{ + register Cardinal i; + Dimension width, height; + + width = w->core.width; + height = w->core.height; + + for ( i = 0 ; i < *num_args ; i++) { + if ( streq(arglist[i].name, XtNwidth) ) + width = (Dimension) arglist[i].value; + if ( streq(arglist[i].name, XtNheight) ) + height = (Dimension) arglist[i].value; + } + + if ((width != w->core.width) || (height != w->core.height)) + MakeSetValuesRequest(w, width, height); + return(False); +} + +/************************************************************ + * + * Geometry Management routines. + * + ************************************************************/ + +/* Function Name: GeometryManager + * Description: This is the SimpleMenu Widget's Geometry Manager. + * Arguments: w - the Menu Entry making the request. + * request - requested new geometry. + * reply - the allowed geometry. + * Returns: XtGeometry{Yes, No, Almost}. + */ + +static XtGeometryResult +GeometryManager(w, request, reply) +Widget w; +XtWidgetGeometry * request, * reply; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) XtParent(w); + SmeObject entry = (SmeObject) w; + XtGeometryMask mode = request->request_mode; + XtGeometryResult answer; + Dimension old_height, old_width; + + if ( !(mode & CWWidth) && !(mode & CWHeight) ) + return(XtGeometryNo); + + reply->width = request->width; + reply->height = request->height; + + old_width = entry->rectangle.width; + old_height = entry->rectangle.height; + + Layout(w, &(reply->width), &(reply->height) ); + +/* + * Since we are an override shell and have no parent there is no one to + * ask to see if this geom change is okay, so I am just going to assume + * we can do whatever we want. If you subclass be very careful with this + * assumption, it could bite you. + * + * Chris D. Peterson - Sept. 1989. + */ + + if ( (reply->width == request->width) && + (reply->height == request->height) ) { + + if ( mode & XtCWQueryOnly ) { /* Actually perform the layout. */ + entry->rectangle.width = old_width; + entry->rectangle.height = old_height; + } + else { + Layout(( Widget) smw, NULL, NULL); + } + answer = XtGeometryDone; + } + else { + entry->rectangle.width = old_width; + entry->rectangle.height = old_height; + + if ( ((reply->width == request->width) && !(mode & CWHeight)) || + ((reply->height == request->height) && !(mode & CWWidth)) || + ((reply->width == request->width) && + (reply->height == request->height)) ) + answer = XtGeometryNo; + else { + answer = XtGeometryAlmost; + reply->request_mode = 0; + if (reply->width != request->width) + reply->request_mode |= CWWidth; + if (reply->height != request->height) + reply->request_mode |= CWHeight; + } + } + return(answer); +} + +/* Function Name: ChangeManaged + * Description: called whenever a new child is managed. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +ChangeManaged(w) +Widget w; +{ + Layout(w, NULL, NULL); +} + +/************************************************************ + * + * Global Action Routines. + * + * These actions routines will be added to the application's + * global action list. + * + ************************************************************/ + +/* Function Name: PositionMenuAction + * Description: Positions the simple menu widget. + * Arguments: w - a widget (no the simple menu widget.) + * event - the event that caused this action. + * params, num_params - parameters passed to the routine. + * we expect the name of the menu here. + * Returns: none + */ + +/* ARGSUSED */ +static void +PositionMenuAction(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + Widget menu; + XPoint loc; + + if (*num_params != 1) { + char error_buf[BUFSIZ]; + sprintf(error_buf, "%s %s", + "Xaw - SimpleMenuWidget: position menu action expects only one", + "parameter which is the name of the menu."); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + if ( (menu = FindMenu(w, params[0])) == NULL) { + char error_buf[BUFSIZ]; + sprintf(error_buf, "%s '%s'", + "Xaw - SimpleMenuWidget: could not find menu named: ", params[0]); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + switch (event->type) { + case ButtonPress: + case ButtonRelease: + loc.x = event->xbutton.x_root; + loc.y = event->xbutton.y_root; + PositionMenu(menu, &loc); + break; + case EnterNotify: + case LeaveNotify: + loc.x = event->xcrossing.x_root; + loc.y = event->xcrossing.y_root; + PositionMenu(menu, &loc); + break; + case MotionNotify: + loc.x = event->xmotion.x_root; + loc.y = event->xmotion.y_root; + PositionMenu(menu, &loc); + break; + default: + PositionMenu(menu, NULL); + break; + } +} + +/************************************************************ + * + * Widget Action Routines. + * + ************************************************************/ + +/* Function Name: Unhighlight + * Description: Unhighlights current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Unhighlight(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry = smw->simple_menu.entry_set; + SmeObjectClass class; + + if ( entry == NULL) return; + + smw->simple_menu.entry_set = NULL; + class = (SmeObjectClass) entry->object.widget_class; + (class->sme_class.unhighlight) ( (Widget) entry); +} + +/* Function Name: Highlight + * Description: Highlights current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Highlight(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry; + SmeObjectClass class; + + if ( !XtIsSensitive(w) ) return; + + entry = GetEventEntry(w, event); + + if (entry == smw->simple_menu.entry_set) return; + + Unhighlight(w, event, params, num_params); + + if (entry == NULL) return; + + if ( !XtIsSensitive( (Widget) entry)) { + smw->simple_menu.entry_set = NULL; + return; + } + + smw->simple_menu.entry_set = entry; + class = (SmeObjectClass) entry->object.widget_class; + + (class->sme_class.highlight) ( (Widget) entry); +} + +/* Function Name: Notify + * Description: Notify user of current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Notify(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry = smw->simple_menu.entry_set; + SmeObjectClass class; + + if ( (entry == NULL) || !XtIsSensitive((Widget) entry) ) return; + + class = (SmeObjectClass) entry->object.widget_class; + (class->sme_class.notify)( (Widget) entry ); +} + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawSimpleMenuAddGlobalActions + * Description: adds the global actions to the simple menu widget. + * Arguments: app_con - the appcontext. + * Returns: none. + */ + +void +XawSimpleMenuAddGlobalActions(app_con) +XtAppContext app_con; +{ + XtInitializeWidgetClass(simpleMenuWidgetClass); + XmuCallInitializers( app_con ); +} + + +/* Function Name: XawSimpleMenuGetActiveEntry + * Description: Gets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: the currently set entry or NULL if none is set. + */ + +Widget +XawSimpleMenuGetActiveEntry(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + return( (Widget) smw->simple_menu.entry_set); +} + +/* Function Name: XawSimpleMenuClearActiveEntry + * Description: Unsets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: none. + */ + +void +XawSimpleMenuClearActiveEntry(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + smw->simple_menu.entry_set = NULL; +} + +/************************************************************ + * + * Private Functions. + * + ************************************************************/ + +/* Function Name: CreateLabel + * Description: Creates a the menu label. + * Arguments: w - the smw widget. + * Returns: none. + * + * Creates the label object and makes sure it is the first child in + * in the list. + */ + +static void +CreateLabel(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + register Widget * child, * next_child; + register int i; + Arg args[2]; + + if ( (smw->simple_menu.label_string == NULL) || + (smw->simple_menu.label != NULL) ) { + char error_buf[BUFSIZ]; + + sprintf(error_buf, "Xaw Simple Menu Widget: %s or %s, %s", + "label string is NULL", "label already exists", + "no label is being created."); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + XtSetArg(args[0], XtNlabel, smw->simple_menu.label_string); + XtSetArg(args[1], XtNjustify, XtJustifyCenter); + smw->simple_menu.label = (SmeObject) + XtCreateManagedWidget("menuLabel", + smw->simple_menu.label_class, w, + args, TWO); + + next_child = NULL; + for (child = smw->composite.children + smw->composite.num_children, + i = smw->composite.num_children ; i > 0 ; i--, child--) { + if (next_child != NULL) + *next_child = *child; + next_child = child; + } + *child = (Widget) smw->simple_menu.label; +} + +/* Function Name: Layout + * Description: lays the menu entries out all nice and neat. + * Arguments: w - See below (+++) + * width_ret, height_ret - The returned width and + * height values. + * Returns: none. + * + * if width == NULL || height == NULL then it assumes the you do not care + * about the return values, and just want a relayout. + * + * if this is not the case then it will set width_ret and height_ret + * to be width and height that the child would get if it were layed out + * at this time. + * + * +++ "w" can be the simple menu widget or any of its object children. + */ + +static void +Layout(w, width_ret, height_ret) +Widget w; +Dimension *width_ret, *height_ret; +{ + SmeObject current_entry, *entry; + SimpleMenuWidget smw; + Dimension width, height; + Boolean do_layout = ((height_ret == NULL) || (width_ret == NULL)); + Boolean allow_change_size; + height = 0; + + if ( XtIsSubclass(w, simpleMenuWidgetClass) ) { + smw = (SimpleMenuWidget) w; + current_entry = NULL; + } + else { + smw = (SimpleMenuWidget) XtParent(w); + current_entry = (SmeObject) w; + } + + allow_change_size = (!XtIsRealized((Widget)smw) || + (smw->shell.allow_shell_resize)); + + if ( smw->simple_menu.menu_height ) + height = smw->core.height; + else + if (do_layout) { + height = smw->simple_menu.top_margin; + height += smw->simple_menu.shadow_thickness; + ForAllChildren(smw, entry) { + if (!XtIsManaged( (Widget) *entry)) continue; + + if ( (smw->simple_menu.row_height != 0) && + (*entry != smw->simple_menu.label) ) + (*entry)->rectangle.height = smw->simple_menu.row_height; + + (*entry)->rectangle.y = height; + (*entry)->rectangle.x = smw->simple_menu.shadow_thickness; + height += (*entry)->rectangle.height; + } + height += smw->simple_menu.bottom_margin; + height += smw->simple_menu.shadow_thickness; + } + else { + if ((smw->simple_menu.row_height != 0) && + (current_entry != smw->simple_menu.label) ) + height = smw->simple_menu.row_height; + } + + if (smw->simple_menu.menu_width) + width = smw->core.width; + else if ( allow_change_size ){ + width = GetMenuWidth((Widget) smw, (Widget) current_entry); + width +=2*smw->simple_menu.shadow_thickness; + } + else + width = smw->core.width; + + if (do_layout) { + ForAllChildren(smw, entry) + if (XtIsManaged( (Widget) *entry)) + (*entry)->rectangle.width = width - + 2*smw->simple_menu.shadow_thickness; + + if (allow_change_size) + MakeSetValuesRequest((Widget) smw, width, height); + } + else { + *width_ret = width; + if (height != 0) + *height_ret = height; + } +} + +/* Function Name: AddPositionAction + * Description: Adds the XawPositionSimpleMenu action to the global + * action list for this appcon. + * Arguments: app_con - the application context for this app. + * data - NOT USED. + * Returns: none. + */ + +/* ARGSUSED */ +static void +AddPositionAction(app_con, data) +XtAppContext app_con; +XtPointer data; +{ + static XtActionsRec pos_action[] = { + { "XawPositionSimpleMenu", PositionMenuAction }, + }; + + XtAppAddActions(app_con, pos_action, XtNumber(pos_action)); +} + +/* Function Name: FindMenu + * Description: Find the menu give a name and reference widget. + * Arguments: widget - reference widget. + * name - the menu widget's name. + * Returns: the menu widget or NULL. + */ + +static Widget +FindMenu(widget, name) +Widget widget; +String name; +{ + register Widget w, menu; + + for ( w = widget ; w != NULL ; w = XtParent(w) ) + if ( (menu = XtNameToWidget(w, name)) != NULL ) + return(menu); + return(NULL); +} + +/* Function Name: MoveMenu + * Description: Actually moves the menu, may force it to + * to be fully visable if menu_on_screen is TRUE. + * Arguments: w - the simple menu widget. + * x, y - the current location of the widget. + * Returns: none + */ + +static void +MoveMenu(w, x, y) +Widget w; +Position x, y; +{ + Arg arglist[2]; + Cardinal num_args = 0; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + if (smw->simple_menu.menu_on_screen) { + int width = w->core.width + 2 * w->core.border_width; + int height = w->core.height + 2 * w->core.border_width; + + if (x < 0) + x = 0; + else { + int scr_width = WidthOfScreen(XtScreen(w)); + if (x + width > scr_width) + x = scr_width - width; + } + + if (y < 0) + y = 0; + else { + int scr_height = HeightOfScreen(XtScreen(w)); + if (y + height > scr_height) + y = scr_height - height; + } + } + + XtSetArg(arglist[num_args], XtNx, x); num_args++; + XtSetArg(arglist[num_args], XtNy, y); num_args++; + XtSetValues(w, arglist, num_args); +} + +/* Function Name: PositionMenu + * Description: Places the menu + * Arguments: w - the simple menu widget. + * location - a pointer the the position or NULL. + * Returns: none. + */ + +static void +PositionMenu(w, location) +Widget w; +XPoint * location; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry; + XPoint t_point; + + if (location == NULL) { + Window junk1, junk2; + int root_x, root_y, junkX, junkY; + unsigned int junkM; + + location = &t_point; + if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, + &root_x, &root_y, &junkX, &junkY, &junkM) == False) { + char error_buf[BUFSIZ]; + sprintf(error_buf, "%s %s", "Xaw - SimpleMenuWidget:", + "Could not find location of mouse pointer"); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + location->x = (short) root_x; + location->y = (short) root_y; + } + + /* + * The width will not be correct unless it is realized. + */ + + XtRealizeWidget(w); + + location->x -= (Position) w->core.width/2; + + if (smw->simple_menu.popup_entry == NULL) + entry = smw->simple_menu.label; + else + entry = smw->simple_menu.popup_entry; + + if (entry != NULL) + location->y -= entry->rectangle.y + entry->rectangle.height/2; + + MoveMenu(w, (Position) location->x, (Position) location->y); +} + +/* Function Name: MakeSetValuesRequest + * Description: Makes a (possibly recursive) call to SetValues, + * I take great pains to not go into an infinite loop. + * Arguments: w - the simple menu widget. + * width, height - the size of the ask for. + * Returns: none + */ + +static void +MakeSetValuesRequest(w, width, height) +Widget w; +Dimension width, height; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Arg arglist[2]; + Cardinal num_args = (Cardinal) 0; + + if ( !smw->simple_menu.recursive_set_values ) { + if ( (smw->core.width != width) || (smw->core.height != height) ) { + smw->simple_menu.recursive_set_values = TRUE; + XtSetArg(arglist[num_args], XtNwidth, width); num_args++; + XtSetArg(arglist[num_args], XtNheight, height); num_args++; + XtSetValues(w, arglist, num_args); + } + else if (XtIsRealized( (Widget) smw)) + Redisplay((Widget) smw, (XEvent *) NULL, (Region) NULL); + } + smw->simple_menu.recursive_set_values = False; +} + +/* Function Name: GetMenuWidth + * Description: Sets the length of the widest entry in pixels. + * Arguments: w - the simple menu widget. + * Returns: width of menu. + */ + +static Dimension +GetMenuWidth(w, w_ent) +Widget w, w_ent; +{ + SmeObject cur_entry = (SmeObject) w_ent; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Dimension width, widest = (Dimension) 0; + SmeObject * entry; + + if ( smw->simple_menu.menu_width ) + return(smw->core.width); + + ForAllChildren(smw, entry) { + XtWidgetGeometry preferred; + + if (!XtIsManaged( (Widget) *entry)) continue; + + if (*entry != cur_entry) { + XtQueryGeometry((Widget)*entry, NULL, &preferred); + + if (preferred.request_mode & CWWidth) + width = preferred.width; + else + width = (*entry)->rectangle.width; + } + else + width = (*entry)->rectangle.width; + + if ( width > widest ) + widest = width; + } + + return(widest); +} + +/* Function Name: GetMenuHeight + * Description: Sets the length of the widest entry in pixels. + * Arguments: w - the simple menu widget. + * Returns: width of menu. + */ + +static Dimension +GetMenuHeight(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + Dimension height; + + if (smw->simple_menu.menu_height) + return(smw->core.height); + + height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin; + + if (smw->simple_menu.row_height == 0) + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget) *entry)) + height += (*entry)->rectangle.height; + else + height += smw->simple_menu.row_height * smw->composite.num_children; + + return(height); +} + +/* Function Name: GetEventEntry + * Description: Gets an entry given an event that has X and Y coords. + * Arguments: w - the simple menu widget. + * event - the event. + * Returns: the entry that this point is in. + */ + +static SmeObject +GetEventEntry(w, event) +Widget w; +XEvent * event; +{ + Position x_loc, y_loc; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + + switch (event->type) { + case MotionNotify: + x_loc = event->xmotion.x; + y_loc = event->xmotion.y; + break; + case EnterNotify: + case LeaveNotify: + x_loc = event->xcrossing.x; + y_loc = event->xcrossing.y; + break; + case ButtonPress: + case ButtonRelease: + x_loc = event->xbutton.x; + y_loc = event->xbutton.y; + break; + default: + XtAppError(XtWidgetToApplicationContext(w), + "Unknown event type in GetEventEntry()."); + break; + } + + if ( (x_loc < 0) || (x_loc >= smw->core.width) || (y_loc < 0) || + (y_loc >= smw->core.height) ) + return(NULL); + + ForAllChildren(smw, entry) { + if (!XtIsManaged ((Widget) *entry)) continue; + + if ( ((*entry)->rectangle.y <= y_loc) && + ((*entry)->rectangle.y + (*entry)->rectangle.height >= y_loc) ) + if ( *entry == smw->simple_menu.label ) + return(NULL); /* cannot select the label. */ + else + return(*entry); + } + + return(NULL); +} diff --git a/vendor/x11iraf/obm/ObmW/Slider2.c b/vendor/x11iraf/obm/ObmW/Slider2.c new file mode 100644 index 00000000..0e21638d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Slider2.c @@ -0,0 +1,640 @@ +/* Generated by wbuild from "Slider2.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "stip4.bm" +#include <stdio.h> +#include "Slider2P.h" +static void start( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void finish( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void drag( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"start", start}, +{"finish", finish}, +{"drag", drag}, +}; + +static char defaultTranslations[] = "\ +<Btn1Down>: start() \n\ +<Btn1Motion>: drag() \n\ +<Btn1Up>: finish() \n\ +"; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void compute_thumb( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +static void compute_inside( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void move_thumb( +#if NeedFunctionPrototypes +Widget,int ,int ,int ,int ,int ,int +#endif +); +static void compute_info( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension *,float *,float *,float *,float * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void scroll_response( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +static void create_gc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_graygc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_thumbgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_thumblightgc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_thumbdarkgc( +#if NeedFunctionPrototypes +Widget +#endif +); +/*ARGSUSED*/static void create_gc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfSlider2Widget)self)->xfwfLabel.gc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfLabel.gc); + values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + values.foreground = ((XfwfSlider2Widget)self)->xfwfLabel.foreground; + values.font = ((XfwfSlider2Widget)self)->xfwfLabel.font->fid; + mask = GCFont | GCBackground | GCForeground; + ((XfwfSlider2Widget)self)->xfwfLabel.gc = XtGetGC(self, mask, &values); + + if (((XfwfSlider2Widget)self)->xfwfLabel.rv_gc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfLabel.rv_gc); + values.foreground = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + values.background = ((XfwfSlider2Widget)self)->xfwfLabel.foreground; + values.font = ((XfwfSlider2Widget)self)->xfwfLabel.font->fid; + mask = GCFont | GCBackground | GCForeground; + ((XfwfSlider2Widget)self)->xfwfLabel.rv_gc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_graygc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfSlider2Widget)self)->xfwfLabel.graygc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfLabel.graygc); + values.foreground = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + values.stipple = + XCreateBitmapFromData(XtDisplay(self), + RootWindowOfScreen(XtScreen(self)), + stip4_bits, stip4_width, stip4_height); + values.fill_style = FillStippled; + mask = GCForeground | GCStipple | GCFillStyle; + ((XfwfSlider2Widget)self)->xfwfLabel.graygc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_thumbgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc); + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap != NULL) { + mask = GCTile | GCFillStyle; + values.tile = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap; + values.fill_style = FillTiled; + } else { + mask = GCForeground; + values.foreground = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + } + ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_thumblightgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc); + switch (((XfwfSlider2Widget)self)->xfwfFrame.shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = ((XfwfSlider2Widget)self)->xfwfFrame.topShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + values.stipple = ((XfwfSlider2Widget)self)->xfwfFrame.topShadowStipple; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen(self)) > 4 + && ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor, &values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + values.stipple = + XCreateBitmapFromData(XtDisplay(self), + RootWindowOfScreen(XtScreen(self)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_thumbdarkgc(self)Widget self; +{ + XtGCMask mask; + XGCValues values; + + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc != NULL) XtReleaseGC(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc); + switch (((XfwfSlider2Widget)self)->xfwfFrame.shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = ((XfwfSlider2Widget)self)->xfwfFrame.bottomShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.stipple = ((XfwfSlider2Widget)self)->xfwfFrame.bottomShadowStipple; + values.foreground = BlackPixelOfScreen(XtScreen(self)); + values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen(self)) > 4 + && ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor, &values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = ((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor; + values.foreground = WhitePixelOfScreen(XtScreen(self)); + values.stipple = + XCreateBitmapFromData(XtDisplay(self), + RootWindowOfScreen(XtScreen(self)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc = XtGetGC(self, mask, &values); +} + +static XtResource resources[] = { +{XtNthumbColor,XtCThumbColor,XtRPixel,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbColor),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbColor),XtRString,(XtPointer)XtDefaultBackground }, +{XtNthumbPixmap,XtCThumbPixmap,XtRPixmap,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbPixmap),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbPixmap),XtRImmediate,(XtPointer)NULL }, +{XtNminsize,XtCMinsize,XtRDimension,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.minsize),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.minsize),XtRImmediate,(XtPointer)20 }, +{XtNthumbFrameWidth,XtCThumbFrameWidth,XtRDimension,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbFrameWidth),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbFrameWidth),XtRImmediate,(XtPointer)2 }, +{XtNthumbFrameType,XtCThumbFrameType,XtRFrameType,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.thumbFrameType),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.thumbFrameType),XtRImmediate,(XtPointer)XfwfRaised }, +{XtNscrollCallback,XtCScrollCallback,XtRCallback,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.scrollCallback),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.scrollCallback),XtRImmediate,(XtPointer)NULL }, +{XtNscrollResponse,XtCScrollResponse,XtRXTCallbackProc,sizeof(((XfwfSlider2Rec*)NULL)->xfwfSlider2.scrollResponse),XtOffsetOf(XfwfSlider2Rec,xfwfSlider2.scrollResponse),XtRImmediate,(XtPointer)scroll_response }, +{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfSlider2Rec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfSlider2Rec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)2 }, +{XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfSlider2Rec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfSlider2Rec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfSunken }, +}; + +XfwfSlider2ClassRec xfwfSlider2ClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfLabelClassRec, +"Slider2d", +sizeof(XfwfSlider2Rec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +3, +resources, +9, +NULLQUARK, +False , +XtExposeCompressMultiple |XtExposeGraphicsExpose , +False , +False , +NULL, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +defaultTranslations, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfLabel_class part */ +XtInherit_set_label, +}, +{ /* XfwfSlider2_class part */ +compute_thumb, +move_thumb, +compute_info, +scroll_response, +}, +}; +WidgetClass xfwfSlider2WidgetClass = (WidgetClass) &xfwfSlider2ClassRec; +/*ARGSUSED*/ +static void start(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + Dimension w, h; + Position x, y; + XfwfScrollInfo info; + Boolean outside = False; + + if (event->type != ButtonPress && event->type != ButtonRelease + && event->type != MotionNotify) + XtError("The start action must be bound to a mouse event"); + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &x, &y, &w, &h); + if (event->xbutton.x < x) { /* Left of thumb */ + info.reason = XfwfSPageLeft; + info.flags = XFWF_HPOS; /* Suggest a value: */ + info.hpos = max(0.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x - ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd); + outside = True; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info); + } + if (event->xbutton.x >= x + w) { /* Right of thumb */ + info.reason = XfwfSPageRight; + info.flags = XFWF_HPOS; /* Suggest a value: */ + info.hpos = min(1.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd); + outside = True; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info); + } + if (event->xbutton.y < y) { /* Above thumb */ + info.reason = XfwfSPageUp; + info.flags = XFWF_VPOS; /* Suggest a value: */ + info.vpos = max(0.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y - ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht); + outside = True; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info); + } + if (event->xbutton.y >= y + h) { /* Below thumb */ + info.reason = XfwfSPageDown; + info.flags = XFWF_VPOS; /* Suggest a value: */ + info.vpos = min(1.0, ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht); + outside = True; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info); + } + if (! outside) { /* Inside the thumb */ + ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = True; + ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_x = x - event->xbutton.x; + ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_y = y - event->xbutton.y; + } +} + +/*ARGSUSED*/ +static void finish(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XfwfScrollInfo info; + + if (((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress) { + ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = False; + info.reason = XfwfSMove; + info.flags = XFWF_VPOS | XFWF_HPOS; + info.hpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x; + info.vpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info); + } +} + +/*ARGSUSED*/ +static void drag(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XfwfScrollInfo info; + Dimension wd, ht, fwd, fht; + Position oldx, oldy, newx, newy, fx, fy; + float dum1, dum2; + + if (! ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress) return; + if (event->type != ButtonPress && event->type != ButtonRelease + && event->type != MotionNotify) + XtError("The drag action must be bound to a mouse event"); + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &oldx, &oldy, &wd, &ht); + newx = event->xbutton.x + ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_x; + newy = event->xbutton.y + ((XfwfSlider2Widget)self)->xfwfSlider2.m_delta_y; + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_info(self, &newx, &newy, &wd, &ht, &((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x, &((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y,&dum1,&dum2); + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.move_thumb(self, oldx, oldy, wd, ht, newx, newy); + info.reason = XfwfSDrag; + info.flags = XFWF_VPOS | XFWF_HPOS; + info.hpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x; + info.vpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &info); +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfSlider2WidgetClass c = (XfwfSlider2WidgetClass) class; + XfwfSlider2WidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfSlider2WidgetClass) return; + super = (XfwfSlider2WidgetClass)class->core_class.superclass; + if (c->xfwfSlider2_class.compute_thumb == XtInherit_compute_thumb) + c->xfwfSlider2_class.compute_thumb = super->xfwfSlider2_class.compute_thumb; + if (c->xfwfSlider2_class.move_thumb == XtInherit_move_thumb) + c->xfwfSlider2_class.move_thumb = super->xfwfSlider2_class.move_thumb; + if (c->xfwfSlider2_class.compute_info == XtInherit_compute_info) + c->xfwfSlider2_class.compute_info = super->xfwfSlider2_class.compute_info; + if (c->xfwfSlider2_class.scroll_response == XtInherit_scroll_response) + c->xfwfSlider2_class.scroll_response = super->xfwfSlider2_class.scroll_response; +} +/*ARGSUSED*/static void compute_thumb(self,x,y,width,height)Widget self;Position * x;Position * y;Dimension * width;Dimension * height; +{ + Position fx, fy; + Dimension fw, fh; + + xfwfLabelClassRec.xfwfCommon_class.compute_inside(self, &fx, &fy, &fw, &fh); + *width = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd * fw + 0.5; + *height = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht * fh + 0.5; + if (*width < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize) *width = min(fw, ((XfwfSlider2Widget)self)->xfwfSlider2.minsize); + if (*height < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize) *height = min(fh, ((XfwfSlider2Widget)self)->xfwfSlider2.minsize); + *x = fx + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x * (fw - *width) + 0.5; + *y = fy + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y * (fh - *height) + 0.5; +} +/*ARGSUSED*/static void compute_inside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h; +{ + int tmp; + + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, x, y, w, h); + *x += ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth; + *y += ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth; + tmp = *w - 2 * ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth; *w = (tmp < 0) ? 0 : tmp; + tmp = *h - 2 * ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth; *h = (tmp < 0) ? 0 : tmp; +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + Position x, y; + Dimension wd, ht; + + if (! XtIsRealized(self)) return; + if (region != NULL) { + XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc, region); + XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc, region); + XSetRegion(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc, region); + } + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &x, &y, &wd, &ht); + XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc, x, y, wd, ht); + XfwfDrawFrame(self, x, y, wd, ht, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameType, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth, + ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc, ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc); + if (region != NULL) { + XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbgc, None); + XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc, None); + XSetClipMask(XtDisplay(self), ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc, None); + } + xfwfLabelClassRec.core_class.expose(self, event, region); +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y = 0.0; + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht = 1.0; + ((XfwfSlider2Widget)self)->xfwfSlider2.drag_in_progress = False; + create_thumbgc(self); + create_gc(self); + create_graygc(self); + ((XfwfSlider2Widget)self)->xfwfSlider2.thumblightgc = NULL; create_thumblightgc(self); + ((XfwfSlider2Widget)self)->xfwfSlider2.thumbdarkgc = NULL; create_thumbdarkgc(self); +} +/*ARGSUSED*/static void move_thumb(self,oldx,oldy,wd,ht,newx,newy)Widget self;int oldx;int oldy;int wd;int ht;int newx;int newy; +{ + int h; + + XCopyArea(XtDisplay(self), XtWindow(self), XtWindow(self), + DefaultGCOfScreen(XtScreen(self)), + oldx, oldy, wd, ht, newx, newy); + /* First check if the old and new areas do not overlap */ + if (newx + wd <= oldx || oldx + wd <= newx + || newy + ht <= oldy || oldy + ht <= newy) { + XClearArea(XtDisplay(self), XtWindow(self), oldx, oldy, wd, ht, False); + return; + } else { /* They do overlap */ + h = oldy - newy; + if (h > 0) + XClearArea(XtDisplay(self), XtWindow(self), oldx, newy + ht, wd,h,False); + else if (h < 0) + XClearArea(XtDisplay(self), XtWindow(self), oldx, oldy, wd, -h, False); + if (newx < oldx) + XClearArea(XtDisplay(self), XtWindow(self), newx + wd, + max(oldy, newy), oldx - newx, ht - abs(h), False); + else if (oldx < newx) + XClearArea(XtDisplay(self), XtWindow(self), oldx, max(oldy, newy), + newx - oldx, ht - abs(h), False); + } +} +/*ARGSUSED*/static void compute_info(self,x,y,w,h,thumb_x,thumb_y,thumb_wd,thumb_ht)Widget self;Position * x;Position * y;Dimension * w;Dimension * h;float * thumb_x;float * thumb_y;float * thumb_wd;float * thumb_ht; +{ + Dimension fw, fh; + Position fx, fy; + + xfwfLabelClassRec.xfwfCommon_class.compute_inside(self, &fx, &fy, &fw, &fh); + *w = min(fw, max(((XfwfSlider2Widget)self)->xfwfSlider2.minsize, *w)); + *h = min(fh, max(((XfwfSlider2Widget)self)->xfwfSlider2.minsize, *h)); + *x = min(fx + fw - *w, max(fx, *x)); + *y = min(fy + fh - *h, max(fy, *y)); + *thumb_wd = ((float) *w)/fw; + *thumb_ht = ((float) *h)/fh; + *thumb_x = (*w == fw) ? 0.0 : ((float) (*x - fx))/(fw - *w); + *thumb_y = (*h == fh) ? 0.0 : ((float) (*y - fy))/(fh - *h); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean need_redisplay = False; + Position x, y; + Dimension w, h; + + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbPixmap) { + create_thumbgc(self); + need_redisplay = True; + } else if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbColor != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbColor) { + ((XfwfSlider2Widget)self)->xfwfSlider2.thumbPixmap = NULL; + create_thumbgc(self); + need_redisplay = True; + } + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameWidth != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbFrameWidth) + need_redisplay = True; + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumbFrameType != ((XfwfSlider2Widget)old)->xfwfSlider2.thumbFrameType) + need_redisplay = True; + if (((XfwfSlider2Widget)self)->xfwfSlider2.minsize != ((XfwfSlider2Widget)old)->xfwfSlider2.minsize) { + compute_thumb(old, &x, &y, &w, &h); + if (w < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize || h < ((XfwfSlider2Widget)self)->xfwfSlider2.minsize) need_redisplay = True; + } + if (((XfwfSlider2Widget)self)->xfwfSlider2.scrollResponse != ((XfwfSlider2Widget)old)->xfwfSlider2.scrollResponse) { + ((XfwfSlider2Widget)self)->xfwfSlider2.scrollResponse = ((XfwfSlider2Widget)old)->xfwfSlider2.scrollResponse; + XtWarning("scrollResponse resource may only be queried, not set"); + } + return need_redisplay; +} +/*ARGSUSED*/static void scroll_response(wdg,client_data,call_data)Widget wdg;XtPointer client_data;XtPointer call_data; +{ + Widget self = (Widget) client_data; + XfwfScrollInfo *inf = (XfwfScrollInfo *)call_data; + XfwfScrollInfo new_info; + float x, y, w, h; + Position newx, newy, oldx, oldy; + Dimension newwd, newht, oldwd, oldht, wd, ht; + XEvent event; + XRectangle rect; + Region clip; + Display *dpy = XtDisplay(self); + + x = (inf->flags&XFWF_HPOS) && range(inf->hpos) ? inf->hpos : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x; + y = (inf->flags&XFWF_VPOS) && range(inf->vpos) ? inf->vpos : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y; + w = (inf->flags&XFWF_HSIZE) && range(inf->hsize) ? inf->hsize : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd; + h = (inf->flags&XFWF_VSIZE) && range(inf->vsize) ? inf->vsize : ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht; + + if (((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd != w || ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht != h) { /* Size changed */ + if (XtIsRealized(self)) + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &oldx, &oldy, &oldwd, &oldht); + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd = w; + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht = h; + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x = x; + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y = y; + if (XtIsRealized(self)) { + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &newx, &newy, &newwd, &newht); + XClearArea(dpy, XtWindow(self), oldx, oldy, oldwd, oldht, False); + event.xexpose.x = rect.x = newx; + event.xexpose.y = rect.y = newy; + event.xexpose.width = rect.width = newwd; + event.xexpose.height = rect.height = newht; + clip = XCreateRegion(); + XUnionRectWithRegion(&rect, clip, clip); + ((XfwfSlider2WidgetClass)self->core.widget_class)->core_class.expose(self, &event, clip); + XDestroyRegion(clip); + } + } else if (((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x != x || ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y != y) { /* Only position changed */ + if (XtIsRealized(self)) + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &oldx, &oldy, &wd, &ht); + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x = x; + ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y = y; + if (XtIsRealized(self)) { + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.compute_thumb(self, &newx, &newy, &wd, &ht); + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.move_thumb(self, oldx, oldy, wd, ht, newx, newy); + } + } + + if (inf->reason != XfwfSNotify) { + new_info = *inf; + new_info.reason = XfwfSNotify; + XtCallCallbackList(self, ((XfwfSlider2Widget)self)->xfwfSlider2.scrollCallback, &new_info); + } +} +/*ARGSUSED*/void XfwfGetThumb(self,info)Widget self;XfwfScrollInfo * info; +{ + if (! XtIsSubclass(self, xfwfSlider2WidgetClass)) + XtError("XfwfGetThumb called with incorrect widget type"); + info->reason = XfwfSNotify; + info->flags = XFWF_VPOS | XFWF_VSIZE | XFWF_HPOS | XFWF_HSIZE; + info->vpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_y; + info->vsize = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_ht; + info->hpos = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_x; + info->hsize = ((XfwfSlider2Widget)self)->xfwfSlider2.thumb_wd; +} +/*ARGSUSED*/void XfwfMoveThumb(self,x,y)Widget self;double x;double y; +{ + XfwfScrollInfo info; + + if (! XtIsSubclass(self, xfwfSlider2WidgetClass)) + XtError("XfwfMoveThumb called with incorrect widget type"); + if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0) + XtError("XfwfMoveThumb called with incorrect arguments"); + + info.flags = XFWF_VPOS | XFWF_HPOS; + info.reason = XfwfSNotify; + info.vpos = y; + info.hpos = x; + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.scroll_response(NULL, self, &info); +} +/*ARGSUSED*/void XfwfResizeThumb(self,wd,ht)Widget self;double wd;double ht; +{ + XfwfScrollInfo info; + + if (! XtIsSubclass(self, xfwfSlider2WidgetClass)) + XtError("XfwfResizeThumb called with incorrect widget type"); + if (wd < 0.0 || wd > 1.0 || ht < 0.0 || ht > 1.0) + XtError("XfwfResizeThumb called with incorrect arguments"); + + info.reason = XfwfSNotify; + info.flags = XFWF_VSIZE | XFWF_HSIZE; + info.vsize = ht; + info.hsize = wd; + ((XfwfSlider2WidgetClass)self->core.widget_class)->xfwfSlider2_class.scroll_response(NULL, self, &info); +} diff --git a/vendor/x11iraf/obm/ObmW/Slider2.h b/vendor/x11iraf/obm/ObmW/Slider2.h new file mode 100644 index 00000000..962590b7 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Slider2.h @@ -0,0 +1,96 @@ +/* Generated by wbuild from "Slider2.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfSlider2_H_ +#define _XfwfSlider2_H_ +#include "Label.h" +#include "scroll.h" +void XfwfGetThumb( +#if NeedFunctionPrototypes +Widget,XfwfScrollInfo * +#endif +); +void XfwfMoveThumb( +#if NeedFunctionPrototypes +Widget,double ,double +#endif +); +void XfwfResizeThumb( +#if NeedFunctionPrototypes +Widget,double ,double +#endif +); +#ifndef XtNthumbColor +#define XtNthumbColor "thumbColor" +#endif +#ifndef XtCThumbColor +#define XtCThumbColor "ThumbColor" +#endif +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNthumbPixmap +#define XtNthumbPixmap "thumbPixmap" +#endif +#ifndef XtCThumbPixmap +#define XtCThumbPixmap "ThumbPixmap" +#endif +#ifndef XtRPixmap +#define XtRPixmap "Pixmap" +#endif + +#ifndef XtNminsize +#define XtNminsize "minsize" +#endif +#ifndef XtCMinsize +#define XtCMinsize "Minsize" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNthumbFrameWidth +#define XtNthumbFrameWidth "thumbFrameWidth" +#endif +#ifndef XtCThumbFrameWidth +#define XtCThumbFrameWidth "ThumbFrameWidth" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNthumbFrameType +#define XtNthumbFrameType "thumbFrameType" +#endif +#ifndef XtCThumbFrameType +#define XtCThumbFrameType "ThumbFrameType" +#endif +#ifndef XtRFrameType +#define XtRFrameType "FrameType" +#endif + +#ifndef XtNscrollCallback +#define XtNscrollCallback "scrollCallback" +#endif +#ifndef XtCScrollCallback +#define XtCScrollCallback "ScrollCallback" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +#ifndef XtNscrollResponse +#define XtNscrollResponse "scrollResponse" +#endif +#ifndef XtCScrollResponse +#define XtCScrollResponse "ScrollResponse" +#endif +#ifndef XtRXTCallbackProc +#define XtRXTCallbackProc "XTCallbackProc" +#endif + +typedef struct _XfwfSlider2ClassRec *XfwfSlider2WidgetClass; +typedef struct _XfwfSlider2Rec *XfwfSlider2Widget; +externalref WidgetClass xfwfSlider2WidgetClass; +#endif /*_XfwfSlider2_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Slider2.man b/vendor/x11iraf/obm/ObmW/Slider2.man new file mode 100644 index 00000000..399250bb --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Slider2.man @@ -0,0 +1,1068 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfSlider2 +.SH DESCRIPTION +A Slider2 widget consists of a rectangular area in which a `thumb' can be +moved about. A Slider2 is typically used to pan or scroll another window; as +such is can replace two scrollbars. The thumb can be dragged with the mouse, +or the mouse can be clicked next to the thumb, to move it in the direction of +the mouse. The thumb may contain one or more lines of text, although there +is usually no room for more than one or two words. + +The widget has three callbacks. The thumb position and size are not +controled by resources, but by calling a function. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfSlider2 +Name Class Type Default +XtNthumbColor XtCThumbColor Pixel XtDefaultBackground +XtNthumbPixmap XtCThumbPixmap Pixmap NULL +XtNminsize XtCMinsize Dimension 20 +XtNthumbFrameWidth XtCThumbFrameWidth Dimension 2 +XtNthumbFrameType XtCThumbFrameType FrameType XfwfRaised +XtNscrollCallback XtCScrollCallback Callback NULL +XtNscrollResponse XtCScrollResponse XTCallbackProc scroll_response + +.TE +.ps + +.TP +.I "XtNthumbColor" +The color of the thumb is by default set to the default background +color of the display, but it can be changed with the \fIthumbColor\fP +resource. It is also possible to tile the thumb with a pixmap, see +below. + + + +.hi + +.nf +Pixel thumbColor = <String>XtDefaultBackground +.fi + +.eh + +.TP +.I "XtNthumbPixmap" +Instead of a color, the thumb can also be tiled with a pixmap. +However, there is currently no converter from string to pixmap, so +this resource can only be set from the application, not from resource +files. + +If both \fIthumbColor\fP and \fIthumbPixmap\fP are set, the pixmap takes +precedence. + + + +.hi + +.nf +Pixmap thumbPixmap = NULL +.fi + +.eh + +.TP +.I "XtNminsize" +The minimum size of the thumb is by default 20 pixels. It can be set +with the \fIminsize\fP resource. + + + +.hi + +.nf +Dimension minsize = 20 +.fi + +.eh + +.TP +.I "XtNthumbFrameWidth" +The width of the frame around the thumb is independent of the frame +around the whole widget. It can be set with \fIthumbFrameWidth\fP. + + + +.hi + +.nf +Dimension thumbFrameWidth = 2 +.fi + +.eh + +.TP +.I "XtNthumbFrameType" +The style of the frame around the thumb is set with +\fIthumbFrameType\fP. By default, it is \fIXfwfRaised\fP. Note that there are no +resources to control the shadow scheme of the thumb independently from +that of the outer frame. That means that the resources \fIshadowScheme\fP, +\fItopShadowColor\fP, \fItopShadowStipple\fP, etc, also influence the frame of the +thumb. + + + +.hi + +.nf +FrameType thumbFrameType = XfwfRaised +.fi + +.eh + +.TP +.I "XtNscrollCallback" +The routines on the callback list are called whenever the user +manipulates the slider and also when the Slider2 receives a call on +its \fIscrollResponse\fP function with a reason other than \fIXfwfSNotify\fP. + +The \fIcall_data\fP parameter of the callback routines is a pointer +to an \fIXfwfScrollInfo\fP structure, which looks like this: \fItypedef +struct _XfwfScrollInfo { XfwfSReason reason; XfwfSFlags flags; float +vpos, vsize, hpos, hsize;} XfwfScrollInfo\fP. + + + +.hi + +.nf +<Callback> XtCallbackList scrollCallback = NULL +.fi + +.eh + +.TP +.I "XtNscrollResponse" +The Slider2 widget provides has a method for dealing with scroll +requests from the application or from other widgets. A pointer to that +function can be retrieved with \fIXtGetValues\fP as the resource +\fIXtNscrollResponse\fP. This resource can only be queried, not set. + + + +.hi + +.nf +XtCallbackProc scrollResponse = scroll_response +.fi + +.eh + +.TP +.I "XtNframeWidth" +The default frame width is changed from 0 to 2. + + + +.hi + +.nf + frameWidth = 2 +.fi + +.eh + +.TP +.I "XtNframeType" +The default frame type is now \fIXfwfSunken\fP. + + + +.hi + +.nf + frameType = XfwfSunken +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfLabel +Name Class Type Default +XtNlabel XtCLabel String NULL +XtNtablist XtCTablist String NULL +XtNfont XtCFont FontStruct XtDefaultFont +XtNforeground XtCForeground Pixel XtDefaultForeground +XtNalignment XtCAlignment Alignment 0 +XtNtopMargin XtCTopMargin Dimension 2 +XtNbottomMargin XtCBottomMargin Dimension 2 +XtNleftMargin XtCLeftMargin Dimension 2 +XtNrightMargin XtCRightMargin Dimension 2 +XtNshrinkToFit XtCShrinkToFit Boolean False +XtNrvStart XtCRvStart Int 0 +XtNrvLength XtCRvLength Int 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Exports" + +The \fIscroll.h\fP header file is needed for the \fIXfwfScrollInfo\fP +structure. + +.nf + +.B incl + <Xfwf/scroll.h> +.fi + +The current size and position of the thumb can be queried with the +function \fIgetThumb\fP. It fills the \fIinfo\fP argument with the current values. + +.nf +XfwfGetThumb( $, XfwfScrollInfo * info) +.fi + +.hi +{ + if (! XtIsSubclass($, xfwfSlider2WidgetClass)) + XtError("XfwfGetThumb called with incorrect widget type"); + info->reason = XfwfSNotify; + info->flags = XFWF_VPOS | XFWF_VSIZE | XFWF_HPOS | XFWF_HSIZE; + info->vpos = $thumb_y; + info->vsize = $thumb_ht; + info->hpos = $thumb_x; + info->hsize = $thumb_wd; +} +.eh + +To change the position of the thumb, a call to \fImoveThumb\fP can be +used. The arguments must be two numbers between 0 and 1. The thumb +is moved with \fIXCopyArea\fP. + +This is a convenience function. The standard interface is through the +\fIscrollResponse\fP resource. In the Slider2 widget, that resource is +connected to the \fIscroll_response\fP method. + +.nf +XfwfMoveThumb( $, double x, double y) +.fi + +.hi +{ + XfwfScrollInfo info; + + if (! XtIsSubclass($, xfwfSlider2WidgetClass)) + XtError("XfwfMoveThumb called with incorrect widget type"); + if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0) + XtError("XfwfMoveThumb called with incorrect arguments"); + + info.flags = XFWF_VPOS | XFWF_HPOS; + info.reason = XfwfSNotify; + info.vpos = y; + info.hpos = x; + $scroll_response(NULL, $, info); +} +.eh + +Resizing the thumb is done with \fIresizeThumb\fP. The two arguments +must be between 0 and 1. + +This is a convenience function. The standard interface is through the +\fIscrollResponse\fP resource. In the Slider2 widget, that resource is +connected to the \fIscroll_response\fP method. + +.nf +XfwfResizeThumb( $, double wd, double ht) +.fi + +.hi +{ + XfwfScrollInfo info; + + if (! XtIsSubclass($, xfwfSlider2WidgetClass)) + XtError("XfwfResizeThumb called with incorrect widget type"); + if (wd < 0.0 || wd > 1.0 || ht < 0.0 || ht > 1.0) + XtError("XfwfResizeThumb called with incorrect arguments"); + + info.reason = XfwfSNotify; + info.flags = XFWF_VSIZE | XFWF_HSIZE; + info.vsize = ht; + info.hsize = wd; + $scroll_response(NULL, $, info); +} +.eh + +.SS "Translations" + +The \fIstart\fP action should be bound to a mouse button press, because it +needs the coordinates of the mouse. The \fIdrag\fP action is bound to mouse +movement and the \fIfinish\fP action is normally bound to a release of the +mouse button. + +.nf +<Btn1Down>: start() +.fi + +.nf +<Btn1Motion>: drag() +.fi + +.nf +<Btn1Up>: finish() +.fi + +.hi +.SS "Actions" + +.TP +.I "start + +The \fIstart\fP action checks the position of the mouse and if it was +outside the thumb, it calls the \fIscrollCallback\fP. Otherwise, it only +records the position. Note that the mouse may have been to the left as +well as below the thumb, causing the callbacks to be called twice. + +.hi + +.nf +void start($, XEvent* event, String* params, Cardinal* num_params) +{ + Dimension w, h; + Position x, y; + XfwfScrollInfo info; + Boolean outside = False; + + if (event->type != ButtonPress event->type != ButtonRelease + event->type != MotionNotify) + XtError("The start action must be bound to a mouse event"); + $compute_thumb($, x, y, w, h); + if (event->xbutton.x < x) { /* Left of thumb */ + info.reason = XfwfSPageLeft; + info.flags = XFWF_HPOS; /* Suggest a value: */ + info.hpos = max(0.0, $thumb_x - $thumb_wd); + outside = True; + XtCallCallbackList($, $scrollCallback, info); + } + if (event->xbutton.x >= x + w) { /* Right of thumb */ + info.reason = XfwfSPageRight; + info.flags = XFWF_HPOS; /* Suggest a value: */ + info.hpos = min(1.0, $thumb_x + $thumb_wd); + outside = True; + XtCallCallbackList($, $scrollCallback, info); + } + if (event->xbutton.y < y) { /* Above thumb */ + info.reason = XfwfSPageUp; + info.flags = XFWF_VPOS; /* Suggest a value: */ + info.vpos = max(0.0, $thumb_y - $thumb_ht); + outside = True; + XtCallCallbackList($, $scrollCallback, info); + } + if (event->xbutton.y >= y + h) { /* Below thumb */ + info.reason = XfwfSPageDown; + info.flags = XFWF_VPOS; /* Suggest a value: */ + info.vpos = min(1.0, $thumb_y + $thumb_ht); + outside = True; + XtCallCallbackList($, $scrollCallback, info); + } + if (! outside) { /* Inside the thumb */ + $drag_in_progress = True; + $m_delta_x = x - event->xbutton.x; + $m_delta_y = y - event->xbutton.y; + } +} +.fi + +.eh + +.TP +.I "finish + +The \fIfinish\fP action does nothing if this is the end of a +click outside the thumb. The callbacks for this event have already +been called. + +If this is the end of a drag action, we reset the flag +\fIdrag_in_progress\fP to False and call the drop callbacks. + +.hi + +.nf +void finish($, XEvent* event, String* params, Cardinal* num_params) +{ + XfwfScrollInfo info; + + if ($drag_in_progress) { + $drag_in_progress = False; + info.reason = XfwfSMove; + info.flags = XFWF_VPOS | XFWF_HPOS; + info.hpos = $thumb_x; + info.vpos = $thumb_y; + XtCallCallbackList($, $scrollCallback, info); + } +} +.fi + +.eh + +.TP +.I "drag + +An application that can draw fast enough, may wish to redraw with +every movement of the thumb, instead of only at the end of the drag +action. The drag callback is provided for this purpose. It is called +in the same way as the drop callback, with the current relative +position of the thumb. + +.hi + +.nf +void drag($, XEvent* event, String* params, Cardinal* num_params) +{ + XfwfScrollInfo info; + Dimension wd, ht, fwd, fht; + Position oldx, oldy, newx, newy, fx, fy; + float dum1, dum2; + + if (! $drag_in_progress) return; + if (event->type != ButtonPress event->type != ButtonRelease + event->type != MotionNotify) + XtError("The drag action must be bound to a mouse event"); + $compute_thumb($, oldx, oldy, wd, ht); + newx = event->xbutton.x + $m_delta_x; + newy = event->xbutton.y + $m_delta_y; + $compute_info($, newx, newy, wd, ht, $thumb_x, $thumb_y,dum1,dum2); + $move_thumb($, oldx, oldy, wd, ht, newx, newy); + info.reason = XfwfSDrag; + info.flags = XFWF_VPOS | XFWF_HPOS; + info.hpos = $thumb_x; + info.vpos = $thumb_y; + XtCallCallbackList($, $scrollCallback, info); +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +.nf + +.B incl + "stip4.bm" +.fi + +.nf + +.B incl + <stdio.h> +.fi + +.hi + +.hi +.SS "Private variables" + +The position and size of the thumb are controlled by four variables +that can assume values between 0 and 1. If \fIthumb_x\fP is 0, the thumb +is located against the left side, if it is 1, the thumb is put against +the right side. + +If \fIthumb_wd\fP is 1, the thumb is as large as possible, if it is 0, it +will have its minimum width \fIminsize\fP. + +.nf +float thumb_x +.fi + +.nf +float thumb_y +.fi + +.nf +float thumb_wd +.fi + +.nf +float thumb_ht +.fi + +A boolean variable is set to when a draggin action has started, but +not yet finished. + +.nf +Boolean drag_in_progress +.fi + +During a drag operation, the thumb is kept at a fixed offset from +the moving mouse. The offset is stored in two local variables. + +.nf +int m_delta_x +.fi + +.nf +int m_delta_y +.fi + +We also need three more GC's for the thumb and the light and dark +parts of the thumb's frame. + +.nf +GC thumbgc +.fi + +.nf +GC thumblightgc +.fi + +.nf +GC thumbdarkgc +.fi + +.hi + +.hi +.SH "Class variables" + +The Core variable \fIcompress_exposure\fP is OR'ed with +\fIXtExposeGraphicsExpose\fP, in order to get graphics expose events delivered +to the \fIexpose\fP method. + +.nf +compress_exposure = XtExposeCompressMultiple |XtExposeGraphicsExpose +.fi + +.hi + +.hi +.SS "Methods" + +The \fIcompute_thumb\fP method returns the position and size of the +thumb in pixels. + +.nf +compute_thumb($, Position * x, Position * y, Dimension * width, Dimension * height) +{ + Position fx, fy; + Dimension fw, fh; + + #compute_inside($, fx, fy, fw, fh); + *width = $thumb_wd * fw + 0.5; + *height = $thumb_ht * fh + 0.5; + if (*width < $minsize) *width = min(fw, $minsize); + if (*height < $minsize) *height = min(fh, $minsize); + *x = fx + $thumb_x * (fw - *width) + 0.5; + *y = fy + $thumb_y * (fh - *height) + 0.5; +} +.fi + +The \fIcompute_inside\fP method of the Label class returns the area inside the +frame, but the label of Slider2 widget should appear in the thumb. Therefore +the \fIcompute_inside\fP method is redefined. This means that the \fIexpose\fP +method of the Label class can still be used, because it calls this function +to establish the position of the text. + +.nf +compute_inside($, Position * x, Position * y, Dimension * w, Dimension * h) +{ + int tmp; + + $compute_thumb($, x, y, w, h); + *x += $thumbFrameWidth; + *y += $thumbFrameWidth; + tmp = *w - 2 * $thumbFrameWidth; *w = (tmp < 0) ? 0 : tmp; + tmp = *h - 2 * $thumbFrameWidth; *h = (tmp < 0) ? 0 : tmp; +} +.fi + +The \fIexpose\fP method of the superclass is called to draw the outer frame +and the text inside the thumb. Only the frame of the thumb is drawn here. + +.nf +expose($, XEvent * event, Region region) +{ + Position x, y; + Dimension wd, ht; + + if (! XtIsRealized($)) return; + if (region != NULL) { + XSetRegion(XtDisplay($), $thumbgc, region); + XSetRegion(XtDisplay($), $thumbdarkgc, region); + XSetRegion(XtDisplay($), $thumblightgc, region); + } + $compute_thumb($, x, y, wd, ht); + XFillRectangle(XtDisplay($), XtWindow($), $thumbgc, x, y, wd, ht); + XfwfDrawFrame($, x, y, wd, ht, $thumbFrameType, $thumbFrameWidth, + $thumblightgc, $thumbdarkgc); + if (region != NULL) { + XSetClipMask(XtDisplay($), $thumbgc, None); + XSetClipMask(XtDisplay($), $thumbdarkgc, None); + XSetClipMask(XtDisplay($), $thumblightgc, None); + } + #expose($, event, region); +} +.fi + +The \fIinitialize\fP method only needs to set the local variables. The +\fIgraygc\fP that is inherited from Label has to be defined differently, +because it now should use the thumb's background, instead of the +widget's. (It still doesn't work right when the thumb is tiled with a +pixmap, however.) Likewise, \fIgc\fP and \fIrv_gc\fP must be defined +differently. The two new GC's are also initialized. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + $thumb_x = $thumb_y = 0.0; + $thumb_wd = $thumb_ht = 1.0; + $drag_in_progress = False; + create_thumbgc($); + create_gc($); + create_graygc($); + $thumblightgc = NULL; create_thumblightgc($); + $thumbdarkgc = NULL; create_thumbdarkgc($); +} +.fi + +The following routine's name, \fImove_thumb\fP, indicates what it is +used for, but not what it really does. It doesn't depend on the thumb +at all, it simply copies a rectangle to another position in the window +and clears the old rectangle to the background color. + +.nf +move_thumb($, int oldx, int oldy, int wd, int ht, int newx, int newy) +{ + int h; + + XCopyArea(XtDisplay($), XtWindow($), XtWindow($), + DefaultGCOfScreen(XtScreen($)), + oldx, oldy, wd, ht, newx, newy); + /* First check if the old and new areas do not overlap */ + if (newx + wd <= oldx || oldx + wd <= newx + || newy + ht <= oldy || oldy + ht <= newy) { + XClearArea(XtDisplay($), XtWindow($), oldx, oldy, wd, ht, False); + return; + } else { /* They do overlap */ + h = oldy - newy; + if (h > 0) + XClearArea(XtDisplay($), XtWindow($), oldx, newy + ht, wd,h,False); + else if (h < 0) + XClearArea(XtDisplay($), XtWindow($), oldx, oldy, wd, -h, False); + if (newx < oldx) + XClearArea(XtDisplay($), XtWindow($), newx + wd, + max(oldy, newy), oldx - newx, ht - abs(h), False); + else if (oldx < newx) + XClearArea(XtDisplay($), XtWindow($), oldx, max(oldy, newy), + newx - oldx, ht - abs(h), False); + } +} +.fi + +The \fIcompute_info\fP method computes the relative position and size of the +thumb, given its geometry in pixels. Before that, it makes sure the pixel +values are within the frame and it adapts the values if needed. + +.nf +compute_info($, Position * x, Position * y, Dimension * w, Dimension * h, float * thumb_x, float * thumb_y, float * thumb_wd, float * thumb_ht) +{ + Dimension fw, fh; + Position fx, fy; + + #compute_inside($, fx, fy, fw, fh); + *w = min(fw, max($minsize, *w)); + *h = min(fh, max($minsize, *h)); + *x = min(fx + fw - *w, max(fx, *x)); + *y = min(fy + fh - *h, max(fy, *y)); + *thumb_wd = ((float) *w)/fw; + *thumb_ht = ((float) *h)/fh; + *thumb_x = (*w == fw) ? 0.0 : ((float) (*x - fx))/(fw - *w); + *thumb_y = (*h == fh) ? 0.0 : ((float) (*y - fy))/(fh - *h); +} +.fi + +The \fIset_values\fP method changes the GC's when needed. +A change in \fIminsize\fP doesn't necessarily cause a redraw; only if +the current thumb size is less than the new minimum does the widget +needs to be redrawn. + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean need_redisplay = False; + Position x, y; + Dimension w, h; + + if ($thumbPixmap != $old$thumbPixmap) { + create_thumbgc($); + need_redisplay = True; + } else if ($thumbColor != $old$thumbColor) { + $thumbPixmap = NULL; + create_thumbgc($); + need_redisplay = True; + } + if ($thumbFrameWidth != $old$thumbFrameWidth) + need_redisplay = True; + if ($thumbFrameType != $old$thumbFrameType) + need_redisplay = True; + if ($minsize != $old$minsize) { + compute_thumb(old, x, y, w, h); + if (w < $minsize || h < $minsize) need_redisplay = True; + } + if ($scrollResponse != $old$scrollResponse) { + $scrollResponse = $old$scrollResponse; + XtWarning("scrollResponse resource may only be queried, not set"); + } + return need_redisplay; +} +.fi + +The method \fIscroll_response\fP is exported via the \fIscrollResponse\fP +resource. It has the format of a callback function, so that it can be +registered as a callback in the \fIscrollCallback\fP list of some other +widget. The \fIclient_data\fP must be a pointer to the Slider2 widget +itself, the \fIcall_data\fP is a pointer to an \fIXfwfScrollInfo\fP structure. +The widget \fIwdg\fP is the widget from whose callback list the function +is called. + +If the size of the thumb changed, the area must be cleared and redrawn +with \fIexpose\fP, but if only the position changed, the thumb can be +moved with the \fImove_thumb\fP method, which is much faster. + +\fBdef\fP range(x) = +(0.0 <=(x )(x )<=1.0 ) + +.nf +scroll_response(Widget wdg, XtPointer client_data, XtPointer call_data) +{ + Widget self = (Widget) client_data; + XfwfScrollInfo *inf = (XfwfScrollInfo *)call_data; + XfwfScrollInfo new_info; + float x, y, w, h; + Position newx, newy, oldx, oldy; + Dimension newwd, newht, oldwd, oldht, wd, ht; + XEvent event; + XRectangle rect; + Region clip; + Display *dpy = XtDisplay($); + + x = (inf->flagsXFWF_HPOS) range(inf->hpos) ? inf->hpos : $thumb_x; + y = (inf->flagsXFWF_VPOS) range(inf->vpos) ? inf->vpos : $thumb_y; + w = (inf->flagsXFWF_HSIZE) range(inf->hsize) ? inf->hsize : $thumb_wd; + h = (inf->flagsXFWF_VSIZE) range(inf->vsize) ? inf->vsize : $thumb_ht; + + if ($thumb_wd != w || $thumb_ht != h) { /* Size changed */ + if (XtIsRealized($)) + $compute_thumb($, oldx, oldy, oldwd, oldht); + $thumb_wd = w; + $thumb_ht = h; + $thumb_x = x; + $thumb_y = y; + if (XtIsRealized($)) { + $compute_thumb($, newx, newy, newwd, newht); + XClearArea(dpy, XtWindow($), oldx, oldy, oldwd, oldht, False); + event.xexpose.x = rect.x = newx; + event.xexpose.y = rect.y = newy; + event.xexpose.width = rect.width = newwd; + event.xexpose.height = rect.height = newht; + clip = XCreateRegion(); + XUnionRectWithRegion(rect, clip, clip); + $expose($, event, clip); + XDestroyRegion(clip); + } + } else if ($thumb_x != x || $thumb_y != y) { /* Only position changed */ + if (XtIsRealized($)) + $compute_thumb($, oldx, oldy, wd, ht); + $thumb_x = x; + $thumb_y = y; + if (XtIsRealized($)) { + $compute_thumb($, newx, newy, wd, ht); + $move_thumb($, oldx, oldy, wd, ht, newx, newy); + } + } + + if (inf->reason != XfwfSNotify) { + new_info = *inf; + new_info.reason = XfwfSNotify; + XtCallCallbackList($, $scrollCallback, new_info); + } +} +.fi + +.hi + +.hi +.SH "Utilities" + +The \fIcreate_gc\fP routine creates the GCs for the text. + +.nf +create_gc($) +{ + XtGCMask mask; + XGCValues values; + + if ($gc != NULL) XtReleaseGC($, $gc); + values.background = $thumbColor; + values.foreground = $foreground; + values.font = $font->fid; + mask = GCFont | GCBackground | GCForeground; + $gc = XtGetGC($, mask, values); + + if ($rv_gc != NULL) XtReleaseGC($, $rv_gc); + values.foreground = $thumbColor; + values.background = $foreground; + values.font = $font->fid; + mask = GCFont | GCBackground | GCForeground; + $rv_gc = XtGetGC($, mask, values); +} +.fi + +The \fIcreate_graygc\fP routine creates the GC that grays the label in +the thumb. + +.nf +create_graygc($) +{ + XtGCMask mask; + XGCValues values; + + if ($graygc != NULL) XtReleaseGC($, $graygc); + values.foreground = $thumbColor; + values.stipple = + XCreateBitmapFromData(XtDisplay($), + RootWindowOfScreen(XtScreen($)), + stip4_bits, stip4_width, stip4_height); + values.fill_style = FillStippled; + mask = GCForeground | GCStipple | GCFillStyle; + $graygc = XtGetGC($, mask, values); +} +.fi + +\fIcreate_thumbgc\fP creates the GC that draw the background in the +thumb. + +.nf +create_thumbgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($thumbgc != NULL) XtReleaseGC($, $thumbgc); + if ($thumbPixmap != NULL) { + mask = GCTile | GCFillStyle; + values.tile = $thumbPixmap; + values.fill_style = FillTiled; + } else { + mask = GCForeground; + values.foreground = $thumbColor; + } + $thumbgc = XtGetGC($, mask, values); +} +.fi + +The \fIcreate_thumblightgc\fP functions makes the GC for drawing the light +parts of the thumb's frame. + +.nf +create_thumblightgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($thumblightgc != NULL) XtReleaseGC($, $thumblightgc); + switch ($shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = $topShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.background = $thumbColor; + values.stipple = $topShadowStipple; + values.foreground = WhitePixelOfScreen(XtScreen($)); + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen($)) > 4 + $lighter_color($, $thumbColor, values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = $thumbColor; + values.foreground = WhitePixelOfScreen(XtScreen($)); + values.stipple = + XCreateBitmapFromData(XtDisplay($), + RootWindowOfScreen(XtScreen($)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + $thumblightgc = XtGetGC($, mask, values); +} +.fi + +The \fIcreate_thumbdarkgc\fP routines does the same for the dark parts of the +thumb's frame. + +.nf +create_thumbdarkgc($) +{ + XtGCMask mask; + XGCValues values; + + if ($thumbdarkgc != NULL) XtReleaseGC($, $thumbdarkgc); + switch ($shadowScheme) { + case XfwfColor: + mask = GCForeground; + values.foreground = $bottomShadowColor; + break; + case XfwfStipple: + mask = GCFillStyle | GCStipple | GCForeground | GCBackground; + values.fill_style = FillOpaqueStippled; + values.stipple = $bottomShadowStipple; + values.foreground = BlackPixelOfScreen(XtScreen($)); + values.background = $thumbColor; + break; + case XfwfAuto: + if (DefaultDepthOfScreen(XtScreen($)) > 4 + $darker_color($, $thumbColor, values.foreground)) { + mask = GCForeground; + } else { + mask = GCFillStyle | GCBackground | GCForeground | GCStipple; + values.fill_style = FillOpaqueStippled; + values.background = $thumbColor; + values.foreground = WhitePixelOfScreen(XtScreen($)); + values.stipple = + XCreateBitmapFromData(XtDisplay($), + RootWindowOfScreen(XtScreen($)), + stip4_bits, stip4_width, stip4_height); + } + break; + } + $thumbdarkgc = XtGetGC($, mask, values); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/Slider2P.h b/vendor/x11iraf/obm/ObmW/Slider2P.h new file mode 100644 index 00000000..c4191940 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Slider2P.h @@ -0,0 +1,87 @@ +/* Generated by wbuild from "Slider2.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfSlider2P_H_ +#define _XfwfSlider2P_H_ +#include "LabelP.h" +#include "Slider2.h" +typedef void (*compute_thumb_Proc)( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension * +#endif +); +#define XtInherit_compute_thumb ((compute_thumb_Proc) _XtInherit) +typedef void (*move_thumb_Proc)( +#if NeedFunctionPrototypes +Widget,int ,int ,int ,int ,int ,int +#endif +); +#define XtInherit_move_thumb ((move_thumb_Proc) _XtInherit) +typedef void (*compute_info_Proc)( +#if NeedFunctionPrototypes +Widget,Position *,Position *,Dimension *,Dimension *,float *,float *,float *,float * +#endif +); +#define XtInherit_compute_info ((compute_info_Proc) _XtInherit) +typedef void (*scroll_response_Proc)( +#if NeedFunctionPrototypes +Widget ,XtPointer ,XtPointer +#endif +); +#define XtInherit_scroll_response ((scroll_response_Proc) _XtInherit) +typedef struct { +/* methods */ +compute_thumb_Proc compute_thumb; +move_thumb_Proc move_thumb; +compute_info_Proc compute_info; +#define range(x) (0.0 <=(x )&&(x )<=1.0 ) + + +scroll_response_Proc scroll_response; +/* class variables */ +} XfwfSlider2ClassPart; +typedef struct _XfwfSlider2ClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfLabelClassPart xfwfLabel_class; +XfwfSlider2ClassPart xfwfSlider2_class; +} XfwfSlider2ClassRec; + +typedef struct { +/* resources */ +Pixel thumbColor; +Pixmap thumbPixmap; +Dimension minsize; +Dimension thumbFrameWidth; +FrameType thumbFrameType; +XtCallbackList scrollCallback; +XtCallbackProc scrollResponse; +/* private state */ +float thumb_x; +float thumb_y; +float thumb_wd; +float thumb_ht; +Boolean drag_in_progress; +int m_delta_x; +int m_delta_y; +GC thumbgc; +GC thumblightgc; +GC thumbdarkgc; +} XfwfSlider2Part; + +typedef struct _XfwfSlider2Rec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfLabelPart xfwfLabel; +XfwfSlider2Part xfwfSlider2; +} XfwfSlider2Rec; + +externalref XfwfSlider2ClassRec xfwfSlider2ClassRec; + +#endif /* _XfwfSlider2P_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/TabString.h b/vendor/x11iraf/obm/ObmW/TabString.h new file mode 100644 index 00000000..9151df67 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/TabString.h @@ -0,0 +1,26 @@ +/* + * Functions for drawing String's with tab characters in them + */ + +#if (NeedFunctionPrototypes > 0) + +extern void XfwfDrawImageString(Display *display, Drawable drawable, + GC gc, int x, int y, String string, int length, + int *tabs); +extern void XtabDrawString(Display *display, Drawable drawable, GC gc, + int x, int y, String string, int length, int *tabs); +extern int * XfwfTablist2Tabs(char *tablist); +extern int XfwfTextWidth(XFontStruct *font, String str, int length, + int *tabs); +extern char * strnchr(char *s, int c, int n); + +#else + +extern void XfwfDrawImageString(); +extern void XtabDrawString(); +extern int * XfwfTablist2Tabs(); +extern int XfwfTextWidth(); +extern char * strnchr(); + +#endif + diff --git a/vendor/x11iraf/obm/ObmW/Table.c b/vendor/x11iraf/obm/ObmW/Table.c new file mode 100644 index 00000000..ecb6e8e8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Table.c @@ -0,0 +1,4594 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> + +#include <X11/Xatom.h> +#include <X11/IntrinsicP.h> +#include <X11/RectObjP.h> +#include <X11/StringDefs.h> +#include <X11/keysym.h> +#include <X11/Xos.h> + +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/Drawing.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/TableP.h> +#include <X11/Xraw/TableUtil.h> +#include <X11/Xraw/Frame.h> +#include <X11/Xraw/AsciiText.h> +#include <X11/Xraw/Viewport.h> +#include <X11/Xraw/Scrollbar.h> +#include <X11/Xraw/ScrolledTable.h> + +#ifdef EBUG_XRAW_MALLOC +#include <dbmalloc/malloc.h> +#endif + +#define MULTI_LINE_TABLE 32767 + + +#undef CELL_IN /* */ + +#ifdef MIN +#undef MIN +#endif +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +#ifdef MAX +#undef MAX +#endif +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define CALLOC(num,type) (num * sizeof(type) <= 0 ? (type*)NULL : \ + (type*)XtMalloc((Cardinal)(num) * (Cardinal)sizeof(type))) + +#define NOT_A_CUT_BUFFER (-1) + +#define MAXCUT 30000 +#define EDIT(w) (((XawTableWidget) w)->table.edit) +#define InRange(n,a,b) MAX(a,MIN(n,b)) + +#define LEFT_EDGE(tw) (((XawTableWidget)tw)->table.internal_width + \ + ((XawTableWidget)tw)->table.label_shadow_thickness) + +#define TOP_EDGE(tw) (((XawTableWidget)tw)->table.internal_height + \ + ((XawTableWidget)tw)->table.label_shadow_thickness) + +#define CELL(field) cell->field +#define STUFF(w) ((XawTableWidget)w)->table.table_stuff +#define COLUMNS(w) ((XawTableWidget)w)->table.columns +#define ROWS(w) ((XawTableWidget)w)->table.rows +#define GET_CELL_LABEL ((CELL(label) == NULL ? Dummy : CELL(label))) + +#define COLUMN_DATA(tw) ((XawTableColumnRec*)tw->table.column_data) +#define COLUMN_WIDTH(tw,column) \ +(tw->table.literal ? \ + ( \ + (COLUMN_DATA(tw)[column].flag & _CL_width) ?\ + COLUMN_DATA(tw)[column].width : \ + tw->table.column_default_width \ + ) \ + * tw->table.literal_width + \ + 2 * tw->table.internal_width \ + : \ + ( \ + (COLUMN_DATA(tw)[column].flag & _CL_width) ?\ + COLUMN_DATA(tw)[column].width : \ + tw->table.column_default_width \ + ) \ +/* _COLUMN_WIDTH_ */) + + +#define MANAGE_EDIT(tw) \ + if ( ! XtIsManaged(EDIT(tw))) \ + { \ + XtManageChild (EDIT(tw)); \ + XtSetKeyboardFocus ((Widget)tw, EDIT(tw)); \ + } + + +#define UNMANAGE_EDIT(tw) \ + if ( XtIsManaged(EDIT(tw))) \ + { \ + XtUnmanageChild (tw->table.edit); \ + XtSetKeyboardFocus((Widget)tw, (Widget)None); \ + } + + +#define DO_CALLBACK(w,callback,data) \ + if (XtCallbackHasSome == XtHasCallbacks(w, callback)) \ + XtCallCallbacks (w, callback, (XtPointer)&data) + + +#define IsEditInRowColumn(tw, row, column) \ + (XtIsManaged(EDIT(tw)) && (row == tw->table.edit_row) \ + && (column == tw->table.edit_column)) + + + +#define REJECT (-1) +#define ACCEPT (0) + +#define CHECK_TABLE(tw) \ + _check_table ((XtPointer)STUFF(tw), ROWS(tw), COLUMNS(tw)); \ + CheckAllLabels(tw) + + + +typedef struct _XawTableCellRec { + /* Node communication entity */ + XawTableNodeRec node; + /* Cell label entity */ + char *label; + Position label_x; + Dimension label_width; + Dimension label_len; + /* Cell colour entity */ + Boolean highlight; + Boolean special_colour; + Pixel fore; + Pixel back; + GC normal; + GC reverse; + GC top; + GC bottom; + +}XawTableCellRec; + +#define _CL_width (1L<<0) +#define _CL_font (1L<<1) +#define _CL_label (1L<<2) +#define _CL_justify (1L<<3) +#define _CL_background (1L<<4) +#define _CL_foreground (1L<<5) + +typedef struct _XawTableColumnRec { + int flag; + int width; + XFontStruct *font; + char *label; + XtJustify justify; + Pixel background; + Pixel foreground; + GC normal; + GC reverse; + GC top; + GC bottom; +}XawTableColumnRec; + + +#ifdef CRAY +#define WORD64 +#endif + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +static void Def_pixel(); +static void Def_scroll(); +static void Def_column_default_width(); +static void Def_literal_width(); +static void Def_shadow_thickness(); + +#define Offset(field) XtOffsetOf(TableRec, field) + +static XtResource resources[] = { + { + XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.foreground), XtRString, XtDefaultForeground + }, + { + XtNeditForeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.edit_fore), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNeditBackground, XtCBackground, XtRPixel, sizeof(Pixel), + Offset(table.edit_back), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNrowForeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.row_fore), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNcolumnForeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.column_fore), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + Offset(table.font), XtRString, XtDefaultFont + }, + { + XtNliteral, XtCLiteral, XtRBoolean, sizeof(Boolean), + Offset(table.literal), XtRImmediate, (XtPointer)False + }, + { + XtNrowOriented, XtCRowOriented, XtRBoolean, sizeof(Boolean), + Offset(table.row_oriented), XtRImmediate, (XtPointer)True + }, + { + XtNmaskNumber, XtCMaskNumber, XtRInt, sizeof(int), + Offset(table.mask_number), XtRImmediate, (XtPointer)7 + }, + { + XtNcolumns, XtCColumns, XtRInt, sizeof(int), + Offset(table.columns), XtRImmediate, (XtPointer)1 + }, + { + XtNrows, XtCRows, XtRInt, sizeof(int), + Offset(table.rows), XtRImmediate, (XtPointer)1 + }, + { + XtNtableMargin, XtCTableMargin, XtRDimension, sizeof(Dimension), + Offset(table.tab_margin), XtRImmediate, (XtPointer)2 + }, + { + XtNrowMargin, XtCRowMargin, XtRDimension, sizeof(Dimension), + Offset(table.row_margin), XtRImmediate, (XtPointer)1 + }, + { + XtNcolumnMargin, XtCColumnMargin, XtRDimension, sizeof(Dimension), + Offset(table.col_margin), XtRImmediate, (XtPointer)1 + }, + { + XtNlabelShadowWidth, XtCLabelShadowWidth, XtRDimension, + sizeof(Dimension), Offset(table.label_shadow_thickness), XtRImmediate, + (XtPointer)1 + }, + { + XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify), + Offset(table.justify), XtRImmediate, (XtPointer)XtJustifyCenter + }, + { + XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), + Offset(table.internal_width), XtRImmediate, (XtPointer)4 + }, + { + XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), + Offset(table.internal_height), XtRImmediate, (XtPointer)2 + }, + { + XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char), + Offset(table.encoding), XtRImmediate, (XtPointer)XawTextEncoding8bit + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + Offset(container.shadow_thickness), XtRCallProc, + (XtPointer) Def_shadow_thickness + }, + { + XtNvetricalScroll, XtCScroll, XtRWidget, sizeof(Widget), + Offset(table.v_scroll), XtRCallProc, (XtPointer)Def_scroll + }, + { + XtNhorizontalScroll, XtCScroll, XtRWidget, sizeof(Widget), + Offset(table.h_scroll), XtRCallProc, (XtPointer)Def_scroll + }, + { + XtNrowHeight, XtCRowHeight, XtRInt, sizeof(int), + Offset(table.row_height), XtRImmediate, (XtPointer)0 + }, + { + XtNdefaultWidth, XtCDefaultWidth, XtRInt, sizeof(int), + Offset(table.column_default_width), XtRCallProc, + (XtPointer) Def_column_default_width + }, + { + XtNeditable, XtCEditable, XtRBoolean, sizeof(Boolean), + Offset(table.editable), XtRImmediate, (XtPointer) FALSE + }, + { + XtNliteralWidth, XtCLiteralWidth, XtRInt, sizeof(int), + Offset(table.literal_width), XtRCallProc, (XtPointer) Def_literal_width + }, + + /* ALLOWANCE CALLBACKS */ + { + XtNallowAddColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_add_column), XtRCallback, NULL + }, + { + XtNallowAddRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_add_row), XtRCallback, NULL + }, + { + XtNallowDeleteColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_delete_column), XtRCallback, NULL + }, + { + XtNallowDeleteRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_delete_row), XtRCallback, NULL + }, + { + XtNallowDeleteTable, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_delete_table), XtRCallback, NULL + }, + /* INFORMATION CALLBACKS */ + + { + XtNaddColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.add_column), XtRCallback, NULL + }, + { + XtNaddRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.add_row), XtRCallback, NULL + }, + { + XtNcreateTable, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.create_table), XtRCallback, NULL + }, + { + XtNchangedCell, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.changed_cell), XtRCallback, NULL + }, + { + XtNchangedColumnWidth, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.changed_column_width), XtRCallback, NULL + }, + { + XtNchangedRowHeight, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.changed_row_height), XtRCallback, NULL + }, + { + XtNdeleteColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.delete_column), XtRCallback, NULL + }, + { + XtNdeleteRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.delete_row), XtRCallback, NULL + }, + { + XtNdeleteTable, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.delete_table), XtRCallback, NULL + }, + { + XtNwhatCell, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.what_cell), XtRCallback, NULL + }, +}; + +#define PRINTF_BOOL(a) ((a) ? "TRUE":"FALSE") +#define PRINTF_NULL(a) ((a)==NULL ? "NULL":"not NULL") + +static void Def_pixel(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + XawTableWidget tw = (XawTableWidget)w; + static Pixel pix = 0; + + + if ( offset == (int)Offset(table.edit_fore)) + pix = tw->table.foreground; + else if ( offset == (int)Offset(table.edit_back)) + { + if (!FetchPixel(w, "#d0d000", &pix)) + pix = WhitePixelOfScreen(XtScreen(w)); + } + else + pix = tw->core.background_pixel; + + value->addr = (XtPointer)& pix; +} + +/* ARGSUSED */ +static void Def_scroll(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + static Widget view; + + for (view = XtParent(w); + (view != (Widget)NULL) && (!XtIsSubclass(view, viewportWidgetClass)); + view = XtParent(view)) + /* EMPTY */; + + if (view) + { + if (offset == Offset(table.v_scroll)) + { + if (((view = XtNameToWidget(view, "vertical")) == (Widget)NULL) + || !XtIsSubclass(view, scrollbarWidgetClass)) + view = (Widget)NULL; + } + else + if (offset == Offset(table.h_scroll)) + { + if (((view = XtNameToWidget(view, "horizontal")) == (Widget)NULL) + || !XtIsSubclass(view, scrollbarWidgetClass)) + view = (Widget)NULL; + } + } + + value->addr = (XtPointer)&view; +} + +/* ARGSUSED */ +static void Def_column_default_width(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + XawTableWidget tw = (XawTableWidget) w; + static int column_default_width; + + if (tw->table.literal) + column_default_width = 10; + else + column_default_width = 60; + + value->addr = (XtPointer)&column_default_width; +} + +#ifndef WORD64 +#define TXT_16 XChar2b +#else +#define TXT_16 char +#endif + +/* ARGSUSED */ +static void Def_literal_width(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + XawTableWidget tw = (XawTableWidget) w; + static int literal_width; + + if (tw->table.encoding) + tw->table.literal_width = XTextWidth16(tw->table.font, (TXT_16*)"mmm", 3); + else + tw->table.literal_width = XTextWidth(tw->table.font, "mmm", 3); + + tw->table.literal_width /= 3; + + value->addr = (XtPointer)& literal_width; +} + +/* ARGSUSED */ +static void Def_shadow_thickness(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + Widget parent = XtParent (w); + static Dimension shadow_thickness; + + /* + if (XtIsSubclass (parent, scrolledTableWidgetClass) || + XtIsSubclass (parent, viewportWidgetClass)) + */ + if (XtIsSubclass (parent, viewportWidgetClass)) + shadow_thickness = 0; + else + shadow_thickness = 2; + + value->addr = (XtPointer)& shadow_thickness; +} + + +#undef offset + +static void MultipleChangeGC(); +static void Initialize(); +static void Realize(); +static void Resize(); +static void Redisplay(); +static void Destroy(); + +static Boolean SetValues(); + +static void WalkForCells(); +static void LoseSelection(); + +static void CallEdit(); +static void InsertSelection(); +static void StoreBuffer(); +static void WhatCell(); +static void KeyReturn(); +static void HighlightCell(); +static void UnhighlightCell(); +static void DoingNothing(); + +static char* DummyString(); + +static Boolean InitCell(); + +static XtGeometryResult QueryGeometry(); +static XtGeometryResult GeometryManager(); + +static XtActionsRec actions[] = { + {"call-edit", (XtActionProc)CallEdit }, + {"insert-selection", (XtActionProc)InsertSelection}, + {"store-in-buffer", (XtActionProc)StoreBuffer }, + {"what_cell", (XtActionProc)WhatCell }, + {"key_return", (XtActionProc)KeyReturn }, + {"highlight", (XtActionProc)HighlightCell }, + {"unhighlight", (XtActionProc)UnhighlightCell}, + {"no-op", (XtActionProc)DoingNothing } +}; + +static char translations[] = + "Ctrl<Btn1Up>: what_cell() \n\ + <Btn1Up>: call-edit() \n\ + <Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \n\ + <Btn3Up>: highlight() store-in-buffer(PRIMARY,CUT_BUFFER0) "; + +static char edit_translations[] = + " <Key>Return: key_return() \n\ + <Key>Linefeed: key_return() \n\ + <Key>Down: no-op(r) \n\ + <Key>Up: no-op(r) "; + +static char* Dummy = ""; + + +#define SuperClass ((ContainerWidgetClass)&containerClassRec) + +TableClassRec tableClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "Table", + /* widget_size */ sizeof(TableRec), + /* classInitialize */ NULL, + /* class_partInitialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ TRUE, + /* visible_interest */ TRUE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ translations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + /* Composite class part */ + { + /* geometry manager */ GeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL, + }, + /* Constraint class part */ + { + /* subresources */ NULL, + /* subresource_count */ 0, + /* constraint_size */ 0, + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL, + }, + /* Container class part */ + { + /* ignore */ 0, + }, + { /* Table class fields initialization */ + /* ignore */ 0 + } +}; + +WidgetClass tableWidgetClass = (WidgetClass)&tableClassRec; + + +/**************************************************************** + * + * Private procedures + * + ****************************************************************/ +#define NORMAL_INDEX(fore, back) \ + (int)(((int)fore * (int)back) & tw->table.mask_hash_table) + +#define SHADOW_INDEX(back) (int)(((int)back) & tw->table.mask_hash_table) + +#define GET_NORMAL(tw,i) (tw->table.normal_hash_table+(i)) +#define GET_SHADOW(tw,i) (tw->table.shadow_hash_table+(i)) + +#define NEXT(i) (int)((i+1) & tw->table.mask_hash_table) + +static int MaskStaticArray[] = { + 0x1, 0x3, 0x7, 0xF, + 0x1F, 0x3F, 0x7F, 0xFF, + 0x1FF, 0x3FF, 0x7FF, 0xFFF + }; + +static NormalReverseGC* GetNormalGC(w, fore, back, font) + Widget w; + Pixel fore; + Pixel back; + Font font; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = NORMAL_INDEX(fore, back); + + while (GET_NORMAL(tw,i)->used > 0) + { + + if (GET_NORMAL(tw,i)->fore == fore && GET_NORMAL(tw,i)->back == back) + { + GET_NORMAL(tw,i)->used++; + return GET_NORMAL(tw,i); + } + i = NEXT(i); + } + + if (GET_NORMAL(tw,i)->used == 0) + { + XtGCMask mask; + XGCValues values; + Display *dpy = XtDisplay(w); + Window win = XtIsRealized(w) ? XtWindow(w) : XDefaultRootWindow(dpy); + + + mask = GCForeground | GCBackground | GCFont; + values.foreground = fore; + values.background = back; + values.font = font; + + GET_NORMAL(tw,i)->normal = XCreateGC(dpy, win, mask, &values); + values.foreground = back; + values.background = fore; + GET_NORMAL(tw,i)->reverse = XCreateGC(dpy, win, mask, &values); + + GET_NORMAL(tw,i)->used = 1; + GET_NORMAL(tw,i)->fore = fore; + GET_NORMAL(tw,i)->back = back; + + return GET_NORMAL(tw,i); + } + + return (NormalReverseGC*)NULL; +} + +static void GetGCByForeground(w, gc, fore) + Widget w; + GC *gc; + Pixel fore; +{ + XGCValues values; + + values.foreground = fore; + (*gc) = XtGetGC(w, GCForeground, &values); +} + + +static ShadowGC* GetShadowGC(w, back) + Widget w; + Pixel back; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = SHADOW_INDEX(back); + + while (GET_SHADOW(tw,i)->used > 0) + { + if (GET_SHADOW(tw,i)->back == back) + { + GET_SHADOW(tw,i)->used++; + return GET_SHADOW(tw,i); + } + i = NEXT(i); + } + + if (GET_SHADOW(tw,i)->used == 0) + { + Pixel top; + Pixel bottom; + + GET_SHADOW(tw,i)->used = 1; + GET_SHADOW(tw,i)->back = back; + + (void)TopShadowColor(w, back, &top); + (void)BottomShadowColor(w, back, &bottom); +#ifdef CELL_IN + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->bottom, top); + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->top, bottom); +#else + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->bottom, bottom); + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->top, top); +#endif + return GET_SHADOW(tw,i); + } + + return (ShadowGC*)NULL; +} + +static void ReleaseNormalGC(w, fore, back) + Widget w; + Pixel fore; + Pixel back; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = NORMAL_INDEX(fore, back); + + while (GET_NORMAL(tw,i)->used > 0) + { + if ( GET_NORMAL(tw,i)->fore == fore && GET_NORMAL(tw,i)->back == back) + { + if (--GET_NORMAL(tw,i)->used == 0) { + XFreeGC(XtDisplay(w), GET_NORMAL(tw,i)->normal); + XFreeGC(XtDisplay(w), GET_NORMAL(tw,i)->reverse); + } + break; + } + + i = NEXT(i); + } +} + +static void ReleaseShadowGC(w, back) + Widget w; + Pixel back; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = SHADOW_INDEX(back); + + while (GET_SHADOW(tw,i)->used > 0) + { + if ( GET_SHADOW(tw,i)->back == back) + { + if (--GET_SHADOW(tw,i)->used == 0) + { + XtReleaseGC(w, GET_SHADOW(tw,i)->top); + XtReleaseGC(w, GET_SHADOW(tw,i)->bottom); + } + break; + } + i = NEXT(i); + } +} + +static void MultipleChangeGC(w, fore, back, font, normal, reverse) + Widget w; + Pixel *fore; + Pixel *back; + Font *font; + GC *normal; + GC *reverse; +{ + XtGCMask mask; + XGCValues values; + + if (normal != (GC*)NULL){ + mask = (XtGCMask)0; + if (fore != (Pixel*)NULL) { + mask |= GCForeground; + values.foreground = *fore; + } + if (back != (Pixel*)NULL) { + mask |= GCBackground; + values.background = *back; + } + if (font != (Font*)NULL) { + mask |= GCFont; + values.font = *font; + } + XChangeGC(XtDisplay(w), *normal, mask, &values); + } + + if (reverse != (GC*)NULL){ + mask = (XtGCMask)0; + if (fore != (Pixel*)NULL) { + mask |= GCForeground; + values.foreground = *back; /* reverse */ + } + if (back != (Pixel*)NULL) { + mask |= GCBackground; + values.background = *fore; /* reverse */ + } + if (font != (Font*)NULL) { + mask |= GCFont; + values.font = *font; + } + XChangeGC(XtDisplay(w), *reverse, mask, &values); + } +} + +#ifndef WORD64 + +#define TXT16 XChar2b + +#else + +#define TXT16 char + +static XChar2b *buf2b; +static int buf2blen = 0; + +#define XTextWidth16 _XawTableWidth16 +#define XDrawString16 _XawTableDraw16 + +#endif /* WORD64 */ + + +static void CalculatePreferredSize(w, width, height) + Widget w; + Dimension *width; + Dimension *height; +{ + register XawTableWidget tw = (XawTableWidget)w; + register int wid; + register int hei; + int i; + + /* + * Calculate preferred width + */ + + wid = 2 * (tw->table.tab_margin + tw->container.shadow_thickness); + wid += COLUMNS(tw) ? (COLUMNS(tw) - 1) * tw->table.col_margin : 0; + wid += 2 * COLUMNS(tw) * tw->table.label_shadow_thickness; + + for(i = 0 ; i < COLUMNS(tw); i++) + wid += (Dimension)COLUMN_WIDTH(tw,i); + + /* + * Calculate preferred height + */ + + hei = 2 * (tw->table.tab_margin + tw->container.shadow_thickness); + hei += ROWS(tw) ? (ROWS(tw) - 1) * tw->table.row_margin : 0; + hei += ROWS(tw) * tw->table.row_height; + hei += 2 * ROWS(tw) * tw->table.label_shadow_thickness; + + tw->table.prefer_width = wid; + tw->table.prefer_height = hei; + + if (width) *width = wid; + if (height) *height = hei; + +} + +static Position GetX(tw,j) + register XawTableWidget tw; + int j; +{ + register TablePart* table = (TablePart*)&tw->table; + register Position x; + + x = j * (table->col_margin + 2 * table->label_shadow_thickness) + + (table->tab_margin + tw->container.shadow_thickness); + + for(; j > 0 ; j--) + { + register int tmp = j - 1; + x += (Position)COLUMN_WIDTH(tw, tmp); + } + return x; +} + +static Position GetY(tw,i) + XawTableWidget tw; + int i; +{ + return(i * (tw->table.row_margin + tw->table.row_height + + 2 * tw->table.label_shadow_thickness) + + (tw->table.tab_margin + tw->container.shadow_thickness)); +} + + +/* + * Calculate width and height of displayed text in pixels + */ + +static void SetLabelHeight(tw) + XawTableWidget tw; +{ + register XFontStruct *fs = tw->table.font; + int row_height = tw->table.row_height; + + if (tw->table.row_height < 1) + tw->table.row_height = (fs->max_bounds.ascent + + fs->max_bounds.descent + + 2 * tw->table.internal_height); + if (row_height != tw->table.row_height) + { + XawTableCallbackStruct callback_str; + callback_str.reason = XawTABLE_CHANGED_ROW_HEIGHT; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK((Widget)tw, XtNchangedRowHeight, callback_str); + } +} + +static void SetLiteralWidth(tw) + XawTableWidget tw; +{ + if (tw->table.encoding) + tw->table.literal_width = XTextWidth16(tw->table.font, (TXT16*)"mmm", 3); + else + tw->table.literal_width = XTextWidth(tw->table.font, "mmm", 3); + + tw->table.literal_width /= 3; +} + + +static void SetLabelWidth(tw,i,j) + XawTableWidget tw; + int i,j; +{ + register XFontStruct *fs = tw->table.font; + XawTableCell cell; + + cell = (XawTableCell)get_cell(STUFF(tw),i,j); + + if (CELL(label) == NULL) { + CELL(label_len) = 0; + CELL(label_width) = 0; + } else { + CELL(label_len) = strlen(CELL(label)); + if (tw->table.encoding) + CELL(label_width) = + XTextWidth16(fs, (TXT16*)CELL(label), (int) CELL(label_len)/2); + else + CELL(label_width) = + XTextWidth(fs, CELL(label), (int) CELL(label_len)); + } +} + + +static void CreateTableCellGC(w) + Widget w; +{ + Display *dpy = XtDisplay(w); + Drawable d = XtWindow(w); + XawTableWidget tw = (XawTableWidget)w; + + tw->table.normal = XCreateGC(dpy, d, (XtGCMask)0, (XGCValues*)NULL); + tw->table.reverse = XCreateGC(dpy, d, (XtGCMask)0, (XGCValues*)NULL); + + MultipleChangeGC(w, + (Pixel*)&tw->table.foreground, + (Pixel*)&tw->core.background_pixel, + (Font*)&tw->table.font->fid, + (GC*)&tw->table.normal, + (GC*)&tw->table.reverse); + +} + +static void DrawColumns(tw, b_column, e_column) + XawTableWidget tw; + int b_column, e_column; +{ + int j,y; + + y = (int)GetY(tw,0); + for(j = MAX(b_column,0); j <= MIN(e_column, COLUMNS(tw) - 2); j++) + { + XFillRectangle(XtDisplay((Widget)tw), + XtWindow((Widget)tw), + tw->table.column_gc, + (int) (GetX(tw,j+1) - tw->table.col_margin), + y, + (unsigned int) tw->table.col_margin, + (unsigned int)(tw->table.prefer_height-(2*y))); + + } +} + +static void DrawRows(tw, b_row, e_row) + XawTableWidget tw; + int b_row, e_row; +{ + int i,x; + + x = (int)GetX(tw,0); + for(i = MAX(b_row, 0); i <= MIN(e_row, ROWS(tw) - 2); i++) + { + XFillRectangle(XtDisplay((Widget)tw), + XtWindow((Widget)tw), + tw->table.row_gc, + x, + (int) (GetY(tw,i+1) - tw->table.row_margin), + (unsigned int) (tw->table.prefer_width-(2*x)), + (unsigned int) tw->table.row_margin); + + } +} + +static void DrawCage(tw, b_row, e_row, b_column, e_column) + XawTableWidget tw; + int b_row, e_row, b_column, e_column; +{ + int i,j; + Display* dpy = XtDisplay((Widget)tw); + Window win = XtWindow((Widget)tw); + + if (tw->table.row_oriented) + { + if (tw->table.col_margin > (Dimension)0) + { + DrawRows(tw, b_row - 1, e_row); + + for(i = b_row; i <= MIN(e_row,ROWS(tw) - 1); i++) + { + int y = (int) GetY(tw,i); + + for(j = MAX(b_column - 1, 0); j <= MIN(e_column, COLUMNS(tw) - 2); j++) + { + XFillRectangle (dpy, + win, + tw->table.column_gc, + (int) (GetX(tw, j + 1) - tw->table.col_margin), + y, + (unsigned int) tw->table.col_margin, + (unsigned int) (tw->table.row_height + + 2 * tw->table.label_shadow_thickness)); + + } + } + } + } + else + { + if (tw->table.row_margin > (Dimension)0) + { + DrawColumns(tw, b_column - 1, e_column); + + for(j = b_column; j <= MIN(e_column, COLUMNS(tw) - 1); j++) + { + int x = (int) GetX(tw,j); + + for(i = MAX(b_row - 1, 0); i <= MIN(e_row, ROWS(tw) - 2); i++) + { + XFillRectangle(XtDisplay((Widget)tw), + XtWindow((Widget)tw), + tw->table.row_gc, + x, + (int) (GetY(tw,i+1) - tw->table.row_margin), + (unsigned int) (COLUMN_WIDTH(tw,j) + + 2 * tw->table.label_shadow_thickness), + (unsigned int) tw->table.row_margin); + } + } + } + } +} + +static void Reposition(tw, cell, i, j) + register XawTableWidget tw; + XawTableCell cell; + int i,j; +{ + Position newPos; + XtJustify justify; + + if (cell == NULL) + cell = (XawTableCell)get_cell(STUFF(tw),i,j); + + if (COLUMN_DATA(tw)[j].flag & _CL_justify) + justify = COLUMN_DATA(tw)[j].justify; + else + justify = tw->table.justify; + + switch (justify) { + case XtJustifyLeft : newPos = tw->table.internal_width; + break; + case XtJustifyRight : newPos = (COLUMN_WIDTH(tw,j) - + CELL(label_width) - + tw->table.internal_width); + break; + case XtJustifyCenter : + default : newPos = (COLUMN_WIDTH(tw,j) - + CELL(label_width)) / 2; + break; + } + + CELL(label_x) = MAX(newPos, tw->table.internal_width); +} + +/* ARGSUSED */ +static Boolean DeleteCell(p, i, j, call_data, client_data) + XtPointer p; + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableCell cell = (XawTableCell)call_data; + + + if (CELL(label) != (char*)NULL) + XtFree(CELL(label)); + + if (CELL(special_colour)) + { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + return False; +} + + +static void UpdateTable(tw) + XawTableWidget tw; +{ + Dimension width; + Dimension height; + + if (tw->table.no_refigure > 0) + return; + + CalculatePreferredSize((Widget)tw, &width, &height); + + tw->table.was_resized = False; + + (void)XtMakeResizeRequest((Widget)tw, width, height, + (Dimension*)NULL, (Dimension*)NULL); + if (tw->table.was_resized == False) + { + tw->table.was_resized = True; + (*tableClassRec.core_class.resize) ((Widget)tw); + } +} + + +static int SetTableSize(w, rows, columns) + Widget w; + int rows; + int columns; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + int i; + + if (rows < 0 || columns < 0) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetTableSize", "SetTableSize","XawToolkitError", + "rows or columns for a new table in TableWidget '%s' less then zero", + subs, &num_subs); + return REJECT; + } + + if (STUFF(tw)) + { + callback_str.reason = XawTABLE_ALLOW_DELETE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = STUFF(tw); + callback_str.new_cell = STUFF(tw); + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowDeleteTable, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + callback_str.reason = XawTABLE_DELETE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = STUFF(tw); + callback_str.new_cell = STUFF(tw); + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK (w, XtNdeleteTable, callback_str); + + WalkForCells (w, (XawTableProc)DeleteCell, + 0, ROWS(tw)-1, 0, COLUMNS(tw)-1); + + delete_table ((XtPointer)STUFF(tw)); + + STUFF(tw) = (XawTableCell)NULL; + ROWS(tw) = 0; + COLUMNS(tw) = 0; + } + + if (rows == 0 || columns == 0) + return ACCEPT; + + STUFF(tw) = (XawTableCell) + create_table(rows, columns, sizeof(XawTableCellRec)); + + if (STUFF(tw) == (XawTableCell)NULL) + return ACCEPT; + + ROWS(tw) = rows; + COLUMNS(tw) = columns; + + WalkForCells((Widget)tw, (XawTableProc)InitCell, 0, rows-1, 0, columns-1); + + if (COLUMNS(tw)) { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)COLUMN_DATA(tw), + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + for (i = 0; i < COLUMNS(tw); i++) + COLUMN_DATA(tw)[i].flag = 0; + } + else { + XtFree((XtPointer)tw->table.column_data); + tw->table.column_data = NULL; + } + + callback_str.reason = XawTABLE_CREATE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNcreateTable, callback_str); + + return ACCEPT; +} + + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request; + Widget new; + ArgList args; + Cardinal *num_args; +{ + register XawTableWidget tw = (XawTableWidget) new; + Dimension width; + Dimension height; + int i; + + tw->table.no_refigure = 0; + tw->table.no_redraw = 0; + tw->table.num_selections = 0; + tw->table.cell_own = (XawTableCell)NULL; + STUFF(tw) = (XawTableCell)NULL; + tw->table.normal = (GC)NULL; + tw->table.reverse = (GC)NULL; + + COLUMNS(tw) = MAX (COLUMNS(tw), 0); + ROWS(tw) = MAX (ROWS(tw), 0); + + if (COLUMNS(tw)) { + tw->table.column_data = (XawTableColumn) + CALLOC (COLUMNS(tw), XawTableColumnRec); + for (i = 0; i < COLUMNS(tw); i++) + COLUMN_DATA(tw)[i].flag = 0; + } + else + tw->table.column_data = NULL; + + SetLiteralWidth(tw); + + EDIT(tw) = XtVaCreateWidget + ("edit", asciiTextWidgetClass, new, + XtNeditType, XawtextEdit, + XtNforeground, tw->table.edit_fore, + XtNbackground, tw->table.edit_back, + XtNborderWidth, (XtArgVal)0, + XtNleftMargin, 2, + XtNrightMargin, 2, + XtNtopMargin, 0, /* to be fixed in future */ + XtNbottomMargin, 0, /* to be fixed in future */ + XtNuseStringInPlace, False, + XtNfont, tw->table.font, + XtNuserData, (XtArgVal)new, + NULL); + + XtOverrideTranslations(EDIT(tw), XtParseTranslationTable(edit_translations)); + + GetGCByForeground (new, (GC*)&tw->table.row_gc, tw->table.row_fore); + GetGCByForeground (new, (GC*)&tw->table.column_gc, tw->table.column_fore); + + if ((COLUMNS(tw) > 0) && (ROWS(tw) > 0)) + { + if (REJECT == SetTableSize(new, ROWS(tw), COLUMNS(tw))) + { + ROWS(tw) = 0; + COLUMNS(tw) = 0; + STUFF(tw) = (XawTableCell)NULL; + } + } + + if ((tw->table.mask_number < 0) + || (tw->table.mask_number >= XtNumber(MaskStaticArray))) + tw->table.mask_number = 7; + + tw->table.mask_hash_table = MaskStaticArray[tw->table.mask_number]; + + tw->table.normal_hash_table = + CALLOC(tw->table.mask_hash_table, NormalReverseGC); + + tw->table.shadow_hash_table = CALLOC(tw->table.mask_hash_table, ShadowGC); + + for(i = 0; i < tw->table.mask_hash_table; i++) + { + GET_NORMAL(tw,i)->used = 0; + GET_NORMAL(tw,i)->normal = (GC)NULL; + GET_NORMAL(tw,i)->reverse = (GC)NULL; + GET_SHADOW(tw,i)->used = 0; + GET_SHADOW(tw,i)->top = (GC)NULL; + GET_SHADOW(tw,i)->bottom = (GC)NULL; + } + + SetLabelHeight(tw); + + CalculatePreferredSize(new, &width, &height); + + if (new->core.width == 0) new->core.width = width; + if (new->core.height == 0) new->core.height = height; +} + + +static void Realize(w, valueMask, attributes) + Widget w; + XtValueMask *valueMask; + XSetWindowAttributes *attributes; +{ + XawTableWidget tw = (XawTableWidget) w; + ShadowGC *shadow; + + (*SuperClass->core_class.realize) (w, valueMask, attributes); + + CreateTableCellGC(w); + + shadow = GetShadowGC(w, tw->table.edit_back); + tw->table.edit_top = shadow->top; + tw->table.edit_bottom = shadow->bottom; + + shadow = GetShadowGC(w, tw->core.background_pixel); + tw->table.top = shadow->top; + tw->table.bottom = shadow->bottom; + + XtRealizeWidget(EDIT(w)); +} + +/* ARGSUSED */ +static Boolean MatchLabel(w, i, j, call_data, client_data) + Widget w; /* unused */ + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; +{ + XawTableCell cell = (XawTableCell)call_data; + XrmQuark* templ = (XrmQuark*)client_data; + + return ((*templ) == XrmStringToQuark (GET_CELL_LABEL)); +} + +/* ARGSUSED */ +static Boolean InitCell(p, i, j, call_data, client_data) + XtPointer p; /* unused */ + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + XawTableCell cell = (XawTableCell)call_data; + + CELL(label) = DummyString(); + CELL(label_len) = 0; + CELL(label_width) = 0; + CELL(highlight) = False; + CELL(special_colour) = False; + CELL(normal) = (GC)NULL; + CELL(reverse) = (GC)NULL; + CELL(top) = (GC)NULL; + CELL(bottom) = (GC)NULL; + + return False; +} + +/* + * + * Shadow drawing around cell + * + */ +static void PaintShadow(w, i, j, x, y, cell) + Widget w; + int i; + int j; + Position x; + Position y; + XawTableCell cell; +{ + XawTableWidget tw = (XawTableWidget) w; + + if (tw->table.label_shadow_thickness != (Dimension)0) { + GC top,bottom; + + if (IsEditInRowColumn(tw,i,j)) + { + top = tw->table.edit_bottom; + bottom = tw->table.edit_top; + } + else if (CELL(special_colour)) + { + top = CELL(top); + bottom = CELL(bottom); + }else { + top = tw->table.top; + bottom = tw->table.bottom; + } + + XawDrawFrame(w, + x, + y, + (Dimension)(COLUMN_WIDTH(tw,j) + + 2 * tw->table.label_shadow_thickness), + (Dimension)(tw->table.row_height + + 2 * tw->table.label_shadow_thickness), + XawRAISED, + tw->table.label_shadow_thickness, + top, + bottom); + } + +} + +/* ARGSUSED */ +static void PaintLabel(w, i, j, x, y, cell) + Widget w; + int i; + int j; + Position x,y; + XawTableCell cell; +{ + XawTableWidget tw = (XawTableWidget) w; + XRectangle rectangle[1]; + Position label_x; + Position label_y; + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,j); + unsigned int height = (unsigned int) tw->table.row_height; + + x += tw->table.label_shadow_thickness; + y += tw->table.label_shadow_thickness; + + if (CELL(special_colour) || CELL(highlight)) + { + GC gc; + + if (CELL(special_colour)) + gc = CELL(highlight) ? CELL(normal) : CELL(reverse); + else + gc = tw->table.normal ; + + /* Fill background for cell with a special colour */ + XFillRectangle(XtDisplay(w), XtWindow(w), gc, + (int)x, (int)y, width, height); + } + else + { + XClearArea (XtDisplay(w), XtWindow(w), (int)x, (int)y, + width, height, FALSE); + } + + if (CELL(label_len) > 0) + { + GC gc; + register XFontStruct *fs = tw->table.font; + + if (CELL(special_colour)) + gc = CELL(highlight) ? CELL(reverse) : CELL(normal); + else + gc = CELL(highlight) ? tw->table.reverse : tw->table.normal; + + /* Set clip rectangle for label in cell */ + rectangle[0].x = (short)x; + rectangle[0].y = (short)y; + rectangle[0].width = (unsigned short)COLUMN_WIDTH(tw,j); + rectangle[0].height = (unsigned short)tw->table.row_height; + + XSetClipRectangles(XtDisplay(w), gc, 0, 0, rectangle, 1, YSorted); + + /* Drawing label */ + label_x = x + CELL(label_x); + label_y = y + + (tw->table.row_height-(fs->max_bounds.ascent+fs->max_bounds.descent))/2 + /* tw->table.internal_height */ + + fs->max_bounds.ascent; + + if (tw->table.encoding) + XDrawString16(XtDisplay(w), XtWindow(w), gc, + label_x, label_y, (TXT16*)CELL(label), + (int)CELL(label_len)/2); + else + XDrawString(XtDisplay(w), XtWindow(w), gc, + label_x, label_y, CELL(label), (int)CELL(label_len)); + + XSetClipMask(XtDisplay(w), gc, (Pixmap)None); + + } +} + +/* ARGSUSED */ +static Boolean PaintCell(p, i, j, call_data, client_data) + XtPointer p; + int i; + int j; + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableWidget tw = (XawTableWidget) w; + XawTableCell cell = (XawTableCell) call_data; + Position x; + Position y; + + x = GetX(tw,j); + y = GetY(tw,i); + + PaintLabel (w, i, j, x, y, cell); + PaintShadow (w, i, j, x, y, cell); + + XFlush(XtDisplay(w)); + return False; +} + +static void WhatCellsToBeDraw(tw, rect, b_row, e_row, b_column , e_column) + XawTableWidget tw; + XRectangle rect; + register int *b_row, *e_row, *b_column , *e_column; +{ + Position x1 = (Position)rect.x, + y1 = (Position)rect.y, + x2 = (Position)(rect.x + rect.width - 1), + y2 = (Position)(rect.y + rect.height - 1); + + for ((*b_column) = 0; (*b_column) < COLUMNS(tw); (*b_column)++) + { + if (x1 < (GetX(tw,(*b_column) + 1) - tw->table.col_margin)) { + /* Added to fix scrolling bug in Viewport parent. MJF 9/6/02 + */ + *b_column = MAX (0, *b_column-1); + break; + } + } + + for ((*e_column) = (*b_column); (*e_column) < COLUMNS(tw); (*e_column)++) + { + if (x2 < (GetX(tw,(*e_column) + 1) - tw->table.col_margin)) + break; + } + + + for ((*b_row) = 0; (*b_row) < ROWS(tw); (*b_row)++) + { + if (y1 < (GetY(tw,(*b_row) + 1) - tw->table.row_margin)) { + /* Added to fix scrolling bug in Viewport parent. MJF 9/6/02 + */ + *b_row = MAX (0, *b_row-1); + break; + } + } + + for ((*e_row) = (*b_row); (*e_row) < ROWS(tw); (*e_row)++) + { + if (y2 < (GetY(tw,(*e_row) + 1) - tw->table.row_margin)) + break; + } +} + + +static void Redisplay(w, event, region) + Widget w; + XEvent *event; + Region region; +{ + XawTableWidget tw = (XawTableWidget) w; + XRectangle rect; + int b_row, e_row, b_column , e_column ; + + + if (!XtIsRealized(w) || !w->core.visible || tw->table.no_redraw) + return; + + if (tw->container.shadow_thickness > 0) + (*SuperClass->core_class.expose) (w, event, region); + + if (region != NULL) + { + XClipBox(region, (XRectangle*)&rect); + + WhatCellsToBeDraw(tw, rect, &b_row, &e_row, &b_column , &e_column); + } + else if (event != (XEvent*)NULL) + { + rect.x = (short) event->xexpose.x; + rect.y = (short) event->xexpose.y; + rect.width = (unsigned short) event->xexpose.width; + rect.height = (unsigned short) event->xexpose.height; + + WhatCellsToBeDraw(tw, rect, &b_row, &e_row, &b_column , &e_column); + + /* The following is necessary so the table gets redrawn properly + * when being managed by e.g. a Viewport widget. MJF 9/6/02 + */ + XawTableDoLayout (w, TRUE); + } + else if (tw->table.v_scroll || tw->table.h_scroll) + { + rect.x = (short) 0; + rect.y = (short) 0; + rect.width = (unsigned short) tw->core.width; + rect.height = (unsigned short) tw->core.height; + + if (tw->table.v_scroll && XtIsManaged(tw->table.v_scroll)) + { + float top; + float shown; + + XtVaGetValues (tw->table.v_scroll, + XtNtopOfThumb, &top, + XtNshown, &shown, + NULL); + + rect.y = (short) ((float)(tw->core.height) * top); + rect.height = (unsigned short) ((float)(tw->core.height) * (top+shown)); + } + + if (tw->table.h_scroll && XtIsManaged(tw->table.h_scroll)) + { + float top; + float shown; + + XtVaGetValues (tw->table.h_scroll, + XtNtopOfThumb, &top, + XtNshown, &shown, + NULL); + + rect.x = (short) ((float)(tw->core.width) * top); + rect.width = (unsigned short) ((float)(tw->core.width) * (top+shown)); + } + + + WhatCellsToBeDraw(tw, rect, &b_row, &e_row, &b_column , &e_column); + } + else + { + b_row = 0; + e_row = ROWS(tw) - 1; + b_column = 0; + e_column = COLUMNS(tw) - 1; + } + + DrawCage(tw, b_row, e_row, b_column, e_column); + + WalkForCells(w, (XawTableProc)PaintCell, b_row, e_row, b_column, e_column); + + XFlush(XtDisplay(w)); +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current; + Widget request; /* unused */ + Widget new; + ArgList args; /* unused */ + Cardinal *num_args; /* unused */ +{ + XawTableWidget curtw = (XawTableWidget) current; + XawTableWidget newtw = (XawTableWidget) new; + register int i; + int j; + Boolean resize = False; + Boolean redisplay = False; + +#define NE(field) (curtw->table.field != newtw->table.field) + + if (NE(mask_number)) + XtWarning("Resource XtNmaskNumber in Table widget can not changed"); + + newtw->table.mask_number = curtw->table.mask_number; + newtw->table.literal = curtw->table.literal; + + if (NE(font->fid)) + XtVaSetValues (EDIT(newtw), XtNfont, curtw->table.font, NULL); + + if (NE(foreground) || + NE(row_fore) || + NE(column_fore) || + NE(row_oriented) || + NE(font->fid) || + NE(justify) || + NE(tab_margin) || + NE(row_margin) || + NE(col_margin) || + NE(internal_width) || + NE(internal_height) || + NE(label_shadow_thickness) || + NE(encoding)) + redisplay = True; + + if (NE(font->fid) || + NE(columns) || + NE(rows) || + NE(tab_margin) || + NE(row_margin) || + NE(col_margin) || + NE(internal_width) || + NE(internal_height) || + NE(row_height) || + NE(label_shadow_thickness)) + resize = True; + + if (NE(columns) || NE(rows)) + if (REJECT == SetTableSize(new, ROWS(newtw), COLUMNS(newtw))) { + newtw->table.columns = curtw->table.columns; + newtw->table.rows = curtw->table.rows; + } + + if(NE(row_height)) + { + XawTableCallbackStruct callback_str; + callback_str.reason = XawTABLE_CHANGED_ROW_HEIGHT; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(new, XtNchangedRowHeight, callback_str); + } + + if(NE(font->fid)) + { + for(i = 0; i < ROWS(newtw); i++) + for(j = 0; j < COLUMNS(newtw); j++) + SetLabelWidth(newtw, i, j); + + SetLabelHeight(newtw); + } + + if(NE(font->fid) || NE(encoding)) + { + SetLiteralWidth(newtw); + + for(i = 0; i < ROWS(newtw); i++) + for(j = 0; j < COLUMNS(newtw); j++) + Reposition(newtw, NULL, i, j); + } + else if(NE(internal_width) || NE(label_shadow_thickness)) { + for(i = 0; i < ROWS(newtw); i++) + for(j = 0; j < COLUMNS(newtw); j++) + Reposition(newtw, NULL, i, j); + } + + + if (NE(internal_height) || NE(label_shadow_thickness)) + { + SetLabelHeight(newtw); + } + + if (resize) + CalculatePreferredSize(new, &newtw->core.width, &newtw->core.height); + + if (NE(foreground) || NE(font->fid) || + curtw->core.background_pixel != newtw->core.background_pixel) + { + MultipleChangeGC(new, + (Pixel*)&newtw->table.foreground, + (Pixel*)&newtw->core.background_pixel, + (Font*)&newtw->table.font->fid, + (GC*)&newtw->table.normal, + (GC*)&newtw->table.reverse); + + } + + if (NE(row_fore)) + { + XtReleaseGC(new, curtw->table.row_gc); + GetGCByForeground(new,(GC*)&newtw->table.row_gc, newtw->table.row_fore); + } + + if (NE(column_fore)) + { + XtReleaseGC(new, curtw->table.column_gc); + GetGCByForeground(new, &newtw->table.column_gc,newtw->table.column_fore); + } + + if (resize) + CalculatePreferredSize(new, &(new->core.width), &(new->core.height)); + + return redisplay; +} + + +static void Destroy(w) + Widget w; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) != (XawTableCell)NULL) + { + callback_str.reason = XawTABLE_DELETE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNdeleteTable, callback_str); + } + + if (tw->table.row_gc != (GC)NULL) { + XtReleaseGC(w, tw->table.row_gc); + tw->table.row_gc = (GC)NULL; + } + if (tw->table.column_gc != (GC)NULL) { + XtReleaseGC(w, tw->table.column_gc); + tw->table.column_gc = (GC)NULL; + } + if (tw->table.normal != (GC)NULL) { + XFreeGC(XtDisplay(w), tw->table.normal); + tw->table.normal = (GC)NULL; + } + + if (tw->table.reverse != (GC)NULL) { + XFreeGC(XtDisplay(w), tw->table.reverse); + tw->table.reverse = (GC)NULL; + } + + WalkForCells(w, (XawTableProc)DeleteCell, 0, ROWS(tw)-1, 0, COLUMNS(tw)-1); + + XtFree((XtPointer)tw->table.normal_hash_table); + XtFree((XtPointer)tw->table.shadow_hash_table); + + delete_table(tw->table.table_stuff); + STUFF(tw) = (XawTableCell)NULL; + + if (tw->table.column_data != NULL) + XtFree((XtPointer)tw->table.column_data); + + if (EDIT(w) != WNULL && !EDIT(w)->core.being_destroyed) + XtDestroyWidget(EDIT(w)); +} + + +static void Resize(w) + Widget w; +{ + XawTableWidget tw = (XawTableWidget)w; + + /* If widget is realized, just redisplay it w/o clearing */ + if (XtIsRealized(w) && tw->table.no_redraw == 0) + { + /* XClearWindow(XtDisplay(w), XtWindow(w)); */ + (*tableClassRec.core_class.expose) (w, (XEvent*)NULL,(Region)NULL); + } + + tw->table.was_resized = True; +} + + +static XtGeometryResult QueryGeometry(w, intended, preferred) + Widget w; + XtWidgetGeometry *intended, *preferred; +{ + preferred->request_mode = CWWidth | CWHeight; + + CalculatePreferredSize(w, &preferred->width, &preferred->height); + +#define Set(bit) (intended->request_mode & bit) + + if (Set(CWWidth) && intended->width == preferred->width && + Set(CWHeight) && intended->height == preferred->height) { + return XtGeometryYes; + } + + if (preferred->width == w->core.width && + preferred->height == w->core.height) { + return XtGeometryNo; + } + + return XtGeometryAlmost; + +#undef Set +} + +/* ARGSUSED */ +static XtGeometryResult GeometryManager(w, desired, allowed) + Widget w; + XtWidgetGeometry *desired; + XtWidgetGeometry *allowed; +{ + return XtGeometryYes; +} + + + +static void ExtractPosition(event, x, y , t) + XEvent *event; + Position *x, *y; /* RETURN */ + Time *t; /* RETURN */ +{ + if (event == NULL) + return; + + switch(event->type) { + case MotionNotify: + *x = event->xmotion.x; + *y = event->xmotion.y; + *t = event->xmotion.time; + break; + case ButtonPress: + case ButtonRelease: + *x = event->xbutton.x; + *y = event->xbutton.y; + *t = event->xbutton.time; + break; + case KeyPress: + case KeyRelease: + *x = event->xkey.x; + *y = event->xkey.y; + *t = event->xkey.time; + break; + case EnterNotify: + case LeaveNotify: + *x = event->xcrossing.x; + *y = event->xcrossing.y; + *t = event->xcrossing.time; + break; + default: + *x = 0; + *y = 0; + *t = XtLastTimestampProcessed(event->xany.display); + } +} + +/* ARGSUSED */ +static Boolean ExtractCell(tw, px, py, row, column) + XawTableWidget tw; + Position px,py; + int *row, *column; /* RETURN */ +{ + Position x; + Position y; +#define SH (tw->table.label_shadow_thickness) + for(*row = 0; *row < ROWS(tw); (*row)++) { + for(*column = 0; *column < COLUMNS(tw); (*column)++) + if ((x=GetX(tw,*column)+SH) <= px) + if ((y=GetY(tw,*row)+SH) <= py) + if ((x+COLUMN_WIDTH(tw,*column)) >= px) + if ((y+tw->table.row_height) >= py) + return False; + } +#undef SH + + return True; +} + + +/* ARGSUSED */ +static void WalkForCells(w, proc, b_r, e_r, b_c, e_c) + Widget w; + XawTableProc proc; + int b_r, e_r, b_c, e_c; +{ + XawTableWidget tw = (XawTableWidget)w; + int i,j; + + (void)go_table((XtPointer)w, proc, STUFF(tw), + b_r, e_r, b_c, e_c, + XawTABLE_RIGHT_DOWN, + &i, &j, (XtPointer)NULL); +} + +static char* DummyString() +{ + return XtNewString(""); +} + +static char* CopyOnlyPrintable(raw) + char* raw; +{ + char* clear; + char *s,*h; + int lenght; + + for(s = raw, lenght = 0; (*s) != '\0';) + { + if (isprint(*s++)) + lenght++; + } + + clear = CALLOC(++lenght, char); + + for(s = raw, h = clear; (*s) != '\0';) + { + if (isprint(*s)) + (*h++) = (*s++); + } + + (*h) = '\0'; + + return clear; +} + +#ifdef EBUG_XRAW_MALLOC +/* ARGSUSED */ +static Boolean CheckLabel(p, i, j, call_data, client_data) + XtPointer p; + int i; + int j; + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableWidget tw = (XawTableWidget) p; + XawTableCell cell = (XawTableCell)call_data; + char* label = CELL(label); + + for (label = CELL(label); *label != '\0'; label++) + if (!isprint(*label)) + { + char message[80]; + char *p = NULL; + sprintf(message, "wrong label '%s' in cell (%4d,%4d) in Table widget '%s'", + CELL(label), i, j, w->core.name); + XtWarning(message); + *p = '\0'; + break; + } + + return False; +} +#endif + +#ifdef EBUG_XRAW_MALLOC +static void CheckAllLabels(tw) + XawTableWidget tw; +{ + WalkForCells((Widget)tw, (XawTableProc)CheckLabel, + 0, ROWS(tw)-1, 0, COLUMNS(tw)-1); +} +#endif + +static void MoveEditCell (tw, row, column) + XawTableWidget tw; + int row; + int column; +{ + Position x,y; + + x = GetX(tw,column); + y = GetY(tw,row); + + XtConfigureWidget(EDIT(tw), + (Position)(x + tw->table.label_shadow_thickness), + (Position)(y + tw->table.label_shadow_thickness), + (Dimension) COLUMN_WIDTH(tw, column), + (Dimension) tw->table.row_height, + (Dimension)0); + XawDrawFrame((Widget)tw, + x, + y, + (Dimension)(COLUMN_WIDTH(tw, column) + + 2 * tw->table.label_shadow_thickness), + (Dimension)(tw->table.row_height + + 2 * tw->table.label_shadow_thickness), + XawSUNKEN, + tw->table.label_shadow_thickness, + tw->table.edit_top, + tw->table.edit_bottom); + +} + +/* ARGSUSED */ +static Boolean CompareCells(p, i, j, call_data, client_data) + XtPointer p; + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + XawTableCell cell = (XawTableCell)call_data; + XawTableCell test_cell = (XawTableCell)client_data; + + return(cell == test_cell); +} + +/****************************************************************** + * + * CONVENIENCE FUNCTIONS + * + ******************************************************************/ + + +void +#ifdef Xraw_NEED_PROTO +XawTableGetSize (Widget w, + int *rows, + int *columns) +#else +XawTableGetSize (w, rows, columns) + Widget w; + int *rows; + int *columns; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + *rows = ROWS(tw); + *columns = COLUMNS(tw); +} + +void +#ifdef Xraw_NEED_PROTO +XawTableDoLayout (Widget w, + Boolean do_layout) +#else +XawTableDoLayout (w, do_layout) + Widget w; + Boolean do_layout; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (do_layout) + tw->table.no_redraw--; + else + tw->table.no_redraw++; + + tw->table.no_redraw = MAX (tw->table.no_redraw, 0); + + if (tw->table.no_redraw == 0) + Redisplay (w, (XEvent *)NULL, (Region)NULL); +} + +int +#ifdef Xraw_NEED_PROTO +XawTableSetNewSize (Widget w, + int rows, + int columns) +#else +XawTableSetNewSize (w, rows, columns) + Widget w; + int rows; + int columns; +#endif +{ + if (REJECT == SetTableSize(w, rows, columns)) + return REJECT; + + UpdateTable((XawTableWidget)w); + return ACCEPT; +} + +char * +#ifdef Xraw_NEED_PROTO +XawTableGetLabelByCell (XawTableCell cell) +#else +XawTableGetLabelByCell (cell) + XawTableCell cell; +#endif +{ + return GET_CELL_LABEL; +} + +void +#ifdef Xraw_NEED_PROTO +XawTableGetEditPosition (Widget w, int *row, int *column) +#else +XawTableGetEditPosition(w, row, column) + Widget w; + int *row; + int *column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + *row = tw->table.edit_row; + *column = tw->table.edit_column; +} + +Boolean +#ifdef Xraw_NEED_PROTO +XawTableWalk ( + Widget w, + XawTableProc proc, + int b_row, + int e_row, + int b_column, + int e_column, + int direction, + int *i, /* returned */ + int *j, /* returned */ + XtPointer client_data) +#else +XawTableWalk(w, proc, b_row, e_row, b_column, e_column, + direction, i, j, client_data) + Widget w; + XawTableProc proc; + int b_row, e_row, b_column, e_column; + int direction; + int *i; /* returned */ + int *j; /* returned */ + XtPointer client_data; +#endif +{ + return go_table((XtPointer)w, proc, STUFF(w), + b_row, e_row, b_column, e_column, + direction, + i, j, client_data); +} + +Boolean +#ifdef Xraw_NEED_PROTO +XawTableSearchLabel (Widget w, char *name, int *row, int *column) +#else +XawTableSearchLabel (w, name, row, column) + Widget w; + char *name; + int *row, *column; +#endif +{ + int row_start = *row; + int column_start = *column; + XrmQuark templ = XrmStringToQuark (name); + + if (XawTableWalk(w, (XawTableProc)MatchLabel, + row_start, row_start, column_start, COLUMNS(w)-1, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + if (XawTableWalk(w, (XawTableProc)MatchLabel, + row_start+1, ROWS(w)-1, 0, COLUMNS(w)-1, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + if (XawTableWalk(w, (XawTableProc)MatchLabel, + 0, row_start-1, 0, COLUMNS(w)-1, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + if (XawTableWalk(w, (XawTableProc)MatchLabel, + row_start, row_start, 0, column_start, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + return (False); + +} + +/************************************************************** + * + * + * + * ROW routines + * + * + * + **************************************************************/ + +int +#ifdef Xraw_NEED_PROTO +XawTablePrependRow (Widget w) +#else +XawTablePrependRow(w) + Widget w; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "prependRow", "XawTablePrependRow","XawToolkitError", + "An attempt to add a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + + /* request for allowance */ + + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ALLOW_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + row_insert_before(STUFF(tw), sizeof(XawTableCellRec)); + ROWS(tw)++; + + STUFF(tw) = (XawTableCell)get_table(STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, 0, 0, 0, COLUMNS(tw)-1); + + if (XawTableIsEditManaged(w)) + MoveEditCell (tw, ++(tw->table.edit_row), tw->table.edit_column); + + UpdateTable(tw); + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddRow)) + { + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddRow, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableAppendRow (Widget w) +#else +XawTableAppendRow (w) + Widget w; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) + { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "appendRow", "XawTableAppendRow","XawToolkitError", + "An attempt to add a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), ROWS(tw)-1, 0); + + callback_str.reason = XawTABLE_ALLOW_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + row_insert_after(get_cell(STUFF(tw), ROWS(tw) - 1, 0), + sizeof(XawTableCellRec)); + + ROWS(tw)++; + + WalkForCells(w, (XawTableProc)InitCell, + ROWS(tw)-1, ROWS(tw)-1, 0, COLUMNS(tw)-1); + + UpdateTable(tw); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddRow)) + { + cell = (XawTableCell)get_cell(STUFF(tw), ROWS(tw)-1, 0); + + callback_str.reason = XawTABLE_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = ROWS(tw)-1; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddRow, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableInsertRow (Widget w, int row) +#else +XawTableInsertRow (w, row) + Widget w; + int row; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertRow", "XawTableInsertRow","XawToolkitError", + "An attempt to add a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (row != InRange(row, 0, ROWS(tw)-1)) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertRow", "XawTableInsertRow","XawToolkitError", + "Incorrect attempt to insert a row in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_ALLOW_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + row_insert_before(get_cell((XtPointer)STUFF(tw), row, 0), + sizeof(XawTableCellRec)); + + ROWS(tw)++; + + if (row == 0) + STUFF(tw) = (XawTableCell)get_table(STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, row, row, 0, COLUMNS(tw)-1); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XawTableIsEditManaged(w) && row <= tw->table.edit_row){ + tw->table.no_redraw++; + MoveEditCell (tw, ++(tw->table.edit_row), tw->table.edit_column); + tw->table.no_redraw--; + } + + UpdateTable(tw); + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddRow)) + { + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = row; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddRow, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableDeleteRow (Widget w, int row) +#else +XawTableDeleteRow (w, row) + Widget w; + int row; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteRow", "XawTableDeleteRow","XawToolkitError", + "An attempt to delete a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (row != InRange(row, 0, ROWS(tw)-1)) { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", ROWS(tw)-1); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteRow", "XawTableDeleteRow","XawToolkitError", + "Incorrect value of row (%s, max is %s) in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_ALLOW_DELETE_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowDeleteRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNdeleteRow)) + { + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_DELETE_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = row; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNdeleteRow, (XtPointer)&callback_str); + } + + /* if selections owner locates here, then disown selections */ + + if (tw->table.cell_own != (XawTableCell)NULL) + { + Boolean have_find; + int i, j; + + have_find = go_table((XtPointer)w, CompareCells, STUFF(tw), + row, row, 0, COLUMNS(tw)-1, + XawTABLE_RIGHT_DOWN, &i, &j, + (XtPointer)tw->table.cell_own); + if (have_find) { + for (; 0 < tw->table.num_selections;) + XtDisownSelection (w, + tw->table.selections[--(tw->table.num_selections)], + XtLastTimestampProcessed(XtDisplay(w))); + + tw->table.cell_own = (XawTableCell)NULL; + } + } + + if (row == 0) + STUFF(tw) = (XawTableCell)get_cell(STUFF(tw), 1, 0); + + if (--ROWS(tw) == 0) + STUFF(tw) = (XawTableCell)NULL; + + WalkForCells(w, (XawTableProc)DeleteCell, row, row, 0, COLUMNS(tw)-1); + + row_delete(cell); + + if (XawTableIsEditManaged(w)) + { + tw->table.no_redraw++; + if (row < tw->table.edit_row){ + MoveEditCell (tw, --(tw->table.edit_row), tw->table.edit_column); + } + else if (row == tw->table.edit_row){ + UNMANAGE_EDIT(tw); + tw->table.edit_row = InRange (tw->table.edit_row, 0, ROWS(tw)-1); + XawTableSetEdit (w, tw->table.edit_row, tw->table.edit_column); + } + tw->table.no_redraw--; + } + + UpdateTable(tw); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + return ACCEPT; +} + + + +/************************************************************** + * + * + * + * COLUMN routines + * + * + * + **************************************************************/ + +int +#ifdef Xraw_NEED_PROTO +XawTablePrependColumn (Widget w, int width) +#else +XawTablePrependColumn (w, width) + Widget w; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int j; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "prependColumn", "XawTablePrependColumn","XawToolkitError", + "An attempt to add a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ALLOW_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + column_insert_before(STUFF(tw), sizeof(XawTableCellRec)); + COLUMNS(tw)++; + + STUFF(tw) = (XawTableCell)get_table(STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, 0, ROWS(tw)-1, 0, 0); + + /* + * insert new item in `column_data' list + */ + + if (tw->table.column_data) + { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + else + { + tw->table.column_data = CALLOC(COLUMNS(tw), XawTableColumnRec); + for(j = 0; j < COLUMNS(tw); j++) + COLUMN_DATA(tw)[j].flag = 0; + } + + for(j = COLUMNS(tw)-2; j >= 0; j--) + (void)memcpy((char*)&(COLUMN_DATA(tw)[j+1]), (char*)&(COLUMN_DATA(tw)[j]), + sizeof(XawTableColumnRec)); + + COLUMN_DATA(tw)[0].flag |= _CL_width; + COLUMN_DATA(tw)[0].width = width; + + + if (XawTableIsEditManaged(w)) + MoveEditCell (tw, tw->table.edit_row, ++(tw->table.edit_column)); + + /* Let's look the table which we have made now */ + UpdateTable(tw); + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddColumn)) + { + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddColumn, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableAppendColumn (Widget w, int width) +#else +XawTableAppendColumn (w, width) + Widget w; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int j; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "addingColumn", "XawTableAppendColumn","XawToolkitError", + "An attempt to add a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), 0, COLUMNS(tw)-1); + + callback_str.reason = XawTABLE_ALLOW_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + column_insert_after(get_cell(STUFF(tw), 0, COLUMNS(tw)-1), + sizeof(XawTableCellRec)); + + COLUMNS(tw)++; + + WalkForCells(w, (XawTableProc)InitCell, + 0, ROWS(tw)-1, COLUMNS(tw)-1, COLUMNS(tw)-1); + + + + + /* + * insert new item in `column_data' list + */ + + if (tw->table.column_data) + { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + else + { + tw->table.column_data = CALLOC(COLUMNS(tw), XawTableColumnRec); + for(j = 0; j < COLUMNS(tw); j++) + COLUMN_DATA(tw)[j].flag = 0; + } + + COLUMN_DATA(tw)[COLUMNS(tw)-1].flag |= _CL_width; + COLUMN_DATA(tw)[COLUMNS(tw)-1].width = width; + + + /* Let's look the table which we have made now */ + UpdateTable(tw); + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddColumn)) + { + cell = (XawTableCell)get_cell(STUFF(tw), 0, COLUMNS(tw)-1); + + callback_str.reason = XawTABLE_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = COLUMNS(tw)-1; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddColumn, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableInsertColumn (Widget w, int column, int width) +#else +XawTableInsertColumn(w, column, width) + Widget w; + int column; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int j; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertColumn", "XawTableInsertColumn","XawToolkitError", + "An attempt to add a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (column != InRange(column, 0, COLUMNS(tw)-1)) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertColumn", "XawTableInsertColumn","XawToolkitError", + "It detected incorrect value of column in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_ALLOW_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + column_insert_before (get_cell ((XtPointer)STUFF(tw), 0, column), + sizeof(XawTableCellRec)); + COLUMNS(tw)++; + + if (column == 0) + STUFF(tw) = (XawTableCell) get_table (STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, 0, ROWS(tw)-1, column, column); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + /* + * insert new item in `column_data' list + */ + + if (tw->table.column_data) + { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + else + { + tw->table.column_data = CALLOC(COLUMNS(tw), XawTableColumnRec); + for(j = 0; j < COLUMNS(tw); j++) + COLUMN_DATA(tw)[j].flag = 0; + } + + for(j = COLUMNS(tw)-2; j >= column; j--) + (void)memcpy((char*)&(COLUMN_DATA(tw)[j+1]), (char*)&(COLUMN_DATA(tw)[j]), + sizeof(XawTableColumnRec)); + + COLUMN_DATA(tw)[column].flag |= _CL_width; + COLUMN_DATA(tw)[column].width = width; + + /* + * move the edit cell + */ + + if (XawTableIsEditManaged(w) && column <= tw->table.edit_column){ + tw->table.no_redraw++; + MoveEditCell (tw, tw->table.edit_row, ++(tw->table.edit_column)); + tw->table.no_redraw--; + } + + /* Let's look the table which we have made now */ + UpdateTable(tw); + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddColumn)) + { + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddColumn, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableDeleteColumn (Widget w, int column) +#else +XawTableDeleteColumn(w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int j; + XawTableCallbackStruct callback_str; + + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteColumn", "XawTableDeleteColumn","XawToolkitError", + "An attempt to delete a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (column != InRange(column, 0, COLUMNS(tw)-1)) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteColumn", "XawTableDeleteColumn","XawToolkitError", + "It detected incorrect value of column in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_ALLOW_DELETE_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowDeleteColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNdeleteColumn)) + { + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_DELETE_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNdeleteColumn, (XtPointer)&callback_str); + } + + /* if selections owner locates here, then disown selections */ + + if (tw->table.cell_own != (XawTableCell)NULL) + { + Boolean have_find; + int i, j; + + have_find = go_table((XtPointer)w, CompareCells, STUFF(tw), + 0, ROWS(tw)-1, column, column, + XawTABLE_RIGHT_DOWN, &i, &j, + (XtPointer)tw->table.cell_own); + if (have_find) { + for (; 0 < tw->table.num_selections;) + XtDisownSelection (w, + tw->table.selections[--(tw->table.num_selections)], + XtLastTimestampProcessed(XtDisplay(w))); + + tw->table.cell_own = (XawTableCell)NULL; + } + } + + if (column == 0) + STUFF(tw) = (XawTableCell)get_cell(STUFF(tw), 0, 1); + + if (--COLUMNS(tw) == 0) + STUFF(tw) = (XawTableCell)NULL; + + + WalkForCells(w, (XawTableProc)DeleteCell, 0, ROWS(tw)-1, column, column); + + column_delete(cell); + + /* + * shrink column data list + */ + + if (COLUMNS(tw) == 0) { + XtFree((XtPointer)tw->table.column_data); + tw->table.column_data = NULL; + } + else + { + for(j = column; j < COLUMNS(tw); j++) + (void)memcpy((char*)&(COLUMN_DATA(tw)[j]),(char*)&(COLUMN_DATA(tw)[j+1]), + sizeof(XawTableColumnRec)); + + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + + + /* + * shift the edit cell + */ + + if (XawTableIsEditManaged(w)) + { + tw->table.no_redraw++; + if (column < tw->table.edit_column){ + MoveEditCell (tw, tw->table.edit_row, --(tw->table.edit_column)); + } + else if (column == tw->table.edit_column){ + UNMANAGE_EDIT(tw); + tw->table.edit_column = InRange (tw->table.edit_column,0,COLUMNS(tw)-1); + XawTableSetEdit (w, tw->table.edit_row, tw->table.edit_column); + } + tw->table.no_redraw--; + } + + /* Let's look the table which we have made now */ + UpdateTable(tw); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + return ACCEPT; +} + + +Boolean +#ifdef Xraw_NEED_PROTO +XawTableIsEditManaged (Widget w) +#else +XawTableIsEditManaged (w) + Widget w; +#endif +{ + return XtIsManaged(((XawTableWidget)w)->table.edit); +} + + + +int +#ifdef Xraw_NEED_PROTO +XawTableSetLabel (Widget w, int row, int column, char *raw_label) +#else +XawTableSetLabel(w, row, column, raw_label) + Widget w; + int row; + int column; + char *raw_label; +#endif +{ + register XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + char* label = NULL; + XawTableCellRec new; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange(row, 0, ROWS(tw)-1)) || + (column != InRange(column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetLabel", "XawTableSetLabel","XawToolkitError", +"XawTableSetLabel\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (raw_label == (char*)NULL) + label = DummyString(); + else + label = CopyOnlyPrintable(raw_label); + + if (streq(label,CELL(label))) { + XtFree(label); /* XtMalloc in CopyOnlyPrintable */ + return ACCEPT; + } + + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.label = label; + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it != True) { + XtFree(label); + return REJECT; + } + + + if (CELL(label)) + XtFree(CELL(label)); + + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + SetLabelWidth (tw, row, column); + Reposition (tw, cell, row, column); + + if (IsEditInRowColumn (tw, row, column)) + { + XtVaSetValues (EDIT(w), "string", CELL(label), NULL); + } + else if (XtIsRealized (w) && w->core.visible && !tw->table.no_redraw) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + XClearArea (XtDisplay(w), XtWindow(w), x, y, width, height, FALSE); + (void) PaintCell (w, row, column, (XtPointer)cell, (XtPointer)NULL); + } + return ACCEPT; +} + + + + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellColours (Widget w, int row, int column, + Pixel fore, Pixel back) +#else +XawTableSetCellColours (w, row, column, fore, back) + Widget w; + int row; + int column; + Pixel fore; + Pixel back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + NormalReverseGC* normal; + ShadowGC* shadow; + + + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellColours","XawToolkitError", +"XawTableSetCellColours\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return REJECT; + } + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(special_colour) && fore == CELL(fore) && back == CELL(back)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = True; + new.back = back; + new.fore = fore; + + /* normal and reverse GC's */ + normal = GetNormalGC(w, fore, back, tw->table.font->fid); + + new.normal = normal->normal; + new.reverse = normal->reverse; + + + /* shadow GC's */ + shadow = GetShadowGC(w, back); + + new.top = shadow->top; + new.bottom = shadow->bottom; + + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && + !tw->table.no_redraw && !tw->table.no_refigure) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + ReleaseNormalGC(w, fore, back); + ReleaseShadowGC(w, back); + return REJECT; + } +} + + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellDefaultColours (Widget w, int row, int column) +#else +XawTableSetCellDefaultColours (w, row, column) + Widget w; + int row; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellDefaultColours","XawToolkitError", +"XawTableSetCellDefaultColours\n\ +Incorrect value of row or column (%s,%s) in Table widget '%s'", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (!CELL(special_colour)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = False; + new.fore = tw->table.foreground; + new.back = tw->core.background_pixel; + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && !tw->table.no_redraw) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + return REJECT; + } +} + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellBackground (Widget w, int row, int column, Pixel back) +#else +XawTableSetCellBackground (w, row, column, back) + Widget w; + int row; + int column; + Pixel back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + NormalReverseGC* normal; + ShadowGC* shadow; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellBackground","XawToolkitError", +"XawTableSetCellBackground\n\ +Incorrect value of row or column (%s,%s) in Table widget '%s'", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(special_colour) && back == CELL(back)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = True; + new.back = back; + + if (!CELL(special_colour)) + new.fore = tw->table.foreground; + + /* normal and reverse GC's */ + normal = GetNormalGC(w, new.fore, back, tw->table.font->fid); + + new.normal = normal->normal; + new.reverse = normal->reverse; + + + /* shadow GC's */ + shadow = GetShadowGC(w, back); + + new.top = shadow->top; + new.bottom = shadow->bottom; + + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && !tw->table.no_redraw) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + ReleaseNormalGC(w, new.fore, back); + ReleaseShadowGC(w, back); + return REJECT; + } + +} + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellForeground (Widget w, int row, int column, Pixel fore) +#else +XawTableSetCellForeground (w, row, column, fore) + Widget w; + int row; + int column; + Pixel fore; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + NormalReverseGC* normal; + ShadowGC* shadow; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellBackground","XawToolkitError", +"XawTableSetCellBackground\n\ +Incorrect value of row or column (%s,%s) in Table widget '%s'", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(special_colour) && fore == CELL(fore)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = True; + new.fore = fore; + + if (!CELL(special_colour)) + new.back = tw->core.background_pixel; + + /* normal and reverse GC's */ + normal = GetNormalGC(w, fore, new.back, tw->table.font->fid); + + new.normal = normal->normal; + new.reverse = normal->reverse; + + + /* shadow GC's */ + shadow = GetShadowGC(w, new.back); + + new.top = shadow->top; + new.bottom = shadow->bottom; + + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && !tw->table.no_redraw) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + ReleaseNormalGC(w, fore, new.back); + ReleaseShadowGC(w, new.back); + return REJECT; + } +} + +void +#ifdef Xraw_NEED_PROTO +XawTableGetCellColours (Widget w, int row, int column, + Pixel *fore, Pixel *back) +#else +XawTableGetCellColours (w, row, column, fore, back) + Widget w; + int row; + int column; + Pixel *fore; + Pixel *back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + + if (cell && cell->special_colour) { + *fore = cell->fore; + *back = cell->back; + } + else { + *fore = tw->table.foreground; + *back = tw->core.background_pixel; + } +} + +void +#ifdef Xraw_NEED_PROTO +XawTableGetCellColoursByCell (Widget w, XawTableCell cell, + Pixel *fore, Pixel *back) +#else +XawTableGetCellColoursByCell (w, cell, fore, back) + Widget w; + XawTableCell cell; + Pixel *fore; + Pixel *back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (cell && cell->special_colour) { + *fore = cell->fore; + *back = cell->back; + } + else { + *fore = tw->table.foreground; + *back = tw->core.background_pixel; + } +} + +/*#########################################################################*/ +/*# #*/ +/*# Column Defaults #*/ +/*# #*/ +/*#########################################################################*/ + +#ifdef notdef +/* ARGSUSED */ +static Boolean PaintCellWithClear(p, i, j, call_data, client_data) + XtPointer p; + int i; + int j; + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableWidget tw = (XawTableWidget) w; + XawTableCell cell = (XawTableCell) call_data; + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,j); + unsigned int height = (unsigned int) tw->table.row_height; + Position x; + Position y; + + + x = GetX(tw,j); + y = GetY(tw,i); + + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + + PaintLabel (w, i, j, x, y, cell); + PaintShadow (w, i, j, x, y, cell); + + XFlush(XtDisplay(w)); + return False; +} +#endif + +void +#ifdef Xraw_NEED_PROTO +XawTableSetColumnJustify (Widget w, int column, XtJustify justify) +#else +XawTableSetColumnJustify (w, column, justify) + Widget w; + int column; + XtJustify justify; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int i, j; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return; + + COLUMN_DATA(tw)[column].flag |= _CL_justify; + COLUMN_DATA(tw)[column].justify = justify; + + for(i = 0; i < ROWS(tw); i++) + Reposition(tw, NULL, i, column); + + if (XtIsRealized(w) && w->core.visible && + !tw->table.no_redraw && !tw->table.no_refigure) + { + (void)go_table((XtPointer)w, PaintCell, STUFF(tw), + 0, ROWS(tw)-1, column, column, + XawTABLE_DOWN_RIGHT, + &i, &j, (XtPointer)NULL); + XFlush(XtDisplay(w)); + } +} + + +XtJustify +#ifdef Xraw_NEED_PROTO +XawTableGetColumnJustify (Widget w, int column) +#else +XawTableGetColumnJustify (w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return XtJustifyCenter; + + if (COLUMN_DATA(tw)[column].flag & _CL_justify) + return COLUMN_DATA(tw)[column].justify; + + return XtJustifyCenter; +} + + +void +#ifdef Xraw_NEED_PROTO +XawTableSetColumnWidth (Widget w, int column, int width) +#else +XawTableSetColumnWidth(w, column, width) + Widget w; + int column; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + register int row; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return; + + if ((COLUMN_DATA(tw)[column].flag & _CL_width) && + COLUMN_DATA(tw)[column].width == width) + return; + + COLUMN_DATA(tw)[column].flag |= _CL_width; + COLUMN_DATA(tw)[column].width = width; + + for(row = 0; row < ROWS(tw); row++) + Reposition(tw, NULL, row, column); + + UpdateTable(tw); + + callback_str.reason = XawTABLE_CHANGED_COLUMN_WIDTH; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedColumnWidth, callback_str); +} + + +void +#ifdef Xraw_NEED_PROTO +XawTableSetMultiColumnWidths (Widget w, int *columns, int *widths, int ncols) +#else +XawTableSetMultiColumnWidths (w, columns, widths, ncols) + Widget w; + int *columns; + int *widths; + int ncols; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + register int i, row, col, width; + + for (i=0; i < ncols; i++ ) { + if (columns[i] != InRange (columns[i], 0, COLUMNS(tw)-1)) + return; + } + + for (i=0; i < ncols; i++ ) { + if ((COLUMN_DATA(tw)[columns[i]].flag & _CL_width) && + COLUMN_DATA(tw)[columns[i]].width == widths[i]) + return; + + COLUMN_DATA(tw)[columns[i]].flag |= _CL_width; + COLUMN_DATA(tw)[columns[i]].width = widths[i]; + + for(row = 0; row < ROWS(tw); row++) + Reposition(tw, NULL, row, columns[i]); + } + + UpdateTable(tw); + +/* + callback_str.reason = XawTABLE_CHANGED_COLUMN_WIDTH; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedColumnWidth, callback_str); +*/ +} + + + +int +#ifdef Xraw_NEED_PROTO +XawTableGetColumnWidth (Widget w, int column) +#else +XawTableGetColumnWidth(w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return tw->table.column_default_width; + + if ((COLUMN_DATA(tw)[column].flag & _CL_width)) + return COLUMN_DATA(tw)[column].width; + + return tw->table.column_default_width; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableGetColumnPixelWidth (Widget w, int column) +#else +XawTableGetColumnPixelWidth(w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int width; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + width = tw->table.column_default_width; + else if ((COLUMN_DATA(tw)[column].flag & _CL_width)) + width = COLUMN_DATA(tw)[column].width; + else + width = tw->table.column_default_width; + + if (tw->table.literal) { + width = width * tw->table.literal_width + 2 * tw->table.internal_width; + } + + return width; +} + +char * +#ifdef Xraw_NEED_PROTO +XawTableGetLabelByPosition (Widget w, int i, int j) +#else + XawTableGetLabelByPosition(w,i,j) + Widget w; + int i,j; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (i != InRange(i, 0, ROWS(tw)-1)) || + (j != InRange(j, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", i); + sprintf(subs[1], "%5d", j); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "GetLabelByPosition", "XawTableGetLabelByPosition","XawToolkitError", +"XawTableGetLabelByPosition\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return NULL; + } + + cell = (XawTableCell)get_cell(STUFF(tw), i, j); + return GET_CELL_LABEL; +} + +void +#ifdef Xraw_NEED_PROTO +XawTableUnsetEdit (Widget w) +#else + XawTableUnsetEdit(w) + Widget w; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + char* label; + XawTableCell cell; + + if (XawTableIsEditManaged(w)) + { + tw->table.no_redraw++; + UNMANAGE_EDIT(tw); + tw->table.no_redraw--; + + XtVaGetValues(EDIT(w), "string", &label, NULL); + + label = CopyOnlyPrintable(label); + + cell = (XawTableCell) + get_cell(STUFF(tw),tw->table.edit_row, tw->table.edit_column); + + if (!streq(label,CELL(label))) + XawTableSetLabel(w, tw->table.edit_row, tw->table.edit_column, label); + + XtFree(label); /* XtMalloc in CopyOnlyPrintable */ + } +} + +void +#ifdef Xraw_NEED_PROTO +XawTableSetEdit (Widget w, int row, int column) +#else + XawTableSetEdit(w, row, column) + Widget w; + int row; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + + if (IsEditInRowColumn(tw, row, column) || STUFF(tw) == NULL) + return; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange(row, 0, ROWS(tw)-1)) || + (column != InRange(column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetEdit", "XawTableSetEdit","XawToolkitError", +"XawTableSetEdit\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return; + } + + XawTableUnsetEdit(w); + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(label) == NULL) + XtVaSetValues(EDIT(tw), "string", Dummy, NULL); + else + XtVaSetValues(EDIT(tw), "string", CELL(label), NULL); + + tw->table.edit_row = row; + tw->table.edit_column = column; + + MoveEditCell (tw, tw->table.edit_row, tw->table.edit_column); + + MANAGE_EDIT(tw); +} + +/****************************************************************** + * + * Actions + * + ******************************************************************/ + +static void HighlightCell(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int row, column; + Position x,y; + Time tm; + + if (!tw->table.editable) + return; + + if (*num_params == 2) + { + row = atoi(params[0]); + column = atoi(params[1]); + } + else if (event != (XEvent*)NULL) + { + ExtractPosition(event, &x, &y , &tm); + if (ExtractCell(tw, x, y, &row, &column)) + return ; + } + else + { + return; + } + + cell = (XawTableCell) get_cell (STUFF(tw), row, column); + + if (CELL(highlight)) + return ; + + CELL(highlight) = True; + + x = GetX(tw,column); + y = GetY(tw,row); + + PaintLabel(w, row, column, x, y, cell); + XFlush(XtDisplay(w)); +} + +/* ARGSUSED */ +static void UnhighlightCell(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int row, column; + Position x,y; + Time tm; + unsigned int width; + unsigned int height; + + if (!tw->table.editable) + return; + + if (*num_params == 2) + { + row = atoi(params[0]); + column = atoi(params[1]); + } + else if (event != (XEvent*)NULL) + { + ExtractPosition(event, &x, &y , &tm); + if (ExtractCell(tw, x, y, &row, &column)) + return ; + } + else + { + return; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (!CELL(highlight)) + return ; + + CELL(highlight) = False; + + width = (unsigned int) COLUMN_WIDTH(tw, column) + + 2 * tw->table.label_shadow_thickness; + height = (unsigned int) tw->table.row_height + + 2 * tw->table.label_shadow_thickness; + + XClearArea(XtDisplay(w), XtWindow(w), + (int)GetX(tw,column), + (int)GetY(tw,row), + width, height, FALSE); + + PaintLabel(w, row, column, x, y, cell); + + XFlush(XtDisplay(w)); + +} + +/* ARGSUSED */ +static void WhatCell(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x,y; + int row, column; + XawTableCallbackStruct callback_str; + XawTableCell cell; + Time tm; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + ExtractPosition(event, &x, &y , &tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + cell = (XawTableCell) get_cell (STUFF(tw), row, column); + + callback_str.reason = XawTABLE_WHAT_CELL; + callback_str.event = event; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNwhatCell, callback_str); +} + +/* ARGSUSED */ +static void KeyReturn(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + Widget tw; + KeySym ksSymbol; + + ksSymbol = XtGetActionKeysym(event, (Modifiers*)NULL); + + if (ksSymbol == XK_Return || ksSymbol == XK_Linefeed) + { + XtVaGetValues(w, XtNuserData, &tw, NULL); + XawTableUnsetEdit(tw); + } + +} + +static Atom FetchAtom(w, name) + Widget w; + String name; +{ + Atom a; + XrmValue source, dest; + + source.size = strlen(name)+1; + source.addr = name; + dest.size = sizeof(Atom); + dest.addr = (XtPointer) &a; + + (void) XtConvertAndStore(w, XtRString, &source, XtRAtom, &dest); + return a; +} + +/* ARGSUSED */ +static Boolean DeliverSelection(w, selection, target, + type, value, length, format) + Widget w; + Atom *selection, *target, *type; + XtPointer *value; + unsigned long *length; + int *format; +{ + XawTableWidget tw = (XawTableWidget) w; + static Atom targets = 0; + + if (targets == 0) { + targets = FetchAtom(w, "TARGETS"); + } + + if (*target == targets) { + *type = XA_ATOM; + *value = (XtPointer) CALLOC(1, Atom); + *(Atom *) *value = XA_STRING; + *length = 1; + *format = 32; + return TRUE; + } + + if (*target == XA_STRING) { + *type = XA_STRING; + *value = (XtPointer) XtNewString(tw->table.cell_own->label); + *length = tw->table.cell_own->label_len; + *format = 8; + return TRUE; + } + + return FALSE; +} + +/* ARGSUSED */ +static void LoseSelection(w, selection) + Widget w; + Atom *selection; +{ + XawTableWidget tw = (XawTableWidget) w; + XawTableCell cell; + int row, column; + int x,y; + unsigned int width, height; + + cell = tw->table.cell_own; + tw->table.cell_own = (XawTableCell)NULL; + + if (!CELL(highlight)) + return ; + + get_cell_positions(cell, &row, &column); + + CELL(highlight) = False; + + x = GetX(tw,column) + tw->table.label_shadow_thickness; + y = GetY(tw,row) + tw->table.label_shadow_thickness; + width = (unsigned int) COLUMN_WIDTH(tw, column); + height = (unsigned int) tw->table.row_height; + + XClearArea(XtDisplay(w), XtWindow(w), x, y, width, height, FALSE); + (void)PaintCell(w, row, column, (XtPointer)cell, (XtPointer)NULL); + + XFlush(XtDisplay(w)); +} + +static int GetCutBufferNumber(); + +static void StoreBuffer(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* selections in precedence order */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x, y; + int row, column; + int i, buffer; + Time tm; + Atom selection; + + if (!tw->table.editable) + return; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + ExtractPosition(event, &x, &y ,&tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + if (tw->table.cell_own != (XawTableCell)NULL) + LoseSelection(w, (Atom*)NULL); + + tw->table.cell_own = (XawTableCell)get_cell(STUFF(tw), row, column); + + for(i=0; i<(int)*num_params; i++) { + selection = FetchAtom(w, *(String *)(params+i)); + + buffer = GetCutBufferNumber(selection); + + if (buffer >= 0) { + if (buffer == 0) { + +#define Create(buffer) \ + XChangeProperty(XtDisplay(w), DefaultRootWindow(XtDisplay(w)),\ + buffer,XA_STRING, 8,PropModeAppend, NULL, 0) + + Create(XA_CUT_BUFFER0); + Create(XA_CUT_BUFFER1); + Create(XA_CUT_BUFFER2); + Create(XA_CUT_BUFFER3); + Create(XA_CUT_BUFFER4); + Create(XA_CUT_BUFFER5); + Create(XA_CUT_BUFFER6); + Create(XA_CUT_BUFFER7); +#undef Create + + XRotateBuffers(XtDisplay(w), 1); + } + + XStoreBuffer(XtDisplay(w), tw->table.cell_own->label, + (int)MIN(tw->table.cell_own->label_len, MAXCUT), buffer); + + } else { + tw->table.selections[tw->table.num_selections++] = selection; + + XtOwnSelection (w, selection, tm, + DeliverSelection, LoseSelection, + (XtSelectionDoneProc) NULL); + } + } +} + + +/* ARGSUSED */ +static void CallEdit(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x,y; + int row, column; + Time tm; + + if (!tw->table.editable) + return; + + ExtractPosition(event, &x, &y , &tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + XawTableSetEdit(w, row, column); +} + + + +typedef struct { + Widget w; + Atom *selections; + Time time; + int row; + int column; + int count; + int num; +}RowColumn; + +static void GetProc(); + +static void GetSelection (rc) + RowColumn *rc; +{ + Atom selection; + int buffer; + int nbytes; + char *label; + + selection = *(rc->selections + rc->num); + + if (rc->num < rc->count){ + + buffer = GetCutBufferNumber(selection); + + if (buffer >= 0) { + label = XFetchBuffer(XtDisplay(rc->w), &nbytes, buffer); + XawTableSetLabel(rc->w, rc->row, rc->column, label); + XtFree((XtPointer)rc->selections); + XtFree((XtPointer)rc); + }else { + XtGetSelectionValue(rc->w, selection, XA_STRING, GetProc, + (XtPointer)rc, rc->time); + rc->num++; + } + } +} + +/* ARGSUSED */ +static void GetProc(w, client_data, selection, + type, value, length, format) + Widget w; + XtPointer client_data; + Atom *selection; + Atom *type; + XtPointer value; + unsigned long *length; + int *format; +{ + RowColumn *rc = (RowColumn*)client_data; + + if ((*type == XA_STRING) && (value != NULL)) { + XawTableSetLabel(w, rc->row, rc->column, (char*)value); + XtFree((XtPointer)value); + XtFree((XtPointer)client_data); + }else { + GetSelection(rc); + } + +} + +static void InsertSelection(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* selections in precedence order */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x,y; + int row, column; + RowColumn *rc; + Time tm; + + if (!tw->table.editable) + return; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + ExtractPosition(event, &x, &y ,&tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + if (*num_params > 0) { + + rc = XtNew(RowColumn); + + rc->time = tm; + rc->w = w; + rc->row = row; + rc->column = column; + rc->count = (int)*num_params; + rc->num = 0; + + if (*num_params > (Cardinal)0) { + rc->selections = CALLOC(*num_params, Atom); + XmuInternStrings(XtDisplay(w), params, *num_params, rc->selections); + } else { + rc->selections = XtNew(Atom); + *rc->selections = FetchAtom(w, "PRIMARY"); + } + GetSelection(rc); + } +} + + +static int GetCutBufferNumber(atom) + register Atom atom; +{ + if (atom == XA_CUT_BUFFER0) return(0); + if (atom == XA_CUT_BUFFER1) return(1); + if (atom == XA_CUT_BUFFER2) return(2); + if (atom == XA_CUT_BUFFER3) return(3); + if (atom == XA_CUT_BUFFER4) return(4); + if (atom == XA_CUT_BUFFER5) return(5); + if (atom == XA_CUT_BUFFER6) return(6); + if (atom == XA_CUT_BUFFER7) return(7); + return(-1); +} + + +/* ARGSUSED */ +static void DoingNothing(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + /* doing nothing */ +} + diff --git a/vendor/x11iraf/obm/ObmW/Table.h b/vendor/x11iraf/obm/ObmW/Table.h new file mode 100644 index 00000000..4c7ab5cf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Table.h @@ -0,0 +1,539 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _XawTable_h +#define _XawTable_h + +#include <X11/Xmu/Converters.h> + +#include <X11/Xraw/Simple.h> +#include <X11/Xraw/XawInit.h> + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resources #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XawTextEncoding8bit +#define XawTextEncoding8bit 0 +#endif +#ifndef XawTextEncodingChar2b +#define XawTextEncodingChar2b 1 +#endif + +#ifndef XtNliteral +#define XtNliteral "literal" +#endif + +#ifndef XtNrows +#define XtNrows "rows" +#endif + +#ifndef XtNcolumns +#define XtNcolumns "columns" +#endif + + +#ifndef XtNmaskNumber +#define XtNmaskNumber "maskNumber" +#endif + +#ifndef XtNrowOriented +#define XtNrowOriented "rowOriented" +#endif + +#ifndef XtNeditForeground +#define XtNeditForeground "editForeground" +#endif + +#ifndef XtNeditBackground +#define XtNeditBackground "editBackground" +#endif + +#ifndef XtNcolumnForeground +#define XtNcolumnForeground "columnForeground" +#endif + +#ifndef XtNrowForeground +#define XtNrowForeground "rowForeground" +#endif + +#ifndef XtNvetricalScroll +#define XtNvetricalScroll "vetricalScroll" +#endif + +#ifndef XtNhorizontalScroll +#define XtNhorizontalScroll "horizontalScroll" +#endif + +#ifndef XtNcolumnsWidth +#define XtNcolumnsWidth "columnsWidth" +#endif + +#ifndef XtNrowHeight +#define XtNrowHeight "rowHeight" +#endif + +#ifndef XtNdefaultWidth +#define XtNdefaultWidth "defaultWidth" +#endif + +#ifndef XtNeditable +#define XtNeditable "editable" +#endif + +#ifndef XtNliteralWidth +#define XtNliteralWidth "literalWidth" +#endif + +#ifndef XtNtableMargin +#define XtNtableMargin "tableMargin" +#endif + +#ifndef XtNrowMargin +#define XtNrowMargin "rowMargin" +#endif + +#ifndef XtNcolumnMargin +#define XtNcolumnMargin "columnMargin" +#endif + +#ifndef XtNlabelShadowWidth +#define XtNlabelShadowWidth "labelShadowWidth" +#endif + +#ifndef XtNencoding +#define XtNencoding "encoding" +#endif + + + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Classes #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtCLiteral +#define XtCLiteral "Literal" +#endif + +#ifndef XtCColumns +#define XtCColumns "Columns" +#endif + +#ifndef XtCMaskNumber +#define XtCMaskNumber "MaskNumber" +#endif + +#ifndef XtCScroll +#define XtCScroll "Scroll" +#endif + +#ifndef XtCColumnsWidth +#define XtCColumnsWidth "ColumnsWidth" +#endif + +#ifndef XtCRowHeight +#define XtCRowHeight "RowHeight" +#endif + +#ifndef XtCDefaultWidth +#define XtCDefaultWidth "DefaultWidth" +#endif + +#ifndef XtCEditable +#define XtCEditable "Editable" +#endif + +#ifndef XtCLiteralWidth +#define XtCLiteralWidth "LiteralWidth" +#endif + +#ifndef XtCRows +#define XtCRows "Rows" +#endif + +#ifndef XtCTableMargin +#define XtCTableMargin "TableMargin" +#endif + +#ifndef XtCRowMargin +#define XtCRowMargin "RowMargin" +#endif + +#ifndef XtCColumnMargin +#define XtCColumnMargin "ColumnMargin" +#endif + +#ifndef XtCLabelShadowWidth +#define XtCLabelShadowWidth "LabelShadowWidth" +#endif + +#ifndef XtCEncoding +#define XtCEncoding "Encoding" +#endif + + + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Types #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtRColumnsWidth +#define XtRColumnsWidth "ColumnsWidth" +#endif + +#ifndef XtCRowOriented +#define XtCRowOriented "RowOriented" +#endif + + +/*#########################################################################*/ +/*# #*/ +/*# Allowance Callbacks #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNallowAddColumn +#define XtNallowAddColumn "allowAddColumn" +#endif + +#ifndef XtNallowAddRow +#define XtNallowAddRow "allowAddRow" +#endif + +#ifndef XtNallowDeleteColumn +#define XtNallowDeleteColumn "allowDeleteColumn" +#endif + +#ifndef XtNallowDeleteRow +#define XtNallowDeleteRow "allowDeleteRow" +#endif + +#ifndef XtNallowDeleteTable +#define XtNallowDeleteTable "allowDeleteTable" +#endif + + +/*#########################################################################*/ +/*# #*/ +/*# Information Callbacks #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNaddColumn +#define XtNaddColumn "addColumn" +#endif + +#ifndef XtNaddRow +#define XtNaddRow "addRow" +#endif + +#ifndef XtNchangedCell +#define XtNchangedCell "changedCell" +#endif + +#ifndef XtNchangedColumnWidth +#define XtNchangedColumnWidth "changedColumnWidth" +#endif + +#ifndef XtNchangedRowHeight +#define XtNchangedRowHeight "changedRowHeight" +#endif + +#ifndef XtNcreateTable +#define XtNcreateTable "createTable" +#endif + +#ifndef XtNdeleteColumn +#define XtNdeleteColumn "deleteColumn" +#endif + +#ifndef XtNdeleteRow +#define XtNdeleteRow "deleteRow" +#endif + +#ifndef XtNdeleteTable +#define XtNdeleteTable "deleteTable" +#endif + +#ifndef XtNwhatCell +#define XtNwhatCell "whatCell" +#endif + + + +/*#########################################################################*/ +/*# #*/ +/*# XawTableCell & XawTableColumn #*/ +/*# #*/ +/*#########################################################################*/ +typedef struct _XawTableCellRec *XawTableCell; /* opaque to outside */ + +typedef struct _XawTableColumnRec *XawTableColumn; /* opaque to outside */ + + + +/*#########################################################################*/ +/*# #*/ +/*# Bypass Routine and Direction Types #*/ +/*# #*/ +/*#########################################################################*/ +typedef Boolean (*XawTableProc) Xraw_PROTO((Widget, + int, + int, + XawTableCell, + XtPointer)); +enum XawTableBypassDirection{ + XawTABLE_RIGHT_DOWN, + XawTABLE_DOWN_RIGHT +}; + + +/*#########################################################################*/ +/*# #*/ +/*# Callback Reasons #*/ +/*# #*/ +/*#########################################################################*/ +enum XawTableReasons{ + XawTABLE_ALLOW_ADD_COLUMN = Xraw_TABLE, + XawTABLE_ALLOW_ADD_ROW, + XawTABLE_ALLOW_CREATE_TABLE, + XawTABLE_ALLOW_DELETE_COLUMN, + XawTABLE_ALLOW_DELETE_ROW, + XawTABLE_ALLOW_DELETE_TABLE, + + XawTABLE_ADD_COLUMN, + XawTABLE_ADD_ROW, + XawTABLE_CHANGED_CELL, + XawTABLE_CHANGED_COLUMN_WIDTH, + XawTABLE_CHANGED_ROW_HEIGHT, + XawTABLE_CREATE_TABLE, + XawTABLE_DELETE_COLUMN, + XawTABLE_DELETE_ROW, + XawTABLE_DELETE_TABLE, + XawTABLE_WHAT_CELL +}; + + +/*#########################################################################*/ +/*# #*/ +/*# Callback Structure #*/ +/*# #*/ +/*#########################################################################*/ +typedef struct { + int reason; + XEvent *event; + XawTableCell old_cell; + XawTableCell new_cell; + int row; + int column; + Boolean do_it; +}XawTableCallbackStruct; + + +/*#########################################################################*/ +/*# #*/ +/*# Layout Control Routine #*/ +/*# #*/ +/*#########################################################################*/ +extern void XawTableDoLayout Xraw_PROTO((Widget w, + Boolean do_layout)); + + +/*#########################################################################*/ +/*# #*/ +/*# Stuff Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTableSetNewSize Xraw_PROTO((Widget w, + int rows, + int columns)); + +extern void XawTableGetSize Xraw_PROTO((Widget w, + int *rows, + int *columns)); + + +/*#########################################################################*/ +/*# #*/ +/*# Row Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTablePrependRow Xraw_PROTO((Widget w)); + +extern int XawTableAppendRow Xraw_PROTO((Widget w)); + +extern int XawTableInsertRow Xraw_PROTO((Widget w, int row)); + +extern int XawTableDeleteRow Xraw_PROTO((Widget w, int row)); + + +/*#########################################################################*/ +/*# #*/ +/*# Column Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTablePrependColumn Xraw_PROTO((Widget w, int width)); + +extern int XawTableAppendColumn Xraw_PROTO((Widget w, int width)); + +extern int XawTableInsertColumn Xraw_PROTO((Widget w, + int column, + int width)); + +extern int XawTableDeleteColumn Xraw_PROTO((Widget w, int column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Set Label Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern char *XawTableGetLabelByCell Xraw_PROTO((XawTableCell cell)); + +extern char *XawTableGetLabelByPosition Xraw_PROTO((Widget w, + int row, + int column)); + +extern int XawTableSetLabel Xraw_PROTO((Widget w, + int row, + int column, + char *label)); + + +/*#########################################################################*/ +/*# #*/ +/*# Bypass Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern Boolean XawTableWalk Xraw_PROTO((Widget w, + XawTableProc proc, + int b_row, + int e_row, + int b_column, + int e_column, + int direction, + int *row, int *column, + XtPointer client_data)); + +extern Boolean XawTableSearchLabel Xraw_PROTO((Widget w, + char *name, + int *row, + int *column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Edit Cell Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern Boolean XawTableIsEditManaged Xraw_PROTO((Widget w)); + +extern void XawTableGetEditPosition Xraw_PROTO((Widget w, + int *row, + int *column)); + +extern void XawTableUnsetEdit Xraw_PROTO((Widget w)); + +extern void XawTableSetEdit Xraw_PROTO((Widget w, + int row, + int column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Set Colour Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTableSetCellBackground Xraw_PROTO((Widget w, + int row, + int column, + Pixel background)); + +extern int XawTableSetCellForeground Xraw_PROTO((Widget w, + int row, + int column, + Pixel foreground)); + +extern int XawTableSetCellDefaultColours Xraw_PROTO((Widget w, + int row, + int column)); + +extern int XawTableSetCellColours Xraw_PROTO((Widget w, + int row, + int column, + Pixel foreground, + Pixel background)); + + +extern void XawTableGetCellColours Xraw_PROTO((Widget w, + int row, + int column, + Pixel *foreground, + Pixel *background)); + +extern void XawTableGetCellColoursByCell Xraw_PROTO((Widget w, + XawTableCell cell, + Pixel *foreground, + Pixel *background)); + + +/*#########################################################################*/ +/*# #*/ +/*# Column Deta #*/ +/*# #*/ +/*#########################################################################*/ +extern void XawTableSetColumnJustify Xraw_PROTO((Widget w, + int column, + XtJustify justify)); + +extern XtJustify XawTableGetColumnJustify Xraw_PROTO((Widget w, + int column)); + +extern void XawTableSetColumnWidth Xraw_PROTO((Widget w, + int column, + int width)); + +extern int XawTableGetColumnWidth Xraw_PROTO((Widget w, + int column)); + +extern int XawTableGetColumnPixelWidth Xraw_PROTO((Widget w, + int column)); + + + +/*#########################################################################*/ +/*# #*/ +/*# Widget Class Pointer #*/ +/*# #*/ +/*#########################################################################*/ +extern WidgetClass tableWidgetClass; + +typedef struct _TableClassRec *XawTableWidgetClass; +typedef struct _TableRec *XawTableWidget; + + +#endif /* _XawTable_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Table3d.c b/vendor/x11iraf/obm/ObmW/Table3d.c new file mode 100644 index 00000000..06fedd0b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Table3d.c @@ -0,0 +1,924 @@ +#include <X11/Xraw/3d.h> +#include <X11/Xraw/color.h> + +#define WHITE WhitePixelOfScreen +#define BLACK BlackPixelOfScreen +#define SWITCH(a,b) (top_or_bottom == TOP ? a : b) + +#define DEPTH_SCREEN(w) DefaultDepthOfScreen(XtScreen(w)) + +#ifdef MIN +#undef MIN +#endif +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +#ifdef MAX +#undef MAX +#endif +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define TOP_VALUE_RATIO (1.3) +#define BOT_VALUE_RATIO (0.6) +#define ARM_VALUE_RATIO (0.85) + +#define Top_Cash (1<<0L) +#define Bot_Cash (1<<1L) +#define Arm_Cash (1<<2L) + +typedef struct _ColorCashRec { + struct _ColorCashRec* nxt; + XColor col; + RGB rgb[1]; + HSV hsv[1]; + RGB top[1]; + RGB bot[1]; + RGB arm[1]; + unsigned int set; +}ColorCashRec, *ColorCash; + +static ColorCashRec* color_cash = NULL; +static void GetTopShadow(); + + +static void GetTopShadow(trom ,to) + XColor* trom; + XColor* to; +{ + ColorCashRec* cash; + float save; + + for (cash = color_cash; cash != NULL; cash = cash->nxt) + { + if (cash->col.red == trom->red && + cash->col.green == trom->green && + cash->col.blue == trom->blue) + { + if (cash->set & Top_Cash) + { + to->red = cash->top[0].r; + to->green = cash->top[0].g; + to->blue = cash->top[0].b; + } + else + { + save = cash->hsv[0].v; + cash->hsv[0].v *= TOP_VALUE_RATIO; + cash->hsv[0].v = MIN(cash->hsv[0].v, 1.0); + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->top); + + cash->hsv[0].v = save; + + to->red = cash->top[0].r; + to->green = cash->top[0].g; + to->blue = cash->top[0].b; + + cash->set |= Top_Cash; + } + + return; + } + } + + cash = XtNew (ColorCashRec); + + cash->col.red = cash->rgb[0].r = trom->red; + cash->col.green = cash->rgb[0].g = trom->green; + cash->col.blue = cash->rgb[0].b = trom->blue; + + RGBToHSV((RGB*)cash->rgb, (HSV*)cash->hsv); + + save = cash->hsv[0].v; + cash->hsv[0].v *= TOP_VALUE_RATIO; + cash->hsv[0].v = MIN(cash->hsv[0].v, 1.0); + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->top); + + cash->hsv[0].v = save; + + to->red = cash->top[0].r; + to->green = cash->top[0].g; + to->blue = cash->top[0].b; + + cash->set = Top_Cash; + + cash->nxt = color_cash; + color_cash = cash; +} + +static void GetBotShadow(trom ,to) + XColor* trom; + XColor* to; +{ + ColorCashRec* cash; + float save; + + for (cash = color_cash; cash != NULL; cash = cash->nxt) + { + if (cash->col.red == trom->red && + cash->col.green == trom->green && + cash->col.blue == trom->blue) + { + if (cash->set & Bot_Cash) + { + to->red = cash->bot[0].r; + to->green = cash->bot[0].g; + to->blue = cash->bot[0].b; + } + else + { + save = cash->hsv[0].v; + cash->hsv[0].v *= BOT_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->bot); + + cash->hsv[0].v = save; + + to->red = cash->bot[0].r; + to->green = cash->bot[0].g; + to->blue = cash->bot[0].b; + + cash->set |= Bot_Cash; + } + + return; + } + } + + cash = XtNew (ColorCashRec); + + cash->col.red = cash->rgb[0].r = trom->red; + cash->col.green = cash->rgb[0].g = trom->green; + cash->col.blue = cash->rgb[0].b = trom->blue; + + RGBToHSV((RGB*)cash->rgb, (HSV*)cash->hsv); + + save = cash->hsv[0].v; + cash->hsv[0].v *= BOT_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->bot); + + cash->hsv[0].v = save; + + to->red = cash->bot[0].r; + to->green = cash->bot[0].g; + to->blue = cash->bot[0].b; + + cash->set = Bot_Cash; + + cash->nxt = color_cash; + color_cash = cash; +} + +static void GetArmShadow(trom ,to) + XColor* trom; + XColor* to; +{ + ColorCashRec* cash; + float save; + + for (cash = color_cash; cash != NULL; cash = cash->nxt) + { + if (cash->col.red == trom->red && + cash->col.green == trom->green && + cash->col.blue == trom->blue) + { + if (cash->set & Arm_Cash) + { + to->red = cash->arm[0].r; + to->green = cash->arm[0].g; + to->blue = cash->arm[0].b; + } + else + { + save = cash->hsv[0].v; + cash->hsv[0].v *= ARM_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->arm); + + cash->hsv[0].v = save; + + to->red = cash->arm[0].r; + to->green = cash->arm[0].g; + to->blue = cash->arm[0].b; + + cash->set |= Arm_Cash; + } + + return; + } + } + + cash = XtNew (ColorCashRec); + + cash->col.red = cash->rgb[0].r = trom->red; + cash->col.green = cash->rgb[0].g = trom->green; + cash->col.blue = cash->rgb[0].b = trom->blue; + + RGBToHSV((RGB*)cash->rgb, (HSV*)cash->hsv); + + save = cash->hsv[0].v; + cash->hsv[0].v *= ARM_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->arm); + + cash->hsv[0].v = save; + + to->red = cash->arm[0].r; + to->green = cash->arm[0].g; + to->blue = cash->arm[0].b; + + cash->set = Arm_Cash; + + cash->nxt = color_cash; + color_cash = cash; +} + +unsigned int shadowpm_width = 8; +unsigned int shadowpm_height= 8; + +static unsigned char shadow_bits[] = { + 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55}; + +static unsigned char mtshadowpm_bits[] = { + 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24}; + +static unsigned char mbshadowpm_bits[] = { + 0x6d, 0xdb, 0xb6, 0x6d, 0xdb, 0xb6, 0x6d, 0xdb}; + + +GC +#ifdef Xraw_NEED_PROTO +AllocGCFromPixmap (Widget w, Pixmap pixmap) +#else +AllocGCFromPixmap(w, pixmap) + Widget w; + Pixmap pixmap; +#endif +{ + XGCValues values; + + if (pixmap != None) { + values.tile = pixmap; + values.fill_style = FillTiled; + return XtGetGC(w, (XtGCMask)(GCTile | GCFillStyle), &values); + } + + return XtGetGC(w, (XtGCMask)0, (XGCValues *)NULL); +} + +GC +#ifdef Xraw_NEED_PROTO +AllocGCFromPixel (Widget w, Pixel fore) +#else +AllocGCFromPixel(w, fore) + Widget w; + Pixel fore; +#endif +{ + XGCValues values; + + values.foreground = fore; + return XtGetGC(w, GCForeground, &values); +} + +static Pixmap Depth_1_ShadowPixmap (w, top_or_bottom) + Widget w; + int top_or_bottom; +{ + Screen *scn = XtScreen (w); + + if (DEPTH_SCREEN(w) == 1) + return XCreatePixmapFromBitmapData (XtDisplay (w), + RootWindowOfScreen (scn), + (char *)shadow_bits, + shadowpm_width, + shadowpm_height, + SWITCH(BLACK (scn), WHITE (scn)), + SWITCH(WHITE (scn), BLACK (scn)), + 1); + else + return None; +} + +static Pixmap Depth_NOT_1_ShadowPixmap (w, colour, top_or_bottom) + Widget w; + Pixel colour; + int top_or_bottom; +{ + Display *dpy = XtDisplay (w); + Screen *scn = XtScreen (w); + unsigned long fore; + unsigned long back; + char *pm_data; + int depth = DEPTH_SCREEN(w); + + if (depth == 1) + return None; + + if (colour == WHITE (scn) || colour == BLACK (scn)) { + fore = WHITE (scn); + back = BLACK (scn); + pm_data = SWITCH((char *)mtshadowpm_bits, (char *)mbshadowpm_bits); + } else { + fore = colour; + back = SWITCH (WHITE (scn), BLACK (scn)); + pm_data = (char *)shadow_bits; + } + + return XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + (char *)pm_data, + shadowpm_width, + shadowpm_height, + fore, + back, + depth); +} + +Pixmap +#ifdef Xraw_NEED_PROTO +CreateShadowPixmap (Widget w, Pixel colour, int top_or_bottom) +#else +CreateShadowPixmap (w, colour, top_or_bottom) + Widget w; + Pixel colour; + int top_or_bottom; +#endif +{ + if (DEPTH_SCREEN(w) == 1) + return Depth_1_ShadowPixmap (w, top_or_bottom); + else + return Depth_NOT_1_ShadowPixmap (w, colour, top_or_bottom); +} + +#define _MIN(x,y) (unsigned short) ((x) < (y)) ? (x) : (y) +#define _MAX(x,y) (unsigned short) ((x) < (y)) ? (y) : (x) + + +Boolean +#ifdef Xraw_NEED_PROTO +XrawAllocShadowPixel ( + Widget w, + Pixel base, + int brightness, + Pixel *result) +#else +XrawAllocShadowPixel (w, base, brightness, result) + Widget w; + Pixel base; + int brightness; + Pixel *result; /* RETURN */ +#endif +{ + XColor set; + XColor get; + double mult; + Colormap cmap= ((CoreWidget)w)->core.colormap; + unsigned short red; + unsigned short green; + unsigned short blue; + + get.pixel = base; + XQueryColor (XtDisplay (w), cmap, &get); + mult = (double)(100 + brightness) / ((double) 100.0); + + red = mult * (double)get.red; + green = mult * (double)get.green; + blue = mult * (double)get.blue; + + set.red = _MAX(0,_MIN (65535, red)); + set.green = _MAX(0,_MIN (65535, green)); + set.blue = _MAX(0,_MIN (65535, blue)); + +#define EQ(field) (set.field == get.field) + if (EQ(red) && EQ(green) && EQ(blue)) +#undef EQ + return False; + + if (XAllocColor (XtDisplay (w), cmap, &set) != 0) { + *result = set.pixel; + return True; + } else + return False; +} + +GC +#ifdef Xraw_NEED_PROTO +MakeGC (Widget w, + Pixel base, + int brightness, + Boolean pseudo, + int top_or_bottom) +#else +MakeGC(w, base, brightness, pseudo, top_or_bottom) + Widget w; + Pixel base; + int brightness; + Boolean pseudo; + int top_or_bottom; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (pseudo) { + tile = Depth_NOT_1_ShadowPixmap (w, base, top_or_bottom); + return AllocGCFromPixmap(w, tile); + } else { + if (XrawAllocShadowPixel(w, base, brightness, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, top_or_bottom); + return AllocGCFromPixmap(w, tile); + } + } + } else { + tile = Depth_1_ShadowPixmap (w, top_or_bottom); + return AllocGCFromPixmap(w, tile); + } +} + +GC +#ifdef Xraw_NEED_PROTO +MakeTopShadowGC (Widget w, Pixel base) +#else +MakeTopShadowGC(w, base) + Widget w; + Pixel base; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (TopShadowColor(w, base, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, TOP); + return AllocGCFromPixmap(w, tile); + } + } else { + tile = Depth_1_ShadowPixmap (w, TOP); + return AllocGCFromPixmap(w, tile); + } +} + + +GC +#ifdef Xraw_NEED_PROTO +MakeBottomShadowGC (Widget w, Pixel base) +#else +MakeBottomShadowGC(w, base) + Widget w; + Pixel base; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (BottomShadowColor(w, base, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, BOTTOM); + return AllocGCFromPixmap(w, tile); + } + } else { + tile = Depth_1_ShadowPixmap (w, BOTTOM); + return AllocGCFromPixmap(w, tile); + } +} + +GC +#ifdef Xraw_NEED_PROTO +MakeArmedGC (Widget w, Pixel base) +#else +MakeArmedGC(w, base) + Widget w; + Pixel base; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (ArmedColor(w, base, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, BOTTOM); + return AllocGCFromPixmap(w, tile); + } + } else { + tile = Depth_1_ShadowPixmap (w, BOTTOM); + return AllocGCFromPixmap(w, tile); + } +} + +void +#ifdef Xraw_NEED_PROTO +XawDrawFrame (Widget gw, + Position x, + Position y, + Dimension w, + Dimension h, + XawFrameType frame_type, + Dimension t, + GC lightgc, + GC darkgc) +#else +XawDrawFrame (gw, x, y, w, h, frame_type, t, lightgc, darkgc) + Widget gw; + Position x; + Position y; + Dimension w; + Dimension h; + XawFrameType frame_type; + Dimension t; + GC lightgc; + GC darkgc; +#endif +{ + XPoint top_polygon[6]; + XPoint bottom_polygon[6]; + XPoint points[3]; + + + if (t == 0 || w == 0 || h == 0) + return; + + if( lightgc == (GC)NULL ){ + XtWarning("XawDrawFrame: lightgc is NULL in XawDrawFrame."); + return; + } + + if( darkgc == (GC)NULL ){ + XtWarning("XawDrawFrame: darkgc is NULL in XawDrawFrame."); + return; + } + + if (!XtIsRealized(gw)) { + XtWarning("XawDrawFrame: widget is not realized!!!"); + return; + } + +#define topPolygon(i,xx,yy) \ + top_polygon[i].x = (short) (xx); \ + top_polygon[i].y = (short) (yy) + +#define bottomPolygon(i,xx,yy) \ + bottom_polygon[i].x = (short) (xx); \ + bottom_polygon[i].y = (short) (yy) + + + if (frame_type == XawTACK && t <= 2) + frame_type = XawLEDGED; + + switch (frame_type) { + + case XawRAISED : + case XawSUNKEN : + + topPolygon (0,x ,y ); bottomPolygon (0,x+w ,y+h ); + topPolygon (1,x+w ,y ); bottomPolygon (1,x ,y+h ); + topPolygon (2,x+w-t,y+t ); bottomPolygon (2,x+t ,y+h-t); + topPolygon (3,x+t ,y+t ); bottomPolygon (3,x+w-t,y+h-t); + topPolygon (4,x+t ,y+h-t); bottomPolygon (4,x+w-t,y+t ); + topPolygon (5,x ,y+h ); bottomPolygon (5,x+w ,y ); + + if (frame_type == XawSUNKEN) + { + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + top_polygon, 6, Nonconvex, CoordModeOrigin); + + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + bottom_polygon, 6, Nonconvex, CoordModeOrigin); + } + else if (frame_type == XawRAISED) + { + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + top_polygon, 6, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + bottom_polygon, 6, Nonconvex, CoordModeOrigin); + } + + break; + + case XawTACK : + + t -= 2; + + topPolygon (0,x ,y ); bottomPolygon (0,x+w ,y+h ); + topPolygon (1,x+w ,y ); bottomPolygon (1,x ,y+h ); + topPolygon (2,x+w-t,y+t ); bottomPolygon (2,x+t ,y+h-t); + topPolygon (3,x+t ,y+t ); bottomPolygon (3,x+w-t,y+h-t); + topPolygon (4,x+t ,y+h-t); bottomPolygon (4,x+w-t,y+t ); + topPolygon (5,x ,y+h ); bottomPolygon (5,x+w ,y ); + + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + top_polygon, 6, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + bottom_polygon, 6, Nonconvex, CoordModeOrigin); + + points[0].x = x + t + 1; points[0].y = y + h - t - 2; + points[1].x = x + t + 1; points[1].y = y + t + 1; + points[2].x = x + w - t - 2; points[2].y = y + t + 1; + + XDrawLines (XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + points, 3, CoordModeOrigin); + + /* points[0].x = x + t + 1; points[0].y = y + h -t - 1; */ + points[1].x = x + w - t - 2; points[1].y = y + h - t - 2; + /* points[2].x = x + w - t - 1; points[2].y = y + t + 1; */ + + XDrawLines (XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + points, 3, CoordModeOrigin); + + break; + + case XawLEDGED : + + XawDrawFrame(gw, x, y, w, h, XawRAISED, t/2, lightgc, darkgc); + XawDrawFrame(gw, (Position)(x + t/2), (Position)(y + t/2), + (Dimension)(w - 2 * (t/2)), (Dimension)(h - 2 * (t/2)), + XawSUNKEN, t/2, lightgc, darkgc); + break; + + case XawCHISELED : + + XawDrawFrame(gw, x, y, w, h, XawSUNKEN, t/2, lightgc, darkgc); + XawDrawFrame(gw, (Position)(x + t/2),(Position)(y + t/2), + (Dimension)(w - 2 * (t/2)), (Dimension)(h - 2 * (t/2)), + XawRAISED, t/2, lightgc, darkgc); + break; + + default : + break; + + } + +#undef topPolygon +#undef bottomPolygon +} + + +Boolean +#ifdef Xraw_NEED_PROTO +BottomShadowColor( Widget widget, + Pixel base, + Pixel *result) +#else +BottomShadowColor(widget, base, result) + Widget widget; + Pixel base; + Pixel *result; +#endif +{ + Colormap colormap; + XColor color; + + if (XtIsWidget(widget)) + colormap = widget->core.colormap; + else + colormap = (XtParent(widget))->core.colormap; + + color.pixel = base; + + XQueryColor(XtDisplay(widget), colormap, &color); + + GetBotShadow(&color, &color); + + if (XAllocColor (XtDisplay(widget), colormap, &color) != 0) + { + *result = color.pixel; + return True; + } + else + { + HSV hsv; + RGB rgb; + + rgb.r = color.red; + rgb.g = color.green; + rgb.b = color.blue; + + RGBToHSV ((RGB*)&rgb, (HSV*)&hsv); + + if (hsv.v > 0.5) + *result = WhitePixelOfScreen(XtScreen (widget)); + else + *result = BlackPixelOfScreen(XtScreen (widget)); + return True; + } + +} + +Boolean +#ifdef Xraw_NEED_PROTO +TopShadowColor( Widget widget, + Pixel base, + Pixel *result) +#else +TopShadowColor(widget, base, result) + Widget widget; + Pixel base; + Pixel *result; +#endif +{ + Colormap colormap; + XColor color; + + if (XtIsWidget(widget)) + colormap = widget->core.colormap; + else + colormap = (XtParent(widget))->core.colormap; + + color.pixel = base; + + XQueryColor(XtDisplay(widget), colormap, &color); + + GetTopShadow(&color, &color); + + if (XAllocColor (XtDisplay(widget), colormap, &color) != 0) + { + *result = color.pixel; + return True; + } + else + { + HSV hsv; + RGB rgb; + + rgb.r = color.red; + rgb.g = color.green; + rgb.b = color.blue; + + RGBToHSV ((RGB*)&rgb, (HSV*)&hsv); + + if (hsv.v > 0.5) + *result = WhitePixelOfScreen(XtScreen (widget)); + else + *result = BlackPixelOfScreen(XtScreen (widget)); + return True; + } + +} + +Boolean +#ifdef Xraw_NEED_PROTO +ArmedColor( Widget widget, + Pixel base, + Pixel *result) +#else +ArmedColor(widget, base, result) + Widget widget; + Pixel base; + Pixel *result; +#endif +{ + Colormap colormap; + XColor color; + + if (XtIsWidget(widget)) + colormap = widget->core.colormap; + else + colormap = (XtParent(widget))->core.colormap; + + color.pixel = base; + + XQueryColor(XtDisplay(widget), colormap, &color); + + GetArmShadow(&color, &color); + + if (XAllocColor (XtDisplay(widget), colormap, &color) != 0) + { + *result = color.pixel; + return True; + } + else + { + HSV hsv; + RGB rgb; + + rgb.r = color.red; + rgb.g = color.green; + rgb.b = color.blue; + + RGBToHSV ((RGB*)&rgb, (HSV*)&hsv); + + if (hsv.v > 0.5) + *result = WhitePixelOfScreen(XtScreen (widget)); + else + *result = BlackPixelOfScreen(XtScreen (widget)); + return True; + } + +} + + + +#undef assign_max +#undef assign_min + + +void +#ifdef Xraw_NEED_PROTO +DrawRhombus ( + Widget w, + short x, + short y, + short g, + short t, + GC top_shadow_GC, + GC foreground_gc, + GC bottom_shadow_GC, + Boolean state ) +#else +DrawRhombus(w, x, y, g, t, + top_shadow_GC, foreground_gc, bottom_shadow_GC, state) + Widget w; + short x; + short y; + short g; + short t; + GC top_shadow_GC; + GC foreground_gc; + GC bottom_shadow_GC; + Boolean state; +#endif +{ + XPoint top_shade[6]; + XPoint bot_shade[6]; + XPoint center[4]; + +#define topPolygon(i,a,b) top_shade[i].x = a; top_shade[i].y = b +#define bottomPolygon(i,a,b) bot_shade[i].x = a; bot_shade[i].y = b +#define centerPolygon(i,a,b) center[i].x = a; center[i].y = b + + topPolygon(0, x-g , y ); bottomPolygon(0, x-g , y ); + topPolygon(1, x-g+t, y ); bottomPolygon(1, x-g+t, y ); + topPolygon(2, x , y-g+t); bottomPolygon(2, x , y+g-t); + topPolygon(3, x+g-t, y ); bottomPolygon(3, x+g-t, y ); + topPolygon(4, x+g , y ); bottomPolygon(4, x+g , y ); + topPolygon(5, x , y-g ); bottomPolygon(5, x , y+g ); + + if (state) + { + if (foreground_gc) + { + centerPolygon(0, x-g+t, y ); + centerPolygon(1, x , y-g+t); + centerPolygon(2, x+g-t, y ); + centerPolygon(3, x , y+g-t); + + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), foreground_gc, + center, XtNumber(center), + Convex, CoordModeOrigin); + } + + if (bottom_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), bottom_shadow_GC, + top_shade, XtNumber(top_shade), Nonconvex, CoordModeOrigin); + + if (top_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), top_shadow_GC, + bot_shade, XtNumber(bot_shade), Nonconvex, CoordModeOrigin); + }else{ + + if (top_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), top_shadow_GC, + top_shade, XtNumber(top_shade), + Nonconvex, CoordModeOrigin); + + if (bottom_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), bottom_shadow_GC, + bot_shade, XtNumber(bot_shade), + Nonconvex, CoordModeOrigin); + } + +#undef topPolygon +#undef bottomPolygon +#undef centerPolygon + +} + +Boolean +#ifdef Xraw_NEED_PROTO +FetchPixel (Widget w, String name, Pixel* pixel) +#else +FetchPixel(w, name, pixel) + Widget w; + String name; + Pixel* pixel; +#endif +{ + XrmValue source, dest; + + source.size = strlen(name)+1; + source.addr = name; + dest.size = sizeof(Pixel); + dest.addr = (caddr_t) pixel; + + return XtConvertAndStore(w, XtRString, &source, XtRPixel, &dest); +} diff --git a/vendor/x11iraf/obm/ObmW/Table3d.h b/vendor/x11iraf/obm/ObmW/Table3d.h new file mode 100644 index 00000000..61125ceb --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Table3d.h @@ -0,0 +1,145 @@ +#ifndef _3d_h_ +#define _3d_h_ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xraw/XawInit.h> + +typedef enum { + XawRAISED = Xraw_3d, + XawSUNKEN, + XawCHISELED, + XawLEDGED, + XawTACK +} XawFrameType; + +#define TOP (1) +#define BOTTOM (2) + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean TopShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean ArmedColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); + + +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + + +extern Pixmap CreateShadowPixmap Xraw_PROTO((Widget , + Pixel , + int )); + + +extern Boolean XrawAllocShadowPixel Xraw_PROTO((Widget , + Pixel , + int , + Pixel * )); + + +extern GC MakeGC Xraw_PROTO((Widget , + Pixel , + int , + Boolean , + int )); + + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern void XawDrawFrame Xraw_PROTO((Widget , + Position , + Position , + Dimension , + Dimension , + XawFrameType , + Dimension , + GC , + GC )); + + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean TopShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean ArmedColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern void DrawRhombus Xraw_PROTO((Widget , + short , + short , + short , + short , + GC , + GC , + GC , + Boolean )); + +extern Boolean FetchPixel Xraw_PROTO((Widget , + String name , + Pixel* )); + +#endif /* _3d_h_ */ + + + + diff --git a/vendor/x11iraf/obm/ObmW/TableP.h b/vendor/x11iraf/obm/ObmW/TableP.h new file mode 100644 index 00000000..352fb278 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/TableP.h @@ -0,0 +1,166 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advises, new components and patches of the existing programs. +Commercial usage is also possible with participation of it's author. + +*************************************************************************/ + +#ifndef _XawTableP_h +#define _XawTableP_h + +/*********************************************************************** + * + * Table Widget Private Data + * + ***********************************************************************/ + + +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Table.h> +#include <X11/Xraw/xraw_table.h> + +/* New fields for the Table widget class record */ + +typedef struct {int foo;} TableClassPart; + +/* Full class record declaration */ +typedef struct _TableClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + TableClassPart table_class; +} TableClassRec; + +#define MAX_ROWS 50 + +typedef struct _NormalReverseGC { + int used; + Pixel fore; + Pixel back; + GC normal; + GC reverse; +}NormalReverseGC; + +typedef struct _ShadowGC { + int used; + Pixel back; + GC top; + GC bottom; +}ShadowGC; + + + +/* New fields for the Table widget record */ +typedef struct { + /* ------------------------ resources -----------------------*/ + Pixel row_fore; + Pixel column_fore; + Pixel edit_fore; + Pixel edit_back; + Boolean row_oriented; + Boolean editable; + Boolean literal; + + int mask_number; + int columns; + int rows; + Dimension tab_margin; + Dimension row_margin; + Dimension col_margin; + Dimension internal_width; + Dimension internal_height; + Dimension label_shadow_thickness; + unsigned char encoding; + + /* Default Values */ + Pixel foreground; + XtJustify justify; + XFontStruct *font; + int width; + + /* Allowance CallbackList */ + XtCallbackList allow_add_row; + XtCallbackList allow_add_column; + XtCallbackList allow_delete_column; + XtCallbackList allow_delete_row; + XtCallbackList allow_delete_table; + + /* Information CallbackList */ + XtCallbackList add_row; + XtCallbackList add_column; + XtCallbackList changed_cell; + XtCallbackList create_table; + XtCallbackList delete_column; + XtCallbackList delete_row; + XtCallbackList delete_table; + XtCallbackList what_cell; + XtCallbackList changed_column_width; + XtCallbackList changed_row_height; + + Widget v_scroll; + Widget h_scroll; + + int row_height; + int column_default_width; + int literal_width; + + /* ------------------------ private state -----------------------*/ + + int no_refigure; /* no re-layout while > 0 */ + int no_redraw; /* no re-draw while > 0 */ + Boolean was_resized; + + + XawTableColumn column_data; + + Dimension prefer_width; + Dimension prefer_height; + Widget edit; + int edit_row; + int edit_column; + XawTableCell cell_own; + XawTableCell table_stuff; + + GC row_gc; /* Intrinsics sharedable GC */ + GC column_gc; /* Intrinsics sharedable GC */ + + GC normal; /* Table sharedable GC */ + GC reverse; /* Table sharedable GC */ + GC top; + GC bottom; + + GC edit_top; + GC edit_bottom; + + NormalReverseGC *normal_hash_table; + ShadowGC *shadow_hash_table; + int mask_hash_table; + + Atom selections[30]; + int num_selections; +} TablePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TableRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + TablePart table; +} TableRec; + +extern TableClassRec tableClassRec; + +#endif /* _XawTableP_h */ diff --git a/vendor/x11iraf/obm/ObmW/TableUtil.c b/vendor/x11iraf/obm/ObmW/TableUtil.c new file mode 100644 index 00000000..27fa3129 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/TableUtil.c @@ -0,0 +1,919 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#include <X11/Xraw/TableUtil.h> +#include <X11/Xraw/xraw_table.h> + +#ifdef EBUG_XRAW_MALLOC +#include <dbmalloc/malloc.h> +#endif + +/************************************************************************ + * + * TABLE IS A GRID OF POINTER BINDED NODES + * + ************************************************************************/ + +#define null (XawTableNode)NULL +#define FREE(t) if((t) != null)XtFree((char*)(t)) + +static void vert_tab_node_insert(f,s,p) + register XawTableNode f; /* insert after */ + register XawTableNode s; /* insert before */ + register XawTableNode p; /* to be inserted */ +{ + if (f != null) f->b = p; + if (s != null) s->t = p; + if (p != null) {p->t = f; p->b = s;} +} + +static void horiz_tab_node_insert(f,s,p) + register XawTableNode f; /* insert after */ + register XawTableNode s; /* insert before */ + register XawTableNode p; /* to be inserted */ +{ + if (f != null) f->r = p; + if (s != null) s->l = p; + if (p != null) {p->l = f; p->r = s;} +} + +static void vert_tab_node_reject(p) + register XawTableNode p; +{ + if (p == null) return; + + if (p->t != null) p->t->b = p->b; + if (p->b != null) p->b->t = p->t; +} + +static void horiz_tab_node_reject(p) + register XawTableNode p; +{ + if (p == null) return; + + if (p->r != null) p->r->l = p->l; + if (p->l != null) p->l->r = p->r; +} + +/* ARGSUSED */ +static XawTableProc del_cell (w, i, j, call_data, client_data) + XtPointer w; + int i; + int j; + XtPointer call_data; + XtPointer client_data; +{ + XtFree((char*)call_data); + return False; +} + +/* +** Function name : row_delete +** +** Description : delete row which the node belongs to +** Input : pointer to the node +** Output : void +*/ + +void +#if NeedFunctionPrototypes +row_delete (XtPointer f) +#else +row_delete(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return; + + /* Go to left edge */ + for(; p->l != null; p=p->l ) + /*EMPTY*/; + + /* Go to right with dettaching cell */ + for(; p->r != null; p=p->r){ + vert_tab_node_reject(p->l); + FREE(p->l); + } + + /* Detach last but one cell in the row */ + if (p->l != null){ + vert_tab_node_reject(p->l); + FREE(p->l); + } + + /* Detach very last cell in the row */ + vert_tab_node_reject(p); + FREE(p); +} + +/* +** Function name : column_delete +** +** Description : delete column which the node belongs to +** Input : pointer to the node +** Output : void +*/ + +void +#if NeedFunctionPrototypes +column_delete (XtPointer f) +#else +column_delete(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return; + + /* Go up to the edge */ + for(; p->t != null; p=p->t ) + /*EMPTY*/; + + /* Go down with dettaching cell */ + for(; p->b != null; p=p->b){ + horiz_tab_node_reject(p->t); + FREE(p->t); + } + + /* Detach bottom but one cell in the column */ + if (p->t != null){ + horiz_tab_node_reject(p->t); + FREE(p->t); + } + + /* Detach very bottom cell in the column */ + horiz_tab_node_reject(p); + FREE(p); +} + + + +/* +** Function name : row_insert_after +** +** Description : insert row down to the row which the node belongs to +** Input : poiter to the node, size of node +** Output : True if successful +*/ + +Boolean +#if NeedFunctionPrototypes +row_insert_after (XtPointer d, int node_size) +#else +row_insert_after(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode) d; + register XawTableNode p; + XawTableNode left; + + if (f == null) + return False; + + /* go left till row edge */ + for(; f->l != null; f=f->l ) + /*EMPTY*/; + + /* save very left node */ + left = f; + + /* go right and attach new cells via vertical ponters */ + for(; f->r != null; f=f->r){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->b); + FREE(left->b); + } + return False; + } + vert_tab_node_insert(f, f->b, p); + } + + /* attach vertically very right cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->b); + FREE(left->b); + } + return False; + } + vert_tab_node_insert(f, f->b, p); + + /* if only one column */ + if ( f->l == null ) { + f->b->l = f->b->r = null; + return True; + } + + /* attach horizontally very right cell */ + horiz_tab_node_insert(f->l->b,null,f->b); + + /* bind via horizontal ponters */ + for(f=f->l; f->l != null; f=f->l ) + horiz_tab_node_insert(f->l->b,f->r->b,f->b); + + /* attach horizontally very left cell */ + horiz_tab_node_insert(null,f->r->b,f->b); + + return True; +} + +/* +** Function name : row_insert_before +** +** Description : the same as previous, but only on top from row +** Input : pointer to the node, size of node +** Output : True if successful +*/ + +Boolean +#if NeedFunctionPrototypes +row_insert_before (XtPointer d, int node_size) +#else +row_insert_before(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode) d; + register XawTableNode p; + XawTableNode left; + + if (f == null) + return False; + + /* go left till row edge */ + for(; f->l != null; f=f->l ) + /*EMPTY*/; + + /* save very left node */ + left = f; + + /* go right and attach new cells via vertical ponters */ + for(; f->r != null; f=f->r){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->t); + FREE(left->t); + } + return False; + } + vert_tab_node_insert(f->t, f, p); + } + + /* attach vertically very right cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->t); + FREE(left->t); + } + return False; + } + vert_tab_node_insert(f->t, f, p); + + /* if only one column */ + if ( f->l == null ) { + f->t->l = f->t->r = null; + return True; + } + + /* attach horizontally very right cell */ + horiz_tab_node_insert(f->l->t,null,f->t); + + /* bind via horizontal ponters */ + for(f=f->l; f->l != null; f=f->l ) + horiz_tab_node_insert(f->l->t,f->r->t,f->t); + + /* attach horizontally very left cell */ + horiz_tab_node_insert(null,f->r->t,f->t); + + return True; +} + +/* +** Function name : column_insert_after +** +** Description : insert column right to the column which the node belongs to +** Input : pointer to the node, size of node +** Output : True if successful +[<*/ + +Boolean +#if NeedFunctionPrototypes +column_insert_after (XtPointer d, int node_size) +#else +column_insert_after(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode) d; + register XawTableNode p; + XawTableNode top; + + if (f == null) + return False; + + /* go top till column edge */ + for(; f->t != null; f=f->t ) + /*EMPTY*/; + + /* save very top node */ + top = f; + + /* go down and attach new cells via horizontal ponters */ + for(; f->b != null; f=f->b){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->r); + FREE(top->r); + } + return False; + } + horiz_tab_node_insert(f, f->r, p); + } + + /* attach horizontally very down cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->r); + FREE(top->r); + } + return False; + } + + horiz_tab_node_insert(f, f->r, p); + + /* if only one row */ + if ( f->t == null ) { + f->r->t = f->r->b = null; + return True; + } + + /* attach vertically very down cell */ + vert_tab_node_insert(f->t->r,null,f->r); + + /* bind via vertical ponters */ + for(f=f->t; f->t != null; f=f->t ) + vert_tab_node_insert(f->t->r,f->b->r,f->r); + + /* attach vertically very top cell */ + vert_tab_node_insert(null,f->b->r,f->r); + + return True; +} + +/* +** Function name : column_insert_before +** +** Description : the same as previous, but only to left from column +** Input : pointer to node, size of node +** Output : True if successful +*/ + +Boolean +#if NeedFunctionPrototypes +column_insert_before (XtPointer d, int node_size) +#else +column_insert_before(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode)d; + register XawTableNode p; + XawTableNode top; + + if (f == null) + return False; + + /* go top till column top */ + for(; f->t != null; f=f->t ) + /*EMPTY*/; + + /* save very top node */ + top = f; + + /* go down and attach new cells via horizontal ponters */ + for(; f->b != null; f=f->b){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->l); + FREE(top->l); + } + return False; + } + horiz_tab_node_insert(f->l, f, p); + } + + /* attach horizontally very down cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->l); + FREE(top->l); + } + return False; + } + horiz_tab_node_insert(f->l, f, p); + + /* if only one row */ + if ( f->t == null ) { + f->l->t = f->l->b = null; + return True; + } + + /* attach vertically very down cell */ + vert_tab_node_insert(f->t->l, null, f->l); + + /* bind via vertical ponters */ + for(f=f->t; f->t != null; f=f->t ) + vert_tab_node_insert(f->t->l, f->b->l, f->l); + + /* attach vertically very top cell */ + vert_tab_node_insert(null, f->b->l, f->l); + + return True; +} + +/* +** Function name : get_table +** +** Description : spot the node (0,0) in the table +** Input : pointer to any node in table +** Output : pointer to the node (0,0) +*/ + +XtPointer +#if NeedFunctionPrototypes +get_table (XtPointer f) +#else +get_table(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return (XtPointer)NULL; + + for(; p->t != null; p=p->t) + /*EMPTY*/; + + for(; p->l != null; p=p->l) + /*EMPTY*/; + + return (XtPointer)p; +} + +/* +** Function name : get_cell +** +** Description : spot the node (i,j) regarding to given node +** Input : pointer to the node, column, row (may be negative) +** Output : pointer to the node or NULL +*/ + +XtPointer +#if NeedFunctionPrototypes +get_cell (XtPointer f, register int i, register int j) +#else +get_cell (f, i, j) + XtPointer f; + register int i; + register int j; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return (XtPointer)NULL; + + if (i > 0) { + for(; i>0; i--) + if (p != null) p = p->b; + else return (XtPointer)NULL; + } else { + for(; i<0; i++) + if (p != null) p = p->t; + else return (XtPointer)NULL; + } + + if (j > 0) { + for(; j>0; j--) + if (p != null) p = p->r; + else return (XtPointer)NULL; + } else { + for(; j<0; j++) + if (p != null) p = p->l; + else return (XtPointer)NULL; + } + + return (XtPointer)p; +} + +#if 0 +static Boolean go_row(w, proc, p, begin_column, end_column, i, j, client_data) + XtPointer w; + XawTableProc proc; + XawTableNode p; /* p == get_cell(table, ... , begin_column) */ + int begin_column; + int end_column; + int *i; /* returned */ + int *j; /* returned */ + XtPointer client_data; +{ + for ((*j) = begin_column; ((*j) <= end_column) && (p != null); (*j)++) + { + XawTableProc sp = p; + p = p->r; + + if (proc(w, *i, *j, (XtPointer)sp, client_data)) + return True; + } + + return False; +} +#endif + +/* +** Function name : go_table +** +** Description : invoke given rutine for every node in given region +** Input : rutine, begin/end rows, begin/end columns... +** Output : True if given rutine returned True for a node, +** numbers of row and column for that node + */ + +Boolean +#if NeedFunctionPrototypes +go_table ( + XtPointer w, + XawTableProc proc, + XtPointer table, + int begin_row, + int end_row, + int begin_column, + int end_column, + int direction, + register int *i, /* returned */ + register int *j, /* returned */ + XtPointer client_data) +#else +go_table(w, proc, table, begin_row, end_row, begin_column, end_column, + direction, i, j, client_data) + XtPointer w; + XawTableProc proc; + XtPointer table; + int begin_row; + int end_row; + int begin_column; + int end_column; + int direction; + register int *i; /* returned */ + register int *j; /* returned */ + XtPointer client_data; +#endif +{ + register XawTableNode p; + register XawTableNode n; + + table = get_table(table); + + switch (direction) { + case XawTABLE_DOWN_RIGHT : + p = (XawTableNode)get_cell(table, begin_row, begin_column); + + for (*j = begin_column; *j <= end_column && p != null; (*j)++) + { + register XawTableNode sp = p; /* protect against deallocated node !! */ + p = p->r; + + for (*i = begin_row, n = sp; *i <= end_row && n != null; (*i)++) + { + register XawTableNode sn = n; /* protect against deallocated node !! */ + n = n->b; + + if (proc(w, *i, *j, (XtPointer)sn, client_data)) + return True; + } + } + break; + case XawTABLE_RIGHT_DOWN : + default : + p = (XawTableNode)get_cell(table, begin_row, begin_column); + + for (*i = begin_row; *i <= end_row && p != null; (*i)++) + { + register XawTableNode sp = p; /* protect against deallocated node !! */ + p = p->b; + + for (*j = begin_column, n = sp; *j <= end_column && n != null; (*j)++) + { + register XawTableNode sn = n; /* protect against deallocated node !! */ + n = n->r; + + if (proc(w, *i, *j, (XtPointer)sn, client_data)) + return True; + } + } + break; + } + return False; +} + +/* +** Function name : get_table_size +** +** Description : define dimention on the table +** Input : pointer to any node in the table +** Output : void +*/ + +void +#if NeedFunctionPrototypes +get_table_size (XtPointer f, + register int *i, /* returned */ + register int *j) /* returned */ +#else +get_table_size(f,i,j) + XtPointer f; + register int *i; /* returned */ + register int *j; /* returned */ +#endif +{ + register XawTableNode p = (XawTableNode)f; + if (p == null){ + *i = 0; + *j = 0; + } + + p = (XawTableNode)get_table(f); + + for (*i = 1; p->b != null; p = p->b, (*i)++) + /*EMPTY*/; + + for (*j = 1; p->r != null; p = p->r, (*j)++) + /*EMPTY*/; +} + +/* +** Function name : delete_table +** +** Description : destroy table +** Input : pointer to any node in the table +** Output : void +*/ + +void +#if NeedFunctionPrototypes +delete_table (XtPointer f) +#else +delete_table(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode)f; + int i,j; + int end_row, end_column; + + if (p == null) + return; + + p = (XawTableNode)get_table(f); + get_table_size((XtPointer)p, (int*)&end_row, (int*)&end_column); + (void)go_table(NULL, (XawTableProc)del_cell, (XtPointer)p, + 0, (int)(end_row-1), 0, (int)(end_column-1), + XawTABLE_RIGHT_DOWN, + (int*)&i, (int*)&j, NULL); +} + +/* +** Function name : get_cell_positions +** +** Description : define number of row & column for node +** Input : pointer to the node +** Output : void +*/ + +void +#if NeedFunctionPrototypes +get_cell_positions (XtPointer f, + register int *i, /* returned */ + register int *j) /* returned */ +#else +get_cell_positions(f, i, j) + XtPointer f; + register int *i; /* returned */ + register int *j; /* returned */ +#endif +{ + register XawTableNode p = (XawTableNode)f; + if ( p == null ) + return; + + if ( i != (int*)NULL ) { + for (*i = 0; p->t != null; p = p->t, (*i)++) + /*EMPTY*/; + } + + if ( j != (int*)NULL ) { + for (*j = 0; p->l != null; p = p->l, (*j)++) + /*EMPTY*/; + } +} + +/* +** Function name : create_table +** +** Description : create the table +** Input : row & column dimestions, size of node +** Output : pointer to the node (0,0) +*/ + +XtPointer +#if NeedFunctionPrototypes +create_table ( int rows, int columns, int node_size) +#else +create_table(rows, columns, node_size) + int rows; + int columns; + int node_size; +#endif +{ + register XawTableNode *area; + register XawTableNode p; + register int i,j; + XawTableNode table; + + if (rows == 0 || columns == 0) + return (XtPointer)NULL; + else{ + register XawTableNode *s; + + /* allocate temporary two-dimension array to make first node's binding */ + if ( (s = area = (XawTableNode*) + XtCalloc ((unsigned)(rows * columns), sizeof(XawTableNode))) == NULL) + return (XtPointer)NULL; + + /* allocate nodes */ + for (i = 0, j = rows*columns; i < j; i++) + if((*s++ = (XawTableNode) XtMalloc (node_size)) == NULL){ + int h; + for (h = 0, s = area; h < i; h++) + XtFree((char*)*s++); + + XtFree((char*)area); + return (XtPointer)NULL; + } + } + +#define a(i,j) (XawTableNode)*(area + (i)*columns + (j)) + + /* initialize the boundary nodes */ + for (i = 0; i < rows; i++) { + p = a(i,0); p->l = null; + p = a(i,columns-1); p->r = null; + } + for (j = 0; j < columns; j++) { + p = a(0,j); p->t = null; + p = a(rows-1,j); p->b = null; + } + +#undef a +#define a(i,j) (( (i)>=0 && (i)<rows ) && ( (j)>=0 && (j)<columns ) ? \ + (XawTableNode)*(area + (i)*columns + (j)) : null) + + /* make internode's binding */ + for (i = 0; i < rows; i++) { + for (j = i % 2; j < columns; j += 2) { + horiz_tab_node_insert(a(i,j-1), a(i,j+1), a(i,j)); + vert_tab_node_insert (a(i-1,j), a(i+1,j), a(i,j)); + } + } + +#undef a + + table = *area; + XtFree((char*)area); + return (XtPointer)table; +} + + +#ifdef EBUG_XRAW_MALLOC +/* ARGSUSED */ +static Boolean check_cell (w, row, column, call_data, client_data) + XtPointer w; /* unused */ + int row; + int column; + XtPointer call_data; + XtPointer client_data; +{ + register XawTableNode p = (XawTableNode)call_data; + int real_row, real_column; + char *halt = NULL;; + + get_cell_positions(p, &real_row, &real_column); + + if (real_row != row){ + XtWarning("check_table: wrong initial table row size"); + *halt = '\0'; + } + + if (real_column != column){ + XtWarning("check_table: wrong initial table column size"); + *halt = '\0'; + } + + if (p->l != null) + if (p->l->r != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + if (p->r != null) + if (p->r->l != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + if (p->t != null) + if (p->t->b != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + if (p->b != null) + if (p->b->t != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + + return False; +} + + + +void +#if NeedFunctionPrototypes +_check_table (XtPointer f, int rows, int columns) +#else +_check_table (f, rows, columns) + XtPointer f; + int rows; + int columns; +#endif +{ + register XawTableNode table = (XawTableNode)f; + int real_rows, real_columns; + register int i,j; + char *halt = NULL; + + if (f == NULL && (rows == 0 || columns == 0)) + return; + + if (table != get_table(f)){ + XtWarning("check_table: wrong initial table cell"); + *halt = '\0'; + } + + get_table_size (f, &real_rows, &real_columns); + + if (real_rows != rows){ + XtWarning("check_table: wrong initial table row size"); + *halt = '\0'; + } + + if (real_columns != columns){ + XtWarning("check_table: wrong initial table column size"); + *halt = '\0'; + } + + + (void) go_table (NULL, check_cell, table, + 0, rows-1, 0, columns-1, + XawTABLE_RIGHT_DOWN, + &real_rows, &real_columns, (XtPointer)NULL); + +} +#endif /* EBUG_XRAW_MALLOC */ + +#undef null +#undef FREE + diff --git a/vendor/x11iraf/obm/ObmW/TableUtil.h b/vendor/x11iraf/obm/ObmW/TableUtil.h new file mode 100644 index 00000000..a8262f75 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/TableUtil.h @@ -0,0 +1,94 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _table_h_ +#define _table_h_ + +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <X11/Xraw/Table.h> + +#if __STDC__ || defined(__cplusplus) +#define F_PROTO(s) s +#else +#define F_PROTO(s) () +#endif + +typedef struct _XawTableNodeRec { /* Node of table grid */ + struct _XawTableNodeRec *l; + struct _XawTableNodeRec *r; + struct _XawTableNodeRec *t; + struct _XawTableNodeRec *b; +}XawTableNodeRec, *XawTableNode; + + +extern XtPointer create_table F_PROTO((int rows, + int columns, + int node_size)); + +extern Boolean row_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean row_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern Boolean column_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean column_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern XtPointer get_table F_PROTO((XtPointer f)); + +extern XtPointer get_cell F_PROTO((XtPointer p, + int i, + int j)); + +extern void get_table_size F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void get_cell_positions F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void row_delete F_PROTO((XtPointer p)); + +extern void column_delete F_PROTO((XtPointer p)); + +extern void delete_table F_PROTO((XtPointer p)); + +extern Boolean go_table F_PROTO((XtPointer w, + XawTableProc proc, + XtPointer table, + int begin_row, + int end_row, + int begin_column, + int end_column, + int direction, + register int *row, + register int *column, + XtPointer client_data)); + +#ifdef EBUG_XRAW_MALLOC +extern void _check_table F_PROTO((XtPointer table, + int rows, + int columns)); +#endif + +#undef F_PROTO + +#endif /* _table_h_ */ diff --git a/vendor/x11iraf/obm/ObmW/Tablist2Tabs.c b/vendor/x11iraf/obm/ObmW/Tablist2Tabs.c new file mode 100644 index 00000000..800500fc --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Tablist2Tabs.c @@ -0,0 +1,35 @@ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include "TabString.h" + +/* + * Converts a string list of tabs to an array of tabs + */ +int * +XfwfTablist2Tabs(tablist) +char *tablist; +{ + register int *tabs; + register int ntabs = 0; + + if (!tablist) + return NULL; + for (;;) + { + /* Skip leading blanks */ + while (*tablist && *tablist == ' ') ++tablist; + if (!*tablist) break; + + /* Allocate space for the new tab */ + if (ntabs) + tabs = (int *) XtRealloc( (char *) tabs, + (ntabs+1) * sizeof(int)); + else + tabs = (int *) XtMalloc( (ntabs + 1) * sizeof(int)); + /* Add it to the list */ + tabs[ntabs++] = atoi(tablist); + /* Skip to the next blank */ + while (*tablist && *tablist != ' ') ++tablist; + } + return (tabs); +} diff --git a/vendor/x11iraf/obm/ObmW/Tabs.c b/vendor/x11iraf/obm/ObmW/Tabs.c new file mode 100644 index 00000000..767bd754 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Tabs.c @@ -0,0 +1,2183 @@ +static char rcsid[] = "$Id: Tabs.c,v 1.27 1999/12/16 18:44:18 falk Exp $" ; + +/* + * Tabs.c - Index Tabs composite widget + * + * Author: Edward A. Falk + * falk@falconer.vip.best.com + * + * Date: July 29, 1997 + * + * + * Overall layout of this widget is as follows: + * + * ________ ,---------. _________ + * | label || Label || Label | \ tabs + * |________|| ||_________| / + * |+----------------------------+| \ + * || || | + * || child widget window || > frame + * |+----------------------------+| | + * +------------------------------+ / + * + * The height of the tabs includes the shadow width, top and bottom + * margins, and the height of the text. + * + * The height of the frame includes the top and bottom shadow width and the + * size of the child widget window. + * + * The tabs overlap the frame and each other vertically by the shadow + * width, so that when the topmost tab is drawn, it obliterates part of + * the frame. + * + * + * $Log: Tabs.c,v $ + * Revision 1.27 1999/12/16 18:44:18 falk + * Added keyboard traversal + * + * Revision 1.26 1999/12/16 18:01:37 falk + * No longer caches child preferred sizes. Now recomputes GC's + * after font change. Fixes some layout bugs. Adds safety feature + * to make sure that layout() doesn't loop forever. + * + * Revision 1.25 1999/12/07 19:11:45 falk + * Fixed uninitialized variables in resize. Minor cleanups to make + * compiler happy. + * + * Revision 1.24 1999/12/02 08:39:04 falk + * deleted dead variables + * + * Revision 1.23 1999/10/01 20:35:16 falk + * Added Motif compatibility + * + * Revision 1.22 1999/09/22 19:53:23 falk + * added more keyboard traversal. + * + * Revision 1.21 1999/09/08 17:47:02 falk + * Now draws text with Y offset when tab is top + * Now requires Ansi C + * + * Revision 1.20 1999/09/07 16:12:01 falk + * added keyboard accelerators + * + * Revision 1.19 1999/08/05 03:17:34 falk + * minor changes to make gcc -Wall happy. + * + * Revision 1.18 1999/07/30 23:01:05 falk + * makes sure top tab is managed + * + * Revision 1.17 1999/07/30 16:17:21 falk + * Optimized size calculations by caching results. + * Now ignores unmanaged children. + * Now handles deletion of top widget properly. + * + * Revision 1.16 1999/06/28 23:03:20 falk + * major updates to geometry management. + * + * Revision 1.15 1999/06/23 18:17:14 falk + * added XtNpopdownCallback resource + * + * Revision 1.14 1998/10/23 17:41:48 falk + * now uses XmuCreateStippledPixmap() + * + * Revision 1.13 1998/10/12 16:49:52 falk + * GC functions seperated out into new file + * + * Revision 1.12 1998/08/07 01:08:37 falk + * got rid of dead code + * + * Revision 1.11 1998/07/28 16:39:09 falk + * now uses XtClass(w) instead of w->core.widget_class + * + * Revision 1.10 1998/06/26 16:27:42 falk + * allocShadowColor now handles failure from XAllocColor + * + * Revision 1.9 1998/06/25 08:09:03 falk + * simplified: got rid of WidgetCmap() and WidgetDepth() + * + * Revision 1.8 1998/06/18 03:12:42 falk + * Added local definition of XtAllocateGC() for X11r4 compatibility + * + * Revision 1.7 1998/06/17 23:49:24 falk + * small changes to make lint happier + * + * Revision 1.6 1998/06/17 23:39:40 falk + * STDC declarations added, prototypes updated accordingly. + * + * Revision 1.5 1998/06/17 23:05:14 falk + * removed last reference to Xaw + * + * Revision 1.4 1998/06/16 16:22:03 falk + * Simplified 3-d look. Removed references to Xaw3d. Added bitmaps + * + * Revision 1.3 1998/06/11 17:12:57 falk + * major style change; too many diffs to list. + * + * Revision 1.2 1998/02/14 07:24:45 falk + * wider tab decorations, re-wrote geometry manager. + * + * Revision 1.1 1997/08/28 05:36:23 falk + * Initial revision + * + */ + +/* + * TODO: min child height = tab height + */ + +#include <stdio.h> + +#include <X11/Xlib.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Drawing.h> +#include <X11/Xmu/Misc.h> + +#include "TabsP.h" +#include "Gcs.h" + +#ifndef XtExposeNoRegion +#define XtExposeNoRegion 0x80 +#endif + +#define MIN_WID 10 +#define MIN_HGT 10 +#define INDENT 3 /* tabs indented from edge by this much */ +#define SPACING 0 /* distance between tabs */ +#define SHADWID 1 /* default shadow width */ +#define TABDELTA 2 /* top tab grows this many pixels */ +#define TABLDELTA 2 /* top tab label offset this many pixels */ + + +/**************************************************************** + * + * IndexTabs Resources + * + ****************************************************************/ + +#ifdef SUNOS +static char defaultTranslations[] = "\ + <BtnUp>: select() \n\ + <FocusIn>: highlight() \n\ + <FocusOut>: unhighlight() \n\ + <Key> : page(select) \n\ + " ; +#else +static char defaultTranslations[] = "\ + <BtnUp>: select() \n\ + <FocusIn>: highlight() \n\ + <FocusOut>: unhighlight() \n\ + <Key>Page_Up: page(up) \n\ + <Key>KP_Page_Up: page(up) \n\ + <Key>Prior: page(up) \n\ + <Key>KP_Prior: page(up) \n\ + <Key>Page_Down: page(down) \n\ + <Key>KP_Page_Down: page(down) \n\ + <Key>Next: page(down) \n\ + <Key>KP_Next: page(down) \n\ + <Key>Home: page(home) \n\ + <Key>KP_Home: page(home) \n\ + <Key>End: page(end) \n\ + <Key>KP_End: page(end) \n\ + <Key>Up: highlight(up) \n\ + <Key>KP_Up: highlight(up) \n\ + <Key>Down: highlight(down) \n\ + <Key>KP_Down: highlight(down) \n\ + <Key> : page(select) \n\ + " ; +#endif + +#ifdef SUNOS +static char accelTable[] = " #augment\n\ + <Key> : page(select) \n\ + " ; +#else +static char accelTable[] = " #augment\n\ + <Key>Page_Up: page(up) \n\ + <Key>KP_Page_Up: page(up) \n\ + <Key>Prior: page(up) \n\ + <Key>KP_Prior: page(up) \n\ + <Key>Page_Down: page(down) \n\ + <Key>KP_Page_Down: page(down) \n\ + <Key>Next: page(down) \n\ + <Key>KP_Next: page(down) \n\ + <Key>Home: page(home) \n\ + <Key>KP_Home: page(home) \n\ + <Key>End: page(end) \n\ + <Key>KP_End: page(end) \n\ + <Key>Up: highlight(up) \n\ + <Key>KP_Up: highlight(up) \n\ + <Key>Down: highlight(down) \n\ + <Key>KP_Down: highlight(down) \n\ + <Key> : page(select) \n\ + " ; +#endif +static XtAccelerators defaultAccelerators ; + +#define offset(field) XtOffsetOf(TabsRec, tabs.field) +static XtResource resources[] = { + + {XtNselectInsensitive, XtCSelectInsensitive, XtRBoolean, sizeof(Boolean), + offset(selectInsensitive), XtRImmediate, (XtPointer) True}, + {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + offset(font), XtRString, (XtPointer) XtDefaultFont}, + {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), + offset(internalWidth), XtRImmediate, (XtPointer)4 }, + {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), + offset(internalHeight), XtRImmediate, (XtPointer)4 }, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), + XtRImmediate, (XtPointer)0}, + {XtNtopWidget, XtCTopWidget, XtRWidget, sizeof(Widget), + offset(topWidget), XtRImmediate, NULL}, + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(callbacks), XtRCallback, NULL}, + {XtNpopdownCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(popdownCallbacks), XtRCallback, NULL}, + {XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean), + offset(be_nice_to_cmap), XtRImmediate, (XtPointer) True}, + {XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int), + offset(top_shadow_contrast), XtRImmediate, (XtPointer) 20}, + {XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int), + offset(bot_shadow_contrast), XtRImmediate, (XtPointer) 40}, + {XtNinsensitiveContrast, XtCInsensitiveContrast, XtRInt, sizeof(int), + offset(insensitive_contrast), XtRImmediate, (XtPointer) 33}, + {XtNaccelerators, XtCAccelerators, XtRAcceleratorTable,sizeof(XtTranslations), + XtOffsetOf(TabsRec,core.accelerators), XtRString, accelTable}, +}; +#undef offset + + + + /* constraint resources */ + +#define offset(field) XtOffsetOf(TabsConstraintsRec, tabs.field) +static XtResource tabsConstraintResources[] = { + {XtNtabLabel, XtCLabel, XtRString, sizeof(String), + offset(label), XtRString, NULL}, + {XtNtabLeftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap), + offset(left_bitmap), XtRImmediate, None}, + {XtNtabForeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRString, (XtPointer) XtDefaultForeground}, + {XtNresizable, XtCResizable, XtRBoolean, sizeof(Boolean), + offset(resizable), XtRImmediate, (XtPointer) True}, +} ; +#undef offset + + + + +#if !NeedFunctionPrototypes + + /* FORWARD REFERENCES: */ + + /* member functions */ + +static void TabsClassInit(); +static void TabsInit(); +static void TabsResize(); +static void TabsExpose(); +static void TabsDestroy(); +static void TabsRealize(); +static Boolean TabsSetValues(); +static Boolean TabsAcceptFocus(); +static XtGeometryResult TabsQueryGeometry(); +static XtGeometryResult TabsGeometryManager(); +static void TabsChangeManaged(); +static void TabsConstraintInitialize() ; +static Boolean TabsConstraintSetValues() ; + + /* action procs */ + +static void TabsSelect() ; +static void TabsPage() ; +static void TabsHighlight() ; +static void TabsUnhighlight() ; + + /* internal privates */ + +static void TabsAllocGCs() ; /* get rendering GCs */ +static void TabsFreeGCs() ; /* return rendering GCs */ +static void DrawTabs() ; /* draw all tabs */ +static void DrawTab() ; /* draw one index tab */ +static void DrawFrame() ; /* draw frame around contents */ +static void DrawTrim() ; /* draw trim around a tab */ +static void DrawBorder() ; /* draw border */ +static void DrawHighlight() ; /* draw highlight */ +static void UndrawTab() ; /* undraw interior of a tab */ +static void TabWidth() ; /* recompute tab size */ +static void GetPreferredSizes() ; /* query all children for their sizes */ +static void MaxChild() ; /* find max preferred child size */ +static int PreferredSize() ; /* compute preferred size */ +static int PreferredSize2() ; /* compute preferred size */ +static int PreferredSize3() ; /* compute preferred size */ +static void MakeSizeRequest() ; /* try to change size */ +static void getBitmapInfo() ; +static int TabLayout() ; /* lay out tabs */ +static void TabsShuffleRows() ; /* bring current tab to bottom row */ + +static void TabsAllocFgGC() ; +static void TabsAllocGreyGC() ; + +#else + +static void TabsClassInit(void) ; +static void TabsInit( Widget req, Widget new, ArgList, Cardinal *nargs) ; +static void TabsConstraintInitialize(Widget, Widget, ArgList, Cardinal *) ; +static void TabsRealize(Widget, Mask *, XSetWindowAttributes *) ; +static void TabsDestroy( Widget w) ; +static void TabsResize( Widget w) ; +static void TabsExpose( Widget w, XEvent *event, Region region) ; +static Boolean TabsSetValues(Widget, Widget, Widget, ArgList, Cardinal *) ; +static Boolean TabsAcceptFocus(Widget, Time *); +static Boolean TabsConstraintSetValues(Widget, Widget, Widget, + ArgList, Cardinal *) ; +static XtGeometryResult TabsQueryGeometry(Widget, + XtWidgetGeometry *, XtWidgetGeometry *) ; +static XtGeometryResult TabsGeometryManager(Widget, + XtWidgetGeometry *, XtWidgetGeometry *) ; +static void TabsChangeManaged( Widget w) ; + +static void TabsSelect(Widget, XEvent *, String *, Cardinal *) ; +static void TabsPage(Widget, XEvent *, String *, Cardinal *) ; +static void TabsHighlight(Widget, XEvent *, String *, Cardinal *) ; +static void TabsUnhighlight(Widget, XEvent *, String *, Cardinal *) ; + +static void DrawTabs( TabsWidget tw, Bool labels) ; +static void DrawTab( TabsWidget tw, Widget child, Bool labels) ; +static void DrawFrame( TabsWidget tw) ; +static void DrawTrim( TabsWidget, int x, int y, + int wid, int hgt, Bool bottom, Bool undraw) ; +static void DrawBorder( TabsWidget tw, Widget child, Bool undraw) ; +static void DrawHighlight( TabsWidget tw, Widget child, Bool undraw) ; +static void UndrawTab( TabsWidget tw, Widget child) ; + +static void TabWidth( Widget w) ; +static int TabLayout( TabsWidget, int wid, Dimension *r_hgt, + Bool query_only) ; +static void GetPreferredSizes(TabsWidget) ; +static void MaxChild(TabsWidget, Widget except, Dimension, Dimension) ; +static void TabsShuffleRows( TabsWidget tw) ; +static int PreferredSize( TabsWidget, + Dimension *reply_width, Dimension *reply_height, + Dimension *reply_cw, Dimension *reply_ch) ; +static int PreferredSize2( TabsWidget, int cw, int ch, + Dimension *rw, Dimension *rh) ; +static int PreferredSize3( TabsWidget, int wid, int hgt, + Dimension *rw, Dimension *rh) ; +static void MakeSizeRequest(TabsWidget) ; + +static void TabsAllocGCs(TabsWidget) ; +static void TabsFreeGCs(TabsWidget) ; +static void getBitmapInfo( TabsWidget tw, TabsConstraints tab) ; +static void TabsAllocFgGC( TabsWidget tw) ; +static void TabsAllocGreyGC( TabsWidget tw) ; + +#endif + +#define AddRect(i,xx,yy,w,h) \ + do{rects[(i)].x=(xx); rects[i].y=(yy); \ + rects[i].width=(w); rects[i].height=(h);}while(0) + +static XtActionsRec actionsList[] = + { + {"select", TabsSelect}, + {"page", TabsPage}, + {"highlight", TabsHighlight}, + {"unhighlight", TabsUnhighlight}, + } ; + + +/**************************************************************** +* +* Full class record constant +* +****************************************************************/ + +#ifndef USE_MOTIF +#define SuperClass (&constraintClassRec) +#else +#define SuperClass (&xmManagerClassRec) +#endif + +TabsClassRec tabsClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "Tabs", + /* widget_size */ sizeof(TabsRec), + /* class_initialize */ TabsClassInit, + /* class_part_init */ NULL, /* TODO? */ + /* class_inited */ FALSE, + /* initialize */ TabsInit, + /* initialize_hook */ NULL, + /* realize */ TabsRealize, + /* actions */ actionsList, + /* num_actions */ XtNumber(actionsList), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ XtExposeCompressMaximal|XtExposeNoRegion, + /* compress_enterleave*/ TRUE, + /* visible_interest */ TRUE, + /* destroy */ TabsDestroy, + /* resize */ TabsResize, + /* expose */ TabsExpose, + /* set_values */ TabsSetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ TabsAcceptFocus, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ TabsQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { +/* composite_class fields */ + /* geometry_manager */ TabsGeometryManager, + /* change_managed */ TabsChangeManaged, + /* insert_child */ XtInheritInsertChild, /* TODO? */ + /* delete_child */ XtInheritDeleteChild, /* TODO? */ + /* extension */ NULL + }, + { +/* constraint_class fields */ + /* subresources */ tabsConstraintResources, + /* subresource_count */ XtNumber(tabsConstraintResources), + /* constraint_size */ sizeof(TabsConstraintsRec), + /* initialize */ TabsConstraintInitialize, + /* destroy */ NULL, + /* set_values */ TabsConstraintSetValues, + /* extension */ NULL, + }, +#ifdef USE_MOTIF +/* Manager Class fields */ + { + /* translations */ NULL, + /* syn_resources */ NULL, + /* num_syn_resources */ 0, + /* syn_constraint_resources */ NULL, + /* num_syn_constraint_resources */ 0, + /* parent_process */ XmInheritParentProcess, + /* extension */ NULL + }, +#endif + { +/* Tabs class fields */ + /* extension */ NULL, + } +}; + +WidgetClass tabsWidgetClass = (WidgetClass)&tabsClassRec; + + + +#ifdef DEBUG +#ifdef __STDC__ +#define assert(e) \ + if(!(e)) fprintf(stderr,"yak! %s at %s:%d\n",#e,__FILE__,__LINE__) +#else +#define assert(e) \ + if(!(e)) fprintf(stderr,"yak! e at %s:%d\n",__FILE__,__LINE__) +#endif +#else +#define assert(e) +#endif + + + + +/**************************************************************** + * + * Member Procedures + * + ****************************************************************/ + +static void +TabsClassInit(void) +{ + defaultAccelerators = XtParseAcceleratorTable(accelTable) ; + /* TODO: register converter for labels? */ +} + + + + /* Init a newly created tabs widget. Compute height of tabs + * and optionally compute size of widget. */ + +/* ARGSUSED */ + +static void +TabsInit(Widget request, Widget new, ArgList args, Cardinal *num_args) +{ + TabsWidget newTw = (TabsWidget)new; + + newTw->tabs.numRows = 0 ; + + GetPreferredSizes(newTw) ; + + /* height is easy, it's the same for all tabs: + * TODO: font height + height of tallest bitmap. + */ + newTw->tabs.tab_height = 2 * newTw->tabs.internalHeight + SHADWID ; + + if( newTw->tabs.font != NULL ) + newTw->tabs.tab_height += newTw->tabs.font->max_bounds.ascent + + newTw->tabs.font->max_bounds.descent ; + + /* GC allocation is deferred until XtRealize() */ + + /* if size not explicitly set, set it to our preferred size now. */ + + if( request->core.width == 0 || request->core.height == 0 ) + { + Dimension w,h ; + PreferredSize(newTw, &w, &h, NULL,NULL) ; + if( request->core.width == 0 ) new->core.width = w ; + if( request->core.height == 0 ) new->core.height = h ; + XtClass(new)->core_class.resize(new) ; + } + + /* defer GC allocation, etc., until Realize() time. */ + newTw->tabs.foregroundGC = + newTw->tabs.backgroundGC = + newTw->tabs.greyGC = + newTw->tabs.topGC = + newTw->tabs.botGC = None ; + + newTw->tabs.grey50 = None ; + + newTw->tabs.needs_layout = False ; + + newTw->tabs.hilight = NULL ; + +#ifdef USE_MOTIF + newTw->manager.navigation_type = XmTAB_GROUP ; + newTw->manager.traversal_on = True ; +#endif +} + + + /* Init the constraint part of a new tab child. Compute the + * size of the tab. + */ +/* ARGSUSED */ +static void +TabsConstraintInitialize(Widget request, Widget new, + ArgList args, Cardinal *num_args) +{ + TabsConstraints tab = (TabsConstraints) new->core.constraints ; + tab->tabs.greyAlloc = False ; /* defer allocation of pixel */ + + getBitmapInfo((TabsWidget)XtParent(new), tab) ; + TabWidth(new) ; +} + + + + /* Called when tabs widget first realized. Create the window + * and allocate the GCs + */ + +static void +TabsRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes) +{ + TabsWidget tw = (TabsWidget) w; + + attributes->bit_gravity = NorthWestGravity; + *valueMask |= CWBitGravity; + + SuperClass->core_class.realize(w, valueMask, attributes); + + TabsAllocGCs(tw) ; +} + + + +static void +TabsDestroy(Widget w) +{ + TabsFreeGCs((TabsWidget)w) ; +} + + + /* Parent has resized us. This will require that the tabs be + * laid out again. + */ + +static void +TabsResize(Widget w) +{ + TabsWidget tw = (TabsWidget) w; + int i ; + int num_children = tw->composite.num_children ; + Widget *childP ; + TabsConstraints tab ; + Dimension cw,ch,bw ; + + /* Our size has now been dictated by the parent. Lay out the + * tabs, lay out the frame, lay out the children. Remember + * that the tabs overlap each other and the frame by shadowWidth. + * Also, the top tab is larger than the others, so if there's only + * one row, the widget must be made taller to accomodate this. + * + * Once the tabs are laid out, if there is more than one + * row, we may need to shuffle the rows to bring the top tab + * to the bottom row. + */ + + tw->tabs.needs_layout = False ; + + if( num_children > 0 && tw->composite.children != NULL ) + { + /* Loop through the tabs and assign rows & x positions */ + (void) TabLayout(tw, tw->core.width, NULL, False) ; + + /* assign a top widget, bring it to bottom row. */ + TabsShuffleRows(tw) ; + + /* now assign child positions & sizes. Positions are all the + * same: just inside the frame. Sizes are also all the same. + */ + + tw->tabs.child_width = cw = tw->core.width - 2 * SHADWID ; + tw->tabs.child_height = ch = + tw->core.height - tw->tabs.tab_total - 2 * SHADWID ; + + + for(i=0, childP=tw->composite.children; + i < num_children; + ++i, ++childP) + if( XtIsManaged(*childP) ) + { + tab = (TabsConstraints) (*childP)->core.constraints ; + bw = (*childP)->core.border_width ; + XtConfigureWidget(*childP, SHADWID,tw->tabs.tab_total+SHADWID, + cw-bw*2,ch-bw*2, bw) ; + } + if( XtIsRealized(w) ) { + XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ; +#ifdef COMMENT + /* should not be necessary to explicitly repaint after a + * resize, but XEmacs folks tell me it is. + */ + XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ; +#endif /* COMMENT */ + } + } +} /* Resize */ + + + + /* Redraw entire Tabs widget */ + +/* ARGSUSED */ +static void +TabsExpose(Widget w, XEvent *event, Region region) +{ + TabsWidget tw = (TabsWidget) w; + + if( tw->tabs.needs_layout ) + XtClass(w)->core_class.resize(w) ; + + DrawTabs(tw, True) ; +} + + + /* Called when any Tabs widget resources are changed. */ + +/* ARGSUSED */ +static Boolean +TabsSetValues(Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args) +{ + TabsWidget curtw = (TabsWidget) current ; + TabsWidget tw = (TabsWidget) new ; + Boolean needRedraw = False ; + Widget *childP ; + int i ; + + + if( tw->tabs.font != curtw->tabs.font || + tw->tabs.internalWidth != curtw->tabs.internalWidth || + tw->tabs.internalHeight != curtw->tabs.internalHeight ) + { + tw->tabs.tab_height = 2 * tw->tabs.internalHeight + SHADWID ; + + if( tw->tabs.font != NULL ) + tw->tabs.tab_height += tw->tabs.font->max_bounds.ascent + + tw->tabs.font->max_bounds.descent ; + + /* Tab size has changed. Resize all tabs and request a new size */ + for(i=0, childP=tw->composite.children; + i < tw->composite.num_children; + ++i, ++childP) + if( XtIsManaged(*childP) ) + TabWidth(*childP) ; + PreferredSize(tw, &tw->core.width, &tw->core.height, NULL,NULL) ; + needRedraw = True ; + tw->tabs.needs_layout = True ; + } + + /* TODO: if any color changes, need to recompute GCs and redraw */ + + if( tw->core.background_pixel != curtw->core.background_pixel || + tw->core.background_pixmap != curtw->core.background_pixmap || + tw->tabs.font != curtw->tabs.font ) + if( XtIsRealized(new) ) + { + TabsFreeGCs(tw) ; + TabsAllocGCs(tw) ; + needRedraw = True ; + } + + if( tw->core.sensitive != curtw->core.sensitive ) + needRedraw = True ; + + /* If top widget changes, need to change stacking order, redraw tabs. + * Window system will handle the redraws. + */ + + if( tw->tabs.topWidget != curtw->tabs.topWidget ) + { + if( XtIsRealized(tw->tabs.topWidget) ) + { + Widget w = tw->tabs.topWidget ; + TabsConstraints tab = (TabsConstraints) w->core.constraints ; + + XRaiseWindow(XtDisplay(w), XtWindow(w)) ; +#ifdef USE_MOTIF + XtVaSetValues(curtw->tabs.topWidget, XmNtraversalOn, False, 0) ; + XtVaSetValues(w, XmNtraversalOn, True, 0) ; +#endif + + if( tab->tabs.row != tw->tabs.numRows-1 ) + TabsShuffleRows(tw) ; + + needRedraw = True ; + } + else + tw->tabs.needs_layout = True ; + } + + return needRedraw ; +} + + + /* Called when any child constraint resources change. */ + +/* ARGSUSED */ +static Boolean +TabsConstraintSetValues(Widget current, Widget request, Widget new, + ArgList args, Cardinal *num_args) +{ + TabsWidget tw = (TabsWidget) XtParent(new) ; + TabsConstraints ctab = (TabsConstraints) current->core.constraints ; + TabsConstraints tab = (TabsConstraints) new->core.constraints ; + + + /* if label changes, need to re-layout the entire widget */ + /* if foreground changes, need to redraw tab label */ + + /* TODO: only need resize of new bitmap has different dimensions + * from old bitmap. + */ + + if( tab->tabs.label != ctab->tabs.label || /* Tab size has changed. */ + tab->tabs.left_bitmap != ctab->tabs.left_bitmap ) + { + TabWidth(new) ; + tw->tabs.needs_layout = True ; + + if( tab->tabs.left_bitmap != ctab->tabs.left_bitmap ) + getBitmapInfo(tw, tab) ; + + /* If there are no subclass ConstraintSetValues procedures remaining + * to be invoked, and if the preferred size has changed, ask + * for a resize. + */ + if( XtClass((Widget)tw) == tabsWidgetClass ) + MakeSizeRequest(tw) ; + } + + + /* The child widget itself never needs a redisplay, but the parent + * Tabs widget might. + */ + + if( XtIsRealized(new) ) + { + if( tw->tabs.needs_layout ) { + XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ; + XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ; + } + + else if( tab->tabs.foreground != ctab->tabs.foreground ) + DrawTab(tw, new, True) ; + } + + return False ; +} + + +static Boolean +TabsAcceptFocus(Widget w, Time *t) +{ + if( !w->core.being_destroyed && XtIsRealized(w) && + XtIsSensitive(w) && XtIsManaged(w) && w->core.visible ) + { + Widget p ; + for(p = XtParent(w); !XtIsShell(p); p = XtParent(p)) ; + XtSetKeyboardFocus(p,w) ; + return True ; + } + else + return False ; +} + + + +/* + * Return preferred size. Happily accept anything >= our preferred size. + * (TODO: is that the right thing to do? Should we always return "almost" + * if offerred more than we need?) + */ + +static XtGeometryResult +TabsQueryGeometry(Widget w, + XtWidgetGeometry *intended, XtWidgetGeometry *preferred) +{ + register TabsWidget tw = (TabsWidget)w ; + XtGeometryMask mode = intended->request_mode ; + + preferred->request_mode = CWWidth | CWHeight ; + PreferredSize(tw, &preferred->width, &preferred->height, NULL,NULL) ; + + if( (!(mode & CWWidth) || intended->width == w->core.width) && + (!(mode & CWHeight) || intended->height == w->core.height) ) + return XtGeometryNo ; + + if( (!(mode & CWWidth) || intended->width >= preferred->width) && + (!(mode & CWHeight) || intended->height >= preferred->height) ) + return XtGeometryYes; + + return XtGeometryAlmost; +} + + + +/* + * Geometry Manager; called when a child wants to be resized. + */ + +static XtGeometryResult +TabsGeometryManager(Widget w, XtWidgetGeometry *req, XtWidgetGeometry *reply) +{ + TabsWidget tw = (TabsWidget) XtParent(w); + Dimension s = SHADWID ; + TabsConstraints tab = (TabsConstraints)w->core.constraints; + XtGeometryResult result ; + Dimension rw, rh ; + + /* Position request always denied */ + + if( ((req->request_mode & CWX) && req->x != w->core.x) || + ((req->request_mode & CWY) && req->y != w->core.y) || + !tab->tabs.resizable ) + return XtGeometryNo ; + + /* Make all three fields in the request valid */ + if( !(req->request_mode & CWWidth) ) + req->width = w->core.width; + if( !(req->request_mode & CWHeight) ) + req->height = w->core.height; + if( !(req->request_mode & CWBorderWidth) ) + req->border_width = w->core.border_width; + + if( req->width == w->core.width && + req->height == w->core.height && + req->border_width == w->core.border_width ) + return XtGeometryNo ; + + rw = req->width + 2 * req->border_width ; + rh = req->height + 2 * req->border_width ; + + /* find out how big the children want to be now */ + MaxChild(tw, w, rw, rh) ; + + + /* Size changes must see if the new size can be accomodated. + * The Tabs widget keeps all of its children the same + * size. A request to shrink will be accepted only if the + * new size is still big enough for all other children. A + * request to shrink that is not big enough for all children + * returns an "almost" response with the new proposed size + * or a "no" response if unable to shrink at all. + * + * A request to grow will be accepted only if the Tabs parent can + * grow to accomodate. + * + * TODO: + * We could get fancy here and re-arrange the tabs if it is + * necessary to compromise with the parent, but we'll save that + * for another day. + */ + + if (req->request_mode & (CWWidth | CWHeight | CWBorderWidth)) + { + Dimension cw,ch ; /* children's preferred size */ + Dimension aw,ah ; /* available size we can give child */ + Dimension th ; /* space used by tabs */ + Dimension wid,hgt ; /* Tabs widget size */ + + cw = tw->tabs.max_cw ; + ch = tw->tabs.max_ch ; + + /* find out what *my* resulting preferred size would be */ + + PreferredSize2(tw, cw, ch, &wid, &hgt) ; + + /* Would my size change? If so, ask to be resized. */ + + if( wid != tw->core.width || hgt != tw->core.height ) + { + Dimension oldWid = tw->core.width, oldHgt = tw->core.height ; + XtWidgetGeometry myrequest, myreply ; + + myrequest.width = wid ; + myrequest.height = hgt ; + myrequest.request_mode = CWWidth | CWHeight ; + + /* If child is only querying, or if we're going to have to + * offer the child a compromise, then make this a query only. + */ + + if( (req->request_mode & XtCWQueryOnly) || rw < cw || rh < ch ) + myrequest.request_mode |= XtCWQueryOnly ; + + result = XtMakeGeometryRequest((Widget)tw, &myrequest, &myreply) ; + + /* !$@# Athena Box widget changes the core size even if QueryOnly + * is set. I'm convinced this is a bug. At any rate, to work + * around the bug, we need to restore the core size after every + * query geometry request. This is only partly effective, + * as there may be other boxes further up the tree. + */ + if( myrequest.request_mode & XtCWQueryOnly ) { + tw->core.width = oldWid ; + tw->core.height = oldHgt ; + } + + /* based on the parent's response, determine what the + * resulting Tabs widget size would be. + */ + + switch( result ) { + case XtGeometryYes: + case XtGeometryDone: + tw->tabs.needs_layout = True ; + break ; + + case XtGeometryNo: + wid = tw->core.width ; + hgt = tw->core.height ; + break ; + + case XtGeometryAlmost: + wid = myreply.width ; + hgt = myreply.height ; + tw->tabs.needs_layout = True ; + break ; + } + } + + /* Within the constraints imposed by the parent, what is + * the max size we can give the child? + */ + (void) TabLayout(tw, wid, &th, True) ; + aw = wid - 2*s ; + ah = hgt - th - 2*s ; + + /* OK, make our decision. If requested size is >= max sibling + * preferred size, AND requested size <= available size, then + * we accept. Otherwise, we offer a compromise. + */ + + if( rw == aw && rh == ah ) + { + /* Acceptable. If this wasn't a query, change *all* children + * to this size. + */ + if( req->request_mode & XtCWQueryOnly ) + return XtGeometryYes ; + else + { + Widget *childP = tw->composite.children ; + int i,bw ; + w->core.border_width = req->border_width ; + for(i=tw->composite.num_children; --i >= 0; ++childP) + if( XtIsManaged(*childP) ) + { + bw = (*childP)->core.border_width ; + XtConfigureWidget(*childP, s,tw->tabs.tab_total+s, + rw-2*bw, rh-2*bw, bw) ; + } +#ifdef COMMENT + /* TODO: under what conditions will we need to redraw? */ + XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ; + XtClass(tw)->core_class.expose((Widget)tw,NULL,NULL) ; +#endif /* COMMENT */ + return XtGeometryDone ; + } + } + + /* Cannot grant child's request. Describe what we *can* do + * and return counter-offer. + */ + reply->width = aw - 2 * req->border_width ; + reply->height = ah - 2 * req->border_width ; + reply->border_width = req->border_width ; + reply->request_mode = CWWidth | CWHeight | CWBorderWidth ; + return XtGeometryAlmost ; + } + + return XtGeometryYes ; +} + + + + + /* The number of children we manage has changed; recompute + * size from scratch. + */ + +static void +TabsChangeManaged(Widget w) +{ + TabsWidget tw = (TabsWidget)w ; + Widget *childP = tw->composite.children ; + int i ; + + if( tw->tabs.topWidget != NULL && + ( !XtIsManaged(tw->tabs.topWidget) || + tw->tabs.topWidget->core.being_destroyed ) ) + tw->tabs.topWidget = NULL ; + + GetPreferredSizes(tw) ; + MakeSizeRequest(tw) ; + + XtClass(w)->core_class.resize(w) ; + if( XtIsRealized(w) ) + { + Display *dpy = XtDisplay(w) ; + XClearWindow(dpy, XtWindow(w)) ; + XtClass(w)->core_class.expose(w,NULL,NULL) ; + + /* make sure the top widget stays on top. This requires + * making sure that all new children are realized first. + */ + if( tw->tabs.topWidget != NULL && XtIsRealized(tw->tabs.topWidget) ) + { + for(i=tw->composite.num_children; --i >= 0; ++childP) + if( !XtIsRealized(*childP) ) + XtRealizeWidget(*childP) ; + + XRaiseWindow(dpy, XtWindow(tw->tabs.topWidget)) ; + } + } + +#ifdef USE_MOTIF + /* Only top widget may receive input */ + + for(childP = tw->composite.children, i=tw->composite.num_children; + --i >= 0; + ++childP) + { + XtVaSetValues(*childP, XmNtraversalOn, False, 0) ; + } + + if( tw->tabs.topWidget != NULL ) + XtVaSetValues(tw->tabs.topWidget, XmNtraversalOn, True, 0) ; +#endif +} + + + + +/**************************************************************** + * + * Action Procedures + * + ****************************************************************/ + + + /* User clicks on a tab, figure out which one it was. */ + +/* ARGSUSED */ +static void +TabsSelect(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + TabsWidget tw = (TabsWidget) w ; + Widget *childP ; + Position x,y ; + Dimension h = tw->tabs.tab_height ; + int i ; + +#ifdef USE_MOTIF + XmProcessTraversal (w, XmTRAVERSE_CURRENT) ; +#endif + + /* TODO: is there an Xmu function or something to do this instead? */ + switch( event->type ) { + case ButtonPress: + case ButtonRelease: + x = event->xbutton.x ; y = event->xbutton.y ; break ; + case KeyPress: + case KeyRelease: + x = event->xkey.x ; y = event->xkey.y ; break ; + default: + return ; + } + + /* TODO: determine which tab was clicked, if any. Set that + * widget to be top of stacking order with XawTabsSetTop(). + */ + for(i=0, childP=tw->composite.children; + i < tw->composite.num_children; + ++i, ++childP) + if( XtIsManaged(*childP) ) + { + TabsConstraints tab = (TabsConstraints)(*childP)->core.constraints; + if( x > tab->tabs.x && x < tab->tabs.x + tab->tabs.width && + y > tab->tabs.y && y < tab->tabs.y + h ) + { + if( *childP != tw->tabs.topWidget && + (XtIsSensitive(*childP) || tw->tabs.selectInsensitive) ) + XawTabsSetTop(*childP, True) ; + break ; + } + } +} + + + /* User hits a key */ + +static void +TabsPage(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + TabsWidget tw = (TabsWidget) w ; + Widget newtop ; + Widget *childP ; + int idx ; + int nc = tw->composite.num_children ; + + if( nc <= 0 ) + return ; + + if( *num_params < 1 ) { + XtAppWarning(XtWidgetToApplicationContext(w), + "Tabs: page() action called with no arguments") ; + return ; + } + + if( tw->tabs.topWidget == NULL ) + tw->tabs.topWidget = tw->composite.children[0] ; + + for(idx=0, childP=tw->composite.children; idx < nc; ++idx, ++childP ) + if( tw->tabs.topWidget == *childP ) + break ; + + switch( params[0][0] ) { + case 'u': /* up */ + case 'U': + if( --idx < 0 ) + idx = nc-1 ; + newtop = tw->composite.children[idx] ; + break ; + + case 'd': /* down */ + case 'D': + if( ++idx >= nc ) + idx = 0 ; + newtop = tw->composite.children[idx] ; + break ; + + case 'h': + case 'H': + default: + newtop = tw->composite.children[0] ; + break ; + + case 'e': + case 'E': + newtop = tw->composite.children[nc-1] ; + break ; + + case 's': /* selected */ + case 'S': + if( (newtop = tw->tabs.hilight) == NULL ) + return ; + break ; + } + + XawTabsSetTop(newtop, True) ; +} + + + /* User hits up/down key */ + +static void +TabsHighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + TabsWidget tw = (TabsWidget) w ; + Widget newhl ; + Widget *childP ; + int idx ; + int nc = tw->composite.num_children ; + + if( nc <= 0 ) + return ; + + if( *num_params < 1 ) + { + if( tw->tabs.hilight != NULL ) + DrawHighlight(tw, tw->tabs.hilight, False) ; + return ; + } + + if( tw->tabs.hilight == NULL ) + newhl = tw->composite.children[0] ; + + else + { + /* find index of currently highlit child */ + for(idx=0, childP=tw->composite.children; idx < nc; ++idx, ++childP ) + if( tw->tabs.hilight == *childP ) + break ; + + switch( params[0][0] ) { + case 'u': /* up */ + case 'U': + if( --idx < 0 ) + idx = nc-1 ; + newhl = tw->composite.children[idx] ; + break ; + + case 'd': /* down */ + case 'D': + if( ++idx >= nc ) + idx = 0 ; + newhl = tw->composite.children[idx] ; + break ; + + case 'h': + case 'H': + newhl = tw->composite.children[0] ; + break ; + + case 'e': + case 'E': + newhl = tw->composite.children[nc-1] ; + break ; + + default: + newhl = tw->tabs.hilight ; + break ; + } + } + + XawTabsSetHighlight(w, newhl) ; +} + + + +static void +TabsUnhighlight(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + TabsWidget tw = (TabsWidget) w ; + int nc = tw->composite.num_children ; + + if( nc <= 0 ) + return ; + + if( tw->tabs.hilight != NULL ) + DrawHighlight(tw, tw->tabs.hilight, True) ; +} + + + + + +/**************************************************************** + * + * Public Procedures + * + ****************************************************************/ + + + /* Set the top tab, optionally call all callbacks. */ +void +XawTabsSetTop(Widget w, Bool callCallbacks) +{ + TabsWidget tw = (TabsWidget)w->core.parent ; + TabsConstraints tab ; + Widget oldtop = tw->tabs.topWidget ; + + if( !XtIsSubclass(w->core.parent, tabsWidgetClass) ) + { + char line[256] ; + sprintf(line, "XawTabsSetTop: widget \"%.64s\" is not the child of a tabs widget.", XtName(w)) ; + XtAppWarning(XtWidgetToApplicationContext(w), line) ; + return ; + } + + if( callCallbacks ) + XtCallCallbackList(w, tw->tabs.popdownCallbacks, + (XtPointer)tw->tabs.topWidget) ; + + if( !XtIsRealized(w) ) { + tw->tabs.topWidget = w ; + tw->tabs.needs_layout = True ; + return ; + } + + XRaiseWindow(XtDisplay(w), XtWindow(w)) ; +#ifdef USE_MOTIF + XtVaSetValues(oldtop, XmNtraversalOn, False, 0) ; + XtVaSetValues(w, XmNtraversalOn, True, 0) ; +#endif + + tab = (TabsConstraints) w->core.constraints ; + if( tab->tabs.row == 0 ) + { + /* Easy case; undraw current top, undraw new top, assign new + * top, redraw all borders. + * We *could* just erase and execute a full redraw, but I like to + * reduce screen flicker. + */ + UndrawTab(tw, oldtop) ; /* undraw old */ + DrawBorder(tw, oldtop, True) ; + UndrawTab(tw, w) ; /* undraw new */ + DrawBorder(tw, w, True) ; + tw->tabs.topWidget = w ; + DrawTab(tw, oldtop, True) ; /* redraw old */ + DrawTab(tw, w, True) ; /* redraw new */ + DrawTabs(tw, False) ; + } + else + { + tw->tabs.topWidget = w ; + TabsShuffleRows(tw) ; + XClearWindow(XtDisplay((Widget)tw), XtWindow((Widget)tw)) ; + XtClass(tw)->core_class.expose((Widget)tw,NULL,None) ; + } + + XawTabsSetHighlight((Widget)tw, w) ; + + if( callCallbacks ) + XtCallCallbackList(w, tw->tabs.callbacks, (XtPointer)w) ; +} + + + /* Set the top tab, optionally call all callbacks. */ +void +XawTabsSetHighlight(Widget t, Widget w) +{ + TabsWidget tw = (TabsWidget)t ; + + if( !XtIsSubclass(t, tabsWidgetClass) ) + return ; + + if( XtIsRealized(t) && w != tw->tabs.hilight ) + { + if( tw->tabs.hilight != NULL ) + DrawHighlight(tw, tw->tabs.hilight, True) ; + if( w != NULL ) + DrawHighlight(tw, w, False) ; + } + + tw->tabs.hilight = w ; +} + + + + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + + +static void +TabsAllocGCs(TabsWidget tw) +{ + TabsAllocFgGC(tw) ; + TabsAllocGreyGC(tw) ; + tw->tabs.backgroundGC = AllocBackgroundGC((Widget)tw, None) ; + tw->tabs.topGC = AllocTopShadowGC((Widget)tw, + tw->tabs.top_shadow_contrast, tw->tabs.be_nice_to_cmap) ; + tw->tabs.botGC = AllocBotShadowGC((Widget)tw, + tw->tabs.bot_shadow_contrast, tw->tabs.be_nice_to_cmap) ; +} + + +static void +TabsFreeGCs(TabsWidget tw) +{ + Widget w = (Widget) tw; + + XtReleaseGC(w, tw->tabs.foregroundGC) ; + XtReleaseGC(w, tw->tabs.greyGC) ; + XtReleaseGC(w, tw->tabs.backgroundGC) ; + XtReleaseGC(w, tw->tabs.topGC) ; + XtReleaseGC(w, tw->tabs.botGC) ; +#ifdef USE_XMU_STIPPLE + XmuReleaseStippledPixmap(XtScreen(w), tw->tabs.grey50) ; +#else +/* XFreePixmap(XtDisplay(w), tw->tabs.grey50 );*/ + ; +#endif +} + + + + + + /* Redraw entire Tabs widget */ + +static void +DrawTabs(TabsWidget tw, Bool labels) +{ + Widget *childP ; + int i,j ; + Dimension s = SHADWID ; + Dimension th = tw->tabs.tab_height ; + Position y ; + TabsConstraints tab ; + + /* draw tabs and frames by row except for the top tab, which + * is drawn last. (This is inefficiently written, but should not + * be too slow as long as there are not a lot of rows.) + */ + + y = tw->tabs.numRows == 1 ? TABDELTA : 0 ; + for(i=0; i<tw->tabs.numRows; ++i, y += th) + { + for( j=tw->composite.num_children, childP=tw->composite.children; + --j >= 0; ++childP ) + if( XtIsManaged(*childP) ) + { + tab = (TabsConstraints)(*childP)->core.constraints; + if( tab->tabs.row == i && *childP != tw->tabs.topWidget ) + DrawTab(tw, *childP, labels) ; + } + if( i != tw->tabs.numRows -1 ) + DrawTrim(tw, 0,y+th, tw->core.width, th+s, False,False) ; + } + + DrawFrame(tw) ; + + /* and now the top tab */ + if( tw->tabs.topWidget != NULL ) + DrawTab(tw, tw->tabs.topWidget, labels) ; +} + + + +/* Draw one tab. Corners are rounded very slightly. */ + +static void +DrawTab(TabsWidget tw, Widget child, Bool labels) +{ + GC gc ; + int x,y ; + + DrawBorder(tw, child, False) ; + + if( labels ) + { + TabsConstraints tab = (TabsConstraints)child->core.constraints; + Display *dpy = XtDisplay((Widget)tw) ; + Window win = XtWindow((Widget)tw) ; + String lbl = tab->tabs.label != NULL ? + tab->tabs.label : XtName(child) ; + + if( XtIsSensitive(child) ) + { + gc = tw->tabs.foregroundGC ; + XSetForeground(dpy, gc, tab->tabs.foreground) ; + } + else + { + /* grey pixel allocation deferred until now */ + if( !tab->tabs.greyAlloc ) + { + if( tw->tabs.be_nice_to_cmap || tw->core.depth == 1 ) + tab->tabs.grey = tab->tabs.foreground ; + else + tab->tabs.grey = AllocGreyPixel((Widget)tw, + tab->tabs.foreground, + tw->core.background_pixel, + tw->tabs.insensitive_contrast ) ; + tab->tabs.greyAlloc = True ; + } + gc = tw->tabs.greyGC ; + XSetForeground(dpy, gc, tab->tabs.grey) ; + } + + x = tab->tabs.x ; + y = tab->tabs.y ; + if( child == tw->tabs.topWidget ) + y -= TABLDELTA ; + + if( tab->tabs.left_bitmap != None && tab->tabs.lbm_width > 0 ) + { + if( tab->tabs.lbm_depth == 1 ) + XCopyPlane(dpy, tab->tabs.left_bitmap, win,gc, + 0,0, tab->tabs.lbm_width, tab->tabs.lbm_height, + x+tab->tabs.lbm_x, y+tab->tabs.lbm_y, 1L) ; + else + XCopyArea(dpy, tab->tabs.left_bitmap, win,gc, + 0,0, tab->tabs.lbm_width, tab->tabs.lbm_height, + x+tab->tabs.lbm_x, y+tab->tabs.lbm_y) ; + } + + if( lbl != NULL && tw->tabs.font != NULL ) + XDrawString(dpy,win,gc, + x+tab->tabs.l_x, y+tab->tabs.l_y, + lbl, (int)strlen(lbl)) ; + } + + if( child == tw->tabs.hilight ) + DrawHighlight(tw, child, False) ; +} + + + /* draw frame all the way around the child windows. */ + +static void +DrawFrame(TabsWidget tw) +{ + GC topgc = tw->tabs.topGC ; + GC botgc = tw->tabs.botGC ; + Dimension s = SHADWID ; + Dimension ch = tw->tabs.child_height ; + + Draw3dBox((Widget)tw, 0,tw->tabs.tab_total, + tw->core.width, ch+2*s, s, topgc, botgc) ; +} + + + /* draw trim around a tab or underneath a row of tabs */ + +static void +DrawTrim(TabsWidget tw, /* widget */ + int x, /* upper-left corner */ + int y, + int wid, /* total size */ + int hgt, + Bool bottom, /* draw bottom? */ + Bool undraw) /* undraw all */ +{ + Display *dpy = XtDisplay((Widget)tw) ; + Window win = XtWindow((Widget)tw) ; + GC bggc = tw->tabs.backgroundGC ; + GC topgc = undraw ? bggc : tw->tabs.topGC ; + GC botgc = undraw ? bggc : tw->tabs.botGC ; + + if( bottom ) + XDrawLine(dpy,win,bggc, x,y+hgt-1, x+wid-1,y+hgt-1) ; /* bottom */ + XDrawLine(dpy,win,topgc, x,y+2, x,y+hgt-2) ; /* left */ + XDrawPoint(dpy,win,topgc, x+1,y+1) ; /* corner */ + XDrawLine(dpy,win,topgc, x+2,y, x+wid-3,y) ; /* top */ + XDrawLine(dpy,win,botgc, x+wid-2,y+1, x+wid-2,y+hgt-2) ; /* right */ + XDrawLine(dpy,win,botgc, x+wid-1,y+2, x+wid-1,y+hgt-2) ; /* right */ +} + + +/* Draw one tab border. */ + +static void +DrawBorder(TabsWidget tw, Widget child, Bool undraw) +{ + TabsConstraints tab = (TabsConstraints)child->core.constraints; + Position x = tab->tabs.x ; + Position y = tab->tabs.y ; + Dimension twid = tab->tabs.width ; + Dimension thgt = tw->tabs.tab_height ; + + /* top tab requires a little special attention; it overlaps + * neighboring tabs slightly, so the background must be cleared + * in the region of the overlap to partially erase those neighbors. + * TODO: is this worth doing with regions instead? + */ + if( child == tw->tabs.topWidget ) + { + Display *dpy = XtDisplay((Widget)tw) ; + Window win = XtWindow((Widget)tw) ; + GC bggc = tw->tabs.backgroundGC ; + XRectangle rects[3] ; + x -= TABDELTA ; + y -= TABDELTA ; + twid += TABDELTA*2 ; + thgt += TABDELTA ; + AddRect(0, x,y+1,twid,TABDELTA) ; + AddRect(1, x+1,y,TABDELTA,thgt) ; + AddRect(2, x+twid-TABDELTA-1,y,TABDELTA,thgt) ; + XFillRectangles(dpy,win,bggc, rects, 3) ; + } + + DrawTrim(tw, x,y,twid,thgt+1, child == tw->tabs.topWidget, undraw) ; +} + + +/* Draw highlight around tab that has focus */ + +static void +DrawHighlight(TabsWidget tw, Widget child, Bool undraw) +{ + TabsConstraints tab = (TabsConstraints)child->core.constraints; + Display *dpy = XtDisplay((Widget)tw) ; + Window win = XtWindow((Widget)tw) ; + GC gc ; + Position x = tab->tabs.x ; + Position y = tab->tabs.y ; + Dimension wid = tab->tabs.width ; + Dimension hgt = tw->tabs.tab_height ; + XPoint points[6] ; + + /* top tab does not have a highlight */ + + if( child == tw->tabs.topWidget ) + return ; + + if( undraw ) + gc = tw->tabs.backgroundGC ; + + else if( XtIsSensitive(child) ) + { + gc = tw->tabs.foregroundGC ; + XSetForeground(dpy, gc, tab->tabs.foreground) ; + } + else + { + gc = tw->tabs.greyGC ; + XSetForeground(dpy, gc, tab->tabs.grey) ; + } + + points[0].x = x+1 ; points[0].y = y+hgt-1 ; + points[1].x = x+1 ; points[1].y = y+2 ; + points[2].x = x+2 ; points[2].y = y+1 ; + points[3].x = x+wid-4 ; points[3].y = y+1 ; + points[4].x = x+wid-3 ; points[4].y = y+2 ; + points[5].x = x+wid-3 ; points[5].y = y+hgt-1 ; + + XDrawLines(dpy,win,gc, points,6, CoordModeOrigin) ; +} + + +/* Undraw one tab interior */ + +static void +UndrawTab(TabsWidget tw, Widget child) +{ + TabsConstraints tab = (TabsConstraints)child->core.constraints; + Position x = tab->tabs.x ; + Position y = tab->tabs.y ; + Dimension twid = tab->tabs.width ; + Dimension thgt = tw->tabs.tab_height ; + Display *dpy = XtDisplay((Widget)tw) ; + Window win = XtWindow((Widget)tw) ; + GC bggc = tw->tabs.backgroundGC ; + + XFillRectangle(dpy,win,bggc, x,y, twid,thgt) ; +} + + + + + + /* GEOMETRY UTILITIES */ + + /* Overview: + * + * MaxChild(): ask all children (except possibly one) their + * preferred sizes, set max_cw, max_ch accordingly. + * + * GetPreferredSizes(): ask all children their preferred sizes, + * set max_cw, max_ch accordingly. + * + * PreferredSize(): given max_cw, max_ch, return tabs widget + * preferred size. Iterate with other widths in order to get + * a reasonable aspect ratio. + * + * PreferredSize2(): Given child dimensions, return Tabs + * widget dimensions. + * + * PreferredSize3(): Same, except given child dimensions plus + * shadow. + */ + + + /* Compute the width of one child's tab. Positions will be computed + * elsewhere. + * + * height: font height + vertical_space*2 + shadowWid*2 + * width: string width + horizontal_space*2 + shadowWid*2 + * + * All tabs are the same height, so that is computed elsewhere. + */ + +static void +TabWidth(Widget w) +{ + TabsConstraints tab = (TabsConstraints) w->core.constraints ; + TabsWidget tw = (TabsWidget)XtParent(w) ; + String lbl = tab->tabs.label != NULL ? + tab->tabs.label : XtName(w) ; + XFontStruct *font = tw->tabs.font ; + int iw = tw->tabs.internalWidth ; + + tab->tabs.width = iw + SHADWID*2 ; + tab->tabs.l_x = tab->tabs.lbm_x = SHADWID + iw ; + + if( tab->tabs.left_bitmap != None ) + { + tab->tabs.width += tab->tabs.lbm_width + iw ; + tab->tabs.l_x += tab->tabs.lbm_width + iw ; + tab->tabs.lbm_y = (tw->tabs.tab_height - tab->tabs.lbm_height)/2 ; + } + + if( lbl != NULL && font != NULL ) + { + tab->tabs.width += XTextWidth( font, lbl, (int)strlen(lbl) ) + iw ; + tab->tabs.l_y = (tw->tabs.tab_height + + tw->tabs.font->max_bounds.ascent - + tw->tabs.font->max_bounds.descent)/2 ; + } +} + + + + /* Lay out tabs to fit in given width. Compute x,y position and + * row number for each tab. Return number of rows and total height + * required by all tabs. If there is only one row, add TABDELTA + * height to the total. Rows are assigned bottom to top. + * + * Tabs are indented from the edges by INDENT. + * + * TODO: if they require more than two rows and the total height:width + * ratio is more than 2:1, then try something else. + */ + +static int +TabLayout(TabsWidget tw, int wid, Dimension *reply_height, Bool query_only) +{ + int i, row ; + int num_children = tw->composite.num_children ; + Widget *childP ; + Dimension w ; + Position x,y ; + TabsConstraints tab ; + + /* Algorithm: loop through children, assign X positions. If a tab + * would extend beyond the right edge, start a new row. After all + * rows are assigned, make a second pass and assign Y positions. + */ + + if( num_children > 0 ) + { + /* Loop through the tabs and see how much space they need. */ + + row = 0 ; + x = INDENT ; + y = 0 ; + wid -= INDENT ; + for(i=num_children, childP=tw->composite.children; --i >= 0; ++childP) + if( XtIsManaged(*childP) ) + { + tab = (TabsConstraints) (*childP)->core.constraints ; + w = tab->tabs.width ; + if( x + w > wid ) { /* new row */ + ++row ; + x = INDENT ; + y += tw->tabs.tab_height ; + } + if( !query_only ) { + tab->tabs.x = x ; + tab->tabs.y = y ; + tab->tabs.row = row ; + } + x += w + SPACING ; + } + /* If there was only one row, increse the height by TABDELTA */ + if( ++row == 1 ) + { + y = TABDELTA ; + if( !query_only ) + for(i=num_children, childP=tw->composite.children; + --i >= 0 ; ++childP) + if( XtIsManaged(*childP) ) + { + tab = (TabsConstraints) (*childP)->core.constraints ; + tab->tabs.y = y ; + } + } + y += tw->tabs.tab_height ; + } + else + row = y = 0 ; + + if( !query_only ) { + tw->tabs.tab_total = y ; + tw->tabs.numRows = row ; + } + + if( reply_height != NULL ) + *reply_height = y ; + + return row ; +} + + + + /* Find max preferred child size. Returned sizes include child + * border widths. + */ + +static void +GetPreferredSizes(TabsWidget tw) +{ + MaxChild(tw, NULL, 0,0) ; +} + + + + /* Find max preferred child size. Returned sizes include child + * border widths. If except is non-null, don't ask that one. + */ + +static void +MaxChild(TabsWidget tw, Widget except, Dimension cw, Dimension ch) +{ + int i ; + Widget *childP = tw->composite.children ; + XtWidgetGeometry preferred ; + + for(i=tw->composite.num_children; --i >=0; ++childP) + if( XtIsManaged(*childP) && *childP != except ) + { + (void) XtQueryGeometry(*childP, NULL, &preferred) ; + cw = Max(cw, preferred.width + preferred.border_width * 2 ) ; + ch = Max(ch, preferred.height + preferred.border_width * 2 ) ; + } + + tw->tabs.max_cw = cw ; + tw->tabs.max_ch = ch ; +} + + + + /* rotate row numbers to bring current widget to bottom row, + * compute y positions for all tabs + */ + +static void +TabsShuffleRows(TabsWidget tw) +{ + TabsConstraints tab ; + int move ; + int nrows ; + Widget *childP ; + Dimension th = tw->tabs.tab_height ; + Position bottom ; + int i ; + + /* There must be a top widget. If not, assign one. */ + if( tw->tabs.topWidget == NULL && tw->composite.children != NULL ) + for(i=tw->composite.num_children, childP=tw->composite.children; + --i >= 0; + ++childP) + if( XtIsManaged(*childP) ) { + tw->tabs.topWidget = *childP ; + break ; + } + + if( tw->tabs.topWidget != NULL ) + { + nrows = tw->tabs.numRows ; + assert( nrows > 0 ) ; + + if( nrows > 1 ) + { + tab = (TabsConstraints) tw->tabs.topWidget->core.constraints ; + assert( tab != NULL ) ; + + /* how far to move top row */ + move = nrows - tab->tabs.row ; + bottom = tw->tabs.tab_total - th ; + + for(i=tw->composite.num_children, childP=tw->composite.children; + --i >= 0; + ++childP) + if( XtIsManaged(*childP) ) + { + tab = (TabsConstraints) (*childP)->core.constraints ; + tab->tabs.row = (tab->tabs.row + move) % nrows ; + tab->tabs.y = bottom - tab->tabs.row * th ; + } + } + } +} + + + /* Find preferred size. Ask children, find size of largest, + * add room for tabs & return. This can get a little involved, + * as we don't want to have too many rows of tabs; we may widen + * the widget to reduce # of rows. + * + * This function requires that max_cw, max_ch already be set. + */ + +static int +PreferredSize( + TabsWidget tw, + Dimension *reply_width, /* total widget size */ + Dimension *reply_height, + Dimension *reply_cw, /* child widget size */ + Dimension *reply_ch) +{ + Dimension cw,ch ; /* child width, height */ + Dimension wid,hgt ; + Dimension rwid,rhgt ; + int nrow ; + + wid = cw = tw->tabs.max_cw ; + hgt = ch = tw->tabs.max_ch ; + + nrow = PreferredSize2(tw, wid,hgt, &rwid, &rhgt) ; + + /* Check for absurd results (more than 2 rows, high aspect + * ratio). Try wider size if needed. + * TODO: make sure this terminates. + */ + + if( nrow > 2 && rhgt > rwid ) + { + Dimension w0, w1 ; + int maxloop = 20 ; + + /* step 1: start doubling size until it's too big */ + do { + w0 = wid ; + wid = Max(wid*2, wid+20) ; + nrow = PreferredSize2(tw, wid,hgt, &rwid,&rhgt) ; + } while( nrow > 2 && rhgt > rwid ) ; + w1 = wid ; + + /* step 2: use Newton's method to find ideal size. Stop within + * 8 pixels. + */ + while( --maxloop > 0 && w1 > w0 + 8 ) + { + wid = (w0+w1)/2 ; + nrow = PreferredSize2(tw, wid,hgt, &rwid,&rhgt) ; + if( nrow > 2 && rhgt > rwid ) + w0 = wid ; + else + w1 = wid ; + } + wid = w1 ; + } + + *reply_width = rwid ; + *reply_height = rhgt ; + if( reply_cw != NULL ) *reply_cw = cw ; + if( reply_ch != NULL ) *reply_ch = ch ; + return nrow ; +} + + + /* Find preferred size, given size of children. */ + +static int +PreferredSize2( + TabsWidget tw, + int cw, /* child width, height */ + int ch, + Dimension *reply_width, /* total widget size */ + Dimension *reply_height) +{ + Dimension s = SHADWID ; + + /* make room for shadow frame */ + cw += s*2 ; + ch += s*2 ; + + return PreferredSize3(tw, cw, ch, reply_width, reply_height) ; +} + + + /* Find preferred size, given size of children+shadow. */ + +static int +PreferredSize3( + TabsWidget tw, + int wid, /* child width, height */ + int hgt, + Dimension *reply_width, /* total widget size */ + Dimension *reply_height) +{ + Dimension th ; /* space used by tabs */ + int nrows ; + + if( tw->composite.num_children > 0 ) + nrows = TabLayout(tw, wid, &th, True) ; + else { + th = 0 ; + nrows = 0 ; + } + + *reply_width = Max(wid, MIN_WID) ; + *reply_height = Max(th+hgt, MIN_HGT) ; + + return nrows ; +} + + +static void +MakeSizeRequest(TabsWidget tw) +{ + Widget w = (Widget)tw ; + XtWidgetGeometry request, reply ; + XtGeometryResult result ; + Dimension cw,ch ; + + request.request_mode = CWWidth | CWHeight ; + PreferredSize(tw, &request.width, &request.height, &cw, &ch) ; + + if( request.width == tw->core.width && + request.height == tw->core.height ) + return ; + + result = XtMakeGeometryRequest(w, &request, &reply) ; + + if( result == XtGeometryAlmost ) + { + /* Bugger. Didn't get what we want, but were offered a + * compromise. If the width was too small, recompute + * based on the too-small width and try again. + * If the height was too small, make a wild-ass guess + * at a wider width and try again. + */ + + if( reply.width < request.width && reply.height >= request.height ) + { + Dimension s = SHADWID ; + ch += s*2 ; + PreferredSize3(tw, reply.width,ch, &request.width, &request.height); + result = XtMakeGeometryRequest(w, &request, &reply) ; + if( result == XtGeometryAlmost ) + (void) XtMakeGeometryRequest(w, &reply, NULL) ; + } + + else + (void) XtMakeGeometryRequest(w, &reply, NULL) ; + } +} + + +static void +getBitmapInfo(TabsWidget tw, TabsConstraints tab) +{ + Window root ; + int x,y ; + unsigned int bw ; + + if( tab->tabs.left_bitmap == None || + !XGetGeometry(XtDisplay(tw), tab->tabs.left_bitmap, &root, &x, &y, + &tab->tabs.lbm_width, &tab->tabs.lbm_height, + &bw, &tab->tabs.lbm_depth) ) + tab->tabs.lbm_width = tab->tabs.lbm_height = 0 ; +} + + + + + /* Code copied & modified from Gcs.c. This version has dynamic + * foreground. + */ + +static void +TabsAllocFgGC(TabsWidget tw) +{ + Widget w = (Widget) tw; + XGCValues values ; + + values.background = tw->core.background_pixel ; + values.font = tw->tabs.font->fid ; + values.line_style = LineOnOffDash ; + values.line_style = LineSolid ; + + tw->tabs.foregroundGC = + XtAllocateGC(w, w->core.depth, + GCBackground|GCFont|GCLineStyle, &values, + GCForeground, + GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode) ; +} + +static void +TabsAllocGreyGC(TabsWidget tw) +{ + Widget w = (Widget) tw; + XGCValues values ; +#ifndef USE_XMU_STIPPLE + Screen *screen = XtScreen((Widget)tw); + Display *display = XtDisplay((Widget)tw); + int pixmap_width = 2, pixmap_height = 2; + static unsigned char pixmap_bits[] = { + 0x02, 0x01, + }; +#endif + + values.background = tw->core.background_pixel ; + values.font = tw->tabs.font->fid ; + + if( tw->tabs.be_nice_to_cmap || w->core.depth == 1) + { + values.fill_style = FillStippled ; +#ifdef USE_XMU_STIPPLE + tw->tabs.grey50 = + values.stipple = XmuCreateStippledPixmap(XtScreen(w), 1L, 0L, 1); +#else + tw->tabs.grey50 = + values.stipple = XCreatePixmapFromBitmapData (display, + RootWindowOfScreen(screen), + (char *)pixmap_bits, + pixmap_width, pixmap_height, + 1L, 0L, 1); +#endif + + tw->tabs.greyGC = + XtAllocateGC(w, w->core.depth, + GCBackground|GCFont|GCStipple|GCFillStyle, &values, + GCForeground, + GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode) ; + } + else + { + tw->tabs.greyGC = + XtAllocateGC(w, w->core.depth, + GCFont, &values, + GCForeground, + GCBackground|GCSubwindowMode|GCGraphicsExposures|GCDashOffset| + GCDashList|GCArcMode) ; + } +} diff --git a/vendor/x11iraf/obm/ObmW/Tabs.h b/vendor/x11iraf/obm/ObmW/Tabs.h new file mode 100644 index 00000000..d53b56ff --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Tabs.h @@ -0,0 +1,186 @@ +/* $Id: Tabs.h,v 1.6 1999/09/22 19:54:14 falk Exp $ + * + * This widget manages one or more child widgets, exactly one of which is + * visible. Above the child widgets is a graphic that looks like index + * tabs from file folders. Each tab corresponds to one of the child widgets. + * By clicking on a tab, the user can bring the corresponding widget to + * the top of the stack. + */ + + +#ifndef _Tabs_h +#define _Tabs_h + +#include <X11/Constraint.h> + + +/*********************************************************************** + * + * Tabs Widget (subclass of CompositeClass) + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + font Font XFontStruct* XtDefaultFont + internalWidth Width Dimension 4 *1 + internalHeight Height Dimension 2 *1 + topWidget TopWidget Widget *2 + callback Callback XtCallbackList NULL *3 + popdownCallback Callback XtCallbackList NULL *4 + selectInsensitive SelectInsensitive Boolean True *5 + beNiceToColormap BeNiceToColormap Boolean False *6 + topShadowContrast TopShadowContrast int 20 + bottomShadowContrast BottomShadowContrast int 40 + insensitiveContrast InsensitiveContrast int 33 *7 + + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + orientation Orientation XtOrientation vertical + vSpace VSpace Dimension 4 + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + + Notes: + + 1 internalWidth, internalHeight specify the margins around the text + in the tabs. + 2 topWidget identifies the widget which is currently visible. + 3 callbacks are called whenever the user selects a tab. Call_data is + the new top widget. + 4 popdownCallbacks are called whenever the user selects a tab. Call_data is + the old (no longer visible) top widget. Note that popdownCallbacks + are called before callbacks. + 5 SelectInsensitive determines whether or not insensitive children may + be selected anyway. + 6 BeNiceToColormap causes the Tabs widget to use fewer colors. + 7 InsensitiveContrast sets the contrast used for labels of insensitive widgets. + +*/ + +/* Constraint parameters: + Name Class RepType Default Value + ---- ----- ------- ------------- + tabLabel Label String widget name + tabLeftBitmap LeftBitmap Pixmap None + tabForeground Foreground Pixel XtDefaultForeground + resizable Resizable Boolean False +*/ + +/* New fields */ + +#ifndef XtNtabLabel +#define XtNtabLabel "tabLabel" +#define XtNtabForeground "tabForeground" +#endif + +#ifndef XtNtabLeftBitmap +#define XtNtabLeftBitmap "tabLeftBitmap" +#endif + +#ifndef XtCLeftBitmap +#define XtCLeftBitmap "LeftBitmap" +#endif + +#ifndef XtCResizable +#define XtCResizable "Resizable" +#endif + +#ifndef XtNselectInsensitive +#define XtNselectInsensitive "selectInsensitive" +#define XtCSelectInsensitive "SelectInsensitive" +#endif + +#ifndef XtNnlabels +#define XtNnlabels "nlabels" +#define XtCNLabels "NLabels" +#endif +#ifndef XtNlabels +#define XtNlabels "labels" +#define XtCLabels "Labels" +#endif + +#ifndef XtNtopWidget +#define XtNtopWidget "topWidget" +#define XtCTopWidget "TopWidget" +#endif + +#ifndef XtNhSpace +#define XtNhSpace "hSpace" +#define XtCHSpace "HSpace" +#define XtNvSpace "vSpace" +#define XtCVSpace "VSpace" +#endif + +#ifndef XtNresizable +#define XtNresizable "resizable" +#endif + +#ifndef XtNinsensitiveContrast +#define XtNinsensitiveContrast "insensitiveContrast" +#define XtCInsensitiveContrast "InsensitiveContrast" +#endif + +#ifndef XtNshadowWidth +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#endif + +#ifndef XtNtopShadowPixmap +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#endif + +#ifndef XtNbeNiceToColormap +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNbeNiceToColourmap "beNiceToColormap" +#define XtCBeNiceToColourmap "BeNiceToColormap" +#endif + +/* Class record constants */ + +extern WidgetClass tabsWidgetClass; + +typedef struct _TabsClassRec *TabsWidgetClass; +typedef struct _TabsRec *TabsWidget; + +_XFUNCPROTOBEGIN + +extern void +XawTabsSetTop( +#if NeedFunctionPrototypes + Widget w, + Bool callCallbacks +#endif +) ; + +extern void +XawTabsSetHighlight( +#if NeedFunctionPrototypes + Widget tabs, + Widget w +#endif +) ; + +_XFUNCPROTOEND + +#endif /* _Tabs_h */ diff --git a/vendor/x11iraf/obm/ObmW/TabsP.h b/vendor/x11iraf/obm/ObmW/TabsP.h new file mode 100644 index 00000000..2b77264e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/TabsP.h @@ -0,0 +1,127 @@ +/* $Id: TabsP.h,v 1.8 1999/12/16 18:01:25 falk Exp $ + * + * TabsP.h - Private definitions for Index Tabs widget + * + */ + +#ifndef _TabsP_h +#define _TabsP_h + +/*********************************************************************** + * + * Tabs Widget Private Data + * + ***********************************************************************/ + +#include <X11/IntrinsicP.h> + +#ifdef USE_MOTIF +#include <Xm/XmP.h> +#include <Xm/ManagerP.h> +#endif + +#include "Tabs.h" + +/* New fields for the Tabs widget class record */ +typedef struct {XtPointer extension;} TabsClassPart; + +/* Full class record declaration */ +typedef struct _TabsClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; +#ifdef USE_MOTIF + XmManagerClassPart manager_class; +#endif + TabsClassPart tabs_class; +} TabsClassRec; + +extern TabsClassRec tabsClassRec; + + + +/**************************************************************** + * + * instance record declaration + * + ****************************************************************/ + +/* New fields for the Tabs widget record */ +typedef struct { + /* resources */ + XFontStruct *font ; + Dimension internalHeight, internalWidth ; + Widget topWidget ; + XtCallbackList callbacks ; + XtCallbackList popdownCallbacks ; + Boolean selectInsensitive ; + Boolean be_nice_to_cmap ; + int top_shadow_contrast ; + int bot_shadow_contrast ; + int insensitive_contrast ; + + /* private state */ + Widget hilight ; + GC foregroundGC ; + GC backgroundGC ; + GC greyGC ; + GC topGC ; + GC botGC ; + Dimension tab_height ; /* height of tabs (all the same) */ + /* Note: includes top shadow only */ + Dimension tab_total ; /* total height of all tabs */ + Dimension child_width, child_height; /* child size, including borders */ + Dimension max_cw, max_ch ; /* max child preferred size */ + Cardinal numRows ; + XtGeometryMask last_query_mode; + Boolean needs_layout ; + Pixmap grey50 ; /* TODO: cache this elsewhere */ +} TabsPart; + + +typedef struct _TabsRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; +#ifdef USE_MOTIF + XmManagerPart manager; +#endif + TabsPart tabs; +} TabsRec; + + + + +/**************************************************************** + * + * constraint record declaration + * + ****************************************************************/ + +typedef struct _TabsConstraintsPart { + /* resources */ + String label ; + Pixmap left_bitmap ; + Pixel foreground ; + Boolean resizable ; + + /* private state */ + Pixel grey ; + Boolean greyAlloc ; + Dimension width ; /* tab width */ + Position x,y ; /* tab base position */ + short row ; /* tab row */ + Position l_x, l_y ; /* label position */ + Position lbm_x, lbm_y ; /* bitmap position */ + unsigned int lbm_width, lbm_height, lbm_depth ; +} TabsConstraintsPart ; + +typedef struct _TabsConstraintsRec { +#ifdef USE_MOTIF + XmManagerConstraintPart manager; +#endif + TabsConstraintsPart tabs ; +} TabsConstraintsRec, *TabsConstraints ; + + +#endif /* _TabsP_h */ diff --git a/vendor/x11iraf/obm/ObmW/TextWidth.c b/vendor/x11iraf/obm/ObmW/TextWidth.c new file mode 100644 index 00000000..b213d198 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/TextWidth.c @@ -0,0 +1,39 @@ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include "TabString.h" + +/* + * Like TextWidth, except it takes an additional "tabs" + * argument, used to specify what horizontal pixel position to + * move to when tab characters are present in the string. If + * the "tabs" argument is NULL, works exactly like its + * counterpart. + */ +int +XfwfTextWidth(font, str, length, tabs) + XFontStruct *font; + String str; + int length; + int *tabs; +{ + register char *p, *ep; + register int tx, tab, rc; + + tab = tx = 0; + if (length == 0) return 0; + for (p = str; length; ) + { + ep = strnchr(p, '\t', length); + if (ep && tabs) + { + tx = tabs[tab++]; + length -= ep - p + 1; + p = ep + 1; + } + else + { + rc = XTextWidth(font, p, length); + if (rc < 0) return rc; else return rc + tx; + } + } +} diff --git a/vendor/x11iraf/obm/ObmW/Toggle.c b/vendor/x11iraf/obm/ObmW/Toggle.c new file mode 100644 index 00000000..6f55305a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Toggle.c @@ -0,0 +1,290 @@ +/* Generated by wbuild from "Toggle.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Converters.h" +#include "ToggleP.h" +static void toggle( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void switch_on( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); +static void switch_off( +#if NeedFunctionPrototypes +Widget,XEvent*,String*,Cardinal* +#endif +); + +static XtActionsRec actionsList[] = { +{"toggle", toggle}, +{"switch_on", switch_on}, +{"switch_off", switch_off}, +}; + +static char defaultTranslations[] = "\ +<Btn1Down>: set_shadow(sunken) \n\ +<Btn1Up>: toggle() set_shadow() \n\ +<Key>Return: toggle() \n\ +"; +static void _resolve_inheritance( +#if NeedFunctionPrototypes +WidgetClass +#endif +); +static void initialize( +#if NeedFunctionPrototypes +Widget ,Widget,ArgList ,Cardinal * +#endif +); +static Boolean set_values( +#if NeedFunctionPrototypes +Widget ,Widget ,Widget,ArgList ,Cardinal * +#endif +); +static void expose( +#if NeedFunctionPrototypes +Widget,XEvent *,Region +#endif +); +static void create_on_gc( +#if NeedFunctionPrototypes +Widget +#endif +); +static void create_off_gc( +#if NeedFunctionPrototypes +Widget +#endif +); +/*ARGSUSED*/static void create_on_gc(self)Widget self; +{ + XtGCMask mask = GCFillStyle; + XGCValues values; + + if (((XfwfToggleWidget)self)->xfwfToggle.on_gc != NULL) XtReleaseGC(self, ((XfwfToggleWidget)self)->xfwfToggle.on_gc); + if (((XfwfToggleWidget)self)->xfwfToggle.onIcon && ((XfwfToggleWidget)self)->xfwfToggle.onIcon->pixmap != None) { + values.tile = ((XfwfToggleWidget)self)->xfwfToggle.onIcon->pixmap; + mask |= GCTile; + } + if (((XfwfToggleWidget)self)->xfwfToggle.onIcon && ((XfwfToggleWidget)self)->xfwfToggle.onIcon->mask != None) { + values.clip_mask = ((XfwfToggleWidget)self)->xfwfToggle.onIcon->mask; + mask |= GCClipMask; + } + values.fill_style = FillTiled; + ((XfwfToggleWidget)self)->xfwfToggle.on_gc = XtGetGC(self, mask, &values); +} +/*ARGSUSED*/static void create_off_gc(self)Widget self; +{ + XtGCMask mask = GCFillStyle; + XGCValues values; + + if (((XfwfToggleWidget)self)->xfwfToggle.off_gc != NULL) XtReleaseGC(self, ((XfwfToggleWidget)self)->xfwfToggle.off_gc); + if (((XfwfToggleWidget)self)->xfwfToggle.offIcon && ((XfwfToggleWidget)self)->xfwfToggle.offIcon->pixmap != None) { + values.tile = ((XfwfToggleWidget)self)->xfwfToggle.offIcon->pixmap; + mask |= GCTile; + } + if (((XfwfToggleWidget)self)->xfwfToggle.offIcon && ((XfwfToggleWidget)self)->xfwfToggle.offIcon->mask != None) { + values.clip_mask = ((XfwfToggleWidget)self)->xfwfToggle.offIcon->mask; + mask |= GCClipMask; + } + values.fill_style = FillTiled; + ((XfwfToggleWidget)self)->xfwfToggle.off_gc = XtGetGC(self, mask, &values); +} + +static XtResource resources[] = { +{XtNonCallback,XtCOnCallback,XtRCallback,sizeof(((XfwfToggleRec*)NULL)->xfwfToggle.onCallback),XtOffsetOf(XfwfToggleRec,xfwfToggle.onCallback),XtRImmediate,(XtPointer)NULL }, +{XtNoffCallback,XtCOffCallback,XtRCallback,sizeof(((XfwfToggleRec*)NULL)->xfwfToggle.offCallback),XtOffsetOf(XfwfToggleRec,xfwfToggle.offCallback),XtRImmediate,(XtPointer)NULL }, +{XtNon,XtCOn,XtRBoolean,sizeof(((XfwfToggleRec*)NULL)->xfwfToggle.on),XtOffsetOf(XfwfToggleRec,xfwfToggle.on),XtRImmediate,(XtPointer)False }, +{XtNonIcon,XtCOnIcon,XtRIcon,sizeof(((XfwfToggleRec*)NULL)->xfwfToggle.onIcon),XtOffsetOf(XfwfToggleRec,xfwfToggle.onIcon),XtRString,(XtPointer)"filledsquare"}, +{XtNoffIcon,XtCOffIcon,XtRIcon,sizeof(((XfwfToggleRec*)NULL)->xfwfToggle.offIcon),XtOffsetOf(XfwfToggleRec,xfwfToggle.offIcon),XtRString,(XtPointer)"emptysquare"}, +}; + +XfwfToggleClassRec xfwfToggleClassRec = { +{ /* core_class part */ +(WidgetClass) &xfwfButtonClassRec, +"TextToggle", +sizeof(XfwfToggleRec), +NULL, +_resolve_inheritance, +FALSE, +initialize, +NULL, +XtInheritRealize, +actionsList, +3, +resources, +5, +NULLQUARK, +False , +FALSE , +False , +False , +NULL, +XtInheritResize, +expose, +set_values, +NULL, +XtInheritSetValuesAlmost, +NULL, +XtInheritAcceptFocus, +XtVersion, +NULL, +defaultTranslations, +XtInheritQueryGeometry, +XtInheritDisplayAccelerator, +NULL +}, +{ /* composite_class part */ +XtInheritGeometryManager, +XtInheritChangeManaged, +XtInheritInsertChild, +XtInheritDeleteChild, +NULL +}, +{ /* XfwfCommon_class part */ +XtInherit_compute_inside, +XtInherit_highlight_border, +XtInherit_unhighlight_border, +XtInherit_would_accept_focus, +XtInherit_traverse, +XtInherit_choose_color, +XtInherit_lighter_color, +XtInherit_darker_color, +NULL , +}, +{ /* XfwfFrame_class part */ +0 +}, +{ /* XfwfBoard_class part */ +XtInherit_set_abs_location, +}, +{ /* XfwfLabel_class part */ +XtInherit_set_label, +}, +{ /* XfwfButton_class part */ +0 +}, +{ /* XfwfToggle_class part */ +0 +}, +}; +WidgetClass xfwfToggleWidgetClass = (WidgetClass) &xfwfToggleClassRec; +/*ARGSUSED*/ +static void toggle(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + XtVaSetValues(self, "on", !((XfwfToggleWidget)self)->xfwfToggle.on, NULL); + XtCallCallbackList(self, ((XfwfToggleWidget)self)->xfwfToggle.on ? ((XfwfToggleWidget)self)->xfwfToggle.onCallback : ((XfwfToggleWidget)self)->xfwfToggle.offCallback, event); +} + +/*ARGSUSED*/ +static void switch_on(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + if (! ((XfwfToggleWidget)self)->xfwfToggle.on) { + XtVaSetValues(self, "on", True, NULL); + XtCallCallbackList(self, ((XfwfToggleWidget)self)->xfwfToggle.onCallback, event); + } +} + +/*ARGSUSED*/ +static void switch_off(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params; +{ + if (((XfwfToggleWidget)self)->xfwfToggle.on) { + XtVaSetValues(self, "on", False, NULL); + XtCallCallbackList(self, ((XfwfToggleWidget)self)->xfwfToggle.offCallback, event); + } +} + +static void _resolve_inheritance(class) +WidgetClass class; +{ + XfwfToggleWidgetClass c = (XfwfToggleWidgetClass) class; + XfwfToggleWidgetClass super; + static CompositeClassExtensionRec extension_rec = { + NULL, NULLQUARK, XtCompositeExtensionVersion, + sizeof(CompositeClassExtensionRec), True}; + CompositeClassExtensionRec *ext; + ext = (XtPointer)XtMalloc(sizeof(*ext)); + *ext = extension_rec; + ext->next_extension = c->composite_class.extension; + c->composite_class.extension = ext; + if (class == xfwfToggleWidgetClass) return; + super = (XfwfToggleWidgetClass)class->core_class.superclass; +} +/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + int status; + Dimension w1, w2, w; + + ((XfwfToggleWidget)self)->xfwfToggle.on_gc = NULL; + ((XfwfToggleWidget)self)->xfwfToggle.off_gc = NULL; + create_on_gc(self); + create_off_gc(self); + + w1 = ((XfwfToggleWidget)self)->xfwfToggle.onIcon ? ((XfwfToggleWidget)self)->xfwfToggle.onIcon->attributes.width : 0; + w2 = ((XfwfToggleWidget)self)->xfwfToggle.offIcon ? ((XfwfToggleWidget)self)->xfwfToggle.offIcon->attributes.width : 0; + w = max(w1, w2); + if (w != 0) XtVaSetValues(self, XtNleftMargin, ((XfwfToggleWidget)self)->xfwfLabel.leftMargin + w, NULL); +} +/*ARGSUSED*/static Boolean set_values(old,request,self,args,num_args)Widget old;Widget request;Widget self;ArgList args;Cardinal * num_args; +{ + Boolean redraw = False, compute_margin = False; + Dimension w1, w2, w; + + if (((XfwfToggleWidget)self)->xfwfToggle.onIcon != ((XfwfToggleWidget)old)->xfwfToggle.onIcon) { + create_on_gc(self); + compute_margin = True; + } + if (((XfwfToggleWidget)self)->xfwfToggle.offIcon != ((XfwfToggleWidget)old)->xfwfToggle.offIcon) { + create_off_gc(self); + compute_margin = True; + } + if (((XfwfToggleWidget)self)->xfwfToggle.on != ((XfwfToggleWidget)old)->xfwfToggle.on) { + redraw = True; + } + if (compute_margin) { + /* Compute w = old margin between icons and text */ + w1 = ((XfwfToggleWidget)old)->xfwfToggle.onIcon ? ((XfwfToggleWidget)old)->xfwfToggle.onIcon->attributes.width : 0; + w2 = ((XfwfToggleWidget)old)->xfwfToggle.offIcon ? ((XfwfToggleWidget)old)->xfwfToggle.offIcon->attributes.width : 0; + w = ((XfwfToggleWidget)old)->xfwfLabel.leftMargin - max(w1, w2); + /* Compute new left margin w = w + width of icons */ + w1 = ((XfwfToggleWidget)self)->xfwfToggle.onIcon ? ((XfwfToggleWidget)self)->xfwfToggle.onIcon->attributes.width : 0; + w2 = ((XfwfToggleWidget)self)->xfwfToggle.offIcon ? ((XfwfToggleWidget)self)->xfwfToggle.offIcon->attributes.width : 0; + w = w + max(w1, w2); + if (((XfwfToggleWidget)old)->xfwfLabel.leftMargin != w) { + XtVaSetValues(self, XtNleftMargin, w, NULL); + redraw = False; + } else + redraw = True; + } + return redraw; +} +/*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region region; +{ + Position x, y; + Dimension w, h; + + if (! XtIsRealized(self)) return; + xfwfButtonClassRec.core_class.expose(self, event, region); + ((XfwfToggleWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h); + if (((XfwfToggleWidget)self)->xfwfToggle.on && ((XfwfToggleWidget)self)->xfwfToggle.onIcon) { + y = y + (h - ((XfwfToggleWidget)self)->xfwfToggle.onIcon->attributes.height)/2; + XSetTSOrigin(XtDisplay(self), ((XfwfToggleWidget)self)->xfwfToggle.on_gc, x, y); + XSetClipOrigin(XtDisplay(self), ((XfwfToggleWidget)self)->xfwfToggle.on_gc, x, y); + XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfToggleWidget)self)->xfwfToggle.on_gc, x, y, + ((XfwfToggleWidget)self)->xfwfToggle.onIcon->attributes.width, + ((XfwfToggleWidget)self)->xfwfToggle.onIcon->attributes.height); + } else if (((XfwfToggleWidget)self)->xfwfToggle.offIcon) { + y = y + (h - ((XfwfToggleWidget)self)->xfwfToggle.offIcon->attributes.height)/2; + XSetTSOrigin(XtDisplay(self), ((XfwfToggleWidget)self)->xfwfToggle.off_gc, x, y); + XSetClipOrigin(XtDisplay(self), ((XfwfToggleWidget)self)->xfwfToggle.off_gc, x, y); + XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfToggleWidget)self)->xfwfToggle.off_gc, x, y, + ((XfwfToggleWidget)self)->xfwfToggle.offIcon->attributes.width, + ((XfwfToggleWidget)self)->xfwfToggle.offIcon->attributes.height); + } +} diff --git a/vendor/x11iraf/obm/ObmW/Toggle.h b/vendor/x11iraf/obm/ObmW/Toggle.h new file mode 100644 index 00000000..fc98c56e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Toggle.h @@ -0,0 +1,60 @@ +/* Generated by wbuild from "Toggle.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfToggle_H_ +#define _XfwfToggle_H_ +#include "Button.h" +#ifndef XtNonCallback +#define XtNonCallback "onCallback" +#endif +#ifndef XtCOnCallback +#define XtCOnCallback "OnCallback" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +#ifndef XtNoffCallback +#define XtNoffCallback "offCallback" +#endif +#ifndef XtCOffCallback +#define XtCOffCallback "OffCallback" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + +#ifndef XtNon +#define XtNon "on" +#endif +#ifndef XtCOn +#define XtCOn "On" +#endif +#ifndef XtRBoolean +#define XtRBoolean "Boolean" +#endif + +#ifndef XtNonIcon +#define XtNonIcon "onIcon" +#endif +#ifndef XtCOnIcon +#define XtCOnIcon "OnIcon" +#endif +#ifndef XtRIcon +#define XtRIcon "Icon" +#endif + +#ifndef XtNoffIcon +#define XtNoffIcon "offIcon" +#endif +#ifndef XtCOffIcon +#define XtCOffIcon "OffIcon" +#endif +#ifndef XtRIcon +#define XtRIcon "Icon" +#endif + +typedef struct _XfwfToggleClassRec *XfwfToggleWidgetClass; +typedef struct _XfwfToggleRec *XfwfToggleWidget; +externalref WidgetClass xfwfToggleWidgetClass; +#endif /*_XfwfToggle_H_*/ diff --git a/vendor/x11iraf/obm/ObmW/Toggle.man b/vendor/x11iraf/obm/ObmW/Toggle.man new file mode 100644 index 00000000..fa01d492 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Toggle.man @@ -0,0 +1,538 @@ +.\"remove .ig hn for full docs +.de hi +.ig eh +.. +.de eh +.. +.TH "" 3 "" "Version 3.0" "Free Widget Foundation" +.SH NAME +XfwfToggle +.SH DESCRIPTION +The \fIXfwfToggle\fP is a button that switches states with every activation +(which is by default with every mouse click). The states are named `on' and +`off'. The states can be indicated with a $\surd$ before the label Two +callbacks report the changed state to the application: \fIonCallback\fP is called +when the button switches to `on', \fIoffCallback\fP is called when the button +switches back to `off'. + +.SS "Public variables" + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfToggle +Name Class Type Default +XtNonCallback XtCOnCallback Callback NULL +XtNoffCallback XtCOffCallback Callback NULL +XtNon XtCOn Boolean False +XtNonIcon XtCOnIcon Icon * "filledsquare" +XtNoffIcon XtCOffIcon Icon * "emptysquare" + +.TE +.ps + +.TP +.I "XtNonCallback" +The \fIonCallback\fP is called by the \fItoggle\fP action or by the \fIswitch_on\fP +action, if the previous state was `off'. The \fIcall_data\fP argument will contain +the \fIXEvent\fP pointer that trigerred the action function. + + + +.hi + +.nf +<Callback> XtCallbackList onCallback = NULL +.fi + +.eh + +.TP +.I "XtNoffCallback" +The \fIoffCallback\fP is called from the \fItoggle\fP or \fIswitch_off\fP action, if the +previous state was `on'. The \fIcall_data\fP argument will be a pointer to the +\fIXEvent\fP that caused the action. + + + +.hi + +.nf +<Callback> XtCallbackList offCallback = NULL +.fi + +.eh + +.TP +.I "XtNon" +The variable \fIon\fP records the state of the widget: \fITrue\fP means `on' and +\fIFalse\fP means `off'. + + + +.hi + +.nf +Boolean on = False +.fi + +.eh + +.TP +.I "XtNonIcon" +By default, the button displays a $\surd$ when on and nothing when +off. The two resources \fIonIcon\fP and \fIoffPIcon\fP can replace these +two graphics with arbitrary pixmaps. Suggested size for these pixmaps +is about $16\times18$. + + + +.hi + +.nf +Icon * onIcon = <String>"filledsquare" +.fi + +.eh + +.TP +.I "XtNoffIcon" +The \fIoffIcon\fP is displayed when the button is in `off' state. By +default, nothing is displayed in this state. + + + +.hi + +.nf +Icon * offIcon = <String>"emptysquare" +.fi + +.eh + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfButton +Name Class Type Default +XtNactivate XtCActivate Callback NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfLabel +Name Class Type Default +XtNlabel XtCLabel String NULL +XtNtablist XtCTablist String NULL +XtNfont XtCFont FontStruct XtDefaultFont +XtNforeground XtCForeground Pixel XtDefaultForeground +XtNalignment XtCAlignment Alignment 0 +XtNtopMargin XtCTopMargin Dimension 2 +XtNbottomMargin XtCBottomMargin Dimension 2 +XtNleftMargin XtCLeftMargin Dimension 2 +XtNrightMargin XtCRightMargin Dimension 2 +XtNshrinkToFit XtCShrinkToFit Boolean False +XtNrvStart XtCRvStart Int 0 +XtNrvLength XtCRvLength Int 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfBoard +Name Class Type Default +XtNabs_x XtCAbs_x Position 0 +XtNrel_x XtCRel_x Float "0.0" +XtNabs_y XtCAbs_y Position 0 +XtNrel_y XtCRel_y Float "0.0" +XtNabs_width XtCAbs_width Position 0 +XtNrel_width XtCRel_width Float "1.0" +XtNabs_height XtCAbs_height Position 0 +XtNrel_height XtCRel_height Float "1.0" +XtNhunit XtCHunit Float "1.0" +XtNvunit XtCVunit Float "1.0" +XtNlocation XtCLocation String NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfFrame +Name Class Type Default +XtNcursor XtCCursor Cursor None +XtNframeType XtCFrameType FrameType XfwfRaised +XtNframeWidth XtCFrameWidth Dimension 0 +XtNouterOffset XtCOuterOffset Dimension 0 +XtNinnerOffset XtCInnerOffset Dimension 0 +XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto +XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor +XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor +XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL +XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +XfwfCommon +Name Class Type Default +XtNtraversalOn XtCTraversalOn Boolean True +XtNhighlightThickness XtCHighlightThickness Dimension 2 +XtNhighlightColor XtCHighlightColor Pixel XtDefaultForeground +XtNhighlightPixmap XtCHighlightPixmap Pixmap None +XtNnextTop XtCNextTop Callback NULL +XtNuserData XtCUserData Pointer NULL + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Composite +Name Class Type Default +XtNchildren XtCChildren WidgetList NULL +insertPosition XtCInsertPosition XTOrderProc NULL +numChildren XtCNumChildren Cardinal 0 + +.TE +.ps + +.ps-2 +.TS +center box; +cBsss +lB|lB|lB|lB +l|l|l|l. +Core +Name Class Type Default +XtNx XtCX Position 0 +XtNy XtCY Position 0 +XtNwidth XtCWidth Dimension 0 +XtNheight XtCHeight Dimension 0 +borderWidth XtCBorderWidth Dimension 0 +XtNcolormap XtCColormap Colormap NULL +XtNdepth XtCDepth Int 0 +destroyCallback XtCDestroyCallback XTCallbackList NULL +XtNsensitive XtCSensitive Boolean True +XtNtm XtCTm XTTMRec NULL +ancestorSensitive XtCAncestorSensitive Boolean False +accelerators XtCAccelerators XTTranslations NULL +borderColor XtCBorderColor Pixel 0 +borderPixmap XtCBorderPixmap Pixmap NULL +background XtCBackground Pixel 0 +backgroundPixmap XtCBackgroundPixmap Pixmap NULL +mappedWhenManaged XtCMappedWhenManaged Boolean True +XtNscreen XtCScreen Screen * NULL + +.TE +.ps + +.SS "Translations" + +The \fItoggle\fP action toggles the widget between `on' and `off'. By +default it is bound to a click of the left mouse button as well as to +the Return key. + + + +.nf +<Btn1Down>: set_shadow(sunken) +.fi + +.nf +<Btn1Up>: toggle() set_shadow() +.fi + +.nf +<Key>Return: toggle() +.fi + +.hi +.SS "Actions" + +.TP +.I "toggle + +The \fItoggle\fP action switches the state. Depending on the resources +it might change the tickmark. The \fIonCallback\fP or \fIoffCallback\fP +functions are called, with the event as \fIcall_data\fP argument. + +.hi + +.nf +void toggle($, XEvent* event, String* params, Cardinal* num_params) +{ + XtVaSetValues($, "on", !$on, NULL); + XtCallCallbackList($, $on ? $onCallback : $offCallback, event); +} +.fi + +.eh + +.TP +.I "switch_on + +The \fIswitch_on\fP action switches the button to `on' if it is `off', +otherwise it does nothing. By default it isn't bound to any event. If +the widget is changed, the \fIonCallback\fP is called with the event as +\fIcall_data\fP. + +.hi + +.nf +void switch_on($, XEvent* event, String* params, Cardinal* num_params) +{ + if (! $on) { + XtVaSetValues($, "on", True, NULL); + XtCallCallbackList($, $onCallback, event); + } +} +.fi + +.eh + +.TP +.I "switch_off + +The \fIswitch_off\fP action switches the widget to `off' if the state is +`on', otherwise it does nothing. When the widget changes states, the +\fIoffCallback\fP is called, with a pointer to the \fIXEvent\fP structure as +\fIcall_data\fP argument. + +.hi + +.nf +void switch_off($, XEvent* event, String* params, Cardinal* num_params) +{ + if ($on) { + XtVaSetValues($, "on", False, NULL); + XtCallCallbackList($, $offCallback, event); + } +} +.fi + +.eh + +.hi + +.hi +.SH "Importss" + +The Converters file is needed for the \fIIcon\fP type. + +.nf + +.B incl + <Xfwf/Converters.h> +.fi + +.hi + +.hi +.SS "Private variables" + +The \fIon_gc\fP GC holds the picture of the tick mark for the `on' +state. + + + +.nf +GC on_gc +.fi + +The \fIoff_gc\fP holds the picture for the `off' state. + + + +.nf +GC off_gc +.fi + +The previous value of \fIleftMargin\fP is stored in a private variable. +This value is added to the width of the widest pixmap to give the new +value of \fIleftMargin\fP. + + + +.nf +Dimension saveLeftMargin +.fi + +.hi + +.hi +.SS "Methods" + +The GC's are created for the first time and the left margin is +increased to make room for the on and off icons. + +.nf +initialize(Widget request, $, ArgList args, Cardinal * num_args) +{ + int status; + Dimension w1, w2, w; + + $on_gc = NULL; + $off_gc = NULL; + create_on_gc($); + create_off_gc($); + + w1 = $onIcon ? $onIcon->attributes.width : 0; + w2 = $offIcon ? $offIcon->attributes.width : 0; + w = max(w1, w2); + if (w != 0) XtVaSetValues($, XtNleftMargin, $leftMargin + w, NULL); +} +.fi + +Question: Does the computation of \fIleftMargin\fP have the desired +effect? Since \fIset_values\fP is downward chained, the Label widget has +already processed it; changing \fIleftMargin\fP doesn't cause Label to +recompute the preferred size\dots + +.nf +Boolean set_values(Widget old, Widget request, $, ArgList args, Cardinal * num_args) +{ + Boolean redraw = False, compute_margin = False; + Dimension w1, w2, w; + + if ($onIcon != $old$onIcon) { + create_on_gc($); + compute_margin = True; + } + if ($offIcon != $old$offIcon) { + create_off_gc($); + compute_margin = True; + } + if ($on != $old$on) { + redraw = True; + } + if (compute_margin) { + /* Compute w = old margin between icons and text */ + w1 = $old$onIcon ? $old$onIcon->attributes.width : 0; + w2 = $old$offIcon ? $old$offIcon->attributes.width : 0; + w = $old$leftMargin - max(w1, w2); + /* Compute new left margin w = w + width of icons */ + w1 = $onIcon ? $onIcon->attributes.width : 0; + w2 = $offIcon ? $offIcon->attributes.width : 0; + w = w + max(w1, w2); + if ($old$leftMargin != w) { + XtVaSetValues($, XtNleftMargin, w, NULL); + redraw = False; + } else + redraw = True; + } + return redraw; +} +.fi + +The \fIexpose\fP method uses the \fIexpose\fP method of the superclass to draw the +button and then possibly adds a tick mark. + +.nf +expose($, XEvent * event, Region region) +{ + Position x, y; + Dimension w, h; + + if (! XtIsRealized($)) return; + #expose($, event, region); + $compute_inside($, x, y, w, h); + if ($on $onIcon) { + y = y + (h - $onIcon->attributes.height)/2; + XSetTSOrigin(XtDisplay($), $on_gc, x, y); + XSetClipOrigin(XtDisplay($), $on_gc, x, y); + XFillRectangle(XtDisplay($), XtWindow($), $on_gc, x, y, + $onIcon->attributes.width, + $onIcon->attributes.height); + } else if ($offIcon) { + y = y + (h - $offIcon->attributes.height)/2; + XSetTSOrigin(XtDisplay($), $off_gc, x, y); + XSetClipOrigin(XtDisplay($), $off_gc, x, y); + XFillRectangle(XtDisplay($), XtWindow($), $off_gc, x, y, + $offIcon->attributes.width, + $offIcon->attributes.height); + } +} +.fi + +.hi + +.hi +.SH "Utilities" + +The \fIcreate_on_gc\fP function creates a GC with the \fIonIcon\fP as tile. + +.nf +create_on_gc($) +{ + XtGCMask mask = GCFillStyle; + XGCValues values; + + if ($on_gc != NULL) XtReleaseGC($, $on_gc); + if ($onIcon $onIcon->pixmap != None) { + values.tile = $onIcon->pixmap; + mask |= GCTile; + } + if ($onIcon $onIcon->mask != None) { + values.clip_mask = $onIcon->mask; + mask |= GCClipMask; + } + values.fill_style = FillTiled; + $on_gc = XtGetGC($, mask, values); +} +.fi + +The \fIcreate_off_gc\fP function creates a GC with the \fIoffIcon\fP as tile. + +.nf +create_off_gc($) +{ + XtGCMask mask = GCFillStyle; + XGCValues values; + + if ($off_gc != NULL) XtReleaseGC($, $off_gc); + if ($offIcon $offIcon->pixmap != None) { + values.tile = $offIcon->pixmap; + mask |= GCTile; + } + if ($offIcon $offIcon->mask != None) { + values.clip_mask = $offIcon->mask; + mask |= GCClipMask; + } + values.fill_style = FillTiled; + $off_gc = XtGetGC($, mask, values); +} +.fi + +.hi diff --git a/vendor/x11iraf/obm/ObmW/ToggleP.h b/vendor/x11iraf/obm/ObmW/ToggleP.h new file mode 100644 index 00000000..20eb26b4 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/ToggleP.h @@ -0,0 +1,50 @@ +/* Generated by wbuild from "Toggle.w" +** (generator version $Revision: 2.0 $ of $Date: 93/07/06 16:08:04 $) +*/ +#ifndef _XfwfToggleP_H_ +#define _XfwfToggleP_H_ +#include "ButtonP.h" +#include "Toggle.h" +typedef struct { +/* methods */ +/* class variables */ +int dummy; +} XfwfToggleClassPart; +typedef struct _XfwfToggleClassRec { +CoreClassPart core_class; +CompositeClassPart composite_class; +XfwfCommonClassPart xfwfCommon_class; +XfwfFrameClassPart xfwfFrame_class; +XfwfBoardClassPart xfwfBoard_class; +XfwfLabelClassPart xfwfLabel_class; +XfwfButtonClassPart xfwfButton_class; +XfwfToggleClassPart xfwfToggle_class; +} XfwfToggleClassRec; + +typedef struct { +/* resources */ +XtCallbackList onCallback; +XtCallbackList offCallback; +Boolean on; +Icon * onIcon; +Icon * offIcon; +/* private state */ +GC on_gc; +GC off_gc; +Dimension saveLeftMargin; +} XfwfTogglePart; + +typedef struct _XfwfToggleRec { +CorePart core; +CompositePart composite; +XfwfCommonPart xfwfCommon; +XfwfFramePart xfwfFrame; +XfwfBoardPart xfwfBoard; +XfwfLabelPart xfwfLabel; +XfwfButtonPart xfwfButton; +XfwfTogglePart xfwfToggle; +} XfwfToggleRec; + +externalref XfwfToggleClassRec xfwfToggleClassRec; + +#endif /* _XfwfToggleP_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/3d.h b/vendor/x11iraf/obm/ObmW/Xraw/3d.h new file mode 100644 index 00000000..8d09dddf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/3d.h @@ -0,0 +1,145 @@ +#ifndef _3d_h_ +#define _3d_h_ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xraw/XawInit.h> + +typedef enum { + XawRAISED = Xraw_3d, + XawSUNKEN, + XawCHISELED, + XawLEDGED, + XawTACK +} XawFrameType; + +#define TOP (1) +#define BOTTOM (2) + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean TopShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean ArmedColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); + + +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + + +extern Pixmap CreateShadowPixmap Xraw_PROTO((Widget , + Pixel , + int )); + + +extern Boolean AllocShadowPixel Xraw_PROTO((Widget , + Pixel , + int , + Pixel * )); + + +extern GC MakeGC Xraw_PROTO((Widget , + Pixel , + int , + Boolean , + int )); + + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern void XawDrawFrame Xraw_PROTO((Widget , + Position , + Position , + Dimension , + Dimension , + XawFrameType , + Dimension , + GC , + GC )); + + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean TopShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean ArmedColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern void DrawRhombus Xraw_PROTO((Widget , + short , + short , + short , + short , + GC , + GC , + GC , + Boolean )); + +extern Boolean FetchPixel Xraw_PROTO((Widget , + String name , + Pixel* )); + +#endif /* _3d_h_ */ + + + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AllWidgets.h b/vendor/x11iraf/obm/ObmW/Xraw/AllWidgets.h new file mode 100644 index 00000000..cded7fcb --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AllWidgets.h @@ -0,0 +1,33 @@ +/* + * $XConsortium: AllWidgets.h,v 1.2 90/02/26 12:00:56 jim Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _XawAllWidgets_h +#define _XawAllWidgets_h + +/* + * This file matches the generated AllWidgets.c + */ +extern XmuWidgetNode XawWidgetArray[]; +extern int XawWidgetCount; + +#endif /* _XawAllWidgets_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Arrow.h b/vendor/x11iraf/obm/ObmW/Xraw/Arrow.h new file mode 100644 index 00000000..bcc7c113 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Arrow.h @@ -0,0 +1,144 @@ +#ifndef _XawArrow_h +#define _XawArrow_h + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback XtCallbackList NULL + direction Direction XawDirection XawTop + foreground Foreground Pixel XtDefaultBackground + height Height Dimension text height + insensitiveBorder Insensitive Pixmap Gray + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + sensitive Sensitive Boolean True + shadowWidht ShadowWidht Dimension 2 + width Width Dimension 8 + x Position Position 0 + y Position Position 0 + +*/ + +typedef enum { + XawLeft, + XawRight, + XawTop, + XawBottom +}XawDirection; + + +/* new instance and class names */ +#ifndef XtNdirection +#define XtNdirection "direction" +#endif + +#ifndef XtCDirection +#define XtCDirection "Direction" +#endif + +#ifndef XtRDirection +#define XtRDirection "Direction" +#endif + +#ifndef XtNforeground +#define XtNforeground "foreground" +#endif +#ifndef XtCForeground +#define XtCForeground "Foreground" +#endif + +#ifndef XtRPixel +#define XtRPixel "Pixel" +#endif + +#ifndef XtNarrowShadow +#define XtNarrowShadow "arrowShadow" +#endif +#ifndef XtCArrowShadow +#define XtCArrowShadow "ArrowShadow" +#endif +#ifndef XtRDimension +#define XtRDimension "Dimension" +#endif + +#ifndef XtNinitialDelay +#define XtNinitialDelay "initialDelay" +#endif +#ifndef XtCInitialDelay +#define XtCInitialDelay "InitialDelay" +#endif +#ifndef XtRCardinal +#define XtRCardinal "Cardinal" +#endif + +#ifndef XtNrepeatDelay +#define XtNrepeatDelay "repeatDelay" +#endif +#ifndef XtCRepeatDelay +#define XtCRepeatDelay "RepeatDelay" +#endif +#ifndef XtRCardinal +#define XtRCardinal "Cardinal" +#endif + +#ifndef XtNcallback +#define XtNcallback "callback" +#endif +#ifndef XtCCallback +#define XtCCallback "Callback" +#endif +#ifndef XtRCallback +#define XtRCallback "Callback" +#endif + /* external declarations */ + +typedef struct { + XawDirection direction; + XPoint p1[3]; + XPoint p2[4]; + XPoint p3[4]; + XPoint p4[4]; + int a; + int a2; + int a3; +}XawDrawArrowStruct; + +extern void XawMakeDrawArrowStruct( +#if NeedFunctionPrototypes + int /* x */, + int /* y */, + unsigned int /* w */, + unsigned int /* h */, + unsigned int /* thickness */, + XawDirection /* direction */, + XawDrawArrowStruct * /* result */ +#endif +); + +extern void XawDrawArrow( +#if NeedFunctionPrototypes + Widget /* w */, + GC /* inner */, + GC /* top */, + GC /* bottom */, + XawDrawArrowStruct * /* draw struct */ +#endif +); + +extern WidgetClass arrowWidgetClass; + +typedef struct _ArrowClassRec *ArrowWidgetClass; +typedef struct _ArrowRec *ArrowWidget; + + +#endif /* _XawArrow_h */ + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ArrowP.h b/vendor/x11iraf/obm/ObmW/Xraw/ArrowP.h new file mode 100644 index 00000000..818e70bf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ArrowP.h @@ -0,0 +1,45 @@ +#ifndef _XawArrowP_h +#define _XawArrowP_h + +#include <X11/Xraw/RepeaterP.h> +#include <X11/Xraw/Arrow.h> + +#define ARROW(w) ((ArrowWidget) w)->arrow + +typedef struct {/* new fields in widget class */ + int dummy; +} ArrowClassPart; + +typedef struct _ArrowClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; + CommandClassPart command_class; + RepeaterClassPart repeater_class; + ArrowClassPart arrow_class; +} ArrowClassRec; + +typedef struct { + /* resources */ + Dimension arrowShadow; + XawDrawArrowStruct outline; + /* private state */ + GC arrowgc; + Boolean set_a2_a3; +} ArrowPart; + +typedef struct _ArrowRec { + CorePart core; + SimplePart simple; + LabelPart label; + CommandPart command; + RepeaterPart repeater; + ArrowPart arrow; +} ArrowRec; + +/* + * external declarations + */ +extern ArrowClassRec arrowClassRec; + +#endif /* _XawArrowP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AsciiSink.h b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSink.h new file mode 100644 index 00000000..1319da43 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSink.h @@ -0,0 +1,87 @@ +/* + * $XConsortium: AsciiSink.h,v 1.4 90/01/10 16:48:48 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawAsciiSink_h +#define _XawAsciiSink_h + +/*********************************************************************** + * + * AsciiSink Object + * + ***********************************************************************/ + +#include <X11/Xraw/TextSink.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + echo Output Boolean True + displayNonprinting Output Boolean True + +*/ + +#define XtCOutput "Output" + +#define XtNdisplayNonprinting "displayNonprinting" +#define XtNecho "echo" + +/* Class record constants */ + +extern WidgetClass asciiSinkObjectClass; + +typedef struct _AsciiSinkClassRec *AsciiSinkObjectClass; +typedef struct _AsciiSinkRec *AsciiSinkObject; + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +#ifdef XAW_BC +/************************************************************ + * For Compatability Only. */ + +#define XtAsciiSinkCreate XawAsciiSinkCreate +#define XtAsciiSinkDestroy XawAsciiSinkDestroy + +#define XawTextSink Widget +#define XtTextSink XawTextSink + +extern XawTextSink XawAsciiSinkCreate(); /* parent, args, num_args */ + /* Widget parent; */ + /* ArgList args; */ + /* Cardinal num_args; */ + +#define XawAsciiSinkDestroy XtDestroyWidget + +#endif /* XAW_BC */ + +#endif /* _XawAsciiSrc_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AsciiSinkP.h b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSinkP.h new file mode 100644 index 00000000..11b91adf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSinkP.h @@ -0,0 +1,93 @@ +/* +* $XConsortium: AsciiSinkP.h,v 1.2 89/10/04 13:56:34 kit Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * asciiSinkP.h - Private definitions for asciiSink object + * + */ + +#ifndef _XawAsciiSinkP_h +#define _XawAsciiSinkP_h + +/*********************************************************************** + * + * AsciiSink Object Private Data + * + ***********************************************************************/ + +#include <X11/Xraw/TextSinkP.h> +#include <X11/Xraw/AsciiSink.h> + +/************************************************************ + * + * New fields for the AsciiSink object class record. + * + ************************************************************/ + +typedef struct _AsciiSinkClassPart { + int foo; +} AsciiSinkClassPart; + +/* Full class record declaration */ + +typedef struct _AsciiSinkClassRec { + ObjectClassPart object_class; + TextSinkClassPart text_sink_class; + AsciiSinkClassPart ascii_sink_class; +} AsciiSinkClassRec; + +extern AsciiSinkClassRec asciiSinkClassRec; + +/* New fields for the AsciiSink object record */ +typedef struct { + /* public resources */ + Boolean echo; + Boolean display_nonprinting; + + /* private state */ + GC normgc, invgc, xorgc; + Pixmap insertCursorOn; + XawTextInsertState laststate; + short cursor_x, cursor_y; /* Cursor Location. */ +} AsciiSinkPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _AsciiSinkRec { + ObjectPart object; + TextSinkPart text_sink; + AsciiSinkPart ascii_sink; +} AsciiSinkRec; + +#endif /* _XawAsciiSinkP_h */ + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AsciiSrc.h b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSrc.h new file mode 100644 index 00000000..8021a53e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSrc.h @@ -0,0 +1,190 @@ +/* + * $XConsortium: AsciiSrc.h,v 1.5 89/10/05 13:17:30 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + */ + + +/* + * AsciiSrc.h - Public Header file for Ascii Text Source. + * + * This is the public header file for the Ascii Text Source. + * It is intended to be used with the Text widget, the simplest way to use + * this text source is to use the AsciiText Object. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + + +#ifndef _XawAsciiSrc_h +#define _XawAsciiSrc_h + +#include <X11/Xraw/TextSrc.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + + +*/ + +/* Class record constants */ + +extern WidgetClass asciiSrcObjectClass; + +typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass; +typedef struct _AsciiSrcRec *AsciiSrcObject; + +/* + * Just to make people's lives a bit easier. + */ + +#define AsciiSourceObjectClass AsciiSrcObjectClass +#define AsciiSourceObject AsciiSrcObject + +/* + * Resource Definitions. + */ + +#define XtCDataCompression "DataCompression" +#define XtCPieceSize "PieceSize" +#define XtCType "Type" +#define XtCUseStringInPlace "UseStringInPlace" + +#define XtNdataCompression "dataCompression" +#define XtNpieceSize "pieceSize" +#define XtNtype "type" +#define XtNuseStringInPlace "useStringInPlace" + +#define XtRAsciiType "AsciiType" + +#define XtEstring "string" +#define XtEfile "file" + +typedef enum {XawAsciiFile, XawAsciiString} XawAsciiType; + +/************************************************************ + * + * Public routines + * + ************************************************************/ + +/* Function Name: XawAsciiSourceFreeString + * Description: Frees the string returned by a get values call + * on the string when the source is of type string. + * Arguments: w - the AsciiSrc object. + * Returns: none. + */ + +void XawAsciiSourceFreeString(/* w */); +/* +Widget w; +*/ + +/* Function Name: XawAsciiSave + * Description: Saves all the pieces into a file or string as required. + * Arguments: w - the asciiSrc Object. + * Returns: TRUE if the save was successful. + */ + +Boolean XawAsciiSave(/* w */); +/* +Widget w; +*/ + +/* Function Name: XawAsciiSaveAsFile + * Description: Save the current buffer as a file. + * Arguments: w - the asciiSrc object. + * name - name of the file to save this file into. + * Returns: True if the save was sucessful. + */ + +Boolean XawAsciiSaveAsFile(/* w, name */); +/* +Widget w; +String name; +*/ + +/* Function Name: XawAsciiSourceChanged + * Description: Returns true if the source has changed since last saved. + * Arguments: w - the asciiSource object. + * Returns: a Boolean (see description). + */ + +Boolean XawAsciiSourceChanged(/* w */); +/* +Widget w; +*/ + +#ifdef XAW_BC +/************************************************************* + * + * These functions are only preserved for compatability. + */ + +#define ASCII_STRING /* Turn on R3 AsciiDisk and AsciiString */ +#define ASCII_DISK /* Emulation modes. */ + +#ifdef ASCII_STRING +#define XawStringSourceDestroy XtDestroyWidget +#endif + +#ifdef ASCII_DISK +#define XawDiskSourceDestroy XtDestroyWidget +#endif + +#ifdef ASCII_STRING +/* Function Name: AsciiStringSourceCreate + * Description: Creates a string source. + * Arguments: parent - the widget that will own this source. + * args, num_args - the argument list. + * Returns: a pointer to the new text source. + */ + +Widget XawStringSourceCreate(/* parent, args, num_args */); +/* +Widget parent; +ArgList args; +Cardinal num_args; +*/ +#endif /* ASCII_STRING */ + +#ifdef ASCII_DISK +/* Function Name: AsciiDiskSourceCreate + * Description: Creates a disk source. + * Arguments: parent - the widget that will own this source. + * args, num_args - the argument list. + * Returns: a pointer to the new text source. + */ + +Widget XawDiskSourceCreate(/* parent, args, num_args */); +/* +Widget parent; +ArgList args; +Cardinal num_args; +*/ +#endif /* ASCII_DISK */ +#endif /* XAW_BC */ +/* + * End of Compatability stuff. + * + ***************************************************/ + +#endif /* _XawAsciiSrc_h - Don't add anything after this line. */ + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AsciiSrcP.h b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSrcP.h new file mode 100644 index 00000000..f2ca6a22 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AsciiSrcP.h @@ -0,0 +1,133 @@ +/* +* $XConsortium: AsciiSrcP.h,v 1.6 89/10/05 13:17:39 kit Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * AsciiSrcP.h - Private Header for Ascii Text Source. + * + * This is the private header file for the Ascii Text Source. + * It is intended to be used with the Text widget, the simplest way to use + * this text source is to use the AsciiText Object. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +/* + * TextSrcP.h - Private definitions for AsciiSrc object + * + */ + +#ifndef _XawAsciiSrcP_h +#define _XawAsciiSrcP_h + +#include <X11/Xraw/AsciiSrc.h> +#include <X11/Xraw/TextSrcP.h> + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#define TMPSIZ 32 /* bytes to allocate for tmpnam */ + +#define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */ + +typedef struct _Piece { /* Piece of the text file of BUFSIZ allocated + characters. */ + char * text; /* The text in this buffer. */ + XawTextPosition used; /* The number of characters of this buffer + that have been used. */ + struct _Piece *prev, *next; /* linked list pointers. */ +} Piece; + +/************************************************************ + * + * New fields for the AsciiSrc object class record. + * + ************************************************************/ + +typedef struct _AsciiSrcClassPart { char foo; } AsciiSrcClassPart; + +/* Full class record declaration */ +typedef struct _AsciiSrcClassRec { + ObjectClassPart object_class; + TextSrcClassPart text_src_class; + AsciiSrcClassPart ascii_src_class; +} AsciiSrcClassRec; + +extern AsciiSrcClassRec asciiSrcClassRec; + +/* New fields for the AsciiSrc object record */ + +typedef struct _AsciiSrcPart { + + /* Resources. */ + + char *string; /* either the string, or the + file name, depending upon the type. */ + XawAsciiType type; /* either string or disk. */ + XawTextPosition piece_size; /* Size of text buffer for each piece. */ + Boolean data_compression; /* compress to minimum memory automatically + on save? */ + XtCallbackList callback; /* A callback list to call when the source is + changed. */ + Boolean use_string_in_place; /* Use the string passed in place. */ + int ascii_length; /* length field for ascii string emulation. */ + +#ifdef ASCII_DISK + String filename; /* name of file for Compatability. */ +#endif /* ASCII_DISK */ + +/* Private data. */ + + Boolean is_tempfile; /* Is this a temporary file? */ + Boolean changes; /* Has this file been edited? */ + Boolean allocated_string; /* Have I allocated the + string in ascii_src->string? */ + XawTextPosition length; /* length of file */ + Piece * first_piece; /* first piece of the text. */ +} AsciiSrcPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _AsciiSrcRec { + ObjectPart object; + TextSrcPart text_src; + AsciiSrcPart ascii_src; +} AsciiSrcRec; + +#endif /* _XawAsciiSrcP_h --- Don't add anything after this line. */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AsciiText.h b/vendor/x11iraf/obm/ObmW/Xraw/AsciiText.h new file mode 100644 index 00000000..db543c0a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AsciiText.h @@ -0,0 +1,110 @@ +/* + * $XConsortium: AsciiText.h,v 1.15 89/07/06 16:00:35 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/*********************************************************************** + * + * AsciiText Widget + * + ***********************************************************************/ + +/* + * AsciiText.c - Public header file for AsciiText Widget. + * + * This Widget is intended to be used as a simple front end to the + * text widget with an ascii source and ascii sink attached to it. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _AsciiText_h +#define _AsciiText_h + +/**************************************************************** + * + * AsciiText widgets + * + ****************************************************************/ + +#include <X11/Xraw/Text.h> /* AsciiText is a subclass of Text */ +#include <X11/Xraw/AsciiSrc.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + displayPosition TextPosition int 0 + editType EditType XawTextEditType XawtextRead + font Font XFontStruct* Fixed + foreground Foreground Pixel Black + height Height Dimension font height + insertPosition TextPosition int 0 + leftMargin Margin Dimension 2 + mappedWhenManaged MappedWhenManaged Boolean True + selectTypes SelectTypes Pointer (internal) + selection Selection Pointer empty selection + sensitive Sensitive Boolean True + string String String NULL + textOptions TextOptions int 0 + width Width Dimension 100 + x Position Position 0 + y Position Position 0 + +*/ + +/* + * Everything else we need is in StringDefs.h or Text.h + */ + +typedef struct _AsciiTextClassRec *AsciiTextWidgetClass; +typedef struct _AsciiRec *AsciiWidget; + +extern WidgetClass asciiTextWidgetClass; + +/************************************************************ + * + * Disk and String Emulation Info. + * + ************************************************************/ + +#ifdef ASCII_STRING +extern WidgetClass asciiStringWidgetClass; +#endif + +#ifdef ASCII_DISK +extern WidgetClass asciiDiskWidgetClass; +#endif + +#endif /* _AsciiText_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/AsciiTextP.h b/vendor/x11iraf/obm/ObmW/Xraw/AsciiTextP.h new file mode 100644 index 00000000..0391b597 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/AsciiTextP.h @@ -0,0 +1,138 @@ +/* + * $XConsortium: AsciiTextP.h,v 1.15 89/07/17 18:09:37 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/*********************************************************************** + * + * AsciiText Widget + * + ***********************************************************************/ + +/* + * AsciiText.c - Private header file for AsciiText Widget. + * + * This Widget is intended to be used as a simple front end to the + * text widget with an ascii source and ascii sink attached to it. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _AsciiTextP_h +#define _AsciiTextP_h + +#include <X11/Xraw/TextP.h> +#include <X11/Xraw/AsciiSrc.h> /* no need to get private header. */ +#include <X11/Xraw/AsciiText.h> + +typedef struct {int empty;} AsciiClassPart; + +typedef struct _AsciiTextClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; + AsciiClassPart ascii_class; +} AsciiTextClassRec; + +extern AsciiTextClassRec asciiTextClassRec; + +typedef struct { char foo; /* keep compiler happy. */ } AsciiPart; + +typedef struct _AsciiRec { + CorePart core; + SimplePart simple; + TextPart text; + AsciiPart ascii; +} AsciiRec; + +/************************************************************ + * + * Ascii String Emulation widget. + * + ************************************************************/ + +#ifdef ASCII_STRING + +typedef struct {int empty;} AsciiStringClassPart; + +typedef struct _AsciiStringClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; + AsciiClassPart ascii_class; + AsciiStringClassPart string_class; +} AsciiStringClassRec; + +extern AsciiStringClassRec asciiStringClassRec; + +typedef struct { char foo; /* keep compiler happy. */ } AsciiStringPart; + +typedef struct _AsciiStringRec { + CorePart core; + SimplePart simple; + TextPart text; + AsciiPart ascii; + AsciiStringPart ascii_str; +} AsciiStringRec; + +#endif /* ASCII_STRING */ + +#ifdef ASCII_DISK + +/************************************************************ + * + * Ascii Disk Emulation widget. + * + ************************************************************/ + +typedef struct {int empty;} AsciiDiskClassPart; + +typedef struct _AsciiDiskClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; + AsciiClassPart ascii_class; + AsciiDiskClassPart disk_class; +} AsciiDiskClassRec; + +extern AsciiDiskClassRec asciiDiskClassRec; + +typedef struct { char foo; /* keep compiler happy. */ } AsciiDiskPart; + +typedef struct _AsciiDiskRec { + CorePart core; + SimplePart simple; + TextPart text; + AsciiPart ascii; + AsciiDiskPart ascii_disk; +} AsciiDiskRec; +#endif /* ASCII_DISK */ + +#endif /* _AsciiTextP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Box.h b/vendor/x11iraf/obm/ObmW/Xraw/Box.h new file mode 100644 index 00000000..ea75e305 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Box.h @@ -0,0 +1,74 @@ +/* +* $XConsortium: Box.h,v 1.21 91/05/04 18:58:58 rws Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawBox_h +#define _XawBox_h + +#include <X11/Xmu/Converters.h> + +/*********************************************************************** + * + * Box Widget (subclass of CompositeClass) + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + orientation Orientation XtOrientation vertical + vSpace VSpace Dimension 4 + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/* New fields */ +#ifndef _XtStringDefs_h_ +#define XtNhSpace "hSpace" +#define XtNvSpace "vSpace" +#endif + +/* Class record constants */ + +extern WidgetClass boxWidgetClass; + +typedef struct _BoxClassRec *BoxWidgetClass; +typedef struct _BoxRec *BoxWidget; + +#endif /* _XawBox_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/BoxP.h b/vendor/x11iraf/obm/ObmW/Xraw/BoxP.h new file mode 100644 index 00000000..fb92b873 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/BoxP.h @@ -0,0 +1,90 @@ +/* +* $XConsortium: BoxP.h,v 1.16 89/11/06 10:51:28 swick Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * BoxP.h - Private definitions for Box widget + * + */ + +#ifndef _XawBoxP_h +#define _XawBoxP_h + +/*********************************************************************** + * + * Box Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xraw/Box.h> +#include <X11/CompositeP.h> +#include <X11/Xraw/ContainerP.h> +#include <X11/Xmu/Converters.h> + +/* New fields for the Box widget class record */ +typedef struct {int empty;} BoxClassPart; + +/* Full class record declaration */ +typedef struct _BoxClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + BoxClassPart box_class; +} BoxClassRec; + +extern BoxClassRec boxClassRec; + +/* New fields for the Box widget record */ +typedef struct { + /* resources */ + Dimension h_space, v_space; + XtOrientation orientation; + + /* private state */ + Dimension preferred_width, preferred_height; + Dimension last_query_width, last_query_height; + XtGeometryMask last_query_mode; +} BoxPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _BoxRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + BoxPart box; +} BoxRec; + +#endif /* _XawBoxP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Cardinals.h b/vendor/x11iraf/obm/ObmW/Xraw/Cardinals.h new file mode 100644 index 00000000..f7e5f120 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Cardinals.h @@ -0,0 +1,35 @@ +/* $XConsortium: Cardinals.h,v 1.5 89/03/30 16:05:19 jim Exp $ */ +/* + +Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. +M.I.T. makes no representations about the suitability of +this software for any purpose. It is provided "as is" +without express or implied warranty. + +*/ + +#ifndef _Cardinals_h +#define _Cardinals_h + +#define ZERO ((Cardinal)0) +#define ONE ((Cardinal)1) +#define TWO ((Cardinal)2) +#define THREE ((Cardinal)3) +#define FOUR ((Cardinal)4) +#define FIVE ((Cardinal)5) +#define SIX ((Cardinal)6) +#define SEVEN ((Cardinal)7) +#define EIGHT ((Cardinal)8) +#define NINE ((Cardinal)9) +#define TEN ((Cardinal)10) + +#endif /* _Cardinals_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Clock.h b/vendor/x11iraf/obm/ObmW/Xraw/Clock.h new file mode 100644 index 00000000..d8ef8361 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Clock.h @@ -0,0 +1,87 @@ +/* +* $XConsortium: Clock.h,v 1.29 90/10/22 14:43:12 converse Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawClock_h +#define _XawClock_h + +/*********************************************************************** + * + * Clock Widget + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + analog Boolean Boolean True + background Background Pixel white + backingStore BackingStore BackingStore default + border BorderColor Pixel Black + borderWidth BorderWidth Dimension 1 + chime Boolean Boolean False + destroyCallback Callback Pointer NULL + font Font XFontStruct* fixed + foreground Foreground Pixel black + hand Foreground Pixel black + height Height Dimension 164 + highlight Foreground Pixel black + mappedWhenManaged MappedWhenManaged Boolean True + padding Margin int 8 + update Interval int 60 (seconds) + width Width Dimension 164 + x Position Position 0 + y Position Position 0 + +*/ + +/* Resource names used to the clock widget */ + + /* color of hands */ +#define XtNhand "hands" + + + /* Boolean: digital if FALSE */ +#define XtNanalog "analog" + + /* Boolean: */ +#define XtNchime "chime" + + /* Int: amount of space around outside of clock */ +#define XtNpadding "padding" + +typedef struct _ClockRec *ClockWidget; /* completely defined in ClockPrivate.h */ +typedef struct _ClockClassRec *ClockWidgetClass; /* completely defined in ClockPrivate.h */ + +extern WidgetClass clockWidgetClass; + +#endif /* _XawClock_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ClockP.h b/vendor/x11iraf/obm/ObmW/Xraw/ClockP.h new file mode 100644 index 00000000..4f7ac8c3 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ClockP.h @@ -0,0 +1,95 @@ +/* +* $XConsortium: ClockP.h,v 1.21 90/10/22 14:43:22 converse Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawClockP_h +#define _XawClockP_h + +#include <X11/Xos.h> /* Needed for struct tm. */ +#include <X11/Xraw/Clock.h> +#include <X11/Xraw/SimpleP.h> + +#define SEG_BUFF_SIZE 128 +#define ASCII_TIME_BUFLEN 32 /* big enough for 26 plus slop */ + +/* New fields for the clock widget instance record */ +typedef struct { + Pixel fgpixel; /* color index for text */ + Pixel Hipixel; /* color index for Highlighting */ + Pixel Hdpixel; /* color index for hands */ + XFontStruct *font; /* font for text */ + GC myGC; /* pointer to GraphicsContext */ + GC EraseGC; /* eraser GC */ + GC HandGC; /* Hand GC */ + GC HighGC; /* Highlighting GC */ +/* start of graph stuff */ + int update; /* update frequence */ + Dimension radius; /* radius factor */ + int backing_store; /* backing store type */ + Boolean chime; + Boolean beeped; + Boolean analog; + Boolean show_second_hand; + Dimension second_hand_length; + Dimension minute_hand_length; + Dimension hour_hand_length; + Dimension hand_width; + Dimension second_hand_width; + Position centerX; + Position centerY; + int numseg; + int padding; + XPoint segbuff[SEG_BUFF_SIZE]; + XPoint *segbuffptr; + XPoint *hour, *sec; + struct tm otm ; + XtIntervalId interval_id; + char prev_time_string[ASCII_TIME_BUFLEN]; + } ClockPart; + +/* Full instance record declaration */ +typedef struct _ClockRec { + CorePart core; + SimplePart simple; + ClockPart clock; + } ClockRec; + +/* New fields for the Clock widget class record */ +typedef struct {int dummy;} ClockClassPart; + +/* Full class record declaration. */ +typedef struct _ClockClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ClockClassPart clock_class; + } ClockClassRec; + +/* Class pointer. */ +extern ClockClassRec clockClassRec; + +#endif /* _XawClockP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Command.h b/vendor/x11iraf/obm/ObmW/Xraw/Command.h new file mode 100644 index 00000000..da7c2274 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Command.h @@ -0,0 +1,104 @@ +/* $XConsortium: Command.h,v 1.27 91/07/28 18:51:35 converse Exp $ */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawCommand_h +#define _XawCommand_h + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Label.h> + +/* Command widget resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + accelerators Accelerators AcceleratorTable NULL + ancestorSensitive AncestorSensitive Boolean True + background Background Pixel XtDefaultBackground + backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap + bitmap Pixmap Pixmap None + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderWidth BorderWidth Dimension 1 + callback Callback XtCallbackList NULL + colormap Colormap Colormap parent's colormap + cornerRoundPercent CornerRoundPercent Dimension 25 + cursor Cursor Cursor None + cursorName Cursor String NULL + depth Depth int parent's depth + destroyCallback Callback XtCallbackList NULL + encoding Encoding UnsignedChar XawTextEncoding8bit + font Font XFontStruct* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + highlightThickness Thickness Dimension 0 if shaped, else 2 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + leftBitmap LeftBitmap Pixmap None + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + resize Resize Boolean True + screen Screen Screen parent's Screen + sensitive Sensitive Boolean True + shapeStyle ShapeStyle ShapeStyle Rectangle + translations Translations TranslationTable see doc or source + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNhighlightThickness "highlightThickness" + + +#define XtNarmedColor "armedColor" +#define XtCArmedColor "ArmedColor" + +#define XtNshapeStyle "shapeStyle" +#define XtCShapeStyle "ShapeStyle" +#define XtRShapeStyle "ShapeStyle" +#define XtNcornerRoundPercent "cornerRoundPercent" +#define XtCCornerRoundPercent "CornerRoundPercent" + +#define XawShapeRectangle XmuShapeRectangle +#define XawShapeOval XmuShapeOval +#define XawShapeEllipse XmuShapeEllipse +#define XawShapeRoundedRectangle XmuShapeRoundedRectangle + + +extern void XawSetCommandColours Xraw_PROTO((Widget /* self */, + Pixel /* background */)); + +extern WidgetClass commandWidgetClass; + +typedef struct _CommandClassRec *CommandWidgetClass; +typedef struct _CommandRec *CommandWidget; + +#endif /* _XawCommand_h */ +/* DON'T ADD STUFF AFTER THIS */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/CommandP.h b/vendor/x11iraf/obm/ObmW/Xraw/CommandP.h new file mode 100644 index 00000000..e41cae41 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/CommandP.h @@ -0,0 +1,121 @@ +/* +* $XConsortium: CommandP.h,v 1.30 90/12/01 13:00:10 rws Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * CommandP.h - Private definitions for Command widget + * + */ + +#ifndef _XawCommandP_h +#define _XawCommandP_h + +#include <X11/Xraw/Command.h> +#include <X11/Xraw/LabelP.h> + +/*********************************************************************** + * + * Command Widget Private Data + * + ***********************************************************************/ + +typedef enum { + HighlightNone, /* Do not highlight. */ + HighlightWhenUnset, /* Highlight only when unset, this is + to preserve current command widget + functionality. */ + HighlightAlways /* Always highlight, lets the toggle widget + and other subclasses do the right thing. */ +} XtCommandHighlight; + +/************************************ + * + * Class structure + * + ***********************************/ + + + /* New fields for the Command widget class record */ +typedef struct _CommandClass + { + int makes_compiler_happy; /* not used */ + } CommandClassPart; + + /* Full class record declaration */ +typedef struct _CommandClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; + CommandClassPart command_class; +} CommandClassRec; + +extern CommandClassRec commandClassRec; + +/*************************************** + * + * Instance (widget) structure + * + **************************************/ + + /* New fields for the Command widget record */ +typedef struct { + /* resources */ + Dimension highlight_thickness; + XtCallbackList callbacks; + Pixel armed; + + /* private state */ + Pixmap gray_pixmap; + GC normal_GC; + GC inverse_GC; + GC armed_GC; + GC shift_GC; /* used for shifted left bitmat */ + Boolean set; + XtCommandHighlight highlighted; + /* more resources */ + int shape_style; + Dimension corner_round; + Boolean changed_highlight; + Boolean changed_set; +} CommandPart; + + +/* XtEventsPtr eventTable;*/ + + + /* Full widget declaration */ +typedef struct _CommandRec { + CorePart core; + SimplePart simple; + LabelPart label; + CommandPart command; +} CommandRec; + +#endif /* _XawCommandP_h */ + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Container.h b/vendor/x11iraf/obm/ObmW/Xraw/Container.h new file mode 100644 index 00000000..a6164a9d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Container.h @@ -0,0 +1,61 @@ +#ifndef _XawContainer_h +#define _XawContainer_h + + +#include <X11/Xraw/XawInit.h> + +/*********************************************************************** + * + * Container Widget (subclass of CompositeClass) + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/* New fields */ +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNuserData "userData" +#define XtCUserData "UserData" +#define XtNcontainerType "containerType" +#define XtCContainerType "ContainerType" +#define XtRContainerType "ContainerType" + +/* Class record constants */ + +extern WidgetClass containerWidgetClass; + +typedef struct _ContainerClassRec *ContainerWidgetClass; +typedef struct _ContainerRec *ContainerWidget; + +#endif /* _XawContainer_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ContainerP.h b/vendor/x11iraf/obm/ObmW/Xraw/ContainerP.h new file mode 100644 index 00000000..25097a74 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ContainerP.h @@ -0,0 +1,71 @@ +#ifndef _CONTEINER_P_H_ +#define _CONTEINER_P_H_ + + +#include <X11/ConstrainP.h> +#include <X11/Xraw/Container.h> + +#define CORE(w) ((Widget)(w))->core +#define COMPOSITE(w) ((CompositeWidget)(w))->composite +#define CONTAINER(w) ((ContainerWidget)(w))->container + +typedef struct { + + /* public instance variables */ + + Pixel foreground; + + Pixel top_shadow_color; + Pixmap top_shadow_pixmap; + Pixel bottom_shadow_color; + Pixmap bottom_shadow_pixmap; + + Dimension shadow_thickness; + + XtPointer user_data; + + /* private instance variables */ + + GC bottom_shadow_GC; + GC top_shadow_GC; + GC background_GC; + +} ContainerPart; + + +typedef struct _ContainerRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; +} ContainerRec; + +typedef struct _ContainerClassPart{ + int unused; +} ContainerClassPart; + + +typedef struct _ContainerClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; +} ContainerClassRec; + +/* container constraints */ + +typedef struct _ContainerConstraintPart { + int unused; +} ContainerConstraintPart; + +typedef struct _ContainerConstraintRec { + ContainerConstraintPart container; +} ContainerCosntraintRec, *ContainerConstraintPtr; + +extern ContainerClassRec containerClassRec; + + +extern void _XawQueryGeometry Xraw_PROTO((Widget widget, + XtWidgetGeometry *reply_return)); + +#endif /* _CONTEINER_P_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Dialog.h b/vendor/x11iraf/obm/ObmW/Xraw/Dialog.h new file mode 100644 index 00000000..1c678f0a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Dialog.h @@ -0,0 +1,82 @@ +/* $XConsortium: Dialog.h,v 1.26 91/07/22 19:05:10 converse Exp $ */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawDialog_h +#define _XawDialog_h + +#include <X11/Xraw/Form.h> + +/*********************************************************************** + * + * Dialog Widget + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + height Height Dimension computed at create + icon Icon Pixmap 0 + label Label String NULL + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + value Value String NULL + width Width Dimension computed at create + x Position Position 0 + y Position Position 0 + +*/ + +#define XtCIcon "Icon" +#define XtNicon "icon" + +typedef struct _DialogClassRec *DialogWidgetClass; +typedef struct _DialogRec *DialogWidget; + +extern WidgetClass dialogWidgetClass; + +extern void XawDialogAddButton( +#if NeedFunctionPrototypes + Widget /* dialog */, + char* /* name */, + XtCallbackProc /* function */, + XtPointer /* client_data */ +#endif +); + +extern char *XawDialogGetValueString( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +#endif /* _XawDialog_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/DialogP.h b/vendor/x11iraf/obm/ObmW/Xraw/DialogP.h new file mode 100644 index 00000000..85993f59 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/DialogP.h @@ -0,0 +1,76 @@ +/* $XConsortium: DialogP.h,v 1.12 89/08/25 18:35:37 kit Exp $ */ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* Private definitions for Dialog widget */ + +#ifndef _DialogP_h +#define _DialogP_h + +#include <X11/Xraw/Dialog.h> +#include <X11/Xraw/FormP.h> + +typedef struct {int empty;} DialogClassPart; + +typedef struct _DialogClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + FormClassPart form_class; + DialogClassPart dialog_class; +} DialogClassRec; + +extern DialogClassRec dialogClassRec; + +typedef struct _DialogPart { + /* resources */ + String label; /* description of the dialog */ + String value; /* for the user response */ + Pixmap icon; /* icon bitmap */ + /* private data */ + Widget iconW; /* widget to display the icon */ + Widget labelW; /* widget to display description*/ + Widget valueW; /* user response TextWidget */ +} DialogPart; + +typedef struct _DialogRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + FormPart form; + DialogPart dialog; +} DialogRec; + +typedef struct {int empty;} DialogConstraintsPart; + +typedef struct _DialogConstraintsRec { + FormConstraintsPart form; + DialogConstraintsPart dialog; +} DialogConstraintsRec, *DialogConstraints; + +#endif /* _DialogP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Form.h b/vendor/x11iraf/obm/ObmW/Xraw/Form.h new file mode 100644 index 00000000..cf7b8554 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Form.h @@ -0,0 +1,142 @@ +/* $XConsortium: Form.h,v 1.28 91/05/04 18:59:10 rws Exp $ */ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawForm_h +#define _XawForm_h + +#include <X11/Xraw/Container.h> + +/*********************************************************************** + * + * Form Widget + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + defaultDistance Thickness int 4 + destroyCallback Callback Pointer NULL + height Height Dimension computed at realize + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension computed at realize + x Position Position 0 + y Position Position 0 + +*/ + +/* Constraint parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + bottom Edge XtEdgeType XtRubber + fromHoriz Widget Widget (left edge of form) + fromVert Widget Widget (top of form) + horizDistance Thickness int defaultDistance + left Edge XtEdgeType XtRubber + resizable Boolean Boolean False + right Edge XtEdgeType XtRubber + top Edge XtEdgeType XtRubber + vertDistance Thickness int defaultDistance + +*/ + + +#ifndef _XtStringDefs_h_ +#define XtNtop "top" +#define XtRWidget "Widget" +#endif + +#define XtNdefaultDistance "defaultDistance" +#define XtNbottom "bottom" +#define XtNleft "left" +#define XtNright "right" +#define XtNfromHoriz "fromHoriz" +#define XtNfromVert "fromVert" +#define XtNhorizDistance "horizDistance" +#define XtNvertDistance "vertDistance" +#define XtNresizable "resizable" + +#define XtCEdge "Edge" +#define XtCWidget "Widget" + +#ifndef _XawEdgeType_e +#define _XawEdgeType_e +typedef enum { + XawChainTop, /* Keep this edge a constant distance from + the top of the form */ + XawChainBottom, /* Keep this edge a constant distance from + the bottom of the form */ + XawChainLeft, /* Keep this edge a constant distance from + the left of the form */ + XawChainRight, /* Keep this edge a constant distance from + the right of the form */ + XawRubber, /* Keep this edge a proportional distance + from the edges of the form*/ + XawChainForm +} XawEdgeType; +#endif /* _XawEdgeType_e */ + +/* + * Unfortunatly I missed this definition for R4, so I cannot + * protect it with XAW_BC, it looks like this particular problem is + * one that we will have to live with for a while. + * + * Chris D. Peterson - 3/23/90. + */ + +#define XtEdgeType XawEdgeType + +#define XtChainTop XawChainTop +#define XtChainBottom XawChainBottom +#define XtChainLeft XawChainLeft +#define XtChainRight XawChainRight +#define XtRubber XawRubber +#define XtChainForm XawChainForm + +typedef struct _FormClassRec *FormWidgetClass; +typedef struct _FormRec *FormWidget; + +extern WidgetClass formWidgetClass; + +extern void XawFormDoLayout( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* do_layout */ +#else + Boolean /* do_layout */ +#endif +#endif +); + +#endif /* _XawForm_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/FormP.h b/vendor/x11iraf/obm/ObmW/Xraw/FormP.h new file mode 100644 index 00000000..414f09ed --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/FormP.h @@ -0,0 +1,126 @@ +/* $XConsortium: FormP.h,v 1.20 91/05/02 16:20:29 swick Exp $ */ +/* Copyright Massachusetts Institute of Technology 1987 */ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* Form widget private definitions */ + +#ifndef _XawFormP_h +#define _XawFormP_h + +#include <X11/ConstrainP.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Form.h> + +#define XtREdgeType "EdgeType" + +typedef enum {LayoutPending, LayoutInProgress, LayoutDone} LayoutState; +#define XtInheritLayout ((Boolean (*)())_XtInherit) + +typedef struct { + Boolean (*layout)(/* FormWidget, Dimension, Dimension */); +} FormClassPart; + +/* + * Layout( + * FormWidget w - the widget whose children are to be configured + * Dimension w, h - bounding box of layout to be calculated + * + * Stores preferred geometry in w->form.preferred_{width,height}. + * If w->form.resize_in_layout is True, then a geometry request + * may be made for the preferred bounding box if necessary. + * + * Returns True if a geometry request was granted, False otherwise. + */ + +typedef struct _FormClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + FormClassPart form_class; +} FormClassRec; + +extern FormClassRec formClassRec; + +typedef struct _FormPart { + /* resources */ + int default_spacing; /* default distance between children */ + /* private state */ + Dimension old_width, old_height; /* last known dimensions */ + int no_refigure; /* no re-layout while > 0 */ + Boolean needs_relayout; /* next time no_refigure == 0 */ + Boolean resize_in_layout; /* should layout() do geom request? */ + Dimension preferred_width, preferred_height; /* cached from layout */ + Boolean resize_is_no_op; /* Causes resize to take not action. */ +} FormPart; + +typedef struct _FormRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + FormPart form; +} FormRec; + +typedef struct _FormConstraintsPart { +/* + * Constraint Resources. + */ + XtEdgeType top, bottom, /* where to drag edge on resize */ + left, right; + int dx; /* desired horiz offset */ + int dy; /* desired vertical offset */ + Widget horiz_base; /* measure dx from here if non-null */ + Widget vert_base; /* measure dy from here if non-null */ + Boolean allow_resize; /* TRUE if child may request resize */ + +/* + * Private contstraint resources. + */ + +/* + * What the size of this child would be if we did not impose the + * constraint the width and height must be greater than zero (0). + */ + short virtual_width, virtual_height; + +/* + * Temporary Storage for children's new possible possition. + */ + + Position new_x, new_y; + + LayoutState layout_state; /* temporary layout state */ + Boolean deferred_resize; /* was resized while no_refigure is set */ +} FormConstraintsPart; + +typedef struct _FormConstraintsRec { + FormConstraintsPart form; +} FormConstraintsRec, *FormConstraints; + +#endif /* _XawFormP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Frame.h b/vendor/x11iraf/obm/ObmW/Xraw/Frame.h new file mode 100644 index 00000000..3af67dec --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Frame.h @@ -0,0 +1,163 @@ +/*********************************************************************** + + Frame widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _XawFrame_h +#define _XawFrame_h + + + +#include <X11/Xraw/3d.h> + +/*********************************************************************** + * + * Frame Widget (subclass of CompositeClass) + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/* New fields */ +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNuserData "userData" +#define XtCUserData "UserData" +#define XtNframeType "frameType" +#define XtCFrameType "FrameType" +#define XtRFrameType "FrameType" + + + +#ifndef XtNhSpace +#define XtNhSpace "hSpace" +#endif + +#ifndef XtNvSpace +#define XtNvSpace "vSpace" +#endif + +#ifndef XtCHSpace +#define XtCHSpace "HSpace" +#endif + +#ifndef XtCVSpace +#define XtCVSpace "VSpace" +#endif + +#ifndef XtNtop +#define XtNtop "top" +#endif + + +#ifndef XtNbottom +#define XtNbottom "bottom" +#endif + + +#ifndef XtNleft +#define XtNleft "left" +#endif + + +#ifndef XtNright +#define XtNright "right" +#endif + +#ifndef XtNlayoutPolicy +#define XtNlayoutPolicy "layoutPolicy" +#endif + +#ifndef XtNxFraction +#define XtNxFraction "xFraction" +#endif + +#ifndef XtNyFraction +#define XtNyFraction "yFraction" +#endif + +#ifndef XtCLayoutPolicy +#define XtCLayoutPolicy "LayoutPolicy" +#endif + +#ifndef XtRLayoutPolicy +#define XtRLayoutPolicy "LayoutPolicy" +#endif + + +#ifndef XtNcaptionOn +#define XtNcaptionOn "captionOn" +#endif + +#ifndef XtCCaptionOn +#define XtCCaptionOn "CaptionOn" +#endif + + +#ifndef XtNcaptionLabel +#define XtNcaptionLabel "captionLabel" +#endif + +#ifndef XtCCaptionLabel +#define XtCCaptionLabel "CaptionLabel" +#endif + +/*#########################################################################*/ +/*# #*/ +/*# Widget Class Pointer #*/ +/*# #*/ +/*#########################################################################*/ +extern WidgetClass frameWidgetClass; + +typedef struct _FrameClassRec *FrameWidgetClass; +typedef struct _FrameRec *FrameWidget; + +typedef enum { + XawSINGLE = Xraw_FRAME + 10, + XawFRACTION, + XawCENTER +}XawLayoutPolicy; + +#endif /* _XawFrame_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/FrameP.h b/vendor/x11iraf/obm/ObmW/Xraw/FrameP.h new file mode 100644 index 00000000..a88805cc --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/FrameP.h @@ -0,0 +1,95 @@ +/* + * FrameP.h - Private definitions for Frame widget + * + * Author: Vladimir Romanovski + * + * Date: Mon Feb 27, 1995 + */ + +/*********************************************************************** + * + * Frame Widget Private Data + * + ***********************************************************************/ + +#ifndef _XawFrameP_h +#define _XawFrameP_h + +#include <X11/ConstrainP.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Frame.h> + +#define FRAME(w) ((FrameWidget)(w))->frame + +/* New fields for the Frame widget class record */ + +typedef struct _FrameClassPart{ + XtPointer extension; +} FrameClassPart; + +typedef struct _FrameClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + FrameClassPart frame_class; +} FrameClassRec; + +/* New fields for the frame widget. */ + +typedef struct _FramePart { + /* Constraint contstraint resources */ + Dimension h_space; + Dimension v_space; + + XawFrameType frame_type; + + int x_fraction; + int y_fraction; + XawLayoutPolicy policy; + + char *label; + XFontStruct *font; + Boolean caption; + XtJustify justify; + unsigned char encoding; + + /* Private resources. */ + Dimension preferred_width; + Dimension preferred_height; + + GC gc; + +} FramePart; + +typedef struct _FrameRec{ + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + FramePart frame; +} FrameRec; + +typedef struct _FrameConstraintsPart { + /* Constraint contstraint resources */ + + int left; + int right; + int top; + int bottom; + + /* Private contstraint resources. */ + +} FrameConstraintsPart; + +typedef struct _FrameConstraintsRec { + FrameConstraintsPart frame; +} FrameConstraintsRec, *FrameConstraints; + + + +extern FrameClassRec frameClassRec; + + +#endif /* _XawFrameP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Grip.h b/vendor/x11iraf/obm/ObmW/Xraw/Grip.h new file mode 100644 index 00000000..1d832626 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Grip.h @@ -0,0 +1,83 @@ +/* $XConsortium: Grip.h,v 1.18 91/07/26 19:42:40 converse Exp $ */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Grip.h - Public Definitions for Grip widget (used by VPane Widget) + * + */ + +#ifndef _XawGrip_h +#define _XawGrip_h + +#include <X11/Xraw/Simple.h> + +/*************************************************************************** + * + * Grip Widget + * + **************************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + foreground Foreground Pixel XtDefaultForeground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 0 + callback Callback Pointer GripAction + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback Pointer NULL + height Height Dimension 8 + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + sensitive Sensitive Boolean True + width Width Dimension 8 + x Position Position 0 + y Position Position 0 + +*/ + + +#define XtNgripTranslations "gripTranslations" +#define XtNgripForeground "gripForeground" + +typedef struct _XawGripCallData { + XEvent *event; /* the event causing the GripAction */ + String *params; /* the TranslationTable params */ + Cardinal num_params; /* count of params */ +} XawGripCallDataRec, *XawGripCallData, + GripCallDataRec, *GripCallData; /* supported for R4 compatibility */ + +/* Class Record Constant */ + +extern WidgetClass gripWidgetClass; + +typedef struct _GripClassRec *GripWidgetClass; +typedef struct _GripRec *GripWidget; + +#endif /* _XawGrip_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/GripP.h b/vendor/x11iraf/obm/ObmW/Xraw/GripP.h new file mode 100644 index 00000000..e3d4248a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/GripP.h @@ -0,0 +1,79 @@ +/* +* $XConsortium: GripP.h,v 1.14 89/05/11 01:05:27 kit Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * GripP.h - Private definitions for Grip widget (Used by VPane Widget) + * + */ + +#ifndef _XawGripP_h +#define _XawGripP_h + +#include <X11/Xraw/Grip.h> +#include <X11/Xraw/SimpleP.h> + +/***************************************************************************** + * + * Grip Widget Private Data + * + *****************************************************************************/ + +#define DEFAULT_GRIP_SIZE 10 + +/* New fields for the Grip widget class record */ +typedef struct {int empty;} GripClassPart; + +/* Full Class record declaration */ +typedef struct _GripClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + GripClassPart grip_class; +} GripClassRec; + +extern GripClassRec gripClassRec; + +/* New fields for the Grip widget record */ +typedef struct { + XtCallbackList grip_action; +} GripPart; + +/***************************************************************************** + * + * Full instance record declaration + * + ****************************************************************************/ + +typedef struct _GripRec { + CorePart core; + SimplePart simple; + GripPart grip; +} GripRec; + +#endif /* _XawGripP_h */ + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Label.h b/vendor/x11iraf/obm/ObmW/Xraw/Label.h new file mode 100644 index 00000000..bbf98f6b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Label.h @@ -0,0 +1,98 @@ +/* $XConsortium: Label.h,v 1.31 91/07/26 19:51:37 converse Exp $ */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawLabel_h +#define _XawLabel_h + +/*********************************************************************** + * + * Label Widget + * + ***********************************************************************/ + +#include <X11/Xraw/Simple.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback XtCallbackList NULL + encoding Encoding unsigned char XawTextEncoding8bit + font Font XFontStruct* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + leftBitmap LeftBitmap Pixmap None + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + resize Resize Boolean True + sensitive Sensitive Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + +#define XawTextEncoding8bit 0 +#define XawTextEncodingChar2b 1 + +#define XtNleftBitmap "leftBitmap" +#define XtCLeftBitmap "LeftBitmap" +#define XtNencoding "encoding" +#define XtCEncoding "Encoding" + +#ifndef _XtStringDefs_h_ +#define XtNbitmap "bitmap" +#define XtNforeground "foreground" +#define XtNlabel "label" +#define XtNfont "font" +#define XtNinternalWidth "internalWidth" +#define XtNinternalHeight "internalHeight" +#define XtNresize "resize" +#define XtCResize "Resize" +#define XtCBitmap "Bitmap" +#endif + +/* Class record constants */ + +extern WidgetClass labelWidgetClass; + +typedef struct _LabelClassRec *LabelWidgetClass; +typedef struct _LabelRec *LabelWidget; + +#endif /* _XawLabel_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/LabelP.h b/vendor/x11iraf/obm/ObmW/Xraw/LabelP.h new file mode 100644 index 00000000..44deb671 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/LabelP.h @@ -0,0 +1,111 @@ +/* +* $XConsortium: LabelP.h,v 1.27 91/06/22 19:34:58 rws Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * LabelP.h - Private definitions for Label widget + * + */ + +#ifndef _XawLabelP_h +#define _XawLabelP_h + +/*********************************************************************** + * + * Label Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/Label.h> + +/* New fields for the Label widget class record */ + +typedef struct { + XtWidgetProc label_position; +} LabelClassPart; + +/* Full class record declaration */ +typedef struct _LabelClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; +} LabelClassRec; + +extern LabelClassRec labelClassRec; + +/* New fields for the Label widget record */ +typedef struct { + /* resources */ + XFontStruct *font; + char *label; + XtJustify justify; + Dimension internal_width; + Dimension internal_height; + Pixmap pixmap; + Boolean resize; + unsigned char encoding; + Pixmap left_bitmap; + + /* private state */ + GC normal_GC; + GC gray_GC; + Pixmap stipple; + Position label_x; + Position label_y; + Dimension label_width; + Dimension label_height; + Dimension label_len; + int lbm_y; /* where in label */ + unsigned int lbm_width, lbm_height; /* size of pixmap */ + Boolean need_calculate_width; +} LabelPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _LabelRec { + CorePart core; + SimplePart simple; + LabelPart label; +} LabelRec; + + +#define XtInheritLabelPosition ((void (*)())_XtInherit) +#define XtLabelClass(w) ((LabelWidgetClass)XtClass(w)) +#define LEFT_OFFSET(lw) ((lw)->label.left_bitmap \ + ? (lw)->label.lbm_width + (lw)->label.internal_width : 0) + + + +#endif /* _XawLabelP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/List.h b/vendor/x11iraf/obm/ObmW/Xraw/List.h new file mode 100644 index 00000000..3081ef89 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/List.h @@ -0,0 +1,225 @@ +/* $XConsortium: List.h,v 1.20 91/07/26 20:07:51 converse Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* This is the List widget, it is useful to display a list, without the + * overhead of having a widget for each item in the list. It allows + * the user to select an item in a list and notifies the application through + * a callback function. + * + * Created: 8/13/88 + * By: Chris D. Peterson + * MIT X Consortium + */ + +#ifndef _XawList_h +#define _XawList_h + +/*********************************************************************** + * + * List Widget + * + ***********************************************************************/ + +#include <X11/Xraw/Simple.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback XtCallbackList NULL **6 + columnSpacing Spacing Dimension 6 + cursor Cursor Cursor left_ptr + cursorName Cursor String NULL + defaultColumns Columns int 2 **5 + destroyCallback Callback Pointer NULL + font Font XFontStruct* XtDefaultFont + forceColumns Columns Boolean False **5 + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 0 **1 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + list List String * NULL **2 + longest Longest int 0 **3 **4 + mappedWhenManaged MappedWhenManaged Boolean True + numberStrings NumberStrings int 0 **4 + pasteBuffer Boolean Boolean False + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + rowSpacing Spacing Dimension 4 + sensitive Sensitive Boolean True + verticalList Boolean Boolean False + width Width Dimension 0 **1 + x Position Position 0 + y Position Position 0 + + **1 - If the Width or Height of the list widget is zero (0) then the value + is set to the minimum size necessay to fit the entire list. + + If both Width and Height are zero then they are adjusted to fit the + entire list that is created width the number of default columns + specified in the defaultColumns resource. + + **2 - This is an array of strings the specify elements of the list. + This resource must be specified. + (What good is a list widget without a list?? :-) + + **3 - Longest is the length of the widest string in pixels. + + **4 - If either of these values are zero (0) then the list widget calculates + the correct value. + + (This allows you to make startup faster if you already have + this information calculated) + + NOTE: If the numberStrings value is zero the list must + be NULL terminated. + + **5 - By setting the List.Columns resource you can force the application to + have a given number of columns. + + **6 - This returns the name and index of the item selected in an + XawListReturnStruct that is pointed to by the client_data + in the CallbackProc. + +*/ + + +/* + * Value returned when there are no highlighted objects. + */ + +#define XAW_LIST_NONE -1 + +#define XtCList "List" +#define XtCSpacing "Spacing" +#define XtCColumns "Columns" +#define XtCLongest "Longest" +#define XtCNumberStrings "NumberStrings" + +#define XtNcursor "cursor" +#define XtNcolumnSpacing "columnSpacing" +#define XtNdefaultColumns "defaultColumns" +#define XtNforceColumns "forceColumns" +#define XtNlist "list" +#define XtNlongest "longest" +#define XtNnumberStrings "numberStrings" +#define XtNpasteBuffer "pasteBuffer" +#define XtNrowSpacing "rowSpacing" +#define XtNverticalList "verticalList" + +#ifndef XtNdoubleClickCallback +#define XtNdoubleClickCallback "doubleClickCallback" +#endif + +/* Class record constants */ + +extern WidgetClass listWidgetClass; + +typedef struct _ListClassRec *ListWidgetClass; +typedef struct _ListRec *ListWidget; + +/* The list return structure. */ + +typedef struct _XawListReturnStruct { + String string; + int list_index; +} XawListReturnStruct; + +/****************************************************************** + * + * Exported Functions + * + *****************************************************************/ + +/* Function Name: XawListChange. + * Description: Changes the list being used and shown. + * Arguments: w - the list widget. + * list - the new list. + * nitems - the number of items in the list. + * longest - the length (in Pixels) of the longest element + * in the list. + * resize - if TRUE the the list widget will + * try to resize itself. + * Returns: none. + * NOTE: If nitems of longest are <= 0 then they will be caluculated. + * If nitems is <= 0 then the list needs to be NULL terminated. + */ + +extern void XawListChange( +#if NeedFunctionPrototypes + Widget /* w */, + String* /* list */, + int /* nitems */, + int /* longest */, +#if NeedWidePrototypes + /* Boolean */ int /* resize */ +#else + Boolean /* resize */ +#endif +#endif +); + +/* Function Name: XawListUnhighlight + * Description: unlights the current highlighted element. + * Arguments: w - the widget. + * Returns: none. + */ + +extern void XawListUnhighlight( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawListHighlight + * Description: Highlights the given item. + * Arguments: w - the list widget. + * item - the item to highlight. + * Returns: none. + */ + +extern void XawListHighlight( +#if NeedFunctionPrototypes + Widget /* w */, + int /* item */ +#endif +); + + +/* Function Name: XawListShowCurrent + * Description: returns the currently highlighted object. + * Arguments: w - the list widget. + * Returns: the info about the currently highlighted object. + */ + +extern XawListReturnStruct * XawListShowCurrent( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +#endif /* _XawList_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ListP.h b/vendor/x11iraf/obm/ObmW/Xraw/ListP.h new file mode 100644 index 00000000..4c2c86e1 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ListP.h @@ -0,0 +1,115 @@ +/* + * $XConsortium: ListP.h,v 1.12 89/12/11 15:09:04 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + + +/* + * ListP.h - Private definitions for List widget + * + * This is the List widget, it is useful to display a list, without the + * overhead of having a widget for each item in the list. It allows + * the user to select an item in a list and notifies the application through + * a callback function. + * + * Created: 8/13/88 + * By: Chris D. Peterson + * MIT - Project Athena + */ + +#ifndef _XawListP_h +#define _XawListP_h + +/*********************************************************************** + * + * List Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/List.h> + +#define NO_HIGHLIGHT XAW_LIST_NONE +#define OUT_OF_RANGE -1 +#define OKAY 0 + +/* New fields for the List widget class record */ + +typedef struct {int foo;} ListClassPart; + +/* Full class record declaration */ +typedef struct _ListClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ListClassPart list_class; +} ListClassRec; + +extern ListClassRec listClassRec; + +/* New fields for the List widget record */ +typedef struct { + /* resources */ + Pixel foreground; + Dimension internal_width, + internal_height, + column_space, + row_space; + int default_cols; + Boolean force_cols, + paste, + vertical_cols; + int longest; + int nitems; /* number of items in the list. */ + XFontStruct *font; + String * list; + XtCallbackList callback; + XtCallbackList double_callback; + + /* private state */ + + int is_highlighted, /* set to the item currently highlighted. */ + highlight, /*set to the item that should be highlighted.*/ + col_width, /* width of each column. */ + row_height, /* height of each row. */ + nrows, /* number of rows in the list. */ + ncols; /* number of columns in the list. */ + GC normgc, /* a couple o' GC's. */ + revgc, + graygc; /* used when inactive. */ + +} ListPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _ListRec { + CorePart core; + SimplePart simple; + ListPart list; +} ListRec; + +#endif /* _XawListP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Logo.h b/vendor/x11iraf/obm/ObmW/Xraw/Logo.h new file mode 100644 index 00000000..d1fed3bf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Logo.h @@ -0,0 +1,50 @@ +/* +* $XConsortium: Logo.h,v 1.11 90/10/22 14:45:11 converse Exp $ +*/ + +/* +Copyright 1988 by the Massachusetts Institute of Technology + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. +M.I.T. makes no representations about the suitability of +this software for any purpose. It is provided "as is" +without express or implied warranty. +*/ + +#ifndef _XawLogo_h +#define _XawLogo_h + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 100 + mappedWhenManaged MappedWhenManaged Boolean True + shapeWindow ShapeWindow Boolean False + width Width Dimension 100 + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNshapeWindow "shapeWindow" +#define XtCShapeWindow "ShapeWindow" + +typedef struct _LogoRec *LogoWidget; +typedef struct _LogoClassRec *LogoWidgetClass; + +extern WidgetClass logoWidgetClass; + +#endif /* _XawLogo_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/LogoP.h b/vendor/x11iraf/obm/ObmW/Xraw/LogoP.h new file mode 100644 index 00000000..22d930a0 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/LogoP.h @@ -0,0 +1,51 @@ +/* +* $XConsortium: LogoP.h,v 1.9 90/10/22 14:45:51 converse Exp $ +*/ + +/* +Copyright 1988 by the Massachusetts Institute of Technology + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. +M.I.T. makes no representations about the suitability of +this software for any purpose. It is provided "as is" +without express or implied warranty. +*/ + +#ifndef _XawLogoP_h +#define _XawLogoP_h + +#include <X11/Xraw/Logo.h> +#include <X11/Xraw/SimpleP.h> + +typedef struct { + Pixel fgpixel; + GC foreGC; + GC backGC; + Boolean shape_window; + Boolean need_shaping; + } LogoPart; + +typedef struct _LogoRec { + CorePart core; + SimplePart simple; + LogoPart logo; + } LogoRec; + +typedef struct {int dummy;} LogoClassPart; + +typedef struct _LogoClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LogoClassPart logo_class; + } LogoClassRec; + +extern LogoClassRec logoClassRec; + +#endif /* _XawLogoP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Mailbox.h b/vendor/x11iraf/obm/ObmW/Xraw/Mailbox.h new file mode 100644 index 00000000..71ddd9b6 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Mailbox.h @@ -0,0 +1,61 @@ +/* + * $XConsortium: Mailbox.h,v 1.20 91/05/04 18:58:42 rws Exp $ + * + * Copyright 1988 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawMailbox_h +#define _XawMailbox_h + +/* + * Mailbox widget; looks a lot like the clock widget, don't it... + */ + +/* resource names used by mailbox widget that aren't defined in StringDefs.h */ + +#ifndef _XtStringDefs_h_ +#define XtNupdate "update" +#endif + +/* command to exec */ +#define XtNcheckCommand "checkCommand" +#define XtNonceOnly "onceOnly" + +/* Int: volume for bell */ +#define XtNvolume "volume" +#define XtNfullPixmap "fullPixmap" +#define XtNfullPixmapMask "fullPixmapMask" +#define XtNemptyPixmap "emptyPixmap" +#define XtNemptyPixmapMask "emptyPixmapMask" +#define XtNflip "flip" +#define XtNshapeWindow "shapeWindow" + +#define XtCCheckCommand "CheckCommand" +#define XtCVolume "Volume" +#define XtCPixmapMask "PixmapMask" +#define XtCFlip "Flip" +#define XtCShapeWindow "ShapeWindow" + + +/* structures */ + +typedef struct _MailboxRec *MailboxWidget; /* see MailboxP.h */ +typedef struct _MailboxClassRec *MailboxWidgetClass; /* see MailboxP.h */ + + +extern WidgetClass mailboxWidgetClass; + +#endif /* _XawMailbox_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/MailboxP.h b/vendor/x11iraf/obm/ObmW/Xraw/MailboxP.h new file mode 100644 index 00000000..1dd8d32e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/MailboxP.h @@ -0,0 +1,80 @@ +/* + * $XConsortium: MailboxP.h,v 1.20 91/07/19 21:52:57 rws Exp $ + * + * Copyright 1988 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawMailboxP_h +#define _XawMailboxP_h + +#include <X11/Xraw/Mailbox.h> +#include <X11/Xraw/SimpleP.h> + +#ifdef SYSV +#define MAILBOX_DIRECTORY "/usr/mail" +#else +#ifdef SVR4 +#define MAILBOX_DIRECTORY "/var/mail" +#else +#define MAILBOX_DIRECTORY "/usr/spool/mail" +#endif +#endif + +typedef struct { /* new fields for mailbox widget */ + /* resources */ + int update; /* seconds between updates */ + Pixel foreground_pixel; /* color index of normal state fg */ + String filename; /* filename to watch */ + String check_command; /* command to exec for mail check */ + Boolean flipit; /* do flip of full pixmap */ + int volume; /* bell volume */ + Boolean once_only; /* ring bell only once on new mail */ + /* local state */ + GC gc; /* normal GC to use */ + long last_size; /* size in bytes of mailboxname */ + XtIntervalId interval_id; /* time between checks */ + Boolean flag_up; /* is the flag up? */ + struct _mbimage { + Pixmap bitmap, mask; /* depth 1, describing shape */ + Pixmap pixmap; /* full depth pixmap */ + int width, height; /* geometry of pixmaps */ + } full, empty; + Boolean shapeit; /* do shape extension */ + struct { + Pixmap mask; + int x, y; + } shape_cache; /* last set of info */ +} MailboxPart; + +typedef struct _MailboxRec { /* full instance record */ + CorePart core; + SimplePart simple; + MailboxPart mailbox; +} MailboxRec; + + +typedef struct { /* new fields for mailbox class */ + int dummy; /* stupid C compiler */ +} MailboxClassPart; + +typedef struct _MailboxClassRec { /* full class record declaration */ + CoreClassPart core_class; + SimpleClassPart simple_class; + MailboxClassPart mailbox_class; +} MailboxClassRec; + +extern MailboxClassRec mailboxClassRec; /* class pointer */ + +#endif /* _XawMailboxP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/MenuButtoP.h b/vendor/x11iraf/obm/ObmW/Xraw/MenuButtoP.h new file mode 100644 index 00000000..92c95eda --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/MenuButtoP.h @@ -0,0 +1,96 @@ +/* + * $XConsortium: MenuButtoP.h,v 1.6 89/12/11 14:57:23 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************** + * + * MenuButton Widget + * + ***********************************************************************/ + +/* + * MenuButtonP.h - Private Header file for MenuButton widget. + * + * This is the private header file for the Athena MenuButton widget. + * It is intended to provide an easy method of activating pulldown menus. + * + * Date: May 2, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawMenuButtonP_h +#define _XawtMenuButtonP_h + +#include <X11/Xraw/MenuButton.h> +#include <X11/Xraw/CommandP.h> + +/************************************ + * + * Class structure + * + ***********************************/ + + + /* New fields for the MenuButton widget class record */ +typedef struct _MenuButtonClass +{ + int makes_compiler_happy; /* not used */ +} MenuButtonClassPart; + + /* Full class record declaration */ +typedef struct _MenuButtonClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; + CommandClassPart command_class; + MenuButtonClassPart menuButton_class; +} MenuButtonClassRec; + +extern MenuButtonClassRec menuButtonClassRec; + +/*************************************** + * + * Instance (widget) structure + * + **************************************/ + + /* New fields for the MenuButton widget record */ +typedef struct { + /* resources */ + String menu_name; +} MenuButtonPart; + + /* Full widget declaration */ +typedef struct _MenuButtonRec { + CorePart core; + SimplePart simple; + LabelPart label; + CommandPart command; + MenuButtonPart menu_button; +} MenuButtonRec; + +#endif /* _XawMenuButtonP_h */ + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/MenuButton.h b/vendor/x11iraf/obm/ObmW/Xraw/MenuButton.h new file mode 100644 index 00000000..9c127c52 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/MenuButton.h @@ -0,0 +1,86 @@ +/* + * $XConsortium: MenuButton.h,v 1.7 89/12/11 14:57:44 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************** + * + * MenuButton Widget + * + ***********************************************************************/ + +/* + * MenuButton.h - Public Header file for MenuButton widget. + * + * This is the public header file for the Athena MenuButton widget. + * It is intended to provide an easy method of activating pulldown menus. + * + * Date: May 2, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawMenuButton_h +#define _XawMenuButton_h + +#include <X11/Xraw/Command.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback Pointer NULL + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + font Font XFontStruct* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + highlightThickness Thickness Dimension 2 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + mappedWhenManaged MappedWhenManaged Boolean True + menuName MenuName String "menu" + resize Resize Boolean True + sensitive Sensitive Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNmenuName "menuName" +#define XtCMenuName "MenuName" + +extern WidgetClass menuButtonWidgetClass; + +typedef struct _MenuButtonClassRec *MenuButtonWidgetClass; +typedef struct _MenuButtonRec *MenuButtonWidget; + +#endif /* _XawMenuButton_h -- DON'T ADD STUFF AFTER THIS */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Object.h b/vendor/x11iraf/obm/ObmW/Xraw/Object.h new file mode 100644 index 00000000..bc0a002d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Object.h @@ -0,0 +1,37 @@ +/* $XConsortium: Object.h,v 1.8 89/09/11 17:39:25 swick Exp $ */ +/* $oHeader: Object.h,v 1.2 88/08/18 15:55:32 asente Exp $ */ +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XtObject_h +#define _XtObject_h + +typedef struct _ObjectRec *Object; +typedef struct _ObjectClassRec *ObjectClass; + +#ifndef OBJECT +externalref WidgetClass objectClass; +#endif +#endif /* _XtObject_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Paned.h b/vendor/x11iraf/obm/ObmW/Xraw/Paned.h new file mode 100644 index 00000000..c32de6a5 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Paned.h @@ -0,0 +1,229 @@ +/* +* $XConsortium: Paned.h,v 1.13 91/02/17 13:16:15 rws Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Paned.h - Paned Composite Widget's public header file. + * + * Updated and significantly modifided from the Athena VPaned Widget. + * + * Date: March 1, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawPaned_h +#define _XawPaned_h + +#include <X11/Constraint.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * Vertical Paned Widget (SubClass of CompositeClass) + * + ****************************************************************/ + +/* RESOURCES: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + betweenCursor Cursor Cursor ** + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + gripIndent GripIndent Position 10 + gripCursor Cursor Cursor ** + horizontalGripCursol Cursor Cursor sb_h_double_arrow + horizontalBetweencursor Cursor Cursor sb_up_arrow + internalBorderColor BorderColor Pixel XtDefaultForeground + internalBorderWidth BorderWidth Position 6 + leftCursor Cursor Cursor sb_left_arrow + lowerCursor Cursor Cursor sb_down_arrow + mappedWhenManaged MappedWhenManaged Boolean True + orientation Orientation XtOrientation XtorientVertical + refigureMode Boolean Boolean On + rightCursor Cursor Cursor sb_right_arrow + sensitive Sensitive Boolean True + upperCursor Cursor Cursor sb_up_arrow + verticalBetweenCursor Cursor Cursor sb_left_arrow + verticalGripCursor Cursor Cursor sb_v_double_arrow + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +** These resources now are set to the vertical or horizontal cursor + depending upon orientation, by default. If a value is specified here + then that cursor will be used reguardless of orientation. + + +CONSTRAINT RESOURCES: + + Name Class RepType Default Value + ---- ----- ------- ------------- + allowResize Boolean Boolean False + max Max Dimension unlimited + min Min Dimension Grip Size + preferredPaneSize PerferredPaneSize Dimension PANED_ASK_CHILD + resizeToPreferred Boolean Boolean False + showGrip ShowGrip Boolean True + skipAdjust Boolean Boolean False + +*/ + +#define PANED_ASK_CHILD 0 +#define PANED_GRIP_SIZE 0 + +/* New Fields */ +#define XtNallowResize "allowResize" +#define XtNbetweenCursor "betweenCursor" +#define XtNverticalBetweenCursor "verticalBetweenCursor" +#define XtNhorizontalBetweenCursor "horizontalBetweenCursor" +#define XtNgripCursor "gripCursor" +#define XtNgripIndent "gripIndent" +#define XtNhorizontalGripCursor "horizontalGripCursor" +#define XtNinternalBorderColor "internalBorderColor" +#define XtNinternalBorderWidth "internalBorderWidth" +#define XtNleftCursor "leftCursor" +#define XtNlowerCursor "lowerCursor" +#define XtNrefigureMode "refigureMode" +#define XtNposition "position" +#define XtNmin "min" +#define XtNmax "max" +#define XtNpreferredPaneSize "preferredPaneSize" +#define XtNresizeToPreferred "resizeToPreferred" +#define XtNrightCursor "rightCursor" +#define XtNshowGrip "showGrip" +#define XtNskipAdjust "skipAdjust" +#define XtNupperCursor "upperCursor" +#define XtNverticalGripCursor "verticalGripCursor" + +#define XtCGripIndent "GripIndent" +#define XtCMin "Min" +#define XtCMax "Max" +#define XtCPreferredPaneSize "PreferredPaneSize" +#define XtCShowGrip "ShowGrip" + +/* Class record constant */ +extern WidgetClass panedWidgetClass; + +typedef struct _PanedClassRec *PanedWidgetClass; +typedef struct _PanedRec *PanedWidget; + +/************************************************************ + * + * Public Procedures + * + ************************************************************/ + +/* Function Name: XawPanedSetMinMax + * Description: Sets the min and max size for a pane. + * Arguments: widget - the widget that is a child of the Paned widget. + * min, max - the new min and max size for the pane. + * Returns: none. + */ + +extern void XawPanedSetMinMax( +#if NeedFunctionPrototypes + Widget /* w */, + int /* min */, + int /* max */ +#endif +); + +/* Function Name: XawPanedGetMinMax + * Description: Gets the min and max size for a pane. + * Arguments: widget - the widget that is a child of the Paned widget. + ** RETURNED ** min, max - the current min and max size for the pane. + * Returns: none. + */ + +extern void XawPanedGetMinMax( +#if NeedFunctionPrototypes + Widget /* w */, + int * /* min_return */, + int * /* max_return */ +#endif +); + +/* Function Name: XawPanedSetRefigureMode + * Description: Allows a flag to be set the will inhibit + * the paned widgets relayout routine. + * Arguments: w - the paned widget. + * mode - if FALSE then inhibit refigure. + * Returns: none. + */ + +extern void XawPanedSetRefigureMode( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* mode */ +#else + Boolean /* mode */ +#endif +#endif +); + +/* Function Name: XawPanedGetNumSub + * Description: Returns the number of panes in the paned widget. + * Arguments: w - the paned widget. + * Returns: the number of panes in the paned widget. + */ + +extern int XawPanedGetNumSub( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawPanedAllowResize + * Description: Allows a flag to be set that determines if the paned + * widget will allow geometry requests from this child + * Arguments: widget - a child of the paned widget. + * Returns: none. + */ + +extern void XawPanedAllowResize( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* allow_resize */ +#else + Boolean /* allow_resize */ +#endif +#endif +); + +#endif /* _XawPaned_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/PanedP.h b/vendor/x11iraf/obm/ObmW/Xraw/PanedP.h new file mode 100644 index 00000000..7954bda1 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/PanedP.h @@ -0,0 +1,172 @@ +/*********************************************************** + + $XConsortium: PanedP.h,v 1.5 91/05/09 20:58:23 gildea Exp $ + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * PanedP.h - Paned Composite Widget's private header file. + * + * Updated and significantly modified from the Athena VPaned Widget. + * + * Date: March 1, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawPanedP_h +#define _XawPanedP_h + +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Paned.h> + +/********************************************************************* + * + * Paned Widget Private Data + * + *********************************************************************/ + +/* New fields for the Paned widget class record */ + +typedef struct _PanedClassPart { + int foo; /* keep compiler happy. */ +} PanedClassPart; + +/* Full Class record declaration */ +typedef struct _PanedClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + PanedClassPart paned_class; +} PanedClassRec; + +extern PanedClassRec panedClassRec; + +/* Paned constraint record */ +typedef struct _PanedConstraintsPart { + /* Resources. */ + Dimension min; /* Minimum height */ + Dimension max; /* Maximum height */ + Boolean allow_resize; /* TRUE iff child resize requests are ok */ + Boolean show_grip; /* TRUE iff child will have grip below it, + when it is not the bottom pane. */ + Boolean skip_adjust; /* TRUE iff child's height should not be */ + /* changed without explicit user action. */ + int position; /* position location in Paned (relative to + other children) ** NIY ** */ + Dimension preferred_size; /* The Preferred size of the pane. + Iff this is zero then ask child for size.*/ + Boolean resize_to_pref; /* resize this pane to its preferred size + on a resize or change managed after + realize. */ + /* Private state. */ + Position delta; /* Desired Location */ + Position olddelta; /* The last value of dy. */ + Boolean paned_adjusted_me; /* Has the vpaned adjusted this widget w/o + user interaction to make things fit? */ + Dimension wp_size; /* widget's preferred size */ + int size; /* the size the widget will actually get. */ + Widget grip; /* The grip for this child */ + +} PanedConstraintsPart, *Pane; + +typedef struct _PanedConstraintsRec { + PanedConstraintsPart paned; +} PanedConstraintsRec, *PanedConstraints; + +/* + * The Pane Stack Structure. + */ + +typedef struct _PaneStack { + struct _PaneStack * next; /* The next element on the stack. */ + Pane pane; /* The pane in this element on the stack. */ + int start_size; /* The size of this element when it was pushed + onto the stack. */ +} PaneStack; + +/* New Fields for the Paned widget record */ +typedef struct { + /* resources */ + Position grip_indent; /* Location of grips (offset + from right margin) */ + Boolean refiguremode; /* Whether to refigure changes + right now */ + XtTranslations grip_translations; /* grip translation table */ + Dimension internal_bw; /* internal border width. */ + XtOrientation orientation; /* Orientation of paned widget. */ + + Cursor cursor; /* Cursor for paned window */ + Cursor grip_cursor; /* inactive grip cursor */ + Cursor v_grip_cursor; /* inactive vert grip cursor */ + Cursor h_grip_cursor; /* inactive horiz grip cursor */ + Cursor adjust_this_cursor; /* active grip cursor: T */ + Cursor v_adjust_this_cursor; /* active vert grip cursor: T */ + Cursor h_adjust_this_cursor; /* active horiz grip cursor: T */ + + /* vertical. */ + Cursor adjust_upper_cursor; /* active grip cursor: U */ + Cursor adjust_lower_cursor; /* active grip cursor: D */ + + /* horizontal. */ + Cursor adjust_left_cursor; /* active grip cursor: U */ + Cursor adjust_right_cursor; /* active grip cursor: D */ + + Dimension v_space; + Dimension h_space; + + /* private */ + Boolean recursively_called; /* for ChangeManaged */ + Boolean resize_children_to_pref; /* override constrain resources + and resize all children to + preferred size. */ + int start_loc; /* mouse origin when adjusting */ + Widget whichadd; /* Which pane to add changes to */ + Widget whichsub; /* Which pane to sub changes from */ + GC flipgc; /* GC to use when animating + borders */ + int num_panes; /* count of managed panes */ + PaneStack * stack; /* The pane stack for this widget.*/ + +} PanedPart; + +/************************************************************************** + * + * Full instance record declaration + * + **************************************************************************/ + +typedef struct _PanedRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + PanedPart paned; +} PanedRec; + +#endif /* _XawPanedP_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Panner.h b/vendor/x11iraf/obm/ObmW/Xraw/Panner.h new file mode 100644 index 00000000..9d0be8fa --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Panner.h @@ -0,0 +1,104 @@ +/* + * $XConsortium: Panner.h,v 1.21 91/05/04 18:59:17 rws Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPanner_h +#define _XawPanner_h + +#include <X11/Xraw/Reports.h> + +/***************************************************************************** + * + * Panner Widget (subclass of Simple) + * + * This widget is used to represent navigation in a 2d coordinate system. + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * allowOff AllowOff Boolean FALSE + * background Background Pixel XtDefaultBackground + * backgroundStipple BackgroundStipple String NULL + * canvasWidth CanvasWidth Dimension 0 + * canvasHeight CanvasHeight Dimension 0 + * defaultScale DefaultScale Dimension 8 percent + * foreground Foreground Pixel XtDefaultBackground + * internalSpace InternalSpace Dimension 4 + * lineWidth LineWidth Dimension 0 + * reportCallback ReportCallback XtCallbackList NULL + * resize Resize Boolean TRUE + * rubberBand RubberBand Boolean FALSE + * shadowColor ShadowColor Pixel XtDefaultForeground + * shadowThickness ShadowThickness Dimension 2 + * sliderX SliderX Position 0 + * sliderY SliderY Position 0 + * sliderWidth SliderWidth Dimension 0 + * sliderHeight SliderHeight Dimension 0 + * + *****************************************************************************/ + + /* new instance and class names */ +#ifndef _XtStringDefs_h_ +#define XtNresize "resize" +#define XtCResize "Resize" +#endif + +#define XtNallowOff "allowOff" +#define XtCAllowOff "AllowOff" +#define XtNbackgroundStipple "backgroundStipple" +#define XtCBackgroundStipple "BackgroundStipple" +#define XtNdefaultScale "defaultScale" +#define XtCDefaultScale "DefaultScale" +#define XtNcanvasWidth "canvasWidth" +#define XtCCanvasWidth "CanvasWidth" +#define XtNcanvasHeight "canvasHeight" +#define XtCCanvasHeight "CanvasHeight" +#define XtNinternalSpace "internalSpace" +#define XtCInternalSpace "InternalSpace" +#define XtNlineWidth "lineWidth" +#define XtCLineWidth "LineWidth" +#define XtNrubberBand "rubberBand" +#define XtCRubberBand "RubberBand" +#define XtNshadowThickness "shadowThickness" +#define XtCShadowThickness "ShadowThickness" +#define XtNshadowColor "shadowColor" +#define XtCShadowColor "ShadowColor" +#define XtNsliderX "sliderX" +#define XtCSliderX "SliderX" +#define XtNsliderY "sliderY" +#define XtCSliderY "SliderY" +#define XtNsliderWidth "sliderWidth" +#define XtCSliderWidth "SliderWidth" +#define XtNsliderHeight "sliderHeight" +#define XtCSliderHeight "SliderHeight" + + /* external declarations */ +extern WidgetClass pannerWidgetClass; + +typedef struct _PannerClassRec *PannerWidgetClass; +typedef struct _PannerRec *PannerWidget; + +#endif /* _XawPanner_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/PannerP.h b/vendor/x11iraf/obm/ObmW/Xraw/PannerP.h new file mode 100644 index 00000000..58aa6ce2 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/PannerP.h @@ -0,0 +1,100 @@ +/* + * $XConsortium: PannerP.h,v 1.18 90/04/11 17:05:11 jim Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPannerP_h +#define _XawPannerP_h + +#include <X11/Xraw/Panner.h> +#include <X11/Xraw/SimpleP.h> /* parent */ + +typedef struct { /* new fields in widget class */ + int dummy; +} PannerClassPart; + +typedef struct _PannerClassRec { /* Panner widget class */ + CoreClassPart core_class; + SimpleClassPart simple_class; + PannerClassPart panner_class; +} PannerClassRec; + +typedef struct { /* new fields in widget */ + /* resources... */ + XtCallbackList report_callbacks; /* callback/Callback */ + Boolean allow_off; /* allowOff/AllowOff */ + Boolean resize_to_pref; /* resizeToPreferred/Boolean */ + Pixel foreground; /* foreground/Foreground */ + Pixel shadow_color; /* shadowColor/ShadowColor */ + Dimension shadow_thickness; /* shadowThickness/ShadowThickness */ + Dimension default_scale; /* defaultScale/DefaultScale */ + Dimension line_width; /* lineWidth/LineWidth */ + Dimension canvas_width; /* canvasWidth/CanvasWidth */ + Dimension canvas_height; /* canvasHeight/CanvasHeight */ + Position slider_x; /* sliderX/SliderX */ + Position slider_y; /* sliderY/SliderY */ + Dimension slider_width; /* sliderWidth/SliderWidth */ + Dimension slider_height; /* sliderHeight/SliderHeight */ + Dimension internal_border; /* internalBorderWidth/BorderWidth */ + String stipple_name; /* backgroundStipple/BackgroundStipple */ + /* private data... */ + GC slider_gc; /* background of slider */ + GC shadow_gc; /* edge of slider and shadow */ + GC xor_gc; /* for doing XOR tmp graphics */ + double haspect, vaspect; /* aspect ratio of core to canvas */ + Boolean rubber_band; /* true = rubber band, false = move */ + struct { + Boolean doing; /* tmp graphics in progress */ + Boolean showing; /* true if tmp graphics displayed */ + Position startx, starty; /* initial position of slider */ + Position dx, dy; /* offset loc for tmp graphics */ + Position x, y; /* location for tmp graphics */ + } tmp; + Position knob_x, knob_y; /* real upper left of knob in canvas */ + Dimension knob_width, knob_height; /* real size of knob in canvas */ + Boolean shadow_valid; /* true if rects are valid */ + XRectangle shadow_rects[2]; /* location of shadows */ + Position last_x, last_y; /* previous location of knob */ +} PannerPart; + +typedef struct _PannerRec { + CorePart core; + SimplePart simple; + PannerPart panner; +} PannerRec; + +#define PANNER_HSCALE(pw,val) ((pw)->panner.haspect * ((double) (val))) +#define PANNER_VSCALE(pw,val) ((pw)->panner.vaspect * ((double) (val))) + +#define PANNER_DSCALE(pw,val) (Dimension) \ + ((((unsigned long) (val)) * (unsigned long) pw->panner.default_scale) / 100L) +#define PANNER_DEFAULT_SCALE 8 /* percent */ + +#define PANNER_OUTOFRANGE -30000 + +/* + * external declarations + */ +extern PannerClassRec pannerClassRec; + +#endif /* _XawPannerP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Porthole.h b/vendor/x11iraf/obm/ObmW/Xraw/Porthole.h new file mode 100644 index 00000000..68005c83 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Porthole.h @@ -0,0 +1,60 @@ +/* + * $XConsortium: Porthole.h,v 1.1 90/02/28 18:07:31 jim Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPorthole_h +#define _XawPorthole_h + +#include <X11/Xraw/Reports.h> + +/***************************************************************************** + * + * Porthole Widget (subclass of Composite) + * + * This widget is similar to a viewport without scrollbars. Child movement + * is done by external panners or scrollbars. + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * background Background Pixel XtDefaultBackground + * border BorderColor Pixel XtDefaultForeground + * borderWidth BorderWidth Dimension 1 + * height Height Dimension 0 + * reportCallback ReportCallback Pointer NULL + * width Width Dimension 0 + * x Position Position 0 + * y Position Position 0 + * + *****************************************************************************/ + + /* external declarations */ + +extern WidgetClass portholeWidgetClass; +typedef struct _PortholeClassRec *PortholeWidgetClass; +typedef struct _PortholeRec *PortholeWidget; + +#endif /* _XawPorthole_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/PortholeP.h b/vendor/x11iraf/obm/ObmW/Xraw/PortholeP.h new file mode 100644 index 00000000..fca997ba --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/PortholeP.h @@ -0,0 +1,63 @@ +/* + * $XConsortium: PortholeP.h,v 1.1 90/02/28 18:07:32 jim Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPortholeP_h +#define _XawPortholeP_h + +#include <X11/CompositeP.h> +#include <X11/Xraw/Porthole.h> + + +typedef struct { /* new fields in widget class */ + int dummy; +} PortholeClassPart; + +typedef struct _PortholeClassRec { /* Porthole widget class */ + CoreClassPart core_class; + CompositeClassPart composite_class; + PortholeClassPart porthole_class; +} PortholeClassRec; + + +typedef struct { /* new fields in widget */ + /* resources... */ + XtCallbackList report_callbacks; /* callback/Callback */ + /* private data... */ +} PortholePart; + +typedef struct _PortholeRec { + CorePart core; + CompositePart composite; + PortholePart porthole; +} PortholeRec; + + +/* + * external declarations + */ +extern PortholeClassRec portholeClassRec; + + +#endif /* _XawPortholeP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Repeater.h b/vendor/x11iraf/obm/ObmW/Xraw/Repeater.h new file mode 100644 index 00000000..e0c6b20b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Repeater.h @@ -0,0 +1,73 @@ +/* + * $XConsortium: Repeater.h,v 1.3 90/03/02 15:46:57 jim Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawRepeater_h +#define _XawRepeater_h + +#include <X11/Xraw/Command.h> + +/***************************************************************************** + * + * Repeater Widget (subclass of Command) + * + * This widget is a push button that repeatedly fires when held down. + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * decay Decay int 5 milliseconds + * flash Boolean Boolean FALSE + * initialDelay Delay int 200 milliseconds + * minimumDelay MinimumDelay int 10 milliseconds + * repeatDelay Delay int 50 milliseconds + * startCallback StartCallback XtCallbackList NULL + * stopCallback StopCallback XtCallbackList NULL + * + *****************************************************************************/ + + /* new instance and class names */ +#define XtNdecay "decay" +#define XtCDecay "Decay" +#define XtNinitialDelay "initialDelay" +#define XtCDelay "Delay" +#define XtNminimumDelay "minimumDelay" +#define XtCMinimumDelay "MinimumDelay" +#define XtNrepeatDelay "repeatDelay" +#define XtNflash "flash" +#define XtNstartCallback "startCallback" +#define XtCStartCallback "StartCallback" +#define XtNstopCallback "stopCallback" +#define XtCStopCallback "StopCallback" + + + /* external declarations */ +extern WidgetClass repeaterWidgetClass; + +typedef struct _RepeaterClassRec *RepeaterWidgetClass; +typedef struct _RepeaterRec *RepeaterWidget; + +#endif /* _XawRepeater_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/RepeaterP.h b/vendor/x11iraf/obm/ObmW/Xraw/RepeaterP.h new file mode 100644 index 00000000..716e295b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/RepeaterP.h @@ -0,0 +1,76 @@ +/* + * $XConsortium: RepeaterP.h,v 1.3 90/03/02 15:47:00 jim Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawRepeaterP_h +#define _XawRepeaterP_h + +#include <X11/Xraw/CommandP.h> +#include <X11/Xraw/Repeater.h> + +typedef struct { /* new fields in widget class */ + int dummy; +} RepeaterClassPart; + +typedef struct _RepeaterClassRec { /* Repeater widget class */ + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; + CommandClassPart command_class; + RepeaterClassPart repeater_class; +} RepeaterClassRec; + +typedef struct { /* new fields in widget */ + /* resources... */ + int initial_delay; /* initialDelay/Delay */ + int repeat_delay; /* repeatDelay/Delay */ + int minimum_delay; /* minimumDelay/MinimumDelay */ + int decay; /* decay to minimum delay */ + Boolean flash; /* flash/Boolean */ + XtCallbackList start_callbacks; /* startCallback/StartCallback */ + XtCallbackList stop_callbacks; /* stopCallback/StopCallback */ + /* private data... */ + int next_delay; /* next amount for timer */ + XtIntervalId timer; /* timer that will fire */ +} RepeaterPart; + +typedef struct _RepeaterRec { + CorePart core; + SimplePart simple; + LabelPart label; + CommandPart command; + RepeaterPart repeater; +} RepeaterRec; + +#define REP_DEF_DECAY 5 /* milliseconds */ +#define REP_DEF_INITIAL_DELAY 200 /* milliseconds */ +#define REP_DEF_MINIMUM_DELAY 10 /* milliseconds */ +#define REP_DEF_REPEAT_DELAY 50 /* milliseconds */ + +/* + * external declarations + */ +extern RepeaterClassRec repeaterClassRec; + +#endif /* _XawRepeaterP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Reports.h b/vendor/x11iraf/obm/ObmW/Xraw/Reports.h new file mode 100644 index 00000000..caa136f2 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Reports.h @@ -0,0 +1,51 @@ +/* + * $XConsortium: Reports.h,v 1.3 90/02/28 18:46:46 jim Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _Xaw_Reports_h +#define _Xaw_Reports_h + +/* + * XawPannerReport - this structure is used by the reportCallback of the + * Panner, Porthole, Viewport, and Scrollbar widgets to report its position. + * All fields must be filled in, although the changed field may be used as + * a hint as to which fields have been altered since the last report. + */ +typedef struct { + unsigned int changed; /* mask, see below */ + Position slider_x, slider_y; /* location of slider within outer */ + Dimension slider_width, slider_height; /* size of slider */ + Dimension canvas_width, canvas_height; /* size of canvas */ +} XawPannerReport; + +#define XawPRSliderX (1 << 0) +#define XawPRSliderY (1 << 1) +#define XawPRSliderWidth (1 << 2) +#define XawPRSliderHeight (1 << 3) +#define XawPRCanvasWidth (1 << 4) +#define XawPRCanvasHeight (1 << 5) +#define XawPRAll (63) /* union of above */ + +#define XtNreportCallback "reportCallback" +#define XtCReportCallback "reportCallback" + +#endif /* _Xaw_Reports_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Scrollbar.h b/vendor/x11iraf/obm/ObmW/Xraw/Scrollbar.h new file mode 100644 index 00000000..b62c7b13 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Scrollbar.h @@ -0,0 +1,221 @@ +/* $XConsortium: Scrollbar.h,v 1.7 91/07/26 21:59:31 converse Exp $ */ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _Scrollbar_h +#define _Scrollbar_h + +/**************************************************************** + * + * Scrollbar Widget + * + ****************************************************************/ + +#include <X11/Xmu/Converters.h> +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Simple.h> + +/* Scrollbar resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + accelerators Accelerators AcceleratorTable NULL + ancestorSensitive AncestorSensitive Boolean True + background Background Pixel XtDefaultBackground + backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderWidth BorderWidth Dimension 1 + colormap Colormap Colormap parent's colormap + cursor Cursor Cursor None + cursorName Cursor String NULL + depth Depth int parent's depth + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + height Height Dimension length or thickness + insensitiveBorder Insensitive Pixmap GreyPixmap + length Length Dimension 1 + mappedWhenManaged MappedWhenManaged Boolean True + minimumThumb MinimumThumb Dimension 7 + orientation Orientation XtOrientation XtorientVertical + screen Screen Screen parent's screen + sensitive Sensitive Boolean True + shown Shown Float 0.0 + thickness Thickness Dimension 14 + thumb Thumb Bitmap GreyPixmap + topOfThumb TopOfThumb Float 0.0 + translations Translations TranslationTable see source or doc + width Width Dimension thickness or length + x Position Position 0 + y Position Position 0 + +*/ + +/* + * Most things we need are in StringDefs.h + */ + +#ifndef XtNincrement +#define XtNincrement "increment" +#endif + +#ifndef XtNpageIncrement +#define XtNpageIncrement "pageIncrement" +#endif + +#ifndef XtNrepeatDelay +#define XtNrepeatDelay "repeatDelay" +#endif + +#ifndef XtNshowArrows +#define XtNshowArrows "showArrows" +#endif + +#ifndef XtNminimumThumb +#define XtNminimumThumb "minimumThumb" +#endif + +#ifndef XtNtopOfThumb +#define XtNtopOfThumb "topOfThumb" +#endif + +#ifndef XtNshown +#define XtNshown "shown" +#endif + +#ifndef XtNincrementProc +#define XtNincrementProc "incrementProc" +#endif + +#ifndef XtNdecrementProc +#define XtNdecrementProc "decrementProc" +#endif + +#ifndef XtNvalueChangedProc +#define XtNvalueChangedProc "valueChangedProc" +#endif + +#ifndef XtNpageIncrementProc +#define XtNpageIncrementProc "pageIncrementProc" +#endif + +#ifndef XtNpageDecrementProc +#define XtNpageDecrementProc "pageDecrementProc" +#endif + +#ifndef XtNdragProc +#define XtNdragProc "dragProc" +#endif + +#ifndef XtNtoTopProc +#define XtNtoTopProc "toTopProc" +#endif + +#ifndef XtNtoBottomProc +#define XtNtoBottomProc "toBottomProc" +#endif + +#ifndef XtCShowArrows +#define XtCShowArrows "ShowArrows" +#endif + +#ifndef XtCIncrement +#define XtCIncrement "Increment" +#endif + +#ifndef XtCMinimumThumb +#define XtCMinimumThumb "MinimumThumb" +#endif + +#ifndef XtCRepeatDelay +#define XtCRepeatDelay "RepeatDelay" +#endif + +#ifndef XtCShown +#define XtCShown "Shown" +#endif + +#ifndef XtCTopOfThumb +#define XtCTopOfThumb "TopOfThumb" +#endif + +#ifndef XtNthumbColor +#define XtNthumbColor "thumbColor" +#endif + +#ifndef XtCThumbColor +#define XtCThumbColor "ThumbColor" +#endif + +#ifndef XtNstripeColor +#define XtNstripeColor "stripeColor" +#endif + +#ifndef XtCStripeColor +#define XtCStripeColor "StripeColor" +#endif + + +enum XawScrollBarReasons{ + XawSB_INCREMENT = Xraw_SCROLLBAR, + XawSB_DECREMENT, + XawSB_PAGE_INCREMENT, + XawSB_PAGE_DECREMENT, + XawSB_VALUE_CHANGED, + XawSB_TOP, + XawSB_BOTTOM, + XawSB_DRAG +}; + +typedef struct { + int reason; + XEvent *event; + float top; + float shown; + Dimension topLoc; + Dimension shownLength; + Dimension length; +}XawScrollBarCallbackStruct; + +typedef struct _ScrollbarRec *ScrollbarWidget; +typedef struct _ScrollbarClassRec *ScrollbarWidgetClass; + +extern WidgetClass scrollbarWidgetClass; + +extern void XawScrollbarSetThumb( +#if NeedFunctionPrototypes + Widget /* scrollbar */, +#if NeedWidePrototypes + /* float */ double /* top */, + /* float */ double /* shown */ +#else + float /* top */, + float /* shown */ +#endif +#endif +); + +#endif /* _Scrollbar_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ScrollbarP.h b/vendor/x11iraf/obm/ObmW/Xraw/ScrollbarP.h new file mode 100644 index 00000000..29a5da8f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ScrollbarP.h @@ -0,0 +1,99 @@ +/* + * $XConsortium: ScrollbarP.h,v 1.2 90/04/11 17:33:53 jim Exp $ + */ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _ScrollbarP_h +#define _ScrollbarP_h + +#include <X11/Xraw/Scrollbar.h> +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/Arrow.h> + +#define BAR(w) ((ScrollbarWidget)w)->scrollbar + +typedef struct { + /* public */ + Pixel foreground; /* thumb foreground color */ + XtOrientation orientation; /* horizontal or vertical */ + float top; /* What percent is above the win's top */ + float shown; /* What percent is shown in the win */ + Dimension along; /* either height or width */ + Dimension cross; + Dimension min_thumb; /* minium size for the thumb. */ + Boolean showArrows; + Dimension increment; + Dimension page_increment; + int delay; + XtCallbackList incrementProc; + XtCallbackList decrementProc; + XtCallbackList pageIncrementProc; + XtCallbackList pageDecrementProc; + XtCallbackList valueChangedProc; + XtCallbackList dragProc; + XtCallbackList toTopProc; + XtCallbackList toBottomProc; + + + XtCallbackList scrollProc; /* proportional scroll */ + XtCallbackList thumbProc; /* jump (to position) scroll */ + XtCallbackList jumpProc; /* same as thumbProc but pass data by ref */ + + /* private */ + + int scrolling; /* a scrollbar status: FREE|BESY|MOVE */ + GC gc; /* a (shared) gc */ + int topLoc; /* Pixel that corresponds to top */ + Dimension shownLength;/* Num pixels corresponding to shown */ + + Dimension direction; + + int margin; + int newLoc; + int shift; + XtIntervalId timer; + XawDrawArrowStruct top_arrow; + XawDrawArrowStruct bot_arrow; +} ScrollbarPart; + +typedef struct _ScrollbarRec { + CorePart core; + SimplePart simple; + ScrollbarPart scrollbar; +} ScrollbarRec; + +typedef struct {int empty;} ScrollbarClassPart; + +typedef struct _ScrollbarClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ScrollbarClassPart scrollbar_class; +} ScrollbarClassRec; + +extern ScrollbarClassRec scrollbarClassRec; + +#endif /* _ScrollbarP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ScrolledTable.h b/vendor/x11iraf/obm/ObmW/Xraw/ScrolledTable.h new file mode 100644 index 00000000..65acf55d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ScrolledTable.h @@ -0,0 +1,104 @@ +/*********************************************************************** + + ScrolledTable widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _XawScrolledTable_H_ +#define _XawScrolledTable_H_ + +#include <X11/Xraw/Container.h> +#include <X11/Xraw/Viewport.h> + +/*#########################################################################*/ +/*# #*/ +/*# New Resources #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNdistance +#define XtNdistance "distance" +#endif + +#ifndef XtNsignWidget +#define XtNsignWidget "signWidget" +#endif + +#ifndef XtNscrollbarWidth +#define XtNscrollbarWidth "scrollbarWidth" +#endif + +#ifndef XtNframeWidth +#define XtNframeWidth "frameWidth" +#endif + +#ifndef XtNrowWidget +#define XtNrowWidget "rowWidget" +#endif + +#ifndef XtNstuffWidget +#define XtNstuffWidget "stuffWidget" +#endif + +#ifndef XtNcolumnWidget +#define XtNcolumnWidget "columnWidget" +#endif + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Classes #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtCColumnWidget +#define XtCColumnWidget "ColumnWidget" +#endif + +#ifndef XtCScrollbarWidth +#define XtCScrollbarWidth "ScrollbarWidth" +#endif + +#ifndef XtCSignWidget +#define XtCSignWidget "SignWidget" +#endif + +#ifndef XtCStuffWidget +#define XtCStuffWidget "StuffWidget" +#endif + +#ifndef XtCDistance +#define XtCDistance "Distance" +#endif + +#ifndef XtCFrameWidth +#define XtCFrameWidth "FrameWidth" +#endif + +#ifndef XtCRowWidget +#define XtCRowWidget "RowWidget" +#endif + + + +/*#########################################################################*/ +/*# #*/ +/*# Widget Class Pointer #*/ +/*# #*/ +/*#########################################################################*/ +extern WidgetClass scrolledTableWidgetClass; + +typedef struct _ScrolledTableClassRec *XrawScrolledTableWidgetClass; +typedef struct _ScrolledTableRec *XrawScrolledTableWidget; + +#endif /* _XawScrolledTable_H_ */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ScrolledTableP.h b/vendor/x11iraf/obm/ObmW/Xraw/ScrolledTableP.h new file mode 100644 index 00000000..9de6947b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ScrolledTableP.h @@ -0,0 +1,64 @@ +#ifndef _XawScrolledTableP_H_ +#define _XawScrolledTableP_H_ + +#include <X11/Xraw/ScrolledTable.h> +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/FrameP.h> + +typedef struct { + int unused; /* class variables */ +} ScrolledTableClassPart; + +typedef struct _ScrolledTableClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + ScrolledTableClassPart scrolled_table_class; +} ScrolledTableClassRec; + +typedef struct _ScrolledTablePart{ + + /* resources */ + + Dimension distance; + Dimension scrollbar_width; + Dimension frame_width; + XawFrameType frame_type; + Boolean allow_vertical_scrollbar; + Boolean allow_horizontal_scrollbar; + Boolean force_scrollbar; + + Widget sign_widget; + Widget row_widget; + Widget column_widget; + Widget stuff_widget; + + /* private state */ + + Widget row_clip; + Widget column_clip; + Widget stuff_clip; + + Position stuff_x; + Position stuff_y; + Dimension stuff_width; + Dimension stuff_height; + + Widget v_scroll; + Widget h_scroll; + +} ScrolledTablePart; + +typedef struct _ScrolledTableRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + ScrolledTablePart scrolled_table; +} ScrolledTableRec; + +extern ScrolledTableClassRec scrolledTableClassRec; + +#endif /* _XawScrolledTableP_H_ */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Separator.h b/vendor/x11iraf/obm/ObmW/Xraw/Separator.h new file mode 100644 index 00000000..6d5ad87f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Separator.h @@ -0,0 +1,99 @@ +#ifndef _XawSeparator_h +#define _XawSeparator_h + +/*********************************************************************** + * + * Separator Widget + * + ***********************************************************************/ + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Simple.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + mappedWhenManaged MappedWhenManaged Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + + + + +typedef enum { + XawSINGLE_LINE = Xraw_SEPARATOR, + XawDOUBLE_LINE, + XawSHADOW_ETCHED_IN, + XawSHADOW_ETCHED_OUT +} XawSeparatorType; + + +#define XawSingle_Line "singleline" +#define XawDouble_Line "doubleline" +#define XawShadow_Etched_In "shadowetchedin" +#define XawShadow_Etched_Out "shadowetchedout" + + + +#ifndef XtNmargin +#define XtNmargin "margin" +#endif + +#ifndef XtCMargin +#define XtCMargin "Margin" +#endif + +#ifndef XtNseparatorType +#define XtNseparatorType "separatorType" +#endif + +#ifndef XtCSeparatorType +#define XtCSeparatorType "SeparatorType" +#endif + +#ifndef XtRSeparatorType +#define XtRSeparatorType "SeparatorType" +#endif + +#define XawTextEncoding8bit 0 +#define XawTextEncodingChar2b 1 + +#define XtNleftBitmap "leftBitmap" +#define XtCLeftBitmap "LeftBitmap" +#define XtNencoding "encoding" +#define XtCEncoding "Encoding" + +#ifndef _XtStringDefs_h_ +#define XtNbitmap "bitmap" +#define XtNforeground "foreground" +#define XtNseparator "separator" +#define XtNfont "font" +#define XtNinternalWidth "internalWidth" +#define XtNinternalHeight "internalHeight" +#define XtNresize "resize" +#define XtCResize "Resize" +#define XtCBitmap "Bitmap" +#endif + +/* Class record constants */ + +extern WidgetClass separatorWidgetClass; + +typedef struct _SeparatorClassRec *SeparatorWidgetClass; +typedef struct _SeparatorRec *SeparatorWidget; + +#endif /* _XawSeparator_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SeparatorP.h b/vendor/x11iraf/obm/ObmW/Xraw/SeparatorP.h new file mode 100644 index 00000000..75250d38 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SeparatorP.h @@ -0,0 +1,60 @@ +/* + * SeparatorP.h - Private definitions for Separator widget + * + */ + +#ifndef _XawSeparatorP_h +#define _XawSeparatorP_h + +/*********************************************************************** + * + * Separator Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/Separator.h> + + +/* New fields for the Separator widget class record */ + +typedef struct {int foo;} SeparatorClassPart; + +/* Full class record declaration */ +typedef struct _SeparatorClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + SeparatorClassPart separator_class; +} SeparatorClassRec; + +extern SeparatorClassRec separatorClassRec; + +/* New fields for the Separator widget record */ + +typedef struct { + + /* Public Resources */ + XtOrientation orientation; + Dimension margin; + XawSeparatorType separatorType; + + /* Private part */ + GC gc; + +} SeparatorPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SeparatorRec { + CorePart core; + SimplePart simple; + SeparatorPart separator; +} SeparatorRec; + +#endif /* _XawSeparatorP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Simple.h b/vendor/x11iraf/obm/ObmW/Xraw/Simple.h new file mode 100644 index 00000000..bbe11cda --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Simple.h @@ -0,0 +1,96 @@ +/* + * $XConsortium: Simple.h,v 1.9 89/07/21 01:44:53 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _Simple_h +#define _Simple_h + +/**************************************************************** + * + * Simple widgets + * + ****************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + insensitiveBorder Insensitive Pixmap Gray + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + + shadowWidth ShadowWidth Dimension 2 + topShadowPixel TopShadowPixel Pixel dynamic + bottomShadowPixel BottomShadowPixel Pixel dynamic + topShadowContrast TopShadowContrast Int 20 + bottomShadowContrast BottomShadowContrast Int 40 + userData UserData XtPointer NULL + beNiceToColormap BeNiceToColormap Boolean False + +*/ + +#define XtNcursor "cursor" +#define XtNinsensitiveBorder "insensitiveBorder" +#define XtNuserData "userData" +#define XtCUserData "UserData" + +#define XtCInsensitive "Insensitive" + +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNhighlightPixmap "highlightPixmap" +#define XtCHighlightPixmap "HighlightPixmap" +#define XtNhighlightThickness "highlightThickness" +#define XtCHighlightThickness "HighlightThickness" + + +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNhighlightPixel "highlightPixel" +#define XtCHighlightPixel "HighlightPixel" + +typedef struct _SimpleClassRec *SimpleWidgetClass; +typedef struct _SimpleRec *SimpleWidget; + +extern WidgetClass simpleWidgetClass; + +#endif /* _Simple_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SimpleMenP.h b/vendor/x11iraf/obm/ObmW/Xraw/SimpleMenP.h new file mode 100644 index 00000000..32f5ccf9 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SimpleMenP.h @@ -0,0 +1,113 @@ +/* + * $XConsortium: SimpleMenP.h,v 1.12 89/12/11 15:01:39 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* + * SimpleMenuP.h - Private Header file for SimpleMenu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SimpleMenuP_h +#define _SimpleMenuP_h + +#include <X11/ShellP.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/SimpleMenu.h> +#include <X11/Xraw/SmeP.h> + +#define SMW(w) ((SimpleMenuWidget)w)->simple_menu + +typedef struct { + XtPointer extension; /* For future needs. */ +} SimpleMenuClassPart; + +typedef struct _SimpleMenuClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ShellClassPart shell_class; + OverrideShellClassPart override_shell_class; + SimpleMenuClassPart simpleMenu_class; +} SimpleMenuClassRec; + +extern SimpleMenuClassRec simpleMenuClassRec; + +typedef struct _SimpleMenuPart { + /* resources */ + Dimension shadow_thickness; + Dimension bsb_shadow_thickness; + + Pixel top_shadow_color; + Pixmap top_shadow_pixmap; + Pixel bottom_shadow_color; + Pixmap bottom_shadow_pixmap; + + GC top_shadow_GC; + GC bottom_shadow_GC; + + XawFrameType frame_type; + + XtPointer user_data; + + /* resources */ + + String label_string; /* The string for the label or NULL. */ + SmeObject label; /* If label_string is non-NULL then this is + the label widget. */ + WidgetClass label_class; /* Widget Class of the menu label object. */ + + Dimension top_margin; /* Top and bottom margins. */ + Dimension bottom_margin; + Dimension row_height; /* height of each row (menu entry) */ + + Cursor cursor; /* The menu's cursor. */ + SmeObject popup_entry; /* The entry to position the cursor on for + when using XawPositionSimpleMenu. */ + Boolean menu_on_screen; /* Force the menus to be fully on the screen.*/ + int backing_store; /* What type of backing store to use. */ + + /* private state */ + + Boolean recursive_set_values; /* contain a possible infinite loop. */ + + Boolean menu_width; /* If true then force width to remain + core.width */ + Boolean menu_height; /* Just like menu_width, but for height. */ + + SmeObject entry_set; /* The entry that is currently set or + highlighted. */ +} SimpleMenuPart; + +typedef struct _SimpleMenuRec { + CorePart core; + CompositePart composite; + ShellPart shell; + OverrideShellPart override; + SimpleMenuPart simple_menu; +} SimpleMenuRec, *SimpleMenu; + +#endif /* _SimpleMenuP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SimpleMenu.h b/vendor/x11iraf/obm/ObmW/Xraw/SimpleMenu.h new file mode 100644 index 00000000..752be892 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SimpleMenu.h @@ -0,0 +1,169 @@ +/* + * $XConsortium: SimpleMenu.h,v 1.17 89/12/11 15:01:55 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SimpleMenu.h - Public Header file for SimpleMenu widget. + * + * This is the public header file for the Athena SimpleMenu widget. + * It is intended to provide one pane pulldown and popup menus within + * the framework of the X Toolkit. As the name implies it is a first and + * by no means complete implementation of menu code. It does not attempt to + * fill the needs of all applications, but does allow a resource oriented + * interface to menus. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SimpleMenu_h +#define _SimpleMenu_h + +#include <X11/Shell.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * SimpleMenu widget + * + ****************************************************************/ + +/* SimpleMenu Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + backgroundPixmap BackgroundPixmap Pixmap None + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap BorderPixmap Pixmap None + borderWidth BorderWidth Dimension 1 + bottomMargin VerticalMargins Dimension VerticalSpace + columnWidth ColumnWidth Dimension Width of widest text + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + label Label String NULL (No label) + labelClass LabelClass Pointer smeBSBObjectClass + mappedWhenManaged MappedWhenManaged Boolean True + rowHeight RowHeight Dimension Height of Font + sensitive Sensitive Boolean True + topMargin VerticalMargins Dimension VerticalSpace + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +typedef struct _SimpleMenuClassRec* SimpleMenuWidgetClass; +typedef struct _SimpleMenuRec* SimpleMenuWidget; + +extern WidgetClass simpleMenuWidgetClass; + +#define XtNcursor "cursor" +#define XtNbottomMargin "bottomMargin" +#define XtNcolumnWidth "columnWidth" +#define XtNlabelClass "labelClass" +#define XtNmenuOnScreen "menuOnScreen" +#define XtNpopupOnEntry "popupOnEntry" +#define XtNrowHeight "rowHeight" +#define XtNtopMargin "topMargin" + +#define XtCColumnWidth "ColumnWidth" +#define XtCLabelClass "LabelClass" +#define XtCMenuOnScreen "MenuOnScreen" +#define XtCPopupOnEntry "PopupOnEntry" +#define XtCRowHeight "RowHeight" +#define XtCVerticalMargins "VerticalMargins" + +/* New fields */ +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNbsbShadowWidth "bsbShadowWidth" +#define XtCBsbShadowWidth "BsbShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNuserData "userData" +#define XtCUserData "UserData" +#define XtNframeType "frameType" +#define XtCFrameType "FrameType" +#define XtRFrameType "FrameType" + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawSimpleMenuAddGlobalActions + * Description: adds the global actions to the simple menu widget. + * Arguments: app_con - the appcontext. + * Returns: none. + */ + +void +XawSimpleMenuAddGlobalActions(/* app_con */); +/* +XtAppContext app_con; +*/ + +/* Function Name: XawSimpleMenuGetActiveEntry + * Description: Gets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: the currently set entry or NULL if none is set. + */ + +Widget +XawSimpleMenuGetActiveEntry( /* w */); +/* +Widget w; +*/ + +/* Function Name: XawSimpleMenuClearActiveEntry + * Description: Unsets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: none. + */ + +void +XawSimpleMenuClearActiveEntry(/* w */); +/* +Widget w; +*/ + +#endif /* _SimpleMenu_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SimpleP.h b/vendor/x11iraf/obm/ObmW/Xraw/SimpleP.h new file mode 100644 index 00000000..f4044709 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SimpleP.h @@ -0,0 +1,62 @@ +#ifndef _SimpleP_h +#define _SimpleP_h + +#include <X11/IntrinsicP.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Simple.h> + +#define SIMPLE(w) ((SimpleWidget) w)->simple + +typedef Boolean (*XawDisplayRectProc) Xraw_PROTO((Widget, XRectangle * )); +typedef Boolean (*XawChangeSensitive) Xraw_PROTO((Widget)); + +typedef struct { + XawChangeSensitive change_sensitive; + XawDisplayRectProc display_rect; + caddr_t extension; +} SimpleClassPart; + +typedef struct _SimpleClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; +} SimpleClassRec; + +extern SimpleClassRec simpleClassRec; + +typedef struct { + /* resources */ + Cursor cursor; + Pixmap insensitive_border; + Pixel foreground; + + Dimension shadow_thickness; + Pixel top_shadow_color; + Pixmap top_shadow_pixmap; + Pixel bottom_shadow_color; + Pixmap bottom_shadow_pixmap; + Pixel highlight_color; + Pixmap highlight_pixmap; + Dimension highlight_thickness; + + caddr_t user_data; + + /* private state */ + GC top_shadow_GC; + GC bottom_shadow_GC; + GC highlight_GC; +} SimplePart; + +typedef struct _SimpleRec { + CorePart core; + SimplePart simple; +} SimpleRec; + +#define SIMPLE_MARGIN(w) (((SimpleWidget)w)->simple.highlight_thickness + \ + ((SimpleWidget)w)->simple.shadow_thickness) + +#define XtSimpleClass(w) ((SimpleWidgetClass)XtClass(w)) +#define XtInheritDisplayRectProc ((Boolean (*)())_XtInherit) +#define XtInheritChangeSensitive ((Boolean (*)())_XtInherit) + +#endif /* _SimpleP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Sme.h b/vendor/x11iraf/obm/ObmW/Xraw/Sme.h new file mode 100644 index 00000000..23d567cd --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Sme.h @@ -0,0 +1,66 @@ +/* + * $XConsortium: Sme.h,v 1.4 89/12/11 15:20:09 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Sme.h - Public Header file for Sme object. + * + * This is the public header file for the Athena Sme object. + * It is intended to be used with the simple menu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _Sme_h +#define _Sme_h + +#include <X11/RectObj.h> + +/**************************************************************** + * + * Sme Object + * + ****************************************************************/ + +/* + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Pointer NULL + destroyCallback Callback Pointer NULL + height Height Dimension 0 + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +typedef struct _SmeClassRec* SmeObjectClass; +typedef struct _SmeRec* SmeObject; + +extern WidgetClass smeObjectClass; + +#endif /* _Sme_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SmeBSB.h b/vendor/x11iraf/obm/ObmW/Xraw/SmeBSB.h new file mode 100644 index 00000000..6e72b38f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SmeBSB.h @@ -0,0 +1,109 @@ +/* + * $XConsortium: SmeBSB.h,v 1.5 89/12/11 15:20:14 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * SmeBSB.h - Public Header file for SmeBSB object. + * + * This is the public header file for the Athena BSB Sme object. + * It is intended to be used with the simple menu widget. This object + * provides bitmap - string - bitmap style entries. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SmeBSB_h +#define _SmeBSB_h + +#include <X11/Xmu/Converters.h> + +#include <X11/Xraw/Sme.h> + +/**************************************************************** + * + * SmeBSB object + * + ****************************************************************/ + +/* BSB Menu Entry Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Callback NULL + destroyCallback Callback Pointer NULL + font Font XFontStruct * XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 0 + label Label String Name of entry + leftBitmap LeftBitmap Pixmap None + leftMargin HorizontalMargins Dimension 4 + rightBitmap RightBitmap Pixmap None + rightMargin HorizontalMargins Dimension 4 + sensitive Sensitive Boolean True + vertSpace VertSpace int 25 + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +typedef struct _SmeBSBClassRec *SmeBSBObjectClass; +typedef struct _SmeBSBRec *SmeBSBObject; + +extern WidgetClass smeBSBObjectClass; + +#ifndef XtNmfore +#define XtNmfore "mfore" +#endif + +#ifndef XtNstate +#define XtNstate "state" +#endif + +#ifndef XtCState +#define XtCState "State" +#endif + +#ifndef XtNswitched +#define XtNswitched "switched" +#endif + +#ifndef XtCSwitched +#define XtCSwitched "Switched" +#endif + +#define XtNleftBitmap "leftBitmap" +#define XtNleftMargin "leftMargin" +#define XtNrightBitmap "rightBitmap" +#define XtNrightMargin "rightMargin" +#define XtNvertSpace "vertSpace" + +#define XtCLeftBitmap "LeftBitmap" +#define XtCHorizontalMargins "HorizontalMargins" +#define XtCRightBitmap "RightBitmap" +#define XtCVertSpace "VertSpace" + +#endif /* _SmeBSB_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SmeBSBP.h b/vendor/x11iraf/obm/ObmW/Xraw/SmeBSBP.h new file mode 100644 index 00000000..63427ff3 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SmeBSBP.h @@ -0,0 +1,121 @@ +/* + * $XConsortium: SmeBSBP.h,v 1.6 89/12/11 15:20:15 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SmeP.h - Private definitions for Sme object + * + */ + +#ifndef _XawSmeBSBP_h +#define _XawSmeBSBP_h + +/*********************************************************************** + * + * Sme Object Private Data + * + ***********************************************************************/ + +#include <X11/Xraw/SmeP.h> +#include <X11/Xraw/SmeBSB.h> + +/************************************************************ + * + * New fields for the Sme Object class record. + * + ************************************************************/ + +typedef struct _SmeBSBClassPart { + XtPointer extension; +} SmeBSBClassPart; + +/* Full class record declaration */ +typedef struct _SmeBSBClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; + SmeBSBClassPart sme_bsb_class; +} SmeBSBClassRec; + +extern SmeBSBClassRec smeBSBClassRec; + +/* New fields for the Sme Object record */ +typedef struct { + /* resources */ + String label; /* The entry label. */ + int vert_space; /* Extra vert space to leave, */ + /* as a percentage of the font height */ + /* of the label. */ + Pixmap left_bitmap; + Pixmap right_bitmap; /* Bitmaps to show. */ + + Dimension left_margin; + Dimension right_margin; /* Left and right margins. */ + + Pixel foreground; /* Foreground color. */ + Pixel mfore; + + XFontStruct * font; /* The font to show label in. */ + XtJustify justify; /* Justification for the label. */ + + Boolean state; + Boolean switched; + + XtPointer user_data; + +/* private resources. */ + + Boolean set_values_area_cleared; /* Remember if we need to unhighlight. */ + GC norm_gc; /* noral color gc. */ + GC rev_gc; /* reverse color gc. */ + GC norm_gray_gc; /* Normal color (grayed out) gc. */ + GC invert_gc; /* gc for flipping colors. */ + GC mfore_gc; + + Dimension left_bitmap_width; /* size of each bitmap. */ + Dimension left_bitmap_height; + Dimension right_bitmap_width; + Dimension right_bitmap_height; + +} SmeBSBPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SmeBSBRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; + SmeBSBPart sme_bsb; +} SmeBSBRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#endif /* _XawSmeBSBP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SmeLine.h b/vendor/x11iraf/obm/ObmW/Xraw/SmeLine.h new file mode 100644 index 00000000..c8bb834f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SmeLine.h @@ -0,0 +1,75 @@ +/* + * $XConsortium: SmeLine.h,v 1.3 89/12/11 15:20:19 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* + * SmeLine.h - Public Header file for SmeLine object. + * + * This is the public header file for the Athena SmeLine object. + * It is intended to be used with the simple menu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SmeLine_h +#define _SmeLine_h + +#include <X11/Xraw/Sme.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * SmeLine Object + * + ****************************************************************/ + +/* Menu Entry Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Pointer NULL + destroyCallback Callback Pointer NULL + height Height Dimension 0 + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +#define XtCLineWidth "LineWidth" +#define XtCStipple "Stipple" + +#define XtNlineWidth "lineWidth" +#define XtNstipple "stipple" + +typedef struct _SmeLineClassRec* SmeLineObjectClass; +typedef struct _SmeLineRec* SmeLineObject; + +extern WidgetClass smeLineObjectClass; + +#endif /* _SmeLine_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SmeLineP.h b/vendor/x11iraf/obm/ObmW/Xraw/SmeLineP.h new file mode 100644 index 00000000..8cb9412a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SmeLineP.h @@ -0,0 +1,93 @@ +/* + * $XConsortium: SmeLineP.h,v 1.3 89/12/11 15:20:20 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SmeLineP.h - Private definitions for SmeLine widget + * + */ + +#ifndef _XawSmeLineP_h +#define _XawSmeLineP_h + +/*********************************************************************** + * + * SmeLine Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xraw/SmeP.h> +#include <X11/Xraw/SmeLine.h> + +/************************************************************ + * + * New fields for the SmeLine widget class record. + * + ************************************************************/ + +typedef struct _SmeLineClassPart { + XtPointer extension; +} SmeLineClassPart; + +/* Full class record declaration */ +typedef struct _SmeLineClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; + SmeLineClassPart sme_line_class; +} SmeLineClassRec; + +extern SmeLineClassRec smeLineClassRec; + +/* New fields for the SmeLine widget record */ +typedef struct { + /* resources */ + Pixel foreground; /* Foreground color. */ + Pixmap stipple; /* Line Stipple. */ + Dimension line_width; /* Width of the line. */ + + /* private data. */ + + GC gc; /* Graphics context for drawing line. */ +} SmeLinePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SmeLineRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; + SmeLinePart sme_line; +} SmeLineRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#endif /* _XawSmeLineP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/SmeP.h b/vendor/x11iraf/obm/ObmW/Xraw/SmeP.h new file mode 100644 index 00000000..92726393 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/SmeP.h @@ -0,0 +1,102 @@ +/* + * $XConsortium: SmeP.h,v 1.4 89/12/11 15:20:22 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * SmeP.h - Private Header file for Sme object. + * + * This is the private header file for the Athena Sme object. + * This object is intended to be used with the simple menu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawSmeP_h +#define _XawSmeP_h + +/*********************************************************************** + * + * Sme Widget Private Data + * + ***********************************************************************/ + +#include <X11/RectObjP.h> +#include <X11/Xraw/Sme.h> + +/************************************************************ + * + * New fields for the Sme widget class record. + * + ************************************************************/ + +typedef struct _SmeClassPart { + XtWidgetProc highlight; + XtWidgetProc unhighlight; + XtWidgetProc notify; + XtPointer extension; +} SmeClassPart; + +/* Full class record declaration */ +typedef struct _SmeClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; +} SmeClassRec; + +extern SmeClassRec smeClassRec; + +/* New fields for the Sme widget record */ +typedef struct { + /* resources */ + XtCallbackList callbacks; /* The callback list */ + XtPointer user_data; + +} SmePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SmeRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; +} SmeRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +typedef void (*_XawEntryVoidFunc)(); + +#define XtInheritHighlight ((_XawEntryVoidFunc) _XtInherit) +#define XtInheritUnhighlight XtInheritHighlight +#define XtInheritNotify XtInheritHighlight + +#endif /* _XawSmeP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/StripCharP.h b/vendor/x11iraf/obm/ObmW/Xraw/StripCharP.h new file mode 100644 index 00000000..02670325 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/StripCharP.h @@ -0,0 +1,83 @@ +/* +* $XConsortium: StripCharP.h,v 1.4 90/10/22 14:38:15 converse Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawStripChartP_h +#define _XawStripChartP_h + +#include <X11/Xraw/StripChart.h> +#include <X11/Xraw/SimpleP.h> + +#define NO_GCS 0 +#define FOREGROUND 1 << 0 +#define HIGHLIGHT 1 << 1 +#define ALL_GCS (FOREGROUND | HIGHLIGHT) + +/* New fields for the stripChart widget instance record */ + +typedef struct { + Pixel fgpixel; /* color index for graph */ + Pixel hipixel; /* color index for lines */ + GC fgGC; /* graphics context for fgpixel */ + GC hiGC; /* graphics context for hipixel */ + + /* start of graph stuff */ + + int update; /* update frequence */ + int scale; /* scale factor */ + int min_scale; /* smallest scale factor */ + int interval; /* data point interval */ + XPoint * points ; /* Poly point for repairing graph lines. */ + double max_value; /* Max Value in window */ + double valuedata[2048];/* record of data points */ + XtIntervalId interval_id; + XtCallbackList get_value; /* proc to call to fetch load pt */ + int jump_val; /* Amount to jump on each scroll. */ +} StripChartPart; + +/* Full instance record declaration */ +typedef struct _StripChartRec { + CorePart core; + SimplePart simple; + StripChartPart strip_chart; +} StripChartRec; + +/* New fields for the StripChart widget class record */ +typedef struct {int dummy;} StripChartClassPart; + +/* Full class record declaration. */ +typedef struct _StripChartClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + StripChartClassPart strip_chart_class; +} StripChartClassRec; + +/* Class pointer. */ +extern StripChartClassRec stripChartClassRec; + +#endif /* _XawStripChartP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/StripChart.h b/vendor/x11iraf/obm/ObmW/Xraw/StripChart.h new file mode 100644 index 00000000..bb607269 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/StripChart.h @@ -0,0 +1,94 @@ +/* $XConsortium: StripChart.h,v 1.5 91/07/26 22:50:35 converse Exp $ */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawStripChart_h +#define _XawStripChart_h + +/*********************************************************************** + * + * StripChart Widget + * + ***********************************************************************/ + +/* StripChart resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + accelerators Accelerators AcceleratorTable NULL + ancestorSensitive AncestorSensitive Boolean True + background Background Pixel XtDefaultBackground + backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderWidth BorderWidth Dimension 1 + colormap Colormap Colormap parent's colormap + cursor Cursor Cursor None + cursorName Cursor String NULL + depth Depth int parent's depth + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + getValue Callback XtCallbackList NULL + height Height Dimension 120 + highlight Foreground Pixel XtDefaultForeground + insensitiveBorder Insensitive Pixmap GreyPixmap + jumpScroll JumpScroll int 1/2 width + mappedWhenManaged MappedWhenManaged Boolean True + minScale Scale int 1 + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + screen Screen Screen parent's screen + sensitive Sensitive Boolean True + translations Translations TranslationTable NULL + update Interval int 10 (seconds) + width Width Dimension 120 + x Position Position 0 + y Position Position 0 + +*/ + +#define DEFAULT_JUMP -1 + +#ifndef _XtStringDefs_h_ +#define XtNhighlight "highlight" +#define XtNupdate "update" +#endif + +#define XtCJumpScroll "JumpScroll" +#define XtCScale "Scale" + +#define XtNgetValue "getValue" +#define XtNjumpScroll "jumpScroll" +#define XtNminScale "minScale" +#define XtNscale "scale" +#define XtNvmunix "vmunix" + +typedef struct _StripChartRec *StripChartWidget; +typedef struct _StripChartClassRec *StripChartWidgetClass; + +extern WidgetClass stripChartWidgetClass; + +#endif /* _XawStripChart_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Table.h b/vendor/x11iraf/obm/ObmW/Xraw/Table.h new file mode 100644 index 00000000..4c7ab5cf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Table.h @@ -0,0 +1,539 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _XawTable_h +#define _XawTable_h + +#include <X11/Xmu/Converters.h> + +#include <X11/Xraw/Simple.h> +#include <X11/Xraw/XawInit.h> + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resources #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XawTextEncoding8bit +#define XawTextEncoding8bit 0 +#endif +#ifndef XawTextEncodingChar2b +#define XawTextEncodingChar2b 1 +#endif + +#ifndef XtNliteral +#define XtNliteral "literal" +#endif + +#ifndef XtNrows +#define XtNrows "rows" +#endif + +#ifndef XtNcolumns +#define XtNcolumns "columns" +#endif + + +#ifndef XtNmaskNumber +#define XtNmaskNumber "maskNumber" +#endif + +#ifndef XtNrowOriented +#define XtNrowOriented "rowOriented" +#endif + +#ifndef XtNeditForeground +#define XtNeditForeground "editForeground" +#endif + +#ifndef XtNeditBackground +#define XtNeditBackground "editBackground" +#endif + +#ifndef XtNcolumnForeground +#define XtNcolumnForeground "columnForeground" +#endif + +#ifndef XtNrowForeground +#define XtNrowForeground "rowForeground" +#endif + +#ifndef XtNvetricalScroll +#define XtNvetricalScroll "vetricalScroll" +#endif + +#ifndef XtNhorizontalScroll +#define XtNhorizontalScroll "horizontalScroll" +#endif + +#ifndef XtNcolumnsWidth +#define XtNcolumnsWidth "columnsWidth" +#endif + +#ifndef XtNrowHeight +#define XtNrowHeight "rowHeight" +#endif + +#ifndef XtNdefaultWidth +#define XtNdefaultWidth "defaultWidth" +#endif + +#ifndef XtNeditable +#define XtNeditable "editable" +#endif + +#ifndef XtNliteralWidth +#define XtNliteralWidth "literalWidth" +#endif + +#ifndef XtNtableMargin +#define XtNtableMargin "tableMargin" +#endif + +#ifndef XtNrowMargin +#define XtNrowMargin "rowMargin" +#endif + +#ifndef XtNcolumnMargin +#define XtNcolumnMargin "columnMargin" +#endif + +#ifndef XtNlabelShadowWidth +#define XtNlabelShadowWidth "labelShadowWidth" +#endif + +#ifndef XtNencoding +#define XtNencoding "encoding" +#endif + + + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Classes #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtCLiteral +#define XtCLiteral "Literal" +#endif + +#ifndef XtCColumns +#define XtCColumns "Columns" +#endif + +#ifndef XtCMaskNumber +#define XtCMaskNumber "MaskNumber" +#endif + +#ifndef XtCScroll +#define XtCScroll "Scroll" +#endif + +#ifndef XtCColumnsWidth +#define XtCColumnsWidth "ColumnsWidth" +#endif + +#ifndef XtCRowHeight +#define XtCRowHeight "RowHeight" +#endif + +#ifndef XtCDefaultWidth +#define XtCDefaultWidth "DefaultWidth" +#endif + +#ifndef XtCEditable +#define XtCEditable "Editable" +#endif + +#ifndef XtCLiteralWidth +#define XtCLiteralWidth "LiteralWidth" +#endif + +#ifndef XtCRows +#define XtCRows "Rows" +#endif + +#ifndef XtCTableMargin +#define XtCTableMargin "TableMargin" +#endif + +#ifndef XtCRowMargin +#define XtCRowMargin "RowMargin" +#endif + +#ifndef XtCColumnMargin +#define XtCColumnMargin "ColumnMargin" +#endif + +#ifndef XtCLabelShadowWidth +#define XtCLabelShadowWidth "LabelShadowWidth" +#endif + +#ifndef XtCEncoding +#define XtCEncoding "Encoding" +#endif + + + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Types #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtRColumnsWidth +#define XtRColumnsWidth "ColumnsWidth" +#endif + +#ifndef XtCRowOriented +#define XtCRowOriented "RowOriented" +#endif + + +/*#########################################################################*/ +/*# #*/ +/*# Allowance Callbacks #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNallowAddColumn +#define XtNallowAddColumn "allowAddColumn" +#endif + +#ifndef XtNallowAddRow +#define XtNallowAddRow "allowAddRow" +#endif + +#ifndef XtNallowDeleteColumn +#define XtNallowDeleteColumn "allowDeleteColumn" +#endif + +#ifndef XtNallowDeleteRow +#define XtNallowDeleteRow "allowDeleteRow" +#endif + +#ifndef XtNallowDeleteTable +#define XtNallowDeleteTable "allowDeleteTable" +#endif + + +/*#########################################################################*/ +/*# #*/ +/*# Information Callbacks #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNaddColumn +#define XtNaddColumn "addColumn" +#endif + +#ifndef XtNaddRow +#define XtNaddRow "addRow" +#endif + +#ifndef XtNchangedCell +#define XtNchangedCell "changedCell" +#endif + +#ifndef XtNchangedColumnWidth +#define XtNchangedColumnWidth "changedColumnWidth" +#endif + +#ifndef XtNchangedRowHeight +#define XtNchangedRowHeight "changedRowHeight" +#endif + +#ifndef XtNcreateTable +#define XtNcreateTable "createTable" +#endif + +#ifndef XtNdeleteColumn +#define XtNdeleteColumn "deleteColumn" +#endif + +#ifndef XtNdeleteRow +#define XtNdeleteRow "deleteRow" +#endif + +#ifndef XtNdeleteTable +#define XtNdeleteTable "deleteTable" +#endif + +#ifndef XtNwhatCell +#define XtNwhatCell "whatCell" +#endif + + + +/*#########################################################################*/ +/*# #*/ +/*# XawTableCell & XawTableColumn #*/ +/*# #*/ +/*#########################################################################*/ +typedef struct _XawTableCellRec *XawTableCell; /* opaque to outside */ + +typedef struct _XawTableColumnRec *XawTableColumn; /* opaque to outside */ + + + +/*#########################################################################*/ +/*# #*/ +/*# Bypass Routine and Direction Types #*/ +/*# #*/ +/*#########################################################################*/ +typedef Boolean (*XawTableProc) Xraw_PROTO((Widget, + int, + int, + XawTableCell, + XtPointer)); +enum XawTableBypassDirection{ + XawTABLE_RIGHT_DOWN, + XawTABLE_DOWN_RIGHT +}; + + +/*#########################################################################*/ +/*# #*/ +/*# Callback Reasons #*/ +/*# #*/ +/*#########################################################################*/ +enum XawTableReasons{ + XawTABLE_ALLOW_ADD_COLUMN = Xraw_TABLE, + XawTABLE_ALLOW_ADD_ROW, + XawTABLE_ALLOW_CREATE_TABLE, + XawTABLE_ALLOW_DELETE_COLUMN, + XawTABLE_ALLOW_DELETE_ROW, + XawTABLE_ALLOW_DELETE_TABLE, + + XawTABLE_ADD_COLUMN, + XawTABLE_ADD_ROW, + XawTABLE_CHANGED_CELL, + XawTABLE_CHANGED_COLUMN_WIDTH, + XawTABLE_CHANGED_ROW_HEIGHT, + XawTABLE_CREATE_TABLE, + XawTABLE_DELETE_COLUMN, + XawTABLE_DELETE_ROW, + XawTABLE_DELETE_TABLE, + XawTABLE_WHAT_CELL +}; + + +/*#########################################################################*/ +/*# #*/ +/*# Callback Structure #*/ +/*# #*/ +/*#########################################################################*/ +typedef struct { + int reason; + XEvent *event; + XawTableCell old_cell; + XawTableCell new_cell; + int row; + int column; + Boolean do_it; +}XawTableCallbackStruct; + + +/*#########################################################################*/ +/*# #*/ +/*# Layout Control Routine #*/ +/*# #*/ +/*#########################################################################*/ +extern void XawTableDoLayout Xraw_PROTO((Widget w, + Boolean do_layout)); + + +/*#########################################################################*/ +/*# #*/ +/*# Stuff Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTableSetNewSize Xraw_PROTO((Widget w, + int rows, + int columns)); + +extern void XawTableGetSize Xraw_PROTO((Widget w, + int *rows, + int *columns)); + + +/*#########################################################################*/ +/*# #*/ +/*# Row Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTablePrependRow Xraw_PROTO((Widget w)); + +extern int XawTableAppendRow Xraw_PROTO((Widget w)); + +extern int XawTableInsertRow Xraw_PROTO((Widget w, int row)); + +extern int XawTableDeleteRow Xraw_PROTO((Widget w, int row)); + + +/*#########################################################################*/ +/*# #*/ +/*# Column Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTablePrependColumn Xraw_PROTO((Widget w, int width)); + +extern int XawTableAppendColumn Xraw_PROTO((Widget w, int width)); + +extern int XawTableInsertColumn Xraw_PROTO((Widget w, + int column, + int width)); + +extern int XawTableDeleteColumn Xraw_PROTO((Widget w, int column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Set Label Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern char *XawTableGetLabelByCell Xraw_PROTO((XawTableCell cell)); + +extern char *XawTableGetLabelByPosition Xraw_PROTO((Widget w, + int row, + int column)); + +extern int XawTableSetLabel Xraw_PROTO((Widget w, + int row, + int column, + char *label)); + + +/*#########################################################################*/ +/*# #*/ +/*# Bypass Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern Boolean XawTableWalk Xraw_PROTO((Widget w, + XawTableProc proc, + int b_row, + int e_row, + int b_column, + int e_column, + int direction, + int *row, int *column, + XtPointer client_data)); + +extern Boolean XawTableSearchLabel Xraw_PROTO((Widget w, + char *name, + int *row, + int *column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Edit Cell Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern Boolean XawTableIsEditManaged Xraw_PROTO((Widget w)); + +extern void XawTableGetEditPosition Xraw_PROTO((Widget w, + int *row, + int *column)); + +extern void XawTableUnsetEdit Xraw_PROTO((Widget w)); + +extern void XawTableSetEdit Xraw_PROTO((Widget w, + int row, + int column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Set Colour Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTableSetCellBackground Xraw_PROTO((Widget w, + int row, + int column, + Pixel background)); + +extern int XawTableSetCellForeground Xraw_PROTO((Widget w, + int row, + int column, + Pixel foreground)); + +extern int XawTableSetCellDefaultColours Xraw_PROTO((Widget w, + int row, + int column)); + +extern int XawTableSetCellColours Xraw_PROTO((Widget w, + int row, + int column, + Pixel foreground, + Pixel background)); + + +extern void XawTableGetCellColours Xraw_PROTO((Widget w, + int row, + int column, + Pixel *foreground, + Pixel *background)); + +extern void XawTableGetCellColoursByCell Xraw_PROTO((Widget w, + XawTableCell cell, + Pixel *foreground, + Pixel *background)); + + +/*#########################################################################*/ +/*# #*/ +/*# Column Deta #*/ +/*# #*/ +/*#########################################################################*/ +extern void XawTableSetColumnJustify Xraw_PROTO((Widget w, + int column, + XtJustify justify)); + +extern XtJustify XawTableGetColumnJustify Xraw_PROTO((Widget w, + int column)); + +extern void XawTableSetColumnWidth Xraw_PROTO((Widget w, + int column, + int width)); + +extern int XawTableGetColumnWidth Xraw_PROTO((Widget w, + int column)); + +extern int XawTableGetColumnPixelWidth Xraw_PROTO((Widget w, + int column)); + + + +/*#########################################################################*/ +/*# #*/ +/*# Widget Class Pointer #*/ +/*# #*/ +/*#########################################################################*/ +extern WidgetClass tableWidgetClass; + +typedef struct _TableClassRec *XawTableWidgetClass; +typedef struct _TableRec *XawTableWidget; + + +#endif /* _XawTable_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Table3d.h b/vendor/x11iraf/obm/ObmW/Xraw/Table3d.h new file mode 100644 index 00000000..8d09dddf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Table3d.h @@ -0,0 +1,145 @@ +#ifndef _3d_h_ +#define _3d_h_ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xraw/XawInit.h> + +typedef enum { + XawRAISED = Xraw_3d, + XawSUNKEN, + XawCHISELED, + XawLEDGED, + XawTACK +} XawFrameType; + +#define TOP (1) +#define BOTTOM (2) + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean TopShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean ArmedColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); + + +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + + +extern Pixmap CreateShadowPixmap Xraw_PROTO((Widget , + Pixel , + int )); + + +extern Boolean AllocShadowPixel Xraw_PROTO((Widget , + Pixel , + int , + Pixel * )); + + +extern GC MakeGC Xraw_PROTO((Widget , + Pixel , + int , + Boolean , + int )); + + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern void XawDrawFrame Xraw_PROTO((Widget , + Position , + Position , + Dimension , + Dimension , + XawFrameType , + Dimension , + GC , + GC )); + + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean TopShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean ArmedColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern void DrawRhombus Xraw_PROTO((Widget , + short , + short , + short , + short , + GC , + GC , + GC , + Boolean )); + +extern Boolean FetchPixel Xraw_PROTO((Widget , + String name , + Pixel* )); + +#endif /* _3d_h_ */ + + + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TableP.h b/vendor/x11iraf/obm/ObmW/Xraw/TableP.h new file mode 100644 index 00000000..352fb278 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TableP.h @@ -0,0 +1,166 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advises, new components and patches of the existing programs. +Commercial usage is also possible with participation of it's author. + +*************************************************************************/ + +#ifndef _XawTableP_h +#define _XawTableP_h + +/*********************************************************************** + * + * Table Widget Private Data + * + ***********************************************************************/ + + +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Table.h> +#include <X11/Xraw/xraw_table.h> + +/* New fields for the Table widget class record */ + +typedef struct {int foo;} TableClassPart; + +/* Full class record declaration */ +typedef struct _TableClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + TableClassPart table_class; +} TableClassRec; + +#define MAX_ROWS 50 + +typedef struct _NormalReverseGC { + int used; + Pixel fore; + Pixel back; + GC normal; + GC reverse; +}NormalReverseGC; + +typedef struct _ShadowGC { + int used; + Pixel back; + GC top; + GC bottom; +}ShadowGC; + + + +/* New fields for the Table widget record */ +typedef struct { + /* ------------------------ resources -----------------------*/ + Pixel row_fore; + Pixel column_fore; + Pixel edit_fore; + Pixel edit_back; + Boolean row_oriented; + Boolean editable; + Boolean literal; + + int mask_number; + int columns; + int rows; + Dimension tab_margin; + Dimension row_margin; + Dimension col_margin; + Dimension internal_width; + Dimension internal_height; + Dimension label_shadow_thickness; + unsigned char encoding; + + /* Default Values */ + Pixel foreground; + XtJustify justify; + XFontStruct *font; + int width; + + /* Allowance CallbackList */ + XtCallbackList allow_add_row; + XtCallbackList allow_add_column; + XtCallbackList allow_delete_column; + XtCallbackList allow_delete_row; + XtCallbackList allow_delete_table; + + /* Information CallbackList */ + XtCallbackList add_row; + XtCallbackList add_column; + XtCallbackList changed_cell; + XtCallbackList create_table; + XtCallbackList delete_column; + XtCallbackList delete_row; + XtCallbackList delete_table; + XtCallbackList what_cell; + XtCallbackList changed_column_width; + XtCallbackList changed_row_height; + + Widget v_scroll; + Widget h_scroll; + + int row_height; + int column_default_width; + int literal_width; + + /* ------------------------ private state -----------------------*/ + + int no_refigure; /* no re-layout while > 0 */ + int no_redraw; /* no re-draw while > 0 */ + Boolean was_resized; + + + XawTableColumn column_data; + + Dimension prefer_width; + Dimension prefer_height; + Widget edit; + int edit_row; + int edit_column; + XawTableCell cell_own; + XawTableCell table_stuff; + + GC row_gc; /* Intrinsics sharedable GC */ + GC column_gc; /* Intrinsics sharedable GC */ + + GC normal; /* Table sharedable GC */ + GC reverse; /* Table sharedable GC */ + GC top; + GC bottom; + + GC edit_top; + GC edit_bottom; + + NormalReverseGC *normal_hash_table; + ShadowGC *shadow_hash_table; + int mask_hash_table; + + Atom selections[30]; + int num_selections; +} TablePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TableRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + TablePart table; +} TableRec; + +extern TableClassRec tableClassRec; + +#endif /* _XawTableP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TableUtil.h b/vendor/x11iraf/obm/ObmW/Xraw/TableUtil.h new file mode 100644 index 00000000..a8262f75 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TableUtil.h @@ -0,0 +1,94 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _table_h_ +#define _table_h_ + +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <X11/Xraw/Table.h> + +#if __STDC__ || defined(__cplusplus) +#define F_PROTO(s) s +#else +#define F_PROTO(s) () +#endif + +typedef struct _XawTableNodeRec { /* Node of table grid */ + struct _XawTableNodeRec *l; + struct _XawTableNodeRec *r; + struct _XawTableNodeRec *t; + struct _XawTableNodeRec *b; +}XawTableNodeRec, *XawTableNode; + + +extern XtPointer create_table F_PROTO((int rows, + int columns, + int node_size)); + +extern Boolean row_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean row_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern Boolean column_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean column_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern XtPointer get_table F_PROTO((XtPointer f)); + +extern XtPointer get_cell F_PROTO((XtPointer p, + int i, + int j)); + +extern void get_table_size F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void get_cell_positions F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void row_delete F_PROTO((XtPointer p)); + +extern void column_delete F_PROTO((XtPointer p)); + +extern void delete_table F_PROTO((XtPointer p)); + +extern Boolean go_table F_PROTO((XtPointer w, + XawTableProc proc, + XtPointer table, + int begin_row, + int end_row, + int begin_column, + int end_column, + int direction, + register int *row, + register int *column, + XtPointer client_data)); + +#ifdef EBUG_XRAW_MALLOC +extern void _check_table F_PROTO((XtPointer table, + int rows, + int columns)); +#endif + +#undef F_PROTO + +#endif /* _table_h_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Template.h b/vendor/x11iraf/obm/ObmW/Xraw/Template.h new file mode 100644 index 00000000..c53f9aa8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Template.h @@ -0,0 +1,65 @@ +/* $XConsortium: Template.h,v 1.5 90/12/19 18:46:00 converse Exp $ */ + +/* Copyright Massachusetts Institute of Technology 1987, 1988 + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifndef _Template_h +#define _Template_h + +/**************************************************************** + * + * Template widget + * + ****************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +/* define any special resource names here that are not in <X11/StringDefs.h> */ + +#define XtNtemplateResource "templateResource" + +#define XtCTemplateResource "TemplateResource" + +/* declare specific TemplateWidget class and instance datatypes */ + +typedef struct _TemplateClassRec* TemplateWidgetClass; +typedef struct _TemplateRec* TemplateWidget; + +/* declare the class constant */ + +extern WidgetClass templateWidgetClass; + +#endif /* _Template_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TemplateP.h b/vendor/x11iraf/obm/ObmW/Xraw/TemplateP.h new file mode 100644 index 00000000..de13b3fa --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TemplateP.h @@ -0,0 +1,57 @@ +/* $XConsortium: TemplateP.h,v 1.6 91/03/13 20:12:07 rws Exp $ */ + +/* Copyright Massachusetts Institute of Technology 1987, 1988 + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#ifndef _TemplateP_h +#define _TemplateP_h + +#include <X11/Xraw/Template.h> +/* include superclass private header file */ +#include <X11/CoreP.h> + +/* define unique representation types not found in <X11/StringDefs.h> */ + +#define XtRTemplateResource "TemplateResource" + +typedef struct { + int empty; +} TemplateClassPart; + +typedef struct _TemplateClassRec { + CoreClassPart core_class; + TemplateClassPart template_class; +} TemplateClassRec; + +extern TemplateClassRec templateClassRec; + +typedef struct { + /* resources */ + char* resource; + /* private state */ +} TemplatePart; + +typedef struct _TemplateRec { + CorePart core; + TemplatePart template; +} TemplateRec; + +#endif /* _TemplateP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Text.h b/vendor/x11iraf/obm/ObmW/Xraw/Text.h new file mode 100644 index 00000000..9493e9db --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Text.h @@ -0,0 +1,314 @@ +/* +* $XConsortium: Text.h,v 1.32 89/10/19 15:01:11 kit Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawText_h +#define _XawText_h + +#include <X11/Xraw/TextSink.h> +#include <X11/Xraw/TextSrc.h> + +/**************************************************************** + * + * Text widget + * + ****************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + dialogHOffset Margin int 10 + dialogVOffset Margin int 10 + displayCaret Output Boolean True + displayPosition TextPosition int 0 + editType EditType XtTextEditType XttextRead + height Height Dimension font height + insertPosition TextPosition int 0 + leftMargin Margin Dimension 2 + mappedWhenManaged MappedWhenManaged Boolean True + selectTypes SelectTypes Pointer (internal) + selection Selection Pointer empty selection + sensitive Sensitive Boolean True + textSink TextSink Pointer (none) + textSource TextSource Pointer (none) + width Width Dimension 100 + x Position int 0 + y Position int 0 + +*/ + +#define XtEtextScrollNever "never" +#define XtEtextScrollWhenNeeded "whenneeded" +#define XtEtextScrollAlways "always" + +#define XtEtextWrapNever "never" +#define XtEtextWrapLine "line" +#define XtEtextWrapWord "word" + +#define XtEtextResizeNever "never" +#define XtEtextResizeWidth "width" +#define XtEtextResizeHeight "height" +#define XtEtextResizeBoth "both" + +#define XtNautoFill "autoFill" +#define XtNbottomMargin "bottomMargin" +#define XtNdialogHOffset "dialogHOffset" +#define XtNdialogVOffset "dialogVOffset" +#define XtNdisplayCaret "displayCaret" +#define XtNdisplayPosition "displayPosition" +#define XtNleftMargin "leftMargin" +#define XtNrightMargin "rightMargin" +#define XtNscrollVertical "scrollVertical" +#define XtNscrollHorizontal "scrollHorizontal" +#define XtNselectTypes "selectTypes" +#define XtNtopMargin "topMargin" +#define XtNwrap "wrap" + +#define XtCAutoFill "AutoFill" +#define XtCSelectTypes "SelectTypes" +#define XtCWrap "Wrap" + +#ifndef XtCScroll +#define XtCScroll "Scroll" +#endif + +#ifndef XtNresize +#define XtNresize "resize" +#endif + +#ifndef XtNinsertPosition +#define XtNinsertPosition "insertPosition" +#endif + +#ifndef XtNselection +#define XtNselection "selection" +#endif + +#ifndef XtCResize +#define XtCResize "Resize" +#endif + + + + +/* Return Error code for XawTextSearch */ + +#define XawTextSearchError (-12345L) + +/* Return codes from XawTextReplace */ + +#define XawEditDone 0 +#define XawEditError 1 +#define XawPositionError 2 + +extern Atom FMT8BIT; + +/* Class record constants */ + +extern WidgetClass textWidgetClass; + +typedef struct _TextClassRec *TextWidgetClass; +typedef struct _TextRec *TextWidget; + +/* other stuff */ + +typedef enum { XawtextScrollNever, + XawtextScrollWhenNeeded, XawtextScrollAlways} XawTextScrollMode; + +typedef enum { XawtextWrapNever, + XawtextWrapLine, XawtextWrapWord} XawTextWrapMode; + +typedef enum { XawtextResizeNever, XawtextResizeWidth, + XawtextResizeHeight, XawtextResizeBoth} XawTextResizeMode; + +typedef enum {XawsdLeft, XawsdRight} XawTextScanDirection; +typedef enum {XawtextRead, XawtextAppend, XawtextEdit} XawTextEditType; +typedef enum {XawselectNull, XawselectPosition, XawselectChar, XawselectWord, + XawselectLine, XawselectParagraph, XawselectAll} XawTextSelectType; + +typedef struct { + int firstPos; + int length; + char *ptr; + Atom format; + } XawTextBlock, *XawTextBlockPtr; +#ifdef XAW_BC +/************************************************************ + * + * This Stuff is only for compatibility, and will go away in + * future releases. */ + +/* preserved for Back Compatability only. */ + +#define XawTextSource Widget +#define XtTextSource Widget + +#define wordBreak 0x01 +#define scrollVertical 0x02 +#define scrollHorizontal 0x04 +#define scrollOnOverflow 0x08 +#define resizeWidth 0x10 +#define resizeHeight 0x20 +#define editable 0x40 + +typedef long XtTextPosition; + +#define XtTextBlock XawTextBlock +#define XtTextBlockPtr XawTextBlockPtr + +#define EditDone XawEditDone +#define EditError XawEditError +#define PositionError XawPositionError + +#define XtEditDone XawEditDone +#define XtEditError XawEditError +#define XtPositionError XawPositionError + +#define XttextRead XawtextRead +#define XttextAppend XawtextAppend +#define XttextEdit XawtextEdit +#define XtTextEditType XawTextEditType +#define XtselectNull XawselectNull + +#define XtselectPosition XawselectPosition +#define XtselectChar XawselectChar +#define XtselectWord XawselectWord +#define XtselectLine XawselectLine +#define XtselectParagraph XawselectParagraph +#define XtselectAll XawselectAll +#define XtTextSelectType XawTextSelectType + +#define XtTextDisableRedisplay XawTextDisableRedisplay +#define XtTextEnableRedisplay XawTextEnableRedisplay +#define XtTextGetSource XawTextGetSource + +#define XtTextDisplay XawTextDisplay +#define XtTextDisplayCaret XawTextDisplayCaret +#define XtTextSetSelectionArray XawTextSetSelectionArray +#define XtTextSetLastPos XawTextSetLastPos +#define XtTextGetSelectionPos XawTextGetSelectionPos +#define XtTextSetSource XawTextSetSource +#define XtTextReplace XawTextReplace +#define XtTextTopPosition XawTextTopPosition +#define XtTextSetInsertionPoint XawTextSetInsertionPoint +#define XtTextGetInsertionPoint XawTextGetInsertionPoint +#define XtTextUnsetSelection XawTextUnsetSelection +#define XtTextChangeOptions XawTextChangeOptions +#define XtTextGetOptions XawTextGetOptions +#define XtTextSetSelection XawTextSetSelection +#define XtTextInvalidate XawTextInvalidate + +#define XtDiskSourceCreate XawDiskSourceCreate +#define XtDiskSourceDestroy XawDiskSourceDestroy +#define XtStringSourceCreate XawStringSourceCreate +#define XtStringSourceDestroy XawStringSourceDestroy + +extern void XawTextChangeOptions(); /* w, options */ + /* Widget w; */ + /* int options; */ + +extern int XawTextGetOptions(); /* w */ + /* Widget w; */ + +extern void XawTextSetLastPos(); /* w, lastPos */ + /* Widget w; */ + /* XawTextPosition lastPos; */ + +/*************************************************************/ +#endif /* XAW_BC */ + +extern void XawTextDisplay(); /* w */ + /* Widget w; */ + +extern void XawTextEnableRedisplay(); /* w */ + /* Widget w; */ + +extern void XawTextDisableRedisplay(); /* w */ + /* Widget w; */ + +extern void XawTextSetSelectionArray(); /* w, sarray */ + /* Widget w; */ + /* SelectionType *sarray; */ + +extern void XawTextGetSelectionPos(); /* dpy, w, left, right */ + /* Widget w; */ + /* XawTextPosition *left, *right; */ + +extern void XawTextSetSource(); /* dpy, w, source, startPos */ + /* Widget w; */ + /* XawTextSource source; */ + /* XawTextPosition startPos; */ + +extern int XawTextReplace(); /* w, startPos, endPos, text */ + /* Widget w; */ + /* XawTextPosition startPos, endPos; */ + /* XawTextBlock *text; */ + +extern XawTextPosition XawTextTopPosition(); /* w */ + /* Widget w; */ + +extern void XawTextSetInsertionPoint(); /* w, position */ + /* Widget w; */ + /* XawTextPosition position; */ + +extern XawTextPosition XawTextGetInsertionPoint(); /* w */ + /* Widget w; */ + +extern void XawTextUnsetSelection(); /* w */ + /* Widget w; */ + +extern void XawTextSetSelection(); /* w, left, right */ + /* Widget w; */ + /* XawTextPosition left, right; */ + +extern void XawTextInvalidate(); /* w, from, to */ + /* Widget w; */ + /* XawTextPosition from, to; */ + +extern Widget XawTextGetSource() ; /* w */ + /* Widget w; */ + +extern XawTextPosition XawTextSearch() ; /* w, dir, text */ + /* Widget w; */ + /* XawTextScanDirection dir; */ + /* XawTextBlock *text; */ + +/* + * For R3 compatability only. + */ + +#include <X11/Xraw/AsciiSrc.h> +#include <X11/Xraw/AsciiSink.h> + +#endif /* _XawText_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TextP.h b/vendor/x11iraf/obm/ObmW/Xraw/TextP.h new file mode 100644 index 00000000..c20e7ee8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TextP.h @@ -0,0 +1,224 @@ +/* +* $XConsortium: TextP.h,v 1.42 89/11/21 15:48:03 swick Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawTextP_h +#define _XawTextP_h + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Text.h> +#include <X11/Xraw/SimpleP.h> + +/**************************************************************** + * + * Text widget private + * + ****************************************************************/ +#define MAXCUT 30000 /* Maximum number of characters that can be cut. */ + +#define abs(x) (((x) < 0) ? (-(x)) : (x)) + +#define GET_LAST_POS XawTextSourceScan(ctx->text.source, 0, \ + XawstAll, XawsdRight, 1, TRUE) + +#define zeroPosition ((XawTextPosition) 0) + +extern XtActionsRec textActionsTable[]; +extern Cardinal textActionsTableCount; + +#define LF 0x0a +#define CR 0x0d +#define TAB 0x09 +#define BS 0x08 +#define SP 0x20 +#define DEL 0x7f +#define BSLASH '\\' + +/* constants that subclasses may want to know */ +#define DEFAULT_TEXT_HEIGHT ((Dimension)~0) + +/* displayable text management data structures */ + +typedef struct { + XawTextPosition position; + Position y; + Dimension textWidth; +} XawTextLineTableEntry, *XawTextLineTableEntryPtr; + +typedef struct { + XawTextPosition left, right; + XawTextSelectType type; + Atom* selections; + int atom_count; + int array_size; +} XawTextSelection; + +/* Line Tables are n+1 long - last position displayed is in last lt entry */ +typedef struct { + XawTextPosition top; /* Top of the displayed text. */ + int lines; /* How many lines in this table. */ + XawTextLineTableEntry *info; /* A dynamic array, one entry per line */ +} XawTextLineTable, *XawTextLineTablePtr; + + +typedef struct _XawTextMargin { + Position left, right, top, bottom; +} XawTextMargin; + +#define VMargins(ctx) ( (ctx)->text.margin.top + (ctx)->text.margin.bottom ) +#define HMargins(ctx) ( (ctx)->text.margin.left + (ctx)->text.margin.right ) + +#define IsPositionVisible(ctx, pos) \ + (pos >= ctx->text.lt.info[0].position && \ + pos < ctx->text.lt.info[ctx->text.lt.lines].position) + +/* + * Search & Replace data structure. + */ + +struct SearchAndReplace { + Boolean selection_changed; /* flag so that the selection cannot be + changed out from underneath query-replace.*/ + Widget search_popup; /* The poppup widget that allows searches.*/ + Widget label1; /* The label widgets for the search window. */ + Widget label2; + Widget left_toggle; /* The left search toggle radioGroup. */ + Widget right_toggle; /* The right search toggle radioGroup. */ + Widget rep_label; /* The Replace label string. */ + Widget rep_text; /* The Replace text field. */ + Widget search_text; /* The Search text field. */ + Widget rep_one; /* The Replace one button. */ + Widget rep_all; /* The Replace all button. */ +}; + +/* Private Text Definitions */ + +typedef int (*ActionProc)(); + +/* New fields for the Text widget class record */ + +typedef struct {int empty;} TextClassPart; + +/* Full class record declaration */ +typedef struct _TextClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; +} TextClassRec; + +extern TextClassRec textClassRec; + +/* New fields for the Text widget record */ +typedef struct _TextPart { + /* resources */ + + Widget source, sink; + XawTextPosition insertPos; + XawTextSelection s; + XawTextSelectType *sarray; /* Array to cycle for selections. */ + int options; /* wordbreak, scroll, etc. */ + int dialog_horiz_offset; /* position for popup dialog */ + int dialog_vert_offset; /* position for popup dialog */ + Boolean display_caret; /* insertion pt visible iff T */ + Boolean auto_fill; /* Auto fill mode? */ + XawTextScrollMode scroll_vert, scroll_horiz; /*what type of scrollbars.*/ + XawTextWrapMode wrap; /* The type of wrapping. */ + XawTextResizeMode resize; /* what to resize */ + XawTextMargin r_margin; /* The real margins. */ + + /* private state */ + + XawTextMargin margin; /* The current margins. */ + XawTextLineTable lt; + XawTextScanDirection extendDir; + XawTextSelection origSel; /* the selection being modified */ + Time lasttime; /* timestamp of last processed action */ + Time time; /* time of last key or button action */ + Position ev_x, ev_y; /* x, y coords for key or button action */ + Widget vbar, hbar; /* The scroll bars (none = NULL). */ + struct SearchAndReplace * search;/* Search and replace structure. */ + Widget file_insert; /* The file insert popup widget. */ + XawTextPosition *updateFrom; /* Array of start positions for update. */ + XawTextPosition *updateTo; /* Array of end positions for update. */ + int numranges; /* How many update ranges there are. */ + int maxranges; /* How many ranges we have space for */ + XawTextPosition lastPos; /* Last position of source. */ + GC gc; + Boolean showposition; /* True if we need to show the position. */ + Boolean hasfocus; /* TRUE if we currently have input focus.*/ + Boolean update_disabled; /* TRUE if display updating turned off */ + Boolean single_char; /* Single character replaced. */ + XawTextPosition old_insert; /* Last insertPos for batched updates */ + short mult; /* Multiplier. */ + + /* private state, shared w/Source and Sink */ + Boolean redisplay_needed; /* in SetValues */ + +} TextPart; + +/************************************************************* + * + * Resource types private to Text widget. + * + *************************************************************/ + +#define XtRScrollMode "ScrollMode" +#define XtRWrapMode "WrapMode" +#define XtRResizeMode "ResizeMode" + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TextRec { + CorePart core; + SimplePart simple; + TextPart text; +} TextRec; + +#ifdef XAW_BC +/************************************************************* + * For Compatibility only. */ + +#define XtTextLineTable XawTextLineTable +#define XtTextLineTablePtr XawTextLineTablePtr +#define XtTextLineTableEntry XawTextLineTableEntry +#define XtTextLineTableEntryPtr XawTextLineTableEntryPtr + +/*************************************************************/ +#endif /* XAW_BC */ + +extern void _XawTextPrepareToUpdate Xraw_PROTO((TextWidget)); + +extern int _XawTextReplace Xraw_PROTO((TextWidget, + XawTextPosition, + XawTextPosition, + XawTextBlock*)); +#endif /* _XawTextP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TextSink.h b/vendor/x11iraf/obm/ObmW/Xraw/TextSink.h new file mode 100644 index 00000000..c2ad36b6 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TextSink.h @@ -0,0 +1,239 @@ +/* + * $XConsortium: TextSink.h,v 1.5 89/11/01 17:28:26 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawTextSink_h +#define _XawTextSink_h + +/*********************************************************************** + * + * TextSink Object + * + ***********************************************************************/ + +#include <X11/Object.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + font Font XFontStruct * XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + background Background Pixel XtDefaultBackground + +*/ + +/* Class record constants */ + +extern WidgetClass textSinkObjectClass; + +typedef struct _TextSinkClassRec *TextSinkObjectClass; +typedef struct _TextSinkRec *TextSinkObject; + +typedef enum {XawisOn, XawisOff} XawTextInsertState; + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawTextSinkDisplayText + * Description: Stub function that in subclasses will display text. + * Arguments: w - the TextSink Object. + * x, y - location to start drawing text. + * pos1, pos2 - location of starting and ending points + * in the text buffer. + * highlight - hightlight this text? + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +void XawTextSinkDisplayText(/* w, x, y, pos1, pos2, highlight */); +/* +Widget w; +Position x, y; +Boolean highlight; +XawTextPosition pos1, pos2; +*/ + +/* Function Name: XawTextSinkInsertCursor + * Description: Places the InsertCursor. + * Arguments: w - the TextSink Object. + * x, y - location for the cursor. + * staye - whether to turn the cursor on, or off. + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +void XawTextSinkInsertCursor( /* w, x, y, state */ ); +/* +Widget w; +Position x, y; +XawTextInsertState state; +*/ + +/* Function Name: XawTextSinkClearToBackground + * Description: Clears a region of the sink to the background color. + * Arguments: w - the TextSink Object. + * x, y - location of area to clear. + * width, height - size of area to clear + * Returns: void. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +void XawTextSinkClearToBackground (/* w, x, y, width, height */); +/* +Widget w; +Position x, y; +Dimension width, height; +*/ + +/* Function Name: XawTextSinkFindPosition + * Description: Finds a position in the text. + * Arguments: w - the TextSink Object. + * fromPos - reference position. + * fromX - reference location. + * width, - width of section to paint text. + * stopAtWordBreak - returned position is a word break? + * resPos - Position to return. *** RETURNED *** + * resWidth - Width actually used. *** RETURNED *** + * resHeight - Height actually used. *** RETURNED *** + * Returns: none (see above). + */ + +void XawTextSinkFindPosition(/* w, fromPos, fromx, width, stopAtWordBreak, + resPos, resWidth, resHeight */ ); +/* +Widget w; +XawTextPosition fromPos; +int fromx, width; +Boolean stopAtWordBreak; +XawTextPosition *resPos; +int *resWidth, *resHeight; +*/ + +/* Function Name: XawTextSinkFindDistance + * Description: Find the Pixel Distance between two text Positions. + * Arguments: w - the TextSink Object. + * fromPos - starting Position. + * fromX - x location of starting Position. + * toPos - end Position. + * resWidth - Distance between fromPos and toPos. + * resPos - Acutal toPos used. + * resHeight - Height required by this text. + * Returns: none. + */ + +void XawTextSinkFindDistance (/* w, fromPos, fromx, + toPos, resWidth, resPos, resHeight */); +/* +Widget w; +XawTextPosition fromPos, toPos, *resPos; +int fromx, *resWidth, *resHeight; +*/ + +/* Function Name: XawTextSinkResolve + * Description: Resloves a location to a position. + * Arguments: w - the TextSink Object. + * pos - a reference Position. + * fromx - a reference Location. + * width - width to move. + * resPos - the resulting position. + * Returns: none + */ + +void XawTextSinkResolve(/* w, pos, fromx, width, resPos */); +/* +Widget w; +XawTextPosition pos; +int fromx, width; +XawTextPosition *resPos; +*/ + +/* Function Name: XawTextSinkMaxLines + * Description: Finds the Maximum number of lines that will fit in + * a given height. + * Arguments: w - the TextSink Object. + * height - height to fit lines into. + * Returns: the number of lines that will fit. + */ + +int XawTextSinkMaxLines(/* w, height */); +/* +Widget w; +Dimension height; +*/ + +/* Function Name: XawTextSinkMaxHeight + * Description: Finds the Minium height that will contain a given number + * lines. + * Arguments: w - the TextSink Object. + * lines - the number of lines. + * Returns: the height. + */ + +int XawTextSinkMaxHeight(/* w, lines */); +/* +Widget w; +int lines; +*/ + +/* Function Name: XawTextSinkSetTabs + * Description: Sets the Tab stops. + * Arguments: w - the TextSink Object. + * tab_count - the number of tabs in the list. + * tabs - the text positions of the tabs. + * Returns: none + */ + +void XawTextSinkSetTabs(/* w, tab_count, tabs */); +/* +Widget w; +int tab_count, *tabs; +*/ + +/* Function Name: XawTextSinkGetCursorBounds + * Description: Finds the bounding box for the insert curor (caret). + * Arguments: w - the TextSinkObject. + * rect - an X rectance containing the cursor bounds. + * Returns: none (fills in rect). + */ + +void XawTextSinkGetCursorBounds(/* w, rect */); +/* +Widget w; +XRectangle * rect; +*/ + +#endif /* _XawTextSrc_h -- DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TextSinkP.h b/vendor/x11iraf/obm/ObmW/Xraw/TextSinkP.h new file mode 100644 index 00000000..4bc4aea1 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TextSinkP.h @@ -0,0 +1,121 @@ +/* +* $XConsortium: TextSinkP.h,v 1.3 89/10/04 13:56:59 kit Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * TextSinkP.h - Private definitions for TextSink object + * + */ + +#ifndef _XawTextSinkP_h +#define _XawTextSinkP_h + +/*********************************************************************** + * + * TextSink Object Private Data + * + ***********************************************************************/ + +#include <X11/ObjectP.h> +#include <X11/Xraw/TextSink.h> +#include <X11/Xraw/TextP.h> /* This source works with the Text widget. */ +#include <X11/Xraw/TextSrcP.h> /* This source works with the Text Source. */ + +/************************************************************ + * + * New fields for the TextSink object class record. + * + ************************************************************/ + +typedef struct _TextSinkClassPart { + void (*DisplayText)(); + void (*InsertCursor)(); + void (*ClearToBackground)(); + void (*FindPosition)(); + void (*FindDistance)(); + void (*Resolve)(); + int (*MaxLines)(); + int (*MaxHeight)(); + void (*SetTabs)(); + void (*GetCursorBounds)(); +} TextSinkClassPart; + +/* Full class record declaration */ +typedef struct _TextSinkClassRec { + ObjectClassPart object_class; + TextSinkClassPart text_sink_class; +} TextSinkClassRec; + +extern TextSinkClassRec textSinkClassRec; + +/* New fields for the TextSink object record */ +typedef struct { + /* resources */ + XFontStruct *font; /* Font to draw in. */ + Pixel foreground; /* Foreground color. */ + Pixel background; /* Background color. */ + + /* private state. */ + Position *tabs; /* The tab stops as pixel values. */ + short *char_tabs; /* The tabs stops as character values. */ + int tab_count; /* number of items in tabs */ + +} TextSinkPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TextSinkRec { + ObjectPart object; + TextSinkPart text_sink; +} TextSinkRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +typedef int (*_XawSinkIntFunc)(); +typedef void (*_XawSinkVoidFunc)(); + +#define XtInheritDisplayText ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritInsertCursor ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritClearToBackground ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritFindPosition ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritFindDistance ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritResolve ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritMaxLines ((_XawSinkIntFunc) _XtInherit) +#define XtInheritMaxHeight ((_XawSinkIntFunc) _XtInherit) +#define XtInheritSetTabs ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritGetCursorBounds ((_XawSinkVoidFunc) _XtInherit) + +#endif /* _XawTextSinkP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TextSrc.h b/vendor/x11iraf/obm/ObmW/Xraw/TextSrc.h new file mode 100644 index 00000000..262a8a00 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TextSrc.h @@ -0,0 +1,224 @@ +/* + * $XConsortium: TextSrc.h,v 1.4 89/10/31 17:12:42 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawTextSrc_h +#define _XawTextSrc_h + +/*********************************************************************** + * + * TextSrc Object + * + ***********************************************************************/ + +#include <X11/Object.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + editType EditType XawTextEditType XawtextRead + +*/ + +/* Class record constants */ + +extern WidgetClass textSrcObjectClass; + +typedef struct _TextSrcClassRec *TextSrcObjectClass; +typedef struct _TextSrcRec *TextSrcObject; + +typedef enum {XawstPositions, XawstWhiteSpace, XawstEOL, XawstParagraph, + XawstAll} XawTextScanType; +typedef enum {Normal, Selected }highlightType; +typedef enum {XawsmTextSelect, XawsmTextExtend} XawTextSelectionMode; +typedef enum {XawactionStart, XawactionAdjust, XawactionEnd} + XawTextSelectionAction; + +typedef long XawTextPosition; + +/* + * Error Conditions: + */ + +#define XawTextReadError -1 +#define XawTextScanError -1 + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawTextSourceRead + * Description: This function reads the source. + * Arguments: w - the TextSrc Object. + * pos - position of the text to retreive. + * RETURNED text - text block that will contain returned text. + * length - maximum number of characters to read. + * Returns: The number of characters read into the buffer. + */ + +XawTextPosition XawTextSourceRead(/* w, pos, text, length */); +/* +Widget w; +XawTextPosition pos; +XawTextBlock *text; +int length; +*/ + +/* Function Name: XawTextSourceReplace. + * Description: Replaces a block of text with new text. + * Arguments: src - the Text Source Object. + * startPos, endPos - ends of text that will be removed. + * text - new text to be inserted into buffer at startPos. + * Returns: XawEditError or XawEditDone. + */ + +int XawTextSourceReplace (/* w, startPos, endPos, text */); +/* +Widget w; +XawTextPosition startPos, endPos; +XawTextBlock *text; +*/ + +/* Function Name: XawTextSourceScan + * Description: Scans the text source for the number and type + * of item specified. + * Arguments: w - the TextSrc Object. + * position - the position to start scanning. + * type - type of thing to scan for. + * dir - direction to scan. + * count - which occurance if this thing to search for. + * include - whether or not to include the character found in + * the position that is returned. + * Returns: The position of the text. + * + */ + +XawTextPosition XawTextSourceScan(/* w, position, type, dir, count, include*/); +/* +Widget w; +XawTextPosition position; +XawTextScanType type; +XawTextScanDirection dir; +int count; +Boolean include; +*/ + +/* Function Name: XawTextSourceSearch + * Description: Searchs the text source for the text block passed + * Arguments: w - the TextSource Object. + * position - the position to start scanning. + * dir - direction to scan. + * text - the text block to search for. + * Returns: The position of the text we are searching for or + * XawTextSearchError. + */ + +XawTextPosition XawTextSourceSearch(/* w, position, dir, text */); +/* +Widget w; +XawTextPosition position; +XawTextScanDirection dir; +XawTextBlock * text; +*/ + +/* Function Name: XawTextSourceConvertSelection + * Description: Dummy selection converter. + * Arguments: w - the TextSrc object. + * selection - the current selection atom. + * target - the current target atom. + * type - the type to conver the selection to. + * RETURNED value, length - the return value that has been converted. + * RETURNED format - the format of the returned value. + * Returns: TRUE if the selection has been converted. + * + */ + +Boolean XawTextSourceConvertSelection(/* w, selection, target, + type, value, length, format */); +/* +Widget w; +Atom * selection, * target, * type; +caddr_t * value; +unsigned long * length; +int * format; +*/ + +/* Function Name: XawTextSourceSetSelection + * Description: allows special setting of the selection. + * Arguments: w - the TextSrc object. + * left, right - bounds of the selection. + * selection - the selection atom. + * Returns: none + */ + +void XawTextSourceSetSelection(/* w, left, right, selection */); +/* +Widget w; +XawTextPosition left, right; +Atom selection; +*/ + +#ifdef XAW_BC +/************************************************************* + * For Compatibility only. */ + +#define _XtTextSink _XawTextSink +#define _XtTextSource _XawTextSource + +#define XtisOn XawisOn +#define XtisOff XawisOff + +#define XtsmTextSelect XawsmTextSelect +#define XtsmTextExtend XawsmTextExtend + +#define XtactionStart XawactionStart +#define XtactionAdjust XawactionAdjust +#define XtactionEnd XawactionEnd + +#define XtsdLeft XawsdLeft +#define XtsdRight XawsdRight + +#define XtstPositions XawstPositions +#define XtstWhiteSpace XawstWhiteSpace +#define XtstEOL XawstEOL +#define XtstParagraph XawstParagraph +#define XtstAll XawstAll + +#define XtTextSelectionAction XawTextSelectionAction +#define XtTextSelection XawTextSelection +#define XtTextScanDirection XawTextScanDirection +#define XtTextScanType XawTextScanType + + +/*************************************************************/ +#endif /* XAW_BC */ + +#endif /* _XawTextSrc_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TextSrcP.h b/vendor/x11iraf/obm/ObmW/Xraw/TextSrcP.h new file mode 100644 index 00000000..a58fff09 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TextSrcP.h @@ -0,0 +1,106 @@ +/* +* $XConsortium: TextSrcP.h,v 1.17 89/10/04 13:56:16 kit Exp $ +*/ + + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * TextSrcP.h - Private definitions for TextSrc object + * + */ + +#ifndef _XawTextSrcP_h +#define _XawTextSrcP_h + +/*********************************************************************** + * + * TextSrc Object Private Data + * + ***********************************************************************/ + +#include <X11/ObjectP.h> +#include <X11/Xraw/TextSrc.h> +#include <X11/Xraw/TextP.h> /* This source works with the Text widget. */ + +/************************************************************ + * + * New fields for the TextSrc object class record. + * + ************************************************************/ + +typedef struct _TextSrcClassPart { + XawTextPosition (*Read)(); + int (*Replace)(); + XawTextPosition (*Scan)(); + XawTextPosition (*Search)(); + void (*SetSelection)(); + Boolean (*ConvertSelection)(); +} TextSrcClassPart; + +/* Full class record declaration */ +typedef struct _TextSrcClassRec { + ObjectClassPart object_class; + TextSrcClassPart textSrc_class; +} TextSrcClassRec; + +extern TextSrcClassRec textSrcClassRec; + +/* New fields for the TextSrc object record */ +typedef struct { + /* resources */ + XawTextEditType edit_mode; +} TextSrcPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TextSrcRec { + ObjectPart object; + TextSrcPart textSrc; +} TextSrcRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +typedef Boolean (*_XawBooleanFunc)(); +typedef int (*_XawIntFunc)(); +typedef XawTextPosition (*_XawTextPositionFunc)(); +typedef void (*_XawTextVoidFunc)(); + +#define XtInheritRead ((_XawTextPositionFunc) _XtInherit) +#define XtInheritReplace ((_XawIntFunc) _XtInherit) +#define XtInheritScan ((_XawTextPositionFunc) _XtInherit) +#define XtInheritSearch ((_XawTextPositionFunc) _XtInherit) +#define XtInheritSetSelection ((_XawTextVoidFunc) _XtInherit) +#define XtInheritConvertSelection ((_XawBooleanFunc) _XtInherit) + +#endif /* _XawTextSrcP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Toggle.h b/vendor/x11iraf/obm/ObmW/Xraw/Toggle.h new file mode 100644 index 00000000..fbd74490 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Toggle.h @@ -0,0 +1,170 @@ +/* + * $XConsortium: Toggle.h,v 1.13 91/05/04 18:59:01 rws Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * ToggleP.h - Private definitions for Toggle widget + * + * Author: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * + * Date: January 12, 1989 + */ + +#ifndef _XawToggle_h +#define _XawToggle_h + +/*********************************************************************** + * + * Toggle Widget + * + ***********************************************************************/ + +#include <X11/Xraw/Command.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + radioGroup RadioGroup Widget NULL + + radioData RadioData Pointer (caddr_t) Widget ++ + state State Boolean Off + + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback Pointer NULL + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + font Font XFontStructx* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + highlightThickness Thickness Dimension 2 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + mappedWhenManaged MappedWhenManaged Boolean True + resize Resize Boolean True + sensitive Sensitive Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + ++ To use the toggle as a radio toggle button, set this resource to point to + any other widget in the radio group. + +++ This is the data returned from a call to XtToggleGetCurrent, by default + this is set to the name of toggle widget. + +*/ + +/* + * These should be in StringDefs.h but aren't so we will define + * them here if they are needed. + */ + + +#define XtCWidget "Widget" +#define XtCState "State" +#define XtCRadioGroup "RadioGroup" +#define XtCRadioData "RadioData" + +#ifndef _XtStringDefs_h_ +#define XtRWidget "Widget" +#endif + +#define XtNstate "state" +#define XtNradioGroup "radioGroup" +#define XtNradioData "radioData" + +extern WidgetClass toggleWidgetClass; + +typedef struct _ToggleClassRec *ToggleWidgetClass; +typedef struct _ToggleRec *ToggleWidget; + + +/************************************************************ + * + * Public Functions + * + ************************************************************/ + +/* Function Name: XawToggleChangeRadioGroup + * Description: Allows a toggle widget to change radio lists. + * Arguments: w - The toggle widget to change lists. + * radio_group - any widget in the new list. + * Returns: none. + */ + +extern void XawToggleChangeRadioGroup( +#if NeedFunctionPrototypes + Widget /* w */, + Widget /* radio_group */ +#endif +); + +/* Function Name: XawToggleGetCurrent + * Description: Returns the RadioData associated with the toggle + * widget that is currently active in a toggle list. + * Arguments: radio_group - any toggle widget in the toggle list. + * Returns: The XtNradioData associated with the toggle widget. + */ + +extern XtPointer XawToggleGetCurrent( +#if NeedFunctionPrototypes + Widget /* radio_group */ +#endif +); + +/* Function Name: XawToggleSetCurrent + * Description: Sets the Toggle widget associated with the + * radio_data specified. + * Arguments: radio_group - any toggle widget in the toggle list. + * radio_data - radio data of the toggle widget to set. + * Returns: none. + */ + +extern void XawToggleSetCurrent( +#if NeedFunctionPrototypes + Widget /* radio_group */, + XtPointer /* radio_data */ +#endif +); + +/* Function Name: XawToggleUnsetCurrent + * Description: Unsets all Toggles in the radio_group specified. + * Arguments: radio_group - any toggle widget in the toggle list. + * Returns: none. + */ + +extern void XawToggleUnsetCurrent( +#if NeedFunctionPrototypes + Widget /* radio_group */ +#endif +); + +#endif /* _XawToggle_h */ +/* DON'T ADD STUFF AFTER THIS */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ToggleP.h b/vendor/x11iraf/obm/ObmW/Xraw/ToggleP.h new file mode 100644 index 00000000..2fd31e53 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ToggleP.h @@ -0,0 +1,108 @@ +/* + * $XConsortium: ToggleP.h,v 1.8 91/06/20 16:15:51 converse Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * ToggleP.h - Private definitions for Toggle widget + * + * Author: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * + * Date: January 12, 1989 + * + */ + +#ifndef _XawToggleP_h +#define _XawToggleP_h + +#include <X11/Xraw/Toggle.h> +#include <X11/Xraw/CommandP.h> + +/*********************************************************************** + * + * Toggle Widget Private Data + * + ***********************************************************************/ +#ifdef streq +#undef streq +#endif + +#define streq(a, b) ( strcmp((a), (b)) == 0 ) + +typedef struct _RadioGroup { + struct _RadioGroup *prev, *next; /* Pointers to other elements in group. */ + Widget widget; /* Widget corrosponding to this element. */ +} RadioGroup; + +/************************************ + * + * Class structure + * + ***********************************/ + + /* New fields for the Toggle widget class record */ +typedef struct _ToggleClass { + XtActionProc Set; + XtActionProc Unset; + XtPointer extension; +} ToggleClassPart; + + /* Full class record declaration */ +typedef struct _ToggleClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + LabelClassPart label_class; + CommandClassPart command_class; + ToggleClassPart toggle_class; +} ToggleClassRec; + +extern ToggleClassRec toggleClassRec; + +/*************************************** + * + * Instance (widget) structure + * + **************************************/ + + /* New fields for the Toggle widget record */ +typedef struct { + /* resources */ + Widget widget; + XtPointer radio_data; + + /* private data */ + RadioGroup * radio_group; +} TogglePart; + + /* Full widget declaration */ +typedef struct _ToggleRec { + CorePart core; + SimplePart simple; + LabelPart label; + CommandPart command; + TogglePart toggle; +} ToggleRec; + +#endif /* _XawToggleP_h */ + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Tree.h b/vendor/x11iraf/obm/ObmW/Xraw/Tree.h new file mode 100644 index 00000000..7ed38fee --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Tree.h @@ -0,0 +1,120 @@ +/* + * $XConsortium: Tree.h,v 1.11 91/05/04 18:59:13 rws Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * Copyright 1989 Prentice Hall + * + * Permission to use, copy, modify, and distribute this software for any + * purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation. + * + * M.I.T., Prentice Hall and the authors disclaim all warranties with regard + * to this software, including all implied warranties of merchantability and + * fitness. In no event shall M.I.T., Prentice Hall or the authors be liable + * for any special, indirect or cosequential damages or any damages whatsoever + * resulting from loss of use, data or profits, whether in an action of + * contract, negligence or other tortious action, arising out of or in + * connection with the use or performance of this software. + * + * Authors: Jim Fulton, MIT X Consortium, + * based on a version by Douglas Young, Prentice Hall + * + * This widget is based on the Tree widget described on pages 397-419 of + * Douglas Young's book "The X Window System, Programming and Applications + * with Xt OSF/Motif Edition." The layout code has been rewritten to use + * additional blank space to make the structure of the graph easier to see + * as well as to support vertical trees. + */ + + +#ifndef _XawTree_h +#define _XawTree_h + +#include <X11/Xmu/Converters.h> +#include <X11/Xraw/XawInit.h> + + +/****************************************************************************** + * + * Tree Widget (subclass of ConstraintClass) + * + ****************************************************************************** + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * autoReconfigure AutoReconfigure Boolean FALSE + * background Background Pixel XtDefaultBackground + * foreground Foreground Pixel XtDefaultForeground + * gravity Gravity XtGravity West + * hSpace HSpace Dimension 20 + * lineWidth LineWidth Dimension 0 + * vSpace VSpace Dimension 6 + * + * + * Constraint Resources attached to children: + * + * treeGC TreeGC GC NULL + * treeParent TreeParent Widget NULL + * + * + *****************************************************************************/ + + /* new instance field names */ +#ifndef _XtStringDefs_h_ +#define XtNhSpace "hSpace" +#define XtNvSpace "vSpace" +#define XtCHSpace "HSpace" +#define XtCVSpace "VSpace" +#endif + +#define XtNautoReconfigure "autoReconfigure" +#define XtNlineWidth "lineWidth" +#define XtNtreeGC "treeGC" +#define XtNtreeParent "treeParent" +#define XtNgravity "gravity" + + /* new class field names */ +#define XtCAutoReconfigure "AutoReconfigure" +#define XtCLineWidth "LineWidth" +#define XtCTreeGC "TreeGC" +#define XtCTreeParent "TreeParent" +#define XtCGravity "Gravity" + +#define XtRGC "GC" + /* external declarations */ +extern WidgetClass treeWidgetClass; + +typedef struct _TreeClassRec *TreeWidgetClass; +typedef struct _TreeRec *TreeWidget; + + +extern void XawTreeForceLayout Xraw_PROTO(( Widget /* tree */)); + + +#if defined(XtSpecificationRelease) && XtSpecificationRelease < 5 + +typedef int XtGravity; + +#define XtRGravity "Gravity" +#define XtEForget "forget" +#define XtENorthWest "northwest" +#define XtENorth "north" +#define XtENorthEast "northeast" +#define XtEWest "west" +#define XtECenter "center" +#define XtEEast "east" +#define XtESouthWest "southwest" +#define XtESouth "south" +#define XtESouthEast "sotheast" +#define XtEStatic "static" +#define XtEUnmap "unmap" +#define XtEtop "top" +#define XtEbottom "bottom" + +#endif + +#endif /* _XawTree_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/TreeP.h b/vendor/x11iraf/obm/ObmW/Xraw/TreeP.h new file mode 100644 index 00000000..16164afc --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/TreeP.h @@ -0,0 +1,112 @@ +/* + * $XConsortium: TreeP.h,v 1.13 90/04/13 16:39:54 jim Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * Copyright 1989 Prentice Hall + * + * Permission to use, copy, modify, and distribute this software for any + * purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation. + * + * M.I.T., Prentice Hall and the authors disclaim all warranties with regard + * to this software, including all implied warranties of merchantability and + * fitness. In no event shall M.I.T., Prentice Hall or the authors be liable + * for any special, indirect or cosequential damages or any damages whatsoever + * resulting from loss of use, data or profits, whether in an action of + * contract, negligence or other tortious action, arising out of or in + * connection with the use or performance of this software. + * + * Authors: Jim Fulton, MIT X Consortium, + * based on a version by Douglas Young, Prentice Hall + * + * This widget is based on the Tree widget described on pages 397-419 of + * Douglas Young's book "The X Window System, Programming and Applications + * with Xt OSF/Motif Edition." The layout code has been rewritten to use + * additional blank space to make the structure of the graph easier to see + * as well as to support vertical trees. + */ + + +#ifndef _XawTreeP_h +#define _XawTreeP_h + +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Tree.h> + +typedef struct _TreeClassPart { + int ignore; +} TreeClassPart; + +typedef struct _TreeClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + TreeClassPart tree_class; +} TreeClassRec; + +extern TreeClassRec treeClassRec; + +typedef struct { + /* fields available through resources */ + Dimension hpad; /* hSpace/HSpace */ + Dimension vpad; /* vSpace/VSpace */ + Dimension line_width; /* lineWidth/LineWidth */ + Pixel foreground; /* foreground/Foreground */ + XtGravity gravity; /* gravity/Gravity */ + Boolean auto_reconfigure; /* autoReconfigure/AutoReconfigure */ + /* private fields */ + GC gc; /* used to draw lines */ + Widget tree_root; /* hidden root off all children */ + Dimension *largest; /* list of largest per depth */ + int n_largest; /* number of elements in largest */ + Dimension maxwidth, maxheight; /* for shrink wrapping */ +} TreePart; + + +typedef struct _TreeRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + TreePart tree; +} TreeRec; + + +/* + * structure attached to all children + */ +typedef struct _TreeConstraintsPart { + /* resources */ + Widget parent; /* treeParent/TreeParent */ + GC gc; /* treeGC/TreeGC */ + /* private data */ + Widget *children; + int n_children; + int max_children; + Dimension bbsubwidth, bbsubheight; /* bounding box of sub tree */ + Dimension bbwidth, bbheight; /* bounding box including node */ + Position x, y; +} TreeConstraintsPart; + +typedef struct _TreeConstraintsRec { + TreeConstraintsPart tree; +} TreeConstraintsRec, *TreeConstraints; + + +/* + * useful macros + */ + +#define TREE_CONSTRAINT(w) \ + ((TreeConstraints)((w)->core.constraints)) + +#define TREE_INITIAL_DEPTH 10 /* for allocating largest array */ +#define TREE_HORIZONTAL_DEFAULT_SPACING 20 +#define TREE_VERTICAL_DEFAULT_SPACING 6 + +#endif /* _XawTreeP_h */ + + + diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Viewport.h b/vendor/x11iraf/obm/ObmW/Xraw/Viewport.h new file mode 100644 index 00000000..f1bcc0f9 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Viewport.h @@ -0,0 +1,153 @@ +/* $XConsortium: Viewport.h,v 1.21 91/07/22 19:05:23 converse Exp $ */ + +/************************************************************ +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifndef _XawViewport_h +#define _XawViewport_h + +#include <X11/Xraw/Form.h> +#include <X11/Xraw/Reports.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + allowHoriz Boolean Boolean False + allowVert Boolean Boolean False + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + foreceBars Boolean Boolean False + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + reportCallback ReportCallback Pointer NULL + sensitive Sensitive Boolean True + useBottom Boolean Boolean False + useRight Boolean Boolean False + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/*#########################################################################*/ +/*# #*/ +/*# New Resources #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNforceBars +#define XtNforceBars "forceBars" +#endif + +#ifndef XtNallowHoriz +#define XtNallowHoriz "allowHoriz" +#endif + +#ifndef XtNallowVert +#define XtNallowVert "allowVert" +#endif + +#ifndef XtNuseBottom +#define XtNuseBottom "useBottom" +#endif + +#ifndef XtNuseRight +#define XtNuseRight "useRight" +#endif + +#ifndef XtNframeWidth +#define XtNframeWidth "frameWidth" +#endif + +#ifndef XtNscrollbarWidth +#define XtNscrollbarWidth "scrollbarWidth" +#endif + +#ifndef XtNdistance +#define XtNdistance "distance" +#endif + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Classes #*/ +/*# #*/ +/*#########################################################################*/ + +#ifndef XtCDistance +#define XtCDistance "Distance" +#endif + +#ifndef XtCScrollbarWidth +#define XtCScrollbarWidth "ScrollbarWidth" +#endif + +#ifndef XtCFrameWidth +#define XtCFrameWidth "FrameWidth" +#endif + + + +extern void XawViewportSetLocation ( +#if NeedFunctionPrototypes + Widget /* gw */, +#if NeedWidePrototypes + /* float */ double /* xoff */, + /* float */ double /* yoff */ +#else + float /* xoff */, + float /* yoff */ +#endif +#endif +); + +extern void XawViewportSetCoordinates ( +#if NeedFunctionPrototypes + Widget /* gw */, +#if NeedWidePrototypes + /* Position */ int /* x */, + /* Position */ int /* y */ +#else + Position /* x */, + Position /* y */ +#endif +#endif +); + + +/*#########################################################################*/ +/*# #*/ +/*# Widget Class Pointer #*/ +/*# #*/ +/*#########################################################################*/ +extern WidgetClass viewportWidgetClass; + +typedef struct _ViewportClassRec *ViewportWidgetClass; +typedef struct _ViewportRec *ViewportWidget; + + +#endif /* _XawViewport_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/ViewportP.h b/vendor/x11iraf/obm/ObmW/Xraw/ViewportP.h new file mode 100644 index 00000000..0aee6123 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/ViewportP.h @@ -0,0 +1,92 @@ +/* + * $XConsortium: ViewportP.h,v 1.13 90/02/13 14:04:14 jim Exp $ + * Private declarations for ViewportWidgetClass + */ + +/************************************************************ +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifndef _ViewportP_h +#define _ViewportP_h + +#include <X11/Xraw/Viewport.h> +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/FrameP.h> + +typedef struct {int empty;} ViewportClassPart; + +typedef struct _ViewportClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + ViewportClassPart viewport_class; +} ViewportClassRec; + +extern ViewportClassRec viewportClassRec; + +typedef struct _ViewportPart { + /* resources */ + Boolean forcebars; /* Whether we should always display */ + /* the selected scrollbars. */ + Boolean allowhoriz; /* Whether we allow horizontal scrollbars. */ + Boolean allowvert; /* Whether we allow vertical scrollbars. */ + Boolean usebottom; /* True if horiz bars appear at bottom. */ + Boolean useright; /* True if vert bars appear at right. */ + + Dimension distance; + Dimension scrollbar_width; + Dimension frame_width; + XawFrameType frame_type; + + XtCallbackList report_callbacks; /* when size/position changes */ + + /* private state */ + + Widget clip, child; /* The clipping and (scrolled) child widgets */ + Widget horiz_bar, vert_bar;/* What scrollbars we currently have. */ + Boolean not_manage; + +} ViewportPart; + +typedef struct _ViewportRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + ViewportPart viewport; +} ViewportRec; + +typedef struct { + /* resources */ + + /* private state */ + Boolean reparented; /* True if child has been re-parented */ +} ViewportConstraintsPart; + +typedef struct _ViewportConstraintsRec { + ViewportConstraintsPart viewport; +} ViewportConstraintsRec, *ViewportConstraints; + +#endif /* _ViewportP_h */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/XawAll.h b/vendor/x11iraf/obm/ObmW/Xraw/XawAll.h new file mode 100644 index 00000000..4cf0d285 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/XawAll.h @@ -0,0 +1,48 @@ +#ifndef _XawAll_h_ +#define _XawAll_h_ + +#include <X11/Xraw/3d.h> +#include <X11/Xraw/Arrow.h> +#include <X11/Xraw/AsciiSink.h> +#include <X11/Xraw/AsciiSrc.h> +#include <X11/Xraw/AsciiText.h> +#include <X11/Xraw/Box.h> +#include <X11/Xraw/Cardinals.h> +#include <X11/Xraw/Clock.h> +#include <X11/Xraw/Command.h> +#include <X11/Xraw/color.h> +#include <X11/Xraw/Container.h> +#include <X11/Xraw/Dialog.h> +#include <X11/Xraw/Form.h> +#include <X11/Xraw/Frame.h> +#include <X11/Xraw/Grip.h> +#include <X11/Xraw/Label.h> +#include <X11/Xraw/List.h> +#include <X11/Xraw/Logo.h> +#include <X11/Xraw/MenuButton.h> +#include <X11/Xraw/Mailbox.h> +#include <X11/Xraw/Paned.h> +#include <X11/Xraw/Panner.h> +#include <X11/Xraw/Porthole.h> +#include <X11/Xraw/Repeater.h> +#include <X11/Xraw/Reports.h> +#include <X11/Xraw/Scrollbar.h> +#include <X11/Xraw/ScrolledTable.h> +#include <X11/Xraw/Separator.h> +#include <X11/Xraw/Simple.h> +#include <X11/Xraw/SimpleMenu.h> +#include <X11/Xraw/Sme.h> +#include <X11/Xraw/SmeBSB.h> +#include <X11/Xraw/SmeLine.h> +#include <X11/Xraw/StripChart.h> +#include <X11/Xraw/table.h> +#include <X11/Xraw/Table.h> +#include <X11/Xraw/Text.h> +#include <X11/Xraw/TextSink.h> +#include <X11/Xraw/TextSrc.h> +#include <X11/Xraw/Tree.h> +#include <X11/Xraw/Toggle.h> +#include <X11/Xraw/Viewport.h> +#include <X11/Xraw/XawInit.h> + +#endif /* _XawAll_h_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/XawInit.h b/vendor/x11iraf/obm/ObmW/Xraw/XawInit.h new file mode 100644 index 00000000..cf6bcbc8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/XawInit.h @@ -0,0 +1,60 @@ +/* $XConsortium: XawInit.h,v 1.4 91/07/22 19:05:25 converse Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#ifndef _XawInit_ +#define _XawInit_ + +#if !(defined(__STDC__) && __STDC__) && !defined(__cplusplus) && !defined(c_plusplus) && !defined(FUNCPROTO) && !defined(XTFUNCPROTO) && !defined(XAWFUNCPROTO) && !(defined(NeedFunctionPrototypes) && NeedFunctionPrototypes) +#define Xraw_NO_PROTO +#else +#define Xraw_NEED_PROTO +#endif /* __STDC__ */ + + +#ifdef Xraw_NEED_PROTO +#define Xraw_PROTO(args) args +#else +#define Xraw_PROTO(args) () +#endif + +#define Xraw_VERSION 1 +#define Xraw_REVISION 2 + +#define Xraw_3d 1 +#define Xraw_SCROLLBAR 20 +#define Xraw_TABLE 40 +#define Xraw_SEPARATOR 60 +#define Xraw_FRAME 80 + +#define streq(a,b) (XrmStringToQuark(a) == XrmStringToQuark(b)) + +#define FULL_WIDTH(w) ((w)->core.width + ((w)->core.border_width << 1)) +#define FULL_HEIGHT(w) ((w)->core.height + ((w)->core.border_width << 1)) +#define WNULL (Widget)NULL + +/* called from ClassInit procs */ +extern void XawInitializeWidgetSet Xraw_PROTO((void)); + +#if defined(XtSpecificationRelease) && XtSpecificationRelease < 5 +#define XPointer XtPointer +#endif + +#endif /* _XawInit_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/Xosdefs.h b/vendor/x11iraf/obm/ObmW/Xraw/Xosdefs.h new file mode 100644 index 00000000..86ab5ed7 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/Xosdefs.h @@ -0,0 +1,95 @@ +/* + * O/S-dependent (mis)feature macro definitions + * + * $XConsortium: Xosdefs.h,v 1.7 91/07/19 23:22:19 rws Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _XOSDEFS_H_ +#define _XOSDEFS_H_ + +/* + * X_NOT_STDC_ENV means does not have ANSI C header files. Lack of this + * symbol does NOT mean that the system has stdarg.h. + * + * X_NOT_POSIX means does not have POSIX header files. Lack of this + * symbol does NOT mean that the POSIX environment is the default. + * You may still have to define _POSIX_SOURCE to get it. + */ + +#ifdef NOSTDHDRS +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif + +#ifdef sony +#ifndef SYSTYPE_SYSV +#define X_NOT_POSIX +#endif +#endif + +#ifdef UTEK +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif + +#ifdef CRAY +#define X_NOT_POSIX +#endif + +#ifdef vax +#ifndef ultrix /* assume vanilla BSD */ +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif +#endif + +#ifdef luna +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif + +#ifdef Mips +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif + +#ifdef USL +#ifdef SYSV /* (release 3.2) */ +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif +#endif + +#ifdef SYSV386 +#ifdef SYSV +#define X_NOT_POSIX +#define X_NOT_STDC_ENV +#endif +#endif + +#ifdef MOTOROLA +#ifdef SYSV +#define X_NOT_STDC_ENV +#endif +#endif + +#endif /* _XOSDEFS_H_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/XrawInit.h b/vendor/x11iraf/obm/ObmW/Xraw/XrawInit.h new file mode 100644 index 00000000..cf6bcbc8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/XrawInit.h @@ -0,0 +1,60 @@ +/* $XConsortium: XawInit.h,v 1.4 91/07/22 19:05:25 converse Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#ifndef _XawInit_ +#define _XawInit_ + +#if !(defined(__STDC__) && __STDC__) && !defined(__cplusplus) && !defined(c_plusplus) && !defined(FUNCPROTO) && !defined(XTFUNCPROTO) && !defined(XAWFUNCPROTO) && !(defined(NeedFunctionPrototypes) && NeedFunctionPrototypes) +#define Xraw_NO_PROTO +#else +#define Xraw_NEED_PROTO +#endif /* __STDC__ */ + + +#ifdef Xraw_NEED_PROTO +#define Xraw_PROTO(args) args +#else +#define Xraw_PROTO(args) () +#endif + +#define Xraw_VERSION 1 +#define Xraw_REVISION 2 + +#define Xraw_3d 1 +#define Xraw_SCROLLBAR 20 +#define Xraw_TABLE 40 +#define Xraw_SEPARATOR 60 +#define Xraw_FRAME 80 + +#define streq(a,b) (XrmStringToQuark(a) == XrmStringToQuark(b)) + +#define FULL_WIDTH(w) ((w)->core.width + ((w)->core.border_width << 1)) +#define FULL_HEIGHT(w) ((w)->core.height + ((w)->core.border_width << 1)) +#define WNULL (Widget)NULL + +/* called from ClassInit procs */ +extern void XawInitializeWidgetSet Xraw_PROTO((void)); + +#if defined(XtSpecificationRelease) && XtSpecificationRelease < 5 +#define XPointer XtPointer +#endif + +#endif /* _XawInit_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/color.h b/vendor/x11iraf/obm/ObmW/Xraw/color.h new file mode 100644 index 00000000..47351d7b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/color.h @@ -0,0 +1,73 @@ +/* $Header: /users/romsky/Xraw/last/Xraw/RCS/color.h,v 1.4 1995/12/14 00:13:07 romsky Exp romsky $ */ + +/* + * color.h - color definitions + * + * Author: Christopher A. Kent + * Western Research Laboratory + * Digital Equipment Corporation + * Date: Sun Dec 13 1987 + * Copyright (c) 1987 Christopher A. Kent + */ + +/* + * $Log: color.h,v $ + * Revision 1.4 1995/12/14 00:13:07 romsky + * Panner and MenuButton + * + * Revision 1.3 1995/11/24 03:35:16 romsky + * version 1.1.1 + * + * Revision 1.3 1995/11/24 03:35:16 romsky + * version 1.1.1 + * + * Revision 1.1 1995/11/24 03:28:25 romsky + * version 1.1.1 + * + * Revision 1.2 1995/11/21 02:40:53 romsky + * *** empty log message *** + * + * Revision 1.1 1995/11/06 05:48:05 romsky + * Initial revision + * + * Revision 1.1 1995/11/06 05:48:05 romsky + * Initial revision + * + * Revision 1.1 1995/10/08 11:32:36 romsky + * Initial revision + * + * Revision 1.2 90/06/30 14:33:12 rlh2 + * patchlevel 1 + * + * Revision 1.1 90/05/10 11:16:54 rlh2 + * Initial revision + * + * Revision 1.2 88/06/30 09:58:56 mikey + * Handles CMY also. + * + * Revision 1.1 88/06/30 09:10:53 mikey + * Initial revision + * + */ + +#ifndef _color_h_ +#define _color_h_ + +#include <X11/Xraw/XawInit.h> + +typedef struct _RGB { + unsigned short r, g, b; +} RGB; + +typedef struct _HSV { + float h, s, v; /* [0.0, 1.0] */ +} HSV; + +typedef struct _CMY { + unsigned short c, m, y; +} CMY; + +extern void HSVToRGB Xraw_PROTO((HSV *, RGB *)); +extern void RGBToHSV Xraw_PROTO((RGB *, HSV *)); + +#endif /* _color_h_ */ diff --git a/vendor/x11iraf/obm/ObmW/Xraw/xraw_table.h b/vendor/x11iraf/obm/ObmW/Xraw/xraw_table.h new file mode 100644 index 00000000..a8262f75 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/Xraw/xraw_table.h @@ -0,0 +1,94 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _table_h_ +#define _table_h_ + +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <X11/Xraw/Table.h> + +#if __STDC__ || defined(__cplusplus) +#define F_PROTO(s) s +#else +#define F_PROTO(s) () +#endif + +typedef struct _XawTableNodeRec { /* Node of table grid */ + struct _XawTableNodeRec *l; + struct _XawTableNodeRec *r; + struct _XawTableNodeRec *t; + struct _XawTableNodeRec *b; +}XawTableNodeRec, *XawTableNode; + + +extern XtPointer create_table F_PROTO((int rows, + int columns, + int node_size)); + +extern Boolean row_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean row_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern Boolean column_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean column_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern XtPointer get_table F_PROTO((XtPointer f)); + +extern XtPointer get_cell F_PROTO((XtPointer p, + int i, + int j)); + +extern void get_table_size F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void get_cell_positions F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void row_delete F_PROTO((XtPointer p)); + +extern void column_delete F_PROTO((XtPointer p)); + +extern void delete_table F_PROTO((XtPointer p)); + +extern Boolean go_table F_PROTO((XtPointer w, + XawTableProc proc, + XtPointer table, + int begin_row, + int end_row, + int begin_column, + int end_column, + int direction, + register int *row, + register int *column, + XtPointer client_data)); + +#ifdef EBUG_XRAW_MALLOC +extern void _check_table F_PROTO((XtPointer table, + int rows, + int columns)); +#endif + +#undef F_PROTO + +#endif /* _table_h_ */ diff --git a/vendor/x11iraf/obm/ObmW/_c b/vendor/x11iraf/obm/ObmW/_c new file mode 100644 index 00000000..f507eb83 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/_c @@ -0,0 +1,90 @@ + + +initColorResources (w) + GtermWidget w; +{ + w->gterm.color0 = ColorNameToPixel (w, w->gterm.color0Str); + w->gterm.color1 = ColorNameToPixel (w, w->gterm.color1Str); + w->gterm.color2 = ColorNameToPixel (w, w->gterm.color2Str); + w->gterm.color3 = ColorNameToPixel (w, w->gterm.color3Str); + w->gterm.color4 = ColorNameToPixel (w, w->gterm.color4Str); + w->gterm.color5 = ColorNameToPixel (w, w->gterm.color5Str); + w->gterm.color6 = ColorNameToPixel (w, w->gterm.color6Str); + w->gterm.color7 = ColorNameToPixel (w, w->gterm.color7Str); + w->gterm.color8 = ColorNameToPixel (w, w->gterm.color8Str); + w->gterm.color9 = ColorNameToPixel (w, w->gterm.color9Str); + + w->gterm.dialogBgColor = + ColorNameToPixel (w, w->gterm.dialogBgColorStr); + w->gterm.dialogFgColor = + ColorNameToPixel (w, w->gterm.dialogFgColorStr); + + w->gterm.idleCursorBgColor = + ColorNameToPixel (w, w->gterm.idleCursorBgColorStr); + w->gterm.idleCursorFgColor = + ColorNameToPixel (w, w->gterm.idleCursorFgColorStr); + + w->gterm.busyCursorBgColor = + ColorNameToPixel (w, w->gterm.busyCursorBgColorStr); + w->gterm.busyCursorFgColor = + ColorNameToPixel (w, w->gterm.busyCursorFgColorStr); + + w->gterm.ginmodeCursorBgColor = + ColorNameToPixel (w, w->gterm.ginmodeCursorBgColorStr); + w->gterm.ginmodeCursorFgColor = + ColorNameToPixel (w, w->gterm.ginmodeCursorFgColorStr); + w->gterm.crosshairCursorColor = + ColorNameToPixel (w, w->gterm.crosshairCursorColorStr); + + w->gterm.gm_fillColor = + ColorNameToPixel (w, w->gterm.gm_fillColorStr); + w->gterm.gm_fillBgColor = + ColorNameToPixel (w, w->gterm.gm_fillBgColorStr); + + w->gterm.gm_highlightColor = + ColorNameToPixel (w, w->gterm.gm_highlightColorStr); + + w->gterm.gm_cursorFgColor = + ColorNameToPixel (w, w->gterm.gm_cursorFgColorStr); + w->gterm.gm_cursorBgColor = + ColorNameToPixel (w, w->gterm.gm_cursorBgColorStr); + + w->gterm.gm_LineLineColor = + ColorNameToPixel (w, w->gterm.gm_LineLineColorStr); + w->gterm.gm_LineKnotColor = + ColorNameToPixel (w, w->gterm.gm_LineKnotColorStr); + + w->gterm.gm_TextLineColor = + ColorNameToPixel (w, w->gterm.gm_TextLineColorStr); + w->gterm.gm_TextColor = + ColorNameToPixel (w, w->gterm.gm_TextColorStr); + w->gterm.gm_TextBgColor = + ColorNameToPixel (w, w->gterm.gm_TextBgColorStr); + + w->gterm.gm_RectLineColor = + ColorNameToPixel (w, w->gterm.gm_RectLineColorStr); + w->gterm.gm_RectKnotColor = + ColorNameToPixel (w, w->gterm.gm_RectKnotColorStr); + + w->gterm.gm_BoxLineColor = + ColorNameToPixel (w, w->gterm.gm_BoxLineColorStr); + w->gterm.gm_BoxKnotColor = + ColorNameToPixel (w, w->gterm.gm_BoxKnotColorStr); + + w->gterm.gm_CircleLineColor = + ColorNameToPixel (w, w->gterm.gm_CircleLineColorStr); + w->gterm.gm_CircleKnotColor = + ColorNameToPixel (w, w->gterm.gm_CircleKnotColorStr); + + w->gterm.gm_EllipseLineColor = + ColorNameToPixel (w, w->gterm.gm_EllipseLineColorStr); + w->gterm.gm_EllipseKnotColor = + ColorNameToPixel (w, w->gterm.gm_EllipseKnotColorStr); + + w->gterm.gm_PgonLineColor = + ColorNameToPixel (w, w->gterm.gm_PgonLineColorStr); + w->gterm.gm_PgonKnotColor = + ColorNameToPixel (w, w->gterm.gm_PgonKnotColorStr); +} + + diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/AnchoredImage.xbm b/vendor/x11iraf/obm/ObmW/bitmaps/AnchoredImage.xbm new file mode 100644 index 00000000..6e129805 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/AnchoredImage.xbm @@ -0,0 +1,8 @@ +#define AnchoredImage_width 40 +#define AnchoredImage_height 10 +static unsigned char AnchoredImage_bits[] = { + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, + 0x00, 0x80, 0x07, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0xff, + 0x1f, 0xfc, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00, + 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, + 0x80, 0x01}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/DelayedImage.xbm b/vendor/x11iraf/obm/ObmW/bitmaps/DelayedImage.xbm new file mode 100644 index 00000000..2b12a4b3 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/DelayedImage.xbm @@ -0,0 +1,16 @@ +#define DelayedImage_width 40 +#define DelayedImage_height 30 +static unsigned char DelayedImage_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0x01, 0xfe, 0x3f, 0x00, 0xfe, 0x03, 0xfe, 0x3f, 0x00, 0xff, 0x07, 0xfe, + 0x3f, 0x80, 0xff, 0x0f, 0xfe, 0x3f, 0xc0, 0xff, 0x1f, 0xfe, 0x3f, 0xe0, + 0xff, 0x3f, 0xfe, 0x3f, 0xf0, 0xff, 0x7f, 0xfe, 0x3f, 0x00, 0x00, 0x00, + 0xfe, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x3f, + 0xc0, 0x07, 0x00, 0xfe, 0x3f, 0xf0, 0x1f, 0x00, 0xfe, 0x3f, 0xf8, 0x3f, + 0x00, 0xfe, 0x3f, 0xfc, 0x7f, 0x00, 0xfe, 0x3f, 0xfc, 0x7f, 0x00, 0x00, + 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0xfe, + 0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, + 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, + 0xf8, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/ERROR.pm b/vendor/x11iraf/obm/ObmW/bitmaps/ERROR.pm new file mode 100644 index 00000000..93fbeb98 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/ERROR.pm @@ -0,0 +1,41 @@ +/* XPM */ +static char * ERROR [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"32 32 3 1 0 0", +/* colors */ +" s none m none c none", +". s iconColor3 m black c red", +"X s iconColor2 m white c white", +/* pixels */ +" ......... ", +" ............. ", +" ................. ", +" ................... ", +" ..................... ", +" ....................... ", +" ......................... ", +" ........................... ", +" ........................... ", +" ............................. ", +" ............................. ", +"............................... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"....XXXXXXXXXXXXXXXXXXXXXXX.... ", +"............................... ", +" ............................. ", +" ............................. ", +" ........................... ", +" ........................... ", +" ......................... ", +" ....................... ", +" ..................... ", +" ................... ", +" ................. ", +" ............. ", +" ......... ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/FATAL.pm b/vendor/x11iraf/obm/ObmW/bitmaps/FATAL.pm new file mode 100644 index 00000000..51c6a740 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/FATAL.pm @@ -0,0 +1,48 @@ +/* XPM */ +static char * FATAL [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"32 32 10 1 0 0", +/* colors */ +" s none m none c none", +". s iconGray1 m white c #e1e1e1e1e1e1", +"X s iconColor2 m white c white", +"o s iconGray3 m white c #afafafafafaf", +"O s iconGray4 m white c #969696969696", +"+ s iconGray2 m white c #c8c8c8c8c8c8", +"@ s iconGray6 m black c #646464646464", +"# s iconGray5 m black c #7d7d7d7d7d7d", +"$ s iconColor1 m black c black", +"% s iconGray7 m black c #4b4b4b4b4b4b", +/* pixels */ +" ......... ", +" ..XX......... ", +" .XXX.....ooo.O+ ", +" ..XXX.....oooOO@# ", +" .XX.......oooOO@# ", +" ..X+$$$....o$$$O+#% ", +" .X+$$$$$...$$$$$##% ", +" .XX$$$$$$X..$$$$$##@% ", +" .XX.$$$$$X.@$$$$$+##% ", +" .XX.....XX.@.o.O+##@% ", +" .XX.....X$$$@ooOO##@% ", +" ..XX....X$$$+ooO+###% ", +" ..X.....$$$+o+OO##% ", +" ..X....$$$$$oooO#@% ", +" .X....$$$$$ooO#@% ", +" .......$$$.oo#O@% ", +" ..........o#O@% ", +" .......ooo@@% ", +" ....$$$o@@% ", +" ..$$$$$%% ", +" $$$$$$$ ", +" ...$$$+O% ", +" ......OO% ", +" ....OO##% ", +" ooo ..###@@ ..... ", +" o...oooo ....+++@ ", +" o.......ooooo ooooo++##+#@@ ", +" oo@##.......oo....####+o@@@ ", +" .......#########oooo ", +" ...++###+#.........ooo ", +" o++++#+oo@@@@@ooo......@ ", +" oooo@@@ o@@@@@@ "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/INFO.pm b/vendor/x11iraf/obm/ObmW/bitmaps/INFO.pm new file mode 100644 index 00000000..c602b7cb --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/INFO.pm @@ -0,0 +1,42 @@ +/* XPM */ +static char * INFO [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"32 32 4 1 0 0", +/* colors */ +" s none m none c none", +". c #54547070AAAA", +"X s iconColor2 m white c white", +"o s iconColor1 m black c black", +/* pixels */ +" .......................... ", +" ............................ ", +" ...XXXXXXXXXXXXXXXXXXXXXXXX... ", +"...XXXXXXXXXXXXXXXXXXXXXXXXXX...", +"..XXXXXXXXXXXXXoooXXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXXoooXXXXXXXXXXXX..", +"..XXXXXXXXXXXXXXXXXXXXXXXXXXXX..", +"..XXXXXXXXXXXXXXXXXXXXXXXXXXXX..", +"..XXXXXXXXXXXXXXXXXXXXXXXXXXXX..", +"..XXXXXXXXXooooooooXXXXXXXXXXX..", +"..XXXXXXXXXXXooooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXXoooooXXXXXXXXXXX..", +"..XXXXXXXXXXXoooooooXXXXXXXXXX..", +"..XXXXXXXXXoooooooooooXXXXXXXX..", +"...XXXXXXXXXXXXXXXXXXXXXXXXXX...", +" ...XXXXXXXXXXXXXXXXXXXXXXXX... ", +" ............................ ", +" .......................... "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/NONE.pm b/vendor/x11iraf/obm/ObmW/bitmaps/NONE.pm new file mode 100644 index 00000000..49740a00 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/NONE.pm @@ -0,0 +1,36 @@ +/* XPM */ +static char * NONE [] = { +"32 32 1 1", +" s None c None", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/NoImage.xbm b/vendor/x11iraf/obm/ObmW/bitmaps/NoImage.xbm new file mode 100644 index 00000000..d5ba4f75 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/NoImage.xbm @@ -0,0 +1,46 @@ +#define NoImage_width 64 +#define NoImage_height 64 +static unsigned char NoImage_bits[] = { + 0x00, 0x00, 0x40, 0x55, 0x55, 0x55, 0x55, 0x04, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x0c, + 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1d, 0x00, 0x40, 0xc4, 0xff, + 0xff, 0xff, 0x7f, 0x1e, 0x00, 0x10, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x0f, + 0x00, 0x40, 0xfe, 0x00, 0x00, 0x00, 0x50, 0x06, 0x00, 0x88, 0x0f, 0x55, + 0x55, 0x55, 0x05, 0x01, 0x00, 0xc0, 0x57, 0x00, 0x00, 0x00, 0x40, 0x01, + 0x00, 0xf2, 0x03, 0x11, 0x11, 0x11, 0x11, 0x03, 0x00, 0x70, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x03, 0x00, 0xb5, 0xf0, 0xff, 0xff, 0xff, 0x9f, 0x03, + 0x00, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0x80, 0x2c, 0x7f, 0x50, + 0x55, 0x55, 0xc1, 0x01, 0x00, 0x4d, 0x4f, 0x05, 0x00, 0x00, 0x20, 0x00, + 0x80, 0x94, 0x13, 0x10, 0x11, 0x11, 0x31, 0x00, 0x00, 0xc1, 0x44, 0x44, + 0x44, 0x44, 0x64, 0x00, 0x40, 0x76, 0x10, 0xf1, 0xff, 0xff, 0x71, 0x00, + 0x00, 0x23, 0xc5, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x40, 0x30, 0xf8, 0x3f, + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x55, 0xfc, 0x01, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x08, 0x1f, 0x54, 0x05, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x0f, 0x01, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x84, 0x43, 0x10, 0x01, 0x00, 0x00, 0x00, + 0x00, 0xcc, 0x01, 0x44, 0x24, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x10, 0x10, + 0x51, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x44, 0x84, 0x00, 0x00, 0x00, + 0x00, 0x70, 0x08, 0x11, 0x91, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x44, + 0x44, 0x01, 0x00, 0x00, 0x00, 0x18, 0x08, 0x11, 0x11, 0x01, 0x00, 0x00, + 0x00, 0x14, 0x40, 0x44, 0x44, 0x03, 0x00, 0x00, 0x00, 0x10, 0x08, 0x11, + 0x11, 0x03, 0x00, 0x00, 0x00, 0x10, 0x40, 0x44, 0x44, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x11, 0x11, 0x03, 0x02, 0x00, 0x00, 0x00, 0x40, 0x44, + 0xc4, 0x03, 0x0c, 0x00, 0x00, 0x00, 0x10, 0x11, 0x91, 0x03, 0x09, 0x00, + 0x00, 0x00, 0x00, 0x44, 0xc4, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xf1, 0x81, 0x65, 0x00, 0x00, 0x00, 0x00, 0x44, 0xf4, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x11, 0x79, 0x20, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x46, + 0x3e, 0x40, 0x33, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x88, 0x27, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x07, 0xc2, 0x11, 0x00, 0x00, 0x0a, 0x00, 0x00, + 0x80, 0xf0, 0x16, 0x00, 0x80, 0xa0, 0xaa, 0xaa, 0x2a, 0xf4, 0x90, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x7d, 0x4d, 0x00, 0x40, 0x44, 0x44, 0x44, + 0x44, 0x3f, 0xa9, 0x00, 0x00, 0x11, 0x11, 0x11, 0xd1, 0x4f, 0x5c, 0x00, + 0x80, 0xfc, 0xff, 0xff, 0xff, 0x13, 0x46, 0x00, 0x00, 0xfe, 0xff, 0xff, + 0xff, 0x44, 0x5b, 0x00, 0x40, 0x1c, 0x00, 0x00, 0x00, 0xd1, 0x27, 0x00, + 0x10, 0x55, 0x55, 0x55, 0x55, 0xe4, 0x31, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x40, 0x78, 0x35, 0x00, 0x08, 0x11, 0x11, 0x11, 0x11, 0x7e, 0x18, 0x00, + 0x40, 0x44, 0x44, 0x44, 0xc4, 0x5f, 0x1c, 0x00, 0x90, 0xff, 0xff, 0xff, + 0xff, 0x17, 0x0f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x45, 0x07, 0x00, + 0x94, 0x01, 0x00, 0x00, 0x00, 0xd1, 0x03, 0x00, 0x40, 0x55, 0x55, 0x55, + 0x55, 0xf4, 0x01, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x3f, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, + 0xf1, 0x1f, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, + 0xf0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/QUESTION.pm b/vendor/x11iraf/obm/ObmW/bitmaps/QUESTION.pm new file mode 100644 index 00000000..296ceefa --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/QUESTION.pm @@ -0,0 +1,38 @@ +/* XPM */ +static char * QUESTION [] = { +"32 32 3 1", +" s None c None", +". c black", +"X s background m white g gray75 c green", +" ", +" ......... ", +" ............... ", +" ...XXXXXXXXXXX... ", +" ...XXXXX.....XXXXX... ", +" ...XXXX..XXXXX..XXXX... ", +" ..XXXXX..XXXXXXX..XXXXX.. ", +" ..XXXX..XXXXXXXXX..XXXX.. ", +" ..XXXXX..XXXXXXXXX..XXXXX.. ", +" ..XXXXXX....XXXXXXX..XXXXXX.. ", +" ..XXXXXX....XXXXXXX..XXXXXX.. ", +" .XXXXXXXX...XXXXXX..XXXXXXXX. ", +"..XXXXXXXXXXXXXXXX..XXXXXXXXX.. ", +"..XXXXXXXXXXXXXXX...XXXXXXXXX.. ", +"..XXXXXXXXXXXXXX...XXXXXXXXXX.. ", +"..XXXXXXXXXXXX....XXXXXXXXXXX.. ", +"..XXXXXXXXXXX...XXXXXXXXXXXXX.. ", +"..XXXXXXXXXX...XXXXXXXXXXXXXX.. ", +"..XXXXXXXXX..XXXXXXXXXXXXXXXX.. ", +"..XXXXXXXXX..XXXXXXXXXXXXXXXX.. ", +"..XXXXXXXXX..XXXXXXXXXXXXXXXX.. ", +" .XXXXXXXXXX..XX..XXXXXXXXXXX. ", +" ..XXXXXXXXXX....XXXXXXXXXXX.. ", +" ..XXXXXXXXXXXXXXXXXXXXXXXXX.. ", +" ..XXXXXXXXXX...XXXXXXXXXX.. ", +" ..XXXXXXXX.....XXXXXXXX.. ", +" ..XXXXXXXX.....XXXXXXXX.. ", +" ...XXXXXX.....XXXXXX... ", +" ...XXXXXX...XXXXXX... ", +" ...XXXXXXXXXXX... ", +" ............... ", +" ......... "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/WARNING.pm b/vendor/x11iraf/obm/ObmW/bitmaps/WARNING.pm new file mode 100644 index 00000000..6c7fda2b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/WARNING.pm @@ -0,0 +1,39 @@ +/* XPM */ +static char * WARNING [] = { +"32 32 4 1", +" s None c None", +". s border m black g gray50 c red", +"X c gray100", +"o c black", +" .. ", +" .. ", +" .... ", +" .... ", +" ...... ", +" ...... ", +" ........ ", +" ........ ", +" ....XX.... ", +" ....XX.... ", +" ....XXXX.... ", +" ....XooX.... ", +" ....XooooX.... ", +" ....XooooX.... ", +" ....XXooooXX.... ", +" ....XXooooXX.... ", +" ....XXXooooXXX.... ", +" ....XXXooooXXX.... ", +" ....XXXXooooXXXX.... ", +" ....XXXXooooXXXX.... ", +" ....XXXXXooooXXXXX.... ", +" ....XXXXXXooXXXXXX.... ", +" ....XXXXXXXXXXXXXXXX.... ", +" ....XXXXXXXooXXXXXXX.... ", +" ....XXXXXXXooooXXXXXXX.... ", +" ....XXXXXXXooooXXXXXXX.... ", +" ....XXXXXXXXXooXXXXXXXXX.... ", +" ....XXXXXXXXXXXXXXXXXXXX.... ", +" .............................. ", +" .............................. ", +"................................", +"................................"}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm new file mode 100644 index 00000000..6868704f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm @@ -0,0 +1,26 @@ +/* XPM */ +static char * diamond0 [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 3 1 0 0", +/* colors */ +" s none m none c none", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s bottomShadowColor m black c #646464646464", +/* pixels */ +" ", +" ... ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" . . ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XXX ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm.ORIG b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm.ORIG new file mode 100644 index 00000000..652c2549 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0.pm.ORIG @@ -0,0 +1,26 @@ +/* XPM */ +static char * diamond0 [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 3 1 0 0", +/* colors */ +" s none m none c none", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s bottomShadowColor m black c #646464646464", +/* pixels */ +" ... ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +".. ..", +". .", +"XX XX", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XXX "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond0m.pm b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0m.pm new file mode 100644 index 00000000..62ae149e --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0m.pm @@ -0,0 +1,26 @@ +/* XPM */ +static char * diamond0m [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 3 1 0 0", +/* colors */ +" s none m none c none", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s bottomShadowColor m black c #646464646464", +/* pixels */ +" ", +" ... ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" . . ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XXX ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond0s.pm b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0s.pm new file mode 100644 index 00000000..017cbbc4 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond0s.pm @@ -0,0 +1,26 @@ +/* XPM */ +static char * diamond0s [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 3 1 0 0", +/* colors */ +" s none m none c none", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s bottomShadowColor m black c #646464646464", +/* pixels */ +" ", +" ", +" ... ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" . . ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XX XX ", +" XXX ", +" ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm new file mode 100644 index 00000000..3ba177ae --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm @@ -0,0 +1,27 @@ +/* XPM */ +static char * diamond1 [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 4 1 0 0", +/* colors */ +" s none m none c none", +". s bottomShadowColor m black c #646464646464", +"X s foreground m white c white", +"o s topShadowColor m white c #c8c8c8c8c8c8", +/* pixels */ +" ", +" ... ", +" ..X.. ", +" ..XXX.. ", +" ..XXXXX.. ", +" ..XXXXXXX.. ", +" ..XXXXXXXXX.. ", +" ..XXXXXXXXXXX.. ", +" .XXXXXXXXXXXXX. ", +" ooXXXXXXXXXXXoo ", +" ooXXXXXXXXXoo ", +" ooXXXXXXXoo ", +" ooXXXXXoo ", +" ooXXXoo ", +" ooXoo ", +" ooo ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm.ORIG b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm.ORIG new file mode 100644 index 00000000..5adbbc1a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1.pm.ORIG @@ -0,0 +1,27 @@ +/* XPM */ +static char * diamond1 [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 4 1 0 0", +/* colors */ +" s none m none c none", +". s bottomShadowColor m black c #646464646464", +"X s foreground m white c white", +"o s topShadowColor m white c #c8c8c8c8c8c8", +/* pixels */ +" ... ", +" ..X.. ", +" ..XXX.. ", +" ..XXXXX.. ", +" ..XXXXXXX.. ", +" ..XXXXXXXXX.. ", +" ..XXXXXXXXXXX.. ", +"..XXXXXXXXXXXXX..", +".XXXXXXXXXXXXXXX.", +"ooXXXXXXXXXXXXXoo", +" ooXXXXXXXXXXXoo ", +" ooXXXXXXXXXoo ", +" ooXXXXXXXoo ", +" ooXXXXXoo ", +" ooXXXoo ", +" ooXoo ", +" ooo "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond1m.pm b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1m.pm new file mode 100644 index 00000000..575505fb --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1m.pm @@ -0,0 +1,27 @@ +/* XPM */ +static char * diamond1m [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 4 1 0 0", +/* colors */ +" s none m none c none", +". s bottomShadowColor m black c #646464646464", +"X s topShadowColor m white c #c8c8c8c8c8c8", +"o s highlightColor m black c black", +/* pixels */ +" ", +" ... ", +" ..o.. ", +" ..ooo.. ", +" ..ooooo.. ", +" ..ooooooo.. ", +" ..ooooooooo.. ", +" ..ooooooooooo.. ", +" .ooooooooooooo. ", +" XXoooooooooooXX ", +" XXoooooooooXX ", +" XXoooooooXX ", +" XXoooooXX ", +" XXoooXX ", +" XXoXX ", +" XXX ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/diamond1s.pm b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1s.pm new file mode 100644 index 00000000..65597fbe --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/diamond1s.pm @@ -0,0 +1,27 @@ +/* XPM */ +static char * diamond1s [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"17 17 4 1 0 0", +/* colors */ +" s none m none c none", +". s bottomShadowColor m black c #646464646464", +"X s topShadowColor m white c #c8c8c8c8c8c8", +"o s highlightColor m black c black", +/* pixels */ +" ", +" ", +" ... ", +" ..o.. ", +" ..ooo.. ", +" ..ooooo.. ", +" ..ooooooo.. ", +" ..ooooooooo.. ", +" .ooooooooooo. ", +" XXoooooooooXX ", +" XXoooooooXX ", +" XXoooooXX ", +" XXoooXX ", +" XXoXX ", +" XXX ", +" ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/square0.pm b/vendor/x11iraf/obm/ObmW/bitmaps/square0.pm new file mode 100644 index 00000000..c111eca5 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/square0.pm @@ -0,0 +1,24 @@ +/* XPM */ +static char * square0 [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"15 15 3 1 0 0", +/* colors */ +" s topShadowColor m white c #c8c8c8c8c8c8", +". s bottomShadowColor m black c #646464646464", +"X s none m none c none", +/* pixels */ +" ", +" .", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" .............", +" .............."}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/square0m.pm b/vendor/x11iraf/obm/ObmW/bitmaps/square0m.pm new file mode 100644 index 00000000..cb3a8e0d --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/square0m.pm @@ -0,0 +1,24 @@ +/* XPM */ +static char * square0m [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"15 15 3 1 0 0", +/* colors */ +" s none m none c none", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s bottomShadowColor m black c #646464646464", +/* pixels */ +" ", +" ............. ", +" ............X ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" ..XXXXXXXXXXX ", +" .XXXXXXXXXXXX ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/square0s.pm b/vendor/x11iraf/obm/ObmW/bitmaps/square0s.pm new file mode 100644 index 00000000..42a30d8a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/square0s.pm @@ -0,0 +1,24 @@ +/* XPM */ +static char * square0s [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"15 15 3 1 0 0", +/* colors */ +" s none m none c none", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s bottomShadowColor m black c #646464646464", +/* pixels */ +" ", +" ", +" ........... ", +" ..........X ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" .. XX ", +" ..XXXXXXXXX ", +" .XXXXXXXXXX ", +" ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/square1.pm b/vendor/x11iraf/obm/ObmW/bitmaps/square1.pm new file mode 100644 index 00000000..54726f47 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/square1.pm @@ -0,0 +1,24 @@ +/* XPM */ +static char * square1 [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"15 15 3 1 0 0", +/* colors */ +" s bottomShadowColor m black c #646464646464", +". s topShadowColor m white c #c8c8c8c8c8c8", +"X s foreground m white c white", +/* pixels */ +" .", +" ..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" XXXXXXXXXXX..", +" ..............", +"..............."}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/square1m.pm b/vendor/x11iraf/obm/ObmW/bitmaps/square1m.pm new file mode 100644 index 00000000..c26562c8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/square1m.pm @@ -0,0 +1,25 @@ +/* XPM */ +static char * square1m [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"15 15 4 1 0 0", +/* colors */ +" s none m none c none", +". s bottomShadowColor m black c #646464646464", +"X s topShadowColor m white c #c8c8c8c8c8c8", +"o s highlightColor m black c black", +/* pixels */ +" ", +" ............. ", +" ............X ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..oooooooooXX ", +" ..XXXXXXXXXXX ", +" .XXXXXXXXXXXX ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/bitmaps/square1s.pm b/vendor/x11iraf/obm/ObmW/bitmaps/square1s.pm new file mode 100644 index 00000000..ee933e85 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/bitmaps/square1s.pm @@ -0,0 +1,25 @@ +/* XPM */ +static char * square1s [] = { +/* width height ncolors cpp [x_hot y_hot] */ +"15 15 4 1 0 0", +/* colors */ +" s none m none c none", +". s bottomShadowColor m black c #646464646464", +"X s topShadowColor m white c #c8c8c8c8c8c8", +"o s highlightColor m black c black", +/* pixels */ +" ", +" ", +" ........... ", +" ..........X ", +" ..oooooooXX ", +" ..oooooooXX ", +" ..oooooooXX ", +" ..oooooooXX ", +" ..oooooooXX ", +" ..oooooooXX ", +" ..oooooooXX ", +" ..XXXXXXXXX ", +" .XXXXXXXXXX ", +" ", +" "}; diff --git a/vendor/x11iraf/obm/ObmW/color.c b/vendor/x11iraf/obm/ObmW/color.c new file mode 100644 index 00000000..ebd7707b --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/color.c @@ -0,0 +1,309 @@ +/*LINTLIBRARY*/ +/* $Header: /users/romsky/Xraw/last/Xraw/RCS/color.c,v 1.4 1995/12/09 08:03:23 romsky Exp $ */ + +/* + * color.c - color helper routines + * + * Author: Christopher A. Kent + * Western Research Laboratory + * Digital Equipment Corporation + * Date: Sun Dec 13 1987 + * Copyright (c) 1987 Christopher A. Kent + */ + +/* + * See David F. Rogers, "Procedural Elements for Computer Graphics", + * McGraw-Hill, for the theory behind these routines. + */ + +/* + * $Log: color.c,v $ + * Revision 1.4 1995/12/09 08:03:23 romsky + * Dec 09 + * + * Revision 1.4 1995/12/09 08:03:23 romsky + * Dec 09 + * + * Revision 1.3 1995/11/24 03:35:16 romsky + * version 1.1.1 + * + * Revision 1.1 1995/11/24 03:28:25 romsky + * version 1.1.1 + * + * Revision 1.2 1995/11/21 02:40:53 romsky + * *** empty log message *** + * + * Revision 1.1 1995/11/06 05:48:05 romsky + * Initial revision + * + * Revision 1.1 1995/11/06 05:48:05 romsky + * Initial revision + * + * Revision 1.2 1995/10/22 12:32:41 romsky + * *** empty log message *** + * + * Revision 1.1 1995/10/08 11:32:36 romsky + * Initial revision + * + * Revision 1.2 90/06/30 14:32:48 rlh2 + * patchlevel 1 + * + * Revision 1.1 90/05/10 11:17:30 rlh2 + * Initial revision + * + * Revision 1.2 88/06/30 09:58:36 mikey + * Handles CMY also. + * + * Revision 1.1 88/06/30 09:10:32 mikey + * Initial revision + * + */ + +static char rcs_ident[] = "$Header: /users/romsky/Xraw/last/Xraw/RCS/color.c,v 1.4 1995/12/09 08:03:23 romsky Exp $"; + +#include <X11/Xlib.h> +#include <X11/Xraw/color.h> + +#define MAX_INTENSITY 65535 /* for X11 */ + +#define ABS(x) ((x)<0?-(x):(x)) +#define MIN(a,b) ((a)<(b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + + +static RGB RGBWhite = { MAX_INTENSITY, MAX_INTENSITY, MAX_INTENSITY }; +static RGB RGBBlack = { 0, 0, 0 }; + +/* + * Intensity percentages to RGB. + */ + +static void PctToRGB(rgb, rr, gg, bb) + RGB *rgb; + float rr, gg, bb; +{ + if (rr > 1.0) + rr = 1.0; + if (gg > 1.0) + gg = 1.0; + if (bb > 1.0) + bb = 1.0; + + rgb->r = (int)(0.5 + rr * MAX_INTENSITY); + rgb->g = (int)(0.5 + gg * MAX_INTENSITY); + rgb->b = (int)(0.5 + bb * MAX_INTENSITY); +} + +/* + * Intensity percentages to HSV. + */ + +static void PctToHSV(hsv, hh, ss, vv) + HSV *hsv; + float hh, ss, vv; +{ + if (hh > 1.0) + hh = 1.0; + if (ss > 1.0) + ss = 1.0; + if (vv > 1.0) + vv = 1.0; + + hsv->h = hh; + hsv->s = ss; + hsv->v = vv; +} + +/* + * The Manhattan distance between two colors, between 0.0 and 3.0. + */ + +static float RGBDist(r, s) + RGB *r, *s; +{ + return ( + ABS((float)(r->r - s->r)) + + ABS((float)(r->g - s->g)) + + ABS((float)(r->b - s->b))) / (float)MAX_INTENSITY; +} + +/* + * Load an XColor with an RGB. + */ + +static void RGBToXColor(r, x) + RGB *r; + XColor *x; +{ + x->red = r->r; + x->green = r->g; + x->blue = r->b; + x->flags = DoRed | DoGreen | DoBlue; +} + +/* + * Convert a CMY to RGB. + */ + +static void CMYToRGB(rgb, cmy) + RGB *rgb; + CMY *cmy; +{ + rgb->r = MAX_INTENSITY - cmy->c; + rgb->g = MAX_INTENSITY - cmy->m; + rgb->b = MAX_INTENSITY - cmy->y; +} + +/* + * Convert an RGB to CMY. + */ + +static void RGBToCMY(rgb, cmy) + RGB *rgb; + CMY *cmy; +{ + cmy->c = MAX_INTENSITY - rgb->r; + cmy->m = MAX_INTENSITY - rgb->g; + cmy->y = MAX_INTENSITY - rgb->b; +} + +/* + * Mix two RGBs, with scale factors alpha and beta, in RGB space. + */ + +static void MixRGB(r, alpha, s, beta, t) + RGB *r; + float alpha; + RGB *s; + float beta; + RGB *t; +{ + t->r = MAX(0, MIN(MAX_INTENSITY, (int)(alpha*(r->r) + beta*(s->r)))); + t->g = MAX(0, MIN(MAX_INTENSITY, (int)(alpha*(r->g) + beta*(s->g)))); + t->b = MAX(0, MIN(MAX_INTENSITY, (int)(alpha*(r->b) + beta*(s->b)))); +} + +/* + * Mix two RGBs with scale factors alpha and beta, in HSV space. + */ + +static void MixHSV(r, alpha, s, beta, t) + RGB *r; + float alpha; + RGB *s; + float beta; + RGB *t; +{ + HSV rr, ss, tt; + + RGBToHSV(r, &rr); + RGBToHSV(s, &ss); + tt.h = alpha*rr.h + beta*ss.h; + if (ABS(rr.h - ss.h) > 0.5) { + tt.h = tt.h + 0.5; + if (tt.h >= 1.0) + tt.h = tt.h - 1.0; + } + tt.s = alpha*rr.s + beta*ss.s; + tt.v = alpha*rr.v + beta*ss.v; + HSVToRGB(&tt, t); +} + +/* + * Convert an HSV to an RGB. + */ + +void +#ifdef Xraw_NEED_PROTO +HSVToRGB(HSV *hsv, RGB *rgb) +#else +HSVToRGB(hsv, rgb) + HSV *hsv; + RGB *rgb; +#endif +{ + float p, q, t, f; + float h = hsv->h; + float s = hsv->s; + float v = hsv->v; + int i; + + if (s == 0.0) + PctToRGB(rgb, v, v, v); + else { + if (s > 1.0) + s = 1.0; + if (s < 0.0) + s = 0.0; + if (v > 1.0) + v = 1.0; + if (v < 0.0) + v = 0.0; + if (h >= 1.0) + h = 0.0; + + h = 6.0 * h; + i = (int) h; + f = h - (float) i; + p = v * (1.0 - s); + q = v * (1.0 - (s * f)); + t = v * (1.0 - (s * (1.0 - f))); + + switch(i) { + case 0: PctToRGB(rgb, v, t, p); break; + case 1: PctToRGB(rgb, q, v, p); break; + case 2: PctToRGB(rgb, p, v, t); break; + case 3: PctToRGB(rgb, p, q, v); break; + case 4: PctToRGB(rgb, t, p, v); break; + case 5: PctToRGB(rgb, v, p, q); break; + } + } +} + +/* + * Convert an RGB to HSV. + */ + +void +#ifdef Xraw_NEED_PROTO +RGBToHSV(RGB *rgb, HSV *hsv) +#else +RGBToHSV(rgb, hsv) + RGB *rgb; + HSV *hsv; +#endif +{ + float rr, gg, bb; + float min, max; + float rc, gc, bc; + + rr = (float) rgb->r / (float) MAX_INTENSITY; + gg = (float) rgb->g / (float) MAX_INTENSITY; + bb = (float) rgb->b / (float) MAX_INTENSITY; + + max = MAX(MAX(rr, gg), bb); + min = MIN(MIN(rr, gg), bb); + hsv->v = max; + if (max == 0.0) + hsv->s = 0.0; + else + hsv->s = (max - min) / max; + if (hsv->s == 0.0) + hsv->h = 0.0; + else { + rc = (max - rr) / (max - min); + gc = (max - gg) / (max - min); + bc = (max - bb) / (max - min); + if (rr == max) + hsv->h = bc - gc; + else if (gg == max) + hsv->h = 2.0 + rc - bc; + else if (bb == max) + hsv->h = 4.0 + gc - rc; + + if (hsv->h < 0.0) + hsv->h += 6.0; + hsv->h = hsv->h / 6.0; + } +} + diff --git a/vendor/x11iraf/obm/ObmW/cvtLong.c b/vendor/x11iraf/obm/ObmW/cvtLong.c new file mode 100644 index 00000000..710b22af --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/cvtLong.c @@ -0,0 +1,34 @@ +/* + A converter from string to long is defined in the Xmu library, but + the opposite direction is not. Here it is. + + Bert Bos <bert@let.rug.nl> + 13 Aug 1993 +*/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Converters.h" +#include "done.h" + + +Boolean XfwfCvtLongToString(display, args, num_args, from, to, converter_data) + Display *display; + XrmValuePtr args; + Cardinal *num_args; + XrmValuePtr from; + XrmValuePtr to; + XtPointer *converter_data; +{ + char s[30]; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtLongToString", "wrongParameters", + "XtToolkitError", + "long to String conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + sprintf(s, "%ld", *((long*) from->addr)); + done(String, s); +} + diff --git a/vendor/x11iraf/obm/ObmW/done.h b/vendor/x11iraf/obm/ObmW/done.h new file mode 100644 index 00000000..d57c683a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/done.h @@ -0,0 +1,16 @@ +#define done(type, value) \ + do {\ + if (to->addr != NULL) {\ + if (to->size < sizeof(type)) {\ + to->size = sizeof(type);\ + return False;\ + }\ + *(type*)(to->addr) = (value);\ + } else {\ + static type static_val;\ + static_val = (value);\ + to->addr = (XtPointer)&static_val;\ + }\ + to->size = sizeof(type);\ + return True;\ + } while (0) diff --git a/vendor/x11iraf/obm/ObmW/iconutil.c b/vendor/x11iraf/obm/ObmW/iconutil.c new file mode 100644 index 00000000..d1392966 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/iconutil.c @@ -0,0 +1,297 @@ +/* + +The converter from String to Icon knows about a few preloaded icons: +FATAL, ERROR, WARNING, QUESTION, INFO, emptysquare, filledsquare, +emptydiamond, filleddiamond and none. Other names are assumed to be +names of files in XPM format. + +An Icon is a combination of a Pixmap and a mask. The mask is +constructed from the pixels that are marked `none' (i.e., +`transparent') in the XPM data. The other pixels end up in the icon's +pixmap. The actual colors depend on many factors, but the XPM format +offers a way of defining `dynamic' colors, i.e., colors that are +chosen at run time instead of by the icon's designer. The designer can +assign symbolic names to colors, such as `foreground' or `shadow'. The +application can then replace the symbolic names with actual colors +when the icon is loaded. + +The type converter tries to automate this process. When an icon is +loaded, the function looks for symbolic color names that match +resources of the widget into which the icon isloaded. E.g., if the +icon has a symbolic color `mainColor' and the widget has resource of +the same name, the value of the resource will be used as the actual +color for the icon. + +In this way, icons can be created that fit the widget, whatever the +colors of that widget. + +Good symbolic names to use are `background' (defined in every widget), +`foreground' (defined e.g., in |XfwfLabel|), `topShadowColor' and +`bottomShadowColor' (defined in |XfwfFrame|). + +The implementation is as follows: the pixmap for the icon actually has +to be created twice; once to get the list of symbolic colors and again +with the replacement colors. When the XPM data is not preloaded, it is +read from a file. The data is converted to an icon, converted back, +and then again converted to an icon with new colors. + +The converter is passed one extra argument: the widget that the icon +is loaded into. It must be in |args[0].addr|. + +The table of colors to override is set to a fixed size of 20. This +should be enough for most applications: how many widgets have more +than 20 color resources? + +*/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Converters.h" +#include "done.h" +#include "bitmaps/FATAL.pm" +#include "bitmaps/ERROR.pm" +#include "bitmaps/WARNING.pm" +#include "bitmaps/QUESTION.pm" +#include "bitmaps/INFO.pm" +#include "bitmaps/square0.pm" +#include "bitmaps/square1.pm" +#include "bitmaps/diamond0.pm" +#include "bitmaps/diamond1.pm" +#include "bitmaps/square0s.pm" +#include "bitmaps/square1s.pm" +#include "bitmaps/diamond0s.pm" +#include "bitmaps/diamond1s.pm" +#include "bitmaps/square0m.pm" +#include "bitmaps/square1m.pm" +#include "bitmaps/diamond0m.pm" +#include "bitmaps/diamond1m.pm" + +#define MAXCOLORSYM 20 + + + +/* Here are the quarks for the built-in icons names. */ + +static XrmQuark filleddiamondq, emptydiamondq, filledsquareq, emptysquareq, + QUESTIONq, FATALq, ERRORq, WARNINGq, INFOq, noneq; +static XrmQuark diamond0sq, diamond1sq, square0sq, square1sq; +static XrmQuark diamond0mq, diamond1mq, square0mq, square1mq; + +static Boolean initialized = False; + + + +/* This function initializes the quarks. */ + +static void init_icon_quarks() +{ + filleddiamondq = XrmPermStringToQuark("filleddiamond"); + emptydiamondq = XrmPermStringToQuark("emptydiamond"); + filledsquareq = XrmPermStringToQuark("filledsquare"); + emptysquareq = XrmPermStringToQuark("emptysquare"); + + diamond0sq = XrmPermStringToQuark("diamond0s"); + diamond1sq = XrmPermStringToQuark("diamond1s"); + square0sq = XrmPermStringToQuark("square0s"); + square1sq = XrmPermStringToQuark("square1s"); + + diamond0mq = XrmPermStringToQuark("diamond0m"); + diamond1mq = XrmPermStringToQuark("diamond1m"); + square0mq = XrmPermStringToQuark("square0m"); + square1mq = XrmPermStringToQuark("square1m"); + + QUESTIONq = XrmPermStringToQuark("QUESTION"); + FATALq = XrmPermStringToQuark("FATAL"); + ERRORq = XrmPermStringToQuark("ERROR"); + WARNINGq = XrmPermStringToQuark("WARNING"); + INFOq = XrmPermStringToQuark("INFO"); + noneq = XrmPermStringToQuark("none"); + + initialized = True; +} + + +/* The function |file_to_xpmimage| is called by the type converter + * |cvtStringToIcon|. It reads a file in XPM format into an XPM image and + * prints error messages in case of failure. + */ +static void file_to_xpmimage (dpy, file, image) + Display *dpy; + String file; + XpmImage *image; +{ + Cardinal one = 1; + int status; + + status = XpmReadFileToXpmImage (file, image, NULL, NULL); + + switch (status) { + case XpmOpenFailed: + case XpmFileInvalid: + case XpmNoMemory: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "fileError", "XtToolkitError", "Failed to create icon \"%s\"", + (XtPointer) &file, &one); + break; + case XpmColorError: + case XpmColorFailed: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "allocColor", "XtToolkitError", + "Could not get (all) colors for image \"%s\"", + (XtPointer) &file, &one); + break; + case XpmSuccess: + ; /* skip */ + } +} + + +/* The function |data_to_xpmimage| is also called by the type converter + * |cvtStringToIcon|. It converts data in XPM format into an XPM image and + * prints error messages in case of failure. + */ +static void data_to_xpmimage (dpy, data, image) + Display *dpy; + String *data; + XpmImage *image; +{ + int status; + + status = XpmCreateXpmImageFromData (data, image, NULL); + + switch (status) { + case XpmOpenFailed: + case XpmFileInvalid: + case XpmNoMemory: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "fileError", "XtToolkitError", "Failed to create an icon", + NULL, NULL); + break; + case XpmColorError: + case XpmColorFailed: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "allocColor", "XtToolkitError", + "Could not get (all) colors for some icon", NULL, NULL); + break; + case XpmSuccess: + ; /* skip */ + } +} + + +/* The function |build_colortable| is also called from +|cvtStringToIcon|. It looks through all the resources for resources that +specify a color (|Pixel|). All such resources and their values are +entered in the table. + +To get at the resource value, the |resource_offset| (an unsigned int) +must be added to the base address of the widget. The widget pointer is +first converted to an unsigned long, tehn the offset is added to it and +the result is converted back to a pointer, in this case a pointer to a +|Pixel|. */ + +static void build_colortable(self, table, size, n) + Widget self; + XpmColorSymbol *table; + Cardinal size; + Cardinal *n; +{ + Cardinal nres, i; + XtResourceList res; + + *n = 0; + XtGetResourceList(XtClass(self), &res, &nres); + for (i = 0; i < nres; i++) + if (strcmp(res[i].resource_type, XtRPixel) == 0 && *n < size) { + table[*n].name = res[i].resource_name; + table[*n].value = NULL; + table[*n].pixel = + * (Pixel*) ((unsigned long) self + res[i].resource_offset); + (*n)++; + } + if (res) + XtFree ((char *)res); /* MF037 */ +} + + + +Boolean cvtStringToIcon(dpy, args, num_args, from, to, converter_data) + Display *dpy; + XrmValue *args; + Cardinal *num_args; + XrmValue *from; + XrmValue *to; + XtPointer *converter_data; +{ + static XpmColorSymbol table[MAXCOLORSYM]; + String *data = NULL, s = (String) from->addr; + Widget self = (Widget) args[0].addr; + XpmImage image; + Icon *view; + Cardinal n; + XrmQuark q; + + if (! initialized) init_icon_quarks(); + + if (*num_args != 1) + XtAppErrorMsg + (XtDisplayToApplicationContext(dpy), + "cvtStringToIcon", "wrongParameters", "XtToolkitError", + "String to Icon conversion needs one argument: a widget", + (String*) NULL, (Cardinal*) NULL); + + view = (Icon*) XtCalloc(1, sizeof(*view)); + q = XrmStringToQuark(s); + /* + * Convert the input icon or XPM file into an XPM image. + */ + if (q == filleddiamondq) data_to_xpmimage(dpy, diamond1, &image); + else if (q == emptydiamondq) data_to_xpmimage(dpy, diamond0, &image); + else if (q == filledsquareq) data_to_xpmimage(dpy, square1, &image); + else if (q == emptysquareq) data_to_xpmimage(dpy, square0, &image); + else if (q == diamond0sq) data_to_xpmimage(dpy, diamond0s, &image); + else if (q == diamond1sq) data_to_xpmimage(dpy, diamond1s, &image); + else if (q == square0sq) data_to_xpmimage(dpy, square0s, &image); + else if (q == square1sq) data_to_xpmimage(dpy, square1s, &image); + else if (q == diamond0mq) data_to_xpmimage(dpy, diamond0m, &image); + else if (q == diamond1mq) data_to_xpmimage(dpy, diamond1m, &image); + else if (q == square0mq) data_to_xpmimage(dpy, square0m, &image); + else if (q == square1mq) data_to_xpmimage(dpy, square1m, &image); + else if (q == QUESTIONq) data_to_xpmimage(dpy, QUESTION, &image); + else if (q == FATALq) data_to_xpmimage(dpy, FATAL, &image); + else if (q == ERRORq) data_to_xpmimage(dpy, ERROR, &image); + else if (q == WARNINGq) data_to_xpmimage(dpy, WARNING, &image); + else if (q == INFOq) data_to_xpmimage(dpy, INFO, &image); + else if (q == noneq) {XtFree((String)view); done(Icon*, NULL);} + else file_to_xpmimage(dpy, s, &image); + + /* + * Convert back to String format + */ + if (image.width > 0 && image.height > 0) + XpmCreateDataFromXpmImage(&data, &image, NULL); + + /* + * Construct color replacement table and create icon. + */ + if (data) { + build_colortable(self, table, XtNumber(table), &n); + view->attributes.colorsymbols = table; + view->attributes.numsymbols = n; + view->attributes.valuemask = XpmColorSymbols; + (void) XpmCreatePixmapFromData(dpy, DefaultRootWindow(dpy), data, + &view->pixmap, &view->mask, + &view->attributes); + XtFree((String) data); + XpmFreeXpmImage (&image); + done(Icon*, view); + + } else { + XtFree ((String)view); + done(Icon*, NULL); + } +} diff --git a/vendor/x11iraf/obm/ObmW/iconutil.c.ORIG b/vendor/x11iraf/obm/ObmW/iconutil.c.ORIG new file mode 100644 index 00000000..1b6c0079 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/iconutil.c.ORIG @@ -0,0 +1,279 @@ +/* + +The converter from String to Icon knows about a few preloaded icons: +FATAL, ERROR, WARNING, QUESTION, INFO, emptysquare, filledsquare, +emptydiamond, filleddiamond and none. Other names are assumed to be +names of files in XPM format. + +An Icon is a combination of a Pixmap and a mask. The mask is +constructed from the pixels that are marked `none' (i.e., +`transparent') in the XPM data. The other pixels end up in the icon's +pixmap. The actual colors depend on many factors, but the XPM format +offers a way of defining `dynamic' colors, i.e., colors that are +chosen at run time instead of by the icon's designer. The designer can +assign symbolic names to colors, such as `foreground' or `shadow'. The +application can then replace the symbolic names with actual colors +when the icon is loaded. + +The type converter tries to automate this process. When an icon is +loaded, the function looks for symbolic color names that match +resources of the widget into which the icon isloaded. E.g., if the +icon has a symbolic color `mainColor' and the widget has resource of +the same name, the value of the resource will be used as the actual +color for the icon. + +In this way, icons can be created that fit the widget, whatever the +colors of that widget. + +Good symbolic names to use are `background' (defined in every widget), +`foreground' (defined e.g., in |XfwfLabel|), `topShadowColor' and +`bottomShadowColor' (defined in |XfwfFrame|). + +The implementation is as follows: the pixmap for the icon actually has +to be created twice; once to get the list of symbolic colors and again +with the replacement colors. When the XPM data is not preloaded, it is +read from a file. The data is converted to an icon, converted back, +and then again converted to an icon with new colors. + +The converter is passed one extra argument: the widget that the icon +is loaded into. It must be in |args[0].addr|. + +The table of colors to override is set to a fixed size of 20. This +should be enough for most applications: how many widgets have more +than 20 color resources? + +*/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "Converters.h" +#include "done.h" +#include "bitmaps/FATAL.pm" +#include "bitmaps/ERROR.pm" +#include "bitmaps/WARNING.pm" +#include "bitmaps/QUESTION.pm" +#include "bitmaps/INFO.pm" +#include "bitmaps/square0.pm" +#include "bitmaps/square1.pm" +#include "bitmaps/diamond0.pm" +#include "bitmaps/diamond1.pm" + +#define MAXCOLORSYM 20 + + + +/* Here are the quarks for the built-in icons names. */ + +static XrmQuark filleddiamondq, emptydiamondq, filledsquareq, emptysquareq, + QUESTIONq, FATALq, ERRORq, WARNINGq, INFOq, noneq; + +static Boolean initialized = False; + + + +/* This function initializes the quarks. */ + +static void init_icon_quarks() +{ + filleddiamondq = XrmPermStringToQuark("filleddiamond"); + emptydiamondq = XrmPermStringToQuark("emptydiamond"); + filledsquareq = XrmPermStringToQuark("filledsquare"); + emptysquareq = XrmPermStringToQuark("emptysquare"); + QUESTIONq = XrmPermStringToQuark("QUESTION"); + FATALq = XrmPermStringToQuark("FATAL"); + ERRORq = XrmPermStringToQuark("ERROR"); + WARNINGq = XrmPermStringToQuark("WARNING"); + INFOq = XrmPermStringToQuark("INFO"); + noneq = XrmPermStringToQuark("none"); + initialized = True; +} + + +/* The function |file_to_icon| is called by the type converter +|cvtStringToIcon|. It reads a file in XPM format and prints error +messages in case of failure. Of the XPM attributes, only the color +symbols are retained. */ + +static void file_to_icon(dpy, file, icon) + Display *dpy; + String file; + Icon *icon; +{ + Cardinal one = 1; + int status; + +#ifdef OLD_XPM + icon->attributes.valuemask = XpmReturnInfos; +#else + icon->attributes.valuemask = 0; +#endif + status = XpmReadFileToPixmap(dpy, DefaultRootWindow(dpy), file, + &icon->pixmap, &icon->mask, + &icon->attributes); + switch (status) { + case XpmOpenFailed: + case XpmFileInvalid: + case XpmNoMemory: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "fileError", "XtToolkitError", "Failed to create icon \"%s\"", + (XtPointer) &file, &one); + icon->pixmap = icon->mask = None; + break; + case XpmColorError: + case XpmColorFailed: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "allocColor", "XtToolkitError", + "Could not get (all) colors for image \"%s\"", + (XtPointer) &file, &one); + break; + case XpmSuccess: + ; /* skip */ + } +} + + +/* The function |data_to_icon| is also called by the type converter +|cvtStringToIcon|. It converts data in XPM format and prints error +messages in case of failure. Of the XPM attributes, only the color +symbols are retained. */ + +static void data_to_icon(dpy, data, icon) + Display *dpy; + String *data; + Icon *icon; +{ + int status; + +#ifdef OLD_XPM + icon->attributes.valuemask = XpmReturnInfos; +#else + icon->attributes.valuemask = 0; +#endif + status = XpmCreatePixmapFromData(dpy, DefaultRootWindow(dpy), data, + &icon->pixmap, &icon->mask, + &icon->attributes); + switch (status) { + case XpmOpenFailed: + case XpmFileInvalid: + case XpmNoMemory: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "fileError", "XtToolkitError", "Failed to create an icon", + NULL, NULL); + icon->pixmap = icon->mask = None; + break; + case XpmColorError: + case XpmColorFailed: + XtAppWarningMsg + (XtDisplayToApplicationContext(dpy), "cvtStringToIcon", + "allocColor", "XtToolkitError", + "Could not get (all) colors for some icon", NULL, NULL); + break; + case XpmSuccess: + ; /* skip */ + } +} + + +/* The function |build_colortable| is also called from +|cvtStringToIcon|. It looks through all the resources for resources that +specify a color (|Pixel|). All such resources and their values are +entered in the table. + +To get at the resource value, the |resource_offset| (an unsigned int) +must be added to the base address of the widget. The widget pointer is +first converted to an unsigned long, tehn the offset is added to it and +the result is converted back to a pointer, in this case a pointer to a +|Pixel|. */ + +static void build_colortable(self, table, size, n) + Widget self; + XpmColorSymbol *table; + Cardinal size; + Cardinal *n; +{ + Cardinal nres, i; + XtResourceList res; + + *n = 0; + XtGetResourceList(XtClass(self), &res, &nres); + for (i = 0; i < nres; i++) + if (strcmp(res[i].resource_type, XtRPixel) == 0 && *n < size) { + table[*n].name = res[i].resource_name; + table[*n].value = NULL; + table[*n].pixel = + * (Pixel*) ((unsigned long) self + res[i].resource_offset); + (*n)++; + } +} + + + +Boolean cvtStringToIcon(dpy, args, num_args, from, to, converter_data) + Display *dpy; + XrmValue *args; + Cardinal *num_args; + XrmValue *from; + XrmValue *to; + XtPointer *converter_data; +{ + static XpmColorSymbol table[MAXCOLORSYM]; + Cardinal n; + String *data, s = (String) from->addr; + Widget self = (Widget) args[0].addr; + Icon *view; + XrmQuark q; + + if (! initialized) init_icon_quarks(); + + if (*num_args != 1) + XtAppErrorMsg + (XtDisplayToApplicationContext(dpy), + "cvtStringToIcon", "wrongParameters", "XtToolkitError", + "String to Icon conversion needs one argument: a widget", + (String*) NULL, (Cardinal*) NULL); + + view = (Icon*) XtMalloc(sizeof(*view)); + q = XrmStringToQuark(s); + /* + * Create the icon for the first time, store the color names + */ + if (q == filleddiamondq) data_to_icon(dpy, diamond1, view); + else if (q == emptydiamondq) data_to_icon(dpy, diamond0, view); + else if (q == filledsquareq) data_to_icon(dpy, square1, view); + else if (q == emptysquareq) data_to_icon(dpy, square0, view); + else if (q == QUESTIONq) data_to_icon(dpy, QUESTION, view); + else if (q == FATALq) data_to_icon(dpy, FATAL, view); + else if (q == ERRORq) data_to_icon(dpy, ERROR, view); + else if (q == WARNINGq) data_to_icon(dpy, WARNING, view); + else if (q == INFOq) data_to_icon(dpy, INFO, view); + else if (q == noneq) {XtFree((String)view); done(Icon*, NULL);} + else file_to_icon(dpy, s, view); + + /* + * Convert back to String format + */ + (void) XpmCreateDataFromPixmap(dpy, &data, view->pixmap, + view->mask, &view->attributes); + /* + XFreePixmap(dpy, view->pixmap); + XFreePixmap(dpy, view->mask); + */ + XpmFreeAttributes(&view->attributes); + /* + * Construct color replacement table and create icon again + */ + build_colortable(self, table, XtNumber(table), &n); + view->attributes.colorsymbols = table; + view->attributes.numsymbols = n; + view->attributes.valuemask = XpmColorSymbols; + (void) XpmCreatePixmapFromData(dpy, DefaultRootWindow(dpy), data, + &view->pixmap, &view->mask, + &view->attributes); + XtFree((String) data); + done(Icon*, view); +} + + diff --git a/vendor/x11iraf/obm/ObmW/inkstore.h b/vendor/x11iraf/obm/ObmW/inkstore.h new file mode 100644 index 00000000..147e7d52 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/inkstore.h @@ -0,0 +1,1844 @@ +/*-------------------------------------------------------------------------- +** File: inkstore.h +** +** Copyright 1993, Slate Corporation, All Rights Reserved. +** +** This document is part of the Jot specification for the storage and +** interchange of electronic ink data. This specification is the joint work +** of representatives of Slate Corporation, Lotus Development Corporation, +** GO, Microsoft, Apple, General Magic, and others. +** +** This document and the accompanying code samples on disk comprise Version +** 1.0 of the Jot specification for the storage and interchange of electronic +** ink data. Permission is granted to incorporate and otherwise use any +** portion of the specification. You may make copies of the specification +** for distribution to others, provided you include the notice "Copyright +** 1993, Slate Corporation. All Rights Reserved" on both the document and +** the disk label. You may not modify this specification without written +** permission from Slate Corporation. +** +** The specification is provided "as is" without warranty of any kind. Slate +** further disclaims all implied warranties of merchantability or of fitness +** for a particular purpose. The entire risk arising out of the use or +** performance of the specification remains with you. +** +**-------------------------------------------------------------------------- +** +** This is the main body of definitions for the ink storage specification. +** See reference section 1.0 for revision history. +** +**------------------------------------------------------------------------*/ + +#ifndef INKSTORE_INCLUDED +#define INKSTORE_INCLUDED + + + + +/*************************/ +/* REFERENCE SECTION 0.0 */ +/*************************/ + +/*-------------------------------------------------------------------------- +** "Rationale for the ink specification" +** +** This document defines a storage and interchange format for embedded ink +** data. The format is device- and platform-independent. The goal is to +** provide application programs on the same and different platforms and +** operating systems a way to store and exchange ink data. Thus a PenPoint +** user might scribble a note and send the untranslated ink as part of an +** e-mail message to a colleague's pen computer running Windows for Pen +** Computing using Magic Mail. +** +** This specification is for a publicly-defined, external format for +** electronic ink data interchange, and neither assumes nor dictates the +** nature of how the application deals with ink data internally. The format +** is not intended to be the "internal" ink format of an application, though +** there is no reason why it could not serve such a purpose. +** +** The scope and goals of this format design are limited to the represent- +** ation of electronic ink data embedded in some other electronic document, +** not to the larger document itself (such as an e-mail or enhanced word- +** processing data file). +** +** The approach taken is to capture the complete user input for the +** electronic ink, including not just X/Y coordinates, but also a large set +** of current drawing attributes such as nib type and ink color. This +** differs from other possible approaches, such as those based on certain +** recognition models for handwritten text, which require decomposing the +** handwritten ink data first into a set of pre-defined approximation curves +** or sub-strokes, and then storing a list of encodings of these sub-strokes. +** In other words, Jot preserves all information about the original input as +** opposed attempting any sort of abstract characterization of the input. +** +** The storage format has a number of properties: +** +** * Simple. Typical operations on the ink data are easy. If you only wish +** to read stroke coordinates and bounding information from the data, +** complex information that might be present will not hinder the process. +** Likewise, it is easy to write out just simple information. The +** complex information is all optional. +** +** * Compact. The storage format is intended to be as compact as possible +** without sacrificing simplicity or fidelity. Optional information such +** as time stamps or color specifications occupy space only when they are +** present. Specifications that apply to many strokes (such as line width +** or color) are represented just once. +** +** * Compression. The stroke information that describes the ink can +** optionally be represented in a compressed format. Compression +** techniques include both compression and reduction of the ink data. +** +** * Inclusive. The format is capable of storing every property of ink +** conceivable as of today. +** +** * Expandable and Compatible. The format is expandable, so as developers +** discover new information that should be recorded in an ink storage +** format, these new features can be added without changing the behavior of +** existing application programs working with an older version of the +** format. In general, new features can generally be ignored by +** applications reading older versions of the format. Likewise, new +** application programs can handle previous versions of the format without +** special work. +** +** The format is not designed to easily support lots of in-memory +** manipulation of the ink data, such as deleting strokes, changing line +** widths, and so on. A format supporting these types of manipulations would +** be at odds with the above goals. All the information needed to perform +** these manipulations is present in this data format, so an application +** might augment this format to facilitate manipulation of the ink data. +** +** Applications are likely to use some other format internally for real-time +** ink manipulation. Many operating environments provide some internal means +** for storing and manipulating ink data, the details of which may be hidden +** to some extent from the application designer. Many such real-time data +** structures store fewer types of and/or less information (such as not +** preserving information about the tablet point data rate) than are covered +** in this definition. +** +**------------------------------------------------------------------------*/ + + + + +/*************************/ +/* REFERENCE SECTION 1.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** Jot Ink Specification +** --------------------- +** +** Revision History: +** +** March 16, 1992 - First public draft. +** July 13, 1992 - Major rewrite to put data into a series of records. +** July 19, 1992 - Inclusion of ink-compacting definitions. +** July 30, 1992 - Change of target rect to offset. +** December 28, 1992 - Changes incorporated from August 1992 review meeting. +** February 12, 1993 - Incremental fixes due to coding experience. +** March 13, 1993 - Revised definition of a "group". +** April 12, 1993 - Release of version 0.99 of the specification. Moved +** reference sections 28 and 29 to a separate file called +** sample.h +** May 01, 1993 - Release of version 1.00 of the specification. +** Changed INK_OFFSET_RECORD units from twips to pen +** units for consistency and ease of implementation. +** Fixed a typo in reference section 26.0 in the diagram. +** The text accompanying the diagram was correct. +** Fixed a typo in reference section 27.0. The old text +** "delta-X == 0 or 1" was replaced with the correct text +** "delta-X == 2". The accompanying diagram was correct. +** Removed all sizeof() constructs and replaced with +** appropriate #defines to reduce compiler dependencies. +** Tagged all struct definitions with tag_ prefix. +** Added comments and reordered some existing comments. +** May 17, 1993 - Added a few more _SIZE #defines, clarified reserved +** values. +** +** +** GENERAL NOTES +** ------------- +** +** +** Record Structure +** ---------------- +** +** If not otherwise specified, all words are stored in Intel order: low-order +** word first, then high-order word, and inside of a word, low-order byte, +** then high-order byte. For example, a 32 bit quantity 0x12345678 would be +** written to the file as 0x78 0x56 0x34 0x12. The notable exception is the +** storage of point data in "standard compression" format. Sign bits are +** used to indicate item types, so the bytes are stored high-order to low- +** order (exactly opposite). See the sample code and reference section 23.0 +** for more information on the compressed format. Uncompressed data is +** written in Intel order. +** +** All structures are packed for the purposes of writing to a stream. +** +** Signed integer values are two's-complement. Rectangles are stored +** x,y,w,h. +** +** These definitions are intended to insulate the sample ink compaction and +** storage code from any possible variation in item alignment or structure +** packing across architectures. The only possible area of portability +** concern lies in the use of unions in colors (see 11.0) and pen tips (see +** 14.0). +** +** Any use of units of mass to denote units of force ("grams of force"), or +** similar common misuses of physical units, are noted here with an apology +** to any purists, and should be interpreted in the common way by assuming +** one standard gravity. +** +** Record Sequence +** --------------- +** +** In this document, one piece of ink data is called an ink bundle. +** Typically this might correspond to the strokes that make up the ink from +** the time when the pen touches down until the user finishes writing +** (usually determined by a timeout or the pen leaving proximity). Thus an +** ink bundle usually contains many ink strokes, and the strokes do not have +** to describe a continuous line of ink. +** +** As stated in reference section 5.0, all data conforming to this +** specification appears as a stream of ink bundles each of which must begin +** with an INK_BUNDLE_RECORD and end with an INK_END_RECORD. There may be +** more than one INK_BUNDLE_RECORD/INK_END_RECORD pair in a given stream. +** A record stream might look something like this: +** +** INK_BUNDLE_RECORD required // for bundle number one +** INK_SCALE_RECORD optional // sets the scale for rendering +** INK_OFFSET_RECORD optional // sets the offset for rendering +** INK_COLOR_RECORD optional // sets the color for rendering +** INK_START_TIME_RECORD optional // sets the relative start time +** INK_PENTIP_RECORD optional // sets the pentip for rendering +** INK_GROUP_RECORD optional // tags the following PENDATA +** INK_PENDATA_RECORD recommended // actual points +** INK_GROUP_RECORD optional // tags the following PENDATA +** INK_PENDATA_RECORD recommended // actual points +** INK_PENDATA_RECORD recommended // more points in same group +** INK_SCALE_RESET_RECORD optional // resets to default scaling/offset +** INK_PENDATA_RECORD recommended // actual points +** INK_END_TIME_RECORD optional // relative time inking ended +** INK_END_RECORD required // end of bundle number one +** +** It is perfectly reasonable to write out only the following (though doing +** so will cause the ink to be rendered in a completely default manner -- +** black hairline width at 1:1 scaling with offset 0): +** +** INK_BUNDLE_RECORD +** INK_PENDATA_RECORD +** INK_END_RECORD +** +** +** Specification Revisions +** ----------------------- +** +** Future enhancements to this specification may modify certain record types. +** It is guaranteed that any record modified in a subsequent revision of the +** specification will be a strict superset of that record's definition in any +** previous revision of the specification. That is, modified record types +** will only be lengthened, not shortened. If a particular record type must +** be extended such that it would not be a superset of the original, a new +** record type would be added to cover that particular extension. +** +** This extension strategy has two important ramifications: +** +** 1) A reading application should *ALWAYS* use the size of a record as +** recorded in the record structure itself (i.e., the recordLength field +** of the INK_RECORD_HEADERx structure) rather than the sizeof() or any +** other size determined at compile time to determine how may bytes to +** read as the data structures are parsed. This is due to the fact that +** a record may grow in a future revision of the standard. The only +** exception to this rule is the INK_BUNDLE_RECORD which contains a +** version number that will be modified with each change to that record. +** If an INK_BUNDLE_RECORD is encountered and its version matches the +** version used at compile time, the size of the record should exactly +** match the #define of inkRecordBundleSize. +** +** 2) Any particular record may be read into a target data structure up to +** the size of the target data structure and the rest may be ignored. +** This is due to the 'strict superset' rule which means that any +** extension of any record type must leave the meaning, content, and size +** of any existing fields as is. So, for example, if an INK_SCALE_RECORD +** was modified by adding 2 bytes, the reading application can safely read +** the data into the INK_SCALE_RECORD known at compile time and throw +** away the extra two bytes: the header, x, and y will be in the same +** place and will have the same meaning. +** +** +** Files of Ink +** ------------ +** +** It is a recommended practice on DOS and UNIX style file systems to use the +** extension ".JOT" for files consisting solely of ink recorded according to +** this specification. The specification is designed such that ink data can +** be embedded inside any file format and if such a file contains more than +** strictly ink data, it should not use the .JOT extension. +** +**------------------------------------------------------------------------*/ + + + + +/*************************/ +/* REFERENCE SECTION 2.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** Definitions used in this header. +** +** These definitions must be defined appropriately to the target environment +** and compiler. +** +** For example, on some compilers for environments using segmented addressing +** and 64K segments sizes, the correct definition of FAR would be "_huge", +** rather than "_far", because the objects pointed to may be larger than 64K. +** +** In particular, check the definitions of FAR, U32, and S32 for +** compatibility with your compiler, environment, and memory model. +** +**------------------------------------------------------------------------*/ + +#ifndef FAR +#define FAR +#endif + +/* useful constants */ + +#define flag0 (0x0001) +#define flag1 (0x0002) +#define flag2 (0x0004) +#define flag3 (0x0008) +#define flag4 (0x0010) +#define flag5 (0x0020) +#define flag6 (0x0040) +#define flag7 (0x0080) +#define flag8 (0x0100) +#define flag9 (0x0200) +#define flag10 (0x0400) +#define flag11 (0x0800) +#define flag12 (0x1000) +#define flag13 (0x2000) +#define flag14 (0x4000) +#define flag15 (0x8000) + +#define flag16 (0x00010000L) +#define flag17 (0x00020000L) +#define flag18 (0x00040000L) +#define flag19 (0x00080000L) +#define flag20 (0x00100000L) +#define flag21 (0x00200000L) +#define flag22 (0x00400000L) +#define flag23 (0x00800000L) +#define flag24 (0x01000000L) +#define flag25 (0x02000000L) +#define flag26 (0x04000000L) +#define flag27 (0x08000000L) +#define flag28 (0x10000000L) +#define flag29 (0x20000000L) +#define flag30 (0x40000000L) +#define flag31 (0x80000000L) + +#define TRUE 1 +#define FALSE 0 + +/* void pointers */ +typedef void FAR *P_UNKNOWN; +typedef P_UNKNOWN FAR *PP_UNKNOWN; + +#define pNull ((P_UNKNOWN)0) + +/* Unsigned integers */ +typedef unsigned char U8, FAR *P_U8; +#define U8_SIZE 1 +typedef unsigned short U16, FAR *P_U16; +#define U16_SIZE 2 +typedef unsigned long U32, FAR *P_U32; +#define U32_SIZE 4 + +/* Signed integers */ +/* +typedef signed char S8, FAR *P_S8; +#define S8_SIZE 1 +typedef signed short S16, FAR *P_S16; +#define S16_SIZE 2 +typedef signed long S32, FAR *P_S32; +#define S32_SIZE 4 + */ +typedef char S8, FAR *P_S8; +#define S8_SIZE 1 +typedef short S16, FAR *P_S16; +#define S16_SIZE 2 +typedef long S32, FAR *P_S32; +#define S32_SIZE 4 + +/* geometry structures */ +typedef struct tag_XY32 { + S32 x; + S32 y; +} XY32, FAR *P_XY32; +#define XY32_SIZE (S32_SIZE+S32_SIZE) + +typedef struct tag_XY16 { + S16 x; + S16 y; +} XY16, FAR *P_XY16; + +/*------------------------------------------------------------------------- +** Note: +** Angles from vertical can exceed +-90 degrees: in this case, the "back" end +** of the stylus is nearer the tablet surface than the "front" end. +**-------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------- +** Note: +** Standard compaction will normally store angles in nibbles, or single +** bytes, rather than in four-byte records. +**-------------------------------------------------------------------------*/ + +typedef struct tag_ANGLE16 { + S16 theta; /* "X" angle of the stylus, degrees from vertical, */ + /* increasing in the positive "X" direction. */ + S16 phi; /* "Y" angle of the stylus. */ +} ANGLE16, FAR *P_ANGLE16; +#define ANGLE16_SIZE (S16_SIZE+S16_SIZE) + +typedef struct tag_SIZE32 { + S32 w; + S32 h; +} SIZE32, FAR *P_SIZE32; +#define SIZE32_SIZE (S32_SIZE+S32_SIZE) + +typedef struct tag_SIZE16 { + S16 w; + S16 h; +} SIZE16, FAR *P_SIZE16; +#define SIZE16_SIZE (S16_SIZE+S16_SIZE) + +/*------------------------------------------------------------------------- +** Note: +** A rect where xmin==xmax and ymin==ymax has a size of zero: +** size.w and size.h are both zero. +**-------------------------------------------------------------------------*/ + +typedef struct tag_RECT32 { + XY32 origin; + SIZE32 size; +} RECT32, FAR *P_RECT32; +#define RECT32_SIZE (XY32_SIZE+SIZE32_SIZE) + +typedef U32 FIXED_FRACTION; /* fixed point value, unity = 0x00010000 */ +#define FIXED_FRACTION_SIZE U32_SIZE + +#define INK_UNITY_SCALE ((U32) 0x00010000L) + + + + +/*************************/ +/* REFERENCE SECTION 3.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** A block of ink data is called an ink bundle. Each ink bundle consists of +** a series of n records. Each record has a common header that indicates the +** record type and the record length. An ink bundle always starts with an +** INK_BUNDLE_RECORD and always ends with an INK_END_RECORD. +** +** Any records of unknown type can be skipped by simply reading the length of +** the record. +** +** Note: +** Within an ink bundle, time increases. This implies a drawing order of +** back-to-front. Between adjacent sequential bundles, the implicit drawing +** is also back-to-front. +** +** A number of record types are defined. The most common is the +** inkRecordPenData which contains the actual pen data. Other records are +** mostly attributes of the pen data and are optional. They will, in +** general, only be present when a given attribute changes to something +** different than the default value for that attribute. +** +** In order to have the most compact format and also allow large records, +** several different record headers are defined, each with a different +** length. +** +** The top two bits of the record type indicate what kind of record length +** follows: +** +** The record length can be: +** +** - non-existent (the entire record consists of just the recordType) +** - An 8 bit length (one byte) for records up to 255 bytes +** - A 16 bit length (two bytes) for records up to 64k +** - A 32 bit length (four bytes) for really big records +** +**------------------------------------------------------------------------*/ + +#define inkRecordNoLength 0 /* no length, just recordType */ +#define inkRecordLength8 flag14 /* 8 bit length */ +#define inkRecordLength16 flag15 /* 16 bit length */ +#define inkRecordLength32 (flag15 | flag14) /* 32 bit length */ + +/* useful defines for isolating or clearing the length type bits */ +#define inkRecordLengthMask (flag15 | flag14) /* mask for length bits */ +#define inkRecordLengthClearMask (~inkRecordLengthMask) + +/* some useful macros for declaring the various types of record types */ +#define MakeRec0(recType) (recType | inkRecordNoLength) /* no rec length */ +#define MakeRec8(recType) (recType | inkRecordLength8) /* 8 bit length */ +#define MakeRec16(recType) (recType | inkRecordLength16) /* 16 bit length */ +#define MakeRec32(recType) (recType | inkRecordLength32) /* 32 bit length */ + +typedef U16 INK_RECORD_TYPE, FAR *P_INK_RECORD_TYPE; +#define INK_RECORD_TYPE_SIZE U16_SIZE + +#define inkRecordHeaderLength(record_type) \ + ( (((record_type) & inkRecordLength32) == inkRecordNoLength) ?\ + INK_RECORD_TYPE_SIZE \ + : (((record_type) & inkRecordLength32) == inkRecordLength8) ?\ + INK_RECORD_TYPE_SIZE+U8_SIZE \ + : (((record_type) & inkRecordLength32) == inkRecordLength16) ?\ + INK_RECORD_TYPE_SIZE+U16_SIZE \ + : INK_RECORD_TYPE_SIZE+U32_SIZE \ + ) + +/*------------------------------------------------------------------------- +** Note: most compilers will not generate code for the above macro but will +** determine the proper value at compile time. +**-------------------------------------------------------------------------*/ + + +/*************************/ +/* REFERENCE SECTION 4.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** These are all the currently defined record types. The macro MakeRecX() +** encodes the right bits in with the record Id to define its recordLength. +** +** For simplicity, recType values may not be repeated for different +** INK_RECORD_TYPEs. Use of a record type defined as MakeRec32(63) thus +** forbids the use of a record type defined as MakeRec16(63), MakeRec8(63), +** or MakeRec0(63). +** +** Record type 63 is reserved explicitly for possible future extension beyond +** 63 record types. +** +**------------------------------------------------------------------------*/ + +#define inkRecordEnd MakeRec0( 0) /* end of bundle */ +#define inkRecordBundle MakeRec8( 1) +#define inkRecordPenData MakeRec32( 2) +#define inkRecordScale MakeRec8( 3) +#define inkRecordScaleReset MakeRec0( 4) +#define inkRecordColor MakeRec8( 5) +#define inkRecordTip MakeRec8( 6) +#define inkRecordGroup MakeRec8( 7) +#define inkRecordOffset MakeRec8( 8) +#define inkRecordStartTime MakeRec8( 9) +#define inkRecordEndTime MakeRec8( 10) +#define inkRecordPointsPerSecond MakeRec8( 11) +#define inkRecordUnitsPerZ MakeRec8( 12) +#define inkRecordUnitsPerForce MakeRec8( 13) + +/* Record types 14 .. 61 are reserved for future definition. */ + +#define inkRecordApp MakeRec32(62) /* application-specific records*/ +#define inkRecordExt MakeRec32(63) /* reserved for extension */ + +/*------------------------------------------------------------------------- +** Every record starts with a header that contains the recordType and the +** recordLength. The recordType indicates the type of data here. The +** recordLength indicates the total length of all the data for the record +** (including the size of the header). +**-------------------------------------------------------------------------*/ + +/* no recordLength */ +typedef struct tag_INK_RECORD_HEADER0 { + INK_RECORD_TYPE recordType; +} INK_RECORD_HEADER0, FAR *P_INK_RECORD_HEADER0; + +/* 8 bit recordLength */ +typedef struct tag_INK_RECORD_HEADER8 { + INK_RECORD_TYPE recordType; + U8 recordLength; +} INK_RECORD_HEADER8, FAR *P_INK_RECORD_HEADER8; + +/* 16 bit recordLength */ +typedef struct tag_INK_RECORD_HEADER16 { + INK_RECORD_TYPE recordType; + U16 recordLength; +} INK_RECORD_HEADER16, FAR *P_INK_RECORD_HEADER16; + +/* 32 bit recordLength */ +typedef struct tag_INK_RECORD_HEADER32 { + INK_RECORD_TYPE recordType; + U32 recordLength; +} INK_RECORD_HEADER32, FAR *P_INK_RECORD_HEADER32; + + + + +/*************************/ +/* REFERENCE SECTION 5.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** A bundle of ink consists of an INK_BUNDLE_RECORD, a series of records, +** terminated with an INK_END_RECORD. +** +** An INK_BUNDLE_RECORD, along with a matching INK_END_RECORD, are the +** mandatory records in the format. The ink data must start with an +** INK_BUNDLE_RECORD. +** +** It is suggested that anyone reading this format do a number of validity +** checks on the first record in any ink data. The first record should meet +** the following minimum requirements: +** +** 1) header.recordType == INK_RECORD_BUNDLE +** 2) header.recordLength >= inkRecordBundleSize (See general notes in +** reference section 1.0 for important information about record sizes.) +** 3) compactionType is an expected and supported value +** 4) penUnitsPerX and penUnitsPerY seem reasonable and expected: +** greater than, say, 1000 units per meter (25.4/inch), less than, say, +** 400,000 (~10,000 units per inch) +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_END_RECORD { + INK_RECORD_HEADER0 header; /* value is inkRecordEnd */ +} INK_END_RECORD, FAR *P_INK_END_RECORD; +#define inkRecordEndSize (inkRecordHeaderLength(inkRecordEnd)) + + + + +/*************************/ +/* REFERENCE SECTION 6.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** The terms compression and compaction are used somewhat interchangeably +** in this specification but they actually have slightly different meanings +** and are both supported to a certain extent by Jot. +** +** Compression refers to a technique of encoding data such that the resuling +** data, while smaller, is still whole. That is, compression under Jot is +** loss-less. Compaction refers to a process where certain pieces of less +** important data are actually omitted from the stream and are possibly +** reconstructed by the reader of the data. +** +** Using Jot, a writing application may choose to compress only, compact only +** or use some combination. The standard compression mechanism defined here +** and implemented in the sample code supports both notions. +** +**------------------------------------------------------------------------*/ + +typedef U8 INK_COMPACTION_TYPE, FAR *P_INK_COMPACTION_TYPE; +#define INK_COMPACTION_TYPE_SIZE U8_SIZE +#define inkNoCompression (0) +#define inkStdCompression (1) + +/*------------------------------------------------------------------------- +** Other compression schemes may be adopted in future revisions of this +** specification. +**-------------------------------------------------------------------------*/ + + + + +/*************************/ +/* REFERENCE SECTION 7.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** The INK_BUNDLE_FLAGS contain some flags that apply to an entire bundle. +** If you wanted to store several pieces of ink that had different +** INK_BUNDLE_FLAGS, you would do it by storing several different bundles. +** +** Advisory flags: +** +** inkPointsRemoved +** Indicates whether all original points are still present or whether +** some points were removed to save space. For applications that are +** only interested in the visual aspects of ink, many points can be +** removed that do not affect the appearance (i.e. duplicate points, +** collinear points, points which deviate less than some screen +** resolution, etc..). Some other types of applications must know that +** points are present at some consistent sampling rate (i.e. some forms +** of handwriting translation). This flag indicates whether all +** original points are still there. +** +** Note: +** The purpose of "inkPointsRemoved" is to indicate that the timing +** information cannot be accurately derived by counting points: +** replacing individual points with an "elided point" item does not +** constitute removing points. ("Elided" means omitted or skipped). +** +** inkProxDataRemoved +** Indicates that the original points between strokes (proximity) were +** removed to save space. An out-of-prox point should be stored between +** strokes to delimit them. Some applications depend on knowing the +** time between strokes or at the ends of strokes for certain +** functions. +** +** Note: +** "Proximity" is defined as the stylus being close enough to the tablet +** for the tablet to report the stylus position, although perhaps at +** lower accuracy and perhaps at a lower number of points per second. A +** recommended practice is to include "out of proximity" points in the +** recorded ink data when they are used as part of determining the +** amount of time a stylus was out of contact with the tablet, or for +** triggering the completion of an action such as a "gesture". +** +** inkStrokeLimitsPresent +** Indicates that INK_BUTTONS items are also present, and that they +** indicate what the storing app decided the stroke start/end points +** were. (Note: the reading application may otherwise use a different +** algorithm for using tip force values to delimit strokes.) +** +** Note: +** If inkStrokeLimitsPresent is set, then inkButtonDataPresent must also +** be set. +** +** Data flags: +** +** inkAngleDataPresent indicates angle data is present. +** inkForceDataPresent indicates force data is present. +** inkProxDataPresent indicates points are present when pen is lifted +** up (i.e. the force drops below some threshold). +** inkRotationDataPresent indicates pen rotation data is present. +** inkHeightDataPresent indicates pen height data is present. +** inkButtonDataPresent indicates "button state" information is present. +** inkPreMultiplyScale indicates that scaling should be applied before +** the offset value is added ("pre-multiply") +** rather than after ("post-multiply") +** +** Note: +** A previous draft version included a provision for compacting data to an +** approximation based on Bezier curves. Initial results did not show +** promise in terms of efficiency and performance. +** +** "inkBezierRepresentation" would have indicated that the X/Y ordinates +** reflected a Bezier approximation to the original tablet data. This would +** have meant that the ordinate data represented aggregates of anchor points +** and control points for each piece wise approximation, and therefore could +** not be used directly to render the data. The definition of these anchor +** and control points, and the example code for the approximation and +** regeneration of the "true" coordinates could not be worked out at this +** time. +** +** Some standard values for pen units per meter follow: +** +** 1000 points per inch digitizer == 39370 pen units per meter +** 500 points per inch digitizer == 19685 pen units per meter +** 200 points per inch digitizer == 7874 pen units per meter +** 254 points per inch (1/10 mm) == 10000 pen units per meter +** +** 1000 pen units per meter is a reasonable minimum; 400,000 is a reasonable +** maximum value. +** +** The specific format for each of these types of data is described in the +** INK_PENDATA_RECORD documentation (reference section 8.0). +** +** Note: +** The order in which these flags are defined has nothing to do with the +** order in which the data appears in the INK_POINT structure when reading +** or writing point data. For more information, see reference section 21.0. +** +**------------------------------------------------------------------------*/ + +typedef U16 INK_BUNDLE_FLAGS, FAR *P_INK_BUNDLE_FLAGS; +#define INK_BUNDLE_FLAGS_SIZE U16_SIZE +#define inkPointsRemoved (flag0) +#define inkProxDataRemoved (flag1) +#define inkAngleDataPresent (flag2) +#define inkForceDataPresent (flag3) +#define inkRotationDataPresent (flag4) +#define inkHeightDataPresent (flag5) +#define inkButtonDataPresent (flag6) +#define inkStrokeLimitsPresent (flag7) +#define inkPreMultiplyScale (flag8) + +/*------------------------------------------------------------------------- +** Reserved: flag9, flag10, flag11, flag12, flag13, flag14, flag15. +** More flags beyond flag15 can be added in a new record type +** in a later revision to this specification. +**-------------------------------------------------------------------------*/ + + +typedef struct tag_INK_BUNDLE_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordBundle */ + U8 version; /* Value for release 1.0 is 1 */ + INK_COMPACTION_TYPE compactionType; + INK_BUNDLE_FLAGS flags; /* flags for the whole bundle */ + U32 penUnitsPerX; /* pen units per meter (x dir) */ + U32 penUnitsPerY; /* pen units per meter (y dir) */ +} INK_BUNDLE_RECORD, FAR *P_INK_BUNDLE_RECORD; + +#define inkPointDefaultVersion (1) +#define inkPointDefaultCompactionType (inkStdCompression) +#define inkPointDefaultBundleFlags (0) +#define inkPointDefaultPenUnitsPerX (1000) +#define inkPointDefaultPenUnitsPerY (1000) + +#define inkRecordBundleSize \ + (inkRecordHeaderLength(inkRecordBundle) + U8_SIZE + \ + INK_COMPACTION_TYPE_SIZE + INK_BUNDLE_FLAGS_SIZE + \ + U32_SIZE + U32_SIZE) + + + + +/*************************/ +/* REFERENCE SECTION 8.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** A penData record contains the actual pen data for one or more pen strokes. +** The bounds applies to all the strokes contained within this record. +** Multiple strokes are typically grouped into one record to increase the +** efficiency of the compression algorithm, though strokes may be stored +** individually, if desired. +** +** The bounds is the pure mathematical bounds of the raw pen points and does +** not take into account any rendering information such as the pen tip or the +** line width. All points in the INK_PENDATA have been normalized relative +** to the lower bounds in the INK_PENDATA header. +** +** Some applications will prefer to know the bounds of individual strokes. +** This can be accomplished in two ways. +** +** 1) The bounds for a given stroke can be computed when reading the file +** by decompressing an INK_PENDATA_RECORD into its strokes and then +** traversing the points in each stroke to build the bounds for each +** stroke. +** +** 2) An application can decide to store only one stroke per +** INK_PENDATA_RECORD (and thus the bounds of the PENDATA_RECORD is +** already the bounds of one stroke). The sacrifice here is in +** compression efficiency and the need to still support reading files +** written by other applications that might group multiple strokes +** into a single INK_PENDATA_RECORD. +** +** Note: +** In practice, our experience is that unpacking the data in order to compute +** the bounds for each stroke to check for strokes that intrude into a given +** region is not an excessive burden. The checks that would have been done +** on the bounds of each stroke can be done on the builds for each penData +** group, and not all strokes must be checked individually. +** +** The format of the pen data is determined by the settings for +** compactionType and flags in the INK_BUNDLE_RECORD structure, and +** is described later in this file. Two formats are currently defined: +** an uncompacted format and a delta-encoded compacted format, both with +** optional components present or absent depending on the state of the flags +** in the INK_BUNDLE_RECORD. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_PENDATA_RECORD { + INK_RECORD_HEADER32 header; /* value is inkRecordPenData */ + RECT32 bounds; + U8 inkData[1]; /* ink data goes here: definitions */ + /* follow later in this file. */ +} INK_PENDATA_RECORD, FAR *P_INK_PENDATA_RECORD; +#define inkRecordPenDataSize(data_length) \ + (inkRecordHeaderLength(inkRecordPenData) + RECT32_SIZE + (data_length)) + + + + +/*************************/ +/* REFERENCE SECTION 9.0 */ +/*************************/ + +/*------------------------------------------------------------------------- +** Ink scale is recorded in two fixed point values. A unity scale (scale +** of one) is represented as 0x00010000, a scale of 0.5 as 0x00008000. +** +** Note: +** All ink is located relative to the lower-left (0,0) corner of a logical +** page or window. Scale and offset operations are cumulative, much in the +** same way as in PostScript. One begins with a normalized graphics state +** and sequentially applies the scale and offset operations to that matrix. +** The INK_SCALE_RESET record returns the graphics state to its default state +** (i.e., the transformation matrix is set to an identity matrix and the +** offset is reset to the default of 0). By default, scaling is applied +** after adding in any offset specified in an INK_OFFSET_RECORD. If the ink +** bundle has the inkPreMultiplyScale bit set, for all ink in that bundle +** scaling is applied before adding in any offset. +** +** As used in this format, ink scale and offset values are set by the storing +** application, to be applied by the rendering application. If the storing +** application collected the ink at scales of (2.0,2.0), the storing +** application should insert an INK_SCALE_RECORD with a scale of (0.5,0.5) +** for the rendering application to multiply all ink X and Y coordinates by. +** +** It is the responsibility of the storing application to deal with any +** effects from round-off or truncation error due to the limits of precision +** in the FIXED_FRACTION values used in INK_SCALE_RECORDs. +** +** An ink scale record indicates a scale change that stays in effect until +** another ink scale record is encountered. Ink scale values compound: if +** the current scale is (2.0,2.0) and an INK_SCALE_RECORD is encountered with +** scale of (2.0,3.0), the scale to be applied to ink then becomes(4.0,6.0). +** In absence of any ink scale record, the default ink scale is unity. In +** general, a typical usage pattern for an application that supports drawing +** ink while zoomed at scale is to record a number of strokes at a given +** scale, reset the scale with an INK_SCALE_RESET_RECORD (which resets both +** the scale and the offset to the default values), then switch to another +** scale, then record a number more strokes, and so on. +** +** Note: +** The extension scaling and offset to the Z ordinate value is not defined in +** this version of the specification. The extension to Z scaling and offset +** in a "standard" record type (i.e. not an application-specific record) may +** be addressed in the future. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_SCALE { + FIXED_FRACTION x; /* scale in the x direction */ + FIXED_FRACTION y; /* scale in the y direction */ +} INK_SCALE, FAR *P_INK_SCALE; +#define INK_SCALE_SIZE (FIXED_FRACTION_SIZE+FIXED_FRACTION_SIZE) + +#define inkPointDefaultScale (INK_UNITY_SCALE) /* Unity. */ + +typedef struct tag_INK_SCALE_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordScale */ + INK_SCALE scale; +} INK_SCALE_RECORD, FAR *P_INK_SCALE_RECORD; +#define inkRecordScaleSize \ + (inkRecordHeaderLength(inkRecordScale) + \ + FIXED_FRACTION_SIZE + FIXED_FRACTION_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 10.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** The offset position is used to relocate ink data, after scaling. For +** example, in a forms application, ink in a sketch field is drawn relative +** to a given sketch field in the form. The location of this original field +** is important to know so we know how the ink in this bundle relates to its +** original field. If we wanted to move this ink to another field (i.e. +** cut/paste or move), we would need to know the location of the original +** field so we could render the ink in the new field in a manner consistent +** with how it was drawn relative to its original field (i.e. a similar +** baseline for a hand-written signature). +** +** This record is optional. If it exists, it will then apply to all +** following pen data in the file. If it is not present it is assumed that +** no information of this type is relevant. For example, while field ink +** would have an offset position, markup ink over an entire form would not +** have a offset position (or would have an offset position of (0,0) and a +** scale of (1,1)) because it is relative to the entire form coordinate +** system, not relative to some piece in the form. +** +** Note: +** This approach allows a reader to "blindly" apply the scale and offset +** values specified to ink data, and puts the burden for computing +** compounding of multiple zoom levels, etc., on the writing application. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_OFFSET_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordOffset */ + XY32 positionOffset; /* values are in pen units */ +} INK_OFFSET_RECORD, FAR *P_INK_OFFSET_RECORD; + +#define inkRecordOffsetSize \ + (inkRecordHeaderLength(inkRecordOffset) + XY32_SIZE) + +#define inkPointDefaultOffset ((S32) 0) /* No offset. */ + + +typedef struct tag_INK_SCALE_RESET_RECORD { + INK_RECORD_HEADER0 header; /* value is inkRecordScaleReset */ +} INK_SCALE_RESET_RECORD, FAR *P_INK_SCALE_RESET_RECORD; + +#define inkRecordScaleResetSize (inkRecordHeaderLength(inkRecordScaleReset)) + + + + +/**************************/ +/* REFERENCE SECTION 11.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Ink color is represented as an rgb value, plus opacity. +** +** The default color is black (r,g,b,o) = (0,0,0,255). A color change +** present in the file remains in effect until another color change. +** Typically, the color will stay the same for many ink strokes and thus +** a color record will only be used occasionally when the color changes. +** +** "Opacity" is rather vaguely understood, especially in color environments. +** In this context, opacity means the degree to which the display underneath +** the ink shows through. An opacity value of 255 means that nothing under +** the ink shows through; 0 means that everything shows through (the ink +** is transparent). It is up to the reading application to define the +** implementation of opacity on the reading platform. +** +** The color/opacity value of (255,255,255,0), or "transparent white" is +** defined as an "erase" color. In inking applications that support a true +** "erase" function, such as the ability to erase annotation ink on an +** "original" document (perhaps a FAX image) the "erase" color restores the +** background image where painted. The "background image" is defined by the +** rendering application. +** +** Applications which do not support a true "erase" function may interpret +** this as some other drawing function, such as drawing the "background" +** color. +** +**------------------------------------------------------------------------*/ + +typedef union { + U32 all; + struct { + U8 red, + green, + blue, + opacity; /* opaqueness: see defines below */ + } rgb; +} INK_COLOR, FAR *P_INK_COLOR; +#define INK_COLOR_SIZE (U32_SIZE) + +typedef struct tag_INK_COLOR_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordColor */ + INK_COLOR color; +} INK_COLOR_RECORD, FAR *P_INK_COLOR_RECORD; +#define inkRecordColorSize \ + (inkRecordHeaderLength(inkRecordColor) + U32_SIZE) + +/*------------------------------------------------------------------------- +** Standardized opacity values: +** A recommended practice is that an opacity value of 128 (midway between +** 0 and 255) be used for "highlighter" colors. A recommended practice is +** that grey values as defined below be used for "standard grey" +** highlighters. +**-------------------------------------------------------------------------*/ + +#define inkOpacityTransparent 0x00 +#define inkOpacityHighlight 0x80 +#define inkOpacityOpaque 0xFF + +/* Standard solid colors: */ + +#define inkColorErase {0xFF,0xFF,0xFF,0x00} +#define inkColorWhite {0xFF,0xFF,0xFF,0xFF} +#define inkColorLtGrey {0x80,0x80,0x80,0xFF} +#define inkColorDkGrey {0x40,0x40,0x40,0xFF} +#define inkColorBlack {0x00,0x00,0x00,0xFF} + +/* Standard highlighter (transparent) colors: */ + +#define inkColorLtGreyHighlight {0x80,0x80,0x80,0x80} +#define inkColorDkGreyHighlight {0x40,0x40,0x40,0x80} + +#define inkDefaultColor ((INK_COLOR) inkColorBlack) + + + + +/**************************/ +/* REFERENCE SECTION 12.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Time is measured in milliseconds. +** +** Note: +** Because of the difficulty synchronizing clocks on different machines +** at the time granularity of digitizing tablets, and because the "editing" +** of ink at a later time makes the definition of the absolute time for each +** ink point ambiguous, the base for the time is arbitrary. All times in +** strokes are just relative to each other with no absolute time +** relationship. +** +** These records, when encountered in the file, apply to the next stroke data +** in the file (so this record comes before the penData that it applies to). +** End time records are not required. The interpretation of an end time +** which is in conflict with the end time inferred from the assumed data rate +** of points and the number of points (including elided points) is not +** defined. +** +** Start time is the time for the first point in the following penData record +** and end time is the time of the last point in the following penData +** record, because if you are recording tip force, the exact definition of +** pen up and pen down may be fuzzy and/or application dependent. +** +**------------------------------------------------------------------------*/ + +typedef U32 INK_TIME, FAR *P_INK_TIME; /* milliseconds */ +#define INK_TIME_SIZE U32_SIZE + +#define inkDefaultTime ((INK_TIME) 0) + +typedef struct tag_INK_START_TIME_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordStartTime */ + INK_TIME startTime; +} INK_START_TIME_RECORD, FAR *P_INK_START_TIME_RECORD; +#define inkRecordStartTimeSize \ + (inkRecordHeaderLength(inkRecordStartTime) + INK_TIME_SIZE) + +typedef struct tag_INK_END_TIME_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordEndTime */ + INK_TIME endTime; +} INK_END_TIME_RECORD, FAR *P_INK_END_TIME_RECORD; +#define inkRecordEndTimeSize \ + (inkRecordHeaderLength(inkRecordEndTime) + INK_TIME_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 13.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** INK_PENDATA_RECORDs can be grouped. If they are grouped, each +** INK_PENDATA_RECORD can be assigned a group number. All +** INK_PENDATA_RECORDs with the same group number belong to the same group. +** +** The exact interpretation of grouping is up the applications involved. +** Writing applications may group ink data, but not all reading applications +** that read the data may interpret grouping in the same way. +** +** For example, grouping could be used in the traditional fashion as in +** drawing programs so the user moves or copies an entire group of +** INK_PENDATA_RECORDs together. A group could also be used to signify a +** series of INK_PENDATA_RECORDs entered by the user all within some criteria +** (i.e. all during one proximity session or all within some time frame). +** +** Group numbers are simply signed 16 bit values and can be anything. They +** do not need to be contiguous (i.e. they do not need to be 0,1,2). They +** can be 12,49,-12345 if that is useful. +** +** This record can also be used as a simple marker for starting a new group +** when the groupId is not really used: Group numbers of 0,0,0,0 ... are +** thus permitted. +** +** INK_GROUPs are nestable. Group 0 is reserved as the end-of-group marker +** for disjoint groups. If no end-of-group marker is encountered before the +** end of the file or the end of all ink data (as indicated by an +** INK_END_RECORD), all current (and possibly nested) groups are terminated +** as if end-of-groups markers for them had been encountered. +** +**------------------------------------------------------------------------*/ + +typedef S32 INK_GROUP, FAR *P_INK_GROUP; +#define INK_GROUP_SIZE S32_SIZE + +typedef struct tag_INK_GROUP_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordGroup */ + INK_GROUP groupId; /* application-specific interpretation */ +} INK_GROUP_RECORD, FAR *P_INK_GROUP_RECORD; + +#define inkDefaultGroup ((INK_GROUP) 0) + +#define inkRecordGroupSize \ + (inkRecordHeaderLength(inkRecordGroup) + INK_GROUP_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 14.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Some applications may support the idea of rendering ink as if it were +** drawn by a certain shaped pen tip. The most common pen tips would be +** round or rectangular. The exact details of how to render a given pen +** tip will be application specific, but this record states what pen tip +** parameters were used by the storing app. +** +** Pen tips determine, in part, how ink is rendered. For pen tip types +** defined in future versions of this format which require additional +** parameters (such as the X and Y rectangle for a simulated nib pen, or +** brush dimensions for a simulated brush), additional data is included +** at the end of the structure. +** +** The writing application should be aware that the reading application will +** only do "the best possible" job of rendering and that fully compliant +** reading applications may not be able to render certain nib types and/or +** colors. Both reading and writing applications should pay particular +** attention to the following notes regarding defaults and ink drawn at a +** width of zero. +** +** A pen tip which is drawing ink in zero width renders at the minimum +** visible width the reading application will support. +** +** A recommended practice is that ink which should not render (should this +** be called for) be drawn with a color value of (0,0,0, 0), i.e., black, +** completely transparent. +** +** Pen tip size should scale when an INK_SCALE_RECORD is encountered. The +** writing application should write a new INK_PENTIP_RECORD after an +** INK_SCALE_RECORD if the writing application does not want the pen tip +** size to scale along with the ink. If the pen tip scales to zero width, +** it should be rendered by the reading application according to the comment +** above. +** +** The default pen tip if no pentip record exists is INK_PENTIP_ROUND, with a +** width of one twip. The dimensions of a round nib specify diameter, not +** radius: the X/Y coordinate is the center of this diameter. Similarly, for +** for rectangular nibs, the X/Y coordinate is the center of the rectangle. +** +** Note: +** This specification does not specify information for an algorithmic +** variation in nib width, ink color, or other "brush" effects as a function +** of tip force, speed or any other factor. An example would be for an +** application to draw wider ink as the user presses down harder with the +** stylus. Applications wishing to implement such features may do so using +** application-specific record types for this revision of the specification. +** +**------------------------------------------------------------------------*/ + +typedef S16 INK_PENTIP, FAR *P_INK_PENTIP; +#define INK_PENTIP_SIZE S16_SIZE +#define INK_PENTIP_ROUND (0) /* Diameter in twips */ +#define INK_PENTIP_RECTANGLE (1) /* Dimensions in twips */ +#define INK_PENTIP_SLANT_RECTANGLE (2) +#define INK_PENTIP_ROUND_FLAT_END (3) +/* ... more to be filled in here if needed */ + +#define inkDefaultPentip INK_PENTIP_ROUND +#define inkDefaultPentipData ((U16) 1) + +typedef struct tag_INK_PENTIP_SLANT { + SIZE16 rectangle_size; /* INK_PENTIP_SLANTRECTANGLE */ + U16 angle; /* Whole degrees from vertical, counter-clockwise */ +} INK_PENTIP_SLANT, FAR *P_INK_PENTIP_SLANT; + +typedef union { + U16 round_width; /* INK_PENTIP_ROUND */ + SIZE16 rectangle_size; /* INK_PENTIP_RECTANGLE */ + INK_PENTIP_SLANT slant; /* INK_PENTIP_SLANT_RECTANGLE */ + U16 round_flat_width; /* INK_PENTIP_ROUND_FLAT_END */ +} INK_PENTIP_DATA, FAR *P_INK_PENTIP_DATA; + +/* Size of the union is determined by INK_PENTIP_SLANT */ +#define INK_PENTIP_DATA_SIZE (SIZE16_SIZE+U16_SIZE) + +typedef struct tag_INK_PENTIP_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordTip */ + INK_PENTIP tip; + INK_PENTIP_DATA tip_data; +} INK_PENTIP_RECORD, FAR *P_INK_PENTIP_RECORD; +#define inkRecordTipSize \ + (inkRecordHeaderLength(inkRecordTip) + INK_PENTIP_SIZE + \ + SIZE16_SIZE + U16_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 15.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** For some applications, it will be important to know the sampling rate of +** the pen digitizer. +** +** This record would likely be present once in a bundle and would typically +** be after the INK_BUNDLE_RECORD, but before the first pen data. +** +** Note: +** Writing applications are not required to report the "true" sampling rate +** of the digitizer, nor are rendering applications required to play back the +** ink at the specified rate. It is likely that most types of rendering +** applications will render ink as rapidly as possible to construct a display +** in minimum time, and that some types of animation applications will +** intentionally set an arbitrary sampling rate to vary the display rate. +** +** Note: +** For hardware which supports a highly variable sampling rate, the writing +** application can simulate a very high sampling rate (say, 1000 points/ +** second), and use skip records for "elided" points to achieve an exact time +** value (at 1-millisecond resolution) for each point. +** +** A default value for sampling rate has been arbitrarily defined below. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_POINTS_PER_SECOND_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordPointsPerSecond */ + U16 pointsPerSecond; +} INK_POINTS_PER_SECOND_RECORD, FAR *P_INK_POINTS_PER_SECOND_RECORD; + +#define inkPointDefaultPointsPerSecond (100) + +#define inkRecordPointsPerSecondSize \ + (inkRecordHeaderLength(inkRecordPointsPerSecond) + U16_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 16.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Units for Z height of stylus above the tablet. +** +** This record would only be present once in a bundle and would typically be +** after the INK_BUNDLE_RECORD, but before the first pen data. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_UNITS_PER_Z_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordUnitsPerZ */ + U32 unitsPerZ; /* pen units per meter (Z height) */ +} INK_UNITS_PER_Z_RECORD, FAR *P_INK_UNITS_PER_Z_RECORD; + +#define inkPointDefaultUnitsPerZ (10000) /* 0.1 mm units */ + +#define inkRecordUnitsPerZSize \ + (inkRecordHeaderLength(inkRecordUnitsPerZ) + U32_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 17.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Units for stylus tip force. +** +** This record would only be present once in a bundle and would typically be +** after the INK_BUNDLE_RECORD, but before the first pen data. +** +** Note: +** This specification assumes some level of accuracy and linearity for tip +** force data, if such data is present. However, since tip force sensors in +** current digitizer tablet and stylus designs may well vary in accuracy and +** linearity from one unit to the next even for hardware of the same design +** and model, and since algorithms for using tip force to determine stroke +** start and end are likely to differ, a recommended practice for writing +** applications that use the tip force value to determine the "touch" points +** in a stroke is to mark those points using the touch bit in the INK_BUTTONS +** structure. +** +** It is also recommended that vendors supporting tip force sensing in their +** hardware linearize their transducers to the greatest extent possible. +** +** Because of the likelihood that tip force transducers may not be accurately +** linearized, negative tip force values, while perhaps somewhat absurd +** are possible and are permitted in this specification. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_UNITS_PER_FORCE_RECORD { + INK_RECORD_HEADER8 header; /* value is inkRecordUnitsPerForce */ + U32 unitsPerForce; /* tip-force units per k-gram of force*/ +} INK_UNITS_PER_FORCE_RECORD, FAR *P_INK_UNITS_PER_FORCE_RECORD; + +#define inkPointDefaultUnitsPerForce (1000) /* grams of force */ + +#define inkRecordUnitsPerForceSize \ + (inkRecordHeaderLength(inkRecordUnitsPerForce) + U32_SIZE) + + + + +/**************************/ +/* REFERENCE SECTION 18.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** The INK_APP_RECORD record is a universal record to be used by individual +** applications to put data into the file that is not supported by an +** additional publicly defined record type. The basic idea is that an +** application puts its own unique application signature into the appData +** bytes in the INK_APP_RECORD. This identifies the data as originating with +** a particular application. Then, an application defines a set of +** subRecordTypes that they wish to use. Then, using these subRecordTypes +** they can put a wide variety of information into the file. By examining +** the appData signature and comparing it to theirs, an application can +** decide whether it knows how to interpret the various subRecordtypes. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_APP_RECORD { + INK_RECORD_HEADER32 header; /* value is inkRecordApp */ + U8 appSignature[8];/* reserved for possible unique */ + /* application signature */ + U16 subRecordType; + /* data here appropriate to the subRecordType and appData signature */ +} INK_APP_RECORD, FAR *P_INK_APP_RECORD; +#define inkRecordAppSize(data_length) \ + (inkRecordHeaderLength(inkRecordApp) + 8 + U16_SIZE + (data_length)) + + + + +/**************************/ +/* REFERENCE SECTION 19.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Definition of the inkData components of an INK_PENDATA_RECORD: +** +** Uncompacted point format: +** ------------------------- +** +** This structure immediately follows the rest of the INK_PENDATA_RECORD. +** The structure has several optional components, present or not present as +** indicated by the INK_BUNDLE_FLAGS in the INK_BUNDLE_RECORD. The format is +** a sequence of "point values", each containing all the scalar data for each +** sampled tablet point. +** +** In the uncompacted format, there is a single structure that contains all +** of the state information for each point from the tablet. Components not +** present (as indicated by the INK_BUNDLE_FLAGS) are just that: not present, +** do not exist, do not occupy space. +** +** Compacted point format: +** ----------------------- +** +** In the compacted format, "State values", such as the stylus state of +** touch/no-touch/out-of-prox or the on/off state of the barrel switches, are +** stored in a compacted "INK_BUTTONS" item (represented using reserved +** encodings in the INK_POINT coordinate values) interjected when their state +** changes. The initial state is assumed to be "not touching", "out of +** proximity", all barrel switches "off". It is possible to have both tip +** force data, and explicit starts and ends of strokes: the starts and ends +** of the strokes are then points that were considered to be such by the +** original application storing the data. The INK_BUTTONS record reflects +** the state of the next X/Y point following. +** +**------------------------------------------------------------------------*/ + + + + +/**************************/ +/* REFERENCE SECTION 20.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** "INK_BUTTONS" items may most often be used only to indicate stylus touch +** and out-of-prox state, and perhaps a single barrel button. The format is +** optimized for this case. The format extends to a total of 28 stylus/puck +** buttons. +** +**------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------- +** The lowest-order bit (flag0) is "0" when the stylus is out of +** proximity, "1" when it is in proximity. +** Second lowest-order bit (flag1) is "1" to indicate the next inkPoints are +** when the stylus is touching (the start of a stroke: tip-switch "on"), +** "0" to indicate that the stylus is not touching (end of a stroke). +** Third bit (flag2) indicates state of first (or only) barrel switch, +** etc. +** 31'st bit (flag30) is normally "0", "1" is indicates there are more +** than 29 barrel/puck buttons with state, and the rest are in the next +** four-byte word. +**-------------------------------------------------------------------------*/ + +typedef U32 INK_BUTTONS, FAR * P_INK_BUTTONS; + +/*------------------------------------------------------------------------- +** These definitions hold the maximum and minimum values that +** can be used with the S15 and S31 representations described in +** this document: +**-------------------------------------------------------------------------*/ + +#define MAX_S31 ((S32) 0x3FFFFFFF) +#define MIN_S31 ((S32) 0xC0000000) + +#define MAX_S15 ((S16) 0x3FFF) +#define MIN_S15 ((S16) 0xC000) + +#define MAX_S7 ((S16) 0x003F) +#define MIN_S7 ((S16) 0xFFC0) + +#define MAX_S3 ((S16) 0x0003) +#define MIN_S3 ((S16) 0xFFFC) + +/* SignExtend4/8/16/32: Sign-extend an S3, S7, S15, S31 to an S32: */ + +#define SignExtend4(value) ((S32) \ + (((value)&0x00000004l)== 0 ? ((value)&0x00000007l) \ + : (((value)&0x00000007l) | 0xFFFFFFF8l))) + +#define SignExtend8(value) ((S32) \ + (((value)&0x00000040l)== 0 ? ((value)&0x0000007Fl) \ + : (((value)&0x0000007Fl) | 0xFFFFFF80l))) + +#define SignExtend16(value) ((S32) \ + (((value)&0x00004000l)== 0 ? ((value)&0x00007FFFl) \ + : (((value)&0x00007FFFl) | 0xFFFF8000l))) + +#define SignExtend32(value) ((S32) \ + (((value)&0x40000000l)== 0 ? ((value)&0x7FFFFFFFl) \ + : (((value)&0x7FFFFFFFl) | 0x80000000l))) + + + +/**************************/ +/* REFERENCE SECTION 21.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** INK_POINT data. The INK_POINT structure varies in size depending on +** flags set in the bundle header. The XY32 position is always present, but +** the force, rho, height, angle, and buttons members are only present when +** indicated by the corresponding flag in the bundle header. When optional +** data is present, it is present in the order defined by this structure; +** that is, position, force, height, rho, angle, and finally buttons. +** +** The INK_POINT structure has the following elements: +** +** position - required and always present +** Positions are measured with (0,0) at the lower-left, X increasing to +** the right, Y increasing upwards. Values are actually S31, not S32. +** The high bit in X and Y must be zero. +** force - optional, present if inkForceDataPresent is asserted +** Units are in pen force units, zero is no contact. +** height - optional, present if inkHeightDataPresent is asserted +** Units are in pen unitsPerZ as specified by inkPointDefaultUnitsPerZ or +** by an INK_UNITS_PER_Z_RECORD, whichever is appropriate. Units increase +** as the stylus is taken away from the tablet. Zero means "just in +** contact". Negative values could possibly result from spring action if +** the stylus is pressed hard, or if the tablet is not perfectly accurate. +** rho - optional, present if inkRotationDataPresent is asserted +** Angles are measured in degrees from some nominal orientation of +** "stylus button on top" (somewhat arbitrary). Angles increase with +** clockwise rotation as seen from the rear end of the stylus. +** angle - optional, present if inkAngleDataPresent is asserted +** Angles are measured in pen angle units from the vertical. Theta +** increases in the positive-X direction, phi in the positive-Y. +** buttons - optional, present if inkButtonDataPresent is asserted +** +** When the INK_BUNDLE_RECORD member compactionType is inkStdCompression, +** all data in this structure is compressed according to the methods +** described in reference section 23.0. For more details on how to interpret +** the compressed data stream, see the sample code. The bundle flags which +** indicate whether a particular piece of data is present are used regardless +** of whether the data is compressed or not. Note that when data is written +** in compressed format, it is NOT written in Intel order but rather most +** significant byte first. In compressed form, some of the eight bit delta +** values are reserved for button data and elided (skipped) point counts. +** This has two important ramifications. 1) When expecting a point, +** compacted button data or elided point data may be encountered instead, and +** 2) when the inkButtonDataPresent flag is asserted in the bundle header, +** button data will appear in the place of a point and not in addition to a +** point. If inkButtonDataPresent is not asserted, the reader need not check +** the point data for the special case of button data; however, the point +** data must still be checked to see if it is a count of elided points rather +** than an actual point. +** +**------------------------------------------------------------------------*/ + +typedef struct tag_INK_POINT { + XY32 position; /* required x/y point data */ + S16 force; /* optional force data */ + S16 height; /* optional z height data */ + S16 rho; /* optional rotational data */ + ANGLE16 angle; /* optional theta and phi data */ + INK_BUTTONS buttons; /* optional proximity, contact, button data */ +} INK_POINT, FAR *P_INK_POINT; + + + + +/**************************/ +/* REFERENCE SECTION 22.0 */ +/**************************/ + + +/*------------------------------------------------------------------------- +** The following default values are assumed before the start of any +** INK_BUNDLE: +** +**------------------------------------------------------------------------*/ + + +#define inkPointDefaultXYPosition ((S32) 0) +#define inkPointDefaultForce ((S16) 0) +#define inkPointDefaultHeight ((S16) 0) +#define inkPointDefaultRho ((S16) 0) +#define inkPointDefaultAngle ((S16) 0) +#define inkPointDefaultButtons ((U32) 0) + + + + +/**************************/ +/* REFERENCE SECTION 23.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Compacted point format: +** --------------------- +** +** A recommended practice is always to use the compacted point format, not +** the uncompacted point format. Sample code for reading and writing the +** compacted format is included in an appendix. +** +** This structure also immediately follows the rest of the +** INK_PENDATA_RECORD. +** +** The uncompacted values above are stored in sequential bytes in a more +** compact, delta-oriented format. Deltas are all signed values, a value to +** add to the previous value. The first point in an INK_PENDATA_RECORD is +** always relative to the defined default values for each component of the +** point. +** +** The storing application, as an alternative to eliminating points, can +** specify a "skip" record for elided points. The skipRecord indicates that +** a number of points were skipped, and the reading application is free to +** insert values for the elided points (interpolating where appropriate). +** The intent is to allow for accurate time information to be maintained +** between time stamps for synchronization with recorded voice, press-hold +** gesture recognition, etc. +** +** Compacted data is written most significant byte first so that reading +** applications can read the first byte and determine (from the top two bits) +** how large the encoded delta is. +** +** Note: +** "Reserved encodings" are those encodings that, if real points, would fit +** into the next smaller delta size. 16 bit deltas and 8 bit deltas have +** reserved encodings. The reserved encodings for 16 bit deltas are all 16 +** bit delta pairs where both X and Y are within the inclusive range MIN_S7 +** and MAX_S7. Similarly, the reserved encoding for 8 bit deltas are all 8 +** bit delta pairs where both X and Y are within the inclusive range MIN_S3 +** and MAX_S3. In revision 1.0 of Jot, three of the reserved encodings for 8 +** bit deltas are used for special cases: skip counts (reference section +** 27.0) and button changes (reference section 26.0). +** +** x/y position: +** ------------ +** +** 32-bit absolute X/Y: +** +** Two 32 bit long words: Data is actually two S31s: +** +** |0|0| (30 low-order bits of X) | +** ... Sign bit is taken from first bit of next word. +** ---------------------------------------------------------------- +** |X| (sign bit of X plus 31 bits of Y) | +** ---------------------------------------------------------------- +** +** 16-bit short delta X/Y: +** +** Short words: two 16 bit words: Deltas are actually two S15s: +** Values that would fit into an 8-bit byte delta are reserved. +** +** |0|1| (14 low-order bits of delta-X) | +** ... Sign bit is taken from first bit of next word. +** -------------------------------------------------- +** |X| (sign bit of X plus 15 bits of delta Y | +** -------------------------------------------------- +** +** 8-bit byte delta X/Y: +** +** Bytes: two bytes: Deltas are actually two S7s: +** Values that would fit into a 4-bit nibble delta are reserved. +** +** |1|0| (6 low-order bits of delta-X) | +** ... Sign bit is taken from first bit of next word. +** ------------------------------------------ +** |X| (7 bits of delta-Y) | +** ------------------------------------------ +** +** 4-bit nibble delta X/Y: +** +** Nibbles: one byte: Deltas are actually S3: +** +** |1|1| (S3 delta-X) | (S3 delta-Y) | +** ----------------------------------- +** +**------------------------------------------------------------------------*/ + + + + +/**************************/ +/* REFERENCE SECTION 24.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Tip force: +** ---------- +** +** 16-bit absolute force: +** +** Short word: one word: Value is actually S15: +** Values that would fit into an 8-bit byte delta are reserved. +** +** |0| (15 bits of force) | +** --------------------------------------------- +** +** 8-bit byte delta force: +** +** Byte: one byte: Deltas are actually S7: +** +** |1| (S7 delta-force) | +** -------------------------- +** +** +** Height: +** ------ +** +** (Same encoding as tip force) +** +** Rho: +** --- +** +** (Same encoding as tip force) +** +** +** Stylus theta-phi: +** ---------------- +** +** 16-bit absolute theta-phi: +** +** Short words: two words: Data is actually S15: +** +** |0|0| (14 low-order bits of theta) | +** ------------------------------------------- +** ... Sign bit is taken from first bit of next word. +** |X| (15 bits of phi) | +** ------------------------------------------- +** +**------------------------------------------------------------------------*/ + + + + +/**************************/ +/* REFERENCE SECTION 25.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** 8-bit byte delta theta-phi +** +** Bytes: two bytes: Deltas are actually S7: +** Values that would fit into a 4-bit nibble delta are reserved. +** +** |0|1| (6 low-order bits of delta-theta)| +** -------------------------------------------- +** ... Sign bit is taken from first bit of next word. +** |X| (7 bits of delta-phi) | +** -------------------------------------------- +** +** 4-bit nibble delta theta-phi +** +** Nibbles: one byte: Deltas are actually S3: +** +** |1|0|(S3 delta-theta)|(S3 delta-phi)| +** ------------------------------------- +** +** Note: +** Leading bit values of |1|1| are reserved +** +**------------------------------------------------------------------------*/ + + + + +/**************************/ +/* REFERENCE SECTION 26.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Since the X/Y data is always present, we use some of the reserved delta +** encodings to encode button states and elided (skipped) points. We use the +** 8-bit delta encodings that are unused: the values that can fit into the +** smaller 4-bit delta encodings. +** +** Button/tip records: +** ------------------ +** +** It is assumed that the state of barrel buttons and the touching sensor on +** the stylus change infrequently. A compacted button/tip record is only +** included when the state changes in one of the switches. The button state +** value applies to the X/Y point immediately following the button state +** record. +** +** +** (Taken from 8-bit byte delta X/Y: two bytes total) +** +** |1|0| 0|0|0|0|0|0/1| 0|X|.|.|.|.|X|X| +** --------------------------------------- +** (delta-X) (delta-Y) +** +** An eight-bit delta with delta-X == 0 or 1, and delta-Y in the range +** (-4..3) indicates a button state encoding. +** +** It is likely to be the case that many hardware platforms have only one +** barrel button. +** +** The three delta-Y bits indicate the "touch", "out-of-prox", and "first +** barrel button" state as follows: +** +** low-order delta-Y bit: 1 --> in proximity, 0 --> out of prox +** next delta-Y bit: 1 --> touching tablet, 0 --> not touching +** high-order (sign) delta-Y bit: 1 --> first button closed, 0 --> open +** +** +** The lowest order bit of the delta-X bits is used to indicate that +** additional bytes follow: "1" indicates that the next byte is used for the +** next 7 barrel buttons with state. The high order bit of each sequential +** byte in the series is "1" if an additional byte must be fetched, "0" +** otherwise. In these additional bytes, the additional buttons are +** associated in order starting with the low-order bit. +** +**------------------------------------------------------------------------*/ + + + +/**************************/ +/* REFERENCE SECTION 27.0 */ +/**************************/ + +/*------------------------------------------------------------------------- +** Skipped-point records: +** --------------------- +** +** (Taken from 8-bit byte delta X/Y: two bytes total) +** +** +** |1|0| 0|0|0|0|1|0| 0|X|.|.|.|.|X|X| +** ------------------------------------- +** (delta-X) (delta-Y) +** +** An eight-bit delta with delta-X == 2, and delta-Y in the range +** (-4..3) indicates a count of elided points. The delta-Y values in the +** range (-4..-1) are used to represent skip counts of (4..7). If the +** delta-Y value is zero "0", the next two bytes are fetched to get a U16 +** skip count value. +** +** The elided points are points removed between the point immediately prior +** to the skipped-point record and the point immediately afterward. This +** implies that at least one point must follow every skip record (though +** the point may not appear next in the stream if there are intervening +** button state transitions). Reading applications that are interested in +** recovering elided points will typically interpolate. Skip counts of zero +** are meaningless and not permitted. +** +** Reserved: +** -------- +** +** The remaining encodings from the 8-bit byte delta X/Y are reserved: +** +** delta-X of -4, -3, -2, -1, 3 AND ((delta-Y >= -4) & ((delta-Y <= 3)) +** +**------------------------------------------------------------------------*/ + +#endif /* end of INKSTORE_INCLUDED */ diff --git a/vendor/x11iraf/obm/ObmW/laygram.y b/vendor/x11iraf/obm/ObmW/laygram.y new file mode 100644 index 00000000..c209b64a --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/laygram.y @@ -0,0 +1,263 @@ +%{ +#include <X11/Xlib.h> +#include <X11/Xresource.h> +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/Converters.h> +#include "LayoutP.h" + +static LayoutPtr *dest; + +%} + +%union { + int ival; + XrmQuark qval; + BoxPtr bval; + BoxParamsPtr pval; + GlueRec gval; + LayoutDirection lval; + ExprPtr eval; + Operator oval; +} + +%type <bval> box boxes compositebox +%type <pval> bothparams oneparams +%type <gval> glue opStretch opShrink +%type <lval> orientation +%type <eval> signedExpr simpleExpr expr + +%token OC CC OA CA OP CP +%token <qval> NAME +%token <ival> NUMBER +%token <ival> INFINITY +%token VERTICAL HORIZONTAL + +%token EQUAL DOLLAR + +%left <oval> PLUS MINUS +%left <oval> TIMES DIVIDE PERCENTOF +%right <oval> PERCENT +%nonassoc WIDTH HEIGHT +%right <oval> UMINUS UPLUS + +%% +layout : compositebox + { *dest = $1; } + ; +box : NAME bothparams + { + BoxPtr box = New(LBoxRec); + box->nextSibling = 0; + box->type = WidgetBox; + box->params = *$2; + Dispose ($2); + box->u.widget.quark = $1; + $$ = box; + } + | signedExpr oneparams + { + BoxPtr box = New(LBoxRec); + box->nextSibling = 0; + box->type = GlueBox; + box->params = *$2; + Dispose ($2); + box->u.glue.expr = $1; + $$ = box; + } + | NAME EQUAL signedExpr + { + BoxPtr box = New(LBoxRec); + box->nextSibling = 0; + box->type = VariableBox; + box->u.variable.quark = $1; + box->u.variable.expr = $3; + $$ = box; + } + | compositebox + { + $$ = $1; + } + ; +compositebox : orientation OC boxes CC + { + BoxPtr box = New(LBoxRec); + BoxPtr child; + + box->nextSibling = 0; + box->parent = 0; + box->type = BoxBox; + box->u.box.dir = $1; + box->u.box.firstChild = $3; + for (child = $3; child; child = child->nextSibling) + { + if (child->type == GlueBox) + { + child->params.stretch[!$1].expr = 0; + child->params.shrink[!$1].expr = 0; + child->params.stretch[!$1].order = 100000; + child->params.shrink[!$1].order = 100000; + child->params.stretch[!$1].value = 1; + child->params.shrink[!$1].value = 1; + } + child->parent = box; + } + $$ = box; + } + ; +boxes : box boxes + { + $1->nextSibling = $2; + $$ = $1; + } + | box + { $$ = $1; } + ; +bothparams : OA opStretch opShrink TIMES opStretch opShrink CA + { + BoxParamsPtr p = New(BoxParamsRec); + + p->stretch[LayoutHorizontal] = $2; + p->shrink[LayoutHorizontal] = $3; + p->stretch[LayoutVertical] = $5; + p->shrink[LayoutVertical] = $6; + $$ = p; + } + | + { + BoxParamsPtr p = New(BoxParamsRec); + + ZeroGlue (p->stretch[LayoutHorizontal]); + ZeroGlue (p->shrink[LayoutHorizontal]); + ZeroGlue (p->stretch[LayoutVertical]); + ZeroGlue (p->shrink[LayoutVertical]); + $$ = p; + } + ; +oneparams : OA opStretch opShrink CA + { + BoxParamsPtr p = New(BoxParamsRec); + + p->stretch[LayoutHorizontal] = $2; + p->shrink[LayoutHorizontal] = $3; + p->stretch[LayoutVertical] = $2; + p->shrink[LayoutVertical] = $3; + $$ = p; + } + | + { + BoxParamsPtr p = New(BoxParamsRec); + + ZeroGlue (p->stretch[LayoutHorizontal]); + ZeroGlue (p->shrink[LayoutHorizontal]); + ZeroGlue (p->stretch[LayoutVertical]); + ZeroGlue (p->shrink[LayoutVertical]); + $$ = p; + } + ; +opStretch : PLUS glue + { $$ = $2; } + | + { ZeroGlue ($$); } + ; +opShrink : MINUS glue + { $$ = $2; } + | + { ZeroGlue ($$); } + ; +glue : simpleExpr INFINITY + { $$.order = $2; $$.expr = $1; } + | simpleExpr + { $$.order = 0; $$.expr = $1; } + | INFINITY + { $$.order = $1; $$.expr = 0; $$.value = 1; } + ; +signedExpr : MINUS simpleExpr %prec UMINUS + { + $$ = New(ExprRec); + $$->type = Unary; + $$->u.unary.op = $1; + $$->u.unary.down = $2; + } + | PLUS simpleExpr %prec UPLUS + { $$ = $2; } + | simpleExpr + ; +simpleExpr : WIDTH NAME + { $$ = New(ExprRec); + $$->type = Width; + $$->u.width = $2; + } + | HEIGHT NAME + { $$ = New(ExprRec); + $$->type = Height; + $$->u.height = $2; + } + | OP expr CP + { $$ = $2; } + | simpleExpr PERCENT + { + $$ = New(ExprRec); + $$->type = Unary; + $$->u.unary.op = $2; + $$->u.unary.down = $1; + } + | NUMBER + { $$ = New(ExprRec); + $$->type = Constant; + $$->u.constant = $1; + } + | DOLLAR NAME + { $$ = New(ExprRec); + $$->type = Variable; + $$->u.variable = $2; + } + ; +expr : expr PLUS expr + { binary: ; + $$ = New(ExprRec); + $$->type = Binary; + $$->u.binary.op = $2; + $$->u.binary.left = $1; + $$->u.binary.right = $3; + } + | expr MINUS expr + { goto binary; } + | expr TIMES expr + { goto binary; } + | expr DIVIDE expr + { goto binary; } + | expr PERCENTOF expr + { goto binary; } + | MINUS expr %prec UMINUS + { unary: ; + $$ = New(ExprRec); + $$->type = Unary; + $$->u.unary.op = $1; + $$->u.unary.down = $2; + } + | PLUS expr %prec UPLUS + { $$ = $2; } + | simpleExpr + ; +orientation : VERTICAL + { $$ = LayoutVertical; } + | HORIZONTAL + { $$ = LayoutHorizontal; } + ; +%% + +int yywrap () +{ + return 1; +} + +void yysetdest (c) + LayoutPtr *c; +{ + dest = c; +} diff --git a/vendor/x11iraf/obm/ObmW/laylex.l b/vendor/x11iraf/obm/ObmW/laylex.l new file mode 100644 index 00000000..8764d066 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/laylex.l @@ -0,0 +1,126 @@ + +%{ +#ifndef FLEX_SCANNER +#undef input +#undef unput +#endif + +#include <X11/Xlib.h> +#include <X11/Xresource.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include "LayoutP.h" +#include "laygram.h" +static char *yysourcebase, *yysource; + +#ifndef FLEX_SCANNER +#define input() (*yysource++) + +/* 18Mar94 DCT - The following doesn't work as the lex code assumes that (c) is + * evaluated. + * + * #define unput(c) (--yysource) + */ +#define unput(c) (--yysource, (c)) + +#else +#include <string.h> +static void my_yyinput(char* buf, int* result, int max_size); +#define YY_INPUT(buf, res, max) my_yyinput(buf, &(res), max); +#endif + +#ifdef __STDC__ +static int count (); +#endif +%} +%% +vertical return VERTICAL; +horizontal return HORIZONTAL; +"{" return OC; +"}" return CC; +"(" return OP; +")" return CP; +"<" return OA; +">" return CA; +infinity { yylval.ival = 1; return INFINITY; } +inff* { yylval.ival = count(yytext, 'f'); return INFINITY; } +[0-9][0-9]* { yylval.ival = atoi(yytext); return NUMBER; } +"=" { return EQUAL; } +"$" { return DOLLAR; } +"+" { yylval.oval = Plus; return PLUS; } +"-" { yylval.oval = Minus; return MINUS; } +"*" { yylval.oval = Times; return TIMES; } +"/" { yylval.oval = Divide; return DIVIDE; } +"%" { yylval.oval = Percent; return PERCENT; } +%[ \t\n]*of { yylval.oval = Percent; return PERCENTOF; } +width return WIDTH; +height return HEIGHT; +\\[a-zA-Z_][a-zA-Z0-9_]* { + /* yytext[yyleng] = '\0'; */ + yylval.qval = XrmStringToQuark (yytext+1); + return NAME; + } + +[a-zA-Z_][a-zA-Z0-9_]* { + /* yytext[yyleng] = '\0'; */ + yylval.qval = XrmStringToQuark (yytext); + return NAME; + } +" " ; +"\t" ; +"\n" ; +. fprintf (stderr, "ignoring %c\n", *yytext); +%% + +static int +count (s, c) + char *s; + char c; +{ + int i = 0; + while (*s) + if (*s++ == c) + i++; + return i; +} + +yysetsource(s) + char *s; +{ + yysourcebase = yysource = s; +} + +yyerror(s) + char *s; +{ + char *t; + + fprintf (stderr, "%s\n", s); + t = yysource - 50; + if (t < yysourcebase) + t = yysourcebase; + while (*t && t < yysource + 50) { + if (t == yysource) + putc ('@', stderr); + putc (*t++, stderr); + } + if (t == yysource) + putc ('@', stderr); + if (!*t) + fprintf (stderr, "<EOF>"); + fprintf (stderr, "\n"); +} + +#ifdef FLEX_SCANNER +static void +my_yyinput(buf, result, max_size) + char *buf; int *result; int max_size; +{ + int size = max_size < strlen(yysource) ? max_size : strlen(yysource); + + strncpy(buf, yysource, size); + yysource += size; + *result = size; +} +#endif diff --git a/vendor/x11iraf/obm/ObmW/laylex.l.ORIG b/vendor/x11iraf/obm/ObmW/laylex.l.ORIG new file mode 100644 index 00000000..63cc87db --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/laylex.l.ORIG @@ -0,0 +1,96 @@ +%{ +#undef input +#undef unput + +#include <X11/Xlib.h> +#include <X11/Xresource.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include "LayoutP.h" +#include "laygram.h" + +static char *yysourcebase, *yysource; +static int count(); + +#define input() (*yysource++) +#define unput(c) (--yysource) + +%} +%% +vertical return VERTICAL; +horizontal return HORIZONTAL; +"{" return OC; +"}" return CC; +"(" return OP; +")" return CP; +"<" return OA; +">" return CA; +infinity { yylval.ival = 1; return INFINITY; } +inff* { yylval.ival = count(yytext, 'f'); return INFINITY; } +[0-9][0-9]* { yylval.ival = atoi(yytext); return NUMBER; } +"=" { return EQUAL; } +"$" { return DOLLAR; } +"+" { yylval.oval = Plus; return PLUS; } +"-" { yylval.oval = Minus; return MINUS; } +"*" { yylval.oval = Times; return TIMES; } +"/" { yylval.oval = Divide; return DIVIDE; } +"%" { yylval.oval = Percent; return PERCENT; } +%[ \t\n]*of { yylval.oval = Percent; return PERCENTOF; } +width return WIDTH; +height return HEIGHT; +\\[a-zA-Z_][a-zA-Z0-9_]* { + /* yytext[yyleng - 1] = '\0'; */ + yylval.qval = XrmStringToQuark (yytext+1); + return NAME; + } + +[a-zA-Z_][a-zA-Z0-9_]* { + /* yytext[yyleng - 1] = '\0'; */ + yylval.qval = XrmStringToQuark (yytext); + return NAME; + } +" " ; +"\t" ; +"\n" ; +. fprintf (stderr, "ignoring %c\n", *yytext); +%% + +static int +count (s, c) + char *s; + char c; +{ + int i = 0; + while (*s) + if (*s++ == c) + i++; + return i; +} + +yysetsource(s) + char *s; +{ + yysourcebase = yysource = s; +} + +yyerror(s) + char *s; +{ + char *t; + + fprintf (stderr, "%s\n", s); + t = yysource - 50; + if (t < yysourcebase) + t = yysourcebase; + while (*t && t < yysource + 50) { + if (t == yysource) + putc ('@', stderr); + putc (*t++, stderr); + } + if (t == yysource) + putc ('@', stderr); + if (!*t) + fprintf (stderr, "<EOF>"); + fprintf (stderr, "\n"); +} diff --git a/vendor/x11iraf/obm/ObmW/scroll.c b/vendor/x11iraf/obm/ObmW/scroll.c new file mode 100644 index 00000000..5a618d44 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/scroll.c @@ -0,0 +1,46 @@ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/CharSet.h> +#include "scroll.h" + +void XfwfConnectScrollingWidgets(w1, w2) + Widget w1, w2; +{ + XtCallbackProc response_cb_1 = NULL, response_cb_2 = NULL; + + /* Error checking omitted */ + XtVaGetValues(w1, "scrollResponse", &response_cb_1, NULL); + XtVaGetValues(w2, "scrollResponse", &response_cb_2, NULL); + + XtAddCallback(w1, "scrollCallback", response_cb_2, (XtPointer)w2); + + XtAddCallback(w2, "scrollCallback", response_cb_1, (XtPointer)w1); +} + +XfwfSReason XfwfCvtStringToScrollReason(s) + String s; +{ + if (XmuCompareISOLatin1(s, "Notify") == 0) return XfwfSNotify; + if (XmuCompareISOLatin1(s, "Move") == 0) return XfwfSMove; + if (XmuCompareISOLatin1(s, "Drag") == 0) return XfwfSDrag; + if (XmuCompareISOLatin1(s, "Zoom") == 0) return XfwfSZoom; + if (XmuCompareISOLatin1(s, "Stretch") == 0) return XfwfSStretch; + if (XmuCompareISOLatin1(s, "Up") == 0) return XfwfSUp; + if (XmuCompareISOLatin1(s, "Down") == 0) return XfwfSDown; + if (XmuCompareISOLatin1(s, "Left") == 0) return XfwfSLeft; + if (XmuCompareISOLatin1(s, "Right") == 0) return XfwfSRight; + if (XmuCompareISOLatin1(s, "PageUp") == 0) return XfwfSPageUp; + if (XmuCompareISOLatin1(s, "PageDown") == 0) return XfwfSPageDown; + if (XmuCompareISOLatin1(s, "PageLeft") == 0) return XfwfSPageLeft; + if (XmuCompareISOLatin1(s, "PageRight") == 0) return XfwfSPageRight; + if (XmuCompareISOLatin1(s, "ZoomIn") == 0) return XfwfSZoomIn; + if (XmuCompareISOLatin1(s, "ZoomOut") == 0) return XfwfSZoomOut; + if (XmuCompareISOLatin1(s, "Top") == 0) return XfwfSTop; + if (XmuCompareISOLatin1(s, "Bottom") == 0) return XfwfSBottom; + if (XmuCompareISOLatin1(s, "LeftSide") == 0) return XfwfSLeftSide; + if (XmuCompareISOLatin1(s, "RightSide") == 0) return XfwfSRightSide; + if (XmuCompareISOLatin1(s, "ZoomInFull") == 0) return XfwfSZoomInFull; + if (XmuCompareISOLatin1(s, "ZoomOutFull") == 0) return XfwfSZoomOutFull; + return XfwfSNotify; /* Should be: error */ +} + diff --git a/vendor/x11iraf/obm/ObmW/scroll.h b/vendor/x11iraf/obm/ObmW/scroll.h new file mode 100644 index 00000000..1ecbe1ed --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/scroll.h @@ -0,0 +1,96 @@ +/* + * File: <Xfwf/scroll.h> + * + * Declarations and typedefs for the Free Widget Foundation + * Scrolling Widget Interface Policy. + * = + + */ + +#ifndef _XFWF_SCROLL_H +#define _XFWF_SCROLL_H 1 + +/* + * The XfwfSReason typedef defines all the possible types + * of scroll messages. XfwfSNotify indicates a _notify_ + * message, and all others indicate a _command_ message. + */ +typedef enum _XfwfSReason +{ + XfwfSNotify, /* Widget has changed position or size */ + + XfwfSMove, /* Request to move widget */ + XfwfSDrag, /* widget is being moved continuously */ + + XfwfSZoom, /* Request to Zoom (resize visible area) */ + XfwfSStretch, /* widget is being zoomed continuously */ + + XfwfSUp, /* User request to ``move up one unit'' */ + XfwfSLeft, /* User request to ``move left one unit'' */ + XfwfSDown, XfwfSRight, /* similar */ + + XfwfSPageUp, /* User request to ``move up one page'' */ + XfwfSPageLeft, XfwfSPageDown, XfwfSPageRight, /* similar */ + + XfwfSZoomIn, /* User invoked ``Zoom In'' */ + XfwfSZoomOut, /* User invoked ``Zoom Out'' */ + + XfwfSTop, /* User invoked ``Scroll to top'' */ + XfwfSBottom, XfwfSLeftSide, XfwfSRightSide, /* similar */ + + XfwfSZoomInFull, XfwfSZoomOutFull /* similar, but wrt zoom state */ + +} XfwfSReason; + +/* = + + * #define's for the 'flags' field: + */ +typedef unsigned short XfwfSFlags; +#define XFWF_VPOS 0x1 /* vpos set */ +#define XFWF_VSIZE 0x2 /* vsize set */ +#define XFWF_HPOS 0x4 /* hpos set */ +#define XFWF_HSIZE 0x8 /* hsize set */ + +/* + * The XfwfScrollInfo structure defines the scroll message passed + * between scrolling widgets: + */ +typedef struct _XfwfScrollInfo +{ + XfwfSReason reason; /* see above */ + XfwfSFlags flags; /* defines which fields are relev= +ant */ + float vpos; /* "top" position, [0..1] */ + float vsize; /* total visible vertical size [0= +=2E.1] */ + float hpos; /* "left" position */ + float hsize; /* total visible horizontal size = +*/ +} XfwfScrollInfo; + + +/* + * Application convenience functions: + * + * XfwfConnectScrollingWidgets(Widget, Widget) attaches two + * widgets, which must have the scrollCallback and scrollResponse + * resources. + */ + +extern void XfwfConnectScrollingWidgets( /* Widget w1, Widget w2 */); + + +/* + * Widget convenience functions: + * + * = + + * XcwfCvtStringToScrollReason(char *s) converts 's' to one + * of the XfwfS* enumerated values. The comparison is case-insensitive, + * and the XfwfS prefix may be present but is not necessary. + */ + +extern XfwfSReason XfwfCvtStringToScrollReason(/* char * */); + +#endif /* _XFWF_SCROLL_H */ diff --git a/vendor/x11iraf/obm/ObmW/stip4.bm b/vendor/x11iraf/obm/ObmW/stip4.bm new file mode 100644 index 00000000..8173f891 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/stip4.bm @@ -0,0 +1,4 @@ +#define stip4_width 2 +#define stip4_height 2 +static char stip4_bits[] = { + 0x01, 0x02}; diff --git a/vendor/x11iraf/obm/ObmW/strnchr.c b/vendor/x11iraf/obm/ObmW/strnchr.c new file mode 100644 index 00000000..2dc2e1cd --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/strnchr.c @@ -0,0 +1,17 @@ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include "TabString.h" + +/* + * Like strchr, except has a length limit. + */ +char * +strnchr(s, c, n) + char *s; + int c; + int n; +{ + while (n--) + if (*s == c) return s; else ++s; + return NULL; +} diff --git a/vendor/x11iraf/obm/ObmW/zz/Separator.c b/vendor/x11iraf/obm/ObmW/zz/Separator.c new file mode 100644 index 00000000..f7669a76 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Separator.c @@ -0,0 +1,357 @@ +/* + * Separator.c - Separator widget Vladimir Romanovski + * + */ +#include <X11/IntrinsicP.h> +#include <X11/RectObjP.h> +#include <X11/StringDefs.h> +#include <X11/Xos.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/SeparatorP.h> + +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xmu/Drawing.h> + +#include <stdio.h> +#include <ctype.h> + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +#define offset(field) XtOffsetOf(SeparatorRec, field) + +static XtResource resources[] = { + { + XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), + offset(separator.orientation), XtRImmediate, (XtPointer) XtorientHorizontal + }, + { + XtNmargin, XtCMargin, XtRDimension, sizeof(Dimension), + offset(separator.margin), XtRImmediate, (caddr_t)1 + }, + { + XtNseparatorType, XtCSeparatorType, XtRSeparatorType, + sizeof(XawSeparatorType), offset(separator.separatorType), + XtRImmediate,(caddr_t)XawSHADOW_ETCHED_IN + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(simple.shadow_thickness), XtRImmediate, (XtPointer)0 + } +}; +#undef offset + +static void Initialize(); +static void Resize(); +static void Redisplay(); +static Boolean SetValues(); +static void ClassInitialize(); +static void Destroy(); + +SeparatorClassRec separatorClassRec = { + { + /* core_class fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "Separator", + /* widget_size */ sizeof(SeparatorRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* Simple class fields initialization */ + /* change_sensitive */ XtInheritChangeSensitive, + /* display_rect */ XtInheritDisplayRectProc, + /* extension */ NULL + }, + { /* Separator class fields initialization */ + /* ignore */ 0 + } +}; + +WidgetClass separatorWidgetClass = (WidgetClass)&separatorClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +/*---------------------------------------------*/ +#define done( type, value ) \ +{ \ + if ( toVal->addr != NULL ) \ + { \ + if ( toVal->size < sizeof( type ) ) \ + { \ + toVal->size = sizeof( type ); \ + return False; \ + } \ + *(type*)(toVal->addr) = (value); \ + } \ + else \ + { \ + static type static_val; \ + static_val = (value); \ + toVal->addr = (caddr_t)&static_val; \ + } \ + toVal->size = sizeof(type); \ + return True; \ +} \ +/*---------------------------------------------*/ + +static XrmQuark QSingle, QDouble, QShadowIn, QShadowOut; + +/* ARGSUSED */ +static Boolean +CvtStringToSeparatorType(dpy, args, num_args, fromVal, toVal, convData) + Display *dpy; + XrmValuePtr args; /* unused */ + Cardinal *num_args; /* unused */ + XrmValuePtr fromVal; + XrmValuePtr toVal; + XtPointer *convData; /* unused */ +{ + static XawSeparatorType separatorType; + XrmQuark q; + char lowerName[BUFSIZ]; + + XmuCopyISOLatin1Lowered (lowerName, (char *)fromVal->addr); + q = XrmStringToQuark(lowerName); + + separatorType = XawSINGLE_LINE; + + if (q == QSingle) separatorType = XawSINGLE_LINE; + else if (q == QDouble) separatorType = XawDOUBLE_LINE; + else if (q == QShadowIn) separatorType = XawSHADOW_ETCHED_IN; + else if (q == QShadowOut) separatorType = XawSHADOW_ETCHED_OUT; + else + XtDisplayStringConversionWarning( dpy, (char *)fromVal->addr, + XtRSeparatorType); + + done(XawSeparatorType, separatorType); +} +#undef done + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtSetTypeConverter( XtRString, XtRSeparatorType, CvtStringToSeparatorType, + (XtConvertArgList)NULL, (Cardinal)0, + XtCacheNone, (XtDestructor)NULL); + + QSingle = XrmStringToQuark(XawSingle_Line); + QDouble = XrmStringToQuark(XawDouble_Line); + QShadowIn = XrmStringToQuark(XawShadow_Etched_In); + QShadowOut = XrmStringToQuark(XawShadow_Etched_Out); +} + +static void GetGC(sw) + SeparatorWidget sw; +{ + XGCValues values; + unsigned long mask; + + values.foreground = sw->simple.foreground; + values.line_width = 0; + mask = GCForeground | GCLineWidth; + + sw->separator.gc = XtGetGC ((Widget)sw, mask, (XGCValues*)&values); +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + SeparatorWidget newsw = (SeparatorWidget) new; + + if (newsw->core.width == 0) + newsw->core.width = 8 + 2*SIMPLE_MARGIN(new); + + if (newsw->core.height == 0) + newsw->core.height = 8 + 2*SIMPLE_MARGIN(new); + + GetGC(newsw); + +} + +static void Resize(w) + Widget w; +{ + /* If widget is realized, clear and redisplay it */ + + if (XtIsRealized(w)) { + XClearWindow(XtDisplay(w), XtWindow(w)); + (*separatorClassRec.core_class.expose) (w, (XEvent*)NULL, (Region)NULL); + } +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + SeparatorWidget cursw = (SeparatorWidget) current; + SeparatorWidget newsw = (SeparatorWidget) new; + Boolean redisplay = False; + +#define NE(field) (cursw->separator.field != newsw->separator.field) + + if (newsw->core.width == 0) + newsw->core.width = 8 + 2*SIMPLE_MARGIN(new); + + if (newsw->core.height == 0) + newsw->core.height = 8 + 2*SIMPLE_MARGIN(new); + + if (NE(margin) || NE(separatorType)) + redisplay = True; + + if (cursw->simple.foreground != newsw->simple.foreground) + { + XtReleaseGC(new, cursw->separator.gc); + GetGC(newsw); + redisplay = True; + } + + return redisplay; +} + +static void Destroy(w) + Widget w; +{ + XtReleaseGC( w, ((SeparatorWidget)w)->separator.gc ); +} + +static void Redisplay(gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + register SeparatorWidget sw = (SeparatorWidget) gw; + int x1, y1, x2, y2; + + if (!XtIsRealized(gw)) + return; + + if (sw->simple.shadow_thickness > 0) + (*simpleWidgetClass->core_class.expose) (gw, event, region); + + if (sw->separator.orientation == XtorientHorizontal) { + x1 = sw->separator.margin; + x2 = sw->core.width - (x1 * 2); + + switch(sw->separator.separatorType) { + + case XawSHADOW_ETCHED_IN : + y1 = (sw->core.height - 2) / 2; + y2 = y1 + 1; + + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y1, x2, y1); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x1, y2, x2, y2); + break; + case XawSHADOW_ETCHED_OUT: + y1 = (sw->core.height - 2) / 2; + y2 = y1 + 1; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y2, x2, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x1, y1, x2, y1); + break; + + case XawDOUBLE_LINE: + y1 = (sw->core.height - 2)/ 2; + y2 = y1 + 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x2, y1); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y2, x2, y2); + break; + + case XawSINGLE_LINE : + y1 = sw->core.height / 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x2, y1); + default: + break; + } + } else { + y1 = sw->separator.margin; + y2 = sw->core.height - (y1 * 2); + + switch(sw->separator.separatorType) { + + case XawSHADOW_ETCHED_IN : + x1 = (sw->core.width - 2) / 2; + x2 = x1 + 1; + + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y1, x1, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x2, y1, x2, y2); + break; + case XawSHADOW_ETCHED_OUT: + x1 = (sw->core.width - 2) / 2; + x2 = x1 + 1; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.bottom_shadow_GC, + x1, y1, x1, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->simple.top_shadow_GC, + x2, y1, x2, y2); + break; + + case XawDOUBLE_LINE: + x1 = (sw->core.width - 2)/ 2; + x2 = x1 + 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x1, y2); + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x2, y1, x2, y2); + break; + + case XawSINGLE_LINE : + x1 = sw->core.width / 2; + XDrawLine(XtDisplay(gw), XtWindow(gw), sw->separator.gc, + x1, y1, x1, y2); + default: + break; + } + } +} + + diff --git a/vendor/x11iraf/obm/ObmW/zz/Separator.h b/vendor/x11iraf/obm/ObmW/zz/Separator.h new file mode 100644 index 00000000..6d5ad87f --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Separator.h @@ -0,0 +1,99 @@ +#ifndef _XawSeparator_h +#define _XawSeparator_h + +/*********************************************************************** + * + * Separator Widget + * + ***********************************************************************/ + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Simple.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + mappedWhenManaged MappedWhenManaged Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + + + + +typedef enum { + XawSINGLE_LINE = Xraw_SEPARATOR, + XawDOUBLE_LINE, + XawSHADOW_ETCHED_IN, + XawSHADOW_ETCHED_OUT +} XawSeparatorType; + + +#define XawSingle_Line "singleline" +#define XawDouble_Line "doubleline" +#define XawShadow_Etched_In "shadowetchedin" +#define XawShadow_Etched_Out "shadowetchedout" + + + +#ifndef XtNmargin +#define XtNmargin "margin" +#endif + +#ifndef XtCMargin +#define XtCMargin "Margin" +#endif + +#ifndef XtNseparatorType +#define XtNseparatorType "separatorType" +#endif + +#ifndef XtCSeparatorType +#define XtCSeparatorType "SeparatorType" +#endif + +#ifndef XtRSeparatorType +#define XtRSeparatorType "SeparatorType" +#endif + +#define XawTextEncoding8bit 0 +#define XawTextEncodingChar2b 1 + +#define XtNleftBitmap "leftBitmap" +#define XtCLeftBitmap "LeftBitmap" +#define XtNencoding "encoding" +#define XtCEncoding "Encoding" + +#ifndef _XtStringDefs_h_ +#define XtNbitmap "bitmap" +#define XtNforeground "foreground" +#define XtNseparator "separator" +#define XtNfont "font" +#define XtNinternalWidth "internalWidth" +#define XtNinternalHeight "internalHeight" +#define XtNresize "resize" +#define XtCResize "Resize" +#define XtCBitmap "Bitmap" +#endif + +/* Class record constants */ + +extern WidgetClass separatorWidgetClass; + +typedef struct _SeparatorClassRec *SeparatorWidgetClass; +typedef struct _SeparatorRec *SeparatorWidget; + +#endif /* _XawSeparator_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/zz/SeparatorP.h b/vendor/x11iraf/obm/ObmW/zz/SeparatorP.h new file mode 100644 index 00000000..75250d38 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/SeparatorP.h @@ -0,0 +1,60 @@ +/* + * SeparatorP.h - Private definitions for Separator widget + * + */ + +#ifndef _XawSeparatorP_h +#define _XawSeparatorP_h + +/*********************************************************************** + * + * Separator Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/Separator.h> + + +/* New fields for the Separator widget class record */ + +typedef struct {int foo;} SeparatorClassPart; + +/* Full class record declaration */ +typedef struct _SeparatorClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + SeparatorClassPart separator_class; +} SeparatorClassRec; + +extern SeparatorClassRec separatorClassRec; + +/* New fields for the Separator widget record */ + +typedef struct { + + /* Public Resources */ + XtOrientation orientation; + Dimension margin; + XawSeparatorType separatorType; + + /* Private part */ + GC gc; + +} SeparatorPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SeparatorRec { + CorePart core; + SimplePart simple; + SeparatorPart separator; +} SeparatorRec; + +#endif /* _XawSeparatorP_h */ diff --git a/vendor/x11iraf/obm/ObmW/zz/Simple.c b/vendor/x11iraf/obm/ObmW/zz/Simple.c new file mode 100644 index 00000000..83797833 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Simple.c @@ -0,0 +1,489 @@ +#include <stdio.h> + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Drawing.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/SimpleP.h> +#include <X11/Xraw/ContainerP.h> + +#define UnspecifiedPixmap (Pixmap)2 +#define UndefinedGC (GC)2 + +static void InsPixel(); + +static XtResource resources[] = { +#define offset(field) XtOffset(SimpleWidget, simple.field) + { + XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, (XtPointer) None + }, + { + XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), + offset(insensitive_border), XtRImmediate, (XtPointer) None + }, + { + XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRImmediate, (XtPointer) XtDefaultForeground + }, + { + "top.gc", "Top.gc", XtRString, sizeof(String), + offset(top_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "bottom.gc", "Bottom.gc", XtRString, sizeof(String), + offset(bottom_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "highlight.gc", "Highlight.gc", XtRString, sizeof(String), + offset(highlight_GC), XtRImmediate, (XtPointer)NULL + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(shadow_thickness), XtRImmediate, (XtPointer) 0 + }, + { + XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(top_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(top_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(bottom_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(bottom_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNhighlightPixmap, XtCHighlightPixmap, XtRPixmap, sizeof(Pixmap), + offset(highlight_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNhighlightPixel, XtCHighlightPixel, XtRPixel, sizeof(Pixel), + offset(highlight_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNhighlightThickness, XtCHighlightThickness, XtRDimension, + sizeof(Dimension), + offset(highlight_thickness), XtRImmediate, (XtPointer) 2 + }, + { + XtNuserData, XtCUserData, XtRPixmap, sizeof(Pixmap), + offset(user_data), XtRImmediate, (XtPointer) NULL + }, + { + XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, (XtPointer)0 + } + +}; + +static void InsPixel(w, off, value) + Widget w; + int off; + XrmValue *value; +{ + register SimpleWidget p = (SimpleWidget) w; + static Pixel pixel; + + if (off == offset(top_shadow_color)) + { + p->simple.top_shadow_GC = UndefinedGC; + } + else if (off == offset(bottom_shadow_color)) + { + p->simple.bottom_shadow_GC = UndefinedGC; + } + else + { + p->simple.highlight_GC = UndefinedGC; + } + value->addr = (XtPointer) &pixel; +} + +#undef offset + +static void ClasstInitialize(); +static void ClassPartInitialize(); +static void Initialize(); +static void Realize(); +static void Redisplay(); +static void Destroy(); + +static Boolean SetValues(); +static Boolean DisplayRectProc(); +static Boolean ChangeSensitive(); + +static XtGeometryResult QueryGeometry(); + +SimpleClassRec simpleClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "Simple", + /* widget_size */ sizeof(SimpleRec), + /* class_initialize */ ClasstInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ NULL, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ ChangeSensitive, + /* display_rect */ DisplayRectProc, + /* extension */ NULL + } +}; + +WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; + +static void ClasstInitialize() +{ +/* EMPTY */ +} + +static void ClassPartInitialize(class) + WidgetClass class; +{ + register SimpleWidgetClass c = (SimpleWidgetClass)class; + + if (c->simple_class.change_sensitive == NULL) + { + char buf[BUFSIZ]; + + sprintf(buf, + "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", + c->core_class.class_name); + XtWarning(buf); + c->simple_class.change_sensitive = ChangeSensitive; + } + + if (c->simple_class.change_sensitive == XtInheritChangeSensitive) + c->simple_class.change_sensitive = ChangeSensitive; + + if (c->simple_class.display_rect == XtInheritDisplayRectProc) + c->simple_class.display_rect = DisplayRectProc; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + SimpleWidget sw = (SimpleWidget)new; + SimplePart* sp = (SimplePart*)&(sw->simple); + + if (sp->top_shadow_pixmap == UnspecifiedPixmap) + sp->top_shadow_pixmap = None; + + if (sp->top_shadow_GC == NULL){ + if (sp->top_shadow_pixmap != None) + sp->top_shadow_GC = AllocGCFromPixmap (new, sp->top_shadow_pixmap); + else + sp->top_shadow_GC = AllocGCFromPixel (new, sp->top_shadow_color); + } else if (sp->top_shadow_GC == UndefinedGC) + sp->top_shadow_GC = MakeTopShadowGC (new, new->core.background_pixel); + + + if (sp->bottom_shadow_pixmap == UnspecifiedPixmap) + sp->bottom_shadow_pixmap = None; + + if (sp->bottom_shadow_GC == NULL){ + if (sp->bottom_shadow_pixmap != None) + sp->bottom_shadow_GC = AllocGCFromPixmap (new, sp->bottom_shadow_pixmap); + else + sp->bottom_shadow_GC = AllocGCFromPixel (new, sp->bottom_shadow_color); + } else if (sp->bottom_shadow_GC == UndefinedGC) + sp->bottom_shadow_GC =MakeBottomShadowGC (new, new->core.background_pixel); + + + if (sp->highlight_pixmap == UnspecifiedPixmap) + sp->highlight_pixmap = None; + + if (sp->highlight_GC == NULL){ + if (sp->highlight_pixmap != None) + sp->highlight_GC = AllocGCFromPixmap (new, sp->highlight_pixmap); + else + sp->highlight_GC = AllocGCFromPixel (new, sp->highlight_color); + } else if (sp->highlight_GC == UndefinedGC) + sp->highlight_GC = MakeBottomShadowGC (new, new->core.background_pixel); + +} + +static void Realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + Pixmap border_pixmap; + + if (!XtIsSensitive(w)) + { + /* change border to gray; have to remember the old one, + * so XtDestroyWidget deletes the proper one */ + if (((SimpleWidget)w)->simple.insensitive_border == None) + ((SimpleWidget)w)->simple.insensitive_border = + XmuCreateStippledPixmap(XtScreen(w), + w->core.border_pixel, + w->core.background_pixel, + w->core.depth); + border_pixmap = w->core.border_pixmap; + attributes->border_pixmap = + w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; + + *valueMask |= CWBorderPixmap; + *valueMask &= ~CWBorderPixel; + } + + if ((attributes->cursor = ((SimpleWidget)w)->simple.cursor) != None) + *valueMask |= CWCursor; + + XtCreateWindow( w, (unsigned int)InputOutput, (Visual *)CopyFromParent, + *valueMask, attributes ); + + if (!XtIsSensitive(w)) + w->core.border_pixmap = border_pixmap; +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + SimpleWidget s_old = (SimpleWidget) current; + SimpleWidget s_new = (SimpleWidget) new; + SimplePart* sp = (SimplePart*)&(s_new->simple); + Boolean redraw = False; + +#define NE(field) (s_new->simple.field != s_old->simple.field) + + if ( XtIsSensitive(current) != XtIsSensitive(new) ) + (*((SimpleWidgetClass)XtClass(new))-> + simple_class.change_sensitive) ( new ); + + if ( NE(cursor) && XtIsRealized(new)) + XDefineCursor(XtDisplay(new), XtWindow(new), s_new->simple.cursor); + + if (NE(top_shadow_pixmap)) + { + XtReleaseGC (new, sp->top_shadow_GC); + sp->top_shadow_GC = AllocGCFromPixmap (new, sp->top_shadow_pixmap); + redraw = True; + } + else if (NE(top_shadow_color) && sp->top_shadow_pixmap == None) + { + XtReleaseGC (new, sp->top_shadow_GC); + sp->top_shadow_GC = AllocGCFromPixel (new, sp->top_shadow_color); + redraw = True; + } + + if (NE(bottom_shadow_pixmap)) + { + XtReleaseGC (new, sp->bottom_shadow_GC); + sp->bottom_shadow_GC = AllocGCFromPixmap (new, sp->bottom_shadow_pixmap); + redraw = True; + } + else if (NE(bottom_shadow_color) && sp->bottom_shadow_pixmap == None) + { + XtReleaseGC (new, sp->bottom_shadow_GC); + sp->bottom_shadow_GC = AllocGCFromPixel (new, sp->bottom_shadow_color); + redraw = True; + } + + if (NE(highlight_pixmap)) + { + XtReleaseGC (new, sp->highlight_GC); + sp->highlight_GC = AllocGCFromPixmap (new, sp->highlight_pixmap); + redraw = True; + } + else if (NE(highlight_color) && sp->highlight_pixmap) + { + XtReleaseGC (new, sp->highlight_GC); + sp->highlight_GC = AllocGCFromPixel (new, sp->highlight_color); + redraw = True; + } + +#undef NE + + return redraw; +} + + +static void Unhighlight (gw) + Widget gw; +{ + register Dimension thick = ((SimpleWidget)gw)->simple.highlight_thickness; + register Dimension width = gw->core.width; + register Dimension height = gw->core.height; + + if (!XtIsRealized(gw)) + return; + + if ( XtIsSubclass(XtParent(gw), containerWidgetClass)) + { + XRectangle rectangles[4]; + GC gc = ((ContainerWidget) XtParent(gw))->container.background_GC; + +#define SET_RECTANGLE(I,X,Y,W,H) \ + rectangles[I].x = X; rectangles[I].y = Y; \ + rectangles[I].width = W; rectangles[I].height = H + + SET_RECTANGLE(0, 0, 0, thick, height); + SET_RECTANGLE(1, 0, height - thick, width, thick); + SET_RECTANGLE(2, 0, 0, width, thick); + SET_RECTANGLE(3, width - thick, 0, thick, height); + + XFillRectangles (XtDisplay(gw), XtWindow(gw), gc, rectangles, 4); + + } + else + { + Display *dpy = XtDisplay(gw); + Window win = XtWindow(gw); + + XClearArea( dpy, win, 0, 0, thick, height, False); + XClearArea( dpy, win, 0, height - thick, width, thick, False); + XClearArea( dpy, win, 0, 0, width, thick, False); + XClearArea( dpy, win, width - thick, 0, thick, height, False); + } +} + + +/* ARGSUSED */ +static void Redisplay( gw, event, region ) + Widget gw; + XEvent *event; + Region region; +{ + register SimpleWidget s = (SimpleWidget)gw; + + if (XtIsRealized(gw)) + { + Unhighlight (gw); + + if (s->simple.shadow_thickness) + XawDrawFrame (gw, + s->simple.highlight_thickness, + s->simple.highlight_thickness, + s->core.width - 2 * s->simple.highlight_thickness, + s->core.height - 2 * s->simple.highlight_thickness, + XawRAISED, + s->simple.shadow_thickness, + s->simple.top_shadow_GC, + s->simple.bottom_shadow_GC); + } +} + +static void Destroy(w) + Widget w; +{ + register SimpleWidget s = (SimpleWidget)w; + + XtReleaseGC(w, s->simple.top_shadow_GC); + XtReleaseGC(w, s->simple.bottom_shadow_GC); +} + +static Boolean DisplayRectProc (w, rect) + Widget w; + XRectangle *rect; +{ + register SimpleWidget s = (SimpleWidget)w; + + rect->x = + rect->y = s->simple.highlight_thickness + s->simple.shadow_thickness; + rect->width = s->core.width - 2 * rect->x; + rect->height = s->core.height - 2 * rect->y; + + return True; +} + + +static XtGeometryResult QueryGeometry(w, intended, preferred) + Widget w; + XtWidgetGeometry *intended, *preferred; +{ + register SimpleWidget sw = (SimpleWidget)w; + + + preferred->request_mode = CWWidth | CWHeight; + + preferred->width = preferred->height = 2 * SIMPLE_MARGIN(sw) + 1; + +#define WIDTH_HEIGHT (CWWidth | CWHeight) + + if (intended + && ((intended->request_mode & WIDTH_HEIGHT) == WIDTH_HEIGHT) + && intended->width == preferred->width + && intended->height == preferred->height) + { + return XtGeometryYes; + } + else if (preferred->width == w->core.width + && preferred->height == w->core.height) + { + return XtGeometryNo; + } + else + { + return XtGeometryAlmost; + } +} + + +static Boolean ChangeSensitive(w) + register Widget w; +{ + if (XtIsRealized(w)) { + if (XtIsSensitive(w)) + if (w->core.border_pixmap != UnspecifiedPixmap) + XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), + w->core.border_pixmap ); + else + XSetWindowBorder( XtDisplay(w), XtWindow(w), + w->core.border_pixel ); + else { + if (((SimpleWidget)w)->simple.insensitive_border == None) + ((SimpleWidget)w)->simple.insensitive_border = + XmuCreateStippledPixmap(XtScreen(w), + w->core.border_pixel, + w->core.background_pixel, + w->core.depth); + XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), + ((SimpleWidget)w)-> + simple.insensitive_border ); + } + } + return False; +} diff --git a/vendor/x11iraf/obm/ObmW/zz/Simple.h b/vendor/x11iraf/obm/ObmW/zz/Simple.h new file mode 100644 index 00000000..bbe11cda --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Simple.h @@ -0,0 +1,96 @@ +/* + * $XConsortium: Simple.h,v 1.9 89/07/21 01:44:53 kit Exp $ + */ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _Simple_h +#define _Simple_h + +/**************************************************************** + * + * Simple widgets + * + ****************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + insensitiveBorder Insensitive Pixmap Gray + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + + shadowWidth ShadowWidth Dimension 2 + topShadowPixel TopShadowPixel Pixel dynamic + bottomShadowPixel BottomShadowPixel Pixel dynamic + topShadowContrast TopShadowContrast Int 20 + bottomShadowContrast BottomShadowContrast Int 40 + userData UserData XtPointer NULL + beNiceToColormap BeNiceToColormap Boolean False + +*/ + +#define XtNcursor "cursor" +#define XtNinsensitiveBorder "insensitiveBorder" +#define XtNuserData "userData" +#define XtCUserData "UserData" + +#define XtCInsensitive "Insensitive" + +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNhighlightPixmap "highlightPixmap" +#define XtCHighlightPixmap "HighlightPixmap" +#define XtNhighlightThickness "highlightThickness" +#define XtCHighlightThickness "HighlightThickness" + + +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNhighlightPixel "highlightPixel" +#define XtCHighlightPixel "HighlightPixel" + +typedef struct _SimpleClassRec *SimpleWidgetClass; +typedef struct _SimpleRec *SimpleWidget; + +extern WidgetClass simpleWidgetClass; + +#endif /* _Simple_h */ diff --git a/vendor/x11iraf/obm/ObmW/zz/SimpleMenP.h b/vendor/x11iraf/obm/ObmW/zz/SimpleMenP.h new file mode 100644 index 00000000..32f5ccf9 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/SimpleMenP.h @@ -0,0 +1,113 @@ +/* + * $XConsortium: SimpleMenP.h,v 1.12 89/12/11 15:01:39 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* + * SimpleMenuP.h - Private Header file for SimpleMenu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SimpleMenuP_h +#define _SimpleMenuP_h + +#include <X11/ShellP.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/SimpleMenu.h> +#include <X11/Xraw/SmeP.h> + +#define SMW(w) ((SimpleMenuWidget)w)->simple_menu + +typedef struct { + XtPointer extension; /* For future needs. */ +} SimpleMenuClassPart; + +typedef struct _SimpleMenuClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ShellClassPart shell_class; + OverrideShellClassPart override_shell_class; + SimpleMenuClassPart simpleMenu_class; +} SimpleMenuClassRec; + +extern SimpleMenuClassRec simpleMenuClassRec; + +typedef struct _SimpleMenuPart { + /* resources */ + Dimension shadow_thickness; + Dimension bsb_shadow_thickness; + + Pixel top_shadow_color; + Pixmap top_shadow_pixmap; + Pixel bottom_shadow_color; + Pixmap bottom_shadow_pixmap; + + GC top_shadow_GC; + GC bottom_shadow_GC; + + XawFrameType frame_type; + + XtPointer user_data; + + /* resources */ + + String label_string; /* The string for the label or NULL. */ + SmeObject label; /* If label_string is non-NULL then this is + the label widget. */ + WidgetClass label_class; /* Widget Class of the menu label object. */ + + Dimension top_margin; /* Top and bottom margins. */ + Dimension bottom_margin; + Dimension row_height; /* height of each row (menu entry) */ + + Cursor cursor; /* The menu's cursor. */ + SmeObject popup_entry; /* The entry to position the cursor on for + when using XawPositionSimpleMenu. */ + Boolean menu_on_screen; /* Force the menus to be fully on the screen.*/ + int backing_store; /* What type of backing store to use. */ + + /* private state */ + + Boolean recursive_set_values; /* contain a possible infinite loop. */ + + Boolean menu_width; /* If true then force width to remain + core.width */ + Boolean menu_height; /* Just like menu_width, but for height. */ + + SmeObject entry_set; /* The entry that is currently set or + highlighted. */ +} SimpleMenuPart; + +typedef struct _SimpleMenuRec { + CorePart core; + CompositePart composite; + ShellPart shell; + OverrideShellPart override; + SimpleMenuPart simple_menu; +} SimpleMenuRec, *SimpleMenu; + +#endif /* _SimpleMenuP_h */ diff --git a/vendor/x11iraf/obm/ObmW/zz/SimpleMenu.c b/vendor/x11iraf/obm/ObmW/zz/SimpleMenu.c new file mode 100644 index 00000000..eeade452 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/SimpleMenu.c @@ -0,0 +1,1467 @@ +/* $XConsortium: SimpleMenu.c,v 1.32 89/12/11 15:01:50 kit Exp $ */ + +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * SimpleMenu.c - Source code file for SimpleMenu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * -------------------------------- + * + * Date: Jul 4, 1995 + * + * Changes: Vladimir T. Romanovski + * romsky@hp1.oea.ihep.su // IHEP (Russia) + * romsky@munin.ucsf.edu // University of California San Francisco + * + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/SimpleMenP.h> +#include <X11/Xraw/SmeBSB.h> +#include <X11/Xraw/Cardinals.h> +#include <X11/Xraw/SmeLineP.h> + +#include <X11/Xmu/Initer.h> +#include <X11/Xmu/CharSet.h> + +#define CORE(w) (w)->core + +#define ForAllChildren(smw, childP) \ + for ( (childP) = (SmeObject *) (smw)->composite.children ; \ + (childP) < (SmeObject *) ((smw)->composite.children + \ + (smw)->composite.num_children ) ; \ + (childP)++ ) + + +#define UnspecifiedPixmap (Pixmap)2 +#define UndefinedGC (GC)2 + +static void InsPixel(); + +static XtResource resources[] = { +#define offset(field) XtOffset(SimpleMenuWidget, simple_menu.field) + { + "top.gc", "Top.gc", XtRString, sizeof(String), + offset(top_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + "bottom.gc", "Bottom.gc", XtRString, sizeof(String), + offset(bottom_shadow_GC), XtRImmediate, (XtPointer)NULL + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(shadow_thickness), XtRImmediate, (XtPointer) 2 + }, + { + XtNbsbShadowWidth, XtCBsbShadowWidth, XtRDimension, sizeof(Dimension), + offset(bsb_shadow_thickness), XtRImmediate, (XtPointer) 2 + }, + { + XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(top_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(top_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(bottom_shadow_pixmap), XtRImmediate, (XtPointer) UnspecifiedPixmap + }, + { + XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(bottom_shadow_color), XtRCallProc, (XtPointer) InsPixel + }, + { + XtNuserData, XtCUserData, XtRPixmap, sizeof(Pixmap), + offset(user_data), XtRImmediate, (XtPointer) NULL + }, + { + XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, (XtPointer)0 + }, + { + XtNframeType, XtCFrameType, XtRFrameType, sizeof(XawFrameType), + offset(frame_type), XtRImmediate, (XtPointer) XawRAISED + }, + +/* + * Label Resources. + */ + + { + XtNlabel, XtCLabel, XtRString, sizeof(String), + offset(label_string), XtRString, NULL + }, + { + XtNlabelClass, XtCLabelClass, XtRPointer, sizeof(WidgetClass), + offset(label_class), XtRImmediate, (XtPointer) NULL + }, + +/* + * Layout Resources. + */ + + { + XtNrowHeight, XtCRowHeight, XtRDimension, sizeof(Dimension), + offset(row_height), XtRImmediate, (XtPointer) 0 + }, + { + XtNtopMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension), + offset(top_margin), XtRImmediate, (XtPointer) 0 + }, + { + XtNbottomMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension), + offset(bottom_margin), XtRImmediate, (XtPointer) 0 + }, + +/* + * Misc. Resources + */ + + { + XtNallowShellResize, XtCAllowShellResize, XtRBoolean, sizeof(Boolean), + XtOffset(SimpleMenuWidget, shell.allow_shell_resize), + XtRImmediate, (XtPointer) TRUE + }, + { + XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, (XtPointer) None + }, + { + XtNmenuOnScreen, XtCMenuOnScreen, XtRBoolean, sizeof(Boolean), + offset(menu_on_screen), XtRImmediate, (XtPointer) TRUE + }, + { + XtNpopupOnEntry, XtCPopupOnEntry, XtRWidget, sizeof(Widget), + offset(popup_entry), XtRWidget, NULL + }, + { + XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), + offset(backing_store), XtRImmediate, + (XtPointer) (Always + WhenMapped + NotUseful) + } +}; + +static void InsPixel(w, off, value) + Widget w; + int off; + XrmValue *value; +{ + register SimpleMenuWidget p = (SimpleMenuWidget) w; + static Pixel pixel; + + if (off == offset(top_shadow_color)) + { + p->simple_menu.top_shadow_GC = UndefinedGC; + } + else if (off == offset(bottom_shadow_color)) + { + p->simple_menu.bottom_shadow_GC = UndefinedGC; + } + value->addr = (XtPointer) &pixel; +} + +#undef offset + +static char defaultTranslations[] = + "<EnterWindow>: highlight() \n\ + <LeaveWindow>: unhighlight() \n\ + <BtnMotion>: highlight() \n\ + <BtnUp>: MenuPopdown() notify() unhighlight()"; + +/* + * Semi Public function definitions. + */ + +static void Redisplay(), Realize(), Resize(), ChangeManaged(); +static void Initialize(), ClassInitialize(), ClassPartInitialize(); +static Boolean SetValues(), SetValuesHook(); +static XtGeometryResult GeometryManager(); + +/* + * Action Routine Definitions + */ + +static void Highlight(), Unhighlight(), Notify(), PositionMenuAction(); + +/* + * Private Function Definitions. + */ + +static void MakeSetValuesRequest(), CreateLabel(), Layout(); +static void AddPositionAction(), PositionMenu(); +static Dimension GetMenuWidth(), GetMenuHeight(); +static Widget FindMenu(); +static SmeObject GetEventEntry(); + +static XtActionsRec actionsList[] = +{ + {"notify", Notify}, + {"highlight", Highlight}, + {"unhighlight", Unhighlight} +}; + +CompositeClassExtensionRec extension_rec = { + /* next_extension */ NULL, + /* record_type */ NULLQUARK, + /* version */ XtCompositeExtensionVersion, + /* record_size */ sizeof(CompositeClassExtensionRec), + /* accepts_objects */ TRUE, +}; + +#define superclass (&overrideShellClassRec) + +SimpleMenuClassRec simpleMenuClassRec = { + { + /* superclass */ (WidgetClass) superclass, + /* class_name */ "SimpleMenu", + /* size */ sizeof(SimpleMenuRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize*/ ClassPartInitialize, + /* Class init'ed */ False, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actionsList, + /* num_actions */ XtNumber(actionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ False, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ SetValuesHook, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ NULL, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + },{ + /* Shell extension */ NULL + },{ + /* Override extension */ NULL + },{ + /* Simple Menu extension*/ NULL + } +}; + +WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec; + +/************************************************************ + * + * Semi-Public Functions. + * + ************************************************************/ +#define done(type, value) \ + { \ + if (to->addr != NULL) { \ + if (to->size < sizeof(type)) { \ + to->size = sizeof(type); \ + return False; \ + } \ + *(type*)(to->addr) = (value); \ + } else { \ + static type static_val; \ + static_val = (value); \ + to->addr = (XtPointer)&static_val; \ + } \ + to->size = sizeof(type); \ + return True; \ + } + + +/* ARGSUSED */ +static Boolean +cvtStringToFrameType ( display, args, num_args, from, to, converter_data) + Display *display; + XrmValuePtr args; + Cardinal *num_args; + XrmValuePtr from; + XrmValuePtr to; + XtPointer *converter_data; +{ + String s = (String) from->addr; + + if (*num_args != 0) + XtAppErrorMsg(XtDisplayToApplicationContext(display), + "cvtStringToFrameType", "wrongParameters", + "XtToolkitError", + "String to frame type conversion needs no arguments", + (String*) NULL, (Cardinal*) NULL); + + if (XmuCompareISOLatin1(s, "raised") == 0) done(XawFrameType, XawRAISED); + if (XmuCompareISOLatin1(s, "sunken") == 0) done(XawFrameType, XawSUNKEN); + if (XmuCompareISOLatin1(s, "chiseled") == 0) done(XawFrameType, XawCHISELED); + if (XmuCompareISOLatin1(s, "ledged") == 0) done(XawFrameType, XawLEDGED); + if (XmuCompareISOLatin1(s, "tack") == 0) done(XawFrameType, XawTACK); + + XtDisplayStringConversionWarning(display, s, XtRFrameType); + printf("SimpleMenu.c"); + + done(XawFrameType, XawRAISED); +} + +/* Function Name: ClassInitialize + * Description: Class Initialize routine, called only once. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, + NULL, 0 ); + XmuAddInitializer( AddPositionAction, NULL); + + XtSetTypeConverter(XtRString, XtRFrameType, cvtStringToFrameType, + NULL, 0, XtCacheNone, NULL); +} + +/* Function Name: ClassPartInitialize + * Description: Class Part Initialize routine, called for every + * subclass. Makes sure that the subclasses pick up + * the extension record. + * Arguments: wc - the widget class of the subclass. + * Returns: none. + */ + +static void +ClassPartInitialize(wc) +WidgetClass wc; +{ + SimpleMenuWidgetClass smwc = (SimpleMenuWidgetClass) wc; + +/* + * Make sure that our subclass gets the extension rec too. + */ + + extension_rec.next_extension = smwc->composite_class.extension; + smwc->composite_class.extension = (XtPointer) &extension_rec; +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new) +Widget request, new; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) new; + register SimpleMenuPart* smwp = (SimpleMenuPart*)&smw->simple_menu; + + XmuCallInitializers(XtWidgetToApplicationContext(new)); + + if (smwp->label_class == NULL) + smwp->label_class = smeBSBObjectClass; + + smwp->label = NULL; + smwp->entry_set = NULL; + smwp->recursive_set_values = False; + + if (smwp->label_string != NULL) + CreateLabel(new); + + smwp->menu_width = TRUE; + + if (smw->core.width == 0) + { + smwp->menu_width = False; + smw->core.width = GetMenuWidth(new, NULL); + } + + smwp->menu_height = TRUE; + + if (smw->core.height == 0) + { + smwp->menu_height = False; + smw->core.height = GetMenuHeight(new); + } + + + /* + * Top & Bottom Shadow GCs + */ + + if (smwp->top_shadow_pixmap == UnspecifiedPixmap) + smwp->top_shadow_pixmap = None; + + if (smwp->top_shadow_GC == NULL){ + if (smwp->top_shadow_pixmap != None) + smwp->top_shadow_GC = AllocGCFromPixmap (new, smwp->top_shadow_pixmap); + else + smwp->top_shadow_GC = AllocGCFromPixel (new, smwp->top_shadow_color); + } else if (smwp->top_shadow_GC == UndefinedGC) + smwp->top_shadow_GC = MakeTopShadowGC (new, new->core.background_pixel); + + + if (smwp->bottom_shadow_pixmap == UnspecifiedPixmap) + smwp->bottom_shadow_pixmap = None; + + if (smwp->bottom_shadow_GC == NULL){ + if (smwp->bottom_shadow_pixmap != None) + smwp->bottom_shadow_GC = + AllocGCFromPixmap (new, smwp->bottom_shadow_pixmap); + else + smwp->bottom_shadow_GC = + AllocGCFromPixel (new, smwp->bottom_shadow_color); + } else if (smwp->bottom_shadow_GC == UndefinedGC) + smwp->bottom_shadow_GC = + MakeBottomShadowGC (new, new->core.background_pixel); +} + +/* Function Name: Redisplay + * Description: Redisplays the contents of the widget. + * Arguments: w - the simple menu widget. + * event - the X event that caused this redisplay. + * region - the region the needs to be repainted. + * Returns: none. + */ + +/* ARGSUSED */ +static void Redisplay(w, event, region) + Widget w; + XEvent * event; + Region region; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + SmeObjectClass class; + + if (region == NULL) + XClearWindow(XtDisplay(w), XtWindow(w)); + + /* + * Check and Paint each of the entries + */ + + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget)*entry)) + { + class = (SmeObjectClass) (*entry)->object.widget_class; + + if (class->rect_class.expose) + (*class->rect_class.expose) ((Widget)*entry, NULL, region); + } + + XawDrawFrame(w, + 0, 0, CORE(w).width, CORE(w).height, + SMW(w).frame_type, + SMW(w).shadow_thickness, + SMW(w).top_shadow_GC, + SMW(w).bottom_shadow_GC); + +} + +/* Function Name: Realize + * Description: Realizes the widget. + * Arguments: w - the simple menu widget. + * mask - value mask for the window to create. + * attrs - attributes for the window to create. + * Returns: none + */ + +static void +Realize(w, mask, attrs) +Widget w; +XtValueMask * mask; +XSetWindowAttributes * attrs; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + attrs->cursor = smw->simple_menu.cursor; + *mask |= CWCursor; + if ((smw->simple_menu.backing_store == Always) || + (smw->simple_menu.backing_store == NotUseful) || + (smw->simple_menu.backing_store == WhenMapped) ) { + *mask |= CWBackingStore; + attrs->backing_store = smw->simple_menu.backing_store; + } + else + *mask &= ~CWBackingStore; + + *mask |= CWSaveUnder; + attrs->save_under = True; + + (*superclass->core_class.realize) (w, mask, attrs); +} + +/* Function Name: Resize + * Description: Handle the menu being resized bigger. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void Resize(w) + Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + + if ( !XtIsRealized(w) ) return; + + ForAllChildren(smw, entry) /* reset width of all entries. */ + if (XtIsManaged( (Widget) *entry)) { + (*entry)->rectangle.width = smw->core.width - + 2 * SMW(w).shadow_thickness; + (*entry)->rectangle.x = SMW(w).shadow_thickness; + } + + XClearWindow(XtDisplay(w), XtWindow(w)); + + Redisplay(w, (XEvent *) NULL, (Region) NULL); + +} + +/* Function Name: SetValues + * Description: Relayout the menu when one of the resources is changed. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: none + */ + +/* ARGSUSED */ +static Boolean SetValues(current, request, new) + Widget current; + Widget request; + Widget new; +{ + SimpleMenuWidget smw_old = (SimpleMenuWidget) current; + SimpleMenuWidget smw_new = (SimpleMenuWidget) new; + register SimpleMenuPart* smwp = (SimpleMenuPart*)&smw_new->simple_menu; + Boolean ret_val = False; + Boolean layout = False; + Boolean redisplay = False; + +#define NE(name) (smw_old->simple_menu.name != smw_new->simple_menu.name) + + if (!XtIsRealized(current)) + return False; + + if (!smw_new->simple_menu.recursive_set_values) + { + if (smw_new->core.width != smw_old->core.width) + { + smw_new->simple_menu.menu_width = (smw_new->core.width != 0); + layout = TRUE; + } + if (smw_new->core.height != smw_old->core.height) + { + smw_new->simple_menu.menu_height = (smw_new->core.height != 0); + layout = TRUE; + } + } + + if (NE(cursor)) + XDefineCursor(XtDisplay(new), + XtWindow(new), smw_new->simple_menu.cursor); + + if (NE(label_string)) + if (smw_new->simple_menu.label_string == NULL) /* Destroy. */ + XtDestroyWidget((Widget)smw_old->simple_menu.label); + else if (smw_old->simple_menu.label_string == NULL) /* Create. */ + CreateLabel(new); + else /* Change. */ + XtVaSetValues((Widget)smw_new->simple_menu.label, + XtNlabel, smw_new->simple_menu.label_string, + NULL); + + if (NE(label_class)) + XtAppWarning(XtWidgetToApplicationContext(new), + "No Dynamic class change of the SimpleMenu Label."); + + if (NE(top_margin) || NE(bottom_margin)) /* filler................. */ + { + layout = TRUE; + ret_val = TRUE; + } + + if (layout) + Layout(new, NULL, NULL); + { + + if ( NE(shadow_thickness) ) + redisplay = TRUE; + + if (NE(top_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->top_shadow_GC); + smwp->top_shadow_GC = AllocGCFromPixmap (new, smwp->top_shadow_pixmap); + redisplay = True; + + } + else if (NE(top_shadow_color && smwp->top_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->top_shadow_GC); + smwp->top_shadow_GC = AllocGCFromPixel (new, smwp->top_shadow_color); + redisplay = True; + + } + + if (NE(bottom_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->bottom_shadow_GC); + smwp->bottom_shadow_GC = + AllocGCFromPixmap (new, smwp->bottom_shadow_pixmap); + + redisplay = True; + + } + else if (NE(bottom_shadow_color && smwp->bottom_shadow_pixmap)) + { + + XtReleaseGC (new, smwp->bottom_shadow_GC); + smwp->bottom_shadow_GC = + AllocGCFromPixel (new, smwp->bottom_shadow_color); + redisplay = True; + + } + +#undef NE + } + + return(ret_val || redisplay); +} + +/* Function Name: SetValuesHook + * Description: To handle a special case, this is passed the + * actual arguments. + * Arguments: w - the menu widget. + * arglist - the argument list passed to XtSetValues. + * num_args - the number of args. + * Returns: none + */ + +/* + * If the user actually passed a width and height to the widget + * then this MUST be used, rather than our newly calculated width and + * height. + */ + +static Boolean +SetValuesHook(w, arglist, num_args) +Widget w; +ArgList arglist; +Cardinal *num_args; +{ + register Cardinal i; + Dimension width, height; + + width = w->core.width; + height = w->core.height; + + for ( i = 0 ; i < *num_args ; i++) { + if ( streq(arglist[i].name, XtNwidth) ) + width = (Dimension) arglist[i].value; + if ( streq(arglist[i].name, XtNheight) ) + height = (Dimension) arglist[i].value; + } + + if ((width != w->core.width) || (height != w->core.height)) + MakeSetValuesRequest(w, width, height); + return(False); +} + +/************************************************************ + * + * Geometry Management routines. + * + ************************************************************/ + +/* Function Name: GeometryManager + * Description: This is the SimpleMenu Widget's Geometry Manager. + * Arguments: w - the Menu Entry making the request. + * request - requested new geometry. + * reply - the allowed geometry. + * Returns: XtGeometry{Yes, No, Almost}. + */ + +static XtGeometryResult +GeometryManager(w, request, reply) +Widget w; +XtWidgetGeometry * request, * reply; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) XtParent(w); + SmeObject entry = (SmeObject) w; + XtGeometryMask mode = request->request_mode; + XtGeometryResult answer; + Dimension old_height, old_width; + + if ( !(mode & CWWidth) && !(mode & CWHeight) ) + return(XtGeometryNo); + + reply->width = request->width; + reply->height = request->height; + + old_width = entry->rectangle.width; + old_height = entry->rectangle.height; + + Layout(w, &(reply->width), &(reply->height) ); + +/* + * Since we are an override shell and have no parent there is no one to + * ask to see if this geom change is okay, so I am just going to assume + * we can do whatever we want. If you subclass be very careful with this + * assumption, it could bite you. + * + * Chris D. Peterson - Sept. 1989. + */ + + if ( (reply->width == request->width) && + (reply->height == request->height) ) { + + if ( mode & XtCWQueryOnly ) { /* Actually perform the layout. */ + entry->rectangle.width = old_width; + entry->rectangle.height = old_height; + } + else { + Layout(( Widget) smw, NULL, NULL); + } + answer = XtGeometryDone; + } + else { + entry->rectangle.width = old_width; + entry->rectangle.height = old_height; + + if ( ((reply->width == request->width) && !(mode & CWHeight)) || + ((reply->height == request->height) && !(mode & CWWidth)) || + ((reply->width == request->width) && + (reply->height == request->height)) ) + answer = XtGeometryNo; + else { + answer = XtGeometryAlmost; + reply->request_mode = 0; + if (reply->width != request->width) + reply->request_mode |= CWWidth; + if (reply->height != request->height) + reply->request_mode |= CWHeight; + } + } + return(answer); +} + +/* Function Name: ChangeManaged + * Description: called whenever a new child is managed. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +ChangeManaged(w) +Widget w; +{ + Layout(w, NULL, NULL); +} + +/************************************************************ + * + * Global Action Routines. + * + * These actions routines will be added to the application's + * global action list. + * + ************************************************************/ + +/* Function Name: PositionMenuAction + * Description: Positions the simple menu widget. + * Arguments: w - a widget (no the simple menu widget.) + * event - the event that caused this action. + * params, num_params - parameters passed to the routine. + * we expect the name of the menu here. + * Returns: none + */ + +/* ARGSUSED */ +static void +PositionMenuAction(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + Widget menu; + XPoint loc; + + if (*num_params != 1) { + char error_buf[BUFSIZ]; + sprintf(error_buf, "%s %s", + "Xaw - SimpleMenuWidget: position menu action expects only one", + "parameter which is the name of the menu."); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + if ( (menu = FindMenu(w, params[0])) == NULL) { + char error_buf[BUFSIZ]; + sprintf(error_buf, "%s '%s'", + "Xaw - SimpleMenuWidget: could not find menu named: ", params[0]); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + switch (event->type) { + case ButtonPress: + case ButtonRelease: + loc.x = event->xbutton.x_root; + loc.y = event->xbutton.y_root; + PositionMenu(menu, &loc); + break; + case EnterNotify: + case LeaveNotify: + loc.x = event->xcrossing.x_root; + loc.y = event->xcrossing.y_root; + PositionMenu(menu, &loc); + break; + case MotionNotify: + loc.x = event->xmotion.x_root; + loc.y = event->xmotion.y_root; + PositionMenu(menu, &loc); + break; + default: + PositionMenu(menu, NULL); + break; + } +} + +/************************************************************ + * + * Widget Action Routines. + * + ************************************************************/ + +/* Function Name: Unhighlight + * Description: Unhighlights current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Unhighlight(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry = smw->simple_menu.entry_set; + SmeObjectClass class; + + if ( entry == NULL) return; + + smw->simple_menu.entry_set = NULL; + class = (SmeObjectClass) entry->object.widget_class; + (class->sme_class.unhighlight) ( (Widget) entry); +} + +/* Function Name: Highlight + * Description: Highlights current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Highlight(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry; + SmeObjectClass class; + + if ( !XtIsSensitive(w) ) return; + + entry = GetEventEntry(w, event); + + if (entry == smw->simple_menu.entry_set) return; + + Unhighlight(w, event, params, num_params); + + if (entry == NULL) return; + + if ( !XtIsSensitive( (Widget) entry)) { + smw->simple_menu.entry_set = NULL; + return; + } + + smw->simple_menu.entry_set = entry; + class = (SmeObjectClass) entry->object.widget_class; + + (class->sme_class.highlight) ( (Widget) entry); +} + +/* Function Name: Notify + * Description: Notify user of current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Notify(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry = smw->simple_menu.entry_set; + SmeObjectClass class; + + if ( (entry == NULL) || !XtIsSensitive((Widget) entry) ) return; + + class = (SmeObjectClass) entry->object.widget_class; + (class->sme_class.notify)( (Widget) entry ); +} + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawSimpleMenuAddGlobalActions + * Description: adds the global actions to the simple menu widget. + * Arguments: app_con - the appcontext. + * Returns: none. + */ + +void +XawSimpleMenuAddGlobalActions(app_con) +XtAppContext app_con; +{ + XtInitializeWidgetClass(simpleMenuWidgetClass); + XmuCallInitializers( app_con ); +} + + +/* Function Name: XawSimpleMenuGetActiveEntry + * Description: Gets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: the currently set entry or NULL if none is set. + */ + +Widget +XawSimpleMenuGetActiveEntry(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + return( (Widget) smw->simple_menu.entry_set); +} + +/* Function Name: XawSimpleMenuClearActiveEntry + * Description: Unsets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: none. + */ + +void +XawSimpleMenuClearActiveEntry(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + smw->simple_menu.entry_set = NULL; +} + +/************************************************************ + * + * Private Functions. + * + ************************************************************/ + +/* Function Name: CreateLabel + * Description: Creates a the menu label. + * Arguments: w - the smw widget. + * Returns: none. + * + * Creates the label object and makes sure it is the first child in + * in the list. + */ + +static void +CreateLabel(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + register Widget * child, * next_child; + register int i; + Arg args[2]; + + if ( (smw->simple_menu.label_string == NULL) || + (smw->simple_menu.label != NULL) ) { + char error_buf[BUFSIZ]; + + sprintf(error_buf, "Xaw Simple Menu Widget: %s or %s, %s", + "label string is NULL", "label already exists", + "no label is being created."); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + XtSetArg(args[0], XtNlabel, smw->simple_menu.label_string); + XtSetArg(args[1], XtNjustify, XtJustifyCenter); + smw->simple_menu.label = (SmeObject) + XtCreateManagedWidget("menuLabel", + smw->simple_menu.label_class, w, + args, TWO); + + next_child = NULL; + for (child = smw->composite.children + smw->composite.num_children, + i = smw->composite.num_children ; i > 0 ; i--, child--) { + if (next_child != NULL) + *next_child = *child; + next_child = child; + } + *child = (Widget) smw->simple_menu.label; +} + +/* Function Name: Layout + * Description: lays the menu entries out all nice and neat. + * Arguments: w - See below (+++) + * width_ret, height_ret - The returned width and + * height values. + * Returns: none. + * + * if width == NULL || height == NULL then it assumes the you do not care + * about the return values, and just want a relayout. + * + * if this is not the case then it will set width_ret and height_ret + * to be width and height that the child would get if it were layed out + * at this time. + * + * +++ "w" can be the simple menu widget or any of its object children. + */ + +static void +Layout(w, width_ret, height_ret) +Widget w; +Dimension *width_ret, *height_ret; +{ + SmeObject current_entry, *entry; + SimpleMenuWidget smw; + Dimension width, height; + Boolean do_layout = ((height_ret == NULL) || (width_ret == NULL)); + Boolean allow_change_size; + height = 0; + + if ( XtIsSubclass(w, simpleMenuWidgetClass) ) { + smw = (SimpleMenuWidget) w; + current_entry = NULL; + } + else { + smw = (SimpleMenuWidget) XtParent(w); + current_entry = (SmeObject) w; + } + + allow_change_size = (!XtIsRealized((Widget)smw) || + (smw->shell.allow_shell_resize)); + + if ( smw->simple_menu.menu_height ) + height = smw->core.height; + else + if (do_layout) { + height = smw->simple_menu.top_margin; + height += smw->simple_menu.shadow_thickness; + ForAllChildren(smw, entry) { + if (!XtIsManaged( (Widget) *entry)) continue; + + if ( (smw->simple_menu.row_height != 0) && + (*entry != smw->simple_menu.label) ) + (*entry)->rectangle.height = smw->simple_menu.row_height; + + (*entry)->rectangle.y = height; + (*entry)->rectangle.x = smw->simple_menu.shadow_thickness; + height += (*entry)->rectangle.height; + } + height += smw->simple_menu.bottom_margin; + height += smw->simple_menu.shadow_thickness; + } + else { + if ((smw->simple_menu.row_height != 0) && + (current_entry != smw->simple_menu.label) ) + height = smw->simple_menu.row_height; + } + + if (smw->simple_menu.menu_width) + width = smw->core.width; + else if ( allow_change_size ){ + width = GetMenuWidth((Widget) smw, (Widget) current_entry); + width +=2*smw->simple_menu.shadow_thickness; + } + else + width = smw->core.width; + + if (do_layout) { + ForAllChildren(smw, entry) + if (XtIsManaged( (Widget) *entry)) + (*entry)->rectangle.width = width - + 2*smw->simple_menu.shadow_thickness; + + if (allow_change_size) + MakeSetValuesRequest((Widget) smw, width, height); + } + else { + *width_ret = width; + if (height != 0) + *height_ret = height; + } +} + +/* Function Name: AddPositionAction + * Description: Adds the XawPositionSimpleMenu action to the global + * action list for this appcon. + * Arguments: app_con - the application context for this app. + * data - NOT USED. + * Returns: none. + */ + +/* ARGSUSED */ +static void +AddPositionAction(app_con, data) +XtAppContext app_con; +XtPointer data; +{ + static XtActionsRec pos_action[] = { + { "XawPositionSimpleMenu", PositionMenuAction }, + }; + + XtAppAddActions(app_con, pos_action, XtNumber(pos_action)); +} + +/* Function Name: FindMenu + * Description: Find the menu give a name and reference widget. + * Arguments: widget - reference widget. + * name - the menu widget's name. + * Returns: the menu widget or NULL. + */ + +static Widget +FindMenu(widget, name) +Widget widget; +String name; +{ + register Widget w, menu; + + for ( w = widget ; w != NULL ; w = XtParent(w) ) + if ( (menu = XtNameToWidget(w, name)) != NULL ) + return(menu); + return(NULL); +} + +/* Function Name: MoveMenu + * Description: Actually moves the menu, may force it to + * to be fully visable if menu_on_screen is TRUE. + * Arguments: w - the simple menu widget. + * x, y - the current location of the widget. + * Returns: none + */ + +static void +MoveMenu(w, x, y) +Widget w; +Position x, y; +{ + Arg arglist[2]; + Cardinal num_args = 0; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + if (smw->simple_menu.menu_on_screen) { + int width = w->core.width + 2 * w->core.border_width; + int height = w->core.height + 2 * w->core.border_width; + + if (x < 0) + x = 0; + else { + int scr_width = WidthOfScreen(XtScreen(w)); + if (x + width > scr_width) + x = scr_width - width; + } + + if (y < 0) + y = 0; + else { + int scr_height = HeightOfScreen(XtScreen(w)); + if (y + height > scr_height) + y = scr_height - height; + } + } + + XtSetArg(arglist[num_args], XtNx, x); num_args++; + XtSetArg(arglist[num_args], XtNy, y); num_args++; + XtSetValues(w, arglist, num_args); +} + +/* Function Name: PositionMenu + * Description: Places the menu + * Arguments: w - the simple menu widget. + * location - a pointer the the position or NULL. + * Returns: none. + */ + +static void +PositionMenu(w, location) +Widget w; +XPoint * location; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry; + XPoint t_point; + + if (location == NULL) { + Window junk1, junk2; + int root_x, root_y, junkX, junkY; + unsigned int junkM; + + location = &t_point; + if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, + &root_x, &root_y, &junkX, &junkY, &junkM) == False) { + char error_buf[BUFSIZ]; + sprintf(error_buf, "%s %s", "Xaw - SimpleMenuWidget:", + "Could not find location of mouse pointer"); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + location->x = (short) root_x; + location->y = (short) root_y; + } + + /* + * The width will not be correct unless it is realized. + */ + + XtRealizeWidget(w); + + location->x -= (Position) w->core.width/2; + + if (smw->simple_menu.popup_entry == NULL) + entry = smw->simple_menu.label; + else + entry = smw->simple_menu.popup_entry; + + if (entry != NULL) + location->y -= entry->rectangle.y + entry->rectangle.height/2; + + MoveMenu(w, (Position) location->x, (Position) location->y); +} + +/* Function Name: MakeSetValuesRequest + * Description: Makes a (possibly recursive) call to SetValues, + * I take great pains to not go into an infinite loop. + * Arguments: w - the simple menu widget. + * width, height - the size of the ask for. + * Returns: none + */ + +static void +MakeSetValuesRequest(w, width, height) +Widget w; +Dimension width, height; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Arg arglist[2]; + Cardinal num_args = (Cardinal) 0; + + if ( !smw->simple_menu.recursive_set_values ) { + if ( (smw->core.width != width) || (smw->core.height != height) ) { + smw->simple_menu.recursive_set_values = TRUE; + XtSetArg(arglist[num_args], XtNwidth, width); num_args++; + XtSetArg(arglist[num_args], XtNheight, height); num_args++; + XtSetValues(w, arglist, num_args); + } + else if (XtIsRealized( (Widget) smw)) + Redisplay((Widget) smw, (XEvent *) NULL, (Region) NULL); + } + smw->simple_menu.recursive_set_values = False; +} + +/* Function Name: GetMenuWidth + * Description: Sets the length of the widest entry in pixels. + * Arguments: w - the simple menu widget. + * Returns: width of menu. + */ + +static Dimension +GetMenuWidth(w, w_ent) +Widget w, w_ent; +{ + SmeObject cur_entry = (SmeObject) w_ent; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Dimension width, widest = (Dimension) 0; + SmeObject * entry; + + if ( smw->simple_menu.menu_width ) + return(smw->core.width); + + ForAllChildren(smw, entry) { + XtWidgetGeometry preferred; + + if (!XtIsManaged( (Widget) *entry)) continue; + + if (*entry != cur_entry) { + XtQueryGeometry((Widget)*entry, NULL, &preferred); + + if (preferred.request_mode & CWWidth) + width = preferred.width; + else + width = (*entry)->rectangle.width; + } + else + width = (*entry)->rectangle.width; + + if ( width > widest ) + widest = width; + } + + return(widest); +} + +/* Function Name: GetMenuHeight + * Description: Sets the length of the widest entry in pixels. + * Arguments: w - the simple menu widget. + * Returns: width of menu. + */ + +static Dimension +GetMenuHeight(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + Dimension height; + + if (smw->simple_menu.menu_height) + return(smw->core.height); + + height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin; + + if (smw->simple_menu.row_height == 0) + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget) *entry)) + height += (*entry)->rectangle.height; + else + height += smw->simple_menu.row_height * smw->composite.num_children; + + return(height); +} + +/* Function Name: GetEventEntry + * Description: Gets an entry given an event that has X and Y coords. + * Arguments: w - the simple menu widget. + * event - the event. + * Returns: the entry that this point is in. + */ + +static SmeObject +GetEventEntry(w, event) +Widget w; +XEvent * event; +{ + Position x_loc, y_loc; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + + switch (event->type) { + case MotionNotify: + x_loc = event->xmotion.x; + y_loc = event->xmotion.y; + break; + case EnterNotify: + case LeaveNotify: + x_loc = event->xcrossing.x; + y_loc = event->xcrossing.y; + break; + case ButtonPress: + case ButtonRelease: + x_loc = event->xbutton.x; + y_loc = event->xbutton.y; + break; + default: + XtAppError(XtWidgetToApplicationContext(w), + "Unknown event type in GetEventEntry()."); + break; + } + + if ( (x_loc < 0) || (x_loc >= smw->core.width) || (y_loc < 0) || + (y_loc >= smw->core.height) ) + return(NULL); + + ForAllChildren(smw, entry) { + if (!XtIsManaged ((Widget) *entry)) continue; + + if ( ((*entry)->rectangle.y <= y_loc) && + ((*entry)->rectangle.y + (*entry)->rectangle.height >= y_loc) ) + if ( *entry == smw->simple_menu.label ) + return(NULL); /* cannot select the label. */ + else + return(*entry); + } + + return(NULL); +} diff --git a/vendor/x11iraf/obm/ObmW/zz/SimpleMenu.h b/vendor/x11iraf/obm/ObmW/zz/SimpleMenu.h new file mode 100644 index 00000000..752be892 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/SimpleMenu.h @@ -0,0 +1,169 @@ +/* + * $XConsortium: SimpleMenu.h,v 1.17 89/12/11 15:01:55 kit Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SimpleMenu.h - Public Header file for SimpleMenu widget. + * + * This is the public header file for the Athena SimpleMenu widget. + * It is intended to provide one pane pulldown and popup menus within + * the framework of the X Toolkit. As the name implies it is a first and + * by no means complete implementation of menu code. It does not attempt to + * fill the needs of all applications, but does allow a resource oriented + * interface to menus. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SimpleMenu_h +#define _SimpleMenu_h + +#include <X11/Shell.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * SimpleMenu widget + * + ****************************************************************/ + +/* SimpleMenu Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + backgroundPixmap BackgroundPixmap Pixmap None + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap BorderPixmap Pixmap None + borderWidth BorderWidth Dimension 1 + bottomMargin VerticalMargins Dimension VerticalSpace + columnWidth ColumnWidth Dimension Width of widest text + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + label Label String NULL (No label) + labelClass LabelClass Pointer smeBSBObjectClass + mappedWhenManaged MappedWhenManaged Boolean True + rowHeight RowHeight Dimension Height of Font + sensitive Sensitive Boolean True + topMargin VerticalMargins Dimension VerticalSpace + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +typedef struct _SimpleMenuClassRec* SimpleMenuWidgetClass; +typedef struct _SimpleMenuRec* SimpleMenuWidget; + +extern WidgetClass simpleMenuWidgetClass; + +#define XtNcursor "cursor" +#define XtNbottomMargin "bottomMargin" +#define XtNcolumnWidth "columnWidth" +#define XtNlabelClass "labelClass" +#define XtNmenuOnScreen "menuOnScreen" +#define XtNpopupOnEntry "popupOnEntry" +#define XtNrowHeight "rowHeight" +#define XtNtopMargin "topMargin" + +#define XtCColumnWidth "ColumnWidth" +#define XtCLabelClass "LabelClass" +#define XtCMenuOnScreen "MenuOnScreen" +#define XtCPopupOnEntry "PopupOnEntry" +#define XtCRowHeight "RowHeight" +#define XtCVerticalMargins "VerticalMargins" + +/* New fields */ +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNbsbShadowWidth "bsbShadowWidth" +#define XtCBsbShadowWidth "BsbShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNuserData "userData" +#define XtCUserData "UserData" +#define XtNframeType "frameType" +#define XtCFrameType "FrameType" +#define XtRFrameType "FrameType" + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawSimpleMenuAddGlobalActions + * Description: adds the global actions to the simple menu widget. + * Arguments: app_con - the appcontext. + * Returns: none. + */ + +void +XawSimpleMenuAddGlobalActions(/* app_con */); +/* +XtAppContext app_con; +*/ + +/* Function Name: XawSimpleMenuGetActiveEntry + * Description: Gets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: the currently set entry or NULL if none is set. + */ + +Widget +XawSimpleMenuGetActiveEntry( /* w */); +/* +Widget w; +*/ + +/* Function Name: XawSimpleMenuClearActiveEntry + * Description: Unsets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: none. + */ + +void +XawSimpleMenuClearActiveEntry(/* w */); +/* +Widget w; +*/ + +#endif /* _SimpleMenu_h */ diff --git a/vendor/x11iraf/obm/ObmW/zz/SimpleP.h b/vendor/x11iraf/obm/ObmW/zz/SimpleP.h new file mode 100644 index 00000000..f4044709 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/SimpleP.h @@ -0,0 +1,62 @@ +#ifndef _SimpleP_h +#define _SimpleP_h + +#include <X11/IntrinsicP.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/Simple.h> + +#define SIMPLE(w) ((SimpleWidget) w)->simple + +typedef Boolean (*XawDisplayRectProc) Xraw_PROTO((Widget, XRectangle * )); +typedef Boolean (*XawChangeSensitive) Xraw_PROTO((Widget)); + +typedef struct { + XawChangeSensitive change_sensitive; + XawDisplayRectProc display_rect; + caddr_t extension; +} SimpleClassPart; + +typedef struct _SimpleClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; +} SimpleClassRec; + +extern SimpleClassRec simpleClassRec; + +typedef struct { + /* resources */ + Cursor cursor; + Pixmap insensitive_border; + Pixel foreground; + + Dimension shadow_thickness; + Pixel top_shadow_color; + Pixmap top_shadow_pixmap; + Pixel bottom_shadow_color; + Pixmap bottom_shadow_pixmap; + Pixel highlight_color; + Pixmap highlight_pixmap; + Dimension highlight_thickness; + + caddr_t user_data; + + /* private state */ + GC top_shadow_GC; + GC bottom_shadow_GC; + GC highlight_GC; +} SimplePart; + +typedef struct _SimpleRec { + CorePart core; + SimplePart simple; +} SimpleRec; + +#define SIMPLE_MARGIN(w) (((SimpleWidget)w)->simple.highlight_thickness + \ + ((SimpleWidget)w)->simple.shadow_thickness) + +#define XtSimpleClass(w) ((SimpleWidgetClass)XtClass(w)) +#define XtInheritDisplayRectProc ((Boolean (*)())_XtInherit) +#define XtInheritChangeSensitive ((Boolean (*)())_XtInherit) + +#endif /* _SimpleP_h */ diff --git a/vendor/x11iraf/obm/ObmW/zz/Table.c b/vendor/x11iraf/obm/ObmW/zz/Table.c new file mode 100644 index 00000000..a5387810 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Table.c @@ -0,0 +1,4529 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> + +#include <X11/Xatom.h> +#include <X11/IntrinsicP.h> +#include <X11/RectObjP.h> +#include <X11/StringDefs.h> +#include <X11/keysym.h> +#include <X11/Xos.h> + +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/Drawing.h> + +#include <X11/Xraw/XawInit.h> +#include <X11/Xraw/3d.h> +#include <X11/Xraw/TableP.h> +#include <X11/Xraw/Frame.h> +#include <X11/Xraw/AsciiText.h> +#include <X11/Xraw/Viewport.h> +#include <X11/Xraw/Scrollbar.h> +#include <X11/Xraw/ScrolledTable.h> + +#ifdef EBUG_XRAW_MALLOC +#include <dbmalloc/malloc.h> +#endif + +#define MULTI_LINE_TABLE 32767 + + +#undef CELL_IN /* */ + +#ifdef MIN +#undef MIN +#endif +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +#ifdef MAX +#undef MAX +#endif +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define CALLOC(num,type) (num * sizeof(type) <= 0 ? (type*)NULL : \ + (type*)XtMalloc((Cardinal)(num) * (Cardinal)sizeof(type))) + +#define NOT_A_CUT_BUFFER (-1) + +#define MAXCUT 30000 +#define EDIT(w) (((XawTableWidget) w)->table.edit) +#define InRange(n,a,b) MAX(a,MIN(n,b)) + +#define LEFT_EDGE(tw) (((XawTableWidget)tw)->table.internal_width + \ + ((XawTableWidget)tw)->table.label_shadow_thickness) + +#define TOP_EDGE(tw) (((XawTableWidget)tw)->table.internal_height + \ + ((XawTableWidget)tw)->table.label_shadow_thickness) + +#define CELL(field) cell->field +#define STUFF(w) ((XawTableWidget)w)->table.table_stuff +#define COLUMNS(w) ((XawTableWidget)w)->table.columns +#define ROWS(w) ((XawTableWidget)w)->table.rows +#define GET_CELL_LABEL ((CELL(label) == NULL ? Dummy : CELL(label))) + +#define COLUMN_DATA(tw) ((XawTableColumnRec*)tw->table.column_data) +#define COLUMN_WIDTH(tw,column) \ +(tw->table.literal ? \ + ( \ + (COLUMN_DATA(tw)[column].flag & _CL_width) ?\ + COLUMN_DATA(tw)[column].width : \ + tw->table.column_default_width \ + ) \ + * tw->table.literal_width + \ + 2 * tw->table.internal_width \ + : \ + ( \ + (COLUMN_DATA(tw)[column].flag & _CL_width) ?\ + COLUMN_DATA(tw)[column].width : \ + tw->table.column_default_width \ + ) \ +/* _COLUMN_WIDTH_ */) + + +#define MANAGE_EDIT(tw) \ + if ( ! XtIsManaged(EDIT(tw))) \ + { \ + XtManageChild (EDIT(tw)); \ + XtSetKeyboardFocus ((Widget)tw, EDIT(tw)); \ + } + + +#define UNMANAGE_EDIT(tw) \ + if ( XtIsManaged(EDIT(tw))) \ + { \ + XtUnmanageChild (tw->table.edit); \ + XtSetKeyboardFocus((Widget)tw, (Widget)None); \ + } + + +#define DO_CALLBACK(w,callback,data) \ + if (XtCallbackHasSome == XtHasCallbacks(w, callback)) \ + XtCallCallbacks (w, callback, (XtPointer)&data) + + +#define IsEditInRowColumn(tw, row, column) \ + (XtIsManaged(EDIT(tw)) && (row == tw->table.edit_row) \ + && (column == tw->table.edit_column)) + + + +#define REJECT (-1) +#define ACCEPT (0) + +#define CHECK_TABLE(tw) \ + _check_table ((XtPointer)STUFF(tw), ROWS(tw), COLUMNS(tw)); \ + CheckAllLabels(tw) + + + +typedef struct _XawTableCellRec { + /* Node communication entity */ + XawTableNodeRec node; + /* Cell label entity */ + char *label; + Position label_x; + Dimension label_width; + Dimension label_len; + /* Cell colour entity */ + Boolean highlight; + Boolean special_colour; + Pixel fore; + Pixel back; + GC normal; + GC reverse; + GC top; + GC bottom; + +}XawTableCellRec; + +#define _CL_width (1L<<0) +#define _CL_font (1L<<1) +#define _CL_label (1L<<2) +#define _CL_justify (1L<<3) +#define _CL_background (1L<<4) +#define _CL_foreground (1L<<5) + +typedef struct _XawTableColumnRec { + int flag; + int width; + XFontStruct *font; + char *label; + XtJustify justify; + Pixel background; + Pixel foreground; + GC normal; + GC reverse; + GC top; + GC bottom; +}XawTableColumnRec; + + +#ifdef CRAY +#define WORD64 +#endif + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +static void Def_pixel(); +static void Def_scroll(); +static void Def_column_default_width(); +static void Def_literal_width(); +static void Def_shadow_thickness(); + +#define Offset(field) XtOffsetOf(TableRec, field) + +static XtResource resources[] = { + { + XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.foreground), XtRString, XtDefaultForeground + }, + { + XtNeditForeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.edit_fore), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNeditBackground, XtCBackground, XtRPixel, sizeof(Pixel), + Offset(table.edit_back), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNrowForeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.row_fore), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNcolumnForeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(table.column_fore), XtRCallProc, (XtPointer)Def_pixel + }, + { + XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + Offset(table.font), XtRString, XtDefaultFont + }, + { + XtNliteral, XtCLiteral, XtRBoolean, sizeof(Boolean), + Offset(table.literal), XtRImmediate, (XtPointer)False + }, + { + XtNrowOriented, XtCRowOriented, XtRBoolean, sizeof(Boolean), + Offset(table.row_oriented), XtRImmediate, (XtPointer)True + }, + { + XtNmaskNumber, XtCMaskNumber, XtRInt, sizeof(int), + Offset(table.mask_number), XtRImmediate, (XtPointer)7 + }, + { + XtNcolumns, XtCColumns, XtRInt, sizeof(int), + Offset(table.columns), XtRImmediate, (XtPointer)0 + }, + { + XtNrows, XtCRows, XtRInt, sizeof(int), + Offset(table.rows), XtRImmediate, (XtPointer)0 + }, + { + XtNtableMargin, XtCTableMargin, XtRDimension, sizeof(Dimension), + Offset(table.tab_margin), XtRImmediate, (XtPointer)2 + }, + { + XtNrowMargin, XtCRowMargin, XtRDimension, sizeof(Dimension), + Offset(table.row_margin), XtRImmediate, (XtPointer)2 + }, + { + XtNcolumnMargin, XtCColumnMargin, XtRDimension, sizeof(Dimension), + Offset(table.col_margin), XtRImmediate, (XtPointer)2 + }, + { + XtNlabelShadowWidth, XtCLabelShadowWidth, XtRDimension, + sizeof(Dimension), Offset(table.label_shadow_thickness), XtRImmediate, + (XtPointer)1 + }, + { + XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify), + Offset(table.justify), XtRImmediate, (XtPointer)XtJustifyCenter + }, + { + XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), + Offset(table.internal_width), XtRImmediate, (XtPointer)4 + }, + { + XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), + Offset(table.internal_height), XtRImmediate, (XtPointer)2 + }, + { + XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char), + Offset(table.encoding), XtRImmediate, (XtPointer)XawTextEncoding8bit + }, + { + XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + Offset(container.shadow_thickness), XtRCallProc, + (XtPointer) Def_shadow_thickness + }, + { + XtNvetricalScroll, XtCScroll, XtRWidget, sizeof(Widget), + Offset(table.v_scroll), XtRCallProc, (XtPointer)Def_scroll + }, + { + XtNhorizontalScroll, XtCScroll, XtRWidget, sizeof(Widget), + Offset(table.h_scroll), XtRCallProc, (XtPointer)Def_scroll + }, + { + XtNrowHeight, XtCRowHeight, XtRInt, sizeof(int), + Offset(table.row_height), XtRImmediate, (XtPointer)0 + }, + { + XtNdefaultWidth, XtCDefaultWidth, XtRInt, sizeof(int), + Offset(table.column_default_width), XtRCallProc, + (XtPointer) Def_column_default_width + }, + { + XtNeditable, XtCEditable, XtRBoolean, sizeof(Boolean), + Offset(table.editable), XtRImmediate, (XtPointer) TRUE + }, + { + XtNliteralWidth, XtCLiteralWidth, XtRInt, sizeof(int), + Offset(table.literal_width), XtRCallProc, (XtPointer) Def_literal_width + }, + + /* ALLOWANCE CALLBACKS */ + { + XtNallowAddColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_add_column), XtRCallback, NULL + }, + { + XtNallowAddRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_add_row), XtRCallback, NULL + }, + { + XtNallowDeleteColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_delete_column), XtRCallback, NULL + }, + { + XtNallowDeleteRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_delete_row), XtRCallback, NULL + }, + { + XtNallowDeleteTable, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.allow_delete_table), XtRCallback, NULL + }, + /* INFORMATION CALLBACKS */ + + { + XtNaddColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.add_column), XtRCallback, NULL + }, + { + XtNaddRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.add_row), XtRCallback, NULL + }, + { + XtNcreateTable, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.create_table), XtRCallback, NULL + }, + { + XtNchangedCell, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.changed_cell), XtRCallback, NULL + }, + { + XtNchangedColumnWidth, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.changed_column_width), XtRCallback, NULL + }, + { + XtNchangedRowHeight, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.changed_row_height), XtRCallback, NULL + }, + { + XtNdeleteColumn, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.delete_column), XtRCallback, NULL + }, + { + XtNdeleteRow, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.delete_row), XtRCallback, NULL + }, + { + XtNdeleteTable, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.delete_table), XtRCallback, NULL + }, + { + XtNwhatCell, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(table.what_cell), XtRCallback, NULL + }, +}; + +#define PRINTF_BOOL(a) ((a) ? "TRUE":"FALSE") +#define PRINTF_NULL(a) ((a)==NULL ? "NULL":"not NULL") + +static void Def_pixel(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + XawTableWidget tw = (XawTableWidget)w; + static Pixel pix = 0; + + + if ( offset == (int)Offset(table.edit_fore)) + pix = tw->table.foreground; + else if ( offset == (int)Offset(table.edit_back)) + { + if (!FetchPixel(w, "#d0d000", &pix)) + pix = WhitePixelOfScreen(XtScreen(w)); + } + else + pix = tw->core.background_pixel; + + value->addr = (XtPointer)& pix; +} + +/* ARGSUSED */ +static void Def_scroll(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + static Widget view; + + for (view = XtParent(w); + (view != (Widget)NULL) && (!XtIsSubclass(view, viewportWidgetClass)); + view = XtParent(view)) + /* EMPTY */; + + if (view) + { + if (offset == Offset(table.v_scroll)) + { + if (((view = XtNameToWidget(view, "vertical")) == (Widget)NULL) + || !XtIsSubclass(view, scrollbarWidgetClass)) + view = (Widget)NULL; + } + else + if (offset == Offset(table.h_scroll)) + { + if (((view = XtNameToWidget(view, "horizontal")) == (Widget)NULL) + || !XtIsSubclass(view, scrollbarWidgetClass)) + view = (Widget)NULL; + } + } + + value->addr = (XtPointer)&view; +} + +/* ARGSUSED */ +static void Def_column_default_width(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + XawTableWidget tw = (XawTableWidget) w; + static int column_default_width; + + if (tw->table.literal) + column_default_width = 10; + else + column_default_width = 60; + + value->addr = (XtPointer)&column_default_width; +} + +#ifndef WORD64 +#define TXT_16 XChar2b +#else +#define TXT_16 char +#endif + +/* ARGSUSED */ +static void Def_literal_width(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + XawTableWidget tw = (XawTableWidget) w; + static int literal_width; + + if (tw->table.encoding) + tw->table.literal_width = XTextWidth16(tw->table.font, (TXT_16*)"mmm", 3); + else + tw->table.literal_width = XTextWidth(tw->table.font, "mmm", 3); + + tw->table.literal_width /= 3; + + value->addr = (XtPointer)& literal_width; +} + +/* ARGSUSED */ +static void Def_shadow_thickness(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + Widget parent = XtParent (w); + static Dimension shadow_thickness; + + if (XtIsSubclass (parent, scrolledTableWidgetClass) + || + XtIsSubclass (parent, viewportWidgetClass)) + shadow_thickness = 0; + else + shadow_thickness = 2; + + value->addr = (XtPointer)& shadow_thickness; +} + + +#undef offset + +static void MultipleChangeGC(); +static void Initialize(); +static void Realize(); +static void Resize(); +static void Redisplay(); +static void Destroy(); + +static Boolean SetValues(); + +static void WalkForCells(); +static void LoseSelection(); + +static void CallEdit(); +static void InsertSelection(); +static void StoreBuffer(); +static void WhatCell(); +static void KeyReturn(); +static void HighlightCell(); +static void UnhighlightCell(); +static void DoingNothing(); + +static char* DummyString(); + +static Boolean InitCell(); + +static XtGeometryResult QueryGeometry(); +static XtGeometryResult GeometryManager(); + +static XtActionsRec actions[] = { + {"call-edit", (XtActionProc)CallEdit }, + {"insert-selection", (XtActionProc)InsertSelection}, + {"store-in-buffer", (XtActionProc)StoreBuffer }, + {"what_cell", (XtActionProc)WhatCell }, + {"key_return", (XtActionProc)KeyReturn }, + {"highlight", (XtActionProc)HighlightCell }, + {"unhighlight", (XtActionProc)UnhighlightCell}, + {"no-op", (XtActionProc)DoingNothing } +}; + +static char translations[] = + "Ctrl<Btn1Up>: what_cell() \n\ + <Btn1Up>: call-edit() \n\ + <Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \n\ + <Btn3Up>: highlight() store-in-buffer(PRIMARY,CUT_BUFFER0) "; + +static char edit_translations[] = + " <Key>Return: key_return() \n\ + <Key>Linefeed: key_return() \n\ + <Key>Down: no-op(r) \n\ + <Key>Up: no-op(r) "; + +static char* Dummy = ""; + + +#define SuperClass ((ContainerWidgetClass)&containerClassRec) + +TableClassRec tableClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "Table", + /* widget_size */ sizeof(TableRec), + /* classInitialize */ NULL, + /* class_partInitialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ TRUE, + /* visible_interest */ TRUE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ translations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + /* Composite class part */ + { + /* geometry manager */ GeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL, + }, + /* Constraint class part */ + { + /* subresources */ NULL, + /* subresource_count */ 0, + /* constraint_size */ 0, + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL, + }, + /* Container class part */ + { + /* ignore */ 0, + }, + { /* Table class fields initialization */ + /* ignore */ 0 + } +}; + +WidgetClass tableWidgetClass = (WidgetClass)&tableClassRec; + + +/**************************************************************** + * + * Private procedures + * + ****************************************************************/ +#define NORMAL_INDEX(fore, back) \ + (int)(((int)fore * (int)back) & tw->table.mask_hash_table) + +#define SHADOW_INDEX(back) (int)(((int)back) & tw->table.mask_hash_table) + +#define GET_NORMAL(tw,i) (tw->table.normal_hash_table+(i)) +#define GET_SHADOW(tw,i) (tw->table.shadow_hash_table+(i)) + +#define NEXT(i) (int)((i+1) & tw->table.mask_hash_table) + +static int MaskStaticArray[] = { + 0x1, 0x3, 0x7, 0xF, + 0x1F, 0x3F, 0x7F, 0xFF, + 0x1FF, 0x3FF, 0x7FF, 0xFFF + }; + +static NormalReverseGC* GetNormalGC(w, fore, back, font) + Widget w; + Pixel fore; + Pixel back; + Font font; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = NORMAL_INDEX(fore, back); + + while (GET_NORMAL(tw,i)->used > 0) + { + + if (GET_NORMAL(tw,i)->fore == fore && GET_NORMAL(tw,i)->back == back) + { + GET_NORMAL(tw,i)->used++; + return GET_NORMAL(tw,i); + } + i = NEXT(i); + } + + if (GET_NORMAL(tw,i)->used == 0) + { + XtGCMask mask; + XGCValues values; + Display *dpy = XtDisplay(w); + Window win = XtIsRealized(w) ? XtWindow(w) : XDefaultRootWindow(dpy); + + + mask = GCForeground | GCBackground | GCFont; + values.foreground = fore; + values.background = back; + values.font = font; + + GET_NORMAL(tw,i)->normal = XCreateGC(dpy, win, mask, &values); + values.foreground = back; + values.background = fore; + GET_NORMAL(tw,i)->reverse = XCreateGC(dpy, win, mask, &values); + + GET_NORMAL(tw,i)->used = 1; + GET_NORMAL(tw,i)->fore = fore; + GET_NORMAL(tw,i)->back = back; + + return GET_NORMAL(tw,i); + } + + return (NormalReverseGC*)NULL; +} + +static void GetGCByForeground(w, gc, fore) + Widget w; + GC *gc; + Pixel fore; +{ + XGCValues values; + + values.foreground = fore; + (*gc) = XtGetGC(w, GCForeground, &values); +} + + +static ShadowGC* GetShadowGC(w, back) + Widget w; + Pixel back; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = SHADOW_INDEX(back); + + while (GET_SHADOW(tw,i)->used > 0) + { + if (GET_SHADOW(tw,i)->back == back) + { + GET_SHADOW(tw,i)->used++; + return GET_SHADOW(tw,i); + } + i = NEXT(i); + } + + if (GET_SHADOW(tw,i)->used == 0) + { + Pixel top; + Pixel bottom; + + GET_SHADOW(tw,i)->used = 1; + GET_SHADOW(tw,i)->back = back; + + (void)TopShadowColor(w, back, &top); + (void)BottomShadowColor(w, back, &bottom); +#ifdef CELL_IN + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->bottom, top); + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->top, bottom); +#else + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->bottom, bottom); + GetGCByForeground(w, (GC*)&GET_SHADOW(tw,i)->top, top); +#endif + return GET_SHADOW(tw,i); + } + + return (ShadowGC*)NULL; +} + +static void ReleaseNormalGC(w, fore, back) + Widget w; + Pixel fore; + Pixel back; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = NORMAL_INDEX(fore, back); + + while (GET_NORMAL(tw,i)->used > 0) + { + if ( GET_NORMAL(tw,i)->fore == fore && GET_NORMAL(tw,i)->back == back) + { + if (--GET_NORMAL(tw,i)->used == 0) { + XFreeGC(XtDisplay(w), GET_NORMAL(tw,i)->normal); + XFreeGC(XtDisplay(w), GET_NORMAL(tw,i)->reverse); + } + break; + } + + i = NEXT(i); + } +} + +static void ReleaseShadowGC(w, back) + Widget w; + Pixel back; +{ + register XawTableWidget tw = (XawTableWidget)w; + int i = SHADOW_INDEX(back); + + while (GET_SHADOW(tw,i)->used > 0) + { + if ( GET_SHADOW(tw,i)->back == back) + { + if (--GET_SHADOW(tw,i)->used == 0) + { + XtReleaseGC(w, GET_SHADOW(tw,i)->top); + XtReleaseGC(w, GET_SHADOW(tw,i)->bottom); + } + break; + } + i = NEXT(i); + } +} + +static void MultipleChangeGC(w, fore, back, font, normal, reverse) + Widget w; + Pixel *fore; + Pixel *back; + Font *font; + GC *normal; + GC *reverse; +{ + XtGCMask mask; + XGCValues values; + + if (normal != (GC*)NULL){ + mask = (XtGCMask)0; + if (fore != (Pixel*)NULL) { + mask |= GCForeground; + values.foreground = *fore; + } + if (back != (Pixel*)NULL) { + mask |= GCBackground; + values.background = *back; + } + if (font != (Font*)NULL) { + mask |= GCFont; + values.font = *font; + } + XChangeGC(XtDisplay(w), *normal, mask, &values); + } + + if (reverse != (GC*)NULL){ + mask = (XtGCMask)0; + if (fore != (Pixel*)NULL) { + mask |= GCForeground; + values.foreground = *back; /* reverse */ + } + if (back != (Pixel*)NULL) { + mask |= GCBackground; + values.background = *fore; /* reverse */ + } + if (font != (Font*)NULL) { + mask |= GCFont; + values.font = *font; + } + XChangeGC(XtDisplay(w), *reverse, mask, &values); + } +} + +#ifndef WORD64 + +#define TXT16 XChar2b + +#else + +#define TXT16 char + +static XChar2b *buf2b; +static int buf2blen = 0; + +#define XTextWidth16 _XawTableWidth16 +#define XDrawString16 _XawTableDraw16 + +#endif /* WORD64 */ + + +static void CalculatePreferredSize(w, width, height) + Widget w; + Dimension *width; + Dimension *height; +{ + register XawTableWidget tw = (XawTableWidget)w; + register int wid; + register int hei; + int i; + + /* + * Calculate preferred width + */ + + wid = 2 * (tw->table.tab_margin + tw->container.shadow_thickness); + wid += COLUMNS(tw) ? (COLUMNS(tw) - 1) * tw->table.col_margin : 0; + wid += 2 * COLUMNS(tw) * tw->table.label_shadow_thickness; + + for(i = 0 ; i < COLUMNS(tw); i++) + wid += (Dimension)COLUMN_WIDTH(tw,i); + + /* + * Calculate preferred height + */ + + hei = 2 * (tw->table.tab_margin + tw->container.shadow_thickness); + hei += ROWS(tw) ? (ROWS(tw) - 1) * tw->table.row_margin : 0; + hei += ROWS(tw) * tw->table.row_height; + hei += 2 * ROWS(tw) * tw->table.label_shadow_thickness; + + tw->table.prefer_width = wid; + tw->table.prefer_height = hei; + + if (width) *width = wid; + if (height) *height = hei; + +} + +static Position GetX(tw,j) + register XawTableWidget tw; + int j; +{ + register TablePart* table = (TablePart*)&tw->table; + register Position x; + + x = j * (table->col_margin + 2 * table->label_shadow_thickness) + + (table->tab_margin + tw->container.shadow_thickness); + + for(; j > 0 ; j--) + { + register int tmp = j - 1; + x += (Position)COLUMN_WIDTH(tw, tmp); + } + return x; +} + +static Position GetY(tw,i) + XawTableWidget tw; + int i; +{ + return(i * (tw->table.row_margin + tw->table.row_height + + 2 * tw->table.label_shadow_thickness) + + (tw->table.tab_margin + tw->container.shadow_thickness)); +} + + +/* + * Calculate width and height of displayed text in pixels + */ + +static void SetLabelHeight(tw) + XawTableWidget tw; +{ + register XFontStruct *fs = tw->table.font; + int row_height = tw->table.row_height; + + if (tw->table.row_height < 1) + tw->table.row_height = (fs->max_bounds.ascent + + fs->max_bounds.descent + + 2 * tw->table.internal_height); + if (row_height != tw->table.row_height) + { + XawTableCallbackStruct callback_str; + callback_str.reason = XawTABLE_CHANGED_ROW_HEIGHT; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK((Widget)tw, XtNchangedRowHeight, callback_str); + } +} + +static void SetLiteralWidth(tw) + XawTableWidget tw; +{ + if (tw->table.encoding) + tw->table.literal_width = XTextWidth16(tw->table.font, (TXT16*)"mmm", 3); + else + tw->table.literal_width = XTextWidth(tw->table.font, "mmm", 3); + + tw->table.literal_width /= 3; +} + + +static void SetLabelWidth(tw,i,j) + XawTableWidget tw; + int i,j; +{ + register XFontStruct *fs = tw->table.font; + XawTableCell cell; + + cell = (XawTableCell)get_cell(STUFF(tw),i,j); + + if (CELL(label) == NULL) { + CELL(label_len) = 0; + CELL(label_width) = 0; + } else { + CELL(label_len) = strlen(CELL(label)); + if (tw->table.encoding) + CELL(label_width) = + XTextWidth16(fs, (TXT16*)CELL(label), (int) CELL(label_len)/2); + else + CELL(label_width) = + XTextWidth(fs, CELL(label), (int) CELL(label_len)); + } +} + + +static void CreateTableCellGC(w) + Widget w; +{ + Display *dpy = XtDisplay(w); + Drawable d = XtWindow(w); + XawTableWidget tw = (XawTableWidget)w; + + tw->table.normal = XCreateGC(dpy, d, (XtGCMask)0, (XGCValues*)NULL); + tw->table.reverse = XCreateGC(dpy, d, (XtGCMask)0, (XGCValues*)NULL); + + MultipleChangeGC(w, + (Pixel*)&tw->table.foreground, + (Pixel*)&tw->core.background_pixel, + (Font*)&tw->table.font->fid, + (GC*)&tw->table.normal, + (GC*)&tw->table.reverse); + +} + +static void DrawColumns(tw, b_column, e_column) + XawTableWidget tw; + int b_column, e_column; +{ + int j,y; + + y = (int)GetY(tw,0); + for(j = MAX(b_column,0); j <= MIN(e_column, COLUMNS(tw) - 2); j++) + { + XFillRectangle(XtDisplay((Widget)tw), + XtWindow((Widget)tw), + tw->table.column_gc, + (int) (GetX(tw,j+1) - tw->table.col_margin), + y, + (unsigned int) tw->table.col_margin, + (unsigned int)(tw->table.prefer_height-(2*y))); + + } +} + +static void DrawRows(tw, b_row, e_row) + XawTableWidget tw; + int b_row, e_row; +{ + int i,x; + + x = (int)GetX(tw,0); + for(i = MAX(b_row, 0); i <= MIN(e_row, ROWS(tw) - 2); i++) + { + XFillRectangle(XtDisplay((Widget)tw), + XtWindow((Widget)tw), + tw->table.row_gc, + x, + (int) (GetY(tw,i+1) - tw->table.row_margin), + (unsigned int) (tw->table.prefer_width-(2*x)), + (unsigned int) tw->table.row_margin); + + } +} + +static void DrawCage(tw, b_row, e_row, b_column, e_column) + XawTableWidget tw; + int b_row, e_row, b_column, e_column; +{ + int i,j; + Display* dpy = XtDisplay((Widget)tw); + Window win = XtWindow((Widget)tw); + + if (tw->table.row_oriented) + { + if (tw->table.col_margin > (Dimension)0) + { + DrawRows(tw, b_row - 1, e_row); + + for(i = b_row; i <= MIN(e_row,ROWS(tw) - 1); i++) + { + int y = (int) GetY(tw,i); + + for(j = MAX(b_column - 1, 0); j <= MIN(e_column, COLUMNS(tw) - 2); j++) + { + XFillRectangle (dpy, + win, + tw->table.column_gc, + (int) (GetX(tw, j + 1) - tw->table.col_margin), + y, + (unsigned int) tw->table.col_margin, + (unsigned int) (tw->table.row_height + + 2 * tw->table.label_shadow_thickness)); + + } + } + } + } + else + { + if (tw->table.row_margin > (Dimension)0) + { + DrawColumns(tw, b_column - 1, e_column); + + for(j = b_column; j <= MIN(e_column, COLUMNS(tw) - 1); j++) + { + int x = (int) GetX(tw,j); + + for(i = MAX(b_row - 1, 0); i <= MIN(e_row, ROWS(tw) - 2); i++) + { + XFillRectangle(XtDisplay((Widget)tw), + XtWindow((Widget)tw), + tw->table.row_gc, + x, + (int) (GetY(tw,i+1) - tw->table.row_margin), + (unsigned int) (COLUMN_WIDTH(tw,j) + + 2 * tw->table.label_shadow_thickness), + (unsigned int) tw->table.row_margin); + } + } + } + } +} + +static void Reposition(tw, cell, i, j) + register XawTableWidget tw; + XawTableCell cell; + int i,j; +{ + Position newPos; + XtJustify justify; + + if (cell == NULL) + cell = (XawTableCell)get_cell(STUFF(tw),i,j); + + if (COLUMN_DATA(tw)[j].flag & _CL_justify) + justify = COLUMN_DATA(tw)[j].justify; + else + justify = tw->table.justify; + + switch (justify) { + case XtJustifyLeft : newPos = tw->table.internal_width; + break; + case XtJustifyRight : newPos = (COLUMN_WIDTH(tw,j) - + CELL(label_width) - + tw->table.internal_width); + break; + case XtJustifyCenter : + default : newPos = (COLUMN_WIDTH(tw,j) - + CELL(label_width)) / 2; + break; + } + + CELL(label_x) = MAX(newPos, tw->table.internal_width); +} + +/* ARGSUSED */ +static Boolean DeleteCell(p, i, j, call_data, client_data) + XtPointer p; + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableCell cell = (XawTableCell)call_data; + + + if (CELL(label) != (char*)NULL) + XtFree(CELL(label)); + + if (CELL(special_colour)) + { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + return False; +} + + +static void UpdateTable(tw) + XawTableWidget tw; +{ + Dimension width; + Dimension height; + + if (tw->table.no_refigure > 0) + return; + + CalculatePreferredSize((Widget)tw, &width, &height); + + tw->table.was_resized = False; + + (void)XtMakeResizeRequest((Widget)tw, width, height, + (Dimension*)NULL, (Dimension*)NULL); + if (tw->table.was_resized == False) + { + tw->table.was_resized = True; + (*tableClassRec.core_class.resize) ((Widget)tw); + } +} + + +static int SetTableSize(w, rows, columns) + Widget w; + int rows; + int columns; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + int i; + + if (rows < 0 || columns < 0) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetTableSize", "SetTableSize","XawToolkitError", + "rows or columns for a new table in TableWidget '%s' less then zero", + subs, &num_subs); + return REJECT; + } + + if (STUFF(tw)) + { + callback_str.reason = XawTABLE_ALLOW_DELETE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = STUFF(tw); + callback_str.new_cell = STUFF(tw); + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowDeleteTable, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + callback_str.reason = XawTABLE_DELETE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = STUFF(tw); + callback_str.new_cell = STUFF(tw); + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK (w, XtNdeleteTable, callback_str); + + WalkForCells (w, (XawTableProc)DeleteCell, + 0, ROWS(tw)-1, 0, COLUMNS(tw)-1); + + delete_table ((XtPointer)STUFF(tw)); + + STUFF(tw) = (XawTableCell)NULL; + ROWS(tw) = 0; + COLUMNS(tw) = 0; + } + + if (rows == 0 || columns == 0) + return ACCEPT; + + STUFF(tw) = (XawTableCell) + create_table(rows, columns, sizeof(XawTableCellRec)); + + if (STUFF(tw) == (XawTableCell)NULL) + return ACCEPT; + + ROWS(tw) = rows; + COLUMNS(tw) = columns; + + WalkForCells((Widget)tw, (XawTableProc)InitCell, 0, rows-1, 0, columns-1); + + if (COLUMNS(tw)) { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)COLUMN_DATA(tw), + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + for (i = 0; i < COLUMNS(tw); i++) + COLUMN_DATA(tw)[i].flag = 0; + } + else { + XtFree((XtPointer)tw->table.column_data); + tw->table.column_data = NULL; + } + + callback_str.reason = XawTABLE_CREATE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNcreateTable, callback_str); + + return ACCEPT; +} + + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request; + Widget new; + ArgList args; + Cardinal *num_args; +{ + register XawTableWidget tw = (XawTableWidget) new; + Dimension width; + Dimension height; + int i; + + tw->table.no_refigure = 0; + tw->table.no_redraw = 0; + tw->table.num_selections = 0; + tw->table.cell_own = (XawTableCell)NULL; + STUFF(tw) = (XawTableCell)NULL; + tw->table.normal = (GC)NULL; + tw->table.reverse = (GC)NULL; + + COLUMNS(tw) = MAX (COLUMNS(tw), 0); + ROWS(tw) = MAX (ROWS(tw), 0); + + if (COLUMNS(tw)) { + tw->table.column_data = (XawTableColumn) + CALLOC (COLUMNS(tw), XawTableColumnRec); + for (i = 0; i < COLUMNS(tw); i++) + COLUMN_DATA(tw)[i].flag = 0; + } + else + tw->table.column_data = NULL; + + SetLiteralWidth(tw); + + EDIT(tw) = XtVaCreateWidget + ("edit", asciiTextWidgetClass, new, + XtNeditType, XawtextEdit, + XtNforeground, tw->table.edit_fore, + XtNbackground, tw->table.edit_back, + XtNborderWidth, (XtArgVal)0, + XtNleftMargin, 2, + XtNrightMargin, 2, + XtNtopMargin, 0, /* to be fixed in future */ + XtNbottomMargin, 0, /* to be fixed in future */ + XtNuseStringInPlace, False, + XtNfont, tw->table.font, + XtNuserData, (XtArgVal)new, + NULL); + + XtOverrideTranslations(EDIT(tw), XtParseTranslationTable(edit_translations)); + + GetGCByForeground (new, (GC*)&tw->table.row_gc, tw->table.row_fore); + GetGCByForeground (new, (GC*)&tw->table.column_gc, tw->table.column_fore); + + if ((COLUMNS(tw) > 0) && (ROWS(tw) > 0)) + { + if (REJECT == SetTableSize(new, ROWS(tw), COLUMNS(tw))) + { + ROWS(tw) = 0; + COLUMNS(tw) = 0; + STUFF(tw) = (XawTableCell)NULL; + } + } + + if ((tw->table.mask_number < 0) + || (tw->table.mask_number >= XtNumber(MaskStaticArray))) + tw->table.mask_number = 7; + + tw->table.mask_hash_table = MaskStaticArray[tw->table.mask_number]; + + tw->table.normal_hash_table = + CALLOC(tw->table.mask_hash_table, NormalReverseGC); + + tw->table.shadow_hash_table = CALLOC(tw->table.mask_hash_table, ShadowGC); + + for(i = 0; i < tw->table.mask_hash_table; i++) + { + GET_NORMAL(tw,i)->used = 0; + GET_NORMAL(tw,i)->normal = (GC)NULL; + GET_NORMAL(tw,i)->reverse = (GC)NULL; + GET_SHADOW(tw,i)->used = 0; + GET_SHADOW(tw,i)->top = (GC)NULL; + GET_SHADOW(tw,i)->bottom = (GC)NULL; + } + + SetLabelHeight(tw); + + CalculatePreferredSize(new, &width, &height); + + if (new->core.width == 0) new->core.width = width; + if (new->core.height == 0) new->core.height = height; +} + + +static void Realize(w, valueMask, attributes) + Widget w; + XtValueMask *valueMask; + XSetWindowAttributes *attributes; +{ + XawTableWidget tw = (XawTableWidget) w; + ShadowGC *shadow; + + (*SuperClass->core_class.realize) (w, valueMask, attributes); + + CreateTableCellGC(w); + + shadow = GetShadowGC(w, tw->table.edit_back); + tw->table.edit_top = shadow->top; + tw->table.edit_bottom = shadow->bottom; + + shadow = GetShadowGC(w, tw->core.background_pixel); + tw->table.top = shadow->top; + tw->table.bottom = shadow->bottom; + + XtRealizeWidget(EDIT(w)); +} + +/* ARGSUSED */ +static Boolean MatchLabel(w, i, j, call_data, client_data) + Widget w; /* unused */ + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; +{ + XawTableCell cell = (XawTableCell)call_data; + XrmQuark* templ = (XrmQuark*)client_data; + + return ((*templ) == XrmStringToQuark (GET_CELL_LABEL)); +} + +/* ARGSUSED */ +static Boolean InitCell(p, i, j, call_data, client_data) + XtPointer p; /* unused */ + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + XawTableCell cell = (XawTableCell)call_data; + + CELL(label) = DummyString(); + CELL(label_len) = 0; + CELL(label_width) = 0; + CELL(highlight) = False; + CELL(special_colour) = False; + CELL(normal) = (GC)NULL; + CELL(reverse) = (GC)NULL; + CELL(top) = (GC)NULL; + CELL(bottom) = (GC)NULL; + + return False; +} + +/* + * + * Shadow drawing around cell + * + */ +static void PaintShadow(w, i, j, x, y, cell) + Widget w; + int i; + int j; + Position x; + Position y; + XawTableCell cell; +{ + XawTableWidget tw = (XawTableWidget) w; + + if (tw->table.label_shadow_thickness != (Dimension)0) { + GC top,bottom; + + if (IsEditInRowColumn(tw,i,j)) + { + top = tw->table.edit_bottom; + bottom = tw->table.edit_top; + } + else if (CELL(special_colour)) + { + top = CELL(top); + bottom = CELL(bottom); + }else { + top = tw->table.top; + bottom = tw->table.bottom; + } + + XawDrawFrame(w, + x, + y, + (Dimension)(COLUMN_WIDTH(tw,j) + + 2 * tw->table.label_shadow_thickness), + (Dimension)(tw->table.row_height + + 2 * tw->table.label_shadow_thickness), + XawRAISED, + tw->table.label_shadow_thickness, + top, + bottom); + } + +} + +/* ARGSUSED */ +static void PaintLabel(w, i, j, x, y, cell) + Widget w; + int i; + int j; + Position x,y; + XawTableCell cell; +{ + XawTableWidget tw = (XawTableWidget) w; + XRectangle rectangle[1]; + Position label_x; + Position label_y; + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,j); + unsigned int height = (unsigned int) tw->table.row_height; + + x += tw->table.label_shadow_thickness; + y += tw->table.label_shadow_thickness; + + if (CELL(special_colour) || CELL(highlight)) + { + GC gc; + + if (CELL(special_colour)) + gc = CELL(highlight) ? CELL(normal) : CELL(reverse); + else + gc = tw->table.normal ; + + /* Fill background for cell with a special colour */ + XFillRectangle(XtDisplay(w), XtWindow(w), gc, + (int)x, (int)y, width, height); + } + else + { + XClearArea (XtDisplay(w), XtWindow(w), (int)x, (int)y, + width, height, FALSE); + } + + if (CELL(label_len) > 0) + { + GC gc; + register XFontStruct *fs = tw->table.font; + + if (CELL(special_colour)) + gc = CELL(highlight) ? CELL(reverse) : CELL(normal); + else + gc = CELL(highlight) ? tw->table.reverse : tw->table.normal; + + /* Set clip rectangle for label in cell */ + rectangle[0].x = (short)x; + rectangle[0].y = (short)y; + rectangle[0].width = (unsigned short)COLUMN_WIDTH(tw,j); + rectangle[0].height = (unsigned short)tw->table.row_height; + + XSetClipRectangles(XtDisplay(w), gc, 0, 0, rectangle, 1, YSorted); + + /* Drawing label */ + label_x = x + CELL(label_x); + label_y = y + + (tw->table.row_height-(fs->max_bounds.ascent+fs->max_bounds.descent))/2 + /* tw->table.internal_height */ + + fs->max_bounds.ascent; + + if (tw->table.encoding) + XDrawString16(XtDisplay(w), XtWindow(w), gc, + label_x, label_y, (TXT16*)CELL(label), + (int)CELL(label_len)/2); + else + XDrawString(XtDisplay(w), XtWindow(w), gc, + label_x, label_y, CELL(label), (int)CELL(label_len)); + + XSetClipMask(XtDisplay(w), gc, (Pixmap)None); + + } +} + +/* ARGSUSED */ +static Boolean PaintCell(p, i, j, call_data, client_data) + XtPointer p; + int i; + int j; + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableWidget tw = (XawTableWidget) w; + XawTableCell cell = (XawTableCell) call_data; + Position x; + Position y; + + x = GetX(tw,j); + y = GetY(tw,i); + + PaintLabel (w, i, j, x, y, cell); + PaintShadow (w, i, j, x, y, cell); + + XFlush(XtDisplay(w)); + return False; +} + +static void WhatCellsToBeDraw(tw, rect, b_row, e_row, b_column , e_column) + XawTableWidget tw; + XRectangle rect; + register int *b_row, *e_row, *b_column , *e_column; +{ + Position x1 = (Position)rect.x, + y1 = (Position)rect.y, + x2 = (Position)(rect.x + rect.width - 1), + y2 = (Position)(rect.y + rect.height - 1); + + for ((*b_column) = 0; (*b_column) < COLUMNS(tw); (*b_column)++) + { + if (x1 < (GetX(tw,(*b_column) + 1) - tw->table.col_margin)) + break; + } + + for ((*e_column) = (*b_column); (*e_column) < COLUMNS(tw); (*e_column)++) + { + if (x2 < (GetX(tw,(*e_column) + 1) - tw->table.col_margin)) + break; + } + + + for ((*b_row) = 0; (*b_row) < ROWS(tw); (*b_row)++) + { + if (y1 < (GetY(tw,(*b_row) + 1) - tw->table.row_margin)) + break; + } + + for ((*e_row) = (*b_row); (*e_row) < ROWS(tw); (*e_row)++) + { + if (y2 < (GetY(tw,(*e_row) + 1) - tw->table.row_margin)) + break; + } +} + + +static void Redisplay(w, event, region) + Widget w; + XEvent *event; + Region region; +{ + XawTableWidget tw = (XawTableWidget) w; + XRectangle rect; + int b_row, e_row, b_column , e_column ; + + if (!XtIsRealized(w) || !w->core.visible || tw->table.no_redraw) + return; + + if (tw->container.shadow_thickness > 0) + (*SuperClass->core_class.expose) (w, event, region); + + if (region != NULL) + { + XClipBox(region, (XRectangle*)&rect); + + WhatCellsToBeDraw(tw, rect, &b_row, &e_row, &b_column , &e_column); + } + else if (event != (XEvent*)NULL) + { + rect.x = (short) event->xexpose.x; + rect.y = (short) event->xexpose.y; + rect.width = (unsigned short) event->xexpose.width; + rect.height = (unsigned short) event->xexpose.height; + + WhatCellsToBeDraw(tw, rect, &b_row, &e_row, &b_column , &e_column); + } + else if (tw->table.v_scroll || tw->table.h_scroll) + { + rect.x = (short) 0; + rect.y = (short) 0; + rect.width = (unsigned short) tw->core.width; + rect.height = (unsigned short) tw->core.height; + + if (tw->table.v_scroll && XtIsManaged(tw->table.v_scroll)) + { + float top; + float shown; + + XtVaGetValues (tw->table.v_scroll, + XtNtopOfThumb, &top, + XtNshown, &shown, + NULL); + + rect.y = (short) ((float)(tw->core.height) * top); + rect.height = (unsigned short) ((float)(tw->core.height) * (top+shown)); + } + + if (tw->table.h_scroll && XtIsManaged(tw->table.h_scroll)) + { + float top; + float shown; + + XtVaGetValues (tw->table.h_scroll, + XtNtopOfThumb, &top, + XtNshown, &shown, + NULL); + + rect.x = (short) ((float)(tw->core.width) * top); + rect.width = (unsigned short) ((float)(tw->core.width) * (top+shown)); + } + + + WhatCellsToBeDraw(tw, rect, &b_row, &e_row, &b_column , &e_column); + } + else + { + b_row = 0; + e_row = ROWS(tw) - 1; + b_column = 0; + e_column = COLUMNS(tw) - 1; + } + + DrawCage(tw, b_row, e_row, b_column, e_column); + + WalkForCells(w, (XawTableProc)PaintCell, b_row, e_row, b_column, e_column); + + XFlush(XtDisplay(w)); +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current; + Widget request; /* unused */ + Widget new; + ArgList args; /* unused */ + Cardinal *num_args; /* unused */ +{ + XawTableWidget curtw = (XawTableWidget) current; + XawTableWidget newtw = (XawTableWidget) new; + register int i; + int j; + Boolean resize = False; + Boolean redisplay = False; + +#define NE(field) (curtw->table.field != newtw->table.field) + + if (NE(mask_number)) + XtWarning("Resource XtNmaskNumber in Table widget can not changed"); + + newtw->table.mask_number = curtw->table.mask_number; + newtw->table.literal = curtw->table.literal; + + if (NE(font->fid)) + XtVaSetValues (EDIT(newtw), XtNfont, curtw->table.font, NULL); + + if (NE(foreground) || + NE(row_fore) || + NE(column_fore) || + NE(row_oriented) || + NE(font->fid) || + NE(justify) || + NE(tab_margin) || + NE(row_margin) || + NE(col_margin) || + NE(internal_width) || + NE(internal_height) || + NE(label_shadow_thickness) || + NE(encoding)) + redisplay = True; + + if (NE(font->fid) || + NE(columns) || + NE(rows) || + NE(tab_margin) || + NE(row_margin) || + NE(col_margin) || + NE(internal_width) || + NE(internal_height) || + NE(row_height) || + NE(label_shadow_thickness)) + resize = True; + + if (NE(columns) || NE(rows)) + if (REJECT == SetTableSize(new, ROWS(newtw), COLUMNS(newtw))) { + newtw->table.columns = curtw->table.columns; + newtw->table.rows = curtw->table.rows; + } + + if(NE(row_height)) + { + XawTableCallbackStruct callback_str; + callback_str.reason = XawTABLE_CHANGED_ROW_HEIGHT; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(new, XtNchangedRowHeight, callback_str); + } + + if(NE(font->fid)) + { + for(i = 0; i < ROWS(newtw); i++) + for(j = 0; j < COLUMNS(newtw); j++) + SetLabelWidth(newtw, i, j); + + SetLabelHeight(newtw); + } + + if(NE(font->fid) || NE(encoding)) + { + SetLiteralWidth(newtw); + + for(i = 0; i < ROWS(newtw); i++) + for(j = 0; j < COLUMNS(newtw); j++) + Reposition(newtw, NULL, i, j); + } + else if(NE(internal_width) || NE(label_shadow_thickness)) { + for(i = 0; i < ROWS(newtw); i++) + for(j = 0; j < COLUMNS(newtw); j++) + Reposition(newtw, NULL, i, j); + } + + + if (NE(internal_height) || NE(label_shadow_thickness)) + { + SetLabelHeight(newtw); + } + + if (resize) + CalculatePreferredSize(new, &newtw->core.width, &newtw->core.height); + + if (NE(foreground) || NE(font->fid) || + curtw->core.background_pixel != newtw->core.background_pixel) + { + MultipleChangeGC(new, + (Pixel*)&newtw->table.foreground, + (Pixel*)&newtw->core.background_pixel, + (Font*)&newtw->table.font->fid, + (GC*)&newtw->table.normal, + (GC*)&newtw->table.reverse); + + } + + if (NE(row_fore)) + { + XtReleaseGC(new, curtw->table.row_gc); + GetGCByForeground(new,(GC*)&newtw->table.row_gc, newtw->table.row_fore); + } + + if (NE(column_fore)) + { + XtReleaseGC(new, curtw->table.column_gc); + GetGCByForeground(new, &newtw->table.column_gc,newtw->table.column_fore); + } + + if (resize) + CalculatePreferredSize(new, &(new->core.width), &(new->core.height)); + + return redisplay; +} + + +static void Destroy(w) + Widget w; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) != (XawTableCell)NULL) + { + callback_str.reason = XawTABLE_DELETE_TABLE; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNdeleteTable, callback_str); + } + + if (tw->table.row_gc != (GC)NULL) { + XtReleaseGC(w, tw->table.row_gc); + tw->table.row_gc = (GC)NULL; + } + if (tw->table.column_gc != (GC)NULL) { + XtReleaseGC(w, tw->table.column_gc); + tw->table.column_gc = (GC)NULL; + } + if (tw->table.normal != (GC)NULL) { + XFreeGC(XtDisplay(w), tw->table.normal); + tw->table.normal = (GC)NULL; + } + + if (tw->table.reverse != (GC)NULL) { + XFreeGC(XtDisplay(w), tw->table.reverse); + tw->table.reverse = (GC)NULL; + } + + WalkForCells(w, (XawTableProc)DeleteCell, 0, ROWS(tw)-1, 0, COLUMNS(tw)-1); + + XtFree((XtPointer)tw->table.normal_hash_table); + XtFree((XtPointer)tw->table.shadow_hash_table); + + delete_table(tw->table.table_stuff); + STUFF(tw) = (XawTableCell)NULL; + + if (tw->table.column_data != NULL) + XtFree((XtPointer)tw->table.column_data); + + if (EDIT(w) != WNULL && !EDIT(w)->core.being_destroyed) + XtDestroyWidget(EDIT(w)); +} + + +static void Resize(w) + Widget w; +{ + XawTableWidget tw = (XawTableWidget)w; + + /* If widget is realized, just redisplay it w/o clearing */ + if (XtIsRealized(w) && tw->table.no_redraw == 0) + { + /* XClearWindow(XtDisplay(w), XtWindow(w)); */ + (*tableClassRec.core_class.expose) (w, (XEvent*)NULL,(Region)NULL); + } + + tw->table.was_resized = True; +} + + +static XtGeometryResult QueryGeometry(w, intended, preferred) + Widget w; + XtWidgetGeometry *intended, *preferred; +{ + preferred->request_mode = CWWidth | CWHeight; + + CalculatePreferredSize(w, &preferred->width, &preferred->height); + +#define Set(bit) (intended->request_mode & bit) + + if (Set(CWWidth) && intended->width == preferred->width && + Set(CWHeight) && intended->height == preferred->height) { + return XtGeometryYes; + } + + if (preferred->width == w->core.width && + preferred->height == w->core.height) { + return XtGeometryNo; + } + + return XtGeometryAlmost; + +#undef Set +} + +/* ARGSUSED */ +static XtGeometryResult GeometryManager(w, desired, allowed) + Widget w; + XtWidgetGeometry *desired; + XtWidgetGeometry *allowed; +{ + return XtGeometryYes; +} + + + +static void ExtractPosition(event, x, y , t) + XEvent *event; + Position *x, *y; /* RETURN */ + Time *t; /* RETURN */ +{ + if (event == NULL) + return; + + switch(event->type) { + case MotionNotify: + *x = event->xmotion.x; + *y = event->xmotion.y; + *t = event->xmotion.time; + break; + case ButtonPress: + case ButtonRelease: + *x = event->xbutton.x; + *y = event->xbutton.y; + *t = event->xbutton.time; + break; + case KeyPress: + case KeyRelease: + *x = event->xkey.x; + *y = event->xkey.y; + *t = event->xkey.time; + break; + case EnterNotify: + case LeaveNotify: + *x = event->xcrossing.x; + *y = event->xcrossing.y; + *t = event->xcrossing.time; + break; + default: + *x = 0; + *y = 0; + *t = XtLastTimestampProcessed(event->xany.display); + } +} + +/* ARGSUSED */ +static Boolean ExtractCell(tw, px, py, row, column) + XawTableWidget tw; + Position px,py; + int *row, *column; /* RETURN */ +{ + Position x; + Position y; +#define SH (tw->table.label_shadow_thickness) + for(*row = 0; *row < ROWS(tw); (*row)++) { + for(*column = 0; *column < COLUMNS(tw); (*column)++) + if ((x=GetX(tw,*column)+SH) <= px) + if ((y=GetY(tw,*row)+SH) <= py) + if ((x+COLUMN_WIDTH(tw,*column)) >= px) + if ((y+tw->table.row_height) >= py) + return False; + } +#undef SH + + return True; +} + + +/* ARGSUSED */ +static void WalkForCells(w, proc, b_r, e_r, b_c, e_c) + Widget w; + XawTableProc proc; + int b_r, e_r, b_c, e_c; +{ + XawTableWidget tw = (XawTableWidget)w; + int i,j; + + (void)go_table((XtPointer)w, proc, STUFF(tw), + b_r, e_r, b_c, e_c, + XawTABLE_RIGHT_DOWN, + &i, &j, (XtPointer)NULL); +} + +static char* DummyString() +{ + return XtNewString(""); +} + +static char* CopyOnlyPrintable(raw) + char* raw; +{ + char* clear; + char *s,*h; + int lenght; + + for(s = raw, lenght = 0; (*s) != '\0';) + { + if (isprint(*s++)) + lenght++; + } + + clear = CALLOC(++lenght, char); + + for(s = raw, h = clear; (*s) != '\0';) + { + if (isprint(*s)) + (*h++) = (*s++); + } + + (*h) = '\0'; + + return clear; +} + +#ifdef EBUG_XRAW_MALLOC +/* ARGSUSED */ +static Boolean CheckLabel(p, i, j, call_data, client_data) + XtPointer p; + int i; + int j; + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableWidget tw = (XawTableWidget) p; + XawTableCell cell = (XawTableCell)call_data; + char* label = CELL(label); + + for (label = CELL(label); *label != '\0'; label++) + if (!isprint(*label)) + { + char message[80]; + char *p = NULL; + sprintf(message, "wrong label '%s' in cell (%4d,%4d) in Table widget '%s'", + CELL(label), i, j, w->core.name); + XtWarning(message); + *p = '\0'; + break; + } + + return False; +} +#endif + +#ifdef EBUG_XRAW_MALLOC +static void CheckAllLabels(tw) + XawTableWidget tw; +{ + WalkForCells((Widget)tw, (XawTableProc)CheckLabel, + 0, ROWS(tw)-1, 0, COLUMNS(tw)-1); +} +#endif + +static void MoveEditCell (tw, row, column) + XawTableWidget tw; + int row; + int column; +{ + Position x,y; + + x = GetX(tw,column); + y = GetY(tw,row); + + XtConfigureWidget(EDIT(tw), + (Position)(x + tw->table.label_shadow_thickness), + (Position)(y + tw->table.label_shadow_thickness), + (Dimension) COLUMN_WIDTH(tw, column), + (Dimension) tw->table.row_height, + (Dimension)0); + XawDrawFrame((Widget)tw, + x, + y, + (Dimension)(COLUMN_WIDTH(tw, column) + + 2 * tw->table.label_shadow_thickness), + (Dimension)(tw->table.row_height + + 2 * tw->table.label_shadow_thickness), + XawSUNKEN, + tw->table.label_shadow_thickness, + tw->table.edit_top, + tw->table.edit_bottom); + +} + +/* ARGSUSED */ +static Boolean CompareCells(p, i, j, call_data, client_data) + XtPointer p; + int i; /* unused */ + int j; /* unused */ + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + XawTableCell cell = (XawTableCell)call_data; + XawTableCell test_cell = (XawTableCell)client_data; + + return(cell == test_cell); +} + +/****************************************************************** + * + * CONVENIENCE FUNCTIONS + * + ******************************************************************/ + + +void +#ifdef Xraw_NEED_PROTO +XawTableGetSize (Widget w, + int *rows, + int *columns) +#else +XawTableGetSize (w, rows, columns) + Widget w; + int *rows; + int *columns; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + *rows = ROWS(tw); + *columns = COLUMNS(tw); +} + +void +#ifdef Xraw_NEED_PROTO +XawTableDoLayout (Widget w, + Boolean do_layout) +#else +XawTableDoLayout (w, do_layout) + Widget w; + Boolean do_layout; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (do_layout) + tw->table.no_redraw--; + else + tw->table.no_redraw++; + + tw->table.no_redraw = MAX (tw->table.no_redraw, 0); + + if (tw->table.no_redraw == 0) + Redisplay (w, (XEvent *)NULL, (Region)NULL); +} + +int +#ifdef Xraw_NEED_PROTO +XawTableSetNewSize (Widget w, + int rows, + int columns) +#else +XawTableSetNewSize (w, rows, columns) + Widget w; + int rows; + int columns; +#endif +{ + if (REJECT == SetTableSize(w, rows, columns)) + return REJECT; + + UpdateTable((XawTableWidget)w); + return ACCEPT; +} + +char * +#ifdef Xraw_NEED_PROTO +XawTableGetLabelByCell (XawTableCell cell) +#else +XawTableGetLabelByCell (cell) + XawTableCell cell; +#endif +{ + return GET_CELL_LABEL; +} + +void +#ifdef Xraw_NEED_PROTO +XawTableGetEditPosition (Widget w, int *row, int *column) +#else +XawTableGetEditPosition(w, row, column) + Widget w; + int *row; + int *column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + *row = tw->table.edit_row; + *column = tw->table.edit_column; +} + +Boolean +#ifdef Xraw_NEED_PROTO +XawTableWalk ( + Widget w, + XawTableProc proc, + int b_row, + int e_row, + int b_column, + int e_column, + int direction, + int *i, /* returned */ + int *j, /* returned */ + XtPointer client_data) +#else +XawTableWalk(w, proc, b_row, e_row, b_column, e_column, + direction, i, j, client_data) + Widget w; + XawTableProc proc; + int b_row, e_row, b_column, e_column; + int direction; + int *i; /* returned */ + int *j; /* returned */ + XtPointer client_data; +#endif +{ + return go_table((XtPointer)w, proc, STUFF(w), + b_row, e_row, b_column, e_column, + direction, + i, j, client_data); +} + +Boolean +#ifdef Xraw_NEED_PROTO +XawTableSearchLabel (Widget w, char *name, int *row, int *column) +#else +XawTableSearchLabel (w, name, row, column) + Widget w; + char *name; + int *row, *column; +#endif +{ + int row_start = *row; + int column_start = *column; + XrmQuark templ = XrmStringToQuark (name); + + if (XawTableWalk(w, (XawTableProc)MatchLabel, + row_start, row_start, column_start, COLUMNS(w)-1, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + if (XawTableWalk(w, (XawTableProc)MatchLabel, + row_start+1, ROWS(w)-1, 0, COLUMNS(w)-1, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + if (XawTableWalk(w, (XawTableProc)MatchLabel, + 0, row_start-1, 0, COLUMNS(w)-1, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + if (XawTableWalk(w, (XawTableProc)MatchLabel, + row_start, row_start, 0, column_start, + XawTABLE_RIGHT_DOWN, + row, column, (XtPointer)&templ)) { + return (True); + } + return (False); + +} + +/************************************************************** + * + * + * + * ROW routines + * + * + * + **************************************************************/ + +int +#ifdef Xraw_NEED_PROTO +XawTablePrependRow (Widget w) +#else +XawTablePrependRow(w) + Widget w; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "prependRow", "XawTablePrependRow","XawToolkitError", + "An attempt to add a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + + /* request for allowance */ + + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ALLOW_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + row_insert_before(STUFF(tw), sizeof(XawTableCellRec)); + ROWS(tw)++; + + STUFF(tw) = (XawTableCell)get_table(STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, 0, 0, 0, COLUMNS(tw)-1); + + if (XawTableIsEditManaged(w)) + MoveEditCell (tw, ++(tw->table.edit_row), tw->table.edit_column); + + UpdateTable(tw); + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddRow)) + { + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddRow, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableAppendRow (Widget w) +#else +XawTableAppendRow (w) + Widget w; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) + { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "appendRow", "XawTableAppendRow","XawToolkitError", + "An attempt to add a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), ROWS(tw)-1, 0); + + callback_str.reason = XawTABLE_ALLOW_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + row_insert_after(get_cell(STUFF(tw), ROWS(tw) - 1, 0), + sizeof(XawTableCellRec)); + + ROWS(tw)++; + + WalkForCells(w, (XawTableProc)InitCell, + ROWS(tw)-1, ROWS(tw)-1, 0, COLUMNS(tw)-1); + + UpdateTable(tw); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddRow)) + { + cell = (XawTableCell)get_cell(STUFF(tw), ROWS(tw)-1, 0); + + callback_str.reason = XawTABLE_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = ROWS(tw)-1; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddRow, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableInsertRow (Widget w, int row) +#else +XawTableInsertRow (w, row) + Widget w; + int row; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertRow", "XawTableInsertRow","XawToolkitError", + "An attempt to add a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (row != InRange(row, 0, ROWS(tw)-1)) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertRow", "XawTableInsertRow","XawToolkitError", + "Incorrect attempt to insert a row in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_ALLOW_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + row_insert_before(get_cell((XtPointer)STUFF(tw), row, 0), + sizeof(XawTableCellRec)); + + ROWS(tw)++; + + if (row == 0) + STUFF(tw) = (XawTableCell)get_table(STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, row, row, 0, COLUMNS(tw)-1); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XawTableIsEditManaged(w) && row <= tw->table.edit_row){ + tw->table.no_redraw++; + MoveEditCell (tw, ++(tw->table.edit_row), tw->table.edit_column); + tw->table.no_redraw--; + } + + UpdateTable(tw); + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddRow)) + { + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_ADD_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = row; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddRow, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableDeleteRow (Widget w, int row) +#else +XawTableDeleteRow (w, row) + Widget w; + int row; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteRow", "XawTableDeleteRow","XawToolkitError", + "An attempt to delete a row in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (row != InRange(row, 0, ROWS(tw)-1)) { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", ROWS(tw)-1); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteRow", "XawTableDeleteRow","XawToolkitError", + "Incorrect value of row (%s, max is %s) in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_ALLOW_DELETE_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowDeleteRow, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNdeleteRow)) + { + cell = (XawTableCell)get_cell(STUFF(tw), row, 0); + + callback_str.reason = XawTABLE_DELETE_ROW; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = row; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNdeleteRow, (XtPointer)&callback_str); + } + + /* if selections owner locates here, then disown selections */ + + if (tw->table.cell_own != (XawTableCell)NULL) + { + Boolean have_find; + int i, j; + + have_find = go_table((XtPointer)w, CompareCells, STUFF(tw), + row, row, 0, COLUMNS(tw)-1, + XawTABLE_RIGHT_DOWN, &i, &j, + (XtPointer)tw->table.cell_own); + if (have_find) { + for (; 0 < tw->table.num_selections;) + XtDisownSelection (w, + tw->table.selections[--(tw->table.num_selections)], + XtLastTimestampProcessed(XtDisplay(w))); + + tw->table.cell_own = (XawTableCell)NULL; + } + } + + if (row == 0) + STUFF(tw) = (XawTableCell)get_cell(STUFF(tw), 1, 0); + + if (--ROWS(tw) == 0) + STUFF(tw) = (XawTableCell)NULL; + + WalkForCells(w, (XawTableProc)DeleteCell, row, row, 0, COLUMNS(tw)-1); + + row_delete(cell); + + if (XawTableIsEditManaged(w)) + { + tw->table.no_redraw++; + if (row < tw->table.edit_row){ + MoveEditCell (tw, --(tw->table.edit_row), tw->table.edit_column); + } + else if (row == tw->table.edit_row){ + UNMANAGE_EDIT(tw); + tw->table.edit_row = InRange (tw->table.edit_row, 0, ROWS(tw)-1); + XawTableSetEdit (w, tw->table.edit_row, tw->table.edit_column); + } + tw->table.no_redraw--; + } + + UpdateTable(tw); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + return ACCEPT; +} + + + +/************************************************************** + * + * + * + * COLUMN routines + * + * + * + **************************************************************/ + +int +#ifdef Xraw_NEED_PROTO +XawTablePrependColumn (Widget w, int width) +#else +XawTablePrependColumn (w, width) + Widget w; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int j; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "prependColumn", "XawTablePrependColumn","XawToolkitError", + "An attempt to add a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ALLOW_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + column_insert_before(STUFF(tw), sizeof(XawTableCellRec)); + COLUMNS(tw)++; + + STUFF(tw) = (XawTableCell)get_table(STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, 0, ROWS(tw)-1, 0, 0); + + /* + * insert new item in `column_data' list + */ + + if (tw->table.column_data) + { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + else + { + tw->table.column_data = CALLOC(COLUMNS(tw), XawTableColumnRec); + for(j = 0; j < COLUMNS(tw); j++) + COLUMN_DATA(tw)[j].flag = 0; + } + + for(j = COLUMNS(tw)-2; j >= 0; j--) + (void)memcpy((char*)&(COLUMN_DATA(tw)[j+1]), (char*)&(COLUMN_DATA(tw)[j]), + sizeof(XawTableColumnRec)); + + COLUMN_DATA(tw)[0].flag |= _CL_width; + COLUMN_DATA(tw)[0].width = width; + + + if (XawTableIsEditManaged(w)) + MoveEditCell (tw, tw->table.edit_row, ++(tw->table.edit_column)); + + /* Let's look the table which we have made now */ + UpdateTable(tw); + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddColumn)) + { + cell = STUFF(tw); + + callback_str.reason = XawTABLE_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddColumn, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableAppendColumn (Widget w, int width) +#else +XawTableAppendColumn (w, width) + Widget w; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int j; + XawTableCell cell; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "addingColumn", "XawTableAppendColumn","XawToolkitError", + "An attempt to add a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), 0, COLUMNS(tw)-1); + + callback_str.reason = XawTABLE_ALLOW_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + column_insert_after(get_cell(STUFF(tw), 0, COLUMNS(tw)-1), + sizeof(XawTableCellRec)); + + COLUMNS(tw)++; + + WalkForCells(w, (XawTableProc)InitCell, + 0, ROWS(tw)-1, COLUMNS(tw)-1, COLUMNS(tw)-1); + + + + + /* + * insert new item in `column_data' list + */ + + if (tw->table.column_data) + { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + else + { + tw->table.column_data = CALLOC(COLUMNS(tw), XawTableColumnRec); + for(j = 0; j < COLUMNS(tw); j++) + COLUMN_DATA(tw)[j].flag = 0; + } + + COLUMN_DATA(tw)[COLUMNS(tw)-1].flag |= _CL_width; + COLUMN_DATA(tw)[COLUMNS(tw)-1].width = width; + + + /* Let's look the table which we have made now */ + UpdateTable(tw); + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddColumn)) + { + cell = (XawTableCell)get_cell(STUFF(tw), 0, COLUMNS(tw)-1); + + callback_str.reason = XawTABLE_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = COLUMNS(tw)-1; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddColumn, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableInsertColumn (Widget w, int column, int width) +#else +XawTableInsertColumn(w, column, width) + Widget w; + int column; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int j; + XawTableCallbackStruct callback_str; + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertColumn", "XawTableInsertColumn","XawToolkitError", + "An attempt to add a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (column != InRange(column, 0, COLUMNS(tw)-1)) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "insertColumn", "XawTableInsertColumn","XawToolkitError", + "It detected incorrect value of column in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_ALLOW_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowAddColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + column_insert_before (get_cell ((XtPointer)STUFF(tw), 0, column), + sizeof(XawTableCellRec)); + COLUMNS(tw)++; + + if (column == 0) + STUFF(tw) = (XawTableCell) get_table (STUFF(tw)); + + WalkForCells(w, (XawTableProc)InitCell, 0, ROWS(tw)-1, column, column); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + /* + * insert new item in `column_data' list + */ + + if (tw->table.column_data) + { + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + else + { + tw->table.column_data = CALLOC(COLUMNS(tw), XawTableColumnRec); + for(j = 0; j < COLUMNS(tw); j++) + COLUMN_DATA(tw)[j].flag = 0; + } + + for(j = COLUMNS(tw)-2; j >= column; j--) + (void)memcpy((char*)&(COLUMN_DATA(tw)[j+1]), (char*)&(COLUMN_DATA(tw)[j]), + sizeof(XawTableColumnRec)); + + COLUMN_DATA(tw)[column].flag |= _CL_width; + COLUMN_DATA(tw)[column].width = width; + + /* + * move the edit cell + */ + + if (XawTableIsEditManaged(w) && column <= tw->table.edit_column){ + tw->table.no_redraw++; + MoveEditCell (tw, tw->table.edit_row, ++(tw->table.edit_column)); + tw->table.no_redraw--; + } + + /* Let's look the table which we have made now */ + UpdateTable(tw); + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNaddColumn)) + { + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_ADD_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNaddColumn, (XtPointer)&callback_str); + } + + return ACCEPT; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableDeleteColumn (Widget w, int column) +#else +XawTableDeleteColumn(w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int j; + XawTableCallbackStruct callback_str; + + + if (STUFF(tw) == NULL) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteColumn", "XawTableDeleteColumn","XawToolkitError", + "An attempt to delete a column in empty table in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + if (column != InRange(column, 0, COLUMNS(tw)-1)) { + String subs[1]; + Cardinal num_subs = 1; + subs[0] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "deleteColumn", "XawTableDeleteColumn","XawToolkitError", + "It detected incorrect value of column in TableWidget '%s'", + subs, &num_subs); + return REJECT; + } + + /* request for allowance */ + + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_ALLOW_DELETE_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = 0; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNallowDeleteColumn, callback_str); + + if (callback_str.do_it != True) + return REJECT; + + + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + if (XtCallbackHasSome == XtHasCallbacks(w, XtNdeleteColumn)) + { + cell = (XawTableCell)get_cell(STUFF(tw), 0, column); + + callback_str.reason = XawTABLE_DELETE_COLUMN; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + XtCallCallbacks (w, XtNdeleteColumn, (XtPointer)&callback_str); + } + + /* if selections owner locates here, then disown selections */ + + if (tw->table.cell_own != (XawTableCell)NULL) + { + Boolean have_find; + int i, j; + + have_find = go_table((XtPointer)w, CompareCells, STUFF(tw), + 0, ROWS(tw)-1, column, column, + XawTABLE_RIGHT_DOWN, &i, &j, + (XtPointer)tw->table.cell_own); + if (have_find) { + for (; 0 < tw->table.num_selections;) + XtDisownSelection (w, + tw->table.selections[--(tw->table.num_selections)], + XtLastTimestampProcessed(XtDisplay(w))); + + tw->table.cell_own = (XawTableCell)NULL; + } + } + + if (column == 0) + STUFF(tw) = (XawTableCell)get_cell(STUFF(tw), 0, 1); + + if (--COLUMNS(tw) == 0) + STUFF(tw) = (XawTableCell)NULL; + + + WalkForCells(w, (XawTableProc)DeleteCell, 0, ROWS(tw)-1, column, column); + + column_delete(cell); + + /* + * shrink column data list + */ + + if (COLUMNS(tw) == 0) { + XtFree((XtPointer)tw->table.column_data); + tw->table.column_data = NULL; + } + else + { + for(j = column; j < COLUMNS(tw); j++) + (void)memcpy((char*)&(COLUMN_DATA(tw)[j]),(char*)&(COLUMN_DATA(tw)[j+1]), + sizeof(XawTableColumnRec)); + + tw->table.column_data = (XawTableColumn) + XtRealloc((XtPointer)tw->table.column_data, + (Cardinal)(COLUMNS(tw) * sizeof(XawTableColumnRec))); + } + + + /* + * shift the edit cell + */ + + if (XawTableIsEditManaged(w)) + { + tw->table.no_redraw++; + if (column < tw->table.edit_column){ + MoveEditCell (tw, tw->table.edit_row, --(tw->table.edit_column)); + } + else if (column == tw->table.edit_column){ + UNMANAGE_EDIT(tw); + tw->table.edit_column = InRange (tw->table.edit_column,0,COLUMNS(tw)-1); + XawTableSetEdit (w, tw->table.edit_row, tw->table.edit_column); + } + tw->table.no_redraw--; + } + + /* Let's look the table which we have made now */ + UpdateTable(tw); + +#ifdef EBUG_XRAW_MALLOC + CHECK_TABLE(tw); +#endif + + return ACCEPT; +} + + +Boolean +#ifdef Xraw_NEED_PROTO +XawTableIsEditManaged (Widget w) +#else +XawTableIsEditManaged (w) + Widget w; +#endif +{ + return XtIsManaged(((XawTableWidget)w)->table.edit); +} + + + +int +#ifdef Xraw_NEED_PROTO +XawTableSetLabel (Widget w, int row, int column, char *raw_label) +#else +XawTableSetLabel(w, row, column, raw_label) + Widget w; + int row; + int column; + char *raw_label; +#endif +{ + register XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + char* label = NULL; + XawTableCellRec new; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange(row, 0, ROWS(tw)-1)) || + (column != InRange(column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetLabel", "XawTableSetLabel","XawToolkitError", +"XawTableSetLabel\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (raw_label == (char*)NULL) + label = DummyString(); + else + label = CopyOnlyPrintable(raw_label); + + if (streq(label,CELL(label))) { + XtFree(label); /* XtMalloc in CopyOnlyPrintable */ + return ACCEPT; + } + + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.label = label; + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it != True) { + XtFree(label); + return REJECT; + } + + + if (CELL(label)) + XtFree(CELL(label)); + + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + SetLabelWidth (tw, row, column); + Reposition (tw, cell, row, column); + + if (IsEditInRowColumn (tw, row, column)) + { + XtVaSetValues (EDIT(w), "string", CELL(label), NULL); + } + else if (XtIsRealized (w) && w->core.visible && !tw->table.no_redraw) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + XClearArea (XtDisplay(w), XtWindow(w), x, y, width, height, FALSE); + (void) PaintCell (w, row, column, (XtPointer)cell, (XtPointer)NULL); + } + return ACCEPT; +} + + + + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellColours (Widget w, int row, int column, + Pixel fore, Pixel back) +#else +XawTableSetCellColours (w, row, column, fore, back) + Widget w; + int row; + int column; + Pixel fore; + Pixel back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + NormalReverseGC* normal; + ShadowGC* shadow; + + + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellColours","XawToolkitError", +"XawTableSetCellColours\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return REJECT; + } + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(special_colour) && fore == CELL(fore) && back == CELL(back)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = True; + new.back = back; + new.fore = fore; + + /* normal and reverse GC's */ + normal = GetNormalGC(w, fore, back, tw->table.font->fid); + + new.normal = normal->normal; + new.reverse = normal->reverse; + + + /* shadow GC's */ + shadow = GetShadowGC(w, back); + + new.top = shadow->top; + new.bottom = shadow->bottom; + + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && + !tw->table.no_redraw && !tw->table.no_refigure) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + ReleaseNormalGC(w, fore, back); + ReleaseShadowGC(w, back); + return REJECT; + } +} + + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellDefaultColours (Widget w, int row, int column) +#else +XawTableSetCellDefaultColours (w, row, column) + Widget w; + int row; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellDefaultColours","XawToolkitError", +"XawTableSetCellDefaultColours\n\ +Incorrect value of row or column (%s,%s) in Table widget '%s'", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (!CELL(special_colour)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = False; + new.fore = tw->table.foreground; + new.back = tw->core.background_pixel; + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && !tw->table.no_redraw) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + return REJECT; + } +} + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellBackground (Widget w, int row, int column, Pixel back) +#else +XawTableSetCellBackground (w, row, column, back) + Widget w; + int row; + int column; + Pixel back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + NormalReverseGC* normal; + ShadowGC* shadow; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellBackground","XawToolkitError", +"XawTableSetCellBackground\n\ +Incorrect value of row or column (%s,%s) in Table widget '%s'", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(special_colour) && back == CELL(back)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = True; + new.back = back; + + if (!CELL(special_colour)) + new.fore = tw->table.foreground; + + /* normal and reverse GC's */ + normal = GetNormalGC(w, new.fore, back, tw->table.font->fid); + + new.normal = normal->normal; + new.reverse = normal->reverse; + + + /* shadow GC's */ + shadow = GetShadowGC(w, back); + + new.top = shadow->top; + new.bottom = shadow->bottom; + + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && !tw->table.no_redraw) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + ReleaseNormalGC(w, new.fore, back); + ReleaseShadowGC(w, back); + return REJECT; + } + +} + +int +#ifdef Xraw_NEED_PROTO +XawTableSetCellForeground (Widget w, int row, int column, Pixel fore) +#else +XawTableSetCellForeground (w, row, column, fore) + Widget w; + int row; + int column; + Pixel fore; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + XawTableCell cell; + XawTableCellRec new; + NormalReverseGC* normal; + ShadowGC* shadow; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange (row, 0, ROWS(tw)-1)) || + (column != InRange (column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetCellColours", "XawTableSetCellBackground","XawToolkitError", +"XawTableSetCellBackground\n\ +Incorrect value of row or column (%s,%s) in Table widget '%s'", + subs, &num_subs); + return REJECT; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(special_colour) && fore == CELL(fore)) + return ACCEPT; + + /* + * prepare new cell stuff from old one + */ + (void)memcpy((char*)&new, (char*)cell, sizeof(XawTableCellRec)); + new.special_colour = True; + new.fore = fore; + + if (!CELL(special_colour)) + new.back = tw->core.background_pixel; + + /* normal and reverse GC's */ + normal = GetNormalGC(w, fore, new.back, tw->table.font->fid); + + new.normal = normal->normal; + new.reverse = normal->reverse; + + + /* shadow GC's */ + shadow = GetShadowGC(w, new.back); + + new.top = shadow->top; + new.bottom = shadow->bottom; + + + callback_str.reason = XawTABLE_CHANGED_CELL; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = cell; + callback_str.new_cell = &new; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedCell, callback_str); + + if (callback_str.do_it) + { + int x = GetX(tw,column); + int y = GetY(tw,row); + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,column); + unsigned int height = (unsigned int) tw->table.row_height; + + if (XtIsRealized(w) && w->core.visible && !tw->table.no_redraw) { + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + PaintLabel (w, row, column, x, y, &new); + PaintShadow (w, row, column, x, y, &new); + XFlush(XtDisplay(w)); + } + + if (CELL(special_colour)) { + ReleaseNormalGC(w, CELL(fore), CELL(back)); + ReleaseShadowGC(w, CELL(back)); + } + (void)memcpy((char*)cell, (char*)&new, sizeof(XawTableCellRec)); + + return ACCEPT; + } + else + { + ReleaseNormalGC(w, fore, new.back); + ReleaseShadowGC(w, new.back); + return REJECT; + } +} + +void +#ifdef Xraw_NEED_PROTO +XawTableGetCellColours (Widget w, int row, int column, + Pixel *fore, Pixel *back) +#else +XawTableGetCellColours (w, row, column, fore, back) + Widget w; + int row; + int column; + Pixel *fore; + Pixel *back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + + if (cell && cell->special_colour) { + *fore = cell->fore; + *back = cell->back; + } + else { + *fore = tw->table.foreground; + *back = tw->core.background_pixel; + } +} + +void +#ifdef Xraw_NEED_PROTO +XawTableGetCellColoursByCell (Widget w, XawTableCell cell, + Pixel *fore, Pixel *back) +#else +XawTableGetCellColoursByCell (w, cell, fore, back) + Widget w; + XawTableCell cell; + Pixel *fore; + Pixel *back; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (cell && cell->special_colour) { + *fore = cell->fore; + *back = cell->back; + } + else { + *fore = tw->table.foreground; + *back = tw->core.background_pixel; + } +} + +/*#########################################################################*/ +/*# #*/ +/*# Column Defaults #*/ +/*# #*/ +/*#########################################################################*/ + +#ifdef notdef +/* ARGSUSED */ +static Boolean PaintCellWithClear(p, i, j, call_data, client_data) + XtPointer p; + int i; + int j; + XtPointer call_data; + XtPointer client_data; /* unused */ +{ + Widget w = (Widget) p; + XawTableWidget tw = (XawTableWidget) w; + XawTableCell cell = (XawTableCell) call_data; + unsigned int width = (unsigned int) COLUMN_WIDTH(tw,j); + unsigned int height = (unsigned int) tw->table.row_height; + Position x; + Position y; + + + x = GetX(tw,j); + y = GetY(tw,i); + + XClearArea (XtDisplay(w), XtWindow(w), + x + tw->table.label_shadow_thickness, + y + tw->table.label_shadow_thickness, + width, height, FALSE); + + PaintLabel (w, i, j, x, y, cell); + PaintShadow (w, i, j, x, y, cell); + + XFlush(XtDisplay(w)); + return False; +} +#endif + +void +#ifdef Xraw_NEED_PROTO +XawTableSetColumnJustify (Widget w, int column, XtJustify justify) +#else +XawTableSetColumnJustify (w, column, justify) + Widget w; + int column; + XtJustify justify; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int i, j; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return; + + COLUMN_DATA(tw)[column].flag |= _CL_justify; + COLUMN_DATA(tw)[column].justify = justify; + + for(i = 0; i < ROWS(tw); i++) + Reposition(tw, NULL, i, column); + + if (XtIsRealized(w) && w->core.visible && + !tw->table.no_redraw && !tw->table.no_refigure) + { + (void)go_table((XtPointer)w, PaintCell, STUFF(tw), + 0, ROWS(tw)-1, column, column, + XawTABLE_DOWN_RIGHT, + &i, &j, (XtPointer)NULL); + XFlush(XtDisplay(w)); + } +} + + +XtJustify +#ifdef Xraw_NEED_PROTO +XawTableGetColumnJustify (Widget w, int column) +#else +XawTableGetColumnJustify (w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return XtJustifyCenter; + + if (COLUMN_DATA(tw)[column].flag & _CL_justify) + return COLUMN_DATA(tw)[column].justify; + + return XtJustifyCenter; +} + + +void +#ifdef Xraw_NEED_PROTO +XawTableSetColumnWidth (Widget w, int column, int width) +#else +XawTableSetColumnWidth(w, column, width) + Widget w; + int column; + int width; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCallbackStruct callback_str; + register int row; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return; + + if ((COLUMN_DATA(tw)[column].flag & _CL_width) && + COLUMN_DATA(tw)[column].width == width) + return; + + COLUMN_DATA(tw)[column].flag |= _CL_width; + COLUMN_DATA(tw)[column].width = width; + + for(row = 0; row < ROWS(tw); row++) + Reposition(tw, NULL, row, column); + + UpdateTable(tw); + + callback_str.reason = XawTABLE_CHANGED_COLUMN_WIDTH; + callback_str.event = (XEvent*)NULL; + callback_str.old_cell = (XawTableCell)NULL; + callback_str.new_cell = (XawTableCell)NULL; + callback_str.row = 0; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNchangedColumnWidth, callback_str); +} + + + +int +#ifdef Xraw_NEED_PROTO +XawTableGetColumnWidth (Widget w, int column) +#else +XawTableGetColumnWidth(w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + return tw->table.column_default_width; + + if ((COLUMN_DATA(tw)[column].flag & _CL_width)) + return COLUMN_DATA(tw)[column].width; + + return tw->table.column_default_width; +} + +int +#ifdef Xraw_NEED_PROTO +XawTableGetColumnPixelWidth (Widget w, int column) +#else +XawTableGetColumnPixelWidth(w, column) + Widget w; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + int width; + + if (column != InRange (column, 0, COLUMNS(tw)-1)) + width = tw->table.column_default_width; + else if ((COLUMN_DATA(tw)[column].flag & _CL_width)) + width = COLUMN_DATA(tw)[column].width; + else + width = tw->table.column_default_width; + + if (tw->table.literal) { + width = width * tw->table.literal_width + 2 * tw->table.internal_width; + } + + return width; +} + +char * +#ifdef Xraw_NEED_PROTO +XawTableGetLabelByPosition (Widget w, int i, int j) +#else + XawTableGetLabelByPosition(w,i,j) + Widget w; + int i,j; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (i != InRange(i, 0, ROWS(tw)-1)) || + (j != InRange(j, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", i); + sprintf(subs[1], "%5d", j); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "GetLabelByPosition", "XawTableGetLabelByPosition","XawToolkitError", +"XawTableGetLabelByPosition\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return NULL; + } + + cell = (XawTableCell)get_cell(STUFF(tw), i, j); + return GET_CELL_LABEL; +} + +void +#ifdef Xraw_NEED_PROTO +XawTableUnsetEdit (Widget w) +#else + XawTableUnsetEdit(w) + Widget w; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + char* label; + XawTableCell cell; + + if (XawTableIsEditManaged(w)) + { + tw->table.no_redraw++; + UNMANAGE_EDIT(tw); + tw->table.no_redraw--; + + XtVaGetValues(EDIT(w), "string", &label, NULL); + + label = CopyOnlyPrintable(label); + + cell = (XawTableCell) + get_cell(STUFF(tw),tw->table.edit_row, tw->table.edit_column); + + if (!streq(label,CELL(label))) + XawTableSetLabel(w, tw->table.edit_row, tw->table.edit_column, label); + + XtFree(label); /* XtMalloc in CopyOnlyPrintable */ + } +} + +void +#ifdef Xraw_NEED_PROTO +XawTableSetEdit (Widget w, int row, int column) +#else + XawTableSetEdit(w, row, column) + Widget w; + int row; + int column; +#endif +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + + if (IsEditInRowColumn(tw, row, column) || STUFF(tw) == NULL) + return; + + if ((ROWS(tw) < 1) || (COLUMNS(tw) < 1) || + (row != InRange(row, 0, ROWS(tw)-1)) || + (column != InRange(column, 0, COLUMNS(tw)-1))) + { + String subs[3]; + Cardinal num_subs = 3; + sprintf(subs[0], "%5d", row); + sprintf(subs[1], "%5d", column); + subs[2] = w->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "SetEdit", "XawTableSetEdit","XawToolkitError", +"XawTableSetEdit\nIncorrect value of rows or columns (%s,%s) in TableWidget '%s' ", + subs, &num_subs); + return; + } + + XawTableUnsetEdit(w); + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (CELL(label) == NULL) + XtVaSetValues(EDIT(tw), "string", Dummy, NULL); + else + XtVaSetValues(EDIT(tw), "string", CELL(label), NULL); + + tw->table.edit_row = row; + tw->table.edit_column = column; + + MoveEditCell (tw, tw->table.edit_row, tw->table.edit_column); + + MANAGE_EDIT(tw); +} + +/****************************************************************** + * + * Actions + * + ******************************************************************/ + +static void HighlightCell(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int row, column; + Position x,y; + Time tm; + + if (!tw->table.editable) + return; + + if (*num_params == 2) + { + row = atoi(params[0]); + column = atoi(params[1]); + } + else if (event != (XEvent*)NULL) + { + ExtractPosition(event, &x, &y , &tm); + if (ExtractCell(tw, x, y, &row, &column)) + return ; + } + else + { + return; + } + + cell = (XawTableCell) get_cell (STUFF(tw), row, column); + + if (CELL(highlight)) + return ; + + CELL(highlight) = True; + + x = GetX(tw,column); + y = GetY(tw,row); + + PaintLabel(w, row, column, x, y, cell); + XFlush(XtDisplay(w)); +} + +/* ARGSUSED */ +static void UnhighlightCell(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + XawTableCell cell; + int row, column; + Position x,y; + Time tm; + unsigned int width; + unsigned int height; + + if (!tw->table.editable) + return; + + if (*num_params == 2) + { + row = atoi(params[0]); + column = atoi(params[1]); + } + else if (event != (XEvent*)NULL) + { + ExtractPosition(event, &x, &y , &tm); + if (ExtractCell(tw, x, y, &row, &column)) + return ; + } + else + { + return; + } + + cell = (XawTableCell)get_cell(STUFF(tw), row, column); + + if (!CELL(highlight)) + return ; + + CELL(highlight) = False; + + width = (unsigned int) COLUMN_WIDTH(tw, column) + + 2 * tw->table.label_shadow_thickness; + height = (unsigned int) tw->table.row_height + + 2 * tw->table.label_shadow_thickness; + + XClearArea(XtDisplay(w), XtWindow(w), + (int)GetX(tw,column), + (int)GetY(tw,row), + width, height, FALSE); + + PaintLabel(w, row, column, x, y, cell); + + XFlush(XtDisplay(w)); + +} + +/* ARGSUSED */ +static void WhatCell(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x,y; + int row, column; + XawTableCallbackStruct callback_str; + XawTableCell cell; + Time tm; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + ExtractPosition(event, &x, &y , &tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + cell = (XawTableCell) get_cell (STUFF(tw), row, column); + + callback_str.reason = XawTABLE_WHAT_CELL; + callback_str.event = event; + callback_str.old_cell = cell; + callback_str.new_cell = cell; + callback_str.row = row; + callback_str.column = column; + callback_str.do_it = True; + + DO_CALLBACK(w, XtNwhatCell, callback_str); +} + +/* ARGSUSED */ +static void KeyReturn(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + Widget tw; + KeySym ksSymbol; + + ksSymbol = XtGetActionKeysym(event, (Modifiers*)NULL); + + if (ksSymbol == XK_Return || ksSymbol == XK_Linefeed) + { + XtVaGetValues(w, XtNuserData, &tw, NULL); + XawTableUnsetEdit(tw); + } + +} + +static Atom FetchAtom(w, name) + Widget w; + String name; +{ + Atom a; + XrmValue source, dest; + + source.size = strlen(name)+1; + source.addr = name; + dest.size = sizeof(Atom); + dest.addr = (XtPointer) &a; + + (void) XtConvertAndStore(w, XtRString, &source, XtRAtom, &dest); + return a; +} + +/* ARGSUSED */ +static Boolean DeliverSelection(w, selection, target, + type, value, length, format) + Widget w; + Atom *selection, *target, *type; + XtPointer *value; + unsigned long *length; + int *format; +{ + XawTableWidget tw = (XawTableWidget) w; + static Atom targets = 0; + + if (targets == 0) { + targets = FetchAtom(w, "TARGETS"); + } + + if (*target == targets) { + *type = XA_ATOM; + *value = (XtPointer) CALLOC(1, Atom); + *(Atom *) *value = XA_STRING; + *length = 1; + *format = 32; + return TRUE; + } + + if (*target == XA_STRING) { + *type = XA_STRING; + *value = (XtPointer) XtNewString(tw->table.cell_own->label); + *length = tw->table.cell_own->label_len; + *format = 8; + return TRUE; + } + + return FALSE; +} + +/* ARGSUSED */ +static void LoseSelection(w, selection) + Widget w; + Atom *selection; +{ + XawTableWidget tw = (XawTableWidget) w; + XawTableCell cell; + int row, column; + int x,y; + unsigned int width, height; + + cell = tw->table.cell_own; + tw->table.cell_own = (XawTableCell)NULL; + + if (!CELL(highlight)) + return ; + + get_cell_positions(cell, &row, &column); + + CELL(highlight) = False; + + x = GetX(tw,column) + tw->table.label_shadow_thickness; + y = GetY(tw,row) + tw->table.label_shadow_thickness; + width = (unsigned int) COLUMN_WIDTH(tw, column); + height = (unsigned int) tw->table.row_height; + + XClearArea(XtDisplay(w), XtWindow(w), x, y, width, height, FALSE); + (void)PaintCell(w, row, column, (XtPointer)cell, (XtPointer)NULL); + + XFlush(XtDisplay(w)); +} + +static int GetCutBufferNumber(); + +static void StoreBuffer(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* selections in precedence order */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x, y; + int row, column; + int i, buffer; + Time tm; + Atom selection; + + if (!tw->table.editable) + return; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + ExtractPosition(event, &x, &y ,&tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + if (tw->table.cell_own != (XawTableCell)NULL) + LoseSelection(w, (Atom*)NULL); + + tw->table.cell_own = (XawTableCell)get_cell(STUFF(tw), row, column); + + for(i=0; i<(int)*num_params; i++) { + selection = FetchAtom(w, *(String *)(params+i)); + + buffer = GetCutBufferNumber(selection); + + if (buffer >= 0) { + if (buffer == 0) { + +#define Create(buffer) \ + XChangeProperty(XtDisplay(w), DefaultRootWindow(XtDisplay(w)),\ + buffer,XA_STRING, 8,PropModeAppend, NULL, 0) + + Create(XA_CUT_BUFFER0); + Create(XA_CUT_BUFFER1); + Create(XA_CUT_BUFFER2); + Create(XA_CUT_BUFFER3); + Create(XA_CUT_BUFFER4); + Create(XA_CUT_BUFFER5); + Create(XA_CUT_BUFFER6); + Create(XA_CUT_BUFFER7); +#undef Create + + XRotateBuffers(XtDisplay(w), 1); + } + + XStoreBuffer(XtDisplay(w), tw->table.cell_own->label, + (int)MIN(tw->table.cell_own->label_len, MAXCUT), buffer); + + } else { + tw->table.selections[tw->table.num_selections++] = selection; + + XtOwnSelection (w, selection, tm, + DeliverSelection, LoseSelection, + (XtSelectionDoneProc) NULL); + } + } +} + + +/* ARGSUSED */ +static void CallEdit(w,event,params,num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x,y; + int row, column; + Time tm; + + if (!tw->table.editable) + return; + + ExtractPosition(event, &x, &y , &tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + XawTableSetEdit(w, row, column); +} + + + +typedef struct { + Widget w; + Atom *selections; + Time time; + int row; + int column; + int count; + int num; +}RowColumn; + +static void GetProc(); + +static void GetSelection (rc) + RowColumn *rc; +{ + Atom selection; + int buffer; + int nbytes; + char *label; + + selection = *(rc->selections + rc->num); + + if (rc->num < rc->count){ + + buffer = GetCutBufferNumber(selection); + + if (buffer >= 0) { + label = XFetchBuffer(XtDisplay(rc->w), &nbytes, buffer); + XawTableSetLabel(rc->w, rc->row, rc->column, label); + XtFree((XtPointer)rc->selections); + XtFree((XtPointer)rc); + }else { + XtGetSelectionValue(rc->w, selection, XA_STRING, GetProc, + (XtPointer)rc, rc->time); + rc->num++; + } + } +} + +/* ARGSUSED */ +static void GetProc(w, client_data, selection, + type, value, length, format) + Widget w; + XtPointer client_data; + Atom *selection; + Atom *type; + XtPointer value; + unsigned long *length; + int *format; +{ + RowColumn *rc = (RowColumn*)client_data; + + if ((*type == XA_STRING) && (value != NULL)) { + XawTableSetLabel(w, rc->row, rc->column, (char*)value); + XtFree((XtPointer)value); + XtFree((XtPointer)client_data); + }else { + GetSelection(rc); + } + +} + +static void InsertSelection(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* selections in precedence order */ + Cardinal *num_params; +{ + XawTableWidget tw = (XawTableWidget)w; + Position x,y; + int row, column; + RowColumn *rc; + Time tm; + + if (!tw->table.editable) + return; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + ExtractPosition(event, &x, &y ,&tm); + + if (ExtractCell(tw, x, y, &row, &column)) + return ; + + if (*num_params > 0) { + + rc = XtNew(RowColumn); + + rc->time = tm; + rc->w = w; + rc->row = row; + rc->column = column; + rc->count = (int)*num_params; + rc->num = 0; + + if (*num_params > (Cardinal)0) { + rc->selections = CALLOC(*num_params, Atom); + XmuInternStrings(XtDisplay(w), params, *num_params, rc->selections); + } else { + rc->selections = XtNew(Atom); + *rc->selections = FetchAtom(w, "PRIMARY"); + } + GetSelection(rc); + } +} + + +static int GetCutBufferNumber(atom) + register Atom atom; +{ + if (atom == XA_CUT_BUFFER0) return(0); + if (atom == XA_CUT_BUFFER1) return(1); + if (atom == XA_CUT_BUFFER2) return(2); + if (atom == XA_CUT_BUFFER3) return(3); + if (atom == XA_CUT_BUFFER4) return(4); + if (atom == XA_CUT_BUFFER5) return(5); + if (atom == XA_CUT_BUFFER6) return(6); + if (atom == XA_CUT_BUFFER7) return(7); + return(-1); +} + + +/* ARGSUSED */ +static void DoingNothing(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + /* doing nothing */ +} + diff --git a/vendor/x11iraf/obm/ObmW/zz/Table.h b/vendor/x11iraf/obm/ObmW/zz/Table.h new file mode 100644 index 00000000..4c7ab5cf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Table.h @@ -0,0 +1,539 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _XawTable_h +#define _XawTable_h + +#include <X11/Xmu/Converters.h> + +#include <X11/Xraw/Simple.h> +#include <X11/Xraw/XawInit.h> + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resources #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XawTextEncoding8bit +#define XawTextEncoding8bit 0 +#endif +#ifndef XawTextEncodingChar2b +#define XawTextEncodingChar2b 1 +#endif + +#ifndef XtNliteral +#define XtNliteral "literal" +#endif + +#ifndef XtNrows +#define XtNrows "rows" +#endif + +#ifndef XtNcolumns +#define XtNcolumns "columns" +#endif + + +#ifndef XtNmaskNumber +#define XtNmaskNumber "maskNumber" +#endif + +#ifndef XtNrowOriented +#define XtNrowOriented "rowOriented" +#endif + +#ifndef XtNeditForeground +#define XtNeditForeground "editForeground" +#endif + +#ifndef XtNeditBackground +#define XtNeditBackground "editBackground" +#endif + +#ifndef XtNcolumnForeground +#define XtNcolumnForeground "columnForeground" +#endif + +#ifndef XtNrowForeground +#define XtNrowForeground "rowForeground" +#endif + +#ifndef XtNvetricalScroll +#define XtNvetricalScroll "vetricalScroll" +#endif + +#ifndef XtNhorizontalScroll +#define XtNhorizontalScroll "horizontalScroll" +#endif + +#ifndef XtNcolumnsWidth +#define XtNcolumnsWidth "columnsWidth" +#endif + +#ifndef XtNrowHeight +#define XtNrowHeight "rowHeight" +#endif + +#ifndef XtNdefaultWidth +#define XtNdefaultWidth "defaultWidth" +#endif + +#ifndef XtNeditable +#define XtNeditable "editable" +#endif + +#ifndef XtNliteralWidth +#define XtNliteralWidth "literalWidth" +#endif + +#ifndef XtNtableMargin +#define XtNtableMargin "tableMargin" +#endif + +#ifndef XtNrowMargin +#define XtNrowMargin "rowMargin" +#endif + +#ifndef XtNcolumnMargin +#define XtNcolumnMargin "columnMargin" +#endif + +#ifndef XtNlabelShadowWidth +#define XtNlabelShadowWidth "labelShadowWidth" +#endif + +#ifndef XtNencoding +#define XtNencoding "encoding" +#endif + + + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Classes #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtCLiteral +#define XtCLiteral "Literal" +#endif + +#ifndef XtCColumns +#define XtCColumns "Columns" +#endif + +#ifndef XtCMaskNumber +#define XtCMaskNumber "MaskNumber" +#endif + +#ifndef XtCScroll +#define XtCScroll "Scroll" +#endif + +#ifndef XtCColumnsWidth +#define XtCColumnsWidth "ColumnsWidth" +#endif + +#ifndef XtCRowHeight +#define XtCRowHeight "RowHeight" +#endif + +#ifndef XtCDefaultWidth +#define XtCDefaultWidth "DefaultWidth" +#endif + +#ifndef XtCEditable +#define XtCEditable "Editable" +#endif + +#ifndef XtCLiteralWidth +#define XtCLiteralWidth "LiteralWidth" +#endif + +#ifndef XtCRows +#define XtCRows "Rows" +#endif + +#ifndef XtCTableMargin +#define XtCTableMargin "TableMargin" +#endif + +#ifndef XtCRowMargin +#define XtCRowMargin "RowMargin" +#endif + +#ifndef XtCColumnMargin +#define XtCColumnMargin "ColumnMargin" +#endif + +#ifndef XtCLabelShadowWidth +#define XtCLabelShadowWidth "LabelShadowWidth" +#endif + +#ifndef XtCEncoding +#define XtCEncoding "Encoding" +#endif + + + + + + +/*#########################################################################*/ +/*# #*/ +/*# New Resource Types #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtRColumnsWidth +#define XtRColumnsWidth "ColumnsWidth" +#endif + +#ifndef XtCRowOriented +#define XtCRowOriented "RowOriented" +#endif + + +/*#########################################################################*/ +/*# #*/ +/*# Allowance Callbacks #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNallowAddColumn +#define XtNallowAddColumn "allowAddColumn" +#endif + +#ifndef XtNallowAddRow +#define XtNallowAddRow "allowAddRow" +#endif + +#ifndef XtNallowDeleteColumn +#define XtNallowDeleteColumn "allowDeleteColumn" +#endif + +#ifndef XtNallowDeleteRow +#define XtNallowDeleteRow "allowDeleteRow" +#endif + +#ifndef XtNallowDeleteTable +#define XtNallowDeleteTable "allowDeleteTable" +#endif + + +/*#########################################################################*/ +/*# #*/ +/*# Information Callbacks #*/ +/*# #*/ +/*#########################################################################*/ +#ifndef XtNaddColumn +#define XtNaddColumn "addColumn" +#endif + +#ifndef XtNaddRow +#define XtNaddRow "addRow" +#endif + +#ifndef XtNchangedCell +#define XtNchangedCell "changedCell" +#endif + +#ifndef XtNchangedColumnWidth +#define XtNchangedColumnWidth "changedColumnWidth" +#endif + +#ifndef XtNchangedRowHeight +#define XtNchangedRowHeight "changedRowHeight" +#endif + +#ifndef XtNcreateTable +#define XtNcreateTable "createTable" +#endif + +#ifndef XtNdeleteColumn +#define XtNdeleteColumn "deleteColumn" +#endif + +#ifndef XtNdeleteRow +#define XtNdeleteRow "deleteRow" +#endif + +#ifndef XtNdeleteTable +#define XtNdeleteTable "deleteTable" +#endif + +#ifndef XtNwhatCell +#define XtNwhatCell "whatCell" +#endif + + + +/*#########################################################################*/ +/*# #*/ +/*# XawTableCell & XawTableColumn #*/ +/*# #*/ +/*#########################################################################*/ +typedef struct _XawTableCellRec *XawTableCell; /* opaque to outside */ + +typedef struct _XawTableColumnRec *XawTableColumn; /* opaque to outside */ + + + +/*#########################################################################*/ +/*# #*/ +/*# Bypass Routine and Direction Types #*/ +/*# #*/ +/*#########################################################################*/ +typedef Boolean (*XawTableProc) Xraw_PROTO((Widget, + int, + int, + XawTableCell, + XtPointer)); +enum XawTableBypassDirection{ + XawTABLE_RIGHT_DOWN, + XawTABLE_DOWN_RIGHT +}; + + +/*#########################################################################*/ +/*# #*/ +/*# Callback Reasons #*/ +/*# #*/ +/*#########################################################################*/ +enum XawTableReasons{ + XawTABLE_ALLOW_ADD_COLUMN = Xraw_TABLE, + XawTABLE_ALLOW_ADD_ROW, + XawTABLE_ALLOW_CREATE_TABLE, + XawTABLE_ALLOW_DELETE_COLUMN, + XawTABLE_ALLOW_DELETE_ROW, + XawTABLE_ALLOW_DELETE_TABLE, + + XawTABLE_ADD_COLUMN, + XawTABLE_ADD_ROW, + XawTABLE_CHANGED_CELL, + XawTABLE_CHANGED_COLUMN_WIDTH, + XawTABLE_CHANGED_ROW_HEIGHT, + XawTABLE_CREATE_TABLE, + XawTABLE_DELETE_COLUMN, + XawTABLE_DELETE_ROW, + XawTABLE_DELETE_TABLE, + XawTABLE_WHAT_CELL +}; + + +/*#########################################################################*/ +/*# #*/ +/*# Callback Structure #*/ +/*# #*/ +/*#########################################################################*/ +typedef struct { + int reason; + XEvent *event; + XawTableCell old_cell; + XawTableCell new_cell; + int row; + int column; + Boolean do_it; +}XawTableCallbackStruct; + + +/*#########################################################################*/ +/*# #*/ +/*# Layout Control Routine #*/ +/*# #*/ +/*#########################################################################*/ +extern void XawTableDoLayout Xraw_PROTO((Widget w, + Boolean do_layout)); + + +/*#########################################################################*/ +/*# #*/ +/*# Stuff Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTableSetNewSize Xraw_PROTO((Widget w, + int rows, + int columns)); + +extern void XawTableGetSize Xraw_PROTO((Widget w, + int *rows, + int *columns)); + + +/*#########################################################################*/ +/*# #*/ +/*# Row Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTablePrependRow Xraw_PROTO((Widget w)); + +extern int XawTableAppendRow Xraw_PROTO((Widget w)); + +extern int XawTableInsertRow Xraw_PROTO((Widget w, int row)); + +extern int XawTableDeleteRow Xraw_PROTO((Widget w, int row)); + + +/*#########################################################################*/ +/*# #*/ +/*# Column Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTablePrependColumn Xraw_PROTO((Widget w, int width)); + +extern int XawTableAppendColumn Xraw_PROTO((Widget w, int width)); + +extern int XawTableInsertColumn Xraw_PROTO((Widget w, + int column, + int width)); + +extern int XawTableDeleteColumn Xraw_PROTO((Widget w, int column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Set Label Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern char *XawTableGetLabelByCell Xraw_PROTO((XawTableCell cell)); + +extern char *XawTableGetLabelByPosition Xraw_PROTO((Widget w, + int row, + int column)); + +extern int XawTableSetLabel Xraw_PROTO((Widget w, + int row, + int column, + char *label)); + + +/*#########################################################################*/ +/*# #*/ +/*# Bypass Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern Boolean XawTableWalk Xraw_PROTO((Widget w, + XawTableProc proc, + int b_row, + int e_row, + int b_column, + int e_column, + int direction, + int *row, int *column, + XtPointer client_data)); + +extern Boolean XawTableSearchLabel Xraw_PROTO((Widget w, + char *name, + int *row, + int *column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Edit Cell Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern Boolean XawTableIsEditManaged Xraw_PROTO((Widget w)); + +extern void XawTableGetEditPosition Xraw_PROTO((Widget w, + int *row, + int *column)); + +extern void XawTableUnsetEdit Xraw_PROTO((Widget w)); + +extern void XawTableSetEdit Xraw_PROTO((Widget w, + int row, + int column)); + + +/*#########################################################################*/ +/*# #*/ +/*# Set Colour Routines #*/ +/*# #*/ +/*#########################################################################*/ +extern int XawTableSetCellBackground Xraw_PROTO((Widget w, + int row, + int column, + Pixel background)); + +extern int XawTableSetCellForeground Xraw_PROTO((Widget w, + int row, + int column, + Pixel foreground)); + +extern int XawTableSetCellDefaultColours Xraw_PROTO((Widget w, + int row, + int column)); + +extern int XawTableSetCellColours Xraw_PROTO((Widget w, + int row, + int column, + Pixel foreground, + Pixel background)); + + +extern void XawTableGetCellColours Xraw_PROTO((Widget w, + int row, + int column, + Pixel *foreground, + Pixel *background)); + +extern void XawTableGetCellColoursByCell Xraw_PROTO((Widget w, + XawTableCell cell, + Pixel *foreground, + Pixel *background)); + + +/*#########################################################################*/ +/*# #*/ +/*# Column Deta #*/ +/*# #*/ +/*#########################################################################*/ +extern void XawTableSetColumnJustify Xraw_PROTO((Widget w, + int column, + XtJustify justify)); + +extern XtJustify XawTableGetColumnJustify Xraw_PROTO((Widget w, + int column)); + +extern void XawTableSetColumnWidth Xraw_PROTO((Widget w, + int column, + int width)); + +extern int XawTableGetColumnWidth Xraw_PROTO((Widget w, + int column)); + +extern int XawTableGetColumnPixelWidth Xraw_PROTO((Widget w, + int column)); + + + +/*#########################################################################*/ +/*# #*/ +/*# Widget Class Pointer #*/ +/*# #*/ +/*#########################################################################*/ +extern WidgetClass tableWidgetClass; + +typedef struct _TableClassRec *XawTableWidgetClass; +typedef struct _TableRec *XawTableWidget; + + +#endif /* _XawTable_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/obm/ObmW/zz/Table3d.c b/vendor/x11iraf/obm/ObmW/zz/Table3d.c new file mode 100644 index 00000000..085b2cac --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Table3d.c @@ -0,0 +1,924 @@ +#include <X11/Xraw/3d.h> +#include <X11/Xraw/color.h> + +#define WHITE WhitePixelOfScreen +#define BLACK BlackPixelOfScreen +#define SWITCH(a,b) (top_or_bottom == TOP ? a : b) + +#define DEPTH_SCREEN(w) DefaultDepthOfScreen(XtScreen(w)) + +#ifdef MIN +#undef MIN +#endif +#define MIN(a,b) ((a)<(b) ? (a) : (b)) + +#ifdef MAX +#undef MAX +#endif +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +#define TOP_VALUE_RATIO (1.3) +#define BOT_VALUE_RATIO (0.6) +#define ARM_VALUE_RATIO (0.85) + +#define Top_Cash (1<<0L) +#define Bot_Cash (1<<1L) +#define Arm_Cash (1<<2L) + +typedef struct _ColorCashRec { + struct _ColorCashRec* nxt; + XColor col; + RGB rgb[1]; + HSV hsv[1]; + RGB top[1]; + RGB bot[1]; + RGB arm[1]; + unsigned int set; +}ColorCashRec, *ColorCash; + +static ColorCashRec* color_cash = NULL; +static void GetTopShadow(); + + +static void GetTopShadow(trom ,to) + XColor* trom; + XColor* to; +{ + ColorCashRec* cash; + float save; + + for (cash = color_cash; cash != NULL; cash = cash->nxt) + { + if (cash->col.red == trom->red && + cash->col.green == trom->green && + cash->col.blue == trom->blue) + { + if (cash->set & Top_Cash) + { + to->red = cash->top[0].r; + to->green = cash->top[0].g; + to->blue = cash->top[0].b; + } + else + { + save = cash->hsv[0].v; + cash->hsv[0].v *= TOP_VALUE_RATIO; + cash->hsv[0].v = MIN(cash->hsv[0].v, 1.0); + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->top); + + cash->hsv[0].v = save; + + to->red = cash->top[0].r; + to->green = cash->top[0].g; + to->blue = cash->top[0].b; + + cash->set |= Top_Cash; + } + + return; + } + } + + cash = XtNew (ColorCashRec); + + cash->col.red = cash->rgb[0].r = trom->red; + cash->col.green = cash->rgb[0].g = trom->green; + cash->col.blue = cash->rgb[0].b = trom->blue; + + RGBToHSV((RGB*)cash->rgb, (HSV*)cash->hsv); + + save = cash->hsv[0].v; + cash->hsv[0].v *= TOP_VALUE_RATIO; + cash->hsv[0].v = MIN(cash->hsv[0].v, 1.0); + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->top); + + cash->hsv[0].v = save; + + to->red = cash->top[0].r; + to->green = cash->top[0].g; + to->blue = cash->top[0].b; + + cash->set = Top_Cash; + + cash->nxt = color_cash; + color_cash = cash; +} + +static void GetBotShadow(trom ,to) + XColor* trom; + XColor* to; +{ + ColorCashRec* cash; + float save; + + for (cash = color_cash; cash != NULL; cash = cash->nxt) + { + if (cash->col.red == trom->red && + cash->col.green == trom->green && + cash->col.blue == trom->blue) + { + if (cash->set & Bot_Cash) + { + to->red = cash->bot[0].r; + to->green = cash->bot[0].g; + to->blue = cash->bot[0].b; + } + else + { + save = cash->hsv[0].v; + cash->hsv[0].v *= BOT_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->bot); + + cash->hsv[0].v = save; + + to->red = cash->bot[0].r; + to->green = cash->bot[0].g; + to->blue = cash->bot[0].b; + + cash->set |= Bot_Cash; + } + + return; + } + } + + cash = XtNew (ColorCashRec); + + cash->col.red = cash->rgb[0].r = trom->red; + cash->col.green = cash->rgb[0].g = trom->green; + cash->col.blue = cash->rgb[0].b = trom->blue; + + RGBToHSV((RGB*)cash->rgb, (HSV*)cash->hsv); + + save = cash->hsv[0].v; + cash->hsv[0].v *= BOT_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->bot); + + cash->hsv[0].v = save; + + to->red = cash->bot[0].r; + to->green = cash->bot[0].g; + to->blue = cash->bot[0].b; + + cash->set = Bot_Cash; + + cash->nxt = color_cash; + color_cash = cash; +} + +static void GetArmShadow(trom ,to) + XColor* trom; + XColor* to; +{ + ColorCashRec* cash; + float save; + + for (cash = color_cash; cash != NULL; cash = cash->nxt) + { + if (cash->col.red == trom->red && + cash->col.green == trom->green && + cash->col.blue == trom->blue) + { + if (cash->set & Arm_Cash) + { + to->red = cash->arm[0].r; + to->green = cash->arm[0].g; + to->blue = cash->arm[0].b; + } + else + { + save = cash->hsv[0].v; + cash->hsv[0].v *= ARM_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->arm); + + cash->hsv[0].v = save; + + to->red = cash->arm[0].r; + to->green = cash->arm[0].g; + to->blue = cash->arm[0].b; + + cash->set |= Arm_Cash; + } + + return; + } + } + + cash = XtNew (ColorCashRec); + + cash->col.red = cash->rgb[0].r = trom->red; + cash->col.green = cash->rgb[0].g = trom->green; + cash->col.blue = cash->rgb[0].b = trom->blue; + + RGBToHSV((RGB*)cash->rgb, (HSV*)cash->hsv); + + save = cash->hsv[0].v; + cash->hsv[0].v *= ARM_VALUE_RATIO; + + HSVToRGB((HSV*)cash->hsv, (RGB*)cash->arm); + + cash->hsv[0].v = save; + + to->red = cash->arm[0].r; + to->green = cash->arm[0].g; + to->blue = cash->arm[0].b; + + cash->set = Arm_Cash; + + cash->nxt = color_cash; + color_cash = cash; +} + +unsigned int shadowpm_width = 8; +unsigned int shadowpm_height= 8; + +static char shadow_bits[] = { + 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55}; + +static char mtshadowpm_bits[] = { + 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24}; + +static char mbshadowpm_bits[] = { + 0x6d, 0xdb, 0xb6, 0x6d, 0xdb, 0xb6, 0x6d, 0xdb}; + + +GC +#ifdef Xraw_NEED_PROTO +AllocGCFromPixmap (Widget w, Pixmap pixmap) +#else +AllocGCFromPixmap(w, pixmap) + Widget w; + Pixmap pixmap; +#endif +{ + XGCValues values; + + if (pixmap != None) { + values.tile = pixmap; + values.fill_style = FillTiled; + return XtGetGC(w, (XtGCMask)(GCTile | GCFillStyle), &values); + } + + return XtGetGC(w, (XtGCMask)0, (XGCValues *)NULL); +} + +GC +#ifdef Xraw_NEED_PROTO +AllocGCFromPixel (Widget w, Pixel fore) +#else +AllocGCFromPixel(w, fore) + Widget w; + Pixel fore; +#endif +{ + XGCValues values; + + values.foreground = fore; + return XtGetGC(w, GCForeground, &values); +} + +static Pixmap Depth_1_ShadowPixmap (w, top_or_bottom) + Widget w; + int top_or_bottom; +{ + Screen *scn = XtScreen (w); + + if (DEPTH_SCREEN(w) == 1) + return XCreatePixmapFromBitmapData (XtDisplay (w), + RootWindowOfScreen (scn), + shadow_bits, + shadowpm_width, + shadowpm_height, + SWITCH(BLACK (scn), WHITE (scn)), + SWITCH(WHITE (scn), BLACK (scn)), + 1); + else + return None; +} + +static Pixmap Depth_NOT_1_ShadowPixmap (w, colour, top_or_bottom) + Widget w; + Pixel colour; + int top_or_bottom; +{ + Display *dpy = XtDisplay (w); + Screen *scn = XtScreen (w); + unsigned long fore; + unsigned long back; + char *pm_data; + int depth = DEPTH_SCREEN(w); + + if (depth == 1) + return None; + + if (colour == WHITE (scn) || colour == BLACK (scn)) { + fore = WHITE (scn); + back = BLACK (scn); + pm_data = SWITCH(mtshadowpm_bits, mbshadowpm_bits); + } else { + fore = colour; + back = SWITCH (WHITE (scn), BLACK (scn)); + pm_data = shadow_bits; + } + + return XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + shadowpm_width, + shadowpm_height, + fore, + back, + depth); +} + +Pixmap +#ifdef Xraw_NEED_PROTO +CreateShadowPixmap (Widget w, Pixel colour, int top_or_bottom) +#else +CreateShadowPixmap (w, colour, top_or_bottom) + Widget w; + Pixel colour; + int top_or_bottom; +#endif +{ + if (DEPTH_SCREEN(w) == 1) + return Depth_1_ShadowPixmap (w, top_or_bottom); + else + return Depth_NOT_1_ShadowPixmap (w, colour, top_or_bottom); +} + +#define _MIN(x,y) (unsigned short) ((x) < (y)) ? (x) : (y) +#define _MAX(x,y) (unsigned short) ((x) < (y)) ? (y) : (x) + + +Boolean +#ifdef Xraw_NEED_PROTO +AllocShadowPixel ( + Widget w, + Pixel base, + int brightness, + Pixel *result) +#else +AllocShadowPixel (w, base, brightness, result) + Widget w; + Pixel base; + int brightness; + Pixel *result; /* RETURN */ +#endif +{ + XColor set; + XColor get; + double mult; + Colormap cmap= ((CoreWidget)w)->core.colormap; + unsigned short red; + unsigned short green; + unsigned short blue; + + get.pixel = base; + XQueryColor (XtDisplay (w), cmap, &get); + mult = (double)(100 + brightness) / ((double) 100.0); + + red = mult * (double)get.red; + green = mult * (double)get.green; + blue = mult * (double)get.blue; + + set.red = _MAX(0,_MIN (65535, red)); + set.green = _MAX(0,_MIN (65535, green)); + set.blue = _MAX(0,_MIN (65535, blue)); + +#define EQ(field) (set.field == get.field) + if (EQ(red) && EQ(green) && EQ(blue)) +#undef EQ + return False; + + if (XAllocColor (XtDisplay (w), cmap, &set) != 0) { + *result = set.pixel; + return True; + } else + return False; +} + +GC +#ifdef Xraw_NEED_PROTO +MakeGC (Widget w, + Pixel base, + int brightness, + Boolean pseudo, + int top_or_bottom) +#else +MakeGC(w, base, brightness, pseudo, top_or_bottom) + Widget w; + Pixel base; + int brightness; + Boolean pseudo; + int top_or_bottom; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (pseudo) { + tile = Depth_NOT_1_ShadowPixmap (w, base, top_or_bottom); + return AllocGCFromPixmap(w, tile); + } else { + if (AllocShadowPixel(w, base, brightness, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, top_or_bottom); + return AllocGCFromPixmap(w, tile); + } + } + } else { + tile = Depth_1_ShadowPixmap (w, top_or_bottom); + return AllocGCFromPixmap(w, tile); + } +} + +GC +#ifdef Xraw_NEED_PROTO +MakeTopShadowGC (Widget w, Pixel base) +#else +MakeTopShadowGC(w, base) + Widget w; + Pixel base; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (TopShadowColor(w, base, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, TOP); + return AllocGCFromPixmap(w, tile); + } + } else { + tile = Depth_1_ShadowPixmap (w, TOP); + return AllocGCFromPixmap(w, tile); + } +} + + +GC +#ifdef Xraw_NEED_PROTO +MakeBottomShadowGC (Widget w, Pixel base) +#else +MakeBottomShadowGC(w, base) + Widget w; + Pixel base; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (BottomShadowColor(w, base, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, BOTTOM); + return AllocGCFromPixmap(w, tile); + } + } else { + tile = Depth_1_ShadowPixmap (w, BOTTOM); + return AllocGCFromPixmap(w, tile); + } +} + +GC +#ifdef Xraw_NEED_PROTO +MakeArmedGC (Widget w, Pixel base) +#else +MakeArmedGC(w, base) + Widget w; + Pixel base; +#endif +{ + Pixel fore; + Pixmap tile; + + if (DEPTH_SCREEN(w) > 1) { + if (ArmedColor(w, base, &fore)) { + return AllocGCFromPixel(w, fore); + } else { + tile = Depth_NOT_1_ShadowPixmap (w, base, BOTTOM); + return AllocGCFromPixmap(w, tile); + } + } else { + tile = Depth_1_ShadowPixmap (w, BOTTOM); + return AllocGCFromPixmap(w, tile); + } +} + +void +#ifdef Xraw_NEED_PROTO +XawDrawFrame (Widget gw, + Position x, + Position y, + Dimension w, + Dimension h, + XawFrameType frame_type, + Dimension t, + GC lightgc, + GC darkgc) +#else +XawDrawFrame (gw, x, y, w, h, frame_type, t, lightgc, darkgc) + Widget gw; + Position x; + Position y; + Dimension w; + Dimension h; + XawFrameType frame_type; + Dimension t; + GC lightgc; + GC darkgc; +#endif +{ + XPoint top_polygon[6]; + XPoint bottom_polygon[6]; + XPoint points[3]; + + + if (t == 0 || w == 0 || h == 0) + return; + + if( lightgc == (GC)NULL ){ + XtWarning("XawDrawFrame: lightgc is NULL in XawDrawFrame."); + return; + } + + if( darkgc == (GC)NULL ){ + XtWarning("XawDrawFrame: darkgc is NULL in XawDrawFrame."); + return; + } + + if (!XtIsRealized(gw)) { + XtWarning("XawDrawFrame: widget is not realized!!!"); + return; + } + +#define topPolygon(i,xx,yy) \ + top_polygon[i].x = (short) (xx); \ + top_polygon[i].y = (short) (yy) + +#define bottomPolygon(i,xx,yy) \ + bottom_polygon[i].x = (short) (xx); \ + bottom_polygon[i].y = (short) (yy) + + + if (frame_type == XawTACK && t <= 2) + frame_type = XawLEDGED; + + switch (frame_type) { + + case XawRAISED : + case XawSUNKEN : + + topPolygon (0,x ,y ); bottomPolygon (0,x+w ,y+h ); + topPolygon (1,x+w ,y ); bottomPolygon (1,x ,y+h ); + topPolygon (2,x+w-t,y+t ); bottomPolygon (2,x+t ,y+h-t); + topPolygon (3,x+t ,y+t ); bottomPolygon (3,x+w-t,y+h-t); + topPolygon (4,x+t ,y+h-t); bottomPolygon (4,x+w-t,y+t ); + topPolygon (5,x ,y+h ); bottomPolygon (5,x+w ,y ); + + if (frame_type == XawSUNKEN) + { + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + top_polygon, 6, Nonconvex, CoordModeOrigin); + + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + bottom_polygon, 6, Nonconvex, CoordModeOrigin); + } + else if (frame_type == XawRAISED) + { + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + top_polygon, 6, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + bottom_polygon, 6, Nonconvex, CoordModeOrigin); + } + + break; + + case XawTACK : + + t -= 2; + + topPolygon (0,x ,y ); bottomPolygon (0,x+w ,y+h ); + topPolygon (1,x+w ,y ); bottomPolygon (1,x ,y+h ); + topPolygon (2,x+w-t,y+t ); bottomPolygon (2,x+t ,y+h-t); + topPolygon (3,x+t ,y+t ); bottomPolygon (3,x+w-t,y+h-t); + topPolygon (4,x+t ,y+h-t); bottomPolygon (4,x+w-t,y+t ); + topPolygon (5,x ,y+h ); bottomPolygon (5,x+w ,y ); + + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + top_polygon, 6, Nonconvex, CoordModeOrigin); + XFillPolygon(XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + bottom_polygon, 6, Nonconvex, CoordModeOrigin); + + points[0].x = x + t + 1; points[0].y = y + h - t - 2; + points[1].x = x + t + 1; points[1].y = y + t + 1; + points[2].x = x + w - t - 2; points[2].y = y + t + 1; + + XDrawLines (XtDisplayOfObject(gw), XtWindowOfObject(gw), darkgc, + points, 3, CoordModeOrigin); + + /* points[0].x = x + t + 1; points[0].y = y + h -t - 1; */ + points[1].x = x + w - t - 2; points[1].y = y + h - t - 2; + /* points[2].x = x + w - t - 1; points[2].y = y + t + 1; */ + + XDrawLines (XtDisplayOfObject(gw), XtWindowOfObject(gw), lightgc, + points, 3, CoordModeOrigin); + + break; + + case XawLEDGED : + + XawDrawFrame(gw, x, y, w, h, XawRAISED, t/2, lightgc, darkgc); + XawDrawFrame(gw, (Position)(x + t/2), (Position)(y + t/2), + (Dimension)(w - 2 * (t/2)), (Dimension)(h - 2 * (t/2)), + XawSUNKEN, t/2, lightgc, darkgc); + break; + + case XawCHISELED : + + XawDrawFrame(gw, x, y, w, h, XawSUNKEN, t/2, lightgc, darkgc); + XawDrawFrame(gw, (Position)(x + t/2),(Position)(y + t/2), + (Dimension)(w - 2 * (t/2)), (Dimension)(h - 2 * (t/2)), + XawRAISED, t/2, lightgc, darkgc); + break; + + default : + break; + + } + +#undef topPolygon +#undef bottomPolygon +} + + +Boolean +#ifdef Xraw_NEED_PROTO +BottomShadowColor( Widget widget, + Pixel base, + Pixel *result) +#else +BottomShadowColor(widget, base, result) + Widget widget; + Pixel base; + Pixel *result; +#endif +{ + Colormap colormap; + XColor color; + + if (XtIsWidget(widget)) + colormap = widget->core.colormap; + else + colormap = (XtParent(widget))->core.colormap; + + color.pixel = base; + + XQueryColor(XtDisplay(widget), colormap, &color); + + GetBotShadow(&color, &color); + + if (XAllocColor (XtDisplay(widget), colormap, &color) != 0) + { + *result = color.pixel; + return True; + } + else + { + HSV hsv; + RGB rgb; + + rgb.r = color.red; + rgb.g = color.green; + rgb.b = color.blue; + + RGBToHSV ((RGB*)&rgb, (HSV*)&hsv); + + if (hsv.v > 0.5) + *result = WhitePixelOfScreen(XtScreen (widget)); + else + *result = BlackPixelOfScreen(XtScreen (widget)); + return True; + } + +} + +Boolean +#ifdef Xraw_NEED_PROTO +TopShadowColor( Widget widget, + Pixel base, + Pixel *result) +#else +TopShadowColor(widget, base, result) + Widget widget; + Pixel base; + Pixel *result; +#endif +{ + Colormap colormap; + XColor color; + + if (XtIsWidget(widget)) + colormap = widget->core.colormap; + else + colormap = (XtParent(widget))->core.colormap; + + color.pixel = base; + + XQueryColor(XtDisplay(widget), colormap, &color); + + GetTopShadow(&color, &color); + + if (XAllocColor (XtDisplay(widget), colormap, &color) != 0) + { + *result = color.pixel; + return True; + } + else + { + HSV hsv; + RGB rgb; + + rgb.r = color.red; + rgb.g = color.green; + rgb.b = color.blue; + + RGBToHSV ((RGB*)&rgb, (HSV*)&hsv); + + if (hsv.v > 0.5) + *result = WhitePixelOfScreen(XtScreen (widget)); + else + *result = BlackPixelOfScreen(XtScreen (widget)); + return True; + } + +} + +Boolean +#ifdef Xraw_NEED_PROTO +ArmedColor( Widget widget, + Pixel base, + Pixel *result) +#else +ArmedColor(widget, base, result) + Widget widget; + Pixel base; + Pixel *result; +#endif +{ + Colormap colormap; + XColor color; + + if (XtIsWidget(widget)) + colormap = widget->core.colormap; + else + colormap = (XtParent(widget))->core.colormap; + + color.pixel = base; + + XQueryColor(XtDisplay(widget), colormap, &color); + + GetArmShadow(&color, &color); + + if (XAllocColor (XtDisplay(widget), colormap, &color) != 0) + { + *result = color.pixel; + return True; + } + else + { + HSV hsv; + RGB rgb; + + rgb.r = color.red; + rgb.g = color.green; + rgb.b = color.blue; + + RGBToHSV ((RGB*)&rgb, (HSV*)&hsv); + + if (hsv.v > 0.5) + *result = WhitePixelOfScreen(XtScreen (widget)); + else + *result = BlackPixelOfScreen(XtScreen (widget)); + return True; + } + +} + + + +#undef assign_max +#undef assign_min + + +void +#ifdef Xraw_NEED_PROTO +DrawRhombus ( + Widget w, + short x, + short y, + short g, + short t, + GC top_shadow_GC, + GC foreground_gc, + GC bottom_shadow_GC, + Boolean state ) +#else +DrawRhombus(w, x, y, g, t, + top_shadow_GC, foreground_gc, bottom_shadow_GC, state) + Widget w; + short x; + short y; + short g; + short t; + GC top_shadow_GC; + GC foreground_gc; + GC bottom_shadow_GC; + Boolean state; +#endif +{ + XPoint top_shade[6]; + XPoint bot_shade[6]; + XPoint center[4]; + +#define topPolygon(i,a,b) top_shade[i].x = a; top_shade[i].y = b +#define bottomPolygon(i,a,b) bot_shade[i].x = a; bot_shade[i].y = b +#define centerPolygon(i,a,b) center[i].x = a; center[i].y = b + + topPolygon(0, x-g , y ); bottomPolygon(0, x-g , y ); + topPolygon(1, x-g+t, y ); bottomPolygon(1, x-g+t, y ); + topPolygon(2, x , y-g+t); bottomPolygon(2, x , y+g-t); + topPolygon(3, x+g-t, y ); bottomPolygon(3, x+g-t, y ); + topPolygon(4, x+g , y ); bottomPolygon(4, x+g , y ); + topPolygon(5, x , y-g ); bottomPolygon(5, x , y+g ); + + if (state) + { + if (foreground_gc) + { + centerPolygon(0, x-g+t, y ); + centerPolygon(1, x , y-g+t); + centerPolygon(2, x+g-t, y ); + centerPolygon(3, x , y+g-t); + + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), foreground_gc, + center, XtNumber(center), + Convex, CoordModeOrigin); + } + + if (bottom_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), bottom_shadow_GC, + top_shade, XtNumber(top_shade), Nonconvex, CoordModeOrigin); + + if (top_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), top_shadow_GC, + bot_shade, XtNumber(bot_shade), Nonconvex, CoordModeOrigin); + }else{ + + if (top_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), top_shadow_GC, + top_shade, XtNumber(top_shade), + Nonconvex, CoordModeOrigin); + + if (bottom_shadow_GC) + XFillPolygon(XtDisplayOfObject(w), XtWindowOfObject(w), bottom_shadow_GC, + bot_shade, XtNumber(bot_shade), + Nonconvex, CoordModeOrigin); + } + +#undef topPolygon +#undef bottomPolygon +#undef centerPolygon + +} + +Boolean +#ifdef Xraw_NEED_PROTO +FetchPixel (Widget w, String name, Pixel* pixel) +#else +FetchPixel(w, name, pixel) + Widget w; + String name; + Pixel* pixel; +#endif +{ + XrmValue source, dest; + + source.size = strlen(name)+1; + source.addr = name; + dest.size = sizeof(Pixel); + dest.addr = (caddr_t) pixel; + + return XtConvertAndStore(w, XtRString, &source, XtRPixel, &dest); +} diff --git a/vendor/x11iraf/obm/ObmW/zz/Table3d.h b/vendor/x11iraf/obm/ObmW/zz/Table3d.h new file mode 100644 index 00000000..8d09dddf --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/Table3d.h @@ -0,0 +1,145 @@ +#ifndef _3d_h_ +#define _3d_h_ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xraw/XawInit.h> + +typedef enum { + XawRAISED = Xraw_3d, + XawSUNKEN, + XawCHISELED, + XawLEDGED, + XawTACK +} XawFrameType; + +#define TOP (1) +#define BOTTOM (2) + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean TopShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern Boolean ArmedColor Xraw_PROTO((Widget /* self */, + Pixel /* base */, + Pixel* /* result */)); + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern GC AllocGCFromPixmap Xraw_PROTO((Widget , Pixmap )); + + +extern GC AllocGCFromPixel Xraw_PROTO((Widget , Pixel )); + + +extern Pixmap CreateShadowPixmap Xraw_PROTO((Widget , + Pixel , + int )); + + +extern Boolean AllocShadowPixel Xraw_PROTO((Widget , + Pixel , + int , + Pixel * )); + + +extern GC MakeGC Xraw_PROTO((Widget , + Pixel , + int , + Boolean , + int )); + + +extern GC MakeTopShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeBottomShadowGC Xraw_PROTO((Widget , Pixel )); + + +extern GC MakeArmedGC Xraw_PROTO((Widget , Pixel )); + + +extern void XawDrawFrame Xraw_PROTO((Widget , + Position , + Position , + Dimension , + Dimension , + XawFrameType , + Dimension , + GC , + GC )); + + +extern void RGBtoHLS Xraw_PROTO((double , + double , + double , + double * , + double * , + double * )); + +extern void HLStoRGB Xraw_PROTO((double * , + double * , + double * , + double , + double , + double )); + +extern Boolean BottomShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean TopShadowColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern Boolean ArmedColor Xraw_PROTO((Widget , + Pixel , + Pixel * )); + + +extern void DrawRhombus Xraw_PROTO((Widget , + short , + short , + short , + short , + GC , + GC , + GC , + Boolean )); + +extern Boolean FetchPixel Xraw_PROTO((Widget , + String name , + Pixel* )); + +#endif /* _3d_h_ */ + + + + diff --git a/vendor/x11iraf/obm/ObmW/zz/TableP.h b/vendor/x11iraf/obm/ObmW/zz/TableP.h new file mode 100644 index 00000000..7daa38f8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/TableP.h @@ -0,0 +1,166 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advises, new components and patches of the existing programs. +Commercial usage is also possible with participation of it's author. + +*************************************************************************/ + +#ifndef _XawTableP_h +#define _XawTableP_h + +/*********************************************************************** + * + * Table Widget Private Data + * + ***********************************************************************/ + + +#include <X11/Xraw/ContainerP.h> +#include <X11/Xraw/Table.h> +#include <X11/Xraw/table.h> + +/* New fields for the Table widget class record */ + +typedef struct {int foo;} TableClassPart; + +/* Full class record declaration */ +typedef struct _TableClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + ContainerClassPart container_class; + TableClassPart table_class; +} TableClassRec; + +#define MAX_ROWS 50 + +typedef struct _NormalReverseGC { + int used; + Pixel fore; + Pixel back; + GC normal; + GC reverse; +}NormalReverseGC; + +typedef struct _ShadowGC { + int used; + Pixel back; + GC top; + GC bottom; +}ShadowGC; + + + +/* New fields for the Table widget record */ +typedef struct { + /* ------------------------ resources -----------------------*/ + Pixel row_fore; + Pixel column_fore; + Pixel edit_fore; + Pixel edit_back; + Boolean row_oriented; + Boolean editable; + Boolean literal; + + int mask_number; + int columns; + int rows; + Dimension tab_margin; + Dimension row_margin; + Dimension col_margin; + Dimension internal_width; + Dimension internal_height; + Dimension label_shadow_thickness; + unsigned char encoding; + + /* Default Values */ + Pixel foreground; + XtJustify justify; + XFontStruct *font; + int width; + + /* Allowance CallbackList */ + XtCallbackList allow_add_row; + XtCallbackList allow_add_column; + XtCallbackList allow_delete_column; + XtCallbackList allow_delete_row; + XtCallbackList allow_delete_table; + + /* Information CallbackList */ + XtCallbackList add_row; + XtCallbackList add_column; + XtCallbackList changed_cell; + XtCallbackList create_table; + XtCallbackList delete_column; + XtCallbackList delete_row; + XtCallbackList delete_table; + XtCallbackList what_cell; + XtCallbackList changed_column_width; + XtCallbackList changed_row_height; + + Widget v_scroll; + Widget h_scroll; + + int row_height; + int column_default_width; + int literal_width; + + /* ------------------------ private state -----------------------*/ + + int no_refigure; /* no re-layout while > 0 */ + int no_redraw; /* no re-draw while > 0 */ + Boolean was_resized; + + + XawTableColumn column_data; + + Dimension prefer_width; + Dimension prefer_height; + Widget edit; + int edit_row; + int edit_column; + XawTableCell cell_own; + XawTableCell table_stuff; + + GC row_gc; /* Intrinsics sharedable GC */ + GC column_gc; /* Intrinsics sharedable GC */ + + GC normal; /* Table sharedable GC */ + GC reverse; /* Table sharedable GC */ + GC top; + GC bottom; + + GC edit_top; + GC edit_bottom; + + NormalReverseGC *normal_hash_table; + ShadowGC *shadow_hash_table; + int mask_hash_table; + + Atom selections[30]; + int num_selections; +} TablePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TableRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + ContainerPart container; + TablePart table; +} TableRec; + +extern TableClassRec tableClassRec; + +#endif /* _XawTableP_h */ diff --git a/vendor/x11iraf/obm/ObmW/zz/TableUtil.c b/vendor/x11iraf/obm/ObmW/zz/TableUtil.c new file mode 100644 index 00000000..ec2582be --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/TableUtil.c @@ -0,0 +1,918 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#include <X11/Xraw/table.h> + +#ifdef EBUG_XRAW_MALLOC +#include <dbmalloc/malloc.h> +#endif + +/************************************************************************ + * + * TABLE IS A GRID OF POINTER BINDED NODES + * + ************************************************************************/ + +#define null (XawTableNode)NULL +#define FREE(t) if((t) != null)XtFree((char*)(t)) + +static void vert_tab_node_insert(f,s,p) + register XawTableNode f; /* insert after */ + register XawTableNode s; /* insert before */ + register XawTableNode p; /* to be inserted */ +{ + if (f != null) f->b = p; + if (s != null) s->t = p; + if (p != null) {p->t = f; p->b = s;} +} + +static void horiz_tab_node_insert(f,s,p) + register XawTableNode f; /* insert after */ + register XawTableNode s; /* insert before */ + register XawTableNode p; /* to be inserted */ +{ + if (f != null) f->r = p; + if (s != null) s->l = p; + if (p != null) {p->l = f; p->r = s;} +} + +static void vert_tab_node_reject(p) + register XawTableNode p; +{ + if (p == null) return; + + if (p->t != null) p->t->b = p->b; + if (p->b != null) p->b->t = p->t; +} + +static void horiz_tab_node_reject(p) + register XawTableNode p; +{ + if (p == null) return; + + if (p->r != null) p->r->l = p->l; + if (p->l != null) p->l->r = p->r; +} + +/* ARGSUSED */ +static XawTableProc del_cell (w, i, j, call_data, client_data) + XtPointer w; + int i; + int j; + XtPointer call_data; + XtPointer client_data; +{ + XtFree((char*)call_data); + return False; +} + +/* +** Function name : row_delete +** +** Description : delete row which the node belongs to +** Input : pointer to the node +** Output : void +*/ + +void +#if NeedFunctionPrototypes +row_delete (XtPointer f) +#else +row_delete(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return; + + /* Go to left edge */ + for(; p->l != null; p=p->l ) + /*EMPTY*/; + + /* Go to right with dettaching cell */ + for(; p->r != null; p=p->r){ + vert_tab_node_reject(p->l); + FREE(p->l); + } + + /* Detach last but one cell in the row */ + if (p->l != null){ + vert_tab_node_reject(p->l); + FREE(p->l); + } + + /* Detach very last cell in the row */ + vert_tab_node_reject(p); + FREE(p); +} + +/* +** Function name : column_delete +** +** Description : delete column which the node belongs to +** Input : pointer to the node +** Output : void +*/ + +void +#if NeedFunctionPrototypes +column_delete (XtPointer f) +#else +column_delete(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return; + + /* Go up to the edge */ + for(; p->t != null; p=p->t ) + /*EMPTY*/; + + /* Go down with dettaching cell */ + for(; p->b != null; p=p->b){ + horiz_tab_node_reject(p->t); + FREE(p->t); + } + + /* Detach bottom but one cell in the column */ + if (p->t != null){ + horiz_tab_node_reject(p->t); + FREE(p->t); + } + + /* Detach very bottom cell in the column */ + horiz_tab_node_reject(p); + FREE(p); +} + + + +/* +** Function name : row_insert_after +** +** Description : insert row down to the row which the node belongs to +** Input : poiter to the node, size of node +** Output : True if successful +*/ + +Boolean +#if NeedFunctionPrototypes +row_insert_after (XtPointer d, int node_size) +#else +row_insert_after(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode) d; + register XawTableNode p; + XawTableNode left; + + if (f == null) + return False; + + /* go left till row edge */ + for(; f->l != null; f=f->l ) + /*EMPTY*/; + + /* save very left node */ + left = f; + + /* go right and attach new cells via vertical ponters */ + for(; f->r != null; f=f->r){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->b); + FREE(left->b); + } + return False; + } + vert_tab_node_insert(f, f->b, p); + } + + /* attach vertically very right cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->b); + FREE(left->b); + } + return False; + } + vert_tab_node_insert(f, f->b, p); + + /* if only one column */ + if ( f->l == null ) { + f->b->l = f->b->r = null; + return True; + } + + /* attach horizontally very right cell */ + horiz_tab_node_insert(f->l->b,null,f->b); + + /* bind via horizontal ponters */ + for(f=f->l; f->l != null; f=f->l ) + horiz_tab_node_insert(f->l->b,f->r->b,f->b); + + /* attach horizontally very left cell */ + horiz_tab_node_insert(null,f->r->b,f->b); + + return True; +} + +/* +** Function name : row_insert_before +** +** Description : the same as previous, but only on top from row +** Input : pointer to the node, size of node +** Output : True if successful +*/ + +Boolean +#if NeedFunctionPrototypes +row_insert_before (XtPointer d, int node_size) +#else +row_insert_before(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode) d; + register XawTableNode p; + XawTableNode left; + + if (f == null) + return False; + + /* go left till row edge */ + for(; f->l != null; f=f->l ) + /*EMPTY*/; + + /* save very left node */ + left = f; + + /* go right and attach new cells via vertical ponters */ + for(; f->r != null; f=f->r){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->t); + FREE(left->t); + } + return False; + } + vert_tab_node_insert(f->t, f, p); + } + + /* attach vertically very right cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; left != f; left = left->r){ + vert_tab_node_reject(left->t); + FREE(left->t); + } + return False; + } + vert_tab_node_insert(f->t, f, p); + + /* if only one column */ + if ( f->l == null ) { + f->t->l = f->t->r = null; + return True; + } + + /* attach horizontally very right cell */ + horiz_tab_node_insert(f->l->t,null,f->t); + + /* bind via horizontal ponters */ + for(f=f->l; f->l != null; f=f->l ) + horiz_tab_node_insert(f->l->t,f->r->t,f->t); + + /* attach horizontally very left cell */ + horiz_tab_node_insert(null,f->r->t,f->t); + + return True; +} + +/* +** Function name : column_insert_after +** +** Description : insert column right to the column which the node belongs to +** Input : pointer to the node, size of node +** Output : True if successful +[<*/ + +Boolean +#if NeedFunctionPrototypes +column_insert_after (XtPointer d, int node_size) +#else +column_insert_after(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode) d; + register XawTableNode p; + XawTableNode top; + + if (f == null) + return False; + + /* go top till column edge */ + for(; f->t != null; f=f->t ) + /*EMPTY*/; + + /* save very top node */ + top = f; + + /* go down and attach new cells via horizontal ponters */ + for(; f->b != null; f=f->b){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->r); + FREE(top->r); + } + return False; + } + horiz_tab_node_insert(f, f->r, p); + } + + /* attach horizontally very down cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->r); + FREE(top->r); + } + return False; + } + + horiz_tab_node_insert(f, f->r, p); + + /* if only one row */ + if ( f->t == null ) { + f->r->t = f->r->b = null; + return True; + } + + /* attach vertically very down cell */ + vert_tab_node_insert(f->t->r,null,f->r); + + /* bind via vertical ponters */ + for(f=f->t; f->t != null; f=f->t ) + vert_tab_node_insert(f->t->r,f->b->r,f->r); + + /* attach vertically very top cell */ + vert_tab_node_insert(null,f->b->r,f->r); + + return True; +} + +/* +** Function name : column_insert_before +** +** Description : the same as previous, but only to left from column +** Input : pointer to node, size of node +** Output : True if successful +*/ + +Boolean +#if NeedFunctionPrototypes +column_insert_before (XtPointer d, int node_size) +#else +column_insert_before(d, node_size) + XtPointer d; + int node_size; +#endif +{ + register XawTableNode f = (XawTableNode)d; + register XawTableNode p; + XawTableNode top; + + if (f == null) + return False; + + /* go top till column top */ + for(; f->t != null; f=f->t ) + /*EMPTY*/; + + /* save very top node */ + top = f; + + /* go down and attach new cells via horizontal ponters */ + for(; f->b != null; f=f->b){ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->l); + FREE(top->l); + } + return False; + } + horiz_tab_node_insert(f->l, f, p); + } + + /* attach horizontally very down cell */ + if( (p = (XawTableNode) XtMalloc (node_size)) == null){ + for(; top != f; top = top->b){ + horiz_tab_node_reject(top->l); + FREE(top->l); + } + return False; + } + horiz_tab_node_insert(f->l, f, p); + + /* if only one row */ + if ( f->t == null ) { + f->l->t = f->l->b = null; + return True; + } + + /* attach vertically very down cell */ + vert_tab_node_insert(f->t->l, null, f->l); + + /* bind via vertical ponters */ + for(f=f->t; f->t != null; f=f->t ) + vert_tab_node_insert(f->t->l, f->b->l, f->l); + + /* attach vertically very top cell */ + vert_tab_node_insert(null, f->b->l, f->l); + + return True; +} + +/* +** Function name : get_table +** +** Description : spot the node (0,0) in the table +** Input : pointer to any node in table +** Output : pointer to the node (0,0) +*/ + +XtPointer +#if NeedFunctionPrototypes +get_table (XtPointer f) +#else +get_table(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return (XtPointer)NULL; + + for(; p->t != null; p=p->t) + /*EMPTY*/; + + for(; p->l != null; p=p->l) + /*EMPTY*/; + + return (XtPointer)p; +} + +/* +** Function name : get_cell +** +** Description : spot the node (i,j) regarding to given node +** Input : pointer to the node, column, row (may be negative) +** Output : pointer to the node or NULL +*/ + +XtPointer +#if NeedFunctionPrototypes +get_cell (XtPointer f, register int i, register int j) +#else +get_cell (f, i, j) + XtPointer f; + register int i; + register int j; +#endif +{ + register XawTableNode p = (XawTableNode) f; + + if (p == null) + return (XtPointer)NULL; + + if (i > 0) { + for(; i>0; i--) + if (p != null) p = p->b; + else return (XtPointer)NULL; + } else { + for(; i<0; i++) + if (p != null) p = p->t; + else return (XtPointer)NULL; + } + + if (j > 0) { + for(; j>0; j--) + if (p != null) p = p->r; + else return (XtPointer)NULL; + } else { + for(; j<0; j++) + if (p != null) p = p->l; + else return (XtPointer)NULL; + } + + return (XtPointer)p; +} + +#if 0 +static Boolean go_row(w, proc, p, begin_column, end_column, i, j, client_data) + XtPointer w; + XawTableProc proc; + XawTableNode p; /* p == get_cell(table, ... , begin_column) */ + int begin_column; + int end_column; + int *i; /* returned */ + int *j; /* returned */ + XtPointer client_data; +{ + for ((*j) = begin_column; ((*j) <= end_column) && (p != null); (*j)++) + { + XawTableProc sp = p; + p = p->r; + + if (proc(w, *i, *j, (XtPointer)sp, client_data)) + return True; + } + + return False; +} +#endif + +/* +** Function name : go_table +** +** Description : invoke given rutine for every node in given region +** Input : rutine, begin/end rows, begin/end columns... +** Output : True if given rutine returned True for a node, +** numbers of row and column for that node + */ + +Boolean +#if NeedFunctionPrototypes +go_table ( + XtPointer w, + XawTableProc proc, + XtPointer table, + int begin_row, + int end_row, + int begin_column, + int end_column, + int direction, + register int *i, /* returned */ + register int *j, /* returned */ + XtPointer client_data) +#else +go_table(w, proc, table, begin_row, end_row, begin_column, end_column, + direction, i, j, client_data) + XtPointer w; + XawTableProc proc; + XtPointer table; + int begin_row; + int end_row; + int begin_column; + int end_column; + int direction; + register int *i; /* returned */ + register int *j; /* returned */ + XtPointer client_data; +#endif +{ + register XawTableNode p; + register XawTableNode n; + + table = get_table(table); + + switch (direction) { + case XawTABLE_DOWN_RIGHT : + p = (XawTableNode)get_cell(table, begin_row, begin_column); + + for (*j = begin_column; *j <= end_column && p != null; (*j)++) + { + register XawTableNode sp = p; /* protect against deallocated node !! */ + p = p->r; + + for (*i = begin_row, n = sp; *i <= end_row && n != null; (*i)++) + { + register XawTableNode sn = n; /* protect against deallocated node !! */ + n = n->b; + + if (proc(w, *i, *j, (XtPointer)sn, client_data)) + return True; + } + } + break; + case XawTABLE_RIGHT_DOWN : + default : + p = (XawTableNode)get_cell(table, begin_row, begin_column); + + for (*i = begin_row; *i <= end_row && p != null; (*i)++) + { + register XawTableNode sp = p; /* protect against deallocated node !! */ + p = p->b; + + for (*j = begin_column, n = sp; *j <= end_column && n != null; (*j)++) + { + register XawTableNode sn = n; /* protect against deallocated node !! */ + n = n->r; + + if (proc(w, *i, *j, (XtPointer)sn, client_data)) + return True; + } + } + break; + } + return False; +} + +/* +** Function name : get_table_size +** +** Description : define dimention on the table +** Input : pointer to any node in the table +** Output : void +*/ + +void +#if NeedFunctionPrototypes +get_table_size (XtPointer f, + register int *i, /* returned */ + register int *j) /* returned */ +#else +get_table_size(f,i,j) + XtPointer f; + register int *i; /* returned */ + register int *j; /* returned */ +#endif +{ + register XawTableNode p = (XawTableNode)f; + if (p == null){ + *i = 0; + *j = 0; + } + + p = (XawTableNode)get_table(f); + + for (*i = 1; p->b != null; p = p->b, (*i)++) + /*EMPTY*/; + + for (*j = 1; p->r != null; p = p->r, (*j)++) + /*EMPTY*/; +} + +/* +** Function name : delete_table +** +** Description : destroy table +** Input : pointer to any node in the table +** Output : void +*/ + +void +#if NeedFunctionPrototypes +delete_table (XtPointer f) +#else +delete_table(f) + XtPointer f; +#endif +{ + register XawTableNode p = (XawTableNode)f; + int i,j; + int end_row, end_column; + + if (p == null) + return; + + p = (XawTableNode)get_table(f); + get_table_size((XtPointer)p, (int*)&end_row, (int*)&end_column); + (void)go_table(NULL, (XawTableProc)del_cell, (XtPointer)p, + 0, (int)(end_row-1), 0, (int)(end_column-1), + XawTABLE_RIGHT_DOWN, + (int*)&i, (int*)&j, NULL); +} + +/* +** Function name : get_cell_positions +** +** Description : define number of row & column for node +** Input : pointer to the node +** Output : void +*/ + +void +#if NeedFunctionPrototypes +get_cell_positions (XtPointer f, + register int *i, /* returned */ + register int *j) /* returned */ +#else +get_cell_positions(f, i, j) + XtPointer f; + register int *i; /* returned */ + register int *j; /* returned */ +#endif +{ + register XawTableNode p = (XawTableNode)f; + if ( p == null ) + return; + + if ( i != (int*)NULL ) { + for (*i = 0; p->t != null; p = p->t, (*i)++) + /*EMPTY*/; + } + + if ( j != (int*)NULL ) { + for (*j = 0; p->l != null; p = p->l, (*j)++) + /*EMPTY*/; + } +} + +/* +** Function name : create_table +** +** Description : create the table +** Input : row & column dimestions, size of node +** Output : pointer to the node (0,0) +*/ + +XtPointer +#if NeedFunctionPrototypes +create_table ( int rows, int columns, int node_size) +#else +create_table(rows, columns, node_size) + int rows; + int columns; + int node_size; +#endif +{ + register XawTableNode *area; + register XawTableNode p; + register int i,j; + XawTableNode table; + + if (rows == 0 || columns == 0) + return (XtPointer)NULL; + else{ + register XawTableNode *s; + + /* allocate temporary two-dimension array to make first node's binding */ + if ( (s = area = (XawTableNode*) + XtCalloc ((unsigned)(rows * columns), sizeof(XawTableNode))) == NULL) + return (XtPointer)NULL; + + /* allocate nodes */ + for (i = 0, j = rows*columns; i < j; i++) + if((*s++ = (XawTableNode) XtMalloc (node_size)) == NULL){ + int h; + for (h = 0, s = area; h < i; h++) + XtFree((char*)*s++); + + XtFree((char*)area); + return (XtPointer)NULL; + } + } + +#define a(i,j) (XawTableNode)*(area + (i)*columns + (j)) + + /* initialize the boundary nodes */ + for (i = 0; i < rows; i++) { + p = a(i,0); p->l = null; + p = a(i,columns-1); p->r = null; + } + for (j = 0; j < columns; j++) { + p = a(0,j); p->t = null; + p = a(rows-1,j); p->b = null; + } + +#undef a +#define a(i,j) (( (i)>=0 && (i)<rows ) && ( (j)>=0 && (j)<columns ) ? \ + (XawTableNode)*(area + (i)*columns + (j)) : null) + + /* make internode's binding */ + for (i = 0; i < rows; i++) { + for (j = i % 2; j < columns; j += 2) { + horiz_tab_node_insert(a(i,j-1), a(i,j+1), a(i,j)); + vert_tab_node_insert (a(i-1,j), a(i+1,j), a(i,j)); + } + } + +#undef a + + table = *area; + XtFree((char*)area); + return (XtPointer)table; +} + + +#ifdef EBUG_XRAW_MALLOC +/* ARGSUSED */ +static Boolean check_cell (w, row, column, call_data, client_data) + XtPointer w; /* unused */ + int row; + int column; + XtPointer call_data; + XtPointer client_data; +{ + register XawTableNode p = (XawTableNode)call_data; + int real_row, real_column; + char *halt = NULL;; + + get_cell_positions(p, &real_row, &real_column); + + if (real_row != row){ + XtWarning("check_table: wrong initial table row size"); + *halt = '\0'; + } + + if (real_column != column){ + XtWarning("check_table: wrong initial table column size"); + *halt = '\0'; + } + + if (p->l != null) + if (p->l->r != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + if (p->r != null) + if (p->r->l != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + if (p->t != null) + if (p->t->b != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + if (p->b != null) + if (p->b->t != p) { + XtWarning("check_table: wrong cell"); + *halt = '\0'; + } + + return False; +} + + + +void +#if NeedFunctionPrototypes +_check_table (XtPointer f, int rows, int columns) +#else +_check_table (f, rows, columns) + XtPointer f; + int rows; + int columns; +#endif +{ + register XawTableNode table = (XawTableNode)f; + int real_rows, real_columns; + register int i,j; + char *halt = NULL; + + if (f == NULL && (rows == 0 || columns == 0)) + return; + + if (table != get_table(f)){ + XtWarning("check_table: wrong initial table cell"); + *halt = '\0'; + } + + get_table_size (f, &real_rows, &real_columns); + + if (real_rows != rows){ + XtWarning("check_table: wrong initial table row size"); + *halt = '\0'; + } + + if (real_columns != columns){ + XtWarning("check_table: wrong initial table column size"); + *halt = '\0'; + } + + + (void) go_table (NULL, check_cell, table, + 0, rows-1, 0, columns-1, + XawTABLE_RIGHT_DOWN, + &real_rows, &real_columns, (XtPointer)NULL); + +} +#endif /* EBUG_XRAW_MALLOC */ + +#undef null +#undef FREE + diff --git a/vendor/x11iraf/obm/ObmW/zz/TableUtil.h b/vendor/x11iraf/obm/ObmW/zz/TableUtil.h new file mode 100644 index 00000000..a8262f75 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/TableUtil.h @@ -0,0 +1,94 @@ +/*********************************************************************** + + Table widget + Copyright by Vladimir T. Romanovski + All rights reserved. + +This library is designed for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate +any advice, new components and patches of the existing programs. +Commercial usage is also possible with participation of the author. + + romsky@hp1.oea.ihep.su (Russia) + romsky@munin.ucsf.edu (USA) + +*************************************************************************/ + +#ifndef _table_h_ +#define _table_h_ + +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <X11/Xraw/Table.h> + +#if __STDC__ || defined(__cplusplus) +#define F_PROTO(s) s +#else +#define F_PROTO(s) () +#endif + +typedef struct _XawTableNodeRec { /* Node of table grid */ + struct _XawTableNodeRec *l; + struct _XawTableNodeRec *r; + struct _XawTableNodeRec *t; + struct _XawTableNodeRec *b; +}XawTableNodeRec, *XawTableNode; + + +extern XtPointer create_table F_PROTO((int rows, + int columns, + int node_size)); + +extern Boolean row_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean row_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern Boolean column_insert_after F_PROTO((XtPointer d, + int node_size)); + +extern Boolean column_insert_before F_PROTO((XtPointer f, + int node_size)); + +extern XtPointer get_table F_PROTO((XtPointer f)); + +extern XtPointer get_cell F_PROTO((XtPointer p, + int i, + int j)); + +extern void get_table_size F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void get_cell_positions F_PROTO((XtPointer p, + int *i, + int *j)); + +extern void row_delete F_PROTO((XtPointer p)); + +extern void column_delete F_PROTO((XtPointer p)); + +extern void delete_table F_PROTO((XtPointer p)); + +extern Boolean go_table F_PROTO((XtPointer w, + XawTableProc proc, + XtPointer table, + int begin_row, + int end_row, + int begin_column, + int end_column, + int direction, + register int *row, + register int *column, + XtPointer client_data)); + +#ifdef EBUG_XRAW_MALLOC +extern void _check_table F_PROTO((XtPointer table, + int rows, + int columns)); +#endif + +#undef F_PROTO + +#endif /* _table_h_ */ diff --git a/vendor/x11iraf/obm/ObmW/zz/XrawInit.h b/vendor/x11iraf/obm/ObmW/zz/XrawInit.h new file mode 100644 index 00000000..cf6bcbc8 --- /dev/null +++ b/vendor/x11iraf/obm/ObmW/zz/XrawInit.h @@ -0,0 +1,60 @@ +/* $XConsortium: XawInit.h,v 1.4 91/07/22 19:05:25 converse Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#ifndef _XawInit_ +#define _XawInit_ + +#if !(defined(__STDC__) && __STDC__) && !defined(__cplusplus) && !defined(c_plusplus) && !defined(FUNCPROTO) && !defined(XTFUNCPROTO) && !defined(XAWFUNCPROTO) && !(defined(NeedFunctionPrototypes) && NeedFunctionPrototypes) +#define Xraw_NO_PROTO +#else +#define Xraw_NEED_PROTO +#endif /* __STDC__ */ + + +#ifdef Xraw_NEED_PROTO +#define Xraw_PROTO(args) args +#else +#define Xraw_PROTO(args) () +#endif + +#define Xraw_VERSION 1 +#define Xraw_REVISION 2 + +#define Xraw_3d 1 +#define Xraw_SCROLLBAR 20 +#define Xraw_TABLE 40 +#define Xraw_SEPARATOR 60 +#define Xraw_FRAME 80 + +#define streq(a,b) (XrmStringToQuark(a) == XrmStringToQuark(b)) + +#define FULL_WIDTH(w) ((w)->core.width + ((w)->core.border_width << 1)) +#define FULL_HEIGHT(w) ((w)->core.height + ((w)->core.border_width << 1)) +#define WNULL (Widget)NULL + +/* called from ClassInit procs */ +extern void XawInitializeWidgetSet Xraw_PROTO((void)); + +#if defined(XtSpecificationRelease) && XtSpecificationRelease < 5 +#define XPointer XtPointer +#endif + +#endif /* _XawInit_ */ diff --git a/vendor/x11iraf/obm/README b/vendor/x11iraf/obm/README new file mode 100644 index 00000000..e97a5880 --- /dev/null +++ b/vendor/x11iraf/obm/README @@ -0,0 +1,9 @@ +OBM -- Object Manager library. This library implements a window system +toolkit as an interpreted window-object language, allowing application GUIs +to be defined and executed at runtime without compiling any code, and with +minimal dependence upon the underlying window system toolkit library. +The object manager is used in X11 client applications such as the IRAF widget +server, which is basically just the object manager packaged as a server that +remote client applications can connect to to download and execute a GUI. + +See obm.c for an overview of the library. diff --git a/vendor/x11iraf/obm/Tcl/Imakefile b/vendor/x11iraf/obm/Tcl/Imakefile new file mode 100644 index 00000000..dca178ec --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/Imakefile @@ -0,0 +1,224 @@ +XCOMM Imakefile for maintaining Tcl in the Object Manager library. +XCOMM 05-Sep-93, Doug Tody NOAO/IRAF. +XCOMM 28-Aug-96, Mike Fitzpatrick NOAO/IRAF. (Revised) + +X11IRAFDIR = ../../ +#include <../../X11IRAF.tmpl> + +XCOMM ------------------ BEGIN TCL DEFINITIONS ---------------------- + + TCL_LIBRARY = /usr/local/lib/tcl + SRC_DIR = . + + +#if defined(MacIIArchitecture) +XCOMM - The following are for Macintosh A/UX + GCC_FLAGS = -w -Wunused -traditional + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_STDLIB_H=1 -DNO_STRING_H=1 \ + -DNEED_MATHERR=1 + COMPAT_OBJS = strerror.o strtoul.o tclMtherr.o +#else + +#if defined(PpcDarwinArchitecture) || defined (TenonServer) +XCOMM - The following are for OS X on a PowerPC +#if ((OSMajorVersion == 10) && (OSMinorVersion < 4)) + CPP_FLAGS = -traditional-cpp +#else + CPP_FLAGS = +#endif + GCC_FLAGS = -DNOSTDHDRS -DSYSV -DANSI -D_BSD_SOURCE -W \ + $(CPP_FLAGS) -fstrength-reduce -fpcc-struct-return + AC_FLAGS = $(CPP_FLAGS) -DHAVE_UNISTD_H=1 + CFLAGS += $(CPP_FLAGS) -I. $(AC_FLAGS) $(GCC_FLAGS) + COMPAT_OBJS = +#else + +#if defined(SunArchitecture) && (OSMajorVersion <= 4) +XCOMM - The following are for SunOS + GCC_FLAGS = + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_FLOAT_H=1 -DNO_STDLIB_H=1 \ + -DNO_STRING_H=1 -DNEED_MATHERR=1 + COMPAT_OBJS = strerror.o strtoul.o tclMtherr.o +#else + +#if defined(SunArchitecture) && !defined (i386Architecture) +XCOMM - The following are for SunSoft/Solaris +# Hack to compile under SunPRO V4 on Solaris + CCOPTIONS = -Xs + EXTRA_LDOPTIONS = -xildoff + GCC_FLAGS = + AC_FLAGS = -DNO_GETWD=1 -DNO_WAIT3=1 -DHAVE_UNISTD_H=1 \ + -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -DUSE_STDARG + COMPAT_OBJS = tclMtherr.o +#else + +#if defined(SunArchitecture) && defined (i386Architecture) +XCOMM - The following are for Solaris x86 + CCOPTIONS = + EXTRA_LDOPTIONS = + GCC_FLAGS = + AC_FLAGS = -DNO_GETWD=1 -DNO_WAIT3=1 -DHAVE_UNISTD_H=1 \ + -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o +#else + +#if defined(FreeBSDArchitecture) +XCOMM - The following are for FreeBSD + GCC_FLAGS = -DNOSTDHDRS -DSYSV -DANSI -D_BSD_SOURCE -W \ + -fstrength-reduce -fpcc-struct-return + AC_FLAGS = -DHAVE_UNISTD_H=1 + CFLAGS += -I. $(AC_FLAGS) $(GCC_FLAGS) + COMPAT_OBJS = +#else + +#if defined(LinuxArchitecture) +XCOMM - The following are for Linux + GCC_FLAGS = -DNOSTDHDRS -DSYSV -DANSI -D_BSD_SOURCE -W \ + -fstrength-reduce -fpcc-struct-return + AC_FLAGS = -DHAVE_UNISTD_H=1 + COMPAT_OBJS = +#else + +#if defined(HPArchitecture) +XCOMM - The following are for HP-UX + GCC_FLAGS = + AC_FLAGS = -DNO_GETWD=1 -DNO_WAIT3=1 -DHAVE_UNISTD_H=1 \ + -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o +#else + +#if defined(OSF1Architecture) +XCOMM - The following are for OSF/1 on Alpha + GCC_FLAGS = + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o + +#else + +#if defined(RsArchitecture) +XCOMM - The following are for AIX on Rs/6000 + GCC_FLAGS = + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o + +#else +#if defined(cygwinArchitecture) + + GCC_FLAGS = -DUSE_STDARG + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_UNION_WAIT=1 -DNO_STDLIB_H=1 + COMPAT_OBJS = +#else + + GCC_FLAGS = + AC_FLAGS = + COMPAT_OBJS = +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif + + +# Platform flags. +#if ((GccMajorVersion == 3) && (GccMinorVersion >= 1)) + PL_FLAGS = -DUSE_STDARG +#else +#if ((GccMajorVersion == 4)) + PL_FLAGS = -DUSE_STDARG + CPP_FLAGS = -traditional-cpp +#else + PL_FLAGS = +#endif +#endif + + + DEPENDFLAGS = -I.. -I${SRC_DIR} ${AC_FLAGS} ${PL_FLAGS} + CCOPTIONS = -I.. -I${SRC_DIR} ${AC_FLAGS} ${PL_FLAGS} ${GCC_FLAGS} \ + -DTCL_LIBRARY=\"${TCL_LIBRARY}\" + +UNIX_OBJS = \ + panic.o tclEnv.o tclGlob.o tclMain.o tclUnixAZ.o \ + tclUnixStr.o tclUnixUtil.o + +GENERIC_OBJS = \ + regexp.o tclAsync.o tclBasic.o tclCkalloc.o \ + tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclExpr.o tclGet.o \ + tclHash.o tclHistory.o tclLink.o tclParse.o tclProc.o \ + tclUtil.o tclVar.o + +TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} + +XCOMM -------------------- END TCL DEFINITIONS ---------------------- + + +HEADERS = patchlevel.h tclRegexp.h tcl.h tclInt.h tclUnix.h + +SRCS = panic.c regexp.c tclAppInit.c tclAsync.c tclBasic.c \ + tclCkalloc.c tclCmdAH.c tclCmdIL.c tclCmdMZ.c tclEnv.c \ + tclExpr.c tclGet.c tclGlob.c tclHash.c tclHistory.c \ + tclLink.c tclMain.c tclMtherr.c tclParse.c tclProc.c \ + tclTest.c tclUnixAZ.c tclUnixStr.c tclUnixUtil.c tclUtil.c \ + tclVar.c + +OBJS = ${TCL_OBJS} + +SubdirLibraryRule($(OBJS)) + +XCOMM ------------------ BEGIN TCL DEFINITIONS ---------------------- +getcwd.o: $(SRC_DIR)/compat/getcwd.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/getcwd.c + +opendir.o: $(SRC_DIR)/compat/opendir.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/opendir.c + +strerror.o: $(SRC_DIR)/compat/strerror.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strerror.c + +strstr.o: $(SRC_DIR)/compat/strstr.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strstr.c + +strtod.o: $(SRC_DIR)/compat/strtod.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtod.c + +strtol.o: $(SRC_DIR)/compat/strtol.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtol.c + +strtoul.o: $(SRC_DIR)/compat/strtoul.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtoul.c + +tmpnam.o: $(SRC_DIR)/compat/tmpnam.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/tmpnam.c + +waitpid.o: $(SRC_DIR)/compat/waitpid.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/waitpid.c +XCOMM -------------------- END TCL DEFINITIONS ---------------------- + + +NormalLintTarget($(SRCS)) +LintLibraryTarget(ar,$(SRCS)) + +includes:: + MakeDir(X11irafIncDir/Tcl) + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/Tcl/$$i; \ + $(CP) -p ObmDir/Tcl/$$i X11irafIncDir/Tcl/$$i; \ + done) + +#if InstallIncludes +install:: + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/Tcl/$$i; \ + done) + for i in $(HEADERS); do \ + (set -x; $(CP) -p $$i X11irafIncDir/Tcl/); \ + done +#endif + +DependTarget() + diff --git a/vendor/x11iraf/obm/Tcl/Imakefile.ORIG b/vendor/x11iraf/obm/Tcl/Imakefile.ORIG new file mode 100644 index 00000000..83444b6d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/Imakefile.ORIG @@ -0,0 +1,163 @@ +XCOMM Imakefile for maintaining Tcl in the Object Manager library. +XCOMM 05-Sep-93, Doug Tody NOAO/IRAF. + +#include <Library.tmpl> + +XCOMM ------------------ BEGIN TCL DEFINITIONS ---------------------- + exec_prefix = /usr/local + prefix = /usr/local + + TCL_LIBRARY = $(prefix)/lib/tcl + LIB_DIR = $(exec_prefix)/lib + BIN_DIR = $(exec_prefix)/bin + SRC_DIR = . + INCLUDE_DIR = $(prefix)/include + +#if defined(MacIIArchitecture) +XCOMM - The following are for Macintosh A/UX + GCC_FLAGS = -w -Wunused -traditional + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_STDLIB_H=1 -DNO_STRING_H=1 \ + -DNEED_MATHERR=1 + COMPAT_OBJS = strerror.o strtoul.o tclMtherr.o + +#else +#if defined(SunArchitecture) && (OSMajorVersion <= 4) +XCOMM - The following are for SunOS + GCC_FLAGS = + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_FLOAT_H=1 -DNO_STDLIB_H=1 \ + -DNO_STRING_H=1 -DNEED_MATHERR=1 + + COMPAT_OBJS = \ + strerror.o strtoul.o tclMtherr.o + +#else +#if defined(SunArchitecture) +XCOMM - The following are for SunSoft/Solaris + GCC_FLAGS = + AC_FLAGS = -DNO_GETWD=1 -DNO_WAIT3=1 -DHAVE_UNISTD_H=1 \ + -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o + +#else +#if defined(LinuxArchitecture) + GCC_FLAGS = -DNOSTDHDRS -DSYSV -DANSI -D_BSD_SOURCE -W \ + -Wunused -Wcomment -fstrength-reduce -fpcc-struct-return + AC_FLAGS = -DHAVE_UNISTD_H=1 + COMPAT_OBJS = + +#else +#if defined(HPArchitecture) +XCOMM - The following are for HP-UX + GCC_FLAGS = + AC_FLAGS = -DNO_GETWD=1 -DNO_WAIT3=1 -DHAVE_UNISTD_H=1 \ + -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o + +#else +#if defined(OSF1) + GCC_FLAGS = + AC_FLAGS = -DHAVE_UNISTD_H=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 + COMPAT_OBJS = tclMtherr.o +#else + GCC_FLAGS = + AC_FLAGS = + COMPAT_OBJS = +#endif +#endif +#endif +#endif +#endif +#endif + + DEPENDFLAGS = -I.. -I${SRC_DIR} ${AC_FLAGS} + CCOPTIONS = -I.. -I${SRC_DIR} ${AC_FLAGS} ${GCC_FLAGS} \ + -DTCL_LIBRARY=\"${TCL_LIBRARY}\" + +UNIX_OBJS = \ + panic.o tclEnv.o tclGlob.o tclMain.o tclUnixAZ.o \ + tclUnixStr.o tclUnixUtil.o + +GENERIC_OBJS = \ + regexp.o tclAsync.o tclBasic.o tclCkalloc.o \ + tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclExpr.o tclGet.o \ + tclHash.o tclHistory.o tclLink.o tclParse.o tclProc.o \ + tclUtil.o tclVar.o + +TCL_OBJS = \ + ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} +XCOMM -------------------- END TCL DEFINITIONS ---------------------- + +HEADERS = \ + patchlevel.h \ + tclRegexp.h \ + tcl.h \ + tclInt.h \ + tclUnix.h + +SRCS = \ + panic.c \ + regexp.c \ + tclAppInit.c \ + tclAsync.c \ + tclBasic.c \ + tclCkalloc.c \ + tclCmdAH.c \ + tclCmdIL.c \ + tclCmdMZ.c \ + tclEnv.c \ + tclExpr.c \ + tclGet.c \ + tclGlob.c \ + tclHash.c \ + tclHistory.c \ + tclLink.c \ + tclMain.c \ + tclMtherr.c \ + tclParse.c \ + tclProc.c \ + tclTest.c \ + tclUnixAZ.c \ + tclUnixStr.c \ + tclUnixUtil.c \ + tclUtil.c \ + tclVar.c + +OBJS = \ + ${TCL_OBJS} + +SubdirLibraryRule($(OBJS)) + +XCOMM ------------------ BEGIN TCL DEFINITIONS ---------------------- +getcwd.o: $(SRC_DIR)/compat/getcwd.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/getcwd.c + +opendir.o: $(SRC_DIR)/compat/opendir.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/opendir.c + +strerror.o: $(SRC_DIR)/compat/strerror.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strerror.c + +strstr.o: $(SRC_DIR)/compat/strstr.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strstr.c + +strtod.o: $(SRC_DIR)/compat/strtod.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtod.c + +strtol.o: $(SRC_DIR)/compat/strtol.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtol.c + +strtoul.o: $(SRC_DIR)/compat/strtoul.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtoul.c + +tmpnam.o: $(SRC_DIR)/compat/tmpnam.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/tmpnam.c + +waitpid.o: $(SRC_DIR)/compat/waitpid.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/waitpid.c +XCOMM -------------------- END TCL DEFINITIONS ---------------------- + + +NormalLintTarget($(SRCS)) +LintLibraryTarget(ar,$(SRCS)) + +DependTarget() diff --git a/vendor/x11iraf/obm/Tcl/Makefile b/vendor/x11iraf/obm/Tcl/Makefile new file mode 100644 index 00000000..4182d6a0 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/Makefile @@ -0,0 +1,1136 @@ +# Makefile generated by imake - do not edit! +# $Xorg: imake.c,v 1.6 2001/02/09 02:03:15 xorgcvs Exp $ + +# ---------------------------------------------------------------------- +# Makefile generated from "Imake.tmpl" and </tmp/IIf.t1R7HV> +# $Xorg: Imake.tmpl,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/Imake.tmpl,v 3.138 2002/12/10 03:20:41 dawes Exp $ +# ---------------------------------------------------------------------- + +all:: + +.SUFFIXES: .i + +# $Xorg: Imake.cf,v 1.4 2000/08/17 19:41:45 cpqbld Exp $ + +# $XFree86: xc/config/cf/Imake.cf,v 3.80 2003/01/15 02:52:12 dawes Exp $ + +# Keep cpp from replacing path elements containing i486/i586/i686 + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that need to come before +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# $XFree86: xc/config/cf/xf86site.def,v 3.181 2002/02/22 21:32:33 dawes Exp $ + +# ---------------------------------------------------------------------- +# platform-specific configuration parameters - edit linux.cf to change + +# platform: $Xorg: linux.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ + +# platform: $XFree86: xc/config/cf/linux.cf,v 3.201tsi Exp $ + +# operating system: Linux 2.4.29-4aslsmp i686 [ELF] (2.4.29) +# libc: (6.3.2) +# binutils: (213) + +# $Xorg: lnxLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.rules,v 3.43 2002/04/04 14:05:33 eich Exp $ + +# $XFree86: xc/config/cf/xfree86.cf,v 3.439.2.1 2003/03/13 04:10:40 tsi Exp $ + +# $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ + +VENDORMANNAME = XFree86 +VENDORMANVERSION = `echo 4 3 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + +AFB_DEFS = -DUSE_AFB + +DRIVERSDKDIR = $(USRLIBDIR)/Server +DRIVERSDKMODULEDIR = $(USRLIBDIR)/Server/modules +DRIVERSDKINCLUDEDIR = $(USRLIBDIR)/Server/include + + XF86SRC = $(SERVERSRC)/hw/xfree86 + XF86COMSRC = $(XF86SRC)/common + XF86PARSERSRC = $(XF86SRC)/parser + XF86OSSRC = $(XF86SRC)/os-support + XF86DRIVERSRC = $(XF86SRC)/drivers + DRIVERSRC = $(XF86DRIVERSRC) + + XFREE86DOCDIR = $(DOCDIR) + XFREE86PSDOCDIR = $(DOCPSDIR) + XFREE86HTMLDOCDIR = $(DOCHTMLDIR) +XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese + +# $Xorg: xf86.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ + +# $XFree86: xc/config/cf/xf86.rules,v 3.33 2001/01/17 16:38:51 dawes Exp $ + +# ---------------------------------------------------------------------- +# site-specific configuration parameters that go after +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# --------------------------------------------------------------------- +# Imake rules for building libraries, programs, scripts, and data files +# rules: $Xorg: Imake.rules,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# rules: $XFree86: xc/config/cf/Imake.rules,v 3.112 2002/11/14 21:01:13 tsi Exp $ + + _NULLCMD_ = @ echo -n + +GLIDE2INCDIR = /usr/include/glide + +GLIDE3INCDIR = /usr/include/glide3 + +GLIDE3LIBNAME = glide3 + +TKLIBNAME = + +TKLIBDIR = + +TCLLIBNAME = + +TCLIBDIR = + + PATHSEP = / + SHELL = /bin/sh -e + + TOP = ../.. + CURRENT_DIR = obm/Tcl + + IMAKE = imake + DEPEND = gccmakedep + MKDIRHIER = mkdir -p + REVPATH = revpath + EXPORTLISTGEN = + RMAN = rman + RMANBASENAME = rman + RMANOPTIONS = -f HTML + CONFIGSRC = $(TOP)/config + IMAKESRC = $(CONFIGSRC)/imake + DEPENDSRC = $(CONFIGSRC)/util + + INCROOT = /usr/X11R6/include + USRLIBDIR = /usr/X11R6/lib + VARDIR = /var + VARLIBDIR = $(VARDIR)/lib + SYSTEMUSRLIBDIR = /usr/lib + SYSTEMUSRINCDIR = /usr/include + SHLIBDIR = /usr/X11R6/lib + LINTLIBDIR = $(USRLIBDIR)/lint + MANPATH = /usr/X11R6/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(MANSOURCEPATH)1 + LIBMANDIR = $(MANSOURCEPATH)3 + FILEMANDIR = $(MANSOURCEPATH)5 + MISCMANDIR = $(MANSOURCEPATH)7 + DRIVERMANDIR = $(MANSOURCEPATH)4 + ICONDIR = /usr/share/icons + XCURSORPATH = "~/.icons:/usr/share/icons:/usr/share/pixmaps" + LOGDIRECTORY = $(VARDIR)/log + + VARRUNDIR = $(VARDIR)/run + + VARDBDIR = $(VARDIR)/lib + + AR = ar clq + +# Nice try but useless: make will inherit BOOTSTRAPCFLAGS +# from top Makefile + BOOTSTRAPCFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -pipe + + CC = gcc -m32 + AS = gcc -m32 -c -x assembler + +.SUFFIXES: .cc + + CXX = c++ -m32 + + CXXFILT = c++filt + CXXLIB = + CXXDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe +CXXDEPENDINCLUDES = + CXXEXTRA_DEFINES = +CXXEXTRA_INCLUDES = + CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(CXXPROJECT_DEFINES) + CXXOPTIONS = + CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) + CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(DEFINES) $(CXXEXTRA_DEFINES) + CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) + + COMPRESS = compress + GZIPCMD = gzip + + CPP = /usr/bin/cpp $(STD_CPP_DEFINES) + RAWCPP = /usr/bin/cpp -undef $(STD_CPP_OPTIONS) + PREPROCESSCMD = gcc -m32 -E $(STD_CPP_DEFINES) + + INSTALL = install + INSTALLFLAGS = -c + + LD = gcc -m32 -nostdlib + + LEX = flex -l + M4 = m4 + M4FLAGS = + LEXLIB = -lfl + YACC = bison -y + CCYACC = bison -y + + LINT = lint + + LINTLIBFLAG = -C + LINTOPTS = -axz + LN = ln -s + MAKE = make + MV = mv -f + CP = cp + + RANLIB = ranlib + + RANLIBINSTFLAGS = + + RM = rm -f + PERL = perl + PERLOPTS = + MANSUFFIX = 1x + LIBMANSUFFIX = 3x + FILEMANSUFFIX = 5x + MISCMANSUFFIX = 7x + DRIVERMANSUFFIX = 4x + MANSRCSUFFIX = man + MANNEWSUFFIX = _man + MANDEFS = -D__apploaddir__=$(XAPPLOADDIR) -D__filemansuffix__=$(FILEMANSUFFIX) -D__libmansuffix__=$(LIBMANSUFFIX) -D__miscmansuffix__=$(MISCMANSUFFIX) -D__drivermansuffix__=$(DRIVERMANSUFFIX) -D__projectroot__=$(PROJECTROOT) $(XORGMANDEFS) $(VENDORMANDEFS) + + COMPRESSMANCMD = gzip -n + + TROFF = groff -Tps + NROFF = nroff + MSMACROS = -ms + MANMACROS = -man + TBL = tbl + EQN = eqn + NEQN = neqn + COL = col + COLFLAGS = -b + + MODCC = gcc -m32 + + MODCPP = /usr/bin/cpp + MODCFLAGS = $(CFLAGS) + MODAS = gcc -m32 -c -x assembler + MODASFLAGS = + + MODLD = gcc -m32 -nostdlib + + MODLDFLAGS = +MODLDCOMBINEFLAGS = -r + MODAR = ar clq + + MODRANLIB = ranlib + + STD_INCLUDES = + STD_CPP_OPTIONS = -traditional + STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) + STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) + EXTRA_LOAD_FLAGS = + EXTRA_LDOPTIONS = + EXTRA_LIBRARIES = + TAGS = ctags + + PARALLELMFLAGS = + + SHAREDCODEDEF = + SHLIBDEF = + + SHLIBLDFLAGS = -shared $(SHLIBGLOBALSFLAGS) + + PICFLAGS = -fPIC + + CXXPICFLAGS = -fPIC + + PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO + + INSTPGMFLAGS = + + INSTBINFLAGS = -m 0755 + INSTUIDFLAGS = -m 4711 + INSTLIBFLAGS = -m 0644 + INSTINCFLAGS = -m 0444 + INSTMANFLAGS = -m 0444 + INSTDATFLAGS = -m 0444 + INSTKMEMFLAGS = -m 4711 + + PROJECTROOT = /usr/X11R6 + + CDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe + CCOPTIONS = + + ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) + LDPRELIB = -L$(USRLIBDIR) $(INSTALLED_LIBS) + LDPOSTLIB = + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + + LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + + CCLINK = $(CC) + + CXXLINK = $(CXX) + + LDSTRIPFLAGS = -x + LDCOMBINEFLAGS = -r + DEPENDFLAGS = + DEPEND_DEFINES = + +# Not sure this belongs here + TKLIBDIR = + TKINCDIR = + TKLIBNAME = + TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME) + TCLLIBDIR = + TCLINCDIR = + TCLLIBNAME = + TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME) + + MACROFILE = linux.cf + RM_CMD = $(RM) + + IMAKE_DEFINES = + IMAKE_WARNINGS = -Wundef + + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_WARNINGS) + + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) + +# $Xorg: X11.rules,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/X11.rules,v 1.5 2000/11/06 19:24:00 dawes Exp $ + +# ---------------------------------------------------------------------- +# X Window System Build Parameters and Rules +# $Xorg: X11.tmpl,v 1.6 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/X11.tmpl,v 1.196.2.2 2003/09/17 05:58:15 herrb Exp $ + +XORGRELSTRING = Release 6.6 +XORGMANNAME = X Version 11 + +VENDORMANNAME = XFree86 +VENDORMANVERSION = `echo 4 3 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + +STICKY_DEFINES = -DHAS_STICKY_DIR_BIT + +FCHOWN_DEFINES = -DHAS_FCHOWN + +# ----------------------------------------------------------------------- +# X Window System make variables; these need to be coordinated with rules + + XTOP = $(TOP) + BINDIR = /usr/X11R6/bin + BUILDINCROOT = $(TOP)/exports + BUILDINCDIR = $(BUILDINCROOT)/include + BUILDINCTOP = ../.. + BUILDLIBDIR = $(TOP)/exports/lib + BUILDLIBTOP = ../.. + BUILDBINDIR = $(TOP)/exports/bin + BUILDBINTOP = ../.. + BUILDMODULEDIR = $(BUILDLIBDIR)/modules + BUILDMODULETOP = $(BUILDLIBTOP)/.. + XBUILDINCROOT = $(XTOP)/exports + XBUILDINCDIR = $(XBUILDINCROOT)/include/X11 + XBUILDINCTOP = ../../.. + XBUILDBINDIR = $(XBUILDINCROOT)/bin + INCDIR = $(INCROOT) + ADMDIR = /var/log + LIBDIR = /usr/X11R6/lib/X11 + LIBEXECDIR = /usr/X11R6/libexec + MODULEDIR = $(USRLIBDIR)/modules + TOP_X_INCLUDES = + + ETCX11DIR = /etc/X11 + + CONFDIR = $(ETCX11DIR) + + DOCDIR = $(LIBDIR)/doc + DOCHTMLDIR = $(DOCDIR)/html + DOCPSDIR = $(DOCDIR)/PostScript + FONTDIR = $(LIBDIR)/fonts + ENCODINGSDIR = $(FONTDIR)/encodings + XINITDIR = /etc/X11/xinit + XDMDIR = /etc/X11/xdm + XDMVARDIR = $(VARLIBDIR)/xdm + TWMDIR = $(LIBDIR)/twm + XSMDIR = $(LIBDIR)/xsm + NLSDIR = $(LIBDIR)/nls + XLOCALEDIR = $(LIBDIR)/locale + PEXAPIDIR = $(LIBDIR)/PEX + LBXPROXYDIR = /etc/X11/lbxproxy + PROXYMANAGERDIR = /etc/X11/proxymngr + XPRINTDIR = /etc/X11/xserver + XAPPLOADDIR = $(LIBDIR)/app-defaults + FONTCFLAGS = -t + + INSTAPPFLAGS = $(INSTDATFLAGS) + + RGB = $(BINDIR)/rgb + FONTC = $(BINDIR)/bdftopcf + MKFONTDIR = $(BINDIR)/mkfontdir + MKHTMLINDEX = $(BINDIR)/mkhtmlindex + UCS2ANY = $(BINDIR)/ucs2any + BDFTRUNCATE = $(BINDIR)/bdftruncate + UCSMAPPREFIX = $(FONTDIR)/util/map- + XCURSORGEN = $(BINDIR)/xcursorgen + + HTMLINDEXCMD = HtmlIndexCmd + + DOCUTILSRC = $(XTOP)/doc/util + CLIENTSRC = $(TOP)/clients + DEMOSRC = $(TOP)/demos + XDOCMACROS = $(DOCUTILSRC)/macros.t + XIDXMACROS = $(DOCUTILSRC)/indexmacros.t + PROGRAMSRC = $(TOP)/programs + LIBSRC = $(XTOP)/lib + FONTSRC = $(XTOP)/fonts + ENCODINGSSRC = $(FONTSRC)/encodings + INCLUDESRC = $(BUILDINCROOT)/include + XINCLUDESRC = $(INCLUDESRC)/X11 + SERVERSRC = $(XTOP)/programs/Xserver + CONTRIBSRC = $(XTOP)/../contrib + UNSUPPORTEDSRC = $(XTOP)/unsupported + DOCSRC = $(XTOP)/doc + RGBSRC = $(XTOP)/programs/rgb + BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf + MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir + FONTSERVERSRC = $(PROGRAMSRC)/xfs + FONTINCSRC = $(XTOP)/include/fonts + EXTINCSRC = $(XTOP)/include/extensions + FTSOURCEDIR = $(TOP)/extras/FreeType + XTTSOURCEDIR = $(TOP)/extras/X-TrueType + MESASRCDIR = $(TOP)/extras/Mesa + OGLSAMPLESRCDIR = $(TOP)/extras/ogl-sample + PSWRAPSRC = $(XTOP)/config/pswrap + TRANSCOMMSRC = $(LIBSRC)/xtrans + TRANS_INCLUDES = -I$(TRANSCOMMSRC) + CONNECTION_FLAGS = -DUNIXCONN -DTCPCONN $(STICKY_DEFINES) $(FCHOWN_DEFINES) + + XORGMANDEFS = -D__xorgversion__='"$(XORGRELSTRING)" "$(XORGMANNAME)"' + VENDORMANDEFS = -D__vendorversion__="\"Version $(VENDORMANVERSION)\" $(VENDORMANNAME)" + + XENVLIBDIR = $(USRLIBDIR) + CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR) + +# $Xorg: lnxLib.tmpl,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.tmpl,v 3.13 2001/01/17 16:22:32 dawes Exp $ + + XLIBSRC = $(LIBSRC)/X11 + +SOXLIBREV = 6.2 +DEPXONLYLIB = +XONLYLIB = -lX11 + +LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln + + XLIBONLY = $(XONLYLIB) + + XEXTLIBSRC = $(LIBSRC)/Xext + +SOXEXTREV = 6.4 +DEPEXTENSIONLIB = +EXTENSIONLIB = -lXext + +LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln + +LINTEXTENSIONLIB = $(LINTEXTENSION) + DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) + XLIB = $(EXTENSIONLIB) $(XONLYLIB) + LINTXLIB = $(LINTXONLYLIB) + + XSSLIBSRC = $(LIBSRC)/Xss + +DEPXSSLIB = $(USRLIBDIR)/libXss.a +XSSLIB = -lXss + +LINTXSS = $(LINTLIBDIR)/llib-lXss.ln + + XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc + +DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a +XXF86MISCLIB = -lXxf86misc + +LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln + + XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm + +DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a +XXF86VMLIB = -lXxf86vm + +LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln + + XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga + +DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a +XXF86DGALIB = -lXxf86dga + +LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln + + XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush + +DEPXXF86RUSHLIB = $(USRLIBDIR)/libXxf86rush.a +XXF86RUSHLIB = -lXxf86rush + +LINTXXF86RUSH = $(LINTLIBDIR)/llib-lXxf86rush.ln + + XVLIBSRC = $(LIBSRC)/Xv + +SOXVREV = 1.0 +DEPXVLIB = +XVLIB = -lXv + +LINTXV = $(LINTLIBDIR)/llib-lXv.ln + + XVMCLIBSRC = $(LIBSRC)/XvMC + +DEPXVMCLIB = $(USRLIBDIR)/libXvMC.a +XVMCLIB = -lXvMC + +LINTXVMC = $(LINTLIBDIR)/llib-lXvMC.ln + + XINERAMALIBSRC = $(LIBSRC)/Xinerama + +DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a +XINERAMALIB = -lXinerama + +LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln + + XRESLIBSRC = $(LIBSRC)/XRes + +DEPXRESLIB = $(USRLIBDIR)/libXRes.a +XRESLIB = -lXRes + +LINTXRES = $(LINTLIBDIR)/llib-lXRes.ln + + DPSLIBSRC = $(LIBSRC)/dps + +SODPSREV = 1.0 +DEPDPSLIB = +DPSLIB = -ldps + +LINTDPS = $(LINTLIBDIR)/llib-ldps.ln + + DPSTKLIBSRC = $(LIBSRC)/dpstk + +SODPSTKREV = 1.0 +DEPDPSTKLIB = +DPSTKLIB = -ldpstk + +LINTDPSTK = $(LINTLIBDIR)/llib-ldpstk.ln + + PSRESLIBSRC = $(LIBSRC)/psres + +SOPSRESREV = 1.0 +DEPPSRESLIB = +PSRESLIB = -lpsres + +LINTPSRES = $(LINTLIBDIR)/llib-lpsres.ln + + GLULIBSRC = $(LIBSRC)/GLU + +SOGLUREV = 1.3 +DEPGLULIB = +GLULIB = -lGLU + +LINTGLU = $(LINTLIBDIR)/llib-lGLU.ln + + GLXLIBSRC = $(LIBSRC)/GL + +SOGLREV = 1.2 +DEPGLXLIB = +GLXLIB = -lGL + +LINTGLX = $(LINTLIBDIR)/llib-lGL.ln + + GLWIDGETSRC = $(LIBSRC)/GLw + +DEPGLWLIB = $(USRLIBDIR)/libGLw.a +GLWLIB = -lGLw + +LINTGLW = $(LINTLIBDIR)/llib-lGLw.ln + + XRENDERLIBSRC = $(LIBSRC)/Xrender + +SOXRENDERREV = 1.2 +DEPXRENDERLIB = +XRENDERLIB = -lXrender + +LINTXRENDER = $(LINTLIBDIR)/llib-lXrender.ln + + XRANDRRLIBSRC = $(LIBSRC)/Xrandr + +SOXRANDRREV = 2.0 +DEPXRANDRLIB = +XRANDRLIB = -lXrandr + +LINTXRANDR = $(LINTLIBDIR)/llib-lXrandr.ln + + XCURSORRLIBSRC = $(LIBSRC)/Xcursor + +SOXCURSORREV = 1.0 +DEPXCURSORLIB = +XCURSORLIB = -lXcursor + +LINTXCURSOR = $(LINTLIBDIR)/llib-lXcursor.ln + + XFONTCACHELIBSRC = $(LIBSRC)/Xfontcache + +DEPXFONTCACHELIB = $(USRLIBDIR)/libXfontcache.a +XFONTCACHELIB = -lXfontcache + +LINTXFONTCACHE = $(LINTLIBDIR)/llib-lXfontcache.ln + + XAUTHSRC = $(LIBSRC)/Xau + +DEPXAUTHLIB = $(USRLIBDIR)/libXau.a +XAUTHLIB = -lXau + +LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln + + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + +DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a +XDMCPLIB = -lXdmcp + +LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln + + XMUSRC = $(LIBSRC)/Xmu + +SOXMUREV = 6.2 +DEPXMULIB = +XMULIB = -lXmu + +LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln + + XMUUSRC = $(LIBSRC)/Xmuu + +SOXMUUREV = 1.0 +DEPXMUULIB = +XMUULIB = -lXmuu + +LINTXMUU = $(LINTLIBDIR)/llib-lXmuu.ln + + OLDXLIBSRC = $(LIBSRC)/oldX + +DEPOLDXLIB = $(USRLIBDIR)/liboldX.a +OLDXLIB = -loldX + +LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln + + XPLIBSRC = $(LIBSRC)/Xp + +SOXPREV = 6.2 +DEPXPLIB = +XPLIB = -lXp + +LINTXP = $(LINTLIBDIR)/llib-lXp.ln + + TOOLKITSRC = $(LIBSRC)/Xt + +SOXTREV = 6.0 +DEPXTOOLONLYLIB = +XTOOLONLYLIB = -lXt + +LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln + + DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) + XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) + LINTXTOOLLIB = $(LINTXTOOLONLYLIB) + + XALIBSRC = $(LIBSRC)/Xa + +SOXAREV = 1.0 +DEPXALIB = +XALIB = -lXa + +LINTXA = $(LINTLIBDIR)/llib-lXa.ln + + AWIDGETSRC = $(LIBSRC)/Xaw + +SOXAWREV = 7.0 +DEPXAWLIB = +XAWLIB = -lXaw + +LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln + + AWIDGET6SRC = $(LIBSRC)/Xaw6 + +SOXAW6REV = 6.1 +DEPXAW6LIB = +XAW6LIB = -lXaw + +LINTXAW6 = $(LINTLIBDIR)/llib-lXaw.ln + + XILIBSRC = $(LIBSRC)/Xi + +SOXINPUTREV = 6.0 +DEPXILIB = +XILIB = -lXi + +LINTXI = $(LINTLIBDIR)/llib-lXi.ln + + XTESTLIBSRC = $(LIBSRC)/Xtst + +SOXTESTREV = 6.1 +DEPXTESTLIB = +XTESTLIB = -lXtst + +LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln + + PEXLIBSRC = $(LIBSRC)/PEX5 + +SOPEXREV = 6.0 +DEPPEXLIB = +PEXLIB = -lPEX5 + +LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln + + XIELIBSRC = $(LIBSRC)/XIE + +SOXIEREV = 6.0 +DEPXIELIB = +XIELIB = -lXIE + +LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln + + PHIGSLIBSRC = $(LIBSRC)/PHIGS + +DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a +PHIGSLIB = -lphigs + +LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln + +DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a +XBSDLIB = -lXbsd + +LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln + + ICESRC = $(LIBSRC)/ICE + +SOICEREV = 6.3 +DEPICELIB = +ICELIB = -lICE + +LINTICE = $(LINTLIBDIR)/llib-lICE.ln + + SMSRC = $(LIBSRC)/SM + +SOSMREV = 6.0 +DEPSMLIB = +SMLIB = -lSM + +LINTSM = $(LINTLIBDIR)/llib-lSM.ln + + XKEYSRC = $(LIBSRC)/Xkey + +SOXKEYREV = 6.0 +DEPXKEYLIB = +XKEYLIB = -lXkey + +LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln + + FSLIBSRC = $(LIBSRC)/FS + +DEPFSLIB = $(USRLIBDIR)/libFS.a +FSLIB = -lFS + +LINTFS = $(LINTLIBDIR)/llib-lFS.ln + + FONTLIBSRC = $(LIBSRC)/font + +SOFONTREV = 1.4 +DEPFONTLIB = +FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln +# +SOFONTREV = 1.4 +DEPXFONTLIB = +XFONTLIB = -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln + + FONTSTUBLIBSRC = $(FONTLIBSRC)/stubs + +DEPFONTSTUBLIB = $(USRLIBDIR)/libfntstubs.a +FONTSTUBLIB = -lfntstubs + +LINTFONTSTUB = $(LINTLIBDIR)/llib-lfntstubs.ln + DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) + FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) $(FONTFT2LIB) + + FONTENCLIBSRC = $(LIBSRC)/fontenc + +DEPXFONTENCLIB = $(USRLIBDIR)/libfontenc.a +XFONTENCLIB = -lfontenc + +LINTXFONTENC = $(LINTLIBDIR)/llib-lfontenc.ln + + XPMLIBSRC = $(LIBSRC)/Xpm + +SOXPMREV = 4.11 +DEPXPMLIB = +XPMLIB = -lXpm + +LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln + +FREETYPE2DIR = /usr +FREETYPE2LIBDIR = /usr/lib +FREETYPE2INCDIR = /usr/include/freetype2 + +FREETYPE2LIB = -lfreetype + +FREETYPE2INCLUDES = -I$(FREETYPE2INCDIR) +FREETYPE2DEFINES = -DFREETYPE2 + + EXPATLIBSRC = $(LIBSRC)/expat + +SOEXPATREV = 1.0 +DEPEXPATLIB = +EXPATLIB = -lexpat + +LINTEXPAT = $(LINTLIBDIR)/llib-lexpat.ln + +EXPATDIR = /usr +EXPATLIBDIR = /usr/lib +EXPATINCDIR = /usr/include + +EXPATINCLUDES = + +EXPATLIB = -lexpat + +EXPATDEFINES = -DEXPAT + + XFT1LIBSRC = $(LIBSRC)/Xft1 + +SOXFT1REV = 1.1 +DEPXFT1LIB = +XFT1LIB = -lXft + +LINTXFT1 = $(LINTLIBDIR)/llib-lXft.ln + + XFTLIBSRC = $(LIBSRC)/Xft + +SOXFTREV = 2.1 +DEPXFTLIB = +XFTLIB = -lXft + +LINTXFT = $(LINTLIBDIR)/llib-lXft.ln + +XFTINCLUDES=$(FONTCONFIGINCLUDES) $(FREETYPE2INCLUDES) + +FONTCONFIGDIR = /usr +FONTCONFIGLIBDIR = /usr/lib +FONTCONFIGINCDIR = /usr/include +FONTCONFIGBINDIR = /usr/bin + +FONTCONFIGLIB = -lfontconfig + +FONTCONFIGINCLUDES = + +FCCACHE = $(FONTCONFIGBINDIR)/fc-cache + +FONTCONFIGDEFINES = -DFONTCONFIG + +LIBPNGINCDIR = /usr/include + +LIBPNGINC= + +LIBPNGDIR = /usr +LIBPNGLIBDIR = /usr/lib +LIBPNGINCDIR = /usr/include + +LIBPNGLIB = -lpng + + XKBFILELIBSRC = $(LIBSRC)/xkbfile + +DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a +XKBFILELIB = -lxkbfile + +LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln + + XKBCOMPCMD = $(BINDIR)/xkbcomp + + XKBUILIBSRC = $(LIBSRC)/xkbui + +DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a +XKBUILIB = -lxkbui + +LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln + + XTRAPLIBSRC = $(LIBSRC)/XTrap + +SOXTRAPREV = 6.4 +DEPXTRAPLIB = +XTRAPLIB = -lXTrap + +LINTXTRAP = $(LINTLIBDIR)/llib-lXTrap.ln + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + + DEPLIBS1 = $(DEPLIBS) + DEPLIBS2 = $(DEPLIBS) + DEPLIBS3 = $(DEPLIBS) + DEPLIBS4 = $(DEPLIBS) + DEPLIBS5 = $(DEPLIBS) + DEPLIBS6 = $(DEPLIBS) + DEPLIBS7 = $(DEPLIBS) + DEPLIBS8 = $(DEPLIBS) + DEPLIBS9 = $(DEPLIBS) + DEPLIBS10 = $(DEPLIBS) + +XMULIBONLY = -lXmu +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) + + CONFIGDIR = $(LIBDIR)/config + + USRLIBDIRPATH = $(USRLIBDIR) + LDPRELIBS = -L$(USRLIBDIR) $(INSTALLED_LIBS) + LDPOSTLIBS = + TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES) + PROJECT_DEFINES = + +CXXPROJECT_DEFINES = + +# ---------------------------------------------------------------------- +# start of Imakefile + +# Imakefile for maintaining Tcl in the Object Manager library. +# 05-Sep-93, Doug Tody NOAO/IRAF. +# 28-Aug-96, Mike Fitzpatrick NOAO/IRAF. (Revised) + +X11IRAFDIR = ../../ + +# $Xorg: Library.tmpl,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/Library.tmpl,v 3.20 2002/11/25 14:04:47 eich Exp $ + + CC = gcc -m32 + + CCOPTIONS = +STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) +CDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe +CLIBDEBUGFLAGS = + CFLAGS = $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) + +LIB_MT_DEFINES = LibraryMTDefines + +SOSYMLINK = true + + X11IRAFBINDIR = $(X11IRAFDIR)/bin + X11IRAFMANDIR = $(X11IRAFDIR)/man + X11IRAFLIBDIR = $(X11IRAFDIR)/lib + X11IRAFINCDIR = $(X11IRAFDIR)/include + + XGTERMDIR = $(X11IRAFDIR)/xgterm + XIMTOOLDIR = $(X11IRAFDIR)/ximtool + XTAPEMONDIR = $(X11IRAFDIR)/xtapemon + OBMSHDIR = $(X11IRAFDIR)/obmsh + OBMDIR = $(X11IRAFDIR)/obm + XPMDIR = $(X11IRAFDIR)/xpm + XAW3DDIR = $(X11IRAFDIR)/xaw3d + CDLDIR = $(X11IRAFDIR)/cdl + + DEPLIBOBM = $(OBMDIR)/libobm.a + LIBOBM = -lobm + DEPLIBXPM = $(XPMDIR)/libXpm.a + LIBXPM = -lXpm + DEPLIBXAW3D = $(XAW3DDIR)/libXaw3d.a + LIBXAW3D = -lXaw3d + LIBCDL = -lcdl + + X11IRAF_LDFLAGS = -L$(X11IRAFDIR)/lib -L../lib + X11IRAF_INCLUDES = -I$(X11IRAFDIR)/include -I../include + + CP = cp -p + +# ------------------ BEGIN TCL DEFINITIONS ---------------------- + + TCL_LIBRARY = /usr/local/lib/tcl + SRC_DIR = . + +# - The following are for Linux + GCC_FLAGS = -DNOSTDHDRS -DSYSV -DANSI -D_BSD_SOURCE -W -fstrength-reduce -fpcc-struct-return + + AC_FLAGS = -DHAVE_UNISTD_H=1 + COMPAT_OBJS = + +# Platform flags. + + PL_FLAGS = -DUSE_STDARG + + DEPENDFLAGS = -I.. -I${SRC_DIR} ${AC_FLAGS} ${PL_FLAGS} + CCOPTIONS = -I.. -I${SRC_DIR} ${AC_FLAGS} ${PL_FLAGS} ${GCC_FLAGS} -DTCL_LIBRARY=\"${TCL_LIBRARY}\" + +UNIX_OBJS = panic.o tclEnv.o tclGlob.o tclMain.o tclUnixAZ.o tclUnixStr.o tclUnixUtil.o + +GENERIC_OBJS = regexp.o tclAsync.o tclBasic.o tclCkalloc.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclExpr.o tclGet.o tclHash.o tclHistory.o tclLink.o tclParse.o tclProc.o tclUtil.o tclVar.o + +TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS} + +# -------------------- END TCL DEFINITIONS ---------------------- + +HEADERS = patchlevel.h tclRegexp.h tcl.h tclInt.h tclUnix.h + +SRCS = panic.c regexp.c tclAppInit.c tclAsync.c tclBasic.c tclCkalloc.c tclCmdAH.c tclCmdIL.c tclCmdMZ.c tclEnv.c tclExpr.c tclGet.c tclGlob.c tclHash.c tclHistory.c tclLink.c tclMain.c tclMtherr.c tclParse.c tclProc.c tclTest.c tclUnixAZ.c tclUnixStr.c tclUnixUtil.c tclUtil.c tclVar.c + +OBJS = ${TCL_OBJS} + +all:: DONE + +DONE: $(OBJS) + $(RM) $@ + touch $@ + +cleandir:: + $(RM) DONE + +# ------------------ BEGIN TCL DEFINITIONS ---------------------- +getcwd.o: $(SRC_DIR)/compat/getcwd.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/getcwd.c + +opendir.o: $(SRC_DIR)/compat/opendir.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/opendir.c + +strerror.o: $(SRC_DIR)/compat/strerror.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strerror.c + +strstr.o: $(SRC_DIR)/compat/strstr.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strstr.c + +strtod.o: $(SRC_DIR)/compat/strtod.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtod.c + +strtol.o: $(SRC_DIR)/compat/strtol.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtol.c + +strtoul.o: $(SRC_DIR)/compat/strtoul.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/strtoul.c + +tmpnam.o: $(SRC_DIR)/compat/tmpnam.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/tmpnam.c + +waitpid.o: $(SRC_DIR)/compat/waitpid.c + $(CC) -c $(CCOPTIONS) $(SRC_DIR)/compat/waitpid.c +# -------------------- END TCL DEFINITIONS ---------------------- + +lint: + $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) +lint1: + $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) + +lintlib:: llib-lar.ln + +llib-lar.ln: $(SRCS) $(EXTRALIBRARYDEPS) + $(RM) $@ + $(LINT) $(LINTLIBFLAG)ar $(LINTFLAGS) $(SRCS) + +includes:: + @if [ -d $(X11IRAFDIR)/include/Tcl ]; then \ + set +x; \ + else \ + if [ -h $(X11IRAFDIR)/include/Tcl ]; then \ + (set -x; rm -f $(X11IRAFDIR)/include/Tcl); \ + fi; \ + (set -x; $(MKDIRHIER) $(X11IRAFDIR)/include/Tcl); \ + fi + @(set -x; for i in $(HEADERS); do $(RM) $(X11IRAFDIR)/include/Tcl/$$i; $(CP) -p $(X11IRAFDIR)/obm/Tcl/$$i $(X11IRAFDIR)/include/Tcl/$$i; done) + +install:: + @(set -x; for i in $(HEADERS); do $(RM) $(X11IRAFDIR)/include/Tcl/$$i; done) + + for i in $(HEADERS); do (set -x; $(CP) -p $$i $(X11IRAFDIR)/include/Tcl/); done + +depend:: + $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) + +# ---------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +.c.i: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ + +.SUFFIXES: .s + +.c.s: + $(RM) $@ + $(CC) -S $(CFLAGS) $(_NOOP_) $*.c + +emptyrule:: + +cleandir:: + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +man_keywords:: + +html_index:: + +clean:: cleandir + +distclean:: cleandir + +# ---------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +install.sdk:: + @echo "install.sdk in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +depend:: + +distclean:: + $(RM) Makefile Makefile.dep + +# ---------------------------------------------------------------------- +# dependencies generated by makedepend + diff --git a/vendor/x11iraf/obm/Tcl/README b/vendor/x11iraf/obm/Tcl/README new file mode 100644 index 00000000..9cb306f5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/README @@ -0,0 +1,346 @@ +Tcl + +by John Ousterhout +University of California at Berkeley +ouster@cs.berkeley.edu + +1. Introduction +--------------- + +This directory contains the sources and documentation for Tcl, an +embeddable tool command language. The information here corresponds +to release 7.3. + +2. Documentation +---------------- + +The best way to get started with Tcl is to read the draft of my +upcoming book on Tcl and Tk, which can be retrieved using anonymous +FTP from the directory "ucb/tcl" on ftp.cs.berkeley.edu. Part I of the +book provides an introduction to writing Tcl scripts and Part III +describes how to write C code that uses the Tcl C library procedures. + +The "doc" subdirectory in this release contains a complete set of manual +entries for Tcl. Files with extension ".1" are for programs (for +example, tclsh.1); files with extension ".3" are for C library procedures; +and files with extension ".n" describe Tcl commands. The file "doc/Tcl.n" +gives a quick summary of the Tcl language syntax. To print any of the man +pages, cd to the "doc" directory and invoke your favorite variant of +troff using the normal -man macros, for example + + ditroff -man Tcl.n + +to print Tcl.n. If Tcl has been installed correctly and your "man" +program supports it, you should be able to access the Tcl manual entries +using the normal "man" mechanisms, such as + + man Tcl + +3. Compiling and installing Tcl +------------------------------- + +This release should compile and run "out of the box" on any UNIX-like +system that approximates POSIX, BSD, or System V. I know that it runs +on workstations from Sun, DEC, H-P, IBM, and Silicon Graphics, and on +PC's running SCO UNIX and Xenix. To compile Tcl, do the following: + + (a) Type "./configure" in this directory. This runs a configuration + script created by GNU autoconf, which configures Tcl for your + system and creates a Makefile. The configure script allows you + to customize the Tcl configuration for your site; for details on + how you can do this, see the file "configure.info". + + (b) Type "make". This will create a library archive called "libtcl.a" + and an interpreter application called "tclsh" that allows you to type + Tcl commands interactively or execute script files. + + (c) If the make fails then you'll have to personalize the Makefile + for your site or possibly modify the distribution in other ways. + First check the file "porting.notes" to see if there are hints + for compiling on your system. If you need to modify Makefile, + there are comments at the beginning of it that describe the things + you might want to change and how to change them. + + (d) Type "make install" to install Tcl binaries and script files in + standard places. You'll need write permission on /usr/local to + do this. See the Makefile for details on where things get + installed. + + (e) At this point you can play with Tcl by invoking the "tclsh" + program and typing Tcl commands. However, if you haven't installed + Tcl then you'll first need to set your TCL_LIBRARY variable to + hold the full path name of the "library" subdirectory. + +If you have trouble compiling Tcl, I'd suggest looking at the file +"porting.notes". It contains information that people have sent me about +changes they had to make to compile Tcl in various environments. I make +no guarantees that this information is accurate, complete, or up-to-date, +but you may find it useful. If you get Tcl running on a new configuration, +I'd be happy to receive new information to add to "porting.notes". I'm +also interested in hearing how to change the configuration setup so that +Tcl compiles on additional platforms "out of the box". + +4. Test suite +------------- + +There is a relatively complete test suite for all of the Tcl core in +the subdirectory "tests". To use it just type "make test" in this +directory. You should then see a printout of the test files processed. +If any errors occur, you'll see a much more substantial printout for +each error. See the README file in the "tests" directory for more +information on the test suite. + +5. Summary of changes in recent releases +---------------------------------------- + +Tcl 7.3 is a minor release that includes only one change relative to +Tcl 7.1 (it fixes a portability problem that prevented tclMain.c from +compiling on some machines due to a missing R_OK definition). Tcl 7.3 +should be completely compatible with Tcl 7.1 and Tcl 7.0. + +Tcl 7.2 was a mistake; it was withdrawn shortly after it was released. + +Tcl 7.1 is a minor release that consists almost entirely of bug fixes. +The only feature change is to allow no arguments in invocations of "list" +and "concat". 7.1 should be completely compatible with 7.0. + +Tcl 7.0 is a major new release that includes several new features +and a few incompatible changes. For a complete list of all changes +to Tcl in chronological order, see the file "changes". Those changes +likely to cause compatibility problems with existing C code or Tcl +scripts are specially marked. The most important changes are +summarized below. + +Tcl configuration and installation has improved in several ways: + + 1. GNU autoconf is now used for configuring Tcl prior to compilation. + + 2. The "tclTest" program no longer exists. It has been replaced by + "tclsh", which is a true shell-like program based around Tcl (tclTest + didn't really work very well as a shell). There's a new program + "tcltest" which is the same as "tclsh" except that it includes a + few extra Tcl commands for testing purposes. + + 3. A new procedure Tcl_AppInit has been added to separate all of the + application-specific initialization from the Tcl main program. This + should make it easier to build new Tcl applications that include + extra packages. + + 4. There are now separate manual entries for each of the built-in + commands. The manual entry "Tcl.n", which used to describe all of + the built-ins plus many other things, now contains a terse but + complete description of the Tcl language syntax. + +Here is a list of all incompatibilities that affect Tcl scripts: + + 1. There have been several changes to backslash processing: + - Unknown backslash sequences such as "\*" are now replaced with + the following character (such as "*"); Tcl used to treat the + backslash as an ordinary character in these cases, so both the + backslash and the following character would be passed through. + - Backslash-newline now eats up any white space after the newline, + replacing the whole sequence with a single space character. Tcl + used to just remove the backslash and newline. + - The obsolete sequences \Cx, \Mx, \CMx, and \e no longer get + special treatment. + - The "format" command no longer does backslash processing on + its input string. + You can invoke the shell command below to locate backslash uses that + may potentially behave differently under Tcl 7.0. This command + will print all of the lines from the script files "*.tcl" that may + not work correctly under Tcl 7.0: + egrep '(\\$)|(\\[^][bfnrtv\0-9{}$ ;"])' *.tcl + In some cases the command may print lines that are actually OK. + + 2. The "glob" command now returns only the names of files that + actually exist, and it only returns names ending in "/" for + directories. + + 3. When Tcl prints floating-point numbers (e.g. in the "expr" command) + it ensures that the numbers contain a "." or "e" so that they don't + look like integers. + + 4. The "regsub" command now overwrites its result variable in all cases. + If there is no match, then the source string is copied to the result. + + 5. The "exec", "glob", "regexp", and "regsub" commands now include a + "--" switch; if the first non-switch argument starts with a "-" then + there must be a "--" switch or the non-switch argument will be treated + as a switch. + + 6. The keyword "UNIX" in the variable "errorCode" has been changed to + "POSIX". + + 7. The "format" and "scan" commands no longer support capitalized + conversion specifiers such as "%D" that aren't supported by ANSI + sprintf and sscanf. + +Here is a list of all of the incompatibilities that affect C code that +uses the Tcl library procedures. If you use an ANSI C compiler then +any potential problems will be detected when you compile your code: if +your code compiles cleanly then you don't need to worry about anything. + + 1. Tcl_TildeString now takes a dynamic string as an argument, which is + used to hold the result. + + 2. tclHash.h has been eliminated; its contents are now in tcl.h. + + 3. The Tcl_History command has been eliminated: the "history" command + is now automatically part of the interpreter. + + 4. The Tcl_Fork and Tcl_WaitPids procedures have been deleted (just + use fork and waitpid instead). + + 5. The "flags" and "termPtr" arguments to Tcl_Eval have been eliminated, + as has the "noSep" argument to Tcl_AppendElement and the TCL_NO_SPACE + flag for Tcl_SetVar and Tcl_SetVar2. + + 6. The Tcl_CmdBuf structure has been eliminated, along with the procedures + Tcl_CreateCmdBuf, Tcl_DeleteCmdBuf, and Tcl_AssembleCmd. Use dynamic + strings instead. + + 7. Tcl_UnsetVar and Tcl_UnsetVar2 now return TCL_OK or TCL_ERROR instead + of 0 or -1. + + 8. Tcl_UnixError has been renamed to Tcl_PosixError. + + 9. Tcl no longer redefines the library procedures "setenv", "putenv", + and "unsetenv" by default. You have to set up special configuration + in the Makefile if you want this. + +Below is a sampler of the most important new features in Tcl 7.0. Refer +to the "changes" file for a complete list. + + 1. The "expr" command supports transcendental and other math functions, + plus it allows you to type expressions in multiple arguments. Its + numerics have also been improved in several ways (e.g. support for + NaN). + + 2. The "format" command now supports XPG3 %n$ conversion specifiers. + + 3. The "exec" command supports many new kinds of redirection such as + >> and >&, plus it allows you to leave out the space between operators + like < and the file name. For processes put into the background, + "exec" returns a list of process ids. + + 4. The "lsearch" command now supports regular expressions and exact + matching. + + 5. The "lsort" command has several new switches to control the + sorting process (e.g. numerical sort, user-provided sort function, + reverse sort, etc.). + + 6. There's a new command "pid" that can be used to return the current + process ids or the process ids from an open file that refers to a + pipeline. + + 7. There's a new command "switch" that should now be used instead + of "case". It supports regular expressions and exact matches, and + also uses single patterns instead of pattern lists. "Case" is + now deprecated, although it's been retained for compatibility. + + 8. A new dynamic string library has been added to make it easier to + build up strings and lists of arbitrary length. See the manual entry + "DString.3". + + 9. Variable handling has been improved in several ways: you can + now use whole-array traces to create variables on demand, you can + delete variables during traces, you can upvar to array elements, + and you can retarget an upvar variable to stop through a sequence + of variables. Also, there's a new library procedure Tcl_LinkVar + that can be used to associate a C variable with a Tcl variable and + keep them in sync. + + 10. New library procedures Tcl_SetCommandInfo and Tcl_GetCommandInfo + allow you to set and get the clientData and callback procedure for + a command. + + 11. Added "-errorinfo" and "-errorcode" options to "return" command; + they allow much better error handling. + + 12. Made prompts in tclsh user-settable via "tcl_prompt1" and + "tcl_prompt2" variables. + + 13. Added low-level support that is needed to handle signals: see + Tcl_AsyncCreate, etc. + +6. Tcl newsgroup +----------------- + +There is a network news group "comp.lang.tcl" intended for the exchange +of information about Tcl, Tk, and related applications. Feel free to use +the newsgroup both for general information questions and for bug reports. +I read the newsgroup and will attempt to fix bugs and problems reported +to it. + +7. Tcl contributed archive +-------------------------- + +Many people have created exciting packages and applications based on Tcl +and made them freely available to the Tcl community. An archive of these +contributions is kept on the machine harbor.ecn.purdue.edu. You can +access the archive using anonymous FTP; the Tcl contributed archive is +in the directory "pub/tcl". The archive also contains an FAQ ("frequently +asked questions") document that provides solutions to problems that +are commonly encountered by TCL newcomers. + +8. Support and bug fixes +------------------------ + +I'm very interested in receiving bug reports and suggestions for +improvements. Bugs usually get fixed quickly (particularly if they +are serious), but enhancements may take a while and may not happen at +all unless there is widespread support for them (I'm trying to slow +the rate at which Tcl turns into a kitchen sink). It's almost impossible +to make incompatible changes to Tcl at this point. + +The Tcl community is too large for me to provide much individual +support for users. If you need help I suggest that you post questions +to comp.lang.tcl. I read the newsgroup and will attempt to answer +esoteric questions for which no-one else is likely to know the answer. +In addition, Tcl support and training are available commercially from +NeoSoft. For more information, send e-mail to "info@neosoft.com". + +9. Tcl release organization +--------------------------- + +Each Tcl release is identified by two numbers separated by a dot, e.g. +6.7 or 7.0. If a new release contains changes that are likely to break +existing C code or Tcl scripts then the major release number increments +and the minor number resets to zero: 6.0, 7.0, etc. If a new release +contains only bug fixes and compatible changes, then the minor number +increments without changing the major number, e.g. 7.1, 7.2, etc. If +you have C code or Tcl scripts that work with release X.Y, then they +should also work with any release X.Z as long as Z > Y. + +Beta releases have an additional suffix of the form bx. For example, +Tcl 7.0b1 is the first beta release of Tcl version 7.0, Tcl 7.0b2 is +the second beta release, and so on. A beta release is an initial +version of a new release, used to fix bugs and bad features before +declaring the release stable. Each new release will be preceded by +one or more beta releases. I hope that lots of people will try out +the beta releases and report problems back to me. I'll make new beta +releases to fix the problems, until eventually there is a beta release +that appears to be stable. Once this occurs I'll remove the beta +suffix so that the last beta release becomes the official release. + +If a new release contains incompatibilities (e.g. 7.0) then I can't +promise to maintain compatibility among its beta releases. For example, +release 7.0b2 may not be backward compatible with 7.0b1. I'll try +to minimize incompatibilities between beta releases, but if a major +problem turns up then I'll fix it even if it introduces an +incompatibility. Once the official release is made then there won't +be any more incompatibilities until the next release with a new major +version number. + +10. Compiling on non-UNIX systems +-------------------------------- + +The Tcl features that depend on system calls peculiar to UNIX (stat, +fork, exec, times, etc.) are now separate from the main body of Tcl, +which only requires a few generic library procedures such as malloc +and strcpy. Thus it should be relatively easy to compile Tcl for +non-UNIX machines such as MACs and DOS PC's, although a number of +UNIX-specific commands will be absent (e.g. exec, time, and glob). +See the comments at the top of Makefile for information on how to +compile without the UNIX features. diff --git a/vendor/x11iraf/obm/Tcl/README.OBM b/vendor/x11iraf/obm/Tcl/README.OBM new file mode 100644 index 00000000..bf6b891e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/README.OBM @@ -0,0 +1,17 @@ +README for Tcl configured as part of the IRAF Object Manager Library. + +This is the standard Tcl distribution; the only difference is the addition +of an Imakefile to allow automated building of the Tcl library as part of +the Object Manager. The Imakefile should be machine independent with one +exception, the COMPAT_OBJS definition, which lists the compatibility +routines. The list of objects defined here may have to be modified for +a different host. One way to do this is to manually run "./configure" in +this directory to build the standard Tcl Makefile, then transfer the +COMPAT_OBJS entry therein to the Imakefile. + +Tcl does not need to be installed (as in make install) to be used with the +Object Manager. The contents of the Tcl library are automatically included +in libObm.a when the library is built. The Tcl include file can be +referenced as Tcl/tcl.h, with the OBM root directory specified as an -I +include directory in the application's Imakefile. In most cases the +application using OBM need not know that Tcl is used internally. diff --git a/vendor/x11iraf/obm/Tcl/changes b/vendor/x11iraf/obm/Tcl/changes new file mode 100644 index 00000000..d920add2 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/changes @@ -0,0 +1,958 @@ +Recent user-visible changes to Tcl: + +1. No more [command1] [command2] construct for grouping multiple +commands on a single command line. + +2. Semi-colon now available for grouping commands on a line. + +3. For a command to span multiple lines, must now use backslash-return +at the end of each line but the last. + +4. "Var" command has been changed to "set". + +5. Double-quotes now available as an argument grouping character. + +6. "Return" may be used at top-level. + +7. More backslash sequences available now. In particular, backslash-newline +may be used to join lines in command files. + +8. New or modified built-in commands: case, return, for, glob, info, +print, return, set, source, string, uplevel. + +9. After an error, the variable "errorInfo" is filled with a stack +trace showing what was being executed when the error occurred. + +10. Command abbreviations are accepted when parsing commands, but +are not recommended except for purely-interactive commands. + +11. $, set, and expr all complain now if a non-existent variable is +referenced. + +12. History facilities exist now. See Tcl.man and Tcl_RecordAndEval.man. + +13. Changed to distinguish between empty variables and those that don't +exist at all. Interfaces to Tcl_GetVar and Tcl_ParseVar have changed +(NULL return value is now possible). *** POTENTIAL INCOMPATIBILITY *** + +14. Changed meaning of "level" argument to "uplevel" command (1 now means +"go up one level", not "go to level 1"; "#1" means "go to level 1"). +*** POTENTIAL INCOMPATIBILITY *** + +15. 3/19/90 Added "info exists" option to see if variable exists. + +16. 3/19/90 Added "noAbbrev" variable to prohibit command abbreviations. + +17. 3/19/90 Added extra errorInfo option to "error" command. + +18. 3/21/90 Double-quotes now only affect space: command, variable, +and backslash substitutions still occur inside double-quotes. +*** POTENTIAL INCOMPATIBILITY *** + +19. 3/21/90 Added support for \r. + +20. 3/21/90 List, concat, eval, and glob commands all expect at least +one argument now. *** POTENTIAL INCOMPATIBILITY *** + +21. 3/22/90 Added "?:" operators to expressions. + +22. 3/25/90 Fixed bug in Tcl_Result that caused memory to get trashed. + +------------------- Released version 3.1 --------------------- + +23. 3/29/90 Fixed bug that caused "file a.b/c ext" to return ".b/c". + +24. 3/29/90 Semi-colon is not treated specially when enclosed in +double-quotes. + +------------------- Released version 3.2 --------------------- + +25. 4/16/90 Rewrote "exec" not to use select or signals anymore. +Should be more Sys-V compatible, and no slower in the normal case. + +26. 4/18/90 Rewrote "glob" to eliminate GNU code (there's no GNU code +left in Tcl, now), and added Tcl_TildeSubst procedure. Added automatic +tilde-substitution in many commands, including "glob". + +------------------- Released version 3.3 --------------------- + +27. 7/11/90 Added "Tcl_AppendResult" procedure. + +28. 7/20/90 "History" with no options now defaults to "history info" +rather than to "history redo". Although this is a backward incompatibility, +it should only be used interactively and thus shouldn't present any +compatibility problems with scripts. + +29. 7/20/90 Added "Tcl_GetInteger", "Tcl_GetDouble", and "Tcl_GetBoolean" +procedures. + +30. 7/22/90 Removed "Tcl_WatchInterp" procedure: doesn't seem to be +necessary, since the same effect can be achieved with the deletion +callbacks on individual commands. *** POTENTIAL INCOMPATIBILITY *** + +31. 7/23/90 Added variable tracing: Tcl_TraceVar, Tcl_UnTraceVar, +and Tcl_VarTraceInfo procedures, "trace" command. + +32. 8/9/90 Mailed out list of all bug fixes since 3.3 release. + +33. 8/29/90 Fixed bugs in Tcl_Merge relating to backslashes and +semi-colons. Mailed out patch. + +34. 9/3/90 Fixed bug in tclBasic.c: quotes weren't quoting ]'s. +Mailed out patch. + +35. 9/19/90 Rewrote exec to always use files both for input and +output to the process. The old pipe-based version didn't work if +the exec'ed process forked a child and then exited: Tcl waited +around for stdout to get closed, which didn't happen until the +grandchild exited. + +36. 11/5/90 ERR_IN_PROGRESS flag wasn't being cleared soon enough +in Tcl_Eval, allowing error messages from different commands to +pile up in $errorInfo. Fixed by re-arranging code in Tcl_Eval that +re-initializes result and ERR_IN_PROGRESS flag. Didn't mail out +patch: changes too complicated to describe. + +37. 12/19/90 Added Tcl_VarEval procedure as a convenience for +assembling and executing Tcl commands. + +38. 1/29/91 Fixed core leak in Tcl_AddErrorInfo. Also changed procedure +and Tcl_Eval so that first call to Tcl_AddErrorInfo need not come from +Tcl_Eval. + +----------------- Released version 5.0 with Tk ------------------ + +39. 4/3/91 Removed change bars from manual entries, leaving only those +that came after version 3.3 was released. + +40. 5/17/91 Changed tests to conform to Mary Ann May-Pumphrey's approach. + +41. 5/23/91 Massive revision to Tcl parser to simplify the implementation +of string and floating-point support in expressions. Newlines inside +[] are now treated as command separators rather than word separators +(this makes newline treatment consistent throughout Tcl). +*** POTENTIAL INCOMPATIBILITY *** + +42. 5/23/91 Massive rewrite of expression code to support floating-point +values and simple string comparisons. The C interfaces to expression +routines have changed (Tcl_Expr is replaced by Tcl_ExprLong, Tcl_ExprDouble, +etc.), but all old Tcl expression strings should be accepted by the new +expression code. +*** POTENTIAL INCOMPATIBILITY *** + +43. 5/23/91 Modified tclHistory.c to check for negative "keep" value. + +44. 5/23/91 Modified Tcl_Backslash to handle backslash-newline. It now +returns 0 to indicate that a backslash sequence should be replaced by +no character at all. +*** POTENTIAL INCOMPATIBILITY *** + +45. 5/29/91 Modified to use ANSI C function prototypes. Must set +"USE_ANSI" switch when compiling to get prototypes. + +46. 5/29/91 Completed test suite by providing tests for all of the +built-in Tcl commands. + +47. 5/29/91 Changed Tcl_Concat to eliminate leading and trailing +white-space in each of the things it concatenates and to ignore +elements that are empty or have only white space in them. This +produces cleaner output from the "concat" command. +*** POTENTIAL INCOMPATIBILITY *** + +48. 5/31/91 Changed "set" command and Tcl_SetVar procedure to return +new value of variable. + +49. 6/1/91 Added "while" and "cd" commands. + +50. 6/1/91 Changed "exec" to delete the last character of program +output if it is a newline. In most cases this makes it easier to +process program-generated output. +*** POTENTIAL INCOMPATIBILITY *** + +51. 6/1/91 Made sure that pointers are never used after freeing them. + +52. 6/1/91 Fixed bug in TclWordEnd where it wasn't dealing with +[] inside quotes correctly. + +53. 6/8/91 Fixed exec.test to accept return values of either 1 or +255 from "false" command. + +54. 7/6/91 Massive overhaul of variable management. Associative +arrays now available, along with "unset" command (and Tcl_UnsetVar +procedure). Variable traces have been completely reworked: +interfaces different both from Tcl and C, and multiple traces may +exist on same variable. Can no longer redefine existing local +variable to be global. Calling sequences have changed slightly +for Tcl_GetVar and Tcl_SetVar ("global" is now "flags"). Tcl_SetVar +can fail and return a NULL result. New forms of variable-manipulation +procedures: Tcl_GetVar2, Tcl_SetVar2, etc. Syntax of variable +$-notation changed to support array indexing. +*** POTENTIAL INCOMPATIBILITY *** + +55. 7/6/91 Added new list-manipulation procedures: Tcl_ScanElement, +Tcl_ConvertElement, Tcl_AppendElement. + +56. 7/12/91 Created new procedure Tcl_EvalFile, which does most of the +work of the "source" command. + +57. 7/20/91 Major reworking of "exec" command to allow pipelines, +more redirection, background. Added new procedures Tcl_Fork, +Tcl_WaitPids, Tcl_DetachPids, and Tcl_CreatePipeline. The old +"< input" notation has been replaced by "<< input" ("<" is for +redirection from a file). Also handles error returns and abnormal +terminations (e.g. signals) differently. +*** POTENTIAL INCOMPATIBILITY *** + +58. 7/21/91 Added "append" and "lappend" commands. + +59. 7/22/91 Reworked error messages and manual entries to use +?x? as the notation for an optional argument x, instead of [x]. The +bracket notation was often confused with the use of brackets for +command substitution. Also modified error messages to be more +consistent. + +60. 7/23/91 Tcl_DeleteCommand now returns an indication of whether +or not the command actually existed, and the "rename" command uses +this information to return an error if an attempt is made to delete +a non-existent command. +*** POTENTIAL INCOMPATIBILITY *** + +61. 7/25/91 Added new "errorCode" mechanism, along with procedures +Tcl_SetErrorCode, Tcl_UnixError, and Tcl_ResetResult. Renamed +Tcl_Return to Tcl_SetResult, but left a #define for Tcl_Return to +avoid compatibility problems. + +62. 7/26/91 Extended "case" command with alternate syntax where all +patterns and commands are together in a single list argument: makes +it easier to write multi-line case statements. + +63. 7/27/91 Changed "print" command to perform tilde-substitution on +the file name. + +64. 7/27/91 Added "tolower", "toupper", "trim", "trimleft", and "trimright" +options to "string" command. + +65. 7/29/91 Added "atime", "mtime", "size", and "stat" options to "file" +command. + +66. 8/1/91 Added "split" and "join" commands. + +67. 8/11/91 Added commands for file I/O, including "open", "close", +"read", "gets", "puts", "flush", "eof", "seek", and "tell". + +68. 8/14/91 Switched to use a hash table for command lookups. Command +abbreviations no longer have direct support in the Tcl interpreter, but +it should be possible to simulate them with the auto-load features +described below. The "noAbbrev" variable is no longer used by Tcl. +*** POTENTIAL INCOMPATIBILITY *** + +68.5 8/15/91 Added support for "unknown" command, which can be used to +complete abbreviations, auto-load library files, auto-exec shell +commands, etc. + +69. 8/15/91 Added -nocomplain switch to "glob" command. + +70. 8/20/91 Added "info library" option and TCL_LIBRARY #define. Also +added "info script" option. + +71. 8/20/91 Changed "file" command to take "option" argument as first +argument (before file name), for consistency with other Tcl commands. +*** POTENTIAL INCOMPATIBILITY *** + +72. 8/20/91 Changed format of information in $errorInfo variable: +comments such as + ("while" body line 1) +are now on separate lines from commands being executed. +*** POTENTIAL INCOMPATIBILITY *** + +73. 8/20/91 Changed Tcl_AppendResult so that it (eventually) frees +large buffers that it allocates. + +74. 8/21/91 Added "linsert", "lreplace", "lsearch", and "lsort" +commands. + +75. 8/28/91 Added "incr" and "exit" commands. + +76. 8/30/91 Added "regexp" and "regsub" commands. + +77. 9/4/91 Changed "dynamic" field in interpreters to "freeProc" (procedure +address). This allows for alternative storage managers. +*** POTENTIAL INCOMPATIBILITY *** + +78. 9/6/91 Added "index", "length", and "range" options to "string" +command. Added "lindex", "llength", and "lrange" commands. + +79. 9/8/91 Removed "index", "length", "print" and "range" commands. +"Print" is redundant with "puts", but less general, and the other +commands are replaced with the new commands described in change 78 +above. +*** POTENTIAL INCOMPATIBILITY *** + +80. 9/8/91 Changed history revision to occur even when history command +is nested; needed in order to allow "history" to be invoked from +"unknown" procedure. + +81. 9/13/91 Changed "panic" not to use vfprintf (it's uglier and less +general now, but makes it easier to run Tcl on systems that don't +have vfprintf). Also changed "strerror" not to redeclare sys_errlist. + +82. 9/19/91 Lots of changes to improve portability to different UNIX +systems, including addition of "config" script to adapt Tcl to the +configuration of the system it's being compiled on. + +83. 9/22/91 Added "pwd" command. + +84. 9/22/91 Renamed manual pages so that their filenames are no more +than 14 characters in length, moved to "doc" subdirectory. + +85. 9/24/91 Redid manual entries so they contain the supplemental +macros that they need; can just print with "troff -man" or "man" +now. + +86. 9/26/91 Created initial version of script library, including +a version of "unknown" that does auto-loading, auto-execution, and +abbreviation expansion. This library is used by tclTest +automatically. See the "library" manual entry for details. + +----------------- Released version 6.0, 9/26/91 ------------------ + +87. 9/30/91 Made "string tolower" and "string toupper" check case +before converting: on some systems, "tolower" and "toupper" assume +that character already has particular case. + +88. 9/30/91 Fixed bug in Tcl_SetResult: wasn't always setting freeProc +correctly when called with NULL value. This tended to cause memory +allocation errors later. + +89. 10/3/91 Added "upvar" command. + +90. 10/4/91 Changed "format" so that internally it converts %D to %ld, +%U to %lu, %O to %lo, and %F to %f. This eliminates some compatibility +problems on some machines without affecting behavior. + +91. 10/10/91 Fixed bug in "regsub" that caused core dumps with the -all +option when the last match wasn't at the end of the string. + +92. 10/17/91 Fixed problems with backslash sequences: \r support was +incomplete and \f and \v weren't supported at all. + +93. 10/24/91 Added Tcl_InitHistory procedure. + +94. 10/24/91 Changed "regexp" to store "-1 -1" in subMatchVars that +don't match, rather than returning an error. + +95. 10/27/91 Modified "regexp" to return actual strings in matchVar +and subMatchVars instead of indices. Added "-indices" switch to cause +indices to be returned. +*** POTENTIAL INCOMPATIBILITY *** + +96. 10/27/91 Fixed bug in "scan" where it used hardwired constants for +sizes of floats and doubles instead of using "sizeof". + +97. 10/31/91 Fixed bug in tclParse.c where parse-related error messages +weren't being storage-managed correctly, causing spurious free's. + +98. 10/31/91 Form feed and vertical tab characters are now considered +to be space characters by the parser. + +99. 10/31/91 Added TCL_LEAVE_ERR_MSG flag to procedures like Tcl_SetVar. + +100. 11/7/91 Fixed bug in "case" where "in" argument couldn't be omitted +if all case branches were embedded in a single list. + +101. 11/7/91 Switched to use "pid_t" and "uid_t" and other official +POSIC types and function prototypes. + +----------------- Released version 6.1, 11/7/91 ------------------ + +102. 12/2/91 Modified Tcl_ScanElement and Tcl_ConvertElement in several +ways. First, allowed caller to request that only backslashes be used +(no braces). Second, made Tcl_ConvertElement more aggressive in using +backslashes for braces and quotes. + +103. 12/5/91 Added "type", "lstat", and "readlink" options to "file" +command, plus added new "type" element to output of "stat" and "lstat" +options. + +104. 12/10/91 Manual entries had first lines that caused "man" program +to try weird preprocessor. Added blank comment lines to fix problem. + +105. 12/16/91 Fixed a few bugs in auto_mkindex proc: wasn't handling +errors properly, and hadn't been upgraded for new "regexp" syntax. + +106. 1/2/92 Fixed bug in "file" command where it didn't properly handle +a file names containing tildes where the indicated user doesn't exist. + +107. 1/2/92 Fixed lots of cases in tclUnixStr.c where two different +errno symbols (e.g. EWOULDBLOCK and EAGAIN) have the same number; Tcl +will only use one of them. + +108. 1/2/92 Lots of changes to configuration script to handle many more +systems more gracefully. E.g. should now detect the bogus strtoul that +comes with AIX and substitute Tcl's own version instead. + +----------------- Released version 6.2, 1/10/92 ------------------ + +109. 1/20/92 Config didn't have code to actually use "uid_t" variable +to set TCL_UIT_T #define. + +110. 2/10/92 Tcl_Eval didn't properly reset "numLevels" variable when +too-deep recursion occurred. + +111. 2/29/92 Added "on" and "off" to keywords accepted by Tcl_GetBoolean. + +112. 3/19/92 Config wasn't installing default version of strtod.c for +systems that don't have one in libc.a. + +113. 3/23/92 Fixed bug in tclExpr.c where numbers with leading "."s, +like 0.75, couldn't be properly substituted into expressions with +variable or command substitution. + +114. 3/25/92 Fixed bug in tclUnixAZ.c where "gets" command wasn't +checking to make sure that it was able to write the variable OK. + +115. 4/16/92 Fixed bug in tclUnixAZ.c where "read" command didn't +compute file size right for device files. + +116. 4/23/92 Fixed but in tclCmdMZ.c where "trace vinfo" was overwriting +the trace command. + +----------------- Released version 6.3, 5/1/92 ------------------ + +117. 5/1/92 Added Tcl_GlobalEval. + +118. 6/1/92 Changed auto-load facility to source files at global level. + +119. 6/8/92 Tcl_ParseVar wasn't always setting termPtr after errors, which +sometimes caused core dumps. + +120. 6/21/92 Fixed bug in initialization of regexp pattern cache. This +bug caused segmentation violations in regexp commands under some conditions. + +121. 6/22/92 Changed implementation of "glob" command to eliminate +trailing slashes on directory names: they confuse some systems. There +shouldn't be any user-visible changes in functionality except for names +in error messages not having trailing slashes. + +122. 7/2/92 Fixed bug that caused 'string match ** ""' to return 0. + +123. 7/2/92 Fixed bug in Tcl_CreateCmdBuf where it wasn't initializing +the buffer to an empty string. + +124. 7/6/92 Fixed bug in "case" command where it used NULL pattern string +after errors in the "default" clause. + +125. 7/25/92 Speeded up auto_load procedure: don't reread all the index +files unless the path has changed. + +126. 8/3/92 Changed tclUnix.h to define MAXPATHLEN from PATH_MAX, not +_POSIX_PATH_MAX. + +----------------- Released version 6.4, 8/7/92 ------------------ + +127. 8/10/92 Changed tclBasic.c so that comment lines can be continued by +putting a backslash before the newline. + +128. 8/21/92 Modified "unknown" to allow the source-ing of a file for +an auto-load to trigger other nested auto-loads, as long as there isn't +any recursion on the same command name. + +129. 8/25/92 Modified "format" command to allow " " and "+" flags, and +allow flags in any order. + +130. 9/14/92 Modified Tcl_ParseVar so that it doesn't actually attempt +to look up the variable if "noEval" mode is in effect in the interpreter +(it just parses the name). This avoids the errors that used to occur +in statements like "expr {[info exists foo] && $foo}". + +131. 9/14/92 Fixed bug in "uplevel" command where it didn't output the +correct error message if a level was specified but no command. + +132. 9/14/92 Renamed manual entries to have extensions like .3 and .n, +and added "install" target to Makefile. + +133. 9/18/92 Modified "unknown" command to emulate !!, !<num>, and +^<old>^<new> csh history substitutions. + +134. 9/21/92 Made the config script cleverer about figuring out which +switches to pass to "nm". + +135. 9/23/92 Fixed tclVar.c to be sure to copy flags when growing variables. +Used to forget about traces in progress and make extra recursive calls +on trace procs. + +136. 9/28/92 Fixed bug in auto_reset where it was unsetting variables +that might not exist. + +137. 10/7/92 Changed "parray" library procedure to print any array +accessible to caller, local or global. + +138. 10/15/92 Fixed bug where propagation of new environment variable +values among interpreters took N! time if there exist N interpreters. + +139. 10/16/92 Changed auto_reset procedure so that it also deletes any +existing procedures that are in the auto_load index (the assumption is +that they should be re-loaded to get the latest versions). + +140. 10/21/92 Fixed bug that caused lists to be incorrectly generated +for elements that contained backslash-newline sequences. + +141. 12/9/92 Added support for TCL_LIBRARY environment variable: use +it as library location if it's present. + +142. 12/9/92 Added "info complete" command, Tcl_CommandComplete procedure. + +143. 12/16/92 Changed the Makefile to check to make sure "config" has been +run (can't run config directly from the Makefile because it modifies the +Makefile; thus make has to be run again after running config). + +----------------- Released version 6.5, 12/17/92 ------------------ + +144. 12/21/92 Changed config to look in several places for libc file. + +145. 12/23/92 Added "elseif" support to if. Also, "then", "else", and +"elseif" may no longer be abbreviated. +*** POTENTIAL INCOMPATIBILITY *** + +146. 12/28/92 Changed "puts" and "read" to support initial "-nonewline" +switch instead of additional "nonewline" argument. The old form is +still supported, but it is discouraged and is no longer documented. +Also changed "puts" to make the file argument default to stdout: e.g. +"puts foo" will print foo on standard output. + +147. 1/6/93 Fixed bug whereby backslash-newline wasn't working when +typed interactively, or in "info complete". + +148. 1/22/93 Fixed bugs in "lreplace" and "linsert" where close +quotes were being lost from last element before replacement or +insertion. + +149. 1/29/93 Fixed bug in Tcl_AssembleCmd where it wasn't requiring +a newline at the end of a line before considering a command to be +complete. The bug caused some very long lines in script files to +be processed as multiple separate commands. + +150. 1/29/93 Various changes in Makefile to add more configuration +options, simplify installation, fix bugs (e.g. don't use -f switch +for cp), etc. + +151. 1/29/93 Changed "name1" and "name2" identifiers to "part1" and +"part2" to avoid name conflicts with stupid C++ implementations that +use "name1" and "name2" in a reserved way. + +152. 2/1/93 Added "putenv" procedure to replace the standard system +version so that it will work correctly with Tcl's environment handling. + +----------------- Released version 6.6, 2/5/93 ------------------ + +153. 2/10/93 Fixed bugs in config script: missing "endif" in libc loop, +and tried to use strncasecmp.c instead of strcasecmp.c. + +154. 2/10/93 Makefile improvements: added RANLIB variable for easier +Sys-V configuration, added SHELL variable for SGI systems. + +----------------- Released version 6.7, 2/11/93 ------------------ + +153. 2/6/93 Changes in backslash processing: + - \Cx, \Mx, \CMx, \e sequences no longer special + - \<newline> also eats up any space after the newline, replacing + the whole sequence with a single space character + - Hex sequences like \x24 are now supported, along with ANSI C's \a. + - "format" no longer does backslash processing on its format string + - there is no longer any special meaning to a 0 return value from + Tcl_Backslash + - unknown backslash sequences, like (e.g. \*), are replaced with + the following character (e.g. *), instead of just treating the + backslash as an ordinary character. +*** POTENTIAL INCOMPATIBILITY *** + +154. 2/6/93 Updated all copyright notices. The meaning hasn't changed +at all but the wording does a better job of protecting U.C. from +liability (according to U.C. lawyers, anyway). + +155. 2/6/93 Changed "regsub" so that it overwrites the result variable +in all cases, even if there is no match. +*** POTENTIAL INCOMPATIBILITY *** + +156. 2/8/93 Added support for XPG3 %n$ conversion specifiers to "format" +command. + +157. 2/17/93 Fixed bug in Tcl_Eval where errors due to infinite +recursion could result in core dumps. + +158. 2/17/93 Improved the auto-load mechanism to deal gracefully (i.e. +return an error) with a situation where a library file that supposedly +defines a procedure doesn't actually define it. + +159. 2/17/93 Renamed Tcl_UnixError procedure to Tcl_PosixError, and +changed errorCode variable usage to use POSIX as keyword instead of +UNIX. +*** POTENTIAL INCOMPATIBILITY *** + +160. 2/19/93 Changes to exec and process control: + - Added support for >>, >&, >>&, |&, <@, >@, and >&@ forms of redirection. + - When exec puts processes into background, it returns a list of + their pids as result. + - Added support for <file, >file, etc. (i.e. no space between + ">" and file name. + - Added -keepnewline option. + - Deleted Tcl_Fork and Tcl_WaitPids procedures (just use fork and + waitpid instead). + - Added waitpid compatibility procedure for systems that don't have + it. + - Added Tcl_ReapDetachedProcs procedure. + - Changed "exec" to return an error if there is stderr output, even + if the command returns a 0 exit status (it's always been documented + this way, but the implementation wasn't correct). + - If a process returns a non-zero exit status but doesn't generate + any diagnostic output, then Tcl generates an error message for it. +*** POTENTIAL INCOMPATIBILITY *** + +161. 2/25/93 Fixed two memory-management problems having to do with +managing the old result during variable trace callbacks. + +162. 3/1/93 Added dynamic string library: Tcl_DStringInit, Tcl_DStringAppend, +Tcl_DStringFree, Tcl_DStringResult, etc. + +163. 3/1/93 Modified glob command to only return the names of files that +exist, and to only return names ending in "/" if the file is a directory. +*** POTENTIAL INCOMPATIBILITY *** + +164. 3/19/93 Modified not to use system calls like "read" directly, +but instead to use special Tcl procedures that retry automatically +if interrupted by signals. + +165. 4/3/93 Eliminated "noSep" argument to Tcl_AppendElement, plus +TCL_NO_SPACE flag for Tcl_SetVar and Tcl_SetVar2. +*** POTENTIAL INCOMPATIBILITY *** + +166. 4/3/93 Eliminated "flags" and "termPtr" arguments to Tcl_Eval. +*** POTENTIAL INCOMPATIBILITY *** + +167. 4/3/93 Changes to expressions: + - The "expr" command now accepts multiple arguments, which are + concatenated together with space separators. + - Integers aren't automatically promoted to floating-point if they + overflow the word size: errors are generated instead. + - Tcl can now handle "NaN" and other special values if the underlying + library procedures handle them. + - When printing floating-point numbers, Tcl ensures that there is a "." + or "e" in the number, so it can't be treated as an integer accidentally. + The procedure Tcl_PrintDouble is available to provide this function + in other contexts. Also, the variable "tcl_precision" can be used + to set the precision for printing (must be a decimal number giving + digits of precision). + - Expressions now support transcendental and other functions, e.g. sin, + acos, hypot, ceil, and round. Can add new math functions with + Tcl_CreateMathFunc(). + - Boolean expressions can now have any of the string values accepted + by Tcl_GetBoolean, such as "yes" or "no". +*** POTENTIAL INCOMPATIBILITY *** + +168. 4/5/93 Changed Tcl_UnsetVar and Tcl_UnsetVar2 to return TCL_OK +or TCL_ERROR instead of 0 or -1. +*** POTENTIAL INCOMPATIBILITY *** + +169. 4/5/93 Eliminated Tcl_CmdBuf structure and associated procedures; +can use Tcl_DStrings instead. +*** POTENTIAL INCOMPATIBILITY *** + +170. 4/8/93 Changed interface to Tcl_TildeSubst to use a dynamic +string for buffer space. This makes the procedure re-entrant and +thread-safe, whereas it wasn't before. +*** POTENTIAL INCOMPATIBILITY *** + +171. 4/14/93 Eliminated tclHash.h, and moved everything from it to +tcl.h +*** POTENTIAL INCOMPATIBILITY *** + +172. 4/15/93 Eliminated Tcl_InitHistory, made "history" command always +be part of interpreter. +*** POTENTIAL INCOMPATIBILITY *** + +173. 4/16/93 Modified "file" command so that "readable" option always +exists, even on machines that don't support symbolic links (always returns +same error as if the file wasn't a symbolic link). + +174. 4/26/93 Fixed bugs in "regsub" where ^ patterns didn't get handled +right (pretended not to match when it really did, and looped infinitely +if -all was specified). + +175. 4/29/93 Various improvements in the handling of variables: + - Can create variables and array elements during a read trace. + - Can delete variables during traces (note: unset traces will be + invoked when this happens). + - Can upvar to array elements. + - Can retarget an upvar to another variable by re-issuing the + upvar command with a different "other" variable. + +176. 5/3/93 Added Tcl_GetCommandInfo, which returns info about a Tcl +command such as whether it exists and its ClientData. Also added +Tcl_SetCommandInfo, which allows any of this information to be modified +and also allows a command's delete procedure to have a different +ClientData value than its command procedure. + +177. 5/5/93 Added Tcl_RegExpMatch procedure. + +178. 5/6/93 Fixed bug in "scan" where it didn't properly handle +%% conversion specifiers. Also changed "scan" to use Tcl_PrintDouble +for printing real values. + +179. 5/7/93 Added "-exact", "-glob", and "-regexp" options to "lsearch" +command to allow different kinds of pattern matching. + +180. 5/7/93 Added many new switches to "lsort" to control the sorting +process: "-ascii", "-integer", "-real", "-command", "-increasing", +and "-decreasing". + +181. 5/10/93 Changes to file I/O: + - Modified "open" command to support a list of POSIX access flags + like {WRONLY CREAT TRUNC} in addition to current fopen-style + access modes. Also added "permissions" argument to set permissions + of newly-created files. + - Fixed Scott Bolte's bug (can close stdin etc. in application and + then re-open them with Tcl commands). + - Exported access to Tcl's file table with new procedures Tcl_EnterFile + and Tcl_GetOpenFile. + +182. 5/15/93 Added new "pid" command, which can be used to retrieve +either the current process id or a list of the process ids in a +pipeline opened with "open |..." + +183. 6/3/93 Changed to use GNU autoconfig for configuration instead of +the home-brew "config" script. Also made many other configuration-related +changes, such as using <unistd.h> instead of explicitly declaring system +calls in tclUnix.h. + +184. 6/4/93 Fixed bug where core-dumps could occur if a procedure +redefined itself (the memory for the procedure's body could get +reallocated in the middle of evaluating the body); implemented +simple reference count mechanism. + +185. 6/5/93 Changed tclIndex file format in two ways: (a) it's now +eval-ed instead of parsed, which makes it 3-4x faster; (b) the entries +in auto_index are now commands to evaluate, which allows commands to +be loaded in different ways such as dynamic-loading of C code. The +old tclIndex file format is still supported. + +186. 6/7/93 Eliminated tclTest program, added new "tclsh" program +that is more like wish (allows script files to be invoked automatically +using "#!/usr/local/bin/tclsh", makes arguments available to script, +etc.). Added support for Tcl_AppInit plus default version; this +allows new Tcl applications to be created without modifying the +main program for tclsh. + +187. 6/7/93 Fixed bug in TclWordEnd that kept backslash-newline from +working correctly in some cases during interactive input. + +188. 6/9/93 Added Tcl_LinkVar and related procedures, which automatically +keep a Tcl variable in sync with a C variable. + +189. 6/16/93 Increased maximum nesting depth from 100 to 1000. + +190. 6/16/93 Modified "trace var" command so that error messages from +within traces are returned properly as the result of the variable +access, instead of the generic "access disallowed by trace command" +message. + +191. 6/16/93 Added Tcl_CallWhenDeleted to provide callbacks when an +interpreter is deleted (same functionality as Tcl_WatchInterp, which +used to exist in versions before 6.0). + +193. 6/16/93 Added "-code" argument to "return" command; it's there +primarily for completeness, so that procedures implementing control +constructs can reflect exceptional conditions back to their callers. + +194. 6/16/93 Split up Tcl.n to make separate manual entries for each +Tcl command. Tcl.n now contains a summary of the language syntax. + +195. 6/17/93 Added new "switch" command to replace "case": allows +alternate forms of pattern matching (exact, glob, regexp), replaces +pattern lists with single patterns (but you can use "-" bodies to +share one body among several patterns), eliminates "in" noise word. +"Case" command is now obsolete. + +196. 6/17/93 Changed the "exec", "glob", "regexp", and "regsub" commands +to include a "--" switch. All initial arguments starting with "-" are now +treated as switches unless a "--" switch is present to end the list. +*** POTENTIAL INCOMPATIBILITY *** + +197. 6/17/93 Changed auto-exec so that the subprocess gets stdin, stdout, +and stderr from the parent. This allows truly interactive sub-processes +(e.g. vi) to be auto-exec'ed from a tcl shell command line. + +198. 6/18/93 Added patchlevel.h, for use in coordinating future patch +releases, and also added "info patchlevel" command to make the patch +level available to Tcl scripts. + +199. 6/19/93 Modified "glob" command so that a leading "//" in a name +gets left as is (this is needed for systems like Apollos where "//" is +the super-root; Tcl used to collapse the two slashes into a single +slash). + +200. 7/7/93 Added Tcl_SetRecursionLimit procedure so that the maximum +allowable nesting depth can be controlled for an interpreter from C. + +----------------- Released version 7.0 Beta 1, 7/9/93 ------------------ + +201. 7/12/93 Modified Tcl_GetInt and tclExpr.c so that full-precision +unsigned integers can be specified without overflow errors. + +202. 7/12/93 Configuration changes: eliminate leading blank line in +configure script; provide separate targets in Makefile for installing +binary and non-binary information; check for size_t and a few other +potentially missing typedefs; don't put tclAppInit.o into libtcl.a; +better checks for matherr support. + +203. 7/14/93 Changed tclExpr.c to check the termination pointer before +errno after strtod calls, to avoid problems with some versions of +strtod that set errno in unexpected ways. + +204. 7/16/93 Changed "scan" command to be more ANSI-conformant: +eliminated %F, %D, etc., added code to ignore "l", "h", and "L" +modifiers but always convert %e, %f, and %g with implicit "l"; +also added support for %u and %i. Also changed "format" command +to eliminate %D, %U, %O, and add %i. +*** POTENTIAL INCOMPATIBILITY *** + +205. 7/17/93 Changed "uplevel" and "upvar" so that they can be used +from global level to global level: this used to generate an error. + +206. 7/19/93 Renamed "setenv", "putenv", and "unsetenv" procedures +to avoid conflicts with system procedures with the same names. If +you want Tcl's procedures to override the system procedures, do it +in the Makefile (instructions are in the Makefile). +*** POTENTIAL INCOMPATIBILITY *** + +----------------- Released version 7.0 Beta 2, 7/21/93 ------------------ + +207. 7/21/93 Fixed bug in tclVar.c where freed memory was accidentally +used if a procedure returned an element of a local array. + +208. 7/22/93 Fixed bug in "unknown" where it didn't properly handle +errors occurring in the "auto_load" procedure, leaving its state +inconsistent. + +209. 7/23/93 Changed exec's ">2" redirection operator to "2>" for +consistency with sh. This is incompatible with earlier beta releases +of 7.0 but not with pre-7.0 releases, which didn't support either +operator. + +210. 7/28/93 Changed backslash-newline handling so that the resulting +space character *is* treated as a word separator unless the backslash +sequence is in quotes or braces. This is incompatible with 7.0b1 +and 7.0b2 but is more compatible with pre-7.0 versions that the b1 +and b2 releases were. + +211. 7/28/93 Eliminated Tcl_LinkedVarWritable, added TCL_LINK_READ_ONLY to +Tcl_LinkVar to accomplish same purpose. This change is incompatible +with earlier beta releases, but not with releases before Tcl 7.0. + +212. 7/29/93 Renamed regexp C functions so they won't clash with POSIX +regexp functions that use the same name. + +213. 8/3/93 Added "-errorinfo" and "-errorcode" options to "return" +command: these allow for much better handling of the errorInfo +and errorCode variables in some cases. + +214. 8/12/93 Changed "expr" so that % always returns a remainder with +the same sign as the divisor and absolute value smaller than the +divisor. + +215. 8/14/93 Turned off auto-exec in "unknown" unless the command +was typed interactively. This means you must use "exec" when +invoking subprocesses, unless it's a command that's typed interactively. +*** POTENTIAL INCOMPATIBILITY *** + +216. 8/14/93 Added support for tcl_prompt1 and tcl_prompt2 variables +to tclMain.c: makes prompts user-settable. + +217. 8/14/93 Added asynchronous handlers (Tcl_AsyncCreate etc.) so +that signals can be taken cleanly by Tcl applications. + +218. 8/16/93 Moved information about open files from the interpreter +structure to global variables so that a file can be opened in one +interpreter and read or written in another. + +219. 8/16/93 Removed ENV_FLAGS from Makefile, so that there's no +official support for overriding setenv, unsetenv, and putenv. + +220. 8/20/93 Various configuration improvements: coerce chars +to unsigned chars before using macros like isspace; source ~/.tclshrc +file during initialization if it exists and program is running +interactively; allow there to be directories in auto_path that don't +exist or don't have tclIndex files (ignore them); added Tcl_Init +procedure and changed Tcl_AppInit to call it. + +221. 8/21/93 Fixed bug in expr where "+", "-", and " " were all +getting treated as integers with value 0. + +222. 8/26/93 Added "tcl_interactive" variable to tclsh. + +223. 8/27/93 Added procedure Tcl_FilePermissions to return whether a +given file can be read or written or both. Modified Tcl_EnterFile +to take a permissions mask rather than separate read and write arguments. + +224. 8/28/93 Fixed performance bug in "glob" command (unnecessary call +to "access" for each file caused a 5-10x slow-down for big directories). + +----------------- Released version 7.0 Beta 3, 8/28/93 ------------------ + +225. 9/9/93 Renamed regexp.h to tclRegexp.h to avoid conflicts with system +include file by same name. + +226. 9/9/93 Added Tcl_DontCallWhenDeleted. + +227. 9/16/93 Changed not to call exit C procedure directly; instead +always invoke "exit" Tcl command so that application can redefine the +command to do additional cleanup. + +228. 9/17/93 Changed auto-exec to handle names that contain slashes +(i.e. don't use PATH for them). + +229. 9/23/93 Fixed bug in "read" and "gets" commands where they didn't +clear EOF conditions. + +----------------- Released version 7.0, 9/29/93 ------------------ + +230. 10/7/93 "Scan" command wasn't properly aligning things in memory, +so segmentation faults could arise under some circumstances. + +231. 10/7/93 Fixed bug in Tcl_ConvertElement where it forgot to +backslash leading curly brace when creating lists. + +232. 10/7/93 Eliminated dependency of tclMain.c on tclInt.h and +tclUnix.h, so that people can copy the file out of the Tcl source +directory to make modified private versions. + +233. 10/8/93 Fixed bug in auto-loader that reversed the priority order +of entries in auto_path for new-style index files. Now things are +back to the way they were before 3.0: first in auto_path is always +highest priority. + +234. 10/13/93 Fixed bug where Tcl_CommandComplete didn't recognize +comments and treat them as such. Thus if you typed the line + # { +interactively, Tcl would think that the command wasn't complete and +wait for more input before evaluating the script. + +235. 10/14/93 Fixed bug where "regsub" didn't set the output variable +if the input string was empty. + +236. 10/23/93 Fixed bug where Tcl_CreatePipeline didn't close off enough +file descriptors in child processes, causing children not to exit +properly in some cases. + +237. 10/28/93 Changed "list" and "concat" commands not to generate +errors if given zero arguments, but instead to just return an empty +string. + +----------------- Released version 7.1, 11/4/93 ------------------ + +Note: there is no 7.2 release. It was flawed and was thus withdrawn +shortly after it was released. + +238. 11/10/93 TclMain.c didn't compile on some systems because of +R_OK in call to "access". Changed to eliminate call to "access". + +----------------- Released version 7.3, 11/26/93 ------------------ diff --git a/vendor/x11iraf/obm/Tcl/compat/README b/vendor/x11iraf/obm/Tcl/compat/README new file mode 100644 index 00000000..9af4285a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/README @@ -0,0 +1,6 @@ +This directory contains various header and code files that are +used make Tcl compatible with various releases of UNIX and UNIX-like +systems. Typically, files from this directory are used to compile +Tcl when a system doesn't contain the corresponding files or when +they are known to be incorrect. When the whole world becomes POSIX- +compliant this directory should be unnecessary. diff --git a/vendor/x11iraf/obm/Tcl/compat/dirent.h b/vendor/x11iraf/obm/Tcl/compat/dirent.h new file mode 100644 index 00000000..d6adf95f --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/dirent.h @@ -0,0 +1,37 @@ +/* + * dirent.h -- + * + * This file is a replacement for <dirent.h> in systems that + * support the old BSD-style <sys/dir.h> with a "struct direct". + * + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/compat/RCS/dirent.h,v 1.2 93/03/19 15:25:03 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _DIRENT +#define _DIRENT + +#include <sys/dir.h> + +#define dirent direct + +#endif /* _DIRENT */ diff --git a/vendor/x11iraf/obm/Tcl/compat/dirent2.h b/vendor/x11iraf/obm/Tcl/compat/dirent2.h new file mode 100644 index 00000000..2f61c354 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/dirent2.h @@ -0,0 +1,73 @@ +/* + * dirent.h -- + * + * Declarations of a library of directory-reading procedures + * in the POSIX style ("struct dirent"). + * + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/compat/RCS/dirent2.h,v 1.2 93/03/19 15:25:09 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _DIRENT +#define _DIRENT + +#ifndef _TCL +#include <tcl.h> +#endif + +/* + * Dirent structure, which holds information about a single + * directory entry. + */ + +#define MAXNAMLEN 255 +#define DIRBLKSIZ 512 + +struct dirent { + long d_ino; /* Inode number of entry */ + short d_reclen; /* Length of this record */ + short d_namlen; /* Length of string in d_name */ + char d_name[MAXNAMLEN + 1]; /* Name must be no longer than this */ +}; + +/* + * State that keeps track of the reading of a directory (clients + * should never look inside this structure; the fields should + * only be accessed by the library procedures). + */ + +typedef struct _dirdesc { + int dd_fd; + long dd_loc; + long dd_size; + char dd_buf[DIRBLKSIZ]; +} DIR; + +/* + * Procedures defined for reading directories: + */ + +extern void closedir _ANSI_ARGS_((DIR *dirp)); +extern DIR * opendir _ANSI_ARGS_((char *name)); +extern struct dirent * readdir _ANSI_ARGS_((DIR *dirp)); + +#endif /* _DIRENT */ diff --git a/vendor/x11iraf/obm/Tcl/compat/float.h b/vendor/x11iraf/obm/Tcl/compat/float.h new file mode 100644 index 00000000..e5b0cb01 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/float.h @@ -0,0 +1,30 @@ +/* + * float.h -- + * + * This is a dummy header file to #include in Tcl when there + * is no float.h in /usr/include. Right now this file is empty: + * Tcl contains #ifdefs to deal with the lack of definitions; + * all it needs is for the #include statement to work. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/compat/RCS/float.h,v 1.1 93/04/15 16:10:39 ouster Exp $ SPRITE (Berkeley) + */ diff --git a/vendor/x11iraf/obm/Tcl/compat/getcwd.c b/vendor/x11iraf/obm/Tcl/compat/getcwd.c new file mode 100644 index 00000000..f693a53e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/getcwd.c @@ -0,0 +1,63 @@ +/* + * getcwd.c -- + * + * This file provides an implementation of the getcwd procedure + * that uses getwd, for systems with getwd but without getcwd. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/getcwd.c,v 1.2 93/07/12 14:00:59 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +extern char *getwd _ANSI_ARGS_((char *pathname)); + +char * +getcwd(buf, size) + char *buf; /* Where to put path for current directory. */ + size_t size; /* Number of bytes at buf. */ +{ + char realBuffer[MAXPATHLEN+1]; + int length; + + if (getwd(realBuffer) == NULL) { + /* + * There's not much we can do besides guess at an errno to + * use for the result (the error message in realBuffer isn't + * much use...). + */ + + errno = EACCES; + return NULL; + } + length = strlen(realBuffer); + if (length >= size) { + errno = ERANGE; + return NULL; + } + strcpy(buf, realBuffer); + return buf; +} + diff --git a/vendor/x11iraf/obm/Tcl/compat/limits.h b/vendor/x11iraf/obm/Tcl/compat/limits.h new file mode 100644 index 00000000..dec6d99e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/limits.h @@ -0,0 +1,34 @@ +/* + * limits.h -- + * + * This is a dummy header file to #include in Tcl when there + * is no limits.h in /usr/include. There are only a few + * definitions here; also see tclUnix.h, which already + * #defines some of the things here if they're not arleady + * defined. + * + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/compat/RCS/limits.h,v 1.3 93/04/08 16:03:59 ouster Exp $ SPRITE (Berkeley) + */ + +#define LONG_MIN 0x80000000 +#define LONG_MAX 0x7fffffff diff --git a/vendor/x11iraf/obm/Tcl/compat/opendir.c b/vendor/x11iraf/obm/Tcl/compat/opendir.c new file mode 100644 index 00000000..5602350f --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/opendir.c @@ -0,0 +1,106 @@ +/* + * opendir.c -- + * + * This file provides dirent-style directory-reading procedures + * for V7 Unix systems that don't have such procedures. The + * origin of this code is unclear, but it seems to have come + * originally from Larry Wall. + * + */ + +#include "tclInt.h" +#include "tclUnix.h" + +#undef DIRSIZ +#define DIRSIZ(dp) \ + ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) + +/* + * open a directory. + */ +DIR * +opendir(name) +char *name; +{ + register DIR *dirp; + register int fd; + char *myname; + + myname = ((*name == '\0') ? "." : name); + if ((fd = open(myname, 0, 0)) == -1) + return NULL; + if ((dirp = (DIR *)ckalloc(sizeof(DIR))) == NULL) { + close (fd); + return NULL; + } + dirp->dd_fd = fd; + dirp->dd_loc = 0; + return dirp; +} + +/* + * read an old style directory entry and present it as a new one + */ +#ifndef pyr +#define ODIRSIZ 14 + +struct olddirect { + ino_t od_ino; + char od_name[ODIRSIZ]; +}; +#else /* a Pyramid in the ATT universe */ +#define ODIRSIZ 248 + +struct olddirect { + long od_ino; + short od_fill1, od_fill2; + char od_name[ODIRSIZ]; +}; +#endif + +/* + * get next entry in a directory. + */ +struct dirent * +readdir(dirp) +register DIR *dirp; +{ + register struct olddirect *dp; + static struct dirent dir; + + for (;;) { + if (dirp->dd_loc == 0) { + dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, + DIRBLKSIZ); + if (dirp->dd_size <= 0) + return NULL; + } + if (dirp->dd_loc >= dirp->dd_size) { + dirp->dd_loc = 0; + continue; + } + dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc); + dirp->dd_loc += sizeof(struct olddirect); + if (dp->od_ino == 0) + continue; + dir.d_ino = dp->od_ino; + strncpy(dir.d_name, dp->od_name, ODIRSIZ); + dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */ + dir.d_namlen = strlen(dir.d_name); + dir.d_reclen = DIRSIZ(&dir); + return (&dir); + } +} + +/* + * close a directory. + */ +void +closedir(dirp) +register DIR *dirp; +{ + close(dirp->dd_fd); + dirp->dd_fd = -1; + dirp->dd_loc = 0; + ckfree((char *) dirp); +} diff --git a/vendor/x11iraf/obm/Tcl/compat/stdlib.h b/vendor/x11iraf/obm/Tcl/compat/stdlib.h new file mode 100644 index 00000000..9aec51a5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/stdlib.h @@ -0,0 +1,59 @@ +/* + * stdlib.h -- + * + * Declares facilities exported by the "stdlib" portion of + * the C library. This file isn't complete in the ANSI-C + * sense; it only declares things that are needed by Tcl. + * This file is needed even on many systems with their own + * stdlib.h (e.g. SunOS) because not all stdlib.h files + * declare all the procedures needed here (such as strtod). + * + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/compat/RCS/stdlib.h,v 1.8 93/03/19 15:25:31 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _STDLIB +#define _STDLIB + +#include <tcl.h> + +extern void abort _ANSI_ARGS_((void)); +extern double atof _ANSI_ARGS_((CONST char *string)); +extern int atoi _ANSI_ARGS_((CONST char *string)); +extern long atol _ANSI_ARGS_((CONST char *string)); +extern char * calloc _ANSI_ARGS_((unsigned int numElements, + unsigned int size)); +extern void exit _ANSI_ARGS_((int status)); +extern int free _ANSI_ARGS_((char *blockPtr)); +extern char * getenv _ANSI_ARGS_((CONST char *name)); +extern char * malloc _ANSI_ARGS_((unsigned int numBytes)); +extern void qsort _ANSI_ARGS_((VOID *base, int n, int size, + int (*compar)(CONST VOID *element1, CONST VOID + *element2))); +extern char * realloc _ANSI_ARGS_((char *ptr, unsigned int numBytes)); +extern double strtod _ANSI_ARGS_((CONST char *string, char **endPtr)); +extern long strtol _ANSI_ARGS_((CONST char *string, char **endPtr, + int base)); +extern unsigned long strtoul _ANSI_ARGS_((CONST char *string, + char **endPtr, int base)); + +#endif /* _STDLIB */ diff --git a/vendor/x11iraf/obm/Tcl/compat/strerror.c b/vendor/x11iraf/obm/Tcl/compat/strerror.c new file mode 100644 index 00000000..773b9d5e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/strerror.c @@ -0,0 +1,484 @@ +/* + * strerror.c -- + * + * Source code for the "strerror" library routine. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strerror.c,v 1.8 93/10/28 16:32:16 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +extern int sys_nerr; +extern char *sys_errlist[]; +/* + *---------------------------------------------------------------------- + * + * strerror -- + * + * Map an integer error number into a printable string. + * + * Results: + * The return value is a pointer to a string describing + * error. The first character of string isn't capitalized. + * + * Side effects: + * Each call to this procedure may overwrite the value returned + * by the previous call. + * + *---------------------------------------------------------------------- + */ + +char * +strerror(error) + int error; /* Integer identifying error (must be + * one of the officially-defined Sprite + * errors, as defined in errno.h). */ +{ + static char msg[50]; + +#ifndef NO_SYS_ERRLIST + if ((error <= sys_nerr) && (error > 0)) { + return sys_errlist[error]; + } +#else + switch (error) { +#ifdef E2BIG + case E2BIG: return "argument list too long"; +#endif +#ifdef EACCES + case EACCES: return "permission denied"; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: return "address already in use"; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: return "can't assign requested address"; +#endif +#ifdef EADV + case EADV: return "advertise error"; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: return "address family not supported by protocol family"; +#endif +#ifdef EAGAIN + case EAGAIN: return "no more processes"; +#endif +#ifdef EALIGN + case EALIGN: return "EALIGN"; +#endif +#ifdef EALREADY + case EALREADY: return "operation already in progress"; +#endif +#ifdef EBADE + case EBADE: return "bad exchange descriptor"; +#endif +#ifdef EBADF + case EBADF: return "bad file number"; +#endif +#ifdef EBADFD + case EBADFD: return "file descriptor in bad state"; +#endif +#ifdef EBADMSG + case EBADMSG: return "not a data message"; +#endif +#ifdef EBADR + case EBADR: return "bad request descriptor"; +#endif +#ifdef EBADRPC + case EBADRPC: return "RPC structure is bad"; +#endif +#ifdef EBADRQC + case EBADRQC: return "bad request code"; +#endif +#ifdef EBADSLT + case EBADSLT: return "invalid slot"; +#endif +#ifdef EBFONT + case EBFONT: return "bad font file format"; +#endif +#ifdef EBUSY + case EBUSY: return "mount device busy"; +#endif +#ifdef ECHILD + case ECHILD: return "no children"; +#endif +#ifdef ECHRNG + case ECHRNG: return "channel number out of range"; +#endif +#ifdef ECOMM + case ECOMM: return "communication error on send"; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: return "software caused connection abort"; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: return "connection refused"; +#endif +#ifdef ECONNRESET + case ECONNRESET: return "connection reset by peer"; +#endif +#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) + case EDEADLK: return "resource deadlock avoided"; +#endif +#ifdef EDEADLOCK + case EDEADLOCK: return "resource deadlock avoided"; +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: return "destination address required"; +#endif +#ifdef EDIRTY + case EDIRTY: return "mounting a dirty fs w/o force"; +#endif +#ifdef EDOM + case EDOM: return "math argument out of range"; +#endif +#ifdef EDOTDOT + case EDOTDOT: return "cross mount point"; +#endif +#ifdef EDQUOT + case EDQUOT: return "disk quota exceeded"; +#endif +#ifdef EDUPPKG + case EDUPPKG: return "duplicate package name"; +#endif +#ifdef EEXIST + case EEXIST: return "file already exists"; +#endif +#ifdef EFAULT + case EFAULT: return "bad address in system call argument"; +#endif +#ifdef EFBIG + case EFBIG: return "file too large"; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: return "host is down"; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: return "host is unreachable"; +#endif +#ifdef EIDRM + case EIDRM: return "identifier removed"; +#endif +#ifdef EINIT + case EINIT: return "initialization error"; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: return "operation now in progress"; +#endif +#ifdef EINTR + case EINTR: return "interrupted system call"; +#endif +#ifdef EINVAL + case EINVAL: return "invalid argument"; +#endif +#ifdef EIO + case EIO: return "I/O error"; +#endif +#ifdef EISCONN + case EISCONN: return "socket is already connected"; +#endif +#ifdef EISDIR + case EISDIR: return "illegal operation on a directory"; +#endif +#ifdef EISNAME + case EISNAM: return "is a name file"; +#endif +#ifdef ELBIN + case ELBIN: return "ELBIN"; +#endif +#ifdef EL2HLT + case EL2HLT: return "level 2 halted"; +#endif +#ifdef EL2NSYNC + case EL2NSYNC: return "level 2 not synchronized"; +#endif +#ifdef EL3HLT + case EL3HLT: return "level 3 halted"; +#endif +#ifdef EL3RST + case EL3RST: return "level 3 reset"; +#endif +#ifdef ELIBACC + case ELIBACC: return "can not access a needed shared library"; +#endif +#ifdef ELIBBAD + case ELIBBAD: return "accessing a corrupted shared library"; +#endif +#ifdef ELIBEXEC + case ELIBEXEC: return "can not exec a shared library directly"; +#endif +#ifdef ELIBMAX + case ELIBMAX: return + "attempting to link in more shared libraries than system limit"; +#endif +#ifdef ELIBSCN + case ELIBSCN: return ".lib section in a.out corrupted"; +#endif +#ifdef ELNRNG + case ELNRNG: return "link number out of range"; +#endif +#ifdef ELOOP + case ELOOP: return "too many levels of symbolic links"; +#endif +#ifdef EMFILE + case EMFILE: return "too many open files"; +#endif +#ifdef EMLINK + case EMLINK: return "too many links"; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: return "message too long"; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: return "multihop attempted"; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: return "file name too long"; +#endif +#ifdef ENAVAIL + case ENAVAIL: return "not available"; +#endif +#ifdef ENET + case ENET: return "ENET"; +#endif +#ifdef ENETDOWN + case ENETDOWN: return "network is down"; +#endif +#ifdef ENETRESET + case ENETRESET: return "network dropped connection on reset"; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: return "network is unreachable"; +#endif +#ifdef ENFILE + case ENFILE: return "file table overflow"; +#endif +#ifdef ENOANO + case ENOANO: return "anode table overflow"; +#endif +#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) + case ENOBUFS: return "no buffer space available"; +#endif +#ifdef ENOCSI + case ENOCSI: return "no CSI structure available"; +#endif +#ifdef ENODATA + case ENODATA: return "no data available"; +#endif +#ifdef ENODEV + case ENODEV: return "no such device"; +#endif +#ifdef ENOENT + case ENOENT: return "no such file or directory"; +#endif +#ifdef ENOEXEC + case ENOEXEC: return "exec format error"; +#endif +#ifdef ENOLCK + case ENOLCK: return "no locks available"; +#endif +#ifdef ENOLINK + case ENOLINK: return "link has be severed"; +#endif +#ifdef ENOMEM + case ENOMEM: return "not enough memory"; +#endif +#ifdef ENOMSG + case ENOMSG: return "no message of desired type"; +#endif +#ifdef ENONET + case ENONET: return "machine is not on the network"; +#endif +#ifdef ENOPKG + case ENOPKG: return "package not installed"; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: return "bad proocol option"; +#endif +#ifdef ENOSPC + case ENOSPC: return "no space left on device"; +#endif +#ifdef ENOSR + case ENOSR: return "out of stream resources"; +#endif +#ifdef ENOSTR + case ENOSTR: return "not a stream device"; +#endif +#ifdef ENOSYM + case ENOSYM: return "unresolved symbol name"; +#endif +#ifdef ENOSYS + case ENOSYS: return "function not implemented"; +#endif +#ifdef ENOTBLK + case ENOTBLK: return "block device required"; +#endif +#ifdef ENOTCONN + case ENOTCONN: return "socket is not connected"; +#endif +#ifdef ENOTDIR + case ENOTDIR: return "not a directory"; +#endif +#ifdef ENOTEMPTY + case ENOTEMPTY: return "directory not empty"; +#endif +#ifdef ENOTNAM + case ENOTNAM: return "not a name file"; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: return "socket operation on non-socket"; +#endif +#ifdef ENOTTY + case ENOTTY: return "inappropriate device for ioctl"; +#endif +#ifdef ENOTUNIQ + case ENOTUNIQ: return "name not unique on network"; +#endif +#ifdef ENXIO + case ENXIO: return "no such device or address"; +#endif +#ifdef EOPNOTSUPP + case EOPNOTSUPP: return "operation not supported on socket"; +#endif +#ifdef EPERM + case EPERM: return "not owner"; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: return "protocol family not supported"; +#endif +#ifdef EPIPE + case EPIPE: return "broken pipe"; +#endif +#ifdef EPROCLIM + case EPROCLIM: return "too many processes"; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: return "bad procedure for program"; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: return "program version wrong"; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: return "RPC program not available"; +#endif +#ifdef EPROTO + case EPROTO: return "protocol error"; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: return "protocol not suppored"; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: return "protocol wrong type for socket"; +#endif +#ifdef ERANGE + case ERANGE: return "math result unrepresentable"; +#endif +#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) + case EREFUSED: return "EREFUSED"; +#endif +#ifdef EREMCHG + case EREMCHG: return "remote address changed"; +#endif +#ifdef EREMDEV + case EREMDEV: return "remote device"; +#endif +#ifdef EREMOTE + case EREMOTE: return "pathname hit remote file system"; +#endif +#ifdef EREMOTEIO + case EREMOTEIO: return "remote i/o error"; +#endif +#ifdef EREMOTERELEASE + case EREMOTERELEASE: return "EREMOTERELEASE"; +#endif +#ifdef EROFS + case EROFS: return "read-only file system"; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: return "RPC version is wrong"; +#endif +#ifdef ERREMOTE + case ERREMOTE: return "object is remote"; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: return "can't send afer socket shutdown"; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: return "socket type not supported"; +#endif +#ifdef ESPIPE + case ESPIPE: return "invalid seek"; +#endif +#ifdef ESRCH + case ESRCH: return "no such process"; +#endif +#ifdef ESRMNT + case ESRMNT: return "srmount error"; +#endif +#ifdef ESTALE + case ESTALE: return "stale remote file handle"; +#endif +#ifdef ESUCCESS + case ESUCCESS: return "Error 0"; +#endif +#ifdef ETIME + case ETIME: return "timer expired"; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: return "connection timed out"; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: return "too many references: can't splice"; +#endif +#ifdef ETXTBSY + case ETXTBSY: return "text file or pseudo-device busy"; +#endif +#ifdef EUCLEAN + case EUCLEAN: return "structure needs cleaning"; +#endif +#ifdef EUNATCH + case EUNATCH: return "protocol driver not attached"; +#endif +#ifdef EUSERS + case EUSERS: return "too many users"; +#endif +#ifdef EVERSION + case EVERSION: return "version mismatch"; +#endif +#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) + case EWOULDBLOCK: return "operation would block"; +#endif +#ifdef EXDEV + case EXDEV: return "cross-domain link"; +#endif +#ifdef EXFULL + case EXFULL: return "message tables full"; +#endif + } +#endif /* ! NO_SYS_ERRLIST */ + sprintf(msg, "unknown error (%d)", error); + return msg; +} diff --git a/vendor/x11iraf/obm/Tcl/compat/string.h b/vendor/x11iraf/obm/Tcl/compat/string.h new file mode 100644 index 00000000..863961f7 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/string.h @@ -0,0 +1,78 @@ +/* + * string.h -- + * + * Declarations of ANSI C library procedures for string handling. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/compat/RCS/string.h,v 1.9 93/03/19 15:25:36 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _STRING +#define _STRING + +#include <tcl.h> + +/* + * The following #include is needed to define size_t. (This used to + * include sys/stdtypes.h but that doesn't exist on older versions + * of SunOS, e.g. 4.0.2, so I'm trying sys/types.h now.... hopefully + * it exists everywhere) + */ + +#include <sys/types.h> + +extern char * memchr _ANSI_ARGS_((CONST VOID *s, int c, size_t n)); +extern int memcmp _ANSI_ARGS_((CONST VOID *s1, CONST VOID *s2, + size_t n)); +extern char * memcpy _ANSI_ARGS_((VOID *t, CONST VOID *f, size_t n)); +extern char * memmove _ANSI_ARGS_((VOID *t, CONST VOID *f, + size_t n)); +extern char * memset _ANSI_ARGS_((VOID *s, int c, size_t n)); + +extern int strcasecmp _ANSI_ARGS_((CONST char *s1, + CONST char *s2)); +extern char * strcat _ANSI_ARGS_((char *dst, CONST char *src)); +extern char * strchr _ANSI_ARGS_((CONST char *string, int c)); +extern int strcmp _ANSI_ARGS_((CONST char *s1, CONST char *s2)); +extern char * strcpy _ANSI_ARGS_((char *dst, CONST char *src)); +extern size_t strcspn _ANSI_ARGS_((CONST char *string, + CONST char *chars)); +extern char * strdup _ANSI_ARGS_((CONST char *string)); +extern char * strerror _ANSI_ARGS_((int error)); +extern size_t strlen _ANSI_ARGS_((CONST char *string)); +extern int strncasecmp _ANSI_ARGS_((CONST char *s1, + CONST char *s2, size_t n)); +extern char * strncat _ANSI_ARGS_((char *dst, CONST char *src, + size_t numChars)); +extern int strncmp _ANSI_ARGS_((CONST char *s1, CONST char *s2, + size_t nChars)); +extern char * strncpy _ANSI_ARGS_((char *dst, CONST char *src, + size_t numChars)); +extern char * strpbrk _ANSI_ARGS_((CONST char *string, char *chars)); +extern char * strrchr _ANSI_ARGS_((CONST char *string, int c)); +extern size_t strspn _ANSI_ARGS_((CONST char *string, + CONST char *chars)); +extern char * strstr _ANSI_ARGS_((CONST char *string, + CONST char *substring)); +extern char * strtok _ANSI_ARGS_((CONST char *s, CONST char *delim)); + +#endif /* _STRING */ diff --git a/vendor/x11iraf/obm/Tcl/compat/strstr.c b/vendor/x11iraf/obm/Tcl/compat/strstr.c new file mode 100644 index 00000000..4fd5e1bc --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/strstr.c @@ -0,0 +1,84 @@ +/* + * strstr.c -- + * + * Source code for the "strstr" library routine. + * + * Copyright (c) 1988-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strstr.c,v 1.2 93/03/19 15:25:40 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +/* + *---------------------------------------------------------------------- + * + * strstr -- + * + * Locate the first instance of a substring in a string. + * + * Results: + * If string contains substring, the return value is the + * location of the first matching instance of substring + * in string. If string doesn't contain substring, the + * return value is 0. Matching is done on an exact + * character-for-character basis with no wildcards or special + * characters. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +strstr(string, substring) + register char *string; /* String to search. */ + char *substring; /* Substring to try to find in string. */ +{ + register char *a, *b; + + /* First scan quickly through the two strings looking for a + * single-character match. When it's found, then compare the + * rest of the substring. + */ + + b = substring; + if (*b == 0) { + return string; + } + for ( ; *string != 0; string += 1) { + if (*string != *b) { + continue; + } + a = string; + while (1) { + if (*b == 0) { + return string; + } + if (*a++ != *b++) { + break; + } + } + b = substring; + } + return (char *) 0; +} diff --git a/vendor/x11iraf/obm/Tcl/compat/strtod.c b/vendor/x11iraf/obm/Tcl/compat/strtod.c new file mode 100644 index 00000000..eb4b3234 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/strtod.c @@ -0,0 +1,273 @@ +/* + * strtod.c -- + * + * Source code for the "strtod" library procedure. + * + * Copyright (c) 1988-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strtod.c,v 1.6 93/07/23 16:31:17 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tcl.h" +#ifdef NO_STDLIB_H +# include "compat/stdlib.h" +#else +# include <stdlib.h> +#endif +#include <ctype.h> + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif +#ifndef NULL +#define NULL 0 +#endif + +static int maxExponent = 511; /* Largest possible base 10 exponent. Any + * exponent larger than this will already + * produce underflow or overflow, so there's + * no need to worry about additional digits. + */ +static double powersOf10[] = { /* Table giving binary powers of 10. Entry */ + 10., /* is 10^2^i. Used to convert decimal */ + 100., /* exponents into floating-point numbers. */ + 1.0e4, + 1.0e8, + 1.0e16, + 1.0e32, + 1.0e64, + 1.0e128, + 1.0e256 +}; + +/* + *---------------------------------------------------------------------- + * + * strtod -- + * + * This procedure converts a floating-point number from an ASCII + * decimal representation to internal double-precision format. + * + * Results: + * The return value is the double-precision floating-point + * representation of the characters in string. If endPtr isn't + * NULL, then *endPtr is filled in with the address of the + * next character after the last one that was part of the + * floating-point number. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +double +strtod(string, endPtr) + CONST char *string; /* A decimal ASCII floating-point number, + * optionally preceded by white space. + * Must have form "-I.FE-X", where I is the + * integer part of the mantissa, F is the + * fractional part of the mantissa, and X + * is the exponent. Either of the signs + * may be "+", "-", or omitted. Either I + * or F may be omitted, or both. The decimal + * point isn't necessary unless F is present. + * The "E" may actually be an "e". E and X + * may both be omitted (but not just one). + */ + char **endPtr; /* If non-NULL, store terminating character's + * address here. */ +{ + int sign, expSign = FALSE; + double fraction, dblExp, *d; + register CONST char *p; + register int c; + int exp = 0; /* Exponent read from "EX" field. */ + int fracExp = 0; /* Exponent that derives from the fractional + * part. Under normal circumstatnces, it is + * the negative of the number of digits in F. + * However, if I is very long, the last digits + * of I get dropped (otherwise a long I with a + * large negative exponent could cause an + * unnecessary overflow on I alone). In this + * case, fracExp is incremented one for each + * dropped digit. */ + int mantSize; /* Number of digits in mantissa. */ + int decPt; /* Number of mantissa digits BEFORE decimal + * point. */ + CONST char *pExp; /* Temporarily holds location of exponent + * in string. */ + + /* + * Strip off leading blanks and check for a sign. + */ + + p = string; + while (isspace(*p)) { + p += 1; + } + if (*p == '-') { + sign = TRUE; + p += 1; + } else { + if (*p == '+') { + p += 1; + } + sign = FALSE; + } + + /* + * Count the number of digits in the mantissa (including the decimal + * point), and also locate the decimal point. + */ + + decPt = -1; + for (mantSize = 0; ; mantSize += 1) + { + c = *p; + if (!isdigit(c)) { + if ((c != '.') || (decPt >= 0)) { + break; + } + decPt = mantSize; + } + p += 1; + } + + /* + * Now suck up the digits in the mantissa. Use two integers to + * collect 9 digits each (this is faster than using floating-point). + * If the mantissa has more than 18 digits, ignore the extras, since + * they can't affect the value anyway. + */ + + pExp = p; + p -= mantSize; + if (decPt < 0) { + decPt = mantSize; + } else { + mantSize -= 1; /* One of the digits was the point. */ + } + if (mantSize > 18) { + fracExp = decPt - 18; + mantSize = 18; + } else { + fracExp = decPt - mantSize; + } + if (mantSize == 0) { + fraction = 0.0; + p = string; + goto done; + } else { + int frac1, frac2; + frac1 = 0; + for ( ; mantSize > 9; mantSize -= 1) + { + c = *p; + p += 1; + if (c == '.') { + c = *p; + p += 1; + } + frac1 = 10*frac1 + (c - '0'); + } + frac2 = 0; + for (; mantSize > 0; mantSize -= 1) + { + c = *p; + p += 1; + if (c == '.') { + c = *p; + p += 1; + } + frac2 = 10*frac2 + (c - '0'); + } + fraction = (1.0e9 * frac1) + frac2; + } + + /* + * Skim off the exponent. + */ + + p = pExp; + if ((*p == 'E') || (*p == 'e')) { + p += 1; + if (*p == '-') { + expSign = TRUE; + p += 1; + } else { + if (*p == '+') { + p += 1; + } + expSign = FALSE; + } + while (isdigit(*p)) { + exp = exp * 10 + (*p - '0'); + p += 1; + } + } + if (expSign) { + exp = fracExp - exp; + } else { + exp = fracExp + exp; + } + + /* + * Generate a floating-point number that represents the exponent. + * Do this by processing the exponent one bit at a time to combine + * many powers of 2 of 10. Then combine the exponent with the + * fraction. + */ + + if (exp < 0) { + expSign = TRUE; + exp = -exp; + } else { + expSign = FALSE; + } + if (exp > maxExponent) { + exp = maxExponent; + } + dblExp = 1.0; + for (d = powersOf10; exp != 0; exp >>= 1, d += 1) { + if (exp & 01) { + dblExp *= *d; + } + } + if (expSign) { + fraction /= dblExp; + } else { + fraction *= dblExp; + } + +done: + if (endPtr != NULL) { + *endPtr = (char *) p; + } + + if (sign) { + return -fraction; + } + return fraction; +} diff --git a/vendor/x11iraf/obm/Tcl/compat/strtol.c b/vendor/x11iraf/obm/Tcl/compat/strtol.c new file mode 100644 index 00000000..b5341a78 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/strtol.c @@ -0,0 +1,99 @@ +/* + * strtol.c -- + * + * Source code for the "strtol" library procedure. + * + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strtol.c,v 1.2 93/03/19 15:25:43 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include <ctype.h> + + +/* + *---------------------------------------------------------------------- + * + * strtol -- + * + * Convert an ASCII string into an integer. + * + * Results: + * The return value is the integer equivalent of string. If endPtr + * is non-NULL, then *endPtr is filled in with the character + * after the last one that was part of the integer. If string + * doesn't contain a valid integer value, then zero is returned + * and *endPtr is set to string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +long int +strtol(string, endPtr, base) + char *string; /* String of ASCII digits, possibly + * preceded by white space. For bases + * greater than 10, either lower- or + * upper-case digits may be used. + */ + char **endPtr; /* Where to store address of terminating + * character, or NULL. */ + int base; /* Base for conversion. Must be less + * than 37. If 0, then the base is chosen + * from the leading characters of string: + * "0x" means hex, "0" means octal, anything + * else means decimal. + */ +{ + register char *p; + int result; + + /* + * Skip any leading blanks. + */ + + p = string; + while (isspace(*p)) { + p += 1; + } + + /* + * Check for a sign. + */ + + if (*p == '-') { + p += 1; + result = -(strtoul(p, endPtr, base)); + } else { + if (*p == '+') { + p += 1; + } + result = strtoul(p, endPtr, base); + } + if ((result == 0) && (endPtr != 0) && (*endPtr == p)) { + *endPtr = string; + } + return result; +} diff --git a/vendor/x11iraf/obm/Tcl/compat/strtoul.c b/vendor/x11iraf/obm/Tcl/compat/strtoul.c new file mode 100644 index 00000000..8981e2c8 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/strtoul.c @@ -0,0 +1,199 @@ +/* + * strtoul.c -- + * + * Source code for the "strtoul" library procedure. + * + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strtoul.c,v 1.3 93/03/19 15:25:41 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include <ctype.h> + +/* + * The table below is used to convert from ASCII digits to a + * numerical equivalent. It maps from '0' through 'z' to integers + * (100 for non-digit characters). + */ + +static char cvtIn[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* '0' - '9' */ + 100, 100, 100, 100, 100, 100, 100, /* punctuation */ + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'A' - 'Z' */ + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, + 100, 100, 100, 100, 100, 100, /* punctuation */ + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'a' - 'z' */ + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35}; + +/* + *---------------------------------------------------------------------- + * + * strtoul -- + * + * Convert an ASCII string into an integer. + * + * Results: + * The return value is the integer equivalent of string. If endPtr + * is non-NULL, then *endPtr is filled in with the character + * after the last one that was part of the integer. If string + * doesn't contain a valid integer value, then zero is returned + * and *endPtr is set to string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +unsigned long int +strtoul(string, endPtr, base) + char *string; /* String of ASCII digits, possibly + * preceded by white space. For bases + * greater than 10, either lower- or + * upper-case digits may be used. + */ + char **endPtr; /* Where to store address of terminating + * character, or NULL. */ + int base; /* Base for conversion. Must be less + * than 37. If 0, then the base is chosen + * from the leading characters of string: + * "0x" means hex, "0" means octal, anything + * else means decimal. + */ +{ + register char *p; + register unsigned long int result = 0; + register unsigned digit; + int anyDigits = 0; + + /* + * Skip any leading blanks. + */ + + p = string; + while (isspace(*p)) { + p += 1; + } + + /* + * If no base was provided, pick one from the leading characters + * of the string. + */ + + if (base == 0) + { + if (*p == '0') { + p += 1; + if (*p == 'x') { + p += 1; + base = 16; + } else { + + /* + * Must set anyDigits here, otherwise "0" produces a + * "no digits" error. + */ + + anyDigits = 1; + base = 8; + } + } + else base = 10; + } else if (base == 16) { + + /* + * Skip a leading "0x" from hex numbers. + */ + + if ((p[0] == '0') && (p[1] == 'x')) { + p += 2; + } + } + + /* + * Sorry this code is so messy, but speed seems important. Do + * different things for base 8, 10, 16, and other. + */ + + if (base == 8) { + for ( ; ; p += 1) { + digit = *p - '0'; + if (digit > 7) { + break; + } + result = (result << 3) + digit; + anyDigits = 1; + } + } else if (base == 10) { + for ( ; ; p += 1) { + digit = *p - '0'; + if (digit > 9) { + break; + } + result = (10*result) + digit; + anyDigits = 1; + } + } else if (base == 16) { + for ( ; ; p += 1) { + digit = *p - '0'; + if (digit > ('z' - '0')) { + break; + } + digit = cvtIn[digit]; + if (digit > 15) { + break; + } + result = (result << 4) + digit; + anyDigits = 1; + } + } else { + for ( ; ; p += 1) { + digit = *p - '0'; + if (digit > ('z' - '0')) { + break; + } + digit = cvtIn[digit]; + if (digit >= base) { + break; + } + result = result*base + digit; + anyDigits = 1; + } + } + + /* + * See if there were any digits at all. + */ + + if (!anyDigits) { + p = string; + } + + if (endPtr != 0) { + *endPtr = p; + } + + return result; +} diff --git a/vendor/x11iraf/obm/Tcl/compat/tmpnam.c b/vendor/x11iraf/obm/Tcl/compat/tmpnam.c new file mode 100644 index 00000000..48074716 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/tmpnam.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific written prior permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)tmpnam.c 4.4 (Berkeley) 6/8/88"; +#endif /* LIBC_SCCS and not lint */ + +#include <sys/param.h> +#include <sys/stat.h> +#include <sys/file.h> +#include <stdio.h> + +/* + * Use /tmp instead of /usr/tmp, because L_tmpname is only 14 chars + * on some machines (like NeXT machines) and /usr/tmp will cause + * buffer overflows. + */ + +#define P_tmpdir "/tmp" + +char * +tmpnam(s) + char *s; +{ + static char name[50]; + char *mktemp(); + + if (!s) + s = name; + (void)sprintf(s, "%s/XXXXXX", P_tmpdir); + return(mktemp(s)); +} diff --git a/vendor/x11iraf/obm/Tcl/compat/unistd.h b/vendor/x11iraf/obm/Tcl/compat/unistd.h new file mode 100644 index 00000000..a0f31dca --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/unistd.h @@ -0,0 +1,83 @@ +/* + * unistd.h -- + * + * Macros, CONSTants and prototypes for Posix conformance. + * + * Copyright 1989 Regents of the University of California + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. The University of California + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * $Header: /user6/ouster/tcl/compat/RCS/unistd.h,v 1.4 93/09/02 16:35:38 ouster Exp $ + */ + +#ifndef _UNISTD +#define _UNISTD + +#include <sys/types.h> +#ifndef _TCL +# include "tcl.h" +#endif + +#ifndef NULL +#define NULL 0 +#endif + +/* + * Strict POSIX stuff goes here. Extensions go down below, in the + * ifndef _POSIX_SOURCE section. + */ + +extern void _exit _ANSI_ARGS_((int status)); +extern int access _ANSI_ARGS_((CONST char *path, int mode)); +extern int chdir _ANSI_ARGS_((CONST char *path)); +extern int chown _ANSI_ARGS_((CONST char *path, uid_t owner, gid_t group)); +extern int close _ANSI_ARGS_((int fd)); +extern int dup _ANSI_ARGS_((int oldfd)); +extern int dup2 _ANSI_ARGS_((int oldfd, int newfd)); +extern int execl _ANSI_ARGS_((CONST char *path, ...)); +extern int execle _ANSI_ARGS_((CONST char *path, ...)); +extern int execlp _ANSI_ARGS_((CONST char *file, ...)); +extern int execv _ANSI_ARGS_((CONST char *path, char **argv)); +extern int execve _ANSI_ARGS_((CONST char *path, char **argv, char **envp)); +extern int execvp _ANSI_ARGS_((CONST char *file, char **argv)); +extern pid_t fork _ANSI_ARGS_((void)); +extern char *getcwd _ANSI_ARGS_((char *buf, size_t size)); +extern gid_t getegid _ANSI_ARGS_((void)); +extern uid_t geteuid _ANSI_ARGS_((void)); +extern gid_t getgid _ANSI_ARGS_((void)); +extern int getgroups _ANSI_ARGS_((int bufSize, int *buffer)); +extern pid_t getpid _ANSI_ARGS_((void)); +extern uid_t getuid _ANSI_ARGS_((void)); +extern int isatty _ANSI_ARGS_((int fd)); +extern off_t lseek _ANSI_ARGS_((int fd, off_t offset, int whence)); +extern int pipe _ANSI_ARGS_((int *fildes)); +extern int read _ANSI_ARGS_((int fd, char *buf, size_t size)); +extern int setgid _ANSI_ARGS_((gid_t group)); +extern int setuid _ANSI_ARGS_((uid_t user)); +extern unsigned sleep _ANSI_ARGS_ ((unsigned seconds)); +extern char *ttyname _ANSI_ARGS_((int fd)); +extern int unlink _ANSI_ARGS_((CONST char *path)); +extern int write _ANSI_ARGS_((int fd, CONST char *buf, size_t size)); + +#ifndef _POSIX_SOURCE +extern char *crypt _ANSI_ARGS_((CONST char *, CONST char *)); +extern int fchown _ANSI_ARGS_((int fd, uid_t owner, gid_t group)); +extern int flock _ANSI_ARGS_((int fd, int operation)); +extern int ftruncate _ANSI_ARGS_((int fd, unsigned long length)); +extern int readlink _ANSI_ARGS_((CONST char *path, char *buf, int bufsize)); +extern int setegid _ANSI_ARGS_((gid_t group)); +extern int seteuid _ANSI_ARGS_((uid_t user)); +extern int setreuid _ANSI_ARGS_((int ruid, int euid)); +extern int symlink _ANSI_ARGS_((CONST char *, CONST char *)); +extern int ttyslot _ANSI_ARGS_((void)); +extern int truncate _ANSI_ARGS_((CONST char *path, unsigned long length)); +extern int vfork _ANSI_ARGS_((void)); +#endif /* _POSIX_SOURCE */ + +#endif /* _UNISTD */ + diff --git a/vendor/x11iraf/obm/Tcl/compat/waitpid.c b/vendor/x11iraf/obm/Tcl/compat/waitpid.c new file mode 100644 index 00000000..dd9713fa --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/compat/waitpid.c @@ -0,0 +1,186 @@ +/* + * waitpid.c -- + * + * This procedure emulates the POSIX waitpid kernel call on + * BSD systems that don't have waitpid but do have wait3. + * This code is based on a prototype version written by + * Mark Diekhans and Karl Lehenbauer. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/waitpid.c,v 1.5 93/07/01 15:25:18 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + * A linked list of the following structures is used to keep track + * of processes for which we received notification from the kernel, + * but the application hasn't waited for them yet (this can happen + * because wait may not return the process we really want). We + * save the information here until the application finally does + * wait for the process. + */ + +typedef struct WaitInfo { + int pid; /* Pid of process that exited. */ + WAIT_STATUS_TYPE status; /* Status returned when child exited + * or suspended. */ + struct WaitInfo *nextPtr; /* Next in list of exited processes. */ +} WaitInfo; + +static WaitInfo *deadList = NULL; /* First in list of all dead + * processes. */ + +/* + *---------------------------------------------------------------------- + * + * waitpid -- + * + * This procedure emulates the functionality of the POSIX + * waitpid kernel call, using the BSD wait3 kernel call. + * Note: it doesn't emulate absolutely all of the waitpid + * functionality, in that it doesn't support pid's of 0 + * or < -1. + * + * Results: + * -1 is returned if there is an error in the wait kernel call. + * Otherwise the pid of an exited or suspended process is + * returned and *statusPtr is set to the status value of the + * process. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +#ifdef waitpid +# undef waitpid +#endif + +int +waitpid(pid, statusPtr, options) + int pid; /* The pid to wait on. Must be -1 or + * greater than zero. */ + int *statusPtr; /* Where to store wait status for the + * process. */ + int options; /* OR'ed combination of WNOHANG and + * WUNTRACED. */ +{ + register WaitInfo *waitPtr, *prevPtr; + int result; + WAIT_STATUS_TYPE status; + + if ((pid < -1) || (pid == 0)) { + errno = EINVAL; + return -1; + } + + /* + * See if there's a suitable process that has already stopped or + * exited. If so, remove it from the list of exited processes and + * return its information. + */ + + for (waitPtr = deadList, prevPtr = NULL; waitPtr != NULL; + prevPtr = waitPtr, waitPtr = waitPtr->nextPtr) { + if ((pid != waitPtr->pid) && (pid != -1)) { + continue; + } + if (!(options & WUNTRACED) && (WIFSTOPPED(waitPtr->status))) { + continue; + } + result = waitPtr->pid; + *statusPtr = *((int *) &waitPtr->status); + if (prevPtr == NULL) { + deadList = waitPtr->nextPtr; + } else { + prevPtr->nextPtr = waitPtr->nextPtr; + } + ckfree((char *) waitPtr); + return result; + } + + /* + * Wait for any process to stop or exit. If it's an acceptable one + * then return it to the caller; otherwise store information about it + * in the list of exited processes and try again. On systems that + * have only wait but not wait3, there are several situations we can't + * handle, but we do the best we can (e.g. can still handle some + * combinations of options by invoking wait instead of wait3). + */ + + while (1) { +#if NO_WAIT3 + if (options & WNOHANG) { + return 0; + } + if (options != 0) { + errno = EINVAL; + return -1; + } + result = wait(&status); +#else + result = wait3(&status, options, 0); +#endif + if ((result == -1) && (errno == EINTR)) { + continue; + } + if (result <= 0) { + return result; + } + + if ((pid != result) && (pid != -1)) { + goto saveInfo; + } + if (!(options & WUNTRACED) && (WIFSTOPPED(status))) { + goto saveInfo; + } + *statusPtr = *((int *) &status); + return result; + + /* + * Can't return this info to caller. Save it in the list of + * stopped or exited processes. Tricky point: first check for + * an existing entry for the process and overwrite it if it + * exists (e.g. a previously stopped process might now be dead). + */ + + saveInfo: + for (waitPtr = deadList; waitPtr != NULL; waitPtr = waitPtr->nextPtr) { + if (waitPtr->pid == result) { + waitPtr->status = status; + goto waitAgain; + } + } + waitPtr = (WaitInfo *) ckalloc(sizeof(WaitInfo)); + waitPtr->pid = result; + waitPtr->status = status; + waitPtr->nextPtr = deadList; + deadList = waitPtr; + + waitAgain: continue; + } +} diff --git a/vendor/x11iraf/obm/Tcl/config.status b/vendor/x11iraf/obm/Tcl/config.status new file mode 100755 index 00000000..d53efe58 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/config.status @@ -0,0 +1,64 @@ +#!/bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host apus: +# +# ./configure + +for arg +do + case "$arg" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + exec /bin/sh ./configure ;; + *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; + esac +done + +trap 'rm -f Makefile; exit 1' 1 3 15 +INSTALL='cp' +INSTALL_PROGRAM='$(INSTALL)' +INSTALL_DATA='$(INSTALL)' +RANLIB='echo ranlib' +CC='cc' +LIBOBJS=' tclMtherr.o' +CPP='cc -E' +LIBS='' +srcdir='.' +DEFS=' -DNO_GETWD=1 -DNO_WAIT3=1 -DHAVE_UNISTD_H=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1' +prefix='' +exec_prefix='' +prsub='' + +top_srcdir=$srcdir + +# Allow make-time overrides of the generated file list. +test -n "$gen_files" || gen_files="Makefile" + +for file in .. $gen_files; do if [ "x$file" != "x.." ]; then + srcdir=$top_srcdir + # Remove last slash and all that follows it. Not all systems have dirname. + dir=`echo $file|sed 's%/[^/][^/]*$%%'` + if test "$dir" != "$file"; then + test "$top_srcdir" != . && srcdir=$top_srcdir/$dir + test ! -d $dir && mkdir $dir + fi + echo creating $file + rm -f $file + echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file + sed -e " +$prsub +s%@INSTALL@%$INSTALL%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@CC@%$CC%g +s%@LIBOBJS@%$LIBOBJS%g +s%@CPP@%$CPP%g +s%@LIBS@%$LIBS%g +s%@srcdir@%$srcdir%g +s%@DEFS@%$DEFS% +" $top_srcdir/${file}.in >> $file +fi; done + +exit 0 diff --git a/vendor/x11iraf/obm/Tcl/configure b/vendor/x11iraf/obm/Tcl/configure new file mode 100755 index 00000000..61f0a4d3 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/configure @@ -0,0 +1,1015 @@ +#!/bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf. +# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create] +# [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET] +# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and +# --with-PACKAGE unless this script has special code to handle it. + + +for arg +do + # Handle --exec-prefix with a space before the argument. + if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix= + # Handle --host with a space before the argument. + elif test x$next_host = xyes; then next_host= + # Handle --prefix with a space before the argument. + elif test x$next_prefix = xyes; then prefix=$arg; next_prefix= + # Handle --srcdir with a space before the argument. + elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir= + else + case $arg in + # For backward compatibility, also recognize exact --exec_prefix. + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*) + exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e) + next_exec_prefix=yes ;; + + -gas | --gas | --ga | --g) ;; + + -host=* | --host=* | --hos=* | --ho=* | --h=*) ;; + -host | --host | --hos | --ho | --h) + next_host=yes ;; + + -nfp | --nfp | --nf) ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no) + no_create=1 ;; + + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + next_prefix=yes ;; + + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*) + srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s) + next_srcdir=yes ;; + + -with-* | --with-*) + package=`echo $arg|sed 's/-*with-//'` + # Delete all the valid chars; see if any are left. + if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then + echo "configure: $package: invalid package name" >&2; exit 1 + fi + eval "with_`echo $package|sed s/-/_/g`=1" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v) + verbose=yes ;; + + *) ;; + esac + fi +done + +trap 'rm -fr conftest* core; exit 1' 1 3 15 + +# NLS nuisances. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi + +rm -f conftest* +compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +unique_file=tcl.h + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + srcdirdefaulted=yes + # Try the directory containing this script, then `..'. + prog=$0 + confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` + test "X$confdir" = "X$prog" && confdir=. + srcdir=$confdir + if test ! -r $srcdir/$unique_file; then + srcdir=.. + fi +fi +if test ! -r $srcdir/$unique_file; then + if test x$srcdirdefaulted = xyes; then + echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2 + else + echo "configure: Can not find sources in \`${srcdir}'." 1>&2 + fi + exit 1 +fi +# Preserve a srcdir of `.' to avoid automounter screwups with pwd. +# But we can't avoid them for `..', to make subdirectories work. +case $srcdir in + .|/*|~*) ;; + *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. +esac + +# Save the original args to write them into config.status later. +configure_args="$*" + +# Make sure to not get the incompatible SysV /etc/install and +# /usr/sbin/install, which might be in PATH before a BSD-like install, +# or the SunOS /usr/etc/install directory, or the AIX /bin/install, +# or the AFS install, which mishandles nonexistent args, or +# /usr/ucb/install on SVR4, which tries to use the nonexistent group +# `staff'. On most BSDish systems install is in /usr/bin, not /usr/ucb +# anyway. Sigh. +if test "z${INSTALL}" = "z" ; then + echo checking for install + IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + case $dir in + /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;; + *) + if test -f $dir/installbsd; then + INSTALL="$dir/installbsd -c" # OSF1 + INSTALL_PROGRAM='$(INSTALL)' + INSTALL_DATA='$(INSTALL) -m 644' + break + fi + if test -f $dir/install; then + if grep dspmsg $dir/install >/dev/null 2>&1; then + : # AIX + else + INSTALL="$dir/install -c" + INSTALL_PROGRAM='$(INSTALL)' + INSTALL_DATA='$(INSTALL) -m 644' + break + fi + fi + ;; + esac + done + IFS="$saveifs" +fi +INSTALL=${INSTALL-cp} +INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'} +INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'} + +if test -z "$RANLIB"; then + # Extract the first word of `ranlib', so it can be a program name with args. + set dummy ranlib; word=$2 + echo checking for $word + IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/$word; then + RANLIB="ranlib" + break + fi + done + IFS="$saveifs" +fi +test -z "$RANLIB" && RANLIB=":" +test -n "$RANLIB" -a -n "$verbose" && echo " setting RANLIB to $RANLIB" + +CC=${CC-cc} + + +#-------------------------------------------------------------------- +# Supply substitutes for missing POSIX library procedures, or +# set flags so Tcl uses alternate procedures. +#-------------------------------------------------------------------- + +for func in getcwd opendir strerror strstr +do +echo checking for ${func} +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_${func}) || defined (__stub___${func}) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char ${func}(); ${func}(); +#endif + } +EOF +if eval $compile; then + : +else + LIBOBJS="$LIBOBJS ${func}.o" +test -n "$verbose" && echo " using ${func}.o instead" +fi +rm -f conftest* + +done + +for func in strtol tmpnam waitpid +do +echo checking for ${func} +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_${func}) || defined (__stub___${func}) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char ${func}(); ${func}(); +#endif + } +EOF +if eval $compile; then + : +else + LIBOBJS="$LIBOBJS ${func}.o" +test -n "$verbose" && echo " using ${func}.o instead" +fi +rm -f conftest* + +done + +echo checking for gettimeofday +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char gettimeofday(); gettimeofday(); +#endif + } +EOF +if eval $compile; then + : +else + { +test -n "$verbose" && \ +echo " defining NO_GETTOD" +DEFS="$DEFS -DNO_GETTOD=1" +} + +fi +rm -f conftest* + +echo checking for getwd +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_getwd) || defined (__stub___getwd) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char getwd(); getwd(); +#endif + } +EOF +if eval $compile; then + : +else + { +test -n "$verbose" && \ +echo " defining NO_GETWD" +DEFS="$DEFS -DNO_GETWD=1" +} + +fi +rm -f conftest* + +echo checking for wait3 +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_wait3) || defined (__stub___wait3) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char wait3(); wait3(); +#endif + } +EOF +if eval $compile; then + : +else + { +test -n "$verbose" && \ +echo " defining NO_WAIT3" +DEFS="$DEFS -DNO_WAIT3=1" +} + +fi +rm -f conftest* + + +#-------------------------------------------------------------------- +# Supply substitutes for missing POSIX header files. Special +# notes: +# - Sprite's dirent.h exists but is bogus. +# - stdlib.h doesn't define strtol, strtoul, or +# strtod insome versions of SunOS +# - some versions of string.h don't declare procedures such +# as strstr +#-------------------------------------------------------------------- + +echo checking for unistd.h +echo checking how to run the C preprocessor +if test -z "$CPP"; then + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and ``${CC-cc}'' will simply confuse + # make. It must be expanded now. + CPP="${CC-cc} -E" + cat > conftest.c <<EOF +#include <stdio.h> +Syntax Error +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + : +else + CPP=/lib/cpp +fi +rm -f conftest* +fi +test ".${verbose}" != "." && echo " setting CPP to $CPP" + +cat > conftest.c <<EOF +#include <unistd.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + +{ +test -n "$verbose" && \ +echo " defining HAVE_UNISTD_H" +DEFS="$DEFS -DHAVE_UNISTD_H=1" +} + +fi +rm -f conftest* + +echo checking for dirent.h +cat > conftest.c <<EOF +#include <sys/types.h> +#include <dirent.h> +int main() { exit(0); } +int t() { +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); + } +EOF +if eval $compile; then + tcl_ok=1 +else + tcl_ok=0 +fi +rm -f conftest* + +echo '#include <tcl_ok=0>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "Sprite version.* NOT POSIX" conftest.out >/dev/null 2>&1; then + : +fi +rm -f conftest* + +if test $tcl_ok = 0; then + +{ +test -n "$verbose" && \ +echo " defining NO_DIRENT_H" +DEFS="$DEFS -DNO_DIRENT_H=1" +} + +fi +echo checking for errno.h +cat > conftest.c <<EOF +#include <errno.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_ERRNO_H" +DEFS="$DEFS -DNO_ERRNO_H=1" +} + +fi +rm -f conftest* + +echo checking for float.h +cat > conftest.c <<EOF +#include <float.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_FLOAT_H" +DEFS="$DEFS -DNO_FLOAT_H=1" +} + +fi +rm -f conftest* + +echo checking for limits.h +cat > conftest.c <<EOF +#include <limits.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_LIMITS_H" +DEFS="$DEFS -DNO_LIMITS_H=1" +} + +fi +rm -f conftest* + +echo checking for stdlib.h +cat > conftest.c <<EOF +#include <stdlib.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + tcl_ok=1 +else + tcl_ok=0 +fi +rm -f conftest* + +echo '#include <stdlib.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "strtol" conftest.out >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + +echo '#include <stdlib.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "strtoul" conftest.out >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + +echo '#include <stdlib.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "strtod" conftest.out >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + +if test $tcl_ok = 0; then + +{ +test -n "$verbose" && \ +echo " defining NO_STDLIB_H" +DEFS="$DEFS -DNO_STDLIB_H=1" +} + +fi +echo checking for string.h +cat > conftest.c <<EOF +#include <string.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + tcl_ok=1 +else + tcl_ok=0 +fi +rm -f conftest* + +echo '#include <string.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "strstr" conftest.out >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + +echo '#include <string.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "strerror" conftest.out >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + +if test $tcl_ok = 0; then + +{ +test -n "$verbose" && \ +echo " defining NO_STRING_H" +DEFS="$DEFS -DNO_STRING_H=1" +} + +fi +echo checking for sys/time.h +cat > conftest.c <<EOF +#include <sys/time.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_SYS_TIME_H" +DEFS="$DEFS -DNO_SYS_TIME_H=1" +} + +fi +rm -f conftest* + +echo checking for sys/wait.h +cat > conftest.c <<EOF +#include <sys/wait.h> +EOF +err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"` +if test -z "$err"; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_SYS_WAIT_H" +DEFS="$DEFS -DNO_SYS_WAIT_H=1" +} + +fi +rm -f conftest* + + +#-------------------------------------------------------------------- +# On some systems strstr is broken: it returns a pointer even +# even if the original string is empty. +#-------------------------------------------------------------------- + +cat > conftest.c <<EOF + +extern int strstr(); +int main() +{ + exit(strstr("\0test", "test") ? 1 : 0); +} + +EOF +eval $compile +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + LIBOBJS="$LIBOBJS strstr.o" +fi +rm -f conftest* + +#-------------------------------------------------------------------- +# Check for strtoul function. This is tricky because under some +# versions of AIX strtoul returns an incorrect terminator +# pointer for the string "0". +#-------------------------------------------------------------------- + +echo checking for strtoul +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strtoul) || defined (__stub___strtoul) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char strtoul(); strtoul(); +#endif + } +EOF +if eval $compile; then + tcl_ok=1 +else + tcl_ok=0 +fi +rm -f conftest* + +cat > conftest.c <<EOF + +extern int strtoul(); +int main() +{ + char *string = "0"; + char *term; + int value; + value = strtoul(string, &term, 0); + if ((value != 0) || (term != (string+1))) { + exit(1); + } + exit(0); +} +EOF +eval $compile +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + tcl_ok=0 +fi +rm -f conftest* +if test $tcl_ok = 0; then + LIBOBJS="$LIBOBJS strtoul.o" +fi + +#-------------------------------------------------------------------- +# Check for the strtod function. This is tricky because under +# some versions of Linux it mis-parses the string "+". +#-------------------------------------------------------------------- + +echo checking for strtod +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strtod) || defined (__stub___strtod) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char strtod(); strtod(); +#endif + } +EOF +if eval $compile; then + tcl_ok=1 +else + tcl_ok=0 +fi +rm -f conftest* + +cat > conftest.c <<EOF + +extern double strtod(); +int main() +{ + char *string = "+"; + char *term; + double value; + value = strtod(string, &term); + if (term != string) { + exit(1); + } + exit(0); +} +EOF +eval $compile +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + tcl_ok=0 +fi +rm -f conftest* +if test $tcl_ok = 0; then + LIBOBJS="$LIBOBJS strtod.o" +fi + +#-------------------------------------------------------------------- +# Check for various typedefs and provide substitutes if +# they don't exist. +#-------------------------------------------------------------------- + +echo checking for mode_t in sys/types.h +echo '#include <sys/types.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "mode_t" conftest.out >/dev/null 2>&1; then + : +else + +{ +test -n "$verbose" && \ +echo " defining mode_t to be int" +DEFS="$DEFS -Dmode_t=int" +} + +fi +rm -f conftest* + +echo checking for pid_t in sys/types.h +echo '#include <sys/types.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "pid_t" conftest.out >/dev/null 2>&1; then + : +else + +{ +test -n "$verbose" && \ +echo " defining pid_t to be int" +DEFS="$DEFS -Dpid_t=int" +} + +fi +rm -f conftest* + +echo checking for size_t in sys/types.h +echo '#include <sys/types.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "size_t" conftest.out >/dev/null 2>&1; then + : +else + +{ +test -n "$verbose" && \ +echo " defining size_t to be unsigned" +DEFS="$DEFS -Dsize_t=unsigned" +} + +fi +rm -f conftest* + +echo checking for uid_t in sys/types.h +echo '#include <sys/types.h>' > conftest.c +eval "$CPP \$DEFS conftest.c > conftest.out 2>&1" +if egrep "uid_t" conftest.out >/dev/null 2>&1; then + : +else + +{ +test -n "$verbose" && \ +echo " defining uid_t to be int" +DEFS="$DEFS -Duid_t=int" +} + +{ +test -n "$verbose" && \ +echo " defining gid_t to be int" +DEFS="$DEFS -Dgid_t=int" +} + +fi +rm -f conftest* + + +#-------------------------------------------------------------------- +# If a system doesn't have an opendir function (man, that's old!) +# then we have to supply a different version of dirent.h which +# is compatible with the substitute version of opendir that's +# provided. This version only works with V7-style directories. +#-------------------------------------------------------------------- + +echo checking for opendir +cat > conftest.c <<EOF +#include <ctype.h> +int main() { exit(0); } +int t() { +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_opendir) || defined (__stub___opendir) +choke me +#else +/* Override any gcc2 internal prototype to avoid an error. */ +extern char opendir(); opendir(); +#endif + } +EOF +if eval $compile; then + : +else + { +test -n "$verbose" && \ +echo " defining USE_DIRENT2_H" +DEFS="$DEFS -DUSE_DIRENT2_H=1" +} + +fi +rm -f conftest* + + +#-------------------------------------------------------------------- +# Check for the existence of sys_errlist (this is only needed if +# there's no strerror, but I don't know how to conditionalize the +# check). +#-------------------------------------------------------------------- + +echo checking for sys_errlist +cat > conftest.c <<EOF + +int main() { exit(0); } +int t() { +extern char *sys_errlist[]; +extern int sys_nerr; +sys_errlist[sys_nerr-1][0] = 0; + } +EOF +if eval $compile; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_SYS_ERRLIST" +DEFS="$DEFS -DNO_SYS_ERRLIST=1" +} + +fi +rm -f conftest* + + +#-------------------------------------------------------------------- +# The check below checks whether <sys/wait.h> defines the type +# "union wait" correctly. It's needed because of weirdness in +# HP-UX where "union wait" is defined in both the BSD and SYS-V +# environments. Checking the usability of WIFEXITED seems to do +# the trick. +#-------------------------------------------------------------------- + +echo checking for union wait +cat > conftest.c <<EOF +#include <sys/types.h> +#include <sys/wait.h> +int main() { exit(0); } +int t() { +union wait x; +WIFEXITED(x); /* Generates compiler error if WIFEXITED + * uses an int. */ + } +EOF +if eval $compile; then + : +else + +{ +test -n "$verbose" && \ +echo " defining NO_UNION_WAIT" +DEFS="$DEFS -DNO_UNION_WAIT=1" +} + +fi +rm -f conftest* + + +#-------------------------------------------------------------------- +# Check to see whether the system supports the matherr function +# and its associated type "struct exception". +#-------------------------------------------------------------------- + +echo checking for matherr support +cat > conftest.c <<EOF +#include <math.h> +int main() { exit(0); } +int t() { +struct exception x; +x.type = DOMAIN; +x.type = SING; + } +EOF +if eval $compile; then + LIBOBJS="$LIBOBJS tclMtherr.o"; +{ +test -n "$verbose" && \ +echo " defining NEED_MATHERR" +DEFS="$DEFS -DNEED_MATHERR=1" +} + +fi +rm -f conftest* + + +if test -n "$prefix"; then + test -z "$exec_prefix" && exec_prefix='${prefix}' + prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" +fi +if test -n "$exec_prefix"; then + prsub="$prsub +s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" +fi +cat >conftest.def <<EOF +$DEFS +EOF +escape_ampersand_and_backslash='s%[&\\]%\\&%g' +DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def` +rm -f conftest.def + +trap 'rm -f config.status; exit 1' 1 3 15 +echo creating config.status +rm -f config.status +cat > config.status <<EOF +#!/bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $configure_args + +for arg +do + case "\$arg" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + exec /bin/sh $0 $configure_args ;; + *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; + esac +done + +trap 'rm -f Makefile; exit 1' 1 3 15 +INSTALL='$INSTALL' +INSTALL_PROGRAM='$INSTALL_PROGRAM' +INSTALL_DATA='$INSTALL_DATA' +RANLIB='$RANLIB' +CC='$CC' +LIBOBJS='$LIBOBJS' +CPP='$CPP' +LIBS='$LIBS' +srcdir='$srcdir' +DEFS='$DEFS' +prefix='$prefix' +exec_prefix='$exec_prefix' +prsub='$prsub' +EOF +cat >> config.status <<\EOF + +top_srcdir=$srcdir + +# Allow make-time overrides of the generated file list. +test -n "$gen_files" || gen_files="Makefile" + +for file in .. $gen_files; do if [ "x$file" != "x.." ]; then + srcdir=$top_srcdir + # Remove last slash and all that follows it. Not all systems have dirname. + dir=`echo $file|sed 's%/[^/][^/]*$%%'` + if test "$dir" != "$file"; then + test "$top_srcdir" != . && srcdir=$top_srcdir/$dir + test ! -d $dir && mkdir $dir + fi + echo creating $file + rm -f $file + echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file + sed -e " +$prsub +s%@INSTALL@%$INSTALL%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@CC@%$CC%g +s%@LIBOBJS@%$LIBOBJS%g +s%@CPP@%$CPP%g +s%@LIBS@%$LIBS%g +s%@srcdir@%$srcdir%g +s%@DEFS@%$DEFS% +" $top_srcdir/${file}.in >> $file +fi; done + +exit 0 +EOF +chmod +x config.status +test -n "$no_create" || ./config.status + diff --git a/vendor/x11iraf/obm/Tcl/configure.in b/vendor/x11iraf/obm/Tcl/configure.in new file mode 100755 index 00000000..f1fa256c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/configure.in @@ -0,0 +1,182 @@ +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which is run during Tcl installation +dnl to configure the system for the local environment. +AC_INIT(tcl.h) +AC_PROG_INSTALL +AC_PROG_RANLIB +CC=${CC-cc} +AC_SUBST(CC) + +#-------------------------------------------------------------------- +# Supply substitutes for missing POSIX library procedures, or +# set flags so Tcl uses alternate procedures. +#-------------------------------------------------------------------- + +AC_REPLACE_FUNCS(getcwd opendir strerror strstr) +AC_REPLACE_FUNCS(strtol tmpnam waitpid) +AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD)) +AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD)) +AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3)) + +#-------------------------------------------------------------------- +# Supply substitutes for missing POSIX header files. Special +# notes: +# - Sprite's dirent.h exists but is bogus. +# - stdlib.h doesn't define strtol, strtoul, or +# strtod insome versions of SunOS +# - some versions of string.h don't declare procedures such +# as strstr +#-------------------------------------------------------------------- + +AC_UNISTD_H +AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h> +#include <dirent.h>], [ +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); +], tcl_ok=1, tcl_ok=0) +AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0) +if test $tcl_ok = 0; then + AC_DEFINE(NO_DIRENT_H) +fi +AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H)) +AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H)) +AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H)) +AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0) +AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0) +AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0) +AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0) +if test $tcl_ok = 0; then + AC_DEFINE(NO_STDLIB_H) +fi +AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0) +AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0) +AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0) +if test $tcl_ok = 0; then + AC_DEFINE(NO_STRING_H) +fi +AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H)) +AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H)) + +#-------------------------------------------------------------------- +# On some systems strstr is broken: it returns a pointer even +# even if the original string is empty. +#-------------------------------------------------------------------- + +AC_TEST_PROGRAM([ +extern int strstr(); +int main() +{ + exit(strstr("\0test", "test") ? 1 : 0); +} +], , [LIBOBJS="$LIBOBJS strstr.o"]) + +#-------------------------------------------------------------------- +# Check for strtoul function. This is tricky because under some +# versions of AIX strtoul returns an incorrect terminator +# pointer for the string "0". +#-------------------------------------------------------------------- + +AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0) +AC_TEST_PROGRAM([ +extern int strtoul(); +int main() +{ + char *string = "0"; + char *term; + int value; + value = strtoul(string, &term, 0); + if ((value != 0) || (term != (string+1))) { + exit(1); + } + exit(0); +}], , tcl_ok=0) +if test $tcl_ok = 0; then + LIBOBJS="$LIBOBJS strtoul.o" +fi + +#-------------------------------------------------------------------- +# Check for the strtod function. This is tricky because under +# some versions of Linux it mis-parses the string "+". +#-------------------------------------------------------------------- + +AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0) +AC_TEST_PROGRAM([ +extern double strtod(); +int main() +{ + char *string = "+"; + char *term; + double value; + value = strtod(string, &term); + if (term != string) { + exit(1); + } + exit(0); +}], , tcl_ok=0) +if test $tcl_ok = 0; then + LIBOBJS="$LIBOBJS strtod.o" +fi + +#-------------------------------------------------------------------- +# Check for various typedefs and provide substitutes if +# they don't exist. +#-------------------------------------------------------------------- + +AC_MODE_T +AC_PID_T +AC_SIZE_T +AC_UID_T + +#-------------------------------------------------------------------- +# If a system doesn't have an opendir function (man, that's old!) +# then we have to supply a different version of dirent.h which +# is compatible with the substitute version of opendir that's +# provided. This version only works with V7-style directories. +#-------------------------------------------------------------------- + +AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H)) + +#-------------------------------------------------------------------- +# Check for the existence of sys_errlist (this is only needed if +# there's no strerror, but I don't know how to conditionalize the +# check). +#-------------------------------------------------------------------- + +AC_COMPILE_CHECK(sys_errlist, , [ +extern char *sys_errlist[]; +extern int sys_nerr; +sys_errlist[sys_nerr-1][0] = 0; +], , AC_DEFINE(NO_SYS_ERRLIST)) + +#-------------------------------------------------------------------- +# The check below checks whether <sys/wait.h> defines the type +# "union wait" correctly. It's needed because of weirdness in +# HP-UX where "union wait" is defined in both the BSD and SYS-V +# environments. Checking the usability of WIFEXITED seems to do +# the trick. +#-------------------------------------------------------------------- + +AC_COMPILE_CHECK([union wait], [#include <sys/types.h> +#include <sys/wait.h>], [ +union wait x; +WIFEXITED(x); /* Generates compiler error if WIFEXITED + * uses an int. */ +], , AC_DEFINE(NO_UNION_WAIT)) + +#-------------------------------------------------------------------- +# Check to see whether the system supports the matherr function +# and its associated type "struct exception". +#-------------------------------------------------------------------- + +AC_COMPILE_CHECK([matherr support], [#include <math.h>], [ +struct exception x; +x.type = DOMAIN; +x.type = SING; +], [LIBOBJS="$LIBOBJS tclMtherr.o"; AC_DEFINE(NEED_MATHERR)]) + +AC_OUTPUT(Makefile) diff --git a/vendor/x11iraf/obm/Tcl/configure.info b/vendor/x11iraf/obm/Tcl/configure.info new file mode 100755 index 00000000..1b15d613 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/configure.info @@ -0,0 +1,81 @@ +This file provides more information about the "configure" script +and how you can personalize it for your local environment. + +The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation, and +creates the Makefile. It also creates a file `config.status' +that you can run in the future to recreate the current configuration. + +Running `configure' takes a minute or two. While it is running, it +prints some messages that tell what it is doing. If you don't want to +see the messages, run `configure' with its standard output redirected +to `/dev/null'; for example, `./configure >/dev/null'. + +To compile the package in a different directory from the one +containing the source code, you must use a version of make that +supports the VPATH variable, such as GNU make. `cd' to the directory +where you want the object files and executables to go and run +`configure'. `configure' automatically checks for the source code in +the directory that `configure' is in and in `..'. If for some reason +`configure' is not in the source code directory that you are +configuring, then it will report that it can't find the source code. +In that case, run `configure' with the option `--srcdir=DIR', where +DIR is the directory that contains the source code. + +By default, `make install' will install the package's files in +/usr/local/bin, /usr/local/lib, /usr/local/man, etc. You can specify +an installation prefix other than /usr/local by giving `configure' the +option `--prefix=PATH'. Alternately, you can do so by giving a value +for the `prefix' variable when you run `make', e.g., + make prefix=/usr/gnu + +You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If +you give `configure' the option `--exec_prefix=PATH' or set the +`make' variable `exec_prefix' to PATH, the package will use PATH as +the prefix for installing programs and libraries. Data files and +documentation will still use the regular prefix. Normally, all files +are installed using the regular prefix. + +You can tell `configure' to figure out the configuration for your +system, and record it in `config.status', without actually configuring +the package (creating `Makefile's and perhaps a configuration header +file). To do this, give `configure' the `--no-create' option. Later, +you can run `./config.status' to actually configure the package. This +option is useful mainly in `Makefile' rules for updating `config.status' +and `Makefile'. You can also give `config.status' the `--recheck' +option, which makes it re-run `configure' with the same arguments you +used before. This is useful if you change `configure'. + +`configure' ignores any other arguments that you give it. + +If your system requires unusual options for compilation or linking +that `configure' doesn't know about, you can give `configure' initial +values for some variables by setting them in the environment. In +Bourne-compatible shells, you can do that on the command line like +this: + CC='gcc -traditional' DEFS=-D_POSIX_SOURCE ./configure + +The `make' variables that you might want to override with environment +variables when running `configure' are: + +(For these variables, any value given in the environment overrides the +value that `configure' would choose:) +CC C compiler program. + Default is `cc', or `gcc' if `gcc' is in your PATH. +INSTALL Program to use to install files. + Default is `install' if you have it, `cp' otherwise. + +(For these variables, any value given in the environment is added to +the value that `configure' chooses:) +DEFS Configuration options, in the form `-Dfoo -Dbar ...' +LIBS Libraries to link with, in the form `-lfoo -lbar ...' + +If you need to do unusual things to compile the package, we encourage +you to figure out how `configure' could check whether to do them, and +mail diffs or instructions to the address given in the README so we +can include them in the next release. + +The file `configure.in' is used as a template to create `configure' by +a program called `autoconf'. You will only need it if you want to +regenerate `configure' using a newer version of `autoconf'. diff --git a/vendor/x11iraf/obm/Tcl/doc/AddErrInfo.3 b/vendor/x11iraf/obm/Tcl/doc/AddErrInfo.3 new file mode 100644 index 00000000..0ed3da3b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/AddErrInfo.3 @@ -0,0 +1,143 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/AddErrInfo.3,v 1.15 93/04/08 13:54:29 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_AddErrorInfo tclc +.BS +.SH NAME +Tcl_AddErrorInfo, Tcl_SetErrorCode, Tcl_PosixError \- record information about errors +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_AddErrorInfo\fR(\fIinterp, message\fR) +.sp +\fBTcl_SetErrorCode\fR(\fIinterp, element, element, ...\fB (char *) NULL\fR) +.sp +char * +\fBTcl_PosixError\fR(\fIinterp\fR) +.SH ARGUMENTS +.AS Tcl_Interp *message +.AP Tcl_Interp *interp in +Interpreter in which to record information. +.AP char *message in +Identifying string to record in \fBerrorInfo\fR variable. +.AP char *element in +String to record as one element of \fBerrorCode\fR variable. +Last \fIelement\fR argument must be NULL. +.BE + +.SH DESCRIPTION +.PP +These procedures are used to manipulate two global variables +that hold information about errors. +The variable \fBerrorInfo\fR holds a stack trace of the +operations that were in progress when an error occurred, and +is intended to be human-readable. +The variable \fBerrorCode\fR holds a list of items that +are intended to be machine-readable. +The first item in \fBerrorCode\fR identifies the class of +.VS +error that occurred (e.g. POSIX means an error occurred in +.VE +a POSIX system call) and additional elements in \fBerrorCode\fR +hold additional pieces of information that depend on the class. +See the Tcl overview manual entry for details on the various +formats for \fBerrorCode\fR. +.PP +The \fBerrorInfo\fR variable is gradually built up as an +error unwinds through the nested operations. +Each time an error code is returned to \fBTcl_Eval\fR +it calls the procedure \fBTcl_AddErrorInfo\fR to add +additional text to \fBerrorInfo\fR describing the +command that was being executed when the error occurred. +By the time the error has been passed all the way back +to the application, it will contain a complete trace +of the activity in progress when the error occurred. +.PP +It is sometimes useful to add additional information to +\fBerrorInfo\fR beyond what can be supplied automatically +by \fBTcl_Eval\fR. +\fBTcl_AddErrorInfo\fR may be used for this purpose: +its \fImessage\fR argument contains an additional +string to be appended to \fBerrorInfo\fR. +For example, the \fBsource\fR command calls \fBTcl_AddErrorInfo\fR +to record the name of the file being processed and the +line number on which the error occurred; for Tcl procedures, the +procedure name and line number within the procedure are recorded, +and so on. +The best time to call \fBTcl_AddErrorInfo\fR is just after +\fBTcl_Eval\fR has returned \fBTCL_ERROR\fR. +In calling \fBTcl_AddErrorInfo\fR, you may find it useful to +use the \fBerrorLine\fR field of the interpreter (see the +\fBTcl_Interp\fR manual entry for details). +.PP +The procedure \fBTcl_SetErrorCode\fR is used to set the +\fBerrorCode\fR variable. +Its \fIelement\fR arguments give one or more strings to record +in \fBerrorCode\fR: each \fIelement\fR will become one item +of a properly-formed Tcl list stored in \fBerrorCode\fR. +\fBTcl_SetErrorCode\fR is typically invoked just before returning +an error. +If an error is returned without calling \fBTcl_SetErrorCode\fR +then the Tcl interpreter automatically sets \fBerrorCode\fR +to \fBNONE\fR. +.PP +\fBTcl_PosixError\fR +.VS +sets the \fBerrorCode\fR variable after an error in a POSIX kernel call. +It reads the value of the \fBerrno\fR C variable and calls +\fBTcl_SetErrorCode\fR to set \fBerrorCode\fR in the +\fBPOSIX\fR format. +In addition, \fBTcl_PosixError\fR returns a human-readable +.VE +diagnostic message for the error (this is the same value that +will appear as the third element in \fBerrorCode\fR). +It may be convenient to include this string as part of the +error message returned to the application in \fIinterp->result\fR. +.PP +It is important to call the procedures described here rather than +setting \fBerrorInfo\fR or \fBerrorCode\fR directly with +\fBTcl_SetVar\fR. +The reason for this is that the Tcl interpreter keeps information +about whether these procedures have been called. +For example, the first time \fBTcl_AppendResult\fR is called +for an error, it clears the existing value of \fBerrorInfo\fR +and adds the error message in \fIinterp->result\fR to the variable +before appending \fImessage\fR; in subsequent calls, it just +appends the new \fImessage\fR. +When \fBTcl_SetErrorCode\fR is called, it sets a flag indicating +that \fBerrorCode\fR has been set; this allows the Tcl interpreter +to set \fBerrorCode\fR to \fBNONE\fB if it receives an error return +when \fBTcl_SetErrorCode\fR hasn't been called. +.PP +If the procedure \fBTcl_ResetResult\fR is called, it clears all +of the state associated with \fBerrorInfo\fR and \fBerrorCode\fR +(but it doesn't actually modify the variables). +If an error had occurred, this will clear the error state to +make it appear as if no error had occurred after all. + +.SH "SEE ALSO" +Tcl_ResetResult, Tcl_Interp + +.SH KEYWORDS +error, stack, trace, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/AppInit.3 b/vendor/x11iraf/obm/Tcl/doc/AppInit.3 new file mode 100644 index 00000000..e957926b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/AppInit.3 @@ -0,0 +1,68 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/AppInit.3,v 1.2 93/06/07 15:11:46 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_AppInit tclc 7.0 +.BS +.SH NAME +Tcl_AppInit \- Perform application-specific initialization +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_AppInit\fR(\fIinterp\fR) +.SH ARGUMENTS +.AS Tcl_Interp *interp +.AP Tcl_Interp *interp in +Interpreter for the application. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_AppInit\fR is a procedure that is invoked by the main programs +for Tcl applications such as \fBtclsh\fR and \fBwish\fR. +Its purpose is to allow new Tcl applications to be created without +modifying existing main programs such as those for \fBtclsh\fR +and \fBwish\fR. +To create a new application simply write a new version of +\fBTcl_AppInit\fR to replace the default version provided by Tcl, +then link your new \fBTcl_AppInit\fR with the Tcl library, which +contains the main program from \fBtclsh\fR (be sure to specify the +switch ``\fB\-u _main\fR'' to the linker to force it to use the +version of \fBmain\fR from the Tcl library). +.PP +\fBTcl_AppInit\fR is invoked after other initialization in +\fBmain\fR and before entering the main loop to process commands. +Here are some examples of things that \fBTcl_AppInit\fR might do: +.IP [1] +Call initialization procedures for various packages used by +the application. +Each initialization procedure adds new commands to \fIinterp\fR +for its package and performs other package-specific initialization. +.IP [2] +Process command-line arguments, which can be accessed from the +Tcl variables \fBargv\fR and \fBargv0\fR in \fIinterp\fR. +.IP [3] +Invoke a startup script to initialize the application. + +.SH KEYWORDS +application, argument, command, initialization, interpreter diff --git a/vendor/x11iraf/obm/Tcl/doc/Async.3 b/vendor/x11iraf/obm/Tcl/doc/Async.3 new file mode 100644 index 00000000..730284d8 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Async.3 @@ -0,0 +1,172 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Async.3,v 1.5 93/09/17 15:21:50 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_AsyncCreate tclc 7.0 +.BS +.SH NAME +Tcl_AsyncCreate, Tcl_AsyncMark, Tcl_AsyncInvoke, Tcl_AsyncDelete \- handle asynchronous events +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +extern int \fBtcl_AsyncReady\fR; +.sp +Tcl_AsyncHandler +\fBTcl_AsyncCreate\fR(\fIproc, clientData\fR) +.sp +\fBTcl_AsyncMark\fR(\fIasync\fR) +.sp +int +\fBTcl_AsyncInvoke\fR(\fIinterp, code\fR) +.sp +\fBTcl_AsyncDelete\fR(\fIasync\fR) +.SH ARGUMENTS +.AS Tcl_AsyncHandler clientData +.AP Tcl_AsyncProc *proc in +Procedure to invoke to handle an asynchronous event. +.AP ClientData clientData in +One-word value to pass to \fIproc\fR. +.AP Tcl_AsyncHandler async in +Token for asynchronous event handler. +.AP Tcl_Interp *interp in +Tcl interpreter in which command was being evaluated when handler was +invoked, or NULL if handler was invoked when there was no interpreter +active. +.AP int code in +Completion code from command that just completed in \fIinterp\fR, +or 0 if \fIinterp\fR is NULL. +.BE + +.SH DESCRIPTION +.PP +These procedures provide a safe mechanism for dealing with +asynchronous events such as signals. +If an event such as a signal occurs while a Tcl script is being +evaluated then it isn't safe to take any substantive action to +process the event. +For example, it isn't safe to evaluate a Tcl script since the +intepreter may already be in the middle of evaluating a script; +it may not even be safe to allocate memory, since a memory +allocation could have been in progress when the event occurred. +The only safe approach is to set a flag indicating that the event +occurred, then handle the event later when the world has returned +to a clean state, such as after the current Tcl command completes. +.PP +\fBTcl_AsyncCreate\fR creates an asynchronous handler and returns +a token for it. +The asynchronous handler must be created before +any occurrences of the asynchronous event that it is intended +to handle (it is not safe to create a handler at the time of +an event). +When an asynchronous event occurs the code that detects the event +(such as a signal handler) should call \fBTcl_AsyncMark\fR with the +token for the handler. +\fBTcl_AsyncMark\fR will mark the handler as ready to execute, but it +will not invoke the handler immediately. +Tcl will call the \fIproc\fR associated with the handler later, when +the world is in a safe state, and \fIproc\fR can then carry out +the actions associated with the asynchronous event. +\fIProc\fR should have arguments and result that match the +type \fBTcl_AsyncProc\fR: +.nf +.RS +typedef int Tcl_AsyncProc( +.RS +ClientData \fIclientData\fR, +Tcl_Interp *\fIinterp\fR, +int \fIcode\fR); +.RE +.RE +.fi +The \fIclientData\fR will be the same as the \fIclientData\fR +argument passed to \fBTcl_AsyncCreate\fR when the handler was +created. +If \fIproc\fR is invoked just after a command has completed +execution in an interpreter, then \fIinterp\fR will identify +the interpreter in which the command was evaluated and +\fIcode\fR will be the completion code returned by that +command. +The command's result will be present in \fIinterp->result\fR. +When \fIproc\fR returns, whatever it leaves in \fIinterp->result\fR +will be returned as the result of the command and the integer +value returned by \fIproc\fR will be used as the new completion +code for the command. +.PP +It is also possible for \fIproc\fR to be invoked when no interpreter +is active. +This can happen, for example, if an asynchronous event occurs while +the application is waiting for interactive input or an X event. +In this case \fIinterp\fR will be NULL and \fIcode\fR will be +0, and the return value from \fIproc\fR will be ignored. +.PP +The procedure \fBTcl_AsyncInvoke\fR is called to invoke all of the +handlers that are ready. +The global variable \fBtcl_AsyncReady\fR will be non-zero whenever any +asynchronous handlers are ready; it can be checked to avoid calls +to \fBTcl_AsyncInvoke\fR when there are no ready handlers. +Tcl checks \fBtcl_AsyncReady\fR after each command is evaluated +and calls \fBTcl_AsyncInvoke\fR if needed. +Applications may also call \fBTcl_AsyncInvoke\fR at interesting +times for that application. +For example, Tk's event handler checks \fBtcl_AsyncReady\fR +after each event and calls \fBTcl_AsyncInvoke\fR if needed. +The \fIinterp\fR and \fIcode\fR arguments to \fBTcl_AsyncInvoke\fR +have the same meaning as for \fIproc\fR: they identify the active +intepreter, if any, and the completion code from the command +that just completed. +.PP +\fBTcl_AsyncDelete\fR removes an asynchronous handler so that +its \fIproc\fR will never be invoked again. +A handler can be deleted even when ready, and it will still +not be invoked. +.PP +If multiple handlers become active at the same time, the +handlers are invoked in the order they were created (oldest +handler first). +The \fIcode\fR and \fIinterp->result\fR for later handlers +reflect the values returned by earlier handlers, so that +the most recently created handler has last say about +the interpreter's result and completion code. +If new handlers become ready while handlers are executing, +\fBTcl_AsyncInvoke\fR will invoke them all; at each point it +invokes the highest-priority (oldest) ready handler, repeating +this over and over until there are no longer any ready handlers. + +.SH WARNING +.PP +It is almost always a bad idea for an asynchronous event +handler to modify \fIinterp->result\fR or return a code different +from its \fIcode\fR argument. +This sort of behavior can disrupt the execution of scripts in +subtle ways and result in bugs that are extremely difficult +to track down. +If an asynchronous event handler needs to evaluate Tcl scripts +then it should first save \fIinterp->result\fR plus the values +of the variables \fBerrorInfo\fR and \fBerrorCode\fR (this can +be done, for example, by storing them in dynamic strings). +When the asynchronous handler is finished it should restore +\fIinterp->result\fR, \fBerrorInfo\fR, and \fBerrorCode\fR, +and return the \fIcode\fR argument. + +.SH KEYWORDS +asynchronous event, handler, signal diff --git a/vendor/x11iraf/obm/Tcl/doc/Backslash.3 b/vendor/x11iraf/obm/Tcl/doc/Backslash.3 new file mode 100644 index 00000000..e8b0325d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Backslash.3 @@ -0,0 +1,58 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Backslash.3,v 1.12 93/04/01 09:25:22 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_Backslash tclc +.BS +.SH NAME +Tcl_Backslash \- parse a backslash sequence +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +char +\fBTcl_Backslash\fR(\fIsrc, countPtr\fR) +.SH ARGUMENTS +.AS char *countPtr +.AP char *src in +Pointer to a string starting with a backslash. +.AP int *countPtr out +If \fIcountPtr\fR isn't NULL, \fI*countPtr\fR gets filled +in with number of characters in the backslash sequence, including +the backslash character. +.BE + +.SH DESCRIPTION +.PP +This is a utility procedure used by several of the Tcl +commands. It parses a backslash sequence and returns +the single character corresponding to the sequence. +\fBTcl_Backslash\fR modifies \fI*countPtr\fR to contain the number +of characters in the backslash sequence. +.PP +See the Tcl manual entry for information on the valid +backslash sequences. +All of the sequences described in the Tcl +manual entry are supported by \fBTcl_Backslash\fR. + +.SH KEYWORDS +backslash, parse diff --git a/vendor/x11iraf/obm/Tcl/doc/CallDel.3 b/vendor/x11iraf/obm/Tcl/doc/CallDel.3 new file mode 100644 index 00000000..1454ca36 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CallDel.3 @@ -0,0 +1,82 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CallDel.3,v 1.3 93/09/09 16:49:23 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CallWhenDeleted tclc 7.0 +.BS +.SH NAME +.na +Tcl_CallWhenDeleted, Tcl_DontCallWhenDeleted \- Arrange for callback when interpreter is deleted +.ad +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_CallWhenDeleted\fR(\fIinterp\fR, \fIproc\fR, \fIclientData\fR) +.sp +\fBTcl_DontCallWhenDeleted\fR(\fIinterp\fR, \fIproc\fR, \fIclientData\fR) +.SH ARGUMENTS +.AS Tcl_InterpDeleteProc clientData +.AP Tcl_Interp *interp in +Interpreter with which to associated callback. +.AP Tcl_InterpDeleteProc *proc in +Procedure to call when \fIinterp\fR is deleted. +.AP ClientData clientData in +Arbitrary one-word value to pass to \fIproc\fR. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_CallWhenDeleted\fR arranges for \fIproc\fR to be called by +\fBTcl_DeleteInterp\fR if/when \fIinterp\fR is deleted at some future +time. \fIProc\fR will be invoked just before the interpreter +is deleted, but the interpreter will still be valid at the +time of the call. +\fIProc\fR should have arguments and result that match the +type \fBTcl_InterpDeleteProc\fR: +.nf +.RS +typedef int Tcl_InterpDeleteProc( +.RS +ClientData \fIclientData\fR, +Tcl_Interp *\fIinterp\fR); +.RE +.RE +.fi +The \fIclientData\fP and \fIinterp\fR parameters are +copies of the \fIclientData\fP and \fIinterp\fR arguments given +to \fBTcl_CallWhenDeleted\fR. +Typically, \fIclientData\fR points to an application-specific +data structure that \fIproc\fR uses to perform cleanup when an +interpreter is about to go away. +\fIProc\fR does not return a value. +.PP +\fBTcl_DontCallWhenDeleted\fR cancels a previous call to +\fBTcl_CallWhenDeleted\fR with the same arguments, so that +\fIproc\fR won't be called after all when \fIinterp\fR is +deleted. +If there is no deletion callback that matches \fIinterp\fR, +\fIproc\fR, and \fIclientData\fR then the call to +\fBTcl_DontCallWhenDeleted\fR has no effect. + +.SH KEYWORDS +callback, delete, interpreter diff --git a/vendor/x11iraf/obm/Tcl/doc/CmdCmplt.3 b/vendor/x11iraf/obm/Tcl/doc/CmdCmplt.3 new file mode 100644 index 00000000..968d6dfa --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CmdCmplt.3 @@ -0,0 +1,49 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CmdCmplt.3,v 1.1 93/04/05 10:04:55 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CmdComplete tclc +.BS +.SH NAME +Tcl_CmdComplete \- Check for unmatched braces in a Tcl command +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_CommandComplete\fR(\fIcmd\fR) +.SH ARGUMENTS +.AS char *cmd +.AP char *cmd in +Command string to test for completeness. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_CommandComplete\fR takes a Tcl command string +as argument and determines whether it contains one or more +complete commands (i.e. there are no unclosed quotes, braces, +brackets, or variable references). +If the command string is complete then it returns 1; otherwise it returns 0. + +.SH KEYWORDS +complete command, partial command diff --git a/vendor/x11iraf/obm/Tcl/doc/Concat.3 b/vendor/x11iraf/obm/Tcl/doc/Concat.3 new file mode 100644 index 00000000..85096014 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Concat.3 @@ -0,0 +1,64 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Concat.3,v 1.6 93/04/01 09:25:23 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_Concat tclc +.BS +.SH NAME +Tcl_Concat \- concatenate a collection of strings +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +char * +\fBTcl_Concat\fR(\fIargc, argv\fR) +.SH ARGUMENTS +.AP int argc in +Number of strings. +.AP char *argv[] in +Array of strings to concatenate. Must have \fIargc\fR entries. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_Concat\fR is a utility procedure used by several of the +Tcl commands. Given a collection of strings, it concatenates +them together into a single string, with the original strings +separated by spaces. This procedure behaves differently than +\fBTcl_Merge\fR, in that the arguments are simply concatenated: +no effort is made to ensure proper list structure. +However, in most common usage the arguments will all be proper +lists themselves; if this is true, then the result will also have +proper list structure. +.PP +\fBTcl_Concat\fR eliminates leading and trailing white space as it +copies strings from \fBargv\fR to the result. If an element of +\fBargv\fR consists of nothing but white space, then that string +is ignored entirely. This white-space removal was added to make +the output of the \fBconcat\fR command cleaner-looking. +.PP +The result string is dynamically allocated +using \fBmalloc()\fR; the caller must eventually release the space +by calling \fBfree()\fR. + +.SH KEYWORDS +concatenate, strings diff --git a/vendor/x11iraf/obm/Tcl/doc/CrtCommand.3 b/vendor/x11iraf/obm/Tcl/doc/CrtCommand.3 new file mode 100644 index 00000000..9f61f49d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CrtCommand.3 @@ -0,0 +1,172 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CrtCommand.3,v 1.12 93/10/29 15:52:29 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CreateCommand tclc +.BS +.SH NAME +Tcl_CreateCommand, Tcl_DeleteCommand, Tcl_GetCommandInfo, Tcl_SetCommandInfo \- implement new commands in C +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_CreateCommand\fR(\fIinterp, cmdName, proc, clientData, deleteProc\fR) +.sp +int +\fBTcl_DeleteCommand\fR(\fIinterp, cmdName\fR) +.sp +.VS +int +\fBTcl_GetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR) +.sp +int +\fBTcl_SetCommandInfo\fR(\fIinterp, cmdName, infoPtr\fR) +.VE +.SH ARGUMENTS +.AS Tcl_CmdDeleteProc **deleteProcPtr +.AP Tcl_Interp *interp in +Interpreter in which to create new command. +.AP char *cmdName in +Name of command. +.AP Tcl_CmdProc *proc in +Implementation of new command: \fIproc\fR will be called whenever +\fIcmdName\fR is invoked as a command. +.AP ClientData clientData in +Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR. +.AP Tcl_CmdDeleteProc *deleteProc in +Procedure to call before \fIcmdName\fR is deleted from the interpreter; +allows for command-specific cleanup. If NULL, then no procedure is +called before the command is deleted. +.AP Tcl_CmdInfo *infoPtr in/out +.VS +Pointer to structure containing various information about a +Tcl command. +.VE +.BE + +.SH DESCRIPTION +.PP +\fBTcl_CreateCommand\fR defines a new command in \fIinterp\fR and associates +it with procedure \fIproc\fR such that whenever \fIcmdName\fR is +invoked as a Tcl command (via a call to \fBTcl_Eval\fR) the Tcl interpreter +will call \fIproc\fR +to process the command. If there is already a command \fIcmdName\fR +associated with the interpreter, it is deleted. \fIProc\fP should +have arguments and result that match the type \fBTcl_CmdProc\fR: +.nf +.RS +typedef int Tcl_CmdProc( +.RS +ClientData \fIclientData\fR, +Tcl_Interp *\fIinterp\fR, +int \fIargc\fR, +char *\fIargv\fR[]); +.RE +.RE +.fi +When \fIproc\fR is invoked the \fIclientData\fP and \fIinterp\fR +parameters will be copies of the \fIclientData\fP and \fIinterp\fR +arguments given to \fBTcl_CreateCommand\fR. +Typically, \fIclientData\fR points to an application-specific +data structure that describes what to do when the command procedure +is invoked. \fIArgc\fR and \fIargv\fR describe the arguments to +the command, \fIargc\fR giving the number of arguments (including +the command name) and \fIargv\fR giving the values of the arguments +as strings. The \fIargv\fR array will contain \fIargc\fR+1 values; +the first \fIargc\fR values point to the argument strings, and the +last value is NULL. +.PP +\fIProc\fR must return an integer code that is either \fBTCL_OK\fR, \fBTCL_ERROR\fR, +\fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR. See the Tcl overview man page +for details on what these codes mean. Most normal commands will only +return \fBTCL_OK\fR or \fBTCL_ERROR\fR. In addition, \fIproc\fR must set +\fIinterp->result\fR to point to a string value; +in the case of a \fBTCL_OK\fR return code this gives the result +of the command, and in the case of \fBTCL_ERROR\fR it gives an error message. +The \fBTcl_SetResult\fR procedure provides an easy interface for setting +the return value; for complete details on how the \fIinterp->result\fR +field is managed, see the \fBTcl_Interp\fR man page. +Before invoking a command procedure, +\fBTcl_Eval\fR sets \fIinterp->result\fR to point to an empty string, so simple +commands can return an empty result by doing nothing at all. +.PP +.VS +The contents of the \fIargv\fR array belong to Tcl and are not +guaranteed to persist once \fIproc\fR returns: \fIproc\fR should +not modify them, nor should it set \fIinterp->result\fR to point +anywhere within the \fIargv\fR values. +Call \fBTcl_SetResult\fR with status \fBTCL_VOLATILE\fR if you want +to return something from the \fIargv\fR array. +.VE +.PP +\fIDeleteProc\fR will be invoked when (if) \fIcmdName\fR is deleted. +This can occur through a call to \fBTcl_DeleteCommand\fR or \fBTcl_DeleteInterp\fR, +or by replacing \fIcmdName\fR in another call to \fBTcl_CreateCommand\fR. +\fIDeleteProc\fR is invoked before the command is deleted, and gives the +application an opportunity to release any structures associated +with the command. \fIDeleteProc\fR should have arguments and +result that match the type \fBTcl_CmdDeleteProc\fR: +.nf +.RS +.sp +typedef void Tcl_CmdDeleteProc(ClientData \fIclientData\fR); +.sp +.RE +.fi +The \fIclientData\fR argument will be the same as the \fIclientData\fR +argument passed to \fBTcl_CreateCommand\fR. +.PP +\fBTcl_DeleteCommand\fR deletes a command from a command interpreter. +Once the call completes, attempts to invoke \fIcmdName\fR in +\fIinterp\fR will result in errors. +If \fIcmdName\fR isn't bound as a command in \fIinterp\fR then +\fBTcl_DeleteCommand\fR does nothing and returns -1; otherwise +it returns 0. +There are no restrictions on \fIcmdName\fR: it may refer to +a built-in command, an application-specific command, or a Tcl procedure. +.PP +.VS +\fBTcl_GetCommandInfo\fR checks to see whether its \fIcmdName\fR argument +exists as a command in \fIinterp\fR. If not then it returns 0. +Otherwise it places information about the command in the structure +pointed to by \fIinfoPtr\fR and returns 1. +Tcl_CmdInfo structures have fields named \fIproc\fR, \fIclientData\fR, +and \fIdeleteProc\fR, which have the same meaning as the corresponding +arguments to \fBTcl_CreateCommand\fR. +There is also a field \fIdeleteData\fR, which is the ClientData value +to pass to \fIdeleteProc\fR; it is normally the same as +\fIclientData\fR but may be set independently using the +\fBTcl_SetCommandInfo\fR procedure. +.PP +\fBTcl_SetCommandInfo\fR is used to modify the procedures and +ClientData values associated with a command. +Its \fIcmdName\fR argument is the name of a command in \fIinterp\fR. +If this command exists then \fBTcl_SetCommandInfo\fR returns 0. +Otherwise, it copies the information from \fI*infoPtr\fR to +Tcl's internal structure for the command and returns 1. +Note that this procedure allows the ClientData for a command's +deletion procedure to be given a different value than the ClientData +for its command procedure. +.VE + +.SH KEYWORDS +bind, command, create, delete, interpreter diff --git a/vendor/x11iraf/obm/Tcl/doc/CrtInterp.3 b/vendor/x11iraf/obm/Tcl/doc/CrtInterp.3 new file mode 100644 index 00000000..c987801c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CrtInterp.3 @@ -0,0 +1,61 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CrtInterp.3,v 1.7 93/04/01 09:25:24 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CreateInterp tclc +.BS +.SH NAME +Tcl_CreateInterp, Tcl_DeleteInterp \- create and delete Tcl command interpreters +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +Tcl_Interp * +\fBTcl_CreateInterp\fR() +.sp +\fBTcl_DeleteInterp\fR(\fIinterp\fR) +.SH ARGUMENTS +.AS Tcl_Interp *interp +.AP Tcl_Interp *interp in +Token for interpreter to be destroyed. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_CreateInterp\fR creates a new interpreter structure and returns +a token for it. The token is required in calls to most other Tcl +procedures, such as \fBTcl_CreateCommand\fR, \fBTcl_Eval\fR, and +\fBTcl_DeleteInterp\fR. +Clients are only allowed to access a few of the fields of +Tcl_Interp structures; see the Tcl_Interp +and \fBTcl_CreateCommand\fR man pages for details. +The new interpreter is initialized with no defined variables and only +the built-in Tcl commands. To bind in additional commands, call +\fBTcl_CreateCommand\fR. +.PP +\fBTcl_DeleteInterp\fR destroys a command interpreter and releases all of +the resources associated with it, including variables, procedures, +and application-specific command bindings. After \fBTcl_DeleteInterp\fR +returns the caller should never again use the \fIinterp\fR token. + +.SH KEYWORDS +command, create, delete, interpreter diff --git a/vendor/x11iraf/obm/Tcl/doc/CrtMathFnc.3 b/vendor/x11iraf/obm/Tcl/doc/CrtMathFnc.3 new file mode 100644 index 00000000..1a48b6c1 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CrtMathFnc.3 @@ -0,0 +1,114 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CrtMathFnc.3,v 1.1 93/04/14 16:35:59 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CreateMathFunc tclc 7.0 +.BS +.SH NAME +Tcl_CreateMathFunc \- Define a new math function for expressions +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_CreateMathFunc\fR(\fIinterp, name, numArgs, argTypes, proc, clientData\fR) +.SH ARGUMENTS +.AS Tcl_ValueType clientData +.AP Tcl_Interp *interp in +Interpreter in which new function will be defined. +.AP char *name in +Name for new function. +.AP int numArgs in +Number of arguments to new function; also gives size of \fIargTypes\fR array. +.AP Tcl_ValueType *argTypes in +Points to an array giving the permissible types for each argument to +function. +.AP Tcl_MathProc *proc in +Procedure that implements the function. +.AP ClientData clientData in +Arbitrary one-word value to pass to \fIproc\fR when it is invoked. +.BE + +.SH DESCRIPTION +.PP +Tcl allows a number of mathematical functions to be used in +expressions, such as \fBsin\fR, \fBcos\fR, and \fBhypot\fR. +\fBTcl_CreateMathFunc\fR allows applications to add additional functions +to those already provided by Tcl or to replace existing functions. +\fIName\fR is the name of the function as it will appear in expressions. +If \fIname\fR doesn't already exist as a function then a new function +is created. If it does exist, then the existing function is replaced. +\fINumArgs\fR and \fIargTypes\fR describe the arguments to the function. +Each entry in the \fIargTypes\fR array must be either TCL_INT, TCL_DOUBLE, +or TCL_EITHER to indicate whether the corresponding argument must be an +integer, a double-precision floating value, or either, respectively. +.PP +Whenever the function is invoked in an expression Tcl will invoke +\fIproc\fR. \fIProc\fR should have arguments and result that match +the type \fBTcl_MathProc\fR: +.nf +.RS +typedef int Tcl_MathProc( +.RS +ClientData \fIclientData\fR, +Tcl_Interp *\fIinterp\fR, +Tcl_Value *\fIargs\fR, +Tcl_Value *resultPtr\fR); +.RE +.RE +.fi +.PP +When \fIproc\fR is invoked the \fIclientData\fR and \fIinterp\fR +arguments will be the same as those passed to \fBTcl_CreateMathFunc\fR. +\fIArgs\fR will point to an array of \fInumArgs\fR Tcl_Value structures, +which describe the actual arguments to the function: +.nf +.RS +typedef struct Tcl_Value { +.RS +Tcl_ValueType \fItype\fR; +int \fIintValue\fR; +double \fIdoubleValue\fR; +.RE +} Tcl_Value; +.RE +.fi +.PP +The \fItype\fR field indicates the type of the argument and is +either TCL_INT or TCL_DOUBLE. +It will match the \fIargTypes\fR value specified for the function unless +the \fIargTypes\fR value was TCL_EITHER. Tcl converts +the argument supplied in the expression to the type requested in +\fIargTypes\fR, if that is necessary. +Depending on the value of the \fItype\fR field, the \fIintValue\fR +or \fIdoubleValue\fR field will contain the actual value of the argument. +.PP +\fIProc\fR should compute its result and store it either as an integer +in \fIresultPtr->intValue\fR or as a floating value in +\fIresultPtr->doubleValue\fR. +It should set also \fIresultPtr->type\fR to either TCL_INT or TCL_DOUBLE +to indicate which value was set. +Under normal circumstances \fIproc\fR should return TCL_OK. +If an error occurs while executing the function, \fIproc\fR should +return TCL_ERROR and leave an error message in \fIinterp->result\fR. + +.SH KEYWORDS +expression, mathematical function diff --git a/vendor/x11iraf/obm/Tcl/doc/CrtPipelin.3 b/vendor/x11iraf/obm/Tcl/doc/CrtPipelin.3 new file mode 100644 index 00000000..f5064b6c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CrtPipelin.3 @@ -0,0 +1,114 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CrtPipelin.3,v 1.7 93/04/09 11:53:47 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CreatePipeline tclc +.BS +.SH NAME +Tcl_CreatePipeline \- create one or more child processes, with I/O redirection +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_CreatePipeline\fR(\fIinterp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr\fR) +.SH ARGUMENTS +.AS Tcl_Interp **pidArrayPtr +.AP Tcl_Interp *interp in +Interpreter to use for error reporting. +.AP int argc in +Number of strings in \fIargv\fR array. +.AP char **argv in +Array of strings describing command(s) and I/O redirection. +.AP int **pidArrayPtr out +The value at \fI*pidArrayPtr\fR is modified to hold a pointer to +an array of process identifiers. The array is dynamically +allocated and must be freed by the caller. +.AP int *inPipePtr out +If this argument is NULL then standard input for the first command +in the pipeline comes from the current standard input. +If \fIinPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will +create a pipe, arrange for it to be used for standard input +to the first command, +and store a file id for writing to that pipe at \fI*inPipePtr\fR. +If the command specified its own input using redirection, then +no pipe is created and -1 is stored at \fI*inPipePtr\fR. +.AP int *outPipePtr out +If this argument is NULL then standard output for the last command +in the pipeline goes to the current standard output. +If \fIoutPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will +create a pipe, arrange for it to be used for standard output from +the last command, and store a file id for reading from that +pipe at \fI*outPipePtr\fR. +If the command specified its own output using redirection then +no pipe is created and -1 is stored at \fI*outPipePtr\fR. +.AP int *errFilePtr out +If this argument is NULL then error output for all the commands +in the pipeline will go to the current standard error file. +If \fIerrFilePtr\fR is not NULL, error output from all the commands +in the pipeline will go to a temporary file created by +\fBTcl_CreatePipeline\fR. +A file id to read from that file will be stored at \fI*errFilePtr\fR. +The file will already have been removed, so closing the file +descriptor at \fI*errFilePtr\fR will cause the file to be flushed +completely. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_CreatePipeline\fR processes the \fIargv\fR array and sets +up one or more child processes in a pipeline configuration. +\fBTcl_CreatePipeline\fR handles pipes specified with ``|'', +input redirection specified with ``<'' or ``<<'', and output +redirection specified with ``>''; see the documentation for +the \fBexec\fR command for details on these specifications. +The return value from \fBTcl_CreatePipeline\fR is a count of +the number of child processes created; the process identifiers +for those processes are stored in a \fImalloc\fR-ed array and +a pointer to that array is stored at \fI*pidArrayPtr\fR. +It is the caller's responsibility to free the array when finished +with it. +.PP +If the \fIinPipePtr\fR, \fIoutPipePtr\fR, and \fIerrFilePtr\fR +arguments are NULL then the pipeline's standard input, standard +output, and standard error are taken from the corresponding +streams of the process. Non-NULL values may be specified for +these arguments to use pipes for standard input and standard +output and a file for standard error. \fBTcl_CreatePipeline\fR +will create the requested pipes or file and return file identifiers +that may be used to read or write them. It is the caller's +responsibility to close all of these files when they are no +longer needed. If \fIargv\fR specifies redirection for standard +input or standard output, then pipes will not be created even +if requested by the \fIinPipePtr\fR and \fIoutPipePtr\fR +arguments. +.PP +If an error occurs in \fBTcl_CreatePipeline\fR (e.g. ``|'' or +``<'' was the last argument in \fIargv\fR, or it wasn't possible +to fork off a child), then -1 is returned +and \fIinterp->result\fR is set to an error message. + +.SH "SEE ALSO" +\fBTcl_DetachPids\fR, \fBTcl_ReapDetachedProcs\fR + +.SH KEYWORDS +background, child, detach, fork, process, status, wait diff --git a/vendor/x11iraf/obm/Tcl/doc/CrtTrace.3 b/vendor/x11iraf/obm/Tcl/doc/CrtTrace.3 new file mode 100644 index 00000000..796346d9 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/CrtTrace.3 @@ -0,0 +1,125 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/CrtTrace.3,v 1.8 93/04/01 09:25:26 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_CreateTrace tclc +.BS +.SH NAME +Tcl_CreateTrace, Tcl_DeleteTrace \- arrange for command execution to be traced +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +Tcl_Trace +\fBTcl_CreateTrace\fR(\fIinterp, level, proc, clientData\fR) +.sp +\fBTcl_DeleteTrace\fR(\fIinterp, trace\fR) +.SH ARGUMENTS +.AS Tcl_CmdTraceProc (clientData)() +.AP Tcl_Interp *interp in +Interpreter containing command to be traced or untraced. +.AP int level in +Only commands at or below this nesting level will be traced. 1 means +top-level commands only, 2 means top-level commands or those that are +invoked as immediate consequences of executing top-level commands +(procedure bodies, bracketed commands, etc.) and so on. +.AP Tcl_CmdTraceProc *proc in +Procedure to call for each command that's executed. See below for +details on the calling sequence. +.AP ClientData clientData in +Arbitrary one-word value to pass to \fIproc\fR. +.AP Tcl_Trace trace in +Token for trace to be removed (return value from previous call +to \fBTcl_CreateTrace\fR). +.BE + +.SH DESCRIPTION +.PP +\fBTcl_CreateTrace\fR arranges for command tracing. From now on, \fIproc\fR +will be invoked before Tcl calls command procedures to process +commands in \fIinterp\fR. The return value from +\fBTcl_CreateTrace\fR is a token for the trace, +which may be passed to \fBTcl_DeleteTrace\fR to remove the trace. There may +be many traces in effect simultaneously for the same command interpreter. +.PP +\fIProc\fR should have arguments and result that match the +type \fBTcl_CmdTraceProc\fR: +.nf +.sp +.RS +typedef void Tcl_CmdTraceProc( +.RS +ClientData \fIclientData\fR, +Tcl_Interp *\fIinterp\fR, +int \fIlevel\fR, +char *\fIcommand\fR, +Tcl_CmdProc *\fIcmdProc\fR, +ClientData \fIcmdClientData\fR, +int \fIargc\fR, +char *\fIargv\fR[])); +.sp +.RE +.RE +.fi +The \fIclientData\fP and \fIinterp\fP parameters are +copies of the corresponding arguments given to \fBTcl_CreateTrace\fR. +\fIClientData\fR typically points to an application-specific +data structure that describes what to do when \fIproc\fR +is invoked. \fILevel\fR gives the nesting level of the command +(1 for top-level commands passed to \fBTcl_Eval\fR by the application, +2 for the next-level commands passed to \fBTcl_Eval\fR as part of parsing +or interpreting level-1 commands, and so on). \fICommand\fR +points to a string containing the text of the +command, before any argument substitution. +\fICmdProc\fR contains the address of the command procedure that +will be called to process the command (i.e. the \fIproc\fR argument +of some previous call to \fBTcl_CreateCommand\fR) and \fIcmdClientData\fR +contains the associated client data for \fIcmdProc\fR (the \fIclientData\fR +value passed to \fBTcl_CreateCommand\fR). \fIArgc\fR and \fIargv\fR give +the final argument information that will be passed to \fIcmdProc\fR, after +command, variable, and backslash substitution. +\fIProc\fR must not modify the \fIcommand\fR or \fIargv\fR strings. +.PP +Tracing will only occur for commands at nesting level less than +or equal to the \fIlevel\fR parameter (i.e. the \fIlevel\fR +parameter to \fIproc\fR will always be less than or equal to the +\fIlevel\fR parameter to \fBTcl_CreateTrace\fR). +.PP +Calls to \fIproc\fR will be made by the Tcl parser immediately before +it calls the command procedure for the command (\fIcmdProc\fR). This +occurs after argument parsing and substitution, so tracing for +substituted commands occurs before tracing of the commands +containing the substitutions. If there is a syntax error in a +command, or if there is no command procedure associated with a +command name, then no tracing will occur for that command. If a +string passed to Tcl_Eval contains multiple commands (bracketed, or +on different lines) then multiple calls to \fIproc\fR will occur, +one for each command. The \fIcommand\fR string for each of these +trace calls will reflect only a single command, not the entire string +passed to Tcl_Eval. +.PP +\fBTcl_DeleteTrace\fR removes a trace, so that no future calls will be +made to the procedure associated with the trace. After \fBTcl_DeleteTrace\fR +returns, the caller should never again use the \fItrace\fR token. + +.SH KEYWORDS +command, create, delete, interpreter, trace diff --git a/vendor/x11iraf/obm/Tcl/doc/DString.3 b/vendor/x11iraf/obm/Tcl/doc/DString.3 new file mode 100644 index 00000000..9d72b423 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/DString.3 @@ -0,0 +1,141 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/DString.3,v 1.10 93/08/16 13:24:52 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_DStringInit tclc 7.0 +.BS +.SH NAME +.na +Tcl_DStringInit, Tcl_DStringAppend, Tcl_DStringAppendElement, Tcl_DStringStartSublist, Tcl_DStringEndSublist, Tcl_DStringLength, Tcl_DStringValue, Tcl_DStringTrunc, Tcl_DStringFree, Tcl_DStringResult \- manipulate dynamic strings +.ad +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_DStringInit\fR(\fIdsPtr\fR) +.sp +char * +\fBTcl_DStringAppend\fR(\fIdsPtr, string, length\fR) +.sp +char * +\fBTcl_DStringAppendElement\fR(\fIdsPtr, string\fR) +.sp +\fBTcl_DStringStartSublist\fR(\fIdsPtr\fR) +.sp +\fBTcl_DStringEndSublist\fR(\fIdsPtr\fR) +.sp +int +\fBTcl_DStringLength\fR(\fIdsPtr\fR) +.sp +char * +\fBTcl_DStringValue\fR(\fIdsPtr\fR) +.sp +\fBTcl_DStringTrunc\fR(\fIdsPtr, newLength\fR) +.sp +\fBTcl_DStringFree\fR(\fIdsPtr\fR) +.sp +\fBTcl_DStringResult\fR(\fIinterp, dsPtr\fR) +.SH ARGUMENTS +.AS Tcl_DString newLength +.AP Tcl_DString *dsPtr in/out +Pointer to structure that is used to manage a dynamic string. +.AP char *string in +Pointer to characters to add to dynamic string. +.AP int length in +Number of characters from string to add to dynamic string. If -1, +add all characters up to null terminating character. +.AP int newLength in +New length for dynamic string, not including null terminating +character. +.BE + +.SH DESCRIPTION +.PP +Dynamic strings provide a mechanism for building up arbitrarily long +strings by gradually appending information. If the dynamic string is +short then there will be no memory allocation overhead; as the string +gets larger, additional space will be allocated as needed. +.PP +\fBTcl_DStringInit\fR initializes a dynamic string to zero length. +The Tcl_DString structure must have been allocated by the caller. +No assumptions are made about the current state of the structure; +anything already in it is discarded. +If the structure has been used previously, \fBTcl_DStringFree\fR should +be called first to free up any memory allocated for the old +string. +.PP +\fBTcl_DStringAppend\fR adds new information to a dynamic string, +allocating more memory for the string if needed. +If \fIlength\fR is less than zero then everything in \fIstring\fR +is appended to the dynamic string; otherwise \fIlength\fR +specifies the number of bytes to append. +\fBTcl_DStringAppend\fR returns a pointer to the characters of +the new string. The string can also be retrieved from the +\fIstring\fR field of the Tcl_DString structure. +.PP +\fBTcl_DStringAppendElement\fR is similar to \fBTcl_DStringAppend\fR +except that it doesn't take a \fIlength\fR argument (it appends +all of \fIstring\fR) and it converts the string to a proper list element +before appending. +\fBTcl_DStringAppendElement\fR adds a separator space before the +new list element unless the new list element is the first in a +list or sub-list (i.e. either the current string is empty, or it +contains the single character ``{'', or the last two characters of +the current string are `` {''). +\fBTcl_DStringAppendElement\fR returns a pointer to the +characters of the new string. +.PP +\fBTcl_DStringStartSublist\fR and \fBTcl_DStringEndSublist\fR can be +used to create nested lists. +To append a list element that is itself a sublist, first +call \fBTcl_DStringStartSublist\fR, then call \fBTcl_DStringAppendElement\fR +for each of the elements in the sublist, then call +\fBTcl_DStringEndSublist\fR to end the sublist. +\fBTcl_DStringStartSublist\fR appends a space character if needed, +followed by an open brace; \fBTcl_DStringAppendElement\fR appends +a close brace. +Lists can be nested to any depth. +.PP +\fBTcl_DStringLength\fR is a macro that returns the current length +of a dynamic string (not including the terminating null character). +\fBTcl_DStringValue\fR is a macro that returns a pointer to the +current contents of a dynamic string. +.PP +\fBTcl_DStringTrunc\fR truncates a dynamic string to a given length. +It has no effect if the string was already smaller than \fInewLength\fR. +This procedure does not free up the string's storage space, even +if the string is truncated to zero length, so \fBTcl_DStringFree\fR +will still need to be called. +.PP +\fBTcl_DStringFree\fR should be called when you're finished using +the string. It frees up any memory that was allocated for the string +and reinitializes the string's value to an empty string. +.PP +\fBTcl_DStringResult\fR sets the result of \fIinterp\fR to the value of +the dynamic string given by \fIdsPtr\fR. It does this by moving +a pointer from \fIdsPtr\fR to \fIinterp->result\fR. +This saves the cost of allocating new memory and copying the string. +\fBTcl_DStringResult\fR also reinitializes the dynamic string to +an empty string. + +.SH KEYWORDS +append, dynamic string, free, result diff --git a/vendor/x11iraf/obm/Tcl/doc/DetachPids.3 b/vendor/x11iraf/obm/Tcl/doc/DetachPids.3 new file mode 100644 index 00000000..4862d92d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/DetachPids.3 @@ -0,0 +1,79 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/DetachPids.3,v 1.10 93/09/09 10:53:24 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_DetachPids tclc +.BS +.SH NAME +Tcl_DetachPids, Tcl_ReapDetachedProcs \- manage child processes in background +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR) +.sp +.VS +\fBTcl_ReapDetachedProcs\fR() +.VE +.SH ARGUMENTS +.AS int *statusPtr +.AP int numPids in +Number of process ids contained in the array pointed to by \fIpidPtr\fR. +.AP int *pidPtr in +Address of array containing \fInumPids\fR process ids. +.BE + +.SH DESCRIPTION +.PP +.VS +\fBTcl_DetachPids\fR and \fBTcl_ReapDetachedProcs\fR provide a +mechanism for managing subprocesses that are running in background. +These procedures are needed because the parent of a process must +eventually invoke the \fBwaitpid\fR kernel call (or one of a few other +similar kernel calls) to wait for the child to exit. Until the +parent waits for the child, the child's state cannot be completely +reclaimed by the system. If a parent continually creates children +and doesn't wait on them, the system's process table will eventually +overflow, even if all the children have exited. +.PP +\fBTcl_DetachPids\fR may be called to ask Tcl to take responsibility +for one or more processes whose process ids are contained in the +\fIpidPtr\fR array passed as argument. The caller presumably +has started these processes running in background and doesn't +want to have to deal with them again. +.PP +\fBTcl_ReapDetachedProcs\fR invokes the \fBwaitpid\fR kernel call +on each of the background processes so that its state can be cleaned +up if it has exited. If the process hasn't exited yet, +\fBTcl_ReapDetachedProcs\fR doesn't wait for it to exit; it will check again +the next time it is invoked. +Tcl automatically calls \fBTcl_ReapDetachedProcs\fR each time the +\fBexec\fR command is executed, so in most cases it isn't necessary +for any code outside of Tcl to invoke \fBTcl_ReapDetachedProcs\fR. +However, if you call \fBTcl_DetachPids\fR in situations where the +\fBexec\fR command may never get executed, you may wish to call +\fBTcl_ReapDetachedProcs\fR from time to time so that background +processes can be cleaned up. +.VE + +.SH KEYWORDS +background, child, detach, process, wait diff --git a/vendor/x11iraf/obm/Tcl/doc/EnterFile.3 b/vendor/x11iraf/obm/Tcl/doc/EnterFile.3 new file mode 100644 index 00000000..12f15299 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/EnterFile.3 @@ -0,0 +1,98 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/EnterFile.3,v 1.4 93/08/27 13:20:42 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_EnterFile tclc 7.0 +.BS +.SH NAME +Tcl_EnterFile, Tcl_GetOpenFile, Tcl_FilePermissions \- manipulate the table of open files +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_EnterFile\fR(\fIinterp, file, permissions\fR) +.sp +int +\fBTcl_GetOpenFile\fR(\fIinterp, string, write, checkUsage, filePtr\fR) +.sp +int +\fBTcl_FilePermissions(\fIfile\fR) +.SH ARGUMENTS +.AS Tcl_Interp checkUsage +.AP Tcl_Interp *interp in +Tcl interpreter from which file is to be accessed. +.AP FILE *file in +Handle for file that is to become accessible in \fIinterp\fR. +.AP int permissions in +OR-ed combination of TCL_FILE_READABLE and TCL_FILE_WRITABLE; +indicates whether \fIfile\fR was opened for reading or writing or both. +.AP char *string in +String identifying file, such as \fBstdin\fR or \fBfile4\fR. +.AP int write in +Non-zero means the file will be used for writing, zero means it will +be used for reading. +.AP int checkUsage in +If non-zero, then an error will be generated if the file wasn't opened +for the access indicated by \fIwrite\fR. +.AP FILE **filePtr out +Points to word in which to store pointer to FILE structure for +the file given by \fIstring\fR. +.BE + +.SH DESCRIPTION +.PP +These procedures provide access to Tcl's file naming mechanism. +\fBTcl_EnterFile\fR enters an open file into Tcl's file table so +that it can be accessed using Tcl commands like \fBgets\fR, +\fBputs\fR, \fBseek\fR, and \fBclose\fR. +It returns in \fIinterp->result\fR an identifier such as \fBfile4\fR +that can be used to refer to the file in subsequent Tcl commands. +\fBTcl_EnterFile\fR is typically used to implement new Tcl commands +that open sockets, pipes, or other kinds of files not already supported +by the built-in commands. +.PP +\fBTcl_GetOpenFile\fR takes as argument a file identifier of the form +returned by the \fBopen\fR command or \fBTcl_EnterFile\fR and +returns at \fI*filePtr\fR a pointer to the FILE structure for +the file. +The \fIwrite\fR argument indicates whether the FILE pointer will +be used for reading or writing. +In some cases, such as a file that connects to a pipeline of +subprocesses, different FILE pointers will be returned for reading +and writing. +\fBTcl_GetOpenFile\fR normally returns TCL_OK. +If an error occurs in \fBTcl_GetOpenFile\fR (e.g. \fIstring\fR didn't +make any sense or \fIcheckUsage\fR was set and the file wasn't opened +for the access specified by \fIwrite\fR) then TCL_ERROR is returned +and \fIinterp->result\fR will contain an error message. +If \fIcheckUsage\fR is zero and the file wasn't opened for the +access specified by \fIwrite\fR, then the FILE pointer returned +at \fI*filePtr\fR may not correspond to \fIwrite\fR. +.PP +\fBTcl_FilePermissions\fR returns an OR-ed combination of the +mask bits TCL_FILE_READABLE and TCL_FILE_WRITABLE; these indicate +whether the given file was opened for reading or writing or both. +If \fIfile\fR does not refer to a file in Tcl's file table then +\-1 is returned. + +.SH KEYWORDS +file table, permissions, pipeline, read, write diff --git a/vendor/x11iraf/obm/Tcl/doc/Eval.3 b/vendor/x11iraf/obm/Tcl/doc/Eval.3 new file mode 100644 index 00000000..db2cbf40 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Eval.3 @@ -0,0 +1,119 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Eval.3,v 1.13 93/04/03 16:40:04 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_Eval tclc 7.0 +.BS +.SH NAME +Tcl_Eval, Tcl_VarEval, Tcl_EvalFile, Tcl_GlobalEval \- execute Tcl commands +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +.VS +\fBTcl_Eval\fR(\fIinterp, cmd\fR) +.VE +.sp +int +\fBTcl_VarEval\fR(\fIinterp, string, string, ... \fB(char *) NULL\fR) +.sp +int +\fBTcl_EvalFile\fR(\fIinterp, fileName\fR) +.sp +int +\fBTcl_GlobalEval\fR(\fIinterp, cmd\fR) +.SH ARGUMENTS +.AS Tcl_Interp **termPtr; +.AP Tcl_Interp *interp in +Interpreter in which to execute the command. String result will be +stored in \fIinterp->result\fR. +.AP char *cmd in +Command (or sequence of commands) to execute. Must be in writable +memory (\fBTcl_Eval\fR makes temporary modifications to the command). +.AP char *string in +String forming part of Tcl command. +.AP char *fileName in +Name of file containing Tcl command string. +.BE + +.SH DESCRIPTION +.PP +All four of these procedures execute Tcl commands. +\fBTcl_Eval\fR is the core procedure: it parses commands +from \fIcmd\fR and executes them in +.VS +order until either an error occurs or it reaches the end of the string. +.VE +The return value from \fBTcl_Eval\fR is one +of the Tcl return codes \fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or +\fBTCL_CONTINUE\fR, and \fIinterp->result\fR will point to +a string with additional information (result value or error message). +This return information corresponds to the last command executed from +\fIcmd\fR. +.PP +\fBTcl_VarEval\fR takes any number of string arguments +of any length, concatenates +them into a single string, then calls \fBTcl_Eval\fR to +execute that string as a Tcl command. +It returns the result of the command and also modifies +\fIinterp->result\fR in the usual fashion for Tcl commands. The +last argument to \fBTcl_VarEval\fR must be NULL to indicate the end +of arguments. +.PP +\fBTcl_EvalFile\fR reads the file given by \fIfileName\fR and evaluates +its contents as a Tcl command by calling \fBTcl_Eval\fR. It returns +a standard Tcl result that reflects the result of evaluating the +file. +If the file couldn't be read then a Tcl error is returned to describe +why the file couldn't be read. +.PP +\fBTcl_GlobalEval\fR is similar to \fBTcl_Eval\fR except that it +processes the command at global level. +This means that the variable context for the command consists of +global variables only (it ignores any Tcl procedure that is active). +This produces an effect similar to the Tcl command ``\fBuplevel 0\fR''. +.PP +During the processing of a Tcl command it is legal to make nested +calls to evaluate other commands (this is how conditionals, loops, +and procedures are implemented). +If a code other than +\fBTCL_OK\fR is returned from a nested \fBTcl_Eval\fR invocation, then the +caller should normally return immediately, passing that same +return code back to its caller, and so on until the top-level application is +reached. A few commands, like \fBfor\fR, will check for certain +return codes, like \fBTCL_BREAK\fR and \fBTCL_CONTINUE\fR, and process them +specially without returning. +.PP +\fBTcl_Eval\fR keeps track of how many nested Tcl_Eval invocations are +in progress for \fIinterp\fR. +If a code of \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR is +about to be returned from the topmost \fBTcl_Eval\fR invocation for +\fIinterp\fR, then \fBTcl_Eval\fR converts the return code to \fBTCL_ERROR\fR +and sets \fIinterp->result\fR to point to an error message indicating that +the \fBreturn\fR, \fBbreak\fR, or \fBcontinue\fR command was +invoked in an inappropriate place. This means that top-level +applications should never see a return code from \fBTcl_Eval\fR other then +\fBTCL_OK\fR or \fBTCL_ERROR\fR. + +.SH KEYWORDS +command, execute, file, global, interpreter, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/ExprLong.3 b/vendor/x11iraf/obm/Tcl/doc/ExprLong.3 new file mode 100644 index 00000000..a043347b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/ExprLong.3 @@ -0,0 +1,119 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/ExprLong.3,v 1.11 93/04/17 15:31:16 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_ExprLong tclc 7.0 +.BS +.SH NAME +Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBool, Tcl_ExprString \- evaluate an expression +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_ExprLong\fR(\fIinterp, string, longPtr\fR) +.sp +int +\fBTcl_ExprDouble\fR(\fIinterp, string, doublePtr\fR) +.sp +int +\fBTcl_ExprBoolean\fR(\fIinterp, string, booleanPtr\fR) +.sp +int +\fBTcl_ExprString\fR(\fIinterp, string\fR) +.SH ARGUMENTS +.AS Tcl_Interp *booleanPtr +.AP Tcl_Interp *interp in +Interpreter in whose context to evaluate \fIstring\fR. +.AP char *string in +Expression to be evaluated. Must be in writable memory (the expression +parser makes temporary modifications to the string during parsing, which +it undoes before returning). +.AP long *longPtr out +Pointer to location in which to store the integer value of the +expression. +.AP int *doublePtr out +Pointer to location in which to store the floating-point value of the +expression. +.AP int *booleanPtr out +Pointer to location in which to store the 0/1 boolean value of the +expression. +.BE + +.SH DESCRIPTION +.PP +These four procedures all evaluate an expression, returning +the result in one of four different forms. +The expression is given by the \fIstring\fR argument, and it +can have any of the forms accepted by the \fBexpr\fR command. +The \fIinterp\fR argument refers to an interpreter used to +evaluate the expression (e.g. for variables and nested Tcl +commands) and to return error information. \fIInterp->result\fR +is assumed to be initialized in the standard fashion when any +of the procedures are invoked. +.PP +For all of these procedures the return value is a standard +Tcl result: \fBTCL_OK\fR means the expression was succesfully +evaluated, and \fBTCL_ERROR\fR means that an error occurred while +evaluating the expression. If \fBTCL_ERROR\fR is returned then +\fIinterp->result\fR will hold a message describing the error. +If an error occurs while executing a Tcl command embedded in +the expression then that error will be returned. +.PP +If the expression is successfully evaluated, then its value is +returned in one of four forms, depending on which procedure +is invoked. +\fBTcl_ExprLong\fR stores an integer value at \fI*longPtr\fR. +If the expression's actual value is a floating-point number, +then it is truncated to an integer. +If the expression's actual value is a non-numeric string then +an error is returned. +.PP +\fBTcl_ExprDouble\fR stores a floating-point value at \fI*doublePtr\fR. +If the expression's actual value is an integer, it is converted to +floating-point. +If the expression's actual value is a non-numeric string then +an error is returned. +.PP +\fBTcl_ExprBoolean\fR stores a 0/1 integer value at \fI*booleanPtr\fR. +If the expression's actual value is an integer or floating-point +number, then \fBTcl_ExprBoolean\fR stores 0 at \fI*booleanPtr\fR if +the value was zero and 1 otherwise. +.VS +If the expression's actual value is a non-numeric string then +it must be one of the values accepted by \fBTcl_GetBoolean\fR, +such as ``yes'' or ``no'', or else an error occurs. +.VE +.PP +\fBTcl_ExprString\fR returns the value of the expression as a +string stored in \fIinterp->result\fR. +.VS +If the expression's actual value is an integer +then \fBTcl_ExprString\fR converts it to a string using \fBsprintf\fR +with a ``%d'' converter. +If the expression's actual value is a floating-point +number, then \fBTcl_ExprString\fR calls \fBTcl_PrintDouble\fR +to convert it to a string. +.VE + +.SH KEYWORDS +boolean, double, evaluate, expression, integer, string diff --git a/vendor/x11iraf/obm/Tcl/doc/GetInt.3 b/vendor/x11iraf/obm/Tcl/doc/GetInt.3 new file mode 100644 index 00000000..b3cf91d5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/GetInt.3 @@ -0,0 +1,94 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/GetInt.3,v 1.8 93/04/01 09:25:29 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_GetInt tclc +.BS +.SH NAME +Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_GetInt\fR(\fIinterp, string, intPtr\fR) +.sp +int +\fBTcl_GetDouble\fR(\fIinterp, string, doublePtr\fR) +.sp +int +\fBTcl_GetBoolean\fR(\fIinterp, string, boolPtr\fR) +.SH ARGUMENTS +.AS Tcl_Interp *doublePtr +.AP Tcl_Interp *interp in +Interpreter to use for error reporting. +.AP char *string in +Textual value to be converted. +.AP int *intPtr out +Points to place to store integer value converted from \fIstring\fR. +.AP double *doublePtr out +Points to place to store double-precision floating-point +value converted from \fIstring\fR. +.AP int *boolPtr out +Points to place to store boolean value (0 or 1) converted from \fIstring\fR. +.BE + +.SH DESCRIPTION +.PP +These procedures convert from strings to integers or double-precision +floating-point values or booleans (represented as 0- or 1-valued +integers). Each of the procedures takes a \fIstring\fR argument, +converts it to an internal form of a particular type, and stores +the converted value at the location indicated by the procedure's +third argument. If all goes well, each of the procedures returns +TCL_OK. If \fIstring\fR doesn't have the proper syntax for the +desired type then TCL_ERROR is returned, an error message is left +in \fIinterp->result\fR, and nothing is stored at *\fIintPtr\fR +or *\fIdoublePtr\fR or *\fIboolPtr\fR. +.PP +\fBTcl_GetInt\fR expects \fIstring\fR to consist of a collection +of integer digits, optionally signed and optionally preceded by +white space. If the first two characters of \fIstring\fR are ``0x'' +then \fIstring\fR is expected to be in hexadecimal form; otherwise, +if the first character of \fIstring\fR is ``0'' then \fIstring\fR +is expected to be in octal form; otherwise, \fIstring\fR is +expected to be in decimal form. +.PP +\fBTcl_GetDouble\fR expects \fIstring\fR to consist of a floating-point +number, which is: white space; a sign; a sequence of digits; a +decimal point; a sequence of digits; the letter ``e''; and a +signed decimal exponent. Any of the fields may be omitted, except that +the digits either before or after the decimal point must be present +and if the ``e'' is present then it must be followed by the +exponent number. +.PP +\fBTcl_GetBoolean\fR expects \fIstring\fR to specify a boolean +value. If \fIstring\fR is any of \fB0\fR, \fBfalse\fR, +\fBno\fR, or \fBoff\fR, then \fBTcl_GetBoolean\fR stores a zero +value at \fI*boolPtr\fR. +If \fIstring\fR is any of \fB1\fR, \fBtrue\fR, \fByes\fR, or \fBon\fR, +then 1 is stored at \fI*boolPtr\fR. +Any of these values may be abbreviated, and upper-case spellings +are also acceptable. + +.SH KEYWORDS +boolean, conversion, double, floating-point, integer diff --git a/vendor/x11iraf/obm/Tcl/doc/Hash.3 b/vendor/x11iraf/obm/Tcl/doc/Hash.3 new file mode 100644 index 00000000..fec89035 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Hash.3 @@ -0,0 +1,222 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Hash.3,v 1.9 93/07/23 08:30:53 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_Hash tclc +.BS +.SH NAME +.na +Tcl_InitHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, Tcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, Tcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, Tcl_HashStats \- procedures to manage hash tables +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_InitHashTable\fR(\fItablePtr, keyType\fR) +.sp +\fBTcl_DeleteHashTable\fR(\fItablePtr\fR) +.sp +Tcl_HashEntry * +\fBTcl_CreateHashEntry\fR(\fItablePtr, key, newPtr\fR) +.sp +\fBTcl_DeleteHashEntry\fR(\fIentryPtr\fR) +.sp +Tcl_HashEntry * +\fBTcl_FindHashEntry\fR(\fItablePtr, key\fR) +.sp +ClientData +\fBTcl_GetHashValue\fR(\fIentryPtr\fR) +.sp +\fBTcl_SetHashValue\fR(\fIentryPtr, value\fR) +.sp +char * +\fBTcl_GetHashKey\fR(\fItablePtr, entryPtr\fR) +.sp +Tcl_HashEntry * +\fBTcl_FirstHashEntry\fR(\fItablePtr, searchPtr\fR) +.sp +Tcl_HashEntry * +\fBTcl_NextHashEntry\fR(\fIsearchPtr\fR) +.sp +char * +\fBTcl_HashStats\fR(\fItablePtr\fR) +.SH ARGUMENTS +.AS Tcl_HashSearch *searchPtr +.AP Tcl_HashTable *tablePtr in +Address of hash table structure (for all procedures but +\fBTcl_InitHashTable\fR, this must have been initialized by +previous call to \fBTcl_InitHashTable\fR). +.AP int keyType in +Kind of keys to use for new hash table. Must be either +TCL_STRING_KEYS, TCL_ONE_WORD_KEYS, or an integer value +greater than 1. +.AP char *key in +Key to use for probe into table. Exact form depends on +\fIkeyType\fR used to create table. +.AP int *newPtr out +The word at \fI*newPtr\fR is set to 1 if a new entry was created +and 0 if there was already an entry for \fIkey\fR. +.AP Tcl_HashEntry *entryPtr in +Pointer to hash table entry. +.AP ClientData value in +New value to assign to hash table entry. Need not have type +ClientData, but must fit in same space as ClientData. +.AP Tcl_HashSearch *searchPtr in +Pointer to record to use to keep track of progress in enumerating +all the entries in a hash table. +.BE + +.SH DESCRIPTION +.PP +A hash table consists of zero or more entries, each consisting of +a key and a value. +Given the key for an entry, the hashing routines can very quickly +locate the entry, and hence its value. +There may be at most one entry in a hash table with a +particular key, but many entries may have the same value. +Keys can take one of three forms: strings, +one-word values, or integer arrays. +All of the keys in a given table have the same form, which is +specified when the table is initialized. +.PP +The value of a hash table entry can be anything that fits in +the same space as a ``char *'' pointer. +Values for hash table entries are managed entirely by clients, +not by the hash module itself. +Typically each entry's value is a pointer to a data structure +managed by client code. +.PP +Hash tables grow gracefully as the number of entries increases, +so that there are always less than three entries per hash bucket, +on average. +This allows for fast lookups regardless of the number of entries +in a table. +.PP +\fBTcl_InitHashTable\fR initializes a structure that describes +a new hash table. +The space for the structure is provided by the caller, not by +the hash module. +The value of \fIkeyType\fR indicates what kinds of keys will +be used for all entries in the table. \fIKeyType\fR must have +one of the following values: +.IP \fBTCL_STRING_KEYS\fR 25 +Keys are null-terminated ASCII strings. +They are passed to hashing routines using the address of the +first character of the string. +.IP \fBTCL_ONE_WORD_KEYS\fR 25 +Keys are single-word values; they are passed to hashing routines +and stored in hash table entries as ``char *'' values. +The pointer value is the key; it need not (and usually doesn't) +actually point to a string. +.IP \fIother\fR 25 +If \fIkeyType\fR is not TCL_STRING_KEYS or TCL_ONE_WORD_KEYS, +then it must be an integer value greater than 1. +In this case the keys will be arrays of ``int'' values, where +\fIkeyType\fR gives the number of ints in each key. +This allows structures to be used as keys. +All keys must have the same size. +Array keys are passed into hashing functions using the address +of the first int in the array. +.PP +\fBTcl_DeleteHashTable\fR deletes all of the entries in a hash +table and frees up the memory associated with the table's +bucket array and entries. +It does not free the actual table structure (pointed to +by \fItablePtr\fR), since that memory is assumed to be managed +by the client. +\fBTcl_DeleteHashTable\fR also does not free or otherwise +manipulate the values of the hash table entries. +If the entry values point to dynamically-allocated memory, then +it is the client's responsibility to free these structures +before deleting the table. +.PP +\fBTcl_CreateHashEntry\fR locates the entry corresponding to a +particular key, creating a new entry in the table if there +wasn't already one with the given key. +If an entry already existed with the given key then \fI*newPtr\fR +is set to zero. +If a new entry was created, then \fI*newPtr\fR is set to a non-zero +value and the value of the new entry will be set to zero. +The return value from \fBTcl_CreateHashEntry\fR is a pointer to +the entry, which may be used to retrieve and modify the entry's +value or to delete the entry from the table. +.PP +\fBTcl_DeleteHashEntry\fR will remove an existing entry from a +table. +The memory associated with the entry itself will be freed, but +the client is responsible for any cleanup associated with the +entry's value, such as freeing a structure that it points to. +.PP +\fBTcl_FindHashEntry\fR is similar to \fBTcl_CreateHashEntry\fR +except that it doesn't create a new entry if the key doesn't exist; +instead, it returns NULL as result. +.PP +\fBTcl_GetHashValue\fR and \fBTcl_SetHashValue\fR are used to +read and write an entry's value, respectively. +Values are stored and retrieved as type ``ClientData'', which is +large enough to hold a pointer value. On almost all machines this is +large enough to hold an integer value too. +.PP +\fBTcl_GetHashKey\fR returns the key for a given hash table entry, +either as a pointer to a string, a one-word (``char *'') key, or +as a pointer to the first word of an array of integers, depending +on the \fIkeyType\fR used to create a hash table. +In all cases \fBTcl_GetHashKey\fR returns a result with type +``char *''. +When the key is a string or array, the result of \fBTcl_GetHashKey\fR +points to information in the table entry; this information will +remain valid until the entry is deleted or its table is deleted. +.PP +\fBTcl_FirstHashEntry\fR and \fBTcl_NextHashEntry\fR may be used +to scan all of the entries in a hash table. +A structure of type ``Tcl_HashSearch'', provided by the client, +is used to keep track of progress through the table. +\fBTcl_FirstHashEntry\fR initializes the search record and +returns the first entry in the table (or NULL if the table is +empty). +Each susequent call to \fBTcl_NextHashEntry\fR returns the +next entry in the table or +NULL if the end of the table has been reached. +A call to \fBTcl_FirstHashEntry\fR followed by calls to +\fBTcl_NextHashEntry\fR will return each of the entries in +the table exactly once, in an arbitrary order. +It is unadvisable to modify the structure of the table, e.g. +by creating or deleting entries, while the search is in +progress. +.PP +\fBTcl_HashStats\fR returns a dynamically-allocated string with +overall information about a hash table, such as the number of +entries it contains, the number of buckets in its hash array, +and the utilization of the buckets. +It is the caller's responsibility to free the result string +by passing it to \fBfree\fR. +.PP +The header file \fBtcl.h\fR defines the actual data structures +used to implement hash tables. +This is necessary so that clients can allocate Tcl_HashTable +structures and so that macros can be used to read and write +the values of entries. +However, users of the hashing routines should never refer directly +to any of the fields of any of the hash-related data structures; +use the procedures and macros defined here. + +.SH KEYWORDS +hash table, key, lookup, search, value diff --git a/vendor/x11iraf/obm/Tcl/doc/Interp.3 b/vendor/x11iraf/obm/Tcl/doc/Interp.3 new file mode 100644 index 00000000..a93cfccb --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Interp.3 @@ -0,0 +1,132 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Interp.3,v 1.10 93/04/01 09:25:32 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_Interp tclc +.BS +.SH NAME +Tcl_Interp \- client-visible fields of interpreter structures +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +typedef struct { + char *\fIresult\fR; + Tcl_FreeProc *\fIfreeProc\fR; + int \fIerrorLine\fR; +} Tcl_Interp; + +typedef void Tcl_FreeProc(char *\fIblockPtr\fR); +.BE + +.SH DESCRIPTION +.PP +The \fBTcl_CreateInterp\fR procedure returns a pointer to a Tcl_Interp +structure. This pointer is then passed into other Tcl procedures +to process commands in the interpreter and perform other operations +on the interpreter. Interpreter structures contain many many fields +that are used by Tcl, but only three that may be accessed by +clients: \fIresult\fR, \fIfreeProc\fR, and \fIerrorLine\fR. +.PP +The \fIresult\fR and \fIfreeProc\fR fields are used to return +results or error messages from commands. +This information is returned by command procedures back to \fBTcl_Eval\fR, +and by \fBTcl_Eval\fR back to its callers. +The \fIresult\fR field points to the string that represents the +result or error message, and the \fIfreeProc\fR field tells how +to dispose of the storage for the string when it isn't needed anymore. +The easiest way for command procedures to manipulate these +fields is to call procedures like \fBTcl_SetResult\fR +or \fBTcl_AppendResult\fR; they +will hide all the details of managing the fields. +The description below is for those procedures that manipulate the +fields directly. +.PP +Whenever a command procedure returns, it must ensure +that the \fIresult\fR field of its interpreter points to the string +being returned by the command. +The \fIresult\fR field must always point to a valid string. +If a command wishes to return no result then \fIinterp->result\fR +should point to an empty string. +Normally, results are assumed to be statically allocated, +which means that the contents will not change before the next time +\fBTcl_Eval\fR is called or some other command procedure is invoked. +In this case, the \fIfreeProc\fR field must be zero. +Alternatively, a command procedure may dynamically +allocate its return value (e.g. using \fBmalloc\fR) +and store a pointer to it in \fIinterp->result\fR. +In this case, the command procedure must also set \fIinterp->freeProc\fR +to the address of a procedure that can free the value (usually \fBfree\fR). +If \fIinterp->freeProc\fR is non-zero, then Tcl will call \fIfreeProc\fR +to free the space pointed to by \fIinterp->result\fR before it +invokes the next command. +If a client procedure overwrites \fIinterp->result\fR when +\fIinterp->freeProc\fR is non-zero, then it is responsible for calling +\fIfreeProc\fR to free the old \fIinterp->result\fR (the \fBTcl_FreeResult\fR +macro should be used for this purpose). +.PP +\fIFreeProc\fR should have arguments and result that match the +\fBTcl_FreeProc\fR declaration above: it receives a single +argument which is a pointer to the result value to free. +In most applications \fBfree\fR is the only non-zero value ever +used for \fIfreeProc\fR. +However, an application may store a different procedure address +in \fIfreeProc\fR in order to use an alternate memory allocator +or in order to do other cleanup when the result memory is freed. +.PP +As part of processing each command, \fBTcl_Eval\fR initializes +\fIinterp->result\fR +and \fIinterp->freeProc\fR just before calling the command procedure for +the command. The \fIfreeProc\fR field will be initialized to zero, +and \fIinterp->result\fR will point to an empty string. Commands that +do not return any value can simply leave the fields alone. +Furthermore, the empty string pointed to by \fIresult\fR is actually +part of an array of \fBTCL_RESULT_SIZE\fR characters (approximately 200). +If a command wishes to return a short string, it can simply copy +it to the area pointed to by \fIinterp->result\fR. Or, it can use +the sprintf procedure to generate a short result string at the location +pointed to by \fIinterp->result\fR. +.PP +It is a general convention in Tcl-based applications that the result +of an interpreter is normally in the initialized state described +in the previous paragraph. +Procedures that manipulate an interpreter's result (e.g. by +returning an error) will generally assume that the result +has been initialized when the procedure is called. +If such a procedure is to be called after the result has been +changed, then \fBTcl_ResetResult\fR should be called first to +reset the result to its initialized state. +.PP +The \fIerrorLine\fR +field is valid only after \fBTcl_Eval\fR returns +a \fBTCL_ERROR\fR return code. In this situation the \fIerrorLine\fR +field identifies the line number of the command being executed when +the error occurred. The line numbers are relative to the command +being executed: 1 means the first line of the command passed to +\fBTcl_Eval\fR, 2 means the second line, and so on. +The \fIerrorLine\fR field is typically used in conjunction with +\fBTcl_AddErrorInfo\fR to report information about where an error +occurred. +\fIErrorLine\fR should not normally be modified except by \fBTcl_Eval\fR. + +.SH KEYWORDS +free, initialized, interpreter, malloc, result diff --git a/vendor/x11iraf/obm/Tcl/doc/LinkVar.3 b/vendor/x11iraf/obm/Tcl/doc/LinkVar.3 new file mode 100644 index 00000000..f44c96c6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/LinkVar.3 @@ -0,0 +1,113 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/LinkVar.3,v 1.4 93/07/28 15:18:56 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_LinkVar tclc 7.0 +.BS +.SH NAME +.na +Tcl_LinkVar, Tcl_UnlinkVar \- link Tcl variable to C variable +.ad +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_LinkVar\fR(\fIinterp, varName, addr, type\fR) +.sp +\fBTcl_UnlinkVar\fR(\fIinterp, varName\fR) +.SH ARGUMENTS +.AS Tcl_Interp writable +.AP Tcl_Interp *interp in +Interpreter that contains \fIvarName\fR. +Also used by \fBTcl_LinkVar\fR to return error messages. +.AP char *varName in +Name of global variable. +.AP char *addr in +Address of C variable that is to be linked to \fIvarName\fR. +.AP int type in +.na +Type of C variable. Must be one of TCL_LINK_INT, TCL_LINK_DOUBLE, +TCL_LINK_BOOLEAN, or TCL_LINK_STRING, optionally OR'ed with +TCL_LINK_READ_ONLY to make Tcl variable read-only. +.ad +.BE + +.SH DESCRIPTION +.PP +\fBTcl_LinkVar\fR uses variable traces to keep the Tcl variable +named by \fIvarName\fR in sync with the C variable at the address +given by \fIaddr\fR. +Whenever the Tcl variable is read the value of the C variable will +be returned, and whenever the Tcl variable is written the C +variable will be updated to have the same value. +\fBTcl_LinkVar\fR normally returns TCL_OK; if an error occurs +while setting up the link (e.g. because \fIvarName\fR is the +name of array) then TCL_ERROR is returned and \fIinterp->result\fR +contains an error message. +.PP +The \fItype\fR argument specifies the type of the C variable, +and must have one of the following values, optionally OR'ed with +TCL_LINK_READ_ONLY: +.TP +\fBTCL_LINK_INT\fR +The C variable is of type \fBint\fR. +Any value written into the Tcl variable must have a proper integer +form acceptable to \fBTcl_GetInt\fR; attempts to write +non-integer values into \fIvarName\fR will be rejected with +Tcl errors. +.TP +\fBTCL_LINK_DOUBLE\fR +The C variable is of type \fBdouble\fR. +Any value written into the Tcl variable must have a proper real +form acceptable to \fBTcl_GetDouble\fR; attempts to write +non-real values into \fIvarName\fR will be rejected with +Tcl errors. +.TP +\fBTCL_LINK_BOOLEAN\fR +The C variable is of type \fBint\fR. +If its value is zero then it will read from Tcl as ``0''; +otherwise it will read from Tcl as ``1''. +Whenver \fIvarName\fR is +modified, the C variable will be set to a 0 or 1 value. +Any value written into the Tcl variable must have a proper boolean +form acceptable to \fBTcl_GetBoolean\fR; attempts to write +non-boolean values into \fIvarName\fR will be rejected with +Tcl errors. +.TP +\fBTCL_LINK_STRING\fR +The C variable is of type \fBchar *\fR. +If its value is not null then it must be a pointer to a string +allocated with \fBmalloc\fR. +Whenever the Tcl variable is modified the current C string will be +freed and new memory will be allocated to hold a copy of the variable's +new value. +If the C variable contains a null pointer then the Tcl variable +will read as ``NULL''. +.PP +If the TCL_LINK_READ_ONLY flag is present in \fItype\fR then the +variable will be read-only from Tcl, so that its value can only be +changed by modifying the C variable. +Attempts to write the variable from Tcl will be rejected with errors. + +.SH KEYWORDS +boolean, integer, link, read-only, real, string, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/PrintDbl.3 b/vendor/x11iraf/obm/Tcl/doc/PrintDbl.3 new file mode 100644 index 00000000..51d7f884 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/PrintDbl.3 @@ -0,0 +1,58 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/PrintDbl.3,v 1.2 93/06/05 15:32:01 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_PrintDouble tclc 7.0 +.BS +.SH NAME +Tcl_PrintDouble \- Convert floating value to string +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_PrintDouble\fR(\fIinterp, value, dst\fR) +.SH ARGUMENTS +.AS Tcl_Interp *interp +.AP Tcl_Interp *interp in +Interpreter that controls the conversion. +.AP double value in +Floating-point value to be converted. +.AP char *dst out +Where to store string representing \fIvalue\fR. Must have at +least TCL_DOUBLE_SPACE characters of storage. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_PrintDouble\fR generates a string that represents the value +of \fIvalue\fR and stores it in memory at the location given by +\fIdst\fR. It uses %g format to generate the string, with two +special twists. First, the string is guaranteed to contain either +a ``.'' or an ``e'' so that it doesn't look like an integer (where +%g would generate an integer with no decimal point, \fBTcl_PrintDouble\fR +adds ``.0''). Second, the number of significant digits printed at +\fIdst\fR is controlled by the \fBtcl_precision\fR variable in +\fIinterp\fR; if \fBtcl_precision\fR is undefined then 6 significant +digits are printed. + +.SH KEYWORDS +conversion, double-precision, floating-point, string diff --git a/vendor/x11iraf/obm/Tcl/doc/RecordEval.3 b/vendor/x11iraf/obm/Tcl/doc/RecordEval.3 new file mode 100644 index 00000000..02e11d8c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/RecordEval.3 @@ -0,0 +1,60 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/RecordEval.3,v 1.9 93/04/16 15:02:27 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_RecordAndEval tclc +.BS +.SH NAME +Tcl_RecordAndEval \- save command on history list before evaluating +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_RecordAndEval\fR(\fIinterp, cmd, eval\fR) +.SH ARGUMENTS +.AS Tcl_Interp *interp; +.AP Tcl_Interp *interp in +Tcl interpreter in which to evaluate command. +.AP char *cmd in +Command (or sequence of commands) to execute. +.AP int eval in +0 means evaluate \fIcmd\fR, TCL_NO_EVAL means record it but don't +evaluate it. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_RecordAndEval\fR is invoked to record a command as an event +on the history list and then execute it. +It returns a completion code such as TCL_OK just like \fBTcl_Eval\fR +and it leaves information in \fIinterp->result\fR. +If you don't want the command recorded on the history list then +you should invoke \fBTcl_Eval\fR instead of \fBTcl_RecordAndEval\fR. +Normally \fBTcl_RecordAndEval\fR is only called with top-level +commands typed by the user, since the purpose of history is to +allow the user to re-issue recently-invoked commands. +If the \fIeval\fR argument is TCL_NO_EVAL then the command is +recorded without being evaluated. + +.SH KEYWORDS +command, event, execute, history, interpreter, record diff --git a/vendor/x11iraf/obm/Tcl/doc/RegExp.3 b/vendor/x11iraf/obm/Tcl/doc/RegExp.3 new file mode 100644 index 00000000..13546ee6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/RegExp.3 @@ -0,0 +1,57 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/RegExp.3,v 1.1 93/05/05 17:06:04 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_RegExpMatch tclc 7.0 +.BS +.SH NAME +Tcl_RegExpMatch \- Test whether a string matches a regular expression +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_RegExpMatch\fR(\fIinterp\fR, \fIstring\fR, \fIregexp\fR) +.SH ARGUMENTS +.AS Tcl_Interp *interp +.AP Tcl_Interp *interp in +Tcl interpreter to use for error reporting. +.AP char *string in +String to test. +.AP char *regexp in +Regular expression to match against \fIstring\fR. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_RegExpMatch\fR determines whether its \fIstring\fR argument +matches \fIregexp\fR, where \fIregexp\fR is interpreted +as a regular expression using the same rules as for the +\fBregexp\fR Tcl command. +If there is a match then \fBTcl_RegExpMatch\fR returns 1. +If there is no match then \fBTcl_RegExpMatch\fR returns 0. +If an error occurs in the matching process (e.g. \fIregexp\fR +is not a valid regular expression) then \fBTcl_RegExpMatch\fR +returns \-1 and leaves an error message in \fIinterp->result\fR. + +.SH KEYWORDS +match, regular expression, string diff --git a/vendor/x11iraf/obm/Tcl/doc/SetRecLmt.3 b/vendor/x11iraf/obm/Tcl/doc/SetRecLmt.3 new file mode 100644 index 00000000..3010a86d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/SetRecLmt.3 @@ -0,0 +1,60 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/SetRecLmt.3,v 1.1 93/07/07 16:35:18 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_SetRecursionLimit tclc 7.0 +.BS +.SH NAME +Tcl_SetRecursionLimit \- set maximum allowable nesting depth in interpreter +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_SetRecursionLimit\fR(\fIinterp, depth\fR) +.SH ARGUMENTS +.AS Tcl_Interp *interp +.AP Tcl_Interp *interp in +Interpreter whose recursion limit is to be set. +Must be greater than zero. +.AP int depth in +New limit for nested calls to \fBTcl_Eval\fR for \fIinterp\fR. +.BE + +.SH DESCRIPTION +.PP +At any given time Tcl enforces a limit on the number of recursive +calls that may be active for \fBTcl_Eval\fR and related procedures +such as \fBTcl_GlobalEval\fR. +Any call to \fBTcl_Eval\fR that exceeds this depth is aborted with +an error. +By default the recursion limit is 1000. +.PP +\fBTcl_SetRecursionLimit\fR may be used to change the maximum +allowable nesting depth for an interpreter. +The \fIdepth\fR argument specifies a new limit for \fIinterp\fR, +and \fBTcl_SetRecursionLimit\fR returns the old limit. +To read out the old limit without modifying it, invoke +\fBTcl_SetRecursionDepth\fR with \fIdepth\fR equal to 0. + +.SH KEYWORDS +nesting depth, recursion diff --git a/vendor/x11iraf/obm/Tcl/doc/SetResult.3 b/vendor/x11iraf/obm/Tcl/doc/SetResult.3 new file mode 100644 index 00000000..94835acd --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/SetResult.3 @@ -0,0 +1,162 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/SetResult.3,v 1.12 93/04/03 15:05:59 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_SetResult tclc 7.0 +.BS +.SH NAME +Tcl_SetResult, Tcl_AppendResult, Tcl_AppendElement, Tcl_ResetResult \- manipulate Tcl result string +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +\fBTcl_SetResult\fR(\fIinterp, string, freeProc\fR) +.sp +\fBTcl_AppendResult(\fIinterp, string, string, ... , \fB(char *) NULL\fR) +.sp +.VS +\fBTcl_AppendElement\fR(\fIinterp, string\fR) +.VE +.sp +\fBTcl_ResetResult\fR(\fIinterp\fR) +.sp +\fBTcl_FreeResult\fR(\fIinterp\fR) +.SH ARGUMENTS +.AS Tcl_FreeProc freeProc +.AP Tcl_Interp *interp out +Interpreter whose result is to be modified. +.AP char *string in +String value to become result for \fIinterp\fR or to be +appended to existing result. +.AP Tcl_FreeProc freeProc in +Address of procedure to call to release storage at +\fIstring\fR, or \fBTCL_STATIC\fR, \fBTCL_DYNAMIC\fR, or +\fBTCL_VOLATILE\fR. +.BE + +.SH DESCRIPTION +.PP +The procedures described here are utilities for setting the +result/error string in a Tcl interpreter. +.PP +\fBTcl_SetResult\fR +arranges for \fIstring\fR to be the return string for the current Tcl +command in \fIinterp\fR, replacing any existing result. +If \fIfreeProc\fR is \fBTCL_STATIC\fR it means that \fIstring\fR +refers to an area of static storage that is guaranteed not to be +modified until at least the next call to \fBTcl_Eval\fR. +If \fIfreeProc\fR +is \fBTCL_DYNAMIC\fR it means that \fIstring\fR was allocated with a call +to \fBmalloc()\fR and is now the property of the Tcl system. +\fBTcl_SetResult\fR will arrange for the string's storage to be +released by calling \fBfree()\fR when it is no longer needed. +If \fIfreeProc\fR is \fBTCL_VOLATILE\fR it means that \fIstring\fR +points to an area of memory that is likely to be overwritten when +\fBTcl_SetResult\fR returns (e.g. it points to something in a stack frame). +In this case \fBTcl_SetResult\fR will make a copy of the string in +dynamically allocated storage and arrange for the copy to be the +return string for the current Tcl command. +.PP +If \fIfreeProc\fR isn't one of the values \fBTCL_STATIC\fR, +\fBTCL_DYNAMIC\fR, and \fBTCL_VOLATILE\fR, then it is the address +of a procedure that Tcl should call to free the string. +This allows applications to use non-standard storage allocators. +When Tcl no longer needs the storage for the string, it will +call \fIfreeProc\fR. \fIFreeProc\fR should have arguments and +result that match the type \fBTcl_FreeProc\fR: +.nf +.RS + +typedef void Tcl_FreeProc(char *\fIblockPtr\fR); + +.RE +.fi +When \fIfreeProc\fR is called, its \fIblockPtr\fR will be set to +the value of \fIstring\fR passed to \fBTcl_SetResult\fR. +.PP +If \fIstring\fR is \fBNULL\fR, then \fIfreeProc\fR is ignored +and \fBTcl_SetResult\fR +re-initializes \fIinterp\fR's result to point to the pre-allocated result +area, with an empty string in the result area. +.PP +If \fBTcl_SetResult\fR is called at a time when \fIinterp\fR holds a +result, \fBTcl_SetResult\fR does whatever is necessary to dispose +of the old result (see the \fBTcl_Interp\fR manual entry for details +on this). +.PP +\fBTcl_AppendResult\fR makes it easy to build up Tcl results in pieces. +It takes each of its \fIstring\fR arguments and appends them in order +to the current result associated with \fIinterp\fR. +If the result is in its initialized empty state (e.g. a command procedure +was just invoked or \fBTcl_ResetResult\fR was just called), +then \fBTcl_AppendResult\fR sets the result to the concatenation of +its \fIstring\fR arguments. +\fBTcl_AppendResult\fR may be called repeatedly as additional pieces +of the result are produced. +\fBTcl_AppendResult\fR takes care of all the +storage management issues associated with managing \fIinterp\fR's +result, such as allocating a larger result area if necessary. +Any number of \fIstring\fR arguments may be passed in a single +call; the last argument in the list must be a NULL pointer. +.PP +\fBTcl_AppendElement\fR is similar to \fBTcl_AppendResult\fR in +that it allows results to be built up in pieces. +However, \fBTcl_AppendElement\fR takes only a single \fIstring\fR +argument and it appends that argument to the current result +as a proper Tcl list element. +\fBTcl_AppendElement\fR adds backslashes or braces if necessary +to ensure that \fIinterp\fR's result can be parsed as a list and that +\fIstring\fR will be extracted as a single element. +Under normal conditions, \fBTcl_AppendElement\fR will add a space +character to \fIinterp\fR's result just before adding the new +list element, so that the list elements in the result are properly +separated. +.VS +However if the new list element is the first in a list or sub-list +(i.e. \fIinterp\fR's current result is empty, or consists of the +single character ``{'', or ends in the characters `` {'') then no +space is added. +.VE +.PP +\fBTcl_ResetResult\fR clears the result for \fIinterp\fR, +freeing the memory associated with it if the current result was +dynamically allocated. +It leaves the result in its normal initialized state with +\fIinterp->result\fR pointing to a static buffer containing +\fBTCL_RESULT_SIZE\fR characters, of which the first character +is zero. +\fBTcl_ResetResult\fR also clears the error state managed by +\fBTcl_AddErrorInfo\fR and \fBTcl_SetErrorCode\fR. +.PP +\fBTcl_FreeResult\fR is a macro that performs part of the work +of \fBTcl_ResetResult\fR. +It frees up the memory associated with \fIinterp\fR's result +and sets \fIinterp->freeProc\fR to zero, but it doesn't +change \fIinterp->result\fR or clear error state. +\fBTcl_FreeResult\fR is most commonly used when a procedure +is about to replace one result value with another. + +.SH "SEE ALSO" +Tcl_AddErrorInfo, Tcl_SetErrorCode, Tcl_Interp + +.SH KEYWORDS +append, command, element, list, result, return value, interpreter diff --git a/vendor/x11iraf/obm/Tcl/doc/SetVar.3 b/vendor/x11iraf/obm/Tcl/doc/SetVar.3 new file mode 100644 index 00000000..087ebf8c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/SetVar.3 @@ -0,0 +1,166 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/SetVar.3,v 1.15 93/06/05 15:40:17 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_SetVar tclc 7.0 +.BS +.SH NAME +Tcl_SetVar, Tcl_SetVar2, Tcl_GetVar, Tcl_GetVar2, Tcl_UnsetVar, Tcl_UnsetVar2 \- manipulate Tcl variables +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +char * +\fBTcl_SetVar\fR(\fIinterp, varName, newValue, flags\fR) +.sp +char * +\fBTcl_SetVar2\fR(\fIinterp, name1, name2, newValue, flags\fR) +.sp +char * +\fBTcl_GetVar\fR(\fIinterp, varName, flags\fR) +.sp +char * +\fBTcl_GetVar2\fR(\fIinterp, name1, name2, flags\fR) +.sp +int +\fBTcl_UnsetVar\fR(\fIinterp, varName, flags\fR) +.sp +int +\fBTcl_UnsetVar2\fR(\fIinterp, name1, name2, flags\fR) +.SH ARGUMENTS +.AS Tcl_Interp *newValue +.AP Tcl_Interp *interp in +Interpreter containing variable. +.AP char *varName in +Name of variable. May refer to a scalar variable or an element of +an array variable. +.AP char *newValue in +New value for variable. +.AP int flags in +OR-ed combination of bits providing additional information for +operation. See below for valid values. +.AP char *name1 in +Name of scalar variable, or name of array variable if \fIname2\fR +is non-NULL. +.AP char *name2 in +If non-NULL, gives name of element within array and \fIname1\fR +must refer to an array variable. +.BE + +.SH DESCRIPTION +.PP +These procedures may be used to create, modify, read, and delete +Tcl variables from C code. +\fBTcl_SetVar\fR and \fBTcl_SetVar2\fR will create a new variable +or modify an existing one. +Both of these procedures set the given variable to the value +given by \fInewValue\fR, and they return a pointer to a +copy of the variable's new value, which is stored in Tcl's +variable structure. +Tcl keeps a private copy of the variable's value, so the caller +may change \fInewValue\fR after these procedures return without +affecting the value of the variable. +If an error occurs in setting the variable (e.g. an array +variable is referenced without giving an index into the array), +then NULL is returned. +.PP +The name of the variable may be specified in either of two ways. +If \fBTcl_SetVar\fR is called, the variable name is given as +a single string, \fIvarName\fR. +If \fIvarName\fR contains an open parenthesis and ends with a +close parenthesis, then the value between the parentheses is +treated as an index (which can have any string value) and +the characters before the first open +parenthesis are treated as the name of an array variable. +If \fIvarName\fR doesn't have parentheses as described above, then +the entire string is treated as the name of a scalar variable. +If \fBTcl_SetVar2\fR is called, then the array name and index +have been separated by the caller into two separate strings, +\fIname1\fR and \fIname2\fR respectively; if \fIname2\fR is +zero it means that a scalar variable is being referenced. +.PP +The \fIflags\fR argument may be used to specify any of several +options to the procedures. +It consists of an OR-ed combination of any of the following +bits: +.IP TCL_GLOBAL_ONLY +Under normal circumstances the procedures look up variables +at the current level of procedure call for \fIinterp\fR, or +at global level if there is no call active. +However, if this bit is set in \fIflags\fR then the variable +is looked up at global level even if there is a procedure +call active. +.IP TCL_LEAVE_ERR_MSG +If an error is returned and this bit is set in \fIflags\fR, then +an error message will be left in \fI\%interp->result\fR. If this +flag bit isn't set then no error message is left (\fI\%interp->result\fR +will not be modified). +.IP TCL_APPEND_VALUE +If this bit is set then \fInewValue\fR is appended to the current +value, instead of replacing it. +If the variable is currently undefined, then this bit is ignored. +.IP TCL_LIST_ELEMENT +If this bit is set, then \fInewValue\fR is converted to a valid +Tcl list element before setting (or appending to) the variable. +A separator space is appended before the new list element unless +.VS +the list element is going to be the first element in a list or +sublist (i.e. the variable's current value is empty, or contains +the single character ``{'', or ends in `` }''). +.VE +.PP +\fBTcl_GetVar\fR and \fBTcl_GetVar2\fR return the current value +of a variable. +The arguments to these procedures are treated in the same way +as the arguments to \fBTcl_SetVar\fR and \fBTcl_SetVar2\fR. +Under normal circumstances, the return value is a pointer +to the variable's value (which is stored in Tcl's variable +structure and will not change before the next call to \fBTcl_SetVar\fR +or \fBTcl_SetVar2\fR). +The only bits of \fIflags\fR that are used are TCL_GLOBAL_ONLY +and TCL_LEAVE_ERR_MSG, both of +which have +the same meaning as for \fBTcl_SetVar\fR. +If an error occurs in reading the variable (e.g. the variable +doesn't exist or an array element is specified for a scalar +variable), then NULL is returned. +.PP +\fBTcl_UnsetVar\fR and \fBTcl_UnsetVar2\fR may be used to remove +a variable, so that future calls to \fBTcl_GetVar\fR or \fBTcl_GetVar2\fR +for the variable will return an error. +The arguments to these procedures are treated in the same way +as the arguments to \fBTcl_GetVar\fR and \fBTcl_GetVar2\fR. +.VS +If the variable is successfully removed then TCL_OK is returned. +If the variable cannot be removed because it doesn't exist then +TCL_ERROR is returned. +.VE +If an array element is specified, the given element is removed +but the array remains. +If an array name is specified without an index, then the entire +array is removed. + +.SH "SEE ALSO" +Tcl_TraceVar + +.SH KEYWORDS +array, interpreter, scalar, set, unset, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/SplitList.3 b/vendor/x11iraf/obm/Tcl/doc/SplitList.3 new file mode 100644 index 00000000..c5964896 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/SplitList.3 @@ -0,0 +1,164 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/SplitList.3,v 1.11 93/04/01 09:25:34 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_SplitList tclc +.BS +.SH NAME +Tcl_SplitList, Tcl_Merge, Tcl_ScanElement, Tcl_ConvertElement \- manipulate Tcl lists +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_SplitList\fR(\fIinterp, list, argcPtr, argvPtr\fR) +.sp +char * +\fBTcl_Merge\fR(\fIargc, argv\fR) +.sp +int +\fBTcl_ScanElement\fR(\fIsrc, flagsPtr\fR) +.sp +int +\fBTcl_ConvertElement\fR(\fIsrc, dst, flags\fR) +.SH ARGUMENTS +.AS Tcl_Interp ***argvPtr +.AP Tcl_Interp *interp out +Interpreter to use for error reporting. +.AP char *list in +Pointer to a string with proper list structure. +.AP int *argcPtr out +Filled in with number of elements in \fIlist\fR. +.AP char ***argvPtr out +\fI*argvPtr\fR will be filled in with the address of an array of +pointers to the strings that are the extracted elements of \fIlist\fR. +There will be \fI*argcPtr\fR valid entries in the array, followed by +a NULL entry. +.AP int argc in +Number of elements in \fIargv\fR. +.AP char **argv in +Array of strings to merge together into a single list. +Each string will become a separate element of the list. +.AP char *src in +String that is to become an element of a list. +.AP int *flagsPtr in +Pointer to word to fill in with information about \fIsrc\fR. +The value of *\fIflagsPtr\fR must be passed to \fBTcl_ConvertElement\fR. +.AP char *dst in +Place to copy converted list element. Must contain enough characters +to hold converted string. +.AP int flags in +Information about \fIsrc\fR. Must be value returned by previous +call to \fBTcl_ScanElement\fR, possibly OR-ed +with \fBTCL_DONT_USE_BRACES\fR. +.BE + +.SH DESCRIPTION +.PP +These procedures may be used to disassemble and reassemble Tcl lists. +\fBTcl_SplitList\fR breaks a list up into its constituent elements, +returning an array of pointers to the elements using +\fIargcPtr\fR and \fIargvPtr\fR. +While extracting the arguments, \fBTcl_SplitList\fR obeys the usual +rules for backslash substitutions and braces. The area of +memory pointed to by \fI*argvPtr\fR is dynamically allocated; in +addition to the array of pointers, it +also holds copies of all the list elements. It is the caller's +responsibility to free up all of this storage by calling +.DS +\fBfree\fR((char *) \fI*argvPtr\fR) +.DE +when the list elements are no longer needed. +.PP +\fBTcl_SplitList\fR normally returns \fBTCL_OK\fR, which means the list was +successfully parsed. +If there was a syntax error in \fIlist\fR, then \fBTCL_ERROR\fR is returned +and \fIinterp->result\fR will point to an error message describing the +problem. +If \fBTCL_ERROR\fR is returned then no memory is allocated and \fI*argvPtr\fR +is not modified. +.PP +\fBTcl_Merge\fR is the inverse of \fBTcl_SplitList\fR: it +takes a collection of strings given by \fIargc\fR +and \fIargv\fR and generates a result string +that has proper list structure. +This means that commands like \fBindex\fR may be used to +extract the original elements again. +In addition, if the result of \fBTcl_Merge\fR is passed to \fBTcl_Eval\fR, +it will be parsed into \fIargc\fR words whose values will +be the same as the \fIargv\fR strings passed to \fBTcl_Merge\fR. +\fBTcl_Merge\fR will modify the list elements with braces and/or +backslashes in order to produce proper Tcl list structure. +The result string is dynamically allocated +using \fBmalloc()\fR; the caller must eventually release the space +using \fBfree()\fR. +.PP +If the result of \fBTcl_Merge\fR is passed to \fBTcl_SplitList\fR, +the elements returned by \fBTcl_SplitList\fR will be identical to +those passed into \fBTcl_Merge\fR. +However, the converse is not true: if \fBTcl_SplitList\fR +is passed a given string, and the resulting \fIargc\fR and +\fIargv\fR are passed to \fBTcl_Merge\fR, the resulting string +may not be the same as the original string passed to \fBTcl_SplitList\fR. +This is because \fBTcl_Merge\fR may use backslashes and braces +differently than the original string. +.PP +\fBTcl_ScanElement\fR and \fBTcl_ConvertElement\fR are the +procedures that do all of the real work of \fBTcl_Merge\fR. +\fBTcl_ScanElement\fR scans its \fIsrc\fR argument +and determines how to use backslashes and braces +when converting it to a list element. +It returns an overestimate of the number of characters +required to represent \fIsrc\fR as a list element, and +it stores information in \fI*flagsPtr\fR that is needed +by \fBTcl_ConvertElement\fR. +.PP +\fBTcl_ConvertElement\fR is a companion procedure to \fBTcl_ScanElement\fR. +It does the actual work of converting a string to a list element. +Its \fIflags\fR argument must be the same as the value returned +by \fBTcl_ScanElement\fR. +\fBTcl_ConvertElement\fR writes a proper list element to memory +starting at *\fIdst\fR and returns a count of the total number +of characters written, which will be no more than the result +returned by \fBTcl_ScanElement\fR. +\fBTcl_ConvertElement\fR writes out only the actual list element +without any leading or trailing spaces: it is up to the caller to +include spaces between adjacent list elements. +.PP +\fBTcl_ConvertElement\fR uses one of two different approaches to +handle the special characters in \fIsrc\fR. Wherever possible, it +handles special characters by surrounding the string with braces. +This produces clean-looking output, but can't be used in some situations, +such as when \fIsrc\fR contains unmatched braces. +In these situations, \fBTcl_ConvertElement\fR handles special +characters by generating backslash sequences for them. +The caller may insist on the second approach by OR-ing the +flag value returned by \fBTcl_ScanElement\fR with +\fBTCL_DONT_USE_BRACES\fR. +Although this will produce an uglier result, it is useful in some +special situations, such as when \fBTcl_ConvertElement\fR is being +used to generate a portion of an argument for a Tcl command. +In this case, surrounding \fIsrc\fR with curly braces would cause +the command not to be parsed correctly. + +.SH KEYWORDS +backslash, convert, element, list, merge, split, strings diff --git a/vendor/x11iraf/obm/Tcl/doc/StrMatch.3 b/vendor/x11iraf/obm/Tcl/doc/StrMatch.3 new file mode 100644 index 00000000..d99c648f --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/StrMatch.3 @@ -0,0 +1,52 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/StrMatch.3,v 1.7 93/04/01 09:25:35 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_StringMatch tclc +.BS +.SH NAME +Tcl_StringMatch \- test whether a string matches a pattern +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_StringMatch\fR(\fIstring\fR, \fIpattern\fR) +.SH ARGUMENTS +.AP char *string in +String to test. +.AP char *pattern in +Pattern to match against string. May contain special +characters from the set *?\e[]. +.BE + +.SH DESCRIPTION +.PP +This utility procedure determines whether a string matches +a given pattern. If it does, then \fBTcl_StringMatch\fR returns +1. Otherwise \fBTcl_StringMatch\fR returns 0. The algorithm +used for matching is the same algorithm used in the ``string match'' +Tcl command and is similar to the algorithm used by the C-shell +for file name matching; see the Tcl manual entry for details. + +.SH KEYWORDS +match, pattern, string diff --git a/vendor/x11iraf/obm/Tcl/doc/Tcl.n b/vendor/x11iraf/obm/Tcl/doc/Tcl.n new file mode 100644 index 00000000..e6d85731 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/Tcl.n @@ -0,0 +1,205 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/Tcl.n,v 1.118 93/07/28 14:13:25 ouster Exp $ SPRITE (Berkeley) +' +.so man.macros +.de UL +\\$1\l'|0\(ul'\\$2 +.. +.HS Tcl tcl +.BS +.SH NAME +Tcl \- Summary of Tcl language syntax. +.BE + +.SH DESCRIPTION +.LP +The following rules define the syntax and semantics of the Tcl language: +.IP [1] +A Tcl script is a string containing one or more commands. +Semi-colons and newlines are command separators unless quoted as +described below. +Close brackets are command terminators during command substitution +(see below) unless quoted. +.IP [2] +A command is evaluated in two steps. +First, the Tcl interpreter breaks the command into \fIwords\fR +and performs substitutions as described below. +These substitutions are performed in the same way for all +commands. +The first word is used to locate a command procedure to +carry out the command, then all of the words of the command are +passed to the command procedure. +The command procedure is free to interpret each of its words +in any way it likes, such as an integer, variable name, list, +or Tcl script. +Different commands interpret their words differently. +.IP [3] +Words of a command are separated by white space (except for +newlines, which are command separators). +.IP [4] +If the first character of a word is double-quote (``"'') then +the word is terminated by the next double-quote character. +If semi-colons, close brackets, or white space characters +(including newlines) appear between the quotes then they are treated +as ordinary characters and included in the word. +Command substitution, variable substitution, and backslash substitution +are performed on the characters between the quotes as described below. +The double-quotes are not retained as part of the word. +.IP [5] +If the first character of a word is an open brace (``{'') then +the word is terminated by the matching close brace (``}''). +Braces nest within the word: for each additional open +brace there must be an additional close brace (however, +if an open brace or close brace within the word is +quoted with a backslash then it is not counted in locating the +matching close brace). +No substitutions are performed on the characters between the +braces except for backslash-newline substitutions described +below, nor do semi-colons, newlines, close brackets, +or white space receive any special interpretation. +The word will consist of exactly the characters between the +outer braces, not including the braces themselves. +.IP [6] +If a word contains an open bracket (``['') then Tcl performs +\fIcommand substitution\fR. +To do this it invokes the Tcl interpreter recursively to process +the characters following the open bracket as a Tcl script. +The script may contain any number of commands and must be terminated +by a close bracket (``]''). +The result of the script (i.e. the result of its last command) is +substituted into the word in place of the brackets and all of the +characters between them. +There may be any number of command substitutions in a single word. +Command substitution is not performed on words enclosed in braces. +.IP [7] +If a word contains a dollar-sign (``$'') then Tcl performs \fIvariable +substitution\fR: the dollar-sign and the following characters are +replaced in the word by the value of a variable. +Variable substition may take any of the following forms: +.RS +.TP 15 +\fB$\fIname\fR +\fIName\fR is the name of a scalar variable; the name is terminated +by any character that isn't a letter, digit, or underscore. +.TP 15 +\fB$\fIname\fB(\fIindex\fB)\fR +\fIName\fR gives the name of an array variable and \fIindex\fR gives +the name of an element within that array. +\fIName\fR must contain only letters, digits, and underscores. +Command substitutions, variable substitutions, and backslash +substitutions are performed on the characters of \fIindex\fR. +.TP 15 +\fB${\fIname\fB}\fR +\fIName\fR is the name of a scalar variable. It may contain any +characters whatsoever except for close braces. +.RE +.LP +There may be any number of variable substitutions in a single word. +Variable substitution is not performed on words enclosed in braces. +.IP [8] +If a backslash (``\e'') appears within a word then +\fIbackslash substitution\fR occurs. +.VS +In all cases but those described below the backslash is dropped and +the following character is treated as an ordinary +character and included in the word. +.VE +This allows characters such as double quotes, close brackets, +and dollar signs to be included in words without triggering +special processing. +The following table lists the backslash sequences that are +handled specially, along with the value that replaces each sequence. +.RS +.VS +.TP 6 +\e\fBa\fR +Audible alert (bell) (0x7). +.VE +.TP 6 +\e\fBb\fR +Backspace (0x8). +.TP 6 +\e\fBf\fR +Form feed (0xc). +.TP 6 +\e\fBn\fR +Newline (0xa). +.TP 6 +\e\fBr\fR +Carriage-return (0xd). +.TP 6 +\e\fBt\fR +Tab (0x9). +.TP 6 +\e\fBv\fR +Vertical tab (0xb). +.TP 6 +\e\fB<newline>\fIwhiteSpace\fR\fR +.VS +A single space character replaces the backslash, newline, and all +white space after the newline. +This backslash sequence is unique in that it is replaced in a separate +pre-pass before the command is actually parsed. +This means that it will be replaced even when it occurs between +braces, and the resulting space will be treated as a word separator +if it isn't in braces or quotes. +.VE +.TP 6 +\e\e +Backslash (``\e''). +.TP 6 +\e\fIooo\fR +The digits \fIooo\fR (one, two, or three of them) give the octal value of +the character. +.TP 6 +\e\fBx\fIhh\fR +.VS +The hexadecimal digits \fIhh\fR give the hexadecimal value of +the character. Any number of digits may be present. +.VE +.RE +.LP +Backslash substitution is not performed on words enclosed in braces, +except for backslash-newline as described above. +.IP [9] +If a hash character (``#'') appears at a point where Tcl is +expecting the first character of the first word of a command, +then the hash character and the characters that follow it, up +through the next newline, are treated as a comment and ignored. +The comment character only has significance when it appears +at the beginning of a command. +.IP [10] +Each character is processed exactly once by the Tcl interpreter +as part of creating the words of a command. +For example, if variable substition occurs then no further +substitions are performed on the value of the variable; the +value is inserted into the word verbatim. +If command substitution occurs then the nested command is +processed entirely by the recursive call to the Tcl interpreter; +no substitutions are perfomed before making the recursive +call and no additional substitutions are performed on the result +of the nested script. +.IP [11] +Substitutions do not affect the word boundaries of a command. +For example, during variable substitution the entire value of +the variable becomes part of a single word, even if the variable's +value contains spaces. diff --git a/vendor/x11iraf/obm/Tcl/doc/TildeSubst.3 b/vendor/x11iraf/obm/Tcl/doc/TildeSubst.3 new file mode 100644 index 00000000..1d1bdeda --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/TildeSubst.3 @@ -0,0 +1,85 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/TildeSubst.3,v 1.10 93/04/08 14:00:43 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_TildeSubst tclc 7.0 +.BS +.SH NAME +Tcl_TildeSubst \- replace tilde with home directory in a file name +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +char * +.VS +\fBTcl_TildeSubst\fR(\fIinterp\fR, \fIname\fR, \fIbufferPtr) +.VE +.SH ARGUMENTS +.AS Tcl_DString *bufferPtr +.AP Tcl_Interp *interp in +Interpreter in which to report an error, if any. +.AP char *name in +File name, which may start with a ``~''. +.AP Tcl_DString *bufferPtr +.VS +If needed, this dynamic string is used to store the new file name. +At the time of the call it should be uninitialized or empty. The +caller must eventually call \fBTcl_DStringFree\fR to free up +anything stored here. +.VE +.BE + +.SH DESCRIPTION +.PP +This utility procedure does tilde substition. If \fIname\fR doesn't +start with a ``~'' character, then the procedure returns \fIname\fR. +If \fIname\fR does start with a tilde, then \fBTcl_TildeSubst\fR +returns a new string identical to \fIname\fR except that the first +element of \fIname\fR is replaced with the location of the home +directory for the given user. The substitution is carried out in +the same way that it would be done by \fIcsh\fR. If the tilde is +followed immediately by a slash, then the \fB$HOME\fR environment +variable is substituted. Otherwise the characters between the +tilde and the next slash are taken as a user name, which is +looked up in the password file; the user's home directory is +retrieved from the password file and substituted. +.PP +If +.VS +\fBTcl_TildeSubst\fR has to do tilde substitution then it uses +the dynamic string at \fI*bufferPtr\fR to hold the new string it +generates. After \fBTcl_TildeSubst\fR returns, the caller must +eventually invoke \fBTcl_DStringFree\fR to free up any information +placed in \fI*bufferPtr\fR. The caller need not know whether or +not \fBTcl_TildeSubst\fR actually used the string; \fBTcl_TildeSubst\fR +initializes \fI*bufferPtr\fR even if it doesn't use it, so the call to +\fBTcl_DStringFree\fR will be safe in either case. +.VE +.PP +If an error occurs (e.g. because there was no user by the given +name) then NULL is returned and an error message will be left +at \fIinterp->result\fR. It is assumed that \fIinterp->result\fR +has been initialized in the standard way when \fBTcl_TildeSubst\fR +is invoked. + +.SH KEYWORDS +file name, home directory, tilde, user diff --git a/vendor/x11iraf/obm/Tcl/doc/TraceVar.3 b/vendor/x11iraf/obm/Tcl/doc/TraceVar.3 new file mode 100644 index 00000000..3ddfecff --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/TraceVar.3 @@ -0,0 +1,361 @@ +'\" +'\" Copyright (c) 1989-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/TraceVar.3,v 1.14 93/05/03 15:53:18 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS Tcl_TraceVar tclc +.BS +.SH NAME +Tcl_TraceVar, Tcl_TraceVar2, Tcl_UntraceVar, Tcl_UntraceVar2, Tcl_VarTraceInfo, Tcl_VarTraceInfo2 \- monitor accesses to a variable +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +int +\fBTcl_TraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR +.sp +int +\fBTcl_TraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR +.sp +\fBTcl_UntraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR +.sp +\fBTcl_UntraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR +.sp +ClientData +\fBTcl_VarTraceInfo(\fIinterp, varName, flags, proc, prevClientData\fB)\fR +.sp +ClientData +\fBTcl_VarTraceInfo2(\fIinterp, name1, name2, flags, proc, prevClientData\fB)\fR +.SH ARGUMENTS +.AS Tcl_VarTraceProc prevClientData +.AP Tcl_Interp *interp in +Interpreter containing variable. +.AP char *varName in +Name of variable. May refer to a scalar variable, to +an array variable with no index, or to an array variable +with a parenthesized index. +.AP int flags in +OR-ed combination of the values TCL_TRACE_READS, TCL_TRACE_WRITES, and +TCL_TRACE_UNSETS, and TCL_GLOBAL_ONLY. Not all flags are used by all +procedures. See below for more information. +.AP Tcl_VarTraceProc *proc in +Procedure to invoke whenever one of the traced operations occurs. +.AP ClientData clientData in +Arbitrary one-word value to pass to \fIproc\fR. +.AP char *name1 in +Name of scalar or array variable (without array index). +.AP char *name2 in +For a trace on an element of an array, gives the index of the +element. For traces on scalar variables or on whole arrays, +is NULL. +.AP ClientData prevClientData in +If non-NULL, gives last value returned by \fBTcl_VarTraceInfo\fR or +\fBTcl_VarTraceInfo2\fR, so this call will return information about +next trace. If NULL, this call will return information about first +trace. +.BE + +.SH DESCRIPTION +.PP +\fBTcl_TraceVar\fR allows a C procedure to monitor and control +access to a Tcl variable, so that the C procedure is invoked +whenever the variable is read or written or unset. +If the trace is created successfully then \fBTcl_TraceVar\fR returns +TCL_OK. If an error occurred (e.g. \fIvarName\fR specifies an element +of an array, but the actual variable isn't an array) then TCL_ERROR +is returned and an error message is left in \fIinterp->result\fR. +.PP +The \fIflags\fR argument to \fBTcl_TraceVar\fR indicates when the +trace procedure is to be invoked and provides information +for setting up the trace. It consists of an OR-ed combination +of any of the following values: +.TP +\fBTCL_GLOBAL_ONLY\fR +Normally, the variable will be looked up at the current level of +procedure call; if this bit is set then the variable will be looked +up at global level, ignoring any active procedures. +.TP +\fBTCL_TRACE_READS\fR +Invoke \fIproc\fR whenever an attempt is made to read the variable. +.TP +\fBTCL_TRACE_WRITES\fR +Invoke \fIproc\fR whenever an attempt is made to modify the variable. +.TP +\fBTCL_TRACE_UNSETS\fR +Invoke \fIproc\fR whenever the variable is unset. +A variable may be unset either explicitly by an \fBunset\fR command, +or implicitly when a procedure returns (its local variables are +automatically unset) or when the interpreter is deleted (all +variables are automatically unset). +.PP +Whenever one of the specified operations occurs on the variable, +\fIproc\fR will be invoked. +It should have arguments and result that match the type +\fBTcl_VarTraceProc\fR: +.nf +.RS +typedef char *Tcl_VarTraceProc( +.RS +ClientData \fIclientData\fR, +Tcl_Interp *\fIinterp\fR, +char *\fIname1\fR, +char *\fIname2\fR, +int \fIflags\fR); +.RE +.RE +.fi +The \fIclientData\fP and \fIinterp\fP parameters will +have the same values as those passed to \fBTcl_TraceVar\fR when the +trace was created. +\fIClientData\fR typically points to an application-specific +data structure that describes what to do when \fIproc\fR +is invoked. +\fIName1\fR and \fIname2\fR give the name of the traced variable +in the normal two-part form (see the description of \fBTcl_TraceVar2\fR +below for details). +\fIFlags\fR is an OR-ed combination of bits providing several +pieces of information. +One of the bits TCL_TRACE_READS, TCL_TRACE_WRITES, or TCL_TRACE_UNSETS +will be set in \fIflags\fR to indicate which operation is being performed +on the variable. +The bit TCL_GLOBAL_ONLY will be set whenever the variable being +accessed is a global one not accessible from the current level of +procedure call: the trace procedure will need to pass this flag +back to variable-related procedures like \fBTcl_GetVar\fR if it +attempts to access the variable. +The bit TCL_TRACE_DESTROYED will be set in \fIflags\fR if the trace is +about to be destroyed; this information may be useful to \fIproc\fR +so that it can clean up its own internal data structures (see +the section TCL_TRACE_DESTROYED below for more details). +Lastly, the bit TCL_INTERP_DESTROYED will be set if the entire +interpreter is being destroyed. +When this bit is set, \fIproc\fR must be especially careful in +the things it does (see the section TCL_INTERP_DESTROYED below). +The trace procedure's return value should normally be NULL; see +ERROR RETURNS below for information on other possibilities. +.PP +\fBTcl_UntraceVar\fR may be used to remove a trace. +If the variable specified by \fIinterp\fR, \fIvarName\fR, and \fIflags\fR +has a trace set with \fIflags\fR, \fIproc\fR, and +\fIclientData\fR, then the corresponding trace is removed. +If no such trace exists, then the call to \fBTcl_UntraceVar\fR +has no effect. +The same bits are valid for \fIflags\fR as for calls to \fBTcl_TraceVars\fR. +.PP +\fBTcl_VarTraceInfo\fR may be used to retrieve information about +traces set on a given variable. +The return value from \fBTcl_VarTraceInfo\fR is the \fIclientData\fR +associated with a particular trace. +The trace must be on the variable specified by the \fIinterp\fR, +\fIvarName\fR, and \fIflags\fR arguments (only the TCL_GLOBAL_ONLY +bit from \fIflags\fR is used; other bits are ignored) and its trace procedure +must the same as the \fIproc\fR argument. +If the \fIprevClientData\fR argument is NULL then the return +value corresponds to the first (most recently created) matching +trace, or NULL if there are no matching traces. +If the \fIprevClientData\fR argument isn't NULL, then it should +be the return value from a previous call to \fBTcl_VarTraceInfo\fR. +In this case, the new return value will correspond to the next +matching trace after the one whose \fIclientData\fR matches +\fIprevClientData\fR, or NULL if no trace matches \fIprevClientData\fR +or if there are no more matching traces after it. +This mechanism makes it possible to step through all of the +traces for a given variable that have the same \fIproc\fR. + +.SH "TWO-PART NAMES" +.PP +The procedures \fBTcl_TraceVar2\fR, \fBTcl_UntraceVar2\fR, and +\fBTcl_VarTraceInfo2\fR are identical to \fBTcl_TraceVar\fR, +\fBTcl_UntraceVar\fR, and \fBTcl_VarTraceInfo\fR, respectively, +except that the name of the variable has already been +separated by the caller into two parts. +\fIName1\fR gives the name of a scalar variable or array, +and \fIname2\fR gives the name of an element within an +array. +If \fIname2\fR is NULL it means that either the variable is +a scalar or the trace is to be set on the entire array rather +than an individual element (see WHOLE-ARRAY TRACES below for +more information). + +.SH "ACCESSING VARIABLES DURING TRACES" +.PP +During read and write traces, the +trace procedure can read, write, or unset the traced +variable using \fBTcl_GetVar2\fR, \fBTcl_SetVar2\fR, and +other procedures. +While \fIproc\fR is executing, traces are temporarily disabled +for the variable, so that calls to \fBTcl_GetVar2\fR and +\fBTcl_SetVar2\fR will not cause \fIproc\fR or other trace procedures +to be invoked again. +Disabling only occurs for the variable whose trace procedure +is active; accesses to other variables will still be traced. +.VS +However, if a variable is unset during a read or write trace then unset +traces will be invoked. +.VE +.PP +During unset traces the variable has already been completely +expunged. +It is possible for the trace procedure to read or write the +variable, but this will be a new version of the variable. +Traces are not disabled during unset traces as they are for +read and write traces, but existing traces have been removed +from the variable before any trace procedures are invoked. +If new traces are set by unset trace procedures, these traces +will be invoked on accesses to the variable by the trace +procedures. + +.SH "CALLBACK TIMING" +.PP +When read tracing has been specified for a variable, the trace +procedure will be invoked whenever the variable's value is +read. This includes \fBset\fR Tcl commands, \fB$\fR-notation +in Tcl commands, and invocations of the \fBTcl_GetVar\fR +and \fBTcl_GetVar2\fR procedures. +\fIProc\fR is invoked just before the variable's value is +returned. +It may modify the value of the variable to affect what +is returned by the traced access. +.VS +If it unsets the variable then the access will return an error +just as if the variable never existed. +.VE +.PP +When write tracing has been specified for a variable, the +trace procedure will be invoked whenever the variable's value +is modified. This includes \fBset\fR commands\fR, +commands that modify variables as side effects (such as +\fBcatch\fR and \fBscan\fR), and calls to the \fBTcl_SetVar\fR +and \fBTcl_SetVar2\fR procedures). +\fIProc\fR will be invoked after the variable's value has been +modified, but before the new value of the variable has been +returned. +It may modify the value of the variable to override the change +and to determine the value actually returned by the traced +access. +.VS +If it deletes the variable then the traced access will return +an empty string. +.VE +.PP +When unset tracing has been specified, the trace procedure +will be invoked whenever the variable is destroyed. +The traces will be called after the variable has been +completely unset. + +.SH "WHOLE-ARRAY TRACES" +.PP +If a call to \fBTcl_TraceVar\fR or \fBTcl_TraceVar2\fR specifies +the name of an array variable without an index into the array, +then the trace will be set on the array as a whole. +This means that \fIproc\fR will be invoked whenever any +element of the array is accessed in the ways specified by +\fIflags\fR. +When an array is unset, a whole-array trace will be invoked +just once, with \fIname1\fR equal to the name of the array +and \fIname2\fR NULL; it will not be invoked once for each +element. + +.SH "MULTIPLE TRACES" +.PP +It is possible for multiple traces to exist on the same variable. +When this happens, all of the trace procedures will be invoked on each +access, in order from most-recently-created to least-recently-created. +When there exist whole-array traces for an array as well as +traces on individual elements, the whole-array traces are invoked +before the individual-element traces. +.VS +If a read or write trace unsets the variable then all of the unset +traces will be invoked but the remainder of the read and write traces +will be skipped. +.VE + +.SH "ERROR RETURNS" +.PP +Under normal conditions trace procedures should return NULL, indicating +successful completion. +If \fIproc\fR returns a non-NULL value it signifies that an +error occurred. +The return value must be a pointer to a static character string +containing an error message. +If a trace procedure returns an error, no further traces are +invoked for the access and the traced access aborts with the +given message. +Trace procedures can use this facility to make variables +read-only, for example (but note that the value of the variable +will already have been modified before the trace procedure is +called, so the trace procedure will have to restore the correct +value). +.PP +The return value from \fIproc\fR is only used during read and +write tracing. +During unset traces, the return value is ignored and all relevant +trace procedures will always be invoked. + +.SH "RESTRICTIONS" +.PP +A trace procedure can be called at any time, even when there +is a partically-formed result in the interpreter's result area. If +the trace procedure does anything that could damage this result (such +as calling \fBTcl_Eval\fR) then it must save the original values of +the interpreter's \fBresult\fR and \fBfreeProc\fR fields and restore +them before it returns. + +.SH "UNDEFINED VARIABLES" +.PP +It is legal to set a trace on an undefined variable. +The variable will still appear to be undefined until the +first time its value is set. +If an undefined variable is traced and then unset, the unset will fail +with an error (``no such variable''), but the trace +procedure will still be invoked. + +.SH "TCL_TRACE_DELETED FLAG" +.PP +In an unset callback to \fIproc\fR, the TCL_TRACE_DELETED bit +is set in \fIflags\fR if the trace is being removed as part +of the deletion. +Traces on a variable are always removed whenever the variable +is deleted; the only time TCL_TRACE_DELETED isn't set is for +a whole-array trace invoked when only a single element of an +array is unset. + +.SH "TCL_INTERP_DESTROYED" +.PP +When an interpreter is destroyed, unset traces are called for +all of its variables. +The TCL_INTERP_DESTROYED bit will be set in the \fIflags\fR +argument passed to the trace procedures. +Trace procedures must be extremely careful in what they do if +the TCL_INTERP_DESTROYED bit is set. +It is not safe for the procedures to invoke any Tcl procedures +on the interpreter, since its state is partially deleted. +All that trace procedures should do under these circumstances is +to clean up and free their own internal data structures. + +.SH BUGS +.PP +Tcl doesn't do any error checking to prevent trace procedures +from misusing the interpreter during traces with TCL_INTERP_DESTROYED +set. + +.SH KEYWORDS +clientData, trace, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/append.n b/vendor/x11iraf/obm/Tcl/doc/append.n new file mode 100644 index 00000000..7015d5a1 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/append.n @@ -0,0 +1,45 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/append.n,v 1.1 93/04/14 16:52:54 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS append tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +append \- Append to variable +.SH SYNOPSIS +\fBappend \fIvarName value \fR?\fIvalue value ...\fR? +.BE + +.SH DESCRIPTION +.PP +Append all of the \fIvalue\fR arguments to the current value +of variable \fIvarName\fR. If \fIvarName\fR doesn't exist, +it is given a value equal to the concatenation of all the +\fIvalue\fR arguments. +This command provides an efficient way to build up long +variables incrementally. +For example, ``\fBappend a $b\fR'' is much more efficient than +``\fBset a $a$b\fR'' if \fB$a\fR is long. + +.SH KEYWORDS +append, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/array.n b/vendor/x11iraf/obm/Tcl/doc/array.n new file mode 100644 index 00000000..553a1cc9 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/array.n @@ -0,0 +1,95 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/array.n,v 1.1 93/04/14 16:52:55 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS array tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +array \- Manipulate array variables +.SH SYNOPSIS +\fBarray \fIoption arrayName\fR ?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command performs one of several operations on the +variable given by \fIarrayName\fR. +\fIArrayName\fR must be the name of an existing array variable. +The \fIoption\fR argument determines what action is carried +out by the command. +The legal \fIoptions\fR (which may be abbreviated) are: +.TP +\fBarray anymore \fIarrayName searchId\fR +Returns 1 if there are any more elements left to be processed +in an array search, 0 if all elements have already been +returned. +\fISearchId\fR indicates which search on \fIarrayName\fR to +check, and must have been the return value from a previous +invocation of \fBarray startsearch\fR. +This option is particularly useful if an array has an element +with an empty name, since the return value from +\fBarray nextelement\fR won't indicate whether the search +has been completed. +.TP +\fBarray donesearch \fIarrayName searchId\fR +This command terminates an array search and destroys all the +state associated with that search. \fISearchId\fR indicates +which search on \fIarrayName\fR to destroy, and must have +been the return value from a previous invocation of +\fBarray startsearch\fR. Returns an empty string. +.TP +\fBarray names \fIarrayName\fR +Returns a list containing the names of all of the elements in +the array. +If there are no elements in the array then an empty string is +returned. +.TP +\fBarray nextelement \fIarrayName searchId\fR +Returns the name of the next element in \fIarrayName\fR, or +an empty string if all elements of \fIarrayName\fR have +already been returned in this search. The \fIsearchId\fR +argument identifies the search, and must have +been the return value of an \fBarray startsearch\fR command. +Warning: if elements are added to or deleted from the array, +then all searches are automatically terminated just as if +\fBarray donesearch\fR had been invoked; this will cause +\fBarray nextelement\fR operations to fail for those searches. +.TP +\fBarray size \fIarrayName\fR +Returns a decimal string giving the number of elements in the +array. +.TP +\fBarray startsearch \fIarrayName\fR +This command initializes an element-by-element search through the +array given by \fIarrayName\fR, such that invocations of the +\fBarray nextelement\fR command will return the names of the +individual elements in the array. +When the search has been completed, the \fBarray donesearch\fR +command should be invoked. +The return value is a +search identifier that must be used in \fBarray nextelement\fR +and \fBarray donesearch\fR commands; it allows multiple +searches to be underway simultaneously for the same array. + +.SH KEYWORDS +array, element names, search diff --git a/vendor/x11iraf/obm/Tcl/doc/break.n b/vendor/x11iraf/obm/Tcl/doc/break.n new file mode 100644 index 00000000..ba2f1088 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/break.n @@ -0,0 +1,41 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/break.n,v 1.1 93/04/14 16:52:56 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS break tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +break \- Abort looping command +.SH SYNOPSIS +\fBbreak\fR +.BE + +.SH DESCRIPTION +.PP +This command may be invoked only inside the body of a looping command +such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR. +It returns a TCL_BREAK code to signal the innermost containing +loop command to return immediately. + +.SH KEYWORDS +abort, break, loop diff --git a/vendor/x11iraf/obm/Tcl/doc/case.n b/vendor/x11iraf/obm/Tcl/doc/case.n new file mode 100644 index 00000000..79114343 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/case.n @@ -0,0 +1,72 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/case.n,v 1.3 93/06/17 11:29:59 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS case tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +case \- Evaluate one of several scripts, depending on a given value +.SH SYNOPSIS +\fBcase\fI string \fR?\fBin\fR? \fIpatList body \fR?\fIpatList body \fR...? +.br +\fBcase\fI string \fR?\fBin\fR? {\fIpatList body \fR?\fIpatList body \fR...?} +.BE + +.SH DESCRIPTION +.PP +\fINote: the \fBcase\fI command is obsolete and is supported only +for backward compatibility. At some point in the future it may be +removed entirely. You should use the \fBswitch\fI command instead.\fR +.PP +The \fBcase\fR command matches \fIstring\fR against each of +the \fIpatList\fR arguments in order. +Each \fIpatList\fR argument is a list of one or +more patterns. If any of these patterns matches \fIstring\fR then +\fBcase\fR evaluates the following \fIbody\fR argument +by passing it recursively to the Tcl interpreter and returns the result +of that evaluation. +Each \fIpatList\fR argument consists of a single +pattern or list of patterns. Each pattern may contain any of the wild-cards +described under \fBstring match\fR. If a \fIpatList\fR +argument is \fBdefault\fR, the corresponding body will be evaluated +if no \fIpatList\fR matches \fIstring\fR. If no \fIpatList\fR argument +matches \fIstring\fR and no default is given, then the \fBcase\fR +command returns an empty string. +.PP +Two syntaxes are provided for the \fIpatList\fR and \fIbody\fR arguments. +The first uses a separate argument for each of the patterns and commands; +this form is convenient if substitutions are desired on some of the +patterns or commands. +The second form places all of the patterns and commands together into +a single argument; the argument must have proper list structure, with +the elements of the list being the patterns and commands. +The second form makes it easy to construct multi-line case commands, +since the braces around the whole list make it unnecessary to include a +backslash at the end of each line. +Since the \fIpatList\fR arguments are in braces in the second form, +no command or variable substitutions are performed on them; this makes +the behavior of the second form different than the first form in some +cases. + +.SH KEYWORDS +case, match, regular expression diff --git a/vendor/x11iraf/obm/Tcl/doc/catch.n b/vendor/x11iraf/obm/Tcl/doc/catch.n new file mode 100644 index 00000000..735aba0d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/catch.n @@ -0,0 +1,50 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/catch.n,v 1.1 93/04/14 16:52:57 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS catch tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +catch \- Evaluate script and trap exceptional returns +.SH SYNOPSIS +\fBcatch\fI script \fR?\fIvarName\fR? +.BE + +.SH DESCRIPTION +.PP +The \fBcatch\fR command may be used to prevent errors from aborting +command interpretation. \fBCatch\fR calls the Tcl interpreter recursively +to execute \fIscript\fR, and always returns a TCL_OK code, regardless of +any errors that might occur while executing \fIscript\fR. The return +value from \fBcatch\fR is a decimal string giving the +code returned by the Tcl interpreter after executing \fIscript\fR. +This will be \fB0\fR (TCL_OK) if there were no errors in \fIscript\fR; +otherwise +it will have a non-zero value corresponding to one of the exceptional +return codes (see tcl.h for the definitions of code values). If the +\fIvarName\fR argument is given, then it gives the name of a variable; +\fBcatch\fR will set the variable to the string returned +from \fIscript\fR (either a result or an error message). + +.SH KEYWORDS +catch, error diff --git a/vendor/x11iraf/obm/Tcl/doc/cd.n b/vendor/x11iraf/obm/Tcl/doc/cd.n new file mode 100644 index 00000000..cfc4401a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/cd.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/cd.n,v 1.1 93/04/14 16:52:58 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS cd tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +cd \- Change working directory +.SH SYNOPSIS +\fBcd \fR?\fIdirName\fR? +.BE + +.SH DESCRIPTION +.PP +Change the current working directory to \fIdirName\fR, or to the +home directory (as specified in the HOME environment variable) if +\fIdirName\fR is not given. +If \fIdirName\fR starts with a tilde, then tilde-expansion is +done as described for \fBTcl_TildeSubst\fR. +Returns an empty string. + +.SH KEYWORDS +working directory diff --git a/vendor/x11iraf/obm/Tcl/doc/close.n b/vendor/x11iraf/obm/Tcl/doc/close.n new file mode 100644 index 00000000..dbd0dc0e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/close.n @@ -0,0 +1,46 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/close.n,v 1.1 93/04/16 17:23:28 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS close tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +close \- Close an open file +.SH SYNOPSIS +\fBclose \fIfileId\fR +.BE + +.SH DESCRIPTION +.PP +Closes the file given by \fIfileId\fR. +\fIFileId\fR must be the return value from a previous invocation +of the \fBopen\fR command; after this command, it should not be +used anymore. +If \fIfileId\fR refers to a command pipeline instead of a file, +then \fBclose\fR waits for the children to complete. +The normal result of this command is an empty string, but errors +are returned if there are problems in closing the file or waiting +for children to complete. + +.SH KEYWORDS +close, file diff --git a/vendor/x11iraf/obm/Tcl/doc/concat.n b/vendor/x11iraf/obm/Tcl/doc/concat.n new file mode 100644 index 00000000..8b50e327 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/concat.n @@ -0,0 +1,57 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/concat.n,v 1.2 93/10/28 16:19:07 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS concat tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +concat \- Join lists together +.SH SYNOPSIS +.VS +\fBconcat\fI \fR?\fIarg arg ...\fR? +.VE +.BE + +.SH DESCRIPTION +.PP +This command treats each argument as a list and concatenates them +into a single list. +It also eliminates leading and trailing spaces in the \fIarg\fR's +and adds a single separator space between \fIarg\fR's. +It permits any number of arguments. For example, +the command +.DS +\fBconcat a b {c d e} {f {g h}}\fR +.DE +will return +.DS +\fBa b c d e f {g h}\fR +.DE +as its result. +.PP +.VS +If no \fIarg\fRs are supplied, the result is an empty string. +.VE + +.SH KEYWORDS +concatenate, join, lists diff --git a/vendor/x11iraf/obm/Tcl/doc/continue.n b/vendor/x11iraf/obm/Tcl/doc/continue.n new file mode 100644 index 00000000..90adf49e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/continue.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/continue.n,v 1.1 93/04/16 17:23:30 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS continue tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +continue \- Skip to the next iteration of a loop +.SH SYNOPSIS +\fBcontinue\fR +.BE + +.SH DESCRIPTION +.PP +This command may be invoked only inside the body of a looping command +such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR. +It returns a TCL_CONTINUE code +to signal the innermost containing loop command to skip the +remainder of the loop's body +but continue with the next iteration of the loop. + +.SH KEYWORDS +continue, iteration, loop diff --git a/vendor/x11iraf/obm/Tcl/doc/eof.n b/vendor/x11iraf/obm/Tcl/doc/eof.n new file mode 100644 index 00000000..ef6e7660 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/eof.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/eof.n,v 1.1 93/04/16 17:23:31 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS eof tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +eof \- Check for end-of-file condition on open file +.SH SYNOPSIS +\fBeof \fIfileId\fR +.BE + +.SH DESCRIPTION +.PP +Returns 1 if an end-of-file condition has occurred on \fIfileId\fR, +0 otherwise. +\fIFileId\fR must have been the return +value from a previous call to \fBopen\fR, or it may be \fBstdin\fR, +\fBstdout\fR, or \fBstderr\fR to refer to one of the standard I/O +channels. + +.SH KEYWORDS +end, file diff --git a/vendor/x11iraf/obm/Tcl/doc/error.n b/vendor/x11iraf/obm/Tcl/doc/error.n new file mode 100644 index 00000000..0c901153 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/error.n @@ -0,0 +1,71 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/error.n,v 1.1 93/04/16 17:23:32 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS error tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +error \- Generate an error +.SH SYNOPSIS +\fBerror \fImessage\fR ?\fIinfo\fR? ?\fIcode\fR? +.BE + +.SH DESCRIPTION +.PP +Returns a TCL_ERROR code, which causes command interpretation to be +unwound. \fIMessage\fR is a string that is returned to the application +to indicate what went wrong. +.PP +If the \fIinfo\fR argument is provided and is non-empty, +it is used to initialize the global variable \fBerrorInfo\fR. +\fBerrorInfo\fR is used to accumulate a stack trace of what +was in progress when an error occurred; as nested commands unwind, +the Tcl interpreter adds information to \fBerrorInfo\fR. If the +\fIinfo\fR argument is present, it is used to initialize +\fBerrorInfo\fR and the first increment of unwind information +will not be added by the Tcl interpreter. In other +words, the command containing the \fBerror\fR command will not appear +in \fBerrorInfo\fR; in its place will be \fIinfo\fR. +This feature is most useful in conjunction with the \fBcatch\fR command: +if a caught error cannot be handled successfully, \fIinfo\fR can be used +to return a stack trace reflecting the original point of occurrence +of the error: +.DS +\fBcatch {...} errMsg +set savedInfo $errorInfo +\&... +error $errMsg $savedInfo\fR +.DE +.PP +If the \fIcode\fR argument is present, then its value is stored +in the \fBerrorCode\fR global variable. This variable is intended +to hold a machine-readable description of the error in cases where +such information is available; see the section BUILT-IN VARIABLES +below for information on the proper format for the variable. +If the \fIcode\fR argument is not +present, then \fBerrorCode\fR is automatically reset to +``NONE'' by the Tcl interpreter as part of processing the +error generated by the command. + +.SH KEYWORDS +error, errorCode, errorInfo diff --git a/vendor/x11iraf/obm/Tcl/doc/eval.n b/vendor/x11iraf/obm/Tcl/doc/eval.n new file mode 100644 index 00000000..7c38ab4c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/eval.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/eval.n,v 1.1 93/05/10 17:10:16 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS eval tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +eval \- Evaluate a Tcl script +.SH SYNOPSIS +\fBeval \fIarg \fR?\fIarg ...\fR? +.BE + +.SH DESCRIPTION +.PP +\fBEval\fR takes one or more arguments, which together comprise a Tcl +script containing one or more commands. +\fBEval\fR concatenates all its arguments in the same +fashion as the \fBconcat\fR command, passes the concatenated string to the +Tcl interpreter recursively, and returns the result of that +evaluation (or any error generated by it). + +.SH KEYWORDS +concatenate, evaluate, script diff --git a/vendor/x11iraf/obm/Tcl/doc/exec.n b/vendor/x11iraf/obm/Tcl/doc/exec.n new file mode 100644 index 00000000..fa900616 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/exec.n @@ -0,0 +1,198 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/exec.n,v 1.6 93/07/23 15:13:34 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS exec tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +exec \- Invoke subprocess(es) +.SH SYNOPSIS +\fBexec \fR?\fIswitches\fR? \fIarg \fR?\fIarg ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command treats its arguments as the specification +of one or more subprocesses to execute. +The arguments take the form of a standard shell pipeline +where each \fIarg\fR becomes one word of a command, and +each distinct command becomes a subprocess. +.PP +If the initial arguments to \fBexec\fR start with \fB\-\fR then +.VS +they are treated as command-line switches and are not part +of the pipeline specification. The following switches are +currently supported: +.TP 13 +\fB\-keepnewline +Retains a trailing newline in the pipeline's output. +Normally a trailing newline will be deleted. +.TP 13 +\fB\-\|\-\fR +Marks the end of switches. The argument following this one will +be treated as the first \fIarg\fR even if it starts with a \fB\-. +.VE +.PP +If an \fIarg\fR (or pair of \fIarg\fR's) has one of the forms +described below then it is used by \fBexec\fR to control the +flow of input and output among the subprocess(es). +Such arguments will not be passed to the subprocess(es). In forms +.VS +such as ``< \fIfileName\fR'' \fIfileName\fR may either be in a +separate argument from ``<'' or in the same argument with no +intervening space (i.e. ``<\fIfileName\fR''). +.VE +.TP 15 +|\fR +Separates distinct commands in the pipeline. The standard output +of the preceding command will be piped into the standard input +of the next command. +.TP 15 +|&\fR +Separates distinct commands in the pipeline. Both standard output +and standard error of the preceding command will be piped into +the standard input of the next command. +This form of redirection overrides forms such as 2> and >&. +.TP 15 +<\0\fIfileName\fR +The file named by \fIfileName\fR is opened and used as the standard +input for the first command in the pipeline. +.TP 15 +<@\0\fIfileId\fR +.VS +\fIFileId\fR must be the identifier for an open file, such as the return +value from a previous call to \fBopen\fR. +It is used as the standard input for the first command in the pipeline. +\fIFileId\fR must have been opened for reading. +.VE +.TP 15 +<<\0\fIvalue\fR +\fIValue\fR is passed to the first command as its standard input. +.TP 15 +>\0\fIfileName\fR +Standard output from the last command is redirected to the file named +\fIfileName\fR, overwriting its previous contents. +.TP 15 +2>\0\fIfileName\fR +.VS +Standard error from all commands in the pipeline is redirected to the +file named \fIfileName\fR, overwriting its previous contents. +.TP 15 +>&\0\fIfileName\fR +Both standard output from the last command and standard error from all +commands are redirected to the file named \fIfileName\fR, overwriting +its previous contents. +.VE +.TP 15 +>>\0\fIfileName\fR +Standard output from the last command is +redirected to the file named \fIfileName\fR, appending to it rather +than overwriting it. +.TP 15 +2>>\0\fIfileName\fR +.VS +Standard error from all commands in the pipeline is +redirected to the file named \fIfileName\fR, appending to it rather +than overwriting it. +.TP 15 +>>&\0\fIfileName\fR +Both standard output from the last command and standard error from +all commands are redirected to the file named \fIfileName\fR, +appending to it rather than overwriting it. +.TP 15 +>@\0\fIfileId\fR +\fIFileId\fR must be the identifier for an open file, such as the return +value from a previous call to \fBopen\fR. +Standard output from the last command is redirected to \fIfileId\fR's +file, which must have been opened for writing. +.TP 15 +2>@\0\fIfileId\fR +\fIFileId\fR must be the identifier for an open file, such as the return +value from a previous call to \fBopen\fR. +Standard error from all commands in the pipeline is +redirected to \fIfileId\fR's file. +The file must have been opened for writing. +.TP 15 +>&@\0\fIfileId\fR +\fIFileId\fR must be the identifier for an open file, such as the return +value from a previous call to \fBopen\fR. +Both standard output from the last command and standard error from +all commands are redirected to \fIfileId\fR's file. +The file must have been opened for writing. +.VE +.PP +If standard output has not been redirected then the \fBexec\fR +command returns the standard output from the last command +in the pipeline. +If any of the commands in the pipeline exit abnormally or +are killed or suspended, then \fBexec\fR will return an error +and the error message will include the pipeline's output followed by +error messages describing the abnormal terminations; the +\fBerrorCode\fR variable will contain additional information +about the last abnormal termination encountered. +If any of the commands writes to its standard error file and that +standard error isn't redirected, +then \fBexec\fR will return an error; the error message +will include the pipeline's standard output, followed by messages +about abnormal terminations (if any), followed by the standard error +output. +.PP +If the last character of the result or error message +is a newline then that character is normally deleted +from the result or error message. +This is consistent with other Tcl return values, which don't +normally end with newlines. +.VS +However, if \fB\-keepnewline\fR is specified then the trailing +newline is retained. +.VE +.PP +If standard input isn't redirected with ``<'' or ``<<'' +or ``<@'' then the standard input for the first command in the +pipeline is taken from the application's current standard input. +.PP +If the last \fIarg\fR is ``&'' then the pipeline will be +executed in background. +.VS +In this case the \fBexec\fR command will return a list whose +elements are the process identifiers for all of the subprocesses +in the pipeline. +.VE +The standard output from the last command in the pipeline will +go to the application's standard output if it hasn't been +redirected, and error output from all of +the commands in the pipeline will go to the application's +standard error file unless redirected. +.PP +The first word in each command is taken as the command name; +tilde-substitution is performed on it, and if the result contains +no slashes then the directories +in the PATH environment variable are searched for +an executable by the given name. +If the name contains a slash then it must refer to an executable +reachable from the current directory. +No ``glob'' expansion or other shell-like substitutions +are performed on the arguments to commands. + +.SH KEYWORDS +execute, pipeline, redirection, subprocess diff --git a/vendor/x11iraf/obm/Tcl/doc/exit.n b/vendor/x11iraf/obm/Tcl/doc/exit.n new file mode 100644 index 00000000..d25a524a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/exit.n @@ -0,0 +1,41 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/exit.n,v 1.2 93/06/17 13:31:30 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS exit tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +exit \- End the application +.SH SYNOPSIS +\fBexit \fR?\fIreturnCode\fR? +.BE + +.SH DESCRIPTION +.PP +Terminate the process, returning \fIreturnCode\fR to the +system as the exit status. +If \fIreturnCode\fR isn't specified then it defaults +to 0. + +.SH KEYWORDS +exit, process diff --git a/vendor/x11iraf/obm/Tcl/doc/expr.n b/vendor/x11iraf/obm/Tcl/doc/expr.n new file mode 100644 index 00000000..957d8cc0 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/expr.n @@ -0,0 +1,302 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/expr.n,v 1.5 93/09/02 16:41:26 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS expr tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +expr \- Evalue an expression +.SH SYNOPSIS +\fBexpr \fIarg \fR?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +.VS +Concatenates \fIarg\fR's (adding separator spaces between them), +evaluates the result as a Tcl expression, and returns the value. +.VE +The operators permitted in Tcl expressions are a subset of +the operators permitted in C expressions, and they have the +same meaning and precedence as the corresponding C operators. +Expressions almost always yield numeric results +(integer or floating-point values). +For example, the expression +.DS +\fBexpr 8.2 + 6\fR +.DE +evaluates to 14.2. +Tcl expressions differ from C expressions in the way that +operands are specified. Also, Tcl expressions support +non-numeric operands and string comparisons. +.SH OPERANDS +.PP +A Tcl expression consists of a combination of operands, operators, +and parentheses. +White space may be used between the operands and operators and +parentheses; it is ignored by the expression processor. +Where possible, operands are interpreted as integer values. +Integer values may be specified in decimal (the normal case), in octal (if the +first character of the operand is \fB0\fR), or in hexadecimal (if the first +two characters of the operand are \fB0x\fR). +If an operand does not have one of the integer formats given +above, then it is treated as a floating-point number if that is +possible. Floating-point numbers may be specified in any of the +ways accepted by an ANSI-compliant C compiler (except that the +``f'', ``F'', ``l'', and ``L'' suffixes will not be permitted in +most installations). For example, all of the +following are valid floating-point numbers: 2.1, 3., 6e4, 7.91e+16. +If no numeric interpretation is possible, then an operand is left +as a string (and only a limited set of operators may be applied to +it). +.PP +Operands may be specified in any of the following ways: +.IP [1] +As an numeric value, either integer or floating-point. +.IP [2] +As a Tcl variable, using standard \fB$\fR notation. +The variable's value will be used as the operand. +.IP [3] +As a string enclosed in double-quotes. +The expression parser will perform backslash, variable, and +command substitutions on the information between the quotes, +and use the resulting value as the operand +.IP [4] +As a string enclosed in braces. +The characters between the open brace and matching close brace +will be used as the operand without any substitutions. +.IP [5] +As a Tcl command enclosed in brackets. +The command will be executed and its result will be used as +the operand. +.IP [6] +.VS +As a mathematical function whose arguments have any of the above +forms for operands, such as ``\fBsin($x)\fR''. See below for a list of defined +functions. +.VE +.LP +Where substitutions occur above (e.g. inside quoted strings), they +are performed by the expression processor. +However, an additional layer of substitution may already have +been performed by the command parser before the expression +processor was called. +As discussed below, it is usually best to enclose expressions +in braces to prevent the command parser from performing substitutions +on the contents. +.PP +For some examples of simple expressions, suppose the variable +\fBa\fR has the value 3 and +the variable \fBb\fR has the value 6. +Then the command on the left side of each of the lines below +will produce the value on the right side of the line: +.DS +.ta 6c +\fBexpr 3.1 + $a 6.1 +expr 2 + "$a.$b" 5.6 +expr 4*[llength "6 2"] 8 +expr {{word one} < "word $a"} 0\fR +.DE +.SH OPERATORS +.PP +The valid operators are listed below, grouped in decreasing order +of precedence: +.TP 20 +\fB\-\0\0~\0\0!\fR +Unary minus, bit-wise NOT, logical NOT. None of these operands +may be applied to string operands, and bit-wise NOT may be +applied only to integers. +.TP 20 +\fB*\0\0/\0\0%\fR +Multiply, divide, remainder. None of these operands may be +applied to string operands, and remainder may be applied only +to integers. +.VS +The remainder will always have the same sign as the divisor and +an absolute value smaller than the divisor. +.VE +.TP 20 +\fB+\0\0\-\fR +Add and subtract. Valid for any numeric operands. +.TP 20 +\fB<<\0\0>>\fR +Left and right shift. Valid for integer operands only. +.TP 20 +\fB<\0\0>\0\0<=\0\0>=\fR +Boolean less, greater, less than or equal, and greater than or equal. +Each operator produces 1 if the condition is true, 0 otherwise. +These operators may be applied to strings as well as numeric operands, +in which case string comparison is used. +.TP 20 +\fB==\0\0!=\fR +Boolean equal and not equal. Each operator produces a zero/one result. +Valid for all operand types. +.TP 20 +\fB&\fR +Bit-wise AND. Valid for integer operands only. +.TP 20 +\fB^\fR +Bit-wise exclusive OR. Valid for integer operands only. +.TP 20 +\fB|\fR +Bit-wise OR. Valid for integer operands only. +.TP 20 +\fB&&\fR +Logical AND. Produces a 1 result if both operands are non-zero, 0 otherwise. +Valid for numeric operands only (integers or floating-point). +.TP 20 +\fB||\fR +Logical OR. Produces a 0 result if both operands are zero, 1 otherwise. +Valid for numeric operands only (integers or floating-point). +.TP 20 +\fIx\fB?\fIy\fB:\fIz\fR +If-then-else, as in C. If \fIx\fR +evaluates to non-zero, then the result is the value of \fIy\fR. +Otherwise the result is the value of \fIz\fR. +The \fIx\fR operand must have a numeric value. +.LP +See the C manual for more details on the results +produced by each operator. +All of the binary operators group left-to-right within the same +precedence level. For example, the command +.DS +\fBexpr 4*2 < 7\fR +.DE +returns 0. +.PP +The \fB&&\fP, \fB||\fP, and \fB?:\fP operators have ``lazy +evaluation'', just as in C, +which means that operands are not evaluated if they are +not needed to determine the outcome. For example, in the command +.DS +\fBexpr {$v ? [a] : [b]}\fR +.DE +only one of \fB[a]\fR or \fB[b]\fR will actually be evaluated, +depending on the value of \fB$v\fP. Note, however, that this is +only true if the entire expression is enclosed in braces; otherwise +the Tcl parser will evaluate both \fB[a]\fR and \fB[b]\fR before +invoking the \fBexpr\fR command. +.SH "MATH FUNCTIONS" +.PP +.VS +Tcl supports the following mathematical functions in expressions: +.DS +.ta 3c 6c 9c +\fBacos\fR \fBcos\fR \fBhypot\fR \fBsinh\fR +\fBasin\fR \fBcosh\fR \fBlog\fR \fBsqrt\fR +\fBatan\fR \fBexp\fR \fBlog10\fR \fBtan\fR +\fBatan2\fR \fBfloor\fR \fBpow\fR \fBtanh\fR +\fBceil\fR \fBfmod\fR \fBsin\fR +.DE +Each of these functions invokes the math library function of the same +name; see the manual entries for the library functions for details +on what they do. Tcl also implements the following functions for +conversion between integers and floating-point numbers: +.TP +\fBabs(\fIarg\fB)\fI +Returns the absolute value of \fIarg\fR. \fIArg\fR may be either +integer or floating-point, and the result is returned in the same form. +.TP +\fBdouble(\fIarg\fB)\fR +If \fIarg\fR is a floating value, returns \fIarg\fR, otherwise converts +\fIarg\fR to floating and returns the converted value. +.TP +\fBint(\fIarg\fB)\fR +If \fIarg\fR is an integer value, returns \fIarg\fR, otherwise converts +\fIarg\fR to integer by truncation and returns the converted value. +.TP +\fBround(\fIarg\fB)\fR +If \fIarg\fR is an integer value, returns \fIarg\fR, otherwise converts +\fIarg\fR to integer by rounding and returns the converted value. +.PP +In addition to these predifined functions, applications may +define additional functions using \fBTcl_CreateMathFunc\fR(). +.VE +.SH "TYPES, OVERFLOW, AND PRECISION" +.PP +All internal computations involving integers are done with the C type +\fIlong\fP, and all internal computations involving floating-point are +done with the C type \fIdouble\fP. +When converting a string to floating-point, exponent overflow is +detected and results in a Tcl error. +For conversion to integer from string, detection of overflow depends +on the behavior of some routines in the local C library, so it should +be regarded as unreliable. +In any case, integer overflow and underflow are generally not detected +reliably for intermediate results. Floating-point overflow and underflow +are detected to the degree supported by the hardware, which is generally +pretty reliable. +.PP +Conversion among internal representations for integer, floating-point, +and string operands is done automatically as needed. +For arithmetic computations, integers are used until some +floating-point number is introduced, after which floating-point is used. +For example, +.DS +\fBexpr 5 / 4\fR +.DE +returns 1, while +.DS +\fBexpr 5 / 4.0\fR +\fBexpr 5 / ( [string length "abcd"] + 0.0 ) +.DE +both return 1.25. +.VS +Floating-point values are always returned with a ``.'' +or an ``e'' so that they will not look like integer values. For +example, +.DS +\fBexpr 20.0/5.0\fR +.DE +returns ``4.0'', not ``4''. The global variable \fBtcl_precision\fR +determines the the number of significant digits that are retained +when floating values are converted to strings (except that trailing +zeroes are omitted). If \fBtcl_precision\fR +is unset then 6 digits of precision are used. +To retain all of the significant bits of an IEEE floating-point +number set \fBtcl_precision\fR to 17; if a value is converted to +string with 17 digits of precision and then converted back to binary +for some later calculation, the resulting binary value is guaranteed +to be identical to the original one. +.VE + +.SH "STRING OPERATIONS" +.PP +String values may be used as operands of the comparison operators, +although the expression evaluator tries to do comparisons as integer +or floating-point when it can. +If one of the operands of a comparison is a string and the other +has a numeric value, the numeric operand is converted back to +a string using the C \fIsprintf\fP format specifier +\fB%d\fR for integers and \fB%g\fR for floating-point values. +For example, the commands +.DS +\fBexpr {"0x03" > "2"}\fR +\fBexpr {"0y" < "0x12"}\fR +.DE +both return 1. The first comparison is done using integer +comparison, and the second is done using string comparison after +the second operand is converted to the string ``18''. + +.SH KEYWORDS +arithmetic, boolean, compare, expression diff --git a/vendor/x11iraf/obm/Tcl/doc/file.n b/vendor/x11iraf/obm/Tcl/doc/file.n new file mode 100644 index 00000000..2423daea --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/file.n @@ -0,0 +1,146 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/file.n,v 1.1 93/05/03 17:09:38 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS file tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +file \- Manipulate file names and attributes +.SH SYNOPSIS +\fBfile \fIoption\fR \fIname\fR ?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command provides several operations on a file's name or attributes. +\fIName\fR is the name of a file; +if it starts with a tilde, then tilde substitution is done before +executing the command (see the manual entry for \fBTcl_TildeSubst\fR +for details). +\fIOption\fR indicates what to do with the file name. Any unique +abbreviation for \fIoption\fR is acceptable. The valid options are: +.TP +\fBfile \fBatime \fIname\fR +Returns a decimal string giving the time at which file \fIname\fR +was last accessed. The time is measured in the standard POSIX +fashion as seconds from a fixed starting time (often January 1, 1970). +If the file doesn't exist or its access time cannot be queried then an +error is generated. +.TP +\fBfile \fBdirname \fIname\fR +Returns all of the characters in \fIname\fR up to but not including +the last slash character. If there are no slashes in \fIname\fR +then returns ``.''. If the last slash in \fIname\fR is its first +character, then return ``/''. +.TP +\fBfile \fBexecutable \fIname\fR +Returns \fB1\fR if file \fIname\fR is executable by +the current user, \fB0\fR otherwise. +.TP +\fBfile \fBexists \fIname\fR +Returns \fB1\fR if file \fIname\fR exists and the current user has +search privileges for the directories leading to it, \fB0\fR otherwise. +.TP +\fBfile \fBextension \fIname\fR +Returns all of the characters in \fIname\fR after and including the +last dot in \fIname\fR. If there is no dot in \fIname\fR then returns +the empty string. +.TP +\fBfile \fBisdirectory \fIname\fR +Returns \fB1\fR if file \fIname\fR is a directory, +\fB0\fR otherwise. +.TP +\fBfile \fBisfile \fIname\fR +Returns \fB1\fR if file \fIname\fR is a regular file, +\fB0\fR otherwise. +.TP +\fBfile lstat \fIname varName\fR +Same as \fBstat\fR option (see below) except uses the \fIlstat\fR +kernel call instead of \fIstat\fR. This means that if \fIname\fR +refers to a symbolic link the information returned in \fIvarName\fR +is for the link rather than the file it refers to. On systems that +don't support symbolic links this option behaves exactly the same +as the \fBstat\fR option. +.TP +\fBfile \fBmtime \fIname\fR +Returns a decimal string giving the time at which file \fIname\fR +was last modified. The time is measured in the standard POSIX +fashion as seconds from a fixed starting time (often January 1, 1970). +If the file doesn't exist or its modified time cannot be queried then an +error is generated. +.TP +\fBfile \fBowned \fIname\fR +Returns \fB1\fR if file \fIname\fR is owned by the current user, +\fB0\fR otherwise. +.TP +\fBfile \fBreadable \fIname\fR +Returns \fB1\fR if file \fIname\fR is readable by +the current user, \fB0\fR otherwise. +.TP +\fBfile readlink \fIname\fR +Returns the value of the symbolic link given by \fIname\fR (i.e. the +name of the file it points to). If +\fIname\fR isn't a symbolic link or its value cannot be read, then +an error is returned. On systems that don't support symbolic links +this option is undefined. +.TP +\fBfile \fBrootname \fIname\fR +Returns all of the characters in \fIname\fR up to but not including +the last ``.'' character in the name. If \fIname\fR doesn't contain +a dot, then returns \fIname\fR. +.TP +\fBfile \fBsize \fIname\fR +Returns a decimal string giving the size of file \fIname\fR in bytes. +If the file doesn't exist or its size cannot be queried then an +error is generated. +.TP +\fBfile \fBstat \fIname varName\fR +Invokes the \fBstat\fR kernel call on \fIname\fR, and uses the +variable given by \fIvarName\fR to hold information returned from +the kernel call. +\fIVarName\fR is treated as an array variable, +and the following elements of that variable are set: \fBatime\fR, +\fBctime\fR, \fBdev\fR, \fBgid\fR, \fBino\fR, \fBmode\fR, \fBmtime\fR, +\fBnlink\fR, \fBsize\fR, \fBtype\fR, \fBuid\fR. +Each element except \fBtype\fR is a decimal string with the value of +the corresponding field from the \fBstat\fR return structure; see the +manual entry for \fBstat\fR for details on the meanings of the values. +The \fBtype\fR element gives the type of the file in the same form +returned by the command \fBfile type\fR. +This command returns an empty string. +.TP +\fBfile \fBtail \fIname\fR +Returns all of the characters in \fIname\fR after the last slash. +If \fIname\fR contains no slashes then returns \fIname\fR. +.TP +\fBfile \fBtype \fIname\fR +Returns a string giving the type of file \fIname\fR, which will be +one of \fBfile\fR, \fBdirectory\fR, \fBcharacterSpecial\fR, +\fBblockSpecial\fR, \fBfifo\fR, \fBlink\fR, or \fBsocket\fR. +.TP +\fBfile \fBwritable \fIname\fR +Returns \fB1\fR if file \fIname\fR is writable by +the current user, \fB0\fR otherwise. + +.SH KEYWORDS +attributes, directory, file, name, stat diff --git a/vendor/x11iraf/obm/Tcl/doc/flush.n b/vendor/x11iraf/obm/Tcl/doc/flush.n new file mode 100644 index 00000000..bc668349 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/flush.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/flush.n,v 1.1 93/05/03 17:09:40 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS flush tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +flush \- Flush buffered output for a file +.SH SYNOPSIS +\fBflush \fIfileId\fR +.BE + +.SH DESCRIPTION +.PP +Flushes any output that has been buffered for \fIfileId\fR. +\fIFileId\fR must have been the return +value from a previous call to \fBopen\fR, or it may be +\fBstdout\fR or \fBstderr\fR to access one of the standard I/O streams; +it must refer to a file that was opened for writing. +The command returns an empty string. + +.SH KEYWORDS +buffer, file, flush, output diff --git a/vendor/x11iraf/obm/Tcl/doc/for.n b/vendor/x11iraf/obm/Tcl/doc/for.n new file mode 100644 index 00000000..45915c6c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/for.n @@ -0,0 +1,57 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/for.n,v 1.1 93/05/03 17:09:41 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS for tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +for \- ``For'' loop +.SH SYNOPSIS +\fBfor \fIstart test next body\fR +.BE + +.SH DESCRIPTION +.PP +\fBFor\fR is a looping command, similar in structure to the C +\fBfor\fR statement. The \fIstart\fR, \fInext\fR, and +\fIbody\fR arguments must be Tcl command strings, and \fItest\fR +is an expression string. +The \fBfor\fR command first invokes the Tcl interpreter to +execute \fIstart\fR. Then it repeatedly evaluates \fItest\fR as +an expression; if the result is non-zero it invokes the Tcl +interpreter on \fIbody\fR, then invokes the Tcl interpreter on \fInext\fR, +then repeats the loop. The command terminates when \fItest\fR evaluates +to 0. If a \fBcontinue\fR command is invoked within \fIbody\fR then +any remaining commands in the current execution of \fIbody\fR are skipped; +processing continues by invoking the Tcl interpreter on \fInext\fR, then +evaluating \fItest\fR, and so on. If a \fBbreak\fR command is invoked +within \fIbody\fR +or \fInext\fR, +then the \fBfor\fR command will +return immediately. +The operation of \fBbreak\fR and \fBcontinue\fR are similar to the +corresponding statements in C. +\fBFor\fR returns an empty string. + +.SH KEYWORDS +for, iteration, looping diff --git a/vendor/x11iraf/obm/Tcl/doc/foreach.n b/vendor/x11iraf/obm/Tcl/doc/foreach.n new file mode 100644 index 00000000..63fe0063 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/foreach.n @@ -0,0 +1,47 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/foreach.n,v 1.1 93/05/03 17:09:42 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS foreach tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +foreach \- Iterate over all elements in a list +.SH SYNOPSIS +\fBforeach \fIvarname list body\fR +.BE + +.SH DESCRIPTION +.PP +In this command \fIvarname\fR is the name of a variable, \fIlist\fR +is a list of values to assign to \fIvarname\fR, and \fIbody\fR is a +Tcl script. +For each element of \fIlist\fR (in order +from left to right), \fBforeach\fR assigns the contents of the +field to \fIvarname\fR as if the \fBlindex\fR command had been used +to extract the field, then calls the Tcl interpreter to execute +\fIbody\fR. The \fBbreak\fR and \fBcontinue\fR statements may be +invoked inside \fIbody\fR, with the same effect as in the \fBfor\fR +command. \fBForeach\fR returns an empty string. + +.SH KEYWORDS +foreach, iteration, list, looping diff --git a/vendor/x11iraf/obm/Tcl/doc/format.n b/vendor/x11iraf/obm/Tcl/doc/format.n new file mode 100644 index 00000000..69f66d2d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/format.n @@ -0,0 +1,233 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/format.n,v 1.4 93/08/05 13:56:19 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS format tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +format \- Format a string in the style of sprintf +.SH SYNOPSIS +\fBformat \fIformatString \fR?\fIarg arg ...\fR? +.BE + +.SH INTRODUCTION +.PP +This command generates a formatted string in the same way as the +ANSI C \fBsprintf\fR procedure (it uses \fBsprintf\fR in its +implementation). +\fIFormatString\fR indicates how to format the result, using +\fB%\fR conversion specifiers as in \fBsprintf\fR, and the additional +arguments, if any, provide values to be substituted into the result. +The return value from \fBformat\fR is the formatted string. + +.SH "DETAILS ON FORMATTING" +.PP +The command operates by scanning \fIformatString\fR from left to right. +Each character from the format string is appended to the result +string unless it is a percent sign. +If the character is a \fB%\fR then it is not copied to the result string. +Instead, the characters following the \fB%\fR character are treated as +a conversion specifier. +The conversion specifier controls the conversion of the next successive +\fIarg\fR to a particular format and the result is appended to +the result string in place of the conversion specifier. +If there are multiple conversion specifiers in the format string, +then each one controls the conversion of one additional \fIarg\fR. +The \fBformat\fR command must be given enough \fIarg\fRs to meet the needs +of all of the conversion specifiers in \fIformatString\fR. +.PP +Each conversion specifier may contain up to six different parts: +.VS +an XPG3 position specifier, +.VE +a set of flags, a minimum field width, a precision, a length modifier, +and a conversion character. +Any of these fields may be omitted except for the conversion character. +The fields that are present must appear in the order given above. +The paragraphs below discuss each of these fields in turn. +.PP +.VS +If the \fB%\fR is followed by a decimal number and a \fB$\fR, as in +``\fB%2$d\fR'', then the value to convert is not taken from the +next sequential argument. +Instead, it is taken from the argument indicated by the number, +where 1 corresponds to the first \fIarg\fR. +If the conversion specifier requires multiple arguments because +of \fB*\fR characters in the specifier then +successive arguments are used, starting with the argument +given by the number. +This follows the XPG3 conventions for positional specifiers. +If there are any positional specifiers in \fIformatString\fR +then all of the specifiers must be positional. +.VE +.PP +The second portion of a conversion specifier may contain any of the +following flag characters, in any order: +.TP 10 +\fB\-\fR +Specifies that the converted argument should be left-justified +in its field (numbers are normally right-justified with leading +spaces if needed). +.TP 10 +\fB+\fR +Specifies that a number should always be printed with a sign, +even if positive. +.TP 10 +\fIspace\fR +Specifies that a space should be added to the beginning of the +number if the first character isn't a sign. +.TP 10 +\fB0\fR +Specifies that the number should be padded on the left with +zeroes instead of spaces. +.TP 10 +\fB#\fR +Requests an alternate output form. For \fBo\fR and \fBO\fR +conversions it guarantees that the first digit is always \fB0\fR. +For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) +will be added to the beginning of the result unless it is zero. +For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, +\fBg\fR, and \fBG\fR) it guarantees that the result always +has a decimal point. +For \fBg\fR and \fBG\fR conversions it specifies that +trailing zeroes should not be removed. +.PP +The third portion of a conversion specifier is a number giving a +minimum field width for this conversion. +It is typically used to make columns line up in tabular printouts. +If the converted argument contains fewer characters than the +minimum field width then it will be padded so that it is as wide +as the minimum field width. +Padding normally occurs by adding extra spaces on the left of the +converted argument, but the \fB0\fR and \fB\-\fR flags +may be used to specify padding with zeroes on the left or with +spaces on the right, respectively. +If the minimum field width is specified as \fB*\fR rather than +a number, then the next argument to the \fBformat\fR command +determines the minimum field width; it must be a numeric string. +.PP +The fourth portion of a conversion specifier is a precision, +which consists of a period followed by a number. +The number is used in different ways for different conversions. +For \fBe\fR, \fBE\fR, and \fBf\fR conversions it specifies the number +of digits to appear to the right of the decimal point. +For \fBg\fR and \fBG\fR conversions it specifies the total number +of digits to appear, including those on both sides of the decimal +point (however, trailing zeroes after the decimal point will still +be omitted unless the \fB#\fR flag has been specified). +For integer conversions, it specifies a mimimum number of digits +to print (leading zeroes will be added if necessary). +For \fBs\fR conversions it specifies the maximum number of characters to be +printed; if the string is longer than this then the trailing characters will be dropped. +If the precision is specified with \fB*\fR rather than a number +then the next argument to the \fBformat\fR command determines the precision; +it must be a numeric string. +.PP +The fourth part of a conversion specifier is a length modifier, +which must be \fBh\fR or \fBl\fR. +If it is \fBh\fR it specifies that the numeric value should be +truncated to a 16-bit value before converting. +This option is rarely useful. +The \fBl\fR modifier is ignored. +.PP +The last thing in a conversion specifier is an alphabetic character +that determines what kind of conversion to perform. +The following conversion characters are currently supported: +.TP 10 +\fBd\fR +Convert integer to signed decimal string. +.TP 10 +\fBu\fR +Convert integer to unsigned decimal string. +.TP 10 +\fBi\fR +Convert integer to signed decimal string; the integer may either be +in decimal, in octal (with a leading \fB0\fR) or in hexadecimal +(with a leading \fB0x\fR). +.TP 10 +\fBo\fR +Convert integer to unsigned octal string. +.TP 10 +\fBx\fR or \fBX\fR +Convert integer to unsigned hexadecimal string, using digits +``0123456789abcdef'' for \fBx\fR and ``0123456789ABCDEF'' for \fBX\fR). +.TP 10 +\fBc\fR +Convert integer to the 8-bit character it represents. +.TP 10 +\fBs\fR +No conversion; just insert string. +.TP 10 +\fBf\fR +Convert floating-point number to signed decimal string of +the form \fIxx.yyy\fR, where the number of \fIy\fR's is determined by +the precision (default: 6). +If the precision is 0 then no decimal point is output. +.TP 10 +\fBe\fR or \fBe\fR +Convert floating-point number to scientific notation in the +form \fIx.yyy\fBe\(+-\fIzz\fR, where the number of \fIy\fR's is determined +by the precision (default: 6). +If the precision is 0 then no decimal point is output. +If the \fBE\fR form is used then \fBE\fR is +printed instead of \fBe\fR. +.TP 10 +\fBg\fR or \fBG\fR +If the exponent is less than \-4 or greater than or equal to the +precision, then convert floating-point number as for \fB%e\fR or +\fB%E\fR. +Otherwise convert as for \fB%f\fR. +Trailing zeroes and a trailing decimal point are omitted. +.TP 10 +\fB%\fR +No conversion: just insert \fB%\fR. +.LP +For the numerical conversions the argument being converted must +be an integer or floating-point string; format converts the argument +to binary and then converts it back to a string according to +the conversion specifier. + +.SH "DIFFERENCES FROM ANSI SPRINTF" +.PP +.VS +The behavior of the format command is the same as the +ANSI C \fBsprintf\fR procedure except for the following +differences: +.IP [1] +\fB%p\fR and \fB%n\fR specifiers are not currently supported. +.VE +.IP [2] +For \fB%c\fR conversions the argument must be a decimal string, +which will then be converted to the corresponding character value. +.IP [3] +.VS +The \fBl\fR modifier is ignored; integer values are always converted +as if there were no modifier present and real values are always +converted as if the \fBl\fR modifier were present (i.e. type +\fBdouble\fR is used for the internal representation). +If the \fBh\fR modifier is specified then integer values are truncated +to \fBshort\fR before conversion. +.VE + +.SH KEYWORDS +conversion specifier, format, sprintf, string, substitution diff --git a/vendor/x11iraf/obm/Tcl/doc/gets.n b/vendor/x11iraf/obm/Tcl/doc/gets.n new file mode 100644 index 00000000..da0bd3a0 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/gets.n @@ -0,0 +1,61 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/gets.n,v 1.2 93/10/04 16:01:09 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS gets tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +gets \- Read a line from a file +.SH SYNOPSIS +\fBgets \fIfileId\fR ?\fIvarName\fR? +.BE + +.SH DESCRIPTION +.PP +This command reads the next line from the file given by \fIfileId\fR +and discards the terminating newline character. +If \fIvarName\fR is specified then the line is placed in the variable +by that name and the return value is a count of the number of characters +read (not including the newline). +If the end of the file is reached before reading +any characters then \-1 is returned and \fIvarName\fR is set to an +empty string. +If \fIvarName\fR is not specified then the return value will be +the line (minus the newline character) or an empty string if +the end of the file is reached before reading any characters. +An empty string will also be returned if a line contains no characters +except the newline, so \fBeof\fR may have to be used to determine +what really happened. +If the last character in the file is not a newline character then +\fBgets\fR behaves as if there were an additional newline character +at the end of the file. +\fIFileId\fR must be \fBstdin\fR or the return value from a previous +call to \fBopen\fR; it must refer to a file that was opened +for reading. +.VS +Any existing end-of-file or error condition on the file is cleared at +the beginning of the \fBgets\fR command. +.VE + +.SH KEYWORDS +file, line, read diff --git a/vendor/x11iraf/obm/Tcl/doc/glob.n b/vendor/x11iraf/obm/Tcl/doc/glob.n new file mode 100644 index 00000000..3b358e2d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/glob.n @@ -0,0 +1,92 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/glob.n,v 1.3 93/06/17 15:50:54 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS glob tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +glob \- Return names of files that match patterns +.SH SYNOPSIS +\fBglob \fR?\fIswitches\fR? \fIpattern \fR?\fIpattern ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command performs file name ``globbing'' in a fashion similar to +the csh shell. It returns a list of the files whose names match any +of the \fIpattern\fR arguments. +.LP +If the initial arguments to \fBglob\fR start with \fB\-\fR then +.VS +they are treated as switches. The following switches are +currently supported: +.TP 15 +\fB\-nocomplain\fR +Allows an empty list to be returned without error; without this +switch an error is returned if the result list would be empty. +.TP 15 +\fB\-\|\-\fR +Marks the end of switches. The argument following this one will +be treated as a \fIpattern\fR even if it starts with a \fB\-. +.VE +.PP +The \fIpattern\fR arguments may contain any of the following +special characters: +.TP 10 +\fB?\fR +Matches any single character. +.TP 10 +\fB*\fR +Matches any sequence of zero or more characters. +.TP 10 +\fB[\fIchars\fB]\fR +Matches any single character in \fIchars\fR. If \fIchars\fR +contains a sequence of the form \fIa\fB\-\fIb\fR then any +character between \fIa\fR and \fIb\fR (inclusive) will match. +.TP 10 +\fB\e\fIx\fR +Matches the character \fIx\fR. +.TP 10 +\fB{\fIa\fB,\fIb\fB,\fI...\fR} +Matches any of the strings \fIa\fR, \fIb\fR, etc. +.LP +As with csh, a ``.'' at the beginning of a file's name or just +after a ``/'' must be matched explicitly or with a {} construct. +In addition, all ``/'' characters must be matched explicitly. +.LP +If the first character in a \fIpattern\fR is ``~'' then it refers +to the home directory for the user whose name follows the ``~''. +If the ``~'' is followed immediately by ``/'' then the value of +the HOME environment variable is used. +.LP +The \fBglob\fR command differs from csh globbing in two ways. +First, it does not sort its result list (use the \fBlsort\fR +command if you want the list sorted). +.VS +Second, \fBglob\fR only returns the names of files that actually +exist; in csh no check for existence is made unless a pattern +contains a ?, *, or [] construct. +.VE + +.SH KEYWORDS +exist, file, glob, pattern diff --git a/vendor/x11iraf/obm/Tcl/doc/global.n b/vendor/x11iraf/obm/Tcl/doc/global.n new file mode 100644 index 00000000..4f7d7bd6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/global.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/global.n,v 1.1 93/05/03 17:09:46 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS global tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +global \- Access global variables +.SH SYNOPSIS +\fBglobal \fIvarname \fR?\fIvarname ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command is ignored unless a Tcl procedure is being interpreted. +If so then it declares the given \fIvarname\fR's to be global variables +rather than local ones. For the duration of the current procedure +(and only while executing in the current procedure), any reference to +any of the \fIvarname\fRs will refer to the global variable by the same +name. + +.SH KEYWORDS +global, procedure, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/history.n b/vendor/x11iraf/obm/Tcl/doc/history.n new file mode 100644 index 00000000..933b51b6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/history.n @@ -0,0 +1,181 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/history.n,v 1.1 93/05/03 17:09:47 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS history tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +history \- Manipulate the history list +.SH SYNOPSIS +\fBhistory \fR?\fIoption\fR? ?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +The \fBhistory\fR command performs one of several operations related to +recently-executed commands recorded in a history list. Each of +these recorded commands is referred to as an ``event''. When +specifying an event to the \fBhistory\fR command, the following +forms may be used: +.IP [1] +A number: if positive, it refers to the event with +that number (all events are numbered starting at 1). If the number +is negative, it selects an event relative to the current event +(\fB\-1\fR refers to the previous event, \fB\-2\fR to the one before that, and +so on). +.IP [2] +A string: selects the most recent event that matches the string. +An event is considered to match the string either if the string is +the same as the first characters of the event, or if the string +matches the event in the sense of the \fBstring match\fR command. +.LP +The \fBhistory\fR command can take any of the following forms: +.TP +\fBhistory\fR +Same +as \fBhistory info\fR, described below. +.TP +\fBhistory add\fI command \fR?\fBexec\fR? +Adds the \fIcommand\fR argument to the history list as a new event. If +\fBexec\fR is specified (or abbreviated) then the command is also +executed and its result is returned. If \fBexec\fR isn't specified +then an empty string is returned as result. +.TP +\fBhistory change\fI newValue\fR ?\fIevent\fR? +Replaces the value recorded for an event with \fInewValue\fR. \fIEvent\fR +specifies the event to replace, and +defaults to the \fIcurrent\fR event (not event \fB\-1\fR). This command +is intended for use in commands that implement new forms of history +substitution and wish to replace the current event (which invokes the +substitution) with the command created through substitution. The return +value is an empty string. +.TP +\fBhistory event\fR ?\fIevent\fR? +Returns the value of the event given by \fIevent\fR. \fIEvent\fR +defaults to \fB\-1\fR. This command causes history revision to occur: +see below for details. +.TP +\fBhistory info \fR?\fIcount\fR? +Returns a formatted string (intended for humans to read) giving +the event number and contents for each of the events in the history +list except the current event. If \fIcount\fR is specified +then only the most recent \fIcount\fR events are returned. +.TP +\fBhistory keep \fIcount\fR +This command may be used to change the size of the history list to +\fIcount\fR events. Initially, 20 events are retained in the history +list. This command returns an empty string. +.TP +\fBhistory nextid\fR +Returns the number of the next event to be recorded +in the history list. It is useful for things like printing the +event number in command-line prompts. +.TP +\fBhistory redo \fR?\fIevent\fR? +Re-executes the command indicated by \fIevent\fR and return its result. +\fIEvent\fR defaults to \fB\-1\fR. This command results in history +revision: see below for details. +.TP +\fBhistory substitute \fIold new \fR?\fIevent\fR? +Retrieves the command given by \fIevent\fR +(\fB\-1\fR by default), replace any occurrences of \fIold\fR by +\fInew\fR in the command (only simple character equality is supported; +no wild cards), execute the resulting command, and return the result +of that execution. This command results in history +revision: see below for details. +.TP +\fBhistory words \fIselector\fR ?\fIevent\fR? +Retrieves from the command given by \fIevent\fR (\fB\-1\fR by default) +the words given by \fIselector\fR, and return those words in a string +separated by spaces. The \fBselector\fR argument has three forms. +If it is a single number then it selects the word given by that +number (\fB0\fR for the command name, \fB1\fR for its first argument, +and so on). If it consists of two numbers separated by a dash, +then it selects all the arguments between those two. Otherwise +\fBselector\fR is treated as a pattern; all words matching that +pattern (in the sense of \fBstring match\fR) are returned. In +the numeric forms \fB$\fR may be used +to select the last word of a command. +For example, suppose the most recent command in the history list is +.RS +.DS +\fBformat {%s is %d years old} Alice [expr $ageInMonths/12]\fR +.DE +Below are some history commands and the results they would produce: +.DS +.ta 4c +.fi +.UL Command " " +.UL Result +.nf + +\fBhistory words $ [expr $ageInMonths/12]\fR +\fBhistory words 1-2 {%s is %d years old} Alice\fR +\fBhistory words *a*o* {%s is %d years old} [expr $ageInMonths/12]\fR +.DE +\fBHistory words\fR results in history revision: see below for details. +.RE +.SH "HISTORY REVISION" +.PP +The history options \fBevent\fR, \fBredo\fR, \fBsubstitute\fR, +and \fBwords\fR result in ``history revision''. +When one of these options is invoked then the current event +is modified to eliminate the history command and replace it with +the result of the history command. +For example, suppose that the most recent command in the history +list is +.DS +\fBset a [expr $b+2]\fR +.DE +and suppose that the next command invoked is one of the ones on +the left side of the table below. The command actually recorded in +the history event will be the corresponding one on the right side +of the table. +.ne 1.5c +.DS +.ta 4c +.fi +.UL "Command Typed" " " +.UL "Command Recorded" +.nf + +\fBhistory redo set a [expr $b+2]\fR +\fBhistory s a b set b [expr $b+2]\fR +\fBset c [history w 2] set c [expr $b+2]\fR +.DE +History revision is needed because event specifiers like \fB\-1\fR +are only valid at a particular time: once more events have been +added to the history list a different event specifier would be +needed. +History revision occurs even when \fBhistory\fR is invoked +indirectly from the current event (e.g. a user types a command +that invokes a Tcl procedure that invokes \fBhistory\fR): the +top-level command whose execution eventually resulted in a +\fBhistory\fR command is replaced. +If you wish to invoke commands like \fBhistory words\fR without +history revision, you can use \fBhistory event\fR to save the +current history event and then use \fBhistory change\fR to +restore it later. + +.SH KEYWORDS +event, history, record, revision diff --git a/vendor/x11iraf/obm/Tcl/doc/if.n b/vendor/x11iraf/obm/Tcl/doc/if.n new file mode 100644 index 00000000..d15b90a5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/if.n @@ -0,0 +1,58 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/if.n,v 1.1 93/05/03 17:34:01 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS if tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +if \- Execute scripts conditionally +.SH SYNOPSIS +\fBif \fIexpr1 \fR?\fBthen\fR? \fIbody1 \fBelseif \fIexpr2 \fR?\fBthen\fR? \fIbody2\fR \fBelseif\fR ... \fR?\fBelse\fR? ?\fIbodyN\fR? +.BE + +.SH DESCRIPTION +.PP +The \fIif\fR command evaluates \fIexpr1\fR as an expression (in the +same way that \fBexpr\fR evaluates its argument). The value of the +expression must be a boolean +.VS +(a numeric value, where 0 is false and +anything is true, or a string value such as \fBtrue\fR or \fByes\fR +for true and \fBfalse\fR or \fBno\fR for false); +.VE +if it is true then \fIbody1\fR is executed by passing it to the +Tcl interpreter. +Otherwise \fIexpr2\fR is evaluated as an expression and if it is true +then \fBbody2\fR is executed, and so on. +If none of the expressions evaluates to true then \fIbodyN\fR is +executed. +The \fBthen\fR and \fBelse\fR arguments are optional +``noise words'' to make the command easier to read. +There may be any number of \fBelseif\fR clauses, including zero. +\fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too. +The return value from the command is the result of the body script +that was executed, or an empty string +if none of the expressions was non-zero and there was no \fIbodyN\fR. + +.SH KEYWORDS +boolean, conditional, else, false, if, true diff --git a/vendor/x11iraf/obm/Tcl/doc/incr.n b/vendor/x11iraf/obm/Tcl/doc/incr.n new file mode 100644 index 00000000..a5340105 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/incr.n @@ -0,0 +1,44 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/incr.n,v 1.1 93/05/03 17:34:02 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS incr tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +incr \- Increment the value of a variable +.SH SYNOPSIS +\fBincr \fIvarName \fR?\fIincrement\fR? +.BE + +.SH DESCRIPTION +.PP +Increments the value stored in the variable whose name is \fIvarName\fR. +The value of the variable must be an integer. +If \fIincrement\fR is supplied then its value (which must be an +integer) is added to the value of variable \fIvarName\fR; otherwise +1 is added to \fIvarName\fR. +The new value is stored as a decimal string in variable \fIvarName\fR +and also returned as result. + +.SH KEYWORDS +add, increment, variable, value diff --git a/vendor/x11iraf/obm/Tcl/doc/info.n b/vendor/x11iraf/obm/Tcl/doc/info.n new file mode 100644 index 00000000..2806aa4a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/info.n @@ -0,0 +1,162 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/info.n,v 1.2 93/06/18 13:58:33 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS info tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +info \- Return information about the state of the Tcl interpreter +.SH SYNOPSIS +\fBinfo \fIoption \fR?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command provides information about various internals of the Tcl +interpreter. +The legal \fIoption\fR's (which may be abbreviated) are: +.TP +\fBinfo args \fIprocname\fR +Returns a list containing the names of the arguments to procedure +\fIprocname\fR, in order. \fIProcname\fR must be the name of a +Tcl command procedure. +.TP +\fBinfo body \fIprocname\fR +Returns the body of procedure \fIprocname\fR. \fIProcname\fR must be +the name of a Tcl command procedure. +.TP +\fBinfo cmdcount\fR +Returns a count of the total number of commands that have been invoked +in this interpreter. +.TP +\fBinfo commands \fR?\fIpattern\fR? +If \fIpattern\fR isn't specified, returns a list of names of all the +Tcl commands, including both the built-in commands written in C and +the command procedures defined using the \fBproc\fR command. +If \fIpattern\fR is specified, only those names matching \fIpattern\fR +are returned. Matching is determined using the same rules as for +\fBstring match\fR. +.TP +\fBinfo complete \fIcommand\fR +Returns 1 if \fIcommand\fR is a complete Tcl command in the sense of +having no unclosed quotes, braces, brackets or array element names, +If the command doesn't appear to be complete then 0 is returned. +This command is typically used in line-oriented input environments +to allow users to type in commands that span multiple lines; if the +command isn't complete, the script can delay evaluating it until additional +lines have been typed to complete the command. +.TP +\fBinfo default \fIprocname arg varname\fR +\fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fR +must be the name of an argument to that procedure. If \fIarg\fR +doesn't have a default value then the command returns \fB0\fR. +Otherwise it returns \fB1\fR and places the default value of \fIarg\fR +into variable \fIvarname\fR. +.TP +\fBinfo exists \fIvarName\fR +Returns \fB1\fR if the variable named \fIvarName\fR exists in the +current context (either as a global or local variable), returns \fB0\fR +otherwise. +.TP +\fBinfo globals \fR?\fIpattern\fR? +If \fIpattern\fR isn't specified, returns a list of all the names +of currently-defined global variables. +If \fIpattern\fR is specified, only those names matching \fIpattern\fR +are returned. Matching is determined using the same rules as for +\fBstring match\fR. +.TP +\fBinfo level\fR ?\fInumber\fR? +If \fInumber\fR is not specified, this command returns a number +giving the stack level of the invoking procedure, or 0 if the +command is invoked at top-level. If \fInumber\fR is specified, +then the result is a list consisting of the name and arguments for the +procedure call at level \fInumber\fR on the stack. If \fInumber\fR +is positive then it selects a particular stack level (1 refers +to the top-most active procedure, 2 to the procedure it called, and +so on); otherwise it gives a level relative to the current level +(0 refers to the current procedure, -1 to its caller, and so on). +See the \fBuplevel\fR command for more information on what stack +levels mean. +.TP +\fBinfo library\fR +Returns the name of the library directory in which standard Tcl +scripts are stored. +The default value for the library is compiled into Tcl, but it +may be overridden by setting the TCL_LIBRARY environment variable. +If there is no TCL_LIBRARY variable and no compiled-in value then +and error is generated. +See the \fBlibrary\fR manual entry for details of the facilities +provided by the Tcl script library. +Normally each application will have its own application-specific +script library in addition to the Tcl script library; I suggest that +each application set a global variable with a name like +\fB$\fIapp\fB_library\fR (where \fIapp\fR is the application's name) +to hold the location of that application's library directory. +.TP +\fBinfo locals \fR?\fIpattern\fR? +If \fIpattern\fR isn't specified, returns a list of all the names +of currently-defined local variables, including arguments to the +current procedure, if any. +Variables defined with the \fBglobal\fR and \fBupvar\fR commands +will not be returned. +If \fIpattern\fR is specified, only those names matching \fIpattern\fR +are returned. Matching is determined using the same rules as for +\fBstring match\fR. +.TP +\fBinfo patchlevel\fR +.VS +Returns a decimal integer giving the current patch level for Tcl. +The patch level is incremented for each new release or patch, and +it uniquely identifies an official version of Tcl. +.VE +.TP +\fBinfo procs \fR?\fIpattern\fR? +If \fIpattern\fR isn't specified, returns a list of all the +names of Tcl command procedures. +If \fIpattern\fR is specified, only those names matching \fIpattern\fR +are returned. Matching is determined using the same rules as for +\fBstring match\fR. +.TP +\fBinfo script\fR +If a Tcl script file is currently being evaluated (i.e. there is a +call to \fBTcl_EvalFile\fR active or there is an active invocation +of the \fBsource\fR command), then this command returns the name +of the innermost file being processed. Otherwise the command returns an +empty string. +.TP +\fBinfo tclversion\fR +Returns the version number for this version of Tcl in the form \fIx.y\fR, +where changes to \fIx\fR represent major changes with probable +incompatibilities and changes to \fIy\fR represent small enhancements and +bug fixes that retain backward compatibility. +.TP +\fBinfo vars\fR ?\fIpattern\fR? +If \fIpattern\fR isn't specified, +returns a list of all the names of currently-visible variables, including +both locals and currently-visible globals. +If \fIpattern\fR is specified, only those names matching \fIpattern\fR +are returned. Matching is determined using the same rules as for +\fBstring match\fR. + +.SH KEYWORDS +command, information, interpreter, level, procedure, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/join.n b/vendor/x11iraf/obm/Tcl/doc/join.n new file mode 100644 index 00000000..d98b0c77 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/join.n @@ -0,0 +1,42 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/join.n,v 1.1 93/05/03 17:34:03 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS join tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +join \- Create a string by joining together list elements +.SH SYNOPSIS +\fBjoin \fIlist \fR?\fIjoinString\fR? +.BE + +.SH DESCRIPTION +.PP +The \fIlist\fR argument must be a valid Tcl list. +This command returns the string +formed by joining all of the elements of \fIlist\fR together with +\fIjoinString\fR separating each adjacent pair of elements. +The \fIjoinString\fR argument defaults to a space character. + +.SH KEYWORDS +element, join, list, separator diff --git a/vendor/x11iraf/obm/Tcl/doc/lappend.n b/vendor/x11iraf/obm/Tcl/doc/lappend.n new file mode 100644 index 00000000..02c6bcc3 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/lappend.n @@ -0,0 +1,48 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/lappend.n,v 1.1 93/05/03 17:34:04 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS lappend tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +lappend \- Append list elements onto a variable +.SH SYNOPSIS +\fBlappend \fIvarName value \fR?\fIvalue value ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command treats the variable given by \fIvarName\fR as a list +and appends each of the \fIvalue\fR arguments to that list as a separate +element, with spaces between elements. +If \fIvarName\fR doesn't exist, it is created as a list with elements +given by the \fIvalue\fR arguments. +\fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs +are appended as list elements rather than raw text. +This command provides a relatively efficient way to build up +large lists. For example, ``\fBlappend a $b\fR'' is much +more efficient than ``\fBset a [concat $a [list $b]]\fR'' when +\fB$a\fR is long. + +.SH KEYWORDS +append, element, list, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/library.n b/vendor/x11iraf/obm/Tcl/doc/library.n new file mode 100644 index 00000000..619ac1f5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/library.n @@ -0,0 +1,239 @@ +'\" +'\" Copyright (c) 1991-1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/library.n,v 1.11 93/08/28 16:05:59 ouster Exp $ SPRITE (Berkeley) +' +.so man.macros +.de UL +\\$1\l'|0\(ul'\\$2 +.. +.HS library tcl +.BS +.SH NAME +library \- standard library of Tcl procedures +.SH SYNOPSIS +.nf +\fBauto_execok \fIcmd\fR +\fBauto_load \fIcmd\fR +\fBauto_mkindex \fIdir pattern pattern ...\fR +\fBauto_reset\fR +\fBparray \fIarrayName\fR +\fBunknown \fIcmd \fR?\fIarg arg ...\fR? +.fi +.BE + +.SH INTRODUCTION +.PP +Tcl includes a library of Tcl procedures for commonly-needed functions. +The procedures defined in the Tcl library are generic ones suitable +for use by many different applications. +The location of the Tcl library is returned by the \fBinfo library\fR +command. +In addition to the Tcl library, each application will normally have +its own library of support procedures as well; the location of this +library is normally given by the value of the \fB$\fIapp\fB_library\fR +global variable, where \fIapp\fR is the name of the application. +For example, the location of the Tk library is kept in the variable +\fB$tk_library\fR. +.PP +To access the procedures in the Tcl library, an application should +source the file \fBinit.tcl\fR in the library, for example with +the Tcl command +.DS +\fBsource [info library]/init.tcl +.DE +This will define the \fBunknown\fR procedure and arrange for the +other procedures to be loaded on-demand using the auto-load +mechanism defined below. + +.SH "COMMAND PROCEDURES" +.PP +The following procedures are provided in the Tcl library: +.TP +\fBauto_execok \fIcmd\fR +Determines whether there is an executable file by the name \fIcmd\fR. +This command examines the directories in the current search path +(given by the PATH enviornment variable) to see if there is an +executable file named \fIcmd\fR in any of those directories. +If so, it returns 1; if not it returns 0. \fBAuto_exec\fR +remembers information about previous searches in an array +named \fBauto_execs\fR; this avoids the path search in +future calls for the same \fIcmd\fR. The command \fBauto_reset\fR +may be used to force \fBauto_execok\fR to forget its cached +information. +.TP +\fBauto_load \fIcmd\fR +This command attempts to load the definition for a Tcl command named +\fIcmd\fR. +To do this, it searches an \fIauto-load path\fR, which is a list of +one or more directories. +The auto-load path is given by the global variable \fB$auto_path\fR +if it exists. +If there is no \fB$auto_path\fR variable, then the TCLLIBPATH environment +variable is used, if it exists. +Otherwise the auto-load path consists of just the Tcl library directory. +Within each directory in the auto-load path there must be a file +\fBtclIndex\fR that describes one +.VS +or more commands defined in that directory +and a script to evaluate to load each of the commands. +The \fBtclIndex\fR file should be generated with the +\fBauto_mkindex\fR command. +If \fIcmd\fR is found in an index file, then the appropriate +script is evaluated to create the command. +.VE +The \fBauto_load\fR command returns 1 if \fIcmd\fR was successfully +created. +The command returns 0 if there was no index entry for \fIcmd\fR +or if the script didn't actually define \fIcmd\fR (e.g. because +index information is out of date). +If an error occurs while processing the script, then that error +is returned. +\fBAuto_load\fR only reads the index information once and saves it +in the array \fBauto_index\fR; future calls to \fBauto_load\fR +check for \fIcmd\fR in the array rather than re-reading the index +files. +The cached index information may be deleted with the command +\fBauto_reset\fR. +This will force the next \fBauto_load\fR command to reload the +index database from disk. +.TP +\fBauto_mkindex \fIdir pattern pattern ...\fR +.VS +Generates an index suitable for use by \fBauto_load\fR. +The command searches \fIdir\fR for all files whose names match +any of the \fIpattern\fR arguments +.VE +(matching is done with the \fBglob\fR command), +generates an index of all the Tcl command +procedures defined in all the matching files, and stores the +index information in a file named \fBtclIndex\fR in \fIdir\fR. +For example, the command +.RS +.DS +\fBauto_mkindex foo *.tcl\fR +.DE +.LP +will read all the \fB.tcl\fR files in subdirectory \fBfoo\fR +and generate a new index file \fBfoo/tclIndex\fR. +.PP +\fBAuto_mkindex\fR parses the Tcl scripts in a relatively +unsophisticated way: if any line contains the word \fBproc\fR +as its first characters then it is assumed to be a procedure +definition and the next word of the line is taken as the +procedure's name. +Procedure definitions that don't appear in this way (e.g. they +have spaces before the \fBproc\fR) will not be indexed. +.RE +.TP +\fBauto_reset\fR +Destroys all the information cached by \fBauto_execok\fR and +\fBauto_load\fR. +This information will be re-read from disk the next time it is +needed. +\fBAuto_reset\fR also deletes any procedures listed in the auto-load +index, so that fresh copies of them will be loaded the next time +that they're used. +.TP +\fBparray \fIarrayName\fR +Prints on standard output the names and values of all the elements +in the array \fIarrayName\fR. +\fBArrayName\fR must be an array accessible to the caller of \fBparray\fR. +It may be either local or global. +.TP +\fBunknown \fIcmd \fR?\fIarg arg ...\fR? +This procedure is invoked automatically by the Tcl interpreter +whenever the name of a command doesn't exist. +The \fBunknown\fR procedure receives as its arguments the +name and arguments of the missing command. +.VS +\fBUnknown\fR first calls \fBauto_load\fR to load the command. +.VE +If this succeeds, then it executes the original command with its +original arguments. +If the auto-load fails then \fBunknown\fR calls \fBauto_execok\fR +to see if there is an executable file by the name \fIcmd\fR. +If so, it invokes the Tcl \fBexec\fR command +with \fIcmd\fR and all the \fIargs\fR as arguments. +If \fIcmd\fR can't be auto-executed, \fBunknown\fR checks to +see if the command was invoked at top-level and outside of any +script. If so, then \fBunknown\fR takes takes two additional steps. +First, it sees if \fIcmd\fR has one of the following three forms: +\fB!!\fR, \fB!\fIevent\fR, or \fB^\fIold\fB^\fInew\fR?\fB^\fR?. +If so, then \fBunknown\fR carries out history substitution +in the same way that \fBcsh\fR would for these constructs. +Second, and last, \fBunknown\fR checks to see if \fIcmd\fR is +a unique abbreviation for an existing Tcl command. +If so, it expands the command name and executes the command with +the original arguments. +If none of the above efforts has been able to execute +the command, \fBunknown\fR generates an error return. +If the global variable \fBauto_noload\fR is defined, then the auto-load +step is skipped. +If the global variable \fBauto_noexec\fR is defined then the +auto-exec step is skipped. +Under normal circumstances the return value from \fBunknown\fR +is the return value from the command that was eventually +executed. + +.SH "VARIABLES" +.PP +The following global variables are defined or used by the procedures in +the Tcl library: +.TP +\fBauto_execs\fR +Used by \fBauto_execok\fR to record information about whether +particular commands exist as executable files. +.TP +\fBauto_index\fR +Used by \fBauto_load\fR to save the index information read from +disk. +.TP +\fBauto_noexec\fR +If set to any value, then \fBunknown\fR will not attempt to auto-exec +any commands. +.TP +\fBauto_noload\fR +If set to any value, then \fBunknown\fR will not attempt to auto-load +any commands. +.TP +\fBauto_path\fR +If set, then it must contain a valid Tcl list giving directories to +search during auto-load operations. +.TP +\fBenv(TCL_LIBRARY)\fR +If set, then it specifies the location of the directory containing +library scripts (the value of this variable will be returned by +the command \fBinfo library\fR). If this variable isn't set then +a default value is used. +.TP +\fBenv(TCLLIBPATH)\fR +If set, then it must contain a valid Tcl list giving directories to +search during auto-load operations. +This variable is only used if \fBauto_path\fR is not defined. +.TP +\fBunknown_active\fR +This variable is set by \fBunknown\fR to indicate that it is active. +It is used to detect errors where \fBunknown\fR recurses on itself +infinitely. +The variable is unset before \fBunknown\fR returns. + +.SH KEYWORDS +auto-exec, auto-load, library, unknown diff --git a/vendor/x11iraf/obm/Tcl/doc/lindex.n b/vendor/x11iraf/obm/Tcl/doc/lindex.n new file mode 100644 index 00000000..60bd0a81 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/lindex.n @@ -0,0 +1,46 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/lindex.n,v 1.1 93/05/03 17:34:05 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS lindex tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +lindex \- Retrieve an element from a list +.SH SYNOPSIS +\fBlindex \fIlist index\fR +.BE + +.SH DESCRIPTION +.PP +This command treats \fIlist\fR as a Tcl list and returns the +\fIindex\fR'th element from it (0 refers to the first element of the list). +In extracting the element, \fIlindex\fR observes the same rules +concerning braces and quotes and backslashes as the Tcl command +interpreter; however, variable +substitution and command substitution do not occur. +If \fIindex\fR is negative or greater than or equal to the number +of elements in \fIvalue\fR, then an empty +string is returned. + +.SH KEYWORDS +element, index, list diff --git a/vendor/x11iraf/obm/Tcl/doc/linsert.n b/vendor/x11iraf/obm/Tcl/doc/linsert.n new file mode 100644 index 00000000..1cb7e5e7 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/linsert.n @@ -0,0 +1,45 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/linsert.n,v 1.1 93/05/03 17:34:05 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS linsert tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +linsert \- Insert elements into a list +.SH SYNOPSIS +\fBlinsert \fIlist index element \fR?\fIelement element ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command produces a new list from \fIlist\fR by inserting all +of the \fIelement\fR arguments just before the \fIindex\fRth +element of \fIlist\fR. Each \fIelement\fR argument will become +a separate element of the new list. If \fIindex\fR is less than +or equal to zero, then the new elements are inserted at the +beginning of the list. If \fIindex\fR is greater than or equal +to the number of elements in the list, then the new elements are +appended to the list. + +.SH KEYWORDS +element, insert, list diff --git a/vendor/x11iraf/obm/Tcl/doc/list.n b/vendor/x11iraf/obm/Tcl/doc/list.n new file mode 100644 index 00000000..40992062 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/list.n @@ -0,0 +1,62 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/list.n,v 1.2 93/10/28 16:19:11 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS list tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +list \- Create a list +.SH SYNOPSIS +.VS +\fBlist \fR?\fIarg arg ...\fR? +.VE +.BE + +.SH DESCRIPTION +.PP +This command returns a list comprised of all the \fIarg\fRs, +.VS +or an empty string if no \fIarg\fRs are specified. +.VE +Braces and backslashes get added as necessary, so that the \fBindex\fR command +may be used on the result to re-extract the original arguments, and also +so that \fBeval\fR may be used to execute the resulting list, with +\fIarg1\fR comprising the command's name and the other \fIarg\fRs comprising +its arguments. \fBList\fR produces slightly different results than +\fBconcat\fR: \fBconcat\fR removes one level of grouping before forming +the list, while \fBlist\fR works directly from the original arguments. +For example, the command +.DS +\fBlist a b {c d e} {f {g h}} +.DE +will return +.DS +\fBa b {c d e} {f {g h}} +.DE +while \fBconcat\fR with the same arguments will return +.DS +\fBa b c d e f {g h}\fR +.DE + +.SH KEYWORDS +element, list diff --git a/vendor/x11iraf/obm/Tcl/doc/llength.n b/vendor/x11iraf/obm/Tcl/doc/llength.n new file mode 100644 index 00000000..aecba66a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/llength.n @@ -0,0 +1,39 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/llength.n,v 1.1 93/05/03 17:34:07 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS llength tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +llength \- Count the number of elements in a list +.SH SYNOPSIS +\fBllength \fIlist\fR +.BE + +.SH DESCRIPTION +.PP +Treats \fIlist\fR as a list and returns a decimal string giving +the number of elements in it. + +.SH KEYWORDS +element, list, length diff --git a/vendor/x11iraf/obm/Tcl/doc/lrange.n b/vendor/x11iraf/obm/Tcl/doc/lrange.n new file mode 100644 index 00000000..b963906d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/lrange.n @@ -0,0 +1,51 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/lrange.n,v 1.1 93/05/03 17:34:07 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS lrange tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +lrange \- Return one or more adjacent elements from a list +.SH SYNOPSIS +\fBlrange \fIlist first last +.BE + +.SH DESCRIPTION +.PP +\fIList\fR must be a valid Tcl list. This command will +return a new list consisting of elements +\fIfirst\fR through \fIlast\fR, inclusive. +\fILast\fR may be \fBend\fR (or any +abbreviation of it) to refer to the last element of the list. +If \fIfirst\fR is less than zero, it is treated as if it were zero. +If \fIlast\fR is greater than or equal to the number of elements +in the list, then it is treated as if it were \fBend\fR. +If \fIfirst\fR is greater than \fIlast\fR then an empty string +is returned. +Note: ``\fBlrange \fIlist first first\fR'' does not always produce the +same result as ``\fBlindex \fIlist first\fR'' (although it often does +for simple fields that aren't enclosed in braces); it does, however, +produce exactly the same results as ``\fBlist [lindex \fIlist first\fB]\fR'' + +.SH KEYWORDS +element, list, range, sublist diff --git a/vendor/x11iraf/obm/Tcl/doc/lreplace.n b/vendor/x11iraf/obm/Tcl/doc/lreplace.n new file mode 100644 index 00000000..c7d96f58 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/lreplace.n @@ -0,0 +1,55 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/lreplace.n,v 1.1 93/05/03 17:34:08 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS lreplace tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +lreplace \- Replace elements in a list with new elements +.SH SYNOPSIS +\fBlreplace \fIlist first last \fR?\fIelement element ...\fR? +.BE + +.SH DESCRIPTION +.PP +\fBLreplace\fR returns a new list formed by replacing one or more elements of +\fIlist\fR with the \fIelement\fR arguments. +\fIFirst\fR gives the index in \fIlist\fR of the first element +to be replaced. +If \fIfirst\fR is less than zero then it refers to the first +element of \fIlist\fR; the element indicated by \fIfirst\fR +must exist in the list. +\fILast\fR gives the index in \fIlist\fR of the last element +to be replaced; it must be greater than or equal to \fIfirst\fR. +\fILast\fR may be \fBend\fR (or any abbreviation of it) to indicate +that all elements between \fIfirst\fR and the end of the list should +be replaced. +The \fIelement\fR arguments specify zero or more new arguments to +be added to the list in place of those that were deleted. +Each \fIelement\fR argument will become a separate element of +the list. +If no \fIelement\fR arguments are specified, then the elements +between \fIfirst\fR and \fIlast\fR are simply deleted. + +.SH KEYWORDS +element, list, replace diff --git a/vendor/x11iraf/obm/Tcl/doc/lsearch.n b/vendor/x11iraf/obm/Tcl/doc/lsearch.n new file mode 100644 index 00000000..af87eb7f --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/lsearch.n @@ -0,0 +1,60 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/lsearch.n,v 1.2 93/05/07 14:27:07 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS lsearch tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +lsearch \- See if a list contains a particular element +.SH SYNOPSIS +\fBlsearch \fR?\fImode\fR? \fIlist pattern\fR +.BE + +.SH DESCRIPTION +.PP +This command searches the elements of \fIlist\fR to see if one +of them matches \fIpattern\fR. +If so, the command returns the index of the first matching +element. +If not, the command returns \fB\-1\fR. +.VS +The \fImode\fR argument indicates how the elements of the list are to +be matched against \fIpattern\fR and it must have one of the following +values: +.TP +\fB\-exact\fR +The list element must contain exactly the same string as \fIpattern\fR. +.TP +\fB\-glob\fR +\fIPattern\fR is a glob-style pattern which is matched against each list +element using the same rules as the \fBstring match\fR command. +.TP +\fB\-regexp\fR +\fIPattern\fR is treated as a regular expression and matched against +each list element using the same rules as the \fBregexp\fR command. +.PP +If \fImode\fR is omitted then it defaults to \fB\-glob\fR. +.VE + +.SH KEYWORDS +list, match, pattern, regular expression, search, string diff --git a/vendor/x11iraf/obm/Tcl/doc/lsort.n b/vendor/x11iraf/obm/Tcl/doc/lsort.n new file mode 100644 index 00000000..a9985d14 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/lsort.n @@ -0,0 +1,72 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/lsort.n,v 1.2 93/05/07 16:48:45 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS lsort tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +lsort \- Sort the elements of a list +.SH SYNOPSIS +\fBlsort \fR?\fIswitches\fR? \fIlist\fR +.BE + +.SH DESCRIPTION +.PP +This command sorts the elements of \fIlist\fR, returning a new +list in sorted order. By default ASCII sorting is used with +the result returned in increasing order. +.VS +However, any of the +following switches may be specified before \fIlist\fR to +control the sorting process (unique abbreviations are accepted): +.TP 20 +\fB\-ascii\fR +Use string comparison with ASCII collation order. This is +the default. +.TP 20 +\fB\-integer\fR +Convert list elements to integers and use integer comparison. +.TP 20 +\fB\-real\fR +Convert list elements to floating-point values and use floating +comparison. +.TP 20 +\fB\-command\0\fIcommand\fR +Use \fIcommand\fR as a comparison command. +To compare two elements, evaluate a Tcl script consisting of +\fIcommand\fR with the two elements appended as additional +arguments. The script should return an integer less than, +equal to, or greater than zero if the first element is to +be considered less than, equal to, or greater than the second, +respectively. +.TP 20 +\fB\-increasing\fR +Sort the list in increasing order (``smallest'' items first). +This is the default. +.TP 20 +\fB\-decreasing\fR +Sort the list in decreasing order (``largest'' items first). +.VE + +.SH KEYWORDS +element, list, order, sort diff --git a/vendor/x11iraf/obm/Tcl/doc/man.macros b/vendor/x11iraf/obm/Tcl/doc/man.macros new file mode 100644 index 00000000..f45afa8e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/man.macros @@ -0,0 +1,182 @@ +.\" The definitions below are for supplemental macros used in Tcl/Tk +.\" manual entries. +.\" +.\" .HS name section [date [version]] +.\" Replacement for .TH in other man pages. See below for valid +.\" section names. +.\" +.\" .AP type name in/out [indent] +.\" Start paragraph describing an argument to a library procedure. +.\" type is type of argument (int, etc.), in/out is either "in", "out", +.\" or "in/out" to describe whether procedure reads or modifies arg, +.\" and indent is equivalent to second arg of .IP (shouldn't ever be +.\" needed; use .AS below instead) +.\" +.\" .AS [type [name]] +.\" Give maximum sizes of arguments for setting tab stops. Type and +.\" name are examples of largest possible arguments that will be passed +.\" to .AP later. If args are omitted, default tab stops are used. +.\" +.\" .BS +.\" Start box enclosure. From here until next .BE, everything will be +.\" enclosed in one large box. +.\" +.\" .BE +.\" End of box enclosure. +.\" +.\" .VS +.\" Begin vertical sidebar, for use in marking newly-changed parts +.\" of man pages. +.\" +.\" .VE +.\" End of vertical sidebar. +.\" +.\" .DS +.\" Begin an indented unfilled display. +.\" +.\" .DE +.\" End of indented unfilled display. +.\" +'\" # Heading for Tcl/Tk man pages +.de HS +.ds ^3 \\0 +.if !"\\$3"" .ds ^3 \\$3 +.if '\\$2'cmds' .TH \\$1 1 \\*(^3 \\$4 +.if '\\$2'lib' .TH \\$1 3 \\*(^3 \\$4 +.if '\\$2'tcl' .TH \\$1 n \\*(^3 Tcl "Tcl Built-In Commands" +.if '\\$2'tk' .TH \\$1 n \\*(^3 Tk "Tk Commands" +.if '\\$2'tclc' .TH \\$1 3 \\*(^3 Tcl "Tcl Library Procedures" +.if '\\$2'tkc' .TH \\$1 3 \\*(^3 Tk "Tk Library Procedures" +.if '\\$2'tclcmds' .TH \\$1 1 \\*(^3 Tk "Tcl Applications" +.if '\\$2'tkcmds' .TH \\$1 1 \\*(^3 Tk "Tk Applications" +.if t .wh -1.3i ^B +.nr ^l \\n(.l +.ad b +.. +'\" # Start an argument description +.de AP +.ie !"\\$4"" .TP \\$4 +.el \{\ +. ie !"\\$2"" .TP \\n()Cu +. el .TP 15 +.\} +.ie !"\\$3"" \{\ +.ta \\n()Au \\n()Bu +\&\\$1 \\fI\\$2\\fP (\\$3) +.\".b +.\} +.el \{\ +.br +.ie !"\\$2"" \{\ +\&\\$1 \\fI\\$2\\fP +.\} +.el \{\ +\&\\fI\\$1\\fP +.\} +.\} +.. +'\" # define tabbing values for .AP +.de AS +.nr )A 10n +.if !"\\$1"" .nr )A \\w'\\$1'u+3n +.nr )B \\n()Au+15n +.\" +.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n +.nr )C \\n()Bu+\\w'(in/out)'u+2n +.. +'\" # BS - start boxed text +'\" # ^y = starting y location +'\" # ^b = 1 +.de BS +.br +.mk ^y +.nr ^b 1u +.if n .nf +.if n .ti 0 +.if n \l'\\n(.lu\(ul' +.if n .fi +.. +'\" # BE - end boxed text (draw box now) +.de BE +.nf +.ti 0 +.mk ^t +.ie n \l'\\n(^lu\(ul' +.el \{\ +.\" Draw four-sided box normally, but don't draw top of +.\" box if the box started on an earlier page. +.ie !\\n(^b-1 \{\ +\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.el \}\ +\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.\} +.fi +.br +.nr ^b 0 +.. +'\" # VS - start vertical sidebar +'\" # ^Y = starting y location +'\" # ^v = 1 (for troff; for nroff this doesn't matter) +.de VS +.mk ^Y +.ie n 'mc \s12\(br\s0 +.el .nr ^v 1u +.. +'\" # VE - end of vertical sidebar +.de VE +.ie n 'mc +.el \{\ +.ev 2 +.nf +.ti 0 +.mk ^t +\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' +.sp -1 +.fi +.ev +.\} +.nr ^v 0 +.. +'\" # Special macro to handle page bottom: finish off current +'\" # box/sidebar if in box/sidebar mode, then invoked standard +'\" # page bottom macro. +.de ^B +.ev 2 +'ti 0 +'nf +.mk ^t +.if \\n(^b \{\ +.\" Draw three-sided box if this is the box's first page, +.\" draw two sides but no top otherwise. +.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.\} +.if \\n(^v \{\ +.nr ^x \\n(^tu+1v-\\n(^Yu +\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c +.\} +.bp +'fi +.ev +.if \\n(^b \{\ +.mk ^y +.nr ^b 2 +.\} +.if \\n(^v \{\ +.mk ^Y +.\} +.. +'\" # DS - begin display +.de DS +.RS +.nf +.sp +.. +'\" # DE - end display +.de DE +.fi +.RE +.sp .5 +.. diff --git a/vendor/x11iraf/obm/Tcl/doc/open.n b/vendor/x11iraf/obm/Tcl/doc/open.n new file mode 100644 index 00000000..8bd39ae1 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/open.n @@ -0,0 +1,138 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/open.n,v 1.1 93/05/10 17:10:32 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS open tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +open \- Open a file +.SH SYNOPSIS +.VS +\fBopen \fIfileName\fR ?\fIaccess\fR? ?\fIpermissions\fR? +.VE +.BE + +.SH DESCRIPTION +.PP +This command opens a file and returns an identifier +that may be used in future invocations +of commands like \fBread\fR, \fBputs\fR, and \fBclose\fR. +\fIFileName\fR gives the name of the file to open; if it starts with +a tilde then tilde substitution is performed as described for +\fBTcl_TildeSubst\fR. +If the first character of \fIfileName\fR is ``|'' then the +remaining characters of \fIfileName\fR are treated as a command +pipeline to invoke, in the same style as for \fBexec\fR. +In this case, the identifier returned by \fBopen\fR may be used +to write to the command's input pipe or read from its output pipe. +.PP +The \fIaccess\fR argument indicates the way in which the file +(or command pipeline) is to be accessed. +.VS +It may take two forms, either a string in the form that would be +passed to the \fBfopen\fR library procedure or a list of POSIX +access flags. +It defaults to ``\fBr\fR''. +In the first form \fIaccess\fR may have any of the following values: +.VE +.TP 15 +\fBr\fR +Open the file for reading only; the file must already exist. +.TP 15 +\fBr+\fR +Open the file for both reading and writing; the file must +already exist. +.TP 15 +\fBw\fR +Open the file for writing only. Truncate it if it exists. If it doesn't +exist, create a new file. +.TP 15 +\fBw+\fR +Open the file for reading and writing. Truncate it if it exists. +If it doesn't exist, create a new file. +.TP 15 +\fBa\fR +Open the file for writing only. The file must already exist, and the file +is positioned so that new data is appended to the file. +.TP 15 +\fBa+\fR +Open the file for reading and writing. If the file doesn't exist, +create a new empty file. +Set the initial access position to the end of the file. +.PP +In the second form, \fIaccess\fR consists of a list of any of the +.VS +following flags, all of which have the standard POSIX meanings. +One of the flags must be either \fBRDONLY\fR, \fBWRONLY\fR or \fBRDWR\fR. +.TP 15 +\fBRDONLY\fR +Open the file for reading only. +.TP 15 +\fBWRONLY\fR +Open the file for writing only. +.TP 15 +\fBRDWR\fR +Open the file for both reading and writing. +.TP 15 +\fBAPPEND\fR +Set the file pointer to the end of the file prior to each write. +.TP 15 +\fBCREAT\fR +Create the file if it doesn't already exist (without this flag it +is an error for the file not to exist). +.TP 15 +\fBEXCL\fR +If \fBCREAT\fR is specified also, an error is returned if the +file already exists. +.TP 15 +\fBNOCTTY\fR +If the file is a terminal device, this flag prevents the file from +becoming the controlling terminal of the process. +.TP 15 +\fBNONBLOCK\fR +Prevents the process from blocking while opening the file. +For details refer to your system documentation on the \fBopen\fR system +call's \fBO_NONBLOCK\fR flag. +.TP 15 +\fBTRUNC\fR +If the file exists it is truncated to zero length. +.PP +If a new file is created as part of opening it, \fIpermissions\fR +(an integer) is used to set the permissions for the new file in +conjunction with the process's file mode creation mask. +\fIPermissions\fR defaults to 0666. +.VE +.PP +If a file is opened for both reading and writing then \fBseek\fR +must be invoked between a read and a write, or vice versa (this +restriction does not apply to command pipelines opened with \fBopen\fR). +When \fIfileName\fR specifies a command pipeline and a write-only access +is used, then standard output from the pipeline is directed to the +current standard output unless overridden by the command. +When \fIfileName\fR specifies a command pipeline and a read-only access +is used, then standard input from the pipeline is taken from the +current standard input unless overridden by the command. + +.SH KEYWORDS +access mode, append, controlling terminal, create, file, +non-blocking, open, permissions, pipeline, process diff --git a/vendor/x11iraf/obm/Tcl/doc/pid.n b/vendor/x11iraf/obm/Tcl/doc/pid.n new file mode 100644 index 00000000..ff671c5d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/pid.n @@ -0,0 +1,47 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/pid.n,v 1.1 93/05/15 16:19:40 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS pid tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +pid \- Retrieve process id(s) +.SH SYNOPSIS +\fBpid \fR?\fIfileId\fR? +.BE + +.SH DESCRIPTION +.PP +If the \fIfileId\fR argument is given then it should normally +refer to a process pipeline created with the \fBopen\fR command. +In this case the \fBpid\fR command will return a list whose elements +are the process identifiers of all the processes in the pipeline, +in order. +The list will be empty if \fIfileId\fR refers to an open file +that isn't a process pipeline. +If no \fIfileId\fR argument is given then \fBpid\fR returns the process +identifier of the current process. +All process identifiers are returned as decimal strings. + +.SH KEYWORDS +file, pipeline, process identifier diff --git a/vendor/x11iraf/obm/Tcl/doc/proc.n b/vendor/x11iraf/obm/Tcl/doc/proc.n new file mode 100644 index 00000000..14061205 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/proc.n @@ -0,0 +1,80 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/proc.n,v 1.1 93/05/10 17:10:18 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS proc tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +proc \- Create a Tcl procedure +.SH SYNOPSIS +\fBproc \fIname args body\fR +.BE + +.SH DESCRIPTION +.PP +The \fBproc\fR command creates a new Tcl procedure named +\fIname\fR, replacing +any existing command or procedure there may have been by that name. +Whenever the new command is invoked, the contents of \fIbody\fR will +be executed by the Tcl interpreter. +\fIArgs\fR specifies the formal arguments to the +procedure. It consists of a list, possibly empty, each of whose +elements specifies +one argument. Each argument specifier is also a list with either +one or two fields. If there is only a single field in the specifier +then it is the name of the argument; if there are two fields, then +the first is the argument name and the second is its default value. +.PP +When \fIname\fR is invoked a local variable +will be created for each of the formal arguments to the procedure; its +value will be the value of corresponding argument in the invoking command +or the argument's default value. +Arguments with default values need not be +specified in a procedure invocation. However, there must be enough +actual arguments for all the +formal arguments that don't have defaults, and there must not be any extra +actual arguments. There is one special case to permit procedures with +variable numbers of arguments. If the last formal argument has the name +\fBargs\fR, then a call to the procedure may contain more actual arguments +than the procedure has formals. In this case, all of the actual arguments +starting at the one that would be assigned to \fBargs\fR are combined into +a list (as if the \fBlist\fR command had been used); this combined value +is assigned to the local variable \fBargs\fR. +.PP +When \fIbody\fR is being executed, variable names normally refer to +local variables, which are created automatically when referenced and +deleted when the procedure returns. One local variable is automatically +created for each of the procedure's arguments. +Global variables can only be accessed by invoking +the \fBglobal\fR command or the \fBupvar\fR command. +.PP +The \fBproc\fR command returns an empty string. When a procedure is +invoked, the procedure's return value is the value specified in a +\fBreturn\fR command. If the procedure doesn't execute an explicit +\fBreturn\fR, then its return value is the value of the last command +executed in the procedure's body. +If an error occurs while executing the procedure +body, then the procedure-as-a-whole will return that same error. + +.SH KEYWORDS +argument, procedure diff --git a/vendor/x11iraf/obm/Tcl/doc/puts.n b/vendor/x11iraf/obm/Tcl/doc/puts.n new file mode 100644 index 00000000..294d4172 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/puts.n @@ -0,0 +1,50 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/puts.n,v 1.1 93/05/10 17:10:19 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS puts tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +puts \- Write to a file +.SH SYNOPSIS +\fBputs \fR?\fB\-nonewline\fR? ?\fIfileId\fR? \fIstring\fR +.BE + +.SH DESCRIPTION +.PP +Writes the characters given by \fIstring\fR to the file given +by \fIfileId\fR. +\fIFileId\fR must have been the return +value from a previous call to \fBopen\fR, or it may be +\fBstdout\fR or \fBstderr\fR to refer to one of the standard I/O +channels; it must refer to a file that was opened for +writing. +If no \fIfileId\fR is specified then it defaults to \fBstdout\fR. +\fBPuts\fR normally outputs a newline character after \fIstring\fR, +but this feature may be suppressed by specifying the \fB\-nonewline\fR +switch. +Output to files is buffered internally by Tcl; the \fBflush\fR +command may be used to force buffered characters to be output. + +.SH KEYWORDS +file, newline, output, write diff --git a/vendor/x11iraf/obm/Tcl/doc/pwd.n b/vendor/x11iraf/obm/Tcl/doc/pwd.n new file mode 100644 index 00000000..b4eb5575 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/pwd.n @@ -0,0 +1,38 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/pwd.n,v 1.1 93/05/10 17:10:19 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS pwd tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +pwd \- Return the current working directory +.SH SYNOPSIS +\fBpwd\fR +.BE + +.SH DESCRIPTION +.PP +Returns the path name of the current working directory. + +.SH KEYWORDS +working directory diff --git a/vendor/x11iraf/obm/Tcl/doc/read.n b/vendor/x11iraf/obm/Tcl/doc/read.n new file mode 100644 index 00000000..3507e0e2 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/read.n @@ -0,0 +1,54 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/read.n,v 1.2 93/10/04 16:01:04 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS read tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +read \- Read from a file +.SH SYNOPSIS +\fBread \fR?\fB\-nonewline\fR? \fIfileId\fR +.br +\fBread \fIfileId numBytes\fR +.BE + +.SH DESCRIPTION +.PP +In the first form, all of the remaining bytes are read from the file +given by \fIfileId\fR; they are returned as the result of the command. +If the \fB\-nonewline\fR switch is specified then the last +character of the file is discarded if it is a newline. +In the second form, the extra argument specifies how many bytes to read; +exactly this many bytes will be read and returned, unless there are fewer than +\fInumBytes\fR bytes left in the file; in this case, all the remaining +bytes are returned. +\fIFileId\fR must be \fBstdin\fR or the return +value from a previous call to \fBopen\fR; it must +refer to a file that was opened for reading. +.VS +Any existing end-of-file or error condition on the file is cleared at +the beginning of the \fBread\fR command. +.VE + +.SH KEYWORDS +file, read diff --git a/vendor/x11iraf/obm/Tcl/doc/regexp.n b/vendor/x11iraf/obm/Tcl/doc/regexp.n new file mode 100644 index 00000000..b3a5d71f --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/regexp.n @@ -0,0 +1,160 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/regexp.n,v 1.4 93/08/03 16:37:28 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS regexp tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +regexp \- Match a regular expression against a string +.SH SYNOPSIS +\fBregexp \fR?\fIswitches\fR? \fIexp string \fR?\fImatchVar\fR? ?\fIsubMatchVar subMatchVar ...\fR? +.BE + +.SH DESCRIPTION +.PP +Determines whether the regular expression \fIexp\fR matches part or +all of \fIstring\fR and returns 1 if it does, 0 if it doesn't. +.LP +If additional arguments are specified after \fIstring\fR then they +are treated as the names of variables in which to return +information about which part(s) of \fIstring\fR matched \fIexp\fR. +\fIMatchVar\fR will be set to the range of \fIstring\fR that +matched all of \fIexp\fR. The first \fIsubMatchVar\fR will contain +the characters in \fIstring\fR that matched the leftmost parenthesized +subexpression within \fIexp\fR, the next \fIsubMatchVar\fR will +contain the characters that matched the next parenthesized +subexpression to the right in \fIexp\fR, and so on. +.LP +If the initial arguments to \fBregexp\fR start with \fB\-\fR then +.VS +they are treated as switches. The following switches are +currently supported: +.TP 10 +\fB\-nocase\fR +Causes upper-case characters in \fIstring\fR to be treated as +lower case during the matching process. +.TP 10 +\fB\-indices\fR +Changes what is stored in the \fIsubMatchVar\fRs. +Instead of storing the matching characters from \fBstring\fR, +each variable +will contain a list of two decimal strings giving the indices +in \fIstring\fR of the first and last characters in the matching +range of characters. +.TP 10 +\fB\-\|\-\fR +Marks the end of switches. The argument following this one will +be treated as \fIexp\fR even if it starts with a \fB\-. +.VE +.LP +If there are more \fIsubMatchVar\fR's than parenthesized +subexpressions within \fIexp\fR, or if a particular subexpression +in \fIexp\fR doesn't match the string (e.g. because it was in a +portion of the expression that wasn't matched), then the corresponding +\fIsubMatchVar\fR will be set to ``\fB\-1 \-1\fR'' if \fB\-indices\fR +has been specified or to an empty string otherwise. + +.SH "REGULAR EXPRESSIONS" +.PP +Regular expressions are implemented using Henry Spencer's package +(thanks, Henry!), +and much of the description of regular expressions below is copied verbatim +from his manual entry. +.PP +A regular expression is zero or more \fIbranches\fR, separated by ``|''. +It matches anything that matches one of the branches. +.PP +A branch is zero or more \fIpieces\fR, concatenated. +It matches a match for the first, followed by a match for the second, etc. +.PP +A piece is an \fIatom\fR possibly followed by ``*'', ``+'', or ``?''. +An atom followed by ``*'' matches a sequence of 0 or more matches of the atom. +An atom followed by ``+'' matches a sequence of 1 or more matches of the atom. +An atom followed by ``?'' matches a match of the atom, or the null string. +.PP +An atom is a regular expression in parentheses (matching a match for the +regular expression), a \fIrange\fR (see below), ``.'' +(matching any single character), ``^'' (matching the null string at the +beginning of the input string), ``$'' (matching the null string at the +end of the input string), a ``\e'' followed by a single character (matching +that character), or a single character with no other significance +(matching that character). +.PP +A \fIrange\fR is a sequence of characters enclosed in ``[]''. +It normally matches any single character from the sequence. +If the sequence begins with ``^'', +it matches any single character \fInot\fR from the rest of the sequence. +If two characters in the sequence are separated by ``\-'', this is shorthand +for the full list of ASCII characters between them +(e.g. ``[0-9]'' matches any decimal digit). +To include a literal ``]'' in the sequence, make it the first character +(following a possible ``^''). +To include a literal ``\-'', make it the first or last character. + +.SH "CHOOSING AMONG ALTERNATIVE MATCHES" +.PP +In general there may be more than one way to match a regular expression +to an input string. For example, consider the command +.DS +\fBregexp (a*)b* aabaaabb x y +.DE +Considering only the rules given so far, \fBx\fR and \fBy\fR could +end up with the values \fBaabb\fR and \fBaa\fR, \fBaaab\fR and \fBaaa\fR, +\fBab\fR and \fBa\fR, or any of several other combinations. +To resolve this potential ambiguity \fBregexp\fR chooses among +alternatives using the rule ``first then longest''. +In other words, it consders the possible matches in order working +from left to right across the input string and the pattern, and it +attempts to match longer pieces of the input string before shorter +ones. More specifically, the following rules apply in decreasing +order of priority: +.IP [1] +If a regular expression could match two different parts of an input string +then it will match the one that begins earliest. +.IP [2] +If a regular expression contains \fB|\fR operators then the leftmost +matching sub-expression is chosen. +.IP [3] +In \fB*\fR, \fB+\fR, and \fB?\fR constructs, longer matches are chosen +in preference to shorter ones. +.IP [4] +In sequences of expression components the components are considered +from left to right. +.LP +In the example from above, \fB(a*)b*\fR matches \fBaab\fR: the \fB(a*)\fR +portion of the pattern is matched first and it consumes the leading +\fBaa\fR; then the \fBb*\fR portion of the pattern consumes the +next \fBb\fR. Or, consider the following example: +.DS +\fBregexp (ab|a)(b*)c abc x y z +.DE +After this command \fBx\fR will be \fBabc\fR, \fBy\fR will be +\fBab\fR, and \fBz\fR will be an empty string. +Rule 4 specifies that \fB(ab|a)\fR gets first shot at the input +string and Rule 2 specifies that the \fBab\fR sub-expression +is checked before the \fBa\fR sub-expression. +Thus the \fBb\fR has already been claimed before the \fB(b*)\fR +component is checked and \fB(b*)\fR must match an empty string. + +.SH KEYWORDS +match, regular expression, string diff --git a/vendor/x11iraf/obm/Tcl/doc/regsub.n b/vendor/x11iraf/obm/Tcl/doc/regsub.n new file mode 100644 index 00000000..0a3e704c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/regsub.n @@ -0,0 +1,88 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/regsub.n,v 1.2 93/06/17 13:31:43 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS regsub tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +regsub \- Perform substitutions based on regular expression pattern matching +.SH SYNOPSIS +\fBregsub \fR?\fIswitches\fR? \fIexp string subSpec varName\fR +.BE + +.SH DESCRIPTION +.PP +This command matches the regular expression \fIexp\fR against +\fIstring\fR, +.VS +and it copies \fIstring\fR to the variable whose name is +given by \fIvarName\fR. +The command returns 1 if there is a match and 0 if there isn't. +If there is a match, then while copying \fIstring\fR to \fIvarName\fR +the portion of \fIstring\fR that +.VE +matched \fIexp\fR is replaced with \fIsubSpec\fR. +If \fIsubSpec\fR contains a ``&'' or ``\e0'', then it is replaced +in the substitution with the portion of \fIstring\fR that +matched \fIexp\fR. +If \fIsubSpec\fR contains a ``\e\fIn\fR'', where \fIn\fR is a digit +between 1 and 9, then it is replaced in the substitution with +the portion of \fIstring\fR that matched the \fIn\fR-th +parenthesized subexpression of \fIexp\fR. +Additional backslashes may be used in \fIsubSpec\fR to prevent special +interpretation of ``&'' or ``\e0'' or ``\e\fIn\fR'' or +backslash. +The use of backslashes in \fIsubSpec\fR tends to interact badly +with the Tcl parser's use of backslashes, so it's generally +safest to enclose \fIsubSpec\fR in braces if it includes +backslashes. +.LP +If the initial arguments to \fBregexp\fR start with \fB\-\fR then +.VS +they are treated as switches. The following switches are +currently supported: +.TP 10 +\fB\-all\fR +All ranges in \fIstring\fR that match \fIexp\fR are found and +substitution is performed for each of these ranges. +Without this switch only the first +matching range is found and substituted. +If \fB\-all\fR is specified, then ``&'' and ``\e\fIn\fR'' +sequences are handled for each substitution using the information +from the corresponding match. +.TP 10 +\fB\-nocase\fR +Upper-case characters in \fIstring\fR will be converted to lower-case +before matching against \fIexp\fR; however, substitutions specified +by \fIsubSpec\fR use the original unconverted form of \fIstring\fR. +.TP 10 +\fB\-\|\-\fR +Marks the end of switches. The argument following this one will +be treated as \fIexp\fR even if it starts with a \fB\-. +.VE +.PP +See the manual entry for \fBregexp\fR for details on the interpretation +of regular expressions. + +.SH KEYWORDS +match, pattern, regular expression, substitute diff --git a/vendor/x11iraf/obm/Tcl/doc/rename.n b/vendor/x11iraf/obm/Tcl/doc/rename.n new file mode 100644 index 00000000..490f52b0 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/rename.n @@ -0,0 +1,41 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/rename.n,v 1.1 93/06/07 16:48:22 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS rename tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +rename \- Rename or delete a command +.SH SYNOPSIS +\fBrename \fIoldName newName\fR +.BE + +.SH DESCRIPTION +.PP +Rename the command that used to be called \fIoldName\fR so that it +is now called \fInewName\fR. If \fInewName\fR is an empty string +then \fIoldName\fR is deleted. The \fBrename\fR command +returns an empty string as result. + +.SH KEYWORDS +command, delete, rename diff --git a/vendor/x11iraf/obm/Tcl/doc/return.n b/vendor/x11iraf/obm/Tcl/doc/return.n new file mode 100644 index 00000000..cb80b61d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/return.n @@ -0,0 +1,104 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/return.n,v 1.8 93/08/03 16:15:41 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS return tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +return \- Return from a procedure +.SH SYNOPSIS +\fBreturn \fR?\fB\-code \fIcode\fR? ?\fB\-errorinfo \fIinfo\fR? ?\fB\-errorcode\fI code\fR? ?\fIstring\fR? +.BE + +.SH DESCRIPTION +.PP +Return immediately from the current procedure +(or top-level command or \fBsource\fR command), +with \fIstring\fR as the return value. If \fIstring\fR is not specified then +an empty string will be returned as result. + +.SH "EXCEPTIONAL RETURNS" +.PP +In the usual case where the \fB\-code\fR option isn't +.VS +specified the procedure will return normally (its completion +code will be TCL_OK). +However, the \fB\-code\fR option may be used to generate an +exceptional return from the procedure. +\fICode\fR may have any of the following values: +.TP 10 +\fBok\fR +Normal return: same as if the option is omitted. +.TP 10 +\fBerror\fR +Error return: same as if the \fBerror\fR command were used to +terminate the procedure, except for handling of \fBerrorInfo\fR +and \fBerrorCode\fR variables (see below). +.TP 10 +\fBreturn\fR +The current procedure will return with a completion code of +TCL_RETURN, so that the procedure that invoked it will return +also. +.TP 10 +\fBbreak\fR +The current procedure will return with a completion code of +TCL_BREAK, which will terminate the innermost nested loop in +the code that invoked the current procedure. +.TP 10 +\fBcontinue\fR +The current procedure will return with a completion code of +TCL_CONTINUE, which will terminate the current iteration of +the innermost nested loop in the code that invoked the current +procedure. +.TP 10 +\fIvalue\fR +\fIValue\fR must be an integer; it will be returned as the +completion code for the current procedure. +.LP +The \fB\-code\fR option is rarely used. +It is provided so that procedures that implement +new control structures can reflect exceptional conditions back to +their callers. +.PP +Two additional options, \fB\-errorinfo\fR and \fB\-errorcode\fR, +may be used to provide additional information during error +returns. +These options are ignored unless \fIcode\fR is \fBerror\fR. +.PP +The \fB\-errorinfo\fR option specifies an initial stack +trace for the \fBerrorInfo\fR variable; if it is not specified then +the stack trace left in \fBerrorInfo\fR will include the call to +the procedure and higher levels on the stack but it will not include +any information about the context of the error within the procedure. +Typically the \fIinfo\fR value is supplied from the value left +in \fBerrorInfo\fR after a \fBcatch\fR command trapped an error within +the procedure. +.PP +If the \fB\-errorcode\fR option is specified then \fIcode\fR provides +a value for the \fBerrorCode\fR variable. +If the option is not specified then \fBerrorCode\fR will +default to \fBNONE\fR. +.VE + +.SH KEYWORDS +break, continue, error, procedure, return diff --git a/vendor/x11iraf/obm/Tcl/doc/scan.n b/vendor/x11iraf/obm/Tcl/doc/scan.n new file mode 100644 index 00000000..b2b15209 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/scan.n @@ -0,0 +1,149 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/scan.n,v 1.3 93/08/04 17:18:42 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS scan tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +scan \- Parse string using conversion specifiers in the style of sscanf +.SH SYNOPSIS +\fBscan \fIstring format varName \fR?\fIvarName ...\fR? +.BE + +.SH INTRODUCTION +.PP +This command parses fields from an input string in the same fashion +as the ANSI C \fBsscanf\fR procedure and returns a count of the number +of fields sucessfully parsed. +\fIString\fR gives the input to be parsed and \fIformat\fR indicates +how to parse it, using \fB%\fR conversion specifiers as in \fBsscanf\fR. +Each \fIvarName\fR gives the name of a variable; when a field is +scanned from \fIstring\fR the result is converted back into a string +and assigned to the corresponding variable. + +.SH "DETAILS ON SCANNING" +.PP +\fBScan\fR operates by scanning \fIstring\fR and \fIformatString\fR together. +If the next character in \fIformatString\fR is a blank or tab then it +is ignored. +Otherwise, if it isn't a \fB%\fR character then it +must match the next non-white-space character of \fIstring\fR. +When a \fB%\fR is encountered in \fIformatString\fR, it indicates +the start of a conversion specifier. +A conversion specifier contains three fields after the \fB%\fR: +a \fB*\fR, which indicates that the converted value is to be discarded +instead of assigned to a variable; a number indicating a maximum field +width; and a conversion character. +All of these fields are optional except for the conversion character. +.PP +When \fBscan\fR finds a conversion specifier in \fIformatString\fR, it +first skips any white-space characters in \fIstring\fR. +Then it converts the next input characters according to the +conversion specifier and stores the result in the variable given +by the next argument to \fBscan\fR. +The following conversion characters are supported: +.TP 10 +\fBd\fR +The input field must be a decimal integer. +It is read in and the value is stored in the variable as a decimal string. +.TP 10 +\fBo\fR +The input field must be an octal integer. It is read in and the +value is stored in the variable as a decimal string. +.TP 10 +\fBx\fR +The input field must be a hexadecimal integer. It is read in +and the value is stored in the variable as a decimal string. +.TP 10 +\fBc\fR +A single character is read in and its binary value is stored in +the variable as a decimal string. +Initial white space is not skipped in this case, so the input +field may be a white-space character. +This conversion is different from the ANSI standard in that the +input field always consists of a single character and no field +width may be specified. +.TP 10 +\fBs\fR +The input field consists of all the characters up to the next +white-space character; the characters are copied to the variable. +.TP 10 +\fBe\fR or \fBf\fR or \fBg\fR +The input field must be a floating-point number consisting +of an optional sign, a string of decimal digits possibly con +taining a decimal point, and an optional exponent consisting +of an \fBe\fR or \fBE\fR followed by an optional sign and a string of +decimal digits. +It is read in and stored in the variable as a floating-point string. +.TP 10 +\fB[\fIchars\fB] +The input field consists of any number of characters in +\fIchars\fR. +The matching string is stored in the variable. +If the first character between the brackets is a \fB]\fR then +it is treated as part of \fIchars\fR rather than the closing +bracket for the set. +.TP 10 +\fB[^\fIchars\fB] +The input field consists of any number of characters not in +\fIchars\fR. +The matching string is stored in the variable. +If the character immediately following the \fB^\fR is a \fB]\fR then it is +treated as part of the set rather than the closing bracket for +the set. +.LP +The number of characters read from the input for a conversion is the +largest number that makes sense for that particular conversion (e.g. +as many decimal digits as possible for \fB%d\fR, as +many octal digits as possible for \fB%o\fR, and so on). +The input field for a given conversion terminates either when a +white-space character is encountered or when the maximum field +width has been reached, whichever comes first. +If a \fB*\fR is present in the conversion specifier +then no variable is assigned and the next scan argument is not consumed. + +.SH "DIFFERENCES FROM ANSI SSCANF" +.PP +The behavior of the \fBscan\fR command is the same as the behavior of +the ANSI C \fBsscanf\fR procedure except for the following differences: +.IP [1] +.VS +\fB%p\fR and \fB%n\fR conversion specifiers are not currently +supported. +.VE +.IP [2] +For \fB%c\fR conversions a single character value is +converted to a decimal string, which is then assigned to the +corresponding \fIvarName\fR; +no field width may be specified for this conversion. +.IP [3] +.VS +The \fBl\fR, \fBh\fR, and \fBL\fR modifiers are ignored; integer +values are always converted as if there were no modifier present +and real values are always converted as if the \fBl\fR modifier +were present (i.e. type \fBdouble\fR is used for the internal +representation). +.VE + +.SH KEYWORDS +conversion specifier, parse, scan diff --git a/vendor/x11iraf/obm/Tcl/doc/seek.n b/vendor/x11iraf/obm/Tcl/doc/seek.n new file mode 100644 index 00000000..832d8a65 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/seek.n @@ -0,0 +1,64 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/seek.n,v 1.1 93/06/07 16:48:27 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS seek tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +seek \- Change the access position for an open file +.SH SYNOPSIS +\fBseek \fIfileId offset \fR?\fIorigin\fR? +.BE + +.SH DESCRIPTION +.PP +Change the current access position for \fIfileId\fR. +\fIFileId\fR must have been the return +value from a previous call to \fBopen\fR, or it may be \fBstdin\fR, +\fBstdout\fR, or \fBstderr\fR to refer to one of the standard I/O +channels. +The \fIoffset\fR and \fIorigin\fR arguments specify the position at +which the next read or write will occur for \fIfileId\fR. +\fIOffset\fR must be an integer (which may be negative) and \fIorigin\fR +must be one of the following: +.TP +\fBstart\fR +The new access position will be \fIoffset\fR bytes from the start +of the file. +.TP +\fBcurrent\fR +The new access position will be \fIoffset\fR bytes from the current +access position; a negative \fIoffset\fR moves the access position +backwards in the file. +.TP +\fBend\fR +The new access position will be \fIoffset\fR bytes from the end of +the file. A negative \fIoffset\fR places the access position before +the end-of-file, and a positive \fIoffset\fR places the access position +after the end-of-file. +.LP +The \fIorigin\fR argument defaults to \fBstart\fR. +This command returns an empty string. + +.SH KEYWORDS +access position, file, seek diff --git a/vendor/x11iraf/obm/Tcl/doc/set.n b/vendor/x11iraf/obm/Tcl/doc/set.n new file mode 100644 index 00000000..1fda124e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/set.n @@ -0,0 +1,51 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/set.n,v 1.1 93/06/07 16:48:27 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS set tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +set \- Read and write variables +.SH SYNOPSIS +\fBset \fIvarName \fR?\fIvalue\fR? +.BE + +.SH DESCRIPTION +.PP +Returns the value of variable \fIvarName\fR. +If \fIvalue\fR is specified, then set +the value of \fIvarName\fR to \fIvalue\fR, creating a new variable +if one doesn't already exist, and return its value. +If \fIvarName\fR contains an open parenthesis and ends with a +close parenthesis, then it refers to an array element: the characters +before the first open parenthesis are the name of the array, and the characters +between the parentheses are the index within the array. +Otherwise \fIvarName\fR refers to a scalar variable. +If no procedure is active, then \fIvarName\fR refers to a global +variable. +If a procedure is active, then \fIvarName\fR refers to a parameter +or local variable of the procedure unless the \fIglobal\fR command +has been invoked to declare \fIvarName\fR to be global. + +.SH KEYWORDS +read, write, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/source.n b/vendor/x11iraf/obm/Tcl/doc/source.n new file mode 100644 index 00000000..124d8049 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/source.n @@ -0,0 +1,47 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/source.n,v 1.1 93/06/07 16:48:28 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS source tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +source \- Evaluate a file as a Tcl script +.SH SYNOPSIS +\fBsource \fIfileName\fR +.BE + +.SH DESCRIPTION +.PP +Read file \fIfileName\fR and pass the contents to the Tcl interpreter +as a script to evaluate in the normal fashion. The return +value from \fBsource\fR is the return value of the last command executed +from the file. If an error occurs in evaluating the contents of the +file then the \fBsource\fR command will return that error. +If a \fBreturn\fR command is invoked from within the file then the remainder of +the file will be skipped and the \fBsource\fR command will return +normally with the result from the \fBreturn\fR command. +If \fIfileName\fR starts with a tilde, then it is tilde-substituted +as described in the \fBTcl_TildeSubst\fR manual entry. + +.SH KEYWORDS +file, script diff --git a/vendor/x11iraf/obm/Tcl/doc/split.n b/vendor/x11iraf/obm/Tcl/doc/split.n new file mode 100644 index 00000000..cd1f1dc3 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/split.n @@ -0,0 +1,57 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/split.n,v 1.1 93/06/16 16:48:25 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS split tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +split \- Split a string into a proper Tcl list +.SH SYNOPSIS +\fBsplit \fIstring \fR?\fIsplitChars\fR? +.BE + +.SH DESCRIPTION +.PP +Returns a list created by splitting \fIstring\fR at each character +that is in the \fIsplitChars\fR argument. +Each element of the result list will consist of the +characters from \fIstring\fR that lie between instances of the +characters in \fIsplitChars\fR. +Empty list elements will be generated if \fIstring\fR contains +adjacent characters in \fIsplitChars\fR, or if the first or last +character of \fIstring\fR is in \fIsplitChars\fR. +If \fIsplitChars\fR is an empty string then each character of +\fIstring\fR becomes a separate element of the result list. +\fISplitChars\fR defaults to the standard white-space characters. +For example, +.DS +\fBsplit "comp.unix.misc" .\fR +.DE +returns \fB"comp unix misc"\fR and +.DS +\fBsplit "Hello world" {}\fR +.DE +returns \fB"H e l l o { } w o r l d"\fR. + +.SH KEYWORDS +list, split, string diff --git a/vendor/x11iraf/obm/Tcl/doc/string.n b/vendor/x11iraf/obm/Tcl/doc/string.n new file mode 100644 index 00000000..defd385a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/string.n @@ -0,0 +1,131 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/string.n,v 1.1 93/06/16 16:48:24 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS string tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +string \- Manipulate strings +.SH SYNOPSIS +\fBstring \fIoption arg \fR?\fIarg ...?\fR +.BE + +.SH DESCRIPTION +.PP +Performs one of several string operations, depending on \fIoption\fR. +The legal \fIoption\fRs (which may be abbreviated) are: +.TP +\fBstring compare \fIstring1 string2\fR +Perform a character-by-character comparison of strings \fIstring1\fR and +\fIstring2\fR in the same way as the C \fBstrcmp\fR procedure. Return +\-1, 0, or 1, depending on whether \fIstring1\fR is lexicographically +less than, equal to, or greater than \fIstring2\fR. +.TP +\fBstring first \fIstring1 string2\fR +Search \fIstring2\fR for a sequence of characters that exactly match +the characters in \fIstring1\fR. If found, return the index of the +first character in the first such match within \fIstring2\fR. If not +found, return \-1. +.TP +\fBstring index \fIstring charIndex\fR +Returns the \fIcharIndex\fR'th character of the \fIstring\fR +argument. A \fIcharIndex\fR of 0 corresponds to the first +character of the string. +If \fIcharIndex\fR is less than 0 or greater than +or equal to the length of the string then an empty string is +returned. +.TP +\fBstring last \fIstring1 string2\fR +Search \fIstring2\fR for a sequence of characters that exactly match +the characters in \fIstring1\fR. If found, return the index of the +first character in the last such match within \fIstring2\fR. If there +is no match, then return \-1. +.TP +\fBstring length \fIstring\fR +Returns a decimal string giving the number of characters in \fIstring\fR. +.TP +\fBstring match \fIpattern\fR \fIstring\fR +See if \fIpattern\fR matches \fIstring\fR; return 1 if it does, 0 +if it doesn't. Matching is done in a fashion similar to that +used by the C-shell. For the two strings to match, their contents +must be identical except that the following special sequences +may appear in \fIpattern\fR: +.RS +.IP \fB*\fR 10 +Matches any sequence of characters in \fIstring\fR, +including a null string. +.IP \fB?\fR 10 +Matches any single character in \fIstring\fR. +.IP \fB[\fIchars\fB]\fR 10 +Matches any character in the set given by \fIchars\fR. If a sequence +of the form +\fIx\fB\-\fIy\fR appears in \fIchars\fR, then any character +between \fIx\fR and \fIy\fR, inclusive, will match. +.IP \fB\e\fIx\fR 10 +Matches the single character \fIx\fR. This provides a way of +avoiding the special interpretation of the characters +\fB*?[]\e\fR in \fIpattern\fR. +.RE +.TP +\fBstring range \fIstring first last\fR +Returns a range of consecutive characters from \fIstring\fR, starting +with the character whose index is \fIfirst\fR and ending with the +character whose index is \fIlast\fR. An index of 0 refers to the +first character of the string. \fILast\fR may be \fBend\fR (or any +abbreviation of it) to refer to the last character of the string. +If \fIfirst\fR is less than zero then it is treated as if it were zero, and +if \fIlast\fR is greater than or equal to the length of the string then +it is treated as if it were \fBend\fR. If \fIfirst\fR is greater than +\fIlast\fR then an empty string is returned. +.TP +\fBstring tolower \fIstring\fR +Returns a value equal to \fIstring\fR except that all upper case +letters have been converted to lower case. +.TP +\fBstring toupper \fIstring\fR +Returns a value equal to \fIstring\fR except that all lower case +letters have been converted to upper case. +.TP +\fBstring trim \fIstring\fR ?\fIchars\fR? +Returns a value equal to \fIstring\fR except that any leading +or trailing characters from the set given by \fIchars\fR are +removed. +If \fIchars\fR is not specified then white space is removed +(spaces, tabs, newlines, and carriage returns). +.TP +\fBstring trimleft \fIstring\fR ?\fIchars\fR? +Returns a value equal to \fIstring\fR except that any +leading characters from the set given by \fIchars\fR are +removed. +If \fIchars\fR is not specified then white space is removed +(spaces, tabs, newlines, and carriage returns). +.TP +\fBstring trimright \fIstring\fR ?\fIchars\fR? +Returns a value equal to \fIstring\fR except that any +trailing characters from the set given by \fIchars\fR are +removed. +If \fIchars\fR is not specified then white space is removed +(spaces, tabs, newlines, and carriage returns). + +.SH KEYWORDS +case conversion, compare, index, match, pattern, string diff --git a/vendor/x11iraf/obm/Tcl/doc/switch.n b/vendor/x11iraf/obm/Tcl/doc/switch.n new file mode 100644 index 00000000..a8a5d1d9 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/switch.n @@ -0,0 +1,122 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/switch.n,v 1.2 93/06/17 13:31:26 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS switch tcl 7.0 +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +switch \- Evaluate one of several scripts, depending on a given value +.SH SYNOPSIS +\fBswitch\fI \fR?\fIoptions\fR?\fI string \fIpattern body \fR?\fIpattern body \fR...? +.br +\fBswitch\fI \fR?\fIoptions\fR?\fI string \fR{\fIpattern body \fR?\fIpattern body \fR...?} +.BE + +.SH DESCRIPTION +.PP +The \fBswitch\fR command matches its \fIstring\fR argument against each of +the \fIpattern\fR arguments in order. +As soon as it finds a \fIpattern\fR that matches \fIstring\fR it +evaluates the following \fIbody\fR argument by passing it recursively +to the Tcl interpreter and returns the result of that evaluation. +If the last \fIpattern\fR argument is \fBdefault\fR then it matches +anything. +If no \fIpattern\fR argument +matches \fIstring\fR and no default is given, then the \fBswitch\fR +command returns an empty string. +.PP +If the initial arguments to \fBswitch\fR start with \fB\-\fR then +they are treated as options. The following options are +currently supported: +.TP 10 +\fB\-exact\fR +Use exact matching when comparing \fIstring\fR to a pattern. This +is the default. +.TP 10 +\fB\-glob\fR +When matching \fIstring\fR to the patterns, use glob-style matching +(i.e. the same as implemented by the \fBstring match\fR command). +.TP 10 +\fB\-regexp\fR +When matching \fIstring\fR to the patterns, use regular +expression matching +(i.e. the same as implemented by the \fBregexp\fR command). +.TP 10 +\fB\-\|\-\fR +Marks the end of options. The argument following this one will +be treated as \fIstring\fR even if it starts with a \fB\-. +.PP +Two syntaxes are provided for the \fIpattern\fR and \fIbody\fR arguments. +The first uses a separate argument for each of the patterns and commands; +this form is convenient if substitutions are desired on some of the +patterns or commands. +The second form places all of the patterns and commands together into +a single argument; the argument must have proper list structure, with +the elements of the list being the patterns and commands. +The second form makes it easy to construct multi-line switch commands, +since the braces around the whole list make it unnecessary to include a +backslash at the end of each line. +Since the \fIpattern\fR arguments are in braces in the second form, +no command or variable substitutions are performed on them; this makes +the behavior of the second form different than the first form in some +cases. +.PP +If a \fIbody\fR is specified as ``\fB\-\fR'' it means that the \fIbody\fR +for the next pattern should also be used as the body for this +pattern (if the next pattern also has a body of ``\fB\-\fR'' +then the body after that is used, and so on). +This feature makes it possible to share a single \fIbody\fR among +several patterns. +.PP +Below are some examples of \fBswitch\fR commands: +.DS +\fBswitch\0abc\0a\0\-\0b\0{format 1}\0abc\0{format 2}\0default\0{format 3} +.DE +will return \fB2\fR, +.DS +.ta .5c 1c +\fBswitch\0\-regexp\0aaab { + ^a.*b$\0\- + b\0{format 1} + a*\0{format 2} + default\0{format 3} +} +.DE +will return \fB1\fR, and +.DS +.ta .5c 1c +\fBswitch\0xyz { + a + \- + b + {format 1} + a* + {format 2} + default + {format 3} +} +.DE +will return \fB3\fR. + +.SH KEYWORDS +switch, match, regular expression diff --git a/vendor/x11iraf/obm/Tcl/doc/tclsh.1 b/vendor/x11iraf/obm/Tcl/doc/tclsh.1 new file mode 100644 index 00000000..ba88be43 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/tclsh.1 @@ -0,0 +1,103 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/tclsh.1,v 1.4 93/08/26 15:06:04 ouster Exp $ SPRITE (Berkeley) +'/" +.so man.macros +.HS tclsh tclcmds +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +tclsh \- Simple shell containing Tcl interpreter +.SH SYNOPSIS +\fBtclsh\fR ?\fIfileName arg arg ...\fR?\fR +.BE + +.SH DESCRIPTION +.PP +\fBTclsh\fR is a shell-like application that reads Tcl commands +from its standard input or from a file and evaluates them. +If invoked with no arguments then it runs interactively, reading +Tcl commands from standard input and printing command results and +error messages to standard output. +It runs until the \fBexit\fR command is invoked or until it +reaches end-of-file on its standard input. +If there exists a file \fB.tclshrc\fR in the home directory of +the user, \fBtclsh\fR evaluates the file as a Tcl script +just before reading the first command from standard input. + +.SH "SCRIPT FILES" +.PP +If \fBtclsh\fR is invoked with arguments then the first argument +is the name of a script file and any additional arguments +are made available to the script as variables (see below). +Instead of reading commands from standard input \fBtclsh\fR will +read Tcl commands from the named file; \fBtclsh\fR will exit +when it reaches the end of the file. +There is no automatic evaluation of \fB.tclshrc\fR in this +case, but the script file can always \fBsource\fR it if desired. +.PP +If you create a Tcl script in a file whose first line is +.DS +\fB#!/usr/local/bin/tclsh +.DE +then you can invoke the script file directly from your shell if +you mark the file as executable. +This assumes that \fBtclsh\fR has been installed in the default +location in /usr/local/bin; if it's installed somewhere else +then you'll have to modify the above line to match. + +.SH "VARIABLES" +.PP +\fBTclsh\fR sets the following Tcl variables: +.TP 15 +\fBargc\fR +Contains a count of the number of \fIarg\fR arguments (0 if none), +not including the name of the script file. +.TP 15 +\fBargv\fR +Contains a Tcl list whose elements are the \fIarg\fR arguments, +in order, or an empty string if there are no \fIarg\fR arguments. +.TP 15 +\fBargv0\fR +Contains \fIfileName\fR if it was specified. +Otherwise, contains the name by which \fBtclsh\fR was invoked. +.TP 15 +\fBtcl_interactive\fR +Contains 1 if \fBtclsh\fR is running interactively (no +\fIfileName\fR was specified and standard input is a terminal-like +device), 0 otherwise. +.LP + +.SH PROMPTS +.PP +When \fBtclsh\fR is invoked interactively it normally prompts for each +command with ``\fB% \fR''. You can change the prompt by setting the +variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR. If variable +\fBtcl_prompt1\fR exists then it must consist of a Tcl script +to output a prompt; instead of outputting a prompt \fBtclsh\fR +will evaluate the script in \fBtcl_prompt1\fR. +The variable \fBtcl_prompt2\fR is used in a similar way when +a newline is typed but the current command isn't yet complete; +if \fBtcl_prompt2\fR isn't set then no prompt is output for +incomplete commands. + +.SH KEYWORDS +argument, interpreter, prompt, script file, shell diff --git a/vendor/x11iraf/obm/Tcl/doc/tclvars.n b/vendor/x11iraf/obm/Tcl/doc/tclvars.n new file mode 100644 index 00000000..5b8c1e15 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/tclvars.n @@ -0,0 +1,156 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/tclvars.n,v 1.1 93/06/16 16:52:49 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS tclvars tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +tclvars \- Variables used by Tcl +.BE + +.SH DESCRIPTION +.PP +The following global variables are created and managed automatically +by the Tcl library. Except where noted below, these variables should +normally be treated as read-only by application-specific code and by users. +.TP +\fBenv\fR +.br +This variable is maintained by Tcl as an array +whose elements are the environment variables for the process. +Reading an element will return the value of the corresponding +environment variable. +Setting an element of the array will modify the corresponding +environment variable or create a new one if it doesn't already +exist. +Unsetting an element of \fBenv\fR will remove the corresponding +environment variable. +Changes to the \fBenv\fR array will affect the environment +passed to children by commands like \fBexec\fR. +If the entire \fBenv\fR array is unset then Tcl will stop +monitoring \fBenv\fR accesses and will not update environment +variables. +.TP +\fBerrorCode\fR +After an error has occurred, this variable will be set to hold +additional information about the error in a form that is easy +to process with programs. +\fBerrorCode\fR consists of a Tcl list with one or more elements. +The first element of the list identifies a general class of +errors, and determines the format of the rest of the list. +The following formats for \fBerrorCode\fR are used by the +Tcl core; individual applications may define additional formats. +.RS +.TP +\fBARITH\fI code msg\fR +.VS +This format is used when an arithmetic error occurs (e.g. an attempt +to divide by zero in the \fBexpr\fR command). +\fICode\fR identifies the precise error and \fImsg\fR provides a +human-readable description of the error. \fICode\fR will be either +DIVZERO (for an attempt to divide by zero), +DOMAIN (if an argument is outside the domain of a function, such as acos(\-3)), +IOVERFLOW (for integer overflow), +OVERLFLOW (for a floating-point overflow), +or UNKNOWN (if the cause of the error cannot be determined). +.VE +.TP +\fBCHILDKILLED\fI pid sigName msg\fR +This format is used when a child process has been killed because of +a signal. The second element of \fBerrorCode\fR will be the +process's identifier (in decimal). +The third element will be the symbolic name of the signal that caused +the process to terminate; it will be one of the names from the +include file signal.h, such as \fBSIGPIPE\fR. +The fourth element will be a short human-readable message +describing the signal, such as ``write on pipe with no readers'' +for \fBSIGPIPE\fR. +.TP +\fBCHILDSTATUS\fI pid code\fR +This format is used when a child process has exited with a non-zero +exit status. The second element of \fBerrorCode\fR will be the +process's identifier (in decimal) and the third element will be the exit +code returned by the process (also in decimal). +.TP +\fBCHILDSUSP\fI pid sigName msg\fR +This format is used when a child process has been suspended because +of a signal. +The second element of \fBerrorCode\fR will be the process's identifier, +in decimal. +The third element will be the symbolic name of the signal that caused +the process to suspend; this will be one of the names from the +include file signal.h, such as \fBSIGTTIN\fR. +The fourth element will be a short human-readable message +describing the signal, such as ``background tty read'' +for \fBSIGTTIN\fR. +.TP +\fBNONE\fR +.br +This format is used for errors where no additional information is +available for an error besides the message returned with the +error. In these cases \fBerrorCode\fR will consist of a list +containing a single element whose contents are \fBNONE\fR. +.TP +\fBPOSIX \fIerrName msg\fR +.VS +If the first element of \fBerrorCode\fR is \fBPOSIX\fR, then +the error occurred during a POSIX kernel call. +.VE +The second element of the list will contain the symbolic name +of the error that occurred, such as \fBENOENT\fR; this will +be one of the values defined in the include file errno.h. +The third element of the list will be a human-readable +message corresponding to \fIerrName\fR, such as +``no such file or directory'' for the \fBENOENT\fR case. +.PP +To set \fBerrorCode\fR, applications should use library +procedures such as \fBTcl_SetErrorCode\fR and +.VS +\fBTcl_PosixError\fR, +.VE +or they may invoke the \fBerror\fR command. +If one of these methods hasn't been used, then the Tcl +interpreter will reset the variable to \fBNONE\fR after +the next error. +.RE +.TP +\fBerrorInfo\fR +After an error has occurred, this string will contain one or more lines +identifying the Tcl commands and procedures that were being executed +when the most recent error occurred. +Its contents take the form of a stack trace showing the various +nested Tcl commands that had been invoked at the time of the error. +.TP +\fBtcl_precision\fR +.VS +If this variable is set, it must contain a decimal number giving the +number of significant digits to include when converting floating-point +values to strings. +If this variable is not set then 6 digits are included. +17 digits is ``perfect'' for IEEE floating-point in that it allows +double-precision values to be converted to strings and back to +binary with no loss of precision. +.VE + +.SH KEYWORDS +arithmetic, error, environment, POSIX, precision, subprocess, variables diff --git a/vendor/x11iraf/obm/Tcl/doc/tell.n b/vendor/x11iraf/obm/Tcl/doc/tell.n new file mode 100644 index 00000000..24c3ff07 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/tell.n @@ -0,0 +1,43 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/tell.n,v 1.1 93/06/16 16:48:30 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS tell tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +tell \- Return current access position for an open file +.SH SYNOPSIS +\fBtell \fIfileId\fR +.BE + +.SH DESCRIPTION +.PP +Returns a decimal string giving the current access position in +\fIfileId\fR. +\fIFileId\fR must have been the return +value from a previous call to \fBopen\fR, or it may be \fBstdin\fR, +\fBstdout\fR, or \fBstderr\fR to refer to one of the standard I/O +channels. + +.SH KEYWORDS +access position, file diff --git a/vendor/x11iraf/obm/Tcl/doc/time.n b/vendor/x11iraf/obm/Tcl/doc/time.n new file mode 100644 index 00000000..dca3c3f6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/time.n @@ -0,0 +1,46 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/time.n,v 1.1 93/06/16 16:48:29 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS time tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +time \- Time the execution of a script +.SH SYNOPSIS +\fBtime \fIscript\fR ?\fIcount\fR? +.BE + +.SH DESCRIPTION +.PP +This command will call the Tcl interpreter \fIcount\fR +times to evaluate \fIscript\fR (or once if \fIcount\fR isn't +specified). It will then return a string of the form +.DS +\fB503 microseconds per iteration\fR +.DE +which indicates the average amount of time required per iteration, +in microseconds. +Time is measured in elapsed time, not CPU time. + +.SH KEYWORDS +script, time diff --git a/vendor/x11iraf/obm/Tcl/doc/trace.n b/vendor/x11iraf/obm/Tcl/doc/trace.n new file mode 100644 index 00000000..7d8652e8 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/trace.n @@ -0,0 +1,175 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/trace.n,v 1.3 93/06/16 16:36:39 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS trace tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +trace \- Monitor variable accesses +.SH SYNOPSIS +\fBtrace \fIoption\fR ?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command causes Tcl commands to be executed whenever certain operations are +invoked. At present, only variable tracing is implemented. The +legal \fIoption\fR's (which may be abbreviated) are: +.TP +\fBtrace variable \fIname ops command\fR +Arrange for \fIcommand\fR to be executed whenever variable \fIname\fR +is accessed in one of the ways given by \fIops\fR. \fIName\fR may +refer to a normal variable, an element of an array, or to an array +as a whole (i.e. \fIname\fR may be just the name of an array, with no +parenthesized index). If \fIname\fR refers to a whole array, then +\fIcommand\fR is invoked whenever any element of the array is +manipulated. +.RS +.LP +\fIOps\fR indicates which operations are of interest, and consists of +one or more of the following letters: +.RS +.TP +\fBr\fR +Invoke \fIcommand\fR whenever the variable is read. +.TP +\fBw\fR +Invoke \fIcommand\fR whenever the variable is written. +.TP +\fBu\fR +Invoke \fIcommand\fR whenever the variable is unset. Variables +can be unset explicitly with the \fBunset\fR command, or +implicitly when procedures return (all of their local variables +are unset). Variables are also unset when interpreters are +deleted, but traces will not be invoked because there is no +interpreter in which to execute them. +.RE +.LP +When the trace triggers, three arguments are appended to +\fIcommand\fR so that the actual command is as follows: +.DS C +\fIcommand name1 name2 op\fR +.DE +\fIName1\fR and \fIname2\fR give the name(s) for the variable +being accessed: if the variable is a scalar then \fIname1\fR +gives the variable's name and \fIname2\fR is an empty string; +if the variable is an array element then \fIname1\fR gives the +name of the array and name2 gives the index into the array; +if an entire array is being deleted and the trace was registered +on the overall array, rather than a single element, then \fIname1\fR +gives the array name and \fIname2\fR is an empty string. +\fIOp\fR indicates what operation is being performed on the +variable, and is one of \fBr\fR, \fBw\fR, or \fBu\fR as +defined above. +.LP +\fICommand\fR executes in the same context as the code that invoked +the traced operation: if the variable was accessed as part of a +Tcl procedure, then \fIcommand\fR will have access to the same +local variables as code in the procedure. This context may be +different than the context in which the trace was created. +If \fIcommand\fR invokes a procedure (which it normally does) then +the procedure will have to use \fBupvar\fR or \fBuplevel\fR if it +wishes to access the traced variable. +Note also that \fIname1\fR may not necessarily be the same as the name +used to set the trace on the variable; differences can occur if +the access is made through a variable defined with the \fBupvar\fR +command. +.LP +For read and write traces, \fIcommand\fR can modify +the variable to affect the result of the traced operation. +If \fIcommand\fR modifies the value of a variable during a +read or write trace, then the new value will be returned as the +result of the traced operation. +The return value from \fIcommand\fR is ignored except that +if it returns an error of any sort then the traced operation +also returns an error with +.VS +the same error message returned by the trace command +.VE +(this mechanism can be used to implement read-only variables, for +example). +For write traces, \fIcommand\fR is invoked after the variable's +value has been changed; it can write a new value into the variable +to override the original value specified in the write operation. +To implement read-only variables, \fIcommand\fR will have to restore +the old value of the variable. +.LP +While \fIcommand\fR is executing during a read or write trace, traces +on the variable are temporarily disabled. +This means that reads and writes invoked by +\fIcommand\fR will occur directly, without invoking \fIcommand\fR +(or any other traces) again. +.VS +However, if \fIcommand\fR unsets the variable then unset traces +will be invoked. +.VE +.LP +When an unset trace is invoked, the variable has already been +deleted: it will appear to be undefined with no traces. +If an unset occurs because of a procedure return, then the +trace will be invoked in the variable context of the procedure +being returned to: the stack frame of the returning procedure +will no longer exist. +Traces are not disabled during unset traces, so if an unset trace +command creates a new trace and accesses the variable, the +trace will be invoked. +.VS +Any errors in unset traces are ignored. +.VE +.LP +If there are multiple traces on a variable they are invoked +in order of creation, most-recent first. +If one trace returns an error, then no further traces are +invoked for the variable. +If an array element has a trace set, and there is also a trace +set on the array as a whole, the trace on the overall array +is invoked before the one on the element. +.LP +Once created, the trace remains in effect either until the +trace is removed with the \fBtrace vdelete\fR command described +below, until the variable is unset, or until the interpreter +is deleted. +Unsetting an element of array will remove any traces on that +element, but will not remove traces on the overall array. +.LP +This command returns an empty string. +.RE +.TP +\fBtrace vdelete \fIname ops command\fR +If there is a trace set on variable \fIname\fR with the +operations and command given by \fIops\fR and \fIcommand\fR, +then the trace is removed, so that \fIcommand\fR will never +again be invoked. +Returns an empty string. +.TP +\fBtrace vinfo \fIname\fR +Returns a list containing one element for each trace +currently set on variable \fIname\fR. +Each element of the list is itself a list containing two +elements, which are the \fIops\fR and \fIcommand\fR associated +with the trace. +If \fIname\fR doesn't exist or doesn't have any traces set, then +the result of the command will be an empty string. + +.SH KEYWORDS +read, variable, write, trace, unset diff --git a/vendor/x11iraf/obm/Tcl/doc/unknown.n b/vendor/x11iraf/obm/Tcl/doc/unknown.n new file mode 100644 index 00000000..7c257575 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/unknown.n @@ -0,0 +1,55 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/unknown.n,v 1.2 93/10/13 17:19:06 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS unknown tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +unknown \- Handle attempts to use non-existent commands +.SH SYNOPSIS +\fBunknown \fIcmdName \fR?\fIarg arg ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command doesn't actually exist as part of Tcl, but Tcl will +invoke it if it does exist. +If the Tcl interpreter encounters a command name for which there +is not a defined command, then Tcl checks for the existence of +a command named \fBunknown\fR. +If there is no such command, then the interpreter returns an +error. +If the \fBunknown\fR command exists, then it is invoked with +arguments consisting of the fully-substituted name and arguments +for the original non-existent command. +The \fBunknown\fR command typically does things like searching +through library directories for a command procedure with the name +\fIcmdName\fR, or expanding abbreviated command names to full-length, +or automatically executing unknown commands as sub-processes. +In some cases (such as expanding abbreviations) \fBunknown\fR will +change the original command slightly and then (re-)execute it. +The result of the \fBunknown\fR command is used as the result for +the original non-existent command. + +.SH KEYWORDS +error, non-existent command diff --git a/vendor/x11iraf/obm/Tcl/doc/unset.n b/vendor/x11iraf/obm/Tcl/doc/unset.n new file mode 100644 index 00000000..ed27582e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/unset.n @@ -0,0 +1,47 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/unset.n,v 1.1 93/06/16 16:48:28 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS unset tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +unset \- Delete variables +.SH SYNOPSIS +\fBunset \fIname \fR?\fIname name ...\fR? +.BE + +.SH DESCRIPTION +.PP +This command removes one or more variables. +Each \fIname\fR is a variable name, specified in any of the +ways acceptable to the \fBset\fR command. +If a \fIname\fR refers to an element of an array then that +element is removed without affecting the rest of the array. +If a \fIname\fR consists of an array name with no parenthesized +index, then the entire array is deleted. +The \fBunset\fR command returns an empty string as result. +An error occurs if any of the variables doesn't exist, and any variables +after the non-existent one are not deleted. + +.SH KEYWORDS +remove, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/uplevel.n b/vendor/x11iraf/obm/Tcl/doc/uplevel.n new file mode 100644 index 00000000..d40e966e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/uplevel.n @@ -0,0 +1,79 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/uplevel.n,v 1.1 93/06/16 16:48:27 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS uplevel tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +uplevel \- Execute a script in a different stack frame +.SH SYNOPSIS +\fBuplevel \fR?\fIlevel\fR?\fI arg \fR?\fIarg ...\fR? +.BE + +.SH DESCRIPTION +.PP +All of the \fIarg\fR arguments are concatenated as if they had +been passed to \fBconcat\fR; the result is then evaluated in the +variable context indicated by \fIlevel\fR. \fBUplevel\fR returns +the result of that evaluation. +.PP +If \fIlevel\fR is an integer then +it gives a distance (up the procedure calling stack) to move before +executing the command. If \fIlevel\fR consists of \fB#\fR followed by +a number then the number gives an absolute level number. If \fIlevel\fR +is omitted then it defaults to \fB1\fR. \fILevel\fR cannot be +defaulted if the first \fIcommand\fR argument starts with a digit or \fB#\fR. +.PP +For example, suppose that procedure \fBa\fR was invoked +from top-level, and that it called \fBb\fR, and that \fBb\fR called \fBc\fR. +Suppose that \fBc\fR invokes the \fBuplevel\fR command. If \fIlevel\fR +is \fB1\fR or \fB#2\fR or omitted, then the command will be executed +in the variable context of \fBb\fR. If \fIlevel\fR is \fB2\fR or \fB#1\fR +then the command will be executed in the variable context of \fBa\fR. +If \fIlevel\fR is \fB3\fR or \fB#0\fR then the command will be executed +at top-level (only global variables will be visible). +.PP +The \fBuplevel\fR command causes the invoking procedure to disappear +from the procedure calling stack while the command is being executed. +In the above example, suppose \fBc\fR invokes the command +.DS +\fBuplevel 1 {set x 43; d} +.DE +where \fBd\fR is another Tcl procedure. The \fBset\fR command will +modify the variable \fBx\fR in \fBb\fR's context, and \fBd\fR will execute +at level 3, as if called from \fBb\fR. If it in turn executes +the command +.DS +\fBuplevel {set x 42} +.DE +then the \fBset\fR command will modify the same variable \fBx\fR in \fBb\fR's +context: the procedure \fBc\fR does not appear to be on the call stack +when \fBd\fR is executing. The command ``\fBinfo level\fR'' may +be used to obtain the level of the current procedure. +.PP +\fBUplevel\fR makes it possible to implement new control +constructs as Tcl procedures (for example, \fBuplevel\fR could +be used to implement the \fBwhile\fR construct as a Tcl procedure). + +.SH KEYWORDS +context, stack frame, variables diff --git a/vendor/x11iraf/obm/Tcl/doc/upvar.n b/vendor/x11iraf/obm/Tcl/doc/upvar.n new file mode 100644 index 00000000..7a83ea2c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/upvar.n @@ -0,0 +1,83 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/upvar.n,v 1.3 93/06/16 16:41:13 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS upvar tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +upvar \- Create link to variable in a different stack frame +.SH SYNOPSIS +\fBupvar \fR?\fIlevel\fR? \fIotherVar myVar \fR?\fIotherVar myVar \fR...? +.BE + +.SH DESCRIPTION +.PP +This command arranges for one or more local variables in the current +procedure to refer to variables in an enclosing procedure call or +to global variables. +\fILevel\fR may have any of the forms permitted for the \fBuplevel\fR +command, and may be omitted if the first letter of the first \fIotherVar\fR +isn't \fB#\fR or a digit (it defaults to \fB1\fR). +For each \fIotherVar\fR argument, \fBupvar\fR makes the variable +by that name in the procedure frame given by \fIlevel\fR (or at +global level, if \fIlevel\fR is \fB#0\fR) accessible +in the current procedure by the name given in the corresponding +\fImyVar\fR argument. +The variable named by \fIotherVar\fR need not exist at the time of the +call; it will be created the first time \fImyVar\fR is referenced, just like +an ordinary variable. +\fBUpvar\fR may only be invoked from within procedures. +.VS +\fIMyVar\fR may not refer to an element of an array, but \fIotherVar\fR +may refer to an array element. +.VE +\fBUpvar\fR returns an empty string. +.PP +The \fBupvar\fR command simplifies the implementation of call-by-name +procedure calling and also makes it easier to build new control constructs +as Tcl procedures. +For example, consider the following procedure: +.DS +.ta 1c 2c 3c +\fBproc add2 name { + upvar $name x + set x [expr $x+2] +} +.DE +\fBAdd2\fR is invoked with an argument giving the name of a variable, +and it adds two to the value of that variable. +Although \fBadd2\fR could have been implemented using \fBuplevel\fR +instead of \fBupvar\fR, \fBupvar\fR makes it simpler for \fBadd2\fR +to access the variable in the caller's procedure frame. +.PP +.VS +If an upvar variable is unset (e.g. \fBx\fR in \fBadd2\fR above), the +\fBunset\fR operation affects the variable it is linked to, not the +upvar variable. There is no way to unset an upvar variable except +by exiting the procedure in which it is defined. However, it is +possible to retarget an upvar variable by executing another \fBupvar\fR +command. +.VE + +.SH KEYWORDS +context, frame, global, level, procedure, variable diff --git a/vendor/x11iraf/obm/Tcl/doc/while.n b/vendor/x11iraf/obm/Tcl/doc/while.n new file mode 100644 index 00000000..f1687621 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/doc/while.n @@ -0,0 +1,50 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" All rights reserved. +'\" +'\" Permission is hereby granted, without written agreement and without +'\" license or royalty fees, to use, copy, modify, and distribute this +'\" documentation for any purpose, provided that the above copyright +'\" notice and the following two paragraphs appear in all copies. +'\" +'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY +'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +'\" +'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +'\" +'\" $Header: /user6/ouster/tcl/man/RCS/while.n,v 1.1 93/06/16 16:48:27 ouster Exp $ SPRITE (Berkeley) +'\" +.so man.macros +.HS while tcl +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +while \- Execute script repeatedly as long as a condition is met +.SH SYNOPSIS +\fBwhile \fItest body +.BE + +.SH DESCRIPTION +.PP +The \fIwhile\fR command evaluates \fItest\fR as an expression +(in the same way that \fBexpr\fR evaluates its argument). +The value of the expression must a proper boolean +value; if it is a true value +then \fIbody\fR is executed by passing it to the Tcl interpreter. +Once \fIbody\fR has been executed then \fItest\fR is evaluated +again, and the process repeats until eventually \fItest\fR +evaluates to a false boolean value. \fBContinue\fR +commands may be executed inside \fIbody\fR to terminate the current +iteration of the loop, and \fBbreak\fR +commands may be executed inside \fIbody\fR to cause immediate +termination of the \fBwhile\fR command. The \fBwhile\fR command +always returns an empty string. + +.SH KEYWORDS +boolean value, loop, test, while diff --git a/vendor/x11iraf/obm/Tcl/library/init.tcl b/vendor/x11iraf/obm/Tcl/library/init.tcl new file mode 100644 index 00000000..6edb37be --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/library/init.tcl @@ -0,0 +1,259 @@ +# init.tcl -- +# +# Default system startup file for Tcl-based applications. Defines +# "unknown" procedure and auto-load facilities. +# +# $Header: /user6/ouster/tcl/library/RCS/init.tcl,v 1.28 93/10/08 09:11:21 ouster Exp $ SPRITE (Berkeley) +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# + +set auto_path [info library] + +# unknown: +# Invoked when a Tcl command is invoked that doesn't exist in the +# interpreter: +# +# 1. See if the autoload facility can locate the command in a +# Tcl script file. If so, load it and execute it. +# 2. See if the command exists as an executable UNIX program. +# If so, "exec" the command. +# 3. If the command was invoked at top-level: +# (a) see if the command requests csh-like history substitution +# in one of the common forms !!, !<number>, or ^old^new. If +# so, emulate csh's history substitution. +# (b) see if the command is a unique abbreviation for another +# command. If so, invoke the command. + +proc unknown args { + global auto_noexec auto_noload env unknown_pending tcl_interactive; + + set name [lindex $args 0] + if ![info exists auto_noload] { + # + # Make sure we're not trying to load the same proc twice. + # + if [info exists unknown_pending($name)] { + unset unknown_pending($name) + if {[array size unknown_pending] == 0} { + unset unknown_pending + } + return -code error "self-referential recursion in \"unknown\" for command \"$name\""; + } + set unknown_pending($name) pending; + set ret [catch {auto_load $name} msg] + unset unknown_pending($name); + if {$ret != 0} { + return -code $ret "error while autoloading \"$name\": $msg" + } + if ![array size unknown_pending] { + unset unknown_pending + } + if $msg { + return [uplevel $args] + } + } + if {([info level] == 1) && ([info script] == "") && $tcl_interactive} { + if ![info exists auto_noexec] { + if [auto_execok $name] { + return [uplevel exec >&@stdout <@stdin $args] + } + } + if {$name == "!!"} { + return [uplevel {history redo}] + } + if [regexp {^!(.+)$} $name dummy event] { + return [uplevel [list history redo $event]] + } + if [regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new] { + return [uplevel [list history substitute $old $new]] + } + set cmds [info commands $name*] + if {[llength $cmds] == 1} { + return [uplevel [lreplace $args 0 0 $cmds]] + } + if {[llength $cmds] != 0} { + if {$name == ""} { + return -code error "empty command name \"\"" + } else { + return -code error \ + "ambiguous command name \"$name\": [lsort $cmds]" + } + } + } + return -code error "invalid command name \"$name\"" +} + +# auto_load: +# Checks a collection of library directories to see if a procedure +# is defined in one of them. If so, it sources the appropriate +# library file to create the procedure. Returns 1 if it successfully +# loaded the procedure, 0 otherwise. + +proc auto_load cmd { + global auto_index auto_oldpath auto_path env errorInfo errorCode + + if [info exists auto_index($cmd)] { + uplevel #0 $auto_index($cmd) + return 1 + } + if [catch {set path $auto_path}] { + if [catch {set path $env(TCLLIBPATH)}] { + if [catch {set path [info library]}] { + return 0 + } + } + } + if [info exists auto_oldpath] { + if {$auto_oldpath == $path} { + return 0 + } + } + set auto_oldpath $path + catch {unset auto_index} + for {set i [expr [llength $path] - 1]} {$i >= 0} {incr i -1} { + set dir [lindex $path $i] + set f "" + if [catch {set f [open $dir/tclIndex]}] { + continue + } + set error [catch { + set id [gets $f] + if {$id == "# Tcl autoload index file, version 2.0"} { + eval [read $f] + } elseif {$id == "# Tcl autoload index file: each line identifies a Tcl"} { + while {[gets $f line] >= 0} { + if {([string index $line 0] == "#") + || ([llength $line] != 2)} { + continue + } + set name [lindex $line 0] + set auto_index($name) "source $dir/[lindex $line 1]" + } + } else { + error "$dir/tclIndex isn't a proper Tcl index file" + } + } msg] + if {$f != ""} { + close $f + } + if $error { + error $msg $errorInfo $errorCode + } + } + if [info exists auto_index($cmd)] { + uplevel #0 $auto_index($cmd) + if {[info commands $cmd] != ""} { + return 1 + } + } + return 0 +} + +# auto_execok: +# Returns 1 if there's an executable in the current path for the +# given name, 0 otherwise. Builds an associative array auto_execs +# that caches information about previous checks, for speed. + +proc auto_execok name { + global auto_execs env + + if [info exists auto_execs($name)] { + return $auto_execs($name) + } + set auto_execs($name) 0 + if {[string first / $name] >= 0} { + if {[file executable $name] && ![file isdirectory $name]} { + set auto_execs($name) 1 + } + return $auto_execs($name) + } + foreach dir [split $env(PATH) :] { + if {[file executable $dir/$name] && ![file isdirectory $dir/$name]} { + set auto_execs($name) 1 + return 1 + } + } + return 0 +} + +# auto_reset: +# Destroy all cached information for auto-loading and auto-execution, +# so that the information gets recomputed the next time it's needed. +# Also delete any procedures that are listed in the auto-load index +# except those related to auto-loading. + +proc auto_reset {} { + global auto_execs auto_index auto_oldpath + foreach p [info procs] { + if {[info exists auto_index($p)] && ($p != "unknown") + && ![string match auto_* $p]} { + rename $p {} + } + } + catch {unset auto_execs} + catch {unset auto_index} + catch {unset auto_oldpath} +} + +# auto_mkindex: +# Regenerate a tclIndex file from Tcl source files. Takes as argument +# the name of the directory in which the tclIndex file is to be placed, +# floowed by any number of glob patterns to use in that directory to +# locate all of the relevant files. + +proc auto_mkindex {dir args} { + global errorCode errorInfo + set oldDir [pwd] + cd $dir + set dir [pwd] + append index "# Tcl autoload index file, version 2.0\n" + append index "# This file is generated by the \"auto_mkindex\" command\n" + append index "# and sourced to set up indexing information for one or\n" + append index "# more commands. Typically each line is a command that\n" + append index "# sets an element in the auto_index array, where the\n" + append index "# element name is the name of a command and the value is\n" + append index "# a script that loads the command.\n\n" + foreach file [eval glob $args] { + set f "" + set error [catch { + set f [open $file] + while {[gets $f line] >= 0} { + if [regexp {^proc[ ]+([^ ]*)} $line match procName] { + append index "set [list auto_index($procName)]" + append index " \"source \$dir/$file\"\n" + } + } + close $f + } msg] + if $error { + set code $errorCode + set info $errorInfo + catch {close $f} + cd $oldDir + error $msg $info $code + } + } + set f [open tclIndex w] + puts $f $index nonewline + close $f + cd $oldDir +} diff --git a/vendor/x11iraf/obm/Tcl/library/parray.tcl b/vendor/x11iraf/obm/Tcl/library/parray.tcl new file mode 100644 index 00000000..b4c9f2dc --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/library/parray.tcl @@ -0,0 +1,43 @@ +# parray: +# Print the contents of a global array on stdout. +# +# $Header: /user6/ouster/tcl/library/RCS/parray.tcl,v 1.5 93/02/06 16:33:45 ouster Exp $ SPRITE (Berkeley) +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# + +proc parray a { + upvar 1 $a array + if [catch {array size array}] { + error "\"$a\" isn't an array" + } + set maxl 0 + foreach name [lsort [array names array]] { + if {[string length $name] > $maxl} { + set maxl [string length $name] + } + } + set maxl [expr {$maxl + [string length $a] + 2}] + foreach name [lsort [array names array]] { + set nameString [format %s(%s) $a $name] + puts stdout [format "%-*s = %s" $maxl $nameString $array($name)] + } +} diff --git a/vendor/x11iraf/obm/Tcl/library/tclIndex b/vendor/x11iraf/obm/Tcl/library/tclIndex new file mode 100644 index 00000000..ad036dcd --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/library/tclIndex @@ -0,0 +1,14 @@ +# Tcl autoload index file, version 2.0 +# This file is generated by the "auto_mkindex" command +# and sourced to set up indexing information for one or +# more commands. Typically each line is a command that +# sets an element in the auto_index array, where the +# element name is the name of a command and the value is +# a script that loads the command. + +set auto_index(unknown) "source $dir/init.tcl" +set auto_index(auto_load) "source $dir/init.tcl" +set auto_index(auto_execok) "source $dir/init.tcl" +set auto_index(auto_reset) "source $dir/init.tcl" +set auto_index(auto_mkindex) "source $dir/init.tcl" +set auto_index(parray) "source $dir/parray.tcl" diff --git a/vendor/x11iraf/obm/Tcl/panic.c b/vendor/x11iraf/obm/Tcl/panic.c new file mode 100644 index 00000000..fa994812 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/panic.c @@ -0,0 +1,69 @@ +/* + * panic.c -- + * + * Source code for the "panic" library procedure for Tcl; + * individual applications will probably override this with + * an application-specific panic procedure. + * + * Copyright (c) 1988-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/panic.c,v 1.5 93/07/12 14:01:35 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include <stdio.h> +#ifdef NO_STDLIB_H +# include "compat/stdlib.h" +#else +# include <stdlib.h> +#endif + +/* + *---------------------------------------------------------------------- + * + * panic -- + * + * Print an error message and kill the process. + * + * Results: + * None. + * + * Side effects: + * The process dies, entering the debugger if possible. + * + *---------------------------------------------------------------------- + */ + + /* VARARGS ARGSUSED */ +void +panic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + char *format; /* Format string, suitable for passing to + * fprintf. */ + char *arg1, *arg2, *arg3; /* Additional arguments (variable in number) + * to pass to fprintf. */ + char *arg4, *arg5, *arg6, *arg7, *arg8; +{ + (void) fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6, + arg7, arg8); + (void) fflush(stderr); + abort(); +} diff --git a/vendor/x11iraf/obm/Tcl/patchlevel.h b/vendor/x11iraf/obm/Tcl/patchlevel.h new file mode 100644 index 00000000..24e4a0a1 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/patchlevel.h @@ -0,0 +1,11 @@ +/* + * patchlevel.h -- + * + * This file does nothing except define a "patch level" for Tcl. + * The patch level is an integer that increments with each new + * release or patch release. It's used to make sure that Tcl + * patches are applied in the correct order and only to appropriate + * sources. + */ + +#define TCL_PATCH_LEVEL 106 diff --git a/vendor/x11iraf/obm/Tcl/porting.notes b/vendor/x11iraf/obm/Tcl/porting.notes new file mode 100644 index 00000000..5e338757 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/porting.notes @@ -0,0 +1,214 @@ +This file contains a collection of notes that various people have +provided about porting Tcl to various machines and operating systems. +I don't have personal access to any of these machines, so I make +no guarantees that the notes are correct, complete, or up-to-date. +In some cases, a person has volunteered to act as a contact point +for questions about porting Tcl to a particular machine; in these +cases the person's name and e-mail address are listed. + +--------------------------------------------- +Cray machines running UNICOS: +Contact: John Freeman (jlf@cray.com) +--------------------------------------------- + +1. There is an error in the strstr function in UNICOS such that if the +string to be searched is empty (""), the search will continue past the +end of the string. Because of this, the history substitution loop +will sometimes run past the end of its target string and trash +malloc's free list, resulting in a core dump some time later. (As you +can probably guess, this took a while to diagnose.) I've submitted a +problem report to the C library maintainers, but in the meantime here +is a workaround. + +----------------------------------------------------------------- +diff -c1 -r1.1 tclHistory.c +*** 1.1 1991/11/12 16:01:58 +--- tclHistory.c 1991/11/12 16:14:22 +*************** +*** 23,24 **** +--- 23,29 ---- + #include "tclInt.h" ++ ++ #ifdef _CRAY ++ /* There is a bug in strstr in UNICOS; this works around it. */ ++ #define strstr(s1,s2) ((s1)?(*(s1)?strstr((s1),(s2)):0):0) ++ #endif _CRAY + +--------------------------------------------- +MIPS systems runing EP/IX: +--------------------------------------------- + +1. Need to add a line "#include <bsd/sys/time.h>" in tclUnix.h. + +2. Need to add "-lbsd" into the line that makes tclTest: + + ${CC} ${CFLAGS} tclTest.o libtcl.a -lbsd -o tclTest + +--------------------------------------------- +IBM RS/6000 systems running AIX: +--------------------------------------------- + +1. The system version of strtoul is buggy, at least under some +versions of AIX. If the expression tests fail, try forcing Tcl +to use its own version of strtoul instead of the system version. +To do this, first copy strtoul.c from the compat subdirectory up +to the main Tcl directory. Then modify the Makefile so that +the definition for COMPAT_OBJS includes "strtoul.o". Note: the +"config" script should now detect the buggy strtoul and substitute +Tcl's version automatically. + +2. You may have to comment out the declaration of open in tclUnix.h. + +3. You may need to add "-D_BSD -lbsd" to the CFLAGS definition. This +causes the system include files to look like BSD include files and +causes C library routines to act like bsd library routines. Without +this, the system may choke on "struct wait". + +--------------------------------------------- +AT&T 4.03 OS: +--------------------------------------------- + +Machine: i386/33Mhz i387 32k Cache 16MByte +OS: AT&T SYSV Release 4 Version 3 +X: X11R5 fixlevel 9 +Xserver: X386 1.2 + +1. Change the Tk Makefile as follows: +XLIB = -lX11 + should be changed to: +XLIB = -lX11 -lsocket -lnsl + +------------------------------------------------------- +Silicon Graphics systems: +------------------------------------------------------- + +1. Change the CC variable in the Makefile to: + +CC = cc -xansi -D__STDC__ -signed + +2. In Irix releases 4.0.1 or earlier the C compiler has a buggy optimizer. + If Tcl fails its test suite or generates inexplicable errors, + compile tclVar.c with -O0 instead of -O. + +3. For IRIX 5.1 or later, comments 1 and 2 are no longer relevant, +but you must add -D_BSD_SIGNALS to CFLAGS to get the proper signal +routines. + +4. Add a "-lsun" switch in the targets for tclsh and tcltest, +just before ${MATH_LIBS}. + +--------------------------------------------- +NeXT machines running NeXTStep 3.1: +--------------------------------------------- + +1. Run configure with predefined CPP: + CPP='cc -E' ./configure + +2. Edit Makefile: + -add tmpnam.o to COMPAT_OBJS: + COMPAT_OBJS = getcwd.o waitpid.o strtod.o tmpnam.o + -add '-m' to MATH_LIBS + MATH_LIBS = -m -lm + +3. Edit compat/tmpnam.o and replace "/usr/tmp" with "/tmp" + +After this, tcl7.0 will be build fine on NeXT (ignore linker warning) +and run all the tests. There are some formatting problems in printf() or +scanf() which come from NeXT's lacking POSIX conformance. Ignore those +errors, they don't matter much. + +------------------------------------------------- +ISC 2.2 UNIX (using standard ATT SYSV compiler): +------------------------------------------------- + +In Makefile, change + +CFLAGS = -g -I. -DTCL_LIBRARY=\"${TCL_LIBRARY}\" + +to + +CFLAGS = -g -I. -DPOSIX_JC -DTCL_LIBRARY=\"${TCL_LIBRARY}\" + +This brings in the typedef for pid_t, which is needed for +/usr/include/sys/wait.h in tclUnix.h. + +--------------------------------------------- +DEC Alphas: +--------------------------------------------- + +1. There appears to be a compiler/library bug that causes core-dumps +unless you compile tclVar.c without optimization (remove the -O compiler +switch). The problem appears to have been fixed in the 1.3-4 version +of the compiler. + +--------------------------------------------- +CDC 4680MNP, EP/IX 1.4.3: +--------------------------------------------- + +The installation was done in the System V environment (-systype sysv) +with the BSD extensions available (-I/usr/include/bsd and -lbsd). It was +built with the 2.20 level C compiler. The 2.11 level should not be used +because it has a problem with detecting NaN values in lines like: + if (x != x) ... +which appear in the TCL code. + +To make the configure script find the BSD extensions, I set environment +variable DEFS to "-I/usr/include/bsd" and LIBS to "-lbsd" before +running it. I would have also set CC to "cc2.20", but that compiler +driver has a bug that loader errors (e.g. not finding a library routine, +which the script uses to tell what is available) do not cause an error +status to be returned to the shell. + +There is a bug in the <sys/wait.h> include file that mis-defines the +structure fields and causes WIFEXITED and WIFSIGNALED to return incorrect +values. My solution was to create a subdirectory "sys" of the main TCL +source directory and put a corrected wait.h in it. The "-I." already on +all the compile lines causes it to be used instead of the system version. +To fix this, compare the structure definition in /usr/include/bsd/sys/wait.h +with /bsd43/include/sys/wait.h (or mail to John Jackson, jrj@cc.purdue.edu, +and he'll send you a context diff). + +After running configure, I made the following changes to Makefile: + + 1) In AC_FLAGS, change: + -DNO_WAIT3=1 + to + -DNO_WAIT3=0 -Dwait3=wait2 + EP/IX (in the System V environment) provides a wait2() system + call with what TCL needs (the WNOHANG flag). The extra parameter + TCL passes to what it thinks is wait3() (the resources used by + the child process) is always zero and will be safely ignored. + + 3) Change: + CC=cc + to + CC=cc2.20 + because of the NaN problem mentioned earlier. Skip this if the + default compiler is already 2.20 (or later). + + 4) Add "-lbsd" to the commands that create tclsh and tcltest + (look for "-o"). + +--------------------------------------------- +Convex systems, OS 10.1 and 10.2: +Contact: Lennart Sorth (ls@dmi.min.dk) +--------------------------------------------- + +1. tcl7.0b2 compiles on Convex systems (OS 10.1 and 10.2) by just running + configure, typing make, except tclUnixUtil.c needs to be compiled + with option "-pcc" (portable cc, =!ANSI) due to: + cc: Error on line 1111 of tclUnixUtil.c: 'waitpid' redeclared: + incompatible types. + +------------------------------------------------- +Pyramid, OSx 5.1a (UCB universe, GCC installed): +------------------------------------------------- + +1. The procedures memcpy, strchr, fmod, and strrchr are all missing, +so you'll need to provide substitutes for them. After you do that +everything should compile fine. There will be one error in a scan +test, but it's an obscure one because of a non-ANSI implementation +of sscanf on the machine; you can ignore it. + +2. You may also have to add "tmpnam.o" to COMPAT_OBJS in Makefile: +the system version appears to be bad. diff --git a/vendor/x11iraf/obm/Tcl/regexp.c b/vendor/x11iraf/obm/Tcl/regexp.c new file mode 100644 index 00000000..6dc0e291 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/regexp.c @@ -0,0 +1,1233 @@ +/* + * TclRegComp and TclRegExec -- TclRegSub and TclRegError are elsewhere + * + * Copyright (c) 1986 by University of Toronto. + * Written by Henry Spencer. Not derived from licensed software. + * + * Permission is granted to anyone to use this software for any + * purpose on any computer system, and to redistribute it freely, + * subject to the following restrictions: + * + * 1. The author is not responsible for the consequences of use of + * this software, no matter how awful, even if they arise + * from defects in it. + * + * 2. The origin of this software must not be misrepresented, either + * by explicit claim or by omission. + * + * 3. Altered versions must be plainly marked as such, and must not + * be misrepresented as being the original software. + * + * Beware that some of this code is subtly aware of the way operator + * precedence is structured in regular expressions. Serious changes in + * regular-expression syntax might require a total rethink. + * + * *** NOTE: this code has been altered slightly for use in Tcl: *** + * *** 1. Use ckalloc and ckfree instead of malloc and free. *** + * *** 2. Add extra argument to regexp to specify the real *** + * *** start of the string separately from the start of the *** + * *** current search. This is needed to search for multiple *** + * *** matches within a string. *** + * *** 3. Names have been changed, e.g. from regcomp to *** + * *** TclRegComp, to avoid clashes with other *** + * *** regexp implementations used by applications. *** + */ +#include "tclInt.h" + +/* + * The "internal use only" fields in regexp.h are present to pass info from + * compile to execute that permits the execute phase to run lots faster on + * simple cases. They are: + * + * regstart char that must begin a match; '\0' if none obvious + * reganch is the match anchored (at beginning-of-line only)? + * regmust string (pointer into program) that match must include, or NULL + * regmlen length of regmust string + * + * Regstart and reganch permit very fast decisions on suitable starting points + * for a match, cutting down the work a lot. Regmust permits fast rejection + * of lines that cannot possibly match. The regmust tests are costly enough + * that TclRegComp() supplies a regmust only if the r.e. contains something + * potentially expensive (at present, the only such thing detected is * or + + * at the start of the r.e., which can involve a lot of backup). Regmlen is + * supplied because the test in TclRegExec() needs it and TclRegComp() is + * computing it anyway. + */ + +/* + * Structure for regexp "program". This is essentially a linear encoding + * of a nondeterministic finite-state machine (aka syntax charts or + * "railroad normal form" in parsing technology). Each node is an opcode + * plus a "next" pointer, possibly plus an operand. "Next" pointers of + * all nodes except BRANCH implement concatenation; a "next" pointer with + * a BRANCH on both ends of it is connecting two alternatives. (Here we + * have one of the subtle syntax dependencies: an individual BRANCH (as + * opposed to a collection of them) is never concatenated with anything + * because of operator precedence.) The operand of some types of node is + * a literal string; for others, it is a node leading into a sub-FSM. In + * particular, the operand of a BRANCH node is the first node of the branch. + * (NB this is *not* a tree structure: the tail of the branch connects + * to the thing following the set of BRANCHes.) The opcodes are: + */ + +/* definition number opnd? meaning */ +#define END 0 /* no End of program. */ +#define BOL 1 /* no Match "" at beginning of line. */ +#define EOL 2 /* no Match "" at end of line. */ +#define ANY 3 /* no Match any one character. */ +#define ANYOF 4 /* str Match any character in this string. */ +#define ANYBUT 5 /* str Match any character not in this string. */ +#define BRANCH 6 /* node Match this alternative, or the next... */ +#define BACK 7 /* no Match "", "next" ptr points backward. */ +#define EXACTLY 8 /* str Match this string. */ +#define NOTHING 9 /* no Match empty string. */ +#define STAR 10 /* node Match this (simple) thing 0 or more times. */ +#define PLUS 11 /* node Match this (simple) thing 1 or more times. */ +#define OPEN 20 /* no Mark this point in input as start of #n. */ + /* OPEN+1 is number 1, etc. */ +#define CLOSE 30 /* no Analogous to OPEN. */ + +/* + * Opcode notes: + * + * BRANCH The set of branches constituting a single choice are hooked + * together with their "next" pointers, since precedence prevents + * anything being concatenated to any individual branch. The + * "next" pointer of the last BRANCH in a choice points to the + * thing following the whole choice. This is also where the + * final "next" pointer of each individual branch points; each + * branch starts with the operand node of a BRANCH node. + * + * BACK Normal "next" pointers all implicitly point forward; BACK + * exists to make loop structures possible. + * + * STAR,PLUS '?', and complex '*' and '+', are implemented as circular + * BRANCH structures using BACK. Simple cases (one character + * per match) are implemented with STAR and PLUS for speed + * and to minimize recursive plunges. + * + * OPEN,CLOSE ...are numbered at compile time. + */ + +/* + * A node is one char of opcode followed by two chars of "next" pointer. + * "Next" pointers are stored as two 8-bit pieces, high order first. The + * value is a positive offset from the opcode of the node containing it. + * An operand, if any, simply follows the node. (Note that much of the + * code generation knows about this implicit relationship.) + * + * Using two bytes for the "next" pointer is vast overkill for most things, + * but allows patterns to get big without disasters. + */ +#define OP(p) (*(p)) +#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) +#define OPERAND(p) ((p) + 3) + +/* + * See regmagic.h for one further detail of program structure. + */ + + +/* + * Utility definitions. + */ +#ifndef CHARBITS +#define UCHARAT(p) ((int)*(unsigned char *)(p)) +#else +#define UCHARAT(p) ((int)*(p)&CHARBITS) +#endif + +#define FAIL(m) { TclRegError(m); return(NULL); } +#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') +#define META "^$.[()|?+*\\" + +/* + * Flags to be passed up and down. + */ +#define HASWIDTH 01 /* Known never to match null string. */ +#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ +#define SPSTART 04 /* Starts with * or +. */ +#define WORST 0 /* Worst case. */ + +/* + * Global work variables for TclRegComp(). + */ +static char *regparse; /* Input-scan pointer. */ +static int regnpar; /* () count. */ +static char regdummy; +static char *regcode; /* Code-emit pointer; &regdummy = don't. */ +static long regsize; /* Code size. */ + +/* + * The first byte of the regexp internal "program" is actually this magic + * number; the start node begins in the second byte. + */ +#define MAGIC 0234 + + +/* + * Forward declarations for TclRegComp()'s friends. + */ +#ifndef STATIC +#define STATIC static +#endif +STATIC char *reg(); +STATIC char *regbranch(); +STATIC char *regpiece(); +STATIC char *regatom(); +STATIC char *regnode(); +STATIC char *regnext(); +STATIC void regc(); +STATIC void reginsert(); +STATIC void regtail(); +STATIC void regoptail(); +#ifdef STRCSPN +STATIC int strcspn(); +#endif + +/* + - TclRegComp - compile a regular expression into internal code + * + * We can't allocate space until we know how big the compiled form will be, + * but we can't compile it (and thus know how big it is) until we've got a + * place to put the code. So we cheat: we compile it twice, once with code + * generation turned off and size counting turned on, and once "for real". + * This also means that we don't allocate space until we are sure that the + * thing really will compile successfully, and we never have to move the + * code and thus invalidate pointers into it. (Note that it has to be in + * one piece because free() must be able to free it all.) + * + * Beware that the optimization-preparation code in here knows about some + * of the structure of the compiled regexp. + */ +regexp * +TclRegComp(exp) +char *exp; +{ + register regexp *r; + register char *scan; + register char *longest; + register int len; + int flags; + + if (exp == NULL) + FAIL("NULL argument"); + + /* First pass: determine size, legality. */ + regparse = exp; + regnpar = 1; + regsize = 0L; + regcode = &regdummy; + regc(MAGIC); + if (reg(0, &flags) == NULL) + return(NULL); + + /* Small enough for pointer-storage convention? */ + if (regsize >= 32767L) /* Probably could be 65535L. */ + FAIL("regexp too big"); + + /* Allocate space. */ + r = (regexp *)ckalloc(sizeof(regexp) + (unsigned)regsize); + if (r == NULL) + FAIL("out of space"); + + /* Second pass: emit code. */ + regparse = exp; + regnpar = 1; + regcode = r->program; + regc(MAGIC); + if (reg(0, &flags) == NULL) + return(NULL); + + /* Dig out information for optimizations. */ + r->regstart = '\0'; /* Worst-case defaults. */ + r->reganch = 0; + r->regmust = NULL; + r->regmlen = 0; + scan = r->program+1; /* First BRANCH. */ + if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ + scan = OPERAND(scan); + + /* Starting-point info. */ + if (OP(scan) == EXACTLY) + r->regstart = *OPERAND(scan); + else if (OP(scan) == BOL) + r->reganch++; + + /* + * If there's something expensive in the r.e., find the + * longest literal string that must appear and make it the + * regmust. Resolve ties in favor of later strings, since + * the regstart check works with the beginning of the r.e. + * and avoiding duplication strengthens checking. Not a + * strong reason, but sufficient in the absence of others. + */ + if (flags&SPSTART) { + longest = NULL; + len = 0; + for (; scan != NULL; scan = regnext(scan)) + if (OP(scan) == EXACTLY && ((int) strlen(OPERAND(scan))) >= len) { + longest = OPERAND(scan); + len = strlen(OPERAND(scan)); + } + r->regmust = longest; + r->regmlen = len; + } + } + + return(r); +} + +/* + - reg - regular expression, i.e. main body or parenthesized thing + * + * Caller must absorb opening parenthesis. + * + * Combining parenthesis handling with the base level of regular expression + * is a trifle forced, but the need to tie the tails of the branches to what + * follows makes it hard to avoid. + */ +static char * +reg(paren, flagp) +int paren; /* Parenthesized? */ +int *flagp; +{ + register char *ret; + register char *br; + register char *ender; + register int parno = 0; + int flags; + + *flagp = HASWIDTH; /* Tentatively. */ + + /* Make an OPEN node, if parenthesized. */ + if (paren) { + if (regnpar >= NSUBEXP) + FAIL("too many ()"); + parno = regnpar; + regnpar++; + ret = regnode(OPEN+parno); + } else + ret = NULL; + + /* Pick up the branches, linking them together. */ + br = regbranch(&flags); + if (br == NULL) + return(NULL); + if (ret != NULL) + regtail(ret, br); /* OPEN -> first. */ + else + ret = br; + if (!(flags&HASWIDTH)) + *flagp &= ~HASWIDTH; + *flagp |= flags&SPSTART; + while (*regparse == '|') { + regparse++; + br = regbranch(&flags); + if (br == NULL) + return(NULL); + regtail(ret, br); /* BRANCH -> BRANCH. */ + if (!(flags&HASWIDTH)) + *flagp &= ~HASWIDTH; + *flagp |= flags&SPSTART; + } + + /* Make a closing node, and hook it on the end. */ + ender = regnode((paren) ? CLOSE+parno : END); + regtail(ret, ender); + + /* Hook the tails of the branches to the closing node. */ + for (br = ret; br != NULL; br = regnext(br)) + regoptail(br, ender); + + /* Check for proper termination. */ + if (paren && *regparse++ != ')') { + FAIL("unmatched ()"); + } else if (!paren && *regparse != '\0') { + if (*regparse == ')') { + FAIL("unmatched ()"); + } else + FAIL("junk on end"); /* "Can't happen". */ + /* NOTREACHED */ + } + + return(ret); +} + +/* + - regbranch - one alternative of an | operator + * + * Implements the concatenation operator. + */ +static char * +regbranch(flagp) +int *flagp; +{ + register char *ret; + register char *chain; + register char *latest; + int flags; + + *flagp = WORST; /* Tentatively. */ + + ret = regnode(BRANCH); + chain = NULL; + while (*regparse != '\0' && *regparse != '|' && *regparse != ')') { + latest = regpiece(&flags); + if (latest == NULL) + return(NULL); + *flagp |= flags&HASWIDTH; + if (chain == NULL) /* First piece. */ + *flagp |= flags&SPSTART; + else + regtail(chain, latest); + chain = latest; + } + if (chain == NULL) /* Loop ran zero times. */ + (void) regnode(NOTHING); + + return(ret); +} + +/* + - regpiece - something followed by possible [*+?] + * + * Note that the branching code sequences used for ? and the general cases + * of * and + are somewhat optimized: they use the same NOTHING node as + * both the endmarker for their branch list and the body of the last branch. + * It might seem that this node could be dispensed with entirely, but the + * endmarker role is not redundant. + */ +static char * +regpiece(flagp) +int *flagp; +{ + register char *ret; + register char op; + register char *next; + int flags; + + ret = regatom(&flags); + if (ret == NULL) + return(NULL); + + op = *regparse; + if (!ISMULT(op)) { + *flagp = flags; + return(ret); + } + + if (!(flags&HASWIDTH) && op != '?') + FAIL("*+ operand could be empty"); + *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); + + if (op == '*' && (flags&SIMPLE)) + reginsert(STAR, ret); + else if (op == '*') { + /* Emit x* as (x&|), where & means "self". */ + reginsert(BRANCH, ret); /* Either x */ + regoptail(ret, regnode(BACK)); /* and loop */ + regoptail(ret, ret); /* back */ + regtail(ret, regnode(BRANCH)); /* or */ + regtail(ret, regnode(NOTHING)); /* null. */ + } else if (op == '+' && (flags&SIMPLE)) + reginsert(PLUS, ret); + else if (op == '+') { + /* Emit x+ as x(&|), where & means "self". */ + next = regnode(BRANCH); /* Either */ + regtail(ret, next); + regtail(regnode(BACK), ret); /* loop back */ + regtail(next, regnode(BRANCH)); /* or */ + regtail(ret, regnode(NOTHING)); /* null. */ + } else if (op == '?') { + /* Emit x? as (x|) */ + reginsert(BRANCH, ret); /* Either x */ + regtail(ret, regnode(BRANCH)); /* or */ + next = regnode(NOTHING); /* null. */ + regtail(ret, next); + regoptail(ret, next); + } + regparse++; + if (ISMULT(*regparse)) + FAIL("nested *?+"); + + return(ret); +} + +/* + - regatom - the lowest level + * + * Optimization: gobbles an entire sequence of ordinary characters so that + * it can turn them into a single node, which is smaller to store and + * faster to run. Backslashed characters are exceptions, each becoming a + * separate node; the code is simpler that way and it's not worth fixing. + */ +static char * +regatom(flagp) +int *flagp; +{ + register char *ret; + int flags; + + *flagp = WORST; /* Tentatively. */ + + switch (*regparse++) { + case '^': + ret = regnode(BOL); + break; + case '$': + ret = regnode(EOL); + break; + case '.': + ret = regnode(ANY); + *flagp |= HASWIDTH|SIMPLE; + break; + case '[': { + register int clss; + register int classend; + + if (*regparse == '^') { /* Complement of range. */ + ret = regnode(ANYBUT); + regparse++; + } else + ret = regnode(ANYOF); + if (*regparse == ']' || *regparse == '-') + regc(*regparse++); + while (*regparse != '\0' && *regparse != ']') { + if (*regparse == '-') { + regparse++; + if (*regparse == ']' || *regparse == '\0') + regc('-'); + else { + clss = UCHARAT(regparse-2)+1; + classend = UCHARAT(regparse); + if (clss > classend+1) + FAIL("invalid [] range"); + for (; clss <= classend; clss++) + regc(clss); + regparse++; + } + } else + regc(*regparse++); + } + regc('\0'); + if (*regparse != ']') + FAIL("unmatched []"); + regparse++; + *flagp |= HASWIDTH|SIMPLE; + } + break; + case '(': + ret = reg(1, &flags); + if (ret == NULL) + return(NULL); + *flagp |= flags&(HASWIDTH|SPSTART); + break; + case '\0': + case '|': + case ')': + FAIL("internal urp"); /* Supposed to be caught earlier. */ + /* NOTREACHED */ + break; + case '?': + case '+': + case '*': + FAIL("?+* follows nothing"); + /* NOTREACHED */ + break; + case '\\': + if (*regparse == '\0') + FAIL("trailing \\"); + ret = regnode(EXACTLY); + regc(*regparse++); + regc('\0'); + *flagp |= HASWIDTH|SIMPLE; + break; + default: { + register int len; + register char ender; + + regparse--; + len = strcspn(regparse, META); + if (len <= 0) + FAIL("internal disaster"); + ender = *(regparse+len); + if (len > 1 && ISMULT(ender)) + len--; /* Back off clear of ?+* operand. */ + *flagp |= HASWIDTH; + if (len == 1) + *flagp |= SIMPLE; + ret = regnode(EXACTLY); + while (len > 0) { + regc(*regparse++); + len--; + } + regc('\0'); + } + break; + } + + return(ret); +} + +/* + - regnode - emit a node + */ +static char * /* Location. */ +regnode(op) +char op; +{ + register char *ret; + register char *ptr; + + ret = regcode; + if (ret == &regdummy) { + regsize += 3; + return(ret); + } + + ptr = ret; + *ptr++ = op; + *ptr++ = '\0'; /* Null "next" pointer. */ + *ptr++ = '\0'; + regcode = ptr; + + return(ret); +} + +/* + - regc - emit (if appropriate) a byte of code + */ +static void +regc(b) +char b; +{ + if (regcode != &regdummy) + *regcode++ = b; + else + regsize++; +} + +/* + - reginsert - insert an operator in front of already-emitted operand + * + * Means relocating the operand. + */ +static void +reginsert(op, opnd) +char op; +char *opnd; +{ + register char *src; + register char *dst; + register char *place; + + if (regcode == &regdummy) { + regsize += 3; + return; + } + + src = regcode; + regcode += 3; + dst = regcode; + while (src > opnd) + *--dst = *--src; + + place = opnd; /* Op node, where operand used to be. */ + *place++ = op; + *place++ = '\0'; + *place++ = '\0'; +} + +/* + - regtail - set the next-pointer at the end of a node chain + */ +static void +regtail(p, val) +char *p; +char *val; +{ + register char *scan; + register char *temp; + register int offset; + + if (p == &regdummy) + return; + + /* Find last node. */ + scan = p; + for (;;) { + temp = regnext(scan); + if (temp == NULL) + break; + scan = temp; + } + + if (OP(scan) == BACK) + offset = scan - val; + else + offset = val - scan; + *(scan+1) = (offset>>8)&0377; + *(scan+2) = offset&0377; +} + +/* + - regoptail - regtail on operand of first argument; nop if operandless + */ +static void +regoptail(p, val) +char *p; +char *val; +{ + /* "Operandless" and "op != BRANCH" are synonymous in practice. */ + if (p == NULL || p == &regdummy || OP(p) != BRANCH) + return; + regtail(OPERAND(p), val); +} + +/* + * TclRegExec and friends + */ + +/* + * Global work variables for TclRegExec(). + */ +static char *reginput; /* String-input pointer. */ +static char *regbol; /* Beginning of input, for ^ check. */ +static char **regstartp; /* Pointer to startp array. */ +static char **regendp; /* Ditto for endp. */ + +/* + * Forwards. + */ +STATIC int regtry(); +STATIC int regmatch(); +STATIC int regrepeat(); + +#ifdef DEBUG +int regnarrate = 0; +void regdump(); +STATIC char *regprop(); +#endif + +/* + - TclRegExec - match a regexp against a string + */ +int +TclRegExec(prog, string, start) +register regexp *prog; +register char *string; +char *start; +{ + register char *s; + + /* Be paranoid... */ + if (prog == NULL || string == NULL) { + TclRegError("NULL parameter"); + return(0); + } + + /* Check validity of program. */ + if (UCHARAT(prog->program) != MAGIC) { + TclRegError("corrupted program"); + return(0); + } + + /* If there is a "must appear" string, look for it. */ + if (prog->regmust != NULL) { + s = string; + while ((s = strchr(s, prog->regmust[0])) != NULL) { + if (strncmp(s, prog->regmust, prog->regmlen) == 0) + break; /* Found it. */ + s++; + } + if (s == NULL) /* Not present. */ + return(0); + } + + /* Mark beginning of line for ^ . */ + regbol = start; + + /* Simplest case: anchored match need be tried only once. */ + if (prog->reganch) + return(regtry(prog, string)); + + /* Messy cases: unanchored match. */ + s = string; + if (prog->regstart != '\0') + /* We know what char it must start with. */ + while ((s = strchr(s, prog->regstart)) != NULL) { + if (regtry(prog, s)) + return(1); + s++; + } + else + /* We don't -- general case. */ + do { + if (regtry(prog, s)) + return(1); + } while (*s++ != '\0'); + + /* Failure. */ + return(0); +} + +/* + - regtry - try match at specific point + */ +static int /* 0 failure, 1 success */ +regtry(prog, string) +regexp *prog; +char *string; +{ + register int i; + register char **sp; + register char **ep; + + reginput = string; + regstartp = prog->startp; + regendp = prog->endp; + + sp = prog->startp; + ep = prog->endp; + for (i = NSUBEXP; i > 0; i--) { + *sp++ = NULL; + *ep++ = NULL; + } + if (regmatch(prog->program + 1)) { + prog->startp[0] = string; + prog->endp[0] = reginput; + return(1); + } else + return(0); +} + +/* + - regmatch - main matching routine + * + * Conceptually the strategy is simple: check to see whether the current + * node matches, call self recursively to see whether the rest matches, + * and then act accordingly. In practice we make some effort to avoid + * recursion, in particular by going through "ordinary" nodes (that don't + * need to know whether the rest of the match failed) by a loop instead of + * by recursion. + */ +static int /* 0 failure, 1 success */ +regmatch(prog) +char *prog; +{ + register char *scan; /* Current node. */ + char *next; /* Next node. */ + + scan = prog; +#ifdef DEBUG + if (scan != NULL && regnarrate) + fprintf(stderr, "%s(\n", regprop(scan)); +#endif + while (scan != NULL) { +#ifdef DEBUG + if (regnarrate) + fprintf(stderr, "%s...\n", regprop(scan)); +#endif + next = regnext(scan); + + switch (OP(scan)) { + case BOL: + if (reginput != regbol) + return(0); + break; + case EOL: + if (*reginput != '\0') + return(0); + break; + case ANY: + if (*reginput == '\0') + return(0); + reginput++; + break; + case EXACTLY: { + register int len; + register char *opnd; + + opnd = OPERAND(scan); + /* Inline the first character, for speed. */ + if (*opnd != *reginput) + return(0); + len = strlen(opnd); + if (len > 1 && strncmp(opnd, reginput, len) != 0) + return(0); + reginput += len; + } + break; + case ANYOF: + if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL) + return(0); + reginput++; + break; + case ANYBUT: + if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL) + return(0); + reginput++; + break; + case NOTHING: + break; + case BACK: + break; + case OPEN+1: + case OPEN+2: + case OPEN+3: + case OPEN+4: + case OPEN+5: + case OPEN+6: + case OPEN+7: + case OPEN+8: + case OPEN+9: { + register int no; + register char *save; + + no = OP(scan) - OPEN; + save = reginput; + + if (regmatch(next)) { + /* + * Don't set startp if some later + * invocation of the same parentheses + * already has. + */ + if (regstartp[no] == NULL) + regstartp[no] = save; + return(1); + } else + return(0); + } + /* NOTREACHED */ + break; + case CLOSE+1: + case CLOSE+2: + case CLOSE+3: + case CLOSE+4: + case CLOSE+5: + case CLOSE+6: + case CLOSE+7: + case CLOSE+8: + case CLOSE+9: { + register int no; + register char *save; + + no = OP(scan) - CLOSE; + save = reginput; + + if (regmatch(next)) { + /* + * Don't set endp if some later + * invocation of the same parentheses + * already has. + */ + if (regendp[no] == NULL) + regendp[no] = save; + return(1); + } else + return(0); + } + /* NOTREACHED */ + break; + case BRANCH: { + register char *save; + + if (OP(next) != BRANCH) /* No choice. */ + next = OPERAND(scan); /* Avoid recursion. */ + else { + do { + save = reginput; + if (regmatch(OPERAND(scan))) + return(1); + reginput = save; + scan = regnext(scan); + } while (scan != NULL && OP(scan) == BRANCH); + return(0); + /* NOTREACHED */ + } + } + /* NOTREACHED */ + break; + case STAR: + case PLUS: { + register char nextch; + register int no; + register char *save; + register int min; + + /* + * Lookahead to avoid useless match attempts + * when we know what character comes next. + */ + nextch = '\0'; + if (OP(next) == EXACTLY) + nextch = *OPERAND(next); + min = (OP(scan) == STAR) ? 0 : 1; + save = reginput; + no = regrepeat(OPERAND(scan)); + while (no >= min) { + /* If it could work, try it. */ + if (nextch == '\0' || *reginput == nextch) + if (regmatch(next)) + return(1); + /* Couldn't or didn't -- back up. */ + no--; + reginput = save + no; + } + return(0); + } + /* NOTREACHED */ + break; + case END: + return(1); /* Success! */ + /* NOTREACHED */ + break; + default: + TclRegError("memory corruption"); + return(0); + /* NOTREACHED */ + break; + } + + scan = next; + } + + /* + * We get here only if there's trouble -- normally "case END" is + * the terminating point. + */ + TclRegError("corrupted pointers"); + return(0); +} + +/* + - regrepeat - repeatedly match something simple, report how many + */ +static int +regrepeat(p) +char *p; +{ + register int count = 0; + register char *scan; + register char *opnd; + + scan = reginput; + opnd = OPERAND(p); + switch (OP(p)) { + case ANY: + count = strlen(scan); + scan += count; + break; + case EXACTLY: + while (*opnd == *scan) { + count++; + scan++; + } + break; + case ANYOF: + while (*scan != '\0' && strchr(opnd, *scan) != NULL) { + count++; + scan++; + } + break; + case ANYBUT: + while (*scan != '\0' && strchr(opnd, *scan) == NULL) { + count++; + scan++; + } + break; + default: /* Oh dear. Called inappropriately. */ + TclRegError("internal foulup"); + count = 0; /* Best compromise. */ + break; + } + reginput = scan; + + return(count); +} + +/* + - regnext - dig the "next" pointer out of a node + */ +static char * +regnext(p) +register char *p; +{ + register int offset; + + if (p == &regdummy) + return(NULL); + + offset = NEXT(p); + if (offset == 0) + return(NULL); + + if (OP(p) == BACK) + return(p-offset); + else + return(p+offset); +} + +#ifdef DEBUG + +STATIC char *regprop(); + +/* + - regdump - dump a regexp onto stdout in vaguely comprehensible form + */ +void +regdump(r) +regexp *r; +{ + register char *s; + register char op = EXACTLY; /* Arbitrary non-END op. */ + register char *next; + + + s = r->program + 1; + while (op != END) { /* While that wasn't END last time... */ + op = OP(s); + printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ + next = regnext(s); + if (next == NULL) /* Next ptr. */ + printf("(0)"); + else + printf("(%d)", (s-r->program)+(next-s)); + s += 3; + if (op == ANYOF || op == ANYBUT || op == EXACTLY) { + /* Literal string, where present. */ + while (*s != '\0') { + putchar(*s); + s++; + } + s++; + } + putchar('\n'); + } + + /* Header fields of interest. */ + if (r->regstart != '\0') + printf("start `%c' ", r->regstart); + if (r->reganch) + printf("anchored "); + if (r->regmust != NULL) + printf("must have \"%s\"", r->regmust); + printf("\n"); +} + +/* + - regprop - printable representation of opcode + */ +static char * +regprop(op) +char *op; +{ + register char *p; + static char buf[50]; + + (void) strcpy(buf, ":"); + + switch (OP(op)) { + case BOL: + p = "BOL"; + break; + case EOL: + p = "EOL"; + break; + case ANY: + p = "ANY"; + break; + case ANYOF: + p = "ANYOF"; + break; + case ANYBUT: + p = "ANYBUT"; + break; + case BRANCH: + p = "BRANCH"; + break; + case EXACTLY: + p = "EXACTLY"; + break; + case NOTHING: + p = "NOTHING"; + break; + case BACK: + p = "BACK"; + break; + case END: + p = "END"; + break; + case OPEN+1: + case OPEN+2: + case OPEN+3: + case OPEN+4: + case OPEN+5: + case OPEN+6: + case OPEN+7: + case OPEN+8: + case OPEN+9: + sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); + p = NULL; + break; + case CLOSE+1: + case CLOSE+2: + case CLOSE+3: + case CLOSE+4: + case CLOSE+5: + case CLOSE+6: + case CLOSE+7: + case CLOSE+8: + case CLOSE+9: + sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); + p = NULL; + break; + case STAR: + p = "STAR"; + break; + case PLUS: + p = "PLUS"; + break; + default: + TclRegError("corrupted opcode"); + break; + } + if (p != NULL) + (void) strcat(buf, p); + return(buf); +} +#endif + +/* + * The following is provided for those people who do not have strcspn() in + * their C libraries. They should get off their butts and do something + * about it; at least one public-domain implementation of those (highly + * useful) string routines has been published on Usenet. + */ +#ifdef STRCSPN +/* + * strcspn - find length of initial segment of s1 consisting entirely + * of characters not from s2 + */ + +static int +strcspn(s1, s2) +char *s1; +char *s2; +{ + register char *scan1; + register char *scan2; + register int count; + + count = 0; + for (scan1 = s1; *scan1 != '\0'; scan1++) { + for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */ + if (*scan1 == *scan2++) + return(count); + count++; + } + return(count); +} +#endif diff --git a/vendor/x11iraf/obm/Tcl/tcl.h b/vendor/x11iraf/obm/Tcl/tcl.h new file mode 100644 index 00000000..5c9288aa --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tcl.h @@ -0,0 +1,649 @@ +/* + * tcl.h -- + * + * This header file describes the externally-visible facilities + * of the Tcl interpreter. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/RCS/tcl.h,v 1.131 93/11/21 14:50:35 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _TCL +#define _TCL + +#ifndef BUFSIZ +#include <stdio.h> +#endif + +#define TCL_VERSION "7.3" +#define TCL_MAJOR_VERSION 7 +#define TCL_MINOR_VERSION 3 + +/* + * Definitions that allow this header file to be used either with or + * without ANSI C features like function prototypes. + */ + +#undef _ANSI_ARGS_ +#undef CONST +#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) +# define _USING_PROTOTYPES_ 1 +# define _ANSI_ARGS_(x) x +# define CONST const +# ifdef __cplusplus +# define VARARGS (...) +# else +# define VARARGS () +# endif +#else +# define _ANSI_ARGS_(x) () +# define CONST +#endif + +#ifdef __cplusplus +# define EXTERN extern "C" +#else +# define EXTERN extern +#endif + +/* + * Macro to use instead of "void" for arguments that must have + * type "void *" in ANSI C; maps them to type "char *" in + * non-ANSI systems. + */ + +#ifndef VOID +# ifdef __STDC__ +# define VOID void +# else +# define VOID char +# endif +#endif + +/* + * Miscellaneous declarations (to allow Tcl to be used stand-alone, + * without the rest of Sprite). + */ + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _CLIENTDATA +# ifdef __STDC__ + typedef void *ClientData; +# else + typedef int *ClientData; +# endif /* __STDC__ */ +#define _CLIENTDATA +#endif + +/* + * Data structures defined opaquely in this module. The definitions + * below just provide dummy types. A few fields are made visible in + * Tcl_Interp structures, namely those for returning string values. + * Note: any change to the Tcl_Interp definition below must be mirrored + * in the "real" definition in tclInt.h. + */ + +typedef struct Tcl_Interp{ + char *result; /* Points to result string returned by last + * command. */ + void (*freeProc) _ANSI_ARGS_((char *blockPtr)); + /* Zero means result is statically allocated. + * If non-zero, gives address of procedure + * to invoke to free the result. Must be + * freed by Tcl_Eval before executing next + * command. */ + int errorLine; /* When TCL_ERROR is returned, this gives + * the line number within the command where + * the error occurred (1 means first line). */ +} Tcl_Interp; + +typedef int *Tcl_Trace; +typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; + +/* + * When a TCL command returns, the string pointer interp->result points to + * a string containing return information from the command. In addition, + * the command procedure returns an integer value, which is one of the + * following: + * + * TCL_OK Command completed normally; interp->result contains + * the command's result. + * TCL_ERROR The command couldn't be completed successfully; + * interp->result describes what went wrong. + * TCL_RETURN The command requests that the current procedure + * return; interp->result contains the procedure's + * return value. + * TCL_BREAK The command requests that the innermost loop + * be exited; interp->result is meaningless. + * TCL_CONTINUE Go on to the next iteration of the current loop; + * interp->result is meaningless. + */ + +#define TCL_OK 0 +#define TCL_ERROR 1 +#define TCL_RETURN 2 +#define TCL_BREAK 3 +#define TCL_CONTINUE 4 + +#define TCL_RESULT_SIZE 200 + +/* + * Argument descriptors for math function callbacks in expressions: + */ + +typedef enum {TCL_INT, TCL_DOUBLE, TCL_EITHER} Tcl_ValueType; +typedef struct Tcl_Value { + Tcl_ValueType type; /* Indicates intValue or doubleValue is + * valid, or both. */ + int intValue; /* Integer value. */ + double doubleValue; /* Double-precision floating value. */ +} Tcl_Value; + +/* + * Procedure types defined by Tcl: + */ + +typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int code)); +typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData)); +typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char *argv[])); +typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc, + ClientData cmdClientData, int argc, char *argv[])); +typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr)); +typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp)); +typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr)); +typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, char *part1, char *part2, int flags)); + +/* + * The structure returned by Tcl_GetCmdInfo and passed into + * Tcl_SetCmdInfo: + */ + +typedef struct Tcl_CmdInfo { + Tcl_CmdProc *proc; /* Procedure that implements command. */ + ClientData clientData; /* ClientData passed to proc. */ + Tcl_CmdDeleteProc *deleteProc; /* Procedure to call when command + * is deleted. */ + ClientData deleteData; /* Value to pass to deleteProc (usually + * the same as clientData). */ +} Tcl_CmdInfo; + +/* + * The structure defined below is used to hold dynamic strings. The only + * field that clients should use is the string field, and they should + * never modify it. + */ + +#define TCL_DSTRING_STATIC_SIZE 200 +typedef struct Tcl_DString { + char *string; /* Points to beginning of string: either + * staticSpace below or a malloc'ed array. */ + int length; /* Number of non-NULL characters in the + * string. */ + int spaceAvl; /* Total number of bytes available for the + * string and its terminating NULL char. */ + char staticSpace[TCL_DSTRING_STATIC_SIZE]; + /* Space to use in common case where string + * is small. */ +} Tcl_DString; + +#define Tcl_DStringLength(dsPtr) ((dsPtr)->length) +#define Tcl_DStringValue(dsPtr) ((dsPtr)->string) + +/* + * Definitions for the maximum number of digits of precision that may + * be specified in the "tcl_precision" variable, and the number of + * characters of buffer space required by Tcl_PrintDouble. + */ + +#define TCL_MAX_PREC 17 +#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10) + +/* + * Flag values passed to Tcl_Eval (see the man page for details; also + * see tclInt.h for additional flags that are only used internally by + * Tcl): + */ + +#define TCL_BRACKET_TERM 1 + +/* + * Flag that may be passed to Tcl_ConvertElement to force it not to + * output braces (careful! if you change this flag be sure to change + * the definitions at the front of tclUtil.c). + */ + +#define TCL_DONT_USE_BRACES 1 + +/* + * Flag value passed to Tcl_RecordAndEval to request no evaluation + * (record only). + */ + +#define TCL_NO_EVAL -1 + +/* + * Special freeProc values that may be passed to Tcl_SetResult (see + * the man page for details): + */ + +#define TCL_VOLATILE ((Tcl_FreeProc *) -1) +#define TCL_STATIC ((Tcl_FreeProc *) 0) +#define TCL_DYNAMIC ((Tcl_FreeProc *) free) + +/* + * Flag values passed to variable-related procedures. + */ + +#define TCL_GLOBAL_ONLY 1 +#define TCL_APPEND_VALUE 2 +#define TCL_LIST_ELEMENT 4 +#define TCL_TRACE_READS 0x10 +#define TCL_TRACE_WRITES 0x20 +#define TCL_TRACE_UNSETS 0x40 +#define TCL_TRACE_DESTROYED 0x80 +#define TCL_INTERP_DESTROYED 0x100 +#define TCL_LEAVE_ERR_MSG 0x200 + +/* + * Types for linked variables: + */ + +#define TCL_LINK_INT 1 +#define TCL_LINK_DOUBLE 2 +#define TCL_LINK_BOOLEAN 3 +#define TCL_LINK_STRING 4 +#define TCL_LINK_READ_ONLY 0x80 + +/* + * Permission flags for files: + */ + +#define TCL_FILE_READABLE 1 +#define TCL_FILE_WRITABLE 2 + +/* + * The following declarations either map ckalloc and ckfree to + * malloc and free, or they map them to procedures with all sorts + * of debugging hooks defined in tclCkalloc.c. + */ + +#ifdef TCL_MEM_DEBUG + +EXTERN char * Tcl_DbCkalloc _ANSI_ARGS_((unsigned int size, + char *file, int line)); +EXTERN int Tcl_DbCkfree _ANSI_ARGS_((char *ptr, + char *file, int line)); +EXTERN char * Tcl_DbCkrealloc _ANSI_ARGS_((char *ptr, + unsigned int size, char *file, int line)); +EXTERN int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName)); +EXTERN void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file, + int line)); +# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__) +# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__) +# define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__) + +#else + +# define ckalloc(x) malloc(x) +# define ckfree(x) free(x) +# define ckrealloc(x,y) realloc(x,y) +# define Tcl_DumpActiveMemory(x) +# define Tcl_ValidateAllMemory(x,y) + +#endif /* TCL_MEM_DEBUG */ + +/* + * Macro to free up result of interpreter. + */ + +#define Tcl_FreeResult(interp) \ + if ((interp)->freeProc != 0) { \ + if ((interp)->freeProc == (Tcl_FreeProc *) free) { \ + ckfree((interp)->result); \ + } else { \ + (*(interp)->freeProc)((interp)->result); \ + } \ + (interp)->freeProc = 0; \ + } + +/* + * Forward declaration of Tcl_HashTable. Needed by some C++ compilers + * to prevent errors when the forward reference to Tcl_HashTable is + * encountered in the Tcl_HashEntry structure. + */ + +#ifdef __cplusplus +struct Tcl_HashTable; +#endif + +/* + * Structure definition for an entry in a hash table. No-one outside + * Tcl should access any of these fields directly; use the macros + * defined below. + */ + +typedef struct Tcl_HashEntry { + struct Tcl_HashEntry *nextPtr; /* Pointer to next entry in this + * hash bucket, or NULL for end of + * chain. */ + struct Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */ + struct Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to + * first entry in this entry's chain: + * used for deleting the entry. */ + ClientData clientData; /* Application stores something here + * with Tcl_SetHashValue. */ + union { /* Key has one of these forms: */ + char *oneWordValue; /* One-word value for key. */ + int words[1]; /* Multiple integer words for key. + * The actual size will be as large + * as necessary for this table's + * keys. */ + char string[4]; /* String for key. The actual size + * will be as large as needed to hold + * the key. */ + } key; /* MUST BE LAST FIELD IN RECORD!! */ +} Tcl_HashEntry; + +/* + * Structure definition for a hash table. Must be in tcl.h so clients + * can allocate space for these structures, but clients should never + * access any fields in this structure. + */ + +#define TCL_SMALL_HASH_TABLE 4 +typedef struct Tcl_HashTable { + Tcl_HashEntry **buckets; /* Pointer to bucket array. Each + * element points to first entry in + * bucket's hash chain, or NULL. */ + Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE]; + /* Bucket array used for small tables + * (to avoid mallocs and frees). */ + int numBuckets; /* Total number of buckets allocated + * at **bucketPtr. */ + int numEntries; /* Total number of entries present + * in table. */ + int rebuildSize; /* Enlarge table when numEntries gets + * to be this large. */ + int downShift; /* Shift count used in hashing + * function. Designed to use high- + * order bits of randomized keys. */ + int mask; /* Mask value used in hashing + * function. */ + int keyType; /* Type of keys used in this table. + * It's either TCL_STRING_KEYS, + * TCL_ONE_WORD_KEYS, or an integer + * giving the number of ints in a + */ + Tcl_HashEntry *(*findProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr, + char *key)); + Tcl_HashEntry *(*createProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr, + char *key, int *newPtr)); +} Tcl_HashTable; + +/* + * Structure definition for information used to keep track of searches + * through hash tables: + */ + +typedef struct Tcl_HashSearch { + Tcl_HashTable *tablePtr; /* Table being searched. */ + int nextIndex; /* Index of next bucket to be + * enumerated after present one. */ + Tcl_HashEntry *nextEntryPtr; /* Next entry to be enumerated in the + * the current bucket. */ +} Tcl_HashSearch; + +/* + * Acceptable key types for hash tables: + */ + +#define TCL_STRING_KEYS 0 +#define TCL_ONE_WORD_KEYS 1 + +/* + * Macros for clients to use to access fields of hash entries: + */ + +#define Tcl_GetHashValue(h) ((h)->clientData) +#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) +#define Tcl_GetHashKey(tablePtr, h) \ + ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) ? (h)->key.oneWordValue \ + : (h)->key.string)) + +/* + * Macros to use for clients to use to invoke find and create procedures + * for hash tables: + */ + +#define Tcl_FindHashEntry(tablePtr, key) \ + (*((tablePtr)->findProc))(tablePtr, key) +#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ + (*((tablePtr)->createProc))(tablePtr, key, newPtr) + +/* + * Exported Tcl variables: + */ + +EXTERN int tcl_AsyncReady; +EXTERN char * tcl_RcFileName; + +/* + * Exported Tcl procedures: + */ + +EXTERN void Tcl_AsyncMark _ANSI_ARGS_((Tcl_AsyncHandler async)); +EXTERN Tcl_AsyncHandler Tcl_AsyncCreate _ANSI_ARGS_((Tcl_AsyncProc *proc, + ClientData clientData)); +EXTERN void Tcl_AsyncDelete _ANSI_ARGS_((Tcl_AsyncHandler async)); +EXTERN int Tcl_AsyncInvoke _ANSI_ARGS_((Tcl_Interp *interp, + int code)); +EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp *interp, + char *string)); +#ifdef ELLIPSES +#ifdef USE_STDARG +EXTERN void Tcl_AppendResult _ANSI_ARGS_((Tcl_Interp *interp, ...)); +#else +EXTERN void Tcl_AppendResult _ANSI_ARGS_(VARARGS); +#endif +#endif +EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp)); +EXTERN void Tcl_AddErrorInfo _ANSI_ARGS_((Tcl_Interp *interp, + char *message)); +EXTERN char Tcl_Backslash _ANSI_ARGS_((char *src, + int *readPtr)); +EXTERN void Tcl_CallWhenDeleted _ANSI_ARGS_((Tcl_Interp *interp, + Tcl_InterpDeleteProc *proc, + ClientData clientData)); +EXTERN int Tcl_CommandComplete _ANSI_ARGS_((char *cmd)); +EXTERN char * Tcl_Concat _ANSI_ARGS_((int argc, char **argv)); +EXTERN int Tcl_ConvertElement _ANSI_ARGS_((char *src, + char *dst, int flags)); +EXTERN void Tcl_CreateCommand _ANSI_ARGS_((Tcl_Interp *interp, + char *cmdName, Tcl_CmdProc *proc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc)); +EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void)); +EXTERN void Tcl_CreateMathFunc _ANSI_ARGS_((Tcl_Interp *interp, + char *name, int numArgs, Tcl_ValueType *argTypes, + Tcl_MathProc *proc, ClientData clientData)); +EXTERN int Tcl_CreatePipeline _ANSI_ARGS_((Tcl_Interp *interp, + int argc, char **argv, int **pidArrayPtr, + int *inPipePtr, int *outPipePtr, + int *errFilePtr)); +EXTERN Tcl_Trace Tcl_CreateTrace _ANSI_ARGS_((Tcl_Interp *interp, + int level, Tcl_CmdTraceProc *proc, + ClientData clientData)); +EXTERN void Tcl_DeleteHashEntry _ANSI_ARGS_(( + Tcl_HashEntry *entryPtr)); +EXTERN void Tcl_DeleteHashTable _ANSI_ARGS_(( + Tcl_HashTable *tablePtr)); +EXTERN char * Tcl_DStringAppend _ANSI_ARGS_((Tcl_DString *dsPtr, + char *string, int length)); +EXTERN char * Tcl_DStringAppendElement _ANSI_ARGS_(( + Tcl_DString *dsPtr, char *string)); +EXTERN void Tcl_DStringEndSublist _ANSI_ARGS_((Tcl_DString *dsPtr)); +EXTERN void Tcl_DStringFree _ANSI_ARGS_((Tcl_DString *dsPtr)); +EXTERN void Tcl_DStringInit _ANSI_ARGS_((Tcl_DString *dsPtr)); +EXTERN void Tcl_DStringResult _ANSI_ARGS_((Tcl_Interp *interp, + Tcl_DString *dsPtr)); +EXTERN void Tcl_DStringStartSublist _ANSI_ARGS_(( + Tcl_DString *dsPtr)); +EXTERN void Tcl_DStringTrunc _ANSI_ARGS_((Tcl_DString *dsPtr, + int length)); +EXTERN int Tcl_DeleteCommand _ANSI_ARGS_((Tcl_Interp *interp, + char *cmdName)); +EXTERN void Tcl_DeleteInterp _ANSI_ARGS_((Tcl_Interp *interp)); +EXTERN void Tcl_DeleteTrace _ANSI_ARGS_((Tcl_Interp *interp, + Tcl_Trace trace)); +EXTERN void Tcl_DetachPids _ANSI_ARGS_((int numPids, int *pidPtr)); +EXTERN void Tcl_DontCallWhenDeleted _ANSI_ARGS_(( + Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, + ClientData clientData)); +EXTERN void Tcl_EnterFile _ANSI_ARGS_((Tcl_Interp *interp, + FILE *file, int permissions)); +EXTERN char * Tcl_ErrnoId _ANSI_ARGS_((void)); +EXTERN int Tcl_Eval _ANSI_ARGS_((Tcl_Interp *interp, char *cmd)); +EXTERN int Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp *interp, + char *fileName)); +EXTERN int Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int *ptr)); +EXTERN int Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp *interp, + char *string, double *ptr)); +EXTERN int Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp *interp, + char *string, long *ptr)); +EXTERN int Tcl_ExprString _ANSI_ARGS_((Tcl_Interp *interp, + char *string)); +EXTERN int Tcl_FilePermissions _ANSI_ARGS_((FILE *file)); +EXTERN Tcl_HashEntry * Tcl_FirstHashEntry _ANSI_ARGS_(( + Tcl_HashTable *tablePtr, + Tcl_HashSearch *searchPtr)); +EXTERN int Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int *boolPtr)); +EXTERN int Tcl_GetCommandInfo _ANSI_ARGS_((Tcl_Interp *interp, + char *cmdName, Tcl_CmdInfo *infoPtr)); +EXTERN int Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp *interp, + char *string, double *doublePtr)); +EXTERN int Tcl_GetInt _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int *intPtr)); +EXTERN int Tcl_GetOpenFile _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int write, int checkUsage, + FILE **filePtr)); +EXTERN char * Tcl_GetVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, int flags)); +EXTERN char * Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, int flags)); +EXTERN int Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp *interp, + char *command)); +EXTERN char * Tcl_HashStats _ANSI_ARGS_((Tcl_HashTable *tablePtr)); +EXTERN int Tcl_Init _ANSI_ARGS_((Tcl_Interp *interp)); +EXTERN void Tcl_InitHashTable _ANSI_ARGS_((Tcl_HashTable *tablePtr, + int keyType)); +EXTERN void Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp)); +EXTERN int Tcl_LinkVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, char *addr, int type)); +EXTERN char * Tcl_Merge _ANSI_ARGS_((int argc, char **argv)); +EXTERN Tcl_HashEntry * Tcl_NextHashEntry _ANSI_ARGS_(( + Tcl_HashSearch *searchPtr)); +EXTERN char * Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp *interp, + char *string, char **termPtr)); +EXTERN char * Tcl_PosixError _ANSI_ARGS_((Tcl_Interp *interp)); +EXTERN void Tcl_PrintDouble _ANSI_ARGS_((Tcl_Interp *interp, + double value, char *dst)); +EXTERN void Tcl_ReapDetachedProcs _ANSI_ARGS_((void)); +EXTERN int Tcl_RecordAndEval _ANSI_ARGS_((Tcl_Interp *interp, + char *cmd, int flags)); +EXTERN int Tcl_RegExpMatch _ANSI_ARGS_((Tcl_Interp *interp, + char *string, char *pattern)); +EXTERN void Tcl_ResetResult _ANSI_ARGS_((Tcl_Interp *interp)); +#define Tcl_Return Tcl_SetResult +EXTERN int Tcl_ScanElement _ANSI_ARGS_((char *string, + int *flagPtr)); +EXTERN int Tcl_SetCommandInfo _ANSI_ARGS_((Tcl_Interp *interp, + char *cmdName, Tcl_CmdInfo *infoPtr)); +#ifdef ELLIPSES +#ifdef USE_STDARG +EXTERN void Tcl_SetErrorCode _ANSI_ARGS_((Tcl_Interp *interp, ...)); +#else +EXTERN void Tcl_SetErrorCode _ANSI_ARGS_(VARARGS); +#endif +#endif +EXTERN int Tcl_SetRecursionLimit _ANSI_ARGS_((Tcl_Interp *interp, + int depth)); +EXTERN void Tcl_SetResult _ANSI_ARGS_((Tcl_Interp *interp, + char *string, Tcl_FreeProc *freeProc)); +EXTERN char * Tcl_SetVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, char *newValue, int flags)); +EXTERN char * Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, char *newValue, + int flags)); +EXTERN char * Tcl_SignalId _ANSI_ARGS_((int sig)); +EXTERN char * Tcl_SignalMsg _ANSI_ARGS_((int sig)); +EXTERN int Tcl_SplitList _ANSI_ARGS_((Tcl_Interp *interp, + char *list, int *argcPtr, char ***argvPtr)); +EXTERN int Tcl_StringMatch _ANSI_ARGS_((char *string, + char *pattern)); +EXTERN char * Tcl_TildeSubst _ANSI_ARGS_((Tcl_Interp *interp, + char *name, Tcl_DString *bufferPtr)); +EXTERN int Tcl_TraceVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, int flags, Tcl_VarTraceProc *proc, + ClientData clientData)); +EXTERN int Tcl_TraceVar2 _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, int flags, + Tcl_VarTraceProc *proc, ClientData clientData)); +EXTERN void Tcl_UnlinkVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName)); +EXTERN int Tcl_UnsetVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, int flags)); +EXTERN int Tcl_UnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, int flags)); +EXTERN void Tcl_UntraceVar _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, int flags, Tcl_VarTraceProc *proc, + ClientData clientData)); +EXTERN void Tcl_UntraceVar2 _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, int flags, + Tcl_VarTraceProc *proc, ClientData clientData)); +#ifdef ELLIPSES +#ifdef USE_STDARG +EXTERN int Tcl_VarEval _ANSI_ARGS_((Tcl_Interp *iPtr, ...)); +#else +EXTERN int Tcl_VarEval _ANSI_ARGS_(VARARGS); +#endif +#endif +EXTERN ClientData Tcl_VarTraceInfo _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, int flags, + Tcl_VarTraceProc *procPtr, + ClientData prevClientData)); +EXTERN ClientData Tcl_VarTraceInfo2 _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, int flags, + Tcl_VarTraceProc *procPtr, + ClientData prevClientData)); + +#endif /* _TCL */ diff --git a/vendor/x11iraf/obm/Tcl/tclAppInit.c b/vendor/x11iraf/obm/Tcl/tclAppInit.c new file mode 100644 index 00000000..df7f93c1 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclAppInit.c @@ -0,0 +1,95 @@ +/* + * tclAppInit.c -- + * + * Provides a default version of the Tcl_AppInit procedure. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclAppInit.c,v 1.6 93/08/26 14:34:55 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tcl.h" + +/* + * The following variable is a special hack that allows applications + * to be linked using the procedure "main" from the Tcl library. The + * variable generates a reference to "main", which causes main to + * be brought in from the library (and all of Tcl with it). + */ + +extern int main(); +int *tclDummyMainPtr = (int *) main; + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + /* + * Call the init procedures for included packages. Each call should + * look like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. + */ + + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + /* + * Call Tcl_CreateCommand for application-specific commands, if + * they weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. Typically the startup file is "~/.apprc" + * where "app" is the name of the application. If this line is deleted + * then no user-specific startup file will be run under any conditions. + */ + + tcl_RcFileName = "~/.tclshrc"; + return TCL_OK; +} diff --git a/vendor/x11iraf/obm/Tcl/tclAsync.c b/vendor/x11iraf/obm/Tcl/tclAsync.c new file mode 100644 index 00000000..447f5d4c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclAsync.c @@ -0,0 +1,256 @@ +/* + * tclAsync.c -- + * + * This file provides low-level support needed to invoke signal + * handlers in a safe way. The code here doesn't actually handle + * signals, though. This code is based on proposals made by + * Mark Diekhans and Don Libes. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclAsync.c,v 1.3 93/09/02 16:02:42 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" + +/* + * One of the following structures exists for each asynchronous + * handler: + */ + +typedef struct AsyncHandler { + int ready; /* Non-zero means this handler should + * be invoked in the next call to + * Tcl_AsyncInvoke. */ + struct AsyncHandler *nextPtr; /* Next in list of all handlers for + * the process. */ + Tcl_AsyncProc *proc; /* Procedure to call when handler + * is invoked. */ + ClientData clientData; /* Value to pass to handler when it + * is invoked. */ +} AsyncHandler; + +/* + * The variables below maintain a list of all existing handlers. + */ + +static AsyncHandler *firstHandler; /* First handler defined for process, + * or NULL if none. */ +static AsyncHandler *lastHandler; /* Last handler or NULL. */ + +/* + * The variable below is set to 1 whenever a handler becomes ready and + * it is cleared to zero whenever Tcl_AsyncInvoke is called. It can be + * checked elsewhere in the application to see if Tcl_AsyncInvoke + * should be invoked. + */ + +int tcl_AsyncReady = 0; + +/* + * The variable below indicates whether Tcl_AsyncInvoke is currently + * working. If so then we won't set tcl_AsyncReady again until + * Tcl_AsyncInvoke returns. + */ + +static int asyncActive = 0; + +/* + *---------------------------------------------------------------------- + * + * Tcl_AsyncCreate -- + * + * This procedure creates the data structures for an asynchronous + * handler, so that no memory has to be allocated when the handler + * is activated. + * + * Results: + * The return value is a token for the handler, which can be used + * to activate it later on. + * + * Side effects: + * Information about the handler is recorded. + * + *---------------------------------------------------------------------- + */ + +Tcl_AsyncHandler +Tcl_AsyncCreate(proc, clientData) + Tcl_AsyncProc *proc; /* Procedure to call when handler + * is invoked. */ + ClientData clientData; /* Argument to pass to handler. */ +{ + AsyncHandler *asyncPtr; + + asyncPtr = (AsyncHandler *) ckalloc(sizeof(AsyncHandler)); + asyncPtr->ready = 0; + asyncPtr->nextPtr = NULL; + asyncPtr->proc = proc; + asyncPtr->clientData = clientData; + if (firstHandler == NULL) { + firstHandler = asyncPtr; + } else { + lastHandler->nextPtr = asyncPtr; + } + lastHandler = asyncPtr; + return (Tcl_AsyncHandler) asyncPtr; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AsyncMark -- + * + * This procedure is called to request that an asynchronous handler + * be invoked as soon as possible. It's typically called from + * an interrupt handler, where it isn't safe to do anything that + * depends on or modifies application state. + * + * Results: + * None. + * + * Side effects: + * The handler gets marked for invocation later. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_AsyncMark(async) + Tcl_AsyncHandler async; /* Token for handler. */ +{ + ((AsyncHandler *) async)->ready = 1; + if (!asyncActive) { + tcl_AsyncReady = 1; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AsyncInvoke -- + * + * This procedure is called at a "safe" time at background level + * to invoke any active asynchronous handlers. + * + * Results: + * The return value is a normal Tcl result, which is intended to + * replace the code argument as the current completion code for + * interp. + * + * Side effects: + * Depends on the handlers that are active. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AsyncInvoke(interp, code) + Tcl_Interp *interp; /* If invoked from Tcl_Eval just after + * completing a command, points to + * interpreter. Otherwise it is + * NULL. */ + int code; /* If interp is non-NULL, this gives + * completion code from command that + * just completed. */ +{ + AsyncHandler *asyncPtr; + + if (tcl_AsyncReady == 0) { + return code; + } + tcl_AsyncReady = 0; + asyncActive = 1; + if (interp == NULL) { + code = 0; + } + + /* + * Make one or more passes over the list of handlers, invoking + * at most one handler in each pass. After invoking a handler, + * go back to the start of the list again so that (a) if a new + * higher-priority handler gets marked while executing a lower + * priority handler, we execute the higher-priority handler + * next, and (b) if a handler gets deleted during the execution + * of a handler, then the list structure may change so it isn't + * safe to continue down the list anyway. + */ + + while (1) { + for (asyncPtr = firstHandler; asyncPtr != NULL; + asyncPtr = asyncPtr->nextPtr) { + if (asyncPtr->ready) { + break; + } + } + if (asyncPtr == NULL) { + break; + } + asyncPtr->ready = 0; + code = (*asyncPtr->proc)(asyncPtr->clientData, interp, code); + } + asyncActive = 0; + return code; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AsyncDelete -- + * + * Frees up all the state for an asynchronous handler. The handler + * should never be used again. + * + * Results: + * None. + * + * Side effects: + * The state associated with the handler is deleted. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_AsyncDelete(async) + Tcl_AsyncHandler async; /* Token for handler to delete. */ +{ + AsyncHandler *asyncPtr = (AsyncHandler *) async; + AsyncHandler *prevPtr; + + if (firstHandler == asyncPtr) { + firstHandler = asyncPtr->nextPtr; + if (firstHandler == NULL) { + lastHandler = NULL; + } + } else { + prevPtr = firstHandler; + while (prevPtr->nextPtr != asyncPtr) { + prevPtr = prevPtr->nextPtr; + } + prevPtr->nextPtr = asyncPtr->nextPtr; + if (lastHandler == asyncPtr) { + lastHandler = prevPtr; + } + } + ckfree((char *) asyncPtr); +} diff --git a/vendor/x11iraf/obm/Tcl/tclBasic.c b/vendor/x11iraf/obm/Tcl/tclBasic.c new file mode 100644 index 00000000..be5469db --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclBasic.c @@ -0,0 +1,1381 @@ +/* + * tclBasic.c -- + * + * Contains the basic facilities for TCL command interpretation, + * including interpreter creation and deletion, command creation + * and deletion, and command parsing and execution. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclBasic.c,v 1.153 93/09/09 16:43:19 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" +#ifndef TCL_GENERIC_ONLY +# include "tclUnix.h" +#endif + +/* + * The following structure defines all of the commands in the Tcl core, + * and the C procedures that execute them. + */ + +typedef struct { + char *name; /* Name of command. */ + Tcl_CmdProc *proc; /* Procedure that executes command. */ +} CmdInfo; + +/* + * Built-in commands, and the procedures associated with them: + */ + +static CmdInfo builtInCmds[] = { + /* + * Commands in the generic core: + */ + + {"append", Tcl_AppendCmd}, + {"array", Tcl_ArrayCmd}, + {"break", Tcl_BreakCmd}, + {"case", Tcl_CaseCmd}, + {"catch", Tcl_CatchCmd}, + {"concat", Tcl_ConcatCmd}, + {"continue", Tcl_ContinueCmd}, + {"error", Tcl_ErrorCmd}, + {"eval", Tcl_EvalCmd}, + {"expr", Tcl_ExprCmd}, + {"for", Tcl_ForCmd}, + {"foreach", Tcl_ForeachCmd}, + {"format", Tcl_FormatCmd}, + {"global", Tcl_GlobalCmd}, + {"history", Tcl_HistoryCmd}, + {"if", Tcl_IfCmd}, + {"incr", Tcl_IncrCmd}, + {"info", Tcl_InfoCmd}, + {"join", Tcl_JoinCmd}, + {"lappend", Tcl_LappendCmd}, + {"lindex", Tcl_LindexCmd}, + {"linsert", Tcl_LinsertCmd}, + {"list", Tcl_ListCmd}, + {"llength", Tcl_LlengthCmd}, + {"lrange", Tcl_LrangeCmd}, + {"lreplace", Tcl_LreplaceCmd}, + {"lsearch", Tcl_LsearchCmd}, + {"lsort", Tcl_LsortCmd}, + {"proc", Tcl_ProcCmd}, + {"regexp", Tcl_RegexpCmd}, + {"regsub", Tcl_RegsubCmd}, + {"rename", Tcl_RenameCmd}, + {"return", Tcl_ReturnCmd}, + {"scan", Tcl_ScanCmd}, + {"set", Tcl_SetCmd}, + {"split", Tcl_SplitCmd}, + {"string", Tcl_StringCmd}, + {"switch", Tcl_SwitchCmd}, + {"trace", Tcl_TraceCmd}, + {"unset", Tcl_UnsetCmd}, + {"uplevel", Tcl_UplevelCmd}, + {"upvar", Tcl_UpvarCmd}, + {"while", Tcl_WhileCmd}, + + /* + * Commands in the UNIX core: + */ + +#ifndef TCL_GENERIC_ONLY + {"cd", Tcl_CdCmd}, + {"close", Tcl_CloseCmd}, + {"eof", Tcl_EofCmd}, + {"exec", Tcl_ExecCmd}, + {"exit", Tcl_ExitCmd}, + {"file", Tcl_FileCmd}, + {"flush", Tcl_FlushCmd}, + {"gets", Tcl_GetsCmd}, + {"glob", Tcl_GlobCmd}, + {"open", Tcl_OpenCmd}, + {"pid", Tcl_PidCmd}, + {"puts", Tcl_PutsCmd}, + {"pwd", Tcl_PwdCmd}, + {"read", Tcl_ReadCmd}, + {"seek", Tcl_SeekCmd}, + {"source", Tcl_SourceCmd}, + {"tell", Tcl_TellCmd}, + {"time", Tcl_TimeCmd}, +#endif /* TCL_GENERIC_ONLY */ + {NULL, (Tcl_CmdProc *) NULL} +}; + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreateInterp -- + * + * Create a new TCL command interpreter. + * + * Results: + * The return value is a token for the interpreter, which may be + * used in calls to procedures like Tcl_CreateCmd, Tcl_Eval, or + * Tcl_DeleteInterp. + * + * Side effects: + * The command interpreter is initialized with an empty variable + * table and the built-in commands. SIGPIPE signals are set to + * be ignored (see comment below for details). + * + *---------------------------------------------------------------------- + */ + +Tcl_Interp * +Tcl_CreateInterp() +{ + register Interp *iPtr; + register Command *cmdPtr; + register CmdInfo *cmdInfoPtr; + int i; + static int firstInterp = 1; + + iPtr = (Interp *) ckalloc(sizeof(Interp)); + iPtr->result = iPtr->resultSpace; + iPtr->freeProc = 0; + iPtr->errorLine = 0; + Tcl_InitHashTable(&iPtr->commandTable, TCL_STRING_KEYS); + Tcl_InitHashTable(&iPtr->mathFuncTable, TCL_STRING_KEYS); + Tcl_InitHashTable(&iPtr->globalTable, TCL_STRING_KEYS); + iPtr->numLevels = 0; + iPtr->maxNestingDepth = 1000; + iPtr->framePtr = NULL; + iPtr->varFramePtr = NULL; + iPtr->activeTracePtr = NULL; + iPtr->returnCode = TCL_OK; + iPtr->errorInfo = NULL; + iPtr->errorCode = NULL; + iPtr->numEvents = 0; + iPtr->events = NULL; + iPtr->curEvent = 0; + iPtr->curEventNum = 0; + iPtr->revPtr = NULL; + iPtr->historyFirst = NULL; + iPtr->revDisables = 1; + iPtr->evalFirst = iPtr->evalLast = NULL; + iPtr->appendResult = NULL; + iPtr->appendAvl = 0; + iPtr->appendUsed = 0; + for (i = 0; i < NUM_REGEXPS; i++) { + iPtr->patterns[i] = NULL; + iPtr->patLengths[i] = -1; + iPtr->regexps[i] = NULL; + } + strcpy(iPtr->pdFormat, DEFAULT_PD_FORMAT); + iPtr->pdPrec = DEFAULT_PD_PREC; + iPtr->cmdCount = 0; + iPtr->noEval = 0; + iPtr->evalFlags = 0; + iPtr->scriptFile = NULL; + iPtr->flags = 0; + iPtr->tracePtr = NULL; + iPtr->deleteCallbackPtr = NULL; + iPtr->resultSpace[0] = 0; + + /* + * Create the built-in commands. Do it here, rather than calling + * Tcl_CreateCommand, because it's faster (there's no need to + * check for a pre-existing command by the same name). + */ + + for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) { + int new; + Tcl_HashEntry *hPtr; + + hPtr = Tcl_CreateHashEntry(&iPtr->commandTable, + cmdInfoPtr->name, &new); + if (new) { + cmdPtr = (Command *) ckalloc(sizeof(Command)); + cmdPtr->proc = cmdInfoPtr->proc; + cmdPtr->clientData = (ClientData) NULL; + cmdPtr->deleteProc = NULL; + cmdPtr->deleteData = (ClientData) NULL; + Tcl_SetHashValue(hPtr, cmdPtr); + } + } + +#ifndef TCL_GENERIC_ONLY + TclSetupEnv((Tcl_Interp *) iPtr); + + /* + * The code below causes SIGPIPE (broken pipe) errors to + * be ignored. This is needed so that Tcl processes don't + * die if they create child processes (e.g. using "exec" or + * "open") that terminate prematurely. The signal handler + * is only set up when the first interpreter is created; + * after this the application can override the handler with + * a different one of its own, if it wants. + */ + + if (firstInterp) { + (void) signal(SIGPIPE, SIG_IGN); + firstInterp = 0; + } +#endif + + Tcl_TraceVar2((Tcl_Interp *) iPtr, "tcl_precision", (char *) NULL, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + TclPrecTraceProc, (ClientData) NULL); + return (Tcl_Interp *) iPtr; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_Init -- + * + * This procedure is typically invoked by Tcl_AppInit procedures + * to perform additional initialization for a Tcl interpreter, + * such as sourcing the "init.tcl" script. + * + * Results: + * Returns a standard Tcl completion code and sets interp->result + * if there is an error. + * + * Side effects: + * Depends on what's in the init.tcl script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_Init(interp) + Tcl_Interp *interp; /* Interpreter to initialize. */ +{ + static char initCmd[] = + "if [file exists [info library]/init.tcl] {\n\ + source [info library]/init.tcl\n\ + } else {\n\ + set msg \"can't find [info library]/init.tcl; perhaps you \"\n\ + append msg \"need to\\ninstall Tcl or set your TCL_LIBRARY \"\n\ + append msg \"environment variable?\"\n\ + error $msg\n\ + }"; + + return Tcl_Eval(interp, initCmd); +} + +/* + *-------------------------------------------------------------- + * + * Tcl_CallWhenDeleted -- + * + * Arrange for a procedure to be called before a given + * interpreter is deleted. + * + * Results: + * None. + * + * Side effects: + * When Tcl_DeleteInterp is invoked to delete interp, + * proc will be invoked. See the manual entry for + * details. + * + *-------------------------------------------------------------- + */ + +void +Tcl_CallWhenDeleted(interp, proc, clientData) + Tcl_Interp *interp; /* Interpreter to watch. */ + Tcl_InterpDeleteProc *proc; /* Procedure to call when interpreter + * is about to be deleted. */ + ClientData clientData; /* One-word value to pass to proc. */ +{ + DeleteCallback *dcPtr, *prevPtr; + Interp *iPtr = (Interp *) interp; + + dcPtr = (DeleteCallback *) ckalloc(sizeof(DeleteCallback)); + dcPtr->proc = proc; + dcPtr->clientData = clientData; + dcPtr->nextPtr = NULL; + if (iPtr->deleteCallbackPtr == NULL) { + iPtr->deleteCallbackPtr = dcPtr; + } else { + prevPtr = iPtr->deleteCallbackPtr; + while (prevPtr->nextPtr != NULL) { + prevPtr = prevPtr->nextPtr; + } + prevPtr->nextPtr = dcPtr; + } +} + +/* + *-------------------------------------------------------------- + * + * Tcl_DontCallWhenDeleted -- + * + * Cancel the arrangement for a procedure to be called when + * a given interpreter is deleted. + * + * Results: + * None. + * + * Side effects: + * If proc and clientData were previously registered as a + * callback via Tcl_CallWhenDeleted, they are unregistered. + * If they weren't previously registered then nothing + * happens. + * + *-------------------------------------------------------------- + */ + +void +Tcl_DontCallWhenDeleted(interp, proc, clientData) + Tcl_Interp *interp; /* Interpreter to watch. */ + Tcl_InterpDeleteProc *proc; /* Procedure to call when interpreter + * is about to be deleted. */ + ClientData clientData; /* One-word value to pass to proc. */ +{ + DeleteCallback *prevPtr, *dcPtr; + Interp *iPtr = (Interp *) interp; + + for (prevPtr = NULL, dcPtr = iPtr->deleteCallbackPtr; + dcPtr != NULL; prevPtr = dcPtr, dcPtr = dcPtr->nextPtr) { + if ((dcPtr->proc != proc) || (dcPtr->clientData != clientData)) { + continue; + } + if (prevPtr == NULL) { + iPtr->deleteCallbackPtr = dcPtr->nextPtr; + } else { + prevPtr->nextPtr = dcPtr->nextPtr; + } + ckfree((char *) dcPtr); + break; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DeleteInterp -- + * + * Delete an interpreter and free up all of the resources associated + * with it. + * + * Results: + * None. + * + * Side effects: + * The interpreter is destroyed. The caller should never again + * use the interp token. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DeleteInterp(interp) + Tcl_Interp *interp; /* Token for command interpreter (returned + * by a previous call to Tcl_CreateInterp). */ +{ + Interp *iPtr = (Interp *) interp; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + register Command *cmdPtr; + DeleteCallback *dcPtr; + int i; + + /* + * If the interpreter is in use, delay the deletion until later. + */ + + iPtr->flags |= DELETED; + if (iPtr->numLevels != 0) { + return; + } + + /* + * Invoke deletion callbacks. + */ + + while (iPtr->deleteCallbackPtr != NULL) { + dcPtr = iPtr->deleteCallbackPtr; + iPtr->deleteCallbackPtr = dcPtr->nextPtr; + (*dcPtr->proc)(dcPtr->clientData, interp); + ckfree((char *) dcPtr); + } + + /* + * Free up any remaining resources associated with the + * interpreter. + */ + + for (hPtr = Tcl_FirstHashEntry(&iPtr->commandTable, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + if (cmdPtr->deleteProc != NULL) { + (*cmdPtr->deleteProc)(cmdPtr->deleteData); + } + ckfree((char *) cmdPtr); + } + Tcl_DeleteHashTable(&iPtr->commandTable); + for (hPtr = Tcl_FirstHashEntry(&iPtr->mathFuncTable, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ckfree((char *) Tcl_GetHashValue(hPtr)); + } + Tcl_DeleteHashTable(&iPtr->mathFuncTable); + TclDeleteVars(iPtr, &iPtr->globalTable); + + /* + * Free up the result *after* deleting variables, since variable + * deletion could have transferred ownership of the result string + * to Tcl. + */ + + Tcl_FreeResult(interp); + if (iPtr->errorInfo != NULL) { + ckfree(iPtr->errorInfo); + } + if (iPtr->errorCode != NULL) { + ckfree(iPtr->errorCode); + } + if (iPtr->events != NULL) { + int i; + + for (i = 0; i < iPtr->numEvents; i++) { + ckfree(iPtr->events[i].command); + } + ckfree((char *) iPtr->events); + } + while (iPtr->revPtr != NULL) { + HistoryRev *nextPtr = iPtr->revPtr->nextPtr; + + ckfree((char *) iPtr->revPtr); + iPtr->revPtr = nextPtr; + } + if (iPtr->appendResult != NULL) { + ckfree(iPtr->appendResult); + } + for (i = 0; i < NUM_REGEXPS; i++) { + if (iPtr->patterns[i] == NULL) { + break; + } + ckfree(iPtr->patterns[i]); + ckfree((char *) iPtr->regexps[i]); + } + while (iPtr->tracePtr != NULL) { + Trace *nextPtr = iPtr->tracePtr->nextPtr; + + ckfree((char *) iPtr->tracePtr); + iPtr->tracePtr = nextPtr; + } + ckfree((char *) iPtr); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreateCommand -- + * + * Define a new command in a command table. + * + * Results: + * None. + * + * Side effects: + * If a command named cmdName already exists for interp, it is + * deleted. In the future, when cmdName is seen as the name of + * a command by Tcl_Eval, proc will be called. When the command + * is deleted from the table, deleteProc will be called. See the + * manual entry for details on the calling sequence. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_CreateCommand(interp, cmdName, proc, clientData, deleteProc) + Tcl_Interp *interp; /* Token for command interpreter (returned + * by a previous call to Tcl_CreateInterp). */ + char *cmdName; /* Name of command. */ + Tcl_CmdProc *proc; /* Command procedure to associate with + * cmdName. */ + ClientData clientData; /* Arbitrary one-word value to pass to proc. */ + Tcl_CmdDeleteProc *deleteProc; + /* If not NULL, gives a procedure to call when + * this command is deleted. */ +{ + Interp *iPtr = (Interp *) interp; + register Command *cmdPtr; + Tcl_HashEntry *hPtr; + int new; + + hPtr = Tcl_CreateHashEntry(&iPtr->commandTable, cmdName, &new); + if (!new) { + /* + * Command already exists: delete the old one. + */ + + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + if (cmdPtr->deleteProc != NULL) { + (*cmdPtr->deleteProc)(cmdPtr->deleteData); + } + } else { + cmdPtr = (Command *) ckalloc(sizeof(Command)); + Tcl_SetHashValue(hPtr, cmdPtr); + } + cmdPtr->proc = proc; + cmdPtr->clientData = clientData; + cmdPtr->deleteProc = deleteProc; + cmdPtr->deleteData = clientData; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetCommandInfo -- + * + * Modifies various information about a Tcl command. + * + * Results: + * If cmdName exists in interp, then the information at *infoPtr + * is stored with the command in place of the current information + * and 1 is returned. If the command doesn't exist then 0 is + * returned. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_SetCommandInfo(interp, cmdName, infoPtr) + Tcl_Interp *interp; /* Interpreter in which to look + * for command. */ + char *cmdName; /* Name of desired command. */ + Tcl_CmdInfo *infoPtr; /* Where to store information about + * command. */ +{ + Tcl_HashEntry *hPtr; + Command *cmdPtr; + + hPtr = Tcl_FindHashEntry(&((Interp *) interp)->commandTable, cmdName); + if (hPtr == NULL) { + return 0; + } + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + cmdPtr->proc = infoPtr->proc; + cmdPtr->clientData = infoPtr->clientData; + cmdPtr->deleteProc = infoPtr->deleteProc; + cmdPtr->deleteData = infoPtr->deleteData; + return 1; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetCommandInfo -- + * + * Returns various information about a Tcl command. + * + * Results: + * If cmdName exists in interp, then *infoPtr is modified to + * hold information about cmdName and 1 is returned. If the + * command doesn't exist then 0 is returned and *infoPtr isn't + * modified. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_GetCommandInfo(interp, cmdName, infoPtr) + Tcl_Interp *interp; /* Interpreter in which to look + * for command. */ + char *cmdName; /* Name of desired command. */ + Tcl_CmdInfo *infoPtr; /* Where to store information about + * command. */ +{ + Tcl_HashEntry *hPtr; + Command *cmdPtr; + + hPtr = Tcl_FindHashEntry(&((Interp *) interp)->commandTable, cmdName); + if (hPtr == NULL) { + return 0; + } + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + infoPtr->proc = cmdPtr->proc; + infoPtr->clientData = cmdPtr->clientData; + infoPtr->deleteProc = cmdPtr->deleteProc; + infoPtr->deleteData = cmdPtr->deleteData; + return 1; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DeleteCommand -- + * + * Remove the given command from the given interpreter. + * + * Results: + * 0 is returned if the command was deleted successfully. + * -1 is returned if there didn't exist a command by that + * name. + * + * Side effects: + * CmdName will no longer be recognized as a valid command for + * interp. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_DeleteCommand(interp, cmdName) + Tcl_Interp *interp; /* Token for command interpreter (returned + * by a previous call to Tcl_CreateInterp). */ + char *cmdName; /* Name of command to remove. */ +{ + Interp *iPtr = (Interp *) interp; + Tcl_HashEntry *hPtr; + Command *cmdPtr; + + hPtr = Tcl_FindHashEntry(&iPtr->commandTable, cmdName); + if (hPtr == NULL) { + return -1; + } + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + if (cmdPtr->deleteProc != NULL) { + (*cmdPtr->deleteProc)(cmdPtr->deleteData); + } + ckfree((char *) cmdPtr); + Tcl_DeleteHashEntry(hPtr); + return 0; +} + +/* + *----------------------------------------------------------------- + * + * Tcl_Eval -- + * + * Parse and execute a command in the Tcl language. + * + * Results: + * The return value is one of the return codes defined in tcl.hd + * (such as TCL_OK), and interp->result contains a string value + * to supplement the return code. The value of interp->result + * will persist only until the next call to Tcl_Eval: copy it or + * lose it! *TermPtr is filled in with the character just after + * the last one that was part of the command (usually a NULL + * character or a closing bracket). + * + * Side effects: + * Almost certainly; depends on the command. + * + *----------------------------------------------------------------- + */ + +int +Tcl_Eval(interp, cmd) + Tcl_Interp *interp; /* Token for command interpreter (returned + * by a previous call to Tcl_CreateInterp). */ + char *cmd; /* Pointer to TCL command to interpret. */ +{ + /* + * The storage immediately below is used to generate a copy + * of the command, after all argument substitutions. Pv will + * contain the argv values passed to the command procedure. +# define NUM_CHARS 1024 + */ + +# define NUM_CHARS 200 + char copyStorage[NUM_CHARS]; + ParseValue pv; + char *oldBuffer; + + /* + * This procedure generates an (argv, argc) array for the command, + * It starts out with stack-allocated space but uses dynamically- + * allocated storage to increase it if needed. + */ + +# define NUM_ARGS 10 + char *(argStorage[NUM_ARGS]); + char **argv = argStorage; + int argc; + int argSize = NUM_ARGS; + + register char *src; /* Points to current character + * in cmd. */ + char termChar; /* Return when this character is found + * (either ']' or '\0'). Zero means + * that newlines terminate commands. */ + int flags; /* Interp->evalFlags value when the + * procedure was called. */ + int result; /* Return value. */ + register Interp *iPtr = (Interp *) interp; + Tcl_HashEntry *hPtr; + Command *cmdPtr; + char *termPtr; /* Contains character just after the + * last one in the command. */ + char *cmdStart; /* Points to first non-blank char. in + * command (used in calling trace + * procedures). */ + char *ellipsis = ""; /* Used in setting errorInfo variable; + * set to "..." to indicate that not + * all of offending command is included + * in errorInfo. "" means that the + * command is all there. */ + register Trace *tracePtr; + + /* + * Initialize the result to an empty string and clear out any + * error information. This makes sure that we return an empty + * result if there are no commands in the command string. + */ + + Tcl_FreeResult((Tcl_Interp *) iPtr); + iPtr->result = iPtr->resultSpace; + iPtr->resultSpace[0] = 0; + result = TCL_OK; + + /* + * Initialize the area in which command copies will be assembled. + */ + + pv.buffer = copyStorage; + pv.end = copyStorage + NUM_CHARS - 1; + pv.expandProc = TclExpandParseValue; + pv.clientData = (ClientData) NULL; + + src = cmd; + flags = iPtr->evalFlags; + iPtr->evalFlags = 0; + if (flags & TCL_BRACKET_TERM) { + termChar = ']'; + } else { + termChar = 0; + } + termPtr = src; + cmdStart = src; + + /* + * Check depth of nested calls to Tcl_Eval: if this gets too large, + * it's probably because of an infinite loop somewhere. + */ + + iPtr->numLevels++; + if (iPtr->numLevels > iPtr->maxNestingDepth) { + iPtr->numLevels--; + iPtr->result = "too many nested calls to Tcl_Eval (infinite loop?)"; + iPtr->termPtr = termPtr; + return TCL_ERROR; + } + + /* + * There can be many sub-commands (separated by semi-colons or + * newlines) in one command string. This outer loop iterates over + * individual commands. + */ + + while (*src != termChar) { + iPtr->flags &= ~(ERR_IN_PROGRESS | ERROR_CODE_SET); + + /* + * Skim off leading white space and semi-colons, and skip + * comments. + */ + + while (1) { + register char c = *src; + + if ((CHAR_TYPE(c) != TCL_SPACE) && (c != ';') && (c != '\n')) { + break; + } + src += 1; + } + if (*src == '#') { + for (src++; *src != 0; src++) { + if ((*src == '\n') && (src[-1] != '\\')) { + src++; + break; + } + } + continue; + } + cmdStart = src; + + /* + * Parse the words of the command, generating the argc and + * argv for the command procedure. May have to call + * TclParseWords several times, expanding the argv array + * between calls. + */ + + pv.next = oldBuffer = pv.buffer; + argc = 0; + while (1) { + int newArgs, maxArgs; + char **newArgv; + int i; + + /* + * Note: the "- 2" below guarantees that we won't use the + * last two argv slots here. One is for a NULL pointer to + * mark the end of the list, and the other is to leave room + * for inserting the command name "unknown" as the first + * argument (see below). + */ + + maxArgs = argSize - argc - 2; + result = TclParseWords((Tcl_Interp *) iPtr, src, flags, + maxArgs, &termPtr, &newArgs, &argv[argc], &pv); + src = termPtr; + if (result != TCL_OK) { + ellipsis = "..."; + goto done; + } + + /* + * Careful! Buffer space may have gotten reallocated while + * parsing words. If this happened, be sure to update all + * of the older argv pointers to refer to the new space. + */ + + if (oldBuffer != pv.buffer) { + int i; + + for (i = 0; i < argc; i++) { + argv[i] = pv.buffer + (argv[i] - oldBuffer); + } + oldBuffer = pv.buffer; + } + argc += newArgs; + if (newArgs < maxArgs) { + argv[argc] = (char *) NULL; + break; + } + + /* + * Args didn't all fit in the current array. Make it bigger. + */ + + argSize *= 2; + newArgv = (char **) + ckalloc((unsigned) argSize * sizeof(char *)); + for (i = 0; i < argc; i++) { + newArgv[i] = argv[i]; + } + if (argv != argStorage) { + ckfree((char *) argv); + } + argv = newArgv; + } + + /* + * If this is an empty command (or if we're just parsing + * commands without evaluating them), then just skip to the + * next command. + */ + + if ((argc == 0) || iPtr->noEval) { + continue; + } + argv[argc] = NULL; + + /* + * Save information for the history module, if needed. + */ + + if (flags & TCL_RECORD_BOUNDS) { + iPtr->evalFirst = cmdStart; + iPtr->evalLast = src-1; + } + + /* + * Find the procedure to execute this command. If there isn't + * one, then see if there is a command "unknown". If so, + * invoke it instead, passing it the words of the original + * command as arguments. + */ + + hPtr = Tcl_FindHashEntry(&iPtr->commandTable, argv[0]); + if (hPtr == NULL) { + int i; + + hPtr = Tcl_FindHashEntry(&iPtr->commandTable, "unknown"); + if (hPtr == NULL) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "invalid command name: \"", + argv[0], "\"", (char *) NULL); + result = TCL_ERROR; + goto done; + } + for (i = argc; i >= 0; i--) { + argv[i+1] = argv[i]; + } + argv[0] = "unknown"; + argc++; + } + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + + /* + * Call trace procedures, if any. + */ + + for (tracePtr = iPtr->tracePtr; tracePtr != NULL; + tracePtr = tracePtr->nextPtr) { + char saved; + + if (tracePtr->level < iPtr->numLevels) { + continue; + } + saved = *src; + *src = 0; + (*tracePtr->proc)(tracePtr->clientData, interp, iPtr->numLevels, + cmdStart, cmdPtr->proc, cmdPtr->clientData, argc, argv); + *src = saved; + } + + /* + * At long last, invoke the command procedure. Reset the + * result to its default empty value first (it could have + * gotten changed by earlier commands in the same command + * string). + */ + + iPtr->cmdCount++; + Tcl_FreeResult(iPtr); + iPtr->result = iPtr->resultSpace; + iPtr->resultSpace[0] = 0; + result = (*cmdPtr->proc)(cmdPtr->clientData, interp, argc, argv); + if (tcl_AsyncReady) { + result = Tcl_AsyncInvoke(interp, result); + } + if (result != TCL_OK) { + break; + } + } + + /* + * Free up any extra resources that were allocated. + */ + + done: + if (pv.buffer != copyStorage) { + ckfree((char *) pv.buffer); + } + if (argv != argStorage) { + ckfree((char *) argv); + } + iPtr->numLevels--; + if (iPtr->numLevels == 0) { + if (result == TCL_RETURN) { + result = TCL_OK; + } + if ((result != TCL_OK) && (result != TCL_ERROR)) { + Tcl_ResetResult(interp); + if (result == TCL_BREAK) { + iPtr->result = "invoked \"break\" outside of a loop"; + } else if (result == TCL_CONTINUE) { + iPtr->result = "invoked \"continue\" outside of a loop"; + } else { + iPtr->result = iPtr->resultSpace; + sprintf(iPtr->resultSpace, "command returned bad code: %d", + result); + } + result = TCL_ERROR; + } + if (iPtr->flags & DELETED) { + Tcl_DeleteInterp(interp); + } + } + + /* + * If an error occurred, record information about what was being + * executed when the error occurred. + */ + + if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) { + int numChars; + register char *p; + + /* + * Compute the line number where the error occurred. + */ + + iPtr->errorLine = 1; + for (p = cmd; p != cmdStart; p++) { + if (*p == '\n') { + iPtr->errorLine++; + } + } + for ( ; isspace(UCHAR(*p)) || (*p == ';'); p++) { + if (*p == '\n') { + iPtr->errorLine++; + } + } + + /* + * Figure out how much of the command to print in the error + * message (up to a certain number of characters, or up to + * the first new-line). + */ + + numChars = src - cmdStart; + if (numChars > (NUM_CHARS-50)) { + numChars = NUM_CHARS-50; + ellipsis = " ..."; + } + + if (!(iPtr->flags & ERR_IN_PROGRESS)) { + sprintf(copyStorage, "\n while executing\n\"%.*s%s\"", + numChars, cmdStart, ellipsis); + } else { + sprintf(copyStorage, "\n invoked from within\n\"%.*s%s\"", + numChars, cmdStart, ellipsis); + } + Tcl_AddErrorInfo(interp, copyStorage); + iPtr->flags &= ~ERR_ALREADY_LOGGED; + } else { + iPtr->flags &= ~ERR_ALREADY_LOGGED; + } + iPtr->termPtr = termPtr; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreateTrace -- + * + * Arrange for a procedure to be called to trace command execution. + * + * Results: + * The return value is a token for the trace, which may be passed + * to Tcl_DeleteTrace to eliminate the trace. + * + * Side effects: + * From now on, proc will be called just before a command procedure + * is called to execute a Tcl command. Calls to proc will have the + * following form: + * + * void + * proc(clientData, interp, level, command, cmdProc, cmdClientData, + * argc, argv) + * ClientData clientData; + * Tcl_Interp *interp; + * int level; + * char *command; + * int (*cmdProc)(); + * ClientData cmdClientData; + * int argc; + * char **argv; + * { + * } + * + * The clientData and interp arguments to proc will be the same + * as the corresponding arguments to this procedure. Level gives + * the nesting level of command interpretation for this interpreter + * (0 corresponds to top level). Command gives the ASCII text of + * the raw command, cmdProc and cmdClientData give the procedure that + * will be called to process the command and the ClientData value it + * will receive, and argc and argv give the arguments to the + * command, after any argument parsing and substitution. Proc + * does not return a value. + * + *---------------------------------------------------------------------- + */ + +Tcl_Trace +Tcl_CreateTrace(interp, level, proc, clientData) + Tcl_Interp *interp; /* Interpreter in which to create the trace. */ + int level; /* Only call proc for commands at nesting level + * <= level (1 => top level). */ + Tcl_CmdTraceProc *proc; /* Procedure to call before executing each + * command. */ + ClientData clientData; /* Arbitrary one-word value to pass to proc. */ +{ + register Trace *tracePtr; + register Interp *iPtr = (Interp *) interp; + + tracePtr = (Trace *) ckalloc(sizeof(Trace)); + tracePtr->level = level; + tracePtr->proc = proc; + tracePtr->clientData = clientData; + tracePtr->nextPtr = iPtr->tracePtr; + iPtr->tracePtr = tracePtr; + + return (Tcl_Trace) tracePtr; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DeleteTrace -- + * + * Remove a trace. + * + * Results: + * None. + * + * Side effects: + * From now on there will be no more calls to the procedure given + * in trace. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DeleteTrace(interp, trace) + Tcl_Interp *interp; /* Interpreter that contains trace. */ + Tcl_Trace trace; /* Token for trace (returned previously by + * Tcl_CreateTrace). */ +{ + register Interp *iPtr = (Interp *) interp; + register Trace *tracePtr = (Trace *) trace; + register Trace *tracePtr2; + + if (iPtr->tracePtr == tracePtr) { + iPtr->tracePtr = tracePtr->nextPtr; + ckfree((char *) tracePtr); + } else { + for (tracePtr2 = iPtr->tracePtr; tracePtr2 != NULL; + tracePtr2 = tracePtr2->nextPtr) { + if (tracePtr2->nextPtr == tracePtr) { + tracePtr2->nextPtr = tracePtr->nextPtr; + ckfree((char *) tracePtr); + return; + } + } + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AddErrorInfo -- + * + * Add information to a message being accumulated that describes + * the current error. + * + * Results: + * None. + * + * Side effects: + * The contents of message are added to the "errorInfo" variable. + * If Tcl_Eval has been called since the current value of errorInfo + * was set, errorInfo is cleared before adding the new message. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_AddErrorInfo(interp, message) + Tcl_Interp *interp; /* Interpreter to which error information + * pertains. */ + char *message; /* Message to record. */ +{ + register Interp *iPtr = (Interp *) interp; + + /* + * If an error is already being logged, then the new errorInfo + * is the concatenation of the old info and the new message. + * If this is the first piece of info for the error, then the + * new errorInfo is the concatenation of the message in + * interp->result and the new message. + */ + + if (!(iPtr->flags & ERR_IN_PROGRESS)) { + Tcl_SetVar2(interp, "errorInfo", (char *) NULL, interp->result, + TCL_GLOBAL_ONLY); + iPtr->flags |= ERR_IN_PROGRESS; + + /* + * If the errorCode variable wasn't set by the code that generated + * the error, set it to "NONE". + */ + + if (!(iPtr->flags & ERROR_CODE_SET)) { + (void) Tcl_SetVar2(interp, "errorCode", (char *) NULL, "NONE", + TCL_GLOBAL_ONLY); + } + } + Tcl_SetVar2(interp, "errorInfo", (char *) NULL, message, + TCL_GLOBAL_ONLY|TCL_APPEND_VALUE); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_VarEval -- + * + * Given a variable number of string arguments, concatenate them + * all together and execute the result as a Tcl command. + * + * Results: + * A standard Tcl return result. An error message or other + * result may be left in interp->result. + * + * Side effects: + * Depends on what was done by the command. + * + *---------------------------------------------------------------------- + */ + /* VARARGS2 */ /* ARGSUSED */ +int +#ifdef USE_STDARG +Tcl_VarEval(Tcl_Interp *iPtr, ...) +#else + +#ifndef lint +Tcl_VarEval(va_alist) +#else +Tcl_VarEval(iPtr, p, va_alist) + Tcl_Interp *iPtr; /* Interpreter in which to execute command. */ + char *p; /* One or more strings to concatenate, + * terminated with a NULL string. */ +#endif + + va_dcl +#endif +{ + va_list argList; + +#define FIXED_SIZE 200 + char fixedSpace[FIXED_SIZE+1]; + int spaceAvl, spaceUsed, length; + char *string, *cmd; + Tcl_Interp *interp = iPtr; + int result; + + /* + * Copy the strings one after the other into a single larger + * string. Use stack-allocated space for small commands, but if + * the command gets too large than call ckalloc to create the + * space. + */ + +#ifdef USE_STDARG + va_start(argList, iPtr); +#else + va_start(argList); + (void) va_arg(argList, Tcl_Interp *); +#endif + spaceAvl = FIXED_SIZE; + spaceUsed = 0; + cmd = fixedSpace; + while (1) { + string = va_arg(argList, char *); + if (string == NULL) { + break; + } + length = strlen(string); + if ((spaceUsed + length) > spaceAvl) { + char *new; + + spaceAvl = spaceUsed + length; + spaceAvl += spaceAvl/2; + new = ckalloc((unsigned) spaceAvl); + memcpy((VOID *) new, (VOID *) cmd, spaceUsed); + if (cmd != fixedSpace) { + ckfree(cmd); + } + cmd = new; + } + strcpy(cmd + spaceUsed, string); + spaceUsed += length; + } + va_end(argList); + cmd[spaceUsed] = '\0'; + + result = Tcl_Eval(interp, cmd); + if (cmd != fixedSpace) { + ckfree(cmd); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GlobalEval -- + * + * Evaluate a command at global level in an interpreter. + * + * Results: + * A standard Tcl result is returned, and interp->result is + * modified accordingly. + * + * Side effects: + * The command string is executed in interp, and the execution + * is carried out in the variable context of global level (no + * procedures active), just as if an "uplevel #0" command were + * being executed. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_GlobalEval(interp, command) + Tcl_Interp *interp; /* Interpreter in which to evaluate command. */ + char *command; /* Command to evaluate. */ +{ + register Interp *iPtr = (Interp *) interp; + int result; + CallFrame *savedVarFramePtr; + + savedVarFramePtr = iPtr->varFramePtr; + iPtr->varFramePtr = NULL; + result = Tcl_Eval(interp, command); + iPtr->varFramePtr = savedVarFramePtr; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetRecursionLimit -- + * + * Set the maximum number of recursive calls that may be active + * for an interpreter at once. + * + * Results: + * The return value is the old limit on nesting for interp. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_SetRecursionLimit(interp, depth) + Tcl_Interp *interp; /* Interpreter whose nesting limit + * is to be set. */ + int depth; /* New value for maximimum depth. */ +{ + Interp *iPtr = (Interp *) interp; + int old; + + old = iPtr->maxNestingDepth; + if (depth > 0) { + iPtr->maxNestingDepth = depth; + } + return old; +} diff --git a/vendor/x11iraf/obm/Tcl/tclCkalloc.c b/vendor/x11iraf/obm/Tcl/tclCkalloc.c new file mode 100644 index 00000000..6f049224 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclCkalloc.c @@ -0,0 +1,607 @@ +/* + * tclCkalloc.c -- + * Interface to malloc and free that provides support for debugging problems + * involving overwritten, double freeing memory and loss of memory. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * This code contributed by Karl Lehenbauer and Mark Diekhans + * + */ + +#include "tclInt.h" + +#define FALSE 0 +#define TRUE 1 + +#ifdef TCL_MEM_DEBUG +#ifndef TCL_GENERIC_ONLY +#include "tclUnix.h" +#endif + +#define GUARD_SIZE 8 + +struct mem_header { + long length; + char *file; + int line; + struct mem_header *flink; + struct mem_header *blink; + int dummy; /* Aligns body on 8-byte boundary. */ + unsigned char low_guard[GUARD_SIZE]; + char body[1]; +}; + +static struct mem_header *allocHead = NULL; /* List of allocated structures */ + +#define GUARD_VALUE 0341 + +/* static char high_guard[] = {0x89, 0xab, 0xcd, 0xef}; */ + +static int total_mallocs = 0; +static int total_frees = 0; +static int current_bytes_malloced = 0; +static int maximum_bytes_malloced = 0; +static int current_malloc_packets = 0; +static int maximum_malloc_packets = 0; +static int break_on_malloc = 0; +static int trace_on_at_malloc = 0; +static int alloc_tracing = FALSE; +static int init_malloced_bodies = TRUE; +#ifdef MEM_VALIDATE + static int validate_memory = TRUE; +#else + static int validate_memory = FALSE; +#endif + +/* + * Prototypes for procedures defined in this file: + */ + +static int MemoryCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); + +/* + *---------------------------------------------------------------------- + * + * dump_memory_info -- + * Display the global memory management statistics. + * + *---------------------------------------------------------------------- + */ +static void +dump_memory_info(outFile) + FILE *outFile; +{ + fprintf(outFile,"total mallocs %10d\n", + total_mallocs); + fprintf(outFile,"total frees %10d\n", + total_frees); + fprintf(outFile,"current packets allocated %10d\n", + current_malloc_packets); + fprintf(outFile,"current bytes allocated %10d\n", + current_bytes_malloced); + fprintf(outFile,"maximum packets allocated %10d\n", + maximum_malloc_packets); + fprintf(outFile,"maximum bytes allocated %10d\n", + maximum_bytes_malloced); +} + +/* + *---------------------------------------------------------------------- + * + * ValidateMemory -- + * Procedure to validate allocted memory guard zones. + * + *---------------------------------------------------------------------- + */ +static void +ValidateMemory (memHeaderP, file, line, nukeGuards) + struct mem_header *memHeaderP; + char *file; + int line; + int nukeGuards; +{ + unsigned char *hiPtr; + int idx; + int guard_failed = FALSE; + int byte; + + for (idx = 0; idx < GUARD_SIZE; idx++) { + byte = *(memHeaderP->low_guard + idx); + if (byte != GUARD_VALUE) { + guard_failed = TRUE; + fflush (stdout); + byte &= 0xff; + fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", idx, byte, + (isprint(UCHAR(byte)) ? byte : ' ')); + } + } + if (guard_failed) { + dump_memory_info (stderr); + fprintf (stderr, "low guard failed at %lx, %s %d\n", + memHeaderP->body, file, line); + fflush (stderr); /* In case name pointer is bad. */ + fprintf (stderr, "%d bytes allocated at (%s %d)\n", memHeaderP->length, + memHeaderP->file, memHeaderP->line); + panic ("Memory validation failure"); + } + + hiPtr = (unsigned char *)memHeaderP->body + memHeaderP->length; + for (idx = 0; idx < GUARD_SIZE; idx++) { + byte = *(hiPtr + idx); + if (byte != GUARD_VALUE) { + guard_failed = TRUE; + fflush (stdout); + byte &= 0xff; + fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", idx, byte, + (isprint(UCHAR(byte)) ? byte : ' ')); + } + } + + if (guard_failed) { + dump_memory_info (stderr); + fprintf (stderr, "high guard failed at %lx, %s %d\n", + memHeaderP->body, file, line); + fflush (stderr); /* In case name pointer is bad. */ + fprintf (stderr, "%d bytes allocated at (%s %d)\n", memHeaderP->length, + memHeaderP->file, memHeaderP->line); + panic ("Memory validation failure"); + } + + if (nukeGuards) { + memset ((char *) memHeaderP->low_guard, 0, GUARD_SIZE); + memset ((char *) hiPtr, 0, GUARD_SIZE); + } + +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ValidateAllMemory -- + * Validates guard regions for all allocated memory. + * + *---------------------------------------------------------------------- + */ +void +Tcl_ValidateAllMemory (file, line) + char *file; + int line; +{ + struct mem_header *memScanP; + + for (memScanP = allocHead; memScanP != NULL; memScanP = memScanP->flink) + ValidateMemory (memScanP, file, line, FALSE); + +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DumpActiveMemory -- + * Displays all allocated memory to stderr. + * + * Results: + * Return TCL_ERROR if an error accessing the file occures, `errno' + * will have the file error number left in it. + *---------------------------------------------------------------------- + */ +int +Tcl_DumpActiveMemory (fileName) + char *fileName; +{ + FILE *fileP; + struct mem_header *memScanP; + char *address; + + fileP = fopen (fileName, "w"); + if (fileP == NULL) + return TCL_ERROR; + + for (memScanP = allocHead; memScanP != NULL; memScanP = memScanP->flink) { + address = &memScanP->body [0]; + fprintf (fileP, "%8lx - %8lx %7d @ %s %d", address, + address + memScanP->length - 1, memScanP->length, + memScanP->file, memScanP->line); + (void) fputc('\n', fileP); + } + fclose (fileP); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DbCkalloc - debugging ckalloc + * + * Allocate the requested amount of space plus some extra for + * guard bands at both ends of the request, plus a size, panicing + * if there isn't enough space, then write in the guard bands + * and return the address of the space in the middle that the + * user asked for. + * + * The second and third arguments are file and line, these contain + * the filename and line number corresponding to the caller. + * These are sent by the ckalloc macro; it uses the preprocessor + * autodefines __FILE__ and __LINE__. + * + *---------------------------------------------------------------------- + */ +char * +Tcl_DbCkalloc(size, file, line) + unsigned int size; + char *file; + int line; +{ + struct mem_header *result; + + if (validate_memory) + Tcl_ValidateAllMemory (file, line); + + result = (struct mem_header *)malloc((unsigned)size + + sizeof(struct mem_header) + GUARD_SIZE); + if (result == NULL) { + fflush(stdout); + dump_memory_info(stderr); + panic("unable to alloc %d bytes, %s line %d", size, file, + line); + } + + /* + * Fill in guard zones and size. Also initialize the contents of + * the block with bogus bytes to detect uses of initialized data. + * Link into allocated list. + */ + if (init_malloced_bodies) { + memset ((VOID *) result, GUARD_VALUE, + size + sizeof(struct mem_header) + GUARD_SIZE); + } else { + memset ((char *) result->low_guard, GUARD_VALUE, GUARD_SIZE); + memset (result->body + size, GUARD_VALUE, GUARD_SIZE); + } + result->length = size; + result->file = file; + result->line = line; + result->flink = allocHead; + result->blink = NULL; + if (allocHead != NULL) + allocHead->blink = result; + allocHead = result; + + total_mallocs++; + if (trace_on_at_malloc && (total_mallocs >= trace_on_at_malloc)) { + (void) fflush(stdout); + fprintf(stderr, "reached malloc trace enable point (%d)\n", + total_mallocs); + fflush(stderr); + alloc_tracing = TRUE; + trace_on_at_malloc = 0; + } + + if (alloc_tracing) + fprintf(stderr,"ckalloc %lx %d %s %d\n", result->body, size, + file, line); + + if (break_on_malloc && (total_mallocs >= break_on_malloc)) { + break_on_malloc = 0; + (void) fflush(stdout); + fprintf(stderr,"reached malloc break limit (%d)\n", + total_mallocs); + fprintf(stderr, "program will now enter C debugger\n"); + (void) fflush(stderr); + abort(); + } + + current_malloc_packets++; + if (current_malloc_packets > maximum_malloc_packets) + maximum_malloc_packets = current_malloc_packets; + current_bytes_malloced += size; + if (current_bytes_malloced > maximum_bytes_malloced) + maximum_bytes_malloced = current_bytes_malloced; + + return result->body; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DbCkfree - debugging ckfree + * + * Verify that the low and high guards are intact, and if so + * then free the buffer else panic. + * + * The guards are erased after being checked to catch duplicate + * frees. + * + * The second and third arguments are file and line, these contain + * the filename and line number corresponding to the caller. + * These are sent by the ckfree macro; it uses the preprocessor + * autodefines __FILE__ and __LINE__. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_DbCkfree(ptr, file, line) + char * ptr; + char *file; + int line; +{ + struct mem_header *memp = 0; /* Must be zero for size calc */ + + /* + * Since header ptr is zero, body offset will be size + */ +#ifdef _CRAYCOM + memp = (struct mem_header *)((char *) ptr - (sizeof(int)*((unsigned)&(memp->body)))); +#else + memp = (struct mem_header *)(((char *) ptr) - (int)memp->body); +#endif + + if (alloc_tracing) + fprintf(stderr, "ckfree %lx %ld %s %d\n", memp->body, + memp->length, file, line); + + if (validate_memory) + Tcl_ValidateAllMemory (file, line); + + ValidateMemory (memp, file, line, TRUE); + if (init_malloced_bodies) { + memset((VOID *) ptr, GUARD_VALUE, memp->length); + } + + total_frees++; + current_malloc_packets--; + current_bytes_malloced -= memp->length; + + /* + * Delink from allocated list + */ + if (memp->flink != NULL) + memp->flink->blink = memp->blink; + if (memp->blink != NULL) + memp->blink->flink = memp->flink; + if (allocHead == memp) + allocHead = memp->flink; + free((char *) memp); + return 0; +} + +/* + *-------------------------------------------------------------------- + * + * Tcl_DbCkrealloc - debugging ckrealloc + * + * Reallocate a chunk of memory by allocating a new one of the + * right size, copying the old data to the new location, and then + * freeing the old memory space, using all the memory checking + * features of this package. + * + *-------------------------------------------------------------------- + */ +char * +Tcl_DbCkrealloc(ptr, size, file, line) + char *ptr; + unsigned int size; + char *file; + int line; +{ + char *new; + unsigned int copySize; + struct mem_header *memp = 0; /* Must be zero for size calc */ + +#ifdef _CRAYCOM + memp = (struct mem_header *)((char *) ptr - (sizeof(int)*((unsigned)&(memp->body)))); +#else + memp = (struct mem_header *)(((char *) ptr) - (int)memp->body); +#endif + copySize = size; + if (copySize > memp->length) { + copySize = memp->length; + } + new = Tcl_DbCkalloc(size, file, line); + memcpy((VOID *) new, (VOID *) ptr, (int) copySize); + Tcl_DbCkfree(ptr, file, line); + return(new); +} + +/* + *---------------------------------------------------------------------- + * + * MemoryCmd -- + * Implements the TCL memory command: + * memory info + * memory display + * break_on_malloc count + * trace_on_at_malloc count + * trace on|off + * validate on|off + * + * Results: + * Standard TCL results. + * + *---------------------------------------------------------------------- + */ + /* ARGSUSED */ +static int +MemoryCmd (clientData, interp, argc, argv) + ClientData clientData; + Tcl_Interp *interp; + int argc; + char **argv; +{ + char *fileName; + Tcl_DString buffer; + int result; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " option [args..]\"", (char *) NULL); + return TCL_ERROR; + } + + if (strcmp(argv[1],"trace") == 0) { + if (argc != 3) + goto bad_suboption; + alloc_tracing = (strcmp(argv[2],"on") == 0); + return TCL_OK; + } + if (strcmp(argv[1],"init") == 0) { + if (argc != 3) + goto bad_suboption; + init_malloced_bodies = (strcmp(argv[2],"on") == 0); + return TCL_OK; + } + if (strcmp(argv[1],"validate") == 0) { + if (argc != 3) + goto bad_suboption; + validate_memory = (strcmp(argv[2],"on") == 0); + return TCL_OK; + } + if (strcmp(argv[1],"trace_on_at_malloc") == 0) { + if (argc != 3) + goto argError; + if (Tcl_GetInt(interp, argv[2], &trace_on_at_malloc) != TCL_OK) + return TCL_ERROR; + return TCL_OK; + } + if (strcmp(argv[1],"break_on_malloc") == 0) { + if (argc != 3) + goto argError; + if (Tcl_GetInt(interp, argv[2], &break_on_malloc) != TCL_OK) + return TCL_ERROR; + return TCL_OK; + } + + if (strcmp(argv[1],"info") == 0) { + dump_memory_info(stdout); + return TCL_OK; + } + if (strcmp(argv[1],"active") == 0) { + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " active file", (char *) NULL); + return TCL_ERROR; + } + fileName = Tcl_TildeSubst(interp, argv[2], &buffer); + if (fileName == NULL) { + return TCL_ERROR; + } + result = Tcl_DumpActiveMemory (fileName); + Tcl_DStringFree(&buffer); + if (result != TCL_OK) { + Tcl_AppendResult(interp, "error accessing ", argv[2], + (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; + } + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be info, init, active, break_on_malloc, ", + "trace_on_at_malloc, trace, or validate", (char *) NULL); + return TCL_ERROR; + +argError: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ", argv[1], "count\"", (char *) NULL); + return TCL_ERROR; + +bad_suboption: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ", argv[1], " on|off\"", (char *) NULL); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_InitMemory -- + * Initialize the memory command. + * + *---------------------------------------------------------------------- + */ +void +Tcl_InitMemory(interp) + Tcl_Interp *interp; +{ +Tcl_CreateCommand (interp, "memory", MemoryCmd, (ClientData) NULL, + (Tcl_CmdDeleteProc *) NULL); +} + +#else + + +/* + *---------------------------------------------------------------------- + * + * Tcl_Ckalloc -- + * Interface to malloc when TCL_MEM_DEBUG is disabled. It does check + * that memory was actually allocated. + * + *---------------------------------------------------------------------- + */ +VOID * +Tcl_Ckalloc (size) + unsigned int size; +{ + char *result; + + result = malloc(size); + if (result == NULL) + panic("unable to alloc %d bytes", size); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * TckCkfree -- + * Interface to free when TCL_MEM_DEBUG is disabled. Done here rather + * in the macro to keep some modules from being compiled with + * TCL_MEM_DEBUG enabled and some with it disabled. + * + *---------------------------------------------------------------------- + */ +void +Tcl_Ckfree (ptr) + VOID *ptr; +{ + free (ptr); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_InitMemory -- + * Dummy initialization for memory command, which is only available + * if TCL_MEM_DEBUG is on. + * + *---------------------------------------------------------------------- + */ + /* ARGSUSED */ +void +Tcl_InitMemory(interp) + Tcl_Interp *interp; +{ +} + +#endif diff --git a/vendor/x11iraf/obm/Tcl/tclCmdAH.c b/vendor/x11iraf/obm/Tcl/tclCmdAH.c new file mode 100644 index 00000000..5238804b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclCmdAH.c @@ -0,0 +1,952 @@ +/* + * tclCmdAH.c -- + * + * This file contains the top-level command routines for most of + * the Tcl built-in commands whose names begin with the letters + * A to H. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclCmdAH.c,v 1.93 93/10/28 16:19:20 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" + + +/* + *---------------------------------------------------------------------- + * + * Tcl_BreakCmd -- + * + * This procedure is invoked to process the "break" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_BreakCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + if (argc != 1) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], "\"", (char *) NULL); + return TCL_ERROR; + } + return TCL_BREAK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CaseCmd -- + * + * This procedure is invoked to process the "case" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_CaseCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i, result; + int body; + char *string; + int caseArgc, splitArgs; + char **caseArgv; + + if (argc < 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " string ?in? patList body ... ?default body?\"", + (char *) NULL); + return TCL_ERROR; + } + string = argv[1]; + body = -1; + if (strcmp(argv[2], "in") == 0) { + i = 3; + } else { + i = 2; + } + caseArgc = argc - i; + caseArgv = argv + i; + + /* + * If all of the pattern/command pairs are lumped into a single + * argument, split them out again. + */ + + splitArgs = 0; + if (caseArgc == 1) { + result = Tcl_SplitList(interp, caseArgv[0], &caseArgc, &caseArgv); + if (result != TCL_OK) { + return result; + } + splitArgs = 1; + } + + for (i = 0; i < caseArgc; i += 2) { + int patArgc, j; + char **patArgv; + register char *p; + + if (i == (caseArgc-1)) { + interp->result = "extra case pattern with no body"; + result = TCL_ERROR; + goto cleanup; + } + + /* + * Check for special case of single pattern (no list) with + * no backslash sequences. + */ + + for (p = caseArgv[i]; *p != 0; p++) { + if (isspace(UCHAR(*p)) || (*p == '\\')) { + break; + } + } + if (*p == 0) { + if ((*caseArgv[i] == 'd') + && (strcmp(caseArgv[i], "default") == 0)) { + body = i+1; + } + if (Tcl_StringMatch(string, caseArgv[i])) { + body = i+1; + goto match; + } + continue; + } + + /* + * Break up pattern lists, then check each of the patterns + * in the list. + */ + + result = Tcl_SplitList(interp, caseArgv[i], &patArgc, &patArgv); + if (result != TCL_OK) { + goto cleanup; + } + for (j = 0; j < patArgc; j++) { + if (Tcl_StringMatch(string, patArgv[j])) { + body = i+1; + break; + } + } + ckfree((char *) patArgv); + if (j < patArgc) { + break; + } + } + + match: + if (body != -1) { + result = Tcl_Eval(interp, caseArgv[body]); + if (result == TCL_ERROR) { + char msg[100]; + sprintf(msg, "\n (\"%.50s\" arm line %d)", caseArgv[body-1], + interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + goto cleanup; + } + + /* + * Nothing matched: return nothing. + */ + + result = TCL_OK; + + cleanup: + if (splitArgs) { + ckfree((char *) caseArgv); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CatchCmd -- + * + * This procedure is invoked to process the "catch" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_CatchCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int result; + + if ((argc != 2) && (argc != 3)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " command ?varName?\"", (char *) NULL); + return TCL_ERROR; + } + result = Tcl_Eval(interp, argv[1]); + if (argc == 3) { + if (Tcl_SetVar(interp, argv[2], interp->result, 0) == NULL) { + Tcl_SetResult(interp, "couldn't save command result in variable", + TCL_STATIC); + return TCL_ERROR; + } + } + Tcl_ResetResult(interp); + sprintf(interp->result, "%d", result); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ConcatCmd -- + * + * This procedure is invoked to process the "concat" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ConcatCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + if (argc >= 2) { + interp->result = Tcl_Concat(argc-1, argv+1); + interp->freeProc = (Tcl_FreeProc *) free; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ContinueCmd -- + * + * This procedure is invoked to process the "continue" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ContinueCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + if (argc != 1) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + "\"", (char *) NULL); + return TCL_ERROR; + } + return TCL_CONTINUE; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ErrorCmd -- + * + * This procedure is invoked to process the "error" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ErrorCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + Interp *iPtr = (Interp *) interp; + + if ((argc < 2) || (argc > 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " message ?errorInfo? ?errorCode?\"", (char *) NULL); + return TCL_ERROR; + } + if ((argc >= 3) && (argv[2][0] != 0)) { + Tcl_AddErrorInfo(interp, argv[2]); + iPtr->flags |= ERR_ALREADY_LOGGED; + } + if (argc == 4) { + Tcl_SetVar2(interp, "errorCode", (char *) NULL, argv[3], + TCL_GLOBAL_ONLY); + iPtr->flags |= ERROR_CODE_SET; + } + Tcl_SetResult(interp, argv[1], TCL_VOLATILE); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_EvalCmd -- + * + * This procedure is invoked to process the "eval" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_EvalCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int result; + char *cmd; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " arg ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + if (argc == 2) { + result = Tcl_Eval(interp, argv[1]); + } else { + + /* + * More than one argument: concatenate them together with spaces + * between, then evaluate the result. + */ + + cmd = Tcl_Concat(argc-1, argv+1); + result = Tcl_Eval(interp, cmd); + ckfree(cmd); + } + if (result == TCL_ERROR) { + char msg[60]; + sprintf(msg, "\n (\"eval\" body line %d)", interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ExprCmd -- + * + * This procedure is invoked to process the "expr" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ExprCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + Tcl_DString buffer; + int i, result; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " arg ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + + if (argc == 2) { + return Tcl_ExprString(interp, argv[1]); + } + Tcl_DStringInit(&buffer); + Tcl_DStringAppend(&buffer, argv[1], -1); + for (i = 2; i < argc; i++) { + Tcl_DStringAppend(&buffer, " ", 1); + Tcl_DStringAppend(&buffer, argv[i], -1); + } + result = Tcl_ExprString(interp, buffer.string); + Tcl_DStringFree(&buffer); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ForCmd -- + * + * This procedure is invoked to process the "for" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ForCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int result, value; + + if (argc != 5) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " start test next command\"", (char *) NULL); + return TCL_ERROR; + } + + result = Tcl_Eval(interp, argv[1]); + if (result != TCL_OK) { + if (result == TCL_ERROR) { + Tcl_AddErrorInfo(interp, "\n (\"for\" initial command)"); + } + return result; + } + while (1) { + result = Tcl_ExprBoolean(interp, argv[2], &value); + if (result != TCL_OK) { + return result; + } + if (!value) { + break; + } + result = Tcl_Eval(interp, argv[4]); + if ((result != TCL_OK) && (result != TCL_CONTINUE)) { + if (result == TCL_ERROR) { + char msg[60]; + sprintf(msg, "\n (\"for\" body line %d)", interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + break; + } + result = Tcl_Eval(interp, argv[3]); + if (result == TCL_BREAK) { + break; + } else if (result != TCL_OK) { + if (result == TCL_ERROR) { + Tcl_AddErrorInfo(interp, "\n (\"for\" loop-end command)"); + } + return result; + } + } + if (result == TCL_BREAK) { + result = TCL_OK; + } + if (result == TCL_OK) { + Tcl_ResetResult(interp); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ForeachCmd -- + * + * This procedure is invoked to process the "foreach" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ForeachCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int listArgc, i, result; + char **listArgv; + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " varName list command\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Break the list up into elements, and execute the command once + * for each value of the element. + */ + + result = Tcl_SplitList(interp, argv[2], &listArgc, &listArgv); + if (result != TCL_OK) { + return result; + } + for (i = 0; i < listArgc; i++) { + if (Tcl_SetVar(interp, argv[1], listArgv[i], 0) == NULL) { + Tcl_SetResult(interp, "couldn't set loop variable", TCL_STATIC); + result = TCL_ERROR; + break; + } + + result = Tcl_Eval(interp, argv[3]); + if (result != TCL_OK) { + if (result == TCL_CONTINUE) { + result = TCL_OK; + } else if (result == TCL_BREAK) { + result = TCL_OK; + break; + } else if (result == TCL_ERROR) { + char msg[100]; + sprintf(msg, "\n (\"foreach\" body line %d)", + interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + break; + } else { + break; + } + } + } + ckfree((char *) listArgv); + if (result == TCL_OK) { + Tcl_ResetResult(interp); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_FormatCmd -- + * + * This procedure is invoked to process the "format" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_FormatCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register char *format; /* Used to read characters from the format + * string. */ + char newFormat[40]; /* A new format specifier is generated here. */ + int width; /* Field width from field specifier, or 0 if + * no width given. */ + int precision; /* Field precision from field specifier, or 0 + * if no precision given. */ + int size; /* Number of bytes needed for result of + * conversion, based on type of conversion + * ("e", "s", etc.) and width from above. */ + char *oneWordValue = NULL; /* Used to hold value to pass to sprintf, if + * it's a one-word value. */ + double twoWordValue; /* Used to hold value to pass to sprintf if + * it's a two-word value. */ + int useTwoWords; /* 0 means use oneWordValue, 1 means use + * twoWordValue. */ + char *dst = interp->result; /* Where result is stored. Starts off at + * interp->resultSpace, but may get dynamically + * re-allocated if this isn't enough. */ + int dstSize = 0; /* Number of non-null characters currently + * stored at dst. */ + int dstSpace = TCL_RESULT_SIZE; + /* Total amount of storage space available + * in dst (not including null terminator. */ + int noPercent; /* Special case for speed: indicates there's + * no field specifier, just a string to copy. */ + int argIndex; /* Index of argument to substitute next. */ + int gotXpg = 0; /* Non-zero means that an XPG3 %n$-style + * specifier has been seen. */ + int gotSequential = 0; /* Non-zero means that a regular sequential + * (non-XPG3) conversion specifier has been + * seen. */ + int useShort; /* Value to be printed is short (half word). */ + char *end; /* Used to locate end of numerical fields. */ + + /* + * This procedure is a bit nasty. The goal is to use sprintf to + * do most of the dirty work. There are several problems: + * 1. this procedure can't trust its arguments. + * 2. we must be able to provide a large enough result area to hold + * whatever's generated. This is hard to estimate. + * 2. there's no way to move the arguments from argv to the call + * to sprintf in a reasonable way. This is particularly nasty + * because some of the arguments may be two-word values (doubles). + * So, what happens here is to scan the format string one % group + * at a time, making many individual calls to sprintf. + */ + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " formatString ?arg arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + argIndex = 2; + for (format = argv[1]; *format != 0; ) { + register char *newPtr = newFormat; + + width = precision = useTwoWords = noPercent = useShort = 0; + + /* + * Get rid of any characters before the next field specifier. + */ + + if (*format != '%') { + register char *p; + + oneWordValue = p = format; + while ((*format != '%') && (*format != 0)) { + *p = *format; + p++; + format++; + } + size = p - oneWordValue; + noPercent = 1; + goto doField; + } + + if (format[1] == '%') { + oneWordValue = format; + size = 1; + noPercent = 1; + format += 2; + goto doField; + } + + /* + * Parse off a field specifier, compute how many characters + * will be needed to store the result, and substitute for + * "*" size specifiers. + */ + + *newPtr = '%'; + newPtr++; + format++; + if (isdigit(UCHAR(*format))) { + int tmp; + + /* + * Check for an XPG3-style %n$ specification. Note: there + * must not be a mixture of XPG3 specs and non-XPG3 specs + * in the same format string. + */ + + tmp = strtoul(format, &end, 10); + if (*end != '$') { + goto notXpg; + } + format = end+1; + gotXpg = 1; + if (gotSequential) { + goto mixedXPG; + } + argIndex = tmp+1; + if ((argIndex < 2) || (argIndex >= argc)) { + goto badIndex; + } + goto xpgCheckDone; + } + + notXpg: + gotSequential = 1; + if (gotXpg) { + goto mixedXPG; + } + + xpgCheckDone: + while ((*format == '-') || (*format == '#') || (*format == '0') + || (*format == ' ') || (*format == '+')) { + *newPtr = *format; + newPtr++; + format++; + } + if (isdigit(UCHAR(*format))) { + width = strtoul(format, &end, 10); + format = end; + } else if (*format == '*') { + if (argIndex >= argc) { + goto badIndex; + } + if (Tcl_GetInt(interp, argv[argIndex], &width) != TCL_OK) { + goto fmtError; + } + argIndex++; + format++; + } + if (width != 0) { + sprintf(newPtr, "%d", width); + while (*newPtr != 0) { + newPtr++; + } + } + if (*format == '.') { + *newPtr = '.'; + newPtr++; + format++; + } + if (isdigit(UCHAR(*format))) { + precision = strtoul(format, &end, 10); + format = end; + } else if (*format == '*') { + if (argIndex >= argc) { + goto badIndex; + } + if (Tcl_GetInt(interp, argv[argIndex], &precision) != TCL_OK) { + goto fmtError; + } + argIndex++; + format++; + } + if (precision != 0) { + sprintf(newPtr, "%d", precision); + while (*newPtr != 0) { + newPtr++; + } + } + if (*format == 'l') { + format++; + } else if (*format == 'h') { + useShort = 1; + *newPtr = 'h'; + newPtr++; + format++; + } + *newPtr = *format; + newPtr++; + *newPtr = 0; + if (argIndex >= argc) { + goto badIndex; + } + switch (*format) { + case 'i': + newPtr[-1] = 'd'; + case 'd': + case 'o': + case 'u': + case 'x': + case 'X': + if (Tcl_GetInt(interp, argv[argIndex], (int *) &oneWordValue) + != TCL_OK) { + goto fmtError; + } + size = 40; + break; + case 's': + oneWordValue = argv[argIndex]; + size = strlen(argv[argIndex]); + break; + case 'c': + if (Tcl_GetInt(interp, argv[argIndex], (int *) &oneWordValue) + != TCL_OK) { + goto fmtError; + } + size = 1; + break; + case 'e': + case 'E': + case 'f': + case 'g': + case 'G': + if (Tcl_GetDouble(interp, argv[argIndex], &twoWordValue) + != TCL_OK) { + goto fmtError; + } + useTwoWords = 1; + size = 320; + if (precision > 10) { + size += precision; + } + break; + case 0: + interp->result = + "format string ended in middle of field specifier"; + goto fmtError; + default: + sprintf(interp->result, "bad field specifier \"%c\"", *format); + goto fmtError; + } + argIndex++; + format++; + + /* + * Make sure that there's enough space to hold the formatted + * result, then format it. + */ + + doField: + if (width > size) { + size = width; + } + if ((dstSize + size) > dstSpace) { + char *newDst; + int newSpace; + + newSpace = 2*(dstSize + size); + newDst = (char *) ckalloc((unsigned) newSpace+1); + if (dstSize != 0) { + memcpy((VOID *) newDst, (VOID *) dst, dstSize); + } + if (dstSpace != TCL_RESULT_SIZE) { + ckfree(dst); + } + dst = newDst; + dstSpace = newSpace; + } + if (noPercent) { + memcpy((VOID *) (dst+dstSize), (VOID *) oneWordValue, size); + dstSize += size; + dst[dstSize] = 0; + } else { + if (useTwoWords) { + sprintf(dst+dstSize, newFormat, twoWordValue); + } else if (useShort) { + /* + * The double cast below is needed for a few machines + * (e.g. Pyramids as of 1/93) that don't like casts + * directly from pointers to shorts. + */ + + sprintf(dst+dstSize, newFormat, (short) (int) oneWordValue); + } else { + sprintf(dst+dstSize, newFormat, (char *) oneWordValue); + } + dstSize += strlen(dst+dstSize); + } + } + + interp->result = dst; + if (dstSpace != TCL_RESULT_SIZE) { + interp->freeProc = (Tcl_FreeProc *) free; + } else { + interp->freeProc = 0; + } + return TCL_OK; + + mixedXPG: + interp->result = "cannot mix \"%\" and \"%n$\" conversion specifiers"; + goto fmtError; + + badIndex: + if (gotXpg) { + interp->result = "\"%n$\" argument index out of range"; + } else { + interp->result = "not enough arguments for all format specifiers"; + } + + fmtError: + if (dstSpace != TCL_RESULT_SIZE) { + ckfree(dst); + } + return TCL_ERROR; +} diff --git a/vendor/x11iraf/obm/Tcl/tclCmdIL.c b/vendor/x11iraf/obm/Tcl/tclCmdIL.c new file mode 100644 index 00000000..d32e0f1e --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclCmdIL.c @@ -0,0 +1,1403 @@ +/* + * tclCmdIL.c -- + * + * This file contains the top-level command routines for most of + * the Tcl built-in commands whose names begin with the letters + * I through L. It contains only commands in the generic core + * (i.e. those that don't depend much upon UNIX facilities). + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclCmdIL.c,v 1.103 93/10/28 16:19:29 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" +#include "patchlevel.h" + +/* + * The variables below are used to implement the "lsort" command. + * Unfortunately, this use of static variables prevents "lsort" + * from being thread-safe, but there's no alternative given the + * current implementation of qsort. In a threaded environment + * these variables should be made thread-local if possible, or else + * "lsort" needs internal mutual exclusion. + */ + +static Tcl_Interp *sortInterp; /* Interpreter for "lsort" command. */ +static enum {ASCII, INTEGER, REAL, COMMAND} sortMode; + /* Mode for sorting: compare as strings, + * compare as numbers, or call + * user-defined command for + * comparison. */ +static Tcl_DString sortCmd; /* Holds command if mode is COMMAND. + * pre-initialized to hold base of + * command. */ +static int sortIncreasing; /* 0 means sort in decreasing order, + * 1 means increasing order. */ +static int sortCode; /* Anything other than TCL_OK means a + * problem occurred while sorting; this + * executing a comparison command, so + * the sort was aborted. */ + +/* + * Forward declarations for procedures defined in this file: + */ + +static int SortCompareProc _ANSI_ARGS_((CONST VOID *first, + CONST VOID *second)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_IfCmd -- + * + * This procedure is invoked to process the "if" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_IfCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i, result, value; + + i = 1; + while (1) { + /* + * At this point in the loop, argv and argc refer to an expression + * to test, either for the main expression or an expression + * following an "elseif". The arguments after the expression must + * be "then" (optional) and a script to execute if the expression is + * true. + */ + + if (i >= argc) { + Tcl_AppendResult(interp, "wrong # args: no expression after \"", + argv[i-1], "\" argument", (char *) NULL); + return TCL_ERROR; + } + result = Tcl_ExprBoolean(interp, argv[i], &value); + if (result != TCL_OK) { + return result; + } + i++; + if ((i < argc) && (strcmp(argv[i], "then") == 0)) { + i++; + } + if (i >= argc) { + Tcl_AppendResult(interp, "wrong # args: no script following \"", + argv[i-1], "\" argument", (char *) NULL); + return TCL_ERROR; + } + if (value) { + return Tcl_Eval(interp, argv[i]); + } + + /* + * The expression evaluated to false. Skip the command, then + * see if there is an "else" or "elseif" clause. + */ + + i++; + if (i >= argc) { + return TCL_OK; + } + if ((argv[i][0] == 'e') && (strcmp(argv[i], "elseif") == 0)) { + i++; + continue; + } + break; + } + + /* + * Couldn't find a "then" or "elseif" clause to execute. Check now + * for an "else" clause. We know that there's at least one more + * argument when we get here. + */ + + if (strcmp(argv[i], "else") == 0) { + i++; + if (i >= argc) { + Tcl_AppendResult(interp, + "wrong # args: no script following \"else\" argument", + (char *) NULL); + return TCL_ERROR; + } + } + return Tcl_Eval(interp, argv[i]); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_IncrCmd -- + * + * This procedure is invoked to process the "incr" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_IncrCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int value; + char *oldString, *result; + char newString[30]; + + if ((argc != 2) && (argc != 3)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " varName ?increment?\"", (char *) NULL); + return TCL_ERROR; + } + + oldString = Tcl_GetVar(interp, argv[1], TCL_LEAVE_ERR_MSG); + if (oldString == NULL) { + return TCL_ERROR; + } + if (Tcl_GetInt(interp, oldString, &value) != TCL_OK) { + Tcl_AddErrorInfo(interp, + "\n (reading value of variable to increment)"); + return TCL_ERROR; + } + if (argc == 2) { + value += 1; + } else { + int increment; + + if (Tcl_GetInt(interp, argv[2], &increment) != TCL_OK) { + Tcl_AddErrorInfo(interp, + "\n (reading increment)"); + return TCL_ERROR; + } + value += increment; + } + sprintf(newString, "%d", value); + result = Tcl_SetVar(interp, argv[1], newString, TCL_LEAVE_ERR_MSG); + if (result == NULL) { + return TCL_ERROR; + } + interp->result = result; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_InfoCmd -- + * + * This procedure is invoked to process the "info" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_InfoCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Interp *iPtr = (Interp *) interp; + int length; + char c; + Arg *argPtr; + Proc *procPtr; + Var *varPtr; + Command *cmdPtr; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " option ?arg arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + c = argv[1][0]; + length = strlen(argv[1]); + if ((c == 'a') && (strncmp(argv[1], "args", length)) == 0) { + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " args procname\"", (char *) NULL); + return TCL_ERROR; + } + procPtr = TclFindProc(iPtr, argv[2]); + if (procPtr == NULL) { + infoNoSuchProc: + Tcl_AppendResult(interp, "\"", argv[2], + "\" isn't a procedure", (char *) NULL); + return TCL_ERROR; + } + for (argPtr = procPtr->argPtr; argPtr != NULL; + argPtr = argPtr->nextPtr) { + Tcl_AppendElement(interp, argPtr->name); + } + return TCL_OK; + } else if ((c == 'b') && (strncmp(argv[1], "body", length)) == 0) { + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " body procname\"", (char *) NULL); + return TCL_ERROR; + } + procPtr = TclFindProc(iPtr, argv[2]); + if (procPtr == NULL) { + goto infoNoSuchProc; + } + iPtr->result = procPtr->command; + return TCL_OK; + } else if ((c == 'c') && (strncmp(argv[1], "cmdcount", length) == 0) + && (length >= 2)) { + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " cmdcount\"", (char *) NULL); + return TCL_ERROR; + } + sprintf(iPtr->result, "%d", iPtr->cmdCount); + return TCL_OK; + } else if ((c == 'c') && (strncmp(argv[1], "commands", length) == 0) + && (length >= 4)) { + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " commands [pattern]\"", (char *) NULL); + return TCL_ERROR; + } + for (hPtr = Tcl_FirstHashEntry(&iPtr->commandTable, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + char *name = Tcl_GetHashKey(&iPtr->commandTable, hPtr); + if ((argc == 3) && !Tcl_StringMatch(name, argv[2])) { + continue; + } + Tcl_AppendElement(interp, name); + } + return TCL_OK; + } else if ((c == 'c') && (strncmp(argv[1], "complete", length) == 0) + && (length >= 4)) { + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " complete command\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_CommandComplete(argv[2])) { + interp->result = "1"; + } else { + interp->result = "0"; + } + return TCL_OK; + } else if ((c == 'd') && (strncmp(argv[1], "default", length)) == 0) { + if (argc != 5) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " default procname arg varname\"", + (char *) NULL); + return TCL_ERROR; + } + procPtr = TclFindProc(iPtr, argv[2]); + if (procPtr == NULL) { + goto infoNoSuchProc; + } + for (argPtr = procPtr->argPtr; ; argPtr = argPtr->nextPtr) { + if (argPtr == NULL) { + Tcl_AppendResult(interp, "procedure \"", argv[2], + "\" doesn't have an argument \"", argv[3], + "\"", (char *) NULL); + return TCL_ERROR; + } + if (strcmp(argv[3], argPtr->name) == 0) { + if (argPtr->defValue != NULL) { + if (Tcl_SetVar((Tcl_Interp *) iPtr, argv[4], + argPtr->defValue, 0) == NULL) { + defStoreError: + Tcl_AppendResult(interp, + "couldn't store default value in variable \"", + argv[4], "\"", (char *) NULL); + return TCL_ERROR; + } + iPtr->result = "1"; + } else { + if (Tcl_SetVar((Tcl_Interp *) iPtr, argv[4], "", 0) + == NULL) { + goto defStoreError; + } + iPtr->result = "0"; + } + return TCL_OK; + } + } + } else if ((c == 'e') && (strncmp(argv[1], "exists", length) == 0)) { + char *p; + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " exists varName\"", (char *) NULL); + return TCL_ERROR; + } + p = Tcl_GetVar((Tcl_Interp *) iPtr, argv[2], 0); + + /* + * The code below handles the special case where the name is for + * an array: Tcl_GetVar will reject this since you can't read + * an array variable without an index. + */ + + if (p == NULL) { + Tcl_HashEntry *hPtr; + Var *varPtr; + + if (strchr(argv[2], '(') != NULL) { + noVar: + iPtr->result = "0"; + return TCL_OK; + } + if (iPtr->varFramePtr == NULL) { + hPtr = Tcl_FindHashEntry(&iPtr->globalTable, argv[2]); + } else { + hPtr = Tcl_FindHashEntry(&iPtr->varFramePtr->varTable, argv[2]); + } + if (hPtr == NULL) { + goto noVar; + } + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & VAR_UPVAR) { + varPtr = varPtr->value.upvarPtr; + } + if (!(varPtr->flags & VAR_ARRAY)) { + goto noVar; + } + } + iPtr->result = "1"; + return TCL_OK; + } else if ((c == 'g') && (strncmp(argv[1], "globals", length) == 0)) { + char *name; + + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " globals [pattern]\"", (char *) NULL); + return TCL_ERROR; + } + for (hPtr = Tcl_FirstHashEntry(&iPtr->globalTable, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & VAR_UNDEFINED) { + continue; + } + name = Tcl_GetHashKey(&iPtr->globalTable, hPtr); + if ((argc == 3) && !Tcl_StringMatch(name, argv[2])) { + continue; + } + Tcl_AppendElement(interp, name); + } + return TCL_OK; + } else if ((c == 'l') && (strncmp(argv[1], "level", length) == 0) + && (length >= 2)) { + if (argc == 2) { + if (iPtr->varFramePtr == NULL) { + iPtr->result = "0"; + } else { + sprintf(iPtr->result, "%d", iPtr->varFramePtr->level); + } + return TCL_OK; + } else if (argc == 3) { + int level; + CallFrame *framePtr; + + if (Tcl_GetInt(interp, argv[2], &level) != TCL_OK) { + return TCL_ERROR; + } + if (level <= 0) { + if (iPtr->varFramePtr == NULL) { + levelError: + Tcl_AppendResult(interp, "bad level \"", argv[2], + "\"", (char *) NULL); + return TCL_ERROR; + } + level += iPtr->varFramePtr->level; + } + for (framePtr = iPtr->varFramePtr; framePtr != NULL; + framePtr = framePtr->callerVarPtr) { + if (framePtr->level == level) { + break; + } + } + if (framePtr == NULL) { + goto levelError; + } + iPtr->result = Tcl_Merge(framePtr->argc, framePtr->argv); + iPtr->freeProc = (Tcl_FreeProc *) free; + return TCL_OK; + } + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " level [number]\"", (char *) NULL); + return TCL_ERROR; + } else if ((c == 'l') && (strncmp(argv[1], "library", length) == 0) + && (length >= 2)) { + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " library\"", (char *) NULL); + return TCL_ERROR; + } + interp->result = getenv("TCL_LIBRARY"); + if (interp->result == NULL) { +#ifdef TCL_LIBRARY + interp->result = TCL_LIBRARY; +#else + interp->result = "there is no Tcl library at this installation"; + return TCL_ERROR; +#endif + } + return TCL_OK; + } else if ((c == 'l') && (strncmp(argv[1], "locals", length) == 0) + && (length >= 2)) { + char *name; + + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " locals [pattern]\"", (char *) NULL); + return TCL_ERROR; + } + if (iPtr->varFramePtr == NULL) { + return TCL_OK; + } + for (hPtr = Tcl_FirstHashEntry(&iPtr->varFramePtr->varTable, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & (VAR_UNDEFINED|VAR_UPVAR)) { + continue; + } + name = Tcl_GetHashKey(&iPtr->varFramePtr->varTable, hPtr); + if ((argc == 3) && !Tcl_StringMatch(name, argv[2])) { + continue; + } + Tcl_AppendElement(interp, name); + } + return TCL_OK; + } else if ((c == 'p') && (strncmp(argv[1], "patchlevel", length) == 0) + && (length >= 2)) { + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " patchlevel\"", (char *) NULL); + return TCL_ERROR; + } + sprintf(interp->result, "%d", TCL_PATCH_LEVEL); + return TCL_OK; + } else if ((c == 'p') && (strncmp(argv[1], "procs", length) == 0) + && (length >= 2)) { + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " procs [pattern]\"", (char *) NULL); + return TCL_ERROR; + } + for (hPtr = Tcl_FirstHashEntry(&iPtr->commandTable, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + char *name = Tcl_GetHashKey(&iPtr->commandTable, hPtr); + + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + if (!TclIsProc(cmdPtr)) { + continue; + } + if ((argc == 3) && !Tcl_StringMatch(name, argv[2])) { + continue; + } + Tcl_AppendElement(interp, name); + } + return TCL_OK; + } else if ((c == 's') && (strncmp(argv[1], "script", length) == 0)) { + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " script\"", (char *) NULL); + return TCL_ERROR; + } + if (iPtr->scriptFile != NULL) { + /* + * Can't depend on iPtr->scriptFile to be non-volatile: + * if this command is returned as the result of the script, + * then iPtr->scriptFile will go away. + */ + + Tcl_SetResult(interp, iPtr->scriptFile, TCL_VOLATILE); + } + return TCL_OK; + } else if ((c == 't') && (strncmp(argv[1], "tclversion", length) == 0)) { + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " tclversion\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Note: TCL_VERSION below is expected to be set with a "-D" + * switch in the Makefile. + */ + + strcpy(iPtr->result, TCL_VERSION); + return TCL_OK; + } else if ((c == 'v') && (strncmp(argv[1], "vars", length)) == 0) { + Tcl_HashTable *tablePtr; + char *name; + + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " vars [pattern]\"", (char *) NULL); + return TCL_ERROR; + } + if (iPtr->varFramePtr == NULL) { + tablePtr = &iPtr->globalTable; + } else { + tablePtr = &iPtr->varFramePtr->varTable; + } + for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & VAR_UNDEFINED) { + continue; + } + name = Tcl_GetHashKey(tablePtr, hPtr); + if ((argc == 3) && !Tcl_StringMatch(name, argv[2])) { + continue; + } + Tcl_AppendElement(interp, name); + } + return TCL_OK; + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be args, body, cmdcount, commands, ", + "complete, default, ", + "exists, globals, level, library, locals, ", + "patchlevel, procs, script, tclversion, or vars", + (char *) NULL); + return TCL_ERROR; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_JoinCmd -- + * + * This procedure is invoked to process the "join" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_JoinCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *joinString; + char **listArgv; + int listArgc, i; + + if (argc == 2) { + joinString = " "; + } else if (argc == 3) { + joinString = argv[2]; + } else { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " list ?joinString?\"", (char *) NULL); + return TCL_ERROR; + } + + if (Tcl_SplitList(interp, argv[1], &listArgc, &listArgv) != TCL_OK) { + return TCL_ERROR; + } + for (i = 0; i < listArgc; i++) { + if (i == 0) { + Tcl_AppendResult(interp, listArgv[0], (char *) NULL); + } else { + Tcl_AppendResult(interp, joinString, listArgv[i], (char *) NULL); + } + } + ckfree((char *) listArgv); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LindexCmd -- + * + * This procedure is invoked to process the "lindex" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LindexCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *p, *element; + int index, size, parenthesized, result; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " list index\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[2], &index) != TCL_OK) { + return TCL_ERROR; + } + if (index < 0) { + return TCL_OK; + } + for (p = argv[1] ; index >= 0; index--) { + result = TclFindElement(interp, p, &element, &p, &size, + &parenthesized); + if (result != TCL_OK) { + return result; + } + } + if (size == 0) { + return TCL_OK; + } + if (size >= TCL_RESULT_SIZE) { + interp->result = (char *) ckalloc((unsigned) size+1); + interp->freeProc = (Tcl_FreeProc *) free; + } + if (parenthesized) { + memcpy((VOID *) interp->result, (VOID *) element, size); + interp->result[size] = 0; + } else { + TclCopyAndCollapse(size, element, interp->result); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LinsertCmd -- + * + * This procedure is invoked to process the "linsert" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LinsertCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *p, *element, savedChar; + int i, index, count, result, size; + + if (argc < 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " list index element ?element ...?\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[2], &index) != TCL_OK) { + return TCL_ERROR; + } + + /* + * Skip over the first "index" elements of the list, then add + * all of those elements to the result. + */ + + size = 0; + element = argv[1]; + for (count = 0, p = argv[1]; (count < index) && (*p != 0); count++) { + result = TclFindElement(interp, p, &element, &p, &size, (int *) NULL); + if (result != TCL_OK) { + return result; + } + } + if (*p == 0) { + Tcl_AppendResult(interp, argv[1], (char *) NULL); + } else { + char *end; + + end = element+size; + if (element != argv[1]) { + while ((*end != 0) && !isspace(UCHAR(*end))) { + end++; + } + } + savedChar = *end; + *end = 0; + Tcl_AppendResult(interp, argv[1], (char *) NULL); + *end = savedChar; + } + + /* + * Add the new list elements. + */ + + for (i = 3; i < argc; i++) { + Tcl_AppendElement(interp, argv[i]); + } + + /* + * Append the remainder of the original list. + */ + + if (*p != 0) { + Tcl_AppendResult(interp, " ", p, (char *) NULL); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ListCmd -- + * + * This procedure is invoked to process the "list" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ListCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + if (argc >= 2) { + interp->result = Tcl_Merge(argc-1, argv+1); + interp->freeProc = (Tcl_FreeProc *) free; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LlengthCmd -- + * + * This procedure is invoked to process the "llength" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LlengthCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int count, result; + char *element, *p; + + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " list\"", (char *) NULL); + return TCL_ERROR; + } + for (count = 0, p = argv[1]; *p != 0 ; count++) { + result = TclFindElement(interp, p, &element, &p, (int *) NULL, + (int *) NULL); + if (result != TCL_OK) { + return result; + } + if (*element == 0) { + break; + } + } + sprintf(interp->result, "%d", count); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LrangeCmd -- + * + * This procedure is invoked to process the "lrange" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LrangeCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int first, last, result; + char *begin, *end, c, *dummy; + int count; + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " list first last\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[2], &first) != TCL_OK) { + return TCL_ERROR; + } + if (first < 0) { + first = 0; + } + if ((*argv[3] == 'e') && (strncmp(argv[3], "end", strlen(argv[3])) == 0)) { + last = 1000000; + } else { + if (Tcl_GetInt(interp, argv[3], &last) != TCL_OK) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, + "expected integer or \"end\" but got \"", + argv[3], "\"", (char *) NULL); + return TCL_ERROR; + } + } + if (first > last) { + return TCL_OK; + } + + /* + * Extract a range of fields. + */ + + for (count = 0, begin = argv[1]; count < first; count++) { + result = TclFindElement(interp, begin, &dummy, &begin, (int *) NULL, + (int *) NULL); + if (result != TCL_OK) { + return result; + } + if (*begin == 0) { + break; + } + } + for (count = first, end = begin; (count <= last) && (*end != 0); + count++) { + result = TclFindElement(interp, end, &dummy, &end, (int *) NULL, + (int *) NULL); + if (result != TCL_OK) { + return result; + } + } + + /* + * Chop off trailing spaces. + */ + + while (isspace(UCHAR(end[-1]))) { + end--; + } + c = *end; + *end = 0; + Tcl_SetResult(interp, begin, TCL_VOLATILE); + *end = c; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LreplaceCmd -- + * + * This procedure is invoked to process the "lreplace" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LreplaceCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *p1, *p2, *element, savedChar, *dummy; + int i, first, last, count, result, size; + + if (argc < 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " list first last ?element element ...?\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[2], &first) != TCL_OK) { + return TCL_ERROR; + } + if (TclGetListIndex(interp, argv[3], &last) != TCL_OK) { + return TCL_ERROR; + } + if (first < 0) { + first = 0; + } + if (last < 0) { + last = 0; + } + if (first > last) { + Tcl_AppendResult(interp, "first index must not be greater than second", + (char *) NULL); + return TCL_ERROR; + } + + /* + * Skip over the elements of the list before "first". + */ + + size = 0; + element = argv[1]; + for (count = 0, p1 = argv[1]; (count < first) && (*p1 != 0); count++) { + result = TclFindElement(interp, p1, &element, &p1, &size, + (int *) NULL); + if (result != TCL_OK) { + return result; + } + } + if (*p1 == 0) { + Tcl_AppendResult(interp, "list doesn't contain element ", + argv[2], (char *) NULL); + return TCL_ERROR; + } + + /* + * Skip over the elements of the list up through "last". + */ + + for (p2 = p1 ; (count <= last) && (*p2 != 0); count++) { + result = TclFindElement(interp, p2, &dummy, &p2, (int *) NULL, + (int *) NULL); + if (result != TCL_OK) { + return result; + } + } + + /* + * Add the elements before "first" to the result. Be sure to + * include quote or brace characters that might terminate the + * last of these elements. + */ + + p1 = element+size; + if (element != argv[1]) { + while ((*p1 != 0) && !isspace(UCHAR(*p1))) { + p1++; + } + } + savedChar = *p1; + *p1 = 0; + Tcl_AppendResult(interp, argv[1], (char *) NULL); + *p1 = savedChar; + + /* + * Add the new list elements. + */ + + for (i = 4; i < argc; i++) { + Tcl_AppendElement(interp, argv[i]); + } + + /* + * Append the remainder of the original list. + */ + + if (*p2 != 0) { + if (*interp->result == 0) { + Tcl_SetResult(interp, p2, TCL_VOLATILE); + } else { + Tcl_AppendResult(interp, " ", p2, (char *) NULL); + } + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LsearchCmd -- + * + * This procedure is invoked to process the "lsearch" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LsearchCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ +#define EXACT 0 +#define GLOB 1 +#define REGEXP 2 + int listArgc; + char **listArgv; + int i, match, mode, index; + + mode = GLOB; + if (argc == 4) { + if (strcmp(argv[1], "-exact") == 0) { + mode = EXACT; + } else if (strcmp(argv[1], "-glob") == 0) { + mode = GLOB; + } else if (strcmp(argv[1], "-regexp") == 0) { + mode = REGEXP; + } else { + Tcl_AppendResult(interp, "bad search mode \"", argv[1], + "\": must be -exact, -glob, or -regexp", (char *) NULL); + return TCL_ERROR; + } + } else if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?mode? list pattern\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_SplitList(interp, argv[argc-2], &listArgc, &listArgv) != TCL_OK) { + return TCL_ERROR; + } + index = -1; + for (i = 0; i < listArgc; i++) { + match = 0; + switch (mode) { + case EXACT: + match = (strcmp(listArgv[i], argv[argc-1]) == 0); + break; + case GLOB: + match = Tcl_StringMatch(listArgv[i], argv[argc-1]); + break; + case REGEXP: + match = Tcl_RegExpMatch(interp, listArgv[i], argv[argc-1]); + if (match < 0) { + ckfree((char *) listArgv); + return TCL_ERROR; + } + break; + } + if (match) { + index = i; + break; + } + } + sprintf(interp->result, "%d", index); + ckfree((char *) listArgv); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LsortCmd -- + * + * This procedure is invoked to process the "lsort" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LsortCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int listArgc, i, c, length; + char **listArgv; + char *command = NULL; /* Initialization needed only to + * prevent compiler warning. */ + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?-ascii? ?-integer? ?-real? ?-increasing? ?-decreasing?", + " ?-command string? list\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Parse arguments to set up the mode for the sort. + */ + + sortInterp = interp; + sortMode = ASCII; + sortIncreasing = 1; + sortCode = TCL_OK; + for (i = 1; i < argc-1; i++) { + length = strlen(argv[i]); + if (length < 2) { + badSwitch: + Tcl_AppendResult(interp, "bad switch \"", argv[i], + "\": must be -ascii, -integer, -real, -increasing", + " -decreasing, or -command", (char *) NULL); + return TCL_ERROR; + } + c = argv[i][1]; + if ((c == 'a') && (strncmp(argv[i], "-ascii", length) == 0)) { + sortMode = ASCII; + } else if ((c == 'c') && (strncmp(argv[i], "-command", length) == 0)) { + if (i == argc-2) { + Tcl_AppendResult(interp, "\"-command\" must be", + " followed by comparison command", (char *) NULL); + return TCL_ERROR; + } + sortMode = COMMAND; + command = argv[i+1]; + i++; + } else if ((c == 'd') + && (strncmp(argv[i], "-decreasing", length) == 0)) { + sortIncreasing = 0; + } else if ((c == 'i') && (length >= 4) + && (strncmp(argv[i], "-increasing", length) == 0)) { + sortIncreasing = 1; + } else if ((c == 'i') && (length >= 4) + && (strncmp(argv[i], "-integer", length) == 0)) { + sortMode = INTEGER; + } else if ((c == 'r') + && (strncmp(argv[i], "-real", length) == 0)) { + sortMode = REAL; + } else { + goto badSwitch; + } + } + if (sortMode == COMMAND) { + Tcl_DStringInit(&sortCmd); + Tcl_DStringAppend(&sortCmd, command, -1); + } + + if (Tcl_SplitList(interp, argv[argc-1], &listArgc, &listArgv) != TCL_OK) { + return TCL_ERROR; + } + qsort((VOID *) listArgv, listArgc, sizeof (char *), SortCompareProc); + if (sortCode == TCL_OK) { + Tcl_ResetResult(interp); + interp->result = Tcl_Merge(listArgc, listArgv); + interp->freeProc = (Tcl_FreeProc *) free; + } + if (sortMode == COMMAND) { + Tcl_DStringFree(&sortCmd); + } + ckfree((char *) listArgv); + return sortCode; +} + +/* + *---------------------------------------------------------------------- + * + * SortCompareProc -- + * + * This procedure is invoked by qsort to determine the proper + * ordering between two elements. + * + * Results: + * < 0 means first is "smaller" than "second", > 0 means "first" + * is larger than "second", and 0 means they should be treated + * as equal. + * + * Side effects: + * None, unless a user-defined comparison command does something + * weird. + * + *---------------------------------------------------------------------- + */ + +static int +SortCompareProc(first, second) + CONST VOID *first, *second; /* Elements to be compared. */ +{ + int order; + char *firstString = *((char **) first); + char *secondString = *((char **) second); + + order = 0; + if (sortCode != TCL_OK) { + /* + * Once an error has occurred, skip any future comparisons + * so as to preserve the error message in sortInterp->result. + */ + + return order; + } + if (sortMode == ASCII) { + order = strcmp(firstString, secondString); + } else if (sortMode == INTEGER) { + int a, b; + + if ((Tcl_GetInt(sortInterp, firstString, &a) != TCL_OK) + || (Tcl_GetInt(sortInterp, secondString, &b) != TCL_OK)) { + Tcl_AddErrorInfo(sortInterp, + "\n (converting list element from string to integer)"); + sortCode = TCL_ERROR; + return order; + } + if (a > b) { + order = 1; + } else if (b > a) { + order = -1; + } + } else if (sortMode == REAL) { + double a, b; + + if ((Tcl_GetDouble(sortInterp, firstString, &a) != TCL_OK) + || (Tcl_GetDouble(sortInterp, secondString, &b) != TCL_OK)) { + Tcl_AddErrorInfo(sortInterp, + "\n (converting list element from string to real)"); + sortCode = TCL_ERROR; + return order; + } + if (a > b) { + order = 1; + } else if (b > a) { + order = -1; + } + } else { + int oldLength; + char *end; + + /* + * Generate and evaluate a command to determine which string comes + * first. + */ + + oldLength = Tcl_DStringLength(&sortCmd); + Tcl_DStringAppendElement(&sortCmd, firstString); + Tcl_DStringAppendElement(&sortCmd, secondString); + sortCode = Tcl_Eval(sortInterp, Tcl_DStringValue(&sortCmd)); + Tcl_DStringTrunc(&sortCmd, oldLength); + if (sortCode != TCL_OK) { + Tcl_AddErrorInfo(sortInterp, + "\n (user-defined comparison command)"); + return order; + } + + /* + * Parse the result of the command. + */ + + order = strtol(sortInterp->result, &end, 0); + if ((end == sortInterp->result) || (*end != 0)) { + Tcl_ResetResult(sortInterp); + Tcl_AppendResult(sortInterp, + "comparison command returned non-numeric result", + (char *) NULL); + sortCode = TCL_ERROR; + return order; + } + } + if (!sortIncreasing) { + order = -order; + } + return order; +} diff --git a/vendor/x11iraf/obm/Tcl/tclCmdMZ.c b/vendor/x11iraf/obm/Tcl/tclCmdMZ.c new file mode 100644 index 00000000..92f9340c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclCmdMZ.c @@ -0,0 +1,1730 @@ +/* + * tclCmdMZ.c -- + * + * This file contains the top-level command routines for most of + * the Tcl built-in commands whose names begin with the letters + * M to Z. It contains only commands in the generic core (i.e. + * those that don't depend much upon UNIX facilities). + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclCmdMZ.c,v 1.44 93/10/15 11:41:16 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" + +/* + * Structure used to hold information about variable traces: + */ + +typedef struct { + int flags; /* Operations for which Tcl command is + * to be invoked. */ + char *errMsg; /* Error message returned from Tcl command, + * or NULL. Malloc'ed. */ + int length; /* Number of non-NULL chars. in command. */ + char command[4]; /* Space for Tcl command to invoke. Actual + * size will be as large as necessary to + * hold command. This field must be the + * last in the structure, so that it can + * be larger than 4 bytes. */ +} TraceVarInfo; + +/* + * Forward declarations for procedures defined in this file: + */ + +static char * TraceVarProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, char *name1, char *name2, + int flags)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_RegexpCmd -- + * + * This procedure is invoked to process the "regexp" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_RegexpCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int noCase = 0; + int indices = 0; + regexp *regexpPtr; + char **argPtr, *string, *pattern; + int match = 0; /* Initialization needed only to + * prevent compiler warning. */ + int i; + Tcl_DString stringDString, patternDString; + + if (argc < 3) { + wrongNumArgs: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?switches? exp string ?matchVar? ?subMatchVar ", + "subMatchVar ...?\"", (char *) NULL); + return TCL_ERROR; + } + argPtr = argv+1; + argc--; + while ((argc > 0) && (argPtr[0][0] == '-')) { + if (strcmp(argPtr[0], "-indices") == 0) { + indices = 1; + } else if (strcmp(argPtr[0], "-nocase") == 0) { + noCase = 1; + } else if (strcmp(argPtr[0], "--") == 0) { + argPtr++; + argc--; + break; + } else { + Tcl_AppendResult(interp, "bad switch \"", argPtr[0], + "\": must be -indices, -nocase, or --", (char *) NULL); + return TCL_ERROR; + } + argPtr++; + argc--; + } + if (argc < 2) { + goto wrongNumArgs; + } + + /* + * Convert the string and pattern to lower case, if desired, and + * perform the matching operation. + */ + + if (noCase) { + register char *p; + + Tcl_DStringInit(&patternDString); + Tcl_DStringAppend(&patternDString, argPtr[0], -1); + pattern = Tcl_DStringValue(&patternDString); + for (p = pattern; *p != 0; p++) { + if (isupper(UCHAR(*p))) { + *p = tolower(*p); + } + } + Tcl_DStringInit(&stringDString); + Tcl_DStringAppend(&stringDString, argPtr[1], -1); + string = Tcl_DStringValue(&stringDString); + for (p = string; *p != 0; p++) { + if (isupper(UCHAR(*p))) { + *p = tolower(*p); + } + } + } else { + pattern = argPtr[0]; + string = argPtr[1]; + } + regexpPtr = TclCompileRegexp(interp, pattern); + if (regexpPtr != NULL) { + tclRegexpError = NULL; + match = TclRegExec(regexpPtr, string, string); + } + if (noCase) { + Tcl_DStringFree(&stringDString); + Tcl_DStringFree(&patternDString); + } + if (regexpPtr == NULL) { + return TCL_ERROR; + } + if (tclRegexpError != NULL) { + Tcl_AppendResult(interp, "error while matching pattern: ", + tclRegexpError, (char *) NULL); + return TCL_ERROR; + } + if (!match) { + interp->result = "0"; + return TCL_OK; + } + + /* + * If additional variable names have been specified, return + * index information in those variables. + */ + + argc -= 2; + if (argc > NSUBEXP) { + interp->result = "too many substring variables"; + return TCL_ERROR; + } + for (i = 0; i < argc; i++) { + char *result, info[50]; + + if (regexpPtr->startp[i] == NULL) { + if (indices) { + result = Tcl_SetVar(interp, argPtr[i+2], "-1 -1", 0); + } else { + result = Tcl_SetVar(interp, argPtr[i+2], "", 0); + } + } else { + if (indices) { + sprintf(info, "%d %d", regexpPtr->startp[i] - string, + regexpPtr->endp[i] - string - 1); + result = Tcl_SetVar(interp, argPtr[i+2], info, 0); + } else { + char savedChar, *first, *last; + + first = argPtr[1] + (regexpPtr->startp[i] - string); + last = argPtr[1] + (regexpPtr->endp[i] - string); + savedChar = *last; + *last = 0; + result = Tcl_SetVar(interp, argPtr[i+2], first, 0); + *last = savedChar; + } + } + if (result == NULL) { + Tcl_AppendResult(interp, "couldn't set variable \"", + argPtr[i+2], "\"", (char *) NULL); + return TCL_ERROR; + } + } + interp->result = "1"; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_RegsubCmd -- + * + * This procedure is invoked to process the "regsub" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_RegsubCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int noCase = 0, all = 0; + regexp *regexpPtr; + char *string, *pattern, *p, *firstChar, *newValue, **argPtr; + int match, flags, code, anyMatches; + register char *src, c; + Tcl_DString stringDString, patternDString; + + if (argc < 5) { + wrongNumArgs: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?switches? exp string subSpec varName\"", (char *) NULL); + return TCL_ERROR; + } + argPtr = argv+1; + argc--; + while (argPtr[0][0] == '-') { + if (strcmp(argPtr[0], "-nocase") == 0) { + noCase = 1; + } else if (strcmp(argPtr[0], "-all") == 0) { + all = 1; + } else if (strcmp(argPtr[0], "--") == 0) { + argPtr++; + argc--; + break; + } else { + Tcl_AppendResult(interp, "bad switch \"", argPtr[0], + "\": must be -all, -nocase, or --", (char *) NULL); + return TCL_ERROR; + } + argPtr++; + argc--; + } + if (argc != 4) { + goto wrongNumArgs; + } + + /* + * Convert the string and pattern to lower case, if desired. + */ + + if (noCase) { + Tcl_DStringInit(&patternDString); + Tcl_DStringAppend(&patternDString, argPtr[0], -1); + pattern = Tcl_DStringValue(&patternDString); + for (p = pattern; *p != 0; p++) { + if (isupper(UCHAR(*p))) { + *p = tolower(*p); + } + } + Tcl_DStringInit(&stringDString); + Tcl_DStringAppend(&stringDString, argPtr[1], -1); + string = Tcl_DStringValue(&stringDString); + for (p = string; *p != 0; p++) { + if (isupper(UCHAR(*p))) { + *p = tolower(*p); + } + } + } else { + pattern = argPtr[0]; + string = argPtr[1]; + } + regexpPtr = TclCompileRegexp(interp, pattern); + if (regexpPtr == NULL) { + code = TCL_ERROR; + goto done; + } + + /* + * The following loop is to handle multiple matches within the + * same source string; each iteration handles one match and its + * corresponding substitution. If "-all" hasn't been specified + * then the loop body only gets executed once. + */ + + flags = 0; + anyMatches = 0; + for (p = string; *p != 0; ) { + tclRegexpError = NULL; + match = TclRegExec(regexpPtr, p, string); + if (tclRegexpError != NULL) { + Tcl_AppendResult(interp, "error while matching pattern: ", + tclRegexpError, (char *) NULL); + code = TCL_ERROR; + goto done; + } + if (!match) { + break; + } + anyMatches = 1; + + /* + * Copy the portion of the source string before the match to the + * result variable. + */ + + src = argPtr[1] + (regexpPtr->startp[0] - string); + c = *src; + *src = 0; + newValue = Tcl_SetVar(interp, argPtr[3], argPtr[1] + (p - string), + flags); + *src = c; + flags = TCL_APPEND_VALUE; + if (newValue == NULL) { + cantSet: + Tcl_AppendResult(interp, "couldn't set variable \"", + argPtr[3], "\"", (char *) NULL); + code = TCL_ERROR; + goto done; + } + + /* + * Append the subSpec argument to the variable, making appropriate + * substitutions. This code is a bit hairy because of the backslash + * conventions and because the code saves up ranges of characters in + * subSpec to reduce the number of calls to Tcl_SetVar. + */ + + for (src = firstChar = argPtr[2], c = *src; c != 0; src++, c = *src) { + int index; + + if (c == '&') { + index = 0; + } else if (c == '\\') { + c = src[1]; + if ((c >= '0') && (c <= '9')) { + index = c - '0'; + } else if ((c == '\\') || (c == '&')) { + *src = c; + src[1] = 0; + newValue = Tcl_SetVar(interp, argPtr[3], firstChar, + TCL_APPEND_VALUE); + *src = '\\'; + src[1] = c; + if (newValue == NULL) { + goto cantSet; + } + firstChar = src+2; + src++; + continue; + } else { + continue; + } + } else { + continue; + } + if (firstChar != src) { + c = *src; + *src = 0; + newValue = Tcl_SetVar(interp, argPtr[3], firstChar, + TCL_APPEND_VALUE); + *src = c; + if (newValue == NULL) { + goto cantSet; + } + } + if ((index < NSUBEXP) && (regexpPtr->startp[index] != NULL) + && (regexpPtr->endp[index] != NULL)) { + char *first, *last, saved; + + first = argPtr[1] + (regexpPtr->startp[index] - string); + last = argPtr[1] + (regexpPtr->endp[index] - string); + saved = *last; + *last = 0; + newValue = Tcl_SetVar(interp, argPtr[3], first, + TCL_APPEND_VALUE); + *last = saved; + if (newValue == NULL) { + goto cantSet; + } + } + if (*src == '\\') { + src++; + } + firstChar = src+1; + } + if (firstChar != src) { + if (Tcl_SetVar(interp, argPtr[3], firstChar, + TCL_APPEND_VALUE) == NULL) { + goto cantSet; + } + } + if (regexpPtr->endp[0] == p) { + char tmp[2]; + + /* + * Always consume at least one character of the input string + * in order to prevent infinite loops. + */ + + tmp[0] = argPtr[1][p - string]; + tmp[1] = 0; + newValue = Tcl_SetVar(interp, argPtr[3], tmp, flags); + if (newValue == NULL) { + goto cantSet; + } + p = regexpPtr->endp[0] + 1; + } else { + p = regexpPtr->endp[0]; + } + if (!all) { + break; + } + } + + /* + * Copy the portion of the source string after the last match to the + * result variable. + */ + + if ((*p != 0) || !anyMatches) { + if (Tcl_SetVar(interp, argPtr[3], argPtr[1] + (p - string), + flags) == NULL) { + goto cantSet; + } + } + if (anyMatches) { + interp->result = "1"; + } else { + interp->result = "0"; + } + code = TCL_OK; + + done: + if (noCase) { + Tcl_DStringFree(&stringDString); + Tcl_DStringFree(&patternDString); + } + return code; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_RenameCmd -- + * + * This procedure is invoked to process the "rename" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_RenameCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Command *cmdPtr; + Interp *iPtr = (Interp *) interp; + Tcl_HashEntry *hPtr; + int new; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " oldName newName\"", (char *) NULL); + return TCL_ERROR; + } + if (argv[2][0] == '\0') { + if (Tcl_DeleteCommand(interp, argv[1]) != 0) { + Tcl_AppendResult(interp, "can't delete \"", argv[1], + "\": command doesn't exist", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; + } + hPtr = Tcl_FindHashEntry(&iPtr->commandTable, argv[2]); + if (hPtr != NULL) { + Tcl_AppendResult(interp, "can't rename to \"", argv[2], + "\": command already exists", (char *) NULL); + return TCL_ERROR; + } + hPtr = Tcl_FindHashEntry(&iPtr->commandTable, argv[1]); + if (hPtr == NULL) { + Tcl_AppendResult(interp, "can't rename \"", argv[1], + "\": command doesn't exist", (char *) NULL); + return TCL_ERROR; + } + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + Tcl_DeleteHashEntry(hPtr); + hPtr = Tcl_CreateHashEntry(&iPtr->commandTable, argv[2], &new); + Tcl_SetHashValue(hPtr, cmdPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ReturnCmd -- + * + * This procedure is invoked to process the "return" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ReturnCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + Interp *iPtr = (Interp *) interp; + int c, code; + + if (iPtr->errorInfo != NULL) { + ckfree(iPtr->errorInfo); + iPtr->errorInfo = NULL; + } + if (iPtr->errorCode != NULL) { + ckfree(iPtr->errorCode); + iPtr->errorCode = NULL; + } + code = TCL_OK; + for (argv++, argc--; argc > 1; argv += 2, argc -= 2) { + if (strcmp(argv[0], "-code") == 0) { + c = argv[1][0]; + if ((c == 'o') && (strcmp(argv[1], "ok") == 0)) { + code = TCL_OK; + } else if ((c == 'e') && (strcmp(argv[1], "error") == 0)) { + code = TCL_ERROR; + } else if ((c == 'r') && (strcmp(argv[1], "return") == 0)) { + code = TCL_RETURN; + } else if ((c == 'b') && (strcmp(argv[1], "break") == 0)) { + code = TCL_BREAK; + } else if ((c == 'c') && (strcmp(argv[1], "continue") == 0)) { + code = TCL_CONTINUE; + } else if (Tcl_GetInt(interp, argv[1], &code) != TCL_OK) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "bad completion code \"", + argv[1], "\": must be ok, error, return, break, ", + "continue, or an integer", (char *) NULL); + return TCL_ERROR; + } + } else if (strcmp(argv[0], "-errorinfo") == 0) { + iPtr->errorInfo = ckalloc((unsigned) (strlen(argv[1]) + 1)); + strcpy(iPtr->errorInfo, argv[1]); + } else if (strcmp(argv[0], "-errorcode") == 0) { + iPtr->errorCode = ckalloc((unsigned) (strlen(argv[1]) + 1)); + strcpy(iPtr->errorCode, argv[1]); + } else { + Tcl_AppendResult(interp, "bad option \"", argv[0], + ": must be -code, -errorcode, or -errorinfo", + (char *) NULL); + return TCL_ERROR; + } + } + if (argc == 1) { + Tcl_SetResult(interp, argv[0], TCL_VOLATILE); + } + iPtr->returnCode = code; + return TCL_RETURN; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ScanCmd -- + * + * This procedure is invoked to process the "scan" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ScanCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ +# define MAX_FIELDS 20 + typedef struct { + char fmt; /* Format for field. */ + int size; /* How many bytes to allow for + * field. */ + char *location; /* Where field will be stored. */ + } Field; + Field fields[MAX_FIELDS]; /* Info about all the fields in the + * format string. */ + register Field *curField; + int numFields = 0; /* Number of fields actually + * specified. */ + int suppress; /* Current field is assignment- + * suppressed. */ + int totalSize = 0; /* Number of bytes needed to store + * all results combined. */ + char *results; /* Where scanned output goes. + * Malloced; NULL means not allocated + * yet. */ + int numScanned; /* sscanf's result. */ + register char *fmt; + int i, widthSpecified, length, code; + + /* + * The variables below are used to hold a copy of the format + * string, so that we can replace format specifiers like "%f" + * and "%F" with specifiers like "%lf" + */ + +# define STATIC_SIZE 5 + char copyBuf[STATIC_SIZE], *fmtCopy; + register char *dst; + + if (argc < 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " string format ?varName varName ...?\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * This procedure operates in four stages: + * 1. Scan the format string, collecting information about each field. + * 2. Allocate an array to hold all of the scanned fields. + * 3. Call sscanf to do all the dirty work, and have it store the + * parsed fields in the array. + * 4. Pick off the fields from the array and assign them to variables. + */ + + code = TCL_OK; + results = NULL; + length = strlen(argv[2]) * 2 + 1; + if (length < STATIC_SIZE) { + fmtCopy = copyBuf; + } else { + fmtCopy = ckalloc((unsigned) length); + } + dst = fmtCopy; + for (fmt = argv[2]; *fmt != 0; fmt++) { + *dst = *fmt; + dst++; + if (*fmt != '%') { + continue; + } + fmt++; + if (*fmt == '%') { + *dst = *fmt; + dst++; + continue; + } + if (*fmt == '*') { + suppress = 1; + *dst = *fmt; + dst++; + fmt++; + } else { + suppress = 0; + } + widthSpecified = 0; + while (isdigit(UCHAR(*fmt))) { + widthSpecified = 1; + *dst = *fmt; + dst++; + fmt++; + } + if ((*fmt == 'l') || (*fmt == 'h') || (*fmt == 'L')) { + fmt++; + } + *dst = *fmt; + dst++; + if (suppress) { + continue; + } + if (numFields == MAX_FIELDS) { + interp->result = "too many fields to scan"; + code = TCL_ERROR; + goto done; + } + curField = &fields[numFields]; + numFields++; + switch (*fmt) { + case 'd': + case 'i': + case 'o': + case 'x': + curField->fmt = 'd'; + curField->size = sizeof(int); + break; + + case 'u': + curField->fmt = 'u'; + curField->size = sizeof(int); + break; + + case 's': + curField->fmt = 's'; + curField->size = strlen(argv[1]) + 1; + break; + + case 'c': + if (widthSpecified) { + interp->result = + "field width may not be specified in %c conversion"; + code = TCL_ERROR; + goto done; + } + curField->fmt = 'c'; + curField->size = sizeof(int); + break; + + case 'e': + case 'f': + case 'g': + dst[-1] = 'l'; + dst[0] = 'f'; + dst++; + curField->fmt = 'f'; + curField->size = sizeof(double); + break; + + case '[': + curField->fmt = 's'; + curField->size = strlen(argv[1]) + 1; + do { + fmt++; + *dst = *fmt; + dst++; + } while (*fmt != ']'); + break; + + default: + sprintf(interp->result, "bad scan conversion character \"%c\"", + *fmt); + code = TCL_ERROR; + goto done; + } + curField->size = TCL_ALIGN(curField->size); + totalSize += curField->size; + } + *dst = 0; + + if (numFields != (argc-3)) { + interp->result = + "different numbers of variable names and field specifiers"; + code = TCL_ERROR; + goto done; + } + + /* + * Step 2: + */ + + results = (char *) ckalloc((unsigned) totalSize); + for (i = 0, totalSize = 0, curField = fields; + i < numFields; i++, curField++) { + curField->location = results + totalSize; + totalSize += curField->size; + } + + /* + * Fill in the remaining fields with NULL; the only purpose of + * this is to keep some memory analyzers, like Purify, from + * complaining. + */ + + for ( ; i < MAX_FIELDS; i++, curField++) { + curField->location = NULL; + } + + /* + * Step 3: + */ + + numScanned = sscanf(argv[1], fmtCopy, + fields[0].location, fields[1].location, fields[2].location, + fields[3].location, fields[4].location, fields[5].location, + fields[6].location, fields[7].location, fields[8].location, + fields[9].location, fields[10].location, fields[11].location, + fields[12].location, fields[13].location, fields[14].location, + fields[15].location, fields[16].location, fields[17].location, + fields[18].location, fields[19].location); + + /* + * Step 4: + */ + + if (numScanned < numFields) { + numFields = numScanned; + } + for (i = 0, curField = fields; i < numFields; i++, curField++) { + switch (curField->fmt) { + char string[TCL_DOUBLE_SPACE]; + + case 'd': + sprintf(string, "%d", *((int *) curField->location)); + if (Tcl_SetVar(interp, argv[i+3], string, 0) == NULL) { + storeError: + Tcl_AppendResult(interp, + "couldn't set variable \"", argv[i+3], "\"", + (char *) NULL); + code = TCL_ERROR; + goto done; + } + break; + + case 'u': + sprintf(string, "%u", *((int *) curField->location)); + if (Tcl_SetVar(interp, argv[i+3], string, 0) == NULL) { + goto storeError; + } + break; + + case 'c': + sprintf(string, "%d", *((char *) curField->location) & 0xff); + if (Tcl_SetVar(interp, argv[i+3], string, 0) == NULL) { + goto storeError; + } + break; + + case 's': + if (Tcl_SetVar(interp, argv[i+3], curField->location, 0) + == NULL) { + goto storeError; + } + break; + + case 'f': + Tcl_PrintDouble(interp, *((double *) curField->location), + string); + if (Tcl_SetVar(interp, argv[i+3], string, 0) == NULL) { + goto storeError; + } + break; + } + } + sprintf(interp->result, "%d", numScanned); + done: + if (results != NULL) { + ckfree(results); + } + if (fmtCopy != copyBuf) { + ckfree(fmtCopy); + } + return code; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SplitCmd -- + * + * This procedure is invoked to process the "split" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_SplitCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *splitChars; + register char *p, *p2; + char *elementStart; + + if (argc == 2) { + splitChars = " \n\t\r"; + } else if (argc == 3) { + splitChars = argv[2]; + } else { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " string ?splitChars?\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Handle the special case of splitting on every character. + */ + + if (*splitChars == 0) { + char string[2]; + string[1] = 0; + for (p = argv[1]; *p != 0; p++) { + string[0] = *p; + Tcl_AppendElement(interp, string); + } + return TCL_OK; + } + + /* + * Normal case: split on any of a given set of characters. + * Discard instances of the split characters. + */ + + for (p = elementStart = argv[1]; *p != 0; p++) { + char c = *p; + for (p2 = splitChars; *p2 != 0; p2++) { + if (*p2 == c) { + *p = 0; + Tcl_AppendElement(interp, elementStart); + *p = c; + elementStart = p+1; + break; + } + } + } + if (p != argv[1]) { + Tcl_AppendElement(interp, elementStart); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_StringCmd -- + * + * This procedure is invoked to process the "string" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_StringCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int length; + register char *p, c; + int match; + int first; + int left = 0, right = 0; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " option arg ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + c = argv[1][0]; + length = strlen(argv[1]); + if ((c == 'c') && (strncmp(argv[1], "compare", length) == 0)) { + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " compare string1 string2\"", (char *) NULL); + return TCL_ERROR; + } + match = strcmp(argv[2], argv[3]); + if (match > 0) { + interp->result = "1"; + } else if (match < 0) { + interp->result = "-1"; + } else { + interp->result = "0"; + } + return TCL_OK; + } else if ((c == 'f') && (strncmp(argv[1], "first", length) == 0)) { + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " first string1 string2\"", (char *) NULL); + return TCL_ERROR; + } + first = 1; + + firstLast: + match = -1; + c = *argv[2]; + length = strlen(argv[2]); + for (p = argv[3]; *p != 0; p++) { + if (*p != c) { + continue; + } + if (strncmp(argv[2], p, length) == 0) { + match = p-argv[3]; + if (first) { + break; + } + } + } + sprintf(interp->result, "%d", match); + return TCL_OK; + } else if ((c == 'i') && (strncmp(argv[1], "index", length) == 0)) { + int index; + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " index string charIndex\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[3], &index) != TCL_OK) { + return TCL_ERROR; + } + if ((index >= 0) && (index < (int) strlen(argv[2]))) { + interp->result[0] = argv[2][index]; + interp->result[1] = 0; + } + return TCL_OK; + } else if ((c == 'l') && (strncmp(argv[1], "last", length) == 0) + && (length >= 2)) { + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " last string1 string2\"", (char *) NULL); + return TCL_ERROR; + } + first = 0; + goto firstLast; + } else if ((c == 'l') && (strncmp(argv[1], "length", length) == 0) + && (length >= 2)) { + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " length string\"", (char *) NULL); + return TCL_ERROR; + } + sprintf(interp->result, "%d", strlen(argv[2])); + return TCL_OK; + } else if ((c == 'm') && (strncmp(argv[1], "match", length) == 0)) { + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " match pattern string\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_StringMatch(argv[3], argv[2]) != 0) { + interp->result = "1"; + } else { + interp->result = "0"; + } + return TCL_OK; + } else if ((c == 'r') && (strncmp(argv[1], "range", length) == 0)) { + int first, last, stringLength; + + if (argc != 5) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " range string first last\"", (char *) NULL); + return TCL_ERROR; + } + stringLength = strlen(argv[2]); + if (Tcl_GetInt(interp, argv[3], &first) != TCL_OK) { + return TCL_ERROR; + } + if ((*argv[4] == 'e') + && (strncmp(argv[4], "end", strlen(argv[4])) == 0)) { + last = stringLength-1; + } else { + if (Tcl_GetInt(interp, argv[4], &last) != TCL_OK) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, + "expected integer or \"end\" but got \"", + argv[4], "\"", (char *) NULL); + return TCL_ERROR; + } + } + if (first < 0) { + first = 0; + } + if (last >= stringLength) { + last = stringLength-1; + } + if (last >= first) { + char saved, *p; + + p = argv[2] + last + 1; + saved = *p; + *p = 0; + Tcl_SetResult(interp, argv[2] + first, TCL_VOLATILE); + *p = saved; + } + return TCL_OK; + } else if ((c == 't') && (strncmp(argv[1], "tolower", length) == 0) + && (length >= 3)) { + register char *p; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " tolower string\"", (char *) NULL); + return TCL_ERROR; + } + Tcl_SetResult(interp, argv[2], TCL_VOLATILE); + for (p = interp->result; *p != 0; p++) { + if (isupper(UCHAR(*p))) { + *p = tolower(*p); + } + } + return TCL_OK; + } else if ((c == 't') && (strncmp(argv[1], "toupper", length) == 0) + && (length >= 3)) { + register char *p; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " toupper string\"", (char *) NULL); + return TCL_ERROR; + } + Tcl_SetResult(interp, argv[2], TCL_VOLATILE); + for (p = interp->result; *p != 0; p++) { + if (islower(UCHAR(*p))) { + *p = toupper(*p); + } + } + return TCL_OK; + } else if ((c == 't') && (strncmp(argv[1], "trim", length) == 0) + && (length == 4)) { + char *trimChars; + register char *p, *checkPtr; + + left = right = 1; + + trim: + if (argc == 4) { + trimChars = argv[3]; + } else if (argc == 3) { + trimChars = " \t\n\r"; + } else { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ", argv[1], " string ?chars?\"", (char *) NULL); + return TCL_ERROR; + } + p = argv[2]; + if (left) { + for (c = *p; c != 0; p++, c = *p) { + for (checkPtr = trimChars; *checkPtr != c; checkPtr++) { + if (*checkPtr == 0) { + goto doneLeft; + } + } + } + } + doneLeft: + Tcl_SetResult(interp, p, TCL_VOLATILE); + if (right) { + char *donePtr; + + p = interp->result + strlen(interp->result) - 1; + donePtr = &interp->result[-1]; + for (c = *p; p != donePtr; p--, c = *p) { + for (checkPtr = trimChars; *checkPtr != c; checkPtr++) { + if (*checkPtr == 0) { + goto doneRight; + } + } + } + doneRight: + p[1] = 0; + } + return TCL_OK; + } else if ((c == 't') && (strncmp(argv[1], "trimleft", length) == 0) + && (length > 4)) { + left = 1; + argv[1] = "trimleft"; + goto trim; + } else if ((c == 't') && (strncmp(argv[1], "trimright", length) == 0) + && (length > 4)) { + right = 1; + argv[1] = "trimright"; + goto trim; + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be compare, first, index, last, length, match, ", + "range, tolower, toupper, trim, trimleft, or trimright", + (char *) NULL); + return TCL_ERROR; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SwitchCmd -- + * + * This procedure is invoked to process the "switch" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_SwitchCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ +#define EXACT 0 +#define GLOB 1 +#define REGEXP 2 + int i, code, mode, matched; + int body; + char *string; + int switchArgc, splitArgs; + char **switchArgv; + + switchArgc = argc-1; + switchArgv = argv+1; + mode = EXACT; + while ((switchArgc > 0) && (*switchArgv[0] == '-')) { + if (strcmp(*switchArgv, "-exact") == 0) { + mode = EXACT; + } else if (strcmp(*switchArgv, "-glob") == 0) { + mode = GLOB; + } else if (strcmp(*switchArgv, "-regexp") == 0) { + mode = REGEXP; + } else if (strcmp(*switchArgv, "--") == 0) { + switchArgc--; + switchArgv++; + break; + } else { + Tcl_AppendResult(interp, "bad option \"", switchArgv[0], + "\": should be -exact, -glob, -regexp, or --", + (char *) NULL); + return TCL_ERROR; + } + switchArgc--; + switchArgv++; + } + if (switchArgc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " ?switches? string pattern body ... ?default body?\"", + (char *) NULL); + return TCL_ERROR; + } + string = *switchArgv; + switchArgc--; + switchArgv++; + + /* + * If all of the pattern/command pairs are lumped into a single + * argument, split them out again. + */ + + splitArgs = 0; + if (switchArgc == 1) { + code = Tcl_SplitList(interp, switchArgv[0], &switchArgc, &switchArgv); + if (code != TCL_OK) { + return code; + } + splitArgs = 1; + } + + for (i = 0; i < switchArgc; i += 2) { + if (i == (switchArgc-1)) { + interp->result = "extra switch pattern with no body"; + code = TCL_ERROR; + goto cleanup; + } + + /* + * See if the pattern matches the string. + */ + + matched = 0; + if ((*switchArgv[i] == 'd') && (i == switchArgc-2) + && (strcmp(switchArgv[i], "default") == 0)) { + matched = 1; + } else { + switch (mode) { + case EXACT: + matched = (strcmp(string, switchArgv[i]) == 0); + break; + case GLOB: + matched = Tcl_StringMatch(string, switchArgv[i]); + break; + case REGEXP: + matched = Tcl_RegExpMatch(interp, string, switchArgv[i]); + if (matched < 0) { + code = TCL_ERROR; + goto cleanup; + } + break; + } + } + if (!matched) { + continue; + } + + /* + * We've got a match. Find a body to execute, skipping bodies + * that are "-". + */ + + for (body = i+1; ; body += 2) { + if (body >= switchArgc) { + Tcl_AppendResult(interp, "no body specified for pattern \"", + switchArgv[i], "\"", (char *) NULL); + code = TCL_ERROR; + goto cleanup; + } + if ((switchArgv[body][0] != '-') || (switchArgv[body][1] != 0)) { + break; + } + } + code = Tcl_Eval(interp, switchArgv[body]); + if (code == TCL_ERROR) { + char msg[100]; + sprintf(msg, "\n (\"%.50s\" arm line %d)", switchArgv[i], + interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + goto cleanup; + } + + /* + * Nothing matched: return nothing. + */ + + code = TCL_OK; + + cleanup: + if (splitArgs) { + ckfree((char *) switchArgv); + } + return code; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_TraceCmd -- + * + * This procedure is invoked to process the "trace" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_TraceCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char c; + int length; + + if (argc < 2) { + Tcl_AppendResult(interp, "too few args: should be \"", + argv[0], " option [arg arg ...]\"", (char *) NULL); + return TCL_ERROR; + } + c = argv[1][1]; + length = strlen(argv[1]); + if ((c == 'a') && (strncmp(argv[1], "variable", length) == 0) + && (length >= 2)) { + char *p; + int flags, length; + TraceVarInfo *tvarPtr; + + if (argc != 5) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " variable name ops command\"", (char *) NULL); + return TCL_ERROR; + } + + flags = 0; + for (p = argv[3] ; *p != 0; p++) { + if (*p == 'r') { + flags |= TCL_TRACE_READS; + } else if (*p == 'w') { + flags |= TCL_TRACE_WRITES; + } else if (*p == 'u') { + flags |= TCL_TRACE_UNSETS; + } else { + goto badOps; + } + } + if (flags == 0) { + goto badOps; + } + + length = strlen(argv[4]); + tvarPtr = (TraceVarInfo *) ckalloc((unsigned) + (sizeof(TraceVarInfo) - sizeof(tvarPtr->command) + length + 1)); + tvarPtr->flags = flags; + tvarPtr->errMsg = NULL; + tvarPtr->length = length; + flags |= TCL_TRACE_UNSETS; + strcpy(tvarPtr->command, argv[4]); + if (Tcl_TraceVar(interp, argv[2], flags, TraceVarProc, + (ClientData) tvarPtr) != TCL_OK) { + ckfree((char *) tvarPtr); + return TCL_ERROR; + } + } else if ((c == 'd') && (strncmp(argv[1], "vdelete", length) + && (length >= 2)) == 0) { + char *p; + int flags, length; + TraceVarInfo *tvarPtr; + ClientData clientData; + + if (argc != 5) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " vdelete name ops command\"", (char *) NULL); + return TCL_ERROR; + } + + flags = 0; + for (p = argv[3] ; *p != 0; p++) { + if (*p == 'r') { + flags |= TCL_TRACE_READS; + } else if (*p == 'w') { + flags |= TCL_TRACE_WRITES; + } else if (*p == 'u') { + flags |= TCL_TRACE_UNSETS; + } else { + goto badOps; + } + } + if (flags == 0) { + goto badOps; + } + + /* + * Search through all of our traces on this variable to + * see if there's one with the given command. If so, then + * delete the first one that matches. + */ + + length = strlen(argv[4]); + clientData = 0; + while ((clientData = Tcl_VarTraceInfo(interp, argv[2], 0, + TraceVarProc, clientData)) != 0) { + tvarPtr = (TraceVarInfo *) clientData; + if ((tvarPtr->length == length) && (tvarPtr->flags == flags) + && (strncmp(argv[4], tvarPtr->command, length) == 0)) { + Tcl_UntraceVar(interp, argv[2], flags | TCL_TRACE_UNSETS, + TraceVarProc, clientData); + if (tvarPtr->errMsg != NULL) { + ckfree(tvarPtr->errMsg); + } + ckfree((char *) tvarPtr); + break; + } + } + } else if ((c == 'i') && (strncmp(argv[1], "vinfo", length) == 0) + && (length >= 2)) { + ClientData clientData; + char ops[4], *p; + char *prefix = "{"; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " vinfo name\"", (char *) NULL); + return TCL_ERROR; + } + clientData = 0; + while ((clientData = Tcl_VarTraceInfo(interp, argv[2], 0, + TraceVarProc, clientData)) != 0) { + TraceVarInfo *tvarPtr = (TraceVarInfo *) clientData; + p = ops; + if (tvarPtr->flags & TCL_TRACE_READS) { + *p = 'r'; + p++; + } + if (tvarPtr->flags & TCL_TRACE_WRITES) { + *p = 'w'; + p++; + } + if (tvarPtr->flags & TCL_TRACE_UNSETS) { + *p = 'u'; + p++; + } + *p = '\0'; + Tcl_AppendResult(interp, prefix, (char *) NULL); + Tcl_AppendElement(interp, ops); + Tcl_AppendElement(interp, tvarPtr->command); + Tcl_AppendResult(interp, "}", (char *) NULL); + prefix = " {"; + } + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be variable, vdelete, or vinfo", + (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; + + badOps: + Tcl_AppendResult(interp, "bad operations \"", argv[3], + "\": should be one or more of rwu", (char *) NULL); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * TraceVarProc -- + * + * This procedure is called to handle variable accesses that have + * been traced using the "trace" command. + * + * Results: + * Normally returns NULL. If the trace command returns an error, + * then this procedure returns an error string. + * + * Side effects: + * Depends on the command associated with the trace. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static char * +TraceVarProc(clientData, interp, name1, name2, flags) + ClientData clientData; /* Information about the variable trace. */ + Tcl_Interp *interp; /* Interpreter containing variable. */ + char *name1; /* Name of variable or array. */ + char *name2; /* Name of element within array; NULL means + * scalar variable is being referenced. */ + int flags; /* OR-ed bits giving operation and other + * information. */ +{ + TraceVarInfo *tvarPtr = (TraceVarInfo *) clientData; + char *result; + int code; + Interp dummy; + Tcl_DString cmd; + + result = NULL; + if (tvarPtr->errMsg != NULL) { + ckfree(tvarPtr->errMsg); + tvarPtr->errMsg = NULL; + } + if ((tvarPtr->flags & flags) && !(flags & TCL_INTERP_DESTROYED)) { + + /* + * Generate a command to execute by appending list elements + * for the two variable names and the operation. The five + * extra characters are for three space, the opcode character, + * and the terminating null. + */ + + if (name2 == NULL) { + name2 = ""; + } + Tcl_DStringInit(&cmd); + Tcl_DStringAppend(&cmd, tvarPtr->command, tvarPtr->length); + Tcl_DStringAppendElement(&cmd, name1); + Tcl_DStringAppendElement(&cmd, name2); + if (flags & TCL_TRACE_READS) { + Tcl_DStringAppend(&cmd, " r", 2); + } else if (flags & TCL_TRACE_WRITES) { + Tcl_DStringAppend(&cmd, " w", 2); + } else if (flags & TCL_TRACE_UNSETS) { + Tcl_DStringAppend(&cmd, " u", 2); + } + + /* + * Execute the command. Be careful to save and restore the + * result from the interpreter used for the command. + */ + + if (interp->freeProc == 0) { + dummy.freeProc = (Tcl_FreeProc *) 0; + dummy.result = ""; + Tcl_SetResult((Tcl_Interp *) &dummy, interp->result, TCL_VOLATILE); + } else { + dummy.freeProc = interp->freeProc; + dummy.result = interp->result; + interp->freeProc = (Tcl_FreeProc *) 0; + } + code = Tcl_Eval(interp, Tcl_DStringValue(&cmd)); + Tcl_DStringFree(&cmd); + if (code != TCL_OK) { + tvarPtr->errMsg = ckalloc((unsigned) (strlen(interp->result) + 1)); + strcpy(tvarPtr->errMsg, interp->result); + result = tvarPtr->errMsg; + Tcl_ResetResult(interp); /* Must clear error state. */ + } + Tcl_SetResult(interp, dummy.result, + (dummy.freeProc == 0) ? TCL_VOLATILE : dummy.freeProc); + } + if (flags & TCL_TRACE_DESTROYED) { + result = NULL; + if (tvarPtr->errMsg != NULL) { + ckfree(tvarPtr->errMsg); + } + ckfree((char *) tvarPtr); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_WhileCmd -- + * + * This procedure is invoked to process the "while" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_WhileCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int result, value; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " test command\"", (char *) NULL); + return TCL_ERROR; + } + + while (1) { + result = Tcl_ExprBoolean(interp, argv[1], &value); + if (result != TCL_OK) { + return result; + } + if (!value) { + break; + } + result = Tcl_Eval(interp, argv[2]); + if ((result != TCL_OK) && (result != TCL_CONTINUE)) { + if (result == TCL_ERROR) { + char msg[60]; + sprintf(msg, "\n (\"while\" body line %d)", + interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + break; + } + } + if (result == TCL_BREAK) { + result = TCL_OK; + } + if (result == TCL_OK) { + Tcl_ResetResult(interp); + } + return result; +} diff --git a/vendor/x11iraf/obm/Tcl/tclEnv.c b/vendor/x11iraf/obm/Tcl/tclEnv.c new file mode 100644 index 00000000..012542fe --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclEnv.c @@ -0,0 +1,531 @@ +/* + * tclEnv.c -- + * + * Tcl support for environment variables, including a setenv + * procedure. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclEnv.c,v 1.17 93/10/13 17:16:56 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +/* + * The putenv and setenv definitions below cause any system prototypes for + * those procedures to be ignored so that there won't be a clash when the + * versions in this file are compiled. + */ + +#define putenv ignore_putenv +#define setenv ignore_setenv +#include "tclInt.h" +#include "tclUnix.h" +#undef putenv +#undef setenv + +/* + * The structure below is used to keep track of all of the interpereters + * for which we're managing the "env" array. It's needed so that they + * can all be updated whenever an environment variable is changed + * anywhere. + */ + +typedef struct EnvInterp { + Tcl_Interp *interp; /* Interpreter for which we're managing + * the env array. */ + struct EnvInterp *nextPtr; /* Next in list of all such interpreters, + * or zero. */ +} EnvInterp; + +static EnvInterp *firstInterpPtr; + /* First in list of all managed interpreters, + * or NULL if none. */ + +static int environSize = 0; /* Non-zero means that the all of the + * environ-related information is malloc-ed + * and the environ array itself has this + * many total entries allocated to it (not + * all may be in use at once). Zero means + * that the environment array is in its + * original static state. */ + +/* + * Declarations for local procedures defined in this file: + */ + +static void EnvInit _ANSI_ARGS_((void)); +static char * EnvTraceProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, char *name1, char *name2, + int flags)); +static int FindVariable _ANSI_ARGS_((CONST char *name, + int *lengthPtr)); +void TclSetEnv _ANSI_ARGS_((CONST char *name, + CONST char *value)); +void TclUnsetEnv _ANSI_ARGS_((CONST char *name)); + +/* + *---------------------------------------------------------------------- + * + * TclSetupEnv -- + * + * This procedure is invoked for an interpreter to make environment + * variables accessible from that interpreter via the "env" + * associative array. + * + * Results: + * None. + * + * Side effects: + * The interpreter is added to a list of interpreters managed + * by us, so that its view of envariables can be kept consistent + * with the view in other interpreters. If this is the first + * call to Tcl_SetupEnv, then additional initialization happens, + * such as copying the environment to dynamically-allocated space + * for ease of management. + * + *---------------------------------------------------------------------- + */ + +void +TclSetupEnv(interp) + Tcl_Interp *interp; /* Interpreter whose "env" array is to be + * managed. */ +{ + EnvInterp *eiPtr; + int i; + + /* + * First, initialize our environment-related information, if + * necessary. + */ + + if (environSize == 0) { + EnvInit(); + } + + /* + * Next, add the interpreter to the list of those that we manage. + */ + + eiPtr = (EnvInterp *) ckalloc(sizeof(EnvInterp)); + eiPtr->interp = interp; + eiPtr->nextPtr = firstInterpPtr; + firstInterpPtr = eiPtr; + + /* + * Store the environment variable values into the interpreter's + * "env" array, and arrange for us to be notified on future + * writes and unsets to that array. + */ + + (void) Tcl_UnsetVar2(interp, "env", (char *) NULL, TCL_GLOBAL_ONLY); + for (i = 0; ; i++) { + char *p, *p2; + + p = environ[i]; + if (p == NULL) { + break; + } + for (p2 = p; *p2 != '='; p2++) { + /* Empty loop body. */ + } + *p2 = 0; + (void) Tcl_SetVar2(interp, "env", p, p2+1, TCL_GLOBAL_ONLY); + *p2 = '='; + } + Tcl_TraceVar2(interp, "env", (char *) NULL, + TCL_GLOBAL_ONLY | TCL_TRACE_WRITES | TCL_TRACE_UNSETS, + EnvTraceProc, (ClientData) NULL); +} + +/* + *---------------------------------------------------------------------- + * + * FindVariable -- + * + * Locate the entry in environ for a given name. + * + * Results: + * The return value is the index in environ of an entry with the + * name "name", or -1 if there is no such entry. The integer at + * *lengthPtr is filled in with the length of name (if a matching + * entry is found) or the length of the environ array (if no matching + * entry is found). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +FindVariable(name, lengthPtr) + CONST char *name; /* Name of desired environment variable. */ + int *lengthPtr; /* Used to return length of name (for + * successful searches) or number of non-NULL + * entries in environ (for unsuccessful + * searches). */ +{ + int i; + CONST char *p1, *p2; + + for (i = 0, p1 = environ[i]; p1 != NULL; i++, p1 = environ[i]) { + for (p2 = name; *p2 == *p1; p1++, p2++) { + /* NULL loop body. */ + } + if ((*p1 == '=') && (*p2 == '\0')) { + *lengthPtr = p2-name; + return i; + } + } + *lengthPtr = i; + return -1; +} + +/* + *---------------------------------------------------------------------- + * + * TclSetEnv -- + * + * Set an environment variable, replacing an existing value + * or creating a new variable if there doesn't exist a variable + * by the given name. This procedure is intended to be a + * stand-in for the UNIX "setenv" procedure so that applications + * using that procedure will interface properly to Tcl. To make + * it a stand-in, the Makefile must define "TclSetEnv" to "setenv". + * + * Results: + * None. + * + * Side effects: + * The environ array gets updated, as do all of the interpreters + * that we manage. + * + *---------------------------------------------------------------------- + */ + +void +TclSetEnv(name, value) + CONST char *name; /* Name of variable whose value is to be + * set. */ + CONST char *value; /* New value for variable. */ +{ + int index, length, nameLength; + char *p; + EnvInterp *eiPtr; + + if (environSize == 0) { + EnvInit(); + } + + /* + * Figure out where the entry is going to go. If the name doesn't + * already exist, enlarge the array if necessary to make room. If + * the name exists, free its old entry. + */ + + index = FindVariable(name, &length); + if (index == -1) { + if ((length+2) > environSize) { + char **newEnviron; + + newEnviron = (char **) ckalloc((unsigned) + ((length+5) * sizeof(char *))); + memcpy((VOID *) newEnviron, (VOID *) environ, + length*sizeof(char *)); + ckfree((char *) environ); + environ = newEnviron; + environSize = length+5; + } + index = length; + environ[index+1] = NULL; + nameLength = strlen(name); + } else { + /* + * Compare the new value to the existing value. If they're + * the same then quit immediately (e.g. don't rewrite the + * value or propagate it to other interpreters). Otherwise, + * when there are N interpreters there will be N! propagations + * of the same value among the interpreters. + */ + + if (strcmp(value, environ[index]+length+1) == 0) { + return; + } + ckfree(environ[index]); + nameLength = length; + } + + /* + * Create a new entry and enter it into the table. + */ + + p = (char *) ckalloc((unsigned) (nameLength + strlen(value) + 2)); + environ[index] = p; + strcpy(p, name); + p += nameLength; + *p = '='; + strcpy(p+1, value); + + /* + * Update all of the interpreters. + */ + + for (eiPtr= firstInterpPtr; eiPtr != NULL; eiPtr = eiPtr->nextPtr) { + (void) Tcl_SetVar2(eiPtr->interp, "env", (char *) name, + p+1, TCL_GLOBAL_ONLY); + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_PutEnv -- + * + * Set an environment variable. Similar to setenv except that + * the information is passed in a single string of the form + * NAME=value, rather than as separate name strings. This procedure + * is intended to be a stand-in for the UNIX "putenv" procedure + * so that applications using that procedure will interface + * properly to Tcl. To make it a stand-in, the Makefile will + * define "Tcl_PutEnv" to "putenv". + * + * Results: + * None. + * + * Side effects: + * The environ array gets updated, as do all of the interpreters + * that we manage. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_PutEnv(string) + CONST char *string; /* Info about environment variable in the + * form NAME=value. */ +{ + int nameLength; + char *name, *value; + + if (string == NULL) { + return 0; + } + + /* + * Separate the string into name and value parts, then call + * TclSetEnv to do all of the real work. + */ + + value = strchr(string, '='); + if (value == NULL) { + return 0; + } + nameLength = value - string; + if (nameLength == 0) { + return 0; + } + name = ckalloc((unsigned) nameLength+1); + memcpy(name, string, nameLength); + name[nameLength] = 0; + TclSetEnv(name, value+1); + ckfree(name); + return 0; +} + +/* + *---------------------------------------------------------------------- + * + * TclUnsetEnv -- + * + * Remove an environment variable, updating the "env" arrays + * in all interpreters managed by us. This function is intended + * to replace the UNIX "unsetenv" function (but to do this the + * Makefile must be modified to redefine "TclUnsetEnv" to + * "unsetenv". + * + * Results: + * None. + * + * Side effects: + * Interpreters are updated, as is environ. + * + *---------------------------------------------------------------------- + */ + +void +TclUnsetEnv(name) + CONST char *name; /* Name of variable to remove. */ +{ + int index, dummy; + char **envPtr; + EnvInterp *eiPtr; + + if (environSize == 0) { + EnvInit(); + } + + /* + * Update the environ array. + */ + + index = FindVariable(name, &dummy); + if (index == -1) { + return; + } + ckfree(environ[index]); + for (envPtr = environ+index+1; ; envPtr++) { + envPtr[-1] = *envPtr; + if (*envPtr == NULL) { + break; + } + } + + /* + * Update all of the interpreters. + */ + + for (eiPtr = firstInterpPtr; eiPtr != NULL; eiPtr = eiPtr->nextPtr) { + (void) Tcl_UnsetVar2(eiPtr->interp, "env", (char *) name, + TCL_GLOBAL_ONLY); + } +} + +/* + *---------------------------------------------------------------------- + * + * EnvTraceProc -- + * + * This procedure is invoked whenever an environment variable + * is modified or deleted. It propagates the change to the + * "environ" array and to any other interpreters for whom + * we're managing an "env" array. + * + * Results: + * Always returns NULL to indicate success. + * + * Side effects: + * Environment variable changes get propagated. If the whole + * "env" array is deleted, then we stop managing things for + * this interpreter (usually this happens because the whole + * interpreter is being deleted). + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static char * +EnvTraceProc(clientData, interp, name1, name2, flags) + ClientData clientData; /* Not used. */ + Tcl_Interp *interp; /* Interpreter whose "env" variable is + * being modified. */ + char *name1; /* Better be "env". */ + char *name2; /* Name of variable being modified, or + * NULL if whole array is being deleted. */ + int flags; /* Indicates what's happening. */ +{ + /* + * First see if the whole "env" variable is being deleted. If + * so, just forget about this interpreter. + */ + + if (name2 == NULL) { + register EnvInterp *eiPtr, *prevPtr; + + if ((flags & (TCL_TRACE_UNSETS|TCL_TRACE_DESTROYED)) + != (TCL_TRACE_UNSETS|TCL_TRACE_DESTROYED)) { + panic("EnvTraceProc called with confusing arguments"); + } + eiPtr = firstInterpPtr; + if (eiPtr->interp == interp) { + firstInterpPtr = eiPtr->nextPtr; + } else { + for (prevPtr = eiPtr, eiPtr = eiPtr->nextPtr; ; + prevPtr = eiPtr, eiPtr = eiPtr->nextPtr) { + if (eiPtr == NULL) { + panic("EnvTraceProc couldn't find interpreter"); + } + if (eiPtr->interp == interp) { + prevPtr->nextPtr = eiPtr->nextPtr; + break; + } + } + } + ckfree((char *) eiPtr); + return NULL; + } + + /* + * If a value is being set, call TclSetEnv to do all of the work. + */ + + if (flags & TCL_TRACE_WRITES) { + TclSetEnv(name2, Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY)); + } + + if (flags & TCL_TRACE_UNSETS) { + TclUnsetEnv(name2); + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * EnvInit -- + * + * This procedure is called to initialize our management + * of the environ array. + * + * Results: + * None. + * + * Side effects: + * Environ gets copied to malloc-ed storage, so that in + * the future we don't have to worry about which entries + * are malloc-ed and which are static. + * + *---------------------------------------------------------------------- + */ + +static void +EnvInit() +{ + char **newEnviron; + int i, length; + + if (environSize != 0) { + return; + } + for (length = 0; environ[length] != NULL; length++) { + /* Empty loop body. */ + } + environSize = length+5; + newEnviron = (char **) ckalloc((unsigned) + (environSize * sizeof(char *))); + for (i = 0; i < length; i++) { + newEnviron[i] = (char *) ckalloc((unsigned) (strlen(environ[i]) + 1)); + strcpy(newEnviron[i], environ[i]); + } + newEnviron[length] = NULL; + environ = newEnviron; +} diff --git a/vendor/x11iraf/obm/Tcl/tclExpr.c b/vendor/x11iraf/obm/Tcl/tclExpr.c new file mode 100644 index 00000000..45780842 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclExpr.c @@ -0,0 +1,2011 @@ +/* + * tclExpr.c -- + * + * This file contains the code to evaluate expressions for + * Tcl. + * + * This implementation of floating-point support was modelled + * after an initial implementation by Bill Carpenter. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclExpr.c,v 1.68 93/10/31 16:19:44 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" +#ifdef NO_FLOAT_H +# include "compat/float.h" +#else +# include <float.h> +#endif +#ifndef TCL_NO_MATH +#include <math.h> +#endif + +/* + * The stuff below is a bit of a hack so that this file can be used + * in environments that include no UNIX, i.e. no errno. Just define + * errno here. + */ + +#ifndef TCL_GENERIC_ONLY +#include "tclUnix.h" +extern int errno; +#else +#define NO_ERRNO_H +#endif + +#ifdef NO_ERRNO_H +int errno; +#define EDOM 33 +#define ERANGE 34 +#endif + +/* Slackware/RedHat4.2 compatibility hack. */ +#if defined(linux) && defined(isalnum) +#undef isalnum +#define isalnum(c) (isalpha(c)||isdigit(c)) +#endif + + +/* + * The data structure below is used to describe an expression value, + * which can be either an integer (the usual case), a double-precision + * floating-point value, or a string. A given number has only one + * value at a time. + */ + +#define STATIC_STRING_SPACE 150 + +typedef struct { + long intValue; /* Integer value, if any. */ + double doubleValue; /* Floating-point value, if any. */ + ParseValue pv; /* Used to hold a string value, if any. */ + char staticSpace[STATIC_STRING_SPACE]; + /* Storage for small strings; large ones + * are malloc-ed. */ + int type; /* Type of value: TYPE_INT, TYPE_DOUBLE, + * or TYPE_STRING. */ +} Value; + +/* + * Valid values for type: + */ + +#define TYPE_INT 0 +#define TYPE_DOUBLE 1 +#define TYPE_STRING 2 + +/* + * The data structure below describes the state of parsing an expression. + * It's passed among the routines in this module. + */ + +typedef struct { + char *originalExpr; /* The entire expression, as originally + * passed to Tcl_ExprString et al. */ + char *expr; /* Position to the next character to be + * scanned from the expression string. */ + int token; /* Type of the last token to be parsed from + * expr. See below for definitions. + * Corresponds to the characters just + * before expr. */ +} ExprInfo; + +/* + * The token types are defined below. In addition, there is a table + * associating a precedence with each operator. The order of types + * is important. Consult the code before changing it. + */ + +#define VALUE 0 +#define OPEN_PAREN 1 +#define CLOSE_PAREN 2 +#define COMMA 3 +#define END 4 +#define UNKNOWN 5 + +/* + * Binary operators: + */ + +#define MULT 8 +#define DIVIDE 9 +#define MOD 10 +#define PLUS 11 +#define MINUS 12 +#define LEFT_SHIFT 13 +#define RIGHT_SHIFT 14 +#define LESS 15 +#define GREATER 16 +#define LEQ 17 +#define GEQ 18 +#define EQUAL 19 +#define NEQ 20 +#define BIT_AND 21 +#define BIT_XOR 22 +#define BIT_OR 23 +#define AND 24 +#define OR 25 +#define QUESTY 26 +#define COLON 27 + +/* + * Unary operators: + */ + +#define UNARY_MINUS 28 +#define NOT 29 +#define BIT_NOT 30 + +/* + * Precedence table. The values for non-operator token types are ignored. + */ + +int precTable[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 11, 11, 11, /* MULT, DIVIDE, MOD */ + 10, 10, /* PLUS, MINUS */ + 9, 9, /* LEFT_SHIFT, RIGHT_SHIFT */ + 8, 8, 8, 8, /* LESS, GREATER, LEQ, GEQ */ + 7, 7, /* EQUAL, NEQ */ + 6, /* BIT_AND */ + 5, /* BIT_XOR */ + 4, /* BIT_OR */ + 3, /* AND */ + 2, /* OR */ + 1, 1, /* QUESTY, COLON */ + 12, 12, 12 /* UNARY_MINUS, NOT, BIT_NOT */ +}; + +/* + * Mapping from operator numbers to strings; used for error messages. + */ + +char *operatorStrings[] = { + "VALUE", "(", ")", "END", "UNKNOWN", "5", "6", "7", + "*", "/", "%", "+", "-", "<<", ">>", "<", ">", "<=", + ">=", "==", "!=", "&", "^", "|", "&&", "||", "?", ":", + "-", "!", "~" +}; + +/* + * The following slight modification to DBL_MAX is needed because of + * a compiler bug on Sprite (4/15/93). + */ + +#ifdef sprite +#undef DBL_MAX +#define DBL_MAX 1.797693134862316e+307 +#endif + +/* + * Macros for testing floating-point values for certain special + * cases. Test for not-a-number by comparing a value against + * itself; test for infinity by comparing against the largest + * floating-point value. + */ + +#define IS_NAN(v) ((v) != (v)) +#ifdef DBL_MAX +# define IS_INF(v) (((v) > DBL_MAX) || ((v) < -DBL_MAX)) +#else +# define IS_INF(v) 0 +#endif + +/* + * The following global variable is use to signal matherr that Tcl + * is responsible for the arithmetic, so errors can be handled in a + * fashion appropriate for Tcl. Zero means no Tcl math is in + * progress; non-zero means Tcl is doing math. + */ + +int tcl_MathInProgress = 0; + +/* + * The variable below serves no useful purpose except to generate + * a reference to matherr, so that the Tcl version of matherr is + * linked in rather than the system version. Without this reference + * the need for matherr won't be discovered during linking until after + * libtcl.a has been processed, so Tcl's version won't be used. + */ + +#ifdef NEED_MATHERR +extern int matherr(); +int (*tclMatherrPtr)() = matherr; +#endif + +/* + * Declarations for local procedures to this file: + */ + +static int ExprAbsFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); +static int ExprBinaryFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); +static int ExprDoubleFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); +static void ExprFloatError _ANSI_ARGS_((Tcl_Interp *interp, + double value)); +static int ExprGetValue _ANSI_ARGS_((Tcl_Interp *interp, + ExprInfo *infoPtr, int prec, Value *valuePtr)); +static int ExprIntFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); +static int ExprLex _ANSI_ARGS_((Tcl_Interp *interp, + ExprInfo *infoPtr, Value *valuePtr)); +static void ExprMakeString _ANSI_ARGS_((Tcl_Interp *interp, + Value *valuePtr)); +static int ExprMathFunc _ANSI_ARGS_((Tcl_Interp *interp, + ExprInfo *infoPtr, Value *valuePtr)); +static int ExprParseString _ANSI_ARGS_((Tcl_Interp *interp, + char *string, Value *valuePtr)); +static int ExprRoundFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); +static int ExprTopLevel _ANSI_ARGS_((Tcl_Interp *interp, + char *string, Value *valuePtr)); +static int ExprUnaryFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); + +/* + * Built-in math functions: + */ + +typedef struct { + char *name; /* Name of function. */ + int numArgs; /* Number of arguments for function. */ + Tcl_ValueType argTypes[MAX_MATH_ARGS]; + /* Acceptable types for each argument. */ + Tcl_MathProc *proc; /* Procedure that implements this function. */ + ClientData clientData; /* Additional argument to pass to the function + * when invoking it. */ +} BuiltinFunc; + +static BuiltinFunc funcTable[] = { +#ifndef TCL_NO_MATH + {"acos", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) acos}, + {"asin", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) asin}, + {"atan", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) atan}, + {"atan2", 2, {TCL_DOUBLE, TCL_DOUBLE}, ExprBinaryFunc, (ClientData) atan2}, + {"ceil", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) ceil}, + {"cos", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) cos}, + {"cosh", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) cosh}, + {"exp", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) exp}, + {"floor", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) floor}, + {"fmod", 2, {TCL_DOUBLE, TCL_DOUBLE}, ExprBinaryFunc, (ClientData) fmod}, + {"hypot", 2, {TCL_DOUBLE, TCL_DOUBLE}, ExprBinaryFunc, (ClientData) hypot}, + {"log", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) log}, + {"log10", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) log10}, + {"pow", 2, {TCL_DOUBLE, TCL_DOUBLE}, ExprBinaryFunc, (ClientData) pow}, + {"sin", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) sin}, + {"sinh", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) sinh}, + {"sqrt", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) sqrt}, + {"tan", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) tan}, + {"tanh", 1, {TCL_DOUBLE}, ExprUnaryFunc, (ClientData) tanh}, +#endif + {"abs", 1, {TCL_EITHER}, ExprAbsFunc, 0}, + {"double", 1, {TCL_EITHER}, ExprDoubleFunc, 0}, + {"int", 1, {TCL_EITHER}, ExprIntFunc, 0}, + {"round", 1, {TCL_EITHER}, ExprRoundFunc, 0}, + {0,0,{0},0,0}, +}; + +/* + *-------------------------------------------------------------- + * + * ExprParseString -- + * + * Given a string (such as one coming from command or variable + * substitution), make a Value based on the string. The value + * will be a floating-point or integer, if possible, or else it + * will just be a copy of the string. + * + * Results: + * TCL_OK is returned under normal circumstances, and TCL_ERROR + * is returned if a floating-point overflow or underflow occurred + * while reading in a number. The value at *valuePtr is modified + * to hold a number, if possible. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +static int +ExprParseString(interp, string, valuePtr) + Tcl_Interp *interp; /* Where to store error message. */ + char *string; /* String to turn into value. */ + Value *valuePtr; /* Where to store value information. + * Caller must have initialized pv field. */ +{ + char *term, *p, *start; + + if (*string != 0) { + valuePtr->type = TYPE_INT; + errno = 0; + + /* + * Note: use strtoul instead of strtol for integer conversions + * to allow full-size unsigned numbers, but don't depend on + * strtoul to handle sign characters; it won't in some + * implementations. + */ + + for (p = string; isspace(UCHAR(*p)); p++) { + /* Empty loop body. */ + } + if (*p == '-') { + start = p+1; + valuePtr->intValue = -strtoul(start, &term, 0); + } else if (*p == '+') { + start = p+1; + valuePtr->intValue = strtoul(start, &term, 0); + } else { + start = p; + valuePtr->intValue = strtoul(start, &term, 0); + } + if (errno == ERANGE) { + /* + * This procedure is sometimes called with string in + * interp->result, so we have to clear the result before + * logging an error message. + */ + + Tcl_ResetResult(interp); + interp->result = "integer value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", interp->result, + (char *) NULL); + return TCL_ERROR; + } + if ((term != start) && (*term == '\0')) { + return TCL_OK; + } + errno = 0; + valuePtr->doubleValue = strtod(p, &term); + if ((term != p) && (*term == '\0')) { + if (errno != 0) { + Tcl_ResetResult(interp); + ExprFloatError(interp, valuePtr->doubleValue); + return TCL_ERROR; + } + valuePtr->type = TYPE_DOUBLE; + return TCL_OK; + } + } + + /* + * Not a valid number. Save a string value (but don't do anything + * if it's already the value). + */ + + valuePtr->type = TYPE_STRING; + if (string != valuePtr->pv.buffer) { + int length, shortfall; + + length = strlen(string); + valuePtr->pv.next = valuePtr->pv.buffer; + shortfall = length - (valuePtr->pv.end - valuePtr->pv.buffer); + if (shortfall > 0) { + (*valuePtr->pv.expandProc)(&valuePtr->pv, shortfall); + } + strcpy(valuePtr->pv.buffer, string); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * ExprLex -- + * + * Lexical analyzer for expression parser: parses a single value, + * operator, or other syntactic element from an expression string. + * + * Results: + * TCL_OK is returned unless an error occurred while doing lexical + * analysis or executing an embedded command. In that case a + * standard Tcl error is returned, using interp->result to hold + * an error message. In the event of a successful return, the token + * and field in infoPtr is updated to refer to the next symbol in + * the expression string, and the expr field is advanced past that + * token; if the token is a value, then the value is stored at + * valuePtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +ExprLex(interp, infoPtr, valuePtr) + Tcl_Interp *interp; /* Interpreter to use for error + * reporting. */ + register ExprInfo *infoPtr; /* Describes the state of the parse. */ + register Value *valuePtr; /* Where to store value, if that is + * what's parsed from string. Caller + * must have initialized pv field + * correctly. */ +{ + register char *p; + char *var, *term; + int result; + + p = infoPtr->expr; + while (isspace(UCHAR(*p))) { + p++; + } + if (*p == 0) { + infoPtr->token = END; + infoPtr->expr = p; + return TCL_OK; + } + + /* + * First try to parse the token as an integer or floating-point number. + * A couple of tricky points: + * + * 1. Can't just check for leading digits to see if there's a number + * there, because it could be a special value like "NaN". + * 2. Don't want to check for a number if the first character is "+" + * or "-". If we do, we might treat a binary operator as unary + * by mistake, which will eventually cause a syntax error. + * 3. First see if there's an integer, then if there's stuff after + * the integer that looks like it could be a floating-point number + * (or if there wasn't even a sensible integer), then try to parse + * as a floating-point number. The check for the characters '8' + * or '9' is to handle floating-point numbers like 028.6: the + * leading zero causes strtoul to interpret the number as octal + * and stop when it gets to the 8. + */ + + if ((*p != '+') && (*p != '-')) { + errno = 0; + valuePtr->intValue = strtoul(p, &term, 0); + if ((term == p) || (*term == '.') || (*term == 'e') || + (*term == 'E') || (*term == '8') || (*term == '9')) { + char *term2; + + /* + * The code here is a bit tricky: we want to use a floating-point + * number if there is one, but if there isn't then fall through to + * use the integer that was already parsed, if there was one. + */ + + errno = 0; + valuePtr->doubleValue = strtod(p, &term2); + if (term2 != p) { + if (errno != 0) { + ExprFloatError(interp, valuePtr->doubleValue); + return TCL_ERROR; + } + infoPtr->token = VALUE; + infoPtr->expr = term2; + valuePtr->type = TYPE_DOUBLE; + return TCL_OK; + } + if (term != p) { + interp->result = "poorly-formed floating-point value"; + return TCL_ERROR; + } + } + if (term != p) { + /* + * No floating-point number, but there is an integer. + */ + + if (errno == ERANGE) { + interp->result = "integer value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", interp->result, + (char *) NULL); + return TCL_ERROR; + } + infoPtr->token = VALUE; + infoPtr->expr = term; + valuePtr->type = TYPE_INT; + return TCL_OK; + } + } + + infoPtr->expr = p+1; + switch (*p) { + case '$': + + /* + * Variable. Fetch its value, then see if it makes sense + * as an integer or floating-point number. + */ + + infoPtr->token = VALUE; + var = Tcl_ParseVar(interp, p, &infoPtr->expr); + if (var == NULL) { + return TCL_ERROR; + } + Tcl_ResetResult(interp); + if (((Interp *) interp)->noEval) { + valuePtr->type = TYPE_INT; + valuePtr->intValue = 0; + return TCL_OK; + } + return ExprParseString(interp, var, valuePtr); + + case '[': + infoPtr->token = VALUE; + ((Interp *) interp)->evalFlags = TCL_BRACKET_TERM; + result = Tcl_Eval(interp, p+1); + infoPtr->expr = ((Interp *) interp)->termPtr; + if (result != TCL_OK) { + return result; + } + infoPtr->expr++; + if (((Interp *) interp)->noEval) { + valuePtr->type = TYPE_INT; + valuePtr->intValue = 0; + Tcl_ResetResult(interp); + return TCL_OK; + } + result = ExprParseString(interp, interp->result, valuePtr); + if (result != TCL_OK) { + return result; + } + Tcl_ResetResult(interp); + return TCL_OK; + + case '"': + infoPtr->token = VALUE; + result = TclParseQuotes(interp, infoPtr->expr, '"', 0, + &infoPtr->expr, &valuePtr->pv); + if (result != TCL_OK) { + return result; + } + Tcl_ResetResult(interp); + return ExprParseString(interp, valuePtr->pv.buffer, valuePtr); + + case '{': + infoPtr->token = VALUE; + result = TclParseBraces(interp, infoPtr->expr, &infoPtr->expr, + &valuePtr->pv); + if (result != TCL_OK) { + return result; + } + Tcl_ResetResult(interp); + return ExprParseString(interp, valuePtr->pv.buffer, valuePtr); + + case '(': + infoPtr->token = OPEN_PAREN; + return TCL_OK; + + case ')': + infoPtr->token = CLOSE_PAREN; + return TCL_OK; + + case ',': + infoPtr->token = COMMA; + return TCL_OK; + + case '*': + infoPtr->token = MULT; + return TCL_OK; + + case '/': + infoPtr->token = DIVIDE; + return TCL_OK; + + case '%': + infoPtr->token = MOD; + return TCL_OK; + + case '+': + infoPtr->token = PLUS; + return TCL_OK; + + case '-': + infoPtr->token = MINUS; + return TCL_OK; + + case '?': + infoPtr->token = QUESTY; + return TCL_OK; + + case ':': + infoPtr->token = COLON; + return TCL_OK; + + case '<': + switch (p[1]) { + case '<': + infoPtr->expr = p+2; + infoPtr->token = LEFT_SHIFT; + break; + case '=': + infoPtr->expr = p+2; + infoPtr->token = LEQ; + break; + default: + infoPtr->token = LESS; + break; + } + return TCL_OK; + + case '>': + switch (p[1]) { + case '>': + infoPtr->expr = p+2; + infoPtr->token = RIGHT_SHIFT; + break; + case '=': + infoPtr->expr = p+2; + infoPtr->token = GEQ; + break; + default: + infoPtr->token = GREATER; + break; + } + return TCL_OK; + + case '=': + if (p[1] == '=') { + infoPtr->expr = p+2; + infoPtr->token = EQUAL; + } else { + infoPtr->token = UNKNOWN; + } + return TCL_OK; + + case '!': + if (p[1] == '=') { + infoPtr->expr = p+2; + infoPtr->token = NEQ; + } else { + infoPtr->token = NOT; + } + return TCL_OK; + + case '&': + if (p[1] == '&') { + infoPtr->expr = p+2; + infoPtr->token = AND; + } else { + infoPtr->token = BIT_AND; + } + return TCL_OK; + + case '^': + infoPtr->token = BIT_XOR; + return TCL_OK; + + case '|': + if (p[1] == '|') { + infoPtr->expr = p+2; + infoPtr->token = OR; + } else { + infoPtr->token = BIT_OR; + } + return TCL_OK; + + case '~': + infoPtr->token = BIT_NOT; + return TCL_OK; + + default: + if (isalpha(UCHAR(*p))) { + infoPtr->expr = p; + return ExprMathFunc(interp, infoPtr, valuePtr); + } + infoPtr->expr = p+1; + infoPtr->token = UNKNOWN; + return TCL_OK; + } +} + +/* + *---------------------------------------------------------------------- + * + * ExprGetValue -- + * + * Parse a "value" from the remainder of the expression in infoPtr. + * + * Results: + * Normally TCL_OK is returned. The value of the expression is + * returned in *valuePtr. If an error occurred, then interp->result + * contains an error message and TCL_ERROR is returned. + * InfoPtr->token will be left pointing to the token AFTER the + * expression, and infoPtr->expr will point to the character just + * after the terminating token. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +ExprGetValue(interp, infoPtr, prec, valuePtr) + Tcl_Interp *interp; /* Interpreter to use for error + * reporting. */ + register ExprInfo *infoPtr; /* Describes the state of the parse + * just before the value (i.e. ExprLex + * will be called to get first token + * of value). */ + int prec; /* Treat any un-parenthesized operator + * with precedence <= this as the end + * of the expression. */ + Value *valuePtr; /* Where to store the value of the + * expression. Caller must have + * initialized pv field. */ +{ + Interp *iPtr = (Interp *) interp; + Value value2; /* Second operand for current + * operator. */ + int operator; /* Current operator (either unary + * or binary). */ + int badType; /* Type of offending argument; used + * for error messages. */ + int gotOp; /* Non-zero means already lexed the + * operator (while picking up value + * for unary operator). Don't lex + * again. */ + int result; + + /* + * There are two phases to this procedure. First, pick off an initial + * value. Then, parse (binary operator, value) pairs until done. + */ + + gotOp = 0; + value2.pv.buffer = value2.pv.next = value2.staticSpace; + value2.pv.end = value2.pv.buffer + STATIC_STRING_SPACE - 1; + value2.pv.expandProc = TclExpandParseValue; + value2.pv.clientData = (ClientData) NULL; + result = ExprLex(interp, infoPtr, valuePtr); + if (result != TCL_OK) { + goto done; + } + if (infoPtr->token == OPEN_PAREN) { + + /* + * Parenthesized sub-expression. + */ + + result = ExprGetValue(interp, infoPtr, -1, valuePtr); + if (result != TCL_OK) { + goto done; + } + if (infoPtr->token != CLOSE_PAREN) { + Tcl_AppendResult(interp, "unmatched parentheses in expression \"", + infoPtr->originalExpr, "\"", (char *) NULL); + result = TCL_ERROR; + goto done; + } + } else { + if (infoPtr->token == MINUS) { + infoPtr->token = UNARY_MINUS; + } + if (infoPtr->token >= UNARY_MINUS) { + + /* + * Process unary operators. + */ + + operator = infoPtr->token; + result = ExprGetValue(interp, infoPtr, precTable[infoPtr->token], + valuePtr); + if (result != TCL_OK) { + goto done; + } + switch (operator) { + case UNARY_MINUS: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = -valuePtr->intValue; + } else if (valuePtr->type == TYPE_DOUBLE){ + valuePtr->doubleValue = -valuePtr->doubleValue; + } else { + badType = valuePtr->type; + goto illegalType; + } + break; + case NOT: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = !valuePtr->intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + /* + * Theoretically, should be able to use + * "!valuePtr->intValue", but apparently some + * compilers can't handle it. + */ + if (valuePtr->doubleValue == 0.0) { + valuePtr->intValue = 1; + } else { + valuePtr->intValue = 0; + } + valuePtr->type = TYPE_INT; + } else { + badType = valuePtr->type; + goto illegalType; + } + break; + case BIT_NOT: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = ~valuePtr->intValue; + } else { + badType = valuePtr->type; + goto illegalType; + } + break; + } + gotOp = 1; + } else if (infoPtr->token != VALUE) { + goto syntaxError; + } + } + + /* + * Got the first operand. Now fetch (operator, operand) pairs. + */ + + if (!gotOp) { + result = ExprLex(interp, infoPtr, &value2); + if (result != TCL_OK) { + goto done; + } + } + while (1) { + operator = infoPtr->token; + value2.pv.next = value2.pv.buffer; + if ((operator < MULT) || (operator >= UNARY_MINUS)) { + if ((operator == END) || (operator == CLOSE_PAREN) + || (operator == COMMA)) { + result = TCL_OK; + goto done; + } else { + goto syntaxError; + } + } + if (precTable[operator] <= prec) { + result = TCL_OK; + goto done; + } + + /* + * If we're doing an AND or OR and the first operand already + * determines the result, don't execute anything in the + * second operand: just parse. Same style for ?: pairs. + */ + + if ((operator == AND) || (operator == OR) || (operator == QUESTY)) { + if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = valuePtr->doubleValue != 0; + valuePtr->type = TYPE_INT; + } else if (valuePtr->type == TYPE_STRING) { + badType = TYPE_STRING; + goto illegalType; + } + if (((operator == AND) && !valuePtr->intValue) + || ((operator == OR) && valuePtr->intValue)) { + iPtr->noEval++; + result = ExprGetValue(interp, infoPtr, precTable[operator], + &value2); + iPtr->noEval--; + } else if (operator == QUESTY) { + if (valuePtr->intValue != 0) { + valuePtr->pv.next = valuePtr->pv.buffer; + result = ExprGetValue(interp, infoPtr, precTable[operator], + valuePtr); + if (result != TCL_OK) { + goto done; + } + if (infoPtr->token != COLON) { + goto syntaxError; + } + value2.pv.next = value2.pv.buffer; + iPtr->noEval++; + result = ExprGetValue(interp, infoPtr, precTable[operator], + &value2); + iPtr->noEval--; + } else { + iPtr->noEval++; + result = ExprGetValue(interp, infoPtr, precTable[operator], + &value2); + iPtr->noEval--; + if (result != TCL_OK) { + goto done; + } + if (infoPtr->token != COLON) { + goto syntaxError; + } + valuePtr->pv.next = valuePtr->pv.buffer; + result = ExprGetValue(interp, infoPtr, precTable[operator], + valuePtr); + } + } else { + result = ExprGetValue(interp, infoPtr, precTable[operator], + &value2); + } + } else { + result = ExprGetValue(interp, infoPtr, precTable[operator], + &value2); + } + if (result != TCL_OK) { + goto done; + } + if ((infoPtr->token < MULT) && (infoPtr->token != VALUE) + && (infoPtr->token != END) && (infoPtr->token != COMMA) + && (infoPtr->token != CLOSE_PAREN)) { + goto syntaxError; + } + + /* + * At this point we've got two values and an operator. Check + * to make sure that the particular data types are appropriate + * for the particular operator, and perform type conversion + * if necessary. + */ + + switch (operator) { + + /* + * For the operators below, no strings are allowed and + * ints get converted to floats if necessary. + */ + + case MULT: case DIVIDE: case PLUS: case MINUS: + if ((valuePtr->type == TYPE_STRING) + || (value2.type == TYPE_STRING)) { + badType = TYPE_STRING; + goto illegalType; + } + if (valuePtr->type == TYPE_DOUBLE) { + if (value2.type == TYPE_INT) { + value2.doubleValue = value2.intValue; + value2.type = TYPE_DOUBLE; + } + } else if (value2.type == TYPE_DOUBLE) { + if (valuePtr->type == TYPE_INT) { + valuePtr->doubleValue = valuePtr->intValue; + valuePtr->type = TYPE_DOUBLE; + } + } + break; + + /* + * For the operators below, only integers are allowed. + */ + + case MOD: case LEFT_SHIFT: case RIGHT_SHIFT: + case BIT_AND: case BIT_XOR: case BIT_OR: + if (valuePtr->type != TYPE_INT) { + badType = valuePtr->type; + goto illegalType; + } else if (value2.type != TYPE_INT) { + badType = value2.type; + goto illegalType; + } + break; + + /* + * For the operators below, any type is allowed but the + * two operands must have the same type. Convert integers + * to floats and either to strings, if necessary. + */ + + case LESS: case GREATER: case LEQ: case GEQ: + case EQUAL: case NEQ: + if (valuePtr->type == TYPE_STRING) { + if (value2.type != TYPE_STRING) { + ExprMakeString(interp, &value2); + } + } else if (value2.type == TYPE_STRING) { + if (valuePtr->type != TYPE_STRING) { + ExprMakeString(interp, valuePtr); + } + } else if (valuePtr->type == TYPE_DOUBLE) { + if (value2.type == TYPE_INT) { + value2.doubleValue = value2.intValue; + value2.type = TYPE_DOUBLE; + } + } else if (value2.type == TYPE_DOUBLE) { + if (valuePtr->type == TYPE_INT) { + valuePtr->doubleValue = valuePtr->intValue; + valuePtr->type = TYPE_DOUBLE; + } + } + break; + + /* + * For the operators below, no strings are allowed, but + * no int->double conversions are performed. + */ + + case AND: case OR: + if (valuePtr->type == TYPE_STRING) { + badType = valuePtr->type; + goto illegalType; + } + if (value2.type == TYPE_STRING) { + badType = value2.type; + goto illegalType; + } + break; + + /* + * For the operators below, type and conversions are + * irrelevant: they're handled elsewhere. + */ + + case QUESTY: case COLON: + break; + + /* + * Any other operator is an error. + */ + + default: + interp->result = "unknown operator in expression"; + result = TCL_ERROR; + goto done; + } + + /* + * If necessary, convert one of the operands to the type + * of the other. If the operands are incompatible with + * the operator (e.g. "+" on strings) then return an + * error. + */ + + switch (operator) { + case MULT: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue *= value2.intValue; + } else { + valuePtr->doubleValue *= value2.doubleValue; + } + break; + case DIVIDE: + case MOD: + if (valuePtr->type == TYPE_INT) { + int divisor, quot, rem, negative; + if (value2.intValue == 0) { + divideByZero: + interp->result = "divide by zero"; + Tcl_SetErrorCode(interp, "ARITH", "DIVZERO", + interp->result, (char *) NULL); + result = TCL_ERROR; + goto done; + } + + /* + * The code below is tricky because C doesn't guarantee + * much about the properties of the quotient or + * remainder, but Tcl does: the remainder always has + * the same sign as the divisor and a smaller absolute + * value. + */ + + divisor = value2.intValue; + negative = 0; + if (divisor < 0) { + divisor = -divisor; + valuePtr->intValue = -valuePtr->intValue; + negative = 1; + } + quot = valuePtr->intValue / divisor; + rem = valuePtr->intValue % divisor; + if (rem < 0) { + rem += divisor; + quot -= 1; + } + if (negative) { + rem = -rem; + } + valuePtr->intValue = (operator == DIVIDE) ? quot : rem; + } else { + if (value2.doubleValue == 0.0) { + goto divideByZero; + } + valuePtr->doubleValue /= value2.doubleValue; + } + break; + case PLUS: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue += value2.intValue; + } else { + valuePtr->doubleValue += value2.doubleValue; + } + break; + case MINUS: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue -= value2.intValue; + } else { + valuePtr->doubleValue -= value2.doubleValue; + } + break; + case LEFT_SHIFT: + valuePtr->intValue <<= value2.intValue; + break; + case RIGHT_SHIFT: + /* + * The following code is a bit tricky: it ensures that + * right shifts propagate the sign bit even on machines + * where ">>" won't do it by default. + */ + + if (valuePtr->intValue < 0) { + valuePtr->intValue = + ~((~valuePtr->intValue) >> value2.intValue); + } else { + valuePtr->intValue >>= value2.intValue; + } + break; + case LESS: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = + valuePtr->intValue < value2.intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = + valuePtr->doubleValue < value2.doubleValue; + } else { + valuePtr->intValue = + strcmp(valuePtr->pv.buffer, value2.pv.buffer) < 0; + } + valuePtr->type = TYPE_INT; + break; + case GREATER: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = + valuePtr->intValue > value2.intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = + valuePtr->doubleValue > value2.doubleValue; + } else { + valuePtr->intValue = + strcmp(valuePtr->pv.buffer, value2.pv.buffer) > 0; + } + valuePtr->type = TYPE_INT; + break; + case LEQ: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = + valuePtr->intValue <= value2.intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = + valuePtr->doubleValue <= value2.doubleValue; + } else { + valuePtr->intValue = + strcmp(valuePtr->pv.buffer, value2.pv.buffer) <= 0; + } + valuePtr->type = TYPE_INT; + break; + case GEQ: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = + valuePtr->intValue >= value2.intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = + valuePtr->doubleValue >= value2.doubleValue; + } else { + valuePtr->intValue = + strcmp(valuePtr->pv.buffer, value2.pv.buffer) >= 0; + } + valuePtr->type = TYPE_INT; + break; + case EQUAL: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = + valuePtr->intValue == value2.intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = + valuePtr->doubleValue == value2.doubleValue; + } else { + valuePtr->intValue = + strcmp(valuePtr->pv.buffer, value2.pv.buffer) == 0; + } + valuePtr->type = TYPE_INT; + break; + case NEQ: + if (valuePtr->type == TYPE_INT) { + valuePtr->intValue = + valuePtr->intValue != value2.intValue; + } else if (valuePtr->type == TYPE_DOUBLE) { + valuePtr->intValue = + valuePtr->doubleValue != value2.doubleValue; + } else { + valuePtr->intValue = + strcmp(valuePtr->pv.buffer, value2.pv.buffer) != 0; + } + valuePtr->type = TYPE_INT; + break; + case BIT_AND: + valuePtr->intValue &= value2.intValue; + break; + case BIT_XOR: + valuePtr->intValue ^= value2.intValue; + break; + case BIT_OR: + valuePtr->intValue |= value2.intValue; + break; + + /* + * For AND and OR, we know that the first value has already + * been converted to an integer. Thus we need only consider + * the possibility of int vs. double for the second value. + */ + + case AND: + if (value2.type == TYPE_DOUBLE) { + value2.intValue = value2.doubleValue != 0; + value2.type = TYPE_INT; + } + valuePtr->intValue = valuePtr->intValue && value2.intValue; + break; + case OR: + if (value2.type == TYPE_DOUBLE) { + value2.intValue = value2.doubleValue != 0; + value2.type = TYPE_INT; + } + valuePtr->intValue = valuePtr->intValue || value2.intValue; + break; + + case COLON: + interp->result = "can't have : operator without ? first"; + result = TCL_ERROR; + goto done; + } + } + + done: + if (value2.pv.buffer != value2.staticSpace) { + ckfree(value2.pv.buffer); + } + return result; + + syntaxError: + Tcl_AppendResult(interp, "syntax error in expression \"", + infoPtr->originalExpr, "\"", (char *) NULL); + result = TCL_ERROR; + goto done; + + illegalType: + Tcl_AppendResult(interp, "can't use ", (badType == TYPE_DOUBLE) ? + "floating-point value" : "non-numeric string", + " as operand of \"", operatorStrings[operator], "\"", + (char *) NULL); + result = TCL_ERROR; + goto done; +} + +/* + *-------------------------------------------------------------- + * + * ExprMakeString -- + * + * Convert a value from int or double representation to + * a string. + * + * Results: + * The information at *valuePtr gets converted to string + * format, if it wasn't that way already. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +static void +ExprMakeString(interp, valuePtr) + Tcl_Interp *interp; /* Interpreter to use for precision + * information. */ + register Value *valuePtr; /* Value to be converted. */ +{ + int shortfall; + + shortfall = 150 - (valuePtr->pv.end - valuePtr->pv.buffer); + if (shortfall > 0) { + (*valuePtr->pv.expandProc)(&valuePtr->pv, shortfall); + } + if (valuePtr->type == TYPE_INT) { + sprintf(valuePtr->pv.buffer, "%ld", valuePtr->intValue); + } else if (valuePtr->type == TYPE_DOUBLE) { + Tcl_PrintDouble(interp, valuePtr->doubleValue, valuePtr->pv.buffer); + } + valuePtr->type = TYPE_STRING; +} + +/* + *-------------------------------------------------------------- + * + * ExprTopLevel -- + * + * This procedure provides top-level functionality shared by + * procedures like Tcl_ExprInt, Tcl_ExprDouble, etc. + * + * Results: + * The result is a standard Tcl return value. If an error + * occurs then an error message is left in interp->result. + * The value of the expression is returned in *valuePtr, in + * whatever form it ends up in (could be string or integer + * or double). Caller may need to convert result. Caller + * is also responsible for freeing string memory in *valuePtr, + * if any was allocated. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +static int +ExprTopLevel(interp, string, valuePtr) + Tcl_Interp *interp; /* Context in which to evaluate the + * expression. */ + char *string; /* Expression to evaluate. */ + Value *valuePtr; /* Where to store result. Should + * not be initialized by caller. */ +{ + ExprInfo info; + int result; + + /* + * Create the math functions the first time an expression is + * evaluated. + */ + + if (!(((Interp *) interp)->flags & EXPR_INITIALIZED)) { + BuiltinFunc *funcPtr; + + ((Interp *) interp)->flags |= EXPR_INITIALIZED; + for (funcPtr = funcTable; funcPtr->name != NULL; + funcPtr++) { + Tcl_CreateMathFunc(interp, funcPtr->name, funcPtr->numArgs, + funcPtr->argTypes, funcPtr->proc, funcPtr->clientData); + } + } + + info.originalExpr = string; + info.expr = string; + valuePtr->pv.buffer = valuePtr->pv.next = valuePtr->staticSpace; + valuePtr->pv.end = valuePtr->pv.buffer + STATIC_STRING_SPACE - 1; + valuePtr->pv.expandProc = TclExpandParseValue; + valuePtr->pv.clientData = (ClientData) NULL; + + result = ExprGetValue(interp, &info, -1, valuePtr); + if (result != TCL_OK) { + return result; + } + if (info.token != END) { + Tcl_AppendResult(interp, "syntax error in expression \"", + string, "\"", (char *) NULL); + return TCL_ERROR; + } + if ((valuePtr->type == TYPE_DOUBLE) && (IS_NAN(valuePtr->doubleValue) + || IS_INF(valuePtr->doubleValue))) { + /* + * IEEE floating-point error. + */ + + ExprFloatError(interp, valuePtr->doubleValue); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *-------------------------------------------------------------- + * + * Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean -- + * + * Procedures to evaluate an expression and return its value + * in a particular form. + * + * Results: + * Each of the procedures below returns a standard Tcl result. + * If an error occurs then an error message is left in + * interp->result. Otherwise the value of the expression, + * in the appropriate form, is stored at *resultPtr. If + * the expression had a result that was incompatible with the + * desired form then an error is returned. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +int +Tcl_ExprLong(interp, string, ptr) + Tcl_Interp *interp; /* Context in which to evaluate the + * expression. */ + char *string; /* Expression to evaluate. */ + long *ptr; /* Where to store result. */ +{ + Value value; + int result; + + result = ExprTopLevel(interp, string, &value); + if (result == TCL_OK) { + if (value.type == TYPE_INT) { + *ptr = value.intValue; + } else if (value.type == TYPE_DOUBLE) { + *ptr = value.doubleValue; + } else { + interp->result = "expression didn't have numeric value"; + result = TCL_ERROR; + } + } + if (value.pv.buffer != value.staticSpace) { + ckfree(value.pv.buffer); + } + return result; +} + +int +Tcl_ExprDouble(interp, string, ptr) + Tcl_Interp *interp; /* Context in which to evaluate the + * expression. */ + char *string; /* Expression to evaluate. */ + double *ptr; /* Where to store result. */ +{ + Value value; + int result; + + result = ExprTopLevel(interp, string, &value); + if (result == TCL_OK) { + if (value.type == TYPE_INT) { + *ptr = value.intValue; + } else if (value.type == TYPE_DOUBLE) { + *ptr = value.doubleValue; + } else { + interp->result = "expression didn't have numeric value"; + result = TCL_ERROR; + } + } + if (value.pv.buffer != value.staticSpace) { + ckfree(value.pv.buffer); + } + return result; +} + +int +Tcl_ExprBoolean(interp, string, ptr) + Tcl_Interp *interp; /* Context in which to evaluate the + * expression. */ + char *string; /* Expression to evaluate. */ + int *ptr; /* Where to store 0/1 result. */ +{ + Value value; + int result; + + result = ExprTopLevel(interp, string, &value); + if (result == TCL_OK) { + if (value.type == TYPE_INT) { + *ptr = value.intValue != 0; + } else if (value.type == TYPE_DOUBLE) { + *ptr = value.doubleValue != 0.0; + } else { + result = Tcl_GetBoolean(interp, value.pv.buffer, ptr); + } + } + if (value.pv.buffer != value.staticSpace) { + ckfree(value.pv.buffer); + } + return result; +} + +/* + *-------------------------------------------------------------- + * + * Tcl_ExprString -- + * + * Evaluate an expression and return its value in string form. + * + * Results: + * A standard Tcl result. If the result is TCL_OK, then the + * interpreter's result is set to the string value of the + * expression. If the result is TCL_OK, then interp->result + * contains an error message. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +int +Tcl_ExprString(interp, string) + Tcl_Interp *interp; /* Context in which to evaluate the + * expression. */ + char *string; /* Expression to evaluate. */ +{ + Value value; + int result; + + result = ExprTopLevel(interp, string, &value); + if (result == TCL_OK) { + if (value.type == TYPE_INT) { + sprintf(interp->result, "%ld", value.intValue); + } else if (value.type == TYPE_DOUBLE) { + Tcl_PrintDouble(interp, value.doubleValue, interp->result); + } else { + if (value.pv.buffer != value.staticSpace) { + interp->result = value.pv.buffer; + interp->freeProc = (Tcl_FreeProc *) free; + value.pv.buffer = value.staticSpace; + } else { + Tcl_SetResult(interp, value.pv.buffer, TCL_VOLATILE); + } + } + } + if (value.pv.buffer != value.staticSpace) { + ckfree(value.pv.buffer); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreateMathFunc -- + * + * Creates a new math function for expressions in a given + * interpreter. + * + * Results: + * None. + * + * Side effects: + * The function defined by "name" is created; if such a function + * already existed then its definition is overriden. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_CreateMathFunc(interp, name, numArgs, argTypes, proc, clientData) + Tcl_Interp *interp; /* Interpreter in which function is + * to be available. */ + char *name; /* Name of function (e.g. "sin"). */ + int numArgs; /* Nnumber of arguments required by + * function. */ + Tcl_ValueType *argTypes; /* Array of types acceptable for + * each argument. */ + Tcl_MathProc *proc; /* Procedure that implements the + * math function. */ + ClientData clientData; /* Additional value to pass to the + * function. */ +{ + Interp *iPtr = (Interp *) interp; + Tcl_HashEntry *hPtr; + MathFunc *mathFuncPtr; + int new, i; + + hPtr = Tcl_CreateHashEntry(&iPtr->mathFuncTable, name, &new); + if (new) { + Tcl_SetHashValue(hPtr, ckalloc(sizeof(MathFunc))); + } + mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr); + if (numArgs > MAX_MATH_ARGS) { + numArgs = MAX_MATH_ARGS; + } + mathFuncPtr->numArgs = numArgs; + for (i = 0; i < numArgs; i++) { + mathFuncPtr->argTypes[i] = argTypes[i]; + } + mathFuncPtr->proc = proc; + mathFuncPtr->clientData = clientData; +} + +/* + *---------------------------------------------------------------------- + * + * ExprMathFunc -- + * + * This procedure is invoked to parse a math function from an + * expression string, carry out the function, and return the + * value computed. + * + * Results: + * TCL_OK is returned if all went well and the function's value + * was computed successfully. If an error occurred, TCL_ERROR + * is returned and an error message is left in interp->result. + * After a successful return infoPtr has been updated to refer + * to the character just after the function call, the token is + * set to VALUE, and the value is stored in valuePtr. + * + * Side effects: + * Embedded commands could have arbitrary side-effects. + * + *---------------------------------------------------------------------- + */ + +static int +ExprMathFunc(interp, infoPtr, valuePtr) + Tcl_Interp *interp; /* Interpreter to use for error + * reporting. */ + register ExprInfo *infoPtr; /* Describes the state of the parse. + * infoPtr->expr must point to the + * first character of the function's + * name. */ + register Value *valuePtr; /* Where to store value, if that is + * what's parsed from string. Caller + * must have initialized pv field + * correctly. */ +{ + Interp *iPtr = (Interp *) interp; + MathFunc *mathFuncPtr; /* Info about math function. */ + Tcl_Value args[MAX_MATH_ARGS]; /* Arguments for function call. */ + Tcl_Value funcResult; /* Result of function call. */ + Tcl_HashEntry *hPtr; + char *p, *funcName; + int i, savedChar, result; + + /* + * Find the end of the math function's name and lookup the MathFunc + * record for the function. + */ + + p = funcName = infoPtr->expr; + while (isalnum(UCHAR(*p)) || (*p == '_')) { + p++; + } + infoPtr->expr = p; + result = ExprLex(interp, infoPtr, valuePtr); + if ((result != TCL_OK) || (infoPtr->token != OPEN_PAREN)) { + goto syntaxError; + } + savedChar = *p; + *p = 0; + hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, funcName); + if (hPtr == NULL) { + Tcl_AppendResult(interp, "unknown math function \"", funcName, + "\"", (char *) NULL); + *p = savedChar; + return TCL_ERROR; + } + *p = savedChar; + mathFuncPtr = (MathFunc *) Tcl_GetHashValue(hPtr); + + /* + * Scan off the arguments for the function, if there are any. + */ + + if (mathFuncPtr->numArgs == 0) { + result = ExprLex(interp, infoPtr, valuePtr); + if ((result != TCL_OK) || (infoPtr->token != CLOSE_PAREN)) { + goto syntaxError; + } + } else { + for (i = 0; ; i++) { + valuePtr->pv.next = valuePtr->pv.buffer; + result = ExprGetValue(interp, infoPtr, -1, valuePtr); + if (result != TCL_OK) { + return result; + } + if (valuePtr->type == TYPE_STRING) { + interp->result = + "argument to math function didn't have numeric value"; + return TCL_ERROR; + } + + /* + * Copy the value to the argument record, converting it if + * necessary. + */ + + if (valuePtr->type == TYPE_INT) { + if (mathFuncPtr->argTypes[i] == TCL_DOUBLE) { + args[i].type = TCL_DOUBLE; + args[i].doubleValue = valuePtr->intValue; + } else { + args[i].type = TCL_INT; + args[i].intValue = valuePtr->intValue; + } + } else { + if (mathFuncPtr->argTypes[i] == TCL_INT) { + args[i].type = TCL_INT; + args[i].intValue = valuePtr->doubleValue; + } else { + args[i].type = TCL_DOUBLE; + args[i].doubleValue = valuePtr->doubleValue; + } + } + + /* + * Check for a comma separator between arguments or a close-paren + * to end the argument list. + */ + + if (i == (mathFuncPtr->numArgs-1)) { + if (infoPtr->token == CLOSE_PAREN) { + break; + } + if (infoPtr->token == COMMA) { + interp->result = "too many arguments for math function"; + return TCL_ERROR; + } else { + goto syntaxError; + } + } + if (infoPtr->token != COMMA) { + if (infoPtr->token == CLOSE_PAREN) { + interp->result = "too few arguments for math function"; + return TCL_ERROR; + } else { + goto syntaxError; + } + } + } + } + + /* + * Invoke the function and copy its result back into valuePtr. + */ + + tcl_MathInProgress++; + result = (*mathFuncPtr->proc)(mathFuncPtr->clientData, interp, args, + &funcResult); + tcl_MathInProgress--; + if (result != TCL_OK) { + return result; + } + if (funcResult.type == TCL_INT) { + valuePtr->type = TYPE_INT; + valuePtr->intValue = funcResult.intValue; + } else { + valuePtr->type = TYPE_DOUBLE; + valuePtr->doubleValue = funcResult.doubleValue; + } + infoPtr->token = VALUE; + return TCL_OK; + + syntaxError: + Tcl_AppendResult(interp, "syntax error in expression \"", + infoPtr->originalExpr, "\"", (char *) NULL); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * ExprFloatError -- + * + * This procedure is called when an error occurs during a + * floating-point operation. It reads errno and sets + * interp->result accordingly. + * + * Results: + * Interp->result is set to hold an error message. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ExprFloatError(interp, value) + Tcl_Interp *interp; /* Where to store error message. */ + double value; /* Value returned after error; used to + * distinguish underflows from overflows. */ +{ + char buf[20]; + + if ((errno == EDOM) || (value != value)) { + interp->result = "domain error: argument not in valid range"; + Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", interp->result, + (char *) NULL); + } else if ((errno == ERANGE) || IS_INF(value)) { + if (value == 0.0) { + interp->result = "floating-point value too small to represent"; + Tcl_SetErrorCode(interp, "ARITH", "UNDERFLOW", interp->result, + (char *) NULL); + } else { + interp->result = "floating-point value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "OVERFLOW", interp->result, + (char *) NULL); + } + } else { + sprintf(buf, "%d", errno); + Tcl_AppendResult(interp, "unknown floating-point error, ", + "errno = ", buf, (char *) NULL); + Tcl_SetErrorCode(interp, "ARITH", "UNKNOWN", interp->result, + (char *) NULL); + } +} + +/* + *---------------------------------------------------------------------- + * + * Math Functions -- + * + * This page contains the procedures that implement all of the + * built-in math functions for expressions. + * + * Results: + * Each procedure returns TCL_OK if it succeeds and places result + * information at *resultPtr. If it fails it returns TCL_ERROR + * and leaves an error message in interp->result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +ExprUnaryFunc(clientData, interp, args, resultPtr) + ClientData clientData; /* Contains address of procedure that + * takes one double argument and + * returns a double result. */ + Tcl_Interp *interp; + Tcl_Value *args; + Tcl_Value *resultPtr; +{ + double (*func)() = (double (*)()) clientData; + + errno = 0; + resultPtr->type = TCL_DOUBLE; + resultPtr->doubleValue = (*func)(args[0].doubleValue); + if (errno != 0) { + ExprFloatError(interp, resultPtr->doubleValue); + return TCL_ERROR; + } + return TCL_OK; +} + +static int +ExprBinaryFunc(clientData, interp, args, resultPtr) + ClientData clientData; /* Contains address of procedure that + * takes two double arguments and + * returns a double result. */ + Tcl_Interp *interp; + Tcl_Value *args; + Tcl_Value *resultPtr; +{ + double (*func)() = (double (*)()) clientData; + + errno = 0; + resultPtr->type = TCL_DOUBLE; + resultPtr->doubleValue = (*func)(args[0].doubleValue, args[1].doubleValue); + if (errno != 0) { + ExprFloatError(interp, resultPtr->doubleValue); + return TCL_ERROR; + } + return TCL_OK; +} + + /* ARGSUSED */ +static int +ExprAbsFunc(clientData, interp, args, resultPtr) + ClientData clientData; + Tcl_Interp *interp; + Tcl_Value *args; + Tcl_Value *resultPtr; +{ + resultPtr->type = TCL_DOUBLE; + if (args[0].type == TCL_DOUBLE) { + resultPtr->type = TCL_DOUBLE; + if (args[0].doubleValue < 0) { + resultPtr->doubleValue = -args[0].doubleValue; + } else { + resultPtr->doubleValue = args[0].doubleValue; + } + } else { + resultPtr->type = TCL_INT; + if (args[0].intValue < 0) { + resultPtr->intValue = -args[0].intValue; + if (resultPtr->intValue < 0) { + interp->result = "integer value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", interp->result, + (char *) NULL); + return TCL_ERROR; + } + } else { + resultPtr->intValue = args[0].intValue; + } + } + return TCL_OK; +} + + /* ARGSUSED */ +static int +ExprDoubleFunc(clientData, interp, args, resultPtr) + ClientData clientData; + Tcl_Interp *interp; + Tcl_Value *args; + Tcl_Value *resultPtr; +{ + resultPtr->type = TCL_DOUBLE; + if (args[0].type == TCL_DOUBLE) { + resultPtr->doubleValue = args[0].doubleValue; + } else { + resultPtr->doubleValue = args[0].intValue; + } + return TCL_OK; +} + + /* ARGSUSED */ +static int +ExprIntFunc(clientData, interp, args, resultPtr) + ClientData clientData; + Tcl_Interp *interp; + Tcl_Value *args; + Tcl_Value *resultPtr; +{ + resultPtr->type = TCL_INT; + if (args[0].type == TCL_INT) { + resultPtr->intValue = args[0].intValue; + } else { + if (args[0].doubleValue < 0) { + if (args[0].doubleValue < (double) (long) LONG_MIN) { + tooLarge: + interp->result = "integer value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", + interp->result, (char *) NULL); + return TCL_ERROR; + } + } else { + if (args[0].doubleValue > (double) LONG_MAX) { + goto tooLarge; + } + } + resultPtr->intValue = args[0].doubleValue; + } + return TCL_OK; +} + + /* ARGSUSED */ +static int +ExprRoundFunc(clientData, interp, args, resultPtr) + ClientData clientData; + Tcl_Interp *interp; + Tcl_Value *args; + Tcl_Value *resultPtr; +{ + resultPtr->type = TCL_INT; + if (args[0].type == TCL_INT) { + resultPtr->intValue = args[0].intValue; + } else { + if (args[0].doubleValue < 0) { + if (args[0].doubleValue <= (((double) (long) LONG_MIN) - 0.5)) { + tooLarge: + interp->result = "integer value too large to represent"; + Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", + interp->result, (char *) NULL); + return TCL_ERROR; + } + resultPtr->intValue = (args[0].doubleValue - 0.5); + } else { + if (args[0].doubleValue >= (((double) LONG_MAX + 0.5))) { + goto tooLarge; + } + resultPtr->intValue = (args[0].doubleValue + 0.5); + } + } + return TCL_OK; +} diff --git a/vendor/x11iraf/obm/Tcl/tclGet.c b/vendor/x11iraf/obm/Tcl/tclGet.c new file mode 100644 index 00000000..fe280e6b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclGet.c @@ -0,0 +1,210 @@ +/* + * tclGet.c -- + * + * This file contains procedures to convert strings into + * other forms, like integers or floating-point numbers or + * booleans, doing syntax checking along the way. + * + * Copyright (c) 1990-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclGet.c,v 1.14 93/08/18 16:07:24 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetInt -- + * + * Given a string, produce the corresponding integer value. + * + * Results: + * The return value is normally TCL_OK; in this case *intPtr + * will be set to the integer value equivalent to string. If + * string is improperly formed then TCL_ERROR is returned and + * an error message will be left in interp->result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_GetInt(interp, string, intPtr) + Tcl_Interp *interp; /* Interpreter to use for error reporting. */ + char *string; /* String containing a (possibly signed) + * integer in a form acceptable to strtol. */ + int *intPtr; /* Place to store converted result. */ +{ + char *end, *p; + int i; + + /* + * Note: use strtoul instead of strtol for integer conversions + * to allow full-size unsigned numbers, but don't depend on strtoul + * to handle sign characters; it won't in some implementations. + */ + + for (p = string; isspace(UCHAR(*p)); p++) { + /* Empty loop body. */ + } + if (*p == '-') { + i = -strtoul(p+1, &end, 0); + } else if (*p == '+') { + i = strtoul(p+1, &end, 0); + } else { + i = strtoul(p, &end, 0); + } + while ((*end != '\0') && isspace(UCHAR(*end))) { + end++; + } + if ((end == string) || (*end != 0)) { + Tcl_AppendResult(interp, "expected integer but got \"", string, + "\"", (char *) NULL); + return TCL_ERROR; + } + *intPtr = i; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetDouble -- + * + * Given a string, produce the corresponding double-precision + * floating-point value. + * + * Results: + * The return value is normally TCL_OK; in this case *doublePtr + * will be set to the double-precision value equivalent to string. + * If string is improperly formed then TCL_ERROR is returned and + * an error message will be left in interp->result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_GetDouble(interp, string, doublePtr) + Tcl_Interp *interp; /* Interpreter to use for error reporting. */ + char *string; /* String containing a floating-point number + * in a form acceptable to strtod. */ + double *doublePtr; /* Place to store converted result. */ +{ + char *end; + double d; + + d = strtod(string, &end); + while ((*end != '\0') && isspace(UCHAR(*end))) { + end++; + } + if ((end == string) || (*end != 0)) { + Tcl_AppendResult(interp, "expected floating-point number but got \"", + string, "\"", (char *) NULL); + return TCL_ERROR; + } + *doublePtr = d; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetBoolean -- + * + * Given a string, return a 0/1 boolean value corresponding + * to the string. + * + * Results: + * The return value is normally TCL_OK; in this case *boolPtr + * will be set to the 0/1 value equivalent to string. If + * string is improperly formed then TCL_ERROR is returned and + * an error message will be left in interp->result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_GetBoolean(interp, string, boolPtr) + Tcl_Interp *interp; /* Interpreter to use for error reporting. */ + char *string; /* String containing a boolean number + * specified either as 1/0 or true/false or + * yes/no. */ + int *boolPtr; /* Place to store converted result, which + * will be 0 or 1. */ +{ + char c; + char lowerCase[10]; + int i, length; + + /* + * Convert the input string to all lower-case. + */ + + for (i = 0; i < 9; i++) { + c = string[i]; + if (c == 0) { + break; + } + if ((c >= 'A') && (c <= 'Z')) { + c += 'a' - 'A'; + } + lowerCase[i] = c; + } + lowerCase[i] = 0; + + length = strlen(lowerCase); + c = lowerCase[0]; + if ((c == '0') && (lowerCase[1] == '\0')) { + *boolPtr = 0; + } else if ((c == '1') && (lowerCase[1] == '\0')) { + *boolPtr = 1; + } else if ((c == 'y') && (strncmp(lowerCase, "yes", length) == 0)) { + *boolPtr = 1; + } else if ((c == 'n') && (strncmp(lowerCase, "no", length) == 0)) { + *boolPtr = 0; + } else if ((c == 't') && (strncmp(lowerCase, "true", length) == 0)) { + *boolPtr = 1; + } else if ((c == 'f') && (strncmp(lowerCase, "false", length) == 0)) { + *boolPtr = 0; + } else if ((c == 'o') && (length >= 2)) { + if (strncmp(lowerCase, "on", length) == 0) { + *boolPtr = 1; + } else if (strncmp(lowerCase, "off", length) == 0) { + *boolPtr = 0; + } + } else { + Tcl_AppendResult(interp, "expected boolean value but got \"", + string, "\"", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} diff --git a/vendor/x11iraf/obm/Tcl/tclGlob.c b/vendor/x11iraf/obm/Tcl/tclGlob.c new file mode 100644 index 00000000..a7f29d3d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclGlob.c @@ -0,0 +1,455 @@ +/* + * tclGlob.c -- + * + * This file provides procedures and commands for file name + * manipulation, such as tilde expansion and globbing. + * + * Copyright (c) 1990-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclGlob.c,v 1.36 93/10/14 15:14:08 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + * The structure below is used to keep track of a globbing result + * being built up (i.e. a partial list of file names). The list + * grows dynamically to be as big as needed. + */ + +typedef struct { + char *result; /* Pointer to result area. */ + int totalSpace; /* Total number of characters allocated + * for result. */ + int spaceUsed; /* Number of characters currently in use + * to hold the partial result (not including + * the terminating NULL). */ + int dynamic; /* 0 means result is static space, 1 means + * it's dynamic. */ +} GlobResult; + +/* + * Declarations for procedures local to this file: + */ + +static int DoGlob _ANSI_ARGS_((Tcl_Interp *interp, char *dir, + char *rem)); + +/* + *---------------------------------------------------------------------- + * + * DoGlob -- + * + * This recursive procedure forms the heart of the globbing + * code. It performs a depth-first traversal of the tree + * given by the path name to be globbed. + * + * Results: + * The return value is a standard Tcl result indicating whether + * an error occurred in globbing. After a normal return the + * result in interp will be set to hold all of the file names + * given by the dir and rem arguments. After an error the + * result in interp will hold an error message. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +DoGlob(interp, dir, rem) + Tcl_Interp *interp; /* Interpreter to use for error + * reporting (e.g. unmatched brace). */ + char *dir; /* Name of a directory at which to + * start glob expansion. This name + * is fixed: it doesn't contain any + * globbing chars. */ + char *rem; /* Path to glob-expand. */ +{ + /* + * When this procedure is entered, the name to be globbed may + * already have been partly expanded by ancestor invocations of + * DoGlob. The part that's already been expanded is in "dir" + * (this may initially be empty), and the part still to expand + * is in "rem". This procedure expands "rem" one level, making + * recursive calls to itself if there's still more stuff left + * in the remainder. + */ + + Tcl_DString newName; /* Holds new name consisting of + * dir plus the first part of rem. */ + register char *p; + register char c; + char *openBrace, *closeBrace, *name, *dirName; + int gotSpecial, baseLength; + int result = TCL_OK; + struct stat statBuf; + + /* + * Make sure that the directory part of the name really is a + * directory. If the directory name is "", use the name "." + * instead, because some UNIX systems don't treat "" like "." + * automatically. Keep the "" for use in generating file names, + * otherwise "glob foo.c" would return "./foo.c". + */ + + if (*dir == '\0') { + dirName = "."; + } else { + dirName = dir; + } + if ((stat(dirName, &statBuf) != 0) || !S_ISDIR(statBuf.st_mode)) { + return TCL_OK; + } + Tcl_DStringInit(&newName); + + /* + * First, find the end of the next element in rem, checking + * along the way for special globbing characters. + */ + + gotSpecial = 0; + openBrace = closeBrace = NULL; + for (p = rem; ; p++) { + c = *p; + if ((c == '\0') || ((openBrace == NULL) && (c == '/'))) { + break; + } + if ((c == '{') && (openBrace == NULL)) { + openBrace = p; + } + if ((c == '}') && (openBrace != NULL) && (closeBrace == NULL)) { + closeBrace = p; + } + if ((c == '*') || (c == '[') || (c == '\\') || (c == '?')) { + gotSpecial = 1; + } + } + + /* + * If there is an open brace in the argument, then make a recursive + * call for each element between the braces. In this case, the + * recursive call to DoGlob uses the same "dir" that we got. + * If there are several brace-pairs in a single name, we just handle + * one here, and the others will be handled in recursive calls. + */ + + if (openBrace != NULL) { + char *element; + + if (closeBrace == NULL) { + Tcl_ResetResult(interp); + interp->result = "unmatched open-brace in file name"; + result = TCL_ERROR; + goto done; + } + Tcl_DStringAppend(&newName, rem, openBrace-rem); + baseLength = newName.length; + for (p = openBrace; *p != '}'; ) { + element = p+1; + for (p = element; ((*p != '}') && (*p != ',')); p++) { + /* Empty loop body. */ + } + Tcl_DStringAppend(&newName, element, p-element); + Tcl_DStringAppend(&newName, closeBrace+1, -1); + result = DoGlob(interp, dir, newName.string); + if (result != TCL_OK) { + goto done; + } + newName.length = baseLength; + } + goto done; + } + + /* + * Start building up the next-level name with dir plus a slash if + * needed to separate it from the next file name. + */ + + Tcl_DStringAppend(&newName, dir, -1); + if ((dir[0] != 0) && (newName.string[newName.length-1] != '/')) { + Tcl_DStringAppend(&newName, "/", 1); + } + baseLength = newName.length; + + /* + * If there were any pattern-matching characters, then scan through + * the directory to find all the matching names. + */ + + if (gotSpecial) { + DIR *d; + struct dirent *entryPtr; + char savedChar; + + d = opendir(dirName); + if (d == NULL) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "couldn't read directory \"", + dirName, "\": ", Tcl_PosixError(interp), (char *) NULL); + result = TCL_ERROR; + goto done; + } + + /* + * Temporarily store a null into rem so that the pattern string + * is now null-terminated. + */ + + savedChar = *p; + *p = 0; + + while (1) { + entryPtr = readdir(d); + if (entryPtr == NULL) { + break; + } + + /* + * Don't match names starting with "." unless the "." is + * present in the pattern. + */ + + if ((*entryPtr->d_name == '.') && (*rem != '.')) { + continue; + } + if (Tcl_StringMatch(entryPtr->d_name, rem)) { + newName.length = baseLength; + Tcl_DStringAppend(&newName, entryPtr->d_name, -1); + if (savedChar == 0) { + Tcl_AppendElement(interp, newName.string); + } else { + result = DoGlob(interp, newName.string, p+1); + if (result != TCL_OK) { + break; + } + } + } + } + closedir(d); + *p = savedChar; + goto done; + } + + /* + * The current element is a simple one with no fancy features. Add + * it to the new name. If there are more elements still to come, + * then recurse to process them. + */ + + Tcl_DStringAppend(&newName, rem, p-rem); + if (*p != 0) { + result = DoGlob(interp, newName.string, p+1); + goto done; + } + + /* + * There are no more elements in the pattern. Check to be sure the + * file actually exists, then add its name to the list being formed + * in interp-result. + */ + + name = newName.string; + if (*name == 0) { + name = "."; + } + if (access(name, F_OK) != 0) { + goto done; + } + Tcl_AppendElement(interp, name); + + done: + Tcl_DStringFree(&newName); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_TildeSubst -- + * + * Given a name starting with a tilde, produce a name where + * the tilde and following characters have been replaced by + * the home directory location for the named user. + * + * Results: + * The result is a pointer to a static string containing + * the new name. If there was an error in processing the + * tilde, then an error message is left in interp->result + * and the return value is NULL. The result may be stored + * in bufferPtr; the caller must call Tcl_DStringFree(bufferPtr) + * to free the name. + * + * Side effects: + * Information may be left in bufferPtr. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_TildeSubst(interp, name, bufferPtr) + Tcl_Interp *interp; /* Interpreter in which to store error + * message (if necessary). */ + char *name; /* File name, which may begin with "~/" + * (to indicate current user's home directory) + * or "~<user>/" (to indicate any user's + * home directory). */ + Tcl_DString *bufferPtr; /* May be used to hold result. Must not hold + * anything at the time of the call, and need + * not even be initialized. */ +{ + char *dir; + register char *p; + + Tcl_DStringInit(bufferPtr); + if (name[0] != '~') { + return name; + } + + if ((name[1] == '/') || (name[1] == '\0')) { + dir = getenv("HOME"); + if (dir == NULL) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "couldn't find HOME environment ", + "variable to expand \"", name, "\"", (char *) NULL); + return NULL; + } + Tcl_DStringAppend(bufferPtr, dir, -1); + Tcl_DStringAppend(bufferPtr, name+1, -1); + } else { + struct passwd *pwPtr; + + for (p = &name[1]; (*p != 0) && (*p != '/'); p++) { + /* Null body; just find end of name. */ + } + Tcl_DStringAppend(bufferPtr, name+1, p - (name+1)); + pwPtr = getpwnam(bufferPtr->string); + if (pwPtr == NULL) { + endpwent(); + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "user \"", bufferPtr->string, + "\" doesn't exist", (char *) NULL); + return NULL; + } + Tcl_DStringFree(bufferPtr); + Tcl_DStringAppend(bufferPtr, pwPtr->pw_dir, -1); + Tcl_DStringAppend(bufferPtr, p, -1); + endpwent(); + } + return bufferPtr->string; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GlobCmd -- + * + * This procedure is invoked to process the "glob" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_GlobCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i, result, noComplain, firstArg; + + if (argc < 2) { + notEnoughArgs: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?switches? name ?name ...?\"", (char *) NULL); + return TCL_ERROR; + } + noComplain = 0; + for (firstArg = 1; (firstArg < argc) && (argv[firstArg][0] == '-'); + firstArg++) { + if (strcmp(argv[firstArg], "-nocomplain") == 0) { + noComplain = 1; + } else if (strcmp(argv[firstArg], "--") == 0) { + firstArg++; + break; + } else { + Tcl_AppendResult(interp, "bad switch \"", argv[firstArg], + "\": must be -nocomplain or --", (char *) NULL); + return TCL_ERROR; + } + } + if (firstArg >= argc) { + goto notEnoughArgs; + } + + for (i = firstArg; i < argc; i++) { + char *thisName; + Tcl_DString buffer; + + thisName = Tcl_TildeSubst(interp, argv[i], &buffer); + if (thisName == NULL) { + return TCL_ERROR; + } + if (*thisName == '/') { + if (thisName[1] == '/') { + /* + * This is a special hack for systems like those from Apollo + * where there is a super-root at "//": need to treat the + * double-slash as a single name. + */ + result = DoGlob(interp, "//", thisName+2); + } else { + result = DoGlob(interp, "/", thisName+1); + } + } else { + result = DoGlob(interp, "", thisName); + } + Tcl_DStringFree(&buffer); + if (result != TCL_OK) { + return result; + } + } + if ((*interp->result == 0) && !noComplain) { + char *sep = ""; + + Tcl_AppendResult(interp, "no files matched glob pattern", + (argc == 2) ? " \"" : "s \"", (char *) NULL); + for (i = firstArg; i < argc; i++) { + Tcl_AppendResult(interp, sep, argv[i], (char *) NULL); + sep = " "; + } + Tcl_AppendResult(interp, "\"", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} diff --git a/vendor/x11iraf/obm/Tcl/tclHash.c b/vendor/x11iraf/obm/Tcl/tclHash.c new file mode 100644 index 00000000..1c4ac37c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclHash.c @@ -0,0 +1,937 @@ +/* + * tclHash.c -- + * + * Implementation of in-memory hash tables for Tcl and Tcl-based + * applications. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclHash.c,v 1.13 93/06/02 10:17:13 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" + +/* + * When there are this many entries per bucket, on average, rebuild + * the hash table to make it larger. + */ + +#define REBUILD_MULTIPLIER 3 + + +/* + * The following macro takes a preliminary integer hash value and + * produces an index into a hash tables bucket list. The idea is + * to make it so that preliminary values that are arbitrarily similar + * will end up in different buckets. The hash function was taken + * from a random-number generator. + */ + +#define RANDOM_INDEX(tablePtr, i) \ + (((((long) (i))*1103515245) >> (tablePtr)->downShift) & (tablePtr)->mask) + +/* + * Procedure prototypes for static procedures in this file: + */ + +static Tcl_HashEntry * ArrayFind _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key)); +static Tcl_HashEntry * ArrayCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key, int *newPtr)); +static Tcl_HashEntry * BogusFind _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key)); +static Tcl_HashEntry * BogusCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key, int *newPtr)); +static unsigned int HashString _ANSI_ARGS_((char *string)); +static void RebuildTable _ANSI_ARGS_((Tcl_HashTable *tablePtr)); +static Tcl_HashEntry * StringFind _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key)); +static Tcl_HashEntry * StringCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key, int *newPtr)); +static Tcl_HashEntry * OneWordFind _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key)); +static Tcl_HashEntry * OneWordCreate _ANSI_ARGS_((Tcl_HashTable *tablePtr, + char *key, int *newPtr)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_InitHashTable -- + * + * Given storage for a hash table, set up the fields to prepare + * the hash table for use. + * + * Results: + * None. + * + * Side effects: + * TablePtr is now ready to be passed to Tcl_FindHashEntry and + * Tcl_CreateHashEntry. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_InitHashTable(tablePtr, keyType) + register Tcl_HashTable *tablePtr; /* Pointer to table record, which + * is supplied by the caller. */ + int keyType; /* Type of keys to use in table: + * TCL_STRING_KEYS, TCL_ONE_WORD_KEYS, + * or an integer >= 2. */ +{ + tablePtr->buckets = tablePtr->staticBuckets; + tablePtr->staticBuckets[0] = tablePtr->staticBuckets[1] = 0; + tablePtr->staticBuckets[2] = tablePtr->staticBuckets[3] = 0; + tablePtr->numBuckets = TCL_SMALL_HASH_TABLE; + tablePtr->numEntries = 0; + tablePtr->rebuildSize = TCL_SMALL_HASH_TABLE*REBUILD_MULTIPLIER; + tablePtr->downShift = 28; + tablePtr->mask = 3; + tablePtr->keyType = keyType; + if (keyType == TCL_STRING_KEYS) { + tablePtr->findProc = StringFind; + tablePtr->createProc = StringCreate; + } else if (keyType == TCL_ONE_WORD_KEYS) { + tablePtr->findProc = OneWordFind; + tablePtr->createProc = OneWordCreate; + } else { + tablePtr->findProc = ArrayFind; + tablePtr->createProc = ArrayCreate; + }; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DeleteHashEntry -- + * + * Remove a single entry from a hash table. + * + * Results: + * None. + * + * Side effects: + * The entry given by entryPtr is deleted from its table and + * should never again be used by the caller. It is up to the + * caller to free the clientData field of the entry, if that + * is relevant. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DeleteHashEntry(entryPtr) + Tcl_HashEntry *entryPtr; +{ + register Tcl_HashEntry *prevPtr; + + if (*entryPtr->bucketPtr == entryPtr) { + *entryPtr->bucketPtr = entryPtr->nextPtr; + } else { + for (prevPtr = *entryPtr->bucketPtr; ; prevPtr = prevPtr->nextPtr) { + if (prevPtr == NULL) { + panic("malformed bucket chain in Tcl_DeleteHashEntry"); + } + if (prevPtr->nextPtr == entryPtr) { + prevPtr->nextPtr = entryPtr->nextPtr; + break; + } + } + } + entryPtr->tablePtr->numEntries--; + ckfree((char *) entryPtr); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DeleteHashTable -- + * + * Free up everything associated with a hash table except for + * the record for the table itself. + * + * Results: + * None. + * + * Side effects: + * The hash table is no longer useable. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DeleteHashTable(tablePtr) + register Tcl_HashTable *tablePtr; /* Table to delete. */ +{ + register Tcl_HashEntry *hPtr, *nextPtr; + int i; + + /* + * Free up all the entries in the table. + */ + + for (i = 0; i < tablePtr->numBuckets; i++) { + hPtr = tablePtr->buckets[i]; + while (hPtr != NULL) { + nextPtr = hPtr->nextPtr; + ckfree((char *) hPtr); + hPtr = nextPtr; + } + } + + /* + * Free up the bucket array, if it was dynamically allocated. + */ + + if (tablePtr->buckets != tablePtr->staticBuckets) { + ckfree((char *) tablePtr->buckets); + } + + /* + * Arrange for panics if the table is used again without + * re-initialization. + */ + + tablePtr->findProc = BogusFind; + tablePtr->createProc = BogusCreate; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_FirstHashEntry -- + * + * Locate the first entry in a hash table and set up a record + * that can be used to step through all the remaining entries + * of the table. + * + * Results: + * The return value is a pointer to the first entry in tablePtr, + * or NULL if tablePtr has no entries in it. The memory at + * *searchPtr is initialized so that subsequent calls to + * Tcl_NextHashEntry will return all of the entries in the table, + * one at a time. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_HashEntry * +Tcl_FirstHashEntry(tablePtr, searchPtr) + Tcl_HashTable *tablePtr; /* Table to search. */ + Tcl_HashSearch *searchPtr; /* Place to store information about + * progress through the table. */ +{ + searchPtr->tablePtr = tablePtr; + searchPtr->nextIndex = 0; + searchPtr->nextEntryPtr = NULL; + return Tcl_NextHashEntry(searchPtr); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_NextHashEntry -- + * + * Once a hash table enumeration has been initiated by calling + * Tcl_FirstHashEntry, this procedure may be called to return + * successive elements of the table. + * + * Results: + * The return value is the next entry in the hash table being + * enumerated, or NULL if the end of the table is reached. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_HashEntry * +Tcl_NextHashEntry(searchPtr) + register Tcl_HashSearch *searchPtr; /* Place to store information about + * progress through the table. Must + * have been initialized by calling + * Tcl_FirstHashEntry. */ +{ + Tcl_HashEntry *hPtr; + + while (searchPtr->nextEntryPtr == NULL) { + if (searchPtr->nextIndex >= searchPtr->tablePtr->numBuckets) { + return NULL; + } + searchPtr->nextEntryPtr = + searchPtr->tablePtr->buckets[searchPtr->nextIndex]; + searchPtr->nextIndex++; + } + hPtr = searchPtr->nextEntryPtr; + searchPtr->nextEntryPtr = hPtr->nextPtr; + return hPtr; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_HashStats -- + * + * Return statistics describing the layout of the hash table + * in its hash buckets. + * + * Results: + * The return value is a malloc-ed string containing information + * about tablePtr. It is the caller's responsibility to free + * this string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_HashStats(tablePtr) + Tcl_HashTable *tablePtr; /* Table for which to produce stats. */ +{ +#define NUM_COUNTERS 10 + int count[NUM_COUNTERS], overflow, i, j; + double average, tmp; + register Tcl_HashEntry *hPtr; + char *result, *p; + + /* + * Compute a histogram of bucket usage. + */ + + for (i = 0; i < NUM_COUNTERS; i++) { + count[i] = 0; + } + overflow = 0; + average = 0.0; + for (i = 0; i < tablePtr->numBuckets; i++) { + j = 0; + for (hPtr = tablePtr->buckets[i]; hPtr != NULL; hPtr = hPtr->nextPtr) { + j++; + } + if (j < NUM_COUNTERS) { + count[j]++; + } else { + overflow++; + } + tmp = j; + average += (tmp+1.0)*(tmp/tablePtr->numEntries)/2.0; + } + + /* + * Print out the histogram and a few other pieces of information. + */ + + result = (char *) ckalloc((unsigned) ((NUM_COUNTERS*60) + 300)); + sprintf(result, "%d entries in table, %d buckets\n", + tablePtr->numEntries, tablePtr->numBuckets); + p = result + strlen(result); + for (i = 0; i < NUM_COUNTERS; i++) { + sprintf(p, "number of buckets with %d entries: %d\n", + i, count[i]); + p += strlen(p); + } + sprintf(p, "number of buckets with %d or more entries: %d\n", + NUM_COUNTERS, overflow); + p += strlen(p); + sprintf(p, "average search distance for entry: %.1f", average); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * HashString -- + * + * Compute a one-word summary of a text string, which can be + * used to generate a hash index. + * + * Results: + * The return value is a one-word summary of the information in + * string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static unsigned int +HashString(string) + register char *string; /* String from which to compute hash value. */ +{ + register unsigned int result; + register int c; + + /* + * I tried a zillion different hash functions and asked many other + * people for advice. Many people had their own favorite functions, + * all different, but no-one had much idea why they were good ones. + * I chose the one below (multiply by 9 and add new character) + * because of the following reasons: + * + * 1. Multiplying by 10 is perfect for keys that are decimal strings, + * and multiplying by 9 is just about as good. + * 2. Times-9 is (shift-left-3) plus (old). This means that each + * character's bits hang around in the low-order bits of the + * hash value for ever, plus they spread fairly rapidly up to + * the high-order bits to fill out the hash value. This seems + * works well both for decimal and non-decimal strings. + */ + + result = 0; + while (1) { + c = *string; + string++; + if (c == 0) { + break; + } + result += (result<<3) + c; + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * StringFind -- + * + * Given a hash table with string keys, and a string key, find + * the entry with a matching key. + * + * Results: + * The return value is a token for the matching entry in the + * hash table, or NULL if there was no matching entry. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +StringFind(tablePtr, key) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + char *key; /* Key to use to find matching entry. */ +{ + register Tcl_HashEntry *hPtr; + register char *p1, *p2; + int index; + + index = HashString(key) & tablePtr->mask; + + /* + * Search all of the entries in the appropriate bucket. + */ + + for (hPtr = tablePtr->buckets[index]; hPtr != NULL; + hPtr = hPtr->nextPtr) { + for (p1 = key, p2 = hPtr->key.string; ; p1++, p2++) { + if (*p1 != *p2) { + break; + } + if (*p1 == '\0') { + return hPtr; + } + } + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * StringCreate -- + * + * Given a hash table with string keys, and a string key, find + * the entry with a matching key. If there is no matching entry, + * then create a new entry that does match. + * + * Results: + * The return value is a pointer to the matching entry. If this + * is a newly-created entry, then *newPtr will be set to a non-zero + * value; otherwise *newPtr will be set to 0. If this is a new + * entry the value stored in the entry will initially be 0. + * + * Side effects: + * A new entry may be added to the hash table. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +StringCreate(tablePtr, key, newPtr) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + char *key; /* Key to use to find or create matching + * entry. */ + int *newPtr; /* Store info here telling whether a new + * entry was created. */ +{ + register Tcl_HashEntry *hPtr; + register char *p1, *p2; + int index; + + index = HashString(key) & tablePtr->mask; + + /* + * Search all of the entries in this bucket. + */ + + for (hPtr = tablePtr->buckets[index]; hPtr != NULL; + hPtr = hPtr->nextPtr) { + for (p1 = key, p2 = hPtr->key.string; ; p1++, p2++) { + if (*p1 != *p2) { + break; + } + if (*p1 == '\0') { + *newPtr = 0; + return hPtr; + } + } + } + + /* + * Entry not found. Add a new one to the bucket. + */ + + *newPtr = 1; + hPtr = (Tcl_HashEntry *) ckalloc((unsigned) + (sizeof(Tcl_HashEntry) + strlen(key) - (sizeof(hPtr->key) -1))); + hPtr->tablePtr = tablePtr; + hPtr->bucketPtr = &(tablePtr->buckets[index]); + hPtr->nextPtr = *hPtr->bucketPtr; + hPtr->clientData = 0; + strcpy(hPtr->key.string, key); + *hPtr->bucketPtr = hPtr; + tablePtr->numEntries++; + + /* + * If the table has exceeded a decent size, rebuild it with many + * more buckets. + */ + + if (tablePtr->numEntries >= tablePtr->rebuildSize) { + RebuildTable(tablePtr); + } + return hPtr; +} + +/* + *---------------------------------------------------------------------- + * + * OneWordFind -- + * + * Given a hash table with one-word keys, and a one-word key, find + * the entry with a matching key. + * + * Results: + * The return value is a token for the matching entry in the + * hash table, or NULL if there was no matching entry. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +OneWordFind(tablePtr, key) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + register char *key; /* Key to use to find matching entry. */ +{ + register Tcl_HashEntry *hPtr; + int index; + + index = RANDOM_INDEX(tablePtr, key); + + /* + * Search all of the entries in the appropriate bucket. + */ + + for (hPtr = tablePtr->buckets[index]; hPtr != NULL; + hPtr = hPtr->nextPtr) { + if (hPtr->key.oneWordValue == key) { + return hPtr; + } + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * OneWordCreate -- + * + * Given a hash table with one-word keys, and a one-word key, find + * the entry with a matching key. If there is no matching entry, + * then create a new entry that does match. + * + * Results: + * The return value is a pointer to the matching entry. If this + * is a newly-created entry, then *newPtr will be set to a non-zero + * value; otherwise *newPtr will be set to 0. If this is a new + * entry the value stored in the entry will initially be 0. + * + * Side effects: + * A new entry may be added to the hash table. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +OneWordCreate(tablePtr, key, newPtr) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + register char *key; /* Key to use to find or create matching + * entry. */ + int *newPtr; /* Store info here telling whether a new + * entry was created. */ +{ + register Tcl_HashEntry *hPtr; + int index; + + index = RANDOM_INDEX(tablePtr, key); + + /* + * Search all of the entries in this bucket. + */ + + for (hPtr = tablePtr->buckets[index]; hPtr != NULL; + hPtr = hPtr->nextPtr) { + if (hPtr->key.oneWordValue == key) { + *newPtr = 0; + return hPtr; + } + } + + /* + * Entry not found. Add a new one to the bucket. + */ + + *newPtr = 1; + hPtr = (Tcl_HashEntry *) ckalloc(sizeof(Tcl_HashEntry)); + hPtr->tablePtr = tablePtr; + hPtr->bucketPtr = &(tablePtr->buckets[index]); + hPtr->nextPtr = *hPtr->bucketPtr; + hPtr->clientData = 0; + hPtr->key.oneWordValue = key; + *hPtr->bucketPtr = hPtr; + tablePtr->numEntries++; + + /* + * If the table has exceeded a decent size, rebuild it with many + * more buckets. + */ + + if (tablePtr->numEntries >= tablePtr->rebuildSize) { + RebuildTable(tablePtr); + } + return hPtr; +} + +/* + *---------------------------------------------------------------------- + * + * ArrayFind -- + * + * Given a hash table with array-of-int keys, and a key, find + * the entry with a matching key. + * + * Results: + * The return value is a token for the matching entry in the + * hash table, or NULL if there was no matching entry. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +ArrayFind(tablePtr, key) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + char *key; /* Key to use to find matching entry. */ +{ + register Tcl_HashEntry *hPtr; + int *arrayPtr = (int *) key; + register int *iPtr1, *iPtr2; + int index, count; + + for (index = 0, count = tablePtr->keyType, iPtr1 = arrayPtr; + count > 0; count--, iPtr1++) { + index += *iPtr1; + } + index = RANDOM_INDEX(tablePtr, index); + + /* + * Search all of the entries in the appropriate bucket. + */ + + for (hPtr = tablePtr->buckets[index]; hPtr != NULL; + hPtr = hPtr->nextPtr) { + for (iPtr1 = arrayPtr, iPtr2 = hPtr->key.words, + count = tablePtr->keyType; ; count--, iPtr1++, iPtr2++) { + if (count == 0) { + return hPtr; + } + if (*iPtr1 != *iPtr2) { + break; + } + } + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * ArrayCreate -- + * + * Given a hash table with one-word keys, and a one-word key, find + * the entry with a matching key. If there is no matching entry, + * then create a new entry that does match. + * + * Results: + * The return value is a pointer to the matching entry. If this + * is a newly-created entry, then *newPtr will be set to a non-zero + * value; otherwise *newPtr will be set to 0. If this is a new + * entry the value stored in the entry will initially be 0. + * + * Side effects: + * A new entry may be added to the hash table. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +ArrayCreate(tablePtr, key, newPtr) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + register char *key; /* Key to use to find or create matching + * entry. */ + int *newPtr; /* Store info here telling whether a new + * entry was created. */ +{ + register Tcl_HashEntry *hPtr; + int *arrayPtr = (int *) key; + register int *iPtr1, *iPtr2; + int index, count; + + for (index = 0, count = tablePtr->keyType, iPtr1 = arrayPtr; + count > 0; count--, iPtr1++) { + index += *iPtr1; + } + index = RANDOM_INDEX(tablePtr, index); + + /* + * Search all of the entries in the appropriate bucket. + */ + + for (hPtr = tablePtr->buckets[index]; hPtr != NULL; + hPtr = hPtr->nextPtr) { + for (iPtr1 = arrayPtr, iPtr2 = hPtr->key.words, + count = tablePtr->keyType; ; count--, iPtr1++, iPtr2++) { + if (count == 0) { + *newPtr = 0; + return hPtr; + } + if (*iPtr1 != *iPtr2) { + break; + } + } + } + + /* + * Entry not found. Add a new one to the bucket. + */ + + *newPtr = 1; + hPtr = (Tcl_HashEntry *) ckalloc((unsigned) (sizeof(Tcl_HashEntry) + + (tablePtr->keyType*sizeof(int)) - 4)); + hPtr->tablePtr = tablePtr; + hPtr->bucketPtr = &(tablePtr->buckets[index]); + hPtr->nextPtr = *hPtr->bucketPtr; + hPtr->clientData = 0; + for (iPtr1 = arrayPtr, iPtr2 = hPtr->key.words, count = tablePtr->keyType; + count > 0; count--, iPtr1++, iPtr2++) { + *iPtr2 = *iPtr1; + } + *hPtr->bucketPtr = hPtr; + tablePtr->numEntries++; + + /* + * If the table has exceeded a decent size, rebuild it with many + * more buckets. + */ + + if (tablePtr->numEntries >= tablePtr->rebuildSize) { + RebuildTable(tablePtr); + } + return hPtr; +} + +/* + *---------------------------------------------------------------------- + * + * BogusFind -- + * + * This procedure is invoked when an Tcl_FindHashEntry is called + * on a table that has been deleted. + * + * Results: + * If panic returns (which it shouldn't) this procedure returns + * NULL. + * + * Side effects: + * Generates a panic. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static Tcl_HashEntry * +BogusFind(tablePtr, key) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + char *key; /* Key to use to find matching entry. */ +{ + panic("called Tcl_FindHashEntry on deleted table"); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * BogusCreate -- + * + * This procedure is invoked when an Tcl_CreateHashEntry is called + * on a table that has been deleted. + * + * Results: + * If panic returns (which it shouldn't) this procedure returns + * NULL. + * + * Side effects: + * Generates a panic. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static Tcl_HashEntry * +BogusCreate(tablePtr, key, newPtr) + Tcl_HashTable *tablePtr; /* Table in which to lookup entry. */ + char *key; /* Key to use to find or create matching + * entry. */ + int *newPtr; /* Store info here telling whether a new + * entry was created. */ +{ + panic("called Tcl_CreateHashEntry on deleted table"); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * RebuildTable -- + * + * This procedure is invoked when the ratio of entries to hash + * buckets becomes too large. It creates a new table with a + * larger bucket array and moves all of the entries into the + * new table. + * + * Results: + * None. + * + * Side effects: + * Memory gets reallocated and entries get re-hashed to new + * buckets. + * + *---------------------------------------------------------------------- + */ + +static void +RebuildTable(tablePtr) + register Tcl_HashTable *tablePtr; /* Table to enlarge. */ +{ + int oldSize, count, index; + Tcl_HashEntry **oldBuckets; + register Tcl_HashEntry **oldChainPtr, **newChainPtr; + register Tcl_HashEntry *hPtr; + + oldSize = tablePtr->numBuckets; + oldBuckets = tablePtr->buckets; + + /* + * Allocate and initialize the new bucket array, and set up + * hashing constants for new array size. + */ + + tablePtr->numBuckets *= 4; + tablePtr->buckets = (Tcl_HashEntry **) ckalloc((unsigned) + (tablePtr->numBuckets * sizeof(Tcl_HashEntry *))); + for (count = tablePtr->numBuckets, newChainPtr = tablePtr->buckets; + count > 0; count--, newChainPtr++) { + *newChainPtr = NULL; + } + tablePtr->rebuildSize *= 4; + tablePtr->downShift -= 2; + tablePtr->mask = (tablePtr->mask << 2) + 3; + + /* + * Rehash all of the existing entries into the new bucket array. + */ + + for (oldChainPtr = oldBuckets; oldSize > 0; oldSize--, oldChainPtr++) { + for (hPtr = *oldChainPtr; hPtr != NULL; hPtr = *oldChainPtr) { + *oldChainPtr = hPtr->nextPtr; + if (tablePtr->keyType == TCL_STRING_KEYS) { + index = HashString(hPtr->key.string) & tablePtr->mask; + } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { + index = RANDOM_INDEX(tablePtr, hPtr->key.oneWordValue); + } else { + register int *iPtr; + int count; + + for (index = 0, count = tablePtr->keyType, + iPtr = hPtr->key.words; count > 0; count--, iPtr++) { + index += *iPtr; + } + index = RANDOM_INDEX(tablePtr, index); + } + hPtr->bucketPtr = &(tablePtr->buckets[index]); + hPtr->nextPtr = *hPtr->bucketPtr; + *hPtr->bucketPtr = hPtr; + } + } + + /* + * Free up the old bucket array, if it was dynamically allocated. + */ + + if (oldBuckets != tablePtr->staticBuckets) { + ckfree((char *) oldBuckets); + } +} diff --git a/vendor/x11iraf/obm/Tcl/tclHistory.c b/vendor/x11iraf/obm/Tcl/tclHistory.c new file mode 100644 index 00000000..5a4cadac --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclHistory.c @@ -0,0 +1,1109 @@ +/* + * tclHistory.c -- + * + * This module implements history as an optional addition to Tcl. + * It can be called to record commands ("events") before they are + * executed, and it provides a command that may be used to perform + * history substitutions. + * + * Copyright (c) 1990-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclHistory.c,v 1.30 93/10/13 13:05:38 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" + +/* + * This history stuff is mostly straightforward, except for one thing + * that makes everything very complicated. Suppose that the following + * commands get executed: + * echo foo + * history redo + * It's important that the history event recorded for the second command + * be "echo foo", not "history redo". Otherwise, if another "history redo" + * command is typed, it will result in infinite recursions on the + * "history redo" command. Thus, the actual recorded history must be + * echo foo + * echo foo + * To do this, the history command revises recorded history as part of + * its execution. In the example above, when "history redo" starts + * execution, the current event is "history redo", but the history + * command arranges for the current event to be changed to "echo foo". + * + * There are three additional complications. The first is that history + * substitution may only be part of a command, as in the following + * command sequence: + * echo foo bar + * echo [history word 3] + * In this case, the second event should be recorded as "echo bar". Only + * part of the recorded event is to be modified. Fortunately, Tcl_Eval + * helps with this by recording (in the evalFirst and evalLast fields of + * the intepreter) the location of the command being executed, so the + * history module can replace exactly the range of bytes corresponding + * to the history substitution command. + * + * The second complication is that there are two ways to revise history: + * replace a command, and replace the result of a command. Consider the + * two examples below: + * format {result is %d} $num | format {result is %d} $num + * print [history redo] | print [history word 3] + * Recorded history for these two cases should be as follows: + * format {result is %d} $num | format {result is %d} $num + * print [format {result is %d} $num] | print $num + * In the left case, the history command was replaced with another command + * to be executed (the brackets were retained), but in the case on the + * right the result of executing the history command was replaced (i.e. + * brackets were replaced too). + * + * The third complication is that there could potentially be many + * history substitutions within a single command, as in: + * echo [history word 3] [history word 2] + * There could even be nested history substitutions, as in: + * history subs abc [history word 2] + * If history revisions were made immediately during each "history" command + * invocations, it would be very difficult to produce the correct cumulative + * effect from several substitutions in the same command. To get around + * this problem, the actual history revision isn't made during the execution + * of the "history" command. Information about the changes is just recorded, + * in xxx records, and the actual changes are made during the next call to + * Tcl_RecordHistory (when we know that execution of the previous command + * has finished). + */ + +/* + * Default space allocation for command strings: + */ + +#define INITIAL_CMD_SIZE 40 + +/* + * Forward declarations for procedures defined later in this file: + */ + +static void DoRevs _ANSI_ARGS_((Interp *iPtr)); +static HistoryEvent * GetEvent _ANSI_ARGS_((Interp *iPtr, char *string)); +static char * GetWords _ANSI_ARGS_((Interp *iPtr, char *command, + char *words)); +static void InitHistory _ANSI_ARGS_((Interp *iPtr)); +static void InsertRev _ANSI_ARGS_((Interp *iPtr, + HistoryRev *revPtr)); +static void MakeSpace _ANSI_ARGS_((HistoryEvent *hPtr, int size)); +static void RevCommand _ANSI_ARGS_((Interp *iPtr, char *string)); +static void RevResult _ANSI_ARGS_((Interp *iPtr, char *string)); +static int SubsAndEval _ANSI_ARGS_((Interp *iPtr, char *cmd, + char *old, char *new)); + +/* + *---------------------------------------------------------------------- + * + * InitHistory -- + * + * Initialize history-related state in an interpreter. + * + * Results: + * None. + * + * Side effects: + * History info is initialized in iPtr. + * + *---------------------------------------------------------------------- + */ + +static void +InitHistory(iPtr) + register Interp *iPtr; /* Interpreter to initialize. */ +{ + int i; + + if (iPtr->numEvents != 0) { + return; + } + iPtr->numEvents = 20; + iPtr->events = (HistoryEvent *) + ckalloc((unsigned) (iPtr->numEvents * sizeof(HistoryEvent))); + for (i = 0; i < iPtr->numEvents; i++) { + iPtr->events[i].command = (char *) ckalloc(INITIAL_CMD_SIZE); + *iPtr->events[i].command = 0; + iPtr->events[i].bytesAvl = INITIAL_CMD_SIZE; + } + iPtr->curEvent = 0; + iPtr->curEventNum = 0; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_RecordAndEval -- + * + * This procedure adds its command argument to the current list of + * recorded events and then executes the command by calling Tcl_Eval. + * + * Results: + * The return value is a standard Tcl return value, the result of + * executing cmd. + * + * Side effects: + * The command is recorded and executed. In addition, pending history + * revisions are carried out, and information is set up to enable + * Tcl_Eval to identify history command ranges. This procedure also + * initializes history information for the interpreter, if it hasn't + * already been initialized. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_RecordAndEval(interp, cmd, flags) + Tcl_Interp *interp; /* Token for interpreter in which command + * will be executed. */ + char *cmd; /* Command to record. */ + int flags; /* Additional flags to pass to Tcl_Eval. + * TCL_NO_EVAL means only record: don't + * execute command. */ +{ + register Interp *iPtr = (Interp *) interp; + register HistoryEvent *eventPtr; + int length, result; + + if (iPtr->numEvents == 0) { + InitHistory(iPtr); + } + DoRevs(iPtr); + + /* + * Don't record empty commands. + */ + + while (isspace(UCHAR(*cmd))) { + cmd++; + } + if (*cmd == '\0') { + Tcl_ResetResult(interp); + return TCL_OK; + } + + iPtr->curEventNum++; + iPtr->curEvent++; + if (iPtr->curEvent >= iPtr->numEvents) { + iPtr->curEvent = 0; + } + eventPtr = &iPtr->events[iPtr->curEvent]; + + /* + * Chop off trailing newlines before recording the command. + */ + + length = strlen(cmd); + while (cmd[length-1] == '\n') { + length--; + } + MakeSpace(eventPtr, length + 1); + strncpy(eventPtr->command, cmd, length); + eventPtr->command[length] = 0; + + /* + * Execute the command. Note: history revision isn't possible after + * a nested call to this procedure, because the event at the top of + * the history list no longer corresponds to what's going on when + * a nested call here returns. Thus, must leave history revision + * disabled when we return. + */ + + result = TCL_OK; + if (flags != TCL_NO_EVAL) { + iPtr->historyFirst = cmd; + iPtr->revDisables = 0; + iPtr->evalFlags = flags | TCL_RECORD_BOUNDS; + result = Tcl_Eval(interp, cmd); + } + iPtr->revDisables = 1; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_HistoryCmd -- + * + * This procedure is invoked to process the "history" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_HistoryCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Interp *iPtr = (Interp *) interp; + register HistoryEvent *eventPtr; + int length; + char c; + + if (iPtr->numEvents == 0) { + InitHistory(iPtr); + } + + /* + * If no arguments, treat the same as "history info". + */ + + if (argc == 1) { + goto infoCmd; + } + + c = argv[1][0]; + length = strlen(argv[1]); + + if ((c == 'a') && (strncmp(argv[1], "add", length)) == 0) { + if ((argc != 3) && (argc != 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " add event ?exec?\"", (char *) NULL); + return TCL_ERROR; + } + if (argc == 4) { + if (strncmp(argv[3], "exec", strlen(argv[3])) != 0) { + Tcl_AppendResult(interp, "bad argument \"", argv[3], + "\": should be \"exec\"", (char *) NULL); + return TCL_ERROR; + } + return Tcl_RecordAndEval(interp, argv[2], 0); + } + return Tcl_RecordAndEval(interp, argv[2], TCL_NO_EVAL); + } else if ((c == 'c') && (strncmp(argv[1], "change", length)) == 0) { + if ((argc != 3) && (argc != 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " change newValue ?event?\"", (char *) NULL); + return TCL_ERROR; + } + if (argc == 3) { + eventPtr = &iPtr->events[iPtr->curEvent]; + iPtr->revDisables += 1; + while (iPtr->revPtr != NULL) { + HistoryRev *nextPtr; + + ckfree(iPtr->revPtr->newBytes); + nextPtr = iPtr->revPtr->nextPtr; + ckfree((char *) iPtr->revPtr); + iPtr->revPtr = nextPtr; + } + } else { + eventPtr = GetEvent(iPtr, argv[3]); + if (eventPtr == NULL) { + return TCL_ERROR; + } + } + MakeSpace(eventPtr, strlen(argv[2]) + 1); + strcpy(eventPtr->command, argv[2]); + return TCL_OK; + } else if ((c == 'e') && (strncmp(argv[1], "event", length)) == 0) { + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " event ?event?\"", (char *) NULL); + return TCL_ERROR; + } + eventPtr = GetEvent(iPtr, argc==2 ? "-1" : argv[2]); + if (eventPtr == NULL) { + return TCL_ERROR; + } + RevResult(iPtr, eventPtr->command); + Tcl_SetResult(interp, eventPtr->command, TCL_VOLATILE); + return TCL_OK; + } else if ((c == 'i') && (strncmp(argv[1], "info", length)) == 0) { + int count, indx, i; + char *newline; + + if ((argc != 2) && (argc != 3)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " info ?count?\"", (char *) NULL); + return TCL_ERROR; + } + infoCmd: + if (argc == 3) { + if (Tcl_GetInt(interp, argv[2], &count) != TCL_OK) { + return TCL_ERROR; + } + if (count > iPtr->numEvents) { + count = iPtr->numEvents; + } + } else { + count = iPtr->numEvents; + } + newline = ""; + for (i = 0, indx = iPtr->curEvent + 1 + iPtr->numEvents - count; + i < count; i++, indx++) { + char *cur, *next, savedChar; + char serial[20]; + + if (indx >= iPtr->numEvents) { + indx -= iPtr->numEvents; + } + cur = iPtr->events[indx].command; + if (*cur == '\0') { + continue; /* No command recorded here. */ + } + sprintf(serial, "%6d ", iPtr->curEventNum + 1 - (count - i)); + Tcl_AppendResult(interp, newline, serial, (char *) NULL); + newline = "\n"; + + /* + * Tricky formatting here: for multi-line commands, indent + * the continuation lines. + */ + + while (1) { + next = strchr(cur, '\n'); + if (next == NULL) { + break; + } + next++; + savedChar = *next; + *next = 0; + Tcl_AppendResult(interp, cur, "\t", (char *) NULL); + *next = savedChar; + cur = next; + } + Tcl_AppendResult(interp, cur, (char *) NULL); + } + return TCL_OK; + } else if ((c == 'k') && (strncmp(argv[1], "keep", length)) == 0) { + int count, i, src; + HistoryEvent *events; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " keep number\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[2], &count) != TCL_OK) { + return TCL_ERROR; + } + if ((count <= 0) || (count > 1000)) { + Tcl_AppendResult(interp, "illegal keep count \"", argv[2], + "\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Create a new history array and copy as much existing history + * as possible from the old array. + */ + + events = (HistoryEvent *) + ckalloc((unsigned) (count * sizeof(HistoryEvent))); + if (count < iPtr->numEvents) { + src = iPtr->curEvent + 1 - count; + if (src < 0) { + src += iPtr->numEvents; + } + } else { + src = iPtr->curEvent + 1; + } + for (i = 0; i < count; i++, src++) { + if (src >= iPtr->numEvents) { + src = 0; + } + if (i < iPtr->numEvents) { + events[i] = iPtr->events[src]; + iPtr->events[src].command = NULL; + } else { + events[i].command = (char *) ckalloc(INITIAL_CMD_SIZE); + events[i].command[0] = 0; + events[i].bytesAvl = INITIAL_CMD_SIZE; + } + } + + /* + * Throw away everything left in the old history array, and + * substitute the new one for the old one. + */ + + for (i = 0; i < iPtr->numEvents; i++) { + if (iPtr->events[i].command != NULL) { + ckfree(iPtr->events[i].command); + } + } + ckfree((char *) iPtr->events); + iPtr->events = events; + if (count < iPtr->numEvents) { + iPtr->curEvent = count-1; + } else { + iPtr->curEvent = iPtr->numEvents-1; + } + iPtr->numEvents = count; + return TCL_OK; + } else if ((c == 'n') && (strncmp(argv[1], "nextid", length)) == 0) { + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " nextid\"", (char *) NULL); + return TCL_ERROR; + } + sprintf(iPtr->result, "%d", iPtr->curEventNum+1); + return TCL_OK; + } else if ((c == 'r') && (strncmp(argv[1], "redo", length)) == 0) { + if (argc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " redo ?event?\"", (char *) NULL); + return TCL_ERROR; + } + eventPtr = GetEvent(iPtr, argc==2 ? "-1" : argv[2]); + if (eventPtr == NULL) { + return TCL_ERROR; + } + RevCommand(iPtr, eventPtr->command); + return Tcl_Eval(interp, eventPtr->command); + } else if ((c == 's') && (strncmp(argv[1], "substitute", length)) == 0) { + if ((argc > 5) || (argc < 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " substitute old new ?event?\"", (char *) NULL); + return TCL_ERROR; + } + eventPtr = GetEvent(iPtr, argc==4 ? "-1" : argv[4]); + if (eventPtr == NULL) { + return TCL_ERROR; + } + return SubsAndEval(iPtr, eventPtr->command, argv[2], argv[3]); + } else if ((c == 'w') && (strncmp(argv[1], "words", length)) == 0) { + char *words; + + if ((argc != 3) && (argc != 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " words num-num/pat ?event?\"", (char *) NULL); + return TCL_ERROR; + } + eventPtr = GetEvent(iPtr, argc==3 ? "-1" : argv[3]); + if (eventPtr == NULL) { + return TCL_ERROR; + } + words = GetWords(iPtr, eventPtr->command, argv[2]); + if (words == NULL) { + return TCL_ERROR; + } + RevResult(iPtr, words); + iPtr->result = words; + iPtr->freeProc = (Tcl_FreeProc *) free; + return TCL_OK; + } + + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": must be add, change, event, info, keep, nextid, ", + "redo, substitute, or words", (char *) NULL); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * MakeSpace -- + * + * Given a history event, make sure it has enough space for + * a string of a given length (enlarge the string area if + * necessary). + * + * Results: + * None. + * + * Side effects: + * More memory may get allocated. + * + *---------------------------------------------------------------------- + */ + +static void +MakeSpace(hPtr, size) + HistoryEvent *hPtr; + int size; /* # of bytes needed in hPtr. */ +{ + if (hPtr->bytesAvl < size) { + ckfree(hPtr->command); + hPtr->command = (char *) ckalloc((unsigned) size); + hPtr->bytesAvl = size; + } +} + +/* + *---------------------------------------------------------------------- + * + * InsertRev -- + * + * Add a new revision to the list of those pending for iPtr. + * Do it in a way that keeps the revision list sorted in + * increasing order of firstIndex. Also, eliminate revisions + * that are subsets of other revisions. + * + * Results: + * None. + * + * Side effects: + * RevPtr is added to iPtr's revision list. + * + *---------------------------------------------------------------------- + */ + +static void +InsertRev(iPtr, revPtr) + Interp *iPtr; /* Interpreter to use. */ + register HistoryRev *revPtr; /* Revision to add to iPtr's list. */ +{ + register HistoryRev *curPtr; + register HistoryRev *prevPtr; + + for (curPtr = iPtr->revPtr, prevPtr = NULL; curPtr != NULL; + prevPtr = curPtr, curPtr = curPtr->nextPtr) { + /* + * If this revision includes the new one (or vice versa) then + * just eliminate the one that is a subset of the other. + */ + + if ((revPtr->firstIndex <= curPtr->firstIndex) + && (revPtr->lastIndex >= curPtr->firstIndex)) { + curPtr->firstIndex = revPtr->firstIndex; + curPtr->lastIndex = revPtr->lastIndex; + curPtr->newSize = revPtr->newSize; + ckfree(curPtr->newBytes); + curPtr->newBytes = revPtr->newBytes; + ckfree((char *) revPtr); + return; + } + if ((revPtr->firstIndex >= curPtr->firstIndex) + && (revPtr->lastIndex <= curPtr->lastIndex)) { + ckfree(revPtr->newBytes); + ckfree((char *) revPtr); + return; + } + + if (revPtr->firstIndex < curPtr->firstIndex) { + break; + } + } + + /* + * Insert revPtr just after prevPtr. + */ + + if (prevPtr == NULL) { + revPtr->nextPtr = iPtr->revPtr; + iPtr->revPtr = revPtr; + } else { + revPtr->nextPtr = prevPtr->nextPtr; + prevPtr->nextPtr = revPtr; + } +} + +/* + *---------------------------------------------------------------------- + * + * RevCommand -- + * + * This procedure is invoked by the "history" command to record + * a command revision. See the comments at the beginning of the + * file for more information about revisions. + * + * Results: + * None. + * + * Side effects: + * Revision information is recorded. + * + *---------------------------------------------------------------------- + */ + +static void +RevCommand(iPtr, string) + register Interp *iPtr; /* Interpreter in which to perform the + * substitution. */ + char *string; /* String to substitute. */ +{ + register HistoryRev *revPtr; + + if ((iPtr->evalFirst == NULL) || (iPtr->revDisables > 0)) { + return; + } + revPtr = (HistoryRev *) ckalloc(sizeof(HistoryRev)); + revPtr->firstIndex = iPtr->evalFirst - iPtr->historyFirst; + revPtr->lastIndex = iPtr->evalLast - iPtr->historyFirst; + revPtr->newSize = strlen(string); + revPtr->newBytes = (char *) ckalloc((unsigned) (revPtr->newSize+1)); + strcpy(revPtr->newBytes, string); + InsertRev(iPtr, revPtr); +} + +/* + *---------------------------------------------------------------------- + * + * RevResult -- + * + * This procedure is invoked by the "history" command to record + * a result revision. See the comments at the beginning of the + * file for more information about revisions. + * + * Results: + * None. + * + * Side effects: + * Revision information is recorded. + * + *---------------------------------------------------------------------- + */ + +static void +RevResult(iPtr, string) + register Interp *iPtr; /* Interpreter in which to perform the + * substitution. */ + char *string; /* String to substitute. */ +{ + register HistoryRev *revPtr; + char *evalFirst, *evalLast; + char *argv[2]; + + if ((iPtr->evalFirst == NULL) || (iPtr->revDisables > 0)) { + return; + } + + /* + * Expand the replacement range to include the brackets that surround + * the command. If there aren't any brackets (i.e. this command was + * invoked at top-level) then don't do any revision. Also, if there + * are several commands in brackets, of which this is just one, + * then don't do any revision. + */ + + evalFirst = iPtr->evalFirst; + evalLast = iPtr->evalLast + 1; + while (1) { + if (evalFirst == iPtr->historyFirst) { + return; + } + evalFirst--; + if (*evalFirst == '[') { + break; + } + if (!isspace(UCHAR(*evalFirst))) { + return; + } + } + if (*evalLast != ']') { + return; + } + + revPtr = (HistoryRev *) ckalloc(sizeof(HistoryRev)); + revPtr->firstIndex = evalFirst - iPtr->historyFirst; + revPtr->lastIndex = evalLast - iPtr->historyFirst; + argv[0] = string; + revPtr->newBytes = Tcl_Merge(1, argv); + revPtr->newSize = strlen(revPtr->newBytes); + InsertRev(iPtr, revPtr); +} + +/* + *---------------------------------------------------------------------- + * + * DoRevs -- + * + * This procedure is called to apply the history revisions that + * have been recorded in iPtr. + * + * Results: + * None. + * + * Side effects: + * The most recent entry in the history for iPtr may be modified. + * + *---------------------------------------------------------------------- + */ + +static void +DoRevs(iPtr) + register Interp *iPtr; /* Interpreter whose history is to + * be modified. */ +{ + register HistoryRev *revPtr; + register HistoryEvent *eventPtr; + char *newCommand, *p; + unsigned int size; + int bytesSeen, count; + + if (iPtr->revPtr == NULL) { + return; + } + + /* + * The revision is done in two passes. The first pass computes the + * amount of space needed for the revised event, and the second pass + * pieces together the new event and frees up the revisions. + */ + + eventPtr = &iPtr->events[iPtr->curEvent]; + size = strlen(eventPtr->command) + 1; + for (revPtr = iPtr->revPtr; revPtr != NULL; revPtr = revPtr->nextPtr) { + size -= revPtr->lastIndex + 1 - revPtr->firstIndex; + size += revPtr->newSize; + } + + newCommand = (char *) ckalloc(size); + p = newCommand; + bytesSeen = 0; + for (revPtr = iPtr->revPtr; revPtr != NULL; ) { + HistoryRev *nextPtr = revPtr->nextPtr; + + count = revPtr->firstIndex - bytesSeen; + if (count > 0) { + strncpy(p, eventPtr->command + bytesSeen, count); + p += count; + } + strncpy(p, revPtr->newBytes, revPtr->newSize); + p += revPtr->newSize; + bytesSeen = revPtr->lastIndex+1; + ckfree(revPtr->newBytes); + ckfree((char *) revPtr); + revPtr = nextPtr; + } + if (&p[strlen(&eventPtr->command[bytesSeen]) + 1] > + &newCommand[size]) { + printf("Assertion failed!\n"); + } + strcpy(p, eventPtr->command + bytesSeen); + + /* + * Replace the command in the event. + */ + + ckfree(eventPtr->command); + eventPtr->command = newCommand; + eventPtr->bytesAvl = size; + iPtr->revPtr = NULL; +} + +/* + *---------------------------------------------------------------------- + * + * GetEvent -- + * + * Given a textual description of an event (see the manual page + * for legal values) find the corresponding event and return its + * command string. + * + * Results: + * The return value is a pointer to the event named by "string". + * If no such event exists, then NULL is returned and an error + * message is left in iPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static HistoryEvent * +GetEvent(iPtr, string) + register Interp *iPtr; /* Interpreter in which to look. */ + char *string; /* Description of event. */ +{ + int eventNum, index; + register HistoryEvent *eventPtr; + int length; + + /* + * First check for a numeric specification of an event. + */ + + if (isdigit(UCHAR(*string)) || (*string == '-')) { + if (Tcl_GetInt((Tcl_Interp *) iPtr, string, &eventNum) != TCL_OK) { + return NULL; + } + if (eventNum < 0) { + eventNum += iPtr->curEventNum; + } + if (eventNum > iPtr->curEventNum) { + Tcl_AppendResult((Tcl_Interp *) iPtr, "event \"", string, + "\" hasn't occurred yet", (char *) NULL); + return NULL; + } + if ((eventNum <= iPtr->curEventNum-iPtr->numEvents) + || (eventNum <= 0)) { + Tcl_AppendResult((Tcl_Interp *) iPtr, "event \"", string, + "\" is too far in the past", (char *) NULL); + return NULL; + } + index = iPtr->curEvent + (eventNum - iPtr->curEventNum); + if (index < 0) { + index += iPtr->numEvents; + } + return &iPtr->events[index]; + } + + /* + * Next, check for an event that contains the string as a prefix or + * that matches the string in the sense of Tcl_StringMatch. + */ + + length = strlen(string); + for (index = iPtr->curEvent - 1; ; index--) { + if (index < 0) { + index += iPtr->numEvents; + } + if (index == iPtr->curEvent) { + break; + } + eventPtr = &iPtr->events[index]; + if ((strncmp(eventPtr->command, string, length) == 0) + || Tcl_StringMatch(eventPtr->command, string)) { + return eventPtr; + } + } + + Tcl_AppendResult((Tcl_Interp *) iPtr, "no event matches \"", string, + "\"", (char *) NULL); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * SubsAndEval -- + * + * Generate a new command by making a textual substitution in + * the "cmd" argument. Then execute the new command. + * + * Results: + * The return value is a standard Tcl error. + * + * Side effects: + * History gets revised if the substitution is occurring on + * a recorded command line. Also, the re-executed command + * may produce side-effects. + * + *---------------------------------------------------------------------- + */ + +static int +SubsAndEval(iPtr, cmd, old, new) + register Interp *iPtr; /* Interpreter in which to execute + * new command. */ + char *cmd; /* Command in which to substitute. */ + char *old; /* String to search for in command. */ + char *new; /* Replacement string for "old". */ +{ + char *src, *dst, *newCmd; + int count, oldLength, newLength, length, result; + + /* + * Figure out how much space it will take to hold the + * substituted command (and complain if the old string + * doesn't appear in the original command). + */ + + oldLength = strlen(old); + newLength = strlen(new); + src = cmd; + count = 0; + while (1) { + src = strstr(src, old); + if (src == NULL) { + break; + } + src += oldLength; + count++; + } + if (count == 0) { + Tcl_AppendResult((Tcl_Interp *) iPtr, "\"", old, + "\" doesn't appear in event", (char *) NULL); + return TCL_ERROR; + } + length = strlen(cmd) + count*(newLength - oldLength); + + /* + * Generate a substituted command. + */ + + newCmd = (char *) ckalloc((unsigned) (length + 1)); + dst = newCmd; + while (1) { + src = strstr(cmd, old); + if (src == NULL) { + strcpy(dst, cmd); + break; + } + strncpy(dst, cmd, src-cmd); + dst += src-cmd; + strcpy(dst, new); + dst += newLength; + cmd = src + oldLength; + } + + RevCommand(iPtr, newCmd); + result = Tcl_Eval((Tcl_Interp *) iPtr, newCmd); + ckfree(newCmd); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * GetWords -- + * + * Given a command string, return one or more words from the + * command string. + * + * Results: + * The return value is a pointer to a dynamically-allocated + * string containing the words of command specified by "words". + * If the word specifier has improper syntax then an error + * message is placed in iPtr->result and NULL is returned. + * + * Side effects: + * Memory is allocated. It is the caller's responsibilty to + * free the returned string.. + * + *---------------------------------------------------------------------- + */ + +static char * +GetWords(iPtr, command, words) + register Interp *iPtr; /* Tcl interpreter in which to place + * an error message if needed. */ + char *command; /* Command string. */ + char *words; /* Description of which words to extract + * from the command. Either num[-num] or + * a pattern. */ +{ + char *result; + char *start, *end, *dst; + register char *next; + int first; /* First word desired. -1 means last word + * only. */ + int last; /* Last word desired. -1 means use everything + * up to the end. */ + int index; /* Index of current word. */ + char *pattern; + + /* + * Figure out whether we're looking for a numerical range or for + * a pattern. + */ + + pattern = NULL; + first = 0; + last = -1; + if (*words == '$') { + if (words[1] != '\0') { + goto error; + } + first = -1; + } else if (isdigit(UCHAR(*words))) { + first = strtoul(words, &start, 0); + if (*start == 0) { + last = first; + } else if (*start == '-') { + start++; + if (*start == '$') { + start++; + } else if (isdigit(UCHAR(*start))) { + last = strtoul(start, &start, 0); + } else { + goto error; + } + if (*start != 0) { + goto error; + } + } + if ((first > last) && (last != -1)) { + goto error; + } + } else { + pattern = words; + } + + /* + * Scan through the words one at a time, copying those that are + * relevant into the result string. Allocate a result area large + * enough to hold all the words if necessary. + */ + + result = (char *) ckalloc((unsigned) (strlen(command) + 1)); + dst = result; + for (next = command; isspace(UCHAR(*next)); next++) { + /* Empty loop body: just find start of first word. */ + } + for (index = 0; *next != 0; index++) { + start = next; + end = TclWordEnd(next, 0, (int *) NULL); + if (*end != 0) { + end++; + for (next = end; isspace(UCHAR(*next)); next++) { + /* Empty loop body: just find start of next word. */ + } + } + if ((first > index) || ((first == -1) && (*next != 0))) { + continue; + } + if ((last != -1) && (last < index)) { + continue; + } + if (pattern != NULL) { + int match; + char savedChar = *end; + + *end = 0; + match = Tcl_StringMatch(start, pattern); + *end = savedChar; + if (!match) { + continue; + } + } + if (dst != result) { + *dst = ' '; + dst++; + } + strncpy(dst, start, (end-start)); + dst += end-start; + } + *dst = 0; + + /* + * Check for an out-of-range argument index. + */ + + if ((last >= index) || (first >= index)) { + ckfree(result); + Tcl_AppendResult((Tcl_Interp *) iPtr, "word selector \"", words, + "\" specified non-existent words", (char *) NULL); + return NULL; + } + return result; + + error: + Tcl_AppendResult((Tcl_Interp *) iPtr, "bad word selector \"", words, + "\": should be num-num or pattern", (char *) NULL); + return NULL; +} diff --git a/vendor/x11iraf/obm/Tcl/tclInt.h b/vendor/x11iraf/obm/Tcl/tclInt.h new file mode 100644 index 00000000..1f59a065 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclInt.h @@ -0,0 +1,947 @@ +/* + * tclInt.h -- + * + * Declarations of things used internally by the Tcl interpreter. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/RCS/tclInt.h,v 1.94 93/10/15 16:36:51 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _TCLINT +#define _TCLINT + +/* + * Common include files needed by most of the Tcl source files are + * included here, so that system-dependent personalizations for the + * include files only have to be made in once place. This results + * in a few extra includes, but greater modularity. The order of + * the three groups of #includes is important. For example, stdio.h + * is needed by tcl.h, and the _ANSI_ARGS_ declaration in tcl.h is + * needed by stdlib.h in some configurations. + */ + +#include <stdio.h> + +#ifndef _TCL +#include "tcl.h" +#endif +#ifndef _REGEXP +#include "tclRegexp.h" +#endif + +#include <ctype.h> +#ifdef NO_LIMITS_H +# include "compat/limits.h" +#else +# include <limits.h> +#endif +#ifdef NO_STDLIB_H +# include "compat/stdlib.h" +#else +# include <stdlib.h> +#endif +#ifdef NO_STRING_H +#include "compat/string.h" +#else +#include <string.h> +#endif + +/* +*/ +#if defined(__DARWIN__) || defined(USE_STDARG) +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +/* Workaround for our old varargs handling on LinuxPPC systems. +#if defined(linux) && defined(__powerpc__) +#undef va_start +#undef va_alist +#undef va_dcl + +#define va_start(AP) __va_start_common (AP, 1) +#define va_alist __va_1st_arg +#define va_dcl register int va_alist; ... +#endif +*/ + + +/* + * At present (12/91) not all stdlib.h implementations declare strtod. + * The declaration below is here to ensure that it's declared, so that + * the compiler won't take the default approach of assuming it returns + * an int. There's no ANSI prototype for it because there would end + * up being too many conflicts with slightly-different prototypes. + */ + +extern double strtod(); + +/* + *---------------------------------------------------------------- + * Data structures related to variables. These are used primarily + * in tclVar.c + *---------------------------------------------------------------- + */ + +/* + * The following structure defines a variable trace, which is used to + * invoke a specific C procedure whenever certain operations are performed + * on a variable. + */ + +typedef struct VarTrace { + Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given + * by flags are performed on variable. */ + ClientData clientData; /* Argument to pass to proc. */ + int flags; /* What events the trace procedure is + * interested in: OR-ed combination of + * TCL_TRACE_READS, TCL_TRACE_WRITES, and + * TCL_TRACE_UNSETS. */ + struct VarTrace *nextPtr; /* Next in list of traces associated with + * a particular variable. */ +} VarTrace; + +/* + * When a variable trace is active (i.e. its associated procedure is + * executing), one of the following structures is linked into a list + * associated with the variable's interpreter. The information in + * the structure is needed in order for Tcl to behave reasonably + * if traces are deleted while traces are active. + */ + +typedef struct ActiveVarTrace { + struct Var *varPtr; /* Variable that's being traced. */ + struct ActiveVarTrace *nextPtr; + /* Next in list of all active variable + * traces for the interpreter, or NULL + * if no more. */ + VarTrace *nextTracePtr; /* Next trace to check after current + * trace procedure returns; if this + * trace gets deleted, must update pointer + * to avoid using free'd memory. */ +} ActiveVarTrace; + +/* + * The following structure describes an enumerative search in progress on + * an array variable; this are invoked with options to the "array" + * command. + */ + +typedef struct ArraySearch { + int id; /* Integer id used to distinguish among + * multiple concurrent searches for the + * same array. */ + struct Var *varPtr; /* Pointer to array variable that's being + * searched. */ + Tcl_HashSearch search; /* Info kept by the hash module about + * progress through the array. */ + Tcl_HashEntry *nextEntry; /* Non-null means this is the next element + * to be enumerated (it's leftover from + * the Tcl_FirstHashEntry call or from + * an "array anymore" command). NULL + * means must call Tcl_NextHashEntry + * to get value to return. */ + struct ArraySearch *nextPtr;/* Next in list of all active searches + * for this variable, or NULL if this is + * the last one. */ +} ArraySearch; + +/* + * The structure below defines a variable, which associates a string name + * with a string value. Pointers to these structures are kept as the + * values of hash table entries, and the name of each variable is stored + * in the hash entry. + */ + +typedef struct Var { + int valueLength; /* Holds the number of non-null bytes + * actually occupied by the variable's + * current value in value.string (extra + * space is sometimes left for expansion). + * For array and global variables this is + * meaningless. */ + int valueSpace; /* Total number of bytes of space allocated + * at value.string. 0 means there is no + * space allocated. */ + union { + char *string; /* String value of variable, used for scalar + * variables and array elements. Malloc-ed. */ + Tcl_HashTable *tablePtr;/* For array variables, this points to + * information about the hash table used + * to implement the associative array. + * Points to malloc-ed data. */ + struct Var *upvarPtr; /* If this is a global variable being + * referred to in a procedure, or a variable + * created by "upvar", this field points to + * the record for the higher-level variable. */ + } value; + Tcl_HashEntry *hPtr; /* Hash table entry that refers to this + * variable, or NULL if the variable has + * been detached from its hash table (e.g. + * an array is deleted, but some of its + * elements are still referred to in upvars). */ + int refCount; /* Counts number of active uses of this + * variable, not including its main hash + * table entry: 1 for each additional variable + * whose upVarPtr points here, 1 for each + * nested trace active on variable. This + * record can't be deleted until refCount + * becomes 0. */ + VarTrace *tracePtr; /* First in list of all traces set for this + * variable. */ + ArraySearch *searchPtr; /* First in list of all searches active + * for this variable, or NULL if none. */ + int flags; /* Miscellaneous bits of information about + * variable. See below for definitions. */ +} Var; + +/* + * Flag bits for variables: + * + * VAR_ARRAY - 1 means this is an array variable rather + * than a scalar variable. + * VAR_UPVAR - 1 means this variable just contains a + * pointer to another variable that has the + * real value. Variables like this come + * about through the "upvar" and "global" + * commands. + * VAR_UNDEFINED - 1 means that the variable is currently + * undefined. Undefined variables usually + * go away completely, but if an undefined + * variable has a trace on it, or if it is + * a global variable being used by a procedure, + * then it stays around even when undefined. + * VAR_TRACE_ACTIVE - 1 means that trace processing is currently + * underway for a read or write access, so + * new read or write accesses should not cause + * trace procedures to be called and the + * variable can't be deleted. + */ + +#define VAR_ARRAY 1 +#define VAR_UPVAR 2 +#define VAR_UNDEFINED 4 +#define VAR_TRACE_ACTIVE 0x10 + +/* + *---------------------------------------------------------------- + * Data structures related to procedures. These are used primarily + * in tclProc.c + *---------------------------------------------------------------- + */ + +/* + * The structure below defines an argument to a procedure, which + * consists of a name and an (optional) default value. + */ + +typedef struct Arg { + struct Arg *nextPtr; /* Next argument for this procedure, + * or NULL if this is the last argument. */ + char *defValue; /* Pointer to arg's default value, or NULL + * if no default value. */ + char name[4]; /* Name of argument starts here. The name + * is followed by space for the default, + * if there is one. The actual size of this + * field will be as large as necessary to + * hold both name and default value. THIS + * MUST BE THE LAST FIELD IN THE STRUCTURE!! */ +} Arg; + +/* + * The structure below defines a command procedure, which consists of + * a collection of Tcl commands plus information about arguments and + * variables. + */ + +typedef struct Proc { + struct Interp *iPtr; /* Interpreter for which this command + * is defined. */ + int refCount; /* Reference count: 1 if still present + * in command table plus 1 for each call + * to the procedure that is currently + * active. This structure can be freed + * when refCount becomes zero. */ + char *command; /* Command that constitutes the body of + * the procedure (dynamically allocated). */ + Arg *argPtr; /* Pointer to first of procedure's formal + * arguments, or NULL if none. */ +} Proc; + +/* + * The structure below defines a command trace. This is used to allow Tcl + * clients to find out whenever a command is about to be executed. + */ + +typedef struct Trace { + int level; /* Only trace commands at nesting level + * less than or equal to this. */ + Tcl_CmdTraceProc *proc; /* Procedure to call to trace command. */ + ClientData clientData; /* Arbitrary value to pass to proc. */ + struct Trace *nextPtr; /* Next in list of traces for this interp. */ +} Trace; + +/* + * The stucture below defines a deletion callback, which is + * a procedure to invoke just before an interpreter is deleted. + */ + +typedef struct DeleteCallback { + Tcl_InterpDeleteProc *proc; /* Procedure to call. */ + ClientData clientData; /* Value to pass to procedure. */ + struct DeleteCallback *nextPtr; + /* Next in list of callbacks for this + * interpreter (or NULL for end of list). */ +} DeleteCallback; + +/* + * The structure below defines a frame, which is a procedure invocation. + * These structures exist only while procedures are being executed, and + * provide a sort of call stack. + */ + +typedef struct CallFrame { + Tcl_HashTable varTable; /* Hash table containing all of procedure's + * local variables. */ + int level; /* Level of this procedure, for "uplevel" + * purposes (i.e. corresponds to nesting of + * callerVarPtr's, not callerPtr's). 1 means + * outer-most procedure, 0 means top-level. */ + int argc; /* This and argv below describe name and + * arguments for this procedure invocation. */ + char **argv; /* Array of arguments. */ + struct CallFrame *callerPtr; + /* Value of interp->framePtr when this + * procedure was invoked (i.e. next in + * stack of all active procedures). */ + struct CallFrame *callerVarPtr; + /* Value of interp->varFramePtr when this + * procedure was invoked (i.e. determines + * variable scoping within caller; same + * as callerPtr unless an "uplevel" command + * or something equivalent was active in + * the caller). */ +} CallFrame; + +/* + * The structure below defines one history event (a previously-executed + * command that can be re-executed in whole or in part). + */ + +typedef struct { + char *command; /* String containing previously-executed + * command. */ + int bytesAvl; /* Total # of bytes available at *event (not + * all are necessarily in use now). */ +} HistoryEvent; + +/* + *---------------------------------------------------------------- + * Data structures related to history. These are used primarily + * in tclHistory.c + *---------------------------------------------------------------- + */ + +/* + * The structure below defines a pending revision to the most recent + * history event. Changes are linked together into a list and applied + * during the next call to Tcl_RecordHistory. See the comments at the + * beginning of tclHistory.c for information on revisions. + */ + +typedef struct HistoryRev { + int firstIndex; /* Index of the first byte to replace in + * current history event. */ + int lastIndex; /* Index of last byte to replace in + * current history event. */ + int newSize; /* Number of bytes in newBytes. */ + char *newBytes; /* Replacement for the range given by + * firstIndex and lastIndex. */ + struct HistoryRev *nextPtr; /* Next in chain of revisions to apply, or + * NULL for end of list. */ +} HistoryRev; + +/* + *---------------------------------------------------------------- + * Data structures related to files. These are used primarily in + * tclUnixUtil.c and tclUnixAZ.c. + *---------------------------------------------------------------- + */ + +/* + * The data structure below defines an open file (or connection to + * a process pipeline) as returned by the "open" command. + */ + +typedef struct OpenFile { + FILE *f; /* Stdio file to use for reading and/or + * writing. */ + FILE *f2; /* Normally NULL. In the special case of + * a command pipeline with pipes for both + * input and output, this is a stdio file + * to use for writing to the pipeline. */ + int permissions; /* OR-ed combination of TCL_FILE_READABLE + * and TCL_FILE_WRITABLE. */ + int numPids; /* If this is a connection to a process + * pipeline, gives number of processes + * in pidPtr array below; otherwise it + * is 0. */ + int *pidPtr; /* Pointer to malloc-ed array of child + * process ids (numPids of them), or NULL + * if this isn't a connection to a process + * pipeline. */ + int errorId; /* File id of file that receives error + * output from pipeline. -1 means not + * used (i.e. this is a normal file). */ +} OpenFile; + +/* + *---------------------------------------------------------------- + * Data structures related to expressions. These are used only in + * tclExpr.c. + *---------------------------------------------------------------- + */ + +/* + * The data structure below defines a math function (e.g. sin or hypot) + * for use in Tcl expressions. + */ + +#define MAX_MATH_ARGS 5 +typedef struct MathFunc { + int numArgs; /* Number of arguments for function. */ + Tcl_ValueType argTypes[MAX_MATH_ARGS]; + /* Acceptable types for each argument. */ + Tcl_MathProc *proc; /* Procedure that implements this function. */ + ClientData clientData; /* Additional argument to pass to the function + * when invoking it. */ +} MathFunc; + +/* + *---------------------------------------------------------------- + * This structure defines an interpreter, which is a collection of + * commands plus other state information related to interpreting + * commands, such as variable storage. Primary responsibility for + * this data structure is in tclBasic.c, but almost every Tcl + * source file uses something in here. + *---------------------------------------------------------------- + */ + +typedef struct Command { + Tcl_CmdProc *proc; /* Procedure to process command. */ + ClientData clientData; /* Arbitrary value to pass to proc. */ + Tcl_CmdDeleteProc *deleteProc; + /* Procedure to invoke when deleting + * command. */ + ClientData deleteData; /* Arbitrary value to pass to deleteProc + * (usually the same as clientData). */ +} Command; + +#define CMD_SIZE(nameLength) ((unsigned) sizeof(Command) + nameLength - 3) + +typedef struct Interp { + + /* + * Note: the first three fields must match exactly the fields in + * a Tcl_Interp struct (see tcl.h). If you change one, be sure to + * change the other. + */ + + char *result; /* Points to result returned by last + * command. */ + Tcl_FreeProc *freeProc; /* Zero means result is statically allocated. + * If non-zero, gives address of procedure + * to invoke to free the result. Must be + * freed by Tcl_Eval before executing next + * command. */ + int errorLine; /* When TCL_ERROR is returned, this gives + * the line number within the command where + * the error occurred (1 means first line). */ + Tcl_HashTable commandTable; /* Contains all of the commands currently + * registered in this interpreter. Indexed + * by strings; values have type (Command *). */ + Tcl_HashTable mathFuncTable;/* Contains all of the math functions currently + * defined for the interpreter. Indexed by + * strings (function names); values have + * type (MathFunc *). */ + + /* + * Information related to procedures and variables. See tclProc.c + * and tclvar.c for usage. + */ + + Tcl_HashTable globalTable; /* Contains all global variables for + * interpreter. */ + int numLevels; /* Keeps track of how many nested calls to + * Tcl_Eval are in progress for this + * interpreter. It's used to delay deletion + * of the table until all Tcl_Eval invocations + * are completed. */ + int maxNestingDepth; /* If numLevels exceeds this value then Tcl + * assumes that infinite recursion has + * occurred and it generates an error. */ + CallFrame *framePtr; /* Points to top-most in stack of all nested + * procedure invocations. NULL means there + * are no active procedures. */ + CallFrame *varFramePtr; /* Points to the call frame whose variables + * are currently in use (same as framePtr + * unless an "uplevel" command is being + * executed). NULL means no procedure is + * active or "uplevel 0" is being exec'ed. */ + ActiveVarTrace *activeTracePtr; + /* First in list of active traces for interp, + * or NULL if no active traces. */ + int returnCode; /* Completion code to return if current + * procedure exits with a TCL_RETURN code. */ + char *errorInfo; /* Value to store in errorInfo if returnCode + * is TCL_ERROR. Malloc'ed, may be NULL */ + char *errorCode; /* Value to store in errorCode if returnCode + * is TCL_ERROR. Malloc'ed, may be NULL */ + + /* + * Information related to history: + */ + + int numEvents; /* Number of previously-executed commands + * to retain. */ + HistoryEvent *events; /* Array containing numEvents entries + * (dynamically allocated). */ + int curEvent; /* Index into events of place where current + * (or most recent) command is recorded. */ + int curEventNum; /* Event number associated with the slot + * given by curEvent. */ + HistoryRev *revPtr; /* First in list of pending revisions. */ + char *historyFirst; /* First char. of current command executed + * from history module or NULL if none. */ + int revDisables; /* 0 means history revision OK; > 0 gives + * a count of number of times revision has + * been disabled. */ + char *evalFirst; /* If TCL_RECORD_BOUNDS flag set, Tcl_Eval + * sets this field to point to the first + * char. of text from which the current + * command came. Otherwise Tcl_Eval sets + * this to NULL. */ + char *evalLast; /* Similar to evalFirst, except points to + * last character of current command. */ + + /* + * Information used by Tcl_AppendResult to keep track of partial + * results. See Tcl_AppendResult code for details. + */ + + char *appendResult; /* Storage space for results generated + * by Tcl_AppendResult. Malloc-ed. NULL + * means not yet allocated. */ + int appendAvl; /* Total amount of space available at + * partialResult. */ + int appendUsed; /* Number of non-null bytes currently + * stored at partialResult. */ + + /* + * A cache of compiled regular expressions. See TclCompileRegexp + * in tclUtil.c for details. + */ + +#define NUM_REGEXPS 5 + char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled + * regular expression patterns. NULL + * means that this slot isn't used. + * Malloc-ed. */ + int patLengths[NUM_REGEXPS];/* Number of non-null characters in + * corresponding entry in patterns. + * -1 means entry isn't used. */ + regexp *regexps[NUM_REGEXPS]; + /* Compiled forms of above strings. Also + * malloc-ed, or NULL if not in use yet. */ + + /* + * Information used by Tcl_PrintDouble: + */ + + char pdFormat[10]; /* Format string used by Tcl_PrintDouble. */ + int pdPrec; /* Current precision (used to restore the + * the tcl_precision variable after a bogus + * value has been put into it). */ + + /* + * Miscellaneous information: + */ + + int cmdCount; /* Total number of times a command procedure + * has been called for this interpreter. */ + int noEval; /* Non-zero means no commands should actually + * be executed: just parse only. Used in + * expressions when the result is already + * determined. */ + int evalFlags; /* Flags to control next call to Tcl_Eval. + * Normally zero, but may be set before + * calling Tcl_Eval to an OR'ed combination + * of TCL_BRACKET_TERM and TCL_RECORD_BOUNDS. */ + char *termPtr; /* Character just after the last one in + * a command. Set by Tcl_Eval before + * returning. */ + char *scriptFile; /* NULL means there is no nested source + * command active; otherwise this points to + * the name of the file being sourced (it's + * not malloc-ed: it points to an argument + * to Tcl_EvalFile. */ + int flags; /* Various flag bits. See below. */ + Trace *tracePtr; /* List of traces for this interpreter. */ + DeleteCallback *deleteCallbackPtr; + /* First in list of callbacks to invoke when + * interpreter is deleted. */ + char resultSpace[TCL_RESULT_SIZE+1]; + /* Static space for storing small results. */ +} Interp; + +/* + * Flag bits for Interp structures: + * + * DELETED: Non-zero means the interpreter has been deleted: + * don't process any more commands for it, and destroy + * the structure as soon as all nested invocations of + * Tcl_Eval are done. + * ERR_IN_PROGRESS: Non-zero means an error unwind is already in progress. + * Zero means a command proc has been invoked since last + * error occured. + * ERR_ALREADY_LOGGED: Non-zero means information has already been logged + * in $errorInfo for the current Tcl_Eval instance, + * so Tcl_Eval needn't log it (used to implement the + * "error message log" command). + * ERROR_CODE_SET: Non-zero means that Tcl_SetErrorCode has been + * called to record information for the current + * error. Zero means Tcl_Eval must clear the + * errorCode variable if an error is returned. + * EXPR_INITIALIZED: 1 means initialization specific to expressions has + * been carried out. + */ + +#define DELETED 1 +#define ERR_IN_PROGRESS 2 +#define ERR_ALREADY_LOGGED 4 +#define ERROR_CODE_SET 8 +#define EXPR_INITIALIZED 0x10 + +/* + * Default value for the pdPrec and pdFormat fields of interpreters: + */ + +#define DEFAULT_PD_PREC 6 +#define DEFAULT_PD_FORMAT "%g" + +/* + *---------------------------------------------------------------- + * Data structures related to command parsing. These are used in + * tclParse.c and its clients. + *---------------------------------------------------------------- + */ + +/* + * The following data structure is used by various parsing procedures + * to hold information about where to store the results of parsing + * (e.g. the substituted contents of a quoted argument, or the result + * of a nested command). At any given time, the space available + * for output is fixed, but a procedure may be called to expand the + * space available if the current space runs out. + */ + +typedef struct ParseValue { + char *buffer; /* Address of first character in + * output buffer. */ + char *next; /* Place to store next character in + * output buffer. */ + char *end; /* Address of the last usable character + * in the buffer. */ + void (*expandProc) _ANSI_ARGS_((struct ParseValue *pvPtr, int needed)); + /* Procedure to call when space runs out; + * it will make more space. */ + ClientData clientData; /* Arbitrary information for use of + * expandProc. */ +} ParseValue; + +/* + * A table used to classify input characters to assist in parsing + * Tcl commands. The table should be indexed with a signed character + * using the CHAR_TYPE macro. The character may have a negative + * value. + */ + +extern char tclTypeTable[]; +#define CHAR_TYPE(c) (tclTypeTable+128)[c] + +/* + * Possible values returned by CHAR_TYPE: + * + * TCL_NORMAL - All characters that don't have special significance + * to the Tcl language. + * TCL_SPACE - Character is space, tab, or return. + * TCL_COMMAND_END - Character is newline or null or semicolon or + * close-bracket. + * TCL_QUOTE - Character is a double-quote. + * TCL_OPEN_BRACKET - Character is a "[". + * TCL_OPEN_BRACE - Character is a "{". + * TCL_CLOSE_BRACE - Character is a "}". + * TCL_BACKSLASH - Character is a "\". + * TCL_DOLLAR - Character is a "$". + */ + +#define TCL_NORMAL 0 +#define TCL_SPACE 1 +#define TCL_COMMAND_END 2 +#define TCL_QUOTE 3 +#define TCL_OPEN_BRACKET 4 +#define TCL_OPEN_BRACE 5 +#define TCL_CLOSE_BRACE 6 +#define TCL_BACKSLASH 7 +#define TCL_DOLLAR 8 + +/* + * Additional flags passed to Tcl_Eval. See tcl.h for other flags to + * Tcl_Eval; these ones are only used internally by Tcl. + * + * TCL_RECORD_BOUNDS Tells Tcl_Eval to record information in the + * evalFirst and evalLast fields for each command + * executed directly from the string (top-level + * commands and those from command substitution). + */ + +#define TCL_RECORD_BOUNDS 0x100 + +/* + * Maximum number of levels of nesting permitted in Tcl commands (used + * to catch infinite recursion). + */ + +#define MAX_NESTING_DEPTH 1000 + +/* + * The macro below is used to modify a "char" value (e.g. by casting + * it to an unsigned character) so that it can be used safely with + * macros such as isspace. + */ + +#define UCHAR(c) ((unsigned char) (c)) + +/* + * Given a size or address, the macro below "aligns" it to the machine's + * memory unit size (e.g. an 8-byte boundary) so that anything can be + * placed at the aligned address without fear of an alignment error. + */ + +#define TCL_ALIGN(x) ((x + 7) & ~7) + +/* + * Variables shared among Tcl modules but not used by the outside + * world: + */ + +extern int tclNumFiles; +extern OpenFile ** tclOpenFiles; +extern char * tclRegexpError; + +/* + *---------------------------------------------------------------- + * Procedures shared among Tcl modules but not used by the outside + * world: + *---------------------------------------------------------------- + */ + +extern void panic(); +extern regexp * TclCompileRegexp _ANSI_ARGS_((Tcl_Interp *interp, + char *string)); +extern void TclCopyAndCollapse _ANSI_ARGS_((int count, char *src, + char *dst)); +extern void TclDeleteVars _ANSI_ARGS_((Interp *iPtr, + Tcl_HashTable *tablePtr)); +extern void TclExpandParseValue _ANSI_ARGS_((ParseValue *pvPtr, + int needed)); +extern int TclFindElement _ANSI_ARGS_((Tcl_Interp *interp, + char *list, char **elementPtr, char **nextPtr, + int *sizePtr, int *bracePtr)); +extern Proc * TclFindProc _ANSI_ARGS_((Interp *iPtr, + char *procName)); +extern int TclGetFrame _ANSI_ARGS_((Tcl_Interp *interp, + char *string, CallFrame **framePtrPtr)); +extern int TclGetListIndex _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int *indexPtr)); +extern Proc * TclIsProc _ANSI_ARGS_((Command *cmdPtr)); +extern int TclParseBraces _ANSI_ARGS_((Tcl_Interp *interp, + char *string, char **termPtr, ParseValue *pvPtr)); +extern int TclParseNestedCmd _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int flags, char **termPtr, + ParseValue *pvPtr)); +extern int TclParseQuotes _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int termChar, int flags, + char **termPtr, ParseValue *pvPtr)); +extern int TclParseWords _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int flags, int maxWords, + char **termPtr, int *argcPtr, char **argv, + ParseValue *pvPtr)); +extern char * TclPrecTraceProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, char *name1, char *name2, + int flags)); +extern void TclSetupEnv _ANSI_ARGS_((Tcl_Interp *interp)); +extern char * TclWordEnd _ANSI_ARGS_((char *start, int nested, + int *semiPtr)); + +/* + *---------------------------------------------------------------- + * Command procedures in the generic core: + *---------------------------------------------------------------- + */ + +extern int Tcl_AppendCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ArrayCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_BreakCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_CaseCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_CatchCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ConcatCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ContinueCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ErrorCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_EvalCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ExprCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ForCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ForeachCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_FormatCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_GlobalCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_HistoryCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_IfCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_IncrCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_InfoCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_JoinCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LappendCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LindexCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LinsertCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LlengthCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ListCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LrangeCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LreplaceCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LsearchCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_LsortCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ProcCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_RegexpCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_RegsubCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_RenameCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ReturnCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ScanCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_SetCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_SplitCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_StringCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_SwitchCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_TraceCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_UnsetCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_UplevelCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_UpvarCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_WhileCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_Cmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_Cmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); + +/* + *---------------------------------------------------------------- + * Command procedures in the UNIX core: + *---------------------------------------------------------------- + */ + +extern int Tcl_CdCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_CloseCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_EofCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ExecCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ExitCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_FileCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_FlushCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_GetsCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_GlobCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_OpenCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_PutsCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_PidCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_PwdCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_ReadCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_SeekCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_SourceCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_TellCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +extern int Tcl_TimeCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); + +#endif /* _TCLINT */ diff --git a/vendor/x11iraf/obm/Tcl/tclLink.c b/vendor/x11iraf/obm/Tcl/tclLink.c new file mode 100644 index 00000000..887d9766 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclLink.c @@ -0,0 +1,361 @@ +/* + * tclLink.c -- + * + * This file implements linked variables (a C variable that is + * tied to a Tcl variable). The idea of linked variables was + * first suggested by Andreas Stocke and this implementation is + * based heavily on a prototype implementation provided by + * him. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclLink.c,v 1.4 93/07/29 15:24:05 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" + +/* + * For each linked variable there is a data structure of the following + * type, which describes the link and is the clientData for the trace + * set on the Tcl variable. + */ + +typedef struct Link { + Tcl_Interp *interp; /* Interpreter containing Tcl variable. */ + char *addr; /* Location of C variable. */ + int type; /* Type of link (TCL_LINK_INT, etc.). */ + int writable; /* Zero means Tcl variable is read-only. */ + union { + int i; + double d; + } lastValue; /* Last known value of C variable; used to + * avoid string conversions. */ +} Link; + +/* + * Forward references to procedures defined later in this file: + */ + +static char * LinkTraceProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, char *name1, char *name2, + int flags)); +static char * StringValue _ANSI_ARGS_((Link *linkPtr, + char *buffer)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_LinkVar -- + * + * Link a C variable to a Tcl variable so that changes to either + * one causes the other to change. + * + * Results: + * The return value is TCL_OK if everything went well or TCL_ERROR + * if an error occurred (interp->result is also set after errors). + * + * Side effects: + * The value at *addr is linked to the Tcl variable "varName", + * using "type" to convert between string values for Tcl and + * binary values for *addr. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_LinkVar(interp, varName, addr, type) + Tcl_Interp *interp; /* Interpreter in which varName exists. */ + char *varName; /* Name of a global variable in interp. */ + char *addr; /* Address of a C variable to be linked + * to varName. */ + int type; /* Type of C variable: TCL_LINK_INT, etc. + * Also may have TCL_LINK_READ_ONLY + * OR'ed in. */ +{ + Link *linkPtr; + char buffer[TCL_DOUBLE_SPACE]; + int code; + + linkPtr = (Link *) ckalloc(sizeof(Link)); + linkPtr->interp = interp; + linkPtr->addr = addr; + linkPtr->type = type & ~TCL_LINK_READ_ONLY; + linkPtr->writable = (type & TCL_LINK_READ_ONLY) == 0; + if (Tcl_SetVar(interp, varName, StringValue(linkPtr, buffer), + TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) { + ckfree((char *) linkPtr); + return TCL_ERROR; + } + code = Tcl_TraceVar(interp, varName, TCL_GLOBAL_ONLY|TCL_TRACE_READS + |TCL_TRACE_WRITES|TCL_TRACE_UNSETS, LinkTraceProc, + (ClientData) linkPtr); + if (code != TCL_OK) { + ckfree((char *) linkPtr); + } + return code; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UnlinkVar -- + * + * Destroy the link between a Tcl variable and a C variable. + * + * Results: + * None. + * + * Side effects: + * If "varName" was previously linked to a C variable, the link + * is broken to make the variable independent. If there was no + * previous link for "varName" then nothing happens. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_UnlinkVar(interp, varName) + Tcl_Interp *interp; /* Interpreter containing variable to unlink. */ + char *varName; /* Global variable in interp to unlink. */ +{ + Link *linkPtr; + + linkPtr = (Link *) Tcl_VarTraceInfo(interp, varName, TCL_GLOBAL_ONLY, + LinkTraceProc, (ClientData) NULL); + if (linkPtr == NULL) { + return; + } + Tcl_UntraceVar(interp, varName, + TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + LinkTraceProc, (ClientData) linkPtr); + ckfree((char *) linkPtr); +} + +/* + *---------------------------------------------------------------------- + * + * LinkTraceProc -- + * + * This procedure is invoked when a linked Tcl variable is read, + * written, or unset from Tcl. It's responsible for keeping the + * C variable in sync with the Tcl variable. + * + * Results: + * If all goes well, NULL is returned; otherwise an error message + * is returned. + * + * Side effects: + * The C variable may be updated to make it consistent with the + * Tcl variable, or the Tcl variable may be overwritten to reject + * a modification. + * + *---------------------------------------------------------------------- + */ + +static char * +LinkTraceProc(clientData, interp, name1, name2, flags) + ClientData clientData; /* Contains information about the link. */ + Tcl_Interp *interp; /* Interpreter containing Tcl variable. */ + char *name1; /* First part of variable name. */ + char *name2; /* Second part of variable name. */ + int flags; /* Miscellaneous additional information. */ +{ + Link *linkPtr = (Link *) clientData; + int changed; + char buffer[TCL_DOUBLE_SPACE]; + char *value, **pp; + Tcl_DString savedResult; + + /* + * If the variable is being unset, then just re-create it (with a + * trace) unless the whole interpreter is going away. + */ + + if (flags & TCL_TRACE_UNSETS) { + if (flags & TCL_INTERP_DESTROYED) { + ckfree((char *) linkPtr); + } + if (flags & TCL_TRACE_DESTROYED) { + Tcl_SetVar2(interp, name1, name2, + StringValue(linkPtr, buffer), TCL_GLOBAL_ONLY); + Tcl_TraceVar2(interp, name1, name2, TCL_GLOBAL_ONLY + |TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + LinkTraceProc, (ClientData) linkPtr); + } + return NULL; + } + + /* + * For read accesses, update the Tcl variable if the C variable + * has changed since the last time we updated the Tcl variable. + */ + + if (flags & TCL_TRACE_READS) { + switch (linkPtr->type) { + case TCL_LINK_INT: + case TCL_LINK_BOOLEAN: + changed = *(int *)(linkPtr->addr) != linkPtr->lastValue.i; + break; + case TCL_LINK_DOUBLE: + changed = *(double *)(linkPtr->addr) != linkPtr->lastValue.d; + break; + case TCL_LINK_STRING: + changed = 1; + break; + default: + return "internal error: bad linked variable type"; + } + if (changed) { + Tcl_SetVar2(interp, name1, name2, StringValue(linkPtr, buffer), + TCL_GLOBAL_ONLY); + } + return NULL; + } + + /* + * For writes, first make sure that the variable is writable. Then + * convert the Tcl value to C if possible. If the variable isn't + * writable or can't be converted, then restore the varaible's old + * value and return an error. Another tricky thing: we have to save + * and restore the interpreter's result, since the variable access + * could occur when the result has been partially set. + */ + + if (!linkPtr->writable) { + Tcl_SetVar2(interp, name1, name2, StringValue(linkPtr, buffer), + TCL_GLOBAL_ONLY); + return "linked variable is read-only"; + } + value = Tcl_GetVar2(interp, name1, name2, TCL_GLOBAL_ONLY); + if (value == NULL) { + /* + * This shouldn't ever happen. + */ + return "internal error: linked variable couldn't be read"; + } + Tcl_DStringInit(&savedResult); + Tcl_DStringAppend(&savedResult, interp->result, -1); + Tcl_ResetResult(interp); + switch (linkPtr->type) { + case TCL_LINK_INT: + if (Tcl_GetInt(interp, value, &linkPtr->lastValue.i) != TCL_OK) { + Tcl_DStringResult(interp, &savedResult); + Tcl_SetVar2(interp, name1, name2, StringValue(linkPtr, buffer), + TCL_GLOBAL_ONLY); + return "variable must have integer value"; + } + *(int *)(linkPtr->addr) = linkPtr->lastValue.i; + break; + case TCL_LINK_DOUBLE: + if (Tcl_GetDouble(interp, value, &linkPtr->lastValue.d) + != TCL_OK) { + Tcl_DStringResult(interp, &savedResult); + Tcl_SetVar2(interp, name1, name2, StringValue(linkPtr, buffer), + TCL_GLOBAL_ONLY); + return "variable must have real value"; + } + *(double *)(linkPtr->addr) = linkPtr->lastValue.d; + break; + case TCL_LINK_BOOLEAN: + if (Tcl_GetBoolean(interp, value, &linkPtr->lastValue.i) + != TCL_OK) { + Tcl_DStringResult(interp, &savedResult); + Tcl_SetVar2(interp, name1, name2, StringValue(linkPtr, buffer), + TCL_GLOBAL_ONLY); + return "variable must have boolean value"; + } + *(int *)(linkPtr->addr) = linkPtr->lastValue.i; + break; + case TCL_LINK_STRING: + pp = (char **)(linkPtr->addr); + if (*pp != NULL) { + ckfree(*pp); + } + *pp = ckalloc((unsigned) (strlen(value) + 1)); + strcpy(*pp, value); + break; + default: + return "internal error: bad linked variable type"; + } + Tcl_DStringResult(interp, &savedResult); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * StringValue -- + * + * Converts the value of a C variable to a string for use in a + * Tcl variable to which it is linked. + * + * Results: + * The return value is a pointer + to a string that represents + * the value of the C variable given by linkPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static char * +StringValue(linkPtr, buffer) + Link *linkPtr; /* Structure describing linked variable. */ + char *buffer; /* Small buffer to use for converting + * values. Must have TCL_DOUBLE_SPACE + * bytes or more. */ +{ + char *p; + + switch (linkPtr->type) { + case TCL_LINK_INT: + linkPtr->lastValue.i = *(int *)(linkPtr->addr); + sprintf(buffer, "%d", linkPtr->lastValue.i); + return buffer; + case TCL_LINK_DOUBLE: + linkPtr->lastValue.d = *(double *)(linkPtr->addr); + Tcl_PrintDouble(linkPtr->interp, linkPtr->lastValue.d, buffer); + return buffer; + case TCL_LINK_BOOLEAN: + linkPtr->lastValue.i = *(int *)(linkPtr->addr); + if (linkPtr->lastValue.i != 0) { + return "1"; + } + return "0"; + case TCL_LINK_STRING: + p = *(char **)(linkPtr->addr); + if (p == NULL) { + return "NULL"; + } + return p; + } + + /* + * This code only gets executed if the link type is unknown + * (shouldn't ever happen). + */ + + return "??"; +} diff --git a/vendor/x11iraf/obm/Tcl/tclMain.c b/vendor/x11iraf/obm/Tcl/tclMain.c new file mode 100644 index 00000000..f080dcd2 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclMain.c @@ -0,0 +1,296 @@ +/* + * main.c -- + * + * Main program for Tcl shells and other Tcl-based applications. + * + * Copyright (c) 1988-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclMain.c,v 1.12 93/11/11 09:35:10 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include <stdio.h> +#include <tcl.h> +#include <errno.h> + +/* + * Declarations for various library procedures and variables (don't want + * to include tclUnix.h here, because people might copy this file out of + * the Tcl source directory to make their own modified versions). + */ + +extern int errno; +extern void exit _ANSI_ARGS_((int status)); +extern int isatty _ANSI_ARGS_((int fd)); +extern char * strcpy _ANSI_ARGS_((char *dst, CONST char *src)); + +static Tcl_Interp *interp; /* Interpreter for application. */ +static Tcl_DString command; /* Used to buffer incomplete commands being + * read from stdin. */ +char *tcl_RcFileName = NULL; /* Name of a user-specific startup script + * to source if the application is being run + * interactively (e.g. "~/.tclshrc"). Set + * by Tcl_AppInit. NULL means don't source + * anything ever. */ +#ifdef TCL_MEM_DEBUG +static char dumpFile[100]; /* Records where to dump memory allocation + * information. */ +static int quitFlag = 0; /* 1 means the "checkmem" command was + * invoked, so the application should quit + * and dump memory allocation information. */ +#endif + +/* + * Forward references for procedures defined later in this file: + */ + +static int CheckmemCmd _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char *argv[])); + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for a Tcl-based shell that reads + * Tcl commands from standard input. + * + * Results: + * None. + * + * Side effects: + * Can be almost arbitrary, depending on what the Tcl commands do. + * + *---------------------------------------------------------------------- + */ + +int +main(argc, argv) + int argc; /* Number of arguments. */ + char **argv; /* Array of argument strings. */ +{ + char buffer[1000], *cmd, *args, *fileName; + int code, gotPartial, tty; + int exitCode = 0; + + interp = Tcl_CreateInterp(); +#ifdef TCL_MEM_DEBUG + Tcl_InitMemory(interp); + Tcl_CreateCommand(interp, "checkmem", CheckmemCmd, (ClientData) 0, + (Tcl_CmdDeleteProc *) NULL); +#endif + + /* + * Make command-line arguments available in the Tcl variables "argc" + * and "argv". If the first argument doesn't start with a "-" then + * strip it off and use it as the name of a script file to process. + */ + + fileName = NULL; + if ((argc > 1) && (argv[1][0] != '-')) { + fileName = argv[1]; + argc--; + argv++; + } + args = Tcl_Merge(argc-1, argv+1); + Tcl_SetVar(interp, "argv", args, TCL_GLOBAL_ONLY); + ckfree(args); + sprintf(buffer, "%d", argc-1); + Tcl_SetVar(interp, "argc", buffer, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "argv0", (fileName != NULL) ? fileName : argv[0], + TCL_GLOBAL_ONLY); + + /* + * Set the "tcl_interactive" variable. + */ + + tty = isatty(0); + Tcl_SetVar(interp, "tcl_interactive", + ((fileName == NULL) && tty) ? "1" : "0", TCL_GLOBAL_ONLY); + + /* + * Invoke application-specific initialization. + */ + + if (Tcl_AppInit(interp) != TCL_OK) { + fprintf(stderr, "Tcl_AppInit failed: %s\n", interp->result); + } + + /* + * If a script file was specified then just source that file + * and quit. + */ + + if (fileName != NULL) { + code = Tcl_EvalFile(interp, fileName); + if (code != TCL_OK) { + fprintf(stderr, "%s\n", interp->result); + exitCode = 1; + } + goto done; + } + + /* + * We're running interactively. Source a user-specific startup + * file if Tcl_AppInit specified one and if the file exists. + */ + + if (tcl_RcFileName != NULL) { + Tcl_DString buffer; + char *fullName; + FILE *f; + + fullName = Tcl_TildeSubst(interp, tcl_RcFileName, &buffer); + if (fullName == NULL) { + fprintf(stderr, "%s\n", interp->result); + } else { + f = fopen(fullName, "r"); + if (f != NULL) { + code = Tcl_EvalFile(interp, fullName); + if (code != TCL_OK) { + fprintf(stderr, "%s\n", interp->result); + } + fclose(f); + } + } + Tcl_DStringFree(&buffer); + } + + /* + * Process commands from stdin until there's an end-of-file. + */ + + gotPartial = 0; + Tcl_DStringInit(&command); + while (1) { + clearerr(stdin); + if (tty) { + char *promptCmd; + + promptCmd = Tcl_GetVar(interp, + gotPartial ? "tcl_prompt2" : "tcl_prompt1", TCL_GLOBAL_ONLY); + if (promptCmd == NULL) { + defaultPrompt: + if (!gotPartial) { + fputs("% ", stdout); + } + } else { + code = Tcl_Eval(interp, promptCmd); + if (code != TCL_OK) { + fprintf(stderr, "%s\n", interp->result); + Tcl_AddErrorInfo(interp, + "\n (script that generates prompt)"); + goto defaultPrompt; + } + } + fflush(stdout); + } + if (fgets(buffer, 1000, stdin) == NULL) { + if (ferror(stdin)) { + if (errno == EINTR) { + if (tcl_AsyncReady) { + (void) Tcl_AsyncInvoke((Tcl_Interp *) NULL, 0); + } + clearerr(stdin); + } else { + goto done; + } + } else { + if (!gotPartial) { + goto done; + } + } + buffer[0] = 0; + } + cmd = Tcl_DStringAppend(&command, buffer, -1); + if ((buffer[0] != 0) && !Tcl_CommandComplete(cmd)) { + gotPartial = 1; + continue; + } + + gotPartial = 0; + code = Tcl_RecordAndEval(interp, cmd, 0); + Tcl_DStringFree(&command); + if (code != TCL_OK) { + fprintf(stderr, "%s\n", interp->result); + } else if (tty && (*interp->result != 0)) { + printf("%s\n", interp->result); + } +#ifdef TCL_MEM_DEBUG + if (quitFlag) { + Tcl_DeleteInterp(interp); + Tcl_DumpActiveMemory(dumpFile); + exit(0); + } +#endif + } + + /* + * Rather than calling exit, invoke the "exit" command so that + * users can replace "exit" with some other command to do additional + * cleanup on exit. The Tcl_Eval call should never return. + */ + + done: + sprintf(buffer, "exit %d", exitCode); + Tcl_Eval(interp, buffer); + return 1; +} + +/* + *---------------------------------------------------------------------- + * + * CheckmemCmd -- + * + * This is the command procedure for the "checkmem" command, which + * causes the application to exit after printing information about + * memory usage to the file passed to this command as its first + * argument. + * + * Results: + * Returns a standard Tcl completion code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +#ifdef TCL_MEM_DEBUG + + /* ARGSUSED */ +static int +CheckmemCmd(clientData, interp, argc, argv) + ClientData clientData; /* Not used. */ + Tcl_Interp *interp; /* Interpreter for evaluation. */ + int argc; /* Number of arguments. */ + char *argv[]; /* String values of arguments. */ +{ + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileName\"", (char *) NULL); + return TCL_ERROR; + } + strcpy(dumpFile, argv[1]); + quitFlag = 1; + return TCL_OK; +} +#endif diff --git a/vendor/x11iraf/obm/Tcl/tclMtherr.c b/vendor/x11iraf/obm/Tcl/tclMtherr.c new file mode 100644 index 00000000..81c14ac5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclMtherr.c @@ -0,0 +1,89 @@ +/* + * tclMatherr.c -- + * + * This function provides a default implementation of the + * "matherr" function, for SYS-V systems where it's needed. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclMtherr.c,v 1.7 93/10/31 16:19:31 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include <math.h> + +#ifndef TCL_GENERIC_ONLY +#include "tclUnix.h" +#else +#define NO_ERRNO_H +#endif + +#ifdef NO_ERRNO_H +extern int errno; /* Use errno from tclExpr.c. */ +#define EDOM 33 +#define ERANGE 34 +#endif + +/* + * The following variable is secretly shared with Tcl so we can + * tell if expression evaluation is in progress. If not, matherr + * just emulates the default behavior, which includes printing + * a message. + */ + +extern int tcl_MathInProgress; + + +/* + *---------------------------------------------------------------------- + * + * matherr -- + * + * This procedure is invoked on Sys-V systems when certain + * errors occur in mathematical functions. Type "man matherr" + * for more information on how this function works. + * + * Results: + * Returns 1 to indicate that we've handled the error + * locally. + * + * Side effects: + * Sets errno based on what's in xPtr. + * + *---------------------------------------------------------------------- + */ + +int +matherr(xPtr) + struct exception *xPtr; /* Describes error that occurred. */ +{ + if (!tcl_MathInProgress) { + return 0; + } + if ((xPtr->type == DOMAIN) || (xPtr->type == SING)) { + errno = EDOM; + } else { + errno = ERANGE; + } + return 1; +} diff --git a/vendor/x11iraf/obm/Tcl/tclParse.c b/vendor/x11iraf/obm/Tcl/tclParse.c new file mode 100644 index 00000000..433e0544 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclParse.c @@ -0,0 +1,1284 @@ +/* + * tclParse.c -- + * + * This file contains a collection of procedures that are used + * to parse Tcl commands or parts of commands (like quoted + * strings or nested sub-commands). + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclParse.c,v 1.37 93/10/14 15:14:06 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" + +/* Slackware/RedHat4.2 compatibility hack. */ +#if defined(linux) && defined(isalnum) +#undef isalnum +#define isalnum(c) (isalpha(c)||isdigit(c)) +#endif + + +/* + * The following table assigns a type to each character. Only types + * meaningful to Tcl parsing are represented here. The table indexes + * all 256 characters, with the negative ones first, then the positive + * ones. + */ + +char tclTypeTable[] = { + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_COMMAND_END, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_SPACE, TCL_COMMAND_END, TCL_SPACE, + TCL_SPACE, TCL_SPACE, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_SPACE, TCL_NORMAL, TCL_QUOTE, TCL_NORMAL, + TCL_DOLLAR, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_COMMAND_END, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_OPEN_BRACKET, + TCL_BACKSLASH, TCL_COMMAND_END, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, + TCL_NORMAL, TCL_NORMAL, TCL_NORMAL, TCL_OPEN_BRACE, + TCL_NORMAL, TCL_CLOSE_BRACE, TCL_NORMAL, TCL_NORMAL, +}; + +/* + * Function prototypes for procedures local to this file: + */ + +static char * QuoteEnd _ANSI_ARGS_((char *string, int term)); +static char * VarNameEnd _ANSI_ARGS_((char *string)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_Backslash -- + * + * Figure out how to handle a backslash sequence. + * + * Results: + * The return value is the character that should be substituted + * in place of the backslash sequence that starts at src. If + * readPtr isn't NULL then it is filled in with a count of the + * number of characters in the backslash sequence. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char +Tcl_Backslash(src, readPtr) + char *src; /* Points to the backslash character of + * a backslash sequence. */ + int *readPtr; /* Fill in with number of characters read + * from src, unless NULL. */ +{ + register char *p = src+1; + char result; + int count; + + count = 2; + + switch (*p) { + case 'a': + result = 0x7; /* Don't say '\a' here, since some compilers */ + break; /* don't support it. */ + case 'b': + result = '\b'; + break; + case 'f': + result = '\f'; + break; + case 'n': + result = '\n'; + break; + case 'r': + result = '\r'; + break; + case 't': + result = '\t'; + break; + case 'v': + result = '\v'; + break; + case 'x': + if (isxdigit(UCHAR(p[1]))) { + char *end; + + result = strtoul(p+1, &end, 16); + count = end - src; + } else { + count = 2; + result = 'x'; + } + break; + case '\n': + do { + p++; + } while (isspace(UCHAR(*p))); + result = ' '; + count = p - src; + break; + case 0: + result = '\\'; + count = 1; + break; + default: + if (isdigit(UCHAR(*p))) { + result = *p - '0'; + p++; + if (!isdigit(UCHAR(*p))) { + break; + } + count = 3; + result = (result << 3) + (*p - '0'); + p++; + if (!isdigit(UCHAR(*p))) { + break; + } + count = 4; + result = (result << 3) + (*p - '0'); + break; + } + result = *p; + count = 2; + break; + } + + if (readPtr != NULL) { + *readPtr = count; + } + return result; +} + +/* + *-------------------------------------------------------------- + * + * TclParseQuotes -- + * + * This procedure parses a double-quoted string such as a + * quoted Tcl command argument or a quoted value in a Tcl + * expression. This procedure is also used to parse array + * element names within parentheses, or anything else that + * needs all the substitutions that happen in quotes. + * + * Results: + * The return value is a standard Tcl result, which is + * TCL_OK unless there was an error while parsing the + * quoted string. If an error occurs then interp->result + * contains a standard error message. *TermPtr is filled + * in with the address of the character just after the + * last one successfully processed; this is usually the + * character just after the matching close-quote. The + * fully-substituted contents of the quotes are stored in + * standard fashion in *pvPtr, null-terminated with + * pvPtr->next pointing to the terminating null character. + * + * Side effects: + * The buffer space in pvPtr may be enlarged by calling its + * expandProc. + * + *-------------------------------------------------------------- + */ + +int +TclParseQuotes(interp, string, termChar, flags, termPtr, pvPtr) + Tcl_Interp *interp; /* Interpreter to use for nested command + * evaluations and error messages. */ + char *string; /* Character just after opening double- + * quote. */ + int termChar; /* Character that terminates "quoted" string + * (usually double-quote, but sometimes + * right-paren or something else). */ + int flags; /* Flags to pass to nested Tcl_Eval calls. */ + char **termPtr; /* Store address of terminating character + * here. */ + ParseValue *pvPtr; /* Information about where to place + * fully-substituted result of parse. */ +{ + register char *src, *dst, c; + + src = string; + dst = pvPtr->next; + + while (1) { + if (dst == pvPtr->end) { + /* + * Target buffer space is about to run out. Make more space. + */ + + pvPtr->next = dst; + (*pvPtr->expandProc)(pvPtr, 1); + dst = pvPtr->next; + } + + c = *src; + src++; + if (c == termChar) { + *dst = '\0'; + pvPtr->next = dst; + *termPtr = src; + return TCL_OK; + } else if (CHAR_TYPE(c) == TCL_NORMAL) { + copy: + *dst = c; + dst++; + continue; + } else if (c == '$') { + int length; + char *value; + + value = Tcl_ParseVar(interp, src-1, termPtr); + if (value == NULL) { + return TCL_ERROR; + } + src = *termPtr; + length = strlen(value); + if ((pvPtr->end - dst) <= length) { + pvPtr->next = dst; + (*pvPtr->expandProc)(pvPtr, length); + dst = pvPtr->next; + } + strcpy(dst, value); + dst += length; + continue; + } else if (c == '[') { + int result; + + pvPtr->next = dst; + result = TclParseNestedCmd(interp, src, flags, termPtr, pvPtr); + if (result != TCL_OK) { + return result; + } + src = *termPtr; + dst = pvPtr->next; + continue; + } else if (c == '\\') { + int numRead; + + src--; + *dst = Tcl_Backslash(src, &numRead); + dst++; + src += numRead; + continue; + } else if (c == '\0') { + Tcl_ResetResult(interp); + sprintf(interp->result, "missing %c", termChar); + *termPtr = string-1; + return TCL_ERROR; + } else { + goto copy; + } + } +} + +/* + *-------------------------------------------------------------- + * + * TclParseNestedCmd -- + * + * This procedure parses a nested Tcl command between + * brackets, returning the result of the command. + * + * Results: + * The return value is a standard Tcl result, which is + * TCL_OK unless there was an error while executing the + * nested command. If an error occurs then interp->result + * contains a standard error message. *TermPtr is filled + * in with the address of the character just after the + * last one processed; this is usually the character just + * after the matching close-bracket, or the null character + * at the end of the string if the close-bracket was missing + * (a missing close bracket is an error). The result returned + * by the command is stored in standard fashion in *pvPtr, + * null-terminated, with pvPtr->next pointing to the null + * character. + * + * Side effects: + * The storage space at *pvPtr may be expanded. + * + *-------------------------------------------------------------- + */ + +int +TclParseNestedCmd(interp, string, flags, termPtr, pvPtr) + Tcl_Interp *interp; /* Interpreter to use for nested command + * evaluations and error messages. */ + char *string; /* Character just after opening bracket. */ + int flags; /* Flags to pass to nested Tcl_Eval. */ + char **termPtr; /* Store address of terminating character + * here. */ + register ParseValue *pvPtr; /* Information about where to place + * result of command. */ +{ + int result, length, shortfall; + Interp *iPtr = (Interp *) interp; + + iPtr->evalFlags = flags | TCL_BRACKET_TERM; + result = Tcl_Eval(interp, string); + *termPtr = iPtr->termPtr; + if (result != TCL_OK) { + /* + * The increment below results in slightly cleaner message in + * the errorInfo variable (the close-bracket will appear). + */ + + if (**termPtr == ']') { + *termPtr += 1; + } + return result; + } + (*termPtr) += 1; + length = strlen(iPtr->result); + shortfall = length + 1 - (pvPtr->end - pvPtr->next); + if (shortfall > 0) { + (*pvPtr->expandProc)(pvPtr, shortfall); + } + strcpy(pvPtr->next, iPtr->result); + pvPtr->next += length; + Tcl_FreeResult(iPtr); + iPtr->result = iPtr->resultSpace; + iPtr->resultSpace[0] = '\0'; + return TCL_OK; +} + +/* + *-------------------------------------------------------------- + * + * TclParseBraces -- + * + * This procedure scans the information between matching + * curly braces. + * + * Results: + * The return value is a standard Tcl result, which is + * TCL_OK unless there was an error while parsing string. + * If an error occurs then interp->result contains a + * standard error message. *TermPtr is filled + * in with the address of the character just after the + * last one successfully processed; this is usually the + * character just after the matching close-brace. The + * information between curly braces is stored in standard + * fashion in *pvPtr, null-terminated with pvPtr->next + * pointing to the terminating null character. + * + * Side effects: + * The storage space at *pvPtr may be expanded. + * + *-------------------------------------------------------------- + */ + +int +TclParseBraces(interp, string, termPtr, pvPtr) + Tcl_Interp *interp; /* Interpreter to use for nested command + * evaluations and error messages. */ + char *string; /* Character just after opening bracket. */ + char **termPtr; /* Store address of terminating character + * here. */ + register ParseValue *pvPtr; /* Information about where to place + * result of command. */ +{ + int level; + register char *src, *dst, *end; + register char c; + + src = string; + dst = pvPtr->next; + end = pvPtr->end; + level = 1; + + /* + * Copy the characters one at a time to the result area, stopping + * when the matching close-brace is found. + */ + + while (1) { + c = *src; + src++; + if (dst == end) { + pvPtr->next = dst; + (*pvPtr->expandProc)(pvPtr, 20); + dst = pvPtr->next; + end = pvPtr->end; + } + *dst = c; + dst++; + if (CHAR_TYPE(c) == TCL_NORMAL) { + continue; + } else if (c == '{') { + level++; + } else if (c == '}') { + level--; + if (level == 0) { + dst--; /* Don't copy the last close brace. */ + break; + } + } else if (c == '\\') { + int count; + + /* + * Must always squish out backslash-newlines, even when in + * braces. This is needed so that this sequence can appear + * anywhere in a command, such as the middle of an expression. + */ + + if (*src == '\n') { + dst[-1] = Tcl_Backslash(src-1, &count); + src += count - 1; + } else { + (void) Tcl_Backslash(src-1, &count); + while (count > 1) { + if (dst == end) { + pvPtr->next = dst; + (*pvPtr->expandProc)(pvPtr, 20); + dst = pvPtr->next; + end = pvPtr->end; + } + *dst = *src; + dst++; + src++; + count--; + } + } + } else if (c == '\0') { + Tcl_SetResult(interp, "missing close-brace", TCL_STATIC); + *termPtr = string-1; + return TCL_ERROR; + } + } + + *dst = '\0'; + pvPtr->next = dst; + *termPtr = src; + return TCL_OK; +} + +/* + *-------------------------------------------------------------- + * + * TclParseWords -- + * + * This procedure parses one or more words from a command + * string and creates argv-style pointers to fully-substituted + * copies of those words. + * + * Results: + * The return value is a standard Tcl result. + * + * *argcPtr is modified to hold a count of the number of words + * successfully parsed, which may be 0. At most maxWords words + * will be parsed. If 0 <= *argcPtr < maxWords then it + * means that a command separator was seen. If *argcPtr + * is maxWords then it means that a command separator was + * not seen yet. + * + * *TermPtr is filled in with the address of the character + * just after the last one successfully processed in the + * last word. This is either the command terminator (if + * *argcPtr < maxWords), the character just after the last + * one in a word (if *argcPtr is maxWords), or the vicinity + * of an error (if the result is not TCL_OK). + * + * The pointers at *argv are filled in with pointers to the + * fully-substituted words, and the actual contents of the + * words are copied to the buffer at pvPtr. + * + * If an error occurrs then an error message is left in + * interp->result and the information at *argv, *argcPtr, + * and *pvPtr may be incomplete. + * + * Side effects: + * The buffer space in pvPtr may be enlarged by calling its + * expandProc. + * + *-------------------------------------------------------------- + */ + +int +TclParseWords(interp, string, flags, maxWords, termPtr, argcPtr, argv, pvPtr) + Tcl_Interp *interp; /* Interpreter to use for nested command + * evaluations and error messages. */ + char *string; /* First character of word. */ + int flags; /* Flags to control parsing (same values as + * passed to Tcl_Eval). */ + int maxWords; /* Maximum number of words to parse. */ + char **termPtr; /* Store address of terminating character + * here. */ + int *argcPtr; /* Filled in with actual number of words + * parsed. */ + char **argv; /* Store addresses of individual words here. */ + register ParseValue *pvPtr; /* Information about where to place + * fully-substituted word. */ +{ + register char *src, *dst; + register char c; + int type, result, argc; + char *oldBuffer; /* Used to detect when pvPtr's buffer gets + * reallocated, so we can adjust all of the + * argv pointers. */ + + src = string; + oldBuffer = pvPtr->buffer; + dst = pvPtr->next; + for (argc = 0; argc < maxWords; argc++) { + argv[argc] = dst; + + /* + * Skip leading space. + */ + + skipSpace: + c = *src; + type = CHAR_TYPE(c); + while (type == TCL_SPACE) { + src++; + c = *src; + type = CHAR_TYPE(c); + } + + /* + * Handle the normal case (i.e. no leading double-quote or brace). + */ + + if (type == TCL_NORMAL) { + normalArg: + while (1) { + if (dst == pvPtr->end) { + /* + * Target buffer space is about to run out. Make + * more space. + */ + + pvPtr->next = dst; + (*pvPtr->expandProc)(pvPtr, 1); + dst = pvPtr->next; + } + + if (type == TCL_NORMAL) { + copy: + *dst = c; + dst++; + src++; + } else if (type == TCL_SPACE) { + goto wordEnd; + } else if (type == TCL_DOLLAR) { + int length; + char *value; + + value = Tcl_ParseVar(interp, src, termPtr); + if (value == NULL) { + return TCL_ERROR; + } + src = *termPtr; + length = strlen(value); + if ((pvPtr->end - dst) <= length) { + pvPtr->next = dst; + (*pvPtr->expandProc)(pvPtr, length); + dst = pvPtr->next; + } + strcpy(dst, value); + dst += length; + } else if (type == TCL_COMMAND_END) { + if ((c == ']') && !(flags & TCL_BRACKET_TERM)) { + goto copy; + } + + /* + * End of command; simulate a word-end first, so + * that the end-of-command can be processed as the + * first thing in a new word. + */ + + goto wordEnd; + } else if (type == TCL_OPEN_BRACKET) { + pvPtr->next = dst; + result = TclParseNestedCmd(interp, src+1, flags, termPtr, + pvPtr); + if (result != TCL_OK) { + return result; + } + src = *termPtr; + dst = pvPtr->next; + } else if (type == TCL_BACKSLASH) { + int numRead; + + *dst = Tcl_Backslash(src, &numRead); + + /* + * The following special check allows a backslash-newline + * to be treated as a word-separator, as if the backslash + * and newline had been collapsed before command parsing + * began. + */ + + if (src[1] == '\n') { + src += numRead; + goto wordEnd; + } + src += numRead; + dst++; + } else { + goto copy; + } + c = *src; + type = CHAR_TYPE(c); + } + } else { + + /* + * Check for the end of the command. + */ + + if (type == TCL_COMMAND_END) { + if (flags & TCL_BRACKET_TERM) { + if (c == '\0') { + Tcl_SetResult(interp, "missing close-bracket", + TCL_STATIC); + return TCL_ERROR; + } + } else { + if (c == ']') { + goto normalArg; + } + } + goto done; + } + + /* + * Now handle the special cases: open braces, double-quotes, + * and backslash-newline. + */ + + pvPtr->next = dst; + if (type == TCL_QUOTE) { + result = TclParseQuotes(interp, src+1, '"', flags, + termPtr, pvPtr); + } else if (type == TCL_OPEN_BRACE) { + result = TclParseBraces(interp, src+1, termPtr, pvPtr); + } else if ((type == TCL_BACKSLASH) && (src[1] == '\n')) { + /* + * This code is needed so that a backslash-newline at the + * very beginning of a word is treated as part of the white + * space between words and not as a space within the word. + */ + + src += 2; + goto skipSpace; + } else { + goto normalArg; + } + if (result != TCL_OK) { + return result; + } + + /* + * Back from quotes or braces; make sure that the terminating + * character was the end of the word. Have to be careful here + * to handle continuation lines (i.e. lines ending in backslash). + */ + + c = **termPtr; + if ((c == '\\') && ((*termPtr)[1] == '\n')) { + c = (*termPtr)[2]; + } + type = CHAR_TYPE(c); + if ((type != TCL_SPACE) && (type != TCL_COMMAND_END)) { + if (*src == '"') { + Tcl_SetResult(interp, "extra characters after close-quote", + TCL_STATIC); + } else { + Tcl_SetResult(interp, "extra characters after close-brace", + TCL_STATIC); + } + return TCL_ERROR; + } + src = *termPtr; + dst = pvPtr->next; + + } + + /* + * We're at the end of a word, so add a null terminator. Then + * see if the buffer was re-allocated during this word. If so, + * update all of the argv pointers. + */ + + wordEnd: + *dst = '\0'; + dst++; + if (oldBuffer != pvPtr->buffer) { + int i; + + for (i = 0; i <= argc; i++) { + argv[i] = pvPtr->buffer + (argv[i] - oldBuffer); + } + oldBuffer = pvPtr->buffer; + } + } + + done: + pvPtr->next = dst; + *termPtr = src; + *argcPtr = argc; + return TCL_OK; +} + +/* + *-------------------------------------------------------------- + * + * TclExpandParseValue -- + * + * This procedure is commonly used as the value of the + * expandProc in a ParseValue. It uses malloc to allocate + * more space for the result of a parse. + * + * Results: + * The buffer space in *pvPtr is reallocated to something + * larger, and if pvPtr->clientData is non-zero the old + * buffer is freed. Information is copied from the old + * buffer to the new one. + * + * Side effects: + * None. + * + *-------------------------------------------------------------- + */ + +void +TclExpandParseValue(pvPtr, needed) + register ParseValue *pvPtr; /* Information about buffer that + * must be expanded. If the clientData + * in the structure is non-zero, it + * means that the current buffer is + * dynamically allocated. */ + int needed; /* Minimum amount of additional space + * to allocate. */ +{ + int newSpace; + char *new; + + /* + * Either double the size of the buffer or add enough new space + * to meet the demand, whichever produces a larger new buffer. + */ + + newSpace = (pvPtr->end - pvPtr->buffer) + 1; + if (newSpace < needed) { + newSpace += needed; + } else { + newSpace += newSpace; + } + new = (char *) ckalloc((unsigned) newSpace); + + /* + * Copy from old buffer to new, free old buffer if needed, and + * mark new buffer as malloc-ed. + */ + + memcpy((VOID *) new, (VOID *) pvPtr->buffer, pvPtr->next - pvPtr->buffer); + pvPtr->next = new + (pvPtr->next - pvPtr->buffer); + if (pvPtr->clientData != 0) { + ckfree(pvPtr->buffer); + } + pvPtr->buffer = new; + pvPtr->end = new + newSpace - 1; + pvPtr->clientData = (ClientData) 1; +} + +/* + *---------------------------------------------------------------------- + * + * TclWordEnd -- + * + * Given a pointer into a Tcl command, find the end of the next + * word of the command. + * + * Results: + * The return value is a pointer to the last character that's part + * of the word pointed to by "start". If the word doesn't end + * properly within the string then the return value is the address + * of the null character at the end of the string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +TclWordEnd(start, nested, semiPtr) + char *start; /* Beginning of a word of a Tcl command. */ + int nested; /* Zero means this is a top-level command. + * One means this is a nested command (close + * brace is a word terminator). */ + int *semiPtr; /* Set to 1 if word ends with a command- + * terminating semi-colon, zero otherwise. + * If NULL then ignored. */ +{ + register char *p; + int count; + + if (semiPtr != NULL) { + *semiPtr = 0; + } + + /* + * Skip leading white space (backslash-newline must be treated like + * white-space, except that it better not be the last thing in the + * command). + */ + + for (p = start; ; p++) { + if (isspace(UCHAR(*p))) { + continue; + } + if ((p[0] == '\\') && (p[1] == '\n')) { + if (p[2] == 0) { + return p+2; + } + continue; + } + break; + } + + /* + * Handle words beginning with a double-quote or a brace. + */ + + if (*p == '"') { + p = QuoteEnd(p+1, '"'); + if (*p == 0) { + return p; + } + p++; + } else if (*p == '{') { + int braces = 1; + while (braces != 0) { + p++; + while (*p == '\\') { + (void) Tcl_Backslash(p, &count); + p += count; + } + if (*p == '}') { + braces--; + } else if (*p == '{') { + braces++; + } else if (*p == 0) { + return p; + } + } + p++; + } + + /* + * Handle words that don't start with a brace or double-quote. + * This code is also invoked if the word starts with a brace or + * double-quote and there is garbage after the closing brace or + * quote. This is an error as far as Tcl_Eval is concerned, but + * for here the garbage is treated as part of the word. + */ + + while (1) { + if (*p == '[') { + for (p++; *p != ']'; p++) { + p = TclWordEnd(p, 1, (int *) NULL); + if (*p == 0) { + return p; + } + } + p++; + } else if (*p == '\\') { + (void) Tcl_Backslash(p, &count); + p += count; + if ((*p == 0) && (count == 2) && (p[-1] == '\n')) { + return p; + } + } else if (*p == '$') { + p = VarNameEnd(p); + if (*p == 0) { + return p; + } + p++; + } else if (*p == ';') { + /* + * Include the semi-colon in the word that is returned. + */ + + if (semiPtr != NULL) { + *semiPtr = 1; + } + return p; + } else if (isspace(UCHAR(*p))) { + return p-1; + } else if ((*p == ']') && nested) { + return p-1; + } else if (*p == 0) { + if (nested) { + /* + * Nested commands can't end because of the end of the + * string. + */ + return p; + } + return p-1; + } else { + p++; + } + } +} + +/* + *---------------------------------------------------------------------- + * + * QuoteEnd -- + * + * Given a pointer to a string that obeys the parsing conventions + * for quoted things in Tcl, find the end of that quoted thing. + * The actual thing may be a quoted argument or a parenthesized + * index name. + * + * Results: + * The return value is a pointer to the last character that is + * part of the quoted string (i.e the character that's equal to + * term). If the quoted string doesn't terminate properly then + * the return value is a pointer to the null character at the + * end of the string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static char * +QuoteEnd(string, term) + char *string; /* Pointer to character just after opening + * "quote". */ + int term; /* This character will terminate the + * quoted string (e.g. '"' or ')'). */ +{ + register char *p = string; + int count; + + while (*p != term) { + if (*p == '\\') { + (void) Tcl_Backslash(p, &count); + p += count; + } else if (*p == '[') { + for (p++; *p != ']'; p++) { + p = TclWordEnd(p, 1, (int *) NULL); + if (*p == 0) { + return p; + } + } + p++; + } else if (*p == '$') { + p = VarNameEnd(p); + if (*p == 0) { + return p; + } + p++; + } else if (*p == 0) { + return p; + } else { + p++; + } + } + return p-1; +} + +/* + *---------------------------------------------------------------------- + * + * VarNameEnd -- + * + * Given a pointer to a variable reference using $-notation, find + * the end of the variable name spec. + * + * Results: + * The return value is a pointer to the last character that + * is part of the variable name. If the variable name doesn't + * terminate properly then the return value is a pointer to the + * null character at the end of the string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static char * +VarNameEnd(string) + char *string; /* Pointer to dollar-sign character. */ +{ + register char *p = string+1; + + if (*p == '{') { + for (p++; (*p != '}') && (*p != 0); p++) { + /* Empty loop body. */ + } + return p; + } + while (isalnum(UCHAR(*p)) || (*p == '_')) { + p++; + } + if ((*p == '(') && (p != string+1)) { + return QuoteEnd(p+1, ')'); + } + return p-1; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ParseVar -- + * + * Given a string starting with a $ sign, parse off a variable + * name and return its value. + * + * Results: + * The return value is the contents of the variable given by + * the leading characters of string. If termPtr isn't NULL, + * *termPtr gets filled in with the address of the character + * just after the last one in the variable specifier. If the + * variable doesn't exist, then the return value is NULL and + * an error message will be left in interp->result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_ParseVar(interp, string, termPtr) + Tcl_Interp *interp; /* Context for looking up variable. */ + register char *string; /* String containing variable name. + * First character must be "$". */ + char **termPtr; /* If non-NULL, points to word to fill + * in with character just after last + * one in the variable specifier. */ + +{ + char *name1, *name1End, c, *result; + register char *name2; +#define NUM_CHARS 200 + char copyStorage[NUM_CHARS]; + ParseValue pv; + + /* + * There are three cases: + * 1. The $ sign is followed by an open curly brace. Then the variable + * name is everything up to the next close curly brace, and the + * variable is a scalar variable. + * 2. The $ sign is not followed by an open curly brace. Then the + * variable name is everything up to the next character that isn't + * a letter, digit, or underscore. If the following character is an + * open parenthesis, then the information between parentheses is + * the array element name, which can include any of the substitutions + * permissible between quotes. + * 3. The $ sign is followed by something that isn't a letter, digit, + * or underscore: in this case, there is no variable name, and "$" + * is returned. + */ + + name2 = NULL; + string++; + if (*string == '{') { + string++; + name1 = string; + while (*string != '}') { + if (*string == 0) { + Tcl_SetResult(interp, "missing close-brace for variable name", + TCL_STATIC); + if (termPtr != 0) { + *termPtr = string; + } + return NULL; + } + string++; + } + name1End = string; + string++; + } else { + name1 = string; + while (isalnum(UCHAR(*string)) || (*string == '_')) { + string++; + } + if (string == name1) { + if (termPtr != 0) { + *termPtr = string; + } + return "$"; + } + name1End = string; + if (*string == '(') { + char *end; + + /* + * Perform substitutions on the array element name, just as + * is done for quotes. + */ + + pv.buffer = pv.next = copyStorage; + pv.end = copyStorage + NUM_CHARS - 1; + pv.expandProc = TclExpandParseValue; + pv.clientData = (ClientData) NULL; + if (TclParseQuotes(interp, string+1, ')', 0, &end, &pv) + != TCL_OK) { + char msg[100]; + sprintf(msg, "\n (parsing index for array \"%.*s\")", + string-name1, name1); + Tcl_AddErrorInfo(interp, msg); + result = NULL; + name2 = pv.buffer; + if (termPtr != 0) { + *termPtr = end; + } + goto done; + } + Tcl_ResetResult(interp); + string = end; + name2 = pv.buffer; + } + } + if (termPtr != 0) { + *termPtr = string; + } + + if (((Interp *) interp)->noEval) { + return ""; + } + c = *name1End; + *name1End = 0; + result = Tcl_GetVar2(interp, name1, name2, TCL_LEAVE_ERR_MSG); + *name1End = c; + + done: + if ((name2 != NULL) && (pv.buffer != copyStorage)) { + ckfree(pv.buffer); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CommandComplete -- + * + * Given a partial or complete Tcl command, this procedure + * determines whether the command is complete in the sense + * of having matched braces and quotes and brackets. + * + * Results: + * 1 is returned if the command is complete, 0 otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_CommandComplete(cmd) + char *cmd; /* Command to check. */ +{ + register char *p = cmd; + int commentOK = 1; + + while (1) { + while (isspace(UCHAR(*p))) { + if (*p == '\n') { + commentOK = 1; + } + p++; + } + if ((*p == '#') && commentOK) { + do { + p++; + } while ((*p != '\n') && (*p != 0)); + continue; + } + if (*p == 0) { + return 1; + } + p = TclWordEnd(p, 0, &commentOK); + if (*p == 0) { + return 0; + } + p++; + } +} diff --git a/vendor/x11iraf/obm/Tcl/tclProc.c b/vendor/x11iraf/obm/Tcl/tclProc.c new file mode 100644 index 00000000..6d290c51 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclProc.c @@ -0,0 +1,625 @@ +/* + * tclProc.c -- + * + * This file contains routines that implement Tcl procedures, + * including the "proc" and "uplevel" commands. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclProc.c,v 1.68 93/10/14 15:13:55 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" + +/* + * Forward references to procedures defined later in this file: + */ + +static void CleanupProc _ANSI_ARGS_((Proc *procPtr)); +static int InterpProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +static void ProcDeleteProc _ANSI_ARGS_((ClientData clientData)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_ProcCmd -- + * + * This procedure is invoked to process the "proc" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * A new procedure gets created. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ProcCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Interp *iPtr = (Interp *) interp; + register Proc *procPtr; + int result, argCount, i; + char **argArray = NULL; + Arg *lastArgPtr; + register Arg *argPtr = NULL; /* Initialization not needed, but + * prevents compiler warning. */ + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " name args body\"", (char *) NULL); + return TCL_ERROR; + } + + procPtr = (Proc *) ckalloc(sizeof(Proc)); + procPtr->iPtr = iPtr; + procPtr->refCount = 1; + procPtr->command = (char *) ckalloc((unsigned) strlen(argv[3]) + 1); + strcpy(procPtr->command, argv[3]); + procPtr->argPtr = NULL; + + /* + * Break up the argument list into argument specifiers, then process + * each argument specifier. + */ + + result = Tcl_SplitList(interp, argv[2], &argCount, &argArray); + if (result != TCL_OK) { + goto procError; + } + lastArgPtr = NULL; + for (i = 0; i < argCount; i++) { + int fieldCount, nameLength, valueLength; + char **fieldValues; + + /* + * Now divide the specifier up into name and default. + */ + + result = Tcl_SplitList(interp, argArray[i], &fieldCount, + &fieldValues); + if (result != TCL_OK) { + goto procError; + } + if (fieldCount > 2) { + ckfree((char *) fieldValues); + Tcl_AppendResult(interp, + "too many fields in argument specifier \"", + argArray[i], "\"", (char *) NULL); + result = TCL_ERROR; + goto procError; + } + if ((fieldCount == 0) || (*fieldValues[0] == 0)) { + ckfree((char *) fieldValues); + Tcl_AppendResult(interp, "procedure \"", argv[1], + "\" has argument with no name", (char *) NULL); + result = TCL_ERROR; + goto procError; + } + nameLength = strlen(fieldValues[0]) + 1; + if (fieldCount == 2) { + valueLength = strlen(fieldValues[1]) + 1; + } else { + valueLength = 0; + } + argPtr = (Arg *) ckalloc((unsigned) + (sizeof(Arg) - sizeof(argPtr->name) + nameLength + + valueLength)); + if (lastArgPtr == NULL) { + procPtr->argPtr = argPtr; + } else { + lastArgPtr->nextPtr = argPtr; + } + lastArgPtr = argPtr; + argPtr->nextPtr = NULL; + strcpy(argPtr->name, fieldValues[0]); + if (fieldCount == 2) { + argPtr->defValue = argPtr->name + nameLength; + strcpy(argPtr->defValue, fieldValues[1]); + } else { + argPtr->defValue = NULL; + } + ckfree((char *) fieldValues); + } + + Tcl_CreateCommand(interp, argv[1], InterpProc, (ClientData) procPtr, + ProcDeleteProc); + ckfree((char *) argArray); + return TCL_OK; + + procError: + ckfree(procPtr->command); + while (procPtr->argPtr != NULL) { + argPtr = procPtr->argPtr; + procPtr->argPtr = argPtr->nextPtr; + ckfree((char *) argPtr); + } + ckfree((char *) procPtr); + if (argArray != NULL) { + ckfree((char *) argArray); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * TclGetFrame -- + * + * Given a description of a procedure frame, such as the first + * argument to an "uplevel" or "upvar" command, locate the + * call frame for the appropriate level of procedure. + * + * Results: + * The return value is -1 if an error occurred in finding the + * frame (in this case an error message is left in interp->result). + * 1 is returned if string was either a number or a number preceded + * by "#" and it specified a valid frame. 0 is returned if string + * isn't one of the two things above (in this case, the lookup + * acts as if string were "1"). The variable pointed to by + * framePtrPtr is filled in with the address of the desired frame + * (unless an error occurs, in which case it isn't modified). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclGetFrame(interp, string, framePtrPtr) + Tcl_Interp *interp; /* Interpreter in which to find frame. */ + char *string; /* String describing frame. */ + CallFrame **framePtrPtr; /* Store pointer to frame here (or NULL + * if global frame indicated). */ +{ + register Interp *iPtr = (Interp *) interp; + int curLevel, level, result; + CallFrame *framePtr; + + /* + * Parse string to figure out which level number to go to. + */ + + result = 1; + curLevel = (iPtr->varFramePtr == NULL) ? 0 : iPtr->varFramePtr->level; + if (*string == '#') { + if (Tcl_GetInt(interp, string+1, &level) != TCL_OK) { + return -1; + } + if (level < 0) { + levelError: + Tcl_AppendResult(interp, "bad level \"", string, "\"", + (char *) NULL); + return -1; + } + } else if (isdigit(UCHAR(*string))) { + if (Tcl_GetInt(interp, string, &level) != TCL_OK) { + return -1; + } + level = curLevel - level; + } else { + level = curLevel - 1; + result = 0; + } + + /* + * Figure out which frame to use, and modify the interpreter so + * its variables come from that frame. + */ + + if (level == 0) { + framePtr = NULL; + } else { + for (framePtr = iPtr->varFramePtr; framePtr != NULL; + framePtr = framePtr->callerVarPtr) { + if (framePtr->level == level) { + break; + } + } + if (framePtr == NULL) { + goto levelError; + } + } + *framePtrPtr = framePtr; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UplevelCmd -- + * + * This procedure is invoked to process the "uplevel" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_UplevelCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Interp *iPtr = (Interp *) interp; + int result; + CallFrame *savedVarFramePtr, *framePtr; + + if (argc < 2) { + uplevelSyntax: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?level? command ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Find the level to use for executing the command. + */ + + result = TclGetFrame(interp, argv[1], &framePtr); + if (result == -1) { + return TCL_ERROR; + } + argc -= (result+1); + if (argc == 0) { + goto uplevelSyntax; + } + argv += (result+1); + + /* + * Modify the interpreter state to execute in the given frame. + */ + + savedVarFramePtr = iPtr->varFramePtr; + iPtr->varFramePtr = framePtr; + + /* + * Execute the residual arguments as a command. + */ + + if (argc == 1) { + result = Tcl_Eval(interp, argv[0]); + } else { + char *cmd; + + cmd = Tcl_Concat(argc, argv); + result = Tcl_Eval(interp, cmd); + ckfree(cmd); + } + if (result == TCL_ERROR) { + char msg[60]; + sprintf(msg, "\n (\"uplevel\" body line %d)", interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + + /* + * Restore the variable frame, and return. + */ + + iPtr->varFramePtr = savedVarFramePtr; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * TclFindProc -- + * + * Given the name of a procedure, return a pointer to the + * record describing the procedure. + * + * Results: + * NULL is returned if the name doesn't correspond to any + * procedure. Otherwise the return value is a pointer to + * the procedure's record. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Proc * +TclFindProc(iPtr, procName) + Interp *iPtr; /* Interpreter in which to look. */ + char *procName; /* Name of desired procedure. */ +{ + Tcl_HashEntry *hPtr; + Command *cmdPtr; + + hPtr = Tcl_FindHashEntry(&iPtr->commandTable, procName); + if (hPtr == NULL) { + return NULL; + } + cmdPtr = (Command *) Tcl_GetHashValue(hPtr); + if (cmdPtr->proc != InterpProc) { + return NULL; + } + return (Proc *) cmdPtr->clientData; +} + +/* + *---------------------------------------------------------------------- + * + * TclIsProc -- + * + * Tells whether a command is a Tcl procedure or not. + * + * Results: + * If the given command is actuall a Tcl procedure, the + * return value is the address of the record describing + * the procedure. Otherwise the return value is 0. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Proc * +TclIsProc(cmdPtr) + Command *cmdPtr; /* Command to test. */ +{ + if (cmdPtr->proc == InterpProc) { + return (Proc *) cmdPtr->clientData; + } + return (Proc *) 0; +} + +/* + *---------------------------------------------------------------------- + * + * InterpProc -- + * + * When a Tcl procedure gets invoked, this routine gets invoked + * to interpret the procedure. + * + * Results: + * A standard Tcl result value, usually TCL_OK. + * + * Side effects: + * Depends on the commands in the procedure. + * + *---------------------------------------------------------------------- + */ + +static int +InterpProc(clientData, interp, argc, argv) + ClientData clientData; /* Record describing procedure to be + * interpreted. */ + Tcl_Interp *interp; /* Interpreter in which procedure was + * invoked. */ + int argc; /* Count of number of arguments to this + * procedure. */ + char **argv; /* Argument values. */ +{ + register Proc *procPtr = (Proc *) clientData; + register Arg *argPtr; + register Interp *iPtr; + char **args; + CallFrame frame; + char *value; + int result; + + /* + * Set up a call frame for the new procedure invocation. + */ + + iPtr = procPtr->iPtr; + Tcl_InitHashTable(&frame.varTable, TCL_STRING_KEYS); + if (iPtr->varFramePtr != NULL) { + frame.level = iPtr->varFramePtr->level + 1; + } else { + frame.level = 1; + } + frame.argc = argc; + frame.argv = argv; + frame.callerPtr = iPtr->framePtr; + frame.callerVarPtr = iPtr->varFramePtr; + iPtr->framePtr = &frame; + iPtr->varFramePtr = &frame; + iPtr->returnCode = TCL_OK; + + /* + * Match the actual arguments against the procedure's formal + * parameters to compute local variables. + */ + + for (argPtr = procPtr->argPtr, args = argv+1, argc -= 1; + argPtr != NULL; + argPtr = argPtr->nextPtr, args++, argc--) { + + /* + * Handle the special case of the last formal being "args". When + * it occurs, assign it a list consisting of all the remaining + * actual arguments. + */ + + if ((argPtr->nextPtr == NULL) + && (strcmp(argPtr->name, "args") == 0)) { + if (argc < 0) { + argc = 0; + } + value = Tcl_Merge(argc, args); + Tcl_SetVar(interp, argPtr->name, value, 0); + ckfree(value); + argc = 0; + break; + } else if (argc > 0) { + value = *args; + } else if (argPtr->defValue != NULL) { + value = argPtr->defValue; + } else { + Tcl_AppendResult(interp, "no value given for parameter \"", + argPtr->name, "\" to \"", argv[0], "\"", + (char *) NULL); + result = TCL_ERROR; + goto procDone; + } + Tcl_SetVar(interp, argPtr->name, value, 0); + } + if (argc > 0) { + Tcl_AppendResult(interp, "called \"", argv[0], + "\" with too many arguments", (char *) NULL); + result = TCL_ERROR; + goto procDone; + } + + /* + * Invoke the commands in the procedure's body. + */ + + procPtr->refCount++; + result = Tcl_Eval(interp, procPtr->command); + procPtr->refCount--; + if (procPtr->refCount <= 0) { + CleanupProc(procPtr); + } + if (result == TCL_RETURN) { + result = iPtr->returnCode; + iPtr->returnCode = TCL_OK; + if (result == TCL_ERROR) { + Tcl_SetVar2(interp, "errorCode", (char *) NULL, + (iPtr->errorCode != NULL) ? iPtr->errorCode : "NONE", + TCL_GLOBAL_ONLY); + iPtr->flags |= ERROR_CODE_SET; + if (iPtr->errorInfo != NULL) { + Tcl_SetVar2(interp, "errorInfo", (char *) NULL, + iPtr->errorInfo, TCL_GLOBAL_ONLY); + iPtr->flags |= ERR_IN_PROGRESS; + } + } + } else if (result == TCL_ERROR) { + char msg[100]; + + /* + * Record information telling where the error occurred. + */ + + sprintf(msg, "\n (procedure \"%.50s\" line %d)", argv[0], + iPtr->errorLine); + Tcl_AddErrorInfo(interp, msg); + } else if (result == TCL_BREAK) { + iPtr->result = "invoked \"break\" outside of a loop"; + result = TCL_ERROR; + } else if (result == TCL_CONTINUE) { + iPtr->result = "invoked \"continue\" outside of a loop"; + result = TCL_ERROR; + } + + /* + * Delete the call frame for this procedure invocation (it's + * important to remove the call frame from the interpreter + * before deleting it, so that traces invoked during the + * deletion don't see the partially-deleted frame). + */ + + procDone: + iPtr->framePtr = frame.callerPtr; + iPtr->varFramePtr = frame.callerVarPtr; + TclDeleteVars(iPtr, &frame.varTable); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * ProcDeleteProc -- + * + * This procedure is invoked just before a command procedure is + * removed from an interpreter. Its job is to release all the + * resources allocated to the procedure. + * + * Results: + * None. + * + * Side effects: + * Memory gets freed, unless the procedure is actively being + * executed. In this case the cleanup is delayed until the + * last call to the current procedure completes. + * + *---------------------------------------------------------------------- + */ + +static void +ProcDeleteProc(clientData) + ClientData clientData; /* Procedure to be deleted. */ +{ + Proc *procPtr = (Proc *) clientData; + + procPtr->refCount--; + if (procPtr->refCount <= 0) { + CleanupProc(procPtr); + } +} + +/* + *---------------------------------------------------------------------- + * + * CleanupProc -- + * + * This procedure does all the real work of freeing up a Proc + * structure. It's called only when the structure's reference + * count becomes zero. + * + * Results: + * None. + * + * Side effects: + * Memory gets freed. + * + *---------------------------------------------------------------------- + */ + +static void +CleanupProc(procPtr) + register Proc *procPtr; /* Procedure to be deleted. */ +{ + register Arg *argPtr; + + ckfree((char *) procPtr->command); + for (argPtr = procPtr->argPtr; argPtr != NULL; ) { + Arg *nextPtr = argPtr->nextPtr; + + ckfree((char *) argPtr); + argPtr = nextPtr; + } + ckfree((char *) procPtr); +} diff --git a/vendor/x11iraf/obm/Tcl/tclRegexp.h b/vendor/x11iraf/obm/Tcl/tclRegexp.h new file mode 100644 index 00000000..c3460006 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclRegexp.h @@ -0,0 +1,30 @@ +/* + * Definitions etc. for regexp(3) routines. + * + * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], + * not the System V one. + */ + +#ifndef _TCL +#include "tcl.h" +#endif +#ifndef _REGEXP +#define _REGEXP 1 + +#define NSUBEXP 10 +typedef struct regexp { + char *startp[NSUBEXP]; + char *endp[NSUBEXP]; + char regstart; /* Internal use only. */ + char reganch; /* Internal use only. */ + char *regmust; /* Internal use only. */ + int regmlen; /* Internal use only. */ + char program[1]; /* Unwarranted chumminess with compiler. */ +} regexp; + +extern regexp *TclRegComp _ANSI_ARGS_((char *exp)); +extern int TclRegExec _ANSI_ARGS_((regexp *prog, char *string, char *start)); +extern void TclRegSub _ANSI_ARGS_((regexp *prog, char *source, char *dest)); +extern void TclRegError _ANSI_ARGS_((char *msg)); + +#endif /* REGEXP */ diff --git a/vendor/x11iraf/obm/Tcl/tclTest.c b/vendor/x11iraf/obm/Tcl/tclTest.c new file mode 100644 index 00000000..c3b19f35 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclTest.c @@ -0,0 +1,786 @@ +/* + * tclTest.c -- + * + * This file contains C command procedures for a bunch of additional + * Tcl commands that are used for testing out Tcl's C interfaces. + * These commands are not normally included in Tcl applications; + * they're only used for testing. + * + * Copyright (c) 1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclTest.c,v 1.15 93/09/09 16:46:52 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + * The following variable is a special hack that allows applications + * to be linked using the procedure "main" from the Tcl library. The + * variable generates a reference to "main", which causes main to + * be brought in from the library (and all of Tcl with it). + */ + +extern int main(); +int *tclDummyMainPtr = (int *) main; + +/* + * Dynamic string shared by TestdcallCmd and DelCallbackProc; used + * to collect the results of the various deletion callbacks. + */ + +static Tcl_DString delString; +static Tcl_Interp *delInterp; + +/* + * One of the following structures exists for each asynchronous + * handler created by the "testasync" command". + */ + +typedef struct TestAsyncHandler { + int id; /* Identifier for this handler. */ + Tcl_AsyncHandler handler; /* Tcl's token for the handler. */ + char *command; /* Command to invoke when the + * handler is invoked. */ + struct TestAsyncHandler *nextPtr; /* Next is list of handlers. */ +} TestAsyncHandler; + +static TestAsyncHandler *firstHandler = NULL; + +/* + * The variable below is a token for an asynchronous handler for + * interrupt signals, or NULL if none exists. + */ + +static Tcl_AsyncHandler intHandler; + +/* + * The dynamic string below is used by the "testdstring" command + * to test the dynamic string facilities. + */ + +static Tcl_DString dstring; + +/* + * Forward declarations for procedures defined later in this file: + */ + +static int AsyncHandlerProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int code)); +static void CmdDelProc1 _ANSI_ARGS_((ClientData clientData)); +static void CmdDelProc2 _ANSI_ARGS_((ClientData clientData)); +static int CmdProc1 _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +static int CmdProc2 _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int argc, char **argv)); +static void DelCallbackProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp)); +static int IntHandlerProc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, int code)); +static void IntProc(); +static int TestasyncCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int argc, char **argv)); +static int TestcmdinfoCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int argc, char **argv)); +static int TestdcallCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int argc, char **argv)); +static int TestdstringCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int argc, char **argv)); +static int TestlinkCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int argc, char **argv)); +static int TestMathFunc _ANSI_ARGS_((ClientData clientData, + Tcl_Interp *interp, Tcl_Value *args, + Tcl_Value *resultPtr)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit(interp) + Tcl_Interp *interp; /* Interpreter for application. */ +{ + /* + * Call the init procedures for included packages. Each call should + * look like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. + */ + + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + /* + * Create additional commands and math functions for testing Tcl. + */ + + Tcl_CreateCommand(interp, "testasync", TestasyncCmd, (ClientData) 0, + (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateCommand(interp, "testcmdinfo", TestcmdinfoCmd, (ClientData) 0, + (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateCommand(interp, "testdcall", TestdcallCmd, (ClientData) 0, + (Tcl_CmdDeleteProc *) NULL); + Tcl_DStringInit(&dstring); + Tcl_CreateCommand(interp, "testdstring", TestdstringCmd, (ClientData) 0, + (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateCommand(interp, "testlink", TestlinkCmd, (ClientData) 0, + (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateMathFunc(interp, "T1", 0, (Tcl_ValueType *) NULL, TestMathFunc, + (ClientData) 123); + Tcl_CreateMathFunc(interp, "T2", 0, (Tcl_ValueType *) NULL, TestMathFunc, + (ClientData) 345); + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. If this line is deleted then no user-specific + * startup file will be run under any conditions. + */ + + tcl_RcFileName = "~/.tclshrc"; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TestasyncCmd -- + * + * This procedure implements the "testasync" command. It is used + * to test the asynchronous handler facilities of Tcl. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * Creates, deletes, and invokes handlers. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestasyncCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + TestAsyncHandler *asyncPtr, *prevPtr; + int id, code; + static int nextId = 1; + + if (argc < 2) { + wrongNumArgs: + interp->result = "wrong # args"; + return TCL_ERROR; + } + if (strcmp(argv[1], "create") == 0) { + if (argc != 3) { + goto wrongNumArgs; + } + asyncPtr = (TestAsyncHandler *) ckalloc(sizeof(TestAsyncHandler)); + asyncPtr->id = nextId; + nextId++; + asyncPtr->handler = Tcl_AsyncCreate(AsyncHandlerProc, + (ClientData) asyncPtr); + asyncPtr->command = ckalloc((unsigned) (strlen(argv[2]) + 1)); + strcpy(asyncPtr->command, argv[2]); + asyncPtr->nextPtr = firstHandler; + firstHandler = asyncPtr; + sprintf(interp->result, "%d", asyncPtr->id); + } else if (strcmp(argv[1], "delete") == 0) { + if (argc == 2) { + while (firstHandler != NULL) { + asyncPtr = firstHandler; + firstHandler = asyncPtr->nextPtr; + Tcl_AsyncDelete(asyncPtr->handler); + ckfree(asyncPtr->command); + ckfree((char *) asyncPtr); + } + return TCL_OK; + } + if (argc != 3) { + goto wrongNumArgs; + } + if (Tcl_GetInt(interp, argv[2], &id) != TCL_OK) { + return TCL_ERROR; + } + for (prevPtr = NULL, asyncPtr = firstHandler; asyncPtr != NULL; + prevPtr = asyncPtr, asyncPtr = asyncPtr->nextPtr) { + if (asyncPtr->id != id) { + continue; + } + if (prevPtr == NULL) { + firstHandler = asyncPtr->nextPtr; + } else { + prevPtr->nextPtr = asyncPtr->nextPtr; + } + Tcl_AsyncDelete(asyncPtr->handler); + ckfree(asyncPtr->command); + ckfree((char *) asyncPtr); + break; + } + } else if (strcmp(argv[1], "int") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + intHandler = Tcl_AsyncCreate(IntHandlerProc, (ClientData) interp); + signal(SIGINT, IntProc); + } else if (strcmp(argv[1], "mark") == 0) { + if (argc != 5) { + goto wrongNumArgs; + } + if ((Tcl_GetInt(interp, argv[2], &id) != TCL_OK) + || (Tcl_GetInt(interp, argv[4], &code) != TCL_OK)) { + return TCL_ERROR; + } + for (asyncPtr = firstHandler; asyncPtr != NULL; + asyncPtr = asyncPtr->nextPtr) { + if (asyncPtr->id == id) { + Tcl_AsyncMark(asyncPtr->handler); + break; + } + } + Tcl_SetResult(interp, argv[3], TCL_VOLATILE); + return code; + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": must be create, delete, int, or mark", + (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +static int +AsyncHandlerProc(clientData, interp, code) + ClientData clientData; /* Pointer to TestAsyncHandler structure. */ + Tcl_Interp *interp; /* Interpreter in which command was + * executed, or NULL. */ + int code; /* Current return code from command. */ +{ + TestAsyncHandler *asyncPtr = (TestAsyncHandler *) clientData; + char *listArgv[4]; + char string[20], *cmd; + + sprintf(string, "%d", code); + listArgv[0] = asyncPtr->command; + listArgv[1] = interp->result; + listArgv[2] = string; + listArgv[3] = NULL; + cmd = Tcl_Merge(3, listArgv); + code = Tcl_Eval(interp, cmd); + ckfree(cmd); + return code; +} + +static void +IntProc() +{ + Tcl_AsyncMark(intHandler); +} + +static int +IntHandlerProc(clientData, interp, code) + ClientData clientData; /* Interpreter in which to invoke command. */ + Tcl_Interp *interp; /* Interpreter in which command was + * executed, or NULL. */ + int code; /* Current return code from command. */ +{ + char *listArgv[4]; + char string[20], *cmd; + + interp = (Tcl_Interp *) clientData; + listArgv[0] = Tcl_GetVar(interp, "sigIntCmd", TCL_GLOBAL_ONLY); + if (listArgv[0] == NULL) { + return code; + } + listArgv[1] = interp->result; + sprintf(string, "%d", code); + listArgv[2] = string; + listArgv[3] = NULL; + cmd = Tcl_Merge(3, listArgv); + code = Tcl_Eval(interp, cmd); + ckfree(cmd); + return code; +} + +/* + *---------------------------------------------------------------------- + * + * TestdcallCmd -- + * + * This procedure implements the "testdcall" command. It is used + * to test Tcl_CallWhenDeleted. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * Creates and deletes interpreters. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestdcallCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i, id; + + delInterp = Tcl_CreateInterp(); + Tcl_DStringInit(&delString); + for (i = 1; i < argc; i++) { + if (Tcl_GetInt(interp, argv[i], &id) != TCL_OK) { + return TCL_ERROR; + } + if (id < 0) { + Tcl_DontCallWhenDeleted(delInterp, DelCallbackProc, + (ClientData) (-id)); + } else { + Tcl_CallWhenDeleted(delInterp, DelCallbackProc, + (ClientData) id); + } + } + Tcl_DeleteInterp(delInterp); + Tcl_DStringResult(interp, &delString); + return TCL_OK; +} + +/* + * The deletion callback used by TestdcallCmd: + */ + +static void +DelCallbackProc(clientData, interp) + ClientData clientData; /* Numerical value to append to + * delString. */ + Tcl_Interp *interp; /* Interpreter being deleted. */ +{ + int id = (int) clientData; + char buffer[10]; + + sprintf(buffer, "%d", id); + Tcl_DStringAppendElement(&delString, buffer); + if (interp != delInterp) { + Tcl_DStringAppendElement(&delString, "bogus interpreter argument!"); + } +} + +/* + *---------------------------------------------------------------------- + * + * TestcmdinfoCmd -- + * + * This procedure implements the "testcmdinfo" command. It is used + * to test Tcl_GetCmdInfo, Tcl_SetCmdInfo, and command creation + * and deletion. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * Creates and deletes various commands and modifies their data. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestcmdinfoCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + Tcl_CmdInfo info; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " option cmdName\"", (char *) NULL); + return TCL_ERROR; + } + if (strcmp(argv[1], "create") == 0) { + Tcl_CreateCommand(interp, argv[2], CmdProc1, (ClientData) "original", + CmdDelProc1); + } else if (strcmp(argv[1], "delete") == 0) { + Tcl_DStringInit(&delString); + Tcl_DeleteCommand(interp, argv[2]); + Tcl_DStringResult(interp, &delString); + } else if (strcmp(argv[1], "get") == 0) { + if (Tcl_GetCommandInfo(interp, argv[2], &info) ==0) { + interp->result = "??"; + return TCL_OK; + } + if (info.proc == CmdProc1) { + Tcl_AppendResult(interp, "CmdProc1", " ", + (char *) info.clientData, (char *) NULL); + } else if (info.proc == CmdProc2) { + Tcl_AppendResult(interp, "CmdProc2", " ", + (char *) info.clientData, (char *) NULL); + } else { + Tcl_AppendResult(interp, "unknown", (char *) NULL); + } + if (info.deleteProc == CmdDelProc1) { + Tcl_AppendResult(interp, " CmdDelProc1", " ", + (char *) info.deleteData, (char *) NULL); + } else if (info.deleteProc == CmdDelProc2) { + Tcl_AppendResult(interp, " CmdDelProc2", " ", + (char *) info.deleteData, (char *) NULL); + } else { + Tcl_AppendResult(interp, " unknown", (char *) NULL); + } + } else if (strcmp(argv[1], "modify") == 0) { + info.proc = CmdProc2; + info.clientData = (ClientData) "new_command_data"; + info.deleteProc = CmdDelProc2; + info.deleteData = (ClientData) "new_delete_data"; + if (Tcl_SetCommandInfo(interp, argv[2], &info) == 0) { + interp->result = "0"; + } else { + interp->result = "1"; + } + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": must be create, delete, get, or modify", + (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + + /*ARGSUSED*/ +static int +CmdProc1(clientData, interp, argc, argv) + ClientData clientData; /* String to return. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + Tcl_AppendResult(interp, "CmdProc1 ", (char *) clientData, + (char *) NULL); + return TCL_OK; +} + + /*ARGSUSED*/ +static int +CmdProc2(clientData, interp, argc, argv) + ClientData clientData; /* String to return. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + Tcl_AppendResult(interp, "CmdProc2 ", (char *) clientData, + (char *) NULL); + return TCL_OK; +} + +static void +CmdDelProc1(clientData) + ClientData clientData; /* String to save. */ +{ + Tcl_DStringInit(&delString); + Tcl_DStringAppend(&delString, "CmdDelProc1 ", -1); + Tcl_DStringAppend(&delString, (char *) clientData, -1); +} + +static void +CmdDelProc2(clientData) + ClientData clientData; /* String to save. */ +{ + Tcl_DStringInit(&delString); + Tcl_DStringAppend(&delString, "CmdDelProc2 ", -1); + Tcl_DStringAppend(&delString, (char *) clientData, -1); +} + +/* + *---------------------------------------------------------------------- + * + * TestdstringCmd -- + * + * This procedure implements the "testdstring" command. It is used + * to test the dynamic string facilities of Tcl. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * Creates, deletes, and invokes handlers. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestdstringCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int count; + + if (argc < 2) { + wrongNumArgs: + interp->result = "wrong # args"; + return TCL_ERROR; + } + if (strcmp(argv[1], "append") == 0) { + if (argc != 4) { + goto wrongNumArgs; + } + if (Tcl_GetInt(interp, argv[3], &count) != TCL_OK) { + return TCL_ERROR; + } + Tcl_DStringAppend(&dstring, argv[2], count); + } else if (strcmp(argv[1], "element") == 0) { + if (argc != 3) { + goto wrongNumArgs; + } + Tcl_DStringAppendElement(&dstring, argv[2]); + } else if (strcmp(argv[1], "end") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + Tcl_DStringEndSublist(&dstring); + } else if (strcmp(argv[1], "free") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + Tcl_DStringFree(&dstring); + } else if (strcmp(argv[1], "get") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + interp->result = Tcl_DStringValue(&dstring); + } else if (strcmp(argv[1], "length") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + sprintf(interp->result, "%d", Tcl_DStringLength(&dstring)); + } else if (strcmp(argv[1], "result") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + Tcl_DStringResult(interp, &dstring); + } else if (strcmp(argv[1], "trunc") == 0) { + if (argc != 3) { + goto wrongNumArgs; + } + if (Tcl_GetInt(interp, argv[2], &count) != TCL_OK) { + return TCL_ERROR; + } + Tcl_DStringTrunc(&dstring, count); + } else if (strcmp(argv[1], "start") == 0) { + if (argc != 2) { + goto wrongNumArgs; + } + Tcl_DStringStartSublist(&dstring); + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": must be append, element, end, free, get, length, ", + "result, trunc, or start", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TestlinkCmd -- + * + * This procedure implements the "testlink" command. It is used + * to test Tcl_LinkVar and related library procedures. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * Creates and deletes various variable links, plus returns + * values of the linked variables. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestlinkCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + static int intVar = 43; + static int boolVar = 4; + static double realVar = 1.23; + static char *stringVar = NULL; + char buffer[TCL_DOUBLE_SPACE]; + int writable, flag; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " option ?arg arg arg?\"", (char *) NULL); + return TCL_ERROR; + } + if (strcmp(argv[1], "create") == 0) { + if (Tcl_GetBoolean(interp, argv[2], &writable) != TCL_OK) { + return TCL_ERROR; + } + flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY; + if (Tcl_LinkVar(interp, "int", (char *) &intVar, + TCL_LINK_INT | flag) != TCL_OK) { + return TCL_ERROR; + } + if (Tcl_GetBoolean(interp, argv[3], &writable) != TCL_OK) { + return TCL_ERROR; + } + flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY; + if (Tcl_LinkVar(interp, "real", (char *) &realVar, + TCL_LINK_DOUBLE | flag) != TCL_OK) { + return TCL_ERROR; + } + if (Tcl_GetBoolean(interp, argv[4], &writable) != TCL_OK) { + return TCL_ERROR; + } + flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY; + if (Tcl_LinkVar(interp, "bool", (char *) &boolVar, + TCL_LINK_BOOLEAN | flag) != TCL_OK) { + return TCL_ERROR; + } + if (Tcl_GetBoolean(interp, argv[5], &writable) != TCL_OK) { + return TCL_ERROR; + } + flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY; + if (Tcl_LinkVar(interp, "string", (char *) &stringVar, + TCL_LINK_STRING | flag) != TCL_OK) { + return TCL_ERROR; + } + } else if (strcmp(argv[1], "delete") == 0) { + Tcl_UnlinkVar(interp, "int"); + Tcl_UnlinkVar(interp, "real"); + Tcl_UnlinkVar(interp, "bool"); + Tcl_UnlinkVar(interp, "string"); + } else if (strcmp(argv[1], "get") == 0) { + sprintf(buffer, "%d", intVar); + Tcl_AppendElement(interp, buffer); + Tcl_PrintDouble(interp, realVar, buffer); + Tcl_AppendElement(interp, buffer); + sprintf(buffer, "%d", boolVar); + Tcl_AppendElement(interp, buffer); + Tcl_AppendElement(interp, (stringVar == NULL) ? "-" : stringVar); + } else if (strcmp(argv[1], "set") == 0) { + if (argc != 6) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " ", argv[1], + "intValue realValue boolValue stringValue\"", (char *) NULL); + return TCL_ERROR; + } + if (argv[2][0] != 0) { + if (Tcl_GetInt(interp, argv[2], &intVar) != TCL_OK) { + return TCL_ERROR; + } + } + if (argv[3][0] != 0) { + if (Tcl_GetDouble(interp, argv[3], &realVar) != TCL_OK) { + return TCL_ERROR; + } + } + if (argv[4][0] != 0) { + if (Tcl_GetInt(interp, argv[4], &boolVar) != TCL_OK) { + return TCL_ERROR; + } + } + if (argv[5][0] != 0) { + if (stringVar != NULL) { + ckfree(stringVar); + } + if (strcmp(argv[5], "-") == 0) { + stringVar = NULL; + } else { + stringVar = ckalloc((unsigned) (strlen(argv[5]) + 1)); + strcpy(stringVar, argv[5]); + } + } + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be create, delete, get, or set", + (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TestMathFunc -- + * + * This is a user-defined math procedure to test out math procedures + * with no arguments. + * + * Results: + * A normal Tcl completion code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static int +TestMathFunc(clientData, interp, args, resultPtr) + ClientData clientData; /* Integer value to return. */ + Tcl_Interp *interp; /* Not used. */ + Tcl_Value *args; /* Not used. */ + Tcl_Value *resultPtr; /* Where to store result. */ +{ + resultPtr->type = TCL_INT; + resultPtr->intValue = (int) clientData; + return TCL_OK; +} diff --git a/vendor/x11iraf/obm/Tcl/tclUnix.h b/vendor/x11iraf/obm/Tcl/tclUnix.h new file mode 100644 index 00000000..343b0253 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclUnix.h @@ -0,0 +1,285 @@ +/* + * tclUnix.h -- + * + * This file reads in UNIX-related header files and sets up + * UNIX-related macros for Tcl's UNIX core. It should be the + * only file that contains #ifdefs to handle different flavors + * of UNIX. This file sets up the union of all UNIX-related + * things needed by any of the Tcl core files. This file + * depends on configuration #defines in tclConfig.h + * + * Much of the material in this file was originally contributed + * by Karl Lehenbauer, Mark Diekhans and Peter da Silva. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * $Header: /user6/ouster/tcl/RCS/tclUnix.h,v 1.46 93/10/28 16:32:28 ouster Exp $ SPRITE (Berkeley) + */ + +#ifndef _TCLUNIX +#define _TCLUNIX + +#include <errno.h> +#include <fcntl.h> +#include <pwd.h> +#include <signal.h> +#include <sys/param.h> +#include <sys/types.h> +#ifdef USE_DIRENT2_H +# include "compat/dirent2.h" +#else +# ifdef NO_DIRENT_H +# include "compat/dirent.h" +# else +# include <dirent.h> +# endif +#endif +#include <sys/file.h> +#include <sys/stat.h> +#ifndef NO_SYS_TIME_H +# include <sys/time.h> +#else +# include <time.h> +#endif +#ifndef NO_SYS_WAIT_H +# include <sys/wait.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#else +# include "compat/unistd.h" +#endif + +/* + * Not all systems declare the errno variable in errno.h. so this + * file does it explicitly. The list of system error messages also + * isn't generally declared in a header file anywhere. + */ + +extern int errno; + +/* + * The type of the status returned by wait varies from UNIX system + * to UNIX system. The macro below defines it: + */ + +#ifdef AIX +# define WAIT_STATUS_TYPE pid_t +#else +#ifndef NO_UNION_WAIT +# define WAIT_STATUS_TYPE union wait +#else +# define WAIT_STATUS_TYPE int +#endif +#endif + +/* + * Supply definitions for macros to query wait status, if not already + * defined in header files above. + */ + +#ifndef WIFEXITED +# define WIFEXITED(stat) (((*((int *) &(stat))) & 0xff) == 0) +#endif + +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xff) +#endif + +#ifndef WIFSIGNALED +# define WIFSIGNALED(stat) (((*((int *) &(stat)))) && ((*((int *) &(stat))) == ((*((int *) &(stat))) & 0x00ff))) +#endif + +#ifndef WTERMSIG +# define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7f) +#endif + +#ifndef WIFSTOPPED +# define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xff) == 0177) +#endif + +#ifndef WSTOPSIG +# define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xff) +#endif + +/* + * Supply macros for seek offsets, if they're not already provided by + * an include file. + */ + +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + +#ifndef SEEK_CUR +# define SEEK_CUR 1 +#endif + +#ifndef SEEK_END +# define SEEK_END 2 +#endif + +/* + * The stuff below is needed by the "time" command. If this + * system has no gettimeofday call, then must use times and the + * CLK_TCK #define (from sys/param.h) to compute elapsed time. + * Unfortunately, some systems only have HZ and no CLK_TCK, and + * some might not even have HZ. + */ + +#ifdef NO_GETTOD +# include <sys/times.h> +# include <sys/param.h> +# ifndef CLK_TCK +# ifdef HZ +# define CLK_TCK HZ +# else +# define CLK_TCK 60 +# endif +# endif +#endif + +/* + * Define access mode constants if they aren't already defined. + */ + +#ifndef F_OK +# define F_OK 00 +#endif +#ifndef X_OK +# define X_OK 01 +#endif +#ifndef W_OK +# define W_OK 02 +#endif +#ifndef R_OK +# define R_OK 04 +#endif + +/* + * On systems without symbolic links (i.e. S_IFLNK isn't defined) + * define "lstat" to use "stat" instead. + */ + +#ifndef S_IFLNK +# define lstat stat +#endif + +/* + * Define macros to query file type bits, if they're not already + * defined. + */ + +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +# endif +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +# endif +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +# endif +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +# endif +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +# endif +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +# endif +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +# endif + +/* + * Make sure that MAXPATHLEN is defined. + */ + +#ifndef MAXPATHLEN +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN 2048 +# endif +#endif + +/* + * Make sure that L_tmpnam is defined. + */ + +#ifndef L_tmpnam +# define L_tmpnam 100 +#endif + +/* + * Substitute Tcl's own versions for several system calls. The + * Tcl versions retry automatically if interrupted by signals. + * (see tclUnixUtil.c). + */ + +#define open(a,b,c) TclOpen(a,b,c) +#define read(a,b,c) TclRead(a,b,c) +#define waitpid(a,b,c) TclWaitpid(a,b,c) +#define write(a,b,c) TclWrite(a,b,c) +EXTERN int TclOpen _ANSI_ARGS_((char *path, int oflag, int mode)); +EXTERN int TclRead _ANSI_ARGS_((int fd, VOID *buf, size_t numBytes)); +EXTERN int TclWaitpid _ANSI_ARGS_((pid_t pid, int *statPtr, int options)); +EXTERN int TclWrite _ANSI_ARGS_((int fd, VOID *buf, size_t numBytes)); + +/* + * Variables provided by the C library: + */ + +#if defined(_sgi) || defined(__sgi) +#define environ _environ +#endif +extern char **environ; + +#endif /* _TCLUNIX */ diff --git a/vendor/x11iraf/obm/Tcl/tclUnixAZ.c b/vendor/x11iraf/obm/Tcl/tclUnixAZ.c new file mode 100644 index 00000000..765b7f03 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclUnixAZ.c @@ -0,0 +1,1998 @@ +/* + * tclUnixAZ.c -- + * + * This file contains the top-level command procedures for + * commands in the Tcl core that require UNIX facilities + * such as files and process execution. Much of the code + * in this file is based on earlier versions contributed + * by Karl Lehenbauer, Mark Diekhans and Peter da Silva. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUnixAZ.c,v 1.70 93/09/24 16:47:39 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + * The variable below caches the name of the current working directory + * in order to avoid repeated calls to getcwd. The string is malloc-ed. + * NULL means the cache needs to be refreshed. + */ + +static char *currentDir = NULL; + +/* + * If the system doesn't define the EWOULDBLOCK errno, just #define it + * to a bogus value that will never occur. + */ + +#ifndef EWOULDBLOCK +#define EWOULDBLOCK -1901 +#endif + +/* + * Prototypes for local procedures defined in this file: + */ + +static int CleanupChildren _ANSI_ARGS_((Tcl_Interp *interp, + int numPids, int *pidPtr, int errorId, + int keepNewline)); +static char * GetFileType _ANSI_ARGS_((int mode)); +static char * GetOpenMode _ANSI_ARGS_((Tcl_Interp *interp, + char *string, int *modePtr)); +static int StoreStatData _ANSI_ARGS_((Tcl_Interp *interp, + char *varName, struct stat *statPtr)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_CdCmd -- + * + * This procedure is invoked to process the "cd" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_CdCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *dirName; + Tcl_DString buffer; + int result; + + if (argc > 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " dirName\"", (char *) NULL); + return TCL_ERROR; + } + + if (argc == 2) { + dirName = argv[1]; + } else { + dirName = "~"; + } + dirName = Tcl_TildeSubst(interp, dirName, &buffer); + if (dirName == NULL) { + return TCL_ERROR; + } + if (currentDir != NULL) { + ckfree(currentDir); + currentDir = NULL; + } + result = TCL_OK; + if (chdir(dirName) != 0) { + Tcl_AppendResult(interp, "couldn't change working directory to \"", + dirName, "\": ", Tcl_PosixError(interp), (char *) NULL); + result = TCL_ERROR; + } + Tcl_DStringFree(&buffer); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CloseCmd -- + * + * This procedure is invoked to process the "close" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_CloseCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + OpenFile *oFilePtr; + int result = TCL_OK; + FILE *f; + + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetOpenFile(interp, argv[1], 0, 0, &f) != TCL_OK) { + return TCL_ERROR; + } + oFilePtr = tclOpenFiles[fileno(f)]; + tclOpenFiles[fileno(f)] = NULL; + + /* + * First close the file (in the case of a process pipeline, there may + * be two files, one for the pipe at each end of the pipeline). + */ + + if (oFilePtr->f2 != NULL) { + clearerr(oFilePtr->f2); + if (fclose(oFilePtr->f2) == EOF) { + Tcl_AppendResult(interp, "error closing \"", argv[1], + "\": ", Tcl_PosixError(interp), "\n", (char *) NULL); + result = TCL_ERROR; + } + } + clearerr(oFilePtr->f); + if (fclose(oFilePtr->f) == EOF) { + Tcl_AppendResult(interp, "error closing \"", argv[1], + "\": ", Tcl_PosixError(interp), "\n", (char *) NULL); + result = TCL_ERROR; + } + + /* + * If the file was a connection to a pipeline, clean up everything + * associated with the child processes. + */ + + if (oFilePtr->numPids > 0) { + if (CleanupChildren(interp, oFilePtr->numPids, oFilePtr->pidPtr, + oFilePtr->errorId, 0) != TCL_OK) { + result = TCL_ERROR; + } + } + + ckfree((char *) oFilePtr); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_EofCmd -- + * + * This procedure is invoked to process the "eof" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_EofCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + FILE *f; + + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetOpenFile(interp, argv[1], 0, 0, &f) != TCL_OK) { + return TCL_ERROR; + } + if (feof(f)) { + interp->result = "1"; + } else { + interp->result = "0"; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ExecCmd -- + * + * This procedure is invoked to process the "exec" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ExecCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int outputId; /* File id for output pipe. -1 + * means command overrode. */ + int errorId; /* File id for temporary file + * containing error output. */ + int *pidPtr; + int numPids, result, keepNewline; + int firstWord; + + /* + * Check for a leading "-keepnewline" argument. + */ + + keepNewline = 0; + for (firstWord = 1; (firstWord < argc) && (argv[firstWord][0] == '-'); + firstWord++) { + if (strcmp(argv[firstWord], "-keepnewline") == 0) { + keepNewline = 1; + } else if (strcmp(argv[firstWord], "--") == 0) { + firstWord++; + break; + } else { + Tcl_AppendResult(interp, "bad switch \"", argv[firstWord], + "\": must be -keepnewline or --", (char *) NULL); + return TCL_ERROR; + } + } + + if (argc <= firstWord) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?switches? arg ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * See if the command is to be run in background; if so, create + * the command, detach it, and return a list of pids. + */ + + if ((argv[argc-1][0] == '&') && (argv[argc-1][1] == 0)) { + int i; + char id[50]; + + argc--; + argv[argc] = NULL; + numPids = Tcl_CreatePipeline(interp, argc-firstWord, argv+firstWord, + &pidPtr, (int *) NULL, (int *) NULL, (int *) NULL); + if (numPids < 0) { + return TCL_ERROR; + } + Tcl_DetachPids(numPids, pidPtr); + for (i = 0; i < numPids; i++) { + sprintf(id, "%d", pidPtr[i]); + Tcl_AppendElement(interp, id); + } + ckfree((char *) pidPtr); + return TCL_OK; + } + + /* + * Create the command's pipeline. + */ + + numPids = Tcl_CreatePipeline(interp, argc-firstWord, argv+firstWord, + &pidPtr, (int *) NULL, &outputId, &errorId); + if (numPids < 0) { + return TCL_ERROR; + } + + /* + * Read the child's output (if any) and put it into the result. + */ + + result = TCL_OK; + if (outputId != -1) { + while (1) { +# define BUFFER_SIZE 1000 + char buffer[BUFFER_SIZE+1]; + int count; + + count = read(outputId, buffer, (size_t) BUFFER_SIZE); + + if (count == 0) { + break; + } + if (count < 0) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, + "error reading from output pipe: ", + Tcl_PosixError(interp), (char *) NULL); + result = TCL_ERROR; + break; + } + buffer[count] = 0; + Tcl_AppendResult(interp, buffer, (char *) NULL); + } + close(outputId); + } + + if (CleanupChildren(interp, numPids, pidPtr, errorId, keepNewline) + != TCL_OK) { + result = TCL_ERROR; + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ExitCmd -- + * + * This procedure is invoked to process the "exit" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ExitCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int value; + + if ((argc != 1) && (argc != 2)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?returnCode?\"", (char *) NULL); + return TCL_ERROR; + } + if (argc == 1) { + exit(0); + } + if (Tcl_GetInt(interp, argv[1], &value) != TCL_OK) { + return TCL_ERROR; + } + exit(value); + /*NOTREACHED*/ + return TCL_OK; /* Better not ever reach this! */ +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_FileCmd -- + * + * This procedure is invoked to process the "file" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_FileCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char *p; + int length, statOp, result; + int mode = 0; /* Initialized only to prevent + * compiler warning message. */ + struct stat statBuf; + char *fileName, c; + Tcl_DString buffer; + + if (argc < 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " option name ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + c = argv[1][0]; + length = strlen(argv[1]); + result = TCL_OK; + + /* + * First handle operations on the file name. + */ + + fileName = Tcl_TildeSubst(interp, argv[2], &buffer); + if (fileName == NULL) { + result = TCL_ERROR; + goto done; + } + if ((c == 'd') && (strncmp(argv[1], "dirname", length) == 0)) { + if (argc != 3) { + argv[1] = "dirname"; + not3Args: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ", argv[1], " name\"", (char *) NULL); + result = TCL_ERROR; + goto done; + } + p = strrchr(fileName, '/'); + if (p == NULL) { + interp->result = "."; + } else if (p == fileName) { + interp->result = "/"; + } else { + *p = 0; + Tcl_SetResult(interp, fileName, TCL_VOLATILE); + *p = '/'; + } + goto done; + } else if ((c == 'r') && (strncmp(argv[1], "rootname", length) == 0) + && (length >= 2)) { + char *lastSlash; + + if (argc != 3) { + argv[1] = "rootname"; + goto not3Args; + } + p = strrchr(fileName, '.'); + lastSlash = strrchr(fileName, '/'); + if ((p == NULL) || ((lastSlash != NULL) && (lastSlash > p))) { + Tcl_SetResult(interp, fileName, TCL_VOLATILE); + } else { + *p = 0; + Tcl_SetResult(interp, fileName, TCL_VOLATILE); + *p = '.'; + } + goto done; + } else if ((c == 'e') && (strncmp(argv[1], "extension", length) == 0) + && (length >= 3)) { + char *lastSlash; + + if (argc != 3) { + argv[1] = "extension"; + goto not3Args; + } + p = strrchr(fileName, '.'); + lastSlash = strrchr(fileName, '/'); + if ((p != NULL) && ((lastSlash == NULL) || (lastSlash < p))) { + Tcl_SetResult(interp, p, TCL_VOLATILE); + } + goto done; + } else if ((c == 't') && (strncmp(argv[1], "tail", length) == 0) + && (length >= 2)) { + if (argc != 3) { + argv[1] = "tail"; + goto not3Args; + } + p = strrchr(fileName, '/'); + if (p != NULL) { + Tcl_SetResult(interp, p+1, TCL_VOLATILE); + } else { + Tcl_SetResult(interp, fileName, TCL_VOLATILE); + } + goto done; + } + + /* + * Next, handle operations that can be satisfied with the "access" + * kernel call. + */ + + if (fileName == NULL) { + result = TCL_ERROR; + goto done; + } + if ((c == 'r') && (strncmp(argv[1], "readable", length) == 0) + && (length >= 5)) { + if (argc != 3) { + argv[1] = "readable"; + goto not3Args; + } + mode = R_OK; + checkAccess: + if (access(fileName, mode) == -1) { + interp->result = "0"; + } else { + interp->result = "1"; + } + goto done; + } else if ((c == 'w') && (strncmp(argv[1], "writable", length) == 0)) { + if (argc != 3) { + argv[1] = "writable"; + goto not3Args; + } + mode = W_OK; + goto checkAccess; + } else if ((c == 'e') && (strncmp(argv[1], "executable", length) == 0) + && (length >= 3)) { + if (argc != 3) { + argv[1] = "executable"; + goto not3Args; + } + mode = X_OK; + goto checkAccess; + } else if ((c == 'e') && (strncmp(argv[1], "exists", length) == 0) + && (length >= 3)) { + if (argc != 3) { + argv[1] = "exists"; + goto not3Args; + } + mode = F_OK; + goto checkAccess; + } + + /* + * Lastly, check stuff that requires the file to be stat-ed. + */ + + if ((c == 'a') && (strncmp(argv[1], "atime", length) == 0)) { + if (argc != 3) { + argv[1] = "atime"; + goto not3Args; + } + if (stat(fileName, &statBuf) == -1) { + goto badStat; + } + sprintf(interp->result, "%ld", statBuf.st_atime); + goto done; + } else if ((c == 'i') && (strncmp(argv[1], "isdirectory", length) == 0) + && (length >= 3)) { + if (argc != 3) { + argv[1] = "isdirectory"; + goto not3Args; + } + statOp = 2; + } else if ((c == 'i') && (strncmp(argv[1], "isfile", length) == 0) + && (length >= 3)) { + if (argc != 3) { + argv[1] = "isfile"; + goto not3Args; + } + statOp = 1; + } else if ((c == 'l') && (strncmp(argv[1], "lstat", length) == 0)) { + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " lstat name varName\"", (char *) NULL); + result = TCL_ERROR; + goto done; + } + + if (lstat(fileName, &statBuf) == -1) { + Tcl_AppendResult(interp, "couldn't lstat \"", argv[2], + "\": ", Tcl_PosixError(interp), (char *) NULL); + result = TCL_ERROR; + goto done; + } + result = StoreStatData(interp, argv[3], &statBuf); + goto done; + } else if ((c == 'm') && (strncmp(argv[1], "mtime", length) == 0)) { + if (argc != 3) { + argv[1] = "mtime"; + goto not3Args; + } + if (stat(fileName, &statBuf) == -1) { + goto badStat; + } + sprintf(interp->result, "%ld", statBuf.st_mtime); + goto done; + } else if ((c == 'o') && (strncmp(argv[1], "owned", length) == 0)) { + if (argc != 3) { + argv[1] = "owned"; + goto not3Args; + } + statOp = 0; + } else if ((c == 'r') && (strncmp(argv[1], "readlink", length) == 0) + && (length >= 5)) { + char linkValue[MAXPATHLEN+1]; + int linkLength; + + if (argc != 3) { + argv[1] = "readlink"; + goto not3Args; + } + + /* + * If S_IFLNK isn't defined it means that the machine doesn't + * support symbolic links, so the file can't possibly be a + * symbolic link. Generate an EINVAL error, which is what + * happens on machines that do support symbolic links when + * you invoke readlink on a file that isn't a symbolic link. + */ + +#ifndef S_IFLNK + linkLength = -1; + errno = EINVAL; +#else + linkLength = readlink(fileName, linkValue, sizeof(linkValue) - 1); +#endif /* S_IFLNK */ + if (linkLength == -1) { + Tcl_AppendResult(interp, "couldn't readlink \"", argv[2], + "\": ", Tcl_PosixError(interp), (char *) NULL); + result = TCL_ERROR; + goto done; + } + linkValue[linkLength] = 0; + Tcl_SetResult(interp, linkValue, TCL_VOLATILE); + goto done; + } else if ((c == 's') && (strncmp(argv[1], "size", length) == 0) + && (length >= 2)) { + if (argc != 3) { + argv[1] = "size"; + goto not3Args; + } + if (stat(fileName, &statBuf) == -1) { + goto badStat; + } + sprintf(interp->result, "%ld", statBuf.st_size); + goto done; + } else if ((c == 's') && (strncmp(argv[1], "stat", length) == 0) + && (length >= 2)) { + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " stat name varName\"", (char *) NULL); + result = TCL_ERROR; + goto done; + } + + if (stat(fileName, &statBuf) == -1) { + badStat: + Tcl_AppendResult(interp, "couldn't stat \"", argv[2], + "\": ", Tcl_PosixError(interp), (char *) NULL); + result = TCL_ERROR; + goto done; + } + result = StoreStatData(interp, argv[3], &statBuf); + goto done; + } else if ((c == 't') && (strncmp(argv[1], "type", length) == 0) + && (length >= 2)) { + if (argc != 3) { + argv[1] = "type"; + goto not3Args; + } + if (lstat(fileName, &statBuf) == -1) { + goto badStat; + } + interp->result = GetFileType((int) statBuf.st_mode); + goto done; + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be atime, dirname, executable, exists, ", + "extension, isdirectory, isfile, lstat, mtime, owned, ", + "readable, readlink, ", + "root, size, stat, tail, type, ", + "or writable", + (char *) NULL); + result = TCL_ERROR; + goto done; + } + if (stat(fileName, &statBuf) == -1) { + interp->result = "0"; + goto done; + } + switch (statOp) { + case 0: + mode = (geteuid() == statBuf.st_uid); + break; + case 1: + mode = S_ISREG(statBuf.st_mode); + break; + case 2: + mode = S_ISDIR(statBuf.st_mode); + break; + } + if (mode) { + interp->result = "1"; + } else { + interp->result = "0"; + } + + done: + Tcl_DStringFree(&buffer); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * StoreStatData -- + * + * This is a utility procedure that breaks out the fields of a + * "stat" structure and stores them in textual form into the + * elements of an associative array. + * + * Results: + * Returns a standard Tcl return value. If an error occurs then + * a message is left in interp->result. + * + * Side effects: + * Elements of the associative array given by "varName" are modified. + * + *---------------------------------------------------------------------- + */ + +static int +StoreStatData(interp, varName, statPtr) + Tcl_Interp *interp; /* Interpreter for error reports. */ + char *varName; /* Name of associative array variable + * in which to store stat results. */ + struct stat *statPtr; /* Pointer to buffer containing + * stat data to store in varName. */ +{ + char string[30]; + + sprintf(string, "%d", statPtr->st_dev); + if (Tcl_SetVar2(interp, varName, "dev", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%d", statPtr->st_ino); + if (Tcl_SetVar2(interp, varName, "ino", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%d", statPtr->st_mode); + if (Tcl_SetVar2(interp, varName, "mode", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%d", statPtr->st_nlink); + if (Tcl_SetVar2(interp, varName, "nlink", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%d", statPtr->st_uid); + if (Tcl_SetVar2(interp, varName, "uid", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%d", statPtr->st_gid); + if (Tcl_SetVar2(interp, varName, "gid", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%ld", statPtr->st_size); + if (Tcl_SetVar2(interp, varName, "size", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%ld", statPtr->st_atime); + if (Tcl_SetVar2(interp, varName, "atime", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%ld", statPtr->st_mtime); + if (Tcl_SetVar2(interp, varName, "mtime", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + sprintf(string, "%ld", statPtr->st_ctime); + if (Tcl_SetVar2(interp, varName, "ctime", string, TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + if (Tcl_SetVar2(interp, varName, "type", + GetFileType((int) statPtr->st_mode), TCL_LEAVE_ERR_MSG) == NULL) { + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * GetFileType -- + * + * Given a mode word, returns a string identifying the type of a + * file. + * + * Results: + * A static text string giving the file type from mode. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static char * +GetFileType(mode) + int mode; +{ + if (S_ISREG(mode)) { + return "file"; + } else if (S_ISDIR(mode)) { + return "directory"; + } else if (S_ISCHR(mode)) { + return "characterSpecial"; + } else if (S_ISBLK(mode)) { + return "blockSpecial"; + } else if (S_ISFIFO(mode)) { + return "fifo"; + } else if (S_ISLNK(mode)) { + return "link"; + } else if (S_ISSOCK(mode)) { + return "socket"; + } + return "unknown"; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_FlushCmd -- + * + * This procedure is invoked to process the "flush" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_FlushCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + FILE *f; + + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetOpenFile(interp, argv[1], 1, 1, &f) != TCL_OK) { + return TCL_ERROR; + } + clearerr(f); + if (fflush(f) == EOF) { + Tcl_AppendResult(interp, "error flushing \"", argv[1], + "\": ", Tcl_PosixError(interp), (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetsCmd -- + * + * This procedure is invoked to process the "gets" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_GetsCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ +# define BUF_SIZE 200 + char buffer[BUF_SIZE+1]; + int totalCount, done, flags; + FILE *f; + + if ((argc != 2) && (argc != 3)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId ?varName?\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetOpenFile(interp, argv[1], 0, 1, &f) != TCL_OK) { + return TCL_ERROR; + } + + /* + * We can't predict how large a line will be, so read it in + * pieces, appending to the current result or to a variable. + */ + + totalCount = 0; + done = 0; + flags = 0; + clearerr(f); + while (!done) { + register int c, count; + register char *p; + + for (p = buffer, count = 0; count < BUF_SIZE-1; count++, p++) { + c = getc(f); + if (c == EOF) { + if (ferror(f)) { + /* + * If the file is in non-blocking mode, return any + * bytes that were read before a block would occur. + */ + + if ((errno == EWOULDBLOCK) + && ((count > 0 || totalCount > 0))) { + done = 1; + break; + } + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "error reading \"", argv[1], + "\": ", Tcl_PosixError(interp), (char *) NULL); + return TCL_ERROR; + } else if (feof(f)) { + if ((totalCount == 0) && (count == 0)) { + totalCount = -1; + } + done = 1; + break; + } + } + if (c == '\n') { + done = 1; + break; + } + *p = c; + } + *p = 0; + if (argc == 2) { + Tcl_AppendResult(interp, buffer, (char *) NULL); + } else { + if (Tcl_SetVar(interp, argv[2], buffer, flags|TCL_LEAVE_ERR_MSG) + == NULL) { + return TCL_ERROR; + } + flags = TCL_APPEND_VALUE; + } + totalCount += count; + } + + if (argc == 3) { + sprintf(interp->result, "%d", totalCount); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_OpenCmd -- + * + * This procedure is invoked to process the "open" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_OpenCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int pipeline, fd, mode, prot, readWrite, permissions; + char *access; + FILE *f, *f2; + + if ((argc < 2) || (argc > 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " filename ?access? ?permissions?\"", (char *) NULL); + return TCL_ERROR; + } + prot = 0666; + if (argc == 2) { + mode = O_RDONLY; + access = "r"; + } else { + access = GetOpenMode(interp, argv[2], &mode); + if (access == NULL) { + return TCL_ERROR; + } + if (argc == 4) { + if (Tcl_GetInt(interp, argv[3], &prot) != TCL_OK) { + return TCL_ERROR; + } + } + } + + f = f2 = NULL; + readWrite = mode & (O_RDWR|O_RDONLY|O_WRONLY); + if (readWrite == O_RDONLY) { + permissions = TCL_FILE_READABLE; + } else if (readWrite == O_WRONLY) { + permissions = TCL_FILE_WRITABLE; + } else { + permissions = TCL_FILE_READABLE|TCL_FILE_WRITABLE; + } + + pipeline = 0; + if (argv[1][0] == '|') { + pipeline = 1; + } + + /* + * Open the file or create a process pipeline. + */ + + if (!pipeline) { + char *fileName; + Tcl_DString buffer; + + fileName = Tcl_TildeSubst(interp, argv[1], &buffer); + if (fileName == NULL) { + return TCL_ERROR; + } + fd = open(fileName, mode, prot); + Tcl_DStringFree(&buffer); + if (fd < 0) { + Tcl_AppendResult(interp, "couldn't open \"", argv[1], + "\": ", Tcl_PosixError(interp), (char *) NULL); + return TCL_ERROR; + } + f = fdopen(fd, access); + if (f == NULL) { + close(fd); + return TCL_ERROR; + } + Tcl_EnterFile(interp, f, permissions); + } else { + int *inPipePtr, *outPipePtr; + int cmdArgc, inPipe, outPipe, numPids, *pidPtr, errorId; + char **cmdArgv; + OpenFile *oFilePtr; + + if (Tcl_SplitList(interp, argv[1]+1, &cmdArgc, &cmdArgv) != TCL_OK) { + return TCL_ERROR; + } + inPipePtr = (permissions & TCL_FILE_WRITABLE) ? &inPipe : NULL; + outPipePtr = (permissions & TCL_FILE_READABLE) ? &outPipe : NULL; + inPipe = outPipe = errorId = -1; + numPids = Tcl_CreatePipeline(interp, cmdArgc, cmdArgv, + &pidPtr, inPipePtr, outPipePtr, &errorId); + ckfree((char *) cmdArgv); + if (numPids < 0) { + pipelineError: + if (f != NULL) { + fclose(f); + } + if (f2 != NULL) { + fclose(f2); + } + if (numPids > 0) { + Tcl_DetachPids(numPids, pidPtr); + ckfree((char *) pidPtr); + } + if (errorId != -1) { + close(errorId); + } + return TCL_ERROR; + } + if (permissions & TCL_FILE_READABLE) { + if (outPipe == -1) { + if (inPipe != -1) { + close(inPipe); + } + Tcl_AppendResult(interp, "can't read output from command:", + " standard output was redirected", (char *) NULL); + goto pipelineError; + } + f = fdopen(outPipe, "r"); + } + if (permissions & TCL_FILE_WRITABLE) { + if (inPipe == -1) { + Tcl_AppendResult(interp, "can't write input to command:", + " standard input was redirected", (char *) NULL); + goto pipelineError; + } + if (f != NULL) { + f2 = fdopen(inPipe, "w"); + } else { + f = fdopen(inPipe, "w"); + } + } + Tcl_EnterFile(interp, f, permissions); + oFilePtr = tclOpenFiles[fileno(f)]; + oFilePtr->f2 = f2; + oFilePtr->numPids = numPids; + oFilePtr->pidPtr = pidPtr; + oFilePtr->errorId = errorId; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * GetOpenMode -- + * + * description. + * + * Results: + * Normally, sets *modePtr to an access mode for passing to "open", + * and returns a string that can be used as the access mode in a + * subsequent call to "fdopen". If an error occurs, then returns + * NULL and sets interp->result to an error message. + * + * Side effects: + * None. + * + * Special note: + * This code is based on a prototype implementation contributed + * by Mark Diekhans. + * + *---------------------------------------------------------------------- + */ + +static char * +GetOpenMode(interp, string, modePtr) + Tcl_Interp *interp; /* Interpreter to use for error + * reporting. */ + char *string; /* Mode string, e.g. "r+" or + * "RDONLY CREAT". */ + int *modePtr; /* Where to store mode corresponding + * to string. */ +{ + int mode, modeArgc, c, i, gotRW; + char **modeArgv, *flag; +#define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) + + /* + * Check for the simpler fopen-like access modes (e.g. "r"). They + * are distinguished from the POSIX access modes by the presence + * of a lower-case first letter. + */ + + mode = 0; + if (islower(UCHAR(string[0]))) { + switch (string[0]) { + case 'r': + mode = O_RDONLY; + break; + case 'w': + mode = O_WRONLY|O_CREAT|O_TRUNC; + break; + case 'a': + mode = O_WRONLY|O_CREAT|O_APPEND; + break; + default: + error: + Tcl_AppendResult(interp, + "illegal access mode \"", string, "\"", (char *) NULL); + return NULL; + } + if (string[1] == '+') { + mode &= ~(O_RDONLY|O_WRONLY); + mode |= O_RDWR; + if (string[2] != 0) { + goto error; + } + } else if (string[1] != 0) { + goto error; + } + *modePtr = mode; + return string; + } + + /* + * The access modes are specified using a list of POSIX modes + * such as O_CREAT. + */ + + if (Tcl_SplitList(interp, string, &modeArgc, &modeArgv) != TCL_OK) { + Tcl_AddErrorInfo(interp, "\n while processing open access modes \""); + Tcl_AddErrorInfo(interp, string); + Tcl_AddErrorInfo(interp, "\""); + return NULL; + } + gotRW = 0; + for (i = 0; i < modeArgc; i++) { + flag = modeArgv[i]; + c = flag[0]; + if ((c == 'R') && (strcmp(flag, "RDONLY") == 0)) { + mode = (mode & ~RW_MODES) | O_RDONLY; + gotRW = 1; + } else if ((c == 'W') && (strcmp(flag, "WRONLY") == 0)) { + mode = (mode & ~RW_MODES) | O_WRONLY; + gotRW = 1; + } else if ((c == 'R') && (strcmp(flag, "RDWR") == 0)) { + mode = (mode & ~RW_MODES) | O_RDWR; + gotRW = 1; + } else if ((c == 'A') && (strcmp(flag, "APPEND") == 0)) { + mode |= O_APPEND; + } else if ((c == 'C') && (strcmp(flag, "CREAT") == 0)) { + mode |= O_CREAT; + } else if ((c == 'E') && (strcmp(flag, "EXCL") == 0)) { + mode |= O_EXCL; + } else if ((c == 'N') && (strcmp(flag, "NOCTTY") == 0)) { +#ifdef O_NOCTTY + mode |= O_NOCTTY; +#else + Tcl_AppendResult(interp, "access mode \"", flag, + "\" not supported by this system", (char *) NULL); + ckfree((char *) modeArgv); + return NULL; +#endif + } else if ((c == 'N') && (strcmp(flag, "NONBLOCK") == 0)) { +#ifdef O_NONBLOCK + mode |= O_NONBLOCK; +#else + mode |= O_NDELAY; +#endif + } else if ((c == 'T') && (strcmp(flag, "TRUNC") == 0)) { + mode |= O_TRUNC; + } else { + Tcl_AppendResult(interp, "invalid access mode \"", flag, + "\": must be RDONLY, WRONLY, RDWR, APPEND, CREAT", + " EXCL, NOCTTY, NONBLOCK, or TRUNC", (char *) NULL); + ckfree((char *) modeArgv); + return NULL; + } + } + ckfree((char *) modeArgv); + if (!gotRW) { + Tcl_AppendResult(interp, "access mode must include either", + " RDONLY, WRONLY, or RDWR", (char *) NULL); + return NULL; + } + *modePtr = mode; + + /* + * The calculation of fdopen access mode below isn't really correct, + * but it doesn't have to be. All it has to do is to disinguish + * read and write permissions, plus indicate append mode. + */ + + i = mode & RW_MODES; + if (i == O_RDONLY) { + return "r"; + } + if (mode & O_APPEND) { + if (i == O_WRONLY) { + return "a"; + } else { + return "a+"; + } + } + if (i == O_WRONLY) { + return "w"; + } + return "r+"; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_PidCmd -- + * + * This procedure is invoked to process the "pid" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_PidCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + FILE *f; + OpenFile *oFilePtr; + int i; + char string[50]; + + if (argc > 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " ?fileId?\"", (char *) NULL); + return TCL_ERROR; + } + if (argc == 1) { + sprintf(interp->result, "%d", getpid()); + } else { + if (Tcl_GetOpenFile(interp, argv[1], 0, 0, &f) != TCL_OK) { + return TCL_ERROR; + } + oFilePtr = tclOpenFiles[fileno(f)]; + for (i = 0; i < oFilePtr->numPids; i++) { + sprintf(string, "%d", oFilePtr->pidPtr[i]); + Tcl_AppendElement(interp, string); + } + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_PutsCmd -- + * + * This procedure is invoked to process the "puts" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_PutsCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + FILE *f; + int i, newline; + char *fileId; + + i = 1; + newline = 1; + if ((argc >= 2) && (strcmp(argv[1], "-nonewline") == 0)) { + newline = 0; + i++; + } + if ((i < (argc-3)) || (i >= argc)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + "\" ?-nonewline? ?fileId? string", (char *) NULL); + return TCL_ERROR; + } + + /* + * The code below provides backwards compatibility with an old + * form of the command that is no longer recommended or documented. + */ + + if (i == (argc-3)) { + if (strncmp(argv[i+2], "nonewline", strlen(argv[i+2])) != 0) { + Tcl_AppendResult(interp, "bad argument \"", argv[i+2], + "\": should be \"nonewline\"", (char *) NULL); + return TCL_ERROR; + } + newline = 0; + } + if (i == (argc-1)) { + fileId = "stdout"; + } else { + fileId = argv[i]; + i++; + } + + if (Tcl_GetOpenFile(interp, fileId, 1, 1, &f) != TCL_OK) { + return TCL_ERROR; + } + + clearerr(f); + fputs(argv[i], f); + if (newline) { + fputc('\n', f); + } + if (ferror(f)) { + Tcl_AppendResult(interp, "error writing \"", fileId, + "\": ", Tcl_PosixError(interp), (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_PwdCmd -- + * + * This procedure is invoked to process the "pwd" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_PwdCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + char buffer[MAXPATHLEN+1]; + + if (argc != 1) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], "\"", (char *) NULL); + return TCL_ERROR; + } + if (currentDir == NULL) { + if (getcwd(buffer, MAXPATHLEN+1) == NULL) { + if (errno == ERANGE) { + interp->result = "working directory name is too long"; + } else { + Tcl_AppendResult(interp, + "error getting working directory name: ", + Tcl_PosixError(interp), (char *) NULL); + } + return TCL_ERROR; + } + currentDir = (char *) ckalloc((unsigned) (strlen(buffer) + 1)); + strcpy(currentDir, buffer); + } + interp->result = currentDir; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ReadCmd -- + * + * This procedure is invoked to process the "read" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ReadCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int bytesLeft, bytesRead, count; +#define READ_BUF_SIZE 4096 + char buffer[READ_BUF_SIZE+1]; + int newline, i; + FILE *f; + + if ((argc != 2) && (argc != 3)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId ?numBytes?\" or \"", argv[0], + " ?-nonewline? fileId\"", (char *) NULL); + return TCL_ERROR; + } + i = 1; + newline = 1; + if ((argc == 3) && (strcmp(argv[1], "-nonewline") == 0)) { + newline = 0; + i++; + } + if (Tcl_GetOpenFile(interp, argv[i], 0, 1, &f) != TCL_OK) { + return TCL_ERROR; + } + + /* + * Compute how many bytes to read, and see whether the final + * newline should be dropped. + */ + + if ((argc >= (i + 2)) && isdigit(UCHAR(argv[i+1][0]))) { + if (Tcl_GetInt(interp, argv[i+1], &bytesLeft) != TCL_OK) { + return TCL_ERROR; + } + } else { + bytesLeft = 1<<30; + + /* + * The code below provides backward compatibility for an + * archaic earlier version of this command. + */ + + if (argc >= (i + 2)) { + if (strncmp(argv[i+1], "nonewline", strlen(argv[i+1])) == 0) { + newline = 0; + } else { + Tcl_AppendResult(interp, "bad argument \"", argv[i+1], + "\": should be \"nonewline\"", (char *) NULL); + return TCL_ERROR; + } + } + } + + /* + * Read the file in one or more chunks. + */ + + bytesRead = 0; + clearerr(f); + while (bytesLeft > 0) { + count = READ_BUF_SIZE; + if (bytesLeft < READ_BUF_SIZE) { + count = bytesLeft; + } + count = fread(buffer, 1, count, f); + if (ferror(f)) { + /* + * If the file is in non-blocking mode, break out of the + * loop and return any bytes that were read. + */ + + if ((errno == EWOULDBLOCK) && ((count > 0) || (bytesRead > 0))) { + clearerr(f); + bytesLeft = count; + } else { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "error reading \"", argv[i], + "\": ", Tcl_PosixError(interp), (char *) NULL); + return TCL_ERROR; + } + } + if (count == 0) { + break; + } + buffer[count] = 0; + Tcl_AppendResult(interp, buffer, (char *) NULL); + bytesLeft -= count; + bytesRead += count; + } + if ((newline == 0) && (bytesRead > 0) + && (interp->result[bytesRead-1] == '\n')) { + interp->result[bytesRead-1] = 0; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SeekCmd -- + * + * This procedure is invoked to process the "seek" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_SeekCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + FILE *f; + int offset, mode; + + if ((argc != 3) && (argc != 4)) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId offset ?origin?\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetOpenFile(interp, argv[1], 0, 0, &f) != TCL_OK) { + return TCL_ERROR; + } + if (Tcl_GetInt(interp, argv[2], &offset) != TCL_OK) { + return TCL_ERROR; + } + mode = SEEK_SET; + if (argc == 4) { + int length; + char c; + + length = strlen(argv[3]); + c = argv[3][0]; + if ((c == 's') && (strncmp(argv[3], "start", length) == 0)) { + mode = SEEK_SET; + } else if ((c == 'c') && (strncmp(argv[3], "current", length) == 0)) { + mode = SEEK_CUR; + } else if ((c == 'e') && (strncmp(argv[3], "end", length) == 0)) { + mode = SEEK_END; + } else { + Tcl_AppendResult(interp, "bad origin \"", argv[3], + "\": should be start, current, or end", (char *) NULL); + return TCL_ERROR; + } + } + clearerr(f); + if (fseek(f, (long) offset, mode) == -1) { + Tcl_AppendResult(interp, "error during seek: ", + Tcl_PosixError(interp), (char *) NULL); + return TCL_ERROR; + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SourceCmd -- + * + * This procedure is invoked to process the "source" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_SourceCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileName\"", (char *) NULL); + return TCL_ERROR; + } + return Tcl_EvalFile(interp, argv[1]); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_TellCmd -- + * + * This procedure is invoked to process the "tell" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_TellCmd(notUsed, interp, argc, argv) + ClientData notUsed; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + FILE *f; + + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " fileId\"", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_GetOpenFile(interp, argv[1], 0, 0, &f) != TCL_OK) { + return TCL_ERROR; + } + sprintf(interp->result, "%d", ftell(f)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_TimeCmd -- + * + * This procedure is invoked to process the "time" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_TimeCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int count, i, result; + double timePer; +#if NO_GETTOD + struct tms dummy2; + long start, stop; +#else + struct timeval start, stop; + struct timezone tz; + int micros; +#endif + + if (argc == 2) { + count = 1; + } else if (argc == 3) { + if (Tcl_GetInt(interp, argv[2], &count) != TCL_OK) { + return TCL_ERROR; + } + } else { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " command ?count?\"", (char *) NULL); + return TCL_ERROR; + } +#if NO_GETTOD + start = times(&dummy2); +#else + gettimeofday(&start, &tz); +#endif + for (i = count ; i > 0; i--) { + result = Tcl_Eval(interp, argv[1]); + if (result != TCL_OK) { + if (result == TCL_ERROR) { + char msg[60]; + sprintf(msg, "\n (\"time\" body line %d)", + interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + return result; + } + } +#if NO_GETTOD + stop = times(&dummy2); + timePer = (((double) (stop - start))*1000000.0)/CLK_TCK; +#else + gettimeofday(&stop, &tz); + micros = (stop.tv_sec - start.tv_sec)*1000000 + + (stop.tv_usec - start.tv_usec); + timePer = micros; +#endif + Tcl_ResetResult(interp); + sprintf(interp->result, "%.0f microseconds per iteration", timePer/count); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * CleanupChildren -- + * + * This is a utility procedure used to wait for child processes + * to exit, record information about abnormal exits, and then + * collect any stderr output generated by them. + * + * Results: + * The return value is a standard Tcl result. If anything at + * weird happened with the child processes, TCL_ERROR is returned + * and a message is left in interp->result. + * + * Side effects: + * If the last character of interp->result is a newline, then it + * is removed unless keepNewline is non-zero. File errorId gets + * closed, and pidPtr is freed back to the storage allocator. + * + *---------------------------------------------------------------------- + */ + +static int +CleanupChildren(interp, numPids, pidPtr, errorId, keepNewline) + Tcl_Interp *interp; /* Used for error messages. */ + int numPids; /* Number of entries in pidPtr array. */ + int *pidPtr; /* Array of process ids of children. */ + int errorId; /* File descriptor index for file containing + * stderr output from pipeline. -1 means + * there isn't any stderr output. */ + int keepNewline; /* Non-zero means don't discard trailing + * newline. */ +{ + int result = TCL_OK; + int i, pid, length, abnormalExit; + WAIT_STATUS_TYPE waitStatus; + + abnormalExit = 0; + for (i = 0; i < numPids; i++) { + pid = waitpid(pidPtr[i], (int *) &waitStatus, 0); + if (pid == -1) { + Tcl_AppendResult(interp, "error waiting for process to exit: ", + Tcl_PosixError(interp), (char *) NULL); + continue; + } + + /* + * Create error messages for unusual process exits. An + * extra newline gets appended to each error message, but + * it gets removed below (in the same fashion that an + * extra newline in the command's output is removed). + */ + + if (!WIFEXITED(waitStatus) || (WEXITSTATUS(waitStatus) != 0)) { + char msg1[20], msg2[20]; + + result = TCL_ERROR; + sprintf(msg1, "%d", pid); + if (WIFEXITED(waitStatus)) { + sprintf(msg2, "%d", WEXITSTATUS(waitStatus)); + Tcl_SetErrorCode(interp, "CHILDSTATUS", msg1, msg2, + (char *) NULL); + abnormalExit = 1; + } else if (WIFSIGNALED(waitStatus)) { + char *p; + + p = Tcl_SignalMsg((int) (WTERMSIG(waitStatus))); + Tcl_SetErrorCode(interp, "CHILDKILLED", msg1, + Tcl_SignalId((int) (WTERMSIG(waitStatus))), p, + (char *) NULL); + Tcl_AppendResult(interp, "child killed: ", p, "\n", + (char *) NULL); + } else if (WIFSTOPPED(waitStatus)) { + char *p; + + p = Tcl_SignalMsg((int) (WSTOPSIG(waitStatus))); + Tcl_SetErrorCode(interp, "CHILDSUSP", msg1, + Tcl_SignalId((int) (WSTOPSIG(waitStatus))), p, (char *) NULL); + Tcl_AppendResult(interp, "child suspended: ", p, "\n", + (char *) NULL); + } else { + Tcl_AppendResult(interp, + "child wait status didn't make sense\n", + (char *) NULL); + } + } + } + ckfree((char *) pidPtr); + + /* + * Read the standard error file. If there's anything there, + * then return an error and add the file's contents to the result + * string. + */ + + if (errorId >= 0) { + while (1) { +# define BUFFER_SIZE 1000 + char buffer[BUFFER_SIZE+1]; + int count; + + count = read(errorId, buffer, (size_t) BUFFER_SIZE); + + if (count == 0) { + break; + } + result = TCL_ERROR; + if (count < 0) { + Tcl_AppendResult(interp, + "error reading stderr output file: ", + Tcl_PosixError(interp), (char *) NULL); + break; + } + buffer[count] = 0; + Tcl_AppendResult(interp, buffer, (char *) NULL); + } + close(errorId); + } + + /* + * If a child exited abnormally but didn't output any error information + * at all, generate an error message here. + */ + + if (abnormalExit && (*interp->result == 0)) { + Tcl_AppendResult(interp, "child process exited abnormally", + (char *) NULL); + } + + /* + * If the last character of interp->result is a newline, then remove + * the newline character (the newline would just confuse things). + * Special hack: must replace the old terminating null character + * as a signal to Tcl_AppendResult et al. that we've mucked with + * the string. + */ + + length = strlen(interp->result); + if (!keepNewline && (length > 0) && (interp->result[length-1] == '\n')) { + interp->result[length-1] = '\0'; + interp->result[length] = 'x'; + } + + return result; +} diff --git a/vendor/x11iraf/obm/Tcl/tclUnixStr.c b/vendor/x11iraf/obm/Tcl/tclUnixStr.c new file mode 100644 index 00000000..0ac38b19 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclUnixStr.c @@ -0,0 +1,737 @@ +/* + * tclUnixStr.c -- + * + * This file contains procedures that generate strings + * corresponding to various UNIX-related codes, such + * as errno and signals. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUnixStr.c,v 1.17 93/09/09 14:47:55 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + *---------------------------------------------------------------------- + * + * Tcl_ErrnoId -- + * + * Return a textual identifier for the current errno value. + * + * Results: + * This procedure returns a machine-readable textual identifier + * that corresponds to the current errno value (e.g. "EPERM"). + * The identifier is the same as the #define name in errno.h. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_ErrnoId() +{ + switch (errno) { +#ifdef E2BIG + case E2BIG: return "E2BIG"; +#endif +#ifdef EACCES + case EACCES: return "EACCES"; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: return "EADDRINUSE"; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; +#endif +#ifdef EADV + case EADV: return "EADV"; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: return "EAFNOSUPPORT"; +#endif +#ifdef EAGAIN + case EAGAIN: return "EAGAIN"; +#endif +#ifdef EALIGN + case EALIGN: return "EALIGN"; +#endif +#ifdef EALREADY + case EALREADY: return "EALREADY"; +#endif +#ifdef EBADE + case EBADE: return "EBADE"; +#endif +#ifdef EBADF + case EBADF: return "EBADF"; +#endif +#ifdef EBADFD + case EBADFD: return "EBADFD"; +#endif +#ifdef EBADMSG + case EBADMSG: return "EBADMSG"; +#endif +#ifdef EBADR + case EBADR: return "EBADR"; +#endif +#ifdef EBADRPC + case EBADRPC: return "EBADRPC"; +#endif +#ifdef EBADRQC + case EBADRQC: return "EBADRQC"; +#endif +#ifdef EBADSLT + case EBADSLT: return "EBADSLT"; +#endif +#ifdef EBFONT + case EBFONT: return "EBFONT"; +#endif +#ifdef EBUSY + case EBUSY: return "EBUSY"; +#endif +#ifdef ECHILD + case ECHILD: return "ECHILD"; +#endif +#ifdef ECHRNG + case ECHRNG: return "ECHRNG"; +#endif +#ifdef ECOMM + case ECOMM: return "ECOMM"; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: return "ECONNABORTED"; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: return "ECONNREFUSED"; +#endif +#ifdef ECONNRESET + case ECONNRESET: return "ECONNRESET"; +#endif +#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) + case EDEADLK: return "EDEADLK"; +#endif +#ifdef EDEADLOCK +#if (EDEADLOCK != EDEADLK) && (!(!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))) + case EDEADLOCK: return "EDEADLOCK"; +#endif +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: return "EDESTADDRREQ"; +#endif +#ifdef EDIRTY + case EDIRTY: return "EDIRTY"; +#endif +#ifdef EDOM + case EDOM: return "EDOM"; +#endif +#ifdef EDOTDOT + case EDOTDOT: return "EDOTDOT"; +#endif +#ifdef EDQUOT + case EDQUOT: return "EDQUOT"; +#endif +#ifdef EDUPPKG + case EDUPPKG: return "EDUPPKG"; +#endif +#ifdef EEXIST + case EEXIST: return "EEXIST"; +#endif +#ifdef EFAULT + case EFAULT: return "EFAULT"; +#endif +#ifdef EFBIG + case EFBIG: return "EFBIG"; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: return "EHOSTDOWN"; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: return "EHOSTUNREACH"; +#endif +#ifdef EIDRM + case EIDRM: return "EIDRM"; +#endif +#ifdef EINIT + case EINIT: return "EINIT"; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: return "EINPROGRESS"; +#endif +#ifdef EINTR + case EINTR: return "EINTR"; +#endif +#ifdef EINVAL + case EINVAL: return "EINVAL"; +#endif +#ifdef EIO + case EIO: return "EIO"; +#endif +#ifdef EISCONN + case EISCONN: return "EISCONN"; +#endif +#ifdef EISDIR + case EISDIR: return "EISDIR"; +#endif +#ifdef EISNAME + case EISNAM: return "EISNAM"; +#endif +#ifdef ELBIN + case ELBIN: return "ELBIN"; +#endif +#ifdef EL2HLT + case EL2HLT: return "EL2HLT"; +#endif +#ifdef EL2NSYNC + case EL2NSYNC: return "EL2NSYNC"; +#endif +#ifdef EL3HLT + case EL3HLT: return "EL3HLT"; +#endif +#ifdef EL3RST + case EL3RST: return "EL3RST"; +#endif +#ifdef ELIBACC + case ELIBACC: return "ELIBACC"; +#endif +#ifdef ELIBBAD + case ELIBBAD: return "ELIBBAD"; +#endif +#ifdef ELIBEXEC + case ELIBEXEC: return "ELIBEXEC"; +#endif +#ifdef ELIBMAX + case ELIBMAX: return "ELIBMAX"; +#endif +#ifdef ELIBSCN + case ELIBSCN: return "ELIBSCN"; +#endif +#ifdef ELNRNG + case ELNRNG: return "ELNRNG"; +#endif +#ifdef ELOOP + case ELOOP: return "ELOOP"; +#endif +#ifdef EMFILE + case EMFILE: return "EMFILE"; +#endif +#ifdef EMLINK + case EMLINK: return "EMLINK"; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: return "EMSGSIZE"; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: return "EMULTIHOP"; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: return "ENAMETOOLONG"; +#endif +#ifdef ENAVAIL + case ENAVAIL: return "ENAVAIL"; +#endif +#ifdef ENET + case ENET: return "ENET"; +#endif +#ifdef ENETDOWN + case ENETDOWN: return "ENETDOWN"; +#endif +#ifdef ENETRESET + case ENETRESET: return "ENETRESET"; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: return "ENETUNREACH"; +#endif +#ifdef ENFILE + case ENFILE: return "ENFILE"; +#endif +#ifdef ENOANO + case ENOANO: return "ENOANO"; +#endif +#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) + case ENOBUFS: return "ENOBUFS"; +#endif +#ifdef ENOCSI + case ENOCSI: return "ENOCSI"; +#endif +#ifdef ENODATA + case ENODATA: return "ENODATA"; +#endif +#ifdef ENODEV + case ENODEV: return "ENODEV"; +#endif +#ifdef ENOENT + case ENOENT: return "ENOENT"; +#endif +#ifdef ENOEXEC + case ENOEXEC: return "ENOEXEC"; +#endif +#ifdef ENOLCK + case ENOLCK: return "ENOLCK"; +#endif +#ifdef ENOLINK + case ENOLINK: return "ENOLINK"; +#endif +#ifdef ENOMEM + case ENOMEM: return "ENOMEM"; +#endif +#ifdef ENOMSG + case ENOMSG: return "ENOMSG"; +#endif +#ifdef ENONET + case ENONET: return "ENONET"; +#endif +#ifdef ENOPKG + case ENOPKG: return "ENOPKG"; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: return "ENOPROTOOPT"; +#endif +#ifdef ENOSPC + case ENOSPC: return "ENOSPC"; +#endif +#ifdef ENOSR + case ENOSR: return "ENOSR"; +#endif +#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR)) + case ENOSTR: return "ENOSTR"; +#endif +#ifdef ENOSYM + case ENOSYM: return "ENOSYM"; +#endif +#ifdef ENOSYS + case ENOSYS: return "ENOSYS"; +#endif +#ifdef ENOTBLK + case ENOTBLK: return "ENOTBLK"; +#endif +#ifdef ENOTCONN + case ENOTCONN: return "ENOTCONN"; +#endif +#ifdef ENOTDIR + case ENOTDIR: return "ENOTDIR"; +#endif +#if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST)) + case ENOTEMPTY: return "ENOTEMPTY"; +#endif +#ifdef ENOTNAM + case ENOTNAM: return "ENOTNAM"; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: return "ENOTSOCK"; +#endif +#ifdef ENOTTY + case ENOTTY: return "ENOTTY"; +#endif +#ifdef ENOTUNIQ + case ENOTUNIQ: return "ENOTUNIQ"; +#endif +#ifdef ENXIO + case ENXIO: return "ENXIO"; +#endif +#ifdef EOPNOTSUPP + case EOPNOTSUPP: return "EOPNOTSUPP"; +#endif +#ifdef EPERM + case EPERM: return "EPERM"; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: return "EPFNOSUPPORT"; +#endif +#ifdef EPIPE + case EPIPE: return "EPIPE"; +#endif +#ifdef EPROCLIM + case EPROCLIM: return "EPROCLIM"; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: return "EPROCUNAVAIL"; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: return "EPROGMISMATCH"; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: return "EPROGUNAVAIL"; +#endif +#ifdef EPROTO + case EPROTO: return "EPROTO"; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: return "EPROTOTYPE"; +#endif +#ifdef ERANGE + case ERANGE: return "ERANGE"; +#endif +#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) + case EREFUSED: return "EREFUSED"; +#endif +#ifdef EREMCHG + case EREMCHG: return "EREMCHG"; +#endif +#ifdef EREMDEV + case EREMDEV: return "EREMDEV"; +#endif +#ifdef EREMOTE + case EREMOTE: return "EREMOTE"; +#endif +#ifdef EREMOTEIO + case EREMOTEIO: return "EREMOTEIO"; +#endif +#ifdef EREMOTERELEASE + case EREMOTERELEASE: return "EREMOTERELEASE"; +#endif +#ifdef EROFS + case EROFS: return "EROFS"; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: return "ERPCMISMATCH"; +#endif +#ifdef ERREMOTE + case ERREMOTE: return "ERREMOTE"; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: return "ESHUTDOWN"; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; +#endif +#ifdef ESPIPE + case ESPIPE: return "ESPIPE"; +#endif +#ifdef ESRCH + case ESRCH: return "ESRCH"; +#endif +#ifdef ESRMNT + case ESRMNT: return "ESRMNT"; +#endif +#ifdef ESTALE + case ESTALE: return "ESTALE"; +#endif +#ifdef ESUCCESS + case ESUCCESS: return "ESUCCESS"; +#endif +#ifdef ETIME + case ETIME: return "ETIME"; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: return "ETIMEDOUT"; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: return "ETOOMANYREFS"; +#endif +#ifdef ETXTBSY + case ETXTBSY: return "ETXTBSY"; +#endif +#ifdef EUCLEAN + case EUCLEAN: return "EUCLEAN"; +#endif +#ifdef EUNATCH + case EUNATCH: return "EUNATCH"; +#endif +#ifdef EUSERS + case EUSERS: return "EUSERS"; +#endif +#ifdef EVERSION + case EVERSION: return "EVERSION"; +#endif +#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) + case EWOULDBLOCK: return "EWOULDBLOCK"; +#endif +#ifdef EXDEV + case EXDEV: return "EXDEV"; +#endif +#ifdef EXFULL + case EXFULL: return "EXFULL"; +#endif + } + return "unknown error"; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SignalId -- + * + * Return a textual identifier for a signal number. + * + * Results: + * This procedure returns a machine-readable textual identifier + * that corresponds to sig. The identifier is the same as the + * #define name in signal.h. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_SignalId(sig) + int sig; /* Number of signal. */ +{ + switch (sig) { +#ifdef SIGABRT + case SIGABRT: return "SIGABRT"; +#endif +#ifdef SIGALRM + case SIGALRM: return "SIGALRM"; +#endif +#ifdef SIGBUS + case SIGBUS: return "SIGBUS"; +#endif +#ifdef SIGCHLD + case SIGCHLD: return "SIGCHLD"; +#endif +#if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) + case SIGCLD: return "SIGCLD"; +#endif +#ifdef SIGCONT + case SIGCONT: return "SIGCONT"; +#endif +#if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) + case SIGEMT: return "SIGEMT"; +#endif +#ifdef SIGFPE + case SIGFPE: return "SIGFPE"; +#endif +#ifdef SIGHUP + case SIGHUP: return "SIGHUP"; +#endif +#ifdef SIGILL + case SIGILL: return "SIGILL"; +#endif +#ifdef SIGINT + case SIGINT: return "SIGINT"; +#endif +#ifdef SIGIO + case SIGIO: return "SIGIO"; +#endif +#if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT)) + case SIGIOT: return "SIGIOT"; +#endif +#ifdef SIGKILL + case SIGKILL: return "SIGKILL"; +#endif +#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) + case SIGLOST: return "SIGLOST"; +#endif +#ifdef SIGPIPE + case SIGPIPE: return "SIGPIPE"; +#endif +#if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) + case SIGPOLL: return "SIGPOLL"; +#endif +#ifdef SIGPROF + case SIGPROF: return "SIGPROF"; +#endif +#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) + case SIGPWR: return "SIGPWR"; +#endif +#ifdef SIGQUIT + case SIGQUIT: return "SIGQUIT"; +#endif +#ifdef SIGSEGV + case SIGSEGV: return "SIGSEGV"; +#endif +#ifdef SIGSTOP + case SIGSTOP: return "SIGSTOP"; +#endif +#ifdef SIGSYS + case SIGSYS: return "SIGSYS"; +#endif +#ifdef SIGTERM + case SIGTERM: return "SIGTERM"; +#endif +#ifdef SIGTRAP + case SIGTRAP: return "SIGTRAP"; +#endif +#ifdef SIGTSTP + case SIGTSTP: return "SIGTSTP"; +#endif +#ifdef SIGTTIN + case SIGTTIN: return "SIGTTIN"; +#endif +#ifdef SIGTTOU + case SIGTTOU: return "SIGTTOU"; +#endif +#if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO)) + case SIGURG: return "SIGURG"; +#endif +#if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO)) + case SIGUSR1: return "SIGUSR1"; +#endif +#if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG)) + case SIGUSR2: return "SIGUSR2"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "SIGVTALRM"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "SIGWINCH"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "SIGXCPU"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "SIGXFSZ"; +#endif + } + return "unknown signal"; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SignalMsg -- + * + * Return a human-readable message describing a signal. + * + * Results: + * This procedure returns a string describing sig that should + * make sense to a human. It may not be easy for a machine + * to parse. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_SignalMsg(sig) + int sig; /* Number of signal. */ +{ + switch (sig) { +#ifdef SIGABRT + case SIGABRT: return "SIGABRT"; +#endif +#ifdef SIGALRM + case SIGALRM: return "alarm clock"; +#endif +#ifdef SIGBUS + case SIGBUS: return "bus error"; +#endif +#ifdef SIGCHLD + case SIGCHLD: return "child status changed"; +#endif +#if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) + case SIGCLD: return "child status changed"; +#endif +#ifdef SIGCONT + case SIGCONT: return "continue after stop"; +#endif +#if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) + case SIGEMT: return "EMT instruction"; +#endif +#ifdef SIGFPE + case SIGFPE: return "floating-point exception"; +#endif +#ifdef SIGHUP + case SIGHUP: return "hangup"; +#endif +#ifdef SIGILL + case SIGILL: return "illegal instruction"; +#endif +#ifdef SIGINT + case SIGINT: return "interrupt"; +#endif +#ifdef SIGIO + case SIGIO: return "input/output possible on file"; +#endif +#if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT)) + case SIGIOT: return "IOT instruction"; +#endif +#ifdef SIGKILL + case SIGKILL: return "kill signal"; +#endif +#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) + case SIGLOST: return "resource lost"; +#endif +#ifdef SIGPIPE + case SIGPIPE: return "write on pipe with no readers"; +#endif +#if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) + case SIGPOLL: return "input/output possible on file"; +#endif +#ifdef SIGPROF + case SIGPROF: return "profiling alarm"; +#endif +#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) + case SIGPWR: return "power-fail restart"; +#endif +#ifdef SIGQUIT + case SIGQUIT: return "quit signal"; +#endif +#ifdef SIGSEGV + case SIGSEGV: return "segmentation violation"; +#endif +#ifdef SIGSTOP + case SIGSTOP: return "stop"; +#endif +#ifdef SIGSYS + case SIGSYS: return "bad argument to system call"; +#endif +#ifdef SIGTERM + case SIGTERM: return "software termination signal"; +#endif +#ifdef SIGTRAP + case SIGTRAP: return "trace trap"; +#endif +#ifdef SIGTSTP + case SIGTSTP: return "stop signal from tty"; +#endif +#ifdef SIGTTIN + case SIGTTIN: return "background tty read"; +#endif +#ifdef SIGTTOU + case SIGTTOU: return "background tty write"; +#endif +#if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO)) + case SIGURG: return "urgent I/O condition"; +#endif +#if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO)) + case SIGUSR1: return "user-defined signal 1"; +#endif +#if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG)) + case SIGUSR2: return "user-defined signal 2"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "virtual time alarm"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "window changed"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "exceeded CPU time limit"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "exceeded file size limit"; +#endif + } + return "unknown signal"; +} diff --git a/vendor/x11iraf/obm/Tcl/tclUnixStr.c.OLD b/vendor/x11iraf/obm/Tcl/tclUnixStr.c.OLD new file mode 100644 index 00000000..454f30a7 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclUnixStr.c.OLD @@ -0,0 +1,735 @@ +/* + * tclUnixStr.c -- + * + * This file contains procedures that generate strings + * corresponding to various UNIX-related codes, such + * as errno and signals. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUnixStr.c,v 1.17 93/09/09 14:47:55 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + *---------------------------------------------------------------------- + * + * Tcl_ErrnoId -- + * + * Return a textual identifier for the current errno value. + * + * Results: + * This procedure returns a machine-readable textual identifier + * that corresponds to the current errno value (e.g. "EPERM"). + * The identifier is the same as the #define name in errno.h. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_ErrnoId() +{ + switch (errno) { +#ifdef E2BIG + case E2BIG: return "E2BIG"; +#endif +#ifdef EACCES + case EACCES: return "EACCES"; +#endif +#ifdef EADDRINUSE + case EADDRINUSE: return "EADDRINUSE"; +#endif +#ifdef EADDRNOTAVAIL + case EADDRNOTAVAIL: return "EADDRNOTAVAIL"; +#endif +#ifdef EADV + case EADV: return "EADV"; +#endif +#ifdef EAFNOSUPPORT + case EAFNOSUPPORT: return "EAFNOSUPPORT"; +#endif +#ifdef EAGAIN + case EAGAIN: return "EAGAIN"; +#endif +#ifdef EALIGN + case EALIGN: return "EALIGN"; +#endif +#ifdef EALREADY + case EALREADY: return "EALREADY"; +#endif +#ifdef EBADE + case EBADE: return "EBADE"; +#endif +#ifdef EBADF + case EBADF: return "EBADF"; +#endif +#ifdef EBADFD + case EBADFD: return "EBADFD"; +#endif +#ifdef EBADMSG + case EBADMSG: return "EBADMSG"; +#endif +#ifdef EBADR + case EBADR: return "EBADR"; +#endif +#ifdef EBADRPC + case EBADRPC: return "EBADRPC"; +#endif +#ifdef EBADRQC + case EBADRQC: return "EBADRQC"; +#endif +#ifdef EBADSLT + case EBADSLT: return "EBADSLT"; +#endif +#ifdef EBFONT + case EBFONT: return "EBFONT"; +#endif +#ifdef EBUSY + case EBUSY: return "EBUSY"; +#endif +#ifdef ECHILD + case ECHILD: return "ECHILD"; +#endif +#ifdef ECHRNG + case ECHRNG: return "ECHRNG"; +#endif +#ifdef ECOMM + case ECOMM: return "ECOMM"; +#endif +#ifdef ECONNABORTED + case ECONNABORTED: return "ECONNABORTED"; +#endif +#ifdef ECONNREFUSED + case ECONNREFUSED: return "ECONNREFUSED"; +#endif +#ifdef ECONNRESET + case ECONNRESET: return "ECONNRESET"; +#endif +#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK)) + case EDEADLK: return "EDEADLK"; +#endif +#ifdef EDEADLOCK + case EDEADLOCK: return "EDEADLOCK"; +#endif +#ifdef EDESTADDRREQ + case EDESTADDRREQ: return "EDESTADDRREQ"; +#endif +#ifdef EDIRTY + case EDIRTY: return "EDIRTY"; +#endif +#ifdef EDOM + case EDOM: return "EDOM"; +#endif +#ifdef EDOTDOT + case EDOTDOT: return "EDOTDOT"; +#endif +#ifdef EDQUOT + case EDQUOT: return "EDQUOT"; +#endif +#ifdef EDUPPKG + case EDUPPKG: return "EDUPPKG"; +#endif +#ifdef EEXIST + case EEXIST: return "EEXIST"; +#endif +#ifdef EFAULT + case EFAULT: return "EFAULT"; +#endif +#ifdef EFBIG + case EFBIG: return "EFBIG"; +#endif +#ifdef EHOSTDOWN + case EHOSTDOWN: return "EHOSTDOWN"; +#endif +#ifdef EHOSTUNREACH + case EHOSTUNREACH: return "EHOSTUNREACH"; +#endif +#ifdef EIDRM + case EIDRM: return "EIDRM"; +#endif +#ifdef EINIT + case EINIT: return "EINIT"; +#endif +#ifdef EINPROGRESS + case EINPROGRESS: return "EINPROGRESS"; +#endif +#ifdef EINTR + case EINTR: return "EINTR"; +#endif +#ifdef EINVAL + case EINVAL: return "EINVAL"; +#endif +#ifdef EIO + case EIO: return "EIO"; +#endif +#ifdef EISCONN + case EISCONN: return "EISCONN"; +#endif +#ifdef EISDIR + case EISDIR: return "EISDIR"; +#endif +#ifdef EISNAME + case EISNAM: return "EISNAM"; +#endif +#ifdef ELBIN + case ELBIN: return "ELBIN"; +#endif +#ifdef EL2HLT + case EL2HLT: return "EL2HLT"; +#endif +#ifdef EL2NSYNC + case EL2NSYNC: return "EL2NSYNC"; +#endif +#ifdef EL3HLT + case EL3HLT: return "EL3HLT"; +#endif +#ifdef EL3RST + case EL3RST: return "EL3RST"; +#endif +#ifdef ELIBACC + case ELIBACC: return "ELIBACC"; +#endif +#ifdef ELIBBAD + case ELIBBAD: return "ELIBBAD"; +#endif +#ifdef ELIBEXEC + case ELIBEXEC: return "ELIBEXEC"; +#endif +#ifdef ELIBMAX + case ELIBMAX: return "ELIBMAX"; +#endif +#ifdef ELIBSCN + case ELIBSCN: return "ELIBSCN"; +#endif +#ifdef ELNRNG + case ELNRNG: return "ELNRNG"; +#endif +#ifdef ELOOP + case ELOOP: return "ELOOP"; +#endif +#ifdef EMFILE + case EMFILE: return "EMFILE"; +#endif +#ifdef EMLINK + case EMLINK: return "EMLINK"; +#endif +#ifdef EMSGSIZE + case EMSGSIZE: return "EMSGSIZE"; +#endif +#ifdef EMULTIHOP + case EMULTIHOP: return "EMULTIHOP"; +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: return "ENAMETOOLONG"; +#endif +#ifdef ENAVAIL + case ENAVAIL: return "ENAVAIL"; +#endif +#ifdef ENET + case ENET: return "ENET"; +#endif +#ifdef ENETDOWN + case ENETDOWN: return "ENETDOWN"; +#endif +#ifdef ENETRESET + case ENETRESET: return "ENETRESET"; +#endif +#ifdef ENETUNREACH + case ENETUNREACH: return "ENETUNREACH"; +#endif +#ifdef ENFILE + case ENFILE: return "ENFILE"; +#endif +#ifdef ENOANO + case ENOANO: return "ENOANO"; +#endif +#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR)) + case ENOBUFS: return "ENOBUFS"; +#endif +#ifdef ENOCSI + case ENOCSI: return "ENOCSI"; +#endif +#ifdef ENODATA + case ENODATA: return "ENODATA"; +#endif +#ifdef ENODEV + case ENODEV: return "ENODEV"; +#endif +#ifdef ENOENT + case ENOENT: return "ENOENT"; +#endif +#ifdef ENOEXEC + case ENOEXEC: return "ENOEXEC"; +#endif +#ifdef ENOLCK + case ENOLCK: return "ENOLCK"; +#endif +#ifdef ENOLINK + case ENOLINK: return "ENOLINK"; +#endif +#ifdef ENOMEM + case ENOMEM: return "ENOMEM"; +#endif +#ifdef ENOMSG + case ENOMSG: return "ENOMSG"; +#endif +#ifdef ENONET + case ENONET: return "ENONET"; +#endif +#ifdef ENOPKG + case ENOPKG: return "ENOPKG"; +#endif +#ifdef ENOPROTOOPT + case ENOPROTOOPT: return "ENOPROTOOPT"; +#endif +#ifdef ENOSPC + case ENOSPC: return "ENOSPC"; +#endif +#ifdef ENOSR + case ENOSR: return "ENOSR"; +#endif +#if defined(ENOSTR) && (!defined(ENOTTY) || (ENOTTY != ENOSTR)) + case ENOSTR: return "ENOSTR"; +#endif +#ifdef ENOSYM + case ENOSYM: return "ENOSYM"; +#endif +#ifdef ENOSYS + case ENOSYS: return "ENOSYS"; +#endif +#ifdef ENOTBLK + case ENOTBLK: return "ENOTBLK"; +#endif +#ifdef ENOTCONN + case ENOTCONN: return "ENOTCONN"; +#endif +#ifdef ENOTDIR + case ENOTDIR: return "ENOTDIR"; +#endif +#if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST)) + case ENOTEMPTY: return "ENOTEMPTY"; +#endif +#ifdef ENOTNAM + case ENOTNAM: return "ENOTNAM"; +#endif +#ifdef ENOTSOCK + case ENOTSOCK: return "ENOTSOCK"; +#endif +#ifdef ENOTTY + case ENOTTY: return "ENOTTY"; +#endif +#ifdef ENOTUNIQ + case ENOTUNIQ: return "ENOTUNIQ"; +#endif +#ifdef ENXIO + case ENXIO: return "ENXIO"; +#endif +#ifdef EOPNOTSUPP + case EOPNOTSUPP: return "EOPNOTSUPP"; +#endif +#ifdef EPERM + case EPERM: return "EPERM"; +#endif +#ifdef EPFNOSUPPORT + case EPFNOSUPPORT: return "EPFNOSUPPORT"; +#endif +#ifdef EPIPE + case EPIPE: return "EPIPE"; +#endif +#ifdef EPROCLIM + case EPROCLIM: return "EPROCLIM"; +#endif +#ifdef EPROCUNAVAIL + case EPROCUNAVAIL: return "EPROCUNAVAIL"; +#endif +#ifdef EPROGMISMATCH + case EPROGMISMATCH: return "EPROGMISMATCH"; +#endif +#ifdef EPROGUNAVAIL + case EPROGUNAVAIL: return "EPROGUNAVAIL"; +#endif +#ifdef EPROTO + case EPROTO: return "EPROTO"; +#endif +#ifdef EPROTONOSUPPORT + case EPROTONOSUPPORT: return "EPROTONOSUPPORT"; +#endif +#ifdef EPROTOTYPE + case EPROTOTYPE: return "EPROTOTYPE"; +#endif +#ifdef ERANGE + case ERANGE: return "ERANGE"; +#endif +#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED)) + case EREFUSED: return "EREFUSED"; +#endif +#ifdef EREMCHG + case EREMCHG: return "EREMCHG"; +#endif +#ifdef EREMDEV + case EREMDEV: return "EREMDEV"; +#endif +#ifdef EREMOTE + case EREMOTE: return "EREMOTE"; +#endif +#ifdef EREMOTEIO + case EREMOTEIO: return "EREMOTEIO"; +#endif +#ifdef EREMOTERELEASE + case EREMOTERELEASE: return "EREMOTERELEASE"; +#endif +#ifdef EROFS + case EROFS: return "EROFS"; +#endif +#ifdef ERPCMISMATCH + case ERPCMISMATCH: return "ERPCMISMATCH"; +#endif +#ifdef ERREMOTE + case ERREMOTE: return "ERREMOTE"; +#endif +#ifdef ESHUTDOWN + case ESHUTDOWN: return "ESHUTDOWN"; +#endif +#ifdef ESOCKTNOSUPPORT + case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT"; +#endif +#ifdef ESPIPE + case ESPIPE: return "ESPIPE"; +#endif +#ifdef ESRCH + case ESRCH: return "ESRCH"; +#endif +#ifdef ESRMNT + case ESRMNT: return "ESRMNT"; +#endif +#ifdef ESTALE + case ESTALE: return "ESTALE"; +#endif +#ifdef ESUCCESS + case ESUCCESS: return "ESUCCESS"; +#endif +#ifdef ETIME + case ETIME: return "ETIME"; +#endif +#ifdef ETIMEDOUT + case ETIMEDOUT: return "ETIMEDOUT"; +#endif +#ifdef ETOOMANYREFS + case ETOOMANYREFS: return "ETOOMANYREFS"; +#endif +#ifdef ETXTBSY + case ETXTBSY: return "ETXTBSY"; +#endif +#ifdef EUCLEAN + case EUCLEAN: return "EUCLEAN"; +#endif +#ifdef EUNATCH + case EUNATCH: return "EUNATCH"; +#endif +#ifdef EUSERS + case EUSERS: return "EUSERS"; +#endif +#ifdef EVERSION + case EVERSION: return "EVERSION"; +#endif +#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) + case EWOULDBLOCK: return "EWOULDBLOCK"; +#endif +#ifdef EXDEV + case EXDEV: return "EXDEV"; +#endif +#ifdef EXFULL + case EXFULL: return "EXFULL"; +#endif + } + return "unknown error"; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SignalId -- + * + * Return a textual identifier for a signal number. + * + * Results: + * This procedure returns a machine-readable textual identifier + * that corresponds to sig. The identifier is the same as the + * #define name in signal.h. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_SignalId(sig) + int sig; /* Number of signal. */ +{ + switch (sig) { +#ifdef SIGABRT + case SIGABRT: return "SIGABRT"; +#endif +#ifdef SIGALRM + case SIGALRM: return "SIGALRM"; +#endif +#ifdef SIGBUS + case SIGBUS: return "SIGBUS"; +#endif +#ifdef SIGCHLD + case SIGCHLD: return "SIGCHLD"; +#endif +#if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) + case SIGCLD: return "SIGCLD"; +#endif +#ifdef SIGCONT + case SIGCONT: return "SIGCONT"; +#endif +#if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) + case SIGEMT: return "SIGEMT"; +#endif +#ifdef SIGFPE + case SIGFPE: return "SIGFPE"; +#endif +#ifdef SIGHUP + case SIGHUP: return "SIGHUP"; +#endif +#ifdef SIGILL + case SIGILL: return "SIGILL"; +#endif +#ifdef SIGINT + case SIGINT: return "SIGINT"; +#endif +#ifdef SIGIO + case SIGIO: return "SIGIO"; +#endif +#if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT)) + case SIGIOT: return "SIGIOT"; +#endif +#ifdef SIGKILL + case SIGKILL: return "SIGKILL"; +#endif +#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) + case SIGLOST: return "SIGLOST"; +#endif +#ifdef SIGPIPE + case SIGPIPE: return "SIGPIPE"; +#endif +#if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) + case SIGPOLL: return "SIGPOLL"; +#endif +#ifdef SIGPROF + case SIGPROF: return "SIGPROF"; +#endif +#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) + case SIGPWR: return "SIGPWR"; +#endif +#ifdef SIGQUIT + case SIGQUIT: return "SIGQUIT"; +#endif +#ifdef SIGSEGV + case SIGSEGV: return "SIGSEGV"; +#endif +#ifdef SIGSTOP + case SIGSTOP: return "SIGSTOP"; +#endif +#ifdef SIGSYS + case SIGSYS: return "SIGSYS"; +#endif +#ifdef SIGTERM + case SIGTERM: return "SIGTERM"; +#endif +#ifdef SIGTRAP + case SIGTRAP: return "SIGTRAP"; +#endif +#ifdef SIGTSTP + case SIGTSTP: return "SIGTSTP"; +#endif +#ifdef SIGTTIN + case SIGTTIN: return "SIGTTIN"; +#endif +#ifdef SIGTTOU + case SIGTTOU: return "SIGTTOU"; +#endif +#if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO)) + case SIGURG: return "SIGURG"; +#endif +#if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO)) + case SIGUSR1: return "SIGUSR1"; +#endif +#if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG)) + case SIGUSR2: return "SIGUSR2"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "SIGVTALRM"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "SIGWINCH"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "SIGXCPU"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "SIGXFSZ"; +#endif + } + return "unknown signal"; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SignalMsg -- + * + * Return a human-readable message describing a signal. + * + * Results: + * This procedure returns a string describing sig that should + * make sense to a human. It may not be easy for a machine + * to parse. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_SignalMsg(sig) + int sig; /* Number of signal. */ +{ + switch (sig) { +#ifdef SIGABRT + case SIGABRT: return "SIGABRT"; +#endif +#ifdef SIGALRM + case SIGALRM: return "alarm clock"; +#endif +#ifdef SIGBUS + case SIGBUS: return "bus error"; +#endif +#ifdef SIGCHLD + case SIGCHLD: return "child status changed"; +#endif +#if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD)) + case SIGCLD: return "child status changed"; +#endif +#ifdef SIGCONT + case SIGCONT: return "continue after stop"; +#endif +#if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU)) + case SIGEMT: return "EMT instruction"; +#endif +#ifdef SIGFPE + case SIGFPE: return "floating-point exception"; +#endif +#ifdef SIGHUP + case SIGHUP: return "hangup"; +#endif +#ifdef SIGILL + case SIGILL: return "illegal instruction"; +#endif +#ifdef SIGINT + case SIGINT: return "interrupt"; +#endif +#ifdef SIGIO + case SIGIO: return "input/output possible on file"; +#endif +#if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT)) + case SIGIOT: return "IOT instruction"; +#endif +#ifdef SIGKILL + case SIGKILL: return "kill signal"; +#endif +#if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT)) && (!defined(SIGURG) || (SIGLOST != SIGURG)) + case SIGLOST: return "resource lost"; +#endif +#ifdef SIGPIPE + case SIGPIPE: return "write on pipe with no readers"; +#endif +#if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO)) + case SIGPOLL: return "input/output possible on file"; +#endif +#ifdef SIGPROF + case SIGPROF: return "profiling alarm"; +#endif +#if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ)) + case SIGPWR: return "power-fail restart"; +#endif +#ifdef SIGQUIT + case SIGQUIT: return "quit signal"; +#endif +#ifdef SIGSEGV + case SIGSEGV: return "segmentation violation"; +#endif +#ifdef SIGSTOP + case SIGSTOP: return "stop"; +#endif +#ifdef SIGSYS + case SIGSYS: return "bad argument to system call"; +#endif +#ifdef SIGTERM + case SIGTERM: return "software termination signal"; +#endif +#ifdef SIGTRAP + case SIGTRAP: return "trace trap"; +#endif +#ifdef SIGTSTP + case SIGTSTP: return "stop signal from tty"; +#endif +#ifdef SIGTTIN + case SIGTTIN: return "background tty read"; +#endif +#ifdef SIGTTOU + case SIGTTOU: return "background tty write"; +#endif +#if defined(SIGURG) && (!defined(SIGIO) || (SIGURG != SIGIO)) + case SIGURG: return "urgent I/O condition"; +#endif +#if defined(SIGUSR1) && (!defined(SIGIO) || (SIGUSR1 != SIGIO)) + case SIGUSR1: return "user-defined signal 1"; +#endif +#if defined(SIGUSR2) && (!defined(SIGURG) || (SIGUSR2 != SIGURG)) + case SIGUSR2: return "user-defined signal 2"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "virtual time alarm"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "window changed"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "exceeded CPU time limit"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "exceeded file size limit"; +#endif + } + return "unknown signal"; +} diff --git a/vendor/x11iraf/obm/Tcl/tclUnixUtil.c b/vendor/x11iraf/obm/Tcl/tclUnixUtil.c new file mode 100644 index 00000000..9f85dc86 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclUnixUtil.c @@ -0,0 +1,1393 @@ +/* + * tclUnixUtil.c -- + * + * This file contains a collection of utility procedures that + * are present in the Tcl's UNIX core but not in the generic + * core. For example, they do file manipulation and process + * manipulation. + * + * Parts of this file are based on code contributed by Karl + * Lehenbauer, Mark Diekhans and Peter da Silva. + * + * Copyright (c) 1991-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUnixUtil.c,v 1.45 93/10/23 14:52:10 ouster Exp $ SPRITE (Berkeley)"; +#endif /* not lint */ + +#include "tclInt.h" +#include "tclUnix.h" + +/* + * A linked list of the following structures is used to keep track + * of child processes that have been detached but haven't exited + * yet, so we can make sure that they're properly "reaped" (officially + * waited for) and don't lie around as zombies cluttering the + * system. + */ + +typedef struct Detached { + int pid; /* Id of process that's been detached + * but isn't known to have exited. */ + struct Detached *nextPtr; /* Next in list of all detached + * processes. */ +} Detached; + +static Detached *detList = NULL; /* List of all detached proceses. */ + +/* + * The following variables are used to keep track of all the open files + * in the process. These files can be shared across interpreters, so the + * information can't be put in the Interp structure. + */ + +int tclNumFiles = 0; /* Number of entries in tclOpenFiles below. + * 0 means array hasn't been created yet. */ +OpenFile **tclOpenFiles; /* Pointer to malloc-ed array of pointers + * to information about open files. Entry + * N corresponds to the file with fileno N. + * If an entry is NULL then the corresponding + * file isn't open. If tclOpenFiles is NULL + * it means no files have been used, so even + * stdin/stdout/stderr entries haven't been + * setup yet. */ + +/* + * Declarations for local procedures defined in this file: + */ + +static int FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp, + char *spec, int atOk, char *arg, int flags, + char *nextArg, int *skipPtr, int *closePtr)); +static void MakeFileTable _ANSI_ARGS_((Interp *iPtr, int index)); +static void RestoreSignals _ANSI_ARGS_((void)); + +/* + *---------------------------------------------------------------------- + * + * Tcl_EvalFile -- + * + * Read in a file and process the entire file as one gigantic + * Tcl command. + * + * Results: + * A standard Tcl result, which is either the result of executing + * the file or an error indicating why the file couldn't be read. + * + * Side effects: + * Depends on the commands in the file. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_EvalFile(interp, fileName) + Tcl_Interp *interp; /* Interpreter in which to process file. */ + char *fileName; /* Name of file to process. Tilde-substitution + * will be performed on this name. */ +{ + int fileId, result; + struct stat statBuf; + char *cmdBuffer, *oldScriptFile; + Interp *iPtr = (Interp *) interp; + Tcl_DString buffer; + + oldScriptFile = iPtr->scriptFile; + iPtr->scriptFile = fileName; + fileName = Tcl_TildeSubst(interp, fileName, &buffer); + if (fileName == NULL) { + goto error; + } + fileId = open(fileName, O_RDONLY, 0); + if (fileId < 0) { + Tcl_AppendResult(interp, "couldn't read file \"", fileName, + "\": ", Tcl_PosixError(interp), (char *) NULL); + goto error; + } + if (fstat(fileId, &statBuf) == -1) { + Tcl_AppendResult(interp, "couldn't stat file \"", fileName, + "\": ", Tcl_PosixError(interp), (char *) NULL); + close(fileId); + goto error; + } + cmdBuffer = (char *) ckalloc((unsigned) statBuf.st_size+1); + if (read(fileId, cmdBuffer, (size_t) statBuf.st_size) != statBuf.st_size) { + Tcl_AppendResult(interp, "error in reading file \"", fileName, + "\": ", Tcl_PosixError(interp), (char *) NULL); + close(fileId); + ckfree(cmdBuffer); + goto error; + } + if (close(fileId) != 0) { + Tcl_AppendResult(interp, "error closing file \"", fileName, + "\": ", Tcl_PosixError(interp), (char *) NULL); + ckfree(cmdBuffer); + goto error; + } + cmdBuffer[statBuf.st_size] = 0; + result = Tcl_Eval(interp, cmdBuffer); + if (result == TCL_RETURN) { + result = TCL_OK; + } + if (result == TCL_ERROR) { + char msg[200]; + + /* + * Record information telling where the error occurred. + */ + + sprintf(msg, "\n (file \"%.150s\" line %d)", fileName, + interp->errorLine); + Tcl_AddErrorInfo(interp, msg); + } + ckfree(cmdBuffer); + iPtr->scriptFile = oldScriptFile; + Tcl_DStringFree(&buffer); + return result; + + error: + iPtr->scriptFile = oldScriptFile; + Tcl_DStringFree(&buffer); + return TCL_ERROR; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DetachPids -- + * + * This procedure is called to indicate that one or more child + * processes have been placed in background and will never be + * waited for; they should eventually be reaped by + * Tcl_ReapDetachedProcs. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DetachPids(numPids, pidPtr) + int numPids; /* Number of pids to detach: gives size + * of array pointed to by pidPtr. */ + int *pidPtr; /* Array of pids to detach. */ +{ + register Detached *detPtr; + int i; + + for (i = 0; i < numPids; i++) { + detPtr = (Detached *) ckalloc(sizeof(Detached)); + detPtr->pid = pidPtr[i]; + detPtr->nextPtr = detList; + detList = detPtr; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ReapDetachedProcs -- + * + * This procedure checks to see if any detached processes have + * exited and, if so, it "reaps" them by officially waiting on + * them. It should be called "occasionally" to make sure that + * all detached processes are eventually reaped. + * + * Results: + * None. + * + * Side effects: + * Processes are waited on, so that they can be reaped by the + * system. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_ReapDetachedProcs() +{ + register Detached *detPtr; + Detached *nextPtr, *prevPtr; + int status, result; + + for (detPtr = detList, prevPtr = NULL; detPtr != NULL; ) { + result = waitpid(detPtr->pid, &status, WNOHANG); + if ((result == 0) || ((result == -1) && (errno != ECHILD))) { + prevPtr = detPtr; + detPtr = detPtr->nextPtr; + continue; + } + nextPtr = detPtr->nextPtr; + if (prevPtr == NULL) { + detList = detPtr->nextPtr; + } else { + prevPtr->nextPtr = detPtr->nextPtr; + } + ckfree((char *) detPtr); + detPtr = nextPtr; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreatePipeline -- + * + * Given an argc/argv array, instantiate a pipeline of processes + * as described by the argv. + * + * Results: + * The return value is a count of the number of new processes + * created, or -1 if an error occurred while creating the pipeline. + * *pidArrayPtr is filled in with the address of a dynamically + * allocated array giving the ids of all of the processes. It + * is up to the caller to free this array when it isn't needed + * anymore. If inPipePtr is non-NULL, *inPipePtr is filled in + * with the file id for the input pipe for the pipeline (if any): + * the caller must eventually close this file. If outPipePtr + * isn't NULL, then *outPipePtr is filled in with the file id + * for the output pipe from the pipeline: the caller must close + * this file. If errFilePtr isn't NULL, then *errFilePtr is filled + * with a file id that may be used to read error output after the + * pipeline completes. + * + * Side effects: + * Processes and pipes are created. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_CreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, + outPipePtr, errFilePtr) + Tcl_Interp *interp; /* Interpreter to use for error reporting. */ + int argc; /* Number of entries in argv. */ + char **argv; /* Array of strings describing commands in + * pipeline plus I/O redirection with <, + * <<, >, etc. Argv[argc] must be NULL. */ + int **pidArrayPtr; /* Word at *pidArrayPtr gets filled in with + * address of array of pids for processes + * in pipeline (first pid is first process + * in pipeline). */ + int *inPipePtr; /* If non-NULL, input to the pipeline comes + * from a pipe (unless overridden by + * redirection in the command). The file + * id with which to write to this pipe is + * stored at *inPipePtr. -1 means command + * specified its own input source. */ + int *outPipePtr; /* If non-NULL, output to the pipeline goes + * to a pipe, unless overriden by redirection + * in the command. The file id with which to + * read frome this pipe is stored at + * *outPipePtr. -1 means command specified + * its own output sink. */ + int *errFilePtr; /* If non-NULL, all stderr output from the + * pipeline will go to a temporary file + * created here, and a descriptor to read + * the file will be left at *errFilePtr. + * The file will be removed already, so + * closing this descriptor will be the end + * of the file. If this is NULL, then + * all stderr output goes to our stderr. + * If the pipeline specifies redirection + * then the fill will still be created + * but it will never get any data. */ +{ + int *pidPtr = NULL; /* Points to malloc-ed array holding all + * the pids of child processes. */ + int numPids = 0; /* Actual number of processes that exist + * at *pidPtr right now. */ + int cmdCount; /* Count of number of distinct commands + * found in argc/argv. */ + char *input = NULL; /* If non-null, then this points to a + * string containing input data (specified + * via <<) to be piped to the first process + * in the pipeline. */ + int inputId = -1; /* If >= 0, gives file id to use as input for + * first process in pipeline (specified via + * < or <@). */ + int closeInput = 0; /* If non-zero, then must close inputId + * when cleaning up (zero means the file needs + * to stay open for some other reason). */ + int outputId = -1; /* Writable file id for output from last + * command in pipeline (could be file or pipe). + * -1 means use stdout. */ + int closeOutput = 0; /* Non-zero means must close outputId when + * cleaning up (similar to closeInput). */ + int errorId = -1; /* Writable file id for error output from + * all commands in pipeline. -1 means use + * stderr. */ + int closeError = 0; /* Non-zero means must close errorId when + * cleaning up. */ + int pipeIds[2]; /* File ids for pipe that's being created. */ + int firstArg, lastArg; /* Indexes of first and last arguments in + * current command. */ + int skip; /* Number of arguments to skip (because they + * specify redirection). */ + int maxFd; /* Highest known file descriptor (used to + * close off extraneous file descriptors in + * child process). */ + int lastBar; + char *execName; + int i, j, pid; + char *p; + Tcl_DString buffer; + + if (inPipePtr != NULL) { + *inPipePtr = -1; + } + if (outPipePtr != NULL) { + *outPipePtr = -1; + } + if (errFilePtr != NULL) { + *errFilePtr = -1; + } + pipeIds[0] = pipeIds[1] = -1; + + /* + * First, scan through all the arguments to figure out the structure + * of the pipeline. Process all of the input and output redirection + * arguments and remove them from the argument list in the pipeline. + * Count the number of distinct processes (it's the number of "|" + * arguments plus one) but don't remove the "|" arguments. + */ + + cmdCount = 1; + lastBar = -1; + for (i = 0; i < argc; i++) { + if ((argv[i][0] == '|') && (((argv[i][1] == 0)) + || ((argv[i][1] == '&') && (argv[i][2] == 0)))) { + if ((i == (lastBar+1)) || (i == (argc-1))) { + interp->result = "illegal use of | or |& in command"; + return -1; + } + lastBar = i; + cmdCount++; + continue; + } else if (argv[i][0] == '<') { + if ((inputId >= 0) && closeInput) { + close(inputId); + } + inputId = -1; + skip = 1; + if (argv[i][1] == '<') { + input = argv[i]+2; + if (*input == 0) { + input = argv[i+1]; + if (input == 0) { + Tcl_AppendResult(interp, "can't specify \"", argv[i], + "\" as last word in command", (char *) NULL); + goto error; + } + skip = 2; + } + } else { + input = 0; + inputId = FileForRedirect(interp, argv[i]+1, 1, argv[i], + O_RDONLY, argv[i+1], &skip, &closeInput); + if (inputId < 0) { + goto error; + } + } + } else if (argv[i][0] == '>') { + int append, useForStdErr, useForStdOut, mustClose, fd, atOk, flags; + + skip = atOk = 1; + append = useForStdErr = 0; + useForStdOut = 1; + if (argv[i][1] == '>') { + p = argv[i] + 2; + append = 1; + atOk = 0; + flags = O_WRONLY|O_CREAT; + } else { + p = argv[i] + 1; + flags = O_WRONLY|O_CREAT|O_TRUNC; + } + if (*p == '&') { + useForStdErr = 1; + p++; + } + fd = FileForRedirect(interp, p, atOk, argv[i], flags, argv[i+1], + &skip, &mustClose); + if (fd < 0) { + goto error; + } + if (append) { + lseek(fd, 0L, 2); + } + + /* + * Got the file descriptor. Now use it for standard output, + * standard error, or both, depending on the redirection. + */ + + if (useForStdOut) { + if ((outputId > 0) && closeOutput) { + close(outputId); + } + outputId = fd; + closeOutput = mustClose; + } + if (useForStdErr) { + if ((errorId > 0) && closeError) { + close(errorId); + } + errorId = fd; + closeError = (useForStdOut) ? 0 : mustClose; + } + } else if ((argv[i][0] == '2') && (argv[i][1] == '>')) { + int append, atOk, flags; + + if ((errorId > 0) && closeError) { + close(errorId); + } + skip = 1; + p = argv[i] + 2; + if (*p == '>') { + p++; + append = 1; + atOk = 0; + flags = O_WRONLY|O_CREAT; + } else { + append = 0; + atOk = 1; + flags = O_WRONLY|O_CREAT|O_TRUNC; + } + errorId = FileForRedirect(interp, p, atOk, argv[i], flags, + argv[i+1], &skip, &closeError); + if (errorId < 0) { + goto error; + } + if (append) { + lseek(errorId, 0L, 2); + } + } else { + continue; + } + for (j = i+skip; j < argc; j++) { + argv[j-skip] = argv[j]; + } + argc -= skip; + i -= 1; /* Process next arg from same position. */ + } + if (argc == 0) { + interp->result = "didn't specify command to execute"; + return -1; + } + + if (inputId < 0) { + if (input != NULL) { + char inName[L_tmpnam]; + int length; + + /* + * The input for the first process is immediate data coming from + * Tcl. Create a temporary file for it and put the data into the + * file. + */ + +#ifdef linux + mkstemp(inName); +#else + tmpnam(inName); +#endif + inputId = open(inName, O_RDWR|O_CREAT|O_TRUNC, 0600); + closeInput = 1; + if (inputId < 0) { + Tcl_AppendResult(interp, + "couldn't create input file for command: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + length = strlen(input); + if (write(inputId, input, (size_t) length) != length) { + Tcl_AppendResult(interp, + "couldn't write file input for command: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + if ((lseek(inputId, 0L, 0) == -1) || (unlink(inName) == -1)) { + Tcl_AppendResult(interp, + "couldn't reset or remove input file for command: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + } else if (inPipePtr != NULL) { + /* + * The input for the first process in the pipeline is to + * come from a pipe that can be written from this end. + */ + + if (pipe(pipeIds) != 0) { + Tcl_AppendResult(interp, + "couldn't create input pipe for command: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + inputId = pipeIds[0]; + closeInput = 1; + *inPipePtr = pipeIds[1]; + pipeIds[0] = pipeIds[1] = -1; + } + } + + /* + * Set up a pipe to receive output from the pipeline, if no other + * output sink has been specified. + */ + + if ((outputId < 0) && (outPipePtr != NULL)) { + if (pipe(pipeIds) != 0) { + Tcl_AppendResult(interp, + "couldn't create output pipe: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + outputId = pipeIds[1]; + closeOutput = 1; + *outPipePtr = pipeIds[0]; + pipeIds[0] = pipeIds[1] = -1; + } + + /* + * Set up the standard error output sink for the pipeline, if + * requested. Use a temporary file which is opened, then deleted. + * Could potentially just use pipe, but if it filled up it could + * cause the pipeline to deadlock: we'd be waiting for processes + * to complete before reading stderr, and processes couldn't complete + * because stderr was backed up. + */ + + if (errFilePtr != NULL) { + char errName[L_tmpnam]; + +#ifdef linux + mkstemp(errName); +#else + tmpnam(errName); +#endif + *errFilePtr = open(errName, O_RDONLY|O_CREAT|O_TRUNC, 0600); + if (*errFilePtr < 0) { + errFileError: + Tcl_AppendResult(interp, + "couldn't create error file for command: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + if (errorId < 0) { + errorId = open(errName, O_WRONLY|O_CREAT|O_TRUNC, 0600); + if (errorId < 0) { + goto errFileError; + } + closeError = 1; + } + if (unlink(errName) == -1) { + Tcl_AppendResult(interp, + "couldn't remove error file for command: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + } + + /* + * Find the largest file descriptor used so far, so that we can + * clean up all the extraneous file descriptors in the child + * processes we create. + */ + + maxFd = inputId; + if (outputId > maxFd) { + maxFd = outputId; + } + if (errorId > maxFd) { + maxFd = errorId; + } + if ((inPipePtr != NULL) && (*inPipePtr > maxFd)) { + maxFd = *inPipePtr; + } + if ((outPipePtr != NULL) && (*outPipePtr > maxFd)) { + maxFd = *outPipePtr; + } + if ((errFilePtr != NULL) && (*errFilePtr > maxFd)) { + maxFd = *errFilePtr; + } + + /* + * Scan through the argc array, forking off a process for each + * group of arguments between "|" arguments. + */ + + pidPtr = (int *) ckalloc((unsigned) (cmdCount * sizeof(int))); + for (i = 0; i < numPids; i++) { + pidPtr[i] = -1; + } + Tcl_ReapDetachedProcs(); + for (firstArg = 0; firstArg < argc; numPids++, firstArg = lastArg+1) { + int joinThisError; + int curOutputId; + + joinThisError = 0; + for (lastArg = firstArg; lastArg < argc; lastArg++) { + if (argv[lastArg][0] == '|') { + if (argv[lastArg][1] == 0) { + break; + } + if ((argv[lastArg][1] == '&') && (argv[lastArg][2] == 0)) { + joinThisError = 1; + break; + } + } + } + argv[lastArg] = NULL; + if (lastArg == argc) { + curOutputId = outputId; + } else { + if (pipe(pipeIds) != 0) { + Tcl_AppendResult(interp, "couldn't create pipe: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + curOutputId = pipeIds[1]; + if (pipeIds[0] > maxFd) { + maxFd = pipeIds[0]; + } + if (pipeIds[1] > maxFd) { + maxFd = pipeIds[1]; + } + } + execName = Tcl_TildeSubst(interp, argv[firstArg], &buffer); + pid = fork(); + if (pid == 0) { + char errSpace[200]; + + if (((inputId != -1) && (dup2(inputId, 0) == -1)) + || ((curOutputId != -1) && (dup2(curOutputId, 1) == -1)) + || (joinThisError && (dup2(1, 2) == -1)) + || (!joinThisError && (errorId != -1) + && (dup2(errorId, 2) == -1))) { + char *err; + err = "forked process couldn't set up input/output\n"; + write(errorId < 0 ? 2 : errorId, err, (size_t) strlen(err)); + _exit(1); + } + for (i = 3; i <= maxFd; i++) { + close(i); + } + RestoreSignals(); + execvp(execName, &argv[firstArg]); + sprintf(errSpace, "couldn't find \"%.150s\" to execute\n", + argv[firstArg]); + write(2, errSpace, (size_t) strlen(errSpace)); + _exit(1); + } + Tcl_DStringFree(&buffer); + if (pid == -1) { + Tcl_AppendResult(interp, "couldn't fork child process: ", + Tcl_PosixError(interp), (char *) NULL); + goto error; + } + pidPtr[numPids] = pid; + + /* + * Close off our copies of file descriptors that were set up for + * this child, then set up the input for the next child. + */ + + if ((inputId != -1) && closeInput) { + close(inputId); + } + if ((curOutputId != -1) && (curOutputId != outputId)) { + close(curOutputId); + } + inputId = pipeIds[0]; + closeInput = 1; + pipeIds[0] = pipeIds[1] = -1; + } + *pidArrayPtr = pidPtr; + + /* + * All done. Cleanup open files lying around and then return. + */ + +cleanup: + if ((inputId != -1) && closeInput) { + close(inputId); + } + if ((outputId != -1) && closeOutput) { + close(outputId); + } + if ((errorId != -1) && closeError) { + close(errorId); + } + return numPids; + + /* + * An error occurred. There could have been extra files open, such + * as pipes between children. Clean them all up. Detach any child + * processes that have been created. + */ + + error: + if ((inPipePtr != NULL) && (*inPipePtr != -1)) { + close(*inPipePtr); + *inPipePtr = -1; + } + if ((outPipePtr != NULL) && (*outPipePtr != -1)) { + close(*outPipePtr); + *outPipePtr = -1; + } + if ((errFilePtr != NULL) && (*errFilePtr != -1)) { + close(*errFilePtr); + *errFilePtr = -1; + } + if (pipeIds[0] != -1) { + close(pipeIds[0]); + } + if (pipeIds[1] != -1) { + close(pipeIds[1]); + } + if (pidPtr != NULL) { + for (i = 0; i < numPids; i++) { + if (pidPtr[i] != -1) { + Tcl_DetachPids(1, &pidPtr[i]); + } + } + ckfree((char *) pidPtr); + } + numPids = -1; + goto cleanup; +} + +/* + *---------------------------------------------------------------------- + * + * FileForRedirect -- + * + * This procedure does much of the work of parsing redirection + * operators. It handles "@" if specified and allowed, and a file + * name, and opens the file if necessary. + * + * Results: + * The return value is the descriptor number for the file. If an + * error occurs then -1 is returned and an error message is left + * in interp->result. Several arguments are side-effected; see + * the argument list below for details. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +FileForRedirect(interp, spec, atOk, arg, flags, nextArg, skipPtr, closePtr) + Tcl_Interp *interp; /* Intepreter to use for error + * reporting. */ + register char *spec; /* Points to character just after + * redirection character. */ + int atOk; /* Non-zero means '@' notation is + * OK, zero means it isn't. */ + char *arg; /* Pointer to entire argument + * containing spec: used for error + * reporting. */ + int flags; /* Flags to use for opening file. */ + char *nextArg; /* Next argument in argc/argv + * array, if needed for file name. + * May be NULL. */ + int *skipPtr; /* This value is incremented if + * nextArg is used for redirection + * spec. */ + int *closePtr; /* This value is set to 1 if the file + * that's returned must be closed, 0 + * if it was specified with "@" so + * it must be left open. */ +{ + int writing = (flags & O_WRONLY); + FILE *f; + int fd; + + if (atOk && (*spec == '@')) { + spec++; + if (*spec == 0) { + spec = nextArg; + if (spec == NULL) { + goto badLastArg; + } + *skipPtr += 1; + } + if (Tcl_GetOpenFile(interp, spec, writing, 1, &f) != TCL_OK) { + return -1; + } + *closePtr = 0; + fd = fileno(f); + } else { + if (*spec == 0) { + spec = nextArg; + if (spec == NULL) { + goto badLastArg; + } + *skipPtr += 1; + } + fd = open(spec, flags, 0666); + if (fd < 0) { + Tcl_AppendResult(interp, "couldn't ", + (writing) ? "write" : "read", " file \"", spec, "\": ", + Tcl_PosixError(interp), (char *) NULL); + return -1; + } + *closePtr = 1; + } + return fd; + + badLastArg: + Tcl_AppendResult(interp, "can't specify \"", arg, + "\" as last word in command", (char *) NULL); + return -1; +} + +/* + *---------------------------------------------------------------------- + * + * RestoreSignals -- + * + * This procedure is invoked in a forked child process just before + * exec-ing a new program to restore all signals to their default + * settings. + * + * Results: + * None. + * + * Side effects: + * Signal settings get changed. + * + *---------------------------------------------------------------------- + */ + +static void +RestoreSignals() +{ +#ifdef SIGABRT + signal(SIGABRT, SIG_DFL); +#endif +#ifdef SIGALRM + signal(SIGALRM, SIG_DFL); +#endif +#ifdef SIGFPE + signal(SIGFPE, SIG_DFL); +#endif +#ifdef SIGHUP + signal(SIGHUP, SIG_DFL); +#endif +#ifdef SIGILL + signal(SIGILL, SIG_DFL); +#endif +#ifdef SIGINT + signal(SIGINT, SIG_DFL); +#endif +#ifdef SIGPIPE + signal(SIGPIPE, SIG_DFL); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, SIG_DFL); +#endif +#ifdef SIGSEGV + signal(SIGSEGV, SIG_DFL); +#endif +#ifdef SIGTERM + signal(SIGTERM, SIG_DFL); +#endif +#ifdef SIGUSR1 + signal(SIGUSR1, SIG_DFL); +#endif +#ifdef SIGUSR2 + signal(SIGUSR2, SIG_DFL); +#endif +#ifdef SIGCHLD + signal(SIGCHLD, SIG_DFL); +#endif +#ifdef SIGCONT + signal(SIGCONT, SIG_DFL); +#endif +#ifdef SIGTSTP + signal(SIGTSTP, SIG_DFL); +#endif +#ifdef SIGTTIN + signal(SIGTTIN, SIG_DFL); +#endif +#ifdef SIGTTOU + signal(SIGTTOU, SIG_DFL); +#endif +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_PosixError -- + * + * This procedure is typically called after UNIX kernel calls + * return errors. It stores machine-readable information about + * the error in $errorCode returns an information string for + * the caller's use. + * + * Results: + * The return value is a human-readable string describing the + * error, as returned by strerror. + * + * Side effects: + * The global variable $errorCode is reset. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_PosixError(interp) + Tcl_Interp *interp; /* Interpreter whose $errorCode variable + * is to be changed. */ +{ + char *id, *msg; + + id = Tcl_ErrnoId(); + msg = strerror(errno); + Tcl_SetErrorCode(interp, "POSIX", id, msg, (char *) NULL); + return msg; +} + +/* + *---------------------------------------------------------------------- + * + * MakeFileTable -- + * + * Create or enlarge the file table for the interpreter, so that + * there is room for a given index. + * + * Results: + * None. + * + * Side effects: + * The file table for iPtr will be created if it doesn't exist + * (and entries will be added for stdin, stdout, and stderr). + * If it already exists, then it will be grown if necessary. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +static void +MakeFileTable(iPtr, index) + Interp *iPtr; /* Interpreter whose table of files is + * to be manipulated. */ + int index; /* Make sure table is large enough to + * hold at least this index. */ +{ + /* + * If the table doesn't even exist, then create it and initialize + * entries for standard files. + */ + + if (tclNumFiles == 0) { + OpenFile *oFilePtr; + int i; + + if (index < 2) { + tclNumFiles = 3; + } else { + tclNumFiles = index+1; + } + tclOpenFiles = (OpenFile **) ckalloc((unsigned) + ((tclNumFiles)*sizeof(OpenFile *))); + for (i = tclNumFiles-1; i >= 0; i--) { + tclOpenFiles[i] = NULL; + } + + oFilePtr = (OpenFile *) ckalloc(sizeof(OpenFile)); + oFilePtr->f = stdin; + oFilePtr->f2 = NULL; + oFilePtr->permissions = TCL_FILE_READABLE; + oFilePtr->numPids = 0; + oFilePtr->pidPtr = NULL; + oFilePtr->errorId = -1; + tclOpenFiles[0] = oFilePtr; + + oFilePtr = (OpenFile *) ckalloc(sizeof(OpenFile)); + oFilePtr->f = stdout; + oFilePtr->f2 = NULL; + oFilePtr->permissions = TCL_FILE_WRITABLE; + oFilePtr->numPids = 0; + oFilePtr->pidPtr = NULL; + oFilePtr->errorId = -1; + tclOpenFiles[1] = oFilePtr; + + oFilePtr = (OpenFile *) ckalloc(sizeof(OpenFile)); + oFilePtr->f = stderr; + oFilePtr->f2 = NULL; + oFilePtr->permissions = TCL_FILE_WRITABLE; + oFilePtr->numPids = 0; + oFilePtr->pidPtr = NULL; + oFilePtr->errorId = -1; + tclOpenFiles[2] = oFilePtr; + } else if (index >= tclNumFiles) { + int newSize; + OpenFile **newPtrArray; + int i; + + newSize = index+1; + newPtrArray = (OpenFile **) ckalloc((unsigned) + ((newSize)*sizeof(OpenFile *))); + memcpy((VOID *) newPtrArray, (VOID *) tclOpenFiles, + tclNumFiles*sizeof(OpenFile *)); + for (i = tclNumFiles; i < newSize; i++) { + newPtrArray[i] = NULL; + } + ckfree((char *) tclOpenFiles); + tclNumFiles = newSize; + tclOpenFiles = newPtrArray; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_EnterFile -- + * + * This procedure is used to enter an already-open file into the + * file table for an interpreter so that the file can be read + * and written with Tcl commands. + * + * Results: + * There is no return value, but interp->result is set to + * hold Tcl's id for the open file, such as "file4". + * + * Side effects: + * "File" is added to the files accessible from interp. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_EnterFile(interp, file, permissions) + Tcl_Interp *interp; /* Interpreter in which to make file + * available. */ + FILE *file; /* File to make available in interp. */ + int permissions; /* Ops that may be done on file: OR-ed + * combinination of TCL_FILE_READABLE and + * TCL_FILE_WRITABLE. */ +{ + Interp *iPtr = (Interp *) interp; + int fd; + register OpenFile *oFilePtr; + + fd = fileno(file); + if (fd >= tclNumFiles) { + MakeFileTable(iPtr, fd); + } + oFilePtr = tclOpenFiles[fd]; + + /* + * It's possible that there already appears to be a file open in + * the slot. This could happen, for example, if the application + * closes a file behind our back so that we don't have a chance + * to clean up. This is probably a bad idea, but if it happens + * just discard the information in the old record (hopefully the + * application is smart enough to have really cleaned everything + * up right). + */ + + if (oFilePtr == NULL) { + oFilePtr = (OpenFile *) ckalloc(sizeof(OpenFile)); + tclOpenFiles[fd] = oFilePtr; + } + oFilePtr->f = file; + oFilePtr->f2 = NULL; + oFilePtr->permissions = permissions; + oFilePtr->numPids = 0; + oFilePtr->pidPtr = NULL; + oFilePtr->errorId = -1; + if (fd <= 2) { + if (fd == 0) { + interp->result = "stdin"; + } else if (fd == 1) { + interp->result = "stdout"; + } else { + interp->result = "stderr"; + } + } else { + sprintf(interp->result, "file%d", fd); + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetOpenFile -- + * + * Given a string identifier for an open file, find the corresponding + * open file structure, if there is one. + * + * Results: + * A standard Tcl return value. If the open file is successfully + * located and meets any usage check requested by checkUsage, TCL_OK + * is returned and *filePtr is modified to hold a pointer to its + * FILE structure. If an error occurs then TCL_ERROR is returned + * and interp->result contains an error message. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_GetOpenFile(interp, string, forWriting, checkUsage, filePtr) + Tcl_Interp *interp; /* Interpreter in which to find file. */ + char *string; /* String that identifies file. */ + int forWriting; /* 1 means the file is going to be used + * for writing, 0 means for reading. */ + int checkUsage; /* 1 means verify that the file was opened + * in a mode that allows the access specified + * by "forWriting". */ + FILE **filePtr; /* Store pointer to FILE structure here. */ +{ + OpenFile *oFilePtr; + int fd = 0; /* Initial value needed only to stop compiler + * warnings. */ + Interp *iPtr = (Interp *) interp; + + if ((string[0] == 'f') && (string[1] == 'i') && (string[2] == 'l') + & (string[3] == 'e')) { + char *end; + + fd = strtoul(string+4, &end, 10); + if ((end == string+4) || (*end != 0)) { + goto badId; + } + } else if ((string[0] == 's') && (string[1] == 't') + && (string[2] == 'd')) { + if (strcmp(string+3, "in") == 0) { + fd = 0; + } else if (strcmp(string+3, "out") == 0) { + fd = 1; + } else if (strcmp(string+3, "err") == 0) { + fd = 2; + } else { + goto badId; + } + } else { + badId: + Tcl_AppendResult(interp, "bad file identifier \"", string, + "\"", (char *) NULL); + return TCL_ERROR; + } + + if (fd >= tclNumFiles) { + if ((tclNumFiles == 0) && (fd <= 2)) { + MakeFileTable(iPtr, fd); + } else { + notOpen: + Tcl_AppendResult(interp, "file \"", string, "\" isn't open", + (char *) NULL); + return TCL_ERROR; + } + } + oFilePtr = tclOpenFiles[fd]; + if (oFilePtr == NULL) { + goto notOpen; + } + if (forWriting) { + if (checkUsage && !(oFilePtr->permissions & TCL_FILE_WRITABLE)) { + Tcl_AppendResult(interp, "\"", string, + "\" wasn't opened for writing", (char *) NULL); + return TCL_ERROR; + } + if (oFilePtr->f2 != NULL) { + *filePtr = oFilePtr->f2; + } else { + *filePtr = oFilePtr->f; + } + } else { + if (checkUsage && !(oFilePtr->permissions & TCL_FILE_READABLE)) { + Tcl_AppendResult(interp, "\"", string, + "\" wasn't opened for reading", (char *) NULL); + return TCL_ERROR; + } + *filePtr = oFilePtr->f; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_FilePermissions -- + * + * Given a FILE * pointer, return the read/write permissions + * associated with the open file. + * + * Results: + * If file is currently open, the return value is an OR-ed + * combination of TCL_FILE_READABLE and TCL_FILE_WRITABLE, + * which indicates the operations permitted on the open file. + * If the file isn't open then the return value is -1. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_FilePermissions(file) + FILE *file; /* File for which permissions are wanted. */ +{ + register OpenFile *oFilePtr; + int i, fd; + + /* + * First try the entry in tclOpenFiles given by the file descriptor + * for the file. If that doesn't match then search all the entries + * in tclOpenFiles. + */ + + if (file != NULL) { + fd = fileno(file); + if (fd < tclNumFiles) { + oFilePtr = tclOpenFiles[fd]; + if ((oFilePtr != NULL) && (oFilePtr->f == file)) { + return oFilePtr->permissions; + } + } + } + for (i = 0; i < tclNumFiles; i++) { + oFilePtr = tclOpenFiles[i]; + if (oFilePtr == NULL) { + continue; + } + if ((oFilePtr->f == file) || (oFilePtr->f2 == file)) { + return oFilePtr->permissions; + } + } + return -1; +} + +/* + *---------------------------------------------------------------------- + * + * TclOpen, etc. -- + * + * Below are a bunch of procedures that are used by Tcl instead + * of system calls. Each of the procedures executes the + * corresponding system call and retries automatically + * if the system call was interrupted by a signal. + * + * Results: + * Whatever the system call would normally return. + * + * Side effects: + * Whatever the system call would normally do. + * + * NOTE: + * This should be the last page of this file, since it undefines + * the macros that redirect read etc. to the procedures below. + * + *---------------------------------------------------------------------- + */ + +#undef open +int +TclOpen(path, oflag, mode) + char *path; + int oflag; + int mode; +{ + int result; + while (1) { + result = open(path, oflag, mode); + if ((result != -1) || (errno != EINTR)) { + return result; + } + } +} + +#undef read +int +TclRead(fd, buf, numBytes) + int fd; + VOID *buf; + size_t numBytes; +{ + int result; + while (1) { + result = read(fd, buf, (size_t) numBytes); + if ((result != -1) || (errno != EINTR)) { + return result; + } + } +} + +#undef waitpid +extern pid_t waitpid _ANSI_ARGS_((pid_t pid, int *stat_loc, int options)); + +/* + * Note: the #ifdef below is needed to avoid compiler errors on systems + * that have ANSI compilers and also define pid_t to be short. The + * problem is a complex one having to do with argument type promotion. + */ + +#ifdef _USING_PROTOTYPES_ +int +TclWaitpid _ANSI_ARGS_((pid_t pid, int *statPtr, int options)) +#else +int +TclWaitpid(pid, statPtr, options) + pid_t pid; + int *statPtr; + int options; +#endif /* _USING_PROTOTYPES_ */ +{ + int result; + while (1) { + result = waitpid(pid, statPtr, options); + if ((result != -1) || (errno != EINTR)) { + return result; + } + } +} + +#undef write +int +TclWrite(fd, buf, numBytes) + int fd; + VOID *buf; + size_t numBytes; +{ + int result; + while (1) { + result = write(fd, buf, (size_t) numBytes); + if ((result != -1) || (errno != EINTR)) { + return result; + } + } +} diff --git a/vendor/x11iraf/obm/Tcl/tclUtil.c b/vendor/x11iraf/obm/Tcl/tclUtil.c new file mode 100644 index 00000000..5c3905a9 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclUtil.c @@ -0,0 +1,1998 @@ +/* + * tclUtil.c -- + * + * This file contains utility procedures that are used by many Tcl + * commands. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUtil.c,v 1.84 93/10/11 09:18:49 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" + +/* + * The following values are used in the flags returned by Tcl_ScanElement + * and used by Tcl_ConvertElement. The value TCL_DONT_USE_BRACES is also + * defined in tcl.h; make sure its value doesn't overlap with any of the + * values below. + * + * TCL_DONT_USE_BRACES - 1 means the string mustn't be enclosed in + * braces (e.g. it contains unmatched braces, + * or ends in a backslash character, or user + * just doesn't want braces); handle all + * special characters by adding backslashes. + * USE_BRACES - 1 means the string contains a special + * character that can be handled simply by + * enclosing the entire argument in braces. + * BRACES_UNMATCHED - 1 means that braces aren't properly matched + * in the argument. + */ + +#define USE_BRACES 2 +#define BRACES_UNMATCHED 4 + +/* + * The variable below is set to NULL before invoking regexp functions + * and checked after those functions. If an error occurred then TclRegError + * will set the variable to point to a (static) error message. This + * mechanism unfortunately does not support multi-threading, but then + * neither does the rest of the regexp facilities. + */ + +char *tclRegexpError = NULL; + +/* + * Function prototypes for local procedures in this file: + */ + +static void SetupAppendBuffer _ANSI_ARGS_((Interp *iPtr, + int newSpace)); + +/* + *---------------------------------------------------------------------- + * + * TclFindElement -- + * + * Given a pointer into a Tcl list, locate the first (or next) + * element in the list. + * + * Results: + * The return value is normally TCL_OK, which means that the + * element was successfully located. If TCL_ERROR is returned + * it means that list didn't have proper list structure; + * interp->result contains a more detailed error message. + * + * If TCL_OK is returned, then *elementPtr will be set to point + * to the first element of list, and *nextPtr will be set to point + * to the character just after any white space following the last + * character that's part of the element. If this is the last argument + * in the list, then *nextPtr will point to the NULL character at the + * end of list. If sizePtr is non-NULL, *sizePtr is filled in with + * the number of characters in the element. If the element is in + * braces, then *elementPtr will point to the character after the + * opening brace and *sizePtr will not include either of the braces. + * If there isn't an element in the list, *sizePtr will be zero, and + * both *elementPtr and *termPtr will refer to the null character at + * the end of list. Note: this procedure does NOT collapse backslash + * sequences. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclFindElement(interp, list, elementPtr, nextPtr, sizePtr, bracePtr) + Tcl_Interp *interp; /* Interpreter to use for error reporting. */ + register char *list; /* String containing Tcl list with zero + * or more elements (possibly in braces). */ + char **elementPtr; /* Fill in with location of first significant + * character in first element of list. */ + char **nextPtr; /* Fill in with location of character just + * after all white space following end of + * argument (i.e. next argument or end of + * list). */ + int *sizePtr; /* If non-zero, fill in with size of + * element. */ + int *bracePtr; /* If non-zero fill in with non-zero/zero + * to indicate that arg was/wasn't + * in braces. */ +{ + register char *p; + int openBraces = 0; + int inQuotes = 0; + int size; + + /* + * Skim off leading white space and check for an opening brace or + * quote. Note: use of "isascii" below and elsewhere in this + * procedure is a temporary hack (7/27/90) because Mx uses characters + * with the high-order bit set for some things. This should probably + * be changed back eventually, or all of Tcl should call isascii. + */ + + while (isspace(UCHAR(*list))) { + list++; + } + if (*list == '{') { + openBraces = 1; + list++; + } else if (*list == '"') { + inQuotes = 1; + list++; + } + if (bracePtr != 0) { + *bracePtr = openBraces; + } + p = list; + + /* + * Find the end of the element (either a space or a close brace or + * the end of the string). + */ + + while (1) { + switch (*p) { + + /* + * Open brace: don't treat specially unless the element is + * in braces. In this case, keep a nesting count. + */ + + case '{': + if (openBraces != 0) { + openBraces++; + } + break; + + /* + * Close brace: if element is in braces, keep nesting + * count and quit when the last close brace is seen. + */ + + case '}': + if (openBraces == 1) { + char *p2; + + size = p - list; + p++; + if (isspace(UCHAR(*p)) || (*p == 0)) { + goto done; + } + for (p2 = p; (*p2 != 0) && (!isspace(UCHAR(*p2))) + && (p2 < p+20); p2++) { + /* null body */ + } + Tcl_ResetResult(interp); + sprintf(interp->result, + "list element in braces followed by \"%.*s\" instead of space", + p2-p, p); + return TCL_ERROR; + } else if (openBraces != 0) { + openBraces--; + } + break; + + /* + * Backslash: skip over everything up to the end of the + * backslash sequence. + */ + + case '\\': { + int size; + + (void) Tcl_Backslash(p, &size); + p += size - 1; + break; + } + + /* + * Space: ignore if element is in braces or quotes; otherwise + * terminate element. + */ + + case ' ': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + if ((openBraces == 0) && !inQuotes) { + size = p - list; + goto done; + } + break; + + /* + * Double-quote: if element is in quotes then terminate it. + */ + + case '"': + if (inQuotes) { + char *p2; + + size = p-list; + p++; + if (isspace(UCHAR(*p)) || (*p == 0)) { + goto done; + } + for (p2 = p; (*p2 != 0) && (!isspace(UCHAR(*p2))) + && (p2 < p+20); p2++) { + /* null body */ + } + Tcl_ResetResult(interp); + sprintf(interp->result, + "list element in quotes followed by \"%.*s\" %s", + p2-p, p, "instead of space"); + return TCL_ERROR; + } + break; + + /* + * End of list: terminate element. + */ + + case 0: + if (openBraces != 0) { + Tcl_SetResult(interp, "unmatched open brace in list", + TCL_STATIC); + return TCL_ERROR; + } else if (inQuotes) { + Tcl_SetResult(interp, "unmatched open quote in list", + TCL_STATIC); + return TCL_ERROR; + } + size = p - list; + goto done; + + } + p++; + } + + done: + while (isspace(UCHAR(*p))) { + p++; + } + *elementPtr = list; + *nextPtr = p; + if (sizePtr != 0) { + *sizePtr = size; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCopyAndCollapse -- + * + * Copy a string and eliminate any backslashes that aren't in braces. + * + * Results: + * There is no return value. Count chars. get copied from src + * to dst. Along the way, if backslash sequences are found outside + * braces, the backslashes are eliminated in the copy. + * After scanning count chars. from source, a null character is + * placed at the end of dst. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +TclCopyAndCollapse(count, src, dst) + int count; /* Total number of characters to copy + * from src. */ + register char *src; /* Copy from here... */ + register char *dst; /* ... to here. */ +{ + register char c; + int numRead; + + for (c = *src; count > 0; src++, c = *src, count--) { + if (c == '\\') { + *dst = Tcl_Backslash(src, &numRead); + dst++; + src += numRead-1; + count -= numRead-1; + } else { + *dst = c; + dst++; + } + } + *dst = 0; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SplitList -- + * + * Splits a list up into its constituent fields. + * + * Results + * The return value is normally TCL_OK, which means that + * the list was successfully split up. If TCL_ERROR is + * returned, it means that "list" didn't have proper list + * structure; interp->result will contain a more detailed + * error message. + * + * *argvPtr will be filled in with the address of an array + * whose elements point to the elements of list, in order. + * *argcPtr will get filled in with the number of valid elements + * in the array. A single block of memory is dynamically allocated + * to hold both the argv array and a copy of the list (with + * backslashes and braces removed in the standard way). + * The caller must eventually free this memory by calling free() + * on *argvPtr. Note: *argvPtr and *argcPtr are only modified + * if the procedure returns normally. + * + * Side effects: + * Memory is allocated. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_SplitList(interp, list, argcPtr, argvPtr) + Tcl_Interp *interp; /* Interpreter to use for error reporting. */ + char *list; /* Pointer to string with list structure. */ + int *argcPtr; /* Pointer to location to fill in with + * the number of elements in the list. */ + char ***argvPtr; /* Pointer to place to store pointer to array + * of pointers to list elements. */ +{ + char **argv; + register char *p; + int size, i, result, elSize, brace; + char *element; + + /* + * Figure out how much space to allocate. There must be enough + * space for both the array of pointers and also for a copy of + * the list. To estimate the number of pointers needed, count + * the number of space characters in the list. + */ + + for (size = 1, p = list; *p != 0; p++) { + if (isspace(UCHAR(*p))) { + size++; + } + } + size++; /* Leave space for final NULL pointer. */ + argv = (char **) ckalloc((unsigned) + ((size * sizeof(char *)) + (p - list) + 1)); + for (i = 0, p = ((char *) argv) + size*sizeof(char *); + *list != 0; i++) { + result = TclFindElement(interp, list, &element, &list, &elSize, &brace); + if (result != TCL_OK) { + ckfree((char *) argv); + return result; + } + if (*element == 0) { + break; + } + if (i >= size) { + ckfree((char *) argv); + Tcl_SetResult(interp, "internal error in Tcl_SplitList", + TCL_STATIC); + return TCL_ERROR; + } + argv[i] = p; + if (brace) { + strncpy(p, element, elSize); + p += elSize; + *p = 0; + p++; + } else { + TclCopyAndCollapse(elSize, element, p); + p += elSize+1; + } + } + + argv[i] = NULL; + *argvPtr = argv; + *argcPtr = i; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ScanElement -- + * + * This procedure is a companion procedure to Tcl_ConvertElement. + * It scans a string to see what needs to be done to it (e.g. + * add backslashes or enclosing braces) to make the string into + * a valid Tcl list element. + * + * Results: + * The return value is an overestimate of the number of characters + * that will be needed by Tcl_ConvertElement to produce a valid + * list element from string. The word at *flagPtr is filled in + * with a value needed by Tcl_ConvertElement when doing the actual + * conversion. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_ScanElement(string, flagPtr) + char *string; /* String to convert to Tcl list element. */ + int *flagPtr; /* Where to store information to guide + * Tcl_ConvertElement. */ +{ + int flags, nestingLevel; + register char *p; + + /* + * This procedure and Tcl_ConvertElement together do two things: + * + * 1. They produce a proper list, one that will yield back the + * argument strings when evaluated or when disassembled with + * Tcl_SplitList. This is the most important thing. + * + * 2. They try to produce legible output, which means minimizing the + * use of backslashes (using braces instead). However, there are + * some situations where backslashes must be used (e.g. an element + * like "{abc": the leading brace will have to be backslashed. For + * each element, one of three things must be done: + * + * (a) Use the element as-is (it doesn't contain anything special + * characters). This is the most desirable option. + * + * (b) Enclose the element in braces, but leave the contents alone. + * This happens if the element contains embedded space, or if it + * contains characters with special interpretation ($, [, ;, or \), + * or if it starts with a brace or double-quote, or if there are + * no characters in the element. + * + * (c) Don't enclose the element in braces, but add backslashes to + * prevent special interpretation of special characters. This is a + * last resort used when the argument would normally fall under case + * (b) but contains unmatched braces. It also occurs if the last + * character of the argument is a backslash or if the element contains + * a backslash followed by newline. + * + * The procedure figures out how many bytes will be needed to store + * the result (actually, it overestimates). It also collects information + * about the element in the form of a flags word. + */ + + nestingLevel = 0; + flags = 0; + if (string == NULL) { + string = ""; + } + p = string; + if ((*p == '{') || (*p == '"') || (*p == 0)) { + flags |= USE_BRACES; + } + for ( ; *p != 0; p++) { + switch (*p) { + case '{': + nestingLevel++; + break; + case '}': + nestingLevel--; + if (nestingLevel < 0) { + flags |= TCL_DONT_USE_BRACES|BRACES_UNMATCHED; + } + break; + case '[': + case '$': + case ';': + case ' ': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + flags |= USE_BRACES; + break; + case '\\': + if ((p[1] == 0) || (p[1] == '\n')) { + flags = TCL_DONT_USE_BRACES; + } else { + int size; + + (void) Tcl_Backslash(p, &size); + p += size-1; + flags |= USE_BRACES; + } + break; + } + } + if (nestingLevel != 0) { + flags = TCL_DONT_USE_BRACES | BRACES_UNMATCHED; + } + *flagPtr = flags; + + /* + * Allow enough space to backslash every character plus leave + * two spaces for braces. + */ + + return 2*(p-string) + 2; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ConvertElement -- + * + * This is a companion procedure to Tcl_ScanElement. Given the + * information produced by Tcl_ScanElement, this procedure converts + * a string to a list element equal to that string. + * + * Results: + * Information is copied to *dst in the form of a list element + * identical to src (i.e. if Tcl_SplitList is applied to dst it + * will produce a string identical to src). The return value is + * a count of the number of characters copied (not including the + * terminating NULL character). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_ConvertElement(src, dst, flags) + register char *src; /* Source information for list element. */ + char *dst; /* Place to put list-ified element. */ + int flags; /* Flags produced by Tcl_ScanElement. */ +{ + register char *p = dst; + + /* + * See the comment block at the beginning of the Tcl_ScanElement + * code for details of how this works. + */ + + if (src == NULL) { + src = ""; + } + if ((flags & USE_BRACES) && !(flags & TCL_DONT_USE_BRACES)) { + *p = '{'; + p++; + for ( ; *src != 0; src++, p++) { + *p = *src; + } + *p = '}'; + p++; + } else if (*src == 0) { + /* + * If string is empty but can't use braces, then use special + * backslash sequence that maps to empty string. + */ + + p[0] = '\\'; + p[1] = '0'; + p += 2; + } else { + if (*src == '{') { + /* + * Can't have a leading brace unless the whole element is + * enclosed in braces. Add a backslash before the brace. + * Furthermore, this may destroy the balance between open + * and close braces, so set BRACES_UNMATCHED. + */ + + p[0] = '\\'; + p[1] = '{'; + p += 2; + src++; + flags |= BRACES_UNMATCHED; + } + for (; *src != 0 ; src++) { + switch (*src) { + case ']': + case '[': + case '$': + case ';': + case ' ': + case '\\': + case '"': + *p = '\\'; + p++; + break; + case '{': + case '}': + /* + * It may not seem necessary to backslash braces, but + * it is. The reason for this is that the resulting + * list element may actually be an element of a sub-list + * enclosed in braces (e.g. if Tcl_DStringStartSublist + * has been invoked), so there may be a brace mismatch + * if the braces aren't backslashed. + */ + + if (flags & BRACES_UNMATCHED) { + *p = '\\'; + p++; + } + break; + case '\f': + *p = '\\'; + p++; + *p = 'f'; + p++; + continue; + case '\n': + *p = '\\'; + p++; + *p = 'n'; + p++; + continue; + case '\r': + *p = '\\'; + p++; + *p = 'r'; + p++; + continue; + case '\t': + *p = '\\'; + p++; + *p = 't'; + p++; + continue; + case '\v': + *p = '\\'; + p++; + *p = 'v'; + p++; + continue; + } + *p = *src; + p++; + } + } + *p = '\0'; + return p-dst; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_Merge -- + * + * Given a collection of strings, merge them together into a + * single string that has proper Tcl list structured (i.e. + * Tcl_SplitList may be used to retrieve strings equal to the + * original elements, and Tcl_Eval will parse the string back + * into its original elements). + * + * Results: + * The return value is the address of a dynamically-allocated + * string containing the merged list. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_Merge(argc, argv) + int argc; /* How many strings to merge. */ + char **argv; /* Array of string values. */ +{ +# define LOCAL_SIZE 20 + int localFlags[LOCAL_SIZE], *flagPtr; + int numChars; + char *result; + register char *dst; + int i; + + /* + * Pass 1: estimate space, gather flags. + */ + + if (argc <= LOCAL_SIZE) { + flagPtr = localFlags; + } else { + flagPtr = (int *) ckalloc((unsigned) argc*sizeof(int)); + } + numChars = 1; + for (i = 0; i < argc; i++) { + numChars += Tcl_ScanElement(argv[i], &flagPtr[i]) + 1; + } + + /* + * Pass two: copy into the result area. + */ + + result = (char *) ckalloc((unsigned) numChars); + dst = result; + for (i = 0; i < argc; i++) { + numChars = Tcl_ConvertElement(argv[i], dst, flagPtr[i]); + dst += numChars; + *dst = ' '; + dst++; + } + if (dst == result) { + *dst = 0; + } else { + dst[-1] = 0; + } + + if (flagPtr != localFlags) { + ckfree((char *) flagPtr); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_Concat -- + * + * Concatenate a set of strings into a single large string. + * + * Results: + * The return value is dynamically-allocated string containing + * a concatenation of all the strings in argv, with spaces between + * the original argv elements. + * + * Side effects: + * Memory is allocated for the result; the caller is responsible + * for freeing the memory. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_Concat(argc, argv) + int argc; /* Number of strings to concatenate. */ + char **argv; /* Array of strings to concatenate. */ +{ + int totalSize, i; + register char *p; + char *result; + + for (totalSize = 1, i = 0; i < argc; i++) { + totalSize += strlen(argv[i]) + 1; + } + result = (char *) ckalloc((unsigned) totalSize); + if (argc == 0) { + *result = '\0'; + return result; + } + for (p = result, i = 0; i < argc; i++) { + char *element; + int length; + + /* + * Clip white space off the front and back of the string + * to generate a neater result, and ignore any empty + * elements. + */ + + element = argv[i]; + while (isspace(UCHAR(*element))) { + element++; + } + for (length = strlen(element); + (length > 0) && (isspace(UCHAR(element[length-1]))); + length--) { + /* Null loop body. */ + } + if (length == 0) { + continue; + } + (void) strncpy(p, element, length); + p += length; + *p = ' '; + p++; + } + if (p != result) { + p[-1] = 0; + } else { + *p = 0; + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_StringMatch -- + * + * See if a particular string matches a particular pattern. + * + * Results: + * The return value is 1 if string matches pattern, and + * 0 otherwise. The matching operation permits the following + * special characters in the pattern: *?\[] (see the manual + * entry for details on what these mean). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_StringMatch(string, pattern) + register char *string; /* String. */ + register char *pattern; /* Pattern, which may contain + * special characters. */ +{ + char c2; + + while (1) { + /* See if we're at the end of both the pattern and the string. + * If so, we succeeded. If we're at the end of the pattern + * but not at the end of the string, we failed. + */ + + if (*pattern == 0) { + if (*string == 0) { + return 1; + } else { + return 0; + } + } + if ((*string == 0) && (*pattern != '*')) { + return 0; + } + + /* Check for a "*" as the next pattern character. It matches + * any substring. We handle this by calling ourselves + * recursively for each postfix of string, until either we + * match or we reach the end of the string. + */ + + if (*pattern == '*') { + pattern += 1; + if (*pattern == 0) { + return 1; + } + while (1) { + if (Tcl_StringMatch(string, pattern)) { + return 1; + } + if (*string == 0) { + return 0; + } + string += 1; + } + } + + /* Check for a "?" as the next pattern character. It matches + * any single character. + */ + + if (*pattern == '?') { + goto thisCharOK; + } + + /* Check for a "[" as the next pattern character. It is followed + * by a list of characters that are acceptable, or by a range + * (two characters separated by "-"). + */ + + if (*pattern == '[') { + pattern += 1; + while (1) { + if ((*pattern == ']') || (*pattern == 0)) { + return 0; + } + if (*pattern == *string) { + break; + } + if (pattern[1] == '-') { + c2 = pattern[2]; + if (c2 == 0) { + return 0; + } + if ((*pattern <= *string) && (c2 >= *string)) { + break; + } + if ((*pattern >= *string) && (c2 <= *string)) { + break; + } + pattern += 2; + } + pattern += 1; + } + while ((*pattern != ']') && (*pattern != 0)) { + pattern += 1; + } + goto thisCharOK; + } + + /* If the next pattern character is '/', just strip off the '/' + * so we do exact matching on the character that follows. + */ + + if (*pattern == '\\') { + pattern += 1; + if (*pattern == 0) { + return 0; + } + } + + /* There's no special character. Just make sure that the next + * characters of each string match. + */ + + if (*pattern != *string) { + return 0; + } + + thisCharOK: pattern += 1; + string += 1; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetResult -- + * + * Arrange for "string" to be the Tcl return value. + * + * Results: + * None. + * + * Side effects: + * interp->result is left pointing either to "string" (if "copy" is 0) + * or to a copy of string. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_SetResult(interp, string, freeProc) + Tcl_Interp *interp; /* Interpreter with which to associate the + * return value. */ + char *string; /* Value to be returned. If NULL, + * the result is set to an empty string. */ + Tcl_FreeProc *freeProc; /* Gives information about the string: + * TCL_STATIC, TCL_VOLATILE, or the address + * of a Tcl_FreeProc such as free. */ +{ + register Interp *iPtr = (Interp *) interp; + int length; + Tcl_FreeProc *oldFreeProc = iPtr->freeProc; + char *oldResult = iPtr->result; + + iPtr->freeProc = freeProc; + if (string == NULL) { + iPtr->resultSpace[0] = 0; + iPtr->result = iPtr->resultSpace; + iPtr->freeProc = 0; + } else if (freeProc == TCL_VOLATILE) { + length = strlen(string); + if (length > TCL_RESULT_SIZE) { + iPtr->result = (char *) ckalloc((unsigned) length+1); + iPtr->freeProc = (Tcl_FreeProc *) free; + } else { + iPtr->result = iPtr->resultSpace; + iPtr->freeProc = 0; + } + strcpy(iPtr->result, string); + } else { + iPtr->result = string; + } + + /* + * If the old result was dynamically-allocated, free it up. Do it + * here, rather than at the beginning, in case the new result value + * was part of the old result value. + */ + + if (oldFreeProc != 0) { + if (oldFreeProc == (Tcl_FreeProc *) free) { + ckfree(oldResult); + } else { + (*oldFreeProc)(oldResult); + } + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppendResult -- + * + * Append a variable number of strings onto the result already + * present for an interpreter. + * + * Results: + * None. + * + * Side effects: + * The result in the interpreter given by the first argument + * is extended by the strings given by the second and following + * arguments (up to a terminating NULL argument). + * + *---------------------------------------------------------------------- + */ + + /* VARARGS2 */ +void +#ifdef USE_STDARG +Tcl_AppendResult(Tcl_Interp *interp, ...) +#else +#ifndef lint +Tcl_AppendResult(va_alist) +#else +void + /* VARARGS2 */ /* ARGSUSED */ +Tcl_AppendResult(interp, p, va_alist) + Tcl_Interp *interp; /* Interpreter whose result is to be + * extended. */ + char *p; /* One or more strings to add to the + * result, terminated with NULL. */ +#endif + va_dcl +#endif +{ + va_list argList; + Interp *iPtr = (Interp *) interp; + char *string; + int newSpace; + + /* + * First, scan through all the arguments to see how much space is + * needed. + */ + +#ifdef USE_STDARG + va_start(argList, interp); +#else + va_start(argList); + (void) va_arg(argList, Interp *); +#endif + newSpace = 0; + while (1) { + string = va_arg(argList, char *); + if (string == NULL) { + break; + } + newSpace += strlen(string); + } + va_end(argList); + + /* + * If the append buffer isn't already setup and large enough + * to hold the new data, set it up. + */ + + if ((iPtr->result != iPtr->appendResult) + || (iPtr->appendResult[iPtr->appendUsed] != 0) + || ((newSpace + iPtr->appendUsed) >= iPtr->appendAvl)) { + SetupAppendBuffer(iPtr, newSpace); + } + + /* + * Final step: go through all the argument strings again, copying + * them into the buffer. + */ + +#ifdef USE_STDARG + va_start(argList, interp); +#else + va_start(argList); + (void) va_arg(argList, Interp *); +#endif + while (1) { + string = va_arg(argList, char *); + if (string == NULL) { + break; + } + strcpy(iPtr->appendResult + iPtr->appendUsed, string); + iPtr->appendUsed += strlen(string); + } + va_end(argList); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppendElement -- + * + * Convert a string to a valid Tcl list element and append it + * to the current result (which is ostensibly a list). + * + * Results: + * None. + * + * Side effects: + * The result in the interpreter given by the first argument + * is extended with a list element converted from string. A + * separator space is added before the converted list element + * unless the current result is empty, contains the single + * character "{", or ends in " {". + * + *---------------------------------------------------------------------- + */ + +void +Tcl_AppendElement(interp, string) + Tcl_Interp *interp; /* Interpreter whose result is to be + * extended. */ + char *string; /* String to convert to list element and + * add to result. */ +{ + register Interp *iPtr = (Interp *) interp; + int size, flags; + char *dst; + + /* + * See how much space is needed, and grow the append buffer if + * needed to accommodate the list element. + */ + + size = Tcl_ScanElement(string, &flags) + 1; + if ((iPtr->result != iPtr->appendResult) + || (iPtr->appendResult[iPtr->appendUsed] != 0) + || ((size + iPtr->appendUsed) >= iPtr->appendAvl)) { + SetupAppendBuffer(iPtr, size+iPtr->appendUsed); + } + + /* + * Convert the string into a list element and copy it to the + * buffer that's forming. + */ + + dst = iPtr->appendResult + iPtr->appendUsed; + if ((iPtr->appendUsed > 0) && ((dst[-1] != '{') + || ((iPtr->appendUsed > 1) && (dst[-2] == '\\')))) { + iPtr->appendUsed++; + *dst = ' '; + dst++; + } + iPtr->appendUsed += Tcl_ConvertElement(string, dst, flags); +} + +/* + *---------------------------------------------------------------------- + * + * SetupAppendBuffer -- + * + * This procedure makes sure that there is an append buffer + * properly initialized for interp, and that it has at least + * enough room to accommodate newSpace new bytes of information. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +SetupAppendBuffer(iPtr, newSpace) + register Interp *iPtr; /* Interpreter whose result is being set up. */ + int newSpace; /* Make sure that at least this many bytes + * of new information may be added. */ +{ + int totalSpace; + + /* + * Make the append buffer larger, if that's necessary, then + * copy the current result into the append buffer and make the + * append buffer the official Tcl result. + */ + + if (iPtr->result != iPtr->appendResult) { + /* + * If an oversized buffer was used recently, then free it up + * so we go back to a smaller buffer. This avoids tying up + * memory forever after a large operation. + */ + + if (iPtr->appendAvl > 500) { + ckfree(iPtr->appendResult); + iPtr->appendResult = NULL; + iPtr->appendAvl = 0; + } + iPtr->appendUsed = strlen(iPtr->result); + } else if (iPtr->result[iPtr->appendUsed] != 0) { + /* + * Most likely someone has modified a result created by + * Tcl_AppendResult et al. so that it has a different size. + * Just recompute the size. + */ + + iPtr->appendUsed = strlen(iPtr->result); + } + totalSpace = newSpace + iPtr->appendUsed; + if (totalSpace >= iPtr->appendAvl) { + char *new; + + if (totalSpace < 100) { + totalSpace = 200; + } else { + totalSpace *= 2; + } + new = (char *) ckalloc((unsigned) totalSpace); + strcpy(new, iPtr->result); + if (iPtr->appendResult != NULL) { + ckfree(iPtr->appendResult); + } + iPtr->appendResult = new; + iPtr->appendAvl = totalSpace; + } else if (iPtr->result != iPtr->appendResult) { + strcpy(iPtr->appendResult, iPtr->result); + } + Tcl_FreeResult(iPtr); + iPtr->result = iPtr->appendResult; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ResetResult -- + * + * This procedure restores the result area for an interpreter + * to its default initialized state, freeing up any memory that + * may have been allocated for the result and clearing any + * error information for the interpreter. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_ResetResult(interp) + Tcl_Interp *interp; /* Interpreter for which to clear result. */ +{ + register Interp *iPtr = (Interp *) interp; + + Tcl_FreeResult(iPtr); + iPtr->result = iPtr->resultSpace; + iPtr->resultSpace[0] = 0; + iPtr->flags &= + ~(ERR_ALREADY_LOGGED | ERR_IN_PROGRESS | ERROR_CODE_SET); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetErrorCode -- + * + * This procedure is called to record machine-readable information + * about an error that is about to be returned. + * + * Results: + * None. + * + * Side effects: + * The errorCode global variable is modified to hold all of the + * arguments to this procedure, in a list form with each argument + * becoming one element of the list. A flag is set internally + * to remember that errorCode has been set, so the variable doesn't + * get set automatically when the error is returned. + * + *---------------------------------------------------------------------- + */ + /* VARARGS2 */ +void +#ifdef USE_STDARG +Tcl_SetErrorCode(Tcl_Interp *interp, ...) +#else +#ifndef lint +Tcl_SetErrorCode(va_alist) +#else +void + /* VARARGS2 */ /* ARGSUSED */ +Tcl_SetErrorCode(interp, p, va_alist) + Tcl_Interp *interp; /* Interpreter whose errorCode variable is + * to be set. */ + char *p; /* One or more elements to add to errorCode, + * terminated with NULL. */ +#endif + va_dcl +#endif +{ + va_list argList; + char *string; + int flags; + Interp *iPtr = (Interp *)interp; + + /* + * Scan through the arguments one at a time, appending them to + * $errorCode as list elements. + */ + +#ifdef USE_STDARG + va_start(argList, interp); +#else + va_start(argList); +#endif + (void) va_arg(argList, Tcl_Interp *); + flags = TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT; + while (1) { + string = va_arg(argList, char *); + if (string == NULL) { + break; + } + (void) Tcl_SetVar2((Tcl_Interp *) iPtr, "errorCode", + (char *) NULL, string, flags); + flags |= TCL_APPEND_VALUE; + } + va_end(argList); + iPtr->flags |= ERROR_CODE_SET; +} + +/* + *---------------------------------------------------------------------- + * + * TclGetListIndex -- + * + * Parse a list index, which may be either an integer or the + * value "end". + * + * Results: + * The return value is either TCL_OK or TCL_ERROR. If it is + * TCL_OK, then the index corresponding to string is left in + * *indexPtr. If the return value is TCL_ERROR, then string + * was bogus; an error message is returned in interp->result. + * If a negative index is specified, it is rounded up to 0. + * The index value may be larger than the size of the list + * (this happens when "end" is specified). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclGetListIndex(interp, string, indexPtr) + Tcl_Interp *interp; /* Interpreter for error reporting. */ + char *string; /* String containing list index. */ + int *indexPtr; /* Where to store index. */ +{ + if (isdigit(UCHAR(*string)) || (*string == '-')) { + if (Tcl_GetInt(interp, string, indexPtr) != TCL_OK) { + return TCL_ERROR; + } + if (*indexPtr < 0) { + *indexPtr = 0; + } + } else if (strncmp(string, "end", strlen(string)) == 0) { + *indexPtr = 1<<30; + } else { + Tcl_AppendResult(interp, "bad index \"", string, + "\": must be integer or \"end\"", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileRegexp -- + * + * Compile a regular expression into a form suitable for fast + * matching. This procedure retains a small cache of pre-compiled + * regular expressions in the interpreter, in order to avoid + * compilation costs as much as possible. + * + * Results: + * The return value is a pointer to the compiled form of string, + * suitable for passing to TclRegExec. If an error occurred while + * compiling the pattern, then NULL is returned and an error + * message is left in interp->result. + * + * Side effects: + * The cache of compiled regexp's in interp will be modified to + * hold information for string, if such information isn't already + * present in the cache. + * + *---------------------------------------------------------------------- + */ + +regexp * +TclCompileRegexp(interp, string) + Tcl_Interp *interp; /* For use in error reporting. */ + char *string; /* String for which to produce + * compiled regular expression. */ +{ + register Interp *iPtr = (Interp *) interp; + int i, length; + regexp *result; + + length = strlen(string); + for (i = 0; i < NUM_REGEXPS; i++) { + if ((length == iPtr->patLengths[i]) + && (strcmp(string, iPtr->patterns[i]) == 0)) { + /* + * Move the matched pattern to the first slot in the + * cache and shift the other patterns down one position. + */ + + if (i != 0) { + int j; + char *cachedString; + + cachedString = iPtr->patterns[i]; + result = iPtr->regexps[i]; + for (j = i-1; j >= 0; j--) { + iPtr->patterns[j+1] = iPtr->patterns[j]; + iPtr->patLengths[j+1] = iPtr->patLengths[j]; + iPtr->regexps[j+1] = iPtr->regexps[j]; + } + iPtr->patterns[0] = cachedString; + iPtr->patLengths[0] = length; + iPtr->regexps[0] = result; + } + return iPtr->regexps[0]; + } + } + + /* + * No match in the cache. Compile the string and add it to the + * cache. + */ + + tclRegexpError = NULL; + result = TclRegComp(string); + if (tclRegexpError != NULL) { + Tcl_AppendResult(interp, + "couldn't compile regular expression pattern: ", + tclRegexpError, (char *) NULL); + return NULL; + } + if (iPtr->patterns[NUM_REGEXPS-1] != NULL) { + ckfree(iPtr->patterns[NUM_REGEXPS-1]); + ckfree((char *) iPtr->regexps[NUM_REGEXPS-1]); + } + for (i = NUM_REGEXPS - 2; i >= 0; i--) { + iPtr->patterns[i+1] = iPtr->patterns[i]; + iPtr->patLengths[i+1] = iPtr->patLengths[i]; + iPtr->regexps[i+1] = iPtr->regexps[i]; + } + iPtr->patterns[0] = (char *) ckalloc((unsigned) (length+1)); + strcpy(iPtr->patterns[0], string); + iPtr->patLengths[0] = length; + iPtr->regexps[0] = result; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * TclRegError -- + * + * This procedure is invoked by the Henry Spencer's regexp code + * when an error occurs. It saves the error message so it can + * be seen by the code that called Spencer's code. + * + * Results: + * None. + * + * Side effects: + * The value of "string" is saved in "tclRegexpError". + * + *---------------------------------------------------------------------- + */ + +void +TclRegError(string) + char *string; /* Error message. */ +{ + tclRegexpError = string; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_RegExpMatch -- + * + * See if a string matches a regular expression. + * + * Results: + * If an error occurs during the matching operation then -1 + * is returned and interp->result contains an error message. + * Otherwise the return value is 1 if "string" matches "pattern" + * and 0 otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_RegExpMatch(interp, string, pattern) + Tcl_Interp *interp; /* Used for error reporting. */ + char *string; /* String. */ + char *pattern; /* Regular expression to match against + * string. */ +{ + regexp *regexpPtr; + int match; + + regexpPtr = TclCompileRegexp(interp, pattern); + if (regexpPtr == NULL) { + return -1; + } + tclRegexpError = NULL; + match = TclRegExec(regexpPtr, string, string); + if (tclRegexpError != NULL) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "error while matching regular expression: ", + tclRegexpError, (char *) NULL); + return -1; + } + return match; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringInit -- + * + * Initializes a dynamic string, discarding any previous contents + * of the string (Tcl_DStringFree should have been called already + * if the dynamic string was previously in use). + * + * Results: + * None. + * + * Side effects: + * The dynamic string is initialized to be empty. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DStringInit(dsPtr) + register Tcl_DString *dsPtr; /* Pointer to structure for + * dynamic string. */ +{ + dsPtr->string = dsPtr->staticSpace; + dsPtr->length = 0; + dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE; + dsPtr->staticSpace[0] = 0; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringAppend -- + * + * Append more characters to the current value of a dynamic string. + * + * Results: + * The return value is a pointer to the dynamic string's new value. + * + * Side effects: + * Length bytes from string (or all of string if length is less + * than zero) are added to the current value of the string. Memory + * gets reallocated if needed to accomodate the string's new size. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_DStringAppend(dsPtr, string, length) + register Tcl_DString *dsPtr; /* Structure describing dynamic + * string. */ + char *string; /* String to append. If length is + * -1 then this must be + * null-terminated. */ + int length; /* Number of characters from string + * to append. If < 0, then append all + * of string, up to null at end. */ +{ + int newSize; + char *newString; + + if (length < 0) { + length = strlen(string); + } + newSize = length + dsPtr->length; + + /* + * Allocate a larger buffer for the string if the current one isn't + * large enough. Allocate extra space in the new buffer so that there + * will be room to grow before we have to allocate again. + */ + + if (newSize >= dsPtr->spaceAvl) { + dsPtr->spaceAvl = newSize*2; + newString = (char *) ckalloc((unsigned) dsPtr->spaceAvl); + strcpy(newString, dsPtr->string); + if (dsPtr->string != dsPtr->staticSpace) { + ckfree(dsPtr->string); + } + dsPtr->string = newString; + } + + /* + * Copy the new string into the buffer at the end of the old + * one. + */ + + strncpy(dsPtr->string + dsPtr->length, string, length); + dsPtr->length += length; + dsPtr->string[dsPtr->length] = 0; + return dsPtr->string; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringAppendElement -- + * + * Append a list element to the current value of a dynamic string. + * + * Results: + * The return value is a pointer to the dynamic string's new value. + * + * Side effects: + * String is reformatted as a list element and added to the current + * value of the string. Memory gets reallocated if needed to + * accomodate the string's new size. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_DStringAppendElement(dsPtr, string) + register Tcl_DString *dsPtr; /* Structure describing dynamic + * string. */ + char *string; /* String to append. Must be + * null-terminated. */ +{ + int newSize, flags; + char *dst, *newString; + + newSize = Tcl_ScanElement(string, &flags) + dsPtr->length + 1; + + /* + * Allocate a larger buffer for the string if the current one isn't + * large enough. Allocate extra space in the new buffer so that there + * will be room to grow before we have to allocate again. + */ + + if (newSize >= dsPtr->spaceAvl) { + dsPtr->spaceAvl = newSize*2; + newString = (char *) ckalloc((unsigned) dsPtr->spaceAvl); + strcpy(newString, dsPtr->string); + if (dsPtr->string != dsPtr->staticSpace) { + ckfree(dsPtr->string); + } + dsPtr->string = newString; + } + + /* + * Convert the new string to a list element and copy it into the + * buffer at the end. Add a space separator unless we're at the + * start of the string or just after an unbackslashed "{". + */ + + dst = dsPtr->string + dsPtr->length; + if ((dsPtr->length > 0) && ((dst[-1] != '{') + || ((dsPtr->length > 1) && (dst[-2] == '\\')))) { + *dst = ' '; + dst++; + dsPtr->length++; + } + dsPtr->length += Tcl_ConvertElement(string, dst, flags); + return dsPtr->string; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringTrunc -- + * + * Truncate a dynamic string to a given length without freeing + * up its storage. + * + * Results: + * None. + * + * Side effects: + * The length of dsPtr is reduced to length unless it was already + * shorter than that. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DStringTrunc(dsPtr, length) + register Tcl_DString *dsPtr; /* Structure describing dynamic + * string. */ + int length; /* New length for dynamic string. */ +{ + if (length < 0) { + length = 0; + } + if (length < dsPtr->length) { + dsPtr->length = length; + dsPtr->string[length] = 0; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringFree -- + * + * Frees up any memory allocated for the dynamic string and + * reinitializes the string to an empty state. + * + * Results: + * None. + * + * Side effects: + * The previous contents of the dynamic string are lost, and + * the new value is an empty string. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DStringFree(dsPtr) + register Tcl_DString *dsPtr; /* Structure describing dynamic + * string. */ +{ + if (dsPtr->string != dsPtr->staticSpace) { + ckfree(dsPtr->string); + } + dsPtr->string = dsPtr->staticSpace; + dsPtr->length = 0; + dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE; + dsPtr->staticSpace[0] = 0; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringResult -- + * + * This procedure moves the value of a dynamic string into an + * interpreter as its result. The string itself is reinitialized + * to an empty string. + * + * Results: + * None. + * + * Side effects: + * The string is "moved" to interp's result, and any existing + * result for interp is freed up. DsPtr is reinitialized to + * an empty string. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DStringResult(interp, dsPtr) + Tcl_Interp *interp; /* Interpreter whose result is to be + * reset. */ + Tcl_DString *dsPtr; /* Dynamic string that is to become + * the result of interp. */ +{ + Tcl_FreeResult(interp); + if (dsPtr->string != dsPtr->staticSpace) { + interp->result = dsPtr->string; + interp->freeProc = (Tcl_FreeProc *) free; + } else if (dsPtr->length < TCL_RESULT_SIZE) { + strcpy(interp->result, dsPtr->string); + } else { + Tcl_SetResult(interp, dsPtr->string, TCL_VOLATILE); + } + dsPtr->string = dsPtr->staticSpace; + dsPtr->length = 0; + dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE; + dsPtr->staticSpace[0] = 0; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringStartSublist -- + * + * This procedure adds the necessary information to a dynamic + * string (e.g. " {" to start a sublist. Future element + * appends will be in the sublist rather than the main list. + * + * Results: + * None. + * + * Side effects: + * Characters get added to the dynamic string. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DStringStartSublist(dsPtr) + Tcl_DString *dsPtr; /* Dynamic string. */ +{ + if ((dsPtr->length == 0) + || ((dsPtr->length == 1) && (dsPtr->string[0] == '{')) + || ((dsPtr->length > 1) && (dsPtr->string[dsPtr->length-1] == '{') + && (dsPtr->string[dsPtr->length-2] != '\\'))) { + Tcl_DStringAppend(dsPtr, "{", -1); + } else { + Tcl_DStringAppend(dsPtr, " {", -1); + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_DStringEndSublist -- + * + * This procedure adds the necessary characters to a dynamic + * string to end a sublist (e.g. "}"). Future element appends + * will be in the enclosing (sub)list rather than the current + * sublist. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_DStringEndSublist(dsPtr) + Tcl_DString *dsPtr; /* Dynamic string. */ +{ + Tcl_DStringAppend(dsPtr, "}", -1); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_PrintDouble -- + * + * Given a floating-point value, this procedure converts it to + * an ASCII string using. + * + * Results: + * The ASCII equivalent of "value" is written at "dst". It is + * written using the current precision, and it is guaranteed to + * contain a decimal point or exponent, so that it looks like + * a floating-point value and not an integer. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_PrintDouble(interp, value, dst) + Tcl_Interp *interp; /* Interpreter whose tcl_precision + * variable controls printing. */ + double value; /* Value to print as string. */ + char *dst; /* Where to store converted value; + * must have at least TCL_DOUBLE_SPACE + * characters. */ +{ + register char *p; + sprintf(dst, ((Interp *) interp)->pdFormat, value); + + /* + * If the ASCII result looks like an integer, add ".0" so that it + * doesn't look like an integer anymore. This prevents floating-point + * values from being converted to integers unintentionally. + */ + + for (p = dst; *p != 0; p++) { + if ((*p == '.') || (isalpha(UCHAR(*p)))) { + return; + } + } + p[0] = '.'; + p[1] = '0'; + p[2] = 0; +} + +/* + *---------------------------------------------------------------------- + * + * TclPrecTraceProc -- + * + * This procedure is invoked whenever the variable "tcl_precision" + * is written. + * + * Results: + * Returns NULL if all went well, or an error message if the + * new value for the variable doesn't make sense. + * + * Side effects: + * If the new value doesn't make sense then this procedure + * undoes the effect of the variable modification. Otherwise + * it modifies the format string that's used by Tcl_PrintDouble. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +char * +TclPrecTraceProc(clientData, interp, name1, name2, flags) + ClientData clientData; /* Not used. */ + Tcl_Interp *interp; /* Interpreter containing variable. */ + char *name1; /* Name of variable. */ + char *name2; /* Second part of variable name. */ + int flags; /* Information about what happened. */ +{ + register Interp *iPtr = (Interp *) interp; + char *value, *end; + int prec; + + /* + * If the variable is unset, then recreate the trace and restore + * the default value of the format string. + */ + + if (flags & TCL_TRACE_UNSETS) { + if ((flags & TCL_TRACE_DESTROYED) && !(flags & TCL_INTERP_DESTROYED)) { + Tcl_TraceVar2(interp, name1, name2, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + TclPrecTraceProc, clientData); + } + strcpy(iPtr->pdFormat, DEFAULT_PD_FORMAT); + iPtr->pdPrec = DEFAULT_PD_PREC; + return (char *) NULL; + } + + value = Tcl_GetVar2(interp, name1, name2, flags & TCL_GLOBAL_ONLY); + if (value == NULL) { + value = ""; + } + prec = strtoul(value, &end, 10); + if ((prec <= 0) || (prec > TCL_MAX_PREC) || (prec > 100) || + (end == value) || (*end != 0)) { + char oldValue[10]; + + sprintf(oldValue, "%d", iPtr->pdPrec); + Tcl_SetVar2(interp, name1, name2, oldValue, flags & TCL_GLOBAL_ONLY); + return "improper value for precision"; + } + sprintf(iPtr->pdFormat, "%%.%dg", prec); + iPtr->pdPrec = prec; + return (char *) NULL; +} diff --git a/vendor/x11iraf/obm/Tcl/tclVar.c b/vendor/x11iraf/obm/Tcl/tclVar.c new file mode 100644 index 00000000..8981cef7 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tclVar.c @@ -0,0 +1,2363 @@ +/* + * tclVar.c -- + * + * This file contains routines that implement Tcl variables + * (both scalars and arrays). + * + * The implementation of arrays is modelled after an initial + * implementation by Mark Diekhans and Karl Lehenbauer. + * + * Copyright (c) 1987-1993 The Regents of the University of California. + * All rights reserved. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF + * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef lint +static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclVar.c,v 1.44 93/08/14 17:21:34 ouster Exp $ SPRITE (Berkeley)"; +#endif + +#include "tclInt.h" + +/* + * The strings below are used to indicate what went wrong when a + * variable access is denied. + */ + +static char *noSuchVar = "no such variable"; +static char *isArray = "variable is array"; +static char *needArray = "variable isn't array"; +static char *noSuchElement = "no such element in array"; +static char *danglingUpvar = "upvar refers to element in deleted array"; + +/* + * Creation flag values passed in to LookupVar: + * + * CRT_PART1 - 1 means create hash table entry for part 1 of + * name, if it doesn't already exist. 0 means + * return an error if it doesn't exist. + * CRT_PART2 - 1 means create hash table entry for part 2 of + * name, if it doesn't already exist. 0 means + * return an error if it doesn't exist. + */ + +#define CRT_PART1 1 +#define CRT_PART2 2 + +/* + * Forward references to procedures defined later in this file: + */ + +static char * CallTraces _ANSI_ARGS_((Interp *iPtr, Var *arrayPtr, + Var *varPtr, char *part1, char *part2, + int flags)); +static void CleanupVar _ANSI_ARGS_((Var *varPtr, Var *arrayPtr)); +static void DeleteSearches _ANSI_ARGS_((Var *arrayVarPtr)); +static void DeleteArray _ANSI_ARGS_((Interp *iPtr, char *arrayName, + Var *varPtr, int flags)); +static Var * LookupVar _ANSI_ARGS_((Tcl_Interp *interp, char *part1, + char *part2, int flags, char *msg, int create, + Var **arrayPtrPtr)); +static int MakeUpvar _ANSI_ARGS_((Interp *iPtr, + CallFrame *framePtr, char *otherP1, + char *otherP2, char *myName)); +static Var * NewVar _ANSI_ARGS_((void)); +static ArraySearch * ParseSearchId _ANSI_ARGS_((Tcl_Interp *interp, + Var *varPtr, char *varName, char *string)); +static void VarErrMsg _ANSI_ARGS_((Tcl_Interp *interp, + char *part1, char *part2, char *operation, + char *reason)); + +/* + *---------------------------------------------------------------------- + * + * LookupVar -- + * + * This procedure is used by virtually all of the variable + * code to locate a variable given its name(s). + * + * Results: + * The return value is a pointer to the variable indicated by + * part1 and part2, or NULL if the variable couldn't be found. + * If the variable is found, *arrayPtrPtr is filled in with + * the address of the array that contains the variable (or NULL + * if the variable is a scalar). Note: it's possible that the + * variable returned may be VAR_UNDEFINED, even if CRT_PART1 and + * CRT_PART2 are specified (these only cause the hash table entry + * and/or array to be created). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static Var * +LookupVar(interp, part1, part2, flags, msg, create, arrayPtrPtr) + Tcl_Interp *interp; /* Interpreter to use for lookup. */ + char *part1; /* If part2 is NULL, this is name of scalar + * variable. Otherwise it is name of array. */ + char *part2; /* Name of an element within array, or NULL. */ + int flags; /* Only the TCL_GLOBAL_ONLY and + * TCL_LEAVE_ERR_MSG bits matter. */ + char *msg; /* Verb to use in error messages, e.g. + * "read" or "set". Only needed if + * TCL_LEAVE_ERR_MSG is set in flags. */ + int create; /* OR'ed combination of CRT_PART1 and + * CRT_PART2. Tells which entries to create + * if they don't already exist. */ + Var **arrayPtrPtr; /* If part2 is non-NULL, *arrayPtrPtr gets + * filled in with address of array variable. */ +{ + Interp *iPtr = (Interp *) interp; + Tcl_HashTable *tablePtr; + Tcl_HashEntry *hPtr; + Var *varPtr; + int new; + + /* + * Lookup part1. + */ + + *arrayPtrPtr = NULL; + if ((flags & TCL_GLOBAL_ONLY) || (iPtr->varFramePtr == NULL)) { + tablePtr = &iPtr->globalTable; + } else { + tablePtr = &iPtr->varFramePtr->varTable; + } + if (create & CRT_PART1) { + hPtr = Tcl_CreateHashEntry(tablePtr, part1, &new); + if (new) { + varPtr = NewVar(); + Tcl_SetHashValue(hPtr, varPtr); + varPtr->hPtr = hPtr; + } + } else { + hPtr = Tcl_FindHashEntry(tablePtr, part1); + if (hPtr == NULL) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, msg, noSuchVar); + } + return NULL; + } + } + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & VAR_UPVAR) { + varPtr = varPtr->value.upvarPtr; + } + + if (part2 == NULL) { + return varPtr; + } + + /* + * We're dealing with an array element, so make sure the variable + * is an array and lookup the element (create it if desired). + */ + + if (varPtr->flags & VAR_UNDEFINED) { + if (!(create & CRT_PART1)) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, msg, noSuchVar); + } + return NULL; + } + varPtr->flags = VAR_ARRAY; + varPtr->value.tablePtr = (Tcl_HashTable *) + ckalloc(sizeof(Tcl_HashTable)); + Tcl_InitHashTable(varPtr->value.tablePtr, TCL_STRING_KEYS); + } else if (!(varPtr->flags & VAR_ARRAY)) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, msg, needArray); + } + return NULL; + } + *arrayPtrPtr = varPtr; + if (create & CRT_PART2) { + hPtr = Tcl_CreateHashEntry(varPtr->value.tablePtr, part2, &new); + if (new) { + if (varPtr->searchPtr != NULL) { + DeleteSearches(varPtr); + } + varPtr = NewVar(); + Tcl_SetHashValue(hPtr, varPtr); + varPtr->hPtr = hPtr; + } + } else { + hPtr = Tcl_FindHashEntry(varPtr->value.tablePtr, part2); + if (hPtr == NULL) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, msg, noSuchElement); + } + return NULL; + } + } + return (Var *) Tcl_GetHashValue(hPtr); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetVar -- + * + * Return the value of a Tcl variable. + * + * Results: + * The return value points to the current value of varName. If + * the variable is not defined or can't be read because of a clash + * in array usage then a NULL pointer is returned and an error + * message is left in interp->result if the TCL_LEAVE_ERR_MSG + * flag is set. Note: the return value is only valid up until + * the next call to Tcl_SetVar or Tcl_SetVar2; if you depend on + * the value lasting longer than that, then make yourself a private + * copy. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_GetVar(interp, varName, flags) + Tcl_Interp *interp; /* Command interpreter in which varName is + * to be looked up. */ + char *varName; /* Name of a variable in interp. */ + int flags; /* OR-ed combination of TCL_GLOBAL_ONLY + * or TCL_LEAVE_ERR_MSG bits. */ +{ + register char *p; + + /* + * If varName refers to an array (it ends with a parenthesized + * element name), then handle it specially. + */ + + for (p = varName; *p != '\0'; p++) { + if (*p == '(') { + char *result; + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + result = Tcl_GetVar2(interp, varName, open+1, flags); + *open = '('; + *p = ')'; + return result; + } + } + + scalar: + return Tcl_GetVar2(interp, varName, (char *) NULL, flags); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetVar2 -- + * + * Return the value of a Tcl variable, given a two-part name + * consisting of array name and element within array. + * + * Results: + * The return value points to the current value of the variable + * given by part1 and part2. If the specified variable doesn't + * exist, or if there is a clash in array usage, then NULL is + * returned and a message will be left in interp->result if the + * TCL_LEAVE_ERR_MSG flag is set. Note: the return value is + * only valid up until the next call to Tcl_SetVar or Tcl_SetVar2; + * if you depend on the value lasting longer than that, then make + * yourself a private copy. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_GetVar2(interp, part1, part2, flags) + Tcl_Interp *interp; /* Command interpreter in which variable is + * to be looked up. */ + char *part1; /* Name of array (if part2 is NULL) or + * name of variable. */ + char *part2; /* If non-null, gives name of element in + * array. */ + int flags; /* OR-ed combination of TCL_GLOBAL_ONLY + * or TCL_LEAVE_ERR_MSG bits. */ +{ + Var *varPtr, *arrayPtr; + Interp *iPtr = (Interp *) interp; + + varPtr = LookupVar(interp, part1, part2, flags, "read", CRT_PART2, + &arrayPtr); + if (varPtr == NULL) { + return NULL; + } + + /* + * Invoke any traces that have been set for the variable. + */ + + if ((varPtr->tracePtr != NULL) + || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL))) { + char *msg; + + msg = CallTraces(iPtr, arrayPtr, varPtr, part1, part2, + (flags & TCL_GLOBAL_ONLY) | TCL_TRACE_READS); + if (msg != NULL) { + VarErrMsg(interp, part1, part2, "read", msg); + goto cleanup; + } + } + if (!(varPtr->flags & (VAR_UNDEFINED|VAR_UPVAR|VAR_ARRAY))) { + return varPtr->value.string; + } + if (flags & TCL_LEAVE_ERR_MSG) { + char *msg; + + if ((varPtr->flags & VAR_UNDEFINED) && (arrayPtr != NULL) + && !(arrayPtr->flags & VAR_UNDEFINED)) { + msg = noSuchElement; + } else { + msg = noSuchVar; + } + VarErrMsg(interp, part1, part2, "read", msg); + } + + /* + * If the variable doesn't exist anymore and no-one's using it, + * then free up the relevant structures and hash table entries. + */ + + cleanup: + if (varPtr->flags & VAR_UNDEFINED) { + CleanupVar(varPtr, arrayPtr); + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetVar -- + * + * Change the value of a variable. + * + * Results: + * Returns a pointer to the malloc'ed string holding the new + * value of the variable. The caller should not modify this + * string. If the write operation was disallowed then NULL + * is returned; if the TCL_LEAVE_ERR_MSG flag is set, then + * an explanatory message will be left in interp->result. + * + * Side effects: + * If varName is defined as a local or global variable in interp, + * its value is changed to newValue. If varName isn't currently + * defined, then a new global variable by that name is created. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_SetVar(interp, varName, newValue, flags) + Tcl_Interp *interp; /* Command interpreter in which varName is + * to be looked up. */ + char *varName; /* Name of a variable in interp. */ + char *newValue; /* New value for varName. */ + int flags; /* Various flags that tell how to set value: + * any of TCL_GLOBAL_ONLY, TCL_APPEND_VALUE, + * TCL_LIST_ELEMENT, or TCL_LEAVE_ERR_MSG. */ +{ + register char *p; + + /* + * If varName refers to an array (it ends with a parenthesized + * element name), then handle it specially. + */ + + for (p = varName; *p != '\0'; p++) { + if (*p == '(') { + char *result; + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + result = Tcl_SetVar2(interp, varName, open+1, newValue, flags); + *open = '('; + *p = ')'; + return result; + } + } + + scalar: + return Tcl_SetVar2(interp, varName, (char *) NULL, newValue, flags); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetVar2 -- + * + * Given a two-part variable name, which may refer either to a + * scalar variable or an element of an array, change the value + * of the variable. If the named scalar or array or element + * doesn't exist then create one. + * + * Results: + * Returns a pointer to the malloc'ed string holding the new + * value of the variable. The caller should not modify this + * string. If the write operation was disallowed because an + * array was expected but not found (or vice versa), then NULL + * is returned; if the TCL_LEAVE_ERR_MSG flag is set, then + * an explanatory message will be left in interp->result. + * + * Side effects: + * The value of the given variable is set. If either the array + * or the entry didn't exist then a new one is created. + * + *---------------------------------------------------------------------- + */ + +char * +Tcl_SetVar2(interp, part1, part2, newValue, flags) + Tcl_Interp *interp; /* Command interpreter in which variable is + * to be looked up. */ + char *part1; /* If part2 is NULL, this is name of scalar + * variable. Otherwise it is name of array. */ + char *part2; /* Name of an element within array, or NULL. */ + char *newValue; /* New value for variable. */ + int flags; /* Various flags that tell how to set value: + * any of TCL_GLOBAL_ONLY, TCL_APPEND_VALUE, + * TCL_LIST_ELEMENT, or TCL_LEAVE_ERR_MSG . */ +{ + register Var *varPtr; + register Interp *iPtr = (Interp *) interp; + int length, listFlags; + Var *arrayPtr; + char *result; + + varPtr = LookupVar(interp, part1, part2, flags, "set", CRT_PART1|CRT_PART2, + &arrayPtr); + if (varPtr == NULL) { + return NULL; + } + + /* + * If the variable's hPtr field is NULL, it means that this is an + * upvar to an array element where the array was deleted, leaving + * the element dangling at the end of the upvar. Generate an error + * (allowing the variable to be reset would screw up our storage + * allocation and is meaningless anyway). + */ + + if (varPtr->hPtr == NULL) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, "set", danglingUpvar); + } + return NULL; + } + + /* + * Clear the variable's current value unless this is an + * append operation. + */ + + if (varPtr->flags & VAR_ARRAY) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, "set", isArray); + } + return NULL; + } + if (!(flags & TCL_APPEND_VALUE) || (varPtr->flags & VAR_UNDEFINED)) { + varPtr->valueLength = 0; + } + + /* + * Compute how many total bytes will be needed for the variable's + * new value (leave space for a separating space between list + * elements). Allocate new space for the value if needed. + */ + + if (flags & TCL_LIST_ELEMENT) { + length = Tcl_ScanElement(newValue, &listFlags) + 1; + } else { + length = strlen(newValue); + } + length += varPtr->valueLength; + if (length >= varPtr->valueSpace) { + char *newValue; + int newSize; + + newSize = 2*varPtr->valueSpace; + if (newSize <= length) { + newSize = length + 1; + } + if (newSize < 24) { + /* + * Don't waste time with teensy-tiny variables; we'll + * just end up expanding them later. + */ + + newSize = 24; + } + newValue = ckalloc((unsigned) newSize); + if (varPtr->valueSpace > 0) { + strcpy(newValue, varPtr->value.string); + ckfree(varPtr->value.string); + } + varPtr->valueSpace = newSize; + varPtr->value.string = newValue; + } + + /* + * Append the new value to the variable, either as a list + * element or as a string. + */ + + if (flags & TCL_LIST_ELEMENT) { + char *dst = varPtr->value.string + varPtr->valueLength; + + if ((varPtr->valueLength > 0) && ((dst[-1] != '{') + || ((varPtr->valueLength > 1) && (dst[-2] == '\\')))) { + *dst = ' '; + dst++; + varPtr->valueLength++; + } + varPtr->valueLength += Tcl_ConvertElement(newValue, dst, listFlags); + } else { + strcpy(varPtr->value.string + varPtr->valueLength, newValue); + varPtr->valueLength = length; + } + varPtr->flags &= ~VAR_UNDEFINED; + + /* + * Invoke any write traces for the variable. + */ + + if ((varPtr->tracePtr != NULL) + || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL))) { + char *msg; + + msg = CallTraces(iPtr, arrayPtr, varPtr, part1, part2, + (flags & TCL_GLOBAL_ONLY) | TCL_TRACE_WRITES); + if (msg != NULL) { + VarErrMsg(interp, part1, part2, "set", msg); + result = NULL; + goto cleanup; + } + } + + /* + * If the variable was changed in some gross way by a trace (e.g. + * it was unset and then recreated as an array) then just return + * an empty string; otherwise return the variable's current + * value. + */ + + if (!(varPtr->flags & (VAR_UNDEFINED|VAR_UPVAR|VAR_ARRAY))) { + return varPtr->value.string; + } + result = ""; + + /* + * If the variable doesn't exist anymore and no-one's using it, + * then free up the relevant structures and hash table entries. + */ + + cleanup: + if (varPtr->flags & VAR_UNDEFINED) { + CleanupVar(varPtr, arrayPtr); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UnsetVar -- + * + * Delete a variable, so that it may not be accessed anymore. + * + * Results: + * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR + * if the variable can't be unset. In the event of an error, + * if the TCL_LEAVE_ERR_MSG flag is set then an error message + * is left in interp->result. + * + * Side effects: + * If varName is defined as a local or global variable in interp, + * it is deleted. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_UnsetVar(interp, varName, flags) + Tcl_Interp *interp; /* Command interpreter in which varName is + * to be looked up. */ + char *varName; /* Name of a variable in interp. May be + * either a scalar name or an array name + * or an element in an array. */ + int flags; /* OR-ed combination of any of + * TCL_GLOBAL_ONLY or TCL_LEAVE_ERR_MSG. */ +{ + register char *p; + int result; + + /* + * Figure out whether this is an array reference, then call + * Tcl_UnsetVar2 to do all the real work. + */ + + for (p = varName; *p != '\0'; p++) { + if (*p == '(') { + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + result = Tcl_UnsetVar2(interp, varName, open+1, flags); + *open = '('; + *p = ')'; + return result; + } + } + + scalar: + return Tcl_UnsetVar2(interp, varName, (char *) NULL, flags); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UnsetVar2 -- + * + * Delete a variable, given a 2-part name. + * + * Results: + * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR + * if the variable can't be unset. In the event of an error, + * if the TCL_LEAVE_ERR_MSG flag is set then an error message + * is left in interp->result. + * + * Side effects: + * If part1 and part2 indicate a local or global variable in interp, + * it is deleted. If part1 is an array name and part2 is NULL, then + * the whole array is deleted. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_UnsetVar2(interp, part1, part2, flags) + Tcl_Interp *interp; /* Command interpreter in which varName is + * to be looked up. */ + char *part1; /* Name of variable or array. */ + char *part2; /* Name of element within array or NULL. */ + int flags; /* OR-ed combination of any of + * TCL_GLOBAL_ONLY or TCL_LEAVE_ERR_MSG. */ +{ + Var *varPtr, dummyVar; + Interp *iPtr = (Interp *) interp; + Var *arrayPtr; + ActiveVarTrace *activePtr; + int result; + + varPtr = LookupVar(interp, part1, part2, flags, "unset", 0, &arrayPtr); + if (varPtr == NULL) { + return TCL_ERROR; + } + result = (varPtr->flags & VAR_UNDEFINED) ? TCL_ERROR : TCL_OK; + + if ((part2 != NULL) && (arrayPtr->searchPtr != NULL)) { + DeleteSearches(arrayPtr); + } + + /* + * The code below is tricky, because of the possibility that + * a trace procedure might try to access a variable being + * deleted. To handle this situation gracefully, do things + * in three steps: + * 1. Copy the contents of the variable to a dummy variable + * structure, and mark the original structure as undefined. + * 2. Invoke traces and clean up the variable, using the copy. + * 3. If at the end of this the original variable is still + * undefined and has no outstanding references, then delete + * it (but it could have gotten recreated by a trace). + */ + + dummyVar = *varPtr; + varPtr->valueSpace = 0; + varPtr->flags = VAR_UNDEFINED; + varPtr->tracePtr = NULL; + + /* + * Call trace procedures for the variable being deleted and delete + * its traces. Be sure to abort any other traces for the variable + * that are still pending. Special tricks: + * 1. Increment varPtr's refCount around this: CallTraces will + * use dummyVar so it won't increment varPtr's refCount. + * 2. Turn off the VAR_TRACE_ACTIVE flag in dummyVar: we want to + * call unset traces even if other traces are pending. + */ + + if ((dummyVar.tracePtr != NULL) + || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL))) { + varPtr->refCount++; + dummyVar.flags &= ~VAR_TRACE_ACTIVE; + (void) CallTraces(iPtr, arrayPtr, &dummyVar, part1, part2, + (flags & TCL_GLOBAL_ONLY) | TCL_TRACE_UNSETS); + while (dummyVar.tracePtr != NULL) { + VarTrace *tracePtr = dummyVar.tracePtr; + dummyVar.tracePtr = tracePtr->nextPtr; + ckfree((char *) tracePtr); + } + for (activePtr = iPtr->activeTracePtr; activePtr != NULL; + activePtr = activePtr->nextPtr) { + if (activePtr->varPtr == varPtr) { + activePtr->nextTracePtr = NULL; + } + } + varPtr->refCount--; + } + + /* + * If the variable is an array, delete all of its elements. This + * must be done after calling the traces on the array, above (that's + * the way traces are defined). + */ + + if (dummyVar.flags & VAR_ARRAY) { + DeleteArray(iPtr, part1, &dummyVar, + (flags & TCL_GLOBAL_ONLY) | TCL_TRACE_UNSETS); + } + if (dummyVar.valueSpace > 0) { + ckfree(dummyVar.value.string); + } + if (result == TCL_ERROR) { + if (flags & TCL_LEAVE_ERR_MSG) { + VarErrMsg(interp, part1, part2, "unset", + (part2 == NULL) ? noSuchVar : noSuchElement); + } + } + + /* + * Finally, if the variable is truly not in use then free up its + * record and remove it from the hash table. + */ + + CleanupVar(varPtr, arrayPtr); + return result; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_TraceVar -- + * + * Arrange for reads and/or writes to a variable to cause a + * procedure to be invoked, which can monitor the operations + * and/or change their actions. + * + * Results: + * A standard Tcl return value. + * + * Side effects: + * A trace is set up on the variable given by varName, such that + * future references to the variable will be intermediated by + * proc. See the manual entry for complete details on the calling + * sequence for proc. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_TraceVar(interp, varName, flags, proc, clientData) + Tcl_Interp *interp; /* Interpreter in which variable is + * to be traced. */ + char *varName; /* Name of variable; may end with "(index)" + * to signify an array reference. */ + int flags; /* OR-ed collection of bits, including any + * of TCL_TRACE_READS, TCL_TRACE_WRITES, + * TCL_TRACE_UNSETS, and TCL_GLOBAL_ONLY. */ + Tcl_VarTraceProc *proc; /* Procedure to call when specified ops are + * invoked upon varName. */ + ClientData clientData; /* Arbitrary argument to pass to proc. */ +{ + register char *p; + + /* + * If varName refers to an array (it ends with a parenthesized + * element name), then handle it specially. + */ + + for (p = varName; *p != '\0'; p++) { + if (*p == '(') { + int result; + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + result = Tcl_TraceVar2(interp, varName, open+1, flags, + proc, clientData); + *open = '('; + *p = ')'; + return result; + } + } + + scalar: + return Tcl_TraceVar2(interp, varName, (char *) NULL, flags, + proc, clientData); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_TraceVar2 -- + * + * Arrange for reads and/or writes to a variable to cause a + * procedure to be invoked, which can monitor the operations + * and/or change their actions. + * + * Results: + * A standard Tcl return value. + * + * Side effects: + * A trace is set up on the variable given by part1 and part2, such + * that future references to the variable will be intermediated by + * proc. See the manual entry for complete details on the calling + * sequence for proc. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_TraceVar2(interp, part1, part2, flags, proc, clientData) + Tcl_Interp *interp; /* Interpreter in which variable is + * to be traced. */ + char *part1; /* Name of scalar variable or array. */ + char *part2; /* Name of element within array; NULL means + * trace applies to scalar variable or array + * as-a-whole. */ + int flags; /* OR-ed collection of bits, including any + * of TCL_TRACE_READS, TCL_TRACE_WRITES, + * TCL_TRACE_UNSETS, and TCL_GLOBAL_ONLY. */ + Tcl_VarTraceProc *proc; /* Procedure to call when specified ops are + * invoked upon varName. */ + ClientData clientData; /* Arbitrary argument to pass to proc. */ +{ + Var *varPtr, *arrayPtr; + register VarTrace *tracePtr; + + varPtr = LookupVar(interp, part1, part2, (flags | TCL_LEAVE_ERR_MSG), + "trace", CRT_PART1|CRT_PART2, &arrayPtr); + if (varPtr == NULL) { + return TCL_ERROR; + } + + /* + * Set up trace information. + */ + + tracePtr = (VarTrace *) ckalloc(sizeof(VarTrace)); + tracePtr->traceProc = proc; + tracePtr->clientData = clientData; + tracePtr->flags = flags & + (TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS); + tracePtr->nextPtr = varPtr->tracePtr; + varPtr->tracePtr = tracePtr; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UntraceVar -- + * + * Remove a previously-created trace for a variable. + * + * Results: + * None. + * + * Side effects: + * If there exists a trace for the variable given by varName + * with the given flags, proc, and clientData, then that trace + * is removed. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_UntraceVar(interp, varName, flags, proc, clientData) + Tcl_Interp *interp; /* Interpreter containing traced variable. */ + char *varName; /* Name of variable; may end with "(index)" + * to signify an array reference. */ + int flags; /* OR-ed collection of bits describing + * current trace, including any of + * TCL_TRACE_READS, TCL_TRACE_WRITES, + * TCL_TRACE_UNSETS, and TCL_GLOBAL_ONLY. */ + Tcl_VarTraceProc *proc; /* Procedure assocated with trace. */ + ClientData clientData; /* Arbitrary argument to pass to proc. */ +{ + register char *p; + + /* + * If varName refers to an array (it ends with a parenthesized + * element name), then handle it specially. + */ + + for (p = varName; *p != '\0'; p++) { + if (*p == '(') { + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + Tcl_UntraceVar2(interp, varName, open+1, flags, proc, clientData); + *open = '('; + *p = ')'; + return; + } + } + + scalar: + Tcl_UntraceVar2(interp, varName, (char *) NULL, flags, proc, clientData); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UntraceVar2 -- + * + * Remove a previously-created trace for a variable. + * + * Results: + * None. + * + * Side effects: + * If there exists a trace for the variable given by part1 + * and part2 with the given flags, proc, and clientData, then + * that trace is removed. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_UntraceVar2(interp, part1, part2, flags, proc, clientData) + Tcl_Interp *interp; /* Interpreter containing traced variable. */ + char *part1; /* Name of variable or array. */ + char *part2; /* Name of element within array; NULL means + * trace applies to scalar variable or array + * as-a-whole. */ + int flags; /* OR-ed collection of bits describing + * current trace, including any of + * TCL_TRACE_READS, TCL_TRACE_WRITES, + * TCL_TRACE_UNSETS, and TCL_GLOBAL_ONLY. */ + Tcl_VarTraceProc *proc; /* Procedure assocated with trace. */ + ClientData clientData; /* Arbitrary argument to pass to proc. */ +{ + register VarTrace *tracePtr; + VarTrace *prevPtr; + Var *varPtr, *arrayPtr; + Interp *iPtr = (Interp *) interp; + ActiveVarTrace *activePtr; + + varPtr = LookupVar(interp, part1, part2, flags & TCL_GLOBAL_ONLY, + (char *) NULL, 0, &arrayPtr); + if (varPtr == NULL) { + return; + } + + flags &= (TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS); + for (tracePtr = varPtr->tracePtr, prevPtr = NULL; ; + prevPtr = tracePtr, tracePtr = tracePtr->nextPtr) { + if (tracePtr == NULL) { + return; + } + if ((tracePtr->traceProc == proc) && (tracePtr->flags == flags) + && (tracePtr->clientData == clientData)) { + break; + } + } + + /* + * The code below makes it possible to delete traces while traces + * are active: it makes sure that the deleted trace won't be + * processed by CallTraces. + */ + + for (activePtr = iPtr->activeTracePtr; activePtr != NULL; + activePtr = activePtr->nextPtr) { + if (activePtr->nextTracePtr == tracePtr) { + activePtr->nextTracePtr = tracePtr->nextPtr; + } + } + if (prevPtr == NULL) { + varPtr->tracePtr = tracePtr->nextPtr; + } else { + prevPtr->nextPtr = tracePtr->nextPtr; + } + ckfree((char *) tracePtr); + + /* + * If this is the last trace on the variable, and the variable is + * unset and unused, then free up the variable. + */ + + if (varPtr->flags & VAR_UNDEFINED) { + CleanupVar(varPtr, (Var *) NULL); + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_VarTraceInfo -- + * + * Return the clientData value associated with a trace on a + * variable. This procedure can also be used to step through + * all of the traces on a particular variable that have the + * same trace procedure. + * + * Results: + * The return value is the clientData value associated with + * a trace on the given variable. Information will only be + * returned for a trace with proc as trace procedure. If + * the clientData argument is NULL then the first such trace is + * returned; otherwise, the next relevant one after the one + * given by clientData will be returned. If the variable + * doesn't exist, or if there are no (more) traces for it, + * then NULL is returned. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +ClientData +Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) + Tcl_Interp *interp; /* Interpreter containing variable. */ + char *varName; /* Name of variable; may end with "(index)" + * to signify an array reference. */ + int flags; /* 0 or TCL_GLOBAL_ONLY. */ + Tcl_VarTraceProc *proc; /* Procedure assocated with trace. */ + ClientData prevClientData; /* If non-NULL, gives last value returned + * by this procedure, so this call will + * return the next trace after that one. + * If NULL, this call will return the + * first trace. */ +{ + register char *p; + + /* + * If varName refers to an array (it ends with a parenthesized + * element name), then handle it specially. + */ + + for (p = varName; *p != '\0'; p++) { + if (*p == '(') { + ClientData result; + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + result = Tcl_VarTraceInfo2(interp, varName, open+1, flags, proc, + prevClientData); + *open = '('; + *p = ')'; + return result; + } + } + + scalar: + return Tcl_VarTraceInfo2(interp, varName, (char *) NULL, flags, proc, + prevClientData); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_VarTraceInfo2 -- + * + * Same as Tcl_VarTraceInfo, except takes name in two pieces + * instead of one. + * + * Results: + * Same as Tcl_VarTraceInfo. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +ClientData +Tcl_VarTraceInfo2(interp, part1, part2, flags, proc, prevClientData) + Tcl_Interp *interp; /* Interpreter containing variable. */ + char *part1; /* Name of variable or array. */ + char *part2; /* Name of element within array; NULL means + * trace applies to scalar variable or array + * as-a-whole. */ + int flags; /* 0 or TCL_GLOBAL_ONLY. */ + Tcl_VarTraceProc *proc; /* Procedure assocated with trace. */ + ClientData prevClientData; /* If non-NULL, gives last value returned + * by this procedure, so this call will + * return the next trace after that one. + * If NULL, this call will return the + * first trace. */ +{ + register VarTrace *tracePtr; + Var *varPtr, *arrayPtr; + + varPtr = LookupVar(interp, part1, part2, flags & TCL_GLOBAL_ONLY, + (char *) NULL, 0, &arrayPtr); + if (varPtr == NULL) { + return NULL; + } + + /* + * Find the relevant trace, if any, and return its clientData. + */ + + tracePtr = varPtr->tracePtr; + if (prevClientData != NULL) { + for ( ; tracePtr != NULL; tracePtr = tracePtr->nextPtr) { + if ((tracePtr->clientData == prevClientData) + && (tracePtr->traceProc == proc)) { + tracePtr = tracePtr->nextPtr; + break; + } + } + } + for ( ; tracePtr != NULL; tracePtr = tracePtr->nextPtr) { + if (tracePtr->traceProc == proc) { + return tracePtr->clientData; + } + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_SetCmd -- + * + * This procedure is invoked to process the "set" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * A variable's value may be changed. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_SetCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + register Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + if (argc == 2) { + char *value; + + value = Tcl_GetVar(interp, argv[1], TCL_LEAVE_ERR_MSG); + if (value == NULL) { + return TCL_ERROR; + } + interp->result = value; + return TCL_OK; + } else if (argc == 3) { + char *result; + + result = Tcl_SetVar(interp, argv[1], argv[2], TCL_LEAVE_ERR_MSG); + if (result == NULL) { + return TCL_ERROR; + } + interp->result = result; + return TCL_OK; + } else { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " varName ?newValue?\"", (char *) NULL); + return TCL_ERROR; + } +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UnsetCmd -- + * + * This procedure is invoked to process the "unset" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_UnsetCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + register Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i; + + if (argc < 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " varName ?varName ...?\"", (char *) NULL); + return TCL_ERROR; + } + for (i = 1; i < argc; i++) { + if (Tcl_UnsetVar(interp, argv[i], TCL_LEAVE_ERR_MSG) != TCL_OK) { + return TCL_ERROR; + } + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppendCmd -- + * + * This procedure is invoked to process the "append" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * A variable's value may be changed. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_AppendCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + register Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i; + char *result = NULL; /* (Initialization only needed to keep + * the compiler from complaining) */ + + if (argc < 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " varName value ?value ...?\"", (char *) NULL); + return TCL_ERROR; + } + + for (i = 2; i < argc; i++) { + result = Tcl_SetVar(interp, argv[1], argv[i], + TCL_APPEND_VALUE|TCL_LEAVE_ERR_MSG); + if (result == NULL) { + return TCL_ERROR; + } + } + interp->result = result; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_LappendCmd -- + * + * This procedure is invoked to process the "lappend" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * A variable's value may be changed. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_LappendCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + register Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int i; + char *result = NULL; /* (Initialization only needed to keep + * the compiler from complaining) */ + + if (argc < 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " varName value ?value ...?\"", (char *) NULL); + return TCL_ERROR; + } + + for (i = 2; i < argc; i++) { + result = Tcl_SetVar(interp, argv[1], argv[i], + TCL_APPEND_VALUE|TCL_LIST_ELEMENT|TCL_LEAVE_ERR_MSG); + if (result == NULL) { + return TCL_ERROR; + } + } + interp->result = result; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_ArrayCmd -- + * + * This procedure is invoked to process the "array" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_ArrayCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + register Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + int length; + char c; + Var *varPtr; + Tcl_HashEntry *hPtr; + Interp *iPtr = (Interp *) interp; + + if (argc < 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " option arrayName ?arg ...?\"", (char *) NULL); + return TCL_ERROR; + } + + /* + * Locate the array variable (and it better be an array). + */ + + if (iPtr->varFramePtr == NULL) { + hPtr = Tcl_FindHashEntry(&iPtr->globalTable, argv[2]); + } else { + hPtr = Tcl_FindHashEntry(&iPtr->varFramePtr->varTable, argv[2]); + } + if (hPtr == NULL) { + notArray: + Tcl_AppendResult(interp, "\"", argv[2], "\" isn't an array", + (char *) NULL); + return TCL_ERROR; + } + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & VAR_UPVAR) { + varPtr = varPtr->value.upvarPtr; + } + if (!(varPtr->flags & VAR_ARRAY)) { + goto notArray; + } + + /* + * Dispatch based on the option. + */ + + c = argv[1][0]; + length = strlen(argv[1]); + if ((c == 'a') && (strncmp(argv[1], "anymore", length) == 0)) { + ArraySearch *searchPtr; + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " anymore arrayName searchId\"", (char *) NULL); + return TCL_ERROR; + } + searchPtr = ParseSearchId(interp, varPtr, argv[2], argv[3]); + if (searchPtr == NULL) { + return TCL_ERROR; + } + while (1) { + Var *varPtr2; + + if (searchPtr->nextEntry != NULL) { + varPtr2 = (Var *) Tcl_GetHashValue(searchPtr->nextEntry); + if (!(varPtr2->flags & VAR_UNDEFINED)) { + break; + } + } + searchPtr->nextEntry = Tcl_NextHashEntry(&searchPtr->search); + if (searchPtr->nextEntry == NULL) { + interp->result = "0"; + return TCL_OK; + } + } + interp->result = "1"; + return TCL_OK; + } else if ((c == 'd') && (strncmp(argv[1], "donesearch", length) == 0)) { + ArraySearch *searchPtr, *prevPtr; + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " donesearch arrayName searchId\"", (char *) NULL); + return TCL_ERROR; + } + searchPtr = ParseSearchId(interp, varPtr, argv[2], argv[3]); + if (searchPtr == NULL) { + return TCL_ERROR; + } + if (varPtr->searchPtr == searchPtr) { + varPtr->searchPtr = searchPtr->nextPtr; + } else { + for (prevPtr = varPtr->searchPtr; ; prevPtr = prevPtr->nextPtr) { + if (prevPtr->nextPtr == searchPtr) { + prevPtr->nextPtr = searchPtr->nextPtr; + break; + } + } + } + ckfree((char *) searchPtr); + } else if ((c == 'n') && (strncmp(argv[1], "names", length) == 0) + && (length >= 2)) { + Tcl_HashSearch search; + Var *varPtr2; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " names arrayName\"", (char *) NULL); + return TCL_ERROR; + } + for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + varPtr2 = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr2->flags & VAR_UNDEFINED) { + continue; + } + Tcl_AppendElement(interp, + Tcl_GetHashKey(varPtr->value.tablePtr, hPtr)); + } + } else if ((c == 'n') && (strncmp(argv[1], "nextelement", length) == 0) + && (length >= 2)) { + ArraySearch *searchPtr; + Tcl_HashEntry *hPtr; + + if (argc != 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " nextelement arrayName searchId\"", + (char *) NULL); + return TCL_ERROR; + } + searchPtr = ParseSearchId(interp, varPtr, argv[2], argv[3]); + if (searchPtr == NULL) { + return TCL_ERROR; + } + while (1) { + Var *varPtr2; + + hPtr = searchPtr->nextEntry; + if (hPtr == NULL) { + hPtr = Tcl_NextHashEntry(&searchPtr->search); + if (hPtr == NULL) { + return TCL_OK; + } + } else { + searchPtr->nextEntry = NULL; + } + varPtr2 = (Var *) Tcl_GetHashValue(hPtr); + if (!(varPtr2->flags & VAR_UNDEFINED)) { + break; + } + } + interp->result = Tcl_GetHashKey(varPtr->value.tablePtr, hPtr); + } else if ((c == 's') && (strncmp(argv[1], "size", length) == 0) + && (length >= 2)) { + Tcl_HashSearch search; + Var *varPtr2; + int size; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " size arrayName\"", (char *) NULL); + return TCL_ERROR; + } + size = 0; + for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + varPtr2 = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr2->flags & VAR_UNDEFINED) { + continue; + } + size++; + } + sprintf(interp->result, "%d", size); + } else if ((c == 's') && (strncmp(argv[1], "startsearch", length) == 0) + && (length >= 2)) { + ArraySearch *searchPtr; + + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", + argv[0], " startsearch arrayName\"", (char *) NULL); + return TCL_ERROR; + } + searchPtr = (ArraySearch *) ckalloc(sizeof(ArraySearch)); + if (varPtr->searchPtr == NULL) { + searchPtr->id = 1; + Tcl_AppendResult(interp, "s-1-", argv[2], (char *) NULL); + } else { + char string[20]; + + searchPtr->id = varPtr->searchPtr->id + 1; + sprintf(string, "%d", searchPtr->id); + Tcl_AppendResult(interp, "s-", string, "-", argv[2], + (char *) NULL); + } + searchPtr->varPtr = varPtr; + searchPtr->nextEntry = Tcl_FirstHashEntry(varPtr->value.tablePtr, + &searchPtr->search); + searchPtr->nextPtr = varPtr->searchPtr; + varPtr->searchPtr = searchPtr; + } else { + Tcl_AppendResult(interp, "bad option \"", argv[1], + "\": should be anymore, donesearch, names, nextelement, ", + "size, or startsearch", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * MakeUpvar -- + * + * This procedure does all of the work of the "global" and "upvar" + * commands. + * + * Results: + * A standard Tcl completion code. If an error occurs then an + * error message is left in iPtr->result. + * + * Side effects: + * The variable given by myName is linked to the variable in + * framePtr given by otherP1 and otherP2, so that references to + * myName are redirected to the other variable like a symbolic +* link. + * + *---------------------------------------------------------------------- + */ + +static int +MakeUpvar(iPtr, framePtr, otherP1, otherP2, myName) + Interp *iPtr; /* Interpreter containing variables. Used + * for error messages, too. */ + CallFrame *framePtr; /* Call frame containing "other" variable. + * NULL means use global context. */ + char *otherP1, *otherP2; /* Two-part name of variable in framePtr. */ + char *myName; /* Name of variable in local table, which + * will refer to otherP1/P2. Must be a + * scalar. */ +{ + Tcl_HashEntry *hPtr; + Var *otherPtr, *varPtr, *arrayPtr; + CallFrame *savedFramePtr; + int new; + + /* + * In order to use LookupVar to find "other", temporarily replace + * the current frame pointer in the interpreter. + */ + + savedFramePtr = iPtr->varFramePtr; + iPtr->varFramePtr = framePtr; + otherPtr = LookupVar((Tcl_Interp *) iPtr, otherP1, otherP2, + TCL_LEAVE_ERR_MSG, "access", CRT_PART1|CRT_PART2, &arrayPtr); + iPtr->varFramePtr = savedFramePtr; + if (otherPtr == NULL) { + return TCL_ERROR; + } + if (iPtr->varFramePtr != NULL) { + hPtr = Tcl_CreateHashEntry(&iPtr->varFramePtr->varTable, myName, &new); + } else { + hPtr = Tcl_CreateHashEntry(&iPtr->globalTable, myName, &new); + } + if (new) { + varPtr = NewVar(); + Tcl_SetHashValue(hPtr, varPtr); + varPtr->hPtr = hPtr; + } else { + /* + * The variable already exists. If it's not an upvar then it's + * an error. If it is an upvar, then just disconnect it from the + * thing it currently refers to. + */ + + varPtr = (Var *) Tcl_GetHashValue(hPtr); + if (varPtr->flags & VAR_UPVAR) { + Var *upvarPtr; + + upvarPtr = varPtr->value.upvarPtr; + if (upvarPtr == otherPtr) { + return TCL_OK; + } + upvarPtr->refCount--; + if (upvarPtr->flags & VAR_UNDEFINED) { + CleanupVar(upvarPtr, (Var *) NULL); + } + } else if (!(varPtr->flags & VAR_UNDEFINED)) { + Tcl_AppendResult((Tcl_Interp *) iPtr, "variable \"", myName, + "\" already exists", (char *) NULL); + return TCL_ERROR; + } + } + varPtr->flags = (varPtr->flags & ~VAR_UNDEFINED) | VAR_UPVAR; + varPtr->value.upvarPtr = otherPtr; + otherPtr->refCount++; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GlobalCmd -- + * + * This procedure is invoked to process the "global" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_GlobalCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Interp *iPtr = (Interp *) interp; + + if (argc < 2) { + Tcl_AppendResult((Tcl_Interp *) iPtr, "wrong # args: should be \"", + argv[0], " varName ?varName ...?\"", (char *) NULL); + return TCL_ERROR; + } + if (iPtr->varFramePtr == NULL) { + return TCL_OK; + } + + for (argc--, argv++; argc > 0; argc--, argv++) { + if (MakeUpvar(iPtr, (CallFrame *) NULL, *argv, (char *) NULL, *argv) + != TCL_OK) { + return TCL_ERROR; + } + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_UpvarCmd -- + * + * This procedure is invoked to process the "upvar" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result value. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + /* ARGSUSED */ +int +Tcl_UpvarCmd(dummy, interp, argc, argv) + ClientData dummy; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ + char **argv; /* Argument strings. */ +{ + register Interp *iPtr = (Interp *) interp; + int result; + CallFrame *framePtr; + register char *p; + + if (argc < 3) { + upvarSyntax: + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?level? otherVar localVar ?otherVar localVar ...?\"", + (char *) NULL); + return TCL_ERROR; + } + + /* + * Find the hash table containing the variable being referenced. + */ + + result = TclGetFrame(interp, argv[1], &framePtr); + if (result == -1) { + return TCL_ERROR; + } + argc -= result+1; + if ((argc & 1) != 0) { + goto upvarSyntax; + } + argv += result+1; + + /* + * Iterate over all the pairs of (other variable, local variable) + * names. For each pair, divide the other variable name into two + * parts, then call MakeUpvar to do all the work of creating linking + * it to the local variable. + */ + + for ( ; argc > 0; argc -= 2, argv += 2) { + for (p = argv[0]; *p != 0; p++) { + if (*p == '(') { + char *open = p; + + do { + p++; + } while (*p != '\0'); + p--; + if (*p != ')') { + goto scalar; + } + *open = '\0'; + *p = '\0'; + result = MakeUpvar(iPtr, framePtr, argv[0], open+1, argv[1]); + *open = '('; + *p = ')'; + goto checkResult; + } + } + scalar: + result = MakeUpvar(iPtr, framePtr, argv[0], (char *) NULL, argv[1]); + + checkResult: + if (result != TCL_OK) { + return TCL_ERROR; + } + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * CallTraces -- + * + * This procedure is invoked to find and invoke relevant + * trace procedures associated with a particular operation on + * a variable. This procedure invokes traces both on the + * variable and on its containing array (where relevant). + * + * Results: + * The return value is NULL if no trace procedures were invoked, or + * if all the invoked trace procedures returned successfully. + * The return value is non-zero if a trace procedure returned an + * error (in this case no more trace procedures were invoked after + * the error was returned). In this case the return value is a + * pointer to a static string describing the error. + * + * Side effects: + * Almost anything can happen, depending on trace; this procedure + * itself doesn't have any side effects. + * + *---------------------------------------------------------------------- + */ + +static char * +CallTraces(iPtr, arrayPtr, varPtr, part1, part2, flags) + Interp *iPtr; /* Interpreter containing variable. */ + register Var *arrayPtr; /* Pointer to array variable that + * contains the variable, or NULL if + * the variable isn't an element of an + * array. */ + Var *varPtr; /* Variable whose traces are to be + * invoked. */ + char *part1, *part2; /* Variable's two-part name. */ + int flags; /* Flags to pass to trace procedures: + * indicates what's happening to + * variable, plus other stuff like + * TCL_GLOBAL_ONLY and + * TCL_INTERP_DESTROYED. */ +{ + register VarTrace *tracePtr; + ActiveVarTrace active; + char *result; + + /* + * If there are already similar trace procedures active for the + * variable, don't call them again. + */ + + if (varPtr->flags & VAR_TRACE_ACTIVE) { + return NULL; + } + varPtr->flags |= VAR_TRACE_ACTIVE; + varPtr->refCount++; + + /* + * Invoke traces on the array containing the variable, if relevant. + */ + + result = NULL; + active.nextPtr = iPtr->activeTracePtr; + iPtr->activeTracePtr = &active; + if (arrayPtr != NULL) { + arrayPtr->refCount++; + active.varPtr = arrayPtr; + for (tracePtr = arrayPtr->tracePtr; tracePtr != NULL; + tracePtr = active.nextTracePtr) { + active.nextTracePtr = tracePtr->nextPtr; + if (!(tracePtr->flags & flags)) { + continue; + } + result = (*tracePtr->traceProc)(tracePtr->clientData, + (Tcl_Interp *) iPtr, part1, part2, flags); + if (result != NULL) { + if (flags & TCL_TRACE_UNSETS) { + result = NULL; + } else { + goto done; + } + } + } + } + + /* + * Invoke traces on the variable itself. + */ + + if (flags & TCL_TRACE_UNSETS) { + flags |= TCL_TRACE_DESTROYED; + } + active.varPtr = varPtr; + for (tracePtr = varPtr->tracePtr; tracePtr != NULL; + tracePtr = active.nextTracePtr) { + active.nextTracePtr = tracePtr->nextPtr; + if (!(tracePtr->flags & flags)) { + continue; + } + result = (*tracePtr->traceProc)(tracePtr->clientData, + (Tcl_Interp *) iPtr, part1, part2, flags); + if (result != NULL) { + if (flags & TCL_TRACE_UNSETS) { + result = NULL; + } else { + goto done; + } + } + } + + /* + * Restore the variable's flags, remove the record of our active + * traces, and then return. + */ + + done: + if (arrayPtr != NULL) { + arrayPtr->refCount--; + } + varPtr->flags &= ~VAR_TRACE_ACTIVE; + varPtr->refCount--; + iPtr->activeTracePtr = active.nextPtr; + return result; +} + +/* + *---------------------------------------------------------------------- + * + * NewVar -- + * + * Create a new variable with a given amount of storage + * space. + * + * Results: + * The return value is a pointer to the new variable structure. + * The variable will not be part of any hash table yet. Its + * initial value is empty. + * + * Side effects: + * Storage gets allocated. + * + *---------------------------------------------------------------------- + */ + +static Var * +NewVar() +{ + register Var *varPtr; + + varPtr = (Var *) ckalloc(sizeof(Var)); + varPtr->valueLength = 0; + varPtr->valueSpace = 0; + varPtr->value.string = NULL; + varPtr->hPtr = NULL; + varPtr->refCount = 0; + varPtr->tracePtr = NULL; + varPtr->searchPtr = NULL; + varPtr->flags = VAR_UNDEFINED; + return varPtr; +} + +/* + *---------------------------------------------------------------------- + * + * ParseSearchId -- + * + * This procedure translates from a string to a pointer to an + * active array search (if there is one that matches the string). + * + * Results: + * The return value is a pointer to the array search indicated + * by string, or NULL if there isn't one. If NULL is returned, + * interp->result contains an error message. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static ArraySearch * +ParseSearchId(interp, varPtr, varName, string) + Tcl_Interp *interp; /* Interpreter containing variable. */ + Var *varPtr; /* Array variable search is for. */ + char *varName; /* Name of array variable that search is + * supposed to be for. */ + char *string; /* String containing id of search. Must have + * form "search-num-var" where "num" is a + * decimal number and "var" is a variable + * name. */ +{ + char *end; + int id; + ArraySearch *searchPtr; + + /* + * Parse the id into the three parts separated by dashes. + */ + + if ((string[0] != 's') || (string[1] != '-')) { + syntax: + Tcl_AppendResult(interp, "illegal search identifier \"", string, + "\"", (char *) NULL); + return NULL; + } + id = strtoul(string+2, &end, 10); + if ((end == (string+2)) || (*end != '-')) { + goto syntax; + } + if (strcmp(end+1, varName) != 0) { + Tcl_AppendResult(interp, "search identifier \"", string, + "\" isn't for variable \"", varName, "\"", (char *) NULL); + return NULL; + } + + /* + * Search through the list of active searches on the interpreter + * to see if the desired one exists. + */ + + for (searchPtr = varPtr->searchPtr; searchPtr != NULL; + searchPtr = searchPtr->nextPtr) { + if (searchPtr->id == id) { + return searchPtr; + } + } + Tcl_AppendResult(interp, "couldn't find search \"", string, "\"", + (char *) NULL); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * DeleteSearches -- + * + * This procedure is called to free up all of the searches + * associated with an array variable. + * + * Results: + * None. + * + * Side effects: + * Memory is released to the storage allocator. + * + *---------------------------------------------------------------------- + */ + +static void +DeleteSearches(arrayVarPtr) + register Var *arrayVarPtr; /* Variable whose searches are + * to be deleted. */ +{ + ArraySearch *searchPtr; + + while (arrayVarPtr->searchPtr != NULL) { + searchPtr = arrayVarPtr->searchPtr; + arrayVarPtr->searchPtr = searchPtr->nextPtr; + ckfree((char *) searchPtr); + } +} + +/* + *---------------------------------------------------------------------- + * + * TclDeleteVars -- + * + * This procedure is called to recycle all the storage space + * associated with a table of variables. For this procedure + * to work correctly, it must not be possible for any of the + * variable in the table to be accessed from Tcl commands + * (e.g. from trace procedures). + * + * Results: + * None. + * + * Side effects: + * Variables are deleted and trace procedures are invoked, if + * any are declared. + * + *---------------------------------------------------------------------- + */ + +void +TclDeleteVars(iPtr, tablePtr) + Interp *iPtr; /* Interpreter to which variables belong. */ + Tcl_HashTable *tablePtr; /* Hash table containing variables to + * delete. */ +{ + Tcl_HashSearch search; + Tcl_HashEntry *hPtr; + register Var *varPtr; + Var *upvarPtr; + int flags; + ActiveVarTrace *activePtr; + + flags = TCL_TRACE_UNSETS; + if (tablePtr == &iPtr->globalTable) { + flags |= TCL_INTERP_DESTROYED | TCL_GLOBAL_ONLY; + } + for (hPtr = Tcl_FirstHashEntry(tablePtr, &search); hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search)) { + varPtr = (Var *) Tcl_GetHashValue(hPtr); + + /* + * For global/upvar variables referenced in procedures, decrement + * the reference count on the variable referred to, and free up + * the referenced variable if it's no longer needed. + */ + + if (varPtr->flags & VAR_UPVAR) { + upvarPtr = varPtr->value.upvarPtr; + upvarPtr->refCount--; + if (upvarPtr->flags & VAR_UNDEFINED) { + CleanupVar(upvarPtr, (Var *) NULL); + } + } + + /* + * Invoke traces on the variable that is being deleted, then + * free up the variable's space (no need to free the hash entry + * here, unless we're dealing with a global variable: the + * hash entries will be deleted automatically when the whole + * table is deleted). + */ + + if (varPtr->tracePtr != NULL) { + (void) CallTraces(iPtr, (Var *) NULL, varPtr, + Tcl_GetHashKey(tablePtr, hPtr), (char *) NULL, flags); + while (varPtr->tracePtr != NULL) { + VarTrace *tracePtr = varPtr->tracePtr; + varPtr->tracePtr = tracePtr->nextPtr; + ckfree((char *) tracePtr); + } + for (activePtr = iPtr->activeTracePtr; activePtr != NULL; + activePtr = activePtr->nextPtr) { + if (activePtr->varPtr == varPtr) { + activePtr->nextTracePtr = NULL; + } + } + } + if (varPtr->flags & VAR_ARRAY) { + DeleteArray(iPtr, Tcl_GetHashKey(tablePtr, hPtr), varPtr, flags); + } + if (varPtr->valueSpace > 0) { + /* + * SPECIAL TRICK: it's possible that the interpreter's result + * currently points to this variable (for example, a "set" or + * "lappend" command was the last command in a procedure that's + * being returned from). If this is the case, then just pass + * ownership of the value string to the Tcl interpreter. + */ + + if (iPtr->result == varPtr->value.string) { + iPtr->freeProc = (Tcl_FreeProc *) free; + } else { + ckfree(varPtr->value.string); + } + varPtr->valueSpace = 0; + } + varPtr->hPtr = NULL; + varPtr->tracePtr = NULL; + varPtr->flags = VAR_UNDEFINED; + if (varPtr->refCount == 0) { + ckfree((char *) varPtr); + } + } + Tcl_DeleteHashTable(tablePtr); +} + +/* + *---------------------------------------------------------------------- + * + * DeleteArray -- + * + * This procedure is called to free up everything in an array + * variable. It's the caller's responsibility to make sure + * that the array is no longer accessible before this procedure + * is called. + * + * Results: + * None. + * + * Side effects: + * All storage associated with varPtr's array elements is deleted + * (including the hash table). Delete trace procedures for + * array elements are invoked. + * + *---------------------------------------------------------------------- + */ + +static void +DeleteArray(iPtr, arrayName, varPtr, flags) + Interp *iPtr; /* Interpreter containing array. */ + char *arrayName; /* Name of array (used for trace + * callbacks). */ + Var *varPtr; /* Pointer to variable structure. */ + int flags; /* Flags to pass to CallTraces: + * TCL_TRACE_UNSETS and sometimes + * TCL_INTERP_DESTROYED and/or + * TCL_GLOBAL_ONLY. */ +{ + Tcl_HashSearch search; + register Tcl_HashEntry *hPtr; + register Var *elPtr; + ActiveVarTrace *activePtr; + + DeleteSearches(varPtr); + for (hPtr = Tcl_FirstHashEntry(varPtr->value.tablePtr, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + elPtr = (Var *) Tcl_GetHashValue(hPtr); + if (elPtr->valueSpace != 0) { + /* + * SPECIAL TRICK: it's possible that the interpreter's result + * currently points to this element (for example, a "set" or + * "lappend" command was the last command in a procedure that's + * being returned from). If this is the case, then just pass + * ownership of the value string to the Tcl interpreter. + */ + + if (iPtr->result == elPtr->value.string) { + iPtr->freeProc = (Tcl_FreeProc *) free; + } else { + ckfree(elPtr->value.string); + } + elPtr->valueSpace = 0; + } + elPtr->hPtr = NULL; + if (elPtr->tracePtr != NULL) { + elPtr->flags &= ~VAR_TRACE_ACTIVE; + (void) CallTraces(iPtr, (Var *) NULL, elPtr, arrayName, + Tcl_GetHashKey(varPtr->value.tablePtr, hPtr), flags); + while (elPtr->tracePtr != NULL) { + VarTrace *tracePtr = elPtr->tracePtr; + elPtr->tracePtr = tracePtr->nextPtr; + ckfree((char *) tracePtr); + } + for (activePtr = iPtr->activeTracePtr; activePtr != NULL; + activePtr = activePtr->nextPtr) { + if (activePtr->varPtr == elPtr) { + activePtr->nextTracePtr = NULL; + } + } + } + elPtr->flags = VAR_UNDEFINED; + if (elPtr->refCount == 0) { + ckfree((char *) elPtr); + } + } + Tcl_DeleteHashTable(varPtr->value.tablePtr); + ckfree((char *) varPtr->value.tablePtr); +} + +/* + *---------------------------------------------------------------------- + * + * CleanupVar -- + * + * This procedure is called when it looks like it may be OK + * to free up the variable's record and hash table entry, and + * those of its containing parent. It's called, for example, + * when a trace on a variable deletes the variable. + * + * Results: + * None. + * + * Side effects: + * If the variable (or its containing array) really is dead then + * its record, and possibly its hash table entry, gets freed up. + * + *---------------------------------------------------------------------- + */ + +static void +CleanupVar(varPtr, arrayPtr) + Var *varPtr; /* Pointer to variable that may be a + * candidate for being expunged. */ + Var *arrayPtr; /* Array that contains the variable, or + * NULL if this variable isn't an array + * element. */ +{ + if ((varPtr->flags & VAR_UNDEFINED) && (varPtr->refCount == 0) + && (varPtr->tracePtr == NULL)) { + if (varPtr->hPtr != NULL) { + Tcl_DeleteHashEntry(varPtr->hPtr); + } + ckfree((char *) varPtr); + } + if (arrayPtr != NULL) { + if ((arrayPtr->flags & VAR_UNDEFINED) && (arrayPtr->refCount == 0) + && (arrayPtr->tracePtr == NULL)) { + if (arrayPtr->hPtr != NULL) { + Tcl_DeleteHashEntry(arrayPtr->hPtr); + } + ckfree((char *) arrayPtr); + } + } + return; +} + +/* + *---------------------------------------------------------------------- + * + * VarErrMsg -- + * + * Generate a reasonable error message describing why a variable + * operation failed. + * + * Results: + * None. + * + * Side effects: + * Interp->result is reset to hold a message identifying the + * variable given by part1 and part2 and describing why the + * variable operation failed. + * + *---------------------------------------------------------------------- + */ + +static void +VarErrMsg(interp, part1, part2, operation, reason) + Tcl_Interp *interp; /* Interpreter in which to record message. */ + char *part1, *part2; /* Variable's two-part name. */ + char *operation; /* String describing operation that failed, + * e.g. "read", "set", or "unset". */ + char *reason; /* String describing why operation failed. */ +{ + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "can't ", operation, " \"", part1, (char *) NULL); + if (part2 != NULL) { + Tcl_AppendResult(interp, "(", part2, ")", (char *) NULL); + } + Tcl_AppendResult(interp, "\": ", reason, (char *) NULL); +} diff --git a/vendor/x11iraf/obm/Tcl/tests/README b/vendor/x11iraf/obm/Tcl/tests/README new file mode 100644 index 00000000..593174a5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/README @@ -0,0 +1,93 @@ +Tcl Test Suite +-------------- + +This directory contains a set of validation tests for the Tcl +commands. Each of the files whose name ends in ".test" is +intended to fully exercise one or a few Tcl commands. The +commands tested by a given file are listed in the first line +of the file. + +You can run the tests in two ways: + (a) type "make test" in the parent directory to this one; this + will run all of the tests. + (b) start up tcltest in this directory, then "source" the test + file (for example, type "source parse.test"). To run all + of the tests, type "source all". +In either case no output will be generated if all goes well, except +for a listing of the tests.. If there are errors then additional +messages will appear in the format described below. + +The rest of this file provides additional information on the +features of the testing environment. + +This approach to testing was designed and initially implemented +by Mary Ann May-Pumphrey of Sun Microsystems. Many thanks to +her for donating her work back to the public Tcl release. + +Definitions file: +----------------- + +The file "defs" defines a collection of procedures and variables +used to run the tests. It is read in automatically by each of the +.test files if needed, but once it has been read once it will not +be read again by the .test files. If you change defs while running +tests you'll have to "source" it by hand to load its new contents. + +Test output: +------------ + +Normally, output only appears when there are errors. However, if +the variable VERBOSE is set to 1 then tests will be run in "verbose" +mode and output will be generated for each test regardless of +whether it succeeded or failed. Test output consists of the +following information: + + - the test identifier (which can be used to locate the test code + in the .test file) + - a brief description of the test + - the contents of the test code + - the actual results produced by the tests + - a "PASSED" or "FAILED" message + - the expected results (if the test failed) + +You can set VERBOSE either interactively (after the defs file has been +read in), or you can change the default value in "defs". + +Selecting tests for execution: +------------------------------ + +Normally, all the tests in a file are run whenever the file is +"source"d. However, you can select a specific set of tests using +the global variable TESTS. This variable contains a pattern; any +test whose identifier matches TESTS will be run. For example, +the following interactive command causes all of the "for" tests in +groups 2 and 4 to be executed: + + set TESTS {for-[24]*} + +TESTS defaults to *, but you can change the default in "defs" if +you wish. + +Saving keystrokes: +------------------ + +A convenience procedure named "dotests" is included in file +"defs". It takes two arguments--the name of the test file (such +as "parse.test"), and a pattern selecting the tests you want to +execute. It sets TESTS to the second argument, calls "source" on +the file specified in the first argument, and restores TESTS to +its pre-call value at the end. + +Batch vs. interactive execution: +-------------------------------- + +The tests can be run in either batch or interactive mode. Batch +mode refers to using I/O redirection from a UNIX shell. For example, +the following command causes the tests in the file named "parse.test" +to be executed: + + tclTest < parse.test > parse.test.results + +Users who want to execute the tests in this fashion need to first +ensure that the file "defs" has proper values for the global +variables that control the testing environment (VERBOSE and TESTS). diff --git a/vendor/x11iraf/obm/Tcl/tests/all b/vendor/x11iraf/obm/Tcl/tests/all new file mode 100644 index 00000000..890e9a2d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/all @@ -0,0 +1,10 @@ +# This file contains a top-level script to run all of the Tcl +# tests. Execute it by invoking "source all" when running tclTest +# in this directory. +# +# $Header: /sprite/src/lib/tcl/tests/RCS/all,v 1.4 91/09/08 13:43:07 ouster Exp $ (Berkeley) + +foreach i [lsort [glob *.test]] { + puts stdout $i + source $i +} diff --git a/vendor/x11iraf/obm/Tcl/tests/append.test b/vendor/x11iraf/obm/Tcl/tests/append.test new file mode 100644 index 00000000..e7f86b5c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/append.test @@ -0,0 +1,122 @@ +# Commands covered: append lappend +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/append.test,v 1.6 93/06/19 14:28:25 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {unset x} +test append-1.1 {append command} { + catch {unset x} + list [append x 1 2 abc "long string"] $x +} {{12abclong string} {12abclong string}} +test append-1.2 {append command} { + set x "" + list [append x first] [append x second] [append x third] $x +} {first firstsecond firstsecondthird firstsecondthird} + +test append-2.1 {long appends} { + set x "" + for {set i 0} {$i < 1000} {set i [expr $i+1]} { + append x "foobar " + } + set y "foobar" + set y "$y $y $y $y $y $y $y $y $y $y" + set y "$y $y $y $y $y $y $y $y $y $y" + set y "$y $y $y $y $y $y $y $y $y $y " + expr {$x == $y} +} 1 + +test append-3.1 {append errors} { + list [catch {append} msg] $msg +} {1 {wrong # args: should be "append varName value ?value ...?"}} +test append-3.2 {append errors} { + list [catch {append x} msg] $msg +} {1 {wrong # args: should be "append varName value ?value ...?"}} +test append-3.3 {append errors} { + set x "" + list [catch {append x(0) 44} msg] $msg +} {1 {can't set "x(0)": variable isn't array}} + +test append-4.1 {lappend command} { + catch {unset x} + list [lappend x 1 2 abc "long string"] $x +} {{1 2 abc {long string}} {1 2 abc {long string}}} +test append-4.2 {lappend command} { + set x "" + list [lappend x first] [lappend x second] [lappend x third] $x +} {first {first second} {first second third} {first second third}} +test append-4.3 {lappend command} { + proc foo {} { + global x + set x old + unset x + lappend x new + } + set result [foo] + rename foo {} + set result +} {new} +test append-4.3 {lappend command} { + set x {} + lappend x \{\ abc +} {\{\ abc} +test append-4.3 {lappend command} { + set x {} + lappend x \{ abc +} {\{ abc} + +proc check {var size} { + set l [llength $var] + if {$l != $size} { + return "length mismatch: should have been $size, was $l" + } + for {set i 0} {$i < $size} {set i [expr $i+1]} { + set j [lindex $var $i] + if {$j != "item $i"} { + return "element $i should have been \"item $i\", was \"$j\" + } + } + return ok +} +test append-5.1 {long lappends} { + set x "" + for {set i 0} {$i < 300} {set i [expr $i+1]} { + lappend x "item $i" + } + check $x 300 +} ok + +test append-6.1 {lappend errors} { + list [catch {lappend} msg] $msg +} {1 {wrong # args: should be "lappend varName value ?value ...?"}} +test append-6.2 {lappend errors} { + list [catch {lappend x} msg] $msg +} {1 {wrong # args: should be "lappend varName value ?value ...?"}} +test append-6.3 {lappend errors} { + set x "" + list [catch {lappend x(0) 44} msg] $msg +} {1 {can't set "x(0)": variable isn't array}} diff --git a/vendor/x11iraf/obm/Tcl/tests/async.test b/vendor/x11iraf/obm/Tcl/tests/async.test new file mode 100644 index 00000000..dc11c24d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/async.test @@ -0,0 +1,145 @@ +# Commands covered: none +# +# This file contains a collection of tests for Tcl_AsyncCreate and related +# library procedures. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/async.test,v 1.2 93/08/14 17:07:43 ouster Exp $ (Berkeley) + +if {[info commands testasync] == {}} { + puts "This application hasn't been compiled with the \"testasync\"" + puts "command, so I can't test Tcl_AsyncCreate et al." + return +} + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc async1 {result code} { + global aresult acode + set aresult $result + set acode $code + return "new result" +} +proc async2 {result code} { + global aresult acode + set aresult $result + set acode $code + return -code error "xyzzy" +} +proc async3 {result code} { + global aresult + set aresult "test pattern" + return -code $code $result +} + +set handler1 [testasync create async1] +set handler2 [testasync create async2] +set handler3 [testasync create async3] +test async-1.1 {basic async handlers} { + set aresult xxx + set acode yyy + list [catch {testasync mark $handler1 "original" 0} msg] $msg \ + $acode $aresult +} {0 {new result} 0 original} +test async-1.2 {basic async handlers} { + set aresult xxx + set acode yyy + list [catch {testasync mark $handler1 "original" 1} msg] $msg \ + $acode $aresult +} {0 {new result} 1 original} +test async-1.3 {basic async handlers} { + set aresult xxx + set acode yyy + list [catch {testasync mark $handler2 "old" 0} msg] $msg \ + $acode $aresult +} {1 xyzzy 0 old} +test async-1.4 {basic async handlers} { + set aresult xxx + set acode yyy + list [catch {testasync mark $handler2 "old" 3} msg] $msg \ + $acode $aresult +} {1 xyzzy 3 old} +test async-1.5 {basic async handlers} { + set aresult xxx + list [catch {testasync mark $handler3 "foobar" 0} msg] $msg $aresult +} {0 foobar {test pattern}} +test async-1.6 {basic async handlers} { + set aresult xxx + list [catch {testasync mark $handler3 "foobar" 1} msg] $msg $aresult +} {1 foobar {test pattern}} + +proc mult1 {result code} { + global x + lappend x mult1 + return -code 7 mult1 +} +set hm1 [testasync create mult1] +proc mult2 {result code} { + global x + lappend x mult2 + return -code 9 mult2 +} +set hm2 [testasync create mult2] +proc mult3 {result code} { + global x hm1 hm2 + lappend x [catch {testasync mark $hm2 serial2 0}] + lappend x [catch {testasync mark $hm1 serial1 0}] + lappend x mult3 + return -code 11 mult3 +} +set hm3 [testasync create mult3] + +test async-2.1 {multiple handlers} { + set x {} + list [catch {testasync mark $hm3 "foobar" 5} msg] $msg $x +} {9 mult2 {0 0 mult3 mult1 mult2}} + +proc del1 {result code} { + global x hm1 hm2 hm3 hm4 + lappend x [catch {testasync mark $hm3 serial2 0}] + lappend x [catch {testasync mark $hm1 serial1 0}] + lappend x [catch {testasync mark $hm4 serial1 0}] + testasync delete $hm1 + testasync delete $hm2 + testasync delete $hm3 + lappend x del1 + return -code 13 del1 +} +proc del2 {result code} { + global x + lappend x del2 + return -code 3 del2 +} +testasync delete $handler1 +testasync delete $hm2 +testasync delete $hm3 +set hm2 [testasync create del1] +set hm3 [testasync create mult2] +set hm4 [testasync create del2] + +test async-3.1 {deleting handlers} { + set x {} + list [catch {testasync mark $hm2 "foobar" 5} msg] $msg $x +} {3 del2 {0 0 0 del1 del2}} + +testasync delete diff --git a/vendor/x11iraf/obm/Tcl/tests/case.test b/vendor/x11iraf/obm/Tcl/tests/case.test new file mode 100644 index 00000000..6b1cb4a6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/case.test @@ -0,0 +1,126 @@ +# Commands covered: case +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/case.test,v 1.11 93/06/17 11:22:41 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} +# Commands covered: case +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/case.test,v 1.11 93/06/17 11:22:41 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test case-1.1 {simple pattern} { + case a in a {format 1} b {format 2} c {format 3} default {format 4} +} 1 +test case-1.2 {simple pattern} { + case b a {format 1} b {format 2} c {format 3} default {format 4} +} 2 +test case-1.3 {simple pattern} { + case x in a {format 1} b {format 2} c {format 3} default {format 4} +} 4 +test case-1.4 {simple pattern} { + case x a {format 1} b {format 2} c {format 3} +} {} +test case-1.5 {simple pattern matches many times} { + case b a {format 1} b {format 2} b {format 3} b {format 4} +} 2 +test case-1.6 {fancier pattern} { + case cx a {format 1} *c {format 2} *x {format 3} default {format 4} +} 3 +test case-1.7 {list of patterns} { + case abc in {a b c} {format 1} {def abc ghi} {format 2} +} 2 + +test case-2.1 {error in executed command} { + list [catch {case a in a {error "Just a test"} default {format 1}} msg] \ + $msg $errorInfo +} {1 {Just a test} {Just a test + while executing +"error "Just a test"" + ("a" arm line 1) + invoked from within +"case a in a {error "Just a test"} default {format 1}"}} +test case-2.2 {error: not enough args} { + list [catch {case} msg] $msg +} {1 {wrong # args: should be "case string ?in? patList body ... ?default body?"}} +test case-2.3 {error: pattern with no body} { + list [catch {case a b} msg] $msg +} {1 {extra case pattern with no body}} +test case-2.4 {error: pattern with no body} { + list [catch {case a in b {format 1} c} msg] $msg +} {1 {extra case pattern with no body}} +test case-2.5 {error in default command} { + list [catch {case foo in a {error case1} default {error case2} \ + b {error case 3}} msg] $msg $errorInfo +} {1 case2 {case2 + while executing +"error case2" + ("default" arm line 1) + invoked from within +"case foo in a {error case1} default {error case2} b {error case 3}"}} + +test case-3.1 {single-argument form for pattern/command pairs} { + case b in { + a {format 1} + b {format 2} + default {format 6} + } +} {2} +test case-3.2 {single-argument form for pattern/command pairs} { + case b { + a {format 1} + b {format 2} + default {format 6} + } +} {2} +test case-3.3 {single-argument form for pattern/command pairs} { + list [catch {case z in {a 2 b}} msg] $msg +} {1 {extra case pattern with no body}} diff --git a/vendor/x11iraf/obm/Tcl/tests/cd.test b/vendor/x11iraf/obm/Tcl/tests/cd.test new file mode 100644 index 00000000..d1eb3357 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/cd.test @@ -0,0 +1,121 @@ +# Commands covered: cd, pwd +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/cd.test,v 1.21 93/10/07 17:21:21 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {exec rm -rf cd.dir} +exec mkdir cd.dir +exec cat << "Sample text" > cd.dir/test.file +set cwd [exec pwd] + +test cd-1.1 {simple pwd check} { + pwd +} $cwd + +cd cd.dir +if $atBerkeley { + test cd-2.1 {changing directories} { + list [exec pwd] + } $cwd/cd.dir + test cd-2.2 {changing directories} { + pwd + } $cwd/cd.dir +} +test cd-2.3 {changing directories} { + exec cat test.file +} "Sample text" +cd .. +test cd-2.4 {changing directories} { + exec pwd +} $cwd +test cd-2.5 {changing directories} { + pwd +} $cwd +test cd-2.6 {changing directories} { + exec cat cd.dir/test.file +} "Sample text" + +# The tests below seem to fail on lots of machines for a variety +# of reasons, such as the auto-mounter, home directories that are +# symbolic links, etc. + +if $atBerkeley { + set home [exec sh -c "cd; pwd"] + test cd-2.7 {changing directories} { + cd ~ + set x [list [exec pwd] [pwd]] + cd $cwd + set x + } "$home $home" + test cd-2.8 {changing directories} { + cd + set x [list [exec pwd] [pwd]] + cd $cwd + set x + } "$home $home" +} + +test cd-3.1 {cd return value} { + cd . +} {} + +test cd-4.1 {errors in cd command} { + list [catch {cd 1 2} msg] $msg $errorCode +} {1 {wrong # args: should be "cd dirName"} NONE} +test cd-4.2 {errors in cd command} { + string tolower [list [catch {cd _bad_dir} msg] $msg $errorCode] +} {1 {couldn't change working directory to "_bad_dir": no such file or directory} {posix enoent {no such file or directory}}} +test cd-4.3 {errors in cd command} { + string tolower [list [catch {cd cd.dir/test.file} msg] $msg $errorCode] +} {1 {couldn't change working directory to "cd.dir/test.file": not a directory} {posix enotdir {not a directory}}} +test cd-4.4 {errors in cd command} { + set home $env(HOME) + unset env(HOME) + set x [list [catch cd msg] $msg] + set env(HOME) $home + set x +} {1 {couldn't find HOME environment variable to expand "~"}} + +test cd-5.1 {errors in pwd command} { + list [catch {pwd a} msg] $msg +} {1 {wrong # args: should be "pwd"}} +if $atBerkeley { + exec mkdir cd.dir/child + cd cd.dir/child + exec chmod 111 .. + if {$user != "root"} { + test cd-5.2 {errors in pwd command} { + catch pwd msg + } 1 + } + cd $cwd + exec chmod 775 cd.dir +} + +catch {exec rm -rf cd.dir} +format "" diff --git a/vendor/x11iraf/obm/Tcl/tests/cmdinfo.test b/vendor/x11iraf/obm/Tcl/tests/cmdinfo.test new file mode 100644 index 00000000..8998363d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/cmdinfo.test @@ -0,0 +1,79 @@ +# Commands covered: none +# +# This file contains a collection of tests for Tcl_GetCommandInfo, +# Tcl_SetCommandInfo, Tcl_CreateCommand, and Tcl_DeleteCommand. +# Sourcing this file into Tcl runs the tests and generates output for +# errors. No output means no errors were found. +# +# Copyright (c) 1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/cmdinfo.test,v 1.1 93/07/01 16:23:09 ouster Exp $ (Berkeley) + +if {[info commands testcmdinfo] == {}} { + puts "This application hasn't been compiled with the \"testcmdinfo\"" + puts "command, so I can't test Tcl_GetCommandInfo etc." + return +} + +if {[string compare test [info procs test]] == 1} then {source defs} + +test cmdinfo-1.1 {command procedure and clientData} { + testcmdinfo create x1 + testcmdinfo get x1 +} {CmdProc1 original CmdDelProc1 original} +test cmdinfo-1.2 {command procedure and clientData} { + testcmdinfo create x1 + x1 +} {CmdProc1 original} +test cmdinfo-1.3 {command procedure and clientData} { + testcmdinfo create x1 + testcmdinfo modify x1 + testcmdinfo get x1 +} {CmdProc2 new_command_data CmdDelProc2 new_delete_data} +test cmdinfo-1.4 {command procedure and clientData} { + testcmdinfo create x1 + testcmdinfo modify x1 + x1 +} {CmdProc2 new_command_data} + +test cmdinfo-2.1 {command deletion callbacks} { + testcmdinfo create x1 + testcmdinfo delete x1 +} {CmdDelProc1 original} +test cmdinfo-2.2 {command deletion callbacks} { + testcmdinfo create x1 + testcmdinfo modify x1 + testcmdinfo delete x1 +} {CmdDelProc2 new_delete_data} + +test cmdinfo-3.1 {Tcl_Get/SetCommandInfo return values} { + testcmdinfo get non_existent +} {??} +test cmdinfo-3.2 {Tcl_Get/SetCommandInfo return values} { + testcmdinfo create x1 + testcmdinfo modify x1 +} 1 +test cmdinfo-3.3 {Tcl_Get/SetCommandInfo return values} { + testcmdinfo modify non_existent +} 0 + +catch {rename x1 ""} +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/concat.test b/vendor/x11iraf/obm/Tcl/tests/concat.test new file mode 100644 index 00000000..a758765d --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/concat.test @@ -0,0 +1,53 @@ +# Commands covered: concat +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/concat.test,v 1.6 93/10/28 16:13:57 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test concat-1.1 {simple concatenation} { + concat a b c d e f g +} {a b c d e f g} +test concat-1.2 {merging lists together} { + concat a {b c d} {e f g h} +} {a b c d e f g h} +test concat-1.3 {merge lists, retain sub-lists} { + concat a {b {c d}} {{e f}} g h +} {a b {c d} {e f} g h} +test concat-1.4 {special characters} { + concat a\{ {b \{c d} \{d +} "a{ b \\{c d {d" + +test concat-2.1 {error: no arguments} { + list [catch concat msg] $msg +} {0 {}} + +test concat-3.1 {pruning off extra white space} { + concat {} {a b c} +} {a b c} +test concat-3.2 {pruning off extra white space} { + concat x y " a b c \n\t " " " " def " +} {x y a b c def} diff --git a/vendor/x11iraf/obm/Tcl/tests/dcall.test b/vendor/x11iraf/obm/Tcl/tests/dcall.test new file mode 100644 index 00000000..a54d7191 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/dcall.test @@ -0,0 +1,54 @@ +# Commands covered: none +# +# This file contains a collection of tests for Tcl_CallWhenDeleted. +# Sourcing this file into Tcl runs the tests and generates output for +# errors. No output means no errors were found. +# +# Copyright (c) 1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/dcall.test,v 1.3 93/09/09 16:43:05 ouster Exp $ (Berkeley) + +if {[info commands testdcall] == {}} { + puts "This application hasn't been compiled with the \"testdcall\"" + puts "command, so I can't test Tcl_CallWhenDeleted." + return +} + +if {[string compare test [info procs test]] == 1} then {source defs} + +test dcall-1.1 {deletion callbacks} { + testdcall 1 2 3 +} {1 2 3} +test dcall-1.2 {deletion callbacks} { + testdcall +} {} +test dcall-1.3 {deletion callbacks} { + testdcall 20 21 22 -22 +} {20 21} +test dcall-1.4 {deletion callbacks} { + testdcall 20 21 22 -20 +} {21 22} +test dcall-1.5 {deletion callbacks} { + testdcall 20 21 22 -21 +} {20 22} +test dcall-1.6 {deletion callbacks} { + testdcall 20 21 22 -21 -22 -20 +} {} diff --git a/vendor/x11iraf/obm/Tcl/tests/defs b/vendor/x11iraf/obm/Tcl/tests/defs new file mode 100644 index 00000000..63f24404 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/defs @@ -0,0 +1,94 @@ +# This file contains support code for the Tcl test suite. It is +# normally sourced by the individual files in the test suite before +# they run their tests. This improved approach to testing was designed +# and initially implemented by Mary Ann May-Pumphrey of Sun Microsystems. + +set VERBOSE 0 +set TESTS {} +set auto_noexec 1 +set auto_noload 1 +catch {rename unknown ""} + +# If tests are being run as root, issue a warning message and set a +# variable to prevent some tests from running at all. + +set user {} +catch {set user [exec whoami]} +if {$user == "root"} { + puts stdout "Warning: you're executing as root. I'll have to" + puts stdout "skip some of the tests, since they'll fail as root." +} + +# Some of the tests don't work on some system configurations due to +# configuration quirks, not due to Tcl problems; in order to prevent +# false alarms, these tests are only run in the master source directory +# at Berkeley. The presence of a file "Berkeley" in this directory is +# used to indicate that these tests should be run. + +set atBerkeley [file exists Berkeley] + +proc print_verbose {test_name test_description contents_of_test code answer} { + puts stdout "\n" + puts stdout "==== $test_name $test_description" + puts stdout "==== Contents of test case:" + puts stdout "$contents_of_test" + if {$code != 0} { + if {$code == 1} { + puts stdout "==== Test generated error:" + puts stdout $answer + } elseif {$code == 2} { + puts stdout "==== Test generated return exception; result was:" + puts stdout $answer + } elseif {$code == 3} { + puts stdout "==== Test generated break exception" + } elseif {$code == 4} { + puts stdout "==== Test generated continue exception" + } else { + puts stdout "==== Test generated exception $code; message was:" + puts stdout $answer + } + } else { + puts stdout "==== Result was:" + puts stdout "$answer" + } +} + +proc test {test_name test_description contents_of_test passing_results} { + global VERBOSE + global TESTS + if {[string compare $TESTS ""] != 0} then { + set ok 0 + foreach test $TESTS { + if [string match $test $test_name] then { + set ok 1 + break + } + } + if !$ok then return + } + set code [catch {uplevel $contents_of_test} answer] + if {$code != 0} { + print_verbose $test_name $test_description $contents_of_test \ + $code $answer + } elseif {[string compare $answer $passing_results] == 0} then { + if $VERBOSE then { + print_verbose $test_name $test_description $contents_of_test \ + $code $answer + puts stdout "++++ $test_name PASSED" + } + } else { + print_verbose $test_name $test_description $contents_of_test $code \ + $answer + puts stdout "---- Result should have been:" + puts stdout "$passing_results" + puts stdout "---- $test_name FAILED" + } +} + +proc dotests {file args} { + global TESTS + set savedTests $TESTS + set TESTS $args + source $file + set TESTS $savedTests +} diff --git a/vendor/x11iraf/obm/Tcl/tests/dstring.test b/vendor/x11iraf/obm/Tcl/tests/dstring.test new file mode 100644 index 00000000..563dc896 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/dstring.test @@ -0,0 +1,192 @@ +# Commands covered: none +# +# This file contains a collection of tests for Tcl's dynamic string +# library procedures. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/dstring.test,v 1.3 93/10/11 09:06:01 ouster Exp $ (Berkeley) + +if {[info commands testdstring] == {}} { + puts "This application hasn't been compiled with the \"testdstring\"" + puts "command, so I can't test Tcl_DStringAppend et al." + return +} + +if {[string compare test [info procs test]] == 1} then {source defs} + +test dstring-1.1 {appending and retrieving} { + testdstring free + testdstring append "abc" -1 + list [testdstring get] [testdstring length] +} {abc 3} +test dstring-1.2 {appending and retrieving} { + testdstring free + testdstring append "abc" -1 + testdstring append " xyzzy" 3 + testdstring append " 12345" -1 + list [testdstring get] [testdstring length] +} {{abc xy 12345} 12} +test dstring-1.3 {appending and retrieving} { + testdstring free + foreach l {a b c d e f g h i j k l m n o p} { + testdstring append $l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l\n -1 + } + list [testdstring get] [testdstring length] +} {{aaaaaaaaaaaaaaaaaaaaa +bbbbbbbbbbbbbbbbbbbbb +ccccccccccccccccccccc +ddddddddddddddddddddd +eeeeeeeeeeeeeeeeeeeee +fffffffffffffffffffff +ggggggggggggggggggggg +hhhhhhhhhhhhhhhhhhhhh +iiiiiiiiiiiiiiiiiiiii +jjjjjjjjjjjjjjjjjjjjj +kkkkkkkkkkkkkkkkkkkkk +lllllllllllllllllllll +mmmmmmmmmmmmmmmmmmmmm +nnnnnnnnnnnnnnnnnnnnn +ooooooooooooooooooooo +ppppppppppppppppppppp +} 352} + +test dstring-2.1 {appending list elements} { + testdstring free + testdstring element "abc" + testdstring element "d e f" + list [testdstring get] [testdstring length] +} {{abc {d e f}} 11} +test dstring-2.2 {appending list elements} { + testdstring free + testdstring element "x" + testdstring element "\{" + testdstring element "ab\}" + testdstring get +} {x \{ ab\}} +test dstring-2.3 {appending list elements} { + testdstring free + foreach l {a b c d e f g h i j k l m n o p} { + testdstring element $l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l + } + testdstring get +} {aaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccc ddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeee fffffffffffffffffffff ggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhh iiiiiiiiiiiiiiiiiiiii jjjjjjjjjjjjjjjjjjjjj kkkkkkkkkkkkkkkkkkkkk lllllllllllllllllllll mmmmmmmmmmmmmmmmmmmmm nnnnnnnnnnnnnnnnnnnnn ooooooooooooooooooooo ppppppppppppppppppppp} + +test dstring-3.1 {nested sublists} { + testdstring free + testdstring start + testdstring element foo + testdstring element bar + testdstring end + testdstring element another + testdstring get +} {{foo bar} another} +test dstring-3.2 {nested sublists} { + testdstring free + testdstring start + testdstring start + testdstring element abc + testdstring element def + testdstring end + testdstring end + testdstring element ghi + testdstring get +} {{{abc def}} ghi} +test dstring-3.3 {nested sublists} { + testdstring free + testdstring start + testdstring start + testdstring start + testdstring element foo + testdstring element foo2 + testdstring end + testdstring end + testdstring element foo3 + testdstring end + testdstring element foo4 + testdstring get +} {{{{foo foo2}} foo3} foo4} +test dstring-3.4 {nested sublists} { + testdstring free + testdstring element before + testdstring start + testdstring element during + testdstring element more + testdstring end + testdstring element last + testdstring get +} {before {during more} last} +test dstring-3.4 {nested sublists} { + testdstring free + testdstring element "\{" + testdstring start + testdstring element first + testdstring element second + testdstring end + testdstring get +} {\{ {first second}} + +test dstring-4.1 {truncation} { + testdstring free + testdstring append "abcdefg" -1 + testdstring trunc 3 + list [testdstring get] [testdstring length] +} {abc 3} +test dstring-4.2 {truncation} { + testdstring free + testdstring append "xyzzy" -1 + testdstring trunc 0 + list [testdstring get] [testdstring length] +} {{} 0} + +test dstring-5.1 {copying to result} { + testdstring free + testdstring append xyz -1 + testdstring result +} xyz +test dstring-5.2 {copying to result} { + testdstring free + foreach l {a b c d e f g h i j k l m n o p} { + testdstring append $l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l\n -1 + } + set a [testdstring result] + testdstring append abc -1 + list $a [testdstring get] +} {{aaaaaaaaaaaaaaaaaaaaa +bbbbbbbbbbbbbbbbbbbbb +ccccccccccccccccccccc +ddddddddddddddddddddd +eeeeeeeeeeeeeeeeeeeee +fffffffffffffffffffff +ggggggggggggggggggggg +hhhhhhhhhhhhhhhhhhhhh +iiiiiiiiiiiiiiiiiiiii +jjjjjjjjjjjjjjjjjjjjj +kkkkkkkkkkkkkkkkkkkkk +lllllllllllllllllllll +mmmmmmmmmmmmmmmmmmmmm +nnnnnnnnnnnnnnnnnnnnn +ooooooooooooooooooooo +ppppppppppppppppppppp +} abc} + +testdstring free diff --git a/vendor/x11iraf/obm/Tcl/tests/env.test b/vendor/x11iraf/obm/Tcl/tests/env.test new file mode 100644 index 00000000..43e92490 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/env.test @@ -0,0 +1,122 @@ +# Commands covered: none (tests environment variable implementation) +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/env.test,v 1.7 93/10/14 14:59:14 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# If there is no "printenv" program on this system, then it's just too +# much trouble to run this test (can't necessarily run csh to get the +# environment: on some systems it barfs if there isn't a minimum set +# predefined environment variables. Also, printenv returns a non-zero +# status on some systems, so read the environment using a procedure +# that catches errors. + +set printenv {} +if [info exists env(PATH)] { + set dirs [split $env(PATH) :] +} else { + set dirs {/bin /usr/bin /usr/ucb /usr/local /usr/public /usr/etc} +} +foreach i $dirs { + if [file executable $i/printenv] { + # The following hack is needed because of weirdness with + # environment variables in symbolic lines on Apollos (?!#?). + if ![catch {exec sh -c "cd $i; pwd"} x] { + set printenv $x/printenv + } else { + set printenv $i/printenv + } + break + } +} +if {$printenv == ""} { + puts stdout "Skipping env tests: need \"printenv\" to read environment." + return "" +} +proc getenv {} { + global printenv + catch {exec $printenv} out + if {$out == "child process exited abnormally"} { + set out {} + } + return $out +} + +# Save the current environment variables at the start of the test. + +foreach name [array names env] { + set env2($name) $env($name) + unset env($name) +} + +test env-1.1 {adding environment variables} { + getenv +} {} + +set env(NAME1) "test string" +test env-1.2 {adding environment variables} { + getenv +} {NAME1=test string} + +set env(NAME2) "more" +test env-1.3 {adding environment variables} { + getenv +} {NAME1=test string +NAME2=more} + +set env(XYZZY) "garbage" +test env-1.4 {adding environment variables} { + getenv +} {NAME1=test string +NAME2=more +XYZZY=garbage} + +set env(NAME2) "new value" +test env-2.1 {changing environment variables} { + getenv +} {NAME1=test string +NAME2=new value +XYZZY=garbage} + +unset env(NAME2) +test env-3.1 {unsetting environment variables} { + getenv +} {NAME1=test string +XYZZY=garbage} +unset env(NAME1) +test env-3.2 {unsetting environment variables} { + getenv +} {XYZZY=garbage} + +# Restore the environment variables at the end of the test. + +foreach name [array names env] { + unset env($name) +} +foreach name [array names env2] { + set env($name) $env2($name) +} diff --git a/vendor/x11iraf/obm/Tcl/tests/error.test b/vendor/x11iraf/obm/Tcl/tests/error.test new file mode 100644 index 00000000..e2410aab --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/error.test @@ -0,0 +1,185 @@ +# Commands covered: error, catch +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/error.test,v 1.12 93/02/06 15:54:01 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc foo {} { + global errorInfo + set a [catch {format [error glorp2]} b] + error {Human-generated} +} + +proc foo2 {} { + global errorInfo + set a [catch {format [error glorp2]} b] + error {Human-generated} $errorInfo +} + +# Catch errors occurring in commands and errors from "error" command + +test error-1.1 {simple errors from commands} { + catch {format [string compare]} b +} 1 + +test error-1.2 {simple errors from commands} { + catch {format [string compare]} b + set b +} {wrong # args: should be "string compare string1 string2"} + +test error-1.3 {simple errors from commands} { + catch {format [string compare]} b + set errorInfo +} {wrong # args: should be "string compare string1 string2" + while executing +"string compare" + invoked from within +"format [string compare]..."} + +test error-1.4 {simple errors from commands} { + catch {error glorp} b +} 1 + +test error-1.5 {simple errors from commands} { + catch {error glorp} b + set b +} glorp + +test error-1.6 {simple errors from commands} { + catch {catch a b c} b +} 1 + +test error-1.7 {simple errors from commands} { + catch {catch a b c} b + set b +} {wrong # args: should be "catch command ?varName?"} + +test error-2.1 {simple errors from commands} { + catch catch +} 1 + +# Check errors nested in procedures. Also check the optional argument +# to "error" to generate a new error trace. + +test error-2.1 {errors in nested procedures} { + catch foo b +} 1 + +test error-2.2 {errors in nested procedures} { + catch foo b + set b +} {Human-generated} + +test error-2.3 {errors in nested procedures} { + catch foo b + set errorInfo +} {Human-generated + while executing +"error {Human-generated}" + (procedure "foo" line 4) + invoked from within +"foo"} + +test error-2.4 {errors in nested procedures} { + catch foo2 b +} 1 + +test error-2.5 {errors in nested procedures} { + catch foo2 b + set b +} {Human-generated} + +test error-2.6 {errors in nested procedures} { + catch foo2 b + set errorInfo +} {glorp2 + while executing +"error glorp2" + invoked from within +"format [error glorp2]..." + (procedure "foo2" line 1) + invoked from within +"foo2"} + +# Error conditions related to "catch". + +test error-3.1 {errors in catch command} { + list [catch {catch} msg] $msg +} {1 {wrong # args: should be "catch command ?varName?"}} +test error-3.2 {errors in catch command} { + list [catch {catch a b c} msg] $msg +} {1 {wrong # args: should be "catch command ?varName?"}} +test error-3.3 {errors in catch command} { + catch {unset a} + set a(0) 22 + list [catch {catch {format 44} a} msg] $msg +} {1 {couldn't save command result in variable}} +catch {unset a} + +# More tests related to errorInfo and errorCode + +test error-4.1 {errorInfo and errorCode variables} { + list [catch {error msg1 msg2 msg3} msg] $msg $errorInfo $errorCode +} {1 msg1 msg2 msg3} +test error-4.2 {errorInfo and errorCode variables} { + list [catch {error msg1 {} msg3} msg] $msg $errorInfo $errorCode +} {1 msg1 {msg1 + while executing +"error msg1 {} msg3"} msg3} +test error-4.3 {errorInfo and errorCode variables} { + list [catch {error msg1 {}} msg] $msg $errorInfo $errorCode +} {1 msg1 {msg1 + while executing +"error msg1 {}"} NONE} +test error-4.4 {errorInfo and errorCode variables} { + set errorCode bogus + list [catch {error msg1} msg] $msg $errorInfo $errorCode +} {1 msg1 {msg1 + while executing +"error msg1"} NONE} +test error-4.5 {errorInfo and errorCode variables} { + set errorCode bogus + list [catch {error msg1 msg2 {}} msg] $msg $errorInfo $errorCode +} {1 msg1 msg2 {}} + +# Errors in error command itself + +test error-5.1 {errors in error command} { + list [catch {error} msg] $msg +} {1 {wrong # args: should be "error message ?errorInfo? ?errorCode?"}} +test error-5.2 {errors in error command} { + list [catch {error a b c d} msg] $msg +} {1 {wrong # args: should be "error message ?errorInfo? ?errorCode?"}} + +# Make sure that catch resets error information + +test error-6.1 {catch must reset error state} { + catch {error outer [catch {error inner inner.errorInfo inner.errorCode}]} + list $errorCode $errorInfo +} {NONE 1} + +return "" diff --git a/vendor/x11iraf/obm/Tcl/tests/eval.test b/vendor/x11iraf/obm/Tcl/tests/eval.test new file mode 100644 index 00000000..b75460ff --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/eval.test @@ -0,0 +1,69 @@ +# Commands covered: eval +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/eval.test,v 1.5 93/02/06 15:54:14 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test eval-1.1 {single argument} { + eval {format 22} +} 22 +test eval-1.2 {multiple arguments} { + set a {$b} + set b xyzzy + eval format $a +} xyzzy +test eval-1.3 {single argument} { + eval concat a b c d e f g +} {a b c d e f g} + +test eval-2.1 {error: not enough arguments} {catch eval} 1 +test eval-2.2 {error: not enough arguments} { + catch eval msg + set msg +} {wrong # args: should be "eval arg ?arg ...?"} +test eval-2.3 {error in eval'ed command} { + catch {eval {error "test error"}} +} 1 +test eval-2.4 {error in eval'ed command} { + catch {eval {error "test error"}} msg + set msg +} {test error} +test eval-2.5 {error in eval'ed command: setting errorInfo} { + catch {eval { + set a 1 + error "test error" + }} msg + set errorInfo +} "test error + while executing +\"error \"test error\"\" + (\"eval\" body line 3) + invoked from within +\"eval { + set a 1 + error \"test error\" + }\"" diff --git a/vendor/x11iraf/obm/Tcl/tests/exec.test b/vendor/x11iraf/obm/Tcl/tests/exec.test new file mode 100644 index 00000000..3528b526 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/exec.test @@ -0,0 +1,435 @@ +# Commands covered: exec +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/exec.test,v 1.30 93/09/16 16:57:43 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# Basic operations. + +test exec-1.1 {basic exec operation} { + exec echo a b c +} "a b c" +test exec-1.2 {pipelining} { + exec echo a b c d | cat | cat +} "a b c d" +test exec-1.3 {pipelining} { + set a [exec echo a b c d | cat | wc] + list [scan $a "%d %d %d" b c d] $b $c $d +} {3 1 4 8} + +# I/O redirection: input from Tcl command. + +test exec-2.1 {redirecting input from immediate source} { + exec cat << "Sample text" +} {Sample text} +test exec-2.2 {redirecting input from immediate source} { + exec << "Sample text" cat | cat +} {Sample text} +test exec-2.3 {redirecting input from immediate source} { + exec cat << "Sample text" | cat +} {Sample text} +test exec-2.4 {redirecting input from immediate source} { + exec cat | cat << "Sample text" +} {Sample text} +test exec-2.5 {redirecting input from immediate source} { + exec cat "<<Joined to arrows" +} {Joined to arrows} + +# I/O redirection: output to file. + +catch {exec rm -f gorp.file} +test exec-3.1 {redirecting output to file} { + exec echo "Some simple words" > gorp.file + exec cat gorp.file +} "Some simple words" +test exec-3.2 {redirecting output to file} { + exec echo "More simple words" | >gorp.file cat | cat + exec cat gorp.file +} "More simple words" +test exec-3.3 {redirecting output to file} { + exec > gorp.file echo "Different simple words" | cat | cat + exec cat gorp.file +} "Different simple words" +test exec-3.4 {redirecting output to file} { + exec echo "Some simple words" >gorp.file + exec cat gorp.file +} "Some simple words" +test exec-3.5 {redirecting output to file} { + exec echo "First line" >gorp.file + exec echo "Second line" >> gorp.file + exec cat gorp.file +} "First line\nSecond line" +test exec-3.6 {redirecting output to file} { + exec echo "First line" >gorp.file + exec echo "Second line" >>gorp.file + exec cat gorp.file +} "First line\nSecond line" +test exec-3.7 {redirecting output to file} { + set f [open gorp.file w] + puts $f "Line 1" + flush $f + exec echo "More text" >@ $f + exec echo >@$f "Even more" + puts $f "Line 3" + close $f + exec cat gorp.file +} "Line 1\nMore text\nEven more\nLine 3" + +# I/O redirection: output and stderr to file. + +catch {exec rm -f gorp.file} +test exec-4.1 {redirecting output and stderr to file} { + exec echo "test output" >& gorp.file + exec cat gorp.file +} "test output" +test exec-4.2 {redirecting output and stderr to file} { + list [exec sh -c "echo foo bar 1>&2" >&gorp.file] \ + [exec cat gorp.file] +} {{} {foo bar}} +test exec-4.3 {redirecting output and stderr to file} { + exec echo "first line" > gorp.file + list [exec sh -c "echo foo bar 1>&2" >>&gorp.file] \ + [exec cat gorp.file] +} "{} {first line\nfoo bar}" +test exec-4.4 {redirecting output and stderr to file} { + set f [open gorp.file w] + puts $f "Line 1" + flush $f + exec echo "More text" >&@ $f + exec echo >&@$f "Even more" + puts $f "Line 3" + close $f + exec cat gorp.file +} "Line 1\nMore text\nEven more\nLine 3" +test exec-4.5 {redirecting output and stderr to file} { + set f [open gorp.file w] + puts $f "Line 1" + flush $f + exec >&@ $f sh -c "echo foo bar 1>&2" + exec >&@$f sh -c "echo xyzzy 1>&2" + puts $f "Line 3" + close $f + exec cat gorp.file +} "Line 1\nfoo bar\nxyzzy\nLine 3" + +# I/O redirection: input from file. + +exec echo "Just a few thoughts" > gorp.file +test exec-5.1 {redirecting input from file} { + exec cat < gorp.file +} {Just a few thoughts} +test exec-5.2 {redirecting input from file} { + exec cat | cat < gorp.file +} {Just a few thoughts} +test exec-5.3 {redirecting input from file} { + exec cat < gorp.file | cat +} {Just a few thoughts} +test exec-5.4 {redirecting input from file} { + exec < gorp.file cat | cat +} {Just a few thoughts} +test exec-5.5 {redirecting input from file} { + exec cat <gorp.file +} {Just a few thoughts} +test exec-5.6 {redirecting input from file} { + set f [open gorp.file r] + set result [exec cat <@ $f] + close $f + set result +} {Just a few thoughts} +test exec-5.7 {redirecting input from file} { + set f [open gorp.file r] + set result [exec <@$f cat] + close $f + set result +} {Just a few thoughts} + +# I/O redirection: standard error through a pipeline. + +test exec-6.1 {redirecting stderr through a pipeline} { + exec sh -c "echo foo bar" |& cat +} "foo bar" +test exec-6.2 {redirecting stderr through a pipeline} { + exec sh -c "echo foo bar 1>&2" |& cat +} "foo bar" +test exec-6.3 {redirecting stderr through a pipeline} { + exec sh -c "echo foo bar 1>&2" |& sh -c "echo second msg 1>& 2; cat" |& cat +} "second msg\nfoo bar" + +# I/O redirection: combinations. + +catch {exec rm -f gorp.file2} +test exec-7.1 {multiple I/O redirections} { + exec << "command input" > gorp.file2 cat < gorp.file + exec cat gorp.file2 +} {Just a few thoughts} +test exec-7.2 {multiple I/O redirections} { + exec < gorp.file << "command input" cat +} {command input} + +# Long input to command and output from command. + +set a "0123456789 xxxxxxxxx abcdefghi ABCDEFGHIJK\n" +set a [concat $a $a $a $a] +set a [concat $a $a $a $a] +set a [concat $a $a $a $a] +set a [concat $a $a $a $a] +test exec-8.1 {long input and output} { + exec cat << $a +} $a + +# Commands that return errors. + +test exec-9.1 {commands returning errors} { + set x [catch {exec gorp456} msg] + list $x $msg [lindex $errorCode 0] [lrange $errorCode 2 end] +} {1 {couldn't find "gorp456" to execute} CHILDSTATUS 1} +test exec-9.2 {commands returning errors} { + set x [catch {exec foo123 | gorp456} msg] + set x1 {couldn't find "foo123" to execute +couldn't find "gorp456" to execute} + set x2 {couldn't find "gorp456" to execute +couldn't find "foo123" to execute} + set y [expr {($msg == $x1) || ($msg == $x2)}] + list $x $y [lindex $errorCode 0] [lrange $errorCode 2 end] +} {1 1 CHILDSTATUS 1} +test exec-9.3 {commands returning errors} { + list [catch {exec sleep 1 | sh -c "exit 43" | sleep 1} msg] $msg +} {1 {child process exited abnormally}} +test exec-9.4 {commands returning errors} { + list [catch {exec gorp456 | echo a b c} msg] $msg +} {1 {a b c +couldn't find "gorp456" to execute}} +test exec-9.5 {commands returning errors} { + list [catch {exec sh -c "echo error msg 1>&2"} msg] $msg +} {1 {error msg}} +test exec-9.6 {commands returning errors} { + list [catch {exec sh -c "echo error msg 1>&2" | sh -c "echo error msg 1>&2"} msg] $msg +} {1 {error msg +error msg}} + +# Errors in executing the Tcl command, as opposed to errors in the +# processes that are invoked. + +test exec-10.1 {errors in exec invocation} { + list [catch {exec} msg] $msg +} {1 {wrong # args: should be "exec ?switches? arg ?arg ...?"}} +test exec-10.2 {errors in exec invocation} { + list [catch {exec | cat} msg] $msg +} {1 {illegal use of | or |& in command}} +test exec-10.3 {errors in exec invocation} { + list [catch {exec cat |} msg] $msg +} {1 {illegal use of | or |& in command}} +test exec-10.4 {errors in exec invocation} { + list [catch {exec cat | | cat} msg] $msg +} {1 {illegal use of | or |& in command}} +test exec-10.5 {errors in exec invocation} { + list [catch {exec cat | |& cat} msg] $msg +} {1 {illegal use of | or |& in command}} +test exec-10.6 {errors in exec invocation} { + list [catch {exec cat |&} msg] $msg +} {1 {illegal use of | or |& in command}} +test exec-10.7 {errors in exec invocation} { + list [catch {exec cat <} msg] $msg +} {1 {can't specify "<" as last word in command}} +test exec-10.8 {errors in exec invocation} { + list [catch {exec cat >} msg] $msg +} {1 {can't specify ">" as last word in command}} +test exec-10.9 {errors in exec invocation} { + list [catch {exec cat <<} msg] $msg +} {1 {can't specify "<<" as last word in command}} +test exec-10.10 {errors in exec invocation} { + list [catch {exec cat >>} msg] $msg +} {1 {can't specify ">>" as last word in command}} +test exec-10.11 {errors in exec invocation} { + list [catch {exec cat >&} msg] $msg +} {1 {can't specify ">&" as last word in command}} +test exec-10.12 {errors in exec invocation} { + list [catch {exec cat >>&} msg] $msg +} {1 {can't specify ">>&" as last word in command}} +test exec-10.13 {errors in exec invocation} { + list [catch {exec cat >@} msg] $msg +} {1 {can't specify ">@" as last word in command}} +test exec-10.14 {errors in exec invocation} { + list [catch {exec cat <@} msg] $msg +} {1 {can't specify "<@" as last word in command}} +test exec-10.15 {errors in exec invocation} { + list [catch {exec cat < a/b/c} msg] [string tolower $msg] +} {1 {couldn't read file "a/b/c": no such file or directory}} +test exec-10.16 {errors in exec invocation} { + list [catch {exec cat << foo > a/b/c} msg] [string tolower $msg] +} {1 {couldn't write file "a/b/c": no such file or directory}} +test exec-10.17 {errors in exec invocation} { + list [catch {exec cat << foo > a/b/c} msg] [string tolower $msg] +} {1 {couldn't write file "a/b/c": no such file or directory}} +set f [open gorp.file w] +test exec-10.18 {errors in exec invocation} { + list [catch {exec cat <@ $f} msg] $msg +} "1 {\"$f\" wasn't opened for reading}" +close $f +set f [open gorp.file r] +test exec-10.19 {errors in exec invocation} { + list [catch {exec cat >@ $f} msg] $msg +} "1 {\"$f\" wasn't opened for writing}" +close $f + +# Commands in background. + +test exec-11.1 {commands in background} { + set x [lindex [time {exec sleep 2 &}] 0] + expr $x<1000000 +} 1 +test exec-11.2 {commands in background} { + list [catch {exec echo a &b} msg] $msg +} {0 {a &b}} +test exec-11.3 {commands in background} { + llength [exec sleep 1 &] +} 1 +test exec-11.4 {commands in background} { + llength [exec sleep 1 | sleep 1 | sleep 1 &] +} 3 + +# Make sure that background commands are properly reaped when +# they eventually die. + +exec sleep 3 +if $atBerkeley { + test exec-12.1 {reaping background processes} { + for {set i 0} {$i < 20} {incr i} { + exec echo foo > /dev/null & + } + exec sleep 1 + catch {exec ps | fgrep "echo foo" | fgrep -v fgrep | wc} msg + lindex $msg 0 + } 0 + test exec-12.2 {reaping background processes} { + exec sleep 2 | sleep 2 | sleep 2 & + catch {exec ps | fgrep "sleep 2" | fgrep -v fgrep | wc} msg + set x [lindex $msg 0] + exec sleep 3 + catch {exec ps | fgrep "sleep 2" | fgrep -v fgrep | wc} msg + list $x [lindex $msg 0] + } {3 0} + test exec-12.3 {reaping background processes} { + exec sleep 1000 & + exec sleep 1000 & + set x [exec ps | fgrep "sleep 1000" | fgrep -v fgrep] + set pids {} + foreach i [split $x \n] { + lappend pids [lindex $i 0] + } + foreach i $pids { + catch {exec kill -STOP $i} + } + catch {exec ps | fgrep "sleep 1000" | fgrep -v fgrep | wc} msg + set x [lindex $msg 0] + + foreach i $pids { + catch {exec kill -KILL $i} + } + catch {exec ps | fgrep "sleep 1000" | fgrep -v fgrep | wc} msg + list $x [lindex $msg 0] + } {2 0} +} + +# Make sure "errorCode" is set correctly. + +test exec-13.1 {setting errorCode variable} { + list [catch {exec cat < a/b/c} msg] [string tolower $errorCode] +} {1 {posix enoent {no such file or directory}}} +test exec-13.2 {setting errorCode variable} { + list [catch {exec cat > a/b/c} msg] [string tolower $errorCode] +} {1 {posix enoent {no such file or directory}}} +test exec-13.3 {setting errorCode variable} { + set x [catch {exec _weirdo_command_} msg] + list $x $msg [lindex $errorCode 0] [lrange $errorCode 2 end] +} {1 {couldn't find "_weirdo_command_" to execute} CHILDSTATUS 1} + +# Switches before the first argument + +test exec-14.1 {-keepnewline switch} { + exec -keepnewline echo foo +} "foo\n" +test exec-14.2 {-keepnewline switch} { + list [catch {exec -keepnewline} msg] $msg +} {1 {wrong # args: should be "exec ?switches? arg ?arg ...?"}} +test exec-14.3 {unknown switch} { + list [catch {exec -gorp} msg] $msg +} {1 {bad switch "-gorp": must be -keepnewline or --}} +test exec-14.4 {-- switch} { + list [catch {exec -- -gorp} msg] $msg +} {1 {couldn't find "-gorp" to execute}} + +# Redirecting standard error separately from standard output + +test exec-15.1 {standard error redirection} { + exec echo "First line" > gorp.file + list [exec sh -c "echo foo bar 1>&2" 2> gorp.file] \ + [exec cat gorp.file] +} {{} {foo bar}} +test exec-15.2 {standard error redirection} { + list [exec sh -c "echo foo bar 1>&2" | echo biz baz >gorp.file \ + 2> gorp.file2] [exec cat gorp.file] \ + [exec cat gorp.file2] +} {{} {biz baz} {foo bar}} +test exec-15.3 {standard error redirection} { + list [exec sh -c "echo foo bar 1>&2" | echo biz baz 2>gorp.file \ + > gorp.file2] [exec cat gorp.file] \ + [exec cat gorp.file2] +} {{} {foo bar} {biz baz}} +test exec-15.4 {standard error redirection} { + set f [open gorp.file w] + puts $f "Line 1" + flush $f + exec sh -c "echo foo bar 1>&2" 2>@ $f + puts $f "Line 3" + close $f + exec cat gorp.file +} {Line 1 +foo bar +Line 3} +test exec-15.5 {standard error redirection} { + exec echo "First line" > gorp.file + exec sh -c "echo foo bar 1>&2" 2>> gorp.file + exec cat gorp.file +} {First line +foo bar} +test exec-15.6 {standard error redirection} { + exec sh -c "echo foo bar 1>&2" > gorp.file2 2> gorp.file \ + >& gorp.file 2> gorp.file2 | echo biz baz + list [exec cat gorp.file] [exec cat gorp.file2] +} {{biz baz} {foo bar}} + +if $atBerkeley { + test exec-16.1 {restore signal settings before exec} { + set f [open {|cat exec.test} r] + list [catch {close $f} msg] [string tolower $msg] + } {1 {child killed: write on pipe with no readers}} +} + +catch {exec rm -f gorp.file} +catch {exec rm -f gorp.file2} +return {} diff --git a/vendor/x11iraf/obm/Tcl/tests/expr.test b/vendor/x11iraf/obm/Tcl/tests/expr.test new file mode 100644 index 00000000..199134fd --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/expr.test @@ -0,0 +1,822 @@ +# Commands covered: expr +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/expr.test,v 1.30 93/09/08 16:46:45 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +if {([catch {expr T1()} msg] == 1) && ($msg == {unknown math function "T1"})} { + set gotT1 0 + puts "This application hasn't been compiled with the \"T1\" and" + puts "\"T2\" math functions, so I'll skip some of the expr tests." +} else { + set gotT1 1 +} + +# First, test all of the integer operators individually. + +test expr-1.1 {integer operators} {expr -4} -4 +test expr-1.2 {integer operators} {expr -(1+4)} -5 +test expr-1.3 {integer operators} {expr ~3} -4 +test expr-1.4 {integer operators} {expr !2} 0 +test expr-1.5 {integer operators} {expr !0} 1 +test expr-1.6 {integer operators} {expr 4*6} 24 +test expr-1.7 {integer operators} {expr 36/12} 3 +test expr-1.8 {integer operators} {expr 27/4} 6 +test expr-1.9 {integer operators} {expr 27%4} 3 +test expr-1.10 {integer operators} {expr 2+2} 4 +test expr-1.11 {integer operators} {expr 2-6} -4 +test expr-1.12 {integer operators} {expr 1<<3} 8 +test expr-1.13 {integer operators} {expr 0xff>>2} 63 +test expr-1.14 {integer operators} {expr -1>>2} -1 +test expr-1.15 {integer operators} {expr 3>2} 1 +test expr-1.16 {integer operators} {expr 2>2} 0 +test expr-1.17 {integer operators} {expr 1>2} 0 +test expr-1.18 {integer operators} {expr 3<2} 0 +test expr-1.19 {integer operators} {expr 2<2} 0 +test expr-1.20 {integer operators} {expr 1<2} 1 +test expr-1.21 {integer operators} {expr 3>=2} 1 +test expr-1.22 {integer operators} {expr 2>=2} 1 +test expr-1.23 {integer operators} {expr 1>=2} 0 +test expr-1.24 {integer operators} {expr 3<=2} 0 +test expr-1.25 {integer operators} {expr 2<=2} 1 +test expr-1.26 {integer operators} {expr 1<=2} 1 +test expr-1.27 {integer operators} {expr 3==2} 0 +test expr-1.28 {integer operators} {expr 2==2} 1 +test expr-1.29 {integer operators} {expr 3!=2} 1 +test expr-1.30 {integer operators} {expr 2!=2} 0 +test expr-1.31 {integer operators} {expr 7&0x13} 3 +test expr-1.32 {integer operators} {expr 7^0x13} 20 +test expr-1.33 {integer operators} {expr 7|0x13} 23 +test expr-1.34 {integer operators} {expr 0&&1} 0 +test expr-1.35 {integer operators} {expr 0&&0} 0 +test expr-1.36 {integer operators} {expr 1&&3} 1 +test expr-1.37 {integer operators} {expr 0||1} 1 +test expr-1.38 {integer operators} {expr 3||0} 1 +test expr-1.39 {integer operators} {expr 0||0} 0 +test expr-1.40 {integer operators} {expr 3>2?44:66} 44 +test expr-1.41 {integer operators} {expr 2>3?44:66} 66 +test expr-1.42 {integer operators} {expr 36/5} 7 +test expr-1.43 {integer operators} {expr 36%5} 1 +test expr-1.44 {integer operators} {expr -36/5} -8 +test expr-1.45 {integer operators} {expr -36%5} 4 +test expr-1.46 {integer operators} {expr 36/-5} -8 +test expr-1.47 {integer operators} {expr 36%-5} -4 +test expr-1.48 {integer operators} {expr -36/-5} 7 +test expr-1.49 {integer operators} {expr -36%-5} -1 + +# Check the floating-point operators individually, along with +# automatic conversion to integers where needed. + +test expr-2.1 {floating-point operators} {expr -4.2} -4.2 +test expr-2.2 {floating-point operators} {expr -(1.1+4.2)} -5.3 +test expr-2.3 {floating-point operators} {expr !2.1} 0 +test expr-2.4 {floating-point operators} {expr !0.0} 1 +test expr-2.5 {floating-point operators} {expr 4.2*6.3} 26.46 +test expr-2.6 {floating-point operators} {expr 36.0/12.0} 3.0 +test expr-2.7 {floating-point operators} {expr 27/4.0} 6.75 +test expr-2.8 {floating-point operators} {expr 2.3+2.1} 4.4 +test expr-2.9 {floating-point operators} {expr 2.3-6.5} -4.2 +test expr-2.10 {floating-point operators} {expr 3.1>2.1} 1 +test expr-2.11 {floating-point operators} {expr {2.1 > 2.1}} 0 +test expr-2.12 {floating-point operators} {expr 1.23>2.34e+1} 0 +test expr-2.13 {floating-point operators} {expr 3.45<2.34} 0 +test expr-2.14 {floating-point operators} {expr 0.002e3<--200e-2} 0 +test expr-2.15 {floating-point operators} {expr 1.1<2.1} 1 +test expr-2.16 {floating-point operators} {expr 3.1>=2.2} 1 +test expr-2.17 {floating-point operators} {expr 2.345>=2.345} 1 +test expr-2.18 {floating-point operators} {expr 1.1>=2.2} 0 +test expr-2.19 {floating-point operators} {expr 3.0<=2.0} 0 +test expr-2.20 {floating-point operators} {expr 2.2<=2.2} 1 +test expr-2.21 {floating-point operators} {expr 2.2<=2.2001} 1 +test expr-2.22 {floating-point operators} {expr 3.2==2.2} 0 +test expr-2.23 {floating-point operators} {expr 2.2==2.2} 1 +test expr-2.24 {floating-point operators} {expr 3.2!=2.2} 1 +test expr-2.25 {floating-point operators} {expr 2.2!=2.2} 0 +test expr-2.26 {floating-point operators} {expr 0.0&&0.0} 0 +test expr-2.27 {floating-point operators} {expr 0.0&&1.3} 0 +test expr-2.28 {floating-point operators} {expr 1.3&&0.0} 0 +test expr-2.29 {floating-point operators} {expr 1.3&&3.3} 1 +test expr-2.30 {floating-point operators} {expr 0.0||0.0} 0 +test expr-2.31 {floating-point operators} {expr 0.0||1.3} 1 +test expr-2.32 {floating-point operators} {expr 1.3||0.0} 1 +test expr-2.33 {floating-point operators} {expr 3.3||0.0} 1 +test expr-2.34 {floating-point operators} {expr 3.3>2.3?44.3:66.3} 44.3 +test expr-2.35 {floating-point operators} {expr 2.3>3.3?44.3:66.3} 66.3 +test expr-2.36 {floating-point operators} { + list [catch {expr 028.1 + 09.2} msg] $msg +} {0 37.3} + +# Operators that aren't legal on floating-point numbers + +test expr-3.1 {illegal floating-point operations} { + list [catch {expr ~4.0} msg] $msg +} {1 {can't use floating-point value as operand of "~"}} +test expr-3.2 {illegal floating-point operations} { + list [catch {expr 27%4.0} msg] $msg +} {1 {can't use floating-point value as operand of "%"}} +test expr-3.3 {illegal floating-point operations} { + list [catch {expr 27.0%4} msg] $msg +} {1 {can't use floating-point value as operand of "%"}} +test expr-3.4 {illegal floating-point operations} { + list [catch {expr 1.0<<3} msg] $msg +} {1 {can't use floating-point value as operand of "<<"}} +test expr-3.5 {illegal floating-point operations} { + list [catch {expr 3<<1.0} msg] $msg +} {1 {can't use floating-point value as operand of "<<"}} +test expr-3.6 {illegal floating-point operations} { + list [catch {expr 24.0>>3} msg] $msg +} {1 {can't use floating-point value as operand of ">>"}} +test expr-3.7 {illegal floating-point operations} { + list [catch {expr 24>>3.0} msg] $msg +} {1 {can't use floating-point value as operand of ">>"}} +test expr-3.8 {illegal floating-point operations} { + list [catch {expr 24&3.0} msg] $msg +} {1 {can't use floating-point value as operand of "&"}} +test expr-3.9 {illegal floating-point operations} { + list [catch {expr 24.0|3} msg] $msg +} {1 {can't use floating-point value as operand of "|"}} +test expr-3.10 {illegal floating-point operations} { + list [catch {expr 24.0^3} msg] $msg +} {1 {can't use floating-point value as operand of "^"}} + +# Check the string operators individually. + +test expr-4.1 {string operators} {expr {"abc" > "def"}} 0 +test expr-4.2 {string operators} {expr {"def" > "def"}} 0 +test expr-4.3 {string operators} {expr {"g" > "def"}} 1 +test expr-4.4 {string operators} {expr {"abc" < "abd"}} 1 +test expr-4.5 {string operators} {expr {"abd" < "abd"}} 0 +test expr-4.6 {string operators} {expr {"abe" < "abd"}} 0 +test expr-4.7 {string operators} {expr {"abc" >= "def"}} 0 +test expr-4.8 {string operators} {expr {"def" >= "def"}} 1 +test expr-4.9 {string operators} {expr {"g" >= "def"}} 1 +test expr-4.10 {string operators} {expr {"abc" <= "abd"}} 1 +test expr-4.11 {string operators} {expr {"abd" <= "abd"}} 1 +test expr-4.12 {string operators} {expr {"abe" <= "abd"}} 0 +test expr-4.13 {string operators} {expr {"abc" == "abd"}} 0 +test expr-4.14 {string operators} {expr {"abd" == "abd"}} 1 +test expr-4.15 {string operators} {expr {"abc" != "abd"}} 1 +test expr-4.16 {string operators} {expr {"abd" != "abd"}} 0 +test expr-4.17 {string operators} {expr {"0y" < "0x12"}} 1 +test expr-4.18 {string operators} {expr {"." < " "}} 0 +test expr-4.19 {string operators} {expr {"0" == "+"}} 0 +test expr-4.20 {string operators} {expr {"0" == "-"}} 0 +test expr-4.21 {string operators} {expr {1?"foo":"bar"}} foo +test expr-4.22 {string operators} {expr {0?"foo":"bar"}} bar + +# Operators that aren't legal on string operands. + +test expr-5.1 {illegal string operations} { + list [catch {expr {-"a"}} msg] $msg +} {1 {can't use non-numeric string as operand of "-"}} +test expr-5.2 {illegal string operations} { + list [catch {expr {~"a"}} msg] $msg +} {1 {can't use non-numeric string as operand of "~"}} +test expr-5.3 {illegal string operations} { + list [catch {expr {!"a"}} msg] $msg +} {1 {can't use non-numeric string as operand of "!"}} +test expr-5.4 {illegal string operations} { + list [catch {expr {"a"*"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "*"}} +test expr-5.5 {illegal string operations} { + list [catch {expr {"a"/"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "/"}} +test expr-5.6 {illegal string operations} { + list [catch {expr {"a"%"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "%"}} +test expr-5.7 {illegal string operations} { + list [catch {expr {"a"+"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "+"}} +test expr-5.8 {illegal string operations} { + list [catch {expr {"a"-"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "-"}} +test expr-5.9 {illegal string operations} { + list [catch {expr {"a"<<"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "<<"}} +test expr-5.10 {illegal string operations} { + list [catch {expr {"a">>"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of ">>"}} +test expr-5.11 {illegal string operations} { + list [catch {expr {"a"&"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "&"}} +test expr-5.12 {illegal string operations} { + list [catch {expr {"a"^"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "^"}} +test expr-5.13 {illegal string operations} { + list [catch {expr {"a"|"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "|"}} +test expr-5.14 {illegal string operations} { + list [catch {expr {"a"&&"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "&&"}} +test expr-5.15 {illegal string operations} { + list [catch {expr {"a"||"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "||"}} +test expr-5.16 {illegal string operations} { + list [catch {expr {"a"?4:2}} msg] $msg +} {1 {can't use non-numeric string as operand of "?"}} + +# Check precedence pairwise. + +test expr-6.1 {precedence checks} {expr -~3} 4 +test expr-6.2 {precedence checks} {expr -!3} 0 +test expr-6.3 {precedence checks} {expr -~0} 1 + +test expr-7.1 {precedence checks} {expr 2*4/6} 1 +test expr-7.2 {precedence checks} {expr 24/6*3} 12 +test expr-7.3 {precedence checks} {expr 24/6/2} 2 + +test expr-8.1 {precedence checks} {expr -2+4} 2 +test expr-8.2 {precedence checks} {expr -2-4} -6 + +test expr-9.1 {precedence checks} {expr 2*3+4} 10 +test expr-9.2 {precedence checks} {expr 8/2+4} 8 +test expr-9.3 {precedence checks} {expr 8%3+4} 6 +test expr-9.4 {precedence checks} {expr 2*3-1} 5 +test expr-9.5 {precedence checks} {expr 8/2-1} 3 +test expr-9.6 {precedence checks} {expr 8%3-1} 1 + +test expr-10.1 {precedence checks} {expr 6-3-2} 1 + +test expr-11.1 {precedence checks} {expr 7+1>>2} 2 +test expr-11.2 {precedence checks} {expr 7+1<<2} 32 +test expr-11.3 {precedence checks} {expr 7>>3-2} 3 +test expr-11.4 {precedence checks} {expr 7<<3-2} 14 + +test expr-12.1 {precedence checks} {expr 6>>1>4} 0 +test expr-12.2 {precedence checks} {expr 6>>1<2} 0 +test expr-12.3 {precedence checks} {expr 6>>1>=3} 1 +test expr-12.4 {precedence checks} {expr 6>>1<=2} 0 +test expr-12.5 {precedence checks} {expr 6<<1>5} 1 +test expr-12.6 {precedence checks} {expr 6<<1<5} 0 +test expr-12.7 {precedence checks} {expr 5<=6<<1} 1 +test expr-12.8 {precedence checks} {expr 5>=6<<1} 0 + +test expr-13.1 {precedence checks} {expr 2<3<4} 1 +test expr-13.2 {precedence checks} {expr 0<4>2} 0 +test expr-13.3 {precedence checks} {expr 4>2<1} 0 +test expr-13.4 {precedence checks} {expr 4>3>2} 0 +test expr-13.5 {precedence checks} {expr 4>3>=2} 0 +test expr-13.6 {precedence checks} {expr 4>=3>2} 0 +test expr-13.7 {precedence checks} {expr 4>=3>=2} 0 +test expr-13.8 {precedence checks} {expr 0<=4>=2} 0 +test expr-13.9 {precedence checks} {expr 4>=2<=0} 0 +test expr-10.10 {precedence checks} {expr 2<=3<=4} 1 + +test expr-14.1 {precedence checks} {expr 1==4>3} 1 +test expr-14.2 {precedence checks} {expr 0!=4>3} 1 +test expr-14.3 {precedence checks} {expr 1==3<4} 1 +test expr-14.4 {precedence checks} {expr 0!=3<4} 1 +test expr-14.5 {precedence checks} {expr 1==4>=3} 1 +test expr-14.6 {precedence checks} {expr 0!=4>=3} 1 +test expr-14.7 {precedence checks} {expr 1==3<=4} 1 +test expr-14.8 {precedence checks} {expr 0!=3<=4} 1 + +test expr-15.1 {precedence checks} {expr 1==3==3} 0 +test expr-15.2 {precedence checks} {expr 3==3!=2} 1 +test expr-15.3 {precedence checks} {expr 2!=3==3} 0 +test expr-15.4 {precedence checks} {expr 2!=1!=1} 0 + +test expr-16.1 {precedence checks} {expr 2&3==2} 0 +test expr-16.2 {precedence checks} {expr 1&3!=3} 0 + +test expr-17.1 {precedence checks} {expr 7&3^0x10} 19 +test expr-17.2 {precedence checks} {expr 7^0x10&3} 7 + +test expr-18.1 {precedence checks} {expr 7^0x10|3} 23 +test expr-18.2 {precedence checks} {expr 7|0x10^3} 23 + +test expr-19.1 {precedence checks} {expr 7|3&&1} 1 +test expr-19.2 {precedence checks} {expr 1&&3|7} 1 +test expr-19.3 {precedence checks} {expr 0&&1||1} 1 +test expr-19.4 {precedence checks} {expr 1||1&&0} 1 + +test expr-20.1 {precedence checks} {expr 1||0?3:4} 3 +test expr-20.2 {precedence checks} {expr 1?0:4||1} 0 + +# Parentheses. + +test expr-21.1 {parenthesization} {expr (2+4)*6} 36 +test expr-21.2 {parenthesization} {expr (1?0:4)||1} 1 + +# Embedded commands and variable names. + +set a 16 +test expr-22.1 {embedded variables} {expr {2*$a}} 32 +test expr-22.2 {embedded variables} { + set x -5 + set y 10 + expr {$x + $y} +} {5} +test expr-22.3 {embedded variables} { + set x " -5" + set y " +10" + expr {$x + $y} +} {5} +test expr-22.4 {embedded commands and variables} {expr {[set a] - 14}} 2 +test expr-22.5 {embedded commands and variables} { + list [catch {expr {12 - [bad_command_name]}} msg] $msg +} {1 {invalid command name: "bad_command_name"}} + +# Double-quotes and things inside them. + +test expr-23.1 {double-quotes} {expr {"abc"}} abc +test expr-23.2 {double-quotes} { + set a 189 + expr {"$a.bc"} +} 189.bc +test expr-23.3 {double-quotes} { + set b2 xyx + expr {"$b2$b2$b2.[set b2].[set b2]"} +} xyxxyxxyx.xyx.xyx +test expr-23.4 {double-quotes} {expr {"11\}\}22"}} 11}}22 +test expr-23.5 {double-quotes} {expr {"\*bc"}} {*bc} +test expr-23.6 {double-quotes} { + catch {unset bogus__} + list [catch {expr {"$bogus__"}} msg] $msg +} {1 {can't read "bogus__": no such variable}} +test expr-23.7 {double-quotes} { + list [catch {expr {"a[error Testing]bc"}} msg] $msg +} {1 Testing} + +# Numbers in various bases. + +test expr-24.1 {numbers in different bases} {expr 0x20} 32 +test expr-24.2 {numbers in different bases} {expr 015} 13 + +# Conversions between various data types. + +test expr-25.1 {type conversions} {expr 2+2.5} 4.5 +test expr-25.2 {type conversions} {expr 2.5+2} 4.5 +test expr-25.3 {type conversions} {expr 2-2.5} -0.5 +test expr-25.4 {type conversions} {expr 2/2.5} 0.8 +test expr-25.5 {type conversions} {expr 2>2.5} 0 +test expr-25.6 {type conversions} {expr 2.5>2} 1 +test expr-25.7 {type conversions} {expr 2<2.5} 1 +test expr-25.8 {type conversions} {expr 2>=2.5} 0 +test expr-25.9 {type conversions} {expr 2<=2.5} 1 +test expr-25.10 {type conversions} {expr 2==2.5} 0 +test expr-25.11 {type conversions} {expr 2!=2.5} 1 +test expr-25.12 {type conversions} {expr 2>"ab"} 0 +test expr-25.13 {type conversions} {expr {2>" "}} 1 +test expr-25.14 {type conversions} {expr {"24.1a" > 24.1}} 1 +test expr-25.15 {type conversions} {expr {24.1 > "24.1a"}} 0 +test expr-25.16 {type conversions} {expr 2+2.5} 4.5 +test expr-25.17 {type conversions} {expr 2+2.5} 4.5 +test expr-25.18 {type conversions} {expr 2.0e2} 200.0 +test expr-25.19 {type conversions} {expr 2.0e15} 2e+15 +test expr-25.20 {type conversions} {expr 10.0} 10.0 + +# Various error conditions. + +test expr-26.1 {error conditions} { + list [catch {expr 2+"a"} msg] $msg +} {1 {can't use non-numeric string as operand of "+"}} +test expr-26.2 {error conditions} { + list [catch {expr 2+4*} msg] $msg +} {1 {syntax error in expression "2+4*"}} +test expr-26.3 {error conditions} { + list [catch {expr 2+4*(} msg] $msg +} {1 {syntax error in expression "2+4*("}} +catch {unset _non_existent_} +test expr-26.4 {error conditions} { + list [catch {expr 2+$_non_existent_} msg] $msg +} {1 {can't read "_non_existent_": no such variable}} +set a xx +test expr-26.5 {error conditions} { + list [catch {expr {2+$a}} msg] $msg +} {1 {can't use non-numeric string as operand of "+"}} +test expr-26.6 {error conditions} { + list [catch {expr {2+[set a]}} msg] $msg +} {1 {can't use non-numeric string as operand of "+"}} +test expr-26.7 {error conditions} { + list [catch {expr {2+(4}} msg] $msg +} {1 {unmatched parentheses in expression "2+(4"}} +test expr-26.8 {error conditions} { + list [catch {expr 2/0} msg] $msg $errorCode +} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}} +test expr-26.9 {error conditions} { + list [catch {expr 2%0} msg] $msg $errorCode +} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}} +test expr-26.10 {error conditions} { + list [catch {expr 2.0/0.0} msg] $msg $errorCode +} {1 {divide by zero} {ARITH DIVZERO {divide by zero}}} +test expr-26.11 {error conditions} { + list [catch {expr 2#} msg] $msg +} {1 {syntax error in expression "2#"}} +test expr-26.12 {error conditions} { + list [catch {expr a.b} msg] $msg +} {1 {syntax error in expression "a.b"}} +test expr-26.13 {error conditions} { + list [catch {expr {"a"/"b"}} msg] $msg +} {1 {can't use non-numeric string as operand of "/"}} +test expr-26.14 {error conditions} { + list [catch {expr 2:3} msg] $msg +} {1 {can't have : operator without ? first}} +test expr-26.15 {error conditions} { + list [catch {expr a@b} msg] $msg +} {1 {syntax error in expression "a@b"}} +test expr-26.16 {error conditions} { + list [catch {expr a[b} msg] $msg +} {1 {missing close-bracket}} +test expr-26.17 {error conditions} { + list [catch {expr a`b} msg] $msg +} {1 {syntax error in expression "a`b"}} +test expr-26.18 {error conditions} { + list [catch {expr \"a\"\{b} msg] $msg +} {1 {missing close-brace}} +test expr-26.19 {error conditions} { + list [catch {expr a} msg] $msg +} {1 {syntax error in expression "a"}} +test expr-26.20 {error conditions} { + list [catch expr msg] $msg +} {1 {wrong # args: should be "expr arg ?arg ...?"}} + +# Cancelled evaluation. + +test expr-27.1 {cancelled evaluation} { + set a 1 + expr {0&&[set a 2]} + set a +} 1 +test expr-27.2 {cancelled evaluation} { + set a 1 + expr {1||[set a 2]} + set a +} 1 +test expr-27.3 {cancelled evaluation} { + set a 1 + expr {0?[set a 2]:1} + set a +} 1 +test expr-27.4 {cancelled evaluation} { + set a 1 + expr {1?2:[set a 2]} + set a +} 1 +catch {unset x} +test expr-27.5 {cancelled evaluation} { + list [catch {expr {[info exists x] && $x}} msg] $msg +} {0 0} +test expr-27.6 {cancelled evaluation} { + list [catch {expr {0 && [concat $x]}} msg] $msg +} {0 0} + +# Tcl_ExprBool as used in "if" statements + +test expr-28.1 {Tcl_ExprBoolean usage} { + set a 1 + if {2} {set a 2} + set a +} 2 +test expr-28.2 {Tcl_ExprBoolean usage} { + set a 1 + if {0} {set a 2} + set a +} 1 +test expr-28.3 {Tcl_ExprBoolean usage} { + set a 1 + if {1.2} {set a 2} + set a +} 2 +test expr-28.4 {Tcl_ExprBoolean usage} { + set a 1 + if {-1.1} {set a 2} + set a +} 2 +test expr-28.5 {Tcl_ExprBoolean usage} { + set a 1 + if {0.0} {set a 2} + set a +} 1 +test expr-28.6 {Tcl_ExprBoolean usage} { + set a 1 + if {"YES"} {set a 2} + set a +} 2 +test expr-28.7 {Tcl_ExprBoolean usage} { + set a 1 + if {"no"} {set a 2} + set a +} 1 +test expr-28.8 {Tcl_ExprBoolean usage} { + set a 1 + if {"true"} {set a 2} + set a +} 2 +test expr-28.9 {Tcl_ExprBoolean usage} { + set a 1 + if {"fAlse"} {set a 2} + set a +} 1 +test expr-28.10 {Tcl_ExprBoolean usage} { + set a 1 + if {"on"} {set a 2} + set a +} 2 +test expr-28.11 {Tcl_ExprBoolean usage} { + set a 1 + if {"Off"} {set a 2} + set a +} 1 +test expr-28.12 {Tcl_ExprBool usage} { + list [catch {if {"abc"} {}} msg] $msg +} {1 {expected boolean value but got "abc"}} + +# Operands enclosed in braces + +test expr-29.1 {braces} {expr {{abc}}} abc +test expr-29.2 {braces} {expr {{00010}}} 8 +test expr-29.3 {braces} {expr {{3.1200000}}} 3.12 +test expr-29.4 {braces} {expr {{a{b}{1 {2 3}}c}}} "a{b}{1 {2 3}}c" +test expr-29.5 {braces} { + list [catch {expr "\{abc"} msg] $msg +} {1 {missing close-brace}} + +# Very long values + +test expr-30.1 {long values} { + set a "0000 1111 2222 3333 4444" + set a "$a | $a | $a | $a | $a" + set a "$a || $a || $a || $a || $a" + expr {$a} +} {0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 || 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 || 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 || 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 || 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444 | 0000 1111 2222 3333 4444} +test expr-30.2 {long values} { + set a "000000000000000000000000000000" + set a "$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a${a}5" + expr $a +} 5 + +# Expressions spanning multiple arguments + +test expr-31.1 {multiple arguments to expr command} { + expr 4 + ( 6 *12) -3 +} 73 +test expr-31.2 {multiple arguments to expr command} { + list [catch {expr 2 + (3 + 4} msg] $msg +} {1 {unmatched parentheses in expression "2 + (3 + 4"}} +test expr-31.3 {multiple arguments to expr command} { + list [catch {expr 2 + 3 +} msg] $msg +} {1 {syntax error in expression "2 + 3 +"}} +test expr-31.4 {multiple arguments to expr command} { + list [catch {expr 2 + 3 )} msg] $msg +} {1 {syntax error in expression "2 + 3 )"}} + +# Math functions + +test expr-32.1 {math functions in expressions} { + expr acos(0.5) +} {1.0472} +test expr-32.2 {math functions in expressions} { + expr asin(0.5) +} {0.523599} +test expr-32.3 {math functions in expressions} { + expr atan(1.0) +} {0.785398} +test expr-32.4 {math functions in expressions} { + expr atan2(2.0, 2.0) +} {0.785398} +test expr-32.5 {math functions in expressions} { + expr ceil(1.999) +} {2.0} +test expr-32.6 {math functions in expressions} { + expr cos(.1) +} {0.995004} +test expr-32.7 {math functions in expressions} { + expr cosh(.1) +} {1.005} +test expr-32.8 {math functions in expressions} { + expr exp(1.0) +} {2.71828} +test expr-32.9 {math functions in expressions} { + expr floor(2.000) +} {2.0} +test expr-32.10 {math functions in expressions} { + expr floor(2.001) +} {2.0} +test expr-32.11 {math functions in expressions} { + expr fmod(7.3, 3.2) +} {0.9} +test expr-32.12 {math functions in expressions} { + expr hypot(3.0, 4.0) +} {5.0} +test expr-32.13 {math functions in expressions} { + expr log(2.8) +} {1.02962} +test expr-32.14 {math functions in expressions} { + expr log10(2.8) +} {0.447158} +test expr-32.15 {math functions in expressions} { + expr pow(2.1, 3.1) +} {9.97424} +test expr-32.16 {math functions in expressions} { + expr sin(.1) +} {0.0998334} +test expr-32.17 {math functions in expressions} { + expr sinh(.1) +} {0.100167} +test expr-32.18 {math functions in expressions} { + expr sqrt(2.0) +} {1.41421} +test expr-32.19 {math functions in expressions} { + expr tan(0.8) +} {1.02964} +test expr-32.20 {math functions in expressions} { + expr tanh(0.8) +} {0.664037} +test expr-32.21 {math functions in expressions} { + expr abs(-1.8) +} {1.8} +test expr-32.22 {math functions in expressions} { + expr abs(10.0) +} {10.0} +test expr-32.23 {math functions in expressions} { + expr abs(-4) +} {4} +test expr-32.24 {math functions in expressions} { + expr abs(66) +} {66} +if ($atBerkeley) { + test expr-32.25 {math functions in expressions} { + list [catch {expr abs(0x80000000)} msg] $msg + } {1 {integer value too large to represent}} +} +test expr-32.26 {math functions in expressions} { + expr double(1) +} {1.0} +test expr-32.27 {math functions in expressions} { + expr double(1.1) +} {1.1} +test expr-32.28 {math functions in expressions} { + expr int(1) +} {1} +test expr-32.29 {math functions in expressions} { + expr int(1.4) +} {1} +test expr-32.30 {math functions in expressions} { + expr int(1.6) +} {1} +test expr-32.31 {math functions in expressions} { + expr int(-1.4) +} {-1} +test expr-32.32 {math functions in expressions} { + expr int(-1.6) +} {-1} +test expr-32.33 {math functions in expressions} { + list [catch {expr int(1e60)} msg] $msg +} {1 {integer value too large to represent}} +test expr-32.34 {math functions in expressions} { + list [catch {expr int(-1e60)} msg] $msg +} {1 {integer value too large to represent}} +test expr-32.35 {math functions in expressions} { + expr round(1.49) +} {1} +test expr-32.36 {math functions in expressions} { + expr round(1.51) +} {2} +test expr-32.37 {math functions in expressions} { + expr round(-1.49) +} {-1} +test expr-32.38 {math functions in expressions} { + expr round(-1.51) +} {-2} +test expr-32.39 {math functions in expressions} { + list [catch {expr round(1e60)} msg] $msg +} {1 {integer value too large to represent}} +test expr-32.40 {math functions in expressions} { + list [catch {expr round(-1e60)} msg] $msg +} {1 {integer value too large to represent}} +test expr-32.41 {math functions in expressions} { + list [catch {expr pow(1.0 + 3.0 - 2, .8 * 5)} msg] $msg +} {0 16.0} +test expr-32.42 {math functions in expressions} { + list [catch {expr hypot(5*.8,3)} msg] $msg +} {0 5.0} +if $gotT1 { + test expr-32.43 {math functions in expressions} { + expr 2*T1() + } 246 + test expr-32.44 {math functions in expressions} { + expr T2()*3 + } 1035 +} + +test expr-33.1 {conversions and fancy args to math functions} { + expr hypot ( 3 , 4 ) +} 5.0 +test expr-33.2 {conversions and fancy args to math functions} { + expr hypot ( (2.0+1.0) , 4 ) +} 5.0 +test expr-33.3 {conversions and fancy args to math functions} { + expr hypot ( 3 , (3.0 + 1.0) ) +} 5.0 +test expr-33.4 {conversions and fancy args to math functions} { + expr cos(acos(0.1)) +} 0.1 + +test expr-34.1 {errors in math functions} { + list [catch {expr func_2(1.0)} msg] $msg +} {1 {unknown math function "func_2"}} +test expr-34.2 {errors in math functions} { + list [catch {expr func|(1.0)} msg] $msg +} {1 {syntax error in expression "func|(1.0)"}} +test expr-34.3 {errors in math functions} { + list [catch {expr {hypot("a b", 2.0)}} msg] $msg +} {1 {argument to math function didn't have numeric value}} +test expr-34.4 {errors in math functions} { + list [catch {expr hypot(1.0 2.0)} msg] $msg +} {1 {syntax error in expression "hypot(1.0 2.0)"}} +test expr-34.5 {errors in math functions} { + list [catch {expr hypot(1.0, 2.0} msg] $msg +} {1 {syntax error in expression "hypot(1.0, 2.0"}} +test expr-34.6 {errors in math functions} { + list [catch {expr hypot(1.0 ,} msg] $msg +} {1 {syntax error in expression "hypot(1.0 ,"}} +test expr-34.7 {errors in math functions} { + list [catch {expr hypot(1.0)} msg] $msg +} {1 {too few arguments for math function}} +test expr-34.8 {errors in math functions} { + list [catch {expr hypot(1.0, 2.0, 3.0)} msg] $msg +} {1 {too many arguments for math function}} +test expr-34.9 {errors in math functions} { + list [catch {expr acos(-2.0)} msg] $msg $errorCode +} {1 {domain error: argument not in valid range} {ARITH DOMAIN {domain error: argument not in valid range}}} +if $atBerkeley { + test expr-34.10 {errors in math functions} { + list [catch {expr pow(-3, 1000001)} msg] $msg $errorCode + } {1 {floating-point value too large to represent} {ARITH OVERFLOW {floating-point value too large to represent}}} +} +test expr-34.11 {errors in math functions} { + list [catch {expr pow(3, 1000001)} msg] $msg $errorCode +} {1 {floating-point value too large to represent} {ARITH OVERFLOW {floating-point value too large to represent}}} +test expr-34.12 {errors in math functions} { + list [catch {expr -14.0*exp(100000)} msg] $msg $errorCode +} {1 {floating-point value too large to represent} {ARITH OVERFLOW {floating-point value too large to represent}}} +test expr-34.13 {errors in math functions} { + list [catch {expr int(1.0e30)} msg] $msg $errorCode +} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}} +test expr-34.14 {errors in math functions} { + list [catch {expr int(-1.0e30)} msg] $msg $errorCode +} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}} +test expr-34.15 {errors in math functions} { + list [catch {expr round(1.0e30)} msg] $msg $errorCode +} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}} +test expr-34.16 {errors in math functions} { + list [catch {expr round(-1.0e30)} msg] $msg $errorCode +} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}} +if $gotT1 { + test expr-34.17 {errors in math functions} { + list [catch {expr T1(4)} msg] $msg + } {1 {syntax error in expression "T1(4)"}} +} + +catch {unset tcl_precision} +test expr-35.1 {tcl_precision variable} { + expr 2.0/3 +} 0.666667 +set tcl_precision 1 +test expr-35.2 {tcl_precision variable} { + expr 2.0/3 +} 0.7 +test expr-35.3 {tcl_precision variable} { + expr 2.0/3 +} 0.7 +test expr-35.4 {tcl_precision variable} { + list [catch {set tcl_precision 0} msg] $msg [expr 2.0/3] +} {1 {can't set "tcl_precision": improper value for precision} 0.7} +test expr-35.5 {tcl_precision variable} { + list [catch {set tcl_precision 101} msg] $msg [expr 2.0/3] +} {1 {can't set "tcl_precision": improper value for precision} 0.7} +test expr-35.6 {tcl_precision variable} { + list [catch {set tcl_precision {}} msg] $msg [expr 2.0/3] +} {1 {can't set "tcl_precision": improper value for precision} 0.7} +test expr-35.7 {tcl_precision variable} { + list [catch {set tcl_precision {1 2 3}} msg] $msg [expr 2.0/3] +} {1 {can't set "tcl_precision": improper value for precision} 0.7} +catch {unset tcl_precision} +test expr-35.8 {tcl_precision variable} { + expr 2.0/3 +} 0.666667 diff --git a/vendor/x11iraf/obm/Tcl/tests/file.test b/vendor/x11iraf/obm/Tcl/tests/file.test new file mode 100644 index 00000000..83603342 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/file.test @@ -0,0 +1,326 @@ +# Commands covered: file +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/file.test,v 1.22 93/04/16 16:46:42 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# rootname and ext + +test file-1.1 {rootname and extension options} {file ext abc.def} .def +test file-1.2 {rootname and extension options} {file ro abc.def} abc +test file-1.3 {rootname and extension options} {file extension a/b/c.d} .d +test file-1.4 {rootname and extension options} {file rootname a/b/c.d} a/b/c +test file-1.5 {rootname and extension options} {file extension a/b.c/d} {} +test file-1.6 {rootname and extension options} {file rootname a/b.c/d} a/b.c/d +set num 7 +foreach outer { {} a .a a. a.a } { + foreach inner { {} a .a a. a.a } { + set thing [format %s/%s $outer $inner] + test file-1.$num {rootname and extension options} { + format %s%s [file rootname $thing] [file ext $thing] + } $thing + set num [expr $num+1] + } +} + +# dirname and tail + +test file-2.1 {dirname and tail options} {file dirname .def} . +test file-2.2 {dirname and tail options} {file tail abc.def} abc.def +test file-2.3 {dirname and tail options} {file d a/b/c.d} a/b +test file-2.4 {dirname and tail options} {file ta a/b/c.d} c.d +test file-2.5 {dirname and tail options} {file dirname a/b.c/d} a/b.c +test file-2.6 {dirname and tail options} {file tail a/b.c/d} d +set num 7 +foreach outer { a .a a. a.a } { + foreach inner { {} a .a a. a.a } { + set thing [format %s/%s $outer $inner] + test file-2.$num {dirname and tail options} { + format %s/%s [file dirname $thing] [file tail $thing] + } $thing + set num [expr $num+1] + } +} + +# exists + +catch {exec chmod 777 dir.file} +catch {exec rm -f dir.file/gorp.file} +catch {exec rm -f gorp.file} +catch {exec rmdir dir.file} +catch {exec rm -f link.file} +test file-3.1 {exists option} {file exists gorp.file} 0 +test file-3.2 {exists option} {file exists dir.file/gorp.file} 0 +exec cat > gorp.file << abcde +exec mkdir dir.file +exec cat > dir.file/gorp.file << 12345 +test file-3.3 {exists option} {file exists gorp.file} 1 +test file-3.4 {exists option} {file exi dir.file/gorp.file} 1 + +# The test below has to be done in /tmp rather than the current +# directory in order to guarantee (?) a local file system: some +# NFS file systems won't do the stuff below correctly. + +catch {exec rm /tmp/tcl.foo.dir/file} +catch {exec rmdir /tmp/tcl.foo.dir} +exec mkdir /tmp/tcl.foo.dir +exec cat > /tmp/tcl.foo.dir/file << 12345 +exec chmod 000 /tmp/tcl.foo.dir +if {$user != "root"} { + test file-3.5 {exists option} {file exists /tmp/tcl.foo.dir/file} 0 +} +exec chmod 775 /tmp/tcl.foo.dir +exec rm /tmp/tcl.foo.dir/file +exec rmdir /tmp/tcl.foo.dir + +# executable + +exec chmod 000 dir.file +if {$user != "root"} { + test file-4.1 {executable option} {file executable gorp.file} 0 +} +exec chmod 775 gorp.file +test file-4.2 {executable option} {file exe gorp.file} 1 + +# isdirectory + +test file-5.1 {isdirectory option} {file isdirectory gorp.file} 0 +test file-5.2 {isdirectory option} {file isd dir.file} 1 + +# isfile + +test file-6.1 {isfile option} {file isfile gorp.file} 1 +test file-6.2 {isfile option} {file isfile dir.file} 0 + +# isowned + +test file-7.1 {owned option} {file owned gorp.file} 1 +if {$user != "root"} { + test file-7.2 {owned option} {file owned /} 0 +} + +# readable + +exec chmod 444 gorp.file +test file-8.1 {readable option} {file readable gorp.file} 1 +exec chmod 333 gorp.file +if {$user != "root"} { + test file-8.2 {readable option} {file reada gorp.file} 0 +} + +# writable + +exec chmod 555 gorp.file +if {$user != "root"} { + test file-9.1 {writable option} {file writable gorp.file} 0 +} +exec chmod 222 gorp.file +test file-9.2 {writable option} {file w gorp.file} 1 + +# stat + +exec cat > gorp.file << "Test string" +exec chmod 765 gorp.file +test file-10.1 {stat option} { + catch {unset stat} + file stat gorp.file stat + lsort [array names stat] +} {atime ctime dev gid ino mode mtime nlink size type uid} +test file-10.2 {stat option} { + catch {unset stat} + file stat gorp.file stat + list $stat(nlink) $stat(size) [expr $stat(mode)&0777] $stat(type) +} {1 11 501 file} +test file-10.3 {stat option} { + string tolower [list [catch {file stat _bogus_ stat} msg] \ + $msg $errorCode] +} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}} +test file-10.4 {stat option} { + list [catch {file stat _bogus_} msg] $msg $errorCode +} {1 {wrong # args: should be "file stat name varName"} NONE} +test file-10.5 {stat option} { + list [catch {file stat _bogus_ a b} msg] $msg $errorCode +} {1 {wrong # args: should be "file stat name varName"} NONE} +test file-10.6 {stat option} { + catch {unset x} + set x 44 + list [catch {file stat gorp.file x} msg] $msg $errorCode +} {1 {can't set "x(dev)": variable isn't array} NONE} +catch {unset stat} + +# mtime, and size (I've given up trying to find a test for "atime": there +# seem to be too many quirks in the way file systems handle this to come +# up with a reproducible test). + +test file-11.1 {mtime and atime and size options} { + catch {unset stat} + file stat gorp.file stat + list [expr {[file mtime gorp.file] == $stat(mtime)}] \ + [expr {[file atime gorp.file] == $stat(atime)}] \ + [file size gorp.file] +} {1 1 11} +test file-11.2 {mtime option} { + set old [file mtime gorp.file] + exec sleep 2 + set f [open gorp.file w] + puts $f "More text" + close $f + set new [file mtime gorp.file] + expr {($new > $old) && ($new <= ($old+5))} +} {1} +test file-11.3 {size option} { + set oldsize [file size gorp.file] + set f [open gorp.file a] + puts $f "More text" + close $f + expr {[file size gorp.file] - $oldsize} +} {10} +test file-11.4 {errors in atime option} { + list [catch {file atime _bogus_ x} msg] $msg $errorCode +} {1 {wrong # args: should be "file atime name"} NONE} +test file-11.5 {errors in atime option} { + string tolower [list [catch {file atime _bogus_} msg] \ + $msg $errorCode] +} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}} +test file-11.6 {errors in mtime option} { + list [catch {file mtime _bogus_ x} msg] $msg $errorCode +} {1 {wrong # args: should be "file mtime name"} NONE} +test file-11.7 {errors in mtime option} { + string tolower [list [catch {file mtime _bogus_} msg] $msg \ + $errorCode] +} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}} +test file-11.8 {errors in size option} { + list [catch {file size _bogus_ x} msg] $msg $errorCode +} {1 {wrong # args: should be "file size name"} NONE} +test file-11.9 {errors in size option} { + string tolower [list [catch {file size _bogus_} msg] $msg \ + $errorCode] +} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}} + +# type + +test file-12.1 {type option} { + file type dir.file +} directory +test file-12.2 {type option} { + file type gorp.file +} file +if $atBerkeley { + exec ln -s a/b/c link.file + test file-12.3 {type option} { + file type link.file + } link + exec rm link.file +} +test file-12.4 {errors in type option} { + list [catch {file type a b} msg] $msg $errorCode +} {1 {wrong # args: should be "file type name"} NONE} +test file-12.5 {errors in type option} { + string tolower [list [catch {file type _bogus_} msg] $msg $errorCode] +} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}} + +# lstat and readlink: run these tests only at Berkeley, since not all +# sites will have symbolic links + +if $atBerkeley { + exec ln -s gorp.file link.file + test file-13.1 {lstat option} { + catch {unset stat} + file lstat link.file stat + lsort [array names stat] + } {atime ctime dev gid ino mode mtime nlink size type uid} + test file-13.1 {lstat option} { + catch {unset stat} + file lstat link.file stat + list $stat(nlink) [expr $stat(mode)&0777] $stat(type) + } {1 511 link} + test file-13.3 {errors in lstat option} { + string tolower [list [catch {file lstat _bogus_ stat} msg] \ + $msg $errorCode] + } {1 {couldn't lstat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}} + test file-13.4 {errors in lstat option} { + list [catch {file lstat _bogus_} msg] $msg $errorCode + } {1 {wrong # args: should be "file lstat name varName"} NONE} + test file-13.5 {errors in lstat option} { + list [catch {file lstat _bogus_ a b} msg] $msg $errorCode + } {1 {wrong # args: should be "file lstat name varName"} NONE} + test file-13.6 {errors in lstat option} { + catch {unset x} + set x 44 + list [catch {file lstat gorp.file x} msg] $msg $errorCode + } {1 {can't set "x(dev)": variable isn't array} NONE} + catch {unset stat} + + test file-14.1 {readlink option} { + file readlink link.file + } gorp.file + test file-14.2 {errors in readlink option} { + list [catch {file readlink a b} msg] $msg $errorCode + } {1 {wrong # args: should be "file readlink name"} NONE} + test file-14.3 {errors in readlink option} { + list [catch {file readlink _bogus_} msg] $msg $errorCode + } {1 {couldn't readlink "_bogus_": no such file or directory} {POSIX ENOENT {no such file or directory}}} + + exec rm link.file +} + +# Error conditions + +test file-15.1 {error conditions} { + list [catch file msg] $msg +} {1 {wrong # args: should be "file option name ?arg ...?"}} +test file-15.2 {error conditions} { + list [catch {file x} msg] $msg +} {1 {wrong # args: should be "file option name ?arg ...?"}} +test file-15.3 {error conditions} { + list [catch {file exists x too} msg] $msg +} {1 {wrong # args: should be "file exists name"}} +test file-15.4 {error conditions} { + list [catch {file gorp x} msg] $msg +} {1 {bad option "gorp": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}} +test file-15.5 {error conditions} { + list [catch {file ex x} msg] $msg +} {1 {bad option "ex": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}} +test file-15.6 {error conditions} { + list [catch {file is x} msg] $msg +} {1 {bad option "is": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}} +test file-15.7 {error conditions} { + list [catch {file read x} msg] $msg +} {1 {bad option "read": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}} +test file-15.8 {error conditions} { + list [catch {file s x} msg] $msg +} {1 {bad option "s": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}} +test file-15.9 {error conditions} { + list [catch {file t x} msg] $msg +} {1 {bad option "t": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}} +test file-15.10 {error conditions} { + list [catch {file rootname ~woohgy} msg] $msg +} {1 {user "woohgy" doesn't exist}} + +exec chmod 777 dir.file +exec rm dir.file/gorp.file gorp.file +exec rmdir dir.file diff --git a/vendor/x11iraf/obm/Tcl/tests/for.test b/vendor/x11iraf/obm/Tcl/tests/for.test new file mode 100644 index 00000000..2fafcc5a --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/for.test @@ -0,0 +1,169 @@ +# Commands covered: foreach, for, continue, break +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/for.test,v 1.8 93/02/06 15:54:05 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# Basic "foreach" operation. + +test for-1.1 {basic foreach tests} { + set a {} + foreach i {a b c d} { + set a [concat $a $i] + } + set a +} {a b c d} +test for-1.2 {basic foreach tests} { + set a {} + foreach i {a b {{c d} e} {123 {{x}}}} { + set a [concat $a $i] + } + set a +} {a b {c d} e 123 {{x}}} +test for-1.3 {basic foreach tests} {catch {foreach} msg} 1 +test for-1.4 {basic foreach tests} { + catch {foreach} msg + set msg +} {wrong # args: should be "foreach varName list command"} +test for-1.5 {basic foreach tests} {catch {foreach i} msg} 1 +test for-1.6 {basic foreach tests} { + catch {foreach i} msg + set msg +} {wrong # args: should be "foreach varName list command"} +test for-1.7 {basic foreach tests} {catch {foreach i j} msg} 1 +test for-1.8 {basic foreach tests} { + catch {foreach i j} msg + set msg +} {wrong # args: should be "foreach varName list command"} +test for-1.9 {basic foreach tests} {catch {foreach i j k l} msg} 1 +test for-1.10 {basic foreach tests} { + catch {foreach i j k l} msg + set msg +} {wrong # args: should be "foreach varName list command"} +test for-1.11 {basic foreach tests} { + set a {} + foreach i {} { + set a [concat $a $i] + } + set a +} {} +test for-1.11 {foreach errors} { + catch {unset a} + set a(0) 44 + list [catch {foreach a {1 2 3} {}} msg] $msg +} {1 {couldn't set loop variable}} +catch {unset a} + +# Check "continue". + +test for-2.1 {continue tests} {catch continue} 4 +test for-2.2 {continue tests} { + set a {} + foreach i {a b c d} { + if {[string compare $i "b"] == 0} continue + set a [concat $a $i] + } + set a +} {a c d} +test for-2.3 {continue tests} { + set a {} + foreach i {a b c d} { + if {[string compare $i "b"] != 0} continue + set a [concat $a $i] + } + set a +} {b} +test for-2.4 {continue tests} {catch {continue foo} msg} 1 +test for-2.5 {continue tests} { + catch {continue foo} msg + set msg +} {wrong # args: should be "continue"} + +# Check "break". + +test for-3.1 {break tests} {catch break} 3 +test for-3.2 {break tests} { + set a {} + foreach i {a b c d} { + if {[string compare $i "c"] == 0} break + set a [concat $a $i] + } + set a +} {a b} +test for-3.3 {break tests} {catch {break foo} msg} 1 +test for-3.4 {break tests} { + catch {break foo} msg + set msg +} {wrong # args: should be "break"} + +# Check "for" and its use of continue and break. + +test for-4.1 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]} { + set a [concat $a $i] + } + set a +} {1 2 3 4 5} +test for-4.2 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]} { + if $i==4 continue + set a [concat $a $i] + } + set a +} {1 2 3 5} +test for-4.3 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]} { + if $i==4 break + set a [concat $a $i] + } + set a +} {1 2 3} +test for-4.4 {for tests} {catch {for 1 2 3} msg} 1 +test for-4.5 {for tests} { + catch {for 1 2 3} msg + set msg +} {wrong # args: should be "for start test next command"} +test for-4.6 {for tests} {catch {for 1 2 3 4 5} msg} 1 +test for-4.7 {for tests} { + catch {for 1 2 3 4 5} msg + set msg +} {wrong # args: should be "for start test next command"} +test for-4.8 {for tests} { + set a {xyz} + for {set i 1} {$i<6} {set i [expr $i+1]} {} + set a +} xyz +test for-4.9 {for tests} { + set a {} + for {set i 1} {$i<6} {set i [expr $i+1]; if $i==4 break} { + set a [concat $a $i] + } + set a +} {1 2 3} diff --git a/vendor/x11iraf/obm/Tcl/tests/format.test b/vendor/x11iraf/obm/Tcl/tests/format.test new file mode 100644 index 00000000..e31ba501 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/format.test @@ -0,0 +1,379 @@ +# Commands covered: format +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/format.test,v 1.16 93/07/17 15:25:01 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# The following code is needed because some versions of SCO Unix have +# a round-off error in sprintf which would cause some of the tests to +# fail. Someday I hope this code shouldn't be necessary (code added +# 9/9/91). + +set roundOffBug 0 +if {"[format %7.1e 68.514]" == "6.8e+01"} { + puts stdout "Note: this system has a sprintf round-off bug, some tests skipped\n" + set roundOffBug 1 +} + +test format-1.1 {integer formatting} { + format "%*d %d %d %d" 6 34 16923 -12 -1 +} { 34 16923 -12 -1} +if $atBerkeley { + test format-1.2 {integer formatting} { + format "%4d %4d %4d %4d %d %#x %#X" 6 34 16923 -12 -1 0 0 + } { 6 34 16923 -12 -1 0 0} +} + +# %u output depends on word length, so don't run these tests except +# at Berkeley, where word length is known. + +if $atBerkeley { + test format-1.3 {integer formatting} { + format "%4u %4u %4u %4u %d %#o" 6 34 16923 -12 -1 0 + } { 6 34 16923 4294967284 -1 0} +} +test format-1.4 {integer formatting} { + format "%-4d %-4i %-4d %-4ld" 6 34 16923 -12 -1 +} {6 34 16923 -12 } +test format-1.5 {integer formatting} { + format "%04d %04d %04d %04i" 6 34 16923 -12 -1 +} {0006 0034 16923 -012} +test format-1.6 {integer formatting} { + format "%00*d" 6 34 +} {000034} + +# Printing negative numbers in hex or octal format depends on word +# length; only run at Berkeley where word length is known. + +if $atBerkeley { + test format-1.7 {integer formatting} { + format "%4x %4x %4x %4x" 6 34 16923 -12 -1 + } { 6 22 421b fffffff4} + test format-1.8 {integer formatting} { + format "%#x %#X %#X %#x" 6 34 16923 -12 -1 + } {0x6 0X22 0X421B 0xfffffff4} + test format-1.9 {integer formatting} { + format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1 + } { 0x6 0x22 0x421b 0xfffffff4} + test format-1.10 {integer formatting} { + format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1 + } {0x6 0x22 0x421b 0xfffffff4 } + test format-1.11 {integer formatting} { + format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1 + } {06 042 041033 037777777764 } +} + +test format-2.1 {string formatting} { + format "%s %s %c %s" abcd {This is a very long test string.} 120 x +} {abcd This is a very long test string. x x} +test format-2.2 {string formatting} { + format "%20s %20s %20c %20s" abcd {This is a very long test string.} 120 x +} { abcd This is a very long test string. x x} +test format-2.3 {string formatting} { + format "%.10s %.10s %c %.10s" abcd {This is a very long test string.} 120 x +} {abcd This is a x x} +test format-2.4 {string formatting} { + format "%s %s %% %c %s" abcd {This is a very long test string.} 120 x +} {abcd This is a very long test string. % x x} + +test format-3.1 {e and f formats} { + format "%e %e %e %e" 34.2e12 68.514 -.125 -16000. .000053 +} {3.420000e+13 6.851400e+01 -1.250000e-01 -1.600000e+04} +test format-3.2 {e and f formats} { + format "%20e %20e %20e %20e" 34.2e12 68.514 -.125 -16000. .000053 +} { 3.420000e+13 6.851400e+01 -1.250000e-01 -1.600000e+04} +if {!$roundOffBug} { + test format-3.3 {e and f formats} { + format "%.1e %.1e %.1e %.1e" 34.2e12 68.514 -.126 -16000. .000053 + } {3.4e+13 6.9e+01 -1.3e-01 -1.6e+04} + test format-3.4 {e and f formats} { + format "%020e %020e %020e %020e" 34.2e12 68.514 -.126 -16000. .000053 + } {000000003.420000e+13 000000006.851400e+01 -00000001.260000e-01 -00000001.600000e+04} + test format-3.5 {e and f formats} { + format "%7.1e %7.1e %7.1e %7.1e" 34.2e12 68.514 -.126 -16000. .000053 + } {3.4e+13 6.9e+01 -1.3e-01 -1.6e+04} + test format-3.6 {e and f formats} { + format "%f %f %f %f" 34.2e12 68.514 -.125 -16000. .000053 + } {34200000000000.000000 68.514000 -0.125000 -16000.000000} +} +test format-3.7 {e and f formats} { + format "%.4f %.4f %.4f %.4f %.4f" 34.2e12 68.514 -.125 -16000. .000053 +} {34200000000000.0000 68.5140 -0.1250 -16000.0000 0.0001} +test format-3.8 {e and f formats} { + format "%.4e %.5e %.6e" -9.99996 -9.99996 9.99996 +} {-1.0000e+01 -9.99996e+00 9.999960e+00} +test format-3.9 {e and f formats} { + format "%.4f %.5f %.6f" -9.99996 -9.99996 9.99996 +} {-10.0000 -9.99996 9.999960} +test format-3.10 {e and f formats} { + format "%20f %-20f %020f" -9.99996 -9.99996 9.99996 +} { -9.999960 -9.999960 0000000000009.999960} +test format-3.11 {e and f formats} { + format "%-020f %020f" -9.99996 -9.99996 9.99996 +} {-9.999960 -000000000009.999960} +test format-3.12 {e and f formats} { + format "%.0e %#.0e" -9.99996 -9.99996 9.99996 +} {-1e+01 -1.e+01} +test format-3.13 {e and f formats} { + format "%.0f %#.0f" -9.99996 -9.99996 9.99996 +} {-10 -10.} +test format-3.14 {e and f formats} { + format "%.4f %.5f %.6f" -9.99996 -9.99996 9.99996 +} {-10.0000 -9.99996 9.999960} +test format-3.15 {e and f formats} { + format "%3.0f %3.0f %3.0f %3.0f" 1.0 1.1 1.01 1.001 +} { 1 1 1 1} +test format-3.16 {e and f formats} { + format "%3.1f %3.1f %3.1f %3.1f" 0.0 0.1 0.01 0.001 +} {0.0 0.1 0.0 0.0} + +test format-4.1 {g-format} { + format "%.3g" 12341.0 +} {1.23e+04} +test format-4.2 {g-format} { + format "%.3G" 1234.12345 +} {1.23E+03} +test format-4.3 {g-format} { + format "%.3g" 123.412345 +} {123} +test format-4.4 {g-format} { + format "%.3g" 12.3412345 +} {12.3} +test format-4.5 {g-format} { + format "%.3g" 1.23412345 +} {1.23} +test format-4.6 {g-format} { + format "%.3g" 1.23412345 +} {1.23} +test format-4.7 {g-format} { + format "%.3g" .123412345 +} {0.123} +test format-4.8 {g-format} { + format "%.3g" .012341 +} {0.0123} +test format-4.9 {g-format} { + format "%.3g" .0012341 +} {0.00123} +test format-4.10 {g-format} { + format "%.3g" .00012341 +} {0.000123} +test format-4.11 {g-format} { + format "%.3g" .00001234 +} {1.23e-05} +test format-4.12 {g-format} { + format "%.4g" 9999.6 +} {1e+04} +test format-4.13 {g-format} { + format "%.4g" 999.96 +} {1000} +test format-4.14 {g-format} { + format "%.3g" 1.0 +} {1} +test format-4.15 {g-format} { + format "%.3g" .1 +} {0.1} +test format-4.16 {g-format} { + format "%.3g" .01 +} {0.01} +test format-4.17 {g-format} { + format "%.3g" .001 +} {0.001} +test format-4.19 {g-format} { + format "%.3g" .00001 +} {1e-05} +test format-4.20 {g-format} { + format "%#.3g" 1234.0 +} {1.23e+03} +test format-4.21 {g-format} { + format "%#.3G" 9999.5 +} {1.00E+04} + +test format-5.1 {floating-point zeroes} { + format "%e %f %g" 0.0 0.0 0.0 0.0 +} {0.000000e+00 0.000000 0} +test format-5.2 {floating-point zeroes} { + format "%.4e %.4f %.4g" 0.0 0.0 0.0 0.0 +} {0.0000e+00 0.0000 0} +test format-5.3 {floating-point zeroes} { + format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0 +} {0.0000e+00 0.0000 0.000} +test format-5.4 {floating-point zeroes} { + format "%.0e %.0f %.0g" 0.0 0.0 0.0 0.0 +} {0e+00 0 0} +test format-5.5 {floating-point zeroes} { + format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0 +} {0.e+00 0. 0.} +test format-5.6 {floating-point zeroes} { + format "%3.0f %3.0f %3.0f %3.0f" 0.0 0.0 0.0 0.0 +} { 0 0 0 0} +test format-5.7 {floating-point zeroes} { + format "%3.0f %3.0f %3.0f %3.0f" 1.0 1.1 1.01 1.001 +} { 1 1 1 1} +test format-5.8 {floating-point zeroes} { + format "%3.1f %3.1f %3.1f %3.1f" 0.0 0.1 0.01 0.001 +} {0.0 0.1 0.0 0.0} + +test format-6.1 {various syntax features} { + format "%*.*f" 12 3 12.345678901 +} { 12.346} +test format-6.2 {various syntax features} { + format "%0*.*f" 12 3 12.345678901 +} {00000012.346} +test format-6.3 {various syntax features} { + format "\*\t\\n" +} {* \n} + +test format-7.1 {error conditions} { + catch format +} 1 +test format-7.2 {error conditions} { + catch format msg + set msg +} {wrong # args: should be "format formatString ?arg arg ...?"} +test format-7.3 {error conditions} { + catch {format %*d} +} 1 +test format-7.4 {error conditions} { + catch {format %*d} msg + set msg +} {not enough arguments for all format specifiers} +test format-7.5 {error conditions} { + catch {format %*.*f 12} +} 1 +test format-7.6 {error conditions} { + catch {format %*.*f 12} msg + set msg +} {not enough arguments for all format specifiers} +test format-7.7 {error conditions} { + catch {format %*.*f 12 3} +} 1 +test format-7.8 {error conditions} { + catch {format %*.*f 12 3} msg + set msg +} {not enough arguments for all format specifiers} +test format-7.9 {error conditions} { + list [catch {format %*d x 3} msg] $msg +} {1 {expected integer but got "x"}} +test format-7.10 {error conditions} { + list [catch {format %*.*f 2 xyz 3} msg] $msg +} {1 {expected integer but got "xyz"}} +test format-7.11 {error conditions} { + catch {format %d 2a} +} 1 +test format-7.12 {error conditions} { + catch {format %d 2a} msg + set msg +} {expected integer but got "2a"} +test format-7.13 {error conditions} { + catch {format %c 2x} +} 1 +test format-7.14 {error conditions} { + catch {format %c 2x} msg + set msg +} {expected integer but got "2x"} +test format-7.15 {error conditions} { + catch {format %f 2.1z} +} 1 +test format-7.16 {error conditions} { + catch {format %f 2.1z} msg + set msg +} {expected floating-point number but got "2.1z"} +test format-7.17 {error conditions} { + catch {format ab%} +} 1 +test format-7.18 {error conditions} { + catch {format ab% 12} msg + set msg +} {format string ended in middle of field specifier} +test format-7.19 {error conditions} { + catch {format %q x} +} 1 +test format-7.20 {error conditions} { + catch {format %q x} msg + set msg +} {bad field specifier "q"} +test format-7.21 {error conditions} { + catch {format %d} +} 1 +test format-7.22 {error conditions} { + catch {format %d} msg + set msg +} {not enough arguments for all format specifiers} + +test format-8.1 {long result} { + set a {1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} + format {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG %s %s %s} $a $a $a +} {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} + +if $atBerkeley { + test format-9.1 {"h" format specifier} { + format %hd 0xffff + } -1 + test format-9.2 {"h" format specifier} { + format %hx 0x10fff + } fff + test format-9.3 {"h" format specifier} { + format %hd 0x10000 + } 0 +} + +test format-10.1 {XPG3 %$n specifiers} { + format {%2$d %1$d} 4 5 +} {5 4} +test format-10.2 {XPG3 %$n specifiers} { + format {%2$d %1$d %1$d %3$d} 4 5 6 +} {5 4 4 6} +test format-10.3 {XPG3 %$n specifiers} { + list [catch {format {%2$d %3$d} 4 5} msg] $msg +} {1 {"%n$" argument index out of range}} +test format-10.4 {XPG3 %$n specifiers} { + list [catch {format {%2$d %0$d} 4 5 6} msg] $msg +} {1 {"%n$" argument index out of range}} +test format-10.5 {XPG3 %$n specifiers} { + list [catch {format {%d %1$d} 4 5 6} msg] $msg +} {1 {cannot mix "%" and "%n$" conversion specifiers}} +test format-10.6 {XPG3 %$n specifiers} { + list [catch {format {%2$d %d} 4 5 6} msg] $msg +} {1 {cannot mix "%" and "%n$" conversion specifiers}} +test format-10.7 {XPG3 %$n specifiers} { + list [catch {format {%2$d %3d} 4 5 6} msg] $msg +} {1 {cannot mix "%" and "%n$" conversion specifiers}} +test format-10.8 {XPG3 %$n specifiers} { + format {%2$*d %3$d} 1 10 4 +} { 4 4} +test format-10.9 {XPG3 %$n specifiers} { + format {%2$.*s %4$d} 1 5 abcdefghijklmnop 44 +} {abcde 44} +test format-10.10 {XPG3 %$n specifiers} { + list [catch {format {%2$*d} 4} msg] $msg +} {1 {"%n$" argument index out of range}} +test format-10.11 {XPG3 %$n specifiers} { + list [catch {format {%2$*d} 4 5} msg] $msg +} {1 {"%n$" argument index out of range}} +test format-10.12 {XPG3 %$n specifiers} { + list [catch {format {%2$*d} 4 5 6} msg] $msg +} {0 { 6}} diff --git a/vendor/x11iraf/obm/Tcl/tests/glob.test b/vendor/x11iraf/obm/Tcl/tests/glob.test new file mode 100644 index 00000000..ba134ed8 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/glob.test @@ -0,0 +1,153 @@ +# Commands covered: glob +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/glob.test,v 1.23 93/08/28 15:57:40 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# First, create some subdirectories to use for testing. + +exec rm -rf globTest +exec mkdir globTest globTest/a1 globTest/a2 globTest/a3 +exec mkdir globTest/a1/b1 globTest/a1/b2 globTest/a2/b3 +exec cat << abc > globTest/x1.c +exec cat << abc > globTest/y1.c +exec cat << abc > globTest/z1.c +exec cat << abc > "globTest/weird name.c" +exec cat << abc > globTest/.1 +exec cat << abc > globTest/a1/b1/x2.c +exec cat << abc > globTest/a1/b2/y2.c + +test glob-1.1 {simple globbing} { + lsort [glob globTest/x1.c globTest/y1.c globTest/foo] +} {globTest/x1.c globTest/y1.c} +test glob-1.2 {simple globbing} { + glob {} +} . + +test glob-2.1 {globbing with braces} { + glob -nocomplain "{a1,a2}" +} {} +test glob-2.2 {globbing with braces} { + lsort [glob globTest/{a,b,x,y}1.c] +} {globTest/x1.c globTest/y1.c} +test glob-2.3 {globbing with braces} { + lsort [glob {globTest/{x1,y2,weird name}.c}] +} {{globTest/weird name.c} globTest/x1.c} +test glob-2.4 {globbing with braces} { + lsort [glob globTest/{x1.c,a1/*}] +} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c} + +test glob-3.1 {asterisks, question marks, and brackets} { + lsort [glob g*/*.c] +} {{globTest/weird name.c} globTest/x1.c globTest/y1.c globTest/z1.c} +test glob-3.2 {asterisks, question marks, and brackets} { + lsort [glob globTest/?1.c] +} {globTest/x1.c globTest/y1.c globTest/z1.c} +test glob-3.3 {asterisks, question marks, and brackets} { + lsort [glob */*/*/*.c] +} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c} +test glob-3.4 {asterisks, question marks, and brackets} { + lsort [glob globTest/*] +} {globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x1.c globTest/y1.c globTest/z1.c} +test glob-3.5 {asterisks, question marks, and brackets} { + lsort [glob globTest/.*] +} {globTest/. globTest/.. globTest/.1} +test glob-3.6 {asterisks, question marks, and brackets} { + lsort [glob globTest/*/*] +} {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3} +test glob-3.7 {asterisks, question marks, and brackets} { + lsort [glob {globTest/[xyab]1.*}] +} {globTest/x1.c globTest/y1.c} +test glob-3.8 {asterisks, question marks, and brackets} { + lsort [glob globTest/*/] +} {globTest/a1/ globTest/a2/ globTest/a3/} + +# The tests immediately below can only be run at Berkeley, where +# the file-system structure is well-known. + +if $atBerkeley { + test glob-4.1 {tildes} {glob ~/.csh*} "/users/ouster/.cshrc" + test glob-4.2 {tildes} {glob ~ouster/.csh*} "/users/ouster/.cshrc" +} + +test glob-5.1 {error conditions} { + list [catch {glob} msg] $msg +} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}} +test glob-5.2 {error conditions} { + list [catch {glob globTest/\{} msg] $msg +} {1 {unmatched open-brace in file name}} +test glob-5.3 {error conditions} { + list [catch {glob globTest/*/gorp} msg] $msg +} {1 {no files matched glob pattern "globTest/*/gorp"}} +test glob-5.4 {error conditions} { + list [catch {glob goo/* x*z foo?q} msg] $msg +} {1 {no files matched glob patterns "goo/* x*z foo?q"}} +test glob-5.5 {error conditions} { + list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg +} {0 {{globTest/weird name.c} globTest/x1.c globTest/y1.c globTest/z1.c}} +test glob-5.6 {error conditions} { + list [catch {glob ~no-one} msg] $msg +} {1 {user "no-one" doesn't exist}} +test glob-5.7 {error conditions} { + set home $env(HOME) + unset env(HOME) + set x [list [catch {glob ~/*} msg] $msg] + set env(HOME) $home + set x +} {1 {couldn't find HOME environment variable to expand "~/*"}} +test glob-5.8 {error conditions} { + list [catch {glob globTest/{a1,a2}/\{} msg] $msg +} {1 {unmatched open-brace in file name}} +test glob-5.9 {error conditions} { + list [catch {glob globTest/*/\{} msg] $msg +} {1 {unmatched open-brace in file name}} + +exec chmod 000 globTest +if {$user != "root"} { + test glob-6.1 {setting errorCode variable} { + string tolower [list [catch {glob globTest/*} msg] $msg $errorCode] + } {1 {couldn't read directory "globtest": permission denied} {posix eacces {permission denied}}} +} +exec chmod 755 globTest + +test glob-7.1 {-nocomplain switch} { + list [catch {glob -nocomplai} msg] $msg +} {1 {bad switch "-nocomplai": must be -nocomplain or --}} +test glob-7.2 {-nocomplain switch} { + list [catch {glob -nocomplain} msg] $msg +} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}} +test glob-7.3 {-nocomplain switch} { + list [catch {glob -nocomplain goo/*} msg] $msg +} {0 {}} +test glob-7.4 {-- switch} { + list [catch {glob -- -nocomplain} msg] $msg +} {1 {no files matched glob patterns "-nocomplain"}} +test glob-7.5 {bogus switch} { + list [catch {glob -gorp} msg] $msg +} {1 {bad switch "-gorp": must be -nocomplain or --}} + +exec rm -rf globTest diff --git a/vendor/x11iraf/obm/Tcl/tests/history.test b/vendor/x11iraf/obm/Tcl/tests/history.test new file mode 100644 index 00000000..56e337be --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/history.test @@ -0,0 +1,400 @@ +# Commands covered: history +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/history.test,v 1.8 93/02/06 15:53:54 ouster Exp $ (Berkeley) + +if {[info commands history] == ""} { + puts stdout "This version of Tcl was built without the history command;\n" + puts stdout "history tests will be skipped.\n" + return +} + +if {[string compare test [info procs test]] == 1} then {source defs} + +set num [history nextid] +history keep 3 +history add {set a 12345} +history add {set b [format {A test %s} string]} +history add {Another test} + +# "history event" + +test history-1.1 {event option} {history event -1} \ + {set b [format {A test %s} string]} +test history-1.2 {event option} {history event $num} \ + {set a 12345} +test history-1.3 {event option} {history event [expr $num+2]} \ + {Another test} +test history-1.4 {event option} {history event set} \ + {set b [format {A test %s} string]} +test history-1.5 {event option} {history e "* a*"} \ + {set a 12345} +test history-1.6 {event option} {catch {history event *gorp} msg} 1 +test history-1.7 {event option} { + catch {history event *gorp} msg + set msg +} {no event matches "*gorp"} +test history-1.8 {event option} {history event} \ + {set b [format {A test %s} string]} +test history-1.9 {event option} {catch {history event 123 456} msg} 1 +test history-1.10 {event option} { + catch {history event 123 456} msg + set msg +} {wrong # args: should be "history event ?event?"} + +# "history redo" + +set a 0 +history redo -2 +test history-2.1 {redo option} {set a} 12345 +set b 0 +history redo +test history-2.2 {redo option} {set b} {A test string} +test history-2.3 {redo option} {catch {history redo -3 -4}} 1 +test history-2.4 {redo option} { + catch {history redo -3 -4} msg + set msg +} {wrong # args: should be "history redo ?event?"} + +# "history add" + +history add "set a 444" exec +test history-3.1 {add option} {set a} 444 +test history-3.2 {add option} {catch {history add "set a 444" execGorp}} 1 +test history-3.3 {add option} { + catch {history add "set a 444" execGorp} msg + set msg +} {bad argument "execGorp": should be "exec"} +test history-3.4 {add option} {catch {history add "set a 444" a} msg} 1 +test history-3.5 {add option} { + catch {history add "set a 444" a} msg + set msg +} {bad argument "a": should be "exec"} +history add "set a 555" e +test history-3.6 {add option} {set a} 555 +history add "set a 666" +test history-3.7 {add option} {set a} 555 +test history-3.8 {add option} {catch {history add "set a 666" e f} msg} 1 +test history-3.9 {add option} { + catch {history add "set a 666" e f} msg + set msg +} {wrong # args: should be "history add event ?exec?"} + +# "history change" + +history change "A test value" +test history-4.1 {change option} {history event [expr {[history n]-1}]} \ + "A test value" +history c "Another test" -1 +test history-4.2 {change option} {history e} "Another test" +test history-4.3 {change option} {history event [expr {[history n]-1}]} \ + "A test value" +test history-4.4 {change option} {catch {history change Foo 4 10}} 1 +test history-4.5 {change option} { + catch {history change Foo 4 10} msg + set msg +} {wrong # args: should be "history change newValue ?event?"} +test history-4.6 {change option} { + catch {history change Foo [expr {[history n]-4}]} +} 1 +test history-4.7 {change option} { + catch {history change Foo [expr {[history n]-4}]} + set msg +} {wrong # args: should be "history change newValue ?event?"} + +# "history info" + +set num [history n] +history add set\ a\ {b\nc\ d\ e} +history add {set b 1234} +history add set\ c\ {a\nb\nc} +test history-5.1 {info option} {history info} [format {%6d set a {b + c d e} +%6d set b 1234 +%6d set c {a + b + c}} $num [expr $num+1] [expr $num+2]] +test history-5.2 {info option} {history i 2} [format {%6d set b 1234 +%6d set c {a + b + c}} [expr $num+1] [expr $num+2]] +test history-5.3 {info option} {catch {history i 2 3}} 1 +test history-5.4 {info option} { + catch {history i 2 3} msg + set msg +} {wrong # args: should be "history info ?count?"} +test history-5.5 {info option} {history} [format {%6d set a {b + c d e} +%6d set b 1234 +%6d set c {a + b + c}} $num [expr $num+1] [expr $num+2]] + +# "history keep" + +history add "foo1" +history add "foo2" +history add "foo3" +history keep 2 +test history-6.1 {keep option} {history event [expr [history n]-1]} foo3 +test history-6.2 {keep option} {history event -1} foo2 +test history-6.3 {keep option} {catch {history event -3}} 1 +test history-6.4 {keep option} { + catch {history event -3} msg + set msg +} {event "-3" is too far in the past} +history k 5 +test history-6.5 {keep option} {history event -1} foo2 +test history-6.6 {keep option} {history event -2} {} +test history-6.7 {keep option} {history event -3} {} +test history-6.8 {keep option} {history event -4} {} +test history-6.9 {keep option} {catch {history event -5}} 1 +test history-6.10 {keep option} {catch {history keep 4 6}} 1 +test history-6.11 {keep option} { + catch {history keep 4 6} msg + set msg +} {wrong # args: should be "history keep number"} +test history-6.12 {keep option} {catch {history keep}} 1 +test history-6.13 {keep option} { + catch {history keep} msg + set msg +} {wrong # args: should be "history keep number"} +test history-6.14 {keep option} {catch {history keep -3}} 1 +test history-6.15 {keep option} { + catch {history keep -3} msg + set msg +} {illegal keep count "-3"} + +# "history nextid" + +set num [history n] +history add "Testing" +history add "Testing2" +test history-7.1 {nextid option} {history event} "Testing" +test history-7.2 {nextid option} {history next} [expr $num+2] +test history-7.3 {nextid option} {catch {history nextid garbage}} 1 +test history-7.4 {nextid option} { + catch {history nextid garbage} msg + set msg +} {wrong # args: should be "history nextid"} + +# "history substitute" + +test history-8.1 {substitute option} { + history add "set a {test foo test b c test}" + history add "Test command 2" + set a 0 + history substitute foo bar -1 + set a +} {test bar test b c test} +test history-8.2 {substitute option} { + history add "set a {test foo test b c test}" + history add "Test command 2" + set a 0 + history substitute test gorp + set a +} {gorp foo gorp b c gorp} +test history-8.3 {substitute option} { + history add "set a {test foo test b c test}" + history add "Test command 2" + set a 0 + history sub " te" to + set a +} {test footost b ctost} +test history-8.4 {substitute option} {catch {history sub xxx yyy}} 1 +test history-8.5 {substitute option} { + catch {history sub xxx yyy} msg + set msg +} {"xxx" doesn't appear in event} +test history-8.6 {substitute option} {catch {history s a b -10}} 1 +test history-8.7 {substitute option} { + catch {history s a b -10} msg + set msg +} {event "-10" is too far in the past} +test history-8.8 {substitute option} {catch {history s a b -1 20}} 1 +test history-8.9 {substitute option} { + catch {history s a b -1 20} msg + set msg +} {wrong # args: should be "history substitute old new ?event?"} + +# "history words" + +test history-9.1 {words option} { + history add {word0 word1 word2 a b c word6} + history add foo + history words 0-$ +} {word0 word1 word2 a b c word6} +test history-9.2 {words option} { + history add {word0 word1 word2 a b c word6} + history add foo + history w 2 -1 +} word2 +test history-9.3 {words option} { + history add {word0 word1 word2 a b c word6} + history add foo + history wo $ +} word6 +test history-9.4 {words option} {catch {history w 1--1} msg} 1 +test history-9.5 {words option} { + catch {history w 1--1} msg + set msg +} {bad word selector "1--1": should be num-num or pattern} +test history-9.6 {words option} { + history add {word0 word1 word2 a b c word6} + history add foo + history w w +} {} +test history-9.7 {words option} { + history add {word0 word1 word2 a b c word6} + history add foo + history w *2 +} word2 +test history-9.8 {words option} { + history add {word0 word1 word2 a b c word6} + history add foo + history w *or* +} {word0 word1 word2 word6} +test history-9.9 {words option} {catch {history words 10}} 1 +test history-9.10 {words option} { + catch {history words 10} msg + set msg +} {word selector "10" specified non-existent words} +test history-9.11 {words option} {catch {history words 1 -1 20}} 1 +test history-9.12 {words option} { + catch {history words 1 -1 20} msg + set msg +} {wrong # args: should be "history words num-num/pat ?event?"} + +# history revision + +test history-10.1 {history revision} { + set a 0 + history a {set a 12345} + history a {set a [history e]} exec + set a +} {set a 12345} +test history-10.2 {history revision} { + set a 0 + history a {set a 12345} + history a {set a [history e]} exec + history a foo + history ev -1 +} {set a {set a 12345}} +test history-10.3 {history revision} { + set a 0 + history a {set a 12345} + history a {set a [history e]} exec + history a foo + history a {history r -2} exec + history a {set a 12345} + history ev -1 +} {set a {set a 12345}} +test history-10.4 {history revision} { + history a {set a 12345} + history a {history s 123 999} exec + history a foo + history ev -1 +} {set a 99945} +test history-10.5 {history revision} { + history add {word0 word1 word2 a b c word6} + history add {set [history w 3] [list [history w 0] [history w {[ab]}]]} exec + set a +} {word0 {a b}} +test history-10.6 {history revision} { + history add {word0 word1 word2 a b c word6} + history add {set [history w 3] [list [history w 0] [history w {[ab]}]]} exec + history add foo + history ev +} {set a [list word0 {a b}]} +test history-10.7 {history revision} { + history add {word0 word1 word2 a b c word6} + history add {set [history w 3] [list [history w 0] [history w {[ab]}]]} exec + history add {format b} + history add {word0 word1 word2 a b c word6} + set a 0 + history add {set [history subs b a -2] [list abc [history r -2] [history w 1-3]]} exec + history add foo + history ev +} {set [format a] [list abc [format b] {word1 word2 a}]} +test history-10.8 {history revision} { + history add {set a 12345} + concat a b c + history add {history redo; set b 44} exec + history add foo + history ev +} {set a 12345; set b 44} +test history-10.9 {history revision} { + history add {set a 12345} + history add {history redo; history change "A simple test"; history subs 45 xx} exec + set a +} 123xx +test history-10.10 {history revision} { + history add {set a 12345} + history add {history redo; history change "A simple test"; history subs 45 xx} exec + history add foo + history e +} {A simple test} +test history-10.11 {history revision} { + history add {word0 word1 $ a b c word6} + history add {set a [history w 4-[history word 2]]} exec + set a +} {b c word6} +test history-10.12 {history revision} { + history add {word0 word1 $ a b c word6} + history add {set a [history w 4-[history word 2]]} exec + history add foo + history e +} {set a {b c word6}} +test history-10.13 {history revision} { + history add {history word 0} exec + history add foo + history e +} {history word 0} +test history-10.14 {history revision} { + history add {set a [history word 0; format c]} exec + history add foo + history e +} {set a [history word 0; format c]} +test history-10.15 {history revision even when nested} { + proc x {a b} {history word $a $b} + history add {word1 word2 word3 word4} + history add {set a [x 1-3 -1]} exec + history add foo + history e +} {set a {word2 word3 word4}} +test history-10.16 {disable history revision in nested history evals} { + history add {word1 word2 word3 word4} + history add {set a [history words 0]; history add foo; set a [history words 0]} exec + history e +} {set a word1; history add foo; set a [history words 0]} + +# miscellaneous + +test history-11.1 {miscellaneous} {catch {history gorp} msg} 1 +test history-11.2 {miscellaneous} { + catch {history gorp} msg + set msg +} {bad option "gorp": must be add, change, event, info, keep, nextid, redo, substitute, or words} diff --git a/vendor/x11iraf/obm/Tcl/tests/if.test b/vendor/x11iraf/obm/Tcl/tests/if.test new file mode 100644 index 00000000..1ab205ed --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/if.test @@ -0,0 +1,162 @@ +# Commands covered: if +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/if.test,v 1.5 93/02/06 15:54:17 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test if-1.1 {taking proper branch} { + set a {} + if 0 {set a 1} else {set a 2} + set a +} 2 +test if-1.2 {taking proper branch} { + set a {} + if 1 {set a 1} else {set a 2} + set a +} 1 +test if-1.3 {taking proper branch} { + set a {} + if 1<2 {set a 1} + set a +} 1 +test if-1.4 {taking proper branch} { + set a {} + if 1>2 {set a 1} + set a +} {} +test if-1.5 {taking proper branch} { + set a {} + if 0 {set a 1} else {} + set a +} {} +test if-1.5 {taking proper branch} { + set a {} + if 0 {set a 1} elseif 1 {set a 2} elseif 1 {set a 3} else {set a 4} + set a +} {2} +test if-1.6 {taking proper branch} { + set a {} + if 0 {set a 1} elseif 0 {set a 2} elseif 1 {set a 3} else {set a 4} + set a +} {3} +test if-1.7 {taking proper branch} { + set a {} + if 0 {set a 1} elseif 0 {set a 2} elseif 0 {set a 3} else {set a 4} + set a +} {4} + + +test if-2.1 {optional then-else args} { + set a 44 + if 0 then {set a 1} elseif 0 then {set a 3} else {set a 2} + set a +} 2 +test if-2.2 {optional then-else args} { + set a 44 + if 1 then {set a 1} else {set a 2} + set a +} 1 +test if-2.3 {optional then-else args} { + set a 44 + if 0 {set a 1} else {set a 2} + set a +} 2 +test if-2.4 {optional then-else args} { + set a 44 + if 1 {set a 1} else {set a 2} + set a +} 1 +test if-2.5 {optional then-else args} { + set a 44 + if 0 then {set a 1} {set a 2} + set a +} 2 +test if-2.6 {optional then-else args} { + set a 44 + if 1 then {set a 1} {set a 2} + set a +} 1 +test if-2.7 {optional then-else args} { + set a 44 + if 0 then {set a 1} else {set a 2} + set a +} 2 +test if-2.8 {optional then-else args} { + set a 44 + if 0 then {set a 1} elseif 0 {set a 2} elseif 0 {set a 3} {set a 4} + set a +} 4 + +test if-3.1 {return value} { + if 1 then {set a 22; concat abc} +} abc +test if-3.2 {return value} { + if 0 then {set a 22; concat abc} elseif 1 {concat def} {concat ghi} +} def +test if-3.3 {return value} { + if 0 then {set a 22; concat abc} else {concat def} +} def +test if-3.4 {return value} { + if 0 then {set a 22; concat abc} +} {} +test if-3.5 {return value} { + if 0 then {set a 22; concat abc} elseif 0 {concat def} +} {} + +test if-4.1 {error conditions} { + list [catch {if} msg] $msg +} {1 {wrong # args: no expression after "if" argument}} +test if-4.2 {error conditions} { + list [catch {if {[error "error in condition"]}} msg] $msg +} {1 {error in condition}} +test if-4.3 {error conditions} { + list [catch {if 2} msg] $msg +} {1 {wrong # args: no script following "2" argument}} +test if-4.4 {error conditions} { + list [catch {if 2 then} msg] $msg +} {1 {wrong # args: no script following "then" argument}} +test if-4.5 {error conditions} { + list [catch {if 2 the} msg] $msg +} {1 {invalid command name: "the"}} +test if-4.6 {error conditions} { + list [catch {if 2 then {[error "error in then clause"]}} msg] $msg +} {1 {error in then clause}} +test if-4.7 {error conditions} { + list [catch {if 0 then foo elseif} msg] $msg +} {1 {wrong # args: no expression after "elseif" argument}} +test if-4.8 {error conditions} { + list [catch {if 0 then foo elsei} msg] $msg +} {1 {invalid command name: "elsei"}} +test if-4.9 {error conditions} { + list [catch {if 0 then foo elseif 0 bar else} msg] $msg +} {1 {wrong # args: no script following "else" argument}} +test if-4.10 {error conditions} { + list [catch {if 0 then foo elseif 0 bar els} msg] $msg +} {1 {invalid command name: "els"}} +test if-4.11 {error conditions} { + list [catch {if 0 then foo elseif 0 bar else {[error "error in else clause"]}} msg] $msg +} {1 {error in else clause}} diff --git a/vendor/x11iraf/obm/Tcl/tests/incr.test b/vendor/x11iraf/obm/Tcl/tests/incr.test new file mode 100644 index 00000000..d04fe7f6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/incr.test @@ -0,0 +1,86 @@ +# Commands covered: lreplace +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/incr.test,v 1.5 93/07/12 11:34:43 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {unset x} + +test incr-1.1 {basic incr operation} { + set x 23 + list [incr x] $x +} {24 24} +test incr-1.2 {basic incr operation} { + set x 106 + list [incr x -5] $x +} {101 101} +test incr-1.3 {basic incr operation} { + set x " -106" + list [incr x 1] $x +} {-105 -105} +test incr-1.3 {basic incr operation} { + set x " +106" + list [incr x 1] $x +} {107 107} + +test incr-2.1 {incr errors} { + list [catch incr msg] $msg +} {1 {wrong # args: should be "incr varName ?increment?"}} +test incr-2.2 {incr errors} { + list [catch {incr a b c} msg] $msg +} {1 {wrong # args: should be "incr varName ?increment?"}} +test incr-2.3 {incr errors} { + catch {unset x} + list [catch {incr x} msg] $msg $errorInfo +} {1 {can't read "x": no such variable} {can't read "x": no such variable + while executing +"incr x"}} +test incr-2.4 {incr errors} { + set x abc + list [catch {incr x} msg] $msg $errorInfo +} {1 {expected integer but got "abc"} {expected integer but got "abc" + (reading value of variable to increment) + invoked from within +"incr x"}} +test incr-2.5 {incr errors} { + set x 123 + list [catch {incr x 1a} msg] $msg $errorInfo +} {1 {expected integer but got "1a"} {expected integer but got "1a" + (reading increment) + invoked from within +"incr x 1a"}} +test incr-2.6 {incr errors} { + proc readonly args {error "variable is read-only"} + set x 123 + trace var x w readonly + list [catch {incr x 1} msg] $msg $errorInfo +} {1 {can't set "x": variable is read-only} {can't set "x": variable is read-only + while executing +"incr x 1"}} + +catch {unset x} +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/info.test b/vendor/x11iraf/obm/Tcl/tests/info.test new file mode 100644 index 00000000..ecc7d940 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/info.test @@ -0,0 +1,524 @@ +# Commands covered: info +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/info.test,v 1.17 93/10/13 13:02:02 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test info-1.1 {info args option} { + proc t1 {a bbb c} {return foo} + info args t1 +} {a bbb c} +test info-1.2 {info args option} { + proc t1 {{a default1} {bbb default2} {c default3} args} {return foo} + info a t1 +} {a bbb c args} +test info-1.3 {info args option} { + proc t1 "" {return foo} + info args t1 +} {} +test info-1.4 {info args option} { + catch {rename t1 {}} + list [catch {info args t1} msg] $msg +} {1 {"t1" isn't a procedure}} +test info-1.5 {info args option} { + list [catch {info args set} msg] $msg +} {1 {"set" isn't a procedure}} + +test info-2.1 {info body option} { + proc t1 {} {body of t1} + info body t1 +} {body of t1} +test info-2.2 {info body option} { + list [catch {info body set} msg] $msg +} {1 {"set" isn't a procedure}} +test info-2.3 {info body option} { + list [catch {info args set 1} msg] $msg +} {1 {wrong # args: should be "info args procname"}} + +test info-3.1 {info cmdcount option} { + set x [info cmdcount] + set y 12345 + set z [info cm] + expr $z-$x +} 3 +test info-3.2 {info body option} { + list [catch {info cmdcount 1} msg] $msg +} {1 {wrong # args: should be "info cmdcount"}} + +test info-4.1 {info commands option} { + proc t1 {} {} + proc t2 {} {} + set x " [info commands] " + list [string match {* t1 *} $x] [string match {* t2 *} $x] \ + [string match {* set *} $x] [string match {* list *} $x] +} {1 1 1 1} +test info-4.2 {info commands option} { + proc t1 {} {} + rename t1 {} + set x [info comm] + string match {* t1 *} $x +} 0 +test info-4.3 {info commands option} { + proc _t1_ {} {} + proc _t2_ {} {} + info commands _t1_ +} _t1_ +test info-4.4 {info commands option} { + proc _t1_ {} {} + proc _t2_ {} {} + lsort [info commands _t*] +} {_t1_ _t2_} +catch {rename _t1_ {}} +catch {rename _t2_ {}} +test info-4.5 {info commands option} { + list [catch {info commands a b} msg] $msg +} {1 {wrong # args: should be "info commands [pattern]"}} + +test info-5.1 {info complete option} { + info complete "" +} 1 +test info-5.2 {info complete option} { + info complete " \n" +} 1 +test info-5.3 {info complete option} { + info complete "abc def" +} 1 +test info-5.4 {info complete option} { + info complete "a b c d e f \t\n" +} 1 +test info-5.5 {info complete option} { + info complete {a b c"d} +} 1 +test info-5.6 {info complete option} { + info complete {a b "c d" e} +} 1 +test info-5.7 {info complete option} { + info complete {a b "c d"} +} 1 +test info-5.8 {info complete option} { + info complete {a b "c d"} +} 1 +test info-5.9 {info complete option} { + info complete {a b "c d} +} 0 +test info-5.10 {info complete option} { + info complete {a b "} +} 0 +test info-5.11 {info complete option} { + info complete {a b "cd"xyz} +} 1 +test info-5.12 {info complete option} { + info complete {a b "c $d() d"} +} 1 +test info-5.13 {info complete option} { + info complete {a b "c $dd("} +} 0 +test info-5.14 {info complete option} { + info complete {a b "c \"} +} 0 +test info-5.15 {info complete option} { + info complete {a b "c [d e f]"} +} 1 +test info-5.16 {info complete option} { + info complete {a b "c [d e f] g"} +} 1 +test info-5.17 {info complete option} { + info complete {a b "c [d e f"} +} 0 +test info-5.18 {info complete option} { + info complete {a {b c d} e} +} 1 +test info-5.19 {info complete option} { + info complete {a {b c d}} +} 1 +test info-5.20 {info complete option} { + info complete "a b\{c d" +} 1 +test info-5.21 {info complete option} { + info complete "a b \{c" +} 0 +test info-5.22 {info complete option} { + info complete "a b \{c{ }" +} 0 +test info-5.23 {info complete option} { + info complete "a b {c d e}xxx" +} 1 +test info-5.24 {info complete option} { + info complete "a b {c \\\{d e}xxx" +} 1 +test info-5.25 {info complete option} { + info complete {a b [ab cd ef]} +} 1 +test info-5.26 {info complete option} { + info complete {a b x[ab][cd][ef] gh} +} 1 +test info-5.27 {info complete option} { + info complete {a b x[ab][cd[ef] gh} +} 0 +test info-5.28 {info complete option} { + info complete {a b x[ gh} +} 0 +test info-5.29 {info complete option} { + info complete {[]]]} +} 1 +test info-5.30 {info complete option} { + info complete {abc x$yyy} +} 1 +test info-5.31 {info complete option} { + info complete "abc x\${abc\[\\d} xyz" +} 1 +test info-5.32 {info complete option} { + info complete "abc x\$\{ xyz" +} 0 +test info-5.33 {info complete option} { + info complete {word $a(xyz)} +} 1 +test info-5.34 {info complete option} { + info complete {word $a(} +} 0 +test info-5.35 {info complete option} { + info complete "set a \\\n" +} 0 +test info-5.36 {info complete option} { + info complete "set a \\n " +} 1 +test info-5.37 {info complete option} { + info complete "set a \\" +} 1 +test info-5.38 {info complete option} { + info complete "foo \\\n\{" +} 0 +test info-5.39 {info complete option} { + info complete " # \{" +} 1 +test info-5.40 {info complete option} { + info complete "foo bar;# \{" +} 1 +test info-5.41 {info complete option} { + info complete "a\nb\n# \{\n# \{\nc\n" +} 1 + +test info-6.1 {info default option} { + proc t1 {a b {c d} {e "long default value"}} {} + info default t1 a value +} 0 +test info-6.2 {info default option} { + proc t1 {a b {c d} {e "long default value"}} {} + set value 12345 + info d t1 a value + set value +} {} +test info-6.3 {info default option} { + proc t1 {a b {c d} {e "long default value"}} {} + info default t1 c value +} 1 +test info-6.4 {info default option} { + proc t1 {a b {c d} {e "long default value"}} {} + set value 12345 + info default t1 c value + set value +} d +test info-6.5 {info default option} { + proc t1 {a b {c d} {e "long default value"}} {} + set value 12345 + set x [info default t1 e value] + list $x $value +} {1 {long default value}} +test info-6.6 {info default option} { + list [catch {info default a b} msg] $msg +} {1 {wrong # args: should be "info default procname arg varname"}} +test info-6.7 {info default option} { + list [catch {info default _nonexistent_ a b} msg] $msg +} {1 {"_nonexistent_" isn't a procedure}} +test info-6.8 {info default option} { + proc t1 {a b} {} + list [catch {info default t1 x value} msg] $msg +} {1 {procedure "t1" doesn't have an argument "x"}} +test info-6.9 {info default option} { + catch {unset a} + set a(0) 88 + proc t1 {a b} {} + list [catch {info default t1 a a} msg] $msg +} {1 {couldn't store default value in variable "a"}} +test info-6.10 {info default option} { + catch {unset a} + set a(0) 88 + proc t1 {{a 18} b} {} + list [catch {info default t1 a a} msg] $msg +} {1 {couldn't store default value in variable "a"}} +catch {unset a} + +test info-7.1 {info exists option} { + set value foo + info exists value +} 1 +catch {unset _nonexistent_} +test info-7.2 {info exists option} { + info exists _nonexistent_ +} 0 +test info-7.3 {info exists option} { + proc t1 {x} {return [info exists x]} + t1 2 +} 1 +test info-7.4 {info exists option} { + proc t1 {x} { + global _nonexistent_ + return [info exists _nonexistent_] + } + t1 2 +} 0 +test info-7.5 {info exists option} { + proc t1 {x} { + set y 47 + return [info exists y] + } + t1 2 +} 1 +test info-7.6 {info exists option} { + proc t1 {x} {return [info exists value]} + t1 2 +} 0 +test info-7.7 {info exists option} { + catch {unset x} + set x(2) 44 + list [info exists x] [info exists x(1)] [info exists x(2)] +} {1 0 1} +catch {unset x} +test info-7.8 {info exists option} { + list [catch {info exists} msg] $msg +} {1 {wrong # args: should be "info exists varName"}} +test info-7.9 {info exists option} { + list [catch {info exists 1 2} msg] $msg +} {1 {wrong # args: should be "info exists varName"}} + +test info-8.1 {info globals option} { + set x 1 + set y 2 + set value 23 + set a " [info globals] " + list [string match {* x *} $a] [string match {* y *} $a] \ + [string match {* value *} $a] [string match {* _foobar_ *} $a] +} {1 1 1 0} +test info-8.2 {info globals option} { + set _xxx1 1 + set _xxx2 2 + lsort [info g _xxx*] +} {_xxx1 _xxx2} +test info-8.3 {info globals option} { + list [catch {info globals 1 2} msg] $msg +} {1 {wrong # args: should be "info globals [pattern]"}} + +test info-9.1 {info level option} { + info level +} 0 +test info-9.2 {info level option} { + proc t1 {a b} { + set x [info le] + set y [info level 1] + list $x $y + } + t1 146 testString +} {1 {t1 146 testString}} +test info-9.3 {info level option} { + proc t1 {a b} { + t2 [expr $a*2] $b + } + proc t2 {x y} { + list [info level] [info level 1] [info level 2] [info level -1] \ + [info level 0] + } + t1 146 {a {b c} {{{c}}}} +} {2 {t1 146 {a {b c} {{{c}}}}} {t2 292 {a {b c} {{{c}}}}} {t1 146 {a {b c} {{{c}}}}} {t2 292 {a {b c} {{{c}}}}}} +test info-9.4 {info level option} { + proc t1 {} { + set x [info level] + set y [info level 1] + list $x $y + } + t1 +} {1 t1} +test info-9.5 {info level option} { + list [catch {info level 1 2} msg] $msg +} {1 {wrong # args: should be "info level [number]"}} +test info-9.6 {info level option} { + list [catch {info level 123a} msg] $msg +} {1 {expected integer but got "123a"}} +test info-9.7 {info level option} { + list [catch {info level 0} msg] $msg +} {1 {bad level "0"}} +test info-9.8 {info level option} { + proc t1 {} {info level -1} + list [catch {t1} msg] $msg +} {1 {bad level "-1"}} +test info-9.9 {info level option} { + proc t1 {x} {info level $x} + list [catch {t1 -3} msg] $msg +} {1 {bad level "-3"}} + +test info-10.1 {info library option} { + list [catch {info library x} msg] $msg +} {1 {wrong # args: should be "info library"}} +# The following check can only be done at Berkeley, where the exact +# location of the library is known. + +if $atBerkeley { + test info-10.2 {info library option} { + info li + } /users/ouster/tcl/library + test info-10.3 {info library option} { + set env(TCL_LIBRARY) test_value + set result [info library] + unset env(TCL_LIBRARY) + list $result [info library] + } {test_value /users/ouster/tcl/library} +} + +test info-11.1 {info locals option} { + set a 22 + proc t1 {x y} { + set b 13 + set c testing + global a + return [info locals] + } + lsort [t1 23 24] +} {b c x y} +test info-11.2 {info locals option} { + proc t1 {x y} { + set xx1 2 + set xx2 3 + set y 4 + return [info lo x*] + } + lsort [t1 2 3] +} {x xx1 xx2} +test info-11.3 {info locals option} { + list [catch {info locals 1 2} msg] $msg +} {1 {wrong # args: should be "info locals [pattern]"}} +test info-11.4 {info locals option} { + info locals +} {} +test info-11.5 {info locals option} { + proc t1 {} {return [info locals]} + t1 +} {} + +test info-12.1 {info patchlevel option} { + set a [info patchlevel] + incr a 2 + expr $a-[info patchlevel] +} 2 +test info-12.2 {info patchlevel option} { + list [catch {info patchlevel a} msg] $msg +} {1 {wrong # args: should be "info patchlevel"}} + +test info-13.1 {info procs option} { + proc t1 {} {} + proc t2 {} {} + set x " [info procs] " + list [string match {* t1 *} $x] [string match {* t2 *} $x] \ + [string match {* _undefined_ *} $x] +} {1 1 0} +test info-13.2 {info procs option} { + proc _tt1 {} {} + proc _tt2 {} {} + lsort [info pr _tt*] +} {_tt1 _tt2} +catch {rename _tt1 {}} +catch {rename _tt2 {}} +test info-13.3 {info procs option} { + list [catch {info procs 2 3} msg] $msg +} {1 {wrong # args: should be "info procs [pattern]"}} + +test info-14.1 {info script option} { + list [catch {info script x} msg] $msg +} {1 {wrong # args: should be "info script"}} +test info-14.2 {info script option} { + file tail [info s] +} info.test +catch {exec rm -f gorp.info} +exec cat > gorp.info << "info script\n" +test info-14.3 {info script option} { + list [source gorp.info] [file tail [info script]] +} {gorp.info info.test} +test info-14.4 {resetting "info script" after errors} { + catch {source ~_nobody_/foo} + file tail [info script] +} {info.test} +test info-14.5 {resetting "info script" after errors} { + catch {source _nonexistent_} + file tail [info script] +} {info.test} +exec rm -f gorp.info + +test info-15.1 {info tclversion option} { + set x [info tclversion] + scan $x "%d.%d%c" a b c +} 2 +test info-15.2 {info tclversion option} { + list [catch {info t 2} msg] $msg +} {1 {wrong # args: should be "info tclversion"}} + +test info-16.1 {info vars option} { + set a 1 + set b 2 + proc t1 {x y} { + global a b + set c 33 + return [info vars] + } + lsort [t1 18 19] +} {a b c x y} +test info-16.2 {info vars option} { + set xxx1 1 + set xxx2 2 + proc t1 {xxa y} { + global xxx1 xxx2 + set c 33 + return [info vars x*] + } + lsort [t1 18 19] +} {xxa xxx1 xxx2} +test info-16.3 {info vars option} { + lsort [info vars] +} [lsort [info globals]] +test info-16.4 {info vars option} { + list [catch {info vars a b} msg] $msg +} {1 {wrong # args: should be "info vars [pattern]"}} + +test info-17.1 {miscellaneous error conditions} { + list [catch {info} msg] $msg +} {1 {wrong # args: should be "info option ?arg arg ...?"}} +test info-17.2 {miscellaneous error conditions} { + list [catch {info gorp} msg] $msg +} {1 {bad option "gorp": should be args, body, cmdcount, commands, complete, default, exists, globals, level, library, locals, patchlevel, procs, script, tclversion, or vars}} +test info-17.3 {miscellaneous error conditions} { + list [catch {info c} msg] $msg +} {1 {bad option "c": should be args, body, cmdcount, commands, complete, default, exists, globals, level, library, locals, patchlevel, procs, script, tclversion, or vars}} +test info-17.4 {miscellaneous error conditions} { + list [catch {info l} msg] $msg +} {1 {bad option "l": should be args, body, cmdcount, commands, complete, default, exists, globals, level, library, locals, patchlevel, procs, script, tclversion, or vars}} diff --git a/vendor/x11iraf/obm/Tcl/tests/join.test b/vendor/x11iraf/obm/Tcl/tests/join.test new file mode 100644 index 00000000..0d01d4d9 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/join.test @@ -0,0 +1,52 @@ +# Commands covered: join +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/join.test,v 1.4 93/02/06 16:01:33 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test join-1.1 {basic join commands} { + join {a b c} xyz +} axyzbxyzc +test join-1.2 {basic join commands} { + join {a b c} {} +} abc +test join-1.3 {basic join commands} { + join {} xyz +} {} +test join-1.4 {basic join commands} { + join {12 34 56} +} {12 34 56} + +test join-2.1 {join errors} { + list [catch join msg] $msg $errorCode +} {1 {wrong # args: should be "join list ?joinString?"} NONE} +test join-2.2 {join errors} { + list [catch {join a b c} msg] $msg $errorCode +} {1 {wrong # args: should be "join list ?joinString?"} NONE} +test join-2.3 {join errors} { + list [catch {join "a \{ c" 111} msg] $msg $errorCode +} {1 {unmatched open brace in list} NONE} diff --git a/vendor/x11iraf/obm/Tcl/tests/lindex.test b/vendor/x11iraf/obm/Tcl/tests/lindex.test new file mode 100644 index 00000000..f215a4ec --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/lindex.test @@ -0,0 +1,73 @@ +# Commands covered: lindex +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/lindex.test,v 1.2 93/02/06 16:01:45 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test lindex-1.1 {basic tests} { + lindex {a b c} 0} a +test lindex-1.2 {basic tests} { + lindex {a {b c d} x} 1} {b c d} +test lindex-1.3 {basic tests} { + lindex {a b\ c\ d x} 1} {b c d} +test lindex-1.4 {basic tests} { + lindex {a b c} 3} {} +test lindex-1.5 {basic tests} { + list [catch {lindex {a b c} -1} msg] $msg +} {0 {}} + +test lindex-2.1 {error conditions} { + list [catch {lindex msg} msg] $msg +} {1 {wrong # args: should be "lindex list index"}} +test lindex-2.2 {error conditions} { + list [catch {lindex 1 2 3 4} msg] $msg +} {1 {wrong # args: should be "lindex list index"}} +test lindex-2.3 {error conditions} { + list [catch {lindex 1 2a2} msg] $msg +} {1 {expected integer but got "2a2"}} +test lindex-2.4 {error conditions} { + list [catch {lindex "a \{" 2} msg] $msg +} {1 {unmatched open brace in list}} +test lindex-2.5 {error conditions} { + list [catch {lindex {a {b c}d e} 2} msg] $msg +} {1 {list element in braces followed by "d" instead of space}} +test lindex-2.6 {error conditions} { + list [catch {lindex {a "b c"def ghi} 2} msg] $msg +} {1 {list element in quotes followed by "def" instead of space}} + +test lindex-3.1 {quoted elements} { + lindex {a "b c" d} 1 +} {b c} +test lindex-3.2 {quoted elements} { + lindex {"{}" b c} 0 +} {{}} +test lindex-3.3 {quoted elements} { + lindex {ab "c d \" x" y} 1 +} {c d " x} +test lindex-3.4 {quoted elements} { + lindex {a b {c d "e} {f g"}} 2 +} {c d "e} diff --git a/vendor/x11iraf/obm/Tcl/tests/link.test b/vendor/x11iraf/obm/Tcl/tests/link.test new file mode 100644 index 00000000..11817145 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/link.test @@ -0,0 +1,148 @@ +# Commands covered: none +# +# This file contains a collection of tests for Tcl_LinkVar and related +# library procedures. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/link.test,v 1.5 93/07/28 15:05:32 ouster Exp $ (Berkeley) + +if {[info commands testlink] == {}} { + puts "This application hasn't been compiled with the \"testlink\"" + puts "command, so I can't test Tcl_LinkVar et al." + return +} + +if {[string compare test [info procs test]] == 1} then {source defs} + +foreach i {int real bool string} { + catch {unset $i} +} +test link-1.1 {reading C variables from Tcl} { + testlink delete + testlink set 43 1.23 4 - + testlink create 1 1 1 1 + list $int $real $bool $string +} {43 1.23 1 NULL} +test link-1.2 {reading C variables from Tcl} { + testlink delete + testlink create 1 1 1 1 + testlink set -3 2 0 "A long string with spaces" + list $int $real $bool $string $int $real $bool $string +} {-3 2.0 0 {A long string with spaces} -3 2.0 0 {A long string with spaces}} + +test link-2.1 {writing C variables from Tcl} { + testlink delete + testlink set 43 1.23 4 - + testlink create 1 1 1 1 + set int "00721" + set real -8e13 + set bool true + set string abcdef + concat [testlink get] $int $real $bool $string +} {465 -8e+13 1 abcdef 00721 -8e13 true abcdef} +test link-2.2 {writing bad values into variables} { + testlink delete + testlink set 43 1.23 4 - + testlink create 1 1 1 1 + list [catch {set int 09a} msg] $msg $int +} {1 {can't set "int": variable must have integer value} 43} +test link-2.3 {writing bad values into variables} { + testlink delete + testlink set 43 1.23 4 - + testlink create 1 1 1 1 + list [catch {set real 1.x3} msg] $msg $real +} {1 {can't set "real": variable must have real value} 1.23} +test link-2.4 {writing bad values into variables} { + testlink delete + testlink set 43 1.23 4 - + testlink create 1 1 1 1 + list [catch {set bool gorp} msg] $msg $bool +} {1 {can't set "bool": variable must have boolean value} 1} + +test link-3.1 {read-only variables} { + testlink delete + testlink set 43 1.23 4 - + testlink create 0 1 1 0 + list [catch {set int 4} msg] $msg $int \ + [catch {set real 10.6} msg] $msg $real \ + [catch {set bool no} msg] $msg $bool \ + [catch {set string "new value"} msg] $msg $string +} {1 {can't set "int": linked variable is read-only} 43 0 10.6 10.6 0 no no 1 {can't set "string": linked variable is read-only} NULL} +test link-3.2 {read-only variables} { + testlink delete + testlink set 43 1.23 4 - + testlink create 1 0 0 1 + list [catch {set int 4} msg] $msg $int \ + [catch {set real 10.6} msg] $msg $real \ + [catch {set bool no} msg] $msg $bool \ + [catch {set string "new value"} msg] $msg $string +} {0 4 4 1 {can't set "real": linked variable is read-only} 1.23 1 {can't set "bool": linked variable is read-only} 1 0 {new value} {new value}} + +test link-4.1 {unsetting linked variables} { + testlink delete + testlink set -6 -2.1 0 stringValue + testlink create 1 1 1 1 + unset int real bool string + list [catch {set int} msg] $msg [catch {set real} msg] $msg \ + [catch {set bool} msg] $msg [catch {set string} msg] $msg +} {0 -6 0 -2.1 0 0 0 stringValue} +test link-4.2 {unsetting linked variables} { + testlink delete + testlink set -6 -2.1 0 stringValue + testlink create 1 1 1 1 + unset int real bool string + set int 102 + set real 16 + set bool true + set string newValue + testlink get +} {102 16.0 1 newValue} + +test link-5.1 {unlinking variables} { + testlink delete + testlink set -6 -2.1 0 stringValue + testlink delete + set int xx1 + set real qrst + set bool bogus + set string 12345 + testlink get +} {-6 -2.1 0 stringValue} +test link-5.2 {unlinking variables} { + testlink delete + testlink set -6 -2.1 0 stringValue + testlink create 1 1 1 1 + testlink delete + testlink set 25 14.7 7 - + list $int $real $bool $string +} {-6 -2.1 0 stringValue} + +test link-6.1 {errors in setting up link} { + testlink delete + catch {unset int} + set int(44) 1 + list [catch {testlink create 1 1 1 1} msg] $msg +} {1 {can't set "int": variable is array}} + +testlink delete +unset int real bool string diff --git a/vendor/x11iraf/obm/Tcl/tests/linsert.test b/vendor/x11iraf/obm/Tcl/tests/linsert.test new file mode 100644 index 00000000..0201405b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/linsert.test @@ -0,0 +1,91 @@ +# Commands covered: linsert +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/linsert.test,v 1.5 93/06/19 14:31:26 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test linsert-1.1 {linsert command} { + linsert {1 2 3 4 5} 0 a +} {a 1 2 3 4 5} +test linsert-1.2 {linsert command} { + linsert {1 2 3 4 5} 1 a +} {1 a 2 3 4 5} +test linsert-1.3 {linsert command} { + linsert {1 2 3 4 5} 2 a +} {1 2 a 3 4 5} +test linsert-1.4 {linsert command} { + linsert {1 2 3 4 5} 3 a +} {1 2 3 a 4 5} +test linsert-1.5 {linsert command} { + linsert {1 2 3 4 5} 4 a +} {1 2 3 4 a 5} +test linsert-1.6 {linsert command} { + linsert {1 2 3 4 5} 5 a +} {1 2 3 4 5 a} +test linsert-1.7 {linsert command} { + linsert {1 2 3 4 5} 2 one two \{three \$four +} {1 2 one two \{three {$four} 3 4 5} +test linsert-1.8 {linsert command} { + linsert {\{one \$two \{three \ four \ five} 2 a b c +} {\{one \$two a b c \{three \ four \ five} +test linsert-1.9 {linsert command} { + linsert {{1 2} {3 4} {5 6} {7 8}} 2 {x y} {a b} +} {{1 2} {3 4} {x y} {a b} {5 6} {7 8}} +test linsert-1.10 {linsert command} { + linsert {} 2 a b c +} {a b c} +test linsert-1.11 {linsert command} { + linsert {} 2 {} +} {{}} +test linsert-1.12 {linsert command} { + linsert {a b "c c" d e} 3 1 +} {a b "c c" 1 d e} +test linsert-1.13 {linsert command} { + linsert { a b c d} 0 1 2 +} {1 2 a b c d} +test linsert-1.14 {linsert command} { + linsert {a b c {d e f}} 4 1 2 +} {a b c {d e f} 1 2} +test linsert-1.15 {linsert command} { + linsert {a b c \{\ abc} 4 q r +} {a b c \{\ q r abc} +test linsert-1.16 {linsert command} { + linsert {a b c \{ abc} 4 q r +} {a b c \{ q r abc} + +test linsert-2.1 {linsert errors} { + list [catch linsert msg] $msg +} {1 {wrong # args: should be "linsert list index element ?element ...?"}} +test linsert-2.2 {linsert errors} { + list [catch {linsert a b} msg] $msg +} {1 {wrong # args: should be "linsert list index element ?element ...?"}} +test linsert-2.3 {linsert errors} { + list [catch {linsert a 12x 2} msg] $msg +} {1 {expected integer but got "12x"}} +test linsert-2.4 {linsert errors} { + list [catch {linsert \{ 12 2} msg] $msg +} {1 {unmatched open brace in list}} diff --git a/vendor/x11iraf/obm/Tcl/tests/list.test b/vendor/x11iraf/obm/Tcl/tests/list.test new file mode 100644 index 00000000..8bc07815 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/list.test @@ -0,0 +1,87 @@ +# Commands covered: list +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/list.test,v 1.18 93/10/28 16:14:10 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +# First, a bunch of individual tests + +test list-1.1 {basic tests} {list a b c} {a b c} +test list-1.2 {basic tests} {list {a b} c} {{a b} c} +test list-1.3 {basic tests} {list \{a b c} {\{a b c} +test list-1.4 {basic tests} "list a{}} b{} c}" "a\\{\\}\\} b{} c\\}" +test list-1.5 {basic tests} {list a\[ b\] } "{a\[} b\\]" +test list-1.6 {basic tests} {list c\ d\t } "{c } {d\t}" +test list-1.7 {basic tests} {list e\n f\$ } "{e\n} {f\$}" +test list-1.8 {basic tests} {list g\; h\\} {{g;} h\\} +test list-1.9 {basic tests} "list a\\\[} b\\\]} " "a\\\[\\\} b\\\]\\\}" +test list-1.10 {basic tests} "list c\\\} d\\t} " "c\\} d\\t\\}" +test list-1.11 {basic tests} "list e\\n} f\\$} " "e\\n\\} f\\$\\}" +test list-1.12 {basic tests} "list g\\;} h\\\\} " "g\\;\\} {h\\}}" +test list-1.13 {basic tests} {list a {{}} b} {a {{}} b} +test list-1.14 {basic tests} {list a b xy\\} "a b xy\\\\" +test list-1.15 {basic tests} "list a b\} e\\" "a b\\} e\\\\" +test list-1.16 {basic tests} "list a b\}\\\$ e\\\$\\" "a b\\}\\\$ e\\\$\\\\" +test list-1.17 {basic tests} {list a\f \{\f} "{a\f} \\\{\\f" +test list-1.18 {basic tests} {list a\r \{\r} "{a\r} \\\{\\r" +test list-1.19 {basic tests} {list a\v \{\v} "{a\v} \\\{\\v" +test list-1.20 {basic tests} {list \"\}\{} "\\\"\\}\\{" +test list-1.21 {basic tests} {list a b c\\\nd} "a b c\\\\\\nd" +test list-1.22 {basic tests} {list "{ab}\\"} \\{ab\\}\\\\ +test list-1.23 {basic tests} {list \{} "\\{" +test list-1.24 {basic tests} {list} {} + +# For the next round of tests create a list and then pick it apart +# with "index" to make sure that we get back exactly what went in. + +set num 1 +proc lcheck {a b c} { + global num d + set d [list $a $b $c] + test list-2.$num {what goes in must come out} {lindex $d 0} $a + set num [expr $num+1] + test list-2.$num {what goes in must come out} {lindex $d 1} $b + set num [expr $num+1] + test list-2.$num {what goes in must come out} {lindex $d 2} $c + set num [expr $num+1] +} +lcheck a b c +lcheck "a b" c\td e\nf +lcheck {{a b}} {} { } +lcheck \$ \$ab ab\$ +lcheck \; \;ab ab\; +lcheck \[ \[ab ab\[ +lcheck \\ \\ab ab\\ +lcheck {"} {"ab} {ab"} +lcheck {a b} { ab} {ab } +lcheck a{ a{b \{ab +lcheck a} a}b }ab +lcheck a\\} {a \}b} {a \{c} +lcheck xyz \\ 1\\\n2 +lcheck "{ab}\\" "{ab}xy" abc + +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/llength.test b/vendor/x11iraf/obm/Tcl/tests/llength.test new file mode 100644 index 00000000..371e1657 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/llength.test @@ -0,0 +1,49 @@ +# Commands covered: llength +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/llength.test,v 1.2 93/02/06 16:01:45 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test llength-1.1 {length of list} { + llength {a b c d} +} 4 +test llength-1.2 {length of list} { + llength {a b c {a b {c d}} d} +} 5 +test llength-1.3 {length of list} { + llength {} +} 0 + +test llength-2.1 {error conditions} { + list [catch {llength} msg] $msg +} {1 {wrong # args: should be "llength list"}} +test llength-2.2 {error conditions} { + list [catch {llength 123 2} msg] $msg +} {1 {wrong # args: should be "llength list"}} +test llength-2.3 {error conditions} { + list [catch {llength "a b c \{"} msg] $msg +} {1 {unmatched open brace in list}} diff --git a/vendor/x11iraf/obm/Tcl/tests/lrange.test b/vendor/x11iraf/obm/Tcl/tests/lrange.test new file mode 100644 index 00000000..b8aef6bf --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/lrange.test @@ -0,0 +1,79 @@ +# Commands covered: lrange +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/lrange.test,v 1.2 93/02/06 16:01:44 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test lrange-1.1 {range of list elements} { + lrange {a b c d} 1 2 +} {b c} +test lrange-1.2 {range of list elements} { + lrange {a {bcd e {f g {}}} l14 l15 d} 1 1 +} {{bcd e {f g {}}}} +test lrange-1.3 {range of list elements} { + lrange {a {bcd e {f g {}}} l14 l15 d} 3 end +} {l15 d} +test lrange-1.4 {range of list elements} { + lrange {a {bcd e {f g {}}} l14 l15 d} 4 10000 +} {d} +test lrange-1.5 {range of list elements} { + lrange {a {bcd e {f g {}}} l14 l15 d} 4 3 +} {} +test lrange-1.6 {range of list elements} { + lrange {a {bcd e {f g {}}} l14 l15 d} 10 11 +} {} +test lrange-1.7 {range of list elements} { + lrange {a b c d e} -1 2 +} {a b c} +test lrange-1.8 {range of list elements} { + lrange {a b c d e} -2 -1 +} {} +test lrange-1.9 {range of list elements} { + lrange {a b c d e} -2 e +} {a b c d e} +test lrange-1.10 {range of list elements} { + lrange "a b\{c d" 1 2 +} "b\{c d" + +test lrange-2.1 {error conditions} { + list [catch {lrange a b} msg] $msg +} {1 {wrong # args: should be "lrange list first last"}} +test lrange-2.2 {error conditions} { + list [catch {lrange a b 6 7} msg] $msg +} {1 {wrong # args: should be "lrange list first last"}} +test lrange-2.3 {error conditions} { + list [catch {lrange a b 6} msg] $msg +} {1 {expected integer but got "b"}} +test lrange-2.4 {error conditions} { + list [catch {lrange a 0 enigma} msg] $msg +} {1 {expected integer or "end" but got "enigma"}} +test lrange-2.5 {error conditions} { + list [catch {lrange "a \{b c" 3 4} msg] $msg +} {1 {unmatched open brace in list}} +test lrange-2.6 {error conditions} { + list [catch {lrange "a b c \{ d e" 1 4} msg] $msg +} {1 {unmatched open brace in list}} diff --git a/vendor/x11iraf/obm/Tcl/tests/lreplace.test b/vendor/x11iraf/obm/Tcl/tests/lreplace.test new file mode 100644 index 00000000..d3025288 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/lreplace.test @@ -0,0 +1,106 @@ +# Commands covered: lreplace +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/lreplace.test,v 1.5 93/02/06 16:01:39 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test lreplace-1.1 {lreplace command} { + lreplace {1 2 3 4 5} 0 0 a +} {a 2 3 4 5} +test lreplace-1.2 {lreplace command} { + lreplace {1 2 3 4 5} 1 1 a +} {1 a 3 4 5} +test lreplace-1.3 {lreplace command} { + lreplace {1 2 3 4 5} 2 2 a +} {1 2 a 4 5} +test lreplace-1.4 {lreplace command} { + lreplace {1 2 3 4 5} 3 3 a +} {1 2 3 a 5} +test lreplace-1.5 {lreplace command} { + lreplace {1 2 3 4 5} 4 4 a +} {1 2 3 4 a} +test lreplace-1.6 {lreplace command} { + lreplace {1 2 3 4 5} 4 5 a +} {1 2 3 4 a} +test lreplace-1.7 {lreplace command} { + lreplace {1 2 3 4 5} -1 -1 a +} {a 2 3 4 5} +test lreplace-1.8 {lreplace command} { + lreplace {1 2 3 4 5} 2 end a b c d +} {1 2 a b c d} +test lreplace-1.9 {lreplace command} { + lreplace {1 2 3 4 5} 0 3 +} {5} +test lreplace-1.10 {lreplace command} { + lreplace {1 2 3 4 5} 0 4 +} {} +test lreplace-1.11 {lreplace command} { + lreplace {1 2 3 4 5} 0 1 +} {3 4 5} +test lreplace-1.12 {lreplace command} { + lreplace {1 2 3 4 5} 2 3 +} {1 2 5} +test lreplace-1.13 {lreplace command} { + lreplace {1 2 3 4 5} 3 end +} {1 2 3} +test lreplace-1.14 {lreplace command} { + lreplace {1 2 3 4 5} -1 4 a b c +} {a b c} +test lreplace-1.15 {lreplace command} { + lreplace {a b "c c" d e f} 3 3 +} {a b "c c" e f} +test lreplace-1.16 {lreplace command} { + lreplace { 1 2 3 4 5} 0 0 a +} {a 2 3 4 5} +test lreplace-1.17 {lreplace command} { + lreplace {1 2 3 4 "5 6"} 4 4 a +} {1 2 3 4 a} +test lreplace-1.18 {lreplace command} { + lreplace {1 2 3 4 {5 6}} 4 4 a +} {1 2 3 4 a} + +test lreplace-2.1 {lreplace errors} { + list [catch lreplace msg] $msg +} {1 {wrong # args: should be "lreplace list first last ?element element ...?"}} +test lreplace-2.2 {lreplace errors} { + list [catch {lreplace a b} msg] $msg +} {1 {wrong # args: should be "lreplace list first last ?element element ...?"}} +test lreplace-2.3 {lreplace errors} { + list [catch {lreplace x a 10} msg] $msg +} {1 {expected integer but got "a"}} +test lreplace-2.4 {lreplace errors} { + list [catch {lreplace x 10 x} msg] $msg +} {1 {bad index "x": must be integer or "end"}} +test lreplace-2.5 {lreplace errors} { + list [catch {lreplace x 10 1x} msg] $msg +} {1 {expected integer but got "1x"}} +test lreplace-2.6 {lreplace errors} { + list [catch {lreplace x 3 2} msg] $msg +} {1 {first index must not be greater than second}} +test lreplace-2.7 {lreplace errors} { + list [catch {lreplace x 1 1} msg] $msg +} {1 {list doesn't contain element 1}} diff --git a/vendor/x11iraf/obm/Tcl/tests/lsearch.test b/vendor/x11iraf/obm/Tcl/tests/lsearch.test new file mode 100644 index 00000000..73bbdaf2 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/lsearch.test @@ -0,0 +1,81 @@ +# Commands covered: lsearch +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/lsearch.test,v 1.3 93/05/06 16:18:04 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +set x {abcd bbcd 123 234 345} +test lsearch-1.1 {lsearch command} { + lsearch $x 123 +} 2 +test lsearch-1.2 {lsearch command} { + lsearch $x 3456 +} -1 +test lsearch-1.3 {lsearch command} { + lsearch $x *5 +} 4 +test lsearch-1.4 {lsearch command} { + lsearch $x *bc* +} 0 + +test lsearch-2.1 {search modes} { + lsearch -exact {xyz bbcc *bc*} *bc* +} 2 +test lsearch-2.2 {search modes} { + lsearch -exact {b.x ^bc xy bcx} ^bc +} 1 +test lsearch-2.3 {search modes} { + list [catch {lsearch -regexp {xyz bbcc *bc*} *bc*} msg] $msg +} {1 {couldn't compile regular expression pattern: ?+* follows nothing}} +test lsearch-2.4 {search modes} { + lsearch -regexp {b.x ^bc xy bcx} ^bc +} 3 +test lsearch-2.5 {search modes} { + lsearch -glob {xyz bbcc *bc*} *bc* +} 1 +test lsearch-2.6 {search modes} { + lsearch -glob {b.x ^bc xy bcx} ^bc +} 1 +test lsearch-2.7 {search modes} { + list [catch {lsearch -glib {b.x bx xy bcx} b.x} msg] $msg +} {1 {bad search mode "-glib": must be -exact, -glob, or -regexp}} + +test lsearch-3.1 {lsearch errors} { + list [catch lsearch msg] $msg +} {1 {wrong # args: should be "lsearch ?mode? list pattern"}} +test lsearch-3.2 {lsearch errors} { + list [catch {lsearch a} msg] $msg +} {1 {wrong # args: should be "lsearch ?mode? list pattern"}} +test lsearch-3.3 {lsearch errors} { + list [catch {lsearch a b c} msg] $msg +} {1 {bad search mode "a": must be -exact, -glob, or -regexp}} +test lsearch-3.4 {lsearch errors} { + list [catch {lsearch a b c d} msg] $msg +} {1 {wrong # args: should be "lsearch ?mode? list pattern"}} +test lsearch-3.5 {lsearch errors} { + list [catch {lsearch "\{" b} msg] $msg +} {1 {unmatched open brace in list}} diff --git a/vendor/x11iraf/obm/Tcl/tests/lsort.test b/vendor/x11iraf/obm/Tcl/tests/lsort.test new file mode 100644 index 00000000..0020eb5c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/lsort.test @@ -0,0 +1,136 @@ +# Commands covered: lsort +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/lsort.test,v 1.4 93/10/22 14:25:01 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test lsort-1.1 {lsort command} { + lsort {abdeq ab 1 ac a} +} {1 a ab abdeq ac} +test lsort-1.2 {lsort command} { + lsort -decreasing {abdeq ab 1 ac a} +} {ac abdeq ab a 1} +test lsort-1.3 {lsort command} { + lsort -increasing {abdeq ab 1 ac a} +} {1 a ab abdeq ac} +test lsort-1.4 {lsort command} { + lsort {{one long element}} +} {{one long element}} +test lsort-1.5 {lsort command} { + lsort {} +} {} +test lsort-1.6 {lsort with characters needing backslashes} { + lsort {$ \\ [] \{} +} {{$} {[]} \\ \{} + +test lsort-2.1 {lsort -integer} { + lsort -integer -inc {1 180 62 040 180 -42 33 0x40} +} {-42 1 040 33 62 0x40 180 180} +test lsort-2.2 {lsort -integer} { + lsort -int -dec {1 180 62 040 180 -42 33 0x40} +} {180 180 0x40 62 33 040 1 -42} +test lsort-2.3 {lsort -integer} { + list [catch {lsort -integer {xxx 180.2 62 040 180 -42 33 0x40}} msg] $msg $errorInfo +} {1 {expected integer but got "xxx"} {expected integer but got "xxx" + (converting list element from string to integer) + invoked from within +"lsort -integer {xxx 180.2 62 040 180 -42 33 0x40}"}} +test lsort-2.4 {lsort -integer} { + list [catch {lsort -integer {1 180.2 62 040 180 -42 33 0x40}} msg] $msg $errorInfo +} {1 {expected integer but got "180.2"} {expected integer but got "180.2" + (converting list element from string to integer) + invoked from within +"lsort -integer {1 180.2 62 040 180 -42 33 0x40}"}} + +test lsort-3.1 {lsort -real} { + lsort -real {1 180.1 62 040 180 -42.7 33} +} {-42.7 1 33 040 62 180 180.1} +test lsort-3.2 {lsort -real} { + lsort -r -d {1 180.1 62 040 180 -42.7 33} +} {180.1 180 62 040 33 1 -42.7} +test lsort-3.3 {lsort -real} { + list [catch {lsort -real -inc {xxx 20 62 180 -42.7 33}} msg] $msg $errorInfo +} {1 {expected floating-point number but got "xxx"} {expected floating-point number but got "xxx" + (converting list element from string to real) + invoked from within +"lsort -real -inc {xxx 20 62 180 -42.7 33}"}} +test lsort-3.4 {lsort -real} { + list [catch {lsort -real -inc {1 0x40 62 180 -42.7 33}} msg] $msg $errorInfo +} {1 {expected floating-point number but got "0x40"} {expected floating-point number but got "0x40" + (converting list element from string to real) + invoked from within +"lsort -real -inc {1 0x40 62 180 -42.7 33}"}} + +proc lsort1 {a b} { + expr {2*([string match x* $a] - [string match x* $b]) + + [string match *y $a] - [string match *y $b]} +} +proc lsort2 {a b} { + error "comparison error" +} +proc lsort3 {a b} { + concat "foobar" +} + +test lsort-4.1 {lsort -command} { + lsort -command lsort1 {xxx yyy abc {xx y}} +} {abc yyy xxx {xx y}} +test lsort-4.2 {lsort -command} { + lsort -command lsort1 -dec {xxx yyy abc {xx y}} +} {{xx y} xxx yyy abc} +test lsort-4.3 {lsort -command} { + list [catch {lsort -command lsort2 -dec {1 1 1 1}} msg] $msg $errorInfo +} {1 {comparison error} {comparison error + while executing +"error "comparison error"" + (procedure "lsort2" line 2) + invoked from within +"lsort2 1 1" + (user-defined comparison command) + invoked from within +"lsort -command lsort2 -dec {1 1 1 1}"}} +test lsort-4.4 {lsort -command} { + list [catch {lsort -command lsort3 -dec {1 2 3 4}} msg] $msg $errorInfo +} {1 {comparison command returned non-numeric result} {comparison command returned non-numeric result + while executing +"lsort -command lsort3 -dec {1 2 3 4}"}} +test lsort-4.5 {lsort -command} { + list [catch {lsort -command {xxx yyy xxy abc}} msg] $msg +} {1 {"-command" must be followed by comparison command}} + +test lsort-5.1 {lsort errors} { + list [catch lsort msg] $msg +} {1 {wrong # args: should be "lsort ?-ascii? ?-integer? ?-real? ?-increasing? ?-decreasing? ?-command string? list"}} +test lsort-5.2 {lsort errors} { + list [catch {lsort a b} msg] $msg +} {1 {bad switch "a": must be -ascii, -integer, -real, -increasing -decreasing, or -command}} +test lsort-5.3 {lsort errors} { + list [catch {lsort "\{"} msg] $msg +} {1 {unmatched open brace in list}} +test lsort-5.4 {lsort errors} { + list [catch {lsort -in {1 180.0 040 62 180 -42.7 33}} msg] $msg +} {1 {bad switch "-in": must be -ascii, -integer, -real, -increasing -decreasing, or -command}} diff --git a/vendor/x11iraf/obm/Tcl/tests/misc.test b/vendor/x11iraf/obm/Tcl/tests/misc.test new file mode 100644 index 00000000..d05a63f5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/misc.test @@ -0,0 +1,84 @@ +# Commands covered: various +# +# This file contains a collection of miscellaneous Tcl tests that +# don't fit naturally in any of the other test files. Many of these +# tests are pathological cases that caused bugs in earlier Tcl +# releases. +# +# Copyright (c) 1992-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/misc.test,v 1.3 93/10/07 11:41:23 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test misc-1.1 {error in variable ref. in command in array reference} { + proc tstProc {} { + global a + + set tst $a([winfo name $zz]) + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + } + set msg {} + list [catch tstProc msg] $msg +} {1 {can't read "zz": no such variable}} +test misc-1.2 {error in variable ref. in command in array reference} { + proc tstProc {} " + global a + + set tst \$a(\[winfo name \$\{zz) + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + " + set msg {} + list [catch tstProc msg] $msg $errorInfo +} [list 1 {missing close-brace for variable name} \ +[format {missing close-brace for variable name + while executing +"winfo name $%szz) + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus commen ..." + (parsing index for array "a") + invoked from within +"set tst $a([winfo name $%szz) + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a bogus comment + # this is a ..." + (procedure "tstProc" line 4) + invoked from within +"tstProc"} \{ \{]] diff --git a/vendor/x11iraf/obm/Tcl/tests/open.test b/vendor/x11iraf/obm/Tcl/tests/open.test new file mode 100644 index 00000000..950873d5 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/open.test @@ -0,0 +1,662 @@ +# Commands covered: open, close, gets, puts, read, seek, tell, eof, flush +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/open.test,v 1.19 93/10/18 08:52:24 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {exec rm -f test1 test2 test3} +exec cat > test1 << "Two lines: this one\nand this one\n" +exec cat > test2 << "line1\nline2\nline3\nline4\nline5\n" + +test open-1.1 {open command (files only)} { + set f [open test1] + set x [gets $f] + close $f + set x +} {Two lines: this one} +test open-1.2 {open command (files only)} { + set f [open test1] + set f2 [open test2] + set f3 [open test1] + set f4 [open test1] + set x [list [gets $f] [gets $f2] [gets $f3] [gets $f4] \ + [gets $f] [gets $f2]] + close $f + close $f2 + close $f3 + close $f4 + set x +} {{Two lines: this one} line1 {Two lines: this one} {Two lines: this one} {and this one} line2} +test open-1.3 {open command (files only)} { + set f [open test3 w] + puts $f xyz + close $f + exec cat test3 +} "xyz" +test open-1.4 {open command (files only)} { + set f [open test3 w] + puts $f xyz + close $f + set f [open test3 a] + puts $f 123 + close $f + exec cat test3 +} "xyz\n123" +test open-1.5 {open command (files only)} { + set f [open test3 w] + puts $f xyz\n123 + close $f + set f [open test3 r+] + set x [gets $f] + seek $f 0 current + puts $f 456 + close $f + list $x [exec cat test3] +} "xyz {xyz +456}" +test open-1.6 {open command (files only)} { + set f [open test3 w] + puts $f xyz\n123 + close $f + set f [open test3 w+] + puts $f xyzzy + seek $f 2 + set x [gets $f] + close $f + list $x [exec cat test3] +} "zzy xyzzy" +test open-1.7 {open command (files only)} { + set f [open test3 w] + puts $f xyz\n123 + close $f + set f [open test3 a+] + puts $f xyzzy + flush $f + set x [tell $f] + seek $f -4 cur + set y [gets $f] + close $f + list $x [exec cat test3] $y +} {14 {xyz +123 +xyzzy} zzy} + +test open-2.1 {errors in open command} { + list [catch {open} msg] $msg +} {1 {wrong # args: should be "open filename ?access? ?permissions?"}} +test open-2.2 {errors in open command} { + list [catch {open a b c d} msg] $msg +} {1 {wrong # args: should be "open filename ?access? ?permissions?"}} +test open-2.3 {errors in open command} { + list [catch {open test1 x} msg] $msg +} {1 {illegal access mode "x"}} +test open-2.4 {errors in open command} { + list [catch {open test1 rw} msg] $msg +} {1 {illegal access mode "rw"}} +test open-2.5 {errors in open command} { + list [catch {open test1 r+1} msg] $msg +} {1 {illegal access mode "r+1"}} +test open-2.6 {errors in open command} { + string tolower [list [catch {open _non_existent_} msg] $msg $errorCode] +} {1 {couldn't open "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}} + +if {![file exists ~/_test_] && [file writable ~]} { + test open-3.1 {tilde substitution in open} { + set f [open ~/_test_ w] + puts $f "Some text" + close $f + set x [file exists $env(HOME)/_test_] + exec rm -f $env(HOME)/_test_ + set x + } 1 +} +test open-3.2 {tilde substitution in open} { + set home $env(HOME) + unset env(HOME) + set x [list [catch {open ~/foo} msg] $msg] + set env(HOME) $home + set x +} {1 {couldn't find HOME environment variable to expand "~/foo"}} + +test open-4.1 {file id parsing errors} { + list [catch {eof gorp} msg] $msg $errorCode +} {1 {bad file identifier "gorp"} NONE} +test open-4.2 {file id parsing errors} { + list [catch {eof filex} msg] $msg +} {1 {bad file identifier "filex"}} +test open-4.3 {file id parsing errors} { + list [catch {eof file12a} msg] $msg +} {1 {bad file identifier "file12a"}} +test open-4.4 {file id parsing errors} { + list [catch {eof file123} msg] $msg +} {1 {file "file123" isn't open}} +test open-4.5 {file id parsing errors} { + list [catch {eof file1} msg] $msg +} {0 0} +test open-4.5 {file id parsing errors} { + list [catch {eof stdin} msg] $msg +} {0 0} +test open-4.6 {file id parsing errors} { + list [catch {eof stdout} msg] $msg +} {0 0} +test open-4.7 {file id parsing errors} { + list [catch {eof stderr} msg] $msg +} {0 0} +test open-4.8 {file id parsing errors} { + list [catch {eof stderr1} msg] $msg +} {1 {bad file identifier "stderr1"}} +set f [open test1] +close $f +set expect "1 {file \"$f\" isn't open}" +test open-4.9 {file id parsing errors} { + list [catch {eof $f} msg] $msg +} $expect + +test open-5.1 {close command (files only)} { + list [catch {close} msg] $msg $errorCode +} {1 {wrong # args: should be "close fileId"} NONE} +test open-5.2 {close command (files only)} { + list [catch {close a b} msg] $msg $errorCode +} {1 {wrong # args: should be "close fileId"} NONE} +test open-5.3 {close command (files only)} { + list [catch {close gorp} msg] $msg $errorCode +} {1 {bad file identifier "gorp"} NONE} +test open-5.4 {close command (files only)} { + list [catch {close file4} msg] \ + [string range $msg [string first {" } $msg] end] $errorCode +} {1 {" isn't open} NONE} + +test open-6.1 {puts command} { + list [catch {puts} msg] $msg $errorCode +} {1 {wrong # args: should be "puts" ?-nonewline? ?fileId? string} NONE} +test open-6.2 {puts command} { + list [catch {puts a b c d} msg] $msg $errorCode +} {1 {wrong # args: should be "puts" ?-nonewline? ?fileId? string} NONE} +test open-6.3 {puts command} { + list [catch {puts a b nonewlinx} msg] $msg $errorCode +} {1 {bad argument "nonewlinx": should be "nonewline"} NONE} +test open-6.4 {puts command} { + list [catch {puts gorp "New text"} msg] $msg $errorCode +} {1 {bad file identifier "gorp"} NONE} +test open-6.5 {puts command} { + set f [open test3] + set x [list [catch {puts $f "New text"} msg] \ + [string range $msg [string first " " $msg] end] $errorCode] + close $f + set x +} {1 { wasn't opened for writing} NONE} +test open-6.6 {puts command} { + set f [open test3 w] + puts -nonewline $f "Text1" + puts -nonewline $f " Text 2" + puts $f " Text 3" + close $f + exec cat test3 +} {Text1 Text 2 Text 3} + +test open-7.1 {gets command} { + list [catch {gets} msg] $msg $errorCode +} {1 {wrong # args: should be "gets fileId ?varName?"} NONE} +test open-7.2 {gets command} { + list [catch {gets a b c} msg] $msg $errorCode +} {1 {wrong # args: should be "gets fileId ?varName?"} NONE} +test open-7.3 {gets command} { + list [catch {gets a} msg] $msg $errorCode +} {1 {bad file identifier "a"} NONE} +test open-7.4 {gets command} { + set f [open test3 w] + set x [list [catch {gets $f} msg] \ + [string range $msg [string first " " $msg] end] $errorCode] + close $f + set x +} {1 { wasn't opened for reading} NONE} +set f [open test3 w] +puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +puts $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +close $f +test open-7.5 {gets command with long line} { + set f [open test3] + set x [gets $f] + close $f + set x +} {abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ} +test open-7.6 {gets command with long line} { + set f [open test3] + set x [gets $f y] + close $f + list $x $y +} {260 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ} +test open-7.7 {gets command and end of file} { + set f [open test3 w] + puts -nonewline $f "Test1\nTest2" + close $f + set f [open test3] + set x {} + set y {} + lappend x [gets $f y] $y + set y {} + lappend x [gets $f y] $y + set y {} + lappend x [gets $f y] $y + close $f + set x +} {5 Test1 5 Test2 -1 {}} +set f [open test3 w] +puts $f "Line 1" +puts $f "Line 2" +close $f +test open-7.8 {gets command and bad variable} { + catch {unset x} + set x 24 + set f [open test3 r] + set result [list [catch {gets $f x(0)} msg] $msg] + close $f + set result +} {1 {can't set "x(0)": variable isn't array}} + +test open-8.1 {read command} { + list [catch {read} msg] $msg $errorCode +} {1 {wrong # args: should be "read fileId ?numBytes?" or "read ?-nonewline? fileId"} NONE} +test open-8.2 {read command} { + list [catch {read -nonewline} msg] $msg $errorCode +} {1 {bad file identifier "-nonewline"} NONE} +test open-8.3 {read command} { + list [catch {read a b c} msg] $msg $errorCode +} {1 {wrong # args: should be "read fileId ?numBytes?" or "read ?-nonewline? fileId"} NONE} +test open-8.4 {read command} { + list [catch {read -nonew file4} msg] $msg $errorCode +} {1 {bad file identifier "-nonew"} NONE} +test open-8.5 {read command} { + list [catch {read stdin foo} msg] $msg $errorCode +} {1 {bad argument "foo": should be "nonewline"} NONE} +test open-8.6 {read command} { + list [catch {read file10} msg] $msg $errorCode +} {1 {file "file10" isn't open} NONE} +test open-8.7 {read command} { + set f [open test3 w] + set x [list [catch {read $f} msg] \ + [string range $msg [string first " " $msg] end] $errorCode] + close $f + set x +} {1 { wasn't opened for reading} NONE} +test open-8.8 {read command} { + set f [open test1] + set x [list [catch {read $f 12z} msg] $msg $errorCode] + close $f + set x +} {1 {expected integer but got "12z"} NONE} +test open-898 {read command} { + set f [open test1] + set x [list [catch {read $f z} msg] $msg $errorCode] + close $f + set x +} {1 {bad argument "z": should be "nonewline"} NONE} +test open-8.10 {read command} { + set f [open test1] + set x [list [read $f 1] [read $f 2] [read $f]] + close $f + set x +} {T wo { lines: this one +and this one +}} +test open-8.11 {read command, with over-large count} { + set f [open test1] + set x [read $f 100] + close $f + set x +} {Two lines: this one +and this one +} +test open-8.12 {read command, -nonewline switch} { + set f [open test1] + set x [read -nonewline $f] + close $f + set x +} {Two lines: this one +and this one} + +test open-9.1 {seek command} { + list [catch {seek foo} msg] $msg $errorCode +} {1 {wrong # args: should be "seek fileId offset ?origin?"} NONE} +test open-9.2 {seek command} { + list [catch {seek foo a b c} msg] $msg $errorCode +} {1 {wrong # args: should be "seek fileId offset ?origin?"} NONE} +test open-9.3 {seek command} { + list [catch {seek foo 0} msg] $msg $errorCode +} {1 {bad file identifier "foo"} NONE} +test open-9.4 {seek command} { + set f [open test2] + set x [list [catch {seek $f xyz} msg] $msg $errorCode] + close $f + set x +} {1 {expected integer but got "xyz"} NONE} +test open-9.5 {seek command} { + set f [open test2] + set x [list [catch {seek $f 100 gorp} msg] $msg $errorCode] + close $f + set x +} {1 {bad origin "gorp": should be start, current, or end} NONE} +set f [open test3 w] +puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +close $f +test open-9.6 {seek command} { + set f [open test3] + set x [read $f 1] + seek $f 3 + lappend x [read $f 1] + seek $f 0 start + lappend x [read $f 1] + seek $f 10 current + lappend x [read $f 1] + seek $f -2 end + lappend x [read $f 1] + seek $f 50 end + lappend x [read $f 1] + seek $f 1 + lappend x [read $f 1] + close $f + set x +} {a d a l Y {} b} + +test open-10.1 {tell command} { + list [catch {tell} msg] $msg $errorCode +} {1 {wrong # args: should be "tell fileId"} NONE} +test open-10.2 {tell command} { + list [catch {tell a b} msg] $msg $errorCode +} {1 {wrong # args: should be "tell fileId"} NONE} +test open-10.3 {tell command} { + list [catch {tell a} msg] $msg $errorCode +} {1 {bad file identifier "a"} NONE} +test open-10.4 {tell command} { + set f [open test2] + set x [tell $f] + read $f 3 + lappend x [tell $f] + seek $f 2 + lappend x [tell $f] + seek $f 10 current + lappend x [tell $f] + seek $f 0 end + lappend x [tell $f] + close $f + set x +} {0 3 2 12 30} + +test open-11.1 {eof command} { + list [catch {eof} msg] $msg $errorCode +} {1 {wrong # args: should be "eof fileId"} NONE} +test open-11.2 {eof command} { + list [catch {eof a b} msg] $msg $errorCode +} {1 {wrong # args: should be "eof fileId"} NONE} +test open-11.3 {eof command} { + list [catch {eof file100} msg] $msg $errorCode +} {1 {file "file100" isn't open} NONE} +test open-11.4 {eof command} { + set f [open test1] + set x [eof $f] + lappend x [eof $f] + gets $f + lappend x [eof $f] + gets $f + lappend x [eof $f] + gets $f + lappend x [eof $f] + lappend x [eof $f] + close $f + set x +} {0 0 0 0 1 1} + +test open-12.1 {flush command} { + list [catch {flush} msg] $msg $errorCode +} {1 {wrong # args: should be "flush fileId"} NONE} +test open-12.2 {flush command} { + list [catch {flush a b} msg] $msg $errorCode +} {1 {wrong # args: should be "flush fileId"} NONE} +test open-12.3 {flush command} { + list [catch {flush a} msg] $msg $errorCode +} {1 {bad file identifier "a"} NONE} +test open-12.4 {flush command} { + set f [open test3] + set x [list [catch {flush $f} msg] \ + [string range $msg [string first " " $msg] end] $errorCode] + close $f + set x +} {1 { wasn't opened for writing} NONE} +test open-12.5 {flush command} { + set f [open test3 w] + puts $f "Line 1" + puts $f "Line 2" + set f2 [open test3] + set x {} + lappend x [read -nonewline $f2] + close $f2 + flush $f + set f2 [open test3] + lappend x [read -nonewline $f2] + close $f2 + close $f + set x +} {{} {Line 1 +Line 2}} + +test open-13.1 {I/O to command pipelines} { + list [catch {open "| cat < test1 > test3" w} msg] $msg $errorCode +} {1 {can't write input to command: standard input was redirected} NONE} +test open-13.2 {I/O to command pipelines} { + list [catch {open "| echo > test3" r} msg] $msg $errorCode +} {1 {can't read output from command: standard output was redirected} NONE} +test open-13.3 {I/O to command pipelines} { + list [catch {open "| echo > test3" r+} msg] $msg $errorCode +} {1 {can't read output from command: standard output was redirected} NONE} +test open-13.4 {writing to command pipelines} { + exec rm test3 + set f [open "| cat | cat > test3" w] + puts $f "Line 1" + puts $f "Line 2" + close $f + exec cat test3 +} {Line 1 +Line 2} +test open-13.5 {reading from command pipelines} { + set f [open "| cat test2" r] + set x [list [gets $f] [gets $f] [gets $f]] + close $f + set x +} {line1 line2 line3} +test open-13.6 {both reading and writing from/to command pipelines} { + set f [open "| cat -u" r+] + puts $f "Line1" + flush $f + set x [gets $f] + close $f + set x +} {Line1} +test open-13.7 {errors in command pipelines} { + set f [open "|gorp"] + list [catch {close $f} msg] $msg [lindex $errorCode 0] [lindex $errorCode 2] +} {1 {couldn't find "gorp" to execute} CHILDSTATUS 1} +test open-13.8 {errors in command pipelines} { + set f [open "|gorp" w] + exec sleep 1 + puts $f output + set x [list [catch {flush $f} msg] [concat \ + [string range $msg 0 [string first {"} $msg]] \ + [string range $msg [string first : $msg] end]] $errorCode] + catch {close $f} + string tolower $x +} {1 {error flushing " : broken pipe} {posix epipe {broken pipe}}} +test open-13.9 {errors in command pipelines} { + set f [open "|gorp" w] + list [catch {close $f} msg] $msg \ + [lindex $errorCode 0] [lindex $errorCode 2] +} {1 {couldn't find "gorp" to execute} CHILDSTATUS 1} +test open-13.10 {errors in command pipelines} { + set f [open "|gorp" w] + exec sleep 1 + puts $f output + string tolower [list [catch {close $f} msg] [concat \ + [string range $msg 0 [string first {"} $msg]] \ + [string range $msg [string first : $msg] end]] \ + [lindex $errorCode 0] [lindex $errorCode 2]] +} {1 {error closing " : broken pipe +couldn't find "gorp" to execute} childstatus 1} + +test open-14.1 {POSIX open access modes: RDONLY} { + set f [open test1 RDONLY] + set x [list [gets $f] [catch {puts $f Test} msg] $msg] + close $f + + # The regsub is needed to avoid false errors if the file + # number varies from system to system. + + regsub {"file."} $x {"file"} x + set x +} {{Two lines: this one} 1 {"file" wasn't opened for writing}} +test open-14.2 {POSIX open access modes: RDONLY} { + catch {exec rm -f test3} + string tolower [list [catch {open test3 RDONLY} msg] $msg] +} {1 {couldn't open "test3": no such file or directory}} +test open-14.3 {POSIX open access modes: WRONLY} { + catch {exec rm -f test3} + string tolower [list [catch {open test3 WRONLY} msg] $msg] +} {1 {couldn't open "test3": no such file or directory}} +test open-14.4 {POSIX open access modes: WRONLY} { + exec echo xyzzy > test3 + set f [open test3 WRONLY] + puts -nonewline $f "ab" + seek $f 0 current + set x [list [catch {gets $f} msg] $msg] + close $f + lappend x [exec cat test3] + + # The regsub is needed to avoid false errors if the file + # number varies from system to system. + + regsub {"file."} $x {"file"} x + set x +} {1 {"file" wasn't opened for reading} abzzy} +test open-14.5 {POSIX open access modes: RDWR} { + catch {exec rm -f test3} + string tolower [list [catch {open test3 RDWR} msg] $msg] +} {1 {couldn't open "test3": no such file or directory}} +test open-14.6 {POSIX open access modes: RDWR} { + exec echo xyzzy > test3 + set f [open test3 RDWR] + puts -nonewline $f "ab" + seek $f 0 current + set x [gets $f] + close $f + lappend x [exec cat test3] +} {zzy abzzy} +test open-14.7 {POSIX open access modes: CREAT} { + catch {exec rm -f test3} + set f [open test3 {WRONLY CREAT} 0600] + file stat test3 stats + set x [format "0%o" [expr $stats(mode)&0777]] + puts $f "line 1" + close $f + lappend x [exec cat test3] +} {0600 {line 1}} +if $atBerkeley { + test open-14.8 {POSIX open access modes: CREAT} { + catch {exec rm -f test3} + set f [open test3 {WRONLY CREAT}] + close $f + file stat test3 stats + format "0%o" [expr $stats(mode)&0777] + } 0664 +} +test open-14.9 {POSIX open access modes: CREAT} { + exec echo xyzzy > test3 + set f [open test3 {WRONLY CREAT}] + puts -nonewline $f "ab" + close $f + exec cat test3 +} abzzy +test open-14.10 {POSIX open access modes: APPEND} { + exec echo xyzzy > test3 + set f [open test3 {WRONLY APPEND}] + puts $f "new line" + seek $f 0 + puts $f "abc" + close $f + exec cat test3 +} {xyzzy +new line +abc} +test open-14.11 {POSIX open access modes: EXCL} { + exec echo xyzzy > test3 + set msg [list [catch {open test3 {WRONLY CREAT EXCL}} msg] $msg] + regsub " already " $msg " " msg + string tolower $msg +} {1 {couldn't open "test3": file exists}} +test open-14.12 {POSIX open access modes: EXCL} { + catch {exec rm -f test3} + set x [catch {set f [open test3 {WRONLY CREAT EXCL}]}] + puts $f "A test line" + close $f + lappend x [exec cat test3] +} {0 {A test line}} +test open-14.13 {POSIX open access modes: TRUNC} { + exec echo xyzzy > test3 + set f [open test3 {WRONLY TRUNC}] + puts $f abc + close $f + exec cat test3 +} {abc} +if $atBerkeley { + test open-14.14 {POSIX open access modes: NOCTTY} { + catch {exec rm -f test3} + list [catch {open test3 {WRONLY NOCTTY CREAT}} msg] $msg + } {1 {access mode "NOCTTY" not supported by this system}} + test open-14.15 {POSIX open access modes: NONBLOCK} { + catch {exec rm -f test3} + set f [open test3 {WRONLY NONBLOCK CREAT}] + puts $f "NONBLOCK test" + close $f + exec cat test3 + } {NONBLOCK test} +} +test open-14.16 {POSIX open access modes: errors} { + concat [catch {open test3 "FOO \{BAR BAZ"} msg] $msg\n$errorInfo +} "1 unmatched open brace in list +unmatched open brace in list + while processing open access modes \"FOO {BAR BAZ\" + invoked from within +\"open test3 \"FOO \\{BAR BAZ\"\"" +test open-14.17 {POSIX open access modes: errors} { + list [catch {open test3 {FOO BAR BAZ}} msg] $msg +} {1 {invalid access mode "FOO": must be RDONLY, WRONLY, RDWR, APPEND, CREAT EXCL, NOCTTY, NONBLOCK, or TRUNC}} +test open-14.18 {POSIX open access modes: errors} { + list [catch {open test3 {TRUNC CREAT}} msg] $msg +} {1 {access mode must include either RDONLY, WRONLY, or RDWR}} + +catch {exec rm -f test1 test2 test3} +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/parse.test b/vendor/x11iraf/obm/Tcl/tests/parse.test new file mode 100644 index 00000000..fde51011 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/parse.test @@ -0,0 +1,429 @@ +# Commands covered: set (plus basic command syntax) +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/parse.test,v 1.24 93/07/28 13:07:14 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc fourArgs {a b c d} { + global arg1 arg2 arg3 arg4 + set arg1 $a + set arg2 $b + set arg3 $c + set arg4 $d +} + +proc getArgs args { + global argv + set argv $args +} + +# Basic argument parsing. + +test parse-1.1 {basic argument parsing} { + set arg1 {} + fourArgs a b c d + list $arg1 $arg2 $arg3 $arg4 +} {a b c d} +test parse-1.2 {basic argument parsing} { + set arg1 {} + eval "fourArgs 123\v4\f56\r7890" + list $arg1 $arg2 $arg3 $arg4 +} {123 4 56 7890} + +# Quotes. + +test parse-2.1 {quotes and variable-substitution} { + getArgs "a b c" d + set argv +} {{a b c} d} +test parse-2.2 {quotes and variable-substitution} { + set a 101 + getArgs "a$a b c" + set argv +} {{a101 b c}} +test parse-2.3 {quotes and variable-substitution} { + set argv "xy[format xabc]" + set argv +} {xyxabc} +test parse-2.4 {quotes and variable-substitution} { + set argv "xy\t" + set argv +} xy\t +test parse-2.5 {quotes and variable-substitution} { + set argv "a b c +d e f" + set argv +} a\ b\tc\nd\ e\ f +test parse-2.6 {quotes and variable-substitution} { + set argv a"bcd"e + set argv +} {a"bcd"e} + +# Braces. + +test parse-3.1 {braces} { + getArgs {a b c} d + set argv +} "{a b c} d" +test parse-3.2 {braces} { + set a 101 + set argv {a$a b c} + set b [string index $argv 1] + set b +} {$} +test parse-3.3 {braces} { + set argv {a[format xyz] b} + string length $argv +} 15 +test parse-3.4 {braces} { + set argv {a\nb\}} + string length $argv +} 6 +test parse-3.5 {braces} { + set argv {{{{}}}} + set argv +} "{{{}}}" +test parse-3.6 {braces} { + set argv a{{}}b + set argv +} "a{{}}b" +test parse-3.7 {braces} { + set a [format "last]"] + set a +} {last]} + +# Command substitution. + +test parse-4.1 {command substitution} { + set a [format xyz] + set a +} xyz +test parse-4.2 {command substitution} { + set a a[format xyz]b[format q] + set a +} axyzbq +test parse-4.3 {command substitution} { + set a a[ +set b 22; +format %s $b + +]b + set a +} a22b + +# Variable substitution. + +test parse-5.1 {variable substitution} { + set a 123 + set b $a + set b +} 123 +test parse-5.2 {variable substitution} { + set a 345 + set b x$a.b + set b +} x345.b +test parse-5.3 {variable substitution} { + set _123z xx + set b $_123z^ + set b +} xx^ +test parse-5.4 {variable substitution} { + set a 78 + set b a${a}b + set b +} a78b +test parse-5.5 {variable substitution} {catch {$_non_existent_} msg} 1 +test parse-5.6 {variable substitution} { + catch {$_non_existent_} msg + set msg +} {can't read "_non_existent_": no such variable} +test parse-5.7 {array variable substitution} { + catch {unset a} + set a(xyz) 123 + set b $a(xyz)foo + set b +} 123foo +test parse-5.8 {array variable substitution} { + catch {unset a} + set "a(x y z)" 123 + set b $a(x y z)foo + set b +} 123foo +test parse-5.9 {array variable substitution} { + catch {unset a}; catch {unset qqq} + set "a(x y z)" qqq + set $a([format x]\ y [format z]) foo + set qqq +} foo +test parse-5.10 {array variable substitution} { + catch {unset a} + list [catch {set b $a(22)} msg] $msg +} {1 {can't read "a(22)": no such variable}} +test parse-5.11 {array variable substitution} { + set b a$! + set b +} {a$!} +test parse-5.12 {array variable substitution} { + set b a$() + set b +} {a$()} +catch {unset a} +test parse-5.13 {array variable substitution} { + catch {unset a} + set long {This is a very long variable, long enough to cause storage \ + allocation to occur in Tcl_ParseVar. If that storage isn't getting \ + freed up correctly, then a core leak will occur when this test is \ + run. This text is probably beginning to sound like drivel, but I've \ + run out of things to say and I need more characters still.} + set a($long) 777 + set b $a($long) + list $b [array names a] +} {777 {{This is a very long variable, long enough to cause storage \ + allocation to occur in Tcl_ParseVar. If that storage isn't getting \ + freed up correctly, then a core leak will occur when this test is \ + run. This text is probably beginning to sound like drivel, but I've \ + run out of things to say and I need more characters still.}}} +test parse-5.14 {array variable substitution} { + catch {unset a}; catch {unset b}; catch {unset a1} + set a1(22) foo + set a(foo) bar + set b $a($a1(22)) + set b +} bar +catch {unset a}; catch {unset a1} + +# Backslash substitution. + +set errNum 1 +proc bsCheck {char num} { + global errNum + test parse-6.$errNum {backslash substitution} { + scan $char %c value + set value + } $num + set errNum [expr $errNum+1] +} + +bsCheck \b 8 +bsCheck \e 101 +bsCheck \f 12 +bsCheck \n 10 +bsCheck \r 13 +bsCheck \t 9 +bsCheck \v 11 +bsCheck \{ 123 +bsCheck \} 125 +bsCheck \[ 91 +bsCheck \] 93 +bsCheck \$ 36 +bsCheck \ 32 +bsCheck \; 59 +bsCheck \\ 92 +bsCheck \Ca 67 +bsCheck \Ma 77 +bsCheck \CMa 67 +bsCheck \8a 8 +bsCheck \14 12 +bsCheck \141 97 +bsCheck \340 224 +bsCheck b\0 98 +bsCheck \x 120 +bsCheck \xa 10 +bsCheck \x41 65 +bsCheck \x541 65 + +test parse-7.1 {backslash substitution} { + set a "\a\c\n\]\}" + string length $a +} 5 +test parse-7.2 {backslash substitution} { + set a {\a\c\n\]\}} + string length $a +} 10 +test parse-7.3 {backslash substitution} { + set a "abc\ +def" + set a +} {abc def} +test parse-7.4 {backslash substitution} { + set a {abc\ +def} + set a +} {abc def} +test parse-7.5 {backslash substitution} { + set msg {} + set a xxx + set error [catch {if {24 < \ + 35} {set a 22} {set \ + a 33}} msg] + list $error $msg $a +} {0 22 22} +test parse-7.6 {backslash substitution} { + eval "concat abc\\" +} "abc\\" +test parse-7.7 {backslash substitution} { + eval "concat \\\na" +} "a" +test parse-7.8 {backslash substitution} { + eval "concat x\\\n \na" +} "x a" +test parse-7.9 {backslash substitution} { + eval "concat \\x" +} "x" +test parse-7.10 {backslash substitution} { + eval "list a b\\\nc d" +} {a b c d} + +# Semi-colon. + +test parse-8.1 {semi-colons} { + set b 0 + getArgs a;set b 2 + set argv +} a +test parse-8.2 {semi-colons} { + set b 0 + getArgs a;set b 2 + set b +} 2 +test parse-8.3 {semi-colons} { + getArgs a b ; set b 1 + set argv +} {a b} +test parse-8.4 {semi-colons} { + getArgs a b ; set b 1 + set b +} 1 + +# The following checks are to ensure that the interpreter's result +# gets re-initialized by Tcl_Eval in all the right places. + +test parse-9.1 {result initialization} {concat abc} abc +test parse-9.2 {result initialization} {concat abc; proc foo {} {}} {} +test parse-9.3 {result initialization} {concat abc; proc foo {} $a} {} +test parse-9.4 {result initialization} {proc foo {} [concat abc]} {} +test parse-9.5 {result initialization} {concat abc; } abc +test parse-9.6 {result initialization} { + eval { + concat abc +}} abc +test parse-9.7 {result initialization} {} {} +test parse-9.8 {result initialization} {concat abc; ; ;} abc + +# Syntax errors. + +test parse-10.1 {syntax errors} {catch "set a \{bcd" msg} 1 +test parse-10.2 {syntax errors} { + catch "set a \{bcd" msg + set msg +} {missing close-brace} +test parse-10.3 {syntax errors} {catch {set a "bcd} msg} 1 +test parse-10.4 {syntax errors} { + catch {set a "bcd} msg + set msg +} {missing "} +test parse-10.5 {syntax errors} {catch {set a "bcd"xy} msg} 1 +test parse-10.6 {syntax errors} { + catch {set a "bcd"xy} msg + set msg +} {extra characters after close-quote} +test parse-10.7 {syntax errors} {catch "set a {bcd}xy" msg} 1 +test parse-10.8 {syntax errors} { + catch "set a {bcd}xy" msg + set msg +} {extra characters after close-brace} +test parse-10.9 {syntax errors} {catch {set a [format abc} msg} 1 +test parse-10.10 {syntax errors} { + catch {set a [format abc} msg + set msg +} {missing close-bracket} +test parse-10.11 {syntax errors} {catch gorp-a-lot msg} 1 +test parse-10.12 {syntax errors} { + catch gorp-a-lot msg + set msg +} {invalid command name: "gorp-a-lot"} +test parse-10.13 {syntax errors} { + set a [concat {a}\ + {b}] + set a +} {a b} +test parse-10.14 {syntax errors} {catch "concat \{a\}\\\n{b}" msg} 1 +test parse-10.15 {syntax errors} { + catch "concat \{a\}\\\n{b}" msg + set msg +} {extra characters after close-brace} + +# Long values (stressing storage management) + +set a {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH} + +test parse-11.1 {long values} { + string length $a +} 214 +test parse-11.2 {long values} { + llength $a +} 43 +test parse-1a1.3 {long values} { + set b "1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH" + set b +} $a +test parse-11.4 {long values} { + set b "$a" + set b +} $a +test parse-11.5 {long values} { + set b [set a] + set b +} $a +test parse-11.6 {long values} { + set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH] + string length $b +} 214 +test parse-11.7 {long values} { + set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH] + llength $b +} 43 +test parse-11.8 {long values} { + set b +} $a +test parse-11.9 {long values} { + set a [concat 0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ] + llength $a +} 62 +set i 0 +foreach j [concat 0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ] { + set test [string index 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ $i] + set test $test$test$test$test + set i [expr $i+1] + test parse-11.10 {long values} { + set j + } $test +} +test parse-11.10 {test buffer overflow in backslashes in braces} { + expr {"a" == {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101}} +} 0 diff --git a/vendor/x11iraf/obm/Tcl/tests/pid.test b/vendor/x11iraf/obm/Tcl/tests/pid.test new file mode 100644 index 00000000..b6023870 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/pid.test @@ -0,0 +1,58 @@ +# Commands covered: pid +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/pid.test,v 1.1 93/05/15 16:06:39 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {exec rm -f test1} + +test open-1.1 {pid command} { + regexp {^[0-9]+$} [pid] +} 1 +test open-1.2 {pid command} { + set f [open {| echo foo | cat > /dev/null} w] + set pids [pid $f] + close $f + list [llength $pids] [regexp {^[0-9]+$} [lindex $pids 0]] \ + [regexp {^[0-9]+$} [lindex $pids 1]] \ + [expr {[lindex $pids 0] == [lindex $pids 1]}] +} {2 1 1 0} +test open-1.3 {pid command} { + set f [open test1 w] + set pids [pid $f] + close $f + set pids +} {} +test open-1.4 {pid command} { + list [catch {pid a b} msg] $msg +} {1 {wrong # args: should be "pid ?fileId?"}} +test open-1.5 {pid command} { + list [catch {pid gorp} msg] $msg +} {1 {bad file identifier "gorp"}} + +catch {exec rm -f test1} +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/proc.test b/vendor/x11iraf/obm/Tcl/tests/proc.test new file mode 100644 index 00000000..f321b761 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/proc.test @@ -0,0 +1,450 @@ +# Commands covered: proc, return, global +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/proc.test,v 1.15 93/08/03 16:10:28 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc tproc {} {return a; return b} +test proc-1.1 {simple procedure call and return} {tproc} a +proc tproc x { + set x [expr $x+1] + return $x +} +test proc-1.2 {simple procedure call and return} {tproc 2} 3 +test proc-1.3 {simple procedure call and return} { + proc tproc {} {return foo} +} {} +test proc-1.4 {simple procedure call and return} { + proc tproc {} {return} + tproc +} {} + +test proc-2.1 {local and global variables} { + proc tproc x { + set x [expr $x+1] + return $x + } + set x 42 + list [tproc 6] $x +} {7 42} +test proc-2.2 {local and global variables} { + proc tproc x { + set y [expr $x+1] + return $y + } + set y 18 + list [tproc 6] $y +} {7 18} +test proc-2.3 {local and global variables} { + proc tproc x { + global y + set y [expr $x+1] + return $y + } + set y 189 + list [tproc 6] $y +} {7 7} +test proc-2.4 {local and global variables} { + proc tproc x { + global y + return [expr $x+$y] + } + set y 189 + list [tproc 6] $y +} {195 189} +catch {unset _undefined_} +test proc-2.5 {local and global variables} { + proc tproc x { + global _undefined_ + return $_undefined_ + } + list [catch {tproc xxx} msg] $msg +} {1 {can't read "_undefined_": no such variable}} +test proc-2.6 {local and global variables} { + set a 114 + set b 115 + global a b + list $a $b +} {114 115} + +proc do {cmd} {eval $cmd} +test proc-3.1 {local and global arrays} { + catch {unset a} + set a(0) 22 + list [catch {do {global a; set a(0)}} msg] $msg +} {0 22} +test proc-3.2 {local and global arrays} { + catch {unset a} + set a(x) 22 + list [catch {do {global a; set a(x) newValue}} msg] $msg $a(x) +} {0 newValue newValue} +test proc-3.3 {local and global arrays} { + catch {unset a} + set a(x) 22 + set a(y) 33 + list [catch {do {global a; unset a(y)}; array names a} msg] $msg +} {0 x} +test proc-3.4 {local and global arrays} { + catch {unset a} + set a(x) 22 + set a(y) 33 + list [catch {do {global a; unset a; info exists a}} msg] $msg \ + [info exists a] +} {0 0 0} +test proc-3.5 {local and global arrays} { + catch {unset a} + set a(x) 22 + set a(y) 33 + list [catch {do {global a; unset a(y); array names a}} msg] $msg +} {0 x} +catch {unset a} +test proc-3.6 {local and global arrays} { + catch {unset a} + set a(x) 22 + set a(y) 33 + do {global a; do {global a; unset a}; set a(z) 22} + list [catch {array names a} msg] $msg +} {0 z} +test proc-3.7 {local and global arrays} { + proc t1 {args} {global info; set info 1} + catch {unset a} + set info {} + do {global a; trace var a(1) w t1} + set a(1) 44 + set info +} 1 +test proc-3.8 {local and global arrays} { + proc t1 {args} {global info; set info 1} + catch {unset a} + trace var a(1) w t1 + set info {} + do {global a; trace vdelete a(1) w t1} + set a(1) 44 + set info +} {} +test proc-3.9 {local and global arrays} { + proc t1 {args} {global info; set info 1} + catch {unset a} + trace var a(1) w t1 + do {global a; trace vinfo a(1)} +} {{w t1}} +catch {unset a} + +test proc-3.1 {arguments and defaults} { + proc tproc {x y z} { + return [list $x $y $z] + } + tproc 11 12 13 +} {11 12 13} +test proc-3.2 {arguments and defaults} { + proc tproc {x y z} { + return [list $x $y $z] + } + list [catch {tproc 11 12} msg] $msg +} {1 {no value given for parameter "z" to "tproc"}} +test proc-3.3 {arguments and defaults} { + proc tproc {x y z} { + return [list $x $y $z] + } + list [catch {tproc 11 12 13 14} msg] $msg +} {1 {called "tproc" with too many arguments}} +test proc-3.4 {arguments and defaults} { + proc tproc {x {y y-default} {z z-default}} { + return [list $x $y $z] + } + tproc 11 12 13 +} {11 12 13} +test proc-3.5 {arguments and defaults} { + proc tproc {x {y y-default} {z z-default}} { + return [list $x $y $z] + } + tproc 11 12 +} {11 12 z-default} +test proc-3.6 {arguments and defaults} { + proc tproc {x {y y-default} {z z-default}} { + return [list $x $y $z] + } + tproc 11 +} {11 y-default z-default} +test proc-3.7 {arguments and defaults} { + proc tproc {x {y y-default} {z z-default}} { + return [list $x $y $z] + } + list [catch {tproc} msg] $msg +} {1 {no value given for parameter "x" to "tproc"}} +test proc-3.8 {arguments and defaults} { + list [catch { + proc tproc {x {y y-default} z} { + return [list $x $y $z] + } + tproc 2 3 + } msg] $msg +} {1 {no value given for parameter "z" to "tproc"}} +test proc-3.9 {arguments and defaults} { + proc tproc {x {y y-default} args} { + return [list $x $y $args] + } + tproc 2 3 4 5 +} {2 3 {4 5}} +test proc-3.10 {arguments and defaults} { + proc tproc {x {y y-default} args} { + return [list $x $y $args] + } + tproc 2 3 +} {2 3 {}} +test proc-3.11 {arguments and defaults} { + proc tproc {x {y y-default} args} { + return [list $x $y $args] + } + tproc 2 +} {2 y-default {}} +test proc-3.12 {arguments and defaults} { + proc tproc {x {y y-default} args} { + return [list $x $y $args] + } + list [catch {tproc} msg] $msg +} {1 {no value given for parameter "x" to "tproc"}} + +test proc-4.1 {variable numbers of arguments} { + proc tproc args {return $args} + tproc +} {} +test proc-4.2 {variable numbers of arguments} { + proc tproc args {return $args} + tproc 1 2 3 4 5 6 7 8 +} {1 2 3 4 5 6 7 8} +test proc-4.3 {variable numbers of arguments} { + proc tproc args {return $args} + tproc 1 {2 3} {4 {5 6} {{{7}}}} 8 +} {1 {2 3} {4 {5 6} {{{7}}}} 8} +test proc-4.4 {variable numbers of arguments} { + proc tproc {x y args} {return $args} + tproc 1 2 3 4 5 6 7 +} {3 4 5 6 7} +test proc-4.5 {variable numbers of arguments} { + proc tproc {x y args} {return $args} + tproc 1 2 +} {} +test proc-4.6 {variable numbers of arguments} { + proc tproc {x missing args} {return $args} + list [catch {tproc 1} msg] $msg +} {1 {no value given for parameter "missing" to "tproc"}} + +test proc-5.1 {error conditions} { + list [catch {proc} msg] $msg +} {1 {wrong # args: should be "proc name args body"}} +test proc-5.2 {error conditions} { + list [catch {proc tproc b} msg] $msg +} {1 {wrong # args: should be "proc name args body"}} +test proc-5.3 {error conditions} { + list [catch {proc tproc b c d e} msg] $msg +} {1 {wrong # args: should be "proc name args body"}} +test proc-5.4 {error conditions} { + list [catch {proc tproc \{xyz {return foo}} msg] $msg +} {1 {unmatched open brace in list}} +test proc-5.5 {error conditions} { + list [catch {proc tproc {{} y} {return foo}} msg] $msg +} {1 {procedure "tproc" has argument with no name}} +test proc-5.6 {error conditions} { + list [catch {proc tproc {{} y} {return foo}} msg] $msg +} {1 {procedure "tproc" has argument with no name}} +test proc-5.7 {error conditions} { + list [catch {proc tproc {{x 1 2} y} {return foo}} msg] $msg +} {1 {too many fields in argument specifier "x 1 2"}} +test proc-5.8 {error conditions} { + catch {return} +} 2 +test proc-5.9 {error conditions} { + list [catch {global} msg] $msg +} {1 {wrong # args: should be "global varName ?varName ...?"}} +proc tproc {} { + set a 22 + global a +} +test proc-5.10 {error conditions} { + list [catch {tproc} msg] $msg +} {1 {variable "a" already exists}} +test proc-5.11 {error conditions} { + catch {rename tproc {}} + catch { + proc tproc {x {} z} {return foo} + } + list [catch {tproc 1} msg] $msg +} {1 {invalid command name: "tproc"}} +test proc-5.12 {error conditions} { + proc tproc {} { + set a 22 + error "error in procedure" + return + } + list [catch tproc msg] $msg +} {1 {error in procedure}} +test proc-5.13 {error conditions} { + proc tproc {} { + set a 22 + error "error in procedure" + return + } + catch tproc msg + set errorInfo +} {error in procedure + while executing +"error "error in procedure"" + (procedure "tproc" line 3) + invoked from within +"tproc"} +test proc-5.14 {error conditions} { + proc tproc {} { + set a 22 + break + return + } + catch tproc msg + set errorInfo +} {invoked "break" outside of a loop + while executing +"tproc"} +test proc-5.15 {error conditions} { + proc tproc {} { + set a 22 + continue + return + } + catch tproc msg + set errorInfo +} {invoked "continue" outside of a loop + while executing +"tproc"} + +# The tests below will really only be useful when run under Purify or +# some other system that can detect accesses to freed memory... + +test proc-6.1 {procedure that redefines itself} { + proc tproc {} { + proc tproc {} { + return 44 + } + return 45 + } + tproc +} 45 +test proc-6.2 {procedure that deletes itself} { + proc tproc {} { + rename tproc {} + return 45 + } + tproc +} 45 + +proc tproc code { + return -code $code abc +} +test proc-7.1 {return with special completion code} { + list [catch {tproc ok} msg] $msg +} {0 abc} +test proc-7.2 {return with special completion code} { + list [catch {tproc error} msg] $msg $errorInfo $errorCode +} {1 abc {abc + while executing +"tproc error"} NONE} +test proc-7.3 {return with special completion code} { + list [catch {tproc return} msg] $msg +} {2 abc} +test proc-7.4 {return with special completion code} { + list [catch {tproc break} msg] $msg +} {3 abc} +test proc-7.5 {return with special completion code} { + list [catch {tproc continue} msg] $msg +} {4 abc} +test proc-7.6 {return with special completion code} { + list [catch {tproc -14} msg] $msg +} {-14 abc} +test proc-7.7 {return with special completion code} { + list [catch {tproc gorp} msg] $msg +} {1 {bad completion code "gorp": must be ok, error, return, break, continue, or an integer}} +test proc-7.8 {return with special completion code} { + list [catch {tproc 10b} msg] $msg +} {1 {bad completion code "10b": must be ok, error, return, break, continue, or an integer}} +test proc-7.9 {return with special completion code} { + proc tproc2 {} { + tproc return + } + list [catch tproc2 msg] $msg +} {0 abc} +test proc-7.10 {return with special completion code} { + proc tproc2 {} { + return -code error + } + list [catch tproc2 msg] $msg +} {1 {}} +test proc-7.11 {return with special completion code} { + proc tproc2 {} { + global errorCode errorInfo + catch {open _bad_file_name r} msg + return -code error -errorinfo $errorInfo -errorcode $errorCode $msg + } + string tolower [list [catch tproc2 msg] $msg $errorInfo $errorCode] +} {1 {couldn't open "_bad_file_name": no such file or directory} {couldn't open "_bad_file_name": no such file or directory + while executing +"open _bad_file_name r" + invoked from within +"tproc2"} {posix enoent {no such file or directory}}} +test proc-7.12 {return with special completion code} { + proc tproc2 {} { + global errorCode errorInfo + catch {open _bad_file_name r} msg + return -code error -errorcode $errorCode $msg + } + string tolower [list [catch tproc2 msg] $msg $errorInfo $errorCode] +} {1 {couldn't open "_bad_file_name": no such file or directory} {couldn't open "_bad_file_name": no such file or directory + while executing +"tproc2"} {posix enoent {no such file or directory}}} +test proc-7.13 {return with special completion code} { + proc tproc2 {} { + global errorCode errorInfo + catch {open _bad_file_name r} msg + return -code error -errorinfo $errorInfo $msg + } + string tolower [list [catch tproc2 msg] $msg $errorInfo $errorCode] +} {1 {couldn't open "_bad_file_name": no such file or directory} {couldn't open "_bad_file_name": no such file or directory + while executing +"open _bad_file_name r" + invoked from within +"tproc2"} none} +test proc-7.14 {return with special completion code} { + proc tproc2 {} { + global errorCode errorInfo + catch {open _bad_file_name r} msg + return -code error $msg + } + string tolower [list [catch tproc2 msg] $msg $errorInfo $errorCode] +} {1 {couldn't open "_bad_file_name": no such file or directory} {couldn't open "_bad_file_name": no such file or directory + while executing +"tproc2"} none} +test proc-7.14 {return with special completion code} { + list [catch {return -badOption foo message} msg] $msg +} {1 {bad option "-badOption: must be -code, -errorcode, or -errorinfo}} diff --git a/vendor/x11iraf/obm/Tcl/tests/regexp.test b/vendor/x11iraf/obm/Tcl/tests/regexp.test new file mode 100644 index 00000000..5f0bc7ce --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/regexp.test @@ -0,0 +1,324 @@ +# Commands covered: regexp, regsub +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/regexp.test,v 1.13 93/10/14 14:53:21 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {unset foo} +test regexp-1.1 {basic regexp operation} { + regexp ab*c abbbc +} 1 +test regexp-1.2 {basic regexp operation} { + regexp ab*c ac +} 1 +test regexp-1.3 {basic regexp operation} { + regexp ab*c ab +} 0 +test regexp-1.4 {basic regexp operation} { + regexp -- -gorp abc-gorpxxx +} 1 + +test regexp-2.1 {getting substrings back from regexp} { + set foo {} + list [regexp ab*c abbbbc foo] $foo +} {1 abbbbc} +test regexp-2.2 {getting substrings back from regexp} { + set foo {} + set f2 {} + list [regexp a(b*)c abbbbc foo f2] $foo $f2 +} {1 abbbbc bbbb} +test regexp-2.3 {getting substrings back from regexp} { + set foo {} + set f2 {} + list [regexp a(b*)(c) abbbbc foo f2] $foo $f2 +} {1 abbbbc bbbb} +test regexp-2.4 {getting substrings back from regexp} { + set foo {} + set f2 {} + set f3 {} + list [regexp a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3 +} {1 abbbbc bbbb c} +test regexp-2.5 {getting substrings back from regexp} { + set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {}; + set f6 {}; set f7 {}; set f8 {}; set f9 {} + list [regexp (1*)(2*)(3*)(4*)(5*)(6*)(7*)(8*)(9*) 12223345556789999 \ + foo f1 f2 f3 f4 f5 f6 f7 f8 f9] $foo $f1 $f2 $f3 $f4 $f5 \ + $f6 $f7 $f8 $f9 +} {1 12223345556789999 1 222 33 4 555 6 7 8 9999} +test regexp-2.6 {getting substrings back from regexp} { + set foo 2; set f2 2; set f3 2; set f4 2 + list [regexp (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4 +} {1 a a {} {}} +test regexp-2.7 {getting substrings back from regexp} { + set foo 1; set f2 1; set f3 1; set f4 1 + list [regexp (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4 +} {1 ac a {} c} + +test regexp-3.1 {-indices option to regexp} { + set foo {} + list [regexp -indices ab*c abbbbc foo] $foo +} {1 {0 5}} +test regexp-3.2 {-indices option to regexp} { + set foo {} + set f2 {} + list [regexp -indices a(b*)c abbbbc foo f2] $foo $f2 +} {1 {0 5} {1 4}} +test regexp-3.3 {-indices option to regexp} { + set foo {} + set f2 {} + list [regexp -indices a(b*)(c) abbbbc foo f2] $foo $f2 +} {1 {0 5} {1 4}} +test regexp-3.4 {-indices option to regexp} { + set foo {} + set f2 {} + set f3 {} + list [regexp -indices a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3 +} {1 {0 5} {1 4} {5 5}} +test regexp-3.5 {-indices option to regexp} { + set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {}; + set f6 {}; set f7 {}; set f8 {}; set f9 {} + list [regexp -indices (1*)(2*)(3*)(4*)(5*)(6*)(7*)(8*)(9*) \ + 12223345556789999 \ + foo f1 f2 f3 f4 f5 f6 f7 f8 f9] $foo $f1 $f2 $f3 $f4 $f5 \ + $f6 $f7 $f8 $f9 +} {1 {0 16} {0 0} {1 3} {4 5} {6 6} {7 9} {10 10} {11 11} {12 12} {13 16}} +test regexp-3.6 {getting substrings back from regexp} { + set foo 2; set f2 2; set f3 2; set f4 2 + list [regexp -indices (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4 +} {1 {1 1} {1 1} {-1 -1} {-1 -1}} +test regexp-3.7 {getting substrings back from regexp} { + set foo 1; set f2 1; set f3 1; set f4 1 + list [regexp -indices (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4 +} {1 {1 2} {1 1} {-1 -1} {2 2}} + +test regexp-4.1 {-nocase option to regexp} { + regexp -nocase foo abcFOo +} 1 +test regexp-4.2 {-nocase option to regexp} { + set f1 22 + set f2 33 + set f3 44 + list [regexp -nocase {a(b*)([xy]*)z} aBbbxYXxxZ22 f1 f2 f3] $f1 $f2 $f3 +} {1 aBbbxYXxxZ Bbb xYXxx} +test regexp-4.3 {-nocase option to regexp} { + regexp -nocase FOo abcFOo +} 1 +set x abcdefghijklmnopqrstuvwxyz1234567890 +set x $x$x$x$x$x$x$x$x$x$x$x$x +test regexp-4.4 {case conversion in regsub} { + list [regexp -nocase $x $x foo] $foo +} "1 $x" +unset x + +test regexp-5.1 {exercise cache of compiled expressions} { + regexp .*a b + regexp .*b c + regexp .*c d + regexp .*d e + regexp .*e f + regexp .*a bbba +} 1 +test regexp-5.2 {exercise cache of compiled expressions} { + regexp .*a b + regexp .*b c + regexp .*c d + regexp .*d e + regexp .*e f + regexp .*b xxxb +} 1 +test regexp-5.3 {exercise cache of compiled expressions} { + regexp .*a b + regexp .*b c + regexp .*c d + regexp .*d e + regexp .*e f + regexp .*c yyyc +} 1 +test regexp-5.4 {exercise cache of compiled expressions} { + regexp .*a b + regexp .*b c + regexp .*c d + regexp .*d e + regexp .*e f + regexp .*d 1d +} 1 +test regexp-5.5 {exercise cache of compiled expressions} { + regexp .*a b + regexp .*b c + regexp .*c d + regexp .*d e + regexp .*e f + regexp .*e xe +} 1 + +test regexp-6.1 {regexp errors} { + list [catch {regexp a} msg] $msg +} {1 {wrong # args: should be "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"}} +test regexp-6.2 {regexp errors} { + list [catch {regexp -nocase a} msg] $msg +} {1 {wrong # args: should be "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"}} +test regexp-6.3 {regexp errors} { + list [catch {regexp -gorp a} msg] $msg +} {1 {bad switch "-gorp": must be -indices, -nocase, or --}} +test regexp-6.4 {regexp errors} { + list [catch {regexp a( b} msg] $msg +} {1 {couldn't compile regular expression pattern: unmatched ()}} +test regexp-6.5 {regexp errors} { + list [catch {regexp a( b} msg] $msg +} {1 {couldn't compile regular expression pattern: unmatched ()}} +test regexp-6.6 {regexp errors} { + list [catch {regexp a a f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1} msg] $msg +} {1 {too many substring variables}} +test regexp-6.7 {regexp errors} { + set f1 44 + list [catch {regexp abc abc f1(f2)} msg] $msg +} {1 {couldn't set variable "f1(f2)"}} + +test regexp-7.1 {basic regsub operation} { + list [regsub aa+ xaxaaaxaa 111&222 foo] $foo +} {1 xax111aaa222xaa} +test regexp-7.2 {basic regsub operation} { + list [regsub aa+ aaaxaa &111 foo] $foo +} {1 aaa111xaa} +test regexp-7.3 {basic regsub operation} { + list [regsub aa+ xaxaaa 111& foo] $foo +} {1 xax111aaa} +test regexp-7.4 {basic regsub operation} { + list [regsub aa+ aaa 11&2&333 foo] $foo +} {1 11aaa2aaa333} +test regexp-7.5 {basic regsub operation} { + list [regsub aa+ xaxaaaxaa &2&333 foo] $foo +} {1 xaxaaa2aaa333xaa} +test regexp-7.6 {basic regsub operation} { + list [regsub aa+ xaxaaaxaa 1&22& foo] $foo +} {1 xax1aaa22aaaxaa} +test regexp-7.7 {basic regsub operation} { + list [regsub a(a+) xaxaaaxaa {1\122\1} foo] $foo +} {1 xax1aa22aaxaa} +test regexp-7.8 {basic regsub operation} { + list [regsub a(a+) xaxaaaxaa {1\\\122\1} foo] $foo +} "1 {xax1\\aa22aaxaa}" +test regexp-7.9 {basic regsub operation} { + list [regsub a(a+) xaxaaaxaa {1\\122\1} foo] $foo +} "1 {xax1\\122aaxaa}" +test regexp-7.10 {basic regsub operation} { + list [regsub a(a+) xaxaaaxaa {1\\&\1} foo] $foo +} "1 {xax1\\aaaaaxaa}" +test regexp-7.11 {basic regsub operation} { + list [regsub a(a+) xaxaaaxaa {1\&\1} foo] $foo +} {1 xax1&aaxaa} +test regexp-7.12 {basic regsub operation} { + list [regsub a(a+) xaxaaaxaa {\1\1\1\1&&} foo] $foo +} {1 xaxaaaaaaaaaaaaaaxaa} +test regexp-7.13 {basic regsub operation} { + set foo xxx + list [regsub abc xyz 111 foo] $foo +} {0 xyz} +test regexp-7.14 {basic regsub operation} { + set foo xxx + list [regsub ^ xyz "111 " foo] $foo +} {1 {111 xyz}} +test regexp-7.15 {basic regsub operation} { + set foo xxx + list [regsub -- -foo abc-foodef "111 " foo] $foo +} {1 {abc111 def}} +test regexp-7.16 {basic regsub operation} { + set foo xxx + list [regsub x "" y foo] $foo +} {0 {}} + +test regexp-8.1 {case conversion in regsub} { + list [regsub -nocase a(a+) xaAAaAAay & foo] $foo +} {1 xaAAaAAay} +test regexp-8.2 {case conversion in regsub} { + list [regsub -nocase a(a+) xaAAaAAay & foo] $foo +} {1 xaAAaAAay} +test regexp-8.3 {case conversion in regsub} { + set foo 123 + list [regsub a(a+) xaAAaAAay & foo] $foo +} {0 xaAAaAAay} +test regexp-8.4 {case conversion in regsub} { + set foo 123 + list [regsub -nocase a CaDE b foo] $foo +} {1 CbDE} +test regexp-8.5 {case conversion in regsub} { + set foo 123 + list [regsub -nocase XYZ CxYzD b foo] $foo +} {1 CbD} +test regexp-8.6 {case conversion in regsub} { + set x abcdefghijklmnopqrstuvwxyz1234567890 + set x $x$x$x$x$x$x$x$x$x$x$x$x + set foo 123 + list [regsub -nocase $x $x b foo] $foo +} {1 b} + +test regexp-9.1 {-all option to regsub} { + set foo 86 + list [regsub -all x+ axxxbxxcxdx |&| foo] $foo +} {1 a|xxx|b|xx|c|x|d|x|} +test regexp-9.2 {-all option to regsub} { + set foo 86 + list [regsub -nocase -all x+ aXxXbxxcXdx |&| foo] $foo +} {1 a|XxX|b|xx|c|X|d|x|} +test regexp-9.3 {-all option to regsub} { + set foo 86 + list [regsub x+ axxxbxxcxdx |&| foo] $foo +} {1 a|xxx|bxxcxdx} +test regexp-9.4 {-all option to regsub} { + set foo 86 + list [regsub -all bc axxxbxxcxdx |&| foo] $foo +} {0 axxxbxxcxdx} +test regexp-9.5 {-all option to regsub} { + set foo xxx + list [regsub -all node "node node more" yy foo] $foo +} {1 {yy yy more}} +test regexp-9.6 {-all option to regsub} { + set foo xxx + list [regsub -all ^ xxx 123 foo] $foo +} {1 123xxx} + +test regexp-10.1 {regsub errors} { + list [catch {regsub a b c} msg] $msg +} {1 {wrong # args: should be "regsub ?switches? exp string subSpec varName"}} +test regexp-10.2 {regsub errors} { + list [catch {regsub -nocase a b c} msg] $msg +} {1 {wrong # args: should be "regsub ?switches? exp string subSpec varName"}} +test regexp-10.3 {regsub errors} { + list [catch {regsub -nocase -all a b c} msg] $msg +} {1 {wrong # args: should be "regsub ?switches? exp string subSpec varName"}} +test regexp-10.4 {regsub errors} { + list [catch {regsub a b c d e f} msg] $msg +} {1 {wrong # args: should be "regsub ?switches? exp string subSpec varName"}} +test regexp-10.5 {regsub errors} { + list [catch {regsub -gorp a b c} msg] $msg +} {1 {bad switch "-gorp": must be -all, -nocase, or --}} +test regexp-10.6 {regsub errors} { + list [catch {regsub -nocase a( b c d} msg] $msg +} {1 {couldn't compile regular expression pattern: unmatched ()}} +test regexp-10.7 {regsub errors} { + list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg +} {1 {couldn't set variable "f1(f2)"}} diff --git a/vendor/x11iraf/obm/Tcl/tests/rename.test b/vendor/x11iraf/obm/Tcl/tests/rename.test new file mode 100644 index 00000000..c5c8d922 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/rename.test @@ -0,0 +1,78 @@ +# Commands covered: rename +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/rename.test,v 1.5 93/02/06 15:54:23 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {rename r2 {}} +proc r1 {} {return "procedure r1"} +rename r1 r2 +test rename-1.1 {simple renaming} { + r2 +} {procedure r1} +test rename-1.2 {simple renaming} { + list [catch r1 msg] $msg +} {1 {invalid command name: "r1"}} +rename r2 {} +test rename-1.3 {simple renaming} { + list [catch r2 msg] $msg +} {1 {invalid command name: "r2"}} + +# The test below is tricky because it renames a built-in command. +# It's possible that the test procedure uses this command, so must +# restore the command before calling test again. + +rename list l.new +set a [catch list msg1] +set b [l.new a b c] +rename l.new list +set c [catch l.new msg2] +set d [list 111 222] +test 2.1 {renaming built-in command} { + list $a $msg1 $b $c $msg2 $d +} {1 {invalid command name: "list"} {a b c} 1 {invalid command name: "l.new"} {111 222}} + +test rename-3.1 {error conditions} { + list [catch {rename r1} msg] $msg $errorCode +} {1 {wrong # args: should be "rename oldName newName"} NONE} +test rename-3.2 {error conditions} { + list [catch {rename r1 r2 r3} msg] $msg $errorCode +} {1 {wrong # args: should be "rename oldName newName"} NONE} +test rename-3.3 {error conditions} { + proc r1 {} {} + proc r2 {} {} + list [catch {rename r1 r2} msg] $msg +} {1 {can't rename to "r2": command already exists}} +test rename-3.4 {error conditions} { + catch {rename r1 {}} + catch {rename r2 {}} + list [catch {rename r1 r2} msg] $msg +} {1 {can't rename "r1": command doesn't exist}} +test rename-3.5 {error conditions} { + catch {rename _non_existent_command {}} + list [catch {rename _non_existent_command {}} msg] $msg +} {1 {can't delete "_non_existent_command": command doesn't exist}} diff --git a/vendor/x11iraf/obm/Tcl/tests/scan.test b/vendor/x11iraf/obm/Tcl/tests/scan.test new file mode 100644 index 00000000..c0219d5f --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/scan.test @@ -0,0 +1,276 @@ +# Commands covered: scan +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/scan.test,v 1.17 93/10/07 10:39:35 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test scan-1.1 {integer scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "-20 1476 \n33 0" "%d %d %d %d" a b c d] $a $b $c $d +} {4 -20 1476 33 0} +test scan-1.2 {integer scanning} { + set a {}; set b {}; set c {} + list [scan "-45 16 7890 +10" "%2d %*d %10d %d" a b c] $a $b $c +} {3 -4 16 7890} +test scan-1.3 {integer scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "-45 16 +10 987" "%ld %d %ld %d" a b c d] $a $b $c $d +} {4 -45 16 10 987} +test scan-1.4 {integer scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "14 1ab 62 10" "%d %x %lo %x" a b c d] $a $b $c $d +} {4 14 427 50 16} +test scan-1.5 {integer scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "12345670 1234567890ab cdefg" "%o %o %x %lx" a b c d] \ + $a $b $c $d +} {4 2739128 342391 561323 52719} +test scan-1.6 {integer scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "ab123-24642" "%2x %3x %3o %2o" a b c d] $a $b $c $d +} {4 171 291 -20 52} +test scan-1.7 {integer scanning} { + set a {}; set b {} + list [scan "1234567 234 567 " "%*3x %x %*o %4o" a b] $a $b +} {2 17767 375} +test scan-1.8 {integer scanning} { + set a {}; set b {} + list [scan "a 1234" "%d %d" a b] $a $b +} {0 {} {}} +test scan-1.9 {integer scanning} { + set a {}; set b {}; set c {}; set d {}; + list [scan "12345678" "%2d %2d %2ld %2d" a b c d] $a $b $c $d +} {4 12 34 56 78} +test scan-1.10 {integer scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "1 2 " "%hd %d %d %d" a b c d] $a $b $c $d +} {2 1 2 {} {}} +if $atBerkeley { + test scan-1.11 {integer scanning} { + set a {}; set b {}; + list [scan "4294967280 4294967280" "%u %d" a b] $a $b + } {2 4294967280 -16} +} + +test scan-2.1 {floating-point scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "2.1 -3.0e8 .99962 a" "%f%g%e%f" a b c d] $a $b $c $d +} {3 2.1 -3e+08 0.99962 {}} +test scan-2.2 {floating-point scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "-1.2345 +8.2 9" "%3e %3lf %f %f" a b c d] $a $b $c $d +} {4 -1.0 234.0 5.0 8.2} +test scan-2.3 {floating-point scanning} { + set a {}; set b {}; set c {} + list [scan "1e00004 332E-4 3e+4" "%Lf %*2e %f %f" a b c] $a $c +} {3 10000.0 30000.0} +if $atBerkeley { + test scan-2.4 {floating-point scanning} { + set a {}; set b {}; set c {} + list [scan "1. 47.6 2.e2 3.e-" "%f %*f %f %f" a b c] $a $b $c + } {3 1.0 200.0 3.0} + test scan-2.5 {floating-point scanning} { + set a {}; set b {} + list [scan "1.eabc" "%f %x" a b] $a $b + } {2 1.0 2748} +} +test scan-2.6 {floating-point scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "4.6 99999.7 876.43e-1 118" "%f %f %f %e" a b c d] $a $b $c $d +} {4 4.6 99999.7 87.643 118.0} +test scan-2.7 {floating-point scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "1.2345 697.0e-3 124 .00005" "%f %e %f %e" a b c d] $a $b $c $d +} {4 1.2345 0.697 124.0 5e-05} +test scan-2.8 {floating-point scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "4.6abc" "%f %f %f %f" a b c d] $a $b $c $d +} {1 4.6 {} {} {}} +test scan-2.9 {floating-point scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "4.6 5.2" "%f %f %f %f" a b c d] $a $b $c $d +} {2 4.6 5.2 {} {}} + +test scan-3.1 {string and character scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "abc defghijk dum " "%s %3s %20s %s" a b c d] $a $b $c $d +} {4 abc def ghijk dum} +test scan-3.2 {string and character scanning} { + set a {}; set b {}; set c {}; set d {} + list [scan "a bcdef" "%c%c%1s %s" a b c d] $a $b $c $d +} {4 97 32 b cdef} +test scan-3.3 {string and character scanning} { + set a {}; set b {}; set c {} + list [scan "123456 test " "%*c%*s %s %s %s" a b c] $a $b $c +} {1 test {} {}} +test scan-3.4 {string and character scanning} { + set a {}; set b {}; set c {}; set d + list [scan "ababcd01234 f 123450" {%4[abcd] %4[abcd] %[^abcdef] %[^0]} a b c d] $a $b $c $d +} {4 abab cd {01234 } {f 12345}} +test scan-3.5 {string and character scanning} { + set a {}; set b {}; set c {} + list [scan "aaaaaabc aaabcdefg + + XYZQR" {%*4[a] %s %*4[a]%s%*4[ +]%c} a b c] $a $b $c +} {3 aabc bcdefg 43} + +test scan-4.1 {error conditions} { + catch {scan a} +} 1 +test scan-4.2 {error conditions} { + catch {scan a} msg + set msg +} {wrong # args: should be "scan string format ?varName varName ...?"} +test scan-4.3 {error conditions} { + catch {scan "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21" "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21} +} 1 +test scan-4.4 {error conditions} { + catch {scan "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21" "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21} msg + set msg +} {too many fields to scan} +test scan-4.5 {error conditions} { + list [catch {scan a %D} msg] $msg +} {1 {bad scan conversion character "D"}} +test scan-4.6 {error conditions} { + list [catch {scan a %O} msg] $msg +} {1 {bad scan conversion character "O"}} +test scan-4.7 {error conditions} { + list [catch {scan a %X} msg] $msg +} {1 {bad scan conversion character "X"}} +test scan-4.8 {error conditions} { + list [catch {scan a %F} msg] $msg +} {1 {bad scan conversion character "F"}} +test scan-4.9 {error conditions} { + list [catch {scan a %E} msg] $msg +} {1 {bad scan conversion character "E"}} +test scan-4.10 {error conditions} { + list [catch {scan a "%d %d" a} msg] $msg +} {1 {different numbers of variable names and field specifiers}} +test scan-4.11 {error conditions} { + list [catch {scan a "%d %d" a b c} msg] $msg +} {1 {different numbers of variable names and field specifiers}} +test scan-4.12 {error conditions} { + set a {}; set b {}; set c {}; set d {} + list [expr {[scan " a" " a %d %d %d %d" a b c d] <= 0}] $a $b $c $d +} {1 {} {} {} {}} +test scan-4.13 {error conditions} { + set a {}; set b {}; set c {}; set d {} + list [scan "1 2" "%d %d %d %d" a b c d] $a $b $c $d +} {2 1 2 {} {}} +test scan-4.14 {error conditions} { + catch {unset a} + set a(0) 44 + list [catch {scan 44 %d a} msg] $msg +} {1 {couldn't set variable "a"}} +test scan-4.15 {error conditions} { + catch {unset a} + set a(0) 44 + list [catch {scan 44 %c a} msg] $msg +} {1 {couldn't set variable "a"}} +test scan-4.16 {error conditions} { + catch {unset a} + set a(0) 44 + list [catch {scan 44 %s a} msg] $msg +} {1 {couldn't set variable "a"}} +test scan-4.17 {error conditions} { + catch {unset a} + set a(0) 44 + list [catch {scan 44 %f a} msg] $msg +} {1 {couldn't set variable "a"}} +test scan-4.18 {error conditions} { + catch {unset a} + set a(0) 44 + list [catch {scan 44 %f a} msg] $msg +} {1 {couldn't set variable "a"}} +catch {unset a} +test scan-4.19 {error conditions} { + list [catch {scan 44 %2c a} msg] $msg +} {1 {field width may not be specified in %c conversion}} + +test scan-5.1 {lots of arguments} { + scan "10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200" "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 +} 20 +test scan-5.2 {lots of arguments} { + scan "10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200" "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 + set a20 +} 200 + +test scan-6.1 {miscellaneous tests} { + set a {} + list [scan ab16c ab%dc a] $a +} {1 16} +test scan-6.2 {miscellaneous tests} { + set a {} + list [scan ax16c ab%dc a] $a +} {0 {}} +test scan-6.3 {miscellaneous tests} { + set a {} + list [catch {scan ab%c114 ab%%c%d a} msg] $msg $a +} {0 1 114} +test scan-6.4 {miscellaneous tests} { + set a {} + list [catch {scan ab%c14 ab%%c%d a} msg] $msg $a +} {0 1 14} +test scan-6.5 {miscellaneous tests} { + catch {unset tcl_precision} + set a {} + scan 1.111122223333 %f a + set a +} {1.11112} +test scan-6.6 {miscellaneous tests} { + set tcl_precision 10 + set a {} + scan 1.111122223333 %lf a + unset tcl_precision + set a +} {1.111122223} +test scan-6.7 {miscellaneous tests} { + set tcl_precision 10 + set a {} + scan 1.111122223333 %f a + unset tcl_precision + set a +} {1.111122223} + +test scan-7.1 {alignment in results array (TCL_ALIGN)} { + scan "123 13.6" "%s %f" a b + set b +} 13.6 +test scan-7.2 {alignment in results array (TCL_ALIGN)} { + scan "1234567 13.6" "%s %f" a b + set b +} 13.6 +test scan-7.3 {alignment in results array (TCL_ALIGN)} { + scan "12345678901 13.6" "%s %f" a b + set b +} 13.6 +test scan-7.4 {alignment in results array (TCL_ALIGN)} { + scan "123456789012345 13.6" "%s %f" a b + set b +} 13.6 +test scan-7.5 {alignment in results array (TCL_ALIGN)} { + scan "1234567890123456789 13.6" "%s %f" a b + set b +} 13.6 diff --git a/vendor/x11iraf/obm/Tcl/tests/set.test b/vendor/x11iraf/obm/Tcl/tests/set.test new file mode 100644 index 00000000..f8622e32 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/set.test @@ -0,0 +1,584 @@ +# Commands covered: set, unset, array +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/set.test,v 1.12 93/07/21 09:18:48 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc ignore args {} + +# Simple variable operations. + +catch {unset a} +test set-1.1 {basic variable setting and unsetting} { + set a 22 +} 22 +test set-1.2 {basic variable setting and unsetting} { + set a 123 + set a +} 123 +test set-1.3 {basic variable setting and unsetting} { + set a xxx + format %s $a +} xxx +test set-1.4 {basic variable setting and unsetting} { + set a 44 + unset a + list [catch {set a} msg] $msg +} {1 {can't read "a": no such variable}} + +# Basic array operations. + +catch {unset a} +set a(xyz) 2 +set a(44) 3 +set {a(a long name)} test +test set-2.1 {basic array operations} { + lsort [array names a] +} {44 {a long name} xyz} +test set-2.2 {basic array operations} { + set a(44) +} 3 +test set-2.3 {basic array operations} { + set a(xyz) +} 2 +test set-2.4 {basic array operations} { + set "a(a long name)" +} test +test set-2.5 {basic array operations} { + list [catch {set a(other)} msg] $msg +} {1 {can't read "a(other)": no such element in array}} +test set-2.6 {basic array operations} { + list [catch {set a} msg] $msg +} {1 {can't read "a": no such variable}} +test set-2.7 {basic array operations} { + format %s $a(44) +} 3 +test set-2.8 {basic array operations} { + format %s $a(a long name) +} test +unset a(44) +test set-2.9 {basic array operations} { + lsort [array names a] +} {{a long name} xyz} +test set-2.10 {basic array operations} { + catch {unset b} + list [catch {set b(123)} msg] $msg +} {1 {can't read "b(123)": no such variable}} +test set-2.11 {basic array operations} { + catch {unset b} + set b 44 + list [catch {set b(123)} msg] $msg +} {1 {can't read "b(123)": variable isn't array}} +test set-2.12 {basic array operations} { + list [catch {set a} msg] $msg +} {1 {can't read "a": no such variable}} +test set-2.13 {basic array operations} { + list [catch {set a 14} msg] $msg +} {1 {can't set "a": variable is array}} +unset a +test set-2.14 {basic array operations} { + list [catch {set a(xyz)} msg] $msg +} {1 {can't read "a(xyz)": no such variable}} + +# Test the set commands, and exercise the corner cases of the code +# that parses array references into two parts. + +test set-3.1 {set command} { + list [catch {set} msg] $msg +} {1 {wrong # args: should be "set varName ?newValue?"}} +test set-3.2 {set command} { + list [catch {set x y z} msg] $msg +} {1 {wrong # args: should be "set varName ?newValue?"}} +test set-3.3 {set command} { + catch {unset a} + list [catch {set a} msg] $msg +} {1 {can't read "a": no such variable}} +test set-3.4 {set command} { + catch {unset a} + set a(14) 83 + list [catch {set a 22} msg] $msg +} {1 {can't set "a": variable is array}} + +# Test the corner-cases of parsing array names, using set and unset. + +test set-4.1 {parsing array names} { + catch {unset a} + set a(()) 44 + list [catch {array names a} msg] $msg +} {0 ()} +test set-4.2 {parsing array names} { + catch {unset a a(abcd} + set a(abcd 33 + info exists a(abcd +} 1 +test set-4.3 {parsing array names} { + catch {unset a a(abcd} + set a(abcd 33 + list [catch {array names a} msg] $msg +} {1 {"a" isn't an array}} +test set-4.4 {parsing array names} { + catch {unset a abcd)} + set abcd) 33 + info exists abcd) +} 1 +test set-4.5 {parsing array names} { + set a(bcd yyy + catch {unset a} + list [catch {set a(bcd} msg] $msg +} {0 yyy} +test set-4.6 {parsing array names} { + catch {unset a} + set a 44 + list [catch {set a(bcd test} msg] $msg +} {0 test} + +# Errors in reading variables + +test set-5.1 {errors in reading variables} { + catch {unset a} + list [catch {set a} msg] $msg +} {1 {can't read "a": no such variable}} +test set-5.2 {errors in reading variables} { + catch {unset a} + set a 44 + list [catch {set a(18)} msg] $msg +} {1 {can't read "a(18)": variable isn't array}} +test set-5.3 {errors in reading variables} { + catch {unset a} + set a(6) 44 + list [catch {set a(18)} msg] $msg +} {1 {can't read "a(18)": no such element in array}} +test set-5.4 {errors in reading variables} { + catch {unset a} + set a(6) 44 + list [catch {set a} msg] $msg +} {1 {can't read "a": no such variable}} + +# Errors and other special cases in writing variables + +test set-6.1 {creating array during write} { + catch {unset a} + trace var a rwu ignore + list [catch {set a(14) 186} msg] $msg [array names a] +} {0 186 14} +test set-6.2 {errors in writing variables} { + catch {unset a} + set a xxx + list [catch {set a(14) 186} msg] $msg +} {1 {can't set "a(14)": variable isn't array}} +test set-6.3 {errors in writing variables} { + catch {unset a} + set a(100) yyy + list [catch {set a 2} msg] $msg +} {1 {can't set "a": variable is array}} +test set-6.4 {expanding variable size} { + catch {unset a} + list [set a short] [set a "longer name"] [set a "even longer name"] \ + [set a "a much much truly longer name"] +} {short {longer name} {even longer name} {a much much truly longer name}} + +# Unset command, Tcl_UnsetVar procedures + +test set-7.1 {unset command} { + catch {unset a}; catch {unset b}; catch {unset c}; catch {unset d} + set a 44 + set b 55 + set c 66 + set d 77 + unset a b c + list [catch {set a(0) 0}] [catch {set b(0) 0}] [catch {set c(0) 0}] \ + [catch {set d(0) 0}] +} {0 0 0 1} +test set-7.2 {unset command} { + list [catch {unset} msg] $msg +} {1 {wrong # args: should be "unset varName ?varName ...?"}} +test set-7.3 {unset command} { + catch {unset a} + list [catch {unset a} msg] $msg +} {1 {can't unset "a": no such variable}} +test set-7.4 {unset command} { + catch {unset a} + set a 44 + list [catch {unset a(14)} msg] $msg +} {1 {can't unset "a(14)": variable isn't array}} +test set-7.5 {unset command} { + catch {unset a} + set a(0) xx + list [catch {unset a(14)} msg] $msg +} {1 {can't unset "a(14)": no such element in array}} +test set-7.6 {unset command} { + catch {unset a}; catch {unset b}; catch {unset c} + set a foo + set c gorp + list [catch {unset a a a(14)} msg] $msg [info exists c] +} {1 {can't unset "a": no such variable} 1} +test set-7.7 {unsetting globals from within procedures} { + set y 0 + proc p1 {} { + global y + set z [p2] + return [list $z [catch {set y} msg] $msg] + } + proc p2 {} {global y; unset y; list [catch {set y} msg] $msg} + p1 +} {{1 {can't read "y": no such variable}} 1 {can't read "y": no such variable}} +test set-7.8 {unsetting globals from within procedures} { + set y 0 + proc p1 {} { + global y + p2 + return [list [catch {set y 44} msg] $msg] + } + proc p2 {} {global y; unset y} + concat [p1] [list [catch {set y} msg] $msg] +} {0 44 0 44} +test set-7.9 {unsetting globals from within procedures} { + set y 0 + proc p1 {} { + global y + unset y + return [list [catch {set y 55} msg] $msg] + } + concat [p1] [list [catch {set y} msg] $msg] +} {0 55 0 55} +test set-7.10 {unset command} { + catch {unset a} + set a(14) 22 + unset a(14) + list [catch {set a(14)} msg] $msg [catch {array names a} msg2] $msg2 +} {1 {can't read "a(14)": no such element in array} 0 {}} +test set-7.11 {unset command} { + catch {unset a} + set a(14) 22 + unset a + list [catch {set a(14)} msg] $msg [catch {array names a} msg2] $msg2 +} {1 {can't read "a(14)": no such variable} 1 {"a" isn't an array}} + +# Array command. + +test set-8.1 {array command} { + list [catch {array} msg] $msg +} {1 {wrong # args: should be "array option arrayName ?arg ...?"}} +test set-8.2 {array command} { + catch {unset a} + list [catch {array names a} msg] $msg +} {1 {"a" isn't an array}} +test set-8.3 {array command} { + catch {unset a} + set a 44 + list [catch {array names a} msg] $msg +} {1 {"a" isn't an array}} +test set-8.4 {array command} { + catch {unset a} + set a(22) 3 + list [catch {array gorp a} msg] $msg +} {1 {bad option "gorp": should be anymore, donesearch, names, nextelement, size, or startsearch}} +test set-8.5 {array command, names option} { + catch {unset a} + set a(22) 3 + list [catch {array names a 4} msg] $msg +} {1 {wrong # args: should be "array names arrayName"}} +test set-8.6 {array command, names option} { + catch {unset a} + set a(22) 3; set a(Textual_name) 44; set "a(name with spaces)" xxx + list [catch {lsort [array names a]} msg] $msg +} {0 {22 Textual_name {name with spaces}}} +test set-8.7 {array command, names option} { + catch {unset a} + set a(22) 3; set a(33) 44; + trace var a(xxx) w ignore + list [catch {lsort [array names a]} msg] $msg +} {0 {22 33}} +test set-8.8 {array command, names option} { + catch {unset a} + set a(22) 3; set a(33) 44; + trace var a(xxx) w ignore + set a(xxx) value + list [catch {lsort [array names a]} msg] $msg +} {0 {22 33 xxx}} +test set-8.9 {array command, size option} { + catch {unset a} + set a(22) 3 + list [catch {array size a 4} msg] $msg +} {1 {wrong # args: should be "array size arrayName"}} +test set-8.10 {array command, size option} { + catch {unset a} + set a(22) 3; set a(Textual_name) 44; set "a(name with spaces)" xxx + list [catch {array size a} msg] $msg +} {0 3} +test set-8.10 {array command, size option} { + catch {unset a} + set a(22) 3; set a(xx) 44; set a(y) xxx + unset a(22) a(y) a(xx) + list [catch {array size a} msg] $msg +} {0 0} +test set-8.11 {array command, size option} { + catch {unset a} + set a(22) 3; + trace var a(33) rwu ignore + list [catch {array size a} msg] $msg +} {0 1} + +test set-9.1 {ids for array enumeration} { + catch {unset a} + set a(a) 1 + list [array st a] [array st a] [array done a s-1-a; array st a] \ + [array done a s-2-a; array d a s-3-a; array start a] +} {s-1-a s-2-a s-3-a s-1-a} +test set-9.2 {array enumeration} { + catch {unset a} + set a(a) 1 + set a(b) 1 + set a(c) 1 + set x [array startsearch a] + list [array nextelement a $x] [array ne a $x] [array next a $x] \ + [array next a $x] [array next a $x] +} {a b c {} {}} +test set-9.3 {array enumeration} { + catch {unset a} + set a(a) 1 + set a(b) 1 + set a(c) 1 + set x [array startsearch a] + set y [array startsearch a] + set z [array startsearch a] + list [array nextelement a $x] [array ne a $x] \ + [array next a $y] [array next a $z] [array next a $y] \ + [array next a $z] [array next a $y] [array next a $z] \ + [array next a $y] [array next a $z] [array next a $x] \ + [array next a $x] +} {a b a a b b c c {} {} c {}} +test set-9.4 {array enumeration: stopping searches} { + catch {unset a} + set a(a) 1 + set a(b) 1 + set a(c) 1 + set x [array startsearch a] + set y [array startsearch a] + set z [array startsearch a] + list [array next a $x] [array next a $x] [array next a $y] \ + [array done a $z; array next a $x] \ + [array done a $x; array next a $y] [array next a $y] +} {a b a c b c} +test set-9.5 {array enumeration: stopping searches} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + array done a $x + list [catch {array next a $x} msg] $msg +} {1 {couldn't find search "s-1-a"}} +test set-9.6 {array enumeration: searches automatically stopped} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + set y [array startsearch a] + set a(b) 1 + list [catch {array next a $x} msg] $msg \ + [catch {array next a $y} msg2] $msg2 +} {1 {couldn't find search "s-1-a"} 1 {couldn't find search "s-2-a"}} +test set-9.7 {array enumeration: searches automatically stopped} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + set y [array startsearch a] + set a(a) 2 + list [catch {array next a $x} msg] $msg \ + [catch {array next a $y} msg2] $msg2 +} {0 a 0 a} +test set-9.8 {array enumeration: searches automatically stopped} { + catch {unset a} + set a(a) 1 + set a(c) 2 + set x [array startsearch a] + set y [array startsearch a] + catch {unset a(c)} + list [catch {array next a $x} msg] $msg \ + [catch {array next a $y} msg2] $msg2 +} {1 {couldn't find search "s-1-a"} 1 {couldn't find search "s-2-a"}} +test set-9.9 {array enumeration: searches automatically stopped} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + set y [array startsearch a] + catch {unset a(c)} + list [catch {array next a $x} msg] $msg \ + [catch {array next a $y} msg2] $msg2 +} {0 a 0 a} +test set-9.10 {array enumeration: searches automatically stopped} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + set y [array startsearch a] + trace var a(b) r {} + list [catch {array next a $x} msg] $msg \ + [catch {array next a $y} msg2] $msg2 +} {1 {couldn't find search "s-1-a"} 1 {couldn't find search "s-2-a"}} +test set-9.11 {array enumeration: searches automatically stopped} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + set y [array startsearch a] + trace var a(a) r {} + list [catch {array next a $x} msg] $msg \ + [catch {array next a $y} msg2] $msg2 +} {0 a 0 a} +test set-9.12 {array enumeration with traced undefined elements} { + catch {unset a} + set a(a) 1 + trace var a(b) r {} + set x [array startsearch a] + list [array next a $x] [array next a $x] +} {a {}} + +test set-10.1 {array enumeration errors} { + list [catch {array start} msg] $msg +} {1 {wrong # args: should be "array option arrayName ?arg ...?"}} +test set-10.2 {array enumeration errors} { + list [catch {array start a b} msg] $msg +} {1 {wrong # args: should be "array startsearch arrayName"}} +test set-10.3 {array enumeration errors} { + catch {unset a} + list [catch {array start a} msg] $msg +} {1 {"a" isn't an array}} +test set-10.4 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a} msg] $msg +} {1 {wrong # args: should be "array nextelement arrayName searchId"}} +test set-10.5 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a b c} msg] $msg +} {1 {wrong # args: should be "array nextelement arrayName searchId"}} +test set-10.6 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a a-1-a} msg] $msg +} {1 {illegal search identifier "a-1-a"}} +test set-10.7 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a sx1-a} msg] $msg +} {1 {illegal search identifier "sx1-a"}} +test set-10.8 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a s--a} msg] $msg +} {1 {illegal search identifier "s--a"}} +test set-10.9 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a s-1-b} msg] $msg +} {1 {search identifier "s-1-b" isn't for variable "a"}} +test set-10.10 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a s-1ba} msg] $msg +} {1 {illegal search identifier "s-1ba"}} +test set-10.11 {array enumeration errors} { + catch {unset a} + set a(a) 1 + set x [array startsearch a] + list [catch {array next a s-2-a} msg] $msg +} {1 {couldn't find search "s-2-a"}} +test set-10.12 {array enumeration errors} { + list [catch {array done a} msg] $msg +} {1 {wrong # args: should be "array donesearch arrayName searchId"}} +test set-10.13 {array enumeration errors} { + list [catch {array done a b c} msg] $msg +} {1 {wrong # args: should be "array donesearch arrayName searchId"}} +test set-10.14 {array enumeration errors} { + list [catch {array done a b} msg] $msg +} {1 {illegal search identifier "b"}} +test set-10.15 {array enumeration errors} { + list [catch {array anymore a} msg] $msg +} {1 {wrong # args: should be "array anymore arrayName searchId"}} +test set-10.16 {array enumeration errors} { + list [catch {array any a b c} msg] $msg +} {1 {wrong # args: should be "array anymore arrayName searchId"}} +test set-10.17 {array enumeration errors} { + catch {unset a} + set a(0) 44 + list [catch {array any a bogus} msg] $msg +} {1 {illegal search identifier "bogus"}} + +# Array enumeration with "anymore" option + +test set-11.1 {array anymore option} { + catch {unset a} + set a(a) 1 + set a(b) 2 + set a(c) 3 + array startsearch a + list [array anymore a s-1-a] [array next a s-1-a] \ + [array anymore a s-1-a] [array next a s-1-a] \ + [array anymore a s-1-a] [array next a s-1-a] \ + [array anymore a s-1-a] [array next a s-1-a] +} {1 a 1 b 1 c 0 {}} +test set-11.2 {array anymore option} { + catch {unset a} + set a(a) 1 + set a(b) 2 + set a(c) 3 + array startsearch a + list [array next a s-1-a] [array next a s-1-a] \ + [array anymore a s-1-a] [array next a s-1-a] \ + [array next a s-1-a] [array anymore a s-1-a] +} {a b 1 c {} 0} + +# Special check to see that the value of a variable is handled correctly +# if it is returned as the result of a procedure (must not free the variable +# string while deleting the call frame). Errors will only be detected if +# a memory consistency checker such as Purify is being used. + +test set-12.1 {cleanup on procedure return} { + proc foo {} { + set x 12345 + } + foo +} 12345 +test set-12.2 {cleanup on procedure return} { + proc foo {} { + set x(1) 23456 + } + foo +} 23456 + +# Must delete variables when done, since these arrays get used as +# scalars by other tests. + +catch {unset a} +catch {unset b} +catch {unset c} +return "" diff --git a/vendor/x11iraf/obm/Tcl/tests/source.test b/vendor/x11iraf/obm/Tcl/tests/source.test new file mode 100644 index 00000000..4ad049a0 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/source.test @@ -0,0 +1,95 @@ +# Commands covered: source +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/source.test,v 1.8 93/02/17 13:22:56 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test source-1.1 {source command} { + set x "old x value" + set y "old y value" + set z "old z value" + exec cat << { + set x 22 + set y 33 + set z 44 + } > source.file + source source.file + list $x $y $z +} {22 33 44} +test source-1.2 {source command} { + exec cat << {list result} > source.file + source source.file +} result + +test source-2.1 {source error conditions} { + list [catch {source} msg] $msg +} {1 {wrong # args: should be "source fileName"}} +test source-2.2 {source error conditions} { + list [catch {source a b} msg] $msg +} {1 {wrong # args: should be "source fileName"}} +test source-2.3 {source error conditions} { + exec cat << { + set x 146 + error "error in sourced file" + set y $x + } > source.file + list [catch {source source.file} msg] $msg $errorInfo +} {1 {error in sourced file} {error in sourced file + while executing +"error "error in sourced file"" + (file "source.file" line 3) + invoked from within +"source source.file"}} +test source-2.4 {source error conditions} { + exec cat << {break} > source.file + catch {source source.file} +} 3 +test source-2.5 {source error conditions} { + exec cat << {continue} > source.file + catch {source source.file} +} 4 +test source-2.6 {source error conditions} { + string tolower [list [catch {source _non_existent_} msg] $msg $errorCode] +} {1 {couldn't read file "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}} + +test source-3.1 {return in middle of source file} { + exec cat << { + set x new-x + return allDone + set y new-y + } > source.file + set x old-x + set y old-y + set z [source source.file] + list $x $y $z +} {new-x old-y allDone} + +catch {exec rm source.file} + +# Generate null final value + +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/split.test b/vendor/x11iraf/obm/Tcl/tests/split.test new file mode 100644 index 00000000..1e2a3d8b --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/split.test @@ -0,0 +1,58 @@ +# Commands covered: split +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/split.test,v 1.6 93/10/11 09:05:58 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test split-1.1 {basic split commands} { + split "a\n b\t\r c\n " +} {a {} b {} {} c {} {}} +test split-1.2 {basic split commands} { + split "word 1xyzword 2zword 3" xyz +} {{word 1} {} {} {word 2} {word 3}} +test split-1.3 {basic split commands} { + split "12345" {} +} {1 2 3 4 5} +test split-1.4 {basic split commands} { + split "a\}b\[c\{\]\$" +} "a\\}b\\\[c\\{\\\]\\\$" +test split-1.5 {basic split commands} { + split {} {} +} {} +test split-1.6 {basic split commands} { + split {} +} {} +test split-1.7 {basic split commands} { + split { } +} {{} {} {} {}} + +test split-2.1 {split errors} { + list [catch split msg] $msg $errorCode +} {1 {wrong # args: should be "split string ?splitChars?"} NONE} +test split-2.2 {split errors} { + list [catch {split a b c} msg] $msg $errorCode +} {1 {wrong # args: should be "split string ?splitChars?"} NONE} diff --git a/vendor/x11iraf/obm/Tcl/tests/string.test b/vendor/x11iraf/obm/Tcl/tests/string.test new file mode 100644 index 00000000..e0bc44a6 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/string.test @@ -0,0 +1,333 @@ +# Commands covered: string +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/string.test,v 1.7 93/02/06 15:54:24 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test string-1.1 {string compare} { + string compare abcde abdef +} -1 +test string-1.2 {string compare} { + string c abcde ABCDE +} 1 +test string-1.3 {string compare} { + string compare abcde abcde +} 0 +test string-1.4 {string compare} { + list [catch {string compare a} msg] $msg +} {1 {wrong # args: should be "string compare string1 string2"}} +test string-1.5 {string compare} { + list [catch {string compare a b c} msg] $msg +} {1 {wrong # args: should be "string compare string1 string2"}} + +test string-2.1 {string first} { + string first bq abcdefgbcefgbqrs +} 12 +test string-2.2 {string first} { + string fir bcd abcdefgbcefgbqrs +} 1 +test string-2.3 {string first} { + string f b abcdefgbcefgbqrs +} 1 +test string-2.4 {string first} { + string first xxx x123xx345xxx789xxx012 +} 9 +test string-2.5 {string first} { + list [catch {string first a} msg] $msg +} {1 {wrong # args: should be "string first string1 string2"}} +test string-2.6 {string first} { + list [catch {string first a b c} msg] $msg +} {1 {wrong # args: should be "string first string1 string2"}} + +test string-3.1 {string index} { + string index abcde 0 +} a +test string-3.2 {string index} { + string i abcde 4 +} e +test string-3.3 {string index} { + string index abcde 5 +} {} +test string-3.4 {string index} { + list [catch {string index abcde -10} msg] $msg +} {0 {}} +test string-3.5 {string index} { + list [catch {string index} msg] $msg +} {1 {wrong # args: should be "string index string charIndex"}} +test string-3.6 {string index} { + list [catch {string index a b c} msg] $msg +} {1 {wrong # args: should be "string index string charIndex"}} +test string-3.7 {string index} { + list [catch {string index a xyz} msg] $msg +} {1 {expected integer but got "xyz"}} + +test string-4.1 {string last} { + string la xxx xxxx123xx345x678 +} 1 +test string-4.2 {string last} { + string last xx xxxx123xx345x678 +} 7 +test string-4.3 {string last} { + string las x xxxx123xx345x678 +} 12 +test string-4.4 {string last} { + list [catch {string last a} msg] $msg +} {1 {wrong # args: should be "string last string1 string2"}} +test string-4.5 {string last} { + list [catch {string last a b c} msg] $msg +} {1 {wrong # args: should be "string last string1 string2"}} + +test string-5.1 {string length} { + string length "a little string" +} 15 +test string-5.2 {string length} { + string le "" +} 0 +test string-5.3 {string length} { + list [catch {string length} msg] $msg +} {1 {wrong # args: should be "string length string"}} +test string-5.4 {string length} { + list [catch {string length a b} msg] $msg +} {1 {wrong # args: should be "string length string"}} + +test string-6.1 {string match} { + string match abc abc +} 1 +test string-6.2 {string match} { + string m abc abd +} 0 +test string-6.3 {string match} { + string match ab*c abc +} 1 +test string-6.4 {string match} { + string match ab**c abc +} 1 +test string-6.5 {string match} { + string match ab* abcdef +} 1 +test string-6.6 {string match} { + string match *c abc +} 1 +test string-6.7 {string match} { + string match *3*6*9 0123456789 +} 1 +test string-6.8 {string match} { + string match *3*6*9 01234567890 +} 0 +test string-6.9 {string match} { + string match a?c abc +} 1 +test string-6.10 {string match} { + string match a??c abc +} 0 +test string-6.11 {string match} { + string match ?1??4???8? 0123456789 +} 1 +test string-6.12 {string match} { + string match {[abc]bc} abc +} 1 +test string-6.13 {string match} { + string match {a[abc]c} abc +} 1 +test string-6.14 {string match} { + string match {a[xyz]c} abc +} 0 +test string-6.15 {string match} { + string match {12[2-7]45} 12345 +} 1 +test string-6.16 {string match} { + string match {12[ab2-4cd]45} 12345 +} 1 +test string-6.17 {string match} { + string match {12[ab2-4cd]45} 12b45 +} 1 +test string-6.18 {string match} { + string match {12[ab2-4cd]45} 12d45 +} 1 +test string-6.19 {string match} { + string match {12[ab2-4cd]45} 12145 +} 0 +test string-6.20 {string match} { + string match {12[ab2-4cd]45} 12545 +} 0 +test string-6.21 {string match} { + string match {a\*b} a*b +} 1 +test string-6.22 {string match} { + string match {a\*b} ab +} 0 +test string-6.23 {string match} { + string match {a\*\?\[\]\\\x} "a*?\[\]\\x" +} 1 +test string-6.24 {string match} { + string match ** "" +} 1 +test string-6.25 {string match} { + string match *. "" +} 0 +test string-6.26 {string match} { + string match "" "" +} 1 +test string-6.27 {string match} { + list [catch {string match a} msg] $msg +} {1 {wrong # args: should be "string match pattern string"}} +test string-6.28 {string match} { + list [catch {string match a b c} msg] $msg +} {1 {wrong # args: should be "string match pattern string"}} + +test string-7.1 {string range} { + string range abcdefghijklmnop 2 14 +} {cdefghijklmno} +test string-7.2 {string range} { + string range abcdefghijklmnop 7 1000 +} {hijklmnop} +test string-7.3 {string range} { + string range abcdefghijklmnop 10 e +} {klmnop} +test string-7.4 {string range} { + string range abcdefghijklmnop 10 9 +} {} +test string-7.5 {string range} { + string range abcdefghijklmnop -3 2 +} {abc} +test string-7.6 {string range} { + string range abcdefghijklmnop -3 -2 +} {} +test string-7.7 {string range} { + string range abcdefghijklmnop 1000 1010 +} {} +test string-7.8 {string range} { + string range abcdefghijklmnop -100 end +} {abcdefghijklmnop} +test string-7.9 {string range} { + list [catch {string range} msg] $msg +} {1 {wrong # args: should be "string range string first last"}} +test string-7.10 {string range} { + list [catch {string range a 1} msg] $msg +} {1 {wrong # args: should be "string range string first last"}} +test string-7.11 {string range} { + list [catch {string range a 1 2 3} msg] $msg +} {1 {wrong # args: should be "string range string first last"}} +test string-7.12 {string range} { + list [catch {string range abc abc 1} msg] $msg +} {1 {expected integer but got "abc"}} +test string-7.13 {string range} { + list [catch {string range abc 1 eof} msg] $msg +} {1 {expected integer or "end" but got "eof"}} + +test string-8.1 {string trim} { + string trim " XYZ " +} {XYZ} +test string-8.2 {string trim} { + string trim "\t\nXYZ\t\n\r\n" +} {XYZ} +test string-8.3 {string trim} { + string trim " A XYZ A " +} {A XYZ A} +test string-8.4 {string trim} { + string trim "XXYYZZABC XXYYZZ" ZYX +} {ABC } +test string-8.5 {string trim} { + string trim " \t\r " +} {} +test string-8.6 {string trim} { + string trim {abcdefg} {} +} {abcdefg} +test string-8.7 {string trim} { + string trim {} +} {} +test string-8.8 {string trim} { + string trim ABC DEF +} {ABC} +test string-8.9 {string trim} { + list [catch {string trim} msg] $msg +} {1 {wrong # args: should be "string trim string ?chars?"}} +test string-8.10 {string trim} { + list [catch {string trim a b c} msg] $msg +} {1 {wrong # args: should be "string trim string ?chars?"}} + +test string-9.1 {string trimleft} { + string trimleft " XYZ " +} {XYZ } +test string-9.2 {string trimleft} { + list [catch {string triml} msg] $msg +} {1 {wrong # args: should be "string trimleft string ?chars?"}} + +test string-10.1 {string trimright} { + string trimright " XYZ " +} { XYZ} +test string-10.2 {string trimright} { + string trimright " " +} {} +test string-10.3 {string trimright} { + string trimright "" +} {} +test string-10.4 {string trimright errors} { + list [catch {string trimr} msg] $msg +} {1 {wrong # args: should be "string trimright string ?chars?"}} +test string-10.5 {string trimright errors} { + list [catch {string trimg a} msg] $msg +} {1 {bad option "trimg": should be compare, first, index, last, length, match, range, tolower, toupper, trim, trimleft, or trimright}} + +test string-11.1 {string tolower} { + string tolower ABCDeF +} {abcdef} +test string-11.2 {string tolower} { + string tolower "ABC XyZ" +} {abc xyz} +test string-11.3 {string tolower} { + string tolower {123#$&*()} +} {123#$&*()} +test string-11.4 {string tolower} { + list [catch {string tolower} msg] $msg +} {1 {wrong # args: should be "string tolower string"}} +test string-11.5 {string tolower} { + list [catch {string tolower a b} msg] $msg +} {1 {wrong # args: should be "string tolower string"}} + +test string-12.1 {string toupper} { + string toupper abCDEf +} {ABCDEF} +test string-12.2 {string toupper} { + string toupper "abc xYz" +} {ABC XYZ} +test string-12.3 {string toupper} { + string toupper {123#$&*()} +} {123#$&*()} +test string-12.4 {string toupper} { + list [catch {string toupper} msg] $msg +} {1 {wrong # args: should be "string toupper string"}} +test string-12.5 {string toupper} { + list [catch {string toupper a b} msg] $msg +} {1 {wrong # args: should be "string toupper string"}} + +test string-13.1 {error conditions} { + list [catch {string gorp a b} msg] $msg +} {1 {bad option "gorp": should be compare, first, index, last, length, match, range, tolower, toupper, trim, trimleft, or trimright}} +test string-13.2 {error conditions} { + list [catch {string} msg] $msg +} {1 {wrong # args: should be "string option arg ?arg ...?"}} diff --git a/vendor/x11iraf/obm/Tcl/tests/switch.test b/vendor/x11iraf/obm/Tcl/tests/switch.test new file mode 100644 index 00000000..dd2baa27 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/switch.test @@ -0,0 +1,184 @@ +# Commands covered: switch +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/switch.test,v 1.2 93/06/17 11:53:58 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test switch-1.1 {simple patterns} { + switch a a {format 1} b {format 2} c {format 3} default {format 4} +} 1 +test switch-1.2 {simple patterns} { + switch b a {format 1} b {format 2} c {format 3} default {format 4} +} 2 +test switch-1.3 {simple patterns} { + switch x a {format 1} b {format 2} c {format 3} default {format 4} +} 4 +test switch-1.4 {simple patterns} { + switch x a {format 1} b {format 2} c {format 3} +} {} +test switch-1.5 {simple pattern matches many times} { + switch b a {format 1} b {format 2} b {format 3} b {format 4} +} 2 +test switch-1.6 {simple patterns} { + switch default a {format 1} default {format 2} c {format 3} default {format 4} +} 2 +test switch-1.7 {simple patterns} { + switch x a {format 1} default {format 2} c {format 3} default {format 4} +} 4 + +test switch-2.1 {single-argument form for pattern/command pairs} { + switch b { + a {format 1} + b {format 2} + default {format 6} + } +} {2} +test switch-2.2 {single-argument form for pattern/command pairs} { + list [catch {switch z {a 2 b}} msg] $msg +} {1 {extra switch pattern with no body}} + +test switch-3.1 {-exact vs. -glob vs. -regexp} { + switch -exact aaaab { + ^a*b$ {concat regexp} + *b {concat glob} + aaaab {concat exact} + default {concat none} + } +} exact +test switch-3.2 {-exact vs. -glob vs. -regexp} { + switch -exact -regexp aaaab { + ^a*b$ {concat regexp} + *b {concat glob} + aaaab {concat exact} + default {concat none} + } +} regexp +test switch-3.3 {-exact vs. -glob vs. -regexp} { + switch -glob aaaab { + ^a*b$ {concat regexp} + *b {concat glob} + aaaab {concat exact} + default {concat none} + } +} glob +test switch-3.4 {-exact vs. -glob vs. -regexp} { + switch aaaab {^a*b$} {concat regexp} *b {concat glob} \ + aaaab {concat exact} default {concat none} +} exact +test switch-3.5 {-exact vs. -glob vs. -regexp} { + switch -- -glob { + ^g.*b$ {concat regexp} + -* {concat glob} + -glob {concat exact} + default {concat none} + } +} exact +test switch-3.6 {-exact vs. -glob vs. -regexp} { + list [catch {switch -foo a b c} msg] $msg +} {1 {bad option "-foo": should be -exact, -glob, -regexp, or --}} + +test switch-4.1 {error in executed command} { + list [catch {switch a a {error "Just a test"} default {format 1}} msg] \ + $msg $errorInfo +} {1 {Just a test} {Just a test + while executing +"error "Just a test"" + ("a" arm line 1) + invoked from within +"switch a a {error "Just a test"} default {format 1}"}} +test switch-4.2 {error: not enough args} { + list [catch {switch} msg] $msg +} {1 {wrong # args: should be "switch ?switches? string pattern body ... ?default body?"}} +test switch-4.3 {error: pattern with no body} { + list [catch {switch a b} msg] $msg +} {1 {extra switch pattern with no body}} +test switch-4.4 {error: pattern with no body} { + list [catch {switch a b {format 1} c} msg] $msg +} {1 {extra switch pattern with no body}} +test switch-4.5 {error in default command} { + list [catch {switch foo a {error switch1} b {error switch 3} \ + default {error switch2}} msg] $msg $errorInfo +} {1 switch2 {switch2 + while executing +"error switch2" + ("default" arm line 1) + invoked from within +"switch foo a {error switch1} b {error switch 3} default {error switch2}"}} + +test switch-5.1 {errors in -regexp matching} { + list [catch {switch -regexp aaaab { + *b {concat glob} + aaaab {concat exact} + default {concat none} + }} msg] $msg +} {1 {couldn't compile regular expression pattern: ?+* follows nothing}} + +test switch-6.1 {backslashes in patterns} { + switch -exact {\a\$\.\[} { + \a\$\.\[ {concat first} + \a\\$\.\\[ {concat second} + \\a\\$\\.\\[ {concat third} + {\a\\$\.\\[} {concat fourth} + {\\a\\$\\.\\[} {concat fifth} + default {concat none} + } +} third +test switch-6.2 {backslashes in patterns} { + switch -exact {\a\$\.\[} { + \a\$\.\[ {concat first} + {\a\$\.\[} {concat second} + {{\a\$\.\[}} {concat third} + default {concat none} + } +} second + +test switch-7.1 {"-" bodies} { + switch a { + a - + b - + c {concat 1} + default {concat 2} + } +} 1 +test switch-7.2 {"-" bodies} { + list [catch { + switch a { + a - + b - + c - + } + } msg] $msg +} {1 {no body specified for pattern "a"}} +test switch-7.3 {"-" bodies} { + list [catch { + switch a { + a - + b -foo + c - + } + } msg] $msg +} {1 {invalid command name: "-foo"}} diff --git a/vendor/x11iraf/obm/Tcl/tests/trace.test b/vendor/x11iraf/obm/Tcl/tests/trace.test new file mode 100644 index 00000000..02fc051c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/trace.test @@ -0,0 +1,914 @@ +# Commands covered: trace +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/trace.test,v 1.20 93/10/11 09:05:38 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc traceScalar {name1 name2 op} { + global info + set info [list $name1 $name2 $op [catch {uplevel set $name1} msg] $msg] +} +proc traceArray {name1 name2 op} { + global info + set info [list $name1 $name2 $op [catch {uplevel set [set name1]($name2)} msg] $msg] +} +proc traceProc {name1 name2 op} { + global info + set info [concat $info [list $name1 $name2 $op]] +} +proc traceTag {tag args} { + global info + set info [concat $info $tag] +} +proc traceError {args} { + error "trace returned error" +} +proc traceCheck {cmd args} { + global info + set info [list [catch $cmd msg] $msg] +} +proc traceCrtElement {value name1 name2 op} { + uplevel set ${name1}($name2) $value +} + +# Read-tracing on variables + +test trace-1.1 {trace variable reads} { + catch {unset x} + set info {} + trace var x r traceScalar + list [catch {set x} msg] $msg $info +} {1 {can't read "x": no such variable} {x {} r 1 {can't read "x": no such variable}}} +test trace-1.2 {trace variable reads} { + catch {unset x} + set x 123 + set info {} + trace var x r traceScalar + list [catch {set x} msg] $msg $info +} {0 123 {x {} r 0 123}} +test trace-1.3 {trace variable reads} { + catch {unset x} + set info {} + trace var x r traceScalar + set x 123 + set info +} {} +test trace-1.4 {trace array element reads} { + catch {unset x} + set info {} + trace var x(2) r traceArray + list [catch {set x(2)} msg] $msg $info +} {1 {can't read "x(2)": no such element in array} {x 2 r 1 {can't read "x(2)": no such element in array}}} +test trace-1.5 {trace array element reads} { + catch {unset x} + set x(2) zzz + set info {} + trace var x(2) r traceArray + list [catch {set x(2)} msg] $msg $info +} {0 zzz {x 2 r 0 zzz}} +test trace-1.6 {trace reads on whole arrays} { + catch {unset x} + set info {} + trace var x r traceArray + list [catch {set x(2)} msg] $msg $info +} {1 {can't read "x(2)": no such variable} {}} +test trace-1.7 {trace reads on whole arrays} { + catch {unset x} + set x(2) zzz + set info {} + trace var x r traceArray + list [catch {set x(2)} msg] $msg $info +} {0 zzz {x 2 r 0 zzz}} +test trace-1.8 {trace variable reads} { + catch {unset x} + set x 444 + set info {} + trace var x r traceScalar + unset x + set info +} {} + +# Basic write-tracing on variables + +test trace-2.1 {trace variable writes} { + catch {unset x} + set info {} + trace var x w traceScalar + set x 123 + set info +} {x {} w 0 123} +test trace-2.2 {trace writes to array elements} { + catch {unset x} + set info {} + trace var x(33) w traceArray + set x(33) 444 + set info +} {x 33 w 0 444} +test trace-2.3 {trace writes on whole arrays} { + catch {unset x} + set info {} + trace var x w traceArray + set x(abc) qq + set info +} {x abc w 0 qq} +test trace-2.4 {trace variable writes} { + catch {unset x} + set x 1234 + set info {} + trace var x w traceScalar + set x + set info +} {} +test trace-2.5 {trace variable writes} { + catch {unset x} + set x 1234 + set info {} + trace var x w traceScalar + unset x + set info +} {} + +# Basic unset-tracing on variables + +test trace-3.1 {trace variable unsets} { + catch {unset x} + set info {} + trace var x u traceScalar + catch {unset x} + set info +} {x {} u 1 {can't read "x": no such variable}} +test trace-3.2 {variable mustn't exist during unset trace} { + catch {unset x} + set x 1234 + set info {} + trace var x u traceScalar + unset x + set info +} {x {} u 1 {can't read "x": no such variable}} +test trace-3.3 {unset traces mustn't be called during reads and writes} { + catch {unset x} + set info {} + trace var x u traceScalar + set x 44 + set x + set info +} {} +test trace-3.4 {trace unsets on array elements} { + catch {unset x} + set x(0) 18 + set info {} + trace var x(1) u traceArray + catch {unset x(1)} + set info +} {x 1 u 1 {can't read "x(1)": no such element in array}} +test trace-3.5 {trace unsets on array elements} { + catch {unset x} + set x(1) 18 + set info {} + trace var x(1) u traceArray + unset x(1) + set info +} {x 1 u 1 {can't read "x(1)": no such element in array}} +test trace-3.6 {trace unsets on array elements} { + catch {unset x} + set x(1) 18 + set info {} + trace var x(1) u traceArray + unset x + set info +} {x 1 u 1 {can't read "x(1)": no such variable}} +test trace-3.7 {trace unsets on whole arrays} { + catch {unset x} + set x(1) 18 + set info {} + trace var x u traceProc + catch {unset x(0)} + set info +} {} +test trace-3.8 {trace unsets on whole arrays} { + catch {unset x} + set x(1) 18 + set x(2) 144 + set x(3) 14 + set info {} + trace var x u traceProc + unset x(1) + set info +} {x 1 u} +test trace-3.9 {trace unsets on whole arrays} { + catch {unset x} + set x(1) 18 + set x(2) 144 + set x(3) 14 + set info {} + trace var x u traceProc + unset x + set info +} {x {} u} + +# Trace multiple trace types at once. + +test trace-4.1 {multiple ops traced at once} { + catch {unset x} + set info {} + trace var x rwu traceProc + catch {set x} + set x 22 + set x + set x 33 + unset x + set info +} {x {} r x {} w x {} r x {} w x {} u} +test trace-4.2 {multiple ops traced on array element} { + catch {unset x} + set info {} + trace var x(0) rwu traceProc + catch {set x(0)} + set x(0) 22 + set x(0) + set x(0) 33 + unset x(0) + unset x + set info +} {x 0 r x 0 w x 0 r x 0 w x 0 u} +test trace-4.3 {multiple ops traced on whole array} { + catch {unset x} + set info {} + trace var x rwu traceProc + catch {set x(0)} + set x(0) 22 + set x(0) + set x(0) 33 + unset x(0) + unset x + set info +} {x 0 w x 0 r x 0 w x 0 u x {} u} + +# Check order of invocation of traces + +test trace-5.1 {order of invocation of traces} { + catch {unset x} + set info {} + trace var x r "traceTag 1" + trace var x r "traceTag 2" + trace var x r "traceTag 3" + catch {set x} + set x 22 + set x + set info +} {3 2 1 3 2 1} +test trace-5.2 {order of invocation of traces} { + catch {unset x} + set x(0) 44 + set info {} + trace var x(0) r "traceTag 1" + trace var x(0) r "traceTag 2" + trace var x(0) r "traceTag 3" + set x(0) + set info +} {3 2 1} +test trace-5.3 {order of invocation of traces} { + catch {unset x} + set x(0) 44 + set info {} + trace var x(0) r "traceTag 1" + trace var x r "traceTag A1" + trace var x(0) r "traceTag 2" + trace var x r "traceTag A2" + trace var x(0) r "traceTag 3" + trace var x r "traceTag A3" + set x(0) + set info +} {A3 A2 A1 3 2 1} + +# Check effects of errors in trace procedures + +test trace-6.1 {error returns from traces} { + catch {unset x} + set x 123 + set info {} + trace var x r "traceTag 1" + trace var x r traceError + list [catch {set x} msg] $msg $info +} {1 {can't read "x": trace returned error} {}} +test trace-6.2 {error returns from traces} { + catch {unset x} + set x 123 + set info {} + trace var x w "traceTag 1" + trace var x w traceError + list [catch {set x 44} msg] $msg $info +} {1 {can't set "x": trace returned error} {}} +test trace-6.3 {error returns from traces} { + catch {unset x} + set x 123 + set info {} + trace var x u "traceTag 1" + trace var x u traceError + list [catch {unset x} msg] $msg $info +} {0 {} 1} +test trace-6.4 {error returns from traces} { + catch {unset x} + set x(0) 123 + set info {} + trace var x(0) r "traceTag 1" + trace var x r "traceTag 2" + trace var x r traceError + trace var x r "traceTag 3" + list [catch {set x(0)} msg] $msg $info +} {1 {can't read "x(0)": trace returned error} 3} +test trace-6.5 {error returns from traces} { + catch {unset x} + set x 123 + trace var x u traceError + list [catch {unset x} msg] $msg +} {0 {}} +test trace-6.6 {error returns from traces} { + # This test just makes sure that the memory for the error message + # gets deallocated correctly when the trace is invoked again or + # when the trace is deleted. + catch {unset x} + set x 123 + trace var x r traceError + catch {set x} + catch {set x} + trace vdelete x r traceError +} {} + +# Check to see that variables are expunged before trace +# procedures are invoked, so trace procedure can even manipulate +# a new copy of the variables. + +test trace-7.1 {be sure variable is unset before trace is called} { + catch {unset x} + set x 33 + set info {} + trace var x u {traceCheck {uplevel set x}} + unset x + set info +} {1 {can't read "x": no such variable}} +test trace-7.2 {be sure variable is unset before trace is called} { + catch {unset x} + set x 33 + set info {} + trace var x u {traceCheck {uplevel set x 22}} + unset x + concat $info [list [catch {set x} msg] $msg] +} {0 22 0 22} +test trace-7.3 {be sure traces are cleared before unset trace called} { + catch {unset x} + set x 33 + set info {} + trace var x u {traceCheck {uplevel trace vinfo x}} + unset x + set info +} {0 {}} +test trace-7.4 {set new trace during unset trace} { + catch {unset x} + set x 33 + set info {} + trace var x u {traceCheck {global x; trace var x u traceProc}} + unset x + concat $info [trace vinfo x] +} {0 {} {u traceProc}} + +test trace-8.1 {make sure array elements are unset before traces are called} { + catch {unset x} + set x(0) 33 + set info {} + trace var x(0) u {traceCheck {uplevel set x(0)}} + unset x(0) + set info +} {1 {can't read "x(0)": no such element in array}} +test trace-8.2 {make sure array elements are unset before traces are called} { + catch {unset x} + set x(0) 33 + set info {} + trace var x(0) u {traceCheck {uplevel set x(0) zzz}} + unset x(0) + concat $info [list [catch {set x(0)} msg] $msg] +} {0 zzz 0 zzz} +test trace-8.3 {array elements are unset before traces are called} { + catch {unset x} + set x(0) 33 + set info {} + trace var x(0) u {traceCheck {global x; trace vinfo x(0)}} + unset x(0) + set info +} {0 {}} +test trace-8.4 {set new array element trace during unset trace} { + catch {unset x} + set x(0) 33 + set info {} + trace var x(0) u {traceCheck {uplevel {trace variable x(0) r {}}}} + catch {unset x(0)} + concat $info [trace vinfo x(0)] +} {0 {} {r {}}} + +test trace-9.1 {make sure arrays are unset before traces are called} { + catch {unset x} + set x(0) 33 + set info {} + trace var x u {traceCheck {uplevel set x(0)}} + unset x + set info +} {1 {can't read "x(0)": no such variable}} +test trace-9.2 {make sure arrays are unset before traces are called} { + catch {unset x} + set x(y) 33 + set info {} + trace var x u {traceCheck {uplevel set x(y) 22}} + unset x + concat $info [list [catch {set x(y)} msg] $msg] +} {0 22 0 22} +test trace-9.3 {make sure arrays are unset before traces are called} { + catch {unset x} + set x(y) 33 + set info {} + trace var x u {traceCheck {uplevel array names x}} + unset x + set info +} {1 {"x" isn't an array}} +test trace-9.4 {make sure arrays are unset before traces are called} { + catch {unset x} + set x(y) 33 + set info {} + set cmd {traceCheck {uplevel {trace vinfo x}}} + trace var x u $cmd + unset x + set info +} {0 {}} +test trace-9.5 {set new array trace during unset trace} { + catch {unset x} + set x(y) 33 + set info {} + trace var x u {traceCheck {global x; trace var x r {}}} + unset x + concat $info [trace vinfo x] +} {0 {} {r {}}} +test trace-9.6 {create scalar during array unset trace} { + catch {unset x} + set x(y) 33 + set info {} + trace var x u {traceCheck {global x; set x 44}} + unset x + concat $info [list [catch {set x} msg] $msg] +} {0 44 0 44} + +# Check special conditions (e.g. errors) in Tcl_TraceVar2. + +test trace-10.1 {creating array when setting variable traces} { + catch {unset x} + set info {} + trace var x(0) w traceProc + list [catch {set x 22} msg] $msg +} {1 {can't set "x": variable is array}} +test trace-10.2 {creating array when setting variable traces} { + catch {unset x} + set info {} + trace var x(0) w traceProc + list [catch {set x(0)} msg] $msg +} {1 {can't read "x(0)": no such element in array}} +test trace-10.3 {creating array when setting variable traces} { + catch {unset x} + set info {} + trace var x(0) w traceProc + set x(0) 22 + set info +} {x 0 w} +test trace-10.4 {creating variable when setting variable traces} { + catch {unset x} + set info {} + trace var x w traceProc + list [catch {set x} msg] $msg +} {1 {can't read "x": no such variable}} +test trace-10.5 {creating variable when setting variable traces} { + catch {unset x} + set info {} + trace var x w traceProc + set x 22 + set info +} {x {} w} +test trace-10.6 {creating variable when setting variable traces} { + catch {unset x} + set info {} + trace var x w traceProc + set x(0) 22 + set info +} {x 0 w} +test trace-10.7 {create array element during read trace} { + catch {unset x} + set x(2) zzz + trace var x r {traceCrtElement xyzzy} + list [catch {set x(3)} msg] $msg +} {0 xyzzy} +test trace-10.8 {errors when setting variable traces} { + catch {unset x} + set x 44 + list [catch {trace var x(0) w traceProc} msg] $msg +} {1 {can't trace "x(0)": variable isn't array}} + +# Check deleting one trace from another. + +test trace-11.1 {delete one trace from another} { + proc delTraces {args} { + global x + trace vdel x r {traceTag 2} + trace vdel x r {traceTag 3} + trace vdel x r {traceTag 4} + } + catch {unset x} + set x 44 + set info {} + trace var x r {traceTag 1} + trace var x r {traceTag 2} + trace var x r {traceTag 3} + trace var x r {traceTag 4} + trace var x r delTraces + trace var x r {traceTag 5} + set x + set info +} {5 1} + +# Check operation and syntax of "trace" command. + +test trace-12.1 {trace command (overall)} { + list [catch {trace} msg] $msg +} {1 {too few args: should be "trace option [arg arg ...]"}} +test trace-12.2 {trace command (overall)} { + list [catch {trace gorp} msg] $msg +} {1 {bad option "gorp": should be variable, vdelete, or vinfo}} +test trace-12.3 {trace command ("variable" option)} { + list [catch {trace variable x y} msg] $msg +} {1 {wrong # args: should be "trace variable name ops command"}} +test trace-12.4 {trace command ("variable" option)} { + list [catch {trace var x y z z2} msg] $msg +} {1 {wrong # args: should be "trace variable name ops command"}} +test trace-12.5 {trace command ("variable" option)} { + list [catch {trace var x y z} msg] $msg +} {1 {bad operations "y": should be one or more of rwu}} +test trace-12.6 {trace command ("vdelete" option)} { + list [catch {trace vdelete x y} msg] $msg +} {1 {wrong # args: should be "trace vdelete name ops command"}} +test trace-12.7 {trace command ("vdelete" option)} { + list [catch {trace vdelete x y z foo} msg] $msg +} {1 {wrong # args: should be "trace vdelete name ops command"}} +test trace-12.8 {trace command ("vdelete" option)} { + list [catch {trace vdelete x y z} msg] $msg +} {1 {bad operations "y": should be one or more of rwu}} +test trace-12.9 {trace command ("vdelete" option)} { + catch {unset x} + set info {} + trace var x w traceProc + trace vdelete x w traceProc +} {} +test trace-12.10 {trace command ("vdelete" option)} { + catch {unset x} + set info {} + trace var x w traceProc + trace vdelete x w traceProc + set x 12345 + set info +} {} +test trace-12.11 {trace command ("vdelete" option)} { + catch {unset x} + set info {} + trace var x w {traceTag 1} + trace var x w traceProc + trace var x w {traceTag 2} + set x yy + trace vdelete x w traceProc + set x 12345 + trace vdelete x w {traceTag 1} + set x foo + trace vdelete x w {traceTag 2} + set x gorp + set info +} {2 x {} w 1 2 1 2} +test trace-12.12 {trace command ("vdelete" option)} { + catch {unset x} + set info {} + trace var x w {traceTag 1} + trace vdelete x w non_existent + set x 12345 + set info +} {1} +test trace-12.13 {trace command ("vinfo" option)} { + list [catch {trace vinfo} msg] $msg] +} {1 {wrong # args: should be "trace vinfo name"]}} +test trace-12.14 {trace command ("vinfo" option)} { + list [catch {trace vinfo x y} msg] $msg] +} {1 {wrong # args: should be "trace vinfo name"]}} +test trace-12.15 {trace command ("vinfo" option)} { + catch {unset x} + trace var x w {traceTag 1} + trace var x w traceProc + trace var x w {traceTag 2} + trace vinfo x +} {{w {traceTag 2}} {w traceProc} {w {traceTag 1}}} +test trace-12.16 {trace command ("vinfo" option)} { + catch {unset x} + trace vinfo x +} {} +test trace-12.17 {trace command ("vinfo" option)} { + catch {unset x} + trace vinfo x(0) +} {} +test trace-12.18 {trace command ("vinfo" option)} { + catch {unset x} + set x 44 + trace vinfo x(0) +} {} +test trace-12.19 {trace command ("vinfo" option)} { + catch {unset x} + set x 44 + trace var x w {traceTag 1} + proc check {} {global x; trace vinfo x} + check +} {{w {traceTag 1}}} + +# Check fancy trace commands (long ones, weird arguments, etc.) + +test trace-13.1 {long trace command} { + catch {unset x} + set info {} + trace var x w {traceTag {This is a very very long argument. It's \ + designed to test out the facilities of TraceVarProc for dealing \ + with such long arguments by malloc-ing space. One possibility \ + is that space doesn't get freed properly. If this happens, then \ + invoking this test over and over again will eventually leak memory.}} + set x 44 + set info +} {This is a very very long argument. It's \ + designed to test out the facilities of TraceVarProc for dealing \ + with such long arguments by malloc-ing space. One possibility \ + is that space doesn't get freed properly. If this happens, then \ + invoking this test over and over again will eventually leak memory.} +test trace-13.2 {long trace command result to ignore} { + proc longResult {args} {return "quite a bit of text, designed to + generate a core leak if this command file is invoked over and over again + and memory isn't being recycled correctly"} + catch {unset x} + trace var x w longResult + set x 44 + set x 5 + set x abcde +} abcde +test trace-13.3 {special list-handling in trace commands} { + catch {unset "x y z"} + set "x y z(a\n\{)" 44 + set info {} + trace var "x y z(a\n\{)" w traceProc + set "x y z(a\n\{)" 33 + set info +} "{x y z} a\\n\\{ w" + +# Check for proper handling of unsets during traces. + +proc traceUnset {unsetName args} { + global info + upvar $unsetName x + lappend info [catch {unset x} msg] $msg [catch {set x} msg] $msg +} +proc traceReset {unsetName resetName args} { + global info + upvar $unsetName x $resetName y + lappend info [catch {unset x} msg] $msg [catch {set y xyzzy} msg] $msg +} +proc traceReset2 {unsetName resetName args} { + global info + lappend info [catch {uplevel unset $unsetName} msg] $msg \ + [catch {uplevel set $resetName xyzzy} msg] $msg +} +proc traceAppend {string name1 name2 op} { + global info + lappend info $string +} + +test trace-14.1 {unsets during read traces} { + catch {unset y} + set y 1234 + set info {} + trace var y r {traceUnset y} + trace var y u {traceAppend unset} + lappend info [catch {set y} msg] $msg +} {unset 0 {} 1 {can't read "x": no such variable} 1 {can't read "y": no such variable}} +test trace-14.2 {unsets during read traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) r {traceUnset y(0)} + lappend info [catch {set y(0)} msg] $msg +} {0 {} 1 {can't read "x": no such variable} 1 {can't read "y(0)": no such element in array}} +test trace-14.3 {unsets during read traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) r {traceUnset y} + lappend info [catch {set y(0)} msg] $msg +} {0 {} 1 {can't read "x": no such variable} 1 {can't read "y(0)": no such variable}} +test trace-14.4 {unsets during read traces} { + catch {unset y} + set y 1234 + set info {} + trace var y r {traceReset y y} + lappend info [catch {set y} msg] $msg +} {0 {} 0 xyzzy 0 xyzzy} +test trace-14.5 {unsets during read traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) r {traceReset y(0) y(0)} + lappend info [catch {set y(0)} msg] $msg +} {0 {} 0 xyzzy 0 xyzzy} +test trace-14.6 {unsets during read traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) r {traceReset y y(0)} + lappend info [catch {set y(0)} msg] $msg [catch {set y(0)} msg] $msg +} {0 {} 1 {can't set "y": upvar refers to element in deleted array} 1 {can't read "y(0)": no such variable} 1 {can't read "y(0)": no such variable}} +test trace-14.7 {unsets during read traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) r {traceReset2 y y(0)} + lappend info [catch {set y(0)} msg] $msg [catch {set y(0)} msg] $msg +} {0 {} 0 xyzzy 1 {can't read "y(0)": no such element in array} 0 xyzzy} +test trace-14.8 {unsets during write traces} { + catch {unset y} + set y 1234 + set info {} + trace var y w {traceUnset y} + trace var y u {traceAppend unset} + lappend info [catch {set y xxx} msg] $msg +} {unset 0 {} 1 {can't read "x": no such variable} 0 {}} +test trace-14.9 {unsets during write traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) w {traceUnset y(0)} + lappend info [catch {set y(0) xxx} msg] $msg +} {0 {} 1 {can't read "x": no such variable} 0 {}} +test trace-14.10 {unsets during write traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) w {traceUnset y} + lappend info [catch {set y(0) xxx} msg] $msg +} {0 {} 1 {can't read "x": no such variable} 0 {}} +test trace-14.11 {unsets during write traces} { + catch {unset y} + set y 1234 + set info {} + trace var y w {traceReset y y} + lappend info [catch {set y xxx} msg] $msg +} {0 {} 0 xyzzy 0 xyzzy} +test trace-14.12 {unsets during write traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) w {traceReset y(0) y(0)} + lappend info [catch {set y(0) xxx} msg] $msg +} {0 {} 0 xyzzy 0 xyzzy} +test trace-14.13 {unsets during write traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) w {traceReset y y(0)} + lappend info [catch {set y(0) xxx} msg] $msg [catch {set y(0)} msg] $msg +} {0 {} 1 {can't set "y": upvar refers to element in deleted array} 0 {} 1 {can't read "y(0)": no such variable}} +test trace-14.14 {unsets during write traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) w {traceReset2 y y(0)} + lappend info [catch {set y(0) xxx} msg] $msg [catch {set y(0)} msg] $msg +} {0 {} 0 xyzzy 0 {} 0 xyzzy} +test trace-14.15 {unsets during unset traces} { + catch {unset y} + set y 1234 + set info {} + trace var y u {traceUnset y} + lappend info [catch {unset y} msg] $msg [catch {set y} msg] $msg +} {1 {can't unset "x": no such variable} 1 {can't read "x": no such variable} 0 {} 1 {can't read "y": no such variable}} +test trace-14.16 {unsets during unset traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) u {traceUnset y(0)} + lappend info [catch {unset y(0)} msg] $msg [catch {set y(0)} msg] $msg +} {1 {can't unset "x": no such variable} 1 {can't read "x": no such variable} 0 {} 1 {can't read "y(0)": no such element in array}} +test trace-14.17 {unsets during unset traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) u {traceUnset y} + lappend info [catch {unset y(0)} msg] $msg [catch {set y(0)} msg] $msg +} {0 {} 1 {can't read "x": no such variable} 0 {} 1 {can't read "y(0)": no such variable}} +test trace-14.18 {unsets during unset traces} { + catch {unset y} + set y 1234 + set info {} + trace var y u {traceReset2 y y} + lappend info [catch {unset y} msg] $msg [catch {set y} msg] $msg +} {1 {can't unset "y": no such variable} 0 xyzzy 0 {} 0 xyzzy} +test trace-14.19 {unsets during unset traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) u {traceReset2 y(0) y(0)} + lappend info [catch {unset y(0)} msg] $msg [catch {set y(0)} msg] $msg +} {1 {can't unset "y(0)": no such element in array} 0 xyzzy 0 {} 0 xyzzy} +test trace-14.20 {unsets during unset traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) u {traceReset2 y y(0)} + lappend info [catch {unset y(0)} msg] $msg [catch {set y(0)} msg] $msg +} {0 {} 0 xyzzy 0 {} 0 xyzzy} +test trace-14.21 {unsets cancelling traces} { + catch {unset y} + set y 1234 + set info {} + trace var y r {traceAppend first} + trace var y r {traceUnset y} + trace var y r {traceAppend third} + trace var y u {traceAppend unset} + lappend info [catch {set y} msg] $msg +} {third unset 0 {} 1 {can't read "x": no such variable} 1 {can't read "y": no such variable}} +test trace-14.22 {unsets cancelling traces} { + catch {unset y} + set y(0) 1234 + set info {} + trace var y(0) r {traceAppend first} + trace var y(0) r {traceUnset y} + trace var y(0) r {traceAppend third} + trace var y(0) u {traceAppend unset} + lappend info [catch {set y(0)} msg] $msg +} {third unset 0 {} 1 {can't read "x": no such variable} 1 {can't read "y(0)": no such variable}} + +# Check various non-interference between traces and other things. + +test trace-15.1 {trace doesn't prevent unset errors} { + catch {unset x} + set info {} + trace var x u {traceProc} + list [catch {unset x} msg] $msg $info +} {1 {can't unset "x": no such variable} {x {} u}} +test trace-15.2 {traced variables must survive procedure exits} { + catch {unset x} + proc p1 {} {global x; trace var x w traceProc} + p1 + trace vinfo x +} {{w traceProc}} +test trace-15.3 {traced variables must survive procedure exits} { + catch {unset x} + set info {} + proc p1 {} {global x; trace var x w traceProc} + p1 + set x 44 + set info +} {x {} w} + +# Be sure that procedure frames are released before unset traces +# are invoked. + +test trace-16.1 {unset traces on procedure returns} { + proc p1 {x y} {set a 44; p2 14} + proc p2 {z} {trace var z u {traceCheck {lsort [uplevel {info vars}]}}} + set info {} + p1 foo bar + set info +} {0 {a x y}} + +# Delete arrays when done, so they can be re-used as scalars +# elsewhere. + +catch {unset x} +catch {unset y} +concat {} diff --git a/vendor/x11iraf/obm/Tcl/tests/unknown.test b/vendor/x11iraf/obm/Tcl/tests/unknown.test new file mode 100644 index 00000000..e80258af --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/unknown.test @@ -0,0 +1,73 @@ +# Commands covered: unknown +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/unknown.test,v 1.7 93/10/11 09:06:00 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +catch {rename unknown {}} + +test unknown-1.1 {non-existent "unknown" command} { + list [catch {_non-existent_ foo bar} msg] $msg +} {1 {invalid command name: "_non-existent_"}} + +proc unknown {args} { + global x + set x $args +} + +test unknown-2.1 {calling "unknown" command} { + foobar x y z + set x +} {foobar x y z} +test unknown-2.2 {calling "unknown" command with lots of args} { + foobar 1 2 3 4 5 6 7 + set x +} {foobar 1 2 3 4 5 6 7} +test unknown-2.3 {calling "unknown" command with lots of args} { + foobar 1 2 3 4 5 6 7 8 + set x +} {foobar 1 2 3 4 5 6 7 8} +test unknown-2.4 {calling "unknown" command with lots of args} { + foobar 1 2 3 4 5 6 7 8 9 + set x +} {foobar 1 2 3 4 5 6 7 8 9} + +test unknown-3.1 {argument quoting in calls to "unknown"} { + foobar \{ \} a\{b \; "\\" \$a a\[b \] + set x +} "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]" + +proc unknown args { + error "unknown failed" +} + +test unknown-4.1 {errors in "unknown" procedure} { + list [catch {non-existent a b} msg] $msg $errorCode +} {1 {unknown failed} NONE} + +catch {rename unknown {}} +return {} diff --git a/vendor/x11iraf/obm/Tcl/tests/uplevel.test b/vendor/x11iraf/obm/Tcl/tests/uplevel.test new file mode 100644 index 00000000..675cb335 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/uplevel.test @@ -0,0 +1,123 @@ +# Commands covered: uplevel +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/uplevel.test,v 1.11 93/07/17 14:38:22 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +proc a {x y} { + newset z [expr $x+$y] + return $z +} +proc newset {name value} { + uplevel set $name $value + uplevel 1 {uplevel 1 {set xyz 22}} +} + +test uplevel-1.1 {simple operation} { + set xyz 0 + a 22 33 +} 55 +test uplevel-1.2 {command is another uplevel command} { + set xyz 0 + a 22 33 + set xyz +} 22 + +proc a1 {} { + b1 + global a a1 + set a $x + set a1 $y +} +proc b1 {} { + c1 + global b b1 + set b $x + set b1 $y +} +proc c1 {} { + uplevel 1 set x 111 + uplevel #2 set y 222 + uplevel 2 set x 333 + uplevel #1 set y 444 + uplevel 3 set x 555 + uplevel #0 set y 666 +} +a1 +test uplevel-2.1 {relative and absolute uplevel} {set a} 333 +test uplevel-2.2 {relative and absolute uplevel} {set a1} 444 +test uplevel-2.3 {relative and absolute uplevel} {set b} 111 +test uplevel-2.4 {relative and absolute uplevel} {set b1} 222 +test uplevel-2.5 {relative and absolute uplevel} {set x} 555 +test uplevel-2.6 {relative and absolute uplevel} {set y} 666 + +test uplevel-3.1 {uplevel to same level} { + set x 33 + uplevel #0 set x 44 + set x +} 44 +test uplevel-3.2 {uplevel to same level} { + set x 33 + uplevel 0 set x +} 33 +test uplevel-3.3 {uplevel to same level} { + set y xxx + proc a1 {} {set y 55; uplevel 0 set y 66; return $y} + a1 +} 66 +test uplevel-3.4 {uplevel to same level} { + set y zzz + proc a1 {} {set y 55; uplevel #1 set y} + a1 +} 55 + +test uplevel-4.1 {error: non-existent level} { + list [catch c1 msg] $msg +} {1 {bad level "#2"}} +test uplevel-4.2 {error: non-existent level} { + proc c2 {} {uplevel 3 {set a b}} + list [catch c2 msg] $msg +} {1 {bad level "3"}} +test uplevel-4.3 {error: not enough args} { + list [catch uplevel msg] $msg +} {1 {wrong # args: should be "uplevel ?level? command ?arg ...?"}} +test uplevel-4.4 {error: not enough args} { + proc upBug {} {uplevel 1} + list [catch upBug msg] $msg +} {1 {wrong # args: should be "uplevel ?level? command ?arg ...?"}} + +proc a2 {} { + uplevel a3 +} +proc a3 {} { + global x y + set x [info level] + set y [info level 1] +} +a2 +test uplevel-5.1 {info level} {set x} 1 +test uplevel-5.2 {info level} {set y} a3 diff --git a/vendor/x11iraf/obm/Tcl/tests/upvar.test b/vendor/x11iraf/obm/Tcl/tests/upvar.test new file mode 100644 index 00000000..bfef720c --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/upvar.test @@ -0,0 +1,303 @@ +# Commands covered: upvar +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/upvar.test,v 1.4 93/07/17 14:38:10 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test upvar-1.1 {reading variables with upvar} { + proc p1 {a b} {set c 22; set d 33; p2} + proc p2 {} {upvar a x1 b x2 c x3 d x4; set a abc; list $x1 $x2 $x3 $x4 $a} + p1 foo bar +} {foo bar 22 33 abc} +test upvar-1.2 {reading variables with upvar} { + proc p1 {a b} {set c 22; set d 33; p2} + proc p2 {} {p3} + proc p3 {} {upvar 2 a x1 b x2 c x3 d x4; set a abc; list $x1 $x2 $x3 $x4 $a} + p1 foo bar +} {foo bar 22 33 abc} +test upvar-1.3 {reading variables with upvar} { + proc p1 {a b} {set c 22; set d 33; p2} + proc p2 {} {p3} + proc p3 {} { + upvar #1 a x1 b x2 c x3 d x4 + set a abc + list $x1 $x2 $x3 $x4 $a + } + p1 foo bar +} {foo bar 22 33 abc} +test upvar-1.4 {reading variables with upvar} { + set x1 44 + set x2 55 + proc p1 {} {p2} + proc p2 {} { + upvar 2 x1 x1 x2 a + upvar #0 x1 b + set c $b + incr b 3 + list $x1 $a $b + } + p1 +} {47 55 47} +test upvar-1.4 {reading array elements with upvar} { + proc p1 {} {set a(0) zeroth; set a(1) first; p2} + proc p2 {} {upvar a(0) x; set x} + p1 +} {zeroth} + +test upvar-2.1 {writing variables with upvar} { + proc p1 {a b} {set c 22; set d 33; p2; list $a $b $c $d} + proc p2 {} { + upvar a x1 b x2 c x3 d x4 + set x1 14 + set x4 88 + } + p1 foo bar +} {14 bar 22 88} +test upvar-2.2 {writing variables with upvar} { + set x1 44 + set x2 55 + proc p1 {x1 x2} { + upvar #0 x1 a + upvar x2 b + set a $x1 + set b $x2 + } + p1 newbits morebits + list $x1 $x2 +} {newbits morebits} +test upvar-2.3 {writing variables with upvar} { + catch {unset x1} + catch {unset x2} + proc p1 {x1 x2} { + upvar #0 x1 a + upvar x2 b + set a $x1 + set b $x2 + } + p1 newbits morebits + list [catch {set x1} msg] $msg [catch {set x2} msg] $msg +} {0 newbits 0 morebits} +test upvar-2.4 {writing array elements with upvar} { + proc p1 {} {set a(0) zeroth; set a(1) first; list [p2] $a(0)} + proc p2 {} {upvar a(0) x; set x xyzzy} + p1 +} {xyzzy xyzzy} + +test upvar-3.1 {unsetting variables with upvar} { + proc p1 {a b} {set c 22; set d 33; p2; lsort [info vars]} + proc p2 {} { + upvar 1 a x1 d x2 + unset x1 x2 + } + p1 foo bar +} {b c} +test upvar-3.2 {unsetting variables with upvar} { + proc p1 {a b} {set c 22; set d 33; p2; lsort [info vars]} + proc p2 {} { + upvar 1 a x1 d x2 + unset x1 x2 + set x2 28 + } + p1 foo bar +} {b c d} +test upvar-3.3 {unsetting variables with upvar} { + set x1 44 + set x2 55 + proc p1 {} {p2} + proc p2 {} { + upvar 2 x1 a + upvar #0 x2 b + unset a b + } + p1 + list [info exists x1] [info exists x2] +} {0 0} +test upvar-3.4 {unsetting variables with upvar} { + set x1 44 + set x2 55 + proc p1 {} { + upvar x1 a x2 b + unset a b + set b 118 + } + p1 + list [info exists x1] [catch {set x2} msg] $msg +} {0 0 118} +test upvar-3.5 {unsetting array elements with upvar} { + proc p1 {} { + set a(0) zeroth + set a(1) first + set a(2) second + p2 + array names a + } + proc p2 {} {upvar a(0) x; unset x} + p1 +} {1 2} +test upvar-3.6 {unsetting then resetting array elements with upvar} { + proc p1 {} { + set a(0) zeroth + set a(1) first + set a(2) second + p2 + list [array names a] [catch {set a(0)} msg] $msg + } + proc p2 {} {upvar a(0) x; unset x; set x 12345} + p1 +} {{0 1 2} 0 12345} + +test upvar-4.1 {nested upvars} { + set x1 88 + proc p1 {a b} {set c 22; set d 33; p2} + proc p2 {} {global x1; upvar c x2; p3} + proc p3 {} { + upvar x1 a x2 b + list $a $b + } + p1 14 15 +} {88 22} +test upvar-4.2 {nested upvars} { + set x1 88 + proc p1 {a b} {set c 22; set d 33; p2; list $a $b $c $d} + proc p2 {} {global x1; upvar c x2; p3} + proc p3 {} { + upvar x1 a x2 b + set a foo + set b bar + } + list [p1 14 15] $x1 +} {{14 15 bar 33} foo} + +proc tproc {args} {global x; set x [list $args [uplevel info vars]]} +test upvar-5.1 {traces involving upvars} { + proc p1 {a b} {set c 22; set d 33; trace var c rw tproc; p2} + proc p2 {} {upvar c x1; set x1 22} + set x --- + p1 foo bar + set x +} {{x1 {} w} x1} +test upvar-5.2 {traces involving upvars} { + proc p1 {a b} {set c 22; set d 33; trace var c rw tproc; p2} + proc p2 {} {upvar c x1; set x1} + set x --- + p1 foo bar + set x +} {{x1 {} r} x1} +test upvar-5.3 {traces involving upvars} { + proc p1 {a b} {set c 22; set d 33; trace var c rwu tproc; p2} + proc p2 {} {upvar c x1; unset x1} + set x --- + p1 foo bar + set x +} {{x1 {} u} x1} + +test upvar-6.1 {retargeting an upvar} { + proc p1 {} { + set a(0) zeroth + set a(1) first + set a(2) second + p2 + } + proc p2 {} { + upvar a x + set result {} + foreach i [array names x] { + upvar a($i) x + lappend result $x + } + lsort $result + } + p1 +} {first second zeroth} +test upvar-6.2 {retargeting an upvar} { + set x 44 + set y abcde + proc p1 {} { + global x + set result $x + upvar y x + lappend result $x + } + p1 +} {44 abcde} +test upvar-6.3 {retargeting an upvar} { + set x 44 + set y abcde + proc p1 {} { + upvar y x + lappend result $x + global x + lappend result $x + } + p1 +} {abcde 44} + +test upvar-7.1 {upvar to same level} { + set x 44 + set y 55 + catch {unset uv} + upvar #0 x uv + set uv abc + upvar 0 y uv + set uv xyzzy + list $x $y +} {abc xyzzy} +test upvar-7.2 {upvar to same level} { + set x 1234 + set y 4567 + proc p1 {x y} { + upvar 0 x uv + set uv $y + return "$x $y" + } + p1 44 89 +} {89 89} +test upvar-7.3 {upvar to same level} { + set x 1234 + set y 4567 + proc p1 {x y} { + upvar #1 x uv + set uv $y + return "$x $y" + } + p1 xyz abc +} {abc abc} + +test upvar-8.1 {errors in upvar command} { + list [catch upvar msg] $msg +} {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}} +test upvar-8.2 {errors in upvar command} { + list [catch {upvar 1} msg] $msg +} {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}} +test upvar-8.3 {errors in upvar command} { + proc p1 {} {upvar a b c} + list [catch p1 msg] $msg +} {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}} +test upvar-8.4 {errors in upvar command} { + proc p1 {} {set a 33; upvar b a} + list [catch p1 msg] $msg +} {1 {variable "a" already exists}} diff --git a/vendor/x11iraf/obm/Tcl/tests/while.test b/vendor/x11iraf/obm/Tcl/tests/while.test new file mode 100644 index 00000000..48a08e19 --- /dev/null +++ b/vendor/x11iraf/obm/Tcl/tests/while.test @@ -0,0 +1,113 @@ +# Commands covered: while +# +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and its documentation for any purpose, provided that the +# above copyright notice and the following two paragraphs appear in +# all copies of this software. +# +# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT +# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF +# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO +# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +# +# $Header: /user6/ouster/tcl/tests/RCS/while.test,v 1.7 93/04/21 11:18:58 ouster Exp $ (Berkeley) + +if {[string compare test [info procs test]] == 1} then {source defs} + +test while-1.1 {basic while loops} { + set count 0 + while {$count < 10} {set count [expr $count+1]} + set count +} 10 +test while-1.2 {basic while loops} { + set value xxx + while {2 > 3} {set value yyy} + set value +} xxx +test while-1.3 {basic while loops} { + set value 1 + while {"true"} { + incr value; + if {$value > 5} { + break; + } + } + set value +} 6 + +test while-2.1 {continue in while loop} { + set list {1 2 3 4 5} + set index 0 + set result {} + while {$index < 5} { + if {$index == 2} {set index [expr $index+1]; continue} + set result [concat $result [lindex $list $index]] + set index [expr $index+1] + } + set result +} {1 2 4 5} + +test while-3.1 {break in while loop} { + set list {1 2 3 4 5} + set index 0 + set result {} + while {$index < 5} { + if {$index == 3} break + set result [concat $result [lindex $list $index]] + set index [expr $index+1] + } + set result +} {1 2 3} + +test while-4.1 {errors in while loops} { + set err [catch {while} msg] + list $err $msg +} {1 {wrong # args: should be "while test command"}} +test while-4.2 {errors in while loops} { + set err [catch {while 1} msg] + list $err $msg +} {1 {wrong # args: should be "while test command"}} +test while-4.3 {errors in while loops} { + set err [catch {while 1 2 3} msg] + list $err $msg +} {1 {wrong # args: should be "while test command"}} +test while-4.4 {errors in while loops} { + set err [catch {while {"a"+"b"} {error "loop aborted"}} msg] + list $err $msg +} {1 {can't use non-numeric string as operand of "+"}} +test while-4.5 {errors in while loops} { + set x 1 + set err [catch {while {$x} {set x foo}} msg] + list $err $msg +} {1 {expected boolean value but got "foo"}} +test while-4.6 {errors in while loops} { + set err [catch {while {1} {error "loop aborted"}} msg] + list $err $msg $errorInfo +} {1 {loop aborted} {loop aborted + while executing +"error "loop aborted"" + ("while" body line 1) + invoked from within +"while {1} {error "loop aborted"}"}} + +test while-5.1 {while return result} { + while {0} {set a 400} +} {} +test while-5.2 {while return result} { + set x 1 + while {$x} {set x 0} +} {} diff --git a/vendor/x11iraf/obm/client.c b/vendor/x11iraf/obm/client.c new file mode 100644 index 00000000..32277572 --- /dev/null +++ b/vendor/x11iraf/obm/client.c @@ -0,0 +1,253 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ObmP.h> + + +/* + * CLIENT class. + * -------------------------- + * The client is the client application, which provides the functionality + * underlying the UI. When a message is sent to the client object it usually + * results in a message being sent to the client *application*, usually an + * external program communicating via IPC, which has little or no knowledge + * of the UI. The client application receives and executes commands delivered + * by the UI via the client object. Output from the client may or may not + * come back to the object manager. That portion of the output which comes + * back to the object manager is in the form of assignments of string values + * to UI parameter-class objects (another way of thinking of this is that + * messages or events are sent to and acted upon by the parameter objects). + * Hence, the client object is output only so far as the client application + * is concerned. + * + * The Client-class commands are used to send a message to the client. + * + * gkey <key> + * gcmd <command-string> + * literal <command> + * + * or just <command>, e.g., "send client <command>" will work in most cases. + * + * GKEY sends and IRAF graphics keystroke. GCMD sends and IRAF graphics + * colon command. LITERAL sends a literal command string to the client. + * The keyword "literal" may optionally be omitted, i.e., "send client foo" + * and "send client literal foo" are the same. The keyword "literal" may + * be used to ensure that the client command string which follows will not + * be interpreted as a Client-class command (such as gkey, gcmd, or literal). + */ + +struct clientPrivate { + ObmContext obm; + Tcl_Interp *tcl; +}; + +typedef struct clientPrivate *ClientPrivate; + +struct clientObject { + struct obmObjectCore core; + struct clientPrivate client; +}; + +typedef struct clientObject *ClientObject; + +static void ClientDestroy(); +static int ClientEvaluate(); +static ObmObject ClientCreate(); +static int clientGcmd(), clientGkey(), clientLiteral(); +static int client_output(); + + +/* ClientClassInit -- Initialize the class record for the client class. + */ +void +ClientClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + classrec->ClassDestroy = obmGenericClassDestroy; + classrec->Create = (ObmFunc) ClientCreate; + classrec->Destroy = ClientDestroy; + classrec->Evaluate = ClientEvaluate; +} + + +/* ClientCreate -- Create an instance of a client object. + */ +static ObmObject +ClientCreate (obm, name, classrec, parent, args, nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList args; +int nargs; +{ + register ClientObject obj; + register Tcl_Interp *tcl; + + obj = (ClientObject) XtCalloc (1, sizeof (struct clientObject)); + obj->client.tcl = tcl = Tcl_CreateInterp(); + obj->client.obm = obm; + + /* Register client-object actions. */ + Tcl_CreateCommand (tcl, + "gcmd", clientGcmd, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "gkey", clientGkey, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "literal", clientLiteral, (ClientData)obj, NULL); + + return ((ObmObject) obj); +} + + +/* ClientDestroy -- Destroy an instance of a client object. + */ +static void +ClientDestroy (object) +ObmObject object; +{ + register ClientObject obj = (ClientObject) object; + + if (obj->core.being_destroyed++) + Tcl_DeleteInterp (obj->client.tcl); +} + + +/* ClientEvaluate -- Evaluate a client command or message. + */ +static int +ClientEvaluate (object, command) +ObmObject object; +char *command; +{ + register ClientObject obj = (ClientObject) object; + register Tcl_Interp *tcl = obj->client.tcl; + int status, argc, i; + char *argv[MAX_ARGS]; + char **argvp; + + if (!obmClientCommand (tcl, command)) + goto literal; + + /* If the command is unrecognized pass it on to the client as a + * literal to be processed by the client. + */ + if ((status = Tcl_Eval (tcl, command)) != TCL_OK) { +literal: if (Tcl_SplitList (tcl, command, &argc, &argvp) == TCL_OK) { + argv[0] = "literal"; + if (argc > MAX_ARGS) + argc = MAX_ARGS; + for (i=0; i <= argc; i++) + argv[i+1] = argvp[i]; + + status = clientLiteral (object, tcl, argc + 1, argv); + free ((char *) argvp); + } + } + + return (status); +} + + +/* clientGcmd -- Send a graphics command string to the client application. + * A graphics command string is a graphics cursor value with the key set + * to `:' and the command string given as the string part of the cursor + * value. The protocol module which posted the client output procedure is + * responsible for encoding and sending the cursor command. + * + * Usage: gcmd <command-string> + */ +static int +clientGcmd (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ClientObject obj = (ClientObject) object; + register ObmContext obm = obj->client.obm; + int stat; + + if (argc >= 2) { + char *message = Tcl_Concat (argc-1, &argv[1]); + stat = client_output (obm, obj->core.name, ':', message); + free ((char *)message); + } else + stat = -1; + + return (stat < 0 ? TCL_ERROR : TCL_OK); +} + + +/* clientGkey -- Send a graphics key event to the client application. + * A graphics key event is a graphics cursor value with the key set to some + * integer value and a null string part. + * + * Usage: gkey <key> + */ +static int +clientGkey (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ClientObject obj = (ClientObject) object; + register ObmContext obm = obj->client.obm; + int stat; + + if (argc >= 2) + stat = client_output (obm, obj->core.name, *argv[1], ""); + else + stat = -1; + + return (stat < 0 ? TCL_ERROR : TCL_OK); +} + + +/* clientLiteral -- Send a literal command to the client application. + * + * Usage: literal <command> + */ +static int +clientLiteral (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ClientObject obj = (ClientObject) object; + register ObmContext obm = obj->client.obm; + int stat; + + if (argc >= 2) { + char *message = Tcl_Concat (argc-1, &argv[1]); + stat = client_output (obm, obj->core.name, 0, message); + free ((char *)message); + } else + stat = -1; + + return (stat < 0 ? TCL_ERROR : TCL_OK); +} + + +/* client_output -- Call the client output callbacks if any. + */ +static int +client_output (obm, objname, key, strval) +register ObmContext obm; +char *objname; +int key; +char *strval; +{ + register ObmCallback cb; + register int stat = 0; + + for (cb = obm->callback_list; cb; cb = cb->next) + if ((cb->callback_type & OBMCB_clientOutput) && cb->u.fcn) + stat |= ((*cb->u.fcn) (cb->client_data, obm->tcl, + objname, key, strval)); + + return (stat != 0); +} diff --git a/vendor/x11iraf/obm/docs/gui.doc/TclQuickRef.html b/vendor/x11iraf/obm/docs/gui.doc/TclQuickRef.html new file mode 100644 index 00000000..3f41eb29 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/TclQuickRef.html @@ -0,0 +1,208 @@ +<title>Tcl Quick Reference</title> + + +<H1><pre>TCL Quick Reference +Based on TCL version 6.4 +Jeff Tranter 12-Aug-1992</pre><h1> + + +<pre> +Basic Language Features + +# comment (continues to end of line) +" " allows embedding whitespace in arguments; substitutions made +{ } group arguments; substitutions not made +[ ] command substitution; replace with result of command +$var variable substitution +; command separator + + +Backslash Substitution + +\b backspace +\[ open bracket +\f form feed +\] close bracket +\n newline +\$ dollar sign +\r carriage return +\<space> space +\t tab +\; semi-colon +\v vertical tab +\" double-quote +\{ left brace +\<newln> newline +\} right brace +\\ backslash +\ddd octal digits + + +Built-in Variables + +env +errorCode +errorInfo + + +Operators (in decreasing order of precedence) + +- ~ ! unary minus, bit-wise NOT, logical NOT +* / % multiply, divide, remainder ++ - add, subtract +<< >> left and right shift +< > <= >= boolean comparisons +== != boolean equal, not equa +& bit-wise AND +^ bit-wise exclusive OR +| bit-wise inclusive OR +&& logical AND +|| logical OR +x?y:z conditional operator + +All operators support integers. +All support floating point except ~, %, <<, >>, &, ^, and | +Boolean operators can also be used on strings. + + +Regular Expressions +regex | regex match either expression +regex* match zero or more of regex +regex+ match one or more of regex +regex? match zero or one of regex +. any single character (except newline) +^ match beginning of line +$ match end of line +\c match character c +c match character c +[] match set of characters +[a-z] match range of characters +[^] match characters not in range or set +() group expressions + + +Keywords + +append varName value [value value ...] +array anymore arrayName searchId +array donesearch arrayName searchId +array names arrayName +array nextelement arrayName searchId +array size arrayName +array startsearch arrayName +break +case string [in] patList body [patList body ...] +case string [in] {patList body [patList body ...] +catch command [varName] +cd [dirName] +close fileId +concat arg [arg ...] +continue +error message [info] [code] +eof fileId +error $errMsg $savedInfo +eval arg [arg ...] +exec arg [arg ...] +exit [returnCode] +expr arg +file atime name +file dirname name +file executable name +file exists name +file extension name +file isdirectory name +file isfile name +file lstat name varName +file mtime name +file owned name +file readable name +file readlink name +file rootname name +file size name +file stat name varName +file tail name +file type name +file writable name +flush fileId +for start test next body +foreach varname list body +format formatString [arg arg ...] +gets fileId [varName] +glob [-nocomplain] filename [filename ...] +global varname [varname ...] +history +history add command [exec] +history change newValue [event] +history event [event] +history info [count] +history keep count +history nextid +history redo [event] +history substitute old new [event] +history words selector [event] +if test [then] trueBody [else] [falseBody] +incr varName [increment] +info args procname +info body procname +info cmdcount +info commands [pattern] +info default procname arg varname +into variable varname +info exists varName +info globals [pattern] +info level [number] +info library +info locals [pattern] +info procs [pattern] +info script +info tclversion +info vars [pattern] +join list [joinString] +lappend varName value [value value ...] +lindex list index +linsert list index element [element element ...] +list arg [arg ...] +llength list +lrange list first last +lreplace list first last [element element ...] +lsearch list pattern +lsort list +open fileName [access] +proc name args body +puts fileId string [nonewline] +pwd +read fileId +read fileId nonewline +read fileId numBytes +regexp [-indices] [-nocase] exp string [matchVar] [subMatchVar subMatchVar ...] +regsub [-all] [-nocase] exp string subSpec varName +rename oldName newName +return [value] +scan string format varname1 [varname2 ...] +seek fileId offset [origin] +set varname [value] +source fileName +split string [splitChars] +string compare string1 string2 +string first string1 string2 +string index string charIndex +string last string1 string2 +string length string +string match pattern string +string range string first last +string tolower string +string toupper string +string trim string [chars] +string trimleft string [chars] +string trimright string [chars] +tell fileId +time command [count] +trace variable name ops command +trace vdelete name ops command +trace vinfo name +unknown cmdName [arg arg ...] +unset name [name name ...] +uplevel [level] command [command ...] +upvar [level] otherVar myVar [otherVar myVar ...] +while test body +</pre> diff --git a/vendor/x11iraf/obm/docs/gui.doc/alphabetic.html b/vendor/x11iraf/obm/docs/gui.doc/alphabetic.html new file mode 100644 index 00000000..0c141617 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/alphabetic.html @@ -0,0 +1,39 @@ +<title>Alphabetized list of GUI commands</title> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<pre> +<a href="gtermclass.html#activate">activate</a> <a href="servercom.html#activate">activate</a> <a href="notyet.html">activeMapping</a> <a href="gmc.html#addCallback">addCallback</a> <a href="gtermclass.html#addCallback">addCallback</a> +<a href="uiparameterclass.html#addCallback">addCallback</a> <a href="widgetclass.html#addCallback">addCallback</a> <a href="widgetclass.html#addEventHandler">addEventHandler</a> <a href="widgetclass.html#append">append</a> <a href="servercom.html#appInitialize">appInitialize</a> +<a href="notyet.html">assignRaster</a> <a href="gtermclass.html#bell">bell</a> <a href="widgetclass.html#do_userproc">call</a> <a href="gtermclass.html#clearScreen">clearScreen</a> <a href="widgetclass.html#configure">configure</a> +<a href="notyet.html">copyPixmap</a> <a href="notyet.html">copyRaster</a> <a href="servercom.html#createBitmap">createBitmap</a> <a href="servercom.html#createCursor">createCursor</a> <a href="gtermclass.html#createMarker">createMarker</a> +<a href="servercom.html#createMenu">createMenu</a> <a href="servercom.html#createObjects">createObjects</a> <a href="notyet.html">createPixmap</a> <a href="servercom.html#createPixmap">createPixmap</a> <a href="notyet.html">createRaster</a> +<a href="gtermclass.html#deactivate">deactivate</a> <a href="servercom.html#deactivate">deactivate</a> <a href="uiparameterclass.html#deleteCallback">deleteCallback</a> <a href="widgetclass.html#deleteCallback">deleteCallback</a> <a href="servercom.html#deleteTimedCallback">deleteTimedCallback</a> +<a href="servercom.html#deleteWorkCallback">deleteWorkCallback</a> <a href="gmc.html#destroy">destroy</a> <a href="servercom.html#destroyMenu">destroyMenu</a> <a href="servercom.html#destroyObject">destroyObject</a> +<a href="notyet.html">destroyRaster</a> <a href="notyet.html">disableMapping</a> <a href="notyet.html">drawAlphaText</a> <a href="notyet.html">drawDialogText</a> <a href="notyet.html">drawMarker</a> +<a href="notyet.html">drawPolygon</a> <a href="notyet.html">drawPolyline</a> <a href="notyet.html">drawPolymarker</a> <a href="servercom.html#createMenu">editMenu</a> <a href="notyet.html">enableMapping</a> +<a href="ximclient.html#encodewcs">encodewcs</a> <a href="notyet.html">endDialog</a> <a href="notyet.html">eraseDialog</a> <a href="ximclient.html#fitFrame">fitFrame</a> <a href="gtermclass.html#flip">flip</a> +<a href="ximclient.html#flip">flip</a> <a href="gtermclass.html#flush">flush</a> <a href="notyet.html">freeColormap</a> <a href="notyet.html">freeMapping</a> <a href="clientclass.html#gcmd">gcmd</a> +<a href="gmc.html#getAttribute">get</a> <a href="widgetclass.html#get">get</a> <a href="notyet.html">getAlphaTextSize</a> <a href="gmc.html#getAttribute">getAttribute</a> +<a href="gmc.html#getAttributes">getAttributes</a> <a href="gtermclass.html#getCursorPos">getCursorPos</a> <a href="notyet.html">getDialogTextSize</a> <a href="ximclient.html#getFrame">getFrame</a> +<a href="widgetclass.html#getItem">getItem</a> <a href="notyet.html">getLogRes</a> <a href="gtermclass.html#getMapping">getMapping</a> <a href="notyet.html">getPhysRes</a> <a href="gtermclass.html#getPixel">getPixel</a> +<a href="gtermclass.html#getRaster">getRaster</a> <a href="gmc.html#getRect">getRect</a> <a href="gmc.html#getRegion">getRegion</a> <a href="servercom.html#getResource">getResource</a> <a href="servercom.html#getResources">getResources</a> +<a href="uiparameterclass.html#getValue">getValue</a> <a href="gmc.html#getVertices">getVertices</a> <a href="clientclass.html#gkey">gkey</a> <a href="widgetclass.html#highlight">highlight</a> <a href="notyet.html">initMappings</a> +<a href="widgetclass.html#isRealized">isRealized</a> <a href="widgetclass.html#isSensitive">isSensitive</a> <a href="clientclass.html#literal">literal</a> <a href="gtermclass.html#loadColormap">loadColormap</a> <a href="gmc.html#lower">lower</a> +<a href="gmc.html#makeCopy">makeCopy</a> <a href="widgetclass.html#manage">manage</a> <a href="widgetclass.html#map">map</a> <a href="gtermclass.html#markerInit">markerInit</a> <a href="gmc.html#markpos">markpos</a> +<a href="ximclient.html#matchFrames">matchFrames</a> <a href="gmc.html#move">move</a> <a href="widgetclass.html#move">move</a> <a href="notyet.html">nextColormap</a> <a href="ximclient.html#nextFrame">nextFrame</a> +<a href="gtermclass.html#nextMapping">nextMapping</a> <a href="notyet.html">nextRaster</a> <a href="gmc.html#notify">notify</a> <a href="uiparameterclass.html#notify">notify</a> <a href="notyet.html">nRasters</a> +<a href="ximclient.html#pan">pan</a> <a href="widgetclass.html#do_popdown">popdown</a> <a href="widgetclass.html#popdown">popdown</a> <a href="widgetclass.html#do_popup">popup</a> <a href="widgetclass.html#popup">popup</a> +<a href="widgetclass.html#popupSpringLoaded">popupSpringLoaded</a> <a href="servercom.html#postActivateCallback">postActivateCallback</a> <a href="servercom.html#postTimedCallback">postTimedCallback</a> +<a href="servercom.html#postWorkCallback">postWorkCallback</a> <a href="ximclient.html#prevFrame">prevFrame</a> <a href="servercom.html#print">print</a> <a href="notyet.html">queryRaster</a> +<a href="ximclient.html#Quit">Quit</a> <a href="gmc.html#raise">raise</a> <a href="gtermclass.html#rasterInit">rasterInit</a> <a href="notyet.html">readColormap</a> <a href="gtermclass.html#readPixels">readPixels</a> +<a href="widgetclass.html#realize">realize</a> <a href="gmc.html#redraw">redraw</a> <a href="notyet.html">refreshMapping</a> <a href="notyet.html">refreshPixels</a> <a href="servercom.html#resetReset">reset-server</a> +<a href="gtermclass.html#reset">reset</a> <a href="gmc.html#resize">resize</a> <a href="widgetclass.html#resize">resize</a> <a href="ximclient.html#retCursorVal">retCursorVal</a> <a href="gmc.html#rotate">rotate</a> +<a href="gtermclass.html#selectRaster">selectRaster</a> <a href="servercom.html#send">send</a> <a href="gmc.html#setAttribute">set</a> <a href="widgetclass.html#set">set</a> <a href="gmc.html#setAttribute">setAttribute</a> +<a href="gmc.html#setAttributes">setAttributes</a> <a href="notyet.html">setColorIndex</a> <a href="ximclient.html#setColormap">setColormap</a> <a href="gtermclass.html#setCursorPos">setCursorPos</a> <a href="gtermclass.html#setCursorType">setCursorType</a> +<a href="notyet.html">setDataLevel</a> <a href="notyet.html">setFillType</a> <a href="ximclient.html#setFrame">setFrame</a> <a href="gtermclass.html#setGterm">setGterm</a> <a href="notyet.html">setLineStyle</a> +<a href="notyet.html">setLineWidth</a> <a href="widgetclass.html#setList">setList</a> <a href="notyet.html">setLogRes</a> <a href="gtermclass.html#setMapping">setMapping</a> <a href="notyet.html">setPhysRes</a> +<a href="gtermclass.html#setPixel">setPixel</a> <a href="gtermclass.html#setRaster">setRaster</a> <a href="widgetclass.html#setSensitive">setSensitive</a> <a href="notyet.html">setTextRes</a> <a href="uiparameterclass.html#setValue">setValue</a> +<a href="gmc.html#setVertices">setVertices</a> <a href="notyet.html">startDialog</a> <a href="widgetclass.html#unhighlight">unhighlight</a> <a href="widgetclass.html#unmanage">unmanage</a> <a href="widgetclass.html#unmap">unmap</a> +<a href="gtermclass.html#unmapPixel">unmapPixel</a> <a href="widgetclass.html#unrealize">unrealize</a> <a href="widgetclass.html#userEventHandler">userEventHandler</a> <a href="ximclient.html#windowColormap">windowColormap</a> +<a href="notyet.html">writeColormap</a> <a href="gtermclass.html#writePixels">writePixels</a> <a href="ximclient.html#zoom">zoom</a> <a href="ximclient.html#zoom">zoomAbs</a> +</pre> + diff --git a/vendor/x11iraf/obm/docs/gui.doc/athena.gif b/vendor/x11iraf/obm/docs/gui.doc/athena.gif new file mode 100644 index 00000000..56e74e96 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/athena.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/athena.html b/vendor/x11iraf/obm/docs/gui.doc/athena.html new file mode 100644 index 00000000..dcd3decf --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/athena.html @@ -0,0 +1,73 @@ +<title>Athena Widgets</title> +<h1><IMG SRC="irafgui.gif"> Athena Widgets</h1> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<p> +The Athena widgets were written at MIT. Each of the widget names is a +hypertext link to a page describing the widget and including an example. +<p> +<h2>Simple Widgets</h2> +<dl> +<dt><a href="commandwidget.html">Command</a> +<dd>A push button that, when selected, may cause a specific action +to take place. This widget can display a multi-line string or a bitmap image. +<dt><a href="gripwidget.html">Grip</a> +<dd>A rectangle that, when selected, will cause an action to take +place. +<dt><a href="labelwidget.html">Label</a> +<dd>A rectangle that may contain one or more lines of text or a bitmap image. +<dt><a href="listwidget.html">List</a> +<dd>A list of text strings presented in row column format that may be +individually selected. When an element is selected an action may take place. +<dt><a href="pannerwidget.html">Panner</a> +<dd>A rectangular area containing a <i>slider</i> that may be moved in two +dimensions. Notification of movement may be continuous or discrete. +<dt><a href="repeaterwidget.html">Repeater</a> +<dd>A push button that triggers an action at an increasing rate when selected. +<dt><a href="scrollbarwidget.html">Scrollbar</a> +<dd>A rectangular area containg a <i>thumb</i> that, when slid along one +dimension, may cause a specific action to take place. The Scrollbar may +be oriented horixontall or vertically. +<dt><a href="simplewidget.html">Simple</a> +<dd>The vase class for most of the simple widgets. Provides a rectangular +area with a settable mouse cursor and special border. +<dt><a href="stripchartwidget.html">StripChart</a> +<dd>A real time data graph that will automatically update and scroll. +<dt><a href="togglewidget.html">Toggle</a> +<dd>A push button [see Command] that contains state information. Toggles +may also be used as radio buttons to implement a "one of many" group of +buttons. +</dl> +<h2>Text Widgets</h2> +<dl> +<dt><a href="textwidget.html">Text</a> +<dd>Basic text widget supports edit commands. +<dt><a href="asciitextwidget.html">AsciiText</a> +<dd>This widget contains a text widget and also includes AsciiSrc and +and AsciiSink widgets. +</dl> +<h2>Composite and Constraint Widgets</h2> +<dl> +<dt><a href="boxwidget.html">Box</a> +<dd>This widget will pack its children as tightly as possible in +non-overlapping rows. +<dt><a href="dialogwidget.html">Dialog</a> +<dd>An implementation of a commonly used interaction semantic to +prompt for auxiliary input from the user, such as a filename. +<dt><a href="formwidget.html">Form</a> +<dd>A more sophisticated layout widget that allows the children to specify +their positions relative to the other children, or to the edges of the form. +<dt><a href="panedwidget.html">Paned</a> +<dd>Allows children to be tiled vertically or horizontally. Controls are also +provided to allow the user to dynamically resize the individual panes. +<dt><a href="portholewidget.html">Porthole</a> +<dd>Allows viewing of a managed child which is as large as, or larger than its +parent, typically under control of a Panner widget. +<dt><a href="treewidget.html">Tree</a> +<dd>Provides geometry management of widgets arranged in a directed, acyclic +graph. +<dt><a href="viewportwidget.html">Viewport</a> +<dd>Consists of a frame, one of two scrollbars, and an inner window. The +inner window can contain all the data that is to be displayed. This inner +window will be clipped by the frame with the scrollbars controlling which +section of the inner window is currently visible. +</dl> diff --git a/vendor/x11iraf/obm/docs/gui.doc/blueline.gif b/vendor/x11iraf/obm/docs/gui.doc/blueline.gif new file mode 100644 index 00000000..d911fe03 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/blueline.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/book.p1.ps.gz b/vendor/x11iraf/obm/docs/gui.doc/book.p1.ps.gz new file mode 100644 index 00000000..360e4950 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/book.p1.ps.gz differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/clientclass.html b/vendor/x11iraf/obm/docs/gui.doc/clientclass.html new file mode 100644 index 00000000..407c177b --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/clientclass.html @@ -0,0 +1,75 @@ +<title>CLIENT class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> CLIENT class</h1> +<p> +<HR> +<p> +The client is the client application, which provides the functionality +underlying the UI. When a message is sent to the client object it usually +results in a message being sent to the client *application*, usually an +external program communicating via IPC, which has little or no knowledge +of the UI. The client application receives and executes commands delivered +by the UI via the client object. Output from the client may or may not +come back to the object manager. That portion of the output which comes +back to the object manager is in the form of assignments of string values +to <a href="uiparameterclass.html">UI parameter-class objects</a> (another +way of thinking of this is that +messages or events are sent to and acted upon by the parameter objects). +Hence, the client object is output only so far as the client application +is concerned. +<p> +The Client-class commands are used to send a message to the client. +<p> +<pre> + <a href="#gkey">gkey</a> &lt;key&gt; + <a href="#gcmd">gcmd</a> &lt;command-string&gt; + <a href="#literal">literal</a> &lt;command&gt; +</pre> +<p> +or just &lt;command&gt;, e.g., "send client &lt;command&gt;" will work in most cases. +<p> +<a href="#gkey">GKEY</a> sends an IRAF graphics keystroke. +<a href="#gcmd">GCMD</a> sends an +IRAF graphics colon command. <a href="#literal">LITERAL</a> sends a literal +command string to the +client. The keyword "literal" may optionally be omitted, i.e., "send client +foo" and "send client literal foo" are the same. The keyword "literal" may +be used to ensure that the client command string which follows will not +be interpreted as a Client-class command (such as gkey, gcmd, or literal). +<p> +<p> +<h1><A NAME="gcmd">gcmd</A></h1> +<p> +Send a graphics command string to the client application. +A graphics command string is a graphics cursor value with the key set +to `:' and the command string given as the string part of the cursor +value. The protocol module which posted the client output procedure is +responsible for encoding and sending the cursor command. +<p> +Usage: +<p> +<pre> + gcmd &lt;command-string&gt; +</pre> +<p> +<h1><A NAME="gkey">gkey</A></h1> +<p> +Send a graphics key event to the client application. +A graphics key event is a graphics cursor value with the key set to some +integer value and a null string part. +<p> +Usage: +<p> +<pre> +gkey &lt;key&gt; +</pre> +<p> +<h1><A NAME="literal">literal</A></h1> +<p> +Send a literal command to the client application. +<p> +Usage: +<p> +<pre> + literal &lt;command&gt; +</pre> + diff --git a/vendor/x11iraf/obm/docs/gui.doc/coloredline.gif b/vendor/x11iraf/obm/docs/gui.doc/coloredline.gif new file mode 100644 index 00000000..f08eb184 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/coloredline.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/einstein.html b/vendor/x11iraf/obm/docs/gui.doc/einstein.html new file mode 100644 index 00000000..1d6e1927 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/einstein.html @@ -0,0 +1,5 @@ +<title>Einstein</title> +<p> +<a href="notyet.html"><IMG align=middle SRC="einstein.gif"></a> +Yep, that's uncle Albert! +<p> diff --git a/vendor/x11iraf/obm/docs/gui.doc/example.html b/vendor/x11iraf/obm/docs/gui.doc/example.html new file mode 100644 index 00000000..40b0b4cd --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/example.html @@ -0,0 +1,6 @@ +<title>Example: Imbrowse</title> +<h2><IMG SRC="irafgui.gif"> Example: Imbrowse</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<p> +<a href="exampmap"><IMG SRC="imbrowse.gif" ISMAP></a> +<p> diff --git a/vendor/x11iraf/obm/docs/gui.doc/exampmap b/vendor/x11iraf/obm/docs/gui.doc/exampmap new file mode 100644 index 00000000..d2284a37 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/exampmap @@ -0,0 +1,30 @@ + +default imbrowsemap/none.html + +# The ellipse containing "panel" +rect imbrowsemap/panel.html 287,19 366,56 + +# The ellipse containing "objView" +rect imbrowsemap/objView.html 226,98 312,130 + +# The ellipse containing "controlForm" +rect imbrowsemap/controlForm.html 266,154 382,186 + +# The ellipse containing "headerText" +rect imbrowsemap/headerText.html 336,96 450,130 + +# The ellipse containing "sectionBox" +rect imbrowsemap/sectionBox.html 461,99 577,131 + +# The ellipse containing "statusBox" +rect imbrowsemap/statusBox.html 75,158 202,190 + +# The ellipse containing "dirSelect" +rect imbrowsemap/dirSelect.html 7,280 95,320 + +# The ellipse containing "dirName" +rect imbrowsemap/dirName.html 74,342 167,380 + +# The ellipse containing "imageButton" +rect imbrowsemap/imageButton.html 171,280 298,315 + diff --git a/vendor/x11iraf/obm/docs/gui.doc/gmc.html b/vendor/x11iraf/obm/docs/gui.doc/gmc.html new file mode 100644 index 00000000..9e124846 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/gmc.html @@ -0,0 +1,402 @@ +<title>Graphics Marker class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> Graphics Marker class</h1> +<p> +<HR> +<p> +A marker is a graphics object implemented by the Gterm-Image widget. +Markers are not real toolkit widgets, but they act much like widgets and +are interfaced as an object class under the Object Manager. The Marker +class is not a subclass, it is a base class like Widget, but Marker objects +can exist only as children of Gterm widgets. +<p> +Since markers are not independent widgets but rather part of a Gterm widget +instance, the parent Gterm widget is partially responsible for managing +markers. The Gterm widget implements the following commands for dealing +with markers. +<p> +<pre> + <a href="gtermclass.html#createMarker">createMarker</a> name [attribute-list] + <a href="gtermclass.html#markerInit">markerInit</a> +</pre> +<p> +A new marker is created by sending the createMarker message to the parent +gterm widget. This creates a marker of the given name and type. +The markerInit command, if sent to a gterm widget, destroys any markers +defined for that widget and reinitializes the marker facility. Markers +may also be created by action procedures in response to user input events. +<p> +A marker may be destroyed by itself in response to an input event (e.g. the +user presses the delete key), by sending the marker the destroy message +to tell it to destroy itself, by sending a markerInit to the parent gterm +widget, or by destroying the marker object (or any parent) with the server +command <a href="servercom.html#destroyObject">destroyObject</a>. +<p> +Once a marker has been created it behaves as an independent object and +receives and executes messages, responds to events, generates callbacks, +and so on. The marker class defines the following commands. +<p> +<pre> + <a href="#makeCopy">makeCopy</a> name + <a href="#addCallback">addCallback</a> procedure [event [event ...]] + <a href="#notify">notify</a> [event-type [param [param ...]]] + <a href="#destroy">destroy</a> [nocallback] +<p> + <a href="#markpos">markpos</a> + <a href="#redraw">redraw</a> [function] [markpos|nomarkpos] [erase|noerase] +<p> + <a href="#raise">raise</a> [reference-marker] + <a href="#lower">lower</a> [reference-marker] +<p> + <a href="#move">move</a> x y + <a href="#resize">resize</a> width height + <a href="#rotate">rotate</a> angle # radians +<p> + <a href="#setAttribute">set</a> attribute value # alias for setAttribute + value = <a href="#getAttribute">get</a> attribute # alias for getAttribute +<p> + <a href="#setAttribute">setAttribute</a> attribute value + value = <a href="#getAttribute">getAttribute</a> attribute + <a href="#setAttributes">setAttributes</a> attribute-list + <a href="#getAttributes">getAttributes</a> attribute-list + <a href="#setVertices">setVertices</a> points first npts + <a href="#getVertices">getVertices</a> points first npts +<p> + region = <a href="#getRegion">getRegion</a> [unmap] [coord-type] + <a href="#getRect">getRect</a> dx dy dnx dny +</pre> +<p> +Marker positions and dimensions are given in window (raster 0) coordinates. +<p> +The operators raise, lower, move, resize, and rotate erase the marker, +modify it as indicated, and redraw it with the new attributes. For finer +control over marker attributes one can use [get|set]Attribute[s] and +[get|set]Vertices to edit the markers directly. In this case an auto +redraw is not performed (unless the autoRedraw marker attribute is set). +The usual sequence is a markpos to record the marker position, one or more +setAttribute calls to change marker attributes, then a redraw to erase +the old marker and redraw the new one. Markers have many attributes which +can be set to control things like the position and size, colors, line +widths, fill type and style, font, rubber-band technique, and so on. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker types and attributes. +<p> +The marker type may be changed at runtime without destroying the marker. +For example a circle can be changed to an ellipse or a rectangle. This +also works for polygons (the vertex list is preserved and restored when +the marker is changed back to a polygon). +<p> +The current shape of a marker may be queried with getVertices, which +returns the polygon or polyline vertex list in window coordinates. A more +powerful routine which does something similar is getRegion. This routine +returns a high level description of the region outlined by the marker, +giving the marker type (rectangle, circle, ellipse etc.), center, width +and height, and so on. Any position or dimension information may +optionally be transformed back to the original source raster, if the marker +center is in a region of the window which is the destination of an active +mapping. The unmap option will follow multiple mappings back to the +original mapped source raster. +<p> +The getRect function returns the parameters of the region outlined by a +rectangle marker in a form convenient for use in a Gterm setMapping call +(this is used to display an image within a marker). +<p> +Default translations when pointer is over a marker. +default Marker Translations +<p> +<pre> + Shift &lt; Btn1Motion &gt;i m_rotateResize() + &lt; Btn1Motion &gt; m_moveResize() + Shift &lt; Btn1Down &gt; m_raise() m_markpos() + &lt; Btn1Down &gt; m_raise() m_markposAdd() + &lt; Btn1Up &gt; m_redraw() m_destroyNull() + &lt; Btn2Down &gt; m_lower() + &lt; Key &gt; BackSpace m_deleteDestroy() + &lt; Key &gt; Delete m_deleteDestroy() + &lt; KeyPress &gt; m_input() + &lt; Motion &gt; track-cursor() +</pre> +<p> +MARKER class commands. +<p> +makeCopy</A></h1> +<p> +Copy a marker. The new marker is initially identical to the +old one, and will not be distinct until, e.g., moved to a new center. +<p> +Usage: +<p> +<pre> + makeCopy name +</pre> +<p> +<h1><A NAME="addCallback">addCallback</A></h1> +<p> +Post a marker callback to be called when the specified +event or events occurs. If no events are listed a Notify callback will +be posted. +<p> +Usage: +<p> +<pre> + addCallback procedure [event [event ...]] +</pre> +<p> +<h1><A NAME="notify">notify</A></h1> +<p> +Generate a Marker pseudo-event, causing any posted client +callback procedures to be called. +<p> +Usage: +<p> +<pre> + notify [event-type [param [param ...]]] +</pre> +<p> +<h1><A NAME="destroy">destroy</A></h1> +<p> +Destroy a marker. Just tell the marker to destroy itself. +All cleanup outside the marker facility relies upon the use of callbacks. +This includes our callback markerDestroyCallback below. +<p> +Usage: +<p> +<pre> + destroy +</pre> +<p> +<h1><A NAME="markpos">markpos</A></h1> +<p> +Mark the current position of a marker for a later redraw. +<p> +Usage: +<p> +<pre> + markpos +</pre> +<p> +Markpos is used to mark the position of a marker before changing any +marker attributes, so that a later "redraw marked" will erase the old +marker rather than the new one. This is necessary, for example, if any +marker attributes are changed which affect the size or position of the +marker. +<p> +<h1><A NAME="redraw">redraw</A></h1> +<p> +Redraw a marker. +<p> +Usage: +<p> +<pre> + redraw [function] [erase|noerase] [markpos|nomarkpos] +</pre> +<p> +By default redraw will erase the old marker at the position indicated by +a previous call to markpos, and redraw the marker with the current +attributes using the drawing function copy (copy source to destination). +Hence the usual usage is "markpos ... change marker attributes ... redraw". +Optional arguments may be given to change the drawing function, enable or +disable erase, or force redraw to do a markpos. These arguments may be +given in any order. +<p> +The drawing functions are as given in the XLIB documentation, minus the +"GX" prefix. The most commonly used functions are "copy" and "xor". +A normal marker redraw uses function=copy. +<p> +<h1><A NAME="raise">raise</A></h1> +<p> +Raise a marker, i.e., cause it to be drawn on top of other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + raise [reference-marker] +</pre> +<p> +In a reference marker is named the marker will raise itself above this +marker, otherwise the raised marker becomes the topmost marker. +<p> +<h1><A NAME="lower">lower</A></h1> +<p> +Lower a marker, i.e., cause it to be drawn beneath other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + lower [reference-marker] +</pre> +<p> +In a reference marker is named the marker will lower itself beneath this +marker, otherwise the lowered marker becomes the lowest marker. +<p> +<h1><A NAME="move">move</A></h1> +<p> +Move a marker. +<p> +Usage: +<p> +<pre> + move x y +</pre> +<p> +Move the marker center to the indicated coordinates in the display window. +<p> +<h1><A NAME="resize">resize</A></h1> +<p> +Resize a marker. +<p> +Usage: +<p> +<pre> + resize width height +</pre> +<p> +Resize the marker to the indicated size. By default width and height are +given in pixels. For a text marker one can append "ch" to indicate that +the units are chars in whatever font is in use, e.g., "40ch" or "40 chars" +is an acceptable value for a text marker dimension. +<p> +<h1><A NAME="rotate">rotate</A></h1> +<p> +Rotate a marker. +<p> +Usage: +<p> +<pre> + rotate angle +</pre> +<p> +Redraw a marker oriented to the given rotation angle. The angle is +given in radians. +<p> +<h1><A NAME="getAttribute">getAttribute</A></h1> +<p> +Return the value of a marker attribute. +<p> +Usage: +<p> +<pre> + value = getAttribute attribute-name +</pre> +<p> +<h1><A NAME="setAttribute">setAttribute</A></h1> +<p> +Set the value of a marker attribute. +<p> +Usage: +<p> +<pre> + setAttribute attribute-name value +</pre> +<p> +<h1><A NAME="getAttributes">getAttributes</A></h1> +<p> +Return the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + getAttributes attribute-list + i.e. getAttributes {name value [name value ...]} + or getAttributes name value [name value ...] +</pre> +<p> +where "value" is the name of the variable in which the attribute value +is to be stored. +<p> +<h1><A NAME="setAttributes">setAttributes</A></h1> +<p> +Set the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + setAttributes attribute-list + i.e. setAttributes {name value [name value ...]} +</pre> +<p> +where "value" is the new value of the associated marker attribute. +<p> +<h1><A NAME="getVertices">getVertices</A></h1> +<p> +Get some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + getVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is returned in the +variable "points", as a string of the form { {x y} {x y} ...}. The first +point is number zero. +<p> +<h1><A NAME="setVertices">setVertices</A></h1> +<p> +Set some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + setVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is set using the points +passed in the "points" variable as a string of the form { {x y} {x y} ...}. +If FIRST and NPTS are not specified first is assumed to be zero (the first +point) and NPTS is the length of the points array. +<p> +<h1><A NAME="getRegion">getRegion</A></h1> +<p> +Return as a text string a high level description of the +region defined by a marker. +<p> +Usage: +<p> +<pre> + region = getRegion [unmap] [coord-type] +</pre> +<p> +The output string defines the marker type and the major marker positional +attributes. The region description formats for the various marker types +follow. +<p> +<pre> + text raster x y width height + line raster x y x y + polyline raster npts { {x y} {x y} ...} + rectangle raster x y width height rotangle + circle raster x y radius + ellipse raster x y width height rotangle + polygon raster npts { {x y} {x y} ...} +</pre> +<p> +Here, width and height refer to the distance from the marker center to an +edge, not to the width or height of the whole marker. This avoids +ambiguities about where the edge of a marker is if the width is even or +odd. Using the center to edge measurement, the edge is at x +/- width, +y +/- height. +<p> +If the "unmap" flag is given getRegion will attempt to associate the +marker with a mapped raster, reversing any mappings from the screen back +to the original source raster, and returning the raster number and raster +coordinates and marker sizes. If "unmap" is not given the marker +coordinates will refer to raster 0. Either pixel ("pixel") or NDC +("ndc") coordinates may be returned, pixel coordinates being the default. +<p> +<h1><A NAME="getRect">getRect</A></h1> +<p> +Return the region enclosed by a rectangle marker. The rect is +returned in a form convenient for use as the destination rect in a gterm +widget raster mapping. +<p> +Usage: +<p> +<pre> + getRect dx dy dnx dny +</pre> +<p> +The rect is stored in the output arguments. +<p> diff --git a/vendor/x11iraf/obm/docs/gui.doc/gterm.gif b/vendor/x11iraf/obm/docs/gui.doc/gterm.gif new file mode 100644 index 00000000..042debf5 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/gterm.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/gtermclass.html b/vendor/x11iraf/obm/docs/gui.doc/gtermclass.html new file mode 100644 index 00000000..5fcdab10 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/gtermclass.html @@ -0,0 +1,694 @@ +<title>Gterm-Image widget class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> Gterm-Image widget class (a subclass of Widget).</h1> +<p> +<HR> +<p> +The gterm-image widget is a general 2D graphics-imaging widget providing +a wide range of facilities for drawing graphics and text, for image +display, and for graphics interaction. Normally the client communicates +directly with the Gterm widget to draw graphics, download image data, +and so on, using some communications protocol outside the domain of the +object manager. Nonetheless so far as possible the facilities of the Gterm +widget have also been made available to GUI code via the commands listed +here. +<p> +The Gterm widget adds the following function to the OBM library. +<p> +<pre> + ObmPostSetGtermCallback (obm, &setgterm, setgterm_client_data) +</pre> +<p> +This is called by a client application to post a procedure to be called +when a gterm widget receives the setGterm command. The calling sequence +for setGterm callback is as follows: +<p> +<pre> + setgterm (client_data, gterm_widget) +</pre> +<p> +The purpose of this callback is to tell the client which gterm widget is +the "active" gterm widget. This is used by clients which only support +one active Gterm widget, i.e., which can only direct graphics output to +one Gterm widget at a time. +<p> +The messages or commands that can be sent to the Gterm widget by GUI +code follow. +<p> +General commands: +<p> +<pre> + <a href="#setGterm">setGterm</a> # make widget the active Gterm +<p> + <a href="#activate">activate</a> + <a href="#deactivate">deactivate</a> + <a href="#addCallback">addCallback</a> procedure-name callback-type + <a href="#reset">reset</a> + <a href="#flush">flush</a> +<p> + <a href="#setCursorPos">setCursorPos</a> x y [raster] + <a href="#getCursorPos">getCursorPos</a> x y + <a href="#setCursorType">setCursorType</a> cursortype + <a href="#bell">bell</a> +</pre> +<p> +Graphics drawing commands: +<p> +<pre> + <a href="#setRaster">setRaster</a> raster + raster = <a href="#getRaster">getRaster</a> [raster] +<p> + <a href="notyet.html">setLogRes</a> width height (unimplimented) + <a href="notyet.html">getLogRes</a> width height (unimplimented) + <a href="notyet.html">setPhysRes</a> width height (unimplimented) + <a href="notyet.html">getPhysRes</a> width height (unimplimented) + <a href="notyet.html">setTextRes</a> rows cols (unimplimented) + <a href="notyet.html">setDataLevel</a> level (unimplimented) + <a href="notyet.html">setLineWidth</a> width (unimplimented) + <a href="notyet.html">setLineStyle</a> style (unimplimented) + <a href="notyet.html">setColorIndex</a> index (unimplimented) + <a href="notyet.html">setFillType</a> filltype (unimplimented) +<p> + <a href="#clearScreen">clearScreen</a> + <a href="notyet.html">drawPolyline</a> vector (unimplimented) + <a href="notyet.html">drawPolymarker</a> vector (unimplimented) + <a href="notyet.html">drawPolygon</a> vector (unimplimented) + <a href="notyet.html">drawMarker</a> x y xsize ysize type (unimplimented) +<p> + <a href="notyet.html">drawAlphaText</a> x y text (unimplimented) + <a href="notyet.html">getAlphaTextSize</a> string width height base (unimplimented) + <a href="notyet.html">startDialog</a> (unimplimented) + <a href="notyet.html">endDialog</a> (unimplimented) + <a href="notyet.html">eraseDialog</a> (unimplimented) + <a href="notyet.html">drawDialogText</a> x y text (unimplimented) + <a href="notyet.html">getDialogTextSize</a> string width height base (unimplimented) +</pre> +<p> +The coordinates used in the graphics drawing commands are logical +coordinates as defined by setLogRes, in the coordinate system of the +reference drawing raster as defined by setRaster. The default reference +raster is raster zero, the widget's window. Vectors are specified as +a list of points, e.g., { {x y} {x y} ... }. +<p> +Imaging commands: +<p> +<pre> + <a href="#rasterInit">rasterInit</a> + <a href="notyet.html">assignRaster</a> raster drawable (unimplimented) + <a href="notyet.html">createRaster</a> raster type width height depth (unimplimented) + <a href="notyet.html">destroyRaster</a> raster (unimplimented) + exists = <a href="notyet.html">queryRaster</a> raster type width height depth (unimplimented) + raster = <a href="notyet.html">nextRaster</a> [raster] (unimplimented) + nrasters = <a href="notyet.html">nRasters</a> [nrasters] (unimplimented) +<p> + <a href="#setPixel">setPixel</a> raster x y value + value = <a href="#getPixel">getPixel</a> raster x y + <a href="#writePixels">writePixels</a> raster pixels encoding x1 y1 nx ny + <a href="#readPixels">readPixels</a> raster pixels encoding x1 y1 nx ny + <a href="notyet.html">refreshPixels</a> raster ct x1 y1 nx ny (unimplimented) + pixmap = <a href="notyet.html">createPixmap</a> src x y width height (unimplimented) + <a href="notyet.html">copyPixmap</a> pixmap dst x y width height (unimplimented) +<p> + colormap = <a href="notyet.html">nextColormap</a> [colormap] (unimplimented) + <a href="notyet.html">freeColormap</a> colormap (unimplimented) + <a href="notyet.html">writeColormap</a> colormap first nelem colors (unimplimented) + <a href="notyet.html">readColormap</a> colormap first nelem colors (unimplimented) + <a href="#loadColormap">loadColormap</a> colormap offset scale +<p> + <a href="notyet.html">initMappings</a> (unimplimented) + mapping = <a href="#nextMapping">nextMapping</a> [mapping] + <a href="notyet.html">freeMapping</a> mapping (unimplimented) + <a href="notyet.html">enableMapping</a> mapping (unimplimented) + <a href="notyet.html">disableMapping</a> mapping (unimplimented) + active = <a href="notyet.html">activeMapping</a> mapping (unimplimented) + <a href="notyet.html">refreshMapping</a> mapping (unimplimented) +<p> + raster = <a href="#selectRaster">selectRaster</a> dras dt dx dy rt rx ry [map] + <a href="#unmapPixel">unmapPixel</a> sx sy raster rx ry [rz] +<p> + <a href="notyet.html">copyRaster</a> rop src st sx sy snx sny dst dt dx dy dnx dny (unimplimented) + <a href="#setMapping">setMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny + <a href="#getMapping">getMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny +<p> + <a href="#flip">flip</a> mapping axis [axis...] +</pre> +<p> +Pixel arrays are long strings consisting either of a sequence of numeric +pixel values separated by whitespace (space or newline), or a hex encoded +sequence of bytes (2 hex digits per 8 bit pixel). Colors are specified +as a list of RGB triplets, e.g., { {R G B} {R G B} ... }. +<p> +Refer to the documentation for the Gterm widget for a detailed description +of rasters, mappings, and colormaps. +<p> +Markers: +<p> +<pre> + <a href="#createMarker">createMarker</a> name [attribute-list] + <a href="#markerInit">markerInit</a> +</pre> +<p> +New markers may be created with createMarker. Once created, a marker +functions under the Object Manager as a named object of class "marker". +Refer to the marker class for a description of the commands defined for +a marker. +<p> +gterm Actions List +<p> +<pre> + ignore + graphics-input + graphics-context + crosshair + track-cursor + enter-window + leave-window + popup-menu {not implemented} + reset + m_create +</pre> +<p> +Default translations for Gterm window. +Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) +<p> +default Gterm Translations +<p> +<pre> + [Btn1Down]:m_create() + [Btn2Down]:crosshair(on) + [Btn2Motion]:crosshair(on) + [Btn2Up]:crosshair(off) + ~Ctrl ~Meta [Btn3Down]:graphics-context() + [EnterWindow]:enter-window() + [LeaveWindow]:leave-window() + [KeyPress]:graphics-input() + [Motion]:track-cursor() +<pre> +<p> +<p> +GTERM class commands. +<p> +<h1><A NAME="setGterm">setGterm</A></h1> +<p> +Set the active Gterm widget. A UI can have more than one +gterm widget, but due to restrictions on the client-server interface, it +may be possible for only one to receive client output at any one time (any +gterm widget can generate input to be sent to the client). If the client +has this restriction, the client-server interface code which uses OBM can +call the ObmPostSetGtermCallback procedure to post a function to be called +when the UI code calls the setGterm procedure. +<p> +Usage: +<p> +<pre> + setGterm +</pre> +<p> +<h1><A NAME="activate">activate</A></h1> +<p> +Activate the gterm widget. This causes the next GIN mode +setCursorType to warp the pointer into the gterm window. +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h1><A NAME="deactivate">deactivate</A></h1> +<p> +Deactivate the gterm widget. If the cursor has been warped +into the window by a previous activate/setCursorType GIN mode, this causes +the cursor to be warped back to where it was previously. +<p> +Usage: +<p> +<pre> + deactivate +</pre> +<p> +<h1><A NAME="reset">reset</A></h1> +<p> +Reset the gterm widget. This causes a number of state variables +affecting graphics drawing options to be set to their default values. +<p> +Usage: +<p> +<pre> + reset +</pre> +<p> +<h1><A NAME="flush">flush</A></h1> +<p> +Flush any graphics output and synchronize the state of the widget +with what is shown on the display. +<p> +Usage: +<p> +<pre> + flush +</pre> +<p> +The gterm widget uses XLIB, which buffers graphics drawing commands and +automatically sends them to the X server when 1) the buffer fills, +2) input is requested from the server. Such buffering of data is necessary +for efficient operation and it should rarely be necessary to explicitly +flush graphics output since XLIB does this automatically in most cases. +An example of when explicitly flushing the ouptut might be necessary is in +cases where smooth animation is desired and drawing the graphics in batches +could cause the display to appear "jerky". +<p> +<h1><A NAME="addCallback">addCallback</A></h1> +<p> +Post a callback for a Gterm widget event. +<p> +Usage: +<p> +<pre> + addCallback procedure-name [callback-type] +</pre> +<p> +The recognized Gterm callbacks are +<p> +<pre> + + input Called when the graphics-input action is invoked in + a translation table. The default Gterm translation + table invokes this action when a KeyPress event occurs + in the Gterm window. + Callback: widget-name input-type event-data + + resize Called when the gterm window is resized. + Callback: widget-name width height + + reset Called when the "reset" action is invoked. + Callback: widget-name + +<pre> +<p> +If no callback is specified the default is "input". +<p> +Note that in GUI code one can also use the translation table to directly +invoke GUI procedures without need to use the Gterm input mechanism. This +is more flexible but we support the Gterm input callback here for +applications that use the default translations. +<p> +<h1><A NAME="setCursorPos">setCursorPos</A></h1> +<p> +Warp the cursor (pointer) to the given coordinates. This +is a graphics drawing command and if no raster number is specified the +current reference drawing raster, as set with setRaster, defines the +coordinate system. +<p> +Usage: +<p> +<pre> + setCursorPos x y [raster] +</pre> +<p> +A raster number may optionally given to define the raster coordinate system +to be used. raster=0 yields screen coordinates. +<p> +<h1><A NAME="getCursorPos">getCursorPos</A></h1> +<p> +Get the cursor position (raster 0 or screen coordinates). +<p> +Usage: +<p> +<pre> + getCursorPos x y +</pre> +<p> +<h1><A NAME="setCursorType">setCursorType</A></h1> +<p> +Set the cursor type. +<p> +Usage: +<p> +<pre> + setCursorType cursor-type + + idle default cursor + busy busy cursor, e.g, when program is busy + ginMode graphics input mode cursor, set when program is + waiting for graphics input +</pre> +<p> +<h1><A NAME="bell">bell</A></h1> +<p> +Gterm widget sound output. +<p> +Usage: +<p> +<pre> + bell +</pre> +<p> +<h1><A NAME="setRaster">setRaster</A></h1> +<p> +Set the number of the raster to be used to define the drawing +context (e.g. coordinate system) for graphics and text drawing functions. +<p> +Usage: +<p> +<pre> + setRaster raster-number +</pre> +<p> +<h1><A NAME="getRaster">getRaster</A></h1> +<p> +Get the number of the raster which defines the drawing +context, as set in the last setRaster call. +<p> +Usage: +<p> +<pre> + raster = getRaster [raster] +</pre> +<p> +If the name of a variable is given the raster number will be stored +directly in that variable. +<p> +<h1><A NAME="clearScreen">clearScreen</A></h1> +<p> +Clear the "screen", i.e., window. This action clears the +drawing window and sets a number of drawing state variables to their default +values. +<p> +Usage: +<p> +<pre> + clearScreen +</pre> +<p> +<h1><A NAME="rasterInit">rasterInit</A></h1> +<p> +Initialize the raster subsystem, deleting all rasters and +mappings and freeing the dynamic part of the colortable. +<p> +Usage: +<p> +<pre> + rasterInit +</pre> +<p> +<h1><A NAME="writePixels">writePixels</A></h1> +<p> +Set the values of some subset of the pixels in a raster. +If any mappings are defined on the affected region and are enabled, any +destination rasters will be automatically updated as defined by the mapping. +<p> +Usage: +<p> +<pre> + writePixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be written. +</pre> +<p> +Most real-world image processing applications get the Gterm widget handle +with setGterm and pass binary data to the widget by calling GtWritePixels +directly. This is the most efficient approach for serious image processing +where large amounts of data are involved. However, being able to read and +write raster pixels directly in a GUI can be useful in specialized +applications, e.g., where the image is computed or modified by the GUI. +<p> +<h1><A NAME="setPixel">setPixel</A></h1> +<p> +Set the value of a single pixel. +<p> +Usage: +<p> +<pre> + setPixel raster x y value + + raster The raster number. + x, y The pixel to be set. + value The pixel value. +</pre> +<p> +This routine is more efficient than writePixels for setting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be set. +<p> +<h1><A NAME="readPixels">readPixels</A></h1> +<p> +Get the values of some subset of the pixels in a raster. +<p> +Usage: +<p> +<pre> + readPixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be read. +</pre> +<p> +Use readPixels to read a block of pixels, and getPixel to get the value +of a single pixel. +<p> +<h1><A NAME="getPixel">getPixel</A></h1> +<p> +Get the value of a single pixel. +<p> +Usage: +<p> +<pre> + getPixel raster x y + + raster The raster number. + x, y The pixel to be set. +</pre> +<p> +This routine is more efficient than readPixels for getting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be read. +<p> +<h1><A NAME="nextMapping">nextMapping</A></h1> +<p> +Return the index of the next unused mapping. +<p> +Usage: +<p> +<pre> + nextMapping +</pre> +<p> +Returns the mapping number as the function value. +<p> +<h1><A NAME="getMapping">getMapping</A></h1> +<p> +Get a mapping. +<p> +Usage: +<p> +<pre> + getMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters except the mapping number are output parameters. +<p> +<h1><A NAME="setMapping">setMapping</A></h1> +<p> +Set a mapping. +<p> +Usage: +<p> +<pre> + setMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters are input parameters. +<p> +<h1><A NAME="loadColormap">loadColormap</A></h1> +<p> +Load a colormap. +<p> +Usage: +<p> +<pre> + loadColormap colormap [offset [scale]] +</pre> +<p> +The offset and scale parameters may be used to adjust the brightness and +contrast of the image when the colormap is loaded. The normalized colormap +has offset=0.5, scale=1.0. Colormap zero is the hardware colormap. +<p> +<h1><A NAME="selectRaster">selectRaster</A></h1> +<p> +Given the raw screen coordinates SX,SY (or coords in +any destination raster), determine the mapping and source raster which are +mapped to that pixel and return the raster and mapping numbers and the +coordinates of the same pixel in the source raster. +<p> +Usage: +<p> +<pre> + raster = selectRaster dras dt dx dy rt rx ry [map] +</pre> +<p> +where +<p> +<pre> + dras display raster + dt,rt coordinate type - "pixel" or "ndc" + dx,dy display raster coordinates (input) + rx,ry source raster coordinates (output) + map mapping selected (output) +</pre> +<p> +Note that the coordinates returned by selectRaster are measured (taking +a line as an example) from zero at the left edge of the first pixel, to +"width" at the right edge of the last pixel. This means that the floating +point coordinates of the center of raster pixel N will be N + 0.5. For +example, if we input screen coordinates (dras=0), x=117, and no mapping +is in effect, the floating point raster coordinates returned will be 117.5. +The difference occurs because the input coordinate is a pixel number +(integer) while the output coordinate is a floating point coordinate +measuring the continuously variable location a pixel. int(x) will convert +this coordinate to a raster pixel number. +<p> +<h1><A NAME="unmapPixel">unmapPixel</A></h1> +<p> +unmapPixel is a simplified, less general version of +selectRaster which will automatically follow graphics pipelines back to +the original mapped raster. If desired the raster pixel value can be +returned as well as the raster number and raster pixel coordinates +corresponding to a screen (raster 0) pixel. +<p> +Usage: +<p> +<pre> + unmapPixel sx sy raster rx ry [rz] +</pre> +<p> +where +<p> +<pre> + sx,sy "screen" (raster 0) coordinates + raster original mapped raster (output) + rx,ry source raster coordinates (output) + rz source raster pixel value (output) +<pre> +<p> +By following graphics pipelines back to the original source raster we mean +the following. If raster A is mapped to raster B which is mapped to C (the +screen), given a screen coordinate in the mapped region unmapPixel will +return the raster number and coordinates for raster A. +<p> +<h1><A NAME="flip">flip</A></h1> +<p> +Edit a mapping to flip the mapped subimage in X and/or Y. +<p> +Usage: +<p> +<pre> + flip mapping axis [axis] +</pre> +<p> +where axis is "x" or "y". This is a convenience routine for changing only +the flip portion of a mapping. +<p> +<h1><A NAME="markerInit">markerInit</A></h1> +<p> +Initialize the Marker subsystem for a Gterm widget. +This destroys all markers and initializes the marker subsystem. +<p> +Usage: +<p> +<pre> + markerInit +</pre> +<p> +<h1><A NAME="createMarker">createMarker</A></h1> +<p> +Create a new marker. +<p> +Usage: +<p> +<pre> + createMarker name attribute-list + e.g. createMarker name {attribute value [attribute value ...]} + or createMarker name attribute value [attribute value ...] +<pre> +<p> +Any marker attribute may be assigned a value when the marker is created. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker attribute names. Often the +the attributes "type" and "createMode" need to be specified at marker +create time. +<p> +<pre> + type The marker type: text, rectangle, circle, etc. + + createMode A marker should be created with createMode=interactive + if the user is expected to interactively drag out + the marker using the pointer and either the default + or an application specified translation table. A + marker can also be created interactively using only + the m_create (marker create) action, however m_create + does not allow the marker attributes to be set. +<pre> +<p> +There are any number of ways to use a GUI to create a marker under the +Object Manager, but an example might be using a translation to call a GUI +procedure which issues the createMarker call. For example a pointer down +event could translate as "call(newMarker,$name,$x,$y) m_create()" where +newMarker is a GUI marker creation procedure which sends a createMarker +message to the Gterm widget. The GUI procedure could set the marker +attributes as desired, possibly using additional GUI components to define +the marker attributes. The m_create action will notice that a +createMarker has been executed and will merely activate the marker and +give it the pointer focus (i.e. install the marker translations). The +user will then use the pointer or keyboard to drag out the marker. +<p> +If the marker is created noninteractive the application must set the marker +position and size using marker attributes. If the marker is sensitive +the user can then use the marker's translations to interactively modify +the marker (resize it, move it, etc.). All markers which are visible and +sensitive and which have the necessary translations can be interactively +modified by the user; the reason for creating a marker in interactive mode +is to allow the initial marker position and size to be specified +interactively *when* the marker is created, instead of afterwards. +<p> +Any number of attributes may be given when the marker is created. Most +marker attributes can also be modified after a marker has been created +by sending setAttribute messages to the marker. + diff --git a/vendor/x11iraf/obm/docs/gui.doc/gui.html b/vendor/x11iraf/obm/docs/gui.doc/gui.html new file mode 100644 index 00000000..d7e20546 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/gui.html @@ -0,0 +1,93 @@ +<html> +<body bgcolor=#FFFFFF> + +<title>IRAF Object Manager</title> +<h1>IRAF Object Manager</h1> +<HR> +<p> +An Object Manager (OBM) user interface (UI) consists of one or more windows +containing an arbitrary hierarchy of widgets. These widgets and their +runtime actions are defined by an interpreted text program uploaded +by the client application, which does not itself deal directly with +the window user interface. Currently, this interpreted program is written +in Tcl. +<p> +The object manager provides a higher level of abstraction for dealing +with widgets and other UI objects. The main function of the object +manager is to deliver messages to UI objects. Each instance of a widget, +the client programs, and the OBM itself are +objects in the UI. The UI contains other types of objects however, +including the client object (client application), the server object +(the object manager itself), and the application specific UI parameters, +each of which is an object with a callback list of UI procedures to be +called when the parameter value changes. All of these UI objects can +receive messages and take actions as a result. Messages may come from the +client application, or as a result of actions executed by the interpreted +UI code in response to graphics events. +<p> +<h2>Object classes:</h2> +<p> +<pre> +<a href="Client.html">Client</a> the client application +<a href="Server.html">Server</a> the object manager itself +<a href="widgetclass.html">Widget</a> widgets +<a href="uiparameterclass.html">ParameterUI</a> control parameter +<a href="gtermclass.html">Gterm</a> graphics/imaging widget +<a href="gmc.html">Graphics Markers</a> marker widgets +<a href="ximclient.html">Image Client</a> imageing widget +<p> +<a href="notyet.html">Various Xt and Athena widgets</a> + {box, shell, label, command, text, list, etc.} +</pre> +<p> +To locate specific IRAF GUI commands quickly, here is an +<pre> + <a href="alphabetic.html">alphabetized list of IRAF GUI commands</a> +</pre> +<p> +Sophisticated graphics applications will download a UI during initialization +to define a custom graphics user interface. This is done by sending a +message to the object manager. Naive applications assume a simple graphics +terminal and do not download a UI; in this case, a default UI is created +for the application when the UI is enabled with ObmEnable. The default +UI is a single top level shell window containing a single gterm (graphics +terminal) widget. +<p> +<pre> + <a href="servercom.html#resetReset">reset-server</a> + <a href="servercom.html#appInitialize">appInitialize</a> appname,appclass,resources + <a href="servercom.html#createObjects">createObjects</a> [resource-name] + (UI specific code) + <a href="servercom.html#activate">activate</a> +</pre> +<p> +A UI specification consists of a sequence of commands to be executed by +the server object. This is downloaded by the client as a message for the +server object. The commands should include "reset-server" (this must be +the first executable command), "appInitialize" (defines the UI objects and +their resources), and "createObjects" (creates the objects and the widget +tree), followed by any UI specific commands to define and register UI +callback procedures. Finally, "activate" is executed to activate the new +user interface. +<p> +Class descriptors for all UI object classes. In the following, only the +class initializer function needs to be set statically, since the class +initializer function will initialize the remaining fields of the class +descriptor at run time when the object manager is opened. +<p> +<pre> + Server Client Parameter Gterm Core + Object Widget Command Grip Label + List Scrollbar StripChart Toggle SimpleMenu + Sme SmeBSB SmeLine MenuButton AsciiText + Box Dialog Form Paned Viewport + + Shell + OverrideShell + WMShell + TransientShell + TopLevelShell + ApplicationShell +</pre> +</body> +</html> diff --git a/vendor/x11iraf/obm/docs/gui.doc/guiintro.html b/vendor/x11iraf/obm/docs/gui.doc/guiintro.html new file mode 100644 index 00000000..81511434 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/guiintro.html @@ -0,0 +1,9 @@ +<title>Introduction and Overview</title> +<h2><IMG SRC="irafgui.gif"> Introduction and Overview</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<h3>Design Philosophy</h3> +<p> +<h3>Basic Tools</h3> +<p> +<h3><a href="example.html">An Example</a></h3> +<p> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowse.gif b/vendor/x11iraf/obm/docs/gui.doc/imbrowse.gif new file mode 100644 index 00000000..af1e7c0a Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/imbrowse.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/controlForm.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/controlForm.html new file mode 100644 index 00000000..88e74c83 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/controlForm.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the controlForm</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirName.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirName.html new file mode 100644 index 00000000..4c4b3cb3 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirName.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the dirName</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirSelect.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirSelect.html new file mode 100644 index 00000000..fe8f8f40 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/dirSelect.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the dirSelect</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/headerText.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/headerText.html new file mode 100644 index 00000000..a132c5f3 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/headerText.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the headerText</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/imageButton.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/imageButton.html new file mode 100644 index 00000000..12595f3c --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/imageButton.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the imageButton</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/none.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/none.html new file mode 100644 index 00000000..9cd7d5e3 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/none.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse none</title> +<h2><IMG SRC="irafgui.gif"> You selected none of the ellipses</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/objView.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/objView.html new file mode 100644 index 00000000..a830a57a --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/objView.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the objView</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/panel.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/panel.html new file mode 100644 index 00000000..b6b0ff2e --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/panel.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the panel</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/sectionBox.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/sectionBox.html new file mode 100644 index 00000000..60895b18 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/sectionBox.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the sectionBox</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/statusBox.html b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/statusBox.html new file mode 100644 index 00000000..061f5045 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/imbrowsemap/statusBox.html @@ -0,0 +1,3 @@ +<title>Example: Imbrowse panel</title> +<h2><IMG SRC="irafgui.gif"> You selected the statusBox</h2> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> diff --git a/vendor/x11iraf/obm/docs/gui.doc/imtool.gif b/vendor/x11iraf/obm/docs/gui.doc/imtool.gif new file mode 100644 index 00000000..a29811ef Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/imtool.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/intro.gif b/vendor/x11iraf/obm/docs/gui.doc/intro.gif new file mode 100644 index 00000000..7f7af646 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/intro.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/irafgui.gif b/vendor/x11iraf/obm/docs/gui.doc/irafgui.gif new file mode 100644 index 00000000..032c72d5 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/irafgui.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/llama.gif b/vendor/x11iraf/obm/docs/gui.doc/llama.gif new file mode 100644 index 00000000..be0ceef4 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/llama.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/marker.gif b/vendor/x11iraf/obm/docs/gui.doc/marker.gif new file mode 100644 index 00000000..639b19bd Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/marker.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/newgui.html b/vendor/x11iraf/obm/docs/gui.doc/newgui.html new file mode 100644 index 00000000..36e7ec1a --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/newgui.html @@ -0,0 +1,18 @@ +<title>IRAF GUI Documentation</title> +<h1><IMG SRC="irafgui.gif"> IRAF Graphical User Interfaces</h1> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<p> +This hypertext work is introductory documentation for the IRAF graphical +user interface facility introduced with IRAF version 2.10.3. Questions +can be directed, via electronic mail, to iraf.noao.edu or posted to the +newsgroup adass.iraf.programmer. +<p> +<pre> +<a href="guiintro.html"><IMG ALIGN=MIDDLE SRC="intro.gif"></a> An introduction and overview + +<a href="widgets.html"><IMG ALIGN=MIDDLE SRC="widgets.gif"></a> The widgets and how they work + +<a href="tcl.html"><IMG ALIGN=MIDDLE SRC="tcl.gif"></a> The language used to build GUIs + +<a href="notyet2.html"><IMG ALIGN=MIDDLE SRC="softgui.gif"></a> Software - GUI communication +</pre> diff --git a/vendor/x11iraf/obm/docs/gui.doc/notyet.html b/vendor/x11iraf/obm/docs/gui.doc/notyet.html new file mode 100644 index 00000000..9a292a44 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/notyet.html @@ -0,0 +1,5 @@ +<title>NOTYET</title> +<p> +<a href="einstein.html"><IMG align=middle SRC="einstein.gif"></a> +The info you requested is not yet available. +<p> diff --git a/vendor/x11iraf/obm/docs/gui.doc/notyet2.html b/vendor/x11iraf/obm/docs/gui.doc/notyet2.html new file mode 100644 index 00000000..2a6e3dca --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/notyet2.html @@ -0,0 +1,5 @@ +<title>NOTYET</title> +<p> +<IMG align=middle SRC="llama.gif"> +The info you requested is not yet available. +<p> diff --git a/vendor/x11iraf/obm/docs/gui.doc/otherwidgets.html b/vendor/x11iraf/obm/docs/gui.doc/otherwidgets.html new file mode 100644 index 00000000..f477fdc7 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/otherwidgets.html @@ -0,0 +1,10 @@ +<title>Other Widgets</title> +<h1><IMG SRC="irafgui.gif"> Other Widgets</h1> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<p> +There are a few more widgets to be aware of, these are the parameter +widgets, .... +<p> +<pre> +<a href="parameterwidgets.html">Parameter Widget</a> +</pre> diff --git a/vendor/x11iraf/obm/docs/gui.doc/params.gif b/vendor/x11iraf/obm/docs/gui.doc/params.gif new file mode 100644 index 00000000..053f424b Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/params.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/redline.gif b/vendor/x11iraf/obm/docs/gui.doc/redline.gif new file mode 100644 index 00000000..574a6c8a Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/redline.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/serverclass.html b/vendor/x11iraf/obm/docs/gui.doc/serverclass.html new file mode 100644 index 00000000..3fdaec2a --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/serverclass.html @@ -0,0 +1,38 @@ +<title>SERVER class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> SERVER class</h1> +<p> +<HR> +<p> +The server, or object manager, is the control center of the user interface. +The server object provides a Tcl interpreter calling custom object manager +commands. These are used to define and initialize the user interface, and +execute UI action procedures at runtime. +<p> +<pre> + <a href="servercom.html#resetReset">reset-server</a> + <a href="servercom.html#appInitialize">appInitialize</a> appname,appclass,resources + <a href="servercom.html#createObjects">createObjects</a> [resource-name] + <a href="servercom.html#destroyObject">destroyObject</a> object + <a href="servercom.html#activate">activate</a> + <a href="servercom.html#deactivate">deactivate</a> [unmap] +<p> + value = <a href="servercom.html#getResource">getResource</a> resource-name [default-value [class]]</a> + <a href="servercom.html#getResources">getResources</a> resource-list +<p> + <a href="servercom.html#createMenu">createMenu</a> menu-name parent item-list + <a href="servercom.html#createMenu">editMenu</a> menu-name parent item-list + <a href="servercom.html#destroyMenu">destroyMenu</a> menu-name +<p> + <a href="servercom.html#createBitmap">createBitmap</a> name width height data + <a href="servercom.html#createCursor">createCursor</a> name source mask fg_color bg_color x_hot y_hot + <a href="servercom.html#createPixmap">createPixmap</a> name width height depth fg_color bg_color data +<p> + <a href="servercom.html#print">print</a> arg [arg ...] # debug messages + <a href="servercom.html#send">send</a> object message +<p> + <a href="servercom.html#postActivateCallback">postActivateCallback</a> procedure +id = <a href="servercom.html#postTimedCallback">postTimedCallback</a> procedure msec [client-data] + <a href="servercom.html#deleteTimedCallback">deleteTimedCallback</a> id + id = <a href="servercom.html#postWorkCallback">postWorkCallback</a> procedure [client-data] + <a href="servercom.html#deleteWorkCallback">deleteWorkCallback</a> id +</pre> diff --git a/vendor/x11iraf/obm/docs/gui.doc/servercom.html b/vendor/x11iraf/obm/docs/gui.doc/servercom.html new file mode 100644 index 00000000..16c4c24e --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/servercom.html @@ -0,0 +1,375 @@ +<h1><A NAME="serverReset">serverReset</A></h1> +<p> +The "reset-server" command is implemented as a special case in ServerEvaluate. +After doing a true reset ServerEvaluate calls Tcl_Eval to evaluate the full +message which still contains the reset-server command. We want to ignore +this the second time, so we treat the command here as a no-op. +<p> +Usage: +<p> +<pre> + reset-server +</pre> +<p> +Note: for reset-server to be recognized by ServerEvaluate and really reset +things, it must be the first command in a message to the server. +<p> +<h1><A NAME="appInitialize>appInitialize</A></h1> +<p> +TCL command to initialize the server for a new application, setting the +application name and loading the application resources. +<p> +Usage: +<p> +<pre> + appInitialize appname, appclass, resources +</pre> +<p> +<h1><A NAME ="createObjects">createObjects</A></h1> +<p> +TCL command to create the tree of UI objects comprising the user interface. +The object tree is defined by a string valued resource. If no resource is +named the default "objects" resource will be used. +<p> +Usage: +<p> +<pre> + createObjects [resource-name] +</pre> +<h1><A NAME="destroyObject">destroyObject</A></h1> +<p> +Destroy an object and all of its children. +<p> +Usage: +<pre> + destroyObject object-name +</pre> +<p> +<h1><A NAME="activate">activate</A></h1> +Activate the user interface. When called the first time the user interface +is created and activated, thereafter the UI is merely reactivated (e.g. +mapped if unmapped). +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h1><A NAME="deactivate">deactivate</A></h1> +<p> +Deactivate the user interface. Optionally unmaps the UI and calls the Obm +client back to let it know that the UI has been deactivated. +<p> +Usage: +<p> +<pre> + deactivate [unmap] +</pre> +<p> +<h1><A NAME="getResource">getResource</A></h1> +<p> +Get the string value of the specified application resource (window +system parameter). This allows use of the resource mechanism to supply +default values for GUI parameters. +<p> +Usage: +<p> +<pre> + value = getResource resource-name [class [default-value]] +</pre> +<p> +In the simplest case one merely requests a resource by name and the +string value is returned as the function value. If the resource has +an entry in the fallback resources for the application (appInitialize +resource list) then a value is guaranteed to be returned. +<p> +If the Class name for the resource is given then a class default value +will be returned if no entry is found for the name resource instance. This +is useful when there are a number of resources of the same type (same class). +If most or all resources in the same class have the same default value one +need only make one entry for the Class in the application defaults resource +list. It is up to the application developer to define the class name of a +resource - the class name can be any string. Examples are "Font", "Cursor", +etc. By convention the first character of a class name is capitalized, while +instance names begin with a lower case letter. +<p> +If there is an entry for the named resource in the resource list passed to +appInitialize then a value string is guaranteed to be returned. This will be +either the appInitialize default, or a value specified by the system or the +user in an X resources file. If one is not certain a default value is defined +somewhere, a default value should be specified in the getResource call as +shown above. +<p> +See also getResources, used to get multiple resources in one call. +<p> +<h1><A NAME="getResources">getResources</A></h1> +<p> +Get the string values of a list of resources. +<p> +Usage: +<p> +<pre> + getResources resource-list +</pre> +<p> +e.g. +<pre> + getResources { + { resource [variable class [default-value]]] } + { resource [variable class [default-value]]] } + (etc.) + } +</pre> +<p> +<h1><A NAME="createMenu">createMenu, editMenu</A></h1> +<p> +Create or modify a menu. The editMenu function is an alias for createMenu. +<p> +Usage: +<pre> + createMenu menu-name parent item-list +</pre> +<p> +e.g., +<pre> + createMenu menu-name parent { + { label function data [options...] } + { label function data [options...] } + (etc.) + } +</pre> +<p> +where +<p> +<pre> + menu-name is the object name for the menu popup shell + parent is the parent widget of the menu shell + label is a menu item label + function is the function to be performed when the menu + item is selected, e.g., f.exec, f.data, f.space, or f.line. + data is function dependent data + options are option-name option-value pairs, as specified + below. +</pre> +<p> +In the item list the fields label and option-value may be any Tcl expression. +Expressions are evaluated in the server context. The data field is a Tcl +script to be executed when the menu item is selected. +<p> +Options are specified as "option option-value". The menu item options are +as follows. +<p> +<pre> + bitmap A bitmap to be displayed left justified in the label field + (e.g. to indicate a parameter setting). + sensitive Specifies whether the menu item is active (sensitive=true) + or inactive (sensitive=false, item grayed out). + accelerator Specifies an input translation (accelerator, e.g., + keyboard event) which can be used to execute the + menu item. +</pre> +<p> +The option-value field may be any Tcl expression. +<p> +Example: +<p> +<pre> + createMenu fileMenu toplevel { + { "File Menu" f.title} + { Open f.exec openFile} + { Save f.exec saveFile} + { Load f.menu loadMenu} + { no-label f.line } + { Quit f.exec "send client Quit" } + } +</pre> +<p> +The first createMenu is called for a given menu the menu is created, added +to the menu list, and all window system widgets are created for the menu. +Subsequent calls will result in only the changed parts of the menu being +altered provided the changes are not great. Hence this routine can be called +to efficiently modify a menu when minor runtime changes occur, e.g., an +item label or action changes, the item value changes state, and so on, +without need for the GUI code to know how to make the necessary detailed +changes to the widgets used to implement the menu. +<p> +<h1><A NAME="destroyMenu">destroyMenu</A></h1> +<p> +Destroy a menu. This can be used to free up the resources used by a +menu, e.g., if the menu is not expected to be needed again for a while. +<p> +Usage: +<p> +<pre> + destroyMenu menu-name +</pre> +<p> +<h1><A NAME="createBitmap">createBitmap</A></h1> +<p> +Create a named bitmap. This replaces any old bitmap of the same name. The +new bitmap is cached in server memory; when a widget bitmap resource is set, +the bitmap cache will be searched for the named bitmap before asking Xlib +to find the bitmap. +<p> +Usage: +<p> +<pre> + createBitmap name width height data +</pre> +<p> +e.g., +<p> +<pre> + createBitmap foo 16 16 { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +<p> +<h1><A NAME="createCursor">createCursor</A></h1> +<p> +Create a cursor from bitmap data. The cursor is entered into the server's +cursor cache and will override any existing entry of the same name. +<p> +Usage: +<p> +<pre> + createCursor name source mask fg_color bg_color x_hot y_hot +</pre> +<p> +e.g., +<p> +<pre> + createCursor foo bitmap1 bitmap2 black white 8 8 +</pre> +<p> +The named bitmaps must be created first with createBitmap. +<p> +<h1><A NAME="createPixmap">createPixmap</A></h1> +<p> +Create a named pixmap. This replaces any old pixmap of the same name. The +new pixmap is cached in server memory; when a widget pixmap resource is set, +the pixmap cache will be searched for the named pixmap before asking Xlib +to find the pixmap. +<p> +Usage: +<p> +<pre> + createPixmap name width height depth fg_color bg_color data +</pre> +<p> +e.g., +<p> +<pre> + createPixmap foo 16 16 8 black white { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +</pre> +<p> +<h1><A NAME="print">print</A></h1> +<p> +Print a string on the standard output. This is used mainly for debugging +user interfaces. +<p> +Usage: +<p> +<pre> + print arg [arg ...] +</pre> +<p> +<h1><A NAME="send">send</A></h1> +<p> +Send a message to an object. The object interprets the message and returns +a function value as the string result of the TCL command. +<p> +Usage +<p> +<pre> + send &lt;object&gt; &lt;message&gt; +</pre> +<p> +<h1><A NAME="postActivateCallback">postActivateCallback</A></h1> +<p> +Post a callback procedure to be called when the UI is activated. The UI is +activated when it is first downloaded to server, but it may also be +activated (reactivated) after the application has exited and is later +restarted, or when the UI is deactivated and reactivated. Note +that the UI state vis-a-vis the external world (client application) may +no longer be accurate after it has been idle for a time and then reactivated. +<p> +Usage: +<p> +<pre> + postActivateCallback &lt;procedure&gt; +</pre> +<p> +<p> +<h1><A NAME="postTimedCallback">postTimedCallback</A></h1> +<p> +Post a callback to call the named procedure back after a specified delay +in milliseconds. +<p> +Usage: +<p> +<pre> + id = postTimedCallback procedure msec [client-data] +</pre> +<p> +After the specified delay the user callback procedure will be called with +client_data (if given) as the single argument. Only one call will be made; +the client must repost the callback in each call if the procedure is to be +repeatedly executed. +<p> +An ID value is returned which may be passed to deleteTimedCallback to delete +the timer. +<p> +<h1><A NAME="deleteTimedCallback">deleteTimedCallback</A></h1> +<p> +Delete a timer callback procedure. This procedure is typically used to +break a timer loop, where the timer procedure repeatedly reposts itself at +the end of each interval. +<p> +Usage: +<p> +<pre> + deleteTimedCallback id +</pre> +<p> +The ID string is returned by postTimedCallback when a timer is posted. +<p> +<h1><A NAME="postWorkCallback">postWorkCallback</A></h1> +<p> +Post a callback for a procedure to be called when the server is idle. +Work procedures are used to perform computations in the background while +the user interface remains active and able to respond to input events. +This works only if the user work procedure does its job in small increments, +doing only a small amount of processing in each call. The work procedure +will be called repeatedly until it returns a status indicating that it has +finished its task. +<p> +Usage: +<p> +<pre> + id = postWorkCallback procedure [client-data] +</pre> +<p> +When the server has nothing else to do the user work procedure will be +called with client_data (if given) as the single argument. The work procedure +should return the string "done" when all processing is finished, or any other +string if the procedure is to be called again. +<p> +An ID value is returned which may be passed to deleteWorkCallback to delete +the work procedure. +<p> +<h1><A NAME="deleteWorkCallback">deleteWorkCallback</A></h1> +<p> +Delete a work callback procedure. +<p> +Usage: +<p> +<pre> + deleteWorkCallback id +</pre> +<p> +The ID string is returned by postWorkCallback when a work procedure is posted. diff --git a/vendor/x11iraf/obm/docs/gui.doc/softgui.gif b/vendor/x11iraf/obm/docs/gui.doc/softgui.gif new file mode 100644 index 00000000..7e287b10 Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/softgui.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/tcl.gif b/vendor/x11iraf/obm/docs/gui.doc/tcl.gif new file mode 100644 index 00000000..804a4afb Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/tcl.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/tcl.html b/vendor/x11iraf/obm/docs/gui.doc/tcl.html new file mode 100644 index 00000000..259192f2 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/tcl.html @@ -0,0 +1,7 @@ +<title>Tcl page</title> +<h1>Tcl page</h1> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<p> +<a href="book.p1.ps"><h2>John Ousterhout's Tcl book</a> (over 700 Kbytes of PostScript)</h2> +<p> +<a href="TclQuickRef.html"><h2>Tcl Quick Reference</h2></a> diff --git a/vendor/x11iraf/obm/docs/gui.doc/uiparameterclass.html b/vendor/x11iraf/obm/docs/gui.doc/uiparameterclass.html new file mode 100644 index 00000000..fe189fc5 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/uiparameterclass.html @@ -0,0 +1,107 @@ +<title>UI PARAMETER class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> UI PARAMETER class</h1> +<p> +<HR> +<p> +The UI parameter class is used for client-UI communications. The client +does not control the user interface directly, rather the UI defines a set +of abstract UI parameters, and during execution the client application +assigns values to these parameters. These UI parameters should be thought +of as describing the runtime state of the client as viewed by the GUI. +The GUI is free to interpret this state information in any way, including +ignoring it. Many GUIs can be written which use the same client state +as described by the UI parameters. +<p> +Assigning a value to a UI parameter causes the new value to be stored, and +any parameter action procedures registered by the UI to be called. +The action or actions [if any] taken when a parameter value changes are +arbitrary, e.g. the action might be something as simple as changing a +displayed value of a UI widget, or something more complex like displaying +a popup. +<p> +UI Parameter class commands: +<p> +<pre> + <a href="#getValue">getValue</a> + <a href="#setValue">setValue</a> &lt;new-value&gt; + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#notify">notify</a> +</pre> +<p> +The most common usage is for the GUI to post one or more callbacks for +each UI parameter. When the UI parameter value is changed [with setValue, +e.g. by the client] the GUI callback procedures are called with the old +and new UI parameter values on the command line. addCallback is used to +add a callback procedure, and deleteCallback to delete one. Multiple +callbacks may be registered for a single UI parameter. notify is used +to simulate a parameter value change, causing any callback procedures to +be invoked. +<p> +The callback procedure is called as follows: +<p> +<pre> + user-procedure param-name {old-value} {new-value} +</pre> +<p> +The important thing to note here is that the old and new value strings +are quoted with braces. This prevents any interpretation of the string +by Tcl when the callback is executed, which is necessary because the +strings can contain arbitrary data. When Tcl calls the callback the +first level of braces will be stripped off, leaving old-value and new-value +each as a single string argument. +<p> +<p> +<h2><A NAME="setValue">setValue</A></h2> +<p> +Set the value of a parameter, and notify all clients +via the posted callback procedures that the parameter value has changed. +<p> +Usage: +<p> +<pre> + setValue &lt;new-value&gt; +</pre> +<p> +<h2><A NAME="getValue">getValue</A></h2> +<p> +Get the value of a parameter. +<p> +Usage: +<p> +<pre> + getValue +</pre> +<p> +<h2><A NAME="notify">notify</A></h2> +<p> +Notify the registered clients of a parameter as if the +value had changed. +<p> +Usage: +<p> +<pre> + notify +</pre> +<p> +<h2><A NAME="addCallback">addCallback</A></h2> +<p> +Add a callback procedure to the callback list for +a parameter. +<p> +Usage: +<p> +<pre> + addCallback &lt;procedure-name&gt; +</pre> +<p> +<h2><A NAME="deleteCallback">deleteCallback</A></h2> +<p> +Delete a callback procedure previously registered +for a parameter. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> diff --git a/vendor/x11iraf/obm/docs/gui.doc/widgetclass.html b/vendor/x11iraf/obm/docs/gui.doc/widgetclass.html new file mode 100644 index 00000000..78d534db --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/widgetclass.html @@ -0,0 +1,450 @@ +<title>WIDGET class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> WIDGET class</h1> +<p> +<HR> +<p> +The Widget class is the generic or base class for the window system +toolkit widgets supported by the object manager. The Widget class +supports a number of different Xt widget classes using a table driven +approach to describe each widget. Any widget may be created, destroyed, +and manipulated in various ways using only the generic Widget class +procedures and Widget-specific resources. The Widget class may be +subclassed to support complex Widgets that require custom class-specific +commands for use by the GUI code. +<p> +Generic Widget-class commands: +<p> +<pre> + <a href="#set">set</a> &lt;resource-name&gt; &lt;value&gt; + <a href="#get">get</a> &lt;resource-name&gt; +<p> + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; [<callback-name>] + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#setSensitive">setSensitive</a> &lt;sensitive&gt; + <a href="#isSensitive">isSensitive</a> +<p> + <a href="#realize">realize</a> + <a href="#unrealize">unrealize</a> + <a href="#isRealized">isRealizeed</a> + <a href="#map">map</a> + <a href="#unmap">unmap</a> + <a href="#manage">manage</a> child [child ...] + <a href="#unmanage">unmanage</a> child [child ...] + <a href="#popup">popup</a> [grab-kind] + <a href="#popdown">popdown</a> + <a href="#popupSpringLoaded">popupSpringLoaded</a> +<p> + <a href="#move">move</a> &lt;x&gt; &lt;y&gt; + <a href="#resize">resize</a> &lt;width&gt; &lt;height&gt; &lt;border-width&gt; + <a href="#configure">configure</a> &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +The most important Widget commands are set/get resource, and the +callbacks. The widget sensitivity can be set and queried using set/get +resource, but special procedures are provided to make this common operation +more convenient. +<p> +Class specific functions: +<p> +<pre> + <a href="#append">append</a> text # text widget + <a href="#setList">setList</a> list [resize] # list widget + value = <a href="#getItem">getItem</a> itemno + <a href="#highlight">highlight</a> itemno + <a href="#unhighlight">unhighlight</a> +</pre> +<p> +Ideally the widget class should be subclassed for widgets that require +class-specific functions, but in simple cases involving standard widgets +the support is built into the widget class code as a special case. +<p> +Special actions (used in translations): +<p> +<pre> + <a href="#do_userproc">call</a> (proc [,arg, ...]) + <a href="#do_popup">popup</a> (menu-name [xoffset [yoffset]]) + <a href="#do_popdown">popdown</a> (menu-name) +</pre> +<p> +The "call" action is a very general mechanism which allows any GUI procedure +to be registered with any translation using the X translation table +mechanism. The popup and popdown actions are used for popup menus. The +menu will be popped up at the event coordinates plus the optional offsets +if given. +<p> +Event handling: +<p> +<pre> + <a href="#addEventHandler">addEventHandler</a> &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +Event callback: +<p> +<pre> + <a href="#userEventHandler">userEventHandler</a> widget event-type time wx wy rx ry other +</pre> +<p> +In most cases translations are preferable to events, but a GUI can capture +raw events if it wishes by adding event handlers. Nearly all of the X +event types are supported. The callback syntax employs a number of +standard arguments, followed by a number of event-specific arguments. +<p> +<h1><A NAME="addCallback">addCallback</A></h1> +<p> +Add a callback procedure to the callback list for +a widget. If no callback name is given, "callback" is assumed. +<p> +Usage: +<p> +<pre> + addCallback <procedure-name> [&lt;callback-name&gt;] +</pre> +<p> +Specific widgets only support certain types of callbacks. There is no +checking that the callback type specified is supported by a widget; the +wrong type of callback can be registered, but it will never be called. +<p> +<h1><A NAME="deleteCallback">deleteCallback</A></h1> +<p> +Delete a callback procedure previously registered +for a widget. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> +<p> +<h1><A NAME="do_userproc">do_userproc (call)</A></h1> +<p> +Translation action procedure used to call general user +action procedures in the interpreter. The name of the user procedure to +be called is given as the first argument in the translation. For example, +the translation "call(foo,a,b,c)" would cause procedure foo to be called +with the arguments (a,b,c). The following arguments are special: +<p> +<pre> + Argument Replaced by +<p> + $name object name of widget + $time event->time + $x event->x + $y event->y + $x_root event->x_root + $y_root event->y_root +</pre> +<p> +The "user procedure" can be any server procedure. +<p> +<h1><A NAME="do_popup">do_popup</A></h1> +<p> +Popup a menu (or other spring loaded popup) at the location +of the event which triggered this action. +<p> +Usage: +<p> +<pre> + popup(menu-name [xoffset [yoffset]]) +</pre> +<p> +<h1><A NAME="do_popdown">do_popdown</A></h1> +<p> +Pop down a menu. +<p> +Usage: +<p> +<pre> + popdown(menu-name) +</pre> +<p> +<h1><A NAME="set">set</A></h1> +<p> +Set a widget resource. +<p> +Usage: +<p> +<pre> + set &lt;resource-name&gt; &lt;value&gt; +</pre> +<p> +<h1><A NAME="get">get</A></h1> +<p> +Get a widget resource value as a string. +<p> +Usage: +<p> +<pre> + get &lt;resource-name&gt; +</pre> +<p> +<h1><A NAME="append">append</A></h1> +<p> +Append data to a text widget. +<p> +Usage: +<p> +<pre> + append &lt;text&gt; +</pre> +<p> +<h1><A NAME="setList">setList</A></h1> +<p> +Set the item list of a list widget. +<p> +Usage: +<p> +<pre> + setList list [resize] +</pre> +<p> +The list is a simple list of strings, passed as a single string argument to +setList (quotes, braces, etc. may be used to quote strings containing +special characters). +<p> +<h1><A NAME="getItem">getItem</A></h1> +<p> +Get an item in a list widget. +<p> +Usage: +<p> +<pre> + value = getItem itemno +</pre> +<p> +If ITEMNO is a number the indicated list item is returned, or the string +"EOF" if the requested item is beyond the end of the list. Otherwise the +currently selected item is returned, and the index of the item is returned +in the output variable ITEMNO. If no item is currently selected ITEMNO +will be set to "none" on output. +<p> +<h1><A NAME="highlight">highlight</A></h1> +<p> +Highlight an item in a list widget. +<p> +Usage: +<p> +<pre> + highlight itemno +</pre> +<p> +The indicated item of the list is highlighted as if the item had been +selected by the user. Any previously highlighted item is unhighlighted. +<p> +<h1><A NAME="unhighlight">unhighlight</A></h1> +<p> +Unhighlight the currently highlighted item in a +list widget. +<p> +Usage: +<p> +<pre> + unhighlight +</pre> +<p> +Any currently highlighted item in the list widget is unhighlighted. +<p> +<h1><A NAME="realize">realize</A></h1> +<p> +Realize a widget. This activates and assigns windows for +a widget and all of its descendants. Realizing a widget does not in itself +cause it to appear on the screen. +<p> +Usage: +<p> +<pre> + realize +</pre> +<p> +<h1><A NAME="unrealize">unrealize</A></h1> +<p> +Unrealize a widget. This destroys the windows assigned +to a widget and all of its descendants. +<p> +Usage: +<p> +<pre> + unrealize +</pre> +<p> +<h1><A NAME="isRealized">isRealized</A></h1> +<p> +Test whether a widget is realized. +<p> +Usage: +<p> +<pre> + isRealized +</pre> +<p> +<h1><A NAME="map">map</A></h1> +<p> +Map a widget. +<p> +Usage: +<p> +<pre> + map +</pre> +<p> +<h1><A NAME="unmap">unmap</A></h1> +<p> +Unmap a widget. +<p> +Usage: +<p> +<pre> + unmap +</pre> +<p> +<h1><A NAME="manage">manage</A></h1> +<p> +Manage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Managing the +children makes them appear in the window, possibly causing the other +children to be rearranged in the window. +<p> +Usage: +<p> +<pre> + manage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h1><A NAME="unmanage">unmanage</A></h1> +<p> +Unmanage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Unmanaging the +children makes them disappear from the window and be removed from geometry +management, possibly causing the other children to be rearranged in the +window. +<p> +Usage: +<p> +<pre> + unmanage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h1><A NAME="popup">popup</A></h1> +<p> +Popup a shell widget. If no grab is indicated the popup +can remain up while other windows accept input. +<p> +Usage: +<p> +<pre> + popup [grab-kind] +</pre> +<p> +<h1><A NAME="popdown">popdown</A></h1> +<p> +Popdown a shell widget. +<p> +Usage: +<p> +<pre> + popdown +</pre> +<p> +<h1><A NAME="popupSpringLoaded">popupSpringLoaded</A></h1> +<p> +Popup a shell widget, e.g., a popup menu. +This implies an exclusive grab. +<p> +Usage: +<p> +<pre> + popupSpringLoaded +</pre> +<p> +<h1><A NAME="move">move</A></h1> +<p> +Move a widget to the given window relative coordinates. +<p> +Usage: +<p> +<pre> + move &lt;x&gt; &lt;y&gt; +</pre> +<p> +<h1><A NAME="resize">resize</A></h1> +<p> +Resize a widget. +<p> +Usage: +<p> +<pre> + resize &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h1><A NAME="configure">configure</A></h1> +<p> +Configure a widget, i.e., execute a simultaneous +move and resize. +<p> +Usage: +<p> +<pre> + configure &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h1><A NAME="setSensitive">setSensitive</A></h1> +<p> +Set the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + setSensitive &lt;sensitive&gt; +</pre> +<p> +<h1><A NAME="isSensitive">isSensitive</A></h1> +<p> +Test the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + isSensitive +</pre> +<p> +<h1><A NAME="addEventHandler">addEventHandler</A></h1> +<p> +Add a custom event handler to a widget. A list +of event masks is given to define the classes of events the user supplied +event handling procedure is to receive. +<p> +Usage: +<p> +<pre> + addEventHandler &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +<h1><A NAME="removeEventHandler">removeEventHandler</A></h1> +<p> +Remove an event handler previously posted +with addEventHandler, above. +<p> +Usage: +<p> +<pre> + removeEventHandler procname +</pre> +<p> +<h1><A NAME="event">event</A></h1> +<p> +Generic event handler called when a widget event handler +posted by addEventHandler is called. +<p> +The user event handler is called as +<p> +<pre> + userEventHandler widget event-type time wx wy rx ry other +</pre> +<p> +where "other" is an event-type specific list of fields describing the +the event. diff --git a/vendor/x11iraf/obm/docs/gui.doc/widgets.gif b/vendor/x11iraf/obm/docs/gui.doc/widgets.gif new file mode 100644 index 00000000..17f9371e Binary files /dev/null and b/vendor/x11iraf/obm/docs/gui.doc/widgets.gif differ diff --git a/vendor/x11iraf/obm/docs/gui.doc/widgets.html b/vendor/x11iraf/obm/docs/gui.doc/widgets.html new file mode 100644 index 00000000..af80a997 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/widgets.html @@ -0,0 +1,14 @@ +<title>The Widgets</title> +<h1><IMG SRC="irafgui.gif"> Widgets</h1> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<p> +The basic widgets available to the IRAF GUI implimenter are the Athena +Widgets, the gterm widget, the image display widget, and markers. +<p> +<pre> +<a href="athena.html"><IMG ALIGN=MIDDLE SRC="athena.gif"></a> Athena widgets <a href="notyet2.html"><IMG ALIGN=MIDDLE SRC="gterm.gif"></a> Gterm widget + +<a href="notyet2.html"><IMG ALIGN=MIDDLE SRC="imtool.gif"></a> Imtool widget <a href="notyet2.html"><IMG ALIGN=MIDDLE SRC="marker.gif"></a> Marker widgets + +<a href="parameterwidget.html"><IMG ALIGN=MIDDLE SRC="params.gif"></a> Parameters +</pre> diff --git a/vendor/x11iraf/obm/docs/gui.doc/ximclient.html b/vendor/x11iraf/obm/docs/gui.doc/ximclient.html new file mode 100644 index 00000000..12eac899 --- /dev/null +++ b/vendor/x11iraf/obm/docs/gui.doc/ximclient.html @@ -0,0 +1,194 @@ +<title>XIMCLIENT</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> XIMCLIENT</h1> +<p> +<HR> +<p> +The Ximtool "client" object. This code implements an OBM client and +responds to messages sent to the client object by the GUI code executing +under the object manager. +<p> +Client commands: +<p> +<pre> + <a href="#setFrame">setFrame</a> frameno + frameno = <a href="#getFrame">getFrame</a> [raster] + <a href="#nextFrame">nextFrame</a> + <a href="#prevFrame">prevFrame</a> + <a href="#matchFrames">matchFrames</a> [frame] + <a href="#fitFrame">fitFrame</a> + + <a href="#setColormap">setColormap</a> colormap + <a href="#windowColormap">windowColormap</a> offset scale + <a href="#zoom">zoom</a> [mag | xmag ymag [ xcen ycen ]] + <a href="#zoom">zoomAbs</a> [mag | xmag ymag [ xcen ycen ]] + <a href="#pan">pan</a> xcen ycen + <a href="#flip">flip</a> axis [axis ...] + + + wcsstr = <a href="#encodewcs">encodewcs</a> sx sy sz + <a href="#retCursorVal">retCursorVal</a> sx sy [frame [wcs [key [strval]]]] + + <a href="#Quit">Quit</a> +</pre> +<p> +XIMTOOL CLIENT commands. +<p> +<h1><A NAME="Quit">Quit</A></h1> +<p> +Exit ximtool. +<p> +Usage: +<p> +<pre> + Quit +</pre> +<p> +<h1><A NAME="setFrame">setFrame</A></h1> +<p> +Set the frame to be displayed. +<p> +Usage: +<p> +<pre> + setFrame <frameno> +</pre> +<p> +<h1><A NAME="getFrame">getFrame</A></h1> +<p> +Get the frame number. +<p> +Usage: +<p> +<pre> + getFrame [raster] +</pre> +<p> +This routine has two forms. When called with no argument getFrame returns +the current display frame. When called with a raster number getFrame +returns the frame number with which the raster is associated. +<p> +<h1><A NAME="nextFrame">nextFrame</A></h1> +<p> +Display the next frame in sequence. +<p> +Usage: +<p> +<pre> + nextFrame +</pre> +<p> +<h1><A NAME="prevFrame">prevFrame</A></h1> +<p> +Display the previous frame in sequence. +<p> +Usage: +<p> +<pre> + prevFrame +</pre> +<p> +<h1><A NAME="matchFrames">matchFrames</A></h1> +<p> +Set the enhancement of all frames to match the current +display frame. +<p> +Usage: +<p> +<pre> + matchFrames [frame] +</pre> +<p> +<h1><A NAME="fitFrame">fitFrame</A></h1> +<p> +Attempt to make the display window the same size as the frame +buffer. +<p> +Usage: +<p> +<pre> + fitFrame +</pre> +<p> +<h1><A NAME="setColormap">setColormap</A></h1> +<p> +Set the colormap for the current display frame. +<p> +Usage: +<p> +<pre> + setColormap <colormap> +</pre> +<p> +<h1><A NAME="windowColormap">windowColormap</A></h1> +<p> +Set the colormap for the current display frame. +<p> +Usage: +<p> +<pre> + windowColormap <offset> <scale> +</pre> +<p> +<h1><A NAME="zoom">zoom, zoomAbs</A></h1> +<p> +Set the zoom factors for the current frame to the given values. +A zoom factor > 1 enlarges the image, < 1 shrinks the image, 1.0 maps +one source pixel to one destination pixel. +<p> +Usage: +<p> +<pre> + zoom <xymag> 1 argument + zoom <xmag> <ymag> 2 arguments + zoom <xmag> <ymag> <xcen> <ycen> 4 arguments +</pre> +<p> +When called as "zoom" the magnification is relative to the fixed scaling, +if any, used to scale the frame to fit the display window at mag=1.0. +When called as zoomAbs" the magnification given is the actual scale factor +used to map raster pixels to display pixels. +<p> +<h1><A NAME="pan">pan</A></h1> +<p> +Pan the current frame, i.e., change the view center. +<p> +Usage: +<p> +<pre> + pan <xcen> <ycen> +</pre> +<p> +<h1><A NAME="flip">flip</A></h1> +<p> +Flip the current display frame in the indicated axis or axes. +<p> +Usage: +<p> +<pre> + flip [axis [axis ...]] +</pre> +<p> +<h1><A NAME="retCursorVal">retCursorVal</A></h1> +<p> +Return a cursor value to the ximtool client process. This +should be executed by the GUI to terminate a cursor read. +<p> +Usage: +<p> +<pre> + retCursorVal sx sy [frame [wcs [key [strval]]]] +</pre> +<p> +<h1><A NAME="encodewcs">encodewcs</A></h1> +<p> +Convert raw screen coordinates x,y,z (z=pixel value) to +world coordinates using the WCS passed to ximtool by the client application +when the frame was loaded. The encoded description of the current position +and pixel value is returned to the GUI as a string value. +<p> +Usage: +<p> +<pre> + string = encodewcs sx sy sz +</pre> +<p> diff --git a/vendor/x11iraf/obm/docs/obm/Client.html b/vendor/x11iraf/obm/docs/obm/Client.html new file mode 100644 index 00000000..407c177b --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/Client.html @@ -0,0 +1,75 @@ +<title>CLIENT class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> CLIENT class</h1> +<p> +<HR> +<p> +The client is the client application, which provides the functionality +underlying the UI. When a message is sent to the client object it usually +results in a message being sent to the client *application*, usually an +external program communicating via IPC, which has little or no knowledge +of the UI. The client application receives and executes commands delivered +by the UI via the client object. Output from the client may or may not +come back to the object manager. That portion of the output which comes +back to the object manager is in the form of assignments of string values +to <a href="uiparameterclass.html">UI parameter-class objects</a> (another +way of thinking of this is that +messages or events are sent to and acted upon by the parameter objects). +Hence, the client object is output only so far as the client application +is concerned. +<p> +The Client-class commands are used to send a message to the client. +<p> +<pre> + <a href="#gkey">gkey</a> &lt;key&gt; + <a href="#gcmd">gcmd</a> &lt;command-string&gt; + <a href="#literal">literal</a> &lt;command&gt; +</pre> +<p> +or just &lt;command&gt;, e.g., "send client &lt;command&gt;" will work in most cases. +<p> +<a href="#gkey">GKEY</a> sends an IRAF graphics keystroke. +<a href="#gcmd">GCMD</a> sends an +IRAF graphics colon command. <a href="#literal">LITERAL</a> sends a literal +command string to the +client. The keyword "literal" may optionally be omitted, i.e., "send client +foo" and "send client literal foo" are the same. The keyword "literal" may +be used to ensure that the client command string which follows will not +be interpreted as a Client-class command (such as gkey, gcmd, or literal). +<p> +<p> +<h1><A NAME="gcmd">gcmd</A></h1> +<p> +Send a graphics command string to the client application. +A graphics command string is a graphics cursor value with the key set +to `:' and the command string given as the string part of the cursor +value. The protocol module which posted the client output procedure is +responsible for encoding and sending the cursor command. +<p> +Usage: +<p> +<pre> + gcmd &lt;command-string&gt; +</pre> +<p> +<h1><A NAME="gkey">gkey</A></h1> +<p> +Send a graphics key event to the client application. +A graphics key event is a graphics cursor value with the key set to some +integer value and a null string part. +<p> +Usage: +<p> +<pre> +gkey &lt;key&gt; +</pre> +<p> +<h1><A NAME="literal">literal</A></h1> +<p> +Send a literal command to the client application. +<p> +Usage: +<p> +<pre> + literal &lt;command&gt; +</pre> + diff --git a/vendor/x11iraf/obm/docs/obm/Gterm.html b/vendor/x11iraf/obm/docs/obm/Gterm.html new file mode 100644 index 00000000..5fcdab10 --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/Gterm.html @@ -0,0 +1,694 @@ +<title>Gterm-Image widget class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> Gterm-Image widget class (a subclass of Widget).</h1> +<p> +<HR> +<p> +The gterm-image widget is a general 2D graphics-imaging widget providing +a wide range of facilities for drawing graphics and text, for image +display, and for graphics interaction. Normally the client communicates +directly with the Gterm widget to draw graphics, download image data, +and so on, using some communications protocol outside the domain of the +object manager. Nonetheless so far as possible the facilities of the Gterm +widget have also been made available to GUI code via the commands listed +here. +<p> +The Gterm widget adds the following function to the OBM library. +<p> +<pre> + ObmPostSetGtermCallback (obm, &setgterm, setgterm_client_data) +</pre> +<p> +This is called by a client application to post a procedure to be called +when a gterm widget receives the setGterm command. The calling sequence +for setGterm callback is as follows: +<p> +<pre> + setgterm (client_data, gterm_widget) +</pre> +<p> +The purpose of this callback is to tell the client which gterm widget is +the "active" gterm widget. This is used by clients which only support +one active Gterm widget, i.e., which can only direct graphics output to +one Gterm widget at a time. +<p> +The messages or commands that can be sent to the Gterm widget by GUI +code follow. +<p> +General commands: +<p> +<pre> + <a href="#setGterm">setGterm</a> # make widget the active Gterm +<p> + <a href="#activate">activate</a> + <a href="#deactivate">deactivate</a> + <a href="#addCallback">addCallback</a> procedure-name callback-type + <a href="#reset">reset</a> + <a href="#flush">flush</a> +<p> + <a href="#setCursorPos">setCursorPos</a> x y [raster] + <a href="#getCursorPos">getCursorPos</a> x y + <a href="#setCursorType">setCursorType</a> cursortype + <a href="#bell">bell</a> +</pre> +<p> +Graphics drawing commands: +<p> +<pre> + <a href="#setRaster">setRaster</a> raster + raster = <a href="#getRaster">getRaster</a> [raster] +<p> + <a href="notyet.html">setLogRes</a> width height (unimplimented) + <a href="notyet.html">getLogRes</a> width height (unimplimented) + <a href="notyet.html">setPhysRes</a> width height (unimplimented) + <a href="notyet.html">getPhysRes</a> width height (unimplimented) + <a href="notyet.html">setTextRes</a> rows cols (unimplimented) + <a href="notyet.html">setDataLevel</a> level (unimplimented) + <a href="notyet.html">setLineWidth</a> width (unimplimented) + <a href="notyet.html">setLineStyle</a> style (unimplimented) + <a href="notyet.html">setColorIndex</a> index (unimplimented) + <a href="notyet.html">setFillType</a> filltype (unimplimented) +<p> + <a href="#clearScreen">clearScreen</a> + <a href="notyet.html">drawPolyline</a> vector (unimplimented) + <a href="notyet.html">drawPolymarker</a> vector (unimplimented) + <a href="notyet.html">drawPolygon</a> vector (unimplimented) + <a href="notyet.html">drawMarker</a> x y xsize ysize type (unimplimented) +<p> + <a href="notyet.html">drawAlphaText</a> x y text (unimplimented) + <a href="notyet.html">getAlphaTextSize</a> string width height base (unimplimented) + <a href="notyet.html">startDialog</a> (unimplimented) + <a href="notyet.html">endDialog</a> (unimplimented) + <a href="notyet.html">eraseDialog</a> (unimplimented) + <a href="notyet.html">drawDialogText</a> x y text (unimplimented) + <a href="notyet.html">getDialogTextSize</a> string width height base (unimplimented) +</pre> +<p> +The coordinates used in the graphics drawing commands are logical +coordinates as defined by setLogRes, in the coordinate system of the +reference drawing raster as defined by setRaster. The default reference +raster is raster zero, the widget's window. Vectors are specified as +a list of points, e.g., { {x y} {x y} ... }. +<p> +Imaging commands: +<p> +<pre> + <a href="#rasterInit">rasterInit</a> + <a href="notyet.html">assignRaster</a> raster drawable (unimplimented) + <a href="notyet.html">createRaster</a> raster type width height depth (unimplimented) + <a href="notyet.html">destroyRaster</a> raster (unimplimented) + exists = <a href="notyet.html">queryRaster</a> raster type width height depth (unimplimented) + raster = <a href="notyet.html">nextRaster</a> [raster] (unimplimented) + nrasters = <a href="notyet.html">nRasters</a> [nrasters] (unimplimented) +<p> + <a href="#setPixel">setPixel</a> raster x y value + value = <a href="#getPixel">getPixel</a> raster x y + <a href="#writePixels">writePixels</a> raster pixels encoding x1 y1 nx ny + <a href="#readPixels">readPixels</a> raster pixels encoding x1 y1 nx ny + <a href="notyet.html">refreshPixels</a> raster ct x1 y1 nx ny (unimplimented) + pixmap = <a href="notyet.html">createPixmap</a> src x y width height (unimplimented) + <a href="notyet.html">copyPixmap</a> pixmap dst x y width height (unimplimented) +<p> + colormap = <a href="notyet.html">nextColormap</a> [colormap] (unimplimented) + <a href="notyet.html">freeColormap</a> colormap (unimplimented) + <a href="notyet.html">writeColormap</a> colormap first nelem colors (unimplimented) + <a href="notyet.html">readColormap</a> colormap first nelem colors (unimplimented) + <a href="#loadColormap">loadColormap</a> colormap offset scale +<p> + <a href="notyet.html">initMappings</a> (unimplimented) + mapping = <a href="#nextMapping">nextMapping</a> [mapping] + <a href="notyet.html">freeMapping</a> mapping (unimplimented) + <a href="notyet.html">enableMapping</a> mapping (unimplimented) + <a href="notyet.html">disableMapping</a> mapping (unimplimented) + active = <a href="notyet.html">activeMapping</a> mapping (unimplimented) + <a href="notyet.html">refreshMapping</a> mapping (unimplimented) +<p> + raster = <a href="#selectRaster">selectRaster</a> dras dt dx dy rt rx ry [map] + <a href="#unmapPixel">unmapPixel</a> sx sy raster rx ry [rz] +<p> + <a href="notyet.html">copyRaster</a> rop src st sx sy snx sny dst dt dx dy dnx dny (unimplimented) + <a href="#setMapping">setMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny + <a href="#getMapping">getMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny +<p> + <a href="#flip">flip</a> mapping axis [axis...] +</pre> +<p> +Pixel arrays are long strings consisting either of a sequence of numeric +pixel values separated by whitespace (space or newline), or a hex encoded +sequence of bytes (2 hex digits per 8 bit pixel). Colors are specified +as a list of RGB triplets, e.g., { {R G B} {R G B} ... }. +<p> +Refer to the documentation for the Gterm widget for a detailed description +of rasters, mappings, and colormaps. +<p> +Markers: +<p> +<pre> + <a href="#createMarker">createMarker</a> name [attribute-list] + <a href="#markerInit">markerInit</a> +</pre> +<p> +New markers may be created with createMarker. Once created, a marker +functions under the Object Manager as a named object of class "marker". +Refer to the marker class for a description of the commands defined for +a marker. +<p> +gterm Actions List +<p> +<pre> + ignore + graphics-input + graphics-context + crosshair + track-cursor + enter-window + leave-window + popup-menu {not implemented} + reset + m_create +</pre> +<p> +Default translations for Gterm window. +Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) +<p> +default Gterm Translations +<p> +<pre> + [Btn1Down]:m_create() + [Btn2Down]:crosshair(on) + [Btn2Motion]:crosshair(on) + [Btn2Up]:crosshair(off) + ~Ctrl ~Meta [Btn3Down]:graphics-context() + [EnterWindow]:enter-window() + [LeaveWindow]:leave-window() + [KeyPress]:graphics-input() + [Motion]:track-cursor() +<pre> +<p> +<p> +GTERM class commands. +<p> +<h1><A NAME="setGterm">setGterm</A></h1> +<p> +Set the active Gterm widget. A UI can have more than one +gterm widget, but due to restrictions on the client-server interface, it +may be possible for only one to receive client output at any one time (any +gterm widget can generate input to be sent to the client). If the client +has this restriction, the client-server interface code which uses OBM can +call the ObmPostSetGtermCallback procedure to post a function to be called +when the UI code calls the setGterm procedure. +<p> +Usage: +<p> +<pre> + setGterm +</pre> +<p> +<h1><A NAME="activate">activate</A></h1> +<p> +Activate the gterm widget. This causes the next GIN mode +setCursorType to warp the pointer into the gterm window. +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h1><A NAME="deactivate">deactivate</A></h1> +<p> +Deactivate the gterm widget. If the cursor has been warped +into the window by a previous activate/setCursorType GIN mode, this causes +the cursor to be warped back to where it was previously. +<p> +Usage: +<p> +<pre> + deactivate +</pre> +<p> +<h1><A NAME="reset">reset</A></h1> +<p> +Reset the gterm widget. This causes a number of state variables +affecting graphics drawing options to be set to their default values. +<p> +Usage: +<p> +<pre> + reset +</pre> +<p> +<h1><A NAME="flush">flush</A></h1> +<p> +Flush any graphics output and synchronize the state of the widget +with what is shown on the display. +<p> +Usage: +<p> +<pre> + flush +</pre> +<p> +The gterm widget uses XLIB, which buffers graphics drawing commands and +automatically sends them to the X server when 1) the buffer fills, +2) input is requested from the server. Such buffering of data is necessary +for efficient operation and it should rarely be necessary to explicitly +flush graphics output since XLIB does this automatically in most cases. +An example of when explicitly flushing the ouptut might be necessary is in +cases where smooth animation is desired and drawing the graphics in batches +could cause the display to appear "jerky". +<p> +<h1><A NAME="addCallback">addCallback</A></h1> +<p> +Post a callback for a Gterm widget event. +<p> +Usage: +<p> +<pre> + addCallback procedure-name [callback-type] +</pre> +<p> +The recognized Gterm callbacks are +<p> +<pre> + + input Called when the graphics-input action is invoked in + a translation table. The default Gterm translation + table invokes this action when a KeyPress event occurs + in the Gterm window. + Callback: widget-name input-type event-data + + resize Called when the gterm window is resized. + Callback: widget-name width height + + reset Called when the "reset" action is invoked. + Callback: widget-name + +<pre> +<p> +If no callback is specified the default is "input". +<p> +Note that in GUI code one can also use the translation table to directly +invoke GUI procedures without need to use the Gterm input mechanism. This +is more flexible but we support the Gterm input callback here for +applications that use the default translations. +<p> +<h1><A NAME="setCursorPos">setCursorPos</A></h1> +<p> +Warp the cursor (pointer) to the given coordinates. This +is a graphics drawing command and if no raster number is specified the +current reference drawing raster, as set with setRaster, defines the +coordinate system. +<p> +Usage: +<p> +<pre> + setCursorPos x y [raster] +</pre> +<p> +A raster number may optionally given to define the raster coordinate system +to be used. raster=0 yields screen coordinates. +<p> +<h1><A NAME="getCursorPos">getCursorPos</A></h1> +<p> +Get the cursor position (raster 0 or screen coordinates). +<p> +Usage: +<p> +<pre> + getCursorPos x y +</pre> +<p> +<h1><A NAME="setCursorType">setCursorType</A></h1> +<p> +Set the cursor type. +<p> +Usage: +<p> +<pre> + setCursorType cursor-type + + idle default cursor + busy busy cursor, e.g, when program is busy + ginMode graphics input mode cursor, set when program is + waiting for graphics input +</pre> +<p> +<h1><A NAME="bell">bell</A></h1> +<p> +Gterm widget sound output. +<p> +Usage: +<p> +<pre> + bell +</pre> +<p> +<h1><A NAME="setRaster">setRaster</A></h1> +<p> +Set the number of the raster to be used to define the drawing +context (e.g. coordinate system) for graphics and text drawing functions. +<p> +Usage: +<p> +<pre> + setRaster raster-number +</pre> +<p> +<h1><A NAME="getRaster">getRaster</A></h1> +<p> +Get the number of the raster which defines the drawing +context, as set in the last setRaster call. +<p> +Usage: +<p> +<pre> + raster = getRaster [raster] +</pre> +<p> +If the name of a variable is given the raster number will be stored +directly in that variable. +<p> +<h1><A NAME="clearScreen">clearScreen</A></h1> +<p> +Clear the "screen", i.e., window. This action clears the +drawing window and sets a number of drawing state variables to their default +values. +<p> +Usage: +<p> +<pre> + clearScreen +</pre> +<p> +<h1><A NAME="rasterInit">rasterInit</A></h1> +<p> +Initialize the raster subsystem, deleting all rasters and +mappings and freeing the dynamic part of the colortable. +<p> +Usage: +<p> +<pre> + rasterInit +</pre> +<p> +<h1><A NAME="writePixels">writePixels</A></h1> +<p> +Set the values of some subset of the pixels in a raster. +If any mappings are defined on the affected region and are enabled, any +destination rasters will be automatically updated as defined by the mapping. +<p> +Usage: +<p> +<pre> + writePixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be written. +</pre> +<p> +Most real-world image processing applications get the Gterm widget handle +with setGterm and pass binary data to the widget by calling GtWritePixels +directly. This is the most efficient approach for serious image processing +where large amounts of data are involved. However, being able to read and +write raster pixels directly in a GUI can be useful in specialized +applications, e.g., where the image is computed or modified by the GUI. +<p> +<h1><A NAME="setPixel">setPixel</A></h1> +<p> +Set the value of a single pixel. +<p> +Usage: +<p> +<pre> + setPixel raster x y value + + raster The raster number. + x, y The pixel to be set. + value The pixel value. +</pre> +<p> +This routine is more efficient than writePixels for setting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be set. +<p> +<h1><A NAME="readPixels">readPixels</A></h1> +<p> +Get the values of some subset of the pixels in a raster. +<p> +Usage: +<p> +<pre> + readPixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be read. +</pre> +<p> +Use readPixels to read a block of pixels, and getPixel to get the value +of a single pixel. +<p> +<h1><A NAME="getPixel">getPixel</A></h1> +<p> +Get the value of a single pixel. +<p> +Usage: +<p> +<pre> + getPixel raster x y + + raster The raster number. + x, y The pixel to be set. +</pre> +<p> +This routine is more efficient than readPixels for getting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be read. +<p> +<h1><A NAME="nextMapping">nextMapping</A></h1> +<p> +Return the index of the next unused mapping. +<p> +Usage: +<p> +<pre> + nextMapping +</pre> +<p> +Returns the mapping number as the function value. +<p> +<h1><A NAME="getMapping">getMapping</A></h1> +<p> +Get a mapping. +<p> +Usage: +<p> +<pre> + getMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters except the mapping number are output parameters. +<p> +<h1><A NAME="setMapping">setMapping</A></h1> +<p> +Set a mapping. +<p> +Usage: +<p> +<pre> + setMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters are input parameters. +<p> +<h1><A NAME="loadColormap">loadColormap</A></h1> +<p> +Load a colormap. +<p> +Usage: +<p> +<pre> + loadColormap colormap [offset [scale]] +</pre> +<p> +The offset and scale parameters may be used to adjust the brightness and +contrast of the image when the colormap is loaded. The normalized colormap +has offset=0.5, scale=1.0. Colormap zero is the hardware colormap. +<p> +<h1><A NAME="selectRaster">selectRaster</A></h1> +<p> +Given the raw screen coordinates SX,SY (or coords in +any destination raster), determine the mapping and source raster which are +mapped to that pixel and return the raster and mapping numbers and the +coordinates of the same pixel in the source raster. +<p> +Usage: +<p> +<pre> + raster = selectRaster dras dt dx dy rt rx ry [map] +</pre> +<p> +where +<p> +<pre> + dras display raster + dt,rt coordinate type - "pixel" or "ndc" + dx,dy display raster coordinates (input) + rx,ry source raster coordinates (output) + map mapping selected (output) +</pre> +<p> +Note that the coordinates returned by selectRaster are measured (taking +a line as an example) from zero at the left edge of the first pixel, to +"width" at the right edge of the last pixel. This means that the floating +point coordinates of the center of raster pixel N will be N + 0.5. For +example, if we input screen coordinates (dras=0), x=117, and no mapping +is in effect, the floating point raster coordinates returned will be 117.5. +The difference occurs because the input coordinate is a pixel number +(integer) while the output coordinate is a floating point coordinate +measuring the continuously variable location a pixel. int(x) will convert +this coordinate to a raster pixel number. +<p> +<h1><A NAME="unmapPixel">unmapPixel</A></h1> +<p> +unmapPixel is a simplified, less general version of +selectRaster which will automatically follow graphics pipelines back to +the original mapped raster. If desired the raster pixel value can be +returned as well as the raster number and raster pixel coordinates +corresponding to a screen (raster 0) pixel. +<p> +Usage: +<p> +<pre> + unmapPixel sx sy raster rx ry [rz] +</pre> +<p> +where +<p> +<pre> + sx,sy "screen" (raster 0) coordinates + raster original mapped raster (output) + rx,ry source raster coordinates (output) + rz source raster pixel value (output) +<pre> +<p> +By following graphics pipelines back to the original source raster we mean +the following. If raster A is mapped to raster B which is mapped to C (the +screen), given a screen coordinate in the mapped region unmapPixel will +return the raster number and coordinates for raster A. +<p> +<h1><A NAME="flip">flip</A></h1> +<p> +Edit a mapping to flip the mapped subimage in X and/or Y. +<p> +Usage: +<p> +<pre> + flip mapping axis [axis] +</pre> +<p> +where axis is "x" or "y". This is a convenience routine for changing only +the flip portion of a mapping. +<p> +<h1><A NAME="markerInit">markerInit</A></h1> +<p> +Initialize the Marker subsystem for a Gterm widget. +This destroys all markers and initializes the marker subsystem. +<p> +Usage: +<p> +<pre> + markerInit +</pre> +<p> +<h1><A NAME="createMarker">createMarker</A></h1> +<p> +Create a new marker. +<p> +Usage: +<p> +<pre> + createMarker name attribute-list + e.g. createMarker name {attribute value [attribute value ...]} + or createMarker name attribute value [attribute value ...] +<pre> +<p> +Any marker attribute may be assigned a value when the marker is created. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker attribute names. Often the +the attributes "type" and "createMode" need to be specified at marker +create time. +<p> +<pre> + type The marker type: text, rectangle, circle, etc. + + createMode A marker should be created with createMode=interactive + if the user is expected to interactively drag out + the marker using the pointer and either the default + or an application specified translation table. A + marker can also be created interactively using only + the m_create (marker create) action, however m_create + does not allow the marker attributes to be set. +<pre> +<p> +There are any number of ways to use a GUI to create a marker under the +Object Manager, but an example might be using a translation to call a GUI +procedure which issues the createMarker call. For example a pointer down +event could translate as "call(newMarker,$name,$x,$y) m_create()" where +newMarker is a GUI marker creation procedure which sends a createMarker +message to the Gterm widget. The GUI procedure could set the marker +attributes as desired, possibly using additional GUI components to define +the marker attributes. The m_create action will notice that a +createMarker has been executed and will merely activate the marker and +give it the pointer focus (i.e. install the marker translations). The +user will then use the pointer or keyboard to drag out the marker. +<p> +If the marker is created noninteractive the application must set the marker +position and size using marker attributes. If the marker is sensitive +the user can then use the marker's translations to interactively modify +the marker (resize it, move it, etc.). All markers which are visible and +sensitive and which have the necessary translations can be interactively +modified by the user; the reason for creating a marker in interactive mode +is to allow the initial marker position and size to be specified +interactively *when* the marker is created, instead of afterwards. +<p> +Any number of attributes may be given when the marker is created. Most +marker attributes can also be modified after a marker has been created +by sending setAttribute messages to the marker. + diff --git a/vendor/x11iraf/obm/docs/obm/Marker.html b/vendor/x11iraf/obm/docs/obm/Marker.html new file mode 100644 index 00000000..9e124846 --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/Marker.html @@ -0,0 +1,402 @@ +<title>Graphics Marker class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> Graphics Marker class</h1> +<p> +<HR> +<p> +A marker is a graphics object implemented by the Gterm-Image widget. +Markers are not real toolkit widgets, but they act much like widgets and +are interfaced as an object class under the Object Manager. The Marker +class is not a subclass, it is a base class like Widget, but Marker objects +can exist only as children of Gterm widgets. +<p> +Since markers are not independent widgets but rather part of a Gterm widget +instance, the parent Gterm widget is partially responsible for managing +markers. The Gterm widget implements the following commands for dealing +with markers. +<p> +<pre> + <a href="gtermclass.html#createMarker">createMarker</a> name [attribute-list] + <a href="gtermclass.html#markerInit">markerInit</a> +</pre> +<p> +A new marker is created by sending the createMarker message to the parent +gterm widget. This creates a marker of the given name and type. +The markerInit command, if sent to a gterm widget, destroys any markers +defined for that widget and reinitializes the marker facility. Markers +may also be created by action procedures in response to user input events. +<p> +A marker may be destroyed by itself in response to an input event (e.g. the +user presses the delete key), by sending the marker the destroy message +to tell it to destroy itself, by sending a markerInit to the parent gterm +widget, or by destroying the marker object (or any parent) with the server +command <a href="servercom.html#destroyObject">destroyObject</a>. +<p> +Once a marker has been created it behaves as an independent object and +receives and executes messages, responds to events, generates callbacks, +and so on. The marker class defines the following commands. +<p> +<pre> + <a href="#makeCopy">makeCopy</a> name + <a href="#addCallback">addCallback</a> procedure [event [event ...]] + <a href="#notify">notify</a> [event-type [param [param ...]]] + <a href="#destroy">destroy</a> [nocallback] +<p> + <a href="#markpos">markpos</a> + <a href="#redraw">redraw</a> [function] [markpos|nomarkpos] [erase|noerase] +<p> + <a href="#raise">raise</a> [reference-marker] + <a href="#lower">lower</a> [reference-marker] +<p> + <a href="#move">move</a> x y + <a href="#resize">resize</a> width height + <a href="#rotate">rotate</a> angle # radians +<p> + <a href="#setAttribute">set</a> attribute value # alias for setAttribute + value = <a href="#getAttribute">get</a> attribute # alias for getAttribute +<p> + <a href="#setAttribute">setAttribute</a> attribute value + value = <a href="#getAttribute">getAttribute</a> attribute + <a href="#setAttributes">setAttributes</a> attribute-list + <a href="#getAttributes">getAttributes</a> attribute-list + <a href="#setVertices">setVertices</a> points first npts + <a href="#getVertices">getVertices</a> points first npts +<p> + region = <a href="#getRegion">getRegion</a> [unmap] [coord-type] + <a href="#getRect">getRect</a> dx dy dnx dny +</pre> +<p> +Marker positions and dimensions are given in window (raster 0) coordinates. +<p> +The operators raise, lower, move, resize, and rotate erase the marker, +modify it as indicated, and redraw it with the new attributes. For finer +control over marker attributes one can use [get|set]Attribute[s] and +[get|set]Vertices to edit the markers directly. In this case an auto +redraw is not performed (unless the autoRedraw marker attribute is set). +The usual sequence is a markpos to record the marker position, one or more +setAttribute calls to change marker attributes, then a redraw to erase +the old marker and redraw the new one. Markers have many attributes which +can be set to control things like the position and size, colors, line +widths, fill type and style, font, rubber-band technique, and so on. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker types and attributes. +<p> +The marker type may be changed at runtime without destroying the marker. +For example a circle can be changed to an ellipse or a rectangle. This +also works for polygons (the vertex list is preserved and restored when +the marker is changed back to a polygon). +<p> +The current shape of a marker may be queried with getVertices, which +returns the polygon or polyline vertex list in window coordinates. A more +powerful routine which does something similar is getRegion. This routine +returns a high level description of the region outlined by the marker, +giving the marker type (rectangle, circle, ellipse etc.), center, width +and height, and so on. Any position or dimension information may +optionally be transformed back to the original source raster, if the marker +center is in a region of the window which is the destination of an active +mapping. The unmap option will follow multiple mappings back to the +original mapped source raster. +<p> +The getRect function returns the parameters of the region outlined by a +rectangle marker in a form convenient for use in a Gterm setMapping call +(this is used to display an image within a marker). +<p> +Default translations when pointer is over a marker. +default Marker Translations +<p> +<pre> + Shift &lt; Btn1Motion &gt;i m_rotateResize() + &lt; Btn1Motion &gt; m_moveResize() + Shift &lt; Btn1Down &gt; m_raise() m_markpos() + &lt; Btn1Down &gt; m_raise() m_markposAdd() + &lt; Btn1Up &gt; m_redraw() m_destroyNull() + &lt; Btn2Down &gt; m_lower() + &lt; Key &gt; BackSpace m_deleteDestroy() + &lt; Key &gt; Delete m_deleteDestroy() + &lt; KeyPress &gt; m_input() + &lt; Motion &gt; track-cursor() +</pre> +<p> +MARKER class commands. +<p> +makeCopy</A></h1> +<p> +Copy a marker. The new marker is initially identical to the +old one, and will not be distinct until, e.g., moved to a new center. +<p> +Usage: +<p> +<pre> + makeCopy name +</pre> +<p> +<h1><A NAME="addCallback">addCallback</A></h1> +<p> +Post a marker callback to be called when the specified +event or events occurs. If no events are listed a Notify callback will +be posted. +<p> +Usage: +<p> +<pre> + addCallback procedure [event [event ...]] +</pre> +<p> +<h1><A NAME="notify">notify</A></h1> +<p> +Generate a Marker pseudo-event, causing any posted client +callback procedures to be called. +<p> +Usage: +<p> +<pre> + notify [event-type [param [param ...]]] +</pre> +<p> +<h1><A NAME="destroy">destroy</A></h1> +<p> +Destroy a marker. Just tell the marker to destroy itself. +All cleanup outside the marker facility relies upon the use of callbacks. +This includes our callback markerDestroyCallback below. +<p> +Usage: +<p> +<pre> + destroy +</pre> +<p> +<h1><A NAME="markpos">markpos</A></h1> +<p> +Mark the current position of a marker for a later redraw. +<p> +Usage: +<p> +<pre> + markpos +</pre> +<p> +Markpos is used to mark the position of a marker before changing any +marker attributes, so that a later "redraw marked" will erase the old +marker rather than the new one. This is necessary, for example, if any +marker attributes are changed which affect the size or position of the +marker. +<p> +<h1><A NAME="redraw">redraw</A></h1> +<p> +Redraw a marker. +<p> +Usage: +<p> +<pre> + redraw [function] [erase|noerase] [markpos|nomarkpos] +</pre> +<p> +By default redraw will erase the old marker at the position indicated by +a previous call to markpos, and redraw the marker with the current +attributes using the drawing function copy (copy source to destination). +Hence the usual usage is "markpos ... change marker attributes ... redraw". +Optional arguments may be given to change the drawing function, enable or +disable erase, or force redraw to do a markpos. These arguments may be +given in any order. +<p> +The drawing functions are as given in the XLIB documentation, minus the +"GX" prefix. The most commonly used functions are "copy" and "xor". +A normal marker redraw uses function=copy. +<p> +<h1><A NAME="raise">raise</A></h1> +<p> +Raise a marker, i.e., cause it to be drawn on top of other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + raise [reference-marker] +</pre> +<p> +In a reference marker is named the marker will raise itself above this +marker, otherwise the raised marker becomes the topmost marker. +<p> +<h1><A NAME="lower">lower</A></h1> +<p> +Lower a marker, i.e., cause it to be drawn beneath other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + lower [reference-marker] +</pre> +<p> +In a reference marker is named the marker will lower itself beneath this +marker, otherwise the lowered marker becomes the lowest marker. +<p> +<h1><A NAME="move">move</A></h1> +<p> +Move a marker. +<p> +Usage: +<p> +<pre> + move x y +</pre> +<p> +Move the marker center to the indicated coordinates in the display window. +<p> +<h1><A NAME="resize">resize</A></h1> +<p> +Resize a marker. +<p> +Usage: +<p> +<pre> + resize width height +</pre> +<p> +Resize the marker to the indicated size. By default width and height are +given in pixels. For a text marker one can append "ch" to indicate that +the units are chars in whatever font is in use, e.g., "40ch" or "40 chars" +is an acceptable value for a text marker dimension. +<p> +<h1><A NAME="rotate">rotate</A></h1> +<p> +Rotate a marker. +<p> +Usage: +<p> +<pre> + rotate angle +</pre> +<p> +Redraw a marker oriented to the given rotation angle. The angle is +given in radians. +<p> +<h1><A NAME="getAttribute">getAttribute</A></h1> +<p> +Return the value of a marker attribute. +<p> +Usage: +<p> +<pre> + value = getAttribute attribute-name +</pre> +<p> +<h1><A NAME="setAttribute">setAttribute</A></h1> +<p> +Set the value of a marker attribute. +<p> +Usage: +<p> +<pre> + setAttribute attribute-name value +</pre> +<p> +<h1><A NAME="getAttributes">getAttributes</A></h1> +<p> +Return the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + getAttributes attribute-list + i.e. getAttributes {name value [name value ...]} + or getAttributes name value [name value ...] +</pre> +<p> +where "value" is the name of the variable in which the attribute value +is to be stored. +<p> +<h1><A NAME="setAttributes">setAttributes</A></h1> +<p> +Set the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + setAttributes attribute-list + i.e. setAttributes {name value [name value ...]} +</pre> +<p> +where "value" is the new value of the associated marker attribute. +<p> +<h1><A NAME="getVertices">getVertices</A></h1> +<p> +Get some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + getVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is returned in the +variable "points", as a string of the form { {x y} {x y} ...}. The first +point is number zero. +<p> +<h1><A NAME="setVertices">setVertices</A></h1> +<p> +Set some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + setVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is set using the points +passed in the "points" variable as a string of the form { {x y} {x y} ...}. +If FIRST and NPTS are not specified first is assumed to be zero (the first +point) and NPTS is the length of the points array. +<p> +<h1><A NAME="getRegion">getRegion</A></h1> +<p> +Return as a text string a high level description of the +region defined by a marker. +<p> +Usage: +<p> +<pre> + region = getRegion [unmap] [coord-type] +</pre> +<p> +The output string defines the marker type and the major marker positional +attributes. The region description formats for the various marker types +follow. +<p> +<pre> + text raster x y width height + line raster x y x y + polyline raster npts { {x y} {x y} ...} + rectangle raster x y width height rotangle + circle raster x y radius + ellipse raster x y width height rotangle + polygon raster npts { {x y} {x y} ...} +</pre> +<p> +Here, width and height refer to the distance from the marker center to an +edge, not to the width or height of the whole marker. This avoids +ambiguities about where the edge of a marker is if the width is even or +odd. Using the center to edge measurement, the edge is at x +/- width, +y +/- height. +<p> +If the "unmap" flag is given getRegion will attempt to associate the +marker with a mapped raster, reversing any mappings from the screen back +to the original source raster, and returning the raster number and raster +coordinates and marker sizes. If "unmap" is not given the marker +coordinates will refer to raster 0. Either pixel ("pixel") or NDC +("ndc") coordinates may be returned, pixel coordinates being the default. +<p> +<h1><A NAME="getRect">getRect</A></h1> +<p> +Return the region enclosed by a rectangle marker. The rect is +returned in a form convenient for use as the destination rect in a gterm +widget raster mapping. +<p> +Usage: +<p> +<pre> + getRect dx dy dnx dny +</pre> +<p> +The rect is stored in the output arguments. +<p> diff --git a/vendor/x11iraf/obm/docs/obm/Parameter.html b/vendor/x11iraf/obm/docs/obm/Parameter.html new file mode 100644 index 00000000..fe189fc5 --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/Parameter.html @@ -0,0 +1,107 @@ +<title>UI PARAMETER class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> UI PARAMETER class</h1> +<p> +<HR> +<p> +The UI parameter class is used for client-UI communications. The client +does not control the user interface directly, rather the UI defines a set +of abstract UI parameters, and during execution the client application +assigns values to these parameters. These UI parameters should be thought +of as describing the runtime state of the client as viewed by the GUI. +The GUI is free to interpret this state information in any way, including +ignoring it. Many GUIs can be written which use the same client state +as described by the UI parameters. +<p> +Assigning a value to a UI parameter causes the new value to be stored, and +any parameter action procedures registered by the UI to be called. +The action or actions [if any] taken when a parameter value changes are +arbitrary, e.g. the action might be something as simple as changing a +displayed value of a UI widget, or something more complex like displaying +a popup. +<p> +UI Parameter class commands: +<p> +<pre> + <a href="#getValue">getValue</a> + <a href="#setValue">setValue</a> &lt;new-value&gt; + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#notify">notify</a> +</pre> +<p> +The most common usage is for the GUI to post one or more callbacks for +each UI parameter. When the UI parameter value is changed [with setValue, +e.g. by the client] the GUI callback procedures are called with the old +and new UI parameter values on the command line. addCallback is used to +add a callback procedure, and deleteCallback to delete one. Multiple +callbacks may be registered for a single UI parameter. notify is used +to simulate a parameter value change, causing any callback procedures to +be invoked. +<p> +The callback procedure is called as follows: +<p> +<pre> + user-procedure param-name {old-value} {new-value} +</pre> +<p> +The important thing to note here is that the old and new value strings +are quoted with braces. This prevents any interpretation of the string +by Tcl when the callback is executed, which is necessary because the +strings can contain arbitrary data. When Tcl calls the callback the +first level of braces will be stripped off, leaving old-value and new-value +each as a single string argument. +<p> +<p> +<h2><A NAME="setValue">setValue</A></h2> +<p> +Set the value of a parameter, and notify all clients +via the posted callback procedures that the parameter value has changed. +<p> +Usage: +<p> +<pre> + setValue &lt;new-value&gt; +</pre> +<p> +<h2><A NAME="getValue">getValue</A></h2> +<p> +Get the value of a parameter. +<p> +Usage: +<p> +<pre> + getValue +</pre> +<p> +<h2><A NAME="notify">notify</A></h2> +<p> +Notify the registered clients of a parameter as if the +value had changed. +<p> +Usage: +<p> +<pre> + notify +</pre> +<p> +<h2><A NAME="addCallback">addCallback</A></h2> +<p> +Add a callback procedure to the callback list for +a parameter. +<p> +Usage: +<p> +<pre> + addCallback &lt;procedure-name&gt; +</pre> +<p> +<h2><A NAME="deleteCallback">deleteCallback</A></h2> +<p> +Delete a callback procedure previously registered +for a parameter. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> diff --git a/vendor/x11iraf/obm/docs/obm/Server.html b/vendor/x11iraf/obm/docs/obm/Server.html new file mode 100644 index 00000000..3fdaec2a --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/Server.html @@ -0,0 +1,38 @@ +<title>SERVER class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> SERVER class</h1> +<p> +<HR> +<p> +The server, or object manager, is the control center of the user interface. +The server object provides a Tcl interpreter calling custom object manager +commands. These are used to define and initialize the user interface, and +execute UI action procedures at runtime. +<p> +<pre> + <a href="servercom.html#resetReset">reset-server</a> + <a href="servercom.html#appInitialize">appInitialize</a> appname,appclass,resources + <a href="servercom.html#createObjects">createObjects</a> [resource-name] + <a href="servercom.html#destroyObject">destroyObject</a> object + <a href="servercom.html#activate">activate</a> + <a href="servercom.html#deactivate">deactivate</a> [unmap] +<p> + value = <a href="servercom.html#getResource">getResource</a> resource-name [default-value [class]]</a> + <a href="servercom.html#getResources">getResources</a> resource-list +<p> + <a href="servercom.html#createMenu">createMenu</a> menu-name parent item-list + <a href="servercom.html#createMenu">editMenu</a> menu-name parent item-list + <a href="servercom.html#destroyMenu">destroyMenu</a> menu-name +<p> + <a href="servercom.html#createBitmap">createBitmap</a> name width height data + <a href="servercom.html#createCursor">createCursor</a> name source mask fg_color bg_color x_hot y_hot + <a href="servercom.html#createPixmap">createPixmap</a> name width height depth fg_color bg_color data +<p> + <a href="servercom.html#print">print</a> arg [arg ...] # debug messages + <a href="servercom.html#send">send</a> object message +<p> + <a href="servercom.html#postActivateCallback">postActivateCallback</a> procedure +id = <a href="servercom.html#postTimedCallback">postTimedCallback</a> procedure msec [client-data] + <a href="servercom.html#deleteTimedCallback">deleteTimedCallback</a> id + id = <a href="servercom.html#postWorkCallback">postWorkCallback</a> procedure [client-data] + <a href="servercom.html#deleteWorkCallback">deleteWorkCallback</a> id +</pre> diff --git a/vendor/x11iraf/obm/docs/obm/Widget.html b/vendor/x11iraf/obm/docs/obm/Widget.html new file mode 100644 index 00000000..78d534db --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/Widget.html @@ -0,0 +1,450 @@ +<title>WIDGET class</title> +<h1><IMG SRC="/iraf/web/images/iraf.gif"> WIDGET class</h1> +<p> +<HR> +<p> +The Widget class is the generic or base class for the window system +toolkit widgets supported by the object manager. The Widget class +supports a number of different Xt widget classes using a table driven +approach to describe each widget. Any widget may be created, destroyed, +and manipulated in various ways using only the generic Widget class +procedures and Widget-specific resources. The Widget class may be +subclassed to support complex Widgets that require custom class-specific +commands for use by the GUI code. +<p> +Generic Widget-class commands: +<p> +<pre> + <a href="#set">set</a> &lt;resource-name&gt; &lt;value&gt; + <a href="#get">get</a> &lt;resource-name&gt; +<p> + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; [<callback-name>] + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#setSensitive">setSensitive</a> &lt;sensitive&gt; + <a href="#isSensitive">isSensitive</a> +<p> + <a href="#realize">realize</a> + <a href="#unrealize">unrealize</a> + <a href="#isRealized">isRealizeed</a> + <a href="#map">map</a> + <a href="#unmap">unmap</a> + <a href="#manage">manage</a> child [child ...] + <a href="#unmanage">unmanage</a> child [child ...] + <a href="#popup">popup</a> [grab-kind] + <a href="#popdown">popdown</a> + <a href="#popupSpringLoaded">popupSpringLoaded</a> +<p> + <a href="#move">move</a> &lt;x&gt; &lt;y&gt; + <a href="#resize">resize</a> &lt;width&gt; &lt;height&gt; &lt;border-width&gt; + <a href="#configure">configure</a> &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +The most important Widget commands are set/get resource, and the +callbacks. The widget sensitivity can be set and queried using set/get +resource, but special procedures are provided to make this common operation +more convenient. +<p> +Class specific functions: +<p> +<pre> + <a href="#append">append</a> text # text widget + <a href="#setList">setList</a> list [resize] # list widget + value = <a href="#getItem">getItem</a> itemno + <a href="#highlight">highlight</a> itemno + <a href="#unhighlight">unhighlight</a> +</pre> +<p> +Ideally the widget class should be subclassed for widgets that require +class-specific functions, but in simple cases involving standard widgets +the support is built into the widget class code as a special case. +<p> +Special actions (used in translations): +<p> +<pre> + <a href="#do_userproc">call</a> (proc [,arg, ...]) + <a href="#do_popup">popup</a> (menu-name [xoffset [yoffset]]) + <a href="#do_popdown">popdown</a> (menu-name) +</pre> +<p> +The "call" action is a very general mechanism which allows any GUI procedure +to be registered with any translation using the X translation table +mechanism. The popup and popdown actions are used for popup menus. The +menu will be popped up at the event coordinates plus the optional offsets +if given. +<p> +Event handling: +<p> +<pre> + <a href="#addEventHandler">addEventHandler</a> &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +Event callback: +<p> +<pre> + <a href="#userEventHandler">userEventHandler</a> widget event-type time wx wy rx ry other +</pre> +<p> +In most cases translations are preferable to events, but a GUI can capture +raw events if it wishes by adding event handlers. Nearly all of the X +event types are supported. The callback syntax employs a number of +standard arguments, followed by a number of event-specific arguments. +<p> +<h1><A NAME="addCallback">addCallback</A></h1> +<p> +Add a callback procedure to the callback list for +a widget. If no callback name is given, "callback" is assumed. +<p> +Usage: +<p> +<pre> + addCallback <procedure-name> [&lt;callback-name&gt;] +</pre> +<p> +Specific widgets only support certain types of callbacks. There is no +checking that the callback type specified is supported by a widget; the +wrong type of callback can be registered, but it will never be called. +<p> +<h1><A NAME="deleteCallback">deleteCallback</A></h1> +<p> +Delete a callback procedure previously registered +for a widget. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> +<p> +<h1><A NAME="do_userproc">do_userproc (call)</A></h1> +<p> +Translation action procedure used to call general user +action procedures in the interpreter. The name of the user procedure to +be called is given as the first argument in the translation. For example, +the translation "call(foo,a,b,c)" would cause procedure foo to be called +with the arguments (a,b,c). The following arguments are special: +<p> +<pre> + Argument Replaced by +<p> + $name object name of widget + $time event->time + $x event->x + $y event->y + $x_root event->x_root + $y_root event->y_root +</pre> +<p> +The "user procedure" can be any server procedure. +<p> +<h1><A NAME="do_popup">do_popup</A></h1> +<p> +Popup a menu (or other spring loaded popup) at the location +of the event which triggered this action. +<p> +Usage: +<p> +<pre> + popup(menu-name [xoffset [yoffset]]) +</pre> +<p> +<h1><A NAME="do_popdown">do_popdown</A></h1> +<p> +Pop down a menu. +<p> +Usage: +<p> +<pre> + popdown(menu-name) +</pre> +<p> +<h1><A NAME="set">set</A></h1> +<p> +Set a widget resource. +<p> +Usage: +<p> +<pre> + set &lt;resource-name&gt; &lt;value&gt; +</pre> +<p> +<h1><A NAME="get">get</A></h1> +<p> +Get a widget resource value as a string. +<p> +Usage: +<p> +<pre> + get &lt;resource-name&gt; +</pre> +<p> +<h1><A NAME="append">append</A></h1> +<p> +Append data to a text widget. +<p> +Usage: +<p> +<pre> + append &lt;text&gt; +</pre> +<p> +<h1><A NAME="setList">setList</A></h1> +<p> +Set the item list of a list widget. +<p> +Usage: +<p> +<pre> + setList list [resize] +</pre> +<p> +The list is a simple list of strings, passed as a single string argument to +setList (quotes, braces, etc. may be used to quote strings containing +special characters). +<p> +<h1><A NAME="getItem">getItem</A></h1> +<p> +Get an item in a list widget. +<p> +Usage: +<p> +<pre> + value = getItem itemno +</pre> +<p> +If ITEMNO is a number the indicated list item is returned, or the string +"EOF" if the requested item is beyond the end of the list. Otherwise the +currently selected item is returned, and the index of the item is returned +in the output variable ITEMNO. If no item is currently selected ITEMNO +will be set to "none" on output. +<p> +<h1><A NAME="highlight">highlight</A></h1> +<p> +Highlight an item in a list widget. +<p> +Usage: +<p> +<pre> + highlight itemno +</pre> +<p> +The indicated item of the list is highlighted as if the item had been +selected by the user. Any previously highlighted item is unhighlighted. +<p> +<h1><A NAME="unhighlight">unhighlight</A></h1> +<p> +Unhighlight the currently highlighted item in a +list widget. +<p> +Usage: +<p> +<pre> + unhighlight +</pre> +<p> +Any currently highlighted item in the list widget is unhighlighted. +<p> +<h1><A NAME="realize">realize</A></h1> +<p> +Realize a widget. This activates and assigns windows for +a widget and all of its descendants. Realizing a widget does not in itself +cause it to appear on the screen. +<p> +Usage: +<p> +<pre> + realize +</pre> +<p> +<h1><A NAME="unrealize">unrealize</A></h1> +<p> +Unrealize a widget. This destroys the windows assigned +to a widget and all of its descendants. +<p> +Usage: +<p> +<pre> + unrealize +</pre> +<p> +<h1><A NAME="isRealized">isRealized</A></h1> +<p> +Test whether a widget is realized. +<p> +Usage: +<p> +<pre> + isRealized +</pre> +<p> +<h1><A NAME="map">map</A></h1> +<p> +Map a widget. +<p> +Usage: +<p> +<pre> + map +</pre> +<p> +<h1><A NAME="unmap">unmap</A></h1> +<p> +Unmap a widget. +<p> +Usage: +<p> +<pre> + unmap +</pre> +<p> +<h1><A NAME="manage">manage</A></h1> +<p> +Manage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Managing the +children makes them appear in the window, possibly causing the other +children to be rearranged in the window. +<p> +Usage: +<p> +<pre> + manage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h1><A NAME="unmanage">unmanage</A></h1> +<p> +Unmanage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Unmanaging the +children makes them disappear from the window and be removed from geometry +management, possibly causing the other children to be rearranged in the +window. +<p> +Usage: +<p> +<pre> + unmanage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h1><A NAME="popup">popup</A></h1> +<p> +Popup a shell widget. If no grab is indicated the popup +can remain up while other windows accept input. +<p> +Usage: +<p> +<pre> + popup [grab-kind] +</pre> +<p> +<h1><A NAME="popdown">popdown</A></h1> +<p> +Popdown a shell widget. +<p> +Usage: +<p> +<pre> + popdown +</pre> +<p> +<h1><A NAME="popupSpringLoaded">popupSpringLoaded</A></h1> +<p> +Popup a shell widget, e.g., a popup menu. +This implies an exclusive grab. +<p> +Usage: +<p> +<pre> + popupSpringLoaded +</pre> +<p> +<h1><A NAME="move">move</A></h1> +<p> +Move a widget to the given window relative coordinates. +<p> +Usage: +<p> +<pre> + move &lt;x&gt; &lt;y&gt; +</pre> +<p> +<h1><A NAME="resize">resize</A></h1> +<p> +Resize a widget. +<p> +Usage: +<p> +<pre> + resize &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h1><A NAME="configure">configure</A></h1> +<p> +Configure a widget, i.e., execute a simultaneous +move and resize. +<p> +Usage: +<p> +<pre> + configure &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h1><A NAME="setSensitive">setSensitive</A></h1> +<p> +Set the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + setSensitive &lt;sensitive&gt; +</pre> +<p> +<h1><A NAME="isSensitive">isSensitive</A></h1> +<p> +Test the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + isSensitive +</pre> +<p> +<h1><A NAME="addEventHandler">addEventHandler</A></h1> +<p> +Add a custom event handler to a widget. A list +of event masks is given to define the classes of events the user supplied +event handling procedure is to receive. +<p> +Usage: +<p> +<pre> + addEventHandler &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +<h1><A NAME="removeEventHandler">removeEventHandler</A></h1> +<p> +Remove an event handler previously posted +with addEventHandler, above. +<p> +Usage: +<p> +<pre> + removeEventHandler procname +</pre> +<p> +<h1><A NAME="event">event</A></h1> +<p> +Generic event handler called when a widget event handler +posted by addEventHandler is called. +<p> +The user event handler is called as +<p> +<pre> + userEventHandler widget event-type time wx wy rx ry other +</pre> +<p> +where "other" is an event-type specific list of fields describing the +the event. diff --git a/vendor/x11iraf/obm/docs/obm/alphabetic.html b/vendor/x11iraf/obm/docs/obm/alphabetic.html new file mode 100644 index 00000000..0c141617 --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/alphabetic.html @@ -0,0 +1,39 @@ +<title>Alphabetized list of GUI commands</title> +<IMG SRC="/iraf/web/projects/x11iraf/docs/gui.doc/blueline.gif"> +<pre> +<a href="gtermclass.html#activate">activate</a> <a href="servercom.html#activate">activate</a> <a href="notyet.html">activeMapping</a> <a href="gmc.html#addCallback">addCallback</a> <a href="gtermclass.html#addCallback">addCallback</a> +<a href="uiparameterclass.html#addCallback">addCallback</a> <a href="widgetclass.html#addCallback">addCallback</a> <a href="widgetclass.html#addEventHandler">addEventHandler</a> <a href="widgetclass.html#append">append</a> <a href="servercom.html#appInitialize">appInitialize</a> +<a href="notyet.html">assignRaster</a> <a href="gtermclass.html#bell">bell</a> <a href="widgetclass.html#do_userproc">call</a> <a href="gtermclass.html#clearScreen">clearScreen</a> <a href="widgetclass.html#configure">configure</a> +<a href="notyet.html">copyPixmap</a> <a href="notyet.html">copyRaster</a> <a href="servercom.html#createBitmap">createBitmap</a> <a href="servercom.html#createCursor">createCursor</a> <a href="gtermclass.html#createMarker">createMarker</a> +<a href="servercom.html#createMenu">createMenu</a> <a href="servercom.html#createObjects">createObjects</a> <a href="notyet.html">createPixmap</a> <a href="servercom.html#createPixmap">createPixmap</a> <a href="notyet.html">createRaster</a> +<a href="gtermclass.html#deactivate">deactivate</a> <a href="servercom.html#deactivate">deactivate</a> <a href="uiparameterclass.html#deleteCallback">deleteCallback</a> <a href="widgetclass.html#deleteCallback">deleteCallback</a> <a href="servercom.html#deleteTimedCallback">deleteTimedCallback</a> +<a href="servercom.html#deleteWorkCallback">deleteWorkCallback</a> <a href="gmc.html#destroy">destroy</a> <a href="servercom.html#destroyMenu">destroyMenu</a> <a href="servercom.html#destroyObject">destroyObject</a> +<a href="notyet.html">destroyRaster</a> <a href="notyet.html">disableMapping</a> <a href="notyet.html">drawAlphaText</a> <a href="notyet.html">drawDialogText</a> <a href="notyet.html">drawMarker</a> +<a href="notyet.html">drawPolygon</a> <a href="notyet.html">drawPolyline</a> <a href="notyet.html">drawPolymarker</a> <a href="servercom.html#createMenu">editMenu</a> <a href="notyet.html">enableMapping</a> +<a href="ximclient.html#encodewcs">encodewcs</a> <a href="notyet.html">endDialog</a> <a href="notyet.html">eraseDialog</a> <a href="ximclient.html#fitFrame">fitFrame</a> <a href="gtermclass.html#flip">flip</a> +<a href="ximclient.html#flip">flip</a> <a href="gtermclass.html#flush">flush</a> <a href="notyet.html">freeColormap</a> <a href="notyet.html">freeMapping</a> <a href="clientclass.html#gcmd">gcmd</a> +<a href="gmc.html#getAttribute">get</a> <a href="widgetclass.html#get">get</a> <a href="notyet.html">getAlphaTextSize</a> <a href="gmc.html#getAttribute">getAttribute</a> +<a href="gmc.html#getAttributes">getAttributes</a> <a href="gtermclass.html#getCursorPos">getCursorPos</a> <a href="notyet.html">getDialogTextSize</a> <a href="ximclient.html#getFrame">getFrame</a> +<a href="widgetclass.html#getItem">getItem</a> <a href="notyet.html">getLogRes</a> <a href="gtermclass.html#getMapping">getMapping</a> <a href="notyet.html">getPhysRes</a> <a href="gtermclass.html#getPixel">getPixel</a> +<a href="gtermclass.html#getRaster">getRaster</a> <a href="gmc.html#getRect">getRect</a> <a href="gmc.html#getRegion">getRegion</a> <a href="servercom.html#getResource">getResource</a> <a href="servercom.html#getResources">getResources</a> +<a href="uiparameterclass.html#getValue">getValue</a> <a href="gmc.html#getVertices">getVertices</a> <a href="clientclass.html#gkey">gkey</a> <a href="widgetclass.html#highlight">highlight</a> <a href="notyet.html">initMappings</a> +<a href="widgetclass.html#isRealized">isRealized</a> <a href="widgetclass.html#isSensitive">isSensitive</a> <a href="clientclass.html#literal">literal</a> <a href="gtermclass.html#loadColormap">loadColormap</a> <a href="gmc.html#lower">lower</a> +<a href="gmc.html#makeCopy">makeCopy</a> <a href="widgetclass.html#manage">manage</a> <a href="widgetclass.html#map">map</a> <a href="gtermclass.html#markerInit">markerInit</a> <a href="gmc.html#markpos">markpos</a> +<a href="ximclient.html#matchFrames">matchFrames</a> <a href="gmc.html#move">move</a> <a href="widgetclass.html#move">move</a> <a href="notyet.html">nextColormap</a> <a href="ximclient.html#nextFrame">nextFrame</a> +<a href="gtermclass.html#nextMapping">nextMapping</a> <a href="notyet.html">nextRaster</a> <a href="gmc.html#notify">notify</a> <a href="uiparameterclass.html#notify">notify</a> <a href="notyet.html">nRasters</a> +<a href="ximclient.html#pan">pan</a> <a href="widgetclass.html#do_popdown">popdown</a> <a href="widgetclass.html#popdown">popdown</a> <a href="widgetclass.html#do_popup">popup</a> <a href="widgetclass.html#popup">popup</a> +<a href="widgetclass.html#popupSpringLoaded">popupSpringLoaded</a> <a href="servercom.html#postActivateCallback">postActivateCallback</a> <a href="servercom.html#postTimedCallback">postTimedCallback</a> +<a href="servercom.html#postWorkCallback">postWorkCallback</a> <a href="ximclient.html#prevFrame">prevFrame</a> <a href="servercom.html#print">print</a> <a href="notyet.html">queryRaster</a> +<a href="ximclient.html#Quit">Quit</a> <a href="gmc.html#raise">raise</a> <a href="gtermclass.html#rasterInit">rasterInit</a> <a href="notyet.html">readColormap</a> <a href="gtermclass.html#readPixels">readPixels</a> +<a href="widgetclass.html#realize">realize</a> <a href="gmc.html#redraw">redraw</a> <a href="notyet.html">refreshMapping</a> <a href="notyet.html">refreshPixels</a> <a href="servercom.html#resetReset">reset-server</a> +<a href="gtermclass.html#reset">reset</a> <a href="gmc.html#resize">resize</a> <a href="widgetclass.html#resize">resize</a> <a href="ximclient.html#retCursorVal">retCursorVal</a> <a href="gmc.html#rotate">rotate</a> +<a href="gtermclass.html#selectRaster">selectRaster</a> <a href="servercom.html#send">send</a> <a href="gmc.html#setAttribute">set</a> <a href="widgetclass.html#set">set</a> <a href="gmc.html#setAttribute">setAttribute</a> +<a href="gmc.html#setAttributes">setAttributes</a> <a href="notyet.html">setColorIndex</a> <a href="ximclient.html#setColormap">setColormap</a> <a href="gtermclass.html#setCursorPos">setCursorPos</a> <a href="gtermclass.html#setCursorType">setCursorType</a> +<a href="notyet.html">setDataLevel</a> <a href="notyet.html">setFillType</a> <a href="ximclient.html#setFrame">setFrame</a> <a href="gtermclass.html#setGterm">setGterm</a> <a href="notyet.html">setLineStyle</a> +<a href="notyet.html">setLineWidth</a> <a href="widgetclass.html#setList">setList</a> <a href="notyet.html">setLogRes</a> <a href="gtermclass.html#setMapping">setMapping</a> <a href="notyet.html">setPhysRes</a> +<a href="gtermclass.html#setPixel">setPixel</a> <a href="gtermclass.html#setRaster">setRaster</a> <a href="widgetclass.html#setSensitive">setSensitive</a> <a href="notyet.html">setTextRes</a> <a href="uiparameterclass.html#setValue">setValue</a> +<a href="gmc.html#setVertices">setVertices</a> <a href="notyet.html">startDialog</a> <a href="widgetclass.html#unhighlight">unhighlight</a> <a href="widgetclass.html#unmanage">unmanage</a> <a href="widgetclass.html#unmap">unmap</a> +<a href="gtermclass.html#unmapPixel">unmapPixel</a> <a href="widgetclass.html#unrealize">unrealize</a> <a href="widgetclass.html#userEventHandler">userEventHandler</a> <a href="ximclient.html#windowColormap">windowColormap</a> +<a href="notyet.html">writeColormap</a> <a href="gtermclass.html#writePixels">writePixels</a> <a href="ximclient.html#zoom">zoom</a> <a href="ximclient.html#zoom">zoomAbs</a> +</pre> + diff --git a/vendor/x11iraf/obm/docs/obm/index.html b/vendor/x11iraf/obm/docs/obm/index.html new file mode 100644 index 00000000..b7e531ca --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/index.html @@ -0,0 +1,2515 @@ +<html> +<body bgcolor=#FFFFFF> +<title>IRAF Object Manager Tutorial</title> + +<center> +<h1>IRAF Object Manager Tutorial</h1> +</center> +<hr noshade=5> + +<h2>Contents</h2> +<ul> +<li><a href="#1">1. Introduction</a> +<li><a href="#2">2. System Architecture</a> +<li><a href="#3">3. The Client Process</a> + <ul> + <li><a href="#3.1">3.1 IRAF Graphics Task</a> + <ul> + <li><a href="#3.1.1">3.1.1 XGterm</a> + </ul> + <li><a href="#3.2">3.2 Standalone Task</a> + <li><a href="#3.3">3.3 OBM Shell</a> + <li><a href="#3.4">3.4 Named External Clients</a> + </ul> +<li><a href="#4">4. UI Definition File</a> + <ul> + <li><a href="#4.1">4.1 Example Interface</a> + </ul> +<li><a href="#5">5. Widget Toolkit</a> +<li><a href="#6">6. Object Classes</a> + <ul> + <li><a href="#6.1">6.1 Client</a> + <ul> + <li><a href="#6.1.1">6.1.1 Command Summary</a> + </ul> + <li><a href="#6.2">6.2 Server</a> + <ul> + <li><a href="#6.2.1">6.2.1 Command Summary</a> + </ul> + <li><a href="#6.3">6.3 Gterm</a> + <ul> + <li><a href="#6.3.1">6.3.1 Command Summary</a> + </ul> + <li><a href="#6.4">6.4 HTML</a> + <ul> + <li><a href="#6.4.1">6.4.1 Command Summary</a> + </ul> + <li><a href="#6.5">6.5 Markers</a> + <ul> + <li><a href="#6.5.1">6.5.1 Command Summary</a> + </ul> + <li><a href="#6.6">6.6 Widget</a> + <ul> + <li><a href="#6.6.1">6.6.1 Command Summary</a> + </ul> + <li><a href="#6.7">6.7 Parameter</a> + <ul> + <li><a href="#6.7.1">6.7.1 Command Summary</a> + </ul> + </ul> +</ul> + +<hr noshade=5> + +<a name="1"></a> +<h3>1. Introduction</h3> +<p> +An Object Manager (OBM) user interface (UI) consists of one or more windows +containing an arbitrary hierarchy of widgets. These widgets and their +runtime actions are defined by an interpreted text program uploaded +by the client application, which does not itself deal directly with the +window user interface. This interpreted program is currently written +as a Tcl script. +<p> +The OBM provides a high level abstraction for dealing with widgets and +other UI objects. The main function of the object manager is to deliver +messages to UI objects. Each instance of a widget is an object in the +interface. The UI contains other types of objects as well, including the +client object (client application), the server object (the object manager +itself), and the application specific UI parameters, each of which is an +object with a callback list of procedures to be called when the parameter +value changes. All of these UI objects can receive messages and take actions +as a result. Messages may come from the client application, or as a result +of actions executed by the interpreted UI code in response to graphics events. +<hr noshade=5> +<p> +<a name="2"></a> +<h3>2. System Architecture</h3> +<p> +For a complete description of the OBM system architecture see Tody, D, +ADASS Proceedings 1994. A <a href="todyd.ps">postscript version of this +paper</a> is also vailable. +<p> +<hr noshade=5> +<p> +<a name="3"></a> +<h3>3. The Client Process</h3> +<p> + The primary advantage of the OBM architecture over traditional GUI +design is the separation of the user interface from the executable client +code, meaning that either can be completely rewritten or developed separately +without affecting the other so long as the messaging between the two +remains the same. The client itself is responsible for initializing the OBM +toolkit and uploading the UI definition file, after that it usually enters +an event loop of some kind (e.g. an iraf graphics cursor loop, or X event +handler) to process actions defined in the client callbacks. +<p> + It's important that the client program maintain the state of the +application rather than the UI file. For example, a text widget in the +interface may instruct the client to load a file, however if this cannot +be done the interface should not have independently reset labels or +whatever assuming the action was done at all. Instead, the client program +uses the Parameter Class objects in the interface to update the state of +the GUI as a result of some action (whose origins may not have been in the +GUI at all). So for example a sequence of events could be something like + +<ul><ul> +<li> User selects a widget in the interface, it's callback sends a + message to the client directing some action be taken +<li> Client receives the message and performs an action in the client +<li> If action fails, (optionally) notify GUI of failure (e.g. send a + message to an 'alert' parameter to popup a dialog box, beep the + terminal, etc) +<li> If action succeeds, notify GUI of new state (e.g. send a message + to the 'filename' Parameter object containing the new file name). +<li> Callback on the 'filename' parameter then updates the status bar + widget with the name of the new active file. +</ul></ul> + +<p> + The messaging between the client and UI depend on the details of how +the client is implemented. In general any callback procedure in the UI can +send a message to any other object in the interface, but the client should +generally communicate only via the Parameter objects to avoid side effects +and maintain a clear separation between the UI and the client code. + +<a name="3.1"></a> +<h3>3.1 IRAF Graphics Task</h3> + +<a name="3.1.1"></a> +<h3>3.1.1 XGterm</h3> + +<a name="3.2"></a> +<h3>3.2 Standalone Task</h3> + +<a name="3.3"></a> +<h3>3.3 OBM Shell</h3> +<p> + The <i>obmsh</i> is a unix shell interpreter for GUI scripts. It is +a minimal standalone client with a single callback to exit the application, +otherwise it's only job is to activate the GUI file. Any messages sent to +the client (except a 'quit') are simply absorbed by the client +<p> + Despite the apparent lack of functionality this is sometimes all +that is required for an interface that can operate independently. Remember +that the Tcl scripting language has it's own facilities for file I/O, +process execution, etc, all of which are still available in the GUI. In +the case of IRAF tasks it's an interface violation to use these facilities +directly, however they still allow for the easy creation of a GUI which +requires no real underlying client (e.g. a tcl debug shell, a calculator +application, task launcher, etc). + +<a name="3.4"></a> +<h3>3.4 Named External Clients</h3> + +<p> +<p> +<hr noshade=5> +<p> +<a name="4"></a> +<h3>4. UI Definition File</h3> +<p> +A UI definition consists of a sequence of commands to be executed by the +server object using Tcl is used as an embedded interpreter within the OBM. +The Tcl script contains several required OBM-specific functions (in +addition to the user-defined callbacks) which is uploaded by the client +as a message for the server object. +<pre> + <a href="#resetReset">reset-server</a> + <a href="#appInitialize">appInitialize</a> appName appClass Resources + <a href="#createObjects">createObjects</a> [name] + <a href="#activate">activate</a> +</pre> +<p> +All UI files must begin with a <b>reset-server</b> command to initialize +the OBM. An <b>appInitialize</b> call is then made to define all of the +widgets and resources used in the interface, initializing the interface +used by the application. The <b>createObjects</b> function then actually +creates the widgets in the server, more specifically it creates the widgets +defined by the named <i>objects</i> resource. Lastly, the <b>activate</b> +call is used to activate the interface, i.e. put it on the screen. + +<p> +<a name="4.1"></a> +<h3>4.1 Example</h3> +A complete "hello, world" GUI definition might look something like: +<pre> + 1) <b>reset-server</b> + 2) <b>appInitialize</b> <i>hello Hello</i> { + 3) *objects:\ + 4) toplevel Form helloForm\ + 5) helloForm Label helloLabel\ + 6) helloForm Command quitButton + 7) + 8) *background: gray + 9) *helloLabel.label: Hello, world! + 10) *quitButton.fromHoriz: helloLabel + 11) *quitButton.label: Quit + 12) } + 13) + 14) <b>createObjects</b> + 15) <b>activate</b> + 16) + 17) <b>proc</b> Quit <b>args</b> { + 18) <b>send client gkey</b> q + 19) <b>deactivate unmap</b> + 20) } ; <b>send</b> quitButton <b>addCallback</b> Quit +</pre> + +where a line-by-line analysis of the GUI shows: + +<dl> +<dt>Line 1: <dd>- The <b>reset-server</b> command must be the first line in +the UI file since it's primary purpose is to initialize the OBM (i.e. a +call to the <i>ObmInitialize()</i> procedure). Subsequent calls (in the +same UI file or a different UI) are effectively a no-op. +<dt>Lines 2-12: <dd>- The <b>appInitialize</b> command defines the widgets +and resources to be used in the interface. The first argument gives the +name of the application, the second argument is the application class name +for purposes of specifying resources in the environment, and the last +argument is a Tcl list (hence the braces) of resources for the application. +<p> +The primary purpose of the call is to initialize the X11 part of the system +by defining the application context and the list of fallback resources. The +<i>objects</i> resource is a required element listing the widget hierarchy +to be used. Remaining resources are used to specify labels, colors, layout, +etc and serve as an app-defaults file for the GUI, interacting with the +normal resource database in the usual way. For example, a user's .Xdefaults +file may specify a "<b>font</b>" resource, unless this is overridden in +some way in the UI file this is the font that will be used. Resources may +be specified with either "loose" (i.e. the '*') or "tight" (i.e. the '.') +bindings with as much detail as is needed. +<dt>Line 14: <dd>- The <b>createObjects</b> command is what actually calls +each widget's Initialize() method to create the widget in the application +and in the X11 server. +<p> +With no argument, the default value used is simply +the <b>objects</b> resource. However, it's possible to specify a named +argument and make repeated calls to <b>createObjects</b> to build any number +widget trees prior to activating the interface. This can be useful for +example to specify a "main_objects" resource contains all the widgets for +the main panel, and a "help_objects" specfiying widgets used for the UI +help panel, which makes the definition file easier to organize. In the +past however UI files were written with a single long list (easily many +hundreds of lines) of objects followed by an even longer list of their +resources under a single <b>appInitialize</b> call, creating a monolithic +and unmanageably GUI definition file. Later on we'll see how complex GUIs +can be divided into separate pieces making it easier to reuse code and +manage the interface more efficiently. +<dt>Line 15: <dd>- The <b>activate</b> command is what creates the interface +on the screen, i.e. it calls the Realize() method for each widget to +instantiate it in the server and draw the window. +<dt>Lines 17-19: <dd>- Lastly we have the user-defined callback procedures. +On line 17 we define a procedure <i>Quit</i> which we use to shut down the +interface and client application. The body of the procedure first sends the +client object the graphics keystroke 'q' to shut down the client, then calls +the <b>deactivate</b> command to close the interface. On the last line +we send a message to the <i>quitButton</i> widget telling it to add this +procedure to it's callback list, so when the Button is selected this +procedure will be called as a result. +</dl> +<p> +<hr noshade=6> + +<a name="5"></a> +<h3>5. Widget Toolkit</h3> +<p> +<p> +<hr noshade=6> + +<a name="6"></a> +<h3>5. Object Classes</h3> +<p> +The following OBM object classes are currently defined: +<pre> + <a href="#6.1">Client</a> The Client application + <a href="#6.2">Server</a> The OBM itself + <a href="#6.3">Gterm</a> Gterm graphics/imaging widget class + <a href="#6.4">HTML</a> HTML widget class + <a href="#6.5">Markers</a> Gterm markers class + <a href="#6.6">Widget</a> General widget class + <a href="#6.7">Parameter</a> UI Parameter class +<p> + Various Xt and Athena widgets + <i>{box, shell, label, command, text, list, etc.}</i> + Misc Other X11 Widgets + <i>{Layout, Tabs, ListTree, etc}</i> +</pre> +<p> +OBM client applications will upload a UI during initialization to define a +custom graphics user interface. This is done by sending a message to the +object manager. Non-GUI applications assume a simple graphics +terminal and do not upload a UI; instead, a default UI is created +for the application consisting of a single top level shell containing a +Gterm (Tek 4012 graphics/imaging) widget. +<p> + +<hr noshade=5> + +<a name="5.1"></a> +<h3>5.1 Client</h3> +<p> +The client is the client application, which provides the functionality +underlying the UI. When a message is sent to the client object it usually +results in a message being sent to the client *application*, usually an +external program communicating via IPC, which has little or no knowledge +of the UI. The client application receives and executes commands delivered +by the UI via the client object. Output from the client may or may not +come back to the object manager. That portion of the output which comes +back to the object manager is in the form of assignments of string values +to <a href="#5.7.html">UI Parameter class objects</a> (another way of thinking +of this is that messages or events are sent to and acted upon by the parameter +objects). Hence, the client object is output only so far as the client +application is concerned. +<p> +The Client-class commands are used to send a message to the client. +<p> +<pre> + <a href="#gkey">gkey</a> &lt;key&gt; + <a href="#gcmd">gcmd</a> &lt;command-string&gt; + <a href="#literal">literal</a> &lt;command&gt; +</pre> +<p> +or just &lt;command&gt;, e.g., "send client &lt;command&gt;" will work in most cases. +<p> +<a href="#gkey">GKEY</a> sends an IRAF graphics keystroke. +<a href="#gcmd">GCMD</a> sends an +IRAF graphics colon command. <a href="#literal">LITERAL</a> sends a literal +command string to the +client. The keyword "literal" may optionally be omitted, i.e., "send client +foo" and "send client literal foo" are the same. The keyword "literal" may +be used to ensure that the client command string which follows will not +be interpreted as a Client-class command (such as gkey, gcmd, or literal). +<p> +<a name="5.1.1"></a> +<h2>5.1.1 Command Summary</h2> +<p> +<h3><A NAME="gcmd">gcmd</A></h3> +<p> +Send a graphics command string to the client application. +A graphics command string is a graphics cursor value with the key set +to `:' and the command string given as the string part of the cursor +value. The protocol module which posted the client output procedure is +responsible for encoding and sending the cursor command. +<p> +Usage: +<p> +<pre> + gcmd &lt;command-string&gt; +</pre> +<p> +<h3><A NAME="gkey">gkey</A></h3> +<p> +Send a graphics key event to the client application. +A graphics key event is a graphics cursor value with the key set to some +integer value and a null string part. +<p> +Usage: +<p> +<pre> +gkey &lt;key&gt; +</pre> +<p> +<h3><A NAME="literal">literal</A></h3> +<p> +Send a literal command to the client application. +<p> +Usage: +<p> +<pre> + literal &lt;command&gt; +</pre> + +<hr noshade=5> + +<a name="6.2"></a> +<h3>6.2 Server</h3> +<p> +The server, or object manager, is the control center of the user interface. +The server object provides a Tcl interpreter calling custom object manager +commands. These are used to define and initialize the user interface, and +execute UI action procedures at runtime. +<p> +<pre> + <a href="#resetReset">reset-server</a> + <a href="#appInitialize">appInitialize</a> appname,appclass,resources + <a href="#createObjects">createObjects</a> [resource-name] + <a href="#destroyObject">destroyObject</a> object + <a href="#activate">activate</a> + <a href="#deactivate">deactivate</a> [unmap] +<p> + value = <a href="#getResource">getResource</a> resource-name [default-value [class]]</a> + <a href="#getResources">getResources</a> resource-list +<p> + <a href="#createMenu">createMenu</a> menu-name parent item-list + <a href="#createMenu">editMenu</a> menu-name parent item-list + <a href="#destroyMenu">destroyMenu</a> menu-name +<p> + <a href="#createBitmap">createBitmap</a> name width height data + <a href="#createCursor">createCursor</a> name source mask fg_color bg_color x_hot y_hot + <a href="#createPixmap">createPixmap</a> name width height depth fg_color bg_color data +<p> + <a href="#print">print</a> arg [arg ...] # debug messages + <a href="#send">send</a> object message +<p> + <a href="#postActivateCallback">postActivateCallback</a> procedure +id = <a href="#postTimedCallback">postTimedCallback</a> procedure msec [client-data] + <a href="#deleteTimedCallback">deleteTimedCallback</a> id + id = <a href="#postWorkCallback">postWorkCallback</a> procedure [client-data] + <a href="#deleteWorkCallback">deleteWorkCallback</a> id +</pre> + +<a name="6.2.1"></a> +<h2>6.2.1 Command Summary</h2> +<p> +<h3><A NAME="serverReset">serverReset</A></h3> +<p> +The "reset-server" command is implemented as a special case in ServerEvaluate. +After doing a true reset ServerEvaluate calls Tcl_Eval to evaluate the full +message which still contains the reset-server command. We want to ignore +this the second time, so we treat the command here as a no-op. +<p> +Usage: +<p> +<pre> + reset-server +</pre> +<p> +Note: for reset-server to be recognized by ServerEvaluate and really reset +things, it must be the first command in a message to the server. +<p> +<h3><A NAME="appInitialize>appInitialize</A></h3> +<p> +TCL command to initialize the server for a new application, setting the +application name and loading the application resources. +<p> +Usage: +<p> +<pre> + appInitialize appname, appclass, resources +</pre> +<p> +<h3><A NAME ="createObjects">createObjects</A></h3> +<p> +TCL command to create the tree of UI objects comprising the user interface. +The object tree is defined by a string valued resource. If no resource is +named the default "objects" resource will be used. +<p> +Usage: +<p> +<pre> + createObjects [resource-name] +</pre> +<h3><A NAME="destroyObject">destroyObject</A></h3> +<p> +Destroy an object and all of its children. +<p> +Usage: +<pre> + destroyObject object-name +</pre> +<p> +<h3><A NAME="activate">activate</A></h3> +Activate the user interface. When called the first time the user interface +is created and activated, thereafter the UI is merely reactivated (e.g. +mapped if unmapped). +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h3><A NAME="deactivate">deactivate</A></h3> +<p> +Deactivate the user interface. Optionally unmaps the UI and calls the Obm +client back to let it know that the UI has been deactivated. +<p> +Usage: +<p> +<pre> + deactivate [unmap] +</pre> +<p> +<h3><A NAME="getResource">getResource</A></h3> +<p> +Get the string value of the specified application resource (window +system parameter). This allows use of the resource mechanism to supply +default values for GUI parameters. +<p> +Usage: +<p> +<pre> + value = getResource resource-name [class [default-value]] +</pre> +<p> +In the simplest case one merely requests a resource by name and the +string value is returned as the function value. If the resource has +an entry in the fallback resources for the application (appInitialize +resource list) then a value is guaranteed to be returned. +<p> +If the Class name for the resource is given then a class default value +will be returned if no entry is found for the name resource instance. This +is useful when there are a number of resources of the same type (same class). +If most or all resources in the same class have the same default value one +need only make one entry for the Class in the application defaults resource +list. It is up to the application developer to define the class name of a +resource - the class name can be any string. Examples are "Font", "Cursor", +etc. By convention the first character of a class name is capitalized, while +instance names begin with a lower case letter. +<p> +If there is an entry for the named resource in the resource list passed to +appInitialize then a value string is guaranteed to be returned. This will be +either the appInitialize default, or a value specified by the system or the +user in an X resources file. If one is not certain a default value is defined +somewhere, a default value should be specified in the getResource call as +shown above. +<p> +See also getResources, used to get multiple resources in one call. +<p> +<h3><A NAME="getResources">getResources</A></h3> +<p> +Get the string values of a list of resources. +<p> +Usage: +<p> +<pre> + getResources resource-list +</pre> +<p> +e.g. +<pre> + getResources { + { resource [variable class [default-value]]] } + { resource [variable class [default-value]]] } + (etc.) + } +</pre> +<p> +<h3><A NAME="createMenu">createMenu, editMenu</A></h3> +<p> +Create or modify a menu. The editMenu function is an alias for createMenu. +<p> +Usage: +<pre> + createMenu menu-name parent item-list +</pre> +<p> +e.g., +<pre> + createMenu menu-name parent { + { label function data [options...] } + { label function data [options...] } + (etc.) + } +</pre> +<p> +where +<p> +<pre> + menu-name is the object name for the menu popup shell + parent is the parent widget of the menu shell + label is a menu item label + function is the function to be performed when the menu + item is selected, e.g., f.exec, f.data, f.space, or f.line. + data is function dependent data + options are option-name option-value pairs, as specified + below. +</pre> +<p> +In the item list the fields label and option-value may be any Tcl expression. +Expressions are evaluated in the server context. The data field is a Tcl +script to be executed when the menu item is selected. +<p> +Options are specified as "option option-value". The menu item options are +as follows. +<p> +<pre> + bitmap A bitmap to be displayed left justified in the label field + (e.g. to indicate a parameter setting). + sensitive Specifies whether the menu item is active (sensitive=true) + or inactive (sensitive=false, item grayed out). + accelerator Specifies an input translation (accelerator, e.g., + keyboard event) which can be used to execute the + menu item. +</pre> +<p> +The option-value field may be any Tcl expression. +<p> +Example: +<p> +<pre> + createMenu fileMenu toplevel { + { "File Menu" f.title} + { Open f.exec openFile} + { Save f.exec saveFile} + { Load f.menu loadMenu} + { no-label f.line } + { Quit f.exec "send client Quit" } + } +</pre> +<p> +The first createMenu is called for a given menu the menu is created, added +to the menu list, and all window system widgets are created for the menu. +Subsequent calls will result in only the changed parts of the menu being +altered provided the changes are not great. Hence this routine can be called +to efficiently modify a menu when minor runtime changes occur, e.g., an +item label or action changes, the item value changes state, and so on, +without need for the GUI code to know how to make the necessary detailed +changes to the widgets used to implement the menu. +<p> +<h3><A NAME="destroyMenu">destroyMenu</A></h3> +<p> +Destroy a menu. This can be used to free up the resources used by a +menu, e.g., if the menu is not expected to be needed again for a while. +<p> +Usage: +<p> +<pre> + destroyMenu menu-name +</pre> +<p> +<h3><A NAME="createBitmap">createBitmap</A></h3> +<p> +Create a named bitmap. This replaces any old bitmap of the same name. The +new bitmap is cached in server memory; when a widget bitmap resource is set, +the bitmap cache will be searched for the named bitmap before asking Xlib +to find the bitmap. +<p> +Usage: +<p> +<pre> + createBitmap name width height data +</pre> +<p> +e.g., +<p> +<pre> + createBitmap foo 16 16 { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +<p> +<h3><A NAME="createCursor">createCursor</A></h3> +<p> +Create a cursor from bitmap data. The cursor is entered into the server's +cursor cache and will override any existing entry of the same name. +<p> +Usage: +<p> +<pre> + createCursor name source mask fg_color bg_color x_hot y_hot +</pre> +<p> +e.g., +<p> +<pre> + createCursor foo bitmap1 bitmap2 black white 8 8 +</pre> +<p> +The named bitmaps must be created first with createBitmap. +<p> +<h3><A NAME="createPixmap">createPixmap</A></h3> +<p> +Create a named pixmap. This replaces any old pixmap of the same name. The +new pixmap is cached in server memory; when a widget pixmap resource is set, +the pixmap cache will be searched for the named pixmap before asking Xlib +to find the pixmap. +<p> +Usage: +<p> +<pre> + createPixmap name width height depth fg_color bg_color data +</pre> +<p> +e.g., +<p> +<pre> + createPixmap foo 16 16 8 black white { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +</pre> +<p> +<h3><A NAME="print">print</A></h3> +<p> +Print a string on the standard output. This is used mainly for debugging +user interfaces. +<p> +Usage: +<p> +<pre> + print arg [arg ...] +</pre> +<p> +<h3><A NAME="send">send</A></h3> +<p> +Send a message to an object. The object interprets the message and returns +a function value as the string result of the TCL command. +<p> +Usage +<p> +<pre> + send &lt;object&gt; &lt;message&gt; +</pre> +<p> +<h3><A NAME="postActivateCallback">postActivateCallback</A></h3> +<p> +Post a callback procedure to be called when the UI is activated. The UI is +activated when it is first downloaded to server, but it may also be +activated (reactivated) after the application has exited and is later +restarted, or when the UI is deactivated and reactivated. Note +that the UI state vis-a-vis the external world (client application) may +no longer be accurate after it has been idle for a time and then reactivated. +<p> +Usage: +<p> +<pre> + postActivateCallback &lt;procedure&gt; +</pre> +<p> +<p> +<h3><A NAME="postTimedCallback">postTimedCallback</A></h3> +<p> +Post a callback to call the named procedure back after a specified delay +in milliseconds. +<p> +Usage: +<p> +<pre> + id = postTimedCallback procedure msec [client-data] +</pre> +<p> +After the specified delay the user callback procedure will be called with +client_data (if given) as the single argument. Only one call will be made; +the client must repost the callback in each call if the procedure is to be +repeatedly executed. +<p> +An ID value is returned which may be passed to deleteTimedCallback to delete +the timer. +<p> +<h3><A NAME="deleteTimedCallback">deleteTimedCallback</A></h3> +<p> +Delete a timer callback procedure. This procedure is typically used to +break a timer loop, where the timer procedure repeatedly reposts itself at +the end of each interval. +<p> +Usage: +<p> +<pre> + deleteTimedCallback id +</pre> +<p> +The ID string is returned by postTimedCallback when a timer is posted. +<p> +<h3><A NAME="postWorkCallback">postWorkCallback</A></h3> +<p> +Post a callback for a procedure to be called when the server is idle. +Work procedures are used to perform computations in the background while +the user interface remains active and able to respond to input events. +This works only if the user work procedure does its job in small increments, +doing only a small amount of processing in each call. The work procedure +will be called repeatedly until it returns a status indicating that it has +finished its task. +<p> +Usage: +<p> +<pre> + id = postWorkCallback procedure [client-data] +</pre> +<p> +When the server has nothing else to do the user work procedure will be +called with client_data (if given) as the single argument. The work procedure +should return the string "done" when all processing is finished, or any other +string if the procedure is to be called again. +<p> +An ID value is returned which may be passed to deleteWorkCallback to delete +the work procedure. +<p> +<h3><A NAME="deleteWorkCallback">deleteWorkCallback</A></h3> +<p> +Delete a work callback procedure. +<p> +Usage: +<p> +<pre> + deleteWorkCallback id +</pre> +<p> +The ID string is returned by postWorkCallback when a work procedure is posted. + +<hr noshade=5> + +<a name="6.3"></a> +<h3>6.3 Gterm</h3> +<p> +The gterm-image widget is a general 2D graphics-imaging widget providing +a wide range of facilities for drawing graphics and text, for image +display, and for graphics interaction. Normally the client communicates +directly with the Gterm widget to draw graphics, download image data, +and so on, using some communications protocol outside the domain of the +object manager. Nonetheless so far as possible the facilities of the Gterm +widget have also been made available to GUI code via the commands listed +here. +<p> +The Gterm widget adds the following function to the OBM library. +<p> +<pre> + ObmPostSetGtermCallback (obm, &setgterm, setgterm_client_data) +</pre> +<p> +This is called by a client application to post a procedure to be called +when a gterm widget receives the setGterm command. The calling sequence +for setGterm callback is as follows: +<p> +<pre> + setgterm (client_data, gterm_widget) +</pre> +<p> +The purpose of this callback is to tell the client which gterm widget is +the "active" gterm widget. This is used by clients which only support +one active Gterm widget, i.e., which can only direct graphics output to +one Gterm widget at a time. +<p> +The messages or commands that can be sent to the Gterm widget by GUI +code follow. +<p> +General commands: +<p> +<pre> + <a href="#setGterm">setGterm</a> # make widget the active Gterm +<p> + <a href="#activate">activate</a> + <a href="#deactivate">deactivate</a> + <a href="#addCallback">addCallback</a> procedure-name callback-type + <a href="#reset">reset</a> + <a href="#flush">flush</a> +<p> + <a href="#setCursorPos">setCursorPos</a> x y [raster] + <a href="#getCursorPos">getCursorPos</a> x y + <a href="#setCursorType">setCursorType</a> cursortype + <a href="#bell">bell</a> +</pre> +<p> +Graphics drawing commands: +<p> +<pre> + <a href="#setRaster">setRaster</a> raster + raster = <a href="#getRaster">getRaster</a> [raster] +<p> + <a href="notyet.html">setLogRes</a> width height + <a href="notyet.html">getLogRes</a> width height + <a href="notyet.html">setPhysRes</a> width height + <a href="notyet.html">getPhysRes</a> width height + <a href="notyet.html">setTextRes</a> rows cols + <a href="notyet.html">setDataLevel</a> level + <a href="notyet.html">setLineWidth</a> width + <a href="notyet.html">setLineStyle</a> style + <a href="notyet.html">setColorIndex</a> index + <a href="notyet.html">setFillType</a> filltype +<p> + <a href="#clearScreen">clearScreen</a> + <a href="notyet.html">drawPolyline</a> vector + <a href="notyet.html">drawPolymarker</a> vector + <a href="notyet.html">drawPolygon</a> vector + <a href="notyet.html">drawMarker</a> x y xsize ysize type +<p> + <a href="notyet.html">drawAlphaText</a> x y text + <a href="notyet.html">getAlphaTextSize</a> string width height base + <a href="notyet.html">startDialog</a> + <a href="notyet.html">endDialog</a> + <a href="notyet.html">eraseDialog</a> + <a href="notyet.html">drawDialogText</a> x y text + <a href="notyet.html">getDialogTextSize</a> string width height base +</pre> +<p> +The coordinates used in the graphics drawing commands are logical +coordinates as defined by setLogRes, in the coordinate system of the +reference drawing raster as defined by setRaster. The default reference +raster is raster zero, the widget's window. Vectors are specified as +a list of points, e.g., { {x y} {x y} ... }. +<p> +Imaging commands: +<p> +<pre> + <a href="#rasterInit">rasterInit</a> + <a href="notyet.html">assignRaster</a> raster drawable + <a href="notyet.html">createRaster</a> raster type width height depth + <a href="notyet.html">destroyRaster</a> raster + exists = <a href="notyet.html">queryRaster</a> raster type width height depth + raster = <a href="notyet.html">nextRaster</a> [raster] + nrasters = <a href="notyet.html">nRasters</a> [nrasters] +<p> + <a href="#setPixel">setPixel</a> raster x y value + value = <a href="#getPixel">getPixel</a> raster x y + <a href="#writePixels">writePixels</a> raster pixels encoding x1 y1 nx ny + <a href="#readPixels">readPixels</a> raster pixels encoding x1 y1 nx ny + <a href="notyet.html">refreshPixels</a> raster ct x1 y1 nx ny + pixmap = <a href="notyet.html">createPixmap</a> src x y width height + <a href="notyet.html">copyPixmap</a> pixmap dst x y width height +<p> + colormap = <a href="notyet.html">nextColormap</a> [colormap] + <a href="notyet.html">freeColormap</a> colormap + <a href="notyet.html">writeColormap</a> colormap first nelem colors + <a href="notyet.html">readColormap</a> colormap first nelem colors + <a href="#loadColormap">loadColormap</a> colormap offset scale +<p> + <a href="notyet.html">initMappings</a> + mapping = <a href="#nextMapping">nextMapping</a> [mapping] + <a href="notyet.html">freeMapping</a> mapping + <a href="notyet.html">enableMapping</a> mapping + <a href="notyet.html">disableMapping</a> mapping + active = <a href="notyet.html">activeMapping</a> mapping + <a href="notyet.html">refreshMapping</a> mapping +<p> + raster = <a href="#selectRaster">selectRaster</a> dras dt dx dy rt rx ry [map] + <a href="#unmapPixel">unmapPixel</a> sx sy raster rx ry [rz] +<p> + <a href="notyet.html">copyRaster</a> rop src st sx sy snx sny dst dt dx dy dnx dny + <a href="#setMapping">setMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny + <a href="#getMapping">getMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny +<p> + <a href="#flip">flip</a> mapping axis [axis...] +</pre> +<p> +Pixel arrays are long strings consisting either of a sequence of numeric +pixel values separated by whitespace (space or newline), or a hex encoded +sequence of bytes (2 hex digits per 8 bit pixel). Colors are specified +as a list of RGB triplets, e.g., { {R G B} {R G B} ... }. +<p> +Refer to the documentation for the Gterm widget for a detailed description +of rasters, mappings, and colormaps. +<p> +Markers: +<p> +<pre> + <a href="#createMarker">createMarker</a> name [attribute-list] + <a href="#markerInit">markerInit</a> +</pre> +<p> +New markers may be created with createMarker. Once created, a marker +functions under the Object Manager as a named object of class "marker". +Refer to the marker class for a description of the commands defined for +a marker. +<p> +gterm Actions List +<p> +<pre> + ignore + graphics-input + graphics-context + crosshair + track-cursor + enter-window + leave-window + popup-menu {not implemented} + reset + m_create +</pre> +<p> +Default translations for Gterm window. +Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) +<p> +default Gterm Translations +<p> +<pre> + [Btn1Down]:m_create() + [Btn2Down]:crosshair(on) + [Btn2Motion]:crosshair(on) + [Btn2Up]:crosshair(off) + ~Ctrl ~Meta [Btn3Down]:graphics-context() + [EnterWindow]:enter-window() + [LeaveWindow]:leave-window() + [KeyPress]:graphics-input() + [Motion]:track-cursor() +</pre> +<p> +<p> +<a name="6.3.1"></a> +<h2>6.3.1 GTERM class commands</h2> +<p> +<h3><A NAME="setGterm">setGterm</A></h3> +<p> +Set the active Gterm widget. A UI can have more than one +gterm widget, but due to restrictions on the client-server interface, it +may be possible for only one to receive client output at any one time (any +gterm widget can generate input to be sent to the client). If the client +has this restriction, the client-server interface code which uses OBM can +call the ObmPostSetGtermCallback procedure to post a function to be called +when the UI code calls the setGterm procedure. +<p> +Usage: +<p> +<pre> + setGterm +</pre> +<p> +<h3><A NAME="activate">activate</A></h3> +<p> +Activate the gterm widget. This causes the next GIN mode +setCursorType to warp the pointer into the gterm window. +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h3><A NAME="deactivate">deactivate</A></h3> +<p> +Deactivate the gterm widget. If the cursor has been warped +into the window by a previous activate/setCursorType GIN mode, this causes +the cursor to be warped back to where it was previously. +<p> +Usage: +<p> +<pre> + deactivate +</pre> +<p> +<h3><A NAME="reset">reset</A></h3> +<p> +Reset the gterm widget. This causes a number of state variables +affecting graphics drawing options to be set to their default values. +<p> +Usage: +<p> +<pre> + reset +</pre> +<p> +<h3><A NAME="flush">flush</A></h3> +<p> +Flush any graphics output and synchronize the state of the widget +with what is shown on the display. +<p> +Usage: +<p> +<pre> + flush +</pre> +<p> +The gterm widget uses XLIB, which buffers graphics drawing commands and +automatically sends them to the X server when 1) the buffer fills, +2) input is requested from the server. Such buffering of data is necessary +for efficient operation and it should rarely be necessary to explicitly +flush graphics output since XLIB does this automatically in most cases. +An example of when explicitly flushing the ouptut might be necessary is in +cases where smooth animation is desired and drawing the graphics in batches +could cause the display to appear "jerky". +<p> +<h3><A NAME="addCallback">addCallback</A></h3> +<p> +Post a callback for a Gterm widget event. +<p> +Usage: +<p> +<pre> + addCallback procedure-name [callback-type] +</pre> +<p> +The recognized Gterm callbacks are +<p> +<pre> + + input Called when the graphics-input action is invoked in + a translation table. The default Gterm translation + table invokes this action when a KeyPress event occurs + in the Gterm window. + Callback: widget-name input-type event-data + + resize Called when the gterm window is resized. + Callback: widget-name width height + + reset Called when the "reset" action is invoked. + Callback: widget-name + +</pre> +<p> +If no callback is specified the default is "input". +<p> +Note that in GUI code one can also use the translation table to directly +invoke GUI procedures without need to use the Gterm input mechanism. This +is more flexible but we support the Gterm input callback here for +applications that use the default translations. +<p> +<h3><A NAME="setCursorPos">setCursorPos</A></h3> +<p> +Warp the cursor (pointer) to the given coordinates. This +is a graphics drawing command and if no raster number is specified the +current reference drawing raster, as set with setRaster, defines the +coordinate system. +<p> +Usage: +<p> +<pre> + setCursorPos x y [raster] +</pre> +<p> +A raster number may optionally given to define the raster coordinate system +to be used. raster=0 yields screen coordinates. +<p> +<h3><A NAME="getCursorPos">getCursorPos</A></h3> +<p> +Get the cursor position (raster 0 or screen coordinates). +<p> +Usage: +<p> +<pre> + getCursorPos x y +</pre> +<p> +<h3><A NAME="setCursorType">setCursorType</A></h3> +<p> +Set the cursor type. +<p> +Usage: +<p> +<pre> + setCursorType cursor-type + + idle default cursor + busy busy cursor, e.g, when program is busy + ginMode graphics input mode cursor, set when program is + waiting for graphics input +</pre> +<p> +<h3><A NAME="bell">bell</A></h3> +<p> +Gterm widget sound output. +<p> +Usage: +<p> +<pre> + bell +</pre> +<p> +<h3><A NAME="setRaster">setRaster</A></h3> +<p> +Set the number of the raster to be used to define the drawing +context (e.g. coordinate system) for graphics and text drawing functions. +<p> +Usage: +<p> +<pre> + setRaster raster-number +</pre> +<p> +<h3><A NAME="getRaster">getRaster</A></h3> +<p> +Get the number of the raster which defines the drawing +context, as set in the last setRaster call. +<p> +Usage: +<p> +<pre> + raster = getRaster [raster] +</pre> +<p> +If the name of a variable is given the raster number will be stored +directly in that variable. +<p> +<h3><A NAME="clearScreen">clearScreen</A></h3> +<p> +Clear the "screen", i.e., window. This action clears the +drawing window and sets a number of drawing state variables to their default +values. +<p> +Usage: +<p> +<pre> + clearScreen +</pre> +<p> +<h3><A NAME="rasterInit">rasterInit</A></h3> +<p> +Initialize the raster subsystem, deleting all rasters and +mappings and freeing the dynamic part of the colortable. +<p> +Usage: +<p> +<pre> + rasterInit +</pre> +<p> +<h3><A NAME="writePixels">writePixels</A></h3> +<p> +Set the values of some subset of the pixels in a raster. +If any mappings are defined on the affected region and are enabled, any +destination rasters will be automatically updated as defined by the mapping. +<p> +Usage: +<p> +<pre> + writePixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be written. +</pre> +<p> +Most real-world image processing applications get the Gterm widget handle +with setGterm and pass binary data to the widget by calling GtWritePixels +directly. This is the most efficient approach for serious image processing +where large amounts of data are involved. However, being able to read and +write raster pixels directly in a GUI can be useful in specialized +applications, e.g., where the image is computed or modified by the GUI. +<p> +<h3><A NAME="setPixel">setPixel</A></h3> +<p> +Set the value of a single pixel. +<p> +Usage: +<p> +<pre> + setPixel raster x y value + + raster The raster number. + x, y The pixel to be set. + value The pixel value. +</pre> +<p> +This routine is more efficient than writePixels for setting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be set. +<p> +<h3><A NAME="readPixels">readPixels</A></h3> +<p> +Get the values of some subset of the pixels in a raster. +<p> +Usage: +<p> +<pre> + readPixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be read. +</pre> +<p> +Use readPixels to read a block of pixels, and getPixel to get the value +of a single pixel. +<p> +<h3><A NAME="getPixel">getPixel</A></h3> +<p> +Get the value of a single pixel. +<p> +Usage: +<p> +<pre> + getPixel raster x y + + raster The raster number. + x, y The pixel to be set. +</pre> +<p> +This routine is more efficient than readPixels for getting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be read. +<p> +<h3><A NAME="nextMapping">nextMapping</A></h3> +<p> +Return the index of the next unused mapping. +<p> +Usage: +<p> +<pre> + nextMapping +</pre> +<p> +Returns the mapping number as the function value. +<p> +<h3><A NAME="getMapping">getMapping</A></h3> +<p> +Get a mapping. +<p> +Usage: +<p> +<pre> + getMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters except the mapping number are output parameters. +<p> +<h3><A NAME="setMapping">setMapping</A></h3> +<p> +Set a mapping. +<p> +Usage: +<p> +<pre> + setMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters are input parameters. +<p> +<h3><A NAME="loadColormap">loadColormap</A></h3> +<p> +Load a colormap. +<p> +Usage: +<p> +<pre> + loadColormap colormap [offset [scale]] +</pre> +<p> +The offset and scale parameters may be used to adjust the brightness and +contrast of the image when the colormap is loaded. The normalized colormap +has offset=0.5, scale=1.0. Colormap zero is the hardware colormap. +<p> +<h3><A NAME="selectRaster">selectRaster</A></h3> +<p> +Given the raw screen coordinates SX,SY (or coords in +any destination raster), determine the mapping and source raster which are +mapped to that pixel and return the raster and mapping numbers and the +coordinates of the same pixel in the source raster. +<p> +Usage: +<p> +<pre> + raster = selectRaster dras dt dx dy rt rx ry [map] +</pre> +<p> +where +<p> +<pre> + dras display raster + dt,rt coordinate type - "pixel" or "ndc" + dx,dy display raster coordinates (input) + rx,ry source raster coordinates (output) + map mapping selected (output) +</pre> +<p> +Note that the coordinates returned by selectRaster are measured (taking +a line as an example) from zero at the left edge of the first pixel, to +"width" at the right edge of the last pixel. This means that the floating +point coordinates of the center of raster pixel N will be N + 0.5. For +example, if we input screen coordinates (dras=0), x=117, and no mapping +is in effect, the floating point raster coordinates returned will be 117.5. +The difference occurs because the input coordinate is a pixel number +(integer) while the output coordinate is a floating point coordinate +measuring the continuously variable location a pixel. int(x) will convert +this coordinate to a raster pixel number. +<p> +<h3><A NAME="unmapPixel">unmapPixel</A></h3> +<p> +unmapPixel is a simplified, less general version of +selectRaster which will automatically follow graphics pipelines back to +the original mapped raster. If desired the raster pixel value can be +returned as well as the raster number and raster pixel coordinates +corresponding to a screen (raster 0) pixel. +<p> +Usage: +<p> +<pre> + unmapPixel sx sy raster rx ry [rz] +</pre> +<p> +where +<p> +<pre> + sx,sy "screen" (raster 0) coordinates + raster original mapped raster (output) + rx,ry source raster coordinates (output) + rz source raster pixel value (output) +<pre> +<p> +By following graphics pipelines back to the original source raster we mean +the following. If raster A is mapped to raster B which is mapped to C (the +screen), given a screen coordinate in the mapped region unmapPixel will +return the raster number and coordinates for raster A. +<p> +<h3><A NAME="flip">flip</A></h3> +<p> +Edit a mapping to flip the mapped subimage in X and/or Y. +<p> +Usage: +<p> +<pre> + flip mapping axis [axis] +</pre> +<p> +where axis is "x" or "y". This is a convenience routine for changing only +the flip portion of a mapping. +<p> +<h3><A NAME="markerInit">markerInit</A></h3> +<p> +Initialize the Marker subsystem for a Gterm widget. +This destroys all markers and initializes the marker subsystem. +<p> +Usage: +<p> +<pre> + markerInit +</pre> +<p> +<h3><A NAME="createMarker">createMarker</A></h3> +<p> +Create a new marker. +<p> +Usage: +<p> +<pre> + createMarker name attribute-list + e.g. createMarker name {attribute value [attribute value ...]} + or createMarker name attribute value [attribute value ...] +<pre> +<p> +Any marker attribute may be assigned a value when the marker is created. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker attribute names. Often the +the attributes "type" and "createMode" need to be specified at marker +create time. +<p> +<pre> + type The marker type: text, rectangle, circle, etc. + + createMode A marker should be created with createMode=interactive + if the user is expected to interactively drag out + the marker using the pointer and either the default + or an application specified translation table. A + marker can also be created interactively using only + the m_create (marker create) action, however m_create + does not allow the marker attributes to be set. +<pre> +<p> +There are any number of ways to use a GUI to create a marker under the +Object Manager, but an example might be using a translation to call a GUI +procedure which issues the createMarker call. For example a pointer down +event could translate as "call(newMarker,$name,$x,$y) m_create()" where +newMarker is a GUI marker creation procedure which sends a createMarker +message to the Gterm widget. The GUI procedure could set the marker +attributes as desired, possibly using additional GUI components to define +the marker attributes. The m_create action will notice that a +createMarker has been executed and will merely activate the marker and +give it the pointer focus (i.e. install the marker translations). The +user will then use the pointer or keyboard to drag out the marker. +<p> +If the marker is created noninteractive the application must set the marker +position and size using marker attributes. If the marker is sensitive +the user can then use the marker's translations to interactively modify +the marker (resize it, move it, etc.). All markers which are visible and +sensitive and which have the necessary translations can be interactively +modified by the user; the reason for creating a marker in interactive mode +is to allow the initial marker position and size to be specified +interactively *when* the marker is created, instead of afterwards. +<p> +Any number of attributes may be given when the marker is created. Most +marker attributes can also be modified after a marker has been created +by sending setAttribute messages to the marker. + +<hr noshade=5> + +<a name="6.4"></a> +<h3>6.4 HTML</h3> + +The HTML (hypertext markup language) widget displays a block of HTML +formatted text, the "document" to be displayed. The text consists of a +mixture of text to be displayed and embedded formatting directives. The +text may also contain "hot links" pointing to other HTML-formatted +documents. + +<pre> + setText text [target [header_text [footer_text]]] + text = getText [format [font]] + retestAnchors + + id = positionToId x y + idToPosition id x y + anchorToPosition name x y + id = anchorToId name + gotoId id + + n = getHRefs list + n = getImageSrcs list + n = getLinks list + + setSelection start end + text = getSelection start end + clearSelection + + searchText pattern start end [direction [search_type]] + + addCallback procedure-name [callback-type] + deleteCallback procedure-name [callback-type] +</pre> + +The possible callback types and their callback arguments are as follows. + +<pre> + anchor widget cbtype event text href element_id + testAnchor widget cbtype href + submitForm widget cbtype event attrs href method enctype encentity + link widget cbtype href role + pointerMotion widget cbtype href +</pre> + +See the comments below for further details on the callback types and their +arguments. + +<p> +<a name="6.4.1"></a> +<h2>6.4.1 Command Summary</h2> +<p> + +<hr noshade=5> + +<a name="6.5"></a> +<h3>6.5 Markers</h3> +<p> +A marker is a graphics object implemented by the Gterm-Image widget. +Markers are not real toolkit widgets, but they act much like widgets and +are interfaced as an object class under the Object Manager. The Marker +class is not a subclass, it is a base class like Widget, but Marker objects +can exist only as children of Gterm widgets. +<p> +Since markers are not independent widgets but rather part of a Gterm widget +instance, the parent Gterm widget is partially responsible for managing +markers. The Gterm widget implements the following commands for dealing +with markers. +<p> +<pre> + <a href="gtermclass.html#createMarker">createMarker</a> name [attribute-list] + <a href="gtermclass.html#markerInit">markerInit</a> +</pre> +<p> +A new marker is created by sending the createMarker message to the parent +gterm widget. This creates a marker of the given name and type. +The markerInit command, if sent to a gterm widget, destroys any markers +defined for that widget and reinitializes the marker facility. Markers +may also be created by action procedures in response to user input events. +<p> +A marker may be destroyed by itself in response to an input event (e.g. the +user presses the delete key), by sending the marker the destroy message +to tell it to destroy itself, by sending a markerInit to the parent gterm +widget, or by destroying the marker object (or any parent) with the server +command <a href="#destroyObject">destroyObject</a>. +<p> +Once a marker has been created it behaves as an independent object and +receives and executes messages, responds to events, generates callbacks, +and so on. The marker class defines the following commands. +<p> +<pre> + <a href="#makeCopy">makeCopy</a> name + <a href="#addCallback">addCallback</a> procedure [event [event ...]] + <a href="#notify">notify</a> [event-type [param [param ...]]] + <a href="#destroy">destroy</a> [nocallback] +<p> + <a href="#markpos">markpos</a> + <a href="#redraw">redraw</a> [function] [markpos|nomarkpos] [erase|noerase] +<p> + <a href="#raise">raise</a> [reference-marker] + <a href="#lower">lower</a> [reference-marker] +<p> + <a href="#move">move</a> x y + <a href="#resize">resize</a> width height + <a href="#rotate">rotate</a> angle # radians +<p> + <a href="#setAttribute">set</a> attribute value # alias for setAttribute + value = <a href="#getAttribute">get</a> attribute # alias for getAttribute +<p> + <a href="#setAttribute">setAttribute</a> attribute value + value = <a href="#getAttribute">getAttribute</a> attribute + <a href="#setAttributes">setAttributes</a> attribute-list + <a href="#getAttributes">getAttributes</a> attribute-list + <a href="#setVertices">setVertices</a> points first npts + <a href="#getVertices">getVertices</a> points first npts +<p> + region = <a href="#getRegion">getRegion</a> [unmap] [coord-type] + <a href="#getRect">getRect</a> dx dy dnx dny +</pre> +<p> +Marker positions and dimensions are given in window (raster 0) coordinates. +<p> +The operators raise, lower, move, resize, and rotate erase the marker, +modify it as indicated, and redraw it with the new attributes. For finer +control over marker attributes one can use [get|set]Attribute[s] and +[get|set]Vertices to edit the markers directly. In this case an auto +redraw is not performed (unless the autoRedraw marker attribute is set). +The usual sequence is a markpos to record the marker position, one or more +setAttribute calls to change marker attributes, then a redraw to erase +the old marker and redraw the new one. Markers have many attributes which +can be set to control things like the position and size, colors, line +widths, fill type and style, font, rubber-band technique, and so on. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker types and attributes. +<p> +The marker type may be changed at runtime without destroying the marker. +For example a circle can be changed to an ellipse or a rectangle. This +also works for polygons (the vertex list is preserved and restored when +the marker is changed back to a polygon). +<p> +The current shape of a marker may be queried with getVertices, which +returns the polygon or polyline vertex list in window coordinates. A more +powerful routine which does something similar is getRegion. This routine +returns a high level description of the region outlined by the marker, +giving the marker type (rectangle, circle, ellipse etc.), center, width +and height, and so on. Any position or dimension information may +optionally be transformed back to the original source raster, if the marker +center is in a region of the window which is the destination of an active +mapping. The unmap option will follow multiple mappings back to the +original mapped source raster. +<p> +The getRect function returns the parameters of the region outlined by a +rectangle marker in a form convenient for use in a Gterm setMapping call +(this is used to display an image within a marker). +<p> +Default translations when pointer is over a marker. +default Marker Translations +<p> +<pre> + Shift &lt;Btn1Motion&gt; m_rotateResize() + &lt;Btn1Motion&gt; m_moveResize() + Shift &lt;Btn1Down&gt; m_raise() m_markpos() + &lt;Btn1Down&gt; m_raise() m_markposAdd() + &lt;Btn1Up&gt; m_redraw() m_destroyNull() + &lt;Btn2Down&gt; m_lower() + &lt;Key&gt; BackSpace m_deleteDestroy() + &lt;Key&gt; Delete m_deleteDestroy() + &lt;KeyPress&gt; m_input() + &lt;Motion&gt; track-cursor() +</pre> +<p> +<a name="6.5.1"></a> +<h2>6.5.1 Command Summary</h2> +<p> +<h3>makeCopy</A></h3> +<p> +Copy a marker. The new marker is initially identical to the +old one, and will not be distinct until, e.g., moved to a new center. +<p> +Usage: +<p> +<pre> + makeCopy name +</pre> +<p> +<h3><A NAME="addCallback">addCallback</A></h3> +<p> +Post a marker callback to be called when the specified +event or events occurs. If no events are listed a Notify callback will +be posted. +<p> +Usage: +<p> +<pre> + addCallback procedure [event [event ...]] +</pre> +<p> +<h3><A NAME="notify">notify</A></h3> +<p> +Generate a Marker pseudo-event, causing any posted client +callback procedures to be called. +<p> +Usage: +<p> +<pre> + notify [event-type [param [param ...]]] +</pre> +<p> +<h3><A NAME="destroy">destroy</A></h3> +<p> +Destroy a marker. Just tell the marker to destroy itself. +All cleanup outside the marker facility relies upon the use of callbacks. +This includes our callback markerDestroyCallback below. +<p> +Usage: +<p> +<pre> + destroy +</pre> +<p> +<h3><A NAME="markpos">markpos</A></h3> +<p> +Mark the current position of a marker for a later redraw. +<p> +Usage: +<p> +<pre> + markpos +</pre> +<p> +Markpos is used to mark the position of a marker before changing any +marker attributes, so that a later "redraw marked" will erase the old +marker rather than the new one. This is necessary, for example, if any +marker attributes are changed which affect the size or position of the +marker. +<p> +<h3><A NAME="redraw">redraw</A></h3> +<p> +Redraw a marker. +<p> +Usage: +<p> +<pre> + redraw [function] [erase|noerase] [markpos|nomarkpos] +</pre> +<p> +By default redraw will erase the old marker at the position indicated by +a previous call to markpos, and redraw the marker with the current +attributes using the drawing function copy (copy source to destination). +Hence the usual usage is "markpos ... change marker attributes ... redraw". +Optional arguments may be given to change the drawing function, enable or +disable erase, or force redraw to do a markpos. These arguments may be +given in any order. +<p> +The drawing functions are as given in the XLIB documentation, minus the +"GX" prefix. The most commonly used functions are "copy" and "xor". +A normal marker redraw uses function=copy. +<p> +<h3><A NAME="raise">raise</A></h3> +<p> +Raise a marker, i.e., cause it to be drawn on top of other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + raise [reference-marker] +</pre> +<p> +In a reference marker is named the marker will raise itself above this +marker, otherwise the raised marker becomes the topmost marker. +<p> +<h3><A NAME="lower">lower</A></h3> +<p> +Lower a marker, i.e., cause it to be drawn beneath other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + lower [reference-marker] +</pre> +<p> +In a reference marker is named the marker will lower itself beneath this +marker, otherwise the lowered marker becomes the lowest marker. +<p> +<h3><A NAME="move">move</A></h3> +<p> +Move a marker. +<p> +Usage: +<p> +<pre> + move x y +</pre> +<p> +Move the marker center to the indicated coordinates in the display window. +<p> +<h3><A NAME="resize">resize</A></h3> +<p> +Resize a marker. +<p> +Usage: +<p> +<pre> + resize width height +</pre> +<p> +Resize the marker to the indicated size. By default width and height are +given in pixels. For a text marker one can append "ch" to indicate that +the units are chars in whatever font is in use, e.g., "40ch" or "40 chars" +is an acceptable value for a text marker dimension. +<p> +<h3><A NAME="rotate">rotate</A></h3> +<p> +Rotate a marker. +<p> +Usage: +<p> +<pre> + rotate angle +</pre> +<p> +Redraw a marker oriented to the given rotation angle. The angle is +given in radians. +<p> +<h3><A NAME="getAttribute">getAttribute</A></h3> +<p> +Return the value of a marker attribute. +<p> +Usage: +<p> +<pre> + value = getAttribute attribute-name +</pre> +<p> +<h3><A NAME="setAttribute">setAttribute</A></h3> +<p> +Set the value of a marker attribute. +<p> +Usage: +<p> +<pre> + setAttribute attribute-name value +</pre> +<p> +<h3><A NAME="getAttributes">getAttributes</A></h3> +<p> +Return the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + getAttributes attribute-list + i.e. getAttributes {name value [name value ...]} + or getAttributes name value [name value ...] +</pre> +<p> +where "value" is the name of the variable in which the attribute value +is to be stored. +<p> +<h3><A NAME="setAttributes">setAttributes</A></h3> +<p> +Set the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + setAttributes attribute-list + i.e. setAttributes {name value [name value ...]} +</pre> +<p> +where "value" is the new value of the associated marker attribute. +<p> +<h3><A NAME="getVertices">getVertices</A></h3> +<p> +Get some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + getVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is returned in the +variable "points", as a string of the form { {x y} {x y} ...}. The first +point is number zero. +<p> +<h3><A NAME="setVertices">setVertices</A></h3> +<p> +Set some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + setVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is set using the points +passed in the "points" variable as a string of the form { {x y} {x y} ...}. +If FIRST and NPTS are not specified first is assumed to be zero (the first +point) and NPTS is the length of the points array. +<p> +<h3><A NAME="getRegion">getRegion</A></h3> +<p> +Return as a text string a high level description of the +region defined by a marker. +<p> +Usage: +<p> +<pre> + region = getRegion [unmap] [coord-type] +</pre> +<p> +The output string defines the marker type and the major marker positional +attributes. The region description formats for the various marker types +follow. +<p> +<pre> + text raster x y width height + line raster x y x y + polyline raster npts { {x y} {x y} ...} + rectangle raster x y width height rotangle + circle raster x y radius + ellipse raster x y width height rotangle + polygon raster npts { {x y} {x y} ...} +</pre> +<p> +Here, width and height refer to the distance from the marker center to an +edge, not to the width or height of the whole marker. This avoids +ambiguities about where the edge of a marker is if the width is even or +odd. Using the center to edge measurement, the edge is at x +/- width, +y +/- height. +<p> +If the "unmap" flag is given getRegion will attempt to associate the +marker with a mapped raster, reversing any mappings from the screen back +to the original source raster, and returning the raster number and raster +coordinates and marker sizes. If "unmap" is not given the marker +coordinates will refer to raster 0. Either pixel ("pixel") or NDC +("ndc") coordinates may be returned, pixel coordinates being the default. +<p> +<h3><A NAME="getRect">getRect</A></h3> +<p> +Return the region enclosed by a rectangle marker. The rect is +returned in a form convenient for use as the destination rect in a gterm +widget raster mapping. +<p> +Usage: +<p> +<pre> + getRect dx dy dnx dny +</pre> +<p> +The rect is stored in the output arguments. +<p> + +<hr noshade=5> + +<a name="6.6"></a> +<h3>6.6 Widget</h3> +<p> +The Widget class is the generic or base class for the window system +toolkit widgets supported by the object manager. The Widget class +supports a number of different Xt widget classes using a table driven +approach to describe each widget. Any widget may be created, destroyed, +and manipulated in various ways using only the generic Widget class +procedures and Widget-specific resources. The Widget class may be +subclassed to support complex Widgets that require custom class-specific +commands for use by the GUI code. +<p> +Generic Widget-class commands: +<p> +<pre> + <a href="#set">set</a> &lt;resource-name&gt; &lt;value&gt; + <a href="#get">get</a> &lt;resource-name&gt; +<p> + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; [<callback-name>] + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#setSensitive">setSensitive</a> &lt;sensitive&gt; + <a href="#isSensitive">isSensitive</a> +<p> + <a href="#realize">realize</a> + <a href="#unrealize">unrealize</a> + <a href="#isRealized">isRealizeed</a> + <a href="#map">map</a> + <a href="#unmap">unmap</a> + <a href="#manage">manage</a> child [child ...] + <a href="#unmanage">unmanage</a> child [child ...] + <a href="#popup">popup</a> [grab-kind] + <a href="#popdown">popdown</a> + <a href="#popupSpringLoaded">popupSpringLoaded</a> +<p> + <a href="#move">move</a> &lt;x&gt; &lt;y&gt; + <a href="#resize">resize</a> &lt;width&gt; &lt;height&gt; &lt;border-width&gt; + <a href="#configure">configure</a> &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +The most important Widget commands are set/get resource, and the +callbacks. The widget sensitivity can be set and queried using set/get +resource, but special procedures are provided to make this common operation +more convenient. +<p> +Class specific functions: +<p> +<pre> + <a href="#append">append</a> text # text widget + <a href="#setList">setList</a> list [resize] # list widget + value = <a href="#getItem">getItem</a> itemno + <a href="#highlight">highlight</a> itemno + <a href="#unhighlight">unhighlight</a> +</pre> +<p> +Ideally the widget class should be subclassed for widgets that require +class-specific functions, but in simple cases involving standard widgets +the support is built into the widget class code as a special case. +<p> +Special actions (used in translations): +<p> +<pre> + <a href="#do_userproc">call</a> (proc [,arg, ...]) + <a href="#do_popup">popup</a> (menu-name [xoffset [yoffset]]) + <a href="#do_popdown">popdown</a> (menu-name) +</pre> +<p> +The "call" action is a very general mechanism which allows any GUI procedure +to be registered with any translation using the X translation table +mechanism. The popup and popdown actions are used for popup menus. The +menu will be popped up at the event coordinates plus the optional offsets +if given. +<p> +Event handling: +<p> +<pre> + <a href="#addEventHandler">addEventHandler</a> &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +Event callback: +<p> +<pre> + <a href="#userEventHandler">userEventHandler</a> widget event-type time wx wy rx ry other +</pre> +<p> +In most cases translations are preferable to events, but a GUI can capture +raw events if it wishes by adding event handlers. Nearly all of the X +event types are supported. The callback syntax employs a number of +standard arguments, followed by a number of event-specific arguments. +<p> +<h3><A NAME="addCallback">addCallback</A></h3> +<p> +Add a callback procedure to the callback list for +a widget. If no callback name is given, "callback" is assumed. +<p> +Usage: +<p> +<pre> + addCallback <procedure-name> [&lt;callback-name&gt;] +</pre> +<p> +Specific widgets only support certain types of callbacks. There is no +checking that the callback type specified is supported by a widget; the +wrong type of callback can be registered, but it will never be called. +<p> +<h3><A NAME="deleteCallback">deleteCallback</A></h3> +<p> +Delete a callback procedure previously registered +for a widget. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> +<p> +<h3><A NAME="do_userproc">do_userproc (call)</A></h3> +<p> +Translation action procedure used to call general user +action procedures in the interpreter. The name of the user procedure to +be called is given as the first argument in the translation. For example, +the translation "call(foo,a,b,c)" would cause procedure foo to be called +with the arguments (a,b,c). The following arguments are special: +<p> +<pre> + Argument Replaced by +<p> + $name object name of widget + $time event->time + $x event->x + $y event->y + $x_root event->x_root + $y_root event->y_root +</pre> +<p> +The "user procedure" can be any server procedure. +<p> +<h3><A NAME="do_popup">do_popup</A></h3> +<p> +Popup a menu (or other spring loaded popup) at the location +of the event which triggered this action. +<p> +Usage: +<p> +<pre> + popup(menu-name [xoffset [yoffset]]) +</pre> +<p> +<h3><A NAME="do_popdown">do_popdown</A></h3> +<p> +Pop down a menu. +<p> +Usage: +<p> +<pre> + popdown(menu-name) +</pre> +<p> +<h3><A NAME="set">set</A></h3> +<p> +Set a widget resource. +<p> +Usage: +<p> +<pre> + set &lt;resource-name&gt; &lt;value&gt; +</pre> +<p> +<h3><A NAME="get">get</A></h3> +<p> +Get a widget resource value as a string. +<p> +Usage: +<p> +<pre> + get &lt;resource-name&gt; +</pre> +<p> +<h3><A NAME="append">append</A></h3> +<p> +Append data to a text widget. +<p> +Usage: +<p> +<pre> + append &lt;text&gt; +</pre> +<p> +<h3><A NAME="setList">setList</A></h3> +<p> +Set the item list of a list widget. +<p> +Usage: +<p> +<pre> + setList list [resize] +</pre> +<p> +The list is a simple list of strings, passed as a single string argument to +setList (quotes, braces, etc. may be used to quote strings containing +special characters). +<p> +<h3><A NAME="getItem">getItem</A></h3> +<p> +Get an item in a list widget. +<p> +Usage: +<p> +<pre> + value = getItem itemno +</pre> +<p> +If ITEMNO is a number the indicated list item is returned, or the string +"EOF" if the requested item is beyond the end of the list. Otherwise the +currently selected item is returned, and the index of the item is returned +in the output variable ITEMNO. If no item is currently selected ITEMNO +will be set to "none" on output. +<p> +<h3><A NAME="highlight">highlight</A></h3> +<p> +Highlight an item in a list widget. +<p> +Usage: +<p> +<pre> + highlight itemno +</pre> +<p> +The indicated item of the list is highlighted as if the item had been +selected by the user. Any previously highlighted item is unhighlighted. +<p> +<h3><A NAME="unhighlight">unhighlight</A></h3> +<p> +Unhighlight the currently highlighted item in a +list widget. +<p> +Usage: +<p> +<pre> + unhighlight +</pre> +<p> +Any currently highlighted item in the list widget is unhighlighted. +<p> +<h3><A NAME="realize">realize</A></h3> +<p> +Realize a widget. This activates and assigns windows for +a widget and all of its descendants. Realizing a widget does not in itself +cause it to appear on the screen. +<p> +Usage: +<p> +<pre> + realize +</pre> +<p> +<h3><A NAME="unrealize">unrealize</A></h3> +<p> +Unrealize a widget. This destroys the windows assigned +to a widget and all of its descendants. +<p> +Usage: +<p> +<pre> + unrealize +</pre> +<p> +<h3><A NAME="isRealized">isRealized</A></h3> +<p> +Test whether a widget is realized. +<p> +Usage: +<p> +<pre> + isRealized +</pre> +<p> +<h3><A NAME="map">map</A></h3> +<p> +Map a widget. +<p> +Usage: +<p> +<pre> + map +</pre> +<p> +<h3><A NAME="unmap">unmap</A></h3> +<p> +Unmap a widget. +<p> +Usage: +<p> +<pre> + unmap +</pre> +<p> +<h3><A NAME="manage">manage</A></h3> +<p> +Manage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Managing the +children makes them appear in the window, possibly causing the other +children to be rearranged in the window. +<p> +Usage: +<p> +<pre> + manage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h3><A NAME="unmanage">unmanage</A></h3> +<p> +Unmanage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Unmanaging the +children makes them disappear from the window and be removed from geometry +management, possibly causing the other children to be rearranged in the +window. +<p> +Usage: +<p> +<pre> + unmanage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h3><A NAME="popup">popup</A></h3> +<p> +Popup a shell widget. If no grab is indicated the popup +can remain up while other windows accept input. +<p> +Usage: +<p> +<pre> + popup [grab-kind] +</pre> +<p> +<h3><A NAME="popdown">popdown</A></h3> +<p> +Popdown a shell widget. +<p> +Usage: +<p> +<pre> + popdown +</pre> +<p> +<h3><A NAME="popupSpringLoaded">popupSpringLoaded</A></h3> +<p> +Popup a shell widget, e.g., a popup menu. +This implies an exclusive grab. +<p> +Usage: +<p> +<pre> + popupSpringLoaded +</pre> +<p> +<h3><A NAME="move">move</A></h3> +<p> +Move a widget to the given window relative coordinates. +<p> +Usage: +<p> +<pre> + move &lt;x&gt; &lt;y&gt; +</pre> +<p> +<h3><A NAME="resize">resize</A></h3> +<p> +Resize a widget. +<p> +Usage: +<p> +<pre> + resize &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h3><A NAME="configure">configure</A></h3> +<p> +Configure a widget, i.e., execute a simultaneous +move and resize. +<p> +Usage: +<p> +<pre> + configure &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h3><A NAME="setSensitive">setSensitive</A></h3> +<p> +Set the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + setSensitive &lt;sensitive&gt; +</pre> +<p> +<h3><A NAME="isSensitive">isSensitive</A></h3> +<p> +Test the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + isSensitive +</pre> +<p> +<h3><A NAME="addEventHandler">addEventHandler</A></h3> +<p> +Add a custom event handler to a widget. A list +of event masks is given to define the classes of events the user supplied +event handling procedure is to receive. +<p> +Usage: +<p> +<pre> + addEventHandler &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +<h3><A NAME="removeEventHandler">removeEventHandler</A></h3> +<p> +Remove an event handler previously posted +with addEventHandler, above. +<p> +Usage: +<p> +<pre> + removeEventHandler procname +</pre> +<p> +<h3><A NAME="event">event</A></h3> +<p> +Generic event handler called when a widget event handler +posted by addEventHandler is called. +<p> +The user event handler is called as +<p> +<pre> + userEventHandler widget event-type time wx wy rx ry other +</pre> +<p> +where "other" is an event-type specific list of fields describing the +the event. +<hr noshade=5> + +<a name="6.7"></a> +<h3>6.7 Parameter</h3> +<p> +The UI parameter class is used for client-UI communications. The client +does not control the user interface directly, rather the UI defines a set +of abstract UI parameters, and during execution the client application +assigns values to these parameters. These UI parameters should be thought +of as describing the runtime state of the client as viewed by the GUI. +The GUI is free to interpret this state information in any way, including +ignoring it. Many GUIs can be written which use the same client state +as described by the UI parameters. +<p> +Assigning a value to a UI parameter causes the new value to be stored, and +any parameter action procedures registered by the UI to be called. +The action or actions [if any] taken when a parameter value changes are +arbitrary, e.g. the action might be something as simple as changing a +displayed value of a UI widget, or something more complex like displaying +a popup. +<p> +<h2>UI Parameter class commands:</h2> +<p> +<pre> + <a href="#getValue">getValue</a> + <a href="#setValue">setValue</a> &lt;new-value&gt; + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#notify">notify</a> +</pre> +<p> +The most common usage is for the GUI to post one or more callbacks for +each UI parameter. When the UI parameter value is changed [with setValue, +e.g. by the client] the GUI callback procedures are called with the old +and new UI parameter values on the command line. addCallback is used to +add a callback procedure, and deleteCallback to delete one. Multiple +callbacks may be registered for a single UI parameter. notify is used +to simulate a parameter value change, causing any callback procedures to +be invoked. +<p> +The callback procedure is called as follows: +<p> +<pre> + user-procedure param-name {old-value} {new-value} +</pre> +<p> +The important thing to note here is that the old and new value strings +are quoted with braces. This prevents any interpretation of the string +by Tcl when the callback is executed, which is necessary because the +strings can contain arbitrary data. When Tcl calls the callback the +first level of braces will be stripped off, leaving old-value and new-value +each as a single string argument. +<p> +<p> +<h2><A NAME="setValue">setValue</A></h2> +<p> +Set the value of a parameter, and notify all clients +via the posted callback procedures that the parameter value has changed. +<p> +Usage: +<p> +<pre> + setValue &lt;new-value&gt; +</pre> +<p> +<h2><A NAME="getValue">getValue</A></h2> +<p> +Get the value of a parameter. +<p> +Usage: +<p> +<pre> + getValue +</pre> +<p> +<h2><A NAME="notify">notify</A></h2> +<p> +Notify the registered clients of a parameter as if the +value had changed. +<p> +Usage: +<p> +<pre> + notify +</pre> +<p> +<h2><A NAME="addCallback">addCallback</A></h2> +<p> +Add a callback procedure to the callback list for +a parameter. +<p> +Usage: +<p> +<pre> + addCallback &lt;procedure-name&gt; +</pre> +<p> +<h2><A NAME="deleteCallback">deleteCallback</A></h2> +<p> +Delete a callback procedure previously registered +for a parameter. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> +<hr noshade=5> + +<hr noshade=5> +</body> +</html> diff --git a/vendor/x11iraf/obm/docs/obm/obm.html b/vendor/x11iraf/obm/docs/obm/obm.html new file mode 100644 index 00000000..b7e531ca --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/obm.html @@ -0,0 +1,2515 @@ +<html> +<body bgcolor=#FFFFFF> +<title>IRAF Object Manager Tutorial</title> + +<center> +<h1>IRAF Object Manager Tutorial</h1> +</center> +<hr noshade=5> + +<h2>Contents</h2> +<ul> +<li><a href="#1">1. Introduction</a> +<li><a href="#2">2. System Architecture</a> +<li><a href="#3">3. The Client Process</a> + <ul> + <li><a href="#3.1">3.1 IRAF Graphics Task</a> + <ul> + <li><a href="#3.1.1">3.1.1 XGterm</a> + </ul> + <li><a href="#3.2">3.2 Standalone Task</a> + <li><a href="#3.3">3.3 OBM Shell</a> + <li><a href="#3.4">3.4 Named External Clients</a> + </ul> +<li><a href="#4">4. UI Definition File</a> + <ul> + <li><a href="#4.1">4.1 Example Interface</a> + </ul> +<li><a href="#5">5. Widget Toolkit</a> +<li><a href="#6">6. Object Classes</a> + <ul> + <li><a href="#6.1">6.1 Client</a> + <ul> + <li><a href="#6.1.1">6.1.1 Command Summary</a> + </ul> + <li><a href="#6.2">6.2 Server</a> + <ul> + <li><a href="#6.2.1">6.2.1 Command Summary</a> + </ul> + <li><a href="#6.3">6.3 Gterm</a> + <ul> + <li><a href="#6.3.1">6.3.1 Command Summary</a> + </ul> + <li><a href="#6.4">6.4 HTML</a> + <ul> + <li><a href="#6.4.1">6.4.1 Command Summary</a> + </ul> + <li><a href="#6.5">6.5 Markers</a> + <ul> + <li><a href="#6.5.1">6.5.1 Command Summary</a> + </ul> + <li><a href="#6.6">6.6 Widget</a> + <ul> + <li><a href="#6.6.1">6.6.1 Command Summary</a> + </ul> + <li><a href="#6.7">6.7 Parameter</a> + <ul> + <li><a href="#6.7.1">6.7.1 Command Summary</a> + </ul> + </ul> +</ul> + +<hr noshade=5> + +<a name="1"></a> +<h3>1. Introduction</h3> +<p> +An Object Manager (OBM) user interface (UI) consists of one or more windows +containing an arbitrary hierarchy of widgets. These widgets and their +runtime actions are defined by an interpreted text program uploaded +by the client application, which does not itself deal directly with the +window user interface. This interpreted program is currently written +as a Tcl script. +<p> +The OBM provides a high level abstraction for dealing with widgets and +other UI objects. The main function of the object manager is to deliver +messages to UI objects. Each instance of a widget is an object in the +interface. The UI contains other types of objects as well, including the +client object (client application), the server object (the object manager +itself), and the application specific UI parameters, each of which is an +object with a callback list of procedures to be called when the parameter +value changes. All of these UI objects can receive messages and take actions +as a result. Messages may come from the client application, or as a result +of actions executed by the interpreted UI code in response to graphics events. +<hr noshade=5> +<p> +<a name="2"></a> +<h3>2. System Architecture</h3> +<p> +For a complete description of the OBM system architecture see Tody, D, +ADASS Proceedings 1994. A <a href="todyd.ps">postscript version of this +paper</a> is also vailable. +<p> +<hr noshade=5> +<p> +<a name="3"></a> +<h3>3. The Client Process</h3> +<p> + The primary advantage of the OBM architecture over traditional GUI +design is the separation of the user interface from the executable client +code, meaning that either can be completely rewritten or developed separately +without affecting the other so long as the messaging between the two +remains the same. The client itself is responsible for initializing the OBM +toolkit and uploading the UI definition file, after that it usually enters +an event loop of some kind (e.g. an iraf graphics cursor loop, or X event +handler) to process actions defined in the client callbacks. +<p> + It's important that the client program maintain the state of the +application rather than the UI file. For example, a text widget in the +interface may instruct the client to load a file, however if this cannot +be done the interface should not have independently reset labels or +whatever assuming the action was done at all. Instead, the client program +uses the Parameter Class objects in the interface to update the state of +the GUI as a result of some action (whose origins may not have been in the +GUI at all). So for example a sequence of events could be something like + +<ul><ul> +<li> User selects a widget in the interface, it's callback sends a + message to the client directing some action be taken +<li> Client receives the message and performs an action in the client +<li> If action fails, (optionally) notify GUI of failure (e.g. send a + message to an 'alert' parameter to popup a dialog box, beep the + terminal, etc) +<li> If action succeeds, notify GUI of new state (e.g. send a message + to the 'filename' Parameter object containing the new file name). +<li> Callback on the 'filename' parameter then updates the status bar + widget with the name of the new active file. +</ul></ul> + +<p> + The messaging between the client and UI depend on the details of how +the client is implemented. In general any callback procedure in the UI can +send a message to any other object in the interface, but the client should +generally communicate only via the Parameter objects to avoid side effects +and maintain a clear separation between the UI and the client code. + +<a name="3.1"></a> +<h3>3.1 IRAF Graphics Task</h3> + +<a name="3.1.1"></a> +<h3>3.1.1 XGterm</h3> + +<a name="3.2"></a> +<h3>3.2 Standalone Task</h3> + +<a name="3.3"></a> +<h3>3.3 OBM Shell</h3> +<p> + The <i>obmsh</i> is a unix shell interpreter for GUI scripts. It is +a minimal standalone client with a single callback to exit the application, +otherwise it's only job is to activate the GUI file. Any messages sent to +the client (except a 'quit') are simply absorbed by the client +<p> + Despite the apparent lack of functionality this is sometimes all +that is required for an interface that can operate independently. Remember +that the Tcl scripting language has it's own facilities for file I/O, +process execution, etc, all of which are still available in the GUI. In +the case of IRAF tasks it's an interface violation to use these facilities +directly, however they still allow for the easy creation of a GUI which +requires no real underlying client (e.g. a tcl debug shell, a calculator +application, task launcher, etc). + +<a name="3.4"></a> +<h3>3.4 Named External Clients</h3> + +<p> +<p> +<hr noshade=5> +<p> +<a name="4"></a> +<h3>4. UI Definition File</h3> +<p> +A UI definition consists of a sequence of commands to be executed by the +server object using Tcl is used as an embedded interpreter within the OBM. +The Tcl script contains several required OBM-specific functions (in +addition to the user-defined callbacks) which is uploaded by the client +as a message for the server object. +<pre> + <a href="#resetReset">reset-server</a> + <a href="#appInitialize">appInitialize</a> appName appClass Resources + <a href="#createObjects">createObjects</a> [name] + <a href="#activate">activate</a> +</pre> +<p> +All UI files must begin with a <b>reset-server</b> command to initialize +the OBM. An <b>appInitialize</b> call is then made to define all of the +widgets and resources used in the interface, initializing the interface +used by the application. The <b>createObjects</b> function then actually +creates the widgets in the server, more specifically it creates the widgets +defined by the named <i>objects</i> resource. Lastly, the <b>activate</b> +call is used to activate the interface, i.e. put it on the screen. + +<p> +<a name="4.1"></a> +<h3>4.1 Example</h3> +A complete "hello, world" GUI definition might look something like: +<pre> + 1) <b>reset-server</b> + 2) <b>appInitialize</b> <i>hello Hello</i> { + 3) *objects:\ + 4) toplevel Form helloForm\ + 5) helloForm Label helloLabel\ + 6) helloForm Command quitButton + 7) + 8) *background: gray + 9) *helloLabel.label: Hello, world! + 10) *quitButton.fromHoriz: helloLabel + 11) *quitButton.label: Quit + 12) } + 13) + 14) <b>createObjects</b> + 15) <b>activate</b> + 16) + 17) <b>proc</b> Quit <b>args</b> { + 18) <b>send client gkey</b> q + 19) <b>deactivate unmap</b> + 20) } ; <b>send</b> quitButton <b>addCallback</b> Quit +</pre> + +where a line-by-line analysis of the GUI shows: + +<dl> +<dt>Line 1: <dd>- The <b>reset-server</b> command must be the first line in +the UI file since it's primary purpose is to initialize the OBM (i.e. a +call to the <i>ObmInitialize()</i> procedure). Subsequent calls (in the +same UI file or a different UI) are effectively a no-op. +<dt>Lines 2-12: <dd>- The <b>appInitialize</b> command defines the widgets +and resources to be used in the interface. The first argument gives the +name of the application, the second argument is the application class name +for purposes of specifying resources in the environment, and the last +argument is a Tcl list (hence the braces) of resources for the application. +<p> +The primary purpose of the call is to initialize the X11 part of the system +by defining the application context and the list of fallback resources. The +<i>objects</i> resource is a required element listing the widget hierarchy +to be used. Remaining resources are used to specify labels, colors, layout, +etc and serve as an app-defaults file for the GUI, interacting with the +normal resource database in the usual way. For example, a user's .Xdefaults +file may specify a "<b>font</b>" resource, unless this is overridden in +some way in the UI file this is the font that will be used. Resources may +be specified with either "loose" (i.e. the '*') or "tight" (i.e. the '.') +bindings with as much detail as is needed. +<dt>Line 14: <dd>- The <b>createObjects</b> command is what actually calls +each widget's Initialize() method to create the widget in the application +and in the X11 server. +<p> +With no argument, the default value used is simply +the <b>objects</b> resource. However, it's possible to specify a named +argument and make repeated calls to <b>createObjects</b> to build any number +widget trees prior to activating the interface. This can be useful for +example to specify a "main_objects" resource contains all the widgets for +the main panel, and a "help_objects" specfiying widgets used for the UI +help panel, which makes the definition file easier to organize. In the +past however UI files were written with a single long list (easily many +hundreds of lines) of objects followed by an even longer list of their +resources under a single <b>appInitialize</b> call, creating a monolithic +and unmanageably GUI definition file. Later on we'll see how complex GUIs +can be divided into separate pieces making it easier to reuse code and +manage the interface more efficiently. +<dt>Line 15: <dd>- The <b>activate</b> command is what creates the interface +on the screen, i.e. it calls the Realize() method for each widget to +instantiate it in the server and draw the window. +<dt>Lines 17-19: <dd>- Lastly we have the user-defined callback procedures. +On line 17 we define a procedure <i>Quit</i> which we use to shut down the +interface and client application. The body of the procedure first sends the +client object the graphics keystroke 'q' to shut down the client, then calls +the <b>deactivate</b> command to close the interface. On the last line +we send a message to the <i>quitButton</i> widget telling it to add this +procedure to it's callback list, so when the Button is selected this +procedure will be called as a result. +</dl> +<p> +<hr noshade=6> + +<a name="5"></a> +<h3>5. Widget Toolkit</h3> +<p> +<p> +<hr noshade=6> + +<a name="6"></a> +<h3>5. Object Classes</h3> +<p> +The following OBM object classes are currently defined: +<pre> + <a href="#6.1">Client</a> The Client application + <a href="#6.2">Server</a> The OBM itself + <a href="#6.3">Gterm</a> Gterm graphics/imaging widget class + <a href="#6.4">HTML</a> HTML widget class + <a href="#6.5">Markers</a> Gterm markers class + <a href="#6.6">Widget</a> General widget class + <a href="#6.7">Parameter</a> UI Parameter class +<p> + Various Xt and Athena widgets + <i>{box, shell, label, command, text, list, etc.}</i> + Misc Other X11 Widgets + <i>{Layout, Tabs, ListTree, etc}</i> +</pre> +<p> +OBM client applications will upload a UI during initialization to define a +custom graphics user interface. This is done by sending a message to the +object manager. Non-GUI applications assume a simple graphics +terminal and do not upload a UI; instead, a default UI is created +for the application consisting of a single top level shell containing a +Gterm (Tek 4012 graphics/imaging) widget. +<p> + +<hr noshade=5> + +<a name="5.1"></a> +<h3>5.1 Client</h3> +<p> +The client is the client application, which provides the functionality +underlying the UI. When a message is sent to the client object it usually +results in a message being sent to the client *application*, usually an +external program communicating via IPC, which has little or no knowledge +of the UI. The client application receives and executes commands delivered +by the UI via the client object. Output from the client may or may not +come back to the object manager. That portion of the output which comes +back to the object manager is in the form of assignments of string values +to <a href="#5.7.html">UI Parameter class objects</a> (another way of thinking +of this is that messages or events are sent to and acted upon by the parameter +objects). Hence, the client object is output only so far as the client +application is concerned. +<p> +The Client-class commands are used to send a message to the client. +<p> +<pre> + <a href="#gkey">gkey</a> &lt;key&gt; + <a href="#gcmd">gcmd</a> &lt;command-string&gt; + <a href="#literal">literal</a> &lt;command&gt; +</pre> +<p> +or just &lt;command&gt;, e.g., "send client &lt;command&gt;" will work in most cases. +<p> +<a href="#gkey">GKEY</a> sends an IRAF graphics keystroke. +<a href="#gcmd">GCMD</a> sends an +IRAF graphics colon command. <a href="#literal">LITERAL</a> sends a literal +command string to the +client. The keyword "literal" may optionally be omitted, i.e., "send client +foo" and "send client literal foo" are the same. The keyword "literal" may +be used to ensure that the client command string which follows will not +be interpreted as a Client-class command (such as gkey, gcmd, or literal). +<p> +<a name="5.1.1"></a> +<h2>5.1.1 Command Summary</h2> +<p> +<h3><A NAME="gcmd">gcmd</A></h3> +<p> +Send a graphics command string to the client application. +A graphics command string is a graphics cursor value with the key set +to `:' and the command string given as the string part of the cursor +value. The protocol module which posted the client output procedure is +responsible for encoding and sending the cursor command. +<p> +Usage: +<p> +<pre> + gcmd &lt;command-string&gt; +</pre> +<p> +<h3><A NAME="gkey">gkey</A></h3> +<p> +Send a graphics key event to the client application. +A graphics key event is a graphics cursor value with the key set to some +integer value and a null string part. +<p> +Usage: +<p> +<pre> +gkey &lt;key&gt; +</pre> +<p> +<h3><A NAME="literal">literal</A></h3> +<p> +Send a literal command to the client application. +<p> +Usage: +<p> +<pre> + literal &lt;command&gt; +</pre> + +<hr noshade=5> + +<a name="6.2"></a> +<h3>6.2 Server</h3> +<p> +The server, or object manager, is the control center of the user interface. +The server object provides a Tcl interpreter calling custom object manager +commands. These are used to define and initialize the user interface, and +execute UI action procedures at runtime. +<p> +<pre> + <a href="#resetReset">reset-server</a> + <a href="#appInitialize">appInitialize</a> appname,appclass,resources + <a href="#createObjects">createObjects</a> [resource-name] + <a href="#destroyObject">destroyObject</a> object + <a href="#activate">activate</a> + <a href="#deactivate">deactivate</a> [unmap] +<p> + value = <a href="#getResource">getResource</a> resource-name [default-value [class]]</a> + <a href="#getResources">getResources</a> resource-list +<p> + <a href="#createMenu">createMenu</a> menu-name parent item-list + <a href="#createMenu">editMenu</a> menu-name parent item-list + <a href="#destroyMenu">destroyMenu</a> menu-name +<p> + <a href="#createBitmap">createBitmap</a> name width height data + <a href="#createCursor">createCursor</a> name source mask fg_color bg_color x_hot y_hot + <a href="#createPixmap">createPixmap</a> name width height depth fg_color bg_color data +<p> + <a href="#print">print</a> arg [arg ...] # debug messages + <a href="#send">send</a> object message +<p> + <a href="#postActivateCallback">postActivateCallback</a> procedure +id = <a href="#postTimedCallback">postTimedCallback</a> procedure msec [client-data] + <a href="#deleteTimedCallback">deleteTimedCallback</a> id + id = <a href="#postWorkCallback">postWorkCallback</a> procedure [client-data] + <a href="#deleteWorkCallback">deleteWorkCallback</a> id +</pre> + +<a name="6.2.1"></a> +<h2>6.2.1 Command Summary</h2> +<p> +<h3><A NAME="serverReset">serverReset</A></h3> +<p> +The "reset-server" command is implemented as a special case in ServerEvaluate. +After doing a true reset ServerEvaluate calls Tcl_Eval to evaluate the full +message which still contains the reset-server command. We want to ignore +this the second time, so we treat the command here as a no-op. +<p> +Usage: +<p> +<pre> + reset-server +</pre> +<p> +Note: for reset-server to be recognized by ServerEvaluate and really reset +things, it must be the first command in a message to the server. +<p> +<h3><A NAME="appInitialize>appInitialize</A></h3> +<p> +TCL command to initialize the server for a new application, setting the +application name and loading the application resources. +<p> +Usage: +<p> +<pre> + appInitialize appname, appclass, resources +</pre> +<p> +<h3><A NAME ="createObjects">createObjects</A></h3> +<p> +TCL command to create the tree of UI objects comprising the user interface. +The object tree is defined by a string valued resource. If no resource is +named the default "objects" resource will be used. +<p> +Usage: +<p> +<pre> + createObjects [resource-name] +</pre> +<h3><A NAME="destroyObject">destroyObject</A></h3> +<p> +Destroy an object and all of its children. +<p> +Usage: +<pre> + destroyObject object-name +</pre> +<p> +<h3><A NAME="activate">activate</A></h3> +Activate the user interface. When called the first time the user interface +is created and activated, thereafter the UI is merely reactivated (e.g. +mapped if unmapped). +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h3><A NAME="deactivate">deactivate</A></h3> +<p> +Deactivate the user interface. Optionally unmaps the UI and calls the Obm +client back to let it know that the UI has been deactivated. +<p> +Usage: +<p> +<pre> + deactivate [unmap] +</pre> +<p> +<h3><A NAME="getResource">getResource</A></h3> +<p> +Get the string value of the specified application resource (window +system parameter). This allows use of the resource mechanism to supply +default values for GUI parameters. +<p> +Usage: +<p> +<pre> + value = getResource resource-name [class [default-value]] +</pre> +<p> +In the simplest case one merely requests a resource by name and the +string value is returned as the function value. If the resource has +an entry in the fallback resources for the application (appInitialize +resource list) then a value is guaranteed to be returned. +<p> +If the Class name for the resource is given then a class default value +will be returned if no entry is found for the name resource instance. This +is useful when there are a number of resources of the same type (same class). +If most or all resources in the same class have the same default value one +need only make one entry for the Class in the application defaults resource +list. It is up to the application developer to define the class name of a +resource - the class name can be any string. Examples are "Font", "Cursor", +etc. By convention the first character of a class name is capitalized, while +instance names begin with a lower case letter. +<p> +If there is an entry for the named resource in the resource list passed to +appInitialize then a value string is guaranteed to be returned. This will be +either the appInitialize default, or a value specified by the system or the +user in an X resources file. If one is not certain a default value is defined +somewhere, a default value should be specified in the getResource call as +shown above. +<p> +See also getResources, used to get multiple resources in one call. +<p> +<h3><A NAME="getResources">getResources</A></h3> +<p> +Get the string values of a list of resources. +<p> +Usage: +<p> +<pre> + getResources resource-list +</pre> +<p> +e.g. +<pre> + getResources { + { resource [variable class [default-value]]] } + { resource [variable class [default-value]]] } + (etc.) + } +</pre> +<p> +<h3><A NAME="createMenu">createMenu, editMenu</A></h3> +<p> +Create or modify a menu. The editMenu function is an alias for createMenu. +<p> +Usage: +<pre> + createMenu menu-name parent item-list +</pre> +<p> +e.g., +<pre> + createMenu menu-name parent { + { label function data [options...] } + { label function data [options...] } + (etc.) + } +</pre> +<p> +where +<p> +<pre> + menu-name is the object name for the menu popup shell + parent is the parent widget of the menu shell + label is a menu item label + function is the function to be performed when the menu + item is selected, e.g., f.exec, f.data, f.space, or f.line. + data is function dependent data + options are option-name option-value pairs, as specified + below. +</pre> +<p> +In the item list the fields label and option-value may be any Tcl expression. +Expressions are evaluated in the server context. The data field is a Tcl +script to be executed when the menu item is selected. +<p> +Options are specified as "option option-value". The menu item options are +as follows. +<p> +<pre> + bitmap A bitmap to be displayed left justified in the label field + (e.g. to indicate a parameter setting). + sensitive Specifies whether the menu item is active (sensitive=true) + or inactive (sensitive=false, item grayed out). + accelerator Specifies an input translation (accelerator, e.g., + keyboard event) which can be used to execute the + menu item. +</pre> +<p> +The option-value field may be any Tcl expression. +<p> +Example: +<p> +<pre> + createMenu fileMenu toplevel { + { "File Menu" f.title} + { Open f.exec openFile} + { Save f.exec saveFile} + { Load f.menu loadMenu} + { no-label f.line } + { Quit f.exec "send client Quit" } + } +</pre> +<p> +The first createMenu is called for a given menu the menu is created, added +to the menu list, and all window system widgets are created for the menu. +Subsequent calls will result in only the changed parts of the menu being +altered provided the changes are not great. Hence this routine can be called +to efficiently modify a menu when minor runtime changes occur, e.g., an +item label or action changes, the item value changes state, and so on, +without need for the GUI code to know how to make the necessary detailed +changes to the widgets used to implement the menu. +<p> +<h3><A NAME="destroyMenu">destroyMenu</A></h3> +<p> +Destroy a menu. This can be used to free up the resources used by a +menu, e.g., if the menu is not expected to be needed again for a while. +<p> +Usage: +<p> +<pre> + destroyMenu menu-name +</pre> +<p> +<h3><A NAME="createBitmap">createBitmap</A></h3> +<p> +Create a named bitmap. This replaces any old bitmap of the same name. The +new bitmap is cached in server memory; when a widget bitmap resource is set, +the bitmap cache will be searched for the named bitmap before asking Xlib +to find the bitmap. +<p> +Usage: +<p> +<pre> + createBitmap name width height data +</pre> +<p> +e.g., +<p> +<pre> + createBitmap foo 16 16 { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +<p> +<h3><A NAME="createCursor">createCursor</A></h3> +<p> +Create a cursor from bitmap data. The cursor is entered into the server's +cursor cache and will override any existing entry of the same name. +<p> +Usage: +<p> +<pre> + createCursor name source mask fg_color bg_color x_hot y_hot +</pre> +<p> +e.g., +<p> +<pre> + createCursor foo bitmap1 bitmap2 black white 8 8 +</pre> +<p> +The named bitmaps must be created first with createBitmap. +<p> +<h3><A NAME="createPixmap">createPixmap</A></h3> +<p> +Create a named pixmap. This replaces any old pixmap of the same name. The +new pixmap is cached in server memory; when a widget pixmap resource is set, +the pixmap cache will be searched for the named pixmap before asking Xlib +to find the pixmap. +<p> +Usage: +<p> +<pre> + createPixmap name width height depth fg_color bg_color data +</pre> +<p> +e.g., +<p> +<pre> + createPixmap foo 16 16 8 black white { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +</pre> +<p> +<h3><A NAME="print">print</A></h3> +<p> +Print a string on the standard output. This is used mainly for debugging +user interfaces. +<p> +Usage: +<p> +<pre> + print arg [arg ...] +</pre> +<p> +<h3><A NAME="send">send</A></h3> +<p> +Send a message to an object. The object interprets the message and returns +a function value as the string result of the TCL command. +<p> +Usage +<p> +<pre> + send &lt;object&gt; &lt;message&gt; +</pre> +<p> +<h3><A NAME="postActivateCallback">postActivateCallback</A></h3> +<p> +Post a callback procedure to be called when the UI is activated. The UI is +activated when it is first downloaded to server, but it may also be +activated (reactivated) after the application has exited and is later +restarted, or when the UI is deactivated and reactivated. Note +that the UI state vis-a-vis the external world (client application) may +no longer be accurate after it has been idle for a time and then reactivated. +<p> +Usage: +<p> +<pre> + postActivateCallback &lt;procedure&gt; +</pre> +<p> +<p> +<h3><A NAME="postTimedCallback">postTimedCallback</A></h3> +<p> +Post a callback to call the named procedure back after a specified delay +in milliseconds. +<p> +Usage: +<p> +<pre> + id = postTimedCallback procedure msec [client-data] +</pre> +<p> +After the specified delay the user callback procedure will be called with +client_data (if given) as the single argument. Only one call will be made; +the client must repost the callback in each call if the procedure is to be +repeatedly executed. +<p> +An ID value is returned which may be passed to deleteTimedCallback to delete +the timer. +<p> +<h3><A NAME="deleteTimedCallback">deleteTimedCallback</A></h3> +<p> +Delete a timer callback procedure. This procedure is typically used to +break a timer loop, where the timer procedure repeatedly reposts itself at +the end of each interval. +<p> +Usage: +<p> +<pre> + deleteTimedCallback id +</pre> +<p> +The ID string is returned by postTimedCallback when a timer is posted. +<p> +<h3><A NAME="postWorkCallback">postWorkCallback</A></h3> +<p> +Post a callback for a procedure to be called when the server is idle. +Work procedures are used to perform computations in the background while +the user interface remains active and able to respond to input events. +This works only if the user work procedure does its job in small increments, +doing only a small amount of processing in each call. The work procedure +will be called repeatedly until it returns a status indicating that it has +finished its task. +<p> +Usage: +<p> +<pre> + id = postWorkCallback procedure [client-data] +</pre> +<p> +When the server has nothing else to do the user work procedure will be +called with client_data (if given) as the single argument. The work procedure +should return the string "done" when all processing is finished, or any other +string if the procedure is to be called again. +<p> +An ID value is returned which may be passed to deleteWorkCallback to delete +the work procedure. +<p> +<h3><A NAME="deleteWorkCallback">deleteWorkCallback</A></h3> +<p> +Delete a work callback procedure. +<p> +Usage: +<p> +<pre> + deleteWorkCallback id +</pre> +<p> +The ID string is returned by postWorkCallback when a work procedure is posted. + +<hr noshade=5> + +<a name="6.3"></a> +<h3>6.3 Gterm</h3> +<p> +The gterm-image widget is a general 2D graphics-imaging widget providing +a wide range of facilities for drawing graphics and text, for image +display, and for graphics interaction. Normally the client communicates +directly with the Gterm widget to draw graphics, download image data, +and so on, using some communications protocol outside the domain of the +object manager. Nonetheless so far as possible the facilities of the Gterm +widget have also been made available to GUI code via the commands listed +here. +<p> +The Gterm widget adds the following function to the OBM library. +<p> +<pre> + ObmPostSetGtermCallback (obm, &setgterm, setgterm_client_data) +</pre> +<p> +This is called by a client application to post a procedure to be called +when a gterm widget receives the setGterm command. The calling sequence +for setGterm callback is as follows: +<p> +<pre> + setgterm (client_data, gterm_widget) +</pre> +<p> +The purpose of this callback is to tell the client which gterm widget is +the "active" gterm widget. This is used by clients which only support +one active Gterm widget, i.e., which can only direct graphics output to +one Gterm widget at a time. +<p> +The messages or commands that can be sent to the Gterm widget by GUI +code follow. +<p> +General commands: +<p> +<pre> + <a href="#setGterm">setGterm</a> # make widget the active Gterm +<p> + <a href="#activate">activate</a> + <a href="#deactivate">deactivate</a> + <a href="#addCallback">addCallback</a> procedure-name callback-type + <a href="#reset">reset</a> + <a href="#flush">flush</a> +<p> + <a href="#setCursorPos">setCursorPos</a> x y [raster] + <a href="#getCursorPos">getCursorPos</a> x y + <a href="#setCursorType">setCursorType</a> cursortype + <a href="#bell">bell</a> +</pre> +<p> +Graphics drawing commands: +<p> +<pre> + <a href="#setRaster">setRaster</a> raster + raster = <a href="#getRaster">getRaster</a> [raster] +<p> + <a href="notyet.html">setLogRes</a> width height + <a href="notyet.html">getLogRes</a> width height + <a href="notyet.html">setPhysRes</a> width height + <a href="notyet.html">getPhysRes</a> width height + <a href="notyet.html">setTextRes</a> rows cols + <a href="notyet.html">setDataLevel</a> level + <a href="notyet.html">setLineWidth</a> width + <a href="notyet.html">setLineStyle</a> style + <a href="notyet.html">setColorIndex</a> index + <a href="notyet.html">setFillType</a> filltype +<p> + <a href="#clearScreen">clearScreen</a> + <a href="notyet.html">drawPolyline</a> vector + <a href="notyet.html">drawPolymarker</a> vector + <a href="notyet.html">drawPolygon</a> vector + <a href="notyet.html">drawMarker</a> x y xsize ysize type +<p> + <a href="notyet.html">drawAlphaText</a> x y text + <a href="notyet.html">getAlphaTextSize</a> string width height base + <a href="notyet.html">startDialog</a> + <a href="notyet.html">endDialog</a> + <a href="notyet.html">eraseDialog</a> + <a href="notyet.html">drawDialogText</a> x y text + <a href="notyet.html">getDialogTextSize</a> string width height base +</pre> +<p> +The coordinates used in the graphics drawing commands are logical +coordinates as defined by setLogRes, in the coordinate system of the +reference drawing raster as defined by setRaster. The default reference +raster is raster zero, the widget's window. Vectors are specified as +a list of points, e.g., { {x y} {x y} ... }. +<p> +Imaging commands: +<p> +<pre> + <a href="#rasterInit">rasterInit</a> + <a href="notyet.html">assignRaster</a> raster drawable + <a href="notyet.html">createRaster</a> raster type width height depth + <a href="notyet.html">destroyRaster</a> raster + exists = <a href="notyet.html">queryRaster</a> raster type width height depth + raster = <a href="notyet.html">nextRaster</a> [raster] + nrasters = <a href="notyet.html">nRasters</a> [nrasters] +<p> + <a href="#setPixel">setPixel</a> raster x y value + value = <a href="#getPixel">getPixel</a> raster x y + <a href="#writePixels">writePixels</a> raster pixels encoding x1 y1 nx ny + <a href="#readPixels">readPixels</a> raster pixels encoding x1 y1 nx ny + <a href="notyet.html">refreshPixels</a> raster ct x1 y1 nx ny + pixmap = <a href="notyet.html">createPixmap</a> src x y width height + <a href="notyet.html">copyPixmap</a> pixmap dst x y width height +<p> + colormap = <a href="notyet.html">nextColormap</a> [colormap] + <a href="notyet.html">freeColormap</a> colormap + <a href="notyet.html">writeColormap</a> colormap first nelem colors + <a href="notyet.html">readColormap</a> colormap first nelem colors + <a href="#loadColormap">loadColormap</a> colormap offset scale +<p> + <a href="notyet.html">initMappings</a> + mapping = <a href="#nextMapping">nextMapping</a> [mapping] + <a href="notyet.html">freeMapping</a> mapping + <a href="notyet.html">enableMapping</a> mapping + <a href="notyet.html">disableMapping</a> mapping + active = <a href="notyet.html">activeMapping</a> mapping + <a href="notyet.html">refreshMapping</a> mapping +<p> + raster = <a href="#selectRaster">selectRaster</a> dras dt dx dy rt rx ry [map] + <a href="#unmapPixel">unmapPixel</a> sx sy raster rx ry [rz] +<p> + <a href="notyet.html">copyRaster</a> rop src st sx sy snx sny dst dt dx dy dnx dny + <a href="#setMapping">setMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny + <a href="#getMapping">getMapping</a> mapping rop + src st sx sy snx sny dst dt dx dy dnx dny +<p> + <a href="#flip">flip</a> mapping axis [axis...] +</pre> +<p> +Pixel arrays are long strings consisting either of a sequence of numeric +pixel values separated by whitespace (space or newline), or a hex encoded +sequence of bytes (2 hex digits per 8 bit pixel). Colors are specified +as a list of RGB triplets, e.g., { {R G B} {R G B} ... }. +<p> +Refer to the documentation for the Gterm widget for a detailed description +of rasters, mappings, and colormaps. +<p> +Markers: +<p> +<pre> + <a href="#createMarker">createMarker</a> name [attribute-list] + <a href="#markerInit">markerInit</a> +</pre> +<p> +New markers may be created with createMarker. Once created, a marker +functions under the Object Manager as a named object of class "marker". +Refer to the marker class for a description of the commands defined for +a marker. +<p> +gterm Actions List +<p> +<pre> + ignore + graphics-input + graphics-context + crosshair + track-cursor + enter-window + leave-window + popup-menu {not implemented} + reset + m_create +</pre> +<p> +Default translations for Gterm window. +Omitted for now: Ctrl ~Meta <Btn3Down>: popup-menu(tekMenu) +<p> +default Gterm Translations +<p> +<pre> + [Btn1Down]:m_create() + [Btn2Down]:crosshair(on) + [Btn2Motion]:crosshair(on) + [Btn2Up]:crosshair(off) + ~Ctrl ~Meta [Btn3Down]:graphics-context() + [EnterWindow]:enter-window() + [LeaveWindow]:leave-window() + [KeyPress]:graphics-input() + [Motion]:track-cursor() +</pre> +<p> +<p> +<a name="6.3.1"></a> +<h2>6.3.1 GTERM class commands</h2> +<p> +<h3><A NAME="setGterm">setGterm</A></h3> +<p> +Set the active Gterm widget. A UI can have more than one +gterm widget, but due to restrictions on the client-server interface, it +may be possible for only one to receive client output at any one time (any +gterm widget can generate input to be sent to the client). If the client +has this restriction, the client-server interface code which uses OBM can +call the ObmPostSetGtermCallback procedure to post a function to be called +when the UI code calls the setGterm procedure. +<p> +Usage: +<p> +<pre> + setGterm +</pre> +<p> +<h3><A NAME="activate">activate</A></h3> +<p> +Activate the gterm widget. This causes the next GIN mode +setCursorType to warp the pointer into the gterm window. +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h3><A NAME="deactivate">deactivate</A></h3> +<p> +Deactivate the gterm widget. If the cursor has been warped +into the window by a previous activate/setCursorType GIN mode, this causes +the cursor to be warped back to where it was previously. +<p> +Usage: +<p> +<pre> + deactivate +</pre> +<p> +<h3><A NAME="reset">reset</A></h3> +<p> +Reset the gterm widget. This causes a number of state variables +affecting graphics drawing options to be set to their default values. +<p> +Usage: +<p> +<pre> + reset +</pre> +<p> +<h3><A NAME="flush">flush</A></h3> +<p> +Flush any graphics output and synchronize the state of the widget +with what is shown on the display. +<p> +Usage: +<p> +<pre> + flush +</pre> +<p> +The gterm widget uses XLIB, which buffers graphics drawing commands and +automatically sends them to the X server when 1) the buffer fills, +2) input is requested from the server. Such buffering of data is necessary +for efficient operation and it should rarely be necessary to explicitly +flush graphics output since XLIB does this automatically in most cases. +An example of when explicitly flushing the ouptut might be necessary is in +cases where smooth animation is desired and drawing the graphics in batches +could cause the display to appear "jerky". +<p> +<h3><A NAME="addCallback">addCallback</A></h3> +<p> +Post a callback for a Gterm widget event. +<p> +Usage: +<p> +<pre> + addCallback procedure-name [callback-type] +</pre> +<p> +The recognized Gterm callbacks are +<p> +<pre> + + input Called when the graphics-input action is invoked in + a translation table. The default Gterm translation + table invokes this action when a KeyPress event occurs + in the Gterm window. + Callback: widget-name input-type event-data + + resize Called when the gterm window is resized. + Callback: widget-name width height + + reset Called when the "reset" action is invoked. + Callback: widget-name + +</pre> +<p> +If no callback is specified the default is "input". +<p> +Note that in GUI code one can also use the translation table to directly +invoke GUI procedures without need to use the Gterm input mechanism. This +is more flexible but we support the Gterm input callback here for +applications that use the default translations. +<p> +<h3><A NAME="setCursorPos">setCursorPos</A></h3> +<p> +Warp the cursor (pointer) to the given coordinates. This +is a graphics drawing command and if no raster number is specified the +current reference drawing raster, as set with setRaster, defines the +coordinate system. +<p> +Usage: +<p> +<pre> + setCursorPos x y [raster] +</pre> +<p> +A raster number may optionally given to define the raster coordinate system +to be used. raster=0 yields screen coordinates. +<p> +<h3><A NAME="getCursorPos">getCursorPos</A></h3> +<p> +Get the cursor position (raster 0 or screen coordinates). +<p> +Usage: +<p> +<pre> + getCursorPos x y +</pre> +<p> +<h3><A NAME="setCursorType">setCursorType</A></h3> +<p> +Set the cursor type. +<p> +Usage: +<p> +<pre> + setCursorType cursor-type + + idle default cursor + busy busy cursor, e.g, when program is busy + ginMode graphics input mode cursor, set when program is + waiting for graphics input +</pre> +<p> +<h3><A NAME="bell">bell</A></h3> +<p> +Gterm widget sound output. +<p> +Usage: +<p> +<pre> + bell +</pre> +<p> +<h3><A NAME="setRaster">setRaster</A></h3> +<p> +Set the number of the raster to be used to define the drawing +context (e.g. coordinate system) for graphics and text drawing functions. +<p> +Usage: +<p> +<pre> + setRaster raster-number +</pre> +<p> +<h3><A NAME="getRaster">getRaster</A></h3> +<p> +Get the number of the raster which defines the drawing +context, as set in the last setRaster call. +<p> +Usage: +<p> +<pre> + raster = getRaster [raster] +</pre> +<p> +If the name of a variable is given the raster number will be stored +directly in that variable. +<p> +<h3><A NAME="clearScreen">clearScreen</A></h3> +<p> +Clear the "screen", i.e., window. This action clears the +drawing window and sets a number of drawing state variables to their default +values. +<p> +Usage: +<p> +<pre> + clearScreen +</pre> +<p> +<h3><A NAME="rasterInit">rasterInit</A></h3> +<p> +Initialize the raster subsystem, deleting all rasters and +mappings and freeing the dynamic part of the colortable. +<p> +Usage: +<p> +<pre> + rasterInit +</pre> +<p> +<h3><A NAME="writePixels">writePixels</A></h3> +<p> +Set the values of some subset of the pixels in a raster. +If any mappings are defined on the affected region and are enabled, any +destination rasters will be automatically updated as defined by the mapping. +<p> +Usage: +<p> +<pre> + writePixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be written. +</pre> +<p> +Most real-world image processing applications get the Gterm widget handle +with setGterm and pass binary data to the widget by calling GtWritePixels +directly. This is the most efficient approach for serious image processing +where large amounts of data are involved. However, being able to read and +write raster pixels directly in a GUI can be useful in specialized +applications, e.g., where the image is computed or modified by the GUI. +<p> +<h3><A NAME="setPixel">setPixel</A></h3> +<p> +Set the value of a single pixel. +<p> +Usage: +<p> +<pre> + setPixel raster x y value + + raster The raster number. + x, y The pixel to be set. + value The pixel value. +</pre> +<p> +This routine is more efficient than writePixels for setting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be set. +<p> +<h3><A NAME="readPixels">readPixels</A></h3> +<p> +Get the values of some subset of the pixels in a raster. +<p> +Usage: +<p> +<pre> + readPixels raster pixels encoding nbits x1 y1 nx ny + + raster The raster number. + pixels The pixel array, encoded as a string. + encoding The pixel encoding. "numeric" means each pixel is + encoded as a decimal integer delimited by whitespace. + "hex" means the pixel array is hex encoded, 2 bytes + per 8 bit pixel, as a printable text string. The + two bytes are defined as follows (v = pixel value): + + byte1 = ((v >> 4) & 017) in hex [0-9A-F] + byte2 = ((v ) & 017) in hex [0-9A-F] + + Whitespace in a hex encoded string is ignored. + Hex encoding reduces the data volume by about a factor + of two (compared to numeric) and is only a factor of + two less space efficient than binary. + + nbits Number of bits per pixel - currently only 8 bit pixels + are supported. + + x1,y1,nx,ny Region of the raster to be read. +</pre> +<p> +Use readPixels to read a block of pixels, and getPixel to get the value +of a single pixel. +<p> +<h3><A NAME="getPixel">getPixel</A></h3> +<p> +Get the value of a single pixel. +<p> +Usage: +<p> +<pre> + getPixel raster x y + + raster The raster number. + x, y The pixel to be set. +</pre> +<p> +This routine is more efficient than readPixels for getting the value of +a single pixel, but is a lot less efficient if a block of pixels are to +be read. +<p> +<h3><A NAME="nextMapping">nextMapping</A></h3> +<p> +Return the index of the next unused mapping. +<p> +Usage: +<p> +<pre> + nextMapping +</pre> +<p> +Returns the mapping number as the function value. +<p> +<h3><A NAME="getMapping">getMapping</A></h3> +<p> +Get a mapping. +<p> +Usage: +<p> +<pre> + getMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters except the mapping number are output parameters. +<p> +<h3><A NAME="setMapping">setMapping</A></h3> +<p> +Set a mapping. +<p> +Usage: +<p> +<pre> + setMapping mapping rop src st sx sy snx sny dst dt dx dy dnx dny +</pre> +<p> +All parameters are input parameters. +<p> +<h3><A NAME="loadColormap">loadColormap</A></h3> +<p> +Load a colormap. +<p> +Usage: +<p> +<pre> + loadColormap colormap [offset [scale]] +</pre> +<p> +The offset and scale parameters may be used to adjust the brightness and +contrast of the image when the colormap is loaded. The normalized colormap +has offset=0.5, scale=1.0. Colormap zero is the hardware colormap. +<p> +<h3><A NAME="selectRaster">selectRaster</A></h3> +<p> +Given the raw screen coordinates SX,SY (or coords in +any destination raster), determine the mapping and source raster which are +mapped to that pixel and return the raster and mapping numbers and the +coordinates of the same pixel in the source raster. +<p> +Usage: +<p> +<pre> + raster = selectRaster dras dt dx dy rt rx ry [map] +</pre> +<p> +where +<p> +<pre> + dras display raster + dt,rt coordinate type - "pixel" or "ndc" + dx,dy display raster coordinates (input) + rx,ry source raster coordinates (output) + map mapping selected (output) +</pre> +<p> +Note that the coordinates returned by selectRaster are measured (taking +a line as an example) from zero at the left edge of the first pixel, to +"width" at the right edge of the last pixel. This means that the floating +point coordinates of the center of raster pixel N will be N + 0.5. For +example, if we input screen coordinates (dras=0), x=117, and no mapping +is in effect, the floating point raster coordinates returned will be 117.5. +The difference occurs because the input coordinate is a pixel number +(integer) while the output coordinate is a floating point coordinate +measuring the continuously variable location a pixel. int(x) will convert +this coordinate to a raster pixel number. +<p> +<h3><A NAME="unmapPixel">unmapPixel</A></h3> +<p> +unmapPixel is a simplified, less general version of +selectRaster which will automatically follow graphics pipelines back to +the original mapped raster. If desired the raster pixel value can be +returned as well as the raster number and raster pixel coordinates +corresponding to a screen (raster 0) pixel. +<p> +Usage: +<p> +<pre> + unmapPixel sx sy raster rx ry [rz] +</pre> +<p> +where +<p> +<pre> + sx,sy "screen" (raster 0) coordinates + raster original mapped raster (output) + rx,ry source raster coordinates (output) + rz source raster pixel value (output) +<pre> +<p> +By following graphics pipelines back to the original source raster we mean +the following. If raster A is mapped to raster B which is mapped to C (the +screen), given a screen coordinate in the mapped region unmapPixel will +return the raster number and coordinates for raster A. +<p> +<h3><A NAME="flip">flip</A></h3> +<p> +Edit a mapping to flip the mapped subimage in X and/or Y. +<p> +Usage: +<p> +<pre> + flip mapping axis [axis] +</pre> +<p> +where axis is "x" or "y". This is a convenience routine for changing only +the flip portion of a mapping. +<p> +<h3><A NAME="markerInit">markerInit</A></h3> +<p> +Initialize the Marker subsystem for a Gterm widget. +This destroys all markers and initializes the marker subsystem. +<p> +Usage: +<p> +<pre> + markerInit +</pre> +<p> +<h3><A NAME="createMarker">createMarker</A></h3> +<p> +Create a new marker. +<p> +Usage: +<p> +<pre> + createMarker name attribute-list + e.g. createMarker name {attribute value [attribute value ...]} + or createMarker name attribute value [attribute value ...] +<pre> +<p> +Any marker attribute may be assigned a value when the marker is created. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker attribute names. Often the +the attributes "type" and "createMode" need to be specified at marker +create time. +<p> +<pre> + type The marker type: text, rectangle, circle, etc. + + createMode A marker should be created with createMode=interactive + if the user is expected to interactively drag out + the marker using the pointer and either the default + or an application specified translation table. A + marker can also be created interactively using only + the m_create (marker create) action, however m_create + does not allow the marker attributes to be set. +<pre> +<p> +There are any number of ways to use a GUI to create a marker under the +Object Manager, but an example might be using a translation to call a GUI +procedure which issues the createMarker call. For example a pointer down +event could translate as "call(newMarker,$name,$x,$y) m_create()" where +newMarker is a GUI marker creation procedure which sends a createMarker +message to the Gterm widget. The GUI procedure could set the marker +attributes as desired, possibly using additional GUI components to define +the marker attributes. The m_create action will notice that a +createMarker has been executed and will merely activate the marker and +give it the pointer focus (i.e. install the marker translations). The +user will then use the pointer or keyboard to drag out the marker. +<p> +If the marker is created noninteractive the application must set the marker +position and size using marker attributes. If the marker is sensitive +the user can then use the marker's translations to interactively modify +the marker (resize it, move it, etc.). All markers which are visible and +sensitive and which have the necessary translations can be interactively +modified by the user; the reason for creating a marker in interactive mode +is to allow the initial marker position and size to be specified +interactively *when* the marker is created, instead of afterwards. +<p> +Any number of attributes may be given when the marker is created. Most +marker attributes can also be modified after a marker has been created +by sending setAttribute messages to the marker. + +<hr noshade=5> + +<a name="6.4"></a> +<h3>6.4 HTML</h3> + +The HTML (hypertext markup language) widget displays a block of HTML +formatted text, the "document" to be displayed. The text consists of a +mixture of text to be displayed and embedded formatting directives. The +text may also contain "hot links" pointing to other HTML-formatted +documents. + +<pre> + setText text [target [header_text [footer_text]]] + text = getText [format [font]] + retestAnchors + + id = positionToId x y + idToPosition id x y + anchorToPosition name x y + id = anchorToId name + gotoId id + + n = getHRefs list + n = getImageSrcs list + n = getLinks list + + setSelection start end + text = getSelection start end + clearSelection + + searchText pattern start end [direction [search_type]] + + addCallback procedure-name [callback-type] + deleteCallback procedure-name [callback-type] +</pre> + +The possible callback types and their callback arguments are as follows. + +<pre> + anchor widget cbtype event text href element_id + testAnchor widget cbtype href + submitForm widget cbtype event attrs href method enctype encentity + link widget cbtype href role + pointerMotion widget cbtype href +</pre> + +See the comments below for further details on the callback types and their +arguments. + +<p> +<a name="6.4.1"></a> +<h2>6.4.1 Command Summary</h2> +<p> + +<hr noshade=5> + +<a name="6.5"></a> +<h3>6.5 Markers</h3> +<p> +A marker is a graphics object implemented by the Gterm-Image widget. +Markers are not real toolkit widgets, but they act much like widgets and +are interfaced as an object class under the Object Manager. The Marker +class is not a subclass, it is a base class like Widget, but Marker objects +can exist only as children of Gterm widgets. +<p> +Since markers are not independent widgets but rather part of a Gterm widget +instance, the parent Gterm widget is partially responsible for managing +markers. The Gterm widget implements the following commands for dealing +with markers. +<p> +<pre> + <a href="gtermclass.html#createMarker">createMarker</a> name [attribute-list] + <a href="gtermclass.html#markerInit">markerInit</a> +</pre> +<p> +A new marker is created by sending the createMarker message to the parent +gterm widget. This creates a marker of the given name and type. +The markerInit command, if sent to a gterm widget, destroys any markers +defined for that widget and reinitializes the marker facility. Markers +may also be created by action procedures in response to user input events. +<p> +A marker may be destroyed by itself in response to an input event (e.g. the +user presses the delete key), by sending the marker the destroy message +to tell it to destroy itself, by sending a markerInit to the parent gterm +widget, or by destroying the marker object (or any parent) with the server +command <a href="#destroyObject">destroyObject</a>. +<p> +Once a marker has been created it behaves as an independent object and +receives and executes messages, responds to events, generates callbacks, +and so on. The marker class defines the following commands. +<p> +<pre> + <a href="#makeCopy">makeCopy</a> name + <a href="#addCallback">addCallback</a> procedure [event [event ...]] + <a href="#notify">notify</a> [event-type [param [param ...]]] + <a href="#destroy">destroy</a> [nocallback] +<p> + <a href="#markpos">markpos</a> + <a href="#redraw">redraw</a> [function] [markpos|nomarkpos] [erase|noerase] +<p> + <a href="#raise">raise</a> [reference-marker] + <a href="#lower">lower</a> [reference-marker] +<p> + <a href="#move">move</a> x y + <a href="#resize">resize</a> width height + <a href="#rotate">rotate</a> angle # radians +<p> + <a href="#setAttribute">set</a> attribute value # alias for setAttribute + value = <a href="#getAttribute">get</a> attribute # alias for getAttribute +<p> + <a href="#setAttribute">setAttribute</a> attribute value + value = <a href="#getAttribute">getAttribute</a> attribute + <a href="#setAttributes">setAttributes</a> attribute-list + <a href="#getAttributes">getAttributes</a> attribute-list + <a href="#setVertices">setVertices</a> points first npts + <a href="#getVertices">getVertices</a> points first npts +<p> + region = <a href="#getRegion">getRegion</a> [unmap] [coord-type] + <a href="#getRect">getRect</a> dx dy dnx dny +</pre> +<p> +Marker positions and dimensions are given in window (raster 0) coordinates. +<p> +The operators raise, lower, move, resize, and rotate erase the marker, +modify it as indicated, and redraw it with the new attributes. For finer +control over marker attributes one can use [get|set]Attribute[s] and +[get|set]Vertices to edit the markers directly. In this case an auto +redraw is not performed (unless the autoRedraw marker attribute is set). +The usual sequence is a markpos to record the marker position, one or more +setAttribute calls to change marker attributes, then a redraw to erase +the old marker and redraw the new one. Markers have many attributes which +can be set to control things like the position and size, colors, line +widths, fill type and style, font, rubber-band technique, and so on. +Refer to &lt;ObmW/Gterm.h&gt; for a list of marker types and attributes. +<p> +The marker type may be changed at runtime without destroying the marker. +For example a circle can be changed to an ellipse or a rectangle. This +also works for polygons (the vertex list is preserved and restored when +the marker is changed back to a polygon). +<p> +The current shape of a marker may be queried with getVertices, which +returns the polygon or polyline vertex list in window coordinates. A more +powerful routine which does something similar is getRegion. This routine +returns a high level description of the region outlined by the marker, +giving the marker type (rectangle, circle, ellipse etc.), center, width +and height, and so on. Any position or dimension information may +optionally be transformed back to the original source raster, if the marker +center is in a region of the window which is the destination of an active +mapping. The unmap option will follow multiple mappings back to the +original mapped source raster. +<p> +The getRect function returns the parameters of the region outlined by a +rectangle marker in a form convenient for use in a Gterm setMapping call +(this is used to display an image within a marker). +<p> +Default translations when pointer is over a marker. +default Marker Translations +<p> +<pre> + Shift &lt;Btn1Motion&gt; m_rotateResize() + &lt;Btn1Motion&gt; m_moveResize() + Shift &lt;Btn1Down&gt; m_raise() m_markpos() + &lt;Btn1Down&gt; m_raise() m_markposAdd() + &lt;Btn1Up&gt; m_redraw() m_destroyNull() + &lt;Btn2Down&gt; m_lower() + &lt;Key&gt; BackSpace m_deleteDestroy() + &lt;Key&gt; Delete m_deleteDestroy() + &lt;KeyPress&gt; m_input() + &lt;Motion&gt; track-cursor() +</pre> +<p> +<a name="6.5.1"></a> +<h2>6.5.1 Command Summary</h2> +<p> +<h3>makeCopy</A></h3> +<p> +Copy a marker. The new marker is initially identical to the +old one, and will not be distinct until, e.g., moved to a new center. +<p> +Usage: +<p> +<pre> + makeCopy name +</pre> +<p> +<h3><A NAME="addCallback">addCallback</A></h3> +<p> +Post a marker callback to be called when the specified +event or events occurs. If no events are listed a Notify callback will +be posted. +<p> +Usage: +<p> +<pre> + addCallback procedure [event [event ...]] +</pre> +<p> +<h3><A NAME="notify">notify</A></h3> +<p> +Generate a Marker pseudo-event, causing any posted client +callback procedures to be called. +<p> +Usage: +<p> +<pre> + notify [event-type [param [param ...]]] +</pre> +<p> +<h3><A NAME="destroy">destroy</A></h3> +<p> +Destroy a marker. Just tell the marker to destroy itself. +All cleanup outside the marker facility relies upon the use of callbacks. +This includes our callback markerDestroyCallback below. +<p> +Usage: +<p> +<pre> + destroy +</pre> +<p> +<h3><A NAME="markpos">markpos</A></h3> +<p> +Mark the current position of a marker for a later redraw. +<p> +Usage: +<p> +<pre> + markpos +</pre> +<p> +Markpos is used to mark the position of a marker before changing any +marker attributes, so that a later "redraw marked" will erase the old +marker rather than the new one. This is necessary, for example, if any +marker attributes are changed which affect the size or position of the +marker. +<p> +<h3><A NAME="redraw">redraw</A></h3> +<p> +Redraw a marker. +<p> +Usage: +<p> +<pre> + redraw [function] [erase|noerase] [markpos|nomarkpos] +</pre> +<p> +By default redraw will erase the old marker at the position indicated by +a previous call to markpos, and redraw the marker with the current +attributes using the drawing function copy (copy source to destination). +Hence the usual usage is "markpos ... change marker attributes ... redraw". +Optional arguments may be given to change the drawing function, enable or +disable erase, or force redraw to do a markpos. These arguments may be +given in any order. +<p> +The drawing functions are as given in the XLIB documentation, minus the +"GX" prefix. The most commonly used functions are "copy" and "xor". +A normal marker redraw uses function=copy. +<p> +<h3><A NAME="raise">raise</A></h3> +<p> +Raise a marker, i.e., cause it to be drawn on top of other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + raise [reference-marker] +</pre> +<p> +In a reference marker is named the marker will raise itself above this +marker, otherwise the raised marker becomes the topmost marker. +<p> +<h3><A NAME="lower">lower</A></h3> +<p> +Lower a marker, i.e., cause it to be drawn beneath other +markers when overlapping markers are drawn. +<p> +Usage: +<p> +<pre> + lower [reference-marker] +</pre> +<p> +In a reference marker is named the marker will lower itself beneath this +marker, otherwise the lowered marker becomes the lowest marker. +<p> +<h3><A NAME="move">move</A></h3> +<p> +Move a marker. +<p> +Usage: +<p> +<pre> + move x y +</pre> +<p> +Move the marker center to the indicated coordinates in the display window. +<p> +<h3><A NAME="resize">resize</A></h3> +<p> +Resize a marker. +<p> +Usage: +<p> +<pre> + resize width height +</pre> +<p> +Resize the marker to the indicated size. By default width and height are +given in pixels. For a text marker one can append "ch" to indicate that +the units are chars in whatever font is in use, e.g., "40ch" or "40 chars" +is an acceptable value for a text marker dimension. +<p> +<h3><A NAME="rotate">rotate</A></h3> +<p> +Rotate a marker. +<p> +Usage: +<p> +<pre> + rotate angle +</pre> +<p> +Redraw a marker oriented to the given rotation angle. The angle is +given in radians. +<p> +<h3><A NAME="getAttribute">getAttribute</A></h3> +<p> +Return the value of a marker attribute. +<p> +Usage: +<p> +<pre> + value = getAttribute attribute-name +</pre> +<p> +<h3><A NAME="setAttribute">setAttribute</A></h3> +<p> +Set the value of a marker attribute. +<p> +Usage: +<p> +<pre> + setAttribute attribute-name value +</pre> +<p> +<h3><A NAME="getAttributes">getAttributes</A></h3> +<p> +Return the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + getAttributes attribute-list + i.e. getAttributes {name value [name value ...]} + or getAttributes name value [name value ...] +</pre> +<p> +where "value" is the name of the variable in which the attribute value +is to be stored. +<p> +<h3><A NAME="setAttributes">setAttributes</A></h3> +<p> +Set the values of a list of marker attributes. +<p> +Usage: +<p> +<pre> + setAttributes attribute-list + i.e. setAttributes {name value [name value ...]} +</pre> +<p> +where "value" is the new value of the associated marker attribute. +<p> +<h3><A NAME="getVertices">getVertices</A></h3> +<p> +Get some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + getVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is returned in the +variable "points", as a string of the form { {x y} {x y} ...}. The first +point is number zero. +<p> +<h3><A NAME="setVertices">setVertices</A></h3> +<p> +Set some or all of the vertices making up the polygon or +polyline representation of a marker. +<p> +Usage: +<p> +<pre> + setVertices points [first npts] +</pre> +<p> +The polygon or polyline representation of a marker is set using the points +passed in the "points" variable as a string of the form { {x y} {x y} ...}. +If FIRST and NPTS are not specified first is assumed to be zero (the first +point) and NPTS is the length of the points array. +<p> +<h3><A NAME="getRegion">getRegion</A></h3> +<p> +Return as a text string a high level description of the +region defined by a marker. +<p> +Usage: +<p> +<pre> + region = getRegion [unmap] [coord-type] +</pre> +<p> +The output string defines the marker type and the major marker positional +attributes. The region description formats for the various marker types +follow. +<p> +<pre> + text raster x y width height + line raster x y x y + polyline raster npts { {x y} {x y} ...} + rectangle raster x y width height rotangle + circle raster x y radius + ellipse raster x y width height rotangle + polygon raster npts { {x y} {x y} ...} +</pre> +<p> +Here, width and height refer to the distance from the marker center to an +edge, not to the width or height of the whole marker. This avoids +ambiguities about where the edge of a marker is if the width is even or +odd. Using the center to edge measurement, the edge is at x +/- width, +y +/- height. +<p> +If the "unmap" flag is given getRegion will attempt to associate the +marker with a mapped raster, reversing any mappings from the screen back +to the original source raster, and returning the raster number and raster +coordinates and marker sizes. If "unmap" is not given the marker +coordinates will refer to raster 0. Either pixel ("pixel") or NDC +("ndc") coordinates may be returned, pixel coordinates being the default. +<p> +<h3><A NAME="getRect">getRect</A></h3> +<p> +Return the region enclosed by a rectangle marker. The rect is +returned in a form convenient for use as the destination rect in a gterm +widget raster mapping. +<p> +Usage: +<p> +<pre> + getRect dx dy dnx dny +</pre> +<p> +The rect is stored in the output arguments. +<p> + +<hr noshade=5> + +<a name="6.6"></a> +<h3>6.6 Widget</h3> +<p> +The Widget class is the generic or base class for the window system +toolkit widgets supported by the object manager. The Widget class +supports a number of different Xt widget classes using a table driven +approach to describe each widget. Any widget may be created, destroyed, +and manipulated in various ways using only the generic Widget class +procedures and Widget-specific resources. The Widget class may be +subclassed to support complex Widgets that require custom class-specific +commands for use by the GUI code. +<p> +Generic Widget-class commands: +<p> +<pre> + <a href="#set">set</a> &lt;resource-name&gt; &lt;value&gt; + <a href="#get">get</a> &lt;resource-name&gt; +<p> + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; [<callback-name>] + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#setSensitive">setSensitive</a> &lt;sensitive&gt; + <a href="#isSensitive">isSensitive</a> +<p> + <a href="#realize">realize</a> + <a href="#unrealize">unrealize</a> + <a href="#isRealized">isRealizeed</a> + <a href="#map">map</a> + <a href="#unmap">unmap</a> + <a href="#manage">manage</a> child [child ...] + <a href="#unmanage">unmanage</a> child [child ...] + <a href="#popup">popup</a> [grab-kind] + <a href="#popdown">popdown</a> + <a href="#popupSpringLoaded">popupSpringLoaded</a> +<p> + <a href="#move">move</a> &lt;x&gt; &lt;y&gt; + <a href="#resize">resize</a> &lt;width&gt; &lt;height&gt; &lt;border-width&gt; + <a href="#configure">configure</a> &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +The most important Widget commands are set/get resource, and the +callbacks. The widget sensitivity can be set and queried using set/get +resource, but special procedures are provided to make this common operation +more convenient. +<p> +Class specific functions: +<p> +<pre> + <a href="#append">append</a> text # text widget + <a href="#setList">setList</a> list [resize] # list widget + value = <a href="#getItem">getItem</a> itemno + <a href="#highlight">highlight</a> itemno + <a href="#unhighlight">unhighlight</a> +</pre> +<p> +Ideally the widget class should be subclassed for widgets that require +class-specific functions, but in simple cases involving standard widgets +the support is built into the widget class code as a special case. +<p> +Special actions (used in translations): +<p> +<pre> + <a href="#do_userproc">call</a> (proc [,arg, ...]) + <a href="#do_popup">popup</a> (menu-name [xoffset [yoffset]]) + <a href="#do_popdown">popdown</a> (menu-name) +</pre> +<p> +The "call" action is a very general mechanism which allows any GUI procedure +to be registered with any translation using the X translation table +mechanism. The popup and popdown actions are used for popup menus. The +menu will be popped up at the event coordinates plus the optional offsets +if given. +<p> +Event handling: +<p> +<pre> + <a href="#addEventHandler">addEventHandler</a> &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +Event callback: +<p> +<pre> + <a href="#userEventHandler">userEventHandler</a> widget event-type time wx wy rx ry other +</pre> +<p> +In most cases translations are preferable to events, but a GUI can capture +raw events if it wishes by adding event handlers. Nearly all of the X +event types are supported. The callback syntax employs a number of +standard arguments, followed by a number of event-specific arguments. +<p> +<h3><A NAME="addCallback">addCallback</A></h3> +<p> +Add a callback procedure to the callback list for +a widget. If no callback name is given, "callback" is assumed. +<p> +Usage: +<p> +<pre> + addCallback <procedure-name> [&lt;callback-name&gt;] +</pre> +<p> +Specific widgets only support certain types of callbacks. There is no +checking that the callback type specified is supported by a widget; the +wrong type of callback can be registered, but it will never be called. +<p> +<h3><A NAME="deleteCallback">deleteCallback</A></h3> +<p> +Delete a callback procedure previously registered +for a widget. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> +<p> +<h3><A NAME="do_userproc">do_userproc (call)</A></h3> +<p> +Translation action procedure used to call general user +action procedures in the interpreter. The name of the user procedure to +be called is given as the first argument in the translation. For example, +the translation "call(foo,a,b,c)" would cause procedure foo to be called +with the arguments (a,b,c). The following arguments are special: +<p> +<pre> + Argument Replaced by +<p> + $name object name of widget + $time event->time + $x event->x + $y event->y + $x_root event->x_root + $y_root event->y_root +</pre> +<p> +The "user procedure" can be any server procedure. +<p> +<h3><A NAME="do_popup">do_popup</A></h3> +<p> +Popup a menu (or other spring loaded popup) at the location +of the event which triggered this action. +<p> +Usage: +<p> +<pre> + popup(menu-name [xoffset [yoffset]]) +</pre> +<p> +<h3><A NAME="do_popdown">do_popdown</A></h3> +<p> +Pop down a menu. +<p> +Usage: +<p> +<pre> + popdown(menu-name) +</pre> +<p> +<h3><A NAME="set">set</A></h3> +<p> +Set a widget resource. +<p> +Usage: +<p> +<pre> + set &lt;resource-name&gt; &lt;value&gt; +</pre> +<p> +<h3><A NAME="get">get</A></h3> +<p> +Get a widget resource value as a string. +<p> +Usage: +<p> +<pre> + get &lt;resource-name&gt; +</pre> +<p> +<h3><A NAME="append">append</A></h3> +<p> +Append data to a text widget. +<p> +Usage: +<p> +<pre> + append &lt;text&gt; +</pre> +<p> +<h3><A NAME="setList">setList</A></h3> +<p> +Set the item list of a list widget. +<p> +Usage: +<p> +<pre> + setList list [resize] +</pre> +<p> +The list is a simple list of strings, passed as a single string argument to +setList (quotes, braces, etc. may be used to quote strings containing +special characters). +<p> +<h3><A NAME="getItem">getItem</A></h3> +<p> +Get an item in a list widget. +<p> +Usage: +<p> +<pre> + value = getItem itemno +</pre> +<p> +If ITEMNO is a number the indicated list item is returned, or the string +"EOF" if the requested item is beyond the end of the list. Otherwise the +currently selected item is returned, and the index of the item is returned +in the output variable ITEMNO. If no item is currently selected ITEMNO +will be set to "none" on output. +<p> +<h3><A NAME="highlight">highlight</A></h3> +<p> +Highlight an item in a list widget. +<p> +Usage: +<p> +<pre> + highlight itemno +</pre> +<p> +The indicated item of the list is highlighted as if the item had been +selected by the user. Any previously highlighted item is unhighlighted. +<p> +<h3><A NAME="unhighlight">unhighlight</A></h3> +<p> +Unhighlight the currently highlighted item in a +list widget. +<p> +Usage: +<p> +<pre> + unhighlight +</pre> +<p> +Any currently highlighted item in the list widget is unhighlighted. +<p> +<h3><A NAME="realize">realize</A></h3> +<p> +Realize a widget. This activates and assigns windows for +a widget and all of its descendants. Realizing a widget does not in itself +cause it to appear on the screen. +<p> +Usage: +<p> +<pre> + realize +</pre> +<p> +<h3><A NAME="unrealize">unrealize</A></h3> +<p> +Unrealize a widget. This destroys the windows assigned +to a widget and all of its descendants. +<p> +Usage: +<p> +<pre> + unrealize +</pre> +<p> +<h3><A NAME="isRealized">isRealized</A></h3> +<p> +Test whether a widget is realized. +<p> +Usage: +<p> +<pre> + isRealized +</pre> +<p> +<h3><A NAME="map">map</A></h3> +<p> +Map a widget. +<p> +Usage: +<p> +<pre> + map +</pre> +<p> +<h3><A NAME="unmap">unmap</A></h3> +<p> +Unmap a widget. +<p> +Usage: +<p> +<pre> + unmap +</pre> +<p> +<h3><A NAME="manage">manage</A></h3> +<p> +Manage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Managing the +children makes them appear in the window, possibly causing the other +children to be rearranged in the window. +<p> +Usage: +<p> +<pre> + manage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h3><A NAME="unmanage">unmanage</A></h3> +<p> +Unmanage a list of child widgets. These should share the +same common parent, a geometry widget of some sort. Unmanaging the +children makes them disappear from the window and be removed from geometry +management, possibly causing the other children to be rearranged in the +window. +<p> +Usage: +<p> +<pre> + unmanage child [child ...] +</pre> +<p> +This message should be sent to the geometry widget which is the parent +of the children. +<p> +<h3><A NAME="popup">popup</A></h3> +<p> +Popup a shell widget. If no grab is indicated the popup +can remain up while other windows accept input. +<p> +Usage: +<p> +<pre> + popup [grab-kind] +</pre> +<p> +<h3><A NAME="popdown">popdown</A></h3> +<p> +Popdown a shell widget. +<p> +Usage: +<p> +<pre> + popdown +</pre> +<p> +<h3><A NAME="popupSpringLoaded">popupSpringLoaded</A></h3> +<p> +Popup a shell widget, e.g., a popup menu. +This implies an exclusive grab. +<p> +Usage: +<p> +<pre> + popupSpringLoaded +</pre> +<p> +<h3><A NAME="move">move</A></h3> +<p> +Move a widget to the given window relative coordinates. +<p> +Usage: +<p> +<pre> + move &lt;x&gt; &lt;y&gt; +</pre> +<p> +<h3><A NAME="resize">resize</A></h3> +<p> +Resize a widget. +<p> +Usage: +<p> +<pre> + resize &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h3><A NAME="configure">configure</A></h3> +<p> +Configure a widget, i.e., execute a simultaneous +move and resize. +<p> +Usage: +<p> +<pre> + configure &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt; &lt;border-width&gt; +</pre> +<p> +<h3><A NAME="setSensitive">setSensitive</A></h3> +<p> +Set the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + setSensitive &lt;sensitive&gt; +</pre> +<p> +<h3><A NAME="isSensitive">isSensitive</A></h3> +<p> +Test the sensitivity of a widget. +<p> +Usage: +<p> +<pre> + isSensitive +</pre> +<p> +<h3><A NAME="addEventHandler">addEventHandler</A></h3> +<p> +Add a custom event handler to a widget. A list +of event masks is given to define the classes of events the user supplied +event handling procedure is to receive. +<p> +Usage: +<p> +<pre> + addEventHandler &lt;procname&gt; &lt;event-mask&gt; [&lt;event-mask&gt;...] +</pre> +<p> +<h3><A NAME="removeEventHandler">removeEventHandler</A></h3> +<p> +Remove an event handler previously posted +with addEventHandler, above. +<p> +Usage: +<p> +<pre> + removeEventHandler procname +</pre> +<p> +<h3><A NAME="event">event</A></h3> +<p> +Generic event handler called when a widget event handler +posted by addEventHandler is called. +<p> +The user event handler is called as +<p> +<pre> + userEventHandler widget event-type time wx wy rx ry other +</pre> +<p> +where "other" is an event-type specific list of fields describing the +the event. +<hr noshade=5> + +<a name="6.7"></a> +<h3>6.7 Parameter</h3> +<p> +The UI parameter class is used for client-UI communications. The client +does not control the user interface directly, rather the UI defines a set +of abstract UI parameters, and during execution the client application +assigns values to these parameters. These UI parameters should be thought +of as describing the runtime state of the client as viewed by the GUI. +The GUI is free to interpret this state information in any way, including +ignoring it. Many GUIs can be written which use the same client state +as described by the UI parameters. +<p> +Assigning a value to a UI parameter causes the new value to be stored, and +any parameter action procedures registered by the UI to be called. +The action or actions [if any] taken when a parameter value changes are +arbitrary, e.g. the action might be something as simple as changing a +displayed value of a UI widget, or something more complex like displaying +a popup. +<p> +<h2>UI Parameter class commands:</h2> +<p> +<pre> + <a href="#getValue">getValue</a> + <a href="#setValue">setValue</a> &lt;new-value&gt; + <a href="#addCallback">addCallback</a> &lt;procedure-name&gt; + <a href="#deleteCallback">deleteCallback</a> &lt;procedure-name&gt; + <a href="#notify">notify</a> +</pre> +<p> +The most common usage is for the GUI to post one or more callbacks for +each UI parameter. When the UI parameter value is changed [with setValue, +e.g. by the client] the GUI callback procedures are called with the old +and new UI parameter values on the command line. addCallback is used to +add a callback procedure, and deleteCallback to delete one. Multiple +callbacks may be registered for a single UI parameter. notify is used +to simulate a parameter value change, causing any callback procedures to +be invoked. +<p> +The callback procedure is called as follows: +<p> +<pre> + user-procedure param-name {old-value} {new-value} +</pre> +<p> +The important thing to note here is that the old and new value strings +are quoted with braces. This prevents any interpretation of the string +by Tcl when the callback is executed, which is necessary because the +strings can contain arbitrary data. When Tcl calls the callback the +first level of braces will be stripped off, leaving old-value and new-value +each as a single string argument. +<p> +<p> +<h2><A NAME="setValue">setValue</A></h2> +<p> +Set the value of a parameter, and notify all clients +via the posted callback procedures that the parameter value has changed. +<p> +Usage: +<p> +<pre> + setValue &lt;new-value&gt; +</pre> +<p> +<h2><A NAME="getValue">getValue</A></h2> +<p> +Get the value of a parameter. +<p> +Usage: +<p> +<pre> + getValue +</pre> +<p> +<h2><A NAME="notify">notify</A></h2> +<p> +Notify the registered clients of a parameter as if the +value had changed. +<p> +Usage: +<p> +<pre> + notify +</pre> +<p> +<h2><A NAME="addCallback">addCallback</A></h2> +<p> +Add a callback procedure to the callback list for +a parameter. +<p> +Usage: +<p> +<pre> + addCallback &lt;procedure-name&gt; +</pre> +<p> +<h2><A NAME="deleteCallback">deleteCallback</A></h2> +<p> +Delete a callback procedure previously registered +for a parameter. +<p> +Usage: +<p> +<pre> + deleteCallback &lt;procedure-name&gt; +</pre> +<hr noshade=5> + +<hr noshade=5> +</body> +</html> diff --git a/vendor/x11iraf/obm/docs/obm/servercom.html b/vendor/x11iraf/obm/docs/obm/servercom.html new file mode 100644 index 00000000..16c4c24e --- /dev/null +++ b/vendor/x11iraf/obm/docs/obm/servercom.html @@ -0,0 +1,375 @@ +<h1><A NAME="serverReset">serverReset</A></h1> +<p> +The "reset-server" command is implemented as a special case in ServerEvaluate. +After doing a true reset ServerEvaluate calls Tcl_Eval to evaluate the full +message which still contains the reset-server command. We want to ignore +this the second time, so we treat the command here as a no-op. +<p> +Usage: +<p> +<pre> + reset-server +</pre> +<p> +Note: for reset-server to be recognized by ServerEvaluate and really reset +things, it must be the first command in a message to the server. +<p> +<h1><A NAME="appInitialize>appInitialize</A></h1> +<p> +TCL command to initialize the server for a new application, setting the +application name and loading the application resources. +<p> +Usage: +<p> +<pre> + appInitialize appname, appclass, resources +</pre> +<p> +<h1><A NAME ="createObjects">createObjects</A></h1> +<p> +TCL command to create the tree of UI objects comprising the user interface. +The object tree is defined by a string valued resource. If no resource is +named the default "objects" resource will be used. +<p> +Usage: +<p> +<pre> + createObjects [resource-name] +</pre> +<h1><A NAME="destroyObject">destroyObject</A></h1> +<p> +Destroy an object and all of its children. +<p> +Usage: +<pre> + destroyObject object-name +</pre> +<p> +<h1><A NAME="activate">activate</A></h1> +Activate the user interface. When called the first time the user interface +is created and activated, thereafter the UI is merely reactivated (e.g. +mapped if unmapped). +<p> +Usage: +<p> +<pre> + activate +</pre> +<p> +<h1><A NAME="deactivate">deactivate</A></h1> +<p> +Deactivate the user interface. Optionally unmaps the UI and calls the Obm +client back to let it know that the UI has been deactivated. +<p> +Usage: +<p> +<pre> + deactivate [unmap] +</pre> +<p> +<h1><A NAME="getResource">getResource</A></h1> +<p> +Get the string value of the specified application resource (window +system parameter). This allows use of the resource mechanism to supply +default values for GUI parameters. +<p> +Usage: +<p> +<pre> + value = getResource resource-name [class [default-value]] +</pre> +<p> +In the simplest case one merely requests a resource by name and the +string value is returned as the function value. If the resource has +an entry in the fallback resources for the application (appInitialize +resource list) then a value is guaranteed to be returned. +<p> +If the Class name for the resource is given then a class default value +will be returned if no entry is found for the name resource instance. This +is useful when there are a number of resources of the same type (same class). +If most or all resources in the same class have the same default value one +need only make one entry for the Class in the application defaults resource +list. It is up to the application developer to define the class name of a +resource - the class name can be any string. Examples are "Font", "Cursor", +etc. By convention the first character of a class name is capitalized, while +instance names begin with a lower case letter. +<p> +If there is an entry for the named resource in the resource list passed to +appInitialize then a value string is guaranteed to be returned. This will be +either the appInitialize default, or a value specified by the system or the +user in an X resources file. If one is not certain a default value is defined +somewhere, a default value should be specified in the getResource call as +shown above. +<p> +See also getResources, used to get multiple resources in one call. +<p> +<h1><A NAME="getResources">getResources</A></h1> +<p> +Get the string values of a list of resources. +<p> +Usage: +<p> +<pre> + getResources resource-list +</pre> +<p> +e.g. +<pre> + getResources { + { resource [variable class [default-value]]] } + { resource [variable class [default-value]]] } + (etc.) + } +</pre> +<p> +<h1><A NAME="createMenu">createMenu, editMenu</A></h1> +<p> +Create or modify a menu. The editMenu function is an alias for createMenu. +<p> +Usage: +<pre> + createMenu menu-name parent item-list +</pre> +<p> +e.g., +<pre> + createMenu menu-name parent { + { label function data [options...] } + { label function data [options...] } + (etc.) + } +</pre> +<p> +where +<p> +<pre> + menu-name is the object name for the menu popup shell + parent is the parent widget of the menu shell + label is a menu item label + function is the function to be performed when the menu + item is selected, e.g., f.exec, f.data, f.space, or f.line. + data is function dependent data + options are option-name option-value pairs, as specified + below. +</pre> +<p> +In the item list the fields label and option-value may be any Tcl expression. +Expressions are evaluated in the server context. The data field is a Tcl +script to be executed when the menu item is selected. +<p> +Options are specified as "option option-value". The menu item options are +as follows. +<p> +<pre> + bitmap A bitmap to be displayed left justified in the label field + (e.g. to indicate a parameter setting). + sensitive Specifies whether the menu item is active (sensitive=true) + or inactive (sensitive=false, item grayed out). + accelerator Specifies an input translation (accelerator, e.g., + keyboard event) which can be used to execute the + menu item. +</pre> +<p> +The option-value field may be any Tcl expression. +<p> +Example: +<p> +<pre> + createMenu fileMenu toplevel { + { "File Menu" f.title} + { Open f.exec openFile} + { Save f.exec saveFile} + { Load f.menu loadMenu} + { no-label f.line } + { Quit f.exec "send client Quit" } + } +</pre> +<p> +The first createMenu is called for a given menu the menu is created, added +to the menu list, and all window system widgets are created for the menu. +Subsequent calls will result in only the changed parts of the menu being +altered provided the changes are not great. Hence this routine can be called +to efficiently modify a menu when minor runtime changes occur, e.g., an +item label or action changes, the item value changes state, and so on, +without need for the GUI code to know how to make the necessary detailed +changes to the widgets used to implement the menu. +<p> +<h1><A NAME="destroyMenu">destroyMenu</A></h1> +<p> +Destroy a menu. This can be used to free up the resources used by a +menu, e.g., if the menu is not expected to be needed again for a while. +<p> +Usage: +<p> +<pre> + destroyMenu menu-name +</pre> +<p> +<h1><A NAME="createBitmap">createBitmap</A></h1> +<p> +Create a named bitmap. This replaces any old bitmap of the same name. The +new bitmap is cached in server memory; when a widget bitmap resource is set, +the bitmap cache will be searched for the named bitmap before asking Xlib +to find the bitmap. +<p> +Usage: +<p> +<pre> + createBitmap name width height data +</pre> +<p> +e.g., +<p> +<pre> + createBitmap foo 16 16 { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +<p> +<h1><A NAME="createCursor">createCursor</A></h1> +<p> +Create a cursor from bitmap data. The cursor is entered into the server's +cursor cache and will override any existing entry of the same name. +<p> +Usage: +<p> +<pre> + createCursor name source mask fg_color bg_color x_hot y_hot +</pre> +<p> +e.g., +<p> +<pre> + createCursor foo bitmap1 bitmap2 black white 8 8 +</pre> +<p> +The named bitmaps must be created first with createBitmap. +<p> +<h1><A NAME="createPixmap">createPixmap</A></h1> +<p> +Create a named pixmap. This replaces any old pixmap of the same name. The +new pixmap is cached in server memory; when a widget pixmap resource is set, +the pixmap cache will be searched for the named pixmap before asking Xlib +to find the pixmap. +<p> +Usage: +<p> +<pre> + createPixmap name width height depth fg_color bg_color data +</pre> +<p> +e.g., +<p> +<pre> + createPixmap foo 16 16 8 black white { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +</pre> +<p> +<h1><A NAME="print">print</A></h1> +<p> +Print a string on the standard output. This is used mainly for debugging +user interfaces. +<p> +Usage: +<p> +<pre> + print arg [arg ...] +</pre> +<p> +<h1><A NAME="send">send</A></h1> +<p> +Send a message to an object. The object interprets the message and returns +a function value as the string result of the TCL command. +<p> +Usage +<p> +<pre> + send &lt;object&gt; &lt;message&gt; +</pre> +<p> +<h1><A NAME="postActivateCallback">postActivateCallback</A></h1> +<p> +Post a callback procedure to be called when the UI is activated. The UI is +activated when it is first downloaded to server, but it may also be +activated (reactivated) after the application has exited and is later +restarted, or when the UI is deactivated and reactivated. Note +that the UI state vis-a-vis the external world (client application) may +no longer be accurate after it has been idle for a time and then reactivated. +<p> +Usage: +<p> +<pre> + postActivateCallback &lt;procedure&gt; +</pre> +<p> +<p> +<h1><A NAME="postTimedCallback">postTimedCallback</A></h1> +<p> +Post a callback to call the named procedure back after a specified delay +in milliseconds. +<p> +Usage: +<p> +<pre> + id = postTimedCallback procedure msec [client-data] +</pre> +<p> +After the specified delay the user callback procedure will be called with +client_data (if given) as the single argument. Only one call will be made; +the client must repost the callback in each call if the procedure is to be +repeatedly executed. +<p> +An ID value is returned which may be passed to deleteTimedCallback to delete +the timer. +<p> +<h1><A NAME="deleteTimedCallback">deleteTimedCallback</A></h1> +<p> +Delete a timer callback procedure. This procedure is typically used to +break a timer loop, where the timer procedure repeatedly reposts itself at +the end of each interval. +<p> +Usage: +<p> +<pre> + deleteTimedCallback id +</pre> +<p> +The ID string is returned by postTimedCallback when a timer is posted. +<p> +<h1><A NAME="postWorkCallback">postWorkCallback</A></h1> +<p> +Post a callback for a procedure to be called when the server is idle. +Work procedures are used to perform computations in the background while +the user interface remains active and able to respond to input events. +This works only if the user work procedure does its job in small increments, +doing only a small amount of processing in each call. The work procedure +will be called repeatedly until it returns a status indicating that it has +finished its task. +<p> +Usage: +<p> +<pre> + id = postWorkCallback procedure [client-data] +</pre> +<p> +When the server has nothing else to do the user work procedure will be +called with client_data (if given) as the single argument. The work procedure +should return the string "done" when all processing is finished, or any other +string if the procedure is to be called again. +<p> +An ID value is returned which may be passed to deleteWorkCallback to delete +the work procedure. +<p> +<h1><A NAME="deleteWorkCallback">deleteWorkCallback</A></h1> +<p> +Delete a work callback procedure. +<p> +Usage: +<p> +<pre> + deleteWorkCallback id +</pre> +<p> +The ID string is returned by postWorkCallback when a work procedure is posted. diff --git a/vendor/x11iraf/obm/docs/tody.paper/todyd.html b/vendor/x11iraf/obm/docs/tody.paper/todyd.html new file mode 100644 index 00000000..53705df4 --- /dev/null +++ b/vendor/x11iraf/obm/docs/tody.paper/todyd.html @@ -0,0 +1,522 @@ +<HEAD> +<TITLE> A Portable GUI Development System---The IRAF Widget Server </TITLE> +</HEAD> +<BODY><P> +<h5><hr> Astronomical Data Analysis Software and Systems IV<br>ASP Conference Series, Vol. 77, 1995<br>Book Editors: R. A. Shaw, H. E. Payne, and J. J. E. Hayes<br>Electronic Editor: H. E. Payne <hr> </h5> +<H1><A NAME=SECTION021900000000000000000> A Portable GUI Development System---The IRAF Widget Server</A></H1> +<P> +<P><b>D. Tody</b><br> +National Optical Astronomy Observatories, P.O. Box 26732, +Tucson, AZ 85726<br> +<P> +The National Optical Astronomy Observatories are +operated by the Association of Universities for Research in Astronomy, Inc. +(AURA) under cooperative agreement with the National Science Foundation. +<P> +<P> +<A NAME=1229>&#160;</A> +<A NAME=1230>&#160;</A> +<A NAME=1231>&#160;</A><A NAME=1232>&#160;</A> +<A NAME=1233>&#160;</A> +<A NAME=1234>&#160;</A><A NAME=1235>&#160;</A><A NAME=1236>&#160;</A><A NAME=1237>&#160;</A> +<A NAME=1238>&#160;</A> +<A NAME=1239>&#160;</A> +<A NAME=todyd>&#160;</A><H3>Abstract:</H3> +<EM>We describe a new GUI (Graphics User Interface) development environment +which extends the X window system and the X Toolkit (Xt) with a high-level, +object-oriented, interpreted programming language. +This approach will allow GUIs written +using standard Xt-based widget sets to be constructed without requiring any +window system programming on the part of the programmer. +The architecture of the resulting program completely separates the GUI from +the applications code, allowing the GUI to be developed separately and +replaced at will without modifying the application. +Despite the separation of the GUI from the application the two are tightly +integrated using an asynchronous, event-driven messaging system based on +requests and client events, with the remote client application appearing as +just another class of object within the GUI. +This approach maximizes window system and toolkit independence and is well +suited to distributed applications, allowing the GUI and client application +to be run easily on separate processors or computers. +<P> +</EM><P> +<H1><A NAME=SECTION021910000000000000000> Introduction</A></H1> +<P> +Most window system programming today is done via one of two approaches. The +first approach is to code directly in C or C++ at the window system toolkit +level, usually integrating the user interface code and applications code +within the same program. The second approach, which is really just a +variation on the first, is to use one of the many commercial GUI builders +available. This simplifies the programmer's task by allowing the user +interface to be interactively designed, relying on the GUI builder to +generate the window system code required to implement the user interface +specified by the programmer and requiring the programmer to code only the +application functionality. As with the direct coding approach, the +applications code is often integrated with the GUI in the same program. +<P> +Recently a third approach has been used. This employs a high-level, +interpreted language in which the programmer codes all or part of the +application, with at least the GUI being implemented in the high-level +interpreted language. Tcl/Tk is a recent example of this approach. Other +examples of the high-level interpreted approach from outside the Unix/X +world include Apple's HyperCard/HyperTalk, and the Visual Basic facility of +Microsoft Windows. +<P> +This paper presents a new, high-level, interpreted window system toolkit +which like Tcl/Tk is also based on the Tcl interpreter. Unlike Tcl/Tk, +which is by definition Tk specific, our approach tries to maximize window +system and window system toolkit independence to ease future upgrades to new +window systems or toolkits. The initial implementation, which is for the X +Window System, is based on the X Toolkit (a part of the X Consortium X11 +release) and uses standard Xt-based widgets. Support for an asynchronous, +event-driven messaging system is an integral part of the design, allowing +the GUI to be isolated from the functional part of an application and making +the facility well suited to distributed applications, e.g., where a GUI +executing locally talks to application code executing remotely, with the +application downloading the GUI to be run at startup time. The core +facility is implemented as a simple C-callable library which can be used to +implement new GUI-based programs without having to write any window +system-level code. +<P> +An important aspect of the facility described in this paper is that it +represents a general user interface management system (UIMS) tailored for +astronomical GUIs. The intent is that by providing a high-level facility +tailored for our applications, we can simplify the task of developing GUIs +for astronomical applications while providing a greater degree of +consistency between applications since they will share the same GUI +components. This is particularly important in the area of 2D graphics and +imaging, including presentation and user interaction with such data, since +the standard toolkits do not address this area. +<P> +<H1><A NAME=SECTION021920000000000000000> The Widget Server</A></H1> +<P> +<H2><A NAME=SECTION021921000000000000000> Overview</A></H2> +<P> +``Widgets'' (window objects), are the basic building blocks of graphical user +interfaces. A window system toolkit provides a selection of widgets that +the programmer can use to construct a user interface. Typical widgets +include things like push buttons, scrollbars, pop-down menus, or scrolling +text regions. The <i> widget server</i> serves up widgets to a remote client +process in much the same way that the X display server serves up windows and +other low-level display resources to a remote client application. +<P> +When a client application starts up it connects to the widget server and +downloads its GUI. The GUI is a simple block of text which is interpreted +and executed by the widget server. The GUI text contains a description of +the widgets comprising the user interface, a number of interpreted action +procedures to be called to process user interface or client events during +execution, and any code needed to initialize the GUI. +During execution the client application waits for and executes requests from +the GUI, and sends messages to the GUI to inform it of any ``client events,'' +or changes in the state of the client. The conventional compiled client +application implements all the application-specific functionality, but does +not communicate directly with the user. +<P> +To the client application the GUI is merely a block of text to be passed on +to the widget server; the client code knows nothing about the GUI other than +the name of the GUI file to be sent to the widget server. The client knows +only about the applications functionality which it implements, and the +messages and requests used to communicate with the GUI. The GUI is +completely isolated from the client application. While to the user the GUI +appears to be an integral part of the application, the actual compiled +client application has an interpreted command-line interface and can be +executed stand-alone without any GUI. +<P> +<H2><A NAME=SECTION021922000000000000000> Widget Server Architecture</A></H2> +<P> +<P><A NAME=1250>&#160;</A><A NAME=todyfig1>&#160;</A><IMG ALIGN=BOTTOM ALT="" SRC="/iraf/web/projects/x11iraf/docs/todyd1.gif"> +<BR><STRONG>Figure:</STRONG> Widget Server Architecture. +<A HREF="http://hoth.stsci.edu/adass-figs/todyd1.eps"> + Original PostScript figure (34 kB) +</A><P> + +<BR> +<P> +<P> +The architecture of an application which uses the widget server is +summarized in Figure <A HREF="todyd.html#todyfig1">1</A>. +The typical widget server-based application consists of two processes, the +process containing the client application, and the widget server process +itself which executes the client's GUI. All user interface functionality +resides in the GUI and all application-specific functionality resides in +the client. During execution these processes communicate via an +asynchronous object-based messaging system. +<P> +<H2><A NAME=SECTION021923000000000000000> Advantages of the Widget Server</A></H2> +<P> +The widget server architecture separates the user interface from the +application-specific code and provides a high-level interpreted language +for developing GUIs. This approach has significant advantages, +including the following: +<P> +<OL><LI> +The high-level, interpreted nature of the widget server makes it much +easier to develop GUIs than is the case with toolkit-level programming or +the conventional, compile-link approach. +<LI> +The use of an interpreted runtime language (Tcl) to compose the GUI is more +powerful than the visual programming approach used in GUI builders, since +the latter only address the appearance of the user interface. +User interface builders can still be used with the widget server to +interactively layout the user interface, although this is less important +than it might be given the interpreted nature of the GUI (i.e., changes can be +made and the GUI redisplayed very quickly). +<LI> +The high-level, integrated nature of the widget server-based GUI development +environment makes it straightforward to customize the environment to support +a particular class of application. This is important for large systems +where GUIs are developed by many people working independently, +to reduce the overall effort and improve consistency. +<LI> +The widget server isolates all window system and toolkit code into a single +executable which can serve any number of applications. This greatly reduces +disk space consumption in a large system that has many application GUIs. +<LI> +Since the widget server is a single executable it is easy to have multiple +versions, e.g., supporting different toolkits or incorporating proprietary +software to optimize performance for a particular class of workstation. +<LI> +Since all the window system code is isolated into a separate process the +client application is completely window system independent, allowing the +same client application to be used with a widget server GUI executing on +any local or remote platform running any operating system. +<LI> +Porting a whole system full of GUIs to a new platform can be done by a +single individual since only the widget server itself need be ported. +<LI> +No window system libraries, and indeed no compilation, is needed +to develop GUIs. All that is needed is the widget server executable. +This makes it much more feasible to use commercial or platform specific +libraries should this be desired. +<LI> +The GUI is completely isolated into a small text file separate from the +application, allowing the GUI and the application to be developed separately, +or several alternate GUIs to be used with a single application. +<LI> +The widget server is well suited to distributed applications since the +widget server can be run on the local workstation while the client +application executes remotely. This allows the entire GUI to execute +interactively on the local workstation, a much more efficient approach than, +for example, running an X application over the network. +</OL> +<P> +Possible disadvantages of the widget server approach are its relative +complexity and the possibility of inefficiency when the application is +distributed over two or more processes. For a small system where only a few +GUI-based applications are needed many of our big-system concerns are +unimportant and it might be simpler to program directly at the toolkit +level, especially if a user interface builder tool is available. Efficiency +can be a problem if the client code is required to respond in real time to +user interface events, however this is rarely a problem in well designed +applications since the more interactive portions of the program can be moved +into the GUI, implemented as interpreted GUI procedures or as calls to the +compiled functions in the widget server itself. The asynchronous nature of +the messaging system ensures that the user interface will always be +responsive even when the client is busy computing. +<P> +<P><A NAME=1259>&#160;</A><A NAME=todyfig2>&#160;</A><IMG ALIGN=BOTTOM ALT="" SRC="/iraf/web/projects/x11iraf/docs/todyd2.gif"> +<BR><STRONG>Figure 2:</STRONG> A Simple GUI: The ``Hello, world'' Application<BR> +<P><H2><A NAME=SECTION021924000000000000000> Platform Independence</A></H2> +<P> +The widget server automatically provides a high degree of platform and +window system independence since the GUI is isolated from the client +application; in the worst case only the GUI file has to be changed to use a +GUI-based application on a new platform. The current implementation +provides full platform independence for platforms which run the X Window +System since the current widget server implementation is X-based. No +changes to the GUI files are needed for these platforms. +<P> +The current widget server implementation does not, however, provide full +window system toolkit independence for window systems other than X. Ideally +the widget server should define a virtual set of widgets which can be +implemented on a variety of window systems and window system toolkits; not +only X but also Windows, Windows NT, Macintosh, etc. This problem has +partially been solved in that the language used in widget server GUIs +isolates the widget-dependent code into a portion of the GUI which describes +the widget hierarchy, assigning widget classes to named GUI objects. The +runtime part of the GUI, i.e., the interpreted action or callback procedures +called at runtime as the GUI executes, is already almost completely widget- +and toolkit-independent. Defining a fully toolkit-independent virtual +widget set is a future problem which cannot be attempted until we have a +better idea what widgets are needed for our applications. Several +commercial window system toolkits or GUI development environments exist +which have already attempted to address this problem, at least for the +standard toolkits. +<P> +The portion of the widget server which interfaces to the underlying window +system and window system toolkit (widget set) is the <i> Object Manager</i>. +This is discussed in the next section. +<P> +<H1><A NAME=SECTION021930000000000000000> The Object Manager Library</A></H1> +<P> +<H2><A NAME=SECTION021931000000000000000> Overview</A></H2> +<P> +The widget server is actually just a shell around the Object Manager library +(OBM). The widget server extends the Object Manager by providing a way for +external clients to connect to the Object Manager to download and execute a +GUI. All of the real work of creating and executing the GUI is done by the +Object Manager library. The widget server adds a client-server communications +method. +<P> +The Object Manager provides services for creating, deactivating, +reactivating, or destroying a GUI, creating or destroying objects, and +delivering messages and events to objects within the GUI. The OBM provides +the framework within which GUIs execute, including the interpreter, +automatic memory allocation, and a library of runtime services. +The Object Manager defines four main classes of objects: <i> Server</i>, +<i> Client</i>, <i> Parameter</i> (for client events), and <i> Widget</i>, for +the graphical elements of the interface. Within the Widget class are many +subclasses, one for each type of widget. +All Object Manager execution is event driven and asynchronous and is based +on messages (requests), callbacks, and events. For example, defining a new +GUI is done by sending a message to the server object. +<P> +The set of widgets implemented by the Object Manager is not fixed, i.e., new +widgets can be added or existing widgets removed to meet the requirements of +the applications which will be using the widget server. The base Widget +class provides a generic set of methods usable with all widget subclasses. +Complex widgets subclass the base Widget class to add their own methods. +The current Object Manager provides a mixture of Xt-based widgets which +provide a Motif-like appearance but which are publically available and +redistributable. Source for these widgets and for all code used in the +widget server is included in the distribution. The current widget set +includes the base Xt widgets, the 3D Athena widgets, selected FWF (Free +Widget Foundation) widgets, plus a few others such as the Layout widget from +MIT, the HTML hypertext markup language widget from NCSA <i> Mosaic</i>, and +the gterm-image widget from the IRAF project. Additional Xt-based widgets +(including Motif, OLIT, and commercial widgets) can easily be added. +<P> +<H2><A NAME=SECTION021932000000000000000> The OBM Library</A></H2> +<P> +The main entry points of the OBM library are shown in Figure <A HREF="todyd.html#todyfig3">3</A>. +The library is very simple since everything complicated is done by the +interpreted GUI code. The main runtime function of the OBM library, from +the point of view of the application which uses the library, is messaging. +A window system application (such as the widget server) calls +<i> ObmDeliverMsg</i> to deliver a message from the client application to a +GUI object. A callback function is registered with the Object Manager to +intercept client requests and pass them on to the client. +<P> +<P><A NAME=7268>&#160;</A><A NAME=todyfig3>&#160;</A><IMG ALIGN=BOTTOM ALT="" SRC="/iraf/web/projects/x11iraf/docs/todyd3.gif"> +<BR><STRONG>Figure 3:</STRONG> Principal routines of the Object Manager library, <i> libobm.a</i><BR> +<P><H2><A NAME=SECTION021933000000000000000> Using the OBM Library to Build Standalone Applications</A></H2> +<P> +Our discussion has thus far concentrated on the widget server and +distributed applications, because the widget server provides the best +architecture for adding GUIs to tasks in an existing, large data processing +system. Another important class of applications are window system +applications, where the focus is on the window system functionality +implemented by the application. Most conventional X window system +applications fall into this class. +<P> +An important use of the Object Manager library is to implement such +applications. A stand-alone, single-process window system application can be +built using the OBM library. In this case the ``client'' is not a separate +process, but an application-specific interpreter within the same process as +the OBM library. The program could be written as a conventional window +system program making direct calls to the underlying window system toolkit, +but by using the OBM library virtually all window system specific code is +eliminated and the GUI is isolated to a high-level, interpreted GUI file. +The only compiled code required is that which implements the functionality +of the application itself. The resulting task is almost completely window +system independent. +<P> +A good example of an existing stand-alone window system task built around +the OBM library is <i> ximtool</i>, the IRAF image display server program. +This is a stand-alone X window system application used for image display and +image interaction. <i> Ximtool</i> contains only about one page of C code +which has anything to do with X. All of the remaining C code handles window +system-independent raster image processing and the fifo or socket-based +binary protocol used to communicate with remote clients for image display. +The <i> ximtool</i> GUI is an interpreted GUI text file, identical to what +one might use with a widget server-based task. The widget server itself, +of course, is another example of a stand-alone X application based on the +OBM library. +<P> +<H2><A NAME=SECTION021934000000000000000> The Object Manager Shell</A></H2> +<P> +Another stand-alone host application built around the Object Manager library +is <i> obmsh</i>, the Object Manager shell. This is a Unix shell which executes +OBM windowing scripts. It can be used to execute GUI files from the Unix +command line, or be used in OBM-based scripts to write stand-alone Unix +shell scripts that can be called as commands from the Unix environment. +For example, the ``hello, world'' GUI shown in Figure <A HREF="todyd.html#todyfig2">2</A> could be +converted to a Unix command <i> hello</i> by changing the file name to ``hello'' +and adding something like ``<code>SPM_quot</code>#!/usr/local/bin/obmsh&quot;'' to the file header. +<P> +<H1><A NAME=SECTION021940000000000000000> Messaging</A></H1> +<P> +<H2><A NAME=SECTION021941000000000000000> Messaging Fundamentals</A></H2> +<P> +The key to isolating the GUI from the client code of an application, while +providing a tightly integrated, efficient application, lies with messaging. +The messaging scheme used determines how objects within the application +interact with each other during execution. This includes the interaction +of the client code (client object) with the GUI. Our discussion here will +concentrate on how messaging is used to link the client to the GUI, but it +should be noted that the same messaging scheme is used for all object-to-object +communications within the GUI as well. +<P> +Messaging as defined by the OBM consists of two parts: requests and +client events. Requests are commands send to the client (or any other +object). The recipient is free to modify or ignore the request as it wishes. +Client events are messages sent to the GUI when the client state +changes in any way. The same mechanism is also used to deliver other forms +of client information to the GUI, e.g., in response to requests. The GUI is +free to ignore client events. It is not unusual for a given GUI to be +interested in only a portion of the client events generated by a client. +<P> +A client event is a message sent to an object of the OBM class <i> Parameter</i>. +A parameter object is very simple, consisting of a name and a string value. +The GUI registers callbacks with the user interface (UI) parameters, i.e., +client events, +that it wishes to know about. The string value of a UI parameter can be +anything, for example a number, a structure, a list, or a large block of text. +It is common for multiple callbacks to be registered on a single UI parameter +by independent elements of the GUI. +<P> +Messaging is fully asynchronous. Both requests and client events are queued +and buffered, and periodically flushed to the process on the other end. +Synchronization occurs automatically when the client waits for input from +the server (GUI). The GUI never waits for a request to complete, nor does +it check to see that a request has been honored. Rather, when the client +processes the request it sends client events back to the GUI to inform the +GUI of any actions performed by the client. The same thing happens when +the client performs actions for any other reason, hence the GUI always +reflects the true state of the client. +<P> +Client events are an important abstraction mechanism. Client events and +messages allow the client to provide the GUI with all the information it +needs to function, without the client code having any knowledge of the +nature of the user interface. Yet, since requests and client events are +decoupled, the client will function even if the client events and messages +it sends are discarded, as when running the client code without a GUI or +with radically different GUIs. +<P> +<H2><A NAME=SECTION021942000000000000000> Simple Messaging Example</A></H2> +<P> +Messaging is one of those things which is fundamentally simple, yet +surprisingly hard to explain. As a simple example, consider what happens +when the user selects a frame to be displayed in <i> ximtool</i>: +<P> +<OL><LI> +The user pushes the next frame button. +<LI> +The callback procedure (in the GUI) for the nextFrame button sends the +command ``nextFrame'' to the client. +<LI> +The client receives and processes the request, changing the frame, +sending the new frame number to the UI parameter ``frame''. +<LI> +A GUI callback procedure registered on the ``frame'' parameter is called, +updating the GUI to indicate the new display frame number. +</OL> +<P> +This example simplifies things considerably but is accurate so far as it +goes. In the real program there are a number of different ways the frame +can be changed, e.g., by the next frame or previous frame buttons, by menu +selection, keyboard accelerators, the blink timer, IRAF running in another +process, and so on. All of these end up sending a request to the <i> +ximtool</i> client which directly or indirectly results in a frame change. +When the display frame is changed a number of client events are generated to +inform the GUI not only of the new frame number, but also the new frame +title, zoom, pan, and frame flip values, type of enhancement used for the +frame, and so on. Each of these items represents a separate client event. +Although the action of the program may be arbitrarily complex in real world +examples, the basic messaging mechanism on which this is all based remains +very simple. +<P> +<H1><A NAME=SECTION021950000000000000000> Software Products</A></H1> +<P> +<H2><A NAME=SECTION021951000000000000000> The X11IRAF Package</A></H2> +<P> +All of the software described in this paper is packaged in a single +distribution called <i> x11iraf</i>. This includes <i> xgterm</i>, <i> ximtool</i>, +the Object Manager library, sources for all the third party widgets used in +OBM, and assorted demo applications. Everything needed to build the package +is included, including compatible versions of some publically available +libraries, e.g., Tcl and Xpm. Despite the name the software is +not tied to IRAF in any way, other than that it is a product of the IRAF +project and is used for IRAF GUIs. +<P> +<H2><A NAME=SECTION021952000000000000000> Xgterm</A></H2> +<P> +<i> Xgterm</i> is an upwards compatible version of the popular <i> xterm</i> +with the <i> xterm</i> graphics ripped out and replaced with an +OBM-based GUI which uses the gterm-image widget for graphics. The +graphics supports a number of extensions, including full color support, an +integrated imaging capability, dialog interaction, intelligent unconstrained +resize, and a full crosshair cursor. Although <i> xgterm</i> is often used as +a simple terminal emulator it is also a general widget server since it +contains the full OBM library, and it can be used to execute +arbitrarily complex OBM-based GUIs and manage the communications with the +remote client. The current version of <i> xgterm</i> is based on the X11R6 +version of <i> xterm</i>. +<P> +<H2><A NAME=SECTION021953000000000000000> Ximtool</A></H2> +<P> +<i> Ximtool</i> is an image display server, used by remote client applications +such as IRAF to display and interact with images. Several frames can be +loaded and independently displayed in a full-frame or tiled configuration. +Display frames can be any size. <i> Ximtool</i> is a good example of a +conventional single process windowing application which uses the OBM library +for the GUI and the window system interface. +<P> +<H2><A NAME=SECTION021954000000000000000> The Object Manager Library</A></H2> +<P> +The Object Manager library (OBM) is a high-level, interpreted window system +toolkit that is used to implement arbitrary graphics user interfaces. The OBM +library uses Tcl as the interpreter. The current version of the OBM +library is based on the X toolkit and can be used with any Xt-based +widget or widget set. +<P> +<H2><A NAME=SECTION021955000000000000000> The Gterm-Image Widget</A></H2> +<P> +The gterm-image widget is an X Toolkit-based widget for general +2D graphics and image display. This is a complex widget and a full +description of its capabilities is beyond the scope of this paper. The +Gterm widget provides a general GKS-like vector graphics and text display +capability. An integrated image display capability allows any number and +size of image rasters to be created within the widget or in the X server. +<i> Mappings</i> can be defined to map one raster to another, permitting +general graphics pipelines involving scaling and other geometric transforms +to be set up. Colormap support is included for grayscale and pseudocolor +rendering of raster data. An interactive <i> graphics marker</i> facility is +provided for interaction with the displayed graphic. The Gterm widget is +used for all graphics and imaging in <i> xgterm</i> and <i> ximtool</i>. +<P> +<H1><A NAME=SECTION021960000000000000000> Adding GUIs to IRAF Applications</A></H1> +<P> +A major application of the widget server and the other software described +in this paper is in adding GUIs to IRAF applications. In this case the +IRAF task is the client: when the IRAF task starts up it downloads its GUI +to the widget server, and during execution the IRAF task and the GUI +communicate via the messaging facility described earlier. The changes +required to add a GUI to an IRAF task are minor, ranging from +changing a single line of code to cause the GUI file to be downloaded, to +defining a set of client events and adding <i> gmsg</i> calls to allow more +complete integration of the GUI. Adding a GUI to a task increases the +system size by only the 10 Kb or so required for the GUI file. +<P> +<H1><A NAME=SECTION021970000000000000000> Availability and Further Information</A></H1> +<P> +Further information on the software described in this paper, including +more detailed documentation, full sources, and executables for a variety +of platforms can be found in +<A HREF="/iraf/web/projects/x11iraf">the X11IRAF Web page</A>. +Further information on IRAF itself and other IRAF products can be found in +<A HREF="/iraf/ftp>the IRAF anonymous ftp archives</A>. +Documentation on Tcl, Xt/XLIB and the other standard software products +used in X11IRAF is available from many sources. +<P> + +<P> + +<P> + +<P> +<BR> <HR> +<P><ADDRESS> +adass4_editors@stsci.edu +</ADDRESS> +</BODY> diff --git a/vendor/x11iraf/obm/docs/tody.paper/todyd1.gif b/vendor/x11iraf/obm/docs/tody.paper/todyd1.gif new file mode 100644 index 00000000..ef206249 Binary files /dev/null and b/vendor/x11iraf/obm/docs/tody.paper/todyd1.gif differ diff --git a/vendor/x11iraf/obm/docs/tody.paper/todyd2.gif b/vendor/x11iraf/obm/docs/tody.paper/todyd2.gif new file mode 100644 index 00000000..b3aea8ba Binary files /dev/null and b/vendor/x11iraf/obm/docs/tody.paper/todyd2.gif differ diff --git a/vendor/x11iraf/obm/docs/tody.paper/todyd3.gif b/vendor/x11iraf/obm/docs/tody.paper/todyd3.gif new file mode 100644 index 00000000..7038a128 Binary files /dev/null and b/vendor/x11iraf/obm/docs/tody.paper/todyd3.gif differ diff --git a/vendor/x11iraf/obm/geom.c b/vendor/x11iraf/obm/geom.c new file mode 100644 index 00000000..ac5db512 --- /dev/null +++ b/vendor/x11iraf/obm/geom.c @@ -0,0 +1,179 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ +/* Copyright 1987, Massachusetts Institute of Technology */ + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <stdio.h> + +/* + * GEOM.C -- Code to get geometry information for a window. This code was + * extracted from the xwininfo sources and hacked into the form of a library + * routine. + */ + +#define SZ_GEOMETRY 64 +static char geometry[SZ_GEOMETRY]; +static Display *dpy; + + +/* get_geometry -- Return the absolute size and position of a window. The + * geometry specification coresponding to the window size and position is + * returned as the function value. + */ +char * +get_geometry (display, screen, window, origin) + Display *display; + Screen *screen; + Window window; + int origin; /* return only origin-relative coords */ +{ + register char *op; + int screen_number = XScreenNumberOfScreen (screen); + XWindowAttributes win_attributes; + XVisualInfo vistemplate, *vinfo; + XSizeHints hints; + + int dw = DisplayWidth (display, screen_number); + int dh = DisplayHeight (display, screen_number); + int showright = 0, showbelow = 0; + int rx, ry, xright, ybelow; + Status status; + Window wmframe; + long longjunk; + Window junkwin; + int junk; + + if (!XGetWindowAttributes (dpy = display, window, &win_attributes)) + return (NULL); + vistemplate.visualid = XVisualIDFromVisual(win_attributes.visual); + /* MF036 + vinfo = XGetVisualInfo (dpy, VisualIDMask, &vistemplate, &junk); + */ + + (void) XTranslateCoordinates (dpy, window, win_attributes.root, + -win_attributes.border_width, + -win_attributes.border_width, + &rx, &ry, &junkwin); + + xright = (dw - rx - win_attributes.border_width * 2 - + win_attributes.width); + ybelow = (dh - ry - win_attributes.border_width * 2 - + win_attributes.height); + + /* compute size in appropriate units */ + status = XGetWMNormalHints (dpy, window, &hints, &longjunk); + op = geometry; + + if (status && (hints.flags & PResizeInc) && + hints.width_inc != 0 && hints.height_inc != 0) { + + if (hints.flags & (PBaseSize|PMinSize)) { + if (hints.flags & PBaseSize) { + win_attributes.width -= hints.base_width; + win_attributes.height -= hints.base_height; + } else { + /* ICCCM says MinSize is default for BaseSize */ + win_attributes.width -= hints.min_width; + win_attributes.height -= hints.min_height; + } + } + sprintf (op, "%dx%d", + win_attributes.width / hints.width_inc, + win_attributes.height / hints.height_inc); + } else + sprintf (op, "%dx%d", win_attributes.width, win_attributes.height); + + while (*op) + op++; + + if (!(hints.flags&PWinGravity)) + hints.win_gravity = NorthWestGravity; /* per ICCCM */ + + /* Find our window manager frame, if any. */ + wmframe = window; + while (True) { + Window root, parent; + Window *childlist; + unsigned int ujunk; + + status = XQueryTree (dpy, wmframe, &root, &parent, &childlist, &ujunk); + if (parent == root || !parent || !status) + break; + wmframe = parent; + if (status && childlist) + XFree ((char *)childlist); + } + + if (wmframe != window) { + /* WM reparented, so find edges of the frame. This only works for + * ICCCM-compliant WMs, and then only if the window has corner gravity. + * We would need to know the original width of the window to correctly + * handle the other gravities. + */ + XWindowAttributes frame_attr; + if (!XGetWindowAttributes (dpy, wmframe, &frame_attr)) + return (NULL); + + switch (hints.win_gravity) { + case NorthWestGravity: + case SouthWestGravity: + case NorthEastGravity: + case SouthEastGravity: + case WestGravity: + rx = frame_attr.x; + } + switch (hints.win_gravity) { + case NorthWestGravity: + case SouthWestGravity: + case NorthEastGravity: + case SouthEastGravity: + case EastGravity: + xright = dw - frame_attr.x - frame_attr.width - + 2 * frame_attr.border_width; + } + switch (hints.win_gravity) { + case NorthWestGravity: case SouthWestGravity: + case NorthEastGravity: case SouthEastGravity: + case NorthGravity: + ry = frame_attr.y; + } + switch (hints.win_gravity) { + case NorthWestGravity: case SouthWestGravity: + case NorthEastGravity: case SouthEastGravity: + case SouthGravity: + ybelow = dh - frame_attr.y - frame_attr.height - + 2 * frame_attr.border_width; + } + } + + /* If edge gravity, offer a corner on that edge (because the application + * programmer cares about that edge), otherwise offer upper left unless + * some other corner is close to an edge of the screen. (For corner + * gravity, assume gravity was set by XWMGeometry. For CenterGravity, + * it doesn't matter.) + */ + if (hints.win_gravity == EastGravity || + (abs(xright) <= 100 && abs(xright) < abs(rx) && + hints.win_gravity != WestGravity)) + showright = 1; + + if (hints.win_gravity == SouthGravity || + (abs(ybelow) <= 100 && abs(ybelow) < abs(ry) && + hints.win_gravity != NorthGravity)) + showbelow = 1; + + if (showright && !origin) + sprintf (op, "-%d", xright); + else + sprintf (op, "+%d", rx); + while (*op) + op++; + + if (showbelow && !origin) + sprintf (op, "-%d", ybelow); + else + sprintf (op, "+%d", ry); + + return (geometry); +} diff --git a/vendor/x11iraf/obm/gterm.c b/vendor/x11iraf/obm/gterm.c new file mode 100644 index 00000000..71856353 --- /dev/null +++ b/vendor/x11iraf/obm/gterm.c @@ -0,0 +1,4407 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ObmP.h> +#include "widget.h" + +/* + * Gterm-Image widget class (a subclass of Widget). + * ------------------------------------------------- + * The gterm-image widget is a general 2D graphics-imaging widget providing + * a wide range of facilities for drawing graphics and text, for image + * display, and for graphics interaction. Normally the client communicates + * directly with the Gterm widget to draw graphics, download image data, + * and so on, using some communications protocol outside the domain of the + * object manager. Nonetheless so far as possible the facilities of the Gterm + * widget have also been made available to GUI code via the commands listed + * here. + * + * The gterm class uses a special OBM callback known as OBMCB_setGterm. + * A client application can use this to post a procedure to be called when + * a gterm widget receives the setGterm command. The calling sequence for + * the setGterm callback is as follows: + * + * setgterm (client_data, gterm_widget) + * + * The purpose of this callback is to tell the client which gterm widget is + * the "active" gterm widget. This is used by clients which only support + * one active Gterm widget, i.e., which can only direct graphics output to + * one Gterm widget at a time. + * + * The messages or commands that can be sent to the Gterm widget by GUI + * code follow. + * + * General commands: + * + * setGterm [arg [arg ...]] # make widget the active Gterm + * + * activate + * deactivate + * addCallback procedure-name callback-type + * deleteCallback procedure-name + * reset + * flush + * + * setCursorPos x y [raster] + * getCursorPos x y + * setCursorType cursortype + * bell + * + * Graphics drawing commands: + * + * setRaster raster + * raster = getRaster [raster] + * + * setLogRes width height + * getLogRes width height + * setPhysRes width height + * getPhysRes width height + * setTextRes rows cols + * setDataLevel level + * setLineWidth width + * setLineStyle style + * setColorIndex index + * setFillType filltype + * + * clearScreen + * drawPolyline vector + * drawPolymarker vector + * drawPolygon vector + * drawMarker type x y xsize ysize [rotangle] + * + * drawAlphaText x y text + * width = getAlphaTextSize [string [width [height [base]]]] + * startDialog + * endDialog + * eraseDialog + * drawDialogText x y text + *width = getDialogTextSize [string [width [height [base]]]] + * + * The coordinates used in the graphics drawing commands are logical + * coordinates as defined by setLogRes, in the coordinate system of the + * reference drawing raster as defined by setRaster. The default reference + * raster is raster zero, the widget's window. Vectors are specified as + * a list of points, e.g., { {x y} {x y} ... }. + * + * Imaging commands: + * + * rasterInit + * assignRaster raster drawable + * createRaster raster width height [type [depth]] + * destroyRaster raster + * exists = queryRaster raster [width [height [type [depth]]]] + * raster = nextRaster + * n = activeRasters + * + * setPixel raster x y value + * value = getPixel raster x y + * writePixels raster pixels encoding x1 y1 nx ny [bias] + * pixels = readPixels raster encoding x1 y1 nx ny [bias] + * refreshPixels raster ct x1 y1 nx ny + * setPixels raster color [ct x1 y1 nx ny [rop]] + * extractPixmap pixmap src [x y [width height]] + * insertPixmap pixmap dst [x y [width height]] + * + * colormap = nextColormap + * freeColormap colormap + * writeColormap colormap colors [offset] + * ncolors = readColormap colormap colors [offset [ncolors]] + * loadColormap colormap offset scale + * pixel = clientPixel gterm_pixel + * bias = getBias [nelem [maxelem]] + * + * initMappings + * mapping = nextMapping + * freeMapping mapping + * raiseMapping mapping [reference] + * lowerMapping mapping [reference] + * enableMapping mapping [refresh] + * disableMapping mapping [erase] + * active = activeMapping mapping + * refreshMapping mapping + * + * copyRaster rop src st sx sy snx sny dst dt dx dy dnx dny + * setMapping mapping rop + * src st sx sy snx sny dst dt dx dy dnx dny + * getMapping mapping rop + * src st sx sy snx sny dst dt dx dy dnx dny + * + * raster = selectRaster dras dt dx dy rt rx ry [map] + * unmapPixel sx sy raster rx ry [rz] + * + * flip mapping axis [axis...] + * + * Pixel arrays are long strings consisting either of a sequence of numeric + * pixel values separated by whitespace (space or newline), or a hex encoded + * sequence of bytes (1 or 2 hex digits per 8 bit pixel). Hex encoded pixel + * arrays may optionally be compressed using a simple run length encoding + # scheme. Colors are specified as a list of RGB triplets, e.g., { {R G B} + # {R G B} ... }. + * + * Refer to the documentation for the Gterm widget for a detailed description + * of rasters, mappings, and colormaps. + * + * Markers: + * + * createMarker name [attribute-list] + * markerInit + * + * New markers may be created with createMarker. Once created, a marker + * functions under the Object Manager as a named object of class "marker". + * Refer to the marker class for a description of the commands defined for + * a marker. + */ + +#define MAX_COLORS 256 +#define MAX_POLYPTS 4096 +#define FIRST_COLOR 10 +#define CB_Input 1 +#define CB_Resize 2 +#define CB_Reset 3 + +/* Gterm class instance descriptor. */ +struct gtermPrivate { + ObmCallback callback_list; + int colormap; + float offset, scale; +}; + +typedef struct gtermPrivate *GtermPrivate; + +struct gtermObject { + struct obmObjectCore core; + struct widgetPrivate widget; + struct gtermPrivate gterm; +}; + +typedef struct gtermObject *GtermObject; + +/* Gterm class class record private data. */ +typedef struct { + /* standard MsgContext fields. */ + Tcl_Interp *tcl; /* class interpreter */ + ObmObject object[MAX_LEVELS]; /* object which received last message */ + int level; + + /* Gterm specific fields. */ + /* (none) */ +} gtermClassData, *GtermClassData; + + +void GtermDestroy(); +void GtermClassDestroy(); +ObmObject GtermCreate(); + +static int gtermActivate(), gtermActiveMapping(), gtermActiveRasters(); +static int gtermAddCallback(), gtermDeleteCallback(); +static int gtermAssignRaster(), gtermBell(), gtermGetBias(); +static int gtermClearScreen(), gtermClientPixel(), gtermCopyRaster(); +static int gtermCreateMarker(), gtermCreateRaster(), gtermDeactivate(); +static int gtermDestroyRaster(), gtermDisableMapping(), gtermDrawAlphaText(); +static int gtermDrawDialogText(), gtermDrawMarker(), gtermDrawPolygon(); +static int gtermDrawPolyline(), gtermDrawPolymarker(), gtermEnableMapping(); +static int gtermEndDialog(), gtermEraseDialog(), gtermExtractPixmap(); +static int gtermFlip(), gtermFlush(), gtermFreeColormap(); +static int gtermFreeMapping(), gtermRaiseMapping(), gtermLowerMapping(); +static int gtermGetAlphaTextSize(), gtermGetCursorPos(); +static int gtermGetDialogTextSize(), gtermGetLogRes(), gtermGetMapping(); +static int gtermGetPhysRes(), gtermGetPixel(), gtermGetRaster(); +static int gtermInitMappings(), gtermInsertPixmap(), gtermLoadColormap(); +static int gtermMarkerInit(), gtermNextColormap(), gtermNextMapping(); +static int gtermNextRaster(), gtermQueryRaster(), gtermRasterInit(); +static int gtermReadColormap(), gtermReadPixels(), gtermRefreshMapping(); +static int gtermRefreshPixels(), gtermReset(), gtermSelectRaster(); +static int gtermSetColorIndex(), gtermSetCursorPos(), gtermSetCursorType(); +static int gtermSetDataLevel(), gtermSetFillType(), gtermSetGterm(); +static int gtermSetLineStyle(), gtermSetLineWidth(), gtermSetLogRes(); +static int gtermSetMapping(), gtermSetPhysRes(), gtermSetPixel(); +static int gtermSetPixels(), gtermSetRaster(), gtermSetTextRes(); +static int gtermStartDialog(), gtermUnmapPixel(), gtermWriteColormap(); +static int gtermWritePixels(); + +static void gtermInputCallback(); +static void gtermResizeCallback(), gtermResetCallback(); +static void get_mapping(), put_mapping(); +static XPoint *get_points(); +extern double strtod(), atof(); + + +/* GtermClassInit -- Initialize the class record for the gterm widget class. + */ +void +GtermClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register GtermClassData gcd; + register Tcl_Interp *tcl; + register ClientData c_gcd; + + /* Install the class methods. */ + classrec->ClassDestroy = GtermClassDestroy; + classrec->Create = (ObmFunc) GtermCreate; + classrec->Destroy = GtermDestroy; + classrec->Evaluate = WidgetEvaluate; + + /* The gterm widget subclass has its own command set hence has its + * own interpreter. The widget will respond both to all the commands + * defined here, and to all the commands implemented by the base + * Widget class. + */ + if (!classrec->class_data) { + gcd = (GtermClassData) XtCalloc (1, sizeof (gtermClassData)); + gcd->tcl = tcl = Tcl_CreateInterp(); + classrec->class_data = (XtPointer) gcd; + c_gcd = (ClientData)gcd; + gcd->level = 0; + + Tcl_CreateCommand (tcl, + "activate", gtermActivate, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "activeMapping", gtermActiveMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "activeRasters", gtermActiveRasters, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "addCallback", gtermAddCallback, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "deleteCallback", gtermDeleteCallback, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "assignRaster", gtermAssignRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "bell", gtermBell, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "clearScreen", gtermClearScreen, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "clientPixel", gtermClientPixel, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "copyRaster", gtermCopyRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "createMarker", gtermCreateMarker, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "createRaster", gtermCreateRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "deactivate", gtermDeactivate, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "destroyRaster", gtermDestroyRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "disableMapping", gtermDisableMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "drawAlphaText", gtermDrawAlphaText, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "drawDialogText", gtermDrawDialogText, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "drawMarker", gtermDrawMarker, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "drawPolygon", gtermDrawPolygon, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "drawPolyline", gtermDrawPolyline, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "drawPolymarker", gtermDrawPolymarker, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "enableMapping", gtermEnableMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "endDialog", gtermEndDialog, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "eraseDialog", gtermEraseDialog, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "extractPixmap", gtermExtractPixmap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "flip", gtermFlip, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "flush", gtermFlush, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "freeColormap", gtermFreeColormap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "freeMapping", gtermFreeMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "raiseMapping", gtermRaiseMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "lowerMapping", gtermLowerMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getAlphaTextSize", gtermGetAlphaTextSize, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getBias", gtermGetBias, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getCursorPos", gtermGetCursorPos, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getDialogTextSize", gtermGetDialogTextSize, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getLogRes", gtermGetLogRes, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getMapping", gtermGetMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getPhysRes", gtermGetPhysRes, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getPixel", gtermGetPixel, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getRaster", gtermGetRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "initMappings", gtermInitMappings, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "insertPixmap", gtermInsertPixmap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "loadColormap", gtermLoadColormap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "markerInit", gtermMarkerInit, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "nextColormap", gtermNextColormap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "nextMapping", gtermNextMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "nextRaster", gtermNextRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "queryRaster", gtermQueryRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "rasterInit", gtermRasterInit, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "readColormap", gtermReadColormap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "readPixels", gtermReadPixels, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "refreshMapping", gtermRefreshMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "refreshPixels", gtermRefreshPixels, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "reset", gtermReset, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "selectRaster", gtermSelectRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setColorIndex", gtermSetColorIndex, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setCursorPos", gtermSetCursorPos, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setCursorType", gtermSetCursorType, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setDataLevel", gtermSetDataLevel, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setFillType", gtermSetFillType, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setGterm", gtermSetGterm, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setLineStyle", gtermSetLineStyle, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setLineWidth", gtermSetLineWidth, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setLogRes", gtermSetLogRes, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setMapping", gtermSetMapping, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setPhysRes", gtermSetPhysRes, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setPixel", gtermSetPixel, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setPixels", gtermSetPixels, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setRaster", gtermSetRaster, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setTextRes", gtermSetTextRes, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "startDialog", gtermStartDialog, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "unmapPixel", gtermUnmapPixel, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "writeColormap", gtermWriteColormap, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "writePixels", gtermWritePixels, c_gcd, NULL); + } +} + + +/* GtermClassDestroy -- Custom destroy procedure for the widget class. + */ +void +GtermClassDestroy (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register GtermClassData gcd = (GtermClassData) classrec->class_data; + + if (gcd) { + if (gcd->tcl) + Tcl_DeleteInterp (gcd->tcl); + XtFree ((char *)gcd); + classrec->class_data = NULL; + } +} + + +/* GtermCreate -- Create an instance of a gterm object. + */ +ObmObject +GtermCreate (obm, name, classrec, parent, args, nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList args; +int nargs; +{ + register GtermObject obj; + Widget w, pw; + + obj = (GtermObject) WidgetCreate (obm, name, + classrec, parent, args, nargs); + if (obj == NULL) + return (NULL); + + obj = (GtermObject) XtRealloc ((char *)obj, sizeof(struct gtermObject)); + if (obj == NULL) + return (NULL); + + /* Initialize GtermPrivate instance structure. */ + obj->gterm.callback_list = NULL; + obj->gterm.colormap = 0; + obj->gterm.offset = 0.5; + obj->gterm.scale = 1.0; + + return ((ObmObject) obj); +} + + +/* GtermDestroy -- Destroy an instance of a gterm object. + */ +void +GtermDestroy (object) +ObmObject object; +{ + GtermObject obj = (GtermObject) object; + ObjClassRec classrec = obj->core.classrec; + register GtermClassData gcd = (GtermClassData) classrec->class_data; + register ObmCallback cb, cb_next; + ObmContext obm = obj->widget.obm; + Widget w = obj->widget.w; + + /* Destroy the object in the second final call to Destroy. */ + if (!obj->core.being_destroyed++) + return; + + /* Invoke any posted setGterm callbacks. This is not completely + * correct; in principle we should call the setGterm callback only + * if the active gterm widget is destroyed. + */ + for (cb = obm->callback_list; cb; cb = cb->next) + if ((cb->callback_type & OBMCB_setGterm) && cb->u.fcn) + (*cb->u.fcn) (cb->client_data, NULL); + + /* Free any gterm callback descriptors. */ + for (cb = obj->gterm.callback_list; cb; cb = cb_next) { + cb_next = cb->next; + + /* Delete the widget level callback. */ + switch (cb->callback_type) { + case CB_Input: + GtDeleteInputProc (w, gtermInputCallback, (XtPointer)cb); + break; + case CB_Resize: + GtDeleteResizeProc (w, gtermResizeCallback, (XtPointer)cb); + break; + case CB_Reset: + GtDeleteResetProc (w, gtermResetCallback, (XtPointer)cb); + break; + } + + XtFree ((char *)cb); + } + + WidgetDestroy (object); +} + + +/* + * GTERM class commands. + * ----------------------- + */ + + +/* SetGterm -- Set the active Gterm widget. Call any OBMCB_setGterm callbacks + * registered by the client code, passing the client the Xt Widget handle of + * the active gterm widget. + * + * Usage: setGterm [arg [arg ...]] + * + * This feature may be used during GUI execution to identify the currently + * active gterm widget to the client, or during startup to pass the Widget id + * to the client code so that it can talk directly to the gterm widget. + */ +static int +gtermSetGterm (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register GtermClassData gcd = (GtermClassData) msg; + GtermObject obj = (GtermObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + register ObmCallback cb; + ObmContext obm = wp->obm; + char *message; + + message = (argc > 1) ? Tcl_Concat (argc-1, &argv[1]) : NULL; + + for (cb = obm->callback_list; cb; cb = cb->next) + if ((cb->callback_type & OBMCB_setGterm) && cb->u.fcn) + (*cb->u.fcn) (cb->client_data, wp->w, message); + + if (message) + free ((char *)message); + + return (TCL_OK); +} + + +/* Activate -- Activate the gterm widget. This causes the next GIN mode + * setCursorType to warp the pointer into the gterm window. + * + * Usage: activate + */ +static int +gtermActivate (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtActivate (w); + return (TCL_OK); +} + + +/* Deactivate -- Deactivate the gterm widget. If the cursor has been warped + * into the window by a previous activate/setCursorType GIN mode, this causes + * the cursor to be warped back to where it was previously. + * + * Usage: deactivate + */ +static int +gtermDeactivate (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtDeactivate (w); + return (TCL_OK); +} + + +/* Reset -- Reset the gterm widget. This causes a number of state variables + * affecting graphics drawing options to be set to their default values. + * + * Usage: reset + */ +static int +gtermReset (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtReset (w); + return (TCL_OK); +} + + +/* Flush -- Flush any graphics output and synchronize the state of the widget + * with what is shown on the display. + * + * Usage: flush + * + * The gterm widget uses XLIB, which buffers graphics drawing commands and + * automatically sends them to the X server when 1) the buffer fills, + * 2) input is requested from the server. Such buffering of data is necessary + * for efficient operation and it should rarely be necessary to explicitly + * flush graphics output since XLIB does this automatically in most cases. + * An example of when explicitly flushing the ouptut might be necessary is in + * cases where smooth animation is desired and drawing the graphics in batches + * could cause the display to appear "jerky". + */ +static int +gtermFlush (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtFlush (w); + return (TCL_OK); +} + + +/* AddCallback -- Post a callback for a Gterm widget event. + * + * Usage: addCallback procedure-name [callback-type] + * + * The recognized Gterm callbacks are + * + * input Called when the graphics-input action is invoked in + * a translation table. The default Gterm translation + * table invokes this action when a KeyPress event occurs + * in the Gterm window. + * + * Callback: widget-name input-type event-data + * + * resize Called when the gterm window is resized. + * + * Callback: widget-name width height + * + * reset Called when the "reset" action is invoked. + * + * Callback: widget-name + * + * If no callback is specified the default is "input". + * + * Note that in GUI code one can also use the translation table to directly + * invoke GUI procedures without need to use the Gterm input mechanism. This + * is more flexible but we support the Gterm input callback here for + * applications that use the default translations. + */ +static int +gtermAddCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register GtermPrivate gp = &obj->gterm; + register Widget w = wp->w; + char *userproc, *callback_type; + ObmCallback cb, new; + int type; + + if (argc < 2) + return (TCL_ERROR); + + userproc = argv[1]; + callback_type = (argc > 2) ? argv[2] : "input"; + + if (strcmp (callback_type, "input") == 0) + type = CB_Input; + else if (strcmp (callback_type, "resize") == 0) + type = CB_Resize; + else if (strcmp (callback_type, "reset") == 0) + type = CB_Reset; + else + return (TCL_ERROR); + + /* Initialize callback descriptor. */ + new = (ObmCallback) XtCalloc (1, sizeof (obmCallback)); + new->u.obj = (ObmObject) obj; + new->callback_type = type; + strncpy (new->name, userproc, SZ_NAME); + + /* Append descriptor to callback list for widget. */ + for (cb = gp->callback_list; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + gp->callback_list = new; + + /* Register the callback with the widget. */ + switch (type) { + case CB_Input: + GtPostInputProc (w, gtermInputCallback, (XtPointer)new); + break; + case CB_Resize: + GtPostResizeProc (w, gtermResizeCallback, (XtPointer)new); + break; + case CB_Reset: + GtPostResetProc (w, gtermResetCallback, (XtPointer)new); + break; + } + + return (TCL_OK); +} + + +/* DeleteCallback -- Delete a gterm callback. + * + * Usage: deleteCallback procedure + */ +static int +gtermDeleteCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register GtermPrivate gp = &obj->gterm; + register ObmCallback cb, prev; + Widget w = obj->widget.w; + char *procedure; + + if (argc < 2) + return (TCL_ERROR); + procedure = argv[1]; + + /* Locate and delete procedure entry in callback list. */ + for (prev=NULL, cb=gp->callback_list; cb; prev=cb, cb=cb->next) + if (strcmp (cb->name, procedure) == 0) { + /* Delete the widget level callback. */ + switch (cb->callback_type) { + case CB_Input: + GtDeleteInputProc (w, gtermInputCallback, (XtPointer)cb); + break; + case CB_Resize: + GtDeleteResizeProc (w, gtermResizeCallback, (XtPointer)cb); + break; + case CB_Reset: + GtDeleteResetProc (w, gtermResetCallback, (XtPointer)cb); + break; + } + if (prev) + prev->next = cb->next; + else + gp->callback_list = cb->next; + XtFree ((char *)cb); + break; + } + + return (TCL_OK); +} + + +/* gtermInputCallback -- Low level callback procedure, called by the Gterm + * widget when an input event occurs. + * + * Callback: userproc widget-name input-type x y data + * Example: userproc widget-name keyPress x y {a shift} + * + * where input-type is keyPress, keyRelease, buttonPress, or buttonRelease, + * and data depends upon the type of input event. data is a list of strings + * delimited by braces. The first string is the key or button pressed and + * the following strings give the state of any modifier keys ("shift", + * "control" and so on). + */ +static void +gtermInputCallback (cb, w, event) +ObmCallback cb; +Widget w; +XEvent *event; +{ + GtermObject obj = (GtermObject) cb->u.obj; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + char s_x[SZ_NUMBER], s_y[SZ_NUMBER]; + char message_data[SZ_LINE]; + char *event_type; + int status; + + switch (event->type) { + case KeyPress: + case KeyRelease: + { XKeyPressedEvent *ev = (XKeyPressedEvent *) event; + register char *ip, *op = message_data; + char buf[SZ_MESSAGE]; + int n; + + if (event->type == KeyPress) + event_type = "keyPress"; + else + event_type = "keyRelease"; + + sprintf (s_x, "%d", ev->x); + sprintf (s_y, "%d", ev->y); + + if ((n = XLookupString(ev,buf,sizeof(buf),NULL,NULL)) > 0) { + for (ip=buf; --n >= 0; ) + if (*ip <= ' ') { + *op++ = '^'; + *op++ = *ip++ + 'A' - 1; + } else if (isprint (*ip)) { + *op++ = *ip++; + } else + ip++; + } else { + /* This case occurs when only a modifier is typed. */ + for (ip = "??"; *op++ = *ip++; ) + ; + } + *op++ = ' '; + op = widgetEventState (op, ev->state); + while (op > message_data && isspace (*(op-1))) + --op; + *op = '\0'; + } + break; + + case ButtonPress: + case ButtonRelease: + { XButtonPressedEvent *ev = (XButtonPressedEvent *) event; + register char *op = message_data; + + if (event->type == KeyPress) + event_type = "buttonPress"; + else + event_type = "buttonRelease"; + + sprintf (s_x, "%d", ev->x); + sprintf (s_y, "%d", ev->y); + + sprintf (op, "%d ", ev->button); + while (*op) + op++; + *op++ = ' '; + op = widgetEventState (op, ev->state); + while (op > message_data && isspace (*(op-1))) + --op; + *op = '\0'; + } + break; + + default: + strcpy (message_data, "unknown none"); + } + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + event_type, " ", + s_x, " ", + s_y, " ", + "{", message_data, "}", + NULL); + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } +} + + +/* gtermResizeCallback -- Low level callback procedure, called by the Gterm + * widget when a resize event occurs. + * + * Callback: userproc widget-name width height + */ +static void +gtermResizeCallback (cb, w) +ObmCallback cb; +Widget w; +{ + GtermObject obj = (GtermObject) cb->u.obj; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + int rtype, width, height, depth, status; + char s_width[SZ_NUMBER], s_height[SZ_NUMBER]; + + GtQueryRaster (wp->w, 0, &rtype, &width, &height, &depth); + sprintf (s_width, "%d", width); + sprintf (s_height, "%d", height); + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + s_width, " ", + s_height, " ", + NULL); + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } +} + + +/* gtermResetCallback -- Low level callback procedure, called by the Gterm + * widget when a reset event occurs. + * + * Callback: userproc + */ +static void +gtermResetCallback (cb, w) +ObmCallback cb; +Widget w; +{ + GtermObject obj = (GtermObject) cb->u.obj; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + int status; + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + NULL); + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } +} + + +/* SetCursorPos -- Warp the cursor (pointer) to the given coordinates. This + * is a graphics drawing command and if no raster number is specified the + * current reference drawing raster, as set with setRaster, defines the + * coordinate system. + * + * Usage: setCursorPos x y [raster] + * + * A raster number may optionally given to define the raster coordinate system + * to be used. raster=0 yields screen coordinates. + */ +static int +gtermSetCursorPos (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + int raster, sv_raster, x, y; + + if (argc < 3) + return (TCL_ERROR); + + x = (int) atof (argv[1]); + y = (int) atof (argv[2]); + raster = (argc > 3) ? atoi (argv[3]) : -1; + + if (raster >= 0) { + sv_raster = GtGetRaster (wp->w); + if (raster != sv_raster) + GtSetRaster (wp->w, raster); + } + + GtSetCursorPos (wp->w, x, y); + + if (raster >= 0) + if (raster != sv_raster) + GtSetRaster (wp->w, sv_raster); + + return (TCL_OK); +} + + +/* GetCursorPos -- Get the cursor position (raster 0 or screen coordinates). + * + * Usage: getCursorPos x y + */ +static int +gtermGetCursorPos (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + char *xout, *yout, buf[SZ_NUMBER]; + int x, y; + + if (argc < 3) + return (TCL_ERROR); + + xout = argv[1]; + yout = argv[2]; + + GtGetCursorPos (wp->w, &x, &y); + sprintf (buf, "%d", x); + Tcl_SetVar (obm->tcl, xout, buf, 0); + sprintf (buf, "%d", y); + Tcl_SetVar (obm->tcl, yout, buf, 0); + + return (TCL_OK); +} + + +/* setCursorType -- Set the cursor type. + * + * Usage: setCursorType cursor-type + * + * idle default cursor + * + * busy busy cursor, e.g, when program is busy + * + * ginMode graphics input mode cursor, set when program is + * waiting for graphics input + */ +static int +gtermSetCursorType (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char *cursor_type; + int type; + + if (argc < 2) + return (TCL_ERROR); + + cursor_type = argv[1]; + if (strcmp (cursor_type, "idle") == 0) + type = GtIdleCursor; + else if (strcmp (cursor_type, "busy") == 0) + type = GtBusyCursor; + else if (strcmp (cursor_type, "ginMode") == 0) + type = GtGinmodeCursor; + else + return (TCL_ERROR); + + GtSetCursorType (w, type); + + return (TCL_OK); +} + + +/* Bell -- Gterm widget sound output. + * + * Usage: bell + */ +static int +gtermBell (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtBell (w); + return (TCL_OK); +} + + +/* setRaster -- Set the number of the raster to be used to define the drawing + * context (e.g. coordinate system) for graphics and text drawing functions. + * + * Usage: setRaster raster-number + */ +static int +gtermSetRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int raster; + + if (argc < 2) + return (TCL_ERROR); + + raster = atoi (argv[1]); + GtSetRaster (w, raster); + + return (TCL_OK); +} + + +/* getRaster -- Get the number of the raster which defines the drawing + * context, as set in the last setRaster call. + * + * Usage: raster = getRaster [raster] + * + * If the name of a variable is given the raster number will be stored + * directly in that variable. + */ +static int +gtermGetRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char buf[SZ_NUMBER], *raster_var; + int raster; + + raster = GtGetRaster (w); + sprintf (buf, "%d", raster); + + if (argc == 2) + Tcl_SetVar (obm->tcl, argv[1], buf, 0); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* setLogRes -- Set the logical resolution of the graphics drawing surface + * in pixels. This defines the range of coordinates in drawing commands + * for drawing graphics such as lines, areas, or text. + * + * Usage: setLogRes width height + * + * Note that this has nothing to do with imaging and the resolution of an + * image raster. The logical resolution of the graphics system is independent + * of the physical resolution of the drawing surface. + */ +static int +gtermSetLogRes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int width, height; + + if (argc < 3) + return (TCL_ERROR); + + width = atoi (argv[1]); + height = atoi (argv[2]); + GtSetLogRes (w, width, height); + + return (TCL_OK); +} + + +/* getLogRes -- Get the logical resolution of the graphics drawing surface + * in pixels. + * + * Usage: getLogRes width height + */ +static int +gtermGetLogRes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char *s_width, *s_height; + char buf[SZ_NUMBER]; + int width, height; + + if (argc < 3) + return (TCL_ERROR); + + s_width = argv[1]; + s_height = argv[2]; + GtGetLogRes (w, &width, &height); + + sprintf (buf, "%d", width); + Tcl_SetVar (obm->tcl, s_width, buf, 0); + sprintf (buf, "%d", height); + Tcl_SetVar (obm->tcl, s_height, buf, 0); + + return (TCL_OK); +} + + +/* setPhysRes -- Set the physical resolution of the graphics drawing surface + * in pixels. This represents an attempt to resize the graphics window to + * provide the requested resolution, i.e., to the given size width*height. + * + * Usage: setPhysRes width height [raster] + * + * This function is equivalent to a createRaster request for the indicated + * raster. The default raster is the current drawing raster. + */ +static int +gtermSetPhysRes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int raster, width, height; + + if (argc < 3) + return (TCL_ERROR); + + width = atoi (argv[1]); + height = atoi (argv[2]); + raster = (argc > 3) ? atoi(argv[3]) : GtGetRaster(w); + GtSetPhysRes (w, raster, width, height); + + return (TCL_OK); +} + + +/* getPhysRes -- Get the physical resolution of the graphics drawing surface + * in pixels. + * + * Usage: raster = getPhysRes width height [raster] + * + * If no raster number is specified the dimensions of the current drawing + * raster are returned. + */ +static int +gtermGetPhysRes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char *s_width, *s_height; + int raster, width, height; + char buf[SZ_NUMBER]; + + if (argc < 3) + return (TCL_ERROR); + + s_width = argv[1]; + s_height = argv[2]; + raster = (argc > 3) ? atoi(argv[3]) : GtGetRaster(w); + GtGetPhysRes (w, raster, &width, &height); + + sprintf (buf, "%d", width); + Tcl_SetVar (obm->tcl, s_width, buf, 0); + sprintf (buf, "%d", height); + Tcl_SetVar (obm->tcl, s_height, buf, 0); + + sprintf (buf, "%d", raster); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* setTextRes -- Set the resolution of the graphics drawing surface in + * characters (e.g., 80x35). + * + * Usage: setTextRes rows cols + * + * When drawing text the widget will space characters to achieve the desired + * resolution. When the drawing window is resized the widget will use this + * number to select the best font. + */ +static int +gtermSetTextRes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int rows, cols; + + if (argc < 3) + return (TCL_ERROR); + + rows = atoi (argv[1]); + cols = atoi (argv[2]); + GtSetTextRes (w, rows, cols); + + return (TCL_OK); +} + + +/* setDataLevel -- Set the logical drawing function used when drawing graphics + * or text. + * + * Usage: setDataLevel level + * + * The recognized data levels for drawing are "set", "clear", and "invert". + * Once set the data level remains in effect until the next clearScreen or + * reset. + */ +static int +gtermSetDataLevel (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int level; + + if (argc < 2) + return (TCL_ERROR); + if ((level = dataLevelType (argv[1])) < 0) + return (TCL_ERROR); + GtSetDataLevel (w, level); + + return (TCL_OK); +} + + +/* setLineWidth -- Set the line width for drawing operations. + * + * Usage: setLineWidth width + * + * The line width is specified in integer pixels. The value width=0 is + * equivalent to width=1 but may permit faster drawing in some cases. + * Once set the line width remains in effect until the next clearScreen or + * reset. + */ +static int +gtermSetLineWidth (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int width; + + if (argc < 2) + return (TCL_ERROR); + if ((width = atoi (argv[1])) < 0) + return (TCL_ERROR); + GtSetLineWidth (w, width); + + return (TCL_OK); +} + + +/* setLineStyle -- Set the line style for drawing operations. + * + * Usage: setLineStyle style + * + * The line style determines whether a solid or dashed line is drawn. The + * recognized line styles are "solid", "dashed", "dotted", dashDot", and + * "dash3dot". Once set the line style remains in effect until the next + * clearScreen or reset. + */ +static int +gtermSetLineStyle (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int style; + + if (argc < 2) + return (TCL_ERROR); + if ((style = lineStyle (argv[1])) < 0) + return (TCL_ERROR); + GtSetLineStyle (w, style); + + return (TCL_OK); +} + + +/* setColorIndex -- Set the gterm widget color index for drawing graphics and + * text. + * + * Usage: setColorIndex index + * + * The color index is an integer in the range 0 to N, where N is the maximum + * number of color table entries permitted by the widget. The gterm widget + * implements a simple color allocation scheme: color index 0 is the background + * color, 1 is the foreground, 2-9 are fixed, statically allocated colors (red, + * green, blue, etc.) and color indices 10 and greater are dynamically + * allocated private colors allocated at runtime by the application. + * + * Colors may be specified by number or by one of the names "background" + * "foreground", "black", "white", "red", "green", "blue", "cyan", "yellow", + * "magenta", "user1", or "user2". These names are aliases for color indices + * 0-9 and the actual color may differ from the logical color associated with + * the given statically defined color index. + * + * Once set the drawing color remains in effect until the next clearScreen or + * reset. + */ +static int +gtermSetColorIndex (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int color; + + if (argc < 2) + return (TCL_ERROR); + if ((color = colorToIndex (argv[1])) < 0) + return (TCL_ERROR); + GtSetColorIndex (w, color); + + return (TCL_OK); +} + + +/* setFillType -- Set the type of fill for area-fill drawing operations. + * + * Usage: setFillType filltype + * + * The fill type may be "solid" or "outline". Once set the fill type remains + * in effect until the next clearScreen or reset. + */ +static int +gtermSetFillType (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int filltype; + + if (argc < 2) + return (TCL_ERROR); + if ((filltype = fillType (argv[1])) < 0) + return (TCL_ERROR); + GtSetFillType (w, filltype); + + return (TCL_OK); +} + + +/* clearScreen -- Clear the "screen", i.e., window. This action clears the + * drawing window and sets a number of drawing state variables to their default + * values. + * + * Usage: clearScreen + */ +static int +gtermClearScreen (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtClearScreen (w); + return (TCL_OK); +} + + +/* drawPolyline -- Draw a polyline. + * + * Usage: drawPolyline points + * + * The points vector is a list of points, wherein each point is itself a list + * consisting of two elements, the X and Y coordinates of the point. The + * coordinate system is the logical coordinate system defined by setLogRes. + * All drawing attributes such as the line width, style, color, context raster + * if any, and so on will affect the drawing operation. + */ +static int +gtermDrawPolyline (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + int npoints; + + if (argc < 2) + return (TCL_ERROR); + + if ((pv = get_points (argv[1], &npoints)) == NULL) + return (TCL_ERROR); + GtDrawPolyline (w, pv, npoints); + + XtFree ((char *)pv); + return (TCL_OK); +} + + +/* drawPolymarker -- Draw a polymarker, or sequence of points. + * + * Usage: drawPolymarker points + * + * The points vector is a list of points, wherein each point is itself a list + * consisting of two elements, the X and Y coordinates of the point. The + * coordinate system is the logical coordinate system defined by setLogRes. + * All drawing attributes such as the line width, style, color, context raster + * if any, and so on will affect the drawing operation. + */ +static int +gtermDrawPolymarker (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + int npoints; + + if (argc < 2) + return (TCL_ERROR); + + if ((pv = get_points (argv[1], &npoints)) == NULL) + return (TCL_ERROR); + GtDrawPolymarker (w, pv, npoints); + + XtFree ((char *)pv); + return (TCL_OK); +} + + +/* drawPolygon -- Draw a polygon, or filled area. + * + * Usage: drawPolygon points + * + * The points vector is a list of points, wherein each point is itself a list + * consisting of two elements, the X and Y coordinates of the point. The + * coordinate system is the logical coordinate system defined by setLogRes. + * All drawing attributes such as the line width, style, color, context raster + * if any, and so on will affect the drawing operation. + */ +static int +gtermDrawPolygon (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + int npoints; + + if (argc < 2) + return (TCL_ERROR); + + if ((pv = get_points (argv[1], &npoints)) == NULL) + return (TCL_ERROR); + GtDrawPolygon (w, pv, npoints); + + XtFree ((char *)pv); + return (TCL_OK); +} + + +/* drawMarker -- Draw a marker. + * + * Usage: drawMarker type x y xsize ysize [rotangle] + * + * A marker of the indicated size and type is drawn at the indicated position. + * The marker type is one of "box", "circle", "ellipse", and so on. + */ +static int +gtermDrawMarker (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + /* not yet implemented. */ + return (TCL_ERROR); +} + + +/* drawAlphaText -- Draw a graphics text string. + * + * Usage: drawAlphaText x y text + * + * A text string is drawn at the indicated position using the current alpha + * text font. The font is selected based on the window size from a resource + * defined list of alpha fonts of different sizes. Alpha text is drawn like + * line graphics, i.e., the background is visible through the text. Drawing + * attributes such as color, data level, context raster, etc. apply to text + * as well as to line graphics. Rotation of text strings is not supported. + * The coordinaes X,Y refer to the lower left corner of the text string where + * "lower" refers to the baseline of the font. That is, if the text string + * is "E", the coordinates x,y refer to the lower left corner of the E. + */ +static int +gtermDrawAlphaText (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char *text; + int x, y; + + if (argc < 4) + return (TCL_ERROR); + + x = atoi (argv[1]); + y = atoi (argv[2]); + text = argv[3]; + GtDrawAlphaText (w, x, y, text); + + return (TCL_OK); +} + + +/* getAlphaTextSize -- Get the size in destination drawable pixels of an + * alpha text string in terms of the current graphics context. + * + * Usage: width = getAlphaTextSize [string [width [height [base]]]] + * + * The size in pixels of the given string is returned in the WIDTH and HEIGHT + * output variables. If no string or the null string is given the maximum + * width and height of a single character in the font are returned. If a BASE + * output variable is given this variable will be set to the Y offset from the + * top of the string to the baseline of the characters forming the string. + */ +static int +gtermGetAlphaTextSize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + + char *s_width, *s_height, *s_base; + int width, height, base; + char buf[SZ_NUMBER]; + char *text; + + if (argc > 1 && (int)strlen(argv[1]) > 0) + text = argv[1]; + else + text = NULL; + + s_width = (argc > 2) ? argv[2] : NULL; + s_height = (argc > 3) ? argv[3] : NULL; + s_base = (argc > 4) ? argv[4] : NULL; + + GtGetAlphaTextSize (w, text, &width, &height, &base); + if (s_width) { + sprintf (buf, "%d", width); + Tcl_SetVar (obm->tcl, s_width, buf, 0); + } + if (s_height) { + sprintf (buf, "%d", height); + Tcl_SetVar (obm->tcl, s_height, buf, 0); + } + if (s_base) { + sprintf (buf, "%d", base); + Tcl_SetVar (obm->tcl, s_base, buf, 0); + } + + sprintf (buf, "%d", width); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* startDialog -- Activate the dialog area for dialog text drawing. + * + * Usage: startDialog + * + * Dialog text is text which is drawn into the dialog area at the bottom of + * the gterm window. Dialog text is transient and is not a permanent part of + * the graphics being drawn. Dialog text is normally used to interact with + * the user or to display messages during program operation, without affecting + * the graphics being drawn. + * + * startDialog is called to prepare the dialog area and initialize dialog + * text mode, prior to drawing dialog text with drawDialogText. + */ +static int +gtermStartDialog (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + + GtStartDialog (w); + return (TCL_OK); +} + + +/* endDialog -- Deactivate the dialog area used for dialog text drawing. + * + * Usage: endDialog + * + * endDialog is called when one is finished drawing dialog text, erasing + * the dialog text area and terminating dialog text mode. + */ +static int +gtermEndDialog (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + + GtEndDialog (w); + return (TCL_OK); +} + + +/* eraseDialog -- Erase the dialog text area. + * + * Usage: eraseDialog + * + * eraseDialog may be called at any time to erase the dialog text area without + * exiting dialog text mode. + */ +static int +gtermEraseDialog (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + + GtEraseDialog (w); + return (TCL_OK); +} + + +/* drawDialogText -- Draw a dialog box text string. + * + * Usage: drawDialogText x y text + * + * A text string is drawn at the indicated position using the current dialog + * text font. The font is selected based on the window size from a resource + * defined list of dialog fonts of different sizes. The attributes of dialog + * text (color etc.) are determined by the widget resources and the window + * size and are independent of the graphics context used for alpha text and + * other graphics. The coordinaes X,Y refer to the lower left corner of the + * text string where "lower" refers to the baseline of the font. That is, if + * the text string is "E", the coordinates x,y refer to the lower left corner + * of the E. + */ +static int +gtermDrawDialogText (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + char *text; + int x, y; + + if (argc < 4) + return (TCL_ERROR); + + x = atoi (argv[1]); + y = atoi (argv[2]); + text = argv[3]; + GtDrawDialogText (w, x, y, text); + + return (TCL_OK); +} + + +/* getDialogTextSize -- Get the size in destination drawable pixels of an + * dialog text string in terms of the current graphics context. + * + * Usage: width = getDialogTextSize [string [width [height [base]]]] + * + * The size in pixels of the given string is returned in the WIDTH and HEIGHT + * output variables. If no string or the null string is given the maximum + * width and height of a single character in the font are returned. If a BASE + * output variable is given this variable will be set to the Y offset from the + * top of the string to the baseline of the characters forming the string. + */ +static int +gtermGetDialogTextSize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + register XPoint *pv; + + char *s_width, *s_height, *s_base; + int width, height, base; + char buf[SZ_NUMBER]; + char *text; + + if (argc > 1 && (int)strlen(argv[1]) > 0) + text = argv[1]; + else + text = NULL; + + s_width = (argc > 2) ? argv[2] : NULL; + s_height = (argc > 3) ? argv[3] : NULL; + s_base = (argc > 4) ? argv[4] : NULL; + + GtGetDialogTextSize (w, text, &width, &height, &base); + if (s_width) { + sprintf (buf, "%d", width); + Tcl_SetVar (obm->tcl, s_width, buf, 0); + } + if (s_height) { + sprintf (buf, "%d", height); + Tcl_SetVar (obm->tcl, s_height, buf, 0); + } + if (s_base) { + sprintf (buf, "%d", base); + Tcl_SetVar (obm->tcl, s_base, buf, 0); + } + + sprintf (buf, "%d", width); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* rasterInit -- Initialize the raster subsystem, deleting all rasters and + * mappings and freeing the dynamic part of the colortable. + * + * Usage: rasterInit + */ +static int +gtermRasterInit (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtRasterInit (w); + return (TCL_OK); +} + + +/* assignRaster -- Assign a raster to a preexisting, externally defined + * drawable (e.g. widget window or server pixmap). + * + * Usage: assignRaster raster drawable + * + * The drawable may be the name of a widget object elsewhere in the GUI, + * or the numeric server code for an arbitrary server pixmap or window. + * A special case occurs when the named widget object is another gterm + * widget. In this case graphics pipelines can be constructed piping data + * from the rasters and mappings of the first widget to those of the second, + * using a mapping to connect the two. When the destination raster is in + * another gterm widget the widget code will automatically execute any + * mappings defined on the affected raster when it is modified by the + * mapping from the first widget. This allows a raster to be mapped to + * and displayed in multiple destination windows. + */ +static int +gtermAssignRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject gt_obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &gt_obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + XtPointer drawable; + ObmObject obj; + int raster, type; + char *object; + + if (argc < 3) + return (TCL_ERROR); + + raster = atoi (argv[1]); + object = argv[2]; + + /* Get the drawable handle and type. + */ + if (isdigit (*object)) { + /* A server pixmap or window passed by server ID. */ + drawable = (XtPointer) atoi(object); + type = GtWindow; + + } else { + /* A named object. */ + if ((obj = obmFindObject (obm, object)) == NULL) + return (TCL_ERROR); + if (obj->core.classrec->object_type != OtNonShell) + return (TCL_ERROR); /* no window */ + + if (obmClass (obj->core.classrec, WtGterm)) { + /* Gterm widget. + drawable = (XtPointer) widgetGetPointer (obj); + */ + drawable = (XtPointer) XtWindow (widgetGetPointer(obj)); + type = GtWidget; + + } else { + /* Some other type of widget. */ + drawable = (XtPointer) XtWindow (widgetGetPointer(obj)); + type = GtWindow; + } + } + + if (GtAssignRaster (w, raster, drawable, type) == OK) + return (TCL_OK); + else + return (TCL_ERROR); +} + + +/* createRaster -- Create a raster of the given type and size. + * + * Usage: createRaster raster width height [type [depth]] + * + * A raster number RASTER is created with the given size and type. The + * possible raster types are "client", and "server", the default being + * to create a client raster. Rasters created in client memory are the + * most general and are best for most applications. Server side rasters + * are used only in special applications; server rasters can be copied to + * the display window very quickly but server memory is a limited resource + * and a program using large amounts of server memory may not run on some + * servers. Mappings other than one-to-one are *less* efficient on server + * rasters than on client rasters. + * + * Currently only rasters of depth 8 bits are supported. A createRaster on + * an existing raster will destroy the old raster, along with any mappings + * defined on it, and create a new one. + * + * Raster number zero is the gterm widget's display window. If one attempts + * a createRaster on this window the widget will try to resize the window. + * The resize attempt may or may not succeed, depending upon the resize + * restrictions of the geometry or window managers in use, shell resources, + * and so on. + * + * There is a limit on the maximum number of rasters which can be created, + * set by the gterm widget resource maxRasters at widget creation. + */ +static int +gtermCreateRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int raster, width, height, type, depth; + char *s_type; + + if (argc < 4) + return (TCL_ERROR); + + raster = atoi (argv[1]); + width = atoi (argv[2]); + height = atoi (argv[3]); + s_type = (argc > 4) ? argv[4] : "client"; + depth = (argc > 5) ? atoi(argv[5]) : 0; + + if (strcmp (s_type, "server") == 0) + type = GtServer; + else + type = GtClient; + + if (GtCreateRaster (w, raster, type, width, height, depth) == ERR) + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* destroyRaster -- Destroy a raster. + * + * Usage: destroyRaster raster + * + * Raster number RASTER is destroyed along with all of its mappings. This is + * a no-op if the raster is not currently defined. Attempts to destroy raster + * number zero (the widget's window) are ignored. + */ +static int +gtermDestroyRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int raster; + + if (argc < 2) + return (TCL_ERROR); + + raster = atoi (argv[1]); + GtDestroyRaster (w, raster); + + return (TCL_OK); +} + + +/* queryRaster -- Query a raster's attributes. + * + * Usage: exists = queryRaster raster [width height [type [depth]]] + * + * The width and height, and optionally the type and depth, of raster number + * RASTER are returned in the named output variables. The boolean function + * value indicates whether or not the raster is currently defined. If the + * raster does not exist the output variables may be undefined after the call. + */ +static int +gtermQueryRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + char *s_width, *s_height, *s_type, *s_depth; + int exists, raster, width, height, type, depth; + char buf[SZ_NUMBER], *v_type; + + if (argc < 2) + return (TCL_ERROR); + + raster = atoi (argv[1]); + s_width = (argc > 2) ? argv[2] : NULL; + s_height = (argc > 3) ? argv[3] : NULL; + s_type = (argc > 4) ? argv[4] : NULL; + s_depth = (argc > 5) ? argv[5] : NULL; + + if (GtQueryRaster (w, raster, &type, &width, &height, &depth)) { + if (s_width) { + sprintf (buf, "%d", width); + Tcl_SetVar (obm->tcl, s_width, buf, 0); + } + if (s_height) { + sprintf (buf, "%d", height); + Tcl_SetVar (obm->tcl, s_height, buf, 0); + } + if (s_type) { + v_type = (type == GtServer) ? "server" : "client"; + Tcl_SetVar (obm->tcl, s_type, v_type, 0); + } + if (s_depth) { + sprintf (buf, "%d", depth); + Tcl_SetVar (obm->tcl, s_depth, buf, 0); + } + Tcl_SetResult (obm->tcl, TRUESTR, TCL_STATIC); + + } else { + Tcl_SetResult (obm->tcl, FALSESTR, TCL_STATIC); + } + + return (TCL_OK); +} + + +/* nextRaster -- Return the number of the next available, unused raster. + * + * Usage: raster = nextRaster + * + */ +static int +gtermNextRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char buf[SZ_NUMBER]; + int raster; + + if ((raster = GtNextRaster (w)) < 0) + return (TCL_ERROR); + else { + sprintf (buf, "%d", raster); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + } + + return (TCL_OK); +} + + +/* activeRasters -- Return the number of currently defined rasters. + * + * Usage: count = activeRasters + * + */ +static int +gtermActiveRasters (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char buf[SZ_NUMBER]; + + sprintf (buf, "%d", GtNRasters(w)); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* setPixel -- Set the value of a single pixel. + * + * Usage: setPixel raster x y value + * + * raster The raster number. + * + * x, y The pixel to be set. + * + * value The pixel value. + * + * This routine is more efficient than writePixels for setting the value of + * a single pixel, but is a lot less efficient if a block of pixels are to + * be set. + */ +static int +gtermSetPixel (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Widget w = wp->w; + int raster, x, y; + uchar data[1]; + + if (argc < 5) + return (TCL_ERROR); + + raster = atoi (argv[1]); + x = atoi (argv[2]); + y = atoi (argv[3]); + data[0] = atoi (argv[4]); + GtWritePixels (w, raster, data, 8, x, y, 1, 1); + + return (TCL_OK); +} + + +/* getPixel -- Get the value of a single pixel. + * + * Usage: getPixel raster x y + * + * raster The raster number. + * + * x, y The pixel to be set. + * + * This routine is more efficient than readPixels for getting the value of + * a single pixel, but is a lot less efficient if a block of pixels are to + * be read. + */ +static int +gtermGetPixel (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Widget w = wp->w; + char buf[SZ_NUMBER]; + int raster, x, y; + uchar data[1]; + + if (argc < 4) + return (TCL_ERROR); + + raster = atoi (argv[1]); + x = atoi (argv[2]); + y = atoi (argv[3]); + GtReadPixels (w, raster, data, 8, x, y, 1, 1); + + sprintf (buf, "%d", data[0]); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* writePixels -- Set the values of some subset of the pixels in a raster. + * If any mappings are defined on the affected region and are enabled, any + * destination rasters will be automatically updated as defined by the mapping. + * + * Usage: writePixels raster pixels encoding nbits x1 y1 nx ny [bias] + * + * raster The raster number. + * + * pixels The pixel array, encoded as a string. + * + * encoding The pixel encoding. "numeric" means each pixel is + * encoded as a decimal integer delimited by whitespace. + * + * "hex1" means the pixel array is hex encoded, 1 bytes + * per 8 bit pixel, as a printable text string. Hex1 + * encoding can only be used for pixel values in the + * range 0-63. The 64 possible pixel values are encoded + * as follows: '0'-'9', 'A'-'Z', 'a'-'z', '$', '_'. + * (Since there are 26 letters this is 10+26+26+1+1=64). + * + * "hex2" means the pixel array is hex encoded, 2 bytes + * per 8 bit pixel, as a printable text string. The + * two bytes are defined as follows (v = pixel value): + * + * byte1 = ((v >> 4) & 017) in hex [0-9A-F] + * byte2 = ((v ) & 017) in hex [0-9A-F] + * + * Either "hex1" or "hex2" followed by "-rle", e.g., + * "hex2-rle" means that the hex-encoded data is in + * turn run length encoded. In a run length encoded + * string all characters are data characters except + * for "@" and "%", which are repeat operators. "@" is + * followed by a single hex1-encoded character giving + * the repeat count minus one: the hex1-encoded number + * is decoded as N and the most recent pixel value is + * repeated N+1 times. "%" is similar, but is followed + * by a 2 character hex2-encoded repeat count. + * + * Whitespace in a hex encoded string is ignored. + * Hex2 encoding reduces the data volume by about a factor + * of two (compared to numeric) and is only a factor of + * two less space efficient than binary. Hex1 encoding + * is as space efficient as binary but pixel values larger + * than 63 (64 possible values) cannot be represented. + * + * nbits Number of bits per pixel - currently only 8 bit pixels + * are supported. + * + * x1,y1,nx,ny Region of the raster to be written to. + * + * bias If a bias value is given this value is added to the + * value of each input pixel. + * + * Most real-world image processing applications get the Gterm widget handle + * with setGterm and pass binary data to the widget by calling GtWritePixels + * directly. This is the most efficient approach for serious image processing + * where large amounts of data are involved. However, being able to read and + * write raster pixels directly in a GUI can be useful in specialized + * applications, e.g., where the image is computed or modified by the GUI. + */ +static int +gtermWritePixels (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Widget w = wp->w; + + register char *ip; + register uchar *op; + register int v, i, j; + static uchar hex1[256], hex2[256]; + static int have_tables = 0; + int raster, nbits, bias; + char *pixels, *encoding; + int x1, y1, nx, ny; + uchar *data, *otop; + + if (argc < 9) + return (TCL_ERROR); + + raster = atoi (argv[1]); + pixels = argv[2]; + encoding = argv[3]; + nbits = atoi (argv[4]); + x1 = atoi (argv[5]); + y1 = atoi (argv[6]); + nx = atoi (argv[7]); + ny = atoi (argv[8]); + bias = (argc > 9) ? atoi(argv[9]) : 0; + + if (nbits != 8) + return (TCL_ERROR); + + /* Generate hex to binary lookup tables in first call. */ + if (!have_tables) { + /* Generate char-to-binary table for the hex1 encoding. */ + for (i=0; i < 256; i++) + hex1[i] = 0177; + for (i='0'; i <= '9'; i++) + hex1[i] = i - '0'; + for (i='A'; i <= 'Z'; i++) + hex1[i] = i - 'A' + 10; + for (i='a'; i <= 'z'; i++) + hex1[i] = i - 'a' + 36; + hex1['$'] = 62; + hex1['_'] = 63; + + /* Generate char-to-binary table for the hex2 encoding. */ + for (i=0; i < 256; i++) + hex2[i] = 0177; + for (i='0'; i <= '9'; i++) + hex2[i] = i - '0'; + for (i='a'; i <= 'f'; i++) + hex2[i] = i - 'a' + 10; + for (i='A'; i <= 'F'; i++) + hex2[i] = i - 'A' + 10; + + have_tables++; + } + + /* Decode the pixel data. */ + if (!(data = (uchar *) XtMalloc (nx * ny))) + return (TCL_ERROR); + otop = data + nx * ny; + + /* Uncompress the input if RLE compression is indicated. */ + if (strcmp (&encoding[strlen(encoding)-4], "-rle") == 0) { + int buflen = nx * ny * 2; + char *ibuf, *op; + int ch; + + /* Get buffer to hold the uncompressed pixel data array. */ + if (!(ibuf = (char *) XtMalloc (buflen + 1))) + goto err; + + /* Uncompress the pixel array. */ + for (ip=pixels, op=ibuf; *ip; ) { + while (isspace (*ip)) + ip++; + + if ((ch = *ip++) == '@') { + if ((i = hex1[*ip++]) >= 0x7f) + while (*ip && ((i = hex1[*ip++]) >= 0x7f)) + ; + if (op-ibuf + i + 1 > buflen) + goto err; + for (v = *(op-1), i++; --i >= 0; ) + *op++ = v; + + } else if (ch == '%') { + if ((i = hex2[*ip++]) >= 0x7f) + while (*ip && ((i = hex2[*ip++]) >= 0x7f)) + ; + if ((j = hex2[*ip++]) >= 0x7f) + while (*ip && ((j = hex2[*ip++]) >= 0x7f)) + ; + i = ((i << 4) | j) + 1; + if (op-ibuf + i > buflen) + goto err; + for (v = *(op-1); --i >= 0; ) + *op++ = v; + + } else + *op++ = ch; + } + + *op = '\0'; + pixels = ibuf; + } + + /* Convert the ascii pixels array to a binary data array. + */ + if (strcmp (encoding, "numeric") == 0) { + for (ip=pixels; isspace(*ip) || *ip == '{'; ip++) + ; + for (op=data; *ip && op < otop; ) { + for (v=0; isdigit(*ip); ) + v = v * 10 + *ip++ - '0'; + *op++ = v + bias; + while (isspace(*ip) || *ip == '}') + ip++; + } + } else if (strncmp (encoding, "hex1", 4) == 0) { + for (ip=pixels, op=data; *ip && op < otop; ) { + if ((v = hex1[*ip++]) > 0xf) + while (*ip && ((v = hex1[*ip++]) > 0xf)) + ; + *op++ = v + bias; + } + } else if (strncmp (encoding, "hex2", 4) == 0) { + for (ip=pixels, op=data; *ip && op < otop; ) { + if ((v = hex2[*ip++]) > 0xf) + while (*ip && ((v = hex2[*ip++]) > 0xf)) + ; + if ((i = hex2[*ip++]) > 0xf) + while (*ip && ((i = hex2[*ip++]) > 0xf)) + ; + *op++ = ((v << 4) | i) + bias; + } + } else { +err: XtFree ((char *)data); + if (pixels != argv[2]) + XtFree (pixels); + return (TCL_ERROR); + } + + /* Write the pixels. */ + GtWritePixels (w, raster, data, nbits, x1, y1, nx, ny); + XtFree ((char *)data); + if (pixels != argv[2]) + XtFree (pixels); + + return (TCL_OK); +} + + +/* readPixels -- Get the values of some subset of the pixels in a raster. + * + * Usage: pixels = readPixels raster encoding nbits x1 y1 nx ny [bias] + * + * raster The raster number. + * + * encoding The pixel encoding. "numeric" means each pixel is + * encoded as a decimal integer delimited by whitespace. + * "hex1", hex2", and "hex1-rle or "hex2-rle" are + * possible encodings. See writePixels for details. + * + * nbits Number of bits per pixel - currently only 8 bit pixels + * are supported. + * + * x1,y1,nx,ny Region of the raster to be read. + * + * bias The bias value is subtracted from the pixel value + * returned by readPixels. + * + * The pixel array, encoded as a string, is returned as the function value. + * Use readPixels to read a block of pixels, and getPixel to get the value + * of a single pixel. + */ +static int +gtermReadPixels (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Widget w = wp->w; + + register int v, i; + register uchar *ip, *op; + int bias, nchars, npix, n, j; + char *pixels, *encoding; + int x1, y1, nx, ny; + int raster, nbits; + uchar *data; + char *buf; + + if (argc < 8) + return (TCL_ERROR); + + raster = atoi (argv[1]); + encoding = argv[2]; + nbits = atoi (argv[3]); + x1 = atoi (argv[4]); + y1 = atoi (argv[5]); + nx = atoi (argv[6]); + ny = atoi (argv[7]); + bias = (argc > 8) ? atoi(argv[8]) : 0; + npix = nx * ny; + + if (nbits != 8) + return (TCL_ERROR); + + /* Get the pixel data. */ + if (!(data = (uchar *) XtMalloc (npix * sizeof(uchar)))) + return (TCL_ERROR); + if (GtReadPixels (w, raster, data, nbits, x1, y1, nx, ny) == ERR) { + XtFree ((char *)data); + return (TCL_ERROR); + } + + /* Get a text buffer large enough to hold the encoded data. */ + nchars = npix * 4 + (npix/16) * 3 + 5; + if (!(buf = (char *) XtMalloc (nchars))) { + XtFree ((char *)data); + return (TCL_ERROR); + } + + /* Encode the pixel data as a printable text string using the + * encoding specified by the caller. + */ + if (strcmp (encoding, "numeric") == 0) { + /* Encode the data as {ddd ddd ddd ... ddd}. */ + op = (uchar *)buf; + *op++ = '{'; + *op++ = ' '; + + for (ip=data, n=npix, j=0; --n >= 0; ) { + v = *ip++ - bias; + + i = (v / 100); + if (i) { + *op++ = i + '0'; + v -= i * 100; + } else + *op++ = ' '; + + i = (v / 10); + if (i) { + *op++ = i + '0'; + v -= i * 10; + } else + *op++ = ' '; + + *op++ = v + '0'; + *op++ = ' '; + + if (++j >= 16) { + *op++ = '\n'; + *op++ = ' '; + *op++ = ' '; + j = 0; + } + } + + if (j) + *op++ = '\n'; + *op++ = '}'; + *op++ = '\0'; + + } else if (strncmp (encoding, "hex", 3) == 0) { + static uchar hex1[256], hex2[256*2]; + static int have_tables = 0; + uchar *obuf, *cbuf; + + if (!have_tables) { + /* Generate binary to hex1 (64 element) lookup table. */ + for (n=0, op=hex1; n < 256; n++) { + i = (n % 64); + if (i < 10) + *op++ = i + '0'; + else if (i < 36) + *op++ = (i - 10) + 'A'; + else if (i < 62) + *op++ = (i - 36) + 'a'; + else if (i == 62) + *op++ = '$'; + else + *op++ = '_'; + } + + /* Generate binary to hex2 (256 element) lookup table. */ + for (n=0, op=hex2; n < 256; n++) { + i = ((n >> 4) & 017); + *op++ = (i < 10) ? i + '0' : (i-10) + 'A'; + i = (n & 017); + *op++ = (i < 10) ? i + '0' : (i-10) + 'A'; + } + + have_tables++; + } + + if ((obuf = (uchar *) XtMalloc (npix*2)) == NULL) + return (TCL_ERROR); + + if (strncmp (encoding, "hex1", 4) == 0) { + /* Hex1 encoding uses only one character per pixel but the + * pixel range is restricted to 0 to 63. + */ + for (j=0, ip=data, op=obuf; j < ny; j++) { + for (i=0; i < nx; i++) + *op++ = hex1[*ip++ - bias]; + } + *op = '\0'; + + } else if (strncmp (encoding, "hex2", 4) == 0) { + /* Hex2 encoding uses 2 characters per pixel and supports + * pixel values in the range 0 to 255. + */ + for (j=0, ip=data, op=obuf; j < ny; j++) { + for (i=0; i < nx; i++) { + v = (*ip++ - bias) * 2; + *op++ = hex2[v]; + *op++ = hex2[v+1]; + } + if (nx % 2) + ip++; + } + *op = '\0'; + } + + /* Run length compress the data. The compressed data stream + * contains a mixture of literal data codes and repeat codes. + * A "@" followed by a hex1-encoded number N causes the most + * recent pixel value to be repeated N+1 times, where N < 64. + * A "%" followed by a hex2-encoded number N causes the most + * recent pixel value to be repeated N+1 times, where N < 256. + */ + if (strcmp (&encoding[strlen(encoding)-4], "-rle") == 0) { + if ((cbuf = (unsigned char *) XtMalloc (npix*3)) == NULL) + return (TCL_ERROR); + + ip = obuf; + op = cbuf; + *op++ = v = *ip++; + while (*ip) { + for (n=0; n < 256 && *ip == v; ip++, n++) + ; + if (n == 0) { + *op++ = v = *ip++; + } else if (n < 3) { + while (--n >= 0) + *op++ = v; + } else if (n <= 64) { + *op++ = '@'; + *op++ = hex1[n-1]; + } else if (n <= 256) { + *op++ = '%'; + *op++ = hex2[(n-1)*2]; + *op++ = hex2[(n-1)*2+1]; + } + } + *op = '\0'; + + XtFree ((char *)obuf); + obuf = cbuf; + } + + /* Output the encoded pixel data. + */ + op = (uchar *)buf; + *op++ = '{'; + *op++ = ' '; + + for (ip=obuf, n=1; *ip; ip++, n++) { + *op++ = *ip; + if (n && n > 72) { + *op++ = '\n'; + *op++ = ' '; + *op++ = ' '; + n = 0; + } + } + + if (n) + *op++ = '\n'; + *op++ = '}'; + *op++ = '\0'; + XtFree ((char *)obuf); + + } else { + XtFree ((char *)data); + return (TCL_ERROR); + } + + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + XtFree ((char *)data); + XtFree ((char *)buf); + + return (TCL_OK); +} + + +/* refreshPixels -- Refresh any mappings the source rect of which intersects + * the given region of the specified raster. + * + * Usage: refreshPixels raster ctype x1 y1 nx ny + * + * Any mappings defined on the region [x1,y1,nx,ny] of the given raster are + * updated, redisplaying the indicated region. refreshPixels is like + * writePixels except that the affected pixels are redisplayed without + * actually having been modified. Raster coordinates may be given in either + * raster pixel coordinates (ctype=Pixel) or NDC coordinates (ctype=NDC) + * in the range 0-1 floating. The origin in the upper left for raster + * coordinates and in the lower left for NDC coordinates. Raster coordinates + * are zero indexed. + */ +static int +gtermRefreshPixels (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + float x1, y1, nx, ny; + int raster, ctype; + + if (argc < 7) + return (TCL_ERROR); + + raster = atoi (argv[1]); + ctype = coordType (argv[2]); + x1 = atof (argv[3]); + y1 = atof (argv[4]); + nx = atof (argv[5]); + ny = atof (argv[6]); + + GtRefreshPixels (w, raster, ctype, x1, y1, nx, ny); + + return (TCL_OK); +} + + +/* setPixels -- Set a region of a raster to a single color. + * + * Usage: setPixels raster [color [ctype x1 y1 nx ny [rop]]] + * + * The region [x1,y1,nx,ny] of raster RASTER, specified in the coordinate + * system CTYPE (Pixel or NDC) is set to the color number COLOR. If no + * region is specified the entire raster is assumed. The color number is + * specified in the color system defined by the client, which may or may not + * be the same as the internal gterm widget color system (the client and + * widget color systems are the same only if no iomap has been specified, + * or, equivalently, if the iomap is one-to-one). If no color is given the + * background color is assumed. Any mappings mapped to the affected pixels + * will be updated to propagate and possibly display the changes. + * + * Although this routine permits an optional rasterop argument (ROP) there + * is currently no support for symbolically defining the bitfields used to + * form this word. Most applications do not need to specify a rasterop. + */ +static int +gtermSetPixels (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int color, rop, raster, ctype; + float x1, y1, nx, ny; + + if (argc < 2) + return (TCL_ERROR); + + raster = atoi (argv[1]); + color = (argc > 2) ? atoi(argv[2]) : GtGetClientPixel(w,0); + + if (argc >= 8) { + ctype = coordType (argv[3]); + x1 = atof (argv[4]); + y1 = atof (argv[5]); + nx = atof (argv[6]); + ny = atof (argv[7]); + } else { + ctype = GtNDC; + x1 = 0; + y1 = 0; + nx = 1.0; + ny = 1.0; + } + + rop = (argc > 8) ? atoi(argv[8]) : 0; + + if (ctype == GtNDC) { + x1 *= MAXNDC; y1 *= MAXNDC; + nx *= MAXNDC; ny *= MAXNDC; + } + + if (GtSetPixels (w, raster, ctype, (int)x1, (int)y1, (int)nx, (int)ny, + color, rop) == ERR) + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* extractPixmap -- Extract a region of a raster into a pixmap. + * + * Usage: extractPixmap pixmap raster [ctype x1 y1 nx ny] + * + * The given region of raster RASTER is extracted and placed into a pixmap + * object with name PIXMAP. The pixmap object is created if it does not + * already exist. The size of the pixmap object will be the size of the + * extracted region. If no region is given the entire raster is assumed. + */ +static int +gtermExtractPixmap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + float x1, y1, nx, ny; + int raster, ctype; + Pixmap pixmap; + char *s_pixmap; + + if (argc < 3) + return (TCL_ERROR); + + s_pixmap = argv[1]; + raster = atoi (argv[2]); + + if (argc >= 8) { + ctype = coordType (argv[3]); + x1 = atof (argv[4]); + y1 = atof (argv[5]); + nx = atof (argv[6]); + ny = atof (argv[7]); + } else { + ctype = GtNDC; + x1 = 0; + y1 = 0; + nx = 1.0; + ny = 1.0; + } + + if (pixmap = GtExtractPixmap (w, raster, ctype, x1, y1, nx, ny)) + createPixmap (obm, s_pixmap, nx, ny, 8, pixmap, NULL, 0, 0); + else + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* insertPixmap -- Insert a pixmap into a region of a raster. + * + * Usage: insertPixmap pixmap raster [ctype x1 y1 nx ny] + * + * The given pixmap PIXMAP is inserted to raster RASTER at the given + * location. If no region is given the entire raster is assumed. + */ +static int +gtermInsertPixmap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + float x1, y1, nx, ny; + int raster, ctype; + Pixmap pixmap; + char *s_pixmap; + + if (argc < 3) + return (TCL_ERROR); + + s_pixmap = argv[1]; + raster = atoi (argv[2]); + + if (argc >= 8) { + ctype = coordType (argv[3]); + x1 = atof (argv[4]); + y1 = atof (argv[5]); + nx = atof (argv[6]); + ny = atof (argv[7]); + } else { + ctype = GtNDC; + x1 = 0; + y1 = 0; + nx = 1.0; + ny = 1.0; + } + + if (pixmap = findPixmap (obm, s_pixmap)) { + if (GtInsertPixmap (w, pixmap, raster, ctype,x1,y1,nx,ny) == ERR) + return (TCL_ERROR); + } else + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* nextColormap -- Get the index of the next unused colormap. + * + * Usage: colormap = nextColormap + * + * Colormaps are dynamically allocated so there is no builtin limit on the + * number of colormaps. + */ +static int +gtermNextColormap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char buf[SZ_NUMBER]; + + sprintf (buf, "%d", GtNextColormap (w)); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* freeColormap -- Free a colormap. + * + * Usage: freeColormap colormap + * + * The given colormap and all of its resources are freed. This is a no-op if + * the given colormap is not defined. + */ +static int +gtermFreeColormap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int colormap; + + if (argc < 2) + return (TCL_ERROR); + + colormap = atoi (argv[1]); + GtFreeColormap (w, colormap); + + return (TCL_OK); +} + + +/* writeColormap -- Write to a colormap. + * + * Usage: writeColormap colormap colors [offset] + * + * The given list of colors are loaded into the given colormap. If no + * offset is specified the offset will default to the offset of the first + * dynamically allocatable color cell (e.g. 10). Colormap zero is the + * window colormap and writing to this colormap will immediately affect + * the display. The nonzero colormaps are merely stored within the gterm + * widget and will not take effect until loaded with loadColormap. + * + * Colors are specified as a list of RGB color triplets in the range 0-255. + * For example, { {R G B} {R G B} ...}. + * + * The gterm widget supports both private colormaps and the default colormap. + * Which is used is controlled by the cmapName resource; writeColormap works + * the same way for both types of colormaps. + */ +static int +gtermWriteColormap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + ObmContext obm = obj->widget.obm; + GtermPrivate gp = &obj->gterm; + Widget w = obj->widget.w; + + register int ncolors; + register char *ip; + char *colors, *ip_save; + ushort r[MAX_COLORS]; + ushort g[MAX_COLORS]; + ushort b[MAX_COLORS]; + int offset, colormap; + char *ipp; + + if (argc < 3) + return (TCL_ERROR); + + colormap = atoi (argv[1]); + colors = argv[2]; + offset = (argc > 3) ? atoi(argv[3]) : FIRST_COLOR; + + for (ncolors=0, ip=colors; *ip && ncolors < MAX_COLORS; ) { + while (isspace(*ip) || *ip == '{') + ip++; + + ip_save = ip; + r[ncolors] = (strtol (ip, &ipp, 10)) << 8; ip = ipp; + g[ncolors] = (strtol (ip, &ipp, 10)) << 8; ip = ipp; + b[ncolors] = (strtol (ip, &ipp, 10)) << 8; ip = ipp; + if (ip == ip_save) + return (TCL_ERROR); + + while (isspace(*ip) || *ip == '}') + ip++; + + ncolors++; + } + + if (GtWriteColormap (w, colormap, offset, ncolors, r, g, b) == ERR) + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* readColormap -- Read from a colormap. + * + * Usage: ncolors = readColormap colormap colors [offset [ncolors]] + * + * The given region of the colormap is read and return in the output variable + * COLORS. The actual number of color values read is returned as the function + * value. If no offset is specified the offset will default to the offset of + * the first dynamically allocatable color cell (e.g. 10). If the number of + * colors to be read (NCOLORS) is not specified readColormap will return a + * list of all the allocated colors starting at the specified colortable + * offset. + * + * Colors are returned as a list of RGB color triplets in the range 0-255. + * For example, { {R G B} {R G B} ...}. + */ +static int +gtermReadColormap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + ObmContext obm = obj->widget.obm; + GtermPrivate gp = &obj->gterm; + Widget w = obj->widget.w; + + register int i; + register char *op; + char colors[MAX_COLORS * 3 * 20]; + ushort r[MAX_COLORS]; + ushort g[MAX_COLORS]; + ushort b[MAX_COLORS]; + int offset, colormap; + int ncolors, request; + char buf[SZ_NUMBER]; + char *s_colors; + + if (argc < 3) + return (TCL_ERROR); + + colormap = atoi (argv[1]); + s_colors = argv[2]; + offset = (argc > 3) ? atoi(argv[3]) : FIRST_COLOR; + request = (argc > 4) ? atoi(argv[4]) : MAX_COLORS; + + ncolors = GtReadColormap (w, colormap, offset, request, r, g, b); + + op = colors; + *op++ = '{'; + *op++ = ' '; + for (i=0; i < ncolors; i++) { + sprintf (op, "{%d %d %d} ", (r[i] >> 8), (g[i] >> 8), (b[i] >> 8)); + while (*op) + op++; + } + *op++ = '}'; + *op++ = '\0'; + Tcl_SetVar (obm->tcl, s_colors, colors, 0); + + sprintf (buf, "%d", ncolors); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* loadColormap -- Load a colormap. + * + * Usage: loadColormap colormap [offset [scale]] + * + * The offset and scale parameters may be used to adjust the brightness and + * contrast of the image when the colormap is loaded. The normalized colormap + * has offset=0.5, scale=1.0. Colormap zero is the hardware colormap. + */ +static int +gtermLoadColormap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + ObmContext obm = obj->widget.obm; + GtermPrivate gp = &obj->gterm; + Widget w = obj->widget.w; + float offset, scale; + int colormap; + + if (argc < 2) + return (TCL_ERROR); + + colormap = atoi (argv[1]); + offset = (argc > 2) ? atof(argv[2]) : gp->offset; + scale = (argc > 3) ? atof(argv[3]) : gp->scale; + + GtLoadColormap (w, colormap, offset, scale); + + gp->colormap = colormap; + gp->offset = offset; + gp->scale = scale; + + return (TCL_OK); +} + + +/* clientPixel -- Convert a gterm pixel to a client pixel. + * + * Usage: pixel = clientPixel gterm_pixel + * + * If the client has an iomap installed, gterm i/o operations which deal + * with pixel values will map to and from client (external) pixels and the + * internal gterm widget color model. The clientPixel routine can be used to + * convert a pixel (i.e. color) in the gterm color model to the corresponding + * client pixel in the client's color model. For example "clientPixel 0" + * will return the client pixel corresponding to the gterm widget background + * color. + */ +static int +gtermClientPixel (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int pixel, client_pixel; + char buf[SZ_NUMBER]; + + if (argc < 2) + return (TCL_ERROR); + + pixel = atoi (argv[1]); + client_pixel = GtGetClientPixel (w, pixel); + + sprintf (buf, "%d", client_pixel); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* getBias -- Get the colormap bias value. + * + * Usage: bias = getBias [nelem [maxelem]] + * + * The colormap bias value is the pixel value corresponding to the first + * dynamically allocatable colormap cell. That is, the gterm widget + * defines N preallocated static colors 0 to N-1, followed by an arbitrary + * number of dynamically allocatable colors. The bias value is the pixel + * value of the first dynamically allocatable color. + * + * If the optional arguments nelem and maxelem are given then the number + * of currently allocated colors and the maximum number of allocatable colors + * are returned. The latter values do not include the N=bias static colors, + * i.e. nelem=0 if no dynamic colors have been allocated. + */ +static int +gtermGetBias (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int first, nelem, maxelem; + char buf[SZ_NUMBER]; + + GtQueryColormap (w, 0, &first, &nelem, &maxelem); + + if (argc > 1) { + sprintf (buf, "%d", nelem); + Tcl_SetVar (obm->tcl, argv[1], buf, 0); + } + if (argc > 2) { + sprintf (buf, "%d", maxelem); + Tcl_SetVar (obm->tcl, argv[2], buf, 0); + } + + sprintf (buf, "%d", first); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* initMappings -- Initialize the mapping subsystem, deleting any existing + * mappings. + * + * Usage: initMappings + */ +static int +gtermInitMappings (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + + GtInitMappings (w); + return (TCL_OK); +} + + +/* nextMapping -- Return the index of the next unused mapping. + * + * Usage: mapping = nextMapping + * + * Returns the mapping number as the function value. + */ +static int +gtermNextMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Widget w = wp->w; + char buf[SZ_NUMBER]; + int mapping; + + mapping = GtNextMapping (w); + sprintf (buf, "%d", mapping); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* freeMapping -- Free or delete a mapping. + * + * Usage: freeMapping mapping + * + * The given mapping descriptor is freed and any resources used by the mapping + * are freed. + */ +static int +gtermFreeMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, erase; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + GtDisableMapping (w, mapping, erase=1); + GtFreeMapping (w, mapping); + + return (TCL_OK); +} + + +/* lowerMapping -- Lower a mapping, i.e., change its stacking order so that + * it is drawn below other mappings. + * + * Usage: lowerMapping mapping [reference] + * + * If a reference mapping is named the stacking order of the target mapping + * will be modified to make it appear just beneath the reference mapping. + * If no reference mapping is given the mapping will be moved to the bottom + * of the mapping stacking order, making it be drawn below all other mappings. + */ +static int +gtermLowerMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, reference; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + reference = (argc > 2) ? atoi(argv[2]) : 0; + GtLowerMapping (w, mapping, reference); + + return (TCL_OK); +} + + +/* raiseMapping -- Raise a mapping, i.e., change its stacking order so that + * it is drawn above other mappings. + * + * Usage: raiseMapping mapping [reference] + * + * If a reference mapping is named the stacking order of the target mapping + * will be modified to make it appear just above the reference mapping. + * If no reference mapping is given the mapping will be moved to the top + * of the mapping stacking order, making it be drawn above all other mappings. + */ +static int +gtermRaiseMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, reference; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + reference = (argc > 2) ? atoi(argv[2]) : 0; + GtRaiseMapping (w, mapping, reference); + + return (TCL_OK); +} + + +/* enableMapping -- Reenable a mapping. + * + * Usage: enableMapping mapping [refresh] + * + * The given mapping is enabled and optionally refreshed. This is a no-op + * if the mapping is already enabled. + */ +static int +gtermEnableMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, refresh; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + refresh = (argc > 2) ? (strcmp(argv[2],"refresh") == 0) : False; + + if (GtEnableMapping (w, mapping, refresh) == ERR) + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* disableMapping -- Disable a mapping. + * + * Usage: disableMapping mapping [erase] + * + * The given mapping is disabled and optionally erased. This is a no-op + * if the mapping is not enabled. + */ +static int +gtermDisableMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, erase; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + erase = (argc > 2) ? (strcmp(argv[2],"erase") == 0) : False; + + if (GtDisableMapping (w, mapping, erase) == ERR) + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* activeMapping -- Test whether a given mapping is active (enabled). + * + * Usage: active = activeMapping mapping + * + * Returns True if the mapping is defined and enabled, False otherwise. + */ +static int +gtermActiveMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + char buf[SZ_NUMBER]; + int mapping, active; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + active = GtActiveMapping (w, mapping); + + Tcl_SetResult (obm->tcl, active ? TRUESTR : FALSESTR, TCL_STATIC); + return (TCL_OK); +} + + +/* refreshMapping -- Refresh a mapping. + * + * Usage: refreshMapping mapping + * + * The given mapping is unconditionally refreshed, i.e., the destination + * rect is repainted. + */ +static int +gtermRefreshMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + GtRefreshMapping (w, mapping); + + return (TCL_OK); +} + + +/* copyRaster -- Copy a region from one raster to another. + * + * Usage: copyRaster rop + * src st sx sy snx sny + * dst dt dx dy dnx dny + * + * The specified region of the source raster is scaled as necessary and + * written to the specified region of the destination raster. This is + * equivalent to defining a mapping between the source and destination, + * refreshing the mapping, and then freeing the mapping. Refer to setMapping + * for a description of the arguments. + * + * Copyraster may be used to manually display rasters (without setting up a + * mapping) by copying rasters to raster zero, the display window. If the + * source raster is a server raster and the mapping is one-to-one this can + * be done very quickly. For the fastest possible results the transient + * flag should be set in the rasterop (ROP) to prevent saving of the displayed + * data in an off-screen pixmap (this may prevent the window from being + * refreshed properly in response to window system expose events). + */ +static int +gtermCopyRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int rop, src, st, dst, dt, status; + int sx, sy, snx, sny, dx, dy, dnx, dny; + + if (argc != 14) + return (TCL_ERROR); + + rop = atoi (argv[1]); + get_mapping (&argv[2], + &src, &st, &sx, &sy, &snx, &sny, + &dst, &dt, &dx, &dy, &dnx, &dny); + + status = GtCopyRaster (w, rop, + src, st, sx, sy, snx, sny, + dst, dt, dx, dy, dnx, dny); + + return (status == ERR ? TCL_ERROR : TCL_OK); +} + + +/* setMapping -- Set or modify a mapping. + * + * Usage: setMapping mapping rop + * src st sx sy snx sny + * dst dt dx dy dnx dny + * + * setMapping defines a new mapping function, or modifies an old one. If a new + * mapping is defined it is merely enabled, and no refreshing of the screen + * takes place until either some mapped source data is modified or the mapping + * is explicitly refreshed. If an existing mapping is modified the old and new + * mappings are examined and only those portions of the destination rect for + * which the mapping changed are updated. This permits minor changes to a + * mapping (e.g. moving an edge) without having to redraw the entire region. + * Regions of the destination drawable which were previously covered by the + * mapping but which were exposed by modifying the mapping are redrawn, in + * effect erasing the mapping. + * + * SetMapping optimizes the mapping operation where possible. In particular, + * if the mapping is one-to-one and both the source and destination rasters + * are server rasters, a very fast memory copy in the server is used. Other + * cases, for example a dezoom involving antialising, can be expensive. + * + * The mapping number is arbitrary. Mapping numbers may be preallocated by + * some client defined logic, or dynamically allocated with nextMapping. + * Most applications will want to set the rasterop (ROP) argument to zero, + * which causes the mapping to copy the source to the destination. For further + * information on the significance of the bits in the rasterop refer to the + * gterm widget documentation. + * + * The source and destination rects are specifed with six fields each: the + * raster number, coordinate type, X,Y coordinates of the rect, and the + * X,Y size of the rect in pixels. The coordinate type may be either "Pixel" + * (raster pixel coordinates) or NDC. NDC coordinates are normalized device + * coordinates in the range 0.0 to 1.0 in either axis. The origin is in the + * upper left corner for Pixel coordinates, and in the lower left corner for + * NDC coordinates. + * + * The source and destination rects need not be the same size. The source + * will be scaled as necessary to fill the destination. Scaling options, + * e.g. the antialiasing technique used for a dezoom, are controlled by the + * rasterop. If the DNX or DNY field is negative the mapping will flip the + * image about the corresponding axis. + * + * The source and destination rects can be any two rasters, or even the + * same raster. A special case is raster zero, the display window. Mapping + * a source raster to dst=0 is equivalent to displaying the raster. By + * default data mapped to raster zero will also be saved in an off-screen + * pixmap in the server and used to autmatically refresh the window in + * response to window system expose events. This feature may be disabled + * by setting the transient flag in the rasterop. + * + * A raster can have multiple source or destination mappings defined on it. + * A region of a raster may be the source for more than one mapping in which + * case all mappings are updated when the source region is modified. Multiple + * sources may be mapped to (different regions) of a destination raster to + * implement special effects such as split screen or picture insets. Mappings + * may be chained to set up graphics pipelines, where the destination of one + * mapping is the source of the next. Care must be taken to avoid feedback or + * infinite loops can result. + */ +static int +gtermSetMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, rop, src, st, dst, dt, status; + int sx, sy, snx, sny, dx, dy, dnx, dny; + + if (argc != 15) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + rop = atoi (argv[2]); + get_mapping (&argv[3], + &src, &st, &sx, &sy, &snx, &sny, + &dst, &dt, &dx, &dy, &dnx, &dny); + + status = GtSetMapping (w, mapping, rop, + src, st, sx, sy, snx, sny, + dst, dt, dx, dy, dnx, dny); + + return (status == ERR ? TCL_ERROR : TCL_OK); +} + + +/* getMapping -- Get a mapping. + * + * Usage: getMapping mapping rop + * src st sx sy snx sny + * dst dt dx dy dnx dny + * + * The given mapping is returned in the output variables. All arguments + * except MAPPING are output variables. It is an error if the mapping is + * not defined, but the mapping need not be enabled. + */ +static int +gtermGetMapping (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, rop, src, st, dst, dt, status; + int sx, sy, snx, sny, dx, dy, dnx, dny; + char buf[SZ_NUMBER]; + + if (argc != 15) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + status = GtGetMapping (w, mapping, &rop, + &src, &st, &sx, &sy, &snx, &sny, + &dst, &dt, &dx, &dy, &dnx, &dny); + if (status == ERR) + return (TCL_ERROR); + + sprintf (buf, "%d", rop); + Tcl_SetVar (obm->tcl, argv[2], buf, 0); + put_mapping (obm->tcl, &argv[3], + src, st, sx, sy, snx, sny, + dst, dt, dx, dy, dnx, dny); + + return (TCL_OK); +} + + +/* SelectRaster -- Given the raw screen coordinates SX,SY (or coords in + * any destination raster), determine the mapping and source raster which are + * mapped to that pixel and return the raster and mapping numbers and the + * coordinates of the same pixel in the source raster. + * + * Usage: raster = selectRaster dras dt dx dy rt rx ry [map] + * + * where dras display raster + * dt,rt coordinate type - "pixel" or "ndc" + * dx,dy display raster coordinates (input) + * rx,ry source raster coordinates (output) + * map mapping selected (output) + * + * Note that the coordinates returned by selectRaster are measured (taking + * a line as an example) from zero at the left edge of the first pixel, to + * "width" at the right edge of the last pixel. This means that the floating + * point coordinates of the center of raster pixel N will be N + 0.5. For + * example, if we input screen coordinates (dras=0), x=117, and no mapping + * is in effect, the floating point raster coordinates returned will be 117.5. + * The difference occurs because the input coordinate is a pixel number + * (integer) while the output coordinate is a floating point coordinate + * measuring the continuously variable location a pixel. int(x) will convert + * this coordinate to a raster pixel number. + */ +static int +gtermSelectRaster (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + int raster, dras, dt, dx, dy, rt, rx, ry, mp; + char *xout, *yout, *mpout; + float fx, fy; + char buf[64]; + + if (argc < 8) + return (TCL_ERROR); + + /* Get arguments. */ + dras = atoi (argv[1]); + if ((dt = coordType (argv[2])) < 0) + dt = GtPixel; + dx = (int) atof (argv[3]); + dy = (int) atof (argv[4]); + if (dt == GtNDC) { + dx *= MAXNDC; + dy *= MAXNDC; + } + if ((rt = coordType (argv[5])) < 0) + rt = GtPixel; + xout = argv[6]; + yout = argv[7]; + mpout = (argc > 8) ? argv[8] : NULL; + + raster = GtSelectRaster (wp->w, dras, dt, dx, dy, GtNDC, &rx, &ry, &mp); + + if (rt == GtNDC) { + /* Return coords scaled 0.0 - 1.0. */ + fx = (float)rx / MAXNDC; + fy = (float)ry / MAXNDC; + } else { + /* Return raster pixel coordinates. */ + ndcToPixel (wp->w, raster, rx, ry, &fx, &fy); + } + + sprintf (buf, "%g", fx); + Tcl_SetVar (obm->tcl, xout, buf, 0); + sprintf (buf, "%g", fy); + Tcl_SetVar (obm->tcl, yout, buf, 0); + if (mpout) { + sprintf (buf, "%d", mp); + Tcl_SetVar (obm->tcl, mpout, buf, 0); + } + + sprintf (buf, "%d", raster); + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + return (TCL_OK); +} + + +/* UnmapPixel -- unmapPixel is a simplified, less general version of + * selectRaster which will automatically follow graphics pipelines back to + * the original mapped raster. If desired the raster pixel value can be + * returned as well as the raster number and raster pixel coordinates + * corresponding to a screen (raster 0) pixel. + * + * Usage: unmapPixel sx sy raster rx ry [rz] + * + * where sx,sy "screen" (raster 0) coordinates + * raster original mapped raster (output) + * rx,ry source raster coordinates (output) + * rz source raster pixel value (output) + * + * By following graphics pipelines back to the original source raster we mean + * the following. If raster A is mapped to raster B which is mapped to C (the + * screen), given a screen coordinate in the mapped region unmapPixel will + * return the raster number and coordinates for raster A. + */ +static int +gtermUnmapPixel (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + int dst, dx, dy, src, sx, sy, mapping; + char *raster_out, *x_out, *y_out, *z_out; + char buf[SZ_NUMBER]; + float fx, fy; + + if (argc < 6) + return (TCL_ERROR); + + /* Get arguments. */ + dx = (int) atof (argv[1]); + dy = (int) atof (argv[2]); + raster_out = argv[3]; + x_out = argv[4]; + y_out = argv[5]; + z_out = (argc > 6) ? argv[6] : NULL; + + /* Follow the pipeline back to the original mapped raster. */ + fx = dx; fy = dy; + src = 0; + + do { + src = GtSelectRaster (wp->w, dst=src, + GtPixel, dx, dy, GtNDC, &sx, &sy, &mapping); + if (src != dst) { + ndcToPixel (wp->w, src, sx, sy, &fx, &fy); + dx = (int) fx; + dy = (int) fy; + } + } while (dst != src); + + sprintf (buf, "%d", src); + Tcl_SetVar (obm->tcl, raster_out, buf, 0); + sprintf (buf, "%g", fx); + Tcl_SetVar (obm->tcl, x_out, buf, 0); + sprintf (buf, "%g", fy); + Tcl_SetVar (obm->tcl, y_out, buf, 0); + + if (z_out) { + uchar data[1]; + GtReadPixels (wp->w, src, data, 8, dx, dy, 1, 1); + sprintf (buf, "%d", data[0]); + Tcl_SetVar (obm->tcl, z_out, buf, 0); + } + + return (TCL_OK); +} + + +/* flip -- Edit a mapping to flip the mapped subimage in X and/or Y. + * + * Usage: flip mapping axis [axis] + * + * where axis is "x" or "y". This is a convenience routine for changing only + * the flip portion of a mapping. + */ +static int +gtermFlip (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + register Widget w = wp->w; + int mapping, rop, flipX, flipY, i; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + + if (argc < 2) + return (TCL_ERROR); + + mapping = atoi (argv[1]); + flipX = flipY = 0; + for (i=2; i < argc; i++) { + if (argv[i][0] == 'x') + flipX = !flipX; + else if (argv[i][0] == 'y') + flipY = !flipY; + } + + if (flipX || flipY) { + GtGetMapping (w, mapping, + &rop, &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + + if (flipX) + dnx = -dnx; + if (flipY) + dny = -dny; + + GtSetMapping (w, mapping, + rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + } + + return (TCL_OK); +} + + +/* gtermMarkerInit -- Initialize the Marker subsystem for a Gterm widget. + * This destroys all markers and initializes the marker subsystem. + * + * Usage: markerInit + */ +static int +gtermMarkerInit (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + + GtMarkerInit (wp->w); + return (TCL_OK); +} + + +/* gtermCreateMarker -- Create a new marker. + * + * Usage: createMarker name attribute-list + * e.g. createMarker name {attribute value [attribute value ...]} + * or createMarker name attribute value [attribute value ...] + * + * Any marker attribute may be assigned a value when the marker is created. + * Refer to <ObmW/Gterm.h> for a list of marker attribute names. Often the + * the attributes "type" and "createMode" need to be specified at marker + * create time. + * + * type The marker type: text, rectangle, circle, etc. + * + * createMode A marker should be created with createMode=interactive + * if the user is expected to interactively drag out + * the marker using the pointer and either the default + * or an application specified translation table. A + * marker can also be created interactively using only + * the m_create (marker create) action, however m_create + * does not allow the marker attributes to be set. + * + * There are any number of ways to use a GUI to create a marker under the + * Object Manager, but an example might be using a translation to call a GUI + * procedure which issues the createMarker call. For example a pointer down + * event could translate as "call(newMarker,$name,$x,$y) m_create()" where + * newMarker is a GUI marker creation procedure which sends a createMarker + * message to the Gterm widget. The GUI procedure could set the marker + * attributes as desired, possibly using additional GUI components to define + * the marker attributes. The m_create action will notice that a + * createMarker has been executed and will merely activate the marker and + * give it the pointer focus (i.e. install the marker translations). The + * user will then use the pointer or keyboard to drag out the marker. + * + * If the marker is created noninteractive the application must set the marker + * position and size using marker attributes. If the marker is sensitive + * the user can then use the marker's translations to interactively modify + * the marker (resize it, move it, etc.). All markers which are visible and + * sensitive and which have the necessary translations can be interactively + * modified by the user; the reason for creating a marker in interactive mode + * is to allow the initial marker position and size to be specified + * interactively *when* the marker is created, instead of afterwards. + * + * Any number of attributes may be given when the marker is created. Most + * marker attributes can also be modified after a marker has been created + * by sending setAttribute messages to the marker. + */ +static int +gtermCreateMarker (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + GtermObject obj = (GtermObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + Arg args[MAX_ARGS]; + int nargs, i; + char **items; + int nitems; + char *name; + + if (argc < 2) + return (TCL_ERROR); + + name = argv[1]; + + if (argc == 3) { + /* Attribute list passed as a list argument. */ + if (Tcl_SplitList (tcl, argv[2], &nitems, &items) != TCL_OK) + return (TCL_ERROR); + } else if (argc > 3) { + /* Attribute list passed as separate arguments. */ + nitems = argc - 2; + items = (char **) XtMalloc (nitems * sizeof(char *)); + if (items == NULL) + return (TCL_ERROR); + for (i=0; i < nitems; i++) + items[i] = argv[i+2]; + } else + return (TCL_ERROR); + + if (argc > 2) + for (i=nargs=0; i < nitems && nargs < MAX_ARGS; i += 2) { + XtSetArg (args[nargs], items[i], items[i+1]); + nargs++; + } + + obmNewObject (obm, name, "Marker", obj->core.name, args, nargs); + + if (argc > 2) + free ((char *) items); + + return (TCL_OK); +} + + +/* + * Gterm widget utility procedures. + * ------------------------------------------ + */ + + +/* coordType -- Convert a coordinate type string "pixel" or "ndc" to an + * integer code. + */ +coordType (name) +char *name; +{ + if (strcmp (name, "pixel") == 0 || + strcmp (name, "Pixel") == 0 || + strcmp (name, "PIXEL") == 0) { + + return (GtPixel); + + } else if ( + strcmp (name, "ndc") == 0 || + strcmp (name, "NDC") == 0) { + + return (GtNDC); + + } else + return (-1); +} + + +/* dataLevelType -- Convert a data level type string to an integer code. + */ +dataLevelType (name) +char *name; +{ + if (strcmp (name, "set") == 0) + return (GtSet); + else if (strcmp (name, "clear") == 0) + return (GtClear); + else if (strcmp (name, "invert") == 0) + return (GtInvert); + else + return (-1); +} + + +/* lineStyle -- Convert a line style string to an integer code. + */ +lineStyle (name) +char *name; +{ + if (strcmp (name, "solid") == 0) + return (GtSolid); + else if (strcmp (name, "dashed") == 0) + return (GtDashed); + else if (strcmp (name, "dotted") == 0) + return (GtDotted); + else if (strcmp (name, "dashDot") == 0) + return (GtDashDot); + else if (strcmp (name, "dash3Dot") == 0) + return (GtDash3Dot); + else + return (-1); +} + + +/* fillType -- Convert a fill type string to an integer code. + */ +fillType (name) +char *name; +{ + if (strcmp (name, "solid") == 0) + return (GtSolid); + else if (strcmp (name, "outline") == 0) + return (GtOutline); + else + return (-1); +} + + +/* colorToIndex -- Convert a color name or number to a gterm widget color + * index. + */ +colorToIndex (name) +char *name; +{ + if (isdigit (*name)) + return (atoi (name)); + else if (strcmp (name, "background") == 0) + return (0); + else if (strcmp (name, "foreground") == 0) + return (1); + else if (strcmp (name, "black") == 0) + return (0); + else if (strcmp (name, "white") == 0) + return (1); + else if (strcmp (name, "red") == 0) + return (2); + else if (strcmp (name, "green") == 0) + return (3); + else if (strcmp (name, "blue") == 0) + return (4); + else if (strcmp (name, "cyan") == 0) + return (5); + else if (strcmp (name, "magenta") == 0) + return (6); + else if (strcmp (name, "yellow") == 0) + return (7); + else if (strcmp (name, "user1") == 0) + return (8); + else if (strcmp (name, "user2") == 0) + return (9); + else + return (-1); +} + + +/* ncdToPixel -- Convert NDC (integer) to raster pixel (floating) coordinates. + */ +ndcToPixel (w, raster, nx, ny, rx, ry) +Widget w; +int raster; +int nx, ny; +float *rx, *ry; +{ + int rtype, width, height, depth; + int x2, y2; + + GtQueryRaster (w, raster, &rtype, &width, &height, &depth); + x2 = width; + y2 = height; + + *rx = (float)( nx) / MAXNDC * x2; + *ry = (float)(MAXNDC - ny) / MAXNDC * y2; /* NDC is flipped in Y */ +} + +static XPoint * +get_points (points, npoints) +char *points; +int *npoints; +{ + register int i; + register char *ip; + register XPoint *pv; + char *ipp, *ip_save; + int maxpts, npts; + + maxpts = MAX_POLYPTS; + if ((pv = (XPoint *) XtMalloc (maxpts * sizeof(XPoint))) == NULL) + return (NULL); + + /* Get the points array. */ + for (npts=0, ip=points; *ip; ) { + while (isspace(*ip) || *ip == '{') + ip++; + + ip_save = ip; + pv[npts].x = (short) strtod (ip, &ipp); ip = ipp; + pv[npts].y = (short) strtod (ip, &ipp); ip = ipp; + if (ip == ip_save) { + XtFree ((char *) pv); + return (NULL); + } + + while (isspace(*ip) || *ip == '}') + ip++; + + if (++npts >= maxpts) { + maxpts *= 2; + if ((pv = (XPoint *) XtRealloc ((char *)pv, + maxpts * sizeof(XPoint))) == NULL) + return (NULL); + } + } + + *npoints = npts; + return (pv); +} + + +/* get_mapping -- Read a mapping from an argument list into local variables. + */ +static void +get_mapping (argv, src, st, sx,sy,snx,sny, dst, dt, dx,dy,dnx,dny) +register char **argv; /* mapping values */ +int *src, *st; +int *sx, *sy, *snx, *sny; +int *dst, *dt; +int *dx, *dy, *dnx, *dny; +{ + register int ndc; + register double v; + + *src = atoi (argv[0]); + *st = (strcmp(argv[1],"pixel")==0 || strcmp(argv[1],"Pixel")==0) ? + GtPixel : GtNDC; + ndc = (*st == GtNDC); + + v = atof(argv[2]); + *sx = ndc ? (v * MAXNDC) : v; + v = atof(argv[3]); + *sy = ndc ? ((1.0 - v) / 1.0 * MAXNDC) : v; + v = atof(argv[4]); + *snx = ndc ? (v * MAXNDC) : v; + v = atof(argv[5]); + *sny = ndc ? (v * MAXNDC) : v; + + *dst = atoi (argv[6]); + *dt = (strcmp(argv[7],"pixel")==0 || strcmp(argv[7],"Pixel")==0) ? + GtPixel : GtNDC; + ndc = (*dt == GtNDC); + + v = atof(argv[8]); + *dx = ndc ? (v * MAXNDC) : v; + v = atof(argv[9]); + *dy = ndc ? ((1.0 - v) / 1.0 * MAXNDC) : v; + v = atof(argv[10]); + *dnx = ndc ? (abs(v) * MAXNDC) : abs(v); + if (v < 0) + *dnx = -(*dnx); + v = atof(argv[11]); + *dny = ndc ? (abs(v) * MAXNDC) : abs(v); + if (v < 0) + *dny = -(*dny); +} + + +/* put_mapping -- Output a mapping from local variables to a list of output + * variables. + */ +static void +put_mapping (tcl, argv, src, st, sx,sy,snx,sny, dst, dt, dx,dy,dnx,dny) +register Tcl_Interp *tcl; +register char **argv; /* mapping variables */ +int src, st; +int sx, sy, snx, sny; +int dst, dt; +int dx, dy, dnx, dny; +{ + register int ndc; + char buf[SZ_NUMBER]; + + sprintf (buf, "%d", src); + Tcl_SetVar (tcl, argv[0], buf, 0); + Tcl_SetVar (tcl, argv[1], st == GtPixel ? "Pixel" : "NDC", 0); + ndc = (st == GtNDC); + + sprintf (buf, "%g", ndc ? (float)sx / MAXNDC : (float)sx); + Tcl_SetVar (tcl, argv[2], buf, 0); + sprintf (buf, "%g", + ndc ? (1.0 - ((float)sy / MAXNDC)) : (float)sy); + Tcl_SetVar (tcl, argv[3], buf, 0); + sprintf (buf, "%g", ndc ? (float)snx / MAXNDC : (float)snx); + Tcl_SetVar (tcl, argv[4], buf, 0); + sprintf (buf, "%g", ndc ? (float)sny / MAXNDC : (float)sny); + Tcl_SetVar (tcl, argv[5], buf, 0); + + sprintf (buf, "%d", src); + Tcl_SetVar (tcl, argv[6], buf, 0); + Tcl_SetVar (tcl, argv[7], st == GtPixel ? "Pixel" : "NDC", 0); + ndc = (st == GtNDC); + + sprintf (buf, "%g", ndc ? (float)dx / MAXNDC : (float)dx); + Tcl_SetVar (tcl, argv[8], buf, 0); + sprintf (buf, "%g", + ndc ? (1.0 - ((float)dy / MAXNDC)) : (float)dy); + Tcl_SetVar (tcl, argv[9], buf, 0); + sprintf (buf, "%g", ndc ? (float)dnx / MAXNDC : (float)dnx); + Tcl_SetVar (tcl, argv[10], buf, 0); + sprintf (buf, "%g", ndc ? (float)dny / MAXNDC : (float)dny); + Tcl_SetVar (tcl, argv[11], buf, 0); +} diff --git a/vendor/x11iraf/obm/html.c b/vendor/x11iraf/obm/html.c new file mode 100644 index 00000000..3679a7a9 --- /dev/null +++ b/vendor/x11iraf/obm/html.c @@ -0,0 +1,1534 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ObmP.h> +#include "widget.h" + +/* + * HTML widget class (a subclass of Widget). + * ------------------------------------------------------------------------- + * The HTML (hypertext markup language) widget displays a block of HTML + * formatted text, the "document" to be displayed. The text consists of a + * mixture of text to be displayed and embedded formatting directives. The + * text may also contain "hot links" pointing to other HTML-formatted + * documents. + * + * setText text [target [header_text [footer_text]]] + * text = getText [format [font]] + * retestAnchors + * + * id = positionToId x y + * idToPosition id x y + * anchorToPosition name x y + * id = anchorToId name + * gotoId id + * + * n = getHRefs list + * n = getImageSrcs list + * n = getLinks list + * + * setSelection start end + * text = getSelection start end + * clearSelection + * + * searchText pattern start end [direction [search_type]] + * + * addCallback procedure-name [callback-type] + * deleteCallback procedure-name [callback-type] + * + * The possible callback types and their callback arguments are as follows. + * + * anchor widget cbtype event text href element_id + * testAnchor widget cbtype href + * submitForm widget cbtype event attrs href method enctype encentity + * link widget cbtype href role + * pointerMotion widget cbtype href + * + * See the comments below for further details on the callback types and their + * arguments. + * + * All a "hot link" is to the HTML widget is a document object containing a + * HREF which causes a callback when selected by the user viewing the document. + * It is up to the application using the HTML widget to define what the meaning + * of an HREF is. + * + * This version of the HTML widget binding does not yet support inline images. + */ + +#define CB_Anchor 1 +#define CB_TestAnchor 2 +#define CB_PointerMotion 3 +#define CB_SubmitForm 4 +#define CB_Link 5 + +/* HTML class instance descriptor. */ +struct htmlPrivate { + ObmCallback callback_list; +}; + +typedef struct htmlPrivate *HTMLPrivate; + +struct htmlObject { + struct obmObjectCore core; + struct widgetPrivate widget; + struct htmlPrivate html; +}; + +typedef struct htmlObject *HTMLObject; + +/* HTML class class record private data. */ +typedef struct { + /* standard MsgContext fields. */ + Tcl_Interp *tcl; /* class interpreter */ + ObmObject object[MAX_LEVELS]; /* object which received last message */ + int level; + + /* HTML specific fields. */ + /* (none) */ +} htmlClassData, *HTMLClassData; + + +void HTMLDestroy(); +void HTMLClassDestroy(); +ObmObject HTMLCreate(); + +static int htmlSetText(), htmlGetText(), htmlGetHRefs(); +static int htmlGetImageSrcs(), htmlGetLinks(); +static int htmlRetestAnchors(), htmlPositionToId(), htmlIdToPosition(); +static int htmlAnchorToPosition(), htmlAnchorToId(); +static int htmlGotoId(), htmlAddCallback(), htmlDeleteCallback(); +static int htmlSetSelection(), htmlGetSelection(), htmlClearSelection(); +static int htmlSearchText(); + +static void anchorCallback(), pointerMotionCallback(); +static void submitFormCallback(), linkCallback(); +static char *cb_encode(), *makeList(); +static int testAnchorCallback(); +static void cb_error(); +static int cb_decode(); +extern long strtol(); + + +/* HTMLClassInit -- Initialize the class record for the HTML widget class. + */ +void +HTMLClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register HTMLClassData gcd; + register Tcl_Interp *tcl; + register ClientData c_gcd; + + /* Install the class methods. */ + classrec->ClassDestroy = HTMLClassDestroy; + classrec->Create = (ObmFunc) HTMLCreate; + classrec->Destroy = HTMLDestroy; + classrec->Evaluate = WidgetEvaluate; + + /* The HTML widget subclass has its own command set hence has its + * own interpreter. The widget will respond both to all the commands + * defined here, and to all the commands implemented by the base + * Widget class. + */ + if (!classrec->class_data) { + gcd = (HTMLClassData) XtCalloc (1, sizeof (htmlClassData)); + gcd->tcl = tcl = Tcl_CreateInterp(); + classrec->class_data = (XtPointer) gcd; + c_gcd = (ClientData)gcd; + gcd->level = 0; + + Tcl_CreateCommand (tcl, + "addCallback", htmlAddCallback, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "deleteCallback", htmlDeleteCallback, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setText", htmlSetText, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getText", htmlGetText, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "positionToId", htmlPositionToId, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "idToPosition", htmlIdToPosition, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "anchorToPosition", htmlAnchorToPosition, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "anchorToId", htmlAnchorToId, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "gotoId", htmlGotoId, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getHRefs", htmlGetHRefs, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getImageSrcs", htmlGetImageSrcs, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getLinks", htmlGetLinks, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "retestAnchors", htmlRetestAnchors, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "setSelection", htmlSetSelection, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "getSelection", htmlGetSelection, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "clearSelection", htmlClearSelection, c_gcd, NULL); + Tcl_CreateCommand (tcl, + "searchText", htmlSearchText, c_gcd, NULL); + } +} + + +/* HTMLClassDestroy -- Custom destroy procedure for the HTML class. + */ +void +HTMLClassDestroy (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register HTMLClassData gcd = (HTMLClassData) classrec->class_data; + + if (gcd) { + if (gcd->tcl) + Tcl_DeleteInterp (gcd->tcl); + XtFree ((char *)gcd); + classrec->class_data = NULL; + } +} + + +/* HTMLCreate -- Create an instance of a HTML object. + */ +ObmObject +HTMLCreate (obm, name, classrec, parent, a_args, a_nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList a_args; +int a_nargs; +{ + register HTMLObject obj; + register Widget w; + Arg args[128]; + int nargs = 0; + + for (nargs = 0; nargs < a_nargs; nargs++) + args[nargs] = a_args[nargs]; + + XtSetArg (args[nargs], WbNpreviouslyVisitedTestFunction, + (long)testAnchorCallback); nargs++; + XtSetArg (args[nargs], WbNpointerMotionCallback, + (long)pointerMotionCallback); nargs++; + + obj = (HTMLObject) WidgetCreate (obm, name,classrec,parent,args,nargs); + if (obj == NULL) + return (NULL); + obj = (HTMLObject) XtRealloc ((char *)obj, sizeof(struct htmlObject)); + if (obj == NULL) + return (NULL); + + w = obj->widget.w; + /* register_image_resolution_function (w); */ + XtAddCallback (w, WbNanchorCallback, anchorCallback, (XtPointer)obj); + XtAddCallback (w, WbNlinkCallback, linkCallback, (XtPointer)obj); + XtAddCallback (w, WbNsubmitFormCallback, submitFormCallback, + (XtPointer)obj); + + XtSetArg (args[0], WbNpreviouslyVisitedTestData, obj); + XtSetArg (args[1], WbNpointerMotionData, obj); + XtSetValues (w, args, 2); + + /* Initialize HTMLPrivate instance structure. */ + obj->html.callback_list = NULL; + + return ((ObmObject) obj); +} + + +/* HTMLDestroy -- Destroy an instance of a HTML object. + */ +void +HTMLDestroy (object) +ObmObject object; +{ + HTMLObject obj = (HTMLObject) object; + ObjClassRec classrec = obj->core.classrec; + register HTMLClassData gcd = (HTMLClassData) classrec->class_data; + register ObmCallback cb, cb_next; + ObmContext obm = obj->widget.obm; + Widget w = obj->widget.w; + + /* Destroy the object in the second final call to Destroy. */ + if (!obj->core.being_destroyed++) + return; + + /* Free any HTML callback descriptors. */ + for (cb = obj->html.callback_list; cb; cb = cb_next) { + cb_next = cb->next; + + XtFree ((char *)cb); + } + + WidgetDestroy (object); +} + + +/* + * HTML class functions. + * ----------------------- + */ + + +/* setText -- Set the text to be displayed in the HTML widget. + * + * Usage: setText text [target [header_text [footer_text]]] + * + * If a target anchor is given the text will be positioned to view the + * given anchor. The target anchor may be specified either by name or by + * its element_id (tag number within the document, e.g. as returned in the + * anchor callback). If any HTML-formatted header or footer text is given + * this will be displayed before or after the document passed in as "text". + */ +static int +htmlSetText (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *text, *target_anchor; + char *header_text, *footer_text; + int element_id; + + text = (argc > 1) ? argv[1] : NULL; + target_anchor = (argc > 2) ? argv[2] : NULL; + header_text = (argc > 3) ? argv[3] : NULL; + footer_text = (argc > 4) ? argv[4] : NULL; + element_id = target_anchor ? atoi (target_anchor) : 0; + + HTMLSetText (wp->w, text, + header_text, footer_text, element_id, target_anchor, NULL); + + return (TCL_OK); +} + + +/* getText -- Get the text of the document currently being displayed. + * + * Usage: text = getText [format [font]] + * + * The optional format argument determines the type of text to be returned. + * The possible values are as follows. + * + * simple No formatting other than indents. + * pretty Simple formatting. + * postscript Return formatted Postscript. + * + * The default output format is simple. If Postscript output is selected + * the font can be selected from one of the following: + * + * times Times + * helvetica Helvetica + * schoolbook New century schoolbook + * lucida Lucida Bright + * + * The default Postscript font is Times. + */ +static int +htmlGetText (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + char *text, *format, *font; + int pretty = 0; + + format = (argc > 1) ? argv[1] : "simple"; + font = (argc > 2) ? argv[2] : "times"; + + if (strcmp (format, "simple") == 0) + pretty = 0; + else if (strcmp (format, "pretty") == 0) + pretty = 1; + else if (strcmp (format, "postscript") == 0) { + if (strcmp (font, "times") == 0) + pretty = 2; + else if (strcmp (font, "helvetica") == 0) + pretty = 3; + else if (strcmp (font, "schoolbook") == 0) + pretty = 4; + else if (strcmp (font, "lucida") == 0) + pretty = 5; + else + pretty = 2; + } + + if (text = HTMLGetText (wp->w, pretty)) { + Tcl_SetResult (wp->obm->tcl, text, TCL_VOLATILE); + free (text); + } + + return (TCL_OK); +} + + +/* positionToId -- Return the element id of the HTML element nearest to the + * given position x,y. + * + * Usage: id = positionToId x y + * + * If there is no element at the given position the first element in the + * current line is returned. If we are not positioned to a line, either the + * beginning or the end of the document is returned. + */ +static int +htmlPositionToId (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + int element_id, x, y; + char buf[SZ_NUMBER]; + + if (argc < 3) + return (TCL_ERROR); + + x = atoi (argv[1]); + y = atoi (argv[2]); + element_id = HTMLPositionToId (wp->w, x, y); + + sprintf (buf, "%d", element_id); + Tcl_SetResult (wp->obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* idToPosition -- Return the position of an HTML element given its + * element id. + * + * Usage: idToPosition id x y + * + * If there is no element with the given element id false is returned and + * the coordinates x,y are undefined. + */ +static int +htmlIdToPosition (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + ObmContext obm = obj->widget.obm; + int status, element_id, x, y; + char buf[SZ_NUMBER]; + char *s_x, *s_y; + + if (argc < 2) + return (TCL_ERROR); + + element_id = atoi (argv[1]); + s_x = (argc > 2) ? argv[2] : NULL; + s_y = (argc > 3) ? argv[3] : NULL; + status = HTMLIdToPosition (wp->w, element_id, &x, &y); + + if (status < 0) + Tcl_SetResult (obm->tcl, FALSESTR, TCL_STATIC); + else { + if (s_x) { + sprintf (buf, "%d", x); + if ((Tcl_SetVar (obm->tcl, s_x, buf, 0)) == NULL) /* MF024 */ + return (TCL_ERROR); + } + if (s_y) { + sprintf (buf, "%d", y); + if ((Tcl_SetVar (obm->tcl, s_y, buf, 0)) == NULL) /* MF024 */ + return (TCL_ERROR); + } + Tcl_SetResult (obm->tcl, TRUESTR, TCL_STATIC); + } + + return (TCL_OK); +} + + +/* anchorToPosition -- Return the position of the named anchor. + * + * Usage: bool = anchorToPosition anchor [x y] + * + * If there is no anchor with the given name false is returned and the + * coordinates x,y are undefined. + */ +static int +htmlAnchorToPosition (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + ObmContext obm = obj->widget.obm; + char *anchor, *s_x, *s_y; + char buf[SZ_NUMBER]; + int status, x, y; + + if (argc < 2) + return (TCL_ERROR); + + anchor = argv[1]; + s_x = (argc > 2) ? argv[2] : NULL; + s_y = (argc > 3) ? argv[3] : NULL; + status = HTMLAnchorToPosition (wp->w, anchor, &x, &y); + + if (status < 0) + Tcl_SetResult (obm->tcl, FALSESTR, TCL_STATIC); + else { + if (s_x) { + sprintf (buf, "%d", x); + if ((Tcl_SetVar (obm->tcl, s_x, buf, 0)) == NULL) /* MF024 */ + return (TCL_ERROR); + } + if (s_y) { + sprintf (buf, "%d", y); + if ((Tcl_SetVar (obm->tcl, s_y, buf, 0)) == NULL) /* MF024 */ + return (TCL_ERROR); + } + Tcl_SetResult (obm->tcl, TRUESTR, TCL_STATIC); + } + + return (TCL_OK); +} + + +/* anchorToId -- Return the element id of the named anchor. + * + * Usage: id = anchorToId anchor + * + * If there is no anchor with the given name false is returned. + */ +static int +htmlAnchorToId (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + char buf[SZ_NUMBER]; + int element_id; + char *anchor; + + if (argc < 2) + return (TCL_ERROR); + + anchor = argv[1]; + element_id = HTMLAnchorToId (wp->w, anchor); + + sprintf (buf, "%d", element_id); + Tcl_SetResult (wp->obm->tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* gotoId -- Position to the given element given its element id. + * + * Usage: gotoId element_id + * + * An id of zero means go to the top of the document. + */ +static int +htmlGotoId (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + int element_id; + + if (argc < 2) + return (TCL_ERROR); + + element_id = atoi (argv[1]); + HTMLGotoId (wp->w, element_id); + + return (TCL_OK); +} + + +/* getHRefs -- Get a list of the HREFs of all the active anchors in the + * document being displayed. + * + * Usage: n = getHRefs list + * + * The number of HREFs is returned as the function value; zero is returned + * if there are no HREFs, in which case "list" is undefined. If the document + * has HREFs on output list will contain a list of HREFs in the form { {HREF1} + * {HREF2} ... {HREFn} }. + * + * An HREF is a hypertext reference, i.e. hot-link or hypertext link to + * some other hypertext document that can be referenced by clicking on an + * anchor in the document being displayed. + */ +static int +htmlGetHRefs (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = obj->widget.obm; + char *a_list, *lbuf, **list; + char buf[SZ_NUMBER]; + int n; + + if (argc < 2) + return (TCL_ERROR); + else + a_list = argv[1]; + + if (list = HTMLGetHRefs (wp->w, &n)) { + if (!(lbuf = makeList (list, n))) { + free ((char *)list); + return (TCL_ERROR); + } + + if ((Tcl_SetVar (obm->tcl, a_list, lbuf, 0)) == NULL) { /* MF024 */ + free ((char *)list); + XtFree (lbuf); + return (TCL_ERROR); + } + + free ((char *)list); + XtFree (lbuf); + } else + n = 0; + + sprintf (buf, "%d", n); + Tcl_SetResult (wp->obm->tcl, buf, TCL_VOLATILE); + return (TCL_OK); +} + + +/* getImageSrcs -- Get a list of the image sources (SRC=) for all the + * inline images referenced by the document being displayed. + * + * Usage: n = getImageSrcs list + * + * The number of SRCs is returned as the function value; zero is returned + * if there are no SRCs, in which case "list" is undefined. If the document + * has SRCs on output the list will contain a list of SRCs in the form + * { {SRC1} {SRC2} ... {SRCn} }. + * + * A SRC is a HREF pointing to an image file. + */ +static int +htmlGetImageSrcs (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = obj->widget.obm; + char *a_list, *lbuf, **list; + char buf[SZ_NUMBER]; + int n; + + if (argc < 2) + return (TCL_ERROR); + else + a_list = argv[1]; + + if (list = HTMLGetImageSrcs (wp->w, &n)) { + if (!(lbuf = makeList (list, n))) { + free ((char *)list); + return (TCL_ERROR); + } + + if ((Tcl_SetVar (obm->tcl, a_list, lbuf, 0)) == NULL) { /* MF024 */ + free ((char *)list); + XtFree (lbuf); + return (TCL_ERROR); + } + + free ((char *)list); + XtFree (lbuf); + } else + n = 0; + + sprintf (buf, "%d", n); + Tcl_SetResult (wp->obm->tcl, buf, TCL_VOLATILE); + return (TCL_OK); +} + + +/* getLinks -- Get a list of the link tags (<LINK>) referenced by the + * document being displayed. + * + * Usage: n = getLinks list + * + * The number of links is returned as the function value; zero is returned + * if there are no links, in which case "list" is undefined. If there are + * any links the returned list will have the format { {{href} {role}} ...} + * where the structure {{href} {role}} describes each link. + */ +static int +htmlGetLinks (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = obj->widget.obm; + char *a_list, *lbuf; + char buf[SZ_NUMBER]; + LinkInfo *list; + int nchars, n; + + if (argc < 2) + return (TCL_ERROR); + else + a_list = argv[1]; + + if (list = HTMLGetLinks (wp->w, &n)) { + register char *ip, *op; + register int i; + + /* Determine how much storage we need for the list. */ + for (i=0, nchars=0; i < n; i++) { + nchars += strlen (list[i].href) + 4; + nchars += strlen (list[i].role) + 4; + } + nchars += 5; + + /* Get the storage. */ + if (!(lbuf = op = XtMalloc (nchars))) { + free ((char *)list); + return (TCL_ERROR); + } + + /* Encode the list as a Tcl list of lists. */ + *op++ = '{'; *op++ = ' '; + for (i=0; i < n; i++) { + *op++ = '{'; + *op++ = '{'; + for (ip=list[i].href; ip && *ip; ) + *op++ = *ip++; + *op++ = '}'; *op++ = ' '; + *op++ = '{'; + for (ip=list[i].role; ip && *ip; ) + *op++ = *ip++; + *op++ = '}'; + *op++ = '}'; *op++ = ' '; + } + *op++ = '}'; + *op++ = '\0'; + + if ((Tcl_SetVar (obm->tcl, a_list, lbuf, 0)) == NULL) { /* MF024 */ + free ((char *)list); + XtFree (lbuf); + return (TCL_ERROR); + } + + free ((char *)list); + XtFree (lbuf); + } else + n = 0; + + sprintf (buf, "%d", n); + Tcl_SetResult (wp->obm->tcl, buf, TCL_VOLATILE); + return (TCL_OK); +} + + +/* makeList -- Take a list of NULL terminated strings and turn it into a + * Tcl list of strings. + */ +static char * +makeList (list, n) +char **list; +int n; +{ + register char *ip, *op; + register int i; + int nchars; + char *buf; + + /* Determine how much storage we need for the list. */ + for (i=0, nchars=0; i < n; i++) + nchars += strlen (list[i]) + 4; + nchars += 5; + + /* Get the storage. */ + if (!(buf = op = XtMalloc (nchars))) { + free ((char *)list); + return (NULL); + } + + /* Encode the list as a Tcl list of strings. */ + *op++ = '{'; *op++ = ' '; + for (i=0; i < n; i++) { + *op++ = '{'; + for (ip=list[i]; ip && *ip; ) + *op++ = *ip++; + *op++ = '}'; *op++ = ' '; + } + *op++ = '}'; + *op++ = '\0'; + + return (buf); +} + + +/* retestAnchors -- Test each anchor and update the display to indicate + * the current status of the anchor. + * + * Usage: retestAnchors + * + * retestAnchors should be called after loading new text into a widget, + * or when the status of one or more anchors has changed, e.g. after a + * given URL has been visited. + */ +static int +htmlRetestAnchors (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + + HTMLRetestAnchors (wp->w, NULL, 0); + return (TCL_OK); +} + + +/* setSelection -- Set the current text selection to the text bracketed by + * the input start and end element refs. + * + * Usage: setSelection start end + * + * "start" and "end" are elements refs such as returned by searchText. + * An element ref is a structure of the form {element_id offset} specifying + * the element id within the document, and the character offset within + * that element. + */ +static int +htmlSetSelection (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + ElementRef start, end; + char *ip = (char *)NULL; + + if (argc < 3) + return (TCL_ERROR); + + ip = (char *)NULL; + start.id = strtol (&argv[1][1], &ip, 0); + start.pos = strtol (ip, &ip, 0); + if (ip == argv[1]) + return (TCL_ERROR); + + ip = (char *)NULL; + end.id = strtol (&argv[2][1], &ip, 0); + end.pos = strtol (ip, &ip, 0); + if (ip == argv[2]) + return (TCL_ERROR); + + HTMLSetSelection (wp->w, &start, &end); + return (TCL_OK); +} + + +/* getSelection -- Get the selected text, if any. + * + * Usage: text = getSelection + * + * An empty string is returned if there is no current text selection. + */ +static int +htmlGetSelection (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + char *text, *start, *end, *insert; + + text = HTMLGetTextAndSelection (wp->w, &start, &end, &insert); + if (text && start) { + int nchars = end - start + 1; + start[nchars] = '\0'; + Tcl_SetResult (wp->obm->tcl, start, TCL_VOLATILE); + } + + if (text) + free (text); + return (TCL_OK); +} + + +/* clearSelection -- Clear the current selection, if any. + * + * Usage: clearSelection + */ +static int +htmlClearSelection (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + + HTMLClearSelection (wp->w); + return (TCL_OK); +} + + +/* searchText -- Search the document for the given pattern. + * + * Usage: bool = searchText pattern start end [direction [search_type]] + * + * direction "forward" or "backward" + * search_type "caseSensitive" or "caseless" + * + * If the search is successful start and end are set to the element refs + * of the matched region and the function returns a true (nonzero) value. + * False is returned if the search fails. An element ref is a structure of + * the form {element_id offset} specifying the element id within the document, + * and the character offset within that element. The search will automatically + * wrap around the page if not found initially. + * + */ +static int +htmlSearchText (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register HTMLClassData gcd = (HTMLClassData) msg; + HTMLObject obj = (HTMLObject) gcd->object[gcd->level]; + register WidgetPrivate wp = &obj->widget; + ObmContext obm = obj->widget.obm; + char *pattern, *a_start, *a_end; + int backward = 0, caseless = 1; + static ElementRef start, end; + static char patstr[64]; + int status, again = 1; + + if (argc < 4) + return (TCL_ERROR); + + pattern = argv[1]; + a_start = argv[2]; + a_end = argv[3]; + backward = 0; + if (argc > 4) + backward = (strcmp (argv[4], "backward") == 0); + caseless = 0; + if (argc > 5) + caseless = (strcmp (argv[5], "caseless") == 0); + + /* See whether the pattern has changed and we need to reset the + * start and end element refs. + */ + if (strcmp (pattern, patstr) != 0) { +retry: start.id = start.pos = 0; + end.id = end.pos = 0; + strcpy (patstr, ""); + again = 0; + } + + /* Do the search. */ + status = HTMLSearchText (wp->w, pattern, + &start, &end, backward, caseless); + + if (status == 1) { + char buf[SZ_LINE]; + sprintf (buf, "{%d %d}", start.id, start.pos); + if ((Tcl_SetVar (obm->tcl, a_start, buf, 0)) == NULL) /* MF024 */ + return (TCL_ERROR); + sprintf (buf, "{%d %d}", end.id, end.pos); + if ((Tcl_SetVar (obm->tcl, a_end, buf, 0)) == NULL) /* MF024 */ + return (TCL_ERROR); + Tcl_SetResult (wp->obm->tcl, TRUESTR, TCL_STATIC); + } else { + if (again == 1) + goto retry; + Tcl_SetResult (wp->obm->tcl, FALSESTR, TCL_STATIC); + } + + /* Save the pattern string so we can reset later if it changes. */ + strcpy (patstr, pattern); + + return (TCL_OK); +} + + +/* AddCallback -- Post a callback for a HTML widget event. + * + * Usage: addCallback procedure-name [callback-type] + * + * The recognized HTML callbacks are + * + * anchor Called to load a new URL. + * + * testAnchor Called to test whether a given URL has + * been previously visited. + * + * pointerMotion Called when the pointer enters an object + * which has a URL. + * + * submitForm Called when a form is submitted from within + * the document being viewed. + * + * link Called when a <LINK> tag is encountered + * while loading text. + * + * The default callback type is "anchor", which is called when the user + * selects a new URL while viewing a document. + */ +static int +htmlAddCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + HTMLObject obj = (HTMLObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register HTMLPrivate hp = &obj->html; + register Widget w = wp->w; + char *userproc, *callback_type; + ObmCallback cb, new; + int type; + + if (argc < 2) + return (TCL_ERROR); + + userproc = argv[1]; + callback_type = (argc > 2) ? argv[2] : "anchor"; + if (!(type = cb_decode (callback_type))) + return (TCL_ERROR); + + /* Initialize callback descriptor. */ + new = (ObmCallback) XtCalloc (1, sizeof (obmCallback)); + new->u.obj = (ObmObject) obj; + new->callback_type = type; + strncpy (new->name, userproc, SZ_NAME); + + /* Append descriptor to callback list for widget. */ + for (cb = hp->callback_list; cb && cb->next; cb = cb->next) + ; + if (cb) + cb->next = new; + else + hp->callback_list = new; + + return (TCL_OK); +} + + +/* DeleteCallback -- Delete a HTML callback. + * + * Usage: deleteCallback procedure [callback_type] + * + * If a callback type is specified all entries of type callback_type for + * the named procedure are deleted, else all entries of any type for the + * named procedure are deleted. + */ +static int +htmlDeleteCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + HTMLObject obj = (HTMLObject) msg->object[msg->level]; + register HTMLPrivate hp = &obj->html; + register ObmCallback cb, prev, next; + char *procedure, *callback_type; + int type; + + if (argc < 2) + return (TCL_ERROR); + + procedure = argv[1]; + callback_type = (argc > 2) ? argv[2] : NULL; + type = callback_type ? cb_decode(callback_type) : 0; + + /* Locate and delete procedure entry in callback list. */ + for (prev=NULL, cb=hp->callback_list; cb; prev=cb, cb=next) { + next = cb->next; + if (strcmp (cb->name, procedure) == 0 && + (!type || cb->callback_type == type)) { + if (prev) + prev->next = next; + else + hp->callback_list = next; + XtFree ((char *)cb); + } + } + + return (TCL_OK); +} + + +/* anchorCallback -- Callback procedure called by the HTML widget when an + * anchor (URL) is selected. + * + * Calling sequence: + * + * userproc widget cbtype event text href element_id + * + * All callbacks registered with the current widget for the anchor callback + * are called in the order in which they were registered. + */ +static void +anchorCallback (w, client_data, call_data) +Widget w; +XtPointer client_data; +XtPointer call_data; +{ + register char *ip, *op; + register ObmCallback cb; + register WbAnchorCallbackData *ap = (WbAnchorCallbackData *)call_data; + HTMLObject obj = (HTMLObject) client_data; + ObmContext obm = obj->widget.obm; + char *text, *href, *none = "none"; + char event_type[SZ_LINE]; + char element_id[SZ_NUMBER]; + int status; + + text = ap->text ? ap->text : none; + href = ap->href ? ap->href : none; + sprintf (element_id, "%d", ap->element_id); + op = event_type; + + /* Compose the event type information. This is the name of the + * key typed, or "Button1", "Button2", etc. for the mouse buttons. + */ + switch (ap->event->type) { + case KeyPress: + case KeyRelease: + { XKeyPressedEvent *ev = (XKeyPressedEvent *) ap->event; + char buf[20]; + int n; + + if ((n = XLookupString(ev,buf,sizeof(buf),NULL,NULL)) > 0) { + for (ip=buf; --n >= 0; ) + if (*ip <= ' ') { + *op++ = '^'; + *op++ = *ip++ + 'A' - 1; + } else if (isprint (*ip)) { + *op++ = *ip++; + } else + ip++; + } else { + /* This case occurs when only a modifier is typed. */ + for (ip = "??"; *op++ = *ip++; ) + ; + } + *op = '\0'; + } + break; + + case ButtonPress: + case ButtonRelease: + { XButtonPressedEvent *ev = (XButtonPressedEvent *) ap->event; + sprintf (op, "Button%d", ev->button); + } + break; + default: + strcpy (event_type, "unknown"); + } + + /* Call any registered callback functions. */ + for (cb = obj->html.callback_list; cb; cb = cb->next) { + if (cb->callback_type != CB_Anchor) + continue; + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + cb_encode(cb->callback_type), " ", + event_type, " ", + "{", text, "} ", + "{", href, "} ", + element_id, + NULL); + + if (status != TCL_OK) + cb_error (obm, cb); + } +} + + +/* testAnchorCallback -- Callback procedure called by the HTML widget to + * test whether a given anchor (URL) has been previously visited. + * + * Calling sequence: + * + * userproc widget cbtype href + * + * A nonzero value should be returned by the userproc if the given anchor + * has been visited previously, otherwise a zero should be returned. + */ +static int +testAnchorCallback (w, client_data, href) +Widget w; +XtPointer client_data; +char *href; +{ + register ObmCallback cb; + register HTMLObject obj = (HTMLObject) client_data; + register ObmContext obm = obj->widget.obm; + int status, retval = 0; + + /* Call any registered callback functions. */ + for (cb = obj->html.callback_list; cb; cb = cb->next) { + if (cb->callback_type != CB_TestAnchor) + continue; + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + cb_encode(cb->callback_type), " ", + "{", href, "} ", + NULL); + + if (status != TCL_OK) + cb_error (obm, cb); + else if (atoi (obm->tcl->result)) + retval = 1; + } + + return (retval); +} + + +/* submitFormCallback -- Callback procedure called by the HTML widget when + * a form is submitted from the document. + * + * Calling sequence: + * + * userproc widget cbtype event attrs href method enctype encentity + * + * "widget" is the name of the HTML widget which generated the callback. + * "cbtype" is the type of callback, i.e., "submitForm". "event" is the + * key/button event which triggered the callback, e.g. "Button1". + * + * "attrs" is a list of attribute-value pairs defining the contents of the + * form. That is, a list of the form { {attr1 value1} {attr2 value2} ... }. + * + * The final block of arguments deal with how to process or deliver the form. + * "href", "method", "enctype", and "encentity" are strings defined by the + * HTML form. The application is free to use these as it wishes, except for + * an HTML form query where the meaning of these fields is well defined. + * The "href" field is normally the URL to which the form is to be submitted, + * while "method" is the method to be used to submit the form. + */ +static void +submitFormCallback (w, client_data, call_data) +Widget w; +XtPointer client_data; +XtPointer call_data; +{ + register char *ip, *op; + register ObmCallback cb; + register WbFormCallbackData *fp = (WbFormCallbackData *)call_data; + HTMLObject obj = (HTMLObject) client_data; + ObmContext obm = obj->widget.obm; + + char *href, *method, *enctype, *encentity; + char *abuf, event_type[SZ_LINE]; + char *none = "none"; + int status, i, n; + + href = fp->href ? fp->href : none; + method = fp->method ? fp->method : none; + enctype = fp->enctype ? fp->enctype : none; + encentity = fp->enc_entity ? fp->enc_entity : none; + op = event_type; + + /* Compose the event type information. This is the name of the + * key typed, or "Button1", "Button2", etc. for the mouse buttons. + */ + switch (fp->event->type) { + case KeyPress: + case KeyRelease: + { XKeyPressedEvent *ev = (XKeyPressedEvent *) fp->event; + char buf[20]; + int n; + + if ((n = XLookupString(ev,buf,sizeof(buf),NULL,NULL)) > 0) { + for (ip=buf; --n >= 0; ) + if (*ip <= ' ') { + *op++ = '^'; + *op++ = *ip++ + 'A' - 1; + } else if (isprint (*ip)) { + *op++ = *ip++; + } else + ip++; + } else { + /* This case occurs when only a modifier is typed. */ + for (ip = "??"; *op++ = *ip++; ) + ; + } + *op = '\0'; + } + break; + + case ButtonPress: + case ButtonRelease: + { XButtonPressedEvent *ev = (XButtonPressedEvent *) fp->event; + sprintf (op, "Button%d", ev->button); + } + break; + default: + strcpy (event_type, "unknown"); + } + + /* Get storage for the attribute list. */ + for (i=0, n=0; i < fp->attribute_count; i++) { + n += strlen (fp->attribute_names[i]); + n += strlen (fp->attribute_values[i]); + n += 10; + } + if (!(abuf = XtMalloc (n))) + return; + + /* Construct the attribute list. + */ + for (i=0, op=abuf; i < fp->attribute_count; i++) { + *op++ = '{'; + + *op++ = '{'; + for (ip = fp->attribute_names[i]; ip && *ip; ) + *op++ = *ip++; + *op++ = '}'; *op++ = ' '; + + *op++ = '{'; + for (ip = fp->attribute_values[i]; ip && *ip; ) + *op++ = *ip++; + *op++ = '}'; + + *op++ = '}'; *op++ = ' '; + } + *op = '\0'; + + /* Call any registered callback functions. */ + for (cb = obj->html.callback_list; cb; cb = cb->next) { + if (cb->callback_type != CB_SubmitForm) + continue; + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + cb_encode(cb->callback_type), " ", + event_type, " ", + "{ ", abuf, "} ", + href, " ", + method, " ", + enctype, " ", + encentity, " ", + NULL); + + if (status != TCL_OK) + cb_error (obm, cb); + } + + XtFree (abuf); +} + + +/* linkCallback -- Callback procedure called by the HTML widget when + * a <LINK> directive is encountered while loading text into the widget. + * + * Calling sequence: + * + * userproc widget cbtype href role + * + * All callbacks registered with the current widget for the callback + * are called in the order in which they were registered. + */ +static void +linkCallback (w, client_data, call_data) +Widget w; +XtPointer client_data; +XtPointer call_data; +{ + register char *ip, *op; + register ObmCallback cb; + LinkInfo *l_info = (LinkInfo *) call_data; + HTMLObject obj = (HTMLObject) client_data; + ObmContext obm = obj->widget.obm; + char *href, *role, *none = "none"; + int status; + + href = l_info->href ? l_info->href : none; + role = l_info->role ? l_info->role : none; + + /* Call any registered callback functions. */ + for (cb = obj->html.callback_list; cb; cb = cb->next) { + if (cb->callback_type != CB_Link) + continue; + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + cb_encode(cb->callback_type), " ", + href, " ", + role, " ", + NULL); + + if (status != TCL_OK) + cb_error (obm, cb); + } +} + + +/* pointerMotionCallback -- Callback procedure called by the HTML widget when + * the pointer enters an anchor. + * + * Calling sequence: + * + * userproc widget cbtype href + */ +static void +pointerMotionCallback (w, client_data, href) +Widget w; +XtPointer client_data; +char *href; +{ + register ObmCallback cb; + register HTMLObject obj = (HTMLObject) client_data; + register ObmContext obm = obj->widget.obm; + int status; + + /* Call any registered callback functions. */ + for (cb = obj->html.callback_list; cb; cb = cb->next) { + if (cb->callback_type != CB_PointerMotion) + continue; + + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + cb_encode(cb->callback_type), " ", + "{", href, "} ", + NULL); + + if (status != TCL_OK) + cb_error (obm, cb); + } +} + + +/* cb_error -- Convenience routine to return an error from a callback. + */ +static void +cb_error (obm, cb) +register ObmContext obm; +register ObmCallback cb; +{ + register Tcl_Interp *tcl = obm->tcl; + char *errstr = Tcl_GetVar (tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + tcl->errorLine, cb->name, + errstr ? errstr : tcl->result); +} + +/* cb_decode -- Convert a callback_type string to a callback type code. + */ +static int +cb_decode (callback_type) +register char *callback_type; +{ + register int type = 0; + + if (strcmp (callback_type, "anchor") == 0) + type = CB_Anchor; + else if (strcmp (callback_type, "testAnchor") == 0) + type = CB_TestAnchor; + else if (strcmp (callback_type, "pointerMotion") == 0) + type = CB_PointerMotion; + else if (strcmp (callback_type, "submitForm") == 0) + type = CB_SubmitForm; + else if (strcmp (callback_type, "link") == 0) + type = CB_Link; + + return (type); +} + +/* cb_encode -- Convert a callback_type string to a callback type code. + */ +static char * +cb_encode (callback_type) +int callback_type; +{ + register char *type = "unknown"; + + switch (callback_type) { + case CB_Anchor: + type = "anchor"; + break; + case CB_TestAnchor: + type = "testAnchor"; + break; + case CB_PointerMotion: + type = "pointerMotion"; + break; + case CB_SubmitForm: + type = "submitForm"; + break; + case CB_Link: + type = "link"; + break; + } + + return (type); +} diff --git a/vendor/x11iraf/obm/listres/AllWidgets.c b/vendor/x11iraf/obm/listres/AllWidgets.c new file mode 100644 index 00000000..7de2cf94 --- /dev/null +++ b/vendor/x11iraf/obm/listres/AllWidgets.c @@ -0,0 +1,151 @@ +/* + * This file is generated by the genlist.sh script and contains an array of + * all the widgets in Athena widget set. + * + * $XConsortium: AllWidgets.c,v 1.4 90/03/02 15:34:13 jim Exp $ + */ +#include <X11/IntrinsicP.h> +#include <X11/Xmu/WidgetNode.h> + +extern WidgetClass applicationShellWidgetClass; +extern WidgetClass asciiSinkObjectClass; +extern WidgetClass asciiSrcObjectClass; +extern WidgetClass asciiTextWidgetClass; +extern WidgetClass boxWidgetClass; +extern WidgetClass commandWidgetClass; +extern WidgetClass compositeWidgetClass; +extern WidgetClass constraintWidgetClass; +extern WidgetClass coreWidgetClass; +extern WidgetClass dialogWidgetClass; +extern WidgetClass formWidgetClass; +extern WidgetClass gripWidgetClass; +extern WidgetClass htmlWidgetClass; +extern WidgetClass labelWidgetClass; +extern WidgetClass layoutWidgetClass; +extern WidgetClass listWidgetClass; +extern WidgetClass menuButtonWidgetClass; +extern WidgetClass objectClass; +extern WidgetClass overrideShellWidgetClass; +extern WidgetClass panedWidgetClass; +extern WidgetClass pannerWidgetClass; +extern WidgetClass portholeWidgetClass; +extern WidgetClass rectObjClass; +extern WidgetClass repeaterWidgetClass; +extern WidgetClass scrollbarWidgetClass; +extern WidgetClass shellWidgetClass; +extern WidgetClass simpleMenuWidgetClass; +extern WidgetClass simpleWidgetClass; +extern WidgetClass smeBSBObjectClass; +extern WidgetClass smeLineObjectClass; +extern WidgetClass smeObjectClass; +extern WidgetClass smeThreeDObjectClass; +extern WidgetClass stripChartWidgetClass; +extern WidgetClass textSinkObjectClass; +extern WidgetClass textSrcObjectClass; +extern WidgetClass textWidgetClass; +extern WidgetClass threeDWidgetClass; +extern WidgetClass toggleWidgetClass; +extern WidgetClass topLevelShellWidgetClass; +extern WidgetClass transientShellWidgetClass; +extern WidgetClass treeWidgetClass; +extern WidgetClass vendorShellWidgetClass; +extern WidgetClass viewportWidgetClass; +extern WidgetClass wmShellWidgetClass; + +extern WidgetClass gtermWidgetClass; +extern WidgetClass xfwfArrowWidgetClass; +extern WidgetClass xfwfBoardWidgetClass; +extern WidgetClass xfwfButtonWidgetClass; +extern WidgetClass xfwfCommonWidgetClass; +extern WidgetClass xfwfFrameWidgetClass; +extern WidgetClass xfwfGroupWidgetClass; +extern WidgetClass xfwfIconWidgetClass; +extern WidgetClass xfwfLabelWidgetClass; +extern WidgetClass xfwfMenuBarWidgetClass; +extern WidgetClass xfwfMultiListWidgetClass; +extern WidgetClass xfwfRadioGroupWidgetClass; +extern WidgetClass xfwfRowColWidgetClass; +extern WidgetClass xfwfScrollbarWidgetClass; +extern WidgetClass xfwfSlider2WidgetClass; +extern WidgetClass xfwfToggleWidgetClass; +extern WidgetClass tabsWidgetClass; +extern WidgetClass listtreeWidgetClass; +extern WidgetClass separatorWidgetClass; +extern WidgetClass tableWidgetClass; +/* +extern WidgetClass scrolledTableWidgetClass; +*/ + +XmuWidgetNode XawWidgetArray[] = { +{ "applicationShell", &applicationShellWidgetClass }, +{ "asciiSink", &asciiSinkObjectClass }, +{ "asciiSink", &asciiSinkObjectClass }, +{ "asciiSrc", &asciiSrcObjectClass }, +{ "asciiText", &asciiTextWidgetClass }, +{ "box", &boxWidgetClass }, +{ "command", &commandWidgetClass }, +{ "composite", &compositeWidgetClass }, +{ "constraint", &constraintWidgetClass }, +{ "core", &coreWidgetClass }, +{ "dialog", &dialogWidgetClass }, +{ "form", &formWidgetClass }, +{ "grip", &gripWidgetClass }, +{ "label", &labelWidgetClass }, +{ "list", &listWidgetClass }, +{ "menuButton", &menuButtonWidgetClass }, +{ "object", &objectClass }, +{ "overrideShell", &overrideShellWidgetClass }, +{ "paned", &panedWidgetClass }, +{ "panner", &pannerWidgetClass }, +{ "porthole", &portholeWidgetClass }, +{ "rect", &rectObjClass }, +{ "repeater", &repeaterWidgetClass }, +{ "scrollbar", &scrollbarWidgetClass }, +{ "shell", &shellWidgetClass }, +{ "simpleMenu", &simpleMenuWidgetClass }, +{ "simple", &simpleWidgetClass }, +{ "smeBSB", &smeBSBObjectClass }, +{ "smeLine", &smeLineObjectClass }, +{ "smeThreeD", &smeThreeDObjectClass }, +{ "sme", &smeObjectClass }, +{ "stripChart", &stripChartWidgetClass }, +{ "textSink", &textSinkObjectClass }, +{ "textSrc", &textSrcObjectClass }, +{ "text", &textWidgetClass }, +{ "threeD", &threeDWidgetClass }, +{ "toggle", &toggleWidgetClass }, +{ "topLevelShell", &topLevelShellWidgetClass }, +{ "transientShell", &transientShellWidgetClass }, +{ "tree", &treeWidgetClass }, +{ "vendorShell", &vendorShellWidgetClass }, +{ "viewport", &viewportWidgetClass }, +{ "wmShell", &wmShellWidgetClass }, + +{ "arrow", &xfwfArrowWidgetClass }, +{ "gterm", &gtermWidgetClass }, +{ "layout", &layoutWidgetClass }, +{ "html", &htmlWidgetClass }, +{ "board", &xfwfBoardWidgetClass }, +{ "frame", &xfwfFrameWidgetClass }, +{ "group", &xfwfGroupWidgetClass }, +{ "icon", &xfwfIconWidgetClass }, +{ "multiList", &xfwfMultiListWidgetClass }, +{ "radioGroup", &xfwfRadioGroupWidgetClass }, +{ "rowCol", &xfwfRowColWidgetClass }, +{ "textBox", &xfwfLabelWidgetClass }, +{ "textButton", &xfwfButtonWidgetClass }, +{ "textToggle", &xfwfToggleWidgetClass }, +{ "scrollbar2", &xfwfScrollbarWidgetClass }, +{ "slider2d", &xfwfSlider2WidgetClass }, + +{ "listtree", &listtreeWidgetClass }, +{ "tabs", &tabsWidgetClass }, +{ "separator", &separatorWidgetClass }, +{ "table", &tableWidgetClass }, +/* +{ "scrolledtable", &scrolledTableWidgetClass }, +*/ +}; + +int XawWidgetCount = XtNumber(XawWidgetArray); + diff --git a/vendor/x11iraf/obm/listres/AllWidgets.h b/vendor/x11iraf/obm/listres/AllWidgets.h new file mode 100644 index 00000000..cded7fcb --- /dev/null +++ b/vendor/x11iraf/obm/listres/AllWidgets.h @@ -0,0 +1,33 @@ +/* + * $XConsortium: AllWidgets.h,v 1.2 90/02/26 12:00:56 jim Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _XawAllWidgets_h +#define _XawAllWidgets_h + +/* + * This file matches the generated AllWidgets.c + */ +extern XmuWidgetNode XawWidgetArray[]; +extern int XawWidgetCount; + +#endif /* _XawAllWidgets_h */ diff --git a/vendor/x11iraf/obm/listres/Imakefile b/vendor/x11iraf/obm/listres/Imakefile new file mode 100644 index 00000000..6e542d74 --- /dev/null +++ b/vendor/x11iraf/obm/listres/Imakefile @@ -0,0 +1,20 @@ +XCOMM $XConsortium: Imakefile,v 1.13 91/07/17 00:48:25 gildea Exp $ + + DEPLIBS = XawClientDepLibs +LOCAL_LIBRARIES = XawClientLibs + SYS_LIBRARIES = -lm + + CDEBUGFLAGS = -O + XAWLIB = -lXaw3d # set to Xaw3d for 3d look + LOCAL_LDFLAGS = -L../../lib + EXTRA_INCLUDES = -I../../include + OBMLIBS = -lobm -lXpm + MATHLIB = -lm + DEPOBM = ../libobm.a + SRCS = listres.c AllWidgets.c + OBJS = listres.o AllWidgets.o + +AllTarget(listres) +NormalProgramTarget(listres,$(OBJS),${DEPOBM},${OBMLIBS} XawClientLibs, $(MATHLIB)) + +${DEPOBM}: diff --git a/vendor/x11iraf/obm/listres/Makefile.bak b/vendor/x11iraf/obm/listres/Makefile.bak new file mode 100644 index 00000000..1944175c --- /dev/null +++ b/vendor/x11iraf/obm/listres/Makefile.bak @@ -0,0 +1,587 @@ +# Makefile generated by imake - do not edit! +# $XConsortium: imake.c,v 1.89 94/08/12 00:45:51 gildea Exp $ + +# ----------------------------------------------------------------------- +# Makefile generated from "Imake.tmpl" and <Imakefile> +# $XConsortium: Imake.tmpl,v 1.219 94/05/13 15:58:31 matt Exp $ +# $SunSoft: @(#)Imake.tmpl 1.1 01/13/97 16:16:22 $ +# + +# ************************************************************************** +# NOTE: +# +# If the user does not define DESTDIR and/or BINDIR in the local Imakefile, +# 'make install' will install the resultant binaries in /usr/openwin/bin. +# This usually fails because of lack of write permission in that directory +# for non-root users. +# +# The reason is that the default definition of ProjectRoot is /usr/openwin. +# This value determines all other definitions, e.g. the binary, library and +# manual page directories, etc. The destination directory, DESTDIR, is not +# defined and BINDIR is defined as $(ProjectRoot)/bin in Project.tmpl. +# +# Care must be taken when changing ProjectRoot. It affects the inclusion +# path of 'imake' in finding the *.cf, *.def, *.tmpl and *.rules files, +# which are in /usr/openwin/lib/X11/config/, and the default inclusion path +# of X11 header files and libraries. Therefore, if ProjectRoot is changed +# not only these configuration files need to be copied to a proper location, +# defined by IRULESRC, so 'make Makefile' can work properly, the header file +# inclusion path, /usr/openwin/include, and the library search path, +# /usr/openwin/lib, also need to be defined properly either in the local +# Imakefile or one of the configuration files to avoid compilation errors +# for programs that use X11 header files or libraries. +# +# Please refer to Project.tmpl, Imake.tmpl, site.def, etc. in +# /usr/openwin/lib/X11/config/ for details. +# ************************************************************************** + +.SUFFIXES: .i + +# $XConsortium: Imake.cf,v 1.12 94/03/29 15:42:08 gildea Exp $ +# $SunSoft: @(#)Imake.cf 1.1 01/13/97 16:16:21 $ + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that need to come before +# the platform-specific parameters - edit site.def to change + +# site: $XConsortium: site.sample,v 1.11 94/06/03 19:50:12 matt Exp $ +# site: $SunSoft: @(#)site.def 1.1 01/13/97 16:16:27$ + +# ----------------------------------------------------------------------- +# platform-specific configuration parameters - edit sun.cf to change + +# platform: $XConsortium: sun.cf,v 1.133 94/07/08 12:23:12 gildea Exp $ +# platform: $SunSoft: @(#)sun.cf 1.5 08/25/99 12:27:05 $ + +# operating system: SunOS 5.8 + +# SUNSOFT SUNSOFT_LOADABLE + +# $XConsortium: svr4.cf,v 1.6 94/04/08 18:56:33 rws Exp $ +# $SunSoft: @(#)svr4.cf 1.1 01/13/97 16:16:29 $ + +# $XConsortium: sv4Lib.rules,v 1.14 94/04/09 12:00:10 rws Exp $ +# $SunSoft: @(#)sv4Lib.rules 1.1 01/13/97 16:16:28 $ + +# SUNSOFT SUNSOFT_LOADABLE + + TROFFTOPS = /usr/lib/lp/postscript/dpost | /usr/lib/lp/postscript/postreverse -r + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that go after +# the platform-specific parameters - edit site.def to change + +# site: $XConsortium: site.sample,v 1.11 94/06/03 19:50:12 matt Exp $ +# site: $SunSoft: @(#)site.def 1.1 01/13/97 16:16:27$ + +# ----------------------------------------------------------------------- +# Imake rules for building libraries, programs, scripts, and data files +# rules: $XConsortium: Imake.rules,v 1.193 94/04/10 17:39:55 rws Exp $ +# rules: $SunSoft: @(#)Imake.rules 1.1 01/13/97 16:16:21 $ + +# SUNSOFT SUNSOFT_LOADABLE + + PATHSEP = / + SHELL = /bin/sh + + TOP = . + CURRENT_DIR = . + + IMAKE = imake + DEPEND = makedepend + MKDIRHIER = mkdirhier + CONFIGSRC = $(TOP)/config + IMAKESRC = $(CONFIGSRC)/imake + DEPENDSRC = $(CONFIGSRC)/makedepend + IXXSRC = $(UNSUPPORTEDSRC)/programs/ixx + IXX = ixx + IXXFLAGS = -s BaseObject -m TypeObj -r RequestObj -p Xf + IXXINCLUDES = -i '<X11/Fresco/enter-scope.h>' + + INCROOT = /usr/openwin/include + USRLIBDIR = /usr/openwin/lib + SHLIBDIR = /usr/openwin/lib + LINTLIBDIR = $(USRLIBDIR) + MANPATH = /usr/openwin/share/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(MANSOURCEPATH)1 + LIBMANDIR = $(MANSOURCEPATH)3 + FILEMANDIR = $(MANSOURCEPATH)$(FILEMANSUFFIX) + + AR = /usr/ccs/bin/ar cq + BOOTSTRAPCFLAGS = -DSVR4 + CC = cc + AS = /usr/ccs/bin/as + + COMPRESS = compress + CPP = /usr/ccs/lib/cpp $(STD_CPP_DEFINES) + PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) + INSTALL = /usr/ucb/install + INSTALLFLAGS = -c + LD = /usr/ccs/bin/ld + LEX = /usr/ccs/bin/lex + LEXLIB = -ll + YACC = /usr/ccs/bin/yacc + CCYACC = /usr/ccs/bin/yacc + LINT = lint + LINTLIBFLAG = -y -o + LINTOPTS = -b -h -Xc + LN = ln -s + MAKE = /usr/ccs/bin/make + MV = mv + CP = cp + + RM = rm -f + MANSUFFIX = 1 + LIBMANSUFFIX = 3 + FILEMANSUFFIX = 4 + TROFF = troff -t -Tpost + MSMACROS = -ms + TBL = tbl + EQN = eqn + + DVIPS = dvips + LATEX = latex + + STD_INCLUDES = + STD_CPP_DEFINES = -Dsun -Dsparc -DSVR4 -DSYSV + STD_DEFINES = -Dsun -Dsparc -DSVR4 -DSYSV + EXTRA_LOAD_FLAGS = + EXTRA_LDOPTIONS = + EXTRA_LIBRARIES = -lsocket -lnsl + TAGS = ctags + + SHAREDCODEDEF = + SHLIBDEF = + + SHLIBLDFLAGS = -G -z text -M mapfile + + PICFLAGS = -Kpic + + CXXPICFLAGS = -K PIC + + PROTO_DEFINES = + + INSTPGMFLAGS = + + INSTBINFLAGS = -m 0755 + INSTUIDFLAGS = -m 4755 + INSTLIBFLAGS = -m 0644 + INSTINCFLAGS = -m 0644 + INSTMANFLAGS = -m 0444 + INSTDATFLAGS = -m 0444 + INSTKMEMFLAGS = -g sys -m 2755 + + PROJECTROOT = /usr/openwin + + TOP_INCLUDES = -I$(INCROOT) + + CDEBUGFLAGS = -g + CCOPTIONS = -Xc -xF -xcg92 + + ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) + LDPRELIB = -L$(USRLIBDIR) + LDPOSTLIB = + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) + CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB) + + LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + + CCENVSETUP = LD_RUN_PATH=$(USRLIBDIR) + CCLINK = $(CCENVSETUP) $(CC) + + CXXENVSETUP = LD_RUN_PATH=$(USRLIBDIR) + CXXLINK = $(CXXENVSETUP) $(CXX) + + LDSTRIPFLAGS = -x + LDCOMBINEFLAGS = -r + DEPENDFLAGS = + + MACROFILE = sun.cf + RM_CMD = $(RM) + + IMAKE_DEFINES = + + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) + + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Project.tmpl \ + $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) \ + $(EXTRA_ICONFIGFILES) + +# ----------------------------------------------------------------------- +# X Window System Build Parameters and Rules +# $XConsortium: Project.tmpl,v 1.242 94/04/13 14:58:40 rws Exp $ +# $SunSoft: @(#)Project.tmpl 1.4 12/15/98 10:56:11 $ + +# SUNSOFT SUNSOFT_LOADABLE + +# ----------------------------------------------------------------------- +# X Window System make variables; these need to be coordinated with rules + + BINDIR = /usr/openwin/bin + BUILDINCROOT = $(TOP) + BUILDINCDIR = $(BUILDINCROOT)/X11 + BUILDINCTOP = .. + BUILDLIBDIR = $(TOP)/usrlib + BUILDLIBTOP = .. + INCDIR = $(INCROOT)/X11 + ADMDIR = /usr/adm + LIBDIR = $(USRLIBDIR)/X11 + + FONTDIR = $(LIBDIR)/fonts + XINITDIR = $(LIBDIR)/xinit + XDMDIR = $(LIBDIR)/xdm + TWMDIR = $(LIBDIR)/twm + NLSDIR = $(LIBDIR)/nls + XLOCALEDIR = $(PROJECTROOT)/lib/locale + PEXAPIDIR = $(LIBDIR)/PEX + XAPPLOADDIR = $(LIBDIR)/app-defaults + FONTCFLAGS = -t + + INSTAPPFLAGS = $(INSTDATFLAGS) + + RGB = rgb + FONTC = bdftopcf + MKFONTDIR = mkfontdir + + DOCUTILSRC = $(TOP)/doc/util + XDOCMACROS = $(DOCUTILSRC)/macros.t + XIDXMACROS = $(DOCUTILSRC)/indexmacros.t + PROGRAMSRC = $(TOP)/programs + LIBSRC = $(TOP)/lib + FONTSRC = $(TOP)/fonts + INCLUDESRC = $(TOP)/X11 + SERVERSRC = $(TOP)/programs/Xserver + CONTRIBSRC = $(TOP)/../contrib + UNSUPPORTEDSRC = $(TOP)/unsupported + DOCSRC = $(TOP)/doc + RGBSRC = $(TOP)/programs/rgb + BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf + MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir + FONTSERVERSRC = $(PROGRAMSRC)/xfs + FONTINCSRC = $(TOP)/include/fonts + EXTINCSRC = $(TOP)/include/extensions + TRANSCOMMSRC = $(LIBSRC)/xtrans + TRANS_INCLUDES = -I$(TRANSCOMMSRC) + +# $XConsortium: sunLib.tmpl,v 1.37 95/05/23 14:31:40 matt Exp $ +# $SunSoft: @(#)sunLib.tmpl 1.2 02/06/97 16:06:36 $ + +# $XConsortium: sv4Lib.tmpl,v 1.19 93/12/03 10:48:36 kaleb Exp $ +# $SunSoft: @(#)sv4Lib.tmpl 1.1 01/13/97 16:16:29 $ + +XMULIBONLY = -lXmu -lm +XMULIB = -lXmu -lm + + SERVERLIB = /usr/openwin/server/lib + + SERVERMODULES = /usr/openwin/server/modules + + SERVERETC = /usr/openwin/server/etc + +SHLIBLDFLAGS = -G -z text -M mapfile +PICFLAGS = -Kpic +MAPFILE = mapfile + + XLIBSRC = $(LIBSRC)/X11 + +SOXLIBREV = 4 +DEPXONLYLIB = +XONLYLIB = -lX11 + +LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln + + XLIBONLY = $(XONLYLIB) + + XEXTLIBSRC = $(LIBSRC)/Xext + +SOXEXTREV = 0 +DEPEXTENSIONLIB = +EXTENSIONLIB = -lXext + +LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln + +LINTEXTENSIONLIB = $(LINTEXTENSION) + DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) + XLIB = $(EXTENSIONLIB) $(XONLYLIB) + LINTXLIB = $(LINTXONLYLIB) + + XAUTHSRC = $(LIBSRC)/Xau + +DEPXAUTHLIB = $(USRLIBDIR)/libXau.a +XAUTHLIB = -lXau + +LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln + + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + +DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a +XDMCPLIB = -lXdmcp + +LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln + + XMUSRC = $(LIBSRC)/Xmu + +SOXMUREV = 4 +DEPXMULIB = +XMULIB = -lXmu + +LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln + +XMULIB = -lXmu -lm + + XCONFIGSRC = $(LIBSRC)/Xconfig + +SOXCONFIGREV = 0 +DEPXCONFIGLIB = +XCONFIGLIB = -lXconfig + +LINTXCONFIG = $(LINTLIBDIR)/llib-lXconfig.ln + + DGASRC = $(LIBSRC)/dga + +SODGAREV = 1 +DEPDGASRCLIB = +DGASRCLIB = -ldga + +LINTDGASRC = $(LINTLIBDIR)/llib-ldga.ln + + MISRC = $(SERVERSRC)/mi + +SOMIREV = 1 +DEPMILIB = +MILIB = -lmi + +LINTMI = $(LINTLIBDIR)/llib-lmi.ln + + MFBSRC = $(SERVERSRC)/mfb + +SOMFBREV = 1 +DEPMFBLIB = +MFBLIB = -lmfb + +LINTMFB = $(LINTLIBDIR)/llib-lmfb.ln + + CFBSRC = $(SERVERSRC)/cfb + +SOCFBREV = 1 +DEPCFBLIB = +CFBLIB = -lcfb + +LINTCFB = $(LINTLIBDIR)/llib-lcfb.ln + + OLDXLIBSRC = $(LIBSRC)/oldX + +SOOLDXREV = 6 +DEPOLDXLIB = +OLDXLIB = -loldX + +LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln + + TOOLKITSRC = $(LIBSRC)/Xt + +SOXTREV = 4 +DEPXTOOLONLYLIB = +XTOOLONLYLIB = -lXt + +LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln + + DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) + XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) + LINTXTOOLLIB = $(LINTXTOOLONLYLIB) + + AWIDGETSRC = $(LIBSRC)/Xaw + +SOXAWREV = 5 +DEPXAWLIB = +XAWLIB = -lXaw + +LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln + + XTFSRC = $(TOP)/workInProgress/Xtf + +SOXTFREV = 0.7 +DEPXTFLIB = +XTFLIB = -lXtf + +LINTXTF = $(LINTLIBDIR)/llib-lXtf.ln + + FRESCOSRC = $(TOP)/workInProgress/Fresco + +SOFRESCOREV = 0.7 +DEPFRESCOLIB = +FRESCOLIB = -lFresco + +LINTFRESCO = $(LINTLIBDIR)/llib-lFresco.ln + + XILIBSRC = $(LIBSRC)/Xi + +SOXINPUTREV = 5 +DEPXILIB = +XILIB = -lXi + +LINTXI = $(LINTLIBDIR)/llib-lXi.ln + + XTESTLIBSRC = $(LIBSRC)/Xtst + +SOXTESTREV = 1 +DEPXTESTLIB = +XTESTLIB = -lXtst + +LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln + + PEXLIBSRC = $(LIBSRC)/PEX5 + +SOPEXREV = 6 +DEPPEXLIB = +PEXLIB = -lPEX5 + +LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln + +SODPSREV = 5 +SOSERVERDPSREV = 5 + + DPSLIBSRC = $(LIBSRC)/DPS + +SODPSREV = 5 +DEPDPSLIB = +DPSLIB = -lDPS + +LINTDPS = $(LINTLIBDIR)/llib-lDPS.ln + + XIELIBSRC = $(LIBSRC)/XIE + +SOXIEREV = 6 +DEPXIELIB = +XIELIB = -lXIE + +LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln + + PHIGSLIBSRC = $(LIBSRC)/PHIGS + +DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a +PHIGSLIB = -lphigs + +LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln + +DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a +XBSDLIB = -lXbsd + +LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln + + ICESRC = $(LIBSRC)/ICE + +SOICEREV = 6 +DEPICELIB = +ICELIB = -lICE + +LINTICE = $(LINTLIBDIR)/llib-lICE.ln + + SMSRC = $(LIBSRC)/SM + +SOSMREV = 6 +DEPSMLIB = +SMLIB = -lSM + +LINTSM = $(LINTLIBDIR)/llib-lSM.ln + + FSLIBSRC = $(LIBSRC)/FS + +SOFSREV = 5 +DEPFSLIB = +FSLIB = -lFS + +LINTFS = $(LINTLIBDIR)/llib-lFS.ln + + FONTLIBSRC = $(LIBSRC)/font + +DEPFONTLIB = $(USRLIBDIR)/libfont.a +FONTLIB = -lfont + +LINTFONT = $(LINTLIBDIR)/llib-lfont.ln + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + + DEPLIBS1 = $(DEPLIBS) + DEPLIBS2 = $(DEPLIBS) + DEPLIBS3 = $(DEPLIBS) + + CONFIGDIR = $(LIBDIR)/config + +# ----------------------------------------------------------------------- +# start of Imakefile + +# $XConsortium: Imakefile,v 1.13 91/07/17 00:48:25 gildea Exp $ + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB) + SYS_LIBRARIES = -lm + + CDEBUGFLAGS = -g + XAWLIB = -lXaw3d # set to Xaw3d for 3d look + LOCAL_LDFLAGS = -L../../lib + EXTRA_INCLUDES = -I../../include + OBMLIBS = -lobm -lXpm + MATHLIB = -lm + DEPOBM = ../libobm.a + SRCS = listres.c AllWidgets.c + OBJS = listres.o AllWidgets.o + +all:: listres + +listres: $(OBJS) ${DEPOBM} + $(RM) $@ + $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) ${OBMLIBS} $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XLIB) $(LDLIBS) $(MATHLIB) $(EXTRA_LOAD_FLAGS) + +clean:: + $(RM) listres + +${DEPOBM}: + +# ----------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +.c.i: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ + +emptyrule:: + +clean:: + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +man_keywords:: + catman -M $(DESTDIR)$(MANPATH) -w + +# ---------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +depend:: + +# ----------------------------------------------------------------------- +# dependencies generated by makedepend + diff --git a/vendor/x11iraf/obm/listres/README b/vendor/x11iraf/obm/listres/README new file mode 100644 index 00000000..eb1f7fcd --- /dev/null +++ b/vendor/x11iraf/obm/listres/README @@ -0,0 +1,29 @@ +LISTRES -- This version of listres includes not only the standard Xt and Xaw +widgets, but also the Xaw3d widgets and any custom widgets included in ObmW. + + +Recipe for updating OBM to include new widget resources. + +1. For each widget &: + + echo ""; echo &; listres -format "%s %s %s %s" & + +2. Edit output and delete header lines. Prepend the widget class name to +the start of each resources line for that widget, e.g. + + Panner Core height Height Dimension + +3. Reorder the columns + + 1,$s!\(.*\) \(.*\) \(.*\) \(.*\) \(.*\)!\3 \5 \1! + +4. Sort + + 1,$!sort | uniq + +5. Reformat into form needed by obmres.c + + 1,$s!\(.*\) \(.*\) \(.*\)! { "\1", "\2", \3 },! + +6. Edit obmres.c to include new entries. Sort resource list and edit class +codes as necessary. These must agree with the definitions in ObmP.h. diff --git a/vendor/x11iraf/obm/listres/listres.c b/vendor/x11iraf/obm/listres/listres.c new file mode 100644 index 00000000..1586c1c1 --- /dev/null +++ b/vendor/x11iraf/obm/listres/listres.c @@ -0,0 +1,302 @@ +/* + * $XConsortium: listres.c,v 1.31 91/02/16 18:30:40 dave Exp $ + * + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#include <stdio.h> +#include <X11/Xos.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/Xaw/Cardinals.h> +#include <X11/Core.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xmu/WidgetNode.h> +#include <X11/Xaw/AllWidgets.h> + +#define widget_list XawWidgetArray /* or motif or ol or ... */ +#define nwidgets XawWidgetCount + +/* Compatibility hacks. */ +#ifdef AUX +void *memmove(a,b,n) void *a; const void *b; size_t n; { bcopy(b,a,n); } +#else +#if defined(sun) && (!defined(SYSV)) +void *memmove(a,b,n) void *a, *b; int n; { bcopy(b,a,n); } +#endif +#endif + +static XrmOptionDescRec Options[] = { + { "-top", "*topObject", XrmoptionSepArg, (caddr_t) NULL }, + { "-format", "*resourceFormat", XrmoptionSepArg, (caddr_t) NULL }, + { "-tree", "*showTree", XrmoptionNoArg, (caddr_t) "on" }, + { "-nosuper", "*showSuper", XrmoptionNoArg, (caddr_t) "off" }, + { "-variable", "*showVariable", XrmoptionNoArg, (caddr_t) "on" }, +}; + +typedef struct { + Boolean show_tree; + Boolean show_all; + Boolean show_variable; + Boolean show_superclass; + char *top_object; + char *format; + } OptionsRec; + +OptionsRec options; + +#define Offset(field) XtOffsetOf(OptionsRec, field) + +static XtResource Resources[] = { + { "showTree", "ShowTree", XtRBoolean, sizeof(Boolean), + Offset(show_tree), XtRImmediate, (XtPointer) FALSE }, + { "showSuper", "ShowSuper", XtRBoolean, sizeof(Boolean), + Offset(show_superclass), XtRImmediate, (caddr_t) TRUE }, + { "showVariable", "ShowVariable", XtRBoolean, sizeof(Boolean), + Offset(show_variable), XtRImmediate, (caddr_t) FALSE }, + { "topObject", "TopObject", XtRString, sizeof(char *), + Offset(top_object), XtRString, (caddr_t) "core" }, + { "resourceFormat", "ResourceFormat", XtRString, sizeof(char *), + Offset(format), XtRString, (caddr_t) " %-16s %20s %-20s %s" }, +}; + +#undef Offset + +char *ProgramName; + +usage () +{ + fprintf(stderr, "usage: %s [-options...]\n", ProgramName); + fprintf(stderr, "\nwhere options include:\n"); + fprintf(stderr, + " -all list all known widget and object classes\n"); + fprintf(stderr, + " -tree list all widgets and objects in a tree\n"); + fprintf(stderr, + " -nosuper do not print superclass resources\n"); + fprintf(stderr, + " -variable show variable name instead of class name\n"); + fprintf(stderr, + " -top name object to be top of tree\n"); + fprintf(stderr, + " -format string printf format for instance, class, type\n"); + fprintf(stderr, "\n"); + exit (1); +} + +static void print_tree_level (wn, level) + register XmuWidgetNode *wn; + register int level; +{ + register int i; + + if (!wn) return; + + for (i = 0; i < level; i++) { + putchar (' '); putchar (' '); + } + printf ("%d: %s/%s\n", level, wn->label, XmuWnClassname(wn)); + print_tree_level (wn->children, level + 1); + print_tree_level (wn->siblings, level); +} + +static void tree_known_widgets () +{ + register int i; + register XmuWidgetNode *wn; + + for (i = 0, wn = widget_list; i < nwidgets; i++, wn++) { + if (!wn->superclass) { /* list all rooted objects */ + print_tree_level (wn, 0); + } + } +} + + +/* + * print_classname - print out the superclass-to-subclass hierchy of names + * in the form super\sub\sub.... + */ +static int print_classname (node, topnode, level, showvar) + XmuWidgetNode *node, *topnode; + int level; + Bool showvar; +{ + int retval; + + if (node && node != topnode) { + retval = print_classname (node->superclass, topnode, level + 1, + showvar); + } else { + retval = level - 1; + } + if (node) + printf ("%s%s", showvar ? node->label : XmuWnClassname(node), + level ? "\\" : ""); + + return retval; +} + +static void list_known_widgets () +{ + int i; + XmuWidgetNode *wn; + int width = 0; + char format[20]; + + for (i = 0, wn = widget_list; i < nwidgets; i++, wn++) { + int l = strlen (wn->label); + if (l > width) width = l; + } + sprintf (format, "%%-%ds ", width); + for (i = 0, wn = widget_list; i < nwidgets; i++, wn++) { + printf (format, wn->label); + print_classname (wn, (XmuWidgetNode *) NULL, 0, False); + putchar ('\n'); + } +} + +/* ARGSUSED */ +static void print_resources (node, format, topnode, showsuper, showvar) + XmuWidgetNode *node; + char *format; + XmuWidgetNode *topnode; + Bool showsuper; + Bool showvar; +{ + int i; + XtResourceList res = node->resources; + XmuWidgetNode **wn = node->resourcewn; + + for (i = 0; i < node->nresources; i++, res++, wn++) { + if (!showsuper && *wn != node) continue; + printf (format, showvar ? (*wn)->label : XmuWnClassname(*wn), + res->resource_name, res->resource_class, res->resource_type); + putchar ('\n'); + } + if (node->nconstraints > 0) { + printf (format, "----", "----", "----", "----"); + putchar ('\n'); + } + res = node->constraints; + wn = node->constraintwn; + for (i = 0; i < node->nconstraints; i++, res++, wn++) { + if (!showsuper && *wn != node) continue; + printf (format, showvar ? (*wn)->label : XmuWnClassname(*wn), + res->resource_name, res->resource_class, res->resource_type); + putchar ('\n'); + } + return; +} + + +/* + * list_resources - display resources of a widget, identifying class from + * which they come + */ +static list_resources (node, format, topnode, toplevel, showsuper, showvar) + XmuWidgetNode *node; + char *format; + XmuWidgetNode *topnode; + Widget toplevel; + Bool showsuper; + Bool showvar; +{ + static Bool first = True; + + XmuWnFetchResources (node, toplevel, topnode); + if (first) { + printf (format, showvar ? "Variable" : "WidgetClass", + "Instance", "Class", "Type"); + putchar ('\n'); + printf (format, showvar ? "--------" : "-----------", + "--------", "-----", "----"); + putchar ('\n'); + first = False; + } + printf ("%s: ", node->label); + print_classname (node, topnode, 0, showvar); + putchar ('\n'); + print_resources (node, format, topnode, showsuper, showvar); + putchar ('\n'); +} + + +main (argc, argv) + int argc; + char **argv; +{ + int i; + XtAppContext appcon; + XmuWidgetNode *topnode; + Widget toplevel, container; + + ProgramName = argv[0]; + + toplevel = XtAppInitialize (&appcon, "Listres", Options, XtNumber(Options), + &argc, argv, NULL, NULL, 0); + container = XtCreateWidget ("dummy", widgetClass, toplevel, NULL, ZERO); + + XtGetApplicationResources (toplevel, (caddr_t) &options, + Resources, XtNumber(Resources), NULL, ZERO); + XmuWnInitializeNodes (widget_list, nwidgets); + if (argc == 1) { + if (options.show_tree) { + tree_known_widgets(); + } else { + list_known_widgets(); + } + exit (0); + } + + topnode = XmuWnNameToNode (widget_list, nwidgets, options.top_object); + argc--, argv++; /* skip command */ + + if (argc > 0 && argv[0][0] == '-') { + int len = strlen (argv[0]); + if (len >= 2 && strncmp(argv[0], "-all", len) == 0) { + XmuWidgetNode *wn; + for (i = 0, wn = widget_list; i < nwidgets; i++, wn++) { + list_resources (wn, options.format, topnode, container, + (Bool) options.show_superclass, + (Bool) options.show_variable); + } + } else + usage(); + } else { + for (; argc > 0; argc--, argv++) { + XmuWidgetNode *node; + + if (argv[0][0] == '-') usage (); + node = XmuWnNameToNode (widget_list, nwidgets, *argv); + if (!node) { + fprintf (stderr, "%s: unable to find widget \"%s\"\n", + ProgramName, *argv); + continue; + } + list_resources (node, options.format, topnode, container, + (Bool) options.show_superclass, + (Bool) options.show_variable); + } + } + exit (0); +} diff --git a/vendor/x11iraf/obm/listres/listres.man b/vendor/x11iraf/obm/listres/listres.man new file mode 100644 index 00000000..a57b51f8 --- /dev/null +++ b/vendor/x11iraf/obm/listres/listres.man @@ -0,0 +1,54 @@ +.TH LISTRES 1 "Release 5" "X Version 11" +.SH NAME +listres - list resources in widgets +.SH SYNOPSIS +.B "listres" +[-option ...] +.SH DESCRIPTION +.PP +The \fIlistres\fP program generates a list of a widget's resource database. +The class in which each resource is first defined, the instance and class +name, and the type of each resource is listed. If no specific widgets +or the \fI-all\fP switch are given, a two-column list of widget names and +their class hierarchies is printed. +.SH OPTIONS +\fIListres\fP accepts all of the standard toolkit command line options along +with those listed below: +.TP 8 +.B \-all +This option indicates that \fIlistres\fP should print information for all +known widgets and objects. +.TP 8 +.B \-nosuper +This option indicates that resources that are inherited from a superclass +should not be listed. This is useful for determining which resources are +new to a subclass. +.TP 8 +.B \-variable +This option indicates that widgets should be identified by the names of the +class record variables rather than the class name given in the variable. This +is useful for distinguishing subclasses that have the same class name as their +superclasses. +.TP 8 +.B \-top \fIname\fP +This option specifies the name of the widget to be treated as the top of the +hierarchy. Case is not significant, and the name may match either the class +variable name or the class name. The default is ``core''. +.TP 8 +.B \-format \fIprintf\-string\fP +This option specifies the \fIprintf\fP-style format string to be used to print +out the name, instance, class, and type of each resource. +.SH "X DEFAULTS" +To be written. +.SH "SEE ALSO" +X(1), xrdb(1), appropriate widget documents +.SH "BUGS" +On operating systems that do not support dynamic linking of run-time routines, +this program must have all of its known widgets compiled in. The sources +provide several tools for automating this process for various widget sets. +.SH COPYRIGHT +Copyright 1989, Massachusetts Institute of Technology. +.br +See \fIX(1)\fP for a full statement of rights and permissions. +.SH AUTHOR +Jim Fulton, MIT X Consortium diff --git a/vendor/x11iraf/obm/marker.c b/vendor/x11iraf/obm/marker.c new file mode 100644 index 00000000..82b5cee3 --- /dev/null +++ b/vendor/x11iraf/obm/marker.c @@ -0,0 +1,1869 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ctype.h> +#include <ObmP.h> +#include "widget.h" + +/* + * Graphics Marker class (a base class, requires a parent Gterm widget). + * -------------------------------------------------------------------------- + * A marker is a graphics object implemented by the Gterm-Image widget. + * Markers are not real toolkit widgets, but they act much like widgets and + * are interfaced as an object class under the Object Manager. The Marker + * class is not a subclass, it is a base class like Widget, but Marker objects + * can exist only as children of Gterm widgets. + * + * Since markers are not independent widgets but rather part of a Gterm widget + * instance, the parent Gterm widget is partially responsible for managing + * markers. The Gterm widget implements the following commands for dealing + * with markers. + * + * createMarker name [attribute-list] + * markerInit + * + * A new marker is created by sending the createMarker message to the parent + * gterm widget. This creates a marker of the given name and type. + * The markerInit command, if sent to a gterm widget, destroys any markers + * defined for that widget and reinitializes the marker facility. Markers + * may also be created by action procedures in response to user input events. + * + * A marker may be destroyed by itself in response to an input event (e.g. the + * user presses the delete key), by sending the marker the destroy message + * to tell it to destroy itself, by sending a markerInit to the parent gterm + * widget, or by destroying the marker object (or any parent) with the server + * command destroyObject. + * + * Once a marker has been created it behaves as an independent object and + * receives and executes messages, responds to events, generates callbacks, + * and so on. The marker class defines the following commands. + * + * makeCopy name + * addCallback procedure [event [event ...]] + * deleteCallback procedure + * notify [event-type [param [param ...]]] + * destroy [nocallback] + * + * markpos + * redraw [function] [markpos|nomarkpos] [erase|noerase] + * + * raise [reference-marker] + * lower [reference-marker] + * + * move x y + * resize width height + * rotate angle # radians + * + * set attribute value # alias for setAttribute + * value = get attribute + * + * setAttribute attribute value + * value = getAttribute attribute + * setAttributes attribute-list + * getAttributes attribute-list + * setVertices points first npts + * getVertices points first npts + * + * region = getRegion [unmap] [coord-type] + * getRect type dx dy dnx dny + * + * Marker positions and dimensions are given in window (raster 0) pixel + * coordinates. NDC (raster normalized) coordinates are not supported for + * markers, except in the unmap option of getRegion which can return a marker + * description in the raster coordinate system of the raster the marker is in. + * + * The operators raise, lower, move, resize, and rotate erase the marker, + * modify it as indicated, and redraw it with the new attributes. For finer + * control over marker attributes one can use [get|set]Attribute[s] and + * [get|set]Vertices to edit the markers directly. In this case an auto + * redraw is not performed (unless the autoRedraw marker attribute is set). + * The usual sequence is a markpos to record the marker position, one or more + * setAttribute calls to change marker attributes, then a redraw to erase + * the old marker and redraw the new one. Markers have many attributes which + * can be set to control things like the position and size, colors, line + * widths, fill type and style, font, rubber-band technique, and so on. + * Refer to <ObmW/Gterm.h> for a list of marker types and attributes. + * + * The marker type may be changed at runtime without destroying the marker. + * For example a circle can be changed to an ellipse or a rectangle. This + * also works for polygons (the vertex list is preserved and restored when + * the marker is changed back to a polygon). + * + * The current shape of a marker may be queried with getVertices, which + * returns the polygon or polyline vertex list in window coordinates. A more + * powerful routine which does something similar is getRegion. This routine + * returns a high level description of the region outlined by the marker, + * giving the marker type (rectangle, circle, ellipse etc.), center, width + * and height, and so on. Any position or dimension information may + * optionally be transformed back to the original source raster, if the marker + * center is in a region of the window which is the destination of an active + * mapping. The unmap option will follow multiple mappings back to the + * original mapped source raster. + * + * The getRect function returns a rect (x y width height) describing either + * the rectangular region enclosed by a marker, or the rect defining the + * marker boundary. This works for any marker but is not likely to be useful + * for other than nonrotated rectangular markers. For example, the enclosed + * rect returned may be used in a setMapping call to map a raster into the + * interior of a marker. + */ + +#define MAX_POLYPTS 4096 + +typedef struct { + ObmContext obm; /* object manager */ + ObmObject pobj; /* parent object */ + Widget gt; /* gterm widget */ + XtPointer gm; /* marker */ + ObmCallback callback; /* callback list */ +} markerPrivate, *MarkerPrivate; + +typedef struct { + struct obmObjectCore core; + markerPrivate marker; +} markerObject, *MarkerObject; + +static void MarkerDestroy(); +static void MarkerClassDestroy(); +static ObmObject MarkerCreate(); +static int MarkerEvaluate(); +static int markerDestroyCallback(); +static int markerFocusCallback(); + +static int markerMakeCopy(), markerAddCallback(); +static int markerDeleteCallback(), markerCallbackProc(); +static int markerNotify(), markerDestroy(), markerMarkpos(), markerRedraw(); +static int markerRaise(), markerLower(), markerMove(), markerResize(); +static int markerRotate(), markerGetAttribute(), markerSetAttribute(); +static int markerGetAttributes(), markerSetAttributes(); +static int markerGetVertices(), markerSetVertices(); +static int markerGetRegion(), markerGetRect(); + +extern XtPointer GmCreate(), GmCopy(); +extern double strtod(); + + +/* MarkerClassInit -- Initialize the class record for the marker widget class. + */ +void +MarkerClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register MsgContext msg; + register Tcl_Interp *tcl; + + /* Install the class methods. */ + classrec->ClassDestroy = MarkerClassDestroy; + classrec->Create = (ObmFunc) MarkerCreate; + classrec->Destroy = MarkerDestroy; + classrec->Evaluate = MarkerEvaluate; + + /* The marker widget subclass has its own command set hence has its + * own interpreter. The widget will respond both to all the commands + * defined here, and to all the commands implemented by the base + * Widget class. + */ + if (!classrec->class_data) { + msg = (MsgContext) XtMalloc (sizeof (struct msgContext)); + msg->tcl = tcl = Tcl_CreateInterp(); + classrec->class_data = (XtPointer) msg; + msg->level = 0; + + Tcl_CreateCommand (tcl, + "makeCopy", markerMakeCopy, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "addCallback", markerAddCallback, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "deleteCallback", markerDeleteCallback, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "callbackProc", markerCallbackProc, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "notify", markerNotify, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "destroy", markerDestroy, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "markpos", markerMarkpos, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "redraw", markerRedraw, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "raise", markerRaise, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "lower", markerLower, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "move", markerMove, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "resize", markerResize, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "rotate", markerRotate, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "set", markerSetAttribute, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "get", markerGetAttribute, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setAttribute", markerSetAttribute, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getAttribute", markerGetAttribute, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setAttributes", markerSetAttributes, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getAttributes", markerGetAttributes, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setVertices", markerSetVertices, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getVertices", markerGetVertices, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getRegion", markerGetRegion, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getRect", markerGetRect, (ClientData)msg, NULL); + } +} + + +/* MarkerClassDestroy -- Custom destroy procedure for the widget class. + */ +static void +MarkerClassDestroy (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register MsgContext msg = (MsgContext) classrec->class_data; + + if (msg) { + if (msg->tcl) + Tcl_DeleteInterp (msg->tcl); + XtFree ((char *)msg); + classrec->class_data = NULL; + } +} + + +/* MarkerCreate -- Create a new instance of a marker object. + */ +static ObmObject +MarkerCreate (obm, name, classrec, parent, args, nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList args; +int nargs; +{ + register MarkerObject obj; + register Widget gt; + ObmObject gterm_obj; + int type, interactive; + int erase, visible, i; + XtPointer marker, gm; + + /* Get descriptor. */ + if ((gterm_obj = obmFindObject (obm, parent)) == NULL) + return (NULL); + obj = (MarkerObject) XtCalloc (1, sizeof(markerObject)); + if (obj == NULL) + return (NULL); + + /* Examine the marker attribute list to determine if we are + * building an object around a marker that has already been created, + * or if we are creating a new marker, the marker type and create mode. + */ + type = Gm_Rectangle; + interactive = 0; + visible = 0; + marker = NULL; + + for (i=0; i < nargs; i++) { + Arg *ap = &args[i]; + int ch; + + if (strcmp (ap->name, "marker") == 0) + marker = (XtPointer)ap->value; + else if (strcmp (ap->name, "createMode") == 0) + interactive = (strcmp ((char *)ap->value, "interactive") == 0); + else if (strcmp (ap->name, "visible") == 0) + visible = ((ch = *(char *)ap->value) == 'T' || ch == 't'); + else if (strcmp (ap->name, "type") == 0) { + if (!(type = GmStrToType ((char *)ap->value))) + type = Gm_Rectangle; + } + } + + /* Create the marker. */ + if (marker) + gm = marker; + else { + gt = widgetGetPointer (gterm_obj); + if ((gm = GmCreate (gt, type, interactive)) == NULL) { + XtFree ((char *)obj); + return (NULL); + } + } + + /* Set any marker attributes. */ + for (i=0; i < nargs; i++) { + Arg *ap = &args[i]; + if (strcmp (ap->name, "marker") != 0 && + strcmp (ap->name, "createMode") != 0 && + strcmp (ap->name, "type") != 0) + GmSetAttribute (gm, ap->name, ap->value, XtRString); + } + + /* Initialize descriptor. */ + obj->marker.obm = obm; + obj->marker.pobj = gterm_obj; + obj->marker.gt = gt; + obj->marker.gm = gm; + + /* Define focusin and focusout callbacks to keep track of the + * marker state. + */ + GmAddCallback (gm, GmEvFocusIn|GmEvFocusOut, + markerFocusCallback, (XtPointer) obj); + + /* Define a destroy callback to automatically free the Marker object + * when a marker is destroyed at the Gterm widget level. + */ + GmAddCallback (gm, GmEvDestroy, + markerDestroyCallback, (XtPointer) obj); + + if (!interactive && visible) + GmRedraw (gm, GXcopy, erase=True); + + return ((ObmObject) obj); +} + + +/* MarkerDestroy -- Destroy an instance of a marker object. + */ +static void +MarkerDestroy (object) +ObmObject object; +{ + MarkerObject obj = (MarkerObject) object; + register ObmContext obm = obj->marker.obm; + register ObmCallback cb, next; + + /* Destroy the object in the second final call to Destroy. */ + if (!obj->core.being_destroyed++) + return; + + /* When a marker is destroyed at the widget level or by sending a + * marker object the destroy message, GmDestroy is called. + * This in turn calls the Marker destroy callback which does an OBM + * Object destroy which calls the class procedure MarkerDestroy + * (this procedure) which calls GmDestroy again below. The second + * GmDestroy will find that a destroy operation is already in progress + * and return immediately. Hence, no matter how a Gterm marker is + * destroyed we end up destroying the associated OBM Marker as well. + */ + if (obj->marker.gm) + GmDestroy (obj->marker.gm); + + /* Free any callback descriptors. */ + for (cb = obj->marker.callback; cb; cb = next) { + next = cb->next; + XtFree ((char *)cb); + } +} + + +/* MarkerEvaluate -- Evaluate a marker command or message. + */ +static int +MarkerEvaluate (object, command) +ObmObject object; +char *command; +{ + register MarkerObject obj = (MarkerObject) object; + register MsgContext msg = (MsgContext) obj->core.classrec->class_data; + register ObmContext obm = obj->marker.obm; + int status; + + /* Since the class wide interpreter is used to evaluate the message + * we can't pass the object descriptor directly to the class procedure + * referenced in the message. Instead we pass the object reference + * in the message descriptor. + */ + Tcl_SetResult (obm->tcl, "", TCL_VOLATILE); + msg->object[++msg->level] = object; + + if (!obmClientCommand (msg->tcl, command)) { + Tcl_SetResult (obm->tcl, "invalid command", TCL_VOLATILE); + status = TCL_ERROR; + } else { + status = Tcl_Eval (msg->tcl, command); + if (status == TCL_ERROR) { + if (*msg->tcl->result) + Tcl_SetResult (obm->tcl, msg->tcl->result, TCL_VOLATILE); + else { + /* Supply a default error message if none was returned. */ + Tcl_SetResult (obm->tcl, "evaluation error", TCL_VOLATILE); + } + obm->tcl->errorLine = msg->tcl->errorLine; + + } else if (*msg->tcl->result) + Tcl_SetResult (obm->tcl, msg->tcl->result, TCL_VOLATILE); + } + + msg->level--; + return (status); +} + + +/* + * MARKER class commands. + * ----------------------- + */ + + +/* makeCopy -- Copy a marker. The new marker is initially identical to the + * old one, and will not be distinct until, e.g., moved to a new center. + * + * Usage: makeCopy name + */ +static int +markerMakeCopy (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + XtPointer gm; + Arg args[10]; + char *name; + + if (argc < 2) + return (TCL_ERROR); + + name = argv[1]; + gm = GmCopy (mp->gm); + + XtSetArg (args[0], "marker", gm); + obmNewObject (obm, name, "Marker", mp->pobj->core.name, args, 1); + + return (TCL_OK); +} + + +/* addCallback -- Post a marker callback to be called when the specified + * event or events occurs. If no events are listed a Notify callback will + * be posted. + * + * Usage: addCallback procedure [event [event ...]] + */ +static int +markerAddCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + ObmContext obm = mp->obm; + register ObmCallback cb, new_cb; + char *procedure; + int events=0, i; + + if (argc < 2) + return (TCL_ERROR); + + procedure = argv[1]; + if (argc > 2) { + for (i=2; i < argc; i++) + events |= GmStrToEvent(argv[i]); + } else + events = GmEvNotify; + + /* Create callback record. */ + new_cb = (ObmCallback) XtCalloc (1, sizeof (obmCallback)); + new_cb->u.obj = (ObmObject) obj; + new_cb->callback_type = events; + strncpy (new_cb->name, procedure, SZ_NAME); + + /* Add new callback to the tail of callback list minus one, with the + * markerDestroyCallback at the very tail of this list. This is + * necessary because we don't want to physically destroy the marker + * object until all marker object Destroy callbacks have been + * processed. + */ + if (mp->callback) { + for (cb = mp->callback; cb->next; cb = cb->next) + ; + cb->next = new_cb; + } else + mp->callback = new_cb; + + GmDeleteCallback (mp->gm, markerDestroyCallback, (XtPointer) obj); + GmAddCallback (mp->gm, events, markerCallbackProc, (XtPointer) new_cb); + GmAddCallback (mp->gm, GmEvDestroy, markerDestroyCallback, + (XtPointer) obj); + + return (TCL_OK); +} + + +/* deleteCallback -- Delete a marker callback. + * + * Usage: deleteCallback procedure + */ +static int +markerDeleteCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmCallback cb, prev; + char *procedure; + + if (argc < 2) + return (TCL_ERROR); + procedure = argv[1]; + + /* Locate and delete procedure entry in callback list. */ + for (prev=NULL, cb=mp->callback; cb; prev=cb, cb=cb->next) + if (strcmp (cb->name, procedure) == 0) { + if (prev) + prev->next = cb->next; + else + mp->callback = cb->next; + GmDeleteCallback (mp->gm, markerCallbackProc, cb); + XtFree ((char *)cb); + break; + } + + return (TCL_OK); +} + + +/* markerCallbackProc -- Low level callback procedure, called by the Gterm + * marker code when a marker event occurs. + */ +static int +markerCallbackProc (cb, gm, events, event, params, nparams) +register ObmCallback cb; +XtPointer gm; +int events; +XEvent *event; +String *params; +Cardinal nparams; +{ + MarkerObject obj = (MarkerObject) cb->u.obj; + MarkerPrivate mp = &obj->marker; + ObmContext obm = mp->obm; + char message_data[SZ_MESSAGE]; + register char *op; + int status = 0; + + /* Call the user callback procedure. The callback procedure is called + * with the arguments "marker-name event-type event-data", where + * event-data is a Tcl list (delimited by braces) of data strings + * describing the event. + */ + + if (events & GmEvNotify) { + /* Callback: marker-name notify {} + */ + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "notify", " ", + "{}", + NULL); + } + + if (events & GmEvMoveResize) { + /* Callback: marker-name moveResize {x y width height} + */ + if (nparams >= 4) { + sprintf (message_data, "%s %s %s %s", + params[0], params[1], params[2], params[3]); + } else + strcpy (message_data, "0 0 0 0"); + + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "moveResize", " ", + "{", message_data, "}", + NULL); + } + + if (events & GmEvModify) { + /* Callback: marker-name modify {attribute-name} + */ + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "modify", " ", + "{", nparams ? params[0] : "unknown", "}", + NULL); + } + + if (events & GmEvRedraw) { + /* Callback: marker-name redraw {} + */ + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "redraw", " ", + "{}", + NULL); + } + + if (events & GmEvDestroy) { + /* Callback: marker-name destroy {} + */ + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "destroy", " ", + "{}", + NULL); + } + + if (events & GmEvInput) { + /* Callback: marker-name input {type data modifiers} + * + * where type is keyPress, keyRelease, buttonPress, or + * buttonRelease, data is the character typed or a digit 1-5 + * identifying the button, and modifier is "shift", "control", + * and so on. Multiple modifiers may be given. + */ + switch (event->type) { + case KeyPress: + case KeyRelease: + { XKeyPressedEvent *ev = (XKeyPressedEvent *) event; + register char *ip, *op = message_data; + char buf[SZ_MESSAGE]; + int n; + + if (event->type == KeyPress) + strcpy (op, "keyPress "); + else + strcpy (op, "keyRelease "); + while (op) + op++; + + if ((n = XLookupString(ev,buf,sizeof(buf),NULL,NULL)) > 0) { + for (ip=buf; --n >= 0; ) + if (*ip <= ' ') { + *op++ = '^'; + *op++ = *ip++ + 'A' - 1; + } else if (isprint (*ip)) { + *op++ = *ip++; + } else + ip++; + } else { + /* This case occurs when only a modifier is typed. */ + for (ip = "??"; *op++ = *ip++; ) + ; + } + *op++ = ' '; + op = widgetEventState (op, ev->state); + while (op > message_data && isspace (*(op-1))) + --op; + *op = '\0'; + } + break; + + case ButtonPress: + case ButtonRelease: + { XButtonPressedEvent *ev = (XButtonPressedEvent *) event; + register char *op = message_data; + + if (event->type == ButtonPress) + strcpy (op, "buttonPress "); + else + strcpy (op, "buttonRelease "); + while (op) + op++; + + sprintf (op, "%d ", ev->button); + while (*op) + op++; + op = widgetEventState (op, ev->state); + while (op > message_data && isspace (*(op-1))) + --op; + *op = '\0'; + } + break; + + default: + strcpy (message_data, "unknown none"); + } + + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "input", " ", + "{", message_data, "}", + NULL); + } + + if (events & GmEvFocusIn) { + /* Callback: marker-name focusIn {} + */ + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "focusIn", " ", + "{}", + NULL); + } + + if (events & GmEvFocusOut) { + /* Callback: marker-name focusOut {} + */ + status |= Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "focusOut", " ", + "{}", + NULL); + } + + /* The constraint callback is a special case because it can modify its + * arguments. The called procedure returns as the function value a + * list of marker attributes with new values for those attributes. + * These are used to modify in place the param strings passed in by + * the widget. + * + * Callback: marker-name constraint { {name oldval newval} ... } + * + * The data field of this callback is a list of marker attributes, + * giving the attribute name, old value, and new value for each + * attribute. The function value returned, if any, should be a list + * of marker attributes giving the attribute name and new value for + * each attribute, e.g. { {name newval} ... }. Only modified new + * values need be returned; if no values are returned, no constraints + * are applied. + */ + if (events & GmEvConstraint) { + Tcl_Interp *tcl = obm->tcl; + char **items, **fields; + int nitems; + int n, i, j; + + op = message_data; + *op++ = '{'; + *op++ = ' '; + + for (i=0; i < nparams; i += 3) { + sprintf (op, "{%s %s %s}", + params[i+0], params[i+1], params[i+2]); + while (*op) + op++; + *op++ = ' '; + } + + *op++ = '}'; + *op++ = '\0'; + + /* Call the client constraint procedure. */ + status |= Tcl_VarEval (tcl, + cb->name, " ", + obj->core.name, " ", + "constraint", " ", + message_data, + NULL); + + /* Process the list of modified values returned by the client. + * This is a list of lists, one for each modified value. + */ + if (*tcl->result && strcmp(tcl->result,"{}") != 0) { + if (Tcl_SplitList(tcl,tcl->result,&nitems,&items) != TCL_OK) + status = ERR; + else { + for (i=0; i < nitems; i++) { + if (Tcl_SplitList(tcl,items[i],&n,&fields) != TCL_OK) { + status = ERR; + continue; + } + if (n > 0) + for (j=0; j < nparams; j += 3) + if (strcmp (fields[0], params[j]) == 0) { + strcpy (params[j+2], fields[1]); + break; + } + free ((char *) fields); + } + } + + free ((char *) items); + } + } + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } + + return (status ? ERR : OK); +} + + +/* notify -- Generate a Marker pseudo-event, causing any posted client + * callback procedures to be called. + * + * Usage: notify [event-type [param [param ...]]] + */ +static int +markerNotify (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + char *event_type; + int first_param; + XEvent event; + + event_type = (argc > 1) ? argv[1] : "notify"; + first_param = (argc > 1) ? 2 : 1; + + GmNotify (mp->gm, GmStrToEvent(event_type), &event, + argv[first_param], max (0, argc - first_param)); + + return (TCL_OK); +} + + +/* destroy -- Destroy a marker. Just tell the marker to destroy itself. + * All cleanup outside the marker facility relies upon the use of callbacks. + * This includes our callback markerDestroyCallback below. + * + * Usage: destroy + */ +static int +markerDestroy (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + + GmDestroy (mp->gm); + return (TCL_OK); +} + + +/* markerDestroyCallback -- Low level callback procedure, called by the + * Gterm widget code when a marker is about to be destroyed. + */ +static int +markerDestroyCallback (obj, gm, events, event, params, nparams) +MarkerObject obj; +XtPointer gm; +int events; +XEvent *event; +String *params; +Cardinal nparams; +{ + MarkerPrivate mp = &obj->marker; + ObmContext obm = mp->obm; + + obmDestroyObject (obm, (ObmObject) obj); + return (0); +} + + +/* markerFocusCallback -- Marker callback procedure, called when a marker + * gets or loses the focus. + */ +static int +markerFocusCallback (obj, gm, events, event, params, nparams) +MarkerObject obj; +XtPointer gm; +int events; +XEvent *event; +String *params; +Cardinal nparams; +{ + MarkerPrivate mp = &obj->marker; + ObmObject gtobj = mp->pobj; + ObmContext obm = mp->obm; + + if (events & GmEvFocusIn) + widget_setTTName (gtobj, obj->core.name); + else if (events & GmEvFocusOut) + widget_setTTName (gtobj, mp->pobj->core.name); + + return (0); +} + + +/* markpos -- Mark the current position of a marker for a later redraw. + * + * Usage: markpos + * + * Markpos is used to mark the position of a marker before changing any + * marker attributes, so that a later "redraw marked" will erase the old + * marker rather than the new one. This is necessary, for example, if any + * marker attributes are changed which affect the size or position of the + * marker. + */ +static int +markerMarkpos (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + int erase; + + GmMarkpos (mp->gm); + + return (TCL_OK); +} + + +/* redraw -- Redraw a marker. + * + * Usage: redraw [function] [erase|noerase] [markpos|nomarkpos] + * + * By default redraw will erase the old marker at the position indicated by + * a previous call to markpos, and redraw the marker with the current + * attributes using the drawing function copy (copy source to destination). + * Hence the usual usage is "markpos ... change marker attributes ... redraw". + * Optional arguments may be given to change the drawing function, enable or + * disable erase, or force redraw to do a markpos. These arguments may be + * given in any order. + * + * The drawing functions are as given in the XLIB documentation, minus the + * "GX" prefix. The most commonly used functions are "copy" and "xor". + * A normal marker redraw uses function=copy. + */ +static int +markerRedraw (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + Boolean markpos = False; + Boolean erase = True; + int function = GXcopy; + int i, v; + char *ap; + + /* Process any optional arguments. */ + for (i=1; i < argc; i++) { + ap = argv[i]; + if (strcmp (ap, "erase") == 0) + erase = True; + else if (strcmp (ap, "noerase") == 0) + erase = False; + else if (strcmp (ap, "markpos") == 0) + markpos = True; + else if (strcmp (ap, "nomarkpos") == 0) + markpos = False; + else if ((v = GmStrToFunction (ap)) > 0) + function = v; + } + + if (markpos) + GmMarkpos (mp->gm); + GmRedraw (mp->gm, function, erase); + + return (TCL_OK); +} + + +/* raise -- Raise a marker, i.e., cause it to be drawn on top of other + * markers when overlapping markers are drawn. + * + * Usage: raise [reference-marker] + * + * In a reference marker is named the marker will raise itself above this + * marker, otherwise the raised marker becomes the topmost marker. + */ +static int +markerRaise (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + XtPointer ref_gm = NULL; + MarkerObject ref; + + if (argc > 1) { + if (ref = (MarkerObject) obmFindObject (obm, argv[1])) + ref_gm = ref->marker.gm; + else + return (TCL_ERROR); + } + + /* This implies an automatic erase and redraw. */ + GmRaise (mp->gm, ref_gm); + + return (TCL_OK); +} + + +/* lower -- Lower a marker, i.e., cause it to be drawn beneath other + * markers when overlapping markers are drawn. + * + * Usage: lower [reference-marker] + * + * In a reference marker is named the marker will lower itself beneath this + * marker, otherwise the lowered marker becomes the lowest marker. + */ +static int +markerLower (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + XtPointer ref_gm = NULL; + MarkerObject ref; + + if (argc > 1) { + if (ref = (MarkerObject) obmFindObject (obm, argv[1])) + ref_gm = ref->marker.gm; + else + return (TCL_ERROR); + } + + /* This implies an automatic erase and redraw. */ + GmLower (mp->gm, ref_gm); + + return (TCL_OK); +} + + +/* move -- Move a marker. + * + * Usage: move x y + * + * Move the marker center to the indicated coordinates in the display window. + */ +static int +markerMove (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + Arg args[10]; + int erase; + + if (argc < 3) + return (TCL_ERROR); + + XtSetArg (args[0], GmX, argv[1]); + XtSetArg (args[1], GmY, argv[2]); + + GmMarkpos (mp->gm); + GmSetAttributes (mp->gm, args, 2, XtRString); + GmRedraw (mp->gm, GXcopy, erase=True); + + return (TCL_OK); +} + + +/* resize -- Resize a marker. + * + * Usage: resize width height + * + * Resize the marker to the indicated size. By default width and height are + * given in pixels. For a text marker one can append "ch" to indicate that + * the units are chars in whatever font is in use, e.g., "40ch" or "40 chars" + * is an acceptable value for a text marker dimension. + */ +static int +markerResize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + Arg args[10]; + int erase; + + if (argc < 3) + return (TCL_ERROR); + + XtSetArg (args[0], GmWidth, argv[1]); + XtSetArg (args[1], GmHeight, argv[2]); + + GmMarkpos (mp->gm); + GmSetAttributes (mp->gm, args, 2, XtRString); + GmRedraw (mp->gm, GXcopy, erase=True); + + return (TCL_OK); +} + + +/* rotate -- Rotate a marker. + * + * Usage: rotate angle + * + * Redraw a marker oriented to the given rotation angle. The angle is + * given in radians. + */ +static int +markerRotate (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + Arg args[10]; + int erase; + + if (argc < 3) + return (TCL_ERROR); + + XtSetArg (args[0], GmRotangle, argv[1]); + + GmMarkpos (mp->gm); + GmSetAttributes (mp->gm, args, 1, XtRString); + GmRedraw (mp->gm, GXcopy, erase=True); + + return (TCL_OK); +} + + +/* getAttribute -- Return the value of a marker attribute. + * + * Usage: value = getAttribute attribute-name + */ +static int +markerGetAttribute (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + char *name, value[SZ_COMMAND]; + + if (argc < 2) + return (TCL_ERROR); + + name = argv[1]; + + if (GmGetAttribute (mp->gm, name, (XtArgVal)value, XtRString) < 0) + return (TCL_ERROR); + else { + Tcl_SetResult (obm->tcl, value, TCL_VOLATILE); + return (TCL_OK); + } +} + + +/* setAttribute -- Set the value of a marker attribute. + * + * Usage: setAttribute attribute-name value + */ +static int +markerSetAttribute (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + char *name, *value; + + if (argc < 3) + return (TCL_ERROR); + + name = argv[1]; + value = argv[2]; + + if (GmSetAttribute (mp->gm, name, (XtArgVal)value, XtRString) < 0) + return (TCL_ERROR); + else + return (TCL_OK); +} + + +/* getAttributes -- Return the values of a list of marker attributes. + * + * Usage: getAttributes attribute-list + * i.e. getAttributes {name value [name value ...]} + * or getAttributes name value [name value ...] + * + * where "value" is the name of the variable in which the attribute value + * is to be stored. + */ +static int +markerGetAttributes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + char *name, *variable, value[SZ_COMMAND]; + int i, status = 0; + char **items; + int nitems; + + if (argc < 2) + return (TCL_ERROR); + + if (argc == 2) { + /* Attribute list passed as a list argument. */ + if (Tcl_SplitList (tcl, argv[1], &nitems, &items) != TCL_OK) + return (TCL_ERROR); + } else if (argc > 2) { + /* Attribute list passed as separate arguments. */ + nitems = argc - 1; + items = (char **) XtMalloc (nitems * sizeof(char *)); + if (items == NULL) + return (TCL_ERROR); + for (i=0; i < nitems; i++) + items[i] = argv[i+1]; + } else + return (TCL_ERROR); + + for (i=0; i < nitems; i += 2) { + name = items[i]; + variable = items[i+1]; + + if (GmGetAttribute (mp->gm, name, (XtArgVal)value, XtRString) < 0) + status++; + if ((Tcl_SetVar (obm->tcl, variable, value, 0)) == NULL) + status++; + } + + free ((char *) items); + return (status ? TCL_ERROR : TCL_OK); +} + + +/* setAttributes -- Set the values of a list of marker attributes. + * + * Usage: setAttributes attribute-list + * i.e. setAttributes {name value [name value ...]} + * + * where "value" is the new value of the associated marker attribute. + */ +static int +markerSetAttributes (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + char *name, *value; + Arg args[MAX_ARGS]; + int status, argno, i; + char **items; + int nitems; + + if (argc < 2) + return (TCL_ERROR); + + if (argc == 2) { + /* Attribute list passed as a list argument. */ + if (Tcl_SplitList (tcl, argv[1], &nitems, &items) != TCL_OK) + return (TCL_ERROR); + } else if (argc > 2) { + /* Attribute list passed as separate arguments. */ + nitems = argc - 1; + items = (char **) XtMalloc (nitems * sizeof(char *)); + if (items == NULL) + return (TCL_ERROR); + for (i=0; i < nitems; i++) + items[i] = argv[i+1]; + } else + return (TCL_ERROR); + + for (i=0, argno=0; i < nitems && argno < MAX_ARGS; i += 2, argno++) { + name = items[i]; + value = items[i+1]; + XtSetArg (args[argno], name, value); + } + + if (GmSetAttributes (mp->gm, args, argno, XtRString) < 0) + status = TCL_ERROR; + else + status = TCL_OK; + + free ((char *) items); + return (status); +} + + +/* getVertices -- Get some or all of the vertices making up the polygon or + * polyline representation of a marker. + * + * Usage: getVertices points [first npts] + * + * The polygon or polyline representation of a marker is returned in the + * variable "points", as a string of the form { {x y} {x y} ...}. The first + * point is number zero. Coordinates are specified in raster zero pixel + * coordinates. + */ +static int +markerGetVertices (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + MarkerPrivate mp = &obj->marker; + ObmContext obm = mp->obm; + + register int i; + register char *op; + register DPoint *pv; + int first, maxpts, npts, ngot; + int nchars, status, buflen; + char *points, *buf; + + if (argc < 2) + return (TCL_ERROR); + + points = argv[1]; + first = (argc > 2) ? atoi(argv[2]) : 0; + npts = (argc > 3) ? atoi(argv[3]) : 0; + maxpts = max (npts, MAX_POLYPTS); +again: + if ((pv = (DPoint *) XtMalloc (maxpts * sizeof(DPoint))) == NULL) + return (TCL_ERROR); + + ngot = GmGetVertices (mp->gm, pv, first, npts ? npts : maxpts); + if (ngot >= maxpts) { + /* This is pretty unlikely. */ + XtFree ((char *)pv); + maxpts *= 2; + goto again; + } + + buflen = SZ_COMMAND; + buf = XtMalloc (buflen); + if (buf == NULL) { + XtFree ((char *)pv); + return (TCL_ERROR); + } + + op = buf; + *op++ = '{'; + *op++ = ' '; + + for (i=0; i < ngot; i++) { /* MF001 */ + sprintf (op, "{%d %d} ", (int)pv[i].x, (int)pv[i].y); + while (*op) /* MF002 */ + op++; + + if (op - buf + SZ_NUMBER > buflen) { + buflen += SZ_COMMAND; + nchars = op - buf; + if ((buf = XtRealloc (buf, buflen)) == NULL) { + XtFree ((char *)pv); + return (TCL_ERROR); + } + op = buf + nchars; + } + } + + *op++ = '}'; + *op++ = '\0'; + + if ((Tcl_SetVar (obm->tcl, points, buf, 0)) == NULL) + status = TCL_ERROR; + else + status = TCL_OK; + + XtFree ((char *)pv); + XtFree (buf); + + return (status); +} + + +/* setVertices -- Set some or all of the vertices making up the polygon or + * polyline representation of a marker. + * + * Usage: setVertices points [first npts] + * + * The polygon or polyline representation of a marker is set using the points + * passed in the "points" variable as a string of the form { {x y} {x y} ...}. + * If FIRST and NPTS are not specified first is assumed to be zero (the first + * point) and NPTS is the length of the points array. Coordinates are + * specified in raster zero pixel coordinates. In the case of 'poly' type + * markers the procedure will close the polygon by adding a copy of the first + * point to the list. + */ +static int +markerSetVertices (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + MarkerPrivate mp = &obj->marker; + ObmContext obm = mp->obm; + + register int i; + register char *ip; + register DPoint *pv; + int first, maxpts, npts, ngot; + char *ipp, *points, *ip_save; + + if (argc < 2) + return (TCL_ERROR); + + points = argv[1]; + first = (argc > 2) ? atoi(argv[2]) : 0; + npts = (argc > 3) ? atoi(argv[3]) : 0; + maxpts = max (npts, MAX_POLYPTS); + + if ((pv = (DPoint *) XtMalloc (maxpts * sizeof(DPoint))) == NULL) + return (TCL_ERROR); + + /* Get the points array. */ + for (ngot=0, ip=points; *ip; ) { + while (isspace(*ip) || *ip == '{') + ip++; + + ip_save = ip; + pv[ngot].x = strtod (ip, &ipp); ip = ipp; + pv[ngot].y = strtod (ip, &ipp); ip = ipp; + if (ip == ip_save) { + XtFree ((char *) pv); + return (TCL_ERROR); + } + + while (isspace(*ip) || *ip == '}') + ip++; + + if (++ngot >= maxpts) { + maxpts *= 2; + if ((pv = (DPoint *) XtRealloc ((char *)pv, + maxpts * sizeof(DPoint))) == NULL) + return (TCL_ERROR); + } + } + + GmSetVertices (mp->gm, pv, first, npts ? npts : ngot); + + XtFree ((char *)pv); + return (TCL_OK); +} + + +/* getRegion -- Return as a text string a high level description of the + * region defined by a marker. + * + * Usage: region = getRegion [unmap] [coord-type] + * + * The output string defines the marker type and the major marker positional + * attributes. The region description formats for the various marker types + * follow. + * + * text raster x y width height + * line raster x y x y + * polyline raster npts { {x y} {x y} ...} + * rectangle raster x y width height rotangle + * circle raster x y radius + * ellipse raster x y width height rotangle + * polygon raster npts { {x y} {x y} ...} + * + * Here, width and height refer to the distance from the marker center to an + * edge, not to the width or height of the whole marker. This avoids + * ambiguities about where the edge of a marker is if the width is even or + * odd. Using the center to edge measurement, the edge is at x +/- width, + * y +/- height. + * + * If the "unmap" flag is given getRegion will attempt to associate the + * marker with a mapped raster, reversing any mappings from the screen back + * to the original source raster, and returning the raster number and raster + * coordinates and marker sizes. If "unmap" is not given the marker + * coordinates will refer to raster 0. Either raster pixel ("pixel" or + * "Pixel") or raster NDC ("ndc" or "NDC") coordinates may be returned, pixel + * coordinates being the default. + */ +static int +markerGetRegion (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + MarkerPrivate mp = &obj->marker; + ObmContext obm = mp->obm; + register DPoint *pv, *vv; + register char *op; + register int i; + + Boolean unmap = False; + int ctype_out = GtPixel; + int x, y, width, height; + int maxpts, npts, src, dst, mapping; + int ctype, pvlen, buflen, nchars; + double rx, ry, rwidth, rheight; + Boolean output_points; + char *buf, *ap; + int marker_type; + double rotangle; + int status, v; + Arg args[10]; + + /* Process any optional arguments. */ + for (i=1; i < argc; i++) { + ap = argv[i]; + if (strcmp (ap, "unmap") == 0) + unmap = True; + else if ((v = coordType (ap)) > 0) + ctype_out = v; + } + + /* First get the basic attributes like x, y, width, height, which + * we need for most markers. + */ + XtSetArg (args[0], GmType, &marker_type); + XtSetArg (args[1], GmX, &x); + XtSetArg (args[2], GmY, &y); + XtSetArg (args[3], GmWidth, &width); + XtSetArg (args[4], GmHeight, &height); + if (GmGetAttributes (mp->gm, args, 5, XtRInt) < 0) + return (TCL_ERROR); + + if (GmGetAttribute (mp->gm, GmRotangle, &rotangle, XtRFloat) < 0) + return (TCL_ERROR); + + /* Get the points array, needed for some markers. */ + maxpts = MAX_POLYPTS; +again: + if ((pv = (DPoint *) XtMalloc (maxpts * sizeof(DPoint))) == NULL) + return (TCL_ERROR); + + /* To ease the coordinate conversions we store the marker center and + * width information as the first two elements in the points array. + * These are not part of the marker polygon or polyline. Putting them + * in the points vector allows us to transform everything in one + * operation. + */ + pv[0].x = x; + pv[0].y = y; + pv[1].x = x + width; + pv[1].y = y + height; + vv = pv + 2; + + /* Now read the points array into pv[2]. */ + npts = GmGetVertices (mp->gm, vv, 0, maxpts - 2); + if (npts == maxpts-2) { + /* This is pretty unlikely. */ + XtFree ((char *)pv); + maxpts *= 2; + goto again; + } + + /* If the unmap option is specified select the mapping, if any, which + * contains the marker center. Transform the coordinate vector + * backwards to the source raster. This process is repeated until we + * get back to a raster pixel which is not the destination of any + * mapping. + */ + src = 0; + pvlen = npts + 2; + + if (unmap) { + do { + src = GtSelectRaster (mp->gt, dst=src, + GtPixel, (int)(pv[0].x + 0.5), (int)(pv[0].y + 0.5), + GtPixel, &x, &y, &mapping); + if (src != dst) + GtMapVector (mp->gt, mapping, GtUnmap, pv, pv, pvlen); + } while (dst != src); + } + + /* Convert the point data to NDC coordinates if indicated. NDC + * coordinates are scaled to the integer range 0:MAXNDC at the widget + * level, which we scale to the range 0-1 floating at the GUI level. + */ + if (ctype_out == GtNDC) { + GtPixelToNDC (mp->gt, src, pv, pv, pvlen); + for (i=0; i < pvlen; i++) { + pv[i].x /= (double)MAXNDC; + pv[i].y /= (double)MAXNDC; + } + } + + rx = pv[0].x; + ry = pv[0].y; + rwidth = abs (pv[1].x - rx); + rheight = abs (pv[1].y - ry); + + buflen = SZ_COMMAND; + output_points = False; + op = buf = XtMalloc (buflen); + if (buf == NULL) { + XtFree ((char *)pv); + return (TCL_ERROR); + } + + /* Generate the marker description. */ + switch (marker_type) { + case Gm_Text: + /* text raster x y width height */ + if (ctype_out == GtNDC) { + sprintf (op, "%s %d %0.5f %0.5f %0.5f %0.5f", + GmText, src, rx, ry, rwidth, rheight); + } else { + sprintf (op, "%s %d %0.2f %0.2f %0.2f %0.2f", + GmText, src, rx, ry, rwidth, rheight); + } + break; + + case Gm_Line: + /* line raster x y x y */ + if (ctype_out == GtNDC) { + sprintf (op, "%s %d %0.5f %0.5f %0.5f %0.5f", GmLine, src, + vv[0].x, vv[0].y, vv[1].x, vv[1].y); + } else { + sprintf (op, "%s %d %0.2f %0.2f %0.2f %0.2f", GmLine, src, + vv[0].x, vv[0].y, vv[1].x, vv[1].y); + } + break; + + case Gm_Polyline: + /* polyline raster npts { {x y} {x y} ...} */ + sprintf (op, "%s %d %d ", GmPolyline, src, npts); + output_points = True; + break; + + case Gm_Rectangle: + /* rectangle raster x y width height rotangle */ + if (ctype_out == GtNDC) { + sprintf (op, "%s %d %0.5f %0.5f %0.5f %0.5f %0.5f", + GmRectangle, src, rx, ry, rwidth, rheight, rotangle); + } else { + sprintf (op, "%s %d %0.2f %0.2f %0.2f %0.2f %0.4f", + GmRectangle, src, rx, ry, rwidth, rheight, rotangle); + } + break; + + case Gm_Box: + /* box raster x y width height rotangle */ + if (ctype_out == GtNDC) { + sprintf (op, "%s %d %0.5f %0.5f %0.5f %0.5f %0.5f", + GmBox, src, rx, ry, rwidth, rheight, rotangle); + } else { + sprintf (op, "%s %d %0.2f %0.2f %0.2f %0.2f %0.4f", + GmBox, src, rx, ry, rwidth, rheight, rotangle); + } + break; + + case Gm_Circle: + /* circle raster x y radius */ + if (ctype_out == GtNDC) { + sprintf (op, "%s %d %0.5f %0.5f %0.5f", GmCircle, src, + rx, ry, rwidth); + } else { + sprintf (op, "%s %d %0.2f %0.2f %0.2f", GmCircle, src, + rx, ry, rwidth); + } + break; + + case Gm_Ellipse: + /* ellipse raster x y width height rotangle */ + if (ctype_out == GtNDC) { + sprintf (op, "%s %d %0.5f %0.5f %0.5f %0.5f %0.5f", + GmEllipse, src, rx, ry, rwidth, rheight, rotangle); + } else { + sprintf (op, "%s %d %0.2f %0.2f %0.2f %0.2f %0.4f", + GmEllipse, src, rx, ry, rwidth, rheight, rotangle); + } + break; + + case Gm_Polygon: + /* polygon raster npts { {x y} {x y} ...} */ + sprintf (op, "%s %d %d ", GmPolygon, src, npts); + output_points = True; + break; + + default: + XtFree (buf); + XtFree ((char *)pv); + return (TCL_ERROR); + } + + /* If the marker description includes a point vector output this + * too. + */ + if (output_points) { + while (*op) + op++; + + *op++ = '{'; + *op++ = ' '; + + for (i=0; i < npts; i++) { + if (ctype_out == GtNDC) + sprintf (op, "{%0.5f %0.5f} ", vv[i].x, vv[i].y); + else + sprintf (op, "{%0.2f %0.2f} ", vv[i].x, vv[i].y); + while (*op) /* MF003 */ + op++; + + if (op - buf + SZ_NUMBER > buflen) { + buflen += SZ_COMMAND; + nchars = op - buf; + if ((buf = XtRealloc (buf, buflen)) == NULL) { + XtFree ((char *)pv); + return (TCL_ERROR); + } + op = buf + nchars; + } + } + + *op++ = '}'; + *op++ = '\0'; + } + + Tcl_SetResult (obm->tcl, buf, TCL_VOLATILE); + XtFree ((char *)pv); + XtFree (buf); + + return (TCL_OK); +} + + +/* getRect -- Return the region defined by a rectangle marker. The rect is + * returned in a form convenient for use as the destination rect in a gterm + * widget raster mapping. + * + * Usage: getRect type dx dy dnx dny + * + * The rect is stored in the output arguments. The rect coordinates are + * integer pixel coordinates (raster 0 pixel coordinates), as with all marker + * level coords. If the rect type is "interior" the rect defining the region + * enclosed by the marker is returned. If the rect type is "boundary' the + * rect returned refers to the location of the marker itself. If the rect + * type is "boundingBox" the rect returned is one which is large enough to + * completely enclose the marker. getRect may be used with any marker, but + * the interior and boundary options are probably not useful except for + * nonrotated rectangular markers. + */ +static int +markerGetRect (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + MarkerObject obj = (MarkerObject) msg->object[msg->level]; + register MarkerPrivate mp = &obj->marker; + register ObmContext obm = mp->obm; + char *dx_out, *dy_out, *dnx_out, *dny_out; + int marker_type, x, y, width, height, status; + int dx, dy, dnx, dny; + int x1, x2, y1, y2; + char *type, buf[32]; + Arg args[10]; + + if (argc < 6) + return (TCL_ERROR); + + type = argv[1]; + dx_out = argv[2]; + dy_out = argv[3]; + dnx_out = argv[4]; + dny_out = argv[5]; + + XtSetArg (args[0], GmType, &marker_type); + XtSetArg (args[1], GmX, &x); + XtSetArg (args[2], GmY, &y); + XtSetArg (args[3], GmWidth, &width); + XtSetArg (args[4], GmHeight, &height); + if (GmGetAttributes (mp->gm, args, 5, XtRInt) < 0) + return (TCL_ERROR); + + /* Get the coordinates of the marker boundary. */ + if (marker_type == Gm_Text) { + x1 = x; x2 = x + width - 1; + y1 = y; y2 = y + height - 1; + } else { + x1 = x - width; x2 = x + width; + y1 = y - height; y2 = y + height; + } + + if (strcmp (type, "boundary") == 0) { + /* Return the rect defining the marker itself. */ + dx = x1; dnx = max(0, x2 - x1 + 1); + dy = y1; dny = max(0, y2 - y1 + 1); + + } else if (strcmp (type, "boundingBox") == 0) { + /* Return a rect large enough to enclose the entire marker. + */ + GmGetBoundingBox (mp->gm, &dx, &dy, &dnx, &dny); + + } else { + /* Compute the enclosed region, leaving a little space between + * the rect and the marker boundary. This is the default. + */ + dx = x1 + 2; dnx = max(0, (x2 - 2) - (x1 + 2) + 1); + dy = y1 + 2; dny = max(0, (y2 - 2) - (y1 + 2) + 1); + } + + status = 0; + sprintf (buf, "%d", dx); + if ((Tcl_SetVar (obm->tcl, dx_out, buf, 0)) == NULL) + status++; + sprintf (buf, "%d", dy); + if ((Tcl_SetVar (obm->tcl, dy_out, buf, 0)) == NULL) + status++; + sprintf (buf, "%d", dnx); + if ((Tcl_SetVar (obm->tcl, dnx_out, buf, 0)) == NULL) + status++; + sprintf (buf, "%d", dny); + if ((Tcl_SetVar (obm->tcl, dny_out, buf, 0)) == NULL) + status++; + + return (TCL_OK); +} diff --git a/vendor/x11iraf/obm/obmres.c b/vendor/x11iraf/obm/obmres.c new file mode 100644 index 00000000..e6acd827 --- /dev/null +++ b/vendor/x11iraf/obm/obmres.c @@ -0,0 +1,2301 @@ +#include <stdio.h> + +/* + * OBMRES.C -- A little program to generate the resource list for the object + * manager (Xt/Athena widgets). + * + * This file is not part of the runtime Object Manager code. + */ + +/* Widget class codes. These must match the values given in ObmP.h. + */ +#define Core 00000000000, 00000000001 +#define Object 00000000000, 00000000002 +#define Simple 00000000000, 00000000004 +#define Shell 00000000000, 00000000010 + +#define AsciiSink 00000000000, 00000000020 +#define AsciiSrc 00000000000, 00000000040 +#define AsciiText 00000000000, 00000000100 +#define Box 00000000000, 00000000200 +#define Command 00000000000, 00000000400 +#define Dialog 00000000000, 00000001000 +#define Form 00000000000, 00000002000 +#define Grip 00000000000, 00000004000 +#define Label 00000000000, 00000010000 +#define List 00000000000, 00000020000 +#define MenuButton 00000000000, 00000040000 +#define Paned 00000000000, 00000100000 +#define Panner 00000000000, 00000200000 +#define Porthole 00000000000, 00000400000 +#define Repeater 00000000000, 00001000000 +#define Scrollbar 00000000000, 00002000000 +#define SimpleMenu 00000000000, 00004000000 +#define Sme 00000000000, 00010000000 +#define SmeBSB 00000000000, 00020000000 +#define SmeLine 00000000000, 00040000000 +#define StripChart 00000000000, 00100000000 +#define Toggle 00000000000, 00200000000 +#define Tree 00000000000, 00400000000 +#define Viewport 00000000000, 01000000000 + +#define Gterm 00000000001, 00000000000 +#define Layout 00000000002, 00000000000 +#define HTML 00000000004, 00000000000 +#define Arrow 00000000010, 00000000000 +#define Board 00000000020, 00000000000 +#define Scrollbar2 00000000040, 00000000000 +#define Slider2d 00000000100, 00000000000 +#define Frame 00000000200, 00000000000 +#define Group 00000000400, 00000000000 +#define Icon 00000001000, 00000000000 +#define MultiList 00000002000, 00000000000 +#define RadioGroup 00000004000, 00000000000 +#define RowCol 00000010000, 00000000000 +#define TextBox 00000020000, 00000000000 +#define TextButton 00000040000, 00000000000 +#define TextToggle 00000100000, 00000000000 +#define XfwfCommon 00000200000, 00000000000 +#define XfwfMenuBar 00000400000, 00000000000 +#define Tabs 00001000000, 00000000000 +#define ListTree 00002000000, 00000000000 +#define Separator 00004000000, 00000000000 +#define Table 00010000000, 00000000000 + +#define ApplicationShell Shell +#define OverrideShell Shell +#define TopLevelShell Shell +#define TransientShell Shell +#define WMShell Shell + + +/* The following should list in sort order all the resources to be indexed, + * giving for each the resource type and the widget class in which it is used. + * + * NOTES. The asciiText widget recognizes the asciiSrc and asciiSink resources + * hence these should be listed as asciiText resources too. Listres lists + * resources for some widgets which have no public XtN definition; these should + * be omitted. + */ +struct resource_list { + char *resource; /* resource name */ + char *type; /* resource type */ + unsigned long class1, class2; /* widget using resource */ +} resources[] = { + { "abs_height", "Position", Arrow }, + { "abs_height", "Position", Board }, + { "abs_height", "Position", Group }, + { "abs_height", "Position", Icon }, + { "abs_height", "Position", RadioGroup }, + { "abs_height", "Position", RowCol }, + { "abs_height", "Position", Scrollbar2 }, + { "abs_height", "Position", Slider2d }, + { "abs_height", "Position", TextBox }, + { "abs_height", "Position", TextButton }, + { "abs_height", "Position", TextToggle }, + { "abs_height", "Position", XfwfMenuBar }, + { "abs_width", "Position", Arrow }, + { "abs_width", "Position", Board }, + { "abs_width", "Position", Group }, + { "abs_width", "Position", Icon }, + { "abs_width", "Position", RadioGroup }, + { "abs_width", "Position", RowCol }, + { "abs_width", "Position", Scrollbar2 }, + { "abs_width", "Position", Slider2d }, + { "abs_width", "Position", TextBox }, + { "abs_width", "Position", TextButton }, + { "abs_width", "Position", TextToggle }, + { "abs_width", "Position", XfwfMenuBar }, + { "abs_x", "Position", Arrow }, + { "abs_x", "Position", Board }, + { "abs_x", "Position", Group }, + { "abs_x", "Position", Icon }, + { "abs_x", "Position", RadioGroup }, + { "abs_x", "Position", RowCol }, + { "abs_x", "Position", Scrollbar2 }, + { "abs_x", "Position", Slider2d }, + { "abs_x", "Position", TextBox }, + { "abs_x", "Position", TextButton }, + { "abs_x", "Position", TextToggle }, + { "abs_x", "Position", XfwfMenuBar }, + { "abs_y", "Position", Arrow }, + { "abs_y", "Position", Board }, + { "abs_y", "Position", Group }, + { "abs_y", "Position", Icon }, + { "abs_y", "Position", RadioGroup }, + { "abs_y", "Position", RowCol }, + { "abs_y", "Position", Scrollbar2 }, + { "abs_y", "Position", Slider2d }, + { "abs_y", "Position", TextBox }, + { "abs_y", "Position", TextButton }, + { "abs_y", "Position", TextToggle }, + { "abs_y", "Position", XfwfMenuBar }, + { "accelerators", "AcceleratorTable", ApplicationShell }, + { "accelerators", "AcceleratorTable", Arrow }, + { "accelerators", "AcceleratorTable", AsciiText }, + { "accelerators", "AcceleratorTable", Board }, + { "accelerators", "AcceleratorTable", Box }, + { "accelerators", "AcceleratorTable", Command }, + { "accelerators", "AcceleratorTable", Core }, + { "accelerators", "AcceleratorTable", Dialog }, + { "accelerators", "AcceleratorTable", Form }, + { "accelerators", "AcceleratorTable", Frame }, + { "accelerators", "AcceleratorTable", Grip }, + { "accelerators", "AcceleratorTable", Group }, + { "accelerators", "AcceleratorTable", Gterm }, + { "accelerators", "AcceleratorTable", HTML }, + { "accelerators", "AcceleratorTable", Icon }, + { "accelerators", "AcceleratorTable", Label }, + { "accelerators", "AcceleratorTable", Layout }, + { "accelerators", "AcceleratorTable", List }, + { "accelerators", "AcceleratorTable", MenuButton }, + { "accelerators", "AcceleratorTable", MultiList }, + { "accelerators", "AcceleratorTable", OverrideShell }, + { "accelerators", "AcceleratorTable", Paned }, + { "accelerators", "AcceleratorTable", Panner }, + { "accelerators", "AcceleratorTable", Porthole }, + { "accelerators", "AcceleratorTable", RadioGroup }, + { "accelerators", "AcceleratorTable", Repeater }, + { "accelerators", "AcceleratorTable", RowCol }, + { "accelerators", "AcceleratorTable", Scrollbar }, + { "accelerators", "AcceleratorTable", Scrollbar2 }, + { "accelerators", "AcceleratorTable", Shell }, + { "accelerators", "AcceleratorTable", Simple }, + { "accelerators", "AcceleratorTable", SimpleMenu }, + { "accelerators", "AcceleratorTable", Slider2d }, + { "accelerators", "AcceleratorTable", StripChart }, + { "accelerators", "AcceleratorTable", Table }, + { "accelerators", "AcceleratorTable", Tabs }, + { "accelerators", "AcceleratorTable", TextBox }, + { "accelerators", "AcceleratorTable", TextButton }, + { "accelerators", "AcceleratorTable", TextToggle }, + { "accelerators", "AcceleratorTable", Toggle }, + { "accelerators", "AcceleratorTable", TopLevelShell }, + { "accelerators", "AcceleratorTable", TransientShell }, + { "accelerators", "AcceleratorTable", Tree }, + { "accelerators", "AcceleratorTable", Viewport }, + { "accelerators", "AcceleratorTable", WMShell }, + { "accelerators", "AcceleratorTable", XfwfCommon }, + { "accelerators", "AcceleratorTable", XfwfMenuBar }, + { "addColumn", "Callback", Table }, + { "addRow", "Callback", Table }, + { "allowAddColumn", "Callback", Table }, + { "allowAddRow", "Callback", Table }, + { "allowDeleteColumn", "Callback", Table }, + { "allowDeleteRow", "Callback", Table }, + { "allowDeleteTable", "Callback", Table }, + { "activate", "Callback", Group }, + { "activate", "Callback", Icon }, + { "activate", "Callback", RadioGroup }, + { "activate", "Callback", TextButton }, + { "activate", "Callback", TextToggle }, + { "activateCallback", "Callback", ListTree }, + { "activeAnchorBG", "Pixel", HTML }, + { "activeAnchorFG", "Pixel", HTML }, + { "addressFont", "FontStruct", HTML }, + { "alignment", "Alignment", Group }, + { "alignment", "Alignment", RadioGroup }, + { "alignment", "Alignment", RowCol }, + { "alignment", "Alignment", Slider2d }, + { "alignment", "Alignment", TextBox }, + { "alignment", "Alignment", TextButton }, + { "alignment", "Alignment", TextToggle }, + { "alignment", "Alignment", XfwfMenuBar }, + { "allowAddColumn", "Callback", Table }, + { "allowAddRow", "Callback", Table }, + { "allowDeleteColumn", "Callback", Table }, + { "allowDeleteRow", "Callback", Table }, + { "allowDeleteTable", "Callback", Table }, + { "allowHoriz", "Boolean", Viewport }, + { "allowOff", "Boolean", Panner }, + { "allowResize", "Boolean", Paned }, + { "allowShellResize", "Boolean", ApplicationShell }, + { "allowShellResize", "Boolean", OverrideShell }, + { "allowShellResize", "Boolean", Shell }, + { "allowShellResize", "Boolean", SimpleMenu }, + { "allowShellResize", "Boolean", TopLevelShell }, + { "allowShellResize", "Boolean", TransientShell }, + { "allowShellResize", "Boolean", WMShell }, + { "allowVert", "Boolean", Viewport }, + { "alphaFont1", "FontStruct", Gterm }, + { "alphaFont2", "FontStruct", Gterm }, + { "alphaFont3", "FontStruct", Gterm }, + { "alphaFont4", "FontStruct", Gterm }, + { "alphaFont5", "FontStruct", Gterm }, + { "alphaFont6", "FontStruct", Gterm }, + { "alphaFont7", "FontStruct", Gterm }, + { "alphaFont8", "FontStruct", Gterm }, + { "ancestorSensitive", "Boolean", ApplicationShell }, + { "ancestorSensitive", "Boolean", Arrow }, + { "ancestorSensitive", "Boolean", AsciiText }, + { "ancestorSensitive", "Boolean", Board }, + { "ancestorSensitive", "Boolean", Box }, + { "ancestorSensitive", "Boolean", Command }, + { "ancestorSensitive", "Boolean", Core }, + { "ancestorSensitive", "Boolean", Dialog }, + { "ancestorSensitive", "Boolean", Form }, + { "ancestorSensitive", "Boolean", Frame }, + { "ancestorSensitive", "Boolean", Grip }, + { "ancestorSensitive", "Boolean", Group }, + { "ancestorSensitive", "Boolean", Gterm }, + { "ancestorSensitive", "Boolean", HTML }, + { "ancestorSensitive", "Boolean", Icon }, + { "ancestorSensitive", "Boolean", Label }, + { "ancestorSensitive", "Boolean", Layout }, + { "ancestorSensitive", "Boolean", List }, + { "ancestorSensitive", "Boolean", MenuButton }, + { "ancestorSensitive", "Boolean", MultiList }, + { "ancestorSensitive", "Boolean", OverrideShell }, + { "ancestorSensitive", "Boolean", Paned }, + { "ancestorSensitive", "Boolean", Panner }, + { "ancestorSensitive", "Boolean", Porthole }, + { "ancestorSensitive", "Boolean", RadioGroup }, + { "ancestorSensitive", "Boolean", Repeater }, + { "ancestorSensitive", "Boolean", RowCol }, + { "ancestorSensitive", "Boolean", Scrollbar }, + { "ancestorSensitive", "Boolean", Scrollbar2 }, + { "ancestorSensitive", "Boolean", Shell }, + { "ancestorSensitive", "Boolean", Simple }, + { "ancestorSensitive", "Boolean", SimpleMenu }, + { "ancestorSensitive", "Boolean", Slider2d }, + { "ancestorSensitive", "Boolean", Sme }, + { "ancestorSensitive", "Boolean", SmeBSB }, + { "ancestorSensitive", "Boolean", SmeLine }, + { "ancestorSensitive", "Boolean", StripChart }, + { "ancestorSensitive", "Boolean", Table }, + { "ancestorSensitive", "Boolean", TextBox }, + { "ancestorSensitive", "Boolean", TextButton }, + { "ancestorSensitive", "Boolean", TextToggle }, + { "ancestorSensitive", "Boolean", Toggle }, + { "ancestorSensitive", "Boolean", TopLevelShell }, + { "ancestorSensitive", "Boolean", TransientShell }, + { "ancestorSensitive", "Boolean", Tree }, + { "ancestorSensitive", "Boolean", Viewport }, + { "ancestorSensitive", "Boolean", WMShell }, + { "ancestorSensitive", "Boolean", XfwfCommon }, + { "ancestorSensitive", "Boolean", XfwfMenuBar }, + { "anchorCallback", "Callback", HTML }, + { "anchorColor", "Pixel", HTML }, + { "anchorUnderlines", "Int", HTML }, + { "argc", "Int", ApplicationShell }, + { "argv", "StringArray", ApplicationShell }, + { "arrowShadow", "Dimension", Arrow }, + { "autoFill", "Boolean", AsciiText }, + { "autoReconfigure", "Boolean", Tree }, + { "background", "Pixel", ApplicationShell }, + { "background", "Pixel", Arrow }, + { "background", "Pixel", AsciiSink }, + { "background", "Pixel", AsciiText }, + { "background", "Pixel", Board }, + { "background", "Pixel", Box }, + { "background", "Pixel", Command }, + { "background", "Pixel", Core }, + { "background", "Pixel", Dialog }, + { "background", "Pixel", Form }, + { "background", "Pixel", Frame }, + { "background", "Pixel", Group }, + { "background", "Pixel", Gterm }, + { "background", "Pixel", HTML }, + { "background", "Pixel", Icon }, + { "background", "Pixel", Label }, + { "background", "Pixel", Layout }, + { "background", "Pixel", List }, + { "background", "Pixel", MenuButton }, + { "background", "Pixel", MultiList }, + { "background", "Pixel", OverrideShell }, + { "background", "Pixel", Paned }, + { "background", "Pixel", Panner }, + { "background", "Pixel", Porthole }, + { "background", "Pixel", RadioGroup }, + { "background", "Pixel", Repeater }, + { "background", "Pixel", RowCol }, + { "background", "Pixel", Separator }, + { "background", "Pixel", Scrollbar }, + { "background", "Pixel", Scrollbar2 }, + { "background", "Pixel", Shell }, + { "background", "Pixel", Simple }, + { "background", "Pixel", SimpleMenu }, + { "background", "Pixel", Slider2d }, + { "background", "Pixel", StripChart }, + { "background", "Pixel", Table }, + { "background", "Pixel", TextBox }, + { "background", "Pixel", TextButton }, + { "background", "Pixel", TextToggle }, + { "background", "Pixel", Toggle }, + { "background", "Pixel", TopLevelShell }, + { "background", "Pixel", TransientShell }, + { "background", "Pixel", Tree }, + { "background", "Pixel", Viewport }, + { "background", "Pixel", WMShell }, + { "background", "Pixel", XfwfCommon }, + { "background", "Pixel", XfwfMenuBar }, + { "backgroundPixmap", "Pixmap", ApplicationShell }, + { "backgroundPixmap", "Pixmap", Arrow }, + { "backgroundPixmap", "Pixmap", AsciiText }, + { "backgroundPixmap", "Pixmap", Board }, + { "backgroundPixmap", "Pixmap", Box }, + { "backgroundPixmap", "Pixmap", Command }, + { "backgroundPixmap", "Pixmap", Core }, + { "backgroundPixmap", "Pixmap", Dialog }, + { "backgroundPixmap", "Pixmap", Form }, + { "backgroundPixmap", "Pixmap", Frame }, + { "backgroundPixmap", "Pixmap", Grip }, + { "backgroundPixmap", "Pixmap", Group }, + { "backgroundPixmap", "Pixmap", Gterm }, + { "backgroundPixmap", "Pixmap", HTML }, + { "backgroundPixmap", "Pixmap", Icon }, + { "backgroundPixmap", "Pixmap", Label }, + { "backgroundPixmap", "Pixmap", Layout }, + { "backgroundPixmap", "Pixmap", List }, + { "backgroundPixmap", "Pixmap", ListTree }, + { "backgroundPixmap", "Pixmap", MenuButton }, + { "backgroundPixmap", "Pixmap", MultiList }, + { "backgroundPixmap", "Pixmap", OverrideShell }, + { "backgroundPixmap", "Pixmap", Paned }, + { "backgroundPixmap", "Pixmap", Panner }, + { "backgroundPixmap", "Pixmap", Porthole }, + { "backgroundPixmap", "Pixmap", RadioGroup }, + { "backgroundPixmap", "Pixmap", Repeater }, + { "backgroundPixmap", "Pixmap", RowCol }, + { "backgroundPixmap", "Pixmap", Scrollbar }, + { "backgroundPixmap", "Pixmap", Scrollbar2 }, + { "backgroundPixmap", "Pixmap", Shell }, + { "backgroundPixmap", "Pixmap", Simple }, + { "backgroundPixmap", "Pixmap", SimpleMenu }, + { "backgroundPixmap", "Pixmap", Slider2d }, + { "backgroundPixmap", "Pixmap", StripChart }, + { "backgroundPixmap", "Pixmap", Table }, + { "backgroundPixmap", "Pixmap", Tabs }, + { "backgroundPixmap", "Pixmap", TextBox }, + { "backgroundPixmap", "Pixmap", TextButton }, + { "backgroundPixmap", "Pixmap", TextToggle }, + { "backgroundPixmap", "Pixmap", Toggle }, + { "backgroundPixmap", "Pixmap", TopLevelShell }, + { "backgroundPixmap", "Pixmap", TransientShell }, + { "backgroundPixmap", "Pixmap", Tree }, + { "backgroundPixmap", "Pixmap", Viewport }, + { "backgroundPixmap", "Pixmap", WMShell }, + { "backgroundPixmap", "Pixmap", XfwfCommon }, + { "backgroundPixmap", "Pixmap", XfwfMenuBar }, + { "backgroundStipple", "String", Panner }, + { "backingStore", "BackingStore", SimpleMenu }, + { "baseHeight", "Int", ApplicationShell }, + { "baseHeight", "Int", TopLevelShell }, + { "baseHeight", "Int", TransientShell }, + { "baseHeight", "Int", WMShell }, + { "basePixel", "Int", Gterm }, + { "baseWidth", "Int", ApplicationShell }, + { "baseWidth", "Int", TopLevelShell }, + { "baseWidth", "Int", TransientShell }, + { "baseWidth", "Int", WMShell }, + { "betweenCursor", "Cursor", Paned }, + { "bitmap", "Bitmap", Command }, + { "bitmap", "Bitmap", Label }, + { "bitmap", "Bitmap", MenuButton }, + { "bitmap", "Bitmap", Repeater }, + { "bitmap", "Bitmap", Separator }, + { "bitmap", "Bitmap", Toggle }, + { "boldFont", "FontStruct", HTML }, + { "border", "Pixel", Separator }, + { "borderColor", "Pixel", ApplicationShell }, + { "borderColor", "Pixel", Arrow }, + { "borderColor", "Pixel", AsciiText }, + { "borderColor", "Pixel", Board }, + { "borderColor", "Pixel", Box }, + { "borderColor", "Pixel", Command }, + { "borderColor", "Pixel", Core }, + { "borderColor", "Pixel", Dialog }, + { "borderColor", "Pixel", Form }, + { "borderColor", "Pixel", Frame }, + { "borderColor", "Pixel", Grip }, + { "borderColor", "Pixel", Group }, + { "borderColor", "Pixel", Gterm }, + { "borderColor", "Pixel", HTML }, + { "borderColor", "Pixel", Icon }, + { "borderColor", "Pixel", Label }, + { "borderColor", "Pixel", Layout }, + { "borderColor", "Pixel", List }, + { "borderColor", "Pixel", MenuButton }, + { "borderColor", "Pixel", MultiList }, + { "borderColor", "Pixel", OverrideShell }, + { "borderColor", "Pixel", Paned }, + { "borderColor", "Pixel", Panner }, + { "borderColor", "Pixel", Porthole }, + { "borderColor", "Pixel", RadioGroup }, + { "borderColor", "Pixel", Repeater }, + { "borderColor", "Pixel", RowCol }, + { "borderColor", "Pixel", Scrollbar }, + { "borderColor", "Pixel", Scrollbar2 }, + { "borderColor", "Pixel", Shell }, + { "borderColor", "Pixel", Simple }, + { "borderColor", "Pixel", SimpleMenu }, + { "borderColor", "Pixel", Slider2d }, + { "borderColor", "Pixel", StripChart }, + { "borderColor", "Pixel", Table }, + { "borderColor", "Pixel", TextBox }, + { "borderColor", "Pixel", TextButton }, + { "borderColor", "Pixel", TextToggle }, + { "borderColor", "Pixel", Toggle }, + { "borderColor", "Pixel", TopLevelShell }, + { "borderColor", "Pixel", TransientShell }, + { "borderColor", "Pixel", Tree }, + { "borderColor", "Pixel", Viewport }, + { "borderColor", "Pixel", WMShell }, + { "borderColor", "Pixel", XfwfCommon }, + { "borderColor", "Pixel", XfwfMenuBar }, + { "borderPixmap", "Pixmap", ApplicationShell }, + { "borderPixmap", "Pixmap", Arrow }, + { "borderPixmap", "Pixmap", AsciiText }, + { "borderPixmap", "Pixmap", Board }, + { "borderPixmap", "Pixmap", Box }, + { "borderPixmap", "Pixmap", Command }, + { "borderPixmap", "Pixmap", Core }, + { "borderPixmap", "Pixmap", Dialog }, + { "borderPixmap", "Pixmap", Form }, + { "borderPixmap", "Pixmap", Frame }, + { "borderPixmap", "Pixmap", Grip }, + { "borderPixmap", "Pixmap", Group }, + { "borderPixmap", "Pixmap", Gterm }, + { "borderPixmap", "Pixmap", HTML }, + { "borderPixmap", "Pixmap", Icon }, + { "borderPixmap", "Pixmap", Label }, + { "borderPixmap", "Pixmap", Layout }, + { "borderPixmap", "Pixmap", List }, + { "borderPixmap", "Pixmap", ListTree }, + { "borderPixmap", "Pixmap", MenuButton }, + { "borderPixmap", "Pixmap", MultiList }, + { "borderPixmap", "Pixmap", OverrideShell }, + { "borderPixmap", "Pixmap", Paned }, + { "borderPixmap", "Pixmap", Panner }, + { "borderPixmap", "Pixmap", Porthole }, + { "borderPixmap", "Pixmap", RadioGroup }, + { "borderPixmap", "Pixmap", Repeater }, + { "borderPixmap", "Pixmap", RowCol }, + { "borderPixmap", "Pixmap", Scrollbar }, + { "borderPixmap", "Pixmap", Scrollbar2 }, + { "borderPixmap", "Pixmap", Shell }, + { "borderPixmap", "Pixmap", Simple }, + { "borderPixmap", "Pixmap", SimpleMenu }, + { "borderPixmap", "Pixmap", Slider2d }, + { "borderPixmap", "Pixmap", StripChart }, + { "borderPixmap", "Pixmap", Table }, + { "borderPixmap", "Pixmap", Tabs }, + { "borderPixmap", "Pixmap", TextBox }, + { "borderPixmap", "Pixmap", TextButton }, + { "borderPixmap", "Pixmap", TextToggle }, + { "borderPixmap", "Pixmap", Toggle }, + { "borderPixmap", "Pixmap", TopLevelShell }, + { "borderPixmap", "Pixmap", TransientShell }, + { "borderPixmap", "Pixmap", Tree }, + { "borderPixmap", "Pixmap", Viewport }, + { "borderPixmap", "Pixmap", WMShell }, + { "borderPixmap", "Pixmap", XfwfCommon }, + { "borderPixmap", "Pixmap", XfwfMenuBar }, + { "borderWidth", "Dimension", ApplicationShell }, + { "borderWidth", "Dimension", Arrow }, + { "borderWidth", "Dimension", AsciiText }, + { "borderWidth", "Dimension", Board }, + { "borderWidth", "Dimension", Box }, + { "borderWidth", "Dimension", Command }, + { "borderWidth", "Dimension", Core }, + { "borderWidth", "Dimension", Dialog }, + { "borderWidth", "Dimension", Form }, + { "borderWidth", "Dimension", Frame }, + { "borderWidth", "Dimension", Grip }, + { "borderWidth", "Dimension", Group }, + { "borderWidth", "Dimension", Gterm }, + { "borderWidth", "Dimension", HTML }, + { "borderWidth", "Dimension", Icon }, + { "borderWidth", "Dimension", Label }, + { "borderWidth", "Dimension", Layout }, + { "borderWidth", "Dimension", List }, + { "borderWidth", "Dimension", MenuButton }, + { "borderWidth", "Dimension", MultiList }, + { "borderWidth", "Dimension", OverrideShell }, + { "borderWidth", "Dimension", Paned }, + { "borderWidth", "Dimension", Panner }, + { "borderWidth", "Dimension", Porthole }, + { "borderWidth", "Dimension", RadioGroup }, + { "borderWidth", "Dimension", Repeater }, + { "borderWidth", "Dimension", RowCol }, + { "borderWidth", "Dimension", Scrollbar }, + { "borderWidth", "Dimension", Scrollbar2 }, + { "borderWidth", "Dimension", Separator }, + { "borderWidth", "Dimension", Shell }, + { "borderWidth", "Dimension", Simple }, + { "borderWidth", "Dimension", SimpleMenu }, + { "borderWidth", "Dimension", Slider2d }, + { "borderWidth", "Dimension", Sme }, + { "borderWidth", "Dimension", SmeBSB }, + { "borderWidth", "Dimension", SmeLine }, + { "borderWidth", "Dimension", StripChart }, + { "borderWidth", "Dimension", Tabs }, + { "borderWidth", "Dimension", TextBox }, + { "borderWidth", "Dimension", TextButton }, + { "borderWidth", "Dimension", TextToggle }, + { "borderWidth", "Dimension", Toggle }, + { "borderWidth", "Dimension", TopLevelShell }, + { "borderWidth", "Dimension", TransientShell }, + { "borderWidth", "Dimension", Tree }, + { "borderWidth", "Dimension", Viewport }, + { "borderWidth", "Dimension", WMShell }, + { "borderWidth", "Dimension", XfwfCommon }, + { "borderWidth", "Dimension", XfwfMenuBar }, + { "bottom", "EdgeType", Dialog }, + { "bottom", "EdgeType", Form }, + { "bottom", "EdgeType", Viewport }, + { "bottomMargin", "Dimension", SimpleMenu }, + { "bottomMargin", "Dimension", Slider2d }, + { "bottomMargin", "Dimension", TextBox }, + { "bottomMargin", "Dimension", TextButton }, + { "bottomMargin", "Dimension", TextToggle }, + { "bottomMargin", "Position", AsciiText }, + { "bottomShadowColor", "Pixel", Arrow }, + { "bottomShadowColor", "Pixel", Board }, + { "bottomShadowColor", "Pixel", Frame }, + { "bottomShadowColor", "Pixel", Group }, + { "bottomShadowColor", "Pixel", Icon }, + { "bottomShadowColor", "Pixel", RadioGroup }, + { "bottomShadowColor", "Pixel", RowCol }, + { "bottomShadowColor", "Pixel", Scrollbar2 }, + { "bottomShadowColor", "Pixel", Slider2d }, + { "bottomShadowColor", "Pixel", TextBox }, + { "bottomShadowColor", "Pixel", TextButton }, + { "bottomShadowColor", "Pixel", TextToggle }, + { "bottomShadowColor", "Pixel", XfwfMenuBar }, + { "bottomShadowContast", "Int", Tabs }, + { "bottomShadowPixel", "Pixel", Table }, + { "bottomShadowPixmap", "Pixmap", Table }, + { "bottomShadowStipple", "Bitmap", Arrow }, + { "bottomShadowStipple", "Bitmap", Board }, + { "bottomShadowStipple", "Bitmap", Frame }, + { "bottomShadowStipple", "Bitmap", Group }, + { "bottomShadowStipple", "Bitmap", Icon }, + { "bottomShadowStipple", "Bitmap", RadioGroup }, + { "bottomShadowStipple", "Bitmap", RowCol }, + { "bottomShadowStipple", "Bitmap", Scrollbar2 }, + { "bottomShadowStipple", "Bitmap", Slider2d }, + { "bottomShadowStipple", "Bitmap", TextBox }, + { "bottomShadowStipple", "Bitmap", TextButton }, + { "bottomShadowStipple", "Bitmap", TextToggle }, + { "bottomShadowStipple", "Bitmap", XfwfMenuBar }, + { "branchPixmap", "Bitmap", ListTree }, + { "branchOpenPixmap", "Bitmap", ListTree }, + { "branchCallback", "Callback", ListTree }, + { "busyCursor", "String", Gterm }, + { "busyCursorBgColor", "Pixel", Gterm }, + { "busyCursorFgColor", "Pixel", Gterm }, + { "cacheRasters", "String", Gterm }, + { "callback", "Callback", Arrow }, + { "callback", "Callback", AsciiSrc }, + { "callback", "Callback", AsciiText }, + { "callback", "Callback", Command }, + { "callback", "Callback", Grip }, + { "callback", "Callback", List }, + { "callback", "Callback", MenuButton }, + { "callback", "Callback", MultiList }, + { "callback", "Callback", Repeater }, + { "callback", "Callback", Sme }, + { "callback", "Callback", SmeBSB }, + { "callback", "Callback", SmeLine }, + { "callback", "Callback", Tabs }, + { "callback", "Callback", Toggle }, + { "canvasHeight", "Dimension", Panner }, + { "canvasWidth", "Dimension", Panner }, + { "changedCell", "Callback", Table }, + { "changedColumnWidth", "Callback", Table }, + { "changedRowHeight", "Callback", Table }, + { "children", "WidgetList", ApplicationShell }, + { "children", "WidgetList", Arrow }, + { "children", "WidgetList", Board }, + { "children", "WidgetList", Box }, + { "children", "WidgetList", Dialog }, + { "children", "WidgetList", Form }, + { "children", "WidgetList", Frame }, + { "children", "WidgetList", Group }, + { "children", "WidgetList", HTML }, + { "children", "WidgetList", Icon }, + { "children", "WidgetList", Layout }, + { "children", "WidgetList", OverrideShell }, + { "children", "WidgetList", Paned }, + { "children", "WidgetList", Porthole }, + { "children", "WidgetList", RadioGroup }, + { "children", "WidgetList", RowCol }, + { "children", "WidgetList", Scrollbar2 }, + { "children", "WidgetList", Shell }, + { "children", "WidgetList", SimpleMenu }, + { "children", "WidgetList", Slider2d }, + { "children", "WidgetList", Table }, + { "children", "WidgetList", TextBox }, + { "children", "WidgetList", TextButton }, + { "children", "WidgetList", TextToggle }, + { "children", "WidgetList", TopLevelShell }, + { "children", "WidgetList", TransientShell }, + { "children", "WidgetList", Tree }, + { "children", "WidgetList", Viewport }, + { "children", "WidgetList", WMShell }, + { "children", "WidgetList", XfwfCommon }, + { "children", "WidgetList", XfwfMenuBar }, + { "cmapInitialize", "Boolean", Gterm }, + { "cmapInterpolate", "Boolean", Gterm }, + { "cmapName", "String", Gterm }, + { "cmapShadow", "Int", Gterm }, + { "cmapUpdate", "Int", Gterm }, + { "color0", "Pixel", Gterm }, + { "color1", "Pixel", Gterm }, + { "color2", "Pixel", Gterm }, + { "color3", "Pixel", Gterm }, + { "color4", "Pixel", Gterm }, + { "color5", "Pixel", Gterm }, + { "color6", "Pixel", Gterm }, + { "color7", "Pixel", Gterm }, + { "color8", "Pixel", Gterm }, + { "color9", "Pixel", Gterm }, + { "colormap", "Colormap", ApplicationShell }, + { "colormap", "Colormap", Arrow }, + { "colormap", "Colormap", AsciiText }, + { "colormap", "Colormap", Board }, + { "colormap", "Colormap", Box }, + { "colormap", "Colormap", Command }, + { "colormap", "Colormap", Core }, + { "colormap", "Colormap", Dialog }, + { "colormap", "Colormap", Form }, + { "colormap", "Colormap", Frame }, + { "colormap", "Colormap", Grip }, + { "colormap", "Colormap", Group }, + { "colormap", "Colormap", Gterm }, + { "colormap", "Colormap", HTML }, + { "colormap", "Colormap", Icon }, + { "colormap", "Colormap", Label }, + { "colormap", "Colormap", Layout }, + { "colormap", "Colormap", List }, + { "colormap", "Colormap", MenuButton }, + { "colormap", "Colormap", MultiList }, + { "colormap", "Colormap", OverrideShell }, + { "colormap", "Colormap", Paned }, + { "colormap", "Colormap", Panner }, + { "colormap", "Colormap", Porthole }, + { "colormap", "Colormap", RadioGroup }, + { "colormap", "Colormap", Repeater }, + { "colormap", "Colormap", RowCol }, + { "colormap", "Colormap", Scrollbar }, + { "colormap", "Colormap", Scrollbar2 }, + { "colormap", "Colormap", Shell }, + { "colormap", "Colormap", Simple }, + { "colormap", "Colormap", SimpleMenu }, + { "colormap", "Colormap", Slider2d }, + { "colormap", "Colormap", StripChart }, + { "colormap", "Colormap", Table }, + { "colormap", "Colormap", Tabs }, + { "colormap", "Colormap", TextBox }, + { "colormap", "Colormap", TextButton }, + { "colormap", "Colormap", TextToggle }, + { "colormap", "Colormap", Toggle }, + { "colormap", "Colormap", TopLevelShell }, + { "colormap", "Colormap", TransientShell }, + { "colormap", "Colormap", Tree }, + { "colormap", "Colormap", Viewport }, + { "colormap", "Colormap", WMShell }, + { "colormap", "Colormap", XfwfCommon }, + { "colormap", "Colormap", XfwfMenuBar }, + { "columnForeground", "Pixel", Table }, + { "columnMargin", "Dimension", Table }, + { "columnSpacing", "Dimension", List }, + { "columnSpacing", "Dimension", MultiList }, + { "columnWidth", "Dimension", MultiList }, + { "columns", "Int", Group }, + { "columns", "Int", RadioGroup }, + { "columns", "Int", RowCol }, + { "columns", "Int", Table }, + { "columns", "Int", XfwfMenuBar }, + { "copyOnResize", "Boolean", Gterm }, + { "cornerRoundPercent", "Dimension", Command }, + { "cornerRoundPercent", "Dimension", MenuButton }, + { "cornerRoundPercent", "Dimension", Repeater }, + { "cornerRoundPercent", "Dimension", Toggle }, + { "createPopupChildProc", "Function", ApplicationShell }, + { "createPopupChildProc", "Function", OverrideShell }, + { "createPopupChildProc", "Function", Shell }, + { "createPopupChildProc", "Function", SimpleMenu }, + { "createPopupChildProc", "Function", TopLevelShell }, + { "createPopupChildProc", "Function", TransientShell }, + { "createPopupChildProc", "Function", WMShell }, + { "createTable", "Callback", Table }, + { "crosshairCursorColor", "Pixel", Gterm }, + { "cursor", "Cursor", Arrow }, + { "cursor", "Cursor", AsciiText }, + { "cursor", "Cursor", Board }, + { "cursor", "Cursor", Command }, + { "cursor", "Cursor", Frame }, + { "cursor", "Cursor", Grip }, + { "cursor", "Cursor", Group }, + { "cursor", "Cursor", Icon }, + { "cursor", "Cursor", Label }, + { "cursor", "Cursor", List }, + { "cursor", "Cursor", MenuButton }, + { "cursor", "Cursor", MultiList }, + { "cursor", "Cursor", Paned }, + { "cursor", "Cursor", Panner }, + { "cursor", "Cursor", RadioGroup }, + { "cursor", "Cursor", Repeater }, + { "cursor", "Cursor", RowCol }, + { "cursor", "Cursor", Scrollbar }, + { "cursor", "Cursor", Scrollbar2 }, + { "cursor", "Cursor", Separator }, + { "cursor", "Cursor", Simple }, + { "cursor", "Cursor", SimpleMenu }, + { "cursor", "Cursor", Slider2d }, + { "cursor", "Cursor", StripChart }, + { "cursor", "Cursor", TextBox }, + { "cursor", "Cursor", TextButton }, + { "cursor", "Cursor", TextToggle }, + { "cursor", "Cursor", Toggle }, + { "cursor", "Cursor", XfwfMenuBar }, + { "cursorName", "String", AsciiText }, + { "cursorName", "String", Command }, + { "cursorName", "String", Grip }, + { "cursorName", "String", Label }, + { "cursorName", "String", List }, + { "cursorName", "String", MenuButton }, + { "cursorName", "String", MultiList }, + { "cursorName", "String", Panner }, + { "cursorName", "String", Repeater }, + { "cursorName", "String", Separator }, + { "cursorName", "String", Scrollbar }, + { "cursorName", "String", Simple }, + { "cursorName", "String", StripChart }, + { "cursorName", "String", Toggle }, + { "dashedAnchorUnderlines", "Boolean", HTML }, + { "dashedVisitedAnchorUnderlines", "Boolean", HTML }, + { "dataCompression", "Boolean", AsciiSrc }, + { "dataCompression", "Boolean", AsciiText }, + { "debug", "Boolean", Layout }, + { "decay", "Int", Repeater }, + { "defaultColumns", "Int", List }, + { "defaultColumns", "Int", MultiList }, + { "defaultDistance", "Int", Dialog }, + { "defaultDistance", "Int", Form }, + { "defaultDistance", "Int", Viewport }, + { "defaultMarker", "String", Gterm }, + { "defaultScale", "Dimension", Panner }, + { "defaultWidth", "Int", Table }, + { "deiconifyWindow", "Boolean", Gterm }, + { "deleteColumn", "Callback", Table }, + { "deleteRow", "Callback", Table }, + { "deleteTable", "Callback", Table }, + { "delayImageLoads", "Boolean", HTML }, + { "depth", "Int", ApplicationShell }, + { "depth", "Int", Arrow }, + { "depth", "Int", AsciiText }, + { "depth", "Int", Board }, + { "depth", "Int", Box }, + { "depth", "Int", Command }, + { "depth", "Int", Core }, + { "depth", "Int", Dialog }, + { "depth", "Int", Form }, + { "depth", "Int", Frame }, + { "depth", "Int", Grip }, + { "depth", "Int", Group }, + { "depth", "Int", Gterm }, + { "depth", "Int", HTML }, + { "depth", "Int", Icon }, + { "depth", "Int", Label }, + { "depth", "Int", Layout }, + { "depth", "Int", List }, + { "depth", "Int", MenuButton }, + { "depth", "Int", MultiList }, + { "depth", "Int", OverrideShell }, + { "depth", "Int", Paned }, + { "depth", "Int", Panner }, + { "depth", "Int", Porthole }, + { "depth", "Int", RadioGroup }, + { "depth", "Int", Repeater }, + { "depth", "Int", RowCol }, + { "depth", "Int", Scrollbar }, + { "depth", "Int", Scrollbar2 }, + { "depth", "Int", Shell }, + { "depth", "Int", Simple }, + { "depth", "Int", SimpleMenu }, + { "depth", "Int", Slider2d }, + { "depth", "Int", StripChart }, + { "depth", "Int", Table }, + { "depth", "Int", TextBox }, + { "depth", "Int", TextButton }, + { "depth", "Int", TextToggle }, + { "depth", "Int", Toggle }, + { "depth", "Int", TopLevelShell }, + { "depth", "Int", TransientShell }, + { "depth", "Int", Tree }, + { "depth", "Int", Viewport }, + { "depth", "Int", WMShell }, + { "depth", "Int", XfwfCommon }, + { "depth", "Int", XfwfMenuBar }, + { "destroyCallback", "Callback", ApplicationShell }, + { "destroyCallback", "Callback", Arrow }, + { "destroyCallback", "Callback", AsciiSink }, + { "destroyCallback", "Callback", AsciiSrc }, + { "destroyCallback", "Callback", AsciiText }, + { "destroyCallback", "Callback", Board }, + { "destroyCallback", "Callback", Box }, + { "destroyCallback", "Callback", Command }, + { "destroyCallback", "Callback", Core }, + { "destroyCallback", "Callback", Dialog }, + { "destroyCallback", "Callback", Form }, + { "destroyCallback", "Callback", Frame }, + { "destroyCallback", "Callback", Grip }, + { "destroyCallback", "Callback", Group }, + { "destroyCallback", "Callback", Gterm }, + { "destroyCallback", "Callback", HTML }, + { "destroyCallback", "Callback", Icon }, + { "destroyCallback", "Callback", Label }, + { "destroyCallback", "Callback", Layout }, + { "destroyCallback", "Callback", List }, + { "destroyCallback", "Callback", MenuButton }, + { "destroyCallback", "Callback", MultiList }, + { "destroyCallback", "Callback", Object }, + { "destroyCallback", "Callback", OverrideShell }, + { "destroyCallback", "Callback", Paned }, + { "destroyCallback", "Callback", Panner }, + { "destroyCallback", "Callback", Porthole }, + { "destroyCallback", "Callback", RadioGroup }, + { "destroyCallback", "Callback", Repeater }, + { "destroyCallback", "Callback", RowCol }, + { "destroyCallback", "Callback", Scrollbar }, + { "destroyCallback", "Callback", Scrollbar2 }, + { "destroyCallback", "Callback", Shell }, + { "destroyCallback", "Callback", Simple }, + { "destroyCallback", "Callback", SimpleMenu }, + { "destroyCallback", "Callback", Slider2d }, + { "destroyCallback", "Callback", Sme }, + { "destroyCallback", "Callback", SmeBSB }, + { "destroyCallback", "Callback", SmeLine }, + { "destroyCallback", "Callback", StripChart }, + { "destroyCallback", "Callback", Table }, + { "destroyCallback", "Callback", TextBox }, + { "destroyCallback", "Callback", TextButton }, + { "destroyCallback", "Callback", TextToggle }, + { "destroyCallback", "Callback", Toggle }, + { "destroyCallback", "Callback", TopLevelShell }, + { "destroyCallback", "Callback", TransientShell }, + { "destroyCallback", "Callback", Tree }, + { "destroyCallback", "Callback", Viewport }, + { "destroyCallback", "Callback", WMShell }, + { "destroyCallback", "Callback", XfwfCommon }, + { "destroyCallback", "Callback", XfwfMenuBar }, + { "dialogBgColor", "Pixel", Gterm }, + { "dialogFgColor", "Pixel", Gterm }, + { "dialogFont1", "FontStruct", Gterm }, + { "dialogFont2", "FontStruct", Gterm }, + { "dialogFont3", "FontStruct", Gterm }, + { "dialogFont4", "FontStruct", Gterm }, + { "dialogFont5", "FontStruct", Gterm }, + { "dialogFont6", "FontStruct", Gterm }, + { "dialogFont7", "FontStruct", Gterm }, + { "dialogFont8", "FontStruct", Gterm }, + { "direction", "Alignment", Arrow }, + { "displayCaret", "Boolean", AsciiText }, + { "displayNonprinting", "Boolean", AsciiSink }, + { "displayNonprinting", "Boolean", AsciiText }, + { "displayPosition", "Int", AsciiText }, + { "echo", "Boolean", AsciiSink }, + { "echo", "Boolean", AsciiText }, + { "editBackground", "Pixel", Table }, + { "editForeground", "Pixel", Table }, + { "editable", "Boolean", Table }, + { "editType", "EditMode", AsciiSrc }, + { "editType", "EditMode", AsciiText }, + { "encoding", "UnsignedChar", Command }, + { "encoding", "UnsignedChar", Label }, + { "encoding", "UnsignedChar", MenuButton }, + { "encoding", "UnsignedChar", Repeater }, + { "encoding", "UnsignedChar", Table }, + { "encoding", "UnsignedChar", Toggle }, + { "encoding", "UnsignedChar", Table }, + { "fancySelections", "Boolean", HTML }, + { "fixedFont", "FontStruct", HTML }, + { "fixedboldFont", "FontStruct", HTML }, + { "fixeditalicFont", "FontStruct", HTML }, + { "flash", "Boolean", Repeater }, + { "font", "FontStruct", AsciiSink }, + { "font", "FontStruct", AsciiText }, + { "font", "FontStruct", Command }, + { "font", "FontStruct", Group }, + { "font", "FontStruct", HTML }, + { "font", "FontStruct", Label }, + { "font", "FontStruct", List }, + { "font", "FontStruct", ListTree }, + { "font", "FontStruct", MenuButton }, + { "font", "FontStruct", MultiList }, + { "font", "FontStruct", RadioGroup }, + { "font", "FontStruct", Repeater }, + { "font", "FontStruct", Slider2d }, + { "font", "FontStruct", SmeBSB }, + { "font", "FontStruct", Tabs }, + { "font", "FontStruct", Table }, + { "font", "FontStruct", TextBox }, + { "font", "FontStruct", TextButton }, + { "font", "FontStruct", TextToggle }, + { "font", "FontStruct", Toggle }, + { "footerText", "String", HTML }, + { "forceBars", "Boolean", Viewport }, + { "forceColumns", "Boolean", List }, + { "forceColumns", "Boolean", MultiList }, + { "foreground", "Pixel", Arrow }, + { "foreground", "Pixel", AsciiSink }, + { "foreground", "Pixel", AsciiText }, + { "foreground", "Pixel", Command }, + { "foreground", "Pixel", Grip }, + { "foreground", "Pixel", Group }, + { "foreground", "Pixel", HTML }, + { "foreground", "Pixel", Label }, + { "foreground", "Pixel", List }, + { "foreground", "Pixel", ListTree }, + { "foreground", "Pixel", MenuButton }, + { "foreground", "Pixel", MultiList }, + { "foreground", "Pixel", Panner }, + { "foreground", "Pixel", RadioGroup }, + { "foreground", "Pixel", Repeater }, + { "foreground", "Pixel", Scrollbar }, + { "foreground", "Pixel", Separator }, + { "foreground", "Pixel", Slider2d }, + { "foreground", "Pixel", SmeBSB }, + { "foreground", "Pixel", SmeLine }, + { "foreground", "Pixel", StripChart }, + { "foreground", "Pixel", Table }, + { "foreground", "Pixel", TextBox }, + { "foreground", "Pixel", TextButton }, + { "foreground", "Pixel", TextToggle }, + { "foreground", "Pixel", Toggle }, + { "foreground", "Pixel", Tree }, + { "frameType", "FrameType", Arrow }, + { "frameType", "FrameType", Board }, + { "frameType", "FrameType", Frame }, + { "frameType", "FrameType", Group }, + { "frameType", "FrameType", Icon }, + { "frameType", "FrameType", RadioGroup }, + { "frameType", "FrameType", RowCol }, + { "frameType", "FrameType", Scrollbar2 }, + { "frameType", "FrameType", Slider2d }, + { "frameType", "FrameType", TextBox }, + { "frameType", "FrameType", TextButton }, + { "frameType", "FrameType", TextToggle }, + { "frameType", "FrameType", XfwfMenuBar }, + { "frameWidth", "Dimension", Arrow }, + { "frameWidth", "Dimension", Board }, + { "frameWidth", "Dimension", Frame }, + { "frameWidth", "Dimension", Group }, + { "frameWidth", "Dimension", Icon }, + { "frameWidth", "Dimension", RadioGroup }, + { "frameWidth", "Dimension", RowCol }, + { "frameWidth", "Dimension", Scrollbar2 }, + { "frameWidth", "Dimension", Slider2d }, + { "frameWidth", "Dimension", TextBox }, + { "frameWidth", "Dimension", TextButton }, + { "frameWidth", "Dimension", TextToggle }, + { "frameWidth", "Dimension", XfwfMenuBar }, + { "fromHoriz", "Widget", Dialog }, + { "fromHoriz", "Widget", Form }, + { "fromHoriz", "Widget", Viewport }, + { "fromVert", "Widget", Dialog }, + { "fromVert", "Widget", Form }, + { "fromVert", "Widget", Viewport }, + { "geometry", "String", ApplicationShell }, + { "geometry", "String", OverrideShell }, + { "geometry", "String", Shell }, + { "geometry", "String", SimpleMenu }, + { "geometry", "String", TopLevelShell }, + { "geometry", "String", TransientShell }, + { "geometry", "String", WMShell }, + { "getValue", "Callback", StripChart }, + { "ginmodeBlinkInterval", "Int", Gterm }, + { "ginmodeCursor", "String", Gterm }, + { "ginmodeCursorBgColor", "Pixel", Gterm }, + { "ginmodeCursorFgColor", "Pixel", Gterm }, + { "gravity", "Gravity", Tree }, + { "gripCursor", "Cursor", Paned }, + { "gripIndent", "Position", Paned }, + { "gripTranslations", "TranslationTable", Paned }, + { "hSpace", "Dimension", Box }, + { "hSpace", "Dimension", Tree }, + { "header1Font1Font", "FontStruct", HTML }, + { "header2Font2Font", "FontStruct", HTML }, + { "header3Font3Font", "FontStruct", HTML }, + { "header4Font4Font", "FontStruct", HTML }, + { "header5Font5Font", "FontStruct", HTML }, + { "header6Font6Font", "FontStruct", HTML }, + { "headerText", "String", HTML }, + { "height", "Dimension", ApplicationShell }, + { "height", "Dimension", Arrow }, + { "height", "Dimension", AsciiText }, + { "height", "Dimension", Board }, + { "height", "Dimension", Box }, + { "height", "Dimension", Command }, + { "height", "Dimension", Core }, + { "height", "Dimension", Dialog }, + { "height", "Dimension", Form }, + { "height", "Dimension", Frame }, + { "height", "Dimension", Grip }, + { "height", "Dimension", Group }, + { "height", "Dimension", Gterm }, + { "height", "Dimension", HTML }, + { "height", "Dimension", Icon }, + { "height", "Dimension", Label }, + { "height", "Dimension", Layout }, + { "height", "Dimension", List }, + { "height", "Dimension", MenuButton }, + { "height", "Dimension", MultiList }, + { "height", "Dimension", OverrideShell }, + { "height", "Dimension", Paned }, + { "height", "Dimension", Panner }, + { "height", "Dimension", Porthole }, + { "height", "Dimension", RadioGroup }, + { "height", "Dimension", Repeater }, + { "height", "Dimension", RowCol }, + { "height", "Dimension", Scrollbar }, + { "height", "Dimension", Scrollbar2 }, + { "height", "Dimension", Separator }, + { "height", "Dimension", Shell }, + { "height", "Dimension", Simple }, + { "height", "Dimension", SimpleMenu }, + { "height", "Dimension", Slider2d }, + { "height", "Dimension", Sme }, + { "height", "Dimension", SmeBSB }, + { "height", "Dimension", SmeLine }, + { "height", "Dimension", StripChart }, + { "height", "Dimension", Table }, + { "height", "Dimension", TextBox }, + { "height", "Dimension", TextButton }, + { "height", "Dimension", TextToggle }, + { "height", "Dimension", Toggle }, + { "height", "Dimension", TopLevelShell }, + { "height", "Dimension", TransientShell }, + { "height", "Dimension", Tree }, + { "height", "Dimension", Viewport }, + { "height", "Dimension", WMShell }, + { "height", "Dimension", XfwfCommon }, + { "height", "Dimension", XfwfMenuBar }, + { "heightInc", "Int", ApplicationShell }, + { "heightInc", "Int", TopLevelShell }, + { "heightInc", "Int", TransientShell }, + { "heightInc", "Int", WMShell }, + { "highlight", "Pixel", StripChart }, + { "highlightBackground", "Pixel", MultiList }, + { "highlightCallback", "Callback", ListTree }, + { "highlightColor", "Pixel", Arrow }, + { "highlightColor", "Pixel", Board }, + { "highlightColor", "Pixel", Frame }, + { "highlightColor", "Pixel", Group }, + { "highlightColor", "Pixel", Icon }, + { "highlightColor", "Pixel", RadioGroup }, + { "highlightColor", "Pixel", RowCol }, + { "highlightColor", "Pixel", Scrollbar2 }, + { "highlightColor", "Pixel", Slider2d }, + { "highlightColor", "Pixel", TextBox }, + { "highlightColor", "Pixel", TextButton }, + { "highlightColor", "Pixel", TextToggle }, + { "highlightColor", "Pixel", XfwfCommon }, + { "highlightColor", "Pixel", XfwfMenuBar }, + { "highlightForeground", "Pixel", MultiList }, + { "highlightPixmap", "Pixmap", Arrow }, + { "highlightPixmap", "Pixmap", Board }, + { "highlightPixmap", "Pixmap", Frame }, + { "highlightPixmap", "Pixmap", Group }, + { "highlightPixmap", "Pixmap", Icon }, + { "highlightPixmap", "Pixmap", RadioGroup }, + { "highlightPixmap", "Pixmap", RowCol }, + { "highlightPixmap", "Pixmap", Scrollbar2 }, + { "highlightPixmap", "Pixmap", Slider2d }, + { "highlightPixmap", "Pixmap", TextBox }, + { "highlightPixmap", "Pixmap", TextButton }, + { "highlightPixmap", "Pixmap", TextToggle }, + { "highlightPixmap", "Pixmap", XfwfCommon }, + { "highlightPixmap", "Pixmap", XfwfMenuBar }, + { "highlightThickness", "Dimension", Arrow }, + { "highlightThickness", "Dimension", Board }, + { "highlightThickness", "Dimension", Command }, + { "highlightThickness", "Dimension", Frame }, + { "highlightThickness", "Dimension", Group }, + { "highlightThickness", "Dimension", Icon }, + { "highlightThickness", "Dimension", MenuButton }, + { "highlightThickness", "Dimension", RadioGroup }, + { "highlightThickness", "Dimension", Repeater }, + { "highlightThickness", "Dimension", RowCol }, + { "highlightThickness", "Dimension", Scrollbar2 }, + { "highlightThickness", "Dimension", Slider2d }, + { "highlightThickness", "Dimension", TextBox }, + { "highlightThickness", "Dimension", TextButton }, + { "highlightThickness", "Dimension", TextToggle }, + { "highlightThickness", "Dimension", Toggle }, + { "highlightThickness", "Dimension", XfwfCommon }, + { "highlightThickness", "Dimension", XfwfMenuBar }, + { "horizDistance", "Int", Dialog }, + { "horizDistance", "Int", Form }, + { "horizDistance", "Int", Viewport }, + { "horizontalBetweenCursor", "Cursor", Paned }, + { "horizontalGripCursor", "Cursor", Paned }, + { "horizontalScroll", "Widget", Table }, + { "horizontalScrollBar", "Widget", HTML }, + { "horizontalScrollOnTop", "Boolean", HTML }, + { "horizontalSpacing", "Dimension", ListTree }, + { "hunit", "Float", Arrow }, + { "hunit", "Float", Board }, + { "hunit", "Float", Group }, + { "hunit", "Float", Icon }, + { "hunit", "Float", RadioGroup }, + { "hunit", "Float", RowCol }, + { "hunit", "Float", Scrollbar2 }, + { "hunit", "Float", Slider2d }, + { "hunit", "Float", TextBox }, + { "hunit", "Float", TextButton }, + { "hunit", "Float", TextToggle }, + { "hunit", "Float", XfwfMenuBar }, + { "icon", "Bitmap", Dialog }, + { "iconMask", "Bitmap", ApplicationShell }, + { "iconMask", "Bitmap", TopLevelShell }, + { "iconMask", "Bitmap", TransientShell }, + { "iconMask", "Bitmap", WMShell }, + { "iconName", "String", ApplicationShell }, + { "iconName", "String", TopLevelShell }, + { "iconNameEncoding", "Atom", ApplicationShell }, + { "iconNameEncoding", "Atom", TopLevelShell }, + { "iconPixmap", "Bitmap", ApplicationShell }, + { "iconPixmap", "Bitmap", TopLevelShell }, + { "iconPixmap", "Bitmap", TransientShell }, + { "iconPixmap", "Bitmap", WMShell }, + { "iconWindow", "Window", ApplicationShell }, + { "iconWindow", "Window", TopLevelShell }, + { "iconWindow", "Window", TransientShell }, + { "iconWindow", "Window", WMShell }, + { "iconX", "Int", ApplicationShell }, + { "iconX", "Int", TopLevelShell }, + { "iconX", "Int", TransientShell }, + { "iconX", "Int", WMShell }, + { "iconY", "Int", ApplicationShell }, + { "iconY", "Int", TopLevelShell }, + { "iconY", "Int", TransientShell }, + { "iconY", "Int", WMShell }, + { "iconic", "Boolean", ApplicationShell }, + { "iconic", "Boolean", TopLevelShell }, + { "idleCursor", "String", Gterm }, + { "idleCursorBgColor", "Pixel", Gterm }, + { "idleCursorFgColor", "Pixel", Gterm }, + { "image", "Icon", Icon }, + { "imageBorders", "Boolean", HTML }, + { "increment", "Float", Scrollbar2 }, + { "indent", "Dimension", ListTree }, + { "initialDelay", "Cardinal", Arrow }, + { "initialDelay", "Cardinal", Scrollbar2 }, + { "initialDelay", "Int", Repeater }, + { "initialState", "InitialState", ApplicationShell }, + { "initialState", "InitialState", TopLevelShell }, + { "initialState", "InitialState", TransientShell }, + { "initialState", "InitialState", WMShell }, + { "insensitiveContrast", "Int", Tabs }, + { "innerOffset", "Dimension", Arrow }, + { "innerOffset", "Dimension", Board }, + { "innerOffset", "Dimension", Frame }, + { "innerOffset", "Dimension", Group }, + { "innerOffset", "Dimension", Icon }, + { "innerOffset", "Dimension", RadioGroup }, + { "innerOffset", "Dimension", RowCol }, + { "innerOffset", "Dimension", Scrollbar2 }, + { "innerOffset", "Dimension", Slider2d }, + { "innerOffset", "Dimension", TextBox }, + { "innerOffset", "Dimension", TextButton }, + { "innerOffset", "Dimension", TextToggle }, + { "innerOffset", "Dimension", XfwfMenuBar }, + { "input", "Bool", ApplicationShell }, + { "input", "Bool", TopLevelShell }, + { "input", "Bool", TransientShell }, + { "input", "Bool", WMShell }, + { "insensitiveBorder", "Pixmap", AsciiText }, + { "insensitiveBorder", "Pixmap", Command }, + { "insensitiveBorder", "Pixmap", Grip }, + { "insensitiveBorder", "Pixmap", Label }, + { "insensitiveBorder", "Pixmap", List }, + { "insensitiveBorder", "Pixmap", MenuButton }, + { "insensitiveBorder", "Pixmap", MultiList }, + { "insensitiveBorder", "Pixmap", Panner }, + { "insensitiveBorder", "Pixmap", Repeater }, + { "insensitiveBorder", "Pixmap", Scrollbar }, + { "insensitiveBorder", "Pixmap", Simple }, + { "insensitiveBorder", "Pixmap", StripChart }, + { "insensitiveBorder", "Pixmap", Toggle }, + { "insertPosition", "Function", ApplicationShell }, + { "insertPosition", "Function", Arrow }, + { "insertPosition", "Function", Board }, + { "insertPosition", "Function", Box }, + { "insertPosition", "Function", Dialog }, + { "insertPosition", "Function", Form }, + { "insertPosition", "Function", Frame }, + { "insertPosition", "Function", Group }, + { "insertPosition", "Function", HTML }, + { "insertPosition", "Function", Icon }, + { "insertPosition", "Function", Layout }, + { "insertPosition", "Function", OverrideShell }, + { "insertPosition", "Function", Paned }, + { "insertPosition", "Function", Porthole }, + { "insertPosition", "Function", RadioGroup }, + { "insertPosition", "Function", RowCol }, + { "insertPosition", "Function", Scrollbar2 }, + { "insertPosition", "Function", Shell }, + { "insertPosition", "Function", SimpleMenu }, + { "insertPosition", "Function", Slider2d }, + { "insertPosition", "Function", TextBox }, + { "insertPosition", "Function", TextButton }, + { "insertPosition", "Function", TextToggle }, + { "insertPosition", "Function", TopLevelShell }, + { "insertPosition", "Function", TransientShell }, + { "insertPosition", "Function", Tree }, + { "insertPosition", "Function", Viewport }, + { "insertPosition", "Function", WMShell }, + { "insertPosition", "Function", XfwfCommon }, + { "insertPosition", "Function", XfwfMenuBar }, + { "insertPosition", "Int", AsciiText }, + { "internalBorderColor", "Pixel", Paned }, + { "internalBorderWidth", "Dimension", Paned }, + { "internalHeight", "Dimension", Command }, + { "internalHeight", "Dimension", Label }, + { "internalHeight", "Dimension", List }, + { "internalHeight", "Dimension", MenuButton }, + { "internalHeight", "Dimension", Repeater }, + { "internalHeight", "Dimension", Table }, + { "internalHeight", "Dimension", Tabs }, + { "internalHeight", "Dimension", Toggle }, + { "internalSpace", "Dimension", Panner }, + { "internalWidth", "Dimension", Command }, + { "internalWidth", "Dimension", Label }, + { "internalWidth", "Dimension", List }, + { "internalWidth", "Dimension", MenuButton }, + { "internalWidth", "Dimension", Repeater }, + { "internalWidth", "Dimension", Table }, + { "internalWidth", "Dimension", Tabs }, + { "internalWidth", "Dimension", Toggle }, + { "isIndex", "Boolean", HTML }, + { "italicFont", "FontStruct", HTML }, + { "jumpProc", "Callback", Scrollbar }, + { "jumpScroll", "Int", StripChart }, + { "justify", "Justify", Command }, + { "justify", "Justify", Label }, + { "justify", "Justify", MenuButton }, + { "justify", "Justify", Repeater }, + { "justify", "Justify", SmeBSB }, + { "justify", "Justify", Table }, + { "justify", "Justify", Toggle }, + { "label", "String", Command }, + { "label", "String", Dialog }, + { "label", "String", Group }, + { "label", "String", Label }, + { "label", "String", MenuButton }, + { "label", "String", RadioGroup }, + { "label", "String", Repeater }, + { "label", "String", SimpleMenu }, + { "label", "String", Slider2d }, + { "label", "String", SmeBSB }, + { "label", "String", TextBox }, + { "label", "String", TextButton }, + { "label", "String", TextToggle }, + { "label", "String", Toggle }, + { "labelClass", "Pointer", SimpleMenu }, + { "labelShadowWidth", "Dimension", Table }, + { "labels", "StringArray", RadioGroup }, + { "layout", "Layout", Layout }, + { "leafPixmap", "Bitmap", ListTree }, + { "leafOpenPixmap", "Bitmap", ListTree }, + { "leafCallback", "Callback", ListTree }, + { "left", "EdgeType", Dialog }, + { "left", "EdgeType", Form }, + { "left", "EdgeType", Viewport }, + { "leftBitmap", "Bitmap", Command }, + { "leftBitmap", "Bitmap", Label }, + { "leftBitmap", "Bitmap", MenuButton }, + { "leftBitmap", "Bitmap", Repeater }, + { "leftBitmap", "Bitmap", SmeBSB }, + { "leftBitmap", "Bitmap", Toggle }, + { "leftCursor", "Cursor", Paned }, + { "leftMargin", "Dimension", Slider2d }, + { "leftMargin", "Dimension", SmeBSB }, + { "leftMargin", "Dimension", TextBox }, + { "leftMargin", "Dimension", TextButton }, + { "leftMargin", "Dimension", TextToggle }, + { "leftMargin", "Position", AsciiText }, + { "length", "Dimension", Scrollbar }, + { "length", "Int", AsciiSrc }, + { "length", "Int", AsciiText }, + { "lineWidth", "Dimension", Panner }, + { "lineWidth", "Dimension", SmeLine }, + { "lineWidth", "Dimension", Tree }, + { "lineWidth", "Dimension", ListTree }, + { "linkCallback", "Callback", HTML }, + { "list", "Pointer", List }, + { "list", "Pointer", MultiList }, + { "listingFont", "FontStruct", HTML }, + { "literal", "Boolean", Table }, + { "literalWidth", "Int", Table }, + { "location", "String", Arrow }, + { "location", "String", Board }, + { "location", "String", Group }, + { "location", "String", Icon }, + { "location", "String", RadioGroup }, + { "location", "String", RowCol }, + { "location", "String", Scrollbar2 }, + { "location", "String", Slider2d }, + { "location", "String", TextBox }, + { "location", "String", TextButton }, + { "location", "String", TextToggle }, + { "location", "String", XfwfMenuBar }, + { "longest", "Int", List }, + { "longest", "Int", MultiList }, + { "lowerCursor", "Cursor", Paned }, + { "mappedWhenManaged", "Boolean", ApplicationShell }, + { "mappedWhenManaged", "Boolean", Arrow }, + { "mappedWhenManaged", "Boolean", AsciiText }, + { "mappedWhenManaged", "Boolean", Board }, + { "mappedWhenManaged", "Boolean", Box }, + { "mappedWhenManaged", "Boolean", Command }, + { "mappedWhenManaged", "Boolean", Core }, + { "mappedWhenManaged", "Boolean", Dialog }, + { "mappedWhenManaged", "Boolean", Form }, + { "mappedWhenManaged", "Boolean", Frame }, + { "mappedWhenManaged", "Boolean", Grip }, + { "mappedWhenManaged", "Boolean", Group }, + { "mappedWhenManaged", "Boolean", Gterm }, + { "mappedWhenManaged", "Boolean", HTML }, + { "mappedWhenManaged", "Boolean", Icon }, + { "mappedWhenManaged", "Boolean", Label }, + { "mappedWhenManaged", "Boolean", Layout }, + { "mappedWhenManaged", "Boolean", List }, + { "mappedWhenManaged", "Boolean", MenuButton }, + { "mappedWhenManaged", "Boolean", MultiList }, + { "mappedWhenManaged", "Boolean", OverrideShell }, + { "mappedWhenManaged", "Boolean", Paned }, + { "mappedWhenManaged", "Boolean", Panner }, + { "mappedWhenManaged", "Boolean", Porthole }, + { "mappedWhenManaged", "Boolean", RadioGroup }, + { "mappedWhenManaged", "Boolean", Repeater }, + { "mappedWhenManaged", "Boolean", RowCol }, + { "mappedWhenManaged", "Boolean", Scrollbar }, + { "mappedWhenManaged", "Boolean", Scrollbar2 }, + { "mappedWhenManaged", "Boolean", Separator }, + { "mappedWhenManaged", "Boolean", Shell }, + { "mappedWhenManaged", "Boolean", Simple }, + { "mappedWhenManaged", "Boolean", SimpleMenu }, + { "mappedWhenManaged", "Boolean", Slider2d }, + { "mappedWhenManaged", "Boolean", StripChart }, + { "mappedWhenManaged", "Boolean", Table }, + { "mappedWhenManaged", "Boolean", TextBox }, + { "mappedWhenManaged", "Boolean", TextButton }, + { "mappedWhenManaged", "Boolean", TextToggle }, + { "mappedWhenManaged", "Boolean", Toggle }, + { "mappedWhenManaged", "Boolean", TopLevelShell }, + { "mappedWhenManaged", "Boolean", TransientShell }, + { "mappedWhenManaged", "Boolean", Tree }, + { "mappedWhenManaged", "Boolean", Viewport }, + { "mappedWhenManaged", "Boolean", WMShell }, + { "mappedWhenManaged", "Boolean", XfwfCommon }, + { "mappedWhenManaged", "Boolean", XfwfMenuBar }, + { "margin", "Dimension", ListTree }, + { "marginHeight", "Dimension", HTML }, + { "marginWidth", "Dimension", HTML }, + { "markerBoxKnotColor", "Pixel", Gterm }, + { "markerBoxKnotSize", "Int", Gterm }, + { "markerBoxLineColor", "Pixel", Gterm }, + { "markerCircleKnotColor", "Pixel", Gterm }, + { "markerCircleKnotSize", "Int", Gterm }, + { "markerCircleLineColor", "Pixel", Gterm }, + { "markerCursorBgColor", "Pixel", Gterm }, + { "markerCursorFgColor", "Pixel", Gterm }, + { "markerEllipseKnotColor", "Pixel", Gterm }, + { "markerEllipseKnotSize", "Int", Gterm }, + { "markerEllipseLineColor", "Pixel", Gterm }, + { "markerFill", "Boolean", Gterm }, + { "markerFillBgColor", "Pixel", Gterm }, + { "markerFillColor", "Pixel", Gterm }, + { "markerFillStyle", "Int", Gterm }, + { "markerHighlightColor", "Pixel", Gterm }, + { "markerHighlightWidth", "Int", Gterm }, + { "markerLineKnotColor", "Pixel", Gterm }, + { "markerLineKnotSize", "Int", Gterm }, + { "markerLineLineColor", "Pixel", Gterm }, + { "markerLineStyle", "Int", Gterm }, + { "markerLineWidth", "Int", Gterm }, + { "markerPgonKnotColor", "Pixel", Gterm }, + { "markerPgonKnotSize", "Int", Gterm }, + { "markerPgonLineColor", "Pixel", Gterm }, + { "markerRectKnotColor", "Pixel", Gterm }, + { "markerRectKnotSize", "Int", Gterm }, + { "markerRectLineColor", "Pixel", Gterm }, + { "markerTextBgColor", "Pixel", Gterm }, + { "markerTextBorder", "Int", Gterm }, + { "markerTextColor", "Pixel", Gterm }, + { "markerTextFont", "FontStruct", Gterm }, + { "markerTextLineColor", "Pixel", Gterm }, + { "markerTextString", "String", Gterm }, + { "markerTranslations", "String", Gterm }, + { "maskNumber", "Int", Table }, + { "max", "Dimension", Paned }, + { "maxAspectX", "Int", ApplicationShell }, + { "maxAspectX", "Int", TopLevelShell }, + { "maxAspectX", "Int", TransientShell }, + { "maxAspectX", "Int", WMShell }, + { "maxAspectY", "Int", ApplicationShell }, + { "maxAspectY", "Int", TopLevelShell }, + { "maxAspectY", "Int", TransientShell }, + { "maxAspectY", "Int", WMShell }, + { "maxColors", "Int", Gterm }, + { "maxHeight", "Int", ApplicationShell }, + { "maxHeight", "Int", TopLevelShell }, + { "maxHeight", "Int", TransientShell }, + { "maxHeight", "Int", WMShell }, + { "maxMappings", "Int", Gterm }, + { "maxRasters", "Int", Gterm }, + { "maxSelectable", "Int", MultiList }, + { "maxWidth", "Int", ApplicationShell }, + { "maxWidth", "Int", TopLevelShell }, + { "maxWidth", "Int", TransientShell }, + { "maxWidth", "Int", WMShell }, + { "menuName", "String", MenuButton }, + { "menuOnScreen", "Boolean", SimpleMenu }, + { "min", "Dimension", Paned }, + { "minAspectX", "Int", ApplicationShell }, + { "minAspectX", "Int", TopLevelShell }, + { "minAspectX", "Int", TransientShell }, + { "minAspectX", "Int", WMShell }, + { "minAspectY", "Int", ApplicationShell }, + { "minAspectY", "Int", TopLevelShell }, + { "minAspectY", "Int", TransientShell }, + { "minAspectY", "Int", WMShell }, + { "minHeight", "Int", ApplicationShell }, + { "minHeight", "Int", TopLevelShell }, + { "minHeight", "Int", TransientShell }, + { "minHeight", "Int", WMShell }, + { "minScale", "Int", StripChart }, + { "minWidth", "Int", ApplicationShell }, + { "minWidth", "Int", TopLevelShell }, + { "minWidth", "Int", TransientShell }, + { "minWidth", "Int", WMShell }, + { "minimumDelay", "Int", Repeater }, + { "minimumThumb", "Dimension", Scrollbar }, + { "minsize", "Dimension", Scrollbar2 }, + { "minsize", "Dimension", Slider2d }, + { "nearEdge", "Int", Gterm }, + { "nearVertex", "Int", Gterm }, + { "nextTop", "Callback", Arrow }, + { "nextTop", "Callback", Board }, + { "nextTop", "Callback", Frame }, + { "nextTop", "Callback", Group }, + { "nextTop", "Callback", Icon }, + { "nextTop", "Callback", RadioGroup }, + { "nextTop", "Callback", RowCol }, + { "nextTop", "Callback", Scrollbar2 }, + { "nextTop", "Callback", Slider2d }, + { "nextTop", "Callback", TextBox }, + { "nextTop", "Callback", TextButton }, + { "nextTop", "Callback", TextToggle }, + { "nextTop", "Callback", XfwfCommon }, + { "nextTop", "Callback", XfwfMenuBar }, + { "numChildren", "Cardinal", ApplicationShell }, + { "numChildren", "Cardinal", Arrow }, + { "numChildren", "Cardinal", Board }, + { "numChildren", "Cardinal", Box }, + { "numChildren", "Cardinal", Dialog }, + { "numChildren", "Cardinal", Form }, + { "numChildren", "Cardinal", Frame }, + { "numChildren", "Cardinal", Group }, + { "numChildren", "Cardinal", HTML }, + { "numChildren", "Cardinal", Icon }, + { "numChildren", "Cardinal", Layout }, + { "numChildren", "Cardinal", OverrideShell }, + { "numChildren", "Cardinal", Paned }, + { "numChildren", "Cardinal", Porthole }, + { "numChildren", "Cardinal", RadioGroup }, + { "numChildren", "Cardinal", RowCol }, + { "numChildren", "Cardinal", Scrollbar2 }, + { "numChildren", "Cardinal", Shell }, + { "numChildren", "Cardinal", SimpleMenu }, + { "numChildren", "Cardinal", Slider2d }, + { "numChildren", "Cardinal", TextBox }, + { "numChildren", "Cardinal", TextButton }, + { "numChildren", "Cardinal", TextToggle }, + { "numChildren", "Cardinal", TopLevelShell }, + { "numChildren", "Cardinal", TransientShell }, + { "numChildren", "Cardinal", Table }, + { "numChildren", "Cardinal", Tree }, + { "numChildren", "Cardinal", Viewport }, + { "numChildren", "Cardinal", WMShell }, + { "numChildren", "Cardinal", XfwfCommon }, + { "numChildren", "Cardinal", XfwfMenuBar }, + { "numberStrings", "Int", List }, + { "numberStrings", "Int", MultiList }, + { "offCallback", "Callback", TextToggle }, + { "offIcon", "Icon", TextToggle }, + { "on", "Boolean", TextToggle }, + { "onCallback", "Callback", TextToggle }, + { "onIcon", "Icon", TextToggle }, + { "orientation", "Orientation", Box }, + { "orientation", "Orientation", Paned }, + { "orientation", "Orientation", Scrollbar }, + { "outerOffset", "Dimension", Arrow }, + { "outerOffset", "Dimension", Board }, + { "outerOffset", "Dimension", Frame }, + { "outerOffset", "Dimension", Group }, + { "outerOffset", "Dimension", Icon }, + { "outerOffset", "Dimension", RadioGroup }, + { "outerOffset", "Dimension", RowCol }, + { "outerOffset", "Dimension", Scrollbar2 }, + { "outerOffset", "Dimension", Slider2d }, + { "outerOffset", "Dimension", TextBox }, + { "outerOffset", "Dimension", TextButton }, + { "outerOffset", "Dimension", TextToggle }, + { "outerOffset", "Dimension", XfwfMenuBar }, + { "overrideRedirect", "Boolean", ApplicationShell }, + { "overrideRedirect", "Boolean", OverrideShell }, + { "overrideRedirect", "Boolean", Shell }, + { "overrideRedirect", "Boolean", SimpleMenu }, + { "overrideRedirect", "Boolean", TopLevelShell }, + { "overrideRedirect", "Boolean", TransientShell }, + { "overrideRedirect", "Boolean", WMShell }, + { "pathCallback", "Callback", ListTree }, + { "pasteBuffer", "Boolean", List }, + { "pasteBuffer", "Boolean", MultiList }, + { "percentVerticalSpace", "Int", HTML }, + { "pickTop", "Boolean", Scrollbar }, + { "pieceSize", "Int", AsciiSrc }, + { "pieceSize", "Int", AsciiText }, + { "plainFont", "FontStruct", HTML }, + { "plainboldFont", "FontStruct", HTML }, + { "plainitalicFont", "FontStruct", HTML }, + { "pointerColor", "Pixel", AsciiText }, + { "pointerColor", "Pixel", Command }, + { "pointerColor", "Pixel", Grip }, + { "pointerColor", "Pixel", Label }, + { "pointerColor", "Pixel", List }, + { "pointerColor", "Pixel", MenuButton }, + { "pointerColor", "Pixel", MultiList }, + { "pointerColor", "Pixel", Panner }, + { "pointerColor", "Pixel", Repeater }, + { "pointerColor", "Pixel", Scrollbar }, + { "pointerColor", "Pixel", Simple }, + { "pointerColor", "Pixel", StripChart }, + { "pointerColor", "Pixel", Toggle }, + { "pointerColorBackground", "Pixel", AsciiText }, + { "pointerColorBackground", "Pixel", Command }, + { "pointerColorBackground", "Pixel", Grip }, + { "pointerColorBackground", "Pixel", Label }, + { "pointerColorBackground", "Pixel", List }, + { "pointerColorBackground", "Pixel", MenuButton }, + { "pointerColorBackground", "Pixel", MultiList }, + { "pointerColorBackground", "Pixel", Panner }, + { "pointerColorBackground", "Pixel", Repeater }, + { "pointerColorBackground", "Pixel", Scrollbar }, + { "pointerColorBackground", "Pixel", Simple }, + { "pointerColorBackground", "Pixel", StripChart }, + { "pointerColorBackground", "Pixel", Toggle }, + { "pointerMotionCallback", "Pointer", HTML }, + { "popdownCallback", "Callback", ApplicationShell }, + { "popdownCallback", "Callback", OverrideShell }, + { "popdownCallback", "Callback", Shell }, + { "popdownCallback", "Callback", SimpleMenu }, + { "popdownCallback", "Callback", Tabs }, + { "popdownCallback", "Callback", TopLevelShell }, + { "popdownCallback", "Callback", TransientShell }, + { "popdownCallback", "Callback", WMShell }, + { "popupCallback", "Callback", ApplicationShell }, + { "popupCallback", "Callback", OverrideShell }, + { "popupCallback", "Callback", Shell }, + { "popupCallback", "Callback", SimpleMenu }, + { "popupCallback", "Callback", Tabs }, + { "popupCallback", "Callback", TopLevelShell }, + { "popupCallback", "Callback", TransientShell }, + { "popupCallback", "Callback", WMShell }, + { "popupOnEntry", "Widget", SimpleMenu }, + { "position", "Int", Paned }, + { "preferredPaneSize", "Dimension", Paned }, + { "previouslyVisitedTestFunction", "Pointer", HTML }, + { "radioData", "Pointer", Toggle }, + { "radioGroup", "Widget", Toggle }, + { "raiseWindow", "Boolean", Gterm }, + { "refigureMode", "Boolean", Paned }, + { "rel_height", "Float", Arrow }, + { "rel_height", "Float", Board }, + { "rel_height", "Float", Group }, + { "rel_height", "Float", Icon }, + { "rel_height", "Float", RadioGroup }, + { "rel_height", "Float", RowCol }, + { "rel_height", "Float", Scrollbar2 }, + { "rel_height", "Float", Slider2d }, + { "rel_height", "Float", TextBox }, + { "rel_height", "Float", TextButton }, + { "rel_height", "Float", TextToggle }, + { "rel_height", "Float", XfwfMenuBar }, + { "rel_width", "Float", Arrow }, + { "rel_width", "Float", Board }, + { "rel_width", "Float", Group }, + { "rel_width", "Float", Icon }, + { "rel_width", "Float", RadioGroup }, + { "rel_width", "Float", RowCol }, + { "rel_width", "Float", Scrollbar2 }, + { "rel_width", "Float", Slider2d }, + { "rel_width", "Float", TextBox }, + { "rel_width", "Float", TextButton }, + { "rel_width", "Float", TextToggle }, + { "rel_width", "Float", XfwfMenuBar }, + { "rel_x", "Float", Arrow }, + { "rel_x", "Float", Board }, + { "rel_x", "Float", Group }, + { "rel_x", "Float", Icon }, + { "rel_x", "Float", RadioGroup }, + { "rel_x", "Float", RowCol }, + { "rel_x", "Float", Scrollbar2 }, + { "rel_x", "Float", Slider2d }, + { "rel_x", "Float", TextBox }, + { "rel_x", "Float", TextButton }, + { "rel_x", "Float", TextToggle }, + { "rel_x", "Float", XfwfMenuBar }, + { "rel_y", "Float", Arrow }, + { "rel_y", "Float", Board }, + { "rel_y", "Float", Group }, + { "rel_y", "Float", Icon }, + { "rel_y", "Float", RadioGroup }, + { "rel_y", "Float", RowCol }, + { "rel_y", "Float", Scrollbar2 }, + { "rel_y", "Float", Slider2d }, + { "rel_y", "Float", TextBox }, + { "rel_y", "Float", TextButton }, + { "rel_y", "Float", TextToggle }, + { "rel_y", "Float", XfwfMenuBar }, + { "repeatDelay", "Cardinal", Arrow }, + { "repeatDelay", "Cardinal", Scrollbar2 }, + { "repeatDelay", "Int", Repeater }, + { "reportCallback", "Callback", Panner }, + { "reportCallback", "Callback", Porthole }, + { "reportCallback", "Callback", Viewport }, + { "resizable", "Boolean", Dialog }, + { "resizable", "Boolean", Form }, + { "resizable", "Boolean", Tabs }, + { "resizable", "Boolean", Viewport }, + { "resize", "Boolean", Command }, + { "resize", "Boolean", Label }, + { "resize", "Boolean", MenuButton }, + { "resize", "Boolean", Panner }, + { "resize", "Boolean", Repeater }, + { "resize", "Boolean", Toggle }, + { "resize", "ResizeMode", AsciiText }, + { "resizeToPreferred", "Boolean", Paned }, + { "resolveDelayedImage", "Pointer", HTML }, + { "resolveImageFunction", "Pointer", HTML }, + { "right", "EdgeType", Dialog }, + { "right", "EdgeType", Form }, + { "right", "EdgeType", Viewport }, + { "rightBitmap", "Bitmap", SmeBSB }, + { "rightCursor", "Cursor", Paned }, + { "rightMargin", "Dimension", Slider2d }, + { "rightMargin", "Dimension", SmeBSB }, + { "rightMargin", "Dimension", TextBox }, + { "rightMargin", "Dimension", TextButton }, + { "rightMargin", "Dimension", TextToggle }, + { "rightMargin", "Position", AsciiText }, + { "rowForeground", "Pixel", Table }, + { "rowHeight", "Dimension", MultiList }, + { "rowHeight", "Dimension", SimpleMenu }, + { "rowHeight", "Int", Table }, + { "rowOriented", "Boolean", Table }, + { "rowMargin", "Dimension", Table }, + { "rowSpacing", "Dimension", List }, + { "rowSpacing", "Dimension", MultiList }, + { "rows", "Int", Group }, + { "rows", "Int", RadioGroup }, + { "rows", "Int", RowCol }, + { "rows", "Int", Table }, + { "rows", "Int", XfwfMenuBar }, + { "rubberBand", "Boolean", Panner }, + { "rvLength", "Int", Slider2d }, + { "rvLength", "Int", TextBox }, + { "rvLength", "Int", TextButton }, + { "rvLength", "Int", TextToggle }, + { "rvStart", "Int", Slider2d }, + { "rvStart", "Int", TextBox }, + { "rvStart", "Int", TextButton }, + { "rvStart", "Int", TextToggle }, + { "saveUnder", "Boolean", ApplicationShell }, + { "saveUnder", "Boolean", OverrideShell }, + { "saveUnder", "Boolean", Shell }, + { "saveUnder", "Boolean", SimpleMenu }, + { "saveUnder", "Boolean", TopLevelShell }, + { "saveUnder", "Boolean", TransientShell }, + { "saveUnder", "Boolean", WMShell }, + { "screen", "Screen", ApplicationShell }, + { "screen", "Screen", Arrow }, + { "screen", "Screen", AsciiText }, + { "screen", "Screen", Board }, + { "screen", "Screen", Box }, + { "screen", "Screen", Command }, + { "screen", "Screen", Core }, + { "screen", "Screen", Dialog }, + { "screen", "Screen", Form }, + { "screen", "Screen", Frame }, + { "screen", "Screen", Grip }, + { "screen", "Screen", Group }, + { "screen", "Screen", Gterm }, + { "screen", "Screen", HTML }, + { "screen", "Screen", Icon }, + { "screen", "Screen", Label }, + { "screen", "Screen", Layout }, + { "screen", "Screen", List }, + { "screen", "Screen", MenuButton }, + { "screen", "Screen", MultiList }, + { "screen", "Screen", OverrideShell }, + { "screen", "Screen", Paned }, + { "screen", "Screen", Panner }, + { "screen", "Screen", Porthole }, + { "screen", "Screen", RadioGroup }, + { "screen", "Screen", Repeater }, + { "screen", "Screen", RowCol }, + { "screen", "Screen", Scrollbar }, + { "screen", "Screen", Scrollbar2 }, + { "screen", "Screen", Shell }, + { "screen", "Screen", Simple }, + { "screen", "Screen", SimpleMenu }, + { "screen", "Screen", Slider2d }, + { "screen", "Screen", StripChart }, + { "screen", "Screen", Table }, + { "screen", "Screen", TextBox }, + { "screen", "Screen", TextButton }, + { "screen", "Screen", TextToggle }, + { "screen", "Screen", Toggle }, + { "screen", "Screen", TopLevelShell }, + { "screen", "Screen", TransientShell }, + { "screen", "Screen", Tree }, + { "screen", "Screen", Viewport }, + { "screen", "Screen", WMShell }, + { "screen", "Screen", XfwfCommon }, + { "screen", "Screen", XfwfMenuBar }, + { "scrollCallback", "Callback", Scrollbar2 }, + { "scrollCallback", "Callback", Slider2d }, + { "scrollDCursor", "Cursor", Scrollbar }, + { "scrollHCursor", "Cursor", Scrollbar }, + { "scrollHorizontal", "ScrollMode", AsciiText }, + { "scrollLCursor", "Cursor", Scrollbar }, + { "scrollProc", "Callback", Scrollbar }, + { "scrollRCursor", "Cursor", Scrollbar }, + { "scrollResponse", "XTCallbackProc", Scrollbar2 }, + { "scrollResponse", "XTCallbackProc", Slider2d }, + { "scrollUCursor", "Cursor", Scrollbar }, + { "scrollVCursor", "Cursor", Scrollbar }, + { "scrollVertical", "ScrollMode", AsciiText }, + { "scrollbarForeground", "Pixel", Scrollbar2 }, + { "selectTypes", "Pointer", AsciiText }, + { "selectInsensitive", "Boolean", Tabs }, + { "selection", "Long", Group }, + { "selection", "Long", RadioGroup }, + { "selectionStyle", "SelectionType", Group }, + { "selectionStyle", "SelectionType", RadioGroup }, + { "sensitive", "Boolean", ApplicationShell }, + { "sensitive", "Boolean", Arrow }, + { "sensitive", "Boolean", AsciiText }, + { "sensitive", "Boolean", Board }, + { "sensitive", "Boolean", Box }, + { "sensitive", "Boolean", Command }, + { "sensitive", "Boolean", Core }, + { "sensitive", "Boolean", Dialog }, + { "sensitive", "Boolean", Form }, + { "sensitive", "Boolean", Frame }, + { "sensitive", "Boolean", Grip }, + { "sensitive", "Boolean", Group }, + { "sensitive", "Boolean", Gterm }, + { "sensitive", "Boolean", HTML }, + { "sensitive", "Boolean", Icon }, + { "sensitive", "Boolean", Label }, + { "sensitive", "Boolean", Layout }, + { "sensitive", "Boolean", List }, + { "sensitive", "Boolean", MenuButton }, + { "sensitive", "Boolean", MultiList }, + { "sensitive", "Boolean", OverrideShell }, + { "sensitive", "Boolean", Paned }, + { "sensitive", "Boolean", Panner }, + { "sensitive", "Boolean", Porthole }, + { "sensitive", "Boolean", RadioGroup }, + { "sensitive", "Boolean", Repeater }, + { "sensitive", "Boolean", RowCol }, + { "sensitive", "Boolean", Scrollbar }, + { "sensitive", "Boolean", Scrollbar2 }, + { "sensitive", "Boolean", Shell }, + { "sensitive", "Boolean", Simple }, + { "sensitive", "Boolean", SimpleMenu }, + { "sensitive", "Boolean", Slider2d }, + { "sensitive", "Boolean", Sme }, + { "sensitive", "Boolean", SmeBSB }, + { "sensitive", "Boolean", SmeLine }, + { "sensitive", "Boolean", StripChart }, + { "sensitive", "Boolean", Table }, + { "sensitive", "Boolean", TextBox }, + { "sensitive", "Boolean", TextButton }, + { "sensitive", "Boolean", TextToggle }, + { "sensitive", "Boolean", Toggle }, + { "sensitive", "Boolean", TopLevelShell }, + { "sensitive", "Boolean", TransientShell }, + { "sensitive", "Boolean", Tree }, + { "sensitive", "Boolean", Viewport }, + { "sensitive", "Boolean", WMShell }, + { "sensitive", "Boolean", XfwfCommon }, + { "sensitive", "Boolean", XfwfMenuBar }, + { "sensitiveArray", "Pointer", MultiList }, + { "shadeSurplus", "Boolean", MultiList }, + { "shadow", "Dimension", Scrollbar2 }, + { "shadowColor", "Pixel", Panner }, + { "shadowScheme", "ShadowScheme", Arrow }, + { "shadowScheme", "ShadowScheme", Board }, + { "shadowScheme", "ShadowScheme", Frame }, + { "shadowScheme", "ShadowScheme", Group }, + { "shadowScheme", "ShadowScheme", Icon }, + { "shadowScheme", "ShadowScheme", RadioGroup }, + { "shadowScheme", "ShadowScheme", RowCol }, + { "shadowScheme", "ShadowScheme", Scrollbar2 }, + { "shadowScheme", "ShadowScheme", Slider2d }, + { "shadowScheme", "ShadowScheme", TextBox }, + { "shadowScheme", "ShadowScheme", TextButton }, + { "shadowScheme", "ShadowScheme", TextToggle }, + { "shadowScheme", "ShadowScheme", XfwfMenuBar }, + { "shadowThickness", "Dimension", Panner }, + { "shadowWidth", "Dimension", Table }, + { "shapeStyle", "ShapeStyle", Command }, + { "shapeStyle", "ShapeStyle", MenuButton }, + { "shapeStyle", "ShapeStyle", Repeater }, + { "shapeStyle", "ShapeStyle", Toggle }, + { "showGrip", "Boolean", Paned }, + { "shown", "Float", Scrollbar }, + { "shrinkToFit", "Boolean", Group }, + { "shrinkToFit", "Boolean", RadioGroup }, + { "shrinkToFit", "Boolean", RowCol }, + { "shrinkToFit", "Boolean", Slider2d }, + { "shrinkToFit", "Boolean", TextBox }, + { "shrinkToFit", "Boolean", TextButton }, + { "shrinkToFit", "Boolean", TextToggle }, + { "shrinkToFit", "Boolean", XfwfMenuBar }, + { "skipAdjust", "Boolean", Paned }, + { "sliderHeight", "Dimension", Panner }, + { "sliderWidth", "Dimension", Panner }, + { "sliderX", "Position", Panner }, + { "sliderY", "Position", Panner }, + { "startCallback", "Callback", Repeater }, + { "state", "Boolean", Toggle }, + { "stipple", "Bitmap", SmeLine }, + { "stopCallback", "Callback", Repeater }, + { "storeByRow", "Boolean", Group }, + { "storeByRow", "Boolean", RadioGroup }, + { "storeByRow", "Boolean", RowCol }, + { "storeByRow", "Boolean", XfwfMenuBar }, + { "string", "String", AsciiSrc }, + { "string", "String", AsciiText }, + { "submitFormCallback", "Callback", HTML }, + { "tabForeground", "Pixel", Tabs }, + { "tabLabel", "String", Tabs }, + { "tableMargin", "Dimension", Table }, + { "tabLeftBitmap", "Bitmap", Tabs }, + { "tablist", "String", MultiList }, + { "tablist", "String", Slider2d }, + { "tablist", "String", TextBox }, + { "tablist", "String", TextButton }, + { "tablist", "String", TextToggle }, + { "text", "String", HTML }, + { "textSink", "Widget", AsciiText }, + { "textSource", "Widget", AsciiText }, + { "thickness", "Dimension", Scrollbar }, + { "thumb", "Bitmap", Scrollbar }, + { "thumbColor", "Pixel", Slider2d }, + { "thumbFrameType", "FrameType", Slider2d }, + { "thumbFrameWidth", "Dimension", Slider2d }, + { "thumbPixmap", "Pixmap", Slider2d }, + { "thumbProc", "Callback", Scrollbar }, + { "title", "String", ApplicationShell }, + { "title", "String", TopLevelShell }, + { "title", "String", TransientShell }, + { "title", "String", WMShell }, + { "titleEncoding", "Atom", ApplicationShell }, + { "titleEncoding", "Atom", TopLevelShell }, + { "titleEncoding", "Atom", TransientShell }, + { "titleEncoding", "Atom", WMShell }, + { "titleText", "String", HTML }, + { "top", "EdgeType", Dialog }, + { "top", "EdgeType", Form }, + { "top", "EdgeType", Viewport }, + { "topMargin", "Dimension", SimpleMenu }, + { "topMargin", "Dimension", Slider2d }, + { "topMargin", "Dimension", TextBox }, + { "topMargin", "Dimension", TextButton }, + { "topMargin", "Dimension", TextToggle }, + { "topMargin", "Position", AsciiText }, + { "topOfThumb", "Float", Scrollbar }, + { "topShadowColor", "Pixel", Arrow }, + { "topShadowColor", "Pixel", Board }, + { "topShadowColor", "Pixel", Frame }, + { "topShadowColor", "Pixel", Group }, + { "topShadowColor", "Pixel", Icon }, + { "topShadowColor", "Pixel", RadioGroup }, + { "topShadowColor", "Pixel", RowCol }, + { "topShadowColor", "Pixel", Scrollbar2 }, + { "topShadowColor", "Pixel", Slider2d }, + { "topShadowColor", "Pixel", TextBox }, + { "topShadowColor", "Pixel", TextButton }, + { "topShadowColor", "Pixel", TextToggle }, + { "topShadowColor", "Pixel", XfwfMenuBar }, + { "topShadowPixel", "Pixel", Table }, + { "topShadowPixmap", "Pixmap", Table }, + { "topShadowContast", "Int", Tabs }, + { "topShadowStipple", "Bitmap", Arrow }, + { "topShadowStipple", "Bitmap", Board }, + { "topShadowStipple", "Bitmap", Frame }, + { "topShadowStipple", "Bitmap", Group }, + { "topShadowStipple", "Bitmap", Icon }, + { "topShadowStipple", "Bitmap", RadioGroup }, + { "topShadowStipple", "Bitmap", RowCol }, + { "topShadowStipple", "Bitmap", Scrollbar2 }, + { "topShadowStipple", "Bitmap", Slider2d }, + { "topShadowStipple", "Bitmap", TextBox }, + { "topShadowStipple", "Bitmap", TextButton }, + { "topShadowStipple", "Bitmap", TextToggle }, + { "topShadowStipple", "Bitmap", XfwfMenuBar }, + { "topWidget", "Widget", Tabs }, + { "transient", "Boolean", ApplicationShell }, + { "transient", "Boolean", TopLevelShell }, + { "transient", "Boolean", TransientShell }, + { "transient", "Boolean", WMShell }, + { "transientFor", "Widget", TransientShell }, + { "translations", "TranslationTable", ApplicationShell }, + { "translations", "TranslationTable", Arrow }, + { "translations", "TranslationTable", AsciiText }, + { "translations", "TranslationTable", Board }, + { "translations", "TranslationTable", Box }, + { "translations", "TranslationTable", Command }, + { "translations", "TranslationTable", Core }, + { "translations", "TranslationTable", Dialog }, + { "translations", "TranslationTable", Form }, + { "translations", "TranslationTable", Frame }, + { "translations", "TranslationTable", Grip }, + { "translations", "TranslationTable", Group }, + { "translations", "TranslationTable", Gterm }, + { "translations", "TranslationTable", HTML }, + { "translations", "TranslationTable", Icon }, + { "translations", "TranslationTable", Label }, + { "translations", "TranslationTable", Layout }, + { "translations", "TranslationTable", List }, + { "translations", "TranslationTable", MenuButton }, + { "translations", "TranslationTable", MultiList }, + { "translations", "TranslationTable", OverrideShell }, + { "translations", "TranslationTable", Paned }, + { "translations", "TranslationTable", Panner }, + { "translations", "TranslationTable", Porthole }, + { "translations", "TranslationTable", RadioGroup }, + { "translations", "TranslationTable", Repeater }, + { "translations", "TranslationTable", RowCol }, + { "translations", "TranslationTable", Scrollbar }, + { "translations", "TranslationTable", Scrollbar2 }, + { "translations", "TranslationTable", Shell }, + { "translations", "TranslationTable", Simple }, + { "translations", "TranslationTable", SimpleMenu }, + { "translations", "TranslationTable", Slider2d }, + { "translations", "TranslationTable", StripChart }, + { "translations", "TranslationTable", Table }, + { "translations", "TranslationTable", TextBox }, + { "translations", "TranslationTable", TextButton }, + { "translations", "TranslationTable", TextToggle }, + { "translations", "TranslationTable", Toggle }, + { "translations", "TranslationTable", TopLevelShell }, + { "translations", "TranslationTable", TransientShell }, + { "translations", "TranslationTable", Tree }, + { "translations", "TranslationTable", Viewport }, + { "translations", "TranslationTable", WMShell }, + { "translations", "TranslationTable", XfwfCommon }, + { "translations", "TranslationTable", XfwfMenuBar }, + { "traversalOn", "Boolean", Arrow }, + { "traversalOn", "Boolean", Board }, + { "traversalOn", "Boolean", Frame }, + { "traversalOn", "Boolean", Group }, + { "traversalOn", "Boolean", Icon }, + { "traversalOn", "Boolean", RadioGroup }, + { "traversalOn", "Boolean", RowCol }, + { "traversalOn", "Boolean", Scrollbar2 }, + { "traversalOn", "Boolean", Slider2d }, + { "traversalOn", "Boolean", TextBox }, + { "traversalOn", "Boolean", TextButton }, + { "traversalOn", "Boolean", TextToggle }, + { "traversalOn", "Boolean", XfwfCommon }, + { "traversalOn", "Boolean", XfwfMenuBar }, + { "treeGC", "GC", Tree }, + { "treeParent", "Widget", Tree }, + { "type", "AsciiType", AsciiSrc }, + { "type", "AsciiType", AsciiText }, + { "unrealizeCallback", "Callback", AsciiText }, + { "update", "Int", StripChart }, + { "upperCursor", "Cursor", Paned }, + { "useBottom", "Boolean", Viewport }, + { "useRight", "Boolean", Viewport }, + { "useStringInPlace", "Boolean", AsciiSrc }, + { "useStringInPlace", "Boolean", AsciiText }, + { "useTimers", "Boolean", Gterm }, + { "userData", "Pointer", Arrow }, + { "userData", "Pointer", Board }, + { "userData", "Pointer", Frame }, + { "userData", "Pointer", Group }, + { "userData", "Pointer", Icon }, + { "userData", "Pointer", RadioGroup }, + { "userData", "Pointer", Repeater }, + { "userData", "Pointer", RowCol }, + { "userData", "Pointer", Scrollbar2 }, + { "userData", "Pointer", Slider2d }, + { "userData", "Pointer", TextBox }, + { "userData", "Pointer", TextButton }, + { "userData", "Pointer", TextToggle }, + { "userData", "Pointer", XfwfCommon }, + { "userData", "Pointer", XfwfMenuBar }, + { "userData", "Pixmap", Table }, + { "vSpace", "Dimension", Box }, + { "vSpace", "Dimension", Tree }, + { "value", "String", Dialog }, + { "vertDistance", "Int", Dialog }, + { "vertDistance", "Int", Form }, + { "vertDistance", "Int", Viewport }, + { "vertSpace", "Int", SmeBSB }, + { "vertical", "Boolean", Scrollbar2 }, + { "verticalBetweenCursor", "Cursor", Paned }, + { "verticalGripCursor", "Cursor", Paned }, + { "verticalList", "Boolean", List }, + { "verticalList", "Boolean", MultiList }, + { "verticalScroll", "Widget", Table }, + { "verticalScrollBar", "Widget", HTML }, + { "verticalScrollOnRight", "Boolean", HTML }, + { "verticalSpacing", "Dimension", ListTree }, + { "view", "Widget", HTML }, + { "visitedAnchorColor", "Pixel", HTML }, + { "visitedAnchorUnderlines", "Int", HTML }, + { "visual", "Visual", ApplicationShell }, + { "visual", "Visual", OverrideShell }, + { "visual", "Visual", Shell }, + { "visual", "Visual", SimpleMenu }, + { "visual", "Visual", TopLevelShell }, + { "visual", "Visual", TransientShell }, + { "visual", "Visual", WMShell }, + { "vunit", "Float", Arrow }, + { "vunit", "Float", Board }, + { "vunit", "Float", Group }, + { "vunit", "Float", Icon }, + { "vunit", "Float", RadioGroup }, + { "vunit", "Float", RowCol }, + { "vunit", "Float", Scrollbar2 }, + { "vunit", "Float", Slider2d }, + { "vunit", "Float", TextBox }, + { "vunit", "Float", TextButton }, + { "vunit", "Float", TextToggle }, + { "vunit", "Float", XfwfMenuBar }, + { "waitforwm", "Boolean", ApplicationShell }, + { "waitforwm", "Boolean", TopLevelShell }, + { "waitforwm", "Boolean", TransientShell }, + { "waitforwm", "Boolean", WMShell }, + { "warpCursor", "Boolean", Gterm }, + { "whatCell", "Callback", Table }, + { "width", "Dimension", ApplicationShell }, + { "width", "Dimension", Arrow }, + { "width", "Dimension", AsciiText }, + { "width", "Dimension", Board }, + { "width", "Dimension", Box }, + { "width", "Dimension", Command }, + { "width", "Dimension", Core }, + { "width", "Dimension", Dialog }, + { "width", "Dimension", Form }, + { "width", "Dimension", Frame }, + { "width", "Dimension", Grip }, + { "width", "Dimension", Group }, + { "width", "Dimension", Gterm }, + { "width", "Dimension", HTML }, + { "width", "Dimension", Icon }, + { "width", "Dimension", Label }, + { "width", "Dimension", Layout }, + { "width", "Dimension", List }, + { "width", "Dimension", MenuButton }, + { "width", "Dimension", MultiList }, + { "width", "Dimension", OverrideShell }, + { "width", "Dimension", Paned }, + { "width", "Dimension", Panner }, + { "width", "Dimension", Porthole }, + { "width", "Dimension", RadioGroup }, + { "width", "Dimension", Repeater }, + { "width", "Dimension", RowCol }, + { "width", "Dimension", Scrollbar }, + { "width", "Dimension", Scrollbar2 }, + { "width", "Dimension", Separator }, + { "width", "Dimension", Shell }, + { "width", "Dimension", Simple }, + { "width", "Dimension", SimpleMenu }, + { "width", "Dimension", Slider2d }, + { "width", "Dimension", Sme }, + { "width", "Dimension", SmeBSB }, + { "width", "Dimension", SmeLine }, + { "width", "Dimension", StripChart }, + { "width", "Dimension", Table }, + { "width", "Dimension", TextBox }, + { "width", "Dimension", TextButton }, + { "width", "Dimension", TextToggle }, + { "width", "Dimension", Toggle }, + { "width", "Dimension", TopLevelShell }, + { "width", "Dimension", TransientShell }, + { "width", "Dimension", Tree }, + { "width", "Dimension", Viewport }, + { "width", "Dimension", WMShell }, + { "width", "Dimension", XfwfCommon }, + { "width", "Dimension", XfwfMenuBar }, + { "widthInc", "Int", ApplicationShell }, + { "widthInc", "Int", TopLevelShell }, + { "widthInc", "Int", TransientShell }, + { "widthInc", "Int", WMShell }, + { "winGravity", "Int", ApplicationShell }, + { "winGravity", "Int", TopLevelShell }, + { "winGravity", "Int", TransientShell }, + { "winGravity", "Int", WMShell }, + { "windowGroup", "Window", ApplicationShell }, + { "windowGroup", "Window", TopLevelShell }, + { "windowGroup", "Window", TransientShell }, + { "windowGroup", "Window", WMShell }, + { "wmTimeout", "Int", ApplicationShell }, + { "wmTimeout", "Int", TopLevelShell }, + { "wmTimeout", "Int", TransientShell }, + { "wmTimeout", "Int", WMShell }, + { "wrap", "WrapMode", AsciiText }, + { "x", "Position", ApplicationShell }, + { "x", "Position", Arrow }, + { "x", "Position", AsciiText }, + { "x", "Position", Board }, + { "x", "Position", Box }, + { "x", "Position", Command }, + { "x", "Position", Core }, + { "x", "Position", Dialog }, + { "x", "Position", Form }, + { "x", "Position", Frame }, + { "x", "Position", Grip }, + { "x", "Position", Group }, + { "x", "Position", Gterm }, + { "x", "Position", HTML }, + { "x", "Position", Icon }, + { "x", "Position", Label }, + { "x", "Position", Layout }, + { "x", "Position", List }, + { "x", "Position", MenuButton }, + { "x", "Position", MultiList }, + { "x", "Position", OverrideShell }, + { "x", "Position", Paned }, + { "x", "Position", Panner }, + { "x", "Position", Porthole }, + { "x", "Position", RadioGroup }, + { "x", "Position", Repeater }, + { "x", "Position", RowCol }, + { "x", "Position", Scrollbar }, + { "x", "Position", Scrollbar2 }, + { "x", "Position", Separator }, + { "x", "Position", Shell }, + { "x", "Position", Simple }, + { "x", "Position", SimpleMenu }, + { "x", "Position", Slider2d }, + { "x", "Position", Sme }, + { "x", "Position", SmeBSB }, + { "x", "Position", SmeLine }, + { "x", "Position", StripChart }, + { "x", "Position", Table }, + { "x", "Position", TextBox }, + { "x", "Position", TextButton }, + { "x", "Position", TextToggle }, + { "x", "Position", Toggle }, + { "x", "Position", TopLevelShell }, + { "x", "Position", TransientShell }, + { "x", "Position", Tree }, + { "x", "Position", Viewport }, + { "x", "Position", WMShell }, + { "x", "Position", XfwfCommon }, + { "x", "Position", XfwfMenuBar }, + { "xorFill", "Boolean", Gterm }, + { "xorFillBgColor", "Int", Gterm }, + { "xorFillColor", "Int", Gterm }, + { "y", "Position", ApplicationShell }, + { "y", "Position", Arrow }, + { "y", "Position", AsciiText }, + { "y", "Position", Board }, + { "y", "Position", Box }, + { "y", "Position", Command }, + { "y", "Position", Core }, + { "y", "Position", Dialog }, + { "y", "Position", Form }, + { "y", "Position", Frame }, + { "y", "Position", Grip }, + { "y", "Position", Group }, + { "y", "Position", Gterm }, + { "y", "Position", HTML }, + { "y", "Position", Icon }, + { "y", "Position", Label }, + { "y", "Position", Layout }, + { "y", "Position", List }, + { "y", "Position", MenuButton }, + { "y", "Position", MultiList }, + { "y", "Position", OverrideShell }, + { "y", "Position", Paned }, + { "y", "Position", Panner }, + { "y", "Position", Porthole }, + { "y", "Position", RadioGroup }, + { "y", "Position", Repeater }, + { "y", "Position", RowCol }, + { "y", "Position", Scrollbar }, + { "y", "Position", Scrollbar2 }, + { "y", "Position", Separator }, + { "y", "Position", Shell }, + { "y", "Position", Simple }, + { "y", "Position", SimpleMenu }, + { "y", "Position", Slider2d }, + { "y", "Position", Sme }, + { "y", "Position", SmeBSB }, + { "y", "Position", SmeLine }, + { "y", "Position", StripChart }, + { "y", "Position", Table }, + { "y", "Position", TextBox }, + { "y", "Position", TextButton }, + { "y", "Position", TextToggle }, + { "y", "Position", Toggle }, + { "y", "Position", TopLevelShell }, + { "y", "Position", TransientShell }, + { "y", "Position", Tree }, + { "y", "Position", Viewport }, + { "y", "Position", WMShell }, + { "y", "Position", XfwfCommon }, + { "y", "Position", XfwfMenuBar }, + { (char *)NULL, (char *)NULL, (unsigned long)NULL }, +}; + +/* Prints a table listing the unique resource name/type pairs, with a bitmask + * indicating the widget classes using each resource/type pair. + */ +main (argc, argv) +int argc; +char *argv[]; +{ + register struct resource_list *rp, *np; + register unsigned long flags1, flags2; + int decorate = 0; + + if (argc >= 2 && !strcmp(argv[1],"-decorate")) + decorate++; + + for (rp=resources; rp && rp->resource; rp=np) { + for (np=rp, flags1=flags2=0; np && np->type && + (!strcmp(rp->resource,np->resource) && + !strcmp(rp->type,np->type)); ) { + + flags1 |= np->class1; + flags2 |= np->class2; + np++; + } + + if (decorate) { + printf ("{ \"%s\", XtR%s, %011o, %011o, NULL },\n", + rp->resource, rp->type, flags1, flags2); + } else { + printf ("%s %s %011o %011o\n", + rp->resource, rp->type, flags1, flags2); + } + } +} diff --git a/vendor/x11iraf/obm/obmres.dat b/vendor/x11iraf/obm/obmres.dat new file mode 100644 index 00000000..756a12d4 --- /dev/null +++ b/vendor/x11iraf/obm/obmres.dat @@ -0,0 +1,538 @@ +/* + * OBMRES.DAT -- Global resource table used by the object manager. + * Format: resource name, resource type, widget classes bitflags, hash link. + * + * To regenerate this file, add any new resources to the table in the + * obmres.c file, sort the table, and then do the following. (Note: the + * widget type code #defines in obmres.c must agree with those in obm.c, + * ignoring the Wt prefix used in obm.c.) + * + * 1. cc obmres.c -o obmres.e + * 2. obmres.e -decorate > temp + * 3. Replace the text following this comment by the contents of + * the file temp. + * + * The "undecorated" output of obmres may be used for various queries, e.g., + * obmres.e | awk '{ print $2 }' | sort | uniq + * will list all the resource types. + */ + +/* The following definitions appear to be needed to work around omissions + * in the X11R4 Athena widget public include files. + */ +#ifndef XtREdgeType +# define XtREdgeType "EdgeType" +#endif +#ifndef XtRWrapMode +# define XtRWrapMode "WrapMode" +#endif +#ifndef XtRTextResizeMode +# define XtRTextResizeMode "TextResizeMode" +#endif +#ifndef XtRTextScrollMode +# define XtRTextScrollMode "TextScrollMode" +#endif +#ifndef XtRResizeMode +# define XtRResizeMode "ResizeMode" +#endif +#ifndef XtRScrollMode +# define XtRScrollMode "ScrollMode" +#endif +#ifndef XtNwaitforwm +# define XtNwaitforwm XtNwaitForWm +#endif + + +{ "abs_height", XtRPosition, 00000575570, 00000000000, NULL }, +{ "abs_width", XtRPosition, 00000575570, 00000000000, NULL }, +{ "abs_x", XtRPosition, 00000575570, 00000000000, NULL }, +{ "abs_y", XtRPosition, 00000575570, 00000000000, NULL }, +{ "accelerators", XtRAcceleratorTable, 00011777777, 01707777715, NULL }, +{ "addColumn", XtRCallback, 00010000000, 00000000000, NULL }, +{ "addRow", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowAddColumn", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowAddRow", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowDeleteColumn", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowDeleteRow", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowDeleteTable", XtRCallback, 00010000000, 00000000000, NULL }, +{ "activate", XtRCallback, 00000145400, 00000000000, NULL }, +{ "activateCallback", XtRCallback, 00002000000, 00000000000, NULL }, +{ "activeAnchorBG", XtRPixel, 00000000004, 00000000000, NULL }, +{ "activeAnchorFG", XtRPixel, 00000000004, 00000000000, NULL }, +{ "addressFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "alignment", XtRAlignment, 00000574500, 00000000000, NULL }, +{ "allowAddColumn", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowAddRow", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowDeleteColumn", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowDeleteRow", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowDeleteTable", XtRCallback, 00010000000, 00000000000, NULL }, +{ "allowHoriz", XtRBoolean, 00000000000, 01000000000, NULL }, +{ "allowOff", XtRBoolean, 00000000000, 00000200000, NULL }, +{ "allowResize", XtRBoolean, 00000000000, 00000100000, NULL }, +{ "allowShellResize", XtRBoolean, 00000000000, 00004000010, NULL }, +{ "allowVert", XtRBoolean, 00000000000, 01000000000, NULL }, +{ "alphaFont1", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont2", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont3", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont4", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont5", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont6", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont7", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "alphaFont8", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "ancestorSensitive", XtRBoolean, 00010777777, 01777777715, NULL }, +{ "anchorCallback", XtRCallback, 00000000004, 00000000000, NULL }, +{ "anchorColor", XtRPixel, 00000000004, 00000000000, NULL }, +{ "anchorUnderlines", XtRInt, 00000000004, 00000000000, NULL }, +{ "argc", XtRInt, 00000000000, 00000000010, NULL }, +{ "argv", XtRStringArray, 00000000000, 00000000010, NULL }, +{ "arrowShadow", XtRDimension, 00000000010, 00000000000, NULL }, +{ "autoFill", XtRBoolean, 00000000000, 00000000100, NULL }, +{ "autoReconfigure", XtRBoolean, 00000000000, 00400000000, NULL }, +{ "background", XtRPixel, 00014777777, 01707773735, NULL }, +{ "backgroundPixmap", XtRPixmap, 00013777777, 01707777715, NULL }, +{ "backgroundStipple", XtRString, 00000000000, 00000200000, NULL }, +{ "backingStore", XtRBackingStore, 00000000000, 00004000000, NULL }, +{ "baseHeight", XtRInt, 00000000000, 00000000010, NULL }, +{ "basePixel", XtRInt, 00000000001, 00000000000, NULL }, +{ "baseWidth", XtRInt, 00000000000, 00000000010, NULL }, +{ "betweenCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "bitmap", XtRBitmap, 00004000000, 00201050400, NULL }, +{ "boldFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "border", XtRPixel, 00004000000, 00000000000, NULL }, +{ "borderColor", XtRPixel, 00010777777, 01707777715, NULL }, +{ "borderPixmap", XtRPixmap, 00013777777, 01707777715, NULL }, +{ "borderWidth", XtRDimension, 00005777777, 01777777715, NULL }, +{ "bottom", XtREdgeType, 00000000000, 01000003000, NULL }, +{ "bottomMargin", XtRDimension, 00000160100, 00004000000, NULL }, +{ "bottomMargin", XtRPosition, 00000000000, 00000000100, NULL }, +{ "bottomShadowColor", XtRPixel, 00000575770, 00000000000, NULL }, +{ "bottomShadowContast", XtRInt, 00001000000, 00000000000, NULL }, +{ "bottomShadowPixel", XtRPixel, 00010000000, 00000000000, NULL }, +{ "bottomShadowPixmap", XtRPixmap, 00010000000, 00000000000, NULL }, +{ "bottomShadowStipple", XtRBitmap, 00000575770, 00000000000, NULL }, +{ "branchPixmap", XtRBitmap, 00002000000, 00000000000, NULL }, +{ "branchOpenPixmap", XtRBitmap, 00002000000, 00000000000, NULL }, +{ "branchCallback", XtRCallback, 00002000000, 00000000000, NULL }, +{ "busyCursor", XtRString, 00000000001, 00000000000, NULL }, +{ "busyCursorBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "busyCursorFgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "cacheRasters", XtRString, 00000000001, 00000000000, NULL }, +{ "callback", XtRCallback, 00001002010, 00271064540, NULL }, +{ "canvasHeight", XtRDimension, 00000000000, 00000200000, NULL }, +{ "canvasWidth", XtRDimension, 00000000000, 00000200000, NULL }, +{ "changedCell", XtRCallback, 00010000000, 00000000000, NULL }, +{ "changedColumnWidth", XtRCallback, 00010000000, 00000000000, NULL }, +{ "changedRowHeight", XtRCallback, 00010000000, 00000000000, NULL }, +{ "children", XtRWidgetList, 00010775776, 01404503210, NULL }, +{ "cmapInitialize", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "cmapInterpolate", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "cmapName", XtRString, 00000000001, 00000000000, NULL }, +{ "cmapShadow", XtRInt, 00000000001, 00000000000, NULL }, +{ "cmapUpdate", XtRInt, 00000000001, 00000000000, NULL }, +{ "color0", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color1", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color2", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color3", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color4", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color5", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color6", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color7", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color8", XtRPixel, 00000000001, 00000000000, NULL }, +{ "color9", XtRPixel, 00000000001, 00000000000, NULL }, +{ "colormap", XtRColormap, 00011777777, 01707777715, NULL }, +{ "columnForeground", XtRPixel, 00010000000, 00000000000, NULL }, +{ "columnMargin", XtRDimension, 00010000000, 00000000000, NULL }, +{ "columnSpacing", XtRDimension, 00000002000, 00000020000, NULL }, +{ "columnWidth", XtRDimension, 00000002000, 00000000000, NULL }, +{ "columns", XtRInt, 00010414400, 00000000000, NULL }, +{ "copyOnResize", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "cornerRoundPercent", XtRDimension, 00000000000, 00201040400, NULL }, +{ "createPopupChildProc", XtRFunction, 00000000000, 00004000010, NULL }, +{ "createTable", XtRCallback, 00010000000, 00000000000, NULL }, +{ "crosshairCursorColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "cursor", XtRCursor, 00004577770, 00307374504, NULL }, +{ "cursorName", XtRString, 00004002000, 00303274504, NULL }, +{ "dashedAnchorUnderlines", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "dashedVisitedAnchorUnderlines", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "dataCompression", XtRBoolean, 00000000000, 00000000140, NULL }, +{ "debug", XtRBoolean, 00000000002, 00000000000, NULL }, +{ "decay", XtRInt, 00000000000, 00001000000, NULL }, +{ "defaultColumns", XtRInt, 00000002000, 00000020000, NULL }, +{ "defaultDistance", XtRInt, 00000000000, 01000003000, NULL }, +{ "defaultMarker", XtRString, 00000000001, 00000000000, NULL }, +{ "defaultScale", XtRDimension, 00000000000, 00000200000, NULL }, +{ "defaultWidth", XtRInt, 00010000000, 00000000000, NULL }, +{ "deiconifyWindow", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "deleteColumn", XtRCallback, 00010000000, 00000000000, NULL }, +{ "deleteRow", XtRCallback, 00010000000, 00000000000, NULL }, +{ "deleteTable", XtRCallback, 00010000000, 00000000000, NULL }, +{ "delayImageLoads", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "depth", XtRInt, 00010777777, 01707777715, NULL }, +{ "destroyCallback", XtRCallback, 00010777777, 01777777777, NULL }, +{ "dialogBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "dialogFgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "dialogFont1", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont2", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont3", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont4", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont5", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont6", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont7", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "dialogFont8", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "direction", XtRAlignment, 00000000010, 00000000000, NULL }, +{ "displayCaret", XtRBoolean, 00000000000, 00000000100, NULL }, +{ "displayNonprinting", XtRBoolean, 00000000000, 00000000120, NULL }, +{ "displayPosition", XtRInt, 00000000000, 00000000100, NULL }, +{ "echo", XtRBoolean, 00000000000, 00000000120, NULL }, +{ "editBackground", XtRPixel, 00010000000, 00000000000, NULL }, +{ "editForeground", XtRPixel, 00010000000, 00000000000, NULL }, +{ "editable", XtRBoolean, 00010000000, 00000000000, NULL }, +{ "editType", XtREditMode, 00000000000, 00000000140, NULL }, +{ "encoding", XtRUnsignedChar, 00010000000, 00201050400, NULL }, +{ "fancySelections", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "fixedFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "fixedboldFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "fixeditalicFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "flash", XtRBoolean, 00000000000, 00001000000, NULL }, +{ "font", XtRFontStruct, 00013166504, 00221070520, NULL }, +{ "footerText", XtRString, 00000000004, 00000000000, NULL }, +{ "forceBars", XtRBoolean, 00000000000, 01000000000, NULL }, +{ "forceColumns", XtRBoolean, 00000002000, 00000020000, NULL }, +{ "foreground", XtRPixel, 00016166514, 00763274520, NULL }, +{ "frameType", XtRFrameType, 00000575770, 00000000000, NULL }, +{ "frameWidth", XtRDimension, 00000575770, 00000000000, NULL }, +{ "fromHoriz", XtRWidget, 00000000000, 01000003000, NULL }, +{ "fromVert", XtRWidget, 00000000000, 01000003000, NULL }, +{ "geometry", XtRString, 00000000000, 00004000010, NULL }, +{ "getValue", XtRCallback, 00000000000, 00100000000, NULL }, +{ "ginmodeBlinkInterval", XtRInt, 00000000001, 00000000000, NULL }, +{ "ginmodeCursor", XtRString, 00000000001, 00000000000, NULL }, +{ "ginmodeCursorBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "ginmodeCursorFgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "gravity", XtRGravity, 00000000000, 00400000000, NULL }, +{ "gripCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "gripIndent", XtRPosition, 00000000000, 00000100000, NULL }, +{ "gripTranslations", XtRTranslationTable, 00000000000, 00000100000, NULL }, +{ "hSpace", XtRDimension, 00000000000, 00400000200, NULL }, +{ "header1Font1Font", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "header2Font2Font", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "header3Font3Font", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "header4Font4Font", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "header5Font5Font", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "header6Font6Font", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "headerText", XtRString, 00000000004, 00000000000, NULL }, +{ "height", XtRDimension, 00014777777, 01777777715, NULL }, +{ "heightInc", XtRInt, 00000000000, 00000000010, NULL }, +{ "highlight", XtRPixel, 00000000000, 00100000000, NULL }, +{ "highlightBackground", XtRPixel, 00000002000, 00000000000, NULL }, +{ "highlightCallback", XtRCallback, 00002000000, 00000000000, NULL }, +{ "highlightColor", XtRPixel, 00000775770, 00000000000, NULL }, +{ "highlightForeground", XtRPixel, 00000002000, 00000000000, NULL }, +{ "highlightPixmap", XtRPixmap, 00000775770, 00000000000, NULL }, +{ "highlightThickness", XtRDimension, 00000775770, 00201040400, NULL }, +{ "horizDistance", XtRInt, 00000000000, 01000003000, NULL }, +{ "horizontalBetweenCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "horizontalGripCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "horizontalScroll", XtRWidget, 00010000000, 00000000000, NULL }, +{ "horizontalScrollBar", XtRWidget, 00000000004, 00000000000, NULL }, +{ "horizontalScrollOnTop", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "horizontalSpacing", XtRDimension, 00002000000, 00000000000, NULL }, +{ "hunit", XtRFloat, 00000575570, 00000000000, NULL }, +{ "icon", XtRBitmap, 00000000000, 00000001000, NULL }, +{ "iconMask", XtRBitmap, 00000000000, 00000000010, NULL }, +{ "iconName", XtRString, 00000000000, 00000000010, NULL }, +{ "iconNameEncoding", XtRAtom, 00000000000, 00000000010, NULL }, +{ "iconPixmap", XtRBitmap, 00000000000, 00000000010, NULL }, +{ "iconWindow", XtRWindow, 00000000000, 00000000010, NULL }, +{ "iconX", XtRInt, 00000000000, 00000000010, NULL }, +{ "iconY", XtRInt, 00000000000, 00000000010, NULL }, +{ "iconic", XtRBoolean, 00000000000, 00000000010, NULL }, +{ "idleCursor", XtRString, 00000000001, 00000000000, NULL }, +{ "idleCursorBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "idleCursorFgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "image", XtRIcon, 00000001000, 00000000000, NULL }, +{ "imageBorders", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "increment", XtRFloat, 00000000040, 00000000000, NULL }, +{ "indent", XtRDimension, 00002000000, 00000000000, NULL }, +{ "initialDelay", XtRCardinal, 00000000050, 00000000000, NULL }, +{ "initialDelay", XtRInt, 00000000000, 00001000000, NULL }, +{ "initialState", XtRInitialState, 00000000000, 00000000010, NULL }, +{ "insensitiveContrast", XtRInt, 00001000000, 00000000000, NULL }, +{ "innerOffset", XtRDimension, 00000575770, 00000000000, NULL }, +{ "input", XtRBool, 00000000000, 00000000010, NULL }, +{ "insensitiveBorder", XtRPixmap, 00000002000, 00303274504, NULL }, +{ "insertPosition", XtRFunction, 00000775776, 01404503210, NULL }, +{ "insertPosition", XtRInt, 00000000000, 00000000100, NULL }, +{ "internalBorderColor", XtRPixel, 00000000000, 00000100000, NULL }, +{ "internalBorderWidth", XtRDimension, 00000000000, 00000100000, NULL }, +{ "internalHeight", XtRDimension, 00011000000, 00201070400, NULL }, +{ "internalSpace", XtRDimension, 00000000000, 00000200000, NULL }, +{ "internalWidth", XtRDimension, 00011000000, 00201070400, NULL }, +{ "isIndex", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "italicFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "jumpProc", XtRCallback, 00000000000, 00002000000, NULL }, +{ "jumpScroll", XtRInt, 00000000000, 00100000000, NULL }, +{ "justify", XtRJustify, 00010000000, 00221050400, NULL }, +{ "label", XtRString, 00000164500, 00225051400, NULL }, +{ "labelClass", XtRPointer, 00000000000, 00004000000, NULL }, +{ "labelShadowWidth", XtRDimension, 00010000000, 00000000000, NULL }, +{ "labels", XtRStringArray, 00000004000, 00000000000, NULL }, +{ "layout", XtRLayout, 00000000002, 00000000000, NULL }, +{ "leafPixmap", XtRBitmap, 00002000000, 00000000000, NULL }, +{ "leafOpenPixmap", XtRBitmap, 00002000000, 00000000000, NULL }, +{ "leafCallback", XtRCallback, 00002000000, 00000000000, NULL }, +{ "left", XtREdgeType, 00000000000, 01000003000, NULL }, +{ "leftBitmap", XtRBitmap, 00000000000, 00221050400, NULL }, +{ "leftCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "leftMargin", XtRDimension, 00000160100, 00020000000, NULL }, +{ "leftMargin", XtRPosition, 00000000000, 00000000100, NULL }, +{ "length", XtRDimension, 00000000000, 00002000000, NULL }, +{ "length", XtRInt, 00000000000, 00000000140, NULL }, +{ "lineWidth", XtRDimension, 00002000000, 00440200000, NULL }, +{ "linkCallback", XtRCallback, 00000000004, 00000000000, NULL }, +{ "list", XtRPointer, 00000002000, 00000020000, NULL }, +{ "listingFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "literal", XtRBoolean, 00010000000, 00000000000, NULL }, +{ "literalWidth", XtRInt, 00010000000, 00000000000, NULL }, +{ "location", XtRString, 00000575570, 00000000000, NULL }, +{ "longest", XtRInt, 00000002000, 00000020000, NULL }, +{ "lowerCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "mappedWhenManaged", XtRBoolean, 00014777777, 01707777715, NULL }, +{ "margin", XtRDimension, 00002000000, 00000000000, NULL }, +{ "marginHeight", XtRDimension, 00000000004, 00000000000, NULL }, +{ "marginWidth", XtRDimension, 00000000004, 00000000000, NULL }, +{ "markerBoxKnotColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerBoxKnotSize", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerBoxLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerCircleKnotColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerCircleKnotSize", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerCircleLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerCursorBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerCursorFgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerEllipseKnotColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerEllipseKnotSize", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerEllipseLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerFill", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "markerFillBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerFillColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerFillStyle", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerHighlightColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerHighlightWidth", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerLineKnotColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerLineKnotSize", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerLineLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerLineStyle", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerLineWidth", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerPgonKnotColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerPgonKnotSize", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerPgonLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerRectKnotColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerRectKnotSize", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerRectLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerTextBgColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerTextBorder", XtRInt, 00000000001, 00000000000, NULL }, +{ "markerTextColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerTextFont", XtRFontStruct, 00000000001, 00000000000, NULL }, +{ "markerTextLineColor", XtRPixel, 00000000001, 00000000000, NULL }, +{ "markerTextString", XtRString, 00000000001, 00000000000, NULL }, +{ "markerTranslations", XtRString, 00000000001, 00000000000, NULL }, +{ "maskNumber", XtRInt, 00010000000, 00000000000, NULL }, +{ "max", XtRDimension, 00000000000, 00000100000, NULL }, +{ "maxAspectX", XtRInt, 00000000000, 00000000010, NULL }, +{ "maxAspectY", XtRInt, 00000000000, 00000000010, NULL }, +{ "maxColors", XtRInt, 00000000001, 00000000000, NULL }, +{ "maxHeight", XtRInt, 00000000000, 00000000010, NULL }, +{ "maxMappings", XtRInt, 00000000001, 00000000000, NULL }, +{ "maxRasters", XtRInt, 00000000001, 00000000000, NULL }, +{ "maxSelectable", XtRInt, 00000002000, 00000000000, NULL }, +{ "maxWidth", XtRInt, 00000000000, 00000000010, NULL }, +{ "menuName", XtRString, 00000000000, 00000040000, NULL }, +{ "menuOnScreen", XtRBoolean, 00000000000, 00004000000, NULL }, +{ "min", XtRDimension, 00000000000, 00000100000, NULL }, +{ "minAspectX", XtRInt, 00000000000, 00000000010, NULL }, +{ "minAspectY", XtRInt, 00000000000, 00000000010, NULL }, +{ "minHeight", XtRInt, 00000000000, 00000000010, NULL }, +{ "minScale", XtRInt, 00000000000, 00100000000, NULL }, +{ "minWidth", XtRInt, 00000000000, 00000000010, NULL }, +{ "minimumDelay", XtRInt, 00000000000, 00001000000, NULL }, +{ "minimumThumb", XtRDimension, 00000000000, 00002000000, NULL }, +{ "minsize", XtRDimension, 00000000140, 00000000000, NULL }, +{ "nearEdge", XtRInt, 00000000001, 00000000000, NULL }, +{ "nearVertex", XtRInt, 00000000001, 00000000000, NULL }, +{ "nextTop", XtRCallback, 00000775770, 00000000000, NULL }, +{ "numChildren", XtRCardinal, 00010775776, 01404503210, NULL }, +{ "numberStrings", XtRInt, 00000002000, 00000020000, NULL }, +{ "offCallback", XtRCallback, 00000100000, 00000000000, NULL }, +{ "offIcon", XtRIcon, 00000100000, 00000000000, NULL }, +{ "on", XtRBoolean, 00000100000, 00000000000, NULL }, +{ "onCallback", XtRCallback, 00000100000, 00000000000, NULL }, +{ "onIcon", XtRIcon, 00000100000, 00000000000, NULL }, +{ "orientation", XtROrientation, 00000000000, 00002100200, NULL }, +{ "outerOffset", XtRDimension, 00000575770, 00000000000, NULL }, +{ "overrideRedirect", XtRBoolean, 00000000000, 00004000010, NULL }, +{ "pathCallback", XtRCallback, 00002000000, 00000000000, NULL }, +{ "pasteBuffer", XtRBoolean, 00000002000, 00000020000, NULL }, +{ "percentVerticalSpace", XtRInt, 00000000004, 00000000000, NULL }, +{ "pickTop", XtRBoolean, 00000000000, 00002000000, NULL }, +{ "pieceSize", XtRInt, 00000000000, 00000000140, NULL }, +{ "plainFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "plainboldFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "plainitalicFont", XtRFontStruct, 00000000004, 00000000000, NULL }, +{ "pointerColor", XtRPixel, 00000002000, 00303274504, NULL }, +{ "pointerColorBackground", XtRPixel, 00000002000, 00303274504, NULL }, +{ "pointerMotionCallback", XtRPointer, 00000000004, 00000000000, NULL }, +{ "popdownCallback", XtRCallback, 00001000000, 00004000010, NULL }, +{ "popupCallback", XtRCallback, 00001000000, 00004000010, NULL }, +{ "popupOnEntry", XtRWidget, 00000000000, 00004000000, NULL }, +{ "position", XtRInt, 00000000000, 00000100000, NULL }, +{ "preferredPaneSize", XtRDimension, 00000000000, 00000100000, NULL }, +{ "previouslyVisitedTestFunction", XtRPointer, 00000000004, 00000000000, NULL }, +{ "radioData", XtRPointer, 00000000000, 00200000000, NULL }, +{ "radioGroup", XtRWidget, 00000000000, 00200000000, NULL }, +{ "raiseWindow", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "refigureMode", XtRBoolean, 00000000000, 00000100000, NULL }, +{ "rel_height", XtRFloat, 00000575570, 00000000000, NULL }, +{ "rel_width", XtRFloat, 00000575570, 00000000000, NULL }, +{ "rel_x", XtRFloat, 00000575570, 00000000000, NULL }, +{ "rel_y", XtRFloat, 00000575570, 00000000000, NULL }, +{ "repeatDelay", XtRCardinal, 00000000050, 00000000000, NULL }, +{ "repeatDelay", XtRInt, 00000000000, 00001000000, NULL }, +{ "reportCallback", XtRCallback, 00000000000, 01000600000, NULL }, +{ "resizable", XtRBoolean, 00001000000, 01000003000, NULL }, +{ "resize", XtRBoolean, 00000000000, 00201250400, NULL }, +{ "resize", XtRResizeMode, 00000000000, 00000000100, NULL }, +{ "resizeToPreferred", XtRBoolean, 00000000000, 00000100000, NULL }, +{ "resolveDelayedImage", XtRPointer, 00000000004, 00000000000, NULL }, +{ "resolveImageFunction", XtRPointer, 00000000004, 00000000000, NULL }, +{ "right", XtREdgeType, 00000000000, 01000003000, NULL }, +{ "rightBitmap", XtRBitmap, 00000000000, 00020000000, NULL }, +{ "rightCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "rightMargin", XtRDimension, 00000160100, 00020000000, NULL }, +{ "rightMargin", XtRPosition, 00000000000, 00000000100, NULL }, +{ "rowForeground", XtRPixel, 00010000000, 00000000000, NULL }, +{ "rowHeight", XtRDimension, 00000002000, 00004000000, NULL }, +{ "rowHeight", XtRInt, 00010000000, 00000000000, NULL }, +{ "rowOriented", XtRBoolean, 00010000000, 00000000000, NULL }, +{ "rowMargin", XtRDimension, 00010000000, 00000000000, NULL }, +{ "rowSpacing", XtRDimension, 00000002000, 00000020000, NULL }, +{ "rows", XtRInt, 00010414400, 00000000000, NULL }, +{ "rubberBand", XtRBoolean, 00000000000, 00000200000, NULL }, +{ "rvLength", XtRInt, 00000160100, 00000000000, NULL }, +{ "rvStart", XtRInt, 00000160100, 00000000000, NULL }, +{ "saveUnder", XtRBoolean, 00000000000, 00004000010, NULL }, +{ "screen", XtRScreen, 00010777777, 01707777715, NULL }, +{ "scrollCallback", XtRCallback, 00000000140, 00000000000, NULL }, +{ "scrollDCursor", XtRCursor, 00000000000, 00002000000, NULL }, +{ "scrollHCursor", XtRCursor, 00000000000, 00002000000, NULL }, +{ "scrollHorizontal", XtRScrollMode, 00000000000, 00000000100, NULL }, +{ "scrollLCursor", XtRCursor, 00000000000, 00002000000, NULL }, +{ "scrollProc", XtRCallback, 00000000000, 00002000000, NULL }, +{ "scrollRCursor", XtRCursor, 00000000000, 00002000000, NULL }, +{ "scrollResponse", XtRXTCallbackProc, 00000000140, 00000000000, NULL }, +{ "scrollUCursor", XtRCursor, 00000000000, 00002000000, NULL }, +{ "scrollVCursor", XtRCursor, 00000000000, 00002000000, NULL }, +{ "scrollVertical", XtRScrollMode, 00000000000, 00000000100, NULL }, +{ "scrollbarForeground", XtRPixel, 00000000040, 00000000000, NULL }, +{ "selectTypes", XtRPointer, 00000000000, 00000000100, NULL }, +{ "selectInsensitive", XtRBoolean, 00001000000, 00000000000, NULL }, +{ "selection", XtRLong, 00000004400, 00000000000, NULL }, +{ "selectionStyle", XtRSelectionType, 00000004400, 00000000000, NULL }, +{ "sensitive", XtRBoolean, 00010777777, 01777777715, NULL }, +{ "sensitiveArray", XtRPointer, 00000002000, 00000000000, NULL }, +{ "shadeSurplus", XtRBoolean, 00000002000, 00000000000, NULL }, +{ "shadow", XtRDimension, 00000000040, 00000000000, NULL }, +{ "shadowColor", XtRPixel, 00000000000, 00000200000, NULL }, +{ "shadowScheme", XtRShadowScheme, 00000575770, 00000000000, NULL }, +{ "shadowThickness", XtRDimension, 00000000000, 00000200000, NULL }, +{ "shadowWidth", XtRDimension, 00010000000, 00000000000, NULL }, +{ "shapeStyle", XtRShapeStyle, 00000000000, 00201040400, NULL }, +{ "showGrip", XtRBoolean, 00000000000, 00000100000, NULL }, +{ "shown", XtRFloat, 00000000000, 00002000000, NULL }, +{ "shrinkToFit", XtRBoolean, 00000574500, 00000000000, NULL }, +{ "skipAdjust", XtRBoolean, 00000000000, 00000100000, NULL }, +{ "sliderHeight", XtRDimension, 00000000000, 00000200000, NULL }, +{ "sliderWidth", XtRDimension, 00000000000, 00000200000, NULL }, +{ "sliderX", XtRPosition, 00000000000, 00000200000, NULL }, +{ "sliderY", XtRPosition, 00000000000, 00000200000, NULL }, +{ "startCallback", XtRCallback, 00000000000, 00001000000, NULL }, +{ "state", XtRBoolean, 00000000000, 00200000000, NULL }, +{ "stipple", XtRBitmap, 00000000000, 00040000000, NULL }, +{ "stopCallback", XtRCallback, 00000000000, 00001000000, NULL }, +{ "storeByRow", XtRBoolean, 00000414400, 00000000000, NULL }, +{ "string", XtRString, 00000000000, 00000000140, NULL }, +{ "submitFormCallback", XtRCallback, 00000000004, 00000000000, NULL }, +{ "tabForeground", XtRPixel, 00001000000, 00000000000, NULL }, +{ "tabLabel", XtRString, 00001000000, 00000000000, NULL }, +{ "tableMargin", XtRDimension, 00010000000, 00000000000, NULL }, +{ "tabLeftBitmap", XtRBitmap, 00001000000, 00000000000, NULL }, +{ "tablist", XtRString, 00000162100, 00000000000, NULL }, +{ "text", XtRString, 00000000004, 00000000000, NULL }, +{ "textSink", XtRWidget, 00000000000, 00000000100, NULL }, +{ "textSource", XtRWidget, 00000000000, 00000000100, NULL }, +{ "thickness", XtRDimension, 00000000000, 00002000000, NULL }, +{ "thumb", XtRBitmap, 00000000000, 00002000000, NULL }, +{ "thumbColor", XtRPixel, 00000000100, 00000000000, NULL }, +{ "thumbFrameType", XtRFrameType, 00000000100, 00000000000, NULL }, +{ "thumbFrameWidth", XtRDimension, 00000000100, 00000000000, NULL }, +{ "thumbPixmap", XtRPixmap, 00000000100, 00000000000, NULL }, +{ "thumbProc", XtRCallback, 00000000000, 00002000000, NULL }, +{ "title", XtRString, 00000000000, 00000000010, NULL }, +{ "titleEncoding", XtRAtom, 00000000000, 00000000010, NULL }, +{ "titleText", XtRString, 00000000004, 00000000000, NULL }, +{ "top", XtREdgeType, 00000000000, 01000003000, NULL }, +{ "topMargin", XtRDimension, 00000160100, 00004000000, NULL }, +{ "topMargin", XtRPosition, 00000000000, 00000000100, NULL }, +{ "topOfThumb", XtRFloat, 00000000000, 00002000000, NULL }, +{ "topShadowColor", XtRPixel, 00000575770, 00000000000, NULL }, +{ "topShadowPixel", XtRPixel, 00010000000, 00000000000, NULL }, +{ "topShadowPixmap", XtRPixmap, 00010000000, 00000000000, NULL }, +{ "topShadowContast", XtRInt, 00001000000, 00000000000, NULL }, +{ "topShadowStipple", XtRBitmap, 00000575770, 00000000000, NULL }, +{ "topWidget", XtRWidget, 00001000000, 00000000000, NULL }, +{ "transient", XtRBoolean, 00000000000, 00000000010, NULL }, +{ "transientFor", XtRWidget, 00000000000, 00000000010, NULL }, +{ "translations", XtRTranslationTable, 00010777777, 01707777715, NULL }, +{ "traversalOn", XtRBoolean, 00000775770, 00000000000, NULL }, +{ "treeGC", XtRGC, 00000000000, 00400000000, NULL }, +{ "treeParent", XtRWidget, 00000000000, 00400000000, NULL }, +{ "type", XtRAsciiType, 00000000000, 00000000140, NULL }, +{ "unrealizeCallback", XtRCallback, 00000000000, 00000000100, NULL }, +{ "update", XtRInt, 00000000000, 00100000000, NULL }, +{ "upperCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "useBottom", XtRBoolean, 00000000000, 01000000000, NULL }, +{ "useRight", XtRBoolean, 00000000000, 01000000000, NULL }, +{ "useStringInPlace", XtRBoolean, 00000000000, 00000000140, NULL }, +{ "useTimers", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "userData", XtRPointer, 00000775770, 00001000000, NULL }, +{ "userData", XtRPixmap, 00010000000, 00000000000, NULL }, +{ "vSpace", XtRDimension, 00000000000, 00400000200, NULL }, +{ "value", XtRString, 00000000000, 00000001000, NULL }, +{ "vertDistance", XtRInt, 00000000000, 01000003000, NULL }, +{ "vertSpace", XtRInt, 00000000000, 00020000000, NULL }, +{ "vertical", XtRBoolean, 00000000040, 00000000000, NULL }, +{ "verticalBetweenCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "verticalGripCursor", XtRCursor, 00000000000, 00000100000, NULL }, +{ "verticalList", XtRBoolean, 00000002000, 00000020000, NULL }, +{ "verticalScroll", XtRWidget, 00010000000, 00000000000, NULL }, +{ "verticalScrollBar", XtRWidget, 00000000004, 00000000000, NULL }, +{ "verticalScrollOnRight", XtRBoolean, 00000000004, 00000000000, NULL }, +{ "verticalSpacing", XtRDimension, 00002000000, 00000000000, NULL }, +{ "view", XtRWidget, 00000000004, 00000000000, NULL }, +{ "visitedAnchorColor", XtRPixel, 00000000004, 00000000000, NULL }, +{ "visitedAnchorUnderlines", XtRInt, 00000000004, 00000000000, NULL }, +{ "visual", XtRVisual, 00000000000, 00004000010, NULL }, +{ "vunit", XtRFloat, 00000575570, 00000000000, NULL }, +{ "waitforwm", XtRBoolean, 00000000000, 00000000010, NULL }, +{ "warpCursor", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "whatCell", XtRCallback, 00010000000, 00000000000, NULL }, +{ "width", XtRDimension, 00014777777, 01777777715, NULL }, +{ "widthInc", XtRInt, 00000000000, 00000000010, NULL }, +{ "winGravity", XtRInt, 00000000000, 00000000010, NULL }, +{ "windowGroup", XtRWindow, 00000000000, 00000000010, NULL }, +{ "wmTimeout", XtRInt, 00000000000, 00000000010, NULL }, +{ "wrap", XtRWrapMode, 00000000000, 00000000100, NULL }, +{ "x", XtRPosition, 00014777777, 01777777715, NULL }, +{ "xorFill", XtRBoolean, 00000000001, 00000000000, NULL }, +{ "xorFillBgColor", XtRInt, 00000000001, 00000000000, NULL }, +{ "xorFillColor", XtRInt, 00000000001, 00000000000, NULL }, +{ "y", XtRPosition, 00014777777, 01777777715, NULL }, diff --git a/vendor/x11iraf/obm/param.c b/vendor/x11iraf/obm/param.c new file mode 100644 index 00000000..27226330 --- /dev/null +++ b/vendor/x11iraf/obm/param.c @@ -0,0 +1,401 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ObmP.h> + + +/* + * UI PARAMETER class. + * -------------------------- + * The UI parameter class is used for client-UI communications. The client + * does not control the user interface directly, rather the UI defines a set + * of abstract UI parameters, and during execution the client application + * assigns values to these parameters. These UI parameters should be thought + * of as describing the runtime state of the client as viewed by the GUI. + * The GUI is free to interpret this state information in any way, including + * ignoring it. Many GUIs can be written which use the same client state + * as described by the UI parameters. + * + * Assigning a value to a UI parameter causes the new value to be stored, and + * any parameter action procedures registered by the UI to be called. + * The action or actions (if any) taken when a parameter value changes are + * arbitrary, e.g. the action might be something as simple as changing a + * displayed value of a UI widget, or something more complex like displaying + * a popup. + * + * UI Parameter class commands: + * + * getValue + * setValue <new-value> + * addCallback <procedure-name> + * deleteCallback <procedure-name> + * notify + * + * The most common usage is for the GUI to post one or more callbacks for + * each UI parameter. When the UI parameter value is changed (with setValue, + * e.g. by the client) the GUI callback procedures are called with the old + * and new UI parameter values on the command line. addCallback is used to + * add a callback procedure, and deleteCallback to delete one. Multiple + * callbacks may be registered for a single UI parameter. notify is used + * to simulate a parameter value change, causing any callback procedures to + * be invoked. + * + * The callback procedure is called as follows: + * + * user-procedure param-name {old-value} {new-value} + * + * The important thing to note here is that the old and new value strings + * are quoted with braces. This prevents any interpretation of the string + * by Tcl when the callback is executed, which is necessary because the + * strings can contain arbitrary data. When Tcl calls the callback the + * first level of braces will be stripped off, leaving old-value and new-value + * each as a single string argument. + */ + +struct parameterPrivate { + ObmContext obm; + char *value; + int len_value; + ObmCallback callback; +}; + +typedef struct parameterPrivate *ParameterPrivate; + +struct parameterObject { + struct obmObjectCore core; + struct parameterPrivate parameter; +}; + +typedef struct parameterObject *ParameterObject; + +/* Object message context. */ +struct msgContext { + Tcl_Interp *tcl; /* class interpreter */ + ObmObject object[MAX_LEVELS]; /* object which received last message */ + int level; +}; +typedef struct msgContext *MsgContext; + +static void ParameterDestroy(); +static int ParameterEvaluate(); +static ObmObject ParameterCreate(); +static void ParameterClassDestroy(); +static int parameterSetValue(), parameterGetValue(), parameterNotify(); +static int parameterAddCallback(), parameterDeleteCallback(); + + +/* ParameterClassInit -- Initialize the class record for the parameter class. + */ +void +ParameterClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register Tcl_Interp *tcl; + register MsgContext msg; + + /* Install the class methods. */ + classrec->ClassDestroy = ParameterClassDestroy; + classrec->Create = (ObmFunc) ParameterCreate; + classrec->Destroy = ParameterDestroy; + classrec->Evaluate = ParameterEvaluate; + + /* Since there can be many instances of the parameter object and + * they all respond to the same class messages, a single interpreter + * is used for all objects. + */ + msg = (MsgContext) XtMalloc (sizeof (struct msgContext)); + classrec->class_data = (XtPointer) msg; + msg->tcl = tcl = Tcl_CreateInterp(); + msg->level = 0; + + /* Register parameter-object actions. */ + Tcl_CreateCommand (tcl, "setValue", + parameterSetValue, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, "getValue", + parameterGetValue, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, "addCallback", + parameterAddCallback, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, "deleteCallback", + parameterDeleteCallback, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, "notify", + parameterNotify, (ClientData)msg, NULL); +} + + +/* ParameterClassDestroy -- Custom destroy procedure for the parameter + * class. + */ +static void +ParameterClassDestroy (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register MsgContext msg = (MsgContext) classrec->class_data; + + if (msg) { + if (msg->tcl) + Tcl_DeleteInterp (msg->tcl); + XtFree ((char *)msg); + classrec->class_data = NULL; + } +} + + +/* ParameterCreate -- Create an instance of a parameter object. + */ +static ObmObject +ParameterCreate (obm, name, classrec, parent, args, nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList args; +int nargs; +{ + register ParameterObject obj; + + obj = (ParameterObject) XtCalloc (1, sizeof (struct parameterObject)); + obj->parameter.obm = obm; + + return ((ObmObject) obj); +} + + +/* ParameterDestroy -- Destroy an instance of a parameter object. + */ +static void +ParameterDestroy (object) +ObmObject object; +{ + register ParameterObject obj = (ParameterObject) object; + register ObmCallback cb, next; + + /* Destroy the object in the second final call to Destroy. */ + if (!obj->core.being_destroyed++) + return; + + XtFree ((char *)obj->parameter.value); + for (cb = obj->parameter.callback; cb; cb = next) { + next = cb->next; + XtFree ((char *)cb); + } +} + + +/* ParameterEvaluate -- Evaluate a parameter command or message. + */ +static int +ParameterEvaluate (object, command) +ObmObject object; +char *command; +{ + register ParameterObject obj = (ParameterObject) object; + register MsgContext msg = (MsgContext) obj->core.classrec->class_data; + register ObmContext obm = obj->parameter.obm; + int status; + + /* Since the class wide interpreter is used to evaluate the message + * we can't pass the object descriptor directly to the class procedure + * referenced in the message. Instead we pass the object reference + * in the message descriptor. + */ + msg->object[++msg->level] = object; + Tcl_SetResult (obm->tcl, "", TCL_VOLATILE); + + if (!obmClientCommand (msg->tcl, command)) { + Tcl_SetResult (obm->tcl, "invalid command", TCL_VOLATILE); + status = TCL_ERROR; + } else { + status = Tcl_Eval (msg->tcl, command); + if (status == TCL_ERROR) { + if (*msg->tcl->result) + Tcl_SetResult (obm->tcl, msg->tcl->result, TCL_VOLATILE); + else { + /* Supply a default error message if none was returned. */ + Tcl_SetResult (obm->tcl, "evaluation error", TCL_VOLATILE); + } + obm->tcl->errorLine = msg->tcl->errorLine; + + } else if (*msg->tcl->result) + Tcl_SetResult (obm->tcl, msg->tcl->result, TCL_VOLATILE); + } + + msg->level--; + return (status); +} + + +/* parameterSetValue -- Set the value of a parameter, and notify all clients + * via the posted callback procedures that the parameter value has changed. + * + * Usage: setValue <new-value> + */ +static int +parameterSetValue (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ParameterObject obj = (ParameterObject) msg->object[msg->level]; + register ObmContext obm = obj->parameter.obm; + register ParameterPrivate pp = &obj->parameter; + char *new_value, *old_value; + ObmCallback cb, cbl[128]; + int ncb, status, i; + + /* Assign new value. */ + old_value = pp->value; + pp->len_value = strlen (argv[1]); + pp->value = new_value = XtMalloc (pp->len_value + 1); + memmove (pp->value, argv[1], pp->len_value + 1); + + /* Safeguard callback list against changes by callback procs. */ + for (cb = pp->callback, ncb=0; cb; cb = cb->next) + cbl[ncb++] = cb; + + /* Notify clients that value has changed. */ + for (i=0; i < ncb && (cb = cbl[i]) != NULL; i++) { +/*printf ("setValue: i=%d obj='%s' cb='%s' new='%s'\n", +i, obj->core.name, cb->name, new_value);*/ + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "{", old_value ? old_value : "", "} ", + "{", new_value, "} ", + NULL); + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } + } + + XtFree ((char *)old_value); + Tcl_SetResult (obm->tcl, "", TCL_STATIC); + return (TCL_OK); +} + + +/* parameterGetValue -- Get the value of a parameter. + * + * Usage: getValue + */ +static int +parameterGetValue (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ParameterObject obj = (ParameterObject) msg->object[msg->level]; + register ObmContext obm = obj->parameter.obm; + register ParameterPrivate pp = &obj->parameter; + + Tcl_SetResult (obm->tcl, pp->value, TCL_STATIC); + return (TCL_OK); +} + + +/* parameterNotify -- Notify the registered clients of a parameter as if the + * value had changed. + * + * Usage: notify + */ +static int +parameterNotify (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ParameterObject obj = (ParameterObject) msg->object[msg->level]; + register ObmContext obm = obj->parameter.obm; + register ParameterPrivate pp = &obj->parameter; + ObmCallback cb; + int status; + + /* Notify clients. */ + for (cb = pp->callback; cb; cb = cb->next) { + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + "{", pp->value, "} ", + "{", pp->value, "} ", + NULL); + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } + } + + Tcl_SetResult (obm->tcl, "", TCL_STATIC); + return (TCL_OK); +} + + +/* parameterAddCallback -- Add a callback procedure to the callback list for + * a parameter. + * + * Usage: addCallback <procedure-name> + */ +static int +parameterAddCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ParameterObject obj = (ParameterObject) msg->object[msg->level]; + register ParameterPrivate pp = &obj->parameter; + ObmCallback cb, new_cb; + + /* Create callback record. */ + new_cb = (ObmCallback) XtCalloc (1, sizeof (obmCallback)); + strcpy (new_cb->name, argv[1]); + + /* Add callback to tail of callback list. */ + if (pp->callback) { + for (cb = pp->callback; cb->next; cb = cb->next) + ; + cb->next = new_cb; + } else + pp->callback = new_cb; + + return (TCL_OK); +} + + +/* parameterDeleteCallback -- Delete a callback procedure previously registered + * for a parameter. + * + * Usage: deleteCallback <procedure-name> + */ +static int +parameterDeleteCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ParameterObject obj = (ParameterObject) msg->object[msg->level]; + register ParameterPrivate pp = &obj->parameter; + ObmCallback cb, prev; + + /* Locate and delete procedure entry in callback list. */ + for (prev=NULL, cb=pp->callback; cb; prev=cb, cb=cb->next) + if (strcmp (cb->name, argv[1]) == 0) { + if (prev) + prev->next = cb->next; + else + pp->callback = cb->next; + XtFree ((char *)cb); + break; + } + + return (TCL_OK); +} diff --git a/vendor/x11iraf/obm/server.c b/vendor/x11iraf/obm/server.c new file mode 100644 index 00000000..fa46d2fd --- /dev/null +++ b/vendor/x11iraf/obm/server.c @@ -0,0 +1,3175 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ObmP.h> + +/* The following internal files are needed for some widget level SmeBSB code + * included in this file. + */ +#include <X11/IntrinsicP.h> +#include <X11/Xaw/SmeBSBP.h> + +/* + * SERVER class. + * -------------------------- + * The server, or object manager, is the control center of the user interface. + * The server object provides a Tcl interpreter calling custom object manager + * commands. These are used to define and initialize the user interface, and + * execute UI action procedures at runtime. + * + * reset-server + * appInitialize appname, appclass, resources + * appExtend new-resources [overwrite] + * createObjects [resource-name] + * destroyObject object + * queryObject object [class [subclass]] + * activate + * deactivate [unmap] + * synchronize + * flush + * + * value = getResource resource-name [default-value [class]] + * getResources resource-list + * + * createMenu menu-name parent item-list + * editMenu menu-name parent item-list + * destroyMenu menu-name + * + * createBitmap name width height data + * createCursor name source mask fg_color bg_color x_hot y_hot + * createPixmap name width height depth fg_color bg_color data + * createXPixmap name widget description + * + * print arg [arg ...] # debug messages + * send object message + * + * postActivateCallback procedure + * postDeactivateCallback procedure + * + * id = postTimedCallback procedure msec [client-data] + * deleteTimedCallback id + * id = postWorkProc procedure [client-data] + * deleteWorkProc id + */ + +#define CB_WORKPROC 1 +#define CB_TIMER 2 + +/* Callback structure for timer, workproc callbacks. */ +struct _serverCallback { + XtPointer obj; + int callback_type; + char *userproc; + char *client_data; + union { + XtIntervalId intervalId; + XtWorkProcId workProcId; + } id; + struct _serverCallback *next; +}; +typedef struct _serverCallback serverCallback; +typedef struct _serverCallback *ServerCallback; + +struct serverPrivate { + ObmContext obm; + ServerCallback cb_head; + ServerCallback cb_tail; +}; + +typedef struct serverPrivate *ServerPrivate; + +struct serverObject { + struct obmObjectCore core; + struct serverPrivate server; +}; + +typedef struct serverObject *ServerObject; + +static ObmObject ServerCreate(); +static void ServerDestroy(); +static int ServerEvaluate(), serverQueryObject(); +static int serverCreateMenu(), serverDestroyMenu(); +static int serverAppInitialize(), serverAppExtend(), serverCreateObjects(); +static int serverSend(), serverPrint(), serverDestroyObject(); +static int serverReset(), serverActivate(), serverDeactivate(); +static int serverCreateBitmap(), serverCreatePixmap(), serverCreateCursor(); +static int serverPostActivateCallback(), serverPostDeactivateCallback(); +static int serverPostTimedCallback(), serverPostWorkProc(); +static int serverDeleteTimedCallback(), serverDeleteWorkProc(); +static int serverCreateXPixmap(), serverSynchronize(), serverFlush(); +static int serverGetResource(), serverGetResources(); +static void link_callback(), unlink_callback(); +static void serverTimedProc(); +static Boolean serverWorkProc(); + +static int editMenu(); +static void menu_popup(), menu_popdown(), menu_popdown_msgHandler(); +static void createMenu(), menuSelect(), build_colorlist(); +static void menu_classInit(), menu_addEntry(), menu_delEntry(); +static void menu_highlight(), menu_unhighlight(); +static Pixmap menu_pullrightBitmap(); +static MenuPtr findMenu(); +extern long strtol(); + +/* The pull-right bitmap for menus. */ +#define MB_WIDTH 16 +#define MB_HEIGHT 16 +#define MB1_PIXELS \ + "0x00, 0x00, 0x30, 0x00, 0xf0, 0x00, 0xf0, 0x03, 0xf0, 0x0f, 0xf0, 0x0f,\ + 0xf0, 0x03, 0xf0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00" +#define MB2_PIXELS \ + "0x00, 0x00, 0x30, 0x00, 0xd0, 0x00, 0x10, 0x03, 0x10, 0x0c, 0x10, 0x0c,\ + 0x10, 0x03, 0xd0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00" + + +/* ServerClassInit -- Initialize the class record for the server class. + */ +void +ServerClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + classrec->ClassDestroy = obmGenericClassDestroy; + classrec->Create = (ObmFunc) ServerCreate; + classrec->Destroy = ServerDestroy; + classrec->Evaluate = ServerEvaluate; +} + + +/* ServerCreate -- Create an instance of a server object. + */ +static ObmObject +ServerCreate (obm, name, classrec, parent, args, nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList args; +int nargs; +{ + register ServerObject obj; + register Tcl_Interp *tcl; + + obj = (ServerObject) XtCalloc (1, sizeof (struct serverObject)); + obm->tcl = tcl = Tcl_CreateInterp(); + obj->server.obm = obm; + + /* Register server actions. */ + Tcl_CreateCommand (tcl, + "reset-server", serverReset, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "activate", serverActivate, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "deactivate", serverDeactivate, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "synchronize", serverSynchronize, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "flush", serverFlush, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "postActivateCallback", serverPostActivateCallback, + (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "postDeactivateCallback", serverPostDeactivateCallback, + (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "appInitialize", serverAppInitialize, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "appExtend", serverAppExtend, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "createObjects", serverCreateObjects, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "destroyObject", serverDestroyObject, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "queryObject", serverQueryObject, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "send", serverSend, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "print", serverPrint, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "getResource", serverGetResource, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "getResources", serverGetResources, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "postTimedCallback", serverPostTimedCallback, + (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "deleteTimedCallback", serverDeleteTimedCallback, + (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "postWorkProc", serverPostWorkProc, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "deleteWorkProc", serverDeleteWorkProc, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "createBitmap", serverCreateBitmap, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "createPixmap", serverCreatePixmap, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "createXPixmap", serverCreateXPixmap, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "createCursor", serverCreateCursor, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "createMenu", serverCreateMenu, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "editMenu", serverCreateMenu, (ClientData)obj, NULL); + Tcl_CreateCommand (tcl, + "destroyMenu", serverDestroyMenu, (ClientData)obj, NULL); + + return ((ObmObject) obj); +} + + +/* ServerDestroy -- Destroy an instance of a server object. + */ +static void +ServerDestroy (object) +ObmObject object; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + register ServerCallback cb, next; + + /* Destroy the object in the second final call to Destroy. */ + if (!obj->core.being_destroyed++) + return; + + /* Delete any pending timers or work procs. */ + for (cb = obj->server.cb_head; cb; cb = next) { + next = cb->next; + switch (cb->callback_type) { + case CB_TIMER: + XtRemoveTimeOut (cb->id.intervalId); + break; + case CB_WORKPROC: + XtRemoveWorkProc (cb->id.workProcId); + break; + } + XtFree ((char *)cb); + } + + obj->server.cb_head = NULL; + obj->server.cb_tail = NULL; + + /* Destroy the server interpreter. */ + if (obm->tcl) { + Tcl_DeleteInterp (obm->tcl); + obm->tcl = NULL; + } +} + + +/* ServerEvaluate -- Evaluate a server command or message. + */ +static int +ServerEvaluate (object, command) +ObmObject object; +char *command; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + static char reset[] = "reset-server"; + register char *ip; + + /* The command "reset-server" is a special case. This destroys the + * current user interface including all objects and widgets. One + * of the objects destroyed is the server object including the tcl + * interpreter. We can't use a normal Tcl command to implement this + * as the server and Tcl data structures will be freed and the rest + * of the input command would be lost. Instead, we check for the + * reset-server command, which must be the first command in the input + * command string, and manually reset things then call Tcl to process + * the remainder of the input command. The reset-server command should + * be the first command in the server config file used to define the + * user interface for a new application. Comments and blank lines + * at the head of the file are ignored. + */ + for (ip=command; *ip; ) { + while (isspace (*ip)) + ip++; + if (*ip == '#') + while (*ip && *ip != '\n') + ip++; + if (isspace (*ip)) + ip++; + else + break; + } + if (strncmp (ip, reset, strlen(reset)) == 0) { + ObmInitialize (obm); + obj = (ServerObject) obmFindObject (obm, "Server"); + } + + /* Now interpret the full message using Tcl. This re-executes the + * reset-server command, which will be ignored since this is a no-op + * when it occurs within a script. We want to leave the command in + * the script as otherwise the line numbers won't be correct. + */ + return (Tcl_Eval (obm->tcl, command)); +} + + +/* serverAppInitialize -- TCL command to initialize the server for a new + * application, setting the application name and loading the application + * resources. + * + * Usage: appInitialize appname, appclass, resources + */ +static int +serverAppInitialize (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + register ObmCallback cb; + + char *resource_buf, *resource_list[MAX_RESOURCES]; + char *appname, *appclass, *resources; + int sv_argc, nresources; + char **sv_argv; + char *ip, *op; + + /* Get arguments. */ + if (argc >= 2) { + strcpy (obm->appname, appname = argv[1]); + strcpy (obm->appclass, appclass = argv[2]); + } else { + appname = "gterm-iraf"; + appclass = "Xgterm"; + } + + if (argc >= 3) + resources = argv[3]; + else + resources = ""; + + /* Get fallback resources. */ + resource_buf = op = XtMalloc (strlen(resources) + MAX_RESOURCES); + resource_list[0] = op; + nresources = 0; + + for (ip=resources; *ip; ip++) { + while (*ip && (*ip == ' ' || *ip == '\t')) + ip++; + if (*ip == '\n') { + ; + } else if (*ip == '!') { + while (*ip && *ip != '\n') + ip++; + } else { + while (*ip && *ip != '\n') + *op++ = *ip++; + *op++ = '\0'; + nresources++; + resource_list[nresources] = op; + } + } + *op++ = '\0'; + resource_list[nresources] = NULL; + + /* Set fallback resources. */ + XtAppSetFallbackResources (obm->app_context, resource_list); + + /* Get local copy of argc and argv. */ + if ((sv_argc = obm->argc) > 0) { + sv_argv = (char **) XtMalloc (obm->argc * sizeof(char *)); + memmove (sv_argv, obm->argv, obm->argc * sizeof(char *)); + } else + sv_argv = obm->argv; + + /* Open the display (initializes the resource database). A separate + * display descriptor is used so that we can specify the application + * name, class, and resources independently from those of the + * application using the object manager. + */ + obm->display = XtOpenDisplay (obm->app_context, (String)NULL, + appname, appclass, NULL, 0, &sv_argc, sv_argv); + if (obm->display == (Display *)NULL) + XtAppError (obm->app_context, "appInitialize: Can't open display."); + + if (obm->debug > 1) + XSynchronize (obm->display, True); + + /* Create the top level shell. */ + obm->toplevel = XtAppCreateShell (appname, appclass, + applicationShellWidgetClass, obm->display, (ArgList)NULL, 0); + obm->screen = XtScreen (obm->toplevel); + + /* Call the client's display connection callback if any. */ + for (cb = obm->callback_list; cb; cb = cb->next) + if ((cb->callback_type & OBMCB_connect) && cb->u.fcn) + (*cb->u.fcn) (cb->client_data, obm->display, obm->toplevel, 1); + + /* Add the toplevel shell to the application's object list. */ + obmNewObject (obm, "toplevel", "TopLevelShell", NULL, NULL, 0); + + if (obm->argc > 0) + XtFree ((char *)sv_argv); + XtFree ((char *)resource_buf); + XtAppSetFallbackResources (obm->app_context, NULL); + + obm->specified++; + return (TCL_OK); +} + + +/* serverAppExtend -- TCL command to extend the application resource database + * to allow for the creation of new widgets loaded since the application was + * first started. The 'overwrite' option, if present, says to allow the new + * resource strings to overwrite the existing resources, otherwise the older + * ones will not be changed. + * + * Usage: appExtend new-resources [overwrite] + */ +static int +serverAppExtend (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + XrmDatabase old_db, extended_db; + Boolean overwrite = False; + char *resources; + + + if (!obm->specified || !obm->display || argc < 2) + return (TCL_ERROR); + + /* Get arguments. */ + resources = argv[1]; + overwrite = (argc > 2) ? (strcmp (argv[2], "overwrite") == 0) : False; + + /* Get the current fallback resource database. */ + old_db = XrmGetDatabase (obm->display); + if (old_db == (XrmDatabase) NULL) + return (TCL_ERROR); + + /* Create a database structure from the resource string. */ + extended_db = XrmGetStringDatabase (resources); + if (extended_db == (XrmDatabase) NULL) + return (TCL_ERROR); + + /* Combine the old an new databases. */ + XrmCombineDatabase (extended_db, &old_db, overwrite); + + /* Update the application resource database. */ + XrmSetDatabase (obm->display, old_db); + + return (TCL_OK); +} + + +/* serverCreateObjects -- TCL command to create the tree of UI objects + * comprising the user interface. The object tree is defined by a string + * valued resource. If no resource is named the default "objects" resource + * will be used. + * + * Usage: createObjects [resource-name] + */ +static int +serverCreateObjects (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register char *ip, *op; + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + char name[SZ_NAME], class[SZ_NAME], parent[SZ_NAME]; + char *objects = NULL; + XtResource r; + + r.resource_name = (argc >= 2) ? argv[1] : "objects"; + r.resource_class = "Objects"; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) NULL; + + /* Get the UI object list. */ + XtGetApplicationResources (obm->toplevel, &objects, &r, 1, NULL, 0); + /* XrmPutFileDatabase (obm->display->db, "zz.list"); */ + + /* Parse the objects list and create the objects. Each entry has + * the form "parent object-class object-name" with a newline (or + * other whitespace) terminating each entry. + */ + for (ip = objects; ip && *ip; ) { + /* Get name of parent object. */ + while (isspace (*ip)) + ip++; + for (op=parent; *ip && !isspace(*ip); ) + *op++ = *ip++; + *op = '\0'; + + /* Get object class. */ + while (isspace (*ip)) + ip++; + for (op=class; *ip && !isspace(*ip); ) + *op++ = *ip++; + *op = '\0'; + + /* Get object name. */ + while (isspace (*ip)) + ip++; + for (op=name; *ip && !isspace(*ip); ) + *op++ = *ip++; + *op = '\0'; + + /* Create the new object. */ + if (*name && *class && *parent) + obmNewObject (obm, name, class, parent, NULL, 0); + + while (isspace (*ip)) + ip++; + } + + return (TCL_OK); +} + + +/* serverDestroyObject -- Destroy an object and all of its children. + * + * Usage: destroyObject object-name + */ +static int +serverDestroyObject (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + char *object_name; + ObmObject killobj; + + if (argc < 2) + return (TCL_ERROR); + + object_name = argv[1]; + if ((killobj = obmFindObject (obm, object_name)) == NULL) + return (TCL_ERROR); + obmDestroyObject (obm, killobj); + + return (TCL_OK); +} + + +/* serverQueryObject -- Test if the named object exists. + * + * Usage: queryObject object-name [class [subclass]] + * + * A nonzero function value is returned if the named object exists. The + * class and subclass of the object are optionally returned in the output + * variables given on the command line. + */ +static int +serverQueryObject (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + char *object_name, *s_class, *s_subclass; + ObjClassRec classrec; + ObmObject o; + + if (argc < 2) + return (TCL_ERROR); + + object_name = argv[1]; + s_class = (argc > 2) ? argv[2] : NULL; + s_subclass = (argc > 3) ? argv[3] : NULL; + + if (o = obmFindObject (obm, object_name)) { + classrec = o->core.classrec; + if (s_class) { + BaseClassRec bp; + int i; + + for (i=0; i < OtNClasses; i++) { + bp = &baseClasses[i]; + if (bp->class == classrec->object_type) { + Tcl_SetVar (obm->tcl, s_class, bp->name, 0); + break; + } + } + } + if (s_subclass) + Tcl_SetVar (obm->tcl, s_subclass, + (classrec->object_type == OtShell) ? + "Shell" : classrec->name, 0); + + Tcl_SetResult (obm->tcl, TRUESTR, TCL_STATIC); + } else + Tcl_SetResult (obm->tcl, FALSESTR, TCL_STATIC); + + return (TCL_OK); +} + + +/* serverActivate -- Activate the user interface. When called the first + * time the user interface is created and activated, thereafter the UI is + * merely reactivated (e.g. mapped if unmapped). + * + * Usage: activate + */ +static int +serverActivate (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + XWMHints hints; + register int i; + ObmObject child; + Widget w; + + + /* Activate the interface. */ + ObmActivate (obm); + + + /* Now set the WM hints for the toplevel shell and any subwindows + * of the UI. Certain ICCCM-compliant window managers make assumptions + * about how the client windows will handle input focus if it's not + * set explicitly, and often the UI is not given the focus. + */ + hints.flags = InputHint | StateHint; + hints.input = True; + hints.initial_state = NormalState; + hints.icon_pixmap = None; + hints.icon_window = None; + hints.icon_x = hints.icon_y = 0; + hints.icon_mask = None; + hints.window_group = None; + + XSetWMHints(obm->display, XtWindow(obm->toplevel), &hints); + + obj = (ServerObject) obmFindObject (obm, "toplevel"); + for (i=0; i < obj->core.nchildren; i++) { + child = obj->core.children[i]; + if (child->core.classrec->object_type == OtShell) { + w = widgetGetPointer (child); + XSetWMHints(obm->display, XtWindow(w), &hints); + } + } + + return (TCL_OK); +} + + +/* serverDeactivate -- Deactivate the user interface. Optionally unmaps the + * UI and calls the Obm client back to let it know that the UI has been + * deactivated. + * + * Usage: deactivate [unmap] + */ +static int +serverDeactivate (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + + ObmDeactivate (obm, argc >=2 && strcmp(argv[1],"unmap") == 0); + return (TCL_OK); +} + + +/* serverSynchronize -- Synchronize the user interface. + * + * Usage: synchronize + * + * Any buffered output to the display is flushed and execution pauses until + * the display has caught up. It is rarely necessary to sychronize the + * display with the client and this defeats the purpose of command buffering, + * hence should be done only when necessary. Try "flush" below first. + */ +static int +serverSynchronize (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + + XSync (obm->display, False); + while (XtAppPending (obm->app_context)) + XtAppProcessEvent (obm->app_context, XtIMAll); + + return (TCL_OK); +} + + +/* serverFlush -- Flush output to the user interface. + * + * Usage: flush + * + * Any buffered output to the display is flushed to the display and + * execution continues. + */ +static int +serverFlush (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + + XFlush (obm->display); + + return (TCL_OK); +} + + +/* serverPostActivateCallback -- Post a callback procedure to be called + * when the UI is activated. The UI is activated when it is first + * downloaded to server, but it may also be activated (reactivated) after + * the application has exited and is later restarted, or when the UI + * is deactivated and reactivated. Note that the UI state vis-a-vis the + * external world (client application) may no longer be accurate after + * it has been idle for a time and then reactivated. + * + * Usage: postActivateCallback <procedure> + */ +static int +serverPostActivateCallback (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + register ObmCallback cb; + + if (argc < 2) + return (TCL_ERROR); + if (!(cb = obmAddCallback (&obm->callback_list))) + return (TCL_ERROR); + + cb->callback_type = OBMUI_activate; + strncpy (cb->name, argv[1], SZ_NAME); + + return (TCL_OK); +} + + +/* serverPostDeactivateCallback -- Post a callback procedure to be called + * when the UI is deactivated. + * + * Usage: postDeactivateCallback <procedure> + */ +static int +serverPostDeactivateCallback (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + register ObmCallback cb; + + if (argc < 2) + return (TCL_ERROR); + if (!(cb = obmAddCallback (&obm->callback_list))) + return (TCL_ERROR); + + cb->callback_type = OBMUI_deactivate; + strncpy (cb->name, argv[1], SZ_NAME); + + return (TCL_OK); +} + + +/* serverSend -- Send a message to an object. The object interprets the + * message and returns a function value as the string result of the TCL + * command. + * + * Usage: send <object> <message> + */ +static int +serverSend (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + int status; + + /* The object which interprets the message leaves the string result, + * if any, directly in the server tcl result string. + */ + if (argc == 3) + status = ObmDeliverMsg (obm, argv[1], argv[2]); + else { + char *message = Tcl_Merge (argc-2, &argv[2]); + status = ObmDeliverMsg (obm, argv[1], message); + free ((char *)message); + } + + return (status); +} + + +/* serverPrint -- Print a string on the standard output. This is used mainly + * for debugging user interfaces. + * + * Usage: print arg [arg ...] + */ +static int +serverPrint (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + + if (argc >= 2) { + char *message = Tcl_Concat (argc-1, &argv[1]); + printf ("%s\n", message); + fflush (stdout); + free ((char *)message); + } + + return (TCL_OK); +} + + +/* serverReset -- The "reset-server" command is implemented as a special + * case in ServerEvaluate. After doing a true reset ServerEvaluate calls + * Tcl_Eval to evaluate the full message which still contains the reset-server + * command. We want to ignore this the second time, so we treat the command + * here as a no-op. + * + * Usage: reset-server + * + * Note: for reset-server to be recognized by ServerEvaluate and really reset + * things, it must be the first command in a message to the server. + */ +static int +serverReset (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + return (TCL_OK); +} + + +/* serverGetResource -- Get the string value of the specified application + * resource (window system parameter). This allows use of the resource + * mechanism to supply default values for GUI parameters. + * + * Usage: value = getResource resource-name [class [default-value]] + * + * In the simplest case one merely requests a resource by name and the + * string value is returned as the function value. If the resource has + * an entry in the fallback resources for the application (appInitialize + * resource list) then a value is guaranteed to be returned. + * + * If the Class name for the resource is given then a class default value + * will be returned if no entry is found for the name resource instance. + * This is useful when there are a number of resources of the same type + * (same class). If most or all resources in the same class have the same + * default value one need only make one entry for the Class in the application + * defaults resource list. It is up to the application developer to define + * the class name of a resource - the class name can be any string. Examples + * are "Font", "Cursor", etc. By convention the first character of a class + * name is capitalized, while instance names begin with a lower case letter. + * + * If there is an entry for the named resource in the resource list passed + * to appInitialize then a value string is guaranteed to be returned. This + * will be either the appInitialize default, or a value specified by the + * system or the user in an X resources file. If one is not certain a + * default value is defined somewhere, a default value should be specified + * in the getResource call as shown above. + * + * See also getResources, used to get multiple resources in one call. + */ +static int +serverGetResource (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + char *resource_name, *class_name, *default_value; + char *value = NULL; + XtResource r; + + if (argc < 2) + return (TCL_ERROR); + + resource_name = argv[1]; + class_name = (argc > 2) ? argv[2] : XtCString; + default_value = (argc > 3) ? argv[3] : ""; + + r.resource_name = resource_name; + r.resource_class = class_name; + r.resource_type = XtRString; + r.resource_size = sizeof (char *); + r.resource_offset = 0; + r.default_type = XtRString; + r.default_addr = (caddr_t) default_value; + + XtGetApplicationResources (obm->toplevel, &value, &r, 1, NULL, 0); + Tcl_SetResult (tcl, value, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* serverGetResources -- Get the string values of a list of resources. + * + * Usage: getResources resource-list + * e.g. + * getResources { + * { resource [variable class [default-value]]] } + * { resource [variable class [default-value]]] } + * (etc.) + * } + * + * The resource list is a list of resource descriptions. Each resource + * entry must give at least the resource name. If no Tcl variable is named + * the resource name will be used and this variable will be set to the + * resource value. The class name and default value fields are optional. + */ +static int +serverGetResources (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + register XtResource *r; + XtResource resources[MAX_RESOURCES]; + char *resource_name, *class_name, *default_value; + char *resource_list, *variable; + char **items, **fields; + int nitems, nfields; + char buf[SZ_NUMBER]; + int item, i; + + typedef struct { + char *variable; + char *value; + char *item_list; + } Value; + Value values[MAX_RESOURCES]; + + if (argc < 2) { + tcl->result = "missing resource-list argument"; + return (TCL_ERROR); + } else + resource_list = argv[1]; + + if (Tcl_SplitList (tcl, resource_list, &nitems, &items) != TCL_OK) { + tcl->result = "could not parse resource list"; + return (TCL_ERROR); + } else if (nitems > MAX_MENUITEMS) + nitems = MAX_MENUITEMS; + + for (item=0; item < nitems; item++) { + if (Tcl_SplitList (tcl, items[item], &nfields, &fields) != TCL_OK) { +err: sprintf (buf, "bad item '%d' in resource list", item + 1); + Tcl_AppendResult (tcl, buf, NULL); + for (i=0; i < item; i++) + free (values[item].item_list); + return (TCL_ERROR); + } + + if (nfields < 1) + goto err; + + resource_name = fields[0]; + variable = (nfields > 1) ? fields[1] : fields[0]; + class_name = (nfields > 2) ? fields[2] : XtCString; + default_value = (nfields > 3) ? fields[3] : ""; + + r = &resources[item]; + r->resource_name = resource_name; + r->resource_class = class_name; + r->resource_type = XtRString; + r->resource_size = sizeof (char *); + r->resource_offset = (unsigned int) &(((Value *)NULL)[item].value); + r->default_type = XtRString; + r->default_addr = (caddr_t) default_value; + + values[item].variable = variable; + values[item].item_list = (char *) fields; + } + + XtGetApplicationResources (obm->toplevel, + (XtPointer) values, resources, nitems, NULL, 0); + + for (item=0; item < nitems; item++) { + if (Tcl_SetVar (tcl, + values[item].variable, values[item].value, 0) == NULL) { + fprintf (stderr, + "Warning (getResources): cannot set value of %s\n", + values[item].variable); + } + free (values[item].item_list); + } + free ((char *) items); + + return (TCL_OK); +} + + +/* serverPostTimedCallback -- Post a callback to call the named procedure + * back after a specified delay in milliseconds. + * + * Usage: id = postTimedCallback procedure msec [client-data] + * + * After the specified delay the user callback procedure will be called + * with client_data (if given) as the single argument. Only one call will + * be made; the client must repost the callback in each call if the procedure + * is to be repeatedly executed. + * + * An ID value is returned which may be passed to deleteTimedCallback to + * delete the timer. If a zero or negative time interval is requested no + * timer will be set and zero will be returned as the timer ID. + * + */ +static int +serverPostTimedCallback (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + char *userproc, *client_data; + unsigned long interval; + char buf[SZ_NUMBER]; + ServerCallback cb; + int nchars; + + if (argc < 3) + return (TCL_ERROR); + + /* Get arguments. */ + userproc = argv[1]; + interval = atoi (argv[2]); + client_data = (argc > 3) ? argv[3] : NULL; + + if (interval > 0) { + /* Allocate and initialize the callback structure. */ + nchars = sizeof(serverCallback) + strlen(userproc)+1 + + (client_data ? strlen(client_data)+1 : 0); + if (!(cb = (ServerCallback) XtCalloc (nchars,1))) + return (TCL_ERROR); + + cb->obj = (XtPointer) obj; + cb->userproc = (char *)cb + sizeof(serverCallback); + cb->client_data = client_data ? + cb->userproc+strlen(userproc)+1 : NULL; + cb->callback_type = CB_TIMER; + cb->next = NULL; + + strcpy (cb->userproc, userproc); + if (client_data) + strcpy (cb->client_data, client_data); + + cb->id.intervalId = XtAppAddTimeOut (obm->app_context, + interval, serverTimedProc, (XtPointer)cb); + link_callback (&obj->server, cb); + } else + cb = NULL; + + sprintf (buf, "0x%lx", cb); + Tcl_SetResult (tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* serverTimedProc -- Xt callback procedure for interval timers. + */ +static void +serverTimedProc (cb_ptr, id) +XtPointer cb_ptr; +XtIntervalId *id; +{ + register ServerCallback cb = (ServerCallback) cb_ptr; + register ServerObject obj = (ServerObject) cb->obj; + ObmContext obm = obj->server.obm; + int status; + + status = Tcl_VarEval (obm->tcl, + cb->userproc, " ", + cb->client_data ? cb->client_data : " ", + NULL); + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->userproc, + errstr ? errstr : obm->tcl->result); + } + + unlink_callback (&obj->server, cb); +/* XtFree ((char *)cb);*/ +} + + +/* serverDeleteTimedCallback -- Delete a timer callback procedure. This + * procedure is typically used to break a timer loop, where the timer + * procedure repeatedly reposts itself at the end of each interval. + * + * Usage: deleteTimedCallback id + * + * The ID string is returned by postTimedCallback when a timer is posted. + */ +static int +serverDeleteTimedCallback (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + ServerCallback cb; + XtIntervalId id; + + if (argc < 2) + return (TCL_ERROR); + + if (cb = (ServerCallback) strtol (argv[1], (char **)NULL, 16)) { + XtRemoveTimeOut (cb->id.intervalId); + unlink_callback (&obj->server, cb); + XtFree ((char *)cb); + } + return (TCL_OK); +} + + +/* serverPostWorkProc -- Post a callback for a procedure to be called when + * the server is idle. Work procedures are used to perform computations in + * the background while the user interface remains active and able to respond + * to input events. This works only if the user work procedure does its job + * in small increments, doing only a small amount of processing in each call. + * The work procedure will be called repeatedly until it returns a status + * indicating that it has finished its task. + * + * Usage: id = postWorkProc procedure [client-data] + * + * When the server has nothing else to do the user work procedure will be + * called with client_data (if given) as the single argument. The work + * procedure should return the string "done" when all processing is finished, + * or any other string if the procedure is to be called again. + * + * An ID value is returned which may be passed to deleteWorkProc to + * delete the work procedure. + */ +static int +serverPostWorkProc (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + register ObmContext obm = obj->server.obm; + char *userproc, *client_data; + char buf[SZ_NUMBER]; + ServerCallback cb; + int nchars; + + if (argc < 2) + return (TCL_ERROR); + + /* Get arguments. */ + userproc = argv[1]; + client_data = (argc > 2) ? argv[2] : NULL; + + /* Allocate and initialize the callback structure. */ + nchars = sizeof(serverCallback) + strlen(userproc)+1 + + (client_data ? strlen(client_data)+1 : 0); + if (!(cb = (ServerCallback) XtMalloc (nchars))) + return (TCL_ERROR); + + cb->obj = (XtPointer) obj; + cb->userproc = (char *)cb + sizeof(serverCallback); + cb->client_data = client_data ? cb->userproc+strlen(userproc)+1 : NULL; + cb->callback_type = CB_WORKPROC; + cb->next = NULL; + + strcpy (cb->userproc, userproc); + if (client_data) + strcpy (cb->client_data, client_data); + + cb->id.workProcId = XtAppAddWorkProc (obm->app_context, + serverWorkProc, (XtPointer)cb); + link_callback (&obj->server, cb); + + sprintf (buf, "0x%lx", cb); + Tcl_SetResult (tcl, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* serverWorkProc -- Xt callback procedure for work procedures. + */ +static Boolean +serverWorkProc (cb_ptr) +XtPointer cb_ptr; +{ + register ServerCallback cb = (ServerCallback) cb_ptr; + register ServerObject obj = (ServerObject) cb->obj; + register ObmContext obm = obj->server.obm; + Boolean done; + int status; + + status = Tcl_VarEval (obm->tcl, + cb->userproc, " ", + cb->client_data ? cb->client_data : " ", + NULL); + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->userproc, + errstr ? errstr : obm->tcl->result); + done = True; + } else + done = (strcmp (obm->tcl->result, "done") == 0) ? True : False; + + if (done) { + unlink_callback (&obj->server, cb); + XtFree ((char *)cb); + } + + return (done); +} + + +/* serverDeleteWorkProc -- Delete a work callback procedure. + * + * Usage: deleteWorkProc id + * + * The ID string is returned by postWorkProc when a work procedure is + * posted. + */ +static int +serverDeleteWorkProc (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register ServerObject obj = (ServerObject) object; + ServerCallback cb; + XtIntervalId id; + + if (argc < 2) + return (TCL_ERROR); + + cb = (ServerCallback) strtol (argv[1], (char **)NULL, 16); + XtRemoveWorkProc (cb->id.workProcId); + unlink_callback (&obj->server, cb); + XtFree ((char *)cb); + return (TCL_OK); +} + + +/* link_callback -- Link a callback descriptor into the global server + * callback list. + */ +static void +link_callback (server, cb) +register ServerPrivate server; +register ServerCallback cb; +{ + if (!server->cb_head) { + server->cb_head = cb; + server->cb_tail = cb; + } else { + server->cb_tail->next = cb; + server->cb_tail = cb; + } +} + + +/* unlink_callback -- Unlink a callback descriptor from the global server + * callback list. + */ +static void +unlink_callback (server, cb) +register ServerPrivate server; +register ServerCallback cb; +{ + register ServerCallback cp; + + if (cb == server->cb_head) { + if (!(server->cb_head = cb->next)) + server->cb_tail = NULL; + } else { + for (cp = server->cb_head; cp && cp->next != cb; cp = cp->next) + ; + if (cp) { + cp->next = cb->next; + if (cb == server->cb_tail) + server->cb_tail = cp; + } + } +} + + +/* serverCreateBitmap -- Create a named bitmap. This replaces any old bitmap + * of the same name. The new bitmap is cached in server memory; when a widget + * bitmap resource is set, the bitmap cache will be searched for the named + * bitmap before asking Xlib to find the bitmap. + * + * Usage: createBitmap name width height data + * + * e.g., + * createBitmap foo 16 16 { + * 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + * 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + * 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + */ +static int +serverCreateBitmap (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ServerObject obj = (ServerObject) object; + ObmContext obm = (ObmContext) obj->server.obm; + char *name, *pixels; + int width, height; + int status; + + if (argc < 5) + return (TCL_ERROR); + + name = argv[1]; + width = atoi (argv[2]); + height = atoi (argv[3]); + pixels = argv[4]; + + status = createBitmap (obm, name, width, height, pixels); + return (status == OK ? TCL_OK : TCL_ERROR); +} + + +/* createBitmap -- Create a bitmap of the indicated size and add it to the + * pixmap cache. + */ +createBitmap (obm, name, width, height, pixels) +ObmContext obm; +char *name; +int width, height; +char *pixels; +{ + register char *ip, *op; + register ObjList lp, last_lp; + char numbuf[32], *data, *dp; + Icon *icon; + int nchars; + + if (!obm->specified || !obm->display) + return (TCL_ERROR); + + /* Check if bitmap is already in cache. */ + for (last_lp = lp = obm->pixmap_cache; lp; lp = lp->next) { + if (strcmp (name, lp->name) == 0) + break; + last_lp = lp; + } + + /* Get an empty bitmap descriptor. */ + if (lp) { + if (lp->ptr) + freeIcon (obm, (Icon *) lp->ptr); + } else { + lp = (ObjList) XtMalloc (sizeof (struct objList)); + if (last_lp) + last_lp->next = lp; + else + obm->pixmap_cache = lp; + strcpy (lp->name, name); + lp->next = NULL; + } + + /* Get bitmap data. */ + data = (char *) XtCalloc (nchars = (width * height), 1); + for (dp=data, ip=pixels; *ip; ) { + while (isspace(*ip) || *ip == ',') + ip++; + for (op=numbuf; *ip && !(isspace(*ip) || *ip == ','); ) + *op++ = *ip++; + *op++ = '\0'; + if (--nchars >= 0) + *dp++ = strtol (numbuf, NULL, 0); + } + + /* Create the bitmap. */ + if (!(icon = (Icon *) XtCalloc (1, sizeof (*icon)))) + return (TCL_ERROR); + icon->pixmap = XCreateBitmapFromData (obm->display, + RootWindowOfScreen (obm->screen), data, width, height); + lp->ptr = (caddr_t) icon; + + XtFree ((char *)data); + return (OK); +} + + +/* findBitmap -- Search the bitmap cache for the named bitmap. Note that + * a bitmap is a pixmap of depth one, hence bitmaps are stored in the pixmap + * cache. + */ +Pixmap +findBitmap (obm, name) +ObmContext obm; +char *name; +{ + return (findPixmap (obm, name)); +} + + +/* serverCreatePixmap -- Create a named pixmap. This replaces any old pixmap + * of the same name. The new pixmap is cached in server memory; when a widget + * pixmap resource is set, the pixmap cache will be searched for the named + * pixmap before asking Xlib to find the pixmap. + * + * Usage: createPixmap name width height depth fg_color bg_color data + * + * e.g., + * createPixmap foo 16 16 8 black white { + * 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + * 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + * 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } + */ +static int +serverCreatePixmap (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ServerObject obj = (ServerObject) object; + ObmContext obm = (ObmContext) obj->server.obm; + int width, height, depth; + char *name, *pixels; + unsigned long fg, bg; + int status; + + if (argc < 8) + return (TCL_ERROR); + + name = argv[1]; + width = atoi (argv[2]); + height = atoi (argv[3]); + depth = atoi (argv[4]); + pixels = argv[7]; + + /* Get fg_color pixel value. */ + if (isdigit (*argv[5])) + fg = strtol (argv[5], NULL, 0); + else { + XrmValue from, to; + from.size = strlen (argv[5]) + 1; + from.addr = argv[5]; + to.addr = (caddr_t) &fg; + to.size = sizeof(fg); + + if (!XtConvertAndStore (obm->toplevel, + XtRString, &from, XtRPixel, &to)) + fg = BlackPixelOfScreen (obm->screen); + } + + /* Get bg_color pixel value. */ + if (isdigit (*argv[6])) + bg = strtol (argv[6], NULL, 0); + else { + XrmValue from, to; + from.size = strlen (argv[6]) + 1; + from.addr = argv[6]; + to.addr = (caddr_t) &bg; + to.size = sizeof(bg); + + if (!XtConvertAndStore (obm->toplevel, + XtRString, &from, XtRPixel, &to)) + bg = WhitePixelOfScreen (obm->screen); + } + + status = createPixmap (obm, name, width,height,8, NULL, pixels, fg,bg); + return (status == OK ? TCL_OK : TCL_ERROR); +} + + +/* createPixmap -- Create a pixmap of the indicated size and add it to the + * pixmap cache. If PIXMAP is non-null the existing pixmap is merely entered + * into the pixmap cache. Otherwise, if PIXELS is NULL an empty pixmap is + * created, otherwise PIXELS points to a character string containing the + * pixmap data in bitmap format, and BG and FG give the background and + * foreground colors. + */ +createPixmap (obm, name, width, height, depth, pixmap, pixels, bg, fg) +ObmContext obm; +char *name; +int width, height, depth; +Pixmap pixmap; +char *pixels; +unsigned long fg, bg; +{ + register char *ip, *op; + register ObjList lp, last_lp; + char numbuf[32], *data, *dp; + Icon *icon; + int nchars; + + if (!obm->specified || !obm->display) + return (TCL_ERROR); + + /* Check if pixmap is already in cache. */ + for (last_lp = lp = obm->pixmap_cache; lp; lp = lp->next) { + if (strcmp (name, lp->name) == 0) + break; + last_lp = lp; + } + + /* Get an empty pixmap descriptor. */ + if (lp) { + if (lp->ptr) + freeIcon (obm, (Icon *) lp->ptr); + } else { + lp = (ObjList) XtMalloc (sizeof (struct objList)); + if (last_lp) + last_lp->next = lp; + else + obm->pixmap_cache = lp; + strcpy (lp->name, name); + lp->next = NULL; + } + + if (!(icon = (Icon *) XtCalloc (1, sizeof (*icon)))) + return (TCL_ERROR); + + /* Get pixmap data. */ + if (pixmap) { + icon->pixmap = pixmap; + } else { + if (pixels) { + data = (char *) XtCalloc (nchars = (width * height), 1); + for (dp=data, ip=pixels; *ip; ) { + while (isspace(*ip) || *ip == ',') + ip++; + for (op=numbuf; *ip && !(isspace(*ip) || *ip == ','); ) + *op++ = *ip++; + *op++ = '\0'; + if (--nchars >= 0) + *dp++ = strtol (numbuf, NULL, 0); + } + + /* Create the pixmap. */ + icon->pixmap = XCreatePixmapFromBitmapData (obm->display, + RootWindowOfScreen(obm->screen), data, width,height, fg,bg, + depth); + + } else { + /* Create the pixmap. */ + icon->pixmap = XCreatePixmap (obm->display, + RootWindowOfScreen(obm->screen), width, height, depth); + } + } + + lp->ptr = (caddr_t) icon; + XtFree ((char *)data); + + return (OK); +} + + +/* serverCreateXPixmap -- Create a pixmap of the given name. The pixmap is + * specified in XPM format which provides much better support for color than + * the simpler format used by createPixmap. + * + * The new pixmap replaces any old pixmap of the same name. The new pixmap + * is cached in server memory; when a widget pixmap resource is set, the + * pixmap cache will be searched for the named pixmap before asking Xlib to + * find the pixmap. + * + * Usage: createXPixmap name widget description + * + * where "name" is the name of the pixmap to be created, "widget" is the + * name of a widget object to be used to search for pixel resources (to color + * the pixmap), and "description" is the XPM format description of the pixmap. + * + * For example: + * + * createXPixmap empty_diamond font1 { + * [* XPM *] + * static char * diamond0c [] = { + * [* width height ncolors cpp [x_hot y_hot] *] + * "17 17 3 1 0 0", + * [* colors *] + * " s none m none c none", + * ". s topShadowColor m white c #c8c8c8c8c8c8", + * "X s bottomShadowColor m black c #646464646464", + * [* pixels *] + * " ", + * " ", + * " ... ", + * " .. .. ", + * " .. .. ", + * " .. .. ", + * " .. .. ", + * " .. .. ", + * " . . ", + * " XX XX ", + * " XX XX ", + * " XX XX ", + * " XX XX ", + * " XX XX ", + * " XXX ", + * " ", + * " "}; + * } + * + * In the above the C style comments have been replaced by [* ... *] to avoid + * prematurely terminating the C comment you are reading. The actual text + * input to createXPixmap should use C style comments, exactly as in the XPM + * file. + * + * The pixmap is specified in XPM format as an array of strings. C style + * coments, commas, and whitespace are ignored (but are permitted, to allow + * XPM files to be directly included). The XPM format is fully defined in + * the XPM documentation, but there is not really that much to it, so we + * summarize it here. The advantage of the XPM format is that it uses a + * visual ascii representation of the pixmap, and it provides good support + * for colored pixmaps, using characters to indicate the color. The fields + * of the color description are as follows: + * + * character character used in "pixels" to signify color (arbitrary) + * s resource name used in application to override color + * m default color on monochrome screens + * g4 for 4-level grayscale screens + * g for grayscale with more than 4 levels + * c for color screens + * + * An important feature of createXPixmap is the reference widget. When the + * pixmap is created the resource list of the named reference widget will be + * searched for any resources that specify colors. If the resource name for + * a color resource matches the "s" name given for a color in the XPM pixmap + * description, then the widget-specific color will be used. This allows + * resources to be used to specify the colors for a pixmap on a per-widget + * basis. If a dummy widget-object name is given (e.g. "none") or no matching + * resources are found, the default colors will be used. Any widget object + * that has color resources may be used for the reference widget (it doesn't + * have to be the widget which will later use the pixmap). + * + * A pixmap created with createXPixmap may be used with the widget-class "set" + * command to set the value of any Pixmap or Icon class widget resource. + */ +static int +serverCreateXPixmap (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ServerObject obj = (ServerObject) object; + ObmContext obm = (ObmContext) obj->server.obm; + char *name, *widget, *description; + int status; + + if (argc < 4) + return (TCL_ERROR); + + name = argv[1]; + widget = argv[2]; + description = argv[3]; + while (isspace (*description)) + description++; + + status = createXPixmap (obm, name, widget, description); + return (status == OK ? TCL_OK : TCL_ERROR); +} + + +/* createXPixmap -- Create a pixmap defined in an XPM format description and + * add it to the pixmap cache. DESCRIPTION points to a character string + * containing the pixmap description in XPM format. A reference widget object + * may be given to associate color resources with the pixmap. + */ +createXPixmap (obm, name, widget, description) +ObmContext obm; +char *name; +char *widget; +char *description; +{ + register char *ip, *op; + register ObjList lp, last_lp; + XpmImage image; + ObmObject obj; + String *data; + Icon *icon; + int status; + Widget w; + + if (!obm->specified || !obm->display) + return (TCL_ERROR); + + /* Get reference widget if any. */ + w = NULL; + if (obj = obmFindObject (obm, widget, obm->toplevel)) + w = widgetGetPointer (obj); + + /* Create the pixmap (actually icon). + */ + status = XpmCreateXpmImageFromBuffer (description, &image, NULL, NULL); + if (status != XpmSuccess) + return (TCL_ERROR); + XpmCreateDataFromXpmImage (&data, &image, NULL); + + if (data) { + static XpmColorSymbol table[MAXCOLORSYM]; + Cardinal n; + + if (!(icon = (Icon *) XtCalloc (1, sizeof(*icon)))) + return (TCL_ERROR); + + build_colorlist (w, table, XtNumber(table), &n); + icon->attributes.colorsymbols = table; + icon->attributes.numsymbols = n; + icon->attributes.valuemask = XpmColorSymbols; + + XpmCreatePixmapFromData (obm->display, + RootWindowOfScreen(obm->screen), data, + &icon->pixmap, &icon->mask, &icon->attributes); + + XtFree ((String) data); +/* XtFree ((String) table);*/ + XpmFreeXpmImage (&image); + + } else { + XpmFreeXpmImage (&image); + return (TCL_ERROR); + } + + /* Check if pixmap is already in cache. */ + for (last_lp = lp = obm->pixmap_cache; lp; lp = lp->next) { + if (strcmp (name, lp->name) == 0) + break; + last_lp = lp; + } + + /* Get an empty pixmap descriptor. */ + if (lp) { + if (lp->ptr) + freeIcon (obm, (Icon *) lp->ptr); + } else { + lp = (ObjList) XtMalloc (sizeof (struct objList)); + if (last_lp) + last_lp->next = lp; + else + obm->pixmap_cache = lp; + strcpy (lp->name, name); + lp->next = NULL; + } + + lp->ptr = (caddr_t) icon; + return (OK); +} + + +/* build_colorlist -- Get a list of all the color resources defined by a + * widget. This looks through all the resources for resources that specify + * a color (Pixel). All such resources and their values are entered in the + * output table. + * + * To get at the resource value, the resource_offset (an unsigned int) must be + * added to the base address of the widget. The widget pointer is first + * converted to an unsigned long, tehn the offset is added to it and the result + * is converted back to a pointer, in this case a pointer to a Pixel. + * + * This code is based on build_colortable from icon.c in the FWF sources. + */ +static void +build_colorlist (w, table, size, n) +Widget w; +register XpmColorSymbol *table; +Cardinal size; +Cardinal *n; +{ + Cardinal nres, i; + XtResourceList res; + + *n = 0; + XtGetResourceList (XtClass(w), &res, &nres); + for (i=0; i < nres; i++) + if (strcmp(res[i].resource_type, XtRPixel) == 0 && *n < size) { + table[*n].name = res[i].resource_name; + table[*n].value = NULL; + table[*n].pixel = + * (Pixel*) ((unsigned long) w + res[i].resource_offset); + (*n)++; + } + if (res) + XtFree ((char *)res); /* MF037 */ +} + + +/* findPixmap -- Search the pixmap cache for the named pixmap. + */ +Pixmap +findPixmap (obm, name) +ObmContext obm; +char *name; +{ + register ObjList lp; + + for (lp = obm->pixmap_cache; lp; lp = lp->next) + if (lp->ptr && strcmp (name, lp->name) == 0) + return (((Icon *)lp->ptr)->pixmap); + + return ((Pixmap) NULL); +} + + +/* findIcon -- Search the pixmap cache for the named icon. + */ +Icon * +findIcon (obm, name) +ObmContext obm; +char *name; +{ + register ObjList lp; + + for (lp = obm->pixmap_cache; lp; lp = lp->next) + if (lp->ptr && strcmp (name, lp->name) == 0) + return ((Icon *) lp->ptr); + + return ((Icon *) NULL); +} + + +/* freeIcon -- Free an icon descriptor (pixmap list). + */ +void +freeIcon (obm, icon) +register ObmContext obm; +register Icon *icon; +{ + if (icon->pixmap) + XFreePixmap (obm->display, icon->pixmap); + if (icon->mask) + XFreePixmap (obm->display, icon->mask); + XtFree ((char *) icon); +} + + +/* serverCreateCursor -- Create a cursor from bitmap data. The cursor is + * entered into the server's cursor cache and will override any existing + * entry of the same name. + * + * Usage: createCursor name source mask fg_color bg_color x_hot y_hot + * e.g., + * createCursor foo bitmap1 bitmap2 black white 8 8 + * + * The named bitmaps must be created first with createBitmap. + */ +static int +serverCreateCursor (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ServerObject obj = (ServerObject) object; + ObmContext obm = (ObmContext) obj->server.obm; + register ObjList lp, last_lp; + XColor fg_color, bg_color; + unsigned long fg, bg; + Pixmap source, mask; + Colormap colormap; + int x_hot, y_hot; + char *name; + + if (!obm->specified || !obm->display) + return (TCL_ERROR); + + if (argc < 8) + return (TCL_ERROR); + + name = argv[1]; + source = findPixmap (obm, argv[2]); + mask = findPixmap (obm, argv[3]); + x_hot = atoi (argv[6]); + y_hot = atoi (argv[7]); + + if (!source) + return (TCL_ERROR); + + colormap = XDefaultColormapOfScreen (obm->screen); + + /* Get fg_color pixel value. */ + if (isdigit (*argv[4])) + fg = strtol (argv[4], NULL, 0); + else { + XrmValue from, to; + from.size = strlen (argv[4]) + 1; + from.addr = argv[4]; + to.addr = (caddr_t) &fg; + to.size = sizeof(fg); + + if (!XtConvertAndStore (obm->toplevel, + XtRString, &from, XtRPixel, &to)) + fg = BlackPixelOfScreen (obm->screen); + + fg_color.pixel = fg; + XQueryColor (obm->display, colormap, &fg_color); + } + + /* Get bg_color pixel value. */ + if (isdigit (*argv[5])) + bg = strtol (argv[5], NULL, 0); + else { + XrmValue from, to; + from.size = strlen (argv[5]) + 1; + from.addr = argv[5]; + to.addr = (caddr_t) &bg; + to.size = sizeof(bg); + + if (!XtConvertAndStore (obm->toplevel, + XtRString, &from, XtRPixel, &to)) + bg = WhitePixelOfScreen (obm->screen); + + bg_color.pixel = bg; + XQueryColor (obm->display, colormap, &bg_color); + } + + /* Check if cursor is already in cache. */ + for (last_lp = lp = obm->cursor_cache; lp; lp = lp->next) { + if (strcmp (name, lp->name) == 0) + break; + last_lp = lp; + } + + /* Get an empty cursor descriptor. */ + if (lp) { + if (lp->ptr) + XFreeCursor (obm->display, (Cursor)lp->ptr); + } else { + lp = (ObjList) XtMalloc (sizeof (struct objList)); + if (last_lp) + last_lp->next = lp; + else + obm->cursor_cache = lp; + strcpy (lp->name, name); + lp->next = NULL; + } + + /* Create the cursor. */ + lp->ptr = (caddr_t) XCreatePixmapCursor (obm->display, + source, mask, &fg_color, &bg_color, x_hot, y_hot); + + return (TCL_OK); +} + + +/* findCursor -- Search the cursor cache for the named cursor. + */ +Cursor +findCursor (obm, name) +ObmContext obm; +char *name; +{ + register ObjList lp; + + for (lp = obm->cursor_cache; lp; lp = lp->next) + if (lp->ptr && strcmp (name, lp->name) == 0) + return ((Cursor) lp->ptr); + + return ((Cursor) NULL); +} + + +/* serverCreateMenu, serverEditMenu -- Create or modify a menu. + * The editMenu function is an alias for createMenu. + * + * Usage: createMenu menu-name parent item-list + * + * e.g., createMenu menu-name parent { + * { label function data [options...] } + * { label function data [options...] } + * (etc.) + * } + * where + * + * menu-name is the object name for the menu popup shell + * parent is the parent widget of the menu shell + * + * label is a menu item label + * + * function is the function to be performed when the menu + * item is selected, e.g., f.exec, f.data, f.space, + * or f.line. + * + * data is function dependent data + * + * options are option-name option-value pairs, as specified + * below. + * + * In the item list the fields label and option-value may be any Tcl + * expression. Expressions are evaluated in the server context. The data + * field is a Tcl script to be executed when the menu item is selected. + * + * Options are specified as "option option-value". The menu item options + * are as follows. + * + * foreground Foreground color. + * + * background Background color. + * + * bitmap A bitmap to be displayed left justified in the + * label field (e.g. to indicate a parameter setting). + * + * justify Type of text alignment: left, center, right. + * + * sensitive Specifies whether the menu item is active (sensitive= + * true) or inactive (sensitive=false, item grayed out). + * + * accelerator Specifies an input translation (accelerator, e.g., + * keyboard event) which can be used to execute the + * menu item. + * + * The option-value field may be any Tcl expression. + * + * Example: createMenu fileMenu toplevel { + * { "File Menu" f.title } + * { Open f.exec openFile } + * { Save f.exec saveFile } + * { Load f.menu loadMenu } + * { no-label f.line } + * { Quit f.exec "send client Quit" } + * } + * + * The first createMenu is called for a given menu the menu is created, + * added to the menu list, and all window system widgets are created for + * the menu. Subsequent calls will result in only the changed parts of the + * menu being altered provided the changes are not great. Hence this routine + * can be called to efficiently modify a menu when minor runtime changes + * occur, e.g., an item label or action changes, the item value changes state, + * and so on, without need for the GUI code to know how to make the necessary + * detailed changes to the widgets used to implement the menu. + */ +static int +serverCreateMenu (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ServerObject obj = (ServerObject) object; + ObmContext obm = (ObmContext) obj->server.obm; + register MenuPtr mp, o_mp; + register MenuItem ip; + register ObjList lp, newobj; + char *menu_name, *menu_label; + char *parent, *item_list; + char **items, **fields; + int nitems, nfields; + int field, item; + ObmObject pobj; + Widget w, pw; + + if (obm->being_destroyed) + return (TCL_OK); + if (!obm->specified || !obm->display) + return (TCL_ERROR); + if (argc < 4) + return (TCL_ERROR); + + menu_name = argv[1]; + parent = argv[2]; + item_list = argv[3]; + + /* Locate the parent widget. */ + if ((pobj = (ObmObject) obmFindObject (obm, parent)) == NULL) { + fprintf (stderr, "obm: cannot find parent widget %s for menu %s\n", + parent, menu_name); + return (TCL_ERROR); + } else + pw = widgetGetPointer (pobj); + + /* Ignore request if parent is being destroyed. */ + if (pobj->core.being_destroyed) + return (TCL_OK); + + /* Get the list of menu item specifier strings. */ + if (Tcl_SplitList (tcl, item_list, &nitems, &items) != TCL_OK) { + fprintf (stderr, "obm: error parsing menu for %s\n", menu_name); + return (TCL_ERROR); + } else if (nitems > MAX_MENUITEMS) + nitems = MAX_MENUITEMS; + + /* Allocate a new, empty menu descriptor. */ + mp = (MenuPtr) XtCalloc (1, sizeof (Menu)); + + /* Process each item and add it to the menu descriptor. */ + for (item=0; item < nitems; item++) { + if (Tcl_SplitList (tcl, items[item], &nfields, &fields) != TCL_OK) { + fprintf (stderr, "obm: error parsing menu item %d of %s\n", + item + 1, menu_name); + continue; + } + + ip = &mp->items[mp->nitems++]; + + /* The first three fields label,type,data have a fairly strict + * syntax and must be in order. Try to interpret the label field + * as a string expression; if this fails, assume it is a literal + * label string. + */ + field = 0; + if (strncmp (fields[field], "f.", 2) == 0) + ip->label = NULL; + else { + char *cp = fields[field++]; + + if (Tcl_ExprString (tcl, cp) != TCL_OK) + ip->label = cp; + else { + ip->label = XtMalloc (strlen(tcl->result) + 1); + strcpy (ip->label, tcl->result); + ip->flags |= M_FreeLabel; + } + } + + /* Determine menu item type. */ + if (strcmp (fields[field], "f.exec") == 0) { + ip->type = MI_EXEC; + ip->data = fields[++field]; + } else if (strcmp (fields[field], "f.line") == 0) { + ip->type = MI_LINE; + ip->data = NULL; + } else if (strcmp (fields[field], "f.dblline") == 0) { + ip->type = MI_DBLLINE; + ip->data = NULL; + } else if (strcmp (fields[field], "f.menu") == 0) { + ip->type = MI_MENU; + ip->data = fields[++field]; + } else if (strcmp (fields[field], "f.space") == 0) { + ip->type = MI_SPACE; + ip->data = fields[++field]; + } else if (strcmp (fields[field], "f.title") == 0) { + ip->type = MI_TITLE; + ip->data = NULL; + } else { + fprintf (stderr, "obm: bad menu item type `%s'\n", + fields[field]); + ip->type = MI_IGNORE; + ip->data = NULL; + } + field++; + + /* Process any optional menu item attributes. */ + for ( ; field < nfields; field++) { + if (strcmp (fields[field], "background") == 0) { + ip->background = fields[++field]; + + } else if (strcmp (fields[field], "foreground") == 0) { + ip->foreground = fields[++field]; + + } else if (strcmp (fields[field], "bitmap") == 0) { + char *cp = fields[++field]; + + if (Tcl_ExprString (tcl, cp) != TCL_OK) + ip->pixmap = findBitmap (obm, cp); + else + ip->pixmap = findBitmap (obm, tcl->result); + + } else if (strcmp (fields[field], "justify") == 0) { + char *justify = fields[++field]; + if (strcmp (justify, "left") == 0) + ip->justify = XtJustifyLeft; + else if (strcmp (justify, "center") == 0) + ip->justify = XtJustifyCenter; + else if (strcmp (justify, "right") == 0) + ip->justify = XtJustifyRight; + + } else if (strcmp (fields[field], "sensitive") == 0) { + int ch = fields[++field][0]; + int bval; + + if (ch == 'f' || ch == 'F') + ip->flags |= M_Insensitive; + else if (ch == 't' || ch == 'T') + ip->flags &= ~M_Insensitive; + else { + if (Tcl_ExprBoolean (tcl, + fields[field], &bval) != TCL_OK) { + fprintf (stderr, + "menu %s.%d sensitive option: %s\n", + menu_name, item, tcl->result); + } else if (!bval) + ip->flags |= M_Insensitive; + } + + } else if (strncmp (fields[field], "accelerator", 5) == 0) { + ip->accelerator = fields[++field]; + + } else { + fprintf (stderr, "obm: bad menu item parameter `%s'\n", + fields[field]); + } + } + + /* Save the string buffer pointer to be freed by menuFree. */ + ip->sbuf = (char *) fields; + } + + /* Free list of menu item specification strings. */ + free ((char *) items); + + /* Search the menu list and see if there is already a menu with + * the given menu name. + */ + for (lp = obm->menu_list, o_mp=NULL; lp; lp = lp->next) + if (strcmp (lp->name, menu_name) == 0) { + o_mp = (MenuPtr) lp->ptr; + break; + } + + /* If the menu already exists try to edit it, otherwise delete any + * existing menu and create a new one from scratch. + */ + if (o_mp && editMenu (o_mp, mp) == 0) { + /* The edit succeeded. Discard the request descriptor. */ + freeMenu (mp); + + } else if (o_mp) { + /* Replace an existing menu. */ + obmDestroyObject (obm, o_mp->obj); + freeMenu (o_mp); + createMenu (obm, mp, menu_name, parent, pw); + lp->ptr = (caddr_t) mp; + + } else { + /* Create a new menu. */ + createMenu (obm, mp, menu_name, parent, pw); + + newobj = (ObjList) XtMalloc (sizeof (struct objList)); + strcpy (newobj->name, menu_name); + newobj->ptr = (caddr_t) mp; + newobj->next = NULL; + + if (obm->menu_list == NULL) + obm->menu_list = newobj; + else { + for (lp = obm->menu_list; lp->next; lp = lp->next) + ; + lp->next = newobj; + } + } + + return (TCL_OK); +} + + +/* serverDestroyMenu -- Destroy a menu. This can be used to free up the + * resources used by a menu, e.g., if the menu is not expected to be needed + * again for a while. + * + * Usage: destroyMenu menu-name + */ +static int +serverDestroyMenu (object, tcl, argc, argv) +ObmObject object; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + ServerObject obj = (ServerObject) object; + ObmContext obm = (ObmContext) obj->server.obm; + register ObjList lp, lpp; + register MenuPtr mp; + char *menu_name; + + if (argc < 2) + return (TCL_ERROR); + else + menu_name = argv[1]; + + /* Locate the menu descriptor. */ + for (lp = obm->menu_list, lpp=NULL, mp=NULL; lp; lpp=lp, lp=lp->next) + if (strcmp (lp->name, menu_name) == 0) { + mp = (MenuPtr) lp->ptr; + break; + } + if (mp == NULL) + return (TCL_OK); + + /* Unlink the menu from the menu list. */ + if (lpp == NULL) + obm->menu_list = lp->next; + else + lpp->next = lp->next; + + /* Destroy the menu object and any descendents. */ + obmDestroyObject (obm, mp->obj); + freeMenu (mp); + + return (TCL_OK); +} + + +/* createMenu -- Create a new menu from a menu descriptor. + */ +static void +createMenu (obm, mp, menu_name, parent, pw) +ObmContext obm; +register MenuPtr mp; +char *menu_name; +char *parent; +Widget pw; +{ + register MenuItem ip; + int itemno, menuno, lineno, spaceno; + Widget menu, entry; + char name[SZ_NAME]; + XrmValue from, to[2]; + Pixel value[2]; + Arg args[10]; + int nargs, i; + + menu_classInit(); + + /* The following resources are statically defined for all menus. */ + nargs = 0; + if (mp->items[0].type == MI_TITLE) { + XtSetArg (args[nargs], XtNlabel, mp->items[0].label); + nargs++; + } + + /* Create the menu shell. */ + obmNewObject (obm, menu_name, "SimpleMenu", parent, args, nargs); + mp->obj = obmFindObject (obm, menu_name); + mp->menuShell = menu = widgetGetPointer (mp->obj); + mp->obm = (XtPointer) obm; + + XtAddCallback (menu, XtNpopupCallback, menu_popup, (XtPointer)mp); + XtAddCallback (menu, XtNpopdownCallback, menu_popdown, (XtPointer)mp); + + ip = &mp->items[0]; + itemno = menuno = lineno = spaceno = 1; + + /* Create each menu item. */ + for (i=0; i < mp->nitems; i++) { + ip->menu = (XtPointer)mp; + + /* Create the menu item widget. */ + switch (ip->type) { + case MI_EXEC: + sprintf (name, "item%d", itemno++); + obmNewObject (obm, name, "SmeBSB", menu_name, NULL, 0); + entry = XtNameToWidget (menu, name); + XtAddCallback (entry, XtNcallback, menuSelect, (XtPointer)mp); + break; + + case MI_LINE: + sprintf (name, "line%d", lineno++); + obmNewObject (obm, name, "SmeLine", menu_name, NULL, 0); + entry = XtNameToWidget (menu, name); + break; + + case MI_DBLLINE: + nargs = 0; + XtSetArg (args[nargs], XtNheight, 2); + nargs++; + sprintf (name, "line%d", lineno++); + obmNewObject (obm, name, "SmeLine", menu_name, args, nargs); + sprintf (name, "line%d", lineno++); + obmNewObject (obm, name, "SmeLine", menu_name, args, nargs); + entry = XtNameToWidget (menu, name); + break; + + case MI_MENU: + sprintf (name, "menu%d", menuno++); + obmNewObject (obm, name, "SmeBSB", menu_name, NULL, 0); + entry = XtNameToWidget (menu, name); + XtAddCallback (entry, XtNcallback, menuSelect, (XtPointer)mp); + + menu_addEntry (entry, menu_name, ip->data, obm); + XtAddCallback (entry, XtNdestroyCallback, menu_delEntry, + (XtPointer)NULL); + break; + + case MI_SPACE: + nargs = 0; + XtSetArg (args[nargs], XtNheight, atoi(ip->data)); + nargs++; + sprintf (name, "line%d", lineno++); + obmNewObject (obm, name, "Sme", menu_name, args, nargs); + entry = XtNameToWidget (menu, name); + break; + + case MI_TITLE: + if (i > 0) + fprintf (stderr, + "obm: menu title must be first item in menu\n"); + ip++; + continue; + + default: + /* ignore */ + fprintf (stderr, "obm: unknown menu item type %s[%d]\n", + menu_name, i + 1); + ip++; + continue; + } + + /* Set the item specific resources. */ + nargs = 0; + if (ip->label) { + XtSetArg (args[nargs], XtNlabel, ip->label); + nargs++; + } + if (ip->background || ip->foreground) { + char *s[3]; + int i=0; + + if (ip->background) + s[i++] = ip->background; + if (ip->foreground) + s[i++] = ip->foreground; + s[i++] = NULL; + + for (i=0; s[i]; i++) { + from.size = strlen(s[i]) + 1; + from.addr = s[i]; + to[i].addr = (caddr_t) &value[i]; + to[i].size = sizeof(value[i]); + + if (XtConvertAndStore (entry, + XtRString, &from, XtRPixel, &to[i])) { + XtSetArg (args[nargs], s[i] == ip->background ? + XtNbackground : XtNforeground, value[i]); + nargs++; + } + } + } + if (ip->justify) { + XtSetArg (args[nargs], XtNjustify, ip->justify); + nargs++; + } + if (ip->pixmap) { + XtSetArg (args[nargs], XtNleftBitmap, ip->pixmap); + nargs++; + } + if (ip->type == MI_MENU) { + XtSetArg (args[nargs], XtNrightBitmap, + menu_pullrightBitmap (obm, 0)); + nargs++; + XtSetArg (args[nargs], XtNrightMargin, MB_WIDTH); + nargs++; + } + if (ip->flags & M_Insensitive) { + XtSetArg (args[nargs], XtNsensitive, False); + nargs++; + } + if (ip->accelerator) { + char buf[SZ_MESSAGE]; + sprintf (buf, "%s: notify()", ip->accelerator); + XtSetArg (args[nargs], XtNaccelerators, buf); + nargs++; + } + + if (nargs) + XtSetValues (entry, args, nargs); + ip->entry = entry; + ip++; + } +} + + +/* editMenu -- Edit a menu given descriptors for the current menu and the + * new version. Zero is returned if the edit succeeds. If the menus are + * too different editMenu will play it safe and return nonzero, and the + * caller should delete the old one and create a new menu from scratch. + */ +static int +editMenu (mp, request) +register MenuPtr mp; /* existing menu */ +MenuPtr request; /* requested values */ +{ + register MenuItem old, new; + register int i; + int ncolors=0, nargs=0; + XrmValue from, to[2]; + Pixel value[2]; + Arg args[10]; + + /* Make a quick comparision of the old and new menu descriptors to + * see if they are similar enough for the edit to make sense. + */ + if (mp->nitems != request->nitems) + return (-1); + for (i=0; i < mp->nitems; i++) { + if (mp->items[i].type != request->items[i].type) + return (-1); + } + + /* Edit each menu item. */ + for (i=0; i < mp->nitems; i++) { + old = &mp->items[i]; + new = &request->items[i]; + + nargs = 0; + if (new->label && + (!old->label || strcmp (old->label, new->label))) { + if (old->flags & M_FreeLabel) + old->label = XtRealloc (old->label, strlen(new->label)+1); + else { + old->label = XtMalloc (strlen(new->label) + 1); + old->flags |= M_FreeLabel; + } + strcpy (old->label, new->label); + XtSetArg (args[nargs], XtNlabel, old->label); + nargs++; + } + + if (new->data && (!old->data || strcmp (old->data, new->data))) { + if (old->flags & M_FreeData) + old->data = XtRealloc (old->data, strlen(new->data)+1); + else { + old->data = XtMalloc (strlen(new->data) + 1); + old->flags |= M_FreeData; + } + strcpy (old->data, new->data); + } + + if (new->background && (!old->background || + strcmp (old->background, new->background))) { + + int nchars = strlen (new->background) + 1; + char *s; + + if (old->flags & M_FreeBackground) + old->background = XtRealloc (old->background, nchars); + else { + old->background = XtMalloc (nchars); + old->flags |= M_FreeBackground; + } + strcpy (s = old->background, new->background); + + from.size = strlen(s) + 1; + from.addr = s; + to[ncolors].addr = (caddr_t) &value[ncolors]; + to[ncolors].size = sizeof(value[ncolors]); + + if (XtConvertAndStore (old->entry, + XtRString, &from, XtRPixel, &to[ncolors])) { + XtSetArg (args[nargs], XtNbackground, value[ncolors]); + nargs++; + ncolors++; + } + } + + if (new->foreground && (!old->foreground || + strcmp (old->foreground, new->foreground))) { + + int nchars = strlen (new->foreground) + 1; + char *s; + + if (old->flags & M_FreeForeground) + old->foreground = XtRealloc (old->foreground, nchars); + else { + old->foreground = XtMalloc (nchars); + old->flags |= M_FreeForeground; + } + strcpy (s = old->foreground, new->foreground); + + from.size = strlen(s) + 1; + from.addr = s; + to[ncolors].addr = (caddr_t) &value[ncolors]; + to[ncolors].size = sizeof(value[ncolors]); + + if (XtConvertAndStore (old->entry, + XtRString, &from, XtRPixel, &to[ncolors])) { + XtSetArg (args[nargs], XtNforeground, value[ncolors]); + nargs++; + ncolors++; + } + } + + if (old->justify != new->justify) { + old->justify = new->justify; + XtSetArg (args[nargs], XtNjustify, old->justify); + nargs++; + } + + if (new->accelerator && (!old->accelerator || + strcmp (old->accelerator, new->accelerator))) { + char buf[SZ_MESSAGE]; + int nchars = strlen (new->accelerator) + 1; + sprintf (buf, "%s: notify()", new->accelerator); + + if (old->flags & M_FreeAccel) + old->accelerator = XtRealloc (old->accelerator, nchars); + else { + old->accelerator = XtMalloc (nchars); + old->flags |= M_FreeAccel; + } + strcpy (old->accelerator, new->accelerator); + XtSetArg (args[nargs], XtNaccelerators, buf); + nargs++; + } + + if (old->pixmap != new->pixmap) { + old->pixmap = new->pixmap; + XtSetArg (args[nargs], XtNleftBitmap, new->pixmap); + nargs++; + } + + if ((old->flags & M_Insensitive) != (new->flags & M_Insensitive)) { + if (new->flags & M_Insensitive) { + old->flags |= M_Insensitive; + XtSetArg (args[nargs], XtNsensitive, False); + } else { + old->flags &= ~M_Insensitive; + XtSetArg (args[nargs], XtNsensitive, True); + } + nargs++; + } + + if (old->entry && nargs > 0) + XtSetValues (old->entry, args, nargs); + } + + return (0); +} + + +/* freeMenu -- Free a menu descriptor. + */ +void +freeMenu (mp) +register MenuPtr mp; +{ + register MenuItem ip; + register int i; + + for (i=0; i < mp->nitems; i++) { + ip = &mp->items[i]; + if (ip->type == MI_MENU && ip->entry) + menu_delEntry (ip->entry); + + if ((ip->flags & M_FreeBackground) && ip->background) + XtFree (ip->background); + if ((ip->flags & M_FreeForeground) && ip->foreground) + XtFree (ip->foreground); + if ((ip->flags & M_FreeAccel) && ip->accelerator) + XtFree (ip->accelerator); + if ((ip->flags & M_FreeLabel) && ip->label) + XtFree (ip->label); + if ((ip->flags & M_FreeData) && ip->data) + XtFree (ip->data); + + XtFree (ip->sbuf); + } + + XtFree ((char *)mp); +} + + +/* menuSelect -- Callback routine, called when a menu item is selected. + */ +static void +menuSelect (w, client_data, call_data) +Widget w; +XtPointer client_data; +XtPointer call_data; +{ + register MenuPtr mp = (MenuPtr) client_data; + register MenuItem ip; + register int i; + ObmContext obm = (ObmContext) mp->obm; + + /* Locate the menu item to which the callback refers. */ + for (i=0, ip=NULL; i < mp->nitems; i++) { + ip = &mp->items[i]; + if (ip->entry == w) + break; + } + + /* Ignore callbacks other than for command type menu entries (MI_EXEC). + * In the case of a command entry the data field of the menu item + * descriptor contains the server command to be executed. + */ + + if (ip && ip->type == MI_EXEC) + if (Tcl_Eval (obm->tcl, ip->data) != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error %s.%s line %d: %s\n", + mp->obj->core.name, XtName(ip->entry), obm->tcl->errorLine, + errstr ? errstr : obm->tcl->result); + } +} + + +/* + * The following code is used to interpose special highlight() and + * unhighlight() SmeBSB class procedures, to allow menu entries which point to + * submenus to automatically popup and popdown the submenu when the menu entry + * which points to it is highlighted or unhighlighted. It is a bit of a trick + * to replace the standard class procedure as we do here, but this is a lot + * simpler than subclassing the entire SmeBSB widget, and works for both the + * standard Athena and Xaw3D versions of the widget. Tying the submenu + * popup/popdown to the simpleMenu highlight/unhighlight actions allows us + * to let the simpleMenu widget track the pointer and determine when the + * submenu should be displayed. + * + * [Note added later]. Having now implemented this technique for cascaded + * menus I am not sure it was the best way to do this - it might have been + * better to just use motion events. There were a number of subtle problems + * to be solved to get this to work. It is true though, that most of these + * don't have much to do with the interpose-highlight technique, so maybe + * I would have run into the problems anyway. The problems were things like + * state changes when the pointer crosses from a menu pane into a submenu, + * the need to explicitly popdown submenus when the main window is popped + * down or when a nonmenu item in the main menu is entered, getting the + * grabs right, an annoying warning message about trying to remove a grab + * which no longer existed, and so on. Getting the pull-right bitmap to + * look right took a lot of fiddling and it appeared that there might be a + * positioning bug in the Xaw3d code related to this. The one problem that + * was clearly specific to the highlight/unhighlight technique was that + * SmeBSB uses a toggle type function for highlight/unhighlight. This + * assumes that the toggle is always in a known state. This works for a + * single menu, but it appears that there is a bug in the SmeBSB code when + * a pull-right menu obscures the parent menu, causing the toggle to get + * out of phase when moving into the submenu band back out (out of phase + * means that when one calls the unhighlight class procedure, the toggle + * actually highlights, and vice versa). I had to disable highlighting of + * submenu items in a menu to avoid this problem. + */ + +/* The following describes a menu entry widget which calls a submenu. */ +struct _menuEntry { + Widget w; /* this widget */ + char name[SZ_NAME]; /* name of menu containing widget */ + char child[SZ_NAME]; /* submenu name */ + Widget menu; /* shell widget of submenu */ + ObmContext obm; /* obm context */ + struct _menuEntry *next; /* next menuEntry on list */ +}; +typedef struct _menuEntry menuEntry, *MenuEntry; + +MenuEntry menuWidgetList; +static char menu_bitmap1[] = "BSB_pullright1"; +static char menu_bitmap2[] = "BSB_pullright2"; +static void (*BSB_highlight)(); +static void (*BSB_unhighlight)(); + + +/* menu_classInit -- Edit the SME class record to interpose our custom + * highlight/unhighlight class procedures. + */ +static void +menu_classInit() +{ + register SmeClassPart *sme = &smeBSBClassRec.sme_class; + + if (sme->highlight != menu_highlight) { + BSB_highlight = sme->highlight; + sme->highlight = menu_highlight; + } + if (sme->unhighlight != menu_unhighlight) { + BSB_unhighlight = sme->unhighlight; + sme->unhighlight = menu_unhighlight; + } +} + + +/* menu_pullrightBitmap -- Return the bitmap id of the pullright bitmap + * displayed on the right side of a menu entry that brings up a submenu. + */ +static Pixmap +menu_pullrightBitmap (obm, state) +ObmContext obm; +int state; +{ + Pixmap bitmap; + + if (bitmap = findBitmap (obm, state ? menu_bitmap2 : menu_bitmap1)) + return (bitmap); + + createBitmap (obm, menu_bitmap1, MB_WIDTH, MB_HEIGHT, MB1_PIXELS); + createBitmap (obm, menu_bitmap2, MB_WIDTH, MB_HEIGHT, MB2_PIXELS); + + if (bitmap = findBitmap (obm, state ? menu_bitmap2 : menu_bitmap1)) + return (bitmap); + else + return ((Pixmap)NULL); +} + + +/* menu_addEntry -- Add a widget to the menuWidgetList list. + */ +static void +menu_addEntry (w, name, child, obm) +Widget w; /* menu entry which calls submenu */ +char *name; /* name of menu containing this widget */ +char *child; /* name of submenu shell widget */ +ObmContext obm; +{ + register MenuEntry mw, new; + + for (mw=menuWidgetList; mw && mw->next; mw = mw->next) + if (mw->w == w) + return; + + if ((new = (MenuEntry) XtCalloc (1, sizeof (menuEntry))) == NULL) + return; + + new->w = w; + strcpy (new->name, name); + strcpy (new->child, child); + new->obm = obm; + + if (mw) + mw->next = new; + else + menuWidgetList = new; +} + + +/* menu_delEntry -- Delete a widget from the menuWidgetList list. + */ +static void +menu_delEntry (w, client_data, call_data) +register Widget w; +XtPointer client_data; /* not used */ +XtPointer call_data; /* not used */ +{ + register MenuEntry mw, prev_mw; + + for (mw=menuWidgetList, prev_mw=NULL; mw; prev_mw=mw, mw=mw->next) + if (mw->w == w) + break; + + if (mw) { + if (prev_mw) + prev_mw->next = mw->next; + else + menuWidgetList = NULL; + XtFree ((char *)mw); + } +} + + +/* menu_popup -- Called when a menu is popped up. + */ +static void +menu_popup (w, client_data, call_data) +Widget w; +XtPointer client_data; +XtPointer call_data; /* not used */ +{ + register MenuPtr mp = (MenuPtr) client_data; + mp->popped_up = True; +} + + +/* menu_popdown -- Called when a menu is popped down. Make sure any + * child menus are popped down before popping down the parent. + */ +static void +menu_popdown (w, client_data, call_data) +Widget w; +XtPointer client_data; +XtPointer call_data; /* not used */ +{ + register MenuPtr mp = (MenuPtr) client_data; + ObmContext obm = (ObmContext) mp->obm; + register MenuEntry mw; + register MenuPtr mm; + MenuItem mi; + int i; + + /* This routine is called with w=NULL to popdown any child menus. + * If w is not NULL that means we are being called as a + * popdownCallback for the menu shell. + */ + if (w) + mp->popped_up = False; + + for (i=0; i < mp->nitems; i++) { + mi = &mp->items[i]; + if (mi->type == MI_MENU) { + /* Locate menu descriptor for named menu. */ + mm = findMenu (obm, mi->data); + + /* Popdown the child menu (if necessary). The temporary dummy + * warning message handler appears to be the only way to avoid + * a warning messages about an attempt to remove a grab for a + * widget on the grab list. What happens is that when + * XtPopdown is called on the main menu this calls + * XtRemoveGrab on the window, which removes any grabs for the + * main window _and any later grabs_, i.e., for the submenus. + * XtPopdown then calls the menu_popdown popdown callback, + * which is necessary to popdown any child menus as XtPopdown + * does not do this. The XtPopdown called in this routine + * tries to remove a grab which has already been removed, + * causing the warning message. The situation itself appears + * to be harmless, so the best thing to do is just disable the + * warning message. + */ + if (mm && mm->menuShell) { + XtErrorMsgHandler old_handler; + + old_handler = XtAppSetWarningMsgHandler (obm->app_context, + (XtErrorMsgHandler) menu_popdown_msgHandler); + XtPopdown (mm->menuShell); + XtAppSetWarningMsgHandler (obm->app_context, old_handler); + } + } + } +} + + +/* menu_popdown_msgHandler -- Dummy warning message handler used in menu + * popdown above. + */ +static void +menu_popdown_msgHandler (name,type,class,defaultp,params,num_params) +String name,type,class,defaultp; +String* params; +Cardinal* num_params; +{ +} + + +/* menu_highlight -- Custom version of the simpleMenu class action highlight + * procedure, called when a menu entry is highlighted. This is identical to + * the standard class procedure (in fact we call the standard class highlight + * procedure) except that we check to see if the widget being highlighted + * is a submenu, and if so, popup the submenu. + */ +static void +menu_highlight (w) +register Widget w; +{ + register MenuEntry mw, sm; + ObmContext obm = global_obm_handle; + MenuPtr mp; + + /* If we are highlighting an entry in a menu then any pull-right + * submenus which are still up should not be, so get rid of them. + */ + if (mp = findMenu (obm, XtName(w->core.parent))) + menu_popdown ((Widget)NULL, (XtPointer)mp, (XtPointer)NULL); + + /* Is the menu entry being highlighted on our list of call-submenu + * widgets? + */ + for (mw=menuWidgetList; mw; mw = mw->next) + if (mw->w == w) + break; + + /* If the menu item is for a submenu, popup the submenu. */ + if (mw) { + Position x, y; + Position menu_x, menu_y; + Dimension parent_width; + Dimension menu_width, menu_height; + char target[SZ_NAME]; + ObmContext obm = mw->obm; + Widget menu; + + /* If the parent menu is not popped up, do not pop up the + * child. This doesn't sound likely but it can happen when + * menu_highlight is called after a button-up event which + * pops down the main menu. + */ + if (mp && mp->popped_up == False) + return; + + /* Get shell widget of submenu. */ + if (!(mp && (mw->menu = XtNameToWidget (mp->menuShell, target)))) { + sprintf (target, "*%s", mw->child); + if (!(mw->menu = XtNameToWidget (obm->toplevel, target))) + return; + } + + menu = mw->menu; + XtTranslateCoords (w, 0, 0, &x, &y); + XtVaGetValues (w, XtNwidth, &parent_width, NULL); + + menu_width = menu->core.width + 2 * menu->core.border_width; + menu_height = menu->core.height + 2 * menu->core.border_width; + menu_x = x + parent_width - 5; + menu_y = y - 5; + + if (menu_x >= 0) { + int scr_width = WidthOfScreen(XtScreen(menu)); + if ((int)(menu_x + menu_width) > (int)scr_width) + menu_x = scr_width - menu_width; + } + if (menu_x < 0) + menu_x = 0; + + if (menu_y >= 0) { + int scr_height = HeightOfScreen(XtScreen(menu)); + if ((int)(menu_y + menu_height) > (int)scr_height) + menu_y = scr_height - menu_height; + } + if (menu_y < 0) + menu_y = 0; + + XtVaSetValues (menu, + XtNx, menu_x, + XtNy, menu_y, + NULL); + /* + * This appears to bring out a bug in the Xaw|Xaw3d SmeBSB. + * + XtVaSetValues (w, + XtNrightBitmap, menu_pullrightBitmap (obm, 1), + NULL); + */ + + /* Popup the pull-right menu. */ + XtPopup (menu, XtGrabNonexclusive); + + } else { + /* Call the standard simplemenu highlight method. */ + BSB_highlight (w); + } +} + + +/* menu_unhighlight -- Custom unhighlight class procedure, interposed in + * front of the standard class procedure. + */ +static void +menu_unhighlight (w) +register Widget w; +{ + register MenuEntry mw; + + /* Is the menu entry being unhighlighted on our list of call-submenu + * widgets? + */ + for (mw=menuWidgetList; mw; mw = mw->next) + if (mw->w == w) + break; + + if (mw == NULL) { + /* Now call the standard class unhighlight procedure. */ + BSB_unhighlight (w); + + } else if (mw->menu) { + /* Popdown the submenu. + */ + ObmContext obm = mw->obm; + Dimension width, height; + int in_window, i; + XMotionEvent *ev; + XEvent event; + Position x, y; + Widget wl[2]; + + /* Get the next window event. All we are looking for here is + * the pointer coordinates. + */ + ev = (XMotionEvent *) &event; + while (!XtAppPeekEvent (obm->app_context, &event)) + ; + + wl[0] = w; + wl[1] = mw->menu; + in_window = 0; + + /* Check if the pointer is in either the pull-right pane of + * the parent menu, or the pull-right menu itself. + */ + for (i=0; i < 2; i++) { + XtTranslateCoords (wl[i], 0, 0, &x, &y); + XtVaGetValues (wl[i], + XtNwidth, &width, + XtNheight, &height, + NULL); + + if (ev->x_root >= x && ev->x_root < x + (Position)width && + ev->y_root >= y && ev->y_root < y + (Position)height) { + in_window++; + break; + } + } + + /* If it is not in either window then go ahead and popdown the + * child menu, otherwise ignore the request. Erroneous requests + * can occur when the pointer is in crossing from one window + * to the other. + */ + if (!in_window) { + /* + * This appears to bring out a bug in the Xaw3d SmeBSB. + XtVaSetValues (w, + XtNrightBitmap, menu_pullrightBitmap (obm, 0), + NULL); + */ + + XtPopdown (mw->menu); + } + } +} + + +/* findMenu -- Return the menu descriptor of a menu given its name. + */ +static MenuPtr +findMenu (obm, name) +register ObmContext obm; +char *name; +{ + register ObjList lp; + + for (lp = obm->menu_list; lp; lp = lp->next) + if (strcmp (lp->name, name) == 0) + return ((MenuPtr) lp->ptr); + + return (NULL); +} diff --git a/vendor/x11iraf/obm/widget.c b/vendor/x11iraf/obm/widget.c new file mode 100644 index 00000000..e33723ff --- /dev/null +++ b/vendor/x11iraf/obm/widget.c @@ -0,0 +1,5017 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +#include <ObmP.h> +#include "widget.h" + +/* + * WIDGET class. + * -------------------------- + * The Widget class is the generic or base class for the window system + * toolkit widgets supported by the object manager. The Widget class + * supports a number of different Xt widget classes using a table driven + * approach to describe each widget. Any widget may be created, destroyed, + * and manipulated in various ways using only the generic Widget class + * procedures and Widget-specific resources. The Widget class may be + * subclassed to support complex Widgets that require custom class-specific + * commands for use by the GUI code. + * + * Generic Widget-class commands: + * + * set resource-name value + * get resource-name + * + * addCallback procedure-name [callback-name] + * deleteCallback procedure-name + * setSensitive sensitive + * isSensitive + * + * realize + * unrealize + * isRealized + * map + * unmap + * manage child [child ...] + * unmanage child [child ...] + * popup [grab-kind] + * popdown + * popupSpringLoaded + * + * move x y + * resize width height border-width + * configure x y width height border-width + * parseGeometry user_geom def_geom x y width height + * geom = getGeometry x y width height [nogravity] + * + * setTTName name # for call($name...) + * name = getTTName + * + * The most important Widget commands are set/get resource, and the + * callbacks. The widget sensitivity can be set and queried using set/get + * resource, but special procedures are provided to make this common operation + * more convenient. + * + * Class specific functions: + * + * append text # text widget + * value = getValue # dialog widget + * + * setList list [resize] # list widget + * value = getItem itemno + * highlight itemno + * unhighlight [itemno] + * + * getThumb x [y [width height]] # sliders + * moveThumb x [y] + * resizeThumb width [height] + * + * setScrollbar position size # scrollbars + * + * setLocation x y # viewport + * setCoordinates x y + * + * setTop widget # tabs + * + * setListTree list # list tree + * listTreeSelect item [top [child_only] ] + * listTreeHighlight item [top [child_only] ] + * listTreeDelete item [top] + * + * setTable nrows ncols data # table + * attr = getCellAttr row col attr + * setCellAttr row col attr value + * attr = getColAttr col attr + * setColAttr col attr value + * attr = getRowAttr row attr + * setRowAttr row attr value + * deleteCol col + * deleteRow row + * addCol col width [where] + * addRow row [where] + * setTableSize nrows ncols + * getTableSize nrows ncols + * + * + * Ideally the widget class should be subclassed for widgets that require + * class-specific functions, but in simple cases involving standard widgets + * the support is built into the widget class code as a special case. + * + * Special actions (used in translations): + * + * call (proc [,arg, ...]) + * popup (menu-name [xoffset [yoffset]]) + * popdown (menu-name) + * + * The "call" action is a very general mechanism which allows any GUI procedure + * to be registered with any translation using the X translation table + * mechanism. The popup and popdown actions are used for popup menus. The + * menu will be popped up at the event coordinates plus the optional offsets + * if given. + * + * Event handling: + * + * addEventHandler <procname> <event-mask> [<event-mask>...] + * + * Event callback: + * + * userEventHandler widget event-type time wx wy rx ry other + * + * In most cases translations are preferable to events, but a GUI can capture + * raw events if it wishes by adding event handlers. Nearly all of the X + * event types are supported. The callback syntax employs a number of + * standard arguments, followed by a number of event-specific arguments. + */ + +typedef struct rtype *Rtype; +#define LEN_RHASH 197 +Rtype rhash[LEN_RHASH]; + +#define MAX_TREE_LEVELS 10 + +/* Global widget resources table. */ +struct rtype { + char *name; /* resource name */ + char *type; /* resource type */ + unsigned long flag1, flag2; /* widgets using resource */ + struct rtype *next; /* next entry on hash thread */ +} ObmResources[] = { +#include "obmres.dat" +}; + +struct callbackType { + int type; + char *name; +}; + +/* Widget callback types. */ +struct callbackType callbackTypes[] = { + { Ctcallback, "callback" }, + { Ctcharmode, "charmode" }, + { Ctlinemode, "linemode" }, + { CtgetValue, "getValue" }, + { CtjumpProc, "jump" }, + { CtscrollProc, "scroll" }, + { CtpopupCallback, "popup" }, + { CtpopdownCallback, "popdown" }, + { CtreportCallback, "report" }, + { CtstartCallback, "start" }, + { CtstopCallback, "stop" }, +}; + + + +enum scaleType { /* MF016 */ + atom, pixel_size, point_size, /* /|\ */ + resolution, resolution_x, resolution_y, average_width, /* / | \ */ + scaledX, scaledY, unscaled, scaledXoverY, uncomputed, /* | */ +}; /* | */ + /* | */ +typedef struct _fontProp { /* | */ + char *name; /* | */ + Atom atom; /* | */ + enum scaleType type; /* | */ + char found; /* | */ +} fontProp; /* | */ + /* | */ +static fontProp fontNamePropTable[] = { /* | */ + { "FOUNDRY", 0, atom, 0}, /* | */ + { "FAMILY_NAME", 0, atom, 0}, /* | */ + { "WEIGHT_NAME", 0, atom, 0}, /* | */ + { "SLANT", 0, atom, 0}, /* | */ + { "SETWIDTH_NAME", 0, atom, 0}, /* | */ + { "ADD_STYLE_NAME", 0, atom, 0}, /* | */ + { "PIXEL_SIZE", 0, pixel_size, 0}, /* | */ + { "POINT_SIZE", 0, point_size, 0}, /* | */ + { "RESOLUTION_X", 0, resolution_x, 0}, /* | */ + { "RESOLUTION_Y", 0, resolution_y, 0}, /* | */ + { "SPACING", 0, atom, 0}, /* | */ + { "AVERAGE_WIDTH", 0, average_width, 0}, /* | */ + { "CHARSET_REGISTRY", 0, atom, 0}, /* | */ + { "CHARSET_ENCODING", 0, atom, 0}, /* | */ +}; /* | */ + /* | */ +#define NUMITEMS(arr) ((int) (sizeof(arr) / sizeof(arr[0]))) /* \ | / */ + /* \|/ */ +static char *widgetGetFontName(); /* MF016 */ + + +static void do_text(); +static void do_userproc(); +static void do_popup(); +static void do_popdown(); +static XtActionsRec widget_actions[] = { + {"call", do_userproc}, + {"do_text", do_text}, + {"popup", do_popup}, + {"popdown", do_popdown}, +}; + +static void call_callbacks(); +static void widgetEvent(), widgetSetDestroy(), widgetDestroy(); +static void widgetCallback(), widgetSCCallback(), widgetJPCallback(); +static void widgetSPCallback(), widgetPUCallback(), widgetPDCallback(); +static void widgetSBCallback(), widgetSECallback(), widgetRPCallback(); +static void widgetRGCallback(), widgetLTHCallback(), widgetLTACallback(); +static void widgetTCCCallback(); +static int widgetSet(), widgetGet(), widgetMap(), widgetUnmap(); +static int widgetRealize(), widgetUnrealize(), widgetIsRealized(); +static int widgetPopup(), widgetPopupSpringLoaded(), widgetPopdown(); +static int widgetAddCallback(), widgetDeleteCallback(); +static int widgetMove(), widgetResize(), widgetConfigure(); +static int widgetParseGeometry(), widgetGetGeometry(); +static int widgetSetSensitive(), widgetIsSensitive(); +static int widgetManage(), widgetUnmanage(), widgetAppend(); +static int widgetAddEventHandler(), widgetRemoveEventHandler(); +static int widgetHighlight(), widgetUnhighlight(), widgetSetTop(); +static int widgetSetList(), widgetGetItem(), widgetGetValue(); +static int widgetGetThumb(), widgetMoveThumb(), widgetResizeThumb(); +static int widgetSetScrollbar(), widgetSetTTName(), widgetGetTTName(); +static int widgetSetListTree(), widgetListTreeSelect(); +static int widgetListTreeHighlight(), widgetListTreeDelete(); +static int widgetSetLocation(), widgetSetCoordinates(); +static int widgetSetTable(), widgetSetCellAttr(), widgetGetCellAttr(); +static int widgetGetColAttr(), widgetSetColAttr(), widgetSetRowAttr(); +static int widgetDeleteRow(), widgetAddRow(), widgetGetTableSize(); +static int widgetDeleteCol(), widgetAddCol(), widgetSetTableSize(); +static int get_itemno(), buildTreeList(), widgetGetRowAttr(); + + +/* WidgetClassInit -- Initialize the class record for the widget class. + */ +void +WidgetClassInit (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register int hashval, n; + register char *ip; + ObjClassRec widgetclass; + static int hashed = 0; + Tcl_Interp *tcl; + MsgContext msg; + Rtype rp, hp; + int i; + + /* The base class for all Widget classes is "Widget". */ + widgetclass = obmGetClassrec ("Widget"); + + /* Install the class methods. */ + classrec->ClassDestroy = WidgetClassDestroy; + classrec->Create = (ObmFunc) WidgetCreate; + classrec->Destroy = WidgetDestroy; + classrec->Evaluate = WidgetEvaluate; + + /* Since there can be many instances of the widget object and they + * all respond to the same class messages, a single interpreter is + * used for all widget instances. By default all Widget subclasses + * use the interperter for the base Widget class. + */ + if (!widgetclass->class_data) { + msg = (MsgContext) XtMalloc (sizeof (struct msgContext)); + msg->tcl = tcl = Tcl_CreateInterp(); + widgetclass->class_data = (XtPointer) msg; + msg->level = 0; + + /* Register widget-object actions. */ + Tcl_CreateCommand (tcl, + "addCallback", widgetAddCallback, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "deleteCallback", widgetDeleteCallback, (ClientData)msg, + NULL); + Tcl_CreateCommand (tcl, + "addEventHandler", widgetAddEventHandler, (ClientData)msg, + NULL); + Tcl_CreateCommand (tcl, + "removeEventHandler", widgetRemoveEventHandler, + (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "set", widgetSet, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "get", widgetGet, (ClientData)msg, NULL); + + /* Text Widget Callbacks */ + Tcl_CreateCommand (tcl, + "append", widgetAppend, (ClientData)msg, NULL); + + /* List Widget Callbacks */ + Tcl_CreateCommand (tcl, + "setList", widgetSetList, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getItem", widgetGetItem, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "highlight", widgetHighlight, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "unhighlight", widgetUnhighlight, (ClientData)msg, NULL); + + /* Dialog Widget Callbacks */ + Tcl_CreateCommand (tcl, + "getValue", widgetGetValue, (ClientData)msg, NULL); + + /* Slider Widget Callbacks */ + Tcl_CreateCommand (tcl, + "getThumb", widgetGetThumb, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "moveThumb", widgetMoveThumb, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "resizeThumb", widgetResizeThumb, (ClientData)msg, NULL); + + /* Scrollbar Widget Callbacks */ + Tcl_CreateCommand (tcl, + "setScrollbar", widgetSetScrollbar, (ClientData)msg, NULL); + + /* Viewport Widget Callbacks */ + Tcl_CreateCommand (tcl, + "setLocation", widgetSetLocation, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setCoordinates", widgetSetCoordinates, (ClientData)msg, NULL); + + /* Tabs Widget Callbacks */ + Tcl_CreateCommand (tcl, + "setTop", widgetSetTop, (ClientData)msg, NULL); + + /* Tree Widget Callbacks */ + Tcl_CreateCommand (tcl, + "setListTree", widgetSetListTree, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "listTreeSelect", widgetListTreeSelect, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "listTreeDelete", widgetListTreeDelete, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "listTreeHighlight", widgetListTreeHighlight, + (ClientData)msg, NULL); + + /* Table Widget Callbacks */ + Tcl_CreateCommand (tcl, + "setTable", widgetSetTable, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getCellAttr", widgetGetCellAttr, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setCellAttr", widgetSetCellAttr, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setColAttr", widgetSetColAttr, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getColAttr", widgetGetColAttr, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setRowAttr", widgetSetRowAttr, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getRowAttr", widgetGetRowAttr, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "deleteCol", widgetDeleteCol, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "deleteRow", widgetDeleteRow, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "addCol", widgetAddCol, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "addRow", widgetAddRow, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setTableSize", widgetSetTableSize, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getTableSize", widgetGetTableSize, (ClientData)msg, NULL); + + Tcl_CreateCommand (tcl, + "realize", widgetRealize, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "unrealize", widgetUnrealize, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "isRealized", widgetIsRealized, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "map", widgetMap, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "unmap", widgetUnmap, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "manage", widgetManage, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "unmanage", widgetUnmanage, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "popup", widgetPopup, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "popupSpringLoaded", widgetPopupSpringLoaded, + (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "popdown", widgetPopdown, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setSensitive", widgetSetSensitive, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "isSensitive", widgetIsSensitive, (ClientData)msg, NULL); + + Tcl_CreateCommand (tcl, + "move", widgetMove, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "resize", widgetResize, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "configure", widgetConfigure, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "parseGeometry", widgetParseGeometry, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getGeometry", widgetGetGeometry, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "setTTName", widgetSetTTName, (ClientData)msg, NULL); + Tcl_CreateCommand (tcl, + "getTTName", widgetGetTTName, (ClientData)msg, NULL); + + /* Register any actions. */ + XtAppAddActions (obm->app_context, widget_actions, + XtNumber(widget_actions)); + XtRegisterGrabAction (do_popup, True, + (unsigned)(ButtonPressMask | ButtonReleaseMask), + GrabModeAsync, GrabModeAsync); + } + + /* Build a hash index for the global widget resources table. */ + if (!hashed) { + for (i=0; i < XtNumber(ObmResources); i++) { + rp = &ObmResources[i]; + n = MAX_HASHCHARS; + for (hashval=0, ip=rp->name; --n >= 0 && *ip; ip++) + hashval += (hashval + *ip); + if (hp = rhash[hashval%LEN_RHASH]) { + for ( ; hp->next; hp = hp->next) + ; + hp->next = rp; + } else + rhash[hashval%LEN_RHASH] = rp; + } + hashed++; + } +} + + +/* WidgetClassDestroy -- Custom destroy procedure for the widget class. + */ +void +WidgetClassDestroy (obm, classrec) +ObmContext obm; +register ObjClassRec classrec; +{ + register MsgContext msg = (MsgContext) classrec->class_data; + + if (msg) { + if (msg->tcl) + Tcl_DeleteInterp (msg->tcl); + XtFree ((char *)msg); + classrec->class_data = NULL; + } +} + + +/* WidgetCreate -- Create an instance of a widget object. + */ +ObmObject +WidgetCreate (obm, name, classrec, parent, args, nargs) +ObmContext obm; +char *name; +ObjClassRec classrec; +char *parent; +ArgList args; +int nargs; +{ + register WidgetObject obj, pobj; + Widget w, pw; + + /* Create the widget object descriptor. */ + obj = (WidgetObject) XtCalloc (1, sizeof (struct widgetObject)); + obj->widget.obm = obm; + + /* The widget "toplevel" is a special case. This is the toplevel + * widget of the entire application and it is created separately + * when the application starts up. When we are called to "create" + * this widget all we do is create a descriptor for it, so that it + * will appear in the object list like any other widget. + */ + if (strcmp (name, "toplevel") == 0) { + w = obm->toplevel; + pw = NULL; + } else { + /* Convert parent name to Widget. */ + if ((pobj = (WidgetObject) obmFindObject (obm, parent)) == NULL) + return (NULL); + pw = pobj->widget.w; + + /* Create the widget. */ + if (classrec->object_type == OtShell) { + w = XtCreatePopupShell (name, + *classrec->widget_class, pw, args, nargs); + } else if (obmClass (classrec, WtObject)) { + w = XtCreateWidget (name, + *classrec->widget_class, pw, args, nargs); + } else { + w = XtCreateManagedWidget (name, + *classrec->widget_class, pw, args, nargs); + } + } + + /* Set the pointer to the superclass if subclass of Widget. */ + if (strcmp (classrec->name, "Widget") != 0) + obj->core.superclass = obmGetClassrec ("Widget"); + + /* Register any class callback procedures. */ + if (obmClass (classrec, WtGrip) || + obmClass (classrec, WtList) || + obmClass (classrec, WtMultiList) || + obmClass (classrec, WtSmeBSB) || + obmClass (classrec, WtCommand) || + obmClass (classrec, WtMenuButton) || + obmClass (classrec, WtTabs) || + obmClass (classrec, WtToggle) || + obmClass (classrec, WtArrow)) { + + XtAddCallback (w, XtNcallback, widgetCallback, obj); + + } else if (obmClass (classrec, WtListTree)) { + XtAddCallback (w, XtNhighlightCallback, widgetLTHCallback, obj); + XtAddCallback (w, XtNactivateCallback, widgetLTACallback, obj); + + } else if (obmClass (classrec, WtRepeater)) { + XtAddCallback (w, XtNcallback, widgetCallback, obj); + XtAddCallback (w, XtNstartCallback, widgetSBCallback, obj); + XtAddCallback (w, XtNstopCallback, widgetSECallback, obj); + + } else if (obmClass (classrec, WtStripChart)) { + XtAddCallback (w, XtNgetValue, widgetSCCallback, obj); + + } else if (obmClass (classrec, WtScrollbar)) { + XtAddCallback (w, XtNjumpProc, widgetJPCallback, obj); + XtAddCallback (w, XtNscrollProc, widgetSPCallback, obj); + + } else if (obmClass (classrec, WtShell) || + obmClass (classrec, WtSimpleMenu)) { + + XtAddCallback (w, XtNpopupCallback, widgetPUCallback, obj); + XtAddCallback (w, XtNpopdownCallback, widgetPDCallback, obj); + + } else if (obmClass (classrec, WtPanner) || + obmClass (classrec, WtPorthole) || + obmClass (classrec, WtViewport)) { + + XtAddCallback (w, XtNreportCallback, widgetRPCallback, obj); + + } else if (obmClass (classrec, WtTextButton) || + obmClass (classrec, WtIcon)) { + XtAddCallback (w, XtNactivate, widgetCallback, obj); + + } else if (obmClass (classrec, WtGroup) || + obmClass (classrec, WtRadioGroup)) { + XtAddCallback (w, XtNactivate, widgetRGCallback, obj); + + } else if (obmClass (classrec, WtTextToggle)) { + XtAddCallback (w, XtNonCallback, widgetCallback, obj); + XtAddCallback (w, XtNoffCallback, widgetCallback, obj); + + } else if (obmClass (classrec, WtSlider2d) || + obmClass (classrec, WtScrollbar2)) { + + XtVaGetValues (w, "scrollResponse", &obj->widget.response_cb, NULL); + XtAddCallback (w, XtNscrollCallback, widgetJPCallback, obj); + XtAddCallback (w, XtNscrollCallback, widgetSPCallback, obj); + } + + obj->widget.w = w; + strcpy (obj->widget.translation_table_name, name); + return ((ObmObject) obj); +} + + +/* WidgetDestroy -- Destroy an instance of a widget object. + */ +void +WidgetDestroy (object) +ObmObject object; +{ + register WidgetObject obj = (WidgetObject) object; + register WidgetPrivate wp = &obj->widget; + register ObmCallback cb, next; + + /* Ignore the second call to Destroy. */ + if (obj->core.being_destroyed++) + return; + + /* Free any callback descriptors. */ + for (cb = wp->callback; cb; cb = next) { + next = cb->next; + XtFree ((char *)cb); + } + + /* Free any event handler descriptors. */ + for (cb = wp->event_handler; cb; cb = next) { + next = cb->next; + XtFree ((char *)cb); + } + + /* Free any object data. Note that free is used, not XtFree, i.e. + * we can't assume that Xt allocated the buffer. + */ + if (wp->data) + free (wp->data); + + /* Mark any widget children as being destroyed so that we don't try + * to destroy them twice. + */ + if (!wp->widget_destroyed) { + widgetSetDestroy (object); + widgetDestroy (obj); + } +} + + +/* widgetSetDestroy -- Set the being_destroyed flag on all the children of a + * widget object to indicate that the widget itself has already been destroyed. + * This happens when a widget tree is destroyed in one toolkit call by + * destroying the top level widget, leaving the object descriptors intact + * while the widgets have already been destroyed. + */ +static void +widgetSetDestroy (obj) +register ObmObject obj; +{ + register int i; + ObmObject child; + int object_type; + + for (i=0; i < obj->core.nchildren; i++) { + child = obj->core.children[i]; + object_type = child->core.classrec->object_type; + if (object_type == OtShell || object_type == OtNonShell) + widgetSetDestroy (child); + } + + ((WidgetObject)obj)->widget.widget_destroyed = True; +} + + +/* widgetDestroy -- Destroy a widget and all of its descendents. We can't + * just call XtDestroyWidget to do this because while this will destroy all + * the normal and popup children of a widget, it won't destroy any top level + * shells and their children. + */ +static void +widgetDestroy (obj) +register ObmObject obj; +{ + register int i; + WidgetObject wobj = (WidgetObject) obj; + WidgetClass *widget_class; + ObmObject child; + int object_type; + + for (i=0; i < obj->core.nchildren; i++) { + child = obj->core.children[i]; + widget_class = child->core.classrec->widget_class; + if (widget_class == &topLevelShellWidgetClass) + widgetDestroy (child); + } + + XtUnrealizeWidget (wobj->widget.w); + XtDestroyWidget (wobj->widget.w); +} + + +/* WidgetEvaluate -- Evaluate a widget command or message. + */ +WidgetEvaluate (object, command) +ObmObject object; +char *command; +{ + register WidgetObject obj = (WidgetObject) object; + register Tcl_Interp *tcl, *server = obj->widget.obm->tcl; + MsgContext omsg = (MsgContext) obj->core.classrec->class_data; + MsgContext pmsg = (MsgContext) obj->core.superclass->class_data; + + /* Since the class wide interpreter is used to evaluate the message + * we can't pass the object descriptor directly to the class procedure + * referenced in the message. Instead we pass the object reference + * in the message descriptor. + */ + Tcl_SetResult (server, "", TCL_STATIC); + + /* First try to get the widget subclass to accept the message. */ + if (omsg && (tcl = omsg->tcl) && obmClientCommand(tcl,command)) { + omsg->object[++omsg->level] = object; + if (Tcl_Eval (tcl, command) == TCL_OK) { + if (*tcl->result) + Tcl_SetResult (server, tcl->result, TCL_VOLATILE); + omsg->level--; + return (TCL_OK); + + } else { + static char invalid[] = "invalid command name"; + omsg->level--; + + /* Exit with an error return if the class code recognized + * the command but failed to execute it. + */ + if (strncmp (tcl->result, invalid, strlen(invalid)) != 0) + goto error; + } + } + + /* If the subclass code did not recognize the command pass the + * message on to the base Widget class. + */ + if (pmsg && pmsg != omsg && (tcl = pmsg->tcl) && + obmClientCommand(tcl,command)) { + pmsg->object[++pmsg->level] = object; + if (Tcl_Eval (tcl, command) == TCL_OK) { + if (*tcl->result) + Tcl_SetResult (server, tcl->result, TCL_VOLATILE); + pmsg->level--; + return (TCL_OK); + } else + pmsg->level--; + } + +error: + if (*tcl->result) + Tcl_SetResult (server, tcl->result, TCL_VOLATILE); + else { + /* Supply a default error message if none was returned. */ + Tcl_SetResult (server, obmClientCommand (tcl, command) ? + "evaluation error" : "invalid command", TCL_VOLATILE); + } + server->errorLine = tcl->errorLine; + return (TCL_ERROR); +} + + +/* widgetGetPointer -- Return the widget descriptor for an object of class + * widget. Used by non-widget Obm code to get the widget handle from an + * object descriptor. + */ +Widget +widgetGetPointer (object) +ObmObject object; +{ + register WidgetObject obj = (WidgetObject) object; + return (obj->widget.w); +} + + +/* widgetToObject -- Convert a widget pointer to an OBM object name. + */ +WidgetObject +widgetToObject (obm, w) +ObmContext obm; +Widget w; +{ + register int i; + register WidgetPrivate wp; + ObmObject objs[256]; + int nobjs; + + obm_nameToObjectList (obm, XtName(w), NULL, &nobjs, objs); + for (i=0; i < nobjs; i++) + wp = &((WidgetObject)objs[i])->widget; + if (wp->w == w) + return ((WidgetObject)objs[i]); + + return (NULL); +} + + +/* widgetAddCallback -- Add a callback procedure to the callback list for + * a widget. If no callback name is given, "callback" is assumed. + * + * Usage: addCallback <procedure-name> [<callback-name>] + * + * Specific widgets only support certain types of callbacks. There is no + * checking that the callback type specified is supported by a widget; the + * wrong type of callback can be registered, but it will never be called. + */ +static int +widgetAddCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register WidgetObject obj = (WidgetObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + ObmCallback cb, new_cb; + char *s_proc, *s_type; + int callback_type, i; + + s_proc = argv[1]; + s_type = (argc > 2) ? argv[2] : NULL; + + /* Determine callback type. */ + if (s_type) { + callback_type = Ctcallback; + for (i=0; i < XtNumber(callbackTypes); i++) + if (strcmp (s_type, callbackTypes[i].name) == 0) { + callback_type = callbackTypes[i].type; + break; + } + } else if (obmClass (obj->core.classrec, WtAsciiText)) { + callback_type = Ctlinemode; + } else if (obmClass (obj->core.classrec, WtPanner) || + obmClass (obj->core.classrec, WtPorthole) || + obmClass (obj->core.classrec, WtViewport)) { + callback_type = CtreportCallback; + } else if (obmClass (obj->core.classrec, WtSlider2d) || + obmClass (obj->core.classrec, WtScrollbar2) || + obmClass (obj->core.classrec, WtScrollbar)) { + callback_type = CtjumpProc; + } else + callback_type = Ctcallback; + + /* Special handling for asciiText callbacks. */ + if (obmClass (obj->core.classrec, WtAsciiText)) + if (callback_type == Ctlinemode) { + char text_translations[SZ_LINE]; + XtTranslations translations; + sprintf (text_translations, "<Key>Return: do_text(0x%lx, %s) ", + wp->obm, XtName(wp->w)); + translations = XtParseTranslationTable (text_translations); + XtOverrideTranslations (wp->w, translations); + } else { + XtAddCallback (XawTextGetSource(wp->w), XtNcallback, + widgetCallback, obj); + } + + /* Create callback record. */ + new_cb = (ObmCallback) XtCalloc (1, sizeof (obmCallback)); + new_cb->callback_type = callback_type; + strncpy (new_cb->name, s_proc, SZ_NAME); + + /* Add callback to tail of callback list. */ + if (wp->callback) { + for (cb = wp->callback; cb->next; cb = cb->next) + ; + cb->next = new_cb; + } else + wp->callback = new_cb; + + return (TCL_OK); +} + + +/* widgetDeleteCallback -- Delete a callback procedure previously registered + * for a widget. + * + * Usage: deleteCallback <procedure-name> + */ +static int +widgetDeleteCallback (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register WidgetObject obj = (WidgetObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + ObmCallback cb, prev; + + /* Locate and delete procedure entry in callback list. */ + for (prev=NULL, cb=wp->callback; cb; prev=cb, cb=cb->next) + if (strcmp (cb->name, argv[1]) == 0) { + if (prev) + prev->next = cb->next; + else + wp->callback = cb->next; + XtFree ((char *)cb); + break; + } + + return (TCL_OK); +} + + +/* widgetCallback -- Generic callback procedure, used for most widgets. + * The callback procedure is called with the widget name as the first + * argument, followed by zero or more additional arguments which depend upon + * the callback type. + */ +static void +widgetCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + register ObjClassRec classrec = obj->core.classrec; + char buffer[SZ_COMMAND]; + char *message = buffer; + int callback_type, i; + + /* Default callback type. */ + callback_type = Ctcallback; + + if (obmClass (classrec, WtAsciiSrc) || + obmClass (classrec, WtAsciiText)) { + + char *string; + Arg args[1]; + + XtSetArg (args[0], "string", &string); + XtGetValues (wp->w, args, 1); + sprintf (message, "{%s}", string); + callback_type = Ctcharmode; + + } else if (obmClass (classrec, WtGrip)) { + GripCallDataRec *grip = (GripCallDataRec *) call_data; + + /* The message, if any, is given in the grip translation table + * as the arguments to the GripAction routine. These differ + * depending upon the event; we just pass on the arguments and + * ignore the event attributes. + */ + message[0] = '\0'; + for (i=0; i < grip->num_params; i++) { + strcat (message, " "); + strcat (message, grip->params[i]); + } + + } else if (obmClass (classrec, WtList)) { + XawListReturnStruct *list = (XawListReturnStruct *) call_data; + + /* The message is the string value of the list element + * selected, followed by its index. + */ + sprintf (message, "{%s} %d", list->string, list->list_index); + + } else if (obmClass (classrec, WtMultiList)) { + XfwfMultiListReturnStruct *list = + (XfwfMultiListReturnStruct *) call_data; + Boolean state, sensitive; + register char *ip, *op; + int buflen, need, i; + char *string; + + /* The message consists of an array of string values of the + * currently selected list elements in the form { {s} {s} ...}, + * followed by a array of the indices { n n ...}. + */ + buflen = SZ_COMMAND; + if (!(message = XtMalloc (buflen))) + return; + + /* Generate list of item strings. */ + op = message; + *op++ = '{'; + for (i=0; i < list->num_selected; i++) { + XfwfMultiListGetItemInfo ((XfwfMultiListWidget)wp->w, + list->selected_items[i], &string, &state, &sensitive); + need = strlen(string)+3 + list->num_selected * 6; + if (buflen < (op-message)+need) { + buflen += max (need, SZ_COMMAND); + if (!(message = XtRealloc (buffer, buflen))) + return; + } + *op++ = ' '; + *op++ = '{'; + for (ip=string; *op = *ip++; op++) + ; + *op++ = '}'; + } + *op++ = ' '; + *op++ = '}'; + + /* Append list of indices. We allocated space for these above. */ + *op++ = ' '; + *op++ = '{'; + for (i=0; i < list->num_selected; i++) { + sprintf (op, " %d", list->selected_items[i]); + while (*op) + op++; + } + *op++ = ' '; + *op++ = '}'; + *op++ = '\0'; + + } else if (obmClass (classrec, WtToggle)) { + Arg args[1]; + Boolean state; + + /* The callback for a toggle does not pass any call data, + * but we return the value of the "state" resource anyway + * to indicate the state of the toggle. + */ + XtSetArg (args[0], XtNstate, &state); + XtGetValues (wp->w, args, 1); + sprintf (message, "%s", state ? TRUESTR : FALSESTR); + + } else if (obmClass (classrec, WtTextToggle)) { + Arg args[1]; + Boolean state; + + /* For this widget the value of the "on" resource indicates + * the state of the toggle. + */ + XtSetArg (args[0], XtNon, &state); + XtGetValues (wp->w, args, 1); + sprintf (message, "%s", state ? TRUESTR : FALSESTR); + + } else { + /* The default case, which works for most simple callbacks. + * Only the widget name is returned. + */ + message = NULL; + } + + call_callbacks (obj, callback_type, message); + + if (message && message != buffer) + XtFree (message); +} + + +/* widgetRGCallback -- Radiogroup or Group callback. The argument list for + * the callback is one of the following: + * + * selectionStyle = multiple: widget-name { label label ... } + * selectionStyle = one,single: widget-name [label | "none"] + * + * Here label refers to the label of the selected TextToggle widget or widgets. + * In the case of selectionStyle=multiple, the list will be empty if no widgets + * are currently selected. + */ +static void +widgetRGCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + long selection = (long) call_data; + register char *op; + register int i; + + char message[SZ_COMMAND]; + SelectionType selectionType; + WidgetList children; + Cardinal nchildren; + Arg args[10]; + char *label; + + /* Get list of child widgets in the group. */ + XtSetArg (args[0], XtNselectionStyle, &selectionType); + XtSetArg (args[1], XtNnumChildren, &nchildren); + XtSetArg (args[2], XtNchildren, &children); + XtGetValues (wp->w, args, 3); + + op = message; + if (selectionType == XfwfMultipleSelection) { + *op++ = '{'; + for (i=0; selection > 0 && i < min(32,nchildren); i++) + if (selection & (1 << i)) { + XtSetArg (args[0], XtNlabel, &label); + XtGetValues (children[i], args, 1); + *op++ = ' '; + sprintf (op, "\"%s\"", label); + while (*op) + op++; + } + *op++ = '}'; + + } else { + if (selection < 0 || selection >= nchildren) + label = "none"; + else { + XtSetArg (args[0], XtNlabel, &label); + XtGetValues (children[selection], args, 1); + } + sprintf (op, "\"%s\"", label); + while (*op) + op++; + } + *op++ = '\0'; + + call_callbacks (obj, Ctcallback, message); +} + + +/* widgetLTHCallback -- ListTree highlight callback. + */ +static void +widgetLTHCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + ListTreeMultiReturnStruct *list; + ListTreeItem *item; + char message[SZ_COMMAND], buf[SZ_LINE]; + register int i; + + list = (ListTreeMultiReturnStruct *) call_data; + if (!list->items) + return; + + + /* The message is the string value of the list element selected + * and a bottom-up path to the root. + */ + sprintf (message, "{%s %d} ", + list->items[0]->text, list->items[0]->open); + + strncat (message, "{ ", 2); + for (i=0; i < list->count; i++) { + item = list->items[i]; + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + while (item->parent) { + item = item->parent; + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + } + } + strncat (message, "}", 1); + + call_callbacks (obj, Ctcallback, message); +} + + +/* widgetLTACallback -- ListTree activate callback. + */ +static void +widgetLTACallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + ListTreeActivateStruct *ret; + ListTreeMultiReturnStruct ret2; + ListTreeItem *item; + char message[SZ_COMMAND], buf[SZ_LINE]; + int i, count; + + ret = (ListTreeActivateStruct *) call_data; + + /* The message is the string value of the list element selected, + * and a bottom-up path to the root. + */ + sprintf (message, "{%s %d} ", ret->item->text, ret->item->open); + + strncat (message, "{ ", 2); + item = ret->item; + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + while (item->parent) { + item = item->parent; + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + } + strncat (message, "}", 1); + + call_callbacks (obj, Ctcallback, message); +} + + +/* widgetSBCallback -- Repeater start callback. + */ +static void +widgetSBCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + call_callbacks (obj, CtstartCallback, NULL); +} + + +/* widgetSECallback -- Repeater stop callback. + */ +static void +widgetSECallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + call_callbacks (obj, CtstopCallback, NULL); +} + + +/* widgetRPCallback -- Report callback used by the panner, porthole, and + * viewport widgets to report any changes in the position or size of the + * thumb (panner) or child widget (porthole, viewport). + */ +static void +widgetRPCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + register XawPannerReport *rp = (XawPannerReport *) call_data; + char message[100]; + + /* Return args: changed x y w h cw ch */ + sprintf (message, "0%o %d %d %d %d %d %d", rp->changed, + rp->slider_x, rp->slider_y, rp->slider_width, rp->slider_height, + rp->canvas_width, rp->canvas_height); + + call_callbacks (obj, CtreportCallback, message); +} + + +/* widgetJPCallback -- Jump callback for the scroll bar widget. This is + * called when the thumb port of the scroll bar is dragged or moved (button 2). + */ +static void +widgetJPCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + XfwfScrollInfo *info = (XfwfScrollInfo *) call_data; + XfwfScrollInfo update_info; + register int flags = info->flags; + char message[100]; + + if (obmClass (obj->core.classrec, WtScrollbar)) { + /* Athena scrollbar. The call_data gives the position of the + * thumb in percent. + */ + sprintf (message, "%0.6f", *((float *)call_data)); + call_callbacks (obj, CtjumpProc, message); + + } else if (info->reason != XfwfSDrag) { + /* Slider2d callback: widget-name x y + * Scrollbar2 callback: widget-name fraction + * + * Scrollbars return the same fraction value regardless of + * whether the scrollbar is vertical or horizontal. + * widgetSPCallback below is always called when the slider moves, + * so we don't need to call response_cb here. + */ + if (obmClass (obj->core.classrec, WtSlider2d)) { + XfwfGetThumb (wp->w, &update_info); + sprintf (message, "%0.5f %0.5f", + (flags & XFWF_HPOS) ? info->hpos : update_info.hpos, + (flags & XFWF_VPOS) ? info->vpos : update_info.vpos); + } else { + if (info->flags & XFWF_HPOS) + sprintf (message, "%0.5f", info->hpos); + else if (info->flags & XFWF_VPOS) + sprintf (message, "%0.5f", info->vpos); + } + + /* Call the callbacks. */ + call_callbacks (obj, CtjumpProc, message); + } +} + + +/* widgetSPCallback -- Scroll callback for the scroll bar widget. This is + * used for incremental scrolling (button 1 or 3). + */ +static void +widgetSPCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + char message[100]; + + if (obmClass (obj->core.classrec, WtScrollbar)) { + /* Athena scrollbar. The call_data gives the distance in pixels + * of the pointer from the top of the scrollbar, and is positive + * for button 1 and negative for button 3. + */ + sprintf (message, "%d", (int)call_data); + call_callbacks (obj, CtscrollProc, message); + + } else { + /* FWF scrollbar2 or slider2d. + */ + XfwfScrollInfo *info = (XfwfScrollInfo *) call_data; + XfwfScrollInfo update_info; + register int flags = info->flags; + + /* Slider2d callback: widget-name x y + * Scrollbar2 callback: widget-name fraction + * + * Scrollbars return the same fraction value regardless of + * whether the scrollbar is vertical or horizontal. + */ + if (obmClass (obj->core.classrec, WtSlider2d)) { + XfwfGetThumb (wp->w, &update_info); + sprintf (message, "%0.5f %0.5f", + (flags & XFWF_HPOS) ? info->hpos : update_info.hpos, + (flags & XFWF_VPOS) ? info->vpos : update_info.vpos); + } else { + if (flags & XFWF_HPOS) + sprintf (message, "%0.5f", info->hpos); + else if (flags & XFWF_VPOS) + sprintf (message, "%0.5f", info->vpos); + } + + /* Call the callbacks. */ + call_callbacks (obj, CtscrollProc, message); + + /* Update the slider. */ + update_info = *info; + update_info.reason = XfwfSNotify; + wp->response_cb (NULL, w, (caddr_t) &update_info); + } +} + + +/* widgetSCCallback -- Strip chart callback procedure. This is called by the + * strip chart widget every "update" seconds to get the next value to be + * plotted. + */ +static void +widgetSCCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + char *callback_name; + ObmCallback cb; + double atof(); + int status, i; + + callback_name = "getValue"; + for (i=0; i < XtNumber(callbackTypes); i++) + if (callbackTypes[i].type == CtgetValue) { + callback_name = callbackTypes[i].name; + break; + } + + /* Call the callback procedure to get the next value to be plotted + * in the strip chart. This is a numeric (e.g. floating point) value + * returned as the function value of the callback procedure. Multiple + * callbacks can be registered, but only the first such procedure + * will be called. + */ + for (cb = wp->callback; cb; cb = cb->next) { + if (cb->callback_type != CtgetValue) + continue; + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + callback_name, " ", + NULL); + if (status == TCL_OK) + *((double *)call_data) = atof (obm->tcl->result); + else { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } + break; + } +} + + +/* widgetPUCallback -- Popup callback, used by the shell and simpleMenu + * widgets. Called when the window pops up. + */ +static void +widgetPUCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + call_callbacks (obj, CtpopupCallback, NULL); +} + + +/* widgetPDCallback -- Popdown callback, used by the shell and simpleMenu + * widgets. Called when the window pops down. + */ +static void +widgetPDCallback (w, obj, call_data) +Widget w; +WidgetObject obj; +caddr_t call_data; +{ + register WidgetPrivate wp = &obj->widget; + call_callbacks (obj, CtpopdownCallback, NULL); +} + + +/* call_callbacks -- Call all the callbacks of the given type for the given + * widget object, passing the given message on the argument list. + */ +static void +call_callbacks (obj, callback_type, message) +WidgetObject obj; +int callback_type; +char *message; +{ + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register ObmCallback cb; + char *callback_name; + int status, i; + + callback_name = callbackTypes[0].name; + for (i=0; i < XtNumber(callbackTypes); i++) + if (callback_type == callbackTypes[i].type) { + callback_name = callbackTypes[i].name; + break; + } + + /* Deliver the message to all the callback procedures registered for + * this widget for which the callback type matches. The callback + * arguments are: + * + * widget-name callback-name callback-args + * + * where the callback-args depend on the callback. + */ + for (cb = wp->callback; cb; cb = cb->next) { + if (cb->callback_type != callback_type) + continue; + + if (message) { + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + callback_name, " ", + message, " ", + NULL); + } else { + status = Tcl_VarEval (obm->tcl, + cb->name, " ", + obj->core.name, " ", + callback_name, " ", + NULL); + } + + if (status != TCL_OK) { + char *errstr = Tcl_GetVar (obm->tcl, "errorInfo", 0); + fprintf (stderr, "Error on line %d in %s: %s\n", + obm->tcl->errorLine, cb->name, + errstr ? errstr : obm->tcl->result); + } + } +} + + +/* do_text -- Translation action procedure for the text widget, called when + * return is typed to process an input string ("linemode" callback type). + */ +static void +do_text (w, event, params, num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + char *message, *s; + WidgetObject obj; + ObmCallback cb; + Arg args[1]; + + /* do_text (0xXXXX, object-name) */ + if (*num_params >= 2) { + ObmContext obm = (ObmContext) strtol (params[0], NULL, 0); + char *object = params[1]; + + if (obm && (obj = (WidgetObject) obmFindObject (obm, object))) { + XtSetArg (args[0], XtNstring, &s); + XtGetValues (obj->widget.w, args, 1); + + if (!(message = XtMalloc (strlen(s) + 10))) + return; + sprintf (message, "{%s}", s); + + call_callbacks (obj, Ctlinemode, message); + XtFree (message); + } + } +} + + +/* do_userproc -- Translation action procedure used to call general user + * action procedures in the interpreter. The name of the user procedure to + * be called is given as the first argument in the translation. For example, + * the translation "call(foo,a,b,c)" would cause procedure foo to be called + * with the arguments (a,b,c). The following arguments are special: + * + * Argument Replaced by + * + * $name translation table name (defaults to widget name) + * $time event->time + * $x event->x + * $y event->y + * $x_root event->x_root + * $y_root event->y_root + * + * The "user procedure" can be any server procedure. + */ +static void +do_userproc (w, event, params, num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + register char *ip, *op; + ObmContext obm = global_obm_handle; + char cmd[SZ_COMMAND], *param; + int x, y, x_root, y_root; + int status, arg; + Time time; + + if (*num_params < 1) + return; + + time = 0; + x = y = 0; + x_root = y_root = 0; + + /* Get common event parameters. */ + switch (event->type) { + case KeyPress: + case KeyRelease: + { XKeyEvent *ev = (XKeyEvent *) event; + time = ev->time; + x = ev->x; y = ev->y; + x_root = ev->x_root; y_root = ev->y_root; + } + break; + case ButtonPress: + case ButtonRelease: + { XButtonEvent *ev = (XButtonEvent *) event; + time = ev->time; + x = ev->x; y = ev->y; + x_root = ev->x_root; y_root = ev->y_root; + } + break; + case MotionNotify: + { XMotionEvent *ev = (XMotionEvent *) event; + time = ev->time; + x = ev->x; y = ev->y; + x_root = ev->x_root; y_root = ev->y_root; + } + break; + case EnterNotify: + case LeaveNotify: + { XCrossingEvent *ev = (XCrossingEvent *) event; + time = ev->time; + x = ev->x; y = ev->y; + x_root = ev->x_root; y_root = ev->y_root; + } + break; + } + + /* Copy name of server procedure to be called. */ + for (ip=params[0], op=cmd; *ip; ) + *op++ = *ip++; + *op++ = ' '; + + /* Copy the remaining arguments. */ + for (arg=1; arg < *num_params; arg++) { + param = params[arg]; + if (*param == '$') { + if (strcmp (param, "$name") == 0) { + /* Return the current translation table name for the + * widget (defaults to the widget name). + */ + WidgetObject obj; + char *name; + + if (obj = widgetToObject (obm, w)) + name = obj->widget.translation_table_name; + else + name = XtName (w); + + for (ip = name; *ip; ) + *op++ = *ip++; + *op++ = ' '; + + } else if (strcmp (param, "$time") == 0) { + sprintf (op, "%u ", time); + while (*op) + op++; + } else if (strcmp (param, "$x") == 0) { + sprintf (op, "%d ", x); + while (*op) + op++; + } else if (strcmp (param, "$y") == 0) { + sprintf (op, "%d ", y); + while (*op) + op++; + } else if (strcmp (param, "$x_root") == 0) { + sprintf (op, "%d ", x_root); + while (*op) + op++; + } else if (strcmp (param, "$y_root") == 0) { + sprintf (op, "%d ", y_root); + while (*op) + op++; + } else { + for (ip=param; *ip; ) + *op++ = *ip++; + *op++ = ' '; + } + } else { + for (ip=param; *ip; ) + *op++ = *ip++; + *op++ = ' '; + } + } + + *op = '\0'; + status = Tcl_Eval (obm->tcl, cmd); + if (status != TCL_OK) { + fprintf (stderr, "Error on line %d of %s: %s\n", + obm->tcl->errorLine, params[0], obm->tcl->result); + } +} + + +/* widgetSetTTName -- Set the translation table name for a widget. This + * is the name passed in the $name field of a translation table action + * procedure called with the "call" action from a translation table. + * + * Usage: setTTName name + * + * The default translation table name is the name of the widget. Note that + * some widget subclasses (e.g. marker) may set the translation table name + * automatically when the widget changes the translation table. + */ +static int +widgetSetTTName (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register WidgetObject obj = (WidgetObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + + if (argc < 2) + return (TCL_ERROR); + + widget_setTTName (obj, argv[1]); + return (TCL_OK); +} + +void +widget_setTTName (obj, name) +WidgetObject obj; +char *name; +{ + register WidgetPrivate wp = &obj->widget; + strncpy (wp->translation_table_name, name, SZ_NAME); + wp->translation_table_name[SZ_NAME-1] = '\0'; +} + + +/* widgetGetTTName -- Get the translation table name for a widget. + * + * Usage: name = getTTName + */ +static int +widgetGetTTName (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register WidgetObject obj = (WidgetObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + + Tcl_SetResult (wp->obm->tcl, widget_getTTName(obj), TCL_VOLATILE); + return (TCL_OK); +} + +char * +widget_getTTName (obj) +WidgetObject obj; +{ + register WidgetPrivate wp = &obj->widget; + return (wp->translation_table_name); +} + + +/* do_popup -- Popup a menu (or other spring loaded popup) at the location + * of the event which triggered this action. + * + * Usage: popup(menu-name [xoffset [yoffset]]) + */ +static void +do_popup (w, event, params, num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + register char *ip, *op; + ObmContext obm = global_obm_handle; + XKeyEvent *ev = (XKeyEvent *) event; + Boolean spring_loaded; + Dimension menu_width, menu_height, menu_borderWidth; + Position menu_x, menu_y; + int xoffset, yoffset; + char *menu_name; + WidgetObject obj; + Widget menu; + + if (*num_params < 1) + return; + + menu_name = params[0]; + xoffset = (*num_params >= 2) ? atoi(params[1]) : -10; + yoffset = (*num_params >= 3) ? atoi(params[2]) : -10; + + if (!(obj = (WidgetObject) obmFindObject (obm, menu_name))) + return; + else + menu = obj->widget.w; + + /* Evidently SimpleMenu requires that the following be called to + * properly initialize things. + */ + if (obmClass (obj->core.classrec, WtSimpleMenu)) + XtCallActionProc (XtParent(menu), "XawPositionSimpleMenu", + event, params, *num_params); + + XtVaGetValues (menu, + XtNwidth, &menu_width, + XtNheight, &menu_height, + XtNborderWidth, &menu_borderWidth, + NULL); + + menu_width = menu_width + 2 * menu_borderWidth; + menu_height = menu_height + 2 * menu_borderWidth; + menu_x = ev->x_root + xoffset; + menu_y = ev->y_root + yoffset; + + if (menu_x >= 0) { + int scr_width = WidthOfScreen(XtScreen(menu)); + if ((int)(menu_x + menu_width) > scr_width) + menu_x = scr_width - menu_width; + } + if (menu_x < 0) + menu_x = 0; + + if (menu_y >= 0) { + int scr_height = HeightOfScreen(XtScreen(menu)); + if ((int)(menu_y + menu_height) > scr_height) + menu_y = scr_height - menu_height; + } + if (menu_y < 0) + menu_y = 0; + + XtVaSetValues (menu, + XtNx, menu_x, + XtNy, menu_y, + NULL); + + if (event->type == ButtonPress) + spring_loaded = True; + else if (event->type == KeyPress || event->type == EnterNotify) + spring_loaded = False; + else { + /* should not happen. */ + spring_loaded = False; + } + + if (spring_loaded) + XtPopupSpringLoaded (menu); + else + XtPopup (menu, XtGrabNonexclusive); +} + + +/* do_popdown -- Pop down a menu. + * + * Usage: popdown(menu-name) + */ +static void +do_popdown (w, event, params, num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + register char *ip, *op; + ObmContext obm = global_obm_handle; + XKeyEvent *ev = (XKeyEvent *) event; + char *menu_name; + WidgetObject obj; + Widget menu; + + if (*num_params < 1) + return; + + menu_name = params[0]; + if (obj = (WidgetObject) obmFindObject (obm, menu_name)) { + menu = obj->widget.w; + XtPopdown (menu); + } +} + + +/* widgetSet -- Set a widget resource. + * + * Usage: set <resource-name> <value> + */ +static int +widgetSet (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + register char *ip; + register int hashval, n; + register Rtype rp; + XrmValue from, to; + Arg args[1]; + + /* Lookup resource. There can be multiple entries for a given resource + * if the resource has a different type in different widgets. A + * resource entry can be used only if both the name matches and the + * bitflags indicate that the target widget uses the resource. + */ + for (hashval=0, ip=argv[1], n=MAX_HASHCHARS; --n >= 0 && *ip; ip++) + hashval += (hashval + *ip); + + if (rp = rhash[hashval%LEN_RHASH]) { + for ( ; rp; rp = rp->next) + if (!strcmp(rp->name,argv[1]) && + obmClass (obj->core.classrec, rp->flag1, rp->flag2)) + break; + } + + /* For a string type resource, no value string arg indicates the + * null string. + */ + if (!rp || argc < 3 && strcmp (rp->type, XtRString)) + return (TCL_ERROR); + + /* If the resource entry was found, convert the resource value + * from a string to whatever the resource type is, and set the + * resource value. + */ + from.size = strlen (argv[2]) + 1; + from.addr = argv[2]; + + if (strcmp (rp->type, XtRString) == 0) { + XtSetArg (args[0], rp->name, argc < 3 ? "" : argv[2]); + XtSetValues (wp->w, args, 1); + + /* The following is for text widgets. */ + if (obmClass (obj->core.classrec, WtAsciiText)) { + register ObmCallback cb; + + wp->text_newline = 0; + wp->text_pos = strlen (argv[2]); + + /* If linemode is in effect set insertion point to EOL. */ + for (cb = wp->callback; cb; cb = cb->next) + if (cb->callback_type == Ctlinemode) { + XawTextSetInsertionPoint (wp->w, wp->text_pos); + break; + } + } + + } else if (strcmp (rp->type, XtRDimension) == 0 || + strcmp (rp->type, XtRPosition) == 0) { + + Dimension value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRBool) == 0 || + strcmp (rp->type, XtRBoolean) == 0) { + + Boolean value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. The numeric values "0" and "1" are + * permitted as well as the resource values "true" and "false". + */ + if (strcmp (from.addr, "0") == 0) { + value = False; + goto set_bval; + } else if (strcmp (from.addr, "1") == 0) { + value = True; + goto set_bval; + } else if (XtConvertAndStore (wp->w,XtRString,&from,rp->type,&to)) { +set_bval: XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRAtom) == 0 || + strcmp (rp->type, XtRCardinal) == 0 || + strcmp (rp->type, XtRInt) == 0) { + + int value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRFloat) == 0) { + union { + int int_value; + float float_value; + } value; + + to.addr = (caddr_t) &value.float_value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value.int_value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRPixel) == 0) { + Pixel value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRPixmap) == 0 || + strcmp (rp->type, XtRBitmap) == 0) { + + Pixmap value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if ((value = findPixmap (obm, (char *)from.addr)) || + XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRIcon) == 0) { + Icon *value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if ((value = findIcon (obm, (char *)from.addr)) || + XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRCursor) == 0) { + Cursor value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if ((value = findCursor (obm, (char *)from.addr)) || + XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRFontStruct) == 0) { + XFontStruct *value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRVisual) == 0) { + Visual *value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRWidget) == 0) { + Widget value; + + /* Convert resource value. */ + if (value = XtNameToWidget (obm->toplevel, argv[2])) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + + } else if (strcmp (rp->type, XtRTranslationTable) == 0) { + XtTranslations value; + + /* Convert resource value. */ + value = XtParseTranslationTable (argv[2]); + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + + } else { + caddr_t value; + to.addr = (caddr_t) &value; + to.size = sizeof(value); + + /* Convert resource value. */ + if (XtConvertAndStore (wp->w, XtRString,&from, rp->type,&to)) { + XtSetArg (args[0], rp->name, value); + XtSetValues (wp->w, args, 1); + } + } + + return (TCL_OK); +} + + +/* widgetGet -- Get a widget resource value as a string. + * + * Usage: get <resource-name> + */ +static int +widgetGet (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + char rbuf[SZ_MESSAGE]; + char *result = rbuf; + register char *ip; + register int hashval, n; + register Rtype rp; + + if (argc < 2) + return (TCL_ERROR); + + /* Lookup widget. There can be multiple entries for a given resource + * if the resource has a different type in different widgets. A + * resource entry can be used only if both the name matches and the + * bitflags indicate that the target widget uses the resource. + */ + for (hashval=0, ip=argv[1], n=MAX_HASHCHARS; --n >= 0 && *ip; ip++) + hashval += (hashval + *ip); + + if (rp = rhash[hashval%LEN_RHASH]) { + for ( ; rp; rp = rp->next) + if (!strcmp(rp->name,argv[1]) && + obmClass (obj->core.classrec, rp->flag1, rp->flag2)) + break; + } + if (!rp) + return (TCL_ERROR); + + /* Return the resource value as a string. In general type converters + * are only registered for string-to-whatever conversions, so we + * cannot reproduce the original string value for all resource types. + * We can return a valid string value for the simple types (boolean, + * integer, floating, string). An attempt is made to convert widget + * pointers to widget names. For everything else, we just return + * the hex representation of the resource value. + */ + if (strcmp (rp->type, XtRBool) == 0 || + strcmp (rp->type, XtRBoolean) == 0) { + + Boolean value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + strcpy (result, value ? TRUESTR : FALSESTR); + + } else if ( + strcmp (rp->type, XtRDimension) == 0 || + strcmp (rp->type, XtRPosition) == 0) { + + short value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + sprintf (result, "%d", value); + + } else if ( + strcmp (rp->type, XtRAtom) == 0 || + strcmp (rp->type, XtRCardinal) == 0 || + strcmp (rp->type, XtRInt) == 0) { + + int value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + sprintf (result, "%d", value); + + } else if (strcmp (rp->type, XtRFloat) == 0) { + float value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + sprintf (result, "%g", value); + + } else if (strcmp (rp->type, XtRString) == 0) { + char *value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + result = (char *)value; + + } else if (strcmp (rp->type, XtRWidget) == 0) { + Widget value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + result = XtName (value); + + } else if (strcmp (rp->type, XtRFontStruct) == 0) { /* MF016 */ + caddr_t value; Arg args[1]; + XFontStruct *font_struct; + ObmContext obm = wp->obm; + char *name = NULL; + + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + sprintf (result, "0x%x", value); + + font_struct = (XFontStruct *) value; + name = widgetGetFontName (obm->display, font_struct); + + if (font_struct == NULL || name == NULL) + name = XtNewString("-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1"); + strcpy (result, name); + free ((char *)name); + + } else { + caddr_t value; Arg args[1]; + XtSetArg (args[0], rp->name, &value); + XtGetValues (wp->w, args, 1); + sprintf (result, "0x%x", value); + } + + Tcl_SetResult (wp->obm->tcl, result, TCL_VOLATILE); + return (TCL_OK); +} + + +/* widgetAppend -- Append data to a text widget. + * + * Usage: append <text> + */ +static int +widgetAppend (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + + register char *ip, *op; + char buf[SZ_COMMAND]; + XawTextBlock tx; + char *text; + + if (!(obmClass (obj->core.classrec, WtAsciiText))) { + obm->tcl->result = "not a text widget"; + return (TCL_ERROR); + } + + if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else + text = argv[1]; + + if (wp->text_pos == 0) { + Arg args[1]; + XtSetArg (args[0], XtNstring, ""); + XtSetValues (wp->w, args, 1); + } + + op = buf; + if (wp->text_newline) + *op++ = '\n'; + + for (ip=text; *ip; ) + *op++ = *ip++; + + if (wp->text_newline = (*(ip-1) == '\n')) + op--; + + *op = '\0'; + + tx.ptr = buf; + tx.length = op - buf; + tx.format = FMT8BIT; + tx.firstPos = 0; + + XawTextReplace (wp->w, wp->text_pos, wp->text_pos, &tx); + XawTextSetInsertionPoint (wp->w, (wp->text_pos += (op - buf))); + + return (TCL_OK); +} + + +/* widgetSetList -- Set the item list of a list widget. + * + * Usage: setList list [resize] + * + * The list is a simple list of strings, passed as a single string argument to + * setList (quotes, braces, etc. may be used to quote strings containing + * special characters). + */ +static int +widgetSetList (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Boolean resize; + String *items; + int nitems; + char *list; + + if (!(obmClass (obj->core.classrec, WtList) || + obmClass (obj->core.classrec, WtMultiList))) { + obm->tcl->result = "not a list widget"; + return (TCL_ERROR); + } + + if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else + list = argv[1]; + + resize = (argc > 2) ? (strcmp (argv[2], "resize") == 0) : False; + + if (Tcl_SplitList (obm->tcl, list, &nitems, &items) != TCL_OK) + return (TCL_ERROR); + + if ((obmClass (obj->core.classrec, WtList))) + XawListChange (wp->w, items, nitems, 0, resize); + else if ((obmClass (obj->core.classrec, WtMultiList))) + XfwfMultiListSetNewData ((XfwfMultiListWidget)wp->w, + items, nitems, 0, resize, NULL); + + if (wp->data) + free (wp->data); + + wp->data = (char *) items; + wp->datalen = nitems; + + return (TCL_OK); +} + + +/* widgetGetItem -- Get an item in a list widget. + * + * Usage: value = getItem itemno + * + * If ITEMNO is a number the indicated list item is returned, or the string + * "EOF" if the requested item is beyond the end of the list. Otherwise the + * currently selected item (or list of items in the case of a MultiList + * widget) is returned, and the index (list of indices) of the item is + * returned in the output variable ITEMNO. If no item is currently selected + * ITEMNO will be set to "none" ({}) on output. + */ +static int +widgetGetItem (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + + register nelem; + register String *list; + register char *ip, *op; + XawListReturnStruct *itemp; + char *s_itemno, *s_item; + char buf[SZ_NUMBER]; + int requested; + char *itemno; + + if (!(obmClass (obj->core.classrec, WtList) || + obmClass (obj->core.classrec, WtMultiList))) { + obm->tcl->result = "not a list widget"; + return (TCL_ERROR); + } + + if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else + itemno = argv[1]; + + if (isdigit (itemno[0])) { + /* Get indexed item. */ + requested = atoi (itemno); + list = (String *) wp->data; + nelem = wp->datalen; + if (requested < nelem) + s_item = list[requested]; + else + s_item = "EOF"; + + } else if (obmClass (obj->core.classrec, WtList)) { + /* Athena list: get the currently selected list item. + */ + itemp = XawListShowCurrent (wp->w); + if (!itemp || itemp->list_index == XAW_LIST_NONE) { + s_itemno = "none"; + s_item = ""; + } else { + sprintf (buf, "%d", itemp->list_index); + s_itemno = buf; + s_item = itemp->string; + } + if ((Tcl_SetVar (obm->tcl, itemno, s_itemno, 0)) == NULL) + return (TCL_ERROR); + + Tcl_SetResult (obm->tcl, s_item, TCL_VOLATILE); + + } else { + /* MultiList: get currently selected items. + */ + XfwfMultiListReturnStruct *list; + char *buffer, *strlist, *indexlist, *string; + Boolean state, sensitive; + int buflen, need, i; + + list = XfwfMultiListGetHighlighted ((XfwfMultiListWidget)wp->w); + buflen = SZ_COMMAND; + if (!(buffer = XtMalloc (buflen))) + return; + + /* Generate list of item strings. */ + strlist = op = buffer; + *op++ = '{'; + for (i=0; i < list->num_selected; i++) { + XfwfMultiListGetItemInfo ((XfwfMultiListWidget)wp->w, + list->selected_items[i], &string, &state, &sensitive); + need = strlen(string)+3 + list->num_selected * 6; + if (buflen < (op-buffer)+need) { + buflen += max (need, SZ_COMMAND); + if (!(buffer = XtRealloc (buffer, buflen))) + return; + } + *op++ = ' '; + *op++ = '{'; + for (ip=string; *op = *ip++; op++) + ; + *op++ = '}'; + } + *op++ = '}'; + *op++ = '\0'; + + /* Append list of indices. We allocated space for these above. */ + indexlist = op; + *op++ = '{'; + for (i=0; i < list->num_selected; i++) { + sprintf (op, " %d", list->selected_items[i]); + while (*op) + op++; + } + *op++ = '}'; + *op++ = '\0'; + + if ((Tcl_SetVar (obm->tcl, itemno, indexlist, 0)) == NULL) + return (TCL_ERROR); + + Tcl_SetResult (obm->tcl, strlist, TCL_VOLATILE); + XtFree (buffer); + } + + return (TCL_OK); +} + + +/* widgetHighlight -- Highlight an item in a list widget. + * + * Usage: highlight itemno + * + * The indicated item of the list is highlighted as if the item had been + * selected by the user. Any previously highlighted item is unhighlighted. + * List items may be specified by either the element number or by name. + */ +static int +widgetHighlight (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + int itemno; + + if (!(obmClass (obj->core.classrec, WtList) || + obmClass (obj->core.classrec, WtMultiList))) { + obm->tcl->result = "not a list widget"; + return (TCL_ERROR); + } + + if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else + itemno = get_itemno (obj, argv[1]); + + if (itemno >= 0 && itemno < wp->datalen) + if (obmClass (obj->core.classrec, WtList)) + XawListHighlight (wp->w, itemno); + else + XfwfMultiListHighlightItem ((XfwfMultiListWidget)wp->w, itemno); + + return (TCL_OK); +} + + +/* widgetUnhighlight -- Unhighlight the currently highlighted item in a + * list widget. + * + * Usage: unhighlight [itemno] + * + * If itemno is not given all list elements are unhighlighted, otherwise + * the given entry is unhighlighted. The itemno argument may be either + * the actual item number, or the name of the list element. + */ +static int +widgetUnhighlight (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + int itemno; + + if (!(obmClass (obj->core.classrec, WtList) || + obmClass (obj->core.classrec, WtMultiList))) { + obm->tcl->result = "not a list widget"; + return (TCL_ERROR); + } + + itemno = (argc > 1) ? get_itemno(obj,argv[1]) : -1; + + if (obmClass (obj->core.classrec, WtList)) { + if (itemno >= 0) { + XawListReturnStruct *itemp = XawListShowCurrent (wp->w); + if (itemp && itemp->list_index == itemno) + XawListUnhighlight (wp->w); + } else + XawListUnhighlight (wp->w); + } else { + if (itemno >= 0) { + XfwfMultiListUnhighlightItem ((XfwfMultiListWidget)wp->w, + itemno); + } else + XfwfMultiListUnhighlightAll ((XfwfMultiListWidget)wp->w); + } + + return (TCL_OK); +} + + +/* get_itemno -- Get the item number of an item in a list widget, given + * either the ascii representation of the item number, or the item string. + */ +static +get_itemno (obj, itemstr) +WidgetObject obj; +char *itemstr; +{ + WidgetPrivate wp = &obj->widget; + register int i; + + if (isdigit (*itemstr)) + return (atoi(itemstr)); + else { + /* Check first to see if the named item is the currently + * selected, or most recently referenced item. + */ + if (obmClass (obj->core.classrec, WtList)) { + XawListReturnStruct *itemp; + itemp = XawListShowCurrent (wp->w); + if (itemp && strcmp (itemp->string, itemstr) == 0) + return (itemp->list_index); + + } else if (obmClass (obj->core.classrec, WtMultiList)) { + XfwfMultiListReturnStruct *list; + list = XfwfMultiListGetHighlighted ((XfwfMultiListWidget)wp->w); + if (list->string && strcmp (list->string, itemstr) == 0) + return (list->item); + } + + /* Search the full list. */ + for (i=0; i < wp->datalen; i++) + if (strcmp (((String *)wp->data)[i], itemstr) == 0) + return (i); + } + + return (-1); +} + + +/* widgetGetValue -- Get the text value of a dialog widget. + * + * Usage: value = getValue + */ +static int +widgetGetValue (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *value; + + if (!(obmClass (obj->core.classrec, WtDialog))) { + obm->tcl->result = "not a dialog widget"; + return (TCL_ERROR); + } + + value = XawDialogGetValueString (wp->w); + Tcl_SetResult (obm->tcl, value, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* widgetGetThumb -- Get the position and size of the thumb of a slider2d + * widget. + * + * Usage: getThumb x [y [width [height]]] + */ +static int +widgetGetThumb (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + XfwfScrollInfo info; + char buf[SZ_NUMBER]; + + if (!(obmClass (obj->core.classrec, WtSlider2d))) { + obm->tcl->result = "not a slider2d widget"; + return (TCL_ERROR); + } + + XfwfGetThumb (wp->w, &info); + + if (argc > 1) { + sprintf (buf, "%g", info.hpos); + if ((Tcl_SetVar (obm->tcl, argv[1], buf, 0)) == NULL) + return (TCL_ERROR); + } + if (argc > 2) { + sprintf (buf, "%g", info.vpos); + if ((Tcl_SetVar (obm->tcl, argv[2], buf, 0)) == NULL) + return (TCL_ERROR); + } + if (argc > 3) { + sprintf (buf, "%g", info.hsize); + if ((Tcl_SetVar (obm->tcl, argv[3], buf, 0)) == NULL) + return (TCL_ERROR); + } + if (argc > 4) { + sprintf (buf, "%g", info.vsize); + if ((Tcl_SetVar (obm->tcl, argv[4], buf, 0)) == NULL) + return (TCL_ERROR); + } + + return (TCL_OK); +} + + +/* widgetMoveThumb -- Move the thumb of a slider2D widget. + * + * Usage: moveThumb x [y] + * + * The thumb of a slider2D wiget is set to the given position specified as + * a fraction of the widget's width or height. The widget and height + * arguments should be floating point values in the range 0.0 to 1.0. + */ +static int +widgetMoveThumb (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + double x, y; + double atof(); + + if (!(obmClass (obj->core.classrec, WtSlider2d))) { + obm->tcl->result = "not a slider2D widget"; + return (TCL_ERROR); + } + + if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else { + x = atof (argv[1]); + y = (argc > 2) ? atof(argv[2]) : 0.0; + } + + x = max(0, min(1, x)); + y = max(0, min(1, y)); + + XfwfMoveThumb (wp->w, x, y); + return (TCL_OK); +} + + +/* widgetResizeThumb -- Resize the thumb of a slider2D widget. + * + * Usage: resizeThumb width [height] + * + * The thumb of a slider2D wiget is set to the given fraction of the widget's + * width or height. The widget and height arguments should be floating point + * values in the range 0.0 to 1.0. + */ +static int +widgetResizeThumb (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + double width, height; + double atof(); + + if (!(obmClass (obj->core.classrec, WtSlider2d))) { + obm->tcl->result = "not a slider2D widget"; + return (TCL_ERROR); + } + + if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else { + width = atof (argv[1]); + height = (argc > 2) ? atof(argv[2]) : 1.0; + } + + width = max(0, min(1, width)); + height = max(0, min(1, height)); + + XfwfResizeThumb (wp->w, width, height); + return (TCL_OK); +} + + +/* widgetSetScrollbar -- Set the position and size of a scrollbar. + * + * Usage: setScrollbar position size + * + * The thumb of a scrollbar wiget is set to the given position and size + * specified as a fraction of the widget's width or height. The position and + * height arguments should be floating point values in the range 0.0 to 1.0. + */ +static int +widgetSetScrollbar (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + double position, size; + double atof(); + + if (!(obmClass (obj->core.classrec, WtScrollbar) || + obmClass (obj->core.classrec, WtScrollbar2))) { + + obm->tcl->result = "not a scrollbar widget"; + return (TCL_ERROR); + } + + if (argc < 3) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else { + position = atof (argv[1]); + size = atof (argv[2]); + } + + position = max(0, min(1, position)); + size = max(0, min(1, size)); + + if (obmClass (obj->core.classrec, WtScrollbar)) + XawScrollbarSetThumb (wp->w, position, size); + else + XfwfSetScrollbar (wp->w, position, size); + + return (TCL_OK); +} + + +/* widgetSetLocation -- Set the position of a Viewport. + * + * Usage: setLocation x y + * + */ +static int +widgetSetLocation (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + float x, y; + double atof(); + + if (!(obmClass (obj->core.classrec, WtViewport))) { + obm->tcl->result = "not a viewport widget"; + return (TCL_ERROR); + } + + if (argc < 3) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else { + x = atof (argv[1]); + y = atof (argv[2]); + } + + XawViewportSetLocation (wp->w, x, y); + + return (TCL_OK); +} + + +/* widgetSetCoordinates -- Set the coordinates of a Viewport. + * + * Usage: setCoordinates x y + * + */ +static int +widgetSetCoordinates (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + int x, y; + double atof(); + + if (!(obmClass (obj->core.classrec, WtViewport))) { + obm->tcl->result = "not a viewport widget"; + return (TCL_ERROR); + } + + if (argc < 3) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } else { + x = atoi (argv[1]); + y = atoi (argv[2]); + } + + XawViewportSetCoordinates (wp->w, (int)x, (int)y); + + return (TCL_OK); +} + + +/* widgetSetTop -- Raise the child of a Tabs widget. + * + * Usage: setTop widget + * + */ +static int +widgetSetTop (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + ObmObject child = (ObmObject) NULL; + + if (!(obmClass (obj->core.classrec, WtTabs))) { + obm->tcl->result = "not a Tabs widget"; + return (TCL_ERROR); + } else if (argc < 2) { + obm->tcl->result = "missing argument"; + return (TCL_ERROR); + } + + /* Get the child object pointer and raise it. */ + child = obmFindObject (obm, argv[1]); + if (child) + XawTabsSetTop (widgetGetPointer (child), False); + + return (TCL_OK); +} + + +/* widgetSetListTree -- Set a ListTree hierarchy. + * + * Usage: setListTree list [append] + * + * The list is specified as a hierarchical Tcl list of the form + * + * {a1 {b1 {a2 {a3 b3}} b2} c1} + * + * This would produce an indented list something like: + * + * a1 + * b1 + * |- a2 + * |- a3 + * |- b3 + * |- b2 + * c1 + * + */ +static int +widgetSetListTree (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Boolean append; + char *list, **items, buf[SZ_LINE]; + int nitems, item; + static char **sv_items = NULL; + static int sv_nitems; + ListTreeItem *val; + extern ListTreeItem *ListTreeAdd(), *ListTreeFirstItem(); + + + /* Do some error checking first. */ + if (!(obmClass (obj->core.classrec, WtListTree))) { + obm->tcl->result = "not a ListTree widget"; + return (TCL_ERROR); + } else if (argc < 2) { + obm->tcl->result = "missing list argument"; + return (TCL_ERROR); + } + + list = argv[1]; + append = (argc > 2) ? (strcmp (argv[2], "append") == 0) : False; + + /* Delete the old tree. */ + if (!append && sv_items) { + while ((val = ListTreeFirstItem(wp->w))) + ListTreeDelete (wp->w, val); + free ((char *) sv_items); + sv_items = NULL; + } + + /* Split the list so we can parse as needed. */ + if (Tcl_SplitList (tcl, list, &nitems, &items) != TCL_OK) + return (TCL_ERROR); + + /* Get local copy of argc and argv. */ + if (!sv_nitems) { + sv_items = (char **) XtMalloc (nitems * sizeof(char *)); + memmove (sv_items, items, nitems * sizeof(char *)); + } + + if (append && sv_items) { + sv_items = (char **) XtRealloc ((char *)sv_items, + (sv_nitems + nitems * 1) * sizeof(char *)); + memmove (sv_items+sv_nitems, items, nitems * sizeof(char *)); + } + + for (item=0; item < nitems; item++) { + /* Build the top-level tree, children are built recursively + * in the routine. + */ + if (buildTreeList (wp->w, tcl, NULL, items[item]) != TCL_OK) { + free ((char *) items); + return (TCL_ERROR); + } + } + +ret: free ((char *) items); + return (TCL_OK); +} + + +/* buildTreeList -- Recursively build a tree from a list of nested Tcl + * lists. This is used to fill out the ListTree widget values. + */ +static int +buildTreeList (w, tcl, parent, item) +Widget w; +Tcl_Interp *tcl; +ListTreeItem *parent; +char *item; +{ + char **fields, **entry; + int i, nentries, nfields, field; + char buf[SZ_LINE]; + ListTreeItem *level; + + /* Split the list so we can parse as needed. */ + if (Tcl_SplitList (tcl, item, &nfields, &fields) != TCL_OK) { + sprintf (buf, "bad item '%s' in tree list", item); + Tcl_AppendResult (tcl, buf, NULL); + return (TCL_ERROR); + } + + /* First item is always added to the list, it may be either the + * parent of another list or a single item. + */ + level = ListTreeAdd (w, parent, fields[0]); + + /* For each of the items, split it and recursively call ourselves + * until it gets added as a single item. + */ + for (field=1; field < nfields; field++) { + if (Tcl_SplitList (tcl, fields[field], &nentries, &entry) != TCL_OK) + return (TCL_ERROR); + + for (i=0; i < nentries; i++) + buildTreeList (w, tcl, level, entry[i]); + } + + free ((char *) fields); +/* free ((char *) entry);*/ + return (TCL_OK); +} + + +/* widgetListTreeSelect -- Select the specified item from a ListTree. + * + * Usage: listTreeSelect item [ top [children_only] ] + * + * The 'item' may be one of: + * + * all open all children in list + * none close all children in list + * + * If 'toplevel' is specified then 'item' is assumed to be a child of + * that node. If 'children_only' is set then only the children of the + * specified item will be opened (applies to all/none only). The return + * message is a pair of lists of the form + * + * { value state } { parent1 parent2 ... } + * + * where the 'value' is the label of the item selected, 'state' is an int + * indicating whether the node is open or closed, and 'parentN' is a list + * of node names chaining back to the top level of the tree. + * + */ +static int +widgetListTreeSelect (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *top, *name; + char message[SZ_COMMAND], buf[SZ_LINE]; + int i, count; + ListTreeItem *item, *titem, *first; + + extern ListTreeItem *ListTreeFindSiblingName(); + extern ListTreeItem *ListTreeFindChildName(); + extern ListTreeItem *ListTreeFindChildNameInTree(); + + + if (argc < 2) + return (TCL_ERROR); + + name = argv[1]; + first = ListTreeFirstItem (wp->w); + + if (strcmp(argv[1], "all") == 0) { + if (argc == 4) { + top = argv[2]; + titem = ListTreeFindSiblingName (wp->w, first, top); + item = ListTreeFindChildName (wp->w, titem, name); + ListTreeOpenAll (wp->w, (item ? item : titem), 1); + ListTreeHighlightItem (wp->w, (item ? item : titem)); + sprintf (message, "{%s 1} { }", + (item ? item->text : titem->text)); + } else { + ListTreeOpenAll (wp->w, (ListTreeItem *)NULL, 0); + strcpy (message, "{all 1} { }"); + } + + + } else if (strcmp(argv[1], "none") == 0) { + if (argc == 4) { + top = argv[2]; + titem = ListTreeFindSiblingName (wp->w, first, top); + item = ListTreeFindChildName (wp->w, titem, name); + ListTreeCloseAll (wp->w, (item ? item : titem), 0); + sprintf (message, "{%s 0} { }", + (item ? item->text : titem->text)); + } else { + ListTreeCloseAll (wp->w, (ListTreeItem *)NULL, 0); + strcpy (message, "{all 0} { }"); + } + + } else { + if (argc == 3) { + top = argv[2]; + titem = ListTreeFindSiblingName (wp->w, first, top); + if (titem) + ListTreeOpenAll (wp->w, titem, 0); + item = ListTreeFindChildNameInTree (wp->w, titem, name); + item = (item ? item : titem); + } else { + titem = ListTreeFindSiblingName (wp->w, first, name); + if (strcmp (name, titem->text) == 0) + item = titem; + else + item = ListTreeFindChildNameInTree (wp->w, titem, name); + } + ListTreeHighlightItem (wp->w, item); + ListTreeOpenAll (wp->w, item, 0); + + /* The message is the string value of the list element selected, + * and a bottom-up path to the root. + */ + sprintf (message, "{%s %d} ", item->text, item->open); + + strncat (message, "{ ", 2); + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + while (item->parent) { + item = item->parent; + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + } + + strncat (message, "}", 1); + + } + + /* Call all the callbacks with the message. */ + call_callbacks (obj, Ctcallback, message); + + return (TCL_OK); +} + + +/* widgetListTreeHighlight -- Highlight but do not select the specified item + * from a ListTree. + * + * Usage: listTreeHighlight item [ top ] + * + * The 'item' is given as a node name of the tree. If 'top' is specified + * then 'item' is assumed to be a child of that node. If 'children_only' is + * set then only the children of the specified item will be opened (applies + * to all/none only). The return message is a pair of lists of the form + * + * { value state } { parent1 parent2 ... } + * + * where the 'value' is the label of the item selected, 'state' is an int + * indicating whether the node is open or closed, and 'parentN' is a list + * of node names chaining back to the top level of the tree. + * + */ +static int +widgetListTreeHighlight (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *top, *name; + char message[SZ_COMMAND], buf[SZ_LINE]; + int i, count; + ListTreeItem *item, *titem, *first, *op; + + extern ListTreeItem *ListTreeFindSiblingName(); + extern ListTreeItem *ListTreeFindChildName(); + extern ListTreeItem *ListTreeFindChildNameInTree(); + + + if (argc < 2) + return (TCL_ERROR); + + name = argv[1]; + first = ListTreeFirstItem (wp->w); + + if (argc == 3) { + top = argv[2]; + titem = ListTreeFindSiblingName (wp->w, first, top); + item = ListTreeFindChildNameInTree (wp->w, titem, name); + item = (item ? item : titem); + + /* Now chain back up thru the parents and open the nodes. + */ + for (op=item ; op->parent && op->parent != first; op = op->parent) { + if (op->open == 0) + ListTreeOpenAll (wp->w, op, 1); + } + + } else { + if (first->open == 0) + ListTreeOpenAll (wp->w, first, 0); + titem = ListTreeFindChildNameInTree (wp->w, first, name); + if (titem && strcmp (name, titem->text) == 0) + item = titem; + else + item = ListTreeFindChildNameInTree (wp->w, titem, name); + } + ListTreeHighlightItem (wp->w, item); + + /* The message is the string value of the list element selected, + * and a bottom-up path to the root. + */ + sprintf (message, "{%s %d} ", item->text, item->open); + + strncat (message, "{ ", 2); + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + while (item->parent) { + item = item->parent; + sprintf (buf, "{ %s } ", item->text); + strcat (message, buf); + } + strncat (message, "}", 1); + + /* Call all the callbacks with the message. */ + call_callbacks (obj, Ctcallback, message); + + return (TCL_OK); +} + + +/* widgetListTreeDelete -- Delete the specified item from a ListTree. + * + * Usage: listTreeDelete item [top] + * + * The 'item' may 'all' to delete the entire list or a named element. + * If 'toplevel' is specified then 'item' is assumed to be a child of + * that node. If 'children_only' is set then only the children of the + * specified item will be opened (applies to all/none only). The return + * message is a pair of lists of the form + * + * { value state } { parent1 parent2 ... } + * + * where the 'value' is the label of the item selected, 'state' is an int + * indicating whether the node is open or closed, and 'parentN' is a list + * of node names chaining back to the top level of the tree. + * + */ +static int +widgetListTreeDelete (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *top, *name; + ListTreeItem *item, *titem, *first; + + extern ListTreeItem *ListTreeFindSiblingName(); + extern ListTreeItem *ListTreeFindChildName(); + extern ListTreeItem *ListTreeFirstItem(); + + + if (argc < 2) + return (TCL_ERROR); + + name = argv[1]; + first = ListTreeFirstItem (wp->w); + + if (strcmp(argv[1], "all") == 0) { + if (argc == 3) { + top = argv[2]; + titem = ListTreeFindSiblingName (wp->w, first, top); + if (strcmp (top, titem->text) == 0) + item = titem; + else + item = ListTreeFindChildName (wp->w, titem, name); + + ListTreeDelete(wp->w, item); + + } else { + while ((item = ListTreeFirstItem(wp->w))) + ListTreeDelete (wp->w, item); + } + + } else { + if (argc == 3) { + top = argv[2]; + titem = ListTreeFindSiblingName (wp->w, first, top); + item = ListTreeFindChildName (wp->w, titem, name); + } else { + titem = ListTreeFindSiblingName (wp->w, first, name); + if (strcmp (name, titem->text) == 0) + item = titem; + else + item = ListTreeFindChildName (wp->w, titem, name); + } + + /* Now delete the item from the list. */ + ListTreeDelete(wp->w, item); + } + + + /* Call all the callbacks with the message. + call_callbacks (obj, Ctcallback, message); + */ + + return (TCL_OK); +} + + +/* widgetSetTable -- Set the contents of a Table widget. + * + * Usage: setTable nrows ncols data + * + * The table data is specified as a Tcl list of the form: + * + * { {r1c1 r1c2 ... r1cN} + * {r2c1 r2c2 ... r2cN} + * : + * {rNc1 rNc2 ... rNcN} } + * + * String values must be quoted, rows/cols will be truncated or cleared if + * the specified table size does not agree with the size of the data table + * being loaded. + * + */ +static int +widgetSetTable (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + + register int i, j; + int nrows, ncols, ndrows=0, ndcols=0, onrows, oncols; + char *list = NULL, **rows = NULL, **cols = NULL; + + + if (argc < 4) + return (TCL_ERROR); + + /* Get the arguments */ + nrows = atoi(argv[1]); + ncols = atoi(argv[2]); + list = argv[3]; + + /* Resize the table if needed. */ + XawTableGetSize (wp->w, &onrows, &oncols); + if (onrows != nrows || oncols != ncols) + XawTableSetNewSize (wp->w, nrows, ncols); + + /* Split the list so we can parse the rows. */ + if (Tcl_SplitList (tcl, list, &ndrows, &rows) != TCL_OK) + return (TCL_ERROR); + + /* Set the labels for the table. Clear any extra row or column + * labels in case we didn't get enough data, ignore extra data in + * the table if it's more than the size we're trying to create. + */ + for (i=0; i < ndrows; i++) { + if (Tcl_SplitList (tcl, rows[i], &ndcols, &cols) != TCL_OK) + return (TCL_ERROR); + + for (j=0; j < ndcols; j++) + XawTableSetLabel (wp->w, i, j, cols[j]); + } + + free ((char *) rows); + free ((char *) cols); + return (TCL_OK); +} + + +/* widgetGetCellAttr -- Get the given attribute of a Table cell. + * + * Usage: setGellAttr row col attribute value + * + * + * The cell position is given as a 1-indexed array element where the UL + * of the table is cell (1,1). Allowed attributes for a cell include: + * + * label label text (string) + * background background color (string) + * foreground foreground color (string) + * + */ +static int +widgetGetCellAttr (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + XrmValue from, to; + unsigned long bg, fg; + int row, col; + char *attr, *value; + + + if (argc < 4) + return (TCL_ERROR); + + row = atoi(argv[1]) - 1; + col = atoi(argv[2]) - 1; + attr = argv[3]; + + if (strcmp(attr, "label") == 0) + value = XawTableGetLabelByPosition (wp->w, row, col); + else + return (TCL_ERROR); + + Tcl_SetResult (wp->obm->tcl, value, TCL_VOLATILE); + return (TCL_OK); +} + + +/* widgetSetCellAttr -- Set the given attribute of a Table cell. + * + * Usage: setCellAttr row col attribute value + * + * + * The cell position is given as a 1-indexed array element where the UL + * of the table is cell (1,1). Allowed attributes for a cell include: + * + * label label text (string) + * background background color (string) + * foreground foreground color (string) + * + */ +static int +widgetSetCellAttr (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + XrmValue from, to; + unsigned long bg, fg; + int row, col; + char *attr, *value; + + + if (argc < 5) + return (TCL_ERROR); + + /* Get the arguments. */ + row = atoi(argv[1]) - 1; + col = atoi(argv[2]) - 1; + attr = argv[3]; + value = argv[4]; + + if (strcmp(attr, "label") == 0) { + XawTableSetLabel (wp->w, row, col, value); + + } else if (strcmp(attr, "background") == 0) { + from.size = strlen (value) + 1; + from.addr = value; + to.addr = (caddr_t) &bg; + to.size = sizeof(bg); + + if (!XtConvertAndStore (wp->w, XtRString, &from, XtRPixel, &to)) + bg = BlackPixelOfScreen (obm->screen); + + XawTableSetCellBackground (wp->w, row, col, bg); + + } else if (strcmp(attr, "foreground") == 0) { + from.size = strlen (value) + 1; + from.addr = value; + to.addr = (caddr_t) &fg; + to.size = sizeof(fg); + + if (!XtConvertAndStore (wp->w, XtRString, &from, XtRPixel, &to)) + fg = BlackPixelOfScreen (obm->screen); + + XawTableSetCellForeground (wp->w, row, col, fg); + } + + return (TCL_OK); +} + + +/* widgetSetColAttr -- Set the given attribute of a Table column. + * + * Usage: setColAttr col attribute value + * + * The column position is given as a 1-indexed array element where the UL + * of the table is cell (1,1). Allowed attributes for a column include: + * + * width column width (pixels) + * background background color (string) + * foreground foreground color (string) + * justify text justification (string) + * + */ +static int +widgetSetColAttr (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + XrmValue from, to; + unsigned long bg, fg; + int cols[128], widths[128]; + int nitems, row, col, nrows, ncols, i; + String *items; + char *attr; + + + if (argc < 4) + return (TCL_ERROR); + + /* Get the arguments. NOTE: need to bounds check the length of the + * list with the array. + */ + if (Tcl_SplitList (tcl, argv[1], &nitems, &items) != TCL_OK) + return (TCL_ERROR); + else { + if (nitems == 1) + col = atoi(argv[1]) - 1; + else { + if (nitems > 128) + return (TCL_ERROR); + for (i=0; i < nitems; i++) + cols[i] = atoi(items[i]) - 1; + } + } + attr = argv[2]; + + /* Get current table size. */ + XawTableGetSize (wp->w, &nrows, &ncols); + + if (strcmp(attr, "width") == 0) { + /* Reset the column width. */ + if (nitems == 1) + XawTableSetColumnWidth (wp->w, col, atoi(argv[3])); + else { + if (Tcl_SplitList (tcl, argv[3], &nitems, &items) != TCL_OK) + return (TCL_ERROR); + if (nitems > 128) + return (TCL_ERROR); + for (i=0; i < nitems; i++) + widths[i] = atoi(items[i]) - 1; + XawTableSetMultiColumnWidths (wp->w, cols, widths, nitems); + } + + } else if (strcmp(attr, "background") == 0) { + /* Reset the column background color. */ + from.size = strlen (argv[3]) + 1; + from.addr = argv[3]; + to.addr = (caddr_t) &bg; + to.size = sizeof(bg); + + if (!XtConvertAndStore (wp->w, XtRString, &from, XtRPixel, &to)) + bg = BlackPixelOfScreen (obm->screen); + + for (i=0; i < nrows; i++) + XawTableSetCellBackground (wp->w, i, col, bg); + + } else if (strcmp(attr, "foreground") == 0) { + /* Reset the column foreground color. */ + from.size = strlen (argv[3]) + 1; + from.addr = argv[3]; + to.addr = (caddr_t) &fg; + to.size = sizeof(fg); + + if (!XtConvertAndStore (wp->w, XtRString, &from, XtRPixel, &to)) + fg = BlackPixelOfScreen (obm->screen); + + for (i=0; i < nrows; i++) + XawTableSetCellForeground (wp->w, i, col, fg); + + } else if (strcmp(attr, "justify") == 0) { + /* Reset the column text justification. */ + if (strcmp(argv[3], "left") == 0) + XawTableSetColumnJustify (wp->w, col, XtJustifyLeft); + else if (strcmp(argv[3], "center") == 0) + XawTableSetColumnJustify (wp->w, col, XtJustifyCenter); + else if (strcmp(argv[3], "right") == 0) + XawTableSetColumnJustify (wp->w, col, XtJustifyRight); + else + XawTableSetColumnJustify (wp->w, col, XtJustifyLeft); + } + + return (TCL_OK); +} + + +/* widgetGetColAttr -- Get the requested attribute of a Table column. + * + * Usage: attr = getColAttr col attribute + * + * + * The column position is given as a 1-indexed array element where the UL + * of the table is cell (1,1). Allowed attributes for a column include: + * + * width column width + * pixelWidth foreground color + * justify text justification + * + */ +static int +widgetGetColAttr (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char rbuf[SZ_MESSAGE]; + char *result = rbuf, *attr; + int col, nrows, ncols, width, pixelWidth; + XtJustify justify; + + + if (argc < 3) + return (TCL_ERROR); + + /* Get the arguments. */ + col = atoi(argv[1]) - 1; + attr = argv[2]; + + /* Get current table size. */ + XawTableGetSize (wp->w, &nrows, &ncols); + + if (strcmp(attr, "width") == 0) { + width = XawTableGetColumnWidth (wp->w, col); + + } else if (strcmp(attr, "pixelWidth") == 0) { + pixelWidth = XawTableGetColumnPixelWidth (wp->w, col); + + } else if (strcmp(attr, "justify") == 0) { + justify = XawTableGetColumnJustify (wp->w, col); + + /* Reset the column text justification. */ + if (justify == XtJustifyLeft) + strcpy (result, "left"); + else if (justify == XtJustifyCenter) + strcpy (result, "center"); + else if (justify == XtJustifyRight) + strcpy (result, "right"); + else + strcpy (result, "left"); + } + + Tcl_SetResult (wp->obm->tcl, result, TCL_VOLATILE); + return (TCL_OK); +} + + +/* widgetSetRowAttr -- Set the given attribute of a Table row. + * + * Usage: setRowAttr row attribute value + * + * The row position is given as a 1-indexed array element where the UL + * of the table is cell (1,1). Allowed attributes for a row include: + * + * background background color + * foreground foreground color + */ +static int +widgetSetRowAttr (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + XrmValue from, to; + unsigned long bg, fg; + int row, col, nrows, ncols, i; + char *attr; + + + if (argc < 4) + return (TCL_ERROR); + + /* Get the arguments. */ + row = atoi(argv[1]) - 1; + attr = argv[2]; + + /* Get current table size. */ + XawTableGetSize (wp->w, &nrows, &ncols); + + if (strcmp(attr, "background") == 0) { + /* Reset the column background color. */ + from.size = strlen (argv[3]) + 1; + from.addr = argv[3]; + to.addr = (caddr_t) &bg; + to.size = sizeof(bg); + + if (!XtConvertAndStore (wp->w, XtRString, &from, XtRPixel, &to)) + bg = BlackPixelOfScreen (obm->screen); + + for (i=0; i < ncols; i++) + XawTableSetCellBackground (wp->w, row, i, bg); + + } else if (strcmp(attr, "foreground") == 0) { + /* Reset the column foreground color. */ + from.size = strlen (argv[3]) + 1; + from.addr = argv[3]; + to.addr = (caddr_t) &fg; + to.size = sizeof(fg); + + if (!XtConvertAndStore (wp->w, XtRString, &from, XtRPixel, &to)) + fg = BlackPixelOfScreen (obm->screen); + + for (i=0; i < ncols; i++) + XawTableSetCellForeground (wp->w, row, i, fg); + } + + return (TCL_OK); +} + + +/* widgetGetRowAttr -- Get the requested attribute of a Table column. + * + * Usage: attr = getRowAttr row attribute + * + * + * The column position is given as a 1-indexed array element where the UL + * of the table is cell (1,1). Allowed attributes for a column include: + * + * <none yet> + * + */ +static int +widgetGetRowAttr (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char rbuf[SZ_MESSAGE]; + char *result = rbuf, *attr; + int row, nrows, ncols, width, pixelWidth; + XtJustify justify; + + + if (argc < 3) + return (TCL_ERROR); + + /* Get the arguments. */ + row = atoi(argv[1]) - 1; + attr = argv[2]; + + /* Get current table size. */ + XawTableGetSize (wp->w, &nrows, &ncols); + + return (TCL_OK); +} + + +/* widgetDeleteCol -- Delete the specified columns from the table. + * + * Usage: deleteCol column + * + */ +static int +widgetDeleteCol (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + int col; + + + if (argc < 2) + return (TCL_ERROR); + + /* Get the arguments. */ + col = atoi(argv[1]) - 1; + + /* Delete the specified row. */ + XawTableDeleteColumn (wp->w, col); + + return (TCL_OK); +} + + +/* widgetAddCol -- Add a new column to the Table. + * + * Usage: addCol col width + * + * The column may be specified in one of the following ways: + * + * first make column the first column in the table + * last make column the last column in the table + * <num> make column the N-th column in the table + * + * The column width is specified as a character width. Data for the + * column must be added separately using the setColAttr function to + * set individual labels. + * + */ +static int +widgetAddCol (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *col = NULL; + int nrows, ncols, width, colnum = 0; + + + if (argc < 3) + return (TCL_ERROR); + + /* Get the arguments. */ + col = argv[1]; + width = atoi(argv[2]); + + /* Add the specified column. */ + XawTableGetSize (wp->w, &nrows, &ncols); + colnum = max (0, min (ncols, atoi (col) - 1)); + + if (colnum == 0 || streq(col, "first")) + XawTablePrependColumn (wp->w, width); + else if (colnum == ncols || streq (col, "last")) + XawTableAppendColumn (wp->w, width); + else + XawTableInsertColumn (wp->w, colnum, width); + + return (TCL_OK); +} + + +/* widgetDeleteRow -- Delete the specified rows from the table. + * + * Usage: deleteRow row + * + */ +static int +widgetDeleteRow (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + int row; + + + if (argc < 2) + return (TCL_ERROR); + + /* Get the arguments. */ + row = atoi(argv[1]) - 1; + + /* Delete the specified row. */ + XawTableDeleteRow (wp->w, row); + + return (TCL_OK); +} + + +/* widgetAddRow -- Add a new row to the Table. + * + * Usage: addRow row + * + * The row may be specified in one of the following ways: + * + * first make row the first row in the table + * last make row the last row in the table + * <num> make row the N-th row in the table + * + * Data for the column must be added separately using the setColAttr + * function to set individual labels. + * + */ +static int +widgetAddRow (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char *row = NULL; + int nrows, ncols, rownum = 0; + + + if (argc < 2) + return (TCL_ERROR); + + /* Get the arguments. */ + row = argv[1]; + + /* Add the specified column. */ + XawTableGetSize (wp->w, &nrows, &ncols); + rownum = max (0, min (nrows, atoi (row) - 1)); + + if (rownum == 0 || streq(row, "first")) + XawTablePrependRow (wp->w); + else if (rownum == nrows || streq (row, "last")) + XawTableAppendRow (wp->w); + else + XawTableInsertRow (wp->w, rownum); + + return (TCL_OK); +} + + +/* widgetSetTableSize -- Set the size of the specified table. + * + * Usage: setTableSize nrows ncols + * + */ +static int +widgetSetTableSize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + int nrows, ncols; + + + if (argc < 3) + return (TCL_ERROR); + + nrows = atoi (argv[1]); + ncols = atoi (argv[2]); + if (XawTableSetNewSize (wp->w, nrows, ncols) >= 0) + return (TCL_OK); + else + return (TCL_ERROR); +} + + + +/* widgetGetTableSize -- Get the size of the specified table. + * + * Usage: getTableSize nrows ncols + * + */ +static int +widgetGetTableSize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char buf[16], *nrows, *ncols; + int nr, nc; + + + if (argc < 3) + return (TCL_ERROR); + + nrows = argv[1]; + ncols = argv[2]; + + XawTableGetSize (wp->w, &nr, &nc); + + sprintf (buf, "%d", nr); + Tcl_SetVar (wp->obm->tcl, nrows, buf, 0); + sprintf (buf, "%d", nc); + Tcl_SetVar (wp->obm->tcl, ncols, buf, 0); + + return (TCL_OK); +} + + + +/* widgetRealize -- Realize a widget. This activates and assigns windows for + * a widget and all of its descendants. Realizing a widget does not in itself + * cause it to appear on the screen. + * + * Usage: realize + */ +static int +widgetRealize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + + XtRealizeWidget (wp->w); + return (TCL_OK); +} + + +/* widgetUnrealize -- Unrealize a widget. This destroys the windows assigned + * to a widget and all of its descendants. + * + * Usage: unrealize + */ +static int +widgetUnrealize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + + XtUnrealizeWidget (wp->w); + return (TCL_OK); +} + + +/* widgetIsRealized -- Test whether a widget is realized. + * + * Usage: isRealized + */ +static int +widgetIsRealized (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Boolean sensitive; + + if (XtIsRealized (wp->w)) + Tcl_SetResult (wp->obm->tcl, TRUESTR, TCL_STATIC); + else + Tcl_SetResult (wp->obm->tcl, FALSESTR, TCL_STATIC); + return (TCL_OK); +} + + +/* widgetMap -- Map a widget. + * + * Usage: map + */ +static int +widgetMap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + + XtRealizeWidget (wp->w); + XtMapWidget (wp->w); + return (TCL_OK); +} + + +/* widgetUnmap -- Unmap a widget. + * + * Usage: unmap + */ +static int +widgetUnmap (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + Widget w = wp->w; + + if (!XtIsRealized(w) || !XtWindow(w)) + return (TCL_ERROR); + + XmuUpdateMapHints (obm->display, XtWindow(w), NULL); + XWithdrawWindow (obm->display, XtWindow(w), + XScreenNumberOfScreen(obm->screen)); + + return (TCL_OK); +} + + +/* widgetManage -- Manage a list of child widgets. These should share the + * same common parent, a geometry widget of some sort. Managing the + * children makes them appear in the window, possibly causing the other + * children to be rearranged in the window. + * + * Usage: manage child [child ...] + * + * This message should be sent to the geometry widget which is the parent + * of the children. + */ +static int +widgetManage (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Widget w, children[512]; + int nchildren, i; + + for (i=1, nchildren=0; i < argc; i++) + if (w = XtNameToWidget (wp->w, argv[i])) + children[nchildren++] = w; + + XtManageChildren (children, nchildren); + return (TCL_OK); +} + + +/* widgetUnmanage -- Unmanage a list of child widgets. These should share the + * same common parent, a geometry widget of some sort. Unmanaging the + * children makes them disappear from the window and be removed from geometry + * management, possibly causing the other children to be rearranged in the + * window. + * + * Usage: unmanage child [child ...] + * + * This message should be sent to the geometry widget which is the parent + * of the children. + */ +static int +widgetUnmanage (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Widget w, children[512]; + int nchildren, i; + + for (i=1, nchildren=0; i < argc; i++) + if (w = XtNameToWidget (wp->w, argv[i])) + children[nchildren++] = w; + + XtUnmanageChildren (children, nchildren); + return (TCL_OK); +} + + +/* widgetPopup -- Popup a shell widget. If no grab is indicated the popup + * can remain up while other windows accept input. + * + * Usage: popup [grab-kind] + */ +static int +widgetPopup (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + XtGrabKind grab; + + grab = XtGrabNone; + if (argc >= 2) { + if (strcmp (argv[1], "GrabNone") == 0) + grab = XtGrabNone; + else if (strcmp (argv[1], "GrabNonexclusive") == 0) + grab = XtGrabNonexclusive; + else if (strcmp (argv[1], "GrabExclusive") == 0) + grab = XtGrabExclusive; + } + + XtPopup (wp->w, grab); + return (TCL_OK); +} + + +/* widgetPopdown -- Popdown a shell widget. + * + * Usage: popdown + */ +static int +widgetPopdown (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + + XtPopdown (wp->w); + return (TCL_OK); +} + + +/* widgetPopupSpringLoaded -- Popup a shell widget, e.g., a popup menu. + * This implies an exclusive grab. + * + * Usage: popupSpringLoaded + */ +static int +widgetPopupSpringLoaded (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + + XtPopupSpringLoaded (wp->w); + return (TCL_OK); +} + + +/* widgetMove -- Move a widget to the given window relative coordinates. + * + * Usage: move x y + */ +static int +widgetMove (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Arg args[10]; int nargs=0; + + if (argc < 3) + return (TCL_ERROR); + + XtSetArg (args[nargs], XtNx, atoi(argv[1])); nargs++; + XtSetArg (args[nargs], XtNy, atoi(argv[2])); nargs++; + + XtSetValues (wp->w, args, nargs); + + return (TCL_OK); +} + + +/* widgetResize -- Resize a widget. + * + * Usage: resize width height [border-width] + */ +static int +widgetResize (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Arg args[10]; int nargs=0; + + if (argc < 3) + return (TCL_ERROR); + + XtSetArg (args[nargs], XtNwidth, atoi(argv[1])); nargs++; + XtSetArg (args[nargs], XtNheight, atoi(argv[2])); nargs++; + if (argc > 3) { + XtSetArg (args[nargs], XtNborderWidth, atoi(argv[3])); + nargs++; + } + + XtSetValues (wp->w, args, nargs); + + return (TCL_OK); +} + + +/* widgetConfigure -- Configure a widget, i.e., execute a simultaneous + * move and resize. + * + * Usage: configure x y width height [border-width] + */ +static int +widgetConfigure (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Arg args[10]; int nargs=0; + + if (argc < 3) + return (TCL_ERROR); + + XtSetArg (args[nargs], XtNx, atoi(argv[1])); nargs++; + XtSetArg (args[nargs], XtNy, atoi(argv[2])); nargs++; + XtSetArg (args[nargs], XtNwidth, atoi(argv[3])); nargs++; + XtSetArg (args[nargs], XtNheight, atoi(argv[4])); nargs++; + if (argc > 5) { + XtSetArg (args[nargs], XtNborderWidth, atoi(argv[5])); + nargs++; + } + + XtSetValues (wp->w, args, nargs); + + return (TCL_OK); +} + + +/* widgetParseGeometry -- Compute the position and size of a region within + * a window , given a user defined geometry and a default geometry. + * + * Usage: parseGeometry user_geom def_geom x y width height + * + * Geometries are specified as in X, e.g. 123x456+5-5. The default geometry + * must be fully specified. + */ +static int +widgetParseGeometry (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + + register int uflags, dflags; + Dimension winWidth, winHeight; + int need, x, y, width, height; + char *user_geom, *def_geom; + char *s_x, *s_y, *s_width, *s_height; + unsigned int u_width, u_height; + unsigned int d_width, d_height; + int u_x, u_y, d_x, d_y; + char buf[SZ_NUMBER]; + + if (argc != 7) + return (TCL_ERROR); + + user_geom = argv[1]; + def_geom = argv[2]; + s_x = argv[3]; + s_y = argv[4]; + s_width = argv[5]; + s_height = argv[6]; + + XtVaGetValues (wp->w, + XtNwidth, &winWidth, + XtNheight, &winHeight, + NULL); + + /* Parse the default geometry. */ + dflags = XParseGeometry (def_geom, &d_x, &d_y, &d_width, &d_height); + need = (XValue | YValue | WidthValue | HeightValue); + if ((dflags & need) != need) { + Tcl_SetResult (obm->tcl, + "default geometry not fully qualified", TCL_VOLATILE); + return (TCL_ERROR); + } + + /* Parse the user supplied geometry. */ + uflags = XParseGeometry (user_geom, &u_x, &u_y, &u_width, &u_height); + + /* Compute the final geometry. This is constrained to fit within + * the given window. + */ + width = (uflags & WidthValue) ? u_width : d_width; + width = max(0, min((int)winWidth, width)); + + height = (uflags & HeightValue) ? u_height : d_height; + height = max(0, min((int)winHeight, height)); + + if (uflags & XValue) + x = (uflags & XNegative) ? winWidth + u_x - width : u_x; + else + x = (dflags & XNegative) ? winWidth + d_x - width : d_x; + x = max(0, min((int)winWidth-width, x)); + + if (uflags & YValue) + y = (uflags & YNegative) ? winHeight + u_y - height : u_y; + else + y = (dflags & YNegative) ? winHeight + d_y - height : d_y; + y = max(0, min((int)winHeight-height, y)); + + /* Output the results. + */ + sprintf (buf, "%d", x); + if ((Tcl_SetVar (obm->tcl, s_x, buf, 0)) == NULL) + return (TCL_ERROR); + sprintf (buf, "%d", y); + if ((Tcl_SetVar (obm->tcl, s_y, buf, 0)) == NULL) + return (TCL_ERROR); + sprintf (buf, "%d", width); + if ((Tcl_SetVar (obm->tcl, s_width, buf, 0)) == NULL) + return (TCL_ERROR); + sprintf (buf, "%d", height); + if ((Tcl_SetVar (obm->tcl, s_height, buf, 0)) == NULL) + return (TCL_ERROR); + + return (TCL_OK); +} + + +/* widgetGetGeometry -- Given a subregion within a rectangular window compute + * the geometry specification which best describes the region. + * + * Usage: geom = getGeometry x y width height [nogravity] + * + * If gravity is enabled (the default) and the rect is near an edge or corner + * the specified geometry will be in the form -X-Y to cause the region to + * track the edge or corner of the window. Otherwise the absolute coordinates + * of the region are returned. + */ +static int +widgetGetGeometry (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + + register char *op; + Dimension winWidth, winHeight; + int dist, gravity, x, y, width, height; + char buf[128]; + + if (argc < 5) + return (TCL_ERROR); + + x = atoi(argv[1]); + y = atoi(argv[2]); + width = atoi(argv[3]); + height = atoi(argv[4]); + gravity = (argc < 6 || strncmp(argv[5],"no",2) != 0); + + XtVaGetValues (wp->w, + XtNwidth, &winWidth, + XtNheight, &winHeight, + NULL); + + sprintf (buf, "%dx%d", width, height); + for (op=buf; *op; ) + op++; + + if (gravity && (dist = winWidth - (x + width)) < 10) + sprintf (op, "-%d", dist); + else + sprintf (op, "+%d", x); + while (*op) + op++; + + if (gravity && (dist = winHeight - (y + height)) < 10) + sprintf (op, "-%d", dist); + else + sprintf (op, "+%d", y); + + Tcl_SetResult (wp->obm->tcl, buf, TCL_VOLATILE); + return (TCL_OK); +} + + +/* widgetSetSensitive -- Set the sensitivity of a widget. + * + * Usage: setSensitive <sensitive> + */ +static int +widgetSetSensitive (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Boolean sensitive; + + sensitive = FALSE; + if (argc >= 2) + if (strcmp (argv[1], "true") == 0 || + strcmp (argv[1], "True") == 0 || + strcmp (argv[1], "TRUE") == 0 || + strcmp (argv[1], "1") == 0) { + + sensitive = TRUE; + } + + XtSetSensitive (wp->w, sensitive); + return (TCL_OK); +} + + +/* widgetIsSensitive -- Test the sensitivity of a widget. + * + * Usage: isSensitive + */ +static int +widgetIsSensitive (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + WidgetPrivate wp = &obj->widget; + Boolean sensitive; + + if (XtIsSensitive (wp->w)) + Tcl_SetResult (wp->obm->tcl, TRUESTR, TCL_STATIC); + else + Tcl_SetResult (wp->obm->tcl, FALSESTR, TCL_STATIC); + + return (TCL_OK); +} + + +/* + * Event handling facility. + */ + +/* Event masks. */ +#define NonMaskable 0 +struct evMask { + char *name; + int mask; +} eventMasks[] = { + { "nonMaskable", NonMaskable }, + { "button1MotionMask", Button1MotionMask }, + { "button2MotionMask", Button2MotionMask }, + { "button3MotionMask", Button3MotionMask }, + { "button4MotionMask", Button4MotionMask }, + { "button5MotionMask", Button5MotionMask }, + { "buttonMotionMask", ButtonMotionMask }, + { "buttonPressMask", ButtonPressMask }, + { "buttonReleaseMask", ButtonReleaseMask }, + { "colormapChangeMask", ColormapChangeMask }, + { "enterWindowMask", EnterWindowMask }, + { "exposureMask", ExposureMask }, + { "focusChangeMask", FocusChangeMask }, + { "keyPressMask", KeyPressMask }, + { "keyReleaseMask", KeyReleaseMask }, + { "keymapStateMask", KeymapStateMask }, + { "leaveWindowMask", LeaveWindowMask }, + { "noEventMask", NoEventMask }, + { "ownerGrabButtonMask", OwnerGrabButtonMask }, + { "pointerMotionHintMask", PointerMotionHintMask }, + { "pointerMotionMask", PointerMotionMask }, + { "propertyChangeMask", PropertyChangeMask }, + { "resizeRedirectMask", ResizeRedirectMask }, + { "structureNotifyMask", StructureNotifyMask }, + { "substructureNotifyMask", SubstructureNotifyMask }, + { "substructureRedirectMask", SubstructureRedirectMask }, + { "visibilityChangeMask", VisibilityChangeMask }, +}; + +/* Event types. */ +struct evType { + char *name; + int type; +} eventTypes[] = { + { "buttonPress", ButtonPress }, + { "buttonRelease", ButtonRelease }, + { "circulateNotify", CirculateNotify }, + { "circulateRequest", CirculateRequest }, + { "clientMessage", ClientMessage }, + { "colormapNotify", ColormapNotify }, + { "configureNotify", ConfigureNotify }, + { "configureRequest", ConfigureRequest }, + { "createNotify", CreateNotify }, + { "destroyNotify", DestroyNotify }, + { "enterNotify", EnterNotify }, + { "expose", Expose }, + { "focusIn", FocusIn }, + { "focusOut", FocusOut }, + { "graphicsExpose", GraphicsExpose }, + { "gravityNotify", GravityNotify }, + { "keyPress", KeyPress }, + { "keyRelease", KeyRelease }, + { "keymapNotify", KeymapNotify }, + { "leaveNotify", LeaveNotify }, + { "mapNotify", MapNotify }, + { "mapRequest", MapRequest }, + { "mappingNotify", MappingNotify }, + { "motionNotify", MotionNotify }, + { "noExpose", NoExpose }, + { "propertyNotify", PropertyNotify }, + { "reparentNotify", ReparentNotify }, + { "resizeRequest", ResizeRequest }, + { "selectionClear", SelectionClear }, + { "selectionNotify", SelectionNotify }, + { "selectionRequest", SelectionRequest }, + { "unmapNotify", UnmapNotify }, + { "visibilityNotify", VisibilityNotify }, +}; + + +/* widgetAddEventHandler -- Add a custom event handler to a widget. A list + * of event masks is given to define the classes of events the user supplied + * event handling procedure is to receive. + * + * Usage: addEventHandler <procname> <event-mask> [<event-mask>...] + */ +static int +widgetAddEventHandler (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + ObmCallback cb, new_cb; + int event_mask, i, j; + Boolean nonmaskable; + + if (argc < 3) + return (TCL_ERROR); + + event_mask = 0; + nonmaskable = FALSE; + + /* Get the event mask. */ + for (j=2; j < argc; j++) { + for (i=0; i < XtNumber(eventMasks); i++) { + if (strcmp (eventMasks[i].name, argv[j]) == 0) { + if (eventMasks[i].mask == NonMaskable) + nonmaskable = TRUE; + else + event_mask |= eventMasks[i].mask; + break; + } + } + } + + /* Create event handler record. */ + new_cb = (ObmCallback) XtCalloc (1, sizeof (obmCallback)); + strcpy (new_cb->name, argv[1]); + new_cb->u.obj = (ObmObject) obj; + new_cb->client_data = (XtPointer) event_mask; + + /* Add record to tail of event handler list. */ + if (wp->event_handler) { + for (cb = wp->event_handler; cb->next; cb = cb->next) + ; + cb->next = new_cb; + } else + wp->event_handler = new_cb; + + /* Post event handler. */ + XtAddEventHandler (wp->w, event_mask, nonmaskable, widgetEvent, new_cb); + + return (TCL_OK); +} + +/* widgetRemoveEventHandler -- Remove an event handler previously posted + * with addEventHandler, above. + * + * Usage: removeEventHandler procname + */ +static int +widgetRemoveEventHandler (msg, tcl, argc, argv) +MsgContext msg; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + WidgetObject obj = (WidgetObject) msg->object[msg->level]; + register WidgetPrivate wp = &obj->widget; + register ObmContext obm = wp->obm; + register ObmCallback cb, pcb; + Boolean nonmaskable; + char *procname; + + if (argc < 2) + return (TCL_ERROR); + + procname = argv[1]; + nonmaskable = False; + + for (cb = wp->event_handler, pcb=NULL; cb; pcb=cb, cb = cb->next) + if (strcmp (cb->name, procname) == 0) + break; + + if (cb) { + XtRemoveEventHandler (wp->w, (int) cb->client_data, nonmaskable, + widgetEvent, cb); + if (pcb) + pcb->next = cb->next; + else + wp->event_handler = NULL; + XtFree ((char *)cb); + } + + return (TCL_OK); +} + + +/* widgetEvent -- Generic event handler called when a widget event handler + * posted by addEventHandler is called. + * + * The user event handler is called as + * + * userEventHandler widget event-type time wx wy rx ry other + * + * where "other" is an event-type specific list of fields describing the + * the event. + */ +static void +widgetEvent (w, cb, event, continue_to_dispatch) +Widget w; +ObmCallback cb; +XEvent *event; +Boolean *continue_to_dispatch; +{ + WidgetObject obj = (WidgetObject) cb->u.obj; + WidgetPrivate wp = &obj->widget; + ObmContext obm = wp->obm; + char cmd[SZ_COMMAND]; + register char *ip, *op; + register int i, j; + int status; + + /* Our job is to translate the X event into a call to a widget server + * procedure. Start with the callback procedure name. + */ + for (ip = cb->name, op=cmd; *ip; ) + *op++ = *ip++; + *op++ = ' '; + + /* Add the name of the widget that received the event. */ + for (ip = obj->core.name; *ip; ) + *op++ = *ip++; + *op++ = ' '; + + /* Add the event type. */ + for (i=0; i < XtNumber(eventTypes); i++) { + if (eventTypes[i].type == event->type) { + for (ip = eventTypes[i].name; *ip; ) + *op++ = *ip++; + *op++ = ' '; + break; + } + + /* Ignore events we don't know anything about. */ + if (i >= XtNumber(eventTypes)) + return; + } + + /* Add the event specific fields. */ + switch (event->type) { + case KeyPress: + case KeyRelease: + { XKeyPressedEvent *ev = (XKeyPressedEvent *) event; + char buf[20]; + int n; + + sprintf (op, "%u %d %d %d %d ", + ev->time, ev->x, ev->y, ev->x_root, ev->y_root); + while (*op) op++; + + *op++ = '{'; + if ((n = XLookupString(ev,buf,sizeof(buf),NULL,NULL)) > 0) { + for (ip=buf; --n >= 0; ) + if (*ip <= ' ') { + *op++ = '^'; + *op++ = *ip++ + 'A' - 1; + } else if (isprint (*ip)) { + *op++ = *ip++; + } else + ip++; + } else { + /* This case occurs when only a modifier is typed. */ + for (ip = "??"; *op++ = *ip++; ) + ; + } + *op++ = ' '; + op = widgetEventState (op, ev->state); + while (op > cmd && isspace (*(op-1))) + --op; + *op++ = '}'; + } + break; + + case ButtonPress: + case ButtonRelease: + { XButtonPressedEvent *ev = (XButtonPressedEvent *) event; + + sprintf (op, "%u %d %d %d %d ", + ev->time, ev->x, ev->y, ev->x_root, ev->y_root); + while (*op) op++; + + *op++ = '{'; + sprintf (op, "%d ", ev->button); while (*op) op++; + op = widgetEventState (op, ev->state); + while (op > cmd && isspace (*(op-1))) + --op; + *op++ = '}'; + } + break; + + case KeymapNotify: + { XKeymapEvent *ev = (XKeymapEvent *) event; + KeySym keysym; + + sprintf (op, "0 0 0 0 0 "); + while (*op) op++; + + *op++ = '{'; + for (j=0; j < 32; j++) { + for (i=0; i < 8; i++) + if ((ev->key_vector[j]) & (1 << i)) { + keysym = XKeycodeToKeysym (obm->display, + j * 8 + i, 0); + if (ip = XKeysymToString (keysym)) { + while (*ip) + *op++ = *ip++; + *op++ = ' '; + } + } + } + *op++ = '}'; + } + break; + + case MotionNotify: + case EnterNotify: + case LeaveNotify: + { XPointerMovedEvent *ev = (XPointerMovedEvent *) event; + + sprintf (op, "%u %d %d %d %d ", + ev->time, ev->x, ev->y, ev->x_root, ev->y_root); + while (*op) op++; + + *op++ = '{'; + op = widgetEventState (op, ev->state); + while (op > cmd && isspace (*(op-1))) + --op; + *op++ = '}'; + } + break; + + case FocusIn: + case FocusOut: + { XFocusChangeEvent *ev = (XFocusChangeEvent *) event; + + sprintf (op, "0 0 0 0 0 "); + while (*op) op++; + } + break; + + case Expose: + { XExposeEvent *ev = (XExposeEvent *) event; + + sprintf (op, "0 %d %d 0 0 ", ev->x, ev->y); + while (*op) op++; + + *op++ = '{'; + sprintf (op, "%d ", ev->width); while (*op) op++; + sprintf (op, "%d ", ev->height); while (*op) op++; + sprintf (op, "%d ", ev->count); while (*op) op++; + *op++ = '}'; + } + break; + + case GraphicsExpose: + { XGraphicsExposeEvent *ev = (XGraphicsExposeEvent *) event; + + sprintf (op, "0 %d %d 0 0 ", ev->x, ev->y); + while (*op) op++; + + *op++ = '{'; + sprintf (op, "%d ", ev->width); while (*op) op++; + sprintf (op, "%d ", ev->height); while (*op) op++; + sprintf (op, "%d ", ev->count); while (*op) op++; + *op++ = '}'; + } + break; + + case NoExpose: + case ColormapNotify: + case PropertyNotify: + case VisibilityNotify: + case ResizeRequest: + case CirculateNotify: + case ConfigureNotify: + case CreateNotify: + case DestroyNotify: + case GravityNotify: + case MapNotify: + case MappingNotify: + case ReparentNotify: + case SelectionNotify: + case UnmapNotify: + { + sprintf (op, "0 0 0 0 0 "); + while (*op) op++; + } + break; + + case CirculateRequest: + case ConfigureRequest: + case MapRequest: + case SelectionRequest: + { + sprintf (op, "0 0 0 0 0 "); + while (*op) op++; + } + break; + + + case ClientMessage: + case SelectionClear: + { + sprintf (op, "0 0 0 0 0 "); + while (*op) op++; + } + break; + } + *op = '\0'; + + /* Call the user supplied event handler. */ + status = Tcl_Eval (obm->tcl, cmd); + if (status != TCL_OK) { + fprintf (stderr, "Error on line %d of %s: %s\n", + obm->tcl->errorLine, cb->name, obm->tcl->result); + } +} + + +/* widgetEventState -- Encode the "state" field of an event struct. + */ +char * +widgetEventState (op, state) +register char *op; +unsigned int state; +{ + if (state & ShiftMask) + { sprintf (op, "shift "); while (*op) op++; } + if (state & LockMask) + { sprintf (op, "lock "); while (*op) op++; } + if (state & ControlMask) + { sprintf (op, "control "); while (*op) op++; } + if (state & Mod1Mask) + { sprintf (op, "mod1 "); while (*op) op++; } + if (state & Mod2Mask) + { sprintf (op, "mod2 "); while (*op) op++; } + if (state & Mod3Mask) + { sprintf (op, "mod3 "); while (*op) op++; } + if (state & Mod4Mask) + { sprintf (op, "mod4 "); while (*op) op++; } + if (state & Mod5Mask) + { sprintf (op, "mod5 "); while (*op) op++; } + + *op = '\0'; + return (op); +} + + + +/* widgetGetFontName -- Encode the font name in a string in XLFD format. + */ + +#define SZ_FONT_NAME 128 + +static char * +widgetGetFontName (display, fs) /* MF016 */ +Display *display; +XFontStruct *fs; +{ + register int i; + unsigned long val; + char *name = (char *) malloc (SZ_FONT_NAME), *str, *lp; + + name[0] = '\0'; + if (fs) { + for (i=0; i < NUMITEMS(fontNamePropTable); i++) { + fontNamePropTable[i].atom = + XInternAtom(display, fontNamePropTable[i].name, 0); + if (XGetFontProperty (fs, fontNamePropTable[i].atom, &val)) { + switch (fontNamePropTable[i].type) { + case atom: + str = XGetAtomName (display, (Atom)val); + for (lp=str; *lp; lp++) + if (isupper(*lp)) + *lp = tolower(*lp); + strcat (name, str); + XFree (str); + break; + + case pixel_size: + case point_size: + case resolution: + case resolution_x: + case resolution_y: + case average_width: + case scaledX: + case scaledY: + case unscaled: + case scaledXoverY: + case uncomputed: + sprintf(name, "%s%d", name, val); + break; + } + } else + strcat(name, "*"); + + if (i != (NUMITEMS(fontNamePropTable)-1)) + strcat(name, "-"); + } + } + + return (name); +} diff --git a/vendor/x11iraf/obm/widget.h b/vendor/x11iraf/obm/widget.h new file mode 100644 index 00000000..ffaef86a --- /dev/null +++ b/vendor/x11iraf/obm/widget.h @@ -0,0 +1,47 @@ +/* Copyright(c) 1993 Association of Universities for Research in Astronomy Inc. + */ + +/* + * WIDGET.H -- Widget class public definitions (used to subclass widgets). + * These definitions are intended for use only by Widget subclasses, not by + * client applications. + */ + +struct widgetPrivate { + Widget w; + ObmContext obm; + ObmCallback callback; + ObmCallback event_handler; + Boolean widget_destroyed; + XawTextPosition text_pos; + XtCallbackProc response_cb; + int text_newline; + char translation_table_name[SZ_NAME]; + char *data; + int datalen; +}; + +typedef struct widgetPrivate *WidgetPrivate; + +struct widgetObject { + struct obmObjectCore core; + struct widgetPrivate widget; +}; + +typedef struct widgetObject *WidgetObject; + +/* Object message context. */ +struct msgContext { + Tcl_Interp *tcl; /* class interpreter */ + ObmObject object[MAX_LEVELS]; /* object which received last message */ + int level; +}; +typedef struct msgContext *MsgContext; + +extern int WidgetEvaluate(); +extern void WidgetDestroy(); +extern void WidgetClassDestroy(); +extern ObmObject WidgetCreate(); +extern WidgetObject widgetToObject(); +extern int coordType(); +extern char *widgetEventState(); diff --git a/vendor/x11iraf/obmsh/.gdb_history b/vendor/x11iraf/obmsh/.gdb_history new file mode 100644 index 00000000..1dbd3323 --- /dev/null +++ b/vendor/x11iraf/obmsh/.gdb_history @@ -0,0 +1,58 @@ +run puzzle +where +quit +run puzzle +list +p argc +p argv +quit +run puzzle +quit +run +dump +? +help +b main +run +p argc +p *argc +quit +run +where +list +p argc +b main +run +p argc +p argv +p *argv +quit +run +where +p argc +quit +run +quit +help trace +help tracepoints +help +help stack +help status +run puzzle +info +info frame +where +up +where +bt +s +where +quit +run +quit +run +quit +run +quit +run puzzle +quit diff --git a/vendor/x11iraf/obmsh/Imakefile b/vendor/x11iraf/obmsh/Imakefile new file mode 100644 index 00000000..8a67758a --- /dev/null +++ b/vendor/x11iraf/obmsh/Imakefile @@ -0,0 +1,47 @@ +# Imakefile for the OBM shell. + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + + CDEBUGFLAGS = -g + +/* Hack to build on NOAO HP systems where the Xmu and Xaw libs had to be added + * specially to the system they don't come with the default X11 development + * system. This also avoids the binary requiring the shared lib version on + * systems which may not have it. + */ +#if defined(HPArchitecture) && OSMajorVersion >= 10 + XMULIB = /usr/lib/X11R6/libXmu.a + XAWLIB = /usr/lib/X11R6/libXaw.a +#endif + + + LOCAL_LDFLAGS = $(X11IRAF_LDFLAGS) + EXTRA_INCLUDES = $(X11IRAF_INCLUDES) + OBMLIBS = LibObm LibXpm + MATHLIB = -lm + XAWLIB = LibXaw3d + + SRCS = obmsh.c + OBJS = obmsh.o + + +AllTarget(obmsh) + +NormalProgramTarget(obmsh,$(OBJS),,${OBMLIBS} XawClientLibs,$(MATHLIB)) + +#if InstallBinaries +install:: obmsh + -@if [ -d X11irafBinDir ]; then set +x; \ + else (set -x; $(MKDIRHIER) X11irafBinDir); fi + $(CP) obmsh X11irafBinDir +#endif + +#if InstallManuals +install:: + MakeDir(X11irafManDir) + $(CP) obmsh.man X11irafManDir/obmsh.1 +#endif + +DependTarget() + diff --git a/vendor/x11iraf/obmsh/Imakefile.orig b/vendor/x11iraf/obmsh/Imakefile.orig new file mode 100644 index 00000000..1462c251 --- /dev/null +++ b/vendor/x11iraf/obmsh/Imakefile.orig @@ -0,0 +1,23 @@ +# Imakefile for the OBM shell. + + CDEBUGFLAGS = -g + XAWLIB = -lXaw3d # set to Xaw3d for 3d look + BINDIR = /usr/local/bin + + LOCAL_LDFLAGS = -L../lib + EXTRA_INCLUDES = -I../include + OBMLIBS = -lobm -lXpm + MATHLIB = -lm + DEPOBM = ../lib/libobm.a + + SRCS = obmsh.c + OBJS = obmsh.o + +AllTarget(obmsh) + +NormalProgramTarget(obmsh,$(OBJS),${DEPOBM},${OBMLIBS} XawClientLibs,$(MATHLIB)) + +${DEPOBM}: + +InstallProgramWithFlags(obmsh, $(BINDIR), $(INSTUIDFLAGS)) +DependTarget() diff --git a/vendor/x11iraf/obmsh/README b/vendor/x11iraf/obmsh/README new file mode 100644 index 00000000..bd578d1d --- /dev/null +++ b/vendor/x11iraf/obmsh/README @@ -0,0 +1,11 @@ +OBMSH -- Unix shell for the IRAF Widget Server / Object Manager (OBM). + +Obmsh may be used to execute a GUI file by name, or may be given as the +shell executable (e.g. #!/usr/local/bin/obmsh) within a unix shell script +to write GUI script commands. + + Imakefile Build file + obmsh.c Source (doesn't take much!) + puzzle Sample OBMSH shell script (contributed by MJF) + +To build: xmkmf, make, make install. diff --git a/vendor/x11iraf/obmsh/obmsh.c b/vendor/x11iraf/obmsh/obmsh.c new file mode 100644 index 00000000..918aabf4 --- /dev/null +++ b/vendor/x11iraf/obmsh/obmsh.c @@ -0,0 +1,127 @@ +#include <stdio.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <Obm.h> + +/* + * OBMSH -- GUI shell using the OBM (Object Manager) library. The GUI script + * to be executed may be read from either the standard input or a file. + */ + +/* Compatibility hacks. */ +#ifdef AUX +void *memmove(a,b,n) void *a; const void *b; size_t n; { bcopy(b,a,n); } +#else +#if defined(sun) && !defined(SYSV) +void *memmove(a,b,n) void *a, *b; int n; { bcopy(b,a,n); } +#endif +#endif + +/* Data. */ +XtAppContext app_context; +static char server[] = "server"; + +static void deactivate(); +static void output(); + + +/* MAIN -- OBMSH main program. + */ +main (argc, argv) +int argc; +char *argv[]; +{ + Widget toplevel; + XtPointer obm; + char **sv_argv; + int sv_argc; + char *fname; + + /* Get local copy of argc and argv. */ + if ((sv_argc = argc) > 0) { + sv_argv = (char **) XtMalloc (argc * sizeof(char *)); + memmove (sv_argv, argv, argc * sizeof(char *)); + } else + sv_argv = argv; + + /* Initialize applications context. */ + toplevel = XtAppInitialize (&app_context, "OBMsh", + (XrmOptionDescList) NULL, 0, &sv_argc, sv_argv, + (String *) NULL, (ArgList) NULL, 0); + + /* Free saved arglist. */ + free ((char *)sv_argv); + if (!toplevel) + exit (1); + + /* Initialize the object manager. */ + if (!(obm = (XtPointer) ObmOpen (app_context, argc, argv))) + exit (2); + ObmAddCallback (obm, OBMCB_deactivate|OBMCB_preserve, deactivate, obm); + ObmAddCallback (obm, OBMCB_clientOutput|OBMCB_preserve, output, obm); + + /* Open and execute the GUI file if there was one, otherwise read + * the GUI from the standard input. + */ + if (argc == 2) { + if (access (fname=argv[1],0) != 0) { + fprintf (stderr, "cannot open %s\n", fname); + exit (3); + } + if (ObmDeliverMsgFromFile (obm, server, fname) != 0) { + fprintf (stderr, "error executing GUI %s\n", fname); + exit (4); + } + } else { + register int ch; + register char *op; + char *message = (char *) XtMalloc (1024000); + + for (op=message; (ch = getc(stdin)) != EOF; ) + *op++ = ch; + *op++ = '\0'; + + ObmDeliverMsg (obm, server, message); + free (message); + } + + /* Activate the GUI. */ + ObmActivate (obm); + + /* EXECUTE */ + XtAppMainLoop (app_context); +} + + +/* DEACTIVATE -- The deactivate callback is called when deactivate is executed + * in the GUI. + */ +static void +deactivate (obm, toplevel) +XtPointer obm; +Widget toplevel; +{ + ObmClose (obm); + exit (0); +} + + +/* OUTPUT -- The output callback is called when the GUI sends data or requests + * to the "client" object, which is this routine in the case of obmsh. + */ +static void +output (obm, tcl, objname, key, string) +XtPointer obm; +XtPointer tcl; /* not used */ +char *objname; /* not used */ +int key; +char *string; +{ + if (key == 'q' || key == 'Q') { + ObmClose (obm); + exit (0); + } else { + printf ("key=%c(%03o) command = `%s'\n", key, key, string); + fflush (stdout); + } +} diff --git a/vendor/x11iraf/obmsh/obmsh.man b/vendor/x11iraf/obmsh/obmsh.man new file mode 100644 index 00000000..06d7a923 --- /dev/null +++ b/vendor/x11iraf/obmsh/obmsh.man @@ -0,0 +1,71 @@ +.\" @(#)obmsh.1 1.1 28-Aug-97 MJF +.TH OBMSH 1 "28 Aug 1997" "X11IRAF Project" +.SH NAME +obmsh \- Object Manager GUI script interpreter +.SH SYNOPSIS +\fBobmsh\fP [\fIfile\fP] +.SH DESCRIPTION +.LP +\fBObmsh\fP is a GUI command interpreter for the IRAF Widget Server / +Object Manager (OBM) that +executes commands read from the standard input or from a file. As with +other shell interpreters such as \fIcsh\fR if the program is a file +beginning with \fB#!\fR, the remainder of the first line specifies an +interpreter for the program, usually the path to the obmsh executable. +There are no arguments. + +OBM programs are Tcl scripts consisting of application widgets to be created, +resource values for those widgets, callback procedures, and OBM-specific +functions needed to create and activate the GUI. In applications such as +\fIXimtool\fR the GUI interacts with an underlying client program by passing +messages to the client, server (the object manager itself) or various +parameters or widgets in the script. Obmsh scripts have no client but +will execute a default callback that outputs the client message to the +standard output, the script will continue to run until a 'q' keystroke is +detected in a client message. + +Obmsh script support all features of the Tcl language but also provide a +builtin GUI capability. For applications which do not require a client +to perform more complex operations, the obmsh provides a fully featured +GUI scripting language. For more information on the IRAF Widget Server / +OBM contact iraf@noao.edu or see Tody, D. 1995, in ADASS IV Proceedings, +ASP Conf. Ser, Vol 77, p. 89. + +.SH EXAMPLE +.LP +The following GUI script program demonstrates a simple "hello world" +application: +.nf + + #!/usr/local/bin/obmsh + + reset-server + appInitialize hello Hello { + ! Application defaults for the hello world program. + Hello*objects:\\ + toplevel Form helloForm\\ + helloForm Label helloLabel\\ + helloForm Command quitButton + + *background: bisque + *helloLabel.label: Hello, world! + *quitButton.fromHoriz: helloLabel + *quitButton.label: Quit + } + + createObjects + proc quit args { send client gkey q; deactivate unmap } + send quitButton addCallback quit + activate + +.fi +If the file has execute permissions set the \fB#!\fR will invoke the obmsh +to execute the file, otherwise it may be running using either +.nf + + % obmsh hello.gui or % obmsh < hello.gui +.fi +.SH SEE ALSO +xgterm(1), ximtool(1) +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/obmsh/obmsh.ps b/vendor/x11iraf/obmsh/obmsh.ps new file mode 100644 index 00000000..3a7a3d86 --- /dev/null +++ b/vendor/x11iraf/obmsh/obmsh.ps @@ -0,0 +1,552 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Thu Sep 11 15:23:56 1997 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/Y{/Symbol FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(OBMSH)S +1272(\()S +1321(1)S +1387(\))S +2787(USER COMMANDS )S +5060(OBMSH)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(obmsh)S +1557(\261)S +1637(Object)S +1933(Manager)S +2317(GUI)S +2524(script)S +2776(interpreter)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(obmsh)S +10 R +1574([)S +10 I +1607(\256le)S +10 R +1729(])S +1536 V +9 B +900(DESCRIPTION)S +1656 V +10 B +1260(Obmsh)S +10 R +1611(is)S +1717(a)S +1800(GUI)S +2016(command)S +2449(interpreter)S +2903(for)S +3058(the)S +3219(IRAF)S +3486(Widget)S +3819(Server)S +4118(/)S +4185(Object)S +4491(Manager)S +4885(\(OBM\))S +5219(that)S +5409(exe-)S +1776 V +1260(cutes)S +1499(commands)S +1966(read)S +2171(from)S +2399(the)S +2555(standard)S +2927(input)S +3167(or)S +3284(from)S +3512(a)S +3590(\256le.)S +3807(As)S +3952(with)S +4164(other)S +4403(shell)S +4626(interpreters)S +5114(such)S +5331(as)S +10 I +5447(csh)S +1896 V +10 R +1260(if)S +1360(the)S +1521(program)S +1898(is)S +2004(a)S +2087(\256le)S +2254(beginning)S +2693(with)S +10 B +2910(#!)S +10 R +2993(,)S +3057(the)S +3218(remainder)S +3661(of)S +3783(the)S +3944(\256rst)S +4139(line)S +4329(speci\256es)S +4713(an)S +4847(interpreter)S +5302(for)S +5458(the)S +2016 V +1260(program,)S +1653(usually)S +1972(the)S +2124(path)S +2326(to)S +2434(the)S +2586(obmsh)S +2883(executable.)S +3394(There)S +3656(are)S +3807(no)S +3937(arguments.)S +2256 V +1260(OBM)S +1524(programs)S +1937(are)S +2095(Tcl)S +2265(scripts)S +2563(consisting)S +3006(of)S +3126(application)S +3607(widgets)S +3955(to)S +4070(be)S +4201(created,)S +4550(resource)S +4924(values)S +5216(for)S +5369(those)S +2376 V +1260(widgets,)S +1644(callback)S +2024(procedures,)S +2534(and)S +2726(OBM-speci\256c)S +3340(functions)S +3760(needed)S +4090(to)S +4216(create)S +4501(and)S +4692(activate)S +5049(the)S +5218(GUI.)S +5497(In)S +2496 V +1260(applications)S +1776(such)S +1992(as)S +10 I +2108(Ximtool)S +10 R +2458(the)S +2613(GUI)S +2823(interacts)S +3194(with)S +3405(an)S +3532(underlying)S +3998(client)S +4253(program)S +4624(by)S +4757(passing)S +5091(messages)S +5502(to)S +2616 V +1260(the)S +1414(client,)S +1693(server)S +1967(\(the)S +2153(object)S +2428(manager)S +2802(itself\))S +3066(or)S +3180(various)S +3505(parameters)S +3973(or)S +4087(widgets)S +4429(in)S +4538(the)S +4691(script.)S +4999(Obmsh)S +5319(scripts)S +2736 V +1260(have)S +1484(no)S +1620(client)S +1878(but)S +2042(will)S +2234(execute)S +2574(a)S +2655(default)S +2969(callback)S +3338(that)S +3525(outputs)S +3857(the)S +4016(client)S +4275(message)S +4650(to)S +4765(the)S +4924(standard)S +5299(output,)S +2856 V +1260(the)S +1412(script)S +1664(will)S +1850(continue)S +2224(to)S +2332(run)S +2495(until)S +2709(a)S +2783('q')S +2929(keystroke)S +3347(is)S +3444(detected)S +3806(in)S +3914(a)S +3988(client)S +4240(message.)S +3096 V +1260(Obmsh)S +1594(script)S +1861(support)S +2206(all)S +2351(features)S +2711(of)S +2840(the)S +3008(Tcl)S +3187(language)S +3593(but)S +3767(also)S +3974(provide)S +4325(a)S +4415(builtin)S +4723(GUI)S +4946(capability.)S +5441(For)S +3216 V +1260(applications)S +1787(which)S +2075(do)S +2219(not)S +2391(require)S +2717(a)S +2805(client)S +3070(to)S +3191(perform)S +3555(more)S +3803(complex)S +4190(operations,)S +4674(the)S +4839(obmsh)S +5149(provides)S +5536(a)S +3336 V +1260(fully)S +1482(featured)S +1841(GUI)S +2051(scripting)S +2434(language.)S +2882(For)S +3054(more)S +3292(information)S +3797(on)S +3930(the)S +4085(IRAF)S +4346(Widget)S +4674(Server)S +4968(/)S +5030(OBM)S +5292(contact)S +3456 V +1260(iraf@noao.edu)S +1883(or)S +1996(see)S +2153(Tody,)S +2419(D.)S +2546(1995,)S +2801(in)S +2909(ADASS)S +3267(IV)S +3402(Proceedings,)S +3945(ASP)S +4159(Conf.)S +4414(Ser,)S +4602(Vol)S +4782(77,)S +4937(p.)S +5042(89.)S +3744 V +9 B +900(EXAMPLE)S +3864 V +10 R +1260(The)S +1445(following)S +1864(GUI)S +2071(script)S +2323(program)S +2691(demonstrates)S +3248(a)S +3322(simple)S +3619("hello)S +3890(world")S +4194(application:)S +4104 V +1380(#!/usr/local/bin/obmsh)S +4344 V +1380(reset-server)S +4464 V +1380(appInitialize)S +1909(hello)S +2139(Hello)S +2391({)S +4584 V +1500(!)S +1563(Application)S +2065(defaults)S +2411(for)S +2557(the)S +2709(hello)S +2939(world)S +3202(program.)S +4704 V +1500(Hello)S +10 Y +1722(*)S +10 R +1772(objects:\\)S +4824 V +1740(toplevel)S +2700(Form)S +3157(helloForm\\)S +4944 V +1740(helloForm)S +2700(Label)S +3137(helloLabel\\)S +5064 V +1740(helloForm)S +2700(Command)S +3267(quitButton)S +5304 V +10 Y +1500(*)S +10 R +1550(background:)S +2559(bisque)S +5424 V +10 Y +1500(*)S +10 R +1550(helloLabel.label:)S +2554(Hello,)S +2831(world!)S +5544 V +10 Y +1500(*)S +10 R +1550(quitButton.fromHoriz:)S +2663(helloLabel)S +5664 V +10 Y +1500(*)S +10 R +1550(quitButton.label:)S +2556(Quit)S +5784 V +1380(})S +6024 V +1380(createObjects)S +6144 V +1380(proc)S +1587(quit)S +1773(args)S +1969({)S +2047(send)S +2260(client)S +2512(gkey)S +2736(q;)S +2844(deactivate)S +3278(unmap)S +3580(})S +6264 V +1380(send)S +1593(quitButton)S +2052(addCallback)S +2581(quit)S +6384 V +1380(activate)S +6624 V +1260(If)S +1361(the)S +1519(\256le)S +1683(has)S +1852(execute)S +2192(permissions)S +2706(set)S +2853(the)S +10 B +3011(#!)S +10 R +3130(will)S +3322(invoke)S +3630(the)S +3788(obmsh)S +4091(to)S +4205(execute)S +4545(the)S +4703(\256le,)S +4892(otherwise)S +5316(it)S +5408(may)S +6744 V +1260(be)S +1384(running)S +1725(using)S +1972(either)S +6984 V +1620(%)S +1733(obmsh)S +2030(hello.gui)S +2700(or)S +3090(%)S +3203(obmsh)S +3500(<)S +3586(hello.gui)S +7680 V +900(X11IRAF Project)S +2703(Last change: 28 Aug 1997)S +5530(1)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(OBMSH)S +1272(\()S +1321(1)S +1387(\))S +2787(USER COMMANDS )S +5060(OBMSH)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(SEE)S +1112(ALSO)S +1080 V +10 R +1260(xgterm\(1\),)S +1714(ximtool\(1\))S +1248 V +9 B +900(COPYRIGHT)S +1368 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 28 Aug 1997)S +5530(2)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol +%%Pages: 2 + \ No newline at end of file diff --git a/vendor/x11iraf/obmsh/puzzle b/vendor/x11iraf/obmsh/puzzle new file mode 100755 index 00000000..e43d04f4 --- /dev/null +++ b/vendor/x11iraf/obmsh/puzzle @@ -0,0 +1,330 @@ +#!/usr/local/bin/obmsh + +# PUZZLE.GUI -- A simple number re-ordering puzzle, kinda like the one my +# Dad would make me play on long car trips to shut me up.... +# +# History: 4/23/94 - written (MJF) +# 4/25/94 - Added timer and move counter labels + +reset-server +appInitialize puzzle Puzzle { + Puzzle*objects:\ + toplevel Paned puzzle\ + puzzle Form tForm\ + tForm Label timerLabel\ + tForm Toggle pauseButton\ + tForm Label movesLabel\ +\ + puzzle Form pForm\ + pForm Command pos11\ + pForm Command pos12\ + pForm Command pos13\ + pForm Command pos14\ + pForm Command pos15\ + pForm Command pos21\ + pForm Command pos22\ + pForm Command pos23\ + pForm Command pos24\ + pForm Command pos25\ + pForm Command pos31\ + pForm Command pos32\ + pForm Command pos33\ + pForm Command pos34\ + pForm Command pos35\ + pForm Command pos41\ + pForm Command pos42\ + pForm Command pos43\ + pForm Command pos44\ + pForm Command pos45\ + pForm Command pos51\ + pForm Command pos52\ + pForm Command pos53\ + pForm Command pos54\ + pForm Command pos55\ +\ + puzzle Form pCmd\ + pCmd Command newButton\ + pCmd Command quitButton + + *tForm*background: bisque3 + *tForm*showGrip: false + *tForm*resizeable: false + *tForm*Label.background: black + *tForm*Label.foreground: red + *tForm*Label.shadowWidth: 0 + *tForm*Label.borderWidth: 0 + *tForm*Command.background: grey80 + *tForm*Toggle.background: grey80 + *pForm*background: bisque3 + *pForm*showGrip: false + *pForm*resizeable: false + *pForm*Command.background: grey80 + *pCmd*background: bisque3 + *pCmd*Command.background: grey80 + *pCmd*resizeable: false + + *timerLabel.label: 0000 + *timerLabel.height: 30 + *timerLabel*font: *times-bold-r*24* + *pauseButton.label: Pause + *pauseButton.height: 30 + *pauseButton.fromHoriz: timerLabel + *pauseButton.horizDistance: 10 + *pauseButton*font: *times-bold-r*18* + *movesLabel.label: 0000 + *movesLabel.height: 30 + *movesLabel*font: *times-bold-r*24* + *movesLabel.fromHoriz: pauseButton + *movesLabel.horizDistance: 10 + + *pForm*width: 50 + *pForm*height: 50 + *pForm*horizDistance: 0 + *pForm*vertDistance: 0 + *pForm*Label.background: bisque3 + *pForm*Label.shadowWidth: 0 + *pForm*Label.borderWidth: 0 + *pForm*font: *times-bold-r*24* + + *pos12.fromHoriz: pos11 + *pos13.fromHoriz: pos12 + *pos14.fromHoriz: pos13 + *pos15.fromHoriz: pos14 + + *pos11.vertDistance: 2 + *pos12.vertDistance: 2 + *pos13.vertDistance: 2 + *pos14.vertDistance: 2 + *pos15.vertDistance: 2 + + *pos21.fromVert: pos11 + *pos21.horizDistance: 1 + *pos22.fromVert: pos12 + *pos22.fromHoriz: pos21 + *pos23.fromVert: pos13 + *pos23.fromHoriz: pos22 + *pos24.fromVert: pos14 + *pos24.fromHoriz: pos23 + *pos25.fromVert: pos15 + *pos25.fromHoriz: pos24 + + *pos31.fromVert: pos21 + *pos31.horizDistance: 1 + *pos32.fromHoriz: pos31 + *pos32.fromVert: pos22 + *pos33.fromVert: pos23 + *pos33.fromHoriz: pos32 + *pos34.fromVert: pos24 + *pos34.fromHoriz: pos33 + *pos35.fromVert: pos25 + *pos35.fromHoriz: pos34 + + *pos41.fromVert: pos31 + *pos41.horizDistance: 1 + *pos42.fromHoriz: pos41 + *pos42.fromVert: pos32 + *pos43.fromVert: pos33 + *pos43.fromHoriz: pos42 + *pos44.fromVert: pos34 + *pos44.fromHoriz: pos43 + *pos45.fromVert: pos35 + *pos45.fromHoriz: pos44 + + *pos51.fromVert: pos41 + *pos51.horizDistance: 1 + *pos52.fromHoriz: pos51 + *pos52.fromVert: pos42 + *pos53.fromVert: pos43 + *pos53.fromHoriz: pos52 + *pos54.fromVert: pos44 + *pos54.fromHoriz: pos53 + *pos55.fromVert: pos45 + *pos55.fromHoriz: pos54 + + *pCmd*Command.height: 30 + *pCmd*Command.width: 50 + *pCmd*Command.vertDistance: 12 + *pCmd*Command*font: *times-bold-r*18* + *newButton.label: New Game + *quitButton.fromHoriz: newButton + *quitButton.vertDistance: 5 + *quitButton.label: Quit +} + + +# Crank 'er up... +createObjects +activate + +# Should be a better way to randomize the start. +set space [ expr ( [pid] % 23 ) ] +set random "17 8 13 19 22 21 12 18 15 9 23 5 3 20 6 4 1 7 24 10 14 16 2 11" + +# Quit the game. +proc Quit args { + global timerId + + if {[send pauseButton get state] == 0} { + deleteTimedCallback $timerId + } + send client gkey q + deactivate unmap +} ; send quitButton addCallback Quit + + +# Initialize the game board. +proc Init args { + global space random + + set k $space + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + + for { set i 1 } { $i<=5 } { incr i } { + for { set j 1 } { $j<=5 } { incr j } { + set val [lindex $random $k] + if {[expr [expr $i == $ispace] && [expr $j == $jspace]]} { + send pForm unmanage pos$i$j + } else { + send pos$i$j "set label $val" + set k [ expr ($k == 23) ? 0 : [expr $k+1] ] + } + } + } +} ; Init + + +# Define the game buttons and positions. +set buttons { pos11 pos12 pos13 pos14 pos15 + pos21 pos22 pos23 pos24 pos25 + pos31 pos32 pos33 pos34 pos35 + pos41 pos42 pos43 pos44 pos45 + pos51 pos52 pos53 pos54 pos55 +} + +set indx 0 +for { set i 1 } { $i<=5 } { incr i } { + for { set j 1 } { $j<=5 } { incr j } { + set bpos(pos$i$j) "$i $j $indx" + incr indx + } +} + +# Take action when hitting a button. +proc Move { widget args } { + global space buttons bpos + + # If we've paused the game then don't move anything. + if {[send pauseButton get state] == 1} { + return + } + + # Get the position of the empty space. + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + + # Get the position of the current widget. + set i [ lindex $bpos($widget) 0] + set j [ lindex $bpos($widget) 1] + + # Now see if the current widget is next to the empty space, but not on + # a corner. + set xdiff [expr abs ([expr $ispace-$i])] + set ydiff [expr abs ([expr $jspace-$j])] + if { ! [expr [expr $xdiff == 1] && [expr $ydiff == 1]]} { + if {[expr [expr $xdiff < 2] && [expr $ydiff < 2]]} { + + # Manage the empty space. + manage_space $space + + # Set space label to current label. + set lab [send $widget get label] + send [lindex $buttons $space] "set label $lab" + + # Unmanage current space. + unmanage_space [lindex $bpos($widget) 2] + set space [lindex $bpos($widget) 2] + + # Update the number of times we've made a move. + update_nmoves + } + } + +} ; foreach item $buttons { send $item addCallback Move } + + +# Start a new game. +proc New_Game args { + global space time nmoves timerId + + # If we've paused the game then don't do anything. + if {[send pauseButton get state] == 1} { + return + } + manage_space $space + new_space + Init + set nmoves -1 ; update_nmoves + set time 0 + deleteTimedCallback $timerId + send timerLabel set label 0000 + set timerId [postTimedCallback timer 1000] +} ; send newButton addCallback New_Game + + +# Get a new empty space. +proc new_space args { + global space random + set space [lindex $random [ expr ($space >= 23) ? 0 : $space ] ] + if {$space == 24} { set space 5 } +} + + +# Show a puzzle piece. +proc manage_space { space args } { + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + send pForm manage pos$ispace$jspace +} + + +# Remove a puzzle piece. +proc unmanage_space { space args } { + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + send pForm unmanage pos$ispace$jspace +} + + +# Install a timer so we can keep score of our best times. +set timerId 0 +set time 0 +proc timer args { + global timerId time + + send timerLabel set label [ format "%04d" $time ] + incr time + set timerId [postTimedCallback timer 1000] +}; set timerId [postTimedCallback timer 1000] + + +# Count the number of times we move a piece. +set nmoves 0 +proc update_nmoves args { + global nmoves + + incr nmoves + send movesLabel set label [ format "%04d" $nmoves ] +} + + +# Define a 'pause' command in case the boss walks in... +proc pause_toggle args { + global timerId + + if {[send pauseButton get state] == 0} { + set timerId [postTimedCallback timer 1000] + } else { + deleteTimedCallback $timerId + } +} ; send pauseButton addCallback pause_toggle diff --git a/vendor/x11iraf/obmsh/zz b/vendor/x11iraf/obmsh/zz new file mode 100755 index 00000000..9419c0c5 --- /dev/null +++ b/vendor/x11iraf/obmsh/zz @@ -0,0 +1,334 @@ +#!/usr/local/bin/obmsh + +# PUZZLE.GUI -- A simple number re-ordering puzzle, kinda like the one my +# Dad would make me play on long car trips to shut me up.... +# +# History: 4/23/94 - written (MJF) +# 4/25/94 - Added timer and move counter labels + +reset-server +appInitialize puzzle Puzzle { + Puzzle*objects:\ + toplevel Paned puzzle\ + puzzle Form tForm\ + tForm Label timerLabel\ + tForm Toggle pauseButton\ + tForm Label movesLabel\ +\ + puzzle Form pForm\ + pForm Command pos11\ + pForm Command pos12\ + pForm Command pos13\ + pForm Command pos14\ + pForm Command pos15\ + pForm Command pos21\ + pForm Command pos22\ + pForm Command pos23\ + pForm Command pos24\ + pForm Command pos25\ + pForm Command pos31\ + pForm Command pos32\ + pForm Command pos33\ + pForm Command pos34\ + pForm Command pos35\ + pForm Command pos41\ + pForm Command pos42\ + pForm Command pos43\ + pForm Command pos44\ + pForm Command pos45\ + pForm Command pos51\ + pForm Command pos52\ + pForm Command pos53\ + pForm Command pos54\ + pForm Command pos55\ +\ + puzzle Form pCmd\ + pCmd Command newButton\ + pCmd Command quitButton + + *tForm*background: bisque3 + *tForm*showGrip: false + *tForm*resizeable: false + *tForm*Label.background: black + *tForm*Label.foreground: red + *tForm*Label.shadowWidth: 0 + *tForm*Label.borderWidth: 0 + *tForm*Command.background: grey80 + *tForm*Toggle.background: grey80 + *pForm*background: bisque3 + *pForm*showGrip: false + *pForm*resizeable: false + *pForm*Command.background: grey80 + *pCmd*background: bisque3 + *pCmd*Command.background: grey80 + *pCmd*resizeable: false + + *timerLabel.label: 0000 + *timerLabel.height: 30 + *timerLabel*font: *times-bold-r*24* + *pauseButton.label: Pause + *pauseButton.height: 30 + *pauseButton.fromHoriz: timerLabel + *pauseButton.horizDistance: 10 + *pauseButton*font: *times-bold-r*18* + *movesLabel.label: 0000 + *movesLabel.height: 30 + *movesLabel*font: *times-bold-r*24* + *movesLabel.fromHoriz: pauseButton + *movesLabel.horizDistance: 10 + + *pForm*width: 50 + *pForm*height: 50 + *pForm*horizDistance: 0 + *pForm*vertDistance: 0 + *pForm*Label.background: bisque3 + *pForm*Label.shadowWidth: 0 + *pForm*Label.borderWidth: 0 + *pForm*font: *times-bold-r*24* + + *pos12.fromHoriz: pos11 + *pos13.fromHoriz: pos12 + *pos14.fromHoriz: pos13 + *pos15.fromHoriz: pos14 + + *pos11.vertDistance: 2 + *pos12.vertDistance: 2 + *pos13.vertDistance: 2 + *pos14.vertDistance: 2 + *pos15.vertDistance: 2 + + *pos21.fromVert: pos11 + *pos21.horizDistance: 1 + *pos22.fromVert: pos12 + *pos22.fromHoriz: pos21 + *pos23.fromVert: pos13 + *pos23.fromHoriz: pos22 + *pos24.fromVert: pos14 + *pos24.fromHoriz: pos23 + *pos25.fromVert: pos15 + *pos25.fromHoriz: pos24 + + *pos31.fromVert: pos21 + *pos31.horizDistance: 1 + *pos32.fromHoriz: pos31 + *pos32.fromVert: pos22 + *pos33.fromVert: pos23 + *pos33.fromHoriz: pos32 + *pos34.fromVert: pos24 + *pos34.fromHoriz: pos33 + *pos35.fromVert: pos25 + *pos35.fromHoriz: pos34 + + *pos41.fromVert: pos31 + *pos41.horizDistance: 1 + *pos42.fromHoriz: pos41 + *pos42.fromVert: pos32 + *pos43.fromVert: pos33 + *pos43.fromHoriz: pos42 + *pos44.fromVert: pos34 + *pos44.fromHoriz: pos43 + *pos45.fromVert: pos35 + *pos45.fromHoriz: pos44 + + *pos51.fromVert: pos41 + *pos51.horizDistance: 1 + *pos52.fromHoriz: pos51 + *pos52.fromVert: pos42 + *pos53.fromVert: pos43 + *pos53.fromHoriz: pos52 + *pos54.fromVert: pos44 + *pos54.fromHoriz: pos53 + *pos55.fromVert: pos45 + *pos55.fromHoriz: pos54 + + *pCmd*Command.height: 30 + *pCmd*Command.width: 50 + *pCmd*Command.vertDistance: 12 + *pCmd*Command*font: *times-bold-r*18* + *newButton.label: New Game + *quitButton.fromHoriz: newButton + *quitButton.vertDistance: 5 + *quitButton.label: Quit +} + + +# Crank 'er up... +createObjects +activate + +# Should be a better way to randomize the start. +set space [ expr ( [pid] % 23 ) ] +set random "17 8 13 19 22 21 12 18 15 9 23 5 3 20 6 4 1 7 24 10 14 16 2 11" + +print [format "test %05d" 123456] + +# Quit the game. +proc Quit args { + global timerId + + if {[send pauseButton get state] == 0} { + deleteTimedCallback $timerId + } + send client gkey q + deactivate unmap +} ; send quitButton addCallback Quit + + +# Initialize the game board. +proc Init args { + global space random + + set k $space + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + + for { set i 1 } { $i<=5 } { incr i } { + for { set j 1 } { $j<=5 } { incr j } { + set val [lindex $random $k] + if {[expr [expr $i == $ispace] && [expr $j == $jspace]]} { + send pForm unmanage pos$i$j + } else { + send pos$i$j "set label $val" + set k [ expr ($k == 23) ? 0 : [expr $k+1] ] + } + } + } +} ; Init + + +# Define the game buttons and positions. +set buttons { pos11 pos12 pos13 pos14 pos15 + pos21 pos22 pos23 pos24 pos25 + pos31 pos32 pos33 pos34 pos35 + pos41 pos42 pos43 pos44 pos45 + pos51 pos52 pos53 pos54 pos55 +} + +set indx 0 +for { set i 1 } { $i<=5 } { incr i } { + for { set j 1 } { $j<=5 } { incr j } { + set bpos(pos$i$j) "$i $j $indx" + incr indx + } +} + +# Take action when hitting a button. +proc Move { widget args } { + global space buttons bpos + + # If we've paused the game then don't move anything. + if {[send pauseButton get state] == 1} { + return + } + + # Get the position of the empty space. + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + + # Get the position of the current widget. + set i [ lindex $bpos($widget) 0] + set j [ lindex $bpos($widget) 1] + + # Now see if the current widget is next to the empty space, but not on + # a corner. + set xdiff [expr abs ([expr $ispace-$i])] + set ydiff [expr abs ([expr $jspace-$j])] + if { ! [expr [expr $xdiff == 1] && [expr $ydiff == 1]]} { + if {[expr [expr $xdiff < 2] && [expr $ydiff < 2]]} { + + # Manage the empty space. + manage_space $space + + # Set space label to current label. + set lab [send $widget get label] + send [lindex $buttons $space] "set label $lab" + + # Unmanage current space. + unmanage_space [lindex $bpos($widget) 2] + set space [lindex $bpos($widget) 2] + + # Update the number of times we've made a move. + update_nmoves + } + } + +} ; foreach item $buttons { send $item addCallback Move } + + +# Start a new game. +proc New_Game args { + global space time nmoves timerId + + # If we've paused the game then don't do anything. + if {[send pauseButton get state] == 1} { + return + } + manage_space $space + new_space + Init + set nmoves -1 ; update_nmoves + set time 0 + deleteTimedCallback $timerId + send timerLabel set label 0000 + set timerId [postTimedCallback timer 1000] +} ; send newButton addCallback New_Game + + +# Get a new empty space. +proc new_space args { + global space random + set space [lindex $random [ expr ($space >= 23) ? 0 : $space ] ] + if {$space == 24} { set space 5 } +} + + +# Show a puzzle piece. +proc manage_space { space args } { + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + send pForm manage pos$ispace$jspace +} + + +# Remove a puzzle piece. +proc unmanage_space { space args } { + set ispace [ expr ($space / 5 + 1) ] + set jspace [ expr ($space % 5 + 1) ] + send pForm unmanage pos$ispace$jspace +} + + +# Install a timer so we can keep score of our best times. +set timerId 0 +set time 0 +proc timer args { + global timerId time + + send timerLabel set label [ format "%04d" $time ] + incr time + set timerId [postTimedCallback timer 1000] +}; set timerId [postTimedCallback timer 1000] + + +# Count the number of times we move a piece. +set nmoves 0 +proc update_nmoves args { + global nmoves + + incr nmoves + send movesLabel set label [ format "%04d" $nmoves ] +} + + +# Define a 'pause' command in case the boss walks in... +proc pause_toggle args { + global timerId + + if {[send pauseButton get state] == 0} { + set timerId [postTimedCallback timer 1000] + } else { + deleteTimedCallback $timerId + } +} ; send pauseButton addCallback pause_toggle + + diff --git a/vendor/x11iraf/util/ras2bin.c b/vendor/x11iraf/util/ras2bin.c new file mode 100644 index 00000000..93be1203 --- /dev/null +++ b/vendor/x11iraf/util/ras2bin.c @@ -0,0 +1,201 @@ +#include <stdio.h> + +/* + * RAS2BIN -- Convert a hex encoded raster to binary. + * + * Usage: ras2bin -encoding encoding -nx nx -ny ny infile outfile + * + * encoding hex1, hex2, hex1-rle, hex2-rle + * nx, ny raster size in pixels + * input input hex encoded, possible RLE (run length) encoded + * block of text. whitespace is ignored otherwise the file + * should contain only data. + * output output file to receive the binary array of pixels + * + * Perhaps this ought to take ras2text output and generate a Sun rasterfile, + * but currently we just decode the pixel data and output it in binary. + */ +main (argc, argv) +int argc; +char **argv; +{ + char *infile=NULL, *outfile=NULL; + char pixels[102400]; + int in, out, nx, ny, bias; + char *encoding; + int i; + + for (i=1; i < argc; i++) + if (argv[i][0] == '-') { + if (strncmp (argv[i], "-en", 3) == 0) + encoding = argv[++i]; + else if (strcmp (argv[i], "-nx") == 0) + nx = atoi (argv[++i]); + else if (strcmp (argv[i], "-ny") == 0) + ny = atoi (argv[++i]); + else if (strcmp (argv[i], "-bias") == 0) + bias = atoi (argv[++i]); + } else if (!infile) { + infile = argv[i]; + } else if (!outfile) + outfile = argv[i]; + + if (!infile || !outfile || nx <= 0 || ny <= 0) { + fprintf (stderr, "bad usage\n"); + exit (1); + } + + printf ("input = %s\n", infile); + if ((in = open (infile, 0)) < 0) { + fprintf (stderr, "cannot open %s\n", infile); + exit (2); + } + printf ("read %d chars from input\n", read (in, pixels, 102400)); + close (in); + + printf ("output = %s\n", outfile); + if ((out = creat (outfile, 0644)) < 0) { + fprintf (stderr, "cannot open %s\n", outfile); + exit (3); + } + + printRaster (out, pixels, encoding, nx, ny, bias); + close (out); +} + +printRaster (out, pixels, encoding, nx, ny, bias) +int out; +char *pixels; +char *encoding; +int nx, ny; +int bias; +{ + register char *ip; + register unsigned char *op; + register int v, i, j; + static unsigned char hex1[256], hex2[256]; + static int have_tables = 0; + unsigned char *data, *otop; + char *sv_pixels = pixels; + + /* Generate hex to binary lookup tables in first call. */ + if (!have_tables) { + /* Generate char-to-binary table for the hex1 encoding. */ + for (i=0; i < 256; i++) + hex1[i] = 0177; + for (i='0'; i <= '9'; i++) + hex1[i] = i - '0'; + for (i='A'; i <= 'Z'; i++) + hex1[i] = i - 'A' + 10; + for (i='a'; i <= 'z'; i++) + hex1[i] = i - 'a' + 36; + hex1['$'] = 62; + hex1['_'] = 63; + + /* Generate char-to-binary table for the hex2 encoding. */ + for (i=0; i < 256; i++) + hex2[i] = 0177; + for (i='0'; i <= '9'; i++) + hex2[i] = i - '0'; + for (i='a'; i <= 'f'; i++) + hex2[i] = i - 'a' + 10; + for (i='A'; i <= 'F'; i++) + hex2[i] = i - 'A' + 10; + + have_tables++; + } + + /* Decode the pixel data. */ + if (!(data = (unsigned char *) malloc (nx * ny))) + return (-1); + otop = data + nx * ny; + + /* Uncompress the input if RLE compression is indicated. */ + if (strcmp (&encoding[strlen(encoding)-4], "-rle") == 0) { + int buflen = nx * ny * 2; + char *ibuf, *op; + int ch; + + /* Get buffer to hold the uncompressed pixel data array. */ + if (!(ibuf = (char *) malloc (buflen + 1))) + goto err; + + /* Uncompress the pixel array. */ + for (ip=pixels, op=ibuf; *ip; ) { + while (isspace (*ip)) + ip++; + + if ((ch = *ip++) == '@') { + if ((i = hex1[*ip++]) >= 0x7f) + while (*ip && ((i = hex1[*ip++]) >= 0x7f)) + ; + if (op-ibuf + i + 1 > buflen) + goto err; + for (v = *(op-1), i++; --i >= 0; ) + *op++ = v; + + } else if (ch == '%') { + if ((i = hex2[*ip++]) >= 0x7f) + while (*ip && ((i = hex2[*ip++]) >= 0x7f)) + ; + if ((j = hex2[*ip++]) >= 0x7f) + while (*ip && ((j = hex2[*ip++]) >= 0x7f)) + ; + i = ((i << 4) | j) + 1; + if (op-ibuf + i > buflen) + goto err; + for (v = *(op-1); --i >= 0; ) + *op++ = v; + + } else + *op++ = ch; + } + + *op = '\0'; + pixels = ibuf; + } + + /* Convert the ascii pixels array to a binary data array. + */ + if (strcmp (encoding, "numeric") == 0) { + while (isspace (*ip)) + ip++; + for (ip=pixels, op=data; *ip && op < otop; ) { + for (v=0; isdigit(*ip); ) + v = v * 10 + *ip++ - '0'; + *op++ = v + bias; + while (isspace (*ip)) + ip++; + } + } else if (strncmp (encoding, "hex1", 4) == 0) { + for (ip=pixels, op=data; *ip && op < otop; ) { + if ((v = hex1[*ip++]) > 0xf) + while (*ip && ((v = hex1[*ip++]) > 0xf)) + ; + *op++ = v + bias; + } + } else if (strncmp (encoding, "hex2", 4) == 0) { + for (ip=pixels, op=data; *ip && op < otop; ) { + if ((v = hex2[*ip++]) > 0xf) + while (*ip && ((v = hex2[*ip++]) > 0xf)) + ; + if ((i = hex2[*ip++]) > 0xf) + while (*ip && ((i = hex2[*ip++]) > 0xf)) + ; + *op++ = ((v << 4) | i) + bias; + } + } else { +err: free ((char *)data); + if (pixels != sv_pixels) + free (pixels); + return (-1); + } + + /* Write the pixels. */ + write (out, data, op - data); + free ((char *)data); + if (pixels != sv_pixels) + free (pixels); + + return (0); +} diff --git a/vendor/x11iraf/util/ras2text.c b/vendor/x11iraf/util/ras2text.c new file mode 100644 index 00000000..7e490a82 --- /dev/null +++ b/vendor/x11iraf/util/ras2text.c @@ -0,0 +1,277 @@ +#include <stdio.h> +#include <rasterfile.h> + +/* + * RAS2TEXT -- This is a small standalone utility program to convert a color + * Sun rasterfile to a printable ASCII form suitable for inclusion as an image + * in a GUI. The dimensions of the raster are output, along with the RGB + * colortable and the hex-encoded and optionally run length encoded pixels. + * + * Usage: ras2text [-hex1 | -hex2] [-rle] fname + * + * The decoded Sun raster is written as text to the standard output. + */ + +#define HEX1 1 +#define HEX2 2 + +struct color { + unsigned char red, green, blue; +}; + +main (argc, argv) +int argc; +char **argv; +{ + register unsigned char *op; + register unsigned char *ip; + register int i, j, v; + struct rasterfile r; + struct color colors[256]; + unsigned char red[256], green[256], blue[256]; + unsigned char hex1[256], hex2[256*2]; + unsigned char *data, *obuf, *cbuf; + int encoding, compress, debug; + int fd, npix, nelem, maxval, n; + char *fname; + + fname = NULL; + encoding = HEX2; + compress = 0; + debug = 0; + + /* Process argument list. */ + for (i=1; i < argc; i++) + if (argv[i][0] == '-') { + if (strcmp (argv[i], "-hex1") == 0) + encoding = HEX1; + else if (strcmp (argv[i], "-hex2") == 0) + encoding = HEX2; + else if (strcmp (argv[i], "-rle") == 0) + compress++; + else if (strcmp (argv[i], "-d") == 0) + debug++; + else + fprintf (stderr, "unknown switch %s\n", argv[i]); + } else + fname = argv[i]; + + /* Open file. */ + if ((fd = open (fname, 0)) < 0) { + fprintf (stderr, "cannot open %s\n", fname); + exit (1); + } + + /* Read file header. */ + if (read(fd,&r,sizeof(r)) != sizeof(r) || r.ras_magic != RAS_MAGIC) { + fprintf (stderr, "not a Sun rasterfile: %s\n", fname); + exit (2); + } + + /* Print header. */ + printf ("width %d height %d depth %d\n", + r.ras_width, r.ras_height, r.ras_depth); + + if (debug) { + fprintf (stderr, "width=%d height=%d depth=%d length=%d type=%d\n", + r.ras_width, r.ras_height, r.ras_depth, r.ras_length, + r.ras_type); + fprintf (stderr, "maptype=%d, maplength=%d\n", + r.ras_maptype, r.ras_maplength); + } + + if (r.ras_type != RT_STANDARD) { + fprintf (stderr, "rasterfile not in standard format\n"); + exit (3); + } + + /* Read the colormap. */ + if (n = r.ras_maplength / 3) { + if (read (fd, red, n) != n || + read (fd, green, n) != n || + read (fd, blue, n) != n) { + + fprintf (stderr, "cannot read colormap\n"); + exit (4); + } + } + + /* Read the pixels. */ + if ((data = (unsigned char *) malloc (npix=r.ras_length)) == NULL) { + fprintf (stderr, "out of memory\n"); + exit (5); + } + if ((npix = read(fd,data,npix)) != r.ras_length) { + fprintf (stderr, "data read error\n"); + exit (6); + } + + /* If bitmap convert to byte pixel array. */ + if (r.ras_depth == 1) { + unsigned char *bits = data; + npix = r.ras_width * r.ras_height; + if ((data = (unsigned char *) malloc (npix)) == NULL) { + fprintf (stderr, "out of memory\n"); + exit (5); + } + for (i=0, op=data; i < npix; i++) + *op++ = !((bits[i/8] & (1 << (7 - (i % 8)))) != 0); + + free (bits); + } + + if ((obuf = (unsigned char *) malloc (npix*2)) == NULL) { + fprintf (stderr, "out of memory\n"); + exit (5); + } + + /* Find largest pixel value. */ + for (i=0, maxval=v=0; i < npix; i++) + if (data[i] > v) + v = data[i]; + maxval = v; + if (debug) + fprintf (stderr, "max pixel value = %d\n", maxval); + + /* Print the colormap. */ + n = r.ras_maplength / 3; + for (i=0; i < n; i++) { + colors[i].red = red[i]; + colors[i].green = green[i]; + colors[i].blue = blue[i]; + } + + if (n >= maxval) + n = maxval + 1; + + printf ("colormap (length %d) = {\n ", nelem = n); + for (i=0, n=1; i < nelem; i++, n++) { + printf ("{%3d %3d %3d} ", + colors[i].red, colors[i].green, colors[i].blue); + if (n && n > 4) { + printf ("\n "); + n = 0; + } + } + if (n) + printf ("\n"); + printf ("}\n"); + + if (r.ras_length <= 0) { + fprintf (stderr, "no data\n"); + exit (7); + } + + /* Print the pixels. + */ + + /* Generate binary to hex1 (64 element) lookup table. */ + for (n=0, op=hex1; n < 256; n++) { + i = (n % 64); + if (i < 10) + *op++ = i + '0'; + else if (i < 36) + *op++ = (i - 10) + 'A'; + else if (i < 62) + *op++ = (i - 36) + 'a'; + else if (i == 62) + *op++ = '$'; + else + *op++ = '_'; + } + + /* Generate binary to hex2 (256 element) lookup table. */ + for (n=0, op=hex2; n < 256; n++) { + i = ((n >> 4) & 017); + *op++ = (i < 10) ? i + '0' : (i-10) + 'A'; + i = (n & 017); + *op++ = (i < 10) ? i + '0' : (i-10) + 'A'; + } + + /* Hex encode the data. */ + if (encoding == HEX1) { + /* Hex1 encoding uses only one character per pixel but the + * pixel range is restricted to 0 to 63. + */ + for (j=0, ip=data, op=obuf; j < r.ras_height; j++) { + for (i=0; i < r.ras_width; i++) + *op++ = hex1[*ip++]; + if (r.ras_width % 2) + ip++; + } + } else if (encoding == HEX2) { + /* Hex2 encoding uses 2 characters per pixel and supports + * pixel values in the range 0 to 255. + */ + for (j=0, ip=data, op=obuf; j < r.ras_height; j++) { + for (i=0; i < r.ras_width; i++) { + v = *ip++ * 2; + *op++ = hex2[v]; + *op++ = hex2[v+1]; + } + if (r.ras_width % 2) + ip++; + } + } + *op = '\0'; + + /* Run length compress the data. The compressed data stream + * contains a mixture of literal data codes and repeat codes. + * A "@" followed by a hex1-encoded number N causes the most + * recent pixel value to be repeated N+1 times, where N < 64. + * A "%" followed by a hex2-encoded number N causes the most + * recent pixel value to be repeated N+1 times, where N < 256. + */ + if (compress) { + npix = r.ras_length; + if ((cbuf = (unsigned char *) malloc (npix*3)) == NULL) { + fprintf (stderr, "out of memory\n"); + exit (8); + } + + ip = obuf; + op = cbuf; + *op++ = v = *ip++; + while (*ip) { + for (n=0; n < 256 && *ip == v; ip++, n++) + ; + if (n == 0) { + *op++ = v = *ip++; + } else if (n < 3) { + while (--n >= 0) + *op++ = v; + } else if (n <= 64) { + *op++ = '@'; + *op++ = hex1[n-1]; + } else if (n <= 256) { + *op++ = '%'; + *op++ = hex2[(n-1)*2]; + *op++ = hex2[(n-1)*2+1]; + } + } + *op = '\0'; + + free (obuf); + obuf = cbuf; + } + + /* Output the encoded pixel data. + */ + printf ("pixels (%s%s) = {\n ", + (encoding == HEX1) ? "hex1" : "hex2", compress ? " rle" : ""); + for (ip=obuf, n=1; *ip; ip++, n++) { + putchar (*ip); + if (n && n > 72) { + printf ("\n "); + n = 0; + } + } + if (n) + printf ("\n"); + printf ("}\n"); + + free (data); + free (obuf); + close (fd); + exit (0); +} diff --git a/vendor/x11iraf/version.h b/vendor/x11iraf/version.h new file mode 100644 index 00000000..050a2cfd --- /dev/null +++ b/vendor/x11iraf/version.h @@ -0,0 +1 @@ +"X11IRAF V2.0 - DEVELOPMENT VERSION", diff --git a/vendor/x11iraf/vximtool/Imakefile b/vendor/x11iraf/vximtool/Imakefile new file mode 100644 index 00000000..5eb85b57 --- /dev/null +++ b/vendor/x11iraf/vximtool/Imakefile @@ -0,0 +1,45 @@ +# Imakefile for the Virtual XImtool display server. + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + + CDEBUGFLAGS = -g + + LOCAL_LDFLAGS = $(X11IRAF_LDFLAGS) + EXTRA_INCLUDES = $(X11IRAF_INCLUDES) + OBMLIBS = + MATHLIB = -lm + CDLLIB = -lcdl + XAWLIB = + + SRCS = vximtool.c + OBJS = vximtool.o + + +AllTarget(vximtool) + +vximtool: vximtool.o + $(RM) vximtool + $(CC) -o vximtool -DHAVE_CDL vximtool.o $(LDOPTIONS) $(CDLLIB) \ + $(MATHLIB) $(EXTRA_LIBRARIES) + +vximtool.o: + $(CC) -c $(CFLAGS) -DHAVE_CDL vximtool.c + +clean:: + $(RM) vximtool vximtool.o + +#if InstallManuals +install:: + MakeDir(X11irafManDir) + $(CP) vximtool.man X11irafManDir/vximtool.1 +#endif + +#if InstallBinaries +install:: vximtool + -@if [ -d X11irafBinDir ]; then set +x; \ + else (set -x; $(MKDIRHIER) X11irafBinDir); fi + $(CP) vximtool X11irafBinDir +#endif + +DependTarget() diff --git a/vendor/x11iraf/vximtool/vximtool.c b/vendor/x11iraf/vximtool/vximtool.c new file mode 100644 index 00000000..42f919cd --- /dev/null +++ b/vendor/x11iraf/vximtool/vximtool.c @@ -0,0 +1,2147 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#include <sys/times.h> +#include <sys/types.h> +#include <sys/socket.h> +#if defined(AIX) || defined(AIXV3) || defined (AIXV4) +#include <sys/select.h> +#endif +#include <netinet/in.h> +#include <sys/un.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> + + +#ifdef HAVE_CDL /* If we have the CDL we can build a proxy server. */ +#include "cdl.h" +#endif + + +/* + * VXIMTOOL.C -- Virtual image display server. This is a server process much + * like XIMTOOL, except that all the process does is respond to datastream + * requests to read and write to internal frame buffers maintained as arrays + * in memory. Multiple frame buffers and frame buffer configurations are + * supported. A log is kept to the stderr of all datastream requests. The + * process is terminated with an EOF on the stdin. + * + * + * To build: cc vximtool.c -o vximtool + * cc vximtool.c -o vximtool -lsocket # For Solaris systems + * cc -DANSI_FUNC vximtool.c # Use ANSI function prototypes + * + * Usage: vximtool -verbose >& spool # run server, log output + * vximtool -i # run interactively + * vximtool -noraster # don't store images in memory + * vximtool -i < cursor_file # take cursor input from file + * + * Options + * + * vximtool [-background] [-config <num>] [-fifo <pipe>] [-fifo_only] [-help] + * [-i] [-imtoolrc <file>] [-inet_only | -port_only] [-noraster] + * [-nframes <num>] [-port <num>] [-proxy] [-verbose] [-unix <name>] + * [-unix_only] + * + * + * Minimal match for command line options may be used. In interactive mode, + * cursor value strings may be typed in on the server stdin in response to + * cursor read requests from the client. Otherwise, a constant cursor value + * "1.0 1.0 101 q" is returned. + */ + + +/* Default values, size limiting values. + */ +#define MAX_FBCONFIG 128 /* max possible frame buf sizes */ +#ifndef HAVE_CDL +#define MAX_FRAMES 16 /* max number of frames */ +#endif +#define MAX_MAPPINGS 32 /* max number mappings/frame */ +#define MAX_CLIENTS 8 /* max display server clients */ +#define DEF_NFRAMES 1 /* save memory; only one frame */ +#define DEF_FRAME_WIDTH 512 /* 512 square frame */ +#define DEF_FRAME_HEIGHT 512 /* 512 square frame */ + +#define SZ_LABEL 256 /* main frame label string */ +#define SZ_IMTITLE 128 /* image title string */ +#define SZ_FIFOBUF 4000 /* transfer size for FIFO i/o */ +#define SZ_FNAME 256 +#define SZ_LINE 256 + +/* Magic numbers. */ +#define DEF_PORT 5137 /* default tcp/ip socket */ +#define DEF_NPORTS 1 /* default no. sockets to open */ +#define DEF_PROXY_PORT 5136 /* default proxy socket */ +#define I_DEVNAME "/dev/imt1o" /* pseudo device names */ +#define O_DEVNAME "/dev/imt1i" /* our IN is client's OUT */ +#define DEF_UNIXADDR "/tmp/.IMT%d" /* default unix socket */ +#define FBCONFIG_1 ".imtoolrc" +#define FBCONFIG_2 "/usr/local/lib/imtoolrc" +#define FBCONFIG_ENV1 "imtoolrc" +#define FBCONFIG_ENV2 "IMTOOLRC" + +/* IIS definitions. */ +#define IO_TIMEOUT 30 +#define MAXCONN 5 +#define SZ_IOBUF 65536 /* max size data transfer */ +#define SZ_FIFOBUF 4000 +#define SZ_OLD_WCSBUF 320 /* old WCS text buffer size */ +#define SZ_WCSBUF 1024 /* WCS text buffer size */ +#define SZ_FNAME 256 +#define SZ_IMCURVAL 160 + +#define IIS_VERSION 10 /* version 10 -> 1.0 */ + +#define MEMORY 01 /* frame buffer i/o */ +#define LUT 02 /* lut i/o */ +#define FEEDBACK 05 /* used for frame clears */ +#define IMCURSOR 020 /* logical image cursor */ +#define WCS 021 /* used to set WCS */ + +#define PACKED 0040000 +#define COMMAND 0100000 +#define IIS_READ 0100000 +#define IMC_SAMPLE 0040000 +#define IMT_FBCONFIG 077 +#define XYMASK 077777 + +struct iism70 { /* DO NOT change the order of */ + short tid; /* this structure. */ + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; +}; + +/* IIS data pixel values. */ +#define CMS_DATASTART 1 +#define CMS_DATAEND 200 +#define CMS_DATARANGE 200 + +/* WCS definitions. */ +#define W_UNITARY 0 +#define W_LINEAR 1 +#define W_LOG 2 +#define W_DEFFORMAT " %7.2f %7.2f %7.1f%c" + +/* Rotation matrix defining world coordinate system (WCS) of a frame. */ +typedef struct { + int valid; /* has WCS been set? */ + float a, b; /* x, y scale factors */ + float c, d; /* x, y cross factors */ + float tx, ty; /* x, y translation */ + float z1, z2; /* greyscale range */ + int zt; /* greyscale mapping */ + char format[32]; /* wcs output format */ + char imtitle[SZ_IMTITLE+1]; /* image title from WCS */ +} Ctran, *CtranPtr; + +/* Coordinate mappings on each frame buffer. */ +typedef struct { + int id; /* object id */ + Ctran ctran; /* world coordinate system */ + char ref[SZ_FNAME+1]; /* image reference from WCS */ + int regid; /* region id */ + char region[SZ_FNAME+1]; /* region name from WCS */ + float sx, sy; /* source rect */ + int snx, sny; + int dx, dy; /* destination rect */ + int dnx, dny; +} Mapping, *MappingPtr; + +/* The frame buffers. */ +typedef struct { + int frameno; /* frame number */ + char *framebuf; /* frame buffer raster */ + char label[SZ_LABEL+1]; /* frame label string */ + Ctran ctran; /* world coordinate system */ + char wcsbuf[SZ_WCSBUF]; /* wcs info string */ + Mapping mapping[MAX_MAPPINGS]; /* coordinate mappings */ + int nmaps; /* number of defined mappings */ +} FrameBuf, *FrameBufPtr; + +/* Possible frame buffer sizes. */ +typedef struct { + int nframes; /* number of frames */ + int width; /* frame buffer width */ + int height; /* frame buffer height */ +} FbConfig, *FbConfigPtr; + +/* Client I/O channel. */ +typedef struct { + void *vxim; /* backpointer to vxim descriptor */ + int type; /* channel type */ + int listen_fd; /* socket server fd */ + int datain; /* input channel */ + int dataout; /* output channel */ + int keepalive; /* used to keep input fifo ready */ + int connected; /* channel is connected to client */ + int port; /* inet port number */ + char path[SZ_FNAME+1]; /* for unix sockets */ + int reference_frame; /* reference (cmd i/o) frame */ + int version; /* flags capability of client */ + FrameBufPtr rf_p; /* reference frame descriptor */ +} IoChan, *IoChanPtr; + +#define IO_FIFO 1 +#define IO_INET 2 +#define IO_UNIX 3 + + +/* Application runtime descriptor. + * -------------------------------- + */ +typedef struct { + int def_config; /* default FB config */ + int def_nframes; /* default number of frames */ + char *imtoolrc; /* imtoolrc file name */ + char *input_fifo; /* client's output */ + char *output_fifo; /* client's input */ + char *unixaddr; /* format for unix socket path */ + int port; /* port for INET socket */ + int nports; /* nports to open */ + + /* Internal state. */ + int display_frame; /* currently displayed frame */ + int fb_configno; /* current config number */ + int nframes; /* current number of frame bufs */ + int width, height; /* current width, height */ + IoChan chan[MAX_CLIENTS]; /* client i/o descriptors */ + FrameBufPtr df_p; /* display frame descriptor */ + FrameBuf frames[MAX_FRAMES]; /* array of frame descriptors */ + FbConfig fb_config[MAX_FBCONFIG]; /* fb config table */ + +} VXimData, *VXimDataPtr; + + +/* Initialize the structure with out starting values. These can be reset + * with command line options. + */ +VXimData server_data = { + 1, /* def_config */ + DEF_NFRAMES, /* def_nframes */ + FBCONFIG_2, /* def_imtoolrc */ + O_DEVNAME, /* input_fifo */ + I_DEVNAME, /* output_fifo */ + DEF_UNIXADDR, /* unixaddr */ + DEF_PORT, /* port */ + DEF_NPORTS, /* nports */ + 1, /* display_frame */ + 1, /* fb_configno */ + 2, /* nframes */ + 512, 512 /* width, height */ +}; + +/* Functions. + */ +#ifndef abs +#define abs(a) (((a)<0)?(-(a)):(a)) +#endif +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef max +#define max(a,b) ((a)<(b)?(b):(a)) +#endif + +#ifdef SOLARIS +#define bzero(a,n) memset(a,0,n) +#define bcopy(a,b,n) memmove(b,a,n) +#endif + +#define SELWIDTH 32 + +#ifdef HAVE_CDL +static int proxy = 0; +static int nclients = 0; +CDLPtr cdl[MAX_CLIENTS]; +#endif +static int keep_raster = 1; +extern int errno; +static int background = 0; +static int objid = 0; +static int verbose = 0; +static int interactive = 0; +static float cursor_x = 1.0, cursor_y = 1.0; +static fd_set fds, allset; + + +#ifdef ANSI_FUNC + +int main(int argc, char **argv); +static int vx_iisopen(register VXimDataPtr vxim); +static void vx_iisclose(register VXimDataPtr vxim); +static IoChanPtr open_fifo(register VXimDataPtr vxim); +static IoChanPtr open_inet(register VXimDataPtr vxim); +static IoChanPtr open_unix(register VXimDataPtr vxim); +static void vx_connectClient(IoChanPtr chan, int *source); +static void vx_disconnectClient(register IoChanPtr chan); +static IoChanPtr get_iochan(register VXimDataPtr vxim); +static void vx_iisio(IoChanPtr chan, int *fd_addr, int source); +static void set_fbconfig(IoChanPtr chan, int config, int frame); +static int decode_frameno(register int z); +static void bswap2(char *a, char *b, int nbytes); +static void vx_retCursorVal(register int dataout, float sx, float sy, + int wcs, int key, char *strval); +static CtranPtr wcs_update(register VXimDataPtr vxim, FrameBufPtr fr); +static void vx_initialize(register VXimDataPtr vxim, int config, + int nframes, int reset); +static void vx_initFrame(register VXimDataPtr vxim, int frame, + int nframes, FbConfigPtr config); +static void vx_eraseFrame(register VXimDataPtr vxim, int frame); +static void get_fbconfig(register VXimDataPtr vxim); +static void Usage(void); +static void printoption(char *st); +static void add_mapping(register VXimDataPtr vxim, CtranPtr ctran, + char *wcsbuf, FrameBufPtr fr); +#ifdef HAVE_CDL +static void vx_flip(char *buffer, int nx, int ny); +#endif +static int iis_read (int fd, void *vptr, int nbytes); +static int iis_write (int fd, void *vptr, int nbytes); + +#else + +static void vx_iisclose(), vx_connectClient(), vx_disconnectClient(); +static void vx_iisio(), set_fbconfig(), vx_retCursorVal(); +static void vx_initialize(), vx_initFrame(), vx_eraseFrame(); +static void get_fbconfig(), Usage(), printoption(); +static void add_mapping(); +#ifdef HAVE_CDL +static void vx_flip(); +#endif +static int vx_iisopen(), decode_frameno(), iis_read(), iis_write(); +static void bswap2(); +static IoChanPtr open_fifo(), open_inet(), open_unix(), get_iochan(); +static CtranPtr wcs_update(); + +#endif + + +/* + * VXIMTOOL -- Virtual display server process. This task is an image display + * server like XImtool, responding to datastream requests on fifo pipes, + * inet sockets, or unix sockets. Up to 16 frames are supported, frame + * buffers may be any of the defined frames in the imtoolrc file. Images + * are stored in memory, allowing readback by the client. Cursor input can + * come from stdin (or a redirected file) allowing the user to respond to + * client cursor requests. The task is terminated with an EOF on stdin. + */ + +#ifdef ANSI_FUNC + +int +main (int argc, char **argv) +#else + +main (argc, argv) +int argc; +char **argv; +#endif +{ + register VXimDataPtr vxim = &server_data; + register IoChanPtr chan; + register int i, nopen, n; + char buf[SZ_FNAME]; + int fd; + + /* Process the command line arguments. */ + for (i=1; i < argc; i++) { + +#ifdef HAVE_CDL + /* Anything without a '-' is a client device to add to the proxy + * list. Format of the arg must be a valid IMTDEV string. + */ + if (proxy && argv[i][0] != '-') { + if ((cdl[nclients++] = cdl_open (argv[i])) == (CDLPtr) NULL) + nclients--; + else if (verbose) + printf ("Connected to server on %s\n", argv[i]); + continue; + } +#endif + if (strncmp (argv[i], "-background", 2) == 0) { + background = 1; + } else if (strncmp (argv[i], "-config", 2) == 0) { + vxim->def_config = atoi (argv[++i]); + } else if (strncmp (argv[i], "-fifo_only", 6) == 0) { + vxim->unixaddr = "none"; + vxim->port = 0; + } else if (strncmp (argv[i], "-fifo", 5) == 0) { + vxim->input_fifo = (char *) calloc (SZ_FNAME, sizeof(char)); + vxim->output_fifo = (char *) calloc (SZ_FNAME, sizeof(char)); + sprintf (vxim->input_fifo, "%si", argv[++i]); + sprintf (vxim->output_fifo, "%so", argv[i]); + } else if (strncmp (argv[i], "-help", 2) == 0) { + Usage (); + exit (0); + } else if (strncmp (argv[i], "-imtoolrc", 3) == 0) { + vxim->imtoolrc = argv[++i]; + } else if (strncmp (argv[i], "-inet_only", 3) == 0) { + vxim->input_fifo = ""; + vxim->unixaddr = "none"; + } else if (strcmp (argv[i], "-i") == 0) { + interactive++; + } else if (strncmp (argv[i], "-noraster", 3) == 0) { + keep_raster = 0; + } else if (strncmp (argv[i], "-nframes", 3) == 0) { + vxim->def_nframes = min (MAX_FRAMES, atoi (argv[++i])); + } else if (strncmp (argv[i], "-nports", 3) == 0) { + vxim->nports = atoi (argv[++i]); + } else if (strncmp (argv[i], "-port_only", 6) == 0) { + vxim->input_fifo = ""; + vxim->unixaddr = "none"; + } else if (strncmp (argv[i], "-port", 5) == 0) { + vxim->port = atoi (argv[++i]); +#ifdef HAVE_CDL + } else if (strncmp (argv[i], "-proxy", 5) == 0) { + proxy = 1; + vxim->port = DEF_PROXY_PORT; /* re-assign port */ + vxim->input_fifo = ""; /* shut off other connections */ + vxim->unixaddr = "none"; +#endif + } else if (strncmp (argv[i], "-verbose", 2) == 0) { + verbose = 1; + } else if (strncmp (argv[i], "-unix_only", 6) == 0) { + vxim->input_fifo = ""; + vxim->port = 0; + } else if (strncmp (argv[i], "-unix", 5) == 0) { + vxim->unixaddr = argv[++i]; + } + } + +#ifdef HAVE_CDL + /* If we're acting as a proxy server, but can't connect to anything, + * exit. In this case it is required that the servers be running + * before starting the proxy program so we have a connection waiting. + */ + if (!nclients && proxy) { + fprintf (stderr, "Error: No servers available for display.\007\n"); + exit (-1); + } +#endif + + /* Initialize the frame buffers */ + vx_initialize (vxim, vxim->def_config, vxim->def_nframes, 1); + + /* Listen for a client connection and initialize the fdset. */ + if (!(nopen = vx_iisopen (vxim))) { + fprintf (stderr, "Error: Cannot open client communications.\007\n"); + exit (-1); + } + FD_ZERO (&allset); + for (i=0; i < nopen; i++) { + chan = &vxim->chan[i]; + FD_SET (chan->datain, &allset); + } + if (!background || interactive) + FD_SET (fileno(stdin), &allset); + + /* Sit in a loop waiting on input, processing the events. */ + while (1) { + fds = allset; /* reset the FD set on each pass */ + + if ((n = select (SELWIDTH, &fds, NULL, NULL, NULL)) > 0) { + + /* Loop over each of the open connections, checking for and + * processing input on any that are ready. + */ + for (i=0; i < nopen; i++) { + chan = &vxim->chan[i]; + fd = chan->datain; + if (FD_ISSET(fd, &fds)) { + + /* Connect the client if not already connected. */ + if (!chan->connected) { + if (verbose) { + if (chan->type == IO_UNIX) + fprintf (stderr, + "connecting client on %s\n", + chan->path); + else if (chan->type == IO_INET) + fprintf (stderr, + "connecting client on port %d\n", + vxim->port); + } + vx_connectClient (chan, &chan->datain); + } + + /* Process any waiting input. */ + vx_iisio (chan, &chan->datain, chan->type); + fflush (stdout); fflush (stderr); + } + } + + /* Check the stdin for an EOF so we can quit gracefully. */ + if (!background) { + if (FD_ISSET(fileno(stdin), &fds)) { + if ((n = read (fileno(stdin), buf, SZ_FNAME)) <= 0) { + /* Shut it down. */ + vx_iisclose (vxim); + exit (0); + } + } + } + + } else if (n < 0) { + fprintf (stderr, "Error: select error\007\n"); + exit (-1); + } + } +} + + + +/* VX_IISOPEN -- Initialize the IIS protocol module and ready the module to + * accept client connections and begin processing client requests. Clients + * may connect to the server using a fifo connection or an internet or + * UNIX domain socket connection. All three types of server ports are + * simultaneously ready to receive client connections. + */ +#ifdef ANSI_FUNC + +static int +vx_iisopen (register VXimDataPtr vxim) +#else + +static int +vx_iisopen (vxim) +register VXimDataPtr vxim; +#endif +{ + int i, port, last_port = (vxim->port + vxim->nports - 1); + int nopen = 0; + + if (open_unix (vxim)) + nopen++; + if (open_fifo (vxim)) + nopen++; + + for (port=vxim->port; port > 0 && port <= last_port; port++) { + if (open_inet (vxim, port)) + nopen++; + } + + return (nopen); +} + + +/* VX_IISCLOSE -- Close down the IIS protocol module. + */ +#ifdef ANSI_FUNC + +static void +vx_iisclose (register VXimDataPtr vxim) +#else + +static void +vx_iisclose (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan = NULL; + register FrameBufPtr fb; + register int i, j; + + for (i=0; i < (sizeof(vxim->chan) / sizeof(vxim->chan[0])); i++) { + chan = &vxim->chan[i]; + + /* Free the in-memory frame buffer rasters. */ + for (j=0; j < vxim->nframes; j++) { + fb = &vxim->frames[j]; + if (keep_raster && fb->framebuf) + free (fb->framebuf); + } + + /* Close the I/O channels. */ + switch (chan->type) { + case IO_FIFO: + if (chan->keepalive >= 0) + close (chan->keepalive); + if (chan->datain >= 0) + close (chan->datain); + if (chan->dataout >= 0) + close (chan->dataout); + chan->type = 0; + if (verbose) + fprintf (stderr, "vximtool: closing fifo connection\n"); + break; + + case IO_INET: + close (chan->datain); + chan->type = 0; + if (verbose) + fprintf (stderr, "vximtool: closing inet socket\n"); + break; + + case IO_UNIX: + close (chan->datain); + unlink (chan->path); + chan->type = 0; + if (verbose) + fprintf (stderr, "vximtool: closing unix socket\n"); + break; + } + } +} + + +/* OPEN_FIFO -- Open the server fifo port and make ready to accept client + * connections and begin processing client requests. There is no client + * yet at this stage. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_fifo (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_fifo (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan; + int datain, dataout; + int keepalive; + + +#if defined(__DARWIN__) || defined (__CYGWIN__) + /* On OS X and Cygwin we don't use fifos. */ + xim->input_fifo = "none"; + return (NULL); +#endif + + /* Setting the input fifo to "none" or the null string disables + * fifo support. + */ + if (!vxim->input_fifo[0] || strcmp(vxim->input_fifo,"none")==0) + return (NULL); + + datain = dataout = -1; + + /* Open the output fifo (which is the client's input fifo). We have + * to open it ourselves first as a client to get around the fifo + * open-no-client error. + */ + if ((datain = open (vxim->input_fifo, O_RDONLY|O_NDELAY)) != -1) { + if ((dataout = open (vxim->input_fifo, O_WRONLY|O_NDELAY)) != -1) + fcntl (dataout, F_SETFL, O_WRONLY); + else + goto done; + close (datain); + } else + goto done; + + /* Open the input stream, a FIFO pseudodevice file used by + * applications to send us commands and data. + */ + if ((datain = open (vxim->output_fifo, O_RDONLY|O_NDELAY)) == -1) + goto done; + else { + /* Clear O_NDELAY for reading. */ + fcntl (datain, F_SETFL, O_RDONLY); + + /* Open the client's output fifo as a pseudo-client to make it + * appear that a client is connected. + */ + keepalive = open (vxim->output_fifo, O_WRONLY); + } +done: + /* Allocate and fill in i/o channel descriptor. */ + if (datain > 0 && dataout > 0 && (chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_FIFO; + chan->datain = datain; + chan->dataout = dataout; + chan->keepalive = keepalive; + chan->connected = 1; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + } else { + fprintf (stderr, "Warning: cannot open %s\n", vxim->output_fifo); + chan = NULL; + } + + /* Register input callback. */ + if (!chan) { + if (datain > 0) + close (datain); + if (dataout > 0) + close (dataout); + } else if (verbose) { + fprintf (stderr, + "vximtool: Open to accept input on fifo: %s\n", + vxim->input_fifo); + } + + return (chan); +} + + +/* OPEN_INET -- Set up a port to be used for incoming client connections + * using internet domain sockets. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_inet (register VXimDataPtr vxim, int port) +#else + +static IoChanPtr +open_inet (vxim, port) +register VXimDataPtr vxim; +int port; +#endif +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_in sockaddr; + + /* Setting the port to zero disables inet socket support. */ + if (port <= 0) + return (NULL); + + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons((short)port); + sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if ((chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_INET; + chan->port = port; + chan->datain = s; + chan->dataout = s; + chan->listen_fd = s; + chan->connected = 0; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + if (verbose) + fprintf (stderr, + "vximtool: Open to accept input on inet: port %d\n", port); + return (chan); + } +err: + fprintf (stderr, "vximtool: cannot open socket on port %d, errno=%d\n", + port, errno); + if (s) + close (s); + return (NULL); +} + + +/* OPEN_UNIX -- Set up a port to be used for incoming client connections + * using unix domain sockets. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_unix (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_unix (vxim) +register VXimDataPtr vxim; +#endif +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_un sockaddr; + char path[256]; + + /* Setting the addr to "none" or the null string disables unix + * socket support. + */ + if (!vxim->unixaddr[0] || strcmp(vxim->unixaddr,"none")==0) + return (NULL); + + /* Get path to be used for the unix domain socket. */ + sprintf (path, vxim->unixaddr, getuid()); + unlink (path); + + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strcpy (sockaddr.sun_path, path); + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if ((chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_UNIX; + chan->datain = s; + chan->dataout = s; + chan->listen_fd = s; + chan->connected = 0; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + strncpy (chan->path, path, SZ_FNAME); + if (verbose) + fprintf (stderr, + "vximtool: Open to accept input on unix: %s\n", path); + return (chan); + } +err: + fprintf (stderr, "vximtool: cannot open socket on port %s, errno=%d\n", + path, errno); + if (s) + close (s); + return (NULL); +} + + +/* VX_CONNECTCLIENT -- Called when a client has attempted a connection on + * a socket port. Accept the connection and set up a new i/o channel to + * communicate with the new client. + */ +#ifdef ANSI_FUNC + +static void +vx_connectClient (IoChanPtr chan, int *source) +#else + +static void +vx_connectClient (chan, source) +IoChanPtr chan; +int *source; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register int s; + + /* Accept connection. */ + if ((s = accept ((int)*source, (struct sockaddr *)0, (int *)0)) < 0) + return; +/* + if (fcntl (s, F_SETFD, O_RDWR|O_NDELAY) < 0) { + close (s); + return; + } +*/ + + /* Allocate and fill in i/o channel descriptor. */ + FD_SET(s, &allset); + chan->datain = s; + chan->dataout = s; + chan->connected = 1; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + + switch (chan->type) { + case IO_INET: + if (verbose) + fprintf (stderr, + "connecting client on port %d\n", chan->port); + case IO_UNIX: + if (verbose && chan->type == IO_UNIX) + fprintf (stderr, + "connecting client on %s\n", chan->path); + } +} + + +/* VX_DISCONNECTCLIENT -- Called to close a client connection when EOF is + * seen on the input port. Close the connection and free the channel + * descriptor. + */ +#ifdef ANSI_FUNC + +static void +vx_disconnectClient (register IoChanPtr chan) +#else + +static void +vx_disconnectClient (chan) +register IoChanPtr chan; +#endif +{ + switch (chan->type) { + case IO_INET: + if (verbose) + fprintf (stderr, + "disconnecting client on port %d\n", chan->port); + case IO_UNIX: + if (verbose && chan->type == IO_UNIX) + fprintf (stderr, + "disconnecting client on %s\n", chan->path); + FD_CLR(chan->datain, &allset); + close (chan->datain); + chan->datain = chan->dataout = chan->listen_fd; + chan->connected = 0; + break; + default: + break; + } +} + + +/* GET_IOCHAN --- Get an i/o channel descriptor. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +get_iochan (register VXimDataPtr vxim) +#else + +static IoChanPtr +get_iochan (vxim) +register VXimDataPtr vxim; +#endif +{ + register int i; + + for (i=0; i < MAX_CLIENTS; i++) + if (!vxim->chan[i].type) + return (&vxim->chan[i]); + + return (NULL); +} + + +/* VX_IISIO -- File i/o callback procedure, called when there is input + * pending on the data stream to the vximtool client. + */ +#ifdef ANSI_FUNC + +static void +vx_iisio (IoChanPtr chan, int *fd_addr, int source) +#else + +static void +vx_iisio (chan, fd_addr, source) +IoChanPtr chan; +int *fd_addr; +int source; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register int sum, i; + register short *p; + int datain = *fd_addr; + int dataout = chan->dataout; + int ndatabytes, nbytes, n, ntrys=0; + struct iism70 iis; + char buf[SZ_FIFOBUF]; + static int errmsg=0, bswap=0; + + + /* Get the IIS header. */ + if ((n = iis_read (datain, (char *)&iis, sizeof(iis))) < sizeof(iis)) { + if (n != 0) + fprintf (stderr, + "vximtool: command input read error, n=%d of %d, errno=%d\n", + n, sizeof(iis), errno); + if (n <= 0) + vx_disconnectClient (chan); + return; + } else if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + + /* Verify the checksum. If it fails swap the bytes and try again. + */ + for (;;) { + for (i=0, sum=0, p=(short *)&iis; i < 8; i++) + sum += *p++; + if ((sum & 0177777) == 0177777) + break; + + if (ntrys++) { + if (!errmsg++) { + fprintf (stderr, "vximtool: bad data header checksum\n"); + if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, "noswap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, " swap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + } + break; + + } else { + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + bswap = !bswap; + } + } + + ndatabytes = -iis.thingct; + if (!(iis.tid & PACKED)) + ndatabytes *= 2; + + if (verbose) { + fprintf (stderr, "%s: ", (source == IO_FIFO ? "fifo" : + (source == IO_INET ? "inet" : "unix"))); + fprintf (stderr, + "subunit=%03o tid=%06o nbytes=%6d x=%06o y=%06o z=%06o t=%06o\n", + iis.subunit & 077, + iis.tid, + ndatabytes, + iis.x & 0177777, + iis.y & 0177777, + iis.z & 0177777, + iis.t & 0177777); + fflush (stdout); + } + + + switch (iis.subunit & 077) { + case FEEDBACK: + /* The feedback unit is used only to clear a frame. + */ + chan->reference_frame = decode_frameno (iis.z & 07777); + vx_eraseFrame (vxim, chan->reference_frame); +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) + cdl_clearFrame (cdl[i]); + } +#endif + if (verbose) + fprintf (stderr, "erase frame %d - ref = %d\n", + decode_frameno(iis.z & 0177777), chan->reference_frame); + break; + + case LUT: + /* Data mode writes to the frame lookup tables are not implemented. + * A command mode write to the LUT subunit is used to connect + * image memories up to the RGB channels, i.e., to select the frame + * to be displayed. We ignore any attempt to assign multiple + * frames to multiple color channels, and just do a simple frame + * select. + */ + if (iis.subunit & COMMAND) { + int frame, z, n; + short x[14]; + + if (iis_read (datain, (char *)x, ndatabytes) == ndatabytes) { + if (bswap) + bswap2 ((char *)x, (char *)x, ndatabytes); + + z = x[0]; + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + frame = max (1, n + 1); + if (frame > vxim->nframes) { + if (frame <= MAX_FRAMES) { +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) { + cdl_setFBConfig (cdl[i], vxim->fb_configno); + cdl_setFrame (cdl[i], frame); + } + } +#endif + set_fbconfig (chan, vxim->fb_configno, frame); + if (verbose) + fprintf (stderr, "set_fbconfig (%d, %d)\n", + vxim->fb_configno, frame); + } else { + fprintf (stderr, "imtool warning: "); + fprintf (stderr, + "attempt to display nonexistent frame %d\n", + frame); + return; + } + } + + vxim->display_frame = frame; + if (verbose) + fprintf (stderr, "set_frame (%d)\n", frame); + return; + } + } + + case MEMORY: + /* Load data into the frame buffer. Data is assumed to be byte + * packed. + */ + if (iis.tid & IIS_READ) { + /* Read from the display. + */ + register FrameBufPtr fb; + unsigned char *ip, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be read from. */ + chan->reference_frame = decode_frameno (iis.z & 0177777); + fb = &vxim->frames[chan->reference_frame-1]; + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + if (x < 0 || x >= vxim->width || y < 0 || y >= vxim->height) { + fprintf (stderr, + "vximtool: attempted read out of bounds on framebuf\n"); + fprintf (stderr, + "read %d bytes at [%d,%d]\n", nbytes, x, y); + memset ((void *)iobuf, 0, min(SZ_IOBUF,nbytes)); + } else { + if (verbose) + fprintf (stderr, "read %d bytes at [%d,%d]\n", + nbytes, x, y); + if (keep_raster) + bcopy(&fb->framebuf[(y * vxim->width)+x], iobuf,nbytes); + else + bzero (iobuf, nbytes); +#ifdef HAVE_CDL + if (proxy) { + unsigned char *pix = (unsigned char *)malloc(SZ_IOBUF); + cdl_readSubRaster (cdl[0], x, + (vxim->height-y-max(1, nbytes/vxim->width)), + min(vxim->width, nbytes), + max(1, nbytes/vxim->width), + &pix); + bcopy(pix, iobuf, nbytes); + vx_flip ((char *)iobuf, min(vxim->width, nbytes), + max(1, nbytes/vxim->width)); + free ((char *)pix); + } +#endif + } + + /* Return the data from the frame buffer. */ + starttime = time(0); + for (nleft=nbytes, ip=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = iis_write (dataout, ip, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) { + fprintf (stderr, "IMTOOL: timeout on write\n"); + break; + } + } else + ip += n; + } + + return; + + } else { + /* Write to the display. + */ + register FrameBufPtr fb; + unsigned char *op, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be written into (encoded with a bit for + * each frame, 01 is frame 1, 02 is frame 2, 04 is frame 3, + * and so on). + */ + chan->reference_frame = decode_frameno (iis.z & 0177777); + fb = &vxim->frames[chan->reference_frame-1]; + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + /* Read the data into the frame buffer. + */ + starttime = time(0); + for (nleft=nbytes, op=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = iis_read (datain, op, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) + break; + } else + op += n; + } + + if (x < 0 || x >= vxim->width || y < 0 || y >= vxim->height) { + fprintf (stderr, + "vximtool: attempted write out of bounds on framebuf\n"); + fprintf (stderr, + "write %d bytes at [%d,%d]\n", nbytes, x, y); + bzero ((void *)iobuf, nbytes); + } else { + if (verbose) + fprintf (stderr, "write %d bytes at x=%d, y=%d\n", + nbytes, x, y); + if (keep_raster) + bcopy(iobuf, &fb->framebuf[(y * vxim->width)+x],nbytes); +#ifdef HAVE_CDL + if (proxy) { + vx_flip ((char *)iobuf, min(vxim->width, nbytes), + max(1, nbytes/vxim->width)); + for (i=0; i < nclients; i++) + cdl_writeSubRaster (cdl[i], x, + (vxim->height-y-max(1, nbytes/vxim->width)), + min(vxim->width, nbytes), + max(1, nbytes/vxim->width), + iobuf); + } +#endif + } + + return; + } + break; + + case WCS: + /* Read or write the WCS for a frame. The frame number to + * which the WCS applies is passed in Z and the frame buffer + * configuration in T. The client changes the frame buffer + * configuration in a WCS set. The WCS text follows the header + * as byte packed ASCII data. + */ + if (iis.tid & IIS_READ) { + /* Return the WCS for the referenced frame. + */ + char emsg[SZ_FNAME]; + char *text; + int frame; + + if ((iis.y & 0177777)) { + /* This is a check by the client on our capabilities. + * Return with a version number which can be used by the + * client. However we write back using the old WCS + * buffer size for compatability. + */ + sprintf (text=emsg, "version=%d", IIS_VERSION); + chan->version = IIS_VERSION; + + iis_write (dataout, text, SZ_OLD_WCSBUF); + if (verbose) + fprintf (stderr, "version query wcs: %s\n",text); + + } else { + frame = decode_frameno (iis.z & 0177777); + chan->reference_frame = frame; + + if (chan->rf_p->frameno <= 0) + strcpy (text=emsg, "[NOSUCHFRAME]\n"); + else + text = chan->rf_p->wcsbuf; + + if ((iis.x & 0177777)) + iis_write (dataout, text, SZ_WCSBUF); + else + iis_write (dataout, text, SZ_OLD_WCSBUF); + + if (verbose) { + fprintf (stderr, "query wcs:\n"); + write (2, text, SZ_WCSBUF); + } + } + + } else { + /* Set the WCS for the referenced frame. + */ + register CtranPtr ct; + int fb_config, frame, new_wcs = 0; + + frame = decode_frameno (iis.z & 0177777); + fb_config = (iis.t & 0777) + 1; + new_wcs = (iis.t & 0777); + + /* See if we need to change the frame buffer configuration, + * or allocate a new frame. + */ + if (fb_config != vxim->fb_configno) { + set_fbconfig (chan, fb_config, frame); +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) { + cdl_setFBConfig (cdl[i], fb_config); + cdl_setFrame (cdl[i], frame); + } + } +#endif + } else if (frame > vxim->nframes && frame < MAX_FRAMES) { + set_fbconfig (chan, vxim->fb_configno, frame); +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) { + cdl_setFBConfig (cdl[i], vxim->fb_configno); + cdl_setFrame (cdl[i], frame); + } + } +#endif + } + + /* Read in and set up the WCS. */ + chan->reference_frame = frame; + memset ((char *)buf, 0, SZ_WCSBUF); + if (iis_read (datain, buf, ndatabytes) == ndatabytes) + strncpy (chan->rf_p->wcsbuf, buf, + (new_wcs ? SZ_WCSBUF : SZ_OLD_WCSBUF)); + + if (verbose) { + fprintf (stderr, "set wcs: nbytes=%d\n", ndatabytes); + write (2, buf, ndatabytes); + } + + strcpy (chan->rf_p->ctran.format, W_DEFFORMAT); + chan->rf_p->ctran.imtitle[0] = '\0'; + chan->rf_p->ctran.valid = 0; + ct = wcs_update (vxim, chan->rf_p); + +#ifdef HAVE_CDL + if (proxy) { + for (i=0; i < nclients; i++) + cdl_setWCS (cdl[i], " ", ct->imtitle, + ct->a, ct->b, ct->c, ct->d, + ct->tx, ct->ty, ct->z1, ct->z2, ct->zt); + } +#endif + + /* Add the mapping information. */ + add_mapping (vxim, ct, chan->rf_p->wcsbuf, + &vxim->frames[chan->reference_frame-1]); + } + return; + + case IMCURSOR: + /* Read or write the logical image cursor. This is an extension + * added to provide a high level cursor read facility; this is + * not the same as a low level access to the IIS cursor subunit. + * Cursor reads may be either nonblocking (immediate) or blocking, + * using the keyboard or mouse to terminate the read, and + * coordinates may be returned in either image (world) or frame + * buffer pixel coordinates. + */ + if (iis.tid & IIS_READ) { + /* Read the logical image cursor. In the case of a blocking + * read all we do is initiate a cursor read; completion occurs + * when the user hits a key or button. + */ + float sx, sy; + + if (verbose) + fprintf (stderr, "read cursor position\n"); + if (iis.tid & IMC_SAMPLE) { + /* Sample the cursor position and return the cursor value + * on the output datastream encoded in a fixed size + * ascii buffer. + */ + int wcs = iis.z; + + sx = cursor_x; + sy = cursor_y; +#ifdef HAVE_CDL + if (proxy) { + char key = ' '; + char curval[SZ_IMCURVAL], keystr[20]; + + cdl_readCursor (cdl[0], 1, &sx, &sy, &key); + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n", + sx, sy, 1, keystr, ""); + } + iis_write (dataout, curval, sizeof(curval)); + } else +#endif + vx_retCursorVal (chan->dataout, sx, sy, wcs, 0, ""); + + } else { + /* Initiate a user triggered cursor read. */ + char key = 'q'; +#ifdef HAVE_CDL + if (proxy) { + char curval[SZ_IMCURVAL], keystr[20]; + + cdl_readCursor (cdl[0], 0, &sx, &sy, &key); + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n\0", + sx, sy, 1, keystr, ""); + } + iis_write (chan->dataout, curval, sizeof(curval)); + } else +#endif + vx_retCursorVal (chan->dataout, 1., 1., 101, key, ""); + } + + } else { + /* Write (set) the logical image cursor position. */ + register CtranPtr ct; + int sx = iis.x, sy = iis.y; + float wx = sx, wy = sy; + int wcs = iis.z; + + if (verbose) + fprintf (stderr, "write cursor position: [%d,%d]\n", sx,sy); + if (wcs) { + ct = wcs_update (vxim, vxim->df_p); + if (ct->valid) { + if (abs(ct->a) > .001) + sx = (wx - ct->tx) / ct->a; + if (abs(ct->d) > .001) + sy = (wy - ct->ty) / ct->d; + } + } + + cursor_x = sx; + cursor_y = sy; +#ifdef HAVE_CDL + if (proxy) + cdl_setCursor (cdl[0], sx, sy, wcs); +#endif + } + return; + + default: + /* Ignore unsupported command input. + */ + fprintf (stderr, "unsupported input: subunit=%03o\n", + iis.subunit & 077); + break; + } + + /* Discard any data following the header. */ + if (!(iis.tid & IIS_READ)) + for (nbytes = ndatabytes; nbytes > 0; nbytes -= n) { + n = (nbytes < SZ_FIFOBUF) ? nbytes : SZ_FIFOBUF; + if ((n = iis_read (datain, buf, n)) <= 0) + break; + } +} + + +/* SET_FBCONFIG -- Set the frame buffer configuration, or add additional + * frames to the current configuration. + */ +#ifdef ANSI_FUNC + +static void +set_fbconfig (IoChanPtr chan, int config, int frame) +#else + +static void +set_fbconfig (chan, config, frame) +IoChanPtr chan; +int config; +int frame; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register FrameBufPtr fb = &vxim->frames[frame-1]; + register int i; + + if (config != vxim->fb_configno) { + /* Change the frame buffer configuration. */ + vx_initialize (vxim, config, + max (vxim->fb_config[config-1].nframes, frame), 1); + + } else if (frame > vxim->nframes) { + /* Add additional frames. */ + for (i=1; i <= frame; i++) { + fb = &vxim->frames[i-1]; + if (fb->frameno != i) + vx_initFrame (vxim, i, frame, &vxim->fb_config[config-1]); + } + } + + chan->reference_frame = frame; +} + + +/* DECODE_FRAMENO -- Decode encoded IIS register frame number. + */ +#ifdef ANSI_FUNC + +static int +decode_frameno (register int z) +#else + +static int +decode_frameno (z) +register int z; +#endif +{ + register int n; + + /* Get the frame number, encoded with a bit for each frame, 01 is + * frame 1, 02 is frame 2, 04 is frame 3, and so on. + */ + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + return (max (1, n + 1)); +} + + +/* BSWAP2 - Move bytes from array "a" to array "b", swapping successive + * pairs of bytes. The two arrays may be the same but may not be offset + * and overlapping. + */ +#ifdef ANSI_FUNC + +static void +bswap2 ( + char *a, + char *b, /* input array */ + int nbytes /* number of bytes to swap */ +) +#else + +static void +bswap2 (a, b, nbytes) +char *a, *b; /* input array */ +int nbytes; /* number of bytes to swap */ +#endif +{ + register char *ip=a, *op=b, *otop; + register unsigned temp; + + /* Swap successive pairs of bytes. + */ + for (otop = op + (nbytes & ~1); op < otop; ) { + temp = *ip++; + *op++ = *ip++; + *op++ = temp; + } + + /* If there is an odd byte left, move it to the output array. + */ + if (nbytes & 1) + *op = *ip; +} + + +/* VX_RETCURSORVAL -- Return the cursor value on the output datastream to + * the client which requested the cursor read. + */ +#ifdef ANSI_FUNC + +static void +vx_retCursorVal ( + register int dataout, + float sx, + float sy, /* cursor screen coordinates */ + int wcs, /* nonzero if WCS coords desired */ + int key, /* keystroke used as trigger */ + char *strval /* optional string value */ +) +#else + +static void +vx_retCursorVal (dataout, sx, sy, wcs, key, strval) +register int dataout; +float sx, sy; /* cursor screen coordinates */ +int wcs; /* nonzero if WCS coords desired */ +int key; /* keystroke used as trigger */ +char *strval; /* optional string value */ +#endif +{ + char curval[SZ_IMCURVAL]; + char keystr[20]; + + /* If running SERVER in interactive mode, allow the user to type + * in the cursor value on the standard input. + */ + if (interactive) { + printf ("enter cursor value string (x y wcs key str): "); + fflush (stdout); + if (fgets (curval, SZ_IMCURVAL, stdin) != NULL) + goto ret; + } + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n", + sx, sy, wcs, keystr, strval); + } +ret: + fprintf (stderr, "%s", curval); + + /* Send it to the client program and terminate cursor mode. */ + write (dataout, curval, sizeof(curval)); +} + + +/* WCS_UPDATE -- Load the screen WCS, if not yet validated, from the user + * wcs file, if any. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". + */ +#ifdef ANSI_FUNC + +static CtranPtr +wcs_update (register VXimDataPtr vxim, FrameBufPtr fr) +#else + +static CtranPtr +wcs_update (vxim, fr) +register VXimDataPtr vxim; +FrameBufPtr fr; +#endif +{ + register CtranPtr ct = &fr->ctran; + char buf[1024], *format; + + /* Get the new WCS. */ + if (!ct->valid) { + fr->label[0] = '\0'; + ct->zt = W_UNITARY; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (fr->wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (fr->wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->valid++; + } + + /* Determine best format for wcs output. */ + if (ct->valid && ct->zt == W_LINEAR) { + float z1, z2, zrange; + z1 = ct->z1; + z2 = ct->z2; + zrange = (z1 > z2) ? z1 - z2 : z2 - z1; + if (zrange < 100.0 && (abs(z1) + abs(z2)) / 2.0 < 200.0) + format = " %7.2f %7.2f %7.3f%c"; + else if (zrange > 99999.0 || (abs(z1) + abs(z2)) / 2.0 > 99999.0) + format = " %7.2f %7.2f %7.3g%c"; + else + format = W_DEFFORMAT; + } else + format = " %7.2f %7.2f %7.0f%c"; + + strcpy (ct->format, format); + return (ct); +} + + +/* VX_INITIALIZE -- Initialize the imaging subsystem. Read the config file + * and create the frame buffers, mappings, and colormaps. + */ +#ifdef ANSI_FUNC + +static void +vx_initialize (register VXimDataPtr vxim, int config, int nframes, int reset) +#else + +static void +vx_initialize (vxim, config, nframes, reset) +register VXimDataPtr vxim; +int config; +int nframes; +int reset; +#endif +{ + if (reset) + get_fbconfig (vxim); + + vxim->fb_configno = config; + vxim->nframes = vxim->fb_config[config].nframes; + vxim->width = vxim->fb_config[config].width; + vxim->height = vxim->fb_config[config].height; + vx_initFrame (vxim, vxim->display_frame, nframes, + &vxim->fb_config[config-1]); +} + + +/* VX_INITFRAME -- Initialize a frame buffer. + */ +#ifdef ANSI_FUNC + +static void +vx_initFrame (register VXimDataPtr vxim, int frame, int nframes, FbConfigPtr config) +#else + +static void +vx_initFrame (vxim, frame, nframes, config) +register VXimDataPtr vxim; +int frame, nframes; +FbConfigPtr config; +#endif +{ + register FrameBufPtr fb = &vxim->frames[frame-1]; + + if (frame < 1 || frame > MAX_FRAMES) + return; + + /* Create the frame buffer. */ + fb->frameno = frame; + if (keep_raster) { + if (fb->framebuf) + free (fb->framebuf); + fb->framebuf = (char *) malloc (config->width * config->height); + } + vxim->width = config->width; + vxim->height = config->height; + vxim->nframes = nframes; +} + +/* VX_ERASEFRAME -- Erase a frame. + */ +#ifdef ANSI_FUNC + +static void +vx_eraseFrame (register VXimDataPtr vxim, int frame) +#else + +static void +vx_eraseFrame (vxim, frame) +register VXimDataPtr vxim; +int frame; +#endif +{ + register FrameBufPtr fb = &vxim->frames[frame-1]; + + if (keep_raster) + bzero (fb->framebuf, vxim->width * vxim->height); +} + + +/* GET_FBCONFIG -- Read the XIMTOOL startup file to get the set of possible + * frame buffer sizes. + * + * File format: configno nframes width height [extra fields] + * e.g., 1 2 512 512 + * 2 2 800 800 + * 3 1 1024 1024 # comment + */ +#ifdef ANSI_FUNC + +static void +get_fbconfig (register VXimDataPtr vxim) +#else + +static void +get_fbconfig (vxim) +register VXimDataPtr vxim; +#endif +{ + register char *ip; + register FILE *fp = NULL; + int config, nframes, width, height, i; + char lbuf[SZ_LINE+1], *fname; + static char *fb_paths[] = { + "/usr/local/lib/imtoolrc", + "/opt/local/lib/imtoolrc", + "/iraf/iraf/dev/imtoolrc", + "/local/lib/imtoolrc", + "/usr/iraf/dev/imtoolrc", + "/usr/local/iraf/dev/imtoolrc", + NULL}; + + /* Initialize the config table. */ + vxim->fb_configno = 1; + for (i=0; i < MAX_FBCONFIG; i++) { + vxim->fb_config[i].nframes = 1; + vxim->fb_config[i].width = DEF_FRAME_WIDTH; + vxim->fb_config[i].height = DEF_FRAME_HEIGHT; + } + + /* Now add in some defaults for commonly used sizes based on the + * standard IRAF imtoolrc file, we'll avoid any instrument specific + * configurations. + */ + vxim->fb_config[0].width = vxim->fb_config[0].height = 512; + vxim->fb_config[1].width = vxim->fb_config[1].height = 800; + vxim->fb_config[2].width = vxim->fb_config[2].height = 1024; + vxim->fb_config[3].width = vxim->fb_config[3].height = 1600; + vxim->fb_config[4].width = vxim->fb_config[4].height = 2048; + vxim->fb_config[5].width = vxim->fb_config[5].height = 4096; + + /* Attempt to open the config file. */ + if ((fname=getenv(FBCONFIG_ENV1)) || (fname=getenv(FBCONFIG_ENV2))) + fp = fopen (fname, "r"); + if (!fp && (fname = getenv ("HOME"))) { + sprintf (lbuf, "%s/%s", fname, FBCONFIG_1); + fp = fopen (fname = lbuf, "r"); + if (fp) { + vxim->imtoolrc = (char *) calloc (strlen(fname+1),sizeof(char)); + strncpy (vxim->imtoolrc, fname, strlen(fname)); + } + } + if (!fp) + fp = fopen (fname = vxim->imtoolrc, "r"); + for (i=0; !fp && fb_paths[i]; i++) { + if ((fp = fopen (fname = fb_paths[i], "r"))) { + vxim->imtoolrc = (char *) calloc (strlen(fb_paths[i]+1), + sizeof(char)); + strncpy (vxim->imtoolrc, fb_paths[i],strlen(fb_paths[i])); + break; + } + } + if (!fp) { + fprintf (stderr, + "Warning: No frame buffer configuration file found.\n"); + return; + } + + + /* Scan the frame buffer configuration file. + */ + while (fgets (lbuf, SZ_LINE, fp) != NULL) { + /* Skip comment lines and blank lines. */ + for (ip=lbuf; *ip == ' ' || *ip == '\t'; ip++) + ; + if (*ip == '\n' || *ip == '#') + continue; + if (!isdigit (*ip)) + continue; + switch (sscanf (ip, "%d%d%d%d", &config,&nframes,&width,&height)) { + case 4: + break; /* normal case */ + case 3: + height = width; /* default to square format */ + break; + default: + fprintf (stderr, "vximtool: bad config `%s'\n", ip); + continue; + } + + nframes = max (1, nframes); + width = max (1, width); + height = max (1, height); + + /* Since the frame buffer is stored in a memory pixrect + * (effectively), the line length should be an integral number + * of 16 bit words. + */ + if (width & 1) { + fprintf (stderr, "imtool warning: fb config %d [%d-%dx%d] - ", + config, nframes, width, height); + fprintf (stderr, "frame width should be even, reset to %d\n", + --width); + } + + config = max(1, min(MAX_FBCONFIG, config)) - 1; + vxim->fb_config[config].nframes = nframes; + vxim->fb_config[config].width = width; + vxim->fb_config[config].height = height; + } + + fclose (fp); +} + + + +/* USAGE -- Print a list of command-line options. + */ +#ifdef ANSI_FUNC + +static void +Usage (void) +#else + +static void +Usage () +#endif +{ + fprintf (stderr, "Usage:\n\n"); + printoption (" vximtool"); + printoption ("[-background]"); /* run in background */ + printoption ("[-config <num>]"); /* initial config */ + printoption ("[-fifo <pipe>]"); /* fifo pipe */ + printoption ("[-fifo_only]"); /* use fifo only */ + printoption ("[-help]"); /* Print help */ + printoption ("[-i]"); /* interactive */ + printoption ("[-imtoolrc <file>]"); /* fbconfig file */ + printoption ("[-inet_only | -port_only]"); /* use inet only */ + printoption ("[-noraster]"); /* don't save pix */ + printoption ("[-nframes <num>]"); /* # of frames */ + printoption ("[-port <num>]"); /* inet port */ + printoption ("[-nports <num>]"); /* No. inet ports */ + printoption ("[-proxy]"); /* run a proxy server */ + printoption ("[-verbose]"); /* verbose output */ + printoption ("[-unix <name>]"); /* unix socket */ + printoption ("[-unix_only]"); /* use unix only */ + fprintf (stderr,"\n"); +} + + +/* PRINTOPTION -- Pretty-print an option string. + */ +static int cpos = 0; +#ifdef ANSI_FUNC + +static void +printoption (char *st) +#else + +static void +printoption(st) +char *st; +#endif +{ + if (strlen(st) + cpos > 78) { + fprintf (stderr,"\n\t"); + cpos = 8; + } + fprintf (stderr,"%s ",st); + cpos = cpos + strlen(st) + 1; +} + + +#ifdef HAVE_CDL +/* VX_FLIP -- Reverse order of lines in raster. + */ + +#ifdef ANSI_FUNC + +static void +vx_flip (char *buffer, int nx, int ny) +#else + +static void +vx_flip (buffer, nx, ny) +char *buffer; +int nx; +int ny; +#endif +{ + register int i, j, v; + register char *buff1, *buff2; + + for (i = 0; i < ny / 2; i++) { + buff1 = &buffer[i*nx]; + buff2 = &buffer[(ny-1-i)*nx]; + for (j = 0; j < nx; j++) { + v = *buff1; + *(buff1++) = *buff2; + *(buff2++) = v; + } + } +} +#endif + + +/* ADD_MAPPING -- Add a mapping for the current frame. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt \n + * region_name sx sy snx sny dx dy dnx dny\n + * object_ref + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". Mapping information is parsed + * elsewhere if needed, our only purpose here is to extract the frame WCS. + */ + +static void +add_mapping (vxim, ctran, wcsbuf, fr) +register VXimDataPtr vxim; +CtranPtr ctran; +char *wcsbuf; +FrameBufPtr fr; +{ + register MappingPtr mp = &fr->mapping[fr->nmaps]; + register CtranPtr ct = &mp->ctran; + register int i, j; + char buf[SZ_WCSBUF], *format; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->zt = W_UNITARY; + ct->valid = 1; + + + mp->ref[0] = '\0'; + mp->region[0] = '\0'; + + /* Skip over the first two lines of WCS data. + */ + strcpy (buf, wcsbuf); + for (i=0, j=0; j < 2 && buf[i]; i++) + if (buf[i] == '\n') + j++; + + /* Attempt to read the mapping. + */ + mp->id = mp->regid = ++objid; + if (sscanf (&buf[i], "%s%f%f%d%d%d%d%d%d\n%s\n", + mp->region, &mp->sx, &mp->sy, &mp->snx, &mp->sny, + &mp->dx, &mp->dy, &mp->dnx, &mp->dny, mp->ref) < 10) { + + if (!wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS mapping\n"); + strncpy (mp->ref, "none", SZ_IMTITLE); + + mp->sx = 1.0; + mp->sy = 1.0; + mp->snx = vxim->width; + mp->sny = vxim->height; + mp->dx = 1; + mp->dy = 1; + mp->dnx = vxim->width; + mp->dny = vxim->height; + } + memmove (ctran, &mp->ctran, sizeof (Ctran)); + + fr->nmaps++; +} + + +/* PRINT_MAPPINGS -- Debug routine to print all mappings on a frame. + */ +print_mappings (fr) +FrameBufPtr fr; +{ + MappingPtr mp; + register int i; + + if (fr->nmaps == 0) printf ("No mappings for frame %d\n", fr->frameno); + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + printf ("Mapping %d frame=%d:\n", fr->nmaps, fr->frameno); + printf ("\t%s %f %f %d %d %d %d %d %d\n\t%s\n", + mp->region, mp->sx, mp->sy, mp->snx, mp->sny, + mp->dx, mp->dy, mp->dnx, mp->dny, mp->ref); + } +} + + +/* IIS_READ -- Read exactly "n" bytes from a descriptor. + */ + +#ifdef ANSI_FUNC +static int +iis_read (int fd, void *vptr, int nbytes) + +#else +static int +iis_read (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +#endif +{ + char *ptr = vptr; + int nread = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = read(fd, ptr, nleft)) < 0) { + if (errno == EINTR) + nb = 0; /* and call read() again */ + else + return(-1); + } else if (nb == 0) + break; /* EOF */ + nleft -= nb; + ptr += nb; + nread += nb; + } + return (nread); /* return no. of bytes read */ +} + + +/* IIS_WRITE -- Write exactly "n" bytes to a descriptor. + */ +#ifdef ANSI_FUNC +static int +iis_write (int fd, void *vptr, int nbytes) + +#else + +static int +iis_write (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +#endif + +{ + char *ptr = vptr; + int nwritten = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = write(fd, ptr, nleft)) <= 0) { + if (errno == EINTR) + nb = 0; /* and call write() again */ + else + return(-1); /* error */ + } + nleft -= nb; + ptr += nb; + nwritten += nb; + } + return (nwritten); +} diff --git a/vendor/x11iraf/vximtool/vximtool.man b/vendor/x11iraf/vximtool/vximtool.man new file mode 100644 index 00000000..fd45b824 --- /dev/null +++ b/vendor/x11iraf/vximtool/vximtool.man @@ -0,0 +1,178 @@ +.\" @(#)vximtool.1 1.1 18-Jun-97 MJF +.TH VXIMTOOL 1 "18 Jun 1997" "IRAF Project" +.SH NAME +vximtool \-- A virtual display server for IRAF IIS protocol clients +.SH SYNOPSIS +\fBvximtool\fP [ \fIoptions\fP ...] + +.SH "DESCRIPTION" +.LP +\fIVXIMTOOL\fR is a image display server process much like \fIXIMTOOL\fR, +except that all it normally does is respond to datastream requests +to read and write to internal frame buffers maintained as arrays in memory. +Multiple frame buffers and frame buffer configurations are supported. It +can be used to debug IIS protocol client programs by printing out the +protocol packets recieved, or can simply be used as a dummy server in cases +where no image display is really needed. + +The \fI-verbose\fR flag will log all datastream requests to the stderr, +otherwise the task runs silently except for error messages. The process is +terminated with an EOF on the stdin, if the task is intended to be run +as a background job the \fI-background\fR flag should be enabled to shut +off the check of the stdin and avoid a "waiting for tty input" message that +would suspend the background job. Frame buffers are maintained as rasters +in memory, up to four frames may currently be defined. If it not necessary +to keep the displayed images in memory (i.e. the client will not need to +read back any subrasters such as when doing overlay graphics), the +\fI-noraster\fR flag can be used to disable the memory rasters. In this +case any image readback will return an array of zero values. + +The default frame buffer size is 512x512, with 2 frames defined initially. +The \fI-config\fR and \fI-nframes\fR flags can be used to change the +startup frame buffers used. The frame buffer configuration table is normally +taken to be /usr/local/lib/imtoolrc but can be overridden by using an +IMTOOLRC environment variable, a \fI$HOME/.imtoolrc\fR file, or +the \fI-imtoolrc\fR command-line flag respectively. The format of the +frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + +and so on. At most 128 frame buffer sizes may be defined, each configuration +may define up to 4 frames, configuration numbers need not be sequential. + +.SH OPTIONS +.TP 5 +.B "-background" +The task will be run in the background so don't listen to STDIN for an +EOF to quit gracefully. +.TP 5 +.B "-config \fInum\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-interactive" +Allow cursor value strings to be typed into the STDIN in response to cursor +read requests from the client. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-noraster" +If set no client data will be stored in memory, and image readback will +return an array of zeroes. +.TP 5 +.B "-nframes \fInum\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-port \fInum\fP" +Set the primary port to listen on for client connections. The default +is 5137. +.TP 5 +.B "-verbose" +If set, print information about all IIS packets headers recieved to the +STDERR stream. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "CLIENT CONNECTIONS" + +\fIVXImtool\fR allows clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument. Values should be specified as the root +pathname to a pair of fifo pipes whose last character is 'i' or 'o', +these characters will be added automatically when opening the pipes. +For example, to use the default pipes the path would be specified as simply +"/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch. +This permits connecting to the server over a remote network connection +anywhere on the Internet. A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch. Legal values should be specified as a filename to be +used for the socket, up to two "%d" fields are allowed and will be replaced +by the userid. An empty string value disables this connection. +.LP +By default \fIvximtool\fR listens simultaneously for client connections on all +three types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + +.SH "COMMUNICATIONS PROTOCOL" + +Clients communicate with \fIvximtool\fR using a protocol developed originally +for IIS (International Imaging Systems) Frame Buffer hardware, the so-called +"IIS protocol"; other more modern protocols will likely be supported in the +future. The IIS protocol is basically a command packet stream with a header +describing the operation to be performed (select frame, load display, read +cursor, etc), and an optional data packet containing e.g. pixels. It is +beyond the scope of this document to describe fully the details of the +protocol; interested users should contact \fIiraf@noao.edu\fP for further +information. + +.SH "EXAMPLES" + +.TP 5 +1) Run the vximtool, logging output to the file named "spool": + + \f(CW% vximtool -verbose >& spool\fR +.TP 5 +2) Run the vximtool in the background, connect only on unix sockets, no output: + + \f(CW% vximtool -b -unix_only &\fR +.TP 5 +3) Don't store images in memory, start with initial 1024x1024 frame buffer: + + \f(CW% vximtool -noraster -config 3\fR +.TP 5 +4) Run the vximtool in the background, taking cursor input from a file: + + \f(CW% vximtool -i < cursor_file &\fR + +.SH SEE ALSO +ximtool(1) +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/vximtool/vximtool.ps b/vendor/x11iraf/vximtool/vximtool.ps new file mode 100644 index 00000000..aa4c686e --- /dev/null +++ b/vendor/x11iraf/vximtool/vximtool.ps @@ -0,0 +1,1569 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Thu Sep 11 15:23:35 1997 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/C{/Courier FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(vximtool)S +1652(\261-)S +1765(A)S +1867(virtual)S +2158(display)S +2477(server)S +2750(for)S +2896(IRAF)S +3154(IIS)S +3306(protocol)S +3669(clients)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(vximtool)S +10 R +1662([)S +10 I +1725(options)S +10 R +2050(...])S +1656 V +9 B +900(DESCRIPTION)S +1776 V +10 I +1260(VXIMTOOL)S +10 R +1793(is)S +1899(a)S +1982(image)S +2265(display)S +2593(server)S +2875(process)S +3213(much)S +3475(like)S +10 I +3665(XIMTOOL)S +10 R +4098(,)S +4163(except)S +4463(that)S +4653(all)S +4793(it)S +4889(normally)S +5290(does)S +5513(is)S +1896 V +1260(respond)S +1632(to)S +1766(datastream)S +2254(requests)S +2637(to)S +2770(read)S +2996(and)S +3195(write)S +3455(to)S +3588(internal)S +3948(frame)S +4235(bu)S +4335 H + (f)show 10 -.5 mul h (f)show +10 R +4396(ers)S +4567(maintained)S +5066(as)S +5204(arrays)S +5502(in)S +2016 V +1260(memory.)S +1682(Multiple)S +2062(frame)S +2329(bu)S +2429 H + (f)show 10 -.5 mul h (f)show +10 R +2490(ers)S +2641(and)S +2820(frame)S +3087(bu)S +3187 H + (f)show 10 -.5 mul h (f)show +10 R +3248(er)S +3360(con\256gurations)S +3967(are)S +4123(supported.)S +4607(It)S +4703(can)S +4876(be)S +5005(used)S +5223(to)S +5336(debug)S +2136 V +1260(IIS)S +1424(protocol)S +1799(client)S +2063(programs)S +2482(by)S +2624(printing)S +2983(out)S +3153(the)S +3317(protocol)S +3692(packets)S +4033(recieved,)S +4436(or)S +4560(can)S +4739(simply)S +5053(be)S +5188(used)S +5412(as)S +5536(a)S +2256 V +1260(dummy)S +1596(server)S +1869(in)S +1977(cases)S +2217(where)S +2490(no)S +2620(image)S +2894(display)S +3213(is)S +3310(really)S +3567(needed.)S +2496 V +1260(The)S +10 I +1448(-verbose)S +10 R +1824(\257ag)S +2007(will)S +2196(log)S +2357(all)S +2490(datastream)S +2955(requests)S +3315(to)S +3426(the)S +3581(stderr,)S +3866(otherwise)S +4287(the)S +4442(task)S +4636(runs)S +4841(silently)S +5170(except)S +5464(for)S +2616 V +1260(error)S +1485(messages.)S +1949(The)S +2136(process)S +2467(is)S +2566(terminated)S +3025(with)S +3234(an)S +3359(EOF)S +3579(on)S +3710(the)S +3863(stdin,)S +4114(if)S +4206(the)S +4359(task)S +4551(is)S +4649(intended)S +5024(to)S +5133(be)S +5258(run)S +5422(as)S +5536(a)S +2736 V +1260(background)S +1772(job)S +1941(the)S +10 I +2104(-background)S +10 R +2655(\257ag)S +2846(should)S +3154(be)S +3289(enabled)S +3640(to)S +3760(shut)S +3969(o)S +4019 H + (f)show 10 -.5 mul h (f)show +10 R +4122(the)S +4286(check)S +4560(of)S +4685(the)S +4849(stdin)S +5086(and)S +5272(avoid)S +5536(a)S +2856 V +1260("waiting)S +1634(for)S +1783(tty)S +1922(input")S +2202(message)S +2573(that)S +2756(would)S +3039(suspend)S +3394(the)S +3549(background)S +4053(job.)S +4269(Frame)S +4557(bu)S +4657 H + (f)show 10 -.5 mul h (f)show +10 R +4718(ers)S +4867(are)S +5021(maintained)S +5497(as)S +2976 V +1260(rasters)S +1554(in)S +1666(memory,)S +2058(up)S +2192(to)S +2305(four)S +2506(frames)S +2812(may)S +3019(currently)S +3414(be)S +3543(de\256ned.)S +3927(If)S +4028(it)S +4119(not)S +4282(necessary)S +4704(to)S +4817(keep)S +5040(the)S +5197(displayed)S +3096 V +1260(images)S +1580(in)S +1695(memory)S +2065(\(i.e.)S +2257(the)S +2416(client)S +2675(will)S +2868(not)S +3033(need)S +3258(to)S +3373(read)S +3581(back)S +3806(any)S +3987(subrasters)S +4423(such)S +4643(as)S +4763(when)S +5016(doing)S +5281(overlay)S +3216 V +1260(graphics\),)S +1690(the)S +10 I +1846(-noraster)S +10 R +2252(\257ag)S +2436(can)S +2608(be)S +2736(used)S +2953(to)S +3066(disable)S +3384(the)S +3541(memory)S +3909(rasters.)S +4259(In)S +4377(this)S +4557(case)S +4763(any)S +4942(image)S +5221(readback)S +3336 V +1260(will)S +1446(return)S +1714(an)S +1838(array)S +2072(of)S +2185(zero)S +2386(values.)S +3576 V +1260(The)S +1448(default)S +1758(frame)S +2023(bu)S +2123 H + (f)show 10 -.5 mul h (f)show +10 R +2184(er)S +2295(size)S +2484(is)S +2585(512x512,)S +2994(with)S +3206(2)S +3290(frames)S +3595(de\256ned)S +3923(initially.)S +4324(The)S +10 I +4513(-con\256g)S +10 R +4824(and)S +10 I +5002(-nframes)S +10 R +5391(\257ags)S +3696 V +1260(can)S +1437(be)S +1570(used)S +1792(to)S +1909(change)S +2230(the)S +2391(startup)S +2702(frame)S +2973(bu)S +3073 H + (f)show 10 -.5 mul h (f)show +10 R +3134(ers)S +3289(used.)S +3566(The)S +3760(frame)S +4031(bu)S +4131 H + (f)show 10 -.5 mul h (f)show +10 R +4192(er)S +4308(con\256guration)S +4880(table)S +5113(is)S +5219(normally)S +3816 V +1260(taken)S +1507(to)S +1616(be)S +1741(/usr/local/lib/imtoolrc)S +2645(but)S +2804(can)S +2973(be)S +3098(overridden)S +3561(by)S +3692(using)S +3941(an)S +4067(IMTOOLRC)S +4621(environment)S +5158(variable,)S +5536(a)S +3936 V +10 I +1260($HOME/.imtoolrc)S +10 R +2029(\256le,)S +2221(or)S +2343(the)S +10 I +2504(-imtoolrc)S +10 R +2915(command-line)S +3531(\257ag)S +3719(respectively.)S +4294(The)S +4487(format)S +4791(of)S +4912(the)S +5072(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +4056 V +1260(con\256guration)S +1823(\256le)S +1981(is)S +4296 V +10 I +1410(con\256gno)S +1784(nframes)S +2136(width)S +2389(height)S +2669([extra)S +2943(\256elds])S +4416 V +10 R +1290(e.g.)S +4536 V +1560(1)S +1670(2)S +1780(512)S +1990(512)S +4656 V +1560(2)S +1670(2)S +1780(800)S +1990(800)S +4776 V +1560(3)S +1670(1)S +1750(1024)S +1980(1024)S +2480(#)S +2560(comment)S +5016 V +1260(and)S +1434(so)S +1553(on.)S +1738(At)S +1868(most)S +2093(128)S +2273(frame)S +2536(bu)S +2636 H + (f)show 10 -.5 mul h (f)show +10 R +2697(er)S +2805(sizes)S +3030(may)S +3233(be)S +3358(de\256ned,)S +3708(each)S +3921(con\256guration)S +4485(may)S +4688(de\256ne)S +4963(up)S +5094(to)S +5203(4)S +5284(frames,)S +5136 V +1260(con\256guration)S +1823(numbers)S +2197(need)S +2415(not)S +2573(be)S +2697(sequential.)S +5424 V +9 B +900(OPTIONS)S +5544 V +10 B +1260(-background)S +5664 V +10 R +1510(The)S +1695(task)S +1886(will)S +2072(be)S +2196(run)S +2359(in)S +2467(the)S +2619(background)S +3120(so)S +3239(don't)S +3480(listen)S +3727(to)S +3835(STDIN)S +4159(for)S +4305(an)S +4429(EOF)S +4648(to)S +4756(quit)S +4942(gracefully.)S +5832 V +10 B +1260(-con\256g)S +10 I +1579(num)S +5952 V +10 R +1510(Initial)S +1799(frame)S +2081(bu)S +2181 H + (f)show 10 -.5 mul h (f)show +10 R +2242(er)S +2369(con\256guration)S +2952(number.)S +3362(The)S +3567(default)S +3894(value)S +4160(is)S +4277(1,)S +4402(indicating)S +4852(a)S +4947(512x512)S +5348(frame)S +6072 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(er)S +1778(with)S +1986(2)S +2066(frames.)S +2422(See)S +2596(below)S +2870(for)S +3016(information)S +3518(on)S +3648(the)S +3800(frame)S +4062(bu)S +4162 H + (f)show 10 -.5 mul h (f)show +10 R +4223(ers.)S +6240 V +10 B +1260(-\256fo)S +10 I +1462(pipe)S +6360 V +10 R +1510(Speci\256es)S +1901(the)S +2053(name)S +2299(of)S +2412(the)S +2564(\256fo)S +2733(pipe)S +2936(to)S +3045(be)S +3170(used,)S +3409(the)S +10 I +3562(i)S +10 R +3621(and)S +10 I +3796(o)S +10 R +3877(su)S +3966 H + (f)show 10 -.5 mul h (\256)show +10 R +4050(xes)S +4214(will)S +4401(be)S +4526(added)S +4795(automatically.)S +5425(The)S +6480 V +1510(default)S +1817(pipe)S +2019(names)S +2304(will)S +2490(be)S +2614(/dev/imt1i)S +3056(\(input)S +3325(pipe\))S +3560(and)S +3734(/dev/imt1o)S +4198(\(output)S +4517(pipe\).)S +6648 V +10 B +1260(-\256fo_only)S +6768 V +10 R +1510(If)S +1615(set,)S +1790(only)S +2007(\256fo)S +2185(pipes)S +2435(will)S +2630(be)S +2763(used)S +2985(for)S +3140(communication)S +3801(with)S +4018(a)S +4101(client)S +4363(program,)S +4766(sockets)S +5100(will)S +5296(be)S +5430(dis-)S +6888 V +1510(abled.)S +7056 V +10 B +1260(-help)S +10 R +1510(Print)S +1735(a)S +1809(summary)S +2211(of)S +2324(command)S +2748(line)S +2928(options)S +3253(to)S +3361(the)S +3513(screen.)S +7224 V +10 B +1260(-interactive)S +7704 V +10 R +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(1)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(Allow)S +1792(cursor)S +2073(value)S +2321(strings)S +2620(to)S +2730(be)S +2856(typed)S +3110(into)S +3299(the)S +3454(STDIN)S +3781(in)S +3892(response)S +4274(to)S +4385(cursor)S +4667(read)S +4871(requests)S +5231(from)S +5458(the)S +1080 V +1510(client.)S +1248 V +10 B +1260(-imtoolrc)S +10 I +1683(\256le)S +1368 V +10 R +1510(Speci\256es)S +1923(the)S +2097(frame)S +2381(bu)S +2481 H + (f)show 10 -.5 mul h (f)show +10 R +2542(er)S +2671(con\256guration)S +3257(\256le)S +3438(to)S +3569(be)S +3716(used.)S +4007(See)S +4204(below)S +4501(for)S +4670(information)S +5195(on)S +5348(frame)S +1488 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(ers.)S +1656 V +10 B +1260(-inet_only)S +1776 V +10 R +1510(If)S +1611(set,)S +1782(only)S +1995(inet)S +2180(sockets)S +2509(will)S +2700(be)S +2829(used)S +3047(for)S +3198(communication)S +3855(with)S +4068(a)S +4147(client)S +4404(program,)S +4802(\256fo)S +4976(pipes)S +5222(and)S +5402(unix)S +1896 V +1510(sockets)S +1834(will)S +2020(be)S +2144(disabled.)S +2064 V +10 B +1260(-noraster)S +2184 V +10 R +1510(If)S +1606(set)S +1747(no)S +1877(client)S +2129(data)S +2325(will)S +2511(be)S +2635(stored)S +2909(in)S +3017(memory,)S +3405(and)S +3579(image)S +3853(readback)S +4242(will)S +4428(return)S +4696(an)S +4820(array)S +5054(of)S +5167(zeroes.)S +2352 V +10 B +1260(-nframes)S +10 I +1672(num)S +2472 V +10 R +1510(Speci\256es)S +1913(the)S +2077(number)S +2424(of)S +2549(frame)S +2823(bu)S +2923 H + (f)show 10 -.5 mul h (f)show +10 R +2984(ers)S +3142(to)S +3262(con\256gure)S +3681(at)S +3795(startup.)S +4164(By)S +4323(default)S +4642(there)S +4883(will)S +5081(be)S +5217(2)S +5309(frames)S +2592 V +1510(available,)S +1925(a)S +1999(maximum)S +2435(of)S +2548(4)S +2628(frames)S +2929(are)S +3080(allowed.)S +2760 V +10 B +1260(-port_only)S +2880 V +10 R +1510(Same)S +1770(as)S +10 I +1891(-inet_only)S +10 R +2334(option.)S +2683(If)S +2787(set,)S +2961(only)S +3177(inet)S +3365(sockets)S +3697(will)S +3891(be)S +4023(used)S +4244(for)S +4398(communication)S +5058(with)S +5275(a)S +5358(client)S +3000 V +1510(program.)S +3168 V +10 B +1260(-port)S +10 I +1506(num)S +3288 V +10 R +1510(Set)S +1668(the)S +1820(primary)S +2166(port)S +2357(to)S +2465(listen)S +2712(on)S +2842(for)S +2988(client)S +3240(connections.)S +3802(The)S +3987(default)S +4294(is)S +4391(5137.)S +3456 V +10 B +1260(-verbose)S +3576 V +10 R +1510(If)S +1606(set,)S +1772(print)S +1991(information)S +2493(about)S +2745(all)S +2875(IIS)S +3027(packets)S +3356(headers)S +3690(recieved)S +4057(to)S +4165(the)S +4317(STDERR)S +4731(stream.)S +3744 V +10 B +1260(-unix)S +10 I +1513(name)S +3864 V +10 R +1510(Speci\256es)S +1909(the)S +2069(unix)S +2285(domain)S +2623(socket)S +2916(name)S +3170(to)S +3286(use.)S +3512(A)S +3622("%d")S +3876(in)S +3993(the)S +4154(\256lename)S +4537(will)S +4732(be)S +4865(replaced)S +5241(with)S +5458(the)S +3984 V +1510(user)S +1706(id.)S +4152 V +10 B +1260(-unix_only)S +4272 V +10 R +1510(If)S +1607(set,)S +1774(only)S +1983(unix)S +2192(domain)S +2523(sockets)S +2848(will)S +3035(be)S +3160(used)S +3374(for)S +3521(communication)S +4174(with)S +4383(a)S +4458(client)S +4711(program,)S +5105(inet)S +5286(sockets)S +4392 V +1510(and)S +1684(\256fos)S +1892(will)S +2078(be)S +2202(disabled.)S +4680 V +9 B +900(CLIENT)S +1272(CONNECTIONS)S +4800 V +10 I +1260(VXImtool)S +10 R +1673(allows)S +1964(clients)S +2255(to)S +2363(connect)S +2703(in)S +2811(any)S +2985(of)S +3098(the)S +3250(following)S +3669(ways:)S +4968 V +10 B +1260(\256fo)S +1429(pipes)S +5088 V +10 R +1510(The)S +1706(traditional)S +2158(approach.)S +2589(The)S +2785(default)S +3103(global)S +3394(/dev/imt1[io])S +3963(pipes)S +4215(may)S +4428(be)S +4564(used,)S +4814(or)S +4939(a)S +5025(private)S +5344(set)S +5497(of)S +5208 V +1510(\256fos)S +1731(can)S +1911(be)S +2047(speci\256ed)S +2444(using)S +2703(the)S +10 I +2867(-\256fo)S +10 R +3070(command)S +3506(line)S +3698(argument.)S +4172(Values)S +4491(should)S +4800(be)S +4936(speci\256ed)S +5333(as)S +5458(the)S +5328 V +1510(root)S +1701(pathname)S +2119(to)S +2227(a)S +2301(pair)S +2486(of)S +2599(\256fo)S +2768(pipes)S +3009(whose)S +3294(last)S +3463(character)S +3857(is)S +3954('i')S +4078(or)S +4191('o',)S +4362(these)S +4597(characters)S +5030(will)S +5217(be)S +5342(added)S +5448 V +1510(automatically)S +2099(when)S +2360(opening)S +2727(the)S +2894(pipes.)S +3175(For)S +3359(example,)S +3767(to)S +3890(use)S +4068(the)S +4234(default)S +4555(pipes)S +4810(the)S +4976(path)S +5192(would)S +5486(be)S +5568 V +1510(speci\256ed)S +1895(as)S +2008(simply)S +2311("/dev/imt1".)S +2832(A)S +2934(value)S +3180(of)S +3293("none")S +3599(disables)S +3951(this)S +4126(connection.)S +5736 V +10 B +1260(tcp/ip)S +1535(sockets)S +5856 V +10 R +1510(Clients)S +1836(connect)S +2188(via)S +2352(a)S +2438(tcp/ip)S +2708(socket.)S +3030(The)S +3227(default)S +3546(port)S +3749(is)S +10 I +3858(5137)S +10 R +4058(,)S +4125(or)S +4250(a)S +4337(custom)S +4669(port)S +4873(may)S +5088(be)S +5225(speci\256ed)S +5976 V +1510(using)S +1760(the)S +10 I +1915(-port)S +10 R +2148(command)S +2575(line)S +2758(switch.)S +3107(This)S +3318(permits)S +3650(connecting)S +4120(to)S +4230(the)S +4384(server)S +4659(over)S +4868(a)S +4944(remote)S +5253(network)S +6096 V +1510(connection)S +1978(anywhere)S +2395(on)S +2525(the)S +2677(Internet.)S +3072(A)S +3174(port)S +3365(number)S +3700(of)S +3813(0)S +3893(\(zero\))S +4160(disables)S +4512(this)S +4687(connection.)S +6264 V +10 B +1260(unix)S +1480(domain)S +1833(sockets)S +6384 V +10 R +1510(Like)S +1733(a)S +1817(tcp/ip)S +2085(socket,)S +2405(but)S +2573(limited)S +2898(to)S +3017(a)S +3102(single)S +3382(host)S +3590(system.)S +3934(Usually)S +4286(faster)S +4548(than)S +4761(a)S +4846(tcp/ip)S +5115(socket,)S +5436(and)S +6504 V +1510(comparable)S +2008(to)S +2119(a)S +2196(\256fo.)S +2393(By)S +2543(default)S +2853(each)S +3068(user)S +3267(gets)S +3460(their)S +3675(own)S +3879(unix)S +4089(domain)S +4421(socket,)S +4733(so)S +4854(this)S +5031(option)S +5319(allows)S +6624 V +1510(multiple)S +1882(users)S +2125(to)S +2241(run)S +2413(ximtools)S +2803(on)S +2942(the)S +3103(same)S +3347(host)S +3553(without)S +3898(having)S +4209(to)S +4326(customize)S +4770(things.)S +5109(The)S +5303(default)S +6744 V +1510(value)S +1758(is)S +1857("/tmp/.IMT%d",)S +2549(other)S +2785(sockets)S +3110(may)S +3313(be)S +3438(de\256ned)S +3763(using)S +4011(the)S +10 I +4164(-unix)S +10 R +4400(command)S +4825(line)S +5006(switch.)S +5353(Legal)S +6864 V +1510(values)S +1813(should)S +2128(be)S +2270(speci\256ed)S +2673(as)S +2804(a)S +2896(\256lename)S +3288(to)S +3414(be)S +3557(used)S +3789(for)S +3954(the)S +4125(socket,)S +4454(up)S +4603(to)S +4730(two)S +4929("%d")S +5193(\256elds)S +5459(are)S +6984 V +1510(allowed)S +1856(and)S +2030(will)S +2216(be)S +2340(replaced)S +2707(by)S +2837(the)S +2989(userid.)S +3288(An)S +3440(empty)S +3720(string)S +3978(value)S +4224(disables)S +4576(this)S +4751(connection.)S +7680 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(2)S +7920 V +EP +%%Page: 3 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(VXIMTOOL)S +1448(\()S +1497(1)S +1563(\))S +2787(USER COMMANDS )S +4884(VXIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(By)S +1408(default)S +10 I +1716(vximtool)S +10 R +2091(listens)S +2378(simultaneously)S +3015(for)S +3162(client)S +3415(connections)S +3923(on)S +4054(all)S +4186(three)S +4417(types)S +4660(of)S +4775(ports.)S +5092(Clients)S +5408(may)S +1080 V +1260(connect)S +1614(simultaneously)S +2264(by)S +2408(di)S +2486 H + (f)show 10 -.5 mul h (f)show +10 R +2547(erent)S +2790(means)S +3089(allowing)S +3483(up)S +3627(to)S +3748(three)S +3990(di)S +4068 H + (f)show 10 -.5 mul h (f)show +10 R +4129(erent)S +4371(displays)S +4742(to)S +4863(be)S +5000(loading)S +5343(at)S +5458(the)S +1200 V +1260(same)S +1495(time)S +1703(into)S +1889(di)S +1967 H + (f)show 10 -.5 mul h (f)show +10 R +2028(erent)S +2257(frames.)S +1488 V +9 B +900(COMMUNICATIONS)S +1807(PROTOCOL)S +1608 V +10 R +1260(Clients)S +1583(communicate)S +2160(with)S +10 I +2377(vximtool)S +10 R +2760(using)S +3016(a)S +3099(protocol)S +3471(developed)S +3920(originally)S +4348(for)S +4503(IIS)S +4664(\(International)S +5247(Imaging)S +1728 V +1260(Systems\))S +1659(Frame)S +1946(Bu)S +2063 H + (f)show 10 -.5 mul h (f)show +10 R +2124(er)S +2232(hardware,)S +2658(the)S +2811(so-called)S +3202("IIS)S +3396(protocol";)S +3829(other)S +4065(more)S +4301(modern)S +4637(protocols)S +5040(will)S +5227(likely)S +5486(be)S +1848 V +1260(supported)S +1687(in)S +1798(the)S +1953(future.)S +2279(The)S +2467(IIS)S +2622(protocol)S +2988(is)S +3088(basically)S +3476(a)S +3553(command)S +3981(packet)S +4275(stream)S +4575(with)S +4787(a)S +4865(header)S +5164(describing)S +1968 V +1260(the)S +1421(operation)S +1837(to)S +1954(be)S +2087(performed)S +2541(\(select)S +2840(frame,)S +3136(load)S +3347(display,)S +3700(read)S +3910(cursor,)S +4223(etc\),)S +4436(and)S +4618(an)S +4750(optional)S +5116(data)S +5320(packet)S +2088 V +1260(containing)S +1712(e.g.)S +1886(pixels.)S +2180(It)S +2271(is)S +2368(beyond)S +2692(the)S +2844(scope)S +3101(of)S +3214(this)S +3390(document)S +3815(to)S +3924(describe)S +4287(fully)S +4507(the)S +4660(details)S +4952(of)S +5066(the)S +5219(protocol;)S +2208 V +1260(interested)S +1678(users)S +1913(should)S +2210(contact)S +10 I +2528(iraf@noao.edu)S +10 R +3164(for)S +3310(further)S +3611(information.)S +2496 V +9 B +900(EXAMPLES)S +2616 V +10 R +1260(1\))S +1373(Run)S +1570(the)S +1722(vximtool,)S +2139(logging)S +2475(output)S +2761(to)S +2869(the)S +3021(\256le)S +3179(named)S +3475("spool":)S +2856 V +10 C +1750(%)S +1870(vximtool)S +2410(-verbose)S +2950(>&)S +3130(spool)S +3024 V +10 R +1260(2\))S +1373(Run)S +1570(the)S +1722(vximtool)S +2114(in)S +2222(the)S +2374(background,)S +2900(connect)S +3240(only)S +3448(on)S +3578(unix)S +3786(sockets,)S +4135(no)S +4265(output:)S +3264 V +10 C +1750(%)S +1870(vximtool)S +2410(-b)S +2590(-unix_only)S +3250(&)S +3432 V +10 R +1260(3\))S +1373(Don't)S +1636(store)S +1860(images)S +2173(in)S +2281(memory,)S +2669(start)S +2871(with)S +3079(initial)S +3343(1024x1024)S +3823(frame)S +4085(bu)S +4185 H + (f)show 10 -.5 mul h (f)show +10 R +4246(er:)S +3672 V +10 C +1750(%)S +1870(vximtool)S +2410(-noraster)S +3010(-config)S +3490(3)S +3840 V +10 R +1260(4\))S +1373(Run)S +1570(the)S +1722(vximtool)S +2114(in)S +2222(the)S +2374(background,)S +2900(taking)S +3180(cursor)S +3459(input)S +3695(from)S +3919(a)S +3993(\256le:)S +4080 V +10 C +1750(%)S +1870(vximtool)S +2410(-i)S +2590(<)S +2710(cursor_file)S +3430(&)S +4368 V +9 B +900(SEE)S +1112(ALSO)S +4488 V +10 R +1260(ximtool\(1\))S +4656 V +9 B +900(COPYRIGHT)S +4776 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(IRAF Project)S +2719(Last change: 18 Jun 1997)S +5530(3)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier +%%Pages: 3 + \ No newline at end of file diff --git a/vendor/x11iraf/vximtool/vximtool_non_cdl.c b/vendor/x11iraf/vximtool/vximtool_non_cdl.c new file mode 100644 index 00000000..d56040dc --- /dev/null +++ b/vendor/x11iraf/vximtool/vximtool_non_cdl.c @@ -0,0 +1,1728 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#ifdef AIXV3 +#include <sys/select.h> +#endif +#include <sys/time.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/un.h> +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> + +/* + * VXIMTOOL.C -- Virtual image display server. This is a server process much + * like XIMTOOL, except that all the process does is respond to datastream + * requests to read and write to internal frame buffers maintained as arrays + * in memory. Multiple frame buffers and frame buffer configurations are + * supported. A log is kept to the stderr of all datastream requests. The + * process is terminated with an EOF on the stdin. + * + * Used to debug server i/o - NOT USED IN THE ONLINE PROGRAMS. + * + * To build: cc vximtool.c -o vximtool + * cc vximtool.c -o vximtool -lsocket # For Solaris systems + * cc -DANSI_FUNC vximtool.c # Use ANSI function prototypes + * + * Usage: vximtool -verbose >& spool # run server, log output + * vximtool -i # run interactively + * vximtool -noraster # don't store images in memory + * vximtool -i < cursor_file # take cursor input from file + * + * Options + * + * vximtool [-background] [-config <num>] [-fifo <pipe>] [-fifo_only] [-help] + * [-i] [-imtoolrc <file>] [-inet_only | -port_only] [-noraster] + * [-nframes <num>] [-port <num>] [-verbose] [-unix <name>] [-unix_only] + * + * Minimal match for command line options may be used. In interactive mode, + * cursor value strings may be typed in on the server stdin in response to + * cursor read requests from the client. Otherwise, a constant cursor value + * "1.0 1.0 101 q" is returned. + */ + + +/* Default values, size limiting values. + */ +#define MAX_FBCONFIG 128 /* max possible frame buf sizes */ +#define MAX_FRAMES 16 /* max number of frames */ +#define MAX_CLIENTS 8 /* max display server clients */ +#define DEF_NFRAMES 1 /* save memory; only one frame */ +#define DEF_FRAME_WIDTH 512 /* 512 square frame */ +#define DEF_FRAME_HEIGHT 512 /* 512 square frame */ + +#define SZ_LABEL 256 /* main frame label string */ +#define SZ_IMTITLE 128 /* image title string */ +#define SZ_WCSBUF 320 /* WCS text buffer size */ +#define SZ_FIFOBUF 4000 /* transfer size for FIFO i/o */ +#define SZ_FNAME 256 +#define SZ_LINE 256 + +/* Magic numbers. */ +#define DEF_PORT 5137 /* default tcp/ip socket */ +#define I_DEVNAME "/dev/imt1o" /* pseudo device names */ +#define O_DEVNAME "/dev/imt1i" /* our IN is client's OUT */ +#define DEF_UNIXADDR "/tmp/.IMT%d" /* default unix socket */ +#define FBCONFIG_1 ".imtoolrc" +#define FBCONFIG_2 "/usr/local/lib/imtoolrc" +#define FBCONFIG_ENV1 "imtoolrc" +#define FBCONFIG_ENV2 "IMTOOLRC" + +/* IIS definitions. */ +#define IO_TIMEOUT 30 +#define MAXCONN 5 +#define SZ_IOBUF 65536 /* max size data transfer */ +#define SZ_FIFOBUF 4000 +#define SZ_WCSBUF 320 /* WCS text buffer size */ +#define SZ_FNAME 256 +#define SZ_IMCURVAL 160 + +#define MEMORY 01 /* frame buffer i/o */ +#define LUT 02 /* lut i/o */ +#define FEEDBACK 05 /* used for frame clears */ +#define IMCURSOR 020 /* logical image cursor */ +#define WCS 021 /* used to set WCS */ + +#define PACKED 0040000 +#define COMMAND 0100000 +#define IIS_READ 0100000 +#define IMC_SAMPLE 0040000 +#define IMT_FBCONFIG 077 +#define XYMASK 077777 + +struct iism70 { /* DO NOT change the order of */ + short tid; /* this structure. */ + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; +}; + +/* IIS data pixel values. */ +#define CMS_DATASTART 1 +#define CMS_DATAEND 200 +#define CMS_DATARANGE 200 + +/* WCS definitions. */ +#define W_UNITARY 0 +#define W_LINEAR 1 +#define W_LOG 2 +#define W_DEFFORMAT " %7.2f %7.2f %7.1f%c" + +/* Rotation matrix defining world coordinate system (WCS) of a frame. */ +typedef struct { + int valid; /* has WCS been set? */ + float a, b; /* x, y scale factors */ + float c, d; /* x, y cross factors */ + float tx, ty; /* x, y translation */ + float z1, z2; /* greyscale range */ + int zt; /* greyscale mapping */ + char format[32]; /* wcs output format */ + char imtitle[SZ_IMTITLE+1]; /* image title from WCS */ +} Ctran, *CtranPtr; + +/* The frame buffers. */ +typedef struct { + int frameno; /* frame number */ + char *framebuf; /* frame buffer raster */ + char label[SZ_LABEL+1]; /* frame label string */ + Ctran ctran; /* world coordinate system */ + char wcsbuf[SZ_WCSBUF]; /* wcs info string */ +} FrameBuf, *FrameBufPtr; + +/* Possible frame buffer sizes. */ +typedef struct { + int nframes; /* number of frames */ + int width; /* frame buffer width */ + int height; /* frame buffer height */ +} FbConfig, *FbConfigPtr; + +/* Client I/O channel. */ +typedef struct { + void *vxim; /* backpointer to vxim descriptor */ + int type; /* channel type */ + int listen_fd; /* socket server fd */ + int datain; /* input channel */ + int dataout; /* output channel */ + int keepalive; /* used to keep input fifo ready */ + int connected; /* channel is connected to client */ + int port; /* inet port number */ + char path[SZ_FNAME+1]; /* for unix sockets */ + int reference_frame; /* reference (cmd i/o) frame */ + FrameBufPtr rf_p; /* reference frame descriptor */ +} IoChan, *IoChanPtr; + +#define IO_FIFO 1 +#define IO_INET 2 +#define IO_UNIX 3 + + +/* Application runtime descriptor. + * -------------------------------- + */ +typedef struct { + int def_config; /* default FB config */ + int def_nframes; /* default number of frames */ + char *imtoolrc; /* imtoolrc file name */ + char *input_fifo; /* client's output */ + char *output_fifo; /* client's input */ + char *unixaddr; /* format for unix socket path */ + int port; /* port for INET socket */ + + /* Internal state. */ + int display_frame; /* currently displayed frame */ + int fb_configno; /* current config number */ + int nframes; /* current number of frame bufs */ + int width, height; /* current width, height */ + IoChan chan[MAX_CLIENTS]; /* client i/o descriptors */ + FrameBufPtr df_p; /* display frame descriptor */ + FrameBuf frames[MAX_FRAMES]; /* array of frame descriptors */ + FbConfig fb_config[MAX_FBCONFIG]; /* fb config table */ + +} VXimData, *VXimDataPtr; + + +/* Initialize the structure with out starting values. These can be reset + * with command line options. + */ +VXimData server_data = { + 1, /* def_config */ + DEF_NFRAMES, /* def_nframes */ + FBCONFIG_2, /* def_imtoolrc */ + O_DEVNAME, /* input_fifo */ + I_DEVNAME, /* output_fifo */ + DEF_UNIXADDR, /* unixaddr */ + DEF_PORT, /* port */ + 1, /* display_frame */ + 1, /* fb_configno */ + 2, /* nframes */ + 512, 512 /* width, height */ +}; + +/* Functions. + */ +#ifndef abs +#define abs(a) (((a)<0)?(-(a)):(a)) +#endif +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef max +#define max(a,b) ((a)<(b)?(b):(a)) +#endif + +#ifdef SOLARIS +#define bzero(a,n) memset(a,0,n) +#define bcopy(a,b,n) memmove(b,a,n) +#endif + +#define SELWIDTH 32 + +extern int errno; +static int verbose = 0; +static int background = 0; +static int interactive = 0; +static int keep_raster = 1; +static float cursor_x = 1.0, cursor_y = 1.0; +static fd_set fds, allset; + + +#ifdef ANSI_FUNC + +int main(int argc, char **argv); +static int vx_iisopen(register VXimDataPtr vxim); +static void vx_iisclose(register VXimDataPtr vxim); +static IoChanPtr open_fifo(register VXimDataPtr vxim); +static IoChanPtr open_inet(register VXimDataPtr vxim); +static IoChanPtr open_unix(register VXimDataPtr vxim); +static void vx_connectClient(IoChanPtr chan, int *source); +static void vx_disconnectClient(register IoChanPtr chan); +static IoChanPtr get_iochan(register VXimDataPtr vxim); +static void vx_iisio(IoChanPtr chan, int *fd_addr, int source); +static void set_fbconfig(IoChanPtr chan, int config, int frame); +static int decode_frameno(register int z); +static int bswap2(char *a, char *b, int nbytes); +static void vx_retCursorVal(register int dataout, float sx, float sy, + int wcs, int key, char *strval); +static CtranPtr wcs_update(register VXimDataPtr vxim, FrameBufPtr fr); +static void vx_initialize(register VXimDataPtr vxim, int config, + int nframes, int reset); +static void vx_initFrame(register VXimDataPtr vxim, int frame, + int nframes, FbConfigPtr config); +static void vx_eraseFrame(register VXimDataPtr vxim, int frame); +static void get_fbconfig(register VXimDataPtr vxim); +static void Usage(void); +static void printoption(char *st); +static int iis_read(int fd, void *vptr, int nbytes); +static int iis_write(int fd, void *vptr, int nbytes); + +#else + +static void vx_iisclose(), vx_connectClient(), vx_disconnectClient(); +static void vx_iisio(), set_fbconfig(), vx_retCursorVal(); +static void vx_initialize(), vx_initFrame(), vx_eraseFrame(); +static void get_fbconfig(), Usage(), printoption(); +static int vx_iisopen(), decode_frameno(), bswap2(); +static int iis_read(), iis_write(); +static IoChanPtr open_fifo(), open_inet(), open_unix(), get_iochan(); +static CtranPtr wcs_update(); + +#endif + + +/* + * VXIMTOOL -- Virtual display server process. This task is an image display + * server like XImtool, responding to datastream requests on fifo pipes, + * inet sockets, or unix sockets. Up to 16 frames are supported, frame + * buffers may be any of the defined frames in the imtoolrc file. Images + * are stored in memory, allowing readback by the client. Cursor input can + * come from stdin (or a redirected file) allowing the user to respond to + * client cursor requests. The task is terminated with an EOF on stdin. + */ + +#ifdef ANSI_FUNC + +int +main (int argc, char **argv) +#else + +main (argc, argv) +int argc; +char **argv; +#endif +{ + register VXimDataPtr vxim = &server_data; + register IoChanPtr chan; + register int i, nopen, n; + char buf[SZ_FNAME]; + int fd; + + /* Process the command line arguments. */ + for (i=1; i < argc; i++) { + if (strncmp (argv[i], "-background", 2) == 0) { + background = 1; + } else if (strncmp (argv[i], "-config", 2) == 0) { + vxim->def_config = atoi (argv[++i]); + } else if (strncmp (argv[i], "-fifo_only", 6) == 0) { + vxim->unixaddr = "none"; + vxim->port = 0; + } else if (strncmp (argv[i], "-fifo", 5) == 0) { + vxim->input_fifo = (char *) calloc (SZ_FNAME, sizeof(char)); + vxim->output_fifo = (char *) calloc (SZ_FNAME, sizeof(char)); + sprintf (vxim->input_fifo, "%si", argv[++i]); + sprintf (vxim->output_fifo, "%so", argv[i]); + } else if (strncmp (argv[i], "-help", 2) == 0) { + Usage (); + exit (0); + } else if (strncmp (argv[i], "-imtoolrc", 3) == 0) { + vxim->imtoolrc = argv[++i]; + } else if (strncmp (argv[i], "-inet_only", 3) == 0) { + vxim->input_fifo = ""; + vxim->unixaddr = "none"; + } else if (strcmp (argv[i], "-i") == 0) { + interactive++; + } else if (strncmp (argv[i], "-noraster", 3) == 0) { + keep_raster = 0; + } else if (strncmp (argv[i], "-nframes", 3) == 0) { + i++; + vxim->def_nframes = min (4, atoi (argv[i])); + } else if (strncmp (argv[i], "-port_only", 6) == 0) { + vxim->input_fifo = ""; + vxim->unixaddr = "none"; + } else if (strncmp (argv[i], "-port", 5) == 0) { + vxim->port = atoi (argv[++i]); + } else if (strncmp (argv[i], "-verbose", 2) == 0) { + verbose = 1; + } else if (strncmp (argv[i], "-unix_only", 6) == 0) { + vxim->input_fifo = ""; + vxim->port = 0; + } else if (strncmp (argv[i], "-unix", 5) == 0) { + vxim->unixaddr = argv[++i]; + } + } + + /* Initialize the frame buffers */ + vx_initialize (vxim, vxim->def_config, vxim->def_nframes, 1); + + /* Listen for a client connection and initialize the fdset. */ + if (! (nopen = vx_iisopen (vxim))) + exit (-1); + FD_ZERO (&allset); + for (i=0; i < nopen; i++) { + chan = &vxim->chan[i]; + FD_SET (chan->datain, &allset); + } + if (!background || interactive) + FD_SET (fileno(stdin), &allset); + + /* Sit in a loop waiting on input, processing the events. */ + while (1) { + fds = allset; /* reset the FD set on each pass */ + + if ((n = select (SELWIDTH, &fds, NULL, NULL, NULL)) > 0) { + + /* Loop over each of the open connections, checking for and + * processing input on any that are ready. + */ + for (i=0; i < nopen; i++) { + chan = &vxim->chan[i]; + fd = chan->datain; + if (FD_ISSET(fd, &fds)) { + + /* Connect the client if not already connected. */ + if (!chan->connected) { + if (verbose) { + if (chan->type == IO_UNIX) + fprintf (stderr, + "connecting client on %s\n", + chan->path); + else if (chan->type == IO_INET) + fprintf (stderr, + "connecting client on port %d\n", + vxim->port); + } + vx_connectClient (chan, &chan->datain); + } + + /* Process any waiting input. */ + vx_iisio (chan, &chan->datain, chan->type); + fflush (stdout); fflush (stderr); + } + } + + /* Check the stdin for an EOF so we can quit gracefully. */ + if (!background) { + if (FD_ISSET(fileno(stdin), &fds)) { + if ((n = read (fileno(stdin), buf, SZ_FNAME)) <= 0) { + /* Shut it down. */ + vx_iisclose (vxim); + exit (0); + } + } + } + + } else if (n < 0) { + fprintf (stderr, "select error\n"); + exit (-1); + } + } +} + + + +/* VX_IISOPEN -- Initialize the IIS protocol module and ready the module to + * accept client connections and begin processing client requests. Clients + * may connect to the server using a fifo connection or an internet or + * UNIX domain socket connection. All three types of server ports are + * simultaneously ready to receive client connections. + */ +#ifdef ANSI_FUNC + +static int +vx_iisopen (register VXimDataPtr vxim) +#else + +static int +vx_iisopen (vxim) +register VXimDataPtr vxim; +#endif +{ + int nopen = 0; + + if (open_fifo (vxim)) + nopen++; + if (open_inet (vxim)) + nopen++; + if (open_unix (vxim)) + nopen++; + + return (nopen); +} + + +/* VX_IISCLOSE -- Close down the IIS protocol module. + */ +#ifdef ANSI_FUNC + +static void +vx_iisclose (register VXimDataPtr vxim) +#else + +static void +vx_iisclose (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan = NULL; + register FrameBufPtr fb; + register int i, j; + + for (i=0; i < (sizeof(vxim->chan) / sizeof(vxim->chan[0])); i++) { + chan = &vxim->chan[i]; + + /* Free the in-memory frame buffer rasters. */ + for (j=0; j < vxim->nframes; j++) { + fb = &vxim->frames[j]; + if (keep_raster && fb->framebuf) + free (fb->framebuf); + } + + /* Close the I/O channels. */ + switch (chan->type) { + case IO_FIFO: + if (chan->keepalive >= 0) + close (chan->keepalive); + if (chan->datain >= 0) + close (chan->datain); + if (chan->dataout >= 0) + close (chan->dataout); + chan->type = 0; + break; + + case IO_INET: + close (chan->datain); + chan->type = 0; + break; + + case IO_UNIX: + close (chan->datain); + unlink (chan->path); + chan->type = 0; + break; + } + } +} + + +/* OPEN_FIFO -- Open the server fifo port and make ready to accept client + * connections and begin processing client requests. There is no client + * yet at this stage. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_fifo (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_fifo (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan; + int datain, dataout; + int keepalive; + + /* Setting the input fifo to "none" or the null string disables + * fifo support. + */ + if (!vxim->input_fifo[0] || strcmp(vxim->input_fifo,"none")==0) + return (NULL); + + datain = dataout = -1; + + /* Open the output fifo (which is the client's input fifo). We have + * to open it ourselves first as a client to get around the fifo + * open-no-client error. + */ + if ((datain = open (vxim->input_fifo, O_RDONLY|O_NDELAY)) != -1) { + if ((dataout = open (vxim->input_fifo, O_WRONLY|O_NDELAY)) != -1) + fcntl (dataout, F_SETFL, O_WRONLY); + else + goto done; + close (datain); + } else + goto done; + + /* Open the input stream, a FIFO pseudodevice file used by + * applications to send us commands and data. + */ + if ((datain = open (vxim->output_fifo, O_RDONLY|O_NDELAY)) == -1) + goto done; + else { + /* Clear O_NDELAY for reading. */ + fcntl (datain, F_SETFL, O_RDONLY); + + /* Open the client's output fifo as a pseudo-client to make it + * appear that a client is connected. + */ + keepalive = open (vxim->output_fifo, O_WRONLY); + } +done: + /* Allocate and fill in i/o channel descriptor. */ + if (datain > 0 && dataout > 0 && (chan = get_iochan(vxim))) { + chan->vxim = (void *) vxim; + chan->type = IO_FIFO; + chan->datain = datain; + chan->dataout = dataout; + chan->keepalive = keepalive; + chan->connected = 1; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + } else { + fprintf (stderr, "Warning: cannot open %s\n", vxim->output_fifo); + chan = NULL; + } + + /* Register input callback. */ + if (!chan) { + if (datain > 0) + close (datain); + if (dataout > 0) + close (dataout); + } else if (verbose) { + fprintf (stderr, + "Open to accept input on fifo: %s\n", vxim->input_fifo); + } + + return (chan); +} + + +/* OPEN_INET -- Set up a port to be used for incoming client connections + * using internet domain sockets. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_inet (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_inet (vxim) +register VXimDataPtr vxim; +#endif +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_in sockaddr; + + /* Setting the port to zero disables inet socket support. */ + if (vxim->port <= 0) + return (NULL); + + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons((short)vxim->port); + sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if (chan = get_iochan(vxim)) { + chan->vxim = (void *) vxim; + chan->type = IO_INET; + chan->port = vxim->port; + chan->datain = s; + chan->dataout = s; + chan->listen_fd = s; + chan->connected = 0; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + if (verbose) + fprintf (stderr, + "Open to accept input on inet: port %d\n", vxim->port); + return (chan); + } +err: + fprintf (stderr, "vximtool: cannot open socket on port %d, errno=%d\n", + vxim->port, errno); + if (s) + close (s); + return (NULL); +} + + +/* OPEN_UNIX -- Set up a port to be used for incoming client connections + * using unix domain sockets. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +open_unix (register VXimDataPtr vxim) +#else + +static IoChanPtr +open_unix (vxim) +register VXimDataPtr vxim; +#endif +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_un sockaddr; + char path[256]; + + /* Setting the addr to "none" or the null string disables unix + * socket support. + */ + if (!vxim->unixaddr[0] || strcmp(vxim->unixaddr,"none")==0) + return (NULL); + + /* Get path to be used for the unix domain socket. */ + sprintf (path, vxim->unixaddr, getuid()); + unlink (path); + + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strcpy (sockaddr.sun_path, path); + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if (chan = get_iochan(vxim)) { + chan->vxim = (void *) vxim; + chan->type = IO_UNIX; + chan->datain = s; + chan->dataout = s; + chan->listen_fd = s; + chan->connected = 0; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; + strncpy (chan->path, path, SZ_FNAME); + if (verbose) + fprintf (stderr, + "Open to accept input on unix: %s\n", path); + return (chan); + } +err: + fprintf (stderr, "vximtool: cannot open socket on port %s, errno=%d\n", + path, errno); + if (s) + close (s); + return (NULL); +} + + +/* VX_CONNECTCLIENT -- Called when a client has attempted a connection on + * a socket port. Accept the connection and set up a new i/o channel to + * communicate with the new client. + */ +#ifdef ANSI_FUNC + +static void +vx_connectClient (IoChanPtr chan, int *source) +#else + +static void +vx_connectClient (chan, source) +IoChanPtr chan; +int *source; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register int s; + + /* Accept connection. */ + if ((s = accept ((int)*source, (struct sockaddr *)0, (int *)0)) < 0) + return; + if (fcntl (s, F_SETFD, O_RDWR|O_NDELAY) < 0) { + close (s); + return; + } + + /* Allocate and fill in i/o channel descriptor. */ + FD_SET(s, &allset); + chan->datain = s; + chan->dataout = s; + chan->connected = 1; + chan->reference_frame = 1; + chan->rf_p = &vxim->frames[0]; +} + + +/* VX_DISCONNECTCLIENT -- Called to close a client connection when EOF is + * seen on the input port. Close the connection and free the channel + * descriptor. + */ +#ifdef ANSI_FUNC + +static void +vx_disconnectClient (register IoChanPtr chan) +#else + +static void +vx_disconnectClient (chan) +register IoChanPtr chan; +#endif +{ + switch (chan->type) { + case IO_INET: + if (verbose) + fprintf (stderr, + "disconnecting client on port %d\n", chan->port); + case IO_UNIX: + if (verbose && chan->type == IO_UNIX) + fprintf (stderr, + "disconnecting client on %s\n", chan->path); + FD_CLR(chan->datain, &allset); + close (chan->datain); + chan->datain = chan->dataout = chan->listen_fd; + chan->connected = 0; + break; + default: + break; + } +} + + +/* GET_IOCHAN --- Get an i/o channel descriptor. + */ +#ifdef ANSI_FUNC + +static IoChanPtr +get_iochan (register VXimDataPtr vxim) +#else + +static IoChanPtr +get_iochan (vxim) +register VXimDataPtr vxim; +#endif +{ + register IoChanPtr chan; + register int i; + + for (i=0; i < MAX_CLIENTS; i++) + if (!vxim->chan[i].type) + return (&vxim->chan[i]); + + return (NULL); +} + + +/* VX_IISIO -- File i/o callback procedure, called when there is input + * pending on the data stream to the vximtool client. + */ +#ifdef ANSI_FUNC + +static void +vx_iisio (IoChanPtr chan, int *fd_addr, int source) +#else + +static void +vx_iisio (chan, fd_addr, source) +IoChanPtr chan; +int *fd_addr; +int source; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register int sum, i; + register short *p; + int datain = *fd_addr; + int dataout = chan->dataout; + int ndatabytes, nbytes, n, ntrys=0; + struct iism70 iis; + char buf[SZ_FIFOBUF]; + static int errmsg=0, bswap=0; + + + /* Get the IIS header. */ + if ((n = iis_read (datain, (char *)&iis, sizeof(iis))) < sizeof(iis)) { + if (n <= 0) + vx_disconnectClient (chan); + else + fprintf (stderr, "vximtool: command input read error\n"); + return; + } else if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + + /* Verify the checksum. If it fails swap the bytes and try again. + */ + for (;;) { + for (i=0, sum=0, p=(short *)&iis; i < 8; i++) + sum += *p++; + if ((sum & 0177777) == 0177777) + break; + + if (ntrys++) { + if (!errmsg++) { + fprintf (stderr, "vximtool: bad data header checksum\n"); + if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, "noswap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, " swap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + } + break; + + } else { + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + bswap = !bswap; + } + } + + ndatabytes = -iis.thingct; + if (!(iis.tid & PACKED)) + ndatabytes *= 2; + + if (verbose) { + fprintf (stderr, "%s: ", (source == IO_FIFO ? "fifo" : + (source == IO_INET ? "inet" : "unix"))); + fprintf (stderr, + "subunit=%03o tid=%06o nbytes=%6d x=%06o y=%06o z=%06o t=%06o\n", + iis.subunit & 077, + iis.tid, + ndatabytes, + iis.x & 0177777, + iis.y & 0177777, + iis.z & 0177777, + iis.t & 0177777); + fflush (stdout); + } + + + switch (iis.subunit & 077) { + case FEEDBACK: + /* The feedback unit is used only to clear a frame. + */ + chan->reference_frame = decode_frameno (iis.z & 07777); + vx_eraseFrame (vxim, chan->reference_frame); + if (verbose) + fprintf (stderr, "erase frame %d - ref = %d\n", + decode_frameno(iis.z & 07777), chan->reference_frame); + break; + + case LUT: + /* Data mode writes to the frame lookup tables are not implemented. + * A command mode write to the LUT subunit is used to connect + * image memories up to the RGB channels, i.e., to select the frame + * to be displayed. We ignore any attempt to assign multiple + * frames to multiple color channels, and just do a simple frame + * select. + */ + if (iis.subunit & COMMAND) { + int frame, z, n; + short x[14]; + + if (iis_read (datain, (char *)x, ndatabytes) == ndatabytes) { + if (bswap) + bswap2 ((char *)x, (char *)x, ndatabytes); + + z = x[0]; + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + frame = max (1, n + 1); + if (frame > vxim->nframes) { + if (frame < MAX_FRAMES) { + set_fbconfig (chan, vxim->fb_configno, frame); + if (verbose) + fprintf (stderr, "set_fbconfig (%d, %d)\n", + vxim->fb_configno, frame); + } else { + fprintf (stderr, "vximtool warning: "); + fprintf (stderr, + "attempt to display nonexistent frame %d\n", + frame); + return; + } + } + + vxim->display_frame = frame; + if (verbose) + fprintf (stderr, "set_frame (%d)\n", frame); + return; + } + } + + case MEMORY: + /* Load data into the frame buffer. Data is assumed to be byte + * packed. + */ + if (iis.tid & IIS_READ) { + /* Read from the display. + */ + register FrameBufPtr fb; + unsigned char *ip, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be read from. */ + chan->reference_frame = decode_frameno (iis.z & 07777); + fb = &vxim->frames[chan->reference_frame-1]; + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + if (x < 0 || x >= vxim->width || y < 0 || y >= vxim->height) { + fprintf (stderr, + "vximtool: attempted read out of bounds on framebuf\n"); + fprintf (stderr, + "read %d bytes at [%d,%d]\n", nbytes, x, y); + memset ((void *)iobuf, 0, nbytes); + } else { + if (verbose) + fprintf (stderr, "read %d bytes at [%d,%d]\n", + nbytes, x, y); + if (keep_raster) + bcopy(&fb->framebuf[(y * vxim->width)+x], iobuf, nbytes); + else + bzero (iobuf, nbytes); + } + + /* Return the data from the frame buffer. */ + starttime = time(0); + for (nleft=nbytes, ip=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = iis_write (dataout, ip, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) { + fprintf (stderr, "IMTOOL: timeout on write\n"); + break; + } + } else + ip += n; + } + + return; + + } else { + /* Write to the display. + */ + register FrameBufPtr fb; + unsigned char *op, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be written into (encoded with a bit for + * each frame, 01 is frame 1, 02 is frame 2, 04 is frame 3, + * and so on). + */ + chan->reference_frame = decode_frameno (iis.z & 07777); + fb = &vxim->frames[chan->reference_frame-1]; + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + /* Read the data into the frame buffer. + */ + starttime = time(0); + for (nleft=nbytes, op=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = iis_read (datain, op, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) + break; + } else + op += n; + } + + if (x < 0 || x >= vxim->width || y < 0 || y >= vxim->height) { + fprintf (stderr, + "vximtool: attempted write out of bounds on framebuf\n"); + fprintf (stderr, + "write %d bytes at [%d,%d]\n", nbytes, x, y); + bzero ((void *)iobuf, nbytes); + } else { + if (verbose) + fprintf (stderr, "write %d bytes at x=%d, y=%d\n", + nbytes, x, y); + if (keep_raster) + bcopy(iobuf, &fb->framebuf[(y * vxim->width)+x], nbytes); + } + + return; + } + break; + + case WCS: + /* Read or write the WCS for a frame. The frame number to + * which the WCS applies is passed in Z and the frame buffer + * configuration in T. The client changes the frame buffer + * configuration in a WCS set. The WCS text follows the header + * as byte packed ASCII data. + */ + if (iis.tid & IIS_READ) { + /* Return the WCS for the referenced frame. + */ + char emsg[SZ_FNAME]; + char *text; + int frame; + + frame = decode_frameno (iis.z & 07777); + chan->reference_frame = frame; + + if (chan->rf_p->frameno <= 0) + strcpy (text=emsg, "[NOSUCHFRAME]\n"); + else + text = chan->rf_p->wcsbuf; + + iis_write (dataout, text, SZ_WCSBUF); + + if (verbose) { + fprintf (stderr, "query wcs:\n"); + write (2, text, SZ_WCSBUF); + } + + } else { + /* Set the WCS for the referenced frame. + */ + register CtranPtr ct; + int fb_config, frame; + + frame = decode_frameno (iis.z & 07777); + fb_config = (iis.t & 0777) + 1; + + /* See if we need to change the frame buffer configuration, + * or allocate a new frame. + + if (fb_config == 1) { + if (vxim->fb_config[0].width != vxim->width || + vxim->fb_config[0].height != vxim->height) + set_fbconfig (chan, fb_config, frame); + } else + */ + if (fb_config != vxim->fb_configno) + set_fbconfig (chan, fb_config, frame); + else if (frame > vxim->nframes && frame < MAX_FRAMES) + set_fbconfig (chan, vxim->fb_configno, frame); + + /* Read in and set up the WCS. */ + chan->reference_frame = frame; + if (iis_read (datain, buf, ndatabytes) == ndatabytes) + strncpy (chan->rf_p->wcsbuf, buf, SZ_WCSBUF); + + if (verbose) { + fprintf (stderr, "set wcs:\n"); + write (2, buf, ndatabytes); + } + + strcpy (chan->rf_p->ctran.format, W_DEFFORMAT); + chan->rf_p->ctran.imtitle[0] = '\0'; + chan->rf_p->ctran.valid = 0; + + ct = wcs_update (vxim, chan->rf_p); + } + return; + + case IMCURSOR: + /* Read or write the logical image cursor. This is an extension + * added to provide a high level cursor read facility; this is + * not the same as a low level access to the IIS cursor subunit. + * Cursor reads may be either nonblocking (immediate) or blocking, + * using the keyboard or mouse to terminate the read, and + * coordinates may be returned in either image (world) or frame + * buffer pixel coordinates. + */ + if (iis.tid & IIS_READ) { + /* Read the logical image cursor. In the case of a blocking + * read all we do is initiate a cursor read; completion occurs + * when the user hits a key or button. + */ + if (verbose) + fprintf (stderr, "read cursor position\n"); + if (iis.tid & IMC_SAMPLE) { + /* Sample the cursor position and return the cursor value + * on the output datastream encoded in a fixed size + * ascii buffer. + */ + int wcs = iis.z; + float sx, sy; + + sx = cursor_x; + sy = cursor_y; + vx_retCursorVal (chan->dataout, sx, sy, wcs, 0, ""); + + } else { + /* Initiate a user triggered cursor read. */ + int frame = chan->reference_frame; + char key = 'q'; + vx_retCursorVal (chan->dataout, 1., 1., 101, key, ""); + } + + } else { + /* Write (set) the logical image cursor position. */ + register CtranPtr ct; + int sx = iis.x, sy = iis.y; + float wx = sx, wy = sy; + int wcs = iis.z; + + if (verbose) + fprintf (stderr, "write cursor position: [%d,%d]\n", sx,sy); + if (wcs) { + ct = wcs_update (vxim, vxim->df_p); + if (ct->valid) { + if (abs(ct->a) > .001) + sx = (wx - ct->tx) / ct->a; + if (abs(ct->d) > .001) + sy = (wy - ct->ty) / ct->d; + } + } + + cursor_x = sx; + cursor_y = sy; + } + return; + + default: + /* Ignore unsupported command input. + */ + break; + } + + /* Discard any data following the header. */ + if (!(iis.tid & IIS_READ)) + for (nbytes = ndatabytes; nbytes > 0; nbytes -= n) { + n = (nbytes < SZ_FIFOBUF) ? nbytes : SZ_FIFOBUF; + if ((n = iis_read (datain, buf, n)) <= 0) + break; + } +} + + +/* SET_FBCONFIG -- Set the frame buffer configuration, or add additional + * frames to the current configuration. + */ +#ifdef ANSI_FUNC + +static void +set_fbconfig (IoChanPtr chan, int config, int frame) +#else + +static void +set_fbconfig (chan, config, frame) +IoChanPtr chan; +int config; +int frame; +#endif +{ + register VXimDataPtr vxim = (VXimDataPtr) chan->vxim; + register FrameBufPtr fb = &vxim->frames[frame-1]; + register int i; + + if (config != vxim->fb_configno) { + /* Change the frame buffer configuration. */ + vx_initialize (vxim, config, + max (vxim->fb_config[config-1].nframes, frame), 1); + + } else if (frame > vxim->nframes) { + /* Add additional frames. */ + for (i=1; i <= frame; i++) { + fb = &vxim->frames[i-1]; + if (fb->frameno != i) + vx_initFrame (vxim, i, frame, &vxim->fb_config[config-1]); + } + } + + chan->reference_frame = frame; +} + + +/* DECODE_FRAMENO -- Decode encoded IIS register frame number. + */ +#ifdef ANSI_FUNC + +static int +decode_frameno (register int z) +#else + +static int +decode_frameno (z) +register int z; +#endif +{ + register int n; + + /* Get the frame number, encoded with a bit for each frame, 01 is + * frame 1, 02 is frame 2, 04 is frame 3, and so on. + */ + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + return (max (1, n + 1)); +} + + +/* BSWAP2 - Move bytes from array "a" to array "b", swapping successive + * pairs of bytes. The two arrays may be the same but may not be offset + * and overlapping. + */ +#ifdef ANSI_FUNC + +static int +bswap2 ( + char *a, + char *b, /* input array */ + int nbytes /* number of bytes to swap */ +) +#else + +static int +bswap2 (a, b, nbytes) +char *a, *b; /* input array */ +int nbytes; /* number of bytes to swap */ +#endif +{ + register char *ip=a, *op=b, *otop; + register unsigned temp; + + /* Swap successive pairs of bytes. + */ + for (otop = op + (nbytes & ~1); op < otop; ) { + temp = *ip++; + *op++ = *ip++; + *op++ = temp; + } + + /* If there is an odd byte left, move it to the output array. + */ + if (nbytes & 1) + *op = *ip; +} + + +/* VX_RETCURSORVAL -- Return the cursor value on the output datastream to + * the client which requested the cursor read. + */ +#ifdef ANSI_FUNC + +static void +vx_retCursorVal ( + register int dataout, + float sx, + float sy, /* cursor screen coordinates */ + int wcs, /* nonzero if WCS coords desired */ + int key, /* keystroke used as trigger */ + char *strval /* optional string value */ +) +#else + +static void +vx_retCursorVal (dataout, sx, sy, wcs, key, strval) +register int dataout; +float sx, sy; /* cursor screen coordinates */ +int wcs; /* nonzero if WCS coords desired */ +int key; /* keystroke used as trigger */ +char *strval; /* optional string value */ +#endif +{ + char curval[SZ_IMCURVAL]; + char keystr[20]; + + /* If running SERVER in interactive mode, allow the user to type + * in the cursor value on the standard input. + */ + if (interactive) { + printf ("enter cursor value string (x y wcs key str): "); + fflush (stdout); + if (fgets (curval, SZ_IMCURVAL, stdin) != NULL) + goto ret; + } + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n", + sx, sy, wcs, keystr, strval); + } +ret: + fprintf (stderr, "%s", curval); + + /* Send it to the client program and terminate cursor mode. */ + write (dataout, curval, sizeof(curval)); +} + + +/* WCS_UPDATE -- Load the screen WCS, if not yet validated, from the user + * wcs file, if any. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". + */ +#ifdef ANSI_FUNC + +static CtranPtr +wcs_update (register VXimDataPtr vxim, FrameBufPtr fr) +#else + +static CtranPtr +wcs_update (vxim, fr) +register VXimDataPtr vxim; +FrameBufPtr fr; +#endif +{ + register CtranPtr ct = &fr->ctran; + char buf[1024], *format; + + /* Get the new WCS. */ + if (!ct->valid) { + fr->label[0] = '\0'; + ct->zt = W_UNITARY; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (fr->wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (fr->wcsbuf[0]) + fprintf (stderr, "vximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->valid++; + } + + /* Determine best format for wcs output. */ + if (ct->valid && ct->zt == W_LINEAR) { + float z1, z2, zrange; + z1 = ct->z1; + z2 = ct->z2; + zrange = (z1 > z2) ? z1 - z2 : z2 - z1; + if (zrange < 100.0 && (abs(z1) + abs(z2)) / 2.0 < 200.0) + format = " %7.2f %7.2f %7.3f%c"; + else if (zrange > 99999.0 || (abs(z1) + abs(z2)) / 2.0 > 99999.0) + format = " %7.2f %7.2f %7.3g%c"; + else + format = W_DEFFORMAT; + } else + format = " %7.2f %7.2f %7.0f%c"; + + strcpy (ct->format, format); + return (ct); +} + + +/* VX_INITIALIZE -- Initialize the imaging subsystem. Read the config file + * and create the frame buffers, mappings, and colormaps. + */ +#ifdef ANSI_FUNC + +static void +vx_initialize (register VXimDataPtr vxim, int config, int nframes, int reset) +#else + +static void +vx_initialize (vxim, config, nframes, reset) +register VXimDataPtr vxim; +int config; +int nframes; +int reset; +#endif +{ + if (reset) + get_fbconfig (vxim); + + vxim->fb_configno = config; + vxim->nframes = vxim->fb_config[config].nframes; + vxim->width = vxim->fb_config[config].width; + vxim->height = vxim->fb_config[config].height; + vx_initFrame (vxim, vxim->display_frame, nframes, + &vxim->fb_config[config-1]); +} + + +/* VX_INITFRAME -- Initialize a frame buffer. + */ +#ifdef ANSI_FUNC + +static void +vx_initFrame (register VXimDataPtr vxim, int frame, int nframes, FbConfigPtr config) +#else + +static void +vx_initFrame (vxim, frame, nframes, config) +register VXimDataPtr vxim; +int frame, nframes; +FbConfigPtr config; +#endif +{ + register FrameBufPtr fb = &vxim->frames[frame-1]; + + if (frame < 1 || frame > MAX_FRAMES) + return; + + /* Create the frame buffer. */ + fb->frameno = frame; + if (keep_raster) { + if (fb->framebuf) + free (fb->framebuf); + fb->framebuf = (char *) malloc (config->width * config->height); + } + vxim->width = config->width; + vxim->height = config->height; + vxim->nframes = nframes; +} + +/* VX_ERASEFRAME -- Erase a frame. + */ +#ifdef ANSI_FUNC + +static void +vx_eraseFrame (register VXimDataPtr vxim, int frame) +#else + +static void +vx_eraseFrame (vxim, frame) +register VXimDataPtr vxim; +int frame; +#endif +{ + register FrameBufPtr fb = &vxim->frames[frame-1]; + + if (keep_raster) + bzero (fb->framebuf, vxim->width * vxim->height); +} + + +/* GET_FBCONFIG -- Read the XIMTOOL startup file to get the set of possible + * frame buffer sizes. + * + * File format: configno nframes width height [extra fields] + * e.g., 1 2 512 512 + * 2 2 800 800 + * 3 1 1024 1024 # comment + */ +#ifdef ANSI_FUNC + +static void +get_fbconfig (register VXimDataPtr vxim) +#else + +static void +get_fbconfig (vxim) +register VXimDataPtr vxim; +#endif +{ + register char *ip; + register FILE *fp = NULL; + int config, nframes, width, height, i; + char lbuf[SZ_LINE+1], *fname; + + /* Initialize the config table. */ + vxim->fb_configno = 1; + for (i=0; i < MAX_FBCONFIG; i++) { + vxim->fb_config[i].nframes = 1; + vxim->fb_config[i].width = DEF_FRAME_WIDTH; + vxim->fb_config[i].height = DEF_FRAME_HEIGHT; + } + + /* Attempt to open the config file. */ + if ((fname=getenv(FBCONFIG_ENV1)) || (fname=getenv(FBCONFIG_ENV2))) + fp = fopen (fname, "r"); + if (!fp && (fname = getenv ("HOME"))) { + sprintf (lbuf, "%s/%s", fname, FBCONFIG_1); + fp = fopen (fname = lbuf, "r"); + } + if (!fp) + fp = fopen (fname = vxim->imtoolrc, "r"); + if (!fp) + return; + + /* Scan the frame buffer configuration file. + */ + lbuf[0] = '\0'; + while (fgets (lbuf, SZ_LINE, fp) != NULL) { + /* Skip comment lines and blank lines. */ + for (ip=lbuf; *ip == ' ' || *ip == '\t'; ip++) + ; + if (*ip == '\n' || *ip == '#') + continue; + if (!isdigit (*ip)) + continue; + switch (sscanf (ip, "%d%d%d%d", &config,&nframes,&width,&height)) { + case 4: + break; /* normal case */ + case 3: + height = width; /* default to square format */ + break; + default: + fprintf (stderr, "vximtool: bad config `%s'\n", ip); + continue; + } + + nframes = max (1, nframes); + width = max (1, width); + height = max (1, height); + + /* Since the frame buffer is stored in a memory pixrect + * (effectively), the line length should be an integral number + * of 16 bit words. + */ + if (width & 1) { + fprintf (stderr, "vximtool warning: fb config %d [%d-%dx%d] - ", + config, nframes, width, height); + fprintf (stderr, "frame width should be even, reset to %d\n", + --width); + } + + config = max(1, min(MAX_FBCONFIG, config)) - 1; + vxim->fb_config[config].nframes = nframes; + vxim->fb_config[config].width = width; + vxim->fb_config[config].height = height; + } + + fclose (fp); +} + + + +/* IIS_READ -- Read exactly "n" bytes from a descriptor. + */ + +#ifdef ANSI_FUNC +static int +iis_read (int fd, void *vptr, int nbytes) + +#else +static int +iis_read (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +#endif +{ + char *ptr = vptr; + int nread = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = read(fd, ptr, nleft)) < 0) { + if (errno == EINTR) + nb = 0; /* and call read() again */ + else + return(-1); + } else if (nb == 0) + break; /* EOF */ + nleft -= nb; + ptr += nb; + nread += nb; + } + return (nread); /* return no. of bytes read */ +} + + +/* IIS_WRITE -- Write exactly "n" bytes to a descriptor. + */ +#ifdef ANSI_FUNC +static int +iis_write (int fd, void *vptr, int nbytes) + +#else + +static int +iis_write (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +#endif + +{ + char *ptr = vptr; + int nwritten = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = write(fd, ptr, nleft)) <= 0) { + if (errno == EINTR) + nb = 0; /* and call write() again */ + else + return(-1); /* error */ + } + nleft -= nb; + ptr += nb; + nwritten += nb; + } + return (nwritten); +} + + +/* USAGE -- Print a list of command-line options. + */ +#ifdef ANSI_FUNC + +static void +Usage (void) +#else + +static void +Usage () +#endif +{ + fprintf (stderr, "Usage:\n\n"); + printoption (" vximtool"); + printoption ("[-config <num>]"); /* initial config */ + printoption ("[-fifo <pipe>]"); /* fifo pipe */ + printoption ("[-fifo_only]"); /* use fifo only */ + printoption ("[-help]"); /* Print help */ + printoption ("[-i]"); /* interactive */ + printoption ("[-imtoolrc <file>]"); /* fbconfig file */ + printoption ("[-inet_only | -port_only]"); /* use inet only */ + printoption ("[-noraster]"); /* don't save pix */ + printoption ("[-nframes <num>]"); /* # of frames */ + printoption ("[-port <num>]"); /* inet port */ + printoption ("[-verbose]"); /* verbose output */ + printoption ("[-unix <name>]"); /* unix socket */ + printoption ("[-unix_only]"); /* use unix only */ + fprintf (stderr,"\n"); +} + + +/* PRINTOPTION -- Pretty-print an option string. + */ +static int cpos = 0; +#ifdef ANSI_FUNC + +static void +printoption (char *st) +#else + +static void +printoption(st) +char *st; +#endif +{ + if (strlen(st) + cpos > 78) { + fprintf (stderr,"\n\t"); + cpos = 8; + } + fprintf (stderr,"%s ",st); + cpos = cpos + strlen(st) + 1; +} + + diff --git a/vendor/x11iraf/xaw3d/AllWidgets.c b/vendor/x11iraf/xaw3d/AllWidgets.c new file mode 100644 index 00000000..0dc7e16d --- /dev/null +++ b/vendor/x11iraf/xaw3d/AllWidgets.c @@ -0,0 +1,124 @@ +/* $XConsortium: AllWidgets.c,v 1.8 94/04/17 20:11:39 kaleb Exp $ */ + +/* + +Copyright (c) 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#include <X11/IntrinsicP.h> +#include <X11/Xmu/WidgetNode.h> + +extern WidgetClass applicationShellWidgetClass; +extern WidgetClass asciiSinkObjectClass; +extern WidgetClass asciiSrcObjectClass; +extern WidgetClass asciiTextWidgetClass; +extern WidgetClass boxWidgetClass; +extern WidgetClass commandWidgetClass; +extern WidgetClass compositeWidgetClass; +extern WidgetClass constraintWidgetClass; +extern WidgetClass coreWidgetClass; +extern WidgetClass dialogWidgetClass; +extern WidgetClass formWidgetClass; +extern WidgetClass gripWidgetClass; +extern WidgetClass labelWidgetClass; +extern WidgetClass layoutWidgetClass; +extern WidgetClass listWidgetClass; +extern WidgetClass menuButtonWidgetClass; +extern WidgetClass objectClass; +extern WidgetClass overrideShellWidgetClass; +extern WidgetClass panedWidgetClass; +extern WidgetClass pannerWidgetClass; +extern WidgetClass portholeWidgetClass; +extern WidgetClass rectObjClass; +extern WidgetClass repeaterWidgetClass; +extern WidgetClass scrollbarWidgetClass; +extern WidgetClass shellWidgetClass; +extern WidgetClass simpleMenuWidgetClass; +extern WidgetClass simpleWidgetClass; +extern WidgetClass smeBSBObjectClass; +extern WidgetClass smeLineObjectClass; +extern WidgetClass smeObjectClass; +extern WidgetClass smeThreeDObjectClass; +extern WidgetClass stripChartWidgetClass; +extern WidgetClass textSinkObjectClass; +extern WidgetClass textSrcObjectClass; +extern WidgetClass textWidgetClass; +extern WidgetClass threeDWidgetClass; +extern WidgetClass toggleWidgetClass; +extern WidgetClass topLevelShellWidgetClass; +extern WidgetClass transientShellWidgetClass; +extern WidgetClass treeWidgetClass; +extern WidgetClass vendorShellWidgetClass; +extern WidgetClass viewportWidgetClass; +extern WidgetClass wmShellWidgetClass; + +XmuWidgetNode XawWidgetArray[] = { +{ "applicationShell", &applicationShellWidgetClass }, +{ "asciiSink", &asciiSinkObjectClass }, +{ "asciiSrc", &asciiSrcObjectClass }, +{ "asciiText", &asciiTextWidgetClass }, +{ "box", &boxWidgetClass }, +{ "command", &commandWidgetClass }, +{ "composite", &compositeWidgetClass }, +{ "constraint", &constraintWidgetClass }, +{ "core", &coreWidgetClass }, +{ "dialog", &dialogWidgetClass }, +{ "form", &formWidgetClass }, +{ "grip", &gripWidgetClass }, +{ "label", &labelWidgetClass }, +{ "layout", &layoutWidgetClass }, +{ "list", &listWidgetClass }, +{ "menuButton", &menuButtonWidgetClass }, +{ "object", &objectClass }, +{ "overrideShell", &overrideShellWidgetClass }, +{ "paned", &panedWidgetClass }, +{ "panner", &pannerWidgetClass }, +{ "porthole", &portholeWidgetClass }, +{ "rect", &rectObjClass }, +{ "repeater", &repeaterWidgetClass }, +{ "scrollbar", &scrollbarWidgetClass }, +{ "shell", &shellWidgetClass }, +{ "simpleMenu", &simpleMenuWidgetClass }, +{ "simple", &simpleWidgetClass }, +{ "smeBSB", &smeBSBObjectClass }, +{ "smeLine", &smeLineObjectClass }, +{ "smeThreeD", &smeThreeDObjectClass }, +{ "sme", &smeObjectClass }, +{ "stripChart", &stripChartWidgetClass }, +{ "textSink", &textSinkObjectClass }, +{ "textSrc", &textSrcObjectClass }, +{ "text", &textWidgetClass }, +{ "threeD", &threeDWidgetClass }, +{ "toggle", &toggleWidgetClass }, +{ "topLevelShell", &topLevelShellWidgetClass }, +{ "transientShell", &transientShellWidgetClass }, +{ "tree", &treeWidgetClass }, +{ "vendorShell", &vendorShellWidgetClass }, +{ "viewport", &viewportWidgetClass }, +{ "wmShell", &wmShellWidgetClass }, +}; + +int XawWidgetCount = XtNumber(XawWidgetArray); + diff --git a/vendor/x11iraf/xaw3d/AllWidgets.h b/vendor/x11iraf/xaw3d/AllWidgets.h new file mode 100644 index 00000000..c71aa91a --- /dev/null +++ b/vendor/x11iraf/xaw3d/AllWidgets.h @@ -0,0 +1,37 @@ +/* + * $XConsortium: AllWidgets.h,v 1.3 94/04/17 20:11:40 jim Exp $ + * +Copyright (c) 1990 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +#ifndef _XawAllWidgets_h +#define _XawAllWidgets_h + +/* + * This file matches the generated AllWidgets.c + */ +extern XmuWidgetNode XawWidgetArray[]; +extern int XawWidgetCount; + +#endif /* _XawAllWidgets_h */ diff --git a/vendor/x11iraf/xaw3d/AsciiSink.c b/vendor/x11iraf/xaw3d/AsciiSink.c new file mode 100644 index 00000000..b427c808 --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiSink.c @@ -0,0 +1,693 @@ +/* $XConsortium: AsciiSink.c,v 1.62 94/04/17 20:11:41 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <stdio.h> + +#include <X11/Xatom.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/AsciiSinkP.h> +#include <X11/Xaw3d/AsciiSrcP.h> /* For source function defs. */ +#include <X11/Xaw3d/TextP.h> /* I also reach into the text widget. */ + +#ifdef GETLASTPOS +#undef GETLASTPOS /* We will use our own GETLASTPOS. */ +#endif + +#define GETLASTPOS XawTextSourceScan(source, (XawTextPosition) 0, XawstAll, XawsdRight, 1, TRUE) + +static void Initialize(), Destroy(); +static Boolean SetValues(); +static int MaxLines(), MaxHeight(); +static void SetTabs(); + +static void DisplayText(), InsertCursor(), FindPosition(); +static void FindDistance(), Resolve(), GetCursorBounds(); + +#define offset(field) XtOffsetOf(AsciiSinkRec, ascii_sink.field) + +static XtResource resources[] = { + {XtNfont, XtCFont, XtRFontStruct, sizeof (XFontStruct *), + offset(font), XtRString, XtDefaultFont}, + {XtNecho, XtCOutput, XtRBoolean, sizeof(Boolean), + offset(echo), XtRImmediate, (XtPointer) True}, + {XtNdisplayNonprinting, XtCOutput, XtRBoolean, sizeof(Boolean), + offset(display_nonprinting), XtRImmediate, (XtPointer) True}, +}; +#undef offset + +#define SuperClass (&textSinkClassRec) +AsciiSinkClassRec asciiSinkClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "AsciiSink", + /* widget_size */ sizeof(AsciiSinkRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* obj1 */ NULL, + /* obj2 */ NULL, + /* obj3 */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* obj4 */ FALSE, + /* obj5 */ FALSE, + /* obj6 */ FALSE, + /* obj7 */ FALSE, + /* destroy */ Destroy, + /* obj8 */ NULL, + /* obj9 */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* obj10 */ NULL, + /* get_values_hook */ NULL, + /* obj11 */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* obj12 */ NULL, + /* obj13 */ NULL, + /* obj14 */ NULL, + /* extension */ NULL + }, +/* text_sink_class fields */ + { + /* DisplayText */ DisplayText, + /* InsertCursor */ InsertCursor, + /* ClearToBackground */ XtInheritClearToBackground, + /* FindPosition */ FindPosition, + /* FindDistance */ FindDistance, + /* Resolve */ Resolve, + /* MaxLines */ MaxLines, + /* MaxHeight */ MaxHeight, + /* SetTabs */ SetTabs, + /* GetCursorBounds */ GetCursorBounds + }, +/* ascii_sink_class fields */ + { + /* unused */ 0 + } +}; + +WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec; + +/* Utilities */ + +static int +CharWidth (w, x, c) +Widget w; +int x; +unsigned char c; +{ + int i, width, nonPrinting; + AsciiSinkObject sink = (AsciiSinkObject) w; + XFontStruct *font = sink->ascii_sink.font; + Position *tab; + + if ( c == XawLF ) return(0); + + if (c == XawTAB) { + /* Adjust for Left Margin. */ + x -= ((TextWidget) XtParent(w))->text.margin.left; + + if (x >= (int)XtParent(w)->core.width) return 0; + for (i = 0, tab = sink->text_sink.tabs ; + i < sink->text_sink.tab_count ; i++, tab++) { + if (x < *tab) { + if (*tab < (int)XtParent(w)->core.width) + return *tab - x; + else + return 0; + } + } + return 0; + } + + if ( (nonPrinting = (c < (unsigned char) XawSP)) ) + if (sink->ascii_sink.display_nonprinting) + c += '@'; + else { + c = XawSP; + nonPrinting = False; + } + + if (font->per_char && + (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2)) + width = font->per_char[c - font->min_char_or_byte2].width; + else + width = font->min_bounds.width; + + if (nonPrinting) + width += CharWidth(w, x, (unsigned char) '^'); + + return width; +} + +/* Function Name: PaintText + * Description: Actually paints the text into the windoe. + * Arguments: w - the text widget. + * gc - gc to paint text with. + * x, y - location to paint the text. + * buf, len - buffer and length of text to paint. + * Returns: the width of the text painted, or 0. + * + * NOTE: If this string attempts to paint past the end of the window + * then this function will return zero. + */ + +static Dimension +PaintText(w, gc, x, y, buf, len) +Widget w; +GC gc; +Position x, y; +unsigned char * buf; +int len; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + TextWidget ctx = (TextWidget) XtParent(w); + + Position max_x; + Dimension width = XTextWidth(sink->ascii_sink.font, (char *) buf, len); + max_x = (Position) ctx->core.width; + + if ( ((int) width) <= -x) /* Don't draw if we can't see it. */ + return(width); + + XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc, + (int) x, (int) y, (char *) buf, len); + if ( (((Position) width + x) > max_x) && (ctx->text.margin.right != 0) ) { + x = ctx->core.width - ctx->text.margin.right; + width = ctx->text.margin.right; + XFillRectangle(XtDisplay((Widget) ctx), XtWindow( (Widget) ctx), + sink->ascii_sink.normgc, (int) x, + (int) y - sink->ascii_sink.font->ascent, + (unsigned int) width, + (unsigned int) (sink->ascii_sink.font->ascent + + sink->ascii_sink.font->descent)); + return(0); + } + return(width); +} + +/* Sink Object Functions */ + +/* + * This function does not know about drawing more than one line of text. + */ + +static void +DisplayText(w, x, y, pos1, pos2, highlight) +Widget w; +Position x, y; +Boolean highlight; +XawTextPosition pos1, pos2; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + Widget source = XawTextGetSource(XtParent(w)); + unsigned char buf[BUFSIZ]; + + int j, k; + XawTextBlock blk; + GC gc = highlight ? sink->ascii_sink.invgc : sink->ascii_sink.normgc; + GC invgc = highlight ? sink->ascii_sink.normgc : sink->ascii_sink.invgc; + + if (!sink->ascii_sink.echo) return; + + y += sink->ascii_sink.font->ascent; + for ( j = 0 ; pos1 < pos2 ; ) { + pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1); + for (k = 0; k < blk.length; k++) { + if (j >= BUFSIZ) { /* buffer full, dump the text. */ + x += PaintText(w, gc, x, y, buf, j); + j = 0; + } + buf[j] = blk.ptr[k]; + if (buf[j] == XawLF) /* line feeds ('\n') are not printed. */ + continue; + + else if (buf[j] == '\t') { + Position temp = 0; + Dimension width; + + if ((j != 0) && ((temp = PaintText(w, gc, x, y, buf, j)) == 0)) + return; + + x += temp; + width = CharWidth(w, x, (unsigned char) '\t'); + XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), + invgc, (int) x, + (int) y - sink->ascii_sink.font->ascent, + (unsigned int) width, + (unsigned int) (sink->ascii_sink.font->ascent + + sink->ascii_sink.font->descent)); + x += width; + j = -1; + } + else if ( buf[j] < (unsigned char) ' ' ) { + if (sink->ascii_sink.display_nonprinting) { + buf[j + 1] = buf[j] + '@'; + buf[j] = '^'; + j++; + } + else + buf[j] = ' '; + } + j++; + } + } + if (j > 0) + (void) PaintText(w, gc, x, y, buf, j); +} + +#define insertCursor_width 6 +#define insertCursor_height 3 +static char insertCursor_bits[] = {0x0c, 0x1e, 0x33}; + +static Pixmap +CreateInsertCursor(s) +Screen *s; +{ + return (XCreateBitmapFromData (DisplayOfScreen(s), RootWindowOfScreen(s), + insertCursor_bits, insertCursor_width, insertCursor_height)); +} + +/* Function Name: GetCursorBounds + * Description: Returns the size and location of the cursor. + * Arguments: w - the text object. + * RETURNED rect - an X rectangle to return the cursor bounds in. + * Returns: none. + */ + +static void +GetCursorBounds(w, rect) +Widget w; +XRectangle * rect; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + + rect->width = (unsigned short) insertCursor_width; + rect->height = (unsigned short) insertCursor_height; + rect->x = sink->ascii_sink.cursor_x - (short) (rect->width / 2); + rect->y = sink->ascii_sink.cursor_y - (short) rect->height; +} + +/* + * The following procedure manages the "insert" cursor. + */ + +static void +InsertCursor (w, x, y, state) +Widget w; +Position x, y; +XawTextInsertState state; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + Widget text_widget = XtParent(w); + XRectangle rect; + + sink->ascii_sink.cursor_x = x; + sink->ascii_sink.cursor_y = y; + + GetCursorBounds(w, &rect); + if (state != sink->ascii_sink.laststate && XtIsRealized(text_widget)) + XCopyPlane(XtDisplay(text_widget), + sink->ascii_sink.insertCursorOn, + XtWindow(text_widget), sink->ascii_sink.xorgc, + 0, 0, (unsigned int) rect.width, (unsigned int) rect.height, + (int) rect.x, (int) rect.y, 1); + sink->ascii_sink.laststate = state; +} + +/* + * Given two positions, find the distance between them. + */ + +static void +FindDistance (w, fromPos, fromx, toPos, resWidth, resPos, resHeight) +Widget w; +XawTextPosition fromPos; /* First position. */ +int fromx; /* Horizontal location of first position. */ +XawTextPosition toPos; /* Second position. */ +int *resWidth; /* Distance between fromPos and resPos. */ +XawTextPosition *resPos; /* Actual second position used. */ +int *resHeight; /* Height required. */ +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + Widget source = XawTextGetSource(XtParent(w)); + + XawTextPosition index, lastPos; + unsigned char c; + XawTextBlock blk; + + /* we may not need this */ + lastPos = GETLASTPOS; + XawTextSourceRead(source, fromPos, &blk, (int) toPos - fromPos); + *resWidth = 0; + for (index = fromPos; index != toPos && index < lastPos; index++) { + if (index - blk.firstPos >= blk.length) + XawTextSourceRead(source, index, &blk, (int) toPos - fromPos); + c = blk.ptr[index - blk.firstPos]; + *resWidth += CharWidth(w, fromx + *resWidth, c); + if (c == XawLF) { + index++; + break; + } + } + *resPos = index; + *resHeight = sink->ascii_sink.font->ascent +sink->ascii_sink.font->descent; +} + + +static void +FindPosition(w, fromPos, fromx, width, stopAtWordBreak, + resPos, resWidth, resHeight) +Widget w; +XawTextPosition fromPos; /* Starting position. */ +int fromx; /* Horizontal location of starting position.*/ +int width; /* Desired width. */ +int stopAtWordBreak; /* Whether the resulting position should be at + a word break. */ +XawTextPosition *resPos; /* Resulting position. */ +int *resWidth; /* Actual width used. */ +int *resHeight; /* Height required. */ +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + Widget source = XawTextGetSource(XtParent(w)); + + XawTextPosition lastPos, index, whiteSpacePosition = 0; + int lastWidth = 0, whiteSpaceWidth = 0; + Boolean whiteSpaceSeen; + unsigned char c; + XawTextBlock blk; + + lastPos = GETLASTPOS; + + XawTextSourceRead(source, fromPos, &blk, BUFSIZ); + *resWidth = 0; + whiteSpaceSeen = FALSE; + c = 0; + for (index = fromPos; *resWidth <= width && index < lastPos; index++) { + lastWidth = *resWidth; + if (index - blk.firstPos >= blk.length) + XawTextSourceRead(source, index, &blk, BUFSIZ); + c = blk.ptr[index - blk.firstPos]; + *resWidth += CharWidth(w, fromx + *resWidth, c); + + if ((c == XawSP || c == XawTAB) && *resWidth <= width) { + whiteSpaceSeen = TRUE; + whiteSpacePosition = index; + whiteSpaceWidth = *resWidth; + } + if (c == XawLF) { + index++; + break; + } + } + if (*resWidth > width && index > fromPos) { + *resWidth = lastWidth; + index--; + if (stopAtWordBreak && whiteSpaceSeen) { + index = whiteSpacePosition + 1; + *resWidth = whiteSpaceWidth; + } + } + if (index == lastPos && c != XawLF) index = lastPos + 1; + *resPos = index; + *resHeight = sink->ascii_sink.font->ascent +sink->ascii_sink.font->descent; +} + +static void +Resolve (w, pos, fromx, width, leftPos, rightPos) +Widget w; +XawTextPosition pos; +int fromx, width; +XawTextPosition *leftPos, *rightPos; +{ + int resWidth, resHeight; + Widget source = XawTextGetSource(XtParent(w)); + + FindPosition(w, pos, fromx, width, FALSE, leftPos, &resWidth, &resHeight); + if (*leftPos > GETLASTPOS) + *leftPos = GETLASTPOS; + *rightPos = *leftPos; +} + +static void +GetGC(sink) +AsciiSinkObject sink; +{ + XtGCMask valuemask = (GCFont | + GCGraphicsExposures | GCForeground | GCBackground ); + XGCValues values; + + values.font = sink->ascii_sink.font->fid; + values.graphics_exposures = (Bool) FALSE; + + values.foreground = sink->text_sink.foreground; + values.background = sink->text_sink.background; + sink->ascii_sink.normgc = XtGetGC((Widget)sink, valuemask, &values); + + values.foreground = sink->text_sink.background; + values.background = sink->text_sink.foreground; + sink->ascii_sink.invgc = XtGetGC((Widget)sink, valuemask, &values); + + values.function = GXxor; + values.background = (unsigned long) 0L; /* (pix ^ 0) = pix */ + values.foreground = (sink->text_sink.background ^ + sink->text_sink.foreground); + valuemask = GCGraphicsExposures | GCFunction | GCForeground | GCBackground; + + sink->ascii_sink.xorgc = XtGetGC((Widget)sink, valuemask, &values); +} + + +/***** Public routines *****/ + +/* Function Name: Initialize + * Description: Initializes the TextSink Object. + * Arguments: request, new - the requested and new values for the object + * instance. + * Returns: none. + * + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + AsciiSinkObject sink = (AsciiSinkObject) new; + + GetGC(sink); + + sink->ascii_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new)); + sink->ascii_sink.laststate = XawisOff; + sink->ascii_sink.cursor_x = sink->ascii_sink.cursor_y = 0; +} + +/* Function Name: Destroy + * Description: This function cleans up when the object is + * destroyed. + * Arguments: w - the AsciiSink Object. + * Returns: none. + */ + +static void +Destroy(w) +Widget w; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + + XtReleaseGC(w, sink->ascii_sink.normgc); + XtReleaseGC(w, sink->ascii_sink.invgc); + XtReleaseGC(w, sink->ascii_sink.xorgc); + XFreePixmap(XtDisplayOfObject(w), sink->ascii_sink.insertCursorOn); +} + +/* Function Name: SetValues + * Description: Sets the values for the AsciiSink + * Arguments: current - current state of the object. + * request - what was requested. + * new - what the object will become. + * Returns: True if redisplay is needed. + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + AsciiSinkObject w = (AsciiSinkObject) new; + AsciiSinkObject old_w = (AsciiSinkObject) current; + + if (w->ascii_sink.font != old_w->ascii_sink.font + || w->text_sink.background != old_w->text_sink.background + || w->text_sink.foreground != old_w->text_sink.foreground) { + XtReleaseGC((Widget)w, w->ascii_sink.normgc); + XtReleaseGC((Widget)w, w->ascii_sink.invgc); + XtReleaseGC((Widget)w, w->ascii_sink.xorgc); + GetGC(w); + ((TextWidget)XtParent(new))->text.redisplay_needed = True; + } else { + if ( (w->ascii_sink.echo != old_w->ascii_sink.echo) || + (w->ascii_sink.display_nonprinting != + old_w->ascii_sink.display_nonprinting) ) + ((TextWidget)XtParent(new))->text.redisplay_needed = True; + } + + return False; +} + +/* Function Name: MaxLines + * Description: Finds the Maximum number of lines that will fit in + * a given height. + * Arguments: w - the AsciiSink Object. + * height - height to fit lines into. + * Returns: the number of lines that will fit. + */ + +/* ARGSUSED */ +static int +MaxLines(w, height) +Widget w; +Dimension height; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + int font_height; + + font_height = sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent; + return( ((int) height) / font_height ); +} + +/* Function Name: MaxHeight + * Description: Finds the Minium height that will contain a given number + * lines. + * Arguments: w - the AsciiSink Object. + * lines - the number of lines. + * Returns: the height. + */ + +/* ARGSUSED */ +static int +MaxHeight(w, lines) +Widget w; +int lines; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + + return(lines * (sink->ascii_sink.font->ascent + + sink->ascii_sink.font->descent)); +} + +/* Function Name: SetTabs + * Description: Sets the Tab stops. + * Arguments: w - the AsciiSink Object. + * tab_count - the number of tabs in the list. + * tabs - the text positions of the tabs. + * Returns: none + */ + +static void +SetTabs(w, tab_count, tabs) +Widget w; +int tab_count; +short *tabs; +{ + AsciiSinkObject sink = (AsciiSinkObject) w; + int i; + Atom XA_FIGURE_WIDTH; + unsigned long figure_width = 0; + XFontStruct *font = sink->ascii_sink.font; + +/* + * Find the figure width of the current font. + */ + + XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE); + if ( (XA_FIGURE_WIDTH != None) && + ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) || + (figure_width == 0)) ) + if (font->per_char && font->min_char_or_byte2 <= '$' && + font->max_char_or_byte2 >= '$') + figure_width = font->per_char['$' - font->min_char_or_byte2].width; + else + figure_width = font->max_bounds.width; + + if (tab_count > sink->text_sink.tab_count) { + sink->text_sink.tabs = (Position *) + XtRealloc((char *) sink->text_sink.tabs, + (Cardinal) (tab_count * sizeof(Position))); + sink->text_sink.char_tabs = (short *) + XtRealloc((char *) sink->text_sink.char_tabs, + (Cardinal) (tab_count * sizeof(short))); + } + + for ( i = 0 ; i < tab_count ; i++ ) { + sink->text_sink.tabs[i] = tabs[i] * figure_width; + sink->text_sink.char_tabs[i] = tabs[i]; + } + + sink->text_sink.tab_count = tab_count; + +#ifndef NO_TAB_FIX + { TextWidget ctx = (TextWidget)XtParent(w); + ctx->text.redisplay_needed = True; + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + } +#endif +} diff --git a/vendor/x11iraf/xaw3d/AsciiSink.h b/vendor/x11iraf/xaw3d/AsciiSink.h new file mode 100644 index 00000000..30ac68aa --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiSink.h @@ -0,0 +1,91 @@ +/* + * $XConsortium: AsciiSink.h,v 1.9 94/04/17 20:11:43 kaleb Exp $ + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawAsciiSink_h +#define _XawAsciiSink_h + +/*********************************************************************** + * + * AsciiSink Object + * + ***********************************************************************/ + +#include <X11/Xaw3d/TextSink.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + echo Output Boolean True + displayNonprinting Output Boolean True + +*/ + +#define XtCOutput "Output" + +#define XtNdisplayNonprinting "displayNonprinting" +#define XtNecho "echo" + +/* Class record constants */ + +extern WidgetClass asciiSinkObjectClass; + +typedef struct _AsciiSinkClassRec *AsciiSinkObjectClass; +typedef struct _AsciiSinkRec *AsciiSinkObject; + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +#endif /* _XawAsciiSrc_h */ diff --git a/vendor/x11iraf/xaw3d/AsciiSinkP.h b/vendor/x11iraf/xaw3d/AsciiSinkP.h new file mode 100644 index 00000000..f6ba99fc --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiSinkP.h @@ -0,0 +1,118 @@ +/* +* $XConsortium: AsciiSinkP.h,v 1.4 94/04/17 20:11:44 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * asciiSinkP.h - Private definitions for asciiSink object + * + */ + +#ifndef _XawAsciiSinkP_h +#define _XawAsciiSinkP_h + +/*********************************************************************** + * + * AsciiSink Object Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/TextSinkP.h> +#include <X11/Xaw3d/AsciiSink.h> + +/************************************************************ + * + * New fields for the AsciiSink object class record. + * + ************************************************************/ + +typedef struct _AsciiSinkClassPart { + int foo; +} AsciiSinkClassPart; + +/* Full class record declaration */ + +typedef struct _AsciiSinkClassRec { + ObjectClassPart object_class; + TextSinkClassPart text_sink_class; + AsciiSinkClassPart ascii_sink_class; +} AsciiSinkClassRec; + +extern AsciiSinkClassRec asciiSinkClassRec; + +/* New fields for the AsciiSink object record */ +typedef struct { + /* public resources */ + XFontStruct *font; /* Font to draw in. */ + Boolean echo; + Boolean display_nonprinting; + + /* private state */ + GC normgc, invgc, xorgc; + Pixmap insertCursorOn; + XawTextInsertState laststate; + short cursor_x, cursor_y; /* Cursor Location. */ +} AsciiSinkPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _AsciiSinkRec { + ObjectPart object; + TextSinkPart text_sink; + AsciiSinkPart ascii_sink; +} AsciiSinkRec; + +#endif /* _XawAsciiSinkP_h */ + diff --git a/vendor/x11iraf/xaw3d/AsciiSrc.c b/vendor/x11iraf/xaw3d/AsciiSrc.c new file mode 100644 index 00000000..d0b8e358 --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiSrc.c @@ -0,0 +1,1411 @@ +/* $XConsortium: AsciiSrc.c,v 1.65 94/04/17 20:11:45 kaleb Exp $ */ + +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* + * AsciiSrc.c - AsciiSrc object. (For use with the text widget). + * + */ + +#include <X11/IntrinsicP.h> +#include <stdio.h> +#include <ctype.h> +#include <errno.h> +#include <X11/StringDefs.h> +#include <X11/Xos.h> +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#endif +#include <X11/Xfuncs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/AsciiSrcP.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xaw3d/MultiSrcP.h> + + +#if (defined(ASCII_STRING) || defined(ASCII_DISK)) +# include <X11/Xaw3d/AsciiText.h> /* for Widget Classes. */ +#endif + + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +static int magic_value = MAGIC_VALUE; + +#define offset(field) XtOffsetOf(AsciiSrcRec, ascii_src.field) + +static XtResource resources[] = { + {XtNstring, XtCString, XtRString, sizeof (char *), + offset(string), XtRString, NULL}, + {XtNtype, XtCType, XtRAsciiType, sizeof (XawAsciiType), + offset(type), XtRImmediate, (XtPointer)XawAsciiString}, + {XtNdataCompression, XtCDataCompression, XtRBoolean, sizeof (Boolean), + offset(data_compression), XtRImmediate, (XtPointer) TRUE}, + {XtNpieceSize, XtCPieceSize, XtRInt, sizeof (XawTextPosition), + offset(piece_size), XtRImmediate, (XtPointer) BUFSIZ}, + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(callback), XtRCallback, (XtPointer)NULL}, + {XtNuseStringInPlace, XtCUseStringInPlace, XtRBoolean, sizeof (Boolean), + offset(use_string_in_place), XtRImmediate, (XtPointer) FALSE}, + {XtNlength, XtCLength, XtRInt, sizeof (int), + offset(ascii_length), XtRInt, (XtPointer) &magic_value}, + +#ifdef ASCII_DISK + {XtNfile, XtCFile, XtRString, sizeof (String), + offset(filename), XtRString, NULL}, +#endif /* ASCII_DISK */ +}; +#undef offset + +static XawTextPosition Scan(), Search(), ReadText(); +static int ReplaceText(); +static Piece * FindPiece(), * AllocNewPiece(); +static FILE * InitStringOrFile(); +static void FreeAllPieces(), RemovePiece(), BreakPiece(), LoadPieces(); +static void RemoveOldStringOrFile(), CvtStringToAsciiType(); +static void ClassInitialize(), Initialize(), Destroy(), GetValuesHook(); +static String MyStrncpy(), StorePiecesInString(); +static Boolean SetValues(), WriteToFile(); +#ifdef X_NOT_STDC_ENV +extern int errno; +#endif + +#ifdef X_NOT_POSIX +#define Off_t long +#define Size_t unsigned int +#else +#define Off_t off_t +#define Size_t size_t +#endif + +#define superclass (&textSrcClassRec) +AsciiSrcClassRec asciiSrcClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) superclass, + /* class_name */ "AsciiSrc", + /* widget_size */ sizeof(AsciiSrcRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ NULL, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ FALSE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ NULL, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ NULL, + /* get_values_hook */ GetValuesHook, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ NULL, + /* display_accelerator */ NULL, + /* extension */ NULL + }, +/* textSrc_class fields */ + { + /* Read */ ReadText, + /* Replace */ ReplaceText, + /* Scan */ Scan, + /* Search */ Search, + /* SetSelection */ XtInheritSetSelection, + /* ConvertSelection */ XtInheritConvertSelection + }, +/* asciiSrc_class fields */ + { + /* Keep the compiler happy */ '\0' + } +}; + +WidgetClass asciiSrcObjectClass = (WidgetClass)&asciiSrcClassRec; + +/************************************************************ + * + * Semi-Public Interfaces. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: Class Initialize routine, called only once. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRAsciiType, CvtStringToAsciiType, + NULL, (Cardinal) 0); +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + AsciiSrcObject src = (AsciiSrcObject) new; + FILE * file; + +/* + * Set correct flags (override resources) depending upon widget class. + */ + + src->text_src.text_format = XawFmt8Bit; /* data format. */ + +#ifdef ASCII_DISK + if (XtIsSubclass(XtParent(new), asciiDiskWidgetClass)) { + src->ascii_src.type = XawAsciiFile; + src->ascii_src.string = src->ascii_src.filename; + } +#endif + +#ifdef ASCII_STRING + if (XtIsSubclass(XtParent(new), asciiStringWidgetClass)) { + src->ascii_src.use_string_in_place = TRUE; + src->ascii_src.type = XawAsciiString; + } +#endif + + src->ascii_src.changes = FALSE; + src->ascii_src.allocated_string = FALSE; + + file = InitStringOrFile(src, src->ascii_src.type == XawAsciiFile); + LoadPieces(src, file, NULL); + + if (file != NULL) fclose(file); +} + +/* Function Name: ReadText + * Description: This function reads the source. + * Arguments: w - the AsciiSource widget. + * pos - position of the text to retreive. + * RETURNED text - text block that will contain returned text. + * length - maximum number of characters to read. + * Returns: The number of characters read into the buffer. + */ + +static XawTextPosition +ReadText(w, pos, text, length) +Widget w; +XawTextPosition pos; +XawTextBlock *text; +int length; +{ + AsciiSrcObject src = (AsciiSrcObject) w; + XawTextPosition count, start; + Piece * piece = FindPiece(src, pos, &start); + + text->firstPos = pos; + text->ptr = piece->text + (pos - start); + count = piece->used - (pos - start); + text->length = (length > count) ? count : length; + return(pos + text->length); +} + +/* Function Name: ReplaceText. + * Description: Replaces a block of text with new text. + * Arguments: w - the AsciiSource widget. + * startPos, endPos - ends of text that will be removed. + * text - new text to be inserted into buffer at startPos. + * Returns: XawEditError or XawEditDone. + */ + +/*ARGSUSED*/ +static int +ReplaceText (w, startPos, endPos, text) +Widget w; +XawTextPosition startPos, endPos; +XawTextBlock *text; +{ + AsciiSrcObject src = (AsciiSrcObject) w; + Piece *start_piece, *end_piece, *temp_piece; + XawTextPosition start_first, end_first; + int length, firstPos; + +/* + * Editing a read only source is not allowed. + */ + + if (src->text_src.edit_mode == XawtextRead) + return(XawEditError); + + start_piece = FindPiece(src, startPos, &start_first); + end_piece = FindPiece(src, endPos, &end_first); + + src->ascii_src.changes = TRUE; /* We have changed the buffer. */ + +/* + * Remove Old Stuff. + */ + + if (start_piece != end_piece) { + temp_piece = start_piece->next; + +/* + * If empty and not the only piece then remove it. + */ + + if ( ((start_piece->used = startPos - start_first) == 0) && + !((start_piece->next == NULL) && (start_piece->prev == NULL)) ) + RemovePiece(src, start_piece); + + while (temp_piece != end_piece) { + temp_piece = temp_piece->next; + RemovePiece(src, temp_piece->prev); + } + end_piece->used -= endPos - end_first; + if (end_piece->used != 0) + MyStrncpy(end_piece->text, (end_piece->text + endPos - end_first), + (int) end_piece->used); + } + else { /* We are fully in one piece. */ + if ( (start_piece->used -= endPos - startPos) == 0) { + if ( !((start_piece->next == NULL) && (start_piece->prev == NULL)) ) + RemovePiece(src, start_piece); + } + else { + MyStrncpy(start_piece->text + (startPos - start_first), + start_piece->text + (endPos - start_first), + (int) (start_piece->used - (startPos - start_first)) ); + if ( src->ascii_src.use_string_in_place && + ((src->ascii_src.length - (endPos - startPos)) < + (src->ascii_src.piece_size - 1)) ) + start_piece->text[src->ascii_src.length - (endPos - startPos)] = '\0'; + } + } + + src->ascii_src.length += -(endPos - startPos) + text->length; + + if ( text->length != 0) { + + /* + * Put in the New Stuff. + */ + + start_piece = FindPiece(src, startPos, &start_first); + + length = text->length; + firstPos = text->firstPos; + + while (length > 0) { + char * ptr; + int fill; + + if (src->ascii_src.use_string_in_place) { + if (start_piece->used == (src->ascii_src.piece_size - 1)) { + /* + * If we are in ascii string emulation mode. Then the + * string is not allowed to grow. + */ + start_piece->used = src->ascii_src.length = + src->ascii_src.piece_size - 1; + start_piece->text[src->ascii_src.length] = '\0'; + return(XawEditError); + } + } + + + if (start_piece->used == src->ascii_src.piece_size) { + BreakPiece(src, start_piece); + start_piece = FindPiece(src, startPos, &start_first); + } + + fill = Min((int)(src->ascii_src.piece_size - start_piece->used), length); + + ptr = start_piece->text + (startPos - start_first); + MyStrncpy(ptr + fill, ptr, + (int) start_piece->used - (startPos - start_first)); + strncpy(ptr, text->ptr + firstPos, fill); + + startPos += fill; + firstPos += fill; + start_piece->used += fill; + length -= fill; + } + } + + if (src->ascii_src.use_string_in_place) + start_piece->text[start_piece->used] = '\0'; + + XtCallCallbacks(w, XtNcallback, NULL); /* Call callbacks, we have changed + the buffer. */ + + return(XawEditDone); +} + +/* Function Name: Scan + * Description: Scans the text source for the number and type + * of item specified. + * Arguments: w - the AsciiSource widget. + * position - the position to start scanning. + * type - type of thing to scan for. + * dir - direction to scan. + * count - which occurance if this thing to search for. + * include - whether or not to include the character found in + * the position that is returned. + * Returns: the position of the item found. + * + * Note: While there are only 'n' characters in the file there are n+1 + * possible cursor positions (one before the first character and + * one after the last character. + */ + +static +XawTextPosition +Scan (w, position, type, dir, count, include) +Widget w; +XawTextPosition position; +XawTextScanType type; +XawTextScanDirection dir; +int count; +Boolean include; +{ + AsciiSrcObject src = (AsciiSrcObject) w; + int inc; + Piece* piece; + XawTextPosition first, first_eol_position = 0; + char* ptr; + + if (type == XawstAll) { /* Optomize this common case. */ + if (dir == XawsdRight) + return(src->ascii_src.length); + return(0); /* else. */ + } + + if (position > src->ascii_src.length) + position = src->ascii_src.length; + + if ( dir == XawsdRight ) { + if (position == src->ascii_src.length) +/* + * Scanning right from src->ascii_src.length??? + */ + return(src->ascii_src.length); + inc = 1; + } + else { + if (position == 0) + return(0); /* Scanning left from 0??? */ + inc = -1; + position--; + } + + piece = FindPiece(src, position, &first); + +/* + * If the buffer is empty then return 0. + */ + + if ( piece->used == 0 ) return(0); + + ptr = (position - first) + piece->text; + + switch (type) { + case XawstEOL: + case XawstParagraph: + case XawstWhiteSpace: + for ( ; count > 0 ; count-- ) { + Boolean non_space = FALSE, first_eol = TRUE; + /* CONSTCOND */ + while (TRUE) { + unsigned char c = *ptr; + + ptr += inc; + position += inc; + + if (type == XawstWhiteSpace) { + if (isspace(c)) { + if (non_space) + break; + } + else + non_space = TRUE; + } + else if (type == XawstEOL) { + if (c == '\n') break; + } + else { /* XawstParagraph */ + if (first_eol) { + if (c == '\n') { + first_eol_position = position; + first_eol = FALSE; + } + } + else + if ( c == '\n') + break; + else if ( !isspace(c) ) + first_eol = TRUE; + } + + + if ( ptr < piece->text ) { + piece = piece->prev; + if (piece == NULL) /* Begining of text. */ + return(0); + ptr = piece->text + piece->used - 1; + } + else if ( ptr >= (piece->text + piece->used) ) { + piece = piece->next; + if (piece == NULL) /* End of text. */ + return(src->ascii_src.length); + ptr = piece->text; + } + } + } + if (!include) { + if ( type == XawstParagraph) + position = first_eol_position; + position -= inc; + } + break; + case XawstPositions: + position += count * inc; + break; + case XawstAll: /* handled in special code above */ + default: + break; + } + + if ( dir == XawsdLeft ) + position++; + + if (position >= src->ascii_src.length) + return(src->ascii_src.length); + if (position < 0) + return(0); + + return(position); +} + +/* Function Name: Search + * Description: Searchs the text source for the text block passed + * Arguments: w - the AsciiSource Widget. + * position - the position to start scanning. + * dir - direction to scan. + * text - the text block to search for. + * Returns: the position of the item found. + */ + +static XawTextPosition +Search(w, position, dir, text) +Widget w; +XawTextPosition position; +XawTextScanDirection dir; +XawTextBlock * text; +{ + AsciiSrcObject src = (AsciiSrcObject) w; + int inc, count = 0; + char * ptr; + Piece * piece; + char * buf; + XawTextPosition first; + + if ( dir == XawsdRight ) + inc = 1; + else { + inc = -1; + if (position == 0) + return(XawTextSearchError); /* scanning left from 0??? */ + position--; + } + + buf = XtMalloc((unsigned)sizeof(unsigned char) * text->length); + strncpy(buf, (text->ptr + text->firstPos), text->length); + piece = FindPiece(src, position, &first); + ptr = (position - first) + piece->text; + + /* CONSTCOND */ + while (TRUE) { + if (*ptr == ((dir == XawsdRight) ? *(buf + count) + : *(buf + text->length - count - 1)) ) { + if (count == (text->length - 1)) + break; + else + count++; + } + else { + if (count != 0) { + position -=inc * count; + ptr -= inc * count; + } + count = 0; + } + + ptr += inc; + position += inc; + + while ( ptr < piece->text ) { + piece = piece->prev; + if (piece == NULL) { /* Begining of text. */ + XtFree(buf); + return(XawTextSearchError); + } + ptr = piece->text + piece->used - 1; + } + + while ( ptr >= (piece->text + piece->used) ) { + piece = piece->next; + if (piece == NULL) { /* End of text. */ + XtFree(buf); + return(XawTextSearchError); + } + ptr = piece->text; + } + } + + XtFree(buf); + if (dir == XawsdLeft) + return(position); + return(position - (text->length - 1)); +} + +/* Function Name: SetValues + * Description: Sets the values for the AsciiSource. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: True if redisplay is needed. + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal * num_args; +{ + AsciiSrcObject src = (AsciiSrcObject) new; + AsciiSrcObject old_src = (AsciiSrcObject) current; + Boolean total_reset = FALSE, string_set = FALSE; + FILE * file; + int i; + + if ( old_src->ascii_src.use_string_in_place != + src->ascii_src.use_string_in_place ) { + XtAppWarning( XtWidgetToApplicationContext(new), + "AsciiSrc: The XtNuseStringInPlace resource may not be changed."); + src->ascii_src.use_string_in_place = + old_src->ascii_src.use_string_in_place; + } + + for (i = 0; i < *num_args ; i++ ) + if (streq(args[i].name, XtNstring)) { + string_set = TRUE; + break; + } + + if ( string_set || (old_src->ascii_src.type != src->ascii_src.type) ) { + RemoveOldStringOrFile(old_src, string_set); /* remove old info. */ + file = InitStringOrFile(src, string_set); /* Init new info. */ + LoadPieces(src, file, NULL); /* load new info into internal buffers. */ + if (file != NULL) fclose(file); + XawTextSetSource( XtParent(new), new, 0); /* Tell text widget + what happened. */ + total_reset = TRUE; + } + + if ( old_src->ascii_src.ascii_length != src->ascii_src.ascii_length ) + src->ascii_src.piece_size = src->ascii_src.ascii_length; + + if ( !total_reset && + (old_src->ascii_src.piece_size != src->ascii_src.piece_size) ) { + String string = StorePiecesInString(old_src); + FreeAllPieces(old_src); + LoadPieces(src, NULL, string); + XtFree(string); + } + + return(FALSE); +} + +/* Function Name: GetValuesHook + * Description: This is a get values hook routine that sets the + * values specific to the ascii source. + * Arguments: w - the AsciiSource Widget. + * args - the argument list. + * num_args - the number of args. + * Returns: none. + */ + +static void +GetValuesHook(w, args, num_args) +Widget w; +ArgList args; +Cardinal * num_args; +{ + AsciiSrcObject src = (AsciiSrcObject) w; + int i; + + if (src->ascii_src.type == XawAsciiString) { + for (i = 0; i < *num_args ; i++ ) + if (streq(args[i].name, XtNstring)) { + if (src->ascii_src.use_string_in_place) { + *((char **) args[i].value) = src->ascii_src.first_piece->text; + } + else { + if (XawAsciiSave(w)) /* If save sucessful. */ + *((char **) args[i].value) = src->ascii_src.string; + } + break; + } + } +} + +/* Function Name: Destroy + * Description: Destroys an ascii source (frees all data) + * Arguments: src - the Ascii source Widget to free. + * Returns: none. + */ + +static void +Destroy (w) +Widget w; +{ + RemoveOldStringOrFile((AsciiSrcObject) w, True); +} + +/************************************************************ + * + * Public routines + * + ************************************************************/ + +/* Function Name: XawAsciiSourceFreeString + * Description: Frees the string returned by a get values call + * on the string when the source is of type string. + * Arguments: w - the AsciiSrc widget. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawAsciiSourceFreeString(Widget w) +#else +XawAsciiSourceFreeString(w) +Widget w; +#endif +{ + AsciiSrcObject src = (AsciiSrcObject) w; + + /* If the src is really a multi, call the multi routine.*/ + + if ( XtIsSubclass( w, multiSrcObjectClass ) ) { + _XawMultiSourceFreeString( w ); + return; + } + + else if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) { + XtErrorMsg("bad argument", "asciiSource", "XawError", + "XawAsciiSourceFreeString's parameter must be an asciiSrc or multiSrc.", + NULL, NULL); + } + + if (src->ascii_src.allocated_string && src->ascii_src.type != XawAsciiFile) { + src->ascii_src.allocated_string = FALSE; + XtFree(src->ascii_src.string); + src->ascii_src.string = NULL; + } +} + +/* Function Name: XawAsciiSave + * Description: Saves all the pieces into a file or string as required. + * Arguments: w - the asciiSrc Widget. + * Returns: TRUE if the save was successful. + */ + +Boolean +#if NeedFunctionPrototypes +XawAsciiSave(Widget w) +#else +XawAsciiSave(w) +Widget w; +#endif +{ + AsciiSrcObject src = (AsciiSrcObject) w; + + /* If the src is really a multi, call the multi save. */ + + if ( XtIsSubclass( w, multiSrcObjectClass ) ) + return( _XawMultiSave( w ) ); + + else if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) { + XtErrorMsg("bad argument", "asciiSource", "XawError", + "XawAsciiSave's parameter must be an asciiSrc or multiSrc.", + NULL, NULL); + } + +/* + * If using the string in place then there is no need to play games + * to get the internal info into a readable string. + */ + + if (src->ascii_src.use_string_in_place) + return(TRUE); + + if (src->ascii_src.type == XawAsciiFile) { + char * string; + + if (!src->ascii_src.changes) /* No changes to save. */ + return(TRUE); + + string = StorePiecesInString(src); + + if (WriteToFile(string, src->ascii_src.string) == FALSE) { + XtFree(string); + return(FALSE); + } + XtFree(string); + } + else { + if (src->ascii_src.allocated_string == TRUE) + XtFree(src->ascii_src.string); + else + src->ascii_src.allocated_string = TRUE; + + src->ascii_src.string = StorePiecesInString(src); + } + src->ascii_src.changes = FALSE; + return(TRUE); +} + +/* Function Name: XawAsciiSaveAsFile + * Description: Save the current buffer as a file. + * Arguments: w - the AsciiSrc widget. + * name - name of the file to save this file into. + * Returns: True if the save was sucessful. + */ + +Boolean +#if NeedFunctionPrototypes +XawAsciiSaveAsFile(Widget w, _Xconst char* name) +#else +XawAsciiSaveAsFile(w, name) +Widget w; +String name; +#endif +{ + AsciiSrcObject src = (AsciiSrcObject) w; + String string; + Boolean ret; + + /* If the src is really a multi, call the multi save. - */ + + if ( XtIsSubclass( w, multiSrcObjectClass ) ) + return( _XawMultiSaveAsFile( w, name ) ); + + else if ( !XtIsSubclass( w, asciiSrcObjectClass ) ) { + XtErrorMsg("bad argument", "asciiSource", "XawError", + "XawAsciiSaveAsFile's 1st parameter must be an asciiSrc or multiSrc.", + NULL, NULL); + } + + string = StorePiecesInString(src); + + ret = WriteToFile(string, name); + XtFree(string); + return(ret); +} + +/* Function Name: XawAsciiSourceChanged + * Description: Returns true if the source has changed since last saved. + * Arguments: w - the ascii source widget. + * Returns: a Boolean (see description). + */ + +Boolean +#if NeedFunctionPrototypes +XawAsciiSourceChanged(Widget w) +#else +XawAsciiSourceChanged(w) +Widget w; +#endif +{ + if ( XtIsSubclass( w, multiSrcObjectClass ) ) + return( ( (MultiSrcObject) w )->multi_src.changes ); + + if ( XtIsSubclass( w, asciiSrcObjectClass ) ) + return( ( (AsciiSrcObject) w)->ascii_src.changes ); + + XtErrorMsg("bad argument", "asciiSource", "XawError", + "XawAsciiSourceChanged parameter must be an asciiSrc or multiSrc.", + NULL, NULL); + + return( True ); /* for gcc -Wall */ +} + +/************************************************************ + * + * Private Functions. + * + ************************************************************/ + +static void +RemoveOldStringOrFile(src, checkString) +AsciiSrcObject src; +Boolean checkString; +{ + FreeAllPieces(src); + + if (checkString && src->ascii_src.allocated_string) { + XtFree(src->ascii_src.string); + src->ascii_src.allocated_string = False; + src->ascii_src.string = NULL; + } +} + +/* Function Name: WriteToFile + * Description: Write the string specified to the begining of the file + * specified. + * Arguments: string - string to write. + * name - the name of the file + * Returns: returns TRUE if sucessful, FALSE otherwise. + */ + +static Boolean +WriteToFile(string, name) +String string, name; +{ + int fd; + + if ( ((fd = creat(name, 0666)) == -1 ) || + (write(fd, string, sizeof(unsigned char) * strlen(string)) == -1) ) + return(FALSE); + + if ( close(fd) == -1 ) + return(FALSE); + + return(TRUE); +} + +/* Function Name: StorePiecesInString + * Description: store the pieces in memory into a standard ascii string. + * Arguments: data - the ascii pointer data. + * Returns: none. + */ + +static String +StorePiecesInString(src) +AsciiSrcObject src; +{ + String string; + XawTextPosition first; + Piece * piece; + + string = XtMalloc((unsigned) sizeof(unsigned char) * + src->ascii_src.length + 1); + + for (first = 0, piece = src->ascii_src.first_piece ; piece != NULL; + first += piece->used, piece = piece->next) + strncpy(string + first, piece->text, piece->used); + + string[src->ascii_src.length] = '\0'; /* NULL terminate this sucker. */ + +/* + * This will refill all pieces to capacity. + */ + + if (src->ascii_src.data_compression) { + FreeAllPieces(src); + LoadPieces(src, NULL, string); + } + + return(string); +} + +/* Function Name: InitStringOrFile. + * Description: Initializes the string or file. + * Arguments: src - the AsciiSource. + * Returns: none - May exit though. + */ + +static FILE * +InitStringOrFile(src, newString) +AsciiSrcObject src; +Boolean newString; +{ + char * open_mode = NULL; + FILE * file; + char fileName[TMPSIZ]; + + if (src->ascii_src.type == XawAsciiString) { + + if (src->ascii_src.string == NULL) + src->ascii_src.length = 0; + + else if (! src->ascii_src.use_string_in_place) { + src->ascii_src.string = XtNewString(src->ascii_src.string); + src->ascii_src.allocated_string = True; + src->ascii_src.length = strlen(src->ascii_src.string); + } + + if (src->ascii_src.use_string_in_place) { + src->ascii_src.length = strlen(src->ascii_src.string); + /* In case the length resource is incorrectly set */ + if (src->ascii_src.length > src->ascii_src.ascii_length) + src->ascii_src.ascii_length = src->ascii_src.length; + + if (src->ascii_src.ascii_length == MAGIC_VALUE) + src->ascii_src.piece_size = src->ascii_src.length; + else + src->ascii_src.piece_size = src->ascii_src.ascii_length + 1; + } + + return(NULL); + } + +/* + * type is XawAsciiFile. + */ + + src->ascii_src.is_tempfile = FALSE; + + switch (src->text_src.edit_mode) { + case XawtextRead: + if (src->ascii_src.string == NULL) + XtErrorMsg("NoFile", "asciiSourceCreate", "XawError", + "Creating a read only disk widget and no file specified.", + NULL, 0); + open_mode = "r"; + break; + case XawtextAppend: + case XawtextEdit: + if (src->ascii_src.string == NULL) { + src->ascii_src.string = fileName; + (void) tmpnam(src->ascii_src.string); + src->ascii_src.is_tempfile = TRUE; + open_mode = "w"; + } else + open_mode = "r+"; + break; + default: + XtErrorMsg("badMode", "asciiSourceCreate", "XawError", + "Bad editMode for ascii source; must be Read, Append or Edit.", + NULL, NULL); + } + + /* Allocate new memory for the temp filename, because it is held in + * a stack variable, not static memory. This widget does not need + * to keep the private state field is_tempfile -- it is only accessed + * in this routine, and its former setting is unused. + */ + if (newString || src->ascii_src.is_tempfile) { + src->ascii_src.string = XtNewString(src->ascii_src.string); + src->ascii_src.allocated_string = TRUE; + } + + if (!src->ascii_src.is_tempfile) { + if ((file = fopen(src->ascii_src.string, open_mode)) != 0) { + (void) fseek(file, (Off_t)0, 2); + src->ascii_src.length = (XawTextPosition) ftell(file); + return file; + } else { + String params[2]; + Cardinal num_params = 2; + + params[0] = src->ascii_src.string; + params[1] = strerror(errno); + XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src), + "openError", "asciiSourceCreate", "XawWarning", + "Cannot open file %s; %s", params, &num_params); + } + } + src->ascii_src.length = 0; + return((FILE *)NULL); +} + +static void +LoadPieces(src, file, string) +AsciiSrcObject src; +FILE * file; +char * string; +{ + char *local_str, *ptr; + Piece * piece = NULL; + XawTextPosition left; + + if (string == NULL) { + if (src->ascii_src.type == XawAsciiFile) { + local_str = XtMalloc((unsigned) (src->ascii_src.length + 1) + * sizeof(unsigned char)); + if (src->ascii_src.length != 0) { + fseek(file, (Off_t)0, 0); + src->ascii_src.length = fread(local_str, (Size_t)sizeof(unsigned char), + (Size_t)src->ascii_src.length, file); + if (src->ascii_src.length <= 0) + XtErrorMsg("readError", "asciiSourceCreate", "XawError", + "fread returned error.", NULL, NULL); + } + local_str[src->ascii_src.length] = '\0'; + } + else + local_str = src->ascii_src.string; + } + else + local_str = string; + + if (src->ascii_src.use_string_in_place) { + piece = AllocNewPiece(src, piece); + piece->used = Min(src->ascii_src.length, src->ascii_src.piece_size); + piece->text = src->ascii_src.string; + return; + } + + ptr = local_str; + left = src->ascii_src.length; + + do { + piece = AllocNewPiece(src, piece); + + piece->text = XtMalloc((unsigned)src->ascii_src.piece_size + * sizeof(unsigned char)); + piece->used = Min(left, src->ascii_src.piece_size); + if (piece->used != 0) + strncpy(piece->text, ptr, piece->used); + + left -= piece->used; + ptr += piece->used; + } while (left > 0); + + if ( (src->ascii_src.type == XawAsciiFile) && (string == NULL) ) + XtFree(local_str); +} + +/* Function Name: AllocNewPiece + * Description: Allocates a new piece of memory. + * Arguments: src - The AsciiSrc Widget. + * prev - the piece just before this one, or NULL. + * Returns: the allocated piece. + */ + +static Piece * +AllocNewPiece(src, prev) +AsciiSrcObject src; +Piece * prev; +{ + Piece * piece = XtNew(Piece); + + if (prev == NULL) { + src->ascii_src.first_piece = piece; + piece->next = NULL; + } + else { + if (prev->next != NULL) + (prev->next)->prev = piece; + piece->next = prev->next; + prev->next = piece; + } + + piece->prev = prev; + + return(piece); +} + +/* Function Name: FreeAllPieces + * Description: Frees all the pieces + * Arguments: src - The AsciiSrc Widget. + * Returns: none. + */ + +static void +FreeAllPieces(src) +AsciiSrcObject src; +{ + Piece * next, * first = src->ascii_src.first_piece; + + if (first->prev != NULL) + (void) printf("Xaw AsciiSrc Object: possible memory leak in FreeAllPieces().\n"); + + for ( ; first != NULL ; first = next ) { + next = first->next; + RemovePiece(src, first); + } +} + +/* Function Name: RemovePiece + * Description: Removes a piece from the list. + * Arguments: + * piece - the piece to remove. + * Returns: none. + */ + +static void +RemovePiece(src, piece) +AsciiSrcObject src; +Piece * piece; +{ + if (piece->prev == NULL) + src->ascii_src.first_piece = piece->next; + else + (piece->prev)->next = piece->next; + + if (piece->next != NULL) + (piece->next)->prev = piece->prev; + + if (!src->ascii_src.use_string_in_place) + XtFree(piece->text); + + XtFree((char *)piece); +} + +/* Function Name: FindPiece + * Description: Finds the piece containing the position indicated. + * Arguments: src - The AsciiSrc Widget. + * position - the position that we are searching for. + * RETURNED first - the position of the first character in this piece. + * Returns: piece - the piece that contains this position. + */ + +static Piece * +FindPiece(src, position, first) +AsciiSrcObject src; +XawTextPosition position, *first; +{ + Piece * old_piece = NULL, * piece = src->ascii_src.first_piece; + XawTextPosition temp; + + for ( temp = 0 ; piece != NULL ; temp += piece->used, piece = piece->next ) { + *first = temp; + old_piece = piece; + + if ((temp + piece->used) > position) + return(piece); + } + return(old_piece); /* if we run off the end the return the last piece */ +} + +/* Function Name: MyStrncpy + * Description: Just like string copy, but slower and will always + * work on overlapping strings. + * Arguments: (same as strncpy) - s1, s2 - strings to copy (2->1). + * n - the number of chars to copy. + * Returns: s1. + */ + +static String +MyStrncpy(s1, s2, n) +char * s1, * s2; +int n; +{ + char buf[256]; + char* temp; + + if (n == 0) return s1; + + if (n < sizeof buf) temp = buf; + else temp = XtMalloc((unsigned)sizeof(unsigned char) * n); + + strncpy(temp, s2, n); /* Saber has a bug that causes it to generate*/ + strncpy(s1, temp, n); /* a bogus warning message here (CDP 6/32/89)*/ + + if (temp != buf) XtFree(temp); + return s1; +} + +/* Function Name: BreakPiece + * Description: Breaks a full piece into two new pieces. + * Arguments: src - The AsciiSrc Widget. + * piece - the piece to break. + * Returns: none. + */ + +#define HALF_PIECE (src->ascii_src.piece_size/2) + +static void +BreakPiece(src, piece) +AsciiSrcObject src; +Piece * piece; +{ + Piece * new = AllocNewPiece(src, piece); + + new->text = XtMalloc(src->ascii_src.piece_size * sizeof(unsigned char)); + strncpy(new->text, piece->text + HALF_PIECE, + src->ascii_src.piece_size - HALF_PIECE); + piece->used = HALF_PIECE; + new->used = src->ascii_src.piece_size - HALF_PIECE; +} + +/* ARGSUSED */ +static void +CvtStringToAsciiType(args, num_args, fromVal, toVal) +XrmValuePtr args; /* unused */ +Cardinal *num_args; /* unused */ +XrmValuePtr fromVal; +XrmValuePtr toVal; +{ + static XawAsciiType type; + static XrmQuark XtQEstring = NULLQUARK; + static XrmQuark XtQEfile; + XrmQuark q; + char lowerName[40]; + + if (XtQEstring == NULLQUARK) { + XtQEstring = XrmPermStringToQuark(XtEstring); + XtQEfile = XrmPermStringToQuark(XtEfile); + } + + if (strlen ((char*)fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered(lowerName, (char *) fromVal->addr); + q = XrmStringToQuark(lowerName); + + if (q == XtQEstring) type = XawAsciiString; + else if (q == XtQEfile) type = XawAsciiFile; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof type; + toVal->addr = (XPointer) &type; + return; + } + toVal->size = 0; + toVal->addr = NULL; +} + +#if (defined(ASCII_STRING) || defined(ASCII_DISK)) +# include <X11/Xaw3d/Cardinals.h> +#endif + +#ifdef ASCII_STRING +/************************************************************ + * + * Compatability functions. + * + ************************************************************/ + +/* Function Name: AsciiStringSourceCreate + * Description: Creates a string source. + * Arguments: parent - the widget that will own this source. + * args, num_args - the argument list. + * Returns: a pointer to the new text source. + */ + +Widget +XawStringSourceCreate(parent, args, num_args) +Widget parent; +ArgList args; +Cardinal num_args; +{ + XawTextSource src; + ArgList ascii_args; + Arg temp[2]; + + XtSetArg(temp[0], XtNtype, XawAsciiString); + XtSetArg(temp[1], XtNuseStringInPlace, TRUE); + ascii_args = XtMergeArgLists(temp, TWO, args, num_args); + + src = XtCreateWidget("genericAsciiString", asciiSrcObjectClass, parent, + ascii_args, num_args + TWO); + XtFree((char *)ascii_args); + return(src); +} + +/* + * This is hacked up to try to emulate old functionality, it + * may not work, as I have not old code to test it on. + * + * Chris D. Peterson 8/31/89. + */ + +void +XawTextSetLastPos (w, lastPos) +Widget w; +XawTextPosition lastPos; +{ + AsciiSrcObject src = (AsciiSrcObject) XawTextGetSource(w); + + src->ascii_src.piece_size = lastPos; +} +#endif /* ASCII_STRING */ + +#ifdef ASCII_DISK +/* Function Name: AsciiDiskSourceCreate + * Description: Creates a disk source. + * Arguments: parent - the widget that will own this source. + * args, num_args - the argument list. + * Returns: a pointer to the new text source. + */ + +Widget +XawDiskSourceCreate(parent, args, num_args) +Widget parent; +ArgList args; +Cardinal num_args; +{ + XawTextSource src; + ArgList ascii_args; + Arg temp[1]; + int i; + + XtSetArg(temp[0], XtNtype, XawAsciiFile); + ascii_args = XtMergeArgLists(temp, ONE, args, num_args); + num_args++; + + for (i = 0; i < num_args; i++) + if (streq(ascii_args[i].name, XtNfile) || + streq(ascii_args[i].name, XtCFile)) + ascii_args[i].name = XtNstring; + + src = XtCreateWidget("genericAsciiDisk", asciiSrcObjectClass, parent, + ascii_args, num_args); + XtFree((char *)ascii_args); + return(src); +} +#endif /* ASCII_DISK */ diff --git a/vendor/x11iraf/xaw3d/AsciiSrc.h b/vendor/x11iraf/xaw3d/AsciiSrc.h new file mode 100644 index 00000000..37fe4e42 --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiSrc.h @@ -0,0 +1,162 @@ +/* $XConsortium: AsciiSrc.h,v 1.15 94/04/17 20:11:46 kaleb Exp $ */ + +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + + +/* + * AsciiSrc.h - Public Header file for Ascii Text Source. + * + * This is the public header file for the Ascii Text Source. + * It is intended to be used with the Text widget, the simplest way to use + * this text source is to use the AsciiText Object. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + + +#ifndef _XawAsciiSrc_h +#define _XawAsciiSrc_h + +#include <X11/Xaw3d/TextSrc.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Callback (none) + dataCompression DataCompression Boolean True + length Length int (internal) + pieceSize PieceSize int BUFSIZ + string String String NULL + type Type XawAsciiType XawAsciiString + useStringInPlace UseStringInPlace Boolean False + +*/ + +/* Class record constants */ + +extern WidgetClass asciiSrcObjectClass; + +typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass; +typedef struct _AsciiSrcRec *AsciiSrcObject; + +/* + * Just to make people's lives a bit easier. + */ + +#define AsciiSourceObjectClass AsciiSrcObjectClass +#define AsciiSourceObject AsciiSrcObject + +/* + * Resource Definitions. + */ + +#define XtCDataCompression "DataCompression" +#define XtCPieceSize "PieceSize" +#define XtCType "Type" +#define XtCUseStringInPlace "UseStringInPlace" + +#define XtNdataCompression "dataCompression" +#define XtNpieceSize "pieceSize" +#define XtNtype "type" +#define XtNuseStringInPlace "useStringInPlace" + +#define XtRAsciiType "AsciiType" + +#define XtEstring "string" +#define XtEfile "file" + +typedef enum {XawAsciiFile, XawAsciiString} XawAsciiType; + +/************************************************************ + * + * Public routines + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawAsciiSourceFreeString + * Description: Frees the string returned by a get values call + * on the string when the source is of type string. + * Arguments: w - the AsciiSrc object. + * Returns: none. + */ + +extern void XawAsciiSourceFreeString( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawAsciiSave + * Description: Saves all the pieces into a file or string as required. + * Arguments: w - the asciiSrc Object. + * Returns: TRUE if the save was successful. + */ + +extern Boolean XawAsciiSave( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawAsciiSaveAsFile + * Description: Save the current buffer as a file. + * Arguments: w - the asciiSrc object. + * name - name of the file to save this file into. + * Returns: True if the save was successful. + */ + +extern Boolean XawAsciiSaveAsFile( +#if NeedFunctionPrototypes + Widget /* w */, + _Xconst char* /* name */ +#endif +); + +/* Function Name: XawAsciiSourceChanged + * Description: Returns true if the source has changed since last saved. + * Arguments: w - the asciiSource object. + * Returns: a Boolean (see description). + */ + +extern Boolean XawAsciiSourceChanged( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawAsciiSrc_h */ + diff --git a/vendor/x11iraf/xaw3d/AsciiSrcP.h b/vendor/x11iraf/xaw3d/AsciiSrcP.h new file mode 100644 index 00000000..dcb33ffb --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiSrcP.h @@ -0,0 +1,163 @@ +/* +* $XConsortium: AsciiSrcP.h,v 1.10 94/04/17 20:11:49 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * AsciiSrcP.h - Private Header for Ascii Text Source. + * + * This is the private header file for the Ascii Text Source. + * It is intended to be used with the Text widget, the simplest way to use + * this text source is to use the AsciiText Object. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +/* + * TextSrcP.h - Private definitions for AsciiSrc object + * + */ + +#ifndef _XawAsciiSrcP_h +#define _XawAsciiSrcP_h + +#include <X11/Xaw3d/TextSrcP.h> +#include <X11/Xaw3d/AsciiSrc.h> + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#ifdef L_tmpnam +#define TMPSIZ L_tmpnam +#else +#define TMPSIZ 32 /* bytes to allocate for tmpnam */ +#endif + +#define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */ + +#define streq(a, b) ( strcmp((a), (b)) == 0 ) + +typedef struct _Piece { /* Piece of the text file of BUFSIZ allocated + characters. */ + char * text; /* The text in this buffer. */ + XawTextPosition used; /* The number of characters of this buffer + that have been used. */ + struct _Piece *prev, *next; /* linked list pointers. */ +} Piece; + +/************************************************************ + * + * New fields for the AsciiSrc object class record. + * + ************************************************************/ + +typedef struct _AsciiSrcClassPart { char foo; } AsciiSrcClassPart; + +/* Full class record declaration */ +typedef struct _AsciiSrcClassRec { + ObjectClassPart object_class; + TextSrcClassPart text_src_class; + AsciiSrcClassPart ascii_src_class; +} AsciiSrcClassRec; + +extern AsciiSrcClassRec asciiSrcClassRec; + +/* New fields for the AsciiSrc object record */ + +typedef struct _AsciiSrcPart { + + /* Resources. */ + + char *string; /* either the string, or the + file name, depending upon the type. */ + XawAsciiType type; /* either string or disk. */ + XawTextPosition piece_size; /* Size of text buffer for each piece. */ + Boolean data_compression; /* compress to minimum memory automatically + on save? */ + XtCallbackList callback; /* A callback list to call when the source is + changed. */ + Boolean use_string_in_place; /* Use the string passed in place. */ + int ascii_length; /* length field for ascii string emulation. */ + +#ifdef ASCII_DISK + String filename; /* name of file for Compatability. */ +#endif /* ASCII_DISK */ + +/* Private data. */ + + Boolean is_tempfile; /* Is this a temporary file? */ + Boolean changes; /* Has this file been edited? */ + Boolean allocated_string; /* Have I allocated the + string in ascii_src->string? */ + XawTextPosition length; /* length of file */ + Piece * first_piece; /* first piece of the text. */ +} AsciiSrcPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _AsciiSrcRec { + ObjectPart object; + TextSrcPart text_src; + AsciiSrcPart ascii_src; +} AsciiSrcRec; + +#endif /* _XawAsciiSrcP_h */ diff --git a/vendor/x11iraf/xaw3d/AsciiText.c b/vendor/x11iraf/xaw3d/AsciiText.c new file mode 100644 index 00000000..0aa35996 --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiText.c @@ -0,0 +1,336 @@ +/* $XConsortium: AsciiText.c,v 1.47 95/06/06 20:50:30 kaleb Exp $ */ + +/* + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +/*********************************************************************** + * + * AsciiText Widget + * + ***********************************************************************/ + +/* + * AsciiText.c - Source code for AsciiText Widget. + * + * This Widget is intended to be used as a simple front end to the + * text widget with an ascii source and ascii sink attached to it. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/Cardinals.h> +#include <X11/Xaw3d/AsciiTextP.h> +#include <X11/Xaw3d/AsciiSrc.h> +#include <X11/Xaw3d/AsciiSink.h> +#include <X11/Xaw3d/MultiSrc.h> +#include <X11/Xaw3d/MultiSinkP.h> +#include <X11/Xaw3d/XawImP.h> + +#define TAB_COUNT 32 + +static void Initialize(), Destroy(); + +AsciiTextClassRec asciiTextClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &textClassRec, + /* class_name */ "Text", + /* widget_size */ sizeof(AsciiRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ NULL, + /* num_resource */ 0, + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure*/ XtExposeGraphicsExpose | XtExposeNoExpose, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost*/ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ XtInheritAcceptFocus, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ XtInheritTranslations, + /* query_geometry */ XtInheritQueryGeometry + }, + { /* Simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* text fields */ + /* empty */ 0 + }, + { /* ascii fields */ + /* empty */ 0 + } +}; + +WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec; + + +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + AsciiWidget w = (AsciiWidget) new; + int i; + int tabs[TAB_COUNT], tab; + + MultiSinkObject sink; + + /* superclass Initialize can't set the following, + * as it didn't know the source or sink when it was called */ + + if (request->core.height == DEFAULT_TEXT_HEIGHT) + new->core.height = DEFAULT_TEXT_HEIGHT; + + + /* This is the main change for internationalization. */ + + if ( w->simple.international == True ) { /* The multi* are international. */ + + w->text.source = XtCreateWidget( "textSource", multiSrcObjectClass, + new, args, *num_args ); + w->text.sink = XtCreateWidget( "textSink", multiSinkObjectClass, + new, args, *num_args ); + } + else { + + w->text.source = XtCreateWidget( "textSource", asciiSrcObjectClass, + new, args, *num_args ); + w->text.sink = XtCreateWidget( "textSink", asciiSinkObjectClass, + new, args, *num_args ); + } + + if (w->core.height == DEFAULT_TEXT_HEIGHT) + w->core.height = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1); + + for (i=0, tab=0 ; i < TAB_COUNT ; i++) + tabs[i] = (tab += 8); + + XawTextSinkSetTabs(w->text.sink, TAB_COUNT, tabs); + + XawTextDisableRedisplay(new); + XawTextEnableRedisplay(new); + + + /* If we are using a MultiSink we need to tell the input method stuff. */ + + if ( w->simple.international == True ) { + Arg list[4]; + Cardinal ac = 0; + + sink = (MultiSinkObject)w->text.sink; + _XawImRegister( new ); + XtSetArg (list[ac], XtNfontSet, sink->multi_sink.fontset); ac++; + XtSetArg (list[ac], XtNinsertPosition, w->text.insertPos); ac++; + XtSetArg (list[ac], XtNforeground, sink->text_sink.foreground); ac++; + XtSetArg (list[ac], XtNbackground, sink->text_sink.background); ac++; + _XawImSetValues(new, list, ac); + } +} + +static void +Destroy(w) +Widget w; +{ + /* Disconnect input method */ + + if ( ((AsciiWidget)w)->simple.international == True ) + _XawImUnregister( w ); + + if (w == XtParent(((AsciiWidget)w)->text.source)) + XtDestroyWidget( ((AsciiWidget)w)->text.source ); + + if (w == XtParent(((AsciiWidget)w)->text.sink)) + XtDestroyWidget( ((AsciiWidget)w)->text.sink ); +} + +#ifdef ASCII_STRING + +/************************************************************ + * + * Ascii String Compatibility Code. + * + ************************************************************/ + +AsciiStringClassRec asciiStringClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &asciiTextClassRec, + /* class_name */ "Text", + /* widget_size */ sizeof(AsciiStringRec), + /* class_initialize */ NULL, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ NULL, + /* num_ resource */ 0, + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure*/ XtExposeGraphicsExpose, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost*/ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ XtInheritAcceptFocus, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ XtInheritTranslations, + /* query_geometry */ XtInheritQueryGeometry + }, + { /* Simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* text fields */ + /* empty */ 0 + }, + { /* ascii fields */ + /* empty */ 0 + } +}; + +WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec; + +#endif /* ASCII_STRING */ + +#ifdef ASCII_DISK + +/************************************************************ + * + * Ascii Disk Compatibility Code. + * + ************************************************************/ + +AsciiDiskClassRec asciiDiskClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &asciiTextClassRec, + /* class_name */ "Text", + /* widget_size */ sizeof(AsciiDiskRec), + /* class_initialize */ NULL, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ NULL, + /* num_ resource */ 0, + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure*/ XtExposeGraphicsExpose, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost*/ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ XtInheritAcceptFocus, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ XtInheritTranslations, + /* query_geometry */ XtInheritQueryGeometry + }, + { /* Simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* text fields */ + /* empty */ 0 + }, + { /* ascii fields */ + /* empty */ 0 + } +}; + +WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec; + +#endif /* ASCII_DISK */ + + + + + + + + + + + + diff --git a/vendor/x11iraf/xaw3d/AsciiText.h b/vendor/x11iraf/xaw3d/AsciiText.h new file mode 100644 index 00000000..fb94d76e --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiText.h @@ -0,0 +1,148 @@ +/* + * $XConsortium: AsciiText.h,v 1.18 94/04/17 20:11:51 kaleb Exp $ + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/*********************************************************************** + * + * AsciiText Widget + * + ***********************************************************************/ + +/* + * AsciiText.c - Public header file for AsciiText Widget. + * + * This Widget is intended to be used as a simple front end to the + * text widget with an ascii source and ascii sink attached to it. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _AsciiText_h +#define _AsciiText_h + +/**************************************************************** + * + * AsciiText widgets + * + ****************************************************************/ + +#include <X11/Xaw3d/Text.h> /* AsciiText is a subclass of Text */ +#include <X11/Xaw3d/AsciiSrc.h> +#include <X11/Xaw3d/MultiSrc.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + autoFill AutoFill Boolean False + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + bottomMargin Margin Position 2 + cursor Cursor Cursor xterm + destroyCallback Callback Pointer NULL + displayCaret Output Boolean True + displayPosition TextPosition int 0 + editType EditType XawTextEditType XawtextRead + font Font XFontStruct* Fixed + foreground Foreground Pixel Black + height Height Dimension font height + insertPosition TextPosition int 0 + international International Boolean false + leftMargin Margin Position 2 + mappedWhenManaged MappedWhenManaged Boolean True + resize Resize XawTextResizeMode XawtextResizeNever + rightMargin Margin Position 4 + scrollHorizontal Scroll XawTextScrollMode XawtextScrollNever + scrollVertical Scroll XawTextScrollMode XawtextScrollNever + selectTypes SelectTypes Pointer pos/word/line/par/all + selection Selection Pointer (empty selection) + sensitive Sensitive Boolean True + sink TextSink Widget (none) + source TextSource Widget (none) + string String String NULL + topMargin Margin Position 2 + width Width Dimension 100 + wrap Wrap XawTextWrapMode XawtextWrapNever + x Position Position 0 + y Position Position 0 + + (see also *Src.h and *Sink.h) +*/ + +/* + * Everything else we need is in StringDefs.h or Text.h + */ + +typedef struct _AsciiTextClassRec *AsciiTextWidgetClass; +typedef struct _AsciiRec *AsciiWidget; + +extern WidgetClass asciiTextWidgetClass; + +/************************************************************ + * + * Disk and String Emulation Info. + * + ************************************************************/ + +#ifdef ASCII_STRING +extern WidgetClass asciiStringWidgetClass; +#endif + +#ifdef ASCII_DISK +extern WidgetClass asciiDiskWidgetClass; +#endif + +#endif /* _AsciiText_h */ diff --git a/vendor/x11iraf/xaw3d/AsciiTextP.h b/vendor/x11iraf/xaw3d/AsciiTextP.h new file mode 100644 index 00000000..d002a214 --- /dev/null +++ b/vendor/x11iraf/xaw3d/AsciiTextP.h @@ -0,0 +1,163 @@ +/* + * $XConsortium: AsciiTextP.h,v 1.17 94/04/17 20:11:52 kaleb Exp $ + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/*********************************************************************** + * + * AsciiText Widget + * + ***********************************************************************/ + +/* + * AsciiText.c - Private header file for AsciiText Widget. + * + * This Widget is intended to be used as a simple front end to the + * text widget with an ascii source and ascii sink attached to it. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _AsciiTextP_h +#define _AsciiTextP_h + +#include <X11/Xaw3d/TextP.h> +#include <X11/Xaw3d/AsciiText.h> +#include <X11/Xaw3d/AsciiSrc.h> +#include <X11/Xaw3d/MultiSrc.h> + +typedef struct {int empty;} AsciiClassPart; + +typedef struct _AsciiTextClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; + AsciiClassPart ascii_class; +} AsciiTextClassRec; + +extern AsciiTextClassRec asciiTextClassRec; + +typedef struct { char foo; /* keep compiler happy. */ } AsciiPart; + +typedef struct _AsciiRec { + CorePart core; + SimplePart simple; + TextPart text; + AsciiPart ascii; +} AsciiRec; + +/************************************************************ + * + * Ascii String Emulation widget. + * + ************************************************************/ + +#ifdef ASCII_STRING + +typedef struct {int empty;} AsciiStringClassPart; + +typedef struct _AsciiStringClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; + AsciiClassPart ascii_class; + AsciiStringClassPart string_class; +} AsciiStringClassRec; + +extern AsciiStringClassRec asciiStringClassRec; + +typedef struct { char foo; /* keep compiler happy. */ } AsciiStringPart; + +typedef struct _AsciiStringRec { + CorePart core; + SimplePart simple; + TextPart text; + AsciiPart ascii; + AsciiStringPart ascii_str; +} AsciiStringRec; + +#endif /* ASCII_STRING */ + +#ifdef ASCII_DISK + +/************************************************************ + * + * Ascii Disk Emulation widget. + * + ************************************************************/ + +typedef struct {int empty;} AsciiDiskClassPart; + +typedef struct _AsciiDiskClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; + AsciiClassPart ascii_class; + AsciiDiskClassPart disk_class; +} AsciiDiskClassRec; + +extern AsciiDiskClassRec asciiDiskClassRec; + +typedef struct { char foo; /* keep compiler happy. */ } AsciiDiskPart; + +typedef struct _AsciiDiskRec { + CorePart core; + SimplePart simple; + TextPart text; + AsciiPart ascii; + AsciiDiskPart ascii_disk; +} AsciiDiskRec; +#endif /* ASCII_DISK */ + +#endif /* _AsciiTextP_h */ diff --git a/vendor/x11iraf/xaw3d/Box.c b/vendor/x11iraf/xaw3d/Box.c new file mode 100644 index 00000000..640567c5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Box.c @@ -0,0 +1,622 @@ +/* $XConsortium: Box.c,v 1.49 94/04/17 20:11:54 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + + +/* + * Box.c - Box composite widget + * + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/BoxP.h> + +/**************************************************************** + * + * Box Resources + * + ****************************************************************/ + +static XtResource resources[] = { + { XtNhSpace, XtCHSpace, XtRDimension, sizeof(Dimension), + XtOffsetOf(BoxRec, box.h_space), + XtRImmediate, (XtPointer)4 }, + { XtNvSpace, XtCVSpace, XtRDimension, sizeof(Dimension), + XtOffsetOf(BoxRec, box.v_space), + XtRImmediate, (XtPointer)4 }, + { XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), + XtOffsetOf(BoxRec, box.orientation), + XtRImmediate, (XtPointer)XtorientVertical }, +}; + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +static void ClassInitialize(); +static void Initialize(); +static void Realize(); +static void Resize(); +static Boolean SetValues(); +static XtGeometryResult GeometryManager(); +static void ChangeManaged(); +static XtGeometryResult PreferredSize(); + +BoxClassRec boxClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) &compositeClassRec, + /* class_name */ "Box", + /* widget_size */ sizeof(BoxRec), + /* class_initialize */ ClassInitialize, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ PreferredSize, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + },{ +/* composite_class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + },{ +/* Box class fields */ + /* empty */ 0, + } +}; + +WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec; + + +/**************************************************************** + * + * Private Routines + * + ****************************************************************/ + +/* + * + * Do a layout, either actually assigning positions, or just calculating size. + * Returns minimum width and height that will preserve the same layout. + * + */ + +static void DoLayout(bbw, width, height, reply_width, reply_height, position) + BoxWidget bbw; + Dimension width, height; + Dimension *reply_width, *reply_height; /* bounding box */ + Boolean position; /* actually reposition the windows? */ +{ + Boolean vbox = (bbw->box.orientation == XtorientVertical); + Cardinal i; + Dimension w, h; /* Width and height needed for box */ + Dimension lw, lh; /* Width and height needed for current line */ + Dimension bw, bh; /* Width and height needed for current widget */ + Dimension h_space; /* Local copy of bbw->box.h_space */ + Widget widget; /* Current widget */ + int num_mapped_children = 0; + + /* Box width and height */ + h_space = bbw->box.h_space; + + w = 0; + for (i = 0; i < bbw->composite.num_children; i++) { + if ( bbw->composite.children[i]->core.width > w ) + w = bbw->composite.children[i]->core.width; + } + w += h_space; + if ( w > width ) width = w; + h = bbw->box.v_space; + + /* Line width and height */ + lh = 0; + lw = h_space; + + for (i = 0; i < bbw->composite.num_children; i++) { + widget = bbw->composite.children[i]; + if (widget->core.managed) { + if (widget->core.mapped_when_managed) num_mapped_children++; + /* Compute widget width */ + bw = widget->core.width + 2*widget->core.border_width + h_space; + if ((Dimension)(lw + bw) > width) { + if (lw > h_space) { + /* At least one widget on this line, and + * can't fit any more. Start new line if vbox. + */ + AssignMax(w, lw); + if (vbox) { + h += lh + bbw->box.v_space; + lh = 0; + lw = h_space; + } + } + else if (!position) { + /* too narrow for this widget; we'll assume we can grow */ + DoLayout(bbw, lw + bw, height, reply_width, + reply_height, position); + return; + } + } + if (position && (lw != (Dimension)widget->core.x || h != (Dimension)widget->core.y)) { + /* It would be nice to use window gravity, but there isn't + * sufficient fine-grain control to nicely handle all + * situations (e.g. when only the height changes -- + * a common case). Explicit unmapping is a cheap hack + * to speed things up & avoid the visual jitter as + * things slide around. + * + * %%% perhaps there should be a client resource to + * control this. If so, we'll have to optimize to + * perform the moves from the correct end so we don't + * force extra exposures as children occlude each other. + */ + if (XtIsRealized(widget) && widget->core.mapped_when_managed) + XUnmapWindow( XtDisplay(widget), XtWindow(widget) ); + XtMoveWidget(widget, (int)lw, (int)h); + } + lw += bw; + bh = widget->core.height + 2*widget->core.border_width; + AssignMax(lh, bh); + } /* if managed */ + } /* for */ + + if (!vbox && width && lw > width && lh < height) { + /* reduce width if too wide and height not filled */ + Dimension sw = lw, sh = lh; + Dimension width_needed = 0; + XtOrientation orientation = bbw->box.orientation; + bbw->box.orientation = XtorientVertical; + while (sh < height && sw > width) { + width_needed = sw; + DoLayout(bbw, sw-1, height, &sw, &sh, False); + } + if (sh < height) width_needed = sw; + if (width_needed != lw) { + DoLayout(bbw,width_needed,height,reply_width,reply_height,position); + bbw->box.orientation = orientation; + return; + } + bbw->box.orientation = orientation; + } + if ( vbox && ( ( width < w ) || ( width < lw ) ) ) { + AssignMax(w, lw); + DoLayout( bbw, w, height, reply_width, reply_height, position ); + return; + } + if (position && XtIsRealized((Widget)bbw)) { + if (bbw->composite.num_children == num_mapped_children) + XMapSubwindows( XtDisplay((Widget)bbw), XtWindow((Widget)bbw) ); + else { + int i = bbw->composite.num_children; + Widget *childP = bbw->composite.children; + for (; i > 0; childP++, i--) + if (XtIsRealized(*childP) && XtIsManaged(*childP) && + (*childP)->core.mapped_when_managed) + XtMapWidget(*childP); + } + } + + /* Finish off last line */ + if (lw > h_space) { + AssignMax(w, lw); + h += lh + bbw->box.v_space; + } + + *reply_width = Max(w, 1); + *reply_height = Max(h, 1); +} + +/* + * + * Calculate preferred size, given constraining box, caching it in the widget. + * + */ + +static XtGeometryResult PreferredSize(widget, constraint, preferred) + Widget widget; + XtWidgetGeometry *constraint, *preferred; +{ + BoxWidget w = (BoxWidget)widget; + Dimension width /*, height */; + Dimension preferred_width = w->box.preferred_width; + Dimension preferred_height = w->box.preferred_height; + + constraint->request_mode &= CWWidth | CWHeight; + + if (constraint->request_mode == 0) + /* parent isn't going to change w or h, so nothing to re-compute */ + return XtGeometryYes; + + if (constraint->request_mode == w->box.last_query_mode && + (!(constraint->request_mode & CWWidth) || + constraint->width == w->box.last_query_width) && + (!(constraint->request_mode & CWHeight) || + constraint->height == w->box.last_query_height)) { + /* same query; current preferences are still valid */ + preferred->request_mode = CWWidth | CWHeight; + preferred->width = preferred_width; + preferred->height = preferred_height; + if (constraint->request_mode == (CWWidth | CWHeight) && + constraint->width == preferred_width && + constraint->height == preferred_height) + return XtGeometryYes; + else + return XtGeometryAlmost; + } + + /* else gotta do it the long way... + I have a preference for tall and narrow, so if my width is + constrained, I'll accept it; otherwise, I'll compute the minimum + width that will fit me within the height constraint */ + + w->box.last_query_mode = constraint->request_mode; + w->box.last_query_width = constraint->width; + w->box.last_query_height= constraint->height; + + if (constraint->request_mode & CWWidth) + width = constraint->width; + else /* if (constraint->request_mode & CWHeight) */ { + /* let's see if I can become any narrower */ + width = 0; + constraint->width = 65535; + } + + /* height is currently ignored by DoLayout. + height = (constraint->request_mode & CWHeight) ? constraint->height + : *preferred_height; + */ + DoLayout(w, width, (Dimension)0, + &preferred_width, &preferred_height, FALSE); + + if (constraint->request_mode & CWHeight && + preferred_height > constraint->height) { + /* find minimum width for this height */ + if (preferred_width > constraint->width) { + /* punt; over-constrained */ + } + else { + width = preferred_width; + do { /* find some width big enough to stay within this height */ + width *= 2; + if (width > constraint->width) width = constraint->width; + DoLayout(w, width, 0, &preferred_width, &preferred_height, FALSE); + } while (preferred_height > constraint->height && + width < constraint->width); + if (width != constraint->width) { + do { /* find minimum width */ + width = preferred_width; + DoLayout(w, preferred_width-1, 0, + &preferred_width, &preferred_height, FALSE); + } while (preferred_height < constraint->height); + /* one last time */ + DoLayout(w, width, 0, &preferred_width, &preferred_height, FALSE); + } + } + } + + preferred->request_mode = CWWidth | CWHeight; + preferred->width = w->box.preferred_width = preferred_width; + preferred->height = w->box.preferred_height = preferred_height; + + if (constraint->request_mode == (CWWidth|CWHeight) + && constraint->width == preferred_width + && constraint->height == preferred_height) + return XtGeometryYes; + else + return XtGeometryAlmost; + +} + +/* + * + * Actually layout the box + * + */ + +static void Resize(w) + Widget w; +{ + Dimension junk; + + DoLayout((BoxWidget)w, w->core.width, w->core.height, &junk, &junk, TRUE); + +} /* Resize */ + +/* + * + * Try to do a new layout within the current width and height; + * if that fails try to resize and do it within the box returne + * by PreferredSize. + * + * TryNewLayout just says if it's possible, and doesn't actually move the kids + */ + +static Boolean TryNewLayout(bbw) + BoxWidget bbw; +{ + Dimension preferred_width, preferred_height; + Dimension proposed_width, proposed_height; + int iterations; + + DoLayout( bbw, bbw->core.width, bbw->core.height, + &preferred_width, &preferred_height, FALSE ); + + /* at this point, preferred_width is guaranteed to not be greater + than bbw->core.width unless some child is larger, so there's no + point in re-computing another layout */ + + if ((bbw->core.width == preferred_width) && + (bbw->core.height == preferred_height)) { + /* Same size */ + return (TRUE); + } + + /* let's see if our parent will go for a new size. */ + iterations = 0; + proposed_width = preferred_width; + proposed_height = preferred_height; + do { + switch (XtMakeResizeRequest((Widget)bbw,proposed_width,proposed_height, + &proposed_width, &proposed_height)) + { + case XtGeometryYes: + return (TRUE); + + case XtGeometryNo: + if (iterations > 0) + /* protect from malicious parents who change their minds */ + DoLayout( bbw, bbw->core.width, bbw->core.height, + &preferred_width, &preferred_height, FALSE ); + if ((preferred_width <= bbw->core.width) && + (preferred_height <= bbw->core.height)) + return (TRUE); + else + return (FALSE); + + case XtGeometryAlmost: + if (proposed_height >= preferred_height && + proposed_width >= preferred_width) { + + /* + * Take it, and assume the parent knows what it is doing. + * + * The parent must accept this since it was returned in + * almost. + * + */ + (void) XtMakeResizeRequest( (Widget)bbw, + proposed_width, proposed_height, + &proposed_width, &proposed_height); + return(TRUE); + } + else if (proposed_width != preferred_width) { + /* recalc bounding box; height might change */ + DoLayout(bbw, proposed_width, 0, + &preferred_width, &preferred_height, FALSE); + proposed_height = preferred_height; + } + else { /* proposed_height != preferred_height */ + XtWidgetGeometry constraints, reply; + constraints.request_mode = CWHeight; + constraints.height = proposed_height; + (void)PreferredSize((Widget)bbw, &constraints, &reply); + proposed_width = preferred_width; + } + break; + + case XtGeometryDone: /* ??? */ + default: + break; + } + iterations++; + } while (iterations < 10); + return (FALSE); +} + +/* + * + * Geometry Manager + * + * 'reply' is unused; we say only yeay or nay, never almost. + * + */ + +/*ARGSUSED*/ +static XtGeometryResult GeometryManager(w, request, reply) + Widget w; + XtWidgetGeometry *request; + XtWidgetGeometry *reply; /* RETURN */ + +{ + Dimension width, height, borderWidth; + BoxWidget bbw; + + /* Position request always denied */ + if ((request->request_mode & CWX && request->x != w->core.x) || + (request->request_mode & CWY && request->y != w->core.y)) + return (XtGeometryNo); + + /* Size changes must see if the new size can be accomodated */ + if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth)) { + + /* Make all three fields in the request valid */ + if ((request->request_mode & CWWidth) == 0) + request->width = w->core.width; + if ((request->request_mode & CWHeight) == 0) + request->height = w->core.height; + if ((request->request_mode & CWBorderWidth) == 0) + request->border_width = w->core.border_width; + + /* Save current size and set to new size */ + width = w->core.width; + height = w->core.height; + borderWidth = w->core.border_width; + w->core.width = request->width; + w->core.height = request->height; + w->core.border_width = request->border_width; + + /* Decide if new layout works: (1) new widget is smaller, + (2) new widget fits in existing Box, (3) Box can be + expanded to allow new widget to fit */ + + bbw = (BoxWidget) w->core.parent; + +/* whenever a child changes his geometry, we attempt to + * change ours to be the minimum enclosing size... + if (((request->width + request->border_width <= width + borderWidth) && + (request->height + request->border_width <= height + borderWidth)) + || bbw->box.preferred_width < bbw->core.width + || bbw->box.preferred_height < bbw->core.height + || TryNewLayout(bbw)) { + */ + if (TryNewLayout(bbw)) { + /* Fits in existing or new space, relayout */ + (*XtClass((Widget)bbw)->core_class.resize)((Widget)bbw); + return (XtGeometryYes); + } else { + /* Cannot satisfy request, change back to original geometry */ + w->core.width = width; + w->core.height = height; + w->core.border_width = borderWidth; + return (XtGeometryNo); + } + }; /* if any size changes requested */ + + /* Any stacking changes don't make a difference, so allow if that's all */ + return (XtGeometryYes); +} + +static void ChangeManaged(w) + Widget w; +{ + /* Reconfigure the box */ + (void) TryNewLayout((BoxWidget)w); + Resize(w); +} + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, + (XtConvertArgList)NULL, (Cardinal)0 ); +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + BoxWidget newbbw = (BoxWidget)new; + + newbbw->box.last_query_mode = CWWidth | CWHeight; + newbbw->box.last_query_width = newbbw->box.last_query_height = 0; + newbbw->box.preferred_width = Max(newbbw->box.h_space, 1); + newbbw->box.preferred_height = Max(newbbw->box.v_space, 1); + + if (newbbw->core.width == 0) + newbbw->core.width = newbbw->box.preferred_width; + + if (newbbw->core.height == 0) + newbbw->core.height = newbbw->box.preferred_height; + +} /* Initialize */ + +static void Realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + attributes->bit_gravity = NorthWestGravity; + *valueMask |= CWBitGravity; + + XtCreateWindow( w, (unsigned)InputOutput, (Visual *)CopyFromParent, + *valueMask, attributes); +} /* Realize */ + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + /* need to relayout if h_space or v_space change */ + + return False; +} diff --git a/vendor/x11iraf/xaw3d/Box.h b/vendor/x11iraf/xaw3d/Box.h new file mode 100644 index 00000000..b303c99e --- /dev/null +++ b/vendor/x11iraf/xaw3d/Box.h @@ -0,0 +1,98 @@ +/* +* $XConsortium: Box.h,v 1.22 94/04/17 20:11:55 rws Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawBox_h +#define _XawBox_h + +#include <X11/Xmu/Converters.h> + +/*********************************************************************** + * + * Box Widget (subclass of CompositeClass) + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + hSpace HSpace Dimension 4 + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + orientation Orientation XtOrientation vertical + vSpace VSpace Dimension 4 + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + + +/* New fields */ +#ifndef _XtStringDefs_h_ +#define XtNhSpace "hSpace" +#define XtNvSpace "vSpace" +#endif + +/* Class record constants */ + +extern WidgetClass boxWidgetClass; + +typedef struct _BoxClassRec *BoxWidgetClass; +typedef struct _BoxRec *BoxWidget; + +#endif /* _XawBox_h */ diff --git a/vendor/x11iraf/xaw3d/BoxP.h b/vendor/x11iraf/xaw3d/BoxP.h new file mode 100644 index 00000000..a2c19e6a --- /dev/null +++ b/vendor/x11iraf/xaw3d/BoxP.h @@ -0,0 +1,108 @@ +/* +* $XConsortium: BoxP.h,v 1.18 94/04/17 20:11:56 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * BoxP.h - Private definitions for Box widget + * + */ + +#ifndef _XawBoxP_h +#define _XawBoxP_h + +/*********************************************************************** + * + * Box Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/Box.h> +#include <X11/Xmu/Converters.h> + +/* New fields for the Box widget class record */ +typedef struct {int empty;} BoxClassPart; + +/* Full class record declaration */ +typedef struct _BoxClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + BoxClassPart box_class; +} BoxClassRec; + +extern BoxClassRec boxClassRec; + +/* New fields for the Box widget record */ +typedef struct { + /* resources */ + Dimension h_space, v_space; + XtOrientation orientation; + + /* private state */ + Dimension preferred_width, preferred_height; + Dimension last_query_width, last_query_height; + XtGeometryMask last_query_mode; +} BoxPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _BoxRec { + CorePart core; + CompositePart composite; + BoxPart box; +} BoxRec; + +#endif /* _XawBoxP_h */ diff --git a/vendor/x11iraf/xaw3d/Cardinals.h b/vendor/x11iraf/xaw3d/Cardinals.h new file mode 100644 index 00000000..716483f4 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Cardinals.h @@ -0,0 +1,44 @@ +/* $XConsortium: Cardinals.h,v 1.6 94/04/17 20:11:57 jim Exp $ */ +/* + +Copyright (c) 1985, 1986, 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#ifndef _Cardinals_h +#define _Cardinals_h + +#define ZERO ((Cardinal)0) +#define ONE ((Cardinal)1) +#define TWO ((Cardinal)2) +#define THREE ((Cardinal)3) +#define FOUR ((Cardinal)4) +#define FIVE ((Cardinal)5) +#define SIX ((Cardinal)6) +#define SEVEN ((Cardinal)7) +#define EIGHT ((Cardinal)8) +#define NINE ((Cardinal)9) +#define TEN ((Cardinal)10) + +#endif /* _Cardinals_h */ diff --git a/vendor/x11iraf/xaw3d/Command.c b/vendor/x11iraf/xaw3d/Command.c new file mode 100644 index 00000000..43ff649d --- /dev/null +++ b/vendor/x11iraf/xaw3d/Command.c @@ -0,0 +1,608 @@ +/* $XConsortium: Command.c,v 1.79 94/04/17 20:11:58 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Command.c - Command button widget + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/CommandP.h> +#include <X11/Xmu/Converters.h> +#include <X11/extensions/shape.h> + +#define DEFAULT_HIGHLIGHT_THICKNESS 2 +#define DEFAULT_SHAPE_HIGHLIGHT 32767 + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +static char defaultTranslations[] = + "<EnterWindow>: highlight() \n\ + <LeaveWindow>: reset() \n\ + <Btn1Down>: set() \n\ + <Btn1Up>: notify() unset() "; + +#define offset(field) XtOffsetOf(CommandRec, field) +static XtResource resources[] = { + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(command.callbacks), XtRCallback, (XtPointer)NULL}, + {XtNhighlightThickness, XtCThickness, XtRDimension, sizeof(Dimension), + offset(command.highlight_thickness), XtRImmediate, + (XtPointer) DEFAULT_SHAPE_HIGHLIGHT}, + {XtNshapeStyle, XtCShapeStyle, XtRShapeStyle, sizeof(int), + offset(command.shape_style), XtRImmediate, (XtPointer)XawShapeRectangle}, + {XtNcornerRoundPercent, XtCCornerRoundPercent, + XtRDimension, sizeof(Dimension), + offset(command.corner_round), XtRImmediate, (XtPointer) 25}, + {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2}, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, + (XtPointer)0} +}; +#undef offset + +static Boolean SetValues(); +static void Initialize(), Redisplay(), Set(), Reset(), Notify(), Unset(); +static void Highlight(), Unhighlight(), Destroy(), PaintCommandWidget(); +static void ClassInitialize(); +static Boolean ShapeButton(); +static void Realize(), Resize(); + +static XtActionsRec actionsList[] = { + {"set", Set}, + {"notify", Notify}, + {"highlight", Highlight}, + {"reset", Reset}, + {"unset", Unset}, + {"unhighlight", Unhighlight} +}; + +#define SuperClass ((LabelWidgetClass)&labelClassRec) + +CommandClassRec commandClassRec = { + { + (WidgetClass) SuperClass, /* superclass */ + "Command", /* class_name */ + sizeof(CommandRec), /* size */ + ClassInitialize, /* class_initialize */ + NULL, /* class_part_initialize */ + FALSE, /* class_inited */ + Initialize, /* initialize */ + NULL, /* initialize_hook */ + Realize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* resource_count */ + NULLQUARK, /* xrm_class */ + FALSE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + Destroy, /* destroy */ + Resize, /* resize */ + Redisplay, /* expose */ + SetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + }, /* CoreClass fields initialization */ + { + XtInheritChangeSensitive /* change_sensitive */ + }, /* SimpleClass fields initialization */ + { + XtInheritXaw3dShadowDraw, /* shadowdraw */ + }, /* ThreeD Class fields initialization */ + { + 0, /* field not used */ + }, /* LabelClass fields initialization */ + { + 0, /* field not used */ + }, /* CommandClass fields initialization */ +}; + + /* for public consumption */ +WidgetClass commandWidgetClass = (WidgetClass) &commandClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static GC +Get_GC(cbw, fg, bg) +CommandWidget cbw; +Pixel fg, bg; +{ + XGCValues values; + + values.foreground = fg; + values.background = bg; + values.font = cbw->label.font->fid; + values.cap_style = CapProjecting; + + if (cbw->command.highlight_thickness > 1 ) + values.line_width = cbw->command.highlight_thickness; + else + values.line_width = 0; + + if ( cbw->simple.international == True ) + return XtAllocateGC((Widget)cbw, 0, + (GCForeground|GCBackground|GCLineWidth|GCCapStyle), + &values, GCFont, 0 ); + else + return XtGetGC((Widget)cbw, + (GCForeground|GCBackground|GCFont|GCLineWidth|GCCapStyle), + &values); +} + + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; /* unused */ +Cardinal *num_args; /* unused */ +{ + CommandWidget cbw = (CommandWidget) new; + int shape_event_base, shape_error_base; + + if (cbw->command.shape_style != XawShapeRectangle + && !XShapeQueryExtension(XtDisplay(new), &shape_event_base, + &shape_error_base)) + cbw->command.shape_style = XawShapeRectangle; + if (cbw->command.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) { + if (cbw->command.shape_style != XawShapeRectangle) + cbw->command.highlight_thickness = 0; + else + cbw->command.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS; + } + if (cbw->command.shape_style != XawShapeRectangle) { + cbw->threeD.shadow_width = 0; + cbw->core.border_width = 1; + } + + cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, + cbw->core.background_pixel); + cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, + cbw->label.foreground); + XtReleaseGC(new, cbw->label.normal_GC); + cbw->label.normal_GC = cbw->command.normal_GC; + + cbw->command.set = FALSE; + cbw->command.highlighted = HighlightNone; +} + +static Region +HighlightRegion(cbw) +CommandWidget cbw; +{ + static Region outerRegion = NULL, innerRegion, emptyRegion; + Dimension s = cbw->threeD.shadow_width; + XRectangle rect; + + if (cbw->command.highlight_thickness == 0 || + cbw->command.highlight_thickness > + (Dimension) ((Dimension) Min(cbw->core.width, cbw->core.height)/2)) + return(NULL); + + if (outerRegion == NULL) { + /* save time by allocating scratch regions only once. */ + outerRegion = XCreateRegion(); + innerRegion = XCreateRegion(); + emptyRegion = XCreateRegion(); + } + + rect.x = rect.y = s; + rect.width = cbw->core.width - 2 * s; + rect.height = cbw->core.height - 2 * s; + XUnionRectWithRegion( &rect, emptyRegion, outerRegion ); + rect.x = rect.y += cbw->command.highlight_thickness; + rect.width -= cbw->command.highlight_thickness * 2; + rect.height -= cbw->command.highlight_thickness * 2; + XUnionRectWithRegion( &rect, emptyRegion, innerRegion ); + XSubtractRegion( outerRegion, innerRegion, outerRegion ); + return outerRegion; +} + +/*************************** +* +* Action Procedures +* +***************************/ + +/* ARGSUSED */ +static void +Set(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + CommandWidget cbw = (CommandWidget)w; + + if (cbw->command.set) + return; + + cbw->command.set= TRUE; + if (XtIsRealized(w)) + PaintCommandWidget(w, event, (Region) NULL, TRUE); +} + +/* ARGSUSED */ +static void +Unset(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; +{ + CommandWidget cbw = (CommandWidget)w; + + if (!cbw->command.set) + return; + + cbw->command.set = FALSE; + if (XtIsRealized(w)) { + XClearWindow(XtDisplay(w), XtWindow(w)); + PaintCommandWidget(w, event, (Region) NULL, TRUE); + } +} + +/* ARGSUSED */ +static void +Reset(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + CommandWidget cbw = (CommandWidget)w; + + if (cbw->command.set) { + cbw->command.highlighted = HighlightNone; + Unset(w, event, params, num_params); + } else + Unhighlight(w, event, params, num_params); +} + +/* ARGSUSED */ +static void +Highlight(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; +Cardinal *num_params; +{ + CommandWidget cbw = (CommandWidget)w; + + if ( *num_params == (Cardinal) 0) + cbw->command.highlighted = HighlightWhenUnset; + else { + if ( *num_params != (Cardinal) 1) + XtWarning("Too many parameters passed to highlight action table."); + switch (params[0][0]) { + case 'A': + case 'a': + cbw->command.highlighted = HighlightAlways; + break; + default: + cbw->command.highlighted = HighlightWhenUnset; + break; + } + } + + if (XtIsRealized(w)) + PaintCommandWidget(w, event, HighlightRegion(cbw), TRUE); +} + +/* ARGSUSED */ +static void +Unhighlight(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + CommandWidget cbw = (CommandWidget)w; + + cbw->command.highlighted = HighlightNone; + if (XtIsRealized(w)) + PaintCommandWidget(w, event, HighlightRegion(cbw), TRUE); +} + +/* ARGSUSED */ +static void +Notify(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + CommandWidget cbw = (CommandWidget)w; + + /* check to be sure state is still Set so that user can cancel + the action (e.g. by moving outside the window, in the default + bindings. + */ + if (cbw->command.set) + XtCallCallbackList(w, cbw->command.callbacks, (XtPointer) NULL); +} + +/* + * Repaint the widget window + */ + +/************************ +* +* REDISPLAY (DRAW) +* +************************/ + +/* ARGSUSED */ +static void +Redisplay(w, event, region) +Widget w; +XEvent *event; +Region region; +{ + PaintCommandWidget(w, event, region, FALSE); +} + +/* Function Name: PaintCommandWidget + * Description: Paints the command widget. + * Arguments: w - the command widget. + * region - region to paint (passed to the superclass). + * change - did it change either set or highlight state? + * Returns: none + */ + +static void +PaintCommandWidget(w, event, region, change) +Widget w; +XEvent *event; +Region region; +Boolean change; +{ + CommandWidget cbw = (CommandWidget) w; + CommandWidgetClass cwclass = (CommandWidgetClass) XtClass (w); + Boolean very_thick; + GC norm_gc, rev_gc; + Dimension s = cbw->threeD.shadow_width; + + very_thick = cbw->command.highlight_thickness > + (Dimension)((Dimension) Min(cbw->core.width, cbw->core.height)/2); + + if (cbw->command.set) { + cbw->label.normal_GC = cbw->command.inverse_GC; + XFillRectangle(XtDisplay(w), XtWindow(w), cbw->command.normal_GC, + s, s, cbw->core.width - 2 * s, cbw->core.height - 2 * s); + region = NULL; /* Force label to repaint text. */ + } + else + cbw->label.normal_GC = cbw->command.normal_GC; + + if (cbw->command.highlight_thickness <= 0) + { + (*SuperClass->core_class.expose) (w, event, region); + (*cwclass->threeD_class.shadowdraw) (w, event, region, !cbw->command.set); + return; + } + +/* + * If we are set then use the same colors as if we are not highlighted. + */ + + if (cbw->command.set == (cbw->command.highlighted == HighlightNone)) { + norm_gc = cbw->command.inverse_GC; + rev_gc = cbw->command.normal_GC; + } + else { + norm_gc = cbw->command.normal_GC; + rev_gc = cbw->command.inverse_GC; + } + + if ( !( (!change && (cbw->command.highlighted == HighlightNone)) || + ((cbw->command.highlighted == HighlightWhenUnset) && + (cbw->command.set))) ) { + if (very_thick) { + cbw->label.normal_GC = norm_gc; /* Give the label the right GC. */ + XFillRectangle(XtDisplay(w),XtWindow(w), rev_gc, + s, s, cbw->core.width - 2 * s, cbw->core.height - 2 * s); + } + else { + /* wide lines are centered on the path, so indent it */ + int offset = cbw->command.highlight_thickness/2; + XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, s + offset, s + offset, + cbw->core.width - cbw->command.highlight_thickness - 2 * s, + cbw->core.height - cbw->command.highlight_thickness - 2 * s); + } + } + (*SuperClass->core_class.expose) (w, event, region); + (*cwclass->threeD_class.shadowdraw) (w, event, region, !cbw->command.set); +} + +static void +Destroy(w) +Widget w; +{ + CommandWidget cbw = (CommandWidget) w; + + /* so Label can release it */ + if (cbw->label.normal_GC == cbw->command.normal_GC) + XtReleaseGC( w, cbw->command.inverse_GC ); + else + XtReleaseGC( w, cbw->command.normal_GC ); +} + +/* + * Set specified arguments into widget + */ + +/* ARGSUSED */ +static Boolean +SetValues (current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + CommandWidget oldcbw = (CommandWidget) current; + CommandWidget cbw = (CommandWidget) new; + Boolean redisplay = False; + + if ( oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) { + /* about to become insensitive */ + cbw->command.set = FALSE; + cbw->command.highlighted = HighlightNone; + redisplay = TRUE; + } + + if ( (oldcbw->label.foreground != cbw->label.foreground) || + (oldcbw->core.background_pixel != cbw->core.background_pixel) || + (oldcbw->command.highlight_thickness != + cbw->command.highlight_thickness) || + (oldcbw->label.font != cbw->label.font) ) + { + if (oldcbw->label.normal_GC == oldcbw->command.normal_GC) + /* Label has release one of these */ + XtReleaseGC(new, cbw->command.inverse_GC); + else + XtReleaseGC(new, cbw->command.normal_GC); + + cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground, + cbw->core.background_pixel); + cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel, + cbw->label.foreground); + XtReleaseGC(new, cbw->label.normal_GC); + cbw->label.normal_GC = (cbw->command.set + ? cbw->command.inverse_GC + : cbw->command.normal_GC); + + redisplay = True; + } + + if ( XtIsRealized(new) + && oldcbw->command.shape_style != cbw->command.shape_style + && !ShapeButton(cbw, TRUE)) + { + cbw->command.shape_style = oldcbw->command.shape_style; + } + + return (redisplay); +} + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtSetTypeConverter( XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle, + (XtConvertArgList)NULL, 0, XtCacheNone, (XtDestructor)NULL ); +} + + +static Boolean +ShapeButton(cbw, checkRectangular) +CommandWidget cbw; +Boolean checkRectangular; +{ + Dimension corner_size = 0; + + if ( (cbw->command.shape_style == XawShapeRoundedRectangle) ) { + corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width + : cbw->core.height; + corner_size = (int) (corner_size * cbw->command.corner_round) / 100; + } + + if (checkRectangular || cbw->command.shape_style != XawShapeRectangle) { + if (!XmuReshapeWidget((Widget) cbw, cbw->command.shape_style, + corner_size, corner_size)) { + cbw->command.shape_style = XawShapeRectangle; + return(False); + } + } + return(TRUE); +} + +static void Realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + (*commandWidgetClass->core_class.superclass->core_class.realize) + (w, valueMask, attributes); + + ShapeButton( (CommandWidget) w, FALSE); +} + +static void Resize(w) + Widget w; +{ + if (XtIsRealized(w)) + ShapeButton( (CommandWidget) w, FALSE); + + (*commandWidgetClass->core_class.superclass->core_class.resize)(w); +} diff --git a/vendor/x11iraf/xaw3d/Command.h b/vendor/x11iraf/xaw3d/Command.h new file mode 100644 index 00000000..43a8ef49 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Command.h @@ -0,0 +1,118 @@ +/* $XConsortium: Command.h,v 1.29 94/04/17 20:11:59 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawCommand_h +#define _XawCommand_h + +#include <X11/Xaw3d/Label.h> + +/* Command widget resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + accelerators Accelerators AcceleratorTable NULL + ancestorSensitive AncestorSensitive Boolean True + background Background Pixel XtDefaultBackground + backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap + bitmap Pixmap Pixmap None + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderWidth BorderWidth Dimension 1 + callback Callback XtCallbackList NULL + colormap Colormap Colormap parent's colormap + cornerRoundPercent CornerRoundPercent Dimension 25 + cursor Cursor Cursor None + cursorName Cursor String NULL + depth Depth int parent's depth + destroyCallback Callback XtCallbackList NULL + encoding Encoding UnsignedChar XawTextEncoding8bit + font Font XFontStruct* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + highlightThickness Thickness Dimension 0 if shaped, else 2 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + leftBitmap LeftBitmap Pixmap None + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + resize Resize Boolean True + screen Screen Screen parent's Screen + sensitive Sensitive Boolean True + shapeStyle ShapeStyle ShapeStyle Rectangle + translations Translations TranslationTable see doc or source + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNhighlightThickness "highlightThickness" + +#define XtNshapeStyle "shapeStyle" +#define XtCShapeStyle "ShapeStyle" +#define XtRShapeStyle "ShapeStyle" +#define XtNcornerRoundPercent "cornerRoundPercent" +#define XtCCornerRoundPercent "CornerRoundPercent" + +#define XawShapeRectangle XmuShapeRectangle +#define XawShapeOval XmuShapeOval +#define XawShapeEllipse XmuShapeEllipse +#define XawShapeRoundedRectangle XmuShapeRoundedRectangle + +extern WidgetClass commandWidgetClass; + +typedef struct _CommandClassRec *CommandWidgetClass; +typedef struct _CommandRec *CommandWidget; + +#endif /* _XawCommand_h */ diff --git a/vendor/x11iraf/xaw3d/CommandP.h b/vendor/x11iraf/xaw3d/CommandP.h new file mode 100644 index 00000000..2d837239 --- /dev/null +++ b/vendor/x11iraf/xaw3d/CommandP.h @@ -0,0 +1,142 @@ +/* +* $XConsortium: CommandP.h,v 1.31 94/04/17 20:12:01 rws Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * CommandP.h - Private definitions for Command widget + * + */ + +#ifndef _XawCommandP_h +#define _XawCommandP_h + +#include <X11/Xaw3d/Command.h> +#include <X11/Xaw3d/LabelP.h> + +/*********************************************************************** + * + * Command Widget Private Data + * + ***********************************************************************/ + +typedef enum { + HighlightNone, /* Do not highlight. */ + HighlightWhenUnset, /* Highlight only when unset, this is + to preserve current command widget + functionality. */ + HighlightAlways /* Always highlight, lets the toggle widget + and other subclasses do the right thing. */ +} XtCommandHighlight; + +/************************************ + * + * Class structure + * + ***********************************/ + + + /* New fields for the Command widget class record */ +typedef struct _CommandClass + { + int makes_compiler_happy; /* not used */ + } CommandClassPart; + + /* Full class record declaration */ +typedef struct _CommandClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + LabelClassPart label_class; + CommandClassPart command_class; +} CommandClassRec; + +extern CommandClassRec commandClassRec; + +/*************************************** + * + * Instance (widget) structure + * + **************************************/ + + /* New fields for the Command widget record */ +typedef struct { + /* resources */ + Dimension highlight_thickness; + XtCallbackList callbacks; + + /* private state */ + Pixmap gray_pixmap; + GC normal_GC; + GC inverse_GC; + Boolean set; + XtCommandHighlight highlighted; + /* more resources */ + int shape_style; + Dimension corner_round; +} CommandPart; + + +/* XtEventsPtr eventTable;*/ + + + /* Full widget declaration */ +typedef struct _CommandRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + LabelPart label; + CommandPart command; +} CommandRec; + +#endif /* _XawCommandP_h */ + + diff --git a/vendor/x11iraf/xaw3d/Dialog.c b/vendor/x11iraf/xaw3d/Dialog.c new file mode 100644 index 00000000..aec1acee --- /dev/null +++ b/vendor/x11iraf/xaw3d/Dialog.c @@ -0,0 +1,448 @@ +/* $XConsortium: Dialog.c,v 1.48 94/04/17 20:12:02 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* NOTE: THIS IS NOT A WIDGET! Rather, this is an interface to a widget. + It implements policy, and gives a (hopefully) easier-to-use interface + than just directly making your own form. */ + + +#include <X11/IntrinsicP.h> +#include <X11/Xos.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Misc.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/AsciiText.h> +#include <X11/Xaw3d/Command.h> +#include <X11/Xaw3d/Label.h> +#include <X11/Xaw3d/DialogP.h> +#include <X11/Xaw3d/Cardinals.h> + +/* + * After we have set the string in the value widget we set the + * string to a magic value. So that when a SetValues request is made + * on the dialog value we will notice it, and reset the string. + */ + +#define MAGIC_VALUE ((char *) 3) + +#define streq(a,b) (strcmp( (a), (b) ) == 0) + +static XtResource resources[] = { + {XtNlabel, XtCLabel, XtRString, sizeof(String), + XtOffsetOf(DialogRec, dialog.label), XtRString, NULL}, + {XtNvalue, XtCValue, XtRString, sizeof(String), + XtOffsetOf(DialogRec, dialog.value), XtRString, NULL}, + {XtNicon, XtCIcon, XtRBitmap, sizeof(Pixmap), + XtOffsetOf(DialogRec, dialog.icon), XtRImmediate, 0}, +}; + +static void Initialize(), ConstraintInitialize(), CreateDialogValueWidget(), + GetValuesHook(); + +static Boolean SetValues(); + +DialogClassRec dialogClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) &formClassRec, + /* class_name */ "Dialog", + /* widget_size */ sizeof(DialogRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ GetValuesHook, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* composite_class fields */ + /* geometry_manager */ XtInheritGeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, + { /* constraint_class fields */ + /* subresourses */ NULL, + /* subresource_count */ 0, + /* constraint_size */ sizeof(DialogConstraintsRec), + /* initialize */ ConstraintInitialize, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL + }, + { /* form_class fields */ + /* layout */ XtInheritLayout + }, + { /* dialog_class fields */ + /* empty */ 0 + } +}; + +WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec; + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + DialogWidget dw = (DialogWidget)new; + Arg arglist[9]; + Cardinal arg_cnt = 0; + + XtSetArg(arglist[arg_cnt], XtNborderWidth, 0); arg_cnt++; + XtSetArg(arglist[arg_cnt], XtNleft, XtChainLeft); arg_cnt++; + + if (dw->dialog.icon != (Pixmap)0) { + XtSetArg(arglist[arg_cnt], XtNbitmap, dw->dialog.icon); arg_cnt++; + XtSetArg(arglist[arg_cnt], XtNright, XtChainLeft); arg_cnt++; + dw->dialog.iconW = + XtCreateManagedWidget( "icon", labelWidgetClass, + new, arglist, arg_cnt ); + arg_cnt = 2; + XtSetArg(arglist[arg_cnt], XtNfromHoriz, dw->dialog.iconW);arg_cnt++; + } else dw->dialog.iconW = (Widget)NULL; + + XtSetArg(arglist[arg_cnt], XtNlabel, dw->dialog.label); arg_cnt++; + XtSetArg(arglist[arg_cnt], XtNright, XtChainRight); arg_cnt++; + + dw->dialog.labelW = XtCreateManagedWidget( "label", labelWidgetClass, + new, arglist, arg_cnt); + + if (dw->dialog.iconW != (Widget)NULL && + (dw->dialog.labelW->core.height < dw->dialog.iconW->core.height)) { + XtSetArg( arglist[0], XtNheight, dw->dialog.iconW->core.height ); + XtSetValues( dw->dialog.labelW, arglist, ONE ); + } + if (dw->dialog.value != NULL) + CreateDialogValueWidget( (Widget) dw); + else + dw->dialog.valueW = NULL; +} + +/* ARGSUSED */ +static void ConstraintInitialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + DialogWidget dw = (DialogWidget)new->core.parent; + DialogConstraints constraint = (DialogConstraints)new->core.constraints; + + if (!XtIsSubclass(new, commandWidgetClass)) /* if not a button */ + return; /* then just use defaults */ + + constraint->form.left = constraint->form.right = XtChainLeft; + if (dw->dialog.valueW == NULL) + constraint->form.vert_base = dw->dialog.labelW; + else + constraint->form.vert_base = dw->dialog.valueW; + + if (dw->composite.num_children > 1) { + WidgetList children = dw->composite.children; + Widget *childP; + for (childP = children + dw->composite.num_children - 1; + childP >= children; childP-- ) { + if (*childP == dw->dialog.labelW || *childP == dw->dialog.valueW) + break; + if (XtIsManaged(*childP) && + XtIsSubclass(*childP, commandWidgetClass)) { + constraint->form.horiz_base = *childP; + break; + } + } + } +} + +#define ICON 0 +#define LABEL 1 +#define NUM_CHECKS 2 + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, in_args, in_num_args) +Widget current, request, new; +ArgList in_args; +Cardinal *in_num_args; +{ + DialogWidget w = (DialogWidget)new; + DialogWidget old = (DialogWidget)current; + Arg args[5]; + Cardinal num_args; + int i; + Boolean checks[NUM_CHECKS]; + + for (i = 0; i < NUM_CHECKS; i++) + checks[i] = FALSE; + + for (i = 0; i < *in_num_args; i++) { + if (streq(XtNicon, in_args[i].name)) + checks[ICON] = TRUE; + if (streq(XtNlabel, in_args[i].name)) + checks[LABEL] = TRUE; + } + + if (checks[ICON]) { + if (w->dialog.icon != (Pixmap)0) { + XtSetArg( args[0], XtNbitmap, w->dialog.icon ); + if (old->dialog.iconW != (Widget)NULL) { + XtSetValues( old->dialog.iconW, args, ONE ); + } else { + XtSetArg( args[1], XtNborderWidth, 0); + XtSetArg( args[2], XtNleft, XtChainLeft); + XtSetArg( args[3], XtNright, XtChainLeft); + w->dialog.iconW = + XtCreateWidget( "icon", labelWidgetClass, + new, args, FOUR ); + ((DialogConstraints)w->dialog.labelW->core.constraints)-> + form.horiz_base = w->dialog.iconW; + XtManageChild(w->dialog.iconW); + } + } else if (old->dialog.icon != (Pixmap)0) { + ((DialogConstraints)w->dialog.labelW->core.constraints)-> + form.horiz_base = (Widget)NULL; + XtDestroyWidget(old->dialog.iconW); + w->dialog.iconW = (Widget)NULL; + } + } + + if ( checks[LABEL] ) { + num_args = 0; + XtSetArg( args[num_args], XtNlabel, w->dialog.label ); num_args++; + if (w->dialog.iconW != (Widget)NULL && + (w->dialog.labelW->core.height <= w->dialog.iconW->core.height)) { + XtSetArg(args[num_args], XtNheight, w->dialog.iconW->core.height); + num_args++; + } + XtSetValues( w->dialog.labelW, args, num_args ); + } + + if ( w->dialog.value != old->dialog.value ) { + if (w->dialog.value == NULL) /* only get here if it + wasn't NULL before. */ + XtDestroyWidget(old->dialog.valueW); + else if (old->dialog.value == NULL) { /* create a new value widget. */ + w->core.width = old->core.width; + w->core.height = old->core.height; +#ifdef notdef +/* this would be correct if Form had the same semantics on Resize + * as on MakeGeometryRequest. Unfortunately, Form botched it, so + * any subclasses will currently have to deal with the fact that + * we're about to change our real size. + */ + w->form.resize_in_layout = False; + CreateDialogValueWidget( (Widget) w); + w->core.width = w->form.preferred_width; + w->core.height = w->form.preferred_height; + w->form.resize_in_layout = True; +#else /*notdef*/ + CreateDialogValueWidget( (Widget) w); +#endif /*notdef*/ + } + else { /* Widget ok, just change string. */ + Arg args[1]; + XtSetArg(args[0], XtNstring, w->dialog.value); + XtSetValues(w->dialog.valueW, args, ONE); + w->dialog.value = MAGIC_VALUE; + } + } + return False; +} + +/* Function Name: GetValuesHook + * Description: This is a get values hook routine that gets the + * values in the dialog. + * Arguments: w - the Text Widget. + * args - the argument list. + * num_args - the number of args. + * Returns: none. + */ + +static void +GetValuesHook(w, args, num_args) +Widget w; +ArgList args; +Cardinal * num_args; +{ + Arg a[1]; + String s; + DialogWidget src = (DialogWidget) w; + int i; + + for (i=0; i < *num_args; i++) + if (streq(args[i].name, XtNvalue)) { + XtSetArg(a[0], XtNstring, &s); + XtGetValues(src->dialog.valueW, a, 1); + *((char **) args[i].value) = s; + } +} + + +/* Function Name: CreateDialogValueWidget + * Description: Creates the dialog widgets value widget. + * Arguments: w - the dialog widget. + * Returns: none. + * + * must be called only when w->dialog.value is non-nil. + */ + +static void +CreateDialogValueWidget(w) +Widget w; +{ + DialogWidget dw = (DialogWidget) w; + Arg arglist[10]; + Cardinal num_args = 0; + +#ifdef notdef + XtSetArg(arglist[num_args], XtNwidth, + dw->dialog.labelW->core.width); num_args++; /* ||| hack */ +#endif /*notdef*/ + XtSetArg(arglist[num_args], XtNstring, dw->dialog.value); num_args++; + XtSetArg(arglist[num_args], XtNresizable, True); num_args++; + XtSetArg(arglist[num_args], XtNresize, XawtextResizeBoth); num_args++; + XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); num_args++; + XtSetArg(arglist[num_args], XtNfromVert, dw->dialog.labelW); num_args++; + XtSetArg(arglist[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(arglist[num_args], XtNright, XtChainRight); num_args++; + + dw->dialog.valueW = XtCreateWidget("value", asciiTextWidgetClass, + w, arglist, num_args); + + /* if the value widget is being added after buttons, + * then the buttons need new layout constraints. + */ + if (dw->composite.num_children > 1) { + WidgetList children = dw->composite.children; + Widget *childP; + for (childP = children + dw->composite.num_children - 1; + childP >= children; childP-- ) { + if (*childP == dw->dialog.labelW || *childP == dw->dialog.valueW) + continue; + if (XtIsManaged(*childP) && + XtIsSubclass(*childP, commandWidgetClass)) { + ((DialogConstraints)(*childP)->core.constraints)-> + form.vert_base = dw->dialog.valueW; + } + } + } + XtManageChild(dw->dialog.valueW); + +/* + * Value widget gets the keyboard focus. + */ + + XtSetKeyboardFocus(w, dw->dialog.valueW); + dw->dialog.value = MAGIC_VALUE; +} + + +void +#if NeedFunctionPrototypes +XawDialogAddButton(Widget dialog, _Xconst char* name, XtCallbackProc function, + XtPointer param) +#else +XawDialogAddButton(dialog, name, function, param) +Widget dialog; +String name; +XtCallbackProc function; +XtPointer param; +#endif +{ +/* + * Correct Constraints are all set in ConstraintInitialize(). + */ + Widget button; + + button = XtCreateManagedWidget( name, commandWidgetClass, dialog, + (ArgList)NULL, (Cardinal)0 ); + + if (function != NULL) /* don't add NULL callback func. */ + XtAddCallback(button, XtNcallback, function, param); +} + + +char * +#if NeedFunctionPrototypes +XawDialogGetValueString(Widget w) +#else +XawDialogGetValueString(w) +Widget w; +#endif +{ + Arg args[1]; + char * value; + + XtSetArg(args[0], XtNstring, &value); + XtGetValues( ((DialogWidget)w)->dialog.valueW, args, ONE); + return(value); +} diff --git a/vendor/x11iraf/xaw3d/Dialog.h b/vendor/x11iraf/xaw3d/Dialog.h new file mode 100644 index 00000000..74ddcfc6 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Dialog.h @@ -0,0 +1,109 @@ +/* $XConsortium: Dialog.h,v 1.28 94/04/17 20:12:03 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawDialog_h +#define _XawDialog_h + +#include <X11/Xaw3d/Form.h> + +/*********************************************************************** + * + * Dialog Widget + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + height Height Dimension computed at create + icon Icon Pixmap 0 + label Label String NULL + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + value Value String NULL + width Width Dimension computed at create + x Position Position 0 + y Position Position 0 + +*/ + +#define XtCIcon "Icon" +#define XtNicon "icon" + +typedef struct _DialogClassRec *DialogWidgetClass; +typedef struct _DialogRec *DialogWidget; + +extern WidgetClass dialogWidgetClass; + +_XFUNCPROTOBEGIN + +extern void XawDialogAddButton( +#if NeedFunctionPrototypes + Widget /* dialog */, + _Xconst char* /* name */, + XtCallbackProc /* function */, + XtPointer /* client_data */ +#endif +); + +extern char *XawDialogGetValueString( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawDialog_h */ diff --git a/vendor/x11iraf/xaw3d/DialogP.h b/vendor/x11iraf/xaw3d/DialogP.h new file mode 100644 index 00000000..77c74f12 --- /dev/null +++ b/vendor/x11iraf/xaw3d/DialogP.h @@ -0,0 +1,98 @@ +/* $XConsortium: DialogP.h,v 1.13 94/04/17 20:12:05 kit Exp $ */ + + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* Private definitions for Dialog widget */ + +#ifndef _DialogP_h +#define _DialogP_h + +#include <X11/Xaw3d/Dialog.h> +#include <X11/Xaw3d/FormP.h> + +typedef struct {int empty;} DialogClassPart; + +typedef struct _DialogClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + FormClassPart form_class; + DialogClassPart dialog_class; +} DialogClassRec; + +extern DialogClassRec dialogClassRec; + +typedef struct _DialogPart { + /* resources */ + String label; /* description of the dialog */ + String value; /* for the user response */ + Pixmap icon; /* icon bitmap */ + /* private data */ + Widget iconW; /* widget to display the icon */ + Widget labelW; /* widget to display description*/ + Widget valueW; /* user response TextWidget */ +} DialogPart; + +typedef struct _DialogRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + FormPart form; + DialogPart dialog; +} DialogRec; + +typedef struct {int empty;} DialogConstraintsPart; + +typedef struct _DialogConstraintsRec { + FormConstraintsPart form; + DialogConstraintsPart dialog; +} DialogConstraintsRec, *DialogConstraints; + +#endif /* _DialogP_h */ diff --git a/vendor/x11iraf/xaw3d/Form.c b/vendor/x11iraf/xaw3d/Form.c new file mode 100644 index 00000000..c4eae4be --- /dev/null +++ b/vendor/x11iraf/xaw3d/Form.c @@ -0,0 +1,848 @@ +/* $XConsortium: Form.c,v 1.52 94/04/17 20:12:06 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/FormP.h> + +/* Private Definitions */ + +static int default_value = -99999; + +#define Offset(field) XtOffsetOf(FormRec, form.field) +static XtResource resources[] = { + {XtNdefaultDistance, XtCThickness, XtRInt, sizeof(int), + Offset(default_spacing), XtRImmediate, (XtPointer)4} +}; +#undef Offset + +static XtEdgeType defEdge = XtRubber; + +#define Offset(field) XtOffsetOf(FormConstraintsRec, form.field) +static XtResource formConstraintResources[] = { + {XtNtop, XtCEdge, XtREdgeType, sizeof(XtEdgeType), + Offset(top), XtREdgeType, (XtPointer)&defEdge}, + {XtNbottom, XtCEdge, XtREdgeType, sizeof(XtEdgeType), + Offset(bottom), XtREdgeType, (XtPointer)&defEdge}, + {XtNleft, XtCEdge, XtREdgeType, sizeof(XtEdgeType), + Offset(left), XtREdgeType, (XtPointer)&defEdge}, + {XtNright, XtCEdge, XtREdgeType, sizeof(XtEdgeType), + Offset(right), XtREdgeType, (XtPointer)&defEdge}, + {XtNhorizDistance, XtCThickness, XtRInt, sizeof(int), + Offset(dx), XtRInt, (XtPointer) &default_value}, + {XtNfromHoriz, XtCWidget, XtRWidget, sizeof(Widget), + Offset(horiz_base), XtRWidget, (XtPointer)NULL}, + {XtNvertDistance, XtCThickness, XtRInt, sizeof(int), + Offset(dy), XtRInt, (XtPointer) &default_value}, + {XtNfromVert, XtCWidget, XtRWidget, sizeof(Widget), + Offset(vert_base), XtRWidget, (XtPointer)NULL}, + {XtNresizable, XtCBoolean, XtRBoolean, sizeof(Boolean), + Offset(allow_resize), XtRImmediate, (XtPointer) FALSE}, +}; +#undef Offset + +static void ClassInitialize(), ClassPartInitialize(), Initialize(), Resize(); +static void ConstraintInitialize(); +static Boolean SetValues(), ConstraintSetValues(); +static XtGeometryResult GeometryManager(), PreferredGeometry(); +static void ChangeManaged(); +static Boolean Layout(); + +static void LayoutChild(), ResizeChildren(); + +FormClassRec formClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) &constraintClassRec, + /* class_name */ "Form", + /* widget_size */ sizeof(FormRec), + /* class_initialize */ ClassInitialize, + /* class_part_init */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ XtInheritExpose, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ PreferredGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* composite_class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, + { /* constraint_class fields */ + /* subresourses */ formConstraintResources, + /* subresource_count */ XtNumber(formConstraintResources), + /* constraint_size */ sizeof(FormConstraintsRec), + /* initialize */ ConstraintInitialize, + /* destroy */ NULL, + /* set_values */ ConstraintSetValues, + /* extension */ NULL + }, + { /* form_class fields */ + /* layout */ Layout + } +}; + +WidgetClass formWidgetClass = (WidgetClass)&formClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + + +static XrmQuark XtQChainLeft, XtQChainRight, XtQChainTop, + XtQChainBottom, XtQRubber; + +/* ARGSUSED */ +static void _CvtStringToEdgeType(args, num_args, fromVal, toVal) + XrmValuePtr args; /* unused */ + Cardinal *num_args; /* unused */ + XrmValuePtr fromVal; + XrmValuePtr toVal; +{ + static XtEdgeType edgeType; + XrmQuark q; + char lowerName[40]; + + if (strlen ((char*) fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered (lowerName, (char*)fromVal->addr); + q = XrmStringToQuark(lowerName); + if (q == XtQChainLeft) edgeType = XtChainLeft; + else if (q == XtQChainRight) edgeType = XtChainRight; + else if (q == XtQChainTop) edgeType = XtChainTop; + else if (q == XtQChainBottom) edgeType = XtChainBottom; + else if (q == XtQRubber) edgeType = XtRubber; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof edgeType; + toVal->addr = (XPointer) &edgeType; + return; + } + toVal->addr = NULL; + toVal->size = 0; +} + +static void ClassInitialize() +{ + static XtConvertArgRec parentCvtArgs[] = { + {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent), + sizeof(Widget)} + }; + XawInitializeWidgetSet(); + XtQChainLeft = XrmPermStringToQuark("chainleft"); + XtQChainRight = XrmPermStringToQuark("chainright"); + XtQChainTop = XrmPermStringToQuark("chaintop"); + XtQChainBottom = XrmPermStringToQuark("chainbottom"); + XtQRubber = XrmPermStringToQuark("rubber"); + + XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, + (XtConvertArgList)NULL, 0 ); + XtSetTypeConverter (XtRString, XtRWidget, XmuNewCvtStringToWidget, + parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone, + (XtDestructor)NULL); +} + +static void ClassPartInitialize(class) + WidgetClass class; +{ + FormWidgetClass c = (FormWidgetClass)class; + FormWidgetClass super = (FormWidgetClass) + c->core_class.superclass; + + if (c->form_class.layout == XtInheritLayout) + c->form_class.layout = super->form_class.layout; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + FormWidget fw = (FormWidget)new; + + fw->form.old_width = fw->core.width; + fw->form.old_height = fw->core.height; + fw->form.no_refigure = False; + fw->form.needs_relayout = False; + fw->form.resize_in_layout = True; + fw->form.resize_is_no_op = False; +} + +/* Function Name: ChangeFormGeometry + * Description: Ask the parent to change the form widget's geometry. + * Arguments: w - the Form widget. + * query_only - TRUE if this is only a query. + * width, height - the new width and height. + * ret_width, ret_height - the actual size the form is allowed + * to resize to. + * Returns: TRUE of children may always be resized. + */ + +static Boolean +ChangeFormGeometry(w, query_only, width, height, ret_width, ret_height) +Widget w; +Boolean query_only; +Dimension width, height; +Dimension *ret_width, *ret_height; +{ + FormWidget fw = (FormWidget) w; + Boolean always_resize_children; + XtGeometryResult result; + XtWidgetGeometry request, return_request; + + /* + * If we are already at the desired size then there is no need + * to ask our parent of we can change size. + */ + + if ( (width == fw->core.width) && (height == fw->core.height) ) + return(TRUE); + + request.width = width; + request.height = height; + request.request_mode = CWWidth | CWHeight; + if (query_only) + request.request_mode |= XtCWQueryOnly; + + /* + * Do no invoke the resize rules if our size changes here. + */ + + fw->form.resize_is_no_op = TRUE; + + result = XtMakeGeometryRequest(w, &request, &return_request); + if (result == XtGeometryAlmost) { + request = return_request; + (void) XtMakeGeometryRequest(w, &request, &return_request); + always_resize_children = FALSE; + } + else + always_resize_children = (result == XtGeometryYes); + + fw->form.resize_is_no_op = FALSE; + + if (ret_width != NULL) + *ret_width = request.width; + if (ret_height != NULL) + *ret_height = request.height; + + return(always_resize_children); +} + +/* Function Name: Layout + * Description: Moves all the children around. + * Arguments: fw - the Form widget. + * width, height - ** UNUSED **. + * force_relayout - will force the children to be + * moved, even if some go past the edge + * of the form. + * Returns: True if the children are allowed to move from their + * current locations to the new ones. + */ + +/* ARGSUSED */ +static Boolean Layout(fw, width, height, force_relayout) + FormWidget fw; + Dimension width, height; + Boolean force_relayout; +{ + int num_children = fw->composite.num_children; + WidgetList children = fw->composite.children; + Widget *childP; + Dimension maxx, maxy; + Boolean ret_val; + + for (childP = children; childP - children < num_children; childP++) { + FormConstraints form = (FormConstraints)(*childP)->core.constraints; + form->form.layout_state = LayoutPending; + } + + maxx = maxy = 1; + for (childP = children; childP - children < num_children; childP++) { + if (XtIsManaged(*childP)) { + FormConstraints form; + Position x, y; + + form = (FormConstraints)(*childP)->core.constraints; + + LayoutChild(*childP); + + x = form->form.new_x + (*childP)->core.width + + ((*childP)->core.border_width << 1); + if (x > (int)maxx) + maxx = x; + + y = form->form.new_y + (*childP)->core.height + + ((*childP)->core.border_width << 1); + if (y > (int)maxy) + maxy = y; + } + } + + fw->form.preferred_width = (maxx += fw->form.default_spacing); + fw->form.preferred_height = (maxy += fw->form.default_spacing); + + if (fw->form.resize_in_layout) { + Boolean always_resize_children; + + always_resize_children = + ChangeFormGeometry( (Widget) fw, FALSE, maxx, maxy, + (Dimension *)NULL, (Dimension *)NULL); + + fw->form.old_width = fw->core.width; + fw->form.old_height = fw->core.height; + + ret_val = (always_resize_children || ( (fw->core.width >= maxx) && + (fw->core.height >= maxy))); + + if (force_relayout) + ret_val = TRUE; + + if (ret_val) + ResizeChildren((Widget) fw); + } + else + ret_val = False; + + fw->form.needs_relayout = False; + return ret_val; +} + +/* Function Name: ResizeChildren + * Description: Resizes all children to new_x and new_y. + * Arguments: w - the form widget. + * Returns: none. + */ + +static void ResizeChildren(w) +Widget w; +{ + FormWidget fw = (FormWidget) w; + int num_children = fw->composite.num_children; + WidgetList children = fw->composite.children; + Widget *childP; + + for (childP = children; childP - children < num_children; childP++) { + FormConstraints form; + + if (!XtIsManaged(*childP)) + continue; + + form = (FormConstraints)(*childP)->core.constraints; + if (fw->form.no_refigure) { +/* + * I am changing the widget wrapper w/o modifing the window. This is + * risky, but I can get away with it since I am the parent of this + * widget, and he must ask me for any geometry changes. + * + * The window will be updated when no_refigure is set back to False. + */ + (*childP)->core.x = form->form.new_x; + (*childP)->core.y = form->form.new_y; + } + else + XtMoveWidget(*childP, form->form.new_x, form->form.new_y); + } +} + + +static void LayoutChild(w) + Widget w; +{ + FormConstraints form = (FormConstraints)w->core.constraints; + Widget ref; + + switch (form->form.layout_state) { + + case LayoutPending: + form->form.layout_state = LayoutInProgress; + break; + + case LayoutDone: + return; + + case LayoutInProgress: + { + String subs[2]; + Cardinal num_subs = 2; + subs[0] = w->core.name; + subs[1] = w->core.parent->core.name; + XtAppWarningMsg(XtWidgetToApplicationContext(w), + "constraintLoop","xawFormLayout","XawToolkitError", + "constraint loop detected while laying out child '%s' in FormWidget '%s'", + subs, &num_subs); + return; + } + } + + form->form.new_x = form->form.dx; + form->form.new_y = form->form.dy; + if ((ref = form->form.horiz_base) != (Widget)NULL) { + FormConstraints ref_form = (FormConstraints) ref->core.constraints; + + LayoutChild(ref); + form->form.new_x += (ref_form->form.new_x + + ref->core.width + (ref->core.border_width << 1)); + } + if ((ref = form->form.vert_base) != (Widget)NULL) { + FormConstraints ref_form = (FormConstraints) ref->core.constraints; + + LayoutChild(ref); + form->form.new_y += (ref_form->form.new_y + + ref->core.height + (ref->core.border_width << 1)); + } + + form->form.layout_state = LayoutDone; +} + + +static Position TransformCoord(loc, old, new, type) + Position loc; + Dimension old, new; + XtEdgeType type; +{ + if (type == XtRubber) { + if ( ((int) old) > 0) + loc = (int)(loc * new) / (int)old; + } + else if (type == XtChainBottom || type == XtChainRight) + loc += (Position)new - (Position)old; + + /* I don't see any problem with returning values less than zero. */ + + return (loc); +} + +static void Resize(w) + Widget w; +{ + FormWidget fw = (FormWidget)w; + WidgetList children = fw->composite.children; + int num_children = fw->composite.num_children; + Widget *childP; + Position x, y; + Dimension width, height; + + if (!fw->form.resize_is_no_op) + for (childP = children; childP - children < num_children; childP++) { + FormConstraints form= (FormConstraints)(*childP)->core.constraints; + if (!XtIsManaged(*childP)) continue; + x = TransformCoord( (*childP)->core.x, fw->form.old_width, + fw->core.width, form->form.left ); + y = TransformCoord( (*childP)->core.y, fw->form.old_height, + fw->core.height, form->form.top ); + + form->form.virtual_width = + TransformCoord((Position)((*childP)->core.x + + form->form.virtual_width + + 2 * (*childP)->core.border_width), + fw->form.old_width, fw->core.width, + form->form.right ) + - (x + 2 * (*childP)->core.border_width); + + form->form.virtual_height = + TransformCoord((Position)((*childP)->core.y + + form->form.virtual_height + + 2 * (*childP)->core.border_width), + fw->form.old_height, fw->core.height, + form->form.bottom ) + - ( y + 2 * (*childP)->core.border_width); + + width = (Dimension) + (form->form.virtual_width < 1) ? 1 : form->form.virtual_width; + height = (Dimension) + (form->form.virtual_height < 1) ? 1 : form->form.virtual_height; + + XtConfigureWidget(*childP,x,y, (Dimension)width, (Dimension)height, + (*childP)->core.border_width ); + } + + fw->form.old_width = fw->core.width; + fw->form.old_height = fw->core.height; +} + +/* + * I don't want to even think about what ``Almost'' would mean - Chris. + */ + +/* ARGSUSED */ +static XtGeometryResult GeometryManager(w, request, reply) + Widget w; + XtWidgetGeometry *request; + XtWidgetGeometry *reply; /* RETURN */ +{ + Dimension old_width, old_height; + FormWidget fw = (FormWidget) XtParent(w); + FormConstraints form = (FormConstraints) w->core.constraints; + XtWidgetGeometry allowed; + XtGeometryResult ret_val; + + if ((request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) || + !form->form.allow_resize) { + + /* If GeometryManager is invoked during a SetValues call on a child + * then it is necessary to compute a new layout if ConstraintSetValues + * allowed any constraint changes. */ + + if (fw->form.needs_relayout) + (*((FormWidgetClass)fw->core.widget_class)->form_class.layout) + (fw, 0, 0, True); + return(XtGeometryNo); + } + + if (request->request_mode & CWWidth) + allowed.width = request->width; + else + allowed.width = w->core.width; + + if (request->request_mode & CWHeight) + allowed.height = request->height; + else + allowed.height = w->core.height; + + if (allowed.width == w->core.width && allowed.height == w->core.height) { + + /* If GeometryManager is invoked during a SetValues call on a child + * then it is necessary to compute a new layout if ConstraintSetValues + * allowed any constraint changes. */ + + if (fw->form.needs_relayout) + (*((FormWidgetClass)fw->core.widget_class)->form_class.layout) + (fw, 0, 0, True); + return(XtGeometryNo); + } + + /* + * Remember the old size, and then set the size to the requested size. + */ + + old_width = w->core.width; + old_height = w->core.height; + w->core.width = allowed.width; + w->core.height = allowed.height; + + if (request->request_mode & XtCWQueryOnly) { + Boolean always_resize_children; + Dimension ret_width, ret_height; + + fw->form.resize_in_layout = FALSE; + + (*((FormWidgetClass)fw->core.widget_class)->form_class.layout) + ( fw, w->core.width, w->core.height, + FALSE ); + + /* + * Reset the size of this child back to what it used to be. + */ + + w->core.width = old_width; + w->core.height = old_height; + + fw->form.resize_in_layout = TRUE; + + always_resize_children = ChangeFormGeometry(w, TRUE, + fw->form.preferred_width, + fw->form.preferred_height, + &ret_width, &ret_height); + + if (always_resize_children || + ((ret_width >= fw->form.preferred_width) && + (ret_height >= fw->form.preferred_height))) + { + ret_val = XtGeometryYes; + } + else + ret_val = XtGeometryNo; + } + else { + if ((*((FormWidgetClass)fw->core.widget_class)->form_class.layout) + ( fw, w->core.width, w->core.height, + FALSE)) + { + form->form.virtual_width = w->core.width; /* reset virtual */ + form->form.virtual_height = w->core.height; /* width and height. */ + if (fw->form.no_refigure) { +/* + * I am changing the widget wrapper w/o modifing the window. This is + * risky, but I can get away with it since I am the parent of this + * widget, and he must ask me for any geometry changes. + * + * The window will be updated when no_refigure is set back to False. + */ + form->form.deferred_resize = True; + ret_val = XtGeometryDone; + } + else + ret_val = XtGeometryYes; + } + else { + w->core.width = old_width; + w->core.height = old_height; + ret_val = XtGeometryNo; + } + } + + return(ret_val); +} + + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + return( FALSE ); +} + + +/* ARGSUSED */ +static void ConstraintInitialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + FormConstraints form = (FormConstraints)new->core.constraints; + FormWidget fw = (FormWidget)new->core.parent; + + form->form.virtual_width = (int) new->core.width; + form->form.virtual_height = (int) new->core.height; + + if (form->form.dx == default_value) + form->form.dx = fw->form.default_spacing; + + if (form->form.dy == default_value) + form->form.dy = fw->form.default_spacing; + + form->form.deferred_resize = False; +} + +/*ARGSUSED*/ +static Boolean ConstraintSetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + FormConstraints cfc = (FormConstraints) current->core.constraints; + FormConstraints nfc = (FormConstraints) new->core.constraints; + + if (cfc->form.top != nfc->form.top || + cfc->form.bottom != nfc->form.bottom || + cfc->form.left != nfc->form.left || + cfc->form.right != nfc->form.right || + cfc->form.dx != nfc->form.dx || + cfc->form.dy != nfc->form.dy || + cfc->form.horiz_base != nfc->form.horiz_base || + cfc->form.vert_base != nfc->form.vert_base) { + + FormWidget fp = (FormWidget) XtParent(new); + + /* If there are no subclass ConstraintSetValues procedures remaining + * to be invoked, and if there is no geometry request about to be + * made, then invoke the new layout now; else defer it. */ + + if (XtClass(XtParent(new)) == formWidgetClass && + current->core.x == new->core.x && + current->core.y == new->core.y && + current->core.width == new->core.width && + current->core.height == new->core.height && + current->core.border_width == new->core.border_width) + Layout(fp, 0, 0, True); + else fp->form.needs_relayout = True; + } + return( FALSE ); +} + +static void ChangeManaged(w) + Widget w; +{ + FormWidget fw = (FormWidget)w; + FormConstraints form; + WidgetList children, childP; + int num_children = fw->composite.num_children; + Widget child; + + /* + * Reset virtual width and height for all children. + */ + + for (children = childP = fw->composite.children ; + childP - children < num_children; childP++) { + child = *childP; + if (XtIsManaged(child)) { + form = (FormConstraints)child->core.constraints; + +/* + * If the size is one (1) then we must not change the virtual sizes, as + * they contain useful information. If someone actually wants a widget of + * width or height one (1) in a form widget he will lose, can't win them all. + * + * Chris D. Peterson 2/9/89. + */ + + if ( child->core.width != 1) + form->form.virtual_width = (int) child->core.width; + if ( child->core.height != 1) + form->form.virtual_height = (int) child->core.height; + } + } + (*((FormWidgetClass)w->core.widget_class)->form_class.layout) + ((FormWidget) w, w->core.width, + w->core.height, TRUE); +} + + +static XtGeometryResult PreferredGeometry( widget, request, reply ) + Widget widget; + XtWidgetGeometry *request, *reply; +{ + FormWidget w = (FormWidget)widget; + + reply->width = w->form.preferred_width; + reply->height = w->form.preferred_height; + reply->request_mode = CWWidth | CWHeight; + if ( request->request_mode & (CWWidth | CWHeight) == + (CWWidth | CWHeight) + && request->width == reply->width + && request->height == reply->height) + return XtGeometryYes; + else if (reply->width == w->core.width && reply->height == w->core.height) + return XtGeometryNo; + else + return XtGeometryAlmost; +} + + +/********************************************************************** + * + * Public routines + * + **********************************************************************/ + +/* + * Set or reset figuring (ignored if not realized) + */ + +void +#if NeedFunctionPrototypes +XawFormDoLayout(Widget w, +#if NeedWidePrototypes + int doit) +#else + Boolean doit) +#endif +#else +XawFormDoLayout(w, doit) +Widget w; +Boolean doit; +#endif +{ + Widget *childP; + FormWidget fw = (FormWidget)w; + int num_children = fw->composite.num_children; + WidgetList children = fw->composite.children; + + if ( ((fw->form.no_refigure = !doit) == TRUE) || !XtIsRealized(w) ) + return; + + for (childP = children; childP - children < num_children; childP++) { + Widget w = *childP; + if (XtIsManaged(w)) { + FormConstraints form = (FormConstraints)w->core.constraints; + + /* + * Xt Configure widget is too smart, and optimizes out + * my changes. + */ + + XMoveResizeWindow(XtDisplay(w), XtWindow(w), + w->core.x, w->core.y, + w->core.width, w->core.height); + + if (form->form.deferred_resize && + XtClass(w)->core_class.resize != (XtWidgetProc) NULL) { + (*(XtClass(w)->core_class.resize))(w); + form->form.deferred_resize = False; + } + } + } +} diff --git a/vendor/x11iraf/xaw3d/Form.h b/vendor/x11iraf/xaw3d/Form.h new file mode 100644 index 00000000..f4c9b5c0 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Form.h @@ -0,0 +1,168 @@ +/* $XConsortium: Form.h,v 1.30 94/04/17 20:12:08 kaleb Exp $ */ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawForm_h +#define _XawForm_h + +#include <X11/Constraint.h> + +/*********************************************************************** + * + * Form Widget + * + ***********************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + defaultDistance Thickness int 4 + destroyCallback Callback Pointer NULL + height Height Dimension computed at realize + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension computed at realize + x Position Position 0 + y Position Position 0 + +*/ + +/* Constraint parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + bottom Edge XtEdgeType XtRubber + fromHoriz Widget Widget (left edge of form) + fromVert Widget Widget (top of form) + horizDistance Thickness int defaultDistance + left Edge XtEdgeType XtRubber + resizable Boolean Boolean False + right Edge XtEdgeType XtRubber + top Edge XtEdgeType XtRubber + vertDistance Thickness int defaultDistance + +*/ + + +#ifndef _XtStringDefs_h_ +#define XtNtop "top" +#define XtRWidget "Widget" +#endif + +#define XtNdefaultDistance "defaultDistance" +#define XtNbottom "bottom" +#define XtNleft "left" +#define XtNright "right" +#define XtNfromHoriz "fromHoriz" +#define XtNfromVert "fromVert" +#define XtNhorizDistance "horizDistance" +#define XtNvertDistance "vertDistance" +#define XtNresizable "resizable" + +#define XtCEdge "Edge" +#define XtCWidget "Widget" + +#ifndef _XawEdgeType_e +#define _XawEdgeType_e +typedef enum { + XawChainTop, /* Keep this edge a constant distance from + the top of the form */ + XawChainBottom, /* Keep this edge a constant distance from + the bottom of the form */ + XawChainLeft, /* Keep this edge a constant distance from + the left of the form */ + XawChainRight, /* Keep this edge a constant distance from + the right of the form */ + XawRubber /* Keep this edge a proportional distance + from the edges of the form*/ +} XawEdgeType; +#endif /* _XawEdgeType_e */ + +/* + * Unfortunatly I missed this definition for R4, so I cannot + * protect it with XAW_BC, it looks like this particular problem is + * one that we will have to live with for a while. + * + * Chris D. Peterson - 3/23/90. + */ + +#define XtEdgeType XawEdgeType + +#define XtChainTop XawChainTop +#define XtChainBottom XawChainBottom +#define XtChainLeft XawChainLeft +#define XtChainRight XawChainRight +#define XtRubber XawRubber + +typedef struct _FormClassRec *FormWidgetClass; +typedef struct _FormRec *FormWidget; + +extern WidgetClass formWidgetClass; + +_XFUNCPROTOBEGIN + +extern void XawFormDoLayout( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* do_layout */ +#else + Boolean /* do_layout */ +#endif +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawForm_h */ diff --git a/vendor/x11iraf/xaw3d/FormP.h b/vendor/x11iraf/xaw3d/FormP.h new file mode 100644 index 00000000..93140152 --- /dev/null +++ b/vendor/x11iraf/xaw3d/FormP.h @@ -0,0 +1,143 @@ +/* $XConsortium: FormP.h,v 1.22 94/04/17 20:12:09 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* Form widget private definitions */ + +#ifndef _XawFormP_h +#define _XawFormP_h + +#include <X11/Xaw3d/Form.h> + +#define XtREdgeType "EdgeType" + +typedef enum {LayoutPending, LayoutInProgress, LayoutDone} LayoutState; +#define XtInheritLayout ((Boolean (*)())_XtInherit) + +typedef struct { + Boolean (*layout)(/* FormWidget, Dimension, Dimension */); +} FormClassPart; + +/* + * Layout( + * FormWidget w - the widget whose children are to be configured + * Dimension w, h - bounding box of layout to be calculated + * + * Stores preferred geometry in w->form.preferred_{width,height}. + * If w->form.resize_in_layout is True, then a geometry request + * may be made for the preferred bounding box if necessary. + * + * Returns True if a geometry request was granted, False otherwise. + */ + +typedef struct _FormClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + FormClassPart form_class; +} FormClassRec; + +extern FormClassRec formClassRec; + +typedef struct _FormPart { + /* resources */ + int default_spacing; /* default distance between children */ + /* private state */ + Dimension old_width, old_height; /* last known dimensions */ + int no_refigure; /* no re-layout while > 0 */ + Boolean needs_relayout; /* next time no_refigure == 0 */ + Boolean resize_in_layout; /* should layout() do geom request? */ + Dimension preferred_width, preferred_height; /* cached from layout */ + Boolean resize_is_no_op; /* Causes resize to take not action. */ +} FormPart; + +typedef struct _FormRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + FormPart form; +} FormRec; + +typedef struct _FormConstraintsPart { +/* + * Constraint Resources. + */ + XtEdgeType top, bottom, /* where to drag edge on resize */ + left, right; + int dx; /* desired horiz offset */ + int dy; /* desired vertical offset */ + Widget horiz_base; /* measure dx from here if non-null */ + Widget vert_base; /* measure dy from here if non-null */ + Boolean allow_resize; /* TRUE if child may request resize */ + +/* + * Private contstraint resources. + */ + +/* + * What the size of this child would be if we did not impose the + * constraint the width and height must be greater than zero (0). + */ + short virtual_width, virtual_height; + +/* + * Temporary Storage for children's new possible possition. + */ + + Position new_x, new_y; + + LayoutState layout_state; /* temporary layout state */ + Boolean deferred_resize; /* was resized while no_refigure is set */ +} FormConstraintsPart; + +typedef struct _FormConstraintsRec { + FormConstraintsPart form; +} FormConstraintsRec, *FormConstraints; + +#endif /* _XawFormP_h */ diff --git a/vendor/x11iraf/xaw3d/Grip.c b/vendor/x11iraf/xaw3d/Grip.c new file mode 100644 index 00000000..17c4fc05 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Grip.c @@ -0,0 +1,150 @@ +/* $XConsortium: Grip.c,v 1.33 94/04/17 20:12:10 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Grip.c - Grip Widget (Used by Paned Widget) + * + */ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/GripP.h> + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(GripRec, core.width), XtRImmediate, + (XtPointer) DEFAULT_GRIP_SIZE}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffsetOf(GripRec, core.height), XtRImmediate, + (XtPointer) DEFAULT_GRIP_SIZE}, + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(GripRec, core.background_pixel), XtRString, + XtDefaultForeground}, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(GripRec, core.border_width), XtRImmediate, (XtPointer)0}, + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + XtOffsetOf(GripRec, grip.grip_action), XtRCallback, NULL}, +}; + +static void GripAction( /* Widget, XEvent*, String*, Cardinal */ ); + +static XtActionsRec actionsList[] = +{ + {"GripAction", GripAction}, +}; + +#define SuperClass (&threeDClassRec) + +GripClassRec gripClassRec = { + { +/* core class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class name */ "Grip", + /* size */ sizeof(GripRec), + /* class initialize */ XawInitializeWidgetSet, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actionsList, + /* num_actions */ XtNumber(actionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ XtInheritExpose, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, +/* Simple class fields initialization */ + { + /* change_sensitive */ XtInheritChangeSensitive + }, +/* ThreeD class fields initialization */ + { + /* shadowdraw */ 0 /* inherited expose method knows how */ + }, +/* Grip class fields initialization */ + { + /* not used */ 0 + } +}; + +WidgetClass gripWidgetClass = (WidgetClass) &gripClassRec; + +static void GripAction( widget, event, params, num_params ) + Widget widget; + XEvent *event; + String *params; + Cardinal *num_params; +{ + XawGripCallDataRec call_data; + + call_data.event = event; + call_data.params = params; + call_data.num_params = *num_params; + + XtCallCallbacks( widget, XtNcallback, (XtPointer)&call_data ); +} diff --git a/vendor/x11iraf/xaw3d/Grip.h b/vendor/x11iraf/xaw3d/Grip.h new file mode 100644 index 00000000..440c1f06 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Grip.h @@ -0,0 +1,105 @@ +/* $XConsortium: Grip.h,v 1.19 94/04/17 20:12:11 converse Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Grip.h - Public Definitions for Grip widget (used by VPane Widget) + * + */ + +#ifndef _XawGrip_h +#define _XawGrip_h + +#include <X11/Xaw3d/Simple.h> + +/*************************************************************************** + * + * Grip Widget + * + **************************************************************************/ + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + foreground Foreground Pixel XtDefaultForeground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 0 + callback Callback Pointer GripAction + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback Pointer NULL + height Height Dimension 8 + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + sensitive Sensitive Boolean True + width Width Dimension 8 + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNgripTranslations "gripTranslations" + +typedef struct _XawGripCallData { + XEvent *event; /* the event causing the GripAction */ + String *params; /* the TranslationTable params */ + Cardinal num_params; /* count of params */ +} XawGripCallDataRec, *XawGripCallData, + GripCallDataRec, *GripCallData; /* supported for R4 compatibility */ + +/* Class Record Constant */ + +extern WidgetClass gripWidgetClass; + +typedef struct _GripClassRec *GripWidgetClass; +typedef struct _GripRec *GripWidget; + +#endif /* _XawGrip_h */ diff --git a/vendor/x11iraf/xaw3d/GripP.h b/vendor/x11iraf/xaw3d/GripP.h new file mode 100644 index 00000000..1fc3ae6d --- /dev/null +++ b/vendor/x11iraf/xaw3d/GripP.h @@ -0,0 +1,105 @@ +/* +* $XConsortium: GripP.h,v 1.15 94/04/17 20:12:11 kit Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * GripP.h - Private definitions for Grip widget (Used by VPane Widget) + * + */ + +#ifndef _XawGripP_h +#define _XawGripP_h + +#include <X11/Xaw3d/Grip.h> +#include <X11/Xaw3d/ThreeDP.h> + +/***************************************************************************** + * + * Grip Widget Private Data + * + *****************************************************************************/ + +#define DEFAULT_GRIP_SIZE 8 + +/* New fields for the Grip widget class record */ +typedef struct {int empty;} GripClassPart; + +/* Full Class record declaration */ +typedef struct _GripClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + GripClassPart grip_class; +} GripClassRec; + +extern GripClassRec gripClassRec; + +/* New fields for the Grip widget record */ +typedef struct { + XtCallbackList grip_action; +} GripPart; + +/***************************************************************************** + * + * Full instance record declaration + * + ****************************************************************************/ + +typedef struct _GripRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + GripPart grip; +} GripRec; + +#endif /* _XawGripP_h */ + diff --git a/vendor/x11iraf/xaw3d/Imakefile b/vendor/x11iraf/xaw3d/Imakefile new file mode 100644 index 00000000..655775dc --- /dev/null +++ b/vendor/x11iraf/xaw3d/Imakefile @@ -0,0 +1,306 @@ +XCOMM $XConsortium: Imakefile,v 1.78 91/09/18 14:28:23 rws Exp $ + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + +#define DoNormalLib NormalLibXaw +############## X11IRAF - we don't want shared libraries. +XCOMM #define DoSharedLib SharedLibXaw +#define DoDebugLib DebugLibXaw +#define DoProfileLib ProfileLibXaw +#define HasSharedData YES +#define LibName Xaw3d +#define SoRev SOXAWREV +#define IncSubSubdir Xaw3d +#define IncSubdir X11 + +#ifdef LinuxArchitecture +JUMP_ROOT_Xaw3d = $(AWIDGETSRC)3d +JUMP_IS_HOST_Xaw3d = YES +JUMP_STUBLIBS_Xaw3d = libXaw3d.sa +JUMP_SUBDIRS_Xaw3d = $(JUMP_ROOT_Xt) +JUMP_DIR_Xaw3d = $(JUMP_ROOT_Xaw3d)/shared +JUMP_VARS_Xaw3d = $(JUMP_ROOT_Xaw3d)/jump_vars +JUMP_FUNCS_Xaw3d = $(JUMP_ROOT_Xaw3d)/jump_funcs +JUMP_IGNORE_Xaw3d = $(JUMP_ROOT_Xaw3d)/jump_ignore +JUMP_EXPORT_Xaw3d = $(JUMP_DIR_Xaw3d)/jump.vars +JUMP_IMPORT_Xaw3d = $(JUMP_EXPORT_Xt) $(JUMP_EXPORT_X11) +JUMP_ADDRESS_Xaw3d = 0x60300000 +JUMP_JUMPTABLESIZE_Xaw3d = 0x4000 +JUMP_GOTSIZE_Xaw3d = 4096 +JUMP_STUBNAMES_Xaw3d = libXaw3d +JUMP_STUBS_IMPORT_Xaw3d = $(JUMP_STUBS_IMPORT_X11) +JUMP_LDLIBS_Xaw3d = $(JUMP_ROOT_Xt)/libXt.sa $(JUMP_ROOT_Xt)/libXmu.sa \ + $(JUMP_ROOT_Xt)/libXext.sa $(JUMP_ROOT_X11)/libX11.sa \ + $(JUMP_LDLIBS_libc) +#endif + +#ifdef SharedXawReqs +REQUIREDLIBS = SharedXawReqs +#endif + +XCOMM DEFINES = XawI18nDefines +DEFINES = + + LINTLIBS = $(LINTXLIB) $(LINTXTOOL) + +#if defined(PpcDarwinArchitecture) || defined (TenonServer) +XCOMM - The following is for OS X on a PowerPC + EXTRA_DEFINES = -DARROW_SCROLLBAR -traditional-cpp -DUSEGRAY +#else + EXTRA_DEFINES = -DARROW_SCROLLBAR -DUSEGRAY +#endif + + EXTRA_INCLUDES = -I. -I../include + + +HEADERS = \ + AllWidgets.h \ + AsciiSink.h \ + AsciiSinkP.h \ + AsciiSrc.h \ + AsciiSrcP.h \ + AsciiText.h \ + AsciiTextP.h \ + Box.h \ + BoxP.h \ + Cardinals.h \ + Command.h \ + CommandP.h \ + Dialog.h \ + DialogP.h \ + Form.h \ + FormP.h \ + Grip.h \ + GripP.h \ + Label.h \ + LabelP.h \ + Layout.h \ + LayoutP.h \ + List.h \ + ListP.h \ + MenuButton.h \ + MenuButtoP.h \ + MultiSrc.h \ + MultiSrcP.h \ + MultiSink.h \ + MultiSinkP.h \ + Paned.h \ + PanedP.h \ + Panner.h \ + PannerP.h \ + Porthole.h \ + PortholeP.h \ + Repeater.h \ + RepeaterP.h \ + Reports.h \ + Scrollbar.h \ + ScrollbarP.h \ + Simple.h \ + SimpleP.h \ + SimpleMenu.h \ + SimpleMenP.h \ + Sme.h \ + SmeP.h \ + SmeBSB.h \ + SmeBSBP.h \ + SmeLine.h \ + SmeLineP.h \ + SmeThreeD.h \ + SmeThreeDP.h \ + StripChart.h \ + StripCharP.h \ + Template.c \ + Template.h \ + TemplateP.h \ + Text.h \ + TextP.h \ + TextSink.h \ + TextSinkP.h \ + TextSrc.h \ + TextSrcP.h \ + ThreeD.h \ + ThreeDP.h \ + Toggle.h \ + ToggleP.h \ + Tree.h \ + TreeP.h \ + VendorEP.h \ + Viewport.h \ + ViewportP.h \ + XawImP.h \ + XawInit.h + +SRCS = \ + AllWidgets.c \ + AsciiSink.c \ + AsciiSrc.c \ + AsciiText.c \ + Box.c \ + Command.c \ + Dialog.c \ Form.c \ + Grip.c \ + Label.c \ + List.c \ + MenuButton.c \ + MultiSrc.c \ + MultiSink.c \ + Paned.c \ + Panner.c \ + Porthole.c \ + Repeater.c \ + Scrollbar.c \ + Simple.c \ + SimpleMenu.c \ + Sme.c \ + SmeBSB.c \ + SmeLine.c \ + SmeThreeD.c \ + StripChart.c \ + Text.c \ + TextSink.c \ + TextSrc.c \ + TextAction.c \ + TextPop.c \ + TextTr.c \ + ThreeD.c \ + Toggle.c \ + Tree.c \ + Vendor.c \ + Viewport.c \ + XawIm.c \ + XawInit.c \ + XawI18n.c \ + sharedlib.c \ + laygram.c \ + laylex.c + +#if SharedDataSeparation +UNSHAREDOBJS = AllWidgets.o sharedlib.o +#endif + +OBJS = \ + AllWidgets.o \ + AsciiSink.o \ + AsciiSrc.o \ + AsciiText.o \ + Box.o \ + Command.o \ + Dialog.o \ + Form.o \ + Grip.o \ + Label.o \ + List.o \ + MenuButton.o \ + MultiSrc.o \ + MultiSink.o \ + Paned.o \ + Panner.o \ + Porthole.o \ + Repeater.o \ + Scrollbar.o \ + Simple.o \ + SimpleMenu.o \ + Sme.o \ + SmeBSB.o \ + SmeLine.o \ + SmeThreeD.o \ + StripChart.o \ + Text.o \ + TextSink.o \ + TextSrc.o \ + TextAction.o \ + TextPop.o \ + TextTr.o \ + ThreeD.o \ + Toggle.o \ + Tree.o \ + Vendor.o \ + Viewport.o \ + XawIm.o \ + XawI18n.o \ + XawInit.o \ + laygram.o \ + laylex.o + +XCOMM #include <Library.tmpl> + +#ifdef LexCmd +LEX=LexCmd +#endif +#ifdef YaccCmd +YACC=YaccCmd +#endif + + +all:: libXaw3d.a + +LinkFileList(linklibs,libXaw3d.a,X11irafLibDir,Xaw3dDir) + +#if defined (SunArchitecture) && OSMajorVersion < 5 +TextTr.o: + acc $(EXTRA_INCLUDES) -c TextTr.c +#endif + +#if defined (PpcDarwinArchitecture) || defined (TenonServer) +libXaw3d.a: $(OBJS) + $(RM) $@ + $(AR) $@ $(OBJS) + RanLibrary($@) +#else +libXaw3d.a: $(OBJS) Vendor.o + $(RM) $@ + $(AR) $@ $(OBJS) Vendor.o + RanLibrary($@) +#endif + +includes:: + MakeDir(X11irafIncDir) + MakeDir(X11irafIncDir/X11) + MakeDir(X11irafIncDir/X11/Xaw3d) +#if defined (PpcDarwinArchitecture) || defined (TenonServer) + $(LN) Xaw3d X11irafIncDir/X11/Xaw +#endif + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/X11/Xaw3d/$$i; \ + $(CP) -p $$i X11irafIncDir/X11/Xaw3d/$$i; \ + done) + +#if InstallIncludes +install:: + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/X11/Xaw3d/$$i; \ + $(CP) -p $$i X11irafIncDir/X11/Xaw3d; \ + done) +#endif + +#if InstallLibraries +install:: + @(set -x; $(RM) X11irafLibDir/libXaw3d.a) + @(set -x; $(CP) -p libXaw3d.a X11irafLibDir/libXaw3d.a) +#endif + + +depend:: laygram.c laylex.c + + +#if DoSharedLib && SharedDataSeparation +SpecialCObjectRule(sharedlib.o,NullParameter,$(SHLIBDEF)) +#endif + +laygram.c : laygram.y + $(YACC) -d laygram.y + sed 's/yy/LayYY/g' y.tab.c > laygram.c + sed 's/yy/LayYY/g' y.tab.h > laygram.h + $(RM) y.tab.c y.tab.h + +laylex.c: laylex.l + $(LEX) laylex.l + sed 's/yy/LayYY/g' lex.yy.c > laylex.c + $(RM) lex.yy.c + +clean:: + $(RM) laygram.c laylex.c + +DependTarget() + diff --git a/vendor/x11iraf/xaw3d/Label.c b/vendor/x11iraf/xaw3d/Label.c new file mode 100644 index 00000000..b60d0a50 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Label.c @@ -0,0 +1,806 @@ +/* $XConsortium: Label.c,v 1.97 94/04/17 20:12:12 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Label.c - Label widget + * + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xos.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/LabelP.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/Drawing.h> +#include <stdio.h> +#include <ctype.h> + +/* needed for abs() */ +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#else +int abs(); +#endif + +#define streq(a,b) (strcmp( (a), (b) ) == 0) + +#define MULTI_LINE_LABEL 32767 + +#ifdef CRAY +#define WORD64 +#endif + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +#define offset(field) XtOffsetOf(LabelRec, field) +static XtResource resources[] = { + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(label.foreground), XtRString, XtDefaultForeground}, + {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + offset(label.font),XtRString, XtDefaultFont}, + {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ), + offset(label.fontset),XtRString, XtDefaultFontSet}, + {XtNlabel, XtCLabel, XtRString, sizeof(String), + offset(label.label), XtRString, NULL}, + {XtNencoding, XtCEncoding, XtRUnsignedChar, sizeof(unsigned char), + offset(label.encoding), XtRImmediate, (XtPointer)XawTextEncoding8bit}, + {XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify), + offset(label.justify), XtRImmediate, (XtPointer)XtJustifyCenter}, + {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), + offset(label.internal_width), XtRImmediate, (XtPointer)4}, + {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), + offset(label.internal_height), XtRImmediate, (XtPointer)2}, + {XtNleftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap), + offset(label.left_bitmap), XtRImmediate, (XtPointer) None}, + {XtNbitmap, XtCPixmap, XtRBitmap, sizeof(Pixmap), + offset(label.pixmap), XtRImmediate, (XtPointer)None}, + {XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), + offset(label.resize), XtRImmediate, (XtPointer)True}, + {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(threeD.shadow_width), XtRImmediate, (XtPointer) 0}, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, + (XtPointer)1} +}; +#undef offset + +static void Initialize(); +static void Resize(); +static void Redisplay(); +static Boolean SetValues(); +static void ClassInitialize(); +static void Destroy(); +static XtGeometryResult QueryGeometry(); + +LabelClassRec labelClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) &threeDClassRec, + /* class_name */ "Label", + /* widget_size */ sizeof(LabelRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, +/* Simple class fields initialization */ + { + /* change_sensitive */ XtInheritChangeSensitive + }, +/* ThreeD class fields initialization */ + { + /* shadowdraw */ XtInheritXaw3dShadowDraw + }, +/* Label class fields initialization */ + { + /* ignore */ 0 + } +}; +WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec; +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, + (XtConvertArgList)NULL, 0 ); +} + +#ifndef WORD64 + +#define TXT16 XChar2b + +#else + +#define TXT16 char + +static XChar2b *buf2b; +static int buf2blen = 0; + +_XawLabelWidth16(fs, str, n) + XFontStruct *fs; + char *str; + int n; +{ + int i; + XChar2b *ptr; + + if (n > buf2blen) { + buf2b = (XChar2b *)XtRealloc((char *)buf2b, n * sizeof(XChar2b)); + buf2blen = n; + } + for (ptr = buf2b, i = n; --i >= 0; ptr++) { + ptr->byte1 = *str++; + ptr->byte2 = *str++; + } + return XTextWidth16(fs, buf2b, n); +} + +_XawLabelDraw16(dpy, d, gc, x, y, str, n) + Display *dpy; + Drawable d; + GC gc; + int x, y; + char *str; + int n; +{ + int i; + XChar2b *ptr; + + if (n > buf2blen) { + buf2b = (XChar2b *)XtRealloc((char *)buf2b, n * sizeof(XChar2b)); + buf2blen = n; + } + for (ptr = buf2b, i = n; --i >= 0; ptr++) { + ptr->byte1 = *str++; + ptr->byte2 = *str++; + } + XDrawString16(dpy, d, gc, x, y, buf2b, n); +} + +#define XTextWidth16 _XawLabelWidth16 +#define XDrawString16 _XawLabelDraw16 + +#endif /* WORD64 */ + +/* + * Calculate width and height of displayed text in pixels + */ + +static void SetTextWidthAndHeight(lw) + LabelWidget lw; +{ + XFontStruct *fs = lw->label.font; + + char *nl; + + if (lw->label.pixmap != None) { + Window root; + int x, y; + unsigned int width, height, bw, depth; + if (XGetGeometry(XtDisplay(lw), lw->label.pixmap, &root, &x, &y, + &width, &height, &bw, &depth)) { + lw->label.label_height = height; + lw->label.label_width = width; + lw->label.label_len = depth; + return; + } + } + if ( lw->simple.international == True ) { + + XFontSet fset = lw->label.fontset; + XFontSetExtents *ext = XExtentsOfFontSet(fset); + + lw->label.label_height = ext->max_ink_extent.height; + if (lw->label.label == NULL) { + lw->label.label_len = 0; + lw->label.label_width = 0; + } + else if ((nl = index(lw->label.label, '\n')) != NULL) { + char *label; + lw->label.label_len = MULTI_LINE_LABEL; + lw->label.label_width = 0; + for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) { + int width = XmbTextEscapement(fset, label, (int)(nl - label)); + + if (width > (int)lw->label.label_width) + lw->label.label_width = width; + label = nl + 1; + if (*label) + lw->label.label_height += + ext->max_ink_extent.height; + } + if (*label) { + int width = XmbTextEscapement(fset, label, strlen(label)); + + if (width > (int) lw->label.label_width) + lw->label.label_width = width; + } + } else { + lw->label.label_len = strlen(lw->label.label); + lw->label.label_width = + XmbTextEscapement(fset, lw->label.label, (int) lw->label.label_len); + } + + } else { + + lw->label.label_height = fs->max_bounds.ascent + fs->max_bounds.descent; + if (lw->label.label == NULL) { + lw->label.label_len = 0; + lw->label.label_width = 0; + } + else if ((nl = index(lw->label.label, '\n')) != NULL) { + char *label; + lw->label.label_len = MULTI_LINE_LABEL; + lw->label.label_width = 0; + for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) { + int width; + + if (lw->label.encoding) + width = XTextWidth16(fs, (TXT16*)label, (int)(nl - label)/2); + else + width = XTextWidth(fs, label, (int)(nl - label)); + if (width > (int)lw->label.label_width) + lw->label.label_width = width; + label = nl + 1; + if (*label) + lw->label.label_height += + fs->max_bounds.ascent + fs->max_bounds.descent; + } + if (*label) { + int width = XTextWidth(fs, label, strlen(label)); + + if (lw->label.encoding) + width = XTextWidth16(fs, (TXT16*)label, (int)strlen(label)/2); + else + width = XTextWidth(fs, label, strlen(label)); + if (width > (int) lw->label.label_width) + lw->label.label_width = width; + } + } else { + lw->label.label_len = strlen(lw->label.label); + if (lw->label.encoding) + lw->label.label_width = + XTextWidth16(fs, (TXT16*)lw->label.label, + (int) lw->label.label_len/2); + else + lw->label.label_width = + XTextWidth(fs, lw->label.label, (int) lw->label.label_len); + } + + } +} + +static void GetnormalGC(lw) + LabelWidget lw; +{ + XGCValues values; + + values.foreground = lw->label.foreground; + values.background = lw->core.background_pixel; + values.font = lw->label.font->fid; + values.graphics_exposures = False; + + if ( lw->simple.international == True ) + /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */ + lw->label.normal_GC = XtAllocateGC( + (Widget)lw, 0, + (unsigned) GCForeground | GCBackground | GCGraphicsExposures, + &values, GCFont, 0 ); + else + lw->label.normal_GC = XtGetGC( + (Widget)lw, + (unsigned) GCForeground | GCBackground | GCFont | GCGraphicsExposures, + &values); +} + +static void GetgrayGC(lw) + LabelWidget lw; +{ + XGCValues values; + + values.foreground = lw->label.foreground; + values.background = lw->core.background_pixel; + values.font = lw->label.font->fid; + values.fill_style = FillTiled; + values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), + lw->label.foreground, + lw->core.background_pixel, + lw->core.depth); + values.graphics_exposures = False; + + lw->label.stipple = values.tile; + if ( lw->simple.international == True ) + /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC. */ + lw->label.gray_GC = XtAllocateGC((Widget)lw, 0, + (unsigned) GCForeground | GCBackground | + GCTile | GCFillStyle | + GCGraphicsExposures, + &values, GCFont, 0); + else + lw->label.gray_GC = XtGetGC((Widget)lw, + (unsigned) GCForeground | GCBackground | + GCFont | GCTile | GCFillStyle | + GCGraphicsExposures, + &values); +} + +static void compute_bitmap_offsets (lw) + LabelWidget lw; +{ + /* + * bitmap will be eventually be displayed at + * (internal_width, internal_height + lbm_y) + */ + if (lw->label.lbm_height != 0) { + lw->label.lbm_y = (lw->core.height - + (lw->threeD.shadow_width * 2 + + lw->label.internal_height * 2 + + lw->label.lbm_height)) / 2; + } else { + lw->label.lbm_y = 0; + } +} + + +static void set_bitmap_info (lw) + LabelWidget lw; +{ + Window root; + int x, y; + unsigned int bw, depth; + + if (!(lw->label.left_bitmap && + XGetGeometry (XtDisplay(lw), lw->label.left_bitmap, &root, &x, &y, + &lw->label.lbm_width, &lw->label.lbm_height, + &bw, &depth))) { + lw->label.lbm_width = lw->label.lbm_height = 0; + } + compute_bitmap_offsets (lw); +} + + + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + LabelWidget lw = (LabelWidget) new; + + if (lw->label.label == NULL) + lw->label.label = XtNewString(lw->core.name); + else { + lw->label.label = XtNewString(lw->label.label); + } + + GetnormalGC(lw); + GetgrayGC(lw); + + SetTextWidthAndHeight(lw); + + if (lw->core.height == 0) + lw->core.height = lw->label.label_height + + 2 * lw->label.internal_height + + 2 * lw->threeD.shadow_width; + + set_bitmap_info (lw); /* need core.height */ + + if (lw->core.width == 0) /* need label.lbm_width */ + lw->core.width = (lw->label.label_width + + 2 * lw->label.internal_width + + 2 * lw->threeD.shadow_width + + LEFT_OFFSET(lw)); + + lw->label.label_x = lw->label.label_y = 0; + (*XtClass(new)->core_class.resize) ((Widget)lw); + +} /* Initialize */ + +/* + * Repaint the widget window + */ + +/* ARGSUSED */ +static void Redisplay(gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + extern WidgetClass commandWidgetClass; + LabelWidget w = (LabelWidget) gw; + LabelWidgetClass lwclass = (LabelWidgetClass) XtClass (gw); + GC gc; + + /* + * Don't draw shadows if command is going to redraw them. + * The shadow draw method is region aware, but since 99% of + * all labels don't have shadows, we'll check for a shadow + * before we incur the function call overhead. + */ + if (!XtIsSubclass (gw, commandWidgetClass) && w->threeD.shadow_width > 0) + (*lwclass->threeD_class.shadowdraw) (gw, event, region, True); + + /* + * now we'll see if we need to draw the rest of the label + */ + if (region != NULL) { + int x = w->label.label_x; + unsigned int width = w->label.label_width; + if (w->label.lbm_width) { + if (w->label.label_x > (x = w->label.internal_width)) + width += w->label.label_x - x; + } + if (XRectInRegion(region, x, w->label.label_y, + width, w->label.label_height) == RectangleOut){ + return; + } + } + + gc = XtIsSensitive(gw) ? w->label.normal_GC : w->label.gray_GC; +#ifdef notdef + if (region != NULL) + XSetRegion(XtDisplay(gw), gc, region); +#endif /*notdef*/ + + if (w->label.pixmap == None) { + int len = w->label.label_len; + char *label = w->label.label; + Position y = w->label.label_y + w->label.font->max_bounds.ascent; + Position ksy = w->label.label_y; + + /* display left bitmap */ + if (w->label.left_bitmap && w->label.lbm_width != 0) { + XCopyPlane (XtDisplay(gw), w->label.left_bitmap, XtWindow(gw), gc, + 0, 0, w->label.lbm_width, w->label.lbm_height, + (int) w->label.internal_width + + w->threeD.shadow_width, + (int) w->label.internal_height + + w->threeD.shadow_width + + w->label.lbm_y, + (unsigned long) 1L); + } + + if ( w->simple.international == True ) { + + XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset); + + ksy += abs(ext->max_ink_extent.y); + + if (len == MULTI_LINE_LABEL) { + char *nl; + while ((nl = index(label, '\n')) != NULL) { + XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, + w->label.label_x, ksy, label, (int)(nl - label)); + ksy += ext->max_ink_extent.height; + label = nl + 1; + } + len = strlen(label); + } + if (len) + XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, + w->label.label_x, ksy, label, len); + + } else { /*international false, so use R5 routine */ + + if (len == MULTI_LINE_LABEL) { + char *nl; + while ((nl = index(label, '\n')) != NULL) { + if (w->label.encoding) + XDrawString16(XtDisplay(gw), XtWindow(gw), gc, + w->label.label_x, y, + (TXT16*)label, (int)(nl - label)/2); + else + XDrawString(XtDisplay(gw), XtWindow(gw), gc, + w->label.label_x, y, label, (int)(nl - label)); + y += w->label.font->max_bounds.ascent + + w->label.font->max_bounds.descent; + label = nl + 1; + } + len = strlen(label); + } + if (len) { + if (w->label.encoding) + XDrawString16(XtDisplay(gw), XtWindow(gw), gc, + w->label.label_x, y, (TXT16*)label, len/2); + else + XDrawString(XtDisplay(gw), XtWindow(gw), gc, + w->label.label_x, y, label, len); + } + + } /*endif international*/ + + } else if (w->label.label_len == 1) { /* depth */ + XCopyPlane(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc, + 0, 0, w->label.label_width, w->label.label_height, + w->label.label_x, w->label.label_y, 1L); + } else { + XCopyArea(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc, + 0, 0, w->label.label_width, w->label.label_height, + w->label.label_x, w->label.label_y); + } + +#ifdef notdef + if (region != NULL) + XSetClipMask(XtDisplay(gw), gc, (Pixmap)None); +#endif /* notdef */ +} + +static void _Reposition(lw, width, height, dx, dy) + LabelWidget lw; + Dimension width, height; + Position *dx, *dy; +{ + Position newPos; + Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw) + + lw->threeD.shadow_width; + + switch (lw->label.justify) { + + case XtJustifyLeft : + newPos = leftedge; + break; + + case XtJustifyRight : + newPos = width - + (lw->label.label_width + + lw->label.internal_width + + lw->threeD.shadow_width); + break; + + case XtJustifyCenter : + default: + newPos = (int)(width - lw->label.label_width) / 2; + break; + } + if (newPos < (Position)leftedge) + newPos = leftedge; + *dx = newPos - lw->label.label_x; + lw->label.label_x = newPos; + *dy = (newPos = (int)(height - lw->label.label_height) / 2) + - lw->label.label_y; + lw->label.label_y = newPos; + return; +} + +static void Resize(w) + Widget w; +{ + LabelWidget lw = (LabelWidget)w; + Position dx, dy; + + _Reposition(lw, w->core.width, w->core.height, &dx, &dy); + compute_bitmap_offsets (lw); +} + +/* + * Set specified arguments into widget + */ + +#define PIXMAP 0 +#define WIDTH 1 +#define HEIGHT 2 +#define NUM_CHECKS 3 + +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + LabelWidget curlw = (LabelWidget) current; + LabelWidget reqlw = (LabelWidget) request; + LabelWidget newlw = (LabelWidget) new; + int i; + Boolean was_resized = False, redisplay = False, checks[NUM_CHECKS]; + + for (i = 0; i < NUM_CHECKS; i++) + checks[i] = FALSE; + + for (i = 0; i < *num_args; i++) { + if (streq(XtNbitmap, args[i].name)) + checks[PIXMAP] = TRUE; + if (streq(XtNwidth, args[i].name)) + checks[WIDTH] = TRUE; + if (streq(XtNheight, args[i].name)) + checks[HEIGHT] = TRUE; + } + + if (newlw->label.label == NULL) { + newlw->label.label = newlw->core.name; + } + + /* + * resize on bitmap change + */ + if (curlw->label.left_bitmap != newlw->label.left_bitmap) { + was_resized = True; + } + + if (curlw->label.encoding != newlw->label.encoding) + was_resized = True; + + if ( (curlw->label.fontset != newlw->label.fontset) && + curlw->simple.international ){ + was_resized = True; + } + if (curlw->label.label != newlw->label.label) { + if (curlw->label.label != curlw->core.name) + XtFree( (char *)curlw->label.label ); + + if (newlw->label.label != newlw->core.name) { + newlw->label.label = XtNewString( newlw->label.label ); + } + was_resized = True; + } + + if (was_resized || (curlw->label.font != newlw->label.font) || + (curlw->label.justify != newlw->label.justify) || checks[PIXMAP]) { + + SetTextWidthAndHeight(newlw); + was_resized = True; + } + + /* recalculate the window size if something has changed. */ + if (newlw->label.resize && was_resized) { + if ((curlw->core.height == reqlw->core.height) && !checks[HEIGHT]) + newlw->core.height = (newlw->label.label_height + + 2 * newlw->label.internal_height + + 2 * newlw->threeD.shadow_width); + + set_bitmap_info (newlw); + + if ((curlw->core.width == reqlw->core.width) && !checks[WIDTH]) + newlw->core.width = (newlw->label.label_width + + LEFT_OFFSET(newlw) + + 2 * newlw->label.internal_width + + 2 * newlw->threeD.shadow_width); + } + + if (curlw->label.foreground != newlw->label.foreground + || curlw->core.background_pixel != newlw->core.background_pixel + || curlw->label.font->fid != newlw->label.font->fid ) { + + /* The Fontset is not in the GC - don't make a new GC if FS changes! */ + + XtReleaseGC(new, curlw->label.normal_GC); + XtReleaseGC(new, curlw->label.gray_GC); + XmuReleaseStippledPixmap( XtScreen(current), curlw->label.stipple ); + GetnormalGC(newlw); + GetgrayGC(newlw); + redisplay = True; + } + + if ((curlw->label.internal_width != newlw->label.internal_width) + || (curlw->label.internal_height != newlw->label.internal_height) + || was_resized) { + /* Resize() will be called if geometry changes succeed */ + Position dx, dy; + _Reposition(newlw, curlw->core.width, curlw->core.height, &dx, &dy); + } + + return was_resized || redisplay || + XtIsSensitive(current) != XtIsSensitive(new); +} + +static void Destroy(w) + Widget w; +{ + LabelWidget lw = (LabelWidget)w; + + if ( lw->label.label != lw->core.name ) + XtFree( lw->label.label ); + XtReleaseGC( w, lw->label.normal_GC ); + XtReleaseGC( w, lw->label.gray_GC); + XmuReleaseStippledPixmap( XtScreen(w), lw->label.stipple ); +} + + +static XtGeometryResult QueryGeometry(w, intended, preferred) + Widget w; + XtWidgetGeometry *intended, *preferred; +{ + LabelWidget lw = (LabelWidget)w; + + preferred->request_mode = CWWidth | CWHeight; + preferred->width = (lw->label.label_width + + 2 * lw->label.internal_width + + 2 * lw->threeD.shadow_width + + LEFT_OFFSET(lw)); + preferred->height = lw->label.label_height + + 2 * lw->label.internal_height + + 2 * lw->threeD.shadow_width; + if ( ((intended->request_mode & (CWWidth | CWHeight)) + == (CWWidth | CWHeight)) && + intended->width == preferred->width && + intended->height == preferred->height) + return XtGeometryYes; + else if (preferred->width == w->core.width && + preferred->height == w->core.height) + return XtGeometryNo; + else + return XtGeometryAlmost; +} diff --git a/vendor/x11iraf/xaw3d/Label.h b/vendor/x11iraf/xaw3d/Label.h new file mode 100644 index 00000000..3d930e2a --- /dev/null +++ b/vendor/x11iraf/xaw3d/Label.h @@ -0,0 +1,129 @@ +/* $XConsortium: Label.h,v 1.34 94/04/17 20:12:13 rws Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawLabel_h +#define _XawLabel_h + +/*********************************************************************** + * + * Label Widget + * + ***********************************************************************/ + +#include <X11/Xaw3d/Simple.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback XtCallbackList NULL + encoding Encoding unsigned char XawTextEncoding8bit + font Font XFontStruct* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + leftBitmap LeftBitmap Pixmap None + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + resize Resize Boolean True + sensitive Sensitive Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + +#define XawTextEncoding8bit 0 +#define XawTextEncodingChar2b 1 + +#define XtNleftBitmap "leftBitmap" +#define XtCLeftBitmap "LeftBitmap" +#define XtNencoding "encoding" +#define XtCEncoding "Encoding" + +#ifndef XtNfontSet +#define XtNfontSet "fontSet" +#endif + +#ifndef XtCFontSet +#define XtCFontSet "FontSet" +#endif + +#ifndef _XtStringDefs_h_ +#define XtNbitmap "bitmap" +#define XtNforeground "foreground" +#define XtNlabel "label" +#define XtNfont "font" +#define XtNinternalWidth "internalWidth" +#define XtNinternalHeight "internalHeight" +#define XtNresize "resize" +#define XtCResize "Resize" +#define XtCBitmap "Bitmap" +#endif + +/* Class record constants */ + +extern WidgetClass labelWidgetClass; + +typedef struct _LabelClassRec *LabelWidgetClass; +typedef struct _LabelRec *LabelWidget; + +#endif /* _XawLabel_h */ diff --git a/vendor/x11iraf/xaw3d/LabelP.h b/vendor/x11iraf/xaw3d/LabelP.h new file mode 100644 index 00000000..c237b916 --- /dev/null +++ b/vendor/x11iraf/xaw3d/LabelP.h @@ -0,0 +1,131 @@ +/* +* $XConsortium: LabelP.h,v 1.29 94/04/17 20:12:14 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * LabelP.h - Private definitions for Label widget + * + */ + +#ifndef _XawLabelP_h +#define _XawLabelP_h + +/*********************************************************************** + * + * Label Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/Label.h> +#include <X11/Xaw3d/ThreeDP.h> + +/* New fields for the Label widget class record */ + +typedef struct {int foo;} LabelClassPart; + +/* Full class record declaration */ +typedef struct _LabelClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + LabelClassPart label_class; +} LabelClassRec; + +extern LabelClassRec labelClassRec; + +/* New fields for the Label widget record */ +typedef struct { + /* resources */ + Pixel foreground; + XFontStruct *font; + XFontSet fontset; + char *label; + XtJustify justify; + Dimension internal_width; + Dimension internal_height; + Pixmap pixmap; + Boolean resize; + unsigned char encoding; + Pixmap left_bitmap; + + /* private state */ + GC normal_GC; + GC gray_GC; + Pixmap stipple; + Position label_x; + Position label_y; + Dimension label_width; + Dimension label_height; + Dimension label_len; + int lbm_y; /* where in label */ + unsigned int lbm_width, lbm_height; /* size of pixmap */ +} LabelPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _LabelRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + LabelPart label; +} LabelRec; + +#define LEFT_OFFSET(lw) ((lw)->label.left_bitmap \ + ? (lw)->label.lbm_width + (lw)->label.internal_width \ + : 0) + +#endif /* _XawLabelP_h */ diff --git a/vendor/x11iraf/xaw3d/Layout.c b/vendor/x11iraf/xaw3d/Layout.c new file mode 100644 index 00000000..44d391a9 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Layout.c @@ -0,0 +1,1049 @@ +/* + * $XConsortium: Layout.c,v 1.1 91/09/13 18:51:44 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/Converters.h> + +#ifdef MOTIF +# include <Xm/XmP.h> +#endif + +#if defined(LAYOUT) +# include "LayoutP.h" +#else +# include <X11/Xaw3d/LayoutP.h> +#endif + +#include <ctype.h> +#include <stdio.h> + +#undef DEBUG +#ifdef DEBUG +static char *DBUG_currentproc, *DBUG_lastproc; +static int DBUG_level = 0; +# define DBUG_ENTER(s) \ + {DBUG_lastproc=DBUG_currentproc;DBUG_currentproc=s;\ + fprintf(stderr,"begin: (%d) %s\n",++DBUG_level,s);} +# define DBUG_VOID_RETURN \ + {fprintf(stderr,"end: (%d) %s\n",DBUG_level--,DBUG_currentproc); \ + DBUG_currentproc=DBUG_lastproc;return;} +# define DBUG_RETURN(f,v) \ + {fprintf(stderr,"return (%d) %s (",DBUG_level--,DBUG_currentproc); \ + fprintf(stderr,(f),(v)); \ + fprintf(stderr,")\n"); DBUG_currentproc=DBUG_lastproc;return (v);} +# define DBUG_PRINT(f,s) \ + {fprintf(stderr," (%d) %s:",DBUG_level, DBUG_currentproc); \ + fprintf(stderr,f,s);fprintf(stderr,"\n");} +#else +# define DBUG_ENTER(s) +# define DBUG_VOID_RETURN return +# define DBUG_PRINT(f,s) +# define DBUG_RETURN(f,v) return(v) +#endif + +/***************************************************************************** + * + * Full instance record declaration + * + ****************************************************************************/ + +#define offset(field) XtOffsetOf(LayoutRec, layout.field) + +static XtResource resources[] = { + {XtNlayout, XtCLayout, XtRLayout, sizeof (BoxPtr), + offset(layout), XtRLayout, NULL }, + {XtNdebug, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(debug), XtRImmediate, (XtPointer) FALSE}, +}; + +#undef offset + +static void ClassInitialize(), Initialize(); +static void Resize(); +static Boolean SetValues(); +static XtGeometryResult GeometryManager(); +static void ChangeManaged(); +static void InsertChild(); +static XtGeometryResult QueryGeometry (); +static void GetDesiredSize (); +#ifdef MOTIF +static void Redisplay (); +#endif + +static void LayoutLayout (); +static void LayoutGetNaturalSize (); +static void LayoutFreeLayout (); + +extern void LayYYsetsource(), LayYYsetdest(); +extern int LayYYparse(); + +#ifdef MOTIF +#define SuperClass ((ConstraintWidgetClass)&xmManagerClassRec) +#else +#define SuperClass ((ConstraintWidgetClass)&constraintClassRec) +#endif + +LayoutClassRec layoutClassRec = { + { +/* core class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class name */ "Layout", + /* size */ sizeof(LayoutRec), + /* class_initialize */ ClassInitialize, + /* class_part init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ 0, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, +#ifdef MOTIF + /* expose */ Redisplay, +#else + /* expose */ NULL, +#endif + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, +#ifdef MOTIF + /* tm_table */ XtInheritTranslations, +#else + /* tm_table */ NULL, +#endif + /* query_geometry */ QueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, { +/* composite class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ InsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, { +/* constraint class fields */ + /* subresources */ NULL, + /* subresource_count */ 0, + /* constraint_size */ sizeof(LayoutConstraintsRec), + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL + }, +#ifdef MOTIF + { + /* manager class */ + XtInheritTranslations, /* translations */ + NULL, /* syn resources */ + 0, /* num syn_resources */ + NULL, /* get_cont_resources */ + 0, /* num_get_cont_resources */ + XmInheritParentProcess, /* parent_process */ + NULL, /* extension */ + }, +#endif + { /* layout_class fields */ + 0 + } +}; + +WidgetClass layoutWidgetClass = (WidgetClass) &layoutClassRec; + +#define ForAllChildren(pw, childP) \ + for ( (childP) = (pw)->composite.children ; \ + (childP) < (pw)->composite.children + (pw)->composite.num_children ; \ + (childP)++ ) if (!XtIsManaged(*childP)) ; else + +/************************************************************ + * + * Semi-public routines. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: The Layout widgets class initialization proc. + * Arguments: none. + * Returns: none. + */ + +/*ARGSUSED*/ +static Boolean +CvtStringToLayout (dpy, args, num_args, from, to, converter_data) + Display *dpy; + XrmValue *args; + Cardinal *num_args; + XrmValue *from, *to; + XtPointer *converter_data; +{ + static BoxPtr tmp; + + LayYYsetsource ((char *) from->addr); + if (!to->addr) to->addr = (XtPointer)&tmp; + LayYYsetdest ((BoxPtr *) to->addr); + to->size = sizeof (BoxPtr *); + return LayYYparse() ? FALSE : TRUE; +} + +/*ARGSUSED*/ +static void +DisposeLayout (app, to, data, args, num_args) + XtAppContext app; + XrmValue *to; + XtPointer data; + XrmValuePtr args; + Cardinal *num_args; +{ + LayoutFreeLayout (* (LayoutPtr *) to->addr); +} + +static void +ClassInitialize() +{ + XtSetTypeConverter ( XtRString, XtRLayout, CvtStringToLayout, + (XtConvertArgList)NULL, (Cardinal)0, XtCacheNone, + DisposeLayout ); +} + +#ifdef MOTIF +static void Redisplay ( gw, event, region ) +Widget gw; +XEvent *event; +Region region; +{ + /* + * If the Layout widget is visible, redraw gadgets. + */ + + if ( XtIsRealized ( gw ) && gw->core.visible ) + { + _XmRedisplayGadgets ( gw, event, region ); + } + /* ChangeManaged(gw);*/ +} +#endif + +/*ARGSUSED*/ +static XtGeometryResult GeometryManager(child, request, reply) + Widget child; + XtWidgetGeometry *request, *reply; +{ + LayoutWidget w = (LayoutWidget) XtParent(child); + SubInfoPtr p = SubInfo(child); + int bw; + Bool changed, bwChanged; + + bw = p->naturalBw; + changed = FALSE; + bwChanged = FALSE; + if (request->request_mode & CWBorderWidth && + request->border_width != child->core.border_width) + { + p->naturalBw = bw; + bw = request->border_width; + changed = TRUE; + bwChanged = TRUE; + } + if (bwChanged || ((request->request_mode & CWWidth) && + request->width != child->core.width)) + { + p->naturalSize[LayoutHorizontal] = request->width + bw * 2; + changed = TRUE; + } + if (bwChanged || ((request->request_mode & CWHeight) && + request->height != child->core.height)) + { + p->naturalSize[LayoutVertical] = request->height + bw * 2; + changed = TRUE; + } + if (changed) + LayoutLayout (w, TRUE); + return XtGeometryDone; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ +/* LayoutWidget w = (LayoutWidget)new; */ +} + +static void ChangeManaged(gw) + Widget gw; +{ + LayoutWidget w = (LayoutWidget) gw; + Widget *children; + + DBUG_ENTER("changeManaged"); + + ForAllChildren (w, children) + GetDesiredSize (*children); + LayoutLayout ((LayoutWidget) w, TRUE); +#ifdef MOTIF + _XmNavigChangeManaged ( gw ); +#endif + DBUG_VOID_RETURN; +} + +static void +GetDesiredSize (child) + Widget child; +{ + XtWidgetGeometry desired; + SubInfoPtr p; + + XtQueryGeometry (child, (XtWidgetGeometry *) NULL, &desired); + p = SubInfo (child); + p->naturalBw = desired.border_width; + p->naturalSize[LayoutHorizontal] = desired.width + desired.border_width * 2; + p->naturalSize[LayoutVertical] = desired.height + desired.border_width * 2; +} + +static void InsertChild (child) + Widget child; +{ + (*SuperClass->composite_class.insert_child) (child); + GetDesiredSize (child); +} + +static void +Resize(gw) + Widget gw; +{ + LayoutLayout ((LayoutWidget) gw, FALSE); +} + +/* ARGSUSED */ +static Boolean +SetValues(gold, greq, gnew, args, num_args) + Widget gold, greq, gnew; + ArgList args; + Cardinal *num_args; +{ + LayoutWidget old = (LayoutWidget) gold, + new = (LayoutWidget) gnew; + + if (old->layout.layout != new->layout.layout) + LayoutLayout (new, TRUE); + return FALSE; +} /* SetValues */ + +static XtGeometryResult +QueryGeometry (gw, request, prefered_return) + Widget gw; + XtWidgetGeometry *request, *prefered_return; +{ + LayoutWidget w = (LayoutWidget) gw; + XtGeometryResult result; + XtWidgetGeometry prefered_size; + + if (request && !(request->request_mode & (CWWidth|CWHeight))) + return XtGeometryYes; + LayoutGetNaturalSize (w, &prefered_size.width, &prefered_size.height); + prefered_return->request_mode = 0; + result = XtGeometryYes; + if (!request) { + prefered_return->width = prefered_size.width; + prefered_return->height= prefered_size.height; + if (prefered_size.width != w->core.width) { + prefered_return->request_mode |= CWWidth; + result = XtGeometryAlmost; + } + if (prefered_size.height != w->core.height) { + prefered_return->request_mode |= CWHeight; + result = XtGeometryAlmost; + } + } else { + if (request->request_mode & CWWidth) { + if (prefered_size.width > request->width) + { + if (prefered_size.width == w->core.width) + result = XtGeometryNo; + else if (result != XtGeometryNo) { + result = XtGeometryAlmost; + prefered_return->request_mode |= CWWidth; + prefered_return->width = prefered_size.width; + } + } + } + if (request->request_mode & CWHeight) { + if (prefered_size.height > request->height) + { + if (prefered_size.height == w->core.height) + result = XtGeometryNo; + else if (result != XtGeometryNo) { + result = XtGeometryAlmost; + prefered_return->request_mode |= CWHeight; + prefered_return->height = prefered_size.height; + } + } + } + } + return result; +} + +/* + * Layout section. Exports LayoutGetNaturalSize and + * LayoutLayout to above section + */ + +static void +PrintGlue (g) + GlueRec g; +{ + if (g.order == 0 || g.value != 1.0) + (void) printf ("%g", g.value); + if (g.order > 0) + { + (void) printf ("%s", " inf"); + if (g.order > 1) + (void) printf (" %d", g.order); + } +} + +static void +PrintDirection (dir) + LayoutDirection dir; +{ + switch (dir) { + case LayoutHorizontal: + (void) printf ("%s", "horizontal"); + break; + case LayoutVertical: + (void) printf ("%s", "vertical"); + break; + default: + (void) printf ("Unknown layout direction %d\n", dir); + break; + + } +} + +static void +TabTo(level) + int level; +{ + while (level--) + (void) printf ("%s", " "); +} + +static void +PrintBox (box, level) + BoxPtr box; + int level; +{ + BoxPtr child; + + TabTo (level); + (void) printf ("%s", "< "); + (void) printf ("%s", " + "); + PrintGlue (box->params.stretch[LayoutHorizontal]); + (void) printf ("%s", " - "); + PrintGlue (box->params.shrink[LayoutHorizontal]); + (void) printf ("%s", " * "); + (void) printf ("%s", " + "); + PrintGlue (box->params.stretch[LayoutVertical]); + (void) printf ("%s", " - "); + PrintGlue (box->params.shrink[LayoutVertical]); + (void) printf ("%s", " >"); + (void) printf (" size: %d x %d", box->size[0], box->size[1]); + (void) printf (" natural: %d x %d ", box->natural[0], box->natural[1]); + switch (box->type) { + case BoxBox: + PrintDirection (box->u.box.dir); + (void) printf ("%s\n", ""); + for (child = box->u.box.firstChild; child; child = child->nextSibling) + PrintBox (child, level+1); + break; + case WidgetBox: + (void) printf (" %s\n", XrmQuarkToString (box->u.widget.quark)); + break; + case GlueBox: + (void) printf ("%s\n", " glue"); + break; + case VariableBox: + (void) printf (" variable %s\n", XrmQuarkToString (box->u.variable.quark)); + break; + } +} + +static ExprPtr +LookupVariable (child, quark) + BoxPtr child; + XrmQuark quark; +{ + BoxPtr parent, box; + + DBUG_ENTER("LookupVariable"); + DBUG_PRINT("name = <%s>",XrmQuarkToString(quark)); + DBUG_PRINT("child = %p",child); + while ((parent = child->parent)) + { + for (box = parent->u.box.firstChild; + box != child; + box = box->nextSibling) + { + if (box->type == VariableBox && box->u.variable.quark == quark) + DBUG_RETURN("%p", box->u.variable.expr); + } + child = parent; + } + DBUG_RETURN("failure -> %d",0); +} + +static double +Evaluate (l, box, expr, natural) + LayoutWidget l; + BoxPtr box; + ExprPtr expr; + double natural; +{ + double left, right, down; + Widget widget; + SubInfoPtr info; + + DBUG_PRINT("Evaluate %d", expr->type); + switch (expr->type) { + case Constant: + return expr->u.constant; + case Binary: + left = Evaluate (l, box, expr->u.binary.left, natural); + right = Evaluate (l, box, expr->u.binary.right, natural); + switch (expr->u.binary.op) { + case Plus: + return left + right; + case Minus: + return left - right; + case Times: + return left * right; + case Divide: + return left / right; + case Percent: + return right * left / 100.0; + } + case Unary: + down = Evaluate (l, box, expr->u.unary.down, natural); + switch (expr->u.unary.op) { + case Percent: + return natural * down / 100.0; + case Minus: + return -down; + case Plus: + case Times: + case Divide: + break; + } + case Width: + widget = QuarkToWidget (l, expr->u.width); + if (!widget) + return 0; + info = SubInfo (widget); + return info->naturalSize[LayoutHorizontal]; + case Height: + widget = QuarkToWidget (l, expr->u.height); + if (!widget) + return 0; + info = SubInfo (widget); + return info->naturalSize[LayoutVertical]; + case Variable: + { + /* in the original code there was no nexpr, + expr was overwritten by LookupVariable and + the expression "expr->u.variable" to obtain the + variable name for the errormessage cause a segmentation + violation */ + ExprPtr nexpr; + nexpr = LookupVariable (box, expr->u.variable); + if (!nexpr) + { + char buf[256]; + (void) sprintf (buf, "Layout: undefined variable %s\n", + XrmQuarkToString (expr->u.variable)); + XtError (buf); + return 0.0; + } + return Evaluate (l, box, nexpr, natural); + } + } + return 0.0; +} + +static void +DisposeExpr (expr) + ExprPtr expr; +{ + if (!expr) + return; + switch (expr->type) { + case Constant: + break; + case Binary: + DisposeExpr (expr->u.binary.left); + DisposeExpr (expr->u.binary.right); + break; + case Unary: + DisposeExpr (expr->u.unary.down); + break; + case Width: + case Height: + case Variable: + break; + } + Dispose (expr); +} + +#define CheckGlue(l, box, glue, n) { \ + if (glue.expr) \ + glue.value = Evaluate (l, box, glue.expr, n); \ + if (glue.order == 0 && glue.value == 0) \ + glue.order = -1; \ + else if (glue.order == -1 && glue.value != 0) \ + glue.order = 0; \ +} + +#define DoStretch(l, box, dir) \ + CheckGlue (l, box, box->params.stretch[dir], (double) box->natural[dir]); + +#define DoShrink(l, box, dir) \ + CheckGlue (l, box, box->params.shrink[dir], (double) box->natural[dir]) + +/* compute the natural sizes of a box */ +static void +ComputeNaturalSizes (l, box, dir) + LayoutWidget l; + BoxPtr box; + LayoutDirection dir; +{ + BoxPtr child; + Widget w; + SubInfoPtr info; + int minStretchOrder, minShrinkOrder; + LayoutDirection thisDir; + + DBUG_ENTER("ComputeNaturalSizes"); + DBUG_PRINT("box->type=%d",box->type); + switch (box->type) { + case WidgetBox: + w = box->u.widget.widget = QuarkToWidget (l, box->u.widget.quark); + if (!w) + { + box->natural[LayoutHorizontal] = 0; + box->natural[LayoutVertical] = 0; + } + else + { + info = SubInfo (w); + box->natural[LayoutHorizontal] = info->naturalSize[LayoutHorizontal]; + box->natural[LayoutVertical] = info->naturalSize[LayoutVertical]; + } + DoStretch (l, box, dir); + DoShrink (l, box, dir); + DoStretch (l, box, !dir); + DoShrink (l, box, !dir); + break; + case GlueBox: + box->natural[dir] = Evaluate (l, box, box->u.glue.expr, 0.0); + box->natural[!dir] = 0; + DoStretch (l, box, dir); + DoShrink (l, box, dir); + break; + case BoxBox: + thisDir = box->u.box.dir; + box->natural[0] = 0; + box->natural[1] = 0; + minStretchOrder = 100000; + minShrinkOrder = 100000; + ZeroGlue (box->params.shrink[thisDir]); + ZeroGlue (box->params.stretch[thisDir]); + box->params.shrink[!thisDir].order = 100000; + box->params.stretch[!thisDir].order = 100000; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + ComputeNaturalSizes (l, child, thisDir); + /* + * along box axis: + * normal size += child normal size + * shrink += child shrink + * stretch += child stretch + */ + box->natural[thisDir] += child->natural[thisDir]; + AddGlue (box->params.shrink[thisDir], + box->params.shrink[thisDir], + child->params.shrink[thisDir]); + AddGlue (box->params.stretch[thisDir], + box->params.stretch[thisDir], + child->params.stretch[thisDir]); + /* + * normal to box axis: + * normal size = maximum child normal size of minimum shrink order + * shrink = difference between normal size and minimum shrink + * stretch = minimum child stretch + */ + if (box->natural[!thisDir] >= child->natural[!thisDir]) + { + if (child->params.stretch[!thisDir].order < minShrinkOrder) + { + box->natural[!thisDir] = child->natural[!thisDir]; + minStretchOrder = child->params.stretch[!thisDir].order; + if (child->params.shrink[!thisDir].order < minShrinkOrder) + minShrinkOrder = child->params.shrink[!thisDir].order; + } + } + else + { + if (child->params.shrink[!thisDir].order <= minStretchOrder) + { + box->natural[!thisDir] = child->natural[!thisDir]; + minShrinkOrder = child->params.shrink[!thisDir].order; + if (child->params.stretch[!thisDir].order < minStretchOrder) + minStretchOrder = child->params.stretch[!thisDir].order; + } + } + MinGlue (box->params.stretch[!thisDir], + box->params.stretch[!thisDir], + child->params.stretch[!thisDir]); + MinGlue (box->params.shrink[!thisDir], + box->params.shrink[!thisDir], + child->params.shrink[!thisDir]); + } + if (box->params.shrink[!thisDir].order <= 0) + { + int minSize; + int largestMinSize; + + largestMinSize = 0; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + if (child->params.shrink[!thisDir].order <= 0) + { + minSize = child->natural[!thisDir] - + child->params.shrink[!thisDir].value; + if (minSize > largestMinSize) + largestMinSize = minSize; + } + } + box->params.shrink[!thisDir].value = box->natural[!thisDir] - + largestMinSize; + if (box->params.shrink[!thisDir].value == 0) + box->params.shrink[!thisDir].order = -1; + else + box->params.shrink[!thisDir].order = 0; + } + break; + case VariableBox: + break; + } + DBUG_VOID_RETURN; +} + +/* given the boxs geometry, set the geometry of the pieces */ + +#define GluePart(a,b,dist) ((a) ? ((int) (((a) * (dist)) / (b) + \ + ((dist >= 0) ? 0.5 : -0.5))) : 0) + +static Bool +ComputeSizes (box) + BoxPtr box; +{ + LayoutDirection dir; + BoxPtr child; + GlueRec stretch; + GlueRec shrink; + GlueRec totalGlue[2]; + double remainingGlue; + GluePtr glue; + int size; + int totalSizes; + int totalChange[2]; + int change; + int remainingChange; + Bool shrinking; + Bool happy; + int i; + int maxGlue; + + dir = box->u.box.dir; + size = box->size[dir]; + + stretch = box->params.stretch[dir]; + shrink = box->params.shrink[dir]; + + /* pick the correct adjustment parameters based on the change direction */ + + totalChange[0] = size - box->natural[dir]; + + shrinking = totalChange[0] < 0; + + totalChange[1] = 0; + totalGlue[1].order = 100000; + totalGlue[1].value = 0; + maxGlue = 1; + if (shrinking) + { + totalGlue[0] = shrink; + /* for first-order infinites, shrink it to zero and then + * shrink the zero-orders + */ + if (shrink.order == 1) { + totalSizes = 0; + remainingGlue = 0; + for (child = box->u.box.firstChild; + child; + child = child->nextSibling) + { + switch (child->params.shrink[dir].order) { + case 0: + remainingGlue += child->params.shrink[dir].value; + break; + case 1: + totalSizes += child->natural[dir]; + break; + } + } + if (totalSizes < -totalChange[0]) + { + totalGlue[1] = shrink; + totalGlue[0].order = 0; + totalGlue[0].value = remainingGlue; + totalChange[1] = -totalSizes; + totalChange[0] = totalChange[0] - totalChange[1]; + maxGlue = 2; + } + } + if (totalGlue[0].order <= 0 && + totalChange[0] > totalGlue[0].value) + { + totalChange[0] = totalGlue[0].value; + } + } + else + totalGlue[0] = stretch; + + /* adjust each box */ + totalSizes = 0; + remainingGlue = totalGlue[0].value + totalGlue[1].value; + remainingChange = totalChange[0] + totalChange[1]; + happy = True; + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + /* never add glue or stretch to a VariableBox! */ + if (child->type == VariableBox) continue; + + if (shrinking) + glue = &child->params.shrink[dir]; + else + glue = &child->params.stretch[dir]; + + child->size[dir] = child->natural[dir]; + for (i = 0; i < maxGlue; i++) + { + if (glue->order == totalGlue[i].order) + { + remainingGlue -= glue->value; + if (remainingGlue <= 0) + change = remainingChange; + else + change = GluePart (glue->value, + totalGlue[i].value, + totalChange[i]); + child->size[dir] += change; + remainingChange -= change; + } + } + child->size[!dir] = box->size[!dir]; + totalSizes += child->size[dir]; + if (child->type == BoxBox) + if (!ComputeSizes (child)) + happy = False; + } + return totalSizes == box->size[dir] && happy; +} + +static void +SetSizes (box, x, y) + BoxPtr box; + Position x, y; +{ + BoxPtr child; + int width, height; + int bw; + Widget w; + SubInfoPtr info; + + switch (box->type) { + case WidgetBox: + w = box->u.widget.widget; + if (w) + { + info = SubInfo(w); + /* info = (SubInfoPtr) w->core.constraints; */ + width = box->size[LayoutHorizontal]; + height = box->size[LayoutVertical]; + bw = info->naturalBw; + width -= bw * 2; + height -= bw * 2; + /* Widgets which grow too small are placed off screen */ + if (width <= 0 || height <= 0) + { + width = 1; + height = 1; + bw = 0; + x = -1; + y = -1; + } + XtConfigureWidget (w, x, y, + (Dimension)width, (Dimension)height, + (Dimension)bw); + } + break; + case BoxBox: + for (child = box->u.box.firstChild; child; child = child->nextSibling) + { + SetSizes (child, x, y); + if (box->u.box.dir == LayoutHorizontal) + x += child->size[LayoutHorizontal]; + else + y += child->size[LayoutVertical]; + } + break; + case GlueBox: + case VariableBox: + break; + } +} + +static void +LayoutFreeLayout (box) + BoxPtr box; +{ + BoxPtr child, next; + + switch (box->type) { + case BoxBox: + for (child = box->u.box.firstChild; child; child = next) + { + next = child->nextSibling; + LayoutFreeLayout (child); + } + break; + case GlueBox: + DisposeExpr (box->u.glue.expr); + break; + case WidgetBox: + case VariableBox: + default: + break; + } + DisposeExpr (box->params.stretch[LayoutHorizontal].expr); + DisposeExpr (box->params.shrink[LayoutHorizontal].expr); + DisposeExpr (box->params.stretch[LayoutVertical].expr); + DisposeExpr (box->params.shrink[LayoutVertical].expr); + Dispose (box); +} + + +static void +LayoutGetNaturalSize (l, widthp, heightp) + LayoutWidget l; + Dimension *widthp, *heightp; +{ + BoxPtr box; + + DBUG_ENTER("LayoutGetNaturalSize"); + box = l->layout.layout; + if (box) + { + ComputeNaturalSizes (l, box, LayoutHorizontal); + *widthp = box->natural[LayoutHorizontal]; + *heightp = box->natural[LayoutVertical]; + } + else + { + *widthp = 0; + *heightp = 0; + } + DBUG_VOID_RETURN; +} + +static void +LayoutLayout (l, attemptResize) + LayoutWidget l; + Bool attemptResize; +{ + BoxPtr box; + Dimension width, height; + Dimension prefered_width, prefered_height; + + DBUG_ENTER("LayoutLayout"); + box = l->layout.layout; + if (!box) + return; + LayoutGetNaturalSize (l, &prefered_width, &prefered_height); + if (l->core.width == 0 || l->core.height == 0) + { + l->core.width = prefered_width; + l->core.height = prefered_height; + } + box->size[LayoutHorizontal] = l->core.width; + box->size[LayoutVertical] = l->core.height; + if (!ComputeSizes (box) && attemptResize) + { + XtMakeResizeRequest ((Widget) l, + prefered_width, prefered_height, + &width, &height); + if (width != box->size[LayoutHorizontal] || + height != box->size[LayoutVertical]) + { + box->size[LayoutHorizontal] = width; + box->size[LayoutVertical] = height; + ComputeSizes (box); + } + } + if (l->layout.debug) + { + PrintBox (box, 0); + fflush (stdout); + } + SetSizes (box, 0, 0); + DBUG_VOID_RETURN; +} + diff --git a/vendor/x11iraf/xaw3d/Layout.h b/vendor/x11iraf/xaw3d/Layout.h new file mode 100644 index 00000000..7d9e636a --- /dev/null +++ b/vendor/x11iraf/xaw3d/Layout.h @@ -0,0 +1,94 @@ +/* + * $XConsortium: Layout.h,v 1.2 92/01/22 18:03:05 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + + +#ifndef _XawLayout_h +#define _XawLayout_h + +#include <X11/Constraint.h> +#include <X11/Xfuncproto.h> + +/**************************************************************** + * + * Layout Widget (SubClass of CompositeClass) + * + ****************************************************************/ + +/* RESOURCES: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + layout Layout Layout NULL + +*/ + +/* + * Syntax of layout resource + * + * *layout:\ + * <widget-name>.<edge>,<widget-name>.<edge>: distance + stretch-factor\n\ + * ... + * where the null widget-name is taken to be the Layout widget + * + * e.g: + * + * *label-1.hStretch: 0 + * *label-2.vStretch: 1 + * *layout:\ + * .left, label-1.left: 10 + 0\n\ + * label-1.right, label-2.left: 10 + 1\n\ + * label-2.right, .right: 10 + 0 + * + * This layout causes label-1 to be set 10 pixels from the left edge + * and be whatever size the label widget requests, while label-2 will + * be set 10 pixels from the right edge, and take up half of the remaining + * space to 10 pixels from the right edge of label-1. + */ + +/* New Fields */ +#define XtNlayout "layout" +#define XtCLayout "Layout" +#define XtRLayout "Layout" +#define XtNdebug "debug" + +/* Class record constant */ + +extern WidgetClass layoutWidgetClass; + +typedef struct _LayoutClassRec *LayoutWidgetClass; +typedef struct _LayoutRec *LayoutWidget; + +#endif /* _Layout_h */ diff --git a/vendor/x11iraf/xaw3d/LayoutP.h b/vendor/x11iraf/xaw3d/LayoutP.h new file mode 100644 index 00000000..ae1f2c6c --- /dev/null +++ b/vendor/x11iraf/xaw3d/LayoutP.h @@ -0,0 +1,232 @@ +/* + * $XConsortium: LayoutP.h,v 1.2 92/01/22 18:03:08 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _XawLayoutP_h +#define _XawLayoutP_h + +#if defined(LAYOUT) +# include "Layout.h" +#else +# include <X11/Xaw3d/Layout.h> +#endif + +#include <X11/ConstrainP.h> + +#ifdef MOTIF +# include "Xm/ManagerP.h" +#endif + +#define GlueEqual(a,b) ((a).order == (b).order && (a).value == (b).value) + +#define AddGlue(r,a,b) if (a.order == b.order) { \ + r.order = a.order; \ + r.value = a.value + b.value; \ + } else { \ + if (a.order > b.order) \ + r = a; \ + else \ + r = b; \ + } + +#define MinGlue(r,a,b) if (a.order == b.order) { \ + r.order = a.order; \ + if (a.value > b.value) \ + r.value = b.value; \ + else \ + r.value = a.value; \ + } else { \ + if (a.order > b.order) \ + r = b; \ + else \ + r = a; \ + } + +#define SubGlue(r,a,b) if (a.order == b.order) { \ + r.order = a.order; \ + r.value = a.value - b.value; \ + } else { \ + if (a.order > b.order) \ + r = a; \ + else { \ + r.order = b.order; \ + r.value = -b.value; \ + } \ + } + +#define ZeroGlue(g) ((g).value = 0, (g).order = 0, (g).expr = 0) +#define IsZeroGlue(g) ((g).value == 0) + +#define QuarkToWidget(l,q) XtNameToWidget((Widget) l, \ + (char *) XrmQuarkToString(q)); + +typedef enum _BoxType { BoxBox, WidgetBox, GlueBox, VariableBox } BoxType; + +typedef enum _LayoutDirection { + LayoutHorizontal = 0, LayoutVertical = 1 +} LayoutDirection; + +typedef enum _Operator { + Plus, Minus, Times, Divide, Percent +} Operator; + +typedef enum _ExprType { + Constant, + Binary, + Unary, + Width, + Height, + Variable +} ExprType; + +typedef struct _Expr *ExprPtr; + +typedef struct _Expr { + ExprType type; + union { + double constant; + struct { + Operator op; + ExprPtr left, right; + } binary; + struct { + Operator op; + ExprPtr down; + } unary; + XrmQuark width; + XrmQuark height; + XrmQuark variable; + } u; +} ExprRec; + +typedef struct _Glue { + int order; + double value; + ExprPtr expr; +} GlueRec, *GluePtr; + +typedef struct _BoxParams { + GlueRec stretch[2]; + GlueRec shrink[2]; +} BoxParamsRec, *BoxParamsPtr; + +typedef struct _Box *BoxPtr; + +typedef BoxPtr LayoutPtr; + +typedef struct _Box { + BoxPtr nextSibling; + BoxPtr parent; + BoxParamsRec params; + int size[2]; + int natural[2]; + BoxType type; + union { + struct { + BoxPtr firstChild; + LayoutDirection dir; + } box; + struct { + XrmQuark quark; + Widget widget; + } widget; + struct { + ExprPtr expr; + } glue; + struct { + XrmQuark quark; + ExprPtr expr; + } variable; + } u; +} LBoxRec; /* this conflicted with Box's BoxRec, besides, it's not used anywhere */ + +typedef struct _SubInfo { + int naturalSize[2]; + int naturalBw; +} SubInfoRec, *SubInfoPtr; + +/* #define New(t) (t *) malloc(sizeof (t)) */ +#define New(t) (t *) XtCalloc(1,sizeof (t)) +#define Dispose(p) XtFree((char *) p) +#define Some(t,n) (t*) XtMalloc(sizeof(t) * n) +#define More(p,t,n) ((p)? (t *) XtRealloc((char *) p, sizeof(t)*n):Some(t,n) + +/********************************************************************* + * + * Layout Widget Private Data + * + *********************************************************************/ + +/* New fields for the Layout widget class record */ + +typedef struct _LayoutClassPart { + int foo; /* keep compiler happy. */ +} LayoutClassPart; + +/* Full Class record declaration */ +typedef struct _LayoutClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; +#ifdef MOTIF + XmManagerClassPart manager_class; +#endif + LayoutClassPart layout_class; +} LayoutClassRec; + +extern LayoutClassRec layoutClassRec; + +typedef struct _LayoutConstraintsRec { +#ifdef MOTIF + XmManagerConstraintPart manager; +#endif + SubInfoRec layout; +} LayoutConstraintsRec, *LayoutConstraints; + +#define SubInfo(w) (&(((LayoutConstraints) (w)->core.constraints)->layout)) + +/* New Fields for the Layout widget record */ + +typedef struct { + /* resources */ + LayoutPtr layout; + Boolean debug; +} LayoutPart; + +/************************************************************************** + * + * Full instance record declaration + * + **************************************************************************/ + +typedef struct _LayoutRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; +#ifdef MOTIF + XmManagerPart manager; +#endif + LayoutPart layout; +} LayoutRec; +#endif diff --git a/vendor/x11iraf/xaw3d/List.c b/vendor/x11iraf/xaw3d/List.c new file mode 100644 index 00000000..e37e2ff0 --- /dev/null +++ b/vendor/x11iraf/xaw3d/List.c @@ -0,0 +1,1204 @@ +/* $XConsortium: List.c,v 1.39 94/04/17 20:12:15 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. +*/ + +/* + * List.c - List widget + * + * This is a List widget. It allows the user to select an item in a list and + * notifies the application through a callback function. + * + * Created: 8/13/88 + * By: Chris D. Peterson + * MIT X Consortium + */ + +#include <stdio.h> +#include <ctype.h> + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Drawing.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/ListP.h> + +/* These added so widget knows whether its height, width are user selected. +I also added the freedoms member of the list widget part. */ + +#define HeightLock 1 +#define WidthLock 2 +#define LongestLock 4 + +#define HeightFree( w ) !(((ListWidget)(w))->list.freedoms & HeightLock ) +#define WidthFree( w ) !(((ListWidget)(w))->list.freedoms & WidthLock ) +#define LongestFree( w ) !(((ListWidget)(w))->list.freedoms & LongestLock ) + +/* + * Default Translation table. + */ + +static char defaultTranslations[] = + "<Btn1Down>: Set()\n\ + <Btn1Up>: Notify()"; + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +#define offset(field) XtOffset(ListWidget, field) + +static XtResource resources[] = { + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(list.foreground), XtRString, XtDefaultForeground}, + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(simple.cursor), XtRString, "left_ptr"}, + {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + offset(list.font),XtRString, XtDefaultFont}, + {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ), + offset(list.fontset),XtRString, XtDefaultFontSet}, + {XtNlist, XtCList, XtRPointer, sizeof(char **), + offset(list.list), XtRString, NULL}, + {XtNdefaultColumns, XtCColumns, XtRInt, sizeof(int), + offset(list.default_cols), XtRImmediate, (XtPointer)2}, + {XtNlongest, XtCLongest, XtRInt, sizeof(int), + offset(list.longest), XtRImmediate, (XtPointer)0}, + {XtNnumberStrings, XtCNumberStrings, XtRInt, sizeof(int), + offset(list.nitems), XtRImmediate, (XtPointer)0}, + {XtNpasteBuffer, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(list.paste), XtRImmediate, (XtPointer) False}, + {XtNforceColumns, XtCColumns, XtRBoolean, sizeof(Boolean), + offset(list.force_cols), XtRImmediate, (XtPointer) False}, + {XtNverticalList, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(list.vertical_cols), XtRImmediate, (XtPointer) False}, + {XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension), + offset(list.internal_width), XtRImmediate, (XtPointer)2}, + {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension), + offset(list.internal_height), XtRImmediate, (XtPointer)2}, + {XtNcolumnSpacing, XtCSpacing, XtRDimension, sizeof(Dimension), + offset(list.column_space), XtRImmediate, (XtPointer)6}, + {XtNrowSpacing, XtCSpacing, XtRDimension, sizeof(Dimension), + offset(list.row_space), XtRImmediate, (XtPointer)2}, + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(list.callback), XtRCallback, NULL}, +}; + +static void Initialize(); +static void ChangeSize(); +static void Resize(); +static void Redisplay(); +static void Destroy(); +static Boolean Layout(); +static XtGeometryResult PreferredGeom(); +static Boolean SetValues(); +static void Notify(), Set(), Unset(); + +static XtActionsRec actions[] = { + {"Notify", Notify}, + {"Set", Set}, + {"Unset", Unset}, +}; + +ListClassRec listClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "List", + /* widget_size */ sizeof(ListRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ PreferredGeom, + }, +/* Simple class fields initialization */ + { + /* change_sensitive */ XtInheritChangeSensitive + }, +/* List class fields initialization */ + { + /* not used */ 0 + }, +}; + +WidgetClass listWidgetClass = (WidgetClass)&listClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static void GetGCs(w) +Widget w; +{ + XGCValues values; + ListWidget lw = (ListWidget) w; + + values.foreground = lw->list.foreground; + values.font = lw->list.font->fid; + + if ( lw->simple.international == True ) + lw->list.normgc = XtAllocateGC( w, 0, (unsigned) GCForeground, + &values, GCFont, 0 ); + else + lw->list.normgc = XtGetGC( w, (unsigned) GCForeground | GCFont, + &values); + + values.foreground = lw->core.background_pixel; + + if ( lw->simple.international == True ) + lw->list.revgc = XtAllocateGC( w, 0, (unsigned) GCForeground, + &values, GCFont, 0 ); + else + lw->list.revgc = XtGetGC( w, (unsigned) GCForeground | GCFont, + &values); + + values.tile = XmuCreateStippledPixmap(XtScreen(w), + lw->list.foreground, + lw->core.background_pixel, + lw->core.depth); + values.fill_style = FillTiled; + + if ( lw->simple.international == True ) + lw->list.graygc = XtAllocateGC( w, 0, (unsigned) GCTile | GCFillStyle, + &values, GCFont, 0 ); + else + lw->list.graygc = XtGetGC( w, (unsigned) GCFont | GCTile | GCFillStyle, + &values); +} + + +/* CalculatedValues() + * + * does routine checks/computations that must be done after data changes + * but won't hurt if accidently called + * + * These calculations were needed in SetValues. They were in ResetList. + * ResetList called ChangeSize, which made an XtGeometryRequest. You + * MAY NOT change your geometry from within a SetValues. (Xt man, + * sect. 9.7.2) So, I factored these changes out. */ + +static void CalculatedValues( w ) +Widget w; +{ + int i, len; + + ListWidget lw = (ListWidget) w; + + /* If list is NULL then the list will just be the name of the widget. */ + + if (lw->list.list == NULL) { + lw->list.list = &(lw->core.name); + lw->list.nitems = 1; + } + + /* Get number of items. */ + + if (lw->list.nitems == 0) + for ( ; lw->list.list[lw->list.nitems] != NULL ; lw->list.nitems++); + + /* Get column width. */ + + if ( LongestFree( lw ) ) { + + lw->list.longest = 0; /* so it will accumulate real longest below */ + + for ( i = 0 ; i < lw->list.nitems; i++) { + if ( lw->simple.international == True ) + len = XmbTextEscapement(lw->list.fontset, lw->list.list[i], + strlen(lw->list.list[i])); + else + len = XTextWidth(lw->list.font, lw->list.list[i], + strlen(lw->list.list[i])); + if (len > lw->list.longest) + lw->list.longest = len; + } + } + + lw->list.col_width = lw->list.longest + lw->list.column_space; +} + +/* Function Name: ResetList + * Description: Resets the new list when important things change. + * Arguments: w - the widget. + * changex, changey - allow the height or width to change? + * + * Returns: TRUE if width or height have been changed + */ + +static void +ResetList( w, changex, changey ) +Widget w; +Boolean changex, changey; +{ + Dimension width = w->core.width; + Dimension height = w->core.height; + + CalculatedValues( w ); + + if( Layout( w, changex, changey, &width, &height ) ) + ChangeSize( w, width, height ); +} + +/* Function Name: ChangeSize. + * Description: Laysout the widget. + * Arguments: w - the widget to try change the size of. + * Returns: none. + */ + +static void +ChangeSize(w, width, height) +Widget w; +Dimension width, height; +{ + XtWidgetGeometry request, reply; + + request.request_mode = CWWidth | CWHeight; + request.width = width; + request.height = height; + + switch ( XtMakeGeometryRequest(w, &request, &reply) ) { + case XtGeometryYes: + break; + case XtGeometryNo: + break; + case XtGeometryAlmost: + Layout(w, (request.height != reply.height), + (request.width != reply.width), + &(reply.width), &(reply.height)); + request = reply; + switch (XtMakeGeometryRequest(w, &request, &reply) ) { + case XtGeometryYes: + case XtGeometryNo: + break; + case XtGeometryAlmost: + request = reply; + Layout(w, FALSE, FALSE, &(request.width), &(request.height)); + request.request_mode = CWWidth | CWHeight; + XtMakeGeometryRequest(w, &request, &reply); + break; + default: + XtAppWarning(XtWidgetToApplicationContext(w), + "List Widget: Unknown geometry return."); + break; + } + break; + default: + XtAppWarning(XtWidgetToApplicationContext(w), + "List Widget: Unknown geometry return."); + break; + } +} + +/* Function Name: Initialize + * Description: Function that initilizes the widget instance. + * Arguments: junk - NOT USED. + * new - the new widget. + * Returns: none + */ + +/* ARGSUSED */ +static void +Initialize(junk, new, args, num_args) +Widget junk, new; +ArgList args; +Cardinal *num_args; +{ + ListWidget lw = (ListWidget) new; + +/* + * Initialize all private resources. + */ + + /* record for posterity if we are free */ + lw->list.freedoms = (lw->core.width != 0) * WidthLock + + (lw->core.height != 0) * HeightLock + + (lw->list.longest != 0) * LongestLock; + + GetGCs(new); + + /* Set row height. based on font or fontset */ + + if (lw->simple.international == True ) + lw->list.row_height = + XExtentsOfFontSet(lw->list.fontset)->max_ink_extent.height + + lw->list.row_space; + else + lw->list.row_height = lw->list.font->max_bounds.ascent + + lw->list.font->max_bounds.descent + + lw->list.row_space; + + ResetList( new, WidthFree( lw ), HeightFree( lw ) ); + + lw->list.highlight = lw->list.is_highlighted = NO_HIGHLIGHT; + +} /* Initialize */ + +/* Function Name: CvtToItem + * Description: Converts Xcoord to item number of item containing that + * point. + * Arguments: w - the list widget. + * xloc, yloc - x location, and y location. + * Returns: the item number. + */ + +static int +CvtToItem(w, xloc, yloc, item) +Widget w; +int xloc, yloc; +int *item; +{ + int one, another; + ListWidget lw = (ListWidget) w; + int ret_val = OKAY; + + if (lw->list.vertical_cols) { + one = lw->list.nrows * ((xloc - (int) lw->list.internal_width) + / lw->list.col_width); + another = (yloc - (int) lw->list.internal_height) + / lw->list.row_height; + /* If out of range, return minimum possible value. */ + if (another >= lw->list.nrows) { + another = lw->list.nrows - 1; + ret_val = OUT_OF_RANGE; + } + } + else { + one = (lw->list.ncols * ((yloc - (int) lw->list.internal_height) + / lw->list.row_height)) ; + /* If in right margin handle things right. */ + another = (xloc - (int) lw->list.internal_width) / lw->list.col_width; + if (another >= lw->list.ncols) { + another = lw->list.ncols - 1; + ret_val = OUT_OF_RANGE; + } + } + if ((xloc < 0) || (yloc < 0)) + ret_val = OUT_OF_RANGE; + if (one < 0) one = 0; + if (another < 0) another = 0; + *item = one + another; + if (*item >= lw->list.nitems) return(OUT_OF_RANGE); + return(ret_val); +} + +/* Function Name: FindCornerItems. + * Description: Find the corners of the rectangle in item space. + * Arguments: w - the list widget. + * event - the event structure that has the rectangle it it. + * ul_ret, lr_ret - the corners ** RETURNED **. + * Returns: none. + */ + +static void +FindCornerItems(w, event, ul_ret, lr_ret) +Widget w; +XEvent * event; +int *ul_ret, *lr_ret; +{ + int xloc, yloc; + + xloc = event->xexpose.x; + yloc = event->xexpose.y; + CvtToItem(w, xloc, yloc, ul_ret); + xloc += event->xexpose.width; + yloc += event->xexpose.height; + CvtToItem(w, xloc, yloc, lr_ret); +} + +/* Function Name: ItemInRectangle + * Description: returns TRUE if the item passed is in the given rectangle. + * Arguments: w - the list widget. + * ul, lr - corners of the rectangle in item space. + * item - item to check. + * Returns: TRUE if the item passed is in the given rectangle. + */ + +static Boolean +ItemInRectangle(w, ul, lr, item) +Widget w; +int ul, lr, item; +{ + ListWidget lw = (ListWidget) w; + int mod_item; + int things; + + if (item < ul || item > lr) + return(FALSE); + if (lw->list.vertical_cols) + things = lw->list.nrows; + else + things = lw->list.ncols; + + mod_item = item % things; + if ( (mod_item >= ul % things) && (mod_item <= lr % things ) ) + return(TRUE); + return(FALSE); +} + + +/* HighlightBackground() + * + * Paints the color of the background for the given item. It performs + * clipping to the interior of internal_width/height by hand, as its a + * simple calculation and probably much faster than using Xlib and a clip mask. + * + * x, y - ul corner of the area item occupies. + * gc - the gc to use to paint this rectangle */ + +static void +HighlightBackground( w, x, y, gc ) +Widget w; +int x, y; +GC gc; +{ + ListWidget lw = (ListWidget) w; + + /* easy to clip the rectangle by hand and probably alot faster than Xlib */ + + Dimension width = lw->list.col_width; + Dimension height = lw->list.row_height; + Dimension frame_limited_width = w->core.width - lw->list.internal_width - x; + Dimension frame_limited_height= w->core.height- lw->list.internal_height- y; + + /* Clip the rectangle width and height to the edge of the drawable area */ + + if ( width > frame_limited_width ) + width = frame_limited_width; + if ( height> frame_limited_height) + height = frame_limited_height; + + /* Clip the rectangle x and y to the edge of the drawable area */ + + if ( x < lw->list.internal_width ) { + width = width - ( lw->list.internal_width - x ); + x = lw->list.internal_width; + } + if ( y < lw->list.internal_height) { + height = height - ( lw->list.internal_height - x ); + y = lw->list.internal_height; + } + XFillRectangle( XtDisplay( w ), XtWindow( w ), gc, x, y, + width, height ); +} + + +/* ClipToShadowInteriorAndLongest() + * + * Converts the passed gc so that any drawing done with that GC will not + * write in the empty margin (specified by internal_width/height) (which also + * prevents erasing the shadow. It also clips against the value longest. + * If the user doesn't set longest, this has no effect (as longest is the + * maximum of all item lengths). If the user does specify, say, 80 pixel + * columns, though, this prevents items from overwriting other items. */ + +static void ClipToShadowInteriorAndLongest(lw, gc_p, x) + ListWidget lw; + GC* gc_p; + Dimension x; +{ + XRectangle rect; + + rect.x = x; + rect.y = lw->list.internal_height; + rect.height = lw->core.height - lw->list.internal_height * 2; + rect.width = lw->core.width - lw->list.internal_width - x; + if ( rect.width > lw->list.longest ) + rect.width = lw->list.longest; + + XSetClipRectangles( XtDisplay((Widget)lw),*gc_p,0,0,&rect,1,YXBanded ); +} + + +/* PaintItemName() + * + * paints the name of the item in the appropriate location. + * w - the list widget. + * item - the item to draw. + * + * NOTE: no action taken on an unrealized widget. */ + +static void +PaintItemName(w, item) +Widget w; +int item; +{ + char * str; + GC gc; + int x, y, str_y; + ListWidget lw = (ListWidget) w; + XFontSetExtents *ext = XExtentsOfFontSet(lw->list.fontset); + + if (!XtIsRealized(w)) return; /* Just in case... */ + + if (lw->list.vertical_cols) { + x = lw->list.col_width * (item / lw->list.nrows) + + lw->list.internal_width; + y = lw->list.row_height * (item % lw->list.nrows) + + lw->list.internal_height; + } + else { + x = lw->list.col_width * (item % lw->list.ncols) + + lw->list.internal_width; + y = lw->list.row_height * (item / lw->list.ncols) + + lw->list.internal_height; + } + + if ( lw->simple.international == True ) + str_y = y + abs(ext->max_ink_extent.y); + else + str_y = y + lw->list.font->max_bounds.ascent; + + if (item == lw->list.is_highlighted) { + if (item == lw->list.highlight) { + gc = lw->list.revgc; + HighlightBackground(w, x, y, lw->list.normgc); + } + else { + if (XtIsSensitive(w)) + gc = lw->list.normgc; + else + gc = lw->list.graygc; + HighlightBackground(w, x, y, lw->list.revgc); + lw->list.is_highlighted = NO_HIGHLIGHT; + } + } + else { + if (item == lw->list.highlight) { + gc = lw->list.revgc; + HighlightBackground(w, x, y, lw->list.normgc); + lw->list.is_highlighted = item; + } + else { + if (XtIsSensitive(w)) + gc = lw->list.normgc; + else + gc = lw->list.graygc; + } + } + + /* List's overall width contains the same number of inter-column + column_space's as columns. There should thus be a half + column_width margin on each side of each column. + The row case is symmetric. */ + + x += lw->list.column_space / 2; + str_y += lw->list.row_space / 2; + + str = lw->list.list[item]; /* draw it */ + + ClipToShadowInteriorAndLongest( lw, &gc, x ); + + if ( lw->simple.international == True ) + XmbDrawString( XtDisplay( w ), XtWindow( w ), lw->list.fontset, + gc, x, str_y, str, strlen( str ) ); + else + XDrawString( XtDisplay( w ), XtWindow( w ), + gc, x, str_y, str, strlen( str ) ); + + XSetClipMask( XtDisplay( w ), gc, None ); +} + + +/* Redisplay() + * + * Repaints the widget window on expose events. + * w - the list widget. + * event - the expose event for this repaint. + * junk - not used, unless three-d patch enabled. */ + +/* ARGSUSED */ +static void +Redisplay(w, event, junk) +Widget w; +XEvent *event; +Region junk; +{ + int item; /* an item to work with. */ + int ul_item, lr_item; /* corners of items we need to paint. */ + ListWidget lw = (ListWidget) w; + + if (event == NULL) { /* repaint all. */ + ul_item = 0; + lr_item = lw->list.nrows * lw->list.ncols - 1; + XClearWindow(XtDisplay(w), XtWindow(w)); + } + else + FindCornerItems(w, event, &ul_item, &lr_item); + + for (item = ul_item; (item <= lr_item && item < lw->list.nitems) ; item++) + if (ItemInRectangle(w, ul_item, lr_item, item)) + PaintItemName(w, item); +} + + +/* PreferredGeom() + * + * This tells the parent what size we would like to be + * given certain constraints. + * w - the widget. + * intended - what the parent intends to do with us. + * requested - what we want to happen. */ + +static XtGeometryResult +PreferredGeom(w, intended, requested) +Widget w; +XtWidgetGeometry *intended, *requested; +{ + Dimension new_width, new_height; + Boolean change, width_req, height_req; + + width_req = intended->request_mode & CWWidth; + height_req = intended->request_mode & CWHeight; + + if (width_req) + new_width = intended->width; + else + new_width = w->core.width; + + if (height_req) + new_height = intended->height; + else + new_height = w->core.height; + + requested->request_mode = 0; + +/* + * We only care about our height and width. + */ + + if ( !width_req && !height_req) + return(XtGeometryYes); + + change = Layout(w, !width_req, !height_req, &new_width, &new_height); + + requested->request_mode |= CWWidth; + requested->width = new_width; + requested->request_mode |= CWHeight; + requested->height = new_height; + + if (change) + return(XtGeometryAlmost); + return(XtGeometryYes); +} + + +/* Resize() + * + * resizes the widget, by changing the number of rows and columns. */ + +static void +Resize(w) + Widget w; +{ + Dimension width, height; + + width = w->core.width; + height = w->core.height; + + if (Layout(w, FALSE, FALSE, &width, &height)) + XtAppWarning(XtWidgetToApplicationContext(w), + "List Widget: Size changed when it shouldn't have when resising."); +} + + +/* Layout() + * + * lays out the item in the list. + * w - the widget. + * xfree, yfree - TRUE if we are free to resize the widget in + * this direction. + * width, height- the is the current width and height that we are going + * we are going to layout the list widget to, + * depending on xfree and yfree of course. + * + * RETURNS: TRUE if width or height have been changed. */ + +static Boolean +Layout(w, xfree, yfree, width, height) +Widget w; +Boolean xfree, yfree; +Dimension *width, *height; +{ + ListWidget lw = (ListWidget) w; + Boolean change = FALSE; + +/* + * If force columns is set then always use number of columns specified + * by default_cols. + */ + + if (lw->list.force_cols) { + lw->list.ncols = lw->list.default_cols; + if (lw->list.ncols <= 0) lw->list.ncols = 1; + /* 12/3 = 4 and 10/3 = 4, but 9/3 = 3 */ + lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ; + if (xfree) { /* If allowed resize width. */ + + /* this counts the same number + of inter-column column_space 's as columns. There should thus be a + half column_space margin on each side of each column...*/ + + *width = lw->list.ncols * lw->list.col_width + + 2 * lw->list.internal_width; + change = TRUE; + } + if (yfree) { /* If allowed resize height. */ + *height = (lw->list.nrows * lw->list.row_height) + + 2 * lw->list.internal_height; + change = TRUE; + } + return(change); + } + +/* + * If both width and height are free to change the use default_cols + * to determine the number columns and set new width and height to + * just fit the window. + */ + + if (xfree && yfree) { + lw->list.ncols = lw->list.default_cols; + if (lw->list.ncols <= 0) lw->list.ncols = 1; + lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ; + *width = lw->list.ncols * lw->list.col_width + + 2 * lw->list.internal_width; + *height = (lw->list.nrows * lw->list.row_height) + + 2 * lw->list.internal_height; + change = TRUE; + } +/* + * If the width is fixed then use it to determine the number of columns. + * If the height is free to move (width still fixed) then resize the height + * of the widget to fit the current list exactly. + */ + else if (!xfree) { + lw->list.ncols = ( (int)(*width - 2 * lw->list.internal_width) + / (int)lw->list.col_width); + if (lw->list.ncols <= 0) lw->list.ncols = 1; + lw->list.nrows = ( ( lw->list.nitems - 1) / lw->list.ncols) + 1 ; + if ( yfree ) { + *height = (lw->list.nrows * lw->list.row_height) + + 2 * lw->list.internal_height; + change = TRUE; + } + } +/* + * The last case is xfree and !yfree we use the height to determine + * the number of rows and then set the width to just fit the resulting + * number of columns. + */ + else if (!yfree) { /* xfree must be TRUE. */ + lw->list.nrows = (int)(*height - 2 * lw->list.internal_height) + / (int)lw->list.row_height; + if (lw->list.nrows <= 0) lw->list.nrows = 1; + lw->list.ncols = (( lw->list.nitems - 1 ) / lw->list.nrows) + 1; + *width = lw->list.ncols * lw->list.col_width + + 2 * lw->list.internal_width; + change = TRUE; + } + return(change); +} + + +/* Notify() - ACTION + * + * Notifies the user that a button has been pressed, and + * calls the callback; if the XtNpasteBuffer resource is true + * then the name of the item is also put in CUT_BUFFER0. */ + +/* ARGSUSED */ +static void +Notify(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal *num_params; +{ + ListWidget lw = ( ListWidget ) w; + int item, item_len; + XawListReturnStruct ret_value; + +/* + * Find item and if out of range then unhighlight and return. + * + * If the current item is unhighlighted then the user has aborted the + * notify, so unhighlight and return. + */ + + if ( ((CvtToItem(w, event->xbutton.x, event->xbutton.y, &item)) + == OUT_OF_RANGE) || (lw->list.highlight != item) ) { + XawListUnhighlight(w); + return; + } + + item_len = strlen(lw->list.list[item]); + + if ( lw->list.paste ) /* if XtNpasteBuffer set then paste it. */ + XStoreBytes(XtDisplay(w), lw->list.list[item], item_len); + +/* + * Call Callback function. + */ + + ret_value.string = lw->list.list[item]; + ret_value.list_index = item; + + XtCallCallbacks( w, XtNcallback, (XtPointer) &ret_value); +} + + +/* Unset() - ACTION + * + * unhighlights the current element. */ + +/* ARGSUSED */ +static void +Unset(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal *num_params; +{ + XawListUnhighlight(w); +} + + +/* Set() - ACTION + * + * Highlights the current element. */ + +/* ARGSUSED */ +static void +Set(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal *num_params; +{ + int item; + ListWidget lw = (ListWidget) w; + + if ( (CvtToItem(w, event->xbutton.x, event->xbutton.y, &item)) + == OUT_OF_RANGE) + XawListUnhighlight(w); /* Unhighlight current item. */ + else if ( lw->list.is_highlighted != item ) /* If this item is not */ + XawListHighlight(w, item); /* highlighted then do it. */ +} + +/* + * Set specified arguments into widget + */ + +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + ListWidget cl = (ListWidget) current; + ListWidget rl = (ListWidget) request; + ListWidget nl = (ListWidget) new; + Boolean redraw = FALSE; + XFontSetExtents *ext = XExtentsOfFontSet(nl->list.fontset); + + /* If the request height/width is different, lock it. Unless its 0. If */ + /* neither new nor 0, leave it as it was. Not in R5. */ + if ( nl->core.width != cl->core.width ) + nl->list.freedoms |= WidthLock; + if ( nl->core.width == 0 ) + nl->list.freedoms &= ~WidthLock; + + if ( nl->core.height != cl->core.height ) + nl->list.freedoms |= HeightLock; + if ( nl->core.height == 0 ) + nl->list.freedoms &= ~HeightLock; + + if ( nl->list.longest != cl->list.longest ) + nl->list.freedoms |= LongestLock; + if ( nl->list.longest == 0 ) + nl->list.freedoms &= ~LongestLock; + + /* _DONT_ check for fontset here - it's not in GC.*/ + + if ( (cl->list.foreground != nl->list.foreground) || + (cl->core.background_pixel != nl->core.background_pixel) || + (cl->list.font != nl->list.font) ) { + XGCValues values; + XGetGCValues(XtDisplay(current), cl->list.graygc, GCTile, &values); + XmuReleaseStippledPixmap(XtScreen(current), values.tile); + XtReleaseGC(current, cl->list.graygc); + XtReleaseGC(current, cl->list.revgc); + XtReleaseGC(current, cl->list.normgc); + GetGCs(new); + redraw = TRUE; + } + + if ( ( cl->list.font != nl->list.font ) && + ( cl->simple.international == False ) ) + nl->list.row_height = nl->list.font->max_bounds.ascent + + nl->list.font->max_bounds.descent + + nl->list.row_space; + + else if ( ( cl->list.fontset != nl->list.fontset ) && + ( cl->simple.international == True ) ) + nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space; + + /* ...If the above two font(set) change checkers above both failed, check + if row_space was altered. If one of the above passed, row_height will + already have been re-calculated. */ + + else if ( cl->list.row_space != nl->list.row_space ) { + + if (cl->simple.international == True ) + nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space; + else + nl->list.row_height = nl->list.font->max_bounds.ascent + + nl->list.font->max_bounds.descent + + nl->list.row_space; + } + + if ((cl->core.width != nl->core.width) || + (cl->core.height != nl->core.height) || + (cl->list.internal_width != nl->list.internal_width) || + (cl->list.internal_height != nl->list.internal_height) || + (cl->list.column_space != nl->list.column_space) || + (cl->list.row_space != nl->list.row_space) || + (cl->list.default_cols != nl->list.default_cols) || + ( (cl->list.force_cols != nl->list.force_cols) && + (rl->list.force_cols != nl->list.ncols) ) || + (cl->list.vertical_cols != nl->list.vertical_cols) || + (cl->list.longest != nl->list.longest) || + (cl->list.nitems != nl->list.nitems) || + (cl->list.font != nl->list.font) || + /* Equiv. fontsets might have different values, but the same fonts, so the + next comparison is sloppy but not dangerous. */ + (cl->list.fontset != nl->list.fontset) || + (cl->list.list != nl->list.list) ) { + + CalculatedValues( new ); + Layout( new, WidthFree( nl ), HeightFree( nl ), + &nl->core.width, &nl->core.height ); + redraw = TRUE; + } + + if (cl->list.list != nl->list.list) + nl->list.is_highlighted = nl->list.highlight = NO_HIGHLIGHT; + + if ((cl->core.sensitive != nl->core.sensitive) || + (cl->core.ancestor_sensitive != nl->core.ancestor_sensitive)) { + nl->list.highlight = NO_HIGHLIGHT; + redraw = TRUE; + } + + if (!XtIsRealized(current)) + return(FALSE); + + return(redraw); +} + +static void Destroy(w) + Widget w; +{ + ListWidget lw = (ListWidget) w; + XGCValues values; + + XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values); + XmuReleaseStippledPixmap(XtScreen(w), values.tile); + XtReleaseGC(w, lw->list.graygc); + XtReleaseGC(w, lw->list.revgc); + XtReleaseGC(w, lw->list.normgc); +} + +/* Exported Functions */ + +/* Function Name: XawListChange. + * Description: Changes the list being used and shown. + * Arguments: w - the list widget. + * list - the new list. + * nitems - the number of items in the list. + * longest - the length (in Pixels) of the longest element + * in the list. + * resize - if TRUE the the list widget will + * try to resize itself. + * Returns: none. + * NOTE: If nitems of longest are <= 0 then they will be calculated. + * If nitems is <= 0 then the list needs to be NULL terminated. + */ + +void +#if NeedFunctionPrototypes +XawListChange(Widget w, char ** list, int nitems, int longest, +#if NeedWidePrototypes + int resize_it) +#else + Boolean resize_it) +#endif +#else +XawListChange(w, list, nitems, longest, resize_it) +Widget w; +char ** list; +int nitems, longest; +Boolean resize_it; +#endif +{ + ListWidget lw = (ListWidget) w; + Dimension new_width = w->core.width; + Dimension new_height = w->core.height; + + lw->list.list = list; + + if ( nitems <= 0 ) nitems = 0; + lw->list.nitems = nitems; + if ( longest <= 0 ) longest = 0; + + /* If the user passes 0 meaning "calculate it", it must be free */ + if ( longest != 0 ) + lw->list.freedoms |= LongestLock; + else /* the user's word is god. */ + lw->list.freedoms &= ~LongestLock; + + if ( resize_it ) + lw->list.freedoms &= ~WidthLock & ~HeightLock; + /* else - still resize if its not locked */ + + lw->list.longest = longest; + + CalculatedValues( w ); + + if( Layout( w, WidthFree( w ), HeightFree( w ), + &new_width, &new_height ) ) + ChangeSize( w, new_width, new_height ); + + lw->list.is_highlighted = lw->list.highlight = NO_HIGHLIGHT; + if ( XtIsRealized( w ) ) + Redisplay( w, (XEvent *)NULL, (Region)NULL ); +} + +/* Function Name: XawListUnhighlight + * Description: unlights the current highlighted element. + * Arguments: w - the widget. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawListUnhighlight(Widget w) +#else +XawListUnhighlight(w) +Widget w; +#endif +{ + ListWidget lw = ( ListWidget ) w; + + lw->list.highlight = NO_HIGHLIGHT; + if (lw->list.is_highlighted != NO_HIGHLIGHT) + PaintItemName(w, lw->list.is_highlighted); /* unhighlight this one. */ +} + +/* Function Name: XawListHighlight + * Description: Highlights the given item. + * Arguments: w - the list widget. + * item - the item to hightlight. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawListHighlight(Widget w, int item) +#else +XawListHighlight(w, item) +Widget w; +int item; +#endif +{ + ListWidget lw = ( ListWidget ) w; + + if (XtIsSensitive(w)) { + lw->list.highlight = item; + if (lw->list.is_highlighted != NO_HIGHLIGHT) + PaintItemName(w, lw->list.is_highlighted); /* Unhighlight. */ + PaintItemName(w, item); /* HIGHLIGHT this one. */ + } +} + +/* Function Name: XawListShowCurrent + * Description: returns the currently highlighted object. + * Arguments: w - the list widget. + * Returns: the info about the currently highlighted object. + */ + +XawListReturnStruct * +#if NeedFunctionPrototypes +XawListShowCurrent(Widget w) +#else +XawListShowCurrent(w) +Widget w; +#endif +{ + ListWidget lw = ( ListWidget ) w; + XawListReturnStruct * ret_val; + + ret_val = (XawListReturnStruct *) + XtMalloc (sizeof (XawListReturnStruct));/* SPARE MALLOC OK */ + + ret_val->list_index = lw->list.highlight; + if (ret_val->list_index == XAW_LIST_NONE) + ret_val->string = ""; + else + ret_val->string = lw->list.list[ ret_val->list_index ]; + + return(ret_val); +} + diff --git a/vendor/x11iraf/xaw3d/List.h b/vendor/x11iraf/xaw3d/List.h new file mode 100644 index 00000000..c9c4ecc8 --- /dev/null +++ b/vendor/x11iraf/xaw3d/List.h @@ -0,0 +1,237 @@ +/* $XConsortium: List.h,v 1.22 94/04/17 20:12:17 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. +*/ + +/* This is the List widget, it is useful to display a list, without the + * overhead of having a widget for each item in the list. It allows + * the user to select an item in a list and notifies the application through + * a callback function. + * + * Created: 8/13/88 + * By: Chris D. Peterson + * MIT X Consortium + */ + +#ifndef _XawList_h +#define _XawList_h + +/*********************************************************************** + * + * List Widget + * + ***********************************************************************/ + +#include <X11/Xaw3d/Simple.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback XtCallbackList NULL **6 + columnSpacing Spacing Dimension 6 + cursor Cursor Cursor left_ptr + cursorName Cursor String NULL + defaultColumns Columns int 2 **5 + destroyCallback Callback Pointer NULL + font Font XFontStruct* XtDefaultFont + forceColumns Columns Boolean False **5 + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 0 **1 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + list List String * NULL **2 + longest Longest int 0 **3 **4 + mappedWhenManaged MappedWhenManaged Boolean True + numberStrings NumberStrings int 0 **4 + pasteBuffer Boolean Boolean False + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + rowSpacing Spacing Dimension 4 + sensitive Sensitive Boolean True + verticalList Boolean Boolean False + width Width Dimension 0 **1 + x Position Position 0 + y Position Position 0 + + **1 - If the Width or Height of the list widget is zero (0) then the value + is set to the minimum size necessay to fit the entire list. + + If both Width and Height are zero then they are adjusted to fit the + entire list that is created width the number of default columns + specified in the defaultColumns resource. + + **2 - This is an array of strings the specify elements of the list. + This resource must be specified. + (What good is a list widget without a list?? :-) + + **3 - Longest is the length of the widest string in pixels. + + **4 - If either of these values are zero (0) then the list widget calculates + the correct value. + + (This allows you to make startup faster if you already have + this information calculated) + + NOTE: If the numberStrings value is zero the list must + be NULL terminated. + + **5 - By setting the List.Columns resource you can force the application to + have a given number of columns. + + **6 - This returns the name and index of the item selected in an + XawListReturnStruct that is pointed to by the client_data + in the CallbackProc. + +*/ + + +/* + * Value returned when there are no highlighted objects. + */ + +#define XAW_LIST_NONE -1 + +#define XtCList "List" +#define XtCSpacing "Spacing" +#define XtCColumns "Columns" +#define XtCLongest "Longest" +#define XtCNumberStrings "NumberStrings" + +#define XtNcursor "cursor" +#define XtNcolumnSpacing "columnSpacing" +#define XtNdefaultColumns "defaultColumns" +#define XtNforceColumns "forceColumns" +#define XtNlist "list" +#define XtNlongest "longest" +#define XtNnumberStrings "numberStrings" +#define XtNpasteBuffer "pasteBuffer" +#define XtNrowSpacing "rowSpacing" +#define XtNverticalList "verticalList" + +#ifndef XtNfontSet +#define XtNfontSet "fontSet" +#endif + +#ifndef XtCFontSet +#define XtCFontSet "FontSet" +#endif + +/* Class record constants */ + +extern WidgetClass listWidgetClass; + +typedef struct _ListClassRec *ListWidgetClass; +typedef struct _ListRec *ListWidget; + +/* The list return structure. */ + +typedef struct _XawListReturnStruct { + String string; + int list_index; +} XawListReturnStruct; + +/****************************************************************** + * + * Exported Functions + * + *****************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawListChange. + * Description: Changes the list being used and shown. + * Arguments: w - the list widget. + * list - the new list. + * nitems - the number of items in the list. + * longest - the length (in Pixels) of the longest element + * in the list. + * resize - if TRUE the the list widget will + * try to resize itself. + * Returns: none. + * NOTE: If nitems of longest are <= 0 then they will be caluculated. + * If nitems is <= 0 then the list needs to be NULL terminated. + */ + +extern void XawListChange( +#if NeedFunctionPrototypes + Widget /* w */, + String* /* list */, + int /* nitems */, + int /* longest */, +#if NeedWidePrototypes + /* Boolean */ int /* resize */ +#else + Boolean /* resize */ +#endif +#endif +); + +/* Function Name: XawListUnhighlight + * Description: unlights the current highlighted element. + * Arguments: w - the widget. + * Returns: none. + */ + +extern void XawListUnhighlight( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawListHighlight + * Description: Highlights the given item. + * Arguments: w - the list widget. + * item - the item to highlight. + * Returns: none. + */ + +extern void XawListHighlight( +#if NeedFunctionPrototypes + Widget /* w */, + int /* item */ +#endif +); + + +/* Function Name: XawListShowCurrent + * Description: returns the currently highlighted object. + * Arguments: w - the list widget. + * Returns: the info about the currently highlighted object. + */ + +extern XawListReturnStruct * XawListShowCurrent( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawList_h */ diff --git a/vendor/x11iraf/xaw3d/ListP.h b/vendor/x11iraf/xaw3d/ListP.h new file mode 100644 index 00000000..d53165ee --- /dev/null +++ b/vendor/x11iraf/xaw3d/ListP.h @@ -0,0 +1,116 @@ +/* $XConsortium: ListP.h,v 1.14 94/04/17 20:12:17 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. +*/ + + +/* + * ListP.h - Private definitions for List widget + * + * This is a List widget. It allows the user to select an item in a list and + * notifies the application through a callback function. + * + * Created: 8/13/88 + * By: Chris D. Peterson + * MIT - Project Athena + */ + +#ifndef _XawListP_h +#define _XawListP_h + +/*********************************************************************** + * + * List Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/SimpleP.h> +#include <X11/Xaw3d/List.h> + +#define NO_HIGHLIGHT XAW_LIST_NONE +#define OUT_OF_RANGE -1 +#define OKAY 0 + +/* New fields for the List widget class record */ + +typedef struct {int foo;} ListClassPart; + +/* Full class record declaration */ +typedef struct _ListClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ListClassPart list_class; +} ListClassRec; + +extern ListClassRec listClassRec; + +/* New fields for the List widget record */ +typedef struct { + /* resources */ + Pixel foreground; + Dimension internal_width, /* if not 3d, user sets directly. */ + internal_height, + column_space, /* half of *_space is add on top/bot/left of*/ + row_space; /* each item's text bounding box. half added to longest for right */ + int default_cols; + Boolean force_cols, + paste, + vertical_cols; + int longest; /* in pixels */ + int nitems; /* number of items in the list. */ + XFontStruct *font; + XFontSet fontset; /* Sheeran, Omron KK, 93/03/05 */ + String * list; /* for i18n, always in multibyte format */ + XtCallbackList callback; + + /* private state */ + int is_highlighted, /* set to the item currently highlighted. */ + highlight, /* set to the item that should be highlighted.*/ + col_width, /* width of each column. */ + row_height, /* height of each row. */ + nrows, /* number of rows in the list. */ + ncols; /* number of columns in the list. */ + GC normgc, /* a couple of GC's. */ + revgc, + graygc; /* used when inactive. */ + + int freedoms; /* flags for resizing height and width */ + +} ListPart; + + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _ListRec { + CorePart core; + SimplePart simple; + ListPart list; +} ListRec; + +#endif /* _XawListP_h */ diff --git a/vendor/x11iraf/xaw3d/MenuButtoP.h b/vendor/x11iraf/xaw3d/MenuButtoP.h new file mode 100644 index 00000000..df2f9dd9 --- /dev/null +++ b/vendor/x11iraf/xaw3d/MenuButtoP.h @@ -0,0 +1,102 @@ +/* $XConsortium: MenuButtoP.h,v 1.8 94/04/17 20:12:18 converse Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/*********************************************************************** + * + * MenuButton Widget + * + ***********************************************************************/ + +/* + * MenuButtonP.h - Private Header file for MenuButton widget. + * + * This is the private header file for the Athena MenuButton widget. + * It is intended to provide an easy method of activating pulldown menus. + * + * Date: May 2, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawMenuButtonP_h +#define _XawMenuButtonP_h + +#include <X11/Xaw3d/MenuButton.h> +#include <X11/Xaw3d/CommandP.h> + +/************************************ + * + * Class structure + * + ***********************************/ + + + /* New fields for the MenuButton widget class record */ +typedef struct _MenuButtonClass +{ + int makes_compiler_happy; /* not used */ +} MenuButtonClassPart; + + /* Full class record declaration */ +typedef struct _MenuButtonClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + LabelClassPart label_class; + CommandClassPart command_class; + MenuButtonClassPart menuButton_class; +} MenuButtonClassRec; + +extern MenuButtonClassRec menuButtonClassRec; + +/*************************************** + * + * Instance (widget) structure + * + **************************************/ + + /* New fields for the MenuButton widget record */ +typedef struct { + /* resources */ + String menu_name; + +} MenuButtonPart; + + /* Full widget declaration */ +typedef struct _MenuButtonRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + LabelPart label; + CommandPart command; + MenuButtonPart menu_button; +} MenuButtonRec; + +#endif /* _XawMenuButtonP_h */ + + diff --git a/vendor/x11iraf/xaw3d/MenuButton.c b/vendor/x11iraf/xaw3d/MenuButton.c new file mode 100644 index 00000000..b96a027e --- /dev/null +++ b/vendor/x11iraf/xaw3d/MenuButton.c @@ -0,0 +1,221 @@ +/* $XConsortium: MenuButton.c,v 1.21 95/06/26 20:35:12 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + */ + + +/*********************************************************************** + * + * MenuButton Widget + * + ***********************************************************************/ + +/* + * MenuButton.c - Source code for MenuButton widget. + * + * This is the source code for the Athena MenuButton widget. + * It is intended to provide an easy method of activating pulldown menus. + * + * Date: May 2, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/MenuButtoP.h> + +static void ClassInitialize(); +static void PopupMenu(); + +#define superclass ((CommandWidgetClass)&commandClassRec) + +static char defaultTranslations[] = +"<EnterWindow>: highlight()\n\ + <LeaveWindow>: reset()\n\ + Any<BtnDown>: reset() PopupMenu()"; + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +#define offset(field) XtOffsetOf(MenuButtonRec, field) +static XtResource resources[] = { + { + XtNmenuName, XtCMenuName, XtRString, sizeof(String), + offset(menu_button.menu_name), XtRString, (XtPointer)"menu"}, +}; +#undef offset + +static XtActionsRec actionsList[] = +{ + {"PopupMenu", PopupMenu} +}; + +MenuButtonClassRec menuButtonClassRec = { + { + (WidgetClass) superclass, /* superclass */ + "MenuButton", /* class_name */ + sizeof(MenuButtonRec), /* size */ + ClassInitialize, /* class_initialize */ + NULL, /* class_part_initialize */ + FALSE, /* class_inited */ + NULL, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* resource_count */ + NULLQUARK, /* xrm_class */ + FALSE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + NULL, /* destroy */ + XtInheritResize, /* resize */ + XtInheritExpose, /* expose */ + NULL, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + }, /* CoreClass fields initialization */ + { + XtInheritChangeSensitive /* change_sensitive */ + }, /* SimpleClass fields initialization */ + { + XtInheritXaw3dShadowDraw, /* shadowdraw */ + }, /* ThreeDClass fields initialization */ + { + 0, /* field not used */ + }, /* LabelClass fields initialization */ + { + 0, /* field not used */ + }, /* CommandClass fields initialization */ + { + 0, /* field not used */ + } /* MenuButtonClass fields initialization */ +}; + + /* for public consumption */ +WidgetClass menuButtonWidgetClass = (WidgetClass) &menuButtonClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtRegisterGrabAction(PopupMenu, True, + (unsigned int)(ButtonPressMask | ButtonReleaseMask), + GrabModeAsync, GrabModeAsync); +} + +/* ARGSUSED */ +static void +PopupMenu(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + MenuButtonWidget mbw = (MenuButtonWidget) w; + Widget menu = NULL, temp; + Arg arglist[2]; + Cardinal num_args; + int menu_x, menu_y, menu_width, menu_height, button_height; + Position button_x, button_y; + + temp = w; + while(temp != NULL) { + menu = XtNameToWidget(temp, mbw->menu_button.menu_name); + if (menu == NULL) + temp = XtParent(temp); + else + break; + } + + if (menu == NULL) { + char error_buf[BUFSIZ]; + (void) sprintf(error_buf, "MenuButton: %s %s.", + "Could not find menu widget named", mbw->menu_button.menu_name); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + if (!XtIsRealized(menu)) + XtRealizeWidget(menu); + + menu_width = menu->core.width + 2 * menu->core.border_width; + button_height = w->core.height + 2 * w->core.border_width; + menu_height = menu->core.height + 2 * menu->core.border_width; + + XtTranslateCoords(w, 0, 0, &button_x, &button_y); + menu_x = button_x; + menu_y = button_y + button_height; + + if (menu_x >= 0) { + int scr_width = WidthOfScreen(XtScreen(menu)); + if (menu_x + menu_width > scr_width) + menu_x = scr_width - menu_width; + } + if (menu_x < 0) + menu_x = 0; + + if (menu_y >= 0) { + int scr_height = HeightOfScreen(XtScreen(menu)); + if (menu_y + menu_height > scr_height) + menu_y = scr_height - menu_height; + } + if (menu_y < 0) + menu_y = 0; + + num_args = 0; + XtSetArg(arglist[num_args], XtNx, menu_x); num_args++; + XtSetArg(arglist[num_args], XtNy, menu_y); num_args++; + XtSetValues(menu, arglist, num_args); + + XtPopupSpringLoaded(menu); +} + diff --git a/vendor/x11iraf/xaw3d/MenuButton.h b/vendor/x11iraf/xaw3d/MenuButton.h new file mode 100644 index 00000000..c9ee0dfb --- /dev/null +++ b/vendor/x11iraf/xaw3d/MenuButton.h @@ -0,0 +1,90 @@ +/* + * $XConsortium: MenuButton.h,v 1.9 94/04/17 20:12:21 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/*********************************************************************** + * + * MenuButton Widget + * + ***********************************************************************/ + +/* + * MenuButton.h - Public Header file for MenuButton widget. + * + * This is the public header file for the Athena MenuButton widget. + * It is intended to provide an easy method of activating pulldown menus. + * + * Date: May 2, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawMenuButton_h +#define _XawMenuButton_h + +#include <X11/Xaw3d/Command.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback Pointer NULL + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + font Font XFontStruct* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + highlightThickness Thickness Dimension 2 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + mappedWhenManaged MappedWhenManaged Boolean True + menuName MenuName String "menu" + resize Resize Boolean True + sensitive Sensitive Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNmenuName "menuName" +#define XtCMenuName "MenuName" + +extern WidgetClass menuButtonWidgetClass; + +typedef struct _MenuButtonClassRec *MenuButtonWidgetClass; +typedef struct _MenuButtonRec *MenuButtonWidget; + +#endif /* _XawMenuButton_h */ diff --git a/vendor/x11iraf/xaw3d/MultiSink.c b/vendor/x11iraf/xaw3d/MultiSink.c new file mode 100644 index 00000000..12ef85cf --- /dev/null +++ b/vendor/x11iraf/xaw3d/MultiSink.c @@ -0,0 +1,780 @@ +/* $XConsortium: MultiSink.c,v 1.6 95/01/23 18:34:46 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of OMRON not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. OMRON makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Li Yuhong OMRON Corporation + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xatom.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/MultiSinkP.h> +#include <X11/Xaw3d/MultiSrcP.h> +#include <X11/Xaw3d/TextP.h> +#include "XawI18n.h" +#include <stdio.h> +#include <ctype.h> + +#ifdef GETLASTPOS +#undef GETLASTPOS /* We will use our own GETLASTPOS. */ +#endif + +#define GETLASTPOS XawTextSourceScan(source, (XawTextPosition) 0, XawstAll, XawsdRight, 1, TRUE) + +static void Initialize(), Destroy(); +static Boolean SetValues(); +static int MaxLines(), MaxHeight(); +static void SetTabs(); + +static void DisplayText(), InsertCursor(), FindPosition(); +static void FindDistance(), Resolve(), GetCursorBounds(); + +#define offset(field) XtOffsetOf(MultiSinkRec, multi_sink.field) + +static XtResource resources[] = { + {XtNfontSet, XtCFontSet, XtRFontSet, sizeof (XFontSet), + offset(fontset), XtRString, XtDefaultFontSet}, + {XtNecho, XtCOutput, XtRBoolean, sizeof(Boolean), + offset(echo), XtRImmediate, (XtPointer) True}, + {XtNdisplayNonprinting, XtCOutput, XtRBoolean, sizeof(Boolean), + offset(display_nonprinting), XtRImmediate, (XtPointer) True}, +}; +#undef offset + +#define SuperClass (&textSinkClassRec) +MultiSinkClassRec multiSinkClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "MultiSink", + /* widget_size */ sizeof(MultiSinkRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* obj1 */ NULL, + /* obj2 */ NULL, + /* obj3 */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* obj4 */ FALSE, + /* obj5 */ FALSE, + /* obj6 */ FALSE, + /* obj7 */ FALSE, + /* destroy */ Destroy, + /* obj8 */ NULL, + /* obj9 */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* obj10 */ NULL, + /* get_values_hook */ NULL, + /* obj11 */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* obj12 */ NULL, + /* obj13 */ NULL, + /* obj14 */ NULL, + /* extension */ NULL + }, + { /* text_sink_class fields */ + /* DisplayText */ DisplayText, + /* InsertCursor */ InsertCursor, + /* ClearToBackground */ XtInheritClearToBackground, + /* FindPosition */ FindPosition, + /* FindDistance */ FindDistance, + /* Resolve */ Resolve, + /* MaxLines */ MaxLines, + /* MaxHeight */ MaxHeight, + /* SetTabs */ SetTabs, + /* GetCursorBounds */ GetCursorBounds + }, + { /* multi_sink_class fields */ + /* unused */ 0 + } +}; + +WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec; + +/* Utilities */ + +static int +#if NeedFunctionPrototypes +CharWidth ( + Widget w, + int x, + wchar_t c) +#else +CharWidth (w, x, c) + Widget w; + int x; + wchar_t c; +#endif +{ + int i, width; + MultiSinkObject sink = (MultiSinkObject) w; + XFontSet fontset = sink->multi_sink.fontset; + Position *tab; + + if ( c == _Xaw_atowc(XawLF) ) return(0); + + if (c == _Xaw_atowc(XawTAB)) { + /* Adjust for Left Margin. */ + x -= ((TextWidget) XtParent(w))->text.margin.left; + + if (x >= (int)XtParent(w)->core.width) return 0; + for (i = 0, tab = sink->text_sink.tabs ; + i < sink->text_sink.tab_count ; i++, tab++) { + if (x < *tab) { + if (*tab < (int)XtParent(w)->core.width) + return *tab - x; + else + return 0; + } + } + return 0; + } + + if (XwcTextEscapement (fontset, &c, 1) == 0) + if (sink->multi_sink.display_nonprinting) + c = _Xaw_atowc('@'); + else { + c = _Xaw_atowc(XawSP); + } + + /* + * if more efficiency(suppose one column is one ASCII char) + + width = XwcGetColumn(fontset->font_charset, fontset->num_of_fonts, c) * + fontset->font_struct_list[0]->min_bounds.width; + * + * WARNING: Very Slower!!! + * + * Li Yuhong. + */ + + width = XwcTextEscapement(fontset, &c, 1); + + return width; +} + +/* Function Name: PaintText + * Description: Actually paints the text into the windoe. + * Arguments: w - the text widget. + * gc - gc to paint text with. + * x, y - location to paint the text. + * buf, len - buffer and length of text to paint. + * Returns: the width of the text painted, or 0. + * + * NOTE: If this string attempts to paint past the end of the window + * then this function will return zero. + */ + +static Dimension +PaintText(w, gc, x, y, buf, len) + Widget w; + GC gc; + Position x, y; + wchar_t* buf; + int len; +{ + MultiSinkObject sink = (MultiSinkObject) w; + TextWidget ctx = (TextWidget) XtParent(w); + + XFontSet fontset = sink->multi_sink.fontset; + Position max_x; + Dimension width = XwcTextEscapement(fontset, buf, len); + XFontSetExtents *ext = XExtentsOfFontSet(fontset); + max_x = (Position) ctx->core.width; + + if ( ((int) width) <= -x) /* Don't draw if we can't see it. */ + return(width); + + XwcDrawImageString(XtDisplay(ctx), XtWindow(ctx), fontset, gc, + (int) x, (int) y, buf, len); + if ( (((Position) width + x) > max_x) && (ctx->text.margin.right != 0) ) { + x = ctx->core.width - ctx->text.margin.right; + width = ctx->text.margin.right; + XFillRectangle(XtDisplay((Widget) ctx), XtWindow( (Widget) ctx), + sink->multi_sink.normgc, (int) x, + (int) y - abs(ext->max_logical_extent.y), + (unsigned int) width, + (unsigned int) ext->max_logical_extent.height); + return(0); + } + return(width); +} + +/* Sink Object Functions */ + +/* + * This function does not know about drawing more than one line of text. + */ + +static void +DisplayText(w, x, y, pos1, pos2, highlight) + Widget w; + Position x, y; + Boolean highlight; + XawTextPosition pos1, pos2; +{ + MultiSinkObject sink = (MultiSinkObject) w; + Widget source = XawTextGetSource(XtParent(w)); + wchar_t buf[BUFSIZ]; + XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); + + int j, k; + XawTextBlock blk; + GC gc = highlight ? sink->multi_sink.invgc : sink->multi_sink.normgc; + GC invgc = highlight ? sink->multi_sink.normgc : sink->multi_sink.invgc; + + if (!sink->multi_sink.echo) return; + + y += abs(ext->max_logical_extent.y); + for ( j = 0 ; pos1 < pos2 ; ) { + pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1); + for (k = 0; k < blk.length; k++) { + if (j >= BUFSIZ) { /* buffer full, dump the text. */ + x += PaintText(w, gc, x, y, buf, j); + j = 0; + } + buf[j] = ((wchar_t *)blk.ptr)[k]; + if (buf[j] == _Xaw_atowc(XawLF)) + continue; + + else if (buf[j] == _Xaw_atowc(XawTAB)) { + Position temp = 0; + Dimension width; + + if ((j != 0) && ((temp = PaintText(w, gc, x, y, buf, j)) == 0)) + return; + + x += temp; + width = CharWidth(w, x, _Xaw_atowc(XawTAB)); + XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), + invgc, (int) x, + (int) y - abs(ext->max_logical_extent.y), + (unsigned int)width, + (unsigned int)ext->max_logical_extent.height); + x += width; + j = -1; + } + else if (XwcTextEscapement (sink->multi_sink.fontset, &buf[j], 1) == 0) { + if (sink->multi_sink.display_nonprinting) + buf[j] = _Xaw_atowc('@'); + else + buf[j] = _Xaw_atowc(' '); + } + j++; + } + } + if (j > 0) + (void) PaintText(w, gc, x, y, buf, j); +} + +#define insertCursor_width 6 +#define insertCursor_height 3 +static char insertCursor_bits[] = {0x0c, 0x1e, 0x33}; + +static Pixmap +CreateInsertCursor(s) + Screen *s; +{ + return (XCreateBitmapFromData (DisplayOfScreen(s), RootWindowOfScreen(s), + insertCursor_bits, insertCursor_width, insertCursor_height)); +} + +/* Function Name: GetCursorBounds + * Description: Returns the size and location of the cursor. + * Arguments: w - the text object. + * RETURNED rect - an X rectangle to return the cursor bounds in. + * Returns: none. + */ + +static void +GetCursorBounds(w, rect) + Widget w; + XRectangle * rect; +{ + MultiSinkObject sink = (MultiSinkObject) w; + + rect->width = (unsigned short) insertCursor_width; + rect->height = (unsigned short) insertCursor_height; + rect->x = sink->multi_sink.cursor_x - (short) (rect->width / 2); + rect->y = sink->multi_sink.cursor_y - (short) rect->height; +} + +/* + * The following procedure manages the "insert" cursor. + */ + +static void +InsertCursor (w, x, y, state) + Widget w; + Position x, y; + XawTextInsertState state; +{ + MultiSinkObject sink = (MultiSinkObject) w; + Widget text_widget = XtParent(w); + XRectangle rect; + + sink->multi_sink.cursor_x = x; + sink->multi_sink.cursor_y = y; + + GetCursorBounds(w, &rect); + if (state != sink->multi_sink.laststate && XtIsRealized(text_widget)) + XCopyPlane(XtDisplay(text_widget), + sink->multi_sink.insertCursorOn, + XtWindow(text_widget), sink->multi_sink.xorgc, + 0, 0, (unsigned int) rect.width, (unsigned int) rect.height, + (int) rect.x, (int) rect.y, 1); + sink->multi_sink.laststate = state; +} + +/* + * Given two positions, find the distance between them. + */ + +static void +FindDistance (w, fromPos, fromx, toPos, resWidth, resPos, resHeight) + Widget w; + XawTextPosition fromPos; /* First position. */ + int fromx; /* Horizontal location of first position. */ + XawTextPosition toPos; /* Second position. */ + int* resWidth; /* Distance between fromPos and resPos. */ + XawTextPosition* resPos; /* Actual second position used. */ + int* resHeight; /* Height required. */ +{ + MultiSinkObject sink = (MultiSinkObject) w; + Widget source = XawTextGetSource(XtParent(w)); + + XawTextPosition index, lastPos; + wchar_t c; + XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); + XawTextBlock blk; + + /* we may not need this */ + lastPos = GETLASTPOS; + XawTextSourceRead(source, fromPos, &blk, (int) toPos - fromPos); + *resWidth = 0; + for (index = fromPos; index != toPos && index < lastPos; index++) { + if (index - blk.firstPos >= blk.length) + XawTextSourceRead(source, index, &blk, (int) toPos - fromPos); + c = ((wchar_t *)blk.ptr)[index - blk.firstPos]; + *resWidth += CharWidth(w, fromx + *resWidth, c); + if (c == _Xaw_atowc(XawLF)) { + index++; + break; + } + } + *resPos = index; + *resHeight = ext->max_logical_extent.height; +} + + +static void +FindPosition(w, fromPos, fromx, width, stopAtWordBreak, resPos, resWidth, resHeight) + Widget w; + XawTextPosition fromPos; /* Starting position. */ + int fromx; /* Horizontal location of starting position.*/ + int width; /* Desired width. */ + int stopAtWordBreak; /* Whether the resulting position should be at + a word break. */ + XawTextPosition *resPos; /* Resulting position. */ + int* resWidth; /* Actual width used. */ + int* resHeight; /* Height required. */ +{ + MultiSinkObject sink = (MultiSinkObject) w; + Widget source = XawTextGetSource(XtParent(w)); + + XawTextPosition lastPos, index, whiteSpacePosition = 0; + int lastWidth = 0, whiteSpaceWidth = 0; + Boolean whiteSpaceSeen; + wchar_t c; + XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); + XawTextBlock blk; + + lastPos = GETLASTPOS; + + XawTextSourceRead(source, fromPos, &blk, BUFSIZ); + *resWidth = 0; + whiteSpaceSeen = FALSE; + c = 0; + for (index = fromPos; *resWidth <= width && index < lastPos; index++) { + lastWidth = *resWidth; + if (index - blk.firstPos >= blk.length) + XawTextSourceRead(source, index, &blk, BUFSIZ); + c = ((wchar_t *)blk.ptr)[index - blk.firstPos]; + *resWidth += CharWidth(w, fromx + *resWidth, c); + + if ((c == _Xaw_atowc(XawSP) || c == _Xaw_atowc(XawTAB)) && + *resWidth <= width) { + whiteSpaceSeen = TRUE; + whiteSpacePosition = index; + whiteSpaceWidth = *resWidth; + } + if (c == _Xaw_atowc(XawLF)) { + index++; + break; + } + } + if (*resWidth > width && index > fromPos) { + *resWidth = lastWidth; + index--; + if (stopAtWordBreak && whiteSpaceSeen) { + index = whiteSpacePosition + 1; + *resWidth = whiteSpaceWidth; + } + } + if (index == lastPos && c != _Xaw_atowc(XawLF)) index = lastPos + 1; + *resPos = index; + *resHeight = ext->max_logical_extent.height; +} + +static void +Resolve (w, pos, fromx, width, leftPos, rightPos) + Widget w; + XawTextPosition pos; + int fromx, width; + XawTextPosition *leftPos, *rightPos; +{ + int resWidth, resHeight; + Widget source = XawTextGetSource(XtParent(w)); + + FindPosition(w, pos, fromx, width, FALSE, leftPos, &resWidth, &resHeight); + if (*leftPos > GETLASTPOS) + *leftPos = GETLASTPOS; + *rightPos = *leftPos; +} + +static void +GetGC(sink) + MultiSinkObject sink; +{ + XtGCMask valuemask = (GCGraphicsExposures | GCForeground | GCBackground ); + XGCValues values; + + values.graphics_exposures = (Bool) FALSE; + + values.foreground = sink->text_sink.foreground; + values.background = sink->text_sink.background; + + sink->multi_sink.normgc = XtAllocateGC( (Widget)sink, 0, valuemask, &values, GCFont, 0 ); + + values.foreground = sink->text_sink.background; + values.background = sink->text_sink.foreground; + sink->multi_sink.invgc = XtAllocateGC( (Widget)sink, 0, valuemask, &values, GCFont, 0 ); + + values.function = GXxor; + values.background = (unsigned long) 0L; /* (pix ^ 0) = pix */ + values.foreground = (sink->text_sink.background ^ + sink->text_sink.foreground); + valuemask = GCGraphicsExposures | GCFunction | GCForeground | GCBackground; + + /* if this GC is not used for fontset rendering then AllocateGC aint needed. Dont hurt tho.*/ + sink->multi_sink.xorgc = XtAllocateGC( (Widget)sink, 0, valuemask, &values, GCFont, 0 ); +} + + +/***** Public routines *****/ + +/* Function Name: Initialize + * Description: Initializes the TextSink Object. + * Arguments: request, new - the requested and new values for the object + * instance. + * Returns: none. + * + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal* num_args; +{ + MultiSinkObject sink = (MultiSinkObject) new; + + GetGC(sink); + + sink->multi_sink.insertCursorOn= CreateInsertCursor(XtScreenOfObject(new)); + sink->multi_sink.laststate = XawisOff; + sink->multi_sink.cursor_x = sink->multi_sink.cursor_y = 0; +} + +/* Function Name: Destroy + * Description: This function cleans up when the object is + * destroyed. + * Arguments: w - the MultiSink Object. + * Returns: none. + */ + +static void +Destroy(w) + Widget w; +{ + MultiSinkObject sink = (MultiSinkObject) w; + + XtReleaseGC(w, sink->multi_sink.normgc); + XtReleaseGC(w, sink->multi_sink.invgc); + XtReleaseGC(w, sink->multi_sink.xorgc); + + XFreePixmap(XtDisplayOfObject(w), sink->multi_sink.insertCursorOn); +} + +/* Function Name: SetValues + * Description: Sets the values for the MultiSink + * Arguments: current - current state of the object. + * request - what was requested. + * new - what the object will become. + * Returns: True if redisplay is needed. + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal* num_args; +{ + MultiSinkObject w = (MultiSinkObject) new; + MultiSinkObject old_w = (MultiSinkObject) current; + + /* Font set is not in the GC! Do not make a new GC when font set changes! */ + + if ( w->multi_sink.fontset != old_w->multi_sink.fontset ) { + ((TextWidget)XtParent(new))->text.redisplay_needed = True; +#ifndef NO_TAB_FIX + SetTabs( w, w->text_sink.tab_count, w->text_sink.char_tabs ); +#endif + } + + if ( w->text_sink.background != old_w->text_sink.background || + w->text_sink.foreground != old_w->text_sink.foreground ) { + + XtReleaseGC((Widget)w, w->multi_sink.normgc); + XtReleaseGC((Widget)w, w->multi_sink.invgc); + XtReleaseGC((Widget)w, w->multi_sink.xorgc); + GetGC(w); + ((TextWidget)XtParent(new))->text.redisplay_needed = True; + } else { + if ( (w->multi_sink.echo != old_w->multi_sink.echo) || + (w->multi_sink.display_nonprinting != + old_w->multi_sink.display_nonprinting) ) + ((TextWidget)XtParent(new))->text.redisplay_needed = True; + } + + return False; +} + +/* Function Name: MaxLines + * Description: Finds the Maximum number of lines that will fit in + * a given height. + * Arguments: w - the MultiSink Object. + * height - height to fit lines into. + * Returns: the number of lines that will fit. + */ + +/* ARGSUSED */ +static int +MaxLines(w, height) + Widget w; + Dimension height; +{ + MultiSinkObject sink = (MultiSinkObject) w; + int font_height; + XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); + + font_height = ext->max_logical_extent.height; + return( ((int) height) / font_height ); +} + +/* Function Name: MaxHeight + * Description: Finds the Minium height that will contain a given number + * lines. + * Arguments: w - the MultiSink Object. + * lines - the number of lines. + * Returns: the height. + */ + +/* ARGSUSED */ +static int +#if NeedFunctionPrototypes +MaxHeight( + Widget w, + int lines ) +#else +MaxHeight( w, lines ) + Widget w; + int lines; +#endif +{ + MultiSinkObject sink = (MultiSinkObject) w; + XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset); + + return(lines * ext->max_logical_extent.height); +} + +/* Function Name: SetTabs + * Description: Sets the Tab stops. + * Arguments: w - the MultiSink Object. + * tab_count - the number of tabs in the list. + * tabs - the text positions of the tabs. + * Returns: none + */ + +static void +#if NeedFunctionPrototypes +SetTabs( + Widget w, + int tab_count, + short* tabs ) +#else +SetTabs( w, tab_count, tabs ) + Widget w; + int tab_count; + short* tabs; +#endif +{ + MultiSinkObject sink = (MultiSinkObject) w; + int i; + Atom XA_FIGURE_WIDTH; + unsigned long figure_width = 0; + XFontStruct *font; + + /* + * Bug: + * Suppose the first font of fontset stores the unit of column. + * + * By Li Yuhong, Mar. 14, 1991 + */ + { XFontStruct **f_list; + char **f_name; + + (void) XFontsOfFontSet(sink->multi_sink.fontset, &f_list, &f_name); + font = f_list[0]; + } + +/* + * Find the figure width of the current font. + */ + + XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE); + if ( (XA_FIGURE_WIDTH != None) && + ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) || + (figure_width == 0)) ) + if (font->per_char && font->min_char_or_byte2 <= '$' && + font->max_char_or_byte2 >= '$') + figure_width = font->per_char['$' - font->min_char_or_byte2].width; + else + figure_width = font->max_bounds.width; + + if (tab_count > sink->text_sink.tab_count) { + sink->text_sink.tabs = (Position *) + XtRealloc((char *) sink->text_sink.tabs, + (Cardinal) (tab_count * sizeof(Position))); + sink->text_sink.char_tabs = (short *) + XtRealloc((char *) sink->text_sink.char_tabs, + (Cardinal) (tab_count * sizeof(short))); + } + + for ( i = 0 ; i < tab_count ; i++ ) { + sink->text_sink.tabs[i] = tabs[i] * figure_width; + sink->text_sink.char_tabs[i] = tabs[i]; + } + + sink->text_sink.tab_count = tab_count; + +#ifndef NO_TAB_FIX + ((TextWidget)XtParent(w))->text.redisplay_needed = True; +#endif +} + +void +#if NeedFunctionPrototypes +_XawMultiSinkPosToXY( + Widget w, + XawTextPosition pos, + Position *x, + Position *y ) +#else +_XawMultiSinkPosToXY( w, pos, x, y ) + Widget w; + XawTextPosition pos; + Position *x, *y; +#endif +{ + MultiSinkObject sink = (MultiSinkObject) ((TextWidget)w)->text.sink; + XFontSetExtents *ext = XExtentsOfFontSet( sink->multi_sink.fontset ); + + _XawTextPosToXY( w, pos, x, y ); + *y += abs( ext->max_logical_extent.y ); +} diff --git a/vendor/x11iraf/xaw3d/MultiSink.h b/vendor/x11iraf/xaw3d/MultiSink.h new file mode 100644 index 00000000..9cb73006 --- /dev/null +++ b/vendor/x11iraf/xaw3d/MultiSink.h @@ -0,0 +1,118 @@ +/* $XConsortium: MultiSink.h,v 1.2 94/04/17 20:12:23 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name OMRON is not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Li Yuhong OMRON Corporation + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawMultiSink_h +#define _XawMultiSink_h + +/*********************************************************************** + * + * MultiSink Object + * + ***********************************************************************/ + +#include <X11/Xaw3d/TextSink.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + echo Output Boolean True + displayNonprinting Output Boolean True + fontSet FontSet XFontSet XtDefaultFontSet + +*/ + +#define XtCOutput "Output" + +#define XtNdisplayNonprinting "displayNonprinting" +#define XtNecho "echo" + +#ifndef XtNfontSet /*Sheeran, Omron KK, 93/03/04*/ +#define XtNfontSet "fontSet" +#endif + +#ifndef XtCFontSet /*Sheeran, Omron KK, 93/03/04*/ +#define XtCFontSet "FontSet" +#endif + +/* Class record constants */ + +extern WidgetClass multiSinkObjectClass; + +typedef struct _MultiSinkClassRec *MultiSinkObjectClass; +typedef struct _MultiSinkRec *MultiSinkObject; + + +#endif /* _XawMultiSrc_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/xaw3d/MultiSinkP.h b/vendor/x11iraf/xaw3d/MultiSinkP.h new file mode 100644 index 00000000..1e13914b --- /dev/null +++ b/vendor/x11iraf/xaw3d/MultiSinkP.h @@ -0,0 +1,157 @@ +/* $XConsortium: MultiSinkP.h,v 1.2 94/04/17 20:12:24 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name OMRON not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON make no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Li Yuhong OMRON Corporation + */ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * multiSinkP.h - Private definitions for multiSink object + * + */ + +#ifndef _XawMultiSinkP_h +#define _XawMultiSinkP_h + +/*********************************************************************** + * + * MultiSink Object Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/TextSinkP.h> +#include <X11/Xaw3d/MultiSink.h> + +/************************************************************ + * + * New fields for the MultiSink object class record. + * + ************************************************************/ + +typedef struct _MultiSinkClassPart { + int foo; +} MultiSinkClassPart; + +/* Full class record declaration */ + +typedef struct _MultiSinkClassRec { + ObjectClassPart object_class; + TextSinkClassPart text_sink_class; + MultiSinkClassPart multi_sink_class; +} MultiSinkClassRec; + +extern MultiSinkClassRec multiSinkClassRec; + +/* New fields for the MultiSink object record */ +typedef struct { + /* public resources */ + Boolean echo; + Boolean display_nonprinting; + + /* private state */ + GC normgc, invgc, xorgc; + Pixmap insertCursorOn; + XawTextInsertState laststate; + short cursor_x, cursor_y; /* Cursor Location. */ + XFontSet fontset; /* font set to draw */ +} MultiSinkPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _MultiSinkRec { + ObjectPart object; + TextSinkPart text_sink; + MultiSinkPart multi_sink; +} MultiSinkRec; + + +/******************************************** + * + * Semi-private functions + * for use by other Xaw modules only + * + *******************************************/ + +extern void _XawMultiSinkPosToXY( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* pos */, + Position * /* x */, + Position * /*y */ +#endif +); + +#endif /* _XawMultiSinkP_h */ + diff --git a/vendor/x11iraf/xaw3d/MultiSrc.c b/vendor/x11iraf/xaw3d/MultiSrc.c new file mode 100644 index 00000000..e89737c5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/MultiSrc.c @@ -0,0 +1,1460 @@ +/* $XConsortium: MultiSrc.c,v 1.8 95/01/24 22:29:08 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name OMRON not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Chris Peterson MIT X Consortium + * Li Yuhong OMRON Corporation + * Frank Sheeran OMRON Corporation + * + * Much code taken from X11R3 String and Disk Sources. + */ + +/* + +Copyright (c) 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* + * MultiSrc.c - MultiSrc object. (For use with the text widget). + * + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xfuncs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/MultiSrcP.h> +#include <X11/Xaw3d/XawImP.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/CharSet.h> +#include "XawI18n.h" +#include <X11/Xos.h> +#include <stdio.h> +#include <ctype.h> +#include <errno.h> + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +static int magic_value = MAGIC_VALUE; + +#define offset(field) XtOffsetOf(MultiSrcRec, multi_src.field) + +static XtResource resources[] = { + {XtNstring, XtCString, XtRString, sizeof (XtPointer), + offset(string), XtRPointer, NULL}, + {XtNtype, XtCType, XtRMultiType, sizeof (XawAsciiType), + offset(type), XtRImmediate, (XtPointer)XawAsciiString}, + /* not used. */ + {XtNdataCompression, XtCDataCompression, XtRBoolean, sizeof (Boolean), + offset(data_compression), XtRImmediate, (XtPointer) FALSE}, + {XtNpieceSize, XtCPieceSize, XtRInt, sizeof (XawTextPosition), + offset(piece_size), XtRImmediate, (XtPointer) BUFSIZ}, + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(callback), XtRCallback, (XtPointer)NULL}, + {XtNuseStringInPlace, XtCUseStringInPlace, XtRBoolean, sizeof (Boolean), + offset(use_string_in_place), XtRImmediate, (XtPointer) FALSE}, + {XtNlength, XtCLength, XtRInt, sizeof (int), + offset(multi_length), XtRInt, (XtPointer) &magic_value}, + +}; +#undef offset + +static XawTextPosition Scan(), Search(), ReadText(); +static int ReplaceText(); +static MultiPiece * FindPiece(), * AllocNewPiece(); +static FILE * InitStringOrFile(); +static void FreeAllPieces(), RemovePiece(), BreakPiece(), LoadPieces(); +static void RemoveOldStringOrFile(), CvtStringToMultiType(); +static void ClassInitialize(), Initialize(), Destroy(), GetValuesHook(); +static String StorePiecesInString(); +static Boolean SetValues(), WriteToFile(); + +#define MyWStrncpy( t,s,wcnt ) (void) memmove( (t), (s), (wcnt)*sizeof(wchar_t)) + +#ifndef MyWStrncpy +static void (MyWStrncpy)(); +#endif + +extern char *tmpnam(); +#ifdef X_NOT_STDC_ENV +extern int errno; +#endif + +#ifdef X_NOT_POSIX +#define Off_t long +#define Size_t unsigned int +#else +#define Off_t off_t +#define Size_t size_t +#endif + +extern wchar_t* _XawTextMBToWC(); +extern char *_XawTextWCToMB(); + +#define superclass (&textSrcClassRec) +MultiSrcClassRec multiSrcClassRec = { + { /* object_class fields */ + /* superclass */ (WidgetClass) superclass, + /* class_name */ "MultiSrc", + /* widget_size */ sizeof(MultiSrcRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* pad */ NULL, + /* pad */ NULL, + /* pad */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* pad */ FALSE, + /* pad */ FALSE, + /* pad */ FALSE, + /* pad */ FALSE, + /* destroy */ Destroy, + /* pad */ NULL, + /* pad */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* pad */ NULL, + /* get_values_hook */ GetValuesHook, + /* pad */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* pad */ NULL, + /* pad */ NULL, + /* pad */ NULL, + /* extension */ NULL + }, + { /* textSrc_class fields */ + /* Read */ ReadText, + /* Replace */ ReplaceText, + /* Scan */ Scan, + /* Search */ Search, + /* SetSelection */ XtInheritSetSelection, + /* ConvertSelection */ XtInheritConvertSelection + }, + { /* multiSrc_class fields */ + /* Keep the compiler happy */ '\0' + } +}; + +WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec; + +/************************************************************ + * + * Semi-Public Interfaces. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: Class Initialize routine, called only once. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRMultiType, CvtStringToMultiType, + NULL, (Cardinal) 0); +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal* num_args; +{ + MultiSrcObject src = (MultiSrcObject) new; + FILE * file; + +/* + * Set correct flags (override resources) depending upon widget class. + */ + + src->multi_src.changes = FALSE; + src->multi_src.allocated_string = FALSE; + + file = InitStringOrFile(src, src->multi_src.type == XawAsciiFile); + LoadPieces(src, file, NULL); + + if (file != NULL) fclose(file); + src->text_src.text_format = XawFmtWide; + +} + +/* Function Name: ReadText + * Description: This function reads the source. + * Arguments: w - the MultiSource widget. + * pos - position of the text to retreive. + * RETURNED text - text block that will contain returned text. + * length - maximum number of characters to read. + * Returns: The number of characters read into the buffer. + */ + +static XawTextPosition +ReadText(w, pos, text, length) + Widget w; + XawTextPosition pos; + XawTextBlock* text; + int length; +{ + MultiSrcObject src = (MultiSrcObject) w; + XawTextPosition count, start; + MultiPiece * piece = FindPiece(src, pos, &start); + + text->format = XawFmtWide; + text->firstPos = pos; + text->ptr = (char *)(piece->text + (pos - start)); + count = piece->used - (pos - start); + text->length = (length > count) ? count : length; + return(pos + text->length); +} + +/* Function Name: ReplaceText. + * Description: Replaces a block of text with new text. + * Arguments: w - the MultiSource widget. + * startPos, endPos - ends of text that will be removed. + * text - new text to be inserted into buffer at startPos. + * Returns: XawEditError or XawEditDone. + */ + +/*ARGSUSED*/ +static int +ReplaceText( w, startPos, endPos, u_text_p) + Widget w; + XawTextPosition startPos, endPos; + XawTextBlock* u_text_p; +{ + MultiSrcObject src = (MultiSrcObject) w; + MultiPiece *start_piece, *end_piece, *temp_piece; + XawTextPosition start_first, end_first; + int length, firstPos; + wchar_t *wptr; + Boolean local_artificial_block = False; + XawTextBlock text; + + /* STEP 1: The user handed me a text block called `u_text' that may be + * in either FMTWIDE or FMT8BIT (ie MB.) Later code needs the block + * `text' to hold FMTWIDE. So, this copies `u_text' to `text', and if + * `u_text' was MB, I knock it up to WIDE. */ + + if ( u_text_p->length == 0 ) /* if so, the block contents never ref'd. */ + text.length = 0; + + else if ( u_text_p->format == XawFmtWide) { + local_artificial_block = False; /* ie, don't have to free it ourselves*/ + text.firstPos = u_text_p->firstPos; + text.length = u_text_p->length; + text.ptr = u_text_p->ptr; + /* text.format is unneeded */ + + } else { + /* WARNING! u_text->firstPos and length are in units of CHAR, not CHARACTERS! */ + + local_artificial_block = True; /* ie, have to free it ourselves */ + text.firstPos = 0; + text.length = u_text_p->length; /* _XawTextMBToWC converts this to wchar len. */ + + text.ptr = (char*)_XawTextMBToWC( XtDisplay(XtParent(w)), + &(u_text_p->ptr[u_text_p->firstPos]), &(text.length) ); + + /* I assert the following assignment is not needed - since Step 4 + depends on length, it has no need of a terminating NULL. I think + the ASCII-version has the same needless NULL. */ + /*((wchar_t*)text.ptr)[ text.length ] = NULL;*/ + } + + + /* STEP 2: some initialization... */ + + if (src->text_src.edit_mode == XawtextRead) + return(XawEditError); + + start_piece = FindPiece(src, startPos, &start_first); + end_piece = FindPiece(src, endPos, &end_first); + + + /* STEP 3: remove the empty pieces... */ + + if (start_piece != end_piece) { + temp_piece = start_piece->next; + + /* If empty and not the only piece then remove it. */ + + if ( ((start_piece->used = startPos - start_first) == 0) && + !((start_piece->next == NULL) && (start_piece->prev == NULL)) ) + RemovePiece(src, start_piece); + + while (temp_piece != end_piece) { + temp_piece = temp_piece->next; + RemovePiece(src, temp_piece->prev); + } + end_piece->used -= endPos - end_first; + if (end_piece->used != 0) + MyWStrncpy(end_piece->text, (end_piece->text + endPos - end_first), + (int) end_piece->used); + } + else { /* We are fully in one piece. */ + if ( (start_piece->used -= endPos - startPos) == 0) { + if ( !((start_piece->next == NULL) && (start_piece->prev == NULL)) ) + RemovePiece(src, start_piece); + } + else { + MyWStrncpy(start_piece->text + (startPos - start_first), + start_piece->text + (endPos - start_first), + (int) (start_piece->used - (startPos - start_first)) ); + if ( src->multi_src.use_string_in_place && + ((src->multi_src.length - (endPos - startPos)) < + (src->multi_src.piece_size - 1)) ) + start_piece->text[src->multi_src.length - (endPos - startPos)] = (wchar_t)0; + } + } + + src->multi_src.length += text.length -(endPos - startPos); + /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/ + + + + /* STEP 4: insert the new stuff */ + + if ( text.length != 0) { + + start_piece = FindPiece(src, startPos, &start_first); + + length = text.length; + firstPos = text.firstPos; + + while (length > 0) { + wchar_t* ptr; + int fill; + + if (src->multi_src.use_string_in_place) { + if (start_piece->used == (src->multi_src.piece_size - 1)) { + /* + * The string is used in place, then the string + * is not allowed to grow. + */ + start_piece->used = src->multi_src.length = + src->multi_src.piece_size - 1; + /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/ + + + start_piece->text[src->multi_src.length] = (wchar_t)0; + return(XawEditError); + } + } + + + if (start_piece->used == src->multi_src.piece_size) { + BreakPiece(src, start_piece); + start_piece = FindPiece(src, startPos, &start_first); + } + + fill = Min((int)(src->multi_src.piece_size - start_piece->used), length); + + ptr = start_piece->text + (startPos - start_first); + MyWStrncpy(ptr + fill, ptr, + (int) start_piece->used - (startPos - start_first)); + wptr =(wchar_t *)text.ptr; + (void)wcsncpy(ptr, wptr + firstPos, fill); + + startPos += fill; + firstPos += fill; + start_piece->used += fill; + length -= fill; + } + } + + if ( local_artificial_block == True ) + + /* In other words, text is not the u_text that the user handed me but + one I made myself. I only care, because I need to free the string. */ + + XFree( text.ptr ); + + if (src->multi_src.use_string_in_place) + start_piece->text[start_piece->used] = (wchar_t)0; + + src->multi_src.changes = TRUE; + + XtCallCallbacks(w, XtNcallback, NULL); + + return(XawEditDone); +} + +/* Function Name: Scan + * Description: Scans the text source for the number and type + * of item specified. + * Arguments: w - the MultiSource widget. + * position - the position to start scanning. + * type - type of thing to scan for. + * dir - direction to scan. + * count - which occurance if this thing to search for. + * include - whether or not to include the character found in + * the position that is returned. + * Returns: the position of the item found. + * + * Note: While there are only 'n' characters in the file there are n+1 + * possible cursor positions (one before the first character and + * one after the last character. + */ + +static +XawTextPosition +Scan( w, position, type, dir, count, include ) + Widget w; + XawTextPosition position; + XawTextScanType type; + XawTextScanDirection dir; + int count; + Boolean include; +{ + MultiSrcObject src = (MultiSrcObject) w; + int inc; + MultiPiece * piece; + XawTextPosition first, first_eol_position = 0; + wchar_t * ptr; + + if (type == XawstAll) { /* Optimize this common case. */ + if (dir == XawsdRight) + return(src->multi_src.length); + return(0); /* else. */ + } + + + /* STEP 1: basic sanity checks */ + + if (position > src->multi_src.length) + position = src->multi_src.length; + + + if ( dir == XawsdRight ) { + if (position == src->multi_src.length) + return(src->multi_src.length); + inc = 1; + } + else { + if (position == 0) + return(0); + inc = -1; + position--; + } + + piece = FindPiece(src, position, &first); + + if ( piece->used == 0 ) return(0); /* i.e., buffer is empty. */ + + ptr = (position - first) + piece->text; + + switch (type) { + case XawstEOL: + case XawstParagraph: + case XawstWhiteSpace: + for ( ; count > 0 ; count-- ) { + Boolean non_space = FALSE, first_eol = TRUE; + /* CONSTCOND */ + while (TRUE) { + wchar_t c = *ptr; + + ptr += inc; + position += inc; + + if (type == XawstWhiteSpace) { + if (iswspace(c)) { + if (non_space) + break; + } + else + non_space = TRUE; + } + else if (type == XawstEOL) { + if (c == _Xaw_atowc(XawLF)) break; + } + else { /* XawstParagraph */ + if (first_eol) { + if (c == _Xaw_atowc(XawLF)) { + first_eol_position = position; + first_eol = FALSE; + } + } + else + if ( c == _Xaw_atowc(XawLF)) + break; + else if ( !iswspace(c) ) + first_eol = TRUE; + } + + + if ( ptr < piece->text ) { + piece = piece->prev; + if (piece == NULL) /* Begining of text. */ + return(0); + ptr = piece->text + piece->used - 1; + } + else if ( ptr >= (piece->text + piece->used) ) { + piece = piece->next; + if (piece == NULL) /* End of text. */ + return(src->multi_src.length); + ptr = piece->text; + } + } + } + if (!include) { + if ( type == XawstParagraph) + position = first_eol_position; + position -= inc; + } + break; + case XawstPositions: + position += count * inc; + break; + case XawstAll: /* handled in special code above */ + default: + break; + } + + if ( dir == XawsdLeft ) + position++; + + if (position >= src->multi_src.length) + return(src->multi_src.length); + if (position < 0) + return(0); + + return(position); +} + +/* Function Name: Search + * Description: Searchs the text source for the text block passed + * Arguments: w - the MultiSource Widget. + * position - the position to start scanning. + * dir - direction to scan. + * text - the text block to search for. + * Returns: the position of the item found. + */ + +static XawTextPosition +Search(w, position, dir, text ) + Widget w; + XawTextPosition position; + XawTextScanDirection dir; + XawTextBlock* text; +{ + MultiSrcObject src = (MultiSrcObject) w; + int inc, count = 0; + wchar_t * ptr; + wchar_t* wtarget; + int wtarget_len; + Display * d = XtDisplay(XtParent(w)); + MultiPiece * piece; + wchar_t* buf; + XawTextPosition first; + + + /* STEP 1: First, a brief sanity check. */ + + if ( dir == XawsdRight ) + inc = 1; + else { + inc = -1; + if (position == 0) + return(XawTextSearchError); /* scanning left from 0??? */ + position--; + } + + + /* STEP 2: Ensure I have a local wide string.. */ + + /* Since this widget stores 32bit chars, I check here to see if + I'm being passed a string claiming to be 8bit chars (ie, MB text.) + If that is the case, naturally I convert to 32bit format. */ + + /*if the block was FMT8BIT, length will convert to REAL wchar count below */ + wtarget_len = text->length; + + if ( text->format == XawFmtWide ) + wtarget = &( ((wchar_t*)text->ptr) [text->firstPos] ); + else + { + /* The following converts wtarget_len from byte len to wchar count */ + wtarget = _XawTextMBToWC( d, &text->ptr[ text->firstPos ], &wtarget_len ); + } + + /* OK, I can now assert that wtarget holds wide characters, wtarget_len + holds an accurate count of those characters, and that firstPos has been + effectively factored out of the following computations. */ + + + /* STEP 3: SEARCH! */ + + buf = (wchar_t *)XtMalloc((unsigned)sizeof(wchar_t) * wtarget_len ); + (void)wcsncpy(buf, wtarget, wtarget_len ); + piece = FindPiece(src, position, &first); + ptr = (position - first) + piece->text; + + /* CONSTCOND */ + while (TRUE) { + if (*ptr == ((dir == XawsdRight) ? *(buf + count) + : *(buf + wtarget_len - count - 1)) ) { + if (count == (text->length - 1)) + break; + else + count++; + } + else { + if (count != 0) { + position -=inc * count; + ptr -= inc * count; + } + count = 0; + } + + ptr += inc; + position += inc; + + while ( ptr < piece->text ) { + piece = piece->prev; + if (piece == NULL) { /* Begining of text. */ + XtFree((char *)buf); + return(XawTextSearchError); + } + ptr = piece->text + piece->used - 1; + } + + while ( ptr >= (piece->text + piece->used) ) { + piece = piece->next; + if (piece == NULL) { /* End of text. */ + XtFree((char *)buf); + return(XawTextSearchError); + } + ptr = piece->text; + } + } + + XtFree( (char *) buf ); + if (dir == XawsdLeft) + return( position ); + return( position - ( wtarget_len - 1 ) ); +} + +/* Function Name: SetValues + * Description: Sets the values for the MultiSource. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: True if redisplay is needed. + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal* num_args; +{ + MultiSrcObject src = (MultiSrcObject) new; + MultiSrcObject old_src = (MultiSrcObject) current; + XtAppContext app_con = XtWidgetToApplicationContext(new); + Boolean total_reset = FALSE, string_set = FALSE; + FILE * file; + int i; + + if ( old_src->multi_src.use_string_in_place != + src->multi_src.use_string_in_place ) { + XtAppWarning( app_con, + "MultiSrc: The XtNuseStringInPlace resources may not be changed."); + src->multi_src.use_string_in_place = + old_src->multi_src.use_string_in_place; + } + + for (i = 0; i < *num_args ; i++ ) + if (streq(args[i].name, XtNstring)) { + string_set = TRUE; + break; + } + + if ( string_set || (old_src->multi_src.type != src->multi_src.type) ) { + RemoveOldStringOrFile(old_src, string_set); + file = InitStringOrFile(src, string_set); + + /* Load pieces does this logic for us, but it shouldn't. Its messy.*/ + /*if (old_src->multi_src.type == XawAsciiString) + LoadPieces(src, NULL, src->multi_src.string); + else*/ + LoadPieces(src, file, NULL); + if (file != NULL) fclose(file); + XawTextSetSource( XtParent(new), new, 0); /* Tell text widget + what happened. */ + total_reset = TRUE; + } + + if ( old_src->multi_src.multi_length != src->multi_src.multi_length ) + src->multi_src.piece_size = src->multi_src.multi_length; + + if ( !total_reset && (old_src->multi_src.piece_size + != src->multi_src.piece_size) ) { + String mb_string = StorePiecesInString( old_src ); + + if ( mb_string != 0 ) { + FreeAllPieces( old_src ); + LoadPieces( src, NULL, mb_string ); + XtFree( mb_string ); + } else { + /* If the buffer holds bad chars, don't touch it... */ + XtAppWarningMsg( app_con, + "convertError", "multiSource", "XawError", + XtName( XtParent( (Widget) old_src ) ), NULL, NULL ); + XtAppWarningMsg( app_con, + "convertError", "multiSource", "XawError", + "Non-character code(s) in buffer.", NULL, NULL ); + } + } + + return(FALSE); +} + +/* Function Name: GetValuesHook + * Description: This is a get values hook routine that sets the + * values specific to the multi source. + * Arguments: w - the MultiSource Widget. + * args - the argument list. + * num_args - the number of args. + * Returns: none. + */ + +static void +GetValuesHook(w, args, num_args) + Widget w; + ArgList args; + Cardinal* num_args; +{ + MultiSrcObject src = (MultiSrcObject) w; + int i; + + if (src->multi_src.type == XawAsciiString) { + for (i = 0; i < *num_args ; i++ ) + if (streq(args[i].name, XtNstring)) { + if (src->multi_src.use_string_in_place) { + *((char **) args[i].value) = (char *) + src->multi_src.first_piece->text; + } + else { + if (_XawMultiSave(w)) /* If save sucessful. */ + *((char **) args[i].value) = src->multi_src.string; + } + break; + } + } +} + +/* Function Name: Destroy + * Description: Destroys an multi source (frees all data) + * Arguments: src - the Multi source Widget to free. + * Returns: none. + */ + +static void +Destroy (w) + Widget w; +{ + RemoveOldStringOrFile((MultiSrcObject) w, True); +} + +/************************************************************ + * + * Public routines + * + ************************************************************/ + +/* Function Name: XawMultiSourceFreeString + * Description: Frees the string returned by a get values call + * on the string when the source is of type string. + * Arguments: w - the MultiSrc widget. + * Returns: none. + * + * The public interface is XawAsciiSourceFreeString! + */ + +void +#if NeedFunctionPrototypes +_XawMultiSourceFreeString( + Widget w) +#else +_XawMultiSourceFreeString(w) + Widget w; +#endif +{ + MultiSrcObject src = (MultiSrcObject) w; + +/*if (src->multi_src.allocated_string&& src->multi_src.type != XawAsciiFile) {*/ + /* ASSERT: src->multi_src.allocated_string -> we MUST free .string! */ + if ( src->multi_src.allocated_string ) { + XtFree(src->multi_src.string); + src->multi_src.allocated_string = FALSE; + src->multi_src.string = NULL; + } +} + +/* Function Name: _XawMultiSave + * Description: Saves all the pieces into a file or string as required. + * Arguments: w - the multiSrc Widget. + * Returns: TRUE if the save was successful. + * + * The public interface is XawAsciiSave(w)! + */ + +Boolean +#if NeedFunctionPrototypes +_XawMultiSave( + Widget w) +#else +_XawMultiSave(w) + Widget w; +#endif +{ + MultiSrcObject src = (MultiSrcObject) w; + XtAppContext app_con = XtWidgetToApplicationContext(w); + char * mb_string; + +/* + * If using the string in place then there is no need to play games + * to get the internal info into a readable string. + */ + + if (src->multi_src.use_string_in_place) + return(TRUE); + + if (src->multi_src.type == XawAsciiFile) { + + if (!src->multi_src.changes) /* No changes to save. */ + return(TRUE); + + mb_string = StorePiecesInString( src ); + + if ( mb_string != 0 ) { + if ( WriteToFile( mb_string, src->multi_src.string ) == FALSE ) { + XtFree( mb_string ); + return( FALSE ); + } + XtFree( mb_string ); + src->multi_src.changes = FALSE; + return( TRUE ); + } else { + /* If the buffer holds bad chars, don't touch it... */ + XtAppWarningMsg( app_con, + "convertError", "multiSource", "XawError", + "Due to illegal characters, file not saved.", NULL, NULL); + return( FALSE ); + } + } + else { + + /* THIS FUNCTIONALITY IS UNDOCUMENTED, probably UNNEEDED? The manual + says this routine's only function is to save files to disk. -Sheeran */ + + mb_string = StorePiecesInString( src ); + + if ( mb_string == 0 ) { + /* If the buffer holds bad chars, don't touch it... */ + XtAppWarningMsg( app_con, + "convertError", "multiSource", "XawError", + XtName( XtParent( (Widget) src ) ), NULL, NULL); + return( FALSE ); + } + + /* assert: mb_string holds good characters so the buffer is fine */ + if (src->multi_src.allocated_string == TRUE) + XtFree(src->multi_src.string); + else + src->multi_src.allocated_string = TRUE; + + src->multi_src.string = mb_string; + } + src->multi_src.changes = FALSE; + return(TRUE); +} + +/* Function Name: XawMultiSaveAsFile + * Description: Save the current buffer as a file. + * Arguments: w - the MultiSrc widget. + * name - name of the file to save this file into. + * Returns: True if the save was sucessful. + * + * The public interface is XawAsciiSaveAsFile! + */ + +Boolean +#if NeedFunctionPrototypes +_XawMultiSaveAsFile( + Widget w, + _Xconst char* name) +#else +_XawMultiSaveAsFile(w, name) + Widget w; + String name; +#endif +{ + MultiSrcObject src = (MultiSrcObject) w; + String mb_string; + Boolean ret; + + mb_string = StorePiecesInString( src ); + + if ( mb_string != 0 ) { + ret = WriteToFile( mb_string, name ); + XtFree( mb_string ); + return( ret ); + } + + /* otherwise there was a conversion error. So print widget name too. */ + XtAppWarningMsg( XtWidgetToApplicationContext(w), + "convertError", "multiSource", "XawError", + XtName( XtParent( (Widget) src ) ), NULL, NULL); + return( False ); +} + +/************************************************************ + * + * Private Functions. + * + ************************************************************/ + +static void +RemoveOldStringOrFile(src, checkString) + MultiSrcObject src; + Boolean checkString; +{ + FreeAllPieces(src); + + if (checkString && src->multi_src.allocated_string) { + XtFree(src->multi_src.string); + src->multi_src.allocated_string = False; + src->multi_src.string = NULL; + } +} + +/* Function Name: WriteToFile + * Description: Write the string specified to the begining of the file + * specified. + * Arguments: string - string to write. + * name - the name of the file + * Returns: returns TRUE if sucessful, FALSE otherwise. + */ + +static Boolean +WriteToFile(string, name) + String string, name; +{ + int fd; + + if ( ((fd = creat(name, 0666)) == -1 ) || + (write(fd, string, sizeof(unsigned char) * strlen(string)) == -1) ) + return(FALSE); + + if ( close(fd) == -1 ) + return(FALSE); + + return(TRUE); +} + + +/* Function Name: StorePiecesInString + * Description: store the pieces in memory into a char string. + * Arguments: src - the multiSrc to gather data from + * Returns: char *mb_string. Caller must free. + * or 0: conversion error. Caller must panic! + */ + +static String +StorePiecesInString(src) + MultiSrcObject src; +{ + wchar_t* wc_string; + char *mb_string; + int char_count = src->multi_src.length; + XawTextPosition first; + MultiPiece * piece; + + /* I believe the char_count + 1 and the NULL termination are unneeded! FS*/ + + wc_string = (wchar_t*) XtMalloc((unsigned)(char_count + 1) * sizeof(wchar_t)); + + for (first = 0, piece = src->multi_src.first_piece ; piece != NULL; + first += piece->used, piece = piece->next) + (void) wcsncpy( wc_string + first, piece->text, piece->used ); + + wc_string[ char_count ] = (wchar_t)0; /* NULL terminate this sucker. */ + + + /* This will refill all pieces to capacity. */ + + if ( src->multi_src.data_compression ) { + FreeAllPieces( src ); + LoadPieces( src, NULL, (char *)wc_string ); + } + + /* Lastly, convert it to a MB format and send it back. */ + + mb_string = _XawTextWCToMB( XtDisplayOfObject( (Widget)src ), + wc_string, &char_count ); + + /* NOTE THAT mb_string MAY BE ZERO IF THE CONVERSION FAILED. */ + XtFree( (char*) wc_string ); + return( mb_string ); +} + + +/* Function Name: InitStringOrFile. + * Description: Initializes the string or file. + * Arguments: src - the MultiSource. + * Returns: none - May exit though. + */ + +static FILE * +InitStringOrFile(src, newString) + MultiSrcObject src; + Boolean newString; +{ + char * open_mode = NULL; + FILE * file; + char fileName[TMPSIZ]; + Display *d = XtDisplayOfObject((Widget)src); + + if (src->multi_src.type == XawAsciiString) { + + if (src->multi_src.string == NULL) + src->multi_src.length = 0; + + else if (! src->multi_src.use_string_in_place) { + int length; + String temp = XtNewString(src->multi_src.string); + if ( src->multi_src.allocated_string ) + XtFree( src->multi_src.string ); + src->multi_src.allocated_string = True; + src->multi_src.string = temp; + + length = strlen(src->multi_src.string); + + /* Wasteful, throwing away the WC string, but need side effect! */ + (void) _XawTextMBToWC(d, src->multi_src.string, &length); + src->multi_src.length = (XawTextPosition) length; + } else { + src->multi_src.length = strlen(src->multi_src.string); + /* In case the length resource is incorrectly set */ + if (src->multi_src.length > src->multi_src.multi_length) + src->multi_src.multi_length = src->multi_src.length; + + if (src->multi_src.multi_length == MAGIC_VALUE) + src->multi_src.piece_size = src->multi_src.length; + else + src->multi_src.piece_size = src->multi_src.multi_length + 1; + } + + /*((TextWidget)src->object.parent)->text.lastPos = src->multi_src.length;*/ + return(NULL); + } + +/* + * type is XawAsciiFile. + */ + + src->multi_src.is_tempfile = FALSE; + + switch (src->text_src.edit_mode) { + case XawtextRead: + if (src->multi_src.string == NULL) + XtErrorMsg("NoFile", "multiSourceCreate", "XawError", + "Creating a read only disk widget and no file specified.", + NULL, 0); + open_mode = "r"; + break; + case XawtextAppend: + case XawtextEdit: + if (src->multi_src.string == NULL) { + + if ( src->multi_src.allocated_string ) + XtFree( src->multi_src.string ); + src->multi_src.allocated_string = False; + src->multi_src.string = fileName; + + (void) tmpnam(src->multi_src.string); + src->multi_src.is_tempfile = TRUE; + open_mode = "w"; + } else + open_mode = "r+"; + break; + default: + XtErrorMsg("badMode", "multiSourceCreate", "XawError", + "Bad editMode for multi source; must be Read, Append or Edit.", + NULL, NULL); + } + + /* Allocate new memory for the temp filename, because it is held in + * a stack memory buffer. We must verify that all routines that set + * .string first check .allocated_string and free it - plumbing Sheeran. + */ + if (newString || src->multi_src.is_tempfile) { + if ( src->multi_src.allocated_string ) + src->multi_src.string = XtNewString(src->multi_src.string); + src->multi_src.allocated_string = TRUE; + } + + if (!src->multi_src.is_tempfile) { + if ((file = fopen(src->multi_src.string, open_mode)) != 0) { + (void) fseek(file, (Off_t)0, 2); + src->multi_src.length = ftell (file); + return file; + } else { + String params[2]; + Cardinal num_params = 2; + + params[0] = src->multi_src.string; + params[1] = strerror(errno); + XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src), + "openError", "multiSourceCreate", "XawWarning", + "Cannot open file %s; %s", params, &num_params); + } + } + src->multi_src.length = 0; + return((FILE *)NULL); +#undef StrLen +} + +/* LoadPieces: This routine takes either the MB contents of open file `file' or the +MB contents of string or the MB contents of src->multi_src.string and places +them in Pieces in WC format. + +CAUTION: You must have src->multi_src.length set to file length bytes +when src->multi_src.type == XawAsciiFile. src->multi_src.length must be +the length of the parameter string if string is non-NULL. */ + +static void +LoadPieces(src, file, string) + MultiSrcObject src; + FILE* file; + char* string; +{ + Display *d = XtDisplayOfObject((Widget)src); + wchar_t* local_str, *ptr; + MultiPiece* piece = NULL; + XawTextPosition left; + int bytes = sizeof(wchar_t); + char* temp_mb_holder = NULL; + + /* + * This is tricky - the _XawTextMBtoWC converter uses its 3rd arg + * in as MB length, out as WC length. We want local_length to be + * WC count. + */ + int local_length = src->multi_src.length; + + if (string != NULL) { + /* + * ASSERT: IF our caller passed a non-null string, THEN + * src->multi_src.length is currently string's * byte count, + * AND string is in a MB format. + */ + local_str = _XawTextMBToWC(d, (char *)string, &local_length); + src->multi_src.length = (XawTextPosition) local_length; + } else if (src->multi_src.type != XawAsciiFile) { + /* + * here, we are not changing the contents, just reloading, + * so don't change len... + */ + local_length = src->multi_src.string ? + strlen( src->multi_src.string ) : 0; + local_str = _XawTextMBToWC( d, (char*)src->multi_src.string, &local_length ); + } else { + if (src->multi_src.length != 0) { + temp_mb_holder = + XtMalloc((unsigned)(src->multi_src.length + 1) * sizeof(unsigned char)); + fseek(file, (Off_t)0, 0); + src->multi_src.length = fread (temp_mb_holder, + (Size_t)sizeof(unsigned char), + (Size_t)src->multi_src.length, file); + if (src->multi_src.length <= 0) + XtAppErrorMsg( XtWidgetToApplicationContext ((Widget) src), + "readError", "multiSource", "XawError", + "fread returned error.", NULL, NULL); + local_length = src->multi_src.length; + local_str = _XawTextMBToWC(d, temp_mb_holder, &local_length); + src->multi_src.length = local_length; + + if ( local_str == 0 ) { + String params[2]; + Cardinal num_params; + static char err_text[] = + "<<< FILE CONTENTS NOT REPRESENTABLE IN THIS LOCALE >>>"; + + params[0] = XtName(XtParent((Widget)src)); + params[1] = src->multi_src.string; + num_params = 2; + + XtAppWarningMsg( XtWidgetToApplicationContext((Widget)src), + "readLocaleError", "multiSource", "XawError", + "%s: The file `%s' contains characters not representable in this locale.", + params, &num_params); + src->multi_src.length = sizeof err_text; + local_length = src->multi_src.length; + local_str = _XawTextMBToWC(d, err_text, &local_length); + src->multi_src.length = local_length; + } + } else { /*ASSERT that since following while loop looks at local_length + this isn't needed. Sheeran, Omron KK, 1993/07/15 + temp_mb_holder[src->multi_src.length] = '\0';*/ + local_str = (wchar_t*)temp_mb_holder; + } + } + + if (src->multi_src.use_string_in_place) { + piece = AllocNewPiece(src, piece); + piece->used = Min(src->multi_src.length, src->multi_src.piece_size); + piece->text = (wchar_t*)src->multi_src.string; + return; + } + + ptr = local_str; + left = local_length; + + do { + piece = AllocNewPiece(src, piece); + + piece->text = (wchar_t*)XtMalloc(src->multi_src.piece_size * bytes); + piece->used = Min(left, src->multi_src.piece_size); + if (piece->used != 0) + (void) wcsncpy(piece->text, ptr, piece->used); + + left -= piece->used; + ptr += piece->used; + } while (left > 0); + + if ( temp_mb_holder ) + XtFree( (char*) temp_mb_holder ); +} + + +/* Function Name: AllocNewPiece + * Description: Allocates a new piece of memory. + * Arguments: src - The MultiSrc Widget. + * prev - the piece just before this one, or NULL. + * Returns: the allocated piece. + */ + +static MultiPiece * +AllocNewPiece(src, prev) + MultiSrcObject src; + MultiPiece * prev; +{ + MultiPiece * piece = XtNew(MultiPiece); + + if (prev == NULL) { + src->multi_src.first_piece = piece; + piece->next = NULL; + } + else { + if (prev->next != NULL) + (prev->next)->prev = piece; + piece->next = prev->next; + prev->next = piece; + } + + piece->prev = prev; + + return(piece); +} + +/* Function Name: FreeAllPieces + * Description: Frees all the pieces + * Arguments: src - The MultiSrc Widget. + * Returns: none. + */ + +static void +FreeAllPieces(src) + MultiSrcObject src; +{ + MultiPiece * next, * first = src->multi_src.first_piece; + + if (first->prev != NULL) + printf("Xaw MultiSrc Object: possible memory leak in FreeAllPieces().\n"); + + for ( ; first != NULL ; first = next ) { + next = first->next; + RemovePiece(src, first); + } +} + +/* Function Name: RemovePiece + * Description: Removes a piece from the list. + * Arguments: + * piece - the piece to remove. + * Returns: none. + */ + +static void +RemovePiece(src, piece) + MultiSrcObject src; + MultiPiece* piece; +{ + if (piece->prev == NULL) + src->multi_src.first_piece = piece->next; + else + (piece->prev)->next = piece->next; + + if (piece->next != NULL) + (piece->next)->prev = piece->prev; + + if (!src->multi_src.use_string_in_place) + XtFree((char *)piece->text); + + XtFree((char *)piece); +} + +/* Function Name: FindPiece + * Description: Finds the piece containing the position indicated. + * Arguments: src - The MultiSrc Widget. + * position - the position that we are searching for. + * RETURNED first - the position of the first character in this piece. + * Returns: piece - the piece that contains this position. + */ + +static MultiPiece * +FindPiece(src, position, first) + MultiSrcObject src; + XawTextPosition position, *first; +{ + MultiPiece * old_piece = NULL, * piece = src->multi_src.first_piece; + XawTextPosition temp; + + for ( temp = 0 ; piece != NULL ; temp += piece->used, piece = piece->next ) { + *first = temp; + old_piece = piece; + + if ((temp + piece->used) > position) + return(piece); + } + return(old_piece); /* if we run off the end the return the last piece */ +} + +/* Function Name: BreakPiece + * Description: Breaks a full piece into two new pieces. + * Arguments: src - The MultiSrc Widget. + * piece - the piece to break. + * Returns: none. + */ + +#define HALF_PIECE (src->multi_src.piece_size/2) + +static void +BreakPiece(src, piece) + MultiSrcObject src; + MultiPiece* piece; +{ + MultiPiece * new = AllocNewPiece(src, piece); + + new->text = (wchar_t*)XtMalloc(src->multi_src.piece_size * sizeof(wchar_t)); + (void) wcsncpy(new->text, piece->text + HALF_PIECE, + src->multi_src.piece_size - HALF_PIECE); + piece->used = HALF_PIECE; + new->used = src->multi_src.piece_size - HALF_PIECE; +} + +/* Convert string "XawAsciiString" and "XawAsciiFile" to quarks. */ + +/* ARGSUSED */ +static void +CvtStringToMultiType(args, num_args, fromVal, toVal) + XrmValuePtr args; /* unused */ + Cardinal* num_args; /* unused */ + XrmValuePtr fromVal; + XrmValuePtr toVal; +{ + static XawAsciiType type; + static XrmQuark XtQEstring = NULLQUARK; + static XrmQuark XtQEfile; + XrmQuark q; + char lowerName[40]; + + if (XtQEstring == NULLQUARK) { + XtQEstring = XrmPermStringToQuark(XtEstring); + XtQEfile = XrmPermStringToQuark(XtEfile); + } + + if (strlen ((char*) fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered(lowerName, (char *) fromVal->addr); + q = XrmStringToQuark(lowerName); + + if (q == XtQEstring) type = XawAsciiString; + else if (q == XtQEfile) type = XawAsciiFile; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof type; + toVal->addr = (XPointer) &type; + return; + } + toVal->size = 0; + toVal->addr = NULL; +} diff --git a/vendor/x11iraf/xaw3d/MultiSrc.h b/vendor/x11iraf/xaw3d/MultiSrc.h new file mode 100644 index 00000000..be01857e --- /dev/null +++ b/vendor/x11iraf/xaw3d/MultiSrc.h @@ -0,0 +1,151 @@ +/* $XConsortium: MultiSrc.h,v 1.2 94/04/17 20:12:26 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name OMRON not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Li Yuhong OMRON Corporation + */ + +/* + +Copyright (c) 1989, 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* + * This file was modified from AsciiSrc.h. + * + * By Li Yuhong, Sept. 18, 1990 + */ + +#ifndef _XawMultiSrc_h +#define _XawMultiSrc_h + +#include <X11/Xaw3d/TextSrc.h> +/*Xfuncproto.h included by Intrinsic.h*/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Callback (none) + dataCompression DataCompression Boolean True + length Length int (internal) + pieceSize PieceSize int BUFSIZ + string String String NULL + type Type XawAsciiType XawAsciiString + useStringInPlace UseStringInPlace Boolean False + +*/ + +/* Class record constants */ + +extern WidgetClass multiSrcObjectClass; + +typedef struct _MultiSrcClassRec *MultiSrcObjectClass; +typedef struct _MultiSrcRec *MultiSrcObject; + +/* + * Just to make people's lives a bit easier. + */ + +#define MultiSourceObjectClass MultiSrcObjectClass +#define MultiSourceObject MultiSrcObject + +/* + * Resource Definitions. + */ + +#define XtCDataCompression "DataCompression" +#define XtCPieceSize "PieceSize" +#define XtCType "Type" +#define XtCUseStringInPlace "UseStringInPlace" + +#define XtNdataCompression "dataCompression" +#define XtNpieceSize "pieceSize" +#define XtNtype "type" +#define XtNuseStringInPlace "useStringInPlace" + +#define XtRMultiType "MultiType" + +#define XtEstring "string" +#define XtEfile "file" + +/************************************************************ + * + * THESE ROUTINES ARE NOT PUBLIC: Source should call + * + * the AsciiSrc API which currently forwards requests here. + * + * future versions (like theres going to be an R7 Xaw!) may + * + * eliminate this file or at least these functions entirely. + * + ************************************************************/ + +_XFUNCPROTOBEGIN + + +extern void XawMultiSourceFreeString( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern Boolean _XawMultiSave( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern Boolean _XawMultiSaveAsFile( +#if NeedFunctionPrototypes + Widget /* w */, + _Xconst char* /* name */ +#endif +); + + +_XFUNCPROTOEND + +#endif /* _XawMultiSrc_h - Don't add anything after this line. */ + diff --git a/vendor/x11iraf/xaw3d/MultiSrcP.h b/vendor/x11iraf/xaw3d/MultiSrcP.h new file mode 100644 index 00000000..69963618 --- /dev/null +++ b/vendor/x11iraf/xaw3d/MultiSrcP.h @@ -0,0 +1,194 @@ +/* $XConsortium: MultiSrcP.h,v 1.2 94/04/17 20:12:27 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name OMRON not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON make no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Li Yuhong OMRON Corporation + */ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * MultiSrcP.h - Private Header for Multi Text Source. + * + * This is the private header file for the Multi Text Source. + * It is intended to be used with the Text widget, the simplest way to use + * this text source is to use the MultiText Object. + * + * Date: June 29, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +/* + * TextSrcP.h - Private definitions for MultiSrc object + * + */ + +/* + * This file was changed from AsciiSrcP.h. + * + * By Li Yuhong, Sept. 18, 1990 + */ + +#ifndef _XawMultiSrcP_h +#define _XawMultiSrcP_h + +#include <X11/Xaw3d/TextSrcP.h> +#include <X11/Xaw3d/MultiSrc.h> + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#ifdef L_tmpnam +#define TMPSIZ L_tmpnam +#else +#define TMPSIZ 32 /* bytes to allocate for tmpnam */ +#endif + +#define MAGIC_VALUE ((XawTextPosition) -1) /* Magic value. */ + +#define streq(a, b) ( strcmp((a), (b)) == 0 ) + +typedef struct _MultiPiece { /* Piece of the text file of BUFSIZ allocated + characters. */ + wchar_t* text; /* The text in this buffer. */ + XawTextPosition used; /* The number of characters of this buffer + that have been used. */ + struct _MultiPiece *prev, *next; /* linked list pointers. */ +} MultiPiece; + +/************************************************************ + * + * New fields for the MultiSrc object class record. + * + ************************************************************/ + +typedef struct _MultiSrcClassPart { char foo; } MultiSrcClassPart; + +/* Full class record declaration */ +typedef struct _MultiSrcClassRec { + ObjectClassPart object_class; + TextSrcClassPart text_src_class; + MultiSrcClassPart multi_src_class; +} MultiSrcClassRec; + +extern MultiSrcClassRec multiSrcClassRec; + +/* New fields for the MultiSrc object record */ + +typedef struct _MultiSrcPart { + + /* Resources. */ + + XIC ic; /* for X Input Method. */ + XtPointer string; /* either the string, or the file name, depend- + ing upon the `type'. ALWAYS IN MB FORMAT. */ + XawAsciiType type; /* either string or disk. */ + XawTextPosition piece_size; /* Size of text buffer for each piece. */ + Boolean data_compression; /* compress to minimum memory automatically + on save? */ + XtCallbackList callback; /* A callback list to call when the source is + changed. */ + Boolean use_string_in_place; /* Use the string passed in place. */ + int multi_length; /* length field for multi string emulation. */ + +/* Private data. */ + + Boolean is_tempfile; /* Is this a temporary file? */ + Boolean changes; /* Has this file been edited? */ + Boolean allocated_string; /* Have I allocated the + string in multi_src->string? */ + XawTextPosition length; /* length of file - IN CHARACTERS, NOT BYTES. */ + MultiPiece * first_piece; /* first piece of the text. */ +} MultiSrcPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _MultiSrcRec { + ObjectPart object; + TextSrcPart text_src; + MultiSrcPart multi_src; +} MultiSrcRec; + +#if NeedFunctionPrototypes +extern void _XawMultiSourceFreeString( Widget ); +#else +extern void _XawMultiSourceFreeString(); +#endif + +#endif /* _XawMultiSrcP_h --- Don't add anything after this line. */ diff --git a/vendor/x11iraf/xaw3d/Paned.c b/vendor/x11iraf/xaw3d/Paned.c new file mode 100644 index 00000000..83fccefb --- /dev/null +++ b/vendor/x11iraf/xaw3d/Paned.c @@ -0,0 +1,1945 @@ +/* $XConsortium: Paned.c,v 1.27 94/04/17 20:12:28 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Paned.c - Paned Composite Widget. + * + * Updated and significantly modified from the Athena VPaned Widget. + * + * Date: March 1, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/Converters.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/Grip.h> +#include <X11/Xaw3d/PanedP.h> + +/* I don't know why Paned.c calls _XawImCallVendorShellExtResize, but... */ +#include <X11/Xaw3d/XawImP.h> + +#include <ctype.h> + +typedef enum {UpLeftPane = 'U', LowRightPane = 'L', + ThisBorderOnly = 'T', AnyPane = 'A' } Direction; + +#define NO_INDEX -100 +#define IS_GRIP NULL + +#define PaneInfo(w) ((Pane)(w)->core.constraints) +#define HasGrip(w) (PaneInfo(w)->grip != NULL) +#define IsPane(w) ((w)->core.widget_class != gripWidgetClass) +#define PaneIndex(w) (PaneInfo(w)->position) +#define IsVert(w) ( (w)->paned.orientation == XtorientVertical ) + +#define ForAllPanes(pw, childP) \ + for ( (childP) = (pw)->composite.children ; \ + (childP) < (pw)->composite.children + (pw)->paned.num_panes ; \ + (childP)++ ) + +#define ForAllChildren(pw, childP) \ + for ( (childP) = (pw)->composite.children ; \ + (childP) < (pw)->composite.children + (pw)->composite.num_children ; \ + (childP)++ ) + +/***************************************************************************** + * + * Full instance record declaration + * + ****************************************************************************/ + +static char defGripTranslations[] = + "<Btn1Down>: GripAction(Start, UpLeftPane) \n\ + <Btn2Down>: GripAction(Start, ThisBorderOnly) \n\ + <Btn3Down>: GripAction(Start, LowRightPane) \n\ + <Btn1Motion>: GripAction(Move, UpLeft) \n\ + <Btn2Motion>: GripAction(Move, ThisBorder) \n\ + <Btn3Motion>: GripAction(Move, LowRight) \n\ + Any<BtnUp>: GripAction(Commit)"; + +#define offset(field) XtOffsetOf(PanedRec, paned.field) + +static XtResource resources[] = { + {XtNinternalBorderColor, XtCBorderColor, XtRPixel, sizeof(Pixel), + offset(internal_bp), XtRString, + (XtPointer) XtDefaultForeground}, + {XtNinternalBorderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + offset(internal_bw), XtRImmediate, (XtPointer) 1}, + {XtNgripIndent, XtCGripIndent, XtRPosition, sizeof(Position), + offset(grip_indent), XtRImmediate, (XtPointer) 10}, + {XtNrefigureMode, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(refiguremode), XtRImmediate, (XtPointer) TRUE}, + {XtNgripTranslations, XtCTranslations, XtRTranslationTable, + sizeof(XtTranslations), + offset(grip_translations), XtRString, (XtPointer)defGripTranslations}, + {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), + offset(orientation), XtRImmediate, (XtPointer) XtorientVertical}, + + /* Cursors - both horiz and vertical have to work. */ + + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, None}, + {XtNgripCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(grip_cursor), XtRImmediate, None}, + {XtNverticalGripCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(v_grip_cursor), XtRString, "sb_v_double_arrow"}, + {XtNhorizontalGripCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(h_grip_cursor), XtRString, "sb_h_double_arrow"}, + + {XtNbetweenCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(adjust_this_cursor), XtRString, None}, + {XtNverticalBetweenCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(v_adjust_this_cursor), XtRString, "sb_left_arrow"}, + {XtNhorizontalBetweenCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(h_adjust_this_cursor), XtRString, "sb_up_arrow"}, + + {XtNupperCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(adjust_upper_cursor), XtRString, "sb_up_arrow"}, + {XtNlowerCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(adjust_lower_cursor), XtRString, "sb_down_arrow"}, + {XtNleftCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(adjust_left_cursor), XtRString, "sb_left_arrow"}, + {XtNrightCursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(adjust_right_cursor), XtRString, "sb_right_arrow"}, +}; + +#undef offset + +#define offset(field) XtOffsetOf(PanedConstraintsRec, paned.field) + +static XtResource subresources[] = { + {XtNallowResize, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(allow_resize), XtRImmediate, (XtPointer) FALSE}, + {XtNposition, XtCPosition, XtRInt, sizeof(int), + offset(position), XtRImmediate, (XtPointer) 0}, + {XtNmin, XtCMin, XtRDimension, sizeof(Dimension), + offset(min), XtRImmediate, (XtPointer) PANED_GRIP_SIZE}, + {XtNmax, XtCMax, XtRDimension, sizeof(Dimension), + offset(max), XtRImmediate, (XtPointer) ~0}, + {XtNpreferredPaneSize, XtCPreferredPaneSize, XtRDimension, + sizeof(Dimension), offset(preferred_size), + XtRImmediate, (XtPointer) PANED_ASK_CHILD}, + {XtNresizeToPreferred, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(resize_to_pref), XtRImmediate, (XtPointer) FALSE}, + {XtNskipAdjust, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(skip_adjust), XtRImmediate, (XtPointer) FALSE}, + {XtNshowGrip, XtCShowGrip, XtRBoolean, sizeof(Boolean), + offset(show_grip), XtRImmediate, (XtPointer) TRUE}, +}; + +#undef offset + +static void ClassInitialize(), Initialize(); +static void Realize(), Resize(); +static void Redisplay(); +static void GetGCs(), ReleaseGCs(); +static void RefigureLocationsAndCommit(); +static Boolean SetValues(); +static XtGeometryResult GeometryManager(); +static void ChangeManaged(); +static void InsertChild(); +static void DeleteChild(); +static Boolean PaneSetValues(); +static Dimension PaneSize(), GetRequestInfo(); +static Boolean SatisfiesRule1(), SatisfiesRule2(), SatisfiesRule3(); + +static void PushPaneStack(); +static void GetPaneStack(); +static Boolean PopPaneStack(); +static void ClearPaneStack(); + +#define SuperClass ((ConstraintWidgetClass)&constraintClassRec) + +PanedClassRec panedClassRec = { + { +/* core class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class name */ "Paned", + /* size */ sizeof(PanedRec), + /* class_initialize */ ClassInitialize, + /* class_part init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ ReleaseGCs, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, { +/* composite class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ InsertChild, + /* delete_child */ DeleteChild, + /* extension */ NULL + }, { +/* constraint class fields */ + /* subresources */ subresources, + /* subresource_count */ XtNumber(subresources), + /* constraint_size */ sizeof(PanedConstraintsRec), + /* initialize */ NULL, + /* destroy */ NULL, + /* set_values */ PaneSetValues, + /* extension */ NULL + } +}; + +WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec; + +/* For compatibility. */ +WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec; + +/*********************************************************** + * + * Private Functions. + * + ************************************************************/ + +/* Function Name: AdjustPanedSize + * Description: Adjusts the size of the pane. + * Arguments: pw - the paned widget to adjust. + * off_size - the new off_size to use. + * result_ret - result of query ** RETURNED ** + * on_size_ret - the new on_size ** RETURNED ** + * off_size_ret - the new off_size ** RETURNED ** + * Returns: the amount of change in size. + */ + +static void +AdjustPanedSize(pw, off_size, result_ret, on_size_ret, off_size_ret) +PanedWidget pw; +Dimension off_size; +XtGeometryResult * result_ret; +Dimension * on_size_ret, * off_size_ret; +{ + Dimension old_size = PaneSize( (Widget) pw, IsVert(pw)); + Dimension newsize = 0; + Widget * childP; + XtWidgetGeometry request, reply; + request.request_mode = CWWidth | CWHeight; + + ForAllPanes(pw, childP) { + int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min); + AssignMin(size, (int) PaneInfo(*childP)->max); + newsize += size + pw->paned.internal_bw; + } + newsize -= pw->paned.internal_bw; + + if (newsize < 1) newsize = 1; + + if ( IsVert(pw) ) { + request.width = off_size; + request.height = newsize; + } + else { + request.width = newsize; + request.height = off_size; + } + + if (result_ret != NULL) { + request.request_mode |= XtCWQueryOnly; + + *result_ret = XtMakeGeometryRequest( (Widget) pw, &request, &reply ); + _XawImCallVendorShellExtResize( (Widget) pw ); + + if ( (newsize == old_size) || (*result_ret == XtGeometryNo) ) { + *on_size_ret = old_size; + *off_size_ret = off_size; + return; + } + if (*result_ret != XtGeometryAlmost) { + *on_size_ret = GetRequestInfo( &request, IsVert(pw) ); + *off_size_ret = GetRequestInfo( &request, !IsVert(pw) ); + return; + } + *on_size_ret = GetRequestInfo( &reply, IsVert(pw) ); + *off_size_ret = GetRequestInfo( &reply, !IsVert(pw) ); + return; + } + + if (newsize == old_size) return; + + if (XtMakeGeometryRequest( (Widget) pw, + &request, &reply) == XtGeometryAlmost) + XtMakeGeometryRequest( (Widget) pw, &reply, &request); +} + +/* Function Name: PaneSize + * Description: returns the width or height of the pane depending + * upon the orientation we are using. + * Arguments: w - and widget. + * vertical - TRUE if this is vertically oriented pane. + * Returns: the size requested + * + * vertical - return height + * !vertical - return width + */ + +static Dimension +PaneSize(w, vertical) +Widget w; +Boolean vertical; +{ + if (vertical) return (w->core.height); + return (w->core.width); +} + +/* Function Name: GetRequestInfo + * Description: returns request information. + * Arguments: geo_struct - a geometry struct to get information out of. + * vert - TRUE if this is a vertical paned widget. + * Returns: the request information. + */ + +static Dimension +GetRequestInfo(geo_struct, vert) +XtWidgetGeometry * geo_struct; +Boolean vert; +{ + if ( vert ) return ( (Dimension) geo_struct->height); + return ( (Dimension) geo_struct->width); +} + +/* Function Name: ChoosePaneToResize. + * Description: This function chooses a pane to resize. + * They are chosen using the following rules: + * + * 1) size < max && size > min + * 2) skip adjust == FALSE + * 3) widget not its prefered height && + * this change will bring it closer && + * The user has not resized this pane. + * + * If no widgets are found that fits all the rules then + * rule #3 is broken. + * If there are still no widgets found than + * rule #2 is broken. + * Rule #1 is never broken. + * If no widgets are found then NULL is returned. + * + * Arguments: pw - the paned widget. + * paneindex - the index of the current pane. + * dir - direction to search first. + * shrink - TRUE if we need to shrink a pane, FALSE otherwise. + * Returns: pane to resize or NULL. + */ + +static Pane +ChoosePaneToResize(pw, paneindex, dir, shrink) +PanedWidget pw; +int paneindex; +Direction dir; +Boolean shrink; +{ + Widget *childP; + int rules = 3; + Direction _dir = dir; + int _index = paneindex; + + if ( (paneindex == NO_INDEX) || (dir == AnyPane) ) { /* Use defaults. */ + _dir = LowRightPane; /* Go up. - really. */ + _index = pw->paned.num_panes - 1; /* Start the last pane, and work + backwards. */ + } + childP = pw->composite.children + _index; + + /* CONSTCOND */ + while(TRUE) { + Pane pane = PaneInfo(*childP); + + if ( (rules < 3 || SatisfiesRule3(pane, shrink)) && + (rules < 2 || SatisfiesRule2(pane)) && + (SatisfiesRule1(pane, shrink)) && + ((paneindex != PaneIndex(*childP)) || (dir == AnyPane)) ) + return(pane); + +/* + * This is counter-intuitive, but if we are resizing the pane + * above the grip we want to choose a pane below the grip to lose, + * and visa-versa. + */ + + if (_dir == LowRightPane) --childP; else ++childP; + +/* + * If we have come to and edge then reduce the rule set, and try again. + * If we are reduced the rules to none, then return NULL. + */ + + if ( (childP - pw->composite.children < 0) || + (childP - pw->composite.children >= pw->paned.num_panes) ) { + if (--rules < 1) /* less strict rules. */ + return(NULL); + childP = pw->composite.children + _index; + } + } +} + +/* Function Name: StatisfiesRule1 + * Description: check for to see if this pane satisfies rule 1. + * Arguments: pane - the pane to check. + * shrink -TRUE if we want to shrink this pane, FALSE otherwise + * Returns: TRUE if the rule is satisfied. + */ + +static Boolean +SatisfiesRule1(pane, shrink) +Pane pane; +Boolean shrink; +{ + return( (shrink && (pane->size != pane->min)) || + (!shrink && (pane->size != pane->max)) ); +} + +/* Function Name: StatisfiesRule2 + * Description: check for to see if this pane satisfies rule 2. + * Arguments: pane - the pane to check. + * Returns: TRUE if the rule is satisfied. + */ + +static Boolean +SatisfiesRule2(pane) +Pane pane; +{ + return(!pane->skip_adjust || pane->paned_adjusted_me); +} + +/* Function Name: StatisfiesRule3 + * Description: check for to see if this pane satisfies rule 3. + * Arguments: pane - the pane to check. + * shrink -TRUE if we want to shrink this pane, FALSE otherwise + * Returns: TRUE if the rule is satisfied. + */ + +static Boolean +SatisfiesRule3(pane, shrink) +Pane pane; +Boolean shrink; +{ + return ( pane->paned_adjusted_me && + ( (shrink && ((int)pane->wp_size <= pane->size)) || + (!shrink && ((int)pane->wp_size >= pane->size))) ); +} + +/* Function Name: LoopAndRefigureChildren. + * Description: if we are resizing either the UpleftPane or LowRight Pane + * loop through all the children to see if any will allow us + * to resize them. + * Arguments: pw - the paned widget. + * paneindex - the number of the pane border we are moving. + * dir - the pane to move (either UpLeftPane or LowRightPane). + * sizeused - current amount of space used. + * THIS VALUE IS USED AND RETURNED. + * Returns: none. + */ + +static void +LoopAndRefigureChildren(pw, paneindex, dir, sizeused) +PanedWidget pw; +int paneindex, *sizeused; +Direction dir; +{ + int pane_size = (int) PaneSize( (Widget) pw, IsVert(pw)); + Boolean shrink = (*sizeused > pane_size); + + if (dir == LowRightPane) paneindex++; + + while (*sizeused != pane_size) { /* While all panes do not fit properly. */ +/* + * Choose a pane to resize. + * First look on the Pane Stack, and then go hunting for another one. + * If we fail to find a pane to resize then give up. + */ + Pane pane; + int start_size; + Dimension old; + Boolean rule3_ok = FALSE, from_stack = TRUE; + + GetPaneStack(pw, shrink, &pane, &start_size); + if (pane == NULL) { + pane = ChoosePaneToResize(pw, paneindex, dir, shrink); + if (pane == NULL) + return; /* no one to resize, give up. */ + + rule3_ok = SatisfiesRule3(pane, shrink); + from_stack = FALSE; + PushPaneStack(pw, pane); + } + + +/* + * Try to resize this pane so that all panes will fit, take min and max + * into account. + */ + old = pane->size; + pane->size += pane_size - *sizeused; + + if (from_stack) { + if (shrink) { + AssignMax(pane->size, start_size); + } /* don't remove these braces. */ + else + AssignMin(pane->size, start_size); + + if (pane->size == start_size) (void) PopPaneStack(pw); + } + else if (rule3_ok) { + if (shrink) { + AssignMax(pane->size, (int) pane->wp_size); + } /* don't remove these braces. */ + else + AssignMin(pane->size, (int) pane->wp_size); + } + + pane->paned_adjusted_me = (pane->size != pane->wp_size); + AssignMax(pane->size, (int) pane->min); + AssignMin(pane->size, (int) pane->max); + *sizeused += (pane->size - old); + } +} + +/* Function Name: RefigureLocations + * Description: refigures all locations of children. + * Arguments: pw - the paned widget. + * paneindex - child to start refiguring at. + * dir - direction to move from child. + * Returns: none. + * + * There are special arguments to paneindex and dir, they are: + * paneindex - NO_INDEX. + * dir - AnyPane. + * + * If either of these is true then all panes may be resized and + * the choosing of panes procedes in reverse order starting with the + * last child. + */ + +static void +RefigureLocations(pw, paneindex, dir) +PanedWidget pw; +int paneindex; +Direction dir; +{ + Widget *childP; + int pane_size = (int) PaneSize( (Widget) pw, IsVert(pw) ); + int sizeused = 0; + Position loc = 0; + + if (pw->paned.num_panes == 0 || !pw->paned.refiguremode) return; + +/* + * Get an initial estimate of the size we will use. + */ + + ForAllPanes(pw, childP) { + Pane pane = PaneInfo(*childP); + AssignMax(pane->size, (int) pane->min); + AssignMin(pane->size, (int) pane->max); + sizeused += (int) pane->size + (int) pw->paned.internal_bw; + } + sizeused -= (int) pw->paned.internal_bw; + + if ( (dir != ThisBorderOnly) && (sizeused != pane_size) ) + LoopAndRefigureChildren(pw, paneindex, dir, &sizeused); + +/* + * If we still are not the right size, then tell the pane that + * wanted to resize that it can't. + */ + + + if ( (paneindex != NO_INDEX) && (dir != AnyPane) ) { + Pane pane = PaneInfo(*(pw->composite.children + paneindex)); + Dimension old = pane->size; + + pane->size += pane_size - sizeused; + AssignMax(pane->size, (int) pane->min); + AssignMin(pane->size, (int) pane->max); + sizeused += pane->size - old; + } + +/* + * It is possible that the panes will not fit inside the vpaned widget, but + * we have tried out best. + * + * Assign each pane a location. + */ + + ForAllPanes(pw, childP) { + PaneInfo(*childP)->delta = loc; + loc += PaneInfo(*childP)->size + pw->paned.internal_bw; + } +} + +/* Function Name: CommitNewLocations + * Description: Commits all of the previously figured locations. + * Arguments: pw - the paned widget. + * Returns: none. + */ + +static void +CommitNewLocations(pw) +PanedWidget pw; +{ + Widget *childP; + XWindowChanges changes; + + changes.stack_mode = Above; + + ForAllPanes(pw, childP) { + Pane pane = PaneInfo(*childP); + Widget grip = pane->grip; /* may be NULL. */ + + if (IsVert(pw)) { + XtMoveWidget(*childP, (Position) 0, pane->delta); + XtResizeWidget(*childP, pw->core.width, (Dimension) pane->size, + (Dimension) 0); + + if (HasGrip(*childP)) { /* Move and Display the Grip */ + changes.x = pw->core.width - pw->paned.grip_indent - + grip->core.width - grip->core.border_width*2; + changes.y = (*childP)->core.y + (*childP)->core.height - + grip->core.height/2 - grip->core.border_width + + pw->paned.internal_bw/2; + } + } + else { + XtMoveWidget(*childP, pane->delta, (Position) 0); + XtResizeWidget(*childP, (Dimension) pane->size, pw->core.height, + (Dimension) 0); + + + if (HasGrip(*childP)) { /* Move and Display the Grip */ + changes.x = (*childP)->core.x + (*childP)->core.width - + grip->core.width/2 - grip->core.border_width + + pw->paned.internal_bw/2; + changes.y = pw->core.height - pw->paned.grip_indent - + grip->core.height - grip->core.border_width*2; + } + } + +/* + * This should match XtMoveWidget, except that we're also insuring the + * grip is Raised in the same request. + */ + + if (HasGrip(*childP)) { + grip->core.x = changes.x; + grip->core.y = changes.y; + + if (XtIsRealized(pane->grip)) + XConfigureWindow( XtDisplay(pane->grip), XtWindow(pane->grip), + CWX | CWY | CWStackMode, &changes ); + } + } + ClearPaneStack(pw); +} + +/* Function Name: RefigureLocationsAndCommit + * Description: Refigures all locations in a paned widget and + * commits them immediately. + * Arguments: pw - the paned widget. + * Returns: none + * + * This function does nothing if any of the following are true. + * o refiguremode is false. + * o The widget is unrealized. + * o There are no panes is the paned widget. + * + * NOTE: This is the resize Procedure for the Paned widget. + */ + +static void +RefigureLocationsAndCommit(w) +Widget w; +{ + PanedWidget pw = (PanedWidget) w; + if (pw->paned.refiguremode && XtIsRealized( (Widget) pw) && + pw->paned.num_panes > 0 ) { + RefigureLocations(pw, NO_INDEX, AnyPane); + CommitNewLocations(pw); + } +} + +/* Function Name: _DrawRect + * Description: Draws a rectangle in the proper orientation. + * Arguments: pw - the paned widget. + * gc - gc to used for the draw. + * on_olc, off_loc - location of upper left corner of rect. + * on_size, off_size - size of rectangle. + * Returns: none + */ + +static void +_DrawRect(pw, gc, on_loc, off_loc, on_size, off_size) +PanedWidget pw; +GC gc; +int on_loc, off_loc; +unsigned int on_size, off_size; +{ + if (IsVert(pw)) + XFillRectangle(XtDisplay(pw), XtWindow(pw), gc, + off_loc, on_loc, off_size, on_size); + else + XFillRectangle(XtDisplay(pw), XtWindow(pw), gc, + on_loc, off_loc, on_size, off_size); +} + +/* Function Name: _DrawInternalBorders + * Description: Draws the internal borders into the paned widget. + * Arguments: pw - the paned widget. + * gc - the GC to use to draw the borders. + * Returns: none. + */ + +static void +_DrawInternalBorders(pw, gc) +PanedWidget pw; +GC gc; +{ + Widget *childP; + int on_loc, off_loc; + unsigned int on_size, off_size; + +/* + * This is an optimization. Do not paint the internal borders if + * they are the same color as the background. + */ + + if (pw->core.background_pixel == pw->paned.internal_bp) + return; + + off_loc = 0; + off_size = (unsigned int) PaneSize( (Widget) pw, !IsVert(pw) ); + on_size = (unsigned int) pw->paned.internal_bw; + + ForAllPanes(pw, childP) { + on_loc = IsVert(pw) ? (*childP)->core.y : (*childP)->core.x; + on_loc -= (int) on_size; + + _DrawRect( pw, gc, on_loc, off_loc, on_size, off_size); + } +} + +/* + * This allows good reuse of code, as well as descriptive function names. + */ + +#define DrawInternalBorders(pw) _DrawInternalBorders((pw), (pw)->paned.normgc); +#define EraseInternalBorders(pw) _DrawInternalBorders((pw), (pw)->paned.invgc); + +/* Function Name: _DrawTrackLines + * Description: Draws the lines that animate the pane borders when the + * grips are moved. + * Arguments: pw - the Paned widget. + * erase - if True then just erase track lines, else + * draw them in. + * Returns: none. + */ + +static void +_DrawTrackLines(pw, erase) +PanedWidget pw; +Boolean erase; +{ + Widget *childP; + Pane pane; + int on_loc, off_loc; + unsigned int on_size, off_size; + + off_loc = 0; + off_size = PaneSize( (Widget) pw, !IsVert(pw)); + + ForAllPanes(pw, childP) { + pane = PaneInfo(*childP); + if ( erase || (pane->olddelta != pane->delta) ) { + on_size = pw->paned.internal_bw; + if (!erase) { + on_loc = PaneInfo(*childP)->olddelta - (int) on_size; + + _DrawRect( pw, pw->paned.flipgc, + on_loc, off_loc, on_size, off_size); + } + + on_loc = PaneInfo(*childP)->delta - (int) on_size; + + _DrawRect(pw, pw->paned.flipgc, + on_loc, off_loc, on_size, off_size); + + pane->olddelta = pane->delta; + } + } +} + +/* + * This allows good reuse of code, as well as descriptive function names. + */ + +#define DrawTrackLines(pw) _DrawTrackLines((pw), FALSE); +#define EraseTrackLines(pw) _DrawTrackLines((pw), TRUE); + +/* Function Name: GetEventLocation + * Description: Converts and event to an x and y location. + * Arguments: pw - the paned widget. + * event - a pointer to an event. + * Returns: if this is a vertical pane then (y) else (x). + */ + +static int +GetEventLocation(pw, event) +PanedWidget pw; +XEvent *event; +{ + int x, y; + + switch (event->xany.type) { + case ButtonPress: + case ButtonRelease: + x = event->xbutton.x_root; + y = event->xbutton.y_root; + break; + case KeyPress: + case KeyRelease: + x = event->xkey.x_root; + y = event->xkey.y_root; + break; + case MotionNotify: + x = event->xmotion.x_root; + y = event->xmotion.y_root; + break; + default: + x = pw->paned.start_loc; + y = pw->paned.start_loc; + } + if (IsVert(pw)) + return(y); + return(x); +} + +/* Function Name: StartGripAdjustment + * Description: Starts the grip adjustment procedure. + * Arguments: pw - the paned widget. + * grip - the grip widget selected. + * dir - the direction that we are to be moving. + * Returns: none. + */ + +static void +StartGripAdjustment(pw, grip, dir) +PanedWidget pw; +Widget grip; +Direction dir; +{ + Widget *childP; + Cursor cursor; + + pw->paned.whichadd = pw->paned.whichsub = (Widget) NULL; + + if (dir == ThisBorderOnly || dir == UpLeftPane) + pw->paned.whichadd = pw->composite.children[PaneIndex(grip)]; + if (dir == ThisBorderOnly || dir == LowRightPane) + pw->paned.whichsub = pw->composite.children[PaneIndex(grip) + 1]; + +/* + * Change the cursor. + */ + + if (XtIsRealized(grip)) { + if ( IsVert(pw) ) { + if (dir == UpLeftPane) + cursor = pw->paned.adjust_upper_cursor; + else if (dir == LowRightPane) + cursor = pw->paned.adjust_lower_cursor; + else { + if ( pw->paned.adjust_this_cursor == None) + cursor = pw->paned.v_adjust_this_cursor; + else + cursor = pw->paned.adjust_this_cursor; + } + } + else { + if (dir == UpLeftPane) + cursor = pw->paned.adjust_left_cursor; + else if (dir == LowRightPane) + cursor = pw->paned.adjust_right_cursor; + else { + if (pw->paned.adjust_this_cursor == None) + cursor = pw->paned.h_adjust_this_cursor; + else + cursor = pw->paned.adjust_this_cursor; + } + } + + XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor); + } + + EraseInternalBorders(pw); + ForAllPanes(pw, childP) + PaneInfo(*childP)->olddelta = -99; +} + +/* Function Name: MoveGripAdjustment + * Description: This routine moves all panes around when a grip is moved. + * Arguments: pw - the paned widget. + * grip - the grip that we are moving. + * dir - the direction the pane we are interested is w.r.t the + * grip. + * loc - location of pointer in proper direction. + * Returns: none. + */ + +static void +MoveGripAdjustment(pw, grip, dir, loc) +PanedWidget pw; +Widget grip; +Direction dir; +int loc; +{ + int diff, add_size = 0, sub_size = 0; + + diff = loc - pw->paned.start_loc; + + if (pw->paned.whichadd) + add_size = PaneSize(pw->paned.whichadd, IsVert(pw) ) + diff; + + if (pw->paned.whichsub) + sub_size = PaneSize(pw->paned.whichsub, IsVert(pw) ) - diff; + +/* + * If moving this border only then do not allow either of the borders + * to go beyond the min or max size allowed. + */ + + if ( (dir == ThisBorderOnly) ) { + int old_add_size = add_size, old_sub_size; + + AssignMax(add_size, (int) PaneInfo(pw->paned.whichadd)->min); + AssignMin(add_size, (int) PaneInfo(pw->paned.whichadd)->max); + if (add_size != old_add_size) + sub_size += old_add_size - add_size; + + old_sub_size = sub_size; + AssignMax(sub_size, (int) PaneInfo(pw->paned.whichsub)->min); + AssignMin(sub_size, (int) PaneInfo(pw->paned.whichsub)->max); + if (sub_size != old_sub_size) return; /* Abort to current sizes. */ + } + + if (add_size != 0) + PaneInfo(pw->paned.whichadd)->size = add_size; + if (sub_size != 0) + PaneInfo(pw->paned.whichsub)->size = sub_size; + RefigureLocations(pw, PaneIndex(grip), dir); + DrawTrackLines(pw); +} + +/* Function Name: CommitGripAdjustment + * Description: Commits the grip adjustment. + * Arguments: pw - the paned widget. + * Returns: none + */ + +static void +CommitGripAdjustment(pw) +PanedWidget pw; +{ + EraseTrackLines(pw); + CommitNewLocations(pw); + DrawInternalBorders(pw); + +/* + * Since the user selected this size then use it as the preferred size. + */ + + if (pw->paned.whichadd) { + Pane pane = PaneInfo(pw->paned.whichadd); + pane->wp_size = pane->size; + } + if (pw->paned.whichsub) { + Pane pane = PaneInfo(pw->paned.whichsub); + pane->wp_size = pane->size; + } +} + +/* Function Name: HandleGrip + * Description: Handles the grip manipulations. + * Arguments: grip - the grip widget that has been moved. + * junk - ** NOT USED ** + * call_data - data passed to us from the grip widget. + * Returns: none. + */ + +/* ARGSUSED */ +static void +HandleGrip(grip, junk, callData) +Widget grip; +XtPointer junk, callData; +{ + XawGripCallData call_data = (XawGripCallData)callData; + PanedWidget pw = (PanedWidget) XtParent(grip); + int loc; + char action_type; + Cursor cursor; + Direction direction = 0; + Arg arglist[1]; + + action_type = *call_data->params[0]; + + if (call_data->num_params == 0 || + (action_type == 'C' && call_data->num_params != 1) || + (action_type != 'C' && call_data->num_params != 2)) + XtError( "Paned GripAction has been passed incorrect parameters." ); + + if (islower(action_type)) action_type = toupper(action_type); + + loc = GetEventLocation(pw, (XEvent *) (call_data->event)); + + if (action_type != 'C') { + if ( isupper(*call_data->params[1]) ) + direction = (Direction) *call_data->params[1]; + else + direction = (Direction) toupper(*call_data->params[1]); + } + + switch (action_type) { + case 'S': /* Start adjustment */ + pw->paned.resize_children_to_pref = FALSE; + StartGripAdjustment(pw, grip, direction); + pw->paned.start_loc = loc; + break; + + case 'M': + MoveGripAdjustment(pw, grip, direction, loc); + break; + + case 'C': + XtSetArg(arglist[0], XtNcursor, &cursor); + XtGetValues(grip, arglist, (Cardinal) 1); + XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor); + CommitGripAdjustment(pw); + break; + + default: + XtError( "Paned GripAction(); 1st parameter invalid" ); + } +} + +/* Function Name: ResortChildren + * Description: Resorts the children so that all managed children + * are first. + * Arguments: pw - the paned widget. + * Returns: none. + */ + +static void +ResortChildren(pw) +PanedWidget pw; +{ + Widget * unmanagedP, * childP; + + unmanagedP = NULL; + ForAllChildren(pw, childP) { + if (!IsPane(*childP) || !XtIsManaged(*childP)) { + /* + * We only keep track of the first unmanaged pane. + */ + if (unmanagedP == NULL) + unmanagedP = childP; + } + else { /* must be a managed pane */ + /* + * If an earlier widget was not a managed pane, then swap + */ + if (unmanagedP != NULL) { + Widget child = *unmanagedP; + *unmanagedP = *childP; + *childP = child; + childP = unmanagedP; /* easiest to just back-track */ + unmanagedP = NULL; /* in case there is another managed */ + } + } + } +} + +/* Function Name: ManageAndUnmanageGrips + * Description: This function manages and unmanages the grips so that + * the managed state of each grip matches that of its pane. + * Arguments: pw - the paned widget. + * Returns: none. + */ + +static void +ManageAndUnmanageGrips(pw) +PanedWidget pw; +{ + WidgetList managed_grips, unmanaged_grips; + Widget *managedP, *unmanagedP, *childP; + Cardinal alloc_size; + + alloc_size = (Cardinal) sizeof(Widget) * pw->composite.num_children / 2; + managedP = managed_grips = (WidgetList) XtMalloc(alloc_size); + unmanagedP = unmanaged_grips = (WidgetList) XtMalloc(alloc_size); + + ForAllChildren(pw, childP) + if (IsPane(*childP) && HasGrip(*childP)) + if ( XtIsManaged(*childP) ) + *managedP++ = PaneInfo(*childP)->grip; + else + *unmanagedP++ = PaneInfo(*childP)->grip; + + if (managedP != managed_grips) { + *unmanagedP++ = *--managedP; /* Last grip is never managed */ + XtManageChildren( managed_grips, (Cardinal)(managedP - managed_grips) ); + } + + if (unmanagedP != unmanaged_grips) + XtUnmanageChildren( unmanaged_grips, + (Cardinal)(unmanagedP - unmanaged_grips) ); + + XtFree((char *)managed_grips); + XtFree((char *)unmanaged_grips); +} + +/* Function Name: CreateGrip + * Description: Creates a grip widget. + * Arguments: child - the child that wants a grip to be created for it. + * Returns: none. + */ + +static void +CreateGrip(child) +Widget child; +{ + PanedWidget pw = (PanedWidget) XtParent(child); + Arg arglist[2]; + Cardinal num_args = 0; + Cursor cursor; + + XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations); + num_args++; + if ( (cursor = pw->paned.grip_cursor) == None ) + if (IsVert(pw)) + cursor = pw->paned.v_grip_cursor; + else + cursor = pw->paned.h_grip_cursor; + + XtSetArg(arglist[num_args], XtNcursor, cursor); + num_args++; + PaneInfo(child)->grip = XtCreateWidget("grip", gripWidgetClass, (Widget)pw, + arglist, num_args); + + XtAddCallback(PaneInfo(child)->grip, XtNcallback, + HandleGrip, (XtPointer) child); +} + +/* Function Name: GetGCs + * Description: Gets new GC's. + * Arguments: w - the paned widget. + * Returns: none. + */ + +static void +GetGCs(w) +Widget w; +{ + PanedWidget pw = (PanedWidget) w; + XtGCMask valuemask; + XGCValues values; + +/* + * Draw pane borders in internal border color. + */ + + values.foreground = pw->paned.internal_bp; + valuemask = GCForeground; + pw->paned.normgc = XtGetGC(w, valuemask, &values); + +/* + * Erase pane borders with background color. + */ + + values.foreground = pw->core.background_pixel; + valuemask = GCForeground; + pw->paned.invgc = XtGetGC(w, valuemask, &values); + +/* + * Draw Track lines (animate pane borders) in internal border color ^ bg color. + */ + + values.function = GXinvert; + values.plane_mask = pw->paned.internal_bp ^ pw->core.background_pixel; + values.subwindow_mode = IncludeInferiors; + valuemask = GCPlaneMask | GCFunction | GCSubwindowMode; + pw->paned.flipgc = XtGetGC(w, valuemask, &values); +} + +/* Function Name: SetChildrenPrefSizes. + * Description: Sets the preferred sizes of the children. + * Arguments: pw - the paned widget. + * Returns: none. + */ + +static void +SetChildrenPrefSizes(pw, off_size) +PanedWidget pw; +Dimension off_size; +{ + Widget * childP; + Boolean vert = IsVert(pw); + XtWidgetGeometry request, reply; + + ForAllPanes(pw, childP) + if ( pw->paned.resize_children_to_pref || + (PaneInfo(*childP)->size == 0) || + (PaneInfo(*childP)->resize_to_pref) ) { + + if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD) + PaneInfo(*childP)->wp_size=PaneInfo(*childP)->preferred_size; + else { + if( vert ) { + request.request_mode = CWWidth; + request.width = off_size; + } + else { + request.request_mode = CWHeight; + request.height = off_size; + } + + if ((XtQueryGeometry( *childP, &request, &reply ) + == XtGeometryAlmost) && + (reply.request_mode = (vert ? CWHeight : CWWidth))) + PaneInfo(*childP)->wp_size = GetRequestInfo(&reply, vert); + else + PaneInfo(*childP)->wp_size = PaneSize(*childP, vert); + } + + PaneInfo(*childP)->size = PaneInfo(*childP)->wp_size; + } +} + +/* Function Name: ChangeAllGripCursors + * Description: Changes all the grip cursors. + * Arguments: pw - the paned widget. + * Returns: none + */ + +static void +ChangeAllGripCursors(pw) +PanedWidget pw; +{ + Widget * childP; + + ForAllPanes(pw, childP) { + Arg arglist[1]; + Cursor cursor; + + if ( (cursor = pw->paned.grip_cursor) == None ) + if ( IsVert(pw) ) + cursor = pw->paned.v_grip_cursor; + else + cursor = pw->paned.h_grip_cursor; + + if (HasGrip (*childP)) { + XtSetArg(arglist[0], XtNcursor, cursor); + XtSetValues(PaneInfo(*childP)->grip, arglist, (Cardinal) 1); + } + } +} + +/************************************************************ + * + * Stack Manipulation routines (Private). + * + ************************************************************/ + +/* Function Name: PushPaneStack + * Description: Pushes a value onto the pane stack. + * Arguments: pw - the paned widget. + * pane - the pane that we are pushing. + * Returns: none. + */ + +static void +PushPaneStack(pw, pane) +PanedWidget pw; +Pane pane; +{ + PaneStack * stack = (PaneStack *) XtMalloc(sizeof(PaneStack)); + + stack->next = pw->paned.stack; + stack->pane = pane; + stack->start_size = pane->size; + + pw->paned.stack = stack; +} + +/* Function Name: GetPaneStack + * Description: Gets the top value from the pane stack. + * Arguments: pw - the paned widget. + * shrink - TRUE if we want to shrink this pane, + * FALSE otherwise. + * ** RETURNED ** pane - the pane that we are popping. + * ** RETURNED ** start_size - the size that this pane started at. + * Returns: none. + */ + +static void +GetPaneStack(pw, shrink, pane, start_size) +PanedWidget pw; +Boolean shrink; +Pane * pane; +int * start_size; +{ + if (pw->paned.stack == NULL) { + *pane = NULL; + return; + } + + *pane = pw->paned.stack->pane; + *start_size = pw->paned.stack->start_size; + + if (shrink != ((*pane)->size > *start_size)) *pane = NULL; +} + +/* Function Name: PopPaneStack + * Description: Pops the top item off the pane stack. + * Arguments: pw - the paned widget. + * Returns: TRUE if this is not the last element on the stack. + */ + +static Boolean +PopPaneStack(pw) +PanedWidget pw; +{ + PaneStack * stack = pw->paned.stack; + + if (stack == NULL) return(FALSE); + + pw->paned.stack = stack->next; + XtFree((char*)stack); + + if (pw->paned.stack == NULL) return(FALSE); + return(TRUE); +} + +/* Function Name: ClearPaneStack + * Description: removes all entries from the pane stack. + * Arguments: pw - the paned widget. + * Returns: none + */ + +static void +ClearPaneStack(pw) +PanedWidget pw; +{ + while(PopPaneStack(pw)); +} + +/************************************************************ + * + * Semi-public routines. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: The Paned widgets class initialization proc. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, + (XtConvertArgList)NULL, (Cardinal)0 ); +} + +/* The Geometry Manager only allows changes after Realize if + * allow_resize is True in the constraints record. + * + * For vertically paned widgets: + * + * It only allows height changes, but offers the requested height + * as a compromise if both width and height changes were requested. + * + * For horizontal widgets the converse is true. + * As all good Geometry Managers should, we will return No if the + * request will have no effect; i.e. when the requestor is already + * of the desired geometry. + */ + +static XtGeometryResult GeometryManager(w, request, reply) +Widget w; +XtWidgetGeometry *request, *reply; +{ + PanedWidget pw = (PanedWidget) XtParent(w); + XtGeometryMask mask = request->request_mode; + Dimension old_size, old_wpsize, old_paned_size; + Pane pane = PaneInfo(w); + Boolean vert = IsVert(pw); + Dimension on_size, off_size; + XtGeometryResult result; + Boolean almost = FALSE; + +/* + * If any of the following is true, disallow the geometry change. + * + * o The paned widget is realized and allow_resize is false for the pane. + * o The child did not ask to change the on_size. + * o The request is not a width or height request. + * o The requested size is the same as the current size. + */ + + if ( (XtIsRealized((Widget)pw) && !pane->allow_resize) || + !(mask & ((vert) ? CWHeight : CWWidth)) || + (mask & ~(CWWidth | CWHeight)) || + (GetRequestInfo(request, vert) == PaneSize(w, vert)) ) { + return XtGeometryNo; + } + + old_paned_size = PaneSize( (Widget) pw, vert); + old_wpsize = pane->wp_size; + old_size = pane->size; + + pane->wp_size = pane->size = GetRequestInfo(request, vert); + + AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), &result, &on_size, + &off_size); + +/* + * Fool the Refigure Locations proc to thinking that we are + * a different on_size; + */ + + if (result != XtGeometryNo) + if (vert) + pw->core.height = on_size; + else + pw->core.width = on_size; + + RefigureLocations(pw, PaneIndex(w), AnyPane); + +/* + * Set up reply struct and reset core on_size. + */ + + if (vert) { + pw->core.height = old_paned_size; + reply->height = pane->size; + reply->width = off_size; + } + else { + pw->core.width = old_paned_size; + reply->height = off_size; + reply->width = pane->size; + } + +/* + * IF either of the following is true. + * + * o There was a "off_size" request and the new "off_size" is different + * from that requested. + * o There was no "off_size" request and the new "off_size" is different + * + * o The "on_size" we will allow is different from that requested. + * + * THEN: set almost + */ + + if ( !((vert ? CWWidth : CWHeight) & mask)) + if (vert) + request->width = w->core.width; + else + request->height = w->core.height; + + almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert); + almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert)); + + if ( (mask & XtCWQueryOnly) || almost ) { + pane->wp_size = old_wpsize; + pane->size = old_size; + RefigureLocations(pw, PaneIndex(w), AnyPane); + reply->request_mode = CWWidth | CWHeight; + if (almost) return XtGeometryAlmost; + } + else { + AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), + (XtGeometryResult *)NULL, + (Dimension *)NULL, (Dimension *)NULL); + CommitNewLocations( pw ); /* layout already refigured. */ + } + return XtGeometryDone; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + PanedWidget pw = (PanedWidget)new; + + GetGCs( (Widget) pw); + + pw->paned.recursively_called = False; + pw->paned.stack = NULL; + pw->paned.resize_children_to_pref = TRUE; + pw->paned.num_panes = 0; +} + +static void +Realize(w, valueMask, attributes) +Widget w; +Mask *valueMask; +XSetWindowAttributes *attributes; +{ + PanedWidget pw = (PanedWidget) w; + Widget * childP; + + if ((attributes->cursor = (pw)->paned.cursor) != None) + *valueMask |= CWCursor; + + (*SuperClass->core_class.realize) (w, valueMask, attributes); + +/* + * Before we commit the new locations we need to realize all the panes and + * their grips. + */ + + ForAllPanes(pw, childP) { + XtRealizeWidget( *childP ); + if (HasGrip (*childP)) + XtRealizeWidget( PaneInfo(*childP)->grip ); + } + + RefigureLocationsAndCommit(w); + pw->paned.resize_children_to_pref = FALSE; +} /* Realize */ + +static void +ReleaseGCs(w) +Widget w; +{ + PanedWidget pw = (PanedWidget)w; + + XtReleaseGC( w, pw->paned.normgc ); + XtReleaseGC( w, pw->paned.invgc ); + XtReleaseGC( w, pw->paned.flipgc ); +} + +static void InsertChild(w) +Widget w; +{ + Pane pane = PaneInfo(w); + + /* insert the child widget in the composite children list with the */ + /* superclass insert_child routine. */ + (*SuperClass->composite_class.insert_child)(w); + + if (!IsPane(w)) return; + + /* ||| Panes will be added in the order they are created, temporarily */ + + if ( pane->show_grip == TRUE ) { + CreateGrip(w); + if (pane->min == PANED_GRIP_SIZE) + pane->min = PaneSize(pane->grip, IsVert((PanedWidget) XtParent(w))); + } + else { + if (pane->min == PANED_GRIP_SIZE) + pane->min = 1; + pane->grip = NULL; + } + + pane->size = 0; + pane->paned_adjusted_me = FALSE; + +} /* InsertChild */ + +static void DeleteChild(w) +Widget w; +{ + /* remove the subwidget info and destroy the grip */ + + if ( IsPane(w) && HasGrip(w) ) XtDestroyWidget(PaneInfo(w)->grip); + + /* delete the child widget in the composite children list with the */ + /* superclass delete_child routine. */ + (*SuperClass->composite_class.delete_child) (w); + +} /* DeleteChild */ + +static void ChangeManaged(w) + Widget w; +{ + PanedWidget pw = (PanedWidget)w; + Boolean vert = IsVert(pw); + Dimension size; + Widget *childP; + + if (pw->paned.recursively_called++) return; + +/* + * If the size is zero then set it to the size of the widest or tallest pane. + */ + + if ( (size = PaneSize( (Widget) pw, !vert )) == 0) { + size = 1; + ForAllChildren(pw, childP) + if ( XtIsManaged(*childP) && (PaneSize( *childP, !vert ) > size) ) + size = PaneSize( *childP, !vert ); + } + + ManageAndUnmanageGrips(pw); + pw->paned.recursively_called = False; + ResortChildren(pw); + + pw->paned.num_panes = 0; + ForAllChildren(pw, childP) + if ( IsPane(*childP) ) + if ( XtIsManaged(*childP) ) { + Pane pane = PaneInfo(*childP); + if (HasGrip(*childP)) + PaneInfo(pane->grip)->position = pw->paned.num_panes; + pane->position = pw->paned.num_panes; /*TEMPORY -CDP 3/89 */ + pw->paned.num_panes++; + } + else + break; /* This list is already sorted. */ + + SetChildrenPrefSizes( (PanedWidget) w, size); + +/* + * ForAllPanes can now be used. + */ + + if ( PaneSize((Widget) pw, vert) == 0 ) + AdjustPanedSize(pw, size, (XtGeometryResult *)NULL, + (Dimension *)NULL, (Dimension *)NULL); + + if (XtIsRealized( (Widget) pw)) + RefigureLocationsAndCommit( (Widget) pw); + +} /* ChangeManaged */ + +/* Function Name: Resize + * Description: The paned widget's resize proc. + * Arguments: w - the paned widget. + * Returns: none. + */ + +static void +Resize(w) +Widget w; +{ + SetChildrenPrefSizes( (PanedWidget) w, + PaneSize(w, !IsVert((PanedWidget) w)) ); + RefigureLocationsAndCommit(w); +} + +/* ARGSUSED */ +static void +Redisplay(w, event, region) +Widget w; +XEvent * event; /* unused. */ +Region region; /* unused. */ +{ + DrawInternalBorders( (PanedWidget) w); +} + +/* ARGSUSED */ +static Boolean +SetValues(old, request, new, args, num_args) +Widget old, request, new; +ArgList args; +Cardinal *num_args; +{ + PanedWidget old_pw = (PanedWidget) old; + PanedWidget new_pw = (PanedWidget) new; + Boolean redisplay = FALSE; + + if ( (old_pw->paned.cursor != new_pw->paned.cursor) && XtIsRealized(new)) + XDefineCursor(XtDisplay(new), XtWindow(new), new_pw->paned.cursor); + + if ( (old_pw->paned.internal_bp != new_pw->paned.internal_bp) || + (old_pw->core.background_pixel != new_pw->core.background_pixel) ) { + ReleaseGCs(old); + GetGCs(new); + redisplay = TRUE; + } + + if ( (old_pw->paned.grip_cursor != new_pw->paned.grip_cursor) || + (old_pw->paned.v_grip_cursor != new_pw->paned.v_grip_cursor) || + (old_pw->paned.h_grip_cursor != new_pw->paned.h_grip_cursor) ) { + ChangeAllGripCursors(new_pw); + } + + if ( IsVert(old_pw) != IsVert(new_pw)) { +/* + * We are fooling the paned widget into thinking that is needs to + * fully refigure everything, which is what we want. + */ + if (IsVert(new_pw)) + new_pw->core.width = 0; + else + new_pw->core.height = 0; + + new_pw->paned.resize_children_to_pref = TRUE; + ChangeManaged(new); /* Seems weird, but does the right thing. */ + new_pw->paned.resize_children_to_pref = FALSE; + if (new_pw->paned.grip_cursor == None) + ChangeAllGripCursors(new_pw); + return(TRUE); + } + + if (old_pw->paned.internal_bw != new_pw->paned.internal_bw) { + AdjustPanedSize( new_pw, PaneSize(new, !IsVert(old_pw)), + (XtGeometryResult *)NULL, + (Dimension *)NULL, (Dimension *)NULL); + RefigureLocationsAndCommit(new); + return(TRUE); /* We have done a full configuration, return.*/ + } + + if ( (old_pw->paned.grip_indent != new_pw->paned.grip_indent) && + (XtIsRealized(new)) ) { + CommitNewLocations(new_pw); + redisplay = TRUE; + } + + return (redisplay); +} /* SetValues */ + + +/* ARGSUSED */ +static Boolean +PaneSetValues(old, request, new, args, num_args) +Widget old, request, new; +ArgList args; +Cardinal *num_args; +{ + Pane old_pane = PaneInfo(old); + Pane new_pane = PaneInfo(new); + Boolean redisplay = FALSE; + + /* Check for new min and max. */ + + if (old_pane->min != new_pane->min || old_pane->max != new_pane->max) + XawPanedSetMinMax(new, (int)new_pane->min, (int)new_pane->max); + + /* Check for change in XtNshowGrip. */ + + if (old_pane->show_grip != new_pane->show_grip) + if (new_pane->show_grip == TRUE) { + CreateGrip(new); + if (XtIsRealized(XtParent(new))) { + if (XtIsManaged(new)) /* if paned is unrealized this will + happen automatically at realize time.*/ + XtManageChild(PaneInfo(new)->grip); /* manage the grip. */ + XtRealizeWidget(PaneInfo(new)->grip); /* realize the grip. */ + CommitNewLocations( (PanedWidget) XtParent(new) ); + } + } + else if ( HasGrip(old) ) { + XtDestroyWidget( old_pane->grip ); + new_pane->grip = NULL; + redisplay = TRUE; + } + + /* ||| need to look at position changes */ + + return(redisplay); +} + +/************************************************************ + * + * Public routines. + * + ************************************************************/ + +/* Function Name: XawPanedSetMinMax + * Description: Sets the min and max size for a pane. + * Arguments: widget - the widget that is a child of the Paned widget. + * min, max - the new min and max size for the pane. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawPanedSetMinMax(Widget widget, int min, int max) +#else +XawPanedSetMinMax(widget, min, max) +Widget widget; +int min, max; +#endif +{ + Pane pane = PaneInfo(widget); + + pane->min = min; + pane->max = max; + RefigureLocationsAndCommit( widget->core.parent ); +} + +/* Function Name: XawPanedGetMinMax + * Description: Gets the min and max size for a pane. + * Arguments: widget - the widget that is a child of the Paned widget. + ** RETURNED ** min, max - the current min and max size for the pane. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawPanedGetMinMax(Widget widget, int *min, int *max) +#else +XawPanedGetMinMax(widget, min, max) +Widget widget; +int *min, *max; +#endif +{ + Pane pane = PaneInfo(widget); + + *min = pane->min; + *max = pane->max; +} + +/* Function Name: XawPanedSetRefigureMode + * Description: Allows a flag to be set the will inhibit + * the paned widgets relayout routine. + * Arguments: w - the paned widget. + * mode - if FALSE then inhibit refigure. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawPanedSetRefigureMode(Widget w, +#if NeedWidePrototypes + int mode) +#else + Boolean mode) +#endif +#else +XawPanedSetRefigureMode(w, mode) +Widget w; +Boolean mode; +#endif +{ + ((PanedWidget) w)->paned.refiguremode = mode; + RefigureLocationsAndCommit( w ); +} + +/* Function Name: XawPanedGetNumSub + * Description: Returns the number of panes in the paned widget. + * Arguments: w - the paned widget. + * Returns: the number of panes in the paned widget. + */ + +int +#if NeedFunctionPrototypes +XawPanedGetNumSub(Widget w) +#else +XawPanedGetNumSub(w) +Widget w; +#endif +{ + return ((PanedWidget)w)->paned.num_panes; +} + +/* Function Name: XawPanedAllowResize + * Description: Allows a flag to be set that determines if the paned + * widget will allow geometry requests from this child + * Arguments: widget - a child of the paned widget. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawPanedAllowResize(Widget widget, +#if NeedWidePrototypes + int allow_resize) +#else + Boolean allow_resize) +#endif +#else +XawPanedAllowResize(widget, allow_resize) +Widget widget; +Boolean allow_resize; +#endif +{ + PaneInfo(widget)->allow_resize = allow_resize; +} diff --git a/vendor/x11iraf/xaw3d/Paned.h b/vendor/x11iraf/xaw3d/Paned.h new file mode 100644 index 00000000..6b37346a --- /dev/null +++ b/vendor/x11iraf/xaw3d/Paned.h @@ -0,0 +1,256 @@ +/* +* $XConsortium: Paned.h,v 1.15 94/04/17 20:12:29 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Paned.h - Paned Composite Widget's public header file. + * + * Updated and significantly modifided from the Athena VPaned Widget. + * + * Date: March 1, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawPaned_h +#define _XawPaned_h + +#include <X11/Constraint.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * Vertical Paned Widget (SubClass of CompositeClass) + * + ****************************************************************/ + +/* RESOURCES: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + betweenCursor Cursor Cursor ** + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + gripIndent GripIndent Position 16 + gripCursor Cursor Cursor ** + horizontalGripCursol Cursor Cursor sb_h_double_arrow + horizontalBetweencursor Cursor Cursor sb_up_arrow + internalBorderColor BorderColor Pixel XtDefaultForeground + internalBorderWidth BorderWidth Position 1 + leftCursor Cursor Cursor sb_left_arrow + lowerCursor Cursor Cursor sb_down_arrow + mappedWhenManaged MappedWhenManaged Boolean True + orientation Orientation XtOrientation XtorientVertical + refigureMode Boolean Boolean On + rightCursor Cursor Cursor sb_right_arrow + sensitive Sensitive Boolean True + upperCursor Cursor Cursor sb_up_arrow + verticalBetweenCursor Cursor Cursor sb_left_arrow + verticalGripCursor Cursor Cursor sb_v_double_arrow + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +** These resources now are set to the vertical or horizontal cursor + depending upon orientation, by default. If a value is specified here + then that cursor will be used reguardless of orientation. + + +CONSTRAINT RESOURCES: + + Name Class RepType Default Value + ---- ----- ------- ------------- + allowResize Boolean Boolean False + max Max Dimension unlimited + min Min Dimension Grip Size + preferredPaneSize PerferredPaneSize Dimension PANED_ASK_CHILD + resizeToPreferred Boolean Boolean False + showGrip ShowGrip Boolean True + skipAdjust Boolean Boolean False + +*/ + +#define PANED_ASK_CHILD 0 +#define PANED_GRIP_SIZE 0 + +/* New Fields */ +#define XtNallowResize "allowResize" +#define XtNbetweenCursor "betweenCursor" +#define XtNverticalBetweenCursor "verticalBetweenCursor" +#define XtNhorizontalBetweenCursor "horizontalBetweenCursor" +#define XtNgripCursor "gripCursor" +#define XtNgripIndent "gripIndent" +#define XtNhorizontalGripCursor "horizontalGripCursor" +#define XtNinternalBorderColor "internalBorderColor" +#define XtNinternalBorderWidth "internalBorderWidth" +#define XtNleftCursor "leftCursor" +#define XtNlowerCursor "lowerCursor" +#define XtNrefigureMode "refigureMode" +#define XtNposition "position" +#define XtNmin "min" +#define XtNmax "max" +#define XtNpreferredPaneSize "preferredPaneSize" +#define XtNresizeToPreferred "resizeToPreferred" +#define XtNrightCursor "rightCursor" +#define XtNshowGrip "showGrip" +#define XtNskipAdjust "skipAdjust" +#define XtNupperCursor "upperCursor" +#define XtNverticalGripCursor "verticalGripCursor" + +#define XtCGripIndent "GripIndent" +#define XtCMin "Min" +#define XtCMax "Max" +#define XtCPreferredPaneSize "PreferredPaneSize" +#define XtCShowGrip "ShowGrip" + +/* Class record constant */ +extern WidgetClass panedWidgetClass; + +typedef struct _PanedClassRec *PanedWidgetClass; +typedef struct _PanedRec *PanedWidget; + +/************************************************************ + * + * Public Procedures + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawPanedSetMinMax + * Description: Sets the min and max size for a pane. + * Arguments: widget - the widget that is a child of the Paned widget. + * min, max - the new min and max size for the pane. + * Returns: none. + */ + +extern void XawPanedSetMinMax( +#if NeedFunctionPrototypes + Widget /* w */, + int /* min */, + int /* max */ +#endif +); + +/* Function Name: XawPanedGetMinMax + * Description: Gets the min and max size for a pane. + * Arguments: widget - the widget that is a child of the Paned widget. + ** RETURNED ** min, max - the current min and max size for the pane. + * Returns: none. + */ + +extern void XawPanedGetMinMax( +#if NeedFunctionPrototypes + Widget /* w */, + int * /* min_return */, + int * /* max_return */ +#endif +); + +/* Function Name: XawPanedSetRefigureMode + * Description: Allows a flag to be set the will inhibit + * the paned widgets relayout routine. + * Arguments: w - the paned widget. + * mode - if FALSE then inhibit refigure. + * Returns: none. + */ + +extern void XawPanedSetRefigureMode( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* mode */ +#else + Boolean /* mode */ +#endif +#endif +); + +/* Function Name: XawPanedGetNumSub + * Description: Returns the number of panes in the paned widget. + * Arguments: w - the paned widget. + * Returns: the number of panes in the paned widget. + */ + +extern int XawPanedGetNumSub( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawPanedAllowResize + * Description: Allows a flag to be set that determines if the paned + * widget will allow geometry requests from this child + * Arguments: widget - a child of the paned widget. + * Returns: none. + */ + +extern void XawPanedAllowResize( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* allow_resize */ +#else + Boolean /* allow_resize */ +#endif +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawPaned_h */ diff --git a/vendor/x11iraf/xaw3d/PanedP.h b/vendor/x11iraf/xaw3d/PanedP.h new file mode 100644 index 00000000..57c410b7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/PanedP.h @@ -0,0 +1,193 @@ +/*********************************************************** + + $XConsortium: PanedP.h,v 1.6 94/04/17 20:12:30 gildea Exp $ + + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * PanedP.h - Paned Composite Widget's private header file. + * + * Updated and significantly modified from the Athena VPaned Widget. + * + * Date: March 1, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawPanedP_h +#define _XawPanedP_h + +#include <X11/Xaw3d/Paned.h> + +/********************************************************************* + * + * Paned Widget Private Data + * + *********************************************************************/ + +/* New fields for the Paned widget class record */ + +typedef struct _PanedClassPart { + int foo; /* keep compiler happy. */ +} PanedClassPart; + +/* Full Class record declaration */ +typedef struct _PanedClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + PanedClassPart paned_class; +} PanedClassRec; + +extern PanedClassRec panedClassRec; + +/* Paned constraint record */ +typedef struct _PanedConstraintsPart { + /* Resources. */ + Dimension min; /* Minimum height */ + Dimension max; /* Maximum height */ + Boolean allow_resize; /* TRUE iff child resize requests are ok */ + Boolean show_grip; /* TRUE iff child will have grip below it, + when it is not the bottom pane. */ + Boolean skip_adjust; /* TRUE iff child's height should not be */ + /* changed without explicit user action. */ + int position; /* position location in Paned (relative to + other children) ** NIY ** */ + Dimension preferred_size; /* The Preferred size of the pane. + Iff this is zero then ask child for size.*/ + Boolean resize_to_pref; /* resize this pane to its preferred size + on a resize or change managed after + realize. */ + + /* Private state. */ + Position delta; /* Desired Location */ + Position olddelta; /* The last value of dy. */ + Boolean paned_adjusted_me; /* Has the vpaned adjusted this widget w/o + user interaction to make things fit? */ + Dimension wp_size; /* widget's preferred size */ + int size; /* the size the widget will actually get. */ + Widget grip; /* The grip for this child */ + +} PanedConstraintsPart, *Pane; + +typedef struct _PanedConstraintsRec { + PanedConstraintsPart paned; +} PanedConstraintsRec, *PanedConstraints; + +/* + * The Pane Stack Structure. + */ + +typedef struct _PaneStack { + struct _PaneStack * next; /* The next element on the stack. */ + Pane pane; /* The pane in this element on the stack. */ + int start_size; /* The size of this element when it was pushed + onto the stack. */ +} PaneStack; + +/* New Fields for the Paned widget record */ +typedef struct { + /* resources */ + Position grip_indent; /* Location of grips (offset + from right margin) */ + Boolean refiguremode; /* Whether to refigure changes + right now */ + XtTranslations grip_translations; /* grip translation table */ + Pixel internal_bp; /* color of internal borders. */ + Dimension internal_bw; /* internal border width. */ + XtOrientation orientation; /* Orientation of paned widget. */ + + Cursor cursor; /* Cursor for paned window */ + Cursor grip_cursor; /* inactive grip cursor */ + Cursor v_grip_cursor; /* inactive vert grip cursor */ + Cursor h_grip_cursor; /* inactive horiz grip cursor */ + Cursor adjust_this_cursor; /* active grip cursor: T */ + Cursor v_adjust_this_cursor; /* active vert grip cursor: T */ + Cursor h_adjust_this_cursor; /* active horiz grip cursor: T */ + + /* vertical. */ + Cursor adjust_upper_cursor; /* active grip cursor: U */ + Cursor adjust_lower_cursor; /* active grip cursor: D */ + + /* horizontal. */ + Cursor adjust_left_cursor; /* active grip cursor: U */ + Cursor adjust_right_cursor; /* active grip cursor: D */ + + /* private */ + Boolean recursively_called; /* for ChangeManaged */ + Boolean resize_children_to_pref; /* override constrain resources + and resize all children to + preferred size. */ + int start_loc; /* mouse origin when adjusting */ + Widget whichadd; /* Which pane to add changes to */ + Widget whichsub; /* Which pane to sub changes from */ + GC normgc; /* GC to use when drawing borders */ + GC invgc; /* GC to use when erasing borders */ + GC flipgc; /* GC to use when animating + borders */ + int num_panes; /* count of managed panes */ + PaneStack * stack; /* The pane stack for this widget.*/ +} PanedPart; + +/************************************************************************** + * + * Full instance record declaration + * + **************************************************************************/ + +typedef struct _PanedRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + PanedPart paned; +} PanedRec; + +#endif /* _XawPanedP_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/xaw3d/Panner.c b/vendor/x11iraf/xaw3d/Panner.c new file mode 100644 index 00000000..df9abac5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Panner.c @@ -0,0 +1,957 @@ +/* + * $XConsortium: Panner.c,v 1.52 95/01/10 14:31:26 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> /* for XtN and XtC defines */ +#include <X11/Xmu/CharSet.h> /* for XmuCompareISOLatin1() */ +#include <X11/Xaw3d/XawInit.h> /* for XawInitializeWidgetSet */ +#include <X11/Xaw3d/PannerP.h> /* us */ +#include <X11/Xos.h> +#include <X11/Xmu/Misc.h> /* for Min */ +#include <X11/Xmu/Drawing.h> +#include <ctype.h> /* for isascii() etc. */ +#include <math.h> /* for atof() */ + +extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */ + +#if defined(ISC) && __STDC__ && !defined(ISC30) +extern double atof(char *); +#endif + +static char defaultTranslations[] = + "<Btn1Down>: start() \n\ + <Btn1Motion>: move() \n\ + <Btn1Up>: notify() stop() \n\ + <Btn2Down>: abort() \n\ + :<Key>KP_Enter: set(rubberband,toggle) \n\ + <Key>space: page(+1p,+1p) \n\ + <Key>Delete: page(-1p,-1p) \n\ + :<Key>KP_Delete: page(-1p,-1p) \n\ + <Key>BackSpace: page(-1p,-1p) \n\ + <Key>Left: page(-.5p,+0) \n\ + :<Key>KP_Left: page(-.5p,+0) \n\ + <Key>Right: page(+.5p,+0) \n\ + :<Key>KP_Right: page(+.5p,+0) \n\ + <Key>Up: page(+0,-.5p) \n\ + :<Key>KP_Up: page(+0,-.5p) \n\ + <Key>Down: page(+0,+.5p) \n\ + :<Key>KP_Down: page(+0,+.5p) \n\ + <Key>Home: page(0,0) \n\ + :<Key>KP_Home: page(0,0)"; + + +static void ActionStart(), ActionStop(), ActionAbort(), ActionMove(); +static void ActionPage(), ActionNotify(), ActionSet(); + +static XtActionsRec actions[] = { + { "start", ActionStart }, /* start tmp graphics */ + { "stop", ActionStop }, /* stop tmp graphics */ + { "abort", ActionAbort }, /* punt */ + { "move", ActionMove }, /* move tmp graphics on Motion event */ + { "page", ActionPage }, /* page around usually from keyboard */ + { "notify", ActionNotify }, /* callback new position */ + { "set", ActionSet }, /* set various parameters */ +}; + + +/* + * resources for the panner + */ +static XtResource resources[] = { +#define poff(field) XtOffsetOf(PannerRec, panner.field) + { XtNallowOff, XtCAllowOff, XtRBoolean, sizeof(Boolean), + poff(allow_off), XtRImmediate, (XtPointer) FALSE }, + { XtNresize, XtCResize, XtRBoolean, sizeof(Boolean), + poff(resize_to_pref), XtRImmediate, (XtPointer) TRUE }, + { XtNreportCallback, XtCReportCallback, XtRCallback, sizeof(XtPointer), + poff(report_callbacks), XtRCallback, (XtPointer) NULL }, + { XtNdefaultScale, XtCDefaultScale, XtRDimension, sizeof(Dimension), + poff(default_scale), XtRImmediate, (XtPointer) PANNER_DEFAULT_SCALE }, + { XtNrubberBand, XtCRubberBand, XtRBoolean, sizeof(Boolean), + poff(rubber_band), XtRImmediate, (XtPointer) FALSE }, + { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + poff(foreground), XtRString, (XtPointer) XtDefaultBackground }, + { XtNinternalSpace, XtCInternalSpace, XtRDimension, sizeof(Dimension), + poff(internal_border), XtRImmediate, (XtPointer) 4 }, + { XtNlineWidth, XtCLineWidth, XtRDimension, sizeof(Dimension), + poff(line_width), XtRImmediate, (XtPointer) 0 }, + { XtNcanvasWidth, XtCCanvasWidth, XtRDimension, sizeof(Dimension), + poff(canvas_width), XtRImmediate, (XtPointer) 0 }, + { XtNcanvasHeight, XtCCanvasHeight, XtRDimension, sizeof(Dimension), + poff(canvas_height), XtRImmediate, (XtPointer) 0 }, + { XtNsliderX, XtCSliderX, XtRPosition, sizeof(Position), + poff(slider_x), XtRImmediate, (XtPointer) 0 }, + { XtNsliderY, XtCSliderY, XtRPosition, sizeof(Position), + poff(slider_y), XtRImmediate, (XtPointer) 0 }, + { XtNsliderWidth, XtCSliderWidth, XtRDimension, sizeof(Dimension), + poff(slider_width), XtRImmediate, (XtPointer) 0 }, + { XtNsliderHeight, XtCSliderHeight, XtRDimension, sizeof(Dimension), + poff(slider_height), XtRImmediate, (XtPointer) 0 }, + { XtNshadowColor, XtCShadowColor, XtRPixel, sizeof(Pixel), + poff(shadow_color), XtRString, (XtPointer) XtDefaultForeground }, + { XtNshadowThickness, XtCShadowThickness, XtRDimension, sizeof(Dimension), + poff(shadow_thickness), XtRImmediate, (XtPointer) 2 }, + { XtNbackgroundStipple, XtCBackgroundStipple, XtRString, sizeof(String), + poff(stipple_name), XtRImmediate, (XtPointer) NULL }, +#undef poff +}; + + +/* + * widget class methods used below + */ +static void Initialize(); /* create gc's */ +static void Realize(); /* create window */ +static void Destroy(); /* clean up widget */ +static void Resize(); /* need to rescale ourselves */ +static void Redisplay(); /* draw ourselves */ +static Boolean SetValues(); /* set all of the resources */ +static void SetValuesAlmost(); /* deal with failed setval geom req */ +static XtGeometryResult QueryGeometry(); /* say how big we would like to be */ + +PannerClassRec pannerClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "Panner", + /* widget_size */ sizeof(PannerRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ SetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* panner fields */ + /* ignore */ 0 + } +}; + +WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec; + + +/***************************************************************************** + * * + * panner utility routines * + * * + *****************************************************************************/ + +static void reset_shadow_gc (pw) /* used when resources change */ + PannerWidget pw; +{ + XtGCMask valuemask = GCForeground; + XGCValues values; + unsigned long pixels[3]; + + if (pw->panner.shadow_gc) XtReleaseGC ((Widget) pw, pw->panner.shadow_gc); + + pixels[0] = pw->panner.foreground; + pixels[1] = pw->core.background_pixel; + pixels[2] = pw->panner.shadow_color; + if (!pw->panner.stipple_name && + !XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, + pixels, 3) && + XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, + pixels, 2)) + { + valuemask = GCTile | GCFillStyle; + values.fill_style = FillTiled; + values.tile = XmuCreateStippledPixmap(XtScreen((Widget)pw), + pw->panner.foreground, + pw->core.background_pixel, + pw->core.depth); + } + else + { + if (!pw->panner.line_width && + !XmuDistinguishablePixels (XtDisplay (pw), pw->core.colormap, + pixels, 2)) + pw->panner.line_width = 1; + valuemask = GCForeground; + values.foreground = pw->panner.shadow_color; + } + if (pw->panner.line_width > 0) { + values.line_width = pw->panner.line_width; + valuemask |= GCLineWidth; + } + + pw->panner.shadow_gc = XtGetGC ((Widget) pw, valuemask, &values); +} + +static void reset_slider_gc (pw) /* used when resources change */ + PannerWidget pw; +{ + XtGCMask valuemask = GCForeground; + XGCValues values; + + if (pw->panner.slider_gc) XtReleaseGC ((Widget) pw, pw->panner.slider_gc); + + values.foreground = pw->panner.foreground; + + pw->panner.slider_gc = XtGetGC ((Widget) pw, valuemask, &values); +} + +static void reset_xor_gc (pw) /* used when resources change */ + PannerWidget pw; +{ + if (pw->panner.xor_gc) XtReleaseGC ((Widget) pw, pw->panner.xor_gc); + + if (pw->panner.rubber_band) { + XtGCMask valuemask = (GCForeground | GCFunction); + XGCValues values; + Pixel tmp; + + tmp = ((pw->panner.foreground == pw->core.background_pixel) ? + pw->panner.shadow_color : pw->panner.foreground); + values.foreground = tmp ^ pw->core.background_pixel; + values.function = GXxor; + if (pw->panner.line_width > 0) { + valuemask |= GCLineWidth; + values.line_width = pw->panner.line_width; + } + pw->panner.xor_gc = XtGetGC ((Widget) pw, valuemask, &values); + } else { + pw->panner.xor_gc = NULL; + } +} + + +static void check_knob (pw, knob) + PannerWidget pw; + Boolean knob; +{ + Position pad = pw->panner.internal_border * 2; + Position maxx = (((Position) pw->core.width) - pad - + ((Position) pw->panner.knob_width)); + Position maxy = (((Position) pw->core.height) - pad - + ((Position) pw->panner.knob_height)); + Position *x = (knob ? &pw->panner.knob_x : &pw->panner.tmp.x); + Position *y = (knob ? &pw->panner.knob_y : &pw->panner.tmp.y); + + /* + * note that positions are already normalized (i.e. internal_border + * has been subtracted out) + */ + if (*x < 0) *x = 0; + if (*x > maxx) *x = maxx; + + if (*y < 0) *y = 0; + if (*y > maxy) *y = maxy; + + if (knob) { + pw->panner.slider_x = (Position) (((double) pw->panner.knob_x) / + pw->panner.haspect + 0.5); + pw->panner.slider_y = (Position) (((double) pw->panner.knob_y) / + pw->panner.vaspect + 0.5); + pw->panner.last_x = pw->panner.last_y = PANNER_OUTOFRANGE; + } +} + + +static void move_shadow (pw) + PannerWidget pw; +{ + if (pw->panner.shadow_thickness > 0) { + int lw = pw->panner.shadow_thickness + pw->panner.line_width * 2; + int pad = pw->panner.internal_border; + + if ((int)pw->panner.knob_height > lw && (int)pw->panner.knob_width > lw) { + XRectangle *r = pw->panner.shadow_rects; + r->x = (short) (pw->panner.knob_x + pad + pw->panner.knob_width); + r->y = (short) (pw->panner.knob_y + pad + lw); + r->width = pw->panner.shadow_thickness; + r->height = (unsigned short) (pw->panner.knob_height - lw); + r++; + r->x = (short) (pw->panner.knob_x + pad + lw); + r->y = (short) (pw->panner.knob_y + pad + pw->panner.knob_height); + r->width = (unsigned short) (pw->panner.knob_width - lw + + pw->panner.shadow_thickness); + r->height = pw->panner.shadow_thickness; + pw->panner.shadow_valid = TRUE; + return; + } + } + pw->panner.shadow_valid = FALSE; +} + +static void scale_knob (pw, location, size) /* set knob size and/or loc */ + PannerWidget pw; + Boolean location, size; +{ + if (location) { + pw->panner.knob_x = (Position) PANNER_HSCALE (pw, pw->panner.slider_x); + pw->panner.knob_y = (Position) PANNER_VSCALE (pw, pw->panner.slider_y); + } + if (size) { + Dimension width, height; + + if (pw->panner.slider_width < 1) { + pw->panner.slider_width = pw->panner.canvas_width; + } + if (pw->panner.slider_height < 1) { + pw->panner.slider_height = pw->panner.canvas_height; + } + width = Min (pw->panner.slider_width, pw->panner.canvas_width); + height = Min (pw->panner.slider_height, pw->panner.canvas_height); + + pw->panner.knob_width = (Dimension) PANNER_HSCALE (pw, width); + pw->panner.knob_height = (Dimension) PANNER_VSCALE (pw, height); + } + if (!pw->panner.allow_off) check_knob (pw, TRUE); + move_shadow (pw); +} + +static void rescale (pw) + PannerWidget pw; +{ + int hpad = pw->panner.internal_border * 2; + int vpad = hpad; + + if (pw->panner.canvas_width < 1) + pw->panner.canvas_width = pw->core.width; + if (pw->panner.canvas_height < 1) + pw->panner.canvas_height = pw->core.height; + + if ((int)pw->core.width <= hpad) hpad = 0; + if ((int)pw->core.height <= vpad) vpad = 0; + + pw->panner.haspect = ((double) pw->core.width - hpad) / + (double) pw->panner.canvas_width; + pw->panner.vaspect = ((double) pw->core.height - vpad) / + (double) pw->panner.canvas_height; + scale_knob (pw, TRUE, TRUE); +} + + +static void get_default_size (pw, wp, hp) + PannerWidget pw; + Dimension *wp, *hp; +{ + Dimension pad = pw->panner.internal_border * 2; + *wp = PANNER_DSCALE (pw, pw->panner.canvas_width) + pad; + *hp = PANNER_DSCALE (pw, pw->panner.canvas_height) + pad; +} + +static Boolean get_event_xy (pw, event, x, y) + PannerWidget pw; + XEvent *event; + int *x, *y; +{ + int pad = pw->panner.internal_border; + + switch (event->type) { + case ButtonPress: + case ButtonRelease: + *x = event->xbutton.x - pad; + *y = event->xbutton.y - pad; + return TRUE; + + case KeyPress: + case KeyRelease: + *x = event->xkey.x - pad; + *y = event->xkey.y - pad; + return TRUE; + + case EnterNotify: + case LeaveNotify: + *x = event->xcrossing.x - pad; + *y = event->xcrossing.y - pad; + return TRUE; + + case MotionNotify: + *x = event->xmotion.x - pad; + *y = event->xmotion.y - pad; + return TRUE; + } + + return FALSE; +} + +static int parse_page_string (s, pagesize, canvassize, relative) + char *s; + int pagesize, canvassize; + Boolean *relative; +{ + char *cp; + double val = 1.0; + Boolean rel = FALSE; + + /* + * syntax: spaces [+-] number spaces [pc\0] spaces + */ + + for (; isascii(*s) && isspace(*s); s++) ; /* skip white space */ + + if (*s == '+' || *s == '-') { /* deal with signs */ + rel = TRUE; + if (*s == '-') val = -1.0; + s++; + } + if (!*s) { /* if null then return nothing */ + *relative = TRUE; + return 0; + } + + /* skip over numbers */ + for (cp = s; isascii(*s) && (isdigit(*s) || *s == '.'); s++) ; + val *= atof (cp); + + /* skip blanks */ + for (; isascii(*s) && isspace(*s); s++) ; + + if (*s) { /* if units */ + switch (s[0]) { + case 'p': case 'P': + val *= (double) pagesize; + break; + + case 'c': case 'C': + val *= (double) canvassize; + break; + } + } + *relative = rel; + return ((int) val); +} + + +#define DRAW_TMP(pw) \ +{ \ + XDrawRectangle (XtDisplay(pw), XtWindow(pw), \ + pw->panner.xor_gc, \ + (int) (pw->panner.tmp.x + pw->panner.internal_border), \ + (int) (pw->panner.tmp.y + pw->panner.internal_border), \ + (unsigned int) (pw->panner.knob_width - 1), \ + (unsigned int) (pw->panner.knob_height - 1)); \ + pw->panner.tmp.showing = !pw->panner.tmp.showing; \ +} + +#define UNDRAW_TMP(pw) \ +{ \ + if (pw->panner.tmp.showing) DRAW_TMP(pw); \ +} + +#define BACKGROUND_STIPPLE(pw) \ + XmuLocatePixmapFile (pw->core.screen, pw->panner.stipple_name, \ + pw->panner.shadow_color, pw->core.background_pixel, \ + pw->core.depth, NULL, 0, NULL, NULL, NULL, NULL) + +#define PIXMAP_OKAY(pm) ((pm) != None && (pm) != XtUnspecifiedPixmap) + + +/***************************************************************************** + * * + * panner class methods * + * * + *****************************************************************************/ + + +/*ARGSUSED*/ +static void Initialize (greq, gnew, args, num_args) + Widget greq, gnew; + ArgList args; + Cardinal *num_args; +{ + PannerWidget req = (PannerWidget) greq, new = (PannerWidget) gnew; + Dimension defwidth, defheight; + + if (req->panner.canvas_width < 1) new->panner.canvas_width = 1; + if (req->panner.canvas_height < 1) new->panner.canvas_height = 1; + if (req->panner.default_scale < 1) + new->panner.default_scale = PANNER_DEFAULT_SCALE; + + get_default_size (req, &defwidth, &defheight); + if (req->core.width < 1) new->core.width = defwidth; + if (req->core.height < 1) new->core.height = defheight; + + new->panner.shadow_gc = NULL; + reset_shadow_gc (new); /* shadowColor */ + new->panner.slider_gc = NULL; + reset_slider_gc (new); /* foreground */ + new->panner.xor_gc = NULL; + reset_xor_gc (new); /* foreground ^ background */ + + rescale (new); /* does a position check */ + new->panner.shadow_valid = FALSE; + new->panner.tmp.doing = FALSE; + new->panner.tmp.showing = FALSE; +} + + +static void Realize (gw, valuemaskp, attr) + Widget gw; + XtValueMask *valuemaskp; + XSetWindowAttributes *attr; +{ + PannerWidget pw = (PannerWidget) gw; + Pixmap pm = XtUnspecifiedPixmap; + Boolean gotpm = FALSE; + + if (pw->core.background_pixmap == XtUnspecifiedPixmap) { + if (pw->panner.stipple_name) pm = BACKGROUND_STIPPLE (pw); + + if (PIXMAP_OKAY(pm)) { + attr->background_pixmap = pm; + *valuemaskp |= CWBackPixmap; + *valuemaskp &= ~CWBackPixel; + gotpm = TRUE; + } + } + (*pannerWidgetClass->core_class.superclass->core_class.realize) + (gw, valuemaskp, attr); + + if (gotpm) XFreePixmap (XtDisplay(gw), pm); +} + + +static void Destroy (gw) + Widget gw; +{ + PannerWidget pw = (PannerWidget) gw; + + XtReleaseGC (gw, pw->panner.shadow_gc); + XtReleaseGC (gw, pw->panner.slider_gc); + XtReleaseGC (gw, pw->panner.xor_gc); +} + + +static void Resize (gw) + Widget gw; +{ + rescale ((PannerWidget) gw); +} + + +/* ARGSUSED */ +static void Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + PannerWidget pw = (PannerWidget) gw; + Display *dpy = XtDisplay(gw); + Window w = XtWindow(gw); + int pad = pw->panner.internal_border; + Dimension lw = pw->panner.line_width; + Dimension extra = pw->panner.shadow_thickness + lw * 2; + int kx = pw->panner.knob_x + pad, ky = pw->panner.knob_y + pad; + + pw->panner.tmp.showing = FALSE; + XClearArea (XtDisplay(pw), XtWindow(pw), + (int) pw->panner.last_x - ((int) lw) + pad, + (int) pw->panner.last_y - ((int) lw) + pad, + (unsigned int) (pw->panner.knob_width + extra), + (unsigned int) (pw->panner.knob_height + extra), + False); + pw->panner.last_x = pw->panner.knob_x; + pw->panner.last_y = pw->panner.knob_y; + + XFillRectangle (dpy, w, pw->panner.slider_gc, kx, ky, + pw->panner.knob_width - 1, pw->panner.knob_height - 1); + + if (lw) + { + XDrawRectangle (dpy, w, pw->panner.shadow_gc, kx, ky, + (unsigned int) (pw->panner.knob_width - 1), + (unsigned int) (pw->panner.knob_height - 1)); + } + + if (pw->panner.shadow_valid) { + XFillRectangles (dpy, w, pw->panner.shadow_gc, + pw->panner.shadow_rects, 2); + } + if (pw->panner.tmp.doing && pw->panner.rubber_band) DRAW_TMP (pw); +} + + +/* ARGSUSED */ +static Boolean SetValues (gcur, greq, gnew, args, num_args) + Widget gcur, greq, gnew; + ArgList args; + Cardinal *num_args; +{ + PannerWidget cur = (PannerWidget) gcur; + PannerWidget new = (PannerWidget) gnew; + Boolean redisplay = FALSE; + + if (cur->panner.foreground != new->panner.foreground) { + reset_slider_gc (new); + if (cur->panner.foreground != cur->core.background_pixel) + reset_xor_gc (new); + redisplay = TRUE; + } else if (cur->panner.line_width != new->panner.line_width || + cur->core.background_pixel != new->core.background_pixel) { + reset_xor_gc (new); + redisplay = TRUE; + } + if (cur->panner.shadow_color != new->panner.shadow_color) { + reset_shadow_gc (new); + if (cur->panner.foreground == cur->core.background_pixel) + reset_xor_gc (new); + redisplay = TRUE; + } + if (cur->panner.shadow_thickness != new->panner.shadow_thickness) { + move_shadow (new); + redisplay = TRUE; + } + if (cur->panner.rubber_band != new->panner.rubber_band) { + reset_xor_gc (new); + if (new->panner.tmp.doing) redisplay = TRUE; + } + + if ((cur->panner.stipple_name != new->panner.stipple_name || + cur->panner.shadow_color != new->panner.shadow_color || + cur->core.background_pixel != new->core.background_pixel) && + XtIsRealized(gnew)) { + Pixmap pm = (new->panner.stipple_name ? BACKGROUND_STIPPLE (new) + : XtUnspecifiedPixmap); + + if (PIXMAP_OKAY(pm)) { + XSetWindowBackgroundPixmap (XtDisplay (new), XtWindow(new), pm); + XFreePixmap (XtDisplay (new), pm); + } else { + XSetWindowBackground (XtDisplay (new), XtWindow(new), + new->core.background_pixel); + } + redisplay = TRUE; + } + + if (new->panner.resize_to_pref && + (cur->panner.canvas_width != new->panner.canvas_width || + cur->panner.canvas_height != new->panner.canvas_height || + cur->panner.resize_to_pref != new->panner.resize_to_pref)) { + get_default_size (new, &new->core.width, &new->core.height); + redisplay = TRUE; + } else if (cur->panner.canvas_width != new->panner.canvas_width || + cur->panner.canvas_height != new->panner.canvas_height || + cur->panner.internal_border != new->panner.internal_border) { + rescale (new); /* does a scale_knob as well */ + redisplay = TRUE; + } else { + Boolean loc = (cur->panner.slider_x != new->panner.slider_x || + cur->panner.slider_y != new->panner.slider_y); + Boolean siz = (cur->panner.slider_width != new->panner.slider_width || + cur->panner.slider_height != new->panner.slider_height); + if (loc || siz || + (cur->panner.allow_off != new->panner.allow_off && + new->panner.allow_off)) { + scale_knob (new, loc, siz); + redisplay = TRUE; + } + } + + return redisplay; +} + +static void SetValuesAlmost (gold, gnew, req, reply) + Widget gold, gnew; + XtWidgetGeometry *req, *reply; +{ + if (reply->request_mode == 0) { /* got turned down, so cope */ + Resize (gnew); + } + (*pannerWidgetClass->core_class.superclass->core_class.set_values_almost) + (gold, gnew, req, reply); +} + +static XtGeometryResult QueryGeometry (gw, intended, pref) + Widget gw; + XtWidgetGeometry *intended, *pref; +{ + PannerWidget pw = (PannerWidget) gw; + + pref->request_mode = (CWWidth | CWHeight); + get_default_size (pw, &pref->width, &pref->height); + + if (((intended->request_mode & (CWWidth | CWHeight)) == + (CWWidth | CWHeight)) && + intended->width == pref->width && + intended->height == pref->height) + return XtGeometryYes; + else if (pref->width == pw->core.width && pref->height == pw->core.height) + return XtGeometryNo; + else + return XtGeometryAlmost; +} + + +/***************************************************************************** + * * + * panner action procs * + * * + *****************************************************************************/ + +/* ARGSUSED */ +static void ActionStart (gw, event, params, num_params) + Widget gw; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + PannerWidget pw = (PannerWidget) gw; + int x, y; + + if (!get_event_xy (pw, event, &x, &y)) { + XBell (XtDisplay(gw), 0); /* should do error message */ + return; + } + + pw->panner.tmp.doing = TRUE; + pw->panner.tmp.startx = pw->panner.knob_x; + pw->panner.tmp.starty = pw->panner.knob_y; + pw->panner.tmp.dx = (((Position) x) - pw->panner.knob_x); + pw->panner.tmp.dy = (((Position) y) - pw->panner.knob_y); + pw->panner.tmp.x = pw->panner.knob_x; + pw->panner.tmp.y = pw->panner.knob_y; + if (pw->panner.rubber_band) DRAW_TMP (pw); +} + +/* ARGSUSED */ +static void ActionStop (gw, event, params, num_params) + Widget gw; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + PannerWidget pw = (PannerWidget) gw; + int x, y; + + if (get_event_xy (pw, event, &x, &y)) { + pw->panner.tmp.x = ((Position) x) - pw->panner.tmp.dx; + pw->panner.tmp.y = ((Position) y) - pw->panner.tmp.dy; + if (!pw->panner.allow_off) check_knob (pw, FALSE); + } + if (pw->panner.rubber_band) UNDRAW_TMP (pw); + pw->panner.tmp.doing = FALSE; +} + +/* ARGSUSED */ +static void ActionAbort (gw, event, params, num_params) + Widget gw; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + PannerWidget pw = (PannerWidget) gw; + + if (!pw->panner.tmp.doing) return; + + if (pw->panner.rubber_band) UNDRAW_TMP (pw); + + if (!pw->panner.rubber_band) { /* restore old position */ + pw->panner.tmp.x = pw->panner.tmp.startx; + pw->panner.tmp.y = pw->panner.tmp.starty; + ActionNotify (gw, event, params, num_params); + } + pw->panner.tmp.doing = FALSE; +} + + +/* ARGSUSED */ +static void ActionMove (gw, event, params, num_params) + Widget gw; + XEvent *event; /* must be a motion event */ + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + PannerWidget pw = (PannerWidget) gw; + int x, y; + + if (!pw->panner.tmp.doing) return; + + if (!get_event_xy (pw, event, &x, &y)) { + XBell (XtDisplay(gw), 0); /* should do error message */ + return; + } + + if (pw->panner.rubber_band) UNDRAW_TMP (pw); + pw->panner.tmp.x = ((Position) x) - pw->panner.tmp.dx; + pw->panner.tmp.y = ((Position) y) - pw->panner.tmp.dy; + + if (!pw->panner.rubber_band) { + ActionNotify (gw, event, params, num_params); /* does a check */ + } else { + if (!pw->panner.allow_off) check_knob (pw, FALSE); + DRAW_TMP (pw); + } +} + + +/* ARGSUSED */ +static void ActionPage (gw, event, params, num_params) + Widget gw; + XEvent *event; /* unused */ + String *params; + Cardinal *num_params; /* unused */ +{ + PannerWidget pw = (PannerWidget) gw; + Cardinal zero = 0; + Boolean isin = pw->panner.tmp.doing; + int x, y; + Boolean relx, rely; + int pad = pw->panner.internal_border * 2; + + if (*num_params != 2) { + XBell (XtDisplay(gw), 0); + return; + } + + x = parse_page_string (params[0], (int) pw->panner.knob_width, + ((int) pw->core.width) - pad, &relx); + y = parse_page_string (params[1], (int) pw->panner.knob_height, + ((int) pw->core.height) - pad, &rely); + + if (relx) x += pw->panner.knob_x; + if (rely) y += pw->panner.knob_y; + + if (isin) { /* if in, then use move */ + XEvent ev; + ev.xbutton.type = ButtonPress; + ev.xbutton.x = x; + ev.xbutton.y = y; + ActionMove (gw, &ev, (String *) NULL, &zero); + } else { /* else just do it */ + pw->panner.tmp.doing = TRUE; + pw->panner.tmp.x = x; + pw->panner.tmp.y = y; + ActionNotify (gw, event, (String *) NULL, &zero); + pw->panner.tmp.doing = FALSE; + } +} + + +/* ARGSUSED */ +static void ActionNotify (gw, event, params, num_params) + Widget gw; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + PannerWidget pw = (PannerWidget) gw; + + if (!pw->panner.tmp.doing) return; + + if (!pw->panner.allow_off) check_knob (pw, FALSE); + pw->panner.knob_x = pw->panner.tmp.x; + pw->panner.knob_y = pw->panner.tmp.y; + move_shadow (pw); + + pw->panner.slider_x = (Position) (((double) pw->panner.knob_x) / + pw->panner.haspect + 0.5); + pw->panner.slider_y = (Position) (((double) pw->panner.knob_y) / + pw->panner.vaspect + 0.5); + if (!pw->panner.allow_off) { + Position tmp; + + if (pw->panner.slider_x > + (tmp = (((Position) pw->panner.canvas_width) - + ((Position) pw->panner.slider_width)))) + pw->panner.slider_x = tmp; + if (pw->panner.slider_x < 0) pw->panner.slider_x = 0; + if (pw->panner.slider_y > + (tmp = (((Position) pw->panner.canvas_height) - + ((Position) pw->panner.slider_height)))) + pw->panner.slider_y = tmp; + if (pw->panner.slider_y < 0) pw->panner.slider_y = 0; + } + + if (pw->panner.last_x != pw->panner.knob_x || + pw->panner.last_y != pw->panner.knob_y) { + XawPannerReport rep; + + Redisplay (gw, (XEvent*) NULL, (Region) NULL); + rep.changed = (XawPRSliderX | XawPRSliderY); + rep.slider_x = pw->panner.slider_x; + rep.slider_y = pw->panner.slider_y; + rep.slider_width = pw->panner.slider_width; + rep.slider_height = pw->panner.slider_height; + rep.canvas_width = pw->panner.canvas_width; + rep.canvas_height = pw->panner.canvas_height; + XtCallCallbackList (gw, pw->panner.report_callbacks, (XtPointer) &rep); + } +} + +/* ARGSUSED */ +static void ActionSet (gw, event, params, num_params) + Widget gw; + XEvent *event; /* unused */ + String *params; + Cardinal *num_params; +{ + PannerWidget pw = (PannerWidget) gw; + Boolean rb; + + if (*num_params < 2 || + XmuCompareISOLatin1 (params[0], "rubberband") != 0) { + XBell (XtDisplay(gw), 0); + return; + } + + if (XmuCompareISOLatin1 (params[1], "on") == 0) { + rb = TRUE; + } else if (XmuCompareISOLatin1 (params[1], "off") == 0) { + rb = FALSE; + } else if (XmuCompareISOLatin1 (params[1], "toggle") == 0) { + rb = !pw->panner.rubber_band; + } else { + XBell (XtDisplay(gw), 0); + return; + } + + if (rb != pw->panner.rubber_band) { + Arg args[1]; + XtSetArg (args[0], XtNrubberBand, rb); + XtSetValues (gw, args, (Cardinal) 1); + } +} diff --git a/vendor/x11iraf/xaw3d/Panner.h b/vendor/x11iraf/xaw3d/Panner.h new file mode 100644 index 00000000..ed0cdfe3 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Panner.h @@ -0,0 +1,108 @@ +/* + * $XConsortium: Panner.h,v 1.22 94/04/17 20:12:32 rws Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPanner_h +#define _XawPanner_h + +#include <X11/Xaw3d/Reports.h> + +/***************************************************************************** + * + * Panner Widget (subclass of Simple) + * + * This widget is used to represent navigation in a 2d coordinate system. + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * allowOff AllowOff Boolean FALSE + * background Background Pixel XtDefaultBackground + * backgroundStipple BackgroundStipple String NULL + * canvasWidth CanvasWidth Dimension 0 + * canvasHeight CanvasHeight Dimension 0 + * defaultScale DefaultScale Dimension 8 percent + * foreground Foreground Pixel XtDefaultBackground + * internalSpace InternalSpace Dimension 4 + * lineWidth LineWidth Dimension 0 + * reportCallback ReportCallback XtCallbackList NULL + * resize Resize Boolean TRUE + * rubberBand RubberBand Boolean FALSE + * shadowColor ShadowColor Pixel XtDefaultForeground + * shadowThickness ShadowThickness Dimension 2 + * sliderX SliderX Position 0 + * sliderY SliderY Position 0 + * sliderWidth SliderWidth Dimension 0 + * sliderHeight SliderHeight Dimension 0 + * + *****************************************************************************/ + + /* new instance and class names */ +#ifndef _XtStringDefs_h_ +#define XtNresize "resize" +#define XtCResize "Resize" +#endif + +#define XtNallowOff "allowOff" +#define XtCAllowOff "AllowOff" +#define XtNbackgroundStipple "backgroundStipple" +#define XtCBackgroundStipple "BackgroundStipple" +#define XtNdefaultScale "defaultScale" +#define XtCDefaultScale "DefaultScale" +#define XtNcanvasWidth "canvasWidth" +#define XtCCanvasWidth "CanvasWidth" +#define XtNcanvasHeight "canvasHeight" +#define XtCCanvasHeight "CanvasHeight" +#define XtNinternalSpace "internalSpace" +#define XtCInternalSpace "InternalSpace" +#define XtNlineWidth "lineWidth" +#define XtCLineWidth "LineWidth" +#define XtNrubberBand "rubberBand" +#define XtCRubberBand "RubberBand" +#define XtNshadowThickness "shadowThickness" +#define XtCShadowThickness "ShadowThickness" +#define XtNshadowColor "shadowColor" +#define XtCShadowColor "ShadowColor" +#define XtNsliderX "sliderX" +#define XtCSliderX "SliderX" +#define XtNsliderY "sliderY" +#define XtCSliderY "SliderY" +#define XtNsliderWidth "sliderWidth" +#define XtCSliderWidth "SliderWidth" +#define XtNsliderHeight "sliderHeight" +#define XtCSliderHeight "SliderHeight" + + /* external declarations */ +extern WidgetClass pannerWidgetClass; + +typedef struct _PannerClassRec *PannerWidgetClass; +typedef struct _PannerRec *PannerWidget; + +#endif /* _XawPanner_h */ diff --git a/vendor/x11iraf/xaw3d/PannerP.h b/vendor/x11iraf/xaw3d/PannerP.h new file mode 100644 index 00000000..2662929b --- /dev/null +++ b/vendor/x11iraf/xaw3d/PannerP.h @@ -0,0 +1,104 @@ +/* + * $XConsortium: PannerP.h,v 1.19 94/04/17 20:12:33 jim Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPannerP_h +#define _XawPannerP_h + +#include <X11/Xaw3d/Panner.h> +#include <X11/Xaw3d/SimpleP.h> /* parent */ + +typedef struct { /* new fields in widget class */ + int dummy; +} PannerClassPart; + +typedef struct _PannerClassRec { /* Panner widget class */ + CoreClassPart core_class; + SimpleClassPart simple_class; + PannerClassPart panner_class; +} PannerClassRec; + +typedef struct { /* new fields in widget */ + /* resources... */ + XtCallbackList report_callbacks; /* callback/Callback */ + Boolean allow_off; /* allowOff/AllowOff */ + Boolean resize_to_pref; /* resizeToPreferred/Boolean */ + Pixel foreground; /* foreground/Foreground */ + Pixel shadow_color; /* shadowColor/ShadowColor */ + Dimension shadow_thickness; /* shadowThickness/ShadowThickness */ + Dimension default_scale; /* defaultScale/DefaultScale */ + Dimension line_width; /* lineWidth/LineWidth */ + Dimension canvas_width; /* canvasWidth/CanvasWidth */ + Dimension canvas_height; /* canvasHeight/CanvasHeight */ + Position slider_x; /* sliderX/SliderX */ + Position slider_y; /* sliderY/SliderY */ + Dimension slider_width; /* sliderWidth/SliderWidth */ + Dimension slider_height; /* sliderHeight/SliderHeight */ + Dimension internal_border; /* internalBorderWidth/BorderWidth */ + String stipple_name; /* backgroundStipple/BackgroundStipple */ + /* private data... */ + GC slider_gc; /* background of slider */ + GC shadow_gc; /* edge of slider and shadow */ + GC xor_gc; /* for doing XOR tmp graphics */ + double haspect, vaspect; /* aspect ratio of core to canvas */ + Boolean rubber_band; /* true = rubber band, false = move */ + struct { + Boolean doing; /* tmp graphics in progress */ + Boolean showing; /* true if tmp graphics displayed */ + Position startx, starty; /* initial position of slider */ + Position dx, dy; /* offset loc for tmp graphics */ + Position x, y; /* location for tmp graphics */ + } tmp; + Position knob_x, knob_y; /* real upper left of knob in canvas */ + Dimension knob_width, knob_height; /* real size of knob in canvas */ + Boolean shadow_valid; /* true if rects are valid */ + XRectangle shadow_rects[2]; /* location of shadows */ + Position last_x, last_y; /* previous location of knob */ +} PannerPart; + +typedef struct _PannerRec { + CorePart core; + SimplePart simple; + PannerPart panner; +} PannerRec; + +#define PANNER_HSCALE(pw,val) ((pw)->panner.haspect * ((double) (val))) +#define PANNER_VSCALE(pw,val) ((pw)->panner.vaspect * ((double) (val))) + +#define PANNER_DSCALE(pw,val) (Dimension) \ + ((((unsigned long) (val)) * (unsigned long) pw->panner.default_scale) / 100L) +#define PANNER_DEFAULT_SCALE 8 /* percent */ + +#define PANNER_OUTOFRANGE -30000 + +/* + * external declarations + */ +extern PannerClassRec pannerClassRec; + +#endif /* _XawPannerP_h */ diff --git a/vendor/x11iraf/xaw3d/Porthole.c b/vendor/x11iraf/xaw3d/Porthole.c new file mode 100644 index 00000000..56ea9a8b --- /dev/null +++ b/vendor/x11iraf/xaw3d/Porthole.c @@ -0,0 +1,366 @@ +/* + * $XConsortium: Porthole.c,v 1.16 94/04/17 20:12:34 kaleb Exp $ + * +Copyright (c) 1990, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + * + * This widget is a trivial clipping widget. It is typically used with a + * panner or scrollbar to navigate. + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> /* get XtN and XtC defines */ +#include <X11/Xaw3d/XawInit.h> /* get Xaw initialize stuff */ +#include <X11/Xaw3d/PortholeP.h> /* get porthole structs */ +#include <X11/Xmu/Misc.h> /* for MAX */ + + +/* + * resources for the porthole + */ +static XtResource resources[] = { +#define poff(field) XtOffsetOf(PortholeRec, porthole.field) + { XtNreportCallback, XtCReportCallback, XtRCallback, sizeof(XtPointer), + poff(report_callbacks), XtRCallback, (XtPointer) NULL }, +#undef poff +}; + + +/* + * widget class methods used below + */ +static void Realize(); /* set gravity and upcall */ +static void Resize(); /* report new size */ +static XtGeometryResult GeometryManager(); /* deal with child requests */ +static void ChangeManaged(); /* somebody added a new widget */ +static XtGeometryResult QueryGeometry(); /* say how big would like to be */ + +PortholeClassRec portholeClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &compositeClassRec, + /* class_name */ "Porthole", + /* widget_size */ sizeof(PortholeRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ NULL, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* composite fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, + { /* porthole fields */ + /* ignore */ 0 + } +}; + +WidgetClass portholeWidgetClass = (WidgetClass) &portholeClassRec; + + +/***************************************************************************** + * * + * utility routines * + * * + *****************************************************************************/ + +static Widget find_child (pw) + PortholeWidget pw; +{ + Widget *children; + int i; + + /* + * Find the managed child on which we should operate. Ignore multiple + * managed children. + */ + for (i = 0, children = pw->composite.children; + i < pw->composite.num_children; i++, children++) { + if (XtIsManaged(*children)) return *children; + } + + return (Widget) NULL; +} + +static void SendReport (pw, changed) + PortholeWidget pw; + unsigned int changed; +{ + Widget child = find_child (pw); + + if (pw->porthole.report_callbacks && child) { + XawPannerReport prep; + + prep.changed = changed; + prep.slider_x = -child->core.x; /* porthole is "inner" */ + prep.slider_y = -child->core.y; /* child is outer since it is larger */ + prep.slider_width = pw->core.width; + prep.slider_height = pw->core.height; + prep.canvas_width = child->core.width; + prep.canvas_height = child->core.height; + XtCallCallbackList ((Widget)pw, pw->porthole.report_callbacks, + (XtPointer) &prep); + } +} + + +static void layout_child (pw, child, geomp, xp, yp, widthp, heightp) + PortholeWidget pw; + Widget child; + XtWidgetGeometry *geomp; + Position *xp, *yp; + Dimension *widthp, *heightp; +{ + Position minx, miny; + + *xp = child->core.x; /* default to current values */ + *yp = child->core.y; + *widthp = child->core.width; + *heightp = child->core.height; + if (geomp) { /* mix in any requested changes */ + if (geomp->request_mode & CWX) *xp = geomp->x; + if (geomp->request_mode & CWY) *yp = geomp->y; + if (geomp->request_mode & CWWidth) *widthp = geomp->width; + if (geomp->request_mode & CWHeight) *heightp = geomp->height; + } + + /* + * Make sure that the child is at least as large as the porthole; there + * is no maximum size. + */ + if (*widthp < pw->core.width) *widthp = pw->core.width; + if (*heightp < pw->core.height) *heightp = pw->core.height; + + /* + * Make sure that the child is still on the screen. Note that this must + * be done *after* the size computation so that we know where to put it. + */ + minx = ((Position) pw->core.width) - ((Position) *widthp); + miny = ((Position) pw->core.height) - ((Position) *heightp); + + if (*xp < minx) *xp = minx; /* keep at lower right corner */ + if (*yp < miny) *yp = miny; + + if (*xp > 0) *xp = 0; /* keep at upper left corner */ + if (*yp > 0) *yp = 0; +} + + + +/***************************************************************************** + * * + * Porthole Widget Class Methods * + * * + *****************************************************************************/ + + +static void Realize (gw, valueMask, attributes) + Widget gw; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + attributes->bit_gravity = NorthWestGravity; + *valueMask |= CWBitGravity; + + if (gw->core.width < 1) gw->core.width = 1; + if (gw->core.height < 1) gw->core.height = 1; + (*portholeWidgetClass->core_class.superclass->core_class.realize) + (gw, valueMask, attributes); +} + + +static void Resize (gw) + Widget gw; +{ + PortholeWidget pw = (PortholeWidget) gw; + Widget child = find_child (pw); + + /* + * If we have a child, we need to make sure that it is at least as big + * as we are and in the right place. + */ + if (child) { + Position x, y; + Dimension width, height; + + layout_child (pw, child, (XtWidgetGeometry *)NULL, + &x, &y, &width, &height); + XtConfigureWidget (child, x, y, width, height, (Dimension) 0); + } + + SendReport (pw, (unsigned int) (XawPRCanvasWidth | XawPRCanvasHeight)); +} + + +static XtGeometryResult QueryGeometry (gw, intended, preferred) + Widget gw; + XtWidgetGeometry *intended, *preferred; +{ + PortholeWidget pw = (PortholeWidget) gw; + Widget child = find_child (pw); + + if (child) { +#define SIZEONLY (CWWidth | CWHeight) + preferred->request_mode = SIZEONLY; + preferred->width = child->core.width; + preferred->height = child->core.height; + + if (((intended->request_mode & SIZEONLY) == SIZEONLY) && + intended->width == preferred->width && + intended->height == preferred->height) + return XtGeometryYes; + else if (preferred->width == pw->core.width && + preferred->height == pw->core.height) + return XtGeometryNo; + else + return XtGeometryAlmost; +#undef SIZEONLY + } + return XtGeometryNo; +} + + +static XtGeometryResult GeometryManager (w, req, reply) + Widget w; + XtWidgetGeometry *req, *reply; +{ + PortholeWidget pw = (PortholeWidget) w->core.parent; + Widget child = find_child (pw); + Boolean okay = TRUE; + + if (child != w) return XtGeometryNo; /* unknown child */ + + *reply = *req; /* assume we'll grant everything */ + + if ((req->request_mode & CWBorderWidth) && req->border_width != 0) { + reply->border_width = 0; /* require border width of 0 */ + okay = FALSE; + } + + layout_child (pw, child, req, &reply->x, &reply->y, + &reply->width, &reply->height); + + if ((req->request_mode & CWX) && req->x != reply->x) okay = FALSE; + if ((req->request_mode & CWY) && req->x != reply->x) okay = FALSE; + if ((req->request_mode & CWWidth) && req->width != reply->width) + okay = FALSE; + if ((req->request_mode & CWHeight) && req->height != reply->height) + okay = FALSE; + + + /* + * If we failed on anything, simply return without touching widget + */ + if (!okay) return XtGeometryAlmost; + + /* + * If not just doing a query, update widget and send report. Note that + * we will often set fields that weren't requested because we want to keep + * the child visible. + */ + if (!(req->request_mode & XtCWQueryOnly)) { + unsigned int changed = 0; + + if (child->core.x != reply->x) { + changed |= XawPRSliderX; + child->core.x = reply->x; + } + if (child->core.y != reply->y) { + changed |= XawPRSliderY; + child->core.y = reply->y; + } + if (child->core.width != reply->width) { + changed |= XawPRSliderWidth; + child->core.width = reply->width; + } + if (child->core.height != reply->height) { + changed |= XawPRSliderHeight; + child->core.height = reply->height; + } + if (changed) SendReport (pw, changed); + } + + return XtGeometryYes; /* success! */ +} + + +static void ChangeManaged (gw) + Widget gw; +{ + PortholeWidget pw = (PortholeWidget) gw; + Widget child = find_child (pw); /* ignore extra children */ + + if (child) { + if (!XtIsRealized (gw)) { + XtWidgetGeometry geom, retgeom; + + geom.request_mode = 0; + if (pw->core.width == 0) { + geom.width = child->core.width; + geom.request_mode |= CWWidth; + } + if (pw->core.height == 0) { + geom.height = child->core.height; + geom.request_mode |= CWHeight; + } + if (geom.request_mode && + XtMakeGeometryRequest (gw, &geom, &retgeom) == XtGeometryAlmost) { + (void) XtMakeGeometryRequest (gw, &retgeom, (XtWidgetGeometry *)NULL); + } + } + + XtResizeWidget (child, Max (child->core.width, pw->core.width), + Max (child->core.height, pw->core.height), 0); + + SendReport (pw, (unsigned int) XawPRAll); + } +} diff --git a/vendor/x11iraf/xaw3d/Porthole.h b/vendor/x11iraf/xaw3d/Porthole.h new file mode 100644 index 00000000..18cac791 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Porthole.h @@ -0,0 +1,64 @@ +/* + * $XConsortium: Porthole.h,v 1.2 94/04/17 20:12:35 jim Exp $ + * +Copyright (c) 1990 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPorthole_h +#define _XawPorthole_h + +#include <X11/Xaw3d/Reports.h> + +/***************************************************************************** + * + * Porthole Widget (subclass of Composite) + * + * This widget is similar to a viewport without scrollbars. Child movement + * is done by external panners or scrollbars. + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * background Background Pixel XtDefaultBackground + * border BorderColor Pixel XtDefaultForeground + * borderWidth BorderWidth Dimension 1 + * height Height Dimension 0 + * reportCallback ReportCallback Pointer NULL + * width Width Dimension 0 + * x Position Position 0 + * y Position Position 0 + * + *****************************************************************************/ + + /* external declarations */ + +extern WidgetClass portholeWidgetClass; +typedef struct _PortholeClassRec *PortholeWidgetClass; +typedef struct _PortholeRec *PortholeWidget; + +#endif /* _XawPorthole_h */ diff --git a/vendor/x11iraf/xaw3d/PortholeP.h b/vendor/x11iraf/xaw3d/PortholeP.h new file mode 100644 index 00000000..2c1d5864 --- /dev/null +++ b/vendor/x11iraf/xaw3d/PortholeP.h @@ -0,0 +1,65 @@ +/* + * $XConsortium: PortholeP.h,v 1.3 94/04/17 20:12:36 kaleb Exp $ + * +Copyright (c) 1990, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawPortholeP_h +#define _XawPortholeP_h + +#include <X11/Xaw3d/Porthole.h> + +typedef struct { /* new fields in widget class */ + int dummy; +} PortholeClassPart; + +typedef struct _PortholeClassRec { /* Porthole widget class */ + CoreClassPart core_class; + CompositeClassPart composite_class; + PortholeClassPart porthole_class; +} PortholeClassRec; + + +typedef struct { /* new fields in widget */ + /* resources... */ + XtCallbackList report_callbacks; /* callback/Callback */ + /* private data... */ +} PortholePart; + +typedef struct _PortholeRec { + CorePart core; + CompositePart composite; + PortholePart porthole; +} PortholeRec; + + +/* + * external declarations + */ +extern PortholeClassRec portholeClassRec; + + +#endif /* _XawPortholeP_h */ diff --git a/vendor/x11iraf/xaw3d/README.XAW3D b/vendor/x11iraf/xaw3d/README.XAW3D new file mode 100644 index 00000000..6dcaa975 --- /dev/null +++ b/vendor/x11iraf/xaw3d/README.XAW3D @@ -0,0 +1,213 @@ + + Three-D Athena Widgets (Xaw3d) + Kaleb S. KEITHLEY + kaleb@opengroup.org + + +NOTICE: + + This file must be included with any source or binary version of Xaw3d + or any Xaw-like library based on Xaw3d. If you hack the sources and + distribute libraries from your hacked sources, you MUST include this + file as is, without modification, with your libraries. NO EXCEPTIONS. + + +Features: + + This is Release 1.5 (14 May, 1998) of a set of 3-D widgets based + on the R6.1/R6.3/R6.4 Athena Widget set. The Three-D Athena may be + used as a general replacement for the Athena (Xaw) Widget set. + + In general, you may relink almost any Athena Widget based application + with the Three-D Athena Widget set and obtain a three dimensional + appearance on some of the widgets. On systems with shared libraries, + you can usually replace your shared libXaw with libXaw3d and obtain + the three dimensional appearance without even relinking. + + Top and bottom shadow colors, shadow width, top and bottom shadow + contrast should be self explanatory, and may be set via the usual + and customary methods, e.g. app-defaults, .Xdefaults, programmatically, + with editres, etc. The user data resource may be used to "hang" + application specific data on a widget, and is only settable + programmatically. + + +Changes in this release: + + Some bug fixes. + + +Known problems: + + o You may not be be able to replace shared libXaw with libXaw3d on + systems with SVR3 style shared libraries. + + o Xaw3d pixel allocation doesn't behave well when beNiceToColormap + is False and the Default Colormap is full. + + o The samples in Layout.h are wrong and don't work. Example programs + written by Keith Packard that use the Layout widget are available + on ftp://ftp.x.org/R5contrib/Layout.tar.Z + + o The lexer in the Layout widget doesn't work well when a program + that uses the Layout widget is linked with GNU malloc. This + is a problem on older releases of Linux, where the libc malloc + is GNU malloc. It's also a problem on older releases of FreeBSD + if you have specified "ExtraLibraries -lgnumalloc" in your imake + config FreeBSD.cf file. (Undoubtedly this is also a problem on the + other BSDen too, but I don't know this for a fact.) The solution + for FreeBSD is to delete the ExtraLibraries in your vendor.cf file, + or edit the Makefile to not link with -lgnumalloc. I don't have a + solution for Linux users, nor do I have the time (or the inclination) + to track this down. If you do, and you discover a fix, you're more + than welcome to send it to me. + + o If your program subclasses Athena's Simple or Sme classes, or + subclasses thereof, then there's a definite chance that Xaw3d + isn't source-code compatible with your widgets. Sorry. I have no + plans to fix this. + + +Notes on Building Xaw3d Outside an X Source Tree: + + The source is intended to be built inside an R6.[134] source tree. + You can use an X Consortium source tree (R6.1, R6.3), an X Project + Team source tree (R6.4), or any XFree86 source tree that corresponds + to one of the X Consortium or X Project Team source trees. + + You might be able to build it outside the source tree, but if you + try, (pay attention here) YOU'RE ON YOUR OWN. Don't send me email + about it. Don't send me email telling me you "...know you're on + your own, but..." It's hard enough to find time to put out these + releases, I don't have time for handholding if you choose to + disregard this advice. + + If you don't have a source tree, for whatever reason, plan on using + binaries built by someone else. I'm sorry, that's just the way it has + to be. + + Some people have written to me and told me that if you add the + following line to the Imakefile: + + EXTRA_INCLUDES=-I. + + then you can build it anywhere you want, i.e. outside the R6 source + tree. If this works for you, great. If not, see above. To simplify + things a bit I've already added this line to the Imakefile. Just + uncomment it (by deleting the '#' at the beginning of the line. + + +Additions, bug-fixes, improvements, etc.: + + Many people have written to me with enhancements and bug fixes. + If your enhancement or bug fix didn't make it into this release + then please understand that I'm very busy with other work and I + have very little time to devote to Xaw3d. Your enhancement may + appear in some future release. + + +xterm: + + A comment that appears in the xterm source: + * + * ...There be serious and nasty dragons here. + * + + xterm is, well, xterm. The auto-scroll in the arrow-style scrollbar + doesn't work in xterm because it relies on XtTimeouts. xterm, perhaps + in the name of speed, circumvents XtAppNextEvent() and goes direct to + XNextEvent() to get it's XEvents, with the unfortunate side effect of + completely ignoring "other sources" like timeouts. At this time I + do not have a patch to fix the R6 xterm. There is a patch to the R5 + xterm on ftp://ftp.x.org/contrib/widgets/Xaw3d/R5. It shouldn't be + hard to integrate it into the R6 sources. + + +Getting: + + Xaw3d may be found on: + + ftp://ftp.x.org/contrib/widgets/Xaw3d/R6.3/Xaw3d-1.5.tar.gz + + and mirror sites around the world. + + +Building: + + Untar the distribution from the base of your X Consortium or XFree86 + source tree with the command: + + `gunzip -c Xaw3d-1.5.tar.gz | tar xpf -` + + or (if your system's tar supports the 'z' option) + + `tar xzpf Xaw3d-1.5.tar.gz` + + + (PAY ATTENTION HERE: If you don't know where the base of your + source tree is, don't send me email asking -- I don't know where + you put it. If you don't know, my guess is that you don't have one.) + + This will create the directory .../xc/lib/Xaw3d. 'cd' there and + enter the following commands: + + `../../config/imake/imake -I../../config/cf -DTOPDIR=../.. -DCURRENTDIR=lib/Xaw3d` + `make includes; make depend; make; make install` + + +Building with Arrow Scrollbars: + + The default Xaw3d does not use arrow scrollbars. The Imakefile + contains the line: + + # EXTRA_DEFINES = -DARROW_SCROLLBAR -DUSEGRAY + + If you want the arrow-scrollbar, then uncomment the line by deleting + the '#'. -DUSEGRAY will do something different with the shadows. If + you don't want it, edit the line accordingly. + + The Imakefile uses the Xaw symbols in .../xc/config/cf, so if you have + debugging, profiling, shared libs, etc. specified for Xaw, you'll get + them in Xaw3d too. + + +Using: + + Just relink your Xaw based application with -lXaw3d. + + To obtain an appearance similar to another well know widget set, use the + following resources: + *background: LightSkyBlue + *shapeStyle: Rectangle + *beNiceToColormap: False + + By default, Label widgets do not have shadows drawn for them. You can + force shadows to be drawn for specifying: + *Label*shadowWidth: 2 + + If you'd like the default behavior (i.e. not 3-D) on pulldown menus, use: + *SmeBSB*shadowWidth: 0 + + +Credits (in chronological order of their contribution): + + All the people at the X Consortium + + Achille Hui (eillihca@drizzle.stanford.edu) + Robert Withrow (witr@rwwa.com) + Malcolm Strickland (chuck-strickland@orl.mmc.com + David Flanagan (david@ora.com) + Jamie Zawinski (jwz@netscape.com) + Frank Terhaar-Yonkers (fty@bizarre.trpnc.epa.gov) + Mike Schulze (mike@cs.curtin.edu.au) + Gustaf Neumann (neumann@mohegan.wi-inf.uni-essen.de) + Jerry Whelan (guru@stasi.bradley.edu) + Mark Rawling (mwr@mel.dit.csiro.au) + Tim Theisen (tim@cs.wisc.edu) + Mitch Trachtenberg (mitch@mta.com) + Keith Packard (keithp@ncd.com) + Dimitrios P. Bouras (dbouras@hol.gr) + Uri Blumenthal (uri@watson.ibm.com) + Heiko Schroeder (heiko@pool.informatik.rwth-aachen.de) + + diff --git a/vendor/x11iraf/xaw3d/Repeater.c b/vendor/x11iraf/xaw3d/Repeater.c new file mode 100644 index 00000000..1467f638 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Repeater.c @@ -0,0 +1,278 @@ +/* + * $XConsortium: Repeater.c,v 1.11 94/04/17 20:12:37 kaleb Exp $ + * +Copyright (c) 1990, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + * + * This widget is used for press-and-hold style buttons. + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> /* for XtN and XtC defines */ +#include <X11/Xaw3d/XawInit.h> /* for XawInitializeWidgetSet() */ +#include <X11/Xaw3d/RepeaterP.h> /* us */ + +static void tic(); /* clock timeout */ + +#define DO_CALLBACK(rw) \ + XtCallCallbackList ((Widget) rw, rw->command.callbacks, (XtPointer)NULL) + + +#define ADD_TIMEOUT(rw,delay) \ + XtAppAddTimeOut (XtWidgetToApplicationContext ((Widget) rw), \ + (unsigned long) delay, tic, (XtPointer) rw) + +#define CLEAR_TIMEOUT(rw) \ + if ((rw)->repeater.timer) { \ + XtRemoveTimeOut ((rw)->repeater.timer); \ + (rw)->repeater.timer = 0; \ + } + + +/* + * Translations to give user interface of press-notify...-release_or_leave + */ +static char defaultTranslations[] = + "<EnterWindow>: highlight() \n\ + <LeaveWindow>: unhighlight() \n\ + <Btn1Down>: set() start() \n\ + <Btn1Up>: stop() unset() "; + + +/* + * Actions added by this widget + */ +static void ActionStart(), ActionStop(); + +static XtActionsRec actions[] = { + { "start", ActionStart }, /* trigger timers */ + { "stop", ActionStop }, /* clear timers */ +}; + + +/* + * New resources added by this widget + */ +static XtResource resources[] = { +#define off(field) XtOffsetOf(RepeaterRec, repeater.field) + { XtNdecay, XtCDecay, XtRInt, sizeof (int), + off(decay), XtRImmediate, (XtPointer) REP_DEF_DECAY }, + { XtNinitialDelay, XtCDelay, XtRInt, sizeof (int), + off(initial_delay), XtRImmediate, (XtPointer) REP_DEF_INITIAL_DELAY }, + { XtNminimumDelay, XtCMinimumDelay, XtRInt, sizeof (int), + off(minimum_delay), XtRImmediate, (XtPointer) REP_DEF_MINIMUM_DELAY }, + { XtNrepeatDelay, XtCDelay, XtRInt, sizeof (int), + off(repeat_delay), XtRImmediate, (XtPointer) REP_DEF_REPEAT_DELAY }, + { XtNflash, XtCBoolean, XtRBoolean, sizeof (Boolean), + off(flash), XtRImmediate, (XtPointer) FALSE }, + { XtNstartCallback, XtCStartCallback, XtRCallback, sizeof (XtPointer), + off(start_callbacks), XtRImmediate, (XtPointer) NULL }, + { XtNstopCallback, XtCStopCallback, XtRCallback, sizeof (XtPointer), + off(stop_callbacks), XtRImmediate, (XtPointer) NULL }, +#undef off +}; + + +/* + * Class Methods + */ + +static void Initialize(); /* setup private data */ +static void Destroy(); /* clear timers */ +static Boolean SetValues(); /* set resources */ + +RepeaterClassRec repeaterClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &commandClassRec, + /* class_name */ "Repeater", + /* widget_size */ sizeof(RepeaterRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* threeD fields */ + /* shadowdraw */ XtInheritXaw3dShadowDraw + }, + { /* label fields */ + /* ignore */ 0 + }, + { /* command fields */ + /* ignore */ 0 + }, + { /* repeater fields */ + /* ignore */ 0 + } +}; + +WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec; + + +/***************************************************************************** + * * + * repeater utility routines * + * * + *****************************************************************************/ + +/* ARGSUSED */ +static void tic (client_data, id) + XtPointer client_data; + XtIntervalId *id; +{ + RepeaterWidget rw = (RepeaterWidget) client_data; + + rw->repeater.timer = 0; /* timer is removed */ + if (rw->repeater.flash) { + XtExposeProc expose; + expose = repeaterWidgetClass->core_class.superclass->core_class.expose; + XClearWindow (XtDisplay((Widget) rw), XtWindow((Widget) rw)); + rw->command.set = FALSE; + (*expose) ((Widget) rw, (XEvent *) NULL, (Region) NULL); + XClearWindow (XtDisplay((Widget) rw), XtWindow((Widget) rw)); + rw->command.set = TRUE; + (*expose) ((Widget) rw, (XEvent *) NULL, (Region) NULL); + } + DO_CALLBACK (rw); + + rw->repeater.timer = ADD_TIMEOUT (rw, rw->repeater.next_delay); + + /* decrement delay time, but clamp */ + if (rw->repeater.decay) { + rw->repeater.next_delay -= rw->repeater.decay; + if (rw->repeater.next_delay < rw->repeater.minimum_delay) + rw->repeater.next_delay = rw->repeater.minimum_delay; + } +} + + +/***************************************************************************** + * * + * repeater class methods * + * * + *****************************************************************************/ + +/* ARGSUSED */ +static void Initialize (greq, gnew, args, num_args) + Widget greq, gnew; + ArgList args; + Cardinal *num_args; +{ + RepeaterWidget new = (RepeaterWidget) gnew; + + if (new->repeater.minimum_delay < 0) new->repeater.minimum_delay = 0; + new->repeater.timer = (XtIntervalId) 0; +} + +static void Destroy (gw) + Widget gw; +{ + CLEAR_TIMEOUT ((RepeaterWidget) gw); +} + +/* ARGSUSED */ +static Boolean SetValues (gcur, greq, gnew, args, num_args) + Widget gcur, greq, gnew; + ArgList args; + Cardinal *num_args; +{ + RepeaterWidget cur = (RepeaterWidget) gcur; + RepeaterWidget new = (RepeaterWidget) gnew; + Boolean redisplay = FALSE; + + if (cur->repeater.minimum_delay != new->repeater.minimum_delay) { + if (new->repeater.next_delay < new->repeater.minimum_delay) + new->repeater.next_delay = new->repeater.minimum_delay; + } + + return redisplay; +} + +/***************************************************************************** + * * + * repeater action procs * + * * + *****************************************************************************/ + +/* ARGSUSED */ +static void ActionStart (gw, event, params, num_params) + Widget gw; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + RepeaterWidget rw = (RepeaterWidget) gw; + + CLEAR_TIMEOUT (rw); + if (rw->repeater.start_callbacks) + XtCallCallbackList (gw, rw->repeater.start_callbacks, (XtPointer)NULL); + + DO_CALLBACK (rw); + rw->repeater.timer = ADD_TIMEOUT (rw, rw->repeater.initial_delay); + rw->repeater.next_delay = rw->repeater.repeat_delay; +} + + +/* ARGSUSED */ +static void ActionStop (gw, event, params, num_params) + Widget gw; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + RepeaterWidget rw = (RepeaterWidget) gw; + + CLEAR_TIMEOUT ((RepeaterWidget) gw); + if (rw->repeater.stop_callbacks) + XtCallCallbackList (gw, rw->repeater.stop_callbacks, (XtPointer)NULL); +} + diff --git a/vendor/x11iraf/xaw3d/Repeater.h b/vendor/x11iraf/xaw3d/Repeater.h new file mode 100644 index 00000000..efc07cba --- /dev/null +++ b/vendor/x11iraf/xaw3d/Repeater.h @@ -0,0 +1,77 @@ +/* + * $XConsortium: Repeater.h,v 1.4 94/04/17 20:12:38 jim Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawRepeater_h +#define _XawRepeater_h + +#include <X11/Xaw3d/Command.h> + +/***************************************************************************** + * + * Repeater Widget (subclass of Command) + * + * This widget is a push button that repeatedly fires when held down. + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * decay Decay int 5 milliseconds + * flash Boolean Boolean FALSE + * initialDelay Delay int 200 milliseconds + * minimumDelay MinimumDelay int 10 milliseconds + * repeatDelay Delay int 50 milliseconds + * startCallback StartCallback XtCallbackList NULL + * stopCallback StopCallback XtCallbackList NULL + * + *****************************************************************************/ + + /* new instance and class names */ +#define XtNdecay "decay" +#define XtCDecay "Decay" +#define XtNinitialDelay "initialDelay" +#define XtCDelay "Delay" +#define XtNminimumDelay "minimumDelay" +#define XtCMinimumDelay "MinimumDelay" +#define XtNrepeatDelay "repeatDelay" +#define XtNflash "flash" +#define XtNstartCallback "startCallback" +#define XtCStartCallback "StartCallback" +#define XtNstopCallback "stopCallback" +#define XtCStopCallback "StopCallback" + + + /* external declarations */ +extern WidgetClass repeaterWidgetClass; + +typedef struct _RepeaterClassRec *RepeaterWidgetClass; +typedef struct _RepeaterRec *RepeaterWidget; + +#endif /* _XawRepeater_h */ diff --git a/vendor/x11iraf/xaw3d/RepeaterP.h b/vendor/x11iraf/xaw3d/RepeaterP.h new file mode 100644 index 00000000..4cd0e758 --- /dev/null +++ b/vendor/x11iraf/xaw3d/RepeaterP.h @@ -0,0 +1,82 @@ +/* + * $XConsortium: RepeaterP.h,v 1.4 94/04/17 20:12:39 jim Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Jim Fulton, MIT X Consortium + */ + +#ifndef _XawRepeaterP_h +#define _XawRepeaterP_h + +#include <X11/Xaw3d/CommandP.h> +#include <X11/Xaw3d/Repeater.h> + +typedef struct { /* new fields in widget class */ + int dummy; +} RepeaterClassPart; + +typedef struct _RepeaterClassRec { /* Repeater widget class */ + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + LabelClassPart label_class; + CommandClassPart command_class; + RepeaterClassPart repeater_class; +} RepeaterClassRec; + +typedef struct { /* new fields in widget */ + /* resources... */ + int initial_delay; /* initialDelay/Delay */ + int repeat_delay; /* repeatDelay/Delay */ + int minimum_delay; /* minimumDelay/MinimumDelay */ + int decay; /* decay to minimum delay */ + Boolean flash; /* flash/Boolean */ + XtCallbackList start_callbacks; /* startCallback/StartCallback */ + XtCallbackList stop_callbacks; /* stopCallback/StopCallback */ + /* private data... */ + int next_delay; /* next amount for timer */ + XtIntervalId timer; /* timer that will fire */ +} RepeaterPart; + +typedef struct _RepeaterRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + LabelPart label; + CommandPart command; + RepeaterPart repeater; +} RepeaterRec; + +#define REP_DEF_DECAY 5 /* milliseconds */ +#define REP_DEF_INITIAL_DELAY 200 /* milliseconds */ +#define REP_DEF_MINIMUM_DELAY 10 /* milliseconds */ +#define REP_DEF_REPEAT_DELAY 50 /* milliseconds */ + +/* + * external declarations + */ +extern RepeaterClassRec repeaterClassRec; + +#endif /* _XawRepeaterP_h */ diff --git a/vendor/x11iraf/xaw3d/Reports.h b/vendor/x11iraf/xaw3d/Reports.h new file mode 100644 index 00000000..0b193c9d --- /dev/null +++ b/vendor/x11iraf/xaw3d/Reports.h @@ -0,0 +1,55 @@ +/* + * $XConsortium: Reports.h,v 1.4 94/04/17 20:12:39 jim Exp $ + * +Copyright (c) 1990 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +#ifndef _Xaw_Reports_h +#define _Xaw_Reports_h + +/* + * XawPannerReport - this structure is used by the reportCallback of the + * Panner, Porthole, Viewport, and Scrollbar widgets to report its position. + * All fields must be filled in, although the changed field may be used as + * a hint as to which fields have been altered since the last report. + */ +typedef struct { + unsigned int changed; /* mask, see below */ + Position slider_x, slider_y; /* location of slider within outer */ + Dimension slider_width, slider_height; /* size of slider */ + Dimension canvas_width, canvas_height; /* size of canvas */ +} XawPannerReport; + +#define XawPRSliderX (1 << 0) +#define XawPRSliderY (1 << 1) +#define XawPRSliderWidth (1 << 2) +#define XawPRSliderHeight (1 << 3) +#define XawPRCanvasWidth (1 << 4) +#define XawPRCanvasHeight (1 << 5) +#define XawPRAll (63) /* union of above */ + +#define XtNreportCallback "reportCallback" +#define XtCReportCallback "reportCallback" + +#endif /* _Xaw_Reports_h */ diff --git a/vendor/x11iraf/xaw3d/Scrollbar.c b/vendor/x11iraf/xaw3d/Scrollbar.c new file mode 100644 index 00000000..3c5d2efb --- /dev/null +++ b/vendor/x11iraf/xaw3d/Scrollbar.c @@ -0,0 +1,1257 @@ + +/* MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) */ +/* Modifications Copyright 1992 by Mitch Trachtenberg */ +/* Rights, permissions, and disclaimer of warranty are as in the */ +/* DEC and MIT notice below. */ +/* $XConsortium: Scrollbar.c,v 1.70 91/10/16 21:39:40 eswu Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* ScrollBar.c */ +/* created by weissman, Mon Jul 7 13:20:03 1986 */ +/* converted by swick, Thu Aug 27 1987 */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/ScrollbarP.h> + +#include <X11/Xmu/Drawing.h> + +/* Private definitions. */ + +#ifdef ARROW_SCROLLBAR +static char defaultTranslations[] = + "<Btn1Down>: NotifyScroll()\n\ + <Btn2Down>: MoveThumb() NotifyThumb() \n\ + <Btn3Down>: NotifyScroll()\n\ + <Btn1Motion>: HandleThumb() \n\ + <Btn3Motion>: HandleThumb() \n\ + <Btn2Motion>: MoveThumb() NotifyThumb() \n\ + <BtnUp>: EndScroll()"; +#else +static char defaultTranslations[] = + "<Btn1Down>: StartScroll(Forward) \n\ + <Btn2Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\ + <Btn3Down>: StartScroll(Backward) \n\ + <Btn2Motion>: MoveThumb() NotifyThumb() \n\ + <BtnUp>: NotifyScroll(Proportional) EndScroll()"; +#ifdef bogusScrollKeys + /* examples */ + "<KeyPress>f: StartScroll(Forward) NotifyScroll(FullLength) EndScroll()" + "<KeyPress>b: StartScroll(Backward) NotifyScroll(FullLength) EndScroll()" +#endif +#endif + +static float floatZero = 0.0; + +#define Offset(field) XtOffsetOf(ScrollbarRec, field) + +static XtResource resources[] = { +#ifdef ARROW_SCROLLBAR +/* {XtNscrollCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.cursor), XtRString, "crosshair"},*/ +#else + {XtNscrollVCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.verCursor), XtRString, "sb_v_double_arrow"}, + {XtNscrollHCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.horCursor), XtRString, "sb_h_double_arrow"}, + {XtNscrollUCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.upCursor), XtRString, "sb_up_arrow"}, + {XtNscrollDCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.downCursor), XtRString, "sb_down_arrow"}, + {XtNscrollLCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.leftCursor), XtRString, "sb_left_arrow"}, + {XtNscrollRCursor, XtCCursor, XtRCursor, sizeof(Cursor), + Offset(scrollbar.rightCursor), XtRString, "sb_right_arrow"}, +#endif + {XtNlength, XtCLength, XtRDimension, sizeof(Dimension), + Offset(scrollbar.length), XtRImmediate, (XtPointer) 1}, + {XtNthickness, XtCThickness, XtRDimension, sizeof(Dimension), + Offset(scrollbar.thickness), XtRImmediate, (XtPointer) 14}, + {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation), + Offset(scrollbar.orientation), XtRImmediate, (XtPointer) XtorientVertical}, + {XtNscrollProc, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(scrollbar.scrollProc), XtRCallback, NULL}, + {XtNthumbProc, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(scrollbar.thumbProc), XtRCallback, NULL}, + {XtNjumpProc, XtCCallback, XtRCallback, sizeof(XtPointer), + Offset(scrollbar.jumpProc), XtRCallback, NULL}, + {XtNthumb, XtCThumb, XtRBitmap, sizeof(Pixmap), + Offset(scrollbar.thumb), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset(scrollbar.foreground), XtRString, XtDefaultForeground}, + {XtNshown, XtCShown, XtRFloat, sizeof(float), + Offset(scrollbar.shown), XtRFloat, (XtPointer)&floatZero}, + {XtNtopOfThumb, XtCTopOfThumb, XtRFloat, sizeof(float), + Offset(scrollbar.top), XtRFloat, (XtPointer)&floatZero}, + {XtNpickTop, XtCPickTop, XtRBoolean, sizeof(Boolean), + Offset(scrollbar.pick_top), XtRBoolean, (XtPointer) False}, + {XtNminimumThumb, XtCMinimumThumb, XtRDimension, sizeof(Dimension), + Offset(scrollbar.min_thumb), XtRImmediate, (XtPointer) 7} +}; +#undef Offset + +static void ClassInitialize(); +static void Initialize(); +static void Destroy(); +static void Realize(); +static void Resize(); +static void Redisplay(); +static Boolean SetValues(); + +#ifdef ARROW_SCROLLBAR +static void HandleThumb(); +#else +static void StartScroll(); +#endif +static void MoveThumb(); +static void NotifyThumb(); +static void NotifyScroll(); +static void EndScroll(); + +static XtActionsRec actions[] = { +#ifdef ARROW_SCROLLBAR + {"HandleThumb", HandleThumb}, +#else + {"StartScroll", StartScroll}, +#endif + {"MoveThumb", MoveThumb}, + {"NotifyThumb", NotifyThumb}, + {"NotifyScroll", NotifyScroll}, + {"EndScroll", EndScroll} +}; + + +ScrollbarClassRec scrollbarClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &threeDClassRec, + /* class_name */ "Scrollbar", + /* size */ sizeof(ScrollbarRec), + /* class_initialize */ ClassInitialize, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure*/ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* threeD fields */ + /* shadowdraw */ XtInheritXaw3dShadowDraw /*,*/ + /* shadowboxdraw */ /*XtInheritXaw3dShadowBoxDraw*/ + }, + { /* scrollbar fields */ + /* ignore */ 0 + } + +}; + +WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec; + +#define NoButton -1 +#define PICKLENGTH(widget, x, y) \ + ((widget->scrollbar.orientation == XtorientHorizontal) ? x : y) +#define MIN(x,y) ((x) < (y) ? (x) : (y)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) + +static void ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, + (XtConvertArgList)NULL, (Cardinal)0 ); +} + +#ifdef ARROW_SCROLLBAR +/* CHECKIT #define MARGIN(sbw) (sbw)->scrollbar.thickness + (sbw)->threeD.shadow_width */ +#define MARGIN(sbw) (sbw)->scrollbar.thickness +#else +#define MARGIN(sbw) (sbw)->threeD.shadow_width +#endif + +/* + The original Xaw Scrollbar's FillArea *really* relied on the fact that the + server was going to clip at the window boundaries; so the logic was really + rather sloppy. To avoid drawing over the shadows and the arrows requires + some extra care... Hope I didn't make any mistakes. +*/ +static void FillArea (sbw, top, bottom, fill) + ScrollbarWidget sbw; + Position top, bottom; + int fill; +{ + int tlen = bottom - top; /* length of thumb in pixels */ + int sw, margin, floor; + int lx, ly, lw, lh; + + if (bottom <= 0 || bottom <= top) + return; + if ((sw = sbw->threeD.shadow_width) < 0) + sw = 0; + margin = MARGIN (sbw); + floor = sbw->scrollbar.length - margin; + + if (sbw->scrollbar.orientation == XtorientHorizontal) { + lx = ((top < margin) ? margin : top); + ly = sw; + lw = ((bottom > floor) ? floor - top : tlen); +/* CHECKIT lw = (((top + tlen) > floor) ? floor - top : tlen); */ + lh = sbw->core.height - 2 * sw; + } else { + lx = sw; + ly = ((top < margin) ? margin : top); + lw = sbw->core.width - 2 * sw; +/* CHECKIT lh = (((top + tlen) > floor) ? floor - top : tlen); */ + lh = ((bottom > floor) ? floor - top : tlen); + } + if (lh <= 0 || lw <= 0) return; + if (fill) { + XFillRectangle(XtDisplay((Widget) sbw), XtWindow((Widget) sbw), + sbw->scrollbar.gc, + lx, ly, (unsigned int) lw, (unsigned int) lh); + } else { + XClearArea (XtDisplay((Widget) sbw), XtWindow((Widget) sbw), + lx, ly, (unsigned int) lw, (unsigned int) lh, + FALSE); + } +} + + + +/* _ShadowSurroundedBox is somewhat redundant with + _Xaw3dDrawShadows (gw, event, region, out) + in ThreeD.c; however, it is more general and allows to + specify the boxsize of the shawdowbox explicitely. In order + to keep the changes in other parts of Xaw3d to Kaleb's distribution + minimal, we define it here instead of as a method in the ThreeD class. + + -gustaf */ + +/* ARGSUSED */ +static void +_ShadowSurroundedBox (gw, event, region, xtl, ytl, xbr, ybr, out) + Widget gw; + XEvent *event; + Region region; + Dimension xtl, ytl, xbr, ybr; /* INNER corners */ + Boolean out; +{ + XPoint pt[6]; + ThreeDWidget tdw = (ThreeDWidget) gw; + Dimension s = tdw->threeD.shadow_width; + + /* + * no point to do anything if the shadow_width is 0 or the + * widget has not been realized. + */ + if((s > 0) && XtIsRealized (gw)){ + + Dimension xms = xtl - s; + Dimension yms = ytl - s; + Dimension xps = xbr + s; + Dimension yps = ybr + s; + Display *dpy = XtDisplay (gw); + Window win = XtWindow (gw); + GC top, bot; + + if (out) { + top = tdw->threeD.top_shadow_GC; + bot = tdw->threeD.bot_shadow_GC; + } else { + top = tdw->threeD.bot_shadow_GC; + bot = tdw->threeD.top_shadow_GC; + } + /* Draw shadows. Points are numbered as follows: + * + * 1_________________________________ 2 + * | / /| + * | / / | + * | 4_________________________/ / | + * | | 3| | + + * | | | | + * | | | | + * | | | | + * | |5_________________________| | + * | / / 4 | + * | / / | + * |/ /_______________________________| + * 3 1 + */ + + /* points common to top and bottom shadow */ + pt[0].x = xms; pt[0].y = yps; + pt[2].x = xps; pt[2].y = yms; + pt[3].x = xbr; pt[3].y = ytl; + pt[5].x = xtl; pt[5].y = ybr; + + /* top-left shadow */ + if ((region == NULL) || + (XRectInRegion (region, xms, yms, xps, ytl) != RectangleOut) || + (XRectInRegion (region, xms, yms, xtl, yps) != RectangleOut)) { + + pt[1].x = xms; pt[1].y = yms; + pt[4].x = xtl; pt[4].y = ytl; + XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin); + } + + /* bottom-right shadow */ + if ((region == NULL) || + (XRectInRegion (region, xms, ybr, xps, yps) != RectangleOut) || + (XRectInRegion (region, xbr, yms, xps, yps) != RectangleOut)) { + + /* swap points from top left to bottom right */ + pt[1].x = xps; pt[1].y = yps; + pt[4].x = xbr; pt[4].y = ybr; + XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin); + } + } +} + + +/* Paint the thumb in the area specified by sbw->top and + sbw->shown. The old area is erased. The painting and + erasing is done cleverly so that no flickering will occur. */ + +static void PaintThumb (sbw, event) + ScrollbarWidget sbw; + XEvent *event; +{ + Dimension s = sbw->threeD.shadow_width; + Position oldtop = sbw->scrollbar.topLoc; + Position oldbot = oldtop + sbw->scrollbar.shownLength; + Dimension margin = MARGIN (sbw); + Dimension tzl = sbw->scrollbar.length - margin - margin; + Position newtop, newbot; + Position floor = sbw->scrollbar.length - margin; + + newtop = margin + (int)(tzl * sbw->scrollbar.top); + newbot = newtop + (int)(tzl * sbw->scrollbar.shown); + if (sbw->scrollbar.shown < 1.) newbot++; + if (newbot < newtop + (int)sbw->scrollbar.min_thumb + + 2 * (int)sbw->threeD.shadow_width) + newbot = newtop + sbw->scrollbar.min_thumb + + 2 * sbw->threeD.shadow_width; + if ( newbot >= floor ) { + newtop = floor-(newbot-newtop)+1; + newbot = floor; + } + + sbw->scrollbar.topLoc = newtop; + sbw->scrollbar.shownLength = newbot - newtop; + if (XtIsRealized ((Widget) sbw)) { + /* 3D thumb wanted ? + */ + if (s) + { + if (newtop < oldtop) FillArea(sbw, oldtop, oldtop + s, 0); + if (newtop > oldtop) FillArea(sbw, oldtop, MIN(newtop, oldbot), 0); + if (newbot < oldbot) FillArea(sbw, MAX(newbot, oldtop), oldbot, 0); + if (newbot > oldbot) FillArea(sbw, oldbot - s, oldbot, 0); + + if (sbw->scrollbar.orientation == XtorientHorizontal) + { + _ShadowSurroundedBox( + sbw, event, + (Region)NULL, + newtop + s, 2 * s, + newbot - s, sbw->core.height - 2 * s, TRUE); + } + else + { + _ShadowSurroundedBox( + sbw, event, + (Region)NULL, + 2 * s, newtop + s, + sbw->core.width - 2 * s, newbot - s, + TRUE); + } + } + else + { + /* + Note to Mitch: FillArea is (now) correctly implemented to + not draw over shadows or the arrows. Therefore setting clipmasks + doesn't seem to be necessary. Correct me if I'm wrong! + */ + if (newtop < oldtop) FillArea(sbw, newtop, MIN(newbot, oldtop), 1); + if (newtop > oldtop) FillArea(sbw, oldtop, MIN(newtop, oldbot), 0); + if (newbot < oldbot) FillArea(sbw, MAX(newbot, oldtop), oldbot, 0); + if (newbot > oldbot) FillArea(sbw, MAX(newtop, oldbot), newbot, 1); + } + } +} + +#ifdef ARROW_SCROLLBAR +static void PaintArrows (sbw) + ScrollbarWidget sbw; +{ + XPoint pt[20]; + Dimension s = sbw->threeD.shadow_width; + Dimension t = sbw->scrollbar.thickness; + Dimension l = sbw->scrollbar.length; + Dimension tms = t - s, lms = l - s; + Dimension tm1 = t - 1; + Dimension lmt = l - t; + Dimension lp1 = lmt + 1; + Dimension sm1 = s - 1; + Dimension t2 = t / 2; + Dimension sa30 = (Dimension)(1.732 * s ); /* cotangent of 30 deg */ + Display *dpy = XtDisplay (sbw); + Window win = XtWindow (sbw); + GC top = sbw->threeD.top_shadow_GC; + GC bot = sbw->threeD.bot_shadow_GC; + + + if (XtIsRealized ((Widget) sbw)) { + /* 3D arrows? + */ + if (s) { + /* upper/right arrow */ + pt[0].x = sm1; pt[0].y = tm1; + pt[1].x = t2; pt[1].y = sm1; + pt[2].x = t2; pt[2].y = s + sa30; + pt[3].x = sm1 + sa30; pt[3].y = tms - 1; + + pt[4].x = sm1; pt[4].y = tm1; + pt[5].x = tms; pt[5].y = tm1; + pt[6].x = t2; pt[6].y = sm1; + pt[7].x = t2; pt[7].y = s + sa30; + pt[8].x = tms - sa30; pt[8].y = tms - 1; + pt[9].x = sm1 + sa30; pt[9].y = tms - 1; + + /* lower/left arrow */ + pt[10].x = tms; pt[10].y = lp1; + pt[11].x = s; pt[11].y = lp1; + pt[12].x = t2; pt[12].y = lms; + pt[13].x = t2; pt[13].y = lms - sa30; + pt[14].x = s + sa30; pt[14].y = lmt + s + 1; + pt[15].x = tms - sa30; pt[15].y = lmt + s + 1; + + pt[16].x = tms; pt[16].y = lp1; + pt[17].x = t2; pt[17].y = lms; + pt[18].x = t2; pt[18].y = lms - sa30; + pt[19].x = tms - sa30; pt[19].y = lmt + s + 1; + + /* horizontal arrows require that x and y coordinates be swapped */ + if (sbw->scrollbar.orientation == XtorientHorizontal) { + int n; + int swap; + for (n = 0; n < 20; n++) { + swap = pt[n].x; + pt[n].x = pt[n].y; + pt[n].y = swap; + } + } + XFillPolygon (dpy, win, top, pt, 4, Complex, CoordModeOrigin); + XFillPolygon (dpy, win, bot, pt + 4, 6, Complex, CoordModeOrigin); + XFillPolygon (dpy, win, top, pt + 10, 6, Complex, CoordModeOrigin); + XFillPolygon (dpy, win, bot, pt + 16, 4, Complex, CoordModeOrigin); + + } else { + pt[0].x = 0; pt[0].y = tm1; + pt[1].x = t; pt[1].y = tm1; + pt[2].x = t2; pt[2].y = 0; + + pt[3].x = 0; pt[3].y = lp1; + pt[4].x = t; pt[4].y = lp1; + pt[5].x = t2; pt[5].y = l; + + /* horizontal arrows require that x and y coordinates be swapped */ + if (sbw->scrollbar.orientation == XtorientHorizontal) { + int n; + int swap; + for (n = 0; n < 6; n++) { + swap = pt[n].x; + pt[n].x = pt[n].y; + pt[n].y = swap; + } + } + /* draw the up/left arrow */ + XFillPolygon (dpy, win, sbw->scrollbar.gc, + pt, 3, + Convex, CoordModeOrigin); + /* draw the down/right arrow */ + XFillPolygon (dpy, win, sbw->scrollbar.gc, + pt+3, 3, + Convex, CoordModeOrigin); + } + } +} +#endif + +/* Function Name: Destroy + * Description: Called as the scrollbar is going away... + * Arguments: w - the scrollbar. + * Returns: nonw + */ +static void Destroy (w) + Widget w; +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; +#ifdef ARROW_SCROLLBAR + if(sbw->scrollbar.timer_id != (XtIntervalId) 0) + XtRemoveTimeOut (sbw->scrollbar.timer_id); +#endif + XtReleaseGC (w, sbw->scrollbar.gc); +} + +/* Function Name: CreateGC + * Description: Creates the GC. + * Arguments: w - the scrollbar widget. + * Returns: none. + */ + +static void CreateGC (w) + Widget w; +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + XGCValues gcValues; + XtGCMask mask; + unsigned int depth = 1; + + if (sbw->scrollbar.thumb == XtUnspecifiedPixmap) { + sbw->scrollbar.thumb = XmuCreateStippledPixmap (XtScreen(w), + (Pixel) 1, (Pixel) 0, depth); + } else if (sbw->scrollbar.thumb != None) { + Window root; + int x, y; + unsigned int width, height, bw; + if (XGetGeometry (XtDisplay(w), sbw->scrollbar.thumb, &root, &x, &y, + &width, &height, &bw, &depth) == 0) { + XtAppError (XtWidgetToApplicationContext (w), + "Scrollbar Widget: Could not get geometry of thumb pixmap."); + } + } + + gcValues.foreground = sbw->scrollbar.foreground; + gcValues.background = sbw->core.background_pixel; + mask = GCForeground | GCBackground; + + if (sbw->scrollbar.thumb != None) { + if (depth == 1) { + gcValues.fill_style = FillOpaqueStippled; + gcValues.stipple = sbw->scrollbar.thumb; + mask |= GCFillStyle | GCStipple; + } + else { + gcValues.fill_style = FillTiled; + gcValues.tile = sbw->scrollbar.thumb; + mask |= GCFillStyle | GCTile; + } + } + /* the creation should be non-caching, because */ + /* we now set and clear clip masks on the gc returned */ + sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues); +} + +static void SetDimensions (sbw) + ScrollbarWidget sbw; +{ + if (sbw->scrollbar.orientation == XtorientVertical) { + sbw->scrollbar.length = sbw->core.height; + sbw->scrollbar.thickness = sbw->core.width; + } else { + sbw->scrollbar.length = sbw->core.width; + sbw->scrollbar.thickness = sbw->core.height; + } +} + +/* ARGSUSED */ +static void Initialize( request, new, args, num_args ) + Widget request; /* what the client asked for */ + Widget new; /* what we're going to give him */ + ArgList args; + Cardinal *num_args; +{ + ScrollbarWidget sbw = (ScrollbarWidget) new; + + CreateGC (new); + + if (sbw->core.width == 0) + sbw->core.width = (sbw->scrollbar.orientation == XtorientVertical) + ? sbw->scrollbar.thickness : sbw->scrollbar.length; + + if (sbw->core.height == 0) + sbw->core.height = (sbw->scrollbar.orientation == XtorientHorizontal) + ? sbw->scrollbar.thickness : sbw->scrollbar.length; + + SetDimensions (sbw); +#ifdef ARROW_SCROLLBAR + sbw->scrollbar.scroll_mode = 0; + sbw->scrollbar.timer_id = (XtIntervalId)0; +#endif + sbw->scrollbar.topLoc = 0; + sbw->scrollbar.shownLength = sbw->scrollbar.min_thumb; +} + +static void Realize (w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; +#ifdef ARROW_SCROLLBAR + if(sbw->simple.cursor_name == NULL) + XtVaSetValues(w, XtNcursorName, "crosshair", NULL); + /* dont set the cursor of the window to anything */ + *valueMask &= ~CWCursor; +#else + sbw->scrollbar.inactiveCursor = + (sbw->scrollbar.orientation == XtorientVertical) + ? sbw->scrollbar.verCursor + : sbw->scrollbar.horCursor; + + XtVaSetValues (w, XtNcursor, sbw->scrollbar.inactiveCursor, NULL); +#endif + /* + * The Simple widget actually stuffs the value in the valuemask. + */ + + (*scrollbarWidgetClass->core_class.superclass->core_class.realize) + (w, valueMask, attributes); +} + +/* ARGSUSED */ +static Boolean SetValues (current, request, desired, args, num_args) + Widget current, /* what I am */ + request, /* what he wants me to be */ + desired; /* what I will become */ + ArgList args; + Cardinal *num_args; +{ + ScrollbarWidget sbw = (ScrollbarWidget) current; + ScrollbarWidget dsbw = (ScrollbarWidget) desired; + Boolean redraw = FALSE; + +/* + * If these values are outside the acceptable range ignore them... + */ + + if (dsbw->scrollbar.top < 0.0 || dsbw->scrollbar.top > 1.0) + dsbw->scrollbar.top = sbw->scrollbar.top; + + if (dsbw->scrollbar.shown < 0.0 || dsbw->scrollbar.shown > 1.0) + dsbw->scrollbar.shown = sbw->scrollbar.shown; + +/* + * Change colors and stuff... + */ + if (XtIsRealized (desired)) { + if (sbw->scrollbar.foreground != dsbw->scrollbar.foreground || + sbw->core.background_pixel != dsbw->core.background_pixel || + sbw->scrollbar.thumb != dsbw->scrollbar.thumb) { + XtReleaseGC (desired, sbw->scrollbar.gc); + CreateGC (desired); + redraw = TRUE; + } + if (sbw->scrollbar.top != dsbw->scrollbar.top || + sbw->scrollbar.shown != dsbw->scrollbar.shown) + redraw = TRUE; + } + return redraw; +} + +static void Resize (w) + Widget w; +{ + /* ForgetGravity has taken care of background, but thumb may + * have to move as a result of the new size. */ + SetDimensions ((ScrollbarWidget) w); + Redisplay (w, (XEvent*) NULL, (Region)NULL); +} + + +/* ARGSUSED */ +static void Redisplay (w, event, region) + Widget w; + XEvent *event; + Region region; +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + ScrollbarWidgetClass swclass = (ScrollbarWidgetClass) XtClass (w); + int x, y; + unsigned int width, height; + + (*swclass->threeD_class.shadowdraw) (w, event, region, FALSE); + + if (sbw->scrollbar.orientation == XtorientHorizontal) { + x = sbw->scrollbar.topLoc; + y = 1; + width = sbw->scrollbar.shownLength; + height = sbw->core.height - 2; + } else { + x = 1; + y = sbw->scrollbar.topLoc; + width = sbw->core.width - 2; + height = sbw->scrollbar.shownLength; + } + if (region == NULL || + XRectInRegion (region, x, y, width, height) != RectangleOut) { + /* Forces entire thumb to be painted. */ + sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1); + PaintThumb (sbw, event); + } +#ifdef ARROW_SCROLLBAR + /* we'd like to be region aware here!!!! */ + PaintArrows (sbw); +#endif + +} + + +static Boolean CompareEvents (oldEvent, newEvent) + XEvent *oldEvent, *newEvent; +{ +#define Check(field) if (newEvent->field != oldEvent->field) return False; + + Check(xany.display); + Check(xany.type); + Check(xany.window); + + switch (newEvent->type) { + case MotionNotify: + Check(xmotion.state); + break; + case ButtonPress: + case ButtonRelease: + Check(xbutton.state); + Check(xbutton.button); + break; + case KeyPress: + case KeyRelease: + Check(xkey.state); + Check(xkey.keycode); + break; + case EnterNotify: + case LeaveNotify: + Check(xcrossing.mode); + Check(xcrossing.detail); + Check(xcrossing.state); + break; + } +#undef Check + + return True; +} + +struct EventData { + XEvent *oldEvent; + int count; +}; + +static Bool PeekNotifyEvent (dpy, event, args) + Display *dpy; + XEvent *event; + char *args; +{ + struct EventData *eventData = (struct EventData*)args; + + return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */ + || CompareEvents(event, eventData->oldEvent)); +} + + +static Boolean LookAhead (w, event) + Widget w; + XEvent *event; +{ + XEvent newEvent; + struct EventData eventData; + + if (QLength (XtDisplay (w)) == 0) return False; + + eventData.count = 0; + eventData.oldEvent = event; + + XPeekIfEvent (XtDisplay (w), &newEvent, PeekNotifyEvent, (char*)&eventData); + + return CompareEvents (event, &newEvent); +} + + +static void ExtractPosition (event, x, y) + XEvent *event; + Position *x, *y; /* RETURN */ +{ + switch( event->type ) { + case MotionNotify: + *x = event->xmotion.x; + *y = event->xmotion.y; + break; + case ButtonPress: + case ButtonRelease: + *x = event->xbutton.x; + *y = event->xbutton.y; + break; + case KeyPress: + case KeyRelease: + *x = event->xkey.x; + *y = event->xkey.y; + break; + case EnterNotify: + case LeaveNotify: + *x = event->xcrossing.x; + *y = event->xcrossing.y; + break; + default: + *x = 0; *y = 0; + } +} + +#ifdef ARROW_SCROLLBAR +/* ARGSUSED */ +static void HandleThumb (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + Position x,y; + ScrollbarWidget sbw = (ScrollbarWidget) w; + + ExtractPosition( event, &x, &y ); + /* if the motion event puts the pointer in thumb, call Move and Notify */ + /* also call Move and Notify if we're already in continuous scroll mode */ + if (sbw->scrollbar.scroll_mode == 2 || + (PICKLENGTH (sbw,x,y) >= sbw->scrollbar.topLoc && + PICKLENGTH (sbw,x,y) <= sbw->scrollbar.topLoc + sbw->scrollbar.shownLength)){ + XtCallActionProc(w, "MoveThumb", event, params, *num_params); + XtCallActionProc(w, "NotifyThumb", event, params, *num_params); + } +} + +static void RepeatNotify (client_data, idp) + XtPointer client_data; + XtIntervalId *idp; +{ +#define A_FEW_PIXELS 5 + ScrollbarWidget sbw = (ScrollbarWidget) client_data; + int call_data; + if (sbw->scrollbar.scroll_mode != 1 && sbw->scrollbar.scroll_mode != 3) { + sbw->scrollbar.timer_id = (XtIntervalId) 0; + return; + } + call_data = MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20); + if (sbw->scrollbar.scroll_mode == 1) + call_data = -call_data; + XtCallCallbacks((Widget)sbw, XtNscrollProc, (XtPointer) call_data); + sbw->scrollbar.timer_id = + XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)sbw), + (unsigned long) 150, + RepeatNotify, + client_data); +} + +#else /* ARROW_SCROLLBAR */ +/* ARGSUSED */ +static void StartScroll (w, event, params, num_params ) + Widget w; + XEvent *event; + String *params; /* direction: Back|Forward|Smooth */ + Cardinal *num_params; /* we only support 1 */ +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + Cursor cursor; + char direction; + + if (sbw->scrollbar.direction != 0) return; /* if we're already scrolling */ + if (*num_params > 0) + direction = *params[0]; + else + direction = 'C'; + + sbw->scrollbar.direction = direction; + + switch (direction) { + case 'B': + case 'b': + cursor = (sbw->scrollbar.orientation == XtorientVertical) + ? sbw->scrollbar.downCursor + : sbw->scrollbar.rightCursor; + break; + case 'F': + case 'f': + cursor = (sbw->scrollbar.orientation == XtorientVertical) + ? sbw->scrollbar.upCursor + : sbw->scrollbar.leftCursor; + break; + case 'C': + case 'c': + cursor = (sbw->scrollbar.orientation == XtorientVertical) + ? sbw->scrollbar.rightCursor + : sbw->scrollbar.upCursor; + break; + default: + return; /* invalid invocation */ + } + XtVaSetValues (w, XtNcursor, cursor, NULL); + XFlush (XtDisplay (w)); +} +#endif /* ARROW_SCROLLBAR */ + +/* + * Make sure the first number is within the range specified by the other + * two numbers. + */ + +#ifndef ARROW_SCROLLBAR +static int InRange(num, small, big) + int num, small, big; +{ + return (num < small) ? small : ((num > big) ? big : num); +} +#endif + +/* + * Same as above, but for floating numbers. + */ + +static float FloatInRange(num, small, big) + float num, small, big; +{ + return (num < small) ? small : ((num > big) ? big : num); +} + + +#ifdef ARROW_SCROLLBAR +static void NotifyScroll (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + int call_data; + Position x, y; + + if (sbw->scrollbar.scroll_mode == 2 /* if scroll continuous */ + || LookAhead (w, event)) + return; + + ExtractPosition (event, &x, &y); + + if (PICKLENGTH (sbw,x,y) < sbw->scrollbar.thickness) { + /* handle first arrow zone */ + call_data = -MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20); + XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); + /* establish autoscroll */ + sbw->scrollbar.timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext (w), + (unsigned long) 300, RepeatNotify, (XtPointer)w); + sbw->scrollbar.scroll_mode = 1; + } else if (PICKLENGTH (sbw,x,y) > sbw->scrollbar.length - sbw->scrollbar.thickness) { + /* handle last arrow zone */ + call_data = MAX (A_FEW_PIXELS, sbw->scrollbar.length / 20); + XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); + /* establish autoscroll */ + sbw->scrollbar.timer_id = + XtAppAddTimeOut (XtWidgetToApplicationContext (w), + (unsigned long) 300, RepeatNotify, (XtPointer)w); + sbw->scrollbar.scroll_mode = 3; + } else if (PICKLENGTH (sbw, x, y) < sbw->scrollbar.topLoc) { + /* handle zone "above" the thumb */ + call_data = - sbw->scrollbar.length; + XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); + } else if (PICKLENGTH (sbw, x, y) > sbw->scrollbar.topLoc + sbw->scrollbar.shownLength) { + /* handle zone "below" the thumb */ + call_data = sbw->scrollbar.length; + XtCallCallbacks (w, XtNscrollProc, (XtPointer)(call_data)); + } else + { + /* handle the thumb in the motion notify action */ + } + return; +} +#else /* ARROW_SCROLLBAR */ +static void NotifyScroll (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* style: Proportional|FullLength */ + Cardinal *num_params; /* we only support 1 */ +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + int call_data; + char style; + Position x, y; + + if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */ + if (LookAhead (w, event)) return; + if (*num_params > 0) + style = *params[0]; + else + style = 'P'; + + switch (style) { + case 'P': /* Proportional */ + case 'p': + ExtractPosition (event, &x, &y); + call_data = + InRange (PICKLENGTH (sbw, x, y), 0, (int) sbw->scrollbar.length); + break; + + case 'F': /* FullLength */ + case 'f': + call_data = sbw->scrollbar.length; + break; + } + switch (sbw->scrollbar.direction) { + case 'B': + case 'b': + call_data = -call_data; + /* fall through */ + + case 'F': + case 'f': + XtCallCallbacks (w, XtNscrollProc, (XtPointer)call_data); + break; + + case 'C': + case 'c': + /* NotifyThumb has already called the thumbProc(s) */ + break; + } +} +#endif /* ARROW_SCROLLBAR */ + +/* ARGSUSED */ +static void EndScroll(w, event, params, num_params ) + Widget w; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + +#ifdef ARROW_SCROLLBAR + sbw->scrollbar.scroll_mode = 0; + /* no need to remove any autoscroll timeout; it will no-op */ + /* because the scroll_mode is 0 */ + /* but be sure to remove timeout in destroy proc */ +#else + XtVaSetValues (w, XtNcursor, sbw->scrollbar.inactiveCursor, NULL); + XFlush (XtDisplay (w)); + sbw->scrollbar.direction = 0; +#endif +} + +static float FractionLoc (sbw, x, y) + ScrollbarWidget sbw; + int x, y; +{ + float result; + int margin; + float height, width; + + margin = MARGIN (sbw); + x -= margin; + y -= margin; + height = sbw->core.height - 2 * margin; + width = sbw->core.width - 2 * margin; + result = PICKLENGTH (sbw, x / width, y / height); + return FloatInRange(result, 0.0, 1.0); +} + + +static void MoveThumb (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + Position x, y; + float loc, t, s; + +#ifndef ARROW_SCROLLBAR + if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */ +#endif + + if (LookAhead (w, event)) return; + + if (!event->xmotion.same_screen) return; + + ExtractPosition (event, &x, &y); + loc = FractionLoc (sbw, x, y); + t = sbw->scrollbar.top; + s = sbw->scrollbar.shown; +#ifdef ARROW_SCROLLBAR + if (sbw->scrollbar.scroll_mode != 2 ) + /* initialize picked position */ + sbw->scrollbar.picked = (FloatInRange( loc, t, t + s ) - t); +#else + sbw->scrollbar.picked = 0.5 * s; +#endif + if (sbw->scrollbar.pick_top) + sbw->scrollbar.top = loc; + else { + sbw->scrollbar.top = loc - sbw->scrollbar.picked; + if (sbw->scrollbar.top < 0.0) sbw->scrollbar.top = 0.0; + } + + if (sbw->scrollbar.top + sbw->scrollbar.shown > 1.0) + sbw->scrollbar.top = 1.0 - sbw->scrollbar.shown; +#ifdef ARROW_SCROLLBAR + sbw->scrollbar.scroll_mode = 2; /* indicate continuous scroll */ +#endif + PaintThumb (sbw, event); + XFlush (XtDisplay (w)); /* re-draw it before Notifying */ +} + + +/* ARGSUSED */ +static void NotifyThumb (w, event, params, num_params ) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + register ScrollbarWidget sbw = (ScrollbarWidget) w; + float top = sbw->scrollbar.top; + +#ifndef ARROW_SCROLLBAR + if (sbw->scrollbar.direction == 0) return; /* if no StartScroll */ +#endif + + if (LookAhead (w, event)) return; + + /* thumbProc is not pretty, but is necessary for backwards + compatibility on those architectures for which it work{s,ed}; + the intent is to pass a (truncated) float by value. */ +#ifdef ARROW_SCROLLBAR + /* This corrects for rounding errors: If the thumb is moved to the end of + the scrollable area sometimes the last line/column is not displayed. + This can happen when the integer number of the top line or leftmost + column to be be displayed is calculated from the float value + sbw->scrollbar.top. The numerical error of this rounding problem is + very small. We therefore add a small value which then forces the + next line/column (the correct one) to be used. Since we can expect + that the resolution of display screens will not be higher then + 10000 text lines/columns we add 1/10000 to the top position. The + intermediate variable `top' is used to avoid erroneous summing up + corrections (can this happen at all?). If the arrows are not displayed + there is no problem since in this case there is always a constant + integer number of pixels the thumb must be moved in order to scroll + to the next line/column. */ + top += 0.0001; +#endif + XtCallCallbacks (w, XtNthumbProc, *(XtPointer*)&top); + XtCallCallbacks (w, XtNjumpProc, (XtPointer)&top); +} + + + +/************************************************************ + * + * Public routines. + * + ************************************************************/ + +/* Set the scroll bar to the given location. */ + +#if NeedFunctionPrototypes +void XawScrollbarSetThumb (Widget w, +#if NeedWidePrototypes + double top, double shown) +#else + float top, float shown) +#endif +#else +void XawScrollbarSetThumb (w, top, shown) + Widget w; + float top, shown; +#endif +{ + ScrollbarWidget sbw = (ScrollbarWidget) w; + +#ifdef WIERD + fprintf(stderr,"< XawScrollbarSetThumb w=%p, top=%f, shown=%f\n", + w,top,shown); +#endif + +#ifdef ARROW_SCROLLBAR + if (sbw->scrollbar.scroll_mode == (char) 2) return; /* if still thumbing */ +#else + if (sbw->scrollbar.direction == 'c') return; /* if still thumbing */ +#endif + + sbw->scrollbar.top = (top > 1.0) ? 1.0 : + (top >= 0.0) ? top : sbw->scrollbar.top; + + sbw->scrollbar.shown = (shown > 1.0) ? 1.0 : + (shown >= 0.0) ? shown : sbw->scrollbar.shown; + + PaintThumb (sbw); +} + diff --git a/vendor/x11iraf/xaw3d/Scrollbar.h b/vendor/x11iraf/xaw3d/Scrollbar.h new file mode 100644 index 00000000..2821018c --- /dev/null +++ b/vendor/x11iraf/xaw3d/Scrollbar.h @@ -0,0 +1,146 @@ +/* $XConsortium: Scrollbar.h,v 1.7 91/07/26 21:59:31 converse Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _Scrollbar_h +#define _Scrollbar_h + +/**************************************************************** + * + * Scrollbar Widget + * + ****************************************************************/ + +#include <X11/Xmu/Converters.h> +#include <X11/Xfuncproto.h> + +/* Scrollbar resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + accelerators Accelerators AcceleratorTable NULL + ancestorSensitive AncestorSensitive Boolean True + background Background Pixel XtDefaultBackground + backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderWidth BorderWidth Dimension 1 + colormap Colormap Colormap parent's colormap + cursor Cursor Cursor None + cursorName Cursor String NULL + depth Depth int parent's depth + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + height Height Dimension length or thickness + insensitiveBorder Insensitive Pixmap GreyPixmap + jumpProc Callback XtCallbackList NULL + length Length Dimension 1 + mappedWhenManaged MappedWhenManaged Boolean True + minimumThumb MinimumThumb Dimension 7 + orientation Orientation XtOrientation XtorientVertical + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + screen Screen Screen parent's screen + scrollDCursor Cursor Cursor XC_sb_down_arrow + scrollHCursor Cursor Cursor XC_sb_h_double_arrow + scrollLCursor Cursor Cursor XC_sb_left_arrow + scrollProc Callback XtCallbackList NULL + scrollRCursor Cursor Cursor XC_sb_right_arrow + scrollUCursor Cursor Cursor XC_sb_up_arrow + scrollVCursor Cursor Cursor XC_sb_v_double_arrow + sensitive Sensitive Boolean True + shown Shown Float 0.0 + thickness Thickness Dimension 14 + thumb Thumb Bitmap GreyPixmap + thumbProc Callback XtCallbackList NULL + topOfThumb TopOfThumb Float 0.0 + pickTop PickTop Boolean False + translations Translations TranslationTable see source or doc + width Width Dimension thickness or length + x Position Position 0 + y Position Position 0 + +*/ + +/* + * Most things we need are in StringDefs.h + */ + +#define XtCMinimumThumb "MinimumThumb" +#define XtCShown "Shown" +#define XtCTopOfThumb "TopOfThumb" +#define XtCPickTop "PickTop" + +#define XtNminimumThumb "minimumThumb" +#define XtNtopOfThumb "topOfThumb" +#define XtNpickTop "pickTop" + +typedef struct _ScrollbarRec *ScrollbarWidget; +typedef struct _ScrollbarClassRec *ScrollbarWidgetClass; + +extern WidgetClass scrollbarWidgetClass; + +_XFUNCPROTOBEGIN + +extern void XawScrollbarSetThumb( +#if NeedFunctionPrototypes + Widget /* scrollbar */, +#if NeedWidePrototypes + /* float */ double /* top */, + /* float */ double /* shown */ +#else + float /* top */, + float /* shown */ +#endif +#endif +); + +_XFUNCPROTOEND + +#endif /* _Scrollbar_h */ diff --git a/vendor/x11iraf/xaw3d/ScrollbarP.h b/vendor/x11iraf/xaw3d/ScrollbarP.h new file mode 100644 index 00000000..445387db --- /dev/null +++ b/vendor/x11iraf/xaw3d/ScrollbarP.h @@ -0,0 +1,121 @@ +/* MODIFIED ATHENA SCROLLBAR (USING ARROWHEADS AT ENDS OF TRAVEL) */ +/* Modifications Copyright 1992 by Mitch Trachtenberg */ +/* Rights, permissions, and disclaimer of warranty are as in the */ +/* DEC and MIT notice below. See usage warning in .c file. */ + +/* + * $XConsortium: ScrollbarP.h,v 1.2 90/04/11 17:33:53 jim Exp $ + */ + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _ScrollbarP_h +#define _ScrollbarP_h + +#include <X11/Xaw3d/Scrollbar.h> +#include <X11/Xaw3d/ThreeDP.h> + +typedef struct { + /* public */ + Pixel foreground; /* thumb foreground color */ + XtOrientation orientation; /* horizontal or vertical */ + XtCallbackList scrollProc; /* proportional scroll */ + XtCallbackList thumbProc; /* jump (to position) scroll */ + XtCallbackList jumpProc; /* same as thumbProc but pass data by ref */ + Pixmap thumb; /* thumb color */ +#ifndef ARROW_SCROLLBAR + Cursor upCursor; /* scroll up cursor */ + Cursor downCursor; /* scroll down cursor */ + Cursor leftCursor; /* scroll left cursor */ + Cursor rightCursor; /* scroll right cursor */ + Cursor verCursor; /* scroll vertical cursor */ + Cursor horCursor; /* scroll horizontal cursor */ +#endif + float top; /* What percent is above the win's top */ + float shown; /* What percent is shown in the win */ + Dimension length; /* either height or width */ + Dimension thickness; /* either width or height */ + Dimension min_thumb; /* minium size for the thumb. */ + float picked; /* How much of the thumb is picked * + * when scrolling starts */ + + /* private */ +#ifdef ARROW_SCROLLBAR + XtIntervalId timer_id; /* autorepeat timer; remove on destruction */ + char scroll_mode; /* 0:none 1:up/back 2:track 3:down/forward */ +#else + Cursor inactiveCursor; /* the normal cursor for scrollbar */ + char direction; /* a scroll has started; which direction */ +#endif + GC gc; /* a (shared) gc */ + Position topLoc; /* Pixel that corresponds to top */ + Dimension shownLength; /* Num pixels corresponding to shown */ + Boolean pick_top; /* pick thumb at top or anywhere*/ + +} ScrollbarPart; + +typedef struct _ScrollbarRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + ScrollbarPart scrollbar; +} ScrollbarRec; + +typedef struct {int empty;} ScrollbarClassPart; + +typedef struct _ScrollbarClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + ScrollbarClassPart scrollbar_class; +} ScrollbarClassRec; + +extern ScrollbarClassRec scrollbarClassRec; + +#endif /* _ScrollbarP_h */ diff --git a/vendor/x11iraf/xaw3d/Simple.c b/vendor/x11iraf/xaw3d/Simple.c new file mode 100644 index 00000000..63d71882 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Simple.c @@ -0,0 +1,294 @@ +/* $XConsortium: Simple.c,v 1.36 94/04/17 20:12:43 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/SimpleP.h> +#include <X11/Xmu/Drawing.h> + +#define offset(field) XtOffsetOf(SimpleRec, simple.field) + +static XtResource resources[] = { + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, (XtPointer) None}, + {XtNinsensitiveBorder, XtCInsensitive, XtRPixmap, sizeof(Pixmap), + offset(insensitive_border), XtRImmediate, (XtPointer) NULL}, + {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), + offset(pointer_fg), XtRString, XtDefaultForeground}, + {XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), + offset(pointer_bg), XtRString, XtDefaultBackground}, + {XtNcursorName, XtCCursor, XtRString, sizeof(String), + offset(cursor_name), XtRString, NULL}, + {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), + offset(international), XtRImmediate, (XtPointer) FALSE}, +#undef offset +}; + +static void ClassPartInitialize(), ClassInitialize(),Realize(),ConvertCursor(); +static Boolean SetValues(), ChangeSensitive(); + +SimpleClassRec simpleClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "Simple", + /* widget_size */ sizeof(SimpleRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ ChangeSensitive + } +}; + +WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; + +static void ClassInitialize() +{ + static XtConvertArgRec convertArg[] = { + {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)}, + {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)}, + {XtResourceString, (XtPointer) XtNpointerColorBackground, + sizeof(Pixel)}, + {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap), + sizeof(Colormap)} + }; + + XawInitializeWidgetSet(); + XtSetTypeConverter( XtRString, XtRColorCursor, XmuCvtStringToColorCursor, + convertArg, XtNumber(convertArg), + XtCacheByDisplay, (XtDestructor)NULL); +} + +static void ClassPartInitialize(class) + WidgetClass class; +{ + SimpleWidgetClass c = (SimpleWidgetClass) class; + SimpleWidgetClass super = (SimpleWidgetClass) + c->core_class.superclass; + + if (c->simple_class.change_sensitive == NULL) { + char buf[BUFSIZ]; + + (void) sprintf(buf, + "%s Widget: The Simple Widget class method 'change_sensitive' is undefined.\nA function must be defined or inherited.", + c->core_class.class_name); + XtWarning(buf); + c->simple_class.change_sensitive = ChangeSensitive; + } + + if (c->simple_class.change_sensitive == XtInheritChangeSensitive) + c->simple_class.change_sensitive = super->simple_class.change_sensitive; +} + +static void Realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + Pixmap border_pixmap = 0; + if (!XtIsSensitive(w)) { + /* change border to gray; have to remember the old one, + * so XtDestroyWidget deletes the proper one */ + if (((SimpleWidget)w)->simple.insensitive_border == None) + ((SimpleWidget)w)->simple.insensitive_border = + XmuCreateStippledPixmap(XtScreen(w), + w->core.border_pixel, + w->core.background_pixel, + w->core.depth); + border_pixmap = w->core.border_pixmap; + attributes->border_pixmap = + w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border; + + *valueMask |= CWBorderPixmap; + *valueMask &= ~CWBorderPixel; + } + + ConvertCursor(w); + + if ((attributes->cursor = ((SimpleWidget)w)->simple.cursor) != None) + *valueMask |= CWCursor; + + XtCreateWindow( w, (unsigned int)InputOutput, (Visual *)CopyFromParent, + *valueMask, attributes ); + + if (!XtIsSensitive(w)) + w->core.border_pixmap = border_pixmap; +} + +/* Function Name: ConvertCursor + * Description: Converts a name to a new cursor. + * Arguments: w - the simple widget. + * Returns: none. + */ + +static void +ConvertCursor(w) +Widget w; +{ + SimpleWidget simple = (SimpleWidget) w; + XrmValue from, to; + Cursor cursor; + + if (simple->simple.cursor_name == NULL) + return; + + from.addr = (XPointer) simple->simple.cursor_name; + from.size = strlen((char *) from.addr) + 1; + + to.size = sizeof(Cursor); + to.addr = (XPointer) &cursor; + + if (XtConvertAndStore(w, XtRString, &from, XtRColorCursor, &to)) { + if ( cursor != None) + simple->simple.cursor = cursor; + } + else { + XtAppErrorMsg(XtWidgetToApplicationContext(w), + "convertFailed","ConvertCursor","XawError", + "Simple: ConvertCursor failed.", + (String *)NULL, (Cardinal *)NULL); + } +} + + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + SimpleWidget s_old = (SimpleWidget) current; + SimpleWidget s_new = (SimpleWidget) new; + Boolean new_cursor = FALSE; + + /* this disables user changes after creation*/ + s_new->simple.international = s_old->simple.international; + + if ( XtIsSensitive(current) != XtIsSensitive(new) ) + (*((SimpleWidgetClass)XtClass(new))-> + simple_class.change_sensitive) ( new ); + + if (s_old->simple.cursor != s_new->simple.cursor) { + new_cursor = TRUE; + } + +/* + * We are not handling the string cursor_name correctly here. + */ + + if ( (s_old->simple.pointer_fg != s_new->simple.pointer_fg) || + (s_old->simple.pointer_bg != s_new->simple.pointer_bg) || + (s_old->simple.cursor_name != s_new->simple.cursor_name) ) { + ConvertCursor(new); + new_cursor = TRUE; + } + + if (new_cursor && XtIsRealized(new)) + XDefineCursor(XtDisplay(new), XtWindow(new), s_new->simple.cursor); + + return False; +} + + +static Boolean ChangeSensitive(w) + Widget w; +{ + if (XtIsRealized(w)) { + if (XtIsSensitive(w)) + if (w->core.border_pixmap != XtUnspecifiedPixmap) + XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), + w->core.border_pixmap ); + else + XSetWindowBorder( XtDisplay(w), XtWindow(w), + w->core.border_pixel ); + else { + if (((SimpleWidget)w)->simple.insensitive_border == None) + ((SimpleWidget)w)->simple.insensitive_border = + XmuCreateStippledPixmap(XtScreen(w), + w->core.border_pixel, + w->core.background_pixel, + w->core.depth); + XSetWindowBorderPixmap( XtDisplay(w), XtWindow(w), + ((SimpleWidget)w)-> + simple.insensitive_border ); + } + } + return False; +} diff --git a/vendor/x11iraf/xaw3d/Simple.h b/vendor/x11iraf/xaw3d/Simple.h new file mode 100644 index 00000000..982ba339 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Simple.h @@ -0,0 +1,103 @@ +/* $XConsortium: Simple.h,v 1.14 94/04/17 20:12:44 rws Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _Simple_h +#define _Simple_h + +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * Simple widgets + * + ****************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + cursor Cursor Cursor None + cursorName Cursor String NULL + destroyCallback Callback Pointer NULL + height Height Dimension 0 + insensitiveBorder Insensitive Pixmap Gray + mappedWhenManaged MappedWhenManaged Boolean True + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +#define XtNcursor "cursor" +#define XtNcursorName "cursorName" +#define XtNinsensitiveBorder "insensitiveBorder" + +#define XtCInsensitive "Insensitive" + +#ifndef XtCInternational +#define XtCInternational "International" +#endif + +#ifndef XtNinternational +#define XtNinternational "international" +#endif + +typedef struct _SimpleClassRec *SimpleWidgetClass; +typedef struct _SimpleRec *SimpleWidget; + +extern WidgetClass simpleWidgetClass; + +#endif /* _Simple_h */ diff --git a/vendor/x11iraf/xaw3d/SimpleMenP.h b/vendor/x11iraf/xaw3d/SimpleMenP.h new file mode 100644 index 00000000..80d299e1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SimpleMenP.h @@ -0,0 +1,99 @@ +/* + * $XConsortium: SimpleMenP.h,v 1.14 94/04/17 20:12:44 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + */ + +/* + * SimpleMenuP.h - Private Header file for SimpleMenu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SimpleMenuP_h +#define _SimpleMenuP_h + +#include <X11/Xaw3d/SimpleMenu.h> +#include <X11/Xaw3d/SmeP.h> +#include <X11/ShellP.h> + +typedef struct { + XtPointer extension; /* For future needs. */ +} SimpleMenuClassPart; + +typedef struct _SimpleMenuClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ShellClassPart shell_class; + OverrideShellClassPart override_shell_class; + SimpleMenuClassPart simpleMenu_class; +} SimpleMenuClassRec; + +extern SimpleMenuClassRec simpleMenuClassRec; + +typedef struct _SimpleMenuPart { + + /* resources */ + + String label_string; /* The string for the label or NULL. */ + SmeObject label; /* If label_string is non-NULL then this is + the label widget. */ + WidgetClass label_class; /* Widget Class of the menu label object. */ + + Dimension top_margin; /* Top and bottom margins. */ + Dimension bottom_margin; + Dimension row_height; /* height of each row (menu entry) */ + + Cursor cursor; /* The menu's cursor. */ + SmeObject popup_entry; /* The entry to position the cursor on for + when using XawPositionSimpleMenu. */ + Boolean menu_on_screen; /* Force the menus to be fully on the screen.*/ + int backing_store; /* What type of backing store to use. */ + + /* private state */ + + Boolean recursive_set_values; /* contain a possible infinite loop. */ + + Boolean menu_width; /* If true then force width to remain + core.width */ + Boolean menu_height; /* Just like menu_width, but for height. */ + + SmeObject entry_set; /* The entry that is currently set or + highlighted. */ +} SimpleMenuPart; + +typedef struct _SimpleMenuRec { + CorePart core; + CompositePart composite; + ShellPart shell; + OverrideShellPart override; + SimpleMenuPart simple_menu; +} SimpleMenuRec; + +#endif /* _SimpleMenuP_h */ diff --git a/vendor/x11iraf/xaw3d/SimpleMenu.c b/vendor/x11iraf/xaw3d/SimpleMenu.c new file mode 100644 index 00000000..a51c34ea --- /dev/null +++ b/vendor/x11iraf/xaw3d/SimpleMenu.c @@ -0,0 +1,1277 @@ +/* $XConsortium: SimpleMenu.c,v 1.44 94/04/17 20:12:45 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * SimpleMenu.c - Source code file for SimpleMenu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/SimpleMenP.h> +#include <X11/Xaw3d/SmeBSB.h> +#include <X11/Xaw3d/Cardinals.h> + +#include <X11/Xmu/Initer.h> +#include <X11/Xmu/CharSet.h> + +#define streq(a, b) ( strcmp((a), (b)) == 0 ) + +#define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field) + +static XtResource resources[] = { + +/* + * Label Resources. + */ + + {XtNlabel, XtCLabel, XtRString, sizeof(String), + offset(label_string), XtRString, NULL}, + {XtNlabelClass, XtCLabelClass, XtRPointer, sizeof(WidgetClass), + offset(label_class), XtRImmediate, (XtPointer) NULL}, + +/* + * Layout Resources. + */ + + {XtNrowHeight, XtCRowHeight, XtRDimension, sizeof(Dimension), + offset(row_height), XtRImmediate, (XtPointer) 0}, + {XtNtopMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension), + offset(top_margin), XtRImmediate, (XtPointer) 0}, + {XtNbottomMargin, XtCVerticalMargins, XtRDimension, sizeof(Dimension), + offset(bottom_margin), XtRImmediate, (XtPointer) 0}, + +/* + * Misc. Resources + */ + + { XtNallowShellResize, XtCAllowShellResize, XtRBoolean, sizeof(Boolean), + XtOffsetOf(SimpleMenuRec, shell.allow_shell_resize), + XtRImmediate, (XtPointer) TRUE }, + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(cursor), XtRImmediate, (XtPointer) None}, + {XtNmenuOnScreen, XtCMenuOnScreen, XtRBoolean, sizeof(Boolean), + offset(menu_on_screen), XtRImmediate, (XtPointer) TRUE}, + {XtNpopupOnEntry, XtCPopupOnEntry, XtRWidget, sizeof(Widget), + offset(popup_entry), XtRWidget, NULL}, + {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), + offset(backing_store), + XtRImmediate, (XtPointer) (Always + WhenMapped + NotUseful)}, +}; +#undef offset + +static char defaultTranslations[] = + ":<EnterWindow>: highlight() \n\ + :<LeaveWindow>: unhighlight() \n\ + :<BtnMotion>: highlight() \n\ + :<BtnUp>: MenuPopdown() notify() unhighlight()"; + +/* + * Semi Public function definitions. + */ + +static void Redisplay(), Realize(), Resize(), ChangeManaged(); +static void Initialize(), ClassInitialize(), ClassPartInitialize(); +static Boolean SetValues(), SetValuesHook(); +static XtGeometryResult GeometryManager(); + +/* + * Action Routine Definitions + */ + +static void Highlight(), Unhighlight(), Notify(), PositionMenuAction(); + +/* + * Private Function Definitions. + */ + +static void MakeSetValuesRequest(), CreateLabel(), Layout(); +static void AddPositionAction(), PositionMenu(), ChangeCursorOnGrab(); +static Dimension GetMenuWidth(), GetMenuHeight(); +static Widget FindMenu(); +static SmeObject GetEventEntry(); +static void MoveMenu(); + +static XtActionsRec actionsList[] = +{ + {"notify", Notify}, + {"highlight", Highlight}, + {"unhighlight", Unhighlight}, +}; + +static CompositeClassExtensionRec extension_rec = { + /* next_extension */ NULL, + /* record_type */ NULLQUARK, + /* version */ XtCompositeExtensionVersion, + /* record_size */ sizeof(CompositeClassExtensionRec), + /* accepts_objects */ TRUE, +}; + +#define superclass (&overrideShellClassRec) + +SimpleMenuClassRec simpleMenuClassRec = { + { + /* superclass */ (WidgetClass) superclass, + /* class_name */ "SimpleMenu", + /* size */ sizeof(SimpleMenuRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize*/ ClassPartInitialize, + /* Class init'ed */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actionsList, + /* num_actions */ XtNumber(actionsList), + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ SetValuesHook, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ NULL, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + },{ + /* Shell extension */ NULL + },{ + /* Override extension */ NULL + },{ + /* Simple Menu extension*/ NULL + } +}; + +WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec; + +#define ForAllChildren(smw, childP) \ + for ( (childP) = (SmeObject *) (smw)->composite.children ; \ + (childP) < (SmeObject *) ( (smw)->composite.children + \ + (smw)->composite.num_children ) ; \ + (childP)++ ) + +/************************************************************ + * + * Semi-Public Functions. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: Class Initialize routine, called only once. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore, + (XtConvertArgList)NULL, (Cardinal)0 ); + XmuAddInitializer( AddPositionAction, NULL); +} + +/* Function Name: ClassInitialize + * Description: Class Part Initialize routine, called for every + * subclass. Makes sure that the subclasses pick up + * the extension record. + * Arguments: wc - the widget class of the subclass. + * Returns: none. + */ + +static void +ClassPartInitialize(wc) +WidgetClass wc; +{ + SimpleMenuWidgetClass smwc = (SimpleMenuWidgetClass) wc; + +/* + * Make sure that our subclass gets the extension rec too. + */ + + extension_rec.next_extension = smwc->composite_class.extension; + smwc->composite_class.extension = (XtPointer) &extension_rec; +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) new; + + XmuCallInitializers(XtWidgetToApplicationContext(new)); + + if (smw->simple_menu.label_class == NULL) + smw->simple_menu.label_class = smeBSBObjectClass; + + smw->simple_menu.label = NULL; + smw->simple_menu.entry_set = NULL; + smw->simple_menu.recursive_set_values = FALSE; + + if (smw->simple_menu.label_string != NULL) + CreateLabel(new); + + smw->simple_menu.menu_width = TRUE; + + if (smw->core.width == 0) { + smw->simple_menu.menu_width = FALSE; + smw->core.width = GetMenuWidth(new, (Widget)NULL); + } + + smw->simple_menu.menu_height = TRUE; + + if (smw->core.height == 0) { + smw->simple_menu.menu_height = FALSE; + smw->core.height = GetMenuHeight(new); + } + +/* + * Add a popup_callback routine for changing the cursor. + */ + + XtAddCallback(new, XtNpopupCallback, ChangeCursorOnGrab, (XtPointer)NULL); +} + +/* Function Name: Redisplay + * Description: Redisplays the contents of the widget. + * Arguments: w - the simple menu widget. + * event - the X event that caused this redisplay. + * region - the region the needs to be repainted. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Redisplay(w, event, region) +Widget w; +XEvent * event; +Region region; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + SmeObjectClass class; + + if (region == NULL) + XClearWindow(XtDisplay(w), XtWindow(w)); + + /* + * Check and Paint each of the entries - including the label. + */ + + ForAllChildren(smw, entry) { + if (!XtIsManaged ( (Widget) *entry)) continue; + + if (region != NULL) + switch(XRectInRegion(region, (int) (*entry)->rectangle.x, + (int) (*entry)->rectangle.y, + (unsigned int) (*entry)->rectangle.width, + (unsigned int) (*entry)->rectangle.height)) { + case RectangleIn: + case RectanglePart: + break; + default: + continue; + } + class = (SmeObjectClass) (*entry)->object.widget_class; + + if (class->rect_class.expose != NULL) + (class->rect_class.expose)( (Widget) *entry, NULL, NULL); + } +} + +/* Function Name: Realize + * Description: Realizes the widget. + * Arguments: w - the simple menu widget. + * mask - value mask for the window to create. + * attrs - attributes for the window to create. + * Returns: none + */ + +static void +Realize(w, mask, attrs) +Widget w; +XtValueMask * mask; +XSetWindowAttributes * attrs; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + attrs->cursor = smw->simple_menu.cursor; + *mask |= CWCursor; + if ((smw->simple_menu.backing_store == Always) || + (smw->simple_menu.backing_store == NotUseful) || + (smw->simple_menu.backing_store == WhenMapped) ) { + *mask |= CWBackingStore; + attrs->backing_store = smw->simple_menu.backing_store; + } + else + *mask &= ~CWBackingStore; + + (*superclass->core_class.realize) (w, mask, attrs); +} + +/* Function Name: Resize + * Description: Handle the menu being resized bigger. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +Resize(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + + if ( !XtIsRealized(w) ) return; + + ForAllChildren(smw, entry) /* reset width of all entries. */ + if (XtIsManaged( (Widget) *entry)) + (*entry)->rectangle.width = smw->core.width; + + Redisplay(w, (XEvent *) NULL, (Region) NULL); +} + +/* Function Name: SetValues + * Description: Relayout the menu when one of the resources is changed. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: none + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + SimpleMenuWidget smw_old = (SimpleMenuWidget) current; + SimpleMenuWidget smw_new = (SimpleMenuWidget) new; + Boolean ret_val = FALSE, layout = FALSE; + + if (!XtIsRealized(current)) return(FALSE); + + if (!smw_new->simple_menu.recursive_set_values) { + if (smw_new->core.width != smw_old->core.width) { + smw_new->simple_menu.menu_width = (smw_new->core.width != 0); + layout = TRUE; + } + if (smw_new->core.height != smw_old->core.height) { + smw_new->simple_menu.menu_height = (smw_new->core.height != 0); + layout = TRUE; + } + } + + if (smw_old->simple_menu.cursor != smw_new->simple_menu.cursor) + XDefineCursor(XtDisplay(new), + XtWindow(new), smw_new->simple_menu.cursor); + + if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) + if (smw_new->simple_menu.label_string == NULL) /* Destroy. */ + XtDestroyWidget((Widget) smw_old->simple_menu.label); + else if (smw_old->simple_menu.label_string == NULL) /* Create. */ + CreateLabel(new); + else { /* Change. */ + Arg arglist[1]; + + XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string); + XtSetValues((Widget) smw_new->simple_menu.label, arglist, ONE); + } + + if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class) + XtAppWarning(XtWidgetToApplicationContext(new), + "No Dynamic class change of the SimpleMenu Label."); + + if ((smw_old->simple_menu.top_margin != smw_new->simple_menu.top_margin) || + (smw_old->simple_menu.bottom_margin != + smw_new->simple_menu.bottom_margin) /* filler................. */ ) { + layout = TRUE; + ret_val = TRUE; + } + + if (layout) + Layout(new, (Dimension *)NULL, (Dimension *)NULL); + + return(ret_val); +} + +/* Function Name: SetValuesHook + * Description: To handle a special case, this is passed the + * actual arguments. + * Arguments: w - the menu widget. + * arglist - the argument list passed to XtSetValues. + * num_args - the number of args. + * Returns: none + */ + +/* + * If the user actually passed a width and height to the widget + * then this MUST be used, rather than our newly calculated width and + * height. + */ + +static Boolean +SetValuesHook(w, arglist, num_args) +Widget w; +ArgList arglist; +Cardinal *num_args; +{ + Cardinal i; + Dimension width, height; + + width = w->core.width; + height = w->core.height; + + for ( i = 0 ; i < *num_args ; i++) { + if ( streq(arglist[i].name, XtNwidth) ) + width = (Dimension) arglist[i].value; + if ( streq(arglist[i].name, XtNheight) ) + height = (Dimension) arglist[i].value; + } + + if ((width != w->core.width) || (height != w->core.height)) + MakeSetValuesRequest(w, width, height); + return(FALSE); +} + +/************************************************************ + * + * Geometry Management routines. + * + ************************************************************/ + +/* Function Name: GeometryManager + * Description: This is the SimpleMenu Widget's Geometry Manager. + * Arguments: w - the Menu Entry making the request. + * request - requested new geometry. + * reply - the allowed geometry. + * Returns: XtGeometry{Yes, No, Almost}. + */ + +static XtGeometryResult +GeometryManager(w, request, reply) +Widget w; +XtWidgetGeometry * request, * reply; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) XtParent(w); + SmeObject entry = (SmeObject) w; + XtGeometryMask mode = request->request_mode; + XtGeometryResult answer; + Dimension old_height, old_width; + + if ( !(mode & CWWidth) && !(mode & CWHeight) ) + return(XtGeometryNo); + + reply->width = request->width; + reply->height = request->height; + + old_width = entry->rectangle.width; + old_height = entry->rectangle.height; + + Layout(w, &(reply->width), &(reply->height) ); + +/* + * Since we are an override shell and have no parent there is no one to + * ask to see if this geom change is okay, so I am just going to assume + * we can do whatever we want. If you subclass be very careful with this + * assumption, it could bite you. + * + * Chris D. Peterson - Sept. 1989. + */ + + if ( (reply->width == request->width) && + (reply->height == request->height) ) { + + if ( mode & XtCWQueryOnly ) { /* Actually perform the layout. */ + entry->rectangle.width = old_width; + entry->rectangle.height = old_height; + } + else { + Layout(( Widget) smw, (Dimension *)NULL, (Dimension *)NULL); + } + answer = XtGeometryDone; + } + else { + entry->rectangle.width = old_width; + entry->rectangle.height = old_height; + + if ( ((reply->width == request->width) && !(mode & CWHeight)) || + ((reply->height == request->height) && !(mode & CWWidth)) || + ((reply->width == request->width) && + (reply->height == request->height)) ) + answer = XtGeometryNo; + else { + answer = XtGeometryAlmost; + reply->request_mode = 0; + if (reply->width != request->width) + reply->request_mode |= CWWidth; + if (reply->height != request->height) + reply->request_mode |= CWHeight; + } + } + return(answer); +} + +/* Function Name: ChangeManaged + * Description: called whenever a new child is managed. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +ChangeManaged(w) +Widget w; +{ + Layout(w, (Dimension *)NULL, (Dimension *)NULL); +} + +/************************************************************ + * + * Global Action Routines. + * + * These actions routines will be added to the application's + * global action list. + * + ************************************************************/ + +/* Function Name: PositionMenuAction + * Description: Positions the simple menu widget. + * Arguments: w - a widget (no the simple menu widget.) + * event - the event that caused this action. + * params, num_params - parameters passed to the routine. + * we expect the name of the menu here. + * Returns: none + */ + +/* ARGSUSED */ +static void +PositionMenuAction(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + Widget menu; + XPoint loc; + + if (*num_params != 1) { + char error_buf[BUFSIZ]; + (void) sprintf(error_buf, "%s %s", + "Xaw - SimpleMenuWidget: position menu action expects only one", + "parameter which is the name of the menu."); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + if ( (menu = FindMenu(w, params[0])) == NULL) { + char error_buf[BUFSIZ]; + (void) sprintf(error_buf, "%s '%s'", + "Xaw - SimpleMenuWidget: could not find menu named: ", params[0]); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + switch (event->type) { + case ButtonPress: + case ButtonRelease: + loc.x = event->xbutton.x_root; + loc.y = event->xbutton.y_root; + PositionMenu(menu, &loc); + break; + case EnterNotify: + case LeaveNotify: + loc.x = event->xcrossing.x_root; + loc.y = event->xcrossing.y_root; + PositionMenu(menu, &loc); + break; + case MotionNotify: + loc.x = event->xmotion.x_root; + loc.y = event->xmotion.y_root; + PositionMenu(menu, &loc); + break; + default: + PositionMenu(menu, (XPoint *)NULL); + break; + } +} + +/************************************************************ + * + * Widget Action Routines. + * + ************************************************************/ + +/* Function Name: Unhighlight + * Description: Unhighlights current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Unhighlight(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry = smw->simple_menu.entry_set; + SmeObjectClass class; + + if ( entry == NULL) return; + + smw->simple_menu.entry_set = NULL; + class = (SmeObjectClass) entry->object.widget_class; + (class->sme_class.unhighlight) ( (Widget) entry); +} + +/* Function Name: Highlight + * Description: Highlights current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Highlight(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry; + SmeObjectClass class; + + if ( !XtIsSensitive(w) ) return; + + entry = GetEventEntry(w, event); + + if (entry == smw->simple_menu.entry_set) return; + + Unhighlight(w, event, params, num_params); + + if (entry == NULL) return; + + if ( !XtIsSensitive( (Widget) entry)) { + smw->simple_menu.entry_set = NULL; + return; + } + + smw->simple_menu.entry_set = entry; + class = (SmeObjectClass) entry->object.widget_class; + + (class->sme_class.highlight) ( (Widget) entry); +} + +/* Function Name: Notify + * Description: Notify user of current entry. + * Arguments: w - the simple menu widget. + * event - the event that caused this action. + * params, num_params - ** NOT USED ** + * Returns: none + */ + +/* ARGSUSED */ +static void +Notify(w, event, params, num_params) +Widget w; +XEvent * event; +String * params; +Cardinal * num_params; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry = smw->simple_menu.entry_set; + SmeObjectClass class; + + if ( (entry == NULL) || !XtIsSensitive((Widget) entry ) ) return; + + class = (SmeObjectClass) entry->object.widget_class; + (class->sme_class.notify)( (Widget) entry ); +} + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawSimpleMenuAddGlobalActions + * Description: adds the global actions to the simple menu widget. + * Arguments: app_con - the appcontext. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawSimpleMenuAddGlobalActions(XtAppContext app_con) +#else +XawSimpleMenuAddGlobalActions(app_con) +XtAppContext app_con; +#endif +{ + XtInitializeWidgetClass(simpleMenuWidgetClass); + XmuCallInitializers( app_con ); +} + + +/* Function Name: XawSimpleMenuGetActiveEntry + * Description: Gets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: the currently set entry or NULL if none is set. + */ + +Widget +#if NeedFunctionPrototypes +XawSimpleMenuGetActiveEntry(Widget w) +#else +XawSimpleMenuGetActiveEntry(w) +Widget w; +#endif +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + return( (Widget) smw->simple_menu.entry_set); +} + +/* Function Name: XawSimpleMenuClearActiveEntry + * Description: Unsets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawSimpleMenuClearActiveEntry(Widget w) +#else +XawSimpleMenuClearActiveEntry(w) +Widget w; +#endif +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + smw->simple_menu.entry_set = NULL; +} + +/************************************************************ + * + * Private Functions. + * + ************************************************************/ + +/* Function Name: CreateLabel + * Description: Creates a the menu label. + * Arguments: w - the smw widget. + * Returns: none. + * + * Creates the label object and makes sure it is the first child in + * in the list. + */ + +static void +CreateLabel(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Widget * child, * next_child; + int i; + Arg args[2]; + + if ( (smw->simple_menu.label_string == NULL) || + (smw->simple_menu.label != NULL) ) { + char error_buf[BUFSIZ]; + + (void) sprintf(error_buf, "Xaw Simple Menu Widget: %s or %s, %s", + "label string is NULL", "label already exists", + "no label is being created."); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + + XtSetArg(args[0], XtNlabel, smw->simple_menu.label_string); + XtSetArg(args[1], XtNjustify, XtJustifyCenter); + smw->simple_menu.label = (SmeObject) + XtCreateManagedWidget("menuLabel", + smw->simple_menu.label_class, w, + args, TWO); + + next_child = NULL; + for (child = smw->composite.children + smw->composite.num_children, + i = smw->composite.num_children ; i > 0 ; i--, child--) { + if (next_child != NULL) + *next_child = *child; + next_child = child; + } + *child = (Widget) smw->simple_menu.label; +} + +/* Function Name: Layout + * Description: lays the menu entries out all nice and neat. + * Arguments: w - See below (+++) + * width_ret, height_ret - The returned width and + * height values. + * Returns: none. + * + * if width == NULL || height == NULL then it assumes the you do not care + * about the return values, and just want a relayout. + * + * if this is not the case then it will set width_ret and height_ret + * to be width and height that the child would get if it were layed out + * at this time. + * + * +++ "w" can be the simple menu widget or any of its object children. + */ + +static void +Layout(w, width_ret, height_ret) +Widget w; +Dimension *width_ret, *height_ret; +{ + SmeObject current_entry, *entry; + SimpleMenuWidget smw; + Dimension width, height; + Boolean do_layout = ((height_ret == NULL) || (width_ret == NULL)); + Boolean allow_change_size; + height = 0; + + if ( XtIsSubclass(w, simpleMenuWidgetClass) ) { + smw = (SimpleMenuWidget) w; + current_entry = NULL; + } + else { + smw = (SimpleMenuWidget) XtParent(w); + current_entry = (SmeObject) w; + } + + allow_change_size = (!XtIsRealized((Widget)smw) || + (smw->shell.allow_shell_resize)); + + if ( smw->simple_menu.menu_height ) + height = smw->core.height; + else + if (do_layout) { + height = smw->simple_menu.top_margin; + ForAllChildren(smw, entry) { + if (!XtIsManaged( (Widget) *entry)) continue; + + if ( (smw->simple_menu.row_height != 0) && + (*entry != smw->simple_menu.label) ) + (*entry)->rectangle.height = smw->simple_menu.row_height; + + (*entry)->rectangle.y = height; + (*entry)->rectangle.x = 0; + height += (*entry)->rectangle.height; + } + height += smw->simple_menu.bottom_margin; + } + else { + if ((smw->simple_menu.row_height != 0) && + (current_entry != smw->simple_menu.label) ) + height = smw->simple_menu.row_height; + } + + if (smw->simple_menu.menu_width) + width = smw->core.width; + else if ( allow_change_size ) + width = GetMenuWidth((Widget) smw, (Widget) current_entry); + else + width = smw->core.width; + + if (do_layout) { + ForAllChildren(smw, entry) + if (XtIsManaged( (Widget) *entry)) + (*entry)->rectangle.width = width; + + if (allow_change_size) + MakeSetValuesRequest((Widget) smw, width, height); + } + else { + *width_ret = width; + if (height != 0) + *height_ret = height; + } +} + +/* Function Name: AddPositionAction + * Description: Adds the XawPositionSimpleMenu action to the global + * action list for this appcon. + * Arguments: app_con - the application context for this app. + * data - NOT USED. + * Returns: none. + */ + +/* ARGSUSED */ +static void +AddPositionAction(app_con, data) +XtAppContext app_con; +XPointer data; +{ + static XtActionsRec pos_action[] = { + { "XawPositionSimpleMenu", PositionMenuAction }, + }; + + XtAppAddActions(app_con, pos_action, XtNumber(pos_action)); +} + +/* Function Name: FindMenu + * Description: Find the menu give a name and reference widget. + * Arguments: widget - reference widget. + * name - the menu widget's name. + * Returns: the menu widget or NULL. + */ + +static Widget +FindMenu(widget, name) +Widget widget; +String name; +{ + Widget w, menu; + + for ( w = widget ; w != NULL ; w = XtParent(w) ) + if ( (menu = XtNameToWidget(w, name)) != NULL ) + return(menu); + return(NULL); +} + +/* Function Name: PositionMenu + * Description: Places the menu + * Arguments: w - the simple menu widget. + * location - a pointer the the position or NULL. + * Returns: none. + */ + +static void +PositionMenu(w, location) +Widget w; +XPoint * location; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject entry; + XPoint t_point; + + if (location == NULL) { + Window junk1, junk2; + int root_x, root_y, junkX, junkY; + unsigned int junkM; + + location = &t_point; + if (XQueryPointer(XtDisplay(w), XtWindow(w), &junk1, &junk2, + &root_x, &root_y, &junkX, &junkY, &junkM) == FALSE) { + char error_buf[BUFSIZ]; + (void) sprintf(error_buf, "%s %s", "Xaw Simple Menu Widget:", + "Could not find location of mouse pointer"); + XtAppWarning(XtWidgetToApplicationContext(w), error_buf); + return; + } + location->x = (short) root_x; + location->y = (short) root_y; + } + + /* + * The width will not be correct unless it is realized. + */ + + XtRealizeWidget(w); + + location->x -= (Position) w->core.width/2; + + if (smw->simple_menu.popup_entry == NULL) + entry = smw->simple_menu.label; + else + entry = smw->simple_menu.popup_entry; + + if (entry != NULL) + location->y -= entry->rectangle.y + entry->rectangle.height/2; + + MoveMenu(w, (Position) location->x, (Position) location->y); +} + +/* Function Name: MoveMenu + * Description: Actually moves the menu, may force it to + * to be fully visable if menu_on_screen is TRUE. + * Arguments: w - the simple menu widget. + * x, y - the current location of the widget. + * Returns: none + */ + +static void +MoveMenu(w, x, y) +Widget w; +Position x, y; +{ + Arg arglist[2]; + Cardinal num_args = 0; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + if (smw->simple_menu.menu_on_screen) { + int width = w->core.width + 2 * w->core.border_width; + int height = w->core.height + 2 * w->core.border_width; + + if (x >= 0) { + int scr_width = WidthOfScreen(XtScreen(w)); + if (x + width > scr_width) + x = scr_width - width; + } + if (x < 0) + x = 0; + + if (y >= 0) { + int scr_height = HeightOfScreen(XtScreen(w)); + if (y + height > scr_height) + y = scr_height - height; + } + if (y < 0) + y = 0; + } + + XtSetArg(arglist[num_args], XtNx, x); num_args++; + XtSetArg(arglist[num_args], XtNy, y); num_args++; + XtSetValues(w, arglist, num_args); +} + +/* Function Name: ChangeCursorOnGrab + * Description: Changes the cursor on the active grab to the one + * specified in out resource list. + * Arguments: w - the widget. + * junk, garbage - ** NOT USED **. + * Returns: None. + */ + +/* ARGSUSED */ +static void +ChangeCursorOnGrab(w, junk, garbage) +Widget w; +XtPointer junk, garbage; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + + /* + * The event mask here is what is currently in the MIT implementation. + * There really needs to be a way to get the value of the mask out + * of the toolkit (CDP 5/26/89). + */ + + XChangeActivePointerGrab(XtDisplay(w), ButtonPressMask|ButtonReleaseMask, + smw->simple_menu.cursor, + XtLastTimestampProcessed(XtDisplay(w))); +} + +/* Function Name: MakeSetValuesRequest + * Description: Makes a (possibly recursive) call to SetValues, + * I take great pains to not go into an infinite loop. + * Arguments: w - the simple menu widget. + * width, height - the size of the ask for. + * Returns: none + */ + +static void +MakeSetValuesRequest(w, width, height) +Widget w; +Dimension width, height; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Arg arglist[2]; + Cardinal num_args = (Cardinal) 0; + + if ( !smw->simple_menu.recursive_set_values ) { + if ( (smw->core.width != width) || (smw->core.height != height) ) { + smw->simple_menu.recursive_set_values = TRUE; + XtSetArg(arglist[num_args], XtNwidth, width); num_args++; + XtSetArg(arglist[num_args], XtNheight, height); num_args++; + XtSetValues(w, arglist, num_args); + } + else if (XtIsRealized( (Widget) smw)) + Redisplay((Widget) smw, (XEvent *) NULL, (Region) NULL); + } + smw->simple_menu.recursive_set_values = FALSE; +} + +/* Function Name: GetMenuWidth + * Description: Sets the length of the widest entry in pixels. + * Arguments: w - the simple menu widget. + * Returns: width of menu. + */ + +static Dimension +GetMenuWidth(w, w_ent) +Widget w, w_ent; +{ + SmeObject cur_entry = (SmeObject) w_ent; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + Dimension width, widest = (Dimension) 0; + SmeObject * entry; + + if ( smw->simple_menu.menu_width ) + return(smw->core.width); + + ForAllChildren(smw, entry) { + XtWidgetGeometry preferred; + + if (!XtIsManaged( (Widget) *entry)) continue; + + if (*entry != cur_entry) { + XtQueryGeometry((Widget) *entry, (XtWidgetGeometry *)NULL, &preferred); + + if (preferred.request_mode & CWWidth) + width = preferred.width; + else + width = (*entry)->rectangle.width; + } + else + width = (*entry)->rectangle.width; + + if ( width > widest ) + widest = width; + } + + return(widest); +} + +/* Function Name: GetMenuHeight + * Description: Sets the length of the widest entry in pixels. + * Arguments: w - the simple menu widget. + * Returns: width of menu. + */ + +static Dimension +GetMenuHeight(w) +Widget w; +{ + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + Dimension height; + + if (smw->simple_menu.menu_height) + return(smw->core.height); + + height = smw->simple_menu.top_margin + smw->simple_menu.bottom_margin; + + if (smw->simple_menu.row_height == 0) { + ForAllChildren(smw, entry) + if (XtIsManaged ((Widget) *entry)) + height += (*entry)->rectangle.height; + } else + height += smw->simple_menu.row_height * smw->composite.num_children; + + return(height); +} + +/* Function Name: GetEventEntry + * Description: Gets an entry given an event that has X and Y coords. + * Arguments: w - the simple menu widget. + * event - the event. + * Returns: the entry that this point is in. + */ + +static SmeObject +GetEventEntry(w, event) +Widget w; +XEvent * event; +{ + Position x_loc = 0, y_loc = 0; + SimpleMenuWidget smw = (SimpleMenuWidget) w; + SmeObject * entry; + + switch (event->type) { + case MotionNotify: + x_loc = event->xmotion.x; + y_loc = event->xmotion.y; + break; + case EnterNotify: + case LeaveNotify: + x_loc = event->xcrossing.x; + y_loc = event->xcrossing.y; + break; + case ButtonPress: + case ButtonRelease: + x_loc = event->xbutton.x; + y_loc = event->xbutton.y; + break; + default: + XtAppError(XtWidgetToApplicationContext(w), + "Unknown event type in GetEventEntry()."); + break; + } + + if ( (x_loc < 0) || (x_loc >= (int)smw->core.width) || (y_loc < 0) || + (y_loc >= (int)smw->core.height) ) + return(NULL); + + ForAllChildren(smw, entry) { + if (!XtIsManaged ((Widget) *entry)) continue; + + if ( ((*entry)->rectangle.y < y_loc) && + ((*entry)->rectangle.y + (int) (*entry)->rectangle.height > y_loc) ) + if ( *entry == smw->simple_menu.label ) + return(NULL); /* cannot select the label. */ + else + return(*entry); + } + + return(NULL); +} diff --git a/vendor/x11iraf/xaw3d/SimpleMenu.h b/vendor/x11iraf/xaw3d/SimpleMenu.h new file mode 100644 index 00000000..8f527b85 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SimpleMenu.h @@ -0,0 +1,152 @@ +/* + * $XConsortium: SimpleMenu.h,v 1.22 94/04/17 20:12:47 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SimpleMenu.h - Public Header file for SimpleMenu widget. + * + * This is the public header file for the Athena SimpleMenu widget. + * It is intended to provide one pane pulldown and popup menus within + * the framework of the X Toolkit. As the name implies it is a first and + * by no means complete implementation of menu code. It does not attempt to + * fill the needs of all applications, but does allow a resource oriented + * interface to menus. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SimpleMenu_h +#define _SimpleMenu_h + +#include <X11/Shell.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * SimpleMenu widget + * + ****************************************************************/ + +/* SimpleMenu Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + backgroundPixmap BackgroundPixmap Pixmap None + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap BorderPixmap Pixmap None + borderWidth BorderWidth Dimension 1 + bottomMargin VerticalMargins Dimension VerticalSpace + columnWidth ColumnWidth Dimension Width of widest text + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + height Height Dimension 0 + label Label String NULL (No label) + labelClass LabelClass Pointer smeBSBObjectClass + mappedWhenManaged MappedWhenManaged Boolean True + rowHeight RowHeight Dimension Height of Font + sensitive Sensitive Boolean True + topMargin VerticalMargins Dimension VerticalSpace + width Width Dimension 0 + x Position Position 0n + y Position Position 0 + +*/ + +typedef struct _SimpleMenuClassRec* SimpleMenuWidgetClass; +typedef struct _SimpleMenuRec* SimpleMenuWidget; + +extern WidgetClass simpleMenuWidgetClass; + +#define XtNcursor "cursor" +#define XtNbottomMargin "bottomMargin" +#define XtNcolumnWidth "columnWidth" +#define XtNlabelClass "labelClass" +#define XtNmenuOnScreen "menuOnScreen" +#define XtNpopupOnEntry "popupOnEntry" +#define XtNrowHeight "rowHeight" +#define XtNtopMargin "topMargin" + +#define XtCColumnWidth "ColumnWidth" +#define XtCLabelClass "LabelClass" +#define XtCMenuOnScreen "MenuOnScreen" +#define XtCPopupOnEntry "PopupOnEntry" +#define XtCRowHeight "RowHeight" +#define XtCVerticalMargins "VerticalMargins" + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawSimpleMenuAddGlobalActions + * Description: adds the global actions to the simple menu widget. + * Arguments: app_con - the appcontext. + * Returns: none. + */ + +extern void XawSimpleMenuAddGlobalActions( +#if NeedFunctionPrototypes + XtAppContext /* app_con */ +#endif +); + +/* Function Name: XawSimpleMenuGetActiveEntry + * Description: Gets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: the currently set entry or NULL if none is set. + */ + +extern Widget XawSimpleMenuGetActiveEntry( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* Function Name: XawSimpleMenuClearActiveEntry + * Description: Unsets the currently active (set) entry. + * Arguments: w - the smw widget. + * Returns: none. + */ + +extern void XawSimpleMenuClearActiveEntry( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _SimpleMenu_h */ diff --git a/vendor/x11iraf/xaw3d/SimpleP.h b/vendor/x11iraf/xaw3d/SimpleP.h new file mode 100644 index 00000000..05c2436c --- /dev/null +++ b/vendor/x11iraf/xaw3d/SimpleP.h @@ -0,0 +1,86 @@ +/*********************************************************** + + $XConsortium: SimpleP.h,v 1.12 94/04/17 20:12:47 kaleb Exp $ + + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _SimpleP_h +#define _SimpleP_h + +#include <X11/Xaw3d/Simple.h> + +typedef struct { + Boolean (*change_sensitive)(/* widget */); +} SimpleClassPart; + +#define XtInheritChangeSensitive ((Boolean (*)())_XtInherit) + +typedef struct _SimpleClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; +} SimpleClassRec; + +extern SimpleClassRec simpleClassRec; + +typedef struct { + /* resources */ + Cursor cursor; + Pixmap insensitive_border; + String cursor_name; /* cursor specified by name. */ + + Pixel pointer_fg, pointer_bg; /* Pointer colors. */ + Boolean international; + /* private state */ +} SimplePart; + +typedef struct _SimpleRec { + CorePart core; + SimplePart simple; +} SimpleRec; + +#endif /* _SimpleP_h */ diff --git a/vendor/x11iraf/xaw3d/Sme.c b/vendor/x11iraf/xaw3d/Sme.c new file mode 100644 index 00000000..741dbef8 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Sme.c @@ -0,0 +1,244 @@ +/* $XConsortium: Sme.c,v 1.12 94/04/17 20:12:48 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * Sme.c - Source code for the generic menu entry + * + * Date: September 26, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/SmeP.h> +#include <X11/Xaw3d/Cardinals.h> + +#define offset(field) XtOffsetOf(SmeRec, sme.field) +static XtResource resources[] = { + {XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(callbacks), XtRCallback, (XtPointer)NULL}, + {XtNinternational, XtCInternational, XtRBoolean, sizeof(Boolean), + offset(international), XtRImmediate, (XtPointer) FALSE}, +}; +#undef offset + +/* + * Semi Public function definitions. + */ + +static void Unhighlight(), Highlight(), Notify(), ClassPartInitialize(); +static void Initialize(); +static XtGeometryResult QueryGeometry(); + +#define SUPERCLASS (&rectObjClassRec) + +SmeClassRec smeClassRec = { + { + /* superclass */ (WidgetClass) SUPERCLASS, + /* class_name */ "Sme", + /* size */ sizeof(SmeRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize*/ ClassPartInitialize, + /* Class init'ed */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ NULL, + /* actions */ NULL, + /* num_actions */ ZERO, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ FALSE, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ NULL, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* Simple Menu Entry Fields */ + + /* highlight */ Highlight, + /* unhighlight */ Unhighlight, + /* notify */ Notify, + /* extension */ NULL + } +}; + +WidgetClass smeObjectClass = (WidgetClass) &smeClassRec; + +/************************************************************ + * + * Semi-Public Functions. + * + ************************************************************/ + +/* Function Name: ClassPartInitialize + * Description: handles inheritance of class functions. + * Arguments: class - the widget classs of this widget. + * Returns: none. + */ + +static void +ClassPartInitialize(class) +WidgetClass class; +{ + SmeObjectClass m_ent, superC; + + m_ent = (SmeObjectClass) class; + superC = (SmeObjectClass) m_ent->rect_class.superclass; + +/* + * We don't need to check for null super since we'll get to TextSink + * eventually. + */ + + if (m_ent->sme_class.highlight == XtInheritHighlight) + m_ent->sme_class.highlight = superC->sme_class.highlight; + + if (m_ent->sme_class.unhighlight == XtInheritUnhighlight) + m_ent->sme_class.unhighlight = superC->sme_class.unhighlight; + + if (m_ent->sme_class.notify == XtInheritNotify) + m_ent->sme_class.notify = superC->sme_class.notify; +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + * + * MENU ENTRIES CANNOT HAVE BORDERS. + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + SmeObject entry = (SmeObject) new; + + entry->rectangle.border_width = 0; +} + +/* Function Name: Highlight + * Description: The default highlight proceedure for menu entries. + * Arguments: w - the menu entry. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Highlight(w) +Widget w; +{ +/* This space intentionally left blank. */ +} + +/* Function Name: Unhighlight + * Description: The default unhighlight proceedure for menu entries. + * Arguments: w - the menu entry. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Unhighlight(w) +Widget w; +{ +/* This space intentionally left blank. */ +} + +/* Function Name: Notify + * Description: calls the callback proceedures for this entry. + * Arguments: w - the menu entry. + * Returns: none. + */ + +static void +Notify(w) +Widget w; +{ + XtCallCallbacks(w, XtNcallback, (XtPointer)NULL); +} + +/* Function Name: QueryGeometry. + * Description: Returns the preferred geometry for this widget. + * Arguments: w - the menu entry object. + * itended, return - the intended and return geometry info. + * Returns: A Geometry Result. + * + * See the Intrinsics manual for details on what this function is for. + * + * I just return the height and a width of 1. + */ + +static XtGeometryResult +QueryGeometry(w, intended, return_val) +Widget w; +XtWidgetGeometry *intended, *return_val; +{ + SmeObject entry = (SmeObject) w; + Dimension width; + XtGeometryResult ret_val = XtGeometryYes; + XtGeometryMask mode = intended->request_mode; + + width = 1; /* we can be really small. */ + + if ( ((mode & CWWidth) && (intended->width != width)) || + !(mode & CWWidth) ) { + return_val->request_mode |= CWWidth; + return_val->width = width; + mode = return_val->request_mode; + + if ( (mode & CWWidth) && (width == entry->rectangle.width) ) + return(XtGeometryNo); + return(XtGeometryAlmost); + } + return(ret_val); +} diff --git a/vendor/x11iraf/xaw3d/Sme.h b/vendor/x11iraf/xaw3d/Sme.h new file mode 100644 index 00000000..4b0dadc6 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Sme.h @@ -0,0 +1,80 @@ +/* + * $XConsortium: Sme.h,v 1.6 94/04/17 20:12:48 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * Sme.h - Public Header file for Sme object. + * + * This is the public header file for the Athena Sme object. + * It is intended to be used with the simple menu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _Sme_h +#define _Sme_h + +#include <X11/RectObj.h> + +/**************************************************************** + * + * Sme Object + * + ****************************************************************/ + +/* Simple Menu Entry Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Pointer NULL + destroyCallback Callback Pointer NULL + height Height Dimension 0 + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0n + y Position Position 0 + +*/ + +#ifndef XtCInternational +#define XtCInternational "International" +#endif + +#ifndef XtNinternational +#define XtNinternational "international" +#endif + + +typedef struct _SmeClassRec* SmeObjectClass; +typedef struct _SmeRec* SmeObject; + +extern WidgetClass smeObjectClass; + +#endif /* _Sme_h */ diff --git a/vendor/x11iraf/xaw3d/SmeBSB.c b/vendor/x11iraf/xaw3d/SmeBSB.c new file mode 100644 index 00000000..bf7a27e1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeBSB.c @@ -0,0 +1,728 @@ +/* $XConsortium: SmeBSB.c,v 1.19 94/04/17 20:12:49 kaleb Exp $ */ + +/* +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * SmeBSB.c - Source code file for BSB Menu Entry object. + * + * Date: September 26, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xos.h> + +/* needed for abs() */ +#ifdef X_NOT_STDC_ENV +extern int abs(); +#else +#include <stdlib.h> +#endif + +#include <X11/Xmu/Drawing.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/SimpleMenu.h> +#include <X11/Xaw3d/SmeBSBP.h> +#include <X11/Xaw3d/Cardinals.h> + +#include <stdio.h> + +#define ONE_HUNDRED 100 + +#define offset(field) XtOffsetOf(SmeBSBRec, sme_bsb.field) + +static XtResource resources[] = { + {XtNlabel, XtCLabel, XtRString, sizeof(String), + offset(label), XtRString, NULL}, + {XtNvertSpace, XtCVertSpace, XtRInt, sizeof(int), + offset(vert_space), XtRImmediate, (XtPointer) 25}, + {XtNleftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap), + offset(left_bitmap), XtRImmediate, (XtPointer)None}, + {XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify), + offset(justify), XtRImmediate, (XtPointer) XtJustifyLeft}, + {XtNrightBitmap, XtCRightBitmap, XtRBitmap, sizeof(Pixmap), + offset(right_bitmap), XtRImmediate, (XtPointer)None}, + {XtNleftMargin, XtCHorizontalMargins, XtRDimension, sizeof(Dimension), + offset(left_margin), XtRImmediate, (XtPointer) 4}, + {XtNrightMargin, XtCHorizontalMargins, XtRDimension, sizeof(Dimension), + offset(right_margin), XtRImmediate, (XtPointer) 4}, + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRString, XtDefaultForeground}, + {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *), + offset(font), XtRString, XtDefaultFont}, + {XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet ), + offset(fontset),XtRString, XtDefaultFontSet}, +}; +#undef offset + +/* + * Semi Public function definitions. + */ + +static void Redisplay(), Destroy(), Initialize(), FlipColors(); +static void ClassInitialize(); +static Boolean SetValues(); +static XtGeometryResult QueryGeometry(); + +/* + * Private Function Definitions. + */ + +static void GetDefaultSize(), DrawBitmaps(), GetBitmapInfo(); +static void CreateGCs(), DestroyGCs(); + +#define superclass (&smeThreeDClassRec) +SmeBSBClassRec smeBSBClassRec = { + { + /* superclass */ (WidgetClass) superclass, + /* class_name */ "SmeBSB", + /* size */ sizeof(SmeBSBRec), + /* class_initializer */ ClassInitialize, + /* class_part_initialize*/ NULL, + /* Class init'ed */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ NULL, + /* actions */ NULL, + /* num_actions */ ZERO, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ FALSE, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ NULL, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* SimpleMenuClass Fields */ + /* highlight */ FlipColors, + /* unhighlight */ FlipColors, + /* notify */ XtInheritNotify, + /* extension */ NULL + }, { + /* ThreeDClass Fields */ + /* shadowdraw */ XtInheritXawSme3dShadowDraw + }, { + /* BSBClass Fields */ + /* extension */ NULL + } +}; + +WidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec; + +/************************************************************ + * + * Semi-Public Functions. + * + ************************************************************/ + +/* Function Name: ClassInitialize + * Description: Initializes the SmeBSBObject. + * Arguments: none. + * Returns: none. + */ + +static void +ClassInitialize() +{ + XawInitializeWidgetSet(); + XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, + (XtConvertArgList)NULL, (Cardinal)0 ); +} + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + SmeBSBObject entry = (SmeBSBObject) new; + + if (entry->sme_bsb.label == NULL) + entry->sme_bsb.label = XtName(new); + else + entry->sme_bsb.label = XtNewString( entry->sme_bsb.label ); + + GetDefaultSize(new, &(entry->rectangle.width), &(entry->rectangle.height)); + CreateGCs(new); + + entry->sme_bsb.left_bitmap_width = entry->sme_bsb.left_bitmap_height = 0; + entry->sme_bsb.right_bitmap_width = entry->sme_bsb.right_bitmap_height = 0; + + GetBitmapInfo(new, TRUE); /* Left Bitmap Info */ + GetBitmapInfo(new, FALSE); /* Right Bitmap Info */ +} + +/* Function Name: Destroy + * Description: Called at destroy time, cleans up. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +Destroy(w) +Widget w; +{ + SmeBSBObject entry = (SmeBSBObject) w; + + DestroyGCs(w); + if (entry->sme_bsb.label != XtName(w)) + XtFree(entry->sme_bsb.label); +} + +/* Function Name: Redisplay + * Description: Redisplays the contents of the widget. + * Arguments: w - the simple menu widget. + * event - the X event that caused this redisplay. + * region - the region the needs to be repainted. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Redisplay(w, event, region) +Widget w; +XEvent * event; +Region region; +{ + GC gc; + SmeBSBObject entry = (SmeBSBObject) w; + Dimension s = entry->sme_threeD.shadow_width; + int font_ascent = 0, font_descent = 0, y_loc; + + int fontset_ascent = 0, fontset_descent = 0; + XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset); + + entry->sme_bsb.set_values_area_cleared = FALSE; + if ( entry->sme.international == True ) { + fontset_ascent = abs(ext->max_ink_extent.y); + fontset_descent = ext->max_ink_extent.height - fontset_ascent; + } + else { /*else, compute size from font like R5*/ + font_ascent = entry->sme_bsb.font->max_bounds.ascent; + font_descent = entry->sme_bsb.font->max_bounds.descent; + } + y_loc = entry->rectangle.y; + + + if (XtIsSensitive(w) && XtIsSensitive( XtParent(w) ) ) { + if ( w == XawSimpleMenuGetActiveEntry(XtParent(w)) ) { + XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), + entry->sme_bsb.norm_gc, s, y_loc + s, + (unsigned int) entry->rectangle.width - 2 * s, + (unsigned int) entry->rectangle.height - 2 * s); + gc = entry->sme_bsb.rev_gc; + } + else + gc = entry->sme_bsb.norm_gc; + } + else + gc = entry->sme_bsb.norm_gray_gc; + + if (entry->sme_bsb.label != NULL) { + int x_loc = entry->sme_bsb.left_margin; + int len = strlen(entry->sme_bsb.label); + char * label = entry->sme_bsb.label; + + switch(entry->sme_bsb.justify) { + int width, t_width; + + case XtJustifyCenter: + if ( entry->sme.international == True ) { + t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len); + width = entry->rectangle.width - (entry->sme_bsb.left_margin + + entry->sme_bsb.right_margin); + } + else { + t_width = XTextWidth(entry->sme_bsb.font, label, len); + width = entry->rectangle.width - (entry->sme_bsb.left_margin + + entry->sme_bsb.right_margin); + } + x_loc += (width - t_width)/2; + break; + case XtJustifyRight: + if ( entry->sme.international == True ) { + t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,len); + x_loc = entry->rectangle.width - ( entry->sme_bsb.right_margin + + t_width ); + } + else { + t_width = XTextWidth(entry->sme_bsb.font, label, len); + x_loc = entry->rectangle.width - ( entry->sme_bsb.right_margin + + t_width ); + } + break; + case XtJustifyLeft: + default: + break; + } + + + /* this will center the text in the gadget top-to-bottom */ + + if ( entry->sme.international==True ) { + y_loc += ((int)entry->rectangle.height - + (fontset_ascent + fontset_descent)) / 2 + fontset_ascent; + + XmbDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), + entry->sme_bsb.fontset, gc, x_loc + s, y_loc, label, len); + } + else { + y_loc += ((int)entry->rectangle.height - + (font_ascent + font_descent)) / 2 + font_ascent; + + XDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), gc, + x_loc + s, y_loc, label, len); + } + } + + DrawBitmaps(w, gc); +} + + +/* Function Name: SetValues + * Description: Relayout the menu when one of the resources is changed. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: none + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + SmeBSBObject entry = (SmeBSBObject) new; + SmeBSBObject old_entry = (SmeBSBObject) current; + Boolean ret_val = FALSE; + + if (old_entry->sme_bsb.label != entry->sme_bsb.label) { + if (old_entry->sme_bsb.label != XtName( new ) ) + XtFree( (char *) old_entry->sme_bsb.label ); + + if (entry->sme_bsb.label != XtName(new) ) + entry->sme_bsb.label = XtNewString( entry->sme_bsb.label ); + + ret_val = True; + } + + if (entry->rectangle.sensitive != old_entry->rectangle.sensitive ) + ret_val = TRUE; + + if (entry->sme_bsb.left_bitmap != old_entry->sme_bsb.left_bitmap) { + GetBitmapInfo(new, TRUE); + ret_val = TRUE; + } + + if (entry->sme_bsb.right_bitmap != old_entry->sme_bsb.right_bitmap) { + GetBitmapInfo(new, FALSE); + ret_val = TRUE; + } + + if ( ( (old_entry->sme_bsb.font != entry->sme_bsb.font) && + (old_entry->sme.international == False ) ) || + (old_entry->sme_bsb.foreground != entry->sme_bsb.foreground) ) { + DestroyGCs(current); + CreateGCs(new); + ret_val = TRUE; + } + + if ( ( old_entry->sme_bsb.fontset != entry->sme_bsb.fontset) && + (old_entry->sme.international == True ) ) + /* DONT changes the GCs, because the fontset is not in them. */ + ret_val = TRUE; + + if (ret_val) { + GetDefaultSize(new, + &(entry->rectangle.width), &(entry->rectangle.height)); + entry->sme_bsb.set_values_area_cleared = TRUE; + } + return(ret_val); +} + +/* Function Name: QueryGeometry. + * Description: Returns the preferred geometry for this widget. + * Arguments: w - the menu entry object. + * itended, return_val - the intended and return geometry info. + * Returns: A Geometry Result. + * + * See the Intrinsics manual for details on what this function is for. + * + * I just return the height and width of the label plus the margins. + */ + +static XtGeometryResult +QueryGeometry(w, intended, return_val) +Widget w; +XtWidgetGeometry *intended, *return_val; +{ + SmeBSBObject entry = (SmeBSBObject) w; + Dimension width, height; + XtGeometryResult ret_val = XtGeometryYes; + XtGeometryMask mode = intended->request_mode; + + GetDefaultSize(w, &width, &height ); + + if ( ((mode & CWWidth) && (intended->width != width)) || + !(mode & CWWidth) ) { + return_val->request_mode |= CWWidth; + return_val->width = width; + ret_val = XtGeometryAlmost; + } + + if ( ((mode & CWHeight) && (intended->height != height)) || + !(mode & CWHeight) ) { + return_val->request_mode |= CWHeight; + return_val->height = height; + ret_val = XtGeometryAlmost; + } + + if (ret_val == XtGeometryAlmost) { + mode = return_val->request_mode; + + if ( ((mode & CWWidth) && (width == entry->rectangle.width)) && + ((mode & CWHeight) && (height == entry->rectangle.height)) ) + return(XtGeometryNo); + } + + return(ret_val); +} + +/* Function Name: FlipColors + * Description: Invert the colors of the current entry. + * Arguments: w - the bsb menu entry widget. + * Returns: none. + */ + +static void +FlipColors(w) +Widget w; +{ + SmeBSBObject entry = (SmeBSBObject) w; + SmeBSBObjectClass oclass = (SmeBSBObjectClass) XtClass (w); + + if (entry->sme_bsb.set_values_area_cleared) { + entry->sme_threeD.shadowed = False; + return; + } + + if (entry->sme_threeD.shadow_width > 0) { + entry->sme_threeD.shadowed ^= True; + (*oclass->sme_threeD_class.shadowdraw) (w); + } else + XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), + entry->sme_bsb.invert_gc, + 0, (int) entry->rectangle.y, + (unsigned int) entry->rectangle.width, + (unsigned int) entry->rectangle.height); +} + +/************************************************************ + * + * Private Functions. + * + ************************************************************/ + +/* Function Name: GetDefaultSize + * Description: Calculates the Default (preferred) size of + * this menu entry. + * Arguments: w - the menu entry widget. + * width, height - default sizes (RETURNED). + * Returns: none. + */ + +static void +GetDefaultSize(w, width, height) +Widget w; +Dimension * width, * height; +{ + SmeBSBObject entry = (SmeBSBObject) w; + + if ( entry->sme.international == True ) { + XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset); + if (entry->sme_bsb.label == NULL) + *width = 0; + else + *width = XmbTextEscapement(entry->sme_bsb.fontset, entry->sme_bsb.label, + strlen(entry->sme_bsb.label)); + *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin; + *width += (2 * entry->sme_threeD.shadow_width); + *height = ext->max_ink_extent.height; + *height = ((int)*height * ( ONE_HUNDRED + + entry->sme_bsb.vert_space )) / ONE_HUNDRED; + *height += (2 * entry->sme_threeD.shadow_width); + } + else { + if (entry->sme_bsb.label == NULL) + *width = 0; + else + *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label, + strlen(entry->sme_bsb.label)); + + *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin; + *width += (2 * entry->sme_threeD.shadow_width); + + *height = (entry->sme_bsb.font->max_bounds.ascent + + entry->sme_bsb.font->max_bounds.descent); + + *height = ((int)*height * ( ONE_HUNDRED + + entry->sme_bsb.vert_space )) / ONE_HUNDRED; + *height += (2 * entry->sme_threeD.shadow_width); + } +} + +/* Function Name: DrawBitmaps + * Description: Draws left and right bitmaps. + * Arguments: w - the simple menu widget. + * gc - graphics context to use for drawing. + * Returns: none + */ + +static void +DrawBitmaps(w, gc) +Widget w; +GC gc; +{ + int x_loc, y_loc; + SmeBSBObject entry = (SmeBSBObject) w; + + if ( (entry->sme_bsb.left_bitmap == None) && + (entry->sme_bsb.right_bitmap == None) ) return; + +/* + * Draw Left Bitmap. + */ + + if (entry->sme_bsb.left_bitmap != None) { + x_loc = entry->sme_threeD.shadow_width + + (int)(entry->sme_bsb.left_margin - + entry->sme_bsb.left_bitmap_width) / 2; + + y_loc = entry->rectangle.y + + (int)(entry->rectangle.height - + entry->sme_bsb.left_bitmap_height) / 2; + + XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.left_bitmap, + XtWindowOfObject(w), gc, 0, 0, + entry->sme_bsb.left_bitmap_width, + entry->sme_bsb.left_bitmap_height, x_loc, y_loc, 1); + } + +/* + * Draw Right Bitmap. + */ + + + if (entry->sme_bsb.right_bitmap != None) { + x_loc = entry->rectangle.width - entry->sme_threeD.shadow_width - + (int)(entry->sme_bsb.right_margin + + entry->sme_bsb.right_bitmap_width) / 2; + + y_loc = entry->rectangle.y + + (int)(entry->rectangle.height - + entry->sme_bsb.right_bitmap_height) / 2; + + XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.right_bitmap, + XtWindowOfObject(w), gc, 0, 0, + entry->sme_bsb.right_bitmap_width, + entry->sme_bsb.right_bitmap_height, x_loc, y_loc, 1); + } +} + +/* Function Name: GetBitmapInfo + * Description: Gets the bitmap information from either of the bitmaps. + * Arguments: w - the bsb menu entry widget. + * is_left - TRUE if we are testing left bitmap, + * FALSE if we are testing the right bitmap. + * Returns: none + */ + +static void +GetBitmapInfo(w, is_left) +Widget w; +Boolean is_left; +{ + SmeBSBObject entry = (SmeBSBObject) w; + unsigned int depth, bw; + Window root; + int x, y; + unsigned int width, height; + char buf[BUFSIZ]; + + if (is_left) { + if (entry->sme_bsb.left_bitmap != None) { + if (!XGetGeometry(XtDisplayOfObject(w), + entry->sme_bsb.left_bitmap, &root, + &x, &y, &width, &height, &bw, &depth)) { + (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", "Could not", + "get Left Bitmap geometry information for menu entry ", + XtName(w)); + XtAppError(XtWidgetToApplicationContext(w), buf); + } + if (depth != 1) { + (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\"%s.", + "Left Bitmap of entry ", + XtName(w), " is not one bit deep."); + XtAppError(XtWidgetToApplicationContext(w), buf); + } + entry->sme_bsb.left_bitmap_width = (Dimension) width; + entry->sme_bsb.left_bitmap_height = (Dimension) height; + } + } + else if (entry->sme_bsb.right_bitmap != None) { + if (!XGetGeometry(XtDisplayOfObject(w), + entry->sme_bsb.right_bitmap, &root, + &x, &y, &width, &height, &bw, &depth)) { + (void) sprintf(buf, "Xaw SmeBSB Object: %s %s \"%s\".", "Could not", + "get Right Bitmap geometry information for menu entry ", + XtName(w)); + XtAppError(XtWidgetToApplicationContext(w), buf); + } + if (depth != 1) { + (void) sprintf(buf, "Xaw SmeBSB Object: %s \"%s\"%s.", + "Right Bitmap of entry ", XtName(w), + " is not one bit deep."); + XtAppError(XtWidgetToApplicationContext(w), buf); + } + entry->sme_bsb.right_bitmap_width = (Dimension) width; + entry->sme_bsb.right_bitmap_height = (Dimension) height; + } +} + +/* Function Name: CreateGCs + * Description: Creates all gc's for the simple menu widget. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +CreateGCs(w) +Widget w; +{ + SmeBSBObject entry = (SmeBSBObject) w; + XGCValues values; + XtGCMask mask, mask_i18n; + + values.foreground = XtParent(w)->core.background_pixel; + values.background = entry->sme_bsb.foreground; + values.font = entry->sme_bsb.font->fid; + values.graphics_exposures = FALSE; + mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont; + mask_i18n = GCForeground | GCBackground | GCGraphicsExposures; + if ( entry->sme.international == True ) + entry->sme_bsb.rev_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0 ); + else + entry->sme_bsb.rev_gc = XtGetGC(w, mask, &values); + + values.foreground = entry->sme_bsb.foreground; + values.background = XtParent(w)->core.background_pixel; + if ( entry->sme.international == True ) + entry->sme_bsb.norm_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0 ); + else + entry->sme_bsb.norm_gc = XtGetGC(w, mask, &values); + + values.fill_style = FillTiled; + values.tile = XmuCreateStippledPixmap(XtScreenOfObject(w), + entry->sme_bsb.foreground, + XtParent(w)->core.background_pixel, + XtParent(w)->core.depth); + values.graphics_exposures = FALSE; + mask |= GCTile | GCFillStyle; + if ( entry->sme.international == True ) + entry->sme_bsb.norm_gray_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0 ); + else + entry->sme_bsb.norm_gray_gc = XtGetGC(w, mask, &values); + + values.foreground ^= values.background; + values.background = 0; + values.function = GXxor; + mask = GCForeground | GCBackground | GCGraphicsExposures | GCFunction; + entry->sme_bsb.invert_gc = XtGetGC(w, mask, &values); +} + +/* Function Name: DestroyGCs + * Description: Removes all gc's for the simple menu widget. + * Arguments: w - the simple menu widget. + * Returns: none. + */ + +static void +DestroyGCs(w) +Widget w; +{ + SmeBSBObject entry = (SmeBSBObject) w; + + XtReleaseGC(w, entry->sme_bsb.norm_gc); + XtReleaseGC(w, entry->sme_bsb.norm_gray_gc); + XtReleaseGC(w, entry->sme_bsb.rev_gc); + XtReleaseGC(w, entry->sme_bsb.invert_gc); +} + +#ifdef apollo + +/* + * The apollo compiler that we have optomizes out my code for + * FlipColors() since it is static. and no one executes it in this + * file. I am setting the function pointer into the class structure so + * that it can be called by my parent who will tell me to when to + * highlight and unhighlight. + */ + +void _XawSmeBSBApolloHack () +{ + FlipColors(); +} +#endif /* apollo */ diff --git a/vendor/x11iraf/xaw3d/SmeBSB.h b/vendor/x11iraf/xaw3d/SmeBSB.h new file mode 100644 index 00000000..f1844b3b --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeBSB.h @@ -0,0 +1,101 @@ +/* + * $XConsortium: SmeBSB.h,v 1.7 94/04/17 20:12:49 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * SmeBSB.h - Public Header file for SmeBSB object. + * + * This is the public header file for the Athena BSB Sme object. + * It is intended to be used with the simple menu widget. This object + * provides bitmap - string - bitmap style entries. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SmeBSB_h +#define _SmeBSB_h + +#include <X11/Xmu/Converters.h> + +#include <X11/Xaw3d/Sme.h> + +/**************************************************************** + * + * SmeBSB object + * + ****************************************************************/ + +/* BSB Menu Entry Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Callback NULL + destroyCallback Callback Pointer NULL + font Font XFontStruct * XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 0 + label Label String Name of entry + leftBitmap LeftBitmap Pixmap None + leftMargin HorizontalMargins Dimension 4 + rightBitmap RightBitmap Pixmap None + rightMargin HorizontalMargins Dimension 4 + sensitive Sensitive Boolean True + vertSpace VertSpace int 25 + width Width Dimension 0 + x Position Position 0n + y Position Position 0 + +*/ + +typedef struct _SmeBSBClassRec *SmeBSBObjectClass; +typedef struct _SmeBSBRec *SmeBSBObject; + +extern WidgetClass smeBSBObjectClass; + +#define XtNleftBitmap "leftBitmap" +#define XtNleftMargin "leftMargin" +#define XtNrightBitmap "rightBitmap" +#define XtNrightMargin "rightMargin" +#define XtNvertSpace "vertSpace" + +#ifndef XtNfontSet +#define XtNfontSet "fontSet" +#endif + +#ifndef XtCFontSet +#define XtCFontSet "FontSet" +#endif + +#define XtCLeftBitmap "LeftBitmap" +#define XtCHorizontalMargins "HorizontalMargins" +#define XtCRightBitmap "RightBitmap" +#define XtCVertSpace "VertSpace" + +#endif /* _SmeBSB_h */ diff --git a/vendor/x11iraf/xaw3d/SmeBSBP.h b/vendor/x11iraf/xaw3d/SmeBSBP.h new file mode 100644 index 00000000..fe697f3f --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeBSBP.h @@ -0,0 +1,115 @@ +/* + * $XConsortium: SmeBSBP.h,v 1.8 94/04/17 21:44:11 rws Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SmeP.h - Private definitions for Sme object + * + */ + +#ifndef _XawSmeBSBP_h +#define _XawSmeBSBP_h + +/*********************************************************************** + * + * Sme Object Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/SmeThreeDP.h> +#include <X11/Xaw3d/SmeBSB.h> + +/************************************************************ + * + * New fields for the Sme Object class record. + * + ************************************************************/ + +typedef struct _SmeBSBClassPart { + XtPointer extension; +} SmeBSBClassPart; + +/* Full class record declaration */ +typedef struct _SmeBSBClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; + SmeThreeDClassPart sme_threeD_class; + SmeBSBClassPart sme_bsb_class; +} SmeBSBClassRec; + +extern SmeBSBClassRec smeBSBClassRec; + +/* New fields for the Sme Object record */ +typedef struct { + /* resources */ + String label; /* The entry label. */ + int vert_space; /* extra vert space to leave, as a percentage + of the font height of the label. */ + Pixmap left_bitmap, right_bitmap; /* bitmaps to show. */ + Dimension left_margin, right_margin; /* left and right margins. */ + Pixel foreground; /* foreground color. */ + XFontStruct * font; /* The font to show label in. */ + XFontSet fontset; /* or fontset */ + XtJustify justify; /* Justification for the label. */ + +/* private resources. */ + + Boolean set_values_area_cleared; /* Remember if we need to unhighlight. */ + GC norm_gc; /* noral color gc. */ + GC rev_gc; /* reverse color gc. */ + GC norm_gray_gc; /* Normal color (grayed out) gc. */ + GC invert_gc; /* gc for flipping colors. */ + + Dimension left_bitmap_width; /* size of each bitmap. */ + Dimension left_bitmap_height; + Dimension right_bitmap_width; + Dimension right_bitmap_height; + +} SmeBSBPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SmeBSBRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; + SmeThreeDPart sme_threeD; + SmeBSBPart sme_bsb; +} SmeBSBRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#endif /* _XawSmeBSBP_h */ diff --git a/vendor/x11iraf/xaw3d/SmeLine.c b/vendor/x11iraf/xaw3d/SmeLine.c new file mode 100644 index 00000000..97a2e2e7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeLine.c @@ -0,0 +1,293 @@ +/* -XT +* $XConsortium: SmeLine.c,v 1.15 94/04/17 20:12:51 eswu Exp $ +* J. P. Terlouw, Kapteyn Astronomical Institute, Groningen The Netherlands, +* February 2001: modified for use with non-default visuals. +*/ + +/* +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * Sme.c - Source code for the generic menu entry + * + * Date: September 26, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/SmeLineP.h> +#include <X11/Xaw3d/Cardinals.h> + +#define offset(field) XtOffsetOf(SmeLineRec, sme_line.field) +static XtResource resources[] = { + {XtNlineWidth, XtCLineWidth, XtRDimension, sizeof(Dimension), + offset(line_width), XtRImmediate, (XtPointer) 1}, + {XtNstipple, XtCStipple, XtRBitmap, sizeof(Pixmap), + offset(stipple), XtRImmediate, (XtPointer) XtUnspecifiedPixmap}, + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRString, XtDefaultForeground}, +}; +#undef offset + +/* + * Function definitions. + */ + +static void Redisplay(), Initialize(); +static void DestroyGC(), CreateGC(); +static Boolean SetValues(); +static XtGeometryResult QueryGeometry(); + + +#define SUPERCLASS (&smeClassRec) + +SmeLineClassRec smeLineClassRec = { + { + /* superclass */ (WidgetClass) SUPERCLASS, + /* class_name */ "SmeLine", + /* size */ sizeof(SmeLineRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize*/ NULL, + /* Class init'ed */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ NULL, + /* actions */ NULL, + /* num_actions */ ZERO, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ FALSE, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ DestroyGC, + /* resize */ NULL, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ NULL, + /* query_geometry */ QueryGeometry, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* Menu Entry Fields */ + + /* highlight */ XtInheritHighlight, + /* unhighlight */ XtInheritUnhighlight, + /* notify */ XtInheritNotify, + /* extension */ NULL + },{ + /* Line Menu Entry Fields */ + /* extension */ NULL + } +}; + +WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec; + +/************************************************************ + * + * Semi-Public Functions. + * + ************************************************************/ + +/* Function Name: Initialize + * Description: Initializes the simple menu widget + * Arguments: request - the widget requested by the argument list. + * new - the new widget with both resource and non + * resource values. + * Returns: none. + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + SmeLineObject entry = (SmeLineObject) new; + + if (entry->rectangle.height == 0) + entry->rectangle.height = entry->sme_line.line_width; + + CreateGC(new); +} + +/* Function Name: CreateGC + * Description: Creates the GC for the line entry widget. + * Arguments: w - the Line entry widget. + * Returns: none + * + * We can only share the GC if there is no stipple, because + * we need to change the stipple origin when drawing. + */ + +static void +CreateGC(w) +Widget w; +{ + SmeLineObject entry = (SmeLineObject) w; + XGCValues values; + XtGCMask mask = GCForeground | GCGraphicsExposures | GCLineWidth ; + + values.foreground = entry->sme_line.foreground; + values.graphics_exposures = FALSE; + values.line_width = entry->sme_line.line_width; + + if (entry->sme_line.stipple != XtUnspecifiedPixmap) { + values.stipple = entry->sme_line.stipple; + values.fill_style = FillStippled; + mask |= GCStipple | GCFillStyle; + + entry->sme_line.gc = XCreateGC(XtDisplayOfObject(w), + XtWindowOfObject(w), + mask, &values); + } + else + entry->sme_line.gc = XtGetGC(w, mask, &values); +} + +/* Function Name: DestroyGC + * Description: Destroys the GC when we are done with it. + * Arguments: w - the Line entry widget. + * Returns: none + */ + +static void +DestroyGC(w) +Widget w; +{ + SmeLineObject entry = (SmeLineObject) w; + + if (entry->sme_line.stipple != XtUnspecifiedPixmap) + XFreeGC(XtDisplayOfObject(w), entry->sme_line.gc); + else + XtReleaseGC(w, entry->sme_line.gc); +} + +/* Function Name: Redisplay + * Description: Paints the Line + * Arguments: w - the menu entry. + * event, region - NOT USED. + * Returns: none + */ + +/*ARGSUSED*/ +static void +Redisplay(w, event, region) +Widget w; +XEvent * event; +Region region; +{ + SmeLineObject entry = (SmeLineObject) w; + int y = entry->rectangle.y + + (int)(entry->rectangle.height - entry->sme_line.line_width) / 2; + + if (entry->sme_line.stipple != XtUnspecifiedPixmap) + XSetTSOrigin(XtDisplayOfObject(w), entry->sme_line.gc, 0, y); + + XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), + entry->sme_line.gc, + 0, y, (unsigned int) entry->rectangle.width, + (unsigned int) entry->sme_line.line_width ); +} + +/* Function Name: SetValues + * Description: Relayout the menu when one of the resources is changed. + * Arguments: current - current state of the widget. + * request - what was requested. + * new - what the widget will become. + * Returns: none + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + SmeLineObject entry = (SmeLineObject) new; + SmeLineObject old_entry = (SmeLineObject) current; + + if ( (entry->sme_line.line_width != old_entry->sme_line.line_width) && + (entry->sme_line.stipple != old_entry->sme_line.stipple) ) { + DestroyGC(current); + CreateGC(new); + return(TRUE); + } + return(FALSE); +} + +/* Function Name: QueryGeometry. + * Description: Returns the preferred geometry for this widget. + * Arguments: w - the menu entry object. + * itended, return - the intended and return geometry info. + * Returns: A Geometry Result. + * + * See the Intrinsics manual for details on what this function is for. + * + * I just return the height and a width of 1. + */ + +static XtGeometryResult +QueryGeometry(w, intended, return_val) +Widget w; +XtWidgetGeometry *intended, *return_val; +{ + SmeObject entry = (SmeObject) w; + Dimension width; + XtGeometryResult ret_val = XtGeometryYes; + XtGeometryMask mode = intended->request_mode; + + width = 1; /* we can be really small. */ + + if ( ((mode & CWWidth) && (intended->width != width)) || + !(mode & CWWidth) ) { + return_val->request_mode |= CWWidth; + return_val->width = width; + mode = return_val->request_mode; + + if ( (mode & CWWidth) && (width == entry->rectangle.width) ) + return(XtGeometryNo); + return(XtGeometryAlmost); + } + return(ret_val); +} diff --git a/vendor/x11iraf/xaw3d/SmeLine.h b/vendor/x11iraf/xaw3d/SmeLine.h new file mode 100644 index 00000000..42b969e8 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeLine.h @@ -0,0 +1,79 @@ +/* + * $XConsortium: SmeLine.h,v 1.4 94/04/17 20:12:53 kit Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + */ + +/* + * SmeLine.h - Public Header file for SmeLine object. + * + * This is the public header file for the Athena SmeLine object. + * It is intended to be used with the simple menu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _SmeLine_h +#define _SmeLine_h + +#include <X11/Xaw3d/Sme.h> +#include <X11/Xmu/Converters.h> + +/**************************************************************** + * + * SmeLine Object + * + ****************************************************************/ + +/* Menu Entry Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + callback Callback Pointer NULL + destroyCallback Callback Pointer NULL + height Height Dimension 0 + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0n + y Position Position 0 + +*/ + +#define XtCLineWidth "LineWidth" +#define XtCStipple "Stipple" + +#define XtNlineWidth "lineWidth" +#define XtNstipple "stipple" + +typedef struct _SmeLineClassRec* SmeLineObjectClass; +typedef struct _SmeLineRec* SmeLineObject; + +extern WidgetClass smeLineObjectClass; + +#endif /* _SmeLine_h */ diff --git a/vendor/x11iraf/xaw3d/SmeLineP.h b/vendor/x11iraf/xaw3d/SmeLineP.h new file mode 100644 index 00000000..c6b612d7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeLineP.h @@ -0,0 +1,97 @@ +/* + * $XConsortium: SmeLineP.h,v 1.4 94/04/17 20:12:54 kit Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * Author: Chris D. Peterson, MIT X Consortium + */ + +/* + * SmeLineP.h - Private definitions for SmeLine widget + * + */ + +#ifndef _XawSmeLineP_h +#define _XawSmeLineP_h + +/*********************************************************************** + * + * SmeLine Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/SmeP.h> +#include <X11/Xaw3d/SmeLine.h> + +/************************************************************ + * + * New fields for the SmeLine widget class record. + * + ************************************************************/ + +typedef struct _SmeLineClassPart { + XtPointer extension; +} SmeLineClassPart; + +/* Full class record declaration */ +typedef struct _SmeLineClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; + SmeLineClassPart sme_line_class; +} SmeLineClassRec; + +extern SmeLineClassRec smeLineClassRec; + +/* New fields for the SmeLine widget record */ +typedef struct { + /* resources */ + Pixel foreground; /* Foreground color. */ + Pixmap stipple; /* Line Stipple. */ + Dimension line_width; /* Width of the line. */ + + /* private data. */ + + GC gc; /* Graphics context for drawing line. */ +} SmeLinePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SmeLineRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; + SmeLinePart sme_line; +} SmeLineRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +#endif /* _XawSmeLineP_h */ diff --git a/vendor/x11iraf/xaw3d/SmeP.h b/vendor/x11iraf/xaw3d/SmeP.h new file mode 100644 index 00000000..0c7805aa --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeP.h @@ -0,0 +1,105 @@ +/* + * $XConsortium: SmeP.h,v 1.6 94/04/17 20:12:54 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * SmeP.h - Private Header file for Sme object. + * + * This is the private header file for the Athena Sme object. + * This object is intended to be used with the simple menu widget. + * + * Date: April 3, 1989 + * + * By: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + */ + +#ifndef _XawSmeP_h +#define _XawSmeP_h + +/*********************************************************************** + * + * Sme Widget Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/Sme.h> + +/************************************************************ + * + * New fields for the Sme widget class record. + * + ************************************************************/ + +typedef struct _SmeClassPart { + void (*highlight)(); + void (*unhighlight)(); + void (*notify)(); + XtPointer extension; +} SmeClassPart; + +/* Full class record declaration */ +typedef struct _SmeClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; +} SmeClassRec; + +extern SmeClassRec smeClassRec; + +/* New fields for the Sme widget record */ +typedef struct { + /* resources */ + XtCallbackList callbacks; /* The callback list */ + Boolean international; + +} SmePart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _SmeRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; +} SmeRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +typedef void (*_XawEntryVoidFunc)(); + +#define XtInheritHighlight ((_XawEntryVoidFunc) _XtInherit) +#define XtInheritUnhighlight XtInheritHighlight +#define XtInheritNotify XtInheritHighlight + +#endif /* _XawSmeP_h */ diff --git a/vendor/x11iraf/xaw3d/SmeThreeD.c b/vendor/x11iraf/xaw3d/SmeThreeD.c new file mode 100644 index 00000000..a1e3d2af --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeThreeD.c @@ -0,0 +1,612 @@ +/* -XT +* $KK: SmeThreeD.c,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +* J. P. Terlouw, Kapteyn Astronomical Institute, Groningen The Netherlands, +* February 2001: modified for use with non-default visuals. +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992, 1993 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/SmeThreeDP.h> +#include <X11/Xosdefs.h> + +/* Initialization of defaults */ + +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" +#define XtNshadowed "shadowed" +#define XtCShadowed "Shadowed" + +#define offset(field) XtOffsetOf(SmeThreeDRec, field) + +static XtResource resources[] = { + {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(sme_threeD.shadow_width), XtRImmediate, (XtPointer) 2}, + {XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(sme_threeD.top_shadow_pixel), XtRString, XtDefaultForeground}, + {XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(sme_threeD.bot_shadow_pixel), XtRString, XtDefaultForeground}, + {XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(sme_threeD.top_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, + {XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(sme_threeD.bot_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, + {XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int), + offset(sme_threeD.top_shadow_contrast), XtRImmediate, (XtPointer) 20}, + {XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int), + offset(sme_threeD.bot_shadow_contrast), XtRImmediate, (XtPointer) 40}, + {XtNuserData, XtCUserData, XtRPointer, sizeof(XtPointer), + offset(sme_threeD.user_data), XtRPointer, (XtPointer) NULL}, + {XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean), + offset(sme_threeD.be_nice_to_cmap), XtRImmediate, (XtPointer) True}, + {XtNshadowed, XtCShadowed, XtRBoolean, sizeof(Boolean), + offset(sme_threeD.shadowed), XtRImmediate, (XtPointer) False}, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, + (XtPointer)0} +}; + +#undef offset + +static void Initialize(), Destroy(); +static void ClassPartInitialize(), _XawSme3dDrawShadows(); +static Boolean SetValues(); + +SmeThreeDClassRec smeThreeDClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &smeClassRec, + /* class_name */ "SmeThreeD", + /* widget_size */ sizeof(SmeThreeDRec), + /* class_initialize */ NULL, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ NULL, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ XtInheritResize, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ NULL, + /* extension */ NULL + }, + { /* Menu Entry fields */ + /* highlight */ XtInheritHighlight, + /* unhighlight */ XtInheritUnhighlight, + /* notify */ XtInheritNotify, + /* extension */ NULL + }, + { /* threeD fields */ + /* shadow draw */ _XawSme3dDrawShadows + } +}; + +WidgetClass smeThreeDObjectClass = (WidgetClass) &smeThreeDClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + + +#define shadowpm_width 8 +#define shadowpm_height 8 +static char shadowpm_bits[] = { + 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55}; + +static char mtshadowpm_bits[] = { + 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24}; + +static char mbshadowpm_bits[] = { + 0x6d, 0xdb, 0xb6, 0x6d, 0xdb, 0xb6, 0x6d, 0xdb}; + +/* ARGSUSED */ +static unsigned long WittePixel (w) + Widget w; +{ + static XColor kleur; + if (!kleur.flags) { + kleur.flags = DoRed | DoGreen | DoBlue; + kleur.red = kleur.green = kleur.blue = 65535; + (void)XAllocColor(XtDisplay(w), w->core.colormap, &kleur); + } + return kleur.pixel; +} + +/* ARGSUSED */ +static unsigned long ZwartePixel (w) + Widget w; +{ + static XColor kleur; + if (!kleur.flags) { + kleur.flags = DoRed | DoGreen | DoBlue; + kleur.red = kleur.green = kleur.blue = 0; + (void)XAllocColor(XtDisplay(w), w->core.colormap, &kleur); + } + return kleur.pixel; +} + +/* ARGSUSED */ +static void AllocTopShadowGC (w) + Widget w; +{ + SmeThreeDObject tdo = (SmeThreeDObject) w; + Widget parent = XtParent(w); + Screen *scn = XtScreenOfObject (w); + XtGCMask valuemask; + XGCValues myXGCV; + + if (tdo->sme_threeD.be_nice_to_cmap || parent->core.depth == 1) { + valuemask = GCTile | GCFillStyle; + myXGCV.tile = tdo->sme_threeD.top_shadow_pxmap; + myXGCV.fill_style = FillTiled; + } else { + valuemask = GCForeground; + myXGCV.foreground = tdo->sme_threeD.top_shadow_pixel; + } + tdo->sme_threeD.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocBotShadowGC (w) + Widget w; +{ + SmeThreeDObject tdo = (SmeThreeDObject) w; + Widget parent = XtParent(w); + Screen *scn = XtScreenOfObject (w); + XtGCMask valuemask; + XGCValues myXGCV; + + if (tdo->sme_threeD.be_nice_to_cmap || parent->core.depth == 1) { + valuemask = GCTile | GCFillStyle; + myXGCV.tile = tdo->sme_threeD.bot_shadow_pxmap; + myXGCV.fill_style = FillTiled; + } else { + valuemask = GCForeground; + myXGCV.foreground = tdo->sme_threeD.bot_shadow_pixel; + } + tdo->sme_threeD.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocEraseGC (w) + Widget w; +{ + Widget parent = XtParent (w); + SmeThreeDObject tdo = (SmeThreeDObject) w; + XtGCMask valuemask; + XGCValues myXGCV; + + valuemask = GCForeground; + myXGCV.foreground = parent->core.background_pixel; + tdo->sme_threeD.erase_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocTopShadowPixmap (new) + Widget new; +{ + SmeThreeDObject tdo = (SmeThreeDObject) new; + Widget parent = XtParent (new); + Display *dpy = XtDisplayOfObject (new); + Screen *scn = XtScreenOfObject (new); + unsigned long top_fg_pixel = 0, top_bg_pixel = 0; + char *pm_data; + Boolean create_pixmap = FALSE; + + /* + * I know, we're going to create two pixmaps for each and every + * shadow'd widget. Yeuck. I'm semi-relying on server side + * pixmap cacheing. + */ + + if (parent->core.depth == 1) { + top_fg_pixel = ZwartePixel(parent); + top_bg_pixel = WittePixel(parent); + pm_data = mtshadowpm_bits; + create_pixmap = TRUE; + } else if (tdo->sme_threeD.be_nice_to_cmap) { + if (parent->core.background_pixel == WittePixel(parent)) { + top_fg_pixel = WittePixel(parent); + top_bg_pixel = ZwartePixel(parent); + } else if (parent->core.background_pixel == ZwartePixel(parent)) { + top_fg_pixel = ZwartePixel(parent); + top_bg_pixel = WittePixel(parent); + } else { + top_fg_pixel = parent->core.background_pixel; + top_bg_pixel = WittePixel(parent); + } + if (parent->core.background_pixel == WittePixel(parent) || + parent->core.background_pixel == ZwartePixel(parent)) + pm_data = mtshadowpm_bits; + else + pm_data = shadowpm_bits; + create_pixmap = TRUE; + } + if (create_pixmap) + tdo->sme_threeD.top_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + shadowpm_width, + shadowpm_height, + top_fg_pixel, + top_bg_pixel, + XtParent(new)->core.depth); +} + +/* ARGSUSED */ +static void AllocBotShadowPixmap (new) + Widget new; +{ + SmeThreeDObject tdo = (SmeThreeDObject) new; + Widget parent = XtParent (new); + Display *dpy = XtDisplayOfObject (new); + Screen *scn = XtScreenOfObject (new); + unsigned long bot_fg_pixel = 0, bot_bg_pixel = 0; + char *pm_data; + Boolean create_pixmap = FALSE; + + if (parent->core.depth == 1) { + bot_fg_pixel = ZwartePixel(parent); + bot_bg_pixel = WittePixel(parent); + pm_data = mbshadowpm_bits; + create_pixmap = TRUE; + } else if (tdo->sme_threeD.be_nice_to_cmap) { + if (parent->core.background_pixel == WittePixel(parent)) { + bot_fg_pixel = WittePixel(parent); + bot_bg_pixel = ZwartePixel(parent); + } else if (parent->core.background_pixel == ZwartePixel(parent)) { + bot_fg_pixel = ZwartePixel(parent); + bot_bg_pixel = WittePixel(parent); + } else { + bot_fg_pixel = parent->core.background_pixel; + bot_bg_pixel = ZwartePixel(parent); + } + if (parent->core.background_pixel == WittePixel(parent) || + parent->core.background_pixel == ZwartePixel(parent)) + pm_data = mbshadowpm_bits; + else + pm_data = shadowpm_bits; + create_pixmap = TRUE; + } + if (create_pixmap) + tdo->sme_threeD.bot_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + shadowpm_width, + shadowpm_height, + bot_fg_pixel, + bot_bg_pixel, + XtParent(new)->core.depth); +} + +/* ARGSUSED */ +void XawSme3dComputeTopShadowRGB (new, xcol_out) + Widget new; + XColor *xcol_out; +{ + if (XtIsSubclass (new, smeThreeDObjectClass)) { + SmeThreeDObject tdo = (SmeThreeDObject) new; + Widget w = XtParent (new); + XColor get_c; + double contrast; + Display *dpy = XtDisplayOfObject (new); + Screen *scn = XtScreenOfObject (new); + Colormap cmap = w->core.colormap; + + get_c.pixel = w->core.background_pixel; + if (get_c.pixel == WittePixel(w) || + get_c.pixel == ZwartePixel(w)) { + contrast = (100 - tdo->sme_threeD.top_shadow_contrast) / 100.0; + xcol_out->red = contrast * 65535.0; + xcol_out->green = contrast * 65535.0; + xcol_out->blue = contrast * 65535.0; + } else { + contrast = 1.0 + tdo->sme_threeD.top_shadow_contrast / 100.0; + XQueryColor (dpy, cmap, &get_c); +#define MIN(x,y) (unsigned short) (x < y) ? x : y + xcol_out->red = MIN (65535, (int) (contrast * (double) get_c.red)); + xcol_out->green = MIN (65535, (int) (contrast * (double) get_c.green)); + xcol_out->blue = MIN (65535, (int) (contrast * (double) get_c.blue)); +#undef MIN + } + } else + xcol_out->red = xcol_out->green = xcol_out->blue = 0; +} + +/* ARGSUSED */ +static void AllocTopShadowPixel (new) + Widget new; +{ + XColor set_c; + SmeThreeDObject tdo = (SmeThreeDObject) new; + Widget parent = XtParent(new); + Display *dpy = XtDisplayOfObject (new); + Screen *scn = XtScreenOfObject (new); + Colormap cmap = parent->core.colormap; + + XawSme3dComputeTopShadowRGB (new, &set_c); + (void) XAllocColor (dpy, cmap, &set_c); + tdo->sme_threeD.top_shadow_pixel = set_c.pixel; +} + + +/* ARGSUSED */ +void XawSme3dComputeBottomShadowRGB (new, xcol_out) + Widget new; + XColor *xcol_out; +{ + if (XtIsSubclass (new, smeThreeDObjectClass)) { + SmeThreeDObject tdo = (SmeThreeDObject) new; + Widget w = XtParent (new); + XColor get_c; + double contrast; + Display *dpy = XtDisplayOfObject (new); + Screen *scn = XtScreenOfObject (new); + Colormap cmap = w->core.colormap; + + get_c.pixel = w->core.background_pixel; + if (get_c.pixel == WittePixel(w) || + get_c.pixel == ZwartePixel(w)) { + contrast = tdo->sme_threeD.bot_shadow_contrast / 100.0; + xcol_out->red = contrast * 65535.0; + xcol_out->green = contrast * 65535.0; + xcol_out->blue = contrast * 65535.0; + } else { + XQueryColor (dpy, cmap, &get_c); + contrast = (100 - tdo->sme_threeD.bot_shadow_contrast) / 100.0; + xcol_out->red = contrast * get_c.red; + xcol_out->green = contrast * get_c.green; + xcol_out->blue = contrast * get_c.blue; + } + } else + xcol_out->red = xcol_out->green = xcol_out->blue = 0; +} + +/* ARGSUSED */ +static void AllocBotShadowPixel (new) + Widget new; +{ + XColor set_c; + SmeThreeDObject tdo = (SmeThreeDObject) new; + Widget parent = XtParent(new); + Display *dpy = XtDisplayOfObject (new); + Screen *scn = XtScreenOfObject (new); + Colormap cmap = parent->core.colormap; + + XawSme3dComputeBottomShadowRGB (new, &set_c); + (void) XAllocColor (dpy, cmap, &set_c); + tdo->sme_threeD.bot_shadow_pixel = set_c.pixel; +} + + +/* ARGSUSED */ +static void ClassPartInitialize (wc) + WidgetClass wc; +{ + SmeThreeDClassRec *tdwc = (SmeThreeDClassRec *) wc; + SmeThreeDClassRec *super = + (SmeThreeDClassRec *) tdwc->rect_class.superclass; + + if (tdwc->sme_threeD_class.shadowdraw == XtInheritXawSme3dShadowDraw) + tdwc->sme_threeD_class.shadowdraw = super->sme_threeD_class.shadowdraw; +} + +/* ARGSUSED */ +static void Initialize (request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + SmeThreeDObject w = (SmeThreeDObject) new; + Screen *scr = XtScreenOfObject (new); + Widget parent = XtParent(new); + + if (w->sme_threeD.be_nice_to_cmap || parent->core.depth == 1) { + AllocTopShadowPixmap (new); + AllocBotShadowPixmap (new); + } else { + if (w->sme_threeD.top_shadow_pixel == w->sme_threeD.bot_shadow_pixel) { + AllocTopShadowPixel (new); + AllocBotShadowPixel (new); + } + w->sme_threeD.top_shadow_pxmap = w->sme_threeD.bot_shadow_pxmap = 0; + } + AllocTopShadowGC (new); + AllocBotShadowGC (new); + AllocEraseGC (new); +} + +static void Destroy (gw) + Widget gw; +{ + SmeThreeDObject w = (SmeThreeDObject) gw; + XtReleaseGC (gw, w->sme_threeD.top_shadow_GC); + XtReleaseGC (gw, w->sme_threeD.bot_shadow_GC); + XtReleaseGC (gw, w->sme_threeD.erase_GC); + if (w->sme_threeD.top_shadow_pxmap) + XFreePixmap (XtDisplayOfObject (gw), w->sme_threeD.top_shadow_pxmap); + if (w->sme_threeD.bot_shadow_pxmap) + XFreePixmap (XtDisplayOfObject (gw), w->sme_threeD.bot_shadow_pxmap); +} + +/* ARGSUSED */ +static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) + Widget gcurrent, grequest, gnew; + ArgList args; + Cardinal *num_args; +{ + SmeThreeDObject current = (SmeThreeDObject) gcurrent; + SmeThreeDObject new = (SmeThreeDObject) gnew; + Boolean redisplay = FALSE; + Boolean alloc_top_pixel = FALSE; + Boolean alloc_bot_pixel = FALSE; + Boolean alloc_top_pixmap = FALSE; + Boolean alloc_bot_pixmap = FALSE; + +#if 0 + (*threeDWidgetClass->core_class.superclass->core_class.set_values) + (gcurrent, grequest, gnew, NULL, 0); +#endif + if (new->sme_threeD.shadow_width != current->sme_threeD.shadow_width) + redisplay = TRUE; + if (new->sme_threeD.be_nice_to_cmap != current->sme_threeD.be_nice_to_cmap) { + if (new->sme_threeD.be_nice_to_cmap) { + alloc_top_pixmap = TRUE; + alloc_bot_pixmap = TRUE; + } else { + alloc_top_pixel = TRUE; + alloc_bot_pixel = TRUE; + } + redisplay = TRUE; + } + if (!new->sme_threeD.be_nice_to_cmap && + new->sme_threeD.top_shadow_contrast != current->sme_threeD.top_shadow_contrast) + alloc_top_pixel = TRUE; + if (!new->sme_threeD.be_nice_to_cmap && + new->sme_threeD.bot_shadow_contrast != current->sme_threeD.bot_shadow_contrast) + alloc_bot_pixel = TRUE; + if (alloc_top_pixel) + AllocTopShadowPixel (gnew); + if (alloc_bot_pixel) + AllocBotShadowPixel (gnew); + if (alloc_top_pixmap) + AllocTopShadowPixmap (gnew); + if (alloc_bot_pixmap) + AllocBotShadowPixmap (gnew); + if (!new->sme_threeD.be_nice_to_cmap && + new->sme_threeD.top_shadow_pixel != current->sme_threeD.top_shadow_pixel) + alloc_top_pixel = TRUE; + if (!new->sme_threeD.be_nice_to_cmap && + new->sme_threeD.bot_shadow_pixel != current->sme_threeD.bot_shadow_pixel) + alloc_bot_pixel = TRUE; + if (new->sme_threeD.be_nice_to_cmap) { + if (alloc_top_pixmap) { + XtReleaseGC (gcurrent, current->sme_threeD.top_shadow_GC); + AllocTopShadowGC (gnew); + redisplay = True; + } + if (alloc_bot_pixmap) { + XtReleaseGC (gcurrent, current->sme_threeD.bot_shadow_GC); + AllocBotShadowGC (gnew); + redisplay = True; + } + } else { + if (alloc_top_pixel) { + if (new->sme_threeD.top_shadow_pxmap) { + XFreePixmap (XtDisplayOfObject (gnew), new->sme_threeD.top_shadow_pxmap); + new->sme_threeD.top_shadow_pxmap = (Pixmap) NULL; + } + XtReleaseGC (gcurrent, current->sme_threeD.top_shadow_GC); + AllocTopShadowGC (gnew); + redisplay = True; + } + if (alloc_bot_pixel) { + if (new->sme_threeD.bot_shadow_pxmap) { + XFreePixmap (XtDisplayOfObject (gnew), new->sme_threeD.bot_shadow_pxmap); + new->sme_threeD.bot_shadow_pxmap = (Pixmap) NULL; + } + XtReleaseGC (gcurrent, current->sme_threeD.bot_shadow_GC); + AllocBotShadowGC (gnew); + redisplay = True; + } + } + return (redisplay); +} + +/* ARGSUSED */ +static void +_XawSme3dDrawShadows (gw) + Widget gw; +{ + XPoint pt[6]; + SmeThreeDObject tdo = (SmeThreeDObject) gw; + Dimension s = tdo->sme_threeD.shadow_width; + /* + * draw the shadows using the core part width and height, + * and the threeD part shadow_width. + * + * no point to do anything if the shadow_width is 0 or the + * widget has not been realized. + */ + if((s > 0) && XtIsRealized (gw)){ + + Dimension h = tdo->rectangle.height; + Dimension w = tdo->rectangle.width; + Dimension x = tdo->rectangle.x; + Dimension y = tdo->rectangle.y; + Display *dpy = XtDisplayOfObject (gw); + Window win = XtWindowOfObject (gw); + GC top, bot; + + if (tdo->sme_threeD.shadowed) { + top = tdo->sme_threeD.top_shadow_GC; + bot = tdo->sme_threeD.bot_shadow_GC; + } else + top = bot = tdo->sme_threeD.erase_GC; + + /* top-left shadow */ + pt[0].x = x; pt[0].y = y + h; + pt[1].x = x; pt[1].y = y; + pt[2].x = w; pt[2].y = y; + pt[3].x = w - s; pt[3].y = y + s; + pt[4].x = s; pt[4].y = y + s; + pt[5].x = s; pt[5].y = y + h - s; + XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin); + + /* bottom-right shadow */ + /* pt[0].x = x; pt[0].y = y + h; */ + pt[1].x = w; pt[1].y = y + h; + /* pt[2].x = w; pt[2].y = y; */ + /* pt[3].x = w - s; pt[3].y = y + s; */ + pt[4].x = w - s; pt[4].y = y + h - s; + /* pt[5].x = s; pt[5].y = y + h - s; */ + XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin); + } +} + diff --git a/vendor/x11iraf/xaw3d/SmeThreeD.h b/vendor/x11iraf/xaw3d/SmeThreeD.h new file mode 100644 index 00000000..b4d458ff --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeThreeD.h @@ -0,0 +1,96 @@ +/* +* $KK: SmeThreeD.h,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawSmeThreeD_h +#define _XawSmeThreeD_h + +/*********************************************************************** + * + * ThreeD Widget + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> +#include <X11/Xaw3d/Sme.h> + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + shadowWidth ShadowWidth Dimension 2 + topShadowPixel TopShadowPixel Pixel dynamic + bottomShadowPixel BottomShadowPixel Pixel dynamic + topShadowContrast TopShadowContrast Int 20 + bottomShadowContrast BottomShadowContrast Int 40 + userData UserData XtPointer NULL + beNiceToColormap BeNiceToColormap Boolean False + +*/ + +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNbeNiceToColourmap "beNiceToColormap" +#define XtCBeNiceToColourmap "BeNiceToColormap" +#define XtNuserData "userData" +#define XtCUserData "UserData" + +typedef struct _SmeThreeDClassRec *SmeThreeDObjectClass; +typedef struct _SmeThreeDRec *SmeThreeDObject; + +extern WidgetClass smeThreeDWidgetClass; + +_XFUNCPROTOBEGIN + +extern void XawSme3dComputeTopShadowRGB ( +#if NeedFunctionPrototypes + Widget /* new */, + XColor* /* xcol_out */ +#endif +); + +extern void XawSme3dComputeBottomShadowRGB ( +#if NeedFunctionPrototypes + Widget /* new */, + XColor* /* xcol_out */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawSmeThreeD_h */ diff --git a/vendor/x11iraf/xaw3d/SmeThreeDP.h b/vendor/x11iraf/xaw3d/SmeThreeDP.h new file mode 100644 index 00000000..a07dd406 --- /dev/null +++ b/vendor/x11iraf/xaw3d/SmeThreeDP.h @@ -0,0 +1,82 @@ +/* +* $KK: SmeThreeDP.h,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawSmeThreeDP_h +#define _XawSmeThreeDP_h + +#include <X11/Xaw3d/SmeThreeD.h> +#include <X11/Xaw3d/SmeP.h> + +typedef struct { + Dimension shadow_width; + Pixel top_shadow_pixel; + Pixel bot_shadow_pixel; + Pixmap top_shadow_pxmap; + Pixmap bot_shadow_pxmap; + int top_shadow_contrast; + int bot_shadow_contrast; + GC top_shadow_GC; + GC bot_shadow_GC; + GC erase_GC; + XtPointer user_data; + Boolean be_nice_to_cmap; + Boolean shadowed; + } SmeThreeDPart; + +/* Full instance record declaration */ +typedef struct _SmeThreeDRec { + ObjectPart object; + RectObjPart rectangle; + SmePart sme; + SmeThreeDPart sme_threeD; + } SmeThreeDRec; + +typedef void (*XawSme3dShadowDrawProc)( +#if NeedFunctionPrototypes + Widget +#endif +); + +typedef struct { + XawSme3dShadowDrawProc shadowdraw; + } SmeThreeDClassPart; + +/* Full class record declaration. */ +typedef struct _SmeThreeDClassRec { + RectObjClassPart rect_class; + SmeClassPart sme_class; + SmeThreeDClassPart sme_threeD_class; + } SmeThreeDClassRec; + +/* Class pointer. */ +extern SmeThreeDClassRec smeThreeDClassRec; + +#define XtInheritXawSme3dShadowDraw ((XawSme3dShadowDrawProc) _XtInherit) + +#endif /* _XawSmeThreeDP_h */ diff --git a/vendor/x11iraf/xaw3d/StripCharP.h b/vendor/x11iraf/xaw3d/StripCharP.h new file mode 100644 index 00000000..feb91e73 --- /dev/null +++ b/vendor/x11iraf/xaw3d/StripCharP.h @@ -0,0 +1,109 @@ +/* +* $XConsortium: StripCharP.h,v 1.5 94/04/17 20:12:55 converse Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawStripChartP_h +#define _XawStripChartP_h + +#include <X11/Xaw3d/StripChart.h> +#include <X11/Xaw3d/ThreeDP.h> + +#define NO_GCS 0 +#define FOREGROUND 1 << 0 +#define HIGHLIGHT 1 << 1 +#define ALL_GCS (FOREGROUND | HIGHLIGHT) + +/* New fields for the stripChart widget instance record */ + +typedef struct { + Pixel fgpixel; /* color index for graph */ + Pixel hipixel; /* color index for lines */ + GC fgGC; /* graphics context for fgpixel */ + GC hiGC; /* graphics context for hipixel */ + + /* start of graph stuff */ + + int update; /* update frequence */ + int scale; /* scale factor */ + int min_scale; /* smallest scale factor */ + int interval; /* data point interval */ + XPoint * points ; /* Poly point for repairing graph lines. */ + double max_value; /* Max Value in window */ + double valuedata[2048];/* record of data points */ + XtIntervalId interval_id; + XtCallbackList get_value; /* proc to call to fetch load pt */ + int jump_val; /* Amount to jump on each scroll. */ +} StripChartPart; + +/* Full instance record declaration */ +typedef struct _StripChartRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + StripChartPart strip_chart; +} StripChartRec; + +/* New fields for the StripChart widget class record */ +typedef struct {int dummy;} StripChartClassPart; + +/* Full class record declaration. */ +typedef struct _StripChartClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + StripChartClassPart strip_chart_class; +} StripChartClassRec; + +/* Class pointer. */ +extern StripChartClassRec stripChartClassRec; + +#endif /* _XawStripChartP_h */ diff --git a/vendor/x11iraf/xaw3d/StripChart.c b/vendor/x11iraf/xaw3d/StripChart.c new file mode 100644 index 00000000..6c47f4c5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/StripChart.c @@ -0,0 +1,556 @@ +/* $XConsortium: StripChart.c,v 1.25 94/04/17 20:12:56 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/StripCharP.h> +#include <X11/Xfuncs.h> + +#define MS_PER_SEC 1000 + +/* Private Data */ + +#define offset(field) XtOffsetOf(StripChartRec, field) + +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + offset(core.width), XtRImmediate, (XtPointer) 120}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + offset(core.height), XtRImmediate, (XtPointer) 120}, + {XtNupdate, XtCInterval, XtRInt, sizeof(int), + offset(strip_chart.update), XtRImmediate, (XtPointer) 10}, + {XtNminScale, XtCScale, XtRInt, sizeof(int), + offset(strip_chart.min_scale), XtRImmediate, (XtPointer) 1}, + {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(strip_chart.fgpixel), XtRString, XtDefaultForeground}, + {XtNhighlight, XtCForeground, XtRPixel, sizeof(Pixel), + offset(strip_chart.hipixel), XtRString, XtDefaultForeground}, + {XtNgetValue, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(strip_chart.get_value), XtRImmediate, (XtPointer) NULL}, + {XtNjumpScroll, XtCJumpScroll, XtRInt, sizeof(int), + offset(strip_chart.jump_val), XtRImmediate, (XtPointer) DEFAULT_JUMP}, +}; + +#undef offset + +static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints(); +static Boolean SetValues(); +static int repaint_window(); + +StripChartClassRec stripChartClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &threeDClassRec, + /* class_name */ "StripChart", + /* size */ sizeof(StripChartRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ XtExposeCompressMultiple | + XtExposeGraphicsExposeMerged, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ SetPoints, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ NULL, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* Simple class fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* ThreeD fields */ + /* shadowdraw */ XtInheritXaw3dShadowDraw + }, + { /* Stripchart fields */ + /* ignore */ 0 + } +}; + +WidgetClass stripChartWidgetClass = (WidgetClass) &stripChartClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static void draw_it(); + +/* Function Name: CreateGC + * Description: Creates the GC's + * Arguments: w - the strip chart widget. + * which - which GC's to create. + * Returns: none + */ + +static void +CreateGC(w, which) +StripChartWidget w; +unsigned int which; +{ + XGCValues myXGCV; + + if (which & FOREGROUND) { + myXGCV.foreground = w->strip_chart.fgpixel; + w->strip_chart.fgGC = XtGetGC((Widget) w, GCForeground, &myXGCV); + } + + if (which & HIGHLIGHT) { + myXGCV.foreground = w->strip_chart.hipixel; + w->strip_chart.hiGC = XtGetGC((Widget) w, GCForeground, &myXGCV); + } +} + +/* Function Name: DestroyGC + * Description: Destroys the GC's + * Arguments: w - the strip chart widget. + * which - which GC's to destroy. + * Returns: none + */ + +static void +DestroyGC(w, which) +StripChartWidget w; +unsigned int which; +{ + if (which & FOREGROUND) + XtReleaseGC((Widget) w, w->strip_chart.fgGC); + + if (which & HIGHLIGHT) + XtReleaseGC((Widget) w, w->strip_chart.hiGC); +} + +/* ARGSUSED */ +static void Initialize (greq, gnew, args, num_args) + Widget greq, gnew; + ArgList args; + Cardinal *num_args; +{ + StripChartWidget w = (StripChartWidget)gnew; + + if (w->strip_chart.update > 0) + w->strip_chart.interval_id = + XtAppAddTimeOut( XtWidgetToApplicationContext(gnew), + (unsigned long) w->strip_chart.update * MS_PER_SEC, + draw_it, (XtPointer) gnew); + CreateGC(w, (unsigned int) ALL_GCS); + + w->strip_chart.scale = w->strip_chart.min_scale; + w->strip_chart.interval = 0; + w->strip_chart.max_value = 0.0; + w->strip_chart.points = NULL; + SetPoints((Widget)w); +} + +static void Destroy (gw) + Widget gw; +{ + StripChartWidget w = (StripChartWidget)gw; + + if (w->strip_chart.update > 0) + XtRemoveTimeOut (w->strip_chart.interval_id); + if (w->strip_chart.points) + XtFree((char *) w->strip_chart.points); + DestroyGC(w, (unsigned int) ALL_GCS); +} + +/* + * NOTE: This function really needs to recieve graphics exposure + * events, but since this is not easily supported until R4 I am + * going to hold off until then. + */ + +/* ARGSUSED */ +static void Redisplay(gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + + StripChartWidget w = (StripChartWidget)gw; + StripChartWidgetClass swclass = (StripChartWidgetClass) XtClass (gw); + Dimension x, width, s = w->threeD.shadow_width; + + (*swclass->threeD_class.shadowdraw) (gw, event, region, FALSE); + + if (event->type == GraphicsExpose) { + x = event->xgraphicsexpose.x; + width = event->xgraphicsexpose.width; + } else { + x = event->xexpose.x; + width = event->xexpose.width; + } + if (x > s) x -= s; /* respect shadow width, but don't become negative */ + else x = 0; + if (x + width > w->core.width - 2 * s) /* ditto for right boundary */ + width = w->core.width - 2 * s - x; + + (void) repaint_window (gw, x, width); +} + +/* ARGSUSED */ +static void +draw_it(client_data, id) +XtPointer client_data; +XtIntervalId *id; /* unused */ +{ + StripChartWidget w = (StripChartWidget)client_data; + StripChartWidgetClass swclass = (StripChartWidgetClass) XtClass ((Widget) w); + Dimension s = w->threeD.shadow_width; + double value; + + if (w->strip_chart.update > 0) + w->strip_chart.interval_id = + XtAppAddTimeOut(XtWidgetToApplicationContext( (Widget) w), + (unsigned long) w->strip_chart.update * MS_PER_SEC, + draw_it, client_data); + + if (w->strip_chart.interval >= (int)( w->core.width - 2 * s)) + MoveChart( (StripChartWidget) w, TRUE); + + /* Get the value, stash the point and draw corresponding line. */ + + if (w->strip_chart.get_value == NULL) + return; + + XtCallCallbacks( (Widget)w, XtNgetValue, (XtPointer)&value ); + + /* + * Keep w->strip_chart.max_value up to date, and if this data + * point is off the graph, change the scale to make it fit. + */ + + if (value > w->strip_chart.max_value) { + w->strip_chart.max_value = value; + if (XtIsRealized((Widget)w) && + w->strip_chart.max_value > w->strip_chart.scale) { + XClearWindow(XtDisplay ((Widget) w), XtWindow ((Widget) w)); + w->strip_chart.interval = repaint_window((Widget)w, 0, (int) w->core.width - 2 * s); + (*swclass->threeD_class.shadowdraw) ((Widget) w, + (XEvent *)0, (Region)0, + FALSE); + } + } + + w->strip_chart.valuedata[w->strip_chart.interval] = value; + if (XtIsRealized((Widget)w)) { + int y = (int) (( w->core.height - 2 * s) + - (int)(( w->core.height - 2 * s) * value) / w->strip_chart.scale); + + XFillRectangle(XtDisplay((Widget) w), XtWindow((Widget) w), w->strip_chart.fgGC, + w->strip_chart.interval + s, + y + s, (unsigned int) 1, + (w->core.height - 2 * s) - y); + /* + * Fill in the graph lines we just painted over. + */ + + if (w->strip_chart.points != NULL) { + w->strip_chart.points[0].x = w->strip_chart.interval + s; + XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC, + w->strip_chart.points, w->strip_chart.scale, + CoordModePrevious); + } + + XFlush(XtDisplay(w)); /* Flush output buffers */ + } + w->strip_chart.interval++; /* Next point */ +} /* draw_it */ + +/* Blts data according to current size, then redraws the stripChart window. + * Next represents the number of valid points in data. Returns the (possibly) + * adjusted value of next. If next is 0, this routine draws an empty window + * (scale - 1 lines for graph). If next is less than the current window width, + * the returned value is identical to the initial value of next and data is + * unchanged. Otherwise keeps half a window's worth of data. If data is + * changed, then w->strip_chart.max_value is updated to reflect the + * largest data point. + */ + +static int +repaint_window(gw, left, width) +Widget gw; +int left, width; +{ + StripChartWidget w = (StripChartWidget) gw; + Dimension s = w->threeD.shadow_width; + StripChartWidgetClass swclass = (StripChartWidgetClass) XtClass ((Widget) w); + int i, j; + int next = w->strip_chart.interval; + int scale = w->strip_chart.scale; + int scalewidth = 0; + + /* Compute the minimum scale required to graph the data, but don't go + lower than min_scale. */ + if (w->strip_chart.interval != 0 || scale <= (int)w->strip_chart.max_value) + scale = ((int) (w->strip_chart.max_value)) + 1; + if (scale < w->strip_chart.min_scale) + scale = w->strip_chart.min_scale; + + if (scale != w->strip_chart.scale) { + w->strip_chart.scale = scale; + left = 0; + width = next; /* check this */ + scalewidth = w->core.width - 2 * s; + + SetPoints(gw); + + if (XtIsRealized (gw)) { + XClearWindow (XtDisplay (gw), XtWindow (gw)); + (*swclass->threeD_class.shadowdraw) (gw, (XEvent *)0, (Region)0, FALSE); + } + + } + + if (XtIsRealized(gw)) { + Display *dpy = XtDisplay(gw); + Window win = XtWindow(gw); + + width += left - 1; + if (!scalewidth) scalewidth = width; + + if (next < (++width - s)) width = next + s; + + /* Draw data point lines. */ + for (i = left; i < width; i++) { + int y = (int) (( w->core.height - 2 * s) - + (int)(( w->core.height - 2 * s) * w->strip_chart.valuedata[i]) / + w->strip_chart.scale); + + XFillRectangle(dpy, win, w->strip_chart.fgGC, + i + s, y + s, (unsigned int) 1, + (unsigned int) (w->core.height - 2 * s - y )); + } + + /* Draw graph reference lines */ + for (i = 1; i < w->strip_chart.scale; i++) { + j = i * ((w->core.height - 2 * s) / w->strip_chart.scale); + XDrawLine(dpy, win, w->strip_chart.hiGC, + left + s, j + s, scalewidth + s, j + s); + } + } + return(next); +} + +/* Function Name: MoveChart + * Description: moves the chart over when it would run off the end. + * Arguments: w - the load widget. + * blit - blit the bits? (TRUE/FALSE). + * Returns: none. + */ + +static void +MoveChart(w, blit) +StripChartWidget w; +Boolean blit; +{ + Dimension s = w->threeD.shadow_width; + double old_max; + int left, i, j; + int next = w->strip_chart.interval; + + if (!XtIsRealized((Widget) w)) return; + + if (w->strip_chart.jump_val < 0) w->strip_chart.jump_val = DEFAULT_JUMP; + if (w->strip_chart.jump_val == DEFAULT_JUMP) + j = ( w->core.width - 2 * s) / 2; /* Half the window width. */ + else { + j = ( w->core.width - 2 * s) - w->strip_chart.jump_val; + if (j < 0) j = 0; + } + + (void) memmove((char *)(w->strip_chart.valuedata), + (char *)(w->strip_chart.valuedata + next - j), + j * sizeof(double)); + next = w->strip_chart.interval = j; + + /* + * Since we just lost some data, recompute the + * w->strip_chart.max_value. + */ + + old_max = w->strip_chart.max_value; + w->strip_chart.max_value = 0.0; + for (i = 0; i < next; i++) { + if (w->strip_chart.valuedata[i] > w->strip_chart.max_value) + w->strip_chart.max_value = w->strip_chart.valuedata[i]; + } + + if (!blit) return; /* we are done... */ + + if ( ((int) old_max) != ( (int) w->strip_chart.max_value) ) { + XClearWindow(XtDisplay(w), XtWindow(w)); + repaint_window((Widget)w, 0, w->core.width - 2 * s); + return; + } + + XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w), + w->strip_chart.hiGC, + (int) ((w->strip_chart.jump_val == DEFAULT_JUMP) ? + (j + s) : (w->strip_chart.jump_val + s)), s, + (unsigned int) j, (unsigned int) ( w->core.height - 2 * s), + s, s); + + XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w), + (int) j + s, s, + (unsigned int) ((w->strip_chart.jump_val == DEFAULT_JUMP) ? + j : w->strip_chart.jump_val), + (unsigned int) ( w->core.height - 2 * s), + FALSE); + + /* Draw graph reference lines */ + left = j; + for (i = 1; i < w->strip_chart.scale; i++) { + j = i * ((w->core.height - 2 * s) / w->strip_chart.scale); + XDrawLine(XtDisplay((Widget) w), XtWindow( (Widget) w), + w->strip_chart.hiGC, + left, j + s, ((int)w->core.width - s - 1), j + s); + } + return; +} + +/* ARGSUSED */ +static Boolean SetValues (current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + StripChartWidget old = (StripChartWidget)current; + StripChartWidget w = (StripChartWidget)new; + Boolean ret_val = FALSE; + unsigned int new_gc = NO_GCS; + + if (w->strip_chart.update != old->strip_chart.update) { + if (old->strip_chart.update > 0) + XtRemoveTimeOut (old->strip_chart.interval_id); + if (w->strip_chart.update > 0) + w->strip_chart.interval_id = + XtAppAddTimeOut(XtWidgetToApplicationContext(new), + (unsigned long) w->strip_chart.update * MS_PER_SEC, + draw_it, (XtPointer)w); + } + + if ( w->strip_chart.min_scale > (int) ((w->strip_chart.max_value) + 1) ) + ret_val = TRUE; + + if ( w->strip_chart.fgpixel != old->strip_chart.fgpixel ) { + new_gc |= FOREGROUND; + ret_val = True; + } + + if ( w->strip_chart.hipixel != old->strip_chart.hipixel ) { + new_gc |= HIGHLIGHT; + ret_val = True; + } + + DestroyGC(old, new_gc); + CreateGC(w, new_gc); + + return( ret_val ); +} + +/* Function Name: SetPoints + * Description: Sets up the polypoint that will be used to draw in + * the graph lines. + * Arguments: w - the StripChart widget. + * Returns: none. + */ + +#define HEIGHT ( (unsigned int) w->core.height) + +static void +SetPoints(widget) +Widget widget; +{ + StripChartWidget w = (StripChartWidget) widget; + Dimension s = w->threeD.shadow_width; + XPoint * points; + Cardinal size; + int i; + + if (w->strip_chart.scale <= 1) { /* no scale lines. */ + XtFree ((char *) w->strip_chart.points); + w->strip_chart.points = NULL; + return; + } + + size = sizeof(XPoint) * (w->strip_chart.scale - 1); + + points = (XPoint *) XtRealloc( (XtPointer) w->strip_chart.points, size); + w->strip_chart.points = points; + + /* Draw graph reference lines into clip mask */ + + for (i = 1; i < w->strip_chart.scale; i++) { + points[i - 1].x = 0; + points[i - 1].y = ( short)(((double)w->core.height - 2.0 * (double) s) / (double) w->strip_chart.scale ); + } + points[0].y += (short)s; +} diff --git a/vendor/x11iraf/xaw3d/StripChart.h b/vendor/x11iraf/xaw3d/StripChart.h new file mode 100644 index 00000000..93052d07 --- /dev/null +++ b/vendor/x11iraf/xaw3d/StripChart.h @@ -0,0 +1,118 @@ +/* $XConsortium: StripChart.h,v 1.6 94/04/17 20:12:57 converse Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawStripChart_h +#define _XawStripChart_h + +/*********************************************************************** + * + * StripChart Widget + * + ***********************************************************************/ + +/* StripChart resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + accelerators Accelerators AcceleratorTable NULL + ancestorSensitive AncestorSensitive Boolean True + background Background Pixel XtDefaultBackground + backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderColor BorderColor Pixel XtDefaultForeground + borderPixmap Pixmap Pixmap XtUnspecifiedPixmap + borderWidth BorderWidth Dimension 1 + colormap Colormap Colormap parent's colormap + cursor Cursor Cursor None + cursorName Cursor String NULL + depth Depth int parent's depth + destroyCallback Callback XtCallbackList NULL + foreground Foreground Pixel XtDefaultForeground + getValue Callback XtCallbackList NULL + height Height Dimension 120 + highlight Foreground Pixel XtDefaultForeground + insensitiveBorder Insensitive Pixmap GreyPixmap + jumpScroll JumpScroll int 1/2 width + mappedWhenManaged MappedWhenManaged Boolean True + minScale Scale int 1 + pointerColor Foreground Pixel XtDefaultForeground + pointerColorBackground Background Pixel XtDefaultBackground + screen Screen Screen parent's screen + sensitive Sensitive Boolean True + translations Translations TranslationTable NULL + update Interval int 10 (seconds) + width Width Dimension 120 + x Position Position 0 + y Position Position 0 + +*/ + +#define DEFAULT_JUMP -1 + +#ifndef _XtStringDefs_h_ +#define XtNhighlight "highlight" +#define XtNupdate "update" +#endif + +#define XtCJumpScroll "JumpScroll" +#define XtCScale "Scale" + +#define XtNgetValue "getValue" +#define XtNjumpScroll "jumpScroll" +#define XtNminScale "minScale" +#define XtNscale "scale" +#define XtNvmunix "vmunix" + +typedef struct _StripChartRec *StripChartWidget; +typedef struct _StripChartClassRec *StripChartWidgetClass; + +extern WidgetClass stripChartWidgetClass; + +#endif /* _XawStripChart_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/xaw3d/Template.c b/vendor/x11iraf/xaw3d/Template.c new file mode 100644 index 00000000..33063aa7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Template.c @@ -0,0 +1,94 @@ +/* $XConsortium: Template.c,v 1.5 94/04/17 20:12:58 converse Exp $ */ + +/* + +Copyright (c) 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "TemplateP.h" + +static XtResource resources[] = { +#define offset(field) XtOffsetOf(TemplateRec, template.field) + /* {name, class, type, size, offset, default_type, default_addr}, */ + { XtNtemplateResource, XtCTemplateResource, XtRTemplateResource, + sizeof(char*), offset(resource), XtRString, (XtPointer) "default" }, +#undef offset +}; + +static void TemplateAction(/* Widget, XEvent*, String*, Cardinal* */); + +static XtActionsRec actions[] = +{ + /* {name, procedure}, */ + {"template", TemplateAction}, +}; + +static char translations[] = +"<Key>: template() \n\ +"; + +TemplateClassRec templateClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "Template", + /* widget_size */ sizeof(TemplateRec), + /* class_initialize */ NULL, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ NULL, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ translations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* template fields */ + /* empty */ 0 + } +}; + +WidgetClass templateWidgetClass = (WidgetClass)&templateClassRec; diff --git a/vendor/x11iraf/xaw3d/Template.h b/vendor/x11iraf/xaw3d/Template.h new file mode 100644 index 00000000..dbb6b149 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Template.h @@ -0,0 +1,71 @@ +/* $XConsortium: Template.h,v 1.6 94/04/17 20:12:59 converse Exp $ */ + +/* + +Copyright (c) 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#ifndef _Template_h +#define _Template_h + +/**************************************************************** + * + * Template widget + * + ****************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + sensitive Sensitive Boolean True + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +/* define any special resource names here that are not in <X11/StringDefs.h> */ + +#define XtNtemplateResource "templateResource" + +#define XtCTemplateResource "TemplateResource" + +/* declare specific TemplateWidget class and instance datatypes */ + +typedef struct _TemplateClassRec* TemplateWidgetClass; +typedef struct _TemplateRec* TemplateWidget; + +/* declare the class constant */ + +extern WidgetClass templateWidgetClass; + +#endif /* _Template_h */ diff --git a/vendor/x11iraf/xaw3d/TemplateP.h b/vendor/x11iraf/xaw3d/TemplateP.h new file mode 100644 index 00000000..d20175e0 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TemplateP.h @@ -0,0 +1,64 @@ +/* $XConsortium: TemplateP.h,v 1.7 94/04/17 20:13:00 rws Exp $ */ + +/* + +Copyright (c) 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + + +#ifndef _TemplateP_h +#define _TemplateP_h + +#include <X11/Xaw3d/Template.h> +/* include superclass private header file */ +#include <X11/CoreP.h> + +/* define unique representation types not found in <X11/StringDefs.h> */ + +#define XtRTemplateResource "TemplateResource" + +typedef struct { + int empty; +} TemplateClassPart; + +typedef struct _TemplateClassRec { + CoreClassPart core_class; + TemplateClassPart template_class; +} TemplateClassRec; + +extern TemplateClassRec templateClassRec; + +typedef struct { + /* resources */ + char* resource; + /* private state */ +} TemplatePart; + +typedef struct _TemplateRec { + CorePart core; + TemplatePart template; +} TemplateRec; + +#endif /* _TemplateP_h */ diff --git a/vendor/x11iraf/xaw3d/Text.c b/vendor/x11iraf/xaw3d/Text.c new file mode 100644 index 00000000..0a999091 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Text.c @@ -0,0 +1,3533 @@ +/* -XT + * $XConsortium: Text.c,v 1.197 95/06/14 15:07:27 kaleb Exp $ + * J. P. Terlouw, Kapteyn Astronomical Institute, Groningen The Netherlands, + * February 2001: modified for use with non-default visuals. + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Xatom.h> +#include <X11/Xutil.h> +#include "XawI18n.h" +#include <stdio.h> + +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/StdSel.h> +#include <X11/Xmu/Misc.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/Cardinals.h> +#include <X11/Xaw3d/Scrollbar.h> +#include <X11/Xaw3d/TextP.h> +#include <X11/Xaw3d/MultiSinkP.h> +#include <X11/Xaw3d/XawImP.h> + +#include <X11/Xfuncs.h> +#include <ctype.h> /* for isprint() */ + +#ifndef MAX_LEN_CT +#define MAX_LEN_CT 6 /* for sequence: ESC $ ( A \xx \xx */ +#endif + +unsigned long FMT8BIT = 0L; +unsigned long XawFmt8Bit = 0L; +unsigned long XawFmtWide = 0L; + +#define SinkClearToBG XawTextSinkClearToBackground + +#define SrcScan XawTextSourceScan +#define SrcRead XawTextSourceRead +#define SrcReplace XawTextSourceReplace +#define SrcSearch XawTextSourceSearch +#define SrcCvtSel XawTextSourceConvertSelection +#define SrcSetSelection XawTextSourceSetSelection + +#define BIGNUM ((Dimension)32023) +#define MULTI_CLICK_TIME 500L + +/* + * Compute a the maximum length of a cut buffer that we can pass at any + * time. The 64 allows for the overhead of the Change Property request. + */ + +#define MAX_CUT_LEN(dpy) (XMaxRequestSize(dpy) - 64) + +#define IsValidLine(ctx, num) ( ((num) == 0) || \ + ((ctx)->text.lt.info[(num)].position != 0) ) + +/* + * Defined in Text.c + */ +static void UnrealizeScrollbars(); +static void VScroll(), VJump(), HScroll(), HJump(), ClearWindow(); +static void DisplayTextWindow(), ModifySelection(), PushCopyQueue(); +static void UpdateTextInLine(), UpdateTextInRectangle(), PopCopyQueue(); +static void FlushUpdate(); +static Boolean LineAndXYForPosition(), TranslateExposeRegion(); +static XawTextPosition FindGoodPosition(), _BuildLineTable(); + +void _XawTextAlterSelection(), _XawTextExecuteUpdate(); +void _XawTextSetScrollBars(), _XawTextPrepareToUpdate(); + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +static XawTextSelectType defaultSelectTypes[] = { + XawselectPosition, XawselectWord, XawselectLine, XawselectParagraph, + XawselectAll, XawselectNull, +}; + +static XPointer defaultSelectTypesPtr = (XPointer)defaultSelectTypes; +extern char *_XawDefaultTextTranslations1, *_XawDefaultTextTranslations2, + *_XawDefaultTextTranslations3, *_XawDefaultTextTranslations4; +static Dimension defWidth = 100; +static Dimension defHeight = DEFAULT_TEXT_HEIGHT; + +#define offset(field) XtOffsetOf(TextRec, field) +static XtResource resources[] = { + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + offset(core.width), XtRDimension, (XtPointer)&defWidth}, + {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), + offset(simple.cursor), XtRString, "xterm"}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + offset(core.height), XtRDimension, (XtPointer)&defHeight}, + {XtNdisplayPosition, XtCTextPosition, XtRInt, sizeof(XawTextPosition), + offset(text.lt.top), XtRImmediate, (XtPointer)0}, + {XtNinsertPosition, XtCTextPosition, XtRInt, sizeof(XawTextPosition), + offset(text.insertPos), XtRImmediate,(XtPointer)0}, + {XtNleftMargin, XtCMargin, XtRPosition, sizeof (Position), + offset(text.r_margin.left), XtRImmediate, (XtPointer)2}, + {XtNrightMargin, XtCMargin, XtRPosition, sizeof (Position), + offset(text.r_margin.right), XtRImmediate, (XtPointer)4}, + {XtNtopMargin, XtCMargin, XtRPosition, sizeof (Position), + offset(text.r_margin.top), XtRImmediate, (XtPointer)2}, + {XtNbottomMargin, XtCMargin, XtRPosition, sizeof (Position), + offset(text.r_margin.bottom), XtRImmediate, (XtPointer)2}, + {XtNselectTypes, XtCSelectTypes, XtRPointer, + sizeof(XawTextSelectType*), offset(text.sarray), + XtRPointer, (XtPointer)&defaultSelectTypesPtr}, + {XtNtextSource, XtCTextSource, XtRWidget, sizeof (Widget), + offset(text.source), XtRImmediate, NULL}, + {XtNtextSink, XtCTextSink, XtRWidget, sizeof (Widget), + offset(text.sink), XtRImmediate, NULL}, + {XtNdisplayCaret, XtCOutput, XtRBoolean, sizeof(Boolean), + offset(text.display_caret), XtRImmediate, (XtPointer)True}, + {XtNscrollVertical, XtCScroll, XtRScrollMode, sizeof(XawTextScrollMode), + offset(text.scroll_vert), XtRImmediate, (XtPointer) XawtextScrollNever}, + {XtNscrollHorizontal, XtCScroll, XtRScrollMode, sizeof(XawTextScrollMode), + offset(text.scroll_horiz), XtRImmediate, (XtPointer) XawtextScrollNever}, + {XtNwrap, XtCWrap, XtRWrapMode, sizeof(XawTextWrapMode), + offset(text.wrap), XtRImmediate, (XtPointer) XawtextWrapNever}, + {XtNresize, XtCResize, XtRResizeMode, sizeof(XawTextResizeMode), + offset(text.resize), XtRImmediate, (XtPointer) XawtextResizeNever}, + {XtNautoFill, XtCAutoFill, XtRBoolean, sizeof(Boolean), + offset(text.auto_fill), XtRImmediate, (XtPointer) FALSE}, + {XtNunrealizeCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(text.unrealize_callbacks), XtRCallback, (XtPointer) NULL} +}; +#undef offset + +/* ARGSUSED */ +static GC obtain_gc(display, drawable) +Display *display; +Drawable drawable; +{ + static GC result; + static int first=1; + if (first) { + first = 0; + result = XCreateGC(display, drawable, 0, NULL); + } + return result; +} + +/* ARGSUSED */ +static void +CvtStringToScrollMode(args, num_args, fromVal, toVal) +XrmValuePtr args; /* unused */ +Cardinal *num_args; /* unused */ +XrmValuePtr fromVal; +XrmValuePtr toVal; +{ + static XawTextScrollMode scrollMode; + static XrmQuark QScrollNever, QScrollAlways, QScrollWhenNeeded; + XrmQuark q; + char lowerName[40]; + static Boolean inited = FALSE; + + if ( !inited ) { + QScrollNever = XrmPermStringToQuark(XtEtextScrollNever); + QScrollWhenNeeded = XrmPermStringToQuark(XtEtextScrollWhenNeeded); + QScrollAlways = XrmPermStringToQuark(XtEtextScrollAlways); + inited = TRUE; + } + + if (strlen ((char*) fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered (lowerName, (char *)fromVal->addr); + q = XrmStringToQuark(lowerName); + + if (q == QScrollNever) scrollMode = XawtextScrollNever; + else if (q == QScrollWhenNeeded) scrollMode = XawtextScrollWhenNeeded; + else if (q == QScrollAlways) scrollMode = XawtextScrollAlways; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof scrollMode; + toVal->addr = (XPointer) &scrollMode; + return; + } + toVal->size = 0; + toVal->addr = NULL; +} + +/* ARGSUSED */ +static void +CvtStringToWrapMode(args, num_args, fromVal, toVal) +XrmValuePtr args; /* unused */ +Cardinal *num_args; /* unused */ +XrmValuePtr fromVal; +XrmValuePtr toVal; +{ + static XawTextWrapMode wrapMode; + static XrmQuark QWrapNever, QWrapLine, QWrapWord; + XrmQuark q; + char lowerName[BUFSIZ]; + static Boolean inited = FALSE; + + if ( !inited ) { + QWrapNever = XrmPermStringToQuark(XtEtextWrapNever); + QWrapLine = XrmPermStringToQuark(XtEtextWrapLine); + QWrapWord = XrmPermStringToQuark(XtEtextWrapWord); + inited = TRUE; + } + + if (strlen ((char*) fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered (lowerName, (char *)fromVal->addr); + q = XrmStringToQuark(lowerName); + + if (q == QWrapNever) wrapMode = XawtextWrapNever; + else if (q == QWrapLine) wrapMode = XawtextWrapLine; + else if (q == QWrapWord) wrapMode = XawtextWrapWord; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof wrapMode; + toVal->addr = (XPointer) &wrapMode; + return; + } + toVal->size = 0; + toVal->addr = NULL; +} + +/* ARGSUSED */ +static void +CvtStringToResizeMode(args, num_args, fromVal, toVal) +XrmValuePtr args; /* unused */ +Cardinal *num_args; /* unused */ +XrmValuePtr fromVal; +XrmValuePtr toVal; +{ + static XawTextResizeMode resizeMode; + static XrmQuark QResizeNever, QResizeWidth, QResizeHeight, QResizeBoth; + XrmQuark q; + char lowerName[40]; + static Boolean inited = FALSE; + + if ( !inited ) { + QResizeNever = XrmPermStringToQuark(XtEtextResizeNever); + QResizeWidth = XrmPermStringToQuark(XtEtextResizeWidth); + QResizeHeight = XrmPermStringToQuark(XtEtextResizeHeight); + QResizeBoth = XrmPermStringToQuark(XtEtextResizeBoth); + inited = TRUE; + } + + if (strlen ((char*) fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered (lowerName, (char *)fromVal->addr); + q = XrmStringToQuark(lowerName); + + if (q == QResizeNever) resizeMode = XawtextResizeNever; + else if (q == QResizeWidth) resizeMode = XawtextResizeWidth; + else if (q == QResizeHeight) resizeMode = XawtextResizeHeight; + else if (q == QResizeBoth) resizeMode = XawtextResizeBoth; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof resizeMode; + toVal->addr = (XPointer) &resizeMode; + return; + } + toVal->size = 0; + toVal->addr = NULL; +} + +static void +ClassInitialize() +{ + int len1 = strlen (_XawDefaultTextTranslations1); + int len2 = strlen (_XawDefaultTextTranslations2); + int len3 = strlen (_XawDefaultTextTranslations3); + int len4 = strlen (_XawDefaultTextTranslations4); + char *buf = XtMalloc ((unsigned)(len1 + len2 + len3 + len4 + 1)); + char *cp = buf; + + if (!XawFmt8Bit) + FMT8BIT = XawFmt8Bit = XrmPermStringToQuark("FMT8BIT"); + if (!XawFmtWide) + XawFmtWide = XrmPermStringToQuark("FMTWIDE"); + + XawInitializeWidgetSet(); + +/* + * Set the number of actions. + */ + + textClassRec.core_class.num_actions = _XawTextActionsTableCount; + + (void) strcpy( cp, _XawDefaultTextTranslations1); cp += len1; + (void) strcpy( cp, _XawDefaultTextTranslations2); cp += len2; + (void) strcpy( cp, _XawDefaultTextTranslations3); cp += len3; + (void) strcpy( cp, _XawDefaultTextTranslations4); + textWidgetClass->core_class.tm_table = buf; + + XtAddConverter(XtRString, XtRScrollMode, CvtStringToScrollMode, + (XtConvertArgList)NULL, (Cardinal)0 ); + XtAddConverter(XtRString, XtRWrapMode, CvtStringToWrapMode, + (XtConvertArgList)NULL, (Cardinal)0 ); + XtAddConverter(XtRString, XtRResizeMode, CvtStringToResizeMode, + (XtConvertArgList)NULL, (Cardinal)0 ); +} + +/* Function Name: PositionHScrollBar. + * Description: Positions the Horizontal scrollbar. + * Arguments: ctx - the text widget. + * Returns: none + */ + +static void +PositionHScrollBar(ctx) +TextWidget ctx; +{ + Widget vbar = ctx->text.vbar, hbar = ctx->text.hbar; + Position top, left = 0; + + if (ctx->text.hbar == NULL) return; + + if (vbar != NULL) + left += (Position) (vbar->core.width + vbar->core.border_width); + + XtResizeWidget( hbar, ctx->core.width - left, hbar->core.height, + hbar->core.border_width ); + + left -= (Position) hbar->core.border_width; + + top = ctx->core.height - ( hbar->core.height + hbar->core.border_width); + XtMoveWidget( hbar, left, top); +} + +/* Function Name: PositionVScrollBar. + * Description: Positions the Vertical scrollbar. + * Arguments: ctx - the text widget. + * Returns: none. + */ + +static void +PositionVScrollBar(ctx) +TextWidget ctx; +{ + Widget vbar = ctx->text.vbar; + Dimension bw; + + if (vbar == NULL) return; + bw = vbar->core.border_width; + + XtResizeWidget( vbar, vbar->core.width, ctx->core.height, bw); + XtMoveWidget( vbar, -(Position)bw, -(Position)bw ); +} + +static void +CreateVScrollBar(ctx) +TextWidget ctx; +{ + Widget vbar; + + if (ctx->text.vbar != NULL) return; + + ctx->text.vbar = vbar = + XtCreateWidget("vScrollbar", scrollbarWidgetClass, (Widget)ctx, + (ArgList) NULL, ZERO); + XtAddCallback( vbar, XtNscrollProc, VScroll, (XtPointer)ctx ); + XtAddCallback( vbar, XtNjumpProc, VJump, (XtPointer)ctx ); + if (ctx->text.hbar == NULL) + XtAddCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars, + (XtPointer) NULL); + + ctx->text.r_margin.left += vbar->core.width + vbar->core.border_width; + ctx->text.margin.left = ctx->text.r_margin.left; + + PositionVScrollBar(ctx); + PositionHScrollBar(ctx); /* May modify location of Horiz. Bar. */ + + if (XtIsRealized((Widget)ctx)) { + XtRealizeWidget(vbar); + XtMapWidget(vbar); + } +} + +/* Function Name: DestroyVScrollBar + * Description: Removes a vertical ScrollBar. + * Arguments: ctx - the parent text widget. + * Returns: none. + */ + +static void +DestroyVScrollBar(ctx) +TextWidget ctx; +{ + Widget vbar = ctx->text.vbar; + + if (vbar == NULL) return; + + ctx->text.r_margin.left -= vbar->core.width + vbar->core.border_width; + ctx->text.margin.left = ctx->text.r_margin.left; + if (ctx->text.hbar == NULL) + XtRemoveCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars, + (XtPointer) NULL); + XtDestroyWidget(vbar); + ctx->text.vbar = NULL; + PositionHScrollBar(ctx); +} + +static void +CreateHScrollBar(ctx) +TextWidget ctx; +{ + Arg args[1]; + Widget hbar; + + if (ctx->text.hbar != NULL) return; + + XtSetArg(args[0], XtNorientation, XtorientHorizontal); + ctx->text.hbar = hbar = + XtCreateWidget("hScrollbar", scrollbarWidgetClass, (Widget)ctx, args, ONE); + XtAddCallback( hbar, XtNscrollProc, HScroll, (XtPointer)ctx ); + XtAddCallback( hbar, XtNjumpProc, HJump, (XtPointer)ctx ); + if (ctx->text.vbar == NULL) + XtAddCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars, + (XtPointer) NULL); + + PositionHScrollBar(ctx); + if (XtIsRealized((Widget)ctx)) { + XtRealizeWidget(hbar); + XtMapWidget(hbar); + } +} + +/* Function Name: DestroyHScrollBar + * Description: Removes a horizontal ScrollBar. + * Arguments: ctx - the parent text widget. + * Returns: none. + */ + +static void +DestroyHScrollBar(ctx) +TextWidget ctx; +{ + Widget hbar = ctx->text.hbar; + + if (hbar == NULL) return; + +/* + ctx->text.r_margin.bottom -= hbar->core.height + hbar->core.border_width; + ctx->text.margin.bottom = ctx->text.r_margin.bottom; +*/ + if (ctx->text.vbar == NULL) + XtRemoveCallback((Widget) ctx, XtNunrealizeCallback, UnrealizeScrollbars, + (XtPointer) NULL); + XtDestroyWidget(hbar); + ctx->text.hbar = NULL; +} + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; /* unused */ +Cardinal *num_args; /* unused */ +{ + TextWidget ctx = (TextWidget) new; + char error_buf[BUFSIZ]; + + ctx->text.lt.lines = 0; + ctx->text.lt.info = NULL; + (void) bzero((char *) &(ctx->text.origSel), sizeof(XawTextSelection)); + (void) bzero((char *) &(ctx->text.s), sizeof(XawTextSelection)); + ctx->text.s.type = XawselectPosition; + ctx->text.salt = NULL; + ctx->text.hbar = ctx->text.vbar = (Widget) NULL; + ctx->text.lasttime = 0; /* ||| correct? */ + ctx->text.time = 0; /* ||| correct? */ + ctx->text.showposition = TRUE; + ctx->text.lastPos = (ctx->text.source != NULL) ? GETLASTPOS : 0; + ctx->text.file_insert = NULL; + ctx->text.search = NULL; + ctx->text.updateFrom = (XawTextPosition *) XtMalloc((unsigned) ONE); + ctx->text.updateTo = (XawTextPosition *) XtMalloc((unsigned) ONE); + ctx->text.numranges = ctx->text.maxranges = 0; +#if 0 + ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx)); +#endif +#if 1 + ctx->text.gc = XtGetGC(ctx, 0, NULL); +#endif + ctx->text.hasfocus = FALSE; + ctx->text.margin = ctx->text.r_margin; /* Strucure copy. */ + ctx->text.update_disabled = FALSE; + ctx->text.old_insert = -1; + ctx->text.mult = 1; + ctx->text.single_char = FALSE; + ctx->text.copy_area_offsets = NULL; + ctx->text.salt2 = NULL; + + if (ctx->core.height == DEFAULT_TEXT_HEIGHT) { + ctx->core.height = VMargins(ctx); + if (ctx->text.sink != NULL) + ctx->core.height += XawTextSinkMaxHeight(ctx->text.sink, 1); + } + + if (ctx->text.scroll_vert != XawtextScrollNever) + if ( (ctx->text.resize == XawtextResizeHeight) || + (ctx->text.resize == XawtextResizeBoth) ) { + (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, + "Vertical scrolling not allowed with height resize.\n", + "Vertical scrolling has been DEACTIVATED."); + XtAppWarning(XtWidgetToApplicationContext(new), error_buf); + ctx->text.scroll_vert = XawtextScrollNever; + } + else if (ctx->text.scroll_vert == XawtextScrollAlways) + CreateVScrollBar(ctx); + + if (ctx->text.scroll_horiz != XawtextScrollNever) + if (ctx->text.wrap != XawtextWrapNever) { + (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, + "Horizontal scrolling not allowed with wrapping active.\n", + "Horizontal scrolling has been DEACTIVATED."); + XtAppWarning(XtWidgetToApplicationContext(new), error_buf); + ctx->text.scroll_horiz = XawtextScrollNever; + } + else if ( (ctx->text.resize == XawtextResizeWidth) || + (ctx->text.resize == XawtextResizeBoth) ) { + (void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name, + "Horizontal scrolling not allowed with width resize.\n", + "Horizontal scrolling has been DEACTIVATED."); + XtAppWarning(XtWidgetToApplicationContext(new), error_buf); + ctx->text.scroll_horiz = XawtextScrollNever; + } + else if (ctx->text.scroll_horiz == XawtextScrollAlways) + CreateHScrollBar(ctx); +} + +static void +Realize( w, valueMask, attributes ) +Widget w; +Mask *valueMask; +XSetWindowAttributes *attributes; +{ + TextWidget ctx = (TextWidget)w; + void _XawTextCheckResize(); + + (*textClassRec.core_class.superclass->core_class.realize) + (w, valueMask, attributes); +#if 0 + ctx->text.gc = obtain_gc(XtDisplay(ctx), XtWindow(ctx)); +#endif + + if (ctx->text.hbar != NULL) { /* Put up Hbar -- Must be first. */ + XtRealizeWidget(ctx->text.hbar); + XtMapWidget(ctx->text.hbar); + } + + if (ctx->text.vbar != NULL) { /* Put up Vbar. */ + XtRealizeWidget(ctx->text.vbar); + XtMapWidget(ctx->text.vbar); + } + + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + _XawTextSetScrollBars(ctx); + _XawTextCheckResize(ctx); +} + +/*ARGSUSED*/ +static void UnrealizeScrollbars(widget, client, call) +Widget widget; /* Text widget */ +XtPointer client; /* unused */ +XtPointer call; /* unused */ +{ + TextWidget ctx = (TextWidget) widget; + + if (ctx->text.hbar) + XtUnrealizeWidget(ctx->text.hbar); + if (ctx->text.vbar) + XtUnrealizeWidget(ctx->text.vbar); +} + +/* Utility routines for support of Text */ + +static void +_CreateCutBuffers(d) +Display *d; +{ + static struct _DisplayRec { + struct _DisplayRec *next; + Display *dpy; + } *dpy_list = NULL; + struct _DisplayRec *dpy_ptr; + + for (dpy_ptr = dpy_list; dpy_ptr != NULL; dpy_ptr = dpy_ptr->next) + if (dpy_ptr->dpy == d) return; + + dpy_ptr = XtNew(struct _DisplayRec); + dpy_ptr->next = dpy_list; + dpy_ptr->dpy = d; + dpy_list = dpy_ptr; + +#define Create(buffer) \ + XChangeProperty(d, RootWindow(d, 0), buffer, XA_STRING, 8, \ + PropModeAppend, NULL, 0 ); + + Create( XA_CUT_BUFFER0 ); + Create( XA_CUT_BUFFER1 ); + Create( XA_CUT_BUFFER2 ); + Create( XA_CUT_BUFFER3 ); + Create( XA_CUT_BUFFER4 ); + Create( XA_CUT_BUFFER5 ); + Create( XA_CUT_BUFFER6 ); + Create( XA_CUT_BUFFER7 ); + +#undef Create +} + +/* + * Procedure to manage insert cursor visibility for editable text. It uses + * the value of ctx->insertPos and an implicit argument. In the event that + * position is immediately preceded by an eol graphic, then the insert cursor + * is displayed at the beginning of the next line. +*/ +static void +InsertCursor (w, state) +Widget w; +XawTextInsertState state; +{ + TextWidget ctx = (TextWidget)w; + Position x, y; + int line; + + if (ctx->text.lt.lines < 1) return; + + if ( LineAndXYForPosition(ctx, ctx->text.insertPos, &line, &x, &y) ) { + if (line < ctx->text.lt.lines) + y += (ctx->text.lt.info[line + 1].y - ctx->text.lt.info[line].y) + 1; + else + y += (ctx->text.lt.info[line].y - ctx->text.lt.info[line - 1].y) + 1; + + if (ctx->text.display_caret) + XawTextSinkInsertCursor(ctx->text.sink, x, y, state); + } + ctx->text.ev_x = x; + ctx->text.ev_y = y; + + /* Keep Input Method up to speed */ + + if ( ctx->simple.international ) { + Arg list[1]; + + XtSetArg (list[0], XtNinsertPosition, ctx->text.insertPos); + _XawImSetValues (w, list, 1); + } +} + +/* + * Procedure to register a span of text that is no longer valid on the display + * It is used to avoid a number of small, and potentially overlapping, screen + * updates. +*/ + +void +_XawTextNeedsUpdating(ctx, left, right) +TextWidget ctx; +XawTextPosition left, right; +{ + int i; + if (left < right) { + for (i = 0; i < ctx->text.numranges; i++) { + if (left <= ctx->text.updateTo[i] && right >= ctx->text.updateFrom[i]) { + ctx->text.updateFrom[i] = Min(left, ctx->text.updateFrom[i]); + ctx->text.updateTo[i] = Max(right, ctx->text.updateTo[i]); + return; + } + } + ctx->text.numranges++; + if (ctx->text.numranges > ctx->text.maxranges) { + ctx->text.maxranges = ctx->text.numranges; + i = ctx->text.maxranges * sizeof(XawTextPosition); + ctx->text.updateFrom = (XawTextPosition *) + XtRealloc((char *)ctx->text.updateFrom, (unsigned) i); + ctx->text.updateTo = (XawTextPosition *) + XtRealloc((char *)ctx->text.updateTo, (unsigned) i); + } + ctx->text.updateFrom[ctx->text.numranges - 1] = left; + ctx->text.updateTo[ctx->text.numranges - 1] = right; + } +} + +/* + * Procedure to read a span of text in Ascii form. This is purely a hack and + * we probably need to add a function to sources to provide this functionality. + * [note: this is really a private procedure but is used in multiple modules]. + */ + +char * +_XawTextGetText(ctx, left, right) +TextWidget ctx; +XawTextPosition left, right; +{ + char *result, *tempResult; + XawTextBlock text; + int bytes; + + if (_XawTextFormat(ctx) == XawFmt8Bit) + bytes = sizeof(unsigned char); + else if (_XawTextFormat(ctx) == XawFmtWide) + bytes = sizeof(wchar_t); + else /* if there is another fomat, add here */ + bytes = 1; + + /* leave space for ZERO */ + tempResult=result=XtMalloc( (unsigned)(((Cardinal)(right-left))+ONE )* bytes); + while (left < right) { + left = SrcRead(ctx->text.source, left, &text, (int)(right - left)); + if (!text.length) + break; + memmove(tempResult, text.ptr, text.length * bytes); + tempResult += text.length * bytes; + } + + if (bytes == sizeof(wchar_t)) + *((wchar_t*)tempResult) = (wchar_t)0; + else + *tempResult = '\0'; + return(result); +} + +/* Like _XawTextGetText, but enforces ICCCM STRING type encoding. This +routine is currently used to put just the ASCII chars in the selection into a +cut buffer. */ + +char * +_XawTextGetSTRING(ctx, left, right) +TextWidget ctx; +XawTextPosition left, right; +{ + unsigned char *s; + unsigned char c; + long i, j, n; + wchar_t *ws, wc; + + /* allow ESC in accordance with ICCCM */ + if (_XawTextFormat(ctx) == XawFmtWide) { + MultiSinkObject sink = (MultiSinkObject) ctx->text.sink; + ws = (wchar_t *)_XawTextGetText(ctx, left, right); + n = wcslen(ws); + for (j = 0, i = 0; j < n; j++) { + wc = ws[j]; + if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1) || + (wc == _Xaw_atowc(XawTAB)) || (wc == _Xaw_atowc(XawLF)) || (wc == _Xaw_atowc(XawESC))) + ws[i++] = wc; + } + ws[i] = (wchar_t)0; + return (char *)ws; + } else { + s = (unsigned char *)_XawTextGetText(ctx, left, right); + /* only HT and NL control chars are allowed, strip out others */ + n = strlen((char *)s); + i = 0; + for (j = 0; j < n; j++) { + c = s[j]; + if (((c >= 0x20) && c <= 0x7f) || + (c >= 0xa0) || (c == XawTAB) || (c == XawLF) || (c == XawESC)) { + s[i] = c; + i++; + } + } + s[i] = 0; + return (char *)s; + } +#undef ESC + +} + +/* + * This routine maps an x and y position in a window that is displaying text + * into the corresponding position in the source. + * + * NOTE: it is illegal to call this routine unless there is a valid line table! + */ + +/*** figure out what line it is on ***/ + +static XawTextPosition +PositionForXY (ctx, x, y) +TextWidget ctx; +Position x,y; +{ + int fromx, line, width, height; + XawTextPosition position; + + if (ctx->text.lt.lines == 0) return 0; + + for (line = 0; line < ctx->text.lt.lines - 1; line++) { + if (y <= ctx->text.lt.info[line + 1].y) + break; + } + position = ctx->text.lt.info[line].position; + if (position >= ctx->text.lastPos) + return(ctx->text.lastPos); + fromx = (int) ctx->text.margin.left; + XawTextSinkFindPosition( ctx->text.sink, position, fromx, x - fromx, + FALSE, &position, &width, &height); + if (position > ctx->text.lastPos) return(ctx->text.lastPos); + if (position >= ctx->text.lt.info[line + 1].position) + position = SrcScan(ctx->text.source, ctx->text.lt.info[line + 1].position, + XawstPositions, XawsdLeft, 1, TRUE); + return(position); +} + +/* + * This routine maps a source position in to the corresponding line number + * of the text that is displayed in the window. + * + * NOTE: It is illegal to call this routine unless there is a valid line table! + */ + +static int +LineForPosition (ctx, position) +TextWidget ctx; +XawTextPosition position; +{ + int line; + + for (line = 0; line < ctx->text.lt.lines; line++) + if (position < ctx->text.lt.info[line + 1].position) + break; + return(line); +} + +/* + * This routine maps a source position into the corresponding line number + * and the x, y coordinates of the text that is displayed in the window. + * + * NOTE: It is illegal to call this routine unless there is a valid line table! + */ + +static Boolean +LineAndXYForPosition (ctx, pos, line, x, y) +TextWidget ctx; +XawTextPosition pos; +int *line; +Position *x, *y; +{ + XawTextPosition linePos, endPos; + Boolean visible; + int realW, realH; + + *line = 0; + *x = ctx->text.margin.left; + *y = ctx->text.margin.top; + if ((visible = IsPositionVisible(ctx, pos))) { + *line = LineForPosition(ctx, pos); + *y = ctx->text.lt.info[*line].y; + *x = ctx->text.margin.left; + linePos = ctx->text.lt.info[*line].position; + XawTextSinkFindDistance( ctx->text.sink, linePos, + *x, pos, &realW, &endPos, &realH); + *x += realW; + } + return(visible); +} + +/* + * This routine builds a line table. It does this by starting at the + * specified position and measuring text to determine the staring position + * of each line to be displayed. It also determines and saves in the + * linetable all the required metrics for displaying a given line (e.g. + * x offset, y offset, line length, etc.). + */ + +void +#if NeedFunctionPrototypes +_XawTextBuildLineTable ( + TextWidget ctx, + XawTextPosition position, + _XtBoolean force_rebuild) +#else +_XawTextBuildLineTable (ctx, position, force_rebuild) + TextWidget ctx; + XawTextPosition position; + Boolean force_rebuild; +#endif +{ + Dimension height = 0; + int lines = 0; + Cardinal size; + + if ((int)ctx->core.height > VMargins(ctx)) { + height = ctx->core.height - VMargins(ctx); + lines = XawTextSinkMaxLines(ctx->text.sink, height); + } + size = sizeof(XawTextLineTableEntry) * (lines + 1); + + if ( (lines != ctx->text.lt.lines) || (ctx->text.lt.info == NULL) ) { + ctx->text.lt.info = (XawTextLineTableEntry *) XtRealloc((char *) ctx->text. + lt.info, size); + ctx->text.lt.lines = lines; + force_rebuild = TRUE; + } + + if ( force_rebuild || (position != ctx->text.lt.top) ) { + (void) bzero((char *) ctx->text.lt.info, size); + (void) _BuildLineTable(ctx, ctx->text.lt.top = position, zeroPosition, 0); + } +} + +/* + * This assumes that the line table does not change size. + */ + +static XawTextPosition +_BuildLineTable(ctx, position, min_pos, line) +TextWidget ctx; +XawTextPosition position, min_pos; +int line; +{ + XawTextLineTableEntry * lt = ctx->text.lt.info + line; + XawTextPosition endPos; + Position y; + int count, width, realW, realH; + Widget src = ctx->text.source; + + if ( ((ctx->text.resize == XawtextResizeWidth) || + (ctx->text.resize == XawtextResizeBoth) ) || + (ctx->text.wrap == XawtextWrapNever) ) + width = BIGNUM; + else + width = Max(0, ((int)ctx->core.width - (int)HMargins(ctx))); + + y = ( (line == 0) ? ctx->text.margin.top : lt->y ); + + /* CONSTCOND */ + while ( TRUE ) { + lt->y = y; + lt->position = position; + + XawTextSinkFindPosition( ctx->text.sink, position, ctx->text.margin.left, + width, ctx->text.wrap == XawtextWrapWord, + &endPos, &realW, &realH); + lt->textWidth = realW; + y += realH; + + if (ctx->text.wrap == XawtextWrapNever) + endPos = SrcScan(src, position, XawstEOL, XawsdRight, 1, TRUE); + + if ( endPos == ctx->text.lastPos) { /* We have reached the end. */ + if(SrcScan(src, position, XawstEOL, XawsdRight, 1, FALSE) == endPos) + break; + } + + ++lt; + ++line; + if ( (line > ctx->text.lt.lines) || + ((lt->position == (position = endPos)) && (position > min_pos)) ) + return(position); + } + +/* + * If we are at the end of the buffer put two special lines in the table. + * + * a) Both have position > text.lastPos and lt->textWidth = 0. + * b) The first has a real height, and the second has a height that + * is the rest of the screen. + * + * I could fill in the rest of the table with valid heights and a large + * lastPos, but this method keeps the number of fill regions down to a + * minimum. + * + * One valid entry is needed at the end of the table so that the cursor + * does not jump off the bottom of the window. + */ + + for ( count = 0; count < 2 ; count++) + if (line++ < ctx->text.lt.lines) { /* make sure not to run of the end. */ + (++lt)->y = (count == 0) ? y : ctx->core.height; + lt->textWidth = 0; + lt->position = ctx->text.lastPos + 100; + } + + if (line < ctx->text.lt.lines) /* Clear out rest of table. */ + (void) bzero( (char *) (lt + 1), + (ctx->text.lt.lines - line) * sizeof(XawTextLineTableEntry) ); + + ctx->text.lt.info[ctx->text.lt.lines].position = lt->position; + + return(endPos); +} + +/* Function Name: GetWidestLine + * Description: Returns the width (in pixels) of the widest line that + * is currently visable. + * Arguments: ctx - the text widget. + * Returns: the width of the widest line. + * + * NOTE: This function requires a valid line table. + */ + +static Dimension +GetWidestLine(ctx) +TextWidget ctx; +{ + int i; + Dimension widest; + XawTextLineTablePtr lt = &(ctx->text.lt); + + for (i = 0, widest = 1 ; i < lt->lines ; i++) + if (widest < lt->info[i].textWidth) + widest = lt->info[i].textWidth; + + return(widest); +} + +static void +CheckVBarScrolling(ctx) +TextWidget ctx; +{ + float first, last; + Boolean temp = (ctx->text.vbar == NULL); + + if (ctx->text.scroll_vert == XawtextScrollNever) return; + + if ( (ctx->text.lastPos > 0) && (ctx->text.lt.lines > 0)) { + first = ctx->text.lt.top; + first /= (float) ctx->text.lastPos; + last = ctx->text.lt.info[ctx->text.lt.lines].position; + if ( ctx->text.lt.info[ctx->text.lt.lines].position < ctx->text.lastPos ) + last /= (float) ctx->text.lastPos; + else + last = 1.0; + + if (ctx->text.scroll_vert == XawtextScrollWhenNeeded) { + int line; + XawTextPosition last_pos; + Position y = ctx->core.height - ctx->text.margin.bottom; + + if (ctx->text.hbar != NULL) + y -= (ctx->text.hbar->core.height + + 2 * ctx->text.hbar->core.border_width); + + last_pos = PositionForXY(ctx, (Position) ctx->core.width, y); + line = LineForPosition(ctx, last_pos); + + if ( (y < ctx->text.lt.info[line + 1].y) || ((last - first) < 1.0) ) + CreateVScrollBar(ctx); + else + DestroyVScrollBar(ctx); + } + + if (ctx->text.vbar != NULL) + XawScrollbarSetThumb(ctx->text.vbar, first, last - first); + + if ( (ctx->text.vbar == NULL) != temp) { + _XawTextNeedsUpdating(ctx, zeroPosition, ctx->text.lastPos); + if (ctx->text.vbar == NULL) + _XawTextBuildLineTable (ctx, zeroPosition, FALSE); + } + } + else if (ctx->text.vbar != NULL) + if (ctx->text.scroll_vert == XawtextScrollWhenNeeded) + DestroyVScrollBar(ctx); + else if (ctx->text.scroll_vert == XawtextScrollAlways) + XawScrollbarSetThumb(ctx->text.vbar, 0.0, 1.0); +} + +/* + * This routine is used by Text to notify an associated scrollbar of the + * correct metrics (position and shown fraction) for the text being currently + * displayed in the window. + */ + +void +_XawTextSetScrollBars(ctx) +TextWidget ctx; +{ + float first, last, widest; + Boolean temp = (ctx->text.hbar == NULL); + Boolean vtemp = (ctx->text.vbar == NULL); + + CheckVBarScrolling(ctx); + + if (ctx->text.scroll_horiz == XawtextScrollNever) return; + + if (ctx->text.vbar != NULL) + widest = (int)(ctx->core.width - ctx->text.vbar->core.width - + ctx->text.vbar->core.border_width); + else + widest = ctx->core.width; + widest /= (last = GetWidestLine(ctx)); + if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded) + if (widest < 1.0) + CreateHScrollBar(ctx); + else + DestroyHScrollBar(ctx); + + if ( (ctx->text.hbar == NULL) != temp ) { + _XawTextBuildLineTable (ctx, ctx->text.lt.top, TRUE); + CheckVBarScrolling(ctx); /* Recheck need for vbar, now that we added + or removed the hbar.*/ + } + + if (ctx->text.hbar != NULL) { + first = ctx->text.r_margin.left - ctx->text.margin.left; + first /= last; + XawScrollbarSetThumb(ctx->text.hbar, first, widest); + } + + if (((ctx->text.hbar == NULL) && (ctx->text.margin.left != + ctx->text.r_margin.left)) || + (ctx->text.vbar == NULL) != vtemp) + { + ctx->text.margin.left = ctx->text.r_margin.left; + _XawTextNeedsUpdating(ctx, zeroPosition, ctx->text.lastPos); + FlushUpdate(ctx); + } +} + +/* + * The routine will scroll the displayed text by lines. If the arg is + * positive, move up; otherwise, move down. [note: this is really a private + * procedure but is used in multiple modules]. + */ + +void +_XawTextVScroll(ctx, n) +TextWidget ctx; +int n; +{ + XawTextPosition top, target; + int y; + Arg list[1]; + XawTextLineTable * lt = &(ctx->text.lt); + + if (abs(n) > ctx->text.lt.lines) + n = (n > 0) ? ctx->text.lt.lines : -ctx->text.lt.lines; + + if (n == 0) return; + + if (n > 0) { + if ( IsValidLine(ctx, n) ) + top = Min(lt->info[n].position, ctx->text.lastPos); + else + top = ctx->text.lastPos; + + y = IsValidLine(ctx, n) ? lt->info[n].y : ctx->core.height; + _XawTextBuildLineTable(ctx, top, FALSE); + if (top >= ctx->text.lastPos) + DisplayTextWindow( (Widget) ctx); + else { + XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc, + 0, y, (int)ctx->core.width, (int)ctx->core.height - y, + 0, ctx->text.margin.top); + + PushCopyQueue(ctx, 0, (int) -y); + SinkClearToBG(ctx->text.sink, + (Position) 0, + (Position) (ctx->text.margin.top + ctx->core.height - y), + (Dimension) ctx->core.width, (Dimension) ctx->core.height); + + if (n < lt->lines) n++; /* update descenders at bottom */ + _XawTextNeedsUpdating(ctx, lt->info[lt->lines - n].position, + ctx->text.lastPos); + _XawTextSetScrollBars(ctx); + } + } + else { + XawTextPosition updateTo; + unsigned int height, clear_height; + + n = -n; + target = lt->top; + top = SrcScan(ctx->text.source, target, XawstEOL, + XawsdLeft, n+1, FALSE); + + _XawTextBuildLineTable(ctx, top, FALSE); + y = IsValidLine(ctx, n) ? lt->info[n].y : ctx->core.height; + updateTo = IsValidLine(ctx, n) ? lt->info[n].position : ctx->text.lastPos; + if (IsValidLine(ctx, lt->lines - n)) + height = lt->info[lt->lines-n].y - ctx->text.margin.top; + else if (ctx->core.height - HMargins(ctx)) + height = ctx->core.height - HMargins(ctx); + else + height = 0; + if (y > (int) ctx->text.margin.top) + clear_height = y - ctx->text.margin.top; + else + clear_height = 0; + + if ( updateTo == target ) { + XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc, + 0, ctx->text.margin.top, (int) ctx->core.width, height, 0, y); + PushCopyQueue(ctx, 0, (int) y); + SinkClearToBG(ctx->text.sink, (Position) 0, ctx->text.margin.top, + (Dimension) ctx->core.width, (Dimension) clear_height); + + _XawTextNeedsUpdating(ctx, lt->info[0].position, updateTo); + _XawTextSetScrollBars(ctx); + } + else if (lt->top != target) + DisplayTextWindow((Widget)ctx); + } + XtSetArg (list[0], XtNinsertPosition, ctx->text.lt.top+ctx->text.lt.lines); + _XawImSetValues ((Widget) ctx, list, 1); +} + +/*ARGSUSED*/ +static void +HScroll(w, closure, callData) +Widget w; +XtPointer closure; /* TextWidget */ +XtPointer callData; /* #pixels */ +{ + TextWidget ctx = (TextWidget) closure; + Widget tw = (Widget) ctx; + Position old_left, pixels = (Position)(int) callData; + XRectangle rect, t_rect; + + _XawTextPrepareToUpdate(ctx); + + old_left = ctx->text.margin.left; + ctx->text.margin.left -= pixels; + if (ctx->text.margin.left > ctx->text.r_margin.left) { + ctx->text.margin.left = ctx->text.r_margin.left; + pixels = old_left - ctx->text.margin.left; + } + + if (pixels > 0) { + rect.width = (unsigned short) pixels + ctx->text.margin.right; + rect.x = (short) ctx->core.width - (short) rect.width; + rect.y = (short) ctx->text.margin.top; + rect.height = (unsigned short) ctx->core.height - rect.y; + + XCopyArea(XtDisplay(tw), XtWindow(tw), XtWindow(tw), ctx->text.gc, + pixels, (int) rect.y, + (unsigned int) rect.x, (unsigned int) ctx->core.height, + 0, (int) rect.y); + + PushCopyQueue(ctx, (int) -pixels, 0); + } + else if (pixels < 0) { + rect.x = 0; + + if (ctx->text.vbar != NULL) + rect.x += (short) (ctx->text.vbar->core.width + + ctx->text.vbar->core.border_width); + + rect.width = (Position) - pixels; + rect.y = ctx->text.margin.top; + rect.height = ctx->core.height - rect.y; + + XCopyArea(XtDisplay(tw), XtWindow(tw), XtWindow(tw), ctx->text.gc, + (int) rect.x, (int) rect.y, + (unsigned int) ctx->core.width - rect.width, + (unsigned int) rect.height, + (int) rect.x + rect.width, (int) rect.y); + + PushCopyQueue(ctx, (int) rect.width, 0); + +/* + * Redraw the line overflow marks. + */ + + t_rect.x = ctx->core.width - ctx->text.margin.right; + t_rect.width = ctx->text.margin.right; + t_rect.y = rect.y; + t_rect.height = rect.height; + + SinkClearToBG(ctx->text.sink, (Position) t_rect.x, (Position) t_rect.y, + (Dimension) t_rect.width, (Dimension) t_rect.height); + + UpdateTextInRectangle(ctx, &t_rect); + } + +/* + * Put in the text that just became visible. + */ + + if ( pixels != 0 ) { + SinkClearToBG(ctx->text.sink, (Position) rect.x, (Position) rect.y, + (Dimension) rect.width, (Dimension) rect.height); + + UpdateTextInRectangle(ctx, &rect); + } + _XawTextExecuteUpdate(ctx); + _XawTextSetScrollBars(ctx); +} + +/*ARGSUSED*/ +static void +HJump(w, closure, callData) +Widget w; +XtPointer closure, callData; /* closure = TextWidget, callData = percent. */ +{ + TextWidget ctx = (TextWidget) closure; + float * percent = (float *) callData; + Position new_left, old_left = ctx->text.margin.left; + + long move; /*difference of Positions can be bigger than Position; lint err */ + + new_left = ctx->text.r_margin.left; + new_left -= (Position) (*percent * GetWidestLine(ctx)); + move = old_left - new_left; + + if (abs(move) < (int)ctx->core.width) { + HScroll(w, (XtPointer) ctx, (XtPointer) move); + return; + } + _XawTextPrepareToUpdate(ctx); + ctx->text.margin.left = new_left; + if (XtIsRealized((Widget) ctx)) DisplayTextWindow((Widget) ctx); + _XawTextExecuteUpdate(ctx); +} + +/* Function Name: UpdateTextInLine + * Description: Updates some text in a given line. + * Arguments: ctx - the text widget. + * line - the line number (in the line table) of this line. + * left, right - left and right pixel offsets of the + * area to update. + * Returns: none. + */ + +static void +UpdateTextInLine(ctx, line, left, right) +TextWidget ctx; +int line; +Position left, right; +{ + XawTextPosition pos1, pos2; + int width, height, local_left, local_width; + XawTextLineTableEntry * lt = ctx->text.lt.info + line; + + if ( ((int)(lt->textWidth + ctx->text.margin.left) < left) || + ( ctx->text.margin.left > right ) ) + return; /* no need to update. */ + + local_width = left - ctx->text.margin.left; + XawTextSinkFindPosition(ctx->text.sink, lt->position, + (int) ctx->text.margin.left, + local_width, FALSE, &pos1, &width, &height); + + if (right >= (Position) lt->textWidth - ctx->text.margin.left) + if ( (IsValidLine(ctx, line + 1)) && + (ctx->text.lt.info[line + 1].position <= ctx->text.lastPos) ) + pos2 = SrcScan( ctx->text.source, (lt + 1)->position, XawstPositions, + XawsdLeft, 1, TRUE); + else + pos2 = GETLASTPOS; + else { + XawTextPosition t_pos; + + local_left = ctx->text.margin.left + width; + local_width = right - local_left; + XawTextSinkFindPosition(ctx->text.sink, pos1, local_left, + local_width, FALSE, &pos2, &width, &height); + + t_pos = SrcScan( ctx->text.source, pos2, + XawstPositions, XawsdRight, 1, TRUE); + if (t_pos < (lt + 1)->position) + pos2 = t_pos; + } + + _XawTextNeedsUpdating(ctx, pos1, pos2); +} + +/* + * The routine will scroll the displayed text by pixels. If the calldata is + * positive, move up; otherwise, move down. + */ + +/*ARGSUSED*/ +static void +VScroll(w, closure, callData) +Widget w; +XtPointer closure; /* TextWidget */ +XtPointer callData; /* #pixels */ +{ + TextWidget ctx = (TextWidget)closure; + int height, nlines, lines = (int) callData; + + height = ctx->core.height - VMargins(ctx); + if (height < 1) + height = 1; + nlines = (int) (lines * (int) ctx->text.lt.lines) / height; +#ifdef ARROW_SCROLLBAR + if (nlines == 0 && lines != 0) + nlines = lines > 0 ? 1 : -1; +#endif + _XawTextPrepareToUpdate(ctx); + _XawTextVScroll(ctx, nlines); + _XawTextExecuteUpdate(ctx); +} + +/* + * The routine "thumbs" the displayed text. Thumbing means reposition the + * displayed view of the source to a new position determined by a fraction + * of the way from beginning to end. Ideally, this should be determined by + * the number of displayable lines in the source. This routine does it as a + * fraction of the first position and last position and then normalizes to + * the start of the line containing the position. + * + * BUG/deficiency: The normalize to line portion of this routine will + * cause thumbing to always position to the start of the source. + */ + +/*ARGSUSED*/ +static void +VJump(w, closure, callData) +Widget w; +XtPointer closure, callData; /* closuer = TextWidget, callData = percent. */ +{ + float * percent = (float *) callData; + TextWidget ctx = (TextWidget)closure; + XawTextPosition position, old_top, old_bot; + XawTextLineTable * lt = &(ctx->text.lt); + + _XawTextPrepareToUpdate(ctx); + old_top = lt->top; + if ( (lt->lines > 0) && (IsValidLine(ctx, lt->lines - 1)) ) + old_bot = lt->info[lt->lines - 1].position; + else + old_bot = ctx->text.lastPos; + + position = (long) (*percent * (float) ctx->text.lastPos); + position= SrcScan(ctx->text.source, position, XawstEOL, XawsdLeft, 1, FALSE); + if ( (position >= old_top) && (position <= old_bot) ) { + int line = 0; + for (;(line < lt->lines) && (position > lt->info[line].position) ; line++); + _XawTextVScroll(ctx, line); + } + else { + XawTextPosition new_bot; + _XawTextBuildLineTable(ctx, position, FALSE); + new_bot = IsValidLine(ctx, lt->lines-1) ? lt->info[lt->lines-1].position + : ctx->text.lastPos; + + if ((old_top >= lt->top) && (old_top <= new_bot)) { + int line = 0; + for (;(line < lt->lines) && (old_top > lt->info[line].position); line++); + _XawTextBuildLineTable(ctx, old_top, FALSE); + _XawTextVScroll(ctx, -line); + } + else + DisplayTextWindow( (Widget) ctx); + } + _XawTextExecuteUpdate(ctx); +} + +static Boolean +MatchSelection(selection, s) +Atom selection; +XawTextSelection *s; +{ + Atom *match; + int count; + + for (count = 0, match = s->selections; count < s->atom_count; match++, count++) + if (*match == selection) + return True; + return False; +} + +static Boolean +ConvertSelection(w, selection, target, type, value, length, format) +Widget w; +Atom *selection, *target, *type; +XtPointer *value; +unsigned long *length; +int *format; +{ + Display* d = XtDisplay(w); + TextWidget ctx = (TextWidget)w; + Widget src = ctx->text.source; + XawTextEditType edit_mode; + Arg args[1]; + + XawTextSelectionSalt *salt = NULL; + XawTextSelection *s; + + if (*target == XA_TARGETS(d)) { + Atom* targetP, * std_targets; + unsigned long std_length; + + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) + return True; + + XmuConvertStandardSelection(w, ctx->text.time, selection, + target, type, (XPointer*)&std_targets, + &std_length, format); + + *value = XtMalloc((unsigned) sizeof(Atom)*(std_length + 7)); + targetP = *(Atom**)value; + *length = std_length + 6; + *targetP++ = XA_STRING; + *targetP++ = XA_TEXT(d); + *targetP++ = XA_COMPOUND_TEXT(d); + *targetP++ = XA_LENGTH(d); + *targetP++ = XA_LIST_LENGTH(d); + *targetP++ = XA_CHARACTER_POSITION(d); + + XtSetArg(args[0], XtNeditType,&edit_mode); + XtGetValues(src, args, ONE); + + if (edit_mode == XawtextEdit) { + *targetP++ = XA_DELETE(d); + (*length)++; + } + (void) memmove((char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); + XtFree((char*)std_targets); + *type = XA_ATOM; + *format = 32; + return True; + } + + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) + return True; + + if (MatchSelection (*selection, &ctx->text.s)) + s = &ctx->text.s; + else + { + for (salt = ctx->text.salt; salt; salt = salt->next) + if (MatchSelection (*selection, &salt->s)) + break; + if (!salt) + return False; + s = &salt->s; + } + if (*target == XA_STRING || + *target == XA_TEXT(d) || + *target == XA_COMPOUND_TEXT(d)) { + if (*target == XA_TEXT(d)) { + if (_XawTextFormat(ctx) == XawFmtWide) + *type = XA_COMPOUND_TEXT(d); + else + *type = XA_STRING; + } else { + *type = *target; + } + /* + * If salt is True, the salt->contents stores CT string, + * its length is measured in bytes. + * Refer to _XawTextSaltAwaySelection(). + * + * by Li Yuhong, Mar. 20, 1991. + */ + if (!salt) { + *value = _XawTextGetSTRING(ctx, s->left, s->right); + if (_XawTextFormat(ctx) == XawFmtWide) { + XTextProperty textprop; + if (XwcTextListToTextProperty(d, (wchar_t **)value, 1, + XCompoundTextStyle, &textprop) + < Success) { + XtFree(*value); + return False; + } + XtFree(*value); + *value = (XtPointer)textprop.value; + *length = textprop.nitems; + } else { + *length = strlen(*value); + } + } else { + *value = XtMalloc((salt->length + 1) * sizeof(unsigned char)); + strcpy (*value, salt->contents); + *length = salt->length; + } + if (_XawTextFormat(ctx) == XawFmtWide && *type == XA_STRING) { + XTextProperty textprop; + wchar_t **wlist; + int count; + textprop.encoding = XA_COMPOUND_TEXT(d); + textprop.value = (unsigned char *)*value; + textprop.nitems = strlen(*value); + textprop.format = 8; + if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count) + < Success) { + XtFree(*value); + return False; + } + XtFree(*value); + if (XwcTextListToTextProperty( d, (wchar_t **)wlist, 1, + XStringStyle, &textprop) < Success) { + XwcFreeStringList( (wchar_t**) wlist ); + return False; + } + *value = (XtPointer) textprop.value; + *length = textprop.nitems; + XwcFreeStringList( (wchar_t**) wlist ); + } + *format = 8; + return True; + } + + if ( (*target == XA_LIST_LENGTH(d)) || (*target == XA_LENGTH(d)) ) { + long * temp; + + temp = (long *) XtMalloc( (unsigned) sizeof(long) ); + if (*target == XA_LIST_LENGTH(d)) + *temp = 1L; + else /* *target == XA_LENGTH(d) */ + *temp = (long) (s->right - s->left); + + *value = (XPointer) temp; + *type = XA_INTEGER; + *length = 1L; + *format = 32; + return True; + } + + if (*target == XA_CHARACTER_POSITION(d)) { + long * temp; + + temp = (long *) XtMalloc( (unsigned)( 2 * sizeof(long) ) ); + temp[0] = (long) (s->left + 1); + temp[1] = s->right; + *value = (XPointer) temp; + *type = XA_SPAN(d); + *length = 2L; + *format = 32; + return True; + } + + if (*target == XA_DELETE(d)) { + void _XawTextZapSelection(); /* From TextAction.c */ + + if (!salt) + _XawTextZapSelection( ctx, (XEvent *) NULL, TRUE); + *value = NULL; + *type = XA_NULL(d); + *length = 0; + *format = 32; + return True; + } + + if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, + (XPointer *)value, length, format)) + return True; + + /* else */ + return False; +} + +/* Function Name: GetCutBuffferNumber + * Description: Returns the number of the cut buffer. + * Arguments: atom - the atom to check. + * Returns: the number of the cut buffer representing this atom or + * NOT_A_CUT_BUFFER. + */ + +#define NOT_A_CUT_BUFFER -1 + +static int +GetCutBufferNumber(atom) +Atom atom; +{ + if (atom == XA_CUT_BUFFER0) return(0); + if (atom == XA_CUT_BUFFER1) return(1); + if (atom == XA_CUT_BUFFER2) return(2); + if (atom == XA_CUT_BUFFER3) return(3); + if (atom == XA_CUT_BUFFER4) return(4); + if (atom == XA_CUT_BUFFER5) return(5); + if (atom == XA_CUT_BUFFER6) return(6); + if (atom == XA_CUT_BUFFER7) return(7); + return(NOT_A_CUT_BUFFER); +} + +static void +LoseSelection(w, selection) +Widget w; +Atom *selection; +{ + TextWidget ctx = (TextWidget) w; + Atom* atomP; + int i; + XawTextSelectionSalt *salt, *prevSalt, *nextSalt; + + _XawTextPrepareToUpdate(ctx); + + atomP = ctx->text.s.selections; + for (i = 0 ; i < ctx->text.s.atom_count; i++, atomP++) + if ( (*selection == *atomP) || + (GetCutBufferNumber(*atomP) != NOT_A_CUT_BUFFER) )/* is a cut buffer */ + *atomP = (Atom)0; + + while (ctx->text.s.atom_count && + ctx->text.s.selections[ctx->text.s.atom_count-1] == 0) + ctx->text.s.atom_count--; + +/* + * Must walk the selection list in opposite order from UnsetSelection. + */ + + atomP = ctx->text.s.selections; + for (i = 0 ; i < ctx->text.s.atom_count; i++, atomP++) + if (*atomP == (Atom)0) { + *atomP = ctx->text.s.selections[--ctx->text.s.atom_count]; + while (ctx->text.s.atom_count && + ctx->text.s.selections[ctx->text.s.atom_count-1] == 0) + ctx->text.s.atom_count--; + } + + if (ctx->text.s.atom_count == 0) + ModifySelection(ctx, ctx->text.insertPos, ctx->text.insertPos); + + if (ctx->text.old_insert >= 0) /* Update in progress. */ + _XawTextExecuteUpdate(ctx); + + prevSalt = 0; + for (salt = ctx->text.salt; salt; salt = nextSalt) + { + atomP = salt->s.selections; + nextSalt = salt->next; + for (i = 0 ; i < salt->s.atom_count; i++, atomP++) + if (*selection == *atomP) + *atomP = (Atom)0; + + while (salt->s.atom_count && + salt->s.selections[salt->s.atom_count-1] == 0) + { + salt->s.atom_count--; + } + + /* + * Must walk the selection list in opposite order from UnsetSelection. + */ + + atomP = salt->s.selections; + for (i = 0 ; i < salt->s.atom_count; i++, atomP++) + if (*atomP == (Atom)0) + { + *atomP = salt->s.selections[--salt->s.atom_count]; + while (salt->s.atom_count && + salt->s.selections[salt->s.atom_count-1] == 0) + salt->s.atom_count--; + } + if (salt->s.atom_count == 0) + { + XtFree ((char *) salt->s.selections); + XtFree (salt->contents); + if (prevSalt) + prevSalt->next = nextSalt; + else + ctx->text.salt = nextSalt; + XtFree ((char *) salt); + } + else + prevSalt = salt; + } +} + +void +_XawTextSaltAwaySelection (ctx, selections, num_atoms) +TextWidget ctx; +Atom* selections; +int num_atoms; +{ + XawTextSelectionSalt *salt; + int i, j; + + for (i = 0; i < num_atoms; i++) + LoseSelection ((Widget) ctx, selections + i); + if (num_atoms == 0) + return; + salt = (XawTextSelectionSalt *) + XtMalloc( (unsigned) sizeof(XawTextSelectionSalt) ); + if (!salt) + return; + salt->s.selections = (Atom *) + XtMalloc( (unsigned) ( num_atoms * sizeof (Atom) ) ); + if (!salt->s.selections) + { + XtFree ((char *) salt); + return; + } + salt->s.left = ctx->text.s.left; + salt->s.right = ctx->text.s.right; + salt->s.type = ctx->text.s.type; + salt->contents = _XawTextGetSTRING(ctx, ctx->text.s.left, ctx->text.s.right); + if (_XawTextFormat(ctx) == XawFmtWide) { + XTextProperty textprop; + if (XwcTextListToTextProperty(XtDisplay((Widget)ctx), + (wchar_t**)(&(salt->contents)), 1, XCompoundTextStyle, + &textprop) < Success) { + XtFree(salt->contents); + salt->length = 0; + return; + } + XtFree(salt->contents); + salt->contents = (char *)textprop.value; + salt->length = textprop.nitems; + } else + salt->length = strlen (salt->contents); + salt->next = ctx->text.salt; + ctx->text.salt = salt; + j = 0; + for (i = 0; i < num_atoms; i++) + { + if (GetCutBufferNumber (selections[i]) == NOT_A_CUT_BUFFER) + { + salt->s.selections[j++] = selections[i]; + XtOwnSelection ((Widget) ctx, selections[i], ctx->text.time, + ConvertSelection, LoseSelection, (XtSelectionDoneProc)NULL); + } + } + salt->s.atom_count = j; +} + +static void +_SetSelection(ctx, left, right, selections, count) +TextWidget ctx; +XawTextPosition left, right; +Atom *selections; +Cardinal count; +{ + XawTextPosition pos; + + if (left < ctx->text.s.left) { + pos = Min(right, ctx->text.s.left); + _XawTextNeedsUpdating(ctx, left, pos); + } + if (left > ctx->text.s.left) { + pos = Min(left, ctx->text.s.right); + _XawTextNeedsUpdating(ctx, ctx->text.s.left, pos); + } + if (right < ctx->text.s.right) { + pos = Max(right, ctx->text.s.left); + _XawTextNeedsUpdating(ctx, pos, ctx->text.s.right); + } + if (right > ctx->text.s.right) { + pos = Max(left, ctx->text.s.right); + _XawTextNeedsUpdating(ctx, pos, right); + } + + ctx->text.s.left = left; + ctx->text.s.right = right; + + SrcSetSelection(ctx->text.source, left, right, + (count == 0) ? None : selections[0]); + + if (left < right) { + Widget w = (Widget) ctx; + int buffer; + + while (count) { + Atom selection = selections[--count]; + + if ((buffer = GetCutBufferNumber(selection)) != NOT_A_CUT_BUFFER) { + + unsigned char *ptr, *tptr; + unsigned int amount, max_len = MAX_CUT_LEN(XtDisplay(w)); + unsigned long len; + + tptr= ptr= (unsigned char *) _XawTextGetSTRING(ctx, ctx->text.s.left, + ctx->text.s.right); + if (_XawTextFormat(ctx) == XawFmtWide) { + /* + * Only XA_STRING(Latin 1) is allowed in CUT_BUFFER, + * so we get it from wchar string, then free the wchar string. + */ + XTextProperty textprop; + if (XwcTextListToTextProperty(XtDisplay(w), (wchar_t**)&ptr, 1, + XStringStyle, &textprop) < Success) { + XtFree((char *)ptr); + return; + } + XtFree((char *)ptr); + tptr = ptr = textprop.value; + } + if (buffer == 0) { + _CreateCutBuffers(XtDisplay(w)); + XRotateBuffers(XtDisplay(w), 1); + } + amount = Min ( (len = strlen((char *)ptr)), max_len); + XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), selection, + XA_STRING, 8, PropModeReplace, ptr, amount); + + while (len > max_len) { + len -= max_len; + tptr += max_len; + amount = Min (len, max_len); + XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), + selection, XA_STRING, 8, PropModeAppend, + tptr, amount); + } + XtFree ((char *)ptr); + } + else /* This is a real selection */ + XtOwnSelection(w, selection, ctx->text.time, ConvertSelection, + LoseSelection, (XtSelectionDoneProc)NULL); + } + } + else + XawTextUnsetSelection((Widget)ctx); +} + +/* + * This internal routine deletes the text from pos1 to pos2 in a source and + * then inserts, at pos1, the text that was passed. As a side effect it + * "invalidates" that portion of the displayed text (if any). + * + * NOTE: It is illegal to call this routine unless there is a valid line table! + */ + +int +_XawTextReplace (ctx, pos1, pos2, text) +TextWidget ctx; +XawTextPosition pos1, pos2; +XawTextBlock *text; +{ + int i, line1, delta, error; + XawTextPosition updateFrom, updateTo; + Widget src = ctx->text.source; + XawTextEditType edit_mode; + Arg args[1]; + Boolean tmp = ctx->text.update_disabled; + + ctx->text.update_disabled = True; /* No redisplay during replacement. */ + +/* + * The insertPos may not always be set to the right spot in XawtextAppend + */ + + XtSetArg(args[0], XtNeditType, &edit_mode); + XtGetValues(src, args, ONE); + + if ((pos1 == ctx->text.insertPos) && (edit_mode == XawtextAppend)) { + ctx->text.insertPos = ctx->text.lastPos; + pos2 = SrcScan(src, ctx->text.insertPos, XawstPositions, XawsdRight, + (int)(ctx->text.insertPos - pos1), (Boolean)TRUE); + pos1 = ctx->text.insertPos; + if ( (pos1 == pos2) && (text->length == 0) ) { + ctx->text.update_disabled = FALSE; /* rearm redisplay. */ + return( XawEditError ); + } + } + + updateFrom = SrcScan(src, pos1, XawstWhiteSpace, XawsdLeft, 1, FALSE); + updateFrom = Max(updateFrom, ctx->text.lt.top); + + line1 = LineForPosition(ctx, updateFrom); + if ( (error = SrcReplace(src, pos1, pos2, text)) != 0) { + ctx->text.update_disabled = tmp; /* restore redisplay */ + return(error); + } + + XawTextUnsetSelection((Widget)ctx); + + ctx->text.lastPos = GETLASTPOS; + if (ctx->text.lt.top >= ctx->text.lastPos) { + _XawTextBuildLineTable(ctx, ctx->text.lastPos, FALSE); + ClearWindow( (Widget) ctx); + ctx->text.update_disabled = tmp; /* restore redisplay */ + return(0); /* Things are fine. */ + } + + ctx->text.single_char = (text->length <= 1 && pos2 - pos1 <= 1); + + delta = text->length - (pos2 - pos1); + + if (delta < ctx->text.lastPos) { + for (pos2 += delta, i = 0; i < ctx->text.numranges; i++) { + if (ctx->text.updateFrom[i] > pos1) + ctx->text.updateFrom[i] += delta; + if (ctx->text.updateTo[i] >= pos1) + ctx->text.updateTo[i] += delta; + } + } + + /* + * fixup all current line table entries to reflect edit. + * %%% it is not legal to do arithmetic on positions. + * using Scan would be more proper. + */ + if (delta != 0) { + XawTextLineTableEntry *lineP; + i = LineForPosition(ctx, pos1) + 1; + for (lineP = ctx->text.lt.info + i; i <= ctx->text.lt.lines; i++, lineP++) + lineP->position += delta; + } + + /* + * Now process the line table and fixup in case edits caused + * changes in line breaks. If we are breaking on word boundaries, + * this code checks for moving words to and from lines. + */ + + if (IsPositionVisible(ctx, updateFrom)) { + updateTo = _BuildLineTable(ctx, + ctx->text.lt.info[line1].position, pos1, line1); + _XawTextNeedsUpdating(ctx, updateFrom, updateTo); + } + + ctx->text.update_disabled = tmp; /* restore redisplay */ + return(0); /* Things are fine. */ +} + +/* + * This routine will display text between two arbitrary source positions. + * In the event that this span contains highlighted text for the selection, + * only that portion will be displayed highlighted. + * + * NOTE: it is illegal to call this routine unless there + * is a valid line table! + */ + +static void +DisplayText(w, pos1, pos2) +Widget w; +XawTextPosition pos1, pos2; +{ + TextWidget ctx = (TextWidget)w; + Position x, y; + int height, line, i, lastPos = ctx->text.lastPos; + XawTextPosition startPos, endPos; + Boolean clear_eol, done_painting; + + pos1 = (pos1 < ctx->text.lt.top) ? ctx->text.lt.top : pos1; + pos2 = FindGoodPosition(ctx, pos2); + if ( (pos1 >= pos2) || !LineAndXYForPosition(ctx, pos1, &line, &x, &y) ) + return; /* line not visible, or pos1 >= pos2. */ + + for ( startPos = pos1, i = line; IsValidLine(ctx, i) && + (i < ctx->text.lt.lines) ; i++) { + + + if ( (endPos = ctx->text.lt.info[i + 1].position) > pos2 ) { + clear_eol = ((endPos = pos2) >= lastPos); + done_painting = (!clear_eol || ctx->text.single_char); + } + else { + clear_eol = TRUE; + done_painting = FALSE; + } + + height = ctx->text.lt.info[i + 1].y - ctx->text.lt.info[i].y; + + if ( (endPos > startPos) ) { + if ( (x == (Position) ctx->text.margin.left) && (x > 0) ) + SinkClearToBG (ctx->text.sink, + (Position) 0, y, + (Dimension) ctx->text.margin.left, (Dimension)height); + + if ( (startPos >= ctx->text.s.right) || (endPos <= ctx->text.s.left) ) + XawTextSinkDisplayText(ctx->text.sink, x, y, startPos, endPos, FALSE); + else if ((startPos >= ctx->text.s.left) && (endPos <= ctx->text.s.right)) + XawTextSinkDisplayText(ctx->text.sink, x, y, startPos, endPos, TRUE); + else { + DisplayText(w, startPos, ctx->text.s.left); + DisplayText(w, Max(startPos, ctx->text.s.left), + Min(endPos, ctx->text.s.right)); + DisplayText(w, ctx->text.s.right, endPos); + } + } + startPos = endPos; + if (clear_eol) { + SinkClearToBG(ctx->text.sink, + (Position) (ctx->text.lt.info[i].textWidth + + ctx->text.margin.left), + (Position) y, w->core.width, (Dimension) height); + + /* + * We only get here if single character is true, and we need + * to clear to the end of the screen. We know that since there + * was only one character deleted that this is the same + * as clearing an extra line, so we do this, and are done. + * + * This a performance hack, and a pretty gross one, but it works. + * + * Chris Peterson 11/13/89. + */ + + if (done_painting) { + y += height; + SinkClearToBG(ctx->text.sink, + (Position) ctx->text.margin.left, (Position) y, + w->core.width, (Dimension) height); + + break; /* set single_char to FALSE and return. */ + } + } + + x = (Position) ctx->text.margin.left; + y = ctx->text.lt.info[i + 1].y; + if ( done_painting + || (y >= (int)(ctx->core.height - ctx->text.margin.bottom)) ) + break; + } + ctx->text.single_char = FALSE; +} + +/* + * This routine implements multi-click selection in a hardwired manner. + * It supports multi-click entity cycling (char, word, line, file) and mouse + * motion adjustment of the selected entitie (i.e. select a word then, with + * button still down, adjust wich word you really meant by moving the mouse). + * [NOTE: This routine is to be replaced by a set of procedures that + * will allows clients to implements a wide class of draw through and + * multi-click selection user interfaces.] + */ + +static void +DoSelection (ctx, pos, time, motion) +TextWidget ctx; +XawTextPosition pos; +Time time; +Boolean motion; +{ + XawTextPosition newLeft, newRight; + XawTextSelectType newType, *sarray; + Widget src = ctx->text.source; + + if (motion) + newType = ctx->text.s.type; + else { + if ( (abs((long) time - (long) ctx->text.lasttime) < MULTI_CLICK_TIME) && + ((pos >= ctx->text.s.left) && (pos <= ctx->text.s.right))) { + sarray = ctx->text.sarray; + for (;*sarray != XawselectNull && *sarray != ctx->text.s.type; sarray++); + + if (*sarray == XawselectNull) + newType = *(ctx->text.sarray); + else { + newType = *(sarray + 1); + if (newType == XawselectNull) + newType = *(ctx->text.sarray); + } + } + else /* single-click event */ + newType = *(ctx->text.sarray); + + ctx->text.lasttime = time; + } + switch (newType) { + case XawselectPosition: + newLeft = newRight = pos; + break; + case XawselectChar: + newLeft = pos; + newRight = SrcScan(src, pos, XawstPositions, XawsdRight, 1, FALSE); + break; + case XawselectWord: + case XawselectParagraph: + { + XawTextScanType stype; + + if (newType == XawselectWord) + stype = XawstWhiteSpace; + else + stype = XawstParagraph; + + /* + * Somewhat complicated, but basically I treat the space between + * two objects as another object. The object that I am currently + * in then becomes the end of the selection. + * + * Chris Peterson - 4/19/90. + */ + + newRight = SrcScan(ctx->text.source, pos, stype, XawsdRight, 1, FALSE); + newRight =SrcScan(ctx->text.source, newRight,stype,XawsdLeft,1, FALSE); + + if (pos != newRight) + newLeft = SrcScan(ctx->text.source, pos, stype, XawsdLeft, 1, FALSE); + else + newLeft = pos; + + newLeft =SrcScan(ctx->text.source, newLeft, stype, XawsdRight,1,FALSE); + + if (newLeft > newRight) { + XawTextPosition temp = newLeft; + newLeft = newRight; + newRight = temp; + } + } + break; + case XawselectLine: + newLeft = SrcScan(src, pos, XawstEOL, XawsdLeft, 1, FALSE); + newRight = SrcScan(src, pos, XawstEOL, XawsdRight, 1, FALSE); + break; + case XawselectAll: + newLeft = SrcScan(src, pos, XawstAll, XawsdLeft, 1, FALSE); + newRight = SrcScan(src, pos, XawstAll, XawsdRight, 1, FALSE); + break; + default: + XtAppWarning(XtWidgetToApplicationContext((Widget) ctx), + "Text Widget: empty selection array."); + return; + } + + if ( (newLeft != ctx->text.s.left) || (newRight != ctx->text.s.right) + || (newType != ctx->text.s.type)) { + ModifySelection(ctx, newLeft, newRight); + if (pos - ctx->text.s.left < ctx->text.s.right - pos) + ctx->text.insertPos = newLeft; + else + ctx->text.insertPos = newRight; + ctx->text.s.type = newType; + } + if (!motion) { /* setup so we can freely mix select extend calls*/ + ctx->text.origSel.type = ctx->text.s.type; + ctx->text.origSel.left = ctx->text.s.left; + ctx->text.origSel.right = ctx->text.s.right; + + if (pos >= ctx->text.s.left + ((ctx->text.s.right - ctx->text.s.left) / 2)) + ctx->text.extendDir = XawsdRight; + else + ctx->text.extendDir = XawsdLeft; + } +} + +/* + * This routine implements extension of the currently selected text in + * the "current" mode (i.e. char word, line, etc.). It worries about + * extending from either end of the selection and handles the case when you + * cross through the "center" of the current selection (e.g. switch which + * end you are extending!). + */ + +static void +ExtendSelection (ctx, pos, motion) +TextWidget ctx; +XawTextPosition pos; +Boolean motion; +{ + XawTextScanDirection dir; + + if (!motion) { /* setup for extending selection */ + if (ctx->text.s.left == ctx->text.s.right) /* no current selection. */ + ctx->text.s.left = ctx->text.s.right = ctx->text.insertPos; + else { + ctx->text.origSel.left = ctx->text.s.left; + ctx->text.origSel.right = ctx->text.s.right; + } + + ctx->text.origSel.type = ctx->text.s.type; + + if (pos >= ctx->text.s.left + ((ctx->text.s.right - ctx->text.s.left) / 2)) + ctx->text.extendDir = XawsdRight; + else + ctx->text.extendDir = XawsdLeft; + } + else /* check for change in extend direction */ + if ((ctx->text.extendDir == XawsdRight && pos <= ctx->text.origSel.left) || + (ctx->text.extendDir == XawsdLeft && pos >= ctx->text.origSel.right)) { + ctx->text.extendDir = (ctx->text.extendDir == XawsdRight) ? + XawsdLeft : XawsdRight; + ModifySelection(ctx, ctx->text.origSel.left, ctx->text.origSel.right); + } + + dir = ctx->text.extendDir; + switch (ctx->text.s.type) { + case XawselectWord: + case XawselectParagraph: + { + XawTextPosition left_pos, right_pos; + XawTextScanType stype; + + if (ctx->text.s.type == XawselectWord) + stype = XawstWhiteSpace; + else + stype = XawstParagraph; + + /* + * Somewhat complicated, but basically I treat the space between + * two objects as another object. The object that I am currently + * in then becomes the end of the selection. + * + * Chris Peterson - 4/19/90. + */ + + right_pos = SrcScan(ctx->text.source, pos, stype, XawsdRight, 1, FALSE); + right_pos =SrcScan(ctx->text.source, right_pos,stype,XawsdLeft,1, FALSE); + + if (pos != right_pos) + left_pos = SrcScan(ctx->text.source, pos, stype, XawsdLeft, 1, FALSE); + else + left_pos = pos; + + left_pos =SrcScan(ctx->text.source, left_pos, stype, XawsdRight,1,FALSE); + + if (dir == XawsdLeft) + pos = Min(left_pos, right_pos); + else /* dir == XawsdRight */ + pos = Max(left_pos, right_pos); + } + break; + case XawselectLine: + pos = SrcScan(ctx->text.source, pos, XawstEOL, dir, 1, dir == XawsdRight); + break; + case XawselectAll: + pos = ctx->text.insertPos; + case XawselectPosition: /* fall through. */ + default: + break; + } + + if (dir == XawsdRight) + ModifySelection(ctx, ctx->text.s.left, pos); + else + ModifySelection(ctx, pos, ctx->text.s.right); + + ctx->text.insertPos = pos; +} + +/* + * Clear the window to background color. + */ + +static void +ClearWindow (w) +Widget w; +{ + TextWidget ctx = (TextWidget) w; + + if (XtIsRealized(w)) + SinkClearToBG(ctx->text.sink, + (Position) 0, (Position) 0, + w->core.width, w->core.height); +} + +/* Function Name: _XawTextClearAndCenterDisplay + * Description: Redraws the display with the cursor in insert point + * centered vertically. + * Arguments: ctx - the text widget. + * Returns: none. + */ + +void +_XawTextClearAndCenterDisplay(ctx) +TextWidget ctx; +{ + int insert_line = LineForPosition(ctx, ctx->text.insertPos); + int scroll_by = insert_line - ctx->text.lt.lines/2; + + _XawTextVScroll(ctx, scroll_by); + DisplayTextWindow( (Widget) ctx); +} + +/* + * Internal redisplay entire window. + * Legal to call only if widget is realized. + */ + +static void +DisplayTextWindow (w) +Widget w; +{ + TextWidget ctx = (TextWidget) w; + ClearWindow(w); + _XawTextBuildLineTable(ctx, ctx->text.lt.top, FALSE); + _XawTextNeedsUpdating(ctx, zeroPosition, ctx->text.lastPos); + _XawTextSetScrollBars(ctx); +} + +/* + * This routine checks to see if the window should be resized (grown or + * shrunk) when text to be painted overflows to the right or + * the bottom of the window. It is used by the keyboard input routine. + */ + +void +_XawTextCheckResize(ctx) +TextWidget ctx; +{ + Widget w = (Widget) ctx; + int line = 0, old_height; + XtWidgetGeometry rbox, return_geom; + + if ( (ctx->text.resize == XawtextResizeWidth) || + (ctx->text.resize == XawtextResizeBoth) ) { + XawTextLineTableEntry *lt; + rbox.width = 0; + for (lt = ctx->text.lt.info; + IsValidLine(ctx, line) && (line < ctx->text.lt.lines); + line++, lt++) { + if ((int)(lt->textWidth + ctx->text.margin.left) > (int)rbox.width) + rbox.width = lt->textWidth + ctx->text.margin.left; + } + + rbox.width += ctx->text.margin.right; + if (rbox.width > ctx->core.width) { /* Only get wider. */ + rbox.request_mode = CWWidth; + if (XtMakeGeometryRequest(w, &rbox, &return_geom) == XtGeometryAlmost) + (void) XtMakeGeometryRequest(w, &return_geom, (XtWidgetGeometry*) NULL); + } + } + + if ( !((ctx->text.resize == XawtextResizeHeight) || + (ctx->text.resize == XawtextResizeBoth)) ) + return; + + if (IsPositionVisible(ctx, ctx->text.lastPos)) + line = LineForPosition(ctx, ctx->text.lastPos); + else + line = ctx->text.lt.lines; + + if ( (line + 1) == ctx->text.lt.lines ) return; + + old_height = ctx->core.height; + rbox.request_mode = CWHeight; + rbox.height = XawTextSinkMaxHeight(ctx->text.sink, line + 1) + VMargins(ctx); + + if ((int)rbox.height < old_height) return; /* It will only get taller. */ + + if (XtMakeGeometryRequest(w, &rbox, &return_geom) == XtGeometryAlmost) + if (XtMakeGeometryRequest(w, &return_geom, (XtWidgetGeometry*)NULL) != XtGeometryYes) + return; + + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); +} + +/* + * Converts (params, num_params) to a list of atoms & caches the + * list in the TextWidget instance. + */ + +Atom* +_XawTextSelectionList(ctx, list, nelems) +TextWidget ctx; +String *list; +Cardinal nelems; +{ + Atom * sel = ctx->text.s.selections; + Display *dpy = XtDisplay((Widget) ctx); + int n; + + if (nelems > ctx->text.s.array_size) { + sel = (Atom *) XtRealloc((char *) sel, sizeof(Atom) * nelems); + ctx->text.s.array_size = nelems; + ctx->text.s.selections = sel; + } + for (n=nelems; --n >= 0; sel++, list++) + *sel = XInternAtom(dpy, *list, False); + + ctx->text.s.atom_count = nelems; + return ctx->text.s.selections; +} + +/* Function Name: SetSelection + * Description: Sets the current selection. + * Arguments: ctx - the text widget. + * defaultSel - the default selection. + * l, r - the left and right ends of the selection. + * list, nelems - the selection list (as strings). + * Returns: none. + * + * NOTE: if (ctx->text.s.left >= ctx->text.s.right) then the selection + * is unset. + */ + +void +_XawTextSetSelection(ctx, l, r, list, nelems) +TextWidget ctx; +XawTextPosition l, r; +String *list; +Cardinal nelems; +{ + if (nelems == 1 && !strcmp (list[0], "none")) + return; + if (nelems == 0) { + String defaultSel = "PRIMARY"; + list = &defaultSel; + nelems = 1; + } + _SetSelection(ctx, l, r, _XawTextSelectionList(ctx, list, nelems), nelems); +} + + +/* Function Name: ModifySelection + * Description: Modifies the current selection. + * Arguments: ctx - the text widget. + * left, right - the left and right ends of the selection. + * Returns: none. + * + * NOTE: if (ctx->text.s.left >= ctx->text.s.right) then the selection + * is unset. + */ + +static void +ModifySelection(ctx, left, right) +TextWidget ctx; +XawTextPosition left, right; +{ + if (left == right) + ctx->text.insertPos = left; + _SetSelection( ctx, left, right, (Atom*) NULL, ZERO ); +} + +/* + * This routine is used to perform various selection functions. The goal is + * to be able to specify all the more popular forms of draw-through and + * multi-click selection user interfaces from the outside. + */ + +void +_XawTextAlterSelection (ctx, mode, action, params, num_params) +TextWidget ctx; +XawTextSelectionMode mode; /* {XawsmTextSelect, XawsmTextExtend} */ +XawTextSelectionAction action; /* {XawactionStart, + XawactionAdjust, XawactionEnd} */ +String *params; +Cardinal *num_params; +{ + XawTextPosition position; + Boolean flag; + +/* + * This flag is used by TextPop.c:DoReplace() to determine if the selection + * is okay to use, or if it has been modified. + */ + + if (ctx->text.search != NULL) + ctx->text.search->selection_changed = TRUE; + + position = PositionForXY (ctx, (int) ctx->text.ev_x, (int) ctx->text.ev_y); + + flag = (action != XawactionStart); + if (mode == XawsmTextSelect) + DoSelection (ctx, position, ctx->text.time, flag); + else /* mode == XawsmTextExtend */ + ExtendSelection (ctx, position, flag); + + if (action == XawactionEnd) + _XawTextSetSelection(ctx, ctx->text.s.left, ctx->text.s.right, + params, *num_params); +} + +/* Function Name: RectanglesOverlap + * Description: Returns TRUE if two rectangles overlap. + * Arguments: rect1, rect2 - the two rectangles to check. + * Returns: TRUE iff these rectangles overlap. + */ + +static Boolean +RectanglesOverlap(rect1, rect2) +XRectangle *rect1, *rect2; +{ + return ( (rect1->x < rect2->x + (short) rect2->width) && + (rect2->x < rect1->x + (short) rect1->width) && + (rect1->y < rect2->y + (short) rect2->height) && + (rect2->y < rect1->y + (short) rect1->height) ); +} + +/* Function Name: UpdateTextInRectangle. + * Description: Updates the text in a rectangle. + * Arguments: ctx - the text widget. + * rect - the rectangle to update. + * Returns: none. + */ + +static void +UpdateTextInRectangle(ctx, rect) +TextWidget ctx; +XRectangle * rect; +{ + XawTextLineTableEntry *info = ctx->text.lt.info; + int line, x = rect->x, y = rect->y; + int right = rect->width + x, bottom = rect->height + y; + + for (line = 0;( (line < ctx->text.lt.lines) && + IsValidLine(ctx, line) && (info->y < bottom)); line++, info++) + if ( (info + 1)->y >= y ) + UpdateTextInLine(ctx, line, x, right); +} + +/* + * This routine processes all "expose region" XEvents. In general, its job + * is to the best job at minimal re-paint of the text, displayed in the + * window, that it can. + */ + +/* ARGSUSED */ +static void +ProcessExposeRegion(w, event, region) +Widget w; +XEvent *event; +Region region; /* Unused. */ +{ + TextWidget ctx = (TextWidget) w; + XRectangle expose, cursor; + Boolean need_to_draw; + + if (event->type == Expose) { + expose.x = event->xexpose.x; + expose.y = event->xexpose.y; + expose.width = event->xexpose.width; + expose.height = event->xexpose.height; + } + else if (event->type == GraphicsExpose) { + expose.x = event->xgraphicsexpose.x; + expose.y = event->xgraphicsexpose.y; + expose.width = event->xgraphicsexpose.width; + expose.height = event->xgraphicsexpose.height; + } + else { /* No Expose */ + PopCopyQueue(ctx); + return; /* no more processing necessary. */ + } + + need_to_draw = TranslateExposeRegion(ctx, &expose); + if ((event->type == GraphicsExpose) && (event->xgraphicsexpose.count == 0)) + PopCopyQueue(ctx); + + if (!need_to_draw) + return; /* don't draw if we don't need to. */ + + _XawTextPrepareToUpdate(ctx); + UpdateTextInRectangle(ctx, &expose); + XawTextSinkGetCursorBounds(ctx->text.sink, &cursor); + if (RectanglesOverlap(&cursor, &expose)) { + SinkClearToBG(ctx->text.sink, (Position) cursor.x, (Position) cursor.y, + (Dimension) cursor.width, (Dimension) cursor.height); + UpdateTextInRectangle(ctx, &cursor); + } + _XawTextExecuteUpdate(ctx); +} + +/* + * This routine does all setup required to syncronize batched screen updates + */ + +void +_XawTextPrepareToUpdate(ctx) +TextWidget ctx; +{ + if (ctx->text.old_insert < 0) { + InsertCursor((Widget)ctx, XawisOff); + ctx->text.numranges = 0; + ctx->text.showposition = FALSE; + ctx->text.old_insert = ctx->text.insertPos; + } +} + +/* + * This is a private utility routine used by _XawTextExecuteUpdate. It + * processes all the outstanding update requests and merges update + * ranges where possible. + */ + +static +void FlushUpdate(ctx) +TextWidget ctx; +{ + int i, w; + XawTextPosition updateFrom, updateTo; + if (!XtIsRealized((Widget)ctx)) { + ctx->text.numranges = 0; + return; + } + while (ctx->text.numranges > 0) { + updateFrom = ctx->text.updateFrom[0]; + w = 0; + for (i = 1 ; i < ctx->text.numranges ; i++) { + if (ctx->text.updateFrom[i] < updateFrom) { + updateFrom = ctx->text.updateFrom[i]; + w = i; + } + } + updateTo = ctx->text.updateTo[w]; + ctx->text.numranges--; + ctx->text.updateFrom[w] = ctx->text.updateFrom[ctx->text.numranges]; + ctx->text.updateTo[w] = ctx->text.updateTo[ctx->text.numranges]; + for (i = ctx->text.numranges - 1 ; i >= 0 ; i--) { + while (ctx->text.updateFrom[i] <= updateTo && i < ctx->text.numranges) { + updateTo = ctx->text.updateTo[i]; + ctx->text.numranges--; + ctx->text.updateFrom[i] = ctx->text.updateFrom[ctx->text.numranges]; + ctx->text.updateTo[i] = ctx->text.updateTo[ctx->text.numranges]; + } + } + DisplayText((Widget)ctx, updateFrom, updateTo); + } +} + +/* + * This is a private utility routine used by _XawTextExecuteUpdate. This + * routine worries about edits causing new data or the insertion point becoming + * invisible (off the screen, or under the horiz. scrollbar). Currently + * it always makes it visible by scrolling. It probably needs + * generalization to allow more options. + */ + +void +_XawTextShowPosition(ctx) +TextWidget ctx; +{ + int x, y, lines, number; + Boolean no_scroll; + XawTextPosition max_pos, top, first; + + if ( (!XtIsRealized((Widget)ctx)) || (ctx->text.lt.lines <= 0) ) + return; + +/* + * Find out the bottom the visable window, and make sure that the + * cursor does not go past the end of this space. + * + * This makes sure that the cursor does not go past the end of the + * visable window. + */ + + x = ctx->core.width; + y = ctx->core.height - ctx->text.margin.bottom; + if (ctx->text.hbar != NULL) + y -= ctx->text.hbar->core.height + 2 * ctx->text.hbar->core.border_width; + + max_pos = PositionForXY (ctx, x, y); + lines = LineForPosition(ctx, max_pos) + 1; /* number of visable lines. */ + + if ( (ctx->text.insertPos >= ctx->text.lt.top) && + (ctx->text.insertPos < max_pos)) + return; + + first = ctx->text.lt.top; + no_scroll = FALSE; + + if (ctx->text.insertPos < first) { /* We need to scroll down. */ + top = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstEOL, XawsdLeft, 1, FALSE); + + /* count the number of lines we have to scroll */ + + number = 0; + while (first > top) { + first = SrcScan(ctx->text.source, first, + XawstEOL, XawsdLeft, 1, TRUE); + + if ( - number > lines ) + break; + + number--; + } + + if (first <= top) { /* If we found the proper number + of lines. */ + + /* Back up to just before the last CR. */ + + first = SrcScan(ctx->text.source, first, + XawstPositions, XawsdRight, 1, TRUE); + + /* Check to make sure the cursor is visable. */ + + if (first <= top) + number++; + + lines = number; + } + else + no_scroll = TRUE; + } + else { /* We need to Scroll up */ + top = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstEOL, XawsdLeft, lines, FALSE); + + if (top < max_pos) + lines = LineForPosition(ctx, top); + else + no_scroll = TRUE; + } + + if (no_scroll) { + _XawTextBuildLineTable(ctx, top, FALSE); + DisplayTextWindow((Widget)ctx); + } + else + _XawTextVScroll(ctx, lines); + + _XawTextSetScrollBars(ctx); +} + +/* + * This routine causes all batched screen updates to be performed + */ + +void +_XawTextExecuteUpdate(ctx) +TextWidget ctx; +{ + if ( ctx->text.update_disabled || (ctx->text.old_insert < 0) ) + return; + + if((ctx->text.old_insert != ctx->text.insertPos) || (ctx->text.showposition)) + _XawTextShowPosition(ctx); + FlushUpdate(ctx); + InsertCursor((Widget)ctx, XawisOn); + ctx->text.old_insert = -1; +} + + +static void +TextDestroy(w) +Widget w; +{ + TextWidget ctx = (TextWidget)w; + + DestroyHScrollBar(ctx); + DestroyVScrollBar(ctx); + + XtFree((char *)ctx->text.s.selections); + XtFree((char *)ctx->text.lt.info); + XtFree((char *)ctx->text.search); + XtFree((char *)ctx->text.updateFrom); + XtFree((char *)ctx->text.updateTo); +} + +/* + * by the time we are managed (and get this far) we had better + * have both a source and a sink + */ + +static void +Resize(w) +Widget w; +{ + TextWidget ctx = (TextWidget) w; + + PositionVScrollBar(ctx); + PositionHScrollBar(ctx); + + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + _XawTextSetScrollBars(ctx); +} + +/* + * This routine allow the application program to Set attributes. + */ + +/*ARGSUSED*/ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + TextWidget oldtw = (TextWidget) current; + TextWidget newtw = (TextWidget) new; + Boolean redisplay = FALSE; + Boolean display_caret = newtw->text.display_caret; + + + newtw->text.display_caret = oldtw->text.display_caret; + _XawTextPrepareToUpdate(newtw); + newtw->text.display_caret = display_caret; + + if (oldtw->text.r_margin.left != newtw->text.r_margin.left) { + newtw->text.margin.left = newtw->text.r_margin.left; + if (newtw->text.vbar != NULL) + newtw->text.margin.left += newtw->text.vbar->core.width + + newtw->text.vbar->core.border_width; + redisplay = TRUE; + } + + if (oldtw->text.scroll_vert != newtw->text.scroll_vert) { + if (newtw->text.scroll_vert == XawtextScrollNever) + DestroyVScrollBar(newtw); + else if (newtw->text.scroll_vert == XawtextScrollAlways) + CreateVScrollBar(newtw); + redisplay = TRUE; + } + + if (oldtw->text.r_margin.bottom != newtw->text.r_margin.bottom) { + newtw->text.margin.bottom = newtw->text.r_margin.bottom; + if (newtw->text.hbar != NULL) + newtw->text.margin.bottom += newtw->text.hbar->core.height + + newtw->text.hbar->core.border_width; + redisplay = TRUE; + } + + if (oldtw->text.scroll_horiz != newtw->text.scroll_horiz) { + if (newtw->text.scroll_horiz == XawtextScrollNever) + DestroyHScrollBar(newtw); + else if (newtw->text.scroll_horiz == XawtextScrollAlways) + CreateHScrollBar(newtw); + redisplay = TRUE; + } + + if ( oldtw->text.source != newtw->text.source ) + XawTextSetSource( (Widget) newtw, newtw->text.source, newtw->text.lt.top); + + newtw->text.redisplay_needed = False; + XtSetValues( (Widget)newtw->text.source, args, *num_args ); + XtSetValues( (Widget)newtw->text.sink, args, *num_args ); + + if ( oldtw->text.wrap != newtw->text.wrap || + oldtw->text.lt.top != newtw->text.lt.top || + oldtw->text.r_margin.right != newtw->text.r_margin.right || + oldtw->text.r_margin.top != newtw->text.r_margin.top || + oldtw->text.sink != newtw->text.sink || + newtw->text.redisplay_needed ) + { + _XawTextBuildLineTable(newtw, newtw->text.lt.top, TRUE); + redisplay = TRUE; + } + + if (oldtw->text.insertPos != newtw->text.insertPos) { + newtw->text.showposition = TRUE; + redisplay = TRUE; + } + + _XawTextExecuteUpdate(newtw); + if (redisplay) + _XawTextSetScrollBars(newtw); + + return redisplay; +} + +/* invoked by the Simple widget's SetValues */ +static Boolean ChangeSensitive(w) + Widget w; /* the new widget */ +{ + Arg args[1]; + TextWidget tw = (TextWidget) w; + + (*(&simpleClassRec)->simple_class.change_sensitive)(w); + + XtSetArg(args[0], XtNancestorSensitive, + (tw->core.ancestor_sensitive && tw->core.sensitive)); + if (tw->text.vbar) + XtSetValues(tw->text.vbar, args, ONE); + if (tw->text.hbar) + XtSetValues(tw->text.hbar, args, ONE); + return False; +} + +/* Function Name: GetValuesHook + * Description: This is a get values hook routine that gets the + * values in the text source and sink. + * Arguments: w - the Text Widget. + * args - the argument list. + * num_args - the number of args. + * Returns: none. + */ + +static void +GetValuesHook(w, args, num_args) +Widget w; +ArgList args; +Cardinal * num_args; +{ + XtGetValues( ((TextWidget) w)->text.source, args, *num_args ); + XtGetValues( ((TextWidget) w)->text.sink, args, *num_args ); +} + +/* Function Name: FindGoodPosition + * Description: Returns a valid position given any postition + * Arguments: pos - any position. + * Returns: a position between (0 and lastPos); + */ + +static XawTextPosition +FindGoodPosition(ctx, pos) +TextWidget ctx; +XawTextPosition pos; +{ + if (pos < 0) return(0); + return ( ((pos > ctx->text.lastPos) ? ctx->text.lastPos : pos) ); +} + +/************************************************************ + * + * Routines for handling the copy area expose queue. + * + ************************************************************/ + +/* Function Name: PushCopyQueue + * Description: Pushes a value onto the copy queue. + * Arguments: ctx - the text widget. + * h, v - amount of offset in the horiz and vert directions. + * Returns: none + */ + +static void +PushCopyQueue(ctx, h, v) +TextWidget ctx; +int h, v; +{ + struct text_move * offsets = XtNew(struct text_move); + + offsets->h = h; + offsets->v = v; + offsets->next = NULL; + + if (ctx->text.copy_area_offsets == NULL) + ctx->text.copy_area_offsets = offsets; + else { + struct text_move * end = ctx->text.copy_area_offsets; + for ( ; end->next != NULL; end = end->next) {} + end->next = offsets; + } +} + +/* Function Name: PopCopyQueue + * Description: Pops the top value off of the copy queue. + * Arguments: ctx - the text widget. + * Returns: none. + */ + +static void +PopCopyQueue(ctx) +TextWidget ctx; +{ + struct text_move * offsets = ctx->text.copy_area_offsets; + + if (offsets == NULL) + (void) printf( "Xaw Text widget %s: empty copy queue\n", + XtName( (Widget) ctx ) ); + else { + ctx->text.copy_area_offsets = offsets->next; + XtFree((char *) offsets); /* free what you allocate. */ + } +} + +/* Function Name: TranslateExposeRegion + * Description: Translates the expose that came into + * the cordinates that now exist in the Text widget. + * Arguments: ctx - the text widget. + * expose - a Rectangle, who's region currently + * contains the expose event location. + * this region will be returned containing + * the new rectangle. + * Returns: True if there is drawing that needs to be done. + */ + +static Boolean +TranslateExposeRegion(ctx, expose) +TextWidget ctx; +XRectangle * expose; +{ + struct text_move * offsets = ctx->text.copy_area_offsets; + int value; + int x, y, width, height; + + /* + * Skip over the first one, this has already been taken into account. + */ + + if (!offsets || !(offsets = offsets->next)) + return(TRUE); + + x = expose->x; + y = expose->y; + width = expose->width; + height = expose->height; + + while (offsets) { + x += offsets->h; + y += offsets->v; + offsets = offsets->next; + } + + /* + * remove that area of the region that is now outside the window. + */ + + if (y < 0) { + height += y; + y = 0; + } + + value = y + height - ctx->core.height; + if (value > 0) + height -= value; + + if (height <= 0) + return(FALSE); /* no need to draw outside the window. */ + + /* + * and now in the horiz direction... + */ + + if (x < 0) { + width += x; + x = 0; + } + + value = x + width - ctx->core.width; + if (value > 0) + width -= value; + + if (width <= 0) + return(FALSE); /* no need to draw outside the window. */ + + expose->x = x; + expose->y = y; + expose->width = width; + expose->height = height; + return(TRUE); +} + +/* Li wrote this so the IM can find a given text position's screen position. */ + +void +#if NeedFunctionPrototypes +_XawTextPosToXY( + Widget w, + XawTextPosition pos, + Position* x, + Position* y ) +#else +_XawTextPosToXY( w, pos, x, y ) + Widget w; + XawTextPosition pos; + Position *x, *y; +#endif +{ + int line; + LineAndXYForPosition( (TextWidget)w, pos, &line, x, y ); +} + +/******************************************************************* +The following routines provide procedural interfaces to Text window state +setting and getting. They need to be redone so than the args code can use +them. I suggest we create a complete set that takes the context as an +argument and then have the public version lookup the context and call the +internal one. The major value of this set is that they have actual application +clients and therefore the functionality provided is required for any future +version of Text. +********************************************************************/ + +void +#if NeedFunctionPrototypes +XawTextDisplay (Widget w) +#else +XawTextDisplay (w) +Widget w; +#endif +{ + if (!XtIsRealized(w)) return; + + _XawTextPrepareToUpdate( (TextWidget) w); + DisplayTextWindow(w); + _XawTextExecuteUpdate( (TextWidget) w); +} + +void +#if NeedFunctionPrototypes +XawTextSetSelectionArray(Widget w, XawTextSelectType *sarray) +#else +XawTextSetSelectionArray(w, sarray) +Widget w; +XawTextSelectType *sarray; +#endif +{ + ((TextWidget)w)->text.sarray = sarray; +} + +void +#if NeedFunctionPrototypes +XawTextGetSelectionPos(Widget w, XawTextPosition *left, XawTextPosition *right) +#else +XawTextGetSelectionPos(w, left, right) +Widget w; +XawTextPosition* left,* right; +#endif +{ + *left = ((TextWidget) w)->text.s.left; + *right = ((TextWidget) w)->text.s.right; +} + + +void +#if NeedFunctionPrototypes +XawTextSetSource(Widget w, Widget source, XawTextPosition startPos) +#else +XawTextSetSource(w, source, startPos) +Widget w, source; +XawTextPosition startPos; +#endif +{ + TextWidget ctx = (TextWidget) w; + + ctx->text.source = source; + ctx->text.lt.top = startPos; + ctx->text.s.left = ctx->text.s.right = 0; + ctx->text.insertPos = startPos; + ctx->text.lastPos = GETLASTPOS; + + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + XawTextDisplay(w); +} + +/* + * This public routine deletes the text from startPos to endPos in a source and + * then inserts, at startPos, the text that was passed. As a side effect it + * "invalidates" that portion of the displayed text (if any), so that things + * will be repainted properly. + */ + +int +#if NeedFunctionPrototypes +XawTextReplace(Widget w, XawTextPosition startPos, XawTextPosition endPos, + XawTextBlock *text) +#else +XawTextReplace(w, startPos, endPos, text) +Widget w; +XawTextPosition startPos, endPos; +XawTextBlock *text; +#endif +{ + TextWidget ctx = (TextWidget) w; + int result; + + _XawTextPrepareToUpdate(ctx); + endPos = FindGoodPosition(ctx, endPos); + startPos = FindGoodPosition(ctx, startPos); + if ((result = _XawTextReplace(ctx, startPos, endPos, text)) == XawEditDone) { + int delta = text->length - (endPos - startPos); + if (ctx->text.insertPos >= (endPos + delta)) { + XawTextScanDirection sd = (delta < 0) ? XawsdLeft : XawsdRight; + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstPositions, sd, abs(delta), TRUE); + } + } + + _XawTextCheckResize(ctx); + _XawTextExecuteUpdate(ctx); + _XawTextSetScrollBars(ctx); + + return result; +} + +XawTextPosition +#if NeedFunctionPrototypes +XawTextTopPosition(Widget w) +#else +XawTextTopPosition(w) +Widget w; +#endif +{ + return( ((TextWidget) w)->text.lt.top ); +} + +void +#if NeedFunctionPrototypes +XawTextSetInsertionPoint(Widget w, XawTextPosition position) +#else +XawTextSetInsertionPoint(w, position) +Widget w; +XawTextPosition position; +#endif +{ + TextWidget ctx = (TextWidget) w; + + _XawTextPrepareToUpdate(ctx); + ctx->text.insertPos = FindGoodPosition(ctx, position); + ctx->text.showposition = TRUE; + + _XawTextExecuteUpdate(ctx); +} + +XawTextPosition +#if NeedFunctionPrototypes +XawTextGetInsertionPoint(Widget w) +#else +XawTextGetInsertionPoint(w) +Widget w; +#endif +{ + return( ((TextWidget) w)->text.insertPos); +} + +/* + * NOTE: Must walk the selection list in opposite order from LoseSelection. + */ + +void +#if NeedFunctionPrototypes +XawTextUnsetSelection(Widget w) +#else +XawTextUnsetSelection(w) +Widget w; +#endif +{ + TextWidget ctx = (TextWidget)w; + + while (ctx->text.s.atom_count != 0) { + Atom sel = ctx->text.s.selections[ctx->text.s.atom_count - 1]; + if ( sel != (Atom) 0 ) { +/* + * As selections are lost the atom_count will decrement. + */ + if (GetCutBufferNumber(sel) == NOT_A_CUT_BUFFER) + XtDisownSelection(w, sel, ctx->text.time); + LoseSelection(w, &sel); /* In case this is a cut buffer, or + XtDisownSelection failed to call us. */ + } + } +} + +void +#if NeedFunctionPrototypes +XawTextSetSelection (Widget w, XawTextPosition left, XawTextPosition right) +#else +XawTextSetSelection (w, left, right) +Widget w; +XawTextPosition left, right; +#endif +{ + TextWidget ctx = (TextWidget) w; + + _XawTextPrepareToUpdate(ctx); + _XawTextSetSelection(ctx, FindGoodPosition(ctx, left), + FindGoodPosition(ctx, right), (String*)NULL, ZERO); + _XawTextExecuteUpdate(ctx); +} + +void +#if NeedFunctionPrototypes +XawTextInvalidate(Widget w, XawTextPosition from, XawTextPosition to) +#else +XawTextInvalidate(w, from, to) +Widget w; +XawTextPosition from,to; +#endif +{ + TextWidget ctx = (TextWidget) w; + + from = FindGoodPosition(ctx, from); + to = FindGoodPosition(ctx, to); + ctx->text.lastPos = GETLASTPOS; + _XawTextPrepareToUpdate(ctx); + _XawTextNeedsUpdating(ctx, from, to); + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + _XawTextExecuteUpdate(ctx); +} + +/*ARGSUSED*/ +void +#if NeedFunctionPrototypes +XawTextDisableRedisplay(Widget w) +#else +XawTextDisableRedisplay(w) +Widget w; +#endif +{ + ((TextWidget) w)->text.update_disabled = True; + _XawTextPrepareToUpdate( (TextWidget) w); +} + +void +#if NeedFunctionPrototypes +XawTextEnableRedisplay(Widget w) +#else +XawTextEnableRedisplay(w) +Widget w; +#endif +{ + TextWidget ctx = (TextWidget)w; + XawTextPosition lastPos; + + if (!ctx->text.update_disabled) return; + + ctx->text.update_disabled = False; + lastPos = ctx->text.lastPos = GETLASTPOS; + ctx->text.lt.top = FindGoodPosition(ctx, ctx->text.lt.top); + ctx->text.insertPos = FindGoodPosition(ctx, ctx->text.insertPos); + if ( (ctx->text.s.left > lastPos) || (ctx->text.s.right > lastPos) ) + ctx->text.s.left = ctx->text.s.right = 0; + + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + if (XtIsRealized(w)) + DisplayTextWindow(w); + _XawTextExecuteUpdate(ctx); +} + +Widget +#if NeedFunctionPrototypes +XawTextGetSource(Widget w) +#else +XawTextGetSource(w) +Widget w; +#endif +{ + return ((TextWidget)w)->text.source; +} + +void +#if NeedFunctionPrototypes +XawTextDisplayCaret (Widget w, +#if NeedWidePrototypes + /* Boolean */ int display_caret) +#else + Boolean display_caret) +#endif +#else +XawTextDisplayCaret (w, display_caret) +Widget w; +Boolean display_caret; +#endif +{ + TextWidget ctx = (TextWidget) w; + + if (ctx->text.display_caret == display_caret) return; + + if (XtIsRealized(w)) { + _XawTextPrepareToUpdate(ctx); + ctx->text.display_caret = display_caret; + _XawTextExecuteUpdate(ctx); + } + else + ctx->text.display_caret = display_caret; +} + +/* Function Name: XawTextSearch(w, dir, text). + * Description: searches for the given text block. + * Arguments: w - The text widget. + * dir - The direction to search. + * text - The text block containing info about the string + * to search for. + * Returns: The position of the text found, or XawTextSearchError on + * an error. + */ + +XawTextPosition +#if NeedFunctionPrototypes +XawTextSearch(Widget w, +#if NeedWidePrototypes + /* XawTextScanDirection */ int dir, +#else + XawTextScanDirection dir, +#endif + XawTextBlock *text) +#else +XawTextSearch(w, dir, text) +Widget w; +XawTextScanDirection dir; +XawTextBlock * text; +#endif +{ + TextWidget ctx = (TextWidget) w; + + return(SrcSearch(ctx->text.source, ctx->text.insertPos, dir, text)); +} + +TextClassRec textClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "Text", + /* widget_size */ sizeof(TextRec), + /* class_initialize */ ClassInitialize, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ _XawTextActionsTable, + /* num_actions */ 0, /* Set in ClassInitialize. */ + /* resources */ resources, + /* num_ resource */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure*/ XtExposeGraphicsExpose | XtExposeNoExpose, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ TextDestroy, + /* resize */ Resize, + /* expose */ ProcessExposeRegion, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost*/ XtInheritSetValuesAlmost, + /* get_values_hook */ GetValuesHook, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, /* set in ClassInitialize */ + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* Simple fields */ + /* change_sensitive */ ChangeSensitive + }, + { /* text fields */ + /* empty */ 0 + } +}; + +WidgetClass textWidgetClass = (WidgetClass)&textClassRec; diff --git a/vendor/x11iraf/xaw3d/Text.h b/vendor/x11iraf/xaw3d/Text.h new file mode 100644 index 00000000..9157927a --- /dev/null +++ b/vendor/x11iraf/xaw3d/Text.h @@ -0,0 +1,310 @@ +/* $XConsortium: Text.h,v 1.45 94/04/17 20:13:05 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawText_h +#define _XawText_h + +#include <X11/Xaw3d/Simple.h> + +/* + Text widget + + Class: textWidgetClass + Class Name: Text + Superclass: Simple + + Resources added by the Text widget: + + Name Class RepType Default Value + ---- ----- ------- ------------- + autoFill AutoFill Boolean False + bottomMargin Margin Position 2 + displayPosition TextPosition XawTextPosition 0 + insertPosition TextPosition XawTextPosition 0 + leftMargin Margin Position 2 + resize Resize XawTextResizeMode XawTextResizeNever + rightMargin Margin Position 4 + scrollHorizontal Scroll XawTextScrollMode XawtextScrollNever + scrollVertical Scroll XawTextScrollMode XawtextScrollNever + selectTypes SelectTypes Pointer see documentation + textSink TextSink Widget NULL + textSource TextSource Widget NULL + topMargin Margin Position 2 + unrealizeCallback Callback Callback NULL + wrap Wrap XawTextWrapMode XawTextWrapNever + +*/ + +typedef long XawTextPosition; + +typedef enum { XawtextScrollNever, + XawtextScrollWhenNeeded, XawtextScrollAlways} XawTextScrollMode; + +typedef enum { XawtextWrapNever, + XawtextWrapLine, XawtextWrapWord} XawTextWrapMode; + +typedef enum { XawtextResizeNever, XawtextResizeWidth, + XawtextResizeHeight, XawtextResizeBoth} XawTextResizeMode; + +typedef enum {XawsdLeft, XawsdRight} XawTextScanDirection; +typedef enum {XawtextRead, XawtextAppend, XawtextEdit} XawTextEditType; +typedef enum {XawselectNull, XawselectPosition, XawselectChar, XawselectWord, + XawselectLine, XawselectParagraph, XawselectAll} XawTextSelectType; + +typedef struct { + int firstPos; + int length; + char *ptr; + unsigned long format; + } XawTextBlock, *XawTextBlockPtr; + +#include <X11/Xaw3d/TextSink.h> +#include <X11/Xaw3d/TextSrc.h> + +#define XtEtextScrollNever "never" +#define XtEtextScrollWhenNeeded "whenneeded" +#define XtEtextScrollAlways "always" + +#define XtEtextWrapNever "never" +#define XtEtextWrapLine "line" +#define XtEtextWrapWord "word" + +#define XtEtextResizeNever "never" +#define XtEtextResizeWidth "width" +#define XtEtextResizeHeight "height" +#define XtEtextResizeBoth "both" + +#define XtNautoFill "autoFill" +#define XtNbottomMargin "bottomMargin" +#define XtNdialogHOffset "dialogHOffset" +#define XtNdialogVOffset "dialogVOffset" +#define XtNdisplayCaret "displayCaret" +#define XtNdisplayPosition "displayPosition" +#define XtNleftMargin "leftMargin" +#define XtNrightMargin "rightMargin" +#define XtNscrollVertical "scrollVertical" +#define XtNscrollHorizontal "scrollHorizontal" +#define XtNselectTypes "selectTypes" +#define XtNtopMargin "topMargin" +#define XtNwrap "wrap" + +#define XtCAutoFill "AutoFill" +#define XtCScroll "Scroll" +#define XtCSelectTypes "SelectTypes" +#define XtCWrap "Wrap" + +#ifndef _XtStringDefs_h_ +#define XtNinsertPosition "insertPosition" +#define XtNresize "resize" +#define XtNselection "selection" +#define XtCResize "Resize" +#endif + +/* Return Error code for XawTextSearch */ + +#define XawTextSearchError (-12345L) + +/* Return codes from XawTextReplace */ + +#define XawReplaceError -1 +#define XawEditDone 0 +#define XawEditError 1 +#define XawPositionError 2 + +extern unsigned long FMT8BIT; +extern unsigned long XawFmt8Bit; +extern unsigned long XawFmtWide; + +/* Class record constants */ + +extern WidgetClass textWidgetClass; + +typedef struct _TextClassRec *TextWidgetClass; +typedef struct _TextRec *TextWidget; + +_XFUNCPROTOBEGIN + +extern XrmQuark _XawTextFormat( +#if NeedFunctionPrototypes + TextWidget /* tw */ +#endif +); + +extern void XawTextDisplay( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void XawTextEnableRedisplay( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void XawTextDisableRedisplay( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void XawTextSetSelectionArray( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextSelectType* /* sarray */ +#endif +); + +extern void XawTextGetSelectionPos( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition* /* begin_return */, + XawTextPosition* /* end_return */ +#endif +); + +extern void XawTextSetSource( +#if NeedFunctionPrototypes + Widget /* w */, + Widget /* source */, + XawTextPosition /* position */ +#endif +); + +extern int XawTextReplace( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* start */, + XawTextPosition /* end */, + XawTextBlock* /* text */ +#endif +); + +extern XawTextPosition XawTextTopPosition( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void XawTextSetInsertionPoint( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* position */ +#endif +); + +extern XawTextPosition XawTextGetInsertionPoint( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void XawTextUnsetSelection( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void XawTextSetSelection( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* left */, + XawTextPosition /* right */ +#endif +); + +extern void XawTextInvalidate( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* from */, + XawTextPosition /* to */ +#endif +); + +extern Widget XawTextGetSource( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern XawTextPosition XawTextSearch( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* XawTextScanDirection */ int /* dir */, +#else + XawTextScanDirection /* dir */, +#endif + XawTextBlock* /* text */ +#endif +); + +extern void XawTextDisplayCaret( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Boolean */ int /* visible */ +#else + Boolean /* visible */ +#endif +#endif +); + +_XFUNCPROTOEND + +/* + * For R3 compatability only. + */ + +#include <X11/Xaw3d/AsciiSrc.h> +#include <X11/Xaw3d/AsciiSink.h> + +#endif /* _XawText_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/xaw3d/TextAction.c b/vendor/x11iraf/xaw3d/TextAction.c new file mode 100644 index 00000000..930a3cf9 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextAction.c @@ -0,0 +1,2270 @@ +/* $XConsortium: TextAction.c,v 1.53 95/06/14 15:07:27 kaleb Exp $ */ + +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/StdSel.h> /* for XmuConvertStandardSelection */ +#include <X11/Xmu/Atoms.h> /* for XA_COMPOUND_TEXT */ +#include <X11/Xaw3d/TextP.h> +#include <X11/Xaw3d/MultiSrcP.h> +#include <X11/Xaw3d/XawImP.h> +#include <X11/Xfuncs.h> +#include "XawI18n.h" +#include <stdio.h> +#include <ctype.h> + +#define SrcScan XawTextSourceScan +#define FindDist XawTextSinkFindDistance +#define FindPos XawTextSinkFindPosition + +#define XawTextActionMaxHexChars 100 + +/* + * These are defined in TextPop.c + */ + +void _XawTextInsertFileAction(), _XawTextInsertFile(), _XawTextSearch(); +void _XawTextSearch(), _XawTextDoSearchAction(), _XawTextDoReplaceAction(); +void _XawTextSetField(), _XawTextPopdownSearchAction(); + +/* + * These are defined in Text.c + */ + +char * _XawTextGetText(); +void _XawTextAlterSelection(), _XawTextVScroll(); +void _XawTextSetSelection(), _XawTextCheckResize(), _XawTextExecuteUpdate(); +void _XawTextSetScrollBars(), _XawTextClearAndCenterDisplay(); +Atom * _XawTextSelectionList(); +void _XawTextPrepareToUpdate(); +int _XawTextReplace(); + +static void ParameterError(w, param) + Widget w; + String param; +{ + String params[2]; + Cardinal num_params = 2; + params[0] = XtName(w); + params[1] = param; + + XtAppWarningMsg( XtWidgetToApplicationContext(w), + "parameterError", "textAction", "XawError", + "Widget: %s Parameter: %s", + params, &num_params); + XBell( XtDisplay( w ), 50 ); +} + +static void +StartAction(ctx, event) +TextWidget ctx; +XEvent *event; +{ + _XawTextPrepareToUpdate(ctx); + if (event != NULL) { + switch (event->type) { + case ButtonPress: + case ButtonRelease: + ctx->text.time = event->xbutton.time; + break; + case KeyPress: + case KeyRelease: + ctx->text.time = event->xkey.time; + break; + case MotionNotify: + ctx->text.time = event->xmotion.time; + break; + case EnterNotify: + case LeaveNotify: + ctx->text.time = event->xcrossing.time; + } + } +} + +static void +NotePosition(ctx, event) +TextWidget ctx; +XEvent* event; +{ + switch (event->type) { + case ButtonPress: + case ButtonRelease: + ctx->text.ev_x = event->xbutton.x; + ctx->text.ev_y = event->xbutton.y; + break; + case KeyPress: + case KeyRelease: + { + XRectangle cursor; + XawTextSinkGetCursorBounds(ctx->text.sink, &cursor); + ctx->text.ev_x = cursor.x + cursor.width / 2;; + ctx->text.ev_y = cursor.y + cursor.height / 2;; + } + break; + case MotionNotify: + ctx->text.ev_x = event->xmotion.x; + ctx->text.ev_y = event->xmotion.y; + break; + case EnterNotify: + case LeaveNotify: + ctx->text.ev_x = event->xcrossing.x; + ctx->text.ev_y = event->xcrossing.y; + } +} + +static void +EndAction(ctx) +TextWidget ctx; +{ + _XawTextCheckResize(ctx); + _XawTextExecuteUpdate(ctx); + ctx->text.mult = 1; +} + + +struct _SelectionList { + String* params; + Cardinal count; + Time time; + Boolean CT_asked; /* flag if asked XA_COMPOUND_TEXT */ + Atom selection; /* selection atom when asking XA_COMPOUND_TEXT */ +}; + +static int ProbablyMB(s) + char* s; +{ + int escapes = 0; + int has_hi_bit = False; + + /* if it has more than one ESC char, I assume it is COMPOUND_TEXT. + If it has at least one hi bit set character, I pretend it is multibyte. */ + + while ( (wchar_t)(*s) != (wchar_t)0 ) { + if ( *s & 128 ) + has_hi_bit = True; + if ( *s++ == '\033' ) + escapes++; + if ( escapes >= 2 ) + return( 0 ); + } + return( has_hi_bit ); +} +static void GetSelection(); + +/* ARGSUSED */ +static void +_SelectionReceived(w, client_data, selection, type, value, length, format) +Widget w; +XtPointer client_data; +Atom *selection, *type; +XtPointer value; +unsigned long *length; +int* format; +{ + TextWidget ctx = (TextWidget)w; + XawTextBlock text; + + if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0) { + struct _SelectionList* list = (struct _SelectionList*)client_data; + if (list != NULL) { + if (list->CT_asked) { + + /* If we just asked for a XA_COMPOUND_TEXT and got a null + response, we'll ask again, this time for an XA_STRING. */ + + list->CT_asked = False; + XtGetSelectionValue(w, list->selection, XA_STRING, _SelectionReceived, + (XtPointer)list, list->time); + } else { + GetSelection(w, list->time, list->params, list->count); + XtFree(client_data); + } + } + return; + } + + /* Many programs, especially old terminal emulators, give us multibyte text +but tell us it is COMPOUND_TEXT :( The following routine checks to see if the +string is a legal multibyte string in our locale using a spooky heuristic :O +and if it is we can only assume the sending client is using the same locale as +we are, and convert it. I also warn the user that the other client is evil. */ + + StartAction( ctx, (XEvent*) NULL ); + if (_XawTextFormat(ctx) == XawFmtWide) { + XTextProperty textprop; + Display *d = XtDisplay((Widget)ctx); + wchar_t **wlist; + int count; + int try_CT = 1; + + /* IS THE SELECTION IN MULTIBYTE FORMAT? */ + + if ( ProbablyMB( (char *) value ) ) { + char * list[1]; + list[0] = (char *) value; + if ( XmbTextListToTextProperty( d, (char**) list, 1, + XCompoundTextStyle, &textprop ) == Success ) + try_CT = 0; + } + + /* OR IN COMPOUND TEXT FORMAT? */ + + if ( try_CT ) { + textprop.encoding = XA_COMPOUND_TEXT(d); + textprop.value = (unsigned char *)value; + textprop.nitems = strlen(value); + textprop.format = 8; + } + + if ( XwcTextPropertyToTextList( d, &textprop, (wchar_t***) &wlist, &count ) + != Success) { + XwcFreeStringList( (wchar_t**) wlist ); + + /* Notify the user on strerr and in the insertion :) */ + textprop.value = (unsigned char *) " >> ILLEGAL SELECTION << "; + count = 1; + fprintf( stderr, "Xaw Text Widget: An attempt was made to insert an illegal selection.\n" ); + + if ( XwcTextPropertyToTextList( d, &textprop, (wchar_t***) &wlist, &count ) + != Success) return; + } + + XFree(value); + value = (XPointer)wlist[0]; + + *length = wcslen(wlist[0]); + XtFree((XtPointer)wlist); + text.format = XawFmtWide; + } else + text.format = XawFmt8Bit; + text.ptr = (char*)value; + text.firstPos = 0; + text.length = *length; + if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) { + XBell(XtDisplay(ctx), 0); + return; + } + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstPositions, XawsdRight, text.length, TRUE); + + _XawTextSetScrollBars(ctx); + EndAction(ctx); + XtFree(client_data); + XFree(value); /* the selection value should be freed with XFree */ +} + +static void +GetSelection(w, time, params, num_params) +Widget w; +Time time; +String* params; /* selections in precedence order */ +Cardinal num_params; +{ + Atom selection; + int buffer; + + selection = XInternAtom(XtDisplay(w), *params, False); + + switch (selection) { + case XA_CUT_BUFFER0: buffer = 0; break; + case XA_CUT_BUFFER1: buffer = 1; break; + case XA_CUT_BUFFER2: buffer = 2; break; + case XA_CUT_BUFFER3: buffer = 3; break; + case XA_CUT_BUFFER4: buffer = 4; break; + case XA_CUT_BUFFER5: buffer = 5; break; + case XA_CUT_BUFFER6: buffer = 6; break; + case XA_CUT_BUFFER7: buffer = 7; break; + default: buffer = -1; + } + if (buffer >= 0) { + int nbytes; + unsigned long length; + int fmt8 = 8; + Atom type = XA_STRING; + char *line = XFetchBuffer(XtDisplay(w), &nbytes, buffer); + if ((length = nbytes)) + _SelectionReceived(w, (XtPointer) NULL, &selection, &type, (XPointer)line, + &length, &fmt8); + else if (num_params > 1) + GetSelection(w, time, params+1, num_params-1); + } else { + struct _SelectionList* list; + if (--num_params) { + list = XtNew(struct _SelectionList); + list->params = params + 1; + list->count = num_params; + list->time = time; + list->CT_asked = True; + list->selection = selection; + } else list = NULL; + XtGetSelectionValue(w, selection, XA_COMPOUND_TEXT(XtDisplay(w)), + _SelectionReceived, (XtPointer)list, time); + } +} + +static void +InsertSelection(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; /* precedence list of selections to try */ +Cardinal* num_params; +{ + StartAction((TextWidget)w, event); /* Get Time. */ + GetSelection(w, ((TextWidget)w)->text.time, params, *num_params); + EndAction((TextWidget)w); +} + +/************************************************************ + * + * Routines for Moving Around. + * + ************************************************************/ + +static void +Move(ctx, event, dir, type, include) +TextWidget ctx; +XEvent* event; +XawTextScanDirection dir; +XawTextScanType type; +Boolean include; +{ + StartAction(ctx, event); + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + type, dir, ctx->text.mult, include); + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +MoveForwardChar(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdRight, XawstPositions, TRUE); +} + +/*ARGSUSED*/ +static void +MoveBackwardChar(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdLeft, XawstPositions, TRUE); +} + +/*ARGSUSED*/ +static void +MoveForwardWord(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdRight, XawstWhiteSpace, FALSE); +} + +/*ARGSUSED*/ +static void +MoveBackwardWord(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdLeft, XawstWhiteSpace, FALSE); +} + +/*ARGSUSED*/ +static void MoveForwardParagraph(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdRight, XawstParagraph, FALSE); +} + +/*ARGSUSED*/ +static void MoveBackwardParagraph(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdLeft, XawstParagraph, FALSE); +} + +/*ARGSUSED*/ +static void +MoveToLineEnd(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdRight, XawstEOL, FALSE); +} + +/*ARGSUSED*/ +static void +MoveToLineStart(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdLeft, XawstEOL, FALSE); +} + + +static void +MoveLine(ctx, event, dir) +TextWidget ctx; +XEvent* event; +XawTextScanDirection dir; +{ + XawTextPosition new, next_line, junk; + int from_left, garbage; + + StartAction(ctx, event); + + if (dir == XawsdLeft) + ctx->text.mult++; + + new = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstEOL, XawsdLeft, 1, FALSE); + + FindDist(ctx->text.sink, new, ctx->text.margin.left, ctx->text.insertPos, + &from_left, &junk, &garbage); + + new = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, dir, + ctx->text.mult, (dir == XawsdRight)); + + next_line = SrcScan(ctx->text.source, new, XawstEOL, XawsdRight, 1, FALSE); + + FindPos(ctx->text.sink, new, ctx->text.margin.left, from_left, FALSE, + &(ctx->text.insertPos), &garbage, &garbage); + + if (ctx->text.insertPos > next_line) + ctx->text.insertPos = next_line; + + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +MoveNextLine(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + MoveLine( (TextWidget) w, event, XawsdRight); +} + +/*ARGSUSED*/ +static void +MovePreviousLine(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + MoveLine( (TextWidget) w, event, XawsdLeft); +} + +/*ARGSUSED*/ +static void +MoveBeginningOfFile(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdLeft, XawstAll, TRUE); +} + +/*ARGSUSED*/ +static void +MoveEndOfFile(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Move((TextWidget) w, event, XawsdRight, XawstAll, TRUE); +} + +static void +Scroll(ctx, event, dir) +TextWidget ctx; +XEvent* event; +XawTextScanDirection dir; +{ + StartAction(ctx, event); + + if (dir == XawsdLeft) + _XawTextVScroll(ctx, ctx->text.mult); + else + _XawTextVScroll(ctx, -ctx->text.mult); + + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +ScrollOneLineUp(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Scroll( (TextWidget) w, event, XawsdLeft); +} + +/*ARGSUSED*/ +static void +ScrollOneLineDown(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + Scroll( (TextWidget) w, event, XawsdRight); +} + +static void +MovePage(ctx, event, dir) +TextWidget ctx; +XEvent* event; +XawTextScanDirection dir; +{ + int scroll_val = Max(1, ctx->text.lt.lines - 2); + + if (dir == XawsdLeft) + scroll_val = -scroll_val; + + StartAction(ctx, event); + _XawTextVScroll(ctx, scroll_val); + ctx->text.insertPos = ctx->text.lt.top; + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +MoveNextPage(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + MovePage((TextWidget) w, event, XawsdRight); +} + +/*ARGSUSED*/ +static void +MovePreviousPage(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + MovePage((TextWidget) w, event, XawsdLeft); +} + +/************************************************************ + * + * Delete Routines. + * + ************************************************************/ + +static Boolean +MatchSelection(selection, s) + Atom selection; + XawTextSelection* s; +{ + Atom *match; + int count; + + for (count = 0, match = s->selections; count < s->atom_count; match++, count++) + if (*match == selection) + return True; + return False; +} + +#define SrcCvtSel XawTextSourceConvertSelection + +static Boolean +ConvertSelection(w, selection, target, type, value, length, format) + Widget w; + Atom *selection, *target, *type; + XtPointer* value; + unsigned long* length; + int* format; +{ + Display* d = XtDisplay(w); + TextWidget ctx = (TextWidget)w; + Widget src = ctx->text.source; + XawTextEditType edit_mode; + Arg args[1]; + XawTextSelectionSalt *salt = NULL; + XawTextSelection *s; + + if (*target == XA_TARGETS(d)) { + Atom* targetP, * std_targets; + unsigned long std_length; + + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) + return True; + + XmuConvertStandardSelection(w, ctx->text.time, selection, + target, type, (XPointer*)&std_targets, + &std_length, format); + + *value = XtMalloc((unsigned) sizeof(Atom)*(std_length + 7)); + targetP = *(Atom**)value; + + *length = std_length + 6; + *targetP++ = XA_STRING; + *targetP++ = XA_TEXT(d); + *targetP++ = XA_COMPOUND_TEXT(d); + *targetP++ = XA_LENGTH(d); + *targetP++ = XA_LIST_LENGTH(d); + *targetP++ = XA_CHARACTER_POSITION(d); + + XtSetArg(args[0], XtNeditType,&edit_mode); + XtGetValues(src, args, 1); + + if (edit_mode == XawtextEdit) { + *targetP++ = XA_DELETE(d); + (*length)++; + } + memcpy((char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); + XtFree((char*)std_targets); + *type = XA_ATOM; + *format = 32; + return True; + } + + if ( SrcCvtSel(src, selection, target, type, value, length, format) ) + return True; + + for (salt = ctx->text.salt2; salt; salt = salt->next) + if (MatchSelection (*selection, &salt->s)) + break; + if (!salt) + return False; + s = &salt->s; + if (*target == XA_STRING || + *target == XA_TEXT(d) || + *target == XA_COMPOUND_TEXT(d)) { + if (*target == XA_TEXT(d)) { + if (_XawTextFormat(ctx) == XawFmtWide) + *type = XA_COMPOUND_TEXT(d); + else + *type = XA_STRING; + } else { + *type = *target; + } + /* + * If salt is True, the salt->contents stores CT string, + * its length is measured in bytes. + * Refer to _XawTextSaltAwaySelection(). + * + * by Li Yuhong, Mar. 20, 1991. + */ + if (!salt) { + *value = (char *)_XawTextGetSTRING(ctx, s->left, s->right); + if (_XawTextFormat(ctx) == XawFmtWide) { + XTextProperty textprop; + if (XwcTextListToTextProperty(d, (wchar_t**)value, 1, + XCompoundTextStyle, &textprop) + < Success) { + XtFree(*value); + return False; + } + XtFree(*value); + *value = (XtPointer)textprop.value; + *length = textprop.nitems; + } else { + *length = strlen(*value); + } + } else { + *value = XtMalloc((salt->length + 1) * sizeof(unsigned char)); + strcpy (*value, salt->contents); + *length = salt->length; + } + if (_XawTextFormat(ctx) == XawFmtWide && *type == XA_STRING) { + XTextProperty textprop; + wchar_t** wlist; + int count; + textprop.encoding = XA_COMPOUND_TEXT(d); + textprop.value = (unsigned char *)*value; + textprop.nitems = strlen(*value); + textprop.format = 8; + if (XwcTextPropertyToTextList(d, &textprop, (wchar_t***)&wlist, &count) + < Success) { + XtFree(*value); + return False; + } + XtFree(*value); + if (XwcTextListToTextProperty(d, (wchar_t**)wlist, 1, + XStringStyle, &textprop) < Success) { + XwcFreeStringList( (wchar_t**) wlist ); + return False; + } + *value = (XtPointer)textprop.value; + *length = textprop.nitems; + XwcFreeStringList( (wchar_t**) wlist ); + } + *format = 8; + return True; + } + + if ( (*target == XA_LIST_LENGTH(d)) || (*target == XA_LENGTH(d)) ) { + long * temp; + + temp = (long *) XtMalloc(sizeof(long)); + if (*target == XA_LIST_LENGTH(d)) + *temp = 1L; + else /* *target == XA_LENGTH(d) */ + *temp = (long) (s->right - s->left); + + *value = (XPointer) temp; + *type = XA_INTEGER; + *length = 1L; + *format = 32; + return True; + } + + if (*target == XA_CHARACTER_POSITION(d)) { + long * temp; + + temp = (long *) XtMalloc(2 * sizeof(long)); + temp[0] = (long) (s->left + 1); + temp[1] = s->right; + *value = (XPointer) temp; + *type = XA_SPAN(d); + *length = 2L; + *format = 32; + return True; + } + + if (*target == XA_DELETE(d)) { + void _XawTextZapSelection(); /* From TextAction.c */ + + if (!salt) + _XawTextZapSelection( ctx, (XEvent *) NULL, TRUE); + *value = NULL; + *type = XA_NULL(d); + *length = 0; + *format = 32; + return True; + } + + if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, + (XPointer *)value, length, format)) + return True; + + /* else */ + return False; +} + +static void +LoseSelection(w, selection) + Widget w; + Atom* selection; +{ + TextWidget ctx = (TextWidget) w; + Atom* atomP; + int i; + XawTextSelectionSalt *salt, *prevSalt, *nextSalt; + + prevSalt = 0; + for (salt = ctx->text.salt2; salt; salt = nextSalt) + { + atomP = salt->s.selections; + nextSalt = salt->next; + for (i = 0 ; i < salt->s.atom_count; i++, atomP++) + if (*selection == *atomP) + *atomP = (Atom)0; + + while (salt->s.atom_count && + salt->s.selections[salt->s.atom_count-1] == 0) + { + salt->s.atom_count--; + } + + /* + * Must walk the selection list in opposite order from UnsetSelection. + */ + + atomP = salt->s.selections; + for (i = 0 ; i < salt->s.atom_count; i++, atomP++) + if (*atomP == (Atom)0) + { + *atomP = salt->s.selections[--salt->s.atom_count]; + while (salt->s.atom_count && + salt->s.selections[salt->s.atom_count-1] == 0) + salt->s.atom_count--; + } + if (salt->s.atom_count == 0) + { + XtFree ((char *) salt->s.selections); + + /* WARNING: the next line frees memory not allocated in Xaw. */ + /* Could be a serious bug. Someone look into it. */ + XtFree (salt->contents); + if (prevSalt) + prevSalt->next = nextSalt; + else + ctx->text.salt2 = nextSalt; + XtFree ((char *) salt); + } + else + prevSalt = salt; + } +} + +static void +_DeleteOrKill(ctx, from, to, kill) +TextWidget ctx; +XawTextPosition from, to; +Boolean kill; +{ + XawTextBlock text; + + if (kill && from < to) { + XawTextSelectionSalt *salt; + Atom selection = XInternAtom(XtDisplay(ctx), "SECONDARY", False); + + LoseSelection ((Widget) ctx, &selection); + salt = (XawTextSelectionSalt *) XtMalloc (sizeof (XawTextSelectionSalt)); + if (!salt) + return; + salt->s.selections = (Atom *) XtMalloc (sizeof (Atom)); + if (!salt->s.selections) + { + XtFree ((char *) salt); + return; + } + salt->s.left = from; + salt->s.right = to; + salt->contents = (char *)_XawTextGetSTRING(ctx, from, to); + if (_XawTextFormat(ctx) == XawFmtWide) { + XTextProperty textprop; + if (XwcTextListToTextProperty(XtDisplay((Widget)ctx), + (wchar_t**)(&(salt->contents)), 1, XCompoundTextStyle, + &textprop) < Success) { + XtFree(salt->contents); + salt->length = 0; + return; + } + XtFree(salt->contents); + salt->contents = (char *)textprop.value; + salt->length = textprop.nitems; + } else + salt->length = strlen (salt->contents); + salt->next = ctx->text.salt2; + ctx->text.salt2 = salt; + salt->s.selections[0] = selection; + XtOwnSelection ((Widget) ctx, selection, ctx->text.time, + ConvertSelection, LoseSelection, NULL); + salt->s.atom_count = 1; +/* + XStoreBuffer(XtDisplay(ctx), ptr, strlen(ptr), 1); + XtFree(ptr); +*/ + } + text.length = 0; + text.firstPos = 0; + + text.format = _XawTextFormat(ctx); + text.ptr = ""; /* These two lines needed to make legal TextBlock */ + + if (_XawTextReplace(ctx, from, to, &text)) { + XBell(XtDisplay(ctx), 50); + return; + } + ctx->text.insertPos = from; + ctx->text.showposition = TRUE; +} + +static void +DeleteOrKill(ctx, event, dir, type, include, kill) +TextWidget ctx; +XEvent* event; +XawTextScanDirection dir; +XawTextScanType type; +Boolean include, kill; +{ + XawTextPosition from, to; + + StartAction(ctx, event); + to = SrcScan(ctx->text.source, ctx->text.insertPos, + type, dir, ctx->text.mult, include); + +/* + * If no movement actually happened, then bump the count and try again. + * This causes the character position at the very beginning and end of + * a boundary to act correctly. + */ + + if (to == ctx->text.insertPos) + to = SrcScan(ctx->text.source, ctx->text.insertPos, + type, dir, ctx->text.mult + 1, include); + + if (dir == XawsdLeft) { + from = to; + to = ctx->text.insertPos; + } + else + from = ctx->text.insertPos; + + _DeleteOrKill(ctx, from, to, kill); + _XawTextSetScrollBars(ctx); + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +DeleteForwardChar(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, XawsdRight, XawstPositions, TRUE, FALSE); +} + +/*ARGSUSED*/ +static void +DeleteBackwardChar(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, XawsdLeft, XawstPositions, TRUE, FALSE); +} + +/*ARGSUSED*/ +static void +DeleteForwardWord(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, + XawsdRight, XawstWhiteSpace, FALSE, FALSE); +} + +/*ARGSUSED*/ +static void +DeleteBackwardWord(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, + XawsdLeft, XawstWhiteSpace, FALSE, FALSE); +} + +/*ARGSUSED*/ +static void +KillForwardWord(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, + XawsdRight, XawstWhiteSpace, FALSE, TRUE); +} + +/*ARGSUSED*/ +static void +KillBackwardWord(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, + XawsdLeft, XawstWhiteSpace, FALSE, TRUE); +} + +/*ARGSUSED*/ +static void +KillToEndOfLine(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + TextWidget ctx = (TextWidget) w; + XawTextPosition end_of_line; + + StartAction(ctx, event); + end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, + XawsdRight, ctx->text.mult, FALSE); + if (end_of_line == ctx->text.insertPos) + end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, + XawsdRight, ctx->text.mult, TRUE); + + _DeleteOrKill(ctx, ctx->text.insertPos, end_of_line, TRUE); + _XawTextSetScrollBars(ctx); + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +KillToEndOfParagraph(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + DeleteOrKill((TextWidget) w, event, XawsdRight, XawstParagraph, FALSE, TRUE); +} + +void +_XawTextZapSelection(ctx, event, kill) +TextWidget ctx; +XEvent* event; +Boolean kill; +{ + StartAction(ctx, event); + _DeleteOrKill(ctx, ctx->text.s.left, ctx->text.s.right, kill); + _XawTextSetScrollBars(ctx); + EndAction(ctx); +} + +/*ARGSUSED*/ +static void +KillCurrentSelection(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + _XawTextZapSelection( (TextWidget) w, event, TRUE); +} + +/*ARGSUSED*/ +static void +DeleteCurrentSelection(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + _XawTextZapSelection( (TextWidget) w, event, FALSE); +} + +/************************************************************ + * + * Insertion Routines. + * + ************************************************************/ + +static int +InsertNewLineAndBackupInternal(ctx) +TextWidget ctx; +{ + int count, error = XawEditDone; + XawTextBlock text; + + text.format = _XawTextFormat(ctx); + text.length = ctx->text.mult; + text.firstPos = 0; + + if ( text.format == XawFmtWide ) { + wchar_t* wptr; + text.ptr = XtMalloc(sizeof(wchar_t) * ctx->text.mult); + wptr = (wchar_t *)text.ptr; + for (count = 0; count < ctx->text.mult; count++ ) + wptr[count] = _Xaw_atowc(XawLF); + } + else { + text.ptr = XtMalloc(sizeof(char) * ctx->text.mult); + for (count = 0; count < ctx->text.mult; count++ ) + text.ptr[count] = XawLF; + } + + if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) { + XBell( XtDisplay(ctx), 50); + error = XawEditError; + } + else + ctx->text.showposition = TRUE; + + XtFree( text.ptr ); + return( error ); +} + +/*ARGSUSED*/ +static void +InsertNewLineAndBackup(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + StartAction( (TextWidget) w, event ); + (void) InsertNewLineAndBackupInternal( (TextWidget) w ); + _XawTextSetScrollBars( (TextWidget) w); + EndAction( (TextWidget) w ); +} + +static int +LocalInsertNewLine(ctx, event) + TextWidget ctx; + XEvent* event; +{ + StartAction(ctx, event); + if (InsertNewLineAndBackupInternal(ctx) == XawEditError) + return(XawEditError); + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstPositions, XawsdRight, ctx->text.mult, TRUE); + _XawTextSetScrollBars(ctx); + EndAction(ctx); + return(XawEditDone); +} + +/*ARGSUSED*/ +static void +InsertNewLine(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + (void) LocalInsertNewLine( (TextWidget) w, event); +} + +/*ARGSUSED*/ +static void +InsertNewLineAndIndent(w, event, p, n) +Widget w; +XEvent *event; +String *p; +Cardinal *n; +{ + XawTextBlock text; + XawTextPosition pos1; + int length; + TextWidget ctx = (TextWidget) w; + String line_to_ip; + + StartAction(ctx, event); + pos1 = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstEOL, XawsdLeft, 1, FALSE); + + line_to_ip = _XawTextGetText(ctx, pos1, ctx->text.insertPos); + + text.format = _XawTextFormat(ctx); + text.firstPos = 0; + + if ( text.format == XawFmtWide ) { + wchar_t* ptr; + text.ptr = XtMalloc( ( 2 + wcslen((wchar_t*)line_to_ip) ) * sizeof(wchar_t) ); + + ptr = (wchar_t*)text.ptr; + ptr[0] = _Xaw_atowc( XawLF ); + wcscpy( (wchar_t*) ++ptr, (wchar_t*) line_to_ip ); + + length = wcslen((wchar_t*)text.ptr); + while ( length && ( iswspace(*ptr) || ( *ptr == _Xaw_atowc(XawTAB) ) ) ) + ptr++, length--; + *ptr = (wchar_t)0; + text.length = wcslen((wchar_t*)text.ptr); + + } else { + char *ptr; + length = strlen(line_to_ip); + /* The current line + \0 and LF will be copied to this + buffer. Before my fix, only length + 1 bytes were + allocated, causing on machine with non-wasteful + malloc implementation segmentation violations by + overwriting the bypte after the allocated area + + -gustaf neumann + */ + text.ptr = XtMalloc( ( 2 + length ) * sizeof( char ) ); + + ptr = text.ptr; + ptr[0] = XawLF; + strcpy( ++ptr, line_to_ip ); + + length++; + while ( length && ( isspace(*ptr) || ( *ptr == XawTAB ) ) ) + ptr++, length--; + *ptr = '\0'; + text.length = strlen(text.ptr); + } + XtFree( line_to_ip ); + + if (_XawTextReplace(ctx,ctx->text.insertPos, ctx->text.insertPos, &text)) { + XBell(XtDisplay(ctx), 50); + XtFree(text.ptr); + EndAction(ctx); + return; + } + XtFree(text.ptr); + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstPositions, XawsdRight, text.length, TRUE); + _XawTextSetScrollBars(ctx); + EndAction(ctx); +} + +/************************************************************ + * + * Selection Routines. + * + *************************************************************/ + +static void +SelectWord(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + XawTextPosition l, r; + + StartAction(ctx, event); + l = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstWhiteSpace, XawsdLeft, 1, FALSE); + r = SrcScan(ctx->text.source, l, XawstWhiteSpace, XawsdRight, 1, FALSE); + _XawTextSetSelection(ctx, l, r, params, *num_params); + EndAction(ctx); +} + +static void +SelectAll(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + + StartAction(ctx, event); + _XawTextSetSelection(ctx,zeroPosition,ctx->text.lastPos,params,*num_params); + EndAction(ctx); +} + +static void +ModifySelection(ctx, event, mode, action, params, num_params) +TextWidget ctx; +XEvent* event; +XawTextSelectionMode mode; +XawTextSelectionAction action; +String* params; /* unused */ +Cardinal* num_params; /* unused */ +{ + StartAction(ctx, event); + NotePosition(ctx, event); + _XawTextAlterSelection(ctx, mode, action, params, num_params); + EndAction(ctx); +} + +/* ARGSUSED */ +static void +SelectStart(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; /* unused */ +Cardinal* num_params; /* unused */ +{ + ModifySelection((TextWidget) w, event, + XawsmTextSelect, XawactionStart, params, num_params); +} + +/* ARGSUSED */ +static void +SelectAdjust(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; /* unused */ +Cardinal* num_params; /* unused */ +{ + ModifySelection((TextWidget) w, event, + XawsmTextSelect, XawactionAdjust, params, num_params); +} + +static void +SelectEnd(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + ModifySelection((TextWidget) w, event, + XawsmTextSelect, XawactionEnd, params, num_params); +} + +/* ARGSUSED */ +static void +ExtendStart(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; /* unused */ +Cardinal* num_params; /* unused */ +{ + ModifySelection((TextWidget) w, event, + XawsmTextExtend, XawactionStart, params, num_params); +} + +/* ARGSUSED */ +static void +ExtendAdjust(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; /* unused */ +Cardinal* num_params; /* unused */ +{ + ModifySelection((TextWidget) w, event, + XawsmTextExtend, XawactionAdjust, params, num_params); +} + +static void +ExtendEnd(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + ModifySelection((TextWidget) w, event, + XawsmTextExtend, XawactionEnd, params, num_params); +} + +static void +SelectSave(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + int num_atoms; + Atom* sel; + Display* dpy = XtDisplay(w); + Atom selections[256]; + + StartAction( (TextWidget) w, event ); + num_atoms = *num_params; + if (num_atoms > 256) + num_atoms = 256; + for (sel=selections; --num_atoms >= 0; sel++, params++) + *sel = XInternAtom(dpy, *params, False); + num_atoms = *num_params; + _XawTextSaltAwaySelection( (TextWidget) w, selections, num_atoms ); + EndAction( (TextWidget) w ); +} + +/************************************************************ + * + * Misc. Routines. + * + ************************************************************/ + +/* ARGSUSED */ +static void +RedrawDisplay(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + StartAction( (TextWidget) w, event); + _XawTextClearAndCenterDisplay((TextWidget) w); + EndAction( (TextWidget) w); +} + +/*ARGSUSED*/ +static void +TextFocusIn (w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + TextWidget ctx = (TextWidget) w; + + /* Let the input method know focus has arrived. */ + _XawImSetFocusValues (w, NULL, 0); + if ( event->xfocus.detail == NotifyPointer ) return; + + ctx->text.hasfocus = TRUE; +} + +/*ARGSUSED*/ +static void +TextFocusOut(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + TextWidget ctx = (TextWidget) w; + + /* Let the input method know focus has left.*/ + _XawImUnsetFocus(w); + if ( event->xfocus.detail == NotifyPointer ) return; + ctx->text.hasfocus = FALSE; +} + +/*ARGSUSED*/ +static void +TextEnterWindow( w, event, params, num_params ) + Widget w; + XEvent* event; + String* params; + Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + + if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus && + !ctx->text.hasfocus) { + _XawImSetFocusValues(w, NULL, 0); + } +} + +/*ARGSUSED*/ +static void +TextLeaveWindow( w, event, params, num_params ) + Widget w; + XEvent* event; + String* params; + Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + + if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus && + !ctx->text.hasfocus) { + _XawImUnsetFocus(w); + } +} + +static XComposeStatus compose_status = {NULL, 0}; + +/* Function Name: AutoFill + * Description: Breaks the line at the previous word boundry when + * called inside InsertChar. + * Arguments: ctx - The text widget. + * Returns: none + */ + +static void +AutoFill(ctx) +TextWidget ctx; +{ + int width, height, x, line_num, max_width; + XawTextPosition ret_pos; + XawTextBlock text; + + if ( !((ctx->text.auto_fill) && (ctx->text.mult == 1)) ) + return; + + for ( line_num = 0; line_num < ctx->text.lt.lines ; line_num++) + if ( ctx->text.lt.info[line_num].position >= ctx->text.insertPos ) + break; + line_num--; /* backup a line. */ + + max_width = Max(0, (int)(ctx->core.width - HMargins(ctx))); + + x = ctx->text.margin.left; + XawTextSinkFindPosition( ctx->text.sink,ctx->text.lt.info[line_num].position, + x, max_width, TRUE, &ret_pos, &width, &height); + + if ( ret_pos >= ctx->text.insertPos ) + return; + + text.format = XawFmt8Bit; + if (_XawTextFormat(ctx) == XawFmtWide) { + text.format = XawFmtWide; + text.ptr = (char *)XtMalloc(sizeof(wchar_t) * 2); + ((wchar_t*)text.ptr)[0] = _Xaw_atowc(XawLF); + ((wchar_t*)text.ptr)[1] = 0; + } else + text.ptr = "\n"; + text.length = 1; + text.firstPos = 0; + + if (_XawTextReplace(ctx, ret_pos - 1, ret_pos, &text)) + XBell(XtDisplay((Widget) ctx), 0); /* Unable to edit, complain. */ +} + +/*ARGSUSED*/ +static void +InsertChar(w, event, p, n) +Widget w; +XEvent* event; +String* p; +Cardinal* n; +{ + TextWidget ctx = (TextWidget) w; + char *ptr, strbuf[BUFSIZ]; + int count, error; + KeySym keysym; + XawTextBlock text; + + if (XtIsSubclass (ctx->text.source, (WidgetClass) multiSrcObjectClass)) + text.length = _XawImWcLookupString (w, &event->xkey, + (wchar_t*) strbuf, BUFSIZ, &keysym, (Status*) &compose_status); + else + text.length = XLookupString ((XKeyEvent*)event, strbuf, BUFSIZ, &keysym, &compose_status); + + if (text.length == 0) + return; + + text.format = _XawTextFormat( ctx ); + if ( text.format == XawFmtWide ) { + text.ptr = ptr = XtMalloc(sizeof(wchar_t) * text.length * ctx->text.mult ); + for (count = 0; count < ctx->text.mult; count++ ) { + memcpy((char*) ptr, (char *)strbuf, sizeof(wchar_t) * text.length ); + ptr += sizeof(wchar_t) * text.length; + } + + } else { /* == XawFmt8Bit */ + text.ptr = ptr = XtMalloc( sizeof(char) * text.length * ctx->text.mult ); + for ( count = 0; count < ctx->text.mult; count++ ) { + strncpy( ptr, strbuf, text.length ); + ptr += text.length; + } + } + + text.length = text.length * ctx->text.mult; + text.firstPos = 0; + + StartAction(ctx, event); + + error = _XawTextReplace(ctx, ctx->text.insertPos,ctx->text.insertPos, &text); + + if (error == XawEditDone) { + ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, + XawstPositions, XawsdRight, text.length, TRUE); + AutoFill(ctx); + } + else + XBell(XtDisplay(ctx), 50); + + XtFree(text.ptr); + _XawTextSetScrollBars(ctx); + EndAction(ctx); +} + + +/* IfHexConvertHexElseReturnParam() - called by InsertString + * + * i18n requires the ability to specify multiple characters in a hexa- + * decimal string at once. Since Insert was already too long, I made + * this a seperate routine. + * + * A legal hex string in MBNF: '0' 'x' ( HEX-DIGIT HEX-DIGIT )+ '\0' + * + * WHEN: the passed param is a legal hex string + * RETURNS: a pointer to that converted, null terminated hex string; + * len_return holds the character count of conversion result + * + * WHEN: the passed param is not a legal hex string: + * RETURNS: the parameter passed; + * len_return holds the char count of param. + * + * NOTE: In neither case will there be strings to free. */ + +static char* +IfHexConvertHexElseReturnParam(param, len_return) + char* param; + int* len_return; +{ + char *p; /* steps through param char by char */ + char c; /* holds the character pointed to by p */ + + int ind; /* steps through hexval buffer char by char */ + static char hexval[ XawTextActionMaxHexChars ]; + Boolean first_digit; + + /* reject if it doesn't begin with 0x and at least one more character. */ + + if ( ( param[0] != '0' ) || ( param[1] != 'x' ) || ( param[2] == '\0' ) ) { + *len_return = strlen( param ); + return( param ); + } + + /* Skip the 0x; go character by character shifting and adding. */ + + first_digit = True; + ind = 0; + hexval[ ind ] = '\0'; + + for ( p = param+2; ( c = *p ); p++ ) { + hexval[ ind ] *= 16; + if (c >= '0' && c <= '9') + hexval[ ind ] += c - '0'; + else if (c >= 'a' && c <= 'f') + hexval[ ind ] += c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + hexval[ ind ] += c - 'A' + 10; + else break; + + /* If we didn't break in preceding line, it was a good hex char. */ + + if ( first_digit ) + first_digit = False; + else { + first_digit = True; + if ( ++ind < XawTextActionMaxHexChars ) + hexval[ ind ] = '\0'; + else { + *len_return = strlen( param ); + return( param ); + } + } + } + + /* We quit the above loop becasue we hit a non hex. If that char is \0... */ + + if ( ( c == '\0' ) && first_digit ) { + *len_return = strlen( hexval ); + return( hexval ); /* ...it was a legal hex string, so return it.*/ + } + + /* Else, there were non-hex chars or odd digit count, so... */ + + *len_return = strlen( param ); + return( param ); /* ...return the verbatim string. */ +} + + +/* InsertString() - action + * + * Mostly rewritten for R6 i18n. + * + * Each parameter, in turn, will be insert at the inputPos + * and the inputPos advances to the insertion's end. + * + * The exception is that parameters composed of the two + * characters 0x, followed only by an even number of + * hexadecimal digits will be converted to characters. */ + +/*ARGSUSED*/ +static void +InsertString(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + XtAppContext app_con = XtWidgetToApplicationContext(w); + XawTextBlock text; + int i; + + text.firstPos = 0; + text.format = _XawTextFormat( ctx ); + + StartAction(ctx, event); + for ( i = *num_params; i; i--, params++ ) { /* DO FOR EACH PARAMETER */ + + text.ptr = IfHexConvertHexElseReturnParam( *params, &text.length ); + + if ( text.length == 0 ) continue; + + if ( _XawTextFormat( ctx ) == XawFmtWide ) { /* convert to WC */ + + int temp_len; + text.ptr = (char*) _XawTextMBToWC( XtDisplay(w), text.ptr, + &text.length ); + + if ( text.ptr == NULL ) { /* conversion error */ + XtAppWarningMsg( app_con, + "insertString", "textAction", "XawError", + "insert-string()'s parameter contents not legal in this locale.", + NULL, NULL ); + ParameterError( w, *params ); + continue; + } + + /* Double check that the new input is legal: try to convert to MB. */ + + temp_len = text.length; /* _XawTextWCToMB's 3rd arg is in_out */ + if ( _XawTextWCToMB( XtDisplay(w), (wchar_t*)text.ptr, &temp_len ) == NULL ) { + XtAppWarningMsg( app_con, + "insertString", "textAction", "XawError", + "insert-string()'s parameter contents not legal in this locale.", + NULL, NULL ); + ParameterError( w, *params ); + continue; + } + } /* convert to WC */ + + if ( _XawTextReplace( ctx, ctx->text.insertPos, + ctx->text.insertPos, &text ) ) { + XBell( XtDisplay( ctx ), 50 ); + EndAction( ctx ); + return; + } + + /* Advance insertPos to the end of the string we just inserted. */ + ctx->text.insertPos = SrcScan( ctx->text.source, ctx->text.insertPos, + XawstPositions, XawsdRight, text.length, TRUE ); + + } /* DO FOR EACH PARAMETER */ + + EndAction( ctx ); +} + + +/* DisplayCaret() - action + * + * The parameter list should contain one boolean value. If the + * argument is true, the cursor will be displayed. If false, not. + * + * The exception is that EnterNotify and LeaveNotify events may + * have a second argument, "always". If they do not, the cursor + * is only affected if the focus member of the event is true. */ + +static void +DisplayCaret(w, event, params, num_params) +Widget w; +XEvent* event; /* CrossingNotify special-cased */ +String* params; /* Off, False, No, On, True, Yes, etc. */ +Cardinal* num_params; /* 0, 1 or 2 */ +{ + TextWidget ctx = (TextWidget)w; + Boolean display_caret = True; + + if ( ( event->type == EnterNotify || event->type == LeaveNotify ) && + ( ( *num_params >= 2 ) && ( strcmp( params[1], "always" ) == 0 ) ) && + ( !event->xcrossing.focus ) ) + return; + + if (*num_params > 0) { /* default arg is "True" */ + XrmValue from, to; + from.size = strlen(from.addr = params[0]); + XtConvert( w, XtRString, &from, XtRBoolean, &to ); + + if ( to.addr != NULL ) + display_caret = *(Boolean*)to.addr; + if ( ctx->text.display_caret == display_caret ) + return; + } + StartAction(ctx, event); + ctx->text.display_caret = display_caret; + EndAction(ctx); +} + + +/* Multiply() - action + * + * The parameter list may contain either a number or the string 'Reset'. + * + * A number will multiply the current multiplication factor by that number. + * Many of the text widget actions will will perform n actions, where n is + * the multiplication factor. + * + * The string reset will reset the mutiplication factor to 1. */ + +/* ARGSUSED */ +static void +Multiply(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + int mult; + + if (*num_params != 1) { + XtAppError( XtWidgetToApplicationContext( w ), + "Xaw Text Widget: multiply() takes exactly one argument."); + XBell( XtDisplay( w ), 0 ); + return; + } + + if ( ( params[0][0] == 'r' ) || ( params[0][0] == 'R' ) ) { + XBell( XtDisplay( w ), 0 ); + ctx->text.mult = 1; + return; + } + + if ( ( mult = atoi( params[0] ) ) == 0 ) { + char buf[ BUFSIZ ]; + sprintf(buf, "%s %s", "Xaw Text Widget: multiply() argument", + "must be a number greater than zero, or 'Reset'." ); + XtAppError( XtWidgetToApplicationContext( w ), buf ); + XBell( XtDisplay( w ), 50 ); + return; + } + + ctx->text.mult *= mult; +} + + +/* StripOutOldCRs() - called from FormRegion + * + * removes CRs in widget ctx, from from to to. + * + * RETURNS: the new ending location (we may add some characters), + * or XawReplaceError if the widget can't be written to. */ + +static XawTextPosition +StripOutOldCRs(ctx, from, to) +TextWidget ctx; +XawTextPosition from, to; +{ + XawTextPosition startPos, endPos, eop_begin, eop_end, temp; + Widget src = ctx->text.source; + XawTextBlock text; + char *buf; + static wchar_t wc_two_spaces[ 3 ]; + + /* Initialize our TextBlock with two spaces. */ + + text.firstPos = 0; + text.format = _XawTextFormat(ctx); + if ( text.format == XawFmt8Bit ) + text.ptr= " "; + else { + wc_two_spaces[0] = _Xaw_atowc(XawSP); + wc_two_spaces[1] = _Xaw_atowc(XawSP); + wc_two_spaces[2] = 0; + text.ptr = (char*) wc_two_spaces; + } + + /* Strip out CR's. */ + + eop_begin = eop_end = startPos = endPos = from; + /* CONSTCOND */ + while (TRUE) { + endPos=SrcScan(src, startPos, XawstEOL, XawsdRight, 1, FALSE); + + temp = SrcScan(src, endPos, XawstWhiteSpace, XawsdLeft, 1, FALSE); + temp = SrcScan(src, temp, XawstWhiteSpace, XawsdRight,1, FALSE); + + if (temp > startPos) + endPos = temp; + + if (endPos >= to) + break; + + if (endPos >= eop_begin) { + startPos = eop_end; + eop_begin=SrcScan(src, startPos, XawstParagraph, XawsdRight, 1,FALSE); + eop_end = SrcScan(src, startPos, XawstParagraph, XawsdRight, 1, TRUE); + } + else { + XawTextPosition periodPos, next_word; + int i, len; + + periodPos= SrcScan(src, endPos, XawstPositions, XawsdLeft, 1, TRUE); + next_word = SrcScan(src, endPos, XawstWhiteSpace, XawsdRight, 1, FALSE); + + len = next_word - periodPos; + + text.length = 1; + buf = _XawTextGetText(ctx, periodPos, next_word); + if (text.format == XawFmtWide) { + if ( (periodPos < endPos) && (((wchar_t*)buf)[0] == _Xaw_atowc('.'))) + text.length++; + } else + if ( (periodPos < endPos) && (buf[0] == '.') ) + text.length++; /* Put in two spaces. */ + + /* + * Remove all extra spaces. + */ + + for (i = 1 ; i < len; i++) + if (text.format == XawFmtWide) { + if ( !iswspace(((wchar_t*)buf)[i]) || ((periodPos + i) >= to) ) { + break; + } + } else + if ( !isspace(buf[i]) || ((periodPos + i) >= to) ) { + break; + } + + XtFree(buf); + + to -= (i - text.length - 1); + startPos = SrcScan(src, periodPos, XawstPositions, XawsdRight, i, TRUE); + if (_XawTextReplace(ctx, endPos, startPos, &text) != XawEditDone) + return XawReplaceError; + startPos -= i - text.length; + } + } + return(to); +} + + +/* InsertNewCRs() - called from FormRegion + * + * inserts new CRs for FormRegion, thus for FormParagraph action */ + +static void +InsertNewCRs(ctx, from, to) +TextWidget ctx; +XawTextPosition from, to; +{ + XawTextPosition startPos, endPos, space, eol; + XawTextBlock text; + int i, width, height, len; + char * buf; + static wchar_t wide_CR[ 2 ]; + + text.firstPos = 0; + text.length = 1; + text.format = _XawTextFormat( ctx ); + + if ( text.format == XawFmt8Bit ) + text.ptr = "\n"; + else { + wide_CR[0] = _Xaw_atowc(XawLF); + wide_CR[1] = 0; + text.ptr = (char*) wide_CR; + } + + startPos = from; + /* CONSTCOND */ + while (TRUE) { + XawTextSinkFindPosition( ctx->text.sink, startPos, + (int) ctx->text.margin.left, + (int) (ctx->core.width - HMargins(ctx)), + TRUE, &eol, &width, &height); + if (eol >= to) + break; + + eol = SrcScan(ctx->text.source, eol, XawstPositions, XawsdLeft, 1, TRUE); + space= SrcScan(ctx->text.source, eol, XawstWhiteSpace,XawsdRight,1, TRUE); + + startPos = endPos = eol; + if (eol == space) + return; + + len = (int) (space - eol); + buf = _XawTextGetText(ctx, eol, space); + for ( i = 0 ; i < len ; i++) + if (text.format == XawFmtWide) { + if (!iswspace(((wchar_t*)buf)[i])) + break; + } else + if (!isspace(buf[i])) + break; + + to -= (i - 1); + endPos = SrcScan(ctx->text.source, endPos, + XawstPositions, XawsdRight, i, TRUE); + XtFree(buf); + + if (_XawTextReplace(ctx, startPos, endPos, &text)) + return; + + startPos = SrcScan(ctx->text.source, startPos, + XawstPositions, XawsdRight, 1, TRUE); + } +} + + +/* FormRegion() - called by FormParagraph + * + * oversees the work of paragraph-forming a region + * + * RETURNS: XawEditDone if successful, or XawReplaceError. */ + +static int +FormRegion(ctx, from, to) +TextWidget ctx; +XawTextPosition from, to; +{ + if ( from >= to ) return XawEditDone; + + if ( ( to = StripOutOldCRs( ctx, from, to ) ) == XawReplaceError ) + return XawReplaceError; + + /* insure that the insertion point is within legal bounds */ + if ( ctx->text.insertPos > SrcScan( ctx->text.source, 0, + XawstAll, XawsdRight, 1, TRUE ) ) + ctx->text.insertPos = to; + + InsertNewCRs(ctx, from, to); + _XawTextBuildLineTable(ctx, ctx->text.lt.top, TRUE); + return XawEditDone; +} + + +/* FormParagraph() - action + * + * removes and reinserts CRs to maximize line length without clipping */ + +/* ARGSUSED */ +static void +FormParagraph(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + XawTextPosition from, to; + + StartAction(ctx, event); + + from = SrcScan( ctx->text.source, ctx->text.insertPos, + XawstParagraph, XawsdLeft, 1, FALSE ); + to = SrcScan( ctx->text.source, from, + XawstParagraph, XawsdRight, 1, FALSE ); + + if ( FormRegion( ctx, from, to ) == XawReplaceError ) + XBell( XtDisplay( w ), 0 ); + _XawTextSetScrollBars( ctx ); + EndAction( ctx ); +} + + +/* TransposeCharacters() - action + * + * Swaps the character to the left of the mark + * with the character to the right of the mark. */ + +/* ARGSUSED */ +static void +TransposeCharacters(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + TextWidget ctx = (TextWidget) w; + XawTextPosition start, end; + XawTextBlock text; + char* buf; + int i; + + StartAction(ctx, event); + + /* Get bounds. */ + + start = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, + XawsdLeft, 1, TRUE ); + end = SrcScan( ctx->text.source, ctx->text.insertPos, XawstPositions, + XawsdRight, ctx->text.mult, TRUE ); + + /* Make sure we aren't at the very beginning or end of the buffer. */ + + if ( ( start == ctx->text.insertPos ) || ( end == ctx->text.insertPos ) ) { + XBell( XtDisplay( w ), 0 ); /* complain. */ + EndAction( ctx ); + return; + } + + ctx->text.insertPos = end; + + text.firstPos = 0; + text.format = _XawTextFormat(ctx); + + /* Retrieve text and swap the characters. */ + + if ( text.format == XawFmtWide) { + wchar_t wc; + wchar_t* wbuf; + + wbuf = (wchar_t*) _XawTextGetText(ctx, start, end); + text.length = wcslen( wbuf ); + wc = wbuf[ 0 ]; + for ( i = 1; i < text.length; i++ ) + wbuf[ i-1 ] = wbuf[ i ]; + wbuf[ i-1 ] = wc; + buf = (char*) wbuf; /* so that it gets assigned and freed */ + + } else { /* thus text.format == XawFmt8Bit */ + char c; + buf = _XawTextGetText( ctx, start, end ); + text.length = strlen( buf ); + c = buf[ 0 ]; + for ( i = 1; i < text.length; i++ ) + buf[ i-1 ] = buf[ i ]; + buf[ i-1 ] = c; + } + + text.ptr = buf; + + /* Store new text in source. */ + + if (_XawTextReplace (ctx, start, end, &text)) /* Unable to edit, complain. */ + XBell(XtDisplay(w), 0); + XtFree((char *) buf); + EndAction(ctx); +} + + +/* NoOp() - action + * This action performs no action, and allows the user or + * application programmer to unbind a translation. + * + * Note: If the parameter list contains the string "RingBell" then + * this action will ring the bell. + */ + +/*ARGSUSED*/ +static void +NoOp(w, event, params, num_params) +Widget w; +XEvent* event; +String* params; +Cardinal* num_params; +{ + if (*num_params != 1) + return; + + switch(params[0][0]) { + case 'R': + case 'r': + XBell(XtDisplay(w), 0); + default: /* Fall Through */ + break; + } +} + +/* Reconnect() - action + * This reconnects to the input method. The user will typically call + * this action if/when connection has been severed, or when the app + * was started up before an IM was started up. + */ + +/*ARGSUSED*/ +static void +Reconnect( w, event, params, num_params ) + Widget w; + XEvent* event; + String* params; + Cardinal* num_params; +{ + _XawImReconnect( w ); +} + + +XtActionsRec _XawTextActionsTable[] = { + +/* motion bindings */ + + {"forward-character", MoveForwardChar}, + {"backward-character", MoveBackwardChar}, + {"forward-word", MoveForwardWord}, + {"backward-word", MoveBackwardWord}, + {"forward-paragraph", MoveForwardParagraph}, + {"backward-paragraph", MoveBackwardParagraph}, + {"beginning-of-line", MoveToLineStart}, + {"end-of-line", MoveToLineEnd}, + {"next-line", MoveNextLine}, + {"previous-line", MovePreviousLine}, + {"next-page", MoveNextPage}, + {"previous-page", MovePreviousPage}, + {"beginning-of-file", MoveBeginningOfFile}, + {"end-of-file", MoveEndOfFile}, + {"scroll-one-line-up", ScrollOneLineUp}, + {"scroll-one-line-down", ScrollOneLineDown}, + +/* delete bindings */ + + {"delete-next-character", DeleteForwardChar}, + {"delete-previous-character", DeleteBackwardChar}, + {"delete-next-word", DeleteForwardWord}, + {"delete-previous-word", DeleteBackwardWord}, + {"delete-selection", DeleteCurrentSelection}, + +/* kill bindings */ + + {"kill-word", KillForwardWord}, + {"backward-kill-word", KillBackwardWord}, + {"kill-selection", KillCurrentSelection}, + {"kill-to-end-of-line", KillToEndOfLine}, + {"kill-to-end-of-paragraph", KillToEndOfParagraph}, + +/* new line stuff */ + + {"newline-and-indent", InsertNewLineAndIndent}, + {"newline-and-backup", InsertNewLineAndBackup}, + {"newline", InsertNewLine}, + +/* Selection stuff */ + + {"select-word", SelectWord}, + {"select-all", SelectAll}, + {"select-start", SelectStart}, + {"select-adjust", SelectAdjust}, + {"select-end", SelectEnd}, + {"select-save", SelectSave}, + {"extend-start", ExtendStart}, + {"extend-adjust", ExtendAdjust}, + {"extend-end", ExtendEnd}, + {"insert-selection", InsertSelection}, + +/* Miscellaneous */ + + {"redraw-display", RedrawDisplay}, + {"insert-file", _XawTextInsertFile}, + {"search", _XawTextSearch}, + {"insert-char", InsertChar}, + {"insert-string", InsertString}, + {"focus-in", TextFocusIn}, + {"focus-out", TextFocusOut}, + {"enter-window", TextEnterWindow}, + {"leave-window", TextLeaveWindow}, + {"display-caret", DisplayCaret}, + {"multiply", Multiply}, + {"form-paragraph", FormParagraph}, + {"transpose-characters", TransposeCharacters}, + {"no-op", NoOp}, + +/* Action to bind special translations for text Dialogs. */ + + {"InsertFileAction", _XawTextInsertFileAction}, + {"DoSearchAction", _XawTextDoSearchAction}, + {"DoReplaceAction", _XawTextDoReplaceAction}, + {"SetField", _XawTextSetField}, + {"PopdownSearchAction", _XawTextPopdownSearchAction}, + +/* Reconnect to Input Method */ + {"reconnect-im", Reconnect} /* Li Yuhong, Omron KK, 1991 */ +}; + +Cardinal _XawTextActionsTableCount = XtNumber(_XawTextActionsTable); diff --git a/vendor/x11iraf/xaw3d/TextP.h b/vendor/x11iraf/xaw3d/TextP.h new file mode 100644 index 00000000..22c2455a --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextP.h @@ -0,0 +1,289 @@ +/* +* $XConsortium: TextP.h,v 1.54 95/06/14 15:07:27 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawTextP_h +#define _XawTextP_h + +#include <X11/Xaw3d/Text.h> +#include <X11/Xaw3d/SimpleP.h> + +/**************************************************************** + * + * Text widget private + * + ****************************************************************/ +#define MAXCUT 30000 /* Maximum number of characters that can be cut. */ + +#define GETLASTPOS XawTextSourceScan(ctx->text.source, 0, \ + XawstAll, XawsdRight, 1, TRUE) + +#define zeroPosition ((XawTextPosition) 0) + +extern XtActionsRec _XawTextActionsTable[]; +extern Cardinal _XawTextActionsTableCount; + +#define XawLF 0x0a +#define XawCR 0x0d +#define XawTAB 0x09 +#define XawBS 0x08 +#define XawSP 0x20 +#define XawDEL 0x7f +#define XawESC 0x1b +#define XawBSLASH '\\' + +/* constants that subclasses may want to know */ +#define DEFAULT_TEXT_HEIGHT ((Dimension)~0) + +/* displayable text management data structures */ + +typedef struct { + XawTextPosition position; + Position y; + Dimension textWidth; +} XawTextLineTableEntry, *XawTextLineTableEntryPtr; + +typedef struct { + XawTextPosition left, right; + XawTextSelectType type; + Atom* selections; + int atom_count; + int array_size; +} XawTextSelection; + +typedef struct _XawTextSelectionSalt { + struct _XawTextSelectionSalt *next; + XawTextSelection s; + /* + * The element "contents" stores the CT string which is gotten in the + * function _XawTextSaltAwaySelection(). + */ + char *contents; + int length; +} XawTextSelectionSalt; + +/* Line Tables are n+1 long - last position displayed is in last lt entry */ +typedef struct { + XawTextPosition top; /* Top of the displayed text. */ + int lines; /* How many lines in this table. */ + XawTextLineTableEntry *info; /* A dynamic array, one entry per line */ +} XawTextLineTable, *XawTextLineTablePtr; + + +typedef struct _XawTextMargin { + Position left, right, top, bottom; +} XawTextMargin; + +#define VMargins(ctx) ( (ctx)->text.margin.top + (ctx)->text.margin.bottom ) +#define HMargins(ctx) ( (ctx)->text.margin.left + (ctx)->text.margin.right ) + +#define IsPositionVisible(ctx, pos) \ + (pos >= ctx->text.lt.info[0].position && \ + pos < ctx->text.lt.info[ctx->text.lt.lines].position) + +/* + * Search & Replace data structure. + */ + +struct SearchAndReplace { + Boolean selection_changed; /* flag so that the selection cannot be + changed out from underneath query-replace.*/ + Widget search_popup; /* The poppup widget that allows searches.*/ + Widget label1; /* The label widgets for the search window. */ + Widget label2; + Widget left_toggle; /* The left search toggle radioGroup. */ + Widget right_toggle; /* The right search toggle radioGroup. */ + Widget rep_label; /* The Replace label string. */ + Widget rep_text; /* The Replace text field. */ + Widget search_text; /* The Search text field. */ + Widget rep_one; /* The Replace one button. */ + Widget rep_all; /* The Replace all button. */ +}; + +/* Private Text Definitions */ + +typedef int (*ActionProc)(); + +/* New fields for the Text widget class record */ + +typedef struct {int empty;} TextClassPart; + +struct text_move { + int h, v; + struct text_move * next; +}; + +/* Full class record declaration */ +typedef struct _TextClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + TextClassPart text_class; +} TextClassRec; + +extern TextClassRec textClassRec; + +/* New fields for the Text widget record */ +typedef struct _TextPart { + /* resources */ + + Widget source, sink; + XawTextPosition insertPos; + XawTextSelection s; + XawTextSelectType *sarray; /* Array to cycle for selections. */ + XawTextSelectionSalt *salt; /* salted away selections */ + int options; /* wordbreak, scroll, etc. */ + int dialog_horiz_offset; /* position for popup dialog */ + int dialog_vert_offset; /* position for popup dialog */ + Boolean display_caret; /* insertion pt visible iff T */ + Boolean auto_fill; /* Auto fill mode? */ + XawTextScrollMode scroll_vert, scroll_horiz; /*what type of scrollbars.*/ + XawTextWrapMode wrap; /* The type of wrapping. */ + XawTextResizeMode resize; /* what to resize */ + XawTextMargin r_margin; /* The real margins. */ + XtCallbackList unrealize_callbacks; /* used for scrollbars */ + + /* private state */ + + XawTextMargin margin; /* The current margins. */ + XawTextLineTable lt; + XawTextScanDirection extendDir; + XawTextSelection origSel; /* the selection being modified */ + Time lasttime; /* timestamp of last processed action */ + Time time; /* time of last key or button action */ + Position ev_x, ev_y; /* x, y coords for key or button action */ + Widget vbar, hbar; /* The scroll bars (none = NULL). */ + struct SearchAndReplace * search;/* Search and replace structure. */ + Widget file_insert; /* The file insert popup widget. */ + XawTextPosition *updateFrom; /* Array of start positions for update. */ + XawTextPosition *updateTo; /* Array of end positions for update. */ + int numranges; /* How many update ranges there are. */ + int maxranges; /* How many ranges we have space for */ + XawTextPosition lastPos; /* Last position of source. */ + GC gc; + Boolean showposition; /* True if we need to show the position. */ + Boolean hasfocus; /* TRUE if we currently have input focus.*/ + Boolean update_disabled; /* TRUE if display updating turned off */ + Boolean single_char; /* Single character replaced. */ + XawTextPosition old_insert; /* Last insertPos for batched updates */ + short mult; /* Multiplier. */ + struct text_move * copy_area_offsets; /* Text offset area (linked list) */ + + /* private state, shared w/Source and Sink */ + Boolean redisplay_needed; /* in SetValues */ + XawTextSelectionSalt *salt2; /* salted away selections */ +} TextPart; + +/************************************************************* + * + * Resource types private to Text widget. + * + *************************************************************/ + +#define XtRScrollMode "ScrollMode" +#define XtRWrapMode "WrapMode" +#define XtRResizeMode "ResizeMode" + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TextRec { + CorePart core; + SimplePart simple; + TextPart text; +} TextRec; + +/******************************************** + * + * Semi-private functions + * for use by other Xaw modules only + * + *******************************************/ + +extern void _XawTextBuildLineTable ( +#if NeedFunctionPrototypes + TextWidget /*ctx*/, + XawTextPosition /*top pos*/, + _XtBoolean /* force_rebuild */ +#endif +); + +extern char* _XawTextGetSTRING( +#if NeedFunctionPrototypes + TextWidget /*ctx*/, + XawTextPosition /*left*/, + XawTextPosition /*right*/ +#endif +); + +extern void _XawTextSaltAwaySelection( +#if NeedFunctionPrototypes + TextWidget /*ctx*/, + Atom* /*selections*/, + int /*num_atoms*/ +#endif +); + +extern void _XawTextPosToXY( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* pos */, + Position * /* x */, + Position * /*y */ +#endif +); + +#endif /* _XawTextP_h */ + + diff --git a/vendor/x11iraf/xaw3d/TextPop.c b/vendor/x11iraf/xaw3d/TextPop.c new file mode 100644 index 00000000..57dc3c21 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextPop.c @@ -0,0 +1,1430 @@ +/* -XT + * $XConsortium: TextPop.c,v 1.31 94/04/17 20:13:10 kaleb Exp $ + * J. P. Terlouw, Kapteyn Astronomical Institute, Groningen The Netherlands, + * February 2001: modified for use with non-default visuals. + */ + +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/************************************************************ + * + * This file is broken up into three sections one dealing with + * each of the three popups created here: + * + * FileInsert, Search, and Replace. + * + * There is also a section at the end for utility functions + * used by all more than one of these dialogs. + * + * The following functions are the only non-static ones defined + * in this module. They are located at the begining of the + * section that contains this dialog box that uses them. + * + * void _XawTextInsertFileAction(w, event, params, num_params); + * void _XawTextDoSearchAction(w, event, params, num_params); + * void _XawTextDoReplaceAction(w, event, params, num_params); + * void _XawTextInsertFile(w, event, params, num_params); + * + *************************************************************/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/ShellP.h> + +#include <X11/Xaw3d/TextP.h> +#include <X11/Xaw3d/AsciiText.h> +#include <X11/Xaw3d/Cardinals.h> +#include <X11/Xaw3d/Command.h> +#include <X11/Xaw3d/Form.h> +#include <X11/Xaw3d/Toggle.h> +#include <X11/Xmu/CharSet.h> +#include "XawI18n.h" +#include <stdio.h> +#include <X11/Xos.h> /* for O_RDONLY */ +#include <errno.h> + +#ifdef X_NOT_STDC_ENV +extern int errno; +#endif + +#define INSERT_FILE ("Enter Filename:") + +#define SEARCH_LABEL_1 ("Use <Tab> to change fields.") +#define SEARCH_LABEL_2 ("Use ^q<Tab> for <Tab>.") +#define DISMISS_NAME ("cancel") +#define DISMISS_NAME_LEN 6 +#define FORM_NAME ("form") +#define LABEL_NAME ("label") +#define TEXT_NAME ("text") + +#define R_OFFSET 1 + +static void CenterWidgetOnPoint(), PopdownSearch(), DoInsert(), _SetField(); +static void InitializeSearchWidget(), SetResource(), SetSearchLabels(); +static void DoReplaceOne(), DoReplaceAll(); +static Widget CreateDialog(), GetShell(); +static void SetWMProtocolTranslations(); +static Boolean DoSearch(), SetResourceByName(), Replace(); +static String GetString(); + +static String GetStringRaw(); + +static void AddInsertFileChildren(); +static Boolean InsertFileNamed(); +static void AddSearchChildren(); + +static char radio_trans_string[] = + "<Btn1Down>,<Btn1Up>: set() notify()"; + +static char search_text_trans[] = + "~Shift<Key>Return: DoSearchAction(Popdown) \n\ + Shift<Key>Return: DoSearchAction() SetField(Replace) \n\ + Ctrl<Key>q,<Key>Tab: insert-char() \n\ + Ctrl<Key>c: PopdownSearchAction() \n\ + <Btn1Down>: select-start() SetField(Search) \n\ + <Key>Tab: DoSearchAction() SetField(Replace)"; + +static char rep_text_trans[] = + "~Shift<Key>Return: DoReplaceAction(Popdown) \n\ + Shift<Key>Return: SetField(Search) \n\ + Ctrl<Key>q,<Key>Tab: insert-char() \n\ + Ctrl<Key>c: PopdownSearchAction() \n\ + <Btn1Down>: select-start() DoSearchAction() SetField(Replace)\n\ + <Key>Tab: SetField(Search)"; + +/************************************************************ + * + * This section of the file contains all the functions that + * the file insert dialog box uses. + * + ************************************************************/ + +/* Function Name: _XawTextInsertFileAction + * Description: Action routine that can be bound to dialog box's + * Text Widget that will insert a file into the main + * Text Widget. + * Arguments: (Standard Action Routine args) + * Returns: none. + */ + +/* ARGSUSED */ +void +_XawTextInsertFileAction(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + DoInsert(w, (XtPointer) XtParent(XtParent(XtParent(w))), (XtPointer)NULL); +} + +/* Function Name: _XawTextInsertFile + * Description: Action routine that can be bound to the text widget + * it will popup the insert file dialog box. + * Arguments: w - the text widget. + * event - X Event (used to get x and y location). + * params, num_params - the parameter list. + * Returns: none. + * + * NOTE: + * + * The parameter list may contain one entry. + * + * Entry: This entry is optional and contains the value of the default + * file to insert. + */ + +void +_XawTextInsertFile(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + TextWidget ctx = (TextWidget)w; + char * ptr; + XawTextEditType edit_mode; + Arg args[1]; + + XtSetArg(args[0], XtNeditType,&edit_mode); + XtGetValues(ctx->text.source, args, ONE); + + if (edit_mode != XawtextEdit) { + XBell(XtDisplay(w), 0); + return; + } + + if (*num_params == 0) + ptr = ""; + else + ptr = params[0]; + + if (!ctx->text.file_insert) { + ctx->text.file_insert = CreateDialog(w, ptr, "insertFile", + AddInsertFileChildren); + XtRealizeWidget(ctx->text.file_insert); + SetWMProtocolTranslations(ctx->text.file_insert); + } + + CenterWidgetOnPoint(ctx->text.file_insert, event); + XtPopup(ctx->text.file_insert, XtGrabNone); +} + +/* Function Name: PopdownFileInsert + * Description: Pops down the file insert button. + * Arguments: w - the widget that caused this action. + * closure - a pointer to the main text widget that + * popped up this dialog. + * call_data - *** NOT USED ***. + * Returns: none. + */ + +/* ARGSUSED */ +static void +PopdownFileInsert(w, closure, call_data) +Widget w; /* The Dialog Button Pressed. */ +XtPointer closure; /* Text Widget. */ +XtPointer call_data; /* unused */ +{ + TextWidget ctx = (TextWidget) closure; + + XtPopdown( ctx->text.file_insert ); + (void) SetResourceByName( ctx->text.file_insert, LABEL_NAME, + XtNlabel, (XtArgVal) INSERT_FILE); +} + +/* Function Name: DoInsert + * Description: Actually insert the file named in the text widget + * of the file dialog. + * Arguments: w - the widget that activated this callback. + * closure - a pointer to the text widget to insert the + * file into. + * Returns: none. + */ + +/* ARGSUSED */ +static void +DoInsert(w, closure, call_data) +Widget w; /* The Dialog Button Pressed. */ +XtPointer closure; /* Text Widget */ +XtPointer call_data; /* unused */ +{ + TextWidget ctx = (TextWidget) closure; + char buf[BUFSIZ], msg[BUFSIZ]; + Widget temp_widget; + + (void) sprintf(buf, "%s.%s", FORM_NAME, TEXT_NAME); + if ( (temp_widget = XtNameToWidget(ctx->text.file_insert, buf)) == NULL ) { + (void) strcpy(msg, + "*** Error: Could not get text widget from file insert popup"); + } + else + if (InsertFileNamed( (Widget) ctx, GetString( temp_widget ))) { + PopdownFileInsert(w, closure, call_data); + return; + } + else + (void) sprintf( msg, "*** Error: %s ***", strerror(errno)); + + (void)SetResourceByName(ctx->text.file_insert, + LABEL_NAME, XtNlabel, (XtArgVal) msg); + XBell(XtDisplay(w), 0); +} + +/* Function Name: InsertFileNamed + * Description: Inserts a file into the text widget. + * Arguments: tw - The text widget to insert this file into. + * str - name of the file to insert. + * Returns: TRUE if the insert was sucessful, FALSE otherwise. + */ + + +static Boolean +InsertFileNamed(tw, str) +Widget tw; +char *str; +{ + FILE *file; + XawTextBlock text; + XawTextPosition pos; + + if ( (str == NULL) || (strlen(str) == 0) || + ((file = fopen(str, "r")) == NULL)) + return(FALSE); + + pos = XawTextGetInsertionPoint(tw); + + fseek(file, 0L, 2); + + + text.firstPos = 0; + text.length = (ftell(file))/sizeof(unsigned char); + text.ptr = XtMalloc((text.length + 1) * sizeof(unsigned char)); + text.format = XawFmt8Bit; + + fseek(file, 0L, 0); + if (fread(text.ptr, sizeof(unsigned char), text.length, file) != text.length) + XtErrorMsg("readError", "insertFileNamed", "XawError", + "fread returned error.", NULL, NULL); + + /* DELETE if (text.format == XawFmtWide) { + wchar_t* _XawTextMBToWC(); + wchar_t* wstr; + wstr = _XawTextMBToWC(XtDisplay(tw), text.ptr, &(text.length)); + wstr[text.length] = NULL; + XtFree(text.ptr); + text.ptr = (char *)wstr; + } else { + (text.ptr)[text.length] = '\0'; + }*/ + + if (XawTextReplace(tw, pos, pos, &text) != XawEditDone) { + XtFree(text.ptr); + fclose(file); + return(FALSE); + } + pos += text.length; + XtFree(text.ptr); + fclose(file); + XawTextSetInsertionPoint(tw, pos); + return(TRUE); +} + + +/* Function Name: AddInsertFileChildren + * Description: Adds all children to the InsertFile dialog widget. + * Arguments: form - the form widget for the insert dialog widget. + * ptr - a pointer to the initial string for the Text Widget. + * tw - the main text widget. + * Returns: none + */ + +static void +AddInsertFileChildren(form, ptr, tw) +Widget form, tw; +char * ptr; +{ + Arg args[10]; + Cardinal num_args; + Widget label, text, cancel, insert; + XtTranslations trans; + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, INSERT_FILE);num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNresizable, TRUE ); num_args++; + XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; + label = XtCreateManagedWidget (LABEL_NAME, labelWidgetClass, form, + args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNfromVert, label); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainRight); num_args++; + XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; + XtSetArg(args[num_args], XtNresizable, TRUE); num_args++; + XtSetArg(args[num_args], XtNresize, XawtextResizeWidth); num_args++; + XtSetArg(args[num_args], XtNstring, ptr); num_args++; + text = XtCreateManagedWidget(TEXT_NAME, asciiTextWidgetClass, form, + args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Insert File"); num_args++; + XtSetArg(args[num_args], XtNfromVert, text); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + insert = XtCreateManagedWidget("insert", commandWidgetClass, form, + args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Cancel"); num_args++; + XtSetArg(args[num_args], XtNfromVert, text); num_args++; + XtSetArg(args[num_args], XtNfromHoriz, insert); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + cancel = XtCreateManagedWidget(DISMISS_NAME, commandWidgetClass, form, + args, num_args); + + XtAddCallback(cancel, XtNcallback, PopdownFileInsert, (XtPointer) tw); + XtAddCallback(insert, XtNcallback, DoInsert, (XtPointer) tw); + + XtSetKeyboardFocus(form, text); + +/* + * Bind <CR> to insert file. + */ + + trans = XtParseTranslationTable("<Key>Return: InsertFileAction()"); + XtOverrideTranslations(text, trans); + +} + +/************************************************************ + * + * This section of the file contains all the functions that + * the search dialog box uses. + * + ************************************************************/ + +/* Function Name: _XawTextDoSearchAction + * Description: Action routine that can be bound to dialog box's + * Text Widget that will search for a string in the main + * Text Widget. + * Arguments: (Standard Action Routine args) + * Returns: none. + * + * Note: + * + * If the search was sucessful and the argument popdown is passed to + * this action routine then the widget will automatically popdown the + * search widget. + */ + +/* ARGSUSED */ +void +_XawTextDoSearchAction(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + TextWidget tw = (TextWidget) XtParent(XtParent(XtParent(w))); + Boolean popdown = FALSE; + + if ( (*num_params == 1) && + ((params[0][0] == 'p') || (params[0][0] == 'P')) ) + popdown = TRUE; + + if (DoSearch(tw->text.search) && popdown) + PopdownSearch(w, (XtPointer) tw->text.search, (XtPointer)NULL); +} + +/* Function Name: _XawTextPopdownSearchAction + * Description: Action routine that can be bound to dialog box's + * Text Widget that will popdown the search widget. + * Arguments: (Standard Action Routine args) + * Returns: none. + */ + +/* ARGSUSED */ +void +_XawTextPopdownSearchAction(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + TextWidget tw = (TextWidget) XtParent(XtParent(XtParent(w))); + + PopdownSearch(w, (XtPointer) tw->text.search, (XtPointer)NULL); +} + +/* Function Name: PopdownSeach + * Description: Pops down the search widget and resets it. + * Arguments: w - *** NOT USED ***. + * closure - a pointer to the search structure. + * call_data - *** NOT USED ***. + * Returns: none + */ + +/* ARGSUSED */ +static void +PopdownSearch(w, closure, call_data) +Widget w; +XtPointer closure; +XtPointer call_data; +{ + struct SearchAndReplace * search = (struct SearchAndReplace *) closure; + + XtPopdown( search->search_popup ); + SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, FALSE); +} + +/* Function Name: SearchButton + * Description: Performs a search when the button is clicked. + * Arguments: w - *** NOT USED **. + * closure - a pointer to the search info. + * call_data - *** NOT USED ***. + * Returns: + */ + +/* ARGSUSED */ +static void +SearchButton(w, closure, call_data) +Widget w; +XtPointer closure; +XtPointer call_data; +{ + (void) DoSearch( (struct SearchAndReplace *) closure ); +} + +/* Function Name: _XawTextSearch + * Description: Action routine that can be bound to the text widget + * it will popup the search dialog box. + * Arguments: w - the text widget. + * event - X Event (used to get x and y location). + * params, num_params - the parameter list. + * Returns: none. + * + * NOTE: + * + * The parameter list contains one or two entries that may be the following. + * + * First Entry: The first entry is the direction to search by default. + * This arguement must be specified and may have a value of + * "left" or "right". + * + * Second Entry: This entry is optional and contains the value of the default + * string to search for. + */ + +#define SEARCH_HEADER ("Text Widget - Search():") + +void +_XawTextSearch(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + TextWidget ctx = (TextWidget)w; + XawTextScanDirection dir; + char * ptr, buf[BUFSIZ]; + XawTextEditType edit_mode; + Arg args[1]; + +#ifdef notdef + if (ctx->text.source->Search == NULL) { + XBell(XtDisplay(w), 0); + return; + } +#endif + + if ( (*num_params < 1) || (*num_params > 2) ) { + (void) sprintf(buf, "%s %s\n%s", SEARCH_HEADER, + "This action must have only", + "one or two parameters"); + XtAppWarning(XtWidgetToApplicationContext(w), buf); + return; + } + + if (*num_params == 2 ) + ptr = params[1]; + else + if (_XawTextFormat(ctx) == XawFmtWide) { + /*This just does the equivalent of ptr = ""L, a waste because params[1] isnt W aligned.*/ + ptr = (char *)XtMalloc(sizeof(wchar_t)); + *((wchar_t*)ptr) = (wchar_t)0; + } else + ptr = ""; + + switch(params[0][0]) { + case 'b': /* Left. */ + case 'B': + dir = XawsdLeft; + break; + case 'f': /* Right. */ + case 'F': + dir = XawsdRight; + break; + default: + (void) sprintf(buf, "%s %s\n%s", SEARCH_HEADER, + "The first parameter must be", + "Either 'backward' or 'forward'"); + XtAppWarning(XtWidgetToApplicationContext(w), buf); + return; + } + + if (ctx->text.search== NULL) { + ctx->text.search = XtNew(struct SearchAndReplace); + ctx->text.search->search_popup = CreateDialog(w, ptr, "search", + AddSearchChildren); + XtRealizeWidget(ctx->text.search->search_popup); + SetWMProtocolTranslations(ctx->text.search->search_popup); + } + else if (*num_params > 1) { + XtVaSetValues(ctx->text.search->search_text, XtNstring, ptr, NULL); + } + + XtSetArg(args[0], XtNeditType,&edit_mode); + XtGetValues(ctx->text.source, args, ONE); + + InitializeSearchWidget(ctx->text.search, dir, (edit_mode == XawtextEdit)); + + CenterWidgetOnPoint(ctx->text.search->search_popup, event); + XtPopup(ctx->text.search->search_popup, XtGrabNone); +} + +/* Function Name: InitializeSearchWidget + * Description: This function initializes the search widget and + * is called each time the search widget is poped up. + * Arguments: search - the search widget structure. + * dir - direction to search. + * replace_active - state of the sensitivity for the + * replace button. + * Returns: none. + */ + +static void +InitializeSearchWidget(search, dir, replace_active) +struct SearchAndReplace * search; +XawTextScanDirection dir; +Boolean replace_active; +{ + SetResource(search->rep_one, XtNsensitive, (XtArgVal) replace_active); + SetResource(search->rep_all, XtNsensitive, (XtArgVal) replace_active); + SetResource(search->rep_label, XtNsensitive, (XtArgVal) replace_active); + SetResource(search->rep_text, XtNsensitive, (XtArgVal) replace_active); + + switch (dir) { + case XawsdLeft: + SetResource(search->left_toggle, XtNstate, (XtArgVal) TRUE); + break; + case XawsdRight: + SetResource(search->right_toggle, XtNstate, (XtArgVal) TRUE); + break; + default: + break; + } +} + +/* Function Name: AddSearchChildren + * Description: Adds all children to the Search Dialog Widget. + * Arguments: form - the form widget for the search widget. + * ptr - a pointer to the initial string for the Text Widget. + * tw - the main text widget. + * Returns: none. + */ + +static void +AddSearchChildren(form, ptr, tw) +Widget form, tw; +char * ptr; +{ + Arg args[10]; + Cardinal num_args; + Widget cancel, search_button, s_label, s_text, r_text; + XtTranslations trans; + struct SearchAndReplace * search = ((TextWidget) tw)->text.search; + + num_args = 0; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNresizable, TRUE ); num_args++; + XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; + search->label1 = XtCreateManagedWidget("label1", labelWidgetClass, form, + args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNfromVert, search->label1); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNresizable, TRUE ); num_args++; + XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; + search->label2 = XtCreateManagedWidget("label2", labelWidgetClass, form, + args, num_args); + +/* + * We need to add R_OFFSET to the radio_data, because the value zero (0) + * has special meaning. + */ + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Backward"); num_args++; + XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNradioData, (XPointer) XawsdLeft + R_OFFSET); + num_args++; + search->left_toggle = XtCreateManagedWidget("backwards", toggleWidgetClass, + form, args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Forward"); num_args++; + XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++; + XtSetArg(args[num_args], XtNfromHoriz, search->left_toggle); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNradioGroup, search->left_toggle); num_args++; + XtSetArg(args[num_args], XtNradioData, (XPointer) XawsdRight + R_OFFSET); + num_args++; + search->right_toggle = XtCreateManagedWidget("forwards", toggleWidgetClass, + form, args, num_args); + + { + XtTranslations radio_translations; + + radio_translations = XtParseTranslationTable(radio_trans_string); + XtOverrideTranslations(search->left_toggle, radio_translations); + XtOverrideTranslations(search->right_toggle, radio_translations); + } + + num_args = 0; + XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++; + XtSetArg(args[num_args], XtNlabel, "Search for: ");num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; + s_label = XtCreateManagedWidget("searchLabel", labelWidgetClass, form, + args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++; + XtSetArg(args[num_args], XtNfromHoriz, s_label); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainRight); num_args++; + XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; + XtSetArg(args[num_args], XtNresizable, TRUE); num_args++; + XtSetArg(args[num_args], XtNresize, XawtextResizeWidth); num_args++; + XtSetArg(args[num_args], XtNstring, ptr); num_args++; + s_text = XtCreateManagedWidget("searchText", asciiTextWidgetClass, form, + args, num_args); + search->search_text = s_text; + + num_args = 0; + XtSetArg(args[num_args], XtNfromVert, s_text); num_args++; + XtSetArg(args[num_args], XtNlabel, "Replace with:");num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++; + search->rep_label = XtCreateManagedWidget("replaceLabel", labelWidgetClass, + form, args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNfromHoriz, s_label); num_args++; + XtSetArg(args[num_args], XtNfromVert, s_text); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainRight); num_args++; + XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; + XtSetArg(args[num_args], XtNresizable, TRUE); num_args++; + XtSetArg(args[num_args], XtNresize, XawtextResizeWidth); num_args++; + XtSetArg(args[num_args], XtNstring, ""); num_args++; + r_text = XtCreateManagedWidget("replaceText", asciiTextWidgetClass, + form, args, num_args); + search->rep_text = r_text; + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Search"); num_args++; + XtSetArg(args[num_args], XtNfromVert, r_text); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + search_button = XtCreateManagedWidget("search", commandWidgetClass, form, + args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Replace"); num_args++; + XtSetArg(args[num_args], XtNfromVert, r_text); num_args++; + XtSetArg(args[num_args], XtNfromHoriz, search_button); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + search->rep_one = XtCreateManagedWidget("replaceOne", commandWidgetClass, + form, args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Replace All"); num_args++; + XtSetArg(args[num_args], XtNfromVert, r_text); num_args++; + XtSetArg(args[num_args], XtNfromHoriz, search->rep_one); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + search->rep_all = XtCreateManagedWidget("replaceAll", commandWidgetClass, + form, args, num_args); + + num_args = 0; + XtSetArg(args[num_args], XtNlabel, "Cancel"); num_args++; + XtSetArg(args[num_args], XtNfromVert, r_text); num_args++; + XtSetArg(args[num_args], XtNfromHoriz, search->rep_all); num_args++; + XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++; + XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++; + cancel = XtCreateManagedWidget(DISMISS_NAME, commandWidgetClass, form, + args, num_args); + + XtAddCallback(search_button, XtNcallback, SearchButton, (XtPointer) search); + XtAddCallback(search->rep_one, XtNcallback, DoReplaceOne, (XtPointer) search); + XtAddCallback(search->rep_all, XtNcallback, DoReplaceAll, (XtPointer) search); + XtAddCallback(cancel, XtNcallback, PopdownSearch, (XtPointer) search); + +/* + * Initialize the text entry fields. + */ + + { + Pixel color; + num_args = 0; + XtSetArg(args[num_args], XtNbackground, &color); num_args++; + XtGetValues(search->rep_text, args, num_args); + num_args = 0; + XtSetArg(args[num_args], XtNborderColor, color); num_args++; + XtSetValues(search->rep_text, args, num_args); + XtSetKeyboardFocus(form, search->search_text); + } + + SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, FALSE); + +/* + * Bind Extra translations. + */ + + trans = XtParseTranslationTable(search_text_trans); + XtOverrideTranslations(search->search_text, trans); + + trans = XtParseTranslationTable(rep_text_trans); + XtOverrideTranslations(search->rep_text, trans); +} + +/* Function Name: DoSearch + * Description: Performs a search. + * Arguments: search - the serach structure. + * Returns: TRUE if sucessful. + */ + +/* ARGSUSED */ +static Boolean +DoSearch(search) +struct SearchAndReplace * search; +{ + char msg[BUFSIZ]; + Widget tw = XtParent(search->search_popup); + XawTextPosition pos; + XawTextScanDirection dir; + XawTextBlock text; + + TextWidget ctx = (TextWidget)tw; + + text.ptr = GetStringRaw(search->search_text); + if ((text.format = _XawTextFormat(ctx)) == XawFmtWide) + text.length = wcslen((wchar_t*)text.ptr); + else + text.length = strlen(text.ptr); + text.firstPos = 0; + + dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) - + R_OFFSET); + + pos = XawTextSearch( tw, dir, &text); + + + /* The Raw string in find.ptr may be WC I can't use here, so I re - call + GetString to get a tame version. */ + + if (pos == XawTextSearchError) + (void) sprintf( msg, "Could not find string ``%s''.", GetString( search->search_text ) ); + else { + if (dir == XawsdRight) + XawTextSetInsertionPoint( tw, pos + text.length); + else + XawTextSetInsertionPoint( tw, pos); + + XawTextSetSelection( tw, pos, pos + text.length); + search->selection_changed = FALSE; /* selection is good. */ + return(TRUE); + } + + XawTextUnsetSelection(tw); + SetSearchLabels(search, msg, "", TRUE); + return(FALSE); +} + +/************************************************************ + * + * This section of the file contains all the functions that + * the replace dialog box uses. + * + ************************************************************/ + +/* Function Name: _XawTextDoReplaceAction + * Description: Action routine that can be bound to dialog box's + * Text Widget that will replace a string in the main + * Text Widget. + * Arguments: (Standard Action Routine args) + * Returns: none. + */ + +/* ARGSUSED */ +void +_XawTextDoReplaceAction(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + TextWidget ctx = (TextWidget) XtParent(XtParent(XtParent(w))); + Boolean popdown = FALSE; + + if ( (*num_params == 1) && + ((params[0][0] == 'p') || (params[0][0] == 'P')) ) + popdown = TRUE; + + if (Replace( ctx->text.search, TRUE, popdown) && popdown) + PopdownSearch(w, (XtPointer) ctx->text.search, (XtPointer)NULL); +} + +/* Function Name: DoReplaceOne + * Description: Replaces the first instance of the string + * in the search dialog's text widget + * with the one in the replace dialog's text widget. + * Arguments: w - *** Not Used ***. + * closure - a pointer to the search structure. + * call_data - *** Not Used ***. + * Returns: none. + */ + +/* ARGSUSED */ +static void +DoReplaceOne(w, closure, call_data) +Widget w; /* The Button Pressed. */ +XtPointer closure; /* Text Widget. */ +XtPointer call_data; /* unused */ +{ + Replace( (struct SearchAndReplace *) closure, TRUE, FALSE); +} + +/* Function Name: DoReplaceOne + * Description: Replaces every instance of the string + * in the search dialog's text widget + * with the one in the replace dialog's text widget. + * Arguments: w - *** Not Used ***. + * closure - a pointer to the search structure. + * call_data - *** Not Used ***. + * Returns: none. + */ + +/* ARGSUSED */ +static void +DoReplaceAll(w, closure, call_data) +Widget w; /* The Button Pressed. */ +XtPointer closure; /* Text Widget. */ +XtPointer call_data; /* unused */ +{ + Replace( (struct SearchAndReplace *) closure, FALSE, FALSE); +} + +/* Function Name: Replace + * Description: This is the function that does the real work of + * replacing strings in the main text widget. + * Arguments: tw - the Text Widget to replce the string in. + * once_only - If TRUE then only replace the first one found. + * other replace all of them. + * show_current - If true then leave the selection on the + * string that was just replaced, otherwise + * move it onto the next one. + * Returns: none. + */ + +static Boolean +Replace(search, once_only, show_current) +struct SearchAndReplace * search; +Boolean once_only, show_current; +{ + XawTextPosition pos, new_pos, end_pos; + XawTextScanDirection dir; + XawTextBlock find, replace; + Widget tw = XtParent(search->search_popup); + int count = 0; + + TextWidget ctx = (TextWidget)tw; + + find.ptr = GetStringRaw( search->search_text); + if ((find.format = _XawTextFormat(ctx)) == XawFmtWide) + find.length = wcslen((wchar_t*)find.ptr); + else + find.length = strlen(find.ptr); + find.firstPos = 0; + + replace.ptr = GetStringRaw(search->rep_text); + replace.firstPos = 0; + if ((replace.format = _XawTextFormat(ctx)) == XawFmtWide) + replace.length = wcslen((wchar_t*)replace.ptr); + else + replace.length = strlen(replace.ptr); + + dir = (XawTextScanDirection)(int) ((XPointer)XawToggleGetCurrent(search->left_toggle) - + R_OFFSET); + /* CONSTCOND */ + while (TRUE) { + if (count != 0) { + new_pos = XawTextSearch( tw, dir, &find); + + if ( (new_pos == XawTextSearchError) ) { + if (count == 0) { + char msg[BUFSIZ]; + + /* The Raw string in find.ptr may be WC I can't use here, + so I call GetString to get a tame version.*/ + + (void) sprintf( msg, "%s %s %s", "*** Error: Could not find string ``", + GetString( search->search_text ), "''. ***"); + SetSearchLabels(search, msg, "", TRUE); + return(FALSE); + } + else + break; + } + pos = new_pos; + end_pos = pos + find.length; + } + else { + XawTextGetSelectionPos(tw, &pos, &end_pos); + + if (search->selection_changed) { + SetSearchLabels(search, "Selection has been modified, aborting.", + "", TRUE); + return(FALSE); + } + if (pos == end_pos) + return(FALSE); + } + + if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) { + char msg[BUFSIZ]; + + (void) sprintf( msg, "'%s' with '%s'. ***", find.ptr, replace.ptr); + SetSearchLabels(search, "*** Error while replacing", msg, TRUE); + return(FALSE); + } + + if (dir == XawsdRight) + XawTextSetInsertionPoint( tw, pos + replace.length); + else + XawTextSetInsertionPoint( tw, pos); + + if (once_only) + if (show_current) + break; + else { + DoSearch(search); + return(TRUE); + } + count++; + } + + if (replace.length == 0) + XawTextUnsetSelection(tw); + else + XawTextSetSelection( tw, pos, pos + replace.length); + + return(TRUE); +} + +/* Function Name: SetSearchLabels + * Description: Sets both the search labels, and also rings the bell + * Arguments: search - the search structure. + * msg1, msg2 - message to put in each search label. + * bell - if TRUE then ring bell. + * Returns: none. + */ + +static void +SetSearchLabels(search, msg1, msg2, bell) +struct SearchAndReplace * search; +String msg1, msg2; +Boolean bell; +{ + (void) SetResource( search->label1, XtNlabel, (XtArgVal) msg1); + (void) SetResource( search->label2, XtNlabel, (XtArgVal) msg2); + if (bell) + XBell(XtDisplay(search->search_popup), 0); +} + +/************************************************************ + * + * This section of the file contains utility routines used by + * other functions in this file. + * + ************************************************************/ + + +/* Function Name: _XawTextSetField + * Description: Action routine that can be bound to dialog box's + * Text Widget that will send input to the field specified. + * Arguments: (Standard Action Routine args) + * Returns: none. + */ + +/* ARGSUSED */ +void +_XawTextSetField(w, event, params, num_params) +Widget w; +XEvent *event; +String * params; +Cardinal * num_params; +{ + struct SearchAndReplace * search; + Widget new, old; + + search = ((TextWidget) XtParent(XtParent(XtParent(w))))->text.search; + + if (*num_params != 1) { + SetSearchLabels(search, "*** Error: SetField Action must have", + "exactly one argument. ***", TRUE); + return; + } + switch (params[0][0]) { + case 's': + case 'S': + new = search->search_text; + old = search->rep_text; + break; + case 'r': + case 'R': + old = search->search_text; + new = search->rep_text; + break; + default: + SetSearchLabels(search, "*** Error: SetField Action's first Argument must", + "be either 'Search' or 'Replace'. ***", TRUE); + return; + } + _SetField(new, old); +} + +/* Function Name: SetField + * Description: Sets the current text field. + * Arguments: new, old - new and old text fields. + * Returns: none + */ + +static void +_SetField(new, old) +Widget new, old; +{ + Arg args[2]; + Pixel new_border, old_border, old_bg; + + if (!XtIsSensitive(new)) { + XBell(XtDisplay(old), 0); /* Don't set field to an inactive Widget. */ + return; + } + + XtSetKeyboardFocus(XtParent(new), new); + + XtSetArg(args[0], XtNborderColor, &old_border); + XtSetArg(args[1], XtNbackground, &old_bg); + XtGetValues(new, args, TWO); + + XtSetArg(args[0], XtNborderColor, &new_border); + XtGetValues(old, args, ONE); + + if (old_border != old_bg) /* Colors are already correct, return. */ + return; + + SetResource(old, XtNborderColor, (XtArgVal) old_border); + SetResource(new, XtNborderColor, (XtArgVal) new_border); +} + +/* Function Name: SetResourceByName + * Description: Sets a resource in any of the dialog children given + * name of the child and the shell widget of the dialog. + * Arguments: shell - shell widget of the popup. + * name - name of the child. + * res_name - name of the resource. + * value - the value of the resource. + * Returns: TRUE if sucessful. + */ + +static Boolean +SetResourceByName(shell, name, res_name, value) +Widget shell; +char * name, * res_name; +XtArgVal value; +{ + Widget temp_widget; + char buf[BUFSIZ]; + + (void) sprintf(buf, "%s.%s", FORM_NAME, name); + + if ( (temp_widget = XtNameToWidget(shell, buf)) != NULL) { + SetResource(temp_widget, res_name, value); + return(TRUE); + } + return(FALSE); +} + +/* Function Name: SetResource + * Description: Sets a resource in a widget + * Arguments: w - the widget. + * res_name - name of the resource. + * value - the value of the resource. + * Returns: none. + */ + +static void +SetResource(w, res_name, value) +Widget w; +char * res_name; +XtArgVal value; +{ + Arg args[1]; + + XtSetArg(args[0], res_name, value); + XtSetValues( w, args, ONE ); +} + +/* Function Name: GetString{Raw} + * Description: Gets the value for the string in the popup. + * Arguments: text - the text widget whose string we will get. + * + * GetString returns the string as a MB. + * GetStringRaw returns the exact buffer contents suitable for a search. + * + */ + +static String +GetString(text) +Widget text; +{ + String string; + Arg args[1]; + + XtSetArg( args[0], XtNstring, &string ); + XtGetValues( text, args, ONE ); + return(string); +} + +static String +GetStringRaw(tw) +Widget tw; +{ + TextWidget ctx = (TextWidget)tw; + XawTextPosition last; + char *_XawTextGetText(); + + last = XawTextSourceScan(ctx->text.source, 0, XawstAll, XawsdRight, + ctx->text.mult, TRUE); + return (_XawTextGetText(ctx, 0, last)); +} + +/* Function Name: CenterWidgetOnPoint. + * Description: Centers a shell widget on a point relative to + * the root window. + * Arguments: w - the shell widget. + * event - event containing the location of the point + * Returns: none. + * + * NOTE: The widget is not allowed to go off the screen. + */ + +static void +CenterWidgetOnPoint(w, event) +Widget w; +XEvent *event; +{ + Arg args[3]; + Cardinal num_args; + Dimension width, height, b_width; + Position x = 0, y = 0, max_x, max_y; + + if (event != NULL) { + switch (event->type) { + case ButtonPress: + case ButtonRelease: + x = event->xbutton.x_root; + y = event->xbutton.y_root; + break; + case KeyPress: + case KeyRelease: + x = event->xkey.x_root; + y = event->xkey.y_root; + break; + default: + return; + } + } + + num_args = 0; + XtSetArg(args[num_args], XtNwidth, &width); num_args++; + XtSetArg(args[num_args], XtNheight, &height); num_args++; + XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++; + XtGetValues(w, args, num_args); + + width += 2 * b_width; + height += 2 * b_width; + + x -= ( (Position) width/2 ); + if (x < 0) x = 0; + if ( x > (max_x = (Position) (XtScreen(w)->width - width)) ) x = max_x; + + y -= ( (Position) height/2 ); + if (y < 0) y = 0; + if ( y > (max_y = (Position) (XtScreen(w)->height - height)) ) y = max_y; + + num_args = 0; + XtSetArg(args[num_args], XtNx, x); num_args++; + XtSetArg(args[num_args], XtNy, y); num_args++; + XtSetValues(w, args, num_args); +} + +/* Function Name: CreateDialog + * Description: Actually creates a dialog. + * Arguments: parent - the parent of the dialog - the main text widget. + * ptr - initial_string for the dialog. + * name - name of the dialog. + * func - function to create the children of the dialog. + * Returns: the popup shell of the dialog. + * + * NOTE: + * + * The function argument is passed the following arguements. + * + * form - the from widget that is the dialog. + * ptr - the initial string for the dialog's text widget. + * parent - the parent of the dialog - the main text widget. + */ + +static Widget +CreateDialog(parent, ptr, name, func) +Widget parent; +String ptr, name; +void (*func)(); +{ + Widget popup, form; + Arg args[8]; + Cardinal num_args; + ShellWidget parsh=GetShell(parent); + + num_args = 0; + XtSetArg(args[num_args], XtNiconName, name); num_args++; + XtSetArg(args[num_args], XtNgeometry, NULL); num_args++; + XtSetArg(args[num_args], XtNallowShellResize, TRUE); num_args++; + XtSetArg(args[num_args], XtNtransientFor, GetShell(parent)); num_args++; + XtSetArg(args[num_args], XtNvisual, parsh->shell.visual); num_args++; + XtSetArg(args[num_args], XtNcolormap, parsh->core.colormap); num_args++; + XtSetArg(args[num_args], XtNborderPixmap, parsh->core.border_pixmap); num_args++; + popup = XtCreatePopupShell(name, transientShellWidgetClass, + parent, args, num_args); + + form = XtCreateManagedWidget(FORM_NAME, formWidgetClass, popup, + (ArgList)NULL, ZERO); + XtManageChild (form); + + (*func) (form, ptr, parent); + return(popup); +} + + /* Function Name: GetShell + * Description: Walks up the widget hierarchy to find the + * nearest shell widget. + * Arguments: w - the widget whose parent shell should be returned. + * Returns: The shell widget among the ancestors of w that is the + * fewest levels up in the widget hierarchy. + */ + +static Widget +GetShell(w) +Widget w; +{ + while ((w != NULL) && !XtIsShell(w)) + w = XtParent(w); + + return (w); +} + +static Boolean InParams(str, p, n) + String str; + String *p; + Cardinal n; +{ + int i; + for (i=0; i < n; p++, i++) + if (! XmuCompareISOLatin1(*p, str)) return True; + return False; +} + +static char *WM_DELETE_WINDOW = "WM_DELETE_WINDOW"; + +static void WMProtocols(w, event, params, num_params) + Widget w; /* popup shell */ + XEvent *event; + String *params; + Cardinal *num_params; +{ + Atom wm_delete_window; + Atom wm_protocols; + + wm_delete_window = XInternAtom(XtDisplay(w), WM_DELETE_WINDOW, True); + wm_protocols = XInternAtom(XtDisplay(w), "WM_PROTOCOLS", True); + + /* Respond to a recognized WM protocol request iff + * event type is ClientMessage and no parameters are passed, or + * event type is ClientMessage and event data is matched to parameters, or + * event type isn't ClientMessage and parameters make a request. + */ +#define DO_DELETE_WINDOW InParams(WM_DELETE_WINDOW, params, *num_params) + + if ((event->type == ClientMessage && + event->xclient.message_type == wm_protocols && + event->xclient.data.l[0] == wm_delete_window && + (*num_params == 0 || DO_DELETE_WINDOW)) + || + (event->type != ClientMessage && DO_DELETE_WINDOW)) { + +#undef DO_DELETE_WINDOW + + Widget cancel; + char descendant[DISMISS_NAME_LEN + 2]; + (void) sprintf(descendant, "*%s", DISMISS_NAME); + cancel = XtNameToWidget(w, descendant); + if (cancel) XtCallCallbacks(cancel, XtNcallback, (XtPointer)NULL); + } +} + +static void SetWMProtocolTranslations(w) + Widget w; /* realized popup shell */ +{ + int i; + XtAppContext app_context; + Atom wm_delete_window; + static XtTranslations compiled_table; /* initially 0 */ + static XtAppContext *app_context_list; /* initially 0 */ + static Cardinal list_size; /* initially 0 */ + + app_context = XtWidgetToApplicationContext(w); + + /* parse translation table once */ + if (! compiled_table) compiled_table = XtParseTranslationTable + ("<Message>WM_PROTOCOLS: XawWMProtocols()\n"); + + /* add actions once per application context */ + for (i=0; i < list_size && app_context_list[i] != app_context; i++) ; + if (i == list_size) { + XtActionsRec actions[1]; + actions[0].string = "XawWMProtocols"; + actions[0].proc = WMProtocols; + list_size++; + app_context_list = (XtAppContext *) XtRealloc + ((char *)app_context_list, list_size * sizeof(XtAppContext)); + XtAppAddActions(app_context, actions, 1); + app_context_list[i] = app_context; + } + + /* establish communication between the window manager and each shell */ + XtAugmentTranslations(w, compiled_table); + wm_delete_window = XInternAtom(XtDisplay(w), WM_DELETE_WINDOW, False); + (void) XSetWMProtocols(XtDisplay(w), XtWindow(w), &wm_delete_window, 1); +} diff --git a/vendor/x11iraf/xaw3d/TextSink.c b/vendor/x11iraf/xaw3d/TextSink.c new file mode 100644 index 00000000..7c7e2a9b --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextSink.c @@ -0,0 +1,779 @@ +/* $XConsortium: TextSink.c,v 1.19 94/04/17 20:13:11 kaleb Exp $ */ +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* + * Author: Chris Peterson, MIT X Consortium. + * + * Much code taken from X11R3 AsciiSink. + */ + +/* + * TextSink.c - TextSink object. (For use with the text widget). + * + */ + +#include <stdio.h> +#include <ctype.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/TextSinkP.h> +#include <X11/Xaw3d/TextP.h> + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +static void ClassPartInitialize(), Initialize(), Destroy(); +static Boolean SetValues(); + +static int MaxHeight(), MaxLines(); +static void DisplayText(), InsertCursor(), ClearToBackground(), FindPosition(); +static void FindDistance(), Resolve(), SetTabs(), GetCursorBounds(); + +#define offset(field) XtOffsetOf(TextSinkRec, text_sink.field) +static XtResource resources[] = { + {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), + offset(foreground), XtRString, XtDefaultForeground}, + {XtNbackground, XtCBackground, XtRPixel, sizeof (Pixel), + offset(background), XtRString, XtDefaultBackground}, +}; +#undef offset + +#define SuperClass (&objectClassRec) +TextSinkClassRec textSinkClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "TextSink", + /* widget_size */ sizeof(TextSinkRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* obj1 */ NULL, + /* obj2 */ NULL, + /* obj3 */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* obj4 */ FALSE, + /* obj5 */ FALSE, + /* obj6 */ FALSE, + /* obj7 */ FALSE, + /* destroy */ Destroy, + /* obj8 */ NULL, + /* obj9 */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* obj10 */ NULL, + /* get_values_hook */ NULL, + /* obj11 */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* obj12 */ NULL, + /* obj13 */ NULL, + /* obj14 */ NULL, + /* extension */ NULL + }, +/* textSink_class fields */ + { + /* DisplayText */ DisplayText, + /* InsertCursor */ InsertCursor, + /* ClearToBackground */ ClearToBackground, + /* FindPosition */ FindPosition, + /* FindDistance */ FindDistance, + /* Resolve */ Resolve, + /* MaxLines */ MaxLines, + /* MaxHeight */ MaxHeight, + /* SetTabs */ SetTabs, + /* GetCursorBounds */ GetCursorBounds, + } +}; + +WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec; + +static void +ClassPartInitialize(wc) +WidgetClass wc; +{ + TextSinkObjectClass t_src, superC; + + t_src = (TextSinkObjectClass) wc; + superC = (TextSinkObjectClass) t_src->object_class.superclass; + +/* + * We don't need to check for null super since we'll get to TextSink + * eventually. + */ + + if (t_src->text_sink_class.DisplayText == XtInheritDisplayText) + t_src->text_sink_class.DisplayText = superC->text_sink_class.DisplayText; + + if (t_src->text_sink_class.InsertCursor == XtInheritInsertCursor) + t_src->text_sink_class.InsertCursor = + superC->text_sink_class.InsertCursor; + + if (t_src->text_sink_class.ClearToBackground== XtInheritClearToBackground) + t_src->text_sink_class.ClearToBackground = + superC->text_sink_class.ClearToBackground; + + if (t_src->text_sink_class.FindPosition == XtInheritFindPosition) + t_src->text_sink_class.FindPosition = + superC->text_sink_class.FindPosition; + + if (t_src->text_sink_class.FindDistance == XtInheritFindDistance) + t_src->text_sink_class.FindDistance = + superC->text_sink_class.FindDistance; + + if (t_src->text_sink_class.Resolve == XtInheritResolve) + t_src->text_sink_class.Resolve = superC->text_sink_class.Resolve; + + if (t_src->text_sink_class.MaxLines == XtInheritMaxLines) + t_src->text_sink_class.MaxLines = superC->text_sink_class.MaxLines; + + if (t_src->text_sink_class.MaxHeight == XtInheritMaxHeight) + t_src->text_sink_class.MaxHeight = superC->text_sink_class.MaxHeight; + + if (t_src->text_sink_class.SetTabs == XtInheritSetTabs) + t_src->text_sink_class.SetTabs = superC->text_sink_class.SetTabs; + + if (t_src->text_sink_class.GetCursorBounds == XtInheritGetCursorBounds) + t_src->text_sink_class.GetCursorBounds = + superC->text_sink_class.GetCursorBounds; +} + +/* Function Name: Initialize + * Description: Initializes the TextSink Object. + * Arguments: request, new - the requested and new values for the object + * instance. + * Returns: none. + * + */ + +/* ARGSUSED */ +static void +Initialize(request, new, args, num_args) +Widget request, new; +ArgList args; +Cardinal *num_args; +{ + TextSinkObject sink = (TextSinkObject) new; + + sink->text_sink.tab_count = 0; /* Initialize the tab stops. */ + sink->text_sink.tabs = NULL; + sink->text_sink.char_tabs = NULL; +} + +/* Function Name: Destroy + * Description: This function cleans up when the object is + * destroyed. + * Arguments: w - the TextSink Object. + * Returns: none. + */ + +static void +Destroy(w) +Widget w; +{ + TextSinkObject sink = (TextSinkObject) w; + + XtFree((char *) sink->text_sink.tabs); + XtFree((char *) sink->text_sink.char_tabs); +} + +/* Function Name: SetValues + * Description: Sets the values for the TextSink + * Arguments: current - current state of the object. + * request - what was requested. + * new - what the object will become. + * Returns: True if redisplay is needed. + */ + +/* ARGSUSED */ +static Boolean +SetValues(current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + TextSinkObject w = (TextSinkObject) new; + TextSinkObject old_w = (TextSinkObject) current; + + if (w->text_sink.foreground != old_w->text_sink.foreground) + ((TextWidget)XtParent(new))->text.redisplay_needed = True; + + return FALSE; +} + +/************************************************************ + * + * Class specific methods. + * + ************************************************************/ + +/* Function Name: DisplayText + * Description: Stub function that in subclasses will display text. + * Arguments: w - the TextSink Object. + * x, y - location to start drawing text. + * pos1, pos2 - location of starting and ending points + * in the text buffer. + * highlight - hightlight this text? + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +/* ARGSUSED */ +static void +DisplayText(w, x, y, pos1, pos2, highlight) +Widget w; +Position x, y; +Boolean highlight; +XawTextPosition pos1, pos2; +{ + return; +} + +/* Function Name: InsertCursor + * Description: Places the InsertCursor. + * Arguments: w - the TextSink Object. + * x, y - location for the cursor. + * staye - whether to turn the cursor on, or off. + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +/* ARGSUSED */ +static void +InsertCursor(w, x, y, state) +Widget w; +Position x, y; +XawTextInsertState state; +{ + return; +} + +/* Function Name: ClearToBackground + * Description: Clears a region of the sink to the background color. + * Arguments: w - the TextSink Object. + * x, y - location of area to clear. + * width, height - size of area to clear + * Returns: void. + * + */ + +/* ARGSUSED */ +static void +ClearToBackground (w, x, y, width, height) +Widget w; +Position x, y; +Dimension width, height; +{ +/* + * Don't clear in height or width are zero. + * XClearArea() has special semantic for these values. + */ + + if ( (height == 0) || (width == 0) ) return; + XClearArea(XtDisplayOfObject(w), XtWindowOfObject(w), + x, y, width, height, False); +} + +/* Function Name: FindPosition + * Description: Finds a position in the text. + * Arguments: w - the TextSink Object. + * fromPos - reference position. + * fromX - reference location. + * width, - width of section to paint text. + * stopAtWordBreak - returned position is a word break? + * resPos - Position to return. *** RETURNED *** + * resWidth - Width actually used. *** RETURNED *** + * resHeight - Height actually used. *** RETURNED *** + * Returns: none (see above). + */ + +/* ARGSUSED */ +static void +FindPosition(w, fromPos, fromx, width, stopAtWordBreak, + resPos, resWidth, resHeight) +Widget w; +XawTextPosition fromPos; +int fromx, width; +Boolean stopAtWordBreak; +XawTextPosition *resPos; +int *resWidth, *resHeight; +{ + *resPos = fromPos; + *resHeight = *resWidth = 0; +} + +/* Function Name: FindDistance + * Description: Find the Pixel Distance between two text Positions. + * Arguments: w - the TextSink Object. + * fromPos - starting Position. + * fromX - x location of starting Position. + * toPos - end Position. + * resWidth - Distance between fromPos and toPos. + * resPos - Acutal toPos used. + * resHeight - Height required by this text. + * Returns: none. + */ + +/* ARGSUSED */ +static void +FindDistance (w, fromPos, fromx, toPos, resWidth, resPos, resHeight) +Widget w; +XawTextPosition fromPos; +int fromx; +XawTextPosition toPos; +int *resWidth; +XawTextPosition *resPos; +int *resHeight; +{ + *resWidth = *resHeight = 0; + *resPos = fromPos; +} + +/* Function Name: Resolve + * Description: Resloves a location to a position. + * Arguments: w - the TextSink Object. + * pos - a reference Position. + * fromx - a reference Location. + * width - width to move. + * resPos - the resulting position. + * Returns: none + */ + +/* ARGSUSED */ +static void +Resolve (w, pos, fromx, width, resPos) +Widget w; +XawTextPosition pos; +int fromx, width; +XawTextPosition *resPos; +{ + *resPos = pos; +} + +/* Function Name: MaxLines + * Description: Finds the Maximum number of lines that will fit in + * a given height. + * Arguments: w - the TextSink Object. + * height - height to fit lines into. + * Returns: the number of lines that will fit. + */ + +/* ARGSUSED */ +static int +MaxLines(w, height) +Widget w; +Dimension height; +{ + /* + * The fontset has gone down to descent Sink Widget, so + * the functions such MaxLines, SetTabs... are bound to the descent. + * + * by Li Yuhong, Jan. 15, 1991 + */ + return 0; +} + +/* Function Name: MaxHeight + * Description: Finds the Minium height that will contain a given number + * lines. + * Arguments: w - the TextSink Object. + * lines - the number of lines. + * Returns: the height. + */ + +/* ARGSUSED */ +static int +MaxHeight(w, lines) +Widget w; +int lines; +{ + return 0; +} + +/* Function Name: SetTabs + * Description: Sets the Tab stops. + * Arguments: w - the TextSink Object. + * tab_count - the number of tabs in the list. + * tabs - the text positions of the tabs. + * Returns: none + */ + +/*ARGSUSED*/ +static void +SetTabs(w, tab_count, tabs) +Widget w; +int tab_count; +short *tabs; +{ + return; +} + +/* Function Name: GetCursorBounds + * Description: Finds the bounding box for the insert curor (caret). + * Arguments: w - the TextSinkObject. + * rect - an X rectance containing the cursor bounds. + * Returns: none (fills in rect). + */ + +/* ARGSUSED */ +static void +GetCursorBounds(w, rect) +Widget w; +XRectangle * rect; +{ + rect->x = rect->y = rect->width = rect->height = 0; +} +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + + +/* Function Name: XawTextSinkDisplayText + * Description: Stub function that in subclasses will display text. + * Arguments: w - the TextSink Object. + * x, y - location to start drawing text. + * pos1, pos2 - location of starting and ending points + * in the text buffer. + * highlight - hightlight this text? + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkDisplayText(Widget w, +#if NeedWidePrototypes + /* Position */ int x, /* Position */ int y, +#else + Position x, Position y, +#endif + XawTextPosition pos1, XawTextPosition pos2, +#if NeedWidePrototypes + /* Boolean */ int highlight) +#else + Boolean highlight) +#endif +#else +XawTextSinkDisplayText(w, x, y, pos1, pos2, highlight) +Widget w; +Position x, y; +Boolean highlight; +XawTextPosition pos1, pos2; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.DisplayText)(w, x, y, pos1, pos2, highlight); +} + +/* Function Name: XawTextSinkInsertCursor + * Description: Places the InsertCursor. + * Arguments: w - the TextSink Object. + * x, y - location for the cursor. + * staye - whether to turn the cursor on, or off. + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkInsertCursor(Widget w, +#if NeedWidePrototypes + int x, int y, int state) +#else + Position x, Position y, XawTextInsertState state) +#endif +#else +XawTextSinkInsertCursor(w, x, y, state) +Widget w; +Position x, y; +XawTextInsertState state; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.InsertCursor)(w, x, y, state); +} + + +/* Function Name: XawTextSinkClearToBackground + * Description: Clears a region of the sink to the background color. + * Arguments: w - the TextSink Object. + * x, y - location of area to clear. + * width, height - size of area to clear + * Returns: void. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkClearToBackground (Widget w, +#if NeedWidePrototypes + int x, int y, int width, int height) +#else + Position x, Position y, + Dimension width, Dimension height) +#endif +#else +XawTextSinkClearToBackground (w, x, y, width, height) +Widget w; +Position x, y; +Dimension width, height; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.ClearToBackground)(w, x, y, width, height); +} + +/* Function Name: XawTextSinkFindPosition + * Description: Finds a position in the text. + * Arguments: w - the TextSink Object. + * fromPos - reference position. + * fromX - reference location. + * width, - width of section to paint text. + * stopAtWordBreak - returned position is a word break? + * resPos - Position to return. *** RETURNED *** + * resWidth - Width actually used. *** RETURNED *** + * resHeight - Height actually used. *** RETURNED *** + * Returns: none (see above). + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkFindPosition(Widget w, XawTextPosition fromPos, int fromx, + int width, +#if NeedWidePrototypes + /* Boolean */ int stopAtWordBreak, +#else + Boolean stopAtWordBreak, +#endif + XawTextPosition *resPos, int *resWidth, int *resHeight) +#else +XawTextSinkFindPosition(w, fromPos, fromx, width, stopAtWordBreak, + resPos, resWidth, resHeight) +Widget w; +XawTextPosition fromPos; +int fromx, width; +Boolean stopAtWordBreak; +XawTextPosition *resPos; +int *resWidth, *resHeight; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.FindPosition)(w, fromPos, fromx, width, + stopAtWordBreak, + resPos, resWidth, resHeight); +} + +/* Function Name: XawTextSinkFindDistance + * Description: Find the Pixel Distance between two text Positions. + * Arguments: w - the TextSink Object. + * fromPos - starting Position. + * fromX - x location of starting Position. + * toPos - end Position. + * resWidth - Distance between fromPos and toPos. + * resPos - Acutal toPos used. + * resHeight - Height required by this text. + * Returns: none. + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkFindDistance (Widget w, XawTextPosition fromPos, int fromx, + XawTextPosition toPos, int *resWidth, + XawTextPosition *resPos, int *resHeight) +#else +XawTextSinkFindDistance (w, fromPos, fromx, toPos, resWidth, resPos, resHeight) +Widget w; +XawTextPosition fromPos, toPos, *resPos; +int fromx, *resWidth, *resHeight; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.FindDistance)(w, fromPos, fromx, toPos, + resWidth, resPos, resHeight); +} + +/* Function Name: XawTextSinkResolve + * Description: Resloves a location to a position. + * Arguments: w - the TextSink Object. + * pos - a reference Position. + * fromx - a reference Location. + * width - width to move. + * resPos - the resulting position. + * Returns: none + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkResolve(Widget w, XawTextPosition pos, int fromx, int width, + XawTextPosition *resPos) +#else +XawTextSinkResolve(w, pos, fromx, width, resPos) +Widget w; +XawTextPosition pos; +int fromx, width; +XawTextPosition *resPos; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.Resolve)(w, pos, fromx, width, resPos); +} + +/* Function Name: XawTextSinkMaxLines + * Description: Finds the Maximum number of lines that will fit in + * a given height. + * Arguments: w - the TextSink Object. + * height - height to fit lines into. + * Returns: the number of lines that will fit. + */ + +/* ARGSUSED */ +int +#if NeedFunctionPrototypes +XawTextSinkMaxLines(Widget w, +#if NeedWidePrototypes + /* Dimension */ int height) +#else + Dimension height) +#endif +#else +XawTextSinkMaxLines(w, height) +Widget w; +Dimension height; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + return((*class->text_sink_class.MaxLines)(w, height)); +} + +/* Function Name: XawTextSinkMaxHeight + * Description: Finds the Minimum height that will contain a given number + * lines. + * Arguments: w - the TextSink Object. + * lines - the number of lines. + * Returns: the height. + */ + +/* ARGSUSED */ +int +#if NeedFunctionPrototypes +XawTextSinkMaxHeight(Widget w, int lines) +#else +XawTextSinkMaxHeight(w, lines) +Widget w; +int lines; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + return((*class->text_sink_class.MaxHeight)(w, lines)); +} + +/* Function Name: XawTextSinkSetTabs + * Description: Sets the Tab stops. + * Arguments: w - the TextSink Object. + * tab_count - the number of tabs in the list. + * tabs - the text positions of the tabs. + * Returns: none + */ + +void +#if NeedFunctionPrototypes +XawTextSinkSetTabs(Widget w, int tab_count, int *tabs) +#else +XawTextSinkSetTabs(w, tab_count, tabs) +Widget w; +int tab_count, *tabs; +#endif +{ + if (tab_count > 0) { + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + short *char_tabs = (short*)XtMalloc( (unsigned)tab_count*sizeof(short) ); + short *tab; + int i; + + for (i = tab_count, tab = char_tabs; i; i--) *tab++ = (short)*tabs++; + + (*class->text_sink_class.SetTabs)(w, tab_count, char_tabs); + XtFree((char *)char_tabs); + } +} + +/* Function Name: XawTextSinkGetCursorBounds + * Description: Finds the bounding box for the insert curor (caret). + * Arguments: w - the TextSinkObject. + * rect - an X rectance containing the cursor bounds. + * Returns: none (fills in rect). + */ + +/* ARGSUSED */ +void +#if NeedFunctionPrototypes +XawTextSinkGetCursorBounds(Widget w, XRectangle *rect) +#else +XawTextSinkGetCursorBounds(w, rect) +Widget w; +XRectangle * rect; +#endif +{ + TextSinkObjectClass class = (TextSinkObjectClass) w->core.widget_class; + + (*class->text_sink_class.GetCursorBounds)(w, rect); +} diff --git a/vendor/x11iraf/xaw3d/TextSink.h b/vendor/x11iraf/xaw3d/TextSink.h new file mode 100644 index 00000000..957938bc --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextSink.h @@ -0,0 +1,317 @@ +/* + * $XConsortium: TextSink.h,v 1.10 94/04/17 20:13:12 kaleb Exp $ + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawTextSink_h +#define _XawTextSink_h + +#include <X11/Xaw3d/Text.h> + +/*********************************************************************** + * + * TextSink Object + * + ***********************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + foreground Foreground Pixel XtDefaultForeground + background Background Pixel XtDefaultBackground + +*/ + +/* Class record constants */ + +extern WidgetClass textSinkObjectClass; + +typedef struct _TextSinkClassRec *TextSinkObjectClass; +typedef struct _TextSinkRec *TextSinkObject; + +typedef enum {XawisOn, XawisOff} XawTextInsertState; + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawTextSinkDisplayText + * Description: Stub function that in subclasses will display text. + * Arguments: w - the TextSink Object. + * x, y - location to start drawing text. + * pos1, pos2 - location of starting and ending points + * in the text buffer. + * highlight - hightlight this text? + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +extern void XawTextSinkDisplayText( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Position */ int /* x */, + /* Position */ int /* y */, +#else + Position /* x */, + Position /* y */, +#endif + XawTextPosition /* pos1 */, + XawTextPosition /* pos2 */, +#if NeedWidePrototypes + /* Boolean */ int /* highlight */ +#else + Boolean /* highlight */ +#endif +#endif +); + +/* Function Name: XawTextSinkInsertCursor + * Description: Places the InsertCursor. + * Arguments: w - the TextSink Object. + * x, y - location for the cursor. + * staye - whether to turn the cursor on, or off. + * Returns: none. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +extern void XawTextSinkInsertCursor( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Position */ int /* x */, + /* Position */ int /* y */, + /* XawTextInsertState */ int /* state */ +#else + Position /* x */, + Position /* y */, + XawTextInsertState /* state */ +#endif +#endif +); + +/* Function Name: XawTextSinkClearToBackground + * Description: Clears a region of the sink to the background color. + * Arguments: w - the TextSink Object. + * x, y - location of area to clear. + * width, height - size of area to clear + * Returns: void. + * + * This function doesn't actually display anything, it is only a place + * holder. + */ + +extern void XawTextSinkClearToBackground( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Position */ int /* x */, + /* Position */ int /* y */, + /* Dimension */ int /* width */, + /* Dimension */ int /* height */ +#else + Position /* x */, + Position /* y */, + Dimension /* width */, + Dimension /* height */ +#endif +#endif +); + +/* Function Name: XawTextSinkFindPosition + * Description: Finds a position in the text. + * Arguments: w - the TextSink Object. + * fromPos - reference position. + * fromX - reference location. + * width, - width of section to paint text. + * stopAtWordBreak - returned position is a word break? + * resPos - Position to return. *** RETURNED *** + * resWidth - Width actually used. *** RETURNED *** + * resHeight - Height actually used. *** RETURNED *** + * Returns: none (see above). + */ + +extern void XawTextSinkFindPosition( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* fromPos */, + int /* fromX */, + int /* width */, +#if NeedWidePrototypes + /* Boolean */ int /* stopAtWordBreak */, +#else + Boolean /* stopAtWordBreak */, +#endif + XawTextPosition* /* pos_return */, + int* /* width_return */, + int* /* height_return */ +#endif +); + +/* Function Name: XawTextSinkFindDistance + * Description: Find the Pixel Distance between two text Positions. + * Arguments: w - the TextSink Object. + * fromPos - starting Position. + * fromX - x location of starting Position. + * toPos - end Position. + * resWidth - Distance between fromPos and toPos. + * resPos - Acutal toPos used. + * resHeight - Height required by this text. + * Returns: none. + */ + +extern void XawTextSinkFindDistance ( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* fromPos */, + int /* fromX */, + XawTextPosition /* toPos */, + int* /* width_return */, + XawTextPosition* /* pos_return */, + int* /* height_return */ +#endif +); + +/* Function Name: XawTextSinkResolve + * Description: Resloves a location to a position. + * Arguments: w - the TextSink Object. + * pos - a reference Position. + * fromx - a reference Location. + * width - width to move. + * resPos - the resulting position. + * Returns: none + */ + +extern void XawTextSinkResolve( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* fromPos */, + int /* fromX */, + int /* width */, + XawTextPosition* /* pos_return */ +#endif +); + +/* Function Name: XawTextSinkMaxLines + * Description: Finds the Maximum number of lines that will fit in + * a given height. + * Arguments: w - the TextSink Object. + * height - height to fit lines into. + * Returns: the number of lines that will fit. + */ + +extern int XawTextSinkMaxLines( +#if NeedFunctionPrototypes + Widget /* w */, +#if NeedWidePrototypes + /* Dimension */ int /* height */ +#else + Dimension /* height */ +#endif +#endif +); + +/* Function Name: XawTextSinkMaxHeight + * Description: Finds the Minium height that will contain a given number + * lines. + * Arguments: w - the TextSink Object. + * lines - the number of lines. + * Returns: the height. + */ + +extern int XawTextSinkMaxHeight( +#if NeedFunctionPrototypes + Widget /* w */, + int /* lines */ +#endif +); + +/* Function Name: XawTextSinkSetTabs + * Description: Sets the Tab stops. + * Arguments: w - the TextSink Object. + * tab_count - the number of tabs in the list. + * tabs - the text positions of the tabs. + * Returns: none + */ + +extern void XawTextSinkSetTabs( +#if NeedFunctionPrototypes + Widget /* w */, + int /* tab_count */, + int* /* tabs */ +#endif +); + +/* Function Name: XawTextSinkGetCursorBounds + * Description: Finds the bounding box for the insert curor (caret). + * Arguments: w - the TextSinkObject. + * rect - an X rectance containing the cursor bounds. + * Returns: none (fills in rect). + */ + +extern void XawTextSinkGetCursorBounds( +#if NeedFunctionPrototypes + Widget /* w */, + XRectangle* /* rect_return */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawTextSrc_h */ diff --git a/vendor/x11iraf/xaw3d/TextSinkP.h b/vendor/x11iraf/xaw3d/TextSinkP.h new file mode 100644 index 00000000..e45bf755 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextSinkP.h @@ -0,0 +1,143 @@ +/* +* $XConsortium: TextSinkP.h,v 1.6 94/04/17 20:13:13 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * TextSinkP.h - Private definitions for TextSink object + * + */ + +#ifndef _XawTextSinkP_h +#define _XawTextSinkP_h + +/*********************************************************************** + * + * TextSink Object Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/TextSink.h> +#include <X11/Xaw3d/TextP.h> /* This source works with the Text widget. */ +#include <X11/Xaw3d/TextSrcP.h> /* This source works with the Text Source. */ + +/************************************************************ + * + * New fields for the TextSink object class record. + * + ************************************************************/ + +typedef struct _TextSinkClassPart { + void (*DisplayText)(); + void (*InsertCursor)(); + void (*ClearToBackground)(); + void (*FindPosition)(); + void (*FindDistance)(); + void (*Resolve)(); + int (*MaxLines)(); + int (*MaxHeight)(); + void (*SetTabs)(); + void (*GetCursorBounds)(); +} TextSinkClassPart; + +/* Full class record declaration */ +typedef struct _TextSinkClassRec { + ObjectClassPart object_class; + TextSinkClassPart text_sink_class; +} TextSinkClassRec; + +extern TextSinkClassRec textSinkClassRec; + +/* New fields for the TextSink object record */ +typedef struct { + /* resources */ + Pixel foreground; /* Foreground color. */ + Pixel background; /* Background color. */ + + /* private state. */ + Position *tabs; /* The tab stops as pixel values. */ + short *char_tabs; /* The tabs stops as character values. */ + int tab_count; /* number of items in tabs */ + +} TextSinkPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TextSinkRec { + ObjectPart object; + TextSinkPart text_sink; +} TextSinkRec; + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +typedef int (*_XawSinkIntFunc)(); +typedef void (*_XawSinkVoidFunc)(); + +#define XtInheritDisplayText ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritInsertCursor ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritClearToBackground ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritFindPosition ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritFindDistance ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritResolve ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritMaxLines ((_XawSinkIntFunc) _XtInherit) +#define XtInheritMaxHeight ((_XawSinkIntFunc) _XtInherit) +#define XtInheritSetTabs ((_XawSinkVoidFunc) _XtInherit) +#define XtInheritGetCursorBounds ((_XawSinkVoidFunc) _XtInherit) + +#endif /* _XawTextSinkP_h */ diff --git a/vendor/x11iraf/xaw3d/TextSrc.c b/vendor/x11iraf/xaw3d/TextSrc.c new file mode 100644 index 00000000..27255d14 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextSrc.c @@ -0,0 +1,671 @@ +/* $XConsortium: TextSrc.c,v 1.15 94/04/17 20:13:14 kaleb Exp $ */ +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* + * Author: Chris Peterson, MIT X Consortium. + * Much code taken from X11R3 String and Disk Sources. + */ + +/* + * TextSrc.c - TextSrc object. (For use with the text widget). + * + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xutil.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/TextSrcP.h> +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/CharSet.h> +#include "XawI18n.h" +#include <stdio.h> +#include <ctype.h> + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +#define offset(field) XtOffsetOf(TextSrcRec, textSrc.field) +static XtResource resources[] = { + {XtNeditType, XtCEditType, XtREditMode, sizeof(XawTextEditType), + offset(edit_mode), XtRString, "read"}, +}; + +static void ClassInitialize(), ClassPartInitialize(), SetSelection(); +static void CvtStringToEditMode(); +static Boolean ConvertSelection(); +static XawTextPosition Search(), Scan(), Read(); +static int Replace(); + +#define SuperClass (&objectClassRec) +TextSrcClassRec textSrcClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) SuperClass, + /* class_name */ "TextSrc", + /* widget_size */ sizeof(TextSrcRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ NULL, + /* initialize_hook */ NULL, + /* realize */ NULL, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ NULL, + /* expose */ NULL, + /* set_values */ NULL, + /* set_values_hook */ NULL, + /* set_values_almost */ NULL, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ NULL, + /* display_accelerator */ NULL, + /* extension */ NULL, + }, +/* textSrc_class fields */ + { + /* Read */ Read, + /* Replace */ Replace, + /* Scan */ Scan, + /* Search */ Search, + /* SetSelection */ SetSelection, + /* ConvertSelection */ ConvertSelection + } +}; + +WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec; + +static void +ClassInitialize () +{ + XawInitializeWidgetSet (); + XtAddConverter(XtRString, XtREditMode, CvtStringToEditMode, NULL, 0); +} + + +static void +ClassPartInitialize(wc) +WidgetClass wc; +{ + TextSrcObjectClass t_src, superC; + + t_src = (TextSrcObjectClass) wc; + superC = (TextSrcObjectClass) t_src->object_class.superclass; + +/* + * We don't need to check for null super since we'll get to TextSrc + * eventually. + */ + if (t_src->textSrc_class.Read == XtInheritRead) + t_src->textSrc_class.Read = superC->textSrc_class.Read; + + if (t_src->textSrc_class.Replace == XtInheritReplace) + t_src->textSrc_class.Replace = superC->textSrc_class.Replace; + + if (t_src->textSrc_class.Scan == XtInheritScan) + t_src->textSrc_class.Scan = superC->textSrc_class.Scan; + + if (t_src->textSrc_class.Search == XtInheritSearch) + t_src->textSrc_class.Search = superC->textSrc_class.Search; + + if (t_src->textSrc_class.SetSelection == XtInheritSetSelection) + t_src->textSrc_class.SetSelection = superC->textSrc_class.SetSelection; + + if (t_src->textSrc_class.ConvertSelection == XtInheritConvertSelection) + t_src->textSrc_class.ConvertSelection = + superC->textSrc_class.ConvertSelection; +} + +/************************************************************ + * + * Class specific methods. + * + ************************************************************/ + +/* Function Name: Read + * Description: This function reads the source. + * Arguments: w - the TextSrc Object. + * pos - position of the text to retreive. + * RETURNED text - text block that will contain returned text. + * length - maximum number of characters to read. + * Returns: The number of characters read into the buffer. + */ + +/* ARGSUSED */ +static XawTextPosition +Read(w, pos, text, length) +Widget w; +XawTextPosition pos; +XawTextBlock *text; +int length; +{ + XtAppError(XtWidgetToApplicationContext(w), + "TextSrc Object: No read function is defined."); + + return( (XawTextPosition) 0 ); /* for gcc -Wall and lint */ +} + +/* Function Name: Replace. + * Description: Replaces a block of text with new text. + * Arguments: src - the Text Source Object. + * startPos, endPos - ends of text that will be removed. + * text - new text to be inserted into buffer at startPos. + * Returns: XawEditError. + */ + +/*ARGSUSED*/ +static int +Replace (w, startPos, endPos, text) +Widget w; +XawTextPosition startPos, endPos; +XawTextBlock *text; +{ + return(XawEditError); +} + +/* Function Name: Scan + * Description: Scans the text source for the number and type + * of item specified. + * Arguments: w - the TextSrc Object. + * position - the position to start scanning. + * type - type of thing to scan for. + * dir - direction to scan. + * count - which occurance if this thing to search for. + * include - whether or not to include the character found in + * the position that is returned. + * Returns: EXITS WITH AN ERROR MESSAGE. + * + */ + +/* ARGSUSED */ +static +XawTextPosition +Scan (w, position, type, dir, count, include) +Widget w; +XawTextPosition position; +XawTextScanType type; +XawTextScanDirection dir; +int count; +Boolean include; +{ + XtAppError(XtWidgetToApplicationContext(w), + "TextSrc Object: No SCAN function is defined."); + + return( (XawTextPosition) 0 ); /* for gcc -Wall and lint */ +} + +/* Function Name: Search + * Description: Searchs the text source for the text block passed + * Arguments: w - the TextSource Object. + * position - the position to start scanning. + * dir - direction to scan. + * text - the text block to search for. + * Returns: XawTextSearchError. + */ + +/* ARGSUSED */ +static XawTextPosition +Search(w, position, dir, text) +Widget w; +XawTextPosition position; +XawTextScanDirection dir; +XawTextBlock * text; +{ + return(XawTextSearchError); +} + +/* Function Name: ConvertSelection + * Description: Dummy selection converter. + * Arguments: w - the TextSrc object. + * selection - the current selection atom. + * target - the current target atom. + * type - the type to conver the selection to. + * RETURNED value, length - the return value that has been converted. + * RETURNED format - the format of the returned value. + * Returns: TRUE if the selection has been converted. + * + */ + +/* ARGSUSED */ +static Boolean +ConvertSelection(w, selection, target, type, value, length, format) +Widget w; +Atom * selection, * target, * type; +XtPointer * value; +unsigned long * length; +int * format; +{ + return(FALSE); +} + +/* Function Name: SetSelection + * Description: allows special setting of the selection. + * Arguments: w - the TextSrc object. + * left, right - bounds of the selection. + * selection - the selection atom. + * Returns: none + */ + +/* ARGSUSED */ +static void +SetSelection(w, left, right, selection) +Widget w; +XawTextPosition left, right; +Atom selection; +{ + /* This space intentionally left blank. */ +} + + +/* ARGSUSED */ +static void +CvtStringToEditMode(args, num_args, fromVal, toVal) +XrmValuePtr args; /* unused */ +Cardinal *num_args; /* unused */ +XrmValuePtr fromVal; +XrmValuePtr toVal; +{ + static XawTextEditType editType; + static XrmQuark QRead, QAppend, QEdit; + XrmQuark q; + char lowerName[40]; + static Boolean inited = FALSE; + + if ( !inited ) { + QRead = XrmPermStringToQuark(XtEtextRead); + QAppend = XrmPermStringToQuark(XtEtextAppend); + QEdit = XrmPermStringToQuark(XtEtextEdit); + inited = TRUE; + } + + if (strlen ((char*) fromVal->addr) < sizeof lowerName) { + XmuCopyISOLatin1Lowered (lowerName, (char *)fromVal->addr); + q = XrmStringToQuark(lowerName); + + if (q == QRead) editType = XawtextRead; + else if (q == QAppend) editType = XawtextAppend; + else if (q == QEdit) editType = XawtextEdit; + else { + toVal->size = 0; + toVal->addr = NULL; + return; + } + toVal->size = sizeof editType; + toVal->addr = (XPointer) &editType; + return; + } + toVal->size = 0; + toVal->addr = NULL; +} + + + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +/* Function Name: XawTextSourceRead + * Description: This function reads the source. + * Arguments: w - the TextSrc Object. + * pos - position of the text to retreive. + * RETURNED text - text block that will contain returned text. + * length - maximum number of characters to read. + * Returns: The number of characters read into the buffer. + */ + +XawTextPosition +#if NeedFunctionPrototypes +XawTextSourceRead(Widget w, XawTextPosition pos, XawTextBlock *text, + int length) +#else +XawTextSourceRead(w, pos, text, length) +Widget w; +XawTextPosition pos; +XawTextBlock *text; +int length; +#endif +{ + TextSrcObjectClass class = (TextSrcObjectClass) w->core.widget_class; + + if ( !XtIsSubclass( w, textSrcObjectClass ) ) + XtErrorMsg("bad argument", "textSource", "XawError", + "XawTextSourceRead's 1st parameter must be subclass of asciiSrc.", + NULL, NULL); + + return((*class->textSrc_class.Read)(w, pos, text, length)); +} + +/* Function Name: XawTextSourceReplace. + * Description: Replaces a block of text with new text. + * Arguments: src - the Text Source Object. + * startPos, endPos - ends of text that will be removed. + * text - new text to be inserted into buffer at startPos. + * Returns: XawEditError or XawEditDone. + */ + +/*ARGSUSED*/ +int +#if NeedFunctionPrototypes +XawTextSourceReplace (Widget w, XawTextPosition startPos, + XawTextPosition endPos, XawTextBlock *text) +#else +XawTextSourceReplace (w, startPos, endPos, text) +Widget w; +XawTextPosition startPos, endPos; +XawTextBlock *text; +#endif +{ + TextSrcObjectClass class = (TextSrcObjectClass) w->core.widget_class; + + if ( !XtIsSubclass( w, textSrcObjectClass ) ) + XtErrorMsg("bad argument", "textSource", "XawError", + "XawTextSourceReplace's 1st parameter must be subclass of asciiSrc.", + NULL, NULL); + + return((*class->textSrc_class.Replace)(w, startPos, endPos, text)); +} + +/* Function Name: XawTextSourceScan + * Description: Scans the text source for the number and type + * of item specified. + * Arguments: w - the TextSrc Object. + * position - the position to start scanning. + * type - type of thing to scan for. + * dir - direction to scan. + * count - which occurance if this thing to search for. + * include - whether or not to include the character found in + * the position that is returned. + * Returns: The position of the text. + * + */ + +XawTextPosition +#if NeedFunctionPrototypes +XawTextSourceScan(Widget w, XawTextPosition position, +#if NeedWidePrototypes + int type, int dir, +#else + XawTextScanType type, XawTextScanDirection dir, +#endif + int count, +#if NeedWidePrototypes + int include) +#else + Boolean include) +#endif +#else +XawTextSourceScan(w, position, type, dir, count, include) +Widget w; +XawTextPosition position; +XawTextScanType type; +XawTextScanDirection dir; +int count; +Boolean include; +#endif +{ + TextSrcObjectClass class = (TextSrcObjectClass) w->core.widget_class; + + if ( !XtIsSubclass( w, textSrcObjectClass ) ) + XtErrorMsg("bad argument", "textSource", "XawError", + "XawTextSourceScan's 1st parameter must be subclass of asciiSrc.", + NULL, NULL); + + return((*class->textSrc_class.Scan)(w, position, type, dir, count, include)); +} + +/* Function Name: XawTextSourceSearch + * Description: Searchs the text source for the text block passed + * Arguments: w - the TextSource Object. + * position - the position to start scanning. + * dir - direction to scan. + * text - the text block to search for. + * Returns: The position of the text we are searching for or + * XawTextSearchError. + */ + +XawTextPosition +#if NeedFunctionPrototypes +XawTextSourceSearch(Widget w, XawTextPosition position, +#if NeedWidePrototypes + int dir, +#else + XawTextScanDirection dir, +#endif + XawTextBlock *text) +#else +XawTextSourceSearch(w, position, dir, text) +Widget w; +XawTextPosition position; +XawTextScanDirection dir; +XawTextBlock * text; +#endif +{ + TextSrcObjectClass class = (TextSrcObjectClass) w->core.widget_class; + + if ( !XtIsSubclass( w, textSrcObjectClass ) ) + XtErrorMsg("bad argument", "textSource", "XawError", + "XawTextSourceSearch's 1st parameter must be subclass of asciiSrc.", + NULL, NULL); + + return((*class->textSrc_class.Search)(w, position, dir, text)); +} + +/* Function Name: XawTextSourceConvertSelection + * Description: Dummy selection converter. + * Arguments: w - the TextSrc object. + * selection - the current selection atom. + * target - the current target atom. + * type - the type to conver the selection to. + * RETURNED value, length - the return value that has been converted. + * RETURNED format - the format of the returned value. + * Returns: TRUE if the selection has been converted. + * + */ + +Boolean +#if NeedFunctionPrototypes +XawTextSourceConvertSelection(Widget w, Atom *selection, Atom *target, + Atom *type, XtPointer *value, + unsigned long *length, int *format) +#else +XawTextSourceConvertSelection(w, selection, + target, type, value, length, format) +Widget w; +Atom * selection, * target, * type; +XtPointer * value; +unsigned long * length; +int * format; +#endif +{ + TextSrcObjectClass class = (TextSrcObjectClass) w->core.widget_class; + + if ( !XtIsSubclass( w, textSrcObjectClass ) ) + XtErrorMsg("bad argument", "textSource", "XawError", + "XawTextSourceConvertSelectionXawTextSourceConvertSelection's 1st parameter must be subclass of asciiSrc.", + NULL, NULL); + + return((*class->textSrc_class.ConvertSelection)(w, selection, target, type, + value, length, format)); +} + +/* Function Name: XawTextSourceSetSelection + * Description: allows special setting of the selection. + * Arguments: w - the TextSrc object. + * left, right - bounds of the selection. + * selection - the selection atom. + * Returns: none + */ + +void +#if NeedFunctionPrototypes +XawTextSourceSetSelection(Widget w, XawTextPosition left, + XawTextPosition right, Atom selection) +#else +XawTextSourceSetSelection(w, left, right, selection) +Widget w; +XawTextPosition left, right; +Atom selection; +#endif +{ + TextSrcObjectClass class = (TextSrcObjectClass) w->core.widget_class; + + if ( !XtIsSubclass( w, textSrcObjectClass ) ) + XtErrorMsg("bad argument", "textSource", "XawError", + "'s 1st parameter must be subclass of asciiSrc.", + NULL, NULL); + + (*class->textSrc_class.SetSelection)(w, left, right, selection); +} + +/******************************************************************** + * + * External Functions for Multi Text. + * + ********************************************************************/ + +/* + * TextFormat(): + * returns the format of text: FMT8BIT or FMTWIDE. + * + */ +XrmQuark +#if NeedFunctionPrototypes +_XawTextFormat(TextWidget tw) +#else +_XawTextFormat(tw) + TextWidget tw; +#endif +{ + return (((TextSrcObject)(tw->text.source))->textSrc.text_format); +} + + +/* _XawTextWCToMB(): + * convert the wchar string to external encoding. + * The caller is responsible for freeing both the source and ret string. + * + * wstr - source wchar string. + * len_in_out - lengh of string. + * As In, length of source wchar string, measured in wchar. + * As Out, length of returned string. + */ + + +char * +_XawTextWCToMB( d, wstr, len_in_out ) + Display* d; + wchar_t* wstr; + int* len_in_out; + +{ + XTextProperty textprop; + if (XwcTextListToTextProperty(d, (wchar_t**)&wstr, 1, + XTextStyle, &textprop) < Success) { + XtWarningMsg("convertError", "textSource", "XawError", + "Non-character code(s) in buffer.", NULL, NULL); + *len_in_out = 0; + return( NULL ); + } + *len_in_out = textprop.nitems; + return((char *)textprop.value); +} + + +/* _XawTextMBToWC(): + * convert the string to internal processing codeset WC. + * The caller is responsible for freeing both the source and ret string. + * + * str - source string. + * len_in_out - lengh of string. + * As In, it is length of source string. + * As Out, it is length of returned string, measured in wchar. + */ + +wchar_t* _XawTextMBToWC( d, str, len_in_out ) +Display *d; +char *str; +int *len_in_out; +{ + if (*len_in_out == 0) { + return(NULL); + } else { + XTextProperty textprop; + char *buf; + wchar_t **wlist, *wstr; + int count; + buf = XtMalloc(*len_in_out + 1); + if (!buf) { + XtErrorMsg("convertError", "multiSourceCreate", "XawError", + "No Memory", NULL, NULL); + *len_in_out = 0; + return (NULL); /* The above function doesn't really return. */ + } + strncpy(buf, str, *len_in_out); + *(buf + *len_in_out) = '\0'; + if (XmbTextListToTextProperty(d, &buf, 1, XTextStyle, &textprop) + != Success) { + XtWarningMsg("convertError", "textSource", "XawError", + "No Memory, or Locale not supported.", NULL, NULL); + XtFree(buf); + *len_in_out = 0; + return (NULL); + } + XtFree(buf); + if (XwcTextPropertyToTextList(d, &textprop, + (wchar_t***)&wlist, &count) != Success) { + XtWarningMsg("convertError", "multiSourceCreate", "XawError", + "Non-character code(s) in source.", NULL, NULL); + *len_in_out = 0; + return (NULL); + } + wstr = wlist[0]; + *len_in_out = wcslen(wstr); + XFree((char**)wlist); /* this is evil */ + return(wstr); + } +} + diff --git a/vendor/x11iraf/xaw3d/TextSrc.h b/vendor/x11iraf/xaw3d/TextSrc.h new file mode 100644 index 00000000..edd31538 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextSrc.h @@ -0,0 +1,237 @@ +/* + * $XConsortium: TextSrc.h,v 1.11 94/04/17 20:13:15 kaleb Exp $ + */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawTextSrc_h +#define _XawTextSrc_h + +/*********************************************************************** + * + * TextSrc Object + * + ***********************************************************************/ + +#include <X11/Xaw3d/Text.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + editType EditType XawTextEditType XawtextRead + +*/ + +/* Class record constants */ + +extern WidgetClass textSrcObjectClass; + +typedef struct _TextSrcClassRec *TextSrcObjectClass; +typedef struct _TextSrcRec *TextSrcObject; + +typedef enum {XawstPositions, XawstWhiteSpace, XawstEOL, XawstParagraph, + XawstAll} XawTextScanType; +typedef enum {Normal, Selected }highlightType; +typedef enum {XawsmTextSelect, XawsmTextExtend} XawTextSelectionMode; +typedef enum {XawactionStart, XawactionAdjust, XawactionEnd} + XawTextSelectionAction; + +/* + * Error Conditions: + */ + +#define XawTextReadError -1 +#define XawTextScanError -1 + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawTextSourceRead + * Description: This function reads the source. + * Arguments: w - the TextSrc Object. + * pos - position of the text to retreive. + * RETURNED text - text block that will contain returned text. + * length - maximum number of characters to read. + * Returns: The number of characters read into the buffer. + */ + +extern XawTextPosition XawTextSourceRead( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* pos */, + XawTextBlock* /* text_return */, + int /* length */ +#endif +); + +/* Function Name: XawTextSourceReplace. + * Description: Replaces a block of text with new text. + * Arguments: src - the Text Source Object. + * startPos, endPos - ends of text that will be removed. + * text - new text to be inserted into buffer at startPos. + * Returns: XawEditError or XawEditDone. + */ + +extern int XawTextSourceReplace ( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* start */, + XawTextPosition /* end */, + XawTextBlock* /* text */ +#endif +); + +/* Function Name: XawTextSourceScan + * Description: Scans the text source for the number and type + * of item specified. + * Arguments: w - the TextSrc Object. + * position - the position to start scanning. + * type - type of thing to scan for. + * dir - direction to scan. + * count - which occurance if this thing to search for. + * include - whether or not to include the character found in + * the position that is returned. + * Returns: The position of the text. + * + */ + +extern XawTextPosition XawTextSourceScan( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* position */, +#if NeedWidePrototypes + /* XawTextScanType */ int /* type */, + /* XawTextScanDirection */ int /* dir */, +#else + XawTextScanType /* type */, + XawTextScanDirection /* dir */, +#endif + int /* count */, +#if NeedWidePrototypes + /* Boolean */ int /* include */ +#else + Boolean /* include */ +#endif +#endif +); + +/* Function Name: XawTextSourceSearch + * Description: Searchs the text source for the text block passed + * Arguments: w - the TextSource Object. + * position - the position to start scanning. + * dir - direction to scan. + * text - the text block to search for. + * Returns: The position of the text we are searching for or + * XawTextSearchError. + */ + +extern XawTextPosition XawTextSourceSearch( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* position */, +#if NeedWidePrototypes + /* XawTextScanDirection */ int /* dir */, +#else + XawTextScanDirection /* dir */, +#endif + XawTextBlock* /* text */ +#endif +); + +/* Function Name: XawTextSourceConvertSelection + * Description: Dummy selection converter. + * Arguments: w - the TextSrc object. + * selection - the current selection atom. + * target - the current target atom. + * type - the type to conver the selection to. + * RETURNED value, length - the return value that has been converted. + * RETURNED format - the format of the returned value. + * Returns: TRUE if the selection has been converted. + * + */ + +extern Boolean XawTextSourceConvertSelection( +#if NeedFunctionPrototypes + Widget /* w */, + Atom* /* selection */, + Atom* /* target */, + Atom* /* type */, + XtPointer* /* value_return */, + unsigned long* /* length_return */, + int* /* format_return */ +#endif +); + +/* Function Name: XawTextSourceSetSelection + * Description: allows special setting of the selection. + * Arguments: w - the TextSrc object. + * left, right - bounds of the selection. + * selection - the selection atom. + * Returns: none + */ + +extern void XawTextSourceSetSelection( +#if NeedFunctionPrototypes + Widget /* w */, + XawTextPosition /* start */, + XawTextPosition /* end */, + Atom /* selection */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawTextSrc_h */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/vendor/x11iraf/xaw3d/TextSrcP.h b/vendor/x11iraf/xaw3d/TextSrcP.h new file mode 100644 index 00000000..c7e0db70 --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextSrcP.h @@ -0,0 +1,164 @@ +/* +* $XConsortium: TextSrcP.h,v 1.20 94/04/17 20:13:15 kaleb Exp $ +*/ + + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * TextSrcP.h - Private definitions for TextSrc object + * + */ + +#ifndef _XawTextSrcP_h +#define _XawTextSrcP_h + +/*********************************************************************** + * + * TextSrc Object Private Data + * + ***********************************************************************/ + +#include <X11/Xaw3d/TextSrc.h> +#include <X11/Xaw3d/TextP.h> /* This source works with the Text widget. */ + +/************************************************************ + * + * New fields for the TextSrc object class record. + * + ************************************************************/ + +typedef struct { + XtPointer next_extension; + XrmQuark record_type; + long version; + Cardinal record_size; + int (*Input)(); +} TextSrcExtRec, *TextSrcExt; + +typedef struct _TextSrcClassPart { + XawTextPosition (*Read)(); + int (*Replace)(); + XawTextPosition (*Scan)(); + XawTextPosition (*Search)(); + void (*SetSelection)(); + Boolean (*ConvertSelection)(); +} TextSrcClassPart; + +/* Full class record declaration */ +typedef struct _TextSrcClassRec { + ObjectClassPart object_class; + TextSrcClassPart textSrc_class; +} TextSrcClassRec; + +extern TextSrcClassRec textSrcClassRec; + +/* New fields for the TextSrc object record */ +typedef struct { + /* resources */ + XawTextEditType edit_mode; + XrmQuark text_format; /* 2 formats: FMT8BIT for Ascii */ + /* FMTWIDE for ISO 10646 */ +} TextSrcPart; + +/**************************************************************** + * + * Full instance record declaration + * + ****************************************************************/ + +typedef struct _TextSrcRec { + ObjectPart object; + TextSrcPart textSrc; +} TextSrcRec; + +/****************************************************************** + * + * Semiprivate declarations of functions used in other modules + * + ******************************************************************/ + +char* _XawTextWCToMB( +#if NeedFunctionPrototypes + Display* /* d */, + wchar_t* /* wstr */, + int* /* len_in_out */ +#endif +); + +wchar_t* _XawTextMBToWC( +#if NeedFunctionPrototypes + Display* /* d */, + char* /* str */, + int* /* len_in_out */ +#endif +); + +/************************************************************ + * + * Private declarations. + * + ************************************************************/ + +typedef Boolean (*_XawBooleanFunc)(); +typedef int (*_XawIntFunc)(); +typedef XawTextPosition (*_XawTextPositionFunc)(); +typedef void (*_XawTextVoidFunc)(); + +#define XtInheritInput ((_XawTextPositionFunc) _XtInherit) +#define XtInheritRead ((_XawTextPositionFunc) _XtInherit) +#define XtInheritReplace ((_XawIntFunc) _XtInherit) +#define XtInheritScan ((_XawTextPositionFunc) _XtInherit) +#define XtInheritSearch ((_XawTextPositionFunc) _XtInherit) +#define XtInheritSetSelection ((_XawTextVoidFunc) _XtInherit) +#define XtInheritConvertSelection ((_XawBooleanFunc) _XtInherit) +#define XtTextSrcExtVersion 1 +#define XtTextSrcExtTypeString "XT_TEXTSRC_EXT" + +#endif /* _XawTextSrcP_h */ diff --git a/vendor/x11iraf/xaw3d/TextTr.c b/vendor/x11iraf/xaw3d/TextTr.c new file mode 100644 index 00000000..d8714a7c --- /dev/null +++ b/vendor/x11iraf/xaw3d/TextTr.c @@ -0,0 +1,130 @@ +/* $XConsortium: TextTr.c,v 1.20 95/06/14 15:07:27 kaleb Exp $ */ + +/* + +Copyright (c) 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* INTERNATIONALIZATION: + +The OMRON R5 contrib added the following action to the old TextTr: + + Ctrl<Key>backslash: reconnect-im() + +This is needed when the im is killed or otherwise becomes unreachable. +This keystroke is evil (inconvenient, hard-to-remember, not obvious) +so I am adding one more translation: + + <Key>Kanji: reconnect-im() + +The Japanese user typically hits their Kanji key when they want to do +input. This merely makes sure the input is connected. +*/ + +char *_XawDefaultTextTranslations1 = +"\ +Ctrl<Key>A: beginning-of-line() \n\ +Ctrl<Key>B: backward-character() \n\ +Ctrl<Key>C: insert-selection(CUT_BUFFER0) \n\ +Ctrl<Key>D: delete-next-character() \n\ +Ctrl<Key>E: end-of-line() \n\ +Ctrl<Key>F: forward-character() \n\ +Ctrl<Key>G: multiply(Reset) \n\ +Ctrl<Key>H: delete-previous-character() \n\ +Ctrl<Key>J: newline-and-indent() \n\ +Ctrl<Key>K: kill-to-end-of-line() \n\ +Ctrl<Key>L: redraw-display() \n\ +Ctrl<Key>M: newline() \n\ +Ctrl<Key>N: next-line() \n\ +Ctrl<Key>O: newline-and-backup() \n\ +Ctrl<Key>P: previous-line() \n\ +Ctrl<Key>R: search(backward) \n\ +Ctrl<Key>S: search(forward) \n\ +Ctrl<Key>T: transpose-characters() \n\ +Ctrl<Key>U: multiply(4) \n\ +Ctrl<Key>V: next-page() \n\ +Ctrl<Key>W: kill-selection() \n\ +Ctrl<Key>Y: insert-selection(SECONDARY) \n\ +Ctrl<Key>Z: scroll-one-line-up() \n\ +", *_XawDefaultTextTranslations2 = "\ +Meta<Key>B: backward-word() \n\ +Meta<Key>F: forward-word() \n\ +Meta<Key>I: insert-file() \n\ +Meta<Key>K: kill-to-end-of-paragraph() \n\ +Meta<Key>Q: form-paragraph() \n\ +Meta<Key>V: previous-page() \n\ +Meta<Key>Y: insert-selection(PRIMARY, CUT_BUFFER0) \n\ +Meta<Key>Z: scroll-one-line-down() \n\ +:Meta<Key>d: delete-next-word() \n\ +:Meta<Key>D: kill-word() \n\ +:Meta<Key>h: delete-previous-word() \n\ +:Meta<Key>H: backward-kill-word() \n\ +:Meta<Key>\\<: beginning-of-file() \n\ +:Meta<Key>\\>: end-of-file() \n\ +:Meta<Key>]: forward-paragraph() \n\ +:Meta<Key>[: backward-paragraph() \n\ +~Shift Meta<Key>Delete: delete-previous-word() \n\ + Shift Meta<Key>Delete: backward-kill-word() \n\ +~Shift Meta<Key>BackSpace: delete-previous-word() \n\ + Shift Meta<Key>BackSpace: backward-kill-word() \n\ +", *_XawDefaultTextTranslations3 = "\ +<Key>Home: beginning-of-file() \n\ +:<Key>KP_Home: beginning-of-file() \n\ +<Key>End: end-of-file() \n\ +:<Key>KP_End: end-of-file() \n\ +<Key>Next: next-page() \n\ +:<Key>KP_Next: next-page() \n\ +<Key>Prior: previous-page() \n\ +:<Key>KP_Prior: previous-page() \n\ +<Key>Right: forward-character() \n\ +:<Key>KP_Right: forward-character() \n\ +<Key>Left: backward-character() \n\ +:<Key>KP_Left: backward-character() \n\ +<Key>Down: next-line() \n\ +:<Key>KP_Down: next-line() \n\ +<Key>Up: previous-line() \n\ +:<Key>KP_Up: previous-line() \n\ +<Key>Delete: delete-previous-character() \n\ +:<Key>KP_Delete: delete-previous-character() \n\ +<Key>BackSpace: delete-previous-character() \n\ +<Key>Linefeed: newline-and-indent() \n\ +<Key>Return: newline() \n\ +:<Key>KP_Enter: newline() \n\ +Ctrl<Key>backslash: reconnect-im() \n\ +<Key>Kanji: reconnect-im()\n\ +<Key>: insert-char() \n\ +", *_XawDefaultTextTranslations4 = "\ +<EnterWindow>: enter-window() \n\ +<LeaveWindow>: leave-window() \n\ +<FocusIn>: focus-in() \n\ +<FocusOut>: focus-out() \n\ +<Btn1Down>: select-start() \n\ +<Btn1Motion>: extend-adjust() \n\ +<Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\ +<Btn2Down>: insert-selection(PRIMARY, CUT_BUFFER0) \n\ +<Btn3Down>: extend-start() \n\ +<Btn3Motion>: extend-adjust() \n\ +<Btn3Up>: extend-end(PRIMARY, CUT_BUFFER0) \ +"; diff --git a/vendor/x11iraf/xaw3d/ThreeD.c b/vendor/x11iraf/xaw3d/ThreeD.c new file mode 100644 index 00000000..3081f1db --- /dev/null +++ b/vendor/x11iraf/xaw3d/ThreeD.c @@ -0,0 +1,640 @@ +/* -XT +* $KK: ThreeD.c,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +* J. P. Terlouw, Kapteyn Astronomical Institute, Groningen The Netherlands, +* February 2001: modified for use with non-default visuals. +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/ThreeDP.h> +#include <X11/Xosdefs.h> + +/* Initialization of defaults */ + +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" + +#define offset(field) XtOffsetOf(ThreeDRec, field) + +static XtResource resources[] = { + {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2}, + {XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(threeD.top_shadow_pixel), XtRString, XtDefaultForeground}, + {XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(threeD.bot_shadow_pixel), XtRString, XtDefaultForeground}, + {XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(threeD.top_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, + {XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(threeD.bot_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, + {XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int), + offset(threeD.top_shadow_contrast), XtRImmediate, (XtPointer) 20}, + {XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int), + offset(threeD.bot_shadow_contrast), XtRImmediate, (XtPointer) 40}, + {XtNuserData, XtCUserData, XtRPointer, sizeof(XtPointer), + offset(threeD.user_data), XtRPointer, (XtPointer) NULL}, + {XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean), + offset(threeD.be_nice_to_cmap), XtRImmediate, (XtPointer) True}, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, + (XtPointer)0} +}; + +#undef offset + +static void ClassPartInitialize(), Initialize(), Destroy(); +static void Redisplay(), Realize(), _Xaw3dDrawShadows(); +static Boolean SetValues(); + +ThreeDClassRec threeDClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "ThreeD", + /* widget_size */ sizeof(ThreeDRec), + /* class_initialize */ NULL, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ XtInheritResize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* threeD fields */ + /* shadow draw */ _Xaw3dDrawShadows + } +}; + +WidgetClass threeDWidgetClass = (WidgetClass) &threeDClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +#define mbshadowpm_size 3 +static char mbshadowpm_bits[] = {0x05, 0x03, 0x06}; + +#define mtshadowpm_size 3 +static char mtshadowpm_bits[] = {0x02, 0x04, 0x01}; + +#define shadowpm_size 2 +static char shadowpm_bits[] = {0x02, 0x01}; + +#define setPixel(p,dpy,scn) (p) + +/* ARGSUSED */ +static unsigned long WittePixel (w) + ThreeDWidget w; +{ + static XColor kleur; + if (!kleur.flags) { + kleur.flags = DoRed | DoGreen | DoBlue; + kleur.red = kleur.green = kleur.blue = 65535; + (void)XAllocColor(XtDisplay(w), w->core.colormap, &kleur); + } + return kleur.pixel; +} + +/* ARGSUSED */ +static unsigned long ZwartePixel (w) + ThreeDWidget w; +{ + static XColor kleur; + if (!kleur.flags) { + kleur.flags = DoRed | DoGreen | DoBlue; + kleur.red = kleur.green = kleur.blue = 0; + (void)XAllocColor(XtDisplay(w), w->core.colormap, &kleur); + } + return kleur.pixel; +} + +/* ARGSUSED */ +static void AllocTopShadowGC (w) + Widget w; +{ + ThreeDWidget tdw = (ThreeDWidget) w; + Screen *scn = XtScreen (w); + XtGCMask valuemask; + XGCValues myXGCV; + + if (tdw->threeD.be_nice_to_cmap || tdw->core.depth == 1) { + valuemask = GCTile | GCFillStyle; + myXGCV.tile = tdw->threeD.top_shadow_pxmap; + myXGCV.fill_style = FillTiled; + } else { + valuemask = GCForeground; + myXGCV.foreground = tdw->threeD.top_shadow_pixel; + } + tdw->threeD.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocBotShadowGC (w) + Widget w; +{ + ThreeDWidget tdw = (ThreeDWidget) w; + Screen *scn = XtScreen (w); + XtGCMask valuemask; + XGCValues myXGCV; + + if (tdw->threeD.be_nice_to_cmap || tdw->core.depth == 1) { + valuemask = GCTile | GCFillStyle; + myXGCV.tile = tdw->threeD.bot_shadow_pxmap; + myXGCV.fill_style = FillTiled; + } else { + valuemask = GCForeground; + myXGCV.foreground = tdw->threeD.bot_shadow_pixel; + } + tdw->threeD.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocTopShadowPixmap (new) + Widget new; +{ + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + unsigned long top_fg_pixel = 0, top_bg_pixel = 0; + char *pm_data = NULL; + Boolean create_pixmap = FALSE; + unsigned int pm_size; + + /* + * I know, we're going to create two pixmaps for each and every + * shadow'd widget. Yeuck. I'm semi-relying on server side + * pixmap cacheing. + */ + + if (tdw->core.depth == 1) { + top_fg_pixel = ZwartePixel(tdw); + top_bg_pixel = WittePixel(tdw); + pm_data = mtshadowpm_bits; + pm_size = mtshadowpm_size; + create_pixmap = TRUE; + } else if (tdw->threeD.be_nice_to_cmap) { + if (tdw->core.background_pixel == WittePixel(tdw)) { + top_fg_pixel = setPixel( WittePixel(tdw), dpy, scn); + top_bg_pixel = ZwartePixel(tdw); + } else if (tdw->core.background_pixel == ZwartePixel(tdw)) { + top_fg_pixel = ZwartePixel(tdw); + top_bg_pixel = setPixel( WittePixel(tdw), dpy, scn); + } else { + top_fg_pixel = tdw->core.background_pixel; + top_bg_pixel = WittePixel(tdw); + } + if (tdw->core.background_pixel == WittePixel(tdw) || + tdw->core.background_pixel == ZwartePixel(tdw)) { + pm_data = mtshadowpm_bits; + pm_size = mtshadowpm_size; + } else + { + pm_data = shadowpm_bits; + pm_size = shadowpm_size; + } + + create_pixmap = TRUE; + } else { + pm_size = 0; /* keep gcc happy */ + } + + if (create_pixmap) + tdw->threeD.top_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + pm_size, + pm_size, + top_fg_pixel, + top_bg_pixel, + ((ThreeDWidget)new)->core.depth); +} + +/* ARGSUSED */ +static void AllocBotShadowPixmap (new) + Widget new; +{ + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + unsigned long bot_fg_pixel = 0, bot_bg_pixel = 0; + char *pm_data = NULL; + Boolean create_pixmap = FALSE; + unsigned int pm_size; + + if (tdw->core.depth == 1) { + bot_fg_pixel = ZwartePixel(tdw); + bot_bg_pixel = WittePixel(tdw); + pm_data = mbshadowpm_bits; + pm_size = mbshadowpm_size; + create_pixmap = TRUE; + } else if (tdw->threeD.be_nice_to_cmap) { + if (tdw->core.background_pixel == WittePixel(tdw)) { + bot_fg_pixel = WittePixel(tdw); + bot_bg_pixel = setPixel( ZwartePixel(tdw), dpy, scn); + } else if (tdw->core.background_pixel == ZwartePixel(tdw)) { + bot_fg_pixel = setPixel( ZwartePixel(tdw), dpy, scn); + bot_bg_pixel = ZwartePixel(tdw); + } else { + bot_fg_pixel = tdw->core.background_pixel; + bot_bg_pixel = ZwartePixel(tdw); + } + if (tdw->core.background_pixel == WittePixel(tdw) || + tdw->core.background_pixel == ZwartePixel(tdw)) { + pm_data = mbshadowpm_bits; + pm_size = mbshadowpm_size; + } else + { + pm_data = shadowpm_bits; + pm_size = shadowpm_size; + } + create_pixmap = TRUE; + } else { + pm_size = 0; /* keep gcc happy */ + } + + if (create_pixmap) + tdw->threeD.bot_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + pm_size, + pm_size, + bot_fg_pixel, + bot_bg_pixel, + ((ThreeDWidget)new)->core.depth); +} + +/* ARGSUSED */ +void Xaw3dComputeTopShadowRGB (new, xcol_out) + Widget new; + XColor *xcol_out; +{ + if (XtIsSubclass (new, threeDWidgetClass)) { + ThreeDWidget tdw = (ThreeDWidget) new; + XColor get_c; + double contrast; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = tdw->core.colormap; + + get_c.pixel = tdw->core.background_pixel; + if (get_c.pixel == WittePixel(tdw) || + get_c.pixel == ZwartePixel(tdw)) { + contrast = (100 - tdw->threeD.top_shadow_contrast) / 100.0; + xcol_out->red = contrast * 65535.0; + xcol_out->green = contrast * 65535.0; + xcol_out->blue = contrast * 65535.0; + } else { + contrast = 1.0 + tdw->threeD.top_shadow_contrast / 100.0; + XQueryColor (dpy, cmap, &get_c); +#define MIN(x,y) (unsigned short) (x < y) ? x : y + xcol_out->red = MIN (65535, (int) (contrast * (double) get_c.red)); + xcol_out->green = MIN (65535, (int) (contrast * (double) get_c.green)); + xcol_out->blue = MIN (65535, (int) (contrast * (double) get_c.blue)); +#undef MIN + } + } else + xcol_out->red = xcol_out->green = xcol_out->blue = 0; +} + +/* ARGSUSED */ +static void AllocTopShadowPixel (new) + Widget new; +{ + XColor set_c; + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = tdw->core.colormap; + + Xaw3dComputeTopShadowRGB (new, &set_c); + (void) XAllocColor (dpy, cmap, &set_c); + tdw->threeD.top_shadow_pixel = set_c.pixel; +} + +/* ARGSUSED */ +void Xaw3dComputeBottomShadowRGB (new, xcol_out) + Widget new; + XColor *xcol_out; +{ + if (XtIsSubclass (new, threeDWidgetClass)) { + ThreeDWidget tdw = (ThreeDWidget) new; + XColor get_c; + double contrast; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = tdw->core.colormap; + + get_c.pixel = tdw->core.background_pixel; + if (get_c.pixel == WittePixel(tdw) || + get_c.pixel == ZwartePixel(tdw)) { + contrast = tdw->threeD.bot_shadow_contrast / 100.0; + xcol_out->red = contrast * 65535.0; + xcol_out->green = contrast * 65535.0; + xcol_out->blue = contrast * 65535.0; + } else { + XQueryColor (dpy, cmap, &get_c); + contrast = (100 - tdw->threeD.bot_shadow_contrast) / 100.0; + xcol_out->red = contrast * get_c.red; + xcol_out->green = contrast * get_c.green; + xcol_out->blue = contrast * get_c.blue; + } + } else + xcol_out->red = xcol_out->green = xcol_out->blue = 0; +} + +/* ARGSUSED */ +static void AllocBotShadowPixel (new) + Widget new; +{ + XColor set_c; + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = tdw->core.colormap; + + Xaw3dComputeBottomShadowRGB (new, &set_c); + (void) XAllocColor (dpy, cmap, &set_c); + tdw->threeD.bot_shadow_pixel = set_c.pixel; +} + + +/* ARGSUSED */ +static void ClassPartInitialize (wc) + WidgetClass wc; + +{ + ThreeDClassRec *tdwc = (ThreeDClassRec*) wc; + ThreeDClassRec *super = (ThreeDClassRec*) tdwc->core_class.superclass; + + if (tdwc->threeD_class.shadowdraw == XtInheritXaw3dShadowDraw) + tdwc->threeD_class.shadowdraw = super->threeD_class.shadowdraw; +} + + +/* ARGSUSED */ +static void Initialize (request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + ThreeDWidget tdw = (ThreeDWidget) new; + Screen *scr = XtScreen (new); + + if (tdw->threeD.be_nice_to_cmap || tdw->core.depth == 1) { + AllocTopShadowPixmap (new); + AllocBotShadowPixmap (new); + } else { + if (tdw->threeD.top_shadow_pixel == tdw->threeD.bot_shadow_pixel) { + /* + Eeek. We're probably going to XQueryColor() twice + for each widget. Necessary because you can set the + top and bottom shadows independent of each other in + SetValues. Some cacheing would certainly help... + */ + AllocTopShadowPixel (new); + AllocBotShadowPixel (new); + } + tdw->threeD.top_shadow_pxmap = tdw->threeD.bot_shadow_pxmap = (Pixmap) 0; + } + AllocTopShadowGC (new); + AllocBotShadowGC (new); +} + +static void Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + /* + * This is necessary because Simple doesn't have a realize method + * XtInheritRealize in the ThreeD class record doesn't work. This + * daisychains through Simple to the Core class realize method + */ + (*threeDWidgetClass->core_class.superclass->core_class.realize) + (gw, valueMask, attrs); +} + +static void Destroy (w) + Widget w; +{ + ThreeDWidget tdw = (ThreeDWidget) w; + XtReleaseGC (w, tdw->threeD.top_shadow_GC); + XtReleaseGC (w, tdw->threeD.bot_shadow_GC); + if (tdw->threeD.top_shadow_pxmap) + XFreePixmap (XtDisplay (w), tdw->threeD.top_shadow_pxmap); + if (tdw->threeD.bot_shadow_pxmap) + XFreePixmap (XtDisplay (w), tdw->threeD.bot_shadow_pxmap); +} + +/* ARGSUSED */ +static void Redisplay (w, event, region) + Widget w; + XEvent *event; /* unused */ + Region region; /* unused */ +{ + _Xaw3dDrawShadows (w, event, region, True); +} + +/* ARGSUSED */ +static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) + Widget gcurrent, grequest, gnew; + ArgList args; + Cardinal *num_args; +{ + ThreeDWidget current = (ThreeDWidget) gcurrent; + ThreeDWidget new = (ThreeDWidget) gnew; + Boolean redisplay = FALSE; + Boolean alloc_top_pixel = FALSE; + Boolean alloc_bot_pixel = FALSE; + Boolean alloc_top_pxmap = FALSE; + Boolean alloc_bot_pxmap = FALSE; + + (*threeDWidgetClass->core_class.superclass->core_class.set_values) + (gcurrent, grequest, gnew, NULL, 0); + if (new->threeD.shadow_width != current->threeD.shadow_width) + redisplay = TRUE; + if (new->threeD.be_nice_to_cmap != current->threeD.be_nice_to_cmap) { + if (new->threeD.be_nice_to_cmap) { + alloc_top_pxmap = TRUE; + alloc_bot_pxmap = TRUE; + } else { + alloc_top_pixel = TRUE; + alloc_bot_pixel = TRUE; + } + redisplay = TRUE; + } + if (!new->threeD.be_nice_to_cmap && + new->threeD.top_shadow_contrast != current->threeD.top_shadow_contrast) + alloc_top_pixel = TRUE; + if (!new->threeD.be_nice_to_cmap && + new->threeD.bot_shadow_contrast != current->threeD.bot_shadow_contrast) + alloc_bot_pixel = TRUE; + if (alloc_top_pixel) + AllocTopShadowPixel (gnew); + if (alloc_bot_pixel) + AllocBotShadowPixel (gnew); + if (alloc_top_pxmap) + AllocTopShadowPixmap (gnew); + if (alloc_bot_pxmap) + AllocBotShadowPixmap (gnew); + if (!new->threeD.be_nice_to_cmap && + new->threeD.top_shadow_pixel != current->threeD.top_shadow_pixel) + alloc_top_pixel = TRUE; + if (!new->threeD.be_nice_to_cmap && + new->threeD.bot_shadow_pixel != current->threeD.bot_shadow_pixel) + alloc_bot_pixel = TRUE; + if (new->threeD.be_nice_to_cmap) { + if (alloc_top_pxmap) { + XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); + AllocTopShadowGC (gnew); + redisplay = True; + } + if (alloc_bot_pxmap) { + XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); + AllocBotShadowGC (gnew); + redisplay = True; + } + } else { + if (alloc_top_pixel) { + if (new->threeD.top_shadow_pxmap) { + XFreePixmap (XtDisplay (gnew), new->threeD.top_shadow_pxmap); + new->threeD.top_shadow_pxmap = (Pixmap) NULL; + } + XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); + AllocTopShadowGC (gnew); + redisplay = True; + } + if (alloc_bot_pixel) { + if (new->threeD.bot_shadow_pxmap) { + XFreePixmap (XtDisplay (gnew), new->threeD.bot_shadow_pxmap); + new->threeD.bot_shadow_pxmap = (Pixmap) NULL; + } + XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); + AllocBotShadowGC (gnew); + redisplay = True; + } + } + return (redisplay); +} + +/* ARGSUSED */ +static void +_Xaw3dDrawShadows (gw, event, region, out) + Widget gw; + XEvent *event; + Region region; + Boolean out; +{ + XPoint pt[6]; + ThreeDWidget tdw = (ThreeDWidget) gw; + Dimension s = tdw->threeD.shadow_width; + /* + * draw the shadows using the core part width and height, + * and the threeD part shadow_width. + * + * no point to do anything if the shadow_width is 0 or the + * widget has not been realized. + */ + if((s > 0) && XtIsRealized (gw)){ + + Dimension h = tdw->core.height; + Dimension w = tdw->core.width; + Dimension wms = w - s; + Dimension hms = h - s; + Display *dpy = XtDisplay (gw); + Window win = XtWindow (gw); + GC top, bot; + + if (out) { + top = tdw->threeD.top_shadow_GC; + bot = tdw->threeD.bot_shadow_GC; + } else { + top = tdw->threeD.bot_shadow_GC; + bot = tdw->threeD.top_shadow_GC; + } + + /* top-left shadow */ + if ((region == NULL) || + (XRectInRegion (region, 0, 0, w, s) != RectangleOut) || + (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) { + + pt[0].x = 0; pt[0].y = h; + pt[1].x = pt[1].y = 0; + pt[2].x = w; pt[2].y = 0; + pt[3].x = wms; pt[3].y = s; + pt[4].x = pt[4].y = s; + pt[5].x = s; pt[5].y = hms; + XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin); + } + + /* bottom-right shadow */ + if ((region == NULL) || + (XRectInRegion (region, 0, hms, w, s) != RectangleOut) || + (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) { + + pt[0].x = 0; pt[0].y = h; + pt[1].x = w; pt[1].y = h; + pt[2].x = w; pt[2].y = 0; + pt[3].x = wms; pt[3].y = s; + pt[4].x = wms; pt[4].y = hms; + pt[5].x = s; pt[5].y = hms; + XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin); + } + } +} + diff --git a/vendor/x11iraf/xaw3d/ThreeD.c.sav b/vendor/x11iraf/xaw3d/ThreeD.c.sav new file mode 100644 index 00000000..55bc4742 --- /dev/null +++ b/vendor/x11iraf/xaw3d/ThreeD.c.sav @@ -0,0 +1,641 @@ +/* -XT +* $KK: ThreeD.c,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/Xlib.h> +#include <X11/StringDefs.h> +#include <X11/IntrinsicP.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/ThreeDP.h> +#include <X11/Xosdefs.h> + +/* Initialization of defaults */ + +#define XtNtopShadowPixmap "topShadowPixmap" +#define XtCTopShadowPixmap "TopShadowPixmap" +#define XtNbottomShadowPixmap "bottomShadowPixmap" +#define XtCBottomShadowPixmap "BottomShadowPixmap" + +#define offset(field) XtOffsetOf(ThreeDRec, field) + +static XtResource resources[] = { + {XtNshadowWidth, XtCShadowWidth, XtRDimension, sizeof(Dimension), + offset(threeD.shadow_width), XtRImmediate, (XtPointer) 2}, + {XtNtopShadowPixel, XtCTopShadowPixel, XtRPixel, sizeof(Pixel), + offset(threeD.top_shadow_pixel), XtRString, XtDefaultForeground}, + {XtNbottomShadowPixel, XtCBottomShadowPixel, XtRPixel, sizeof(Pixel), + offset(threeD.bot_shadow_pixel), XtRString, XtDefaultForeground}, + {XtNtopShadowPixmap, XtCTopShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(threeD.top_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, + {XtNbottomShadowPixmap, XtCBottomShadowPixmap, XtRPixmap, sizeof(Pixmap), + offset(threeD.bot_shadow_pxmap), XtRImmediate, (XtPointer) NULL}, + {XtNtopShadowContrast, XtCTopShadowContrast, XtRInt, sizeof(int), + offset(threeD.top_shadow_contrast), XtRImmediate, (XtPointer) 20}, + {XtNbottomShadowContrast, XtCBottomShadowContrast, XtRInt, sizeof(int), + offset(threeD.bot_shadow_contrast), XtRImmediate, (XtPointer) 40}, + {XtNuserData, XtCUserData, XtRPointer, sizeof(XtPointer), + offset(threeD.user_data), XtRPointer, (XtPointer) NULL}, + {XtNbeNiceToColormap, XtCBeNiceToColormap, XtRBoolean, sizeof(Boolean), + offset(threeD.be_nice_to_cmap), XtRImmediate, (XtPointer) True}, + {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate, + (XtPointer)0} +}; + +#undef offset + +static void ClassPartInitialize(), Initialize(), Destroy(); +static void Redisplay(), Realize(), _Xaw3dDrawShadows(); +static Boolean SetValues(); + +ThreeDClassRec threeDClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &simpleClassRec, + /* class_name */ "ThreeD", + /* widget_size */ sizeof(ThreeDRec), + /* class_initialize */ NULL, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ XtInheritResize, + /* expose */ Redisplay, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* simple fields */ + /* change_sensitive */ XtInheritChangeSensitive + }, + { /* threeD fields */ + /* shadow draw */ _Xaw3dDrawShadows + } +}; + +WidgetClass threeDWidgetClass = (WidgetClass) &threeDClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +#define mbshadowpm_size 3 +static char mbshadowpm_bits[] = {0x05, 0x03, 0x06}; + +#define mtshadowpm_size 3 +static char mtshadowpm_bits[] = {0x02, 0x04, 0x01}; + +#define shadowpm_size 2 +static char shadowpm_bits[] = {0x02, 0x01}; + +#ifdef USEGRAY +#include <stdio.h> +unsigned long grayPixel(dpy, scn) +Display *dpy; +Screen *scn; + { + static XColor Gray = + { + /* pixel */ 0, + /* red, green, blue */ 0,0,0, + /* flags */ 0, + /* pad */ 0 + }; + if (!Gray.pixel) + { + XColor exact; + (void) XAllocNamedColor(dpy, DefaultColormapOfScreen (scn), + "gray", &Gray,&exact); /* Blindflug */ + } + return Gray.pixel; + } +#define setPixel(p,dpy,scn) grayPixel(dpy,scn) +#else +#define setPixel(p,dpy,scn) (p) +#endif + + +/* ARGSUSED */ +static void AllocTopShadowGC (w) + Widget w; +{ + ThreeDWidget tdw = (ThreeDWidget) w; + Screen *scn = XtScreen (w); + XtGCMask valuemask; + XGCValues myXGCV; + + if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scn) == 1) { + valuemask = GCTile | GCFillStyle; + myXGCV.tile = tdw->threeD.top_shadow_pxmap; + myXGCV.fill_style = FillTiled; + } else { + valuemask = GCForeground; + myXGCV.foreground = tdw->threeD.top_shadow_pixel; + } + tdw->threeD.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocBotShadowGC (w) + Widget w; +{ + ThreeDWidget tdw = (ThreeDWidget) w; + Screen *scn = XtScreen (w); + XtGCMask valuemask; + XGCValues myXGCV; + + if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scn) == 1) { + valuemask = GCTile | GCFillStyle; + myXGCV.tile = tdw->threeD.bot_shadow_pxmap; + myXGCV.fill_style = FillTiled; + } else { + valuemask = GCForeground; + myXGCV.foreground = tdw->threeD.bot_shadow_pixel; + } + tdw->threeD.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV); +} + +/* ARGSUSED */ +static void AllocTopShadowPixmap (new) + Widget new; +{ + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + unsigned long top_fg_pixel = 0, top_bg_pixel = 0; + char *pm_data = NULL; + Boolean create_pixmap = FALSE; + unsigned int pm_size; + + /* + * I know, we're going to create two pixmaps for each and every + * shadow'd widget. Yeuck. I'm semi-relying on server side + * pixmap cacheing. + */ + + if (DefaultDepthOfScreen (scn) == 1) { + top_fg_pixel = BlackPixelOfScreen (scn); + top_bg_pixel = WhitePixelOfScreen (scn); + pm_data = mtshadowpm_bits; + pm_size = mtshadowpm_size; + create_pixmap = TRUE; + } else if (tdw->threeD.be_nice_to_cmap) { + if (tdw->core.background_pixel == WhitePixelOfScreen (scn)) { + top_fg_pixel = setPixel( WhitePixelOfScreen (scn), dpy, scn); + top_bg_pixel = BlackPixelOfScreen (scn); + } else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) { + top_fg_pixel = BlackPixelOfScreen (scn); + top_bg_pixel = setPixel( WhitePixelOfScreen (scn), dpy, scn); + } else { + top_fg_pixel = tdw->core.background_pixel; + top_bg_pixel = WhitePixelOfScreen (scn); + } +#ifndef USEGRAY + if (tdw->core.background_pixel == WhitePixelOfScreen (scn) || + tdw->core.background_pixel == BlackPixelOfScreen (scn)) { + pm_data = mtshadowpm_bits; + pm_size = mtshadowpm_size; + } else +#endif + { + pm_data = shadowpm_bits; + pm_size = shadowpm_size; + } + + create_pixmap = TRUE; + } else { + pm_size = 0; /* keep gcc happy */ + } + + if (create_pixmap) + tdw->threeD.top_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + pm_size, + pm_size, + top_fg_pixel, + top_bg_pixel, + ((ThreeDWidget)new)->core.depth); +} + +/* ARGSUSED */ +static void AllocBotShadowPixmap (new) + Widget new; +{ + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + unsigned long bot_fg_pixel = 0, bot_bg_pixel = 0; + char *pm_data = NULL; + Boolean create_pixmap = FALSE; + unsigned int pm_size; + + if (DefaultDepthOfScreen (scn) == 1) { + bot_fg_pixel = BlackPixelOfScreen (scn); + bot_bg_pixel = WhitePixelOfScreen (scn); + pm_data = mbshadowpm_bits; + pm_size = mbshadowpm_size; + create_pixmap = TRUE; + } else if (tdw->threeD.be_nice_to_cmap) { + if (tdw->core.background_pixel == WhitePixelOfScreen (scn)) { + bot_fg_pixel = WhitePixelOfScreen (scn); + bot_bg_pixel = setPixel( BlackPixelOfScreen (scn), dpy, scn); + } else if (tdw->core.background_pixel == BlackPixelOfScreen (scn)) { + bot_fg_pixel = setPixel( BlackPixelOfScreen (scn), dpy, scn); + bot_bg_pixel = BlackPixelOfScreen (scn); + } else { + bot_fg_pixel = tdw->core.background_pixel; + bot_bg_pixel = BlackPixelOfScreen (scn); + } +#ifndef USEGRAY + if (tdw->core.background_pixel == WhitePixelOfScreen (scn) || + tdw->core.background_pixel == BlackPixelOfScreen (scn)) { + pm_data = mbshadowpm_bits; + pm_size = mbshadowpm_size; + } else +#endif + { + pm_data = shadowpm_bits; + pm_size = shadowpm_size; + } + create_pixmap = TRUE; + } else { + pm_size = 0; /* keep gcc happy */ + } + + if (create_pixmap) + tdw->threeD.bot_shadow_pxmap = XCreatePixmapFromBitmapData (dpy, + RootWindowOfScreen (scn), + pm_data, + pm_size, + pm_size, + bot_fg_pixel, + bot_bg_pixel, + ((ThreeDWidget)new)->core.depth); +} + +/* ARGSUSED */ +void Xaw3dComputeTopShadowRGB (new, xcol_out) + Widget new; + XColor *xcol_out; +{ + if (XtIsSubclass (new, threeDWidgetClass)) { + ThreeDWidget tdw = (ThreeDWidget) new; + XColor get_c; + double contrast; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = DefaultColormapOfScreen (scn); + + get_c.pixel = tdw->core.background_pixel; + if (get_c.pixel == WhitePixelOfScreen (scn) || + get_c.pixel == BlackPixelOfScreen (scn)) { + contrast = (100 - tdw->threeD.top_shadow_contrast) / 100.0; + xcol_out->red = contrast * 65535.0; + xcol_out->green = contrast * 65535.0; + xcol_out->blue = contrast * 65535.0; + } else { + contrast = 1.0 + tdw->threeD.top_shadow_contrast / 100.0; + XQueryColor (dpy, cmap, &get_c); +#define MIN(x,y) (unsigned short) (x < y) ? x : y + xcol_out->red = MIN (65535, (int) (contrast * (double) get_c.red)); + xcol_out->green = MIN (65535, (int) (contrast * (double) get_c.green)); + xcol_out->blue = MIN (65535, (int) (contrast * (double) get_c.blue)); +#undef MIN + } + } else + xcol_out->red = xcol_out->green = xcol_out->blue = 0; +} + +/* ARGSUSED */ +static void AllocTopShadowPixel (new) + Widget new; +{ + XColor set_c; + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = DefaultColormapOfScreen (scn); + + Xaw3dComputeTopShadowRGB (new, &set_c); + (void) XAllocColor (dpy, cmap, &set_c); + tdw->threeD.top_shadow_pixel = set_c.pixel; +} + +/* ARGSUSED */ +void Xaw3dComputeBottomShadowRGB (new, xcol_out) + Widget new; + XColor *xcol_out; +{ + if (XtIsSubclass (new, threeDWidgetClass)) { + ThreeDWidget tdw = (ThreeDWidget) new; + XColor get_c; + double contrast; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = DefaultColormapOfScreen (scn); + + get_c.pixel = tdw->core.background_pixel; + if (get_c.pixel == WhitePixelOfScreen (scn) || + get_c.pixel == BlackPixelOfScreen (scn)) { + contrast = tdw->threeD.bot_shadow_contrast / 100.0; + xcol_out->red = contrast * 65535.0; + xcol_out->green = contrast * 65535.0; + xcol_out->blue = contrast * 65535.0; + } else { + XQueryColor (dpy, cmap, &get_c); + contrast = (100 - tdw->threeD.bot_shadow_contrast) / 100.0; + xcol_out->red = contrast * get_c.red; + xcol_out->green = contrast * get_c.green; + xcol_out->blue = contrast * get_c.blue; + } + } else + xcol_out->red = xcol_out->green = xcol_out->blue = 0; +} + +/* ARGSUSED */ +static void AllocBotShadowPixel (new) + Widget new; +{ + XColor set_c; + ThreeDWidget tdw = (ThreeDWidget) new; + Display *dpy = XtDisplay (new); + Screen *scn = XtScreen (new); + Colormap cmap = DefaultColormapOfScreen (scn); + + Xaw3dComputeBottomShadowRGB (new, &set_c); + (void) XAllocColor (dpy, cmap, &set_c); + tdw->threeD.bot_shadow_pixel = set_c.pixel; +} + + +/* ARGSUSED */ +static void ClassPartInitialize (wc) + WidgetClass wc; + +{ + ThreeDClassRec *tdwc = (ThreeDClassRec*) wc; + ThreeDClassRec *super = (ThreeDClassRec*) tdwc->core_class.superclass; + + if (tdwc->threeD_class.shadowdraw == XtInheritXaw3dShadowDraw) + tdwc->threeD_class.shadowdraw = super->threeD_class.shadowdraw; +} + + +/* ARGSUSED */ +static void Initialize (request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + ThreeDWidget tdw = (ThreeDWidget) new; + Screen *scr = XtScreen (new); + + if (tdw->threeD.be_nice_to_cmap || DefaultDepthOfScreen (scr) == 1) { + AllocTopShadowPixmap (new); + AllocBotShadowPixmap (new); + } else { + if (tdw->threeD.top_shadow_pixel == tdw->threeD.bot_shadow_pixel) { + /* + Eeek. We're probably going to XQueryColor() twice + for each widget. Necessary because you can set the + top and bottom shadows independent of each other in + SetValues. Some cacheing would certainly help... + */ + AllocTopShadowPixel (new); + AllocBotShadowPixel (new); + } + tdw->threeD.top_shadow_pxmap = tdw->threeD.bot_shadow_pxmap = (Pixmap) 0; + } + AllocTopShadowGC (new); + AllocBotShadowGC (new); +} + +static void Realize (gw, valueMask, attrs) + Widget gw; + XtValueMask *valueMask; + XSetWindowAttributes *attrs; +{ + /* + * This is necessary because Simple doesn't have a realize method + * XtInheritRealize in the ThreeD class record doesn't work. This + * daisychains through Simple to the Core class realize method + */ + (*threeDWidgetClass->core_class.superclass->core_class.realize) + (gw, valueMask, attrs); +} + +static void Destroy (w) + Widget w; +{ + ThreeDWidget tdw = (ThreeDWidget) w; + XtReleaseGC (w, tdw->threeD.top_shadow_GC); + XtReleaseGC (w, tdw->threeD.bot_shadow_GC); + if (tdw->threeD.top_shadow_pxmap) + XFreePixmap (XtDisplay (w), tdw->threeD.top_shadow_pxmap); + if (tdw->threeD.bot_shadow_pxmap) + XFreePixmap (XtDisplay (w), tdw->threeD.bot_shadow_pxmap); +} + +/* ARGSUSED */ +static void Redisplay (w, event, region) + Widget w; + XEvent *event; /* unused */ + Region region; /* unused */ +{ + _Xaw3dDrawShadows (w, event, region, True); +} + +/* ARGSUSED */ +static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) + Widget gcurrent, grequest, gnew; + ArgList args; + Cardinal *num_args; +{ + ThreeDWidget current = (ThreeDWidget) gcurrent; + ThreeDWidget new = (ThreeDWidget) gnew; + Boolean redisplay = FALSE; + Boolean alloc_top_pixel = FALSE; + Boolean alloc_bot_pixel = FALSE; + Boolean alloc_top_pxmap = FALSE; + Boolean alloc_bot_pxmap = FALSE; + + (*threeDWidgetClass->core_class.superclass->core_class.set_values) + (gcurrent, grequest, gnew, NULL, 0); + if (new->threeD.shadow_width != current->threeD.shadow_width) + redisplay = TRUE; + if (new->threeD.be_nice_to_cmap != current->threeD.be_nice_to_cmap) { + if (new->threeD.be_nice_to_cmap) { + alloc_top_pxmap = TRUE; + alloc_bot_pxmap = TRUE; + } else { + alloc_top_pixel = TRUE; + alloc_bot_pixel = TRUE; + } + redisplay = TRUE; + } + if (!new->threeD.be_nice_to_cmap && + new->threeD.top_shadow_contrast != current->threeD.top_shadow_contrast) + alloc_top_pixel = TRUE; + if (!new->threeD.be_nice_to_cmap && + new->threeD.bot_shadow_contrast != current->threeD.bot_shadow_contrast) + alloc_bot_pixel = TRUE; + if (alloc_top_pixel) + AllocTopShadowPixel (gnew); + if (alloc_bot_pixel) + AllocBotShadowPixel (gnew); + if (alloc_top_pxmap) + AllocTopShadowPixmap (gnew); + if (alloc_bot_pxmap) + AllocBotShadowPixmap (gnew); + if (!new->threeD.be_nice_to_cmap && + new->threeD.top_shadow_pixel != current->threeD.top_shadow_pixel) + alloc_top_pixel = TRUE; + if (!new->threeD.be_nice_to_cmap && + new->threeD.bot_shadow_pixel != current->threeD.bot_shadow_pixel) + alloc_bot_pixel = TRUE; + if (new->threeD.be_nice_to_cmap) { + if (alloc_top_pxmap) { + XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); + AllocTopShadowGC (gnew); + redisplay = True; + } + if (alloc_bot_pxmap) { + XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); + AllocBotShadowGC (gnew); + redisplay = True; + } + } else { + if (alloc_top_pixel) { + if (new->threeD.top_shadow_pxmap) { + XFreePixmap (XtDisplay (gnew), new->threeD.top_shadow_pxmap); + new->threeD.top_shadow_pxmap = (Pixmap) NULL; + } + XtReleaseGC (gcurrent, current->threeD.top_shadow_GC); + AllocTopShadowGC (gnew); + redisplay = True; + } + if (alloc_bot_pixel) { + if (new->threeD.bot_shadow_pxmap) { + XFreePixmap (XtDisplay (gnew), new->threeD.bot_shadow_pxmap); + new->threeD.bot_shadow_pxmap = (Pixmap) NULL; + } + XtReleaseGC (gcurrent, current->threeD.bot_shadow_GC); + AllocBotShadowGC (gnew); + redisplay = True; + } + } + return (redisplay); +} + +/* ARGSUSED */ +static void +_Xaw3dDrawShadows (gw, event, region, out) + Widget gw; + XEvent *event; + Region region; + Boolean out; +{ + XPoint pt[6]; + ThreeDWidget tdw = (ThreeDWidget) gw; + Dimension s = tdw->threeD.shadow_width; + /* + * draw the shadows using the core part width and height, + * and the threeD part shadow_width. + * + * no point to do anything if the shadow_width is 0 or the + * widget has not been realized. + */ + if((s > 0) && XtIsRealized (gw)){ + + Dimension h = tdw->core.height; + Dimension w = tdw->core.width; + Dimension wms = w - s; + Dimension hms = h - s; + Display *dpy = XtDisplay (gw); + Window win = XtWindow (gw); + GC top, bot; + + if (out) { + top = tdw->threeD.top_shadow_GC; + bot = tdw->threeD.bot_shadow_GC; + } else { + top = tdw->threeD.bot_shadow_GC; + bot = tdw->threeD.top_shadow_GC; + } + + /* top-left shadow */ + if ((region == NULL) || + (XRectInRegion (region, 0, 0, w, s) != RectangleOut) || + (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) { + + pt[0].x = 0; pt[0].y = h; + pt[1].x = pt[1].y = 0; + pt[2].x = w; pt[2].y = 0; + pt[3].x = wms; pt[3].y = s; + pt[4].x = pt[4].y = s; + pt[5].x = s; pt[5].y = hms; + XFillPolygon (dpy, win, top, pt, 6,Complex,CoordModeOrigin); + } + + /* bottom-right shadow */ + if ((region == NULL) || + (XRectInRegion (region, 0, hms, w, s) != RectangleOut) || + (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) { + + pt[0].x = 0; pt[0].y = h; + pt[1].x = w; pt[1].y = h; + pt[2].x = w; pt[2].y = 0; + pt[3].x = wms; pt[3].y = s; + pt[4].x = wms; pt[4].y = hms; + pt[5].x = s; pt[5].y = hms; + XFillPolygon (dpy, win, bot, pt,6, Complex,CoordModeOrigin); + } + } +} + diff --git a/vendor/x11iraf/xaw3d/ThreeD.h b/vendor/x11iraf/xaw3d/ThreeD.h new file mode 100644 index 00000000..61096720 --- /dev/null +++ b/vendor/x11iraf/xaw3d/ThreeD.h @@ -0,0 +1,95 @@ +/* +* $KK: ThreeD.h,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _XawThreeD_h +#define _XawThreeD_h + +/*********************************************************************** + * + * ThreeD Widget + * + ***********************************************************************/ + +#include <X11/Xmu/Converters.h> + +/* Parameters: + + Name Class RepType Default Value + ---- ----- ------- ------------- + shadowWidth ShadowWidth Dimension 2 + topShadowPixel TopShadowPixel Pixel dynamic + bottomShadowPixel BottomShadowPixel Pixel dynamic + topShadowContrast TopShadowContrast Int 20 + bottomShadowContrast BottomShadowContrast Int 40 + userData UserData XtPointer NULL + beNiceToColormap BeNiceToColormap Boolean False + +*/ + +#define XtNshadowWidth "shadowWidth" +#define XtCShadowWidth "ShadowWidth" +#define XtNtopShadowPixel "topShadowPixel" +#define XtCTopShadowPixel "TopShadowPixel" +#define XtNbottomShadowPixel "bottomShadowPixel" +#define XtCBottomShadowPixel "BottomShadowPixel" +#define XtNtopShadowContrast "topShadowContrast" +#define XtCTopShadowContrast "TopShadowContrast" +#define XtNbottomShadowContrast "bottomShadowContrast" +#define XtCBottomShadowContrast "BottomShadowContrast" +#define XtNbeNiceToColormap "beNiceToColormap" +#define XtCBeNiceToColormap "BeNiceToColormap" +#define XtNbeNiceToColourmap "beNiceToColormap" +#define XtCBeNiceToColourmap "BeNiceToColormap" +#define XtNuserData "userData" +#define XtCUserData "UserData" + +typedef struct _ThreeDRec *ThreeDWidget; +typedef struct _ThreeDClassRec *ThreeDWidgetClass; + +extern WidgetClass threeDWidgetClass; + +_XFUNCPROTOBEGIN + +extern void Xaw3dComputeTopShadowRGB ( +#if NeedFunctionPrototypes + Widget /* new */, + XColor* /* xcol_out */ +#endif +); + +extern void Xaw3dComputeBottomShadowRGB ( +#if NeedFunctionPrototypes + Widget /* new */, + XColor* /* xcol_out */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawThreeD_h */ diff --git a/vendor/x11iraf/xaw3d/ThreeDP.h b/vendor/x11iraf/xaw3d/ThreeDP.h new file mode 100644 index 00000000..316b5204 --- /dev/null +++ b/vendor/x11iraf/xaw3d/ThreeDP.h @@ -0,0 +1,74 @@ +/* +* $KK: ThreeDP.h,v 0.3 92/11/04 xx:xx:xx keithley Exp $ +*/ + +/*********************************************************** +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. +Copyright 1992 by Kaleb Keithley + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital, MIT, or Kaleb +Keithley not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef _ThreeDP_h +#define _ThreeDP_h + +#include <X11/Xaw3d/ThreeD.h> +#include <X11/Xaw3d/SimpleP.h> + +typedef struct { + Dimension shadow_width; + Pixel top_shadow_pixel; + Pixel bot_shadow_pixel; + Pixmap top_shadow_pxmap; + Pixmap bot_shadow_pxmap; + int top_shadow_contrast; + int bot_shadow_contrast; + GC top_shadow_GC; + GC bot_shadow_GC; + XtPointer user_data; + Boolean be_nice_to_cmap; + } ThreeDPart; + +/* Full instance record declaration */ +typedef struct _ThreeDRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + } ThreeDRec; + +typedef struct { + void (*shadowdraw)(); + } ThreeDClassPart; + +#define XtInheritXaw3dShadowDraw ((void (*)())_XtInherit) + +/* Full class record declaration. */ +typedef struct _ThreeDClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + } ThreeDClassRec; + +/* Class pointer. */ +extern ThreeDClassRec threeDClassRec; + + +#endif /* _ThreeDP_h */ diff --git a/vendor/x11iraf/xaw3d/Toggle.c b/vendor/x11iraf/xaw3d/Toggle.c new file mode 100644 index 00000000..66902c43 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Toggle.c @@ -0,0 +1,619 @@ +/* $XConsortium: Toggle.c,v 1.28 94/04/17 20:13:17 kaleb Exp $ */ + +/* + +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + */ + +/* + * Toggle.c - Toggle button widget + * + * Author: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * + * Date: January 12, 1989 + * + */ + +#include <stdio.h> + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xaw3d/ToggleP.h> + +/**************************************************************** + * + * Full class record constant + * + ****************************************************************/ + +/* Private Data */ + +/* + * The order of toggle and notify are important, as the state has + * to be set when we call the notify proc. + */ + +static char defaultTranslations[] = + "<EnterWindow>: highlight(Always) \n\ + <LeaveWindow>: unhighlight() \n\ + <Btn1Down>,<Btn1Up>: toggle() notify()"; + +#define offset(field) XtOffsetOf(ToggleRec, field) + +static XtResource resources[] = { + {XtNstate, XtCState, XtRBoolean, sizeof(Boolean), + offset(command.set), XtRString, "off"}, + {XtNradioGroup, XtCWidget, XtRWidget, sizeof(Widget), + offset(toggle.widget), XtRWidget, (XtPointer) NULL }, + {XtNradioData, XtCRadioData, XtRPointer, sizeof(XtPointer), + offset(toggle.radio_data), XtRPointer, (XtPointer) NULL }, +}; + +#undef offset + + +static void Toggle(), Initialize(), Notify(), ToggleSet(); +static void ToggleDestroy(), ClassInit(); +static Boolean SetValues(); + +/* Functions for handling the Radio Group. */ + +static RadioGroup * GetRadioGroup(); +static void CreateRadioGroup(), AddToRadioGroup(), TurnOffRadioSiblings(); +static void RemoveFromRadioGroup(); + +static XtActionsRec actionsList[] = +{ + {"toggle", Toggle}, + {"notify", Notify}, + {"set", ToggleSet}, +}; + +#define SuperClass ((CommandWidgetClass)&commandClassRec) + +ToggleClassRec toggleClassRec = { + { + (WidgetClass) SuperClass, /* superclass */ + "Toggle", /* class_name */ + sizeof(ToggleRec), /* size */ + ClassInit, /* class_initialize */ + NULL, /* class_part_initialize */ + FALSE, /* class_inited */ + Initialize, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* resource_count */ + NULLQUARK, /* xrm_class */ + FALSE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave */ + FALSE, /* visible_interest */ + NULL, /* destroy */ + XtInheritResize, /* resize */ + XtInheritExpose, /* expose */ + SetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + }, /* CoreClass fields initialization */ + { + XtInheritChangeSensitive /* change_sensitive */ + }, /* SimpleClass fields initialization */ + { + XtInheritXaw3dShadowDraw /* shadowdraw */ + }, /* ThreeDClass fields initialization */ + { + 0 /* field not used */ + }, /* LabelClass fields initialization */ + { + 0 /* field not used */ + }, /* CommandClass fields initialization */ + { + NULL, /* Set Procedure. */ + NULL, /* Unset Procedure. */ + NULL /* extension. */ + } /* ToggleClass fields initialization */ +}; + + /* for public consumption */ +WidgetClass toggleWidgetClass = (WidgetClass) &toggleClassRec; + +/**************************************************************** + * + * Private Procedures + * + ****************************************************************/ + +static void +ClassInit() +{ + XtActionList actions; + Cardinal num_actions; + Cardinal i; + ToggleWidgetClass class = (ToggleWidgetClass) toggleWidgetClass; + static XtConvertArgRec parentCvtArgs[] = { + {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent), + sizeof(Widget)} + }; + + XawInitializeWidgetSet(); + XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget, + parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone, + (XtDestructor)NULL); +/* + * Find the set and unset actions in the command widget's action table. + */ + + XtGetActionList(commandWidgetClass, &actions, &num_actions); + + for (i = 0 ; i < num_actions ; i++) { + if (streq(actions[i].string, "set")) + class->toggle_class.Set = actions[i].proc; + if (streq(actions[i].string, "unset")) + class->toggle_class.Unset = actions[i].proc; + + if ( (class->toggle_class.Set != NULL) && + (class->toggle_class.Unset != NULL) ) { + XtFree((char *) actions); + return; + } + } + +/* We should never get here. */ + XtError("Aborting, due to errors resolving bindings in the Toggle widget."); +} + +/*ARGSUSED*/ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + ToggleWidget tw = (ToggleWidget) new; + ToggleWidget tw_req = (ToggleWidget) request; + + tw->toggle.radio_group = NULL; + + if (tw->toggle.radio_data == NULL) + tw->toggle.radio_data = (XtPointer) new->core.name; + + if (tw->toggle.widget != NULL) { + if ( GetRadioGroup(tw->toggle.widget) == NULL) + CreateRadioGroup(new, tw->toggle.widget); + else + AddToRadioGroup( GetRadioGroup(tw->toggle.widget), new); + } + XtAddCallback(new, XtNdestroyCallback, ToggleDestroy, (XtPointer)NULL); + +/* + * Command widget assumes that the widget is unset, so we only + * have to handle the case where it needs to be set. + * + * If this widget is in a radio group then it may cause another + * widget to be unset, thus calling the notify proceedure. + * + * I want to set the toggle if the user set the state to "On" in + * the resource group, reguardless of what my ancestors did. + */ + + if (tw_req->command.set) + ToggleSet(new, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); +} + +/************************************************************ + * + * Action Procedures + * + ************************************************************/ + +/* ARGSUSED */ +static void +ToggleSet(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + ToggleWidgetClass class = (ToggleWidgetClass) w->core.widget_class; + + TurnOffRadioSiblings(w); + class->toggle_class.Set(w, event, NULL, 0); +} + +/* ARGSUSED */ +static void +Toggle(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + ToggleWidget tw = (ToggleWidget)w; + ToggleWidgetClass class = (ToggleWidgetClass) w->core.widget_class; + + if (tw->command.set) + class->toggle_class.Unset(w, event, NULL, 0); + else + ToggleSet(w, event, params, num_params); +} + +/* ARGSUSED */ +static void Notify(w,event,params,num_params) +Widget w; +XEvent *event; +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + ToggleWidget tw = (ToggleWidget) w; + long antilint = tw->command.set; + + XtCallCallbacks( w, XtNcallback, (XtPointer) antilint ); +} + +/************************************************************ + * + * Set specified arguments into widget + * + ***********************************************************/ + +/* ARGSUSED */ +static Boolean +SetValues (current, request, new, args, num_args) +Widget current, request, new; +ArgList args; +Cardinal *num_args; +{ + ToggleWidget oldtw = (ToggleWidget) current; + ToggleWidget tw = (ToggleWidget) new; + ToggleWidget rtw = (ToggleWidget) request; + + if (oldtw->toggle.widget != tw->toggle.widget) + XawToggleChangeRadioGroup(new, tw->toggle.widget); + + if (!tw->core.sensitive && oldtw->core.sensitive && rtw->command.set) + tw->command.set = True; + + if (oldtw->command.set != tw->command.set) { + tw->command.set = oldtw->command.set; + Toggle(new, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + } + return(FALSE); +} + +/* Function Name: ToggleDestroy + * Description: Destroy Callback for toggle widget. + * Arguments: w - the toggle widget that is being destroyed. + * junk, grabage - not used. + * Returns: none. + */ + +/* ARGSUSED */ +static void +ToggleDestroy(w, junk, garbage) +Widget w; +XtPointer junk, garbage; +{ + RemoveFromRadioGroup(w); +} + +/************************************************************ + * + * Below are all the private procedures that handle + * radio toggle buttons. + * + ************************************************************/ + +/* Function Name: GetRadioGroup + * Description: Gets the radio group associated with a give toggle + * widget. + * Arguments: w - the toggle widget who's radio group we are getting. + * Returns: the radio group associated with this toggle group. + */ + +static RadioGroup * +GetRadioGroup(w) +Widget w; +{ + ToggleWidget tw = (ToggleWidget) w; + + if (tw == NULL) return(NULL); + return( tw->toggle.radio_group ); +} + +/* Function Name: CreateRadioGroup + * Description: Creates a radio group. give two widgets. + * Arguments: w1, w2 - the toggle widgets to add to the radio group. + * Returns: none. + * + * NOTE: A pointer to the group is added to each widget's radio_group + * field. + */ + +static void +CreateRadioGroup(w1, w2) +Widget w1, w2; +{ + char error_buf[BUFSIZ]; + ToggleWidget tw1 = (ToggleWidget) w1; + ToggleWidget tw2 = (ToggleWidget) w2; + + if ( (tw1->toggle.radio_group != NULL) || (tw2->toggle.radio_group != NULL) ) { + (void) sprintf(error_buf, "%s %s", "Toggle Widget Error - Attempting", + "to create a new toggle group, when one already exists."); + XtWarning(error_buf); + } + + AddToRadioGroup( (RadioGroup *)NULL, w1 ); + AddToRadioGroup( GetRadioGroup(w1), w2 ); +} + +/* Function Name: AddToRadioGroup + * Description: Adds a toggle to the radio group. + * Arguments: group - any element of the radio group the we are adding to. + * w - the new toggle widget to add to the group. + * Returns: none. + */ + +static void +AddToRadioGroup(group, w) +RadioGroup * group; +Widget w; +{ + ToggleWidget tw = (ToggleWidget) w; + RadioGroup * local; + + local = (RadioGroup *) XtMalloc( sizeof(RadioGroup) ); + local->widget = w; + tw->toggle.radio_group = local; + + if (group == NULL) { /* Creating new group. */ + group = local; + group->next = NULL; + group->prev = NULL; + return; + } + local->prev = group; /* Adding to previous group. */ + if ((local->next = group->next) != NULL) + local->next->prev = local; + group->next = local; +} + +/* Function Name: TurnOffRadioSiblings + * Description: Deactivates all radio siblings. + * Arguments: widget - a toggle widget. + * Returns: none. + */ + +static void +TurnOffRadioSiblings(w) +Widget w; +{ + RadioGroup * group; + ToggleWidgetClass class = (ToggleWidgetClass) w->core.widget_class; + + if ( (group = GetRadioGroup(w)) == NULL) /* Punt if there is no group */ + return; + + /* Go to the top of the group. */ + + for ( ; group->prev != NULL ; group = group->prev ); + + while ( group != NULL ) { + ToggleWidget local_tog = (ToggleWidget) group->widget; + if ( local_tog->command.set ) { + class->toggle_class.Unset(group->widget, NULL, NULL, 0); + Notify( group->widget, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + } + group = group->next; + } +} + +/* Function Name: RemoveFromRadioGroup + * Description: Removes a toggle from a RadioGroup. + * Arguments: w - the toggle widget to remove. + * Returns: none. + */ + +static void +RemoveFromRadioGroup(w) +Widget w; +{ + RadioGroup * group = GetRadioGroup(w); + if (group != NULL) { + if (group->prev != NULL) + (group->prev)->next = group->next; + if (group->next != NULL) + (group->next)->prev = group->prev; + XtFree((char *) group); + } +} + +/************************************************************ + * + * Public Routines + * + ************************************************************/ + +/* Function Name: XawToggleChangeRadioGroup + * Description: Allows a toggle widget to change radio groups. + * Arguments: w - The toggle widget to change groups. + * radio_group - any widget in the new group. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawToggleChangeRadioGroup(Widget w, Widget radio_group) +#else +XawToggleChangeRadioGroup(w, radio_group) +Widget w, radio_group; +#endif +{ + ToggleWidget tw = (ToggleWidget) w; + RadioGroup * group; + + RemoveFromRadioGroup(w); + +/* + * If the toggle that we are about to add is set then we will + * unset all toggles in the new radio group. + */ + + if ( tw->command.set && radio_group != NULL ) + XawToggleUnsetCurrent(radio_group); + + if (radio_group != NULL) + if ((group = GetRadioGroup(radio_group)) == NULL) + CreateRadioGroup(w, radio_group); + else AddToRadioGroup(group, w); +} + +/* Function Name: XawToggleGetCurrent + * Description: Returns the RadioData associated with the toggle + * widget that is currently active in a toggle group. + * Arguments: w - any toggle widget in the toggle group. + * Returns: The XtNradioData associated with the toggle widget. + */ + +XtPointer +#if NeedFunctionPrototypes +XawToggleGetCurrent(Widget w) +#else +XawToggleGetCurrent(w) +Widget w; +#endif +{ + RadioGroup * group; + + if ( (group = GetRadioGroup(w)) == NULL) return(NULL); + for ( ; group->prev != NULL ; group = group->prev); + + while ( group != NULL ) { + ToggleWidget local_tog = (ToggleWidget) group->widget; + if ( local_tog->command.set ) + return( local_tog->toggle.radio_data ); + group = group->next; + } + return(NULL); +} + +/* Function Name: XawToggleSetCurrent + * Description: Sets the Toggle widget associated with the + * radio_data specified. + * Arguments: radio_group - any toggle widget in the toggle group. + * radio_data - radio data of the toggle widget to set. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawToggleSetCurrent(Widget radio_group, XtPointer radio_data) +#else +XawToggleSetCurrent(radio_group, radio_data) +Widget radio_group; +XtPointer radio_data; +#endif +{ + RadioGroup * group; + ToggleWidget local_tog; + +/* Special case of no radio group. */ + + if ( (group = GetRadioGroup(radio_group)) == NULL) { + local_tog = (ToggleWidget) radio_group; + if ( (local_tog->toggle.radio_data == radio_data) ) + if (!local_tog->command.set) { + ToggleSet((Widget) local_tog, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + Notify((Widget) local_tog, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + } + return; + } + +/* + * find top of radio_roup + */ + + for ( ; group->prev != NULL ; group = group->prev); + +/* + * search for matching radio data. + */ + + while ( group != NULL ) { + local_tog = (ToggleWidget) group->widget; + if ( (local_tog->toggle.radio_data == radio_data) ) { + if (!local_tog->command.set) { /* if not already set. */ + ToggleSet((Widget) local_tog, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + Notify((Widget) local_tog, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + } + return; /* found it, done */ + } + group = group->next; + } +} + +/* Function Name: XawToggleUnsetCurrent + * Description: Unsets all Toggles in the radio_group specified. + * Arguments: radio_group - any toggle widget in the toggle group. + * Returns: none. + */ + +void +#if NeedFunctionPrototypes +XawToggleUnsetCurrent(Widget radio_group) +#else +XawToggleUnsetCurrent(radio_group) +Widget radio_group; +#endif +{ + ToggleWidgetClass class; + ToggleWidget local_tog = (ToggleWidget) radio_group; + + /* Special Case no radio group. */ + + if (local_tog->command.set) { + class = (ToggleWidgetClass) local_tog->core.widget_class; + class->toggle_class.Unset(radio_group, NULL, NULL, 0); + Notify(radio_group, (XEvent *)NULL, (String *)NULL, (Cardinal *)0); + } + if ( GetRadioGroup(radio_group) == NULL) return; + TurnOffRadioSiblings(radio_group); +} + diff --git a/vendor/x11iraf/xaw3d/Toggle.h b/vendor/x11iraf/xaw3d/Toggle.h new file mode 100644 index 00000000..7083139f --- /dev/null +++ b/vendor/x11iraf/xaw3d/Toggle.h @@ -0,0 +1,177 @@ +/* + * $XConsortium: Toggle.h,v 1.16 94/04/17 20:13:19 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +/* + * ToggleP.h - Private definitions for Toggle widget + * + * Author: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * + * Date: January 12, 1989 + */ + +#ifndef _XawToggle_h +#define _XawToggle_h + +/*********************************************************************** + * + * Toggle Widget + * + ***********************************************************************/ + +#include <X11/Xaw3d/Command.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + radioGroup RadioGroup Widget NULL + + radioData RadioData Pointer (XPointer) Widget ++ + state State Boolean Off + + background Background Pixel XtDefaultBackground + bitmap Pixmap Pixmap None + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + callback Callback Pointer NULL + cursor Cursor Cursor None + destroyCallback Callback Pointer NULL + font Font XFontStructx* XtDefaultFont + foreground Foreground Pixel XtDefaultForeground + height Height Dimension text height + highlightThickness Thickness Dimension 2 + insensitiveBorder Insensitive Pixmap Gray + internalHeight Height Dimension 2 + internalWidth Width Dimension 4 + justify Justify XtJustify XtJustifyCenter + label Label String NULL + mappedWhenManaged MappedWhenManaged Boolean True + resize Resize Boolean True + sensitive Sensitive Boolean True + width Width Dimension text width + x Position Position 0 + y Position Position 0 + ++ To use the toggle as a radio toggle button, set this resource to point to + any other widget in the radio group. + +++ This is the data returned from a call to XtToggleGetCurrent, by default + this is set to the name of toggle widget. + +*/ + +/* + * These should be in StringDefs.h but aren't so we will define + * them here if they are needed. + */ + + +#define XtCWidget "Widget" +#define XtCState "State" +#define XtCRadioGroup "RadioGroup" +#define XtCRadioData "RadioData" + +#ifndef _XtStringDefs_h_ +#define XtRWidget "Widget" +#endif + +#define XtNstate "state" +#define XtNradioGroup "radioGroup" +#define XtNradioData "radioData" + +extern WidgetClass toggleWidgetClass; + +typedef struct _ToggleClassRec *ToggleWidgetClass; +typedef struct _ToggleRec *ToggleWidget; + + +/************************************************************ + * + * Public Functions + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Function Name: XawToggleChangeRadioGroup + * Description: Allows a toggle widget to change radio lists. + * Arguments: w - The toggle widget to change lists. + * radio_group - any widget in the new list. + * Returns: none. + */ + +extern void XawToggleChangeRadioGroup( +#if NeedFunctionPrototypes + Widget /* w */, + Widget /* radio_group */ +#endif +); + +/* Function Name: XawToggleGetCurrent + * Description: Returns the RadioData associated with the toggle + * widget that is currently active in a toggle list. + * Arguments: radio_group - any toggle widget in the toggle list. + * Returns: The XtNradioData associated with the toggle widget. + */ + +extern XtPointer XawToggleGetCurrent( +#if NeedFunctionPrototypes + Widget /* radio_group */ +#endif +); + +/* Function Name: XawToggleSetCurrent + * Description: Sets the Toggle widget associated with the + * radio_data specified. + * Arguments: radio_group - any toggle widget in the toggle list. + * radio_data - radio data of the toggle widget to set. + * Returns: none. + */ + +extern void XawToggleSetCurrent( +#if NeedFunctionPrototypes + Widget /* radio_group */, + XtPointer /* radio_data */ +#endif +); + +/* Function Name: XawToggleUnsetCurrent + * Description: Unsets all Toggles in the radio_group specified. + * Arguments: radio_group - any toggle widget in the toggle list. + * Returns: none. + */ + +extern void XawToggleUnsetCurrent( +#if NeedFunctionPrototypes + Widget /* radio_group */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawToggle_h */ diff --git a/vendor/x11iraf/xaw3d/ToggleP.h b/vendor/x11iraf/xaw3d/ToggleP.h new file mode 100644 index 00000000..0155ae48 --- /dev/null +++ b/vendor/x11iraf/xaw3d/ToggleP.h @@ -0,0 +1,113 @@ +/* $XConsortium: ToggleP.h,v 1.9 94/04/17 20:13:19 converse Exp $ */ + +/* + +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +/* + * ToggleP.h - Private definitions for Toggle widget + * + * Author: Chris D. Peterson + * MIT X Consortium + * kit@expo.lcs.mit.edu + * + * Date: January 12, 1989 + * + */ + +#ifndef _XawToggleP_h +#define _XawToggleP_h + +#include <X11/Xaw3d/Toggle.h> +#include <X11/Xaw3d/CommandP.h> + +/*********************************************************************** + * + * Toggle Widget Private Data + * + ***********************************************************************/ + +#define streq(a, b) ( strcmp((a), (b)) == 0 ) + +typedef struct _RadioGroup { + struct _RadioGroup *prev, *next; /* Pointers to other elements in group. */ + Widget widget; /* Widget corrosponding to this element. */ +} RadioGroup; + +/************************************ + * + * Class structure + * + ***********************************/ + + /* New fields for the Toggle widget class record */ +typedef struct _ToggleClass { + XtActionProc Set; + XtActionProc Unset; + XtPointer extension; +} ToggleClassPart; + + /* Full class record declaration */ +typedef struct _ToggleClassRec { + CoreClassPart core_class; + SimpleClassPart simple_class; + ThreeDClassPart threeD_class; + LabelClassPart label_class; + CommandClassPart command_class; + ToggleClassPart toggle_class; +} ToggleClassRec; + +extern ToggleClassRec toggleClassRec; + +/*************************************** + * + * Instance (widget) structure + * + **************************************/ + + /* New fields for the Toggle widget record */ +typedef struct { + /* resources */ + Widget widget; + XtPointer radio_data; + + /* private data */ + RadioGroup * radio_group; +} TogglePart; + + /* Full widget declaration */ +typedef struct _ToggleRec { + CorePart core; + SimplePart simple; + ThreeDPart threeD; + LabelPart label; + CommandPart command; + TogglePart toggle; +} ToggleRec; + +#endif /* _XawToggleP_h */ + + diff --git a/vendor/x11iraf/xaw3d/Tree.c b/vendor/x11iraf/xaw3d/Tree.c new file mode 100644 index 00000000..94b8d700 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Tree.c @@ -0,0 +1,1008 @@ +/* + * $XConsortium: Tree.c,v 1.45 94/04/17 20:13:20 kaleb Exp $ + * + +Copyright (c) 1990, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + * Copyright 1989 Prentice Hall + * + * Permission to use, copy, modify, and distribute this software for any + * purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation. + * + * Prentice Hall and the authors disclaim all warranties with regard + * to this software, including all implied warranties of merchantability and + * fitness. In no event shall Prentice Hall or the authors be liable + * for any special, indirect or cosequential damages or any damages whatsoever + * resulting from loss of use, data or profits, whether in an action of + * contract, negligence or other tortious action, arising out of or in + * connection with the use or performance of this software. + * + * Authors: Jim Fulton, MIT X Consortium, + * based on a version by Douglas Young, Prentice Hall + * + * This widget is based on the Tree widget described on pages 397-419 of + * Douglas Young's book "The X Window System, Programming and Applications + * with Xt OSF/Motif Edition." The layout code has been rewritten to use + * additional blank space to make the structure of the graph easier to see + * as well as to support vertical trees. + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xaw3d/Cardinals.h> +#include <X11/Xaw3d/TreeP.h> + +#define IsHorizontal(tw) ((tw)->tree.gravity == WestGravity || \ + (tw)->tree.gravity == EastGravity) + + + /* widget class method */ +static void ClassInitialize(); +static void Initialize(); +static void ConstraintInitialize(); +static void ConstraintDestroy(); +static Boolean ConstraintSetValues(); +static void Destroy(); +static Boolean SetValues(); +static XtGeometryResult GeometryManager(); +static void ChangeManaged(); +static void Redisplay(); +static XtGeometryResult QueryGeometry(); + + /* utility routines */ +static void insert_node(); +static void delete_node(); +static void layout_tree(); + + +/* + * resources of the tree itself + */ +static XtResource resources[] = { + { XtNautoReconfigure, XtCAutoReconfigure, XtRBoolean, sizeof (Boolean), + XtOffsetOf(TreeRec, tree.auto_reconfigure), XtRImmediate, + (XtPointer) FALSE }, + { XtNhSpace, XtCHSpace, XtRDimension, sizeof (Dimension), + XtOffsetOf(TreeRec, tree.hpad), XtRImmediate, (XtPointer) 0 }, + { XtNvSpace, XtCVSpace, XtRDimension, sizeof (Dimension), + XtOffsetOf(TreeRec, tree.vpad), XtRImmediate, (XtPointer) 0 }, + { XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), + XtOffsetOf(TreeRec, tree.foreground), XtRString, + XtDefaultForeground}, + { XtNlineWidth, XtCLineWidth, XtRDimension, sizeof (Dimension), + XtOffsetOf(TreeRec, tree.line_width), XtRImmediate, (XtPointer) 0 }, + { XtNgravity, XtCGravity, XtRGravity, sizeof (XtGravity), + XtOffsetOf(TreeRec, tree.gravity), XtRImmediate, + (XtPointer) WestGravity }, +}; + + +/* + * resources that are attached to all children of the tree + */ +static XtResource treeConstraintResources[] = { + { XtNtreeParent, XtCTreeParent, XtRWidget, sizeof (Widget), + XtOffsetOf(TreeConstraintsRec, tree.parent), XtRImmediate, NULL }, + { XtNtreeGC, XtCTreeGC, XtRGC, sizeof(GC), + XtOffsetOf(TreeConstraintsRec, tree.gc), XtRImmediate, NULL }, +}; + + +TreeClassRec treeClassRec = { + { + /* core_class fields */ + (WidgetClass) &constraintClassRec, /* superclass */ + "Tree", /* class_name */ + sizeof(TreeRec), /* widget_size */ + ClassInitialize, /* class_init */ + NULL, /* class_part_init */ + FALSE, /* class_inited */ + Initialize, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + NULL, /* actions */ + 0, /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + TRUE, /* compress_motion */ + TRUE, /* compress_exposure */ + TRUE, /* compress_enterleave*/ + TRUE, /* visible_interest */ + Destroy, /* destroy */ + NULL, /* resize */ + Redisplay, /* expose */ + SetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + NULL, /* tm_table */ + QueryGeometry, /* query_geometry */ + NULL, /* display_accelerator*/ + NULL, /* extension */ + }, + { + /* composite_class fields */ + GeometryManager, /* geometry_manager */ + ChangeManaged, /* change_managed */ + XtInheritInsertChild, /* insert_child */ + XtInheritDeleteChild, /* delete_child */ + NULL, /* extension */ + }, + { + /* constraint_class fields */ + treeConstraintResources, /* subresources */ + XtNumber(treeConstraintResources), /* subresource_count */ + sizeof(TreeConstraintsRec), /* constraint_size */ + ConstraintInitialize, /* initialize */ + ConstraintDestroy, /* destroy */ + ConstraintSetValues, /* set_values */ + NULL, /* extension */ + }, + { + /* Tree class fields */ + 0, /* ignore */ + } +}; + +WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec; + + +/***************************************************************************** + * * + * tree utility routines * + * * + *****************************************************************************/ + +static void initialize_dimensions (listp, sizep, n) + Dimension **listp; + int *sizep; + int n; +{ + int i; + Dimension *l; + + if (!*listp) { + *listp = (Dimension *) XtCalloc ((unsigned int) n, + (unsigned int) sizeof(Dimension)); + *sizep = ((*listp) ? n : 0); + return; + } + if (n > *sizep) { + *listp = (Dimension *) XtRealloc((char *) *listp, + (unsigned int) (n*sizeof(Dimension))); + if (!*listp) { + *sizep = 0; + return; + } + for (i = *sizep, l = (*listp) + i; i < n; i++, l++) *l = 0; + *sizep = n; + } + return; +} + +static GC get_tree_gc (w) + TreeWidget w; +{ + XtGCMask valuemask = GCBackground | GCForeground; + XGCValues values; + + values.background = w->core.background_pixel; + values.foreground = w->tree.foreground; + if (w->tree.line_width != 0) { + valuemask |= GCLineWidth; + values.line_width = w->tree.line_width; + } + + return XtGetGC ((Widget) w, valuemask, &values); +} + +static void insert_node (parent, node) + Widget parent, node; +{ + TreeConstraints pc; + TreeConstraints nc = TREE_CONSTRAINT(node); + int nindex; + + nc->tree.parent = parent; + + if (parent == NULL) return; + + /* + * If there isn't more room in the children array, + * allocate additional space. + */ + pc = TREE_CONSTRAINT(parent); + nindex = pc->tree.n_children; + + if (pc->tree.n_children == pc->tree.max_children) { + pc->tree.max_children += (pc->tree.max_children / 2) + 2; + pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children, + (unsigned int) + ((pc->tree.max_children) * + sizeof(Widget))); + } + + /* + * Add the sub_node in the next available slot and + * increment the counter. + */ + pc->tree.children[nindex] = node; + pc->tree.n_children++; +} + +static void delete_node (parent, node) + Widget parent, node; +{ + TreeConstraints pc; + int pos, i; + + /* + * Make sure the parent exists. + */ + if (!parent) return; + + pc = TREE_CONSTRAINT(parent); + + /* + * Find the sub_node on its parent's list. + */ + for (pos = 0; pos < pc->tree.n_children; pos++) + if (pc->tree.children[pos] == node) break; + + if (pos == pc->tree.n_children) return; + + /* + * Decrement the number of children + */ + pc->tree.n_children--; + + /* + * Fill in the gap left by the sub_node. + * Zero the last slot for good luck. + */ + for (i = pos; i < pc->tree.n_children; i++) + pc->tree.children[i] = pc->tree.children[i+1]; + + pc->tree.children[pc->tree.n_children]=0; +} + +static void check_gravity (tw, grav) + TreeWidget tw; + XtGravity grav; +{ + switch (tw->tree.gravity) { + case WestGravity: case NorthGravity: case EastGravity: case SouthGravity: + break; + default: + tw->tree.gravity = grav; + break; + } +} + + +/***************************************************************************** + * * + * tree class methods * + * * + *****************************************************************************/ + +static void ClassInitialize () +{ + XawInitializeWidgetSet(); + XtAddConverter (XtRString, XtRGravity, XmuCvtStringToGravity, + (XtConvertArgList) NULL, (Cardinal) 0); +} + + +/*ARGSUSED*/ +static void Initialize (grequest, gnew, args, num_args) + Widget grequest, gnew; + ArgList args; + Cardinal *num_args; +{ + TreeWidget request = (TreeWidget) grequest, new = (TreeWidget) gnew; + Arg arglist[2]; + + /* + * Make sure the widget's width and height are + * greater than zero. + */ + if (request->core.width <= 0) new->core.width = 5; + if (request->core.height <= 0) new->core.height = 5; + + /* + * Set the padding according to the orientation + */ + if (request->tree.hpad == 0 && request->tree.vpad == 0) { + if (IsHorizontal (request)) { + new->tree.hpad = TREE_HORIZONTAL_DEFAULT_SPACING; + new->tree.vpad = TREE_VERTICAL_DEFAULT_SPACING; + } else { + new->tree.hpad = TREE_VERTICAL_DEFAULT_SPACING; + new->tree.vpad = TREE_HORIZONTAL_DEFAULT_SPACING; + } + } + + /* + * Create a graphics context for the connecting lines. + */ + new->tree.gc = get_tree_gc (new); + + /* + * Create the hidden root widget. + */ + new->tree.tree_root = (Widget) NULL; + XtSetArg(arglist[0], XtNwidth, 1); + XtSetArg(arglist[1], XtNheight, 1); + new->tree.tree_root = XtCreateWidget ("root", widgetClass, gnew, + arglist,TWO); + + /* + * Allocate the array used to hold the widest values per depth + */ + new->tree.largest = NULL; + new->tree.n_largest = 0; + initialize_dimensions (&new->tree.largest, &new->tree.n_largest, + TREE_INITIAL_DEPTH); + + /* + * make sure that our gravity is one of the acceptable values + */ + check_gravity (new, WestGravity); +} + + +/* ARGSUSED */ +static void ConstraintInitialize (request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + TreeConstraints tc = TREE_CONSTRAINT(new); + TreeWidget tw = (TreeWidget) new->core.parent; + + /* + * Initialize the widget to have no sub-nodes. + */ + tc->tree.n_children = 0; + tc->tree.max_children = 0; + tc->tree.children = (Widget *) NULL; + tc->tree.x = tc->tree.y = 0; + tc->tree.bbsubwidth = 0; + tc->tree.bbsubheight = 0; + + + /* + * If this widget has a super-node, add it to that + * widget' sub-nodes list. Otherwise make it a sub-node of + * the tree_root widget. + */ + if (tc->tree.parent) + insert_node (tc->tree.parent, new); + else if (tw->tree.tree_root) + insert_node (tw->tree.tree_root, new); +} + + +/* ARGSUSED */ +static Boolean SetValues (gcurrent, grequest, gnew, args, num_args) + Widget gcurrent, grequest, gnew; + ArgList args; + Cardinal *num_args; +{ + TreeWidget current = (TreeWidget) gcurrent, new = (TreeWidget) gnew; + Boolean redraw = FALSE; + + /* + * If the foreground color has changed, redo the GC's + * and indicate a redraw. + */ + if (new->tree.foreground != current->tree.foreground || + new->core.background_pixel != current->core.background_pixel || + new->tree.line_width != current->tree.line_width) { + XtReleaseGC (gnew, new->tree.gc); + new->tree.gc = get_tree_gc (new); + redraw = TRUE; + } + + /* + * If the minimum spacing has changed, recalculate the + * tree layout. layout_tree() does a redraw, so we don't + * need SetValues to do another one. + */ + if (new->tree.gravity != current->tree.gravity) { + check_gravity (new, current->tree.gravity); + } + + if (IsHorizontal(new) != IsHorizontal(current)) { + if (new->tree.vpad == current->tree.vpad && + new->tree.hpad == current->tree.hpad) { + new->tree.vpad = current->tree.hpad; + new->tree.hpad = current->tree.vpad; + } + } + + if (new->tree.vpad != current->tree.vpad || + new->tree.hpad != current->tree.hpad || + new->tree.gravity != current->tree.gravity) { + layout_tree (new, TRUE); + redraw = FALSE; + } + return redraw; +} + + +/* ARGSUSED */ +static Boolean ConstraintSetValues (current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + TreeConstraints newc = TREE_CONSTRAINT(new); + TreeConstraints curc = TREE_CONSTRAINT(current); + TreeWidget tw = (TreeWidget) new->core.parent; + + /* + * If the parent field has changed, remove the widget + * from the old widget's children list and add it to the + * new one. + */ + if (curc->tree.parent != newc->tree.parent){ + if (curc->tree.parent) + delete_node (curc->tree.parent, new); + if (newc->tree.parent) + insert_node(newc->tree.parent, new); + + /* + * If the Tree widget has been realized, + * compute new layout. + */ + if (XtIsRealized((Widget)tw)) + layout_tree (tw, FALSE); + } + return False; +} + + +static void ConstraintDestroy (w) + Widget w; +{ + TreeConstraints tc = TREE_CONSTRAINT(w); + TreeWidget tw = (TreeWidget) XtParent(w); + int i; + + /* + * Remove the widget from its parent's sub-nodes list and + * make all this widget's sub-nodes sub-nodes of the parent. + */ + + if (tw->tree.tree_root == w) { + if (tc->tree.n_children > 0) + tw->tree.tree_root = tc->tree.children[0]; + else + tw->tree.tree_root = NULL; + } + + delete_node (tc->tree.parent, (Widget) w); + for (i = 0; i< tc->tree.n_children; i++) + insert_node (tc->tree.parent, tc->tree.children[i]); + + layout_tree ((TreeWidget) (w->core.parent), FALSE); +} + +/* ARGSUSED */ +static XtGeometryResult GeometryManager (w, request, reply) + Widget w; + XtWidgetGeometry *request; + XtWidgetGeometry *reply; +{ + + TreeWidget tw = (TreeWidget) w->core.parent; + + /* + * No position changes allowed!. + */ + if ((request->request_mode & CWX && request->x!=w->core.x) + ||(request->request_mode & CWY && request->y!=w->core.y)) + return (XtGeometryNo); + + /* + * Allow all resize requests. + */ + + if (request->request_mode & CWWidth) + w->core.width = request->width; + if (request->request_mode & CWHeight) + w->core.height = request->height; + if (request->request_mode & CWBorderWidth) + w->core.border_width = request->border_width; + + if (tw->tree.auto_reconfigure) layout_tree (tw, FALSE); + return (XtGeometryYes); +} + +static void ChangeManaged (gw) + Widget gw; +{ + layout_tree ((TreeWidget) gw, FALSE); +} + + +static void Destroy (gw) + Widget gw; +{ + TreeWidget w = (TreeWidget) gw; + + XtReleaseGC (gw, w->tree.gc); + if (w->tree.largest) XtFree ((char *) w->tree.largest); +} + + +/* ARGSUSED */ +static void Redisplay (gw, event, region) + Widget gw; + XEvent *event; + Region region; +{ + TreeWidget tw = (TreeWidget) gw; + + /* + * If the Tree widget is visible, visit each managed child. + */ + if (tw->core.visible) { + int i, j; + Display *dpy = XtDisplay (tw); + Window w = XtWindow (tw); + + for (i = 0; i < tw->composite.num_children; i++) { + Widget child = tw->composite.children[i]; + TreeConstraints tc = TREE_CONSTRAINT(child); + + /* + * Don't draw lines from the fake tree_root. + */ + if (child != tw->tree.tree_root && tc->tree.n_children) { + int srcx = child->core.x + child->core.border_width; + int srcy = child->core.y + child->core.border_width; + + switch (tw->tree.gravity) { + case WestGravity: + srcx += child->core.width + child->core.border_width; + /* fall through */ + case EastGravity: + srcy += child->core.height / 2; + break; + + case NorthGravity: + srcy += child->core.height + child->core.border_width; + /* fall through */ + case SouthGravity: + srcx += child->core.width / 2; + break; + } + + for (j = 0; j < tc->tree.n_children; j++) { + Widget k = tc->tree.children[j]; + GC gc = (tc->tree.gc ? tc->tree.gc : tw->tree.gc); + + switch (tw->tree.gravity) { + case WestGravity: + /* + * right center to left center + */ + XDrawLine (dpy, w, gc, srcx, srcy, + (int) k->core.x, + (k->core.y + ((int) k->core.border_width) + + ((int) k->core.height) / 2)); + break; + + case NorthGravity: + /* + * bottom center to top center + */ + XDrawLine (dpy, w, gc, srcx, srcy, + (k->core.x + ((int) k->core.border_width) + + ((int) k->core.width) / 2), + (int) k->core.y); + break; + + case EastGravity: + /* + * left center to right center + */ + XDrawLine (dpy, w, gc, srcx, srcy, + (k->core.x + + (((int) k->core.border_width) << 1) + + (int) k->core.width), + (k->core.y + ((int) k->core.border_width) + + ((int) k->core.height) / 2)); + break; + + case SouthGravity: + /* + * top center to bottom center + */ + XDrawLine (dpy, w, gc, srcx, srcy, + (k->core.x + ((int) k->core.border_width) + + ((int) k->core.width) / 2), + (k->core.y + + (((int) k->core.border_width) << 1) + + (int) k->core.height)); + break; + } + } + } + } + } +} + +static XtGeometryResult QueryGeometry (w, intended, preferred) + Widget w; + XtWidgetGeometry *intended, *preferred; +{ + TreeWidget tw = (TreeWidget) w; + + preferred->request_mode = (CWWidth | CWHeight); + preferred->width = tw->tree.maxwidth; + preferred->height = tw->tree.maxheight; + + if (((intended->request_mode & (CWWidth | CWHeight)) == + (CWWidth | CWHeight)) && + intended->width == preferred->width && + intended->height == preferred->height) + return XtGeometryYes; + else if (preferred->width == w->core.width && + preferred->height == w->core.height) + return XtGeometryNo; + else + return XtGeometryAlmost; +} + + +/***************************************************************************** + * * + * tree layout algorithm * + * * + * Each node in the tree is "shrink-wrapped" with a minimal bounding * + * rectangle, laid next to its siblings (with a small about of padding in * + * between) and then wrapped with their parent. Parents are centered about * + * their children (or vice versa if the parent is larger than the children). * + * * + *****************************************************************************/ + +static void compute_bounding_box_subtree (tree, w, depth) + TreeWidget tree; + Widget w; + int depth; +{ + TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */ + int i; + Bool horiz = IsHorizontal (tree); + Dimension newwidth, newheight; + Dimension bw2 = w->core.border_width * 2; + + /* + * Set the max-size per level. + */ + if (depth >= tree->tree.n_largest) { + initialize_dimensions (&tree->tree.largest, + &tree->tree.n_largest, depth + 1); + } + newwidth = ((horiz ? w->core.width : w->core.height) + bw2); + if (tree->tree.largest[depth] < newwidth) + tree->tree.largest[depth] = newwidth; + + + /* + * initialize + */ + tc->tree.bbwidth = w->core.width + bw2; + tc->tree.bbheight = w->core.height + bw2; + + if (tc->tree.n_children == 0) return; + + /* + * Figure the size of the opposite dimension (vertical if tree is + * horizontal, else vice versa). The other dimension will be set + * in the second pass once we know the maximum dimensions. + */ + newwidth = 0; + newheight = 0; + for (i = 0; i < tc->tree.n_children; i++) { + Widget child = tc->tree.children[i]; + TreeConstraints cc = TREE_CONSTRAINT(child); + + compute_bounding_box_subtree (tree, child, depth + 1); + + if (horiz) { + if (newwidth < cc->tree.bbwidth) newwidth = cc->tree.bbwidth; + newheight += tree->tree.vpad + cc->tree.bbheight; + } else { + if (newheight < cc->tree.bbheight) newheight = cc->tree.bbheight; + newwidth += tree->tree.hpad + cc->tree.bbwidth; + } + } + + + tc->tree.bbsubwidth = newwidth; + tc->tree.bbsubheight = newheight; + + /* + * Now fit parent onto side (or top) of bounding box and correct for + * extra padding. Be careful of unsigned arithmetic. + */ + if (horiz) { + tc->tree.bbwidth += tree->tree.hpad + newwidth; + newheight -= tree->tree.vpad; + if (newheight > tc->tree.bbheight) tc->tree.bbheight = newheight; + } else { + tc->tree.bbheight += tree->tree.vpad + newheight; + newwidth -= tree->tree.hpad; + if (newwidth > tc->tree.bbwidth) tc->tree.bbwidth = newwidth; + } +} + + +static void set_positions (tw, w, level) + TreeWidget tw; + Widget w; + int level; +{ + int i; + + if (w) { + TreeConstraints tc = TREE_CONSTRAINT(w); + + if (level > 0) { + /* + * mirror if necessary + */ + switch (tw->tree.gravity) { + case EastGravity: + tc->tree.x = (((Position) tw->tree.maxwidth) - + ((Position) w->core.width) - tc->tree.x); + break; + + case SouthGravity: + tc->tree.y = (((Position) tw->tree.maxheight) - + ((Position) w->core.height) - tc->tree.y); + break; + } + + /* + * Move the widget into position. + */ + XtMoveWidget (w, tc->tree.x, tc->tree.y); + } + + /* + * Set the positions of all children. + */ + for (i = 0; i < tc->tree.n_children; i++) + set_positions (tw, tc->tree.children[i], level + 1); + } +} + + +static void arrange_subtree (tree, w, depth, x, y) + TreeWidget tree; + Widget w; + int depth; + Position x, y; +{ + TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */ + TreeConstraints firstcc, lastcc; + int i; + int newx, newy; + Bool horiz = IsHorizontal (tree); + Widget child = NULL; + Dimension tmp; + Dimension bw2 = w->core.border_width * 2; + Bool relayout = True; + + + /* + * If no children, then just lay out where requested. + */ + tc->tree.x = x; + tc->tree.y = y; + + if (horiz) { + int myh = (w->core.height + bw2); + + if (myh > (int)tc->tree.bbsubheight) { + y += (myh - (int)tc->tree.bbsubheight) / 2; + relayout = False; + } + } else { + int myw = (w->core.width + bw2); + + if (myw > (int)tc->tree.bbsubwidth) { + x += (myw - (int)tc->tree.bbsubwidth) / 2; + relayout = False; + } + } + + if ((tmp = ((Dimension) x) + tc->tree.bbwidth) > tree->tree.maxwidth) + tree->tree.maxwidth = tmp; + if ((tmp = ((Dimension) y) + tc->tree.bbheight) > tree->tree.maxheight) + tree->tree.maxheight = tmp; + + if (tc->tree.n_children == 0) return; + + + /* + * Have children, so walk down tree laying out children, then laying + * out parents. + */ + if (horiz) { + newx = x + tree->tree.largest[depth]; + if (depth > 0) newx += tree->tree.hpad; + newy = y; + } else { + newx = x; + newy = y + tree->tree.largest[depth]; + if (depth > 0) newy += tree->tree.vpad; + } + + for (i = 0; i < tc->tree.n_children; i++) { + TreeConstraints cc; + + child = tc->tree.children[i]; /* last value is used outside loop */ + cc = TREE_CONSTRAINT(child); + + arrange_subtree (tree, child, depth + 1, newx, newy); + if (horiz) { + newy += tree->tree.vpad + cc->tree.bbheight; + } else { + newx += tree->tree.hpad + cc->tree.bbwidth; + } + } + + /* + * now layout parent between first and last children + */ + if (relayout) { + Position adjusted; + firstcc = TREE_CONSTRAINT (tc->tree.children[0]); + lastcc = TREE_CONSTRAINT (child); + + /* Adjustments are disallowed if they result in a position above + * or to the left of the originally requested position, because + * this could collide with the position of the previous sibling. + */ + if (horiz) { + tc->tree.x = x; + adjusted = firstcc->tree.y + + ((lastcc->tree.y + (Position) child->core.height + + (Position) child->core.border_width * 2 - + firstcc->tree.y - (Position) w->core.height - + (Position) w->core.border_width * 2 + 1) / 2); + if (adjusted > tc->tree.y) tc->tree.y = adjusted; + } else { + adjusted = firstcc->tree.x + + ((lastcc->tree.x + (Position) child->core.width + + (Position) child->core.border_width * 2 - + firstcc->tree.x - (Position) w->core.width - + (Position) w->core.border_width * 2 + 1) / 2); + if (adjusted > tc->tree.x) tc->tree.x = adjusted; + tc->tree.y = y; + } + } +} + +static void set_tree_size (tw, insetvalues, width, height) + TreeWidget tw; + Boolean insetvalues; + Dimension width, height; +{ + if (insetvalues) { + tw->core.width = width; + tw->core.height = height; + } else { + Dimension replyWidth = 0, replyHeight = 0; + XtGeometryResult result = XtMakeResizeRequest ((Widget) tw, + width, height, + &replyWidth, + &replyHeight); + /* + * Accept any compromise. + */ + if (result == XtGeometryAlmost) + XtMakeResizeRequest ((Widget) tw, replyWidth, replyHeight, + (Dimension *) NULL, (Dimension *) NULL); + } + return; +} + +static void layout_tree (tw, insetvalues) + TreeWidget tw; + Boolean insetvalues; +{ + int i; + Dimension *dp; + + /* + * Do a depth-first search computing the width and height of the bounding + * box for the tree at that position (and below). Then, walk again using + * this information to layout the children at each level. + */ + + if (tw->tree.tree_root == NULL) + return; + + tw->tree.maxwidth = tw->tree.maxheight = 0; + for (i = 0, dp = tw->tree.largest; i < tw->tree.n_largest; i++, dp++) + *dp = 0; + initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest, + tw->tree.n_largest); + compute_bounding_box_subtree (tw, tw->tree.tree_root, 0); + + /* + * Second pass to do final layout. Each child's bounding box is stacked + * on top of (if horizontal, else next to) on top of its siblings. The + * parent is centered between the first and last children. + */ + arrange_subtree (tw, tw->tree.tree_root, 0, 0, 0); + + /* + * Move each widget into place. + */ + set_tree_size (tw, insetvalues, tw->tree.maxwidth, tw->tree.maxheight); + set_positions (tw, tw->tree.tree_root, 0); + + /* + * And redisplay. + */ + if (XtIsRealized ((Widget) tw)) { + XClearArea (XtDisplay(tw), XtWindow((Widget)tw), 0, 0, 0, 0, True); + } +} + + + +/***************************************************************************** + * * + * Public Routines * + * * + *****************************************************************************/ + +void +#if NeedFunctionPrototypes +XawTreeForceLayout (Widget tree) +#else +XawTreeForceLayout (tree) + Widget tree; +#endif +{ + layout_tree ((TreeWidget) tree, FALSE); +} + diff --git a/vendor/x11iraf/xaw3d/Tree.h b/vendor/x11iraf/xaw3d/Tree.h new file mode 100644 index 00000000..fde1117b --- /dev/null +++ b/vendor/x11iraf/xaw3d/Tree.h @@ -0,0 +1,125 @@ +/* + * $XConsortium: Tree.h,v 1.13 94/04/17 20:13:22 kaleb Exp $ + * + +Copyright (c) 1990, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + * Copyright 1989 Prentice Hall + * + * Permission to use, copy, modify, and distribute this software for any + * purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation. + * + * Prentice Hall and the authors disclaim all warranties with regard + * to this software, including all implied warranties of merchantability and + * fitness. In no event shall Prentice Hall or the authors be liable + * for any special, indirect or cosequential damages or any damages whatsoever + * resulting from loss of use, data or profits, whether in an action of + * contract, negligence or other tortious action, arising out of or in + * connection with the use or performance of this software. + * + * Authors: Jim Fulton, MIT X Consortium, + * based on a version by Douglas Young, Prentice Hall + * + * This widget is based on the Tree widget described on pages 397-419 of + * Douglas Young's book "The X Window System, Programming and Applications + * with Xt OSF/Motif Edition." The layout code has been rewritten to use + * additional blank space to make the structure of the graph easier to see + * as well as to support vertical trees. + */ + + +#ifndef _XawTree_h +#define _XawTree_h + +#include <X11/Xmu/Converters.h> + +/****************************************************************************** + * + * Tree Widget (subclass of ConstraintClass) + * + ****************************************************************************** + * + * Parameters: + * + * Name Class Type Default + * ---- ----- ---- ------- + * + * autoReconfigure AutoReconfigure Boolean FALSE + * background Background Pixel XtDefaultBackground + * foreground Foreground Pixel XtDefaultForeground + * gravity Gravity XtGravity West + * hSpace HSpace Dimension 20 + * lineWidth LineWidth Dimension 0 + * vSpace VSpace Dimension 6 + * + * + * Constraint Resources attached to children: + * + * treeGC TreeGC GC NULL + * treeParent TreeParent Widget NULL + * + * + *****************************************************************************/ + + /* new instance field names */ +#ifndef _XtStringDefs_h_ +#define XtNhSpace "hSpace" +#define XtNvSpace "vSpace" +#define XtCHSpace "HSpace" +#define XtCVSpace "VSpace" +#endif + +#define XtNautoReconfigure "autoReconfigure" +#define XtNlineWidth "lineWidth" +#define XtNtreeGC "treeGC" +#define XtNtreeParent "treeParent" +#define XtNgravity "gravity" + + /* new class field names */ +#define XtCAutoReconfigure "AutoReconfigure" +#define XtCLineWidth "LineWidth" +#define XtCTreeGC "TreeGC" +#define XtCTreeParent "TreeParent" +#define XtCGravity "Gravity" + +#define XtRGC "GC" + /* external declarations */ +extern WidgetClass treeWidgetClass; + +typedef struct _TreeClassRec *TreeWidgetClass; +typedef struct _TreeRec *TreeWidget; + +_XFUNCPROTOBEGIN + +extern void XawTreeForceLayout ( +#if NeedFunctionPrototypes + Widget /* tree */ +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawTree_h */ diff --git a/vendor/x11iraf/xaw3d/TreeP.h b/vendor/x11iraf/xaw3d/TreeP.h new file mode 100644 index 00000000..9905138b --- /dev/null +++ b/vendor/x11iraf/xaw3d/TreeP.h @@ -0,0 +1,132 @@ +/* + * $XConsortium: TreeP.h,v 1.14 94/04/17 20:13:24 jim Exp $ + * + +Copyright (c) 1990 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + * Copyright 1989 Prentice Hall + * + * Permission to use, copy, modify, and distribute this software for any + * purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation. + * + * Prentice Hall and the authors disclaim all warranties with regard + * to this software, including all implied warranties of merchantability and + * fitness. In no event shall Prentice Hall or the authors be liable + * for any special, indirect or cosequential damages or any damages whatsoever + * resulting from loss of use, data or profits, whether in an action of + * contract, negligence or other tortious action, arising out of or in + * connection with the use or performance of this software. + * + * Authors: Jim Fulton, MIT X Consortium, + * based on a version by Douglas Young, Prentice Hall + * + * This widget is based on the Tree widget described on pages 397-419 of + * Douglas Young's book "The X Window System, Programming and Applications + * with Xt OSF/Motif Edition." The layout code has been rewritten to use + * additional blank space to make the structure of the graph easier to see + * as well as to support vertical trees. + */ + + +#ifndef _XawTreeP_h +#define _XawTreeP_h + +#include <X11/Xaw3d/Tree.h> + +typedef struct _TreeClassPart { + int ignore; +} TreeClassPart; + +typedef struct _TreeClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + TreeClassPart tree_class; +} TreeClassRec; + +extern TreeClassRec treeClassRec; + +typedef struct { + /* fields available through resources */ + Dimension hpad; /* hSpace/HSpace */ + Dimension vpad; /* vSpace/VSpace */ + Dimension line_width; /* lineWidth/LineWidth */ + Pixel foreground; /* foreground/Foreground */ + XtGravity gravity; /* gravity/Gravity */ + Boolean auto_reconfigure; /* autoReconfigure/AutoReconfigure */ + /* private fields */ + GC gc; /* used to draw lines */ + Widget tree_root; /* hidden root off all children */ + Dimension *largest; /* list of largest per depth */ + int n_largest; /* number of elements in largest */ + Dimension maxwidth, maxheight; /* for shrink wrapping */ +} TreePart; + + +typedef struct _TreeRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + TreePart tree; +} TreeRec; + + +/* + * structure attached to all children + */ +typedef struct _TreeConstraintsPart { + /* resources */ + Widget parent; /* treeParent/TreeParent */ + GC gc; /* treeGC/TreeGC */ + /* private data */ + Widget *children; + int n_children; + int max_children; + Dimension bbsubwidth, bbsubheight; /* bounding box of sub tree */ + Dimension bbwidth, bbheight; /* bounding box including node */ + Position x, y; +} TreeConstraintsPart; + +typedef struct _TreeConstraintsRec { + TreeConstraintsPart tree; +} TreeConstraintsRec, *TreeConstraints; + + +/* + * useful macros + */ + +#define TREE_CONSTRAINT(w) \ + ((TreeConstraints)((w)->core.constraints)) + +#define TREE_INITIAL_DEPTH 10 /* for allocating largest array */ +#define TREE_HORIZONTAL_DEFAULT_SPACING 20 +#define TREE_VERTICAL_DEFAULT_SPACING 6 + +#endif /* _XawTreeP_h */ + + + diff --git a/vendor/x11iraf/xaw3d/Vendor.c b/vendor/x11iraf/xaw3d/Vendor.c new file mode 100644 index 00000000..4d693190 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Vendor.c @@ -0,0 +1,461 @@ +/* $XConsortium: Vendor.c,v 1.27 94/04/17 20:13:25 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * This is a copy of Xt/Vendor.c with an additional ClassInitialize + * procedure to register Xmu resource type converters, and all the + * monkey business associated with input methods... + * + */ + +/* Make sure all wm properties can make it out of the resource manager */ + +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/ShellP.h> +#include <X11/VendorP.h> +#include <X11/Xmu/Converters.h> +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/Editres.h> +#include <X11/Xmu/ExtAgent.h> + +/* The following two headers are for the input method. */ + +#include <X11/Xaw3d/VendorEP.h> +#include <X11/Xaw3d/XawImP.h> + + +static XtResource resources[] = { + {XtNinput, XtCInput, XtRBool, sizeof(Bool), + XtOffsetOf(VendorShellRec, wm.wm_hints.input), + XtRImmediate, (XtPointer)True} +}; + +/*************************************************************************** + * + * Vendor shell class record + * + ***************************************************************************/ + +static void XawVendorShellClassInitialize(); +static void XawVendorShellClassPartInit(); +static void XawVendorShellInitialize(); +static Boolean XawVendorShellSetValues(); +static void Realize(), ChangeManaged(); +static XtGeometryResult GeometryManager(); +void XawVendorShellExtResize(); + +static CompositeClassExtensionRec vendorCompositeExt = { + /* next_extension */ NULL, + /* record_type */ NULLQUARK, + /* version */ XtCompositeExtensionVersion, + /* record_size */ sizeof (CompositeClassExtensionRec), + /* accepts_objects */ TRUE, + /* allows_change_managed_set */ FALSE +}; + +#define SuperClass (&wmShellClassRec) +externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { + { + /* superclass */ (WidgetClass)SuperClass, + /* class_name */ "VendorShell", + /* size */ sizeof(VendorShellRec), + /* class_initialize */ XawVendorShellClassInitialize, + /* class_part_init */ XawVendorShellClassPartInit, + /* Class init'ed ? */ FALSE, + /* initialize */ XawVendorShellInitialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* resource_count */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ FALSE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ FALSE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ XawVendorShellExtResize, + /* expose */ NULL, + /* set_values */ XawVendorShellSetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* intrinsics version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ NULL, + /* query_geometry */ NULL, + /* display_accelerator*/ NULL, + /* extension */ NULL + },{ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ (XtPointer) &vendorCompositeExt + },{ + /* extension */ NULL + },{ + /* extension */ NULL + },{ + /* extension */ NULL + } +}; + +externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass = + (WidgetClass) (&vendorShellClassRec); + + +/*************************************************************************** + * + * The following section is for the Vendor shell Extension class record + * + ***************************************************************************/ + +static XtResource ext_resources[] = { + {XtNinputMethod, XtCInputMethod, XtRString, sizeof(String), + XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.input_method), + XtRString, (XtPointer)NULL}, + {XtNpreeditType, XtCPreeditType, XtRString, sizeof(String), + XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.preedit_type), + XtRString, (XtPointer)"OverTheSpot,OffTheSpot,Root"}, + {XtNopenIm, XtCOpenIm, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.open_im), + XtRImmediate, (XtPointer)TRUE}, + {XtNsharedIc, XtCSharedIc, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XawVendorShellExtRec, vendor_ext.ic.shared_ic), + XtRImmediate, (XtPointer)FALSE} +}; + +static void XawVendorShellExtClassInitialize(); +static void XawVendorShellExtInitialize(); +static void XawVendorShellExtDestroy(); +static Boolean XawVendorShellExtSetValues(); + +externaldef(vendorshellextclassrec) XawVendorShellExtClassRec + xawvendorShellExtClassRec = { + { + /* superclass */ (WidgetClass)&objectClassRec, + /* class_name */ "VendorShellExt", + /* size */ sizeof(XawVendorShellExtRec), + /* class_initialize */ XawVendorShellExtClassInitialize, + /* class_part_initialize*/ NULL, + /* Class init'ed ? */ FALSE, + /* initialize */ XawVendorShellExtInitialize, + /* initialize_hook */ NULL, + /* pad */ NULL, + /* pad */ NULL, + /* pad */ 0, + /* resources */ ext_resources, + /* resource_count */ XtNumber(ext_resources), + /* xrm_class */ NULLQUARK, + /* pad */ FALSE, + /* pad */ FALSE, + /* pad */ FALSE, + /* pad */ FALSE, + /* destroy */ XawVendorShellExtDestroy, + /* pad */ NULL, + /* pad */ NULL, + /* set_values */ XawVendorShellExtSetValues, + /* set_values_hook */ NULL, + /* pad */ NULL, + /* get_values_hook */ NULL, + /* pad */ NULL, + /* version */ XtVersion, + /* callback_offsets */ NULL, + /* pad */ NULL, + /* pad */ NULL, + /* pad */ NULL, + /* extension */ NULL + },{ + /* extension */ NULL + } +}; + +externaldef(xawvendorshellwidgetclass) WidgetClass + xawvendorShellExtWidgetClass = (WidgetClass) (&xawvendorShellExtClassRec); + + +/*ARGSUSED*/ +static Boolean +XawCvtCompoundTextToString(dpy, args, num_args, fromVal, toVal, cvt_data) +Display *dpy; +XrmValuePtr args; +Cardinal *num_args; +XrmValue *fromVal; +XrmValue *toVal; +XtPointer *cvt_data; +{ + XTextProperty prop; + char **list; + int count; + static char *mbs = NULL; + int len; + + prop.value = (unsigned char *)fromVal->addr; + prop.encoding = XA_COMPOUND_TEXT(dpy); + prop.format = 8; + prop.nitems = fromVal->size; + + if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) { + XtAppWarningMsg(XtDisplayToApplicationContext(dpy), + "converter", "XmbTextPropertyToTextList", "XawError", + "conversion from CT to MB failed.", NULL, 0); + return False; + } + len = strlen(*list); + toVal->size = len; + mbs = XtRealloc(mbs, len + 1); /* keep buffer because no one call free :( */ + strcpy(mbs, *list); + XFreeStringList(list); + toVal->addr = (XtPointer)mbs; + return True; +} + +static void XawVendorShellClassInitialize() +{ + static XtConvertArgRec screenConvertArg[] = { + {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), + sizeof(Screen *)} + }; + + XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor, + screenConvertArg, XtNumber(screenConvertArg)); + + XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap, + screenConvertArg, XtNumber(screenConvertArg)); + + XtSetTypeConverter("CompoundText", XtRString, XawCvtCompoundTextToString, + NULL, 0, XtCacheNone, NULL); +} + +static void XawVendorShellClassPartInit(class) + WidgetClass class; +{ + CompositeClassExtension ext; + VendorShellWidgetClass vsclass = (VendorShellWidgetClass) class; + + if ((ext = (CompositeClassExtension) + XtGetClassExtension (class, + XtOffsetOf(CompositeClassRec, + composite_class.extension), + NULLQUARK, 1L, (Cardinal) 0)) == NULL) { + ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec); + if (ext != NULL) { + ext->next_extension = vsclass->composite_class.extension; + ext->record_type = NULLQUARK; + ext->version = XtCompositeExtensionVersion; + ext->record_size = sizeof (CompositeClassExtensionRec); + ext->accepts_objects = TRUE; + ext->allows_change_managed_set = FALSE; + vsclass->composite_class.extension = (XtPointer) ext; + } + } +} + +#ifdef __osf__ +/* stupid OSF/1 shared libraries have the wrong semantics */ +/* symbols do not get resolved external to the shared library */ +void _XawFixupVendorShell() +{ + transientShellWidgetClass->core_class.superclass = + (WidgetClass) &vendorShellClassRec; + topLevelShellWidgetClass->core_class.superclass = + (WidgetClass) &vendorShellClassRec; +} +#endif + +/* ARGSUSED */ +static void XawVendorShellInitialize(req, new, args, num_args) + Widget req, new; + ArgList args; + Cardinal *num_args; +{ + XtAddEventHandler(new, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL); + XtAddEventHandler(new, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL); + XtCreateWidget("shellext", xawvendorShellExtWidgetClass, + new, args, *num_args); +} + +/* ARGSUSED */ +static Boolean XawVendorShellSetValues(old, ref, new) + Widget old, ref, new; +{ + return FALSE; +} + +static void Realize(wid, vmask, attr) + Widget wid; + Mask *vmask; + XSetWindowAttributes *attr; +{ + WidgetClass super = wmShellWidgetClass; + + /* Make my superclass do all the dirty work */ + + (*super->core_class.realize) (wid, vmask, attr); + _XawImRealize(wid); +} + + +static void XawVendorShellExtClassInitialize() +{ +} + +/* ARGSUSED */ +static void XawVendorShellExtInitialize(req, new) + Widget req, new; +{ + _XawImInitialize(new->core.parent, new); +} + +/* ARGSUSED */ +static void XawVendorShellExtDestroy( w ) + Widget w; +{ + _XawImDestroy( w->core.parent, w ); +} + +/* ARGSUSED */ +static Boolean XawVendorShellExtSetValues(old, ref, new) + Widget old, ref, new; +{ + return FALSE; +} + +void XawVendorShellExtResize( w ) + Widget w; +{ + ShellWidget sw = (ShellWidget) w; + Widget childwid; + int i; + int core_height; + + _XawImResizeVendorShell( w ); + core_height = _XawImGetShellHeight( w ); + for( i = 0; i < sw->composite.num_children; i++ ) { + if( XtIsManaged( sw->composite.children[ i ] ) ) { + childwid = sw->composite.children[ i ]; + XtResizeWidget( childwid, sw->core.width, core_height, + childwid->core.border_width ); + } + } +} + +/*ARGSUSED*/ +static XtGeometryResult GeometryManager( wid, request, reply ) + Widget wid; + XtWidgetGeometry *request; + XtWidgetGeometry *reply; +{ + ShellWidget shell = (ShellWidget)(wid->core.parent); + XtWidgetGeometry my_request; + + if(shell->shell.allow_shell_resize == FALSE && XtIsRealized(wid)) + return(XtGeometryNo); + + if (request->request_mode & (CWX | CWY)) + return(XtGeometryNo); + + /* %%% worry about XtCWQueryOnly */ + my_request.request_mode = 0; + if (request->request_mode & CWWidth) { + my_request.width = request->width; + my_request.request_mode |= CWWidth; + } + if (request->request_mode & CWHeight) { + my_request.height = request->height + + _XawImGetImAreaHeight( wid ); + my_request.request_mode |= CWHeight; + } + if (request->request_mode & CWBorderWidth) { + my_request.border_width = request->border_width; + my_request.request_mode |= CWBorderWidth; + } + if (XtMakeGeometryRequest((Widget)shell, &my_request, NULL) + == XtGeometryYes) { + /* assert: if (request->request_mode & CWWidth) then + * shell->core.width == request->width + * assert: if (request->request_mode & CWHeight) then + * shell->core.height == request->height + * + * so, whatever the WM sized us to (if the Shell requested + * only one of the two) is now the correct child size + */ + + wid->core.width = shell->core.width; + wid->core.height = shell->core.height; + if (request->request_mode & CWBorderWidth) { + wid->core.x = wid->core.y = -request->border_width; + } + _XawImCallVendorShellExtResize(wid); + return XtGeometryYes; + } else return XtGeometryNo; +} + +static void ChangeManaged(wid) + Widget wid; +{ + ShellWidget w = (ShellWidget) wid; + Widget* childP; + int i; + + (*SuperClass->composite_class.change_managed)(wid); + for (i = w->composite.num_children, childP = w->composite.children; + i; i--, childP++) { + if (XtIsManaged(*childP)) { + XtSetKeyboardFocus(wid, *childP); + break; + } + } +} diff --git a/vendor/x11iraf/xaw3d/VendorEP.h b/vendor/x11iraf/xaw3d/VendorEP.h new file mode 100644 index 00000000..9da02d90 --- /dev/null +++ b/vendor/x11iraf/xaw3d/VendorEP.h @@ -0,0 +1,81 @@ +/* $XConsortium: VendorEP.h,v 1.2 94/04/17 20:13:25 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of OMRON not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. OMRON makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: Seiji Kuwari OMRON Corporation + * kuwa@omron.co.jp + * kuwa%omron.co.jp@uunet.uu.net + */ + +/* + +Copyright (c) 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#ifndef _VendorEP_h +#define _VendorEP_h + +#include <X11/Xaw3d/XawImP.h> + +typedef struct { + XtPointer extension; +} XawVendorShellExtClassPart; + +typedef struct _VendorShellExtClassRec { + ObjectClassPart object_class; + XawVendorShellExtClassPart vendor_shell_ext_class; +} XawVendorShellExtClassRec; + +typedef struct { + Widget parent; + XawImPart im; + XawIcPart ic; +} XawVendorShellExtPart; + +typedef struct XawVendorShellExtRec { + ObjectPart object; + XawVendorShellExtPart vendor_ext; +} XawVendorShellExtRec, *XawVendorShellExtWidget; + +#endif /* _VendorEP_h */ diff --git a/vendor/x11iraf/xaw3d/Viewport.c b/vendor/x11iraf/xaw3d/Viewport.c new file mode 100644 index 00000000..79f8eca7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/Viewport.c @@ -0,0 +1,1084 @@ +/* $XConsortium: Viewport.c,v 1.71 94/04/17 20:13:26 kaleb Exp $ */ + +/*********************************************************** + +Copyright (c) 1987, 1988, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include <X11/Xaw3d/XawInit.h> +#include <X11/Xmu/Misc.h> +#include <X11/Xaw3d/Scrollbar.h> +#include <X11/Xaw3d/ViewportP.h> + +static void ScrollUpDownProc(), ThumbProc(); +static Boolean GetGeometry(); + +static void ComputeWithForceBars(); + +#define offset(field) XtOffsetOf(ViewportRec, viewport.field) +static XtResource resources[] = { + {XtNforceBars, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(forcebars), XtRImmediate, (XtPointer)False}, + {XtNallowHoriz, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(allowhoriz), XtRImmediate, (XtPointer)False}, + {XtNallowVert, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(allowvert), XtRImmediate, (XtPointer)False}, + {XtNuseBottom, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(usebottom), XtRImmediate, (XtPointer)False}, + {XtNuseRight, XtCBoolean, XtRBoolean, sizeof(Boolean), + offset(useright), XtRImmediate, (XtPointer)False}, + {XtNreportCallback, XtCReportCallback, XtRCallback, sizeof(XtPointer), + offset(report_callbacks), XtRImmediate, (XtPointer) NULL}, +}; +#undef offset + +static void Initialize(), ConstraintInitialize(), + Realize(), Resize(), ChangeManaged(); +static Boolean SetValues(), Layout(); +static XtGeometryResult GeometryManager(), PreferredGeometry(); + +#define superclass (&formClassRec) +ViewportClassRec viewportClassRec = { + { /* core_class fields */ + /* superclass */ (WidgetClass) superclass, + /* class_name */ "Viewport", + /* widget_size */ sizeof(ViewportRec), + /* class_initialize */ XawInitializeWidgetSet, + /* class_part_init */ NULL, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ NULL, + /* num_actions */ 0, + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave*/ TRUE, + /* visible_interest */ FALSE, + /* destroy */ NULL, + /* resize */ Resize, + /* expose */ XtInheritExpose, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ NULL, + /* query_geometry */ PreferredGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* composite_class fields */ + /* geometry_manager */ GeometryManager, + /* change_managed */ ChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL + }, + { /* constraint_class fields */ + /* subresourses */ NULL, + /* subresource_count */ 0, + /* constraint_size */ sizeof(ViewportConstraintsRec), + /* initialize */ ConstraintInitialize, + /* destroy */ NULL, + /* set_values */ NULL, + /* extension */ NULL + }, + { /* form_class fields */ + /* layout */ Layout + }, + { /* viewport_class fields */ + /* empty */ 0 + } +}; + + +WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec; + +static Widget CreateScrollbar(w, horizontal) + ViewportWidget w; + Boolean horizontal; +{ + Widget clip = w->viewport.clip; + ViewportConstraints constraints = + (ViewportConstraints)clip->core.constraints; + static Arg barArgs[] = { + {XtNorientation, (XtArgVal) 0}, + {XtNlength, (XtArgVal) 0}, + {XtNleft, (XtArgVal) 0}, + {XtNright, (XtArgVal) 0}, + {XtNtop, (XtArgVal) 0}, + {XtNbottom, (XtArgVal) 0}, + {XtNmappedWhenManaged, (XtArgVal) False}, + }; + Widget bar; + + XtSetArg(barArgs[0], XtNorientation, + horizontal ? XtorientHorizontal : XtorientVertical ); + XtSetArg(barArgs[1], XtNlength, + horizontal ? clip->core.width : clip->core.height); + XtSetArg(barArgs[2], XtNleft, + (!horizontal && w->viewport.useright) ? XtChainRight : XtChainLeft); + XtSetArg(barArgs[3], XtNright, + (!horizontal && !w->viewport.useright) ? XtChainLeft : XtChainRight); + XtSetArg(barArgs[4], XtNtop, + (horizontal && w->viewport.usebottom) ? XtChainBottom: XtChainTop); + XtSetArg(barArgs[5], XtNbottom, + (horizontal && !w->viewport.usebottom) ? XtChainTop: XtChainBottom); + + bar = XtCreateWidget((horizontal ? "horizontal" : "vertical"), + scrollbarWidgetClass, (Widget)w, + barArgs, XtNumber(barArgs) ); + XtAddCallback( bar, XtNscrollProc, ScrollUpDownProc, (XtPointer)w ); + XtAddCallback( bar, XtNjumpProc, ThumbProc, (XtPointer)w ); + + if (horizontal) { + w->viewport.horiz_bar = bar; + constraints->form.vert_base = bar; + } + else { + w->viewport.vert_bar = bar; + constraints->form.horiz_base = bar; + } + + XtManageChild( bar ); + + return bar; +} + +/* ARGSUSED */ +static void Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + ViewportWidget w = (ViewportWidget)new; + static Arg clip_args[8]; + Cardinal arg_cnt; + Widget h_bar, v_bar; + Dimension clip_height, clip_width; + + w->form.default_spacing = 0; /* Reset the default spacing to 0 pixels. */ + + +/* + * Initialize all widget pointers to NULL. + */ + + w->viewport.child = (Widget) NULL; + w->viewport.horiz_bar = w->viewport.vert_bar = (Widget)NULL; + +/* + * Create Clip Widget. + */ + + arg_cnt = 0; + XtSetArg(clip_args[arg_cnt], XtNbackgroundPixmap, None); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNborderWidth, 0); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNleft, XtChainLeft); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNright, XtChainRight); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNwidth, w->core.width); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNheight, w->core.height); arg_cnt++; + + w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, new, + clip_args, arg_cnt); + + if (!w->viewport.forcebars) + return; /* If we are not forcing the bars then we are done. */ + + if (w->viewport.allowhoriz) + (void) CreateScrollbar(w, True); + if (w->viewport.allowvert) + (void) CreateScrollbar(w, False); + + h_bar = w->viewport.horiz_bar; + v_bar = w->viewport.vert_bar; + +/* + * Set the clip widget to the correct height. + */ + + clip_width = w->core.width; + clip_height = w->core.height; + + if ( (h_bar != NULL) && + ((int)w->core.width > + (int)(h_bar->core.width + h_bar->core.border_width)) ) + clip_width -= h_bar->core.width + h_bar->core.border_width; + + if ( (v_bar != NULL) && + ((int)w->core.height > + (int)(v_bar->core.height + v_bar->core.border_width)) ) + clip_height -= v_bar->core.height + v_bar->core.border_width; + + arg_cnt = 0; + XtSetArg(clip_args[arg_cnt], XtNwidth, clip_width); arg_cnt++; + XtSetArg(clip_args[arg_cnt], XtNheight, clip_height); arg_cnt++; + XtSetValues(w->viewport.clip, clip_args, arg_cnt); +} + +/* ARGSUSED */ +static void ConstraintInitialize(request, new, args, num_args) + Widget request, new; + ArgList args; + Cardinal *num_args; +{ + ((ViewportConstraints)new->core.constraints)->viewport.reparented = False; +} + +static void Realize(widget, value_mask, attributes) + Widget widget; + XtValueMask *value_mask; + XSetWindowAttributes *attributes; +{ + ViewportWidget w = (ViewportWidget)widget; + Widget child = w->viewport.child; + Widget clip = w->viewport.clip; + + *value_mask |= CWBitGravity; + attributes->bit_gravity = NorthWestGravity; + (*superclass->core_class.realize)(widget, value_mask, attributes); + + (*w->core.widget_class->core_class.resize)(widget); /* turn on bars */ + + if (child != (Widget)NULL) { + XtMoveWidget( child, (Position)0, (Position)0 ); + XtRealizeWidget( clip ); + XtRealizeWidget( child ); + XReparentWindow( XtDisplay(w), XtWindow(child), XtWindow(clip), + (Position)0, (Position)0 ); + XtMapWidget( child ); + } +} + +/* ARGSUSED */ +static Boolean SetValues(current, request, new, args, num_args) + Widget current, request, new; + ArgList args; + Cardinal *num_args; +{ + ViewportWidget w = (ViewportWidget)new; + ViewportWidget cw = (ViewportWidget)current; + + if ( (w->viewport.forcebars != cw->viewport.forcebars) || + (w->viewport.allowvert != cw->viewport.allowvert) || + (w->viewport.allowhoriz != cw->viewport.allowhoriz) || + (w->viewport.useright != cw->viewport.useright) || + (w->viewport.usebottom != cw->viewport.usebottom) ) + { + (*w->core.widget_class->core_class.resize)(new); /* Recompute layout.*/ + } + + return False; +} + + +static void ChangeManaged(widget) + Widget widget; +{ + ViewportWidget w = (ViewportWidget)widget; + int num_children = w->composite.num_children; + Widget child, *childP; + int i; + + child = (Widget)NULL; + for (childP=w->composite.children, i=0; i < num_children; childP++, i++) { + if (XtIsManaged(*childP) + && *childP != w->viewport.clip + && *childP != w->viewport.horiz_bar + && *childP != w->viewport.vert_bar) + { + child = *childP; + break; + } + } + + if (child != w->viewport.child) { + w->viewport.child = child; + if (child != (Widget)NULL) { + XtResizeWidget( child, child->core.width, + child->core.height, (Dimension)0 ); + if (XtIsRealized(widget)) { + ViewportConstraints constraints = + (ViewportConstraints)child->core.constraints; + if (!XtIsRealized(child)) { + Window window = XtWindow(w); + XtMoveWidget( child, (Position)0, (Position)0 ); +#ifdef notdef + /* this is dirty, but it saves the following code: */ + XtRealizeWidget( child ); + XReparentWindow( XtDisplay(w), XtWindow(child), + XtWindow(w->viewport.clip), + (Position)0, (Position)0 ); + if (child->core.mapped_when_managed) + XtMapWidget( child ); +#else + w->core.window = XtWindow(w->viewport.clip); + XtRealizeWidget( child ); + w->core.window = window; +#endif /* notdef */ + constraints->viewport.reparented = True; + } + else if (!constraints->viewport.reparented) { + XReparentWindow( XtDisplay(w), XtWindow(child), + XtWindow(w->viewport.clip), + (Position)0, (Position)0 ); + constraints->viewport.reparented = True; + if (child->core.mapped_when_managed) + XtMapWidget( child ); + } + } + GetGeometry( widget, child->core.width, child->core.height ); + (*((ViewportWidgetClass)w->core.widget_class)->form_class.layout) + ( (FormWidget)w, w->core.width, w->core.height ); + /* %%% do we need to hide this child from Form? */ + } + } + +#ifdef notdef + (*superclass->composite_class.change_managed)( widget ); +#endif +} + + +static void SetBar(w, top, length, total) + Widget w; + Position top; + Dimension length, total; +{ + XawScrollbarSetThumb(w, (float)top/(float)total, + (float)length/(float)total); +} + +static void RedrawThumbs(w) + ViewportWidget w; +{ + Widget child = w->viewport.child; + Widget clip = w->viewport.clip; + + if (w->viewport.horiz_bar != (Widget)NULL) + SetBar( w->viewport.horiz_bar, -(child->core.x), + clip->core.width, child->core.width ); + + if (w->viewport.vert_bar != (Widget)NULL) + SetBar( w->viewport.vert_bar, -(child->core.y), + clip->core.height, child->core.height ); +} + + + +static void SendReport (w, changed) + ViewportWidget w; + unsigned int changed; +{ + XawPannerReport rep; + + if (w->viewport.report_callbacks) { + Widget child = w->viewport.child; + Widget clip = w->viewport.clip; + + rep.changed = changed; + rep.slider_x = -child->core.x; /* child is canvas */ + rep.slider_y = -child->core.y; /* clip is slider */ + rep.slider_width = clip->core.width; + rep.slider_height = clip->core.height; + rep.canvas_width = child->core.width; + rep.canvas_height = child->core.height; + XtCallCallbackList ((Widget) w, w->viewport.report_callbacks, + (XtPointer) &rep); + } +} + + +static void MoveChild(w, x, y) + ViewportWidget w; + Position x, y; +{ + Widget child = w->viewport.child; + Widget clip = w->viewport.clip; + + /* make sure we never move past right/bottom borders */ + if (-x + (int)clip->core.width > (int)child->core.width) + x = -(child->core.width - clip->core.width); + + if (-y + (int)clip->core.height > (int)child->core.height) + y = -(child->core.height - clip->core.height); + + /* make sure we never move past left/top borders */ + if (x >= 0) x = 0; + if (y >= 0) y = 0; + + XtMoveWidget(child, x, y); + SendReport (w, (XawPRSliderX | XawPRSliderY)); + + RedrawThumbs(w); +} + + +static void ComputeLayout(widget, query, destroy_scrollbars) + Widget widget; /* Viewport */ + Boolean query; /* query child's preferred geom? */ + Boolean destroy_scrollbars; /* destroy un-needed scrollbars? */ +{ + ViewportWidget w = (ViewportWidget)widget; + Widget child = w->viewport.child; + Widget clip = w->viewport.clip; + ViewportConstraints constraints + = (ViewportConstraints)clip->core.constraints; + Boolean needshoriz, needsvert; + int clip_width, clip_height; + XtWidgetGeometry intended; + + if (child == (Widget) NULL) return; + + clip_width = w->core.width; + clip_height = w->core.height; + intended.request_mode = CWBorderWidth; + intended.border_width = 0; + + if (w->viewport.forcebars) { + needsvert = w->viewport.allowvert; + needshoriz = w->viewport.allowhoriz; + ComputeWithForceBars(widget, query, &intended, + &clip_width, &clip_height); + } + else { + Dimension prev_width, prev_height; + XtGeometryMask prev_mode; + XtWidgetGeometry preferred; + + needshoriz = needsvert = False; + + /* + * intended.{width,height} caches the eventual child dimensions, + * but we don't set the mode bits until after we decide that the + * child's preferences are not acceptable. + */ + + if (!w->viewport.allowhoriz) + intended.request_mode |= CWWidth; + + if ((int)child->core.width < clip_width) + intended.width = clip_width; + else + intended.width = child->core.width; + + if ((int)child->core.height < clip_height) + intended.height = clip_height; + else + intended.height = child->core.height; + + if (!w->viewport.allowvert) + intended.request_mode |= CWHeight; + + if (!query) { + preferred.width = child->core.width; + preferred.height = child->core.height; + } + do { /* while intended != prev */ + + if (query) { + (void) XtQueryGeometry( child, &intended, &preferred ); + if ( !(preferred.request_mode & CWWidth) ) + preferred.width = intended.width; + if ( !(preferred.request_mode & CWHeight) ) + preferred.height = intended.height; + } + prev_width = intended.width; + prev_height = intended.height; + prev_mode = intended.request_mode; + /* + * note that having once decided to turn on either bar + * we'll not change our mind until we're next resized, + * thus avoiding potential oscillations. + */ +#define CheckHoriz() \ + if ( w->viewport.allowhoriz && \ + (int)preferred.width > clip_width) { \ + if (!needshoriz) { \ + Widget bar; \ + needshoriz = True; \ + if ((bar = w->viewport.horiz_bar) == (Widget)NULL) \ + bar = CreateScrollbar(w, True); \ + clip_height -= bar->core.height + \ + bar->core.border_width; \ + if (clip_height < 1) clip_height = 1; \ + } \ + intended.width = preferred.width; \ + } +/*enddef*/ + CheckHoriz(); + if (w->viewport.allowvert && (int)preferred.height > clip_height) { + if (!needsvert) { + Widget bar; + needsvert = True; + if ((bar = w->viewport.vert_bar) == (Widget)NULL) + bar = CreateScrollbar(w, False); + clip_width -= bar->core.width + bar->core.border_width; + if (clip_width < 1) clip_width = 1; + CheckHoriz(); + } + intended.height = preferred.height; + } + if ( !w->viewport.allowhoriz || + (int)preferred.width < clip_width) { + intended.width = clip_width; + intended.request_mode |= CWWidth; + } + if ( !w->viewport.allowvert || + (int)preferred.height < clip_height) { + intended.height = clip_height; + intended.request_mode |= CWHeight; + } + } while (intended.request_mode != prev_mode + || (intended.request_mode & CWWidth + && intended.width != prev_width) + || (intended.request_mode & CWHeight + && intended.height != prev_height)); + } + + if (XtIsRealized(clip)) + XRaiseWindow( XtDisplay(clip), XtWindow(clip) ); + + XtMoveWidget( clip, + (Position) (needsvert ? (w->viewport.useright ? 0 : + w->viewport.vert_bar->core.width + + w->viewport.vert_bar->core.border_width) : 0), + (Position) (needshoriz ? (w->viewport.usebottom ? 0 : + w->viewport.horiz_bar->core.height + + w->viewport.horiz_bar->core.border_width) : 0)); + XtResizeWidget( clip, (Dimension)clip_width, + (Dimension)clip_height, (Dimension)0 ); + + if (w->viewport.horiz_bar != (Widget)NULL) { + Widget bar = w->viewport.horiz_bar; + if (!needshoriz) { + constraints->form.vert_base = (Widget)NULL; + if (destroy_scrollbars) { + XtDestroyWidget( bar ); + w->viewport.horiz_bar = (Widget)NULL; + } + } + else { + int bw = bar->core.border_width; + XtResizeWidget( bar, (Dimension) clip_width, bar->core.height, (Dimension) bw ); + XtMoveWidget( bar, + (Position)((needsvert && !w->viewport.useright) + ? w->viewport.vert_bar->core.width + : -bw), + (Position)(w->viewport.usebottom + ? w->core.height - bar->core.height - bw + : -bw) ); + XtSetMappedWhenManaged( bar, True ); + } + } + + if (w->viewport.vert_bar != (Widget)NULL) { + Widget bar = w->viewport.vert_bar; + if (!needsvert) { + constraints->form.horiz_base = (Widget)NULL; + if (destroy_scrollbars) { + XtDestroyWidget( bar ); + w->viewport.vert_bar = (Widget)NULL; + } + } + else { + int bw = bar->core.border_width; + XtResizeWidget( bar, bar->core.width, (Dimension)clip_height, (Dimension)bw ); + XtMoveWidget( bar, + (Position)(w->viewport.useright + ? w->core.width - bar->core.width - bw + : -bw), + (Position)((needshoriz && !w->viewport.usebottom) + ? w->viewport.horiz_bar->core.height + : -bw) ); + XtSetMappedWhenManaged( bar, True ); + } + } + + if (child != (Widget)NULL) { + XtResizeWidget( child, (Dimension)intended.width, + (Dimension)intended.height, (Dimension)0 ); + MoveChild(w, + needshoriz ? child->core.x : 0, + needsvert ? child->core.y : 0); + } + + SendReport (w, XawPRAll); +} + +/* Function Name: ComputeWithForceBars + * Description: Computes the layout give forcebars is set. + * Arguments: widget - the viewport widget. + * query - whether or not to query the child. + * intended - the cache of the childs height is + * stored here ( USED AND RETURNED ). + * clip_width, clip_height - size of clip window. + * (USED AND RETURNED ). + * Returns: none. + */ + +static void +ComputeWithForceBars(widget, query, intended, clip_width, clip_height) +Widget widget; +Boolean query; +XtWidgetGeometry * intended; +int *clip_width, *clip_height; +{ + ViewportWidget w = (ViewportWidget)widget; + Widget child = w->viewport.child; + XtWidgetGeometry preferred; + +/* + * If forcebars then needs = allows = has. + * Thus if needsvert is set it MUST have a scrollbar. + */ + + if (w->viewport.allowvert) { + if (w->viewport.vert_bar == NULL) + w->viewport.vert_bar = CreateScrollbar(w, False); + + *clip_width -= w->viewport.vert_bar->core.width + + w->viewport.vert_bar->core.border_width; + } + + if (w->viewport.allowhoriz) { + if (w->viewport.horiz_bar == NULL) + w->viewport.horiz_bar = CreateScrollbar(w, True); + + *clip_height -= w->viewport.horiz_bar->core.height + + w->viewport.horiz_bar->core.border_width; + } + + AssignMax( *clip_width, 1 ); + AssignMax( *clip_height, 1 ); + + if (!w->viewport.allowvert) { + intended->height = *clip_height; + intended->request_mode = CWHeight; + } + if (!w->viewport.allowhoriz) { + intended->width = *clip_width; + intended->request_mode = CWWidth; + } + + if ( query ) { + if ( (w->viewport.allowvert || w->viewport.allowhoriz) ) { + XtQueryGeometry( child, intended, &preferred ); + + if ( !(intended->request_mode & CWWidth) ) + if ( preferred.request_mode & CWWidth ) + intended->width = preferred.width; + else + intended->width = child->core.width; + + if ( !(intended->request_mode & CWHeight) ) + if ( preferred.request_mode & CWHeight ) + intended->height = preferred.height; + else + intended->height = child->core.height; + } + } + else { + if (w->viewport.allowvert) + intended->height = child->core.height; + if (w->viewport.allowhoriz) + intended->width = child->core.width; + } + + if (*clip_width > (int)intended->width) + intended->width = *clip_width; + if (*clip_height > (int)intended->height) + intended->height = *clip_height; +} + +static void Resize(widget) + Widget widget; +{ + ComputeLayout( widget, /*query=*/True, /*destroy=*/True ); +} + + +/* ARGSUSED */ +static Boolean Layout(w, width, height) + FormWidget w; + Dimension width, height; +{ + ComputeLayout( (Widget)w, /*query=*/True, /*destroy=*/True ); + w->form.preferred_width = w->core.width; + w->form.preferred_height = w->core.height; + return False; +} + + +static void ScrollUpDownProc(widget, closure, call_data) + Widget widget; + XtPointer closure; + XtPointer call_data; +{ + ViewportWidget w = (ViewportWidget)closure; + Widget child = w->viewport.child; + int pix = (int)call_data; + Position x, y; + + if (child == NULL) return; /* no child to scroll. */ + + x = child->core.x - ((widget == w->viewport.horiz_bar) ? pix : 0); + y = child->core.y - ((widget == w->viewport.vert_bar) ? pix : 0); + MoveChild(w, x, y); +} + + +/* ARGSUSED */ +static void ThumbProc(widget, closure, call_data) + Widget widget; + XtPointer closure; + XtPointer call_data; +{ + ViewportWidget w = (ViewportWidget)closure; + Widget child = w->viewport.child; + float *percent = (float *) call_data; + Position x, y; + + if (child == NULL) return; /* no child to scroll. */ + + if (widget == w->viewport.horiz_bar) +#ifdef macII /* bug in the macII A/UX 1.0 cc */ + x = (int)(-*percent * child->core.width); +#else /* else not macII */ + x = -(int)(*percent * child->core.width); +#endif /* macII */ + else + x = child->core.x; + + if (widget == w->viewport.vert_bar) +#ifdef macII /* bug in the macII A/UX 1.0 cc */ + y = (int)(-*percent * child->core.height); +#else /* else not macII */ + y = -(int)(*percent * child->core.height); +#endif /* macII */ + else + y = child->core.y; + + MoveChild(w, x, y); +} + +static XtGeometryResult +TestSmaller(w, request, reply_return) + ViewportWidget w; XtWidgetGeometry *request, *reply_return; +{ + if (request->width < w->core.width || request->height < w->core.height) + return XtMakeGeometryRequest((Widget)w, request, reply_return); + else + return XtGeometryYes; +} + +static XtGeometryResult +GeometryRequestPlusScrollbar(w, horizontal, request, reply_return) + Boolean horizontal; + ViewportWidget w; + XtWidgetGeometry *request, *reply_return; +{ + Widget sb; + XtWidgetGeometry plusScrollbars; + plusScrollbars = *request; + if ((sb = w->viewport.horiz_bar) == (Widget)NULL) + sb = CreateScrollbar( w, horizontal); + request->width += sb->core.width; + request->height += sb->core.height; + XtDestroyWidget(sb); + return XtMakeGeometryRequest((Widget) w, &plusScrollbars, reply_return); + } + +#define WidthChange() (request->width != w->core.width) +#define HeightChange() (request->height != w->core.height) + +static XtGeometryResult +QueryGeometry(w, request, reply_return) + ViewportWidget w; XtWidgetGeometry *request, *reply_return; +{ + if (w->viewport.allowhoriz && w->viewport.allowvert) + return TestSmaller(w, request, reply_return); + + else if (w->viewport.allowhoriz && !w->viewport.allowvert) { + if (WidthChange() && !HeightChange()) + return TestSmaller(w, request, reply_return); + else if (!WidthChange() && HeightChange()) + return XtMakeGeometryRequest((Widget) w, request, reply_return); + else if (WidthChange() && HeightChange()) /* hard part */ + return GeometryRequestPlusScrollbar(w, True, request, reply_return); + else /* !WidthChange() && !HeightChange() */ + return XtGeometryYes; + } + else if (!w->viewport.allowhoriz && w->viewport.allowvert) { + if (!WidthChange() && HeightChange()) + return TestSmaller(w, request, reply_return); + else if (WidthChange() && !HeightChange()) + return XtMakeGeometryRequest((Widget)w, request, reply_return); + else if (WidthChange() && HeightChange()) /* hard part */ + return GeometryRequestPlusScrollbar(w, False, request, reply_return); + else /* !WidthChange() && !HeightChange() */ + return XtGeometryYes; + } + else /* (!w->viewport.allowhoriz && !w->viewport.allowvert) */ + return XtMakeGeometryRequest((Widget) w, request, reply_return); +} + +#undef WidthChange +#undef HeightChange + +static XtGeometryResult GeometryManager(child, request, reply) + Widget child; + XtWidgetGeometry *request, *reply; +{ + ViewportWidget w = (ViewportWidget)child->core.parent; + Boolean rWidth = (Boolean)(request->request_mode & CWWidth); + Boolean rHeight = (Boolean)(request->request_mode & CWHeight); + XtWidgetGeometry allowed; + XtGeometryResult result; + Boolean reconfigured; + Boolean child_changed_size; + Dimension height_remaining; + + if (request->request_mode & XtCWQueryOnly) + return QueryGeometry(w, request, reply); + + if (child != w->viewport.child + || request->request_mode & ~(CWWidth | CWHeight + | CWBorderWidth) + || ((request->request_mode & CWBorderWidth) + && request->border_width > 0)) + return XtGeometryNo; + + allowed = *request; + + reconfigured = GetGeometry( (Widget)w, + (rWidth ? request->width : w->core.width), + (rHeight ? request->height : w->core.height) + ); + + child_changed_size = ((rWidth && child->core.width != request->width) || + (rHeight && child->core.height != request->height)); + + height_remaining = w->core.height; + if (rWidth && w->core.width != request->width) { + if (w->viewport.allowhoriz && request->width > w->core.width) { + /* horizontal scrollbar will be needed so possibly reduce height */ + Widget bar; + if ((bar = w->viewport.horiz_bar) == (Widget)NULL) + bar = CreateScrollbar( w, True ); + height_remaining -= bar->core.height + bar->core.border_width; + reconfigured = True; + } + else { + allowed.width = w->core.width; + } + } + if (rHeight && height_remaining != request->height) { + if (w->viewport.allowvert && request->height > height_remaining) { + /* vertical scrollbar will be needed, so possibly reduce width */ + if (!w->viewport.allowhoriz || request->width < w->core.width) { + Widget bar; + if ((bar = w->viewport.vert_bar) == (Widget)NULL) + bar = CreateScrollbar( w, False ); + if (!rWidth) { + allowed.width = w->core.width; + allowed.request_mode |= CWWidth; + } + if ( (int)allowed.width > + (int)(bar->core.width + bar->core.border_width) ) + allowed.width -= bar->core.width + bar->core.border_width; + else + allowed.width = 1; + reconfigured = True; + } + } + else { + allowed.height = height_remaining; + } + } + + if (allowed.width != request->width || allowed.height != request->height) { + *reply = allowed; + result = XtGeometryAlmost; + } + else { + if (rWidth) child->core.width = request->width; + if (rHeight) child->core.height = request->height; + result = XtGeometryYes; + } + + if (reconfigured || child_changed_size) + ComputeLayout( (Widget)w, + /*query=*/ False, + /*destroy=*/ (result == XtGeometryYes) ? True : False ); + + return result; + } + + +static Boolean GetGeometry(w, width, height) + Widget w; + Dimension width, height; +{ + XtWidgetGeometry geometry, return_geom; + XtGeometryResult result; + + if (width == w->core.width && height == w->core.height) + return False; + + geometry.request_mode = CWWidth | CWHeight; + geometry.width = width; + geometry.height = height; + + if (XtIsRealized(w)) { + if (((ViewportWidget)w)->viewport.allowhoriz && width > w->core.width) + geometry.width = w->core.width; + if (((ViewportWidget)w)->viewport.allowvert && height > w->core.height) + geometry.height = w->core.height; + } else { + /* This is the Realize call; we'll inherit a w&h iff none currently */ + if (w->core.width != 0) { + if (w->core.height != 0) return False; + geometry.width = w->core.width; + } + if (w->core.height != 0) geometry.height = w->core.height; + } + + result = XtMakeGeometryRequest(w, &geometry, &return_geom); + if (result == XtGeometryAlmost) + result = XtMakeGeometryRequest(w, &return_geom, (XtWidgetGeometry *)NULL); + + return (result == XtGeometryYes); +} + +static XtGeometryResult PreferredGeometry(w, constraints, reply) + Widget w; + XtWidgetGeometry *constraints, *reply; +{ + if (((ViewportWidget)w)->viewport.child != NULL) + return XtQueryGeometry( ((ViewportWidget)w)->viewport.child, + constraints, reply ); + else + return XtGeometryYes; +} + + +void +#if NeedFunctionPrototypes +XawViewportSetLocation (Widget gw, +#if NeedWidePrototypes + double xoff, double yoff) +#else + float xoff, float yoff) +#endif +#else +XawViewportSetLocation (gw, xoff, yoff) + Widget gw; + float xoff,yoff; +#endif +{ + ViewportWidget w = (ViewportWidget) gw; + Widget child = w->viewport.child; + Position x, y; + + if (xoff > 1.0) /* scroll to right */ + x = child->core.width; + else if (xoff < 0.0) /* if the offset is < 0.0 nothing */ + x = child->core.x; + else + x = (Position) (((float) child->core.width) * xoff); + + if (yoff > 1.0) + y = child->core.height; + else if (yoff < 0.0) + y = child->core.y; + else + y = (Position) (((float) child->core.height) * yoff); + + MoveChild (w, -x, -y); +} + +void +#if NeedFunctionPrototypes +XawViewportSetCoordinates (Widget gw, +#if NeedWidePrototypes + int x, int y) +#else + Position x, Position y) +#endif +#else +XawViewportSetCoordinates (gw, x, y) + Widget gw; + Position x, y; +#endif +{ + ViewportWidget w = (ViewportWidget) gw; + Widget child = w->viewport.child; + + if (x > (int)child->core.width) + x = child->core.width; + else if (x < 0) + x = child->core.x; + + if (y > (int)child->core.height) + y = child->core.height; + else if (y < 0) + y = child->core.y; + + MoveChild (w, -x, -y); +} + diff --git a/vendor/x11iraf/xaw3d/Viewport.h b/vendor/x11iraf/xaw3d/Viewport.h new file mode 100644 index 00000000..499905ed --- /dev/null +++ b/vendor/x11iraf/xaw3d/Viewport.h @@ -0,0 +1,124 @@ +/* $XConsortium: Viewport.h,v 1.23 94/04/17 20:13:27 kaleb Exp $ */ + +/************************************************************ + +Copyright (c) 1987, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifndef _XawViewport_h +#define _XawViewport_h + +#include <X11/Xaw3d/Form.h> +#include <X11/Xaw3d/Reports.h> + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + allowHoriz Boolean Boolean False + allowVert Boolean Boolean False + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + destroyCallback Callback Pointer NULL + foreceBars Boolean Boolean False + height Height Dimension 0 + mappedWhenManaged MappedWhenManaged Boolean True + reportCallback ReportCallback Pointer NULL + sensitive Sensitive Boolean True + useBottom Boolean Boolean False + useRight Boolean Boolean False + width Width Dimension 0 + x Position Position 0 + y Position Position 0 + +*/ + +/* fields added to Form */ +#ifndef _XtStringDefs_h_ +#define XtNforceBars "forceBars" +#define XtNallowHoriz "allowHoriz" +#define XtNallowVert "allowVert" +#define XtNuseBottom "useBottom" +#define XtNuseRight "useRight" +#endif + +extern WidgetClass viewportWidgetClass; + +typedef struct _ViewportClassRec *ViewportWidgetClass; +typedef struct _ViewportRec *ViewportWidget; + +_XFUNCPROTOBEGIN + +extern void XawViewportSetLocation ( +#if NeedFunctionPrototypes + Widget /* gw */, +#if NeedWidePrototypes + /* float */ double /* xoff */, + /* float */ double /* yoff */ +#else + float /* xoff */, + float /* yoff */ +#endif +#endif +); + +extern void XawViewportSetCoordinates ( +#if NeedFunctionPrototypes + Widget /* gw */, +#if NeedWidePrototypes + /* Position */ int /* x */, + /* Position */ int /* y */ +#else + Position /* x */, + Position /* y */ +#endif +#endif +); + +_XFUNCPROTOEND + +#endif /* _XawViewport_h */ diff --git a/vendor/x11iraf/xaw3d/ViewportP.h b/vendor/x11iraf/xaw3d/ViewportP.h new file mode 100644 index 00000000..d24d6ea6 --- /dev/null +++ b/vendor/x11iraf/xaw3d/ViewportP.h @@ -0,0 +1,106 @@ +/* + * $XConsortium: ViewportP.h,v 1.14 94/04/17 20:13:28 jim Exp $ + * Private declarations for ViewportWidgetClass + */ + +/************************************************************ + +Copyright (c) 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifndef _ViewportP_h +#define _ViewportP_h + +#include <X11/Xaw3d/Viewport.h> +#include <X11/Xaw3d/FormP.h> + +typedef struct {int empty;} ViewportClassPart; + +typedef struct _ViewportClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ConstraintClassPart constraint_class; + FormClassPart form_class; + ViewportClassPart viewport_class; +} ViewportClassRec; + +extern ViewportClassRec viewportClassRec; + +typedef struct _ViewportPart { + /* resources */ + Boolean forcebars; /* Whether we should always display */ + /* the selected scrollbars. */ + Boolean allowhoriz; /* Whether we allow horizontal scrollbars. */ + Boolean allowvert; /* Whether we allow vertical scrollbars. */ + Boolean usebottom; /* True iff horiz bars appear at bottom. */ + Boolean useright; /* True iff vert bars appear at right. */ + XtCallbackList report_callbacks; /* when size/position changes */ + /* private state */ + Widget clip, child; /* The clipping and (scrolled) child widgets */ + Widget horiz_bar, vert_bar;/* What scrollbars we currently have. */ +} ViewportPart; + +typedef struct _ViewportRec { + CorePart core; + CompositePart composite; + ConstraintPart constraint; + FormPart form; + ViewportPart viewport; +} ViewportRec; + +typedef struct { + /* resources */ + + /* private state */ + Boolean reparented; /* True if child has been re-parented */ +} ViewportConstraintsPart; + +typedef struct _ViewportConstraintsRec { + FormConstraintsPart form; + ViewportConstraintsPart viewport; +} ViewportConstraintsRec, *ViewportConstraints; + +#endif /* _ViewportP_h */ diff --git a/vendor/x11iraf/xaw3d/XawI18n.c b/vendor/x11iraf/xaw3d/XawI18n.c new file mode 100644 index 00000000..c9110579 --- /dev/null +++ b/vendor/x11iraf/xaw3d/XawI18n.c @@ -0,0 +1,88 @@ +/* $XConsortium: XawI18n.c,v 1.6 94/04/17 20:13:28 kaleb Exp $ */ + +/* Copyright 1991 NCR Corporation - Dayton, Ohio, USA */ + +/* + * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, + * and Nippon Telegraph and Telephone Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of OMRON, NTT Software, and NTT + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. OMRON, NTT Software, + * and NTT make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Li Yuhong OMRON Corporation + */ + +/* + +Copyright (c) 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#include <X11/IntrinsicP.h> +#include "XawI18n.h" + +#if NeedFunctionPrototypes +wchar_t _Xaw_atowc( + unsigned char c) +#else +wchar_t _Xaw_atowc(c) + unsigned char c; +#endif +{ + wchar_t wc; + char str[2]; + + str[0] = c; + str[1] = '\0'; + + mbtowc(&wc, str, 1); + return wc; +} + +#ifdef NCR +int _Xaw_iswspace(wchar_t w) +{ + int ret = 0; + wchar_t s = _Xaw_atowc(' '); + if (s == w) + ret = 1; + return ret; +} +#endif diff --git a/vendor/x11iraf/xaw3d/XawI18n.h b/vendor/x11iraf/xaw3d/XawI18n.h new file mode 100644 index 00000000..b0176bf7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/XawI18n.h @@ -0,0 +1,80 @@ +/* $XConsortium: XawI18n.h,v 1.12 95/01/25 00:48:44 kaleb Exp $ */ + +/************************************************************ + +Copyright (c) 1993, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +********************************************************/ + +#ifdef HAS_WCTYPE_H +#include <wctype.h> +#ifndef NO_WIDEC_H +#include <widec.h> +#define wcslen(c) wslen(c) +#define wcscpy(d,s) wscpy(d,s) +#define wcsncpy(d,s,l) wsncpy(d,s,l) +#endif +#endif + +#ifdef HAS_WCHAR_H +#include <wchar.h> +#endif + +#ifdef AIXV3 +#include <ctype.h> +#endif + +#ifdef NCR +#define iswspace(c) _Xaw_iswspace(c) +extern int _Xaw_iswspace(wchar_t); +#endif + +#ifdef sony +#ifndef SVR4 +#include <jctype.h> +#define iswspace(c) jisspace(c) +#endif +#endif + +#ifdef USE_XWCHAR_STRING +#define wcslen(c) _Xwcslen(c) +#define wcscpy(d,s) _Xwcscpy(d,s) +#define wcsncpy(d,s,l) _Xwcsncpy(d,s,l) +#ifdef USE_XMBTOWC +#define mbtowc(wc,s,l) _Xmbtowc(wc,s,l) +#endif +#endif + +extern wchar_t _Xaw_atowc ( +#if NeedFunctionPrototypes + unsigned char c +#endif +); + +#ifndef HAS_ISW_FUNCS +#include <ctype.h> +#ifndef iswspace +#define iswspace(c) (isascii(c) && isspace(toascii(c))) +#endif +#endif diff --git a/vendor/x11iraf/xaw3d/XawIm.c b/vendor/x11iraf/xaw3d/XawIm.c new file mode 100644 index 00000000..ead71661 --- /dev/null +++ b/vendor/x11iraf/xaw3d/XawIm.c @@ -0,0 +1,1716 @@ +/* $XConsortium: XawIm.c,v 1.6 95/01/20 16:17:21 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of OMRON not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. OMRON makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: Seiji Kuwari OMRON Corporation + * kuwa@omron.co.jp + * kuwa%omron.co.jp@uunet.uu.net + */ + + +/* + +Copyright (c) 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xos.h> +#include <X11/Xfuncs.h> +#include <X11/ShellP.h> +#include <X11/Xaw3d/TextP.h> +#include <X11/Xaw3d/MultiSrc.h> +#include <X11/Xaw3d/MultiSinkP.h> +#include <X11/Xaw3d/XawImP.h> +#include <X11/Xaw3d/VendorEP.h> +#include "XawI18n.h" +#include <ctype.h> + +#if NeedVarargsPrototypes +# include <stdarg.h> +# define Va_start(a,b) va_start(a,b) +#else +# include <varargs.h> +# define Va_start(a,b) va_start(a) +#endif + +#define maxAscentOfFontSet(fontset) \ + ( - (XExtentsOfFontSet((fontset)))->max_logical_extent.y) + +#define maxHeightOfFontSet(fontset) \ + ((XExtentsOfFontSet((fontset)))->max_logical_extent.height) + +#define maxDescentOfFontSet(fontset) \ + (maxHeightOfFontSet(fontset) - maxAscentOfFontSet(fontset)) + +#define Offset(field) (XtOffsetOf(XawIcTablePart, field)) + +/***************************************************** + * + * Forward reference prototypes + * + *****************************************************/ + +static XawIcTableList CurrentSharedIcTable( +#if NeedFunctionPrototypes + XawVendorShellExtPart* /* ve */ +#endif +); + +static void DestroyIC( +#if NeedFunctionPrototypes + Widget /* w */, + XawVendorShellExtPart* /* ve */ +#endif +); + +static XtResource resources[] = +{ + { + XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet), + Offset (font_set), XtRString, XtDefaultFontSet + }, + { + XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + Offset (foreground), XtRString, (XtPointer)"XtDefaultForeground" + }, + { + XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), + Offset (background), XtRString, (XtPointer)"XtDefaultBackground" + }, + { + XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap), + Offset (bg_pixmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap + }, + { + XtNinsertPosition, XtCTextPosition, XtRInt, sizeof (XawTextPosition), + Offset (cursor_position), XtRImmediate, (XtPointer) 0 + } +}; +#undef Offset + + +static void SetVaArg( arg, value ) + XPointer *arg, value; +{ + *arg = value; +} + +static VendorShellWidget SearchVendorShell( w ) + Widget w; +{ + while(w && !XtIsShell(w)) w = XtParent(w); + if (w && XtIsVendorShell(w)) return((VendorShellWidget)w); + return(NULL); +} + +static XContext extContext = (XContext)NULL; + +static XawVendorShellExtPart *SetExtPart( w, vew ) + VendorShellWidget w; + XawVendorShellExtWidget vew; +{ + contextDataRec *contextData; + + if (extContext == (XContext)NULL) extContext = XUniqueContext(); + + contextData = XtNew(contextDataRec); + contextData->parent = (Widget)w; + contextData->ve = (Widget)vew; + if (XSaveContext(XtDisplay(w), (Window)w, extContext, (char *)contextData)) { + return(NULL); + } + return(&(vew->vendor_ext)); +} + +static XawVendorShellExtPart *GetExtPart( w ) + VendorShellWidget w; +{ + contextDataRec *contextData; + XawVendorShellExtWidget vew; + + if (XFindContext(XtDisplay(w), (Window)w, extContext, + (XPointer*)&contextData)) { + return(NULL); + } + vew = (XawVendorShellExtWidget)contextData->ve; + return(&(vew->vendor_ext)); +} + +static Boolean IsSharedIC( ve ) + XawVendorShellExtPart * ve; +{ + return( ve->ic.shared_ic ); +} + +static XawIcTableList GetIcTableShared( w, ve ) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList p; + + for (p = ve->ic.ic_table; p; p = p->next) { + if (p->widget == w) { + if (IsSharedIC(ve)) { + return(ve->ic.shared_ic_table); + } else { + return(p); + } + } + } + return(NULL); +} + +static XawIcTableList GetIcTable( w, ve ) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList p; + + for (p = ve->ic.ic_table; p; p = p->next) { + if (p->widget == w) { + return(p); + } + } + return(NULL); +} + +static XIMStyle GetInputStyleOfIC( ve ) + XawVendorShellExtPart * ve; +{ + + if (!ve) return((XIMStyle)0); + return(ve->ic.input_style); +} + +static void ConfigureCB( w, closure, event ) + Widget w; + XtPointer closure; + XEvent * event; +{ + XawIcTableList p; + XawVendorShellExtPart *ve; + VendorShellWidget vw; + XVaNestedList pe_attr; + XRectangle pe_area; + XawTextMargin *margin; + + if (event->type != ConfigureNotify) return; + + if ((vw = SearchVendorShell(w)) == NULL) return; + + if ((ve = GetExtPart(vw))) { + if (IsSharedIC(ve)) return; + if ((ve->im.xim == NULL) || + ((p = GetIcTableShared(w, ve)) == NULL) || + (p->xic == NULL) || !(p->input_style & XIMPreeditPosition)) return; + pe_area.x = 0; + pe_area.y = 0; + pe_area.width = w->core.width; + pe_area.height = w->core.height; + margin = &(((TextWidget)w)->text.margin); + pe_area.x += margin->left; + pe_area.y += margin->top; + pe_area.width -= (margin->left + margin->right - 1); + pe_area.height -= (margin->top + margin->bottom - 1); + + pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); + XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL); + XtFree(pe_attr); + } +} + +static XContext errContext = (XContext)NULL; + +static Widget SetErrCnxt( w, xim ) + Widget w; + XIM xim; +{ + contextErrDataRec *contextErrData; + + if (errContext == (XContext)NULL) errContext = XUniqueContext(); + + contextErrData = XtNew(contextErrDataRec); + contextErrData->widget = w; + contextErrData->xim = xim; + if (XSaveContext(XtDisplay(w), (Window)xim, errContext, + (char *)contextErrData)) { + return(NULL); + } + return(contextErrData->widget); +} + +static void CloseIM( ve ) + XawVendorShellExtPart * ve; +{ + if (ve->im.xim) + XCloseIM(ve->im.xim); +} + +static Dimension SetVendorShellHeight( ve, height ) + XawVendorShellExtPart* ve; + Dimension height; +{ + Arg args[2]; + Cardinal i = 0; + + if (ve->im.area_height < height || height == 0) { + XtSetArg(args[i], XtNheight, + (ve->parent->core.height + height - ve->im.area_height)); + ve->im.area_height = height; + XtSetValues(ve->parent, args, 1); + } + return(ve->im.area_height); +} + +static void DestroyAllIM( ve ) + XawVendorShellExtPart * ve; +{ + XawIcTableList p; + contextErrDataRec *contextErrData; + + /* + * Destory all ICs + */ + if (IsSharedIC(ve)) { + if ((p = ve->ic.shared_ic_table) && p->xic) { + DestroyIC(p->widget, ve); + p->xic = NULL; + p->ic_focused = FALSE; + } + } else { + for (p = ve->ic.ic_table; p; p = p->next) { + if (p->xic == NULL) continue; + DestroyIC(p->widget, ve); + p->xic = NULL; + p->ic_focused = FALSE; + } + } + if (!ve->im.xim) return; + /* + * Close Input Method + */ + CloseIM(ve); + if (!XFindContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext, + (XPointer*)&contextErrData)) { + if (contextErrData) XtFree((char *)contextErrData); + } + XDeleteContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext); + ve->im.xim = NULL; + + /* + * resize vendor shell to core size + */ + (void) SetVendorShellHeight(ve, 0); + /* + XawVendorShellExtResize(vw); + */ + return; +} + +static void FreeAllDataOfVendorShell(ve, vw) + XawVendorShellExtPart * ve; + VendorShellWidget vw; +{ + XawIcTableList p, next; + contextErrDataRec *contextErrData; + + if (!XFindContext(XtDisplay(vw), (Window)vw, extContext, + (XPointer*)&contextErrData)) { + if (contextErrData) XtFree((char *)contextErrData); + } + XDeleteContext(XtDisplay(vw), (Window)vw, extContext); + if (ve->ic.shared_ic_table) + XtFree((char *)ve->ic.shared_ic_table); + if (ve->im.resources) XtFree((char *)ve->im.resources); + for (p = ve->ic.ic_table; p; p = next) { + next = p->next; + XtFree((char *)p); + } +} + +static void VendorShellDestroyed( w, cl_data, ca_data ) + Widget w; + XtPointer cl_data, ca_data; +{ + XawVendorShellExtPart *ve; + + if ( ( ve = GetExtPart( (VendorShellWidget) w ) ) == NULL ) return; + DestroyAllIM( ve ); + FreeAllDataOfVendorShell( ve, (VendorShellWidget) w ); + return; +} + +/* + * Attempt to open an input method + */ + +static void OpenIM(ve) + XawVendorShellExtPart * ve; +{ + int i; + char *p, *s, *ns, *end, *pbuf, buf[32]; + XIM xim = NULL; + XIMStyles *xim_styles; + XIMStyle input_style = 0; + Boolean found; + + if (ve->im.open_im == False) return; + ve->im.xim = NULL; + if (ve->im.input_method == NULL) { + if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p) + xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL); + } else { + /* no fragment can be longer than the whole string */ + int len = strlen (ve->im.input_method) + 5; + + if (len < sizeof buf) pbuf = buf; + else pbuf = XtMalloc (len); + + if (pbuf == NULL) return; + + for(ns=s=ve->im.input_method; ns && *s;) { + /* skip any leading blanks */ + while (*s && isspace(*s)) s++; + if (!*s) break; + if ((ns = end = strchr(s, ',')) == NULL) + end = s + strlen(s); + /* strip any trailing blanks */ + while (isspace(*end)) end--; + + strcpy (pbuf, "@im="); + strncat (pbuf, s, end - s); + pbuf[end - s + 4] = '\0'; + + if ((p = XSetLocaleModifiers(pbuf)) != NULL && *p + && (xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL)) != NULL) + break; + + s = ns + 1; + } + + if (pbuf != buf) XtFree (pbuf); + } + if (xim == NULL) { + if ((p = XSetLocaleModifiers("")) != NULL) { + xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL); + } + } + if (xim == NULL) { + XtAppWarning(XtWidgetToApplicationContext(ve->parent), + "Input Method Open Failed"); + return; + } + if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) + || !xim_styles) { + XtAppWarning(XtWidgetToApplicationContext(ve->parent), + "input method doesn't support any style"); + XCloseIM(xim); + return; + } + found = False; + for(ns = s = ve->im.preedit_type; s && !found;) { + while (*s && isspace(*s)) s++; + if (!*s) break; + if ((ns = end = strchr(s, ',')) == NULL) + end = s + strlen(s); + while (isspace(*end)) end--; + + if (!strncmp(s, "OverTheSpot", end - s)) { + input_style = (XIMPreeditPosition | XIMStatusArea); + } else if (!strncmp(s, "OffTheSpot", end - s)) { + input_style = (XIMPreeditArea | XIMStatusArea); + } else if (!strncmp(s, "Root", end - s)) { + input_style = (XIMPreeditNothing | XIMStatusNothing); + } + for (i = 0; (unsigned short)i < xim_styles->count_styles; i++) + if (input_style == xim_styles->supported_styles[i]) { + ve->ic.input_style = input_style; + SetErrCnxt(ve->parent, xim); + ve->im.xim = xim; + found = True; + break; + } + + s = ns + 1; + } + XFree(xim_styles); + + if (!found) { + XCloseIM(xim); + XtAppWarning(XtWidgetToApplicationContext(ve->parent), + "input method doesn't support my input style"); + } +} + +static Boolean ResizeVendorShell_Core(vw, ve, p) + VendorShellWidget vw; + XawVendorShellExtPart * ve; + XawIcTableList p; +{ + XVaNestedList pe_attr, st_attr; + XRectangle pe_area, st_area; + XRectangle *get_pe_area = NULL, *get_st_area = NULL; + + st_area.width = 0; + if (p->input_style & XIMStatusArea) { + st_attr = XVaCreateNestedList(0, XNArea, &get_st_area, NULL); + XGetICValues(p->xic, XNStatusAttributes, st_attr, NULL); + XFree(st_attr); + if (p->xic == NULL) { + return(FALSE); + } + st_area.x = 0; + st_area.y = vw->core.height - ve->im.area_height; + st_area.width = get_st_area->width; + st_area.height = get_st_area->height; + XFree(get_st_area); + st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL); + XSetICValues(p->xic, XNStatusAttributes, st_attr, NULL); + XFree(st_attr); + if (p->xic == NULL) { + return(FALSE); + } + } + if (p->input_style & XIMPreeditArea) { + pe_attr = XVaCreateNestedList(0, XNArea, &get_pe_area, NULL); + XGetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL); + XFree(pe_attr); + if (p->xic == NULL) { + return(FALSE); + } + pe_area.x = st_area.width; + pe_area.y = vw->core.height - ve->im.area_height; + pe_area.width = vw->core.width; + pe_area.height = get_pe_area->height; + if (p->input_style & XIMStatusArea) { + pe_area.width -= st_area.width; + } + XFree(get_pe_area); + pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); + XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL); + XFree(pe_attr); + } + return(TRUE); +} + +static void ResizeVendorShell(vw, ve) + VendorShellWidget vw; + XawVendorShellExtPart * ve; +{ + XawIcTableList p; + + if (IsSharedIC(ve)) { + p = ve->ic.shared_ic_table; + if (p->xic == NULL) return; + ResizeVendorShell_Core(vw, ve, p); + return; + } + for (p = ve->ic.ic_table; p; p = p->next) { + if (p->xic == NULL) continue; + if (ResizeVendorShell_Core(vw, ve, p) == FALSE) return; + } +} + +static XawIcTableList CreateIcTable( w, ve ) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList table; + + table = (XawIcTableList) XtMalloc(sizeof(XawIcTablePart)); + if (table == NULL) return(NULL); + table->widget = w; + table->xic = NULL; + table->flg = table->prev_flg = 0; + table->font_set = NULL; + table->foreground = table->background = 0xffffffff; + table->bg_pixmap = 0; + table->cursor_position = 0xffff; + table->line_spacing = 0; + table->ic_focused = FALSE; + table->openic_error = FALSE; + return(table); +} + +static Boolean RegisterToVendorShell( w, ve ) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList table; + + if ((table = CreateIcTable(w, ve)) == NULL) return(FALSE); + table->next = ve->ic.ic_table; + ve->ic.ic_table = table; + return(TRUE); +} + +static void UnregisterFromVendorShell(w, ve) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList *prev, p; + + for (prev = &ve->ic.ic_table; (p = *prev); prev = &p->next) { + if (p->widget == w) { + *prev = p->next; + XtFree((char *)p); + break; + } + } + return; +} + +static void SetICValuesShared(w, ve, p, check) + Widget w; + XawVendorShellExtPart * ve; + XawIcTableList p; + Boolean check; +{ + XawIcTableList pp; + + if ((pp = GetIcTable(w, ve)) == NULL) return; + if (check == TRUE && CurrentSharedIcTable(ve) != pp) return; + + if (pp->prev_flg & CICursorP && p->cursor_position != pp->cursor_position) { + p->cursor_position = pp->cursor_position; + p->flg |= CICursorP; + } + if (pp->prev_flg & CIFontSet && p->font_set != pp->font_set) { + p->font_set = pp->font_set; + p->flg |= (CIFontSet|CICursorP); + } + if (pp->prev_flg & CIFg && p->foreground != pp->foreground) { + p->foreground = pp->foreground; + p->flg |= CIFg; + } + if (pp->prev_flg & CIBg && p->background != pp->background) { + p->background = pp->background; + p->flg |= CIBg; + } + if (pp->prev_flg & CIBgPixmap && p->bg_pixmap != pp->bg_pixmap) { + p->bg_pixmap = pp->bg_pixmap; + p->flg |= CIBgPixmap; + } + if (pp->prev_flg & CILineS && p->line_spacing != pp->line_spacing) { + p->line_spacing = pp->line_spacing; + p->flg |= CILineS; + } +} + +static Boolean IsCreatedIC(w, ve) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList p; + + if (ve->im.xim == NULL) return(FALSE); + if ((p = GetIcTableShared(w, ve)) == NULL) return(FALSE); + if (p->xic == NULL) return(FALSE); + return(TRUE); +} + +static void SizeNegotiation(p, width, height) + XawIcTableList p; + Dimension width, height; +{ + XRectangle pe_area, st_area; + XVaNestedList pe_attr = NULL, st_attr = NULL; + int ic_cnt = 0, pe_cnt = 0, st_cnt = 0; + XRectangle *pe_area_needed = NULL, *st_area_needed = NULL; + XPointer ic_a[5]; + + if (p->input_style & XIMPreeditArea) { + pe_attr = XVaCreateNestedList(0, XNAreaNeeded, &pe_area_needed, NULL); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++; + } + if (p->input_style & XIMStatusArea) { + st_attr = XVaCreateNestedList(0, XNAreaNeeded, &st_area_needed, NULL); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++; + } + SetVaArg( &ic_a[ic_cnt], (XPointer) NULL); + + if (ic_cnt > 0) { + XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]); + if (pe_attr) XFree(pe_attr); + if (st_attr) XFree(st_attr); + if (p->xic == NULL) { + p->openic_error = True; + return; + } + pe_attr = st_attr = NULL; + ic_cnt = pe_cnt = st_cnt = 0; + if (p->input_style & XIMStatusArea) { + st_area.height = st_area_needed->height; + st_area.x = 0; + st_area.y = height - st_area.height; + if (p->input_style & XIMPreeditArea) { + st_area.width = st_area_needed->width; + } else { + st_area.width = width; + } + + XFree(st_area_needed); + st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++; + } + if (p->input_style & XIMPreeditArea) { + if (p->input_style & XIMStatusArea) { + pe_area.x = st_area.width; + pe_area.width = width - st_area.width; + } else { + pe_area.x = 0; + pe_area.width = width; + } + pe_area.height = pe_area_needed->height; + XFree(pe_area_needed); + pe_area.y = height - pe_area.height; + pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++; + } + SetVaArg( &ic_a[ic_cnt], (XPointer) NULL); + XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]); + if (pe_attr) XFree(pe_attr); + if (st_attr) XFree(st_attr); + if (p->xic == NULL) { + p->openic_error = True; + return; + } + } +} + +static void CreateIC( w, ve ) + Widget w; + XawVendorShellExtPart* ve; +{ + XawIcTableList p; + XPoint position; + XRectangle pe_area, st_area; + XVaNestedList pe_attr = NULL, st_attr = NULL; + XPointer ic_a[20], pe_a[20], st_a[20]; + Dimension height = 0; + int ic_cnt = 0, pe_cnt = 0, st_cnt = 0; + XawTextMargin *margin; + + if (!XtIsRealized(w)) return; + if (((ve->im.xim == NULL) || (p = GetIcTableShared(w, ve)) == NULL) || + p->xic || (p->openic_error != FALSE)) return; + + p->input_style = GetInputStyleOfIC(ve); + + if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, FALSE); + XFlush(XtDisplay(w)); + + if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) { + if (p->flg & CIFontSet) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++; + height = maxAscentOfFontSet(p->font_set) + + maxDescentOfFontSet(p->font_set); + height = SetVendorShellHeight(ve, height); + } + if (p->flg & CIFg) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNForeground); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->foreground); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNForeground); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->foreground); st_cnt++; + } + if (p->flg & CIBg) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackground); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->background); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNBackground); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->background); st_cnt++; + } + if (p->flg & CIBgPixmap) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackgroundPixmap); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->bg_pixmap); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNBackgroundPixmap); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->bg_pixmap); st_cnt++; + } + if (p->flg & CILineS) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNLineSpace); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->line_spacing); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNLineSpace); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->line_spacing); st_cnt++; + } + } + if (p->input_style & XIMPreeditArea) { + pe_area.x = 0; + pe_area.y = ve->parent->core.height - height; + pe_area.width = ve->parent->core.width; + pe_area.height = height; + SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++; + } + if (p->input_style & XIMPreeditPosition) { + pe_area.x = 0; + pe_area.y = 0; + pe_area.width = w->core.width; + pe_area.height = w->core.height; + margin = &(((TextWidget)w)->text.margin); + pe_area.x += margin->left; + pe_area.y += margin->top; + pe_area.width -= (margin->left + margin->right - 1); + pe_area.height -= (margin->top + margin->bottom - 1); + SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++; + if (p->flg & CICursorP) { + _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y); + } else { + position.x = position.y = 0; + } + SetVaArg( &pe_a[pe_cnt], (XPointer) XNSpotLocation); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) &position); pe_cnt++; + } + if (p->input_style & XIMStatusArea) { + st_area.x = 0; + st_area.y = ve->parent->core.height - height; + st_area.width = ve->parent->core.width; + st_area.height = height; + SetVaArg( &st_a[st_cnt], (XPointer) XNArea); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) &st_area); st_cnt++; + } + + SetVaArg( &ic_a[ic_cnt], (XPointer) XNInputStyle); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) p->input_style); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) XNClientWindow); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(ve->parent)); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) XNFocusWindow); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(w)); ic_cnt++; + + if (pe_cnt > 0) { + SetVaArg( &pe_a[pe_cnt], (XPointer) NULL); + pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3], + pe_a[4], pe_a[5], pe_a[6], pe_a[7], pe_a[8], + pe_a[9], pe_a[10], pe_a[11], pe_a[12], + pe_a[13], pe_a[14], pe_a[15], pe_a[16], + pe_a[17], pe_a[18], pe_a[19]); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++; + } + + if (st_cnt > 0) { + SetVaArg( &st_a[st_cnt], (XPointer) NULL); + st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3], + st_a[4], st_a[5], st_a[6], st_a[7], st_a[8], + st_a[9], st_a[10], st_a[11], st_a[12], + st_a[13], st_a[14], st_a[15], st_a[16], + st_a[17], st_a[18], st_a[19]); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++; + } + SetVaArg( &ic_a[ic_cnt], (XPointer) NULL); + + p->xic = XCreateIC(ve->im.xim, ic_a[0], ic_a[1], ic_a[2], ic_a[3], + ic_a[4], ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], + ic_a[10], ic_a[11], ic_a[12], ic_a[13], ic_a[14], + ic_a[15], ic_a[16], ic_a[17], ic_a[18], ic_a[19]); + if (pe_attr) XtFree(pe_attr); + if (st_attr) XtFree(st_attr); + + if (p->xic == NULL) { + p->openic_error = True; + return; + } + + SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height); + + p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS); + + if (!IsSharedIC(ve)) { + if (p->input_style & XIMPreeditPosition) { + XtAddEventHandler(w, (EventMask)StructureNotifyMask, FALSE, + (XtEventHandler)ConfigureCB, (Opaque)NULL); + } + } +} + +static void SetICValues( w, ve, focus ) + Widget w; + XawVendorShellExtPart *ve; + Boolean focus; +{ + XawIcTableList p; + XPoint position; + XRectangle pe_area; + XVaNestedList pe_attr = NULL, st_attr = NULL; + XPointer ic_a[20], pe_a[20], st_a[20]; + int ic_cnt = 0, pe_cnt = 0, st_cnt = 0; + XawTextMargin *margin; + int height; + + if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) || + (p->xic == NULL)) return; + + if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, TRUE); + XFlush(XtDisplay(w)); + if (focus == FALSE && + !(p->flg & (CIFontSet | CIFg | CIBg | + CIBgPixmap | CICursorP | CILineS))) return; +#ifdef SPOT + if ((p->input_style & XIMPreeditPosition) + && ((!IsSharedIC(ve) && ((p->flg & ~CIICFocus) == CICursorP)) + || (IsSharedIC(ve) && p->flg == CICursorP))) { + _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y); + _XipChangeSpot(p->xic, position.x, position.y); + p->flg &= ~CICursorP; + return; + } +#endif + + if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) { + if (p->flg & CIFontSet) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++; + height = maxAscentOfFontSet(p->font_set) + + maxDescentOfFontSet(p->font_set); + height = SetVendorShellHeight(ve, height); + } + if (p->flg & CIFg) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNForeground); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->foreground); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNForeground); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->foreground); st_cnt++; + } + if (p->flg & CIBg) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackground); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->background); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNBackground); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->background); st_cnt++; + } + if (p->flg & CIBgPixmap) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackgroundPixmap); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->bg_pixmap); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNBackgroundPixmap); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->bg_pixmap); st_cnt++; + } + if (p->flg & CILineS) { + SetVaArg( &pe_a[pe_cnt], (XPointer) XNLineSpace); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) p->line_spacing); pe_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) XNLineSpace); st_cnt++; + SetVaArg( &st_a[st_cnt], (XPointer) p->line_spacing); st_cnt++; + } + } + if (p->input_style & XIMPreeditPosition) { + if (p->flg & CICursorP) { + _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y); + SetVaArg( &pe_a[pe_cnt], (XPointer) XNSpotLocation); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) &position); pe_cnt++; + } + } + if (IsSharedIC(ve)) { + if (p->input_style & XIMPreeditPosition) { + pe_area.x = 0; + pe_area.y = 0; + pe_area.width = w->core.width; + pe_area.height = w->core.height; + margin = &(((TextWidget)w)->text.margin); + pe_area.x += margin->left; + pe_area.y += margin->top; + pe_area.width -= (margin->left + margin->right - 1); + pe_area.height -= (margin->top + margin->bottom - 1); + SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++; + SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++; + } + } + + if (pe_cnt > 0) { + SetVaArg( &pe_a[pe_cnt], (XPointer) NULL); + pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3], + pe_a[4], pe_a[5], pe_a[6], pe_a[7], + pe_a[8], pe_a[9], pe_a[10], pe_a[11], + pe_a[12], pe_a[13], pe_a[14], pe_a[15], + pe_a[16], pe_a[17], pe_a[18], pe_a[19]); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++; + } + if (st_cnt > 0) { + SetVaArg( &st_a[st_cnt], (XPointer) NULL); + st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3], + st_a[4], st_a[5], st_a[6], st_a[7], + st_a[8], st_a[9], st_a[10], st_a[11], + st_a[12], st_a[13], st_a[14], st_a[15], + st_a[16], st_a[17], st_a[18], st_a[19]); + SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++; + } + if (focus == TRUE) { + SetVaArg( &ic_a[ic_cnt], (XPointer) XNFocusWindow); ic_cnt++; + SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(w)); ic_cnt++; + } + if (ic_cnt > 0) { + SetVaArg( &ic_a[ic_cnt], (XPointer) NULL); + XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4], + ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], ic_a[10], + ic_a[11], ic_a[12], ic_a[13], ic_a[14], ic_a[15], + ic_a[16], ic_a[17], ic_a[18], ic_a[19]); + if (pe_attr) XtFree(pe_attr); + if (st_attr) XtFree(st_attr); + } + + if (IsSharedIC(ve) && p->flg & CIFontSet) + SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height); + + p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS); +} + +static void SharedICChangeFocusWindow(w, ve, p) + Widget w; + XawVendorShellExtPart *ve; + XawIcTableList p; +{ + XawIcTableList pp; + + if (w == NULL) { + ve->ic.current_ic_table = NULL; + return; + } + if ((pp = GetIcTable(w, ve)) == NULL) return; + ve->ic.current_ic_table = pp; + SetICValues(w, ve, TRUE); +} + +static XawIcTableList CurrentSharedIcTable( ve ) + XawVendorShellExtPart * ve; +{ + return(ve->ic.current_ic_table); +} + +static void SetICFocus(w, ve) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList p, pp; + + if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) || + (p->xic == NULL)) return; + + if (IsSharedIC(ve)) { + pp = CurrentSharedIcTable(ve); + if (pp == NULL || pp->widget != w) { + SharedICChangeFocusWindow(w, ve, p); + } + } + if (p->flg & CIICFocus && p->ic_focused == FALSE) { + p->ic_focused = TRUE; + XSetICFocus(p->xic); + } + p->flg &= ~CIICFocus; +} + +static void UnsetICFocus(w, ve) + Widget w; + XawVendorShellExtPart * ve; +{ + XawIcTableList p, pp; + + if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) || + (p->xic == NULL)) return; + + if (IsSharedIC(ve) && (pp = CurrentSharedIcTable(ve))) { + if (pp->widget != w) { + return; + } + SharedICChangeFocusWindow(NULL, ve, p); + } + if (p->ic_focused == TRUE) { + XUnsetICFocus(p->xic); + p->ic_focused = FALSE; + } +} + +static void SetValues( w, ve, args, num_args ) + Widget w; + XawVendorShellExtPart * ve; + ArgList args; + Cardinal num_args; +{ + ArgList arg; + + XrmName argName; + XrmResourceList xrmres; + int i; + XawIcTablePart *p, save_tbl; + + if ((p = GetIcTable(w, ve)) == NULL) return; + + memcpy(&save_tbl, p, sizeof(XawIcTablePart)); + + for (arg = args ; num_args != 0; num_args--, arg++) { + argName = XrmStringToName(arg->name); + for (xrmres = (XrmResourceList)ve->im.resources, i = 0; + i < ve->im.num_resources; i++, xrmres++) { + if (argName == xrmres->xrm_name) { + _XtCopyFromArg(arg->value, + (char *)p - xrmres->xrm_offset - 1, + xrmres->xrm_size); + break; + } + } + } + if (p->font_set != save_tbl.font_set) { + p->flg |= CIFontSet; + } + if (p->foreground != save_tbl.foreground) { + p->flg |= CIFg; + } + if (p->background !=save_tbl.background) { + p->flg |= CIBg; + } + if (p->bg_pixmap != save_tbl.bg_pixmap) { + p->flg |= CIBgPixmap; + } + if (p->cursor_position != save_tbl.cursor_position) { + p->flg |= CICursorP; + } + if (p->line_spacing != save_tbl.line_spacing) { + p->flg |= CILineS; + } + p->prev_flg |= p->flg; +} + +static void SetFocus( w, ve ) + Widget w; + XawVendorShellExtPart *ve; +{ + XawIcTableList p; + if ((p = GetIcTableShared(w, ve)) == NULL) return; + + if ( p->ic_focused == FALSE || IsSharedIC(ve)) { + p->flg |= CIICFocus; + } + p->prev_flg |= p->flg; +} + +static void DestroyIC(w, ve) + Widget w; + XawVendorShellExtPart *ve; +{ + XawIcTableList p; + + if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) || + (p->xic == NULL)) return; + if (IsSharedIC(ve)) { + if (GetIcTable(w, ve) == ve->ic.current_ic_table) { + UnsetICFocus(w, ve); + } + return; + } + XDestroyIC(p->xic); + if (!IsSharedIC(ve)) { + if (p->input_style & XIMPreeditPosition) { + XtRemoveEventHandler(w, (EventMask)StructureNotifyMask, FALSE, + (XtEventHandler)ConfigureCB, (Opaque)NULL); + } + } +} + +static void SetFocusValues( inwidg, args, num_args, focus ) + Widget inwidg; + ArgList args; + Cardinal num_args; + Boolean focus; +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + + if ((vw = SearchVendorShell(inwidg)) == NULL) return; + if ((ve = GetExtPart(vw))) { + if (num_args > 0) SetValues(inwidg, ve, args, num_args); + if (focus) SetFocus(inwidg, ve); + if (XtIsRealized((Widget)vw) && ve->im.xim) { + if (IsCreatedIC(inwidg, ve)) { + SetICValues(inwidg, ve, FALSE); + if (focus) SetICFocus(inwidg, ve); + } else { + CreateIC(inwidg, ve); + SetICFocus(inwidg, ve); + } + } + } +} + +static void UnsetFocus( inwidg ) + Widget inwidg; +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + XawIcTableList p; + + if ((vw = SearchVendorShell(inwidg)) == NULL) return; + if ((ve = GetExtPart(vw))) { + if ((p = GetIcTableShared(inwidg, ve)) == NULL) return; + if (p->flg & CIICFocus) { + p->flg &= ~CIICFocus; + } + p->prev_flg &= ~CIICFocus; + if (ve->im.xim && XtIsRealized((Widget)vw) && p->xic) { + UnsetICFocus(inwidg, ve); + } + } +} + +static Boolean IsRegistered( w, ve ) + Widget w; + XawVendorShellExtPart* ve; +{ + XawIcTableList p; + + for (p = ve->ic.ic_table; p; p = p->next) + { + if (p->widget == w) return(TRUE); + } + return(FALSE); +} + +static void Register(inwidg, ve) + Widget inwidg; + XawVendorShellExtPart* ve; +{ + if (ve->im.xim == NULL) + { + OpenIM(ve); + } + + if (IsRegistered(inwidg, ve)) return; + + if (RegisterToVendorShell(inwidg, ve) == FALSE) return; + + if (ve->im.xim == NULL) return; + + if (XtIsRealized(ve->parent)) + { + CreateIC(inwidg, ve); + SetICFocus(inwidg, ve); + } +} + +static Boolean NoRegistered(ve) + XawVendorShellExtPart* ve; +{ + if (ve->ic.ic_table == NULL) return(TRUE); + return(FALSE); +} + +static void Unregister(inwidg, ve) + Widget inwidg; + XawVendorShellExtPart* ve; +{ + if (!IsRegistered(inwidg, ve)) return; + + DestroyIC(inwidg, ve); + + UnregisterFromVendorShell(inwidg, ve); + + if (NoRegistered(ve)) + { + CloseIM(ve); + ve->im.xim = NULL; + /* + * resize vendor shell to core size + */ + (void) SetVendorShellHeight(ve, 0); + } +} + +static void AllCreateIC( ve ) + XawVendorShellExtPart* ve; +{ + XawIcTableList p; + + if (ve->im.xim == NULL) return; + if (IsSharedIC(ve) && ve->ic.ic_table[0].widget) { + p = ve->ic.shared_ic_table; + if (p->xic == NULL) + CreateIC(ve->ic.ic_table[0].widget, ve); + SetICFocus(ve->ic.ic_table[0].widget, ve); + return; + } + for (p = ve->ic.ic_table; p; p = p->next) { + if (p->xic == NULL) + CreateIC(p->widget, ve); + } + for (p = ve->ic.ic_table; p; p = p->next) { + SetICFocus(p->widget, ve); + } +} + + +static void Reconnect(ve) + XawVendorShellExtPart* ve; +{ + XawIcTableList p; + + ve->im.open_im = True; + if (ve->im.xim == NULL) { + OpenIM(ve); + } + if (ve->im.xim == NULL) return; + + if (IsSharedIC(ve)) { + p = ve->ic.shared_ic_table; + p->flg = p->prev_flg; + p->openic_error = FALSE; + } else { + for (p = ve->ic.ic_table; p; p = p->next) { + p->flg = p->prev_flg; + p->openic_error = FALSE; + } + } + AllCreateIC(ve); +} + + +static void CompileResourceList( res, num_res ) + XtResourceList res; + unsigned int num_res; +{ + unsigned int count; + +#define xrmres ((XrmResourceList) res) + for (count = 0; count < num_res; res++, count++) { + xrmres->xrm_name = XrmPermStringToQuark(res->resource_name); + xrmres->xrm_class = XrmPermStringToQuark(res->resource_class); + xrmres->xrm_type = XrmPermStringToQuark(res->resource_type); + xrmres->xrm_offset = -res->resource_offset - 1; + xrmres->xrm_default_type = XrmPermStringToQuark(res->default_type); + } +#undef xrmres +} + +static Boolean Initialize( vw, ve ) + VendorShellWidget vw; + XawVendorShellExtPart* ve; +{ + int i; + + if (!XtIsVendorShell((Widget)vw)) return(FALSE); + ve->parent = (Widget)vw; + ve->im.xim = NULL; + ve->im.area_height = 0; + ve->im.resources = (XrmResourceList)XtMalloc(sizeof(resources)); + if (ve->im.resources == NULL) return(FALSE); + memcpy((char *)ve->im.resources, (char *)resources, sizeof(resources)); + ve->im.num_resources = XtNumber(resources); + CompileResourceList( (XtResourceList) ve->im.resources, + ve->im.num_resources ); + if ((ve->ic.shared_ic_table = CreateIcTable( (Widget)vw, ve)) == NULL) + return(FALSE); + ve->ic.current_ic_table = NULL; + ve->ic.ic_table = NULL; + return(TRUE); +} + + +/* Destroy() + * + * This frees all (most?) of the resources malloced by XawIm. + * It is called by _XawImDestroy, which is called by Vendor.c's + * VendorExt's Destroy method. Sheeran, Omron KK, 93/08/05 */ + +static void Destroy( w, ve ) + Widget w; + XawVendorShellExtPart* ve; +{ + contextDataRec *contextData; + contextErrDataRec *contextErrData; + + if (!XtIsVendorShell( w ) ) + return; + XtFree( (char*) ve->im.resources ); + + if (extContext != (XContext)NULL && + !XFindContext (XtDisplay (w), (Window)w, + extContext, (XPointer*)&contextData)) + XtFree( (char*) contextData ); + + if (errContext != (XContext)NULL && + !XFindContext (XDisplayOfIM( ve->im.xim ), (Window) ve->im.xim, + errContext, (XPointer*) &contextErrData)) + XtFree( (char*) contextErrData ); +} + +/********************************************* + * + * SEMI-PRIVATE FUNCTIONS + * For use by other Xaw modules + * + ********************************************/ + +void +#if NeedFunctionPrototypes +_XawImResizeVendorShell( + Widget w ) +#else +_XawImResizeVendorShell( w ) + Widget w; +#endif +{ + XawVendorShellExtPart *ve; + + if ( ( ve = GetExtPart( (VendorShellWidget) w ) ) && ve->im.xim ) { + ResizeVendorShell( (VendorShellWidget) w, ve ); + } +} + + +Dimension +#if NeedFunctionPrototypes +_XawImGetShellHeight( + Widget w ) +#else +_XawImGetShellHeight( w ) + Widget w; +#endif +{ + XawVendorShellExtPart *ve; + + if (!XtIsVendorShell( w ) ) return( w->core.height ); + if ((ve = GetExtPart( (VendorShellWidget) w ))) { + return( w->core.height - ve->im.area_height ); + } + return( w->core.height ); +} + +void +#if NeedFunctionPrototypes +_XawImRealize( + Widget w ) +#else +_XawImRealize( w ) + Widget w; +#endif +{ + XawVendorShellExtPart *ve; + extern void XawVendorShellExtResize(); + + if ( !XtIsRealized( w ) || !XtIsVendorShell( w ) ) return; + if ((ve = GetExtPart( (VendorShellWidget) w ))) { + XtAddEventHandler( w, (EventMask)StructureNotifyMask, FALSE, + XawVendorShellExtResize, (XtPointer)NULL ); + AllCreateIC(ve); + } +} + +void +#if NeedFunctionPrototypes +_XawImInitialize( + Widget w, + Widget ext ) +#else +_XawImInitialize( w, ext ) + Widget w, ext; +#endif +{ + XawVendorShellExtPart *ve; + + if ( !XtIsVendorShell( w ) ) return; + if ((ve = SetExtPart( (VendorShellWidget) w, (XawVendorShellExtWidget)ext)) ) { + if ( Initialize( (VendorShellWidget) w, ve ) == FALSE ) return; + XtAddCallback( w, XtNdestroyCallback, VendorShellDestroyed, + (XtPointer) NULL ); + } +} + +void +#if NeedFunctionPrototypes +_XawImReconnect( + Widget inwidg ) +#else +_XawImReconnect( inwidg ) + Widget inwidg; +#endif +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + + if ((vw = SearchVendorShell(inwidg)) == NULL) return; + if ((ve = GetExtPart(vw))) { + Reconnect(ve); + } +} + +void +#if NeedFunctionPrototypes +_XawImRegister( + Widget inwidg) +#else +_XawImRegister(inwidg) + Widget inwidg; +#endif +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + + if ((vw = SearchVendorShell(inwidg)) == NULL) return; + if ((ve = GetExtPart(vw))) { + Register(inwidg, ve); + } +} + +void +#if NeedFunctionPrototypes +_XawImUnregister( + Widget inwidg) +#else +_XawImUnregister(inwidg) + Widget inwidg; +#endif +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + + if ((vw = SearchVendorShell(inwidg)) == NULL) return; + if ((ve = GetExtPart(vw))) { + Unregister(inwidg, ve); + } +} + +void +#if NeedFunctionPrototypes +_XawImSetValues( + Widget inwidg, + ArgList args, + Cardinal num_args ) +#else +_XawImSetValues( inwidg, args, num_args ) + Widget inwidg; + ArgList args; + Cardinal num_args; +#endif +{ + SetFocusValues( inwidg, args, num_args, FALSE ); +} + +void +#if NeedVarargsPrototypes +_XawImVASetValues( Widget inwidg, ... ) +#else +_XawImVASetValues( inwidg, va_alist ) + Widget inwidg; + va_dcl +#endif +{ + va_list var; + ArgList args = NULL; + Cardinal num_args; + int total_count, typed_count; + + Va_start( var, inwidg ); + _XtCountVaList( var, &total_count, &typed_count ); + va_end( var ); + + Va_start( var, inwidg ); + + _XtVaToArgList( inwidg, var, total_count, &args, &num_args ); + _XawImSetValues( inwidg, args, num_args ); + if ( args != NULL ) { + XtFree( (XtPointer) args ); + } + va_end( var ); +} + +void +#if NeedFunctionPrototypes +_XawImSetFocusValues( + Widget inwidg, + ArgList args, + Cardinal num_args) +#else +_XawImSetFocusValues(inwidg, args, num_args) + Widget inwidg; + ArgList args; + Cardinal num_args; +#endif +{ + SetFocusValues(inwidg, args, num_args, TRUE); +} + +void +#if NeedVarargsPrototypes +_XawImVASetFocusValues(Widget inwidg, ...) +#else +_XawImVASetFocusValues(inwidg, va_alist) + Widget inwidg; + va_dcl +#endif +{ + va_list var; + ArgList args = NULL; + Cardinal num_args; + int total_count, typed_count; + + Va_start(var, inwidg); + _XtCountVaList(var, &total_count, &typed_count); + va_end(var); + + Va_start(var,inwidg); + + _XtVaToArgList(inwidg, var, total_count, &args, &num_args); + _XawImSetFocusValues(inwidg, args, num_args); + if (args != NULL) { + XtFree((XtPointer)args); + } + va_end(var); +} + +void +#if NeedFunctionPrototypes +_XawImUnsetFocus( + Widget inwidg) +#else +_XawImUnsetFocus(inwidg) + Widget inwidg; +#endif +{ + UnsetFocus(inwidg); +} + +int +#if NeedFunctionPrototypes +_XawImWcLookupString( + Widget inwidg, + XKeyPressedEvent *event, + wchar_t* buffer_return, + int bytes_buffer, + KeySym *keysym_return, + Status *status_return) +#else +_XawImWcLookupString( inwidg, event, buffer_return, bytes_buffer, + keysym_return, status_return) + Widget inwidg; + XKeyPressedEvent* event; + wchar_t* buffer_return; + int bytes_buffer; + KeySym* keysym_return; + Status* status_return; +#endif +{ + XawVendorShellExtPart* ve; + VendorShellWidget vw; + XawIcTableList p; + int i, ret; + char tmp_buf[64], *tmp_p; + wchar_t* buf_p; + + if ((vw = SearchVendorShell(inwidg)) && (ve = GetExtPart(vw)) && + ve->im.xim && (p = GetIcTableShared(inwidg, ve)) && p->xic) { + return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer, + keysym_return, status_return)); + } + ret = XLookupString( event, tmp_buf, 64, keysym_return, + (XComposeStatus*) status_return ); + for ( i = 0, tmp_p = tmp_buf, buf_p = buffer_return; i < ret; i++ ) { + *buf_p++ = _Xaw_atowc(*tmp_p++); + } + return( ret ); +} + +int +#if NeedFunctionPrototypes +_XawImGetImAreaHeight( + Widget w) +#else +_XawImGetImAreaHeight( w ) + Widget w; +#endif +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + + if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) { + return(ve->im.area_height); + } + return(0); +} + +void +#if NeedFunctionPrototypes +_XawImCallVendorShellExtResize( + Widget w) +#else +_XawImCallVendorShellExtResize( w ) + Widget w; +#endif +{ + XawVendorShellExtPart *ve; + VendorShellWidget vw; + extern void XawVendorShellExtResize(); + + if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) { + XawVendorShellExtResize(vw); + } +} + + +/* _XawImDestroy() + * + * This should be called by the VendorExt from its + * core Destroy method. Sheeran, Omron KK 93/08/05 */ + +void +#if NeedFunctionPrototypes +_XawImDestroy( + Widget w, + Widget ext ) +#else +_XawImDestroy( w, ext ) + Widget w; + Widget ext; +#endif +{ + XawVendorShellExtPart *ve; + + if ( !XtIsVendorShell( w ) ) return; + if ((ve = GetExtPart( (VendorShellWidget) w ))) + Destroy( w, ve ); +} diff --git a/vendor/x11iraf/xaw3d/XawImP.h b/vendor/x11iraf/xaw3d/XawImP.h new file mode 100644 index 00000000..4c398ffd --- /dev/null +++ b/vendor/x11iraf/xaw3d/XawImP.h @@ -0,0 +1,240 @@ +/* $XConsortium: XawImP.h,v 1.4 95/06/06 20:50:30 kaleb Exp $ */ + +/* + * Copyright 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of OMRON not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. OMRON makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * + * Author: Seiji Kuwari OMRON Corporation + * kuwa@omron.co.jp + * kuwa%omron.co.jp@uunet.uu.net + */ + +/* + +Copyright (c) 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#ifndef _XawImP_h +#define _XawImP_h + +#define XtNinputMethod "inputMethod" +#define XtCInputMethod "InputMethod" +#define XtNpreeditType "preeditType" +#define XtCPreeditType "PreeditType" +#define XtNopenIm "openIm" +#define XtCOpenIm "OpenIm" +#define XtNsharedIc "sharedIc" +#define XtCSharedIc "SharedIc" + +#include <X11/Xaw3d/Text.h> + +#define CIICFocus (1 << 0) +#define CIFontSet (1 << 1) +#define CIFg (1 << 2) +#define CIBg (1 << 3) +#define CIBgPixmap (1 << 4) +#define CICursorP (1 << 5) +#define CILineS (1 << 6) + +typedef struct _XawImPart +{ + XIM xim; + XrmResourceList resources; + Cardinal num_resources; + Boolean open_im; + Boolean initialized; + Dimension area_height; + String input_method; + String preedit_type; +} XawImPart; + +typedef struct _XawIcTablePart +{ + Widget widget; + XIC xic; + XIMStyle input_style; + unsigned long flg; + unsigned long prev_flg; + Boolean ic_focused; + XFontSet font_set; + Pixel foreground; + Pixel background; + Pixmap bg_pixmap; + XawTextPosition cursor_position; + unsigned long line_spacing; + Boolean openic_error; + struct _XawIcTablePart *next; +} XawIcTablePart, *XawIcTableList; + +typedef struct _XawIcPart +{ + XIMStyle input_style; + Boolean shared_ic; + XawIcTableList shared_ic_table; + XawIcTableList current_ic_table; + XawIcTableList ic_table; +} XawIcPart; + +typedef struct _contextDataRec +{ + Widget parent; + Widget ve; +} contextDataRec; + +typedef struct _contextErrDataRec +{ + Widget widget; + XIM xim; +} contextErrDataRec; + +void _XawImResizeVendorShell( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +Dimension _XawImGetShellHeight( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImRealize( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImInitialize( +#if NeedFunctionPrototypes + Widget, /* w */ + Widget /* ext */ +#endif +); + +void _XawImReconnect( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImRegister( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImUnregister( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImSetValues( +#if NeedFunctionPrototypes + Widget, /* w */ + ArgList, /* args */ + Cardinal /* num_args */ +#endif +); + +/* DON'T USE THIS FUNCTION -- it's going away in the next release */ +void _XawImVASetValues( +#if NeedVarargsPrototypes + Widget, /* w */ + ... +#endif +); + +void _XawImSetFocusValues( +#if NeedFunctionPrototypes + Widget, /* w */ + ArgList, /* args */ + Cardinal /* num_args */ +#endif +); + +/* DON'T USE THIS FUNCTION -- it's going away in the next release */ +void _XawImVASetFocusValues( +#if NeedVarargsPrototypes + Widget, /* w */ + ... +#endif +); + +void _XawImUnsetFocus( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +int _XawImWcLookupString( +#if NeedFunctionPrototypes + Widget, /* w */ + XKeyPressedEvent*, /* event */ + wchar_t*, /* buffer_return */ + int, /* bytes_buffer */ + KeySym*, /* keysym_return */ + Status* /* status return */ +#endif +); + +int _XawImGetImAreaHeight( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImCallVendorShellExtResize( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +void _XawImDestroy( +#if NeedFunctionPrototypes + Widget, /* w */ + Widget /* ext */ +#endif +); + +#endif /* _XawImP_h */ diff --git a/vendor/x11iraf/xaw3d/XawInit.c b/vendor/x11iraf/xaw3d/XawInit.c new file mode 100644 index 00000000..b2bd4825 --- /dev/null +++ b/vendor/x11iraf/xaw3d/XawInit.c @@ -0,0 +1,49 @@ +/* + * $XConsortium: XawInit.c,v 1.3 94/04/17 20:13:32 jim Exp $ + * +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * + * + * XawInitializeWidgetSet + * + * This routine forces a reference to vendor shell so that the one in this + * widget is installed. Any other cross-widget set initialization should be + * done here as well. All Athena widgets should include "XawInit.h" and + * call this routine from their ClassInitialize procs (this routine may be + * used as the class init proc). + */ + +#include <X11/Intrinsic.h> +#include <X11/Vendor.h> +#include <X11/Xaw3d/XawInit.h> + +void XawInitializeWidgetSet () +{ + static int firsttime = 1; + + if (firsttime) { + firsttime = 0; + XtInitializeWidgetClass (vendorShellWidgetClass); + } +} diff --git a/vendor/x11iraf/xaw3d/XawInit.h b/vendor/x11iraf/xaw3d/XawInit.h new file mode 100644 index 00000000..5d19f885 --- /dev/null +++ b/vendor/x11iraf/xaw3d/XawInit.h @@ -0,0 +1,31 @@ +/* $XConsortium: XawInit.h,v 1.6 94/04/17 20:13:33 kaleb Exp $ + * +Copyright (c) 1989, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + */ + +_XFUNCPROTOBEGIN + +extern void XawInitializeWidgetSet(); /* called from ClassInit procs */ + +_XFUNCPROTOEND diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AllWidgets.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AllWidgets.h new file mode 120000 index 00000000..fab2cb1c --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AllWidgets.h @@ -0,0 +1 @@ +../../../.././AllWidgets.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSink.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSink.h new file mode 120000 index 00000000..22d1c08f --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSink.h @@ -0,0 +1 @@ +../../../.././AsciiSink.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSinkP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSinkP.h new file mode 120000 index 00000000..a6baa5e3 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSinkP.h @@ -0,0 +1 @@ +../../../.././AsciiSinkP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrc.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrc.h new file mode 120000 index 00000000..a9c76bd6 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrc.h @@ -0,0 +1 @@ +../../../.././AsciiSrc.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrcP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrcP.h new file mode 120000 index 00000000..7c36d629 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiSrcP.h @@ -0,0 +1 @@ +../../../.././AsciiSrcP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiText.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiText.h new file mode 120000 index 00000000..f4f2eb9c --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiText.h @@ -0,0 +1 @@ +../../../.././AsciiText.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiTextP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiTextP.h new file mode 120000 index 00000000..382a9aa3 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/AsciiTextP.h @@ -0,0 +1 @@ +../../../.././AsciiTextP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Box.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Box.h new file mode 120000 index 00000000..2f70ba86 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Box.h @@ -0,0 +1 @@ +../../../.././Box.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/BoxP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/BoxP.h new file mode 120000 index 00000000..badcb543 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/BoxP.h @@ -0,0 +1 @@ +../../../.././BoxP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Cardinals.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Cardinals.h new file mode 120000 index 00000000..49708424 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Cardinals.h @@ -0,0 +1 @@ +../../../.././Cardinals.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Command.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Command.h new file mode 120000 index 00000000..486a5e7a --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Command.h @@ -0,0 +1 @@ +../../../.././Command.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/CommandP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/CommandP.h new file mode 120000 index 00000000..e44d023d --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/CommandP.h @@ -0,0 +1 @@ +../../../.././CommandP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Dialog.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Dialog.h new file mode 120000 index 00000000..593f9c88 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Dialog.h @@ -0,0 +1 @@ +../../../.././Dialog.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/DialogP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/DialogP.h new file mode 120000 index 00000000..ff77c463 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/DialogP.h @@ -0,0 +1 @@ +../../../.././DialogP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Form.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Form.h new file mode 120000 index 00000000..b2056815 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Form.h @@ -0,0 +1 @@ +../../../.././Form.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/FormP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/FormP.h new file mode 120000 index 00000000..f084f9d7 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/FormP.h @@ -0,0 +1 @@ +../../../.././FormP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Grip.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Grip.h new file mode 120000 index 00000000..abc1eedf --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Grip.h @@ -0,0 +1 @@ +../../../.././Grip.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/GripP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/GripP.h new file mode 120000 index 00000000..9d4706ff --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/GripP.h @@ -0,0 +1 @@ +../../../.././GripP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Label.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Label.h new file mode 120000 index 00000000..0ed3d2eb --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Label.h @@ -0,0 +1 @@ +../../../.././Label.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/LabelP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/LabelP.h new file mode 120000 index 00000000..1158a614 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/LabelP.h @@ -0,0 +1 @@ +../../../.././LabelP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/List.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/List.h new file mode 120000 index 00000000..89bce8a6 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/List.h @@ -0,0 +1 @@ +../../../.././List.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ListP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ListP.h new file mode 120000 index 00000000..934a2983 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ListP.h @@ -0,0 +1 @@ +../../../.././ListP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButtoP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButtoP.h new file mode 120000 index 00000000..1bb43bb5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButtoP.h @@ -0,0 +1 @@ +../../../.././MenuButtoP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButton.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButton.h new file mode 120000 index 00000000..051bbe33 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MenuButton.h @@ -0,0 +1 @@ +../../../.././MenuButton.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSink.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSink.h new file mode 120000 index 00000000..c6f5ea10 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSink.h @@ -0,0 +1 @@ +../../../.././MultiSink.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSinkP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSinkP.h new file mode 120000 index 00000000..f1f2cd5f --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSinkP.h @@ -0,0 +1 @@ +../../../.././MultiSinkP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrc.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrc.h new file mode 120000 index 00000000..cddb0518 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrc.h @@ -0,0 +1 @@ +../../../.././MultiSrc.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrcP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrcP.h new file mode 120000 index 00000000..730245c1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/MultiSrcP.h @@ -0,0 +1 @@ +../../../.././MultiSrcP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Paned.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Paned.h new file mode 120000 index 00000000..7fed1a09 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Paned.h @@ -0,0 +1 @@ +../../../.././Paned.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PanedP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PanedP.h new file mode 120000 index 00000000..d5523757 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PanedP.h @@ -0,0 +1 @@ +../../../.././PanedP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Panner.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Panner.h new file mode 120000 index 00000000..eafbb0c9 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Panner.h @@ -0,0 +1 @@ +../../../.././Panner.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PannerP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PannerP.h new file mode 120000 index 00000000..d59d74f1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PannerP.h @@ -0,0 +1 @@ +../../../.././PannerP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Porthole.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Porthole.h new file mode 120000 index 00000000..e59c1b13 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Porthole.h @@ -0,0 +1 @@ +../../../.././Porthole.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PortholeP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PortholeP.h new file mode 120000 index 00000000..cdb5f618 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/PortholeP.h @@ -0,0 +1 @@ +../../../.././PortholeP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Repeater.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Repeater.h new file mode 120000 index 00000000..eae6e1c0 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Repeater.h @@ -0,0 +1 @@ +../../../.././Repeater.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/RepeaterP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/RepeaterP.h new file mode 120000 index 00000000..6e0c0957 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/RepeaterP.h @@ -0,0 +1 @@ +../../../.././RepeaterP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Reports.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Reports.h new file mode 120000 index 00000000..e0d7e93d --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Reports.h @@ -0,0 +1 @@ +../../../.././Reports.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Scrollbar.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Scrollbar.h new file mode 120000 index 00000000..5ffa05e1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Scrollbar.h @@ -0,0 +1 @@ +../../../.././Scrollbar.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ScrollbarP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ScrollbarP.h new file mode 120000 index 00000000..1e226ad1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ScrollbarP.h @@ -0,0 +1 @@ +../../../.././ScrollbarP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Simple.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Simple.h new file mode 120000 index 00000000..1d89e642 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Simple.h @@ -0,0 +1 @@ +../../../.././Simple.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenP.h new file mode 120000 index 00000000..ac46c060 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenP.h @@ -0,0 +1 @@ +../../../.././SimpleMenP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenu.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenu.h new file mode 120000 index 00000000..10933e9b --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleMenu.h @@ -0,0 +1 @@ +../../../.././SimpleMenu.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleP.h new file mode 120000 index 00000000..51784540 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SimpleP.h @@ -0,0 +1 @@ +../../../.././SimpleP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Sme.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Sme.h new file mode 120000 index 00000000..f797179e --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Sme.h @@ -0,0 +1 @@ +../../../.././Sme.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSB.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSB.h new file mode 120000 index 00000000..f06cacf4 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSB.h @@ -0,0 +1 @@ +../../../.././SmeBSB.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSBP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSBP.h new file mode 120000 index 00000000..327ee505 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeBSBP.h @@ -0,0 +1 @@ +../../../.././SmeBSBP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLine.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLine.h new file mode 120000 index 00000000..07e146b1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLine.h @@ -0,0 +1 @@ +../../../.././SmeLine.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLineP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLineP.h new file mode 120000 index 00000000..f73d5bc5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeLineP.h @@ -0,0 +1 @@ +../../../.././SmeLineP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeP.h new file mode 120000 index 00000000..a812f505 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeP.h @@ -0,0 +1 @@ +../../../.././SmeP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeD.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeD.h new file mode 120000 index 00000000..8e7c14aa --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeD.h @@ -0,0 +1 @@ +../../../.././SmeThreeD.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeDP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeDP.h new file mode 120000 index 00000000..7cef8c88 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/SmeThreeDP.h @@ -0,0 +1 @@ +../../../.././SmeThreeDP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripCharP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripCharP.h new file mode 120000 index 00000000..6edb76b1 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripCharP.h @@ -0,0 +1 @@ +../../../.././StripCharP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripChart.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripChart.h new file mode 120000 index 00000000..c109e58c --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/StripChart.h @@ -0,0 +1 @@ +../../../.././StripChart.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.c b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.c new file mode 120000 index 00000000..025df5ae --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.c @@ -0,0 +1 @@ +../../../.././Template.c \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.h new file mode 120000 index 00000000..717ea5c0 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Template.h @@ -0,0 +1 @@ +../../../.././Template.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TemplateP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TemplateP.h new file mode 120000 index 00000000..9730cea5 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TemplateP.h @@ -0,0 +1 @@ +../../../.././TemplateP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Text.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Text.h new file mode 120000 index 00000000..2bf04dc8 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Text.h @@ -0,0 +1 @@ +../../../.././Text.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextP.h new file mode 120000 index 00000000..4e335b05 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextP.h @@ -0,0 +1 @@ +../../../.././TextP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSink.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSink.h new file mode 120000 index 00000000..13486fd6 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSink.h @@ -0,0 +1 @@ +../../../.././TextSink.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSinkP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSinkP.h new file mode 120000 index 00000000..63ab8d8f --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSinkP.h @@ -0,0 +1 @@ +../../../.././TextSinkP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrc.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrc.h new file mode 120000 index 00000000..1b9a097c --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrc.h @@ -0,0 +1 @@ +../../../.././TextSrc.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrcP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrcP.h new file mode 120000 index 00000000..51143763 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TextSrcP.h @@ -0,0 +1 @@ +../../../.././TextSrcP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeD.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeD.h new file mode 120000 index 00000000..a4e0ae4c --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeD.h @@ -0,0 +1 @@ +../../../.././ThreeD.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeDP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeDP.h new file mode 120000 index 00000000..220d1596 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ThreeDP.h @@ -0,0 +1 @@ +../../../.././ThreeDP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Toggle.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Toggle.h new file mode 120000 index 00000000..cbdeed95 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Toggle.h @@ -0,0 +1 @@ +../../../.././Toggle.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ToggleP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ToggleP.h new file mode 120000 index 00000000..750d2552 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ToggleP.h @@ -0,0 +1 @@ +../../../.././ToggleP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Tree.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Tree.h new file mode 120000 index 00000000..e29ee7c8 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Tree.h @@ -0,0 +1 @@ +../../../.././Tree.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TreeP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TreeP.h new file mode 120000 index 00000000..0d870a3b --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/TreeP.h @@ -0,0 +1 @@ +../../../.././TreeP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/VendorEP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/VendorEP.h new file mode 120000 index 00000000..6184ba70 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/VendorEP.h @@ -0,0 +1 @@ +../../../.././VendorEP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Viewport.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Viewport.h new file mode 120000 index 00000000..ed59e27b --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/Viewport.h @@ -0,0 +1 @@ +../../../.././Viewport.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ViewportP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ViewportP.h new file mode 120000 index 00000000..2898c9c2 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/ViewportP.h @@ -0,0 +1 @@ +../../../.././ViewportP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawImP.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawImP.h new file mode 120000 index 00000000..c4a5c583 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawImP.h @@ -0,0 +1 @@ +../../../.././XawImP.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawInit.h b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawInit.h new file mode 120000 index 00000000..d3f62788 --- /dev/null +++ b/vendor/x11iraf/xaw3d/exports/include/X11/Xaw3d/XawInit.h @@ -0,0 +1 @@ +../../../.././XawInit.h \ No newline at end of file diff --git a/vendor/x11iraf/xaw3d/jump_funcs b/vendor/x11iraf/xaw3d/jump_funcs new file mode 100644 index 00000000..9c137a79 --- /dev/null +++ b/vendor/x11iraf/xaw3d/jump_funcs @@ -0,0 +1,128 @@ +# $XConsortium: jump_funcs,v 1.2 94/12/07 10:46:47 kaleb Exp $ +# $XFree86: xc/lib/Xaw/jump_funcs,v 3.0 1994/04/28 12:31:51 dawes Exp $ +# +00000000 T _XawAsciiSourceFreeString libXaw3d AsciiSrc +00000000 T _XawAsciiSave libXaw3d AsciiSrc +00000000 T _XawAsciiSaveAsFile libXaw3d AsciiSrc +00000000 T _XawAsciiSourceChanged libXaw3d AsciiSrc +00000000 T _XawDialogAddButton libXaw3d Dialog +00000000 T _XawDialogGetValueString libXaw3d Dialog +00000000 T _XawFormDoLayout libXaw3d Form +00000000 T _XawListChange libXaw3d List +00000000 T _XawListUnhighlight libXaw3d List +00000000 T _XawListHighlight libXaw3d List +00000000 T _XawListShowCurrent libXaw3d List +00000000 T _XawPanedSetMinMax libXaw3d Paned +00000000 T _XawPanedGetMinMax libXaw3d Paned +00000000 T _XawPanedSetRefigureMode libXaw3d Paned +00000000 T _XawPanedGetNumSub libXaw3d Paned +00000000 T _XawPanedAllowResize libXaw3d Paned +00000000 T _XawScrollbarSetThumb libXaw3d Scrollbar +00000000 T _XawSimpleMenuAddGlobalActions libXaw3d SimpleMenu +00000000 T _XawSimpleMenuGetActiveEntry libXaw3d SimpleMenu +00000000 T _XawSimpleMenuClearActiveEntry libXaw3d SimpleMenu +00000000 T __XawTextNeedsUpdating libXaw3d Text +00000000 T __XawTextGetText libXaw3d Text +00000000 T __XawTextGetSTRING libXaw3d Text +00000000 T __XawTextBuildLineTable libXaw3d Text +00000000 T __XawTextSetScrollBars libXaw3d Text +00000000 T __XawTextVScroll libXaw3d Text +00000000 T __XawTextSaltAwaySelection libXaw3d Text +00000000 T __XawTextReplace libXaw3d Text +00000000 T __XawTextClearAndCenterDisplay libXaw3d Text +00000000 T __XawTextCheckResize libXaw3d Text +00000000 T __XawTextSelectionList libXaw3d Text +00000000 T __XawTextSetSelection libXaw3d Text +00000000 T __XawTextAlterSelection libXaw3d Text +00000000 T __XawTextPrepareToUpdate libXaw3d Text +00000000 T __XawTextShowPosition libXaw3d Text +00000000 T __XawTextExecuteUpdate libXaw3d Text +00000000 T _XawTextDisplay libXaw3d Text +00000000 T _XawTextSetSelectionArray libXaw3d Text +00000000 T _XawTextGetSelectionPos libXaw3d Text +00000000 T _XawTextSetSource libXaw3d Text +00000000 T _XawTextReplace libXaw3d Text +00000000 T _XawTextTopPosition libXaw3d Text +00000000 T _XawTextSetInsertionPoint libXaw3d Text +00000000 T _XawTextGetInsertionPoint libXaw3d Text +00000000 T _XawTextUnsetSelection libXaw3d Text +00000000 T _XawTextSetSelection libXaw3d Text +00000000 T _XawTextInvalidate libXaw3d Text +00000000 T _XawTextDisableRedisplay libXaw3d Text +00000000 T _XawTextEnableRedisplay libXaw3d Text +00000000 T _XawTextGetSource libXaw3d Text +00000000 T _XawTextDisplayCaret libXaw3d Text +00000000 T _XawTextSearch libXaw3d Text +00000000 T _XawTextSinkDisplayText libXaw3d TextSink +00000000 T _XawTextSinkInsertCursor libXaw3d TextSink +00000000 T _XawTextSinkClearToBackground libXaw3d TextSink +00000000 T _XawTextSinkFindPosition libXaw3d TextSink +00000000 T _XawTextSinkFindDistance libXaw3d TextSink +00000000 T _XawTextSinkResolve libXaw3d TextSink +00000000 T _XawTextSinkMaxLines libXaw3d TextSink +00000000 T _XawTextSinkMaxHeight libXaw3d TextSink +00000000 T _XawTextSinkSetTabs libXaw3d TextSink +00000000 T _XawTextSinkGetCursorBounds libXaw3d TextSink +00000000 T _XawTextSourceRead libXaw3d TextSrc +00000000 T _XawTextSourceReplace libXaw3d TextSrc +00000000 T _XawTextSourceScan libXaw3d TextSrc +00000000 T _XawTextSourceSearch libXaw3d TextSrc +00000000 T _XawTextSourceConvertSelection libXaw3d TextSrc +00000000 T _XawTextSourceSetSelection libXaw3d TextSrc +00000000 T __XawTextZapSelection libXaw3d TextAction +00000000 T __XawTextInsertFileAction libXaw3d TextPop +00000000 T __XawTextInsertFile libXaw3d TextPop +00000000 T __XawTextDoSearchAction libXaw3d TextPop +00000000 T __XawTextPopdownSearchAction libXaw3d TextPop +00000000 T __XawTextSearch libXaw3d TextPop +00000000 T __XawTextDoReplaceAction libXaw3d TextPop +00000000 T __XawTextSetField libXaw3d TextPop +00000000 T _XawToggleChangeRadioGroup libXaw3d Toggle +00000000 T _XawToggleGetCurrent libXaw3d Toggle +00000000 T _XawToggleSetCurrent libXaw3d Toggle +00000000 T _XawToggleUnsetCurrent libXaw3d Toggle +00000000 T _XawTreeForceLayout libXaw3d Tree +00000000 T _XawViewportSetLocation libXaw3d Viewport +00000000 T _XawViewportSetCoordinates libXaw3d Viewport +00000000 T _XawInitializeWidgetSet libXaw3d XawInit +00000000 T __XawMultiSourceFreeString libXaw3d MultiSrc +00000000 T __XawMultiSave libXaw3d MultiSrc +00000000 T __XawMultiSaveAsFile libXaw3d MultiSrc +00000000 T __XawMultiSinkPosToXY libXaw3d MultiSink +00000000 T __XawTextPosToXY libXaw3d Text +00000000 T __XawTextFormat libXaw3d TextSrc +00000000 T __XawTextWCToMB libXaw3d TextSrc +00000000 T __XawTextMBToWC libXaw3d TextSrc +00000000 T _XawVendorShellExtResize libXaw3d Vendor +00000000 T __XawImResizeVendorShell libXaw3d XawIm +00000000 T __XawImGetShellHeight libXaw3d XawIm +00000000 T __XawImRealize libXaw3d XawIm +00000000 T __XawImInitialize libXaw3d XawIm +00000000 T __XawImReconnect libXaw3d XawIm +00000000 T __XawImRegister libXaw3d XawIm +00000000 T __XawImUnregister libXaw3d XawIm +00000000 T __XawImSetValues libXaw3d XawIm +00000000 T __XawImVASetValues libXaw3d XawIm +00000000 T __XawImSetFocusValues libXaw3d XawIm +00000000 T __XawImVASetFocusValues libXaw3d XawIm +00000000 T __XawImUnsetFocus libXaw3d XawIm +00000000 T __XawImWcLookupString libXaw3d XawIm +00000000 T __XawImGetImAreaHeight libXaw3d XawIm +00000000 T __XawImCallVendorShellExtResize libXaw3d XawIm +00000000 T __XawImDestroy libXaw3d XawIm +00000000 T __Xaw_atowc libXaw3d XawI18n +00000000 T _XawSme3dComputeTopShadowRGB libXaw3d SmeThreeD +00000000 T _XawSme3dComputeBottomShadowRGB libXaw3d SmeThreeD +00000000 T _Xaw3dComputeTopShadowRGB libXaw3d ThreeD +00000000 T _Xaw3dComputeBottomShadowRGB libXaw3d ThreeD +00000000 T _LayYYwrap libXaw3d laygram +00000000 T _LayYYsetdest libXaw3d laygram +00000000 T _LayYYparse libXaw3d laygram +00000000 T _LayYYlex libXaw3d laylex +00000000 T _LayYYsetsource libXaw3d laylex +00000000 T _LayYYerror libXaw3d laylex +00000000 T _LayYYlook libXaw3d laylex +00000000 T _LayYYback libXaw3d laylex +00000000 T _LayYYinput libXaw3d laylex +00000000 T _LayYYoutput libXaw3d laylex +00000000 T _LayYYunput libXaw3d laylex diff --git a/vendor/x11iraf/xaw3d/jump_ignore b/vendor/x11iraf/xaw3d/jump_ignore new file mode 100644 index 00000000..cf0567d4 --- /dev/null +++ b/vendor/x11iraf/xaw3d/jump_ignore @@ -0,0 +1,3 @@ +# $XConsortium: jump_ignore,v 1.2 94/12/07 10:46:47 kaleb Exp $ +# $XFree86: xc/lib/Xaw/jump_ignore,v 3.0 1994/04/28 12:31:53 dawes Exp $ +# jump_ignore diff --git a/vendor/x11iraf/xaw3d/jump_vars b/vendor/x11iraf/xaw3d/jump_vars new file mode 100644 index 00000000..254c4eec --- /dev/null +++ b/vendor/x11iraf/xaw3d/jump_vars @@ -0,0 +1,126 @@ +# $XConsortium: jump_vars,v 1.2 94/12/07 10:46:47 kaleb Exp $ +# $XFree86: xc/lib/Xaw/jump_vars,v 3.0 1994/04/28 12:31:54 dawes Exp $ +# +00001400 D _XawWidgetArray libXaw3d AllWidgets +00000004 D _XawWidgetCount libXaw3d AllWidgets +00000140 D _asciiSinkClassRec libXaw3d AsciiSink +00000004 D _asciiSinkObjectClass libXaw3d AsciiSink +00000120 D _asciiSrcClassRec libXaw3d AsciiSrc +00000004 D _asciiSrcObjectClass libXaw3d AsciiSrc +00000100 D _asciiTextClassRec libXaw3d AsciiText +00000004 D _asciiTextWidgetClass libXaw3d AsciiText +00000100 D _boxClassRec libXaw3d Box +00000004 D _boxWidgetClass libXaw3d Box +00000100 D _commandClassRec libXaw3d Command +00000004 D _commandWidgetClass libXaw3d Command +00000140 D _dialogClassRec libXaw3d Dialog +00000004 D _dialogWidgetClass libXaw3d Dialog +00000140 D _formClassRec libXaw3d Form +00000004 D _formWidgetClass libXaw3d Form +00000100 D _gripClassRec libXaw3d Grip +00000004 D _gripWidgetClass libXaw3d Grip +00000100 D _labelClassRec libXaw3d Label +00000004 D _labelWidgetClass libXaw3d Label +00000100 D _listClassRec libXaw3d List +00000004 D _listWidgetClass libXaw3d List +00000100 D _menuButtonClassRec libXaw3d MenuButton +00000004 D _menuButtonWidgetClass libXaw3d MenuButton +00000140 D _panedClassRec libXaw3d Paned +00000004 D _panedWidgetClass libXaw3d Paned +00000004 D _vPanedWidgetClass libXaw3d Paned +00000100 D _pannerClassRec libXaw3d Panner +00000004 D _pannerWidgetClass libXaw3d Panner +00000100 D _portholeClassRec libXaw3d Porthole +00000004 D _portholeWidgetClass libXaw3d Porthole +00000100 D _repeaterClassRec libXaw3d Repeater +00000004 D _repeaterWidgetClass libXaw3d Repeater +00000100 D _scrollbarClassRec libXaw3d Scrollbar +00000004 D _scrollbarWidgetClass libXaw3d Scrollbar +00000100 D _simpleClassRec libXaw3d Simple +00000004 D _simpleWidgetClass libXaw3d Simple +00000100 D _simpleMenuClassRec libXaw3d SimpleMenu +00000004 D _simpleMenuWidgetClass libXaw3d SimpleMenu +00000100 D _smeClassRec libXaw3d Sme +00000004 D _smeObjectClass libXaw3d Sme +00000100 D _smeBSBClassRec libXaw3d SmeBSB +00000004 D _smeBSBObjectClass libXaw3d SmeBSB +00000100 D _smeLineClassRec libXaw3d SmeLine +00000004 D _smeLineObjectClass libXaw3d SmeLine +00000100 D _stripChartClassRec libXaw3d StripChart +00000004 D _stripChartWidgetClass libXaw3d StripChart +00000004 D _FMT8BIT libXaw3d Text +00000100 D _textClassRec libXaw3d Text +00000004 D _textWidgetClass libXaw3d Text +00000100 D _textSinkClassRec libXaw3d TextSink +00000004 D _textSinkObjectClass libXaw3d TextSink +00000100 D _textSrcClassRec libXaw3d TextSrc +00000004 D _textSrcObjectClass libXaw3d TextSrc +00000300 D __XawTextActionsTable libXaw3d TextAction +00000004 D __XawTextActionsTableCount libXaw3d TextAction +00000004 D __XawDefaultTextTranslations1 libXaw3d TextTr +00000004 D __XawDefaultTextTranslations2 libXaw3d TextTr +00000004 D __XawDefaultTextTranslations3 libXaw3d TextTr +00000100 D _toggleClassRec libXaw3d Toggle +00000004 D _toggleWidgetClass libXaw3d Toggle +00000140 D _treeClassRec libXaw3d Tree +00000004 D _treeWidgetClass libXaw3d Tree +00000100 D _vendorShellClassRec libXaw3d Vendor +00000004 D _vendorShellWidgetClass libXaw3d Vendor +00000140 D _viewportClassRec libXaw3d Viewport +00000004 D _viewportWidgetClass libXaw3d Viewport +00000140 D _multiSrcClassRec libXaw3d MultiSrc +00000004 D _multiSrcObjectClass libXaw3d MultiSrc +00000140 D _multiSinkClassRec libXaw3d MultiSink +00000004 D _multiSinkObjectClass libXaw3d MultiSink +00000004 D __XawDefaultTextTranslations4 libXaw3d TextTr +00000140 D _xawvendorShellExtClassRec libXaw3d Vendor +00000004 D _xawvendorShellExtWidgetClass libXaw3d Vendor +00000004 D _XawFmt8Bit libXaw3d Text +00000004 D _XawFmtWide libXaw3d Text +00000140 D _layoutClassRec libXaw3d Layout +00000004 D _layoutWidgetClass libXaw3d Layout +00000140 D _smeThreeDClassRec libXaw3d SmeThreeD +00000004 D _smeThreeDObjectClass libXaw3d SmeThreeD +00000100 D _threeDClassRec libXaw3d ThreeD +00000004 D _threeDWidgetClass libXaw3d ThreeD +000000a0 D _LayYYlhs libXaw3d laygram +000000a0 D _LayYYlen libXaw3d laygram +00000100 D _LayYYdefred libXaw3d laygram +00000040 D _LayYYdgoto libXaw3d laygram +00000140 D _LayYYsindex libXaw3d laygram +00000140 D _LayYYrindex libXaw3d laygram +00000040 D _LayYYgindex libXaw3d laygram +00000400 D _LayYYtable libXaw3d laygram +00000400 D _LayYYcheck libXaw3d laygram +00000004 C _LayYYdebug libXaw3d laygram +00000004 C _LayYYnerrs libXaw3d laygram +00000004 C _LayYYerrflag libXaw3d laygram +00000004 C _LayYYchar libXaw3d laygram +00000004 C _LayYYssp libXaw3d laygram +00000004 C _LayYYvsp libXaw3d laygram +00000040 C _LayYYval libXaw3d laygram +00000040 C _LayYYlval libXaw3d laygram +00000800 C _LayYYss libXaw3d laygram +00004000 C _LayYYvs libXaw3d laygram +00000004 D _LayYYin libXaw3d laylex +00000004 D _LayYYout libXaw3d laylex +00000400 D _LayYYvstop libXaw3d laylex +00000400 D _LayYYcrank libXaw3d laylex +00000600 D _LayYYsvec libXaw3d laylex +00000004 D _LayYYtop libXaw3d laylex +00000004 D _LayYYbgin libXaw3d laylex +00000200 D _LayYYmatch libXaw3d laylex +00000040 D _LayYYextra libXaw3d laylex +00000004 D _LayYYlineno libXaw3d laylex +00000004 D _LayYYsptr libXaw3d laylex +00000004 D _LayYYprevious libXaw3d laylex +00000004 C _LayYYleng libXaw3d laylex +00000800 C _LayYYtext libXaw3d laylex +00000004 C _LayYYmorfg libXaw3d laylex +00000800 C _LayYYsbuf libXaw3d laylex +00000004 C _LayYYtchar libXaw3d laylex +00000004 C _LayYYestate libXaw3d laylex +00002000 C _LayYYlstate libXaw3d laylex +00000004 C _LayYYlsp libXaw3d laylex +00000004 C _LayYYolsp libXaw3d laylex +00000004 C _LayYYfnd libXaw3d laylex diff --git a/vendor/x11iraf/xaw3d/laygram.h b/vendor/x11iraf/xaw3d/laygram.h new file mode 100644 index 00000000..97212640 --- /dev/null +++ b/vendor/x11iraf/xaw3d/laygram.h @@ -0,0 +1,45 @@ +#ifndef BISON_Y_TAB_H +# define BISON_Y_TAB_H + +#ifndef YYSTYPE +typedef union { + int ival; + XrmQuark qval; + BoxPtr bval; + BoxParamsPtr pval; + GlueRec gval; + LayoutDirection lval; + ExprPtr eval; + Operator oval; +} LayYYstype; +# define YYSTYPE LayYYstype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +# define OC 257 +# define CC 258 +# define OA 259 +# define CA 260 +# define OP 261 +# define CP 262 +# define NAME 263 +# define NUMBER 264 +# define INFINITY 265 +# define VERTICAL 266 +# define HORIZONTAL 267 +# define EQUAL 268 +# define DOLLAR 269 +# define PLUS 270 +# define MINUS 271 +# define TIMES 272 +# define DIVIDE 273 +# define PERCENTOF 274 +# define PERCENT 275 +# define WIDTH 276 +# define HEIGHT 277 +# define UMINUS 278 +# define UPLUS 279 + + +extern YYSTYPE LayYYlval; + +#endif /* not BISON_Y_TAB_H */ diff --git a/vendor/x11iraf/xaw3d/laygram.y b/vendor/x11iraf/xaw3d/laygram.y new file mode 100644 index 00000000..c209b64a --- /dev/null +++ b/vendor/x11iraf/xaw3d/laygram.y @@ -0,0 +1,263 @@ +%{ +#include <X11/Xlib.h> +#include <X11/Xresource.h> +#include <stdio.h> +#include <X11/IntrinsicP.h> +#include <X11/cursorfont.h> +#include <X11/StringDefs.h> + +#include <X11/Xmu/Misc.h> +#include <X11/Xmu/Converters.h> +#include "LayoutP.h" + +static LayoutPtr *dest; + +%} + +%union { + int ival; + XrmQuark qval; + BoxPtr bval; + BoxParamsPtr pval; + GlueRec gval; + LayoutDirection lval; + ExprPtr eval; + Operator oval; +} + +%type <bval> box boxes compositebox +%type <pval> bothparams oneparams +%type <gval> glue opStretch opShrink +%type <lval> orientation +%type <eval> signedExpr simpleExpr expr + +%token OC CC OA CA OP CP +%token <qval> NAME +%token <ival> NUMBER +%token <ival> INFINITY +%token VERTICAL HORIZONTAL + +%token EQUAL DOLLAR + +%left <oval> PLUS MINUS +%left <oval> TIMES DIVIDE PERCENTOF +%right <oval> PERCENT +%nonassoc WIDTH HEIGHT +%right <oval> UMINUS UPLUS + +%% +layout : compositebox + { *dest = $1; } + ; +box : NAME bothparams + { + BoxPtr box = New(LBoxRec); + box->nextSibling = 0; + box->type = WidgetBox; + box->params = *$2; + Dispose ($2); + box->u.widget.quark = $1; + $$ = box; + } + | signedExpr oneparams + { + BoxPtr box = New(LBoxRec); + box->nextSibling = 0; + box->type = GlueBox; + box->params = *$2; + Dispose ($2); + box->u.glue.expr = $1; + $$ = box; + } + | NAME EQUAL signedExpr + { + BoxPtr box = New(LBoxRec); + box->nextSibling = 0; + box->type = VariableBox; + box->u.variable.quark = $1; + box->u.variable.expr = $3; + $$ = box; + } + | compositebox + { + $$ = $1; + } + ; +compositebox : orientation OC boxes CC + { + BoxPtr box = New(LBoxRec); + BoxPtr child; + + box->nextSibling = 0; + box->parent = 0; + box->type = BoxBox; + box->u.box.dir = $1; + box->u.box.firstChild = $3; + for (child = $3; child; child = child->nextSibling) + { + if (child->type == GlueBox) + { + child->params.stretch[!$1].expr = 0; + child->params.shrink[!$1].expr = 0; + child->params.stretch[!$1].order = 100000; + child->params.shrink[!$1].order = 100000; + child->params.stretch[!$1].value = 1; + child->params.shrink[!$1].value = 1; + } + child->parent = box; + } + $$ = box; + } + ; +boxes : box boxes + { + $1->nextSibling = $2; + $$ = $1; + } + | box + { $$ = $1; } + ; +bothparams : OA opStretch opShrink TIMES opStretch opShrink CA + { + BoxParamsPtr p = New(BoxParamsRec); + + p->stretch[LayoutHorizontal] = $2; + p->shrink[LayoutHorizontal] = $3; + p->stretch[LayoutVertical] = $5; + p->shrink[LayoutVertical] = $6; + $$ = p; + } + | + { + BoxParamsPtr p = New(BoxParamsRec); + + ZeroGlue (p->stretch[LayoutHorizontal]); + ZeroGlue (p->shrink[LayoutHorizontal]); + ZeroGlue (p->stretch[LayoutVertical]); + ZeroGlue (p->shrink[LayoutVertical]); + $$ = p; + } + ; +oneparams : OA opStretch opShrink CA + { + BoxParamsPtr p = New(BoxParamsRec); + + p->stretch[LayoutHorizontal] = $2; + p->shrink[LayoutHorizontal] = $3; + p->stretch[LayoutVertical] = $2; + p->shrink[LayoutVertical] = $3; + $$ = p; + } + | + { + BoxParamsPtr p = New(BoxParamsRec); + + ZeroGlue (p->stretch[LayoutHorizontal]); + ZeroGlue (p->shrink[LayoutHorizontal]); + ZeroGlue (p->stretch[LayoutVertical]); + ZeroGlue (p->shrink[LayoutVertical]); + $$ = p; + } + ; +opStretch : PLUS glue + { $$ = $2; } + | + { ZeroGlue ($$); } + ; +opShrink : MINUS glue + { $$ = $2; } + | + { ZeroGlue ($$); } + ; +glue : simpleExpr INFINITY + { $$.order = $2; $$.expr = $1; } + | simpleExpr + { $$.order = 0; $$.expr = $1; } + | INFINITY + { $$.order = $1; $$.expr = 0; $$.value = 1; } + ; +signedExpr : MINUS simpleExpr %prec UMINUS + { + $$ = New(ExprRec); + $$->type = Unary; + $$->u.unary.op = $1; + $$->u.unary.down = $2; + } + | PLUS simpleExpr %prec UPLUS + { $$ = $2; } + | simpleExpr + ; +simpleExpr : WIDTH NAME + { $$ = New(ExprRec); + $$->type = Width; + $$->u.width = $2; + } + | HEIGHT NAME + { $$ = New(ExprRec); + $$->type = Height; + $$->u.height = $2; + } + | OP expr CP + { $$ = $2; } + | simpleExpr PERCENT + { + $$ = New(ExprRec); + $$->type = Unary; + $$->u.unary.op = $2; + $$->u.unary.down = $1; + } + | NUMBER + { $$ = New(ExprRec); + $$->type = Constant; + $$->u.constant = $1; + } + | DOLLAR NAME + { $$ = New(ExprRec); + $$->type = Variable; + $$->u.variable = $2; + } + ; +expr : expr PLUS expr + { binary: ; + $$ = New(ExprRec); + $$->type = Binary; + $$->u.binary.op = $2; + $$->u.binary.left = $1; + $$->u.binary.right = $3; + } + | expr MINUS expr + { goto binary; } + | expr TIMES expr + { goto binary; } + | expr DIVIDE expr + { goto binary; } + | expr PERCENTOF expr + { goto binary; } + | MINUS expr %prec UMINUS + { unary: ; + $$ = New(ExprRec); + $$->type = Unary; + $$->u.unary.op = $1; + $$->u.unary.down = $2; + } + | PLUS expr %prec UPLUS + { $$ = $2; } + | simpleExpr + ; +orientation : VERTICAL + { $$ = LayoutVertical; } + | HORIZONTAL + { $$ = LayoutHorizontal; } + ; +%% + +int yywrap () +{ + return 1; +} + +void yysetdest (c) + LayoutPtr *c; +{ + dest = c; +} diff --git a/vendor/x11iraf/xaw3d/laylex.l b/vendor/x11iraf/xaw3d/laylex.l new file mode 100644 index 00000000..3ed20264 --- /dev/null +++ b/vendor/x11iraf/xaw3d/laylex.l @@ -0,0 +1,127 @@ + +%{ +#ifndef FLEX_SCANNER +#undef input +#undef unput +#endif + +#include <X11/Xlib.h> +#include <X11/Xresource.h> +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> + +#include "LayoutP.h" +#include "laygram.h" +static char *yysourcebase, *yysource; + +#ifndef FLEX_SCANNER +#define input() (*yysource++) +#define unput(c) (--yysource) +#else +#include <string.h> +static void my_yyinput(char *buf, int *result, int max_size); +#define YY_INPUT(buf, res, max) my_yyinput(buf, &(res), max) +#endif + + +static int count (); + +%} +%% +vertical return VERTICAL; +horizontal return HORIZONTAL; +"{" return OC; +"}" return CC; +"(" return OP; +")" return CP; +"<" return OA; +">" return CA; +infinity { yylval.ival = 1; return INFINITY; } +inff* { yylval.ival = count(yytext, 'f'); return INFINITY; } +[0-9][0-9]* { yylval.ival = atoi(yytext); return NUMBER; } +"=" { return EQUAL; } +"$" { return DOLLAR; } +"+" { yylval.oval = Plus; return PLUS; } +"-" { yylval.oval = Minus; return MINUS; } +"*" { yylval.oval = Times; return TIMES; } +"/" { yylval.oval = Divide; return DIVIDE; } +"%" { yylval.oval = Percent; return PERCENT; } +%[ \t\n]*of { yylval.oval = Percent; return PERCENTOF; } +width return WIDTH; +height return HEIGHT; +\\[a-zA-Z_][a-zA-Z0-9_]* { +#ifdef FLEX_SCANNER + yytext[yyleng] = '\0'; +#else + yytext[yyleng-1] = '\0'; +#endif + yylval.qval = XrmStringToQuark (yytext+1); + return NAME; + } + +[a-zA-Z_][a-zA-Z0-9_]* { +#ifdef FLEX_SCANNER + yytext[yyleng] = '\0'; +#else + yytext[yyleng-1] = '\0'; +#endif + yylval.qval = XrmStringToQuark (yytext); + return NAME; + } +" " ; +"\t" ; +"\n" ; +. fprintf (stderr, "ignoring %c\n", *yytext); +%% + +static int +count (s, c) + char *s; + char c; +{ + int i = 0; + while (*s) + if (*s++ == c) + i++; + return i; +} + +yysetsource(s) + char *s; +{ + yysourcebase = yysource = s; +} + +yyerror(s) + char *s; +{ + char *t; + + fprintf (stderr, "%s\n", s); + t = yysource - 50; + if (t < yysourcebase) + t = yysourcebase; + while (*t && t < yysource + 50) { + if (t == yysource) + putc ('@', stderr); + putc (*t++, stderr); + } + if (t == yysource) + putc ('@', stderr); + if (!*t) + fprintf (stderr, "<EOF>"); + fprintf (stderr, "\n"); +} + +#ifdef FLEX_SCANNER +static void +my_yyinput(buf, result, max_size) + char *buf; int *result; int max_size; +{ + int size = max_size < strlen(yysource) ? max_size : strlen(yysource); + + strncpy(buf, yysource, size); + yysource += size; + *result = size; +} +#endif diff --git a/vendor/x11iraf/xaw3d/sharedlib.c b/vendor/x11iraf/xaw3d/sharedlib.c new file mode 100644 index 00000000..254bd52c --- /dev/null +++ b/vendor/x11iraf/xaw3d/sharedlib.c @@ -0,0 +1,179 @@ +/* $XConsortium: sharedlib.c,v 1.6 94/04/17 20:13:34 kaleb Exp $ */ +/* + +Copyright (c) 1991, 1994 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#if defined(SUNSHLIB) && !defined(SHAREDCODE) + +#include <X11/IntrinsicP.h> +#include <X11/Xaw3d/AsciiSinkP.h> +#include <X11/Xaw3d/AsciiSrcP.h> +#include <X11/Xaw3d/AsciiTextP.h> +#include <X11/Xaw3d/MultiSinkP.h> +#include <X11/Xaw3d/MultiSrcP.h> +#include <X11/Xaw3d/BoxP.h> +#include <X11/Xaw3d/CommandP.h> +#include <X11/Xaw3d/DialogP.h> +#include <X11/Xaw3d/FormP.h> +#include <X11/Xaw3d/GripP.h> +#include <X11/Xaw3d/LabelP.h> +#include <X11/Xaw3d/ListP.h> +#include <X11/Xaw3d/MenuButtoP.h> +#include <X11/Xaw3d/PanedP.h> +#include <X11/Xaw3d/PannerP.h> +#include <X11/Xaw3d/PortholeP.h> +#include <X11/Xaw3d/RepeaterP.h> +#include <X11/Xaw3d/ScrollbarP.h> +#include <X11/Xaw3d/SimpleP.h> +#include <X11/Xaw3d/SimpleMenP.h> +#include <X11/Xaw3d/SmeP.h> +#include <X11/Xaw3d/SmeThreeDP.h> +#include <X11/Xaw3d/SmeBSBP.h> +#include <X11/Xaw3d/SmeLineP.h> +#include <X11/Xaw3d/StripCharP.h> +#include <X11/Xaw3d/TextP.h> +#include <X11/Xaw3d/TextSinkP.h> +#include <X11/Xaw3d/TextSrcP.h> +#include <X11/Xaw3d/ThreeDP.h> +#include <X11/Xaw3d/ToggleP.h> +#include <X11/Xaw3d/TreeP.h> +#include <X11/VendorP.h> +#include <X11/Xaw3d/ViewportP.h> + +extern AsciiSinkClassRec asciiSinkClassRec; +WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec; + +extern AsciiSrcClassRec asciiSrcClassRec; +WidgetClass asciiSrcObjectClass = (WidgetClass)&asciiSrcClassRec; + +extern AsciiTextClassRec asciiTextClassRec; +WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec; + +#ifdef ASCII_STRING +extern AsciiStringClassRec asciiStringClassRec; +WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec; +#endif + +#ifdef ASCII_DISK +extern AsciiDiskClassRec asciiDiskClassRec; +WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec; +#endif + +extern MultiSinkClassRec multiSinkClassRec; +WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec; + +extern MultiSrcClassRec multiSrcClassRec; +WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec; + +extern BoxClassRec boxClassRec; +WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec; + +extern CommandClassRec commandClassRec; +WidgetClass commandWidgetClass = (WidgetClass) &commandClassRec; + +extern DialogClassRec dialogClassRec; +WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec; + +extern FormClassRec formClassRec; +WidgetClass formWidgetClass = (WidgetClass)&formClassRec; + +extern GripClassRec gripClassRec; +WidgetClass gripWidgetClass = (WidgetClass) &gripClassRec; + +extern LabelClassRec labelClassRec; +WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec; + +extern ListClassRec listClassRec; +WidgetClass listWidgetClass = (WidgetClass)&listClassRec; + +extern MenuButtonClassRec menuButtonClassRec; +WidgetClass menuButtonWidgetClass = (WidgetClass) &menuButtonClassRec; + +extern PanedClassRec panedClassRec; +WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec; +WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec; + +extern PannerClassRec pannerClassRec; +WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec; + +extern PortholeClassRec portholeClassRec; +WidgetClass portholeWidgetClass = (WidgetClass) &portholeClassRec; + +extern RepeaterClassRec repeaterClassRec; +WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec; + +extern ScrollbarClassRec scrollbarClassRec; +WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec; + +extern SimpleClassRec simpleClassRec; +WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; + +extern SimpleMenuClassRec simpleMenuClassRec; +WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec; + +extern SmeClassRec smeClassRec; +WidgetClass smeObjectClass = (WidgetClass) &smeClassRec; + +extern smeThreeDClassRec smeThreeDClassRec; +WidgetClass smeThreeDObjectClass = (WidgetClass) &smeThreeDClassRec; + +WidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec; + +extern SmeLineClassRec smeLineClassRec; +WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec; + +extern StripChartClassRec stripChartClassRec; +WidgetClass stripChartWidgetClass = (WidgetClass) &stripChartClassRec; + +extern TextClassRec textClassRec; +WidgetClass textWidgetClass = (WidgetClass)&textClassRec; + +unsigned long FMT8BIT = 0L; +unsigned long XawFmt8Bit = 0L; +unsigned long XawFmtWide = 0L; + +extern TextSinkClassRec textSinkClassRec; +WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec; + +extern TextSrcClassRec textSrcClassRec; +WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec; + +extern ThreeDClassRec threeDClassRec; +WidgetClass threeDClass = (WidgetClass)&threeDClassRec; + +extern ToggleClassRec toggleClassRec; +WidgetClass toggleWidgetClass = (WidgetClass) &toggleClassRec; + +extern TreeClassRec treeClassRec; +WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec; + +extern VendorShellClassRec vendorShellClassRec; +WidgetClass vendorShellWidgetClass = (WidgetClass) &vendorShellClassRec; + +extern ViewportClassRec viewportClassRec; +WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec; + +#endif /* SUNSHLIB */ diff --git a/vendor/x11iraf/xgterm/.gdb_history b/vendor/x11iraf/xgterm/.gdb_history new file mode 100644 index 00000000..89d38562 --- /dev/null +++ b/vendor/x11iraf/xgterm/.gdb_history @@ -0,0 +1,93 @@ +run +quit +run +where +quit +b get_pty +run +c +quit +b pty_search +b get_pty +b init_ttyio +run +where +quit +b get_pty +b init_ttyio +run -display denali:0.0 +p pty +s +quit +b Panic +run +s +s +s +s +p fd +quit +b main +run +s +p ptydev +s +p xgterm_name +s +quit +b get_pty +b main +b get_pty +run +quit +b main +run +s +p toplevel +p *toplevel +s +p app_con +p *app_con +s +p app_con +p *app_con +s +where +s +quit +run +where +quit +b consolepr +run +helop +help +help running +set follow-fork-mode +set follow-fork-mode child +run +logo +quit +b strerror +run +where +quit +b get_pty +run +quit +b strerror +run +where +quit +run +cd +p w +where +up +p w +p w->gterm.cmapName +where +down +p w +p w->gterm.cmapName +quit diff --git a/vendor/x11iraf/xgterm/.pure b/vendor/x11iraf/xgterm/.pure new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/xgterm/Imakefile b/vendor/x11iraf/xgterm/Imakefile new file mode 100644 index 00000000..ec3309e3 --- /dev/null +++ b/vendor/x11iraf/xgterm/Imakefile @@ -0,0 +1,154 @@ +XCOMM $XConsortium: Imakefile,v 1.56 92/03/11 17:35:22 gildea Exp $ +XCOMM +XCOMM Attention xgterm porters +XCOMM +XCOMM +XCOMM Xgterm assumes that bcopy can handle overlapping arguments. If your +XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in +XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. +XCOMM + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + +/* + * add -DWTMP and -DLASTLOG if you want them; make sure that bcopy can + * handle overlapping copies before using it. + */ +#ifdef SetTtyGroup /* turn on in config/machine.cf */ + TTYGROUPDEF = -DUSE_TTY_GROUP + TTYGROUPDEF = +#endif +#ifdef UsePUCCPtyd /* turn on in config/site.def */ + PUCCPTYDDEF = -DPUCC_PTYD /* does not need to be setuid */ + PTYLIB = -lpucc +#endif + +/* Hack to build on NOAO HP systems where the Xmu and Xaw libs had to be added + * specially to the system they don't come with the default X11 development + * system. This also avoids the binary requiring the shared lib version on + * systems which may not have it. + */ +#if defined(HPArchitecture) && OSMajorVersion >= 10 + XMULIB = /usr/lib/X11R6/libXmu.a + XAWLIB = /usr/lib/X11R6/libXaw.a +#endif + + + OSMAJORVERSION = OSMajorVersion + OSMINORVERSION = OSMinorVersion + + CDEBUGFLAGS = -g + XAWLIB = LibXaw3d + DEPXAWLIB = DepLibXaw3d + X11IRAFDIR = ../ + + MAIN_DEFINES = -DUTMP $(TTYGROUPDEF) $(PUCCPTYDDEF) \ + -DOSMAJORVERSION=$(OSMAJORVERSION) \ + -DOSMINORVERSION=$(OSMINORVERSION) + MISC_DEFINES = /* -DALLOWLOGFILEEXEC */ + EXTRA_DEFINES = -DALLOWLOGGING + LOCAL_LDFLAGS = -L../lib + EXTRA_INCLUDES = -I../include + DEPENDFLAGS = -I../include -I../include/ObmW + + SRCS1 = button.c charproc.c cursor.c data.c gtermio.c input.c \ + main.c menu.c misc.c screen.c scrollbar.c tabs.c \ + util.c VTPrsTbl.c + OBJS1 = main.o input.o charproc.o cursor.o util.o tabs.o \ + screen.o scrollbar.o button.o misc.o \ + VTPrsTbl.o data.o menu.o gtermio.o + SRCS2 = resize.c + OBJS2 = resize.o + SRCS = $(SRCS1) $(SRCS2) + OBJS = $(OBJS1) $(OBJS2) + DEPOBM = DepLibObm DepLibXpm DepLibXaw3d + + PROGRAMS = resize xgterm + DEPLIBS1 = XawClientDepLibs $(DEPOBM) + DEPLIBS2 = + PROGRAMS = xgterm resize + +#ifndef TermcapLibrary +#if SystemV && !defined(MacIIArchitecture) +#if defined(CrayArchitecture) || defined(RsArchitecture) +#define TermcapLibrary -lcurses /* special cases of System V */ +#else +#define TermcapLibrary -ltermlib /* usually in here */ +#endif +#else +#define TermcapLibrary -ltermcap /* bsd puts it here */ +#endif +#endif + + + TERMCAPLIB = TermcapLibrary + OBMLIBS = -lobm -lXpm + MATHLIB = -lm + +AllTarget($(PROGRAMS)) + +SpecialObjectRule(main.o,NullParameter,$(MAIN_DEFINES)) +SpecialObjectRule(misc.o,NullParameter,$(MISC_DEFINES)) +SpecialObjectRule(charproc.o,NullParameter,$(MISC_DEFINES)) + +main.o: ../version.h + +#if InstallXgtermSetUID +SetUIDProgramTarget(xgterm,$(OBJS1),$(DEPLIBS1),$(OBMLIBS) XawClientLibs,$(TERMCAPLIB) $(PTYLIB) $(MATHLIB)) +#else +NormalProgramTarget(xgterm,$(OBJS1),$(DEPLIBS1),$(OBMLIBS) XawClientLibs,$(TERMCAPLIB) $(PTYLIB) $(MATHLIB)) +#endif + + +#if InstallBinaries +#if InstallXgtermSetUID && defined(SunArchitecture) && HasSharedLibraries +#if AlternateUsrLibDir +#if OSMajorVersion > 4 || (OSMajorVersion == 4 && OSMinorVersion >= 1) +LDOVERRIDE = -L$(DESTDIR)$(USRLIBDIR) +#else +#if HasGcc +LDOVERRIDE = -static -L$(DESTDIR)$(USRLIBDIR) +#else +LDOVERRIDE = -Bstatic -L$(DESTDIR)$(USRLIBDIR) +LDRESUME = -Bdynamic +#endif +#endif +#endif +install:: xgterm + MakeDir(X11irafBinDir) + $(CP) xgterm X11irafBinDir + chmod 4755 X11irafBinDir/xgterm +#else +#if InstallXgtermSetUID +install:: xgterm + MakeDir(X11irafBinDir) + $(CP) xgterm X11irafBinDir + chmod 4755 X11irafBinDir/xgterm +#else +install:: xgterm + MakeDir(X11irafBinDir) + $(CP) xgterm X11irafBinDir +#endif +#endif + +NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB)) +install:: resize + MakeDir(X11irafBinDir) + $(CP) resize X11irafBinDir +#endif + +#if InstallAppdefs +install:: XGterm.ad + MakeDir(X11irafAppDir) + cp XGterm.ad X11irafAppDir/XGterm +#endif + +#if InstallManuals +install:: + MakeDir(X11irafManDir) + $(CP) xgterm.man X11irafManDir/xgterm.1 + $(CP) resize.man X11irafManDir/resize.1 +#endif + +DependTarget() diff --git a/vendor/x11iraf/xgterm/NOTES b/vendor/x11iraf/xgterm/NOTES new file mode 100644 index 00000000..f14fa19d --- /dev/null +++ b/vendor/x11iraf/xgterm/NOTES @@ -0,0 +1,959 @@ +xgterm.NOTES -- Some random design notes made while writing this code. Not +intended to be useful to anyone reading this code. + + +To do: + Object manager + add bitmap support + add event handling support + Gterm widget + add cell array + pixrect operations? + minor odds and ends + Gtermio + modify to use object manager + add messaging capability + GIO + add messaging capability + modify cell array support as needed + + +Pixmaps + cache by name + new entry replaces old + entries are never freed unless overwritten + for lookup, check cache first then look for file (normal resource + translation) + + typical bitmap: + + #define opendot_width 16 + #define opendot_height 16 + #define opendot_x_hot 7 + #define opendot_y_hot 7 + static char opendot_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01, + 0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; + + types of bitmaps - bitmap, pixmap, cursor + + createBitmap name width height data + createPixmap name width height depth fg_color bg_color data + createCursor name source mask fg_color bg_color x_hot y_hot + + +Event handling + + addEventHandler <procname> <event-mask> [<event-mask>...] + userEventHandler {widget event-type time wx wy rx ry other} + where "other" is a event-specific list of fields + +Event structs + + event masks, event names are numerous + most events have these fields: + type, time, x_win, y_win, x_root, y_root other + other fields: + key: state (key or button mask), keycode + button: state (key or button mask), button code + motion: state (key or button mask), is_hint + crossing: mode (normal, grab, ungrab) + focus: mode (normal, grab, ungrab) + visibility: state + error: error_code, request_code, minor_code + + keycode|button|mode|state + +Event masks + + Button1MotionMask + Button2MotionMask + Button3MotionMask + Button4MotionMask + Button5MotionMask + ButtonMotionMask + ButtonPressMask + ButtonReleaseMask + ColormapChangeMask + EnterWindowMask + ExposureMask + FocusChangeMask + KeyPressMask + KeyReleaseMask + KeymapStateMask + LeaveWindowMask + NoEventMask + OwnerGrabButtonMask + PointerMotionHintMask + PointerMotionMask + PropertyChangeMask + ResizeRedirectMask + StructureNotifyMask + SubstructureNotifyMask + SubstructureRedirectMask + VisibilityChangeMask + +Event names + + ButtonPress + ButtonRelease + CirculateNotify + CirculateRequest + ClientMessage + ColormapNotify + ConfigureNotify + ConfigureRequest + CreateNotify + DestroyNotify + EnterNotify + Expose + FocusIn + FocusOut + GraphicsExpose + GravityNotify + KeyPress + KeyRelease + KeymapNotify + LeaveNotify + MapNotify + MapRequest + MappingNotify + MotionNotify + NoExpose + PropertyNotify + ReparentNotify + ResizeRequest + SelectionClear + SelectionNotify + SelectionRequest + UnmapNotify + VisibilityNotify + + +GTERM CELL ARRAY + + Colormap + use pseudocolor visual if possible + a fixed number of well defined sharable, read-only cells + a variable number of private read-write cells + the private cells are allocated at runtime when the + application allocates a colormap + the graphcap entry specifies the maximum number of private + colormap cells that can be allocated + a private colormap is used if the requested cells cannot + be allocated + there is only one colormap per gterm widget (if there are + multiple cell arrays they share the same colormap) + + Cell arrays (obsolete term?) + A cell array is mapping of an MxN array of 8 bit pixel values + to a region of the screen. + The pixel values in a cell array range from 0 to NC, and are + contiguous in that range. NC is the number of colors in + the gterm colormap. The first few values starting at 0 + are statically allocated and cell array pixels will + normally start at the first dynamically allocated value. + The cell array mapping defines the transformation used to paint + a region of the Gterm window from the cell array pixels. + Scaling and axis flipping are possible. + Cell arrays are defined and written to in separate steps. A + given write operation may modify only part of the MxN pixels + of the cell array. + + New operations + write colormap Writes N cells of the gterm colormap starting + at a given pixel value. + + define cell array Define transformation for cell array N. + Several cell arrays may be active. + + write cell array Write to a subregion of a cell array (operates + in cell array pixels, not screen pixels). + + Arbitrary regions of the colormap or a cell array may be + modified, allowing for very interactive operations. + + Binary pixel values must be encoded for transmission between the + client and server. The simplest encoding adds 040 to the value + of each pixel (byte), resulting in a printable byte stream. + Control codes may be used for compression schemes. + + Alternative scheme + Store cell array in off screen buffer. This is the same as + above except that in the above scheme the pixels are not + saved. + Modifying any pixel data, or editing the mapping causes the + affected region of the screen to be rewritten. + The advantage of this approach is that operations such as zoom + and pan can be implemented merely by modifying the mapping. + Given multiple cell arrays, one can also do blink, split + screen, etc. + Perhaps mappings should be separate from cell arrays. The + same array may be mapped to more than one region of the + screen, or a mapping may map portions of more than one + array. + Fundamental items are pixel array, mapping, colormap + + Pixmap operations + Create host or display pixmap + Destroy pixmap (or all such pixmaps) + Copy data to/from pixmap and screen + Read a file into a pixmap or series of pixmaps + Append pixmap to a file + + Should be combined with Obm capabilities for creating and + referencing pixmaps. + + Pixmap operations can be used for a number of purposes, + including movie making. + +Imaging Procedures + + Images (rasters) are implemented internally in Gterm using either + ximages or off screen pixmaps. Which format is used is decided at + raster create time and is controlled by a Gterm resource. This is + transparent to the client application. Currently only 8 bit rasters + are supported. + + GtRasterInit (gt) + GtAssignRaster (gt, raster, drawable) + GtCreateRaster (gt, raster, type, width, height) + GtDestroyRaster (gt, raster) + exists = GtQueryRaster (gt, raster, &width, &height) + n = GtNRasters (gt) + + GtWritePixels (gt, raster, pixels, x1, y1, nx, ny) + GtReadPixels (gt, raster, pixels, x1, y1, nx, ny) + pixmap = GtCreatePixmap (gt, src, x, y, width, height) + GtCopyPixmap (gt, pixmap, dst, x, y, width, height) + + GtWriteColormap (gt, first, nelem, r, g, b) + GtReadColormap (gt, first, nelem, r, g, b) + + GtInitMappings (gt) + GtCopyRaster (gt, rop, src,sx,sy,snx,sny, dst,dx,dy,dnx,dny) + GtSetMapping (gt, mapping, src,sx,sy,snx,sny, dst,dx,dy,dnx,dny) + GtGetMapping (gt, mapping, src,sx,sy,snx,sny, dst,dx,dy,dnx,dny) + GtEnableMapping (gt, mapping, enable) + GtRefreshMapping (gt, mapping) + + For the widget class we can also have commands to operate upon + pixmaps created by or written into a gterm widget. + + createPixmap name src [x y width height] + copyPixmap name dst [x y width height] + destroyPixmap name + + There should also be commands to delete pixmaps, write pixmaps to + files, and read pixmaps from files. + + The imaging routines operate in window or pixmap pixels. If a + window is resized, any mappings referencing the window are modified + to reflect the change in size. A query-size function is required + to pass the window size in pixels back to the client. A set-size + (resize window) procedure is also desirable to allow the client to + attempt to set the window to the optimum size for an image. + + The client uses a special library of procedures for imaging. These + use GIO escapes to communicate with the stdgraph kernel. The + stdgraph kernel uses special ESC codes to communicate with the + server. + + Applications which do only simple imaging will use GIO calls to + put a cell array and assign colors, using NDC coordinates for the + cell array mapping. More demanding applications that must operate + in pixel space, operate directly on image buffers, etc., will use + the GIO escapes directly. The stdgraph kernel will keep track of + the window size and perform NDC to pixel space conversions for the + put cell array call. + + +Implementation + + Code structure + + client + gio + gim + gki_escape + | (--IPC--) + stdgraph kernel + serial encoding + | (--IPC--) + gtermio + obm + gterm widget + + + Simple graphics applications use the high level GIO routines for + imaging. These include put/get cell array and put/get colors, with + gset being used to select colors for drawing. + + A small library of routines are used in client programs that have + more demanding imaging requirements. These are implemented using + GIO escapes and operate in pixel space, providing direct access to + the gterm imaging functions. + + The GIO escapes are processed by the stdgraph kernel. This uses ASCII + escape sequences defined in graphcap to communicate with the server. + The GIO escape codes are defined in lib$gescape.h. + + The gtermio code in Xgterm processes these escape sequences and + converts them into calls to the imaging routines in the gterm widget. + + The object manager also provides routines for calling the gterm + imaging routines from within UI code. + + The actual Xlib based imaging code is in the gterm widget. + + +Complications + + Cursor mode - wants to buffer all GKI instructions, including the + GIM escapes, some of which are voluminous. If any interactive image + editing, redrawing, etc. is done without initializing things, this + could be a lot of data. Would like cursor mode to work in the sense + that one can redraw the screen, zoom and pan. + + Cursor readback - for a cursor read within a mapped region of the + screen, the logical thing is to return raster coordinates rather + than Tek window coordinates. The server should make the mapping + transparent, so that the client gets raster coordinates regardless + of the image offset, scale, any axis flip, and so on. + + Cursor mode strategy - all GIM escapes issued by the client are + executed, but only setmapping instructions are buffered. During a + cursor mode redraw the setmapping instructions are edited to reflect + the cursor mode zoom/pan (this should be done by a GIM routine), and + retransimitted to the server at the time that they are encountered + in the display list. In most cases this will result in the image + data being redrawn at the appropriate time, e.g. after a frame draw + and area clear, and before any overlaid graphics is drawn. + + This requires that the server not initialize the imaging system on + every frame clear (probably the imaging subsystem should be + initialized when the cursor mode frame buffer is cleared, rather + than when the server screen is cleared). The space required to + buffer setmapping instructions is mimimal. A disadvantage is that + :.write/read will not save or redisplay image data. The major + advantage is that this provides full cursor mode zoom/pan capability + and is time and space efficient. + + To encapsulate manipulation of the GIM escapes in the cursor mode + code, a GIM (stdgraph kernel) routine should be called when a GIM + escape is executed to edit the instruction, if any, left behind in + the cursor mode buffer. This routine will have access to the + cursor mode frame buffer and will edit it as necessary, e.g. + deleting the instruction, replacing it, or editing earlier GIM + escapes in the same frame buffer. + + Cursor readback strategy - to solve this problem it appears to be + necessary to have the server pass back the "cursor number" in a + cursor read. When a cursor read occurs there is no way the client + can predict which cursor will be read; the server selects the cursor + depending upon the pointer location. The cursor number is the Tek + cursor, a raster cursor, or a region of a window. The WCS number + in the cursor value struct passed back to the client indicates + which cursor was read. + + +Timings + + Time to copy 631296 byte text file through a tty/pty + + lepus 8-9sec 70 Kb/sec + tucana 2sec 300 Kb/sec + + +Cursor Handling + + The general scheme is that when the cursor is read, the server + determines which raster the cursor is in and returns pixel + coordinates relative to this raster, regardless of how the raster is + mapped to the screen. The return cursor value includes the raster + number, pixel X and Y coordinates, and the keystroke (keycode) which + terminated the cursor read. + + Since the Tek cursor value struct does not provide adequate + resolution or any provision for the raster number, a custom cursor + return value is required. gtermio will continue to support a Tek + cursor, using a special escape to initiate a custom cursor read. + + gki_retcursor needs to be modified to provide more coordinate + resolution and to allow the "cursor" (raster) number to be returned. + + In cursor mode, WCS selection will use the CN/raster number instead + of screen position to determine the WCS to be used. A WCS maps a + range of world coordinates (e.g. image pixel coordinates) to a + viewport in NDC space. + + +Current cursor mechanism + + ESC SUB - initiate standard Tek cursor read + user types key to terminate graphics input mode + + server returns cursor value encoded as + key + hix; lox + hiy; loy + trailer1; trailer2 + x, y are encoded in Tek screen coordinates, 0-1023,0-779 + + gki_getcursor (fd, x, y, key, cursor) + stg_getcursor (cursor number) + call stg_readcursor to read cursor + returns GKI cursor value struct + cursor number, x, y, key + + stg_readcursor (cursor, x, y, key) + stg_rdcursor (tty, cursor, x, y, key, output_rc) + set raw mode + getc until pattern is matched + clear raw mode + stg_encode to decode cursor value + return x, y, key + + rcursor (fd, curval, maxch) + grc_cursor (rc, stream, x, y, key, ppos) (screen) + gtr_readcursor (stream, x, y, key) (screen) + gki_getcursor (fd, mx, my, key, 0) (GKI) + grc_scrtowcs (stream, x, y, xc, yc, wcs) (WCS) + grc_scrtondc (sx, sy, mx, my) (NDC) + wcs = grc_selectwcs (tr, mx, my) + grc_settran (w, ct) + grc_ndctowcs (ct, mx, my, wx, wy) (WCS) + format and return cursor value as a string (WCS) + + screen coordinates - workstation screen/window + NDC coordinates - normalized screen coordinates (no zoom) + WCS coordinates - world coordinates in active WCS + + WCS - max 16 per screen + wx1,wx2,wy1,wy2 range of world coordinates + sx1,sx2,sy1,sy2 viewport, NDC coordinates + xtran, ytran type of transformation in each axis + clip flag to clip at viewport boundary + + WSTRAN - cursor mode ndc-to-screen + vx1,vx2,vy1,vy2 range of NDC coordinates + mx1,mx1,my1,my2 range of GKI coordinates + + +Cursor mechanism with rasters + + The key concept underlying this scheme is that GKI (NDC) coordinates + refer to the "raster" the cursor is in, rather than to the screen, + hence are independent of the raster-to-screen mapping. One + logically draws into a raster, and any mappings defined on the + raster take care of rendering the graphics on the screen. A cursor + read returns both screen coordinates, used for cursor mode zoom/pan, + and image raster GKI/NDC coordinates. A special case is raster 0, + the screen (actually the drawing window), which is what GKI/NDC + coordinates always referred to in the past. When drawing into + raster 0 one is drawing directly to the screen. When drawing into a + raster, one is still drawing to the screen, but via any mapping or + mappings defined on the raster. + + Each raster has zero or more WCS associated with it. The WCS + associated with the raster defines a mapping between some world + coordinate system, e.g., image pixel coordinates, and NDC or + normalized raster coordinates. To get from world coordinates to + pixels on the screen, one converts from world coordinates to NDC + coordinates via the WCS, then from NDC coordinates to raster pixels, + then from raster pixels to screen pixels via the mapping. To be + more precise, the full transformation is as follows: + + GIO in the client: + world -> NDC + NDC -> GKI (clipped at viewport) + + Cursor mode in the CL: + GKI to "screen" (zoomed/clipped-GKI) coordinates + zoomed-GKI to Tek coordinates for serial protocol + + Gtermio code in the server: + Tek coordinates to raster pixel coordinates for current + drawing raster + + Gterm widget code: + raster pixel coordinates to screen pixel coordinates + via a mapping defined on the raster + repeat for each mapping defined on the raster + + Graphics drawing for raster overlays requires that the server treat + the input Tek encoded coordinates (1024x780) as normalized for the + current raster. If the raster number is zero the normal drawing + operation (into the display window) takes place. If the raster + number is nonzero any mappings defined on the referenced raster + define where the graphics is drawn on the screen. If a mapping is + disabled no drawing takes place. Graphics are automatically clipped + at the boundary of the destination rect defined by a mapping. + + In a cursor read operation, the server determines which raster if + any is mapped to the region of the screen the cursor is in. Both + screen (raster 0) and raster coordinates are returned using a + special cursor value struct. The cursor value return by RCURSOR + (hence =gcur and clgcur) returns the world coordinates defined by + the selected WCS for the current raster. If no WCS is defined NDC + coordinates are returned. If multiple WCS are defined for a raster + cursor mode selects the "nearest" viewport as it has always done + for screen coordinates. + + About the only alternative to the above scheme is to have the server + return raster pixel coordinates. The problem with this is that this + is inconsistent with the GIO graphics model, and the WCS cannot be + used to return world coordinates, or to draw graphics overlays. + + A complication with this scheme is that normally WCS 1 is used for + the screen (raster 0). Sometimes more than one WCS is used. Hence + to make a strict association between WCS number and raster number + would require that raster numbers be allocated accordingly in the + client. Also it is not clear what happens if there is more than one + WCS defined for a raster. To get around this problem a way is + needed to define which raster a WCS refers to. This can be done + without a (significant) protocol change by encoding the frame number + in the existing, little used WCS_CLIP field of the existing WCS + structure. + + +Colormap Sharing + + A gterm resource selects type of colormap: default, private, shared + default means default screen colormap, shared by all apps + private means colormap is used only by this gterm instance + shared means non-default colormap shared by multiple gterms + + In the case of the default colormap, read-only or read-write cells + are allocated out of the screen default colormap. This guarantees + that the colors of non-gterm windows will not be affected when gterm + colors are allocated, but it may not be possible to allocate all + requested colors, or having allocated these colors to a gterm + widget it may not be possible to run other applications. Use of + the default colormap is appropriate for applications that do not + use many colors. + + A private colormap is allocated and used by only a single gterm. + This guarantees that the expected number of colors will be available, + and prevents one gterm from changing another's colors. The main + disadvantage is that the window will go black (or whatever) when + the pointer is not in the window. + + A shared colormap is a non-default (custom) colormap shared by + multiple gterms. Allocation of colors is guaranteed, but when one + gterm modifies the colormap all gterms using the shared colormap + are affected. They are however still visible and if they contain + similar data the display may still appear reasonable. There can + be multiple shared colormaps, each with a different name. + + It is possible to use a trick to minimize colormap flashing when + private or shared colormaps are used. This works so long as the + default colormap has only a limited number of colors allocated, + and the gterm client needs only a limited number of colors (e.g. + 200 or so out of 256). The trick is to allocate as many colors as + possible from the default colormap, assigning the same pixels for + colors in the custom colormap. The default colormap is then copied + to the private (or shared) colormap, and the new colors are stored + in both colormaps. The newly allocated colors are then freed in + the default colormap. The custom colormap will then inherit most + of the color assignments of the default colormap, and in turn the + default colormap may still have the initial color assignments from + the custom colormap. + + Differences will appear as both colormaps change thereafter, but in + practice many color assignments are fairly static so colormap + flashing should be minimized. The default colormap can be updated + periodically by repeating the allocate, store, copy, and free + sequence, e.g., when the custom colormap is modified. + + Custom gterm colormap allocation strategy: in the normal case reserve + 216 colors for private use. The remaining cells are copied from the + default colormap to minimize colormap flashing. If the gterm client + requests more than 216 colors the full colormap is allocated. + + 0 - 37 copied from default colormap + 38 - 253 reserved for gterm client + 254 - 255 copied from default colormap + + The point where the gterm colormap starts (e.g. 38) should be defined + by a resource as there is no guarantee which end of the default + colormap static colors will be allocated at. + + if (use default colormap) { + allocate read-write cells + store colors + } else { + if (don't have colormap yet) { + map colormap name to atom + if (named gterm colormap not found) { + # Create gterm colormap. + open connection to display + create colormap, allocate all colors + call XSetRGBColormaps to set colormap property + call XSetCloseDownMode to make colormap permanent + close display + } else { + call XGetRGBColormaps to get colormap property + get colormap id + } + set colormap id for gterm window + call XSetWMColormapWindows to notify WM of custom colormap + } + store new colors in custom colormap + if (match colormaps) { + copy global cells from default colormap + attempt to allocate cells in default colormap + attempt to store new colors in default colormap + free cells allocated above + } + } + + If the gterm widget has a private colormap different than that of + its top level window, XSetWMColormapWindows must be called for gterm + window focus in/out events to indicate to the WM that the colormap + for the gterm window is to be loaded. + + +Windowing the Display + + Given a range of display pixel values and a normalized colormap, + apply a threshold/gain transformation to window the display (i.e., + write new screen colormap). This needs to be done in the UI to + provide acceptable interactive response. + + GtWindowDisplay (gw, offset, slope) + + offset (0.5 +/- X) center of windowed region + slope (+/- X) slope of transfer function + + The transfer function is applied to the normalized colormap + and the output colormap is written to the screen. + + To window over a greater dynamic range one must regenerate the + display pixel values from the raster or image (this can be done by + the client). For example, the client application can display a + histogram and the user can mark the region to be written to the the + gterm raster pixels. + + The marker facilities described in the next section can be used to + implement real-time display of the grayscale transfer function if + desired. The message facility could also be used to transfer the + image histogram and information about the histogram region loaded + into a raster, for use with the transfer function to generate a + full display of the grayscale mapping from disk image to screen. + + +Graphics Markers + + A "marker" is a graphics object, defined on a raster, which can be + created or destroyed, which can draw itself, or which can modify + (move or resize) itself in response to pointer events. Markers have + attributes such as the marker type (text, line, circle, polygon, + etc.), color, line width, center, width, height, visibility, and + sensitivity. Markers can accept callbacks which are executed when + the object is interactively moved or resized. + + Markers can be used to annotate a window, as if one were drawing + into a window. The chief difference between a marker and a simple + drawing operation (such as a polyline) is that markers are not just + lines on the screen, but actual objects capable of responding to + requests or taking independent action. + + Generic functions + + create + destroy + copy + set attribute + get attribute + raise, lower + + Generic attributes + + type + visibility + autoRedraw + sensitivity + foreground, background text markers + linecolor, linewidth + knotcolor, knotsize + fillcolor, fillstyle polygon markers + width, height + x, y + + Marker types + + text font, string + line vertices + box + rectangle + circle + ellipse + polyline vertices + polygon vertices + + Procedures + + gm = GmGreate (gt, type, interactive) + gm = GmCopy (gm) + GmDestroy (gm) + GmAddCallback (gm, func, client_data) + gm = GmSelect (gt, x, y, &what) + + GmMarkpos (gm) + GmRedraw (gm, func, erase) + GmRaise (gm, ref_gm|NULL) + GmLower (gm, ref_gm|NULL) + GmNotify (gm, events) + + GmAdd (gm, x, y) + GmDelete (gm, x, y) + GmMove (gm, x, y) + GmResize (gm, x, y) + GmRotate (gm, x, y) + + GmSetAttribute (gm, attribute, value, type) + GmGetAttribute (gm, attribute, value, type) + GmSetVertices (gm, points, first, npts) + npts = GmGetVertices (gm, points, first, maxpts) + + raster = GtSelectRaster (gt, st, sx, sy, rt, &rx, &ry, &mp) + GtMapVector (gt, mp, dir, st, sv, dt, dv, npts, clip) + + Markers operate in screen coordinates (raster 0). The SelectRaster + and MapVector routines may be used to convert to and from raster + coordinates if desired. + + Actions + create (type) + destroy marker + set (attr, value) + raise marker + lower marker + notify callback + + markpos marker + markposAdd marker point button1-down + redraw marker button1-up + add point + delete point + deleteDestroy point or marker delete or backspace + move marker + resize marker + moveResize point or marker button1-motion + rotate marker shift-button1 + + Marker specific functions (internal) + + bool = select (gm, x, y, &what) + classinit (gm) + markpos (gm, &rect) + redraw (gm, function) + + add (gm, x, y) + delete (gm, x, y) + move (gm, x, y) + resize (gm, x, y) + rotate (gm, x, y) + + The marker specific functions are the methods for each marker + class. The functions add, delete, move etc. merely edit the marker + descriptor. A separate call to redraw is required to redraw the + modified marker. + + Actions such as deleteDestroy and moveResize will select one of the + listed actions based upon the pointer coordinates. For example with + moveResize, if the pointer is in the center of a marker the entire + marker is moved, and if the pointer is near a point the point is + moved or the marker resized depending upon the type of marker. + + The default translations for these actions are shown at the right. + These translations are in effect only when the pointer is over a + marker that is sensitive and visible. The cursor will change to + indicate that the marker is active; the cursor type will indicate + whether the entire marker, a single point, or add-point will be + selected if button1 is pressed at that location. In addition, the + default translation for button1-down for the window is create + rectangle. Hence a rectangle object can be created and dragged out + with the left button at any time just using the default + translations. This can be used prior to executing a command to + indicate the region to be operated upon. + + Actions such as move, resize, rotate, etc. do not redraw the object + (unless autoRedraw is set). Instead, these actions do a GXor redraw + of the marker at the old location, edit the marker according to its + type, and then do another GXor redraw at the new location. When + tracking the cursor this produces a rubber-band effect. When + tracking completes (e.g., button1-up) the screen is refreshed at the + markpos position, erasing the old marker, any affected markers are + redrawn at the markpos position, and the edited marker is redrawn at + the new location. + + A Marker is created with GmCreate. If the interactive flag is set + a mode is entered where the mouse is used to set the initial + position and size of the object. The cursor changes to indicate + that the widget is waiting for input. The user moves the mouse to + the position on the screen where the object will go, clicks the left + pointer, and then does a drag to set the initial size and + orientation of the object. When the button is released the create + object operation is complete, unless the marker type is polygon in + which case multiple click-and-drag operations are required to + interactively define the polygon. + + If the create is not interactive, the GmCreate returns immediately, + and SetAttribute calls are used to set the object attributes and + then display the object. + + Once a marker has been created the sensitivity attribute controls + whether the object can be interactively moved or resized with the + mouse. If the marker is sensitive, when the pointer is placed + within the marker or near a vertex or edge the cursor will change to + indicate that the marker, vertex, or edge can be dragged to move or + resize the marker. Alternatively, the delete or backspace key can + be used to destroy the marker. This will not actually destroy the + marker, but will notify the client (via a callback) that the user + has requested that the marker be destroyed. + + When the mouse is near a sensitive marker a special translation + table defines the key or pointer bindings associated with the drag, + delete, etc. marker actions. Typical bindings would be left pointer + for create and drag, middle pointer to terminate a sequence such as + when drawing a polygon or to abort a create object, shift left + pointer to add a point to an existing polygon, and delete or + backspace to delete an object, or in add-point mode, the last vertex + in a polygon. + + All the gterm widget need do is, when there is one or more sensitive + marker in a window, track the cursor and load the marker translation + table when the pointer is over a marker which is sensitive. The + rest will be done by the marker actions. + + Markers can be used in UI code to provide a more general method of + position input than a cursor read, which can only specify a single + point. For example to input a rectangular region, one would do the + following: + + UI selects marker type rectangle + UI creates a rectangle marker in interactive mode + cursor changes to indicate create-object mode + user positions mouse and clicks left button + holding button down, user drags out the rectangle + button up terminates GmCreate + UI calls GetVertices and passes polygon back to client + UI destroys marker + + If desired, the client application can draw the polygon again + using normal graphics drawing commands (i.e., not as a marker). + + To mark a region on a raster in UI code: + + UI creates rectangle object in noninteractive mode + visibility and autoredraw are initially false + UI calls SetAttribute to set rectangle position, size, etc. + UI sets visibility attribute to cause marker to be drawn + + If the region is to be active, e.g. something should happen if the + user moves or resizes the region, then the sensitivity should be + set to true and a callback can be posted to take some action if the + region is changed. For example, this could be used to graphically + pan the image or adjust the colormap. + + Markers are only drawn to the screen, never to the screen pixmap. + Hence they can be erased by copying from the screen pixmap. If the + screen needs to be refreshed the markers are redrawn from the object + list maintained internally by the gterm widget. + + +Display of Pixel Dependent Information + + A common feature of image display UIs is the ability to display + information about the pixel under the cursor, either in sample mode + or continuously as the cursor is moved. For maximum flexibility + one must rely upon the client application to return information about + a pixel, since usually only the client has full access to the data, + and the significance of a pixel can be highly application specific. + An example of this is the display of the cursor position and pixel + intensity in user coordinates. + + To implement this feature we need the following capabilities. + + o The UI posts a callback procedure which is called whenever + the cursor moves, i.e., which receives pointer-moved events. + + o The UI obtains information about the pixel under the pointer + from the client. + + o The UI displays this information in a text object, either + overlaid on the image or in a separate text display area. + + The WS already provides the ability to post a callback to receive + pointer-moved events. What we need is an efficient way to obtain + information about the pixel under the cursor. Due to the overhead + of the client-server architecture, it is undesirable to query the + client every time we need information about a pixel. Hence, we must + get information for a block of pixels in single query and cache this + information in the server, sending another query only when the + pointer moves to a different region of the screen. + + This can be done by sending a request to the client to send a block + of information (text) for all the points in a grid in pixel space. + The client responds by generating the text as a message to a UI + parameter. The UI then needs a way to select text from the UI + parameter, and generate another query if the desired data is not + cached. + + The cached text consists of a sequence of lines of the form + + raster-x raster-y client-text + + The server will need to cache several such blocks of data, each with + a header identifying the raster number and the region of the raster + covered by the cached data. The object code in the server will + provide convenience routines for managing and searching this data. + + +Text Display Facilities + + Real-time display of pixel information requires some way of + displaying the text passed back by the client via the method + described in the last section. Text display can be done either + using a text widget ouside the gterm window, or using a text marker + if the text is to be overlaid on the image. An advantage of using a + marker for the text overlay is that since the marker is active, the + user can use the mouse to reposition the text on the screen. + + +Translations + + The Widget specifies the default translations. The Widget + translations resource specifies replacement, augment, or override + translations. Additional augment or override translations may + be specified in a function call (e.g. to cause the widget to invoke + an application specified menu via a translation). + + On a marker focusout, the widget must restore the gterm window + translations. + + At initialize time: + + if (translations resource defined) { + if (augment or override translations) { + defTranslations = compiled Gterm translations + compile auxiliary translations + set augment or override flag + } else + defTranslations = compiled translations resource + } else + defTranslations = compiled translations resource + + At focusout time: + + SetValues defTranslations + for (each auxiliary translation table) + augment or override widget translations + + Additional auxiliary widget translations can be specified with + GtAugmentTranslations or GtOverrideTranslations. + +oo diff --git a/vendor/x11iraf/xgterm/README b/vendor/x11iraf/xgterm/README new file mode 100644 index 00000000..6e312da2 --- /dev/null +++ b/vendor/x11iraf/xgterm/README @@ -0,0 +1,15 @@ + Abandon All Hope, Ye Who Enter Here + + +This is undoubtedly the most ugly program in the distribution. It was one of +the first "serious" programs ported, and still has a lot of historical baggage. +Ideally, there would be a general tty widget and then vt102 and tek4014 +subwidgets so that they could be used in other programs. We are trying to +clean things up as we go, but there is still a lot of work to do. + +If you are porting this to a machine that has problems with overlapping +bcopy's, watch out! + +There are two documents on xgterm: the man page, xgterm.man, which describes +how to use it, and ctlseqs.ms, which describes the control sequences it +understands. diff --git a/vendor/x11iraf/xgterm/TODO b/vendor/x11iraf/xgterm/TODO new file mode 100644 index 00000000..ebf3c939 --- /dev/null +++ b/vendor/x11iraf/xgterm/TODO @@ -0,0 +1,93 @@ + XGTERM - TODO + + + +Imaging Support (July 1993) + + Gterm widget + debug polygon marker code + debug fill area support + implement missing read-raster primitive + add resource to set cursor type + + Object manager + add gterm widget support (subclass) + bindings for standard actions + support for pixel tagging + callbacks for image events? (e.g. raster actions) + add support for timers and background work functions + debug or trace mode for Tcl interpreter + improved error handling and recovery + flesh out support for standard widgets (menu, text, etc.) + evaluate other widgets (Xc, FWF, layout) + + Xgterm + hack event handling to support timers + add missing arguments, resources + + IRAF + file include capability for .gui file + interactive background mode (bkg GUIs) + stdimage which uses stdgraph kernel + + +Imaging Support (April 1993) + + subraster updates do not always overlap on screen [DONE] + check out frame buffer editing (partial instructions) [DONE] + custom cursor bitmap for crosshair cursor [DONE] + colormap - initialize table for static entries [DONE] + + add colormap number to GIM read/write colormap (0=screen) [DONE] + implement polygon clipping code in gio/cursor [DONE] + what to do about raster mapping after window resize [DONE] + add NDC-GIM coordinate conversions primitives to GIM ? [DONE] + add support for alternate GKI|GIM coordinates to GIM [DONE] + + general problem of cursor input and rasters/mappings [DONE] + return cursor coordinate in GKI units scaled to raster? [DONE] + + resolve problem of multiple gterms with color tables [DONE] + private colormap + share with other gterms (e.g. using properties) + reload colormap on focus-in event? + allocate private colormap if 256 cells requested? + add tcl callable windowing function (midpoint, slope) [DONE] + window display pixels by diddling colormap + regenerate display pixels from ximage (or from client) + add tcl callable region drawing facilities [DONE] + draw, erase, shape; how is interaction handled + add support for getting x/y/z from client and getting x/y/z + string given raster pixel coordinate + add tcl support for text display in the gterm window. can be [DONE] + combined with above for coord display + + implement GIM functions in interpreter (callbacks?) + implement missing read-raster primitive + add tcl access to gterm widget drawing functions? + add resource to set ginmode, busy cursor types + check out menu stuff + + add get/put cell array (NDC coords) to GIO + add get/put colormap to GIO + + add gtermio resource to set ginmode terminators + add gtermio resource to set emulation type + + what about stdgraph/stdimage? one possibility is for standard + xgterm GUI to provide separate graph, image windows automatically + selectable by graphics stream + + start up interactive bkg jobs in own xgterm + + +Client Applications (May 1993) + + Clean up Xgterm client (setup menus etc.) + write Ximtool client + Demo clients, further testing of object manager and widget stuff + imbrowse + movie program + simple image display task using GIO + + diff --git a/vendor/x11iraf/xgterm/Tests b/vendor/x11iraf/xgterm/Tests new file mode 100644 index 00000000..f270e203 --- /dev/null +++ b/vendor/x11iraf/xgterm/Tests @@ -0,0 +1,42 @@ +Tests for xgterm: + +If system supports window size (i.e., some combination of SIGWINCH, +TIOCSSIZE, TIOCSWINSZ), start a full-screen program (e.g., Emacs, +Jove, vi) and resize the xgterm window. The program must immediately +update its screen image for the new size. + +If compiled with -DUTMP, starting a new xgterm should create a new utmp +entry. ("who" will show this info.) Exiting xgterm should remove the +entry. Killing the xgterm window (or other unnatural exit) should also +remove the entry. When should entries be made in the wtmp file? + +Process group stuff should be correct. + +Should work without access to /dev/tty, say started from an xdm +started from a boot-time script. + +If "xgterm -help" offers the -C option, it should work. + +echo "test" > /dev/tty + +vi with lines that wrap. + +Exec'ing things other than shells. + +Another thing that has caused problems in the past is process groups, +especially w.r.t. signal propagation to the child. + +Popup menu signals: running only a shell, click on "Send INT Signal." +Do you get a new prompt from the shell? (Same as typing ^C at it.) + +Should scroll *fast* with jumpScroll enabled. + +While a mouse button is down tracing out a selection, output to the +screen should be suspended. + +Selections more than one screen long. + +start xgterm running only Tek widget: "xgterm -t" + + +Please add to this list if you find xgterm failing in some way. diff --git a/vendor/x11iraf/xgterm/VTPrsTbl.c b/vendor/x11iraf/xgterm/VTPrsTbl.c new file mode 100644 index 00000000..1392de99 --- /dev/null +++ b/vendor/x11iraf/xgterm/VTPrsTbl.c @@ -0,0 +1,2956 @@ +/* + * $XConsortium: VTPrsTbl.c,v 1.9 92/09/15 15:28:28 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "VTparse.h" + +#if __STDC__ +#define Const const +#else +#define Const /**/ +#endif + +/* + * Stupid Apollo C preprocessor can't handle long lines. So... To keep + * it happy, we put each onto a separate line.... Sigh... + */ + +Const int groundtable[] = +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* $ % & ' */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ( ) * + */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* , - . / */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 0 1 2 3 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 4 5 6 7 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 8 9 : ; */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* < = > ? */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* @ A B C */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* D E F G */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* H I J K */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* L M N O */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* P Q R S */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* T U V W */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* X Y Z [ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* \ ] ^ _ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ` a b c */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* d e f g */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* h i j k */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* l m n o */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* p q r s */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* t u v w */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* x y z { */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* | } ~ DEL */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* currency yen brokenbar section */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* notsign hyphen registered macron */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* degree plusminus twosuperior threesuperior */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* acute mu paragraph periodcentered */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* cedilla onesuperior masculine guillemotright */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* onequarter onehalf threequarters questiondown */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Agrave Aacute Acircumflex Atilde */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Adiaeresis Aring AE Ccedilla */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Eth Ntilde Ograve Oacute */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* agrave aacute acircumflex atilde */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* adiaeresis aring ae ccedilla */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* egrave eacute ecircumflex ediaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* igrave iacute icircumflex idiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* eth ntilde ograve oacute */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ocircumflex otilde odiaeresis division */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* oslash ugrave uacute ucircumflex */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +}; + +Const int csitable[] = /* ESC [ */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_IGNORE, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_DEC_STATE, +/* @ A B C */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* D E F G */ +CASE_CUB, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_CUP, +CASE_GROUND_STATE, +CASE_ED, +CASE_EL, +/* L M N O */ +CASE_IL, +CASE_DL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_DCH, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_TRACK_MOUSE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DA1, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_CUP, +CASE_TBC, +/* h i j k */ +CASE_SET, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_RST, +CASE_SGR, +CASE_CPR, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECSTBM, +CASE_GROUND_STATE, +/* t u v w */ +CASE_SUNREQTPARM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_DECREQTPARM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int dectable[] = /* ESC [ ? */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_IGNORE, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_DECSET, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_DECRST, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_XGTERM_RESTORE, +CASE_XGTERM_SAVE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int eigtable[] = /* CASE_ESC_IGNORE */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , + - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int esctable[] = /* ESC */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_SCR_STATE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_SCS0_STATE, +CASE_SCS1_STATE, +CASE_SCS2_STATE, +CASE_SCS3_STATE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECSC, +/* 8 9 : ; */ +CASE_DECRC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_DECKPAM, +CASE_DECKPNM, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_IND, +CASE_NEL, +CASE_HP_BUGGY_LL, +CASE_GROUND_STATE, +/* H I J K */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* P Q R S */ +CASE_IGNORE_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_XGTERM_TITLE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_OSC, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_RIS, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_HP_MEM_LOCK, +CASE_HP_MEM_UNLOCK, +CASE_LS2, +CASE_LS3, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_LS3R, +CASE_LS2R, +CASE_LS1R, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int iestable[] = /* CASE_IGNORE_ESC */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* BS HT NL VT */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* NP CR SO SI */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* CAN EM SUB ESC */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* FS GS RS US */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* SP ! " # */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* $ % & ' */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* ( ) * + */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* , - . / */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* 0 1 2 3 */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* 4 5 6 7 */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* 8 9 : ; */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* < = > ? */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* @ A B C */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* D E F G */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* H I J K */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* L M N O */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* P Q R S */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* T U V W */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* X Y Z [ */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* ` a b c */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* d e f g */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* h i j k */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* l m n o */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* p q r s */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* t u v w */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* x y z { */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* | } ~ DEL */ +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +CASE_IGNORE_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int igntable[] = /* CASE_IGNORE_STATE */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* BS HT NL VT */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_IGNORE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 4 5 6 7 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 8 9 : ; */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* < = > ? */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* @ A B C */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* D E F G */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* H I J K */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* L M N O */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* P Q R S */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* T U V W */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* X Y Z [ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* \ ] ^ _ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ` a b c */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* d e f g */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* h i j k */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* l m n o */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* p q r s */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* t u v w */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* x y z { */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* | } ~ DEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int scrtable[] = /* ESC # */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_DECALN, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const int scstable[] = /* ESC ( etc. */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* NP CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* currency yen brokenbar section */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* notsign hyphen registered macron */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; diff --git a/vendor/x11iraf/xgterm/VTparse.def b/vendor/x11iraf/xgterm/VTparse.def new file mode 100644 index 00000000..fa083f9f --- /dev/null +++ b/vendor/x11iraf/xgterm/VTparse.def @@ -0,0 +1,80 @@ +# +# $XConsortium: VTparse.def,v 1.4 92/09/15 15:28:31 gildea Exp $ +# +# List of symbols that need to be defined for VTparse.h. If you need to +# change any of the CASE_ macros, make the change here and rerun the command +# shown in VTparse.h. +# + +CASE_GROUND_STATE +CASE_IGNORE_STATE +CASE_IGNORE_ESC +CASE_IGNORE +CASE_BELL +CASE_BS +CASE_CR +CASE_ESC +CASE_VMOT +CASE_TAB +CASE_SI +CASE_SO +CASE_SCR_STATE +CASE_SCS0_STATE +CASE_SCS1_STATE +CASE_SCS2_STATE +CASE_SCS3_STATE +CASE_ESC_IGNORE +CASE_ESC_DIGIT +CASE_ESC_SEMI +CASE_DEC_STATE +CASE_ICH +CASE_CUU +CASE_CUD +CASE_CUF +CASE_CUB +CASE_CUP +CASE_ED +CASE_EL +CASE_IL +CASE_DL +CASE_DCH +CASE_DA1 +CASE_TRACK_MOUSE +CASE_TBC +CASE_SET +CASE_RST +CASE_SGR +CASE_CPR +CASE_DECSTBM +CASE_SUNREQTPARM +CASE_DECREQTPARM +CASE_DECSET +CASE_DECRST +CASE_DECALN +CASE_GSETS +CASE_DECSC +CASE_DECRC +CASE_DECKPAM +CASE_DECKPNM +CASE_IND +CASE_NEL +CASE_HTS +CASE_RI +CASE_SS2 +CASE_SS3 +CASE_CSI_STATE +CASE_OSC +CASE_RIS +CASE_LS2 +CASE_LS3 +CASE_LS3R +CASE_LS2R +CASE_LS1R +CASE_PRINT +CASE_XGTERM_SAVE +CASE_XGTERM_RESTORE +CASE_XGTERM_TITLE +CASE_DECID +CASE_HP_MEM_LOCK +CASE_HP_MEM_UNLOCK +CASE_HP_BUGGY_LL diff --git a/vendor/x11iraf/xgterm/VTparse.h b/vendor/x11iraf/xgterm/VTparse.h new file mode 100644 index 00000000..c7c7fa06 --- /dev/null +++ b/vendor/x11iraf/xgterm/VTparse.h @@ -0,0 +1,110 @@ +/* + * $XConsortium: VTparse.h,v 1.6 92/09/15 15:28:31 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * The following list of definitions is generated from VTparse.def using the + * following command line: + * + * grep '^CASE_' VTparse.def | awk '{printf "#define %s %d\n", $1, n++}' + * + * You you need to change something, change VTparse.def and regenerate the + * definitions. This would have been automatic, but since this doesn't change + * very often, it isn't worth the makefile hassle. + */ + +#define CASE_GROUND_STATE 0 +#define CASE_IGNORE_STATE 1 +#define CASE_IGNORE_ESC 2 +#define CASE_IGNORE 3 +#define CASE_BELL 4 +#define CASE_BS 5 +#define CASE_CR 6 +#define CASE_ESC 7 +#define CASE_VMOT 8 +#define CASE_TAB 9 +#define CASE_SI 10 +#define CASE_SO 11 +#define CASE_SCR_STATE 12 +#define CASE_SCS0_STATE 13 +#define CASE_SCS1_STATE 14 +#define CASE_SCS2_STATE 15 +#define CASE_SCS3_STATE 16 +#define CASE_ESC_IGNORE 17 +#define CASE_ESC_DIGIT 18 +#define CASE_ESC_SEMI 19 +#define CASE_DEC_STATE 20 +#define CASE_ICH 21 +#define CASE_CUU 22 +#define CASE_CUD 23 +#define CASE_CUF 24 +#define CASE_CUB 25 +#define CASE_CUP 26 +#define CASE_ED 27 +#define CASE_EL 28 +#define CASE_IL 29 +#define CASE_DL 30 +#define CASE_DCH 31 +#define CASE_DA1 32 +#define CASE_TRACK_MOUSE 33 +#define CASE_TBC 34 +#define CASE_SET 35 +#define CASE_RST 36 +#define CASE_SGR 37 +#define CASE_CPR 38 +#define CASE_DECSTBM 39 +#define CASE_SUNREQTPARM 40 +#define CASE_DECREQTPARM 41 +#define CASE_DECSET 42 +#define CASE_DECRST 43 +#define CASE_DECALN 44 +#define CASE_GSETS 45 +#define CASE_DECSC 46 +#define CASE_DECRC 47 +#define CASE_DECKPAM 48 +#define CASE_DECKPNM 49 +#define CASE_IND 50 +#define CASE_NEL 51 +#define CASE_HTS 52 +#define CASE_RI 53 +#define CASE_SS2 54 +#define CASE_SS3 55 +#define CASE_CSI_STATE 56 +#define CASE_OSC 57 +#define CASE_RIS 58 +#define CASE_LS2 59 +#define CASE_LS3 60 +#define CASE_LS3R 61 +#define CASE_LS2R 62 +#define CASE_LS1R 63 +#define CASE_PRINT 64 +#define CASE_XGTERM_SAVE 65 +#define CASE_XGTERM_RESTORE 66 +#define CASE_XGTERM_TITLE 67 +#define CASE_DECID 68 +#define CASE_HP_MEM_LOCK 69 +#define CASE_HP_MEM_UNLOCK 70 +#define CASE_HP_BUGGY_LL 71 diff --git a/vendor/x11iraf/xgterm/XGterm.ad b/vendor/x11iraf/xgterm/XGterm.ad new file mode 100644 index 00000000..644f5a68 --- /dev/null +++ b/vendor/x11iraf/xgterm/XGterm.ad @@ -0,0 +1,112 @@ +*SimpleMenu*BackingStore: NotUseful +*SimpleMenu*font: -adobe-helvetica-bold-r-normal--*-100-*-*-*-*-iso8859-* +*SimpleMenu*menuLabel.vertSpace: 100 +*SimpleMenu*HorizontalMargins: 16 +*SimpleMenu*vertSpace: 10 +*SimpleMenu*Cursor: left_ptr + +! Comment out if not color display. +*SimpleMenu*menuLabel.foreground: White +*SimpleMenu.borderColor: black +!.xgterm.SimpleMenu.background: #7c8498 +!.gterm-iraf.tekMenu.background: #7c8498 +.xgterm.SimpleMenu.background: #8992a8 +.gterm-iraf.tekMenu.background: #8992a8 +*SimpleMenu*foreground: Black + +! The following is for Xaw3d. +*beNiceToColormap: False + +*mainMenu.Label: Main Options +*mainMenu*securekbd*Label: Secure Keyboard +*mainMenu*allowsends*Label: Allow SendEvents +*mainMenu*logging*Label: Log to File +*mainMenu*redraw*Label: Redraw Window +*mainMenu*suspend*Label: Send STOP Signal +*mainMenu*continue*Label: Send CONT Signal +*mainMenu*interrupt*Label: Send INT Signal +*mainMenu*hangup*Label: Send HUP Signal +*mainMenu*terminate*Label: Send TERM Signal +*mainMenu*kill*Label: Send KILL Signal +*mainMenu*quit*Label: Quit + +*fontMenu.Label: VT Fonts +*fontMenu*fontdefault*Label: Default +*fontMenu*font1*Label: Unreadable +*VT100*font1: nil2 +*fontMenu*font2*Label: Tiny +*VT100*font2: 5x7 +*fontMenu*font3*Label: Small +*VT100*font3: 6x10 +*fontMenu*font4*Label: Medium +*VT100*font4: 7x13 +*fontMenu*font5*Label: Large +*VT100*font5: 9x15 +*fontMenu*font6*Label: Huge +*VT100*font6: 10x20 +*fontMenu*fontescape*Label: Escape Sequence +*fontMenu*fontsel*Label: Selection +!fontescape and fontsel overridden by application + +*vtMenu.Label: Control Options +*vtMenu*scrollbar*Label: Enable Scrollbar +*vtMenu*jumpscroll*Label: Enable Jump Scroll +*vtMenu*reversevideo*Label: Enable Reverse Video +*vtMenu*colortext*Label: Enable Color Text +*vtMenu*autowrap*Label: Enable Auto Wraparound +*vtMenu*reversewrap*Label: Enable Reverse Wraparound +*vtMenu*autolinefeed*Label: Enable Auto Linefeed +*vtMenu*appcursor*Label: Enable Application Cursor Keys +*vtMenu*appkeypad*Label: Enable Application Keypad +*vtMenu*scrollkey*Label: Scroll to Bottom on Key Press +*vtMenu*scrollttyoutput*Label: Scroll to Bottom on Tty Output +*vtMenu*allow132*Label: Allow 80/132 Column Switching +*vtMenu*cursesemul*Label: Enable Curses Emulation +*vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*marginbell*Label: Enable Margin Bell +*vtMenu*altscreen*Label: Show Alternate Screen +*vtMenu*softreset*Label: Do Soft Reset +*vtMenu*hardreset*Label: Do Full Reset +*vtMenu*clearsavedlines*Label: Reset and Clear Saved Lines +*vtMenu*gioenable*Label: Enable Graphics Capabilities +*vtMenu*tekshow*Label: Show Graphics Window +*vtMenu*tekmode*Label: Switch to Graphics Mode +*vtMenu*tekreset*Label: Reset Graphics Window +*vtMenu*vthide*Label: Hide VT Window + +*tekMenu.Label: Graphics Options +*tekMenu*tekpage*Label: Clear window +*tekMenu*tekhide*Label: Hide Window +*tekMenu*vtshow*Label: Show VT Window +*tekMenu*tekreset*Label: Destroy Window + +! The following key bindings are for Sun sparcstation keyboards (copy/paste). +*VT100.Translations: #override \ + <Key>L6:select-set(CLIPBOARD)\n\ + <Key>L8:insert-selection(CLIPBOARD) + +! The following define the ISO 6429 color standard +*VT100*color0: black +*VT100*color1: red +*VT100*color2: green +*VT100*color3: yellow +*VT100*color4: blue +*VT100*color5: magenta +*VT100*color6: cyan +*VT100*color7: gray55 +*VT100*color8: gray30 +*VT100*color9: red +*VT100*color10: green +*VT100*color11: yellow +*VT100*color12: blue +*VT100*color13: magenta +*VT100*color14: cyan +*VT100*color15: white +*VT100*colorBD: white +*VT100*colorUL: yellow + +! The following define resources to produce a 3-D scrollbar with arrows. +*VT100*Scrollbar*background: #c0c0c0 +*VT100*Scrollbar*width: 15 +*VT100*Scrollbar*height: 15 +*VT100*Scrollbar*shadowWidth: 2 diff --git a/vendor/x11iraf/xgterm/XGterm.ad.R5 b/vendor/x11iraf/xgterm/XGterm.ad.R5 new file mode 100644 index 00000000..e87d6b0a --- /dev/null +++ b/vendor/x11iraf/xgterm/XGterm.ad.R5 @@ -0,0 +1,85 @@ +*SimpleMenu*BackingStore: NotUseful +*SimpleMenu*font: -adobe-helvetica-bold-r-normal--*-100-*-*-*-*-iso8859-* +*SimpleMenu*menuLabel.vertSpace: 100 +*SimpleMenu*HorizontalMargins: 16 +*SimpleMenu*vertSpace: 10 +*SimpleMenu*Cursor: left_ptr + +! Comment out if not color display. +*SimpleMenu*menuLabel.foreground: White +*SimpleMenu.borderColor: black +!.xgterm.SimpleMenu.background: #7c8498 +!.gterm-iraf.tekMenu.background: #7c8498 +.xgterm.SimpleMenu.background: #8992a8 +.gterm-iraf.tekMenu.background: #8992a8 +*SimpleMenu*foreground: Black + +! The following is for Xaw3d. +*beNiceToColormap: False + +*mainMenu.Label: Main Options +*mainMenu*securekbd*Label: Secure Keyboard +*mainMenu*allowsends*Label: Allow SendEvents +*mainMenu*logging*Label: Log to File +*mainMenu*redraw*Label: Redraw Window +*mainMenu*suspend*Label: Send STOP Signal +*mainMenu*continue*Label: Send CONT Signal +*mainMenu*interrupt*Label: Send INT Signal +*mainMenu*hangup*Label: Send HUP Signal +*mainMenu*terminate*Label: Send TERM Signal +*mainMenu*kill*Label: Send KILL Signal +*mainMenu*quit*Label: Quit + +*fontMenu.Label: VT Fonts +*fontMenu*fontdefault*Label: Default +*fontMenu*font1*Label: Unreadable +*VT100*font1: nil2 +*fontMenu*font2*Label: Tiny +*VT100*font2: 5x7 +*fontMenu*font3*Label: Small +*VT100*font3: 6x10 +*fontMenu*font4*Label: Medium +*VT100*font4: 7x13 +*fontMenu*font5*Label: Large +*VT100*font5: 9x15 +*fontMenu*font6*Label: Huge +*VT100*font6: 10x20 +*fontMenu*fontescape*Label: Escape Sequence +*fontMenu*fontsel*Label: Selection +!fontescape and fontsel overridden by application + +*vtMenu.Label: Control Options +*vtMenu*scrollbar*Label: Enable Scrollbar +*vtMenu*jumpscroll*Label: Enable Jump Scroll +*vtMenu*reversevideo*Label: Enable Reverse Video +*vtMenu*autowrap*Label: Enable Auto Wraparound +*vtMenu*reversewrap*Label: Enable Reverse Wraparound +*vtMenu*autolinefeed*Label: Enable Auto Linefeed +*vtMenu*appcursor*Label: Enable Application Cursor Keys +*vtMenu*appkeypad*Label: Enable Application Keypad +*vtMenu*scrollkey*Label: Scroll to Bottom on Key Press +*vtMenu*scrollttyoutput*Label: Scroll to Bottom on Tty Output +*vtMenu*allow132*Label: Allow 80/132 Column Switching +*vtMenu*cursesemul*Label: Enable Curses Emulation +*vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*marginbell*Label: Enable Margin Bell +*vtMenu*altscreen*Label: Show Alternate Screen +*vtMenu*softreset*Label: Do Soft Reset +*vtMenu*hardreset*Label: Do Full Reset +*vtMenu*clearsavedlines*Label: Reset and Clear Saved Lines +*vtMenu*gioenable*Label: Enable Graphics Capabilities +*vtMenu*tekshow*Label: Show Graphics Window +*vtMenu*tekmode*Label: Switch to Graphics Mode +*vtMenu*tekreset*Label: Reset Graphics Window +*vtMenu*vthide*Label: Hide VT Window + +*tekMenu.Label: Graphics Options +*tekMenu*tekpage*Label: Clear window +*tekMenu*tekhide*Label: Hide Window +*tekMenu*vtshow*Label: Show VT Window +*tekMenu*tekreset*Label: Destroy Window + +! The following key bindings are for Sun sparcstation keyboards (copy/paste). +*VT100.Translations: #override \ + <Key>L6:select-set(CLIPBOARD)\n\ + <Key>L8:insert-selection(CLIPBOARD) diff --git a/vendor/x11iraf/xgterm/_3d b/vendor/x11iraf/xgterm/_3d new file mode 100644 index 00000000..750e7d4e --- /dev/null +++ b/vendor/x11iraf/xgterm/_3d @@ -0,0 +1,44 @@ + +XGterm*Form.background: #c0c0c0 +XGterm*TransientShell*Dialog.background: #c0c0c0 +XGterm*Command.background: #c0c0c0 +XGterm*Menubutton.background: #c0c0c0 +XGterm*ScrollbarBackground: #c0c0c0 +!XGterm*Scrollbar*background: #c0c0c0 +XGterm*Scrollbar*background: #c0c0c0 +!XGterm*Scrollbar*foreground: #cccccc +XGterm*Scrollbar*width: 15 +XGterm*Scrollbar*height: 15 +XGterm*Scrollbar*shadowWidth: 2 +XGterm*Scrollbar*cursorName: top_left_arrow +XGterm*Scrollbar*pushThumb: true +XGterm*shapeStyle: Rectangle +XGterm*beNiceToColormap: False +XGterm*shadowWidth: 2 +XGterm*SmeBSB*shadowWidth: 2 +XGterm*highlightThickness: 0 +XGterm*topShadowContrast: 20 +XGterm*bottomShadowContrast: 55 + +!*VT100*background: black +!*VT100*foreground: wheat +*VT100*color0: black +*VT100*color1: red4 +*VT100*color2: green4 +*VT100*color3: yellow4 +*VT100*color4: blue4 +*VT100*color5: magenta4 +*VT100*color6: cyan4 +*VT100*color7: gray55 +*VT100*color8: gray30 +*VT100*color9: red +*VT100*color10: green +*VT100*color11: yellow +*VT100*color12: blue +*VT100*color13: magenta +*VT100*color14: cyan +*VT100*color15: white +*VT100*colorBD: white +*VT100*colorUL: yellow + +XGterm*dynamicColors: false diff --git a/vendor/x11iraf/xgterm/button.c b/vendor/x11iraf/xgterm/button.c new file mode 100644 index 00000000..18a15673 --- /dev/null +++ b/vendor/x11iraf/xgterm/button.c @@ -0,0 +1,1480 @@ +/* $XConsortium: button.c,v 1.69 94/04/02 12:41:50 gildea Exp $ */ +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* +button.c Handles button events in the terminal emulator. + does cut/paste operations, change modes via menu, + passes button events through to some applications. + J. Gettys. +*/ + +#include "ptyx.h" /* Xlib headers included here. */ +#include <X11/Xatom.h> +#include <stdio.h> + +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/StdSel.h> + +#include "data.h" +#include "error.h" +#include "menu.h" + +extern char *malloc(); + +extern void DoSecureKeyboard(); + +#define KeyState(x) (((x) & (ShiftMask|ControlMask)) + (((x) & Mod1Mask) ? 2 : 0)) + /* adds together the bits: + shift key -> 1 + meta key -> 2 + control key -> 4 */ + +#define TEXTMODES 4 +#define NBUTS 3 +#define DIRS 2 +#define UP 1 +#define DOWN 0 +#define SHIFTS 8 /* three keys, so eight combinations */ +#define Coordinate(r,c) ((r) * (term->screen.max_col+1) + (c)) + +extern char *xgterm_name; + +static void PointToRowCol(); +static void SelectionReceived(); +static void TrackDown(); +static void ComputeSelect(); +static void EditorButton(); +static void ExtendExtend(); +static void ReHiliteText(); +static void SelectSet(); +static void StartSelect(); +static int Length(); +static char *SaveText(); + +extern XgtermWidget term; + +/* Selection/extension variables */ + +/* Raw char position where the selection started */ +static int rawRow, rawCol; + +/* Selected area before CHAR, WORD, LINE selectUnit processing */ +static int startRRow, startRCol, endRRow, endRCol = 0; + +/* Selected area after CHAR, WORD, LINE selectUnit processing */ +static int startSRow, startSCol, endSRow, endSCol = 0; + +/* Valid rows for selection clipping */ +static int firstValidRow, lastValidRow; + +/* Start, end of extension */ +static int startERow, startECol, endERow, endECol; + +/* Saved values of raw selection for extend to restore to */ +static int saveStartRRow, saveStartRCol, saveEndRRow, saveEndRCol; + +/* Multi-click handling */ +static int numberOfClicks = 0; +static long int lastButtonUpTime = 0; +typedef int SelectUnit; +#define SELECTCHAR 0 +#define SELECTWORD 1 +#define SELECTLINE 2 +#define NSELECTUNITS 3 +static SelectUnit selectUnit; + +/* Send emacs escape code when done selecting or extending? */ +static int replyToEmacs; + + +Boolean SendMousePosition(w, event) +Widget w; +XEvent* event; +{ + register TScreen *screen = &((XgtermWidget)w)->screen; + + if (screen->send_mouse_pos == 0) return False; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return False; + +#define KeyModifiers \ + (event->xbutton.state & (ShiftMask | LockMask | ControlMask | Mod1Mask | \ + Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask )) + +#define ButtonModifiers \ + (event->xbutton.state & (ShiftMask | LockMask | ControlMask | Mod1Mask | \ + Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask )) + + switch (screen->send_mouse_pos) { + case 1: /* X10 compatibility sequences */ + + if (KeyModifiers == 0) { + if (event->type == ButtonPress) + EditorButton(event); + return True; + } + return False; + + case 2: /* DEC vt200 compatible */ + + if (KeyModifiers == 0 || KeyModifiers == ControlMask) { + EditorButton(event); + return True; + } + return False; + + case 3: /* DEC vt200 hilite tracking */ + if ( event->type == ButtonPress && + KeyModifiers == 0 && + event->xbutton.button == Button1 ) { + TrackDown(event); + return True; + } + if (KeyModifiers == 0 || KeyModifiers == ControlMask) { + EditorButton(event); + return True; + } + /* fall through */ + + default: + return False; + } +#undef KeyModifiers +} + + +void +DiredButton(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +{ /* ^XM-G<line+' '><col+' '> */ + register TScreen *screen = &term->screen; + int pty = screen->respond; + char Line[ 6 ]; + register unsigned line, col; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + strcpy( Line, "\030\033G " ); + + line = ( event->xbutton.y - screen->border ) / FontHeight( screen ); + if (term->misc.sb_right) + col = (event->xbutton.x - screen->border) / FontWidth(screen); + else + col = (event->xbutton.x - screen->border - screen->scrollbar) / + FontWidth(screen); + Line[3] = ' ' + col; + Line[4] = ' ' + line; + v_write(pty, Line, 5 ); +} + +void +ViButton(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +{ /* ^XM-G<line+' '><col+' '> */ + register TScreen *screen = &term->screen; + int pty = screen->respond; + char Line[ 6 ]; + register int line, col; + + if (event->type != ButtonPress && event->type != ButtonRelease) + return; + + line = screen->cur_row - + (( event->xbutton.y - screen->border ) / FontHeight( screen)); +/* fprintf( stderr, "xtdb line=%d\n", line ); */ + if ( ! line ) return; + Line[ 1 ] = 0; + Line[ 0 ] = 27; + v_write(pty, Line, 1 ); + + Line[ 0 ] = 'p' & 0x1f; + + if ( line < 0 ) + { line = -line; + Line[ 0 ] = 'n' & 0x1f; + } + while ( --line >= 0 ) v_write(pty, Line, 1 ); +} + +/*ARGSUSED*/ +void HandleSelectExtend(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XMotionEvent */ +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + register TScreen *screen = &((XgtermWidget)w)->screen; + int row, col; + + screen->selection_time = event->xmotion.time; + switch (eventMode) { + case LEFTEXTENSION : + case RIGHTEXTENSION : + PointToRowCol (event->xmotion.y, event->xmotion.x, + &row, &col); + ExtendExtend (row, col); + break; + case NORMAL : + /* will get here if send_mouse_pos != 0 */ + break; + } +} + +static void EndExtend(); + +static void do_select_end (w, event, params, num_params, use_cursor_loc) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +Bool use_cursor_loc; +{ + ((XgtermWidget)w)->screen.selection_time = event->xbutton.time; + switch (eventMode) { + case NORMAL : + (void) SendMousePosition(w, event); + break; + case LEFTEXTENSION : + case RIGHTEXTENSION : + EndExtend(w, event, params, *num_params, use_cursor_loc); + break; + } +} + + +void HandleSelectEnd(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +{ + do_select_end (w, event, params, num_params, False); +} + + +void HandleKeyboardSelectEnd(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent */ +String *params; /* selections */ +Cardinal *num_params; +{ + do_select_end (w, event, params, num_params, True); +} + + + + +struct _SelectionList { + String *params; + Cardinal count; + Time time; +}; + + +static void _GetSelection(w, time, params, num_params) +Widget w; +Time time; +String *params; /* selections in precedence order */ +Cardinal num_params; +{ + Atom selection; + int cutbuffer; + + XmuInternStrings(XtDisplay(w), params, (Cardinal)1, &selection); + switch (selection) { + case XA_CUT_BUFFER0: cutbuffer = 0; break; + case XA_CUT_BUFFER1: cutbuffer = 1; break; + case XA_CUT_BUFFER2: cutbuffer = 2; break; + case XA_CUT_BUFFER3: cutbuffer = 3; break; + case XA_CUT_BUFFER4: cutbuffer = 4; break; + case XA_CUT_BUFFER5: cutbuffer = 5; break; + case XA_CUT_BUFFER6: cutbuffer = 6; break; + case XA_CUT_BUFFER7: cutbuffer = 7; break; + default: cutbuffer = -1; + } + if (cutbuffer >= 0) { + register TScreen *screen = &((XgtermWidget)w)->screen; + int inbytes; + unsigned long nbytes; + int fmt8 = 8; + Atom type = XA_STRING; + char *line = XFetchBuffer(screen->display, &inbytes, cutbuffer); + nbytes = (unsigned long) inbytes; + if (nbytes > 0) + SelectionReceived(w, NULL, &selection, &type, (XtPointer)line, + &nbytes, &fmt8); + else if (num_params > 1) + _GetSelection(w, time, params+1, num_params-1); + } else { + struct _SelectionList* list; + if (--num_params) { + list = XtNew(struct _SelectionList); + list->params = params + 1; + list->count = num_params; /* decremented above */ + list->time = time; + } else list = NULL; + XtGetSelectionValue(w, selection, XA_STRING, SelectionReceived, + (XtPointer)list, time); + } +} + +/* SelectionReceived: stuff received selection text into pty */ + +/* ARGSUSED */ +static void SelectionReceived(w, client_data, selection, type, + value, length, format) +Widget w; +XtPointer client_data; +Atom *selection, *type; +XtPointer value; +unsigned long *length; +int *format; +{ + int pty = ((XgtermWidget)w)->screen.respond; /* file descriptor of pty */ + register char *lag, *cp, *end; + char *line = (char*)value; + + if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0 || value == NULL) { + /* could not get this selection, so see if there are more to try */ + struct _SelectionList* list = (struct _SelectionList*)client_data; + if (list != NULL) { + _GetSelection(w, list->time, list->params, list->count); + XtFree(client_data); + } + return; + } + + /* Write data to pty a line at a time. */ + /* Doing this one line at a time may no longer be necessary + because v_write has been re-written. */ + + end = &line[*length]; + lag = line; + for (cp = line; cp != end; cp++) + { + if (*cp != '\n') continue; + *cp = '\r'; + v_write(pty, lag, cp - lag + 1); + lag = cp + 1; + } + if (lag != end) + v_write(pty, lag, end - lag); + + XtFree(client_data); + XtFree(value); +} + + +void +HandleInsertSelection(w, event, params, num_params) +Widget w; +XEvent *event; /* assumed to be XButtonEvent* */ +String *params; /* selections in precedence order */ +Cardinal *num_params; +{ + if (SendMousePosition(w, event)) return; + _GetSelection(w, event->xbutton.time, params, *num_params); +} + + +static void +SetSelectUnit(buttonDownTime, defaultUnit) + Time buttonDownTime; + SelectUnit defaultUnit; +{ +/* Do arithmetic as integers, but compare as unsigned solves clock wraparound */ + if ((long unsigned)((long int)buttonDownTime - lastButtonUpTime) + > term->screen.multiClickTime) { + numberOfClicks = 1; + selectUnit = defaultUnit; + } else { + ++numberOfClicks; + selectUnit = ((selectUnit + 1) % NSELECTUNITS); + } +} + +static void do_select_start (w, event, startrow, startcol) +Widget w; +XEvent *event; /* must be XButtonEvent* */ +int startrow, startcol; +{ + if (SendMousePosition(w, event)) return; + SetSelectUnit(event->xbutton.time, SELECTCHAR); + replyToEmacs = FALSE; + StartSelect(startrow, startcol); +} + +/* ARGSUSED */ +void +HandleSelectStart(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent* */ +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + register TScreen *screen = &((XgtermWidget)w)->screen; + int startrow, startcol; + + firstValidRow = 0; + lastValidRow = screen->max_row; + PointToRowCol(event->xbutton.y, event->xbutton.x, &startrow, &startcol); + do_select_start (w, event, startrow, startcol); +} + + +/* ARGSUSED */ +void +HandleKeyboardSelectStart(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent* */ +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + register TScreen *screen = &((XgtermWidget)w)->screen; + + do_select_start (w, event, screen->cursor_row, screen->cursor_col); +} + + +static void +TrackDown(event) + register XButtonEvent *event; +{ + int startrow, startcol; + + SetSelectUnit(event->time, SELECTCHAR); + if (numberOfClicks > 1 ) { + PointToRowCol(event->y, event->x, &startrow, &startcol); + replyToEmacs = TRUE; + StartSelect(startrow, startcol); + } else { + waitingForTrackInfo = 1; + EditorButton(event); + } +} + + +#define boundsCheck(x) if (x < 0) \ + x = 0; \ + else if (x >= screen->max_row) \ + x = screen->max_row; + +void +TrackMouse(func, startrow, startcol, firstrow, lastrow) + int func, startrow, startcol, firstrow, lastrow; +{ + TScreen *screen = &term->screen; + + if (!waitingForTrackInfo) { /* Timed out, so ignore */ + return; + } + waitingForTrackInfo = 0; + if (func == 0) return; + boundsCheck (startrow) + boundsCheck (firstrow) + boundsCheck (lastrow) + firstValidRow = firstrow; + lastValidRow = lastrow; + replyToEmacs = TRUE; + StartSelect(startrow, startcol); +} + +static void +StartSelect(startrow, startcol) + int startrow, startcol; +{ + TScreen *screen = &term->screen; + + if (screen->cursor_state) + HideCursor (); + if (numberOfClicks == 1) { + /* set start of selection */ + rawRow = startrow; + rawCol = startcol; + + } /* else use old values in rawRow, Col */ + + saveStartRRow = startERow = rawRow; + saveStartRCol = startECol = rawCol; + saveEndRRow = endERow = rawRow; + saveEndRCol = endECol = rawCol; + if (Coordinate(startrow, startcol) < Coordinate(rawRow, rawCol)) { + eventMode = LEFTEXTENSION; + startERow = startrow; + startECol = startcol; + } else { + eventMode = RIGHTEXTENSION; + endERow = startrow; + endECol = startcol; + } + ComputeSelect(startERow, startECol, endERow, endECol, False); + +} + +static void +EndExtend(w, event, params, num_params, use_cursor_loc) + Widget w; + XEvent *event; /* must be XButtonEvent */ + String *params; /* selections */ + Cardinal num_params; + Bool use_cursor_loc; +{ + int row, col; + TScreen *screen = &term->screen; + char line[9]; + + if (use_cursor_loc) { + row = screen->cursor_row; + col = screen->cursor_col; + } else { + PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); + } + ExtendExtend (row, col); + lastButtonUpTime = event->xbutton.time; + if (startSRow != endSRow || startSCol != endSCol) { + if (replyToEmacs) { + if (rawRow == startSRow && rawCol == startSCol + && row == endSRow && col == endSCol) { + /* Use short-form emacs select */ + strcpy(line, "\033[t"); + line[3] = ' ' + endSCol + 1; + line[4] = ' ' + endSRow + 1; + v_write(screen->respond, line, 5); + } else { + /* long-form, specify everything */ + strcpy(line, "\033[T"); + line[3] = ' ' + startSCol + 1; + line[4] = ' ' + startSRow + 1; + line[5] = ' ' + endSCol + 1; + line[6] = ' ' + endSRow + 1; + line[7] = ' ' + col + 1; + line[8] = ' ' + row + 1; + v_write(screen->respond, line, 9); + } + TrackText(0, 0, 0, 0); + } + } + SelectSet(w, event, params, num_params); + eventMode = NORMAL; +} + +void +HandleSelectSet(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + SelectSet (w, event, params, *num_params); +} + +static void SaltTextAway(); + +/* ARGSUSED */ +static void +SelectSet (w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal num_params; +{ + /* Only do select stuff if non-null select */ + if (startSRow != endSRow || startSCol != endSCol) { + SaltTextAway(startSRow, startSCol, endSRow, endSCol, + params, num_params); + } else + DisownSelection(term); +} + +#define Abs(x) ((x) < 0 ? -(x) : (x)) + +/* ARGSUSED */ +static void do_start_extend (w, event, params, num_params, use_cursor_loc) +Widget w; +XEvent *event; /* must be XButtonEvent* */ +String *params; /* unused */ +Cardinal *num_params; /* unused */ +Bool use_cursor_loc; +{ + TScreen *screen = &((XgtermWidget)w)->screen; + int row, col, coord; + + if (SendMousePosition(w, event)) return; + firstValidRow = 0; + lastValidRow = screen->max_row; + SetSelectUnit(event->xbutton.time, selectUnit); + replyToEmacs = FALSE; + + if (numberOfClicks == 1) { + /* Save existing selection so we can reestablish it if the guy + extends past the other end of the selection */ + saveStartRRow = startERow = startRRow; + saveStartRCol = startECol = startRCol; + saveEndRRow = endERow = endRRow; + saveEndRCol = endECol = endRCol; + } else { + /* He just needed the selection mode changed, use old values. */ + startERow = startRRow = saveStartRRow; + startECol = startRCol = saveStartRCol; + endERow = endRRow = saveEndRRow; + endECol = endRCol = saveEndRCol; + + } + if (use_cursor_loc) { + row = screen->cursor_row; + col = screen->cursor_col; + } else { + PointToRowCol(event->xbutton.y, event->xbutton.x, &row, &col); + } + coord = Coordinate(row, col); + + if (Abs(coord - Coordinate(startSRow, startSCol)) + < Abs(coord - Coordinate(endSRow, endSCol)) + || coord < Coordinate(startSRow, startSCol)) { + /* point is close to left side of selection */ + eventMode = LEFTEXTENSION; + startERow = row; + startECol = col; + } else { + /* point is close to left side of selection */ + eventMode = RIGHTEXTENSION; + endERow = row; + endECol = col; + } + ComputeSelect(startERow, startECol, endERow, endECol, True); +} + +static void +ExtendExtend (row, col) + int row, col; +{ + int coord = Coordinate(row, col); + + if (eventMode == LEFTEXTENSION + && (coord + (selectUnit!=SELECTCHAR)) > Coordinate(endSRow, endSCol)) { + /* Whoops, he's changed his mind. Do RIGHTEXTENSION */ + eventMode = RIGHTEXTENSION; + startERow = saveStartRRow; + startECol = saveStartRCol; + } else if (eventMode == RIGHTEXTENSION + && coord < Coordinate(startSRow, startSCol)) { + /* Whoops, he's changed his mind. Do LEFTEXTENSION */ + eventMode = LEFTEXTENSION; + endERow = saveEndRRow; + endECol = saveEndRCol; + } + if (eventMode == LEFTEXTENSION) { + startERow = row; + startECol = col; + } else { + endERow = row; + endECol = col; + } + ComputeSelect(startERow, startECol, endERow, endECol, False); +} + + +void HandleStartExtend(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent* */ +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + do_start_extend (w, event, params, num_params, False); +} + +void HandleKeyboardStartExtend(w, event, params, num_params) +Widget w; +XEvent *event; /* must be XButtonEvent* */ +String *params; /* unused */ +Cardinal *num_params; /* unused */ +{ + do_start_extend (w, event, params, num_params, True); +} + + +ScrollSelection(screen, amount) +register TScreen* screen; +register int amount; +{ + register int minrow = -screen->savedlines - screen->topline; + register int maxrow = screen->max_row - screen->topline; + register int maxcol = screen->max_col; + +#define scroll_update_one(row, col) \ + row += amount; \ + if (row < minrow) { \ + row = minrow; \ + col = 0; \ + } \ + if (row > maxrow) { \ + row = maxrow; \ + col = maxcol; \ + } + + scroll_update_one(startRRow, startRCol); + scroll_update_one(endRRow, endRCol); + scroll_update_one(startSRow, startSCol); + scroll_update_one(endSRow, endSCol); + + scroll_update_one(rawRow, rawCol); + + scroll_update_one(screen->startHRow, screen->startHCol); + scroll_update_one(screen->endHRow, screen->endHCol); + + screen->startHCoord = Coordinate (screen->startHRow, screen->startHCol); + screen->endHCoord = Coordinate (screen->endHRow, screen->endHCol); +} + + +/*ARGSUSED*/ +ResizeSelection (screen, rows, cols) + TScreen *screen; + int rows, cols; +{ + rows--; /* decr to get 0-max */ + cols--; + + if (startRRow > rows) startRRow = rows; + if (startSRow > rows) startSRow = rows; + if (endRRow > rows) endRRow = rows; + if (endSRow > rows) endSRow = rows; + if (rawRow > rows) rawRow = rows; + + if (startRCol > cols) startRCol = cols; + if (startSCol > cols) startSCol = cols; + if (endRCol > cols) endRCol = cols; + if (endSCol > cols) endSCol = cols; + if (rawCol > cols) rawCol = cols; +} + +static void +PointToRowCol(y, x, r, c) + register int y, x; + int *r, *c; +/* Convert pixel coordinates to character coordinates. + Rows are clipped between firstValidRow and lastValidRow. + Columns are clipped between to be 0 or greater, but are not clipped to some + maximum value. */ +{ + register TScreen *screen = &term->screen; + register row, col; + + row = (y - screen->border) / FontHeight(screen); + if(row < firstValidRow) + row = firstValidRow; + else if(row > lastValidRow) + row = lastValidRow; + if (term->misc.sb_right) + col = (x - screen->border) / FontWidth(screen); + else + col = (x - screen->border - screen->scrollbar) / FontWidth(screen); + if(col < 0) + col = 0; + else if(col > screen->max_col+1) { + col = screen->max_col+1; + } + *r = row; + *c = col; +} + +static int +LastTextCol(row) + register int row; +{ + register TScreen *screen = &term->screen; + register int i; + register Char *ch; + + for ( i = screen->max_col, + ch = screen->buf[4 * (row + screen->topline) + 1] + i ; + i >= 0 && !(*ch & CHARDRAWN) ; + ch--, i--) + ; + return(i); +} + +/* +** double click table for cut and paste in 8 bits +** +** This table is divided in four parts : +** +** - control characters [0,0x1f] U [0x80,0x9f] +** - separators [0x20,0x3f] U [0xa0,0xb9] +** - binding characters [0x40,0x7f] U [0xc0,0xff] +** - execeptions +*/ +static int charClass[256] = { +/* NUL SOH STX ETX EOT ENQ ACK BEL */ + 32, 1, 1, 1, 1, 1, 1, 1, +/* BS HT NL VT NP CR SO SI */ + 1, 32, 1, 1, 1, 1, 1, 1, +/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* CAN EM SUB ESC FS GS RS US */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* SP ! " # $ % & ' */ + 32, 33, 34, 35, 36, 37, 38, 39, +/* ( ) * + , - . / */ + 40, 41, 42, 43, 44, 45, 46, 47, +/* 0 1 2 3 4 5 6 7 */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* 8 9 : ; < = > ? */ + 48, 48, 58, 59, 60, 61, 62, 63, +/* @ A B C D E F G */ + 64, 48, 48, 48, 48, 48, 48, 48, +/* H I J K L M N O */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* P Q R S T U V W */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* X Y Z [ \ ] ^ _ */ + 48, 48, 48, 91, 92, 93, 94, 48, +/* ` a b c d e f g */ + 96, 48, 48, 48, 48, 48, 48, 48, +/* h i j k l m n o */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* p q r s t u v w */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* x y z { | } ~ DEL */ + 48, 48, 48, 123, 124, 125, 126, 1, +/* x80 x81 x82 x83 IND NEL SSA ESA */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* HTS HTJ VTS PLD PLU RI SS2 SS3 */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* DCS PU1 PU2 STS CCH MW SPA EPA */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* x98 x99 x9A CSI ST OSC PM APC */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* - i c/ L ox Y- | So */ + 160, 161, 162, 163, 164, 165, 166, 167, +/* .. c0 ip << _ R0 - */ + 168, 169, 170, 171, 172, 173, 174, 175, +/* o +- 2 3 ' u q| . */ + 176, 177, 178, 179, 180, 181, 182, 183, +/* , 1 2 >> 1/4 1/2 3/4 ? */ + 184, 185, 186, 187, 188, 189, 190, 191, +/* A` A' A^ A~ A: Ao AE C, */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* E` E' E^ E: I` I' I^ I: */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* D- N~ O` O' O^ O~ O: X */ + 48, 48, 48, 48, 48, 48, 48, 216, +/* O/ U` U' U^ U: Y' P B */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* a` a' a^ a~ a: ao ae c, */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* e` e' e^ e: i` i' i^ i: */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* d n~ o` o' o^ o~ o: -: */ + 48, 48, 48, 48, 48, 48, 48, 248, +/* o/ u` u' u^ u: y' P y: */ + 48, 48, 48, 48, 48, 48, 48, 48}; + +int SetCharacterClassRange (low, high, value) + register int low, high; /* in range of [0..255] */ + register int value; /* arbitrary */ +{ + + if (low < 0 || high > 255 || high < low) return (-1); + + for (; low <= high; low++) charClass[low] = value; + + return (0); +} + +/* + * sets startSRow startSCol endSRow endSCol + * ensuring that they have legal values + */ + +static void +ComputeSelect(startRow, startCol, endRow, endCol, extend) + int startRow, startCol, endRow, endCol; + Bool extend; +{ + register TScreen *screen = &term->screen; + register Char *ptr; + register int length; + register int class; + int osc = startSCol; + + if (Coordinate(startRow, startCol) <= Coordinate(endRow, endCol)) { + startSRow = startRRow = startRow; + startSCol = startRCol = startCol; + endSRow = endRRow = endRow; + endSCol = endRCol = endCol; + } else { /* Swap them */ + startSRow = startRRow = endRow; + startSCol = startRCol = endCol; + endSRow = endRRow = startRow; + endSCol = endRCol = startCol; + } + + switch (selectUnit) { + case SELECTCHAR : + if (startSCol > (LastTextCol(startSRow) + 1)) { + startSCol = 0; + startSRow++; + } + if (endSCol > (LastTextCol(endSRow) + 1)) { + endSCol = 0; + endSRow++; + } + break; + case SELECTWORD : + if (startSCol > (LastTextCol(startSRow) + 1)) { + startSCol = 0; + startSRow++; + } else { + ptr = screen->buf[4*(startSRow+screen->topline)] + + startSCol; + class = charClass[*ptr]; + do { + --startSCol; + --ptr; + } while (startSCol >= 0 + && charClass[*ptr] == class); + ++startSCol; + } + if (endSCol > (LastTextCol(endSRow) + 1)) { + endSCol = 0; + endSRow++; + } else { + length = LastTextCol(endSRow); + ptr = screen->buf[4*(endSRow+screen->topline)] + + endSCol; + class = charClass[*ptr]; + do { + ++endSCol; + ++ptr; + } while (endSCol <= length + && charClass[*ptr] == class); + /* Word select selects if pointing to any char + in "word", especially in that it includes + the last character in a word. So no --endSCol + and do special eol handling */ + if (endSCol > length+1) { + endSCol = 0; + ++endSRow; + } + } + break; + case SELECTLINE : + if (term->screen.cutToBeginningOfLine) { + startSCol = 0; + } else if (!extend) { + startSCol = osc; + } + if (term->screen.cutNewline) { + endSCol = 0; + ++endSRow; + } else { + endSCol = LastTextCol(endSRow) + 1; + } + break; + } + + TrackText(startSRow, startSCol, endSRow, endSCol); + return; +} + + +TrackText(frow, fcol, trow, tcol) + register int frow, fcol, trow, tcol; + /* Guaranteed (frow, fcol) <= (trow, tcol) */ +{ + register int from, to; + register TScreen *screen = &term->screen; + int old_startrow, old_startcol, old_endrow, old_endcol; + + old_startrow = screen->startHRow; + old_startcol = screen->startHCol; + old_endrow = screen->endHRow; + old_endcol = screen->endHCol; + if (frow == old_startrow && fcol == old_startcol && + trow == old_endrow && tcol == old_endcol) return; + screen->startHRow = frow; + screen->startHCol = fcol; + screen->endHRow = trow; + screen->endHCol = tcol; + from = Coordinate(frow, fcol); + to = Coordinate(trow, tcol); + if (to <= screen->startHCoord || from > screen->endHCoord) { + /* No overlap whatsoever between old and new hilite */ + ReHiliteText(old_startrow, old_startcol, old_endrow, old_endcol); + ReHiliteText(frow, fcol, trow, tcol); + } else { + if (from < screen->startHCoord) { + /* Extend left end */ + ReHiliteText(frow, fcol, old_startrow, old_startcol); + } else if (from > screen->startHCoord) { + /* Shorten left end */ + ReHiliteText(old_startrow, old_startcol, frow, fcol); + } + if (to > screen->endHCoord) { + /* Extend right end */ + ReHiliteText(old_endrow, old_endcol, trow, tcol); + } else if (to < screen->endHCoord) { + /* Shorten right end */ + ReHiliteText(trow, tcol, old_endrow, old_endcol); + } + } + screen->startHCoord = from; + screen->endHCoord = to; +} + +static void +ReHiliteText(frow, fcol, trow, tcol) + register int frow, fcol, trow, tcol; + /* Guaranteed that (frow, fcol) <= (trow, tcol) */ +{ + register TScreen *screen = &term->screen; + register int i; + + if (frow < 0) + frow = fcol = 0; + else if (frow > screen->max_row) + return; /* nothing to do, since trow >= frow */ + + if (trow < 0) + return; /* nothing to do, since frow <= trow */ + else if (trow > screen->max_row) { + trow = screen->max_row; + tcol = screen->max_col+1; + } + if (frow == trow && fcol == tcol) + return; + + if(frow != trow) { /* do multiple rows */ + if((i = screen->max_col - fcol + 1) > 0) { /* first row */ + ScrnRefresh(screen, frow, fcol, 1, i, True); + } + if((i = trow - frow - 1) > 0) { /* middle rows*/ + ScrnRefresh(screen, frow+1, 0,i, screen->max_col+1, True); + } + if(tcol > 0 && trow <= screen->max_row) { /* last row */ + ScrnRefresh(screen, trow, 0, 1, tcol, True); + } + } else { /* do single row */ + ScrnRefresh(screen, frow, fcol, 1, tcol - fcol, True); + } +} + +static void _OwnSelection(); + +static void +SaltTextAway(crow, ccol, row, col, params, num_params) + /*register*/ int crow, ccol, row, col; + String *params; /* selections */ + Cardinal num_params; + /* Guaranteed that (crow, ccol) <= (row, col), and that both points are valid + (may have row = screen->max_row+1, col = 0) */ +{ + register TScreen *screen = &term->screen; + register int i, j = 0; + int eol; + char *line, *lp; + + if (crow == row && ccol > col) { + int tmp = ccol; + ccol = col; + col = tmp; + } + + --col; + /* first we need to know how long the string is before we can save it*/ + + if ( row == crow ) j = Length(screen, crow, ccol, col); + else { /* two cases, cut is on same line, cut spans multiple lines */ + j += Length(screen, crow, ccol, screen->max_col) + 1; + for(i = crow + 1; i < row; i++) + j += Length(screen, i, 0, screen->max_col) + 1; + if (col >= 0) + j += Length(screen, row, 0, col); + } + + /* now get some memory to save it in */ + + if (screen->selection_size <= j) { + if((line = malloc((unsigned) j + 1)) == (char *)NULL) + SysError(ERROR_BMALLOC2); + XtFree(screen->selection); + screen->selection = line; + screen->selection_size = j + 1; + } else line = screen->selection; + if (!line || j < 0) return; + + line[j] = '\0'; /* make sure it is null terminated */ + lp = line; /* lp points to where to save the text */ + if ( row == crow ) lp = SaveText(screen, row, ccol, col, lp, &eol); + else { + lp = SaveText(screen, crow, ccol, screen->max_col, lp, &eol); + if (eol) + *lp ++ = '\n'; /* put in newline at end of line */ + for(i = crow +1; i < row; i++) { + lp = SaveText(screen, i, 0, screen->max_col, lp, &eol); + if (eol) + *lp ++ = '\n'; + } + if (col >= 0) + lp = SaveText(screen, row, 0, col, lp, &eol); + } + *lp = '\0'; /* make sure we have end marked */ + + screen->selection_length = (lp - line); + _OwnSelection(term, params, num_params); +} + +static Boolean ConvertSelection(w, selection, target, + type, value, length, format) +Widget w; +Atom *selection, *target, *type; +XtPointer *value; +unsigned long *length; +int *format; +{ + Display* d = XtDisplay(w); + XgtermWidget xgterm = (XgtermWidget)w; + + if (xgterm->screen.selection == NULL) return False; /* can this happen? */ + + if (*target == XA_TARGETS(d)) { + Atom* targetP; + Atom* std_targets; + unsigned long std_length; + XmuConvertStandardSelection( + w, xgterm->screen.selection_time, selection, + target, type, (caddr_t*)&std_targets, &std_length, format + ); + *length = std_length + 5; + *value = (XtPointer)XtMalloc(sizeof(Atom)*(*length)); + targetP = *(Atom**)value; + *targetP++ = XA_STRING; + *targetP++ = XA_TEXT(d); + *targetP++ = XA_COMPOUND_TEXT(d); + *targetP++ = XA_LENGTH(d); + *targetP++ = XA_LIST_LENGTH(d); + memmove( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); + XtFree((char*)std_targets); + *type = XA_ATOM; + *format = 32; + return True; + } + + if (*target == XA_STRING || + *target == XA_TEXT(d) || + *target == XA_COMPOUND_TEXT(d)) { + if (*target == XA_COMPOUND_TEXT(d)) + *type = *target; + else + *type = XA_STRING; + *value = xgterm->screen.selection; + *length = xgterm->screen.selection_length; + *format = 8; + return True; + } + if (*target == XA_LIST_LENGTH(d)) { + *value = XtMalloc(4); + if (sizeof(long) == 4) + *(long*)*value = 1; + else { + long temp = 1; + memmove( (char*)*value, ((char*)&temp)+sizeof(long)-4, 4); + } + *type = XA_INTEGER; + *length = 1; + *format = 32; + return True; + } + if (*target == XA_LENGTH(d)) { + *value = XtMalloc(4); + if (sizeof(long) == 4) + *(long*)*value = xgterm->screen.selection_length; + else { + long temp = xgterm->screen.selection_length; + memmove( (char*)*value, ((char*)&temp)+sizeof(long)-4, 4); + } + *type = XA_INTEGER; + *length = 1; + *format = 32; + return True; + } + if (XmuConvertStandardSelection(w, xgterm->screen.selection_time, selection, + target, type, + (caddr_t *)value, length, format)) + return True; + + /* else */ + return False; + +} + + +static void LoseSelection(w, selection) + Widget w; + Atom *selection; +{ + register TScreen* screen = &((XgtermWidget)w)->screen; + register Atom* atomP; + int i; + for (i = 0, atomP = screen->selection_atoms; + i < screen->selection_count; i++, atomP++) + { + if (*selection == *atomP) *atomP = (Atom)0; + switch (*atomP) { + case XA_CUT_BUFFER0: + case XA_CUT_BUFFER1: + case XA_CUT_BUFFER2: + case XA_CUT_BUFFER3: + case XA_CUT_BUFFER4: + case XA_CUT_BUFFER5: + case XA_CUT_BUFFER6: + case XA_CUT_BUFFER7: *atomP = (Atom)0; + } + } + + for (i = screen->selection_count; i; i--) { + if (screen->selection_atoms[i-1] != 0) break; + } + screen->selection_count = i; + + for (i = 0, atomP = screen->selection_atoms; + i < screen->selection_count; i++, atomP++) + { + if (*atomP == (Atom)0) { + *atomP = screen->selection_atoms[--screen->selection_count]; + } + } + + if (screen->selection_count == 0) + TrackText(0, 0, 0, 0); +} + + +/* ARGSUSED */ +static void SelectionDone(w, selection, target) +Widget w; +Atom *selection, *target; +{ + /* empty proc so Intrinsics know we want to keep storage */ +} + + +static void _OwnSelection(termw, selections, count) + register XgtermWidget termw; + String *selections; + Cardinal count; +{ + Atom* atoms = termw->screen.selection_atoms; + int i; + Boolean have_selection = False; + + if (termw->screen.selection_length < 0) return; + + if (count > termw->screen.sel_atoms_size) { + XtFree((char*)atoms); + atoms = (Atom*)XtMalloc(count*sizeof(Atom)); + termw->screen.selection_atoms = atoms; + termw->screen.sel_atoms_size = count; + } + XmuInternStrings( XtDisplay((Widget)termw), selections, count, atoms ); + for (i = 0; i < count; i++) { + int cutbuffer; + switch (atoms[i]) { + case XA_CUT_BUFFER0: cutbuffer = 0; break; + case XA_CUT_BUFFER1: cutbuffer = 1; break; + case XA_CUT_BUFFER2: cutbuffer = 2; break; + case XA_CUT_BUFFER3: cutbuffer = 3; break; + case XA_CUT_BUFFER4: cutbuffer = 4; break; + case XA_CUT_BUFFER5: cutbuffer = 5; break; + case XA_CUT_BUFFER6: cutbuffer = 6; break; + case XA_CUT_BUFFER7: cutbuffer = 7; break; + default: cutbuffer = -1; + } + if (cutbuffer >= 0) + if ( termw->screen.selection_length > + 4*XMaxRequestSize(XtDisplay((Widget)termw))-32) + fprintf(stderr, + "%s: selection too big (%d bytes), not storing in CUT_BUFFER%d\n", + xgterm_name, termw->screen.selection_length, cutbuffer); + else + XStoreBuffer( XtDisplay((Widget)termw), termw->screen.selection, + termw->screen.selection_length, cutbuffer ); + else if (!replyToEmacs) { + have_selection |= + XtOwnSelection( (Widget)termw, atoms[i], + termw->screen.selection_time, + ConvertSelection, LoseSelection, SelectionDone ); + } + } + if (!replyToEmacs) + termw->screen.selection_count = count; + if (!have_selection) + TrackText(0, 0, 0, 0); +} + +/* void */ +DisownSelection(termw) + register XgtermWidget termw; +{ + Atom* atoms = termw->screen.selection_atoms; + Cardinal count = termw->screen.selection_count; + int i; + + for (i = 0; i < count; i++) { + int cutbuffer; + switch (atoms[i]) { + case XA_CUT_BUFFER0: cutbuffer = 0; break; + case XA_CUT_BUFFER1: cutbuffer = 1; break; + case XA_CUT_BUFFER2: cutbuffer = 2; break; + case XA_CUT_BUFFER3: cutbuffer = 3; break; + case XA_CUT_BUFFER4: cutbuffer = 4; break; + case XA_CUT_BUFFER5: cutbuffer = 5; break; + case XA_CUT_BUFFER6: cutbuffer = 6; break; + case XA_CUT_BUFFER7: cutbuffer = 7; break; + default: cutbuffer = -1; + } + if (cutbuffer < 0) + XtDisownSelection( (Widget)termw, atoms[i], + termw->screen.selection_time ); + } + termw->screen.selection_count = 0; + termw->screen.startHRow = termw->screen.startHCol = 0; + termw->screen.endHRow = termw->screen.endHCol = 0; +} + + +/* returns number of chars in line from scol to ecol out */ +/* ARGSUSED */ +static int +Length(screen, row, scol, ecol) + register int row, scol, ecol; + register TScreen *screen; +{ + register int lastcol = LastTextCol(row); + + if (ecol > lastcol) + ecol = lastcol; + return (ecol - scol + 1); +} + +/* copies text into line, preallocated */ +static char * +SaveText(screen, row, scol, ecol, lp, eol) + int row; + int scol, ecol; + TScreen *screen; + register char *lp; /* pointer to where to put the text */ + int *eol; +{ + register int i = 0; + register Char *ch = screen->buf[4 * (row + screen->topline)]; + Char attr; + register int c; + + *eol = 0; + i = Length(screen, row, scol, ecol); + ecol = scol + i; + if (*eol == 0) { + if(ScrnGetAttributes(screen, row + screen->topline, 0, &attr, 1) == 1) { + *eol = (attr & LINEWRAPPED) ? 0 : 1; + } else { + /* If we can't get the attributes, assume no wrap */ + /* CANTHAPPEN */ + (void)fprintf(stderr, "%s: no attributes for %d, %d\n", + xgterm_name, row, ecol - 1); + *eol = 1; + } + } + for (i = scol; i < ecol; i++) { + c = ch[i]; + if (c == 0) + c = ' '; + else if(c < ' ') { + if(c == '\036') + c = '#'; /* char on screen is pound sterling */ + else + c += 0x5f; /* char is from DEC drawing set */ + } else if(c == 0x7f) + c = 0x5f; + *lp++ = c; + } + return(lp); +} + +static void +EditorButton(event) + register XButtonEvent *event; +{ + register TScreen *screen = &term->screen; + int pty = screen->respond; + char line[6]; + register unsigned row, col; + int button; + + button = event->button - 1; + + row = (event->y - screen->border) + / FontHeight(screen); + if (term->misc.sb_right) + col = (event->x - screen->border) / FontWidth(screen); + else + col = (event->x - screen->border - screen->scrollbar) / FontWidth(screen); + (void) strcpy(line, "\033[M"); + if (screen->send_mouse_pos == 1) { + line[3] = ' ' + button; + } else { + line[3] = ' ' + (KeyState(event->state) << 2) + + ((event->type == ButtonPress)? button:3); + } + line[4] = ' ' + col + 1; + line[5] = ' ' + row + 1; + v_write(pty, line, 6); +} + + +/* ARGSUSED */ +void HandleSecure(w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* [0] = volume */ + Cardinal *param_count; /* 0 or 1 */ +{ + Time time = CurrentTime; + + if ((event->xany.type == KeyPress) || + (event->xany.type == KeyRelease)) + time = event->xkey.time; + else if ((event->xany.type == ButtonPress) || + (event->xany.type == ButtonRelease)) + time = event->xbutton.time; + DoSecureKeyboard (time); +} diff --git a/vendor/x11iraf/xgterm/charproc.c b/vendor/x11iraf/xgterm/charproc.c new file mode 100644 index 00000000..51a44c9d --- /dev/null +++ b/vendor/x11iraf/xgterm/charproc.c @@ -0,0 +1,3877 @@ +/* + * $XConsortium: charproc.c,v 1.180 94/04/17 20:23:25 hersh Exp $ + */ +/* + +Copyright (c) 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* charproc.c */ + +#include "ptyx.h" +#include "VTparse.h" +#include "data.h" +#include "error.h" +#include "menu.h" +#include "main.h" +#include <X11/Xos.h> +#include <X11/Xatom.h> +#include <X11/Xutil.h> +#include <X11/cursorfont.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Atoms.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xmu/Converters.h> +#ifdef I18N +#include <X11/Xaw/XawImP.h> +#endif +#include <stdio.h> +#include <errno.h> +#include <setjmp.h> +#include <ctype.h> + + +/* + * Check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX + * systems are broken and return EWOULDBLOCK when they should return EAGAIN. + * Note that this macro may evaluate its argument more than once. + */ +#if defined(EAGAIN) && defined(EWOULDBLOCK) +#define E_TEST(err) ((err) == EAGAIN || (err) == EWOULDBLOCK) +#else +#ifdef EAGAIN +#define E_TEST(err) ((err) == EAGAIN) +#else +#define E_TEST(err) ((err) == EWOULDBLOCK) +#endif +#endif + +extern jmp_buf VTend; + +extern XtAppContext app_con; +extern Widget toplevel; +extern void exit(); +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#else +extern char *malloc(); +extern char *realloc(); +#endif + + +static void VTallocbuf(); +static int finput(); +static void dotext(); +static void WriteText(); +static int in_put(); +static void do_read(), do_write(); +static void ToAlternate(); +static void FromAlternate(); +static void update_font_info(); + +static void bitset(), bitclr(); + +#define DEFAULT -1 +#define TEXT_BUF_SIZE 1024 +#define TRACKTIMESEC 4L +#define TRACKTIMEUSEC 0L +#define BELLSUPPRESSMSEC 200 + +#define XtNalwaysHighlight "alwaysHighlight" +#define XtNappcursorDefault "appcursorDefault" +#define XtNappkeypadDefault "appkeypadDefault" +#define XtNbellSuppressTime "bellSuppressTime" +#define XtNboldFont "boldFont" +#define XtNc132 "c132" +#define XtNcharClass "charClass" +#define XtNcurses "curses" +#define XtNhpLowerleftBugCompat "hpLowerleftBugCompat" +#define XtNcursorColor "cursorColor" +#define XtNcutNewline "cutNewline" +#define XtNcutToBeginningOfLine "cutToBeginningOfLine" +#define XtNeightBitInput "eightBitInput" +#define XtNeightBitOutput "eightBitOutput" +#define XtNgeometry "geometry" +#define XtNtekGeometry "tekGeometry" +#define XtNinternalBorder "internalBorder" +#define XtNjumpScroll "jumpScroll" +#ifdef ALLOWLOGGING +#define XtNlogFile "logFile" +#define XtNlogging "logging" +#define XtNlogInhibit "logInhibit" +#endif +#define XtNloginShell "loginShell" +#define XtNmarginBell "marginBell" +#define XtNpointerColor "pointerColor" +#define XtNpointerColorBackground "pointerColorBackground" +#define XtNpointerShape "pointerShape" +#define XtNmultiClickTime "multiClickTime" +#define XtNmultiScroll "multiScroll" +#define XtNnMarginBell "nMarginBell" +#define XtNresizeGravity "resizeGravity" +#define XtNreverseWrap "reverseWrap" +#define XtNautoWrap "autoWrap" +#define XtNsaveLines "saveLines" +#define XtNscrollBar "scrollBar" +#define XtNscrollTtyOutput "scrollTtyOutput" +#define XtNscrollKey "scrollKey" +#define XtNscrollLines "scrollLines" +#define XtNscrollPos "scrollPos" +#define XtNsignalInhibit "signalInhibit" +#define XtNtekInhibit "tekInhibit" +#define XtNtekStartup "tekStartup" +#define XtNtiteInhibit "titeInhibit" +#define XtNunderLine "underLine" +#define XtNvisualBell "visualBell" +#define XtNallowSendEvents "allowSendEvents" +#define XtNcolor0 "color0" +#define XtNcolor1 "color1" +#define XtNcolor2 "color2" +#define XtNcolor3 "color3" +#define XtNcolor4 "color4" +#define XtNcolor5 "color5" +#define XtNcolor6 "color6" +#define XtNcolor7 "color7" +#define XtNcolor8 "color8" +#define XtNcolor9 "color9" +#define XtNcolor10 "color10" +#define XtNcolor11 "color11" +#define XtNcolor12 "color12" +#define XtNcolor13 "color13" +#define XtNcolor14 "color14" +#define XtNcolor15 "color15" +#define XtNcolorBD "colorBD" +#define XtNcolorUL "colorUL" +#define XtNdynamicColors "dynamicColors" +#define XtNscrollBarRight "scrollBarRight" + +#define XtCAlwaysHighlight "AlwaysHighlight" +#define XtCAppcursorDefault "AppcursorDefault" +#define XtCAppkeypadDefault "AppkeypadDefault" +#define XtCBellSuppressTime "BellSuppressTime" +#define XtCBoldFont "BoldFont" +#define XtCC132 "C132" +#define XtCCharClass "CharClass" +#define XtCCurses "Curses" +#define XtCHpLowerleftBugCompat "HpLowerleftBugCompat" +#define XtCCutNewline "CutNewline" +#define XtCCutToBeginningOfLine "CutToBeginningOfLine" +#define XtCEightBitInput "EightBitInput" +#define XtCEightBitOutput "EightBitOutput" +#define XtCGeometry "Geometry" +#define XtCJumpScroll "JumpScroll" +#ifdef ALLOWLOGGING +#define XtCLogfile "Logfile" +#define XtCLogging "Logging" +#define XtCLogInhibit "LogInhibit" +#endif +#define XtCLoginShell "LoginShell" +#define XtCMarginBell "MarginBell" +#define XtCMultiClickTime "MultiClickTime" +#define XtCMultiScroll "MultiScroll" +#define XtCColumn "Column" +#define XtCResizeGravity "ResizeGravity" +#define XtCReverseWrap "ReverseWrap" +#define XtCAutoWrap "AutoWrap" +#define XtCSaveLines "SaveLines" +#define XtCScrollBar "ScrollBar" +#define XtCScrollLines "ScrollLines" +#define XtCScrollPos "ScrollPos" +#define XtCScrollCond "ScrollCond" +#define XtCSignalInhibit "SignalInhibit" +#define XtCTekInhibit "TekInhibit" +#define XtCTekStartup "TekStartup" +#define XtCTiteInhibit "TiteInhibit" +#define XtCUnderLine "UnderLine" +#define XtCVisualBell "VisualBell" +#define XtCAllowSendEvents "AllowSendEvents" +#define XtCDynamicColors "DynamicColors" +#define XtCScrollBarRight "ScrollBarRight" + +#define doinput() (bcnt-- > 0 ? *bptr++ : in_put()) + +static int nparam; +static ANSI reply; +static int param[NPARAM]; + +static unsigned long ctotal; +static unsigned long ntotal; +static jmp_buf vtjmpbuf; + +extern int groundtable[]; +extern int csitable[]; +extern int dectable[]; +extern int eigtable[]; +extern int esctable[]; +extern int iestable[]; +extern int igntable[]; +extern int scrtable[]; +extern int scstable[]; + + +/* event handlers */ +extern void HandleKeyPressed(), HandleEightBitKeyPressed(); +extern void HandleStringEvent(); +extern void HandleEnterWindow(); +extern void HandleLeaveWindow(); +extern void HandleBellPropertyChange(); +extern void HandleFocusChange(); +static void HandleKeymapChange(); +extern void HandleInsertSelection(); +extern void HandleSelectStart(), HandleKeyboardSelectStart(); +extern void HandleSelectExtend(), HandleSelectSet(); +extern void HandleSelectEnd(), HandleKeyboardSelectEnd(); +extern void HandleStartExtend(), HandleKeyboardStartExtend(); +static void HandleBell(); +static void HandleVisualBell(); +static void HandleIgnore(); +extern void HandleSecure(); +extern void HandleScrollForward(); +extern void HandleScrollBack(); +extern void HandleCreateMenu(), HandlePopupMenu(); +extern void HandleSetFont(); +extern void SetVTFont(); + +extern void ViButton(), DiredButton(); +extern Boolean SendMousePosition(); +extern void ScrnSetAttributes(); + +/* + * NOTE: VTInitialize zeros out the entire ".screen" component of the + * XgtermWidget, so make sure to add an assignment statement in VTInitialize() + * for each new ".screen" field added to this resource list. + */ + +/* Defaults */ +static Boolean defaultFALSE = FALSE; +static Boolean defaultTRUE = TRUE; +static int defaultBorderWidth = DEFBORDERWIDTH; +static int defaultIntBorder = DEFBORDER; +static int defaultSaveLines = SAVELINES; +static int defaultScrollLines = SCROLLLINES; +static int defaultNMarginBell = N_MARGINBELL; +static int defaultMultiClickTime = MULTICLICKTIME; +static int defaultBellSuppressTime = BELLSUPPRESSMSEC; +static char * _Font_Selected_ = "yes"; /* string is arbitrary */ + +/* + * Warning, the following must be kept under 1024 bytes or else some + * compilers (particularly AT&T 6386 SVR3.2) will barf). Workaround is to + * declare a static buffer and copy in at run time (the the Athena text widget + * does). Yuck. + */ +static char defaultTranslations[] = +"\ + Shift <KeyPress> Prior:scroll-back(1,halfpage) \n\ + Shift <KeyPress> Next:scroll-forw(1,halfpage) \n\ +Shift <KeyPress> Select:select-cursor-start() select-cursor-end(PRIMARY, CUT_BUFFER0) \n\ +Shift <KeyPress> Insert:insert-selection(PRIMARY, CUT_BUFFER0) \n\ + ~Meta <KeyPress>:insert-seven-bit() \n\ + Meta <KeyPress>:insert-eight-bit() \n\ + !Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ + !Lock Ctrl <Btn1Down>:popup-menu(mainMenu) \n\ + ~Meta <Btn1Down>:select-start() \n\ + ~Meta <Btn1Motion>:select-extend() \n\ + !Ctrl <Btn2Down>:popup-menu(fontMenu) \n\ + !Lock Ctrl <Btn2Down>:popup-menu(fontMenu) \n\ + ~Ctrl ~Meta <Btn2Down>:ignore() \n\ + ~Ctrl ~Meta <Btn2Up>:insert-selection(PRIMARY, CUT_BUFFER0) \n\ + !Ctrl <Btn3Down>:popup-menu(vtMenu) \n\ + !Lock Ctrl <Btn3Down>:popup-menu(vtMenu) \n\ + ~Ctrl ~Meta <Btn3Down>:start-extend() \n\ + ~Meta <Btn3Motion>:select-extend() \n\ + <BtnUp>:select-end(PRIMARY, CUT_BUFFER0) \n\ + <BtnDown>:bell(0) \ +"; + +static XtActionsRec actionsList[] = { + { "bell", HandleBell }, + { "create-menu", HandleCreateMenu }, + { "ignore", HandleIgnore }, + { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */ + { "insert-seven-bit", HandleKeyPressed }, + { "insert-eight-bit", HandleEightBitKeyPressed }, + { "insert-selection", HandleInsertSelection }, + { "keymap", HandleKeymapChange }, + { "popup-menu", HandlePopupMenu }, + { "secure", HandleSecure }, + { "select-start", HandleSelectStart }, + { "select-extend", HandleSelectExtend }, + { "select-end", HandleSelectEnd }, + { "select-set", HandleSelectSet }, + { "select-cursor-start", HandleKeyboardSelectStart }, + { "select-cursor-end", HandleKeyboardSelectEnd }, + { "set-vt-font", HandleSetFont }, + { "start-extend", HandleStartExtend }, + { "start-cursor-extend", HandleKeyboardStartExtend }, + { "string", HandleStringEvent }, + { "scroll-forw", HandleScrollForward }, + { "scroll-back", HandleScrollBack }, + /* menu actions */ + { "allow-send-events", HandleAllowSends }, + { "set-visual-bell", HandleSetVisualBell }, +#ifdef ALLOWLOGGING + { "set-logging", HandleLogging }, +#endif + { "redraw", HandleRedraw }, + { "send-signal", HandleSendSignal }, + { "quit", HandleQuit }, + { "set-scrollbar", HandleScrollbar }, + { "set-jumpscroll", HandleJumpscroll }, + { "set-reverse-video", HandleReverseVideo }, + { "set-autowrap", HandleAutoWrap }, + { "set-reversewrap", HandleReverseWrap }, + { "set-autolinefeed", HandleAutoLineFeed }, + { "set-appcursor", HandleAppCursor }, + { "set-appkeypad", HandleAppKeypad }, + { "set-scroll-on-key", HandleScrollKey }, + { "set-scroll-on-tty-output", HandleScrollTtyOutput }, + { "set-allow132", HandleAllow132 }, + { "set-cursesemul", HandleCursesEmul }, + { "set-marginbell", HandleMarginBell }, + { "set-altscreen", HandleAltScreen }, + { "soft-reset", HandleSoftReset }, + { "hard-reset", HandleHardReset }, + { "clear-saved-lines", HandleClearSavedLines }, + { "set-terminal-type", HandleSetTerminalType }, + { "set-visibility", HandleVisibility }, + { "tek-page", HandleTekPage }, + { "tek-reset", HandleTekReset }, + { "tek-copy", HandleTekCopy }, + { "visual-bell", HandleVisualBell }, + { "dired-button", DiredButton }, + { "vi-button", ViButton }, +}; + +static XtResource resources[] = { +{XtNfont, XtCFont, XtRString, sizeof(char *), + XtOffsetOf(XgtermWidgetRec, misc.f_n), XtRString, + DEFFONT}, +{XtNboldFont, XtCBoldFont, XtRString, sizeof(char *), + XtOffsetOf(XgtermWidgetRec, misc.f_b), XtRString, + DEFBOLDFONT}, +{XtNc132, XtCC132, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.c132), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNcharClass, XtCCharClass, XtRString, sizeof(char *), + XtOffsetOf(XgtermWidgetRec, screen.charClass), + XtRString, (XtPointer) NULL}, +{XtNcurses, XtCCurses, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.curses), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.hp_ll_bc), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNcutNewline, XtCCutNewline, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.cutNewline), + XtRBoolean, (XtPointer) &defaultTRUE}, +{XtNcutToBeginningOfLine, XtCCutToBeginningOfLine, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.cutToBeginningOfLine), + XtRBoolean, (XtPointer) &defaultTRUE}, +{XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, core.background_pixel), + XtRString, "XtDefaultBackground"}, +{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.foreground), + XtRString, "XtDefaultForeground"}, +{XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.cursorcolor), + XtRString, "XtDefaultForeground"}, +{XtNeightBitInput, XtCEightBitInput, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.input_eight_bits), + XtRBoolean, (XtPointer) &defaultTRUE}, +{XtNeightBitOutput, XtCEightBitOutput, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.output_eight_bits), + XtRBoolean, (XtPointer) &defaultTRUE}, +{XtNgeometry,XtCGeometry, XtRString, sizeof(char *), + XtOffsetOf(XgtermWidgetRec, misc.geo_metry), + XtRString, (XtPointer) NULL}, +{XtNalwaysHighlight,XtCAlwaysHighlight,XtRBoolean, + sizeof(Boolean),XtOffsetOf(XgtermWidgetRec, screen.always_highlight), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNappcursorDefault,XtCAppcursorDefault,XtRBoolean, + sizeof(Boolean),XtOffsetOf(XgtermWidgetRec, misc.appcursorDefault), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNappkeypadDefault,XtCAppkeypadDefault,XtRBoolean, + sizeof(Boolean),XtOffsetOf(XgtermWidgetRec, misc.appkeypadDefault), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNbellSuppressTime, XtCBellSuppressTime, XtRInt, sizeof(int), + XtOffsetOf(XgtermWidgetRec, screen.bellSuppressTime), + XtRInt, (XtPointer) &defaultBellSuppressTime}, +{XtNtekGeometry,XtCGeometry, XtRString, sizeof(char *), + XtOffsetOf(XgtermWidgetRec, misc.T_geometry), + XtRString, (XtPointer) NULL}, +{XtNalwaysHighlight,XtCAlwaysHighlight,XtRBoolean, + sizeof(Boolean),XtOffset(XgtermWidget, screen.always_highlight), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNinternalBorder,XtCBorderWidth,XtRInt, sizeof(int), + XtOffsetOf(XgtermWidgetRec, screen.border), + XtRInt, (XtPointer) &defaultIntBorder}, +{XtNjumpScroll, XtCJumpScroll, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.jumpscroll), + XtRBoolean, (XtPointer) &defaultTRUE}, +#ifdef ALLOWLOGGING +{XtNlogFile, XtCLogfile, XtRString, sizeof(char *), + XtOffsetOf(XgtermWidgetRec, screen.logfile), + XtRString, (XtPointer) NULL}, +{XtNlogging, XtCLogging, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.log_on), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNlogInhibit, XtCLogInhibit, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.logInhibit), + XtRBoolean, (XtPointer) &defaultFALSE}, +#endif +{XtNloginShell, XtCLoginShell, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.login_shell), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNmarginBell, XtCMarginBell, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.marginbell), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.mousecolor), + XtRString, "XtDefaultForeground"}, +{XtNpointerColorBackground, XtCBackground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.mousecolorback), + XtRString, "XtDefaultBackground"}, +{XtNpointerShape,XtCCursor, XtRCursor, sizeof(Cursor), + XtOffsetOf(XgtermWidgetRec, screen.pointer_cursor), + XtRString, (XtPointer) "xterm"}, +{XtNmultiClickTime,XtCMultiClickTime, XtRInt, sizeof(int), + XtOffsetOf(XgtermWidgetRec, screen.multiClickTime), + XtRInt, (XtPointer) &defaultMultiClickTime}, +{XtNmultiScroll,XtCMultiScroll, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.multiscroll), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNnMarginBell,XtCColumn, XtRInt, sizeof(int), + XtOffsetOf(XgtermWidgetRec, screen.nmarginbell), + XtRInt, (XtPointer) &defaultNMarginBell}, +{XtNreverseVideo,XtCReverseVideo,XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.re_verse), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNresizeGravity, XtCResizeGravity, XtRGravity, sizeof(XtGravity), + XtOffsetOf(XgtermWidgetRec, misc.resizeGravity), + XtRImmediate, (XtPointer) SouthWestGravity}, +{XtNreverseWrap,XtCReverseWrap, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.reverseWrap), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNautoWrap,XtCAutoWrap, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.autoWrap), + XtRBoolean, (XtPointer) &defaultTRUE}, +{XtNsaveLines, XtCSaveLines, XtRInt, sizeof(int), + XtOffsetOf(XgtermWidgetRec, screen.savelines), + XtRInt, (XtPointer) &defaultSaveLines}, +{XtNscrollBar, XtCScrollBar, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.scrollbar), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNscrollTtyOutput,XtCScrollCond, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.scrollttyoutput), + XtRBoolean, (XtPointer) &defaultTRUE}, +{XtNscrollKey, XtCScrollCond, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.scrollkey), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNscrollLines, XtCScrollLines, XtRInt, sizeof(int), + XtOffsetOf(XgtermWidgetRec, screen.scrolllines), + XtRInt, (XtPointer) &defaultScrollLines}, +{XtNsignalInhibit,XtCSignalInhibit,XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.signalInhibit), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNtekInhibit, XtCTekInhibit, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.tekInhibit), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNtekStartup, XtCTekStartup, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.TekEmu), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNtiteInhibit, XtCTiteInhibit, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.titeInhibit), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNunderLine, XtCUnderLine, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.underline), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.visualbell), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNallowSendEvents, XtCAllowSendEvents, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, screen.allowSendEvents), + XtRBoolean, (XtPointer) &defaultTRUE}, +{"font1", "Font1", XtRString, sizeof(String), + XtOffsetOf(XgtermWidgetRec, screen.menu_font_names[fontMenu_font1]), + XtRString, (XtPointer) NULL}, +{"font2", "Font2", XtRString, sizeof(String), + XtOffsetOf(XgtermWidgetRec, screen.menu_font_names[fontMenu_font2]), + XtRString, (XtPointer) NULL}, +{"font3", "Font3", XtRString, sizeof(String), + XtOffsetOf(XgtermWidgetRec, screen.menu_font_names[fontMenu_font3]), + XtRString, (XtPointer) NULL}, +{"font4", "Font4", XtRString, sizeof(String), + XtOffsetOf(XgtermWidgetRec, screen.menu_font_names[fontMenu_font4]), + XtRString, (XtPointer) NULL}, +{"font5", "Font5", XtRString, sizeof(String), + XtOffsetOf(XgtermWidgetRec, screen.menu_font_names[fontMenu_font5]), + XtRString, (XtPointer) NULL}, +{"font6", "Font6", XtRString, sizeof(String), + XtOffsetOf(XgtermWidgetRec, screen.menu_font_names[fontMenu_font6]), + XtRString, (XtPointer) NULL}, +#ifdef I18N + {XtNinputMethod, XtCInputMethod, XtRString, sizeof(char*), + XtOffsetOf(XgtermWidgetRec, misc.input_method), + XtRString, (XtPointer)NULL}, + {XtNpreeditType, XtCPreeditType, XtRString, sizeof(char*), + XtOffsetOf(XgtermWidgetRec, misc.preedit_type), + XtRString, (XtPointer)"Root"}, + {XtNopenIm, XtCOpenIm, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.open_im), + XtRImmediate, (XtPointer)TRUE}, +#endif +{XtNcolor0, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_0]), + XtRString, "XtDefaultForeground"}, +{XtNcolor1, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_1]), + XtRString, "XtDefaultForeground"}, +{XtNcolor2, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_2]), + XtRString, "XtDefaultForeground"}, +{XtNcolor3, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_3]), + XtRString, "XtDefaultForeground"}, +{XtNcolor4, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_4]), + XtRString, "XtDefaultForeground"}, +{XtNcolor5, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_5]), + XtRString, "XtDefaultForeground"}, +{XtNcolor6, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_6]), + XtRString, "XtDefaultForeground"}, +{XtNcolor7, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_7]), + XtRString, "XtDefaultForeground"}, +{XtNcolor8, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_8]), + XtRString, "XtDefaultForeground"}, +{XtNcolor9, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_9]), + XtRString, "XtDefaultForeground"}, +{XtNcolor10, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_10]), + XtRString, "XtDefaultForeground"}, +{XtNcolor11, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_11]), + XtRString, "XtDefaultForeground"}, +{XtNcolor12, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_12]), + XtRString, "XtDefaultForeground"}, +{XtNcolor13, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_13]), + XtRString, "XtDefaultForeground"}, +{XtNcolor14, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_14]), + XtRString, "XtDefaultForeground"}, +{XtNcolor15, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_15]), + XtRString, "XtDefaultForeground"}, +{XtNcolorBD, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_BD]), + XtRString, "XtDefaultForeground"}, +{XtNcolorUL, XtCForeground, XtRPixel, sizeof(Pixel), + XtOffsetOf(XgtermWidgetRec, screen.colors[COLOR_UL]), + XtRString, "XtDefaultForeground"}, +{XtNdynamicColors, XtCDynamicColors, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.dynamicColors), + XtRBoolean, (XtPointer) &defaultFALSE}, +{XtNscrollBarRight, XtCScrollBarRight, XtRBoolean, sizeof(Boolean), + XtOffsetOf(XgtermWidgetRec, misc.sb_right), + XtRBoolean, (XtPointer) &defaultFALSE}, +}; + +static void VTClassInit(); +static void VTInitialize(); +static void VTRealize(); +static void VTExpose(); +static void VTResize(); +static void VTDestroy(); +static Boolean VTSetValues(); +#ifdef I18N +static void VTInitI18N(); +#endif + +static WidgetClassRec xgtermClassRec = { + { +/* core_class fields */ + /* superclass */ (WidgetClass) &widgetClassRec, + /* class_name */ "VT100", + /* widget_size */ sizeof(XgtermWidgetRec), + /* class_initialize */ VTClassInit, + /* class_part_initialize */ NULL, + /* class_inited */ FALSE, + /* initialize */ VTInitialize, + /* initialize_hook */ NULL, + /* realize */ VTRealize, + /* actions */ actionsList, + /* num_actions */ XtNumber(actionsList), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ FALSE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ VTDestroy, + /* resize */ VTResize, + /* expose */ VTExpose, + /* set_values */ VTSetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ NULL, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_offsets */ NULL, + /* tm_table */ defaultTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator*/ XtInheritDisplayAccelerator, + /* extension */ NULL + } +}; + +WidgetClass xgtermWidgetClass = (WidgetClass)&xgtermClassRec; + +static void VTparse() +{ + register TScreen *screen = &term->screen; + register int *parsestate = groundtable; + register unsigned int c; + register unsigned char *cp; + register int row, col, top, bot, scstype; + extern int TrackMouse(); + + if(setjmp(vtjmpbuf)) + parsestate = groundtable; + for( ; ; ) { + switch (parsestate[c = doinput()]) { + case CASE_PRINT: + /* printable characters */ + top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt; + cp = bptr; + *--bptr = c; + while(top > 0 && isprint(*cp & 0x7f)) { + top--; + bcnt--; + cp++; + } + if(screen->curss) { + dotext(screen, term->flags, + screen->gsets[screen->curss], bptr, bptr + 1, + term->cur_foreground, + term->cur_background ); + screen->curss = 0; + bptr++; + } + if(bptr < cp) + dotext(screen, term->flags, + screen->gsets[screen->curgl], bptr, cp, + term->cur_foreground, + term->cur_background ); + bptr = cp; + break; + + case CASE_GROUND_STATE: + /* exit ignore mode */ + parsestate = groundtable; + break; + + case CASE_IGNORE_STATE: + /* Ies: ignore anything else */ + parsestate = igntable; + break; + + case CASE_IGNORE_ESC: + /* Ign: escape */ + parsestate = iestable; + break; + + case CASE_IGNORE: + /* Ignore character */ + break; + + case CASE_BELL: + /* bell */ + Bell(); + break; + + case CASE_BS: + /* backspace */ + CursorBack(screen, 1); + break; + + case CASE_CR: + /* carriage return */ + CarriageReturn(screen); + parsestate = groundtable; + break; + + case CASE_ESC: + /* escape */ + parsestate = esctable; + break; + + case CASE_VMOT: + /* + * form feed, line feed, vertical tab + */ + Index(screen, 1); + if (term->flags & LINEFEED) + CarriageReturn(screen); + if (XtAppPending(app_con) || + GetBytesAvailable (ConnectionNumber(screen->display)) > 0) + xevents(); + parsestate = groundtable; + break; + + case CASE_TAB: + /* tab */ + screen->cur_col = TabNext(term->tabs, screen->cur_col); + if (screen->cur_col > screen->max_col) + screen->cur_col = screen->max_col; + break; + + case CASE_SI: + screen->curgl = 0; + break; + + case CASE_SO: + screen->curgl = 1; + break; + + case CASE_SCR_STATE: + /* enter scr state */ + parsestate = scrtable; + break; + + case CASE_SCS0_STATE: + /* enter scs state 0 */ + scstype = 0; + parsestate = scstable; + break; + + case CASE_SCS1_STATE: + /* enter scs state 1 */ + scstype = 1; + parsestate = scstable; + break; + + case CASE_SCS2_STATE: + /* enter scs state 2 */ + scstype = 2; + parsestate = scstable; + break; + + case CASE_SCS3_STATE: + /* enter scs state 3 */ + scstype = 3; + parsestate = scstable; + break; + + case CASE_ESC_IGNORE: + /* unknown escape sequence */ + parsestate = eigtable; + break; + + case CASE_ESC_DIGIT: + /* digit in csi or dec mode */ + if((row = param[nparam - 1]) == DEFAULT) + row = 0; + param[nparam - 1] = 10 * row + (c - '0'); + break; + + case CASE_ESC_SEMI: + /* semicolon in csi or dec mode */ + param[nparam++] = DEFAULT; + break; + + case CASE_DEC_STATE: + /* enter dec mode */ + parsestate = dectable; + break; + + case CASE_ICH: + /* ICH */ + if((row = param[0]) < 1) + row = 1; + InsertChar(screen, row); + parsestate = groundtable; + break; + + case CASE_CUU: + /* CUU */ + if((row = param[0]) < 1) + row = 1; + CursorUp(screen, row); + parsestate = groundtable; + break; + + case CASE_CUD: + /* CUD */ + if((row = param[0]) < 1) + row = 1; + CursorDown(screen, row); + parsestate = groundtable; + break; + + case CASE_CUF: + /* CUF */ + if((row = param[0]) < 1) + row = 1; + CursorForward(screen, row); + parsestate = groundtable; + break; + + case CASE_CUB: + /* CUB */ + if((row = param[0]) < 1) + row = 1; + CursorBack(screen, row); + parsestate = groundtable; + break; + + case CASE_CUP: + /* CUP | HVP */ + if((row = param[0]) < 1) + row = 1; + if(nparam < 2 || (col = param[1]) < 1) + col = 1; + CursorSet(screen, row-1, col-1, term->flags); + parsestate = groundtable; + break; + + case CASE_HP_BUGGY_LL: + /* Some HP-UX applications have the bug that they + assume ESC F goes to the lower left corner of + the screen, regardless of what terminfo says. */ + if (screen->hp_ll_bc) + CursorSet(screen, screen->max_row, 0, term->flags); + parsestate = groundtable; + break; + + case CASE_ED: + /* ED */ + switch (param[0]) { + case DEFAULT: + case 0: + ClearBelow(screen); + break; + + case 1: + ClearAbove(screen); + break; + + case 2: + ClearScreen(screen); + CursorSet(screen, 0, 0, term->flags); + break; + } + parsestate = groundtable; + break; + + case CASE_EL: + /* EL */ + switch (param[0]) { + case DEFAULT: + case 0: + ClearRight(screen); + break; + case 1: + ClearLeft(screen); + break; + case 2: + ClearLine(screen); + break; + } + parsestate = groundtable; + break; + + case CASE_IL: + /* IL */ + if((row = param[0]) < 1) + row = 1; + InsertLine(screen, row); + parsestate = groundtable; + break; + + case CASE_DL: + /* DL */ + if((row = param[0]) < 1) + row = 1; + DeleteLine(screen, row); + parsestate = groundtable; + break; + + case CASE_DCH: + /* DCH */ + if((row = param[0]) < 1) + row = 1; + DeleteChar(screen, row); + parsestate = groundtable; + break; + + case CASE_TRACK_MOUSE: + /* Track mouse as long as in window and between + specified rows */ + TrackMouse(param[0], param[2]-1, param[1]-1, + param[3]-1, param[4]-2); + break; + + case CASE_DECID: + param[0] = -1; /* Default ID parameter */ + /* Fall through into ... */ + case CASE_DA1: + /* DA1 */ + if (param[0] <= 0) { /* less than means DEFAULT */ + reply.a_type = CSI; + reply.a_pintro = '?'; + reply.a_nparam = 2; + reply.a_param[0] = 1; /* VT102 */ + reply.a_param[1] = 2; /* VT102 */ + reply.a_inters = 0; + reply.a_final = 'c'; + unparseseq(&reply, screen->respond); + } + parsestate = groundtable; + break; + + case CASE_TBC: + /* TBC */ + if ((row = param[0]) <= 0) /* less than means default */ + TabClear(term->tabs, screen->cur_col); + else if (row == 3) + TabZonk(term->tabs); + parsestate = groundtable; + break; + + case CASE_SET: + /* SET */ + ansi_modes(term, bitset); + parsestate = groundtable; + break; + + case CASE_RST: + /* RST */ + ansi_modes(term, bitclr); + parsestate = groundtable; + break; + + case CASE_SGR: + /* SGR */ + for (row=0; row<nparam; ++row) { + switch (param[row]) { + case DEFAULT: + case 0: + term->flags &= + ~(INVERSE|BOLD|UNDERLINE|FG_COLOR|BG_COLOR); + break; + case 1: + case 5: /* Blink, really. */ + term->flags |= BOLD; + if (term->misc.dynamicColors) { + if (!(term->flags & FG_COLOR) || + (term->cur_foreground==COLOR_UL)) { + term->flags |= FG_COLOR; + term->cur_foreground = COLOR_BD; + } else { /* Set highlight bit */ + if (term->cur_foreground < 8) + term->cur_foreground |= 8; + } + } + break; + case 4: /* Underscore */ + term->flags |= UNDERLINE; + if (term->misc.dynamicColors) { +/**/ if (!(term->flags & FG_COLOR)) { + term->flags |= FG_COLOR; + term->cur_foreground = COLOR_UL; + } + } + break; + case 7: + term->flags |= INVERSE; + break; + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + term->flags |= FG_COLOR; + term->cur_foreground = param[row] - 30; + /* Set highlight bit if bold on */ + if (term->flags & BOLD) + term->cur_foreground |= 8; + break; + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + term->flags |= BG_COLOR; + term->cur_background = param[row] - 40; + break; + } + } + parsestate = groundtable; + break; + + case CASE_CPR: + /* CPR */ + if ((row = param[0]) == 5) { + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 1; + reply.a_param[0] = 0; + reply.a_inters = 0; + reply.a_final = 'n'; + unparseseq(&reply, screen->respond); + } else if (row == 6) { + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 2; + reply.a_param[0] = screen->cur_row+1; + reply.a_param[1] = screen->cur_col+1; + reply.a_inters = 0; + reply.a_final = 'R'; + unparseseq(&reply, screen->respond); + } + parsestate = groundtable; + break; + + case CASE_HP_MEM_LOCK: + case CASE_HP_MEM_UNLOCK: + if(screen->scroll_amt) + FlushScroll(screen); + if (parsestate[c] == CASE_HP_MEM_LOCK) + screen->top_marg = screen->cur_row; + else + screen->top_marg = 0; + parsestate = groundtable; + break; + + case CASE_DECSTBM: + /* DECSTBM - set scrolling region */ + if((top = param[0]) < 1) + top = 1; + if(nparam < 2 || (bot = param[1]) == DEFAULT + || bot > screen->max_row + 1 + || bot == 0) + bot = screen->max_row+1; + if (bot > top) { + if(screen->scroll_amt) + FlushScroll(screen); + screen->top_marg = top-1; + screen->bot_marg = bot-1; + CursorSet(screen, 0, 0, term->flags); + } + parsestate = groundtable; + break; + + case CASE_SUNREQTPARM: + /* Escape commands or query functions used by the + * SunView shelltool (ttysw widget). Most of these + * are currently stubbed out. + */ + if ((row = param[0]) == DEFAULT) + row = 18; + switch (row) { + case 1: + /* open */ + break; + case 2: + /* close */ + break; + case 3: + /* move */ + break; + case 4: + /* resize */ + break; + case 5: + /* front */ + break; + case 6: + /* back */ + break; + case 7: + /* refresh */ + break; + case 11: + /* report if open or iconic by sending + * \E[1t or \E[2t. + */ + break; + case 13: + /* report position by sending \E[3;TOP;LEFTt + */ + break; + case 14: + /* report size in pixels by sending \E[4;HT;WIDTHt. + */ + break; + case 18: + /* report size in characters by sending + * \E[8;ROWS;COLSt. + */ + reply.a_type = ESC; + reply.a_pintro = '['; + reply.a_nparam = 3; + reply.a_param[0] = 8; + reply.a_param[1] = screen->max_row + 1; + reply.a_param[2] = screen->max_col + 1; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(&reply, screen->respond); + break; + case 20: + /* report icon label by sending \E]Llabel\E\. + */ + break; + case 21: + /* report tool header by sending \E]llabel\E\. + */ + break; + } + parsestate = groundtable; + break; + + case CASE_DECREQTPARM: + /* DECREQTPARM */ + if ((row = param[0]) == DEFAULT) + row = 0; + if (row == 0 || row == 1) { + reply.a_type = CSI; + reply.a_pintro = 0; + reply.a_nparam = 7; + reply.a_param[0] = row + 2; + reply.a_param[1] = 1; /* no parity */ + reply.a_param[2] = 1; /* eight bits */ + reply.a_param[3] = 112; /* transmit 9600 baud */ + reply.a_param[4] = 112; /* receive 9600 baud */ + reply.a_param[5] = 1; /* clock multiplier ? */ + reply.a_param[6] = 0; /* STP flags ? */ + reply.a_inters = 0; + reply.a_final = 'x'; + unparseseq(&reply, screen->respond); + } + parsestate = groundtable; + break; + + case CASE_DECSET: + /* DECSET */ + dpmodes(term, bitset); + parsestate = groundtable; + break; + + case CASE_DECRST: + /* DECRST */ + dpmodes(term, bitclr); + parsestate = groundtable; + break; + + case CASE_DECALN: + /* DECALN */ + if(screen->cursor_state) + HideCursor(); + for(row = screen->max_row ; row >= 0 ; row--) { + memset(screen->buf[4 * row + 1], 0, + col = screen->max_col + 1); + for(cp = (unsigned char *)screen->buf[4 * row] ; col > 0 ; col--) + *cp++ = (unsigned char) 'E'; + } + ScrnRefresh(screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); + parsestate = groundtable; + break; + + case CASE_GSETS: + screen->gsets[scstype] = c; + parsestate = groundtable; + break; + + case CASE_DECSC: + /* DECSC */ + CursorSave(term, &screen->sc); + parsestate = groundtable; + break; + + case CASE_DECRC: + /* DECRC */ + CursorRestore(term, &screen->sc); + parsestate = groundtable; + break; + + case CASE_DECKPAM: + /* DECKPAM */ + term->keyboard.flags |= KYPD_APL; + update_appkeypad(); + parsestate = groundtable; + break; + + case CASE_DECKPNM: + /* DECKPNM */ + term->keyboard.flags &= ~KYPD_APL; + update_appkeypad(); + parsestate = groundtable; + break; + + case CASE_IND: + /* IND */ + Index(screen, 1); + if (XtAppPending(app_con) || + GetBytesAvailable (ConnectionNumber(screen->display)) > 0) + xevents(); + parsestate = groundtable; + break; + + case CASE_NEL: + /* NEL */ + Index(screen, 1); + CarriageReturn(screen); + + if (XtAppPending(app_con) || + GetBytesAvailable (ConnectionNumber(screen->display)) > 0) + xevents(); + parsestate = groundtable; + break; + + case CASE_HTS: + /* HTS */ + TabSet(term->tabs, screen->cur_col); + parsestate = groundtable; + break; + + case CASE_RI: + /* RI */ + RevIndex(screen, 1); + parsestate = groundtable; + break; + + case CASE_SS2: + /* SS2 */ + screen->curss = 2; + parsestate = groundtable; + break; + + case CASE_SS3: + /* SS3 */ + screen->curss = 3; + parsestate = groundtable; + break; + + case CASE_CSI_STATE: + /* enter csi state */ + nparam = 1; + param[0] = DEFAULT; + parsestate = csitable; + break; + + case CASE_OSC: + /* Operating System Command: ESC ] */ + do_osc(finput); + parsestate = groundtable; + break; + + case CASE_RIS: + /* RIS */ + VTReset(TRUE); + parsestate = groundtable; + break; + + case CASE_LS2: + /* LS2 */ + screen->curgl = 2; + parsestate = groundtable; + break; + + case CASE_LS3: + /* LS3 */ + screen->curgl = 3; + parsestate = groundtable; + break; + + case CASE_LS3R: + /* LS3R */ + screen->curgr = 3; + parsestate = groundtable; + break; + + case CASE_LS2R: + /* LS2R */ + screen->curgr = 2; + parsestate = groundtable; + break; + + case CASE_LS1R: + /* LS1R */ + screen->curgr = 1; + parsestate = groundtable; + break; + + case CASE_XGTERM_SAVE: + savemodes(term); + parsestate = groundtable; + break; + + case CASE_XGTERM_RESTORE: + restoremodes(term); + parsestate = groundtable; + break; + + default: + printf ("VTParse: unknown state....\n"); + } + } +} + +static finput() +{ + return(doinput()); +} + + +static char *v_buffer; /* pointer to physical buffer */ +static char *v_bufstr = NULL; /* beginning of area to write */ +static char *v_bufptr; /* end of area to write */ +static char *v_bufend; /* end of physical buffer */ + +/**/ +static XtIntervalId input_handler = (XtIntervalId) NULL; +static XtIntervalId output_handler = (XtIntervalId) NULL; +static int pty_read_bytes = 0; +#define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0) + +/* Write data to the pty as typed by the user, pasted with the mouse, + or generated by us in response to a query ESC sequence. */ + +v_write(f, d, len) + int f; + char *d; + int len; +{ + int riten; + int c = len; + + if (v_bufstr == NULL && len > 0) { + v_buffer = XtMalloc(len); + v_bufstr = v_buffer; + v_bufptr = v_buffer; + v_bufend = v_buffer + len; + } +#ifdef DEBUG + if (debug) { + fprintf(stderr, "v_write called with %d bytes (%d left over)", + len, v_bufptr - v_bufstr); + if (len > 1 && len < 10) fprintf(stderr, " \"%.*s\"", len, d); + fprintf(stderr, "\n"); + } +#endif + + if ((1 << f) != pty_mask) + return(write(f, d, len)); + + /* + * Append to the block we already have. + * Always doing this simplifies the code, and + * isn't too bad, either. If this is a short + * block, it isn't too expensive, and if this is + * a long block, we won't be able to write it all + * anyway. + */ + + if (len > 0) { + if (v_bufend < v_bufptr + len) { /* we've run out of room */ + if (v_bufstr != v_buffer) { + /* there is unused space, move everything down */ + /* possibly overlapping memmove here */ +#ifdef DEBUG + if (debug) + fprintf(stderr, "moving data down %d\n", + v_bufstr - v_buffer); +#endif + memmove( v_buffer, v_bufstr, v_bufptr - v_bufstr); + v_bufptr -= v_bufstr - v_buffer; + v_bufstr = v_buffer; + } + if (v_bufend < v_bufptr + len) { + /* still won't fit: get more space */ + /* Don't use XtRealloc because an error is not fatal. */ + int size = v_bufptr - v_buffer; /* save across realloc */ + v_buffer = realloc(v_buffer, size + len); + if (v_buffer) { +#ifdef DEBUG + if (debug) + fprintf(stderr, "expanded buffer to %d\n", + size + len); +#endif + v_bufstr = v_buffer; + v_bufptr = v_buffer + size; + v_bufend = v_bufptr + len; + } else { + /* no memory: ignore entire write request */ + fprintf(stderr, "%s: cannot allocate buffer space\n", + xgterm_name); + v_buffer = v_bufstr; /* restore clobbered pointer */ + c = 0; + } + } + } + if (v_bufend >= v_bufptr + len) { + /* new stuff will fit */ + memmove( v_bufptr, d, len); + v_bufptr += len; + } + } + + /* + * Write out as much of the buffer as we can. + * Be careful not to overflow the pty's input silo. + * We are conservative here and only write + * a small amount at a time. + * + * If we can't push all the data into the pty yet, we expect write + * to return a non-negative number less than the length requested + * (if some data written) or -1 and set errno to EAGAIN, + * EWOULDBLOCK, or EINTR (if no data written). + * + * (Not all systems do this, sigh, so the code is actually + * a little more forgiving.) + */ + +#define MAX_PTY_WRITE 128 /* 1/2 POSIX minimum MAX_INPUT */ + + if (v_bufptr > v_bufstr) { + riten = write(f, v_bufstr, v_bufptr - v_bufstr <= MAX_PTY_WRITE ? + v_bufptr - v_bufstr : MAX_PTY_WRITE); + if (riten < 0) { +#ifdef DEBUG + if (debug) perror("write"); +#endif + riten = 0; + } +#ifdef DEBUG + if (debug) + fprintf(stderr, "write called with %d, wrote %d\n", + v_bufptr - v_bufstr <= MAX_PTY_WRITE ? + v_bufptr - v_bufstr : MAX_PTY_WRITE, + riten); +#endif + v_bufstr += riten; + if (v_bufstr >= v_bufptr) /* we wrote it all */ + v_bufstr = v_bufptr = v_buffer; + } + + /* + * If we have lots of unused memory allocated, return it + */ + if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */ + /* save pointers across realloc */ + int start = v_bufstr - v_buffer; + int size = v_bufptr - v_buffer; + int allocsize = size ? size : 1; + + v_buffer = realloc(v_buffer, allocsize); + if (v_buffer) { + v_bufstr = v_buffer + start; + v_bufptr = v_buffer + size; + v_bufend = v_buffer + allocsize; +#ifdef DEBUG + if (debug) + fprintf(stderr, "shrunk buffer to %d\n", allocsize); +#endif + } else { + /* should we print a warning if couldn't return memory? */ + v_buffer = v_bufstr - start; /* restore clobbered pointer */ + } + } + + /* If there is still data left to write post an event handler to + * write the rest of the buffer. Otherwise remove any old handler. + */ + if (v_bufptr > v_bufstr) { + if (!output_handler) + output_handler = XtAppAddInput (app_con, f, + (XtPointer)XtInputWriteMask, do_write, (XtPointer)NULL); + } else if (output_handler) { + XtRemoveInput (output_handler); + output_handler = (XtIntervalId) NULL; + } + + return(c); +} + + +/* in_put -- Process input from all sources (terminal pty i/o, X events, and + * timers). This is called after the input pty data buffer has been processed + * and we are ready for more input, and it returns when new input data has + * been received from the client. + */ +static int +in_put() +{ + register TScreen *screen = &term->screen; + register XtInputMask mask; + + /* Enable pty input. */ + if (!input_handler) + init_ttyio (screen->respond); + + /* Process events until we get some input data to return to our caller. + */ + do { + /* Pty input events are processed first - this is necessary for the + * jump scroll feature to work properly. + */ + if (bcnt <= 0 && pty_read_bytes < 4096) { + mask = (XtIMAlternateInput | XtIMTimer); + while (bcnt <= 0 && (XtAppPending(app_con) & mask)) + XtAppProcessEvent (app_con, mask); + if (bcnt > 0) + goto done; + } + + /* Update the screen. */ + if (screen->scroll_amt) + FlushScroll (screen); + if (screen->cursor_set && (screen->cursor_col != screen->cur_col + || screen->cursor_row != screen->cur_row)) { + if (screen->cursor_state) + HideCursor(); + ShowCursor(); + } else if (screen->cursor_set != screen->cursor_state) { + if (screen->cursor_set) + ShowCursor(); + else + HideCursor(); + } + while (!gt_flush()) + ; + XFlush (XtDisplay(term)); + + /* Process any queued up X events. */ + while (XtAppPending(app_con) & (XtIMXEvent|XtIMTimer)) + XtAppProcessEvent (app_con, XtIMXEvent|XtIMTimer); + + /* Wait for and process the next input event. */ + XtAppProcessEvent (app_con, XtIMAll); + pty_read_bytes = 0; + + } while (bcnt <= 0); + +done: + /* Disable pty input except when in this routine. */ + XtRemoveInput (input_handler); + input_handler = (XtIntervalId) NULL; + + /* Return the next input char. */ + bcnt--; + return (*bptr++); +} + + +/* do_read -- Called to read input data from the client pty. We merely read + * the data into the global input data buffer and return. The data is + * processed out of the buffer elsewhere. + */ +static void +do_read (w, fd, id) + XtPointer w; + int *fd; + XtInputId *id; +{ + register TScreen *screen = &term->screen; + + /* Don't read any more data until the input buffer is empty. */ + if (bcnt > 0) + return; + +#ifdef ALLOWLOGGING + if (screen->logging) + FlushLog(screen); +#endif + + bcnt = read (*fd, (char *)(bptr = buffer), BUF_SIZE); + if (bcnt > 0 && screen->logging) + write (screen->logfd, buffer, bcnt); + + if (bcnt < 0) { + if (errno == EIO) + Cleanup (0); + else if (!E_TEST(errno)) + Panic ("input: read returned unexpected error (%d)\n", errno); + } else if (bcnt == 0) { + Panic ("input: read returned zero\n", 0); + + } else { + /* read from pty was successful */ + + /* Let gtermio remove any graphics text. */ + bcnt = gt_input (bptr, bcnt); + gt_flush(); + + if (bcnt <= 0) { + bcnt = 0; + return; + } + + if (!screen->output_eight_bits) { + register int bc = bcnt; + register Char *b = bptr; + + for (; bc > 0; bc--, b++) { + *b &= (Char) 0x7f; + } + } + + if (screen->scrollWidget && screen->scrollttyoutput && + screen->topline < 0) + WindowScroll(screen, 0); /* Scroll to bottom */ + + pty_read_bytes += bcnt; + } +} + + +/* do_write -- Called to write buffered client output when there is data + * queued and the output file is ready for writing. + */ +static void +do_write (w, fd, id) + XtPointer w; + int *fd; + XtInputId *id; +{ + v_write (*fd, 0, 0); +} + +/* init_ttyio -- Initialize tty i/o. Called by the main when the terminal + * file descriptor has been obtained. + */ +init_ttyio (pty) + int pty; +{ + if (pty < 0) { + Panic ("init_ttyio: invalid pty=%d\n", pty); + + } else if (!input_handler) { + input_handler = XtAppAddInput (app_con, pty, + (XtPointer)XtInputReadMask, do_read, (XtPointer)NULL); + } +} + + +/* + * process a string of characters according to the character set indicated + * by charset. worry about end of line conditions (wraparound if selected). + */ +static void +dotext(screen, flags, charset, buf, ptr, fg, bg) + register TScreen *screen; + unsigned flags, fg, bg; + char charset; + char *buf; /* start of characters to process */ + char *ptr; /* end */ +{ + register char *s; + register int len; + register int n; + register int next_col; + + switch (charset) { + case 'A': /* United Kingdom set */ + for (s=buf; s<ptr; ++s) + if (*s == '#') + *s = '\036'; /* UK pound sign*/ + break; + + case 'B': /* ASCII set */ + break; + + case '0': /* special graphics (line drawing) */ + for (s=buf; s<ptr; ++s) + if (*s>=0x5f && *s<=0x7e) + *s = *s == 0x5f ? 0x7f : *s - 0x5f; + break; + + default: /* any character sets we don't recognize*/ + return; + } + + len = ptr - buf; + ptr = buf; + while (len > 0) { + n = screen->max_col - screen->cur_col +1; + if (n <= 1) { + if (screen->do_wrap && (flags&WRAPAROUND)) { + /* mark that we had to wrap this line */ + ScrnSetAttributes(screen, screen->cur_row, 0, + LINEWRAPPED, LINEWRAPPED, 1); + Index(screen, 1); + screen->cur_col = 0; + screen->do_wrap = 0; + n = screen->max_col+1; + } else + n = 1; + } + if (len < n) + n = len; + next_col = screen->cur_col + n; + WriteText(screen, ptr, n, flags, fg, bg); + /* + * the call to WriteText updates screen->cur_col. + * If screen->cur_col != next_col, we must have + * hit the right margin, so set the do_wrap flag. + */ + screen->do_wrap = (screen->cur_col < next_col); + len -= n; + ptr += n; + } +} + +/* + * write a string str of length len onto the screen at + * the current cursor position. update cursor position. + */ +static void +WriteText(screen, str, len, flags, fg, bg) + register TScreen *screen; + register char *str; + register int len; + unsigned flags, fg, bg; +{ + register int cx, cy; + register unsigned fgs = flags; + register Pixel fg_pix, bg_pix; + GC currentGC; + + fg_pix = (fgs & FG_COLOR) ? screen->colors[fg] : + screen->foreground; + bg_pix = (fgs & BG_COLOR) ? screen->colors[bg] : + term->core.background_pixel; + + if(screen->cur_row - screen->topline <= screen->max_row) { + /* + if(screen->cur_row == screen->cursor_row && screen->cur_col <= + screen->cursor_col && screen->cursor_col <= screen->cur_col + len - 1) + screen->cursor_state = OFF; + */ + if(screen->cursor_state) + HideCursor(); + + /* + * make sure that the correct GC is current + */ + + if (fgs & INVERSE) { + if (fgs & BOLD) currentGC = screen->reverseboldGC; + else currentGC = screen->reverseGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, currentGC, bg_pix); + XSetBackground(screen->display, currentGC, fg_pix); + } + + } else { /* not bold */ + if (fgs & BOLD) currentGC = screen->normalboldGC; + else currentGC = screen->normalGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, currentGC, fg_pix); + XSetBackground(screen->display, currentGC, bg_pix); + } + } + + if (fgs & INSERT) + InsertChar(screen, len); + if (!(AddToRefresh(screen))) { + if(screen->scroll_amt) + FlushScroll(screen); + cx = CursorX(screen, screen->cur_col); + cy = CursorY(screen, screen->cur_row)+screen->fnt_norm->ascent; + XDrawImageString(screen->display, TextWindow(screen), currentGC, + cx, cy, str, len); + + if((fgs & BOLD) && screen->enbolden) + if (currentGC == screen->normalGC || screen->reverseGC) + XDrawString(screen->display, TextWindow(screen), + currentGC,cx + 1, cy, str, len); + + if((fgs & UNDERLINE) && screen->underline) + XDrawLine(screen->display, TextWindow(screen), currentGC, + cx, cy+1, + cx + len * FontWidth(screen), cy+1); + /* + * the following statements compile data to compute the average + * number of characters written on each call to XText. The data + * may be examined via the use of a "hidden" escape sequence. + */ + ctotal += len; + ++ntotal; + } + } + ScreenWrite(screen, str, flags, fg, bg, len); + CursorForward(screen, len); +} + +/* + * process ANSI modes set, reset + */ +ansi_modes(termw, func) + XgtermWidget termw; + int (*func)(); +{ + register int i; + + for (i=0; i<nparam; ++i) { + switch (param[i]) { + case 4: /* IRM */ + (*func)(&termw->flags, INSERT); + break; + + case 20: /* LNM */ + (*func)(&termw->flags, LINEFEED); + update_autolinefeed(); + break; + } + } +} + +/* + * process DEC private modes set, reset + */ +dpmodes(termw, func) + XgtermWidget termw; + void (*func)(); +{ + register TScreen *screen = &termw->screen; + register int i, j; + + for (i=0; i<nparam; ++i) { + switch (param[i]) { + case 1: /* DECCKM */ + (*func)(&termw->keyboard.flags, CURSOR_APL); + update_appcursor(); + break; + case 2: /* ANSI/VT52 mode */ + if (func == bitset) { + screen->gsets[0] = + screen->gsets[1] = + screen->gsets[2] = + screen->gsets[3] = 'B'; + screen->curgl = 0; + screen->curgr = 2; + } + break; + case 3: /* DECCOLM */ + if(screen->c132) { + ClearScreen(screen); + CursorSet(screen, 0, 0, termw->flags); + if((j = func == bitset ? 132 : 80) != + ((termw->flags & IN132COLUMNS) ? 132 : 80) || + j != screen->max_col + 1) { + Dimension replyWidth, replyHeight; + XtGeometryResult status; + + if (term->misc.sb_right) { + status = XtMakeResizeRequest ( + (Widget) termw, + (Dimension)FontWidth(screen) * j + + 2*screen->border, + (Dimension) FontHeight(screen) + * (screen->max_row + 1) + + 2 * screen->border, + &replyWidth, &replyHeight); + } else { + status = XtMakeResizeRequest ( + (Widget) termw, + (Dimension)FontWidth(screen) * j + + 2*screen->border + + screen->scrollbar, + (Dimension) FontHeight(screen) + * (screen->max_row + 1) + + 2 * screen->border, + &replyWidth, &replyHeight); + } + + if (status == XtGeometryYes || + status == XtGeometryDone) { + ScreenResize (&termw->screen, + replyWidth, + replyHeight, + &termw->flags); + } + } + (*func)(&termw->flags, IN132COLUMNS); + } + break; + case 4: /* DECSCLM (slow scroll) */ + if (func == bitset) { + screen->jumpscroll = 0; + if (screen->scroll_amt) + FlushScroll(screen); + } else + screen->jumpscroll = 1; + (*func)(&termw->flags, SMOOTHSCROLL); + update_jumpscroll(); + break; + case 5: /* DECSCNM */ + j = termw->flags; + (*func)(&termw->flags, REVERSE_VIDEO); + if ((termw->flags ^ j) & REVERSE_VIDEO) + ReverseVideo(termw); + /* update_reversevideo done in RevVid */ + break; + + case 6: /* DECOM */ + (*func)(&termw->flags, ORIGIN); + CursorSet(screen, 0, 0, termw->flags); + break; + + case 7: /* DECAWM */ + (*func)(&termw->flags, WRAPAROUND); + update_autowrap(); + break; + case 8: /* DECARM */ + /* ignore autorepeat */ + break; + case 9: /* MIT bogus sequence */ + if(func == bitset) + screen->send_mouse_pos = 1; + else + screen->send_mouse_pos = 0; + break; + case 38: /* DECTEK */ + if(func == bitset && !(screen->inhibit & I_TEK)) { +#ifdef ALLOWLOGGING + if(screen->logging) { + FlushLog(screen); + screen->logstart = Tbuffer; + } +#endif + /* Enable gtermio as if a GS had been seen, + * but in xterm emulation mode (no trailers). + * Call gt_input to pass any buffered input + * following the DECTEK on to gtermio. + */ + switch_modes (0); + gt_set_ginmode_trailers (NULL); + while (!gt_flush()) + ; + } + break; + case 40: /* 132 column mode */ + screen->c132 = (func == bitset); + update_allow132(); + break; + case 41: /* curses hack */ + screen->curses = (func == bitset); + update_cursesemul(); + break; + case 44: /* margin bell */ + screen->marginbell = (func == bitset); + if(!screen->marginbell) + screen->bellarmed = -1; + update_marginbell(); + break; + case 45: /* reverse wraparound */ + (*func)(&termw->flags, REVERSEWRAP); + update_reversewrap(); + break; +#ifdef ALLOWLOGGING + case 46: /* logging */ +#ifdef ALLOWLOGFILEONOFF + /* + * if this feature is enabled, logging may be + * enabled and disabled via escape sequences. + */ + if(func == bitset) + StartLog(screen); + else + CloseLog(screen); +#else + Bell(); + Bell(); +#endif /* ALLOWLOGFILEONOFF */ + break; +#endif + case 47: /* alternate buffer */ + if (!termw->misc.titeInhibit) { + if(func == bitset) + ToAlternate(screen); + else + FromAlternate(screen); + } + break; + case 1000: /* xgterm bogus sequence */ + if(func == bitset) + screen->send_mouse_pos = 2; + else + screen->send_mouse_pos = 0; + break; + case 1001: /* xgterm sequence w/hilite tracking */ + if(func == bitset) + screen->send_mouse_pos = 3; + else + screen->send_mouse_pos = 0; + break; + } + } +} + +/* + * process xgterm private modes save + */ +savemodes(termw) + XgtermWidget termw; +{ + register TScreen *screen = &termw->screen; + register int i; + + for (i = 0; i < nparam; i++) { + switch (param[i]) { + case 1: /* DECCKM */ + screen->save_modes[0] = termw->keyboard.flags & + CURSOR_APL; + break; + case 3: /* DECCOLM */ + if(screen->c132) + screen->save_modes[1] = termw->flags & IN132COLUMNS; + break; + case 4: /* DECSCLM (slow scroll) */ + screen->save_modes[2] = termw->flags & SMOOTHSCROLL; + break; + case 5: /* DECSCNM */ + screen->save_modes[3] = termw->flags & REVERSE_VIDEO; + break; + case 6: /* DECOM */ + screen->save_modes[4] = termw->flags & ORIGIN; + break; + + case 7: /* DECAWM */ + screen->save_modes[5] = termw->flags & WRAPAROUND; + break; + case 8: /* DECARM */ + /* ignore autorepeat */ + break; + case 9: /* mouse bogus sequence */ + screen->save_modes[7] = screen->send_mouse_pos; + break; + case 40: /* 132 column mode */ + screen->save_modes[8] = screen->c132; + break; + case 41: /* curses hack */ + screen->save_modes[9] = screen->curses; + break; + case 44: /* margin bell */ + screen->save_modes[12] = screen->marginbell; + break; + case 45: /* reverse wraparound */ + screen->save_modes[13] = termw->flags & REVERSEWRAP; + break; +#ifdef ALLOWLOGGING + case 46: /* logging */ + screen->save_modes[14] = screen->logging; + break; +#endif + case 47: /* alternate buffer */ + screen->save_modes[15] = screen->alternate; + break; + case 1000: /* mouse bogus sequence */ + case 1001: + screen->save_modes[7] = screen->send_mouse_pos; + break; + } + } +} + +/* + * process xgterm private modes restore + */ +restoremodes(termw) + XgtermWidget termw; +{ + register TScreen *screen = &termw->screen; + register int i, j; + + for (i = 0; i < nparam; i++) { + switch (param[i]) { + case 1: /* DECCKM */ + termw->keyboard.flags &= ~CURSOR_APL; + termw->keyboard.flags |= screen->save_modes[0] & + CURSOR_APL; + update_appcursor(); + break; + case 3: /* DECCOLM */ + if(screen->c132) { + ClearScreen(screen); + CursorSet(screen, 0, 0, termw->flags); + if((j = (screen->save_modes[1] & IN132COLUMNS) + ? 132 : 80) != ((termw->flags & IN132COLUMNS) + ? 132 : 80) || j != screen->max_col + 1) { + Dimension replyWidth, replyHeight; + XtGeometryResult status; + status = XtMakeResizeRequest ( + (Widget) termw, + (Dimension) FontWidth(screen) * j + + 2*screen->border + + screen->scrollbar, + (Dimension) FontHeight(screen) + * (screen->max_row + 1) + + 2*screen->border, + &replyWidth, &replyHeight); + + if (status == XtGeometryYes || + status == XtGeometryDone) { + ScreenResize (&termw->screen, + replyWidth, + replyHeight, + &termw->flags); + } + } + termw->flags &= ~IN132COLUMNS; + termw->flags |= screen->save_modes[1] & + IN132COLUMNS; + } + break; + case 4: /* DECSCLM (slow scroll) */ + if (screen->save_modes[2] & SMOOTHSCROLL) { + screen->jumpscroll = 0; + if (screen->scroll_amt) + FlushScroll(screen); + } else + screen->jumpscroll = 1; + termw->flags &= ~SMOOTHSCROLL; + termw->flags |= screen->save_modes[2] & SMOOTHSCROLL; + update_jumpscroll(); + break; + case 5: /* DECSCNM */ + if((screen->save_modes[3] ^ termw->flags) & REVERSE_VIDEO) { + termw->flags &= ~REVERSE_VIDEO; + termw->flags |= screen->save_modes[3] & REVERSE_VIDEO; + ReverseVideo(termw); + /* update_reversevideo done in RevVid */ + } + break; + case 6: /* DECOM */ + termw->flags &= ~ORIGIN; + termw->flags |= screen->save_modes[4] & ORIGIN; + CursorSet(screen, 0, 0, termw->flags); + break; + + case 7: /* DECAWM */ + termw->flags &= ~WRAPAROUND; + termw->flags |= screen->save_modes[5] & WRAPAROUND; + update_autowrap(); + break; + case 8: /* DECARM */ + /* ignore autorepeat */ + break; + case 9: /* MIT bogus sequence */ + screen->send_mouse_pos = screen->save_modes[7]; + break; + case 40: /* 132 column mode */ + screen->c132 = screen->save_modes[8]; + update_allow132(); + break; + case 41: /* curses hack */ + screen->curses = screen->save_modes[9]; + update_cursesemul(); + break; + case 44: /* margin bell */ + if(!(screen->marginbell = screen->save_modes[12])) + screen->bellarmed = -1; + update_marginbell(); + break; + case 45: /* reverse wraparound */ + termw->flags &= ~REVERSEWRAP; + termw->flags |= screen->save_modes[13] & REVERSEWRAP; + update_reversewrap(); + break; +#ifdef ALLOWLOGGING + case 46: /* logging */ +#ifdef ALLOWLOGFILEONOFF + if(screen->save_modes[14]) + StartLog(screen); + else + CloseLog(screen); +#endif /* ALLOWLOGFILEONOFF */ + /* update_logging done by StartLog and CloseLog */ + break; +#endif + case 47: /* alternate buffer */ + if (!termw->misc.titeInhibit) { + if(screen->save_modes[15]) + ToAlternate(screen); + else + FromAlternate(screen); + /* update_altscreen done by ToAlt and FromAlt */ + } + break; + case 1000: /* mouse bogus sequence */ + case 1001: + screen->send_mouse_pos = screen->save_modes[7]; + break; + } + } +} + +/* + * set a bit in a word given a pointer to the word and a mask. + */ +static void bitset(p, mask) + unsigned *p; + int mask; +{ + *p |= mask; +} + +/* + * clear a bit in a word given a pointer to the word and a mask. + */ +static void bitclr(p, mask) + unsigned *p; + int mask; +{ + *p &= ~mask; +} + +unparseseq(ap, fd) + register ANSI *ap; + int fd; +{ + register int c; + register int i; + register int inters; + + c = ap->a_type; + if (c>=0x80 && c<=0x9F) { + unparseputc(ESC, fd); + c -= 0x40; + } + unparseputc(c, fd); + c = ap->a_type; + if (c==ESC || c==DCS || c==CSI || c==OSC || c==PM || c==APC) { + if (ap->a_pintro != 0) + unparseputc((char) ap->a_pintro, fd); + for (i=0; i<ap->a_nparam; ++i) { + if (i != 0) + unparseputc(';', fd); + unparseputn((unsigned int) ap->a_param[i], fd); + } + inters = ap->a_inters; + for (i=3; i>=0; --i) { + c = (inters >> (8*i)) & 0xff; + if (c != 0) + unparseputc(c, fd); + } + unparseputc((char) ap->a_final, fd); + } +} + +unparseputn(n, fd) +unsigned int n; +int fd; +{ + unsigned int q; + + q = n/10; + if (q != 0) + unparseputn(q, fd); + unparseputc((char) ('0' + (n%10)), fd); +} + +unparseputc(c, fd) +char c; +int fd; +{ + char buf[2]; + register i = 1; + extern XgtermWidget term; + + if((buf[0] = c) == '\r' && (term->flags & LINEFEED)) { + buf[1] = '\n'; + i++; + } + v_write(fd, buf, i); +} + +unparsefputs (s, fd) + register char *s; + int fd; +{ + if (s) { + while (*s) unparseputc (*s++, fd); + } +} + +static void SwitchBufs(); + +static void +ToAlternate(screen) +register TScreen *screen; +{ + extern ScrnBuf Allocate(); + + if(screen->alternate) + return; + if(!screen->altbuf) + screen->altbuf = Allocate(screen->max_row + 1, screen->max_col + + 1, &screen->abuf_address); + SwitchBufs(screen); + screen->alternate = TRUE; + update_altscreen(); +} + +static void +FromAlternate(screen) +register TScreen *screen; +{ + if(!screen->alternate) + return; + screen->alternate = FALSE; + SwitchBufs(screen); + update_altscreen(); +} + +static void +SwitchBufs(screen) + register TScreen *screen; +{ + register int rows, top; + + if(screen->cursor_state) + HideCursor(); + rows = screen->max_row + 1; + SwitchBufPtrs(screen); + TrackText(0, 0, 0, 0); /* remove any highlighting */ + if((top = -screen->topline) <= screen->max_row) { + if(screen->scroll_amt) + FlushScroll(screen); + if(top == 0) + XClearWindow(screen->display, TextWindow(screen)); + else + if (term->misc.sb_right) { + XClearArea( + screen->display, + TextWindow(screen), + (int) screen->border, + (int) top * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) (screen->max_row - top + 1) + * FontHeight(screen), + FALSE); + } else { + XClearArea( + screen->display, + TextWindow(screen), + (int) screen->border + screen->scrollbar, + (int) top * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) (screen->max_row - top + 1) + * FontHeight(screen), + FALSE); + } + } + ScrnRefresh(screen, 0, 0, rows, screen->max_col + 1, False); +} + +/* swap buffer line pointers between alt and regular screens */ + +SwitchBufPtrs(screen) + register TScreen *screen; +{ + register int rows = screen->max_row + 1; + char *save [4 * MAX_ROWS]; + + memmove( (char *)save, (char *)screen->buf, 4 * sizeof(char *) * rows); + memmove( (char *)screen->buf, (char *)screen->altbuf, + 4 * sizeof(char *) * rows); + memmove( (char *)screen->altbuf, (char *)save, 4 * sizeof(char *) * rows); +} + +VTRun() +{ + register TScreen *screen = &term->screen; + register int i; + + XtRealizeWidget (term->core.parent); + if (!screen->TekEmu) + set_vt_visibility (TRUE); +/* + if (!screen->Vshow) + set_vt_visibility (TRUE); +*/ + + update_vttekmode(); + update_vtshow(); + update_tekshow(); + set_vthide_sensitivity(); + + if (screen->allbuf == NULL) VTallocbuf (); + + screen->cursor_state = OFF; + screen->cursor_set = ON; + + bcnt = 0; + bptr = buffer; + while(Tpushb > Tpushback) { + *bptr++ = *--Tpushb; + bcnt++; + } + bcnt += (i = Tbcnt); + for( ; i > 0 ; i--) + *bptr++ = *Tbptr++; + bptr = buffer; + if(!setjmp(VTend)) + VTparse(); + HideCursor(); + screen->cursor_set = OFF; +} + +/*ARGSUSED*/ +static void VTExpose(w, event, region) + Widget w; + XEvent *event; + Region region; +{ + register TScreen *screen = &term->screen; + +#ifdef DEBUG + if(debug) + fputs("Expose\n", stderr); +#endif /* DEBUG */ + if (event->type == Expose) + HandleExposure (screen, event); +} + +static void VTGraphicsOrNoExpose (event) + XEvent *event; +{ + register TScreen *screen = &term->screen; + if (screen->incopy <= 0) { + screen->incopy = 1; + if (screen->scrolls > 0) + screen->scrolls--; + } + if (event->type == GraphicsExpose) + if (HandleExposure (screen, event)) + screen->cursor_state = OFF; + if ((event->type == NoExpose) || ((XGraphicsExposeEvent *)event)->count == 0) { + if (screen->incopy <= 0 && screen->scrolls > 0) + screen->scrolls--; + if (screen->scrolls) + screen->incopy = -1; + else + screen->incopy = 0; + } +} + +/*ARGSUSED*/ +static void VTNonMaskableEvent (w, closure, event, cont) +Widget w; /* unused */ +XtPointer closure; /* unused */ +XEvent *event; +Boolean *cont; /* unused */ +{ + switch (event->type) { + case GraphicsExpose: + case NoExpose: + VTGraphicsOrNoExpose (event); + break; + } +} + + + + +static void VTResize(w) + Widget w; +{ + if (XtIsRealized(w)) + ScreenResize (&term->screen, term->core.width, term->core.height, + &term->flags); +} + + +extern Atom wm_delete_window; /* for ICCCM delete window */ + +static String xgterm_trans = + "<ClientMessage>WM_PROTOCOLS: DeleteWindow()\n\ + <MappingNotify>: KeyboardMapping()\n"; + +int VTInit () +{ + register TScreen *screen = &term->screen; + Widget vtparent = term->core.parent; + + XtRealizeWidget (vtparent); + XtOverrideTranslations(vtparent, XtParseTranslationTable(xgterm_trans)); + (void) XSetWMProtocols (XtDisplay(vtparent), XtWindow(vtparent), + &wm_delete_window, 1); + + if (screen->allbuf == NULL) VTallocbuf (); + return (1); +} + +static void VTallocbuf () +{ + register TScreen *screen = &term->screen; + int nrows = screen->max_row + 1; + extern ScrnBuf Allocate(); + + /* allocate screen buffer now, if necessary. */ + if (screen->scrollWidget) + nrows += screen->savelines; + screen->allbuf = Allocate (nrows, screen->max_col + 1, + &screen->sbuf_address); + if (screen->scrollWidget) + screen->buf = &screen->allbuf[4 * screen->savelines]; + else + screen->buf = screen->allbuf; + return; +} + +static void VTClassInit () +{ + XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, + (XtConvertArgList) NULL, (Cardinal) 0); +} + + +/* ARGSUSED */ +static void VTInitialize (wrequest, wnew, args, num_args) + Widget wrequest, wnew; + ArgList args; + Cardinal *num_args; +{ + XgtermWidget request = (XgtermWidget) wrequest; + XgtermWidget new = (XgtermWidget) wnew; + int i; + + /* Zero out the entire "screen" component of "new" widget, + then do field-by-field assigment of "screen" fields + that are named in the resource list. */ + + memset ((char *) &new->screen, 0, sizeof(new->screen)); + new->screen.c132 = request->screen.c132; + new->screen.curses = request->screen.curses; + new->screen.hp_ll_bc = request->screen.hp_ll_bc; + new->screen.foreground = request->screen.foreground; + new->screen.cursorcolor = request->screen.cursorcolor; + new->screen.border = request->screen.border; + new->screen.jumpscroll = request->screen.jumpscroll; +#ifdef ALLOWLOGGING + new->screen.logfile = request->screen.logfile; +#endif + new->screen.marginbell = request->screen.marginbell; + new->screen.mousecolor = request->screen.mousecolor; + new->screen.mousecolorback = request->screen.mousecolorback; + new->screen.multiscroll = request->screen.multiscroll; + new->screen.nmarginbell = request->screen.nmarginbell; + new->screen.savelines = request->screen.savelines; + new->screen.scrolllines = request->screen.scrolllines; + new->screen.scrollttyoutput = request->screen.scrollttyoutput; + new->screen.scrollkey = request->screen.scrollkey; + new->screen.underline = request->screen.underline; + new->screen.visualbell = request->screen.visualbell; + new->screen.TekEmu = request->screen.TekEmu; + new->misc.re_verse = request->misc.re_verse; + new->screen.multiClickTime = request->screen.multiClickTime; + new->screen.bellSuppressTime = request->screen.bellSuppressTime; + new->screen.charClass = request->screen.charClass; + new->screen.cutNewline = request->screen.cutNewline; + new->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine; + new->screen.always_highlight = request->screen.always_highlight; + new->screen.pointer_cursor = request->screen.pointer_cursor; + new->screen.input_eight_bits = request->screen.input_eight_bits; + new->screen.output_eight_bits = request->screen.output_eight_bits; + new->screen.allowSendEvents = request->screen.allowSendEvents; + new->misc.titeInhibit = request->misc.titeInhibit; + for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) { + new->screen.menu_font_names[i] = request->screen.menu_font_names[i]; + } + /* set default in realize proc */ + new->screen.menu_font_names[fontMenu_fontdefault] = NULL; + new->screen.menu_font_names[fontMenu_fontescape] = NULL; + new->screen.menu_font_names[fontMenu_fontsel] = NULL; + new->screen.menu_font_number = fontMenu_fontdefault; + + for (i = 0; i < MAXCOLORS; i++) { + new->screen.colors[i] = request->screen.colors[i]; + } + + /* + * The definition of -rv now is that it changes the definition of + * XtDefaultForeground and XtDefaultBackground. So, we no longer + * need to do anything special. + */ + new->keyboard.flags = 0; + new->screen.display = new->core.screen->display; + new->core.height = new->core.width = 1; + /* dummy values so that we don't try to Realize the parent shell + with height or width of 0, which is illegal in X. The real + size is computed in the xgtermWidget's Realize proc, + but the shell's Realize proc is called first, and must see + a valid size. */ + + /* look for focus related events on the shell, because we need + * to care about the shell's border being part of our focus. + */ + XtAddEventHandler(XtParent(new), FocusChangeMask, FALSE, + HandleFocusChange, (Opaque)NULL); + XtAddEventHandler((Widget)new, 0L, TRUE, + VTNonMaskableEvent, (Opaque)NULL); + XtAddEventHandler((Widget)new, PropertyChangeMask, FALSE, + HandleBellPropertyChange, (Opaque)NULL); + + /* These apply to vt100 window events. */ + XtAddEventHandler (wnew, EnterWindowMask, FALSE, HandleEnterWindow, + (Opaque)NULL); + XtAddEventHandler (wnew, LeaveWindowMask, FALSE, HandleLeaveWindow, + (Opaque)NULL); + + new->screen.bellInProgress = FALSE; + set_character_class (new->screen.charClass); + + /* create it, but don't realize it */ + ScrollBarOn (new, TRUE, FALSE); + + /* make sure that the resize gravity acceptable */ + if ( new->misc.resizeGravity != NorthWestGravity && + new->misc.resizeGravity != SouthWestGravity) { + Cardinal nparams = 1; + + XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XGtermError", + "unsupported resizeGravity resource value (%d)", + (String *) &(new->misc.resizeGravity), &nparams); + new->misc.resizeGravity = SouthWestGravity; + } + + return; +} + + +static void VTDestroy (w) +Widget w; +{ + XtFree(((XgtermWidget)w)->screen.selection); +} + +/*ARGSUSED*/ +static void VTRealize (w, valuemask, values) + Widget w; + XtValueMask *valuemask; + XSetWindowAttributes *values; +{ + unsigned int width, height; + register TScreen *screen = &term->screen; + int xpos, ypos, pr; + XSizeHints sizehints; + int scrollbar_width; + + TabReset (term->tabs); + + screen->menu_font_names[fontMenu_fontdefault] = term->misc.f_n; + screen->fnt_norm = screen->fnt_bold = NULL; + if (!LoadNewFont(screen, term->misc.f_n, term->misc.f_b, False, 0)) { + if (XmuCompareISOLatin1(term->misc.f_n, "fixed") != 0) { + fprintf (stderr, + "%s: unable to open font \"%s\", trying \"fixed\"....\n", + xgterm_name, term->misc.f_n); + (void) LoadNewFont (screen, "fixed", NULL, False, 0); + screen->menu_font_names[fontMenu_fontdefault] = "fixed"; + } + } + + /* really screwed if we couldn't open default font */ + if (!screen->fnt_norm) { + fprintf (stderr, "%s: unable to locate a suitable font\n", + xgterm_name); + Exit (1); + } + + /* making cursor */ + if (!screen->pointer_cursor) + screen->pointer_cursor = make_colored_cursor(XC_xterm, + screen->mousecolor, + screen->mousecolorback); + else + recolor_cursor (screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + + scrollbar_width = (term->misc.scrollbar || term->misc.sb_right ? + screen->scrollWidget->core.width /* + + screen->scrollWidget->core.border_width */ : 0); + + /* set defaults */ + xpos = 1; ypos = 1; width = 80; height = 24; + pr = XParseGeometry (term->misc.geo_metry, &xpos, &ypos, + &width, &height); + screen->max_col = (width - 1); /* units in character cells */ + screen->max_row = (height - 1); /* units in character cells */ + update_font_info (&term->screen, False); + + width = screen->fullVwin.fullwidth; + height = screen->fullVwin.fullheight; + + if ((pr & XValue) && (XNegative&pr)) + xpos += DisplayWidth(screen->display, DefaultScreen(screen->display)) + - width - (term->core.parent->core.border_width * 2); + if ((pr & YValue) && (YNegative&pr)) + ypos += DisplayHeight(screen->display,DefaultScreen(screen->display)) + - height - (term->core.parent->core.border_width * 2); + + /* set up size hints for window manager; min 1 char by 1 char */ + sizehints.base_width = 2 * screen->border + scrollbar_width; + sizehints.base_height = 2 * screen->border; + sizehints.width_inc = FontWidth(screen); + sizehints.height_inc = FontHeight(screen); + sizehints.min_width = sizehints.base_width + sizehints.width_inc; + sizehints.min_height = sizehints.base_height + sizehints.height_inc; + sizehints.flags = (PBaseSize|PMinSize|PResizeInc); + sizehints.x = xpos; + sizehints.y = ypos; + if ((XValue&pr) || (YValue&pr)) { + sizehints.flags |= USSize|USPosition; + sizehints.flags |= PWinGravity; + switch (pr & (XNegative | YNegative)) { + case 0: + sizehints.win_gravity = NorthWestGravity; + break; + case XNegative: + sizehints.win_gravity = NorthEastGravity; + break; + case YNegative: + sizehints.win_gravity = SouthWestGravity; + break; + default: + sizehints.win_gravity = SouthEastGravity; + break; + } + } else { + /* set a default size, but do *not* set position */ + sizehints.flags |= PSize; + } + sizehints.width = width; + sizehints.height = height; + if ((WidthValue&pr) || (HeightValue&pr)) + sizehints.flags |= USSize; + else sizehints.flags |= PSize; + + (void) XtMakeResizeRequest((Widget) term, + (Dimension)width, (Dimension)height, + &term->core.width, &term->core.height); + + /* XXX This is bogus. We are parsing geometries too late. This + * is information that the shell widget ought to have before we get + * realized, so that it can do the right thing. + */ + if (sizehints.flags & USPosition) + XMoveWindow (XtDisplay(term), term->core.parent->core.window, + sizehints.x, sizehints.y); + + XSetWMNormalHints (XtDisplay(term), term->core.parent->core.window, + &sizehints); + XFlush (XtDisplay(term)); /* get it out to window manager */ + + /* use ForgetGravity instead of SouthWestGravity because translating + the Expose events for ConfigureNotifys is too hard */ + values->bit_gravity = term->misc.resizeGravity == NorthWestGravity ? + NorthWestGravity : ForgetGravity; + term->screen.fullVwin.window = term->core.window = + XCreateWindow(XtDisplay(term), XtWindow(term->core.parent), + term->core.x, term->core.y, + term->core.width, term->core.height, term->core.border_width, + (int) term->core.depth, + InputOutput, CopyFromParent, + *valuemask|CWBitGravity, values); + +/* +#ifdef I18N + VTInitI18N(); +#endif +*/ + + set_cursor_gcs (screen); + + /* Reset variables used by ANSI emulation. */ + + screen->gsets[0] = 'B'; /* ASCII_G */ + screen->gsets[1] = 'B'; + screen->gsets[2] = 'B'; /* DEC supplemental. */ + screen->gsets[3] = 'B'; + screen->curgl = 0; /* G0 => GL. */ + screen->curgr = 2; /* G2 => GR. */ + screen->curss = 0; /* No single shift. */ + + XDefineCursor(screen->display, VShellWindow, screen->pointer_cursor); + + screen->cur_col = screen->cur_row = 0; + screen->max_col = Width(screen)/screen->fullVwin.f_width - 1; + screen->top_marg = 0; + screen->bot_marg = screen->max_row = Height(screen) / + screen->fullVwin.f_height - 1; + + screen->sc.row = screen->sc.col = screen->sc.flags = 0; + + /* Mark screen buffer as unallocated. We wait until the run loop so + that the child process does not fork and exec with all the dynamic + memory it will never use. If we were to do it here, the + swap space for new process would be huge for huge savelines. */ + screen->buf = screen->allbuf = NULL; + + screen->do_wrap = 0; + screen->scrolls = screen->incopy = 0; + set_vt_box (screen); + + screen->savedlines = 0; + + if (term->misc.scrollbar || term->misc.sb_right ) { + screen->scrollbar = 0; + ScrollBarOn (term, FALSE, TRUE); + } + CursorSave (term, &screen->sc); + return; +} + +#ifdef I18N + +static void VTInitI18N() +{ + int i, + ic_cnt = 0; + char *p, + *s, + *ns, + *end, + tmp[1024], + buf[32]; + XIM xim; + XIMStyles *xim_styles; + XIMStyle input_style; + Boolean found; + + term->screen.xic = NULL; + + if (!term->misc.open_im) return; + + if (term->misc.input_method) { + strcpy(tmp, term->misc.input_method); + for(s=tmp; *s;) { + while (*s && isspace(*s)) s++; + if (!*s) break; + if (!(ns = end = index(s, ','))) + end = s + strlen(s); + while (isspace(*end)) end--; + *end = '\0'; + + strcpy(buf, "@im="); + strcat(buf, s); + if ((p = XSetLocaleModifiers(buf)) != NULL && *p + && (xim = XOpenIM(XtDisplay(term), NULL, NULL, NULL)) != NULL) + break; + + s = ns + 1; + } + } else { + if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p) + xim = XOpenIM(XtDisplay(term), NULL, NULL, NULL); + } + + if (xim == NULL && (p = XSetLocaleModifiers("")) != NULL && *p) + xim = XOpenIM(XtDisplay(term), NULL, NULL, NULL); + + if (!xim) { + fprintf(stderr, "Failed to open input method"); + return; + } + + if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) + || !xim_styles) { + fprintf(stderr, "input method doesn't support any style\n"); + XCloseIM(xim); + return; + } + + found = False; + strcpy(tmp, term->misc.preedit_type); + for(s = tmp; s && !found;) { + while (*s && isspace(*s)) s++; + if (!*s) break; + if (ns = end = index(s, ',')) + ns++; + else + end = s + strlen(s); + while (isspace(*end)) end--; + *end = '\0'; + + if (!strcmp(s, "OverTheSpot")) { + input_style = (XIMPreeditPosition | XIMStatusArea); + } else if (!strcmp(s, "OffTheSpot")) { + input_style = (XIMPreeditArea | XIMStatusArea); + } else if (!strcmp(s, "Root")) { + input_style = (XIMPreeditNothing | XIMStatusNothing); + } + for (i = 0; (unsigned short)i < xim_styles->count_styles; i++) + if (input_style == xim_styles->supported_styles[i]) { + found = True; + break; + } + + s = ns; + } + XFree(xim_styles); + + if (!found) { + fprintf(stderr, "input method doesn't support my preedit type\n"); + XCloseIM(xim); + return; + } + + /* + * This program only understands the Root preedit_style yet + * Then misc.preedit_type should default to: + * "OverTheSpot,OffTheSpot,Root" + * + * /MaF + */ + if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { + fprintf(stderr,"This program only supports the 'Root' preedit type\n"); + XCloseIM(xim); + return; + } + + term->screen.xic = XCreateIC(xim, XNInputStyle, input_style, + XNClientWindow, term->core.window, + XNFocusWindow, term->core.window, + NULL); + + if (!term->screen.xic) { + fprintf(stderr,"Failed to create input context\n"); + XCloseIM(xim); + } + + return; +} + +#endif + + +static Boolean VTSetValues (cur, request, new, args, num_args) + Widget cur, request, new; + ArgList args; + Cardinal *num_args; +{ + XgtermWidget curvt = (XgtermWidget) cur; + XgtermWidget newvt = (XgtermWidget) new; + Boolean refresh_needed = FALSE; + Boolean fonts_redone = FALSE; + + if(curvt->core.background_pixel != newvt->core.background_pixel + || curvt->screen.foreground != newvt->screen.foreground + || curvt->screen.menu_font_names[curvt->screen.menu_font_number] + != newvt->screen.menu_font_names[newvt->screen.menu_font_number] + || curvt->misc.f_n != newvt->misc.f_n) { + if(curvt->misc.f_n != newvt->misc.f_n) + newvt->screen.menu_font_names[fontMenu_fontdefault] = newvt->misc.f_n; + if (LoadNewFont(&newvt->screen, + newvt->screen.menu_font_names[curvt->screen.menu_font_number], + newvt->screen.menu_font_names[curvt->screen.menu_font_number], + TRUE, newvt->screen.menu_font_number)) { + /* resizing does the redisplay, so don't ask for it here */ + refresh_needed = TRUE; + fonts_redone = TRUE; + } else + if(curvt->misc.f_n != newvt->misc.f_n) + newvt->screen.menu_font_names[fontMenu_fontdefault] = curvt->misc.f_n; + } + if(!fonts_redone + && curvt->screen.cursorcolor != newvt->screen.cursorcolor) { + set_cursor_gcs(&newvt->screen); + refresh_needed = TRUE; + } + if(curvt->misc.re_verse != newvt->misc.re_verse) { + newvt->flags ^= REVERSE_VIDEO; + ReverseVideo(newvt); + newvt->misc.re_verse = !newvt->misc.re_verse; /* ReverseVideo toggles */ + refresh_needed = TRUE; + } + if(curvt->screen.mousecolor != newvt->screen.mousecolor + || curvt->screen.mousecolorback != newvt->screen.mousecolorback) { + recolor_cursor (newvt->screen.pointer_cursor, + newvt->screen.mousecolor, + newvt->screen.mousecolorback); + refresh_needed = TRUE; + } + if ((curvt->misc.scrollbar != newvt->misc.scrollbar) && + (curvt->misc.sb_right != newvt->misc.sb_right)) { + if (newvt->misc.scrollbar || newvt->misc.sb_right) { + ScrollBarOn (newvt, FALSE, FALSE); + } else { + ScrollBarOff (&newvt->screen); + } + update_scrollbar(); + } + + return refresh_needed; +} + +/* + * Shows cursor at new cursor position in screen. + */ +ShowCursor() +{ + register TScreen *screen = &term->screen; + register int x, y, flags; + Char c; + GC currentGC; + Boolean in_selection; + + if (eventMode != NORMAL) return; + + if (screen->cur_row - screen->topline > screen->max_row) + return; + c = screen->buf[y = 4 * (screen->cursor_row = screen->cur_row)] + [x = screen->cursor_col = screen->cur_col]; + flags = screen->buf[y + 1][x]; + if (c == 0) + c = ' '; + + if (screen->cur_row > screen->endHRow || + (screen->cur_row == screen->endHRow && + screen->cur_col >= screen->endHCol) || + screen->cur_row < screen->startHRow || + (screen->cur_row == screen->startHRow && + screen->cur_col < screen->startHCol)) + in_selection = False; + else + in_selection = True; + + if(screen->select || screen->always_highlight) { + if (( (flags & INVERSE) && !in_selection) || + (!(flags & INVERSE) && in_selection)){ + /* text is reverse video */ + if (screen->cursorGC) { + currentGC = screen->cursorGC; + } else { + if (flags & BOLD) { + currentGC = screen->normalboldGC; + } else { + currentGC = screen->normalGC; + } + } + } else { /* normal video */ + if (screen->reversecursorGC) { + currentGC = screen->reversecursorGC; + } else { + if (flags & BOLD) { + currentGC = screen->reverseboldGC; + } else { + currentGC = screen->reverseGC; + } + } + } +#if 0 + /*RFB*/ + if ( flags & BG_COLOR ) + XSetForeground( screen->display, currentGC, + screen->colors[ term->cur_background ]); + if ( flags & FG_COLOR ) + XSetBackground( screen->display, currentGC, + screen->colors[ term->cur_foreground ]); + /**********************************************************/ + /* */ + /* we test "flags and background" before calling */ + /* XSetForeground; */ + /* */ + /* it looks funny, but we're in reverse video and the */ + /* color we're setting it to is the current background */ + /* color! */ + /* */ + /**********************************************************/ + /*RFB*/ +#endif + } else { /* not selected */ + if (( (flags & INVERSE) && !in_selection) || + (!(flags & INVERSE) && in_selection)) { + /* text is reverse video */ + currentGC = screen->reverseGC; + } else { /* normal video */ + currentGC = screen->normalGC; + } +#if 0 + /*RFB*/ + if ( flags & FG_COLOR ) + XSetForeground( screen->display, currentGC, + screen->colors[ term->cur_foreground ]); + if ( flags & BG_COLOR ) + XSetBackground( screen->display, currentGC, + screen->colors[ term->cur_background ]); + /*RFB*/ +#endif + } + + x = CursorX (screen, screen->cur_col); + y = CursorY(screen, screen->cur_row) + + screen->fnt_norm->ascent; + XDrawImageString(screen->display, TextWindow(screen), currentGC, + x, y, (char *) &c, 1); + + if((flags & BOLD) && screen->enbolden) /* no bold font */ + XDrawString(screen->display, TextWindow(screen), currentGC, + x + 1, y, (char *) &c, 1); + if((flags & UNDERLINE) && screen->underline) + XDrawLine(screen->display, TextWindow(screen), currentGC, + x, y+1, x + FontWidth(screen), y+1); + if (!screen->select && !screen->always_highlight) { + screen->box->x = x; + screen->box->y = y - screen->fnt_norm->ascent; + XDrawLines (screen->display, TextWindow(screen), + screen->cursoroutlineGC ? screen->cursoroutlineGC + : currentGC, + screen->box, NBOX, CoordModePrevious); + } + screen->cursor_state = ON; +} + +/* + * hide cursor at previous cursor position in screen. + */ +HideCursor() +{ + register TScreen *screen = &term->screen; + GC currentGC; + register int x, y, flags, fg, bg; + register Pixel fg_pix, bg_pix; + char c; + Boolean in_selection; + + if(screen->cursor_row - screen->topline > screen->max_row) + return; + c = screen->buf[y = 4 * screen->cursor_row][x = screen->cursor_col]; + flags = screen->buf[y + 1][x]; + fg = screen->buf[y + 2][x]; + bg = screen->buf[y + 3][x]; + + fg_pix = (flags&FG_COLOR) ? screen->colors[fg] : + screen->foreground; + bg_pix = (flags&BG_COLOR) ? screen->colors[bg] : + term->core.background_pixel; + + if (screen->cursor_row > screen->endHRow || + (screen->cursor_row == screen->endHRow && + screen->cursor_col >= screen->endHCol) || + screen->cursor_row < screen->startHRow || + (screen->cursor_row == screen->startHRow && + screen->cursor_col < screen->startHCol)) + in_selection = False; + else + in_selection = True; + + if (( (flags & INVERSE) && !in_selection) || + (!(flags & INVERSE) && in_selection)) { + if(flags & BOLD) + currentGC = screen->reverseboldGC; + else + currentGC = screen->reverseGC; + if (term->misc.dynamicColors) { + XSetForeground(screen->display, currentGC, bg_pix); + XSetBackground(screen->display, currentGC, fg_pix); + } + } else { + if(flags & BOLD) + currentGC = screen->normalboldGC; + else + currentGC = screen->normalGC; + if (term->misc.dynamicColors) { + XSetForeground(screen->display, currentGC, fg_pix); + XSetBackground(screen->display, currentGC, bg_pix); + } + } + + if (c == 0) + c = ' '; + x = CursorX (screen, screen->cursor_col); + y = (((screen->cursor_row - screen->topline) * FontHeight(screen))) + + screen->border; + y = y+screen->fnt_norm->ascent; + XDrawImageString(screen->display, TextWindow(screen), currentGC, + x, y, &c, 1); + if((flags & BOLD) && screen->enbolden) + XDrawString(screen->display, TextWindow(screen), currentGC, + x + 1, y, &c, 1); + if((flags & UNDERLINE) && screen->underline) + XDrawLine(screen->display, TextWindow(screen), currentGC, + x, y+1, x + FontWidth(screen), y+1); + screen->cursor_state = OFF; +} + +VTReset(full) + Boolean full; +{ + register TScreen *screen = &term->screen; + + /* reset scrolling region */ + screen->top_marg = 0; + screen->bot_marg = screen->max_row; + term->flags &= ~ORIGIN; + if(full) { + TabReset (term->tabs); + term->keyboard.flags = 0; + update_appcursor(); + update_appkeypad(); + screen->gsets[0] = 'B'; + screen->gsets[1] = 'B'; + screen->gsets[2] = 'B'; + screen->gsets[3] = 'B'; + screen->curgl = 0; + screen->curgr = 2; + screen->curss = 0; + FromAlternate(screen); + ClearScreen(screen); + screen->cursor_state = OFF; + if (term->flags & REVERSE_VIDEO) + ReverseVideo(term); + + term->flags = term->initflags; + update_reversevideo(); + update_autowrap(); + update_reversewrap(); + update_autolinefeed(); + screen->jumpscroll = !(term->flags & SMOOTHSCROLL); + update_jumpscroll(); + if(screen->c132 && (term->flags & IN132COLUMNS)) { + Dimension junk; + + if (term->misc.sb_right) { + XtMakeResizeRequest( + (Widget) term, + (Dimension) 80*FontWidth(screen) + + 2 * screen->border, + (Dimension) FontHeight(screen) + * (screen->max_row + 1) + 2 * screen->border, + &junk, &junk); + } else { + XtMakeResizeRequest( + (Widget) term, + (Dimension) 80*FontWidth(screen) + + 2 * screen->border + screen->scrollbar, + (Dimension) FontHeight(screen) + * (screen->max_row + 1) + 2 * screen->border, + &junk, &junk); + } + XSync(screen->display, FALSE); /* synchronize */ + if(XtAppPending(app_con)) + xevents(); + } + CursorSet(screen, 0, 0, term->flags); + } + longjmp(vtjmpbuf, 1); /* force ground state in parser */ +} + + + +/* + * set_character_class - takes a string of the form + * + * low[-high]:val[,low[-high]:val[...]] + * + * and sets the indicated ranges to the indicated values. + */ + +int set_character_class (s) + register char *s; +{ + register int i; /* iterator, index into s */ + int len; /* length of s */ + int acc; /* accumulator */ + int low, high; /* bounds of range [0..127] */ + int base; /* 8, 10, 16 (octal, decimal, hex) */ + int numbers; /* count of numbers per range */ + int digits; /* count of digits in a number */ + static char *errfmt = "%s: %s in range string \"%s\" (position %d)\n"; + extern char *ProgramName; + + if (!s || !s[0]) return -1; + + base = 10; /* in case we ever add octal, hex */ + low = high = -1; /* out of range */ + + for (i = 0, len = strlen (s), acc = 0, numbers = digits = 0; + i < len; i++) { + char c = s[i]; + + if (isspace(c)) { + continue; + } else if (isdigit(c)) { + acc = acc * base + (c - '0'); + digits++; + continue; + } else if (c == '-') { + low = acc; + acc = 0; + if (digits == 0) { + fprintf (stderr, errfmt, ProgramName, "missing number", s, i); + return (-1); + } + digits = 0; + numbers++; + continue; + } else if (c == ':') { + if (numbers == 0) + low = acc; + else if (numbers == 1) + high = acc; + else { + fprintf (stderr, errfmt, ProgramName, "too many numbers", + s, i); + return (-1); + } + digits = 0; + numbers++; + acc = 0; + continue; + } else if (c == ',') { + /* + * now, process it + */ + + if (high < 0) { + high = low; + numbers++; + } + if (numbers != 2) { + fprintf (stderr, errfmt, ProgramName, "bad value number", + s, i); + } else if (SetCharacterClassRange (low, high, acc) != 0) { + fprintf (stderr, errfmt, ProgramName, "bad range", s, i); + } + + low = high = -1; + acc = 0; + digits = 0; + numbers = 0; + continue; + } else { + fprintf (stderr, errfmt, ProgramName, "bad character", s, i); + return (-1); + } /* end if else if ... else */ + + } + + if (low < 0 && high < 0) return (0); + + /* + * now, process it + */ + + if (high < 0) high = low; + if (numbers < 1 || numbers > 2) { + fprintf (stderr, errfmt, ProgramName, "bad value number", s, i); + } else if (SetCharacterClassRange (low, high, acc) != 0) { + fprintf (stderr, errfmt, ProgramName, "bad range", s, i); + } + + return (0); +} + +/* ARGSUSED */ +static void HandleKeymapChange(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + static XtTranslations keymap, original; + static XtResource key_resources[] = { + { XtNtranslations, XtCTranslations, XtRTranslationTable, + sizeof(XtTranslations), 0, XtRTranslationTable, (XtPointer)NULL} + }; + char mapName[1000]; + char mapClass[1000]; + + if (*param_count != 1) return; + + if (original == NULL) original = w->core.tm.translations; + + if (strcmp(params[0], "None") == 0) { + XtOverrideTranslations(w, original); + return; + } + (void) sprintf( mapName, "%sKeymap", params[0] ); + (void) strcpy( mapClass, mapName ); + if (islower(mapClass[0])) mapClass[0] = toupper(mapClass[0]); + XtGetSubresources( w, (XtPointer)&keymap, mapName, mapClass, + key_resources, (Cardinal)1, NULL, (Cardinal)0 ); + if (keymap != NULL) + XtOverrideTranslations(w, keymap); +} + + +/* ARGSUSED */ +static void HandleBell(w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* [0] = volume */ + Cardinal *param_count; /* 0 or 1 */ +{ + int percent = (*param_count) ? atoi(params[0]) : 0; + + XBell( XtDisplay(w), percent ); +} + + +/* ARGSUSED */ +static void HandleVisualBell(w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + VisualBell(); +} + + +/* ARGSUSED */ +static void HandleIgnore(w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + /* do nothing, but check for funny escape sequences */ + (void) SendMousePosition(w, event); +} + + +/* ARGSUSED */ +static void +DoSetSelectedFont(w, client_data, selection, type, value, length, format) + Widget w; + XtPointer client_data; + Atom *selection, *type; + XtPointer value; + unsigned long *length; + int *format; +{ + char *val = (char *)value; + int len; + if (*type != XA_STRING || *format != 8) { + Bell(); + return; + } + len = strlen(val); + if (len > 0) { + if (val[len-1] == '\n') val[len-1] = '\0'; + /* Do some sanity checking to avoid sending a long selection + back to the server in an OpenFont that is unlikely to succeed. + XLFD allows up to 255 characters and no control characters; + we are a little more liberal here. */ + if (len > 1000 || strchr(val, '\n')) + return; + if (!LoadNewFont (&term->screen, val, NULL, True, fontMenu_fontsel)) + Bell(); + } +} + +void FindFontSelection (atom_name, justprobe) + char *atom_name; + Bool justprobe; +{ + static AtomPtr *atoms; + static int atomCount = 0; + AtomPtr *pAtom; + int a; + Atom target; + + if (!atom_name) atom_name = "PRIMARY"; + + for (pAtom = atoms, a = atomCount; a; a--, pAtom++) { + if (strcmp(atom_name, XmuNameOfAtom(*pAtom)) == 0) break; + } + if (!a) { + atoms = (AtomPtr*) XtRealloc ((char *)atoms, + sizeof(AtomPtr)*(atomCount+1)); + *(pAtom = &atoms[atomCount++]) = XmuMakeAtom(atom_name); + } + + target = XmuInternAtom(XtDisplay(term), *pAtom); + if (justprobe) { + term->screen.menu_font_names[fontMenu_fontsel] = + XGetSelectionOwner(XtDisplay(term), target) ? _Font_Selected_ : NULL; + } else { + XtGetSelectionValue((Widget)term, target, XA_STRING, + DoSetSelectedFont, NULL, + XtLastTimestampProcessed(XtDisplay(term))); + } + return; +} + + +/* ARGSUSED */ +void HandleSetFont(w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* unused */ + Cardinal *param_count; /* unused */ +{ + int fontnum; + char *name1 = NULL, *name2 = NULL; + + if (*param_count == 0) { + fontnum = fontMenu_fontdefault; + } else { + int maxparams = 1; /* total number of params allowed */ + + switch (params[0][0]) { + case 'd': case 'D': case '0': + fontnum = fontMenu_fontdefault; break; + case '1': + fontnum = fontMenu_font1; break; + case '2': + fontnum = fontMenu_font2; break; + case '3': + fontnum = fontMenu_font3; break; + case '4': + fontnum = fontMenu_font4; break; + case '5': + fontnum = fontMenu_font5; break; + case '6': + fontnum = fontMenu_font6; break; + case 'e': case 'E': + fontnum = fontMenu_fontescape; maxparams = 3; break; + case 's': case 'S': + fontnum = fontMenu_fontsel; maxparams = 2; break; + default: + Bell(); + return; + } + if (*param_count > maxparams) { /* see if extra args given */ + Bell(); + return; + } + switch (*param_count) { /* assign 'em */ + case 3: + name2 = params[2]; + /* fall through */ + case 2: + name1 = params[1]; + break; + } + } + + SetVTFont (fontnum, True, name1, name2); +} + + +void SetVTFont (i, doresize, name1, name2) + int i; + Bool doresize; + char *name1, *name2; +{ + TScreen *screen = &term->screen; + + if (i < 0 || i >= NMENUFONTS) { + Bell(); + return; + } + if (i == fontMenu_fontsel) { /* go get the selection */ + FindFontSelection (name1, False); /* name1 = atom, name2 is ignored */ + return; + } + if (!name1) name1 = screen->menu_font_names[i]; + if (!LoadNewFont(screen, name1, name2, doresize, i)) { + Bell(); + } + return; +} + + +int LoadNewFont (screen, nfontname, bfontname, doresize, fontnum) + TScreen *screen; + char *nfontname, *bfontname; + Bool doresize; + int fontnum; +{ + XFontStruct *nfs = NULL, *bfs = NULL; + XGCValues xgcv; + unsigned long mask; + GC new_normalGC = NULL, new_normalboldGC = NULL; + GC new_reverseGC = NULL, new_reverseboldGC = NULL; + char *tmpname = NULL; + + if (!nfontname) return 0; + + if (fontnum == fontMenu_fontescape && + nfontname != screen->menu_font_names[fontnum]) { + tmpname = (char *) malloc (strlen(nfontname) + 1); + if (!tmpname) return 0; + strcpy (tmpname, nfontname); + } + + if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad; + if (nfs->ascent + nfs->descent == 0 || nfs->max_bounds.width == 0) + goto bad; /* can't use a 0-sized font */ + + if (!(bfontname && + (bfs = XLoadQueryFont (screen->display, bfontname)))) + bfs = nfs; + else + if (bfs->ascent + bfs->descent == 0 || bfs->max_bounds.width == 0) + goto bad; /* can't use a 0-sized font */ + + mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures | + GCFunction); + + xgcv.font = nfs->fid; + xgcv.foreground = screen->foreground; + xgcv.background = term->core.background_pixel; + xgcv.graphics_exposures = TRUE; /* default */ + xgcv.function = GXcopy; + + new_normalGC = XtGetGC((Widget)term, mask, &xgcv); + if (!new_normalGC) goto bad; + + if (nfs == bfs) { /* there is no bold font */ + new_normalboldGC = new_normalGC; + } else { + xgcv.font = bfs->fid; + new_normalboldGC = XtGetGC((Widget)term, mask, &xgcv); + if (!new_normalboldGC) goto bad; + } + + xgcv.font = nfs->fid; + xgcv.foreground = term->core.background_pixel; + xgcv.background = screen->foreground; + new_reverseGC = XtGetGC((Widget)term, mask, &xgcv); + if (!new_reverseGC) goto bad; + + if (nfs == bfs) { /* there is no bold font */ + new_reverseboldGC = new_reverseGC; + } else { + xgcv.font = bfs->fid; + new_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv); + if (!new_reverseboldGC) goto bad; + } + + if (screen->normalGC != screen->normalboldGC) + XtReleaseGC ((Widget) term, screen->normalboldGC); + XtReleaseGC ((Widget) term, screen->normalGC); + if (screen->reverseGC != screen->reverseboldGC) + XtReleaseGC ((Widget) term, screen->reverseboldGC); + XtReleaseGC ((Widget) term, screen->reverseGC); + screen->normalGC = new_normalGC; + screen->normalboldGC = new_normalboldGC; + screen->reverseGC = new_reverseGC; + screen->reverseboldGC = new_reverseboldGC; + screen->fnt_norm = nfs; + screen->fnt_bold = bfs; + screen->enbolden = (nfs == bfs); + set_menu_font (False); + screen->menu_font_number = fontnum; + set_menu_font (True); + if (tmpname) { /* if setting escape or sel */ + if (screen->menu_font_names[fontnum]) + free (screen->menu_font_names[fontnum]); + screen->menu_font_names[fontnum] = tmpname; + if (fontnum == fontMenu_fontescape) { + set_sensitivity (term->screen.fontMenu, + fontMenuEntries[fontMenu_fontescape].widget, + TRUE); + } + } + set_cursor_gcs (screen); + update_font_info (screen, doresize); + return 1; + + bad: + if (tmpname) free (tmpname); + if (new_normalGC) + XtReleaseGC ((Widget) term, screen->normalGC); + if (new_normalGC && new_normalGC != new_normalboldGC) + XtReleaseGC ((Widget) term, new_normalboldGC); + if (new_reverseGC) + XtReleaseGC ((Widget) term, new_reverseGC); + if (new_reverseGC && new_reverseGC != new_reverseboldGC) + XtReleaseGC ((Widget) term, new_reverseboldGC); + if (nfs) XFreeFont (screen->display, nfs); + if (bfs && nfs != bfs) XFreeFont (screen->display, bfs); + return 0; +} + +static void +update_font_info (screen, doresize) + TScreen *screen; + Bool doresize; +{ + int i, j, width, height, scrollbar_width; + + screen->fullVwin.f_width = screen->fnt_norm->max_bounds.width; + screen->fullVwin.f_height = (screen->fnt_norm->ascent + + screen->fnt_norm->descent); + scrollbar_width = (term->misc.scrollbar || term->misc.sb_right ? + screen->scrollWidget->core.width + + screen->scrollWidget->core.border_width : 0); + i = 2 * screen->border + scrollbar_width; + j = 2 * screen->border; + width = (screen->max_col + 1) * screen->fullVwin.f_width + i; + height = (screen->max_row + 1) * screen->fullVwin.f_height + j; + screen->fullVwin.fullwidth = width; + screen->fullVwin.fullheight = height; + screen->fullVwin.width = width - i; + screen->fullVwin.height = height - j; + + if (doresize) { + if (VWindow(screen)) { + XClearWindow (screen->display, VWindow(screen)); + } + DoResizeScreen (term); /* set to the new natural size */ + if (screen->scrollWidget) { + if (term->misc.sb_right) + ResizeScrollBar (screen->scrollWidget, + screen->fullVwin.fullwidth - + screen->scrollWidget->core.width - + screen->scrollWidget->core.border_width, 0, + (Height(screen) + screen->border * 2)-1); + else + ResizeScrollBar (screen->scrollWidget, -1, -1, + Height(screen) + screen->border * 2); + } + Redraw (); + } + set_vt_box (screen); +} + +set_vt_box (screen) + TScreen *screen; +{ + XPoint *vp; + + vp = &VTbox[1]; + (vp++)->x = FontWidth(screen) - 1; + (vp++)->y = FontHeight(screen) - 1; + (vp++)->x = -(FontWidth(screen) - 1); + vp->y = -(FontHeight(screen) - 1); + screen->box = VTbox; +} + + +set_cursor_gcs (screen) + TScreen *screen; +{ + XGCValues xgcv; + unsigned long mask; + unsigned long cc = screen->cursorcolor; + unsigned long fg = screen->foreground; + unsigned long bg = term->core.background_pixel; + GC new_cursorGC = NULL, new_reversecursorGC = NULL; + GC new_cursoroutlineGC = NULL; + + /* + * Let's see, there are three things that have "color": + * + * background + * text + * cursorblock + * + * And, there are four situation when drawing a cursor, if we decide + * that we like have a solid block of cursor color with the letter + * that it is highlighting shown in the background color to make it + * stand out: + * + * selected window, normal video - background on cursor + * selected window, reverse video - foreground on cursor + * unselected window, normal video - foreground on background + * unselected window, reverse video - background on foreground + * + * Since the last two are really just normalGC and reverseGC, we only + * need two new GC's. Under monochrome, we get the same effect as + * above by setting cursor color to foreground. + */ + + xgcv.font = screen->fnt_norm->fid; + mask = (GCForeground | GCBackground | GCFont); + if (cc != fg && cc != bg) { + /* we have a colored cursor */ + xgcv.foreground = fg; + xgcv.background = cc; + new_cursorGC = XtGetGC ((Widget) term, mask, &xgcv); + + if (screen->always_highlight) { + new_reversecursorGC = (GC) 0; + new_cursoroutlineGC = (GC) 0; + } else { + xgcv.foreground = bg; + xgcv.background = cc; + new_reversecursorGC = XtGetGC ((Widget) term, mask, &xgcv); + xgcv.foreground = cc; + xgcv.background = bg; + new_cursoroutlineGC = XtGetGC ((Widget) term, mask, &xgcv); + } + } else { + new_cursorGC = (GC) 0; + new_reversecursorGC = (GC) 0; + new_cursoroutlineGC = (GC) 0; + } + if (screen->cursorGC) XtReleaseGC ((Widget)term, screen->cursorGC); + if (screen->reversecursorGC) + XtReleaseGC ((Widget)term, screen->reversecursorGC); + if (screen->cursoroutlineGC) + XtReleaseGC ((Widget)term, screen->cursoroutlineGC); + screen->cursorGC = new_cursorGC; + screen->reversecursorGC = new_reversecursorGC; + screen->cursoroutlineGC = new_cursoroutlineGC; +} diff --git a/vendor/x11iraf/xgterm/ctlseqs.ms b/vendor/x11iraf/xgterm/ctlseqs.ms new file mode 100644 index 00000000..d5b7d740 --- /dev/null +++ b/vendor/x11iraf/xgterm/ctlseqs.ms @@ -0,0 +1,587 @@ +.\"#! troff -ms $1 -*- Nroff -*- +.\" "Xterm Control Sequences" document +.\" $XConsortium: ctlseqs.ms,v 1.8 91/07/21 15:30:31 gildea Exp $ +.\" +.\" Copyright 1991 by the Massachusetts Institute of Technology +.\" +.\" Permission to use, copy, modify, and distribute this documentation +.\" for any purpose and without fee is hereby granted, provided +.\" that the above copyright notice appears in all copies, +.\" and that the name of M.I.T. not be used in advertising +.\" or publicity pertaining to distribution of the software without specific, +.\" written prior permission. M.I.T. makes no representations about the +.\" suitability of the software described here for any purpose, nor +.\" about the accuracy of this documentation. It is provided "as is" +.\" without express or implied warranty. +.\" +.\" The X Window System is a Trademark of MIT. +.\" +.\" Originally written by Edward Moy, University of California, +.\" Berkeley, edmoy@violet.berkeley.edu, for the X.V10R4 xterm. +.\" The X Consortium staff has since updated it for X11. +.\" +.\" Run this file through troff and use the -ms macro package. +.ND +.de St +.sp +.nr PD 0 +.nr PI 1.5i +.nr VS 16 +.. +.de Ed +.nr PD .3v +.nr VS 12 +.. +.rm CH +.ds LH Xterm Control Sequences +.nr s 6*\n(PS/10 +.ds L \s\nsBEL\s0 +.ds E \s\nsESC\s0 +.ds T \s\nsTAB\s0 +.ds X \s\nsETX\s0 +.ds N \s\nsENQ\s0 +.ds e \s\nsETB\s0 +.ds C \s\nsCAN\s0 +.ds S \s\nsSUB\s0 +.nr [W \w'\*L'u +.nr w \w'\*E'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*T'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*X'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*N'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*e'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*C'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*S'u +.if \nw>\n([W .nr [W \nw +.nr [W +\w'\|\|'u +.de [] +.nr w \w'\\$2' +.nr H \\n([Wu-\\nwu +.nr h \\nHu/2u +.ds \\$1 \(br\v'-1p'\(br\v'1p'\h'\\nhu'\\$2\h'\\nHu-\\nhu'\(br\l'-\\n([Wu\(ul'\v'-1p'\(br\l'-\\n([Wu\(rn'\v'1p'\| +.. +.[] Et \v'-1p'\*X\v'1p' +.[] En \v'-1p'\*N\v'1p' +.[] Be \v'-1p'\*L\v'1p' +.[] Bs \v'-1p'\s\nsBS\s0\v'1p' +.[] Ta \v'-1p'\*T\v'1p' +.[] Lf \v'-1p'\s\nsLF\s0\v'1p' +.[] Vt \v'-1p'\s\nsVT\s0\v'1p' +.[] Ff \v'-1p'\s\nsFF\s0\v'1p' +.[] Cr \v'-1p'\s\nsCR\s0\v'1p' +.[] So \v'-1p'\s\nsSO\s0\v'1p' +.[] Si \v'-1p'\s\nsSI\s0\v'1p' +.[] Eb \v'-1p'\*e\v'1p' +.[] Ca \v'-1p'\*C\v'1p' +.[] Su \v'-1p'\*S\v'1p' +.[] Es \v'-1p'\*E\v'1p' +.[] Fs \v'-1p'\s\nsFS\s0\v'1p' +.[] Gs \v'-1p'\s\nsGS\s0\v'1p' +.[] Rs \v'-1p'\s\nsRS\s0\v'1p' +.[] Us \v'-1p'\s\nsUS\s0\v'1p' +.[] ! ! +.[] # # +.[] (( ( +.[] ) ) +.[] * * +.[] + + +.[] 0 0 +.[] 1 1 +.[] 2 2 +.[] 3 3 +.[] 4 4 +.[] 5 5 +.[] 6 6 +.[] 7 7 +.[] 8 8 +.[] 9 9 +.[] : : +.[] ; ; +.[] = = +.[] > > +.[] ? ? +.[] @ @ +.[] A A +.[] cB B +.[] C C +.[] D D +.[] E E +.[] F F +.[] H H +.[] J J +.[] K K +.[] L L +.[] M M +.[] N N +.[] O O +.[] P P +.[] R R +.[] S S +.[] T T +.[] Z Z +.[] [[ [ +.[] bS \\e +.[] ] ] +.[] ^ ^ +.[] _ _ +.[] ` \` +.[] a a +.[] b b +.[] c c +.[] d d +.[] f f +.[] g g +.[] h h +.[] i i +.[] j j +.[] k k +.[] l l +.[] m m +.[] n n +.[] o o +.[] p p +.[] q q +.[] r r +.[] s s +.[] t t +.[] x x +.[] | | +.[] } } +.[] c~ ~ +.[] Sc \fIc\fP +.ds Cc \fIC\fP +.ds Cb \fIC\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP +.ds Cx \fIC\v'.3m'\h'-.2m'\s-2x\s0\v'-.3m'\fP +.ds Cy \fIC\v'.3m'\h'-.2m'\s-2y\s0\v'-.3m'\fP +.ds Ps \fIP\v'.3m'\h'-.2m'\s-2s\s0\v'-.3m'\fP +.ds Pm \fIP\v'.3m'\h'-.2m'\s-2m\s0\v'-.3m'\fP +.ds Pt \fIP\v'.3m'\h'-.2m'\s-2t\s0\v'-.3m'\fP +.ds Ix \fIx\fP +.ds Iy \fIy\fP +.ds Iw \fIw\fP +.ds Ih \fIh\fP +.ds Ir \fIr\fP +.ds Ic \fIc\fP +.nr LL 6.5i +.TL +Xterm Control Sequences +.AU +Edward Moy +.AI +University of California, Berkeley +.sp +Revised by +.AU +Stephen Gildea +.AI +MIT X Consortium + +.am NP +.ds CF % +.. +.SH +Definitions +.IP \*(Sc +The literal character \fIc\fP. +.IP \*(Cc +A single (required) character. +.IP \*(Ps +A single (usually optional) numeric parameter, composed of one of more digits. +.IP \*(Pm +A multiple numeric parameter composed of any number of single numeric +parameters, separated by \*; character(s). +.IP \*(Pt +A text parameter composed of printable characters. +.SH +VT100 Mode +.ds RH VT100 Mode +.LP +Most of these control sequences are standard VT102 control sequences, +but there are some sequences here from later DEC VT terminals, too. +Major VT102 features not supported are smooth scrolling, double size +characters, blinking characters, and VT52 mode. +There are additional control sequences to provide +\fIxterm-\fPdependent functions, like the scrollbar or window size. +Where the function is specified by DEC or ISO 6429, the code assigned +to it is given in parentheses. The escape codes to designate +character sets are specified by ISO 2022; see that document for a +discussion of character sets. +.St +.IP \\*(Be +Bell (Ctrl-G) +.IP \\*(Bs +Backspace (Ctrl-H) +.IP \\*(Ta +Horizontal Tab (HT) (Ctrl-I) +.IP \\*(Lf +Line Feed or New Line (NL) (Ctrl-J) +.IP \\*(Vt +Vertical Tab (Ctrl-K) same as LF +.IP \\*(Ff +Form Feed or New Page (NP) (Ctrl-L) same as LF +.IP \\*(Cr +Carriage Return (Ctrl-M) +.IP \\*(So +Shift Out (Ctrl-N) \(-> Switch to Alternate Character Set: invokes the +G1 character set. +.IP \\*(Si +Shift In (Ctrl-O) \(-> Switch to Standard Character Set: invokes the +G0 character set (the default). +.IP \\*(Es\\*#\\*8 +DEC Screen Alignment Test (DECALN) +.IP \\*(Es\\*(((\\*(Cc +Designate G0 Character Set (ISO 2022) + \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set + \*(Cc = \*A \(-> United Kingdom (UK) + \*(Cc = \*(cB \(-> United States (USASCII) +.IP \\*(Es\\*)\\*(Cc +Designate G1 Character Set (ISO 2022) + \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set + \*(Cc = \*A \(-> United Kingdom (UK) + \*(Cc = \*(cB \(-> United States (USASCII) +.IP \\*(Es\\**\\*(Cc +Designate G2 Character Set (ISO 2022) + \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set + \*(Cc = \*A \(-> United Kingdom (UK) + \*(Cc = \*(cB \(-> United States (USASCII) +.IP \\*(Es\\*+\\*(Cc +Designate G3 Character Set (ISO 2022) + \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set + \*(Cc = \*A \(-> United Kingdom (UK) + \*(Cc = \*(cB \(-> United States (USASCII) +.IP \\*(Es\\*7 +Save Cursor (DECSC) +.IP \\*(Es\\*8 +Restore Cursor (DECRC) +.IP \\*(Es\\*= +Application Keypad (DECPAM) +.IP \\*(Es\\*> +Normal Keypad (DECPNM) +.IP \\*(Es\\*D +Index (IND) +.IP \\*(Es\\*E +Next Line (NEL) +.IP \\*(Es\\*H +Tab Set (HTS) +.IP \\*(Es\\*M +Reverse Index (RI) +.IP \\*(Es\\*N +Single Shift Select of G2 Character Set (SS2): affects next character only +.IP \\*(Es\\*O +Single Shift Select of G3 Character Set (SS3): affects next character only +.IP \\*(Es\\*P\\*(Pt\|\\*(Es\\*(bS +Device Control String (DCS) + \fIxterm\fP implements no DCS functions; \*(Pt is ignored. +\*(Pt need not be printable characters. +.IP \\*(Es\\*Z +Return Terminal ID (DECID). Obsolete form of \*(Es\*([[\*c (DA). +.IP \\*(Es\\*([[\\*(Ps\|\\*@ +Insert \*(Ps (Blank) Character(s) (default = 1) (ICH) +.IP \\*(Es\\*([[\\*(Ps\|\\*A +Cursor Up \*(Ps Times (default = 1) (CUU) +.IP \\*(Es\\*([[\\*(Ps\|\\*(cB +Cursor Down \*(Ps Times (default = 1) (CUD) +.IP \\*(Es\\*([[\\*(Ps\|\\*C +Cursor Forward \*(Ps Times (default = 1) (CUF) +.IP \\*(Es\\*([[\\*(Ps\|\\*D +Cursor Backward \*(Ps Times (default = 1) (CUB) +.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*H +Cursor Position [row;column] (default = [1,1]) (CUP) +.IP \\*(Es\\*([[\\*(Ps\|\\*J +Erase in Display (ED) + \*(Ps = \*0 \(-> Clear Below (default) + \*(Ps = \*1 \(-> Clear Above + \*(Ps = \*2 \(-> Clear All +.IP \\*(Es\\*([[\\*(Ps\|\\*K +Erase in Line (EL) + \*(Ps = \*0 \(-> Clear to Right (default) + \*(Ps = \*1 \(-> Clear to Left + \*(Ps = \*2 \(-> Clear All +.IP \\*(Es\\*([[\\*(Ps\|\\*L +Insert \*(Ps Line(s) (default = 1) (IL) +.IP \\*(Es\\*([[\\*(Ps\|\\*M +Delete \*(Ps Line(s) (default = 1) (DL) +.IP \\*(Es\\*([[\\*(Ps\|\\*P +Delete \*(Ps Character(s) (default = 1) (DCH) +.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*;\\*(Ps\|\\*;\\*(Ps\|\\*;\\*(Ps\|\\*T +Initiate hilite mouse tracking. +Parameters are [func;startx;starty;firstrow;lastrow]. +See the section \fBMouse Tracking\fP. +.IP \\*(Es\\*([[\\*(Ps\|\\*c +Send Device Attributes (DA) + \*(Ps = \*0 or omitted \(-> request attributes from terminal + \(-> \*(Es\*([[\*?\*1\*;\*2\*c (``I am a VT100 with Advanced +Video Option.'') +.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*f +Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP) +.IP \\*(Es\\*([[\\*(Ps\|\\*g +Tab Clear (TBC) + \*(Ps = \*0 \(-> Clear Current Column (default) + \*(Ps = \*3 \(-> Clear All +.IP \\*(Es\\*([[\\*(Pm\|\\*h +Set Mode (SM) + \*(Ps = \*4 \(-> Insert Mode (IRM) + \*(Ps = \*2\*0 \(-> Automatic Newline (LNM) +.IP \\*(Es\\*([[\\*(Pm\|\\*l +Reset Mode (RM) + \*(Ps = \*4 \(-> Replace Mode (IRM) + \*(Ps = \*2\*0 \(-> Normal Linefeed (LNM) +.IP \\*(Es\\*([[\\*(Pm\|\\*m +Character Attributes (SGR) + \*(Ps = \*0 \(-> Normal (default) + \*(Ps = \*1 \(-> Bold + \*(Ps = \*4 \(-> Underscore + \*(Ps = \*5 \(-> Blink (appears as Bold) + \*(Ps = \*7 \(-> Inverse +.IP \\*(Es\\*([[\\*(Ps\|\\*n +Device Status Report (DSR) + \*(Ps = \*5 \(-> Status Report \*(Es\*([[\*0\*n (``OK'') + \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as +\*(Es\*([[\*(Ir\|\*;\*(Ic\|\*R +.IP \\*(Es\\*([[\\*(Ps\|\\*;\\*(Ps\|\\*r +Set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM) +.IP \\*(Es\\*([[\\*(Ps\|\\*x +Request Terminal Parameters (DECREQTPARM) +.IP \\*(Es\\*([[\\*?\\*(Pm\|\\*h +DEC Private Mode Set (DECSET) + \*(Ps = \*1 \(-> Application Cursor Keys (DECCKM) + \*(Ps = \*2 \(-> Designate USASCII for character sets G0-G3. +(In the VT102, this selects VT52 mode (DECANM), which \fIxterm\fP +doesn't support.) + \*(Ps = \*3 \(-> 132 Column Mode (DECCOLM) + \*(Ps = \*4 \(-> Smooth (Slow) Scroll (DECSCLM) + \*(Ps = \*5 \(-> Reverse Video (DECSCNM) + \*(Ps = \*6 \(-> Origin Mode (DECOM) + \*(Ps = \*7 \(-> Wraparound Mode (DECAWM) + \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM) + \*(Ps = \*9 \(-> Send Mouse X & Y on button press. +See the section \fBMouse Tracking\fP. + \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK) + \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode + \*(Ps = \*4\*1 \(-> \fIcurses\fP(5) fix + \*(Ps = \*4\*4 \(-> Turn On Margin Bell + \*(Ps = \*4\*5 \(-> Reverse-wraparound Mode + \*(Ps = \*4\*6 \(-> Start Logging + \*(Ps = \*4\*7 \(-> Use Alternate Screen Buffer (unless +disabled by the \fBtiteInhibit\fP resource) + \*(Ps = \*1\*0\*0\*0 \(-> Send Mouse X & Y on button press and release. +See the section \fBMouse Tracking\fP. + \*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking. +See the section \fBMouse Tracking\fP. +.IP \\*(Es\\*([[\\*?\\*(Pm\|\\*l +DEC Private Mode Reset (DECRST) + \*(Ps = \*1 \(-> Normal Cursor Keys (DECCKM) + \*(Ps = \*3 \(-> 80 Column Mode (DECCOLM) + \*(Ps = \*4 \(-> Jump (Fast) Scroll (DECSCLM) + \*(Ps = \*5 \(-> Normal Video (DECSCNM) + \*(Ps = \*6 \(-> Normal Cursor Mode (DECOM) + \*(Ps = \*7 \(-> No Wraparound Mode (DECAWM) + \*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM) + \*(Ps = \*9 \(-> Don't Send Mouse X & Y on button press + \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode + \*(Ps = \*4\*1 \(-> No \fIcurses\fP(5) fix + \*(Ps = \*4\*4 \(-> Turn Off Margin Bell + \*(Ps = \*4\*5 \(-> No Reverse-wraparound Mode + \*(Ps = \*4\*6 \(-> Stop Logging + \*(Ps = \*4\*7 \(-> Use Normal Screen Buffer + \*(Ps = \*1\*0\*0\*0 \(-> Don't Send Mouse X & Y on button press and +release + \*(Ps = \*1\*0\*0\*1 \(-> Don't Use Hilite Mouse Tracking +.IP \\*(Es\\*([[\\*?\\*(Pm\|\\*r +Restore DEC Private Mode Values. The value of \*(Ps previously saved is +restored. \*(Ps values are the same as for DECSET. +.IP \\*(Es\\*([[\\*?\\*(Pm\|\\*s +Save DEC Private Mode Values. \*(Ps values are the same as for DECSET. +.IP \\*(Es\\*]\\*(Ps\|\\*;\\*(Pt\|\\*(Be +Set Text Parameters + \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt + \*(Ps = \*1 \(-> Change Icon Name to \*(Pt + \*(Ps = \*2 \(-> Change Window Title to \*(Pt + \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt (normally disabled by a +compile-time option) + \*(Ps = \*5\*0 \(-> Set Font to \*(Pt +.IP \\*(Es\\*^\\*(Pt\|\\*(Es\\*(bS +Privacy Message (PM) + \fIxterm\fP implements no PM functions; \*(Pt is ignored. +\*(Pt need not be printable characters. +.IP \\*(Es\\*_\\*(Pt\|\\*(Es\\*(bS +Application Program Command (APC) + \fIxterm\fP implements no APC functions; \*(Pt is ignored. +\*(Pt need not be printable characters. +.IP \\*(Es\\*c +Full Reset (RIS) +.IP \\*(Es\\*n +Select the G2 Character Set (LS2) +.IP \\*(Es\\*o +Select the G3 Character Set (LS3) +.IP \\*(Es\\*| +Invoke the G3 Character Set as GR (LS3R). Has no visible effect in \fIxterm\fP. +.IP \\*(Es\\*} +Invoke the G2 Character Set as GR (LS2R). Has no visible effect in \fIxterm\fP. +.IP \\*(Es\\*(c~ +Invoke the G1 Character Set as GR (LS1R). Has no visible effect in \fIxterm\fP. +.Ed +.SH +Mouse Tracking +.LP +The VT widget can be set to send the mouse position and other +information on button presses. These modes are typically used by +editors and other full-screen applications that want to make use of +the mouse. +.LP +There are three mutually exclusive modes, each enabled (or disabled) +by a different parameter in the DECSET (or DECRST) escape sequence. +Parameters for all mouse tracking escape sequences generated by +\fIxterm\fP encode numeric parameters in a single character as +\fIvalue\fP+040. For example, \*! is 1. The screen +coodinate system is 1-based. +.LP +X10 compatibility mode sends an escape sequence on button press +encoding the location and the mouse button pressed. +It is enabled by specifying parameter 9 to DECSET. +On button press, \fIxterm\fP sends +\*(Es\*([[\*M\*(Cb\*(Cx\*(Cy (6 characters). \*(Cb is button\-1. +\*(Cx and \*(Cy are the x and y coordinates of the mouse when the +button was pressed. +.LP +Normal tracking mode sends an escape sequence on both button press and +release. Modifier information is also sent. +It is enabled by specifying parameter 1000 to DECSET. +On button press or release, \fIxterm\fP sends +\*(Es\*([[\*M\*(Cb\*(Cx\*(Cy. +The low two bits of \*(Cb encode button information: +0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. +The upper bits encode what modifiers were down when the button was +pressed and are added together. 4=Shift, 8=Meta, 16=Control. +\*(Cx and \*(Cy are the x and y coordinates of the mouse event. The +upper left corner is (1,1). +.LP +Mouse hilite tracking notifies a program of a button press, receives a +range of lines from the program, highlights the region covered by +the mouse within that range until button release, and then sends the +program the release coordinates. +It is enabled by specifying parameter 1001 to DECSET. +Warning: use of this mode requires a cooperating program or it will +hang \fIxterm.\fP +On button press, the same information as for normal tracking is +generated; \fIxterm\fP then waits for the program to send mouse +tracking information. +\fIAll X events are ignored until the proper escape sequence is +received from the pty:\fP +\*(Es\*([[\*(Ps\|\*;\*(Ps\|\*;\*(Ps\|\*;\*(Ps\|\*;\*(Ps\|\*T. +The parameters are \fIfunc, startx, starty, firstrow,\fP and \fIlastrow.\fP +\fIfunc\fP is non-zero to initiate hilite tracking and zero to abort. +\fIstartx\fP and \fIstarty\fP give the starting x and y location for +the highlighted region. The ending location tracks the mouse, but +will never be above row \fIfirstrow\fP and will always be above row +\fIlastrow.\fP (The top of the screen is row 1.) +When the button is released, \fIxterm\fP reports the ending position +one of two ways: if the start and end coordinates are valid text +locations: \*(Es\*([[\*t\*(Cx\*(Cy. If either coordinate is past +the end of the line: +\*(Es\*([[\*T\*(Cx\*(Cy\*(Cx\*(Cy\*(Cx\*(Cy. +The parameters are \fIstartx, starty, endx, endy, mousex,\fP and \fImousey.\fP +\fIstartx, starty, endx, \fPand\fI endy\fP give the starting and +ending character positions of the region. \fImousex\fP and \fImousey\fP +give the location of the mouse at button up, which may not be over a +character. +.SH +Tektronix 4014 Mode +.ds RH Tektronix 4014 Mode +.LP +Most of these sequences are standard Tektronix 4014 control sequences. +The major features missing are +the write-thru and defocused modes. +This document does not describe the commands used in the various +Tektronix plotting modes but does describe the commands to switch modes. +.St +.IP \\*(Be +Bell (Ctrl-G) +.IP \\*(Bs +Backspace (Ctrl-H) +.IP \\*(Ta +Horizontal Tab (Ctrl-I) +.IP \\*(Lf +Line Feed or New Line (Ctrl-J) +.IP \\*(Vt +Cursor up (Ctrl-K) +.IP \\*(Ff +Form Feed or New Page (Ctrl-L) +.IP \\*(Cr +Carriage Return (Ctrl-M) +.IP \\*(Es\\*(Et +Switch to VT100 Mode (ESC Ctrl-C) +.IP \\*(Es\\*(En +Return Terminal Status (ESC Ctrl-E) +.IP \\*(Es\\*(Lf +PAGE (Clear Screen) +.IP \\*(Es\\*(So +Begin 4015 APL mode (ignored by \fIxterm\fP) (ESC Ctrl-N) +.IP \\*(Es\\*(Si +End 4015 APL mode (ignored by \fIxterm\fP) (ESC Ctrl-O) +.IP \\*(Es\\*(Eb +COPY (Save Tektronix Codes to file COPYyy-mm-dd.hh:mm:ss) (ESC Ctrl-W) +.IP \\*(Es\\*(Ca +Bypass Condition (ESC Ctrl-X) +.IP \\*(Es\\*(Su +GIN mode (ESC Ctrl-Z) +.IP \\*(Es\\*(Fs +Special Point Plot Mode (ESC Ctrl-\e) +.IP \\*(Es\\*8 +Select Large Character Set +.IP \\*(Es\\*9 +Select #2 Character Set +.IP \\*(Es\\*: +Select #3 Character Set +.IP \\*(Es\\*; +Select Small Character Set +.IP \\*(Es\\*]\\*(Ps\|\\*;\\*(Pt\|\\*(Be +Set Text Parameters of VT window + \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt + \*(Ps = \*1 \(-> Change Icon Name to \*(Pt + \*(Ps = \*2 \(-> Change Window Title to \*(Pt + \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt +.IP \\*(Es\\*` +Normal Z Axis and Normal (solid) Vectors +.IP \\*(Es\\*a +Normal Z Axis and Dotted Line Vectors +.IP \\*(Es\\*b +Normal Z Axis and Dot-Dashed Vectors +.IP \\*(Es\\*c +Normal Z Axis and Short-Dashed Vectors +.IP \\*(Es\\*d +Normal Z Axis and Long-Dashed Vectors +.IP \\*(Es\\*h +Defocused Z Axis and Normal (solid) Vectors +.IP \\*(Es\\*i +Defocused Z Axis and Dotted Line Vectors +.IP \\*(Es\\*j +Defocused Z Axis and Dot-Dashed Vectors +.IP \\*(Es\\*k +Defocused Z Axis and Short-Dashed Vectors +.IP \\*(Es\\*l +Defocused Z Axis and Long-Dashed Vectors +.IP \\*(Es\\*p +Write-Thru Mode and Normal (solid) Vectors +.IP \\*(Es\\*q +Write-Thru Mode and Dotted Line Vectors +.IP \\*(Es\\*r +Write-Thru Mode and Dot-Dashed Vectors +.IP \\*(Es\\*s +Write-Thru Mode and Short-Dashed Vectors +.IP \\*(Es\\*t +Write-Thru Mode and Long-Dashed Vectors +.IP \\*(Fs +Point Plot Mode (Ctrl-\e) +.IP \\*(Gs +Graph Mode (Ctrl-]) +.IP \\*(Rs +Incremental Plot Mode (Ctrl-^) +.IP \\*(Us +Alpha Mode (Ctrl-_) +.Ed diff --git a/vendor/x11iraf/xgterm/ctlseqs.ps b/vendor/x11iraf/xgterm/ctlseqs.ps new file mode 100644 index 00000000..b7167a48 --- /dev/null +++ b/vendor/x11iraf/xgterm/ctlseqs.ps @@ -0,0 +1,9696 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Mon Feb 23 13:49:22 1998 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/Y{/Symbol FF}def +%% Troff special characters not on Symbol font +%% Copyright (C) 1986 by Pipeline Associates, Inc. +%% Version 1.1 +/altRTD 20 dict def +altRTD begin +/s{setcachedevice}def +/C{1000 1000 scale}def +/m{moveto}def +/c{curveto}def +/S{stroke}def +/l{lineto}def +/a{arcto}def +/p{pop}def +/sl{setlinewidth}def +end +/F_Troff 17 dict def F_Troff begin +systemdict /currentpacking known +{/SavePacking currentpacking def true setpacking}if +/PaintType 0 def +/FontType 3 def +/StrokeWidth 0 def +/UniqueID 8277003 def +/FontMatrix [.001000 0 0 .001000 0 0] def +/FontBBox [-12 -105 942 855 ] def +/Encoding 256 array def +/CD 256 1 add dict def +/FontInfo 3 dict def FontInfo begin +/UnderlinePosition -133 def /UnderlineThickness 20 def end +/FontName (Troff) def +0 1 256 1 sub{Encoding exch /.notdef put}for +CD /.notdef{500 0 setcharwidth{}}put +Encoding (1) 0 get /br put +%% bold vertical rule used by tbl +CD /br{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +0 .9 l +{S} +}put +Encoding (2) 0 get /ul put +%% underline used by tbl +CD /ul{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +.5 -.1 l +{S} +}put +Encoding (3) 0 get /ru put +%% baseline rule +CD /ru{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +m0 +.5 0 l +{S} +}put +Encoding (4) 0 get /vr put +%% vertical rule +CD /vr{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +m0 +0 1 l +{S} +}put +Encoding (5) 0 get /sq put +%% square +CD /sq{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{S} +}put +Encoding (6) 0 get /bx put +%% solid box +CD /bx{ +C +.5 0 -.5 -.5 1 1 s +np +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{fill} +}put +Encoding (7) 0 get /rn put +%% radical extender +CD /rn{ +C +.5 0 -.5 -.5 1 1 s +np +.03 sl +-.03 .9 m +.5 0 rl +{S} +}put +Encoding (8) 0 get /GR put +%% gray mask +CD /GR{ +C +.5 0 setcharwidth +.5 setgray +np +0 -.1 m +0 1 rl +.5 0 rl +0 -1 rl +-.5 0 rl +closepath +{fill} +}put +Encoding 97 /a put +CD /a{1000 0 0 66 942 421 s 430 415 +m 578 406 678 349 662 319 c 655 306 614 287 583 +296 c 570 300 466 340 438 332 c 365 309 335 213 +270 209 c 0 310 m 108 310 l 108 114 l 0 +114 l 0 310 l 42 161 m 42 134 l 66 134 l 66 +161 l 42 161 l 47 155 m 47 140 l 62 140 l 62 +155 l 47 155 l 110 133 m 226 113 300 66 410 +80 c 497 91 550 69 634 76 c 645 76 663 92 669 +107 c 677 125 673 141 668 160 c 725 334 m 758 +332 734 253 701 250 c 501 325 m 475 316 476 309 +473 302 c 465 282 482 263 499 257 c 552 236 615 +253 689 253 c 701 253 713 236 713 218 c 712 194 +702 168 678 161 c 671 159 663 160 655 160 c 591 +158 516 156 479 168 c 461 173 453 191 453 210 c 453 +224 456 235 466 244 c 476 253 490 252 503 255 c 459 +84 m 447 96 435 106 435 123 c 435 136 440 145 447 +155 c 453 163 462 168 469 173 c 110 293 m 173 +318 300 421 435 415 c 609 407 852 416 885 411 c 898 +409 924 411 930 380 c 942 316 828 339 742 334 c 731 +334 730 335 725 335 c 701 336 685 336 660 336 c{S}}put +Encoding 98 /b put +CD /b{1000 0 -12 66 930 421 s 500 +415 m 352 406 252 349 268 319 c 275 306 316 287 +347 296 c 360 300 464 340 492 332 c 565 309 595 +213 660 209 c 930 310 m 822 310 l 822 114 l 930 +114 l 930 310 l 888 161 m 888 134 l 864 134 +l 864 161 l 888 161 l 883 155 m 883 140 l 868 +140 l 868 155 l 883 155 l 820 133 m 704 113 +630 66 520 80 c 433 91 380 69 296 76 c 285 76 +267 92 261 107 c 253 125 257 141 262 160 c 205 +334 m 172 332 196 253 229 250 c 429 325 m 455 +316 454 309 457 302 c 465 282 448 263 431 257 c 378 +236 315 253 241 253 c 229 253 217 236 217 218 c 218 +194 228 168 252 161 c 259 159 267 160 275 160 c 339 +158 414 156 451 168 c 469 173 477 191 477 210 c 477 +224 474 235 464 244 c 454 253 440 252 427 255 c 471 +84 m 483 96 495 106 495 123 c 495 136 490 145 483 +155 c 477 163 468 168 461 173 c 820 293 m 757 +318 630 421 495 415 c 321 407 78 416 45 411 c 32 +409 6 411 0 380 c -12 316 102 339 188 334 c 199 +334 200 335 205 335 c 229 336 245 336 270 336 c{S}}put +Encoding 99 /c put +CD /c{1000 0 184 0 827 627 s 185 315 +m 186 488 332 627 505 625 c 682 623 827 467 815 +290 c 804 124 666 0 500 0 c 327 0 184 142 185 +315 c{S}}put +Encoding 100 /d put +CD /d{590 0 134 158 477 500 s 300 +160 m 208 162 134 238 135 330 c 136 423 212 500 +305 500 c 397 500 473 427 475 335 c 477 239 396 +158 300 160 c{fill}}put +Encoding 101 /e put % Bell Symbol +CD /e{1010 0 -100 -210 1010 1010 s 100 sl 0 setlinecap +420 300 450 0 360 arc +420 650 m 420 575 l S +newpath 120 125 m 720 125 l 75 sl S +420 125 m 420 25 l S +220 400 m 220 175 120 175 100 a p p p p +220 400 m 220 550 420 550 80 a p p p p +620 400 m 620 175 720 175 100 a p p p p +620 400 m 620 550 420 550 80 a p p p p +295 550 m 545 550 l{S}}put +/BuildChar{altRTD /BuildChar get exec}def end +altRTD begin /BuildChar{altRTD begin +/char exch def /fontdict exch def save +/charname fontdict /Encoding get char get def +fontdict /StrokeWidth get sl +fontdict /CD get dup charname known +{charname}{/.notdef}ifelse get newpath exec +fontdict /PaintType get 0 eq{exec}{p S}ifelse +restore end}def end +systemdict /currentpacking known{F_Troff /SavePacking get setpacking}if +/Troff F_Troff definefont pop +/Y1{/Troff FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +1200 V +12 B +2574(Xterm)S +2942(Control)S +3378(Sequences)S +1440 V +10 I +2978(Edward)S +3325(Moy)S +1620 V +10 R +2547(University)S +2999(of)S +3112(California,)S +3572(Berkeley)S +1860 V +3014(Revised)S +3366(by)S +2100 V +10 I +2931(Stephen)S +3277(Gildea)S +2280 V +10 R +2846(MIT)S +3059(X)S +3161(Consortium)S +3000 V +11 B +900(De\256nitions)S +3156 V +11 Y1 +900(1)S +3146 V +900(1)S +3156 V +11 I +957(c)S +11 Y1 +1062(1)S +900(2)S +952(22)S +3146 V +1062(1)S +900(7)S +952(77)S +3156 V +11 R +1150(The)S +1353(literal)S +1642(character)S +11 I +2073(c)S +11 R +2121(.)S +3312 V +11 I +900(C)S +11 R +1150(A)S +1262(single)S +1558(\(required\))S +2027(character.)S +3468 V +11 I +900(P)S +3501 V +9 I +945(s)S +3468 V +11 R +1150(A)S +1262(single)S +1558(\(usually)S +1945(optional\))S +2375(numeric)S +2767(parameter,)S +3264(composed)S +3742(of)S +3866(one)S +4057(of)S +4181(more)S +4439(digits.)S +3624 V +11 I +900(P)S +3657 V +9 I +945(m)S +3624 V +11 R +1150(A)S +1272(multiple)S +1684(numeric)S +2087(parameter)S +2567(composed)S +3056(of)S +3191(any)S +3393(number)S +3772(of)S +3907(single)S +4214(numeric)S +4617(parameters,)S +5168(separated)S +3744 V +1150(by)S +11 Y1 +1293(1)S +3734 V +1293(1)S +3744 V +11 R +1358(;)S +11 Y1 +1455(1)S +1293(2)S +1345(22)S +3734 V +1455(1)S +1293(7)S +1345(77)S +3744 V +11 R +1506(character\(s\).)S +3900 V +11 I +900(P)S +3933 V +9 I +945(t)S +3900 V +11 R +1150(A)S +1262(text)S +1460(parameter)S +1929(composed)S +2407(of)S +2531(printable)S +2954(characters.)S +4140 V +11 B +900(VT100)S +1251(Mode)S +4296 V +11 R +900(Most)S +1171(of)S +1306(these)S +1575(control)S +1930(sequences)S +2417(are)S +2593(standard)S +3008(VT102)S +3363(control)S +3718(sequences,)S +4234(but)S +4420(there)S +4683(are)S +4860(some)S +5137(sequences)S +4416 V +900(here)S +1122(from)S +1370(later)S +1598(DEC)S +1852(VT)S +2032(terminals,)S +2503(too.)S +2739(Major)S +3041(VT102)S +3386(features)S +3765(not)S +3940(supported)S +4407(are)S +4573(smooth)S +4932(scrolling,)S +5379(dou-)S +4536 V +900(ble)S +1069(size)S +1275(characters,)S +1780(blinking)S +2184(characters,)S +2689(and)S +2883(VT52)S +3175(mode.)S +3516(There)S +3806(are)S +3974(additional)S +4450(control)S +4797(sequences)S +5276(to)S +5398(pro-)S +4656 V +900(vide)S +11 I +1132(xterm-)S +11 R +1417(dependent)S +1910(functions,)S +2390(like)S +2598(the)S +2775(scrollbar)S +3201(or)S +3335(window)S +3732(size.)S +4006(Where)S +4338(the)S +4514(function)S +4922(is)S +5038(speci\256ed)S +5470(by)S +4776 V +900(DEC)S +1157(or)S +1285(ISO)S +1499(6429,)S +1784(the)S +1955(code)S +2198(assigned)S +2613(to)S +2736(it)S +2835(is)S +2946(given)S +3227(in)S +3350(parentheses.)S +3958(The)S +4166(escape)S +4494(codes)S +4781(to)S +4905(designate)S +5357(char-)S +4896 V +900(acter)S +1144(sets)S +1342(are)S +1507(speci\256ed)S +1930(by)S +2073(ISO)S +2283(2022;)S +2567(see)S +2739(that)S +2937(document)S +3403(for)S +3563(a)S +3644(discussion)S +4136(of)S +4260(character)S +4691(sets.)S +5176 V +11 Y1 +900(1)S +5166 V +900(1)S +6 R +924(BEL)S +5176 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5166 V +1062(1)S +900(7)S +952(77)S +5176 V +11 R +1980(Bell)S +2197(\(Ctrl-G\))S +5336 V +11 Y1 +900(1)S +5326 V +900(1)S +6 R +944(BS)S +5336 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5326 V +1062(1)S +900(7)S +952(77)S +5336 V +11 R +1980(Backspace)S +2480(\(Ctrl-H\))S +5496 V +11 Y1 +900(1)S +5486 V +900(1)S +6 R +921(TAB)S +5496 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5486 V +1062(1)S +900(7)S +952(77)S +5496 V +11 R +1980(Horizontal)S +2482(Tab)S +2685(\(HT\))S +2936(\(Ctrl-I\))S +5656 V +11 Y1 +900(1)S +5646 V +900(1)S +6 R +945(LF)S +5656 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5646 V +1062(1)S +900(7)S +952(77)S +5656 V +11 R +1980(Line)S +2214(Feed)S +2460(or)S +2584(New)S +2823(Line)S +3057(\(NL\))S +3308(\(Ctrl-J\))S +5816 V +11 Y1 +900(1)S +5806 V +900(1)S +6 R +941(VT)S +5816 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5806 V +1062(1)S +900(7)S +952(77)S +5816 V +11 R +1980(Vertical)S +2365(Tab)S +2568(\(Ctrl-K\))S +2960(same)S +3218(as)S +3342(LF)S +5976 V +11 Y1 +900(1)S +5966 V +900(1)S +6 R +947(FF)S +5976 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5966 V +1062(1)S +900(7)S +952(77)S +5976 V +11 R +1980(Form)S +2252(Feed)S +2498(or)S +2622(New)S +2861(Page)S +3107(\(NP\))S +3353(\(Ctrl-L\))S +3733(same)S +3991(as)S +4115(LF)S +6136 V +11 Y1 +900(1)S +6126 V +900(1)S +6 R +941(CR)S +6136 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6126 V +1062(1)S +900(7)S +952(77)S +6136 V +11 R +1980(Carriage)S +2389(Return)S +2721(\(Ctrl-M\))S +6296 V +11 Y1 +900(1)S +6286 V +900(1)S +6 R +942(SO)S +6296 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6286 V +1062(1)S +900(7)S +952(77)S +6296 V +11 R +1980(Shift)S +2230(Out)S +2430(\(Ctrl-N\))S +11 Y +2824(\256)S +11 R +2968(Switch)S +3310(to)S +3432(Alternate)S +3875(Character)S +4335(Set:)S +4543(invokes)S +4921(the)S +5091(G1)S +5261(charac-)S +6456 V +1980(ter)S +2128(set.)S +6616 V +11 Y1 +900(1)S +6606 V +900(1)S +6 R +954(SI)S +6616 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6606 V +1062(1)S +900(7)S +952(77)S +6616 V +11 R +1980(Shift)S +2231(In)S +2358(\(Ctrl-O\))S +11 Y +2753(\256)S +11 R +2898(Switch)S +3241(to)S +3364(Standard)S +3791(Character)S +4252(Set:)S +4461(invokes)S +4840(the)S +5011(G0)S +5182(character)S +6776 V +1980(set)S +2135(\(the)S +2338(default\).)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +520 V +900(Xterm Control Sequences)S +4980(VT100 Mode)S +880 V +11 Y1 +900(1)S +870 V +900(1)S +6 R +925(ESC)S +880 V +11 Y1 +1062(1)S +900(2)S +952(22)S +870 V +1062(1)S +900(7)S +952(77)S +880 V +1080(1)S +870 V +1080(1)S +880 V +11 R +1133(#)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +870 V +1242(1)S +1080(7)S +1132(77)S +880 V +1260(1)S +870 V +1260(1)S +880 V +11 R +1313(8)S +11 Y1 +1422(1)S +1260(2)S +1312(22)S +870 V +1422(1)S +1260(7)S +1312(77)S +880 V +11 R +1980(DEC)S +2233(Screen)S +2563(Alignment)S +3067(Test)S +3289(\(DECALN\))S +1040 V +11 Y1 +900(1)S +1030 V +900(1)S +6 R +925(ESC)S +1040 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1030 V +1062(1)S +900(7)S +952(77)S +1040 V +1080(1)S +1030 V +1080(1)S +1040 V +11 R +1143(\()S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1030 V +1242(1)S +1080(7)S +1132(77)S +1040 V +11 I +1260(C)S +11 R +1980(Designate)S +2451(G0)S +2618(Character)S +3075(Set)S +3249(\(ISO)S +3495(2022\))S +1200 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +1190 V +2248(1)S +1200 V +11 R +2301(0)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +1190 V +2410(1)S +2248(7)S +2300(77)S +1200 V +11 Y +2461(\256)S +11 R +2603(DEC)S +2856(Special)S +3212(Character)S +3669(and)S +3860(Line)S +4094(Drawing)S +4510(Set)S +1360 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +1350 V +2248(1)S +1360 V +11 R +2289(A)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +1350 V +2410(1)S +2248(7)S +2300(77)S +1360 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(Kingdom)S +3384(\(UK\))S +1520 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +1510 V +2248(1)S +1520 V +11 R +2292(B)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +1510 V +2410(1)S +2248(7)S +2300(77)S +1520 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(States)S +3231(\(USASCII\))S +1680 V +11 Y1 +900(1)S +1670 V +900(1)S +6 R +925(ESC)S +1680 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1670 V +1062(1)S +900(7)S +952(77)S +1680 V +1080(1)S +1670 V +1080(1)S +1680 V +11 R +1143(\))S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1670 V +1242(1)S +1080(7)S +1132(77)S +1680 V +11 I +1260(C)S +11 R +1980(Designate)S +2451(G1)S +2618(Character)S +3075(Set)S +3249(\(ISO)S +3495(2022\))S +1840 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +1830 V +2248(1)S +1840 V +11 R +2301(0)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +1830 V +2410(1)S +2248(7)S +2300(77)S +1840 V +11 Y +2461(\256)S +11 R +2603(DEC)S +2856(Special)S +3212(Character)S +3669(and)S +3860(Line)S +4094(Drawing)S +4510(Set)S +2000 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +1990 V +2248(1)S +2000 V +11 R +2289(A)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +1990 V +2410(1)S +2248(7)S +2300(77)S +2000 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(Kingdom)S +3384(\(UK\))S +2160 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +2150 V +2248(1)S +2160 V +11 R +2292(B)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +2150 V +2410(1)S +2248(7)S +2300(77)S +2160 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(States)S +3231(\(USASCII\))S +2320 V +11 Y1 +900(1)S +2310 V +900(1)S +6 R +925(ESC)S +2320 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2310 V +1062(1)S +900(7)S +952(77)S +2320 V +1080(1)S +2310 V +1080(1)S +2320 V +11 R +1133(*)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2310 V +1242(1)S +1080(7)S +1132(77)S +2320 V +11 I +1260(C)S +11 R +1980(Designate)S +2451(G2)S +2618(Character)S +3075(Set)S +3249(\(ISO)S +3495(2022\))S +2480 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +2470 V +2248(1)S +2480 V +11 R +2301(0)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +2470 V +2410(1)S +2248(7)S +2300(77)S +2480 V +11 Y +2461(\256)S +11 R +2603(DEC)S +2856(Special)S +3212(Character)S +3669(and)S +3860(Line)S +4094(Drawing)S +4510(Set)S +2640 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +2630 V +2248(1)S +2640 V +11 R +2289(A)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +2630 V +2410(1)S +2248(7)S +2300(77)S +2640 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(Kingdom)S +3384(\(UK\))S +2800 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +2790 V +2248(1)S +2800 V +11 R +2292(B)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +2790 V +2410(1)S +2248(7)S +2300(77)S +2800 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(States)S +3231(\(USASCII\))S +2960 V +11 Y1 +900(1)S +2950 V +900(1)S +6 R +925(ESC)S +2960 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2950 V +1062(1)S +900(7)S +952(77)S +2960 V +1080(1)S +2950 V +1080(1)S +2960 V +11 R +1130(+)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2950 V +1242(1)S +1080(7)S +1132(77)S +2960 V +11 I +1260(C)S +11 R +1980(Designate)S +2451(G3)S +2618(Character)S +3075(Set)S +3249(\(ISO)S +3495(2022\))S +3120 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +3110 V +2248(1)S +3120 V +11 R +2301(0)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +3110 V +2410(1)S +2248(7)S +2300(77)S +3120 V +11 Y +2461(\256)S +11 R +2603(DEC)S +2856(Special)S +3212(Character)S +3669(and)S +3860(Line)S +4094(Drawing)S +4510(Set)S +3280 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +3270 V +2248(1)S +3280 V +11 R +2289(A)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +3270 V +2410(1)S +2248(7)S +2300(77)S +3280 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(Kingdom)S +3384(\(UK\))S +3440 V +11 I +2046(C)S +11 R +2153(=)S +11 Y1 +2248(1)S +3430 V +2248(1)S +3440 V +11 R +2292(B)S +11 Y1 +2410(1)S +2248(2)S +2300(22)S +3430 V +2410(1)S +2248(7)S +2300(77)S +3440 V +11 Y +2461(\256)S +11 R +2603(United)S +2935(States)S +3231(\(USASCII\))S +3600 V +11 Y1 +900(1)S +3590 V +900(1)S +6 R +925(ESC)S +3600 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3590 V +1062(1)S +900(7)S +952(77)S +3600 V +1080(1)S +3590 V +1080(1)S +3600 V +11 R +1133(7)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3590 V +1242(1)S +1080(7)S +1132(77)S +3600 V +11 R +1980(Save)S +2226(Cursor)S +2558(\(DECSC\))S +3760 V +11 Y1 +900(1)S +3750 V +900(1)S +6 R +925(ESC)S +3760 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3750 V +1062(1)S +900(7)S +952(77)S +3760 V +1080(1)S +3750 V +1080(1)S +3760 V +11 R +1133(8)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3750 V +1242(1)S +1080(7)S +1132(77)S +3760 V +11 R +1980(Restore)S +2348(Cursor)S +2680(\(DECRC\))S +3920 V +11 Y1 +900(1)S +3910 V +900(1)S +6 R +925(ESC)S +3920 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3910 V +1062(1)S +900(7)S +952(77)S +3920 V +1080(1)S +3910 V +1080(1)S +3920 V +11 R +1130(=)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3910 V +1242(1)S +1080(7)S +1132(77)S +3920 V +11 R +1980(Application)S +2532(Keypad)S +2905(\(DECPAM\))S +4080 V +11 Y1 +900(1)S +4070 V +900(1)S +6 R +925(ESC)S +4080 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4070 V +1062(1)S +900(7)S +952(77)S +4080 V +1080(1)S +4070 V +1080(1)S +4080 V +11 R +1130(>)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4070 V +1242(1)S +1080(7)S +1132(77)S +4080 V +11 R +1980(Normal)S +2348(Keypad)S +2721(\(DECPNM\))S +4240 V +11 Y1 +900(1)S +4230 V +900(1)S +6 R +925(ESC)S +4240 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4230 V +1062(1)S +900(7)S +952(77)S +4240 V +1080(1)S +4230 V +1080(1)S +4240 V +11 R +1121(D)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4230 V +1242(1)S +1080(7)S +1132(77)S +4240 V +11 R +1980(Index)S +2262(\(IND\))S +4400 V +11 Y1 +900(1)S +4390 V +900(1)S +6 R +925(ESC)S +4400 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4390 V +1062(1)S +900(7)S +952(77)S +4400 V +1080(1)S +4390 V +1080(1)S +4400 V +11 R +1127(E)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4390 V +1242(1)S +1080(7)S +1132(77)S +4400 V +11 R +1980(Next)S +2226(Line)S +2460(\(NEL\))S +4560 V +11 Y1 +900(1)S +4550 V +900(1)S +6 R +925(ESC)S +4560 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4550 V +1062(1)S +900(7)S +952(77)S +4560 V +1080(1)S +4550 V +1080(1)S +4560 V +11 R +1121(H)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4550 V +1242(1)S +1080(7)S +1132(77)S +4560 V +11 R +1980(Tab)S +2183(Set)S +2357(\(HTS\))S +4720 V +11 Y1 +900(1)S +4710 V +900(1)S +6 R +925(ESC)S +4720 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4710 V +1062(1)S +900(7)S +952(77)S +4720 V +1080(1)S +4710 V +1080(1)S +4720 V +11 R +1112(M)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4710 V +1242(1)S +1080(7)S +1132(77)S +4720 V +11 R +1980(Reverse)S +2365(Index)S +2647(\(RI\))S +4880 V +11 Y1 +900(1)S +4870 V +900(1)S +6 R +925(ESC)S +4880 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4870 V +1062(1)S +900(7)S +952(77)S +4880 V +1080(1)S +4870 V +1080(1)S +4880 V +11 R +1121(N)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4870 V +1242(1)S +1080(7)S +1132(77)S +4880 V +11 R +1980(Single)S +2295(Shift)S +2543(Select)S +2844(of)S +2968(G2)S +3135(Character)S +3592(Set)S +3766(\(SS2\):)S +4081(a)S +4129 H + (f)show 11 -.5 mul h (f)show +11 R +4196(ects)S +4399(next)S +4621(character)S +5052(only)S +5040 V +11 Y1 +900(1)S +5030 V +900(1)S +6 R +925(ESC)S +5040 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5030 V +1062(1)S +900(7)S +952(77)S +5040 V +1080(1)S +5030 V +1080(1)S +5040 V +11 R +1121(O)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5030 V +1242(1)S +1080(7)S +1132(77)S +5040 V +11 R +1980(Single)S +2295(Shift)S +2543(Select)S +2844(of)S +2968(G3)S +3135(Character)S +3592(Set)S +3766(\(SS3\):)S +4081(a)S +4129 H + (f)show 11 -.5 mul h (f)show +11 R +4196(ects)S +4399(next)S +4621(character)S +5052(only)S +5200 V +11 Y1 +900(1)S +5190 V +900(1)S +6 R +925(ESC)S +5200 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5190 V +1062(1)S +900(7)S +952(77)S +5200 V +1080(1)S +5190 V +1080(1)S +5200 V +11 R +1130(P)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5190 V +1242(1)S +1080(7)S +1132(77)S +5200 V +11 I +1260(P)S +5233 V +9 I +1305(t)S +5200 V +11 Y1 +1348(1)S +5190 V +1348(1)S +6 R +1373(ESC)S +5200 V +11 Y1 +1510(1)S +1348(2)S +1400(22)S +5190 V +1510(1)S +1348(7)S +1400(77)S +5200 V +1528(1)S +5190 V +1528(1)S +5200 V +11 R +1593(\\)S +11 Y1 +1690(1)S +1528(2)S +1580(22)S +5190 V +1690(1)S +1528(7)S +1580(77)S +5200 V +11 R +1980(Device)S +2322(Control)S +2692(String)S +2995(\(DCS\))S +5360 V +11 I +2046(xterm)S +11 R +2341(implements)S +2901(no)S +3057(DCS)S +3318(functions;)S +11 I +3804(P)S +5393 V +9 I +3849(t)S +5360 V +11 R +3920(is)S +4040(ignored.)S +11 I +4482(P)S +5393 V +9 I +4527(t)S +5360 V +11 R +4599(need)S +4852(not)S +5040(be)S +5190(printable)S +5520 V +1980(characters.)S +5680 V +11 Y1 +900(1)S +5670 V +900(1)S +6 R +925(ESC)S +5680 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5670 V +1062(1)S +900(7)S +952(77)S +5680 V +1080(1)S +5670 V +1080(1)S +5680 V +11 R +1127(Z)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5670 V +1242(1)S +1080(7)S +1132(77)S +5680 V +11 R +1980(Return)S +2312(Terminal)S +2747(ID)S +2895(\(DECID\).)S +3396(Obsolete)S +3819(form)S +4065(of)S +11 Y1 +4189(1)S +5670 V +4189(1)S +6 R +4214(ESC)S +5680 V +11 Y1 +4351(1)S +4189(2)S +4241(22)S +5670 V +4351(1)S +4189(7)S +4241(77)S +5680 V +4369(1)S +5670 V +4369(1)S +5680 V +11 R +4432([)S +11 Y1 +4531(1)S +4369(2)S +4421(22)S +5670 V +4531(1)S +4369(7)S +4421(77)S +5680 V +4549(1)S +5670 V +4549(1)S +5680 V +11 R +4606(c)S +11 Y1 +4711(1)S +4549(2)S +4601(22)S +5670 V +4711(1)S +4549(7)S +4601(77)S +5680 V +11 R +4762(\(DA\).)S +5840 V +11 Y1 +900(1)S +5830 V +900(1)S +6 R +925(ESC)S +5840 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5830 V +1062(1)S +900(7)S +952(77)S +5840 V +1080(1)S +5830 V +1080(1)S +5840 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5830 V +1242(1)S +1080(7)S +1132(77)S +5840 V +11 I +1260(P)S +5873 V +9 I +1305(s)S +5840 V +11 Y1 +1358(1)S +5830 V +1358(1)S +5840 V +11 R +1388(@)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +5830 V +1520(1)S +1358(7)S +1410(77)S +5840 V +11 R +1980(Insert)S +11 I +2262(P)S +5873 V +9 I +2307(s)S +5840 V +11 R +2375(\(Blank\))S +2743(Character\(s\))S +3315(\(default)S +3688(=)S +3783(1\))S +3907(\(ICH\))S +6000 V +11 Y1 +900(1)S +5990 V +900(1)S +6 R +925(ESC)S +6000 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5990 V +1062(1)S +900(7)S +952(77)S +6000 V +1080(1)S +5990 V +1080(1)S +6000 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5990 V +1242(1)S +1080(7)S +1132(77)S +6000 V +11 I +1260(P)S +6033 V +9 I +1305(s)S +6000 V +11 Y1 +1358(1)S +5990 V +1358(1)S +6000 V +11 R +1399(A)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +5990 V +1520(1)S +1358(7)S +1410(77)S +6000 V +11 R +1980(Cursor)S +2312(Up)S +11 I +2479(P)S +6033 V +9 I +2524(s)S +6000 V +11 R +2592(Times)S +2900(\(default)S +3273(=)S +3368(1\))S +3492(\(CUU\))S +6160 V +11 Y1 +900(1)S +6150 V +900(1)S +6 R +925(ESC)S +6160 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6150 V +1062(1)S +900(7)S +952(77)S +6160 V +1080(1)S +6150 V +1080(1)S +6160 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6150 V +1242(1)S +1080(7)S +1132(77)S +6160 V +11 I +1260(P)S +6193 V +9 I +1305(s)S +6160 V +11 Y1 +1358(1)S +6150 V +1358(1)S +6160 V +11 R +1402(B)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6150 V +1520(1)S +1358(7)S +1410(77)S +6160 V +11 R +1980(Cursor)S +2312(Down)S +11 I +2613(P)S +6193 V +9 I +2658(s)S +6160 V +11 R +2726(Times)S +3034(\(default)S +3407(=)S +3502(1\))S +3626(\(CUD\))S +6320 V +11 Y1 +900(1)S +6310 V +900(1)S +6 R +925(ESC)S +6320 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6310 V +1062(1)S +900(7)S +952(77)S +6320 V +1080(1)S +6310 V +1080(1)S +6320 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6310 V +1242(1)S +1080(7)S +1132(77)S +6320 V +11 I +1260(P)S +6353 V +9 I +1305(s)S +6320 V +11 Y1 +1358(1)S +6310 V +1358(1)S +6320 V +11 R +1402(C)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6310 V +1520(1)S +1358(7)S +1410(77)S +6320 V +11 R +1980(Cursor)S +2312(Forward)S +11 I +2716(P)S +6353 V +9 I +2761(s)S +6320 V +11 R +2829(Times)S +3137(\(default)S +3510(=)S +3605(1\))S +3729(\(CUF\))S +6480 V +11 Y1 +900(1)S +6470 V +900(1)S +6 R +925(ESC)S +6480 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6470 V +1062(1)S +900(7)S +952(77)S +6480 V +1080(1)S +6470 V +1080(1)S +6480 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6470 V +1242(1)S +1080(7)S +1132(77)S +6480 V +11 I +1260(P)S +6513 V +9 I +1305(s)S +6480 V +11 Y1 +1358(1)S +6470 V +1358(1)S +6480 V +11 R +1399(D)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6470 V +1520(1)S +1358(7)S +1410(77)S +6480 V +11 R +1980(Cursor)S +2312(Backward)S +11 I +2788(P)S +6513 V +9 I +2833(s)S +6480 V +11 R +2901(Times)S +3209(\(default)S +3582(=)S +3677(1\))S +3801(\(CUB\))S +6640 V +11 Y1 +900(1)S +6630 V +900(1)S +6 R +925(ESC)S +6640 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6630 V +1062(1)S +900(7)S +952(77)S +6640 V +1080(1)S +6630 V +1080(1)S +6640 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6630 V +1242(1)S +1080(7)S +1132(77)S +6640 V +11 I +1260(P)S +6673 V +9 I +1305(s)S +6640 V +11 Y1 +1358(1)S +6630 V +1358(1)S +6640 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6630 V +1520(1)S +1358(7)S +1410(77)S +6640 V +11 I +1538(P)S +6673 V +9 I +1583(s)S +6640 V +11 Y1 +1636(1)S +6630 V +1636(1)S +6640 V +11 R +1677(H)S +11 Y1 +1798(1)S +1636(2)S +1688(22)S +6630 V +1798(1)S +1636(7)S +1688(77)S +6640 V +11 R +1980(Cursor)S +2312(Position)S +2708([row;column])S +3344(\(default)S +3717(=)S +3812([1,1]\))S +4091(\(CUP\))S +6800 V +11 Y1 +900(1)S +6790 V +900(1)S +6 R +925(ESC)S +6800 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6790 V +1062(1)S +900(7)S +952(77)S +6800 V +1080(1)S +6790 V +1080(1)S +6800 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6790 V +1242(1)S +1080(7)S +1132(77)S +6800 V +11 I +1260(P)S +6833 V +9 I +1305(s)S +6800 V +11 Y1 +1358(1)S +6790 V +1358(1)S +6800 V +11 R +1417(J)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6790 V +1520(1)S +1358(7)S +1410(77)S +6800 V +11 R +1980(Erase)S +2255(in)S +2374(Display)S +2749(\(ED\))S +6960 V +11 I +2046(P)S +6993 V +9 I +2091(s)S +6960 V +11 R +2159(=)S +11 Y1 +2254(1)S +6950 V +2254(1)S +6960 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +6950 V +2416(1)S +2254(7)S +2306(77)S +6960 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(Below)S +3199(\(default\))S +7120 V +11 I +2046(P)S +7153 V +9 I +2091(s)S +7120 V +11 R +2159(=)S +11 Y1 +2254(1)S +7110 V +2254(1)S +7120 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +7110 V +2416(1)S +2254(7)S +2306(77)S +7120 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(Above)S +7280 V +11 I +2046(P)S +7313 V +9 I +2091(s)S +7280 V +11 R +2159(=)S +11 Y1 +2254(1)S +7270 V +2254(1)S +7280 V +11 R +2307(2)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +7270 V +2416(1)S +2254(7)S +2306(77)S +7280 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(All)S +7720 V +3212(2)S +7920 V +EP +%%Page: 3 3 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +520 V +900(Xterm Control Sequences)S +4980(VT100 Mode)S +880 V +11 Y1 +900(1)S +870 V +900(1)S +6 R +925(ESC)S +880 V +11 Y1 +1062(1)S +900(2)S +952(22)S +870 V +1062(1)S +900(7)S +952(77)S +880 V +1080(1)S +870 V +1080(1)S +880 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +870 V +1242(1)S +1080(7)S +1132(77)S +880 V +11 I +1260(P)S +913 V +9 I +1305(s)S +880 V +11 Y1 +1358(1)S +870 V +1358(1)S +880 V +11 R +1399(K)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +870 V +1520(1)S +1358(7)S +1410(77)S +880 V +11 R +1980(Erase)S +2255(in)S +2374(Line)S +2608(\(EL\))S +1040 V +11 I +2046(P)S +1073 V +9 I +2091(s)S +1040 V +11 R +2159(=)S +11 Y1 +2254(1)S +1030 V +2254(1)S +1040 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1030 V +2416(1)S +2254(7)S +2306(77)S +1040 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(to)S +2998(Right)S +3277(\(default\))S +1200 V +11 I +2046(P)S +1233 V +9 I +2091(s)S +1200 V +11 R +2159(=)S +11 Y1 +2254(1)S +1190 V +2254(1)S +1200 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1190 V +2416(1)S +2254(7)S +2306(77)S +1200 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(to)S +2998(Left)S +1360 V +11 I +2046(P)S +1393 V +9 I +2091(s)S +1360 V +11 R +2159(=)S +11 Y1 +2254(1)S +1350 V +2254(1)S +1360 V +11 R +2307(2)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1350 V +2416(1)S +2254(7)S +2306(77)S +1360 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(All)S +1520 V +11 Y1 +900(1)S +1510 V +900(1)S +6 R +925(ESC)S +1520 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1510 V +1062(1)S +900(7)S +952(77)S +1520 V +1080(1)S +1510 V +1080(1)S +1520 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1510 V +1242(1)S +1080(7)S +1132(77)S +1520 V +11 I +1260(P)S +1553 V +9 I +1305(s)S +1520 V +11 Y1 +1358(1)S +1510 V +1358(1)S +1520 V +11 R +1405(L)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +1510 V +1520(1)S +1358(7)S +1410(77)S +1520 V +11 R +1980(Insert)S +11 I +2262(P)S +1553 V +9 I +2307(s)S +1520 V +11 R +2375(Line\(s\))S +2724(\(default)S +3097(=)S +3192(1\))S +3316(\(IL\))S +1680 V +11 Y1 +900(1)S +1670 V +900(1)S +6 R +925(ESC)S +1680 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1670 V +1062(1)S +900(7)S +952(77)S +1680 V +1080(1)S +1670 V +1080(1)S +1680 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1670 V +1242(1)S +1080(7)S +1132(77)S +1680 V +11 I +1260(P)S +1713 V +9 I +1305(s)S +1680 V +11 Y1 +1358(1)S +1670 V +1358(1)S +1680 V +11 R +1390(M)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +1670 V +1520(1)S +1358(7)S +1410(77)S +1680 V +11 R +1980(Delete)S +11 I +2298(P)S +1713 V +9 I +2343(s)S +1680 V +11 R +2411(Line\(s\))S +2760(\(default)S +3133(=)S +3228(1\))S +3352(\(DL\))S +1840 V +11 Y1 +900(1)S +1830 V +900(1)S +6 R +925(ESC)S +1840 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1830 V +1062(1)S +900(7)S +952(77)S +1840 V +1080(1)S +1830 V +1080(1)S +1840 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1830 V +1242(1)S +1080(7)S +1132(77)S +1840 V +11 I +1260(P)S +1873 V +9 I +1305(s)S +1840 V +11 Y1 +1358(1)S +1830 V +1358(1)S +1840 V +11 R +1408(P)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +1830 V +1520(1)S +1358(7)S +1410(77)S +1840 V +11 R +1980(Delete)S +11 I +2298(P)S +1873 V +9 I +2343(s)S +1840 V +11 R +2411(Character\(s\))S +2983(\(default)S +3356(=)S +3451(1\))S +3575(\(DCH\))S +2000 V +11 Y1 +900(1)S +1990 V +900(1)S +6 R +925(ESC)S +2000 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1990 V +1062(1)S +900(7)S +952(77)S +2000 V +1080(1)S +1990 V +1080(1)S +2000 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1990 V +1242(1)S +1080(7)S +1132(77)S +2000 V +11 I +1260(P)S +2033 V +9 I +1305(s)S +2000 V +11 Y1 +1358(1)S +1990 V +1358(1)S +2000 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +1990 V +1520(1)S +1358(7)S +1410(77)S +2000 V +11 I +1538(P)S +2033 V +9 I +1583(s)S +2000 V +11 Y1 +1636(1)S +1990 V +1636(1)S +2000 V +11 R +1701(;)S +11 Y1 +1798(1)S +1636(2)S +1688(22)S +1990 V +1798(1)S +1636(7)S +1688(77)S +2000 V +11 I +1816(P)S +2033 V +9 I +1861(s)S +2000 V +11 Y1 +1914(1)S +1990 V +1914(1)S +2000 V +11 R +1979(;)S +11 Y1 +2076(1)S +1914(2)S +1966(22)S +1990 V +2076(1)S +1914(7)S +1966(77)S +2000 V +11 I +2094(P)S +2033 V +9 I +2139(s)S +2000 V +11 Y1 +2192(1)S +1990 V +2192(1)S +2000 V +11 R +2257(;)S +11 Y1 +2354(1)S +2192(2)S +2244(22)S +1990 V +2354(1)S +2192(7)S +2244(77)S +2000 V +11 I +2372(P)S +2033 V +9 I +2417(s)S +2000 V +11 Y1 +2470(1)S +1990 V +2470(1)S +2000 V +11 R +2517(T)S +11 Y1 +2632(1)S +2470(2)S +2522(22)S +1990 V +2632(1)S +2470(7)S +2522(77)S +2000 V +11 R +2650(Initiate)S +3174(hilite)S +3614(mouse)S +4114(tracking.)S +4748(Parameters)S +5448(are)S +2160 V +1980([func;startx;starty;\256rstrow;lastrow].)S +3617(See)S +3808(the)S +3975(section)S +11 B +4319(Mouse)S +4663(Tracking)S +11 R +5098(.)S +2320 V +11 Y1 +900(1)S +2310 V +900(1)S +6 R +925(ESC)S +2320 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2310 V +1062(1)S +900(7)S +952(77)S +2320 V +1080(1)S +2310 V +1080(1)S +2320 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2310 V +1242(1)S +1080(7)S +1132(77)S +2320 V +11 I +1260(P)S +2353 V +9 I +1305(s)S +2320 V +11 Y1 +1358(1)S +2310 V +1358(1)S +2320 V +11 R +1415(c)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +2310 V +1520(1)S +1358(7)S +1410(77)S +2320 V +11 R +1980(Send)S +2233(Device)S +2575(Attributes)S +3048(\(DA\))S +2480 V +11 I +2046(P)S +2513 V +9 I +2091(s)S +2480 V +11 R +2159(=)S +11 Y1 +2254(1)S +2470 V +2254(1)S +2480 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +2470 V +2416(1)S +2254(7)S +2306(77)S +2480 V +11 R +2467(or)S +2591(omitted)S +11 Y +2961(\256)S +11 R +3103(request)S +3452(attributes)S +3894(from)S +4140(terminal)S +2640 V +11 Y +2046(\256)S +11 Y1 +2232(1)S +2630 V +2232(1)S +6 R +2257(ESC)S +2640 V +11 Y1 +2394(1)S +2232(2)S +2284(22)S +2630 V +2394(1)S +2232(7)S +2284(77)S +2640 V +2412(1)S +2630 V +2412(1)S +2640 V +11 R +2475([)S +11 Y1 +2574(1)S +2412(2)S +2464(22)S +2630 V +2574(1)S +2412(7)S +2464(77)S +2640 V +2592(1)S +2630 V +2592(1)S +2640 V +11 R +2649(?)S +11 Y1 +2754(1)S +2592(2)S +2644(22)S +2630 V +2754(1)S +2592(7)S +2644(77)S +2640 V +2772(1)S +2630 V +2772(1)S +2640 V +11 R +2825(1)S +11 Y1 +2934(1)S +2772(2)S +2824(22)S +2630 V +2934(1)S +2772(7)S +2824(77)S +2640 V +2952(1)S +2630 V +2952(1)S +2640 V +11 R +3017(;)S +11 Y1 +3114(1)S +2952(2)S +3004(22)S +2630 V +3114(1)S +2952(7)S +3004(77)S +2640 V +3132(1)S +2630 V +3132(1)S +2640 V +11 R +3185(2)S +11 Y1 +3294(1)S +3132(2)S +3184(22)S +2630 V +3294(1)S +3132(7)S +3184(77)S +2640 V +3312(1)S +2630 V +3312(1)S +2640 V +11 R +3369(c)S +11 Y1 +3474(1)S +3312(2)S +3364(22)S +2630 V +3474(1)S +3312(7)S +3364(77)S +2640 V +11 R +3569(\(``I)S +3790(am)S +4002(a)S +4128(VT100)S +4517(with)S +4791(Advanced)S +5312(Video)S +2800 V +1980(Option.''\))S +2960 V +11 Y1 +900(1)S +2950 V +900(1)S +6 R +925(ESC)S +2960 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2950 V +1062(1)S +900(7)S +952(77)S +2960 V +1080(1)S +2950 V +1080(1)S +2960 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2950 V +1242(1)S +1080(7)S +1132(77)S +2960 V +11 I +1260(P)S +2993 V +9 I +1305(s)S +2960 V +11 Y1 +1358(1)S +2950 V +1358(1)S +2960 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +2950 V +1520(1)S +1358(7)S +1410(77)S +2960 V +11 I +1538(P)S +2993 V +9 I +1583(s)S +2960 V +11 Y1 +1636(1)S +2950 V +1636(1)S +2960 V +11 R +1699(f)S +11 Y1 +1798(1)S +1636(2)S +1688(22)S +2950 V +1798(1)S +1636(7)S +1688(77)S +2960 V +11 R +1980(Horizontal)S +2482(and)S +2673(Vertical)S +3058(Position)S +3454([row;column])S +4090(\(default)S +4463(=)S +4558([1,1]\))S +4837(\(HVP\))S +3120 V +11 Y1 +900(1)S +3110 V +900(1)S +6 R +925(ESC)S +3120 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3110 V +1062(1)S +900(7)S +952(77)S +3120 V +1080(1)S +3110 V +1080(1)S +3120 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3110 V +1242(1)S +1080(7)S +1132(77)S +3120 V +11 I +1260(P)S +3153 V +9 I +1305(s)S +3120 V +11 Y1 +1358(1)S +3110 V +1358(1)S +3120 V +11 R +1411(g)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +3110 V +1520(1)S +1358(7)S +1410(77)S +3120 V +11 R +1980(Tab)S +2183(Clear)S +2453(\(TBC\))S +3280 V +11 I +2046(P)S +3313 V +9 I +2091(s)S +3280 V +11 R +2159(=)S +11 Y1 +2254(1)S +3270 V +2254(1)S +3280 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +3270 V +2416(1)S +2254(7)S +2306(77)S +3280 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(Current)S +3247(Column)S +3636(\(default\))S +3440 V +11 I +2046(P)S +3473 V +9 I +2091(s)S +3440 V +11 R +2159(=)S +11 Y1 +2254(1)S +3430 V +2254(1)S +3440 V +11 R +2307(3)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +3430 V +2416(1)S +2254(7)S +2306(77)S +3440 V +11 Y +2467(\256)S +11 R +2609(Clear)S +2879(All)S +3600 V +11 Y1 +900(1)S +3590 V +900(1)S +6 R +925(ESC)S +3600 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3590 V +1062(1)S +900(7)S +952(77)S +3600 V +1080(1)S +3590 V +1080(1)S +3600 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3590 V +1242(1)S +1080(7)S +1132(77)S +3600 V +11 I +1260(P)S +3633 V +9 I +1305(m)S +3600 V +11 Y1 +1388(1)S +3590 V +1388(1)S +3600 V +11 R +1441(h)S +11 Y1 +1550(1)S +1388(2)S +1440(22)S +3590 V +1550(1)S +1388(7)S +1440(77)S +3600 V +11 R +1980(Set)S +2154(Mode)S +2443(\(SM\))S +3760 V +11 I +2046(P)S +3793 V +9 I +2091(s)S +3760 V +11 R +2159(=)S +11 Y1 +2254(1)S +3750 V +2254(1)S +3760 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +3750 V +2416(1)S +2254(7)S +2306(77)S +3760 V +11 Y +2467(\256)S +11 R +2609(Insert)S +2891(Mode)S +3180(\(IRM\))S +3920 V +11 I +2046(P)S +3953 V +9 I +2091(s)S +3920 V +11 R +2159(=)S +11 Y1 +2254(1)S +3910 V +2254(1)S +3920 V +11 R +2307(2)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +3910 V +2416(1)S +2254(7)S +2306(77)S +3920 V +2434(1)S +3910 V +2434(1)S +3920 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +3910 V +2596(1)S +2434(7)S +2486(77)S +3920 V +11 Y +2647(\256)S +11 R +2789(Automatic)S +3286(Newline)S +3690(\(LNM\))S +4080 V +11 Y1 +900(1)S +4070 V +900(1)S +6 R +925(ESC)S +4080 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4070 V +1062(1)S +900(7)S +952(77)S +4080 V +1080(1)S +4070 V +1080(1)S +4080 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4070 V +1242(1)S +1080(7)S +1132(77)S +4080 V +11 I +1260(P)S +4113 V +9 I +1305(m)S +4080 V +11 Y1 +1388(1)S +4070 V +1388(1)S +4080 V +11 R +1453(l)S +11 Y1 +1550(1)S +1388(2)S +1440(22)S +4070 V +1550(1)S +1388(7)S +1440(77)S +4080 V +11 R +1980(Reset)S +2257(Mode)S +2546(\(RM\))S +4240 V +11 I +2046(P)S +4273 V +9 I +2091(s)S +4240 V +11 R +2159(=)S +11 Y1 +2254(1)S +4230 V +2254(1)S +4240 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4230 V +2416(1)S +2254(7)S +2306(77)S +4240 V +11 Y +2467(\256)S +11 R +2609(Replace)S +2994(Mode)S +3283(\(IRM\))S +4400 V +11 I +2046(P)S +4433 V +9 I +2091(s)S +4400 V +11 R +2159(=)S +11 Y1 +2254(1)S +4390 V +2254(1)S +4400 V +11 R +2307(2)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4390 V +2416(1)S +2254(7)S +2306(77)S +4400 V +2434(1)S +4390 V +2434(1)S +4400 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +4390 V +2596(1)S +2434(7)S +2486(77)S +4400 V +11 Y +2647(\256)S +11 R +2789(Normal)S +3157(Linefeed)S +3578(\(LNM\))S +4560 V +11 Y1 +900(1)S +4550 V +900(1)S +6 R +925(ESC)S +4560 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4550 V +1062(1)S +900(7)S +952(77)S +4560 V +1080(1)S +4550 V +1080(1)S +4560 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4550 V +1242(1)S +1080(7)S +1132(77)S +4560 V +11 I +1260(P)S +4593 V +9 I +1305(m)S +4560 V +11 Y1 +1388(1)S +4550 V +1388(1)S +4560 V +11 R +1426(m)S +11 Y1 +1550(1)S +1388(2)S +1440(22)S +4550 V +1550(1)S +1388(7)S +1440(77)S +4560 V +11 R +1980(Character)S +2437(Attributes)S +2910(\(SGR\))S +4720 V +11 I +2046(P)S +4753 V +9 I +2091(s)S +4720 V +11 R +2159(=)S +11 Y1 +2254(1)S +4710 V +2254(1)S +4720 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4710 V +2416(1)S +2254(7)S +2306(77)S +4720 V +11 Y +2467(\256)S +11 R +2609(Normal)S +2977(\(default\))S +4880 V +11 I +2046(P)S +4913 V +9 I +2091(s)S +4880 V +11 R +2159(=)S +11 Y1 +2254(1)S +4870 V +2254(1)S +4880 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4870 V +2416(1)S +2254(7)S +2306(77)S +4880 V +11 Y +2467(\256)S +11 R +2609(Bold)S +5040 V +11 I +2046(P)S +5073 V +9 I +2091(s)S +5040 V +11 R +2159(=)S +11 Y1 +2254(1)S +5030 V +2254(1)S +5040 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5030 V +2416(1)S +2254(7)S +2306(77)S +5040 V +11 Y +2467(\256)S +11 R +2609(Underscore)S +5200 V +11 I +2046(P)S +5233 V +9 I +2091(s)S +5200 V +11 R +2159(=)S +11 Y1 +2254(1)S +5190 V +2254(1)S +5200 V +11 R +2307(5)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5190 V +2416(1)S +2254(7)S +2306(77)S +5200 V +11 Y +2467(\256)S +11 R +2609(Blink)S +2888(\(appears)S +3290(as)S +3414(Bold\))S +5360 V +11 I +2046(P)S +5393 V +9 I +2091(s)S +5360 V +11 R +2159(=)S +11 Y1 +2254(1)S +5350 V +2254(1)S +5360 V +11 R +2307(7)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5350 V +2416(1)S +2254(7)S +2306(77)S +5360 V +11 Y +2467(\256)S +11 R +2609(Inverse)S +5520 V +11 Y1 +900(1)S +5510 V +900(1)S +6 R +925(ESC)S +5520 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5510 V +1062(1)S +900(7)S +952(77)S +5520 V +1080(1)S +5510 V +1080(1)S +5520 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5510 V +1242(1)S +1080(7)S +1132(77)S +5520 V +11 I +1260(P)S +5553 V +9 I +1305(s)S +5520 V +11 Y1 +1358(1)S +5510 V +1358(1)S +5520 V +11 R +1411(n)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +5510 V +1520(1)S +1358(7)S +1410(77)S +5520 V +11 R +1980(Device)S +2322(Status)S +2625(Report)S +2957(\(DSR\))S +5680 V +11 I +2046(P)S +5713 V +9 I +2091(s)S +5680 V +11 R +2159(=)S +11 Y1 +2254(1)S +5670 V +2254(1)S +5680 V +11 R +2307(5)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5670 V +2416(1)S +2254(7)S +2306(77)S +5680 V +11 Y +2467(\256)S +11 R +2609(Status)S +2912(Report)S +11 Y1 +3244(1)S +5670 V +3244(1)S +6 R +3269(ESC)S +5680 V +11 Y1 +3406(1)S +3244(2)S +3296(22)S +5670 V +3406(1)S +3244(7)S +3296(77)S +5680 V +3424(1)S +5670 V +3424(1)S +5680 V +11 R +3487([)S +11 Y1 +3586(1)S +3424(2)S +3476(22)S +5670 V +3586(1)S +3424(7)S +3476(77)S +5680 V +3604(1)S +5670 V +3604(1)S +5680 V +11 R +3657(0)S +11 Y1 +3766(1)S +3604(2)S +3656(22)S +5670 V +3766(1)S +3604(7)S +3656(77)S +5680 V +3784(1)S +5670 V +3784(1)S +5680 V +11 R +3837(n)S +11 Y1 +3946(1)S +3784(2)S +3836(22)S +5670 V +3946(1)S +3784(7)S +3836(77)S +5680 V +11 R +3997(\(``OK''\))S +5840 V +11 I +2046(P)S +5873 V +9 I +2091(s)S +5840 V +11 R +2255(=)S +11 Y1 +2446(1)S +5830 V +2446(1)S +5840 V +11 R +2499(6)S +11 Y1 +2608(1)S +2446(2)S +2498(22)S +5830 V +2608(1)S +2446(7)S +2498(77)S +5840 V +11 Y +2755(\256)S +11 R +2993(Report)S +3422(Cursor)S +3851(Position)S +4344(\(CPR\))S +4756([row;column])S +5489(as)S +6000 V +11 Y1 +1980(1)S +5990 V +1980(1)S +6 R +2005(ESC)S +6000 V +11 Y1 +2142(1)S +1980(2)S +2032(22)S +5990 V +2142(1)S +1980(7)S +2032(77)S +6000 V +2160(1)S +5990 V +2160(1)S +6000 V +11 R +2223([)S +11 Y1 +2322(1)S +2160(2)S +2212(22)S +5990 V +2322(1)S +2160(7)S +2212(77)S +6000 V +11 I +2340(r)S +11 Y1 +2401(1)S +5990 V +2401(1)S +6000 V +11 R +2466(;)S +11 Y1 +2563(1)S +2401(2)S +2453(22)S +5990 V +2563(1)S +2401(7)S +2453(77)S +6000 V +11 I +2581(c)S +11 Y1 +2647(1)S +5990 V +2647(1)S +6000 V +11 R +2691(R)S +11 Y1 +2809(1)S +2647(2)S +2699(22)S +5990 V +2809(1)S +2647(7)S +2699(77)S +6160 V +900(1)S +6150 V +900(1)S +6 R +925(ESC)S +6160 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6150 V +1062(1)S +900(7)S +952(77)S +6160 V +1080(1)S +6150 V +1080(1)S +6160 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6150 V +1242(1)S +1080(7)S +1132(77)S +6160 V +11 I +1260(P)S +6193 V +9 I +1305(s)S +6160 V +11 Y1 +1358(1)S +6150 V +1358(1)S +6160 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6150 V +1520(1)S +1358(7)S +1410(77)S +6160 V +11 I +1538(P)S +6193 V +9 I +1583(s)S +6160 V +11 Y1 +1636(1)S +6150 V +1636(1)S +6160 V +11 R +1699(r)S +11 Y1 +1798(1)S +1636(2)S +1688(22)S +6150 V +1798(1)S +1636(7)S +1688(77)S +6160 V +11 R +1980(Set)S +2154(Scrolling)S +2591(Region)S +2942([top;bottom])S +3532(\(default)S +3905(=)S +4000(full)S +4186(size)S +4389(of)S +4513(window\))S +4936(\(DECSTBM\))S +6320 V +11 Y1 +900(1)S +6310 V +900(1)S +6 R +925(ESC)S +6320 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6310 V +1062(1)S +900(7)S +952(77)S +6320 V +1080(1)S +6310 V +1080(1)S +6320 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6310 V +1242(1)S +1080(7)S +1132(77)S +6320 V +11 I +1260(P)S +6353 V +9 I +1305(s)S +6320 V +11 Y1 +1358(1)S +6310 V +1358(1)S +6320 V +11 R +1411(x)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +6310 V +1520(1)S +1358(7)S +1410(77)S +6320 V +11 R +1980(Request)S +2367(Terminal)S +2802(Parameters)S +3321(\(DECREQTPARM\))S +6480 V +11 Y1 +900(1)S +6470 V +900(1)S +6 R +925(ESC)S +6480 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6470 V +1062(1)S +900(7)S +952(77)S +6480 V +1080(1)S +6470 V +1080(1)S +6480 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6470 V +1242(1)S +1080(7)S +1132(77)S +6480 V +1260(1)S +6470 V +1260(1)S +6480 V +11 R +1317(?)S +11 Y1 +1422(1)S +1260(2)S +1312(22)S +6470 V +1422(1)S +1260(7)S +1312(77)S +6480 V +11 I +1440(P)S +6513 V +9 I +1485(m)S +6480 V +11 Y1 +1568(1)S +6470 V +1568(1)S +6480 V +11 R +1621(h)S +11 Y1 +1730(1)S +1568(2)S +1620(22)S +6470 V +1730(1)S +1568(7)S +1620(77)S +6480 V +11 R +1980(DEC)S +2233(Private)S +2577(Mode)S +2866(Set)S +3040(\(DECSET\))S +6640 V +11 I +2046(P)S +6673 V +9 I +2091(s)S +6640 V +11 R +2159(=)S +11 Y1 +2254(1)S +6630 V +2254(1)S +6640 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +6630 V +2416(1)S +2254(7)S +2306(77)S +6640 V +11 Y +2467(\256)S +11 R +2609(Application)S +3161(Cursor)S +3493(Keys)S +3751(\(DECCKM\))S +6800 V +11 I +2046(P)S +6833 V +9 I +2091(s)S +6800 V +11 R +2174(=)S +11 Y1 +2284(1)S +6790 V +2284(1)S +6800 V +11 R +2337(2)S +11 Y1 +2446(1)S +2284(2)S +2336(22)S +6790 V +2446(1)S +2284(7)S +2336(77)S +6800 V +11 Y +2512(\256)S +11 R +2669(Designate)S +3155(USASCII)S +3631(for)S +3807(character)S +4254(sets)S +4468(G0-G3.)S +4882(\(In)S +5058(the)S +5241(VT102,)S +6960 V +1980(this)S +2173(selects)S +2498(VT52)S +2787(mode)S +3064(\(DECANM\),)S +3673(which)S +11 I +3974(xterm)S +11 R +4256(doesn't)S +4612(support.\))S +7120 V +11 I +2046(P)S +7153 V +9 I +2091(s)S +7120 V +11 R +2159(=)S +11 Y1 +2254(1)S +7110 V +2254(1)S +7120 V +11 R +2307(3)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +7110 V +2416(1)S +2254(7)S +2306(77)S +7120 V +11 Y +2467(\256)S +11 R +2609(132)S +2807(Column)S +3196(Mode)S +3485(\(DECCOLM\))S +7280 V +11 I +2046(P)S +7313 V +9 I +2091(s)S +7280 V +11 R +2159(=)S +11 Y1 +2254(1)S +7270 V +2254(1)S +7280 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +7270 V +2416(1)S +2254(7)S +2306(77)S +7280 V +11 Y +2467(\256)S +11 R +2609(Smooth)S +2986(\(Slow\))S +3318(Scroll)S +3614(\(DECSCLM\))S +7720 V +3212(3)S +7920 V +EP +%%Page: 4 4 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +520 V +900(Xterm Control Sequences)S +4980(VT100 Mode)S +880 V +11 I +2046(P)S +913 V +9 I +2091(s)S +880 V +11 R +2159(=)S +11 Y1 +2254(1)S +870 V +2254(1)S +880 V +11 R +2307(5)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +870 V +2416(1)S +2254(7)S +2306(77)S +880 V +11 Y +2467(\256)S +11 R +2609(Reverse)S +2994(Video)S +3295(\(DECSCNM\))S +1040 V +11 I +2046(P)S +1073 V +9 I +2091(s)S +1040 V +11 R +2159(=)S +11 Y1 +2254(1)S +1030 V +2254(1)S +1040 V +11 R +2307(6)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1030 V +2416(1)S +2254(7)S +2306(77)S +1040 V +11 Y +2467(\256)S +11 R +2609(Origin)S +2929(Mode)S +3218(\(DECOM\))S +1200 V +11 I +2046(P)S +1233 V +9 I +2091(s)S +1200 V +11 R +2159(=)S +11 Y1 +2254(1)S +1190 V +2254(1)S +1200 V +11 R +2307(7)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1190 V +2416(1)S +2254(7)S +2306(77)S +1200 V +11 Y +2467(\256)S +11 R +2609(Wraparound)S +3188(Mode)S +3477(\(DECAWM\))S +1360 V +11 I +2046(P)S +1393 V +9 I +2091(s)S +1360 V +11 R +2159(=)S +11 Y1 +2254(1)S +1350 V +2254(1)S +1360 V +11 R +2307(8)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1350 V +2416(1)S +2254(7)S +2306(77)S +1360 V +11 Y +2467(\256)S +11 R +2609(Auto-repeat)S +3164(Keys)S +3422(\(DECARM\))S +1520 V +11 I +2046(P)S +1553 V +9 I +2091(s)S +1520 V +11 R +2175(=)S +11 Y1 +2286(1)S +1510 V +2286(1)S +1520 V +11 R +2339(9)S +11 Y1 +2448(1)S +2286(2)S +2338(22)S +1510 V +2448(1)S +2286(7)S +2338(77)S +1520 V +11 Y +2516(\256)S +11 R +2675(Send)S +2945(Mouse)S +3294(X)S +3423(&)S +3559(Y)S +3688(on)S +3848(button)S +4180(press.)S +4516(See)S +4724(the)S +4908(section)S +11 B +5269(Mouse)S +1680 V +1980(Tracking)S +11 R +2415(.)S +1840 V +11 I +2046(P)S +1873 V +9 I +2091(s)S +1840 V +11 R +2159(=)S +11 Y1 +2254(1)S +1830 V +2254(1)S +1840 V +11 R +2307(3)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1830 V +2416(1)S +2254(7)S +2306(77)S +1840 V +2434(1)S +1830 V +2434(1)S +1840 V +11 R +2487(8)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +1830 V +2596(1)S +2434(7)S +2486(77)S +1840 V +11 Y +2647(\256)S +11 R +2789(Enter)S +3059(Tektronix)S +3525(Mode)S +3814(\(DECTEK\))S +2000 V +11 I +2046(P)S +2033 V +9 I +2091(s)S +2000 V +11 R +2159(=)S +11 Y1 +2254(1)S +1990 V +2254(1)S +2000 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1990 V +2416(1)S +2254(7)S +2306(77)S +2000 V +2434(1)S +1990 V +2434(1)S +2000 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +1990 V +2596(1)S +2434(7)S +2486(77)S +2000 V +11 Y +2647(\256)S +11 R +2789(Allow)S +3097(80)S +11 Y +3240(\254)S +3240(\256)S +11 R +3382(132)S +3580(Mode)S +2160 V +11 I +2046(P)S +2193 V +9 I +2091(s)S +2160 V +11 R +2159(=)S +11 Y1 +2254(1)S +2150 V +2254(1)S +2160 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +2150 V +2416(1)S +2254(7)S +2306(77)S +2160 V +2434(1)S +2150 V +2434(1)S +2160 V +11 R +2487(1)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +2150 V +2596(1)S +2434(7)S +2486(77)S +2160 V +11 Y +2647(\256)S +11 I +2789(curses)S +11 R +3069(\(5\))S +3229(\256x)S +2320 V +11 I +2046(P)S +2353 V +9 I +2091(s)S +2320 V +11 R +2159(=)S +11 Y1 +2254(1)S +2310 V +2254(1)S +2320 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +2310 V +2416(1)S +2254(7)S +2306(77)S +2320 V +2434(1)S +2310 V +2434(1)S +2320 V +11 R +2487(4)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +2310 V +2596(1)S +2434(7)S +2486(77)S +2320 V +11 Y +2647(\256)S +11 R +2789(Turn)S +3035(On)S +3202(Margin)S +3558(Bell)S +2480 V +11 I +2046(P)S +2513 V +9 I +2091(s)S +2480 V +11 R +2159(=)S +11 Y1 +2254(1)S +2470 V +2254(1)S +2480 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +2470 V +2416(1)S +2254(7)S +2306(77)S +2480 V +2434(1)S +2470 V +2434(1)S +2480 V +11 R +2487(5)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +2470 V +2596(1)S +2434(7)S +2486(77)S +2480 V +11 Y +2647(\256)S +11 R +2789(Reverse-wraparound)S +3732(Mode)S +2640 V +11 I +2046(P)S +2673 V +9 I +2091(s)S +2640 V +11 R +2159(=)S +11 Y1 +2254(1)S +2630 V +2254(1)S +2640 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +2630 V +2416(1)S +2254(7)S +2306(77)S +2640 V +2434(1)S +2630 V +2434(1)S +2640 V +11 R +2487(6)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +2630 V +2596(1)S +2434(7)S +2486(77)S +2640 V +11 Y +2647(\256)S +11 R +2789(Start)S +3030(Logging)S +2800 V +11 I +2046(P)S +2833 V +9 I +2091(s)S +2800 V +11 R +2164(=)S +11 Y1 +2264(1)S +2790 V +2264(1)S +2800 V +11 R +2317(4)S +11 Y1 +2426(1)S +2264(2)S +2316(22)S +2790 V +2426(1)S +2264(7)S +2316(77)S +2800 V +2444(1)S +2790 V +2444(1)S +2800 V +11 R +2497(7)S +11 Y1 +2606(1)S +2444(2)S +2496(22)S +2790 V +2606(1)S +2444(7)S +2496(77)S +2800 V +11 Y +2662(\256)S +11 R +2809(Use)S +3017(Alternate)S +3463(Screen)S +3799(Bu)S +3928 H + (f)show 11 -.5 mul h (f)show +11 R +3995(er)S +4118(\(unless)S +4468(disabled)S +4873(by)S +5022(the)S +11 B +5195(titeInhi-)S +2960 V +1980(bit)S +11 R +2142(resource\))S +3120 V +11 I +2046(P)S +3153 V +9 I +2091(s)S +3120 V +11 R +2162(=)S +11 Y1 +2260(1)S +3110 V +2260(1)S +3120 V +11 R +2313(1)S +11 Y1 +2422(1)S +2260(2)S +2312(22)S +3110 V +2422(1)S +2260(7)S +2312(77)S +3120 V +2440(1)S +3110 V +2440(1)S +3120 V +11 R +2493(0)S +11 Y1 +2602(1)S +2440(2)S +2492(22)S +3110 V +2602(1)S +2440(7)S +2492(77)S +3120 V +2620(1)S +3110 V +2620(1)S +3120 V +11 R +2673(0)S +11 Y1 +2782(1)S +2620(2)S +2672(22)S +3110 V +2782(1)S +2620(7)S +2672(77)S +3120 V +2800(1)S +3110 V +2800(1)S +3120 V +11 R +2853(0)S +11 Y1 +2962(1)S +2800(2)S +2852(22)S +3110 V +2962(1)S +2800(7)S +2852(77)S +3120 V +11 Y +3016(\256)S +11 R +3161(Send)S +3417(Mouse)S +3752(X)S +3867(&)S +3989(Y)S +4104(on)S +4250(button)S +4568(press)S +4829(and)S +5023(release.)S +5422(See)S +3280 V +1980(the)S +2147(section)S +11 B +2491(Mouse)S +2835(Tracking)S +11 R +3270(.)S +3440 V +11 I +2046(P)S +3473 V +9 I +2091(s)S +3440 V +11 R +2169(=)S +11 Y1 +2274(1)S +3430 V +2274(1)S +3440 V +11 R +2327(1)S +11 Y1 +2436(1)S +2274(2)S +2326(22)S +3430 V +2436(1)S +2274(7)S +2326(77)S +3440 V +2454(1)S +3430 V +2454(1)S +3440 V +11 R +2507(0)S +11 Y1 +2616(1)S +2454(2)S +2506(22)S +3430 V +2616(1)S +2454(7)S +2506(77)S +3440 V +2634(1)S +3430 V +2634(1)S +3440 V +11 R +2687(0)S +11 Y1 +2796(1)S +2634(2)S +2686(22)S +3430 V +2796(1)S +2634(7)S +2686(77)S +3440 V +2814(1)S +3430 V +2814(1)S +3440 V +11 R +2867(1)S +11 Y1 +2976(1)S +2814(2)S +2866(22)S +3430 V +2976(1)S +2814(7)S +2866(77)S +3440 V +11 Y +3037(\256)S +11 R +3189(Use)S +3402(Hilite)S +3696(Mouse)S +4038(Tracking.)S +4537(See)S +4738(the)S +4915(section)S +11 B +5269(Mouse)S +3600 V +1980(Tracking)S +11 R +2415(.)S +3760 V +11 Y1 +900(1)S +3750 V +900(1)S +6 R +925(ESC)S +3760 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3750 V +1062(1)S +900(7)S +952(77)S +3760 V +1080(1)S +3750 V +1080(1)S +3760 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3750 V +1242(1)S +1080(7)S +1132(77)S +3760 V +1260(1)S +3750 V +1260(1)S +3760 V +11 R +1317(?)S +11 Y1 +1422(1)S +1260(2)S +1312(22)S +3750 V +1422(1)S +1260(7)S +1312(77)S +3760 V +11 I +1440(P)S +3793 V +9 I +1485(m)S +3760 V +11 Y1 +1568(1)S +3750 V +1568(1)S +3760 V +11 R +1633(l)S +11 Y1 +1730(1)S +1568(2)S +1620(22)S +3750 V +1730(1)S +1568(7)S +1620(77)S +3760 V +11 R +1980(DEC)S +2233(Private)S +2577(Mode)S +2866(Reset)S +3143(\(DECRST\))S +3920 V +11 I +2046(P)S +3953 V +9 I +2091(s)S +3920 V +11 R +2159(=)S +11 Y1 +2254(1)S +3910 V +2254(1)S +3920 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +3910 V +2416(1)S +2254(7)S +2306(77)S +3920 V +11 Y +2467(\256)S +11 R +2609(Normal)S +2977(Cursor)S +3309(Keys)S +3567(\(DECCKM\))S +4080 V +11 I +2046(P)S +4113 V +9 I +2091(s)S +4080 V +11 R +2159(=)S +11 Y1 +2254(1)S +4070 V +2254(1)S +4080 V +11 R +2307(3)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4070 V +2416(1)S +2254(7)S +2306(77)S +4080 V +11 Y +2467(\256)S +11 R +2609(80)S +2752(Column)S +3141(Mode)S +3430(\(DECCOLM\))S +4240 V +11 I +2046(P)S +4273 V +9 I +2091(s)S +4240 V +11 R +2159(=)S +11 Y1 +2254(1)S +4230 V +2254(1)S +4240 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4230 V +2416(1)S +2254(7)S +2306(77)S +4240 V +11 Y +2467(\256)S +11 R +2609(Jump)S +2881(\(Fast\))S +3170(Scroll)S +3466(\(DECSCLM\))S +4400 V +11 I +2046(P)S +4433 V +9 I +2091(s)S +4400 V +11 R +2159(=)S +11 Y1 +2254(1)S +4390 V +2254(1)S +4400 V +11 R +2307(5)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4390 V +2416(1)S +2254(7)S +2306(77)S +4400 V +11 Y +2467(\256)S +11 R +2609(Normal)S +2977(Video)S +3278(\(DECSCNM\))S +4560 V +11 I +2046(P)S +4593 V +9 I +2091(s)S +4560 V +11 R +2159(=)S +11 Y1 +2254(1)S +4550 V +2254(1)S +4560 V +11 R +2307(6)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4550 V +2416(1)S +2254(7)S +2306(77)S +4560 V +11 Y +2467(\256)S +11 R +2609(Normal)S +2977(Cursor)S +3309(Mode)S +3598(\(DECOM\))S +4720 V +11 I +2046(P)S +4753 V +9 I +2091(s)S +4720 V +11 R +2159(=)S +11 Y1 +2254(1)S +4710 V +2254(1)S +4720 V +11 R +2307(7)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4710 V +2416(1)S +2254(7)S +2306(77)S +4720 V +11 Y +2467(\256)S +11 R +2609(No)S +2776(Wraparound)S +3355(Mode)S +3644(\(DECAWM\))S +4880 V +11 I +2046(P)S +4913 V +9 I +2091(s)S +4880 V +11 R +2159(=)S +11 Y1 +2254(1)S +4870 V +2254(1)S +4880 V +11 R +2307(8)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +4870 V +2416(1)S +2254(7)S +2306(77)S +4880 V +11 Y +2467(\256)S +11 R +2609(No)S +2776(Auto-repeat)S +3331(Keys)S +3589(\(DECARM\))S +5040 V +11 I +2046(P)S +5073 V +9 I +2091(s)S +5040 V +11 R +2159(=)S +11 Y1 +2254(1)S +5030 V +2254(1)S +5040 V +11 R +2307(9)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5030 V +2416(1)S +2254(7)S +2306(77)S +5040 V +11 Y +2467(\256)S +11 R +2609(Don't)S +2898(Send)S +3151(Mouse)S +3483(X)S +3595(&)S +3714(Y)S +3826(on)S +3969(button)S +4284(press)S +5200 V +11 I +2046(P)S +5233 V +9 I +2091(s)S +5200 V +11 R +2159(=)S +11 Y1 +2254(1)S +5190 V +2254(1)S +5200 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5190 V +2416(1)S +2254(7)S +2306(77)S +5200 V +2434(1)S +5190 V +2434(1)S +5200 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +5190 V +2596(1)S +2434(7)S +2486(77)S +5200 V +11 Y +2647(\256)S +11 R +2789(Disallow)S +3219(80)S +11 Y +3362(\254)S +3362(\256)S +11 R +3504(132)S +3702(Mode)S +5360 V +11 I +2046(P)S +5393 V +9 I +2091(s)S +5360 V +11 R +2159(=)S +11 Y1 +2254(1)S +5350 V +2254(1)S +5360 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5350 V +2416(1)S +2254(7)S +2306(77)S +5360 V +2434(1)S +5350 V +2434(1)S +5360 V +11 R +2487(1)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +5350 V +2596(1)S +2434(7)S +2486(77)S +5360 V +11 Y +2647(\256)S +11 R +2789(No)S +11 I +2956(curses)S +11 R +3236(\(5\))S +3396(\256x)S +5520 V +11 I +2046(P)S +5553 V +9 I +2091(s)S +5520 V +11 R +2159(=)S +11 Y1 +2254(1)S +5510 V +2254(1)S +5520 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5510 V +2416(1)S +2254(7)S +2306(77)S +5520 V +2434(1)S +5510 V +2434(1)S +5520 V +11 R +2487(4)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +5510 V +2596(1)S +2434(7)S +2486(77)S +5520 V +11 Y +2647(\256)S +11 R +2789(Turn)S +3035(O)S +3114 H + (f)show 11 -.5 mul h (f)show +11 R +3214(Margin)S +3570(Bell)S +5680 V +11 I +2046(P)S +5713 V +9 I +2091(s)S +5680 V +11 R +2159(=)S +11 Y1 +2254(1)S +5670 V +2254(1)S +5680 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5670 V +2416(1)S +2254(7)S +2306(77)S +5680 V +2434(1)S +5670 V +2434(1)S +5680 V +11 R +2487(5)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +5670 V +2596(1)S +2434(7)S +2486(77)S +5680 V +11 Y +2647(\256)S +11 R +2789(No)S +2956(Reverse-wraparound)S +3899(Mode)S +5840 V +11 I +2046(P)S +5873 V +9 I +2091(s)S +5840 V +11 R +2159(=)S +11 Y1 +2254(1)S +5830 V +2254(1)S +5840 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5830 V +2416(1)S +2254(7)S +2306(77)S +5840 V +2434(1)S +5830 V +2434(1)S +5840 V +11 R +2487(6)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +5830 V +2596(1)S +2434(7)S +2486(77)S +5840 V +11 Y +2647(\256)S +11 R +2789(Stop)S +3025(Logging)S +6000 V +11 I +2046(P)S +6033 V +9 I +2091(s)S +6000 V +11 R +2159(=)S +11 Y1 +2254(1)S +5990 V +2254(1)S +6000 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5990 V +2416(1)S +2254(7)S +2306(77)S +6000 V +2434(1)S +5990 V +2434(1)S +6000 V +11 R +2487(7)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +5990 V +2596(1)S +2434(7)S +2486(77)S +6000 V +11 Y +2647(\256)S +11 R +2789(Use)S +2992(Normal)S +3360(Screen)S +3690(Bu)S +3819 H + (f)show 11 -.5 mul h (f)show +11 R +3886(er)S +6160 V +11 I +2046(P)S +6193 V +9 I +2091(s)S +6160 V +11 R +2159(=)S +11 Y1 +2254(1)S +6150 V +2254(1)S +6160 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +6150 V +2416(1)S +2254(7)S +2306(77)S +6160 V +2434(1)S +6150 V +2434(1)S +6160 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +6150 V +2596(1)S +2434(7)S +2486(77)S +6160 V +2614(1)S +6150 V +2614(1)S +6160 V +11 R +2667(0)S +11 Y1 +2776(1)S +2614(2)S +2666(22)S +6150 V +2776(1)S +2614(7)S +2666(77)S +6160 V +2794(1)S +6150 V +2794(1)S +6160 V +11 R +2847(0)S +11 Y1 +2956(1)S +2794(2)S +2846(22)S +6150 V +2956(1)S +2794(7)S +2846(77)S +6160 V +11 Y +3007(\256)S +11 R +3149(Don't)S +3438(Send)S +3691(Mouse)S +4023(X)S +4135(&)S +4254(Y)S +4366(on)S +4509(button)S +4824(press)S +5082(and)S +5273(release)S +6320 V +11 I +2046(P)S +6353 V +9 I +2091(s)S +6320 V +11 R +2159(=)S +11 Y1 +2254(1)S +6310 V +2254(1)S +6320 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +6310 V +2416(1)S +2254(7)S +2306(77)S +6320 V +2434(1)S +6310 V +2434(1)S +6320 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +6310 V +2596(1)S +2434(7)S +2486(77)S +6320 V +2614(1)S +6310 V +2614(1)S +6320 V +11 R +2667(0)S +11 Y1 +2776(1)S +2614(2)S +2666(22)S +6310 V +2776(1)S +2614(7)S +2666(77)S +6320 V +2794(1)S +6310 V +2794(1)S +6320 V +11 R +2847(1)S +11 Y1 +2956(1)S +2794(2)S +2846(22)S +6310 V +2956(1)S +2794(7)S +2846(77)S +6320 V +11 Y +3007(\256)S +11 R +3149(Don't)S +3438(Use)S +3641(Hilite)S +3925(Mouse)S +4257(Tracking)S +6480 V +11 Y1 +900(1)S +6470 V +900(1)S +6 R +925(ESC)S +6480 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6470 V +1062(1)S +900(7)S +952(77)S +6480 V +1080(1)S +6470 V +1080(1)S +6480 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6470 V +1242(1)S +1080(7)S +1132(77)S +6480 V +1260(1)S +6470 V +1260(1)S +6480 V +11 R +1317(?)S +11 Y1 +1422(1)S +1260(2)S +1312(22)S +6470 V +1422(1)S +1260(7)S +1312(77)S +6480 V +11 I +1440(P)S +6513 V +9 I +1485(m)S +6480 V +11 Y1 +1568(1)S +6470 V +1568(1)S +6480 V +11 R +1631(r)S +11 Y1 +1730(1)S +1568(2)S +1620(22)S +6470 V +1730(1)S +1568(7)S +1620(77)S +6480 V +11 R +1980(Restore)S +2383(DEC)S +2671(Private)S +3050(Mode)S +3374(Values.)S +3807(The)S +4045(value)S +4350(of)S +11 I +4509(P)S +6513 V +9 I +4554(s)S +6480 V +11 R +4657(previously)S +5189(saved)S +5506(is)S +6640 V +1980(restored.)S +11 I +2426(P)S +6673 V +9 I +2471(s)S +6640 V +11 R +2539(values)S +2852(are)S +3017(the)S +3184(same)S +3442(as)S +3566(for)S +3726(DECSET.)S +6800 V +11 Y1 +900(1)S +6790 V +900(1)S +6 R +925(ESC)S +6800 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6790 V +1062(1)S +900(7)S +952(77)S +6800 V +1080(1)S +6790 V +1080(1)S +6800 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6790 V +1242(1)S +1080(7)S +1132(77)S +6800 V +1260(1)S +6790 V +1260(1)S +6800 V +11 R +1317(?)S +11 Y1 +1422(1)S +1260(2)S +1312(22)S +6790 V +1422(1)S +1260(7)S +1312(77)S +6800 V +11 I +1440(P)S +6833 V +9 I +1485(m)S +6800 V +11 Y1 +1568(1)S +6790 V +1568(1)S +6800 V +11 R +1627(s)S +11 Y1 +1730(1)S +1568(2)S +1620(22)S +6790 V +1730(1)S +1568(7)S +1620(77)S +6800 V +11 R +1980(Save)S +2226(DEC)S +2479(Private)S +2823(Mode)S +3112(Values.)S +11 I +3510(P)S +6833 V +9 I +3555(s)S +6800 V +11 R +3623(values)S +3936(are)S +4101(the)S +4268(same)S +4526(as)S +4650(for)S +4810(DECSET.)S +7720 V +3212(4)S +7920 V +EP +%%Page: 5 5 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +520 V +900(Xterm Control Sequences)S +4980(VT100 Mode)S +880 V +11 Y1 +900(1)S +870 V +900(1)S +6 R +925(ESC)S +880 V +11 Y1 +1062(1)S +900(2)S +952(22)S +870 V +1062(1)S +900(7)S +952(77)S +880 V +1080(1)S +870 V +1080(1)S +880 V +11 R +1143(])S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +870 V +1242(1)S +1080(7)S +1132(77)S +880 V +11 I +1260(P)S +913 V +9 I +1305(s)S +880 V +11 Y1 +1358(1)S +870 V +1358(1)S +880 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +870 V +1520(1)S +1358(7)S +1410(77)S +880 V +11 I +1538(P)S +913 V +9 I +1583(t)S +880 V +11 Y1 +1626(1)S +870 V +1626(1)S +6 R +1650(BEL)S +880 V +11 Y1 +1788(1)S +1626(2)S +1678(22)S +870 V +1788(1)S +1626(7)S +1678(77)S +880 V +11 R +1980(Set)S +2154(Text)S +2388(Parameters)S +1040 V +11 I +2046(P)S +1073 V +9 I +2091(s)S +1040 V +11 R +2159(=)S +11 Y1 +2254(1)S +1030 V +2254(1)S +1040 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1030 V +2416(1)S +2254(7)S +2306(77)S +1040 V +11 Y +2467(\256)S +11 R +2609(Change)S +2977(Icon)S +3204(Name)S +3498(and)S +3689(Window)S +4100(Title)S +4341(to)S +11 I +4460(P)S +1073 V +9 I +4505(t)S +1200 V +11 I +2046(P)S +1233 V +9 I +2091(s)S +1200 V +11 R +2159(=)S +11 Y1 +2254(1)S +1190 V +2254(1)S +1200 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1190 V +2416(1)S +2254(7)S +2306(77)S +1200 V +11 Y +2467(\256)S +11 R +2609(Change)S +2977(Icon)S +3204(Name)S +3498(to)S +11 I +3617(P)S +1233 V +9 I +3662(t)S +1360 V +11 I +2046(P)S +1393 V +9 I +2091(s)S +1360 V +11 R +2159(=)S +11 Y1 +2254(1)S +1350 V +2254(1)S +1360 V +11 R +2307(2)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1350 V +2416(1)S +2254(7)S +2306(77)S +1360 V +11 Y +2467(\256)S +11 R +2609(Change)S +2977(Window)S +3388(Title)S +3629(to)S +11 I +3748(P)S +1393 V +9 I +3793(t)S +1520 V +11 I +2046(P)S +1553 V +9 I +2091(s)S +1520 V +11 R +2167(=)S +11 Y1 +2270(1)S +1510 V +2270(1)S +1520 V +11 R +2323(4)S +11 Y1 +2432(1)S +2270(2)S +2322(22)S +1510 V +2432(1)S +2270(7)S +2322(77)S +1520 V +2450(1)S +1510 V +2450(1)S +1520 V +11 R +2503(6)S +11 Y1 +2612(1)S +2450(2)S +2502(22)S +1510 V +2612(1)S +2450(7)S +2502(77)S +1520 V +11 Y +2671(\256)S +11 R +2821(Change)S +3197(Log)S +3415(File)S +3629(to)S +11 I +3757(P)S +1553 V +9 I +3802(t)S +1520 V +11 R +3869(\(normally)S +4344(disabled)S +4752(by)S +4904(a)S +4994(compile-time)S +1680 V +1980(option\))S +1840 V +11 I +2046(P)S +1873 V +9 I +2091(s)S +1840 V +11 R +2159(=)S +11 Y1 +2254(1)S +1830 V +2254(1)S +1840 V +11 R +2307(5)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +1830 V +2416(1)S +2254(7)S +2306(77)S +1840 V +2434(1)S +1830 V +2434(1)S +1840 V +11 R +2487(0)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +1830 V +2596(1)S +2434(7)S +2486(77)S +1840 V +11 Y +2647(\256)S +11 R +2789(Set)S +2963(Font)S +3199(to)S +11 I +3318(P)S +1873 V +9 I +3363(t)S +2000 V +11 Y1 +900(1)S +1990 V +900(1)S +6 R +925(ESC)S +2000 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1990 V +1062(1)S +900(7)S +952(77)S +2000 V +1080(1)S +1990 V +1080(1)S +2000 V +11 R +1135(^)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1990 V +1242(1)S +1080(7)S +1132(77)S +2000 V +11 I +1260(P)S +2033 V +9 I +1305(t)S +2000 V +11 Y1 +1348(1)S +1990 V +1348(1)S +6 R +1373(ESC)S +2000 V +11 Y1 +1510(1)S +1348(2)S +1400(22)S +1990 V +1510(1)S +1348(7)S +1400(77)S +2000 V +1528(1)S +1990 V +1528(1)S +2000 V +11 R +1593(\\)S +11 Y1 +1690(1)S +1528(2)S +1580(22)S +1990 V +1690(1)S +1528(7)S +1580(77)S +2000 V +11 R +1980(Privacy)S +2348(Message)S +2764(\(PM\))S +2160 V +11 I +2046(xterm)S +11 R +2345(implements)S +2910(no)S +3071(PM)S +3282(functions;)S +11 I +3773(P)S +2193 V +9 I +3818(t)S +2160 V +11 R +3894(is)S +4019(ignored.)S +11 I +4466(P)S +2193 V +9 I +4511(t)S +2160 V +11 R +4587(need)S +4844(not)S +5036(be)S +5190(printable)S +2320 V +1980(characters.)S +2480 V +11 Y1 +900(1)S +2470 V +900(1)S +6 R +925(ESC)S +2480 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2470 V +1062(1)S +900(7)S +952(77)S +2480 V +1080(1)S +2470 V +1080(1)S +2480 V +11 R +1133(_)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2470 V +1242(1)S +1080(7)S +1132(77)S +2480 V +11 I +1260(P)S +2513 V +9 I +1305(t)S +2480 V +11 Y1 +1348(1)S +2470 V +1348(1)S +6 R +1373(ESC)S +2480 V +11 Y1 +1510(1)S +1348(2)S +1400(22)S +2470 V +1510(1)S +1348(7)S +1400(77)S +2480 V +1528(1)S +2470 V +1528(1)S +2480 V +11 R +1593(\\)S +11 Y1 +1690(1)S +1528(2)S +1580(22)S +2470 V +1690(1)S +1528(7)S +1580(77)S +2480 V +11 R +1980(Application)S +2532(Program)S +2943(Command)S +3435(\(APC\))S +2640 V +11 I +2046(xterm)S +11 R +2341(implements)S +2901(no)S +3057(APC)S +3318(functions;)S +11 I +3804(P)S +2673 V +9 I +3849(t)S +2640 V +11 R +3920(is)S +4040(ignored.)S +11 I +4482(P)S +2673 V +9 I +4527(t)S +2640 V +11 R +4599(need)S +4852(not)S +5040(be)S +5190(printable)S +2800 V +1980(characters.)S +2960 V +11 Y1 +900(1)S +2950 V +900(1)S +6 R +925(ESC)S +2960 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2950 V +1062(1)S +900(7)S +952(77)S +2960 V +1080(1)S +2950 V +1080(1)S +2960 V +11 R +1137(c)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2950 V +1242(1)S +1080(7)S +1132(77)S +2960 V +11 R +1980(Full)S +2192(Reset)S +2469(\(RIS\))S +3120 V +11 Y1 +900(1)S +3110 V +900(1)S +6 R +925(ESC)S +3120 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3110 V +1062(1)S +900(7)S +952(77)S +3120 V +1080(1)S +3110 V +1080(1)S +3120 V +11 R +1133(n)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3110 V +1242(1)S +1080(7)S +1132(77)S +3120 V +11 R +1980(Select)S +2281(the)S +2448(G2)S +2615(Character)S +3072(Set)S +3246(\(LS2\))S +3280 V +11 Y1 +900(1)S +3270 V +900(1)S +6 R +925(ESC)S +3280 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3270 V +1062(1)S +900(7)S +952(77)S +3280 V +1080(1)S +3270 V +1080(1)S +3280 V +11 R +1133(o)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3270 V +1242(1)S +1080(7)S +1132(77)S +3280 V +11 R +1980(Select)S +2281(the)S +2448(G3)S +2615(Character)S +3072(Set)S +3246(\(LS3\))S +3440 V +11 Y1 +900(1)S +3430 V +900(1)S +6 R +925(ESC)S +3440 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3430 V +1062(1)S +900(7)S +952(77)S +3440 V +1080(1)S +3430 V +1080(1)S +3440 V +11 R +1150(|)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3430 V +1242(1)S +1080(7)S +1132(77)S +3440 V +11 R +1980(Invoke)S +2317(the)S +2484(G3)S +2651(Character)S +3108(Set)S +3282(as)S +3406(GR)S +3592(\(LS3R\).)S +4016(Has)S +4219(no)S +4362(visible)S +4689(e)S +4737 H + (f)show 11 -.5 mul h (f)show +11 R +4804(ect)S +4964(in)S +11 I +5083(xterm)S +11 R +5332(.)S +3600 V +11 Y1 +900(1)S +3590 V +900(1)S +6 R +925(ESC)S +3600 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3590 V +1062(1)S +900(7)S +952(77)S +3600 V +1080(1)S +3590 V +1080(1)S +3600 V +11 R +1134(})S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3590 V +1242(1)S +1080(7)S +1132(77)S +3600 V +11 R +1980(Invoke)S +2317(the)S +2484(G2)S +2651(Character)S +3108(Set)S +3282(as)S +3406(GR)S +3592(\(LS2R\).)S +4016(Has)S +4219(no)S +4362(visible)S +4689(e)S +4737 H + (f)show 11 -.5 mul h (f)show +11 R +4804(ect)S +4964(in)S +11 I +5083(xterm)S +11 R +5332(.)S +3760 V +11 Y1 +900(1)S +3750 V +900(1)S +6 R +925(ESC)S +3760 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3750 V +1062(1)S +900(7)S +952(77)S +3760 V +1080(1)S +3750 V +1080(1)S +3760 V +11 R +1131(~)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3750 V +1242(1)S +1080(7)S +1132(77)S +3760 V +11 R +1980(Invoke)S +2317(the)S +2484(G1)S +2651(Character)S +3108(Set)S +3282(as)S +3406(GR)S +3592(\(LS1R\).)S +4016(Has)S +4219(no)S +4362(visible)S +4689(e)S +4737 H + (f)show 11 -.5 mul h (f)show +11 R +4804(ect)S +4964(in)S +11 I +5083(xterm)S +11 R +5332(.)S +4000 V +11 B +900(Mouse)S +1244(Tracking)S +4168 V +11 R +900(The)S +1110(VT)S +1296(widget)S +1635(can)S +1826(be)S +1970(set)S +2133(to)S +2260(send)S +2502(the)S +2677(mouse)S +3005(position)S +3402(and)S +3601(other)S +3867(information)S +4427(on)S +4578(button)S +4901(presses.)S +5319(These)S +4288 V +900(modes)S +1238(are)S +1421(typically)S +1857(used)S +2109(by)S +2270(editors)S +2620(and)S +2829(other)S +3105(full-screen)S +3623(applications)S +4205(that)S +4421(want)S +4685(to)S +4822(make)S +5109(use)S +5305(of)S +5446(the)S +4408 V +900(mouse.)S +4576 V +900(There)S +1200(are)S +1378(three)S +1642(mutually)S +2081(exclusive)S +2542(modes,)S +2904(each)S +3150(enabled)S +3537(\(or)S +3711(disabled\))S +4160(by)S +4317(a)S +4412(di)S +4498 H + (f)show 11 -.5 mul h (f)show +11 R +4565(erent)S +4830(parameter)S +5313(in)S +5446(the)S +4696 V +900(DECSET)S +1350(\(or)S +1511(DECRST\))S +2004(escape)S +2328(sequence.)S +2823(Parameters)S +3342(for)S +3502(all)S +3645(mouse)S +3965(tracking)S +4357(escape)S +4680(sequences)S +5156(generated)S +4816 V +900(by)S +11 I +1051(xterm)S +11 R +1342(encode)S +1693(numeric)S +2094(parameters)S +2615(in)S +2743(a)S +2833(single)S +3138(character)S +3578(as)S +11 I +3711(value)S +11 R +3948(+040.)S +4278(For)S +4473(example,)S +11 Y1 +4914(1)S +4806 V +4914(1)S +4816 V +11 R +4977(!)S +11 Y1 +5076(1)S +4914(2)S +4966(22)S +4806 V +5076(1)S +4914(7)S +4966(77)S +4816 V +11 R +5136(is)S +5252(1.)S +5410(The)S +4936 V +900(screen)S +1211(coodinate)S +1670(system)S +2009(is)S +2116(1-based.)S +5104 V +900(X10)S +1124(compatibility)S +1747(mode)S +2026(sends)S +2305(an)S +2444(escape)S +2770(sequence)S +3206(on)S +3352(button)S +3670(press)S +3931(encoding)S +4369(the)S +4539(location)S +4929(and)S +5123(the)S +5293(mouse)S +5224 V +900(button)S +1232(pressed.)S +1671(It)S +1788(is)S +1912(enabled)S +2302(by)S +2462(specifying)S +2969(parameter)S +3455(9)S +3560(to)S +3696(DECSET.)S +4222(On)S +4405(button)S +4736(press,)S +11 I +5038(xterm)S +11 R +5336(sends)S +5344 V +11 Y1 +900(1)S +5334 V +900(1)S +6 R +925(ESC)S +5344 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5334 V +1062(1)S +900(7)S +952(77)S +5344 V +1080(1)S +5334 V +1080(1)S +5344 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5334 V +1242(1)S +1080(7)S +1132(77)S +5344 V +1260(1)S +5334 V +1260(1)S +5344 V +11 R +1292(M)S +11 Y1 +1422(1)S +1260(2)S +1312(22)S +5334 V +1422(1)S +1260(7)S +1312(77)S +5344 V +11 I +1440(C)S +5377 V +9 I +1492(b)S +5344 V +11 I +1537(C)S +5377 V +9 I +1589(x)S +5344 V +11 I +1629(C)S +5377 V +9 I +1681(y)S +5344 V +11 R +1762(\(6)S +1895(characters\).)S +11 I +2475(C)S +5377 V +9 I +2527(b)S +5344 V +11 R +2614(is)S +2730(button\2611.)S +11 I +3225(C)S +5377 V +9 I +3277(x)S +5344 V +11 R +3359(and)S +11 I +3559(C)S +5377 V +9 I +3611(y)S +5344 V +11 R +3693(are)S +3867(the)S +4043(x)S +4140(and)S +4340(y)S +4437(coordinates)S +4984(of)S +5117(the)S +5293(mouse)S +5464 V +900(when)S +1170(the)S +1337(button)S +1652(was)S +1855(pressed.)S +5632 V +900(Normal)S +1268(tracking)S +1660(mode)S +1937(sends)S +2214(an)S +2350(escape)S +2673(sequence)S +3106(on)S +3249(both)S +3478(button)S +3794(press)S +4053(and)S +4245(release.)S +4642(Modi\256er)S +5061(information)S +5752 V +900(is)S +1011(also)S +1224(sent.)S +1498(It)S +1601(is)S +1711(enabled)S +2087(by)S +2233(specifying)S +2726(parameter)S +3198(1000)S +3454(to)S +3576(DECSET.)S +4089(On)S +4259(button)S +4577(press)S +4838(or)S +4965(release,)S +11 I +5331(xterm)S +5872 V +11 R +900(sends)S +11 Y1 +1184(1)S +5862 V +1184(1)S +6 R +1209(ESC)S +5872 V +11 Y1 +1346(1)S +1184(2)S +1236(22)S +5862 V +1346(1)S +1184(7)S +1236(77)S +5872 V +1364(1)S +5862 V +1364(1)S +5872 V +11 R +1427([)S +11 Y1 +1526(1)S +1364(2)S +1416(22)S +5862 V +1526(1)S +1364(7)S +1416(77)S +5872 V +1544(1)S +5862 V +1544(1)S +5872 V +11 R +1576(M)S +11 Y1 +1706(1)S +1544(2)S +1596(22)S +5862 V +1706(1)S +1544(7)S +1596(77)S +5872 V +11 I +1724(C)S +5905 V +9 I +1776(b)S +5872 V +11 I +1821(C)S +5905 V +9 I +1873(x)S +5872 V +11 I +1913(C)S +5905 V +9 I +1965(y)S +5872 V +11 R +2005(.)S +2106(The)S +2316(low)S +2521(two)S +2726(bits)S +2926(of)S +11 I +3057(C)S +5905 V +9 I +3109(b)S +5872 V +11 R +3194(encode)S +3543(button)S +3865(information:)S +4455(0=MB1)S +4839(pressed,)S +5236(1=MB2)S +5992 V +900(pressed,)S +1294(2=MB3)S +1675(pressed,)S +2068(3=release.)S +2585(The)S +2792(upper)S +3078(bits)S +3275(encode)S +3621(what)S +3871(modi\256ers)S +4324(were)S +4572(down)S +4853(when)S +5127(the)S +5298(button)S +6112 V +900(was)S +1112(pressed)S +1482(and)S +1682(are)S +1856(added)S +2159(together.)S +2621(4=Shift,)S +3023(8=Meta,)S +3435(16=Control.)S +11 I +4047(C)S +6145 V +9 I +4099(x)S +6112 V +11 R +4181(and)S +11 I +4381(C)S +6145 V +9 I +4433(y)S +6112 V +11 R +4515(are)S +4690(the)S +4867(x)S +4965(and)S +5166(y)S +5264(coordi-)S +6232 V +900(nates)S +1158(of)S +1282(the)S +1449(mouse)S +1769(event.)S +2100(The)S +2303(upper)S +2585(left)S +2764(corner)S +3075(is)S +3182(\(1,1\).)S +6400 V +900(Mouse)S +1239(hilite)S +1506(tracking)S +1905(noti\256es)S +2270(a)S +2358(program)S +2769(of)S +2900(a)S +2988(button)S +3310(press,)S +3603(receives)S +4000(a)S +4088(range)S +4371(of)S +4503(lines)S +4752(from)S +5006(the)S +5181(program,)S +6520 V +900(highlights)S +1387(the)S +1566(region)S +1891(covered)S +2281(by)S +2436(the)S +2615(mouse)S +2947(within)S +3274(that)S +3484(range)S +3771(until)S +4019(button)S +4346(release,)S +4721(and)S +4924(then)S +5158(sends)S +5446(the)S +6640 V +900(program)S +1305(the)S +1473(release)S +1809(coordinates.)S +2409(It)S +2510(is)S +2618(enabled)S +2992(by)S +3136(specifying)S +3627(parameter)S +4097(1001)S +4352(to)S +4473(DECSET.)S +4985(Warning:)S +5434(use)S +6760 V +900(of)S +1029(this)S +1227(mode)S +1509(requires)S +1899(a)S +1985(cooperating)S +2540(program)S +2949(or)S +3078(it)S +3178(will)S +3387(hang)S +11 I +3637(xterm.)S +11 R +3984(On)S +4155(button)S +4474(press,)S +4764(the)S +4935(same)S +5197(informa-)S +6880 V +900(tion)S +1107(as)S +1233(for)S +1395(normal)S +1741(tracking)S +2135(is)S +2245(generated;)S +11 I +2736(xterm)S +11 R +3021(then)S +3246(waits)S +3514(for)S +3677(the)S +3847(program)S +4254(to)S +4376(send)S +4613(mouse)S +4936(tracking)S +5331(infor-)S +7000 V +900(mation.)S +11 I +1339(All)S +1540(X)S +1679(events)S +2023(are)S +2240(ignored)S +2653(until)S +2927(the)S +3132(proper)S +3502(escape)S +3870(sequence)S +4341(is)S +4486(received)S +4926(from)S +5205(the)S +5410(pty:)S +7120 V +11 Y1 +900(1)S +7110 V +900(1)S +6 R +925(ESC)S +7120 V +11 Y1 +1062(1)S +900(2)S +952(22)S +7110 V +1062(1)S +900(7)S +952(77)S +7120 V +1080(1)S +7110 V +1080(1)S +7120 V +11 R +1143([)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +7110 V +1242(1)S +1080(7)S +1132(77)S +7120 V +11 I +1260(P)S +7153 V +9 I +1305(s)S +7120 V +11 Y1 +1358(1)S +7110 V +1358(1)S +7120 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +7110 V +1520(1)S +1358(7)S +1410(77)S +7120 V +11 I +1538(P)S +7153 V +9 I +1583(s)S +7120 V +11 Y1 +1636(1)S +7110 V +1636(1)S +7120 V +11 R +1701(;)S +11 Y1 +1798(1)S +1636(2)S +1688(22)S +7110 V +1798(1)S +1636(7)S +1688(77)S +7120 V +11 I +1816(P)S +7153 V +9 I +1861(s)S +7120 V +11 Y1 +1914(1)S +7110 V +1914(1)S +7120 V +11 R +1979(;)S +11 Y1 +2076(1)S +1914(2)S +1966(22)S +7110 V +2076(1)S +1914(7)S +1966(77)S +7120 V +11 I +2094(P)S +7153 V +9 I +2139(s)S +7120 V +11 Y1 +2192(1)S +7110 V +2192(1)S +7120 V +11 R +2257(;)S +11 Y1 +2354(1)S +2192(2)S +2244(22)S +7110 V +2354(1)S +2192(7)S +2244(77)S +7120 V +11 I +2372(P)S +7153 V +9 I +2417(s)S +7120 V +11 Y1 +2470(1)S +7110 V +2470(1)S +7120 V +11 R +2517(T)S +11 Y1 +2632(1)S +2470(2)S +2522(22)S +7110 V +2632(1)S +2470(7)S +2522(77)S +7120 V +11 R +2650(.)S +2758(The)S +2975(parameters)S +3501(are)S +11 I +3680(func,)S +3944(startx,)S +4270(starty,)S +4596(\256rstrow,)S +11 R +5015(and)S +11 I +5220(lastrow.)S +7240 V +900(func)S +11 R +1129(is)S +1243(non-zero)S +1671(to)S +1797(initiate)S +2143(hilite)S +2410(tracking)S +2809(and)S +3007(zero)S +3234(to)S +3360(abort.)S +11 I +3686(startx)S +11 R +3977(and)S +11 I +4174(starty)S +11 R +4464(give)S +4692(the)S +4865(starting)S +5234(x)S +5328(and)S +5525(y)S +7680 V +3212(5)S +7920 V +EP +%%Page: 6 6 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +480 V +900(Xterm Control Sequences)S +4980(VT100 Mode)S +840 V +900(location)S +1291(for)S +1455(the)S +1626(highlighted)S +2165(region.)S +2543(The)S +2750(ending)S +3086(location)S +3477(tracks)S +3776(the)S +3948(mouse,)S +4301(but)S +4480(will)S +4690(never)S +4970(be)S +5111(above)S +5410(row)S +960 V +11 I +900(\256rstrow)S +11 R +1285(and)S +1484(will)S +1697(always)S +2042(be)S +2186(above)S +2488(row)S +11 I +2699(lastrow.)S +11 R +3133(\(The)S +3380(top)S +3562(of)S +3694(the)S +3869(screen)S +4188(is)S +4303(row)S +4514(1.\))S +4707(When)S +5009(the)S +5184(button)S +5506(is)S +1080 V +900(released,)S +11 I +1327(xterm)S +11 R +1618(reports)S +1964(the)S +2140(ending)S +2481(position)S +2879(one)S +3079(of)S +3212(two)S +3419(ways:)S +3717(if)S +3826(the)S +4003(start)S +4235(and)S +4436(end)S +4637(coordinates)S +5185(are)S +5360(valid)S +1200 V +900(text)S +1099(locations:)S +11 Y1 +1561(1)S +1190 V +1561(1)S +6 R +1586(ESC)S +1200 V +11 Y1 +1723(1)S +1561(2)S +1613(22)S +1190 V +1723(1)S +1561(7)S +1613(77)S +1200 V +1741(1)S +1190 V +1741(1)S +1200 V +11 R +1804([)S +11 Y1 +1903(1)S +1741(2)S +1793(22)S +1190 V +1903(1)S +1741(7)S +1793(77)S +1200 V +1921(1)S +1190 V +1921(1)S +1200 V +11 R +1986(t)S +11 Y1 +2083(1)S +1921(2)S +1973(22)S +1190 V +2083(1)S +1921(7)S +1973(77)S +1200 V +11 I +2101(C)S +1233 V +9 I +2153(x)S +1200 V +11 I +2193(C)S +1233 V +9 I +2245(y)S +1200 V +11 R +2285(.)S +2380(If)S +2486(either)S +2769(coordinate)S +3265(is)S +3372(past)S +3582(the)S +3749(end)S +3940(of)S +4064(the)S +4231(line:)S +11 Y1 +4460(1)S +1190 V +4460(1)S +6 R +4485(ESC)S +1200 V +11 Y1 +4622(1)S +4460(2)S +4512(22)S +1190 V +4622(1)S +4460(7)S +4512(77)S +1200 V +4640(1)S +1190 V +4640(1)S +1200 V +11 R +4703([)S +11 Y1 +4802(1)S +4640(2)S +4692(22)S +1190 V +4802(1)S +4640(7)S +4692(77)S +1200 V +4820(1)S +1190 V +4820(1)S +1200 V +11 R +4867(T)S +11 Y1 +4982(1)S +4820(2)S +4872(22)S +1190 V +4982(1)S +4820(7)S +4872(77)S +1200 V +11 I +5000(C)S +1233 V +9 I +5052(x)S +1200 V +11 I +5092(C)S +1233 V +9 I +5144(y)S +1200 V +11 I +5184(C)S +1233 V +9 I +5236(x)S +1200 V +11 I +5276(C)S +1233 V +9 I +5328(y)S +1200 V +11 I +5368(C)S +1233 V +9 I +5420(x)S +1200 V +11 I +5460(C)S +1233 V +9 I +5512(y)S +1200 V +11 R +5552(.)S +1320 V +900(The)S +1111(parameters)S +1631(are)S +11 I +1804(startx,)S +2124(starty,)S +2444(endx,)S +2720(endy,)S +2996(mousex,)S +11 R +3394(and)S +11 I +3594(mousey.)S +4025(startx,)S +4346(starty,)S +4667(endx,)S +11 R +4943(and)S +11 I +5143(endy)S +11 R +5391(give)S +1440 V +900(the)S +1079(starting)S +1454(and)S +1657(ending)S +2001(character)S +2444(positions)S +2888(of)S +3024(the)S +3203(region.)S +11 I +3556(mousex)S +11 R +3928(and)S +11 I +4130(mousey)S +11 R +4502(give)S +4735(the)S +4913(location)S +5311(of)S +5446(the)S +1560 V +900(mouse)S +1220(at)S +1332(button)S +1647(up,)S +1818(which)S +2119(may)S +2341(not)S +2515(be)S +2651(over)S +2878(a)S +2959(character.)S +1800 V +11 B +900(Tektronix)S +1404(4014)S +1657(Mode)S +1968 V +11 R +900(Most)S +1161(of)S +1286(these)S +1545(sequences)S +2022(are)S +2188(standard)S +2593(Tektronix)S +3060(4014)S +3314(control)S +3659(sequences.)S +4197(The)S +4401(major)S +4691(features)S +5070(missing)S +5448(are)S +2088 V +900(the)S +1074(write-thru)S +1552(and)S +1749(defocused)S +2231(modes.)S +2618(This)S +2853(document)S +3325(does)S +3565(not)S +3745(describe)S +4148(the)S +4321(commands)S +4836(used)S +5076(in)S +5201(the)S +5374(vari-)S +2208 V +900(ous)S +1086(Tektronix)S +1552(plotting)S +1929(modes)S +2249(but)S +2423(does)S +2657(describe)S +3054(the)S +3221(commands)S +3730(to)S +3849(switch)S +4169(modes.)S +2488 V +11 Y1 +900(1)S +2478 V +900(1)S +6 R +924(BEL)S +2488 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2478 V +1062(1)S +900(7)S +952(77)S +2488 V +11 R +1980(Bell)S +2197(\(Ctrl-G\))S +2648 V +11 Y1 +900(1)S +2638 V +900(1)S +6 R +944(BS)S +2648 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2638 V +1062(1)S +900(7)S +952(77)S +2648 V +11 R +1980(Backspace)S +2480(\(Ctrl-H\))S +2808 V +11 Y1 +900(1)S +2798 V +900(1)S +6 R +921(TAB)S +2808 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2798 V +1062(1)S +900(7)S +952(77)S +2808 V +11 R +1980(Horizontal)S +2482(Tab)S +2685(\(Ctrl-I\))S +2968 V +11 Y1 +900(1)S +2958 V +900(1)S +6 R +945(LF)S +2968 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2958 V +1062(1)S +900(7)S +952(77)S +2968 V +11 R +1980(Line)S +2214(Feed)S +2460(or)S +2584(New)S +2823(Line)S +3057(\(Ctrl-J\))S +3128 V +11 Y1 +900(1)S +3118 V +900(1)S +6 R +941(VT)S +3128 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3118 V +1062(1)S +900(7)S +952(77)S +3128 V +11 R +1980(Cursor)S +2312(up)S +2455(\(Ctrl-K\))S +3288 V +11 Y1 +900(1)S +3278 V +900(1)S +6 R +947(FF)S +3288 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3278 V +1062(1)S +900(7)S +952(77)S +3288 V +11 R +1980(Form)S +2252(Feed)S +2498(or)S +2622(New)S +2861(Page)S +3107(\(Ctrl-L\))S +3448 V +11 Y1 +900(1)S +3438 V +900(1)S +6 R +941(CR)S +3448 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3438 V +1062(1)S +900(7)S +952(77)S +3448 V +11 R +1980(Carriage)S +2389(Return)S +2721(\(Ctrl-M\))S +3608 V +11 Y1 +900(1)S +3598 V +900(1)S +6 R +925(ESC)S +3608 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3598 V +1062(1)S +900(7)S +952(77)S +3608 V +1080(1)S +3598 V +1080(1)S +6 R +1102(ETX)S +3608 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3598 V +1242(1)S +1080(7)S +1132(77)S +3608 V +11 R +1980(Switch)S +2319(to)S +2438(VT100)S +2782(Mode)S +3071(\(ESC)S +3343(Ctrl-C\))S +3768 V +11 Y1 +900(1)S +3758 V +900(1)S +6 R +925(ESC)S +3768 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3758 V +1062(1)S +900(7)S +952(77)S +3768 V +1080(1)S +3758 V +1080(1)S +6 R +1099(ENQ)S +3768 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3758 V +1242(1)S +1080(7)S +1132(77)S +3768 V +11 R +1980(Return)S +2312(Terminal)S +2747(Status)S +3050(\(ESC)S +3322(Ctrl-E\))S +3928 V +11 Y1 +900(1)S +3918 V +900(1)S +6 R +925(ESC)S +3928 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3918 V +1062(1)S +900(7)S +952(77)S +3928 V +1080(1)S +3918 V +1080(1)S +6 R +1125(LF)S +3928 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +3918 V +1242(1)S +1080(7)S +1132(77)S +3928 V +11 R +1980(PAGE)S +2300(\(Clear)S +2606(Screen\))S +4088 V +11 Y1 +900(1)S +4078 V +900(1)S +6 R +925(ESC)S +4088 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4078 V +1062(1)S +900(7)S +952(77)S +4088 V +1080(1)S +4078 V +1080(1)S +6 R +1122(SO)S +4088 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4078 V +1242(1)S +1080(7)S +1132(77)S +4088 V +11 R +1980(Begin)S +2276(4015)S +2529(APL)S +2770(mode)S +3047(\(ignored)S +3451(by)S +11 I +3594(xterm)S +11 R +3843(\))S +3912(\(ESC)S +4184(Ctrl-N\))S +4248 V +11 Y1 +900(1)S +4238 V +900(1)S +6 R +925(ESC)S +4248 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4238 V +1062(1)S +900(7)S +952(77)S +4248 V +1080(1)S +4238 V +1080(1)S +6 R +1134(SI)S +4248 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4238 V +1242(1)S +1080(7)S +1132(77)S +4248 V +11 R +1980(End)S +2190(4015)S +2443(APL)S +2684(mode)S +2961(\(ignored)S +3365(by)S +11 I +3508(xterm)S +11 R +3757(\))S +3826(\(ESC)S +4098(Ctrl-O\))S +4408 V +11 Y1 +900(1)S +4398 V +900(1)S +6 R +925(ESC)S +4408 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4398 V +1062(1)S +900(7)S +952(77)S +4408 V +1080(1)S +4398 V +1080(1)S +6 R +1104(ETB)S +4408 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4398 V +1242(1)S +1080(7)S +1132(77)S +4408 V +11 R +1980(COPY)S +2307(\(Save)S +2589(Tektronix)S +3055(Codes)S +3363(to)S +3482(\256le)S +3656(COPYyy-mm-dd.hh:mm:ss\))S +4941(\(ESC)S +5213(Ctrl-W\))S +4568 V +11 Y1 +900(1)S +4558 V +900(1)S +6 R +925(ESC)S +4568 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4558 V +1062(1)S +900(7)S +952(77)S +4568 V +1080(1)S +4558 V +1080(1)S +6 R +1098(CAN)S +4568 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4558 V +1242(1)S +1080(7)S +1132(77)S +4568 V +11 R +1980(Bypass)S +2331(Condition)S +2806(\(ESC)S +3078(Ctrl-X\))S +4728 V +11 Y1 +900(1)S +4718 V +900(1)S +6 R +925(ESC)S +4728 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4718 V +1062(1)S +900(7)S +952(77)S +4728 V +1080(1)S +4718 V +1080(1)S +6 R +1102(SUB)S +4728 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4718 V +1242(1)S +1080(7)S +1132(77)S +4728 V +11 R +1980(GIN)S +2207(mode)S +2484(\(ESC)S +2756(Ctrl-Z\))S +4888 V +11 Y1 +900(1)S +4878 V +900(1)S +6 R +925(ESC)S +4888 V +11 Y1 +1062(1)S +900(2)S +952(22)S +4878 V +1062(1)S +900(7)S +952(77)S +4888 V +1080(1)S +4878 V +1080(1)S +6 R +1127(FS)S +4888 V +11 Y1 +1242(1)S +1080(2)S +1132(22)S +4878 V +1242(1)S +1080(7)S +1132(77)S +4888 V +11 R +1980(Special)S +2336(Point)S +2603(Plot)S +2815(Mode)S +3104(\(ESC)S +3376(Ctrl-\\\))S +5048 V +11 Y1 +900(1)S +5038 V +900(1)S +6 R +925(ESC)S +5048 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5038 V +1062(1)S +900(7)S +952(77)S +5048 V +1080(1)S +5038 V +1080(1)S +5048 V +11 R +1133(8)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5038 V +1242(1)S +1080(7)S +1132(77)S +5048 V +11 R +1980(Select)S +2281(Large)S +2568(Character)S +3025(Set)S +5208 V +11 Y1 +900(1)S +5198 V +900(1)S +6 R +925(ESC)S +5208 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5198 V +1062(1)S +900(7)S +952(77)S +5208 V +1080(1)S +5198 V +1080(1)S +5208 V +11 R +1133(9)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5198 V +1242(1)S +1080(7)S +1132(77)S +5208 V +11 R +1980(Select)S +2281(#2)S +2424(Character)S +2881(Set)S +5368 V +11 Y1 +900(1)S +5358 V +900(1)S +6 R +925(ESC)S +5368 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5358 V +1062(1)S +900(7)S +952(77)S +5368 V +1080(1)S +5358 V +1080(1)S +5368 V +11 R +1145(:)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5358 V +1242(1)S +1080(7)S +1132(77)S +5368 V +11 R +1980(Select)S +2281(#3)S +2424(Character)S +2881(Set)S +5528 V +11 Y1 +900(1)S +5518 V +900(1)S +6 R +925(ESC)S +5528 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5518 V +1062(1)S +900(7)S +952(77)S +5528 V +1080(1)S +5518 V +1080(1)S +5528 V +11 R +1145(;)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5518 V +1242(1)S +1080(7)S +1132(77)S +5528 V +11 R +1980(Select)S +2281(Small)S +2572(Character)S +3029(Set)S +5688 V +11 Y1 +900(1)S +5678 V +900(1)S +6 R +925(ESC)S +5688 V +11 Y1 +1062(1)S +900(2)S +952(22)S +5678 V +1062(1)S +900(7)S +952(77)S +5688 V +1080(1)S +5678 V +1080(1)S +5688 V +11 R +1143(])S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +5678 V +1242(1)S +1080(7)S +1132(77)S +5688 V +11 I +1260(P)S +5721 V +9 I +1305(s)S +5688 V +11 Y1 +1358(1)S +5678 V +1358(1)S +5688 V +11 R +1423(;)S +11 Y1 +1520(1)S +1358(2)S +1410(22)S +5678 V +1520(1)S +1358(7)S +1410(77)S +5688 V +11 I +1538(P)S +5721 V +9 I +1583(t)S +5688 V +11 Y1 +1626(1)S +5678 V +1626(1)S +6 R +1650(BEL)S +5688 V +11 Y1 +1788(1)S +1626(2)S +1678(22)S +5678 V +1788(1)S +1626(7)S +1678(77)S +5688 V +11 R +1980(Set)S +2154(Text)S +2388(Parameters)S +2907(of)S +3031(VT)S +3210(window)S +5848 V +11 I +2046(P)S +5881 V +9 I +2091(s)S +5848 V +11 R +2159(=)S +11 Y1 +2254(1)S +5838 V +2254(1)S +5848 V +11 R +2307(0)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5838 V +2416(1)S +2254(7)S +2306(77)S +5848 V +11 Y +2467(\256)S +11 R +2609(Change)S +2977(Icon)S +3204(Name)S +3498(and)S +3689(Window)S +4100(Title)S +4341(to)S +11 I +4460(P)S +5881 V +9 I +4505(t)S +6008 V +11 I +2046(P)S +6041 V +9 I +2091(s)S +6008 V +11 R +2159(=)S +11 Y1 +2254(1)S +5998 V +2254(1)S +6008 V +11 R +2307(1)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +5998 V +2416(1)S +2254(7)S +2306(77)S +6008 V +11 Y +2467(\256)S +11 R +2609(Change)S +2977(Icon)S +3204(Name)S +3498(to)S +11 I +3617(P)S +6041 V +9 I +3662(t)S +6168 V +11 I +2046(P)S +6201 V +9 I +2091(s)S +6168 V +11 R +2159(=)S +11 Y1 +2254(1)S +6158 V +2254(1)S +6168 V +11 R +2307(2)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +6158 V +2416(1)S +2254(7)S +2306(77)S +6168 V +11 Y +2467(\256)S +11 R +2609(Change)S +2977(Window)S +3388(Title)S +3629(to)S +11 I +3748(P)S +6201 V +9 I +3793(t)S +6328 V +11 I +2046(P)S +6361 V +9 I +2091(s)S +6328 V +11 R +2159(=)S +11 Y1 +2254(1)S +6318 V +2254(1)S +6328 V +11 R +2307(4)S +11 Y1 +2416(1)S +2254(2)S +2306(22)S +6318 V +2416(1)S +2254(7)S +2306(77)S +6328 V +2434(1)S +6318 V +2434(1)S +6328 V +11 R +2487(6)S +11 Y1 +2596(1)S +2434(2)S +2486(22)S +6318 V +2596(1)S +2434(7)S +2486(77)S +6328 V +11 Y +2647(\256)S +11 R +2789(Change)S +3157(Log)S +3367(File)S +3572(to)S +11 I +3691(P)S +6361 V +9 I +3736(t)S +6488 V +11 Y1 +900(1)S +6478 V +900(1)S +6 R +925(ESC)S +6488 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6478 V +1062(1)S +900(7)S +952(77)S +6488 V +1080(1)S +6478 V +1080(1)S +6488 V +11 R +1143(\301)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6478 V +1242(1)S +1080(7)S +1132(77)S +6488 V +11 R +1980(Normal)S +2348(Z)S +2448(Axis)S +2689(and)S +2880(Normal)S +3248(\(solid\))S +3568(Vectors)S +6648 V +11 Y1 +900(1)S +6638 V +900(1)S +6 R +925(ESC)S +6648 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6638 V +1062(1)S +900(7)S +952(77)S +6648 V +1080(1)S +6638 V +1080(1)S +6648 V +11 R +1137(a)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6638 V +1242(1)S +1080(7)S +1132(77)S +6648 V +11 R +1980(Normal)S +2348(Z)S +2448(Axis)S +2689(and)S +2880(Dotted)S +3212(Line)S +3446(Vectors)S +6808 V +11 Y1 +900(1)S +6798 V +900(1)S +6 R +925(ESC)S +6808 V +11 Y1 +1062(1)S +900(2)S +952(22)S +6798 V +1062(1)S +900(7)S +952(77)S +6808 V +1080(1)S +6798 V +1080(1)S +6808 V +11 R +1133(b)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +6798 V +1242(1)S +1080(7)S +1132(77)S +6808 V +11 R +1980(Normal)S +2348(Z)S +2448(Axis)S +2689(and)S +2880(Dot-Dashed)S +3442(Vectors)S +7720 V +3212(6)S +7920 V +EP +%%Page: 7 7 +BP +/slant 0 def +/height 1.000000 def +11 R +11 R +520 V +900(Xterm Control Sequences)S +4605(Tektronix 4014 Mode)S +880 V +11 Y1 +900(1)S +870 V +900(1)S +6 R +925(ESC)S +880 V +11 Y1 +1062(1)S +900(2)S +952(22)S +870 V +1062(1)S +900(7)S +952(77)S +880 V +1080(1)S +870 V +1080(1)S +880 V +11 R +1137(c)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +870 V +1242(1)S +1080(7)S +1132(77)S +880 V +11 R +1980(Normal)S +2348(Z)S +2448(Axis)S +2689(and)S +2880(Short-Dashed)S +3516(Vectors)S +1040 V +11 Y1 +900(1)S +1030 V +900(1)S +6 R +925(ESC)S +1040 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1030 V +1062(1)S +900(7)S +952(77)S +1040 V +1080(1)S +1030 V +1080(1)S +1040 V +11 R +1133(d)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1030 V +1242(1)S +1080(7)S +1132(77)S +1040 V +11 R +1980(Normal)S +2348(Z)S +2448(Axis)S +2689(and)S +2880(Long-Dashed)S +3509(Vectors)S +1200 V +11 Y1 +900(1)S +1190 V +900(1)S +6 R +925(ESC)S +1200 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1190 V +1062(1)S +900(7)S +952(77)S +1200 V +1080(1)S +1190 V +1080(1)S +1200 V +11 R +1133(h)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1190 V +1242(1)S +1080(7)S +1132(77)S +1200 V +11 R +1980(Defocused)S +2480(Z)S +2580(Axis)S +2821(and)S +3012(Normal)S +3380(\(solid\))S +3700(Vectors)S +1360 V +11 Y1 +900(1)S +1350 V +900(1)S +6 R +925(ESC)S +1360 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1350 V +1062(1)S +900(7)S +952(77)S +1360 V +1080(1)S +1350 V +1080(1)S +1360 V +11 R +1145(i)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1350 V +1242(1)S +1080(7)S +1132(77)S +1360 V +11 R +1980(Defocused)S +2480(Z)S +2580(Axis)S +2821(and)S +3012(Dotted)S +3344(Line)S +3578(Vectors)S +1520 V +11 Y1 +900(1)S +1510 V +900(1)S +6 R +925(ESC)S +1520 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1510 V +1062(1)S +900(7)S +952(77)S +1520 V +1080(1)S +1510 V +1080(1)S +1520 V +11 R +1145(j)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1510 V +1242(1)S +1080(7)S +1132(77)S +1520 V +11 R +1980(Defocused)S +2480(Z)S +2580(Axis)S +2821(and)S +3012(Dot-Dashed)S +3574(Vectors)S +1680 V +11 Y1 +900(1)S +1670 V +900(1)S +6 R +925(ESC)S +1680 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1670 V +1062(1)S +900(7)S +952(77)S +1680 V +1080(1)S +1670 V +1080(1)S +1680 V +11 R +1133(k)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1670 V +1242(1)S +1080(7)S +1132(77)S +1680 V +11 R +1980(Defocused)S +2480(Z)S +2580(Axis)S +2821(and)S +3012(Short-Dashed)S +3648(Vectors)S +1840 V +11 Y1 +900(1)S +1830 V +900(1)S +6 R +925(ESC)S +1840 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1830 V +1062(1)S +900(7)S +952(77)S +1840 V +1080(1)S +1830 V +1080(1)S +1840 V +11 R +1145(l)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1830 V +1242(1)S +1080(7)S +1132(77)S +1840 V +11 R +1980(Defocused)S +2480(Z)S +2580(Axis)S +2821(and)S +3012(Long-Dashed)S +3641(Vectors)S +2000 V +11 Y1 +900(1)S +1990 V +900(1)S +6 R +925(ESC)S +2000 V +11 Y1 +1062(1)S +900(2)S +952(22)S +1990 V +1062(1)S +900(7)S +952(77)S +2000 V +1080(1)S +1990 V +1080(1)S +2000 V +11 R +1133(p)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +1990 V +1242(1)S +1080(7)S +1132(77)S +2000 V +11 R +1980(Write-Thru)S +2511(Mode)S +2800(and)S +2991(Normal)S +3359(\(solid\))S +3679(Vectors)S +2160 V +11 Y1 +900(1)S +2150 V +900(1)S +6 R +925(ESC)S +2160 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2150 V +1062(1)S +900(7)S +952(77)S +2160 V +1080(1)S +2150 V +1080(1)S +2160 V +11 R +1133(q)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2150 V +1242(1)S +1080(7)S +1132(77)S +2160 V +11 R +1980(Write-Thru)S +2511(Mode)S +2800(and)S +2991(Dotted)S +3323(Line)S +3557(Vectors)S +2320 V +11 Y1 +900(1)S +2310 V +900(1)S +6 R +925(ESC)S +2320 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2310 V +1062(1)S +900(7)S +952(77)S +2320 V +1080(1)S +2310 V +1080(1)S +2320 V +11 R +1143(r)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2310 V +1242(1)S +1080(7)S +1132(77)S +2320 V +11 R +1980(Write-Thru)S +2511(Mode)S +2800(and)S +2991(Dot-Dashed)S +3553(Vectors)S +2480 V +11 Y1 +900(1)S +2470 V +900(1)S +6 R +925(ESC)S +2480 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2470 V +1062(1)S +900(7)S +952(77)S +2480 V +1080(1)S +2470 V +1080(1)S +2480 V +11 R +1139(s)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2470 V +1242(1)S +1080(7)S +1132(77)S +2480 V +11 R +1980(Write-Thru)S +2511(Mode)S +2800(and)S +2991(Short-Dashed)S +3627(Vectors)S +2640 V +11 Y1 +900(1)S +2630 V +900(1)S +6 R +925(ESC)S +2640 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2630 V +1062(1)S +900(7)S +952(77)S +2640 V +1080(1)S +2630 V +1080(1)S +2640 V +11 R +1145(t)S +11 Y1 +1242(1)S +1080(2)S +1132(22)S +2630 V +1242(1)S +1080(7)S +1132(77)S +2640 V +11 R +1980(Write-Thru)S +2511(Mode)S +2800(and)S +2991(Long-Dashed)S +3620(Vectors)S +2800 V +11 Y1 +900(1)S +2790 V +900(1)S +6 R +947(FS)S +2800 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2790 V +1062(1)S +900(7)S +952(77)S +2800 V +11 R +1980(Point)S +2247(Plot)S +2459(Mode)S +2748(\(Ctrl-\\\))S +2960 V +11 Y1 +900(1)S +2950 V +900(1)S +6 R +942(GS)S +2960 V +11 Y1 +1062(1)S +900(2)S +952(22)S +2950 V +1062(1)S +900(7)S +952(77)S +2960 V +11 R +1980(Graph)S +2286(Mode)S +2575(\(Ctrl-]\))S +3120 V +11 Y1 +900(1)S +3110 V +900(1)S +6 R +944(RS)S +3120 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3110 V +1062(1)S +900(7)S +952(77)S +3120 V +11 R +1980(Incremental)S +2535(Plot)S +2747(Mode)S +3036(\(Ctrl-^\))S +3280 V +11 Y1 +900(1)S +3270 V +900(1)S +6 R +942(US)S +3280 V +11 Y1 +1062(1)S +900(2)S +952(22)S +3270 V +1062(1)S +900(7)S +952(77)S +3280 V +11 R +1980(Alpha)S +2281(Mode)S +2570(\(Ctrl-_\))S +7720 V +3212(7)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol Troff +%%Pages: 7 + \ No newline at end of file diff --git a/vendor/x11iraf/xgterm/cursor.c b/vendor/x11iraf/xgterm/cursor.c new file mode 100644 index 00000000..5fc00957 --- /dev/null +++ b/vendor/x11iraf/xgterm/cursor.c @@ -0,0 +1,244 @@ +/* + * $XConsortium: cursor.c,v 1.14 93/09/20 17:42:23 hersh Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* cursor.c */ + +#include "ptyx.h" /* also gets Xlib.h */ + +static void _CheckSelection(screen) +register TScreen *screen; +{ + extern XgtermWidget term; /* %%% gross */ + + if (screen->cur_row > screen->endHRow || + (screen->cur_row == screen->endHRow && + screen->cur_col >= screen->endHCol)) {} + else + DisownSelection(term); +} + + + +/* + * Moves the cursor to the specified position, checking for bounds. + * (this includes scrolling regions) + * The origin is considered to be 0, 0 for this procedure. + */ +CursorSet(screen, row, col, flags) +register TScreen *screen; +register int row, col; +unsigned flags; +{ + register int maxr; + + col = (col < 0 ? 0 : col); + screen->cur_col = (col <= screen->max_col ? col : screen->max_col); + maxr = screen->max_row; + if (flags & ORIGIN) { + row += screen->top_marg; + maxr = screen->bot_marg; + } + row = (row < 0 ? 0 : row); + screen->cur_row = (row <= maxr ? row : maxr); + screen->do_wrap = 0; + _CheckSelection(screen); +} + +/* + * moves the cursor left n, no wrap around + */ +CursorBack(screen, n) +register TScreen *screen; +int n; +{ + register int i, j, k, rev; + extern XgtermWidget term; + + if((rev = (term->flags & (REVERSEWRAP | WRAPAROUND)) == + (REVERSEWRAP | WRAPAROUND)) && screen->do_wrap) + n--; + if ((screen->cur_col -= n) < 0) { + if(rev) { + if((i = (j = screen->max_col + 1) * screen->cur_row + + screen->cur_col) < 0) { + k = j * (screen->max_row + 1); + i += ((-i) / k + 1) * k; + } + screen->cur_row = i / j; + screen->cur_col = i % j; + } else + screen->cur_col = 0; + } + screen->do_wrap = 0; + _CheckSelection(screen); +} + +/* + * moves the cursor forward n, no wraparound + */ +CursorForward(screen, n) +register TScreen *screen; +int n; +{ + screen->cur_col += n; + if (screen->cur_col > screen->max_col) + screen->cur_col = screen->max_col; + screen->do_wrap = 0; + _CheckSelection(screen); +} + +/* + * moves the cursor down n, no scrolling. + * Won't pass bottom margin or bottom of screen. + */ +CursorDown(screen, n) +register TScreen *screen; +int n; +{ + register int max; + + max = (screen->cur_row > screen->bot_marg ? + screen->max_row : screen->bot_marg); + + screen->cur_row += n; + if (screen->cur_row > max) + screen->cur_row = max; + screen->do_wrap = 0; + _CheckSelection(screen); +} + +/* + * moves the cursor up n, no linestarving. + * Won't pass top margin or top of screen. + */ +CursorUp(screen, n) +register TScreen *screen; +int n; +{ + register int min; + + min = (screen->cur_row < screen->top_marg ? + 0 : screen->top_marg); + + screen->cur_row -= n; + if (screen->cur_row < min) + screen->cur_row = min; + screen->do_wrap = 0; + _CheckSelection(screen); +} + +/* + * Moves cursor down amount lines, scrolls if necessary. + * Won't leave scrolling region. No carriage return. + */ +Index(screen, amount) +register TScreen *screen; +register int amount; +{ + register int j; + + /* + * indexing when below scrolling region is cursor down. + * if cursor high enough, no scrolling necessary. + */ + if (screen->cur_row > screen->bot_marg + || screen->cur_row + amount <= screen->bot_marg) { + CursorDown(screen, amount); + return; + } + + CursorDown(screen, j = screen->bot_marg - screen->cur_row); + Scroll(screen, amount - j); +} + +/* + * Moves cursor up amount lines, reverse scrolls if necessary. + * Won't leave scrolling region. No carriage return. + */ +RevIndex(screen, amount) +register TScreen *screen; +register int amount; +{ + /* + * reverse indexing when above scrolling region is cursor up. + * if cursor low enough, no reverse indexing needed + */ + if (screen->cur_row < screen->top_marg + || screen->cur_row-amount >= screen->top_marg) { + CursorUp(screen, amount); + return; + } + + RevScroll(screen, amount - (screen->cur_row - screen->top_marg)); + CursorUp(screen, screen->cur_row - screen->top_marg); +} + +/* + * Moves Cursor To First Column In Line + */ +CarriageReturn(screen) +register TScreen *screen; +{ + screen->cur_col = 0; + screen->do_wrap = 0; + _CheckSelection(screen); +} + +/* + * Save Cursor and Attributes + */ +CursorSave(term, sc) +register XgtermWidget term; +register SavedCursor *sc; +{ + register TScreen *screen = &term->screen; + + sc->row = screen->cur_row; + sc->col = screen->cur_col; + sc->flags = term->flags; + sc->curgl = screen->curgl; + sc->curgr = screen->curgr; + memmove( sc->gsets, screen->gsets, sizeof(screen->gsets)); +} + +/* + * Restore Cursor and Attributes + */ +CursorRestore(term, sc) +register XgtermWidget term; +register SavedCursor *sc; +{ + register TScreen *screen = &term->screen; + + memmove( screen->gsets, sc->gsets, sizeof(screen->gsets)); + screen->curgl = sc->curgl; + screen->curgr = sc->curgr; + term->flags &= ~(BOLD|INVERSE|UNDERLINE|ORIGIN); + term->flags |= sc->flags & (BOLD|INVERSE|UNDERLINE|ORIGIN); + CursorSet (screen, (term->flags & ORIGIN) ? sc->row - screen->top_marg + : sc->row, sc->col, term->flags); +} diff --git a/vendor/x11iraf/xgterm/data.c b/vendor/x11iraf/xgterm/data.c new file mode 100644 index 00000000..abcc4cfa --- /dev/null +++ b/vendor/x11iraf/xgterm/data.c @@ -0,0 +1,106 @@ +/* + * $XConsortium: data.c,v 1.11 93/02/25 17:21:27 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "ptyx.h" /* gets Xt stuff, too */ +#include "data.h" +#include <setjmp.h> + +XPoint T_boxlarge[NBOX] = { + {0, 0}, + {8, 0}, + {0, 14}, + {-8, 0}, + {0, -14}, +}; +XPoint T_box2[NBOX] = { + {0, 0}, + {7, 0}, + {0, 12}, + {-7, 0}, + {0, -12}, +}; +XPoint T_box3[NBOX] = { + {0, 0}, + {5, 0}, + {0, 12}, + {-5, 0}, + {0, -12}, +}; +XPoint T_boxsmall[NBOX] = { + {0, 0}, + {5, 0}, + {0, 9}, + {-5, 0}, + {0, -9}, +}; +int Tbcnt = 0; +Char *Tbuffer; +Char *Tbptr; +Char *Tpushb; +Char *Tpushback; +int Ttoggled = 0; +int bcnt = 0; +Char buffer[BUF_SIZE]; +Char *bptr = buffer; +jmp_buf VTend; +XPoint VTbox[NBOX] = { + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, + {0, 0}, +}; + +#ifdef DEBUG +int debug = 0; /* true causes error messages to be displayed */ +#endif /* DEBUG */ +XgtermWidget term; /* master data structure for client */ +char *xgterm_name; /* argv[0] */ +int am_slave = -1; /* set to 1 if running as a slave process */ +int max_plus1; +int pty_mask; +int Select_mask; +int X_mask; +char *ptydev; +char *ttydev; +#ifdef ALLOWLOGGING +char log_def_name[] = "XgtermLog.XXXXX"; +#endif +int T_lastx = -1; +int T_lasty = -1; + +/* Display connection used by GUI. */ +Display *gtermio_display; +Widget gtermio_toplevel; +char gtermio_appname[SZ_APPNAME+1]; + +int waitingForTrackInfo = 0; +EventMode eventMode = NORMAL; + +GC visualBellGC; + +int VTgcFontMask = GCFont; diff --git a/vendor/x11iraf/xgterm/data.h b/vendor/x11iraf/xgterm/data.h new file mode 100644 index 00000000..b1932c96 --- /dev/null +++ b/vendor/x11iraf/xgterm/data.h @@ -0,0 +1,69 @@ +/* + * $XConsortium: data.h,v 1.9 91/02/05 19:44:30 gildea Exp $ + */ +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +extern XPoint T_box2[]; +extern XPoint T_box3[]; +extern XPoint T_boxlarge[]; +extern XPoint T_boxsmall[]; +extern XPoint VTbox[]; +extern Char *Tbptr; +extern Char *Tbuffer; +extern Char *Tpushb; +extern Char *Tpushback; +extern Char *bptr; +#ifdef ALLOWLOGGING +extern char log_def_name[]; +#endif +extern char *ptydev; +extern char *ttydev; +extern char *xgterm_name; +extern Char buffer[]; +extern int Select_mask; +extern int T_lastx; +extern int T_lasty; +extern int Tbcnt; +extern int Ttoggled; +extern int X_mask; +extern int am_slave; +extern int bcnt; +#ifdef DEBUG +extern int debug; +#endif /* DEBUG */ +extern int errno; +extern int max_plus1; +extern int pty_mask; +extern int switchfb[]; + +extern int waitingForTrackInfo; +extern EventMode eventMode; +extern GC visualBellGC; +extern int VTgcFontMask; +extern XgtermWidget term; + +#define SZ_APPNAME 16 +extern Display *gtermio_display; +extern Widget gtermio_toplevel; +extern char gtermio_appname[]; diff --git a/vendor/x11iraf/xgterm/error.h b/vendor/x11iraf/xgterm/error.h new file mode 100644 index 00000000..1d50d05a --- /dev/null +++ b/vendor/x11iraf/xgterm/error.h @@ -0,0 +1,111 @@ +/* + * $XConsortium: error.h,v 1.8 91/07/17 17:43:54 rws Exp $ + */ + + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* @(#)error.h X10/6.6 11/6/86 */ +/* main.c */ +#define ERROR_KMALLOC 10 /* main: malloc() failed for keyboardtype */ +#define ERROR_FIONBIO 11 /* main: ioctl() failed on FIONBIO */ + + +#define ERROR_OPDEVTTY 14 /* spawn: open() failed on /dev/tty */ +#define ERROR_TIOCGETP 15 /* spawn: ioctl() failed on TIOCGETP */ +#define ERROR_TIOCGETC 16 /* spawn: ioctl() failed on TIOCGETC */ +#define ERROR_TIOCGETD 17 /* spawn: ioctl() failed on TIOCGETD */ +#define ERROR_TIOCGLTC 18 /* spawn: ioctl() failed on TIOCGLTC */ +#define ERROR_TIOCLGET 19 /* spawn: ioctl() failed on TIOCLGET */ +#define ERROR_TIOCCONS 20 /* spawn: ioctl() failed on TIOCCONS */ +#define ERROR_OPDEVTTY2 21 /* spawn: second open() failed on /dev/tty */ +#define ERROR_NOTTY 22 /* spawn: ioctl() failed on TIOCNOTTY */ +#define ERROR_TIOCSETP 23 /* spawn: ioctl() failed on TIOCSETP */ +#define ERROR_TIOCSETC 24 /* spawn: ioctl() failed on TIOCSETC */ +#define ERROR_TIOCSETD 25 /* spawn: ioctl() failed on TIOCSETD */ +#define ERROR_TIOCSLTC 26 /* spawn: ioctl() failed on TIOCSLTC */ +#define ERROR_TIOCLSET 27 /* spawn: ioctl() failed on TIOCLSET */ + +#define ERROR_FORK 29 /* spawn: fork() failed */ +#define ERROR_EXEC 30 /* spawn: exec() failed */ +#define ERROR_OPDEVTTY3 31 /* spawn: third open() failed on /dev/tty */ +#define ERROR_PTYS 32 /* get_pty: not enough ptys */ +#define ERROR_NOX 33 /* get_terminal: can't connect to server */ +#define ERROR_PTY_EXEC 34 /* waiting for initial map */ + +#define ERROR_INIT 36 /* spawn: can't initialize window */ +#define ERROR_NOCO 37 /* resize: no `co' in termcap */ +#define ERROR_NOLI 38 /* resize: no `li' in termcap */ +#define ERROR_BORDER 39 /* get_terminal: can't make border tile */ +#define ERROR_BACK 40 /* get_terminal: can't make background tile */ +#define ERROR_NOX3 43 /* get_terminal: bad pty from display server */ +#define ERROR_TIOCKGET 44 /* spawn: ioctl() failed on TIOCKGET */ +#define ERROR_TIOCKGETC 45 /* spawn: ioctl() failed on TIOCKGETC */ +#define ERROR_TIOCKSET 46 /* spawn: ioctl() failed on TIOCKSET */ +#define ERROR_TIOCKSETC 47 /* spawn: ioctl() failed on TIOCKSETC */ +/* charproc.c */ +#define ERROR_SELECT 50 /* in_put: select() failed */ +#define ERROR_VINIT 54 /* VTInit: can't initialize window */ +#define ERROR_CNMALLOC1 55 /* Changename: malloc failed */ +#define ERROR_CNMALLOC2 56 /* Changename: malloc failed */ +/* Tekproc.c */ +#define ERROR_TSELECT 60 /* Tinput: select() failed */ +#define ERROR_TINIT 64 /* TekInit: can't initialize window */ +#define ERROR_TBACK 65 /* TekBackground: can't make background */ +/* button.c */ +#define ERROR_BMALLOC2 71 /* SaltTextAway: malloc() failed */ + +/* misc.c */ +#ifdef ALLOWLOGGING +#ifdef ALLOWLOGFILEEXEC +#define ERROR_LOGEXEC 80 /* StartLog: exec() failed */ +#endif +#endif +#define ERROR_XERROR 83 /* xerror: XError event */ +#define ERROR_XIOERROR 84 /* xioerror: X I/O error */ +#define ERROR_WINNAME 85 /* get_terminal: malloc failed */ +/* screen.c */ +#define ERROR_SCALLOC 90 /* Alloc: calloc() failed on base */ +#define ERROR_SCALLOC2 91 /* Alloc: calloc() failed on rows */ +#define ERROR_SREALLOC 92 /* ScreenResize: realloc() failed on alt base */ +#define ERROR_SREALLOC2 93 /* ScreenResize: realloc() failed on alt rows */ +#define ERROR_SREALLOC3 94 /* ScreenResize: realloc() failed on rows */ +#define ERROR_SREALLOC4 95 /* ScreenResize: realloc() failed on rows */ +#define ERROR_RESIZE 96 /* ScreenResize: malloc() or realloc() failed */ +#define ERROR_RESIZE2 97 /* ScreenResize: malloc() or realloc() failed */ +#define ERROR_RESIZROW 98 /* ScreenResize: realloc() failed on alt char */ +#define ERROR_RESIZROW2 99 /* ScreenResize: realloc() failed on alt attr */ +#define ERROR_RESIZROW3 100 /* ScreenResize: realloc() failed on attr */ +#define ERROR_RESIZROW4 101 /* ScreenResize: realloc() failed on attr */ +/* scrollbar.c */ +#define ERROR_SBRALLOC 110 /* ScrollBarOn: realloc() failed on base */ +#define ERROR_SBRALLOC2 111 /* ScrollBarOn: realloc() failed on rows */ +/* util.c */ +#define ERROR_UBACK 120 /* ReverseVideo: can't make background */ + +#define ERROR_PTSNAME 217 /* spawn: ptsname() failed */ +#define ERROR_OPPTSNAME 218 /* spawn: open() failed on ptsname */ +#define ERROR_INIGROUPS 228 /* spawn: initgroups() failed */ +#define ERROR_SETUID 235 /* spawn: setuid() failed */ + diff --git a/vendor/x11iraf/xgterm/gtermio.c b/vendor/x11iraf/xgterm/gtermio.c new file mode 100644 index 00000000..0d1b825d --- /dev/null +++ b/vendor/x11iraf/xgterm/gtermio.c @@ -0,0 +1,2671 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#include <sys/ioctl.h> +#include <ctype.h> +#include <stdio.h> + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Xaw/Cardinals.h> +#include <X11/Shell.h> +#include <ObmW/Gterm.h> +#include <Obm.h> + +#include "gtermio.h" + +/* + * GTERMIO -- XGterm protocol manager for IRAF Gterm graphics emulation. + * This protocol is an extension of the Tektronix 4012 graphics protocol. + * The basic extensions are patterned after the Retrographics VT640 graphics + * terminal, using GS and CAN to switch between vt100 and graphics modes. + * Additional extensions are defined to support advanced features such as + * color, area fills, graphics erasure, setting the cursor location under + * program control, interactive dialog via the "status line", and so on. + * + * This is the low level code which filters graphics output out of the ASCII + * pseudoterminal output stream and decodes the graphics instructions therein, + * converting these into function calls to the Gterm graphics widget. The low + * level pty input code (i/o manager) in XGterm spends most of its time + * waiting for input on a pty. When a block of data is physically read from + * the pty, it is passed to the gio_ptyinput procedure herein. This routine + * filters out any graphics data in the input stream, handling text/graphics + * mode switches, returning any nongraphics input data to be passed on to the + * vt100 text widget. The input graphics data is then processed by the + * protocol manager which decodes the input and makes calls to the drawing + * functions in the gterm graphics widget. + */ + +/* Size limiting definitions. */ +#define TEK_XRES 1024 /* tek4012 logical X resolution */ +#define TEK_YRES 780 /* tek4012 logical Y resolution */ +#define TEK_ROWS 35 /* tek4012 screen size, rows */ +#define TEK_COLS 80 /* tek4012 screen size, columns */ +#define SZ_GBUF 16384 /* max buffered graphics data */ +#define GB_MINSPACE 2048 /* high water mark */ +#define GB_BIGSPACE 12288 /* low water mark */ +#define MAX_PLPTS 4096 /* max points in a polyline */ +#define MAX_COLORS 256 /* max colormap cells */ +#define SZ_TXBUF 1024 /* max chars in a polytext */ +#define SZ_STRBUF 128 /* string input buffer */ +#define SZ_MSGBUF 16384 /* object message fragments */ +#define SZ_ESCAPE 64 /* client escape sequence */ +#define INC_MSGBUF 16384 /* increment if overflow */ +#define MAX_TEXTCHARS 132 /* max chars in text line */ +#define SL_XOFFSET 0 /* x offset to status line */ +#define SL_YOFFSET 5 /* y offset to status line */ +#define MAX_QUOTA 512 /* limit for one proc. loop */ +#define MAXNDC 32767 /* max NDC coordinate value */ +#define MAX_GTERM 128 /* max gterm widgets */ + +/* Magic numbers. */ +#define SET_BITS 0 /* draw vectors|points */ +#define CLEAR_BITS 1 /* erase vectors|points */ +#define TOGGLE_BITS 2 /* toggle data bits */ +#define COMMAND_MODE 0 /* initial state */ +#define ALPHA_MODE 1 /* tek-alpha character drawing */ +#define TEXT_MODE 2 /* output to status line */ +#define VECTOR_MODE 3 /* draw vectors or points */ +#define MESSAGE_MODE 4 /* accumulate object messages */ +#define WIMAGE_MODE 5 /* draw pixels in image */ +#define WCMAP_MODE 6 /* write to colormap */ +#define WIOMAP_MODE 7 /* write to iomap */ +#define CURSOR_MODE 8 /* read crosshair cursor posn */ +#define BREAK_LINE (-2) /* special automargin code */ +#define ERR (-1) /* error return code */ + +/* ASCII codes. */ +#define ETX '\003' +#define ENQ '\005' +#define BEL '\007' +#define CR '\015' +#define CAN '\030' +#define EM '\031' +#define SUB '\032' +#define ESC '\033' +#define FS '\034' +#define GS '\035' +#define RS '\036' +#define US '\037' + +/* The following are the xterm equivalents of GS, CAN. Gtermio recognizes + * either as graphics start and end sequences. + */ +#define XGS "[?38h" /* xterm GS escape sequence */ +#define LEN_XGS 5 /* length excluding ESC */ +#define XGE "\003" /* graphics terminator (ETX) */ +#define LEN_XGE 1 /* length excluding ESC */ + +static XtAppContext app_con; +static ObmContext obm; /* object manager */ +static Widget gw; /* graphics widget */ + +static int gio_graphicsenabled = 0; /* switch text/graphics output */ +static int gio_enabled = 1; /* enable graphics window */ +static Widget gterms[MAX_GTERM]; +static int actions_registered = 0; + +/* Pseudoterminal i/o. + */ +static int pty_fd; /* fd of pseudoterminal */ +static int pty_stop = 0; /* set when XOFF is set on pty */ + +/* The graphics data buffer, a circular buffer. Note that while buffer + * data is unsigned char, g_getc below returns a signed integer value. + */ +static unsigned char g_buf[SZ_GBUF]; /* circular buffer */ +static unsigned char *g_top= &g_buf[SZ_GBUF]; /* end of buffer + 1 */ +static unsigned char *g_ip = g_buf; /* input pointer */ +static unsigned char *g_op = g_buf; /* output pointer */ + +#define g_getc(c) (g_ip == g_op ? \ + ((c)=0, -1) : ((c) = *g_ip++, g_ip >= g_top ? *(char *)(g_ip=g_buf):0)) +#define g_putc(c)\ + (*g_op++ = (c), ((g_op >= g_top) ? g_op = g_buf : g_op)) +#define g_ungetc(c)\ + (g_ip = ((g_ip==g_buf) ? g_top-1 : g_ip-1)) +#define g_spaceleft\ + (g_ip <= g_op ? (g_top - g_op + g_ip - g_buf) : (g_ip - g_op)) +#define g_havedata (g_ip != g_op) +#define g_mark(ip) ((ip)=g_ip) +#define g_reset(ip) (g_ip=(ip)) +#define g_equal(ip) ((ip)==g_ip) + +/* Message buffer. + */ +static char *msgbuf = NULL; +static int len_msgbuf = 0; +static int msg_op = 0; + +/* Polyline (polymarker) output-point buffer. + */ +static char pl_text[MAX_PLPTS]; /* encoded [x,y] coord data */ +static XPoint pl_p[MAX_PLPTS]; /* polyline storage */ +static int pl_npts = 0; /* npoints in polyline */ +static int pl_op = 0; /* which char in coord pair */ +static int pl_pointmode = 0; /* point or line mode */ +static int pl_areamode = 0; /* fill area mode */ + +static int ohiy=0, oloy=0; /* encoded current position */ +static int ohix=0, olox=0; + +/* Graphics text variables. + */ +static char tx_buf[SZ_TXBUF+1]; /* polytext text buffer */ +static int tx_len = 0; /* nchars in buffer */ +static int tx_maxlines; /* nlines of text on a screen */ +static int tx_maxcols; /* ncols of text on a screen */ +static int tx_charheight; /* height of a char in pixels */ +static int tx_charwidth; /* width of a char in pixels */ +static int tx_charbase; /* topline to baseline distance */ +static int tx_leftmargin; /* where columns start */ +static int sl_x, sl_y; /* current pos. in status line */ +static int sl_charwidth; /* status line char width */ +static int sl_charheight; /* status line char height */ +static int sl_charbase; /* topline to baseline distance */ + +/* Miscellaneous variables. + */ +static int cur_x, cur_y; /* current x,y position */ +static int tek_xres, tek_yres; /* resolution of input data */ +static int win_xres, win_yres; /* resolution of draw window */ +static int trailer1 = '\r'; /* trailer code, cursor value */ +static int trailer2 = -1; /* second trailer code (opt) */ +static char s_reset[SZ_ESCAPE]; /* sent to client on reset */ +static char s_resize[SZ_ESCAPE]; /* sent to client on resize */ +static int gio_mode=COMMAND_MODE; /* graphics drawing mode */ +static int gio_datalevel=SET_BITS; /* set, clear, or toggle bits */ +static int workstation_open = 0; /* have issued open workstation */ +static int wait_cursor = 0; /* waiting for cursor input */ +static int wincursor = 0; /* return window cursor */ +static int gio_delay = 0; /* wait for widget to ready */ +static int gio_pending = 0; /* workproc already posted */ + +/* Imaging variables. */ +static int wi_encoding, wi_raster, wi_x1, wi_y1, wi_nx, wi_ny, wi_bp; +static int wc_map, wc_first, wc_ncolors; + +/* Macros to convert between tektronix and window coordinates. */ +#define X_TEK2WIN(x) ( ((x) * win_xres + tek_xres/2) / tek_xres) +#define Y_TEK2WIN(y) (win_yres-1 - (((y) * win_yres + tek_yres/2) / tek_yres)) +#define X_WIN2TEK(x) ((( (x)) * tek_xres + win_xres/2) / win_xres) +#define Y_WIN2TEK(y) (((win_yres-1 - (y)) * tek_yres + win_yres/2) / win_yres) + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) + +/* OBM request queue. */ +struct request { + int key; + int sx, sy; + int raster; + int rx, ry; + int nchars; + char *strval; + struct request *next; +}; + +typedef struct request Request; +typedef Request *RequestPtr; +static RequestPtr request_head = NULL; +static RequestPtr request_tail = NULL; + +static int gio_reset(), gio_clear(), gio_setginmodeterm(), gio_output(); +static int gio_retcursor(), gio_queue_output(), gio_queue_request(); +static int gio_hardreset(), gio_activate(), gio_enable(), gio_tekmode(); +static int gio_processdata(), gio_ptyinput(), gio_escape(), gio_status(); +static int gio_activate_cb(), gio_connect_cb(); +static int gio_deactivate_cb(); +static void gio_keyinput(), gio_resize(); +static void pl_decodepts(), gio_retenq(); + +/* Externally callable routines. */ +static struct GT_function gio_functions[] = { + "reset", gio_hardreset, NULL, + "clear", gio_clear, NULL, + "input", gio_ptyinput, NULL, + "output", gio_processdata, NULL, + "activate", gio_activate, NULL, + "status", gio_status, NULL, + "enable", gio_enable, NULL, + "tekmode", gio_tekmode, NULL, + "setGinmodeTrailers", gio_setginmodeterm, NULL, +}; + + +/* Translation to hook Tek menu to gterm widget. */ +extern void HandlePopupMenu(); +extern void DeleteWindow(); +extern char *gtermio_getResource(); +static Atom wm_delete_window = 0; /* for ICCCM delete window */ + +static char *gio_shellTrans = + "<ClientMessage>WM_PROTOCOLS: DeleteWindow()\n"; +static char *gio_tekMenu = + "!Ctrl <Btn3Down>: popup-xtmenu(tekMenu)\n"; +static XtActionsRec actionsList[] = { + { "popup-xtmenu", HandlePopupMenu }, + { "DeleteWindow", DeleteWindow }, +}; + + +/* + * GTERMIO external procedures. + * ---------------------------- + */ + +/* GIO_SETUP -- Called by the high level Gterm window management code during + * process startup to establish communications between the caller and gtermio. + */ +void +gio_setup (app_context, argc, argv, fd) +XtAppContext app_context; /* applications context of caller */ +int argc; /* argument count */ +char *argv[]; /* argument vector */ +int fd; /* fd of pty for terminal i/o */ +{ + app_con = app_context; + pty_fd = fd; + + /* Register client callable functions. */ + gtermio_register (gio_functions, XtNumber(gio_functions)); + + /* Open the object manager. */ + obm = ObmOpen (app_context, argc, argv); + ObmAddCallback (obm, OBMCB_connect|OBMCB_preserve, + gio_connect_cb, NULL); + ObmAddCallback (obm, OBMCB_activate|OBMCB_preserve, + gio_activate_cb, NULL); + ObmAddCallback (obm, OBMCB_deactivate|OBMCB_preserve, + gio_deactivate_cb, NULL); + ObmAddCallback (obm, OBMCB_clientOutput|OBMCB_preserve, + gio_queue_output, NULL); + ObmAddCallback (obm, OBMCB_setGterm|OBMCB_preserve, + gio_reset, NULL); + + /* Register xgterm global actions. */ + if (!actions_registered) { + XtAppAddActions (app_context, actionsList, XtNumber(actionsList)); + actions_registered++; + } + + gio_hardreset (0); +} + + +/* GIO_POSTCONNECTCALLBACK -- Called by the client to post a procedure to + * be called when the display connection is opened or close. + */ +void +gio_postconnectcallback (connect, client_data) +void (*connect)(); +int client_data; +{ + if (obm) { + ObmAddCallback (obm, OBMCB_connect|OBMCB_preserve, + connect, client_data); + } +} + + +/* GIO_ENABLE -- Enable or disable the graphics window. If graphics is + * disabled, all i/o is directed to the text window. + */ +static +gio_enable (dummy, onoff) +int dummy; +int onoff; +{ + switch (onoff) { + case 0: + gio_enabled = 0; + gio_graphicsenabled = 0; + break; + case 1: + gio_enabled = 1; + break; + } + + return (gio_enabled); +} + + +/* GIO_ACTIVATE -- Callback procedure called by the client application to + * forcibly activate or deactivate the graphics UI. + */ +static +gio_activate (dummy, state) +int dummy; +int state; +{ + register RequestPtr rp; + + /* Cancel any buffered command output. */ + wait_cursor = 0; + while (rp = request_head) { + request_head = rp->next; + free ((char *)rp); + } + request_head = request_tail = NULL; + + switch (state) { + case 0: + /* Deactivate. If the application is currently waiting for + * cursor input send it EOF to indicate that the graphics window + * is deactivating and that the application should revert to + * terminal mode. + */ + if (wait_cursor) { + gio_retcursor ('\004', 0,0, 0,0,0, 0); /* ctrl/d */ + if (gw) + GtSetCursorType (gw, GtIdleCursor); + } + + ObmDeactivate (obm, 1); + gtermio_close_workstation(); + gio_graphicsenabled = 0; + break; + + case 1: + ObmActivate (obm); + gtermio_open_workstation(); + break; + } + + return (ObmActivated (obm)); +} + + +/* GIO_STATUS -- Query the status of the Object Manager, i.e., whether or + * not a GUI has been loaded. + */ +static +gio_status (dummy, app_name, app_class) +int dummy; +char *app_name; /* can be NULL */ +char *app_class; /* can be NULL */ +{ + return (ObmStatus (obm, app_name, app_class)); +} + + +/* GIO_ACTIVATE_CB -- Activate callback, called by the gterm widget when the + * user interface is activated. + */ +static +gio_activate_cb (dummy, w, state) +int dummy; +Widget w; +int state; +{ + register RequestPtr rp; + + if (!state) + return; + + /* Cancel any buffered command output. */ + wait_cursor = 0; + while (rp = request_head) { + request_head = rp->next; + free ((char *)rp); + } + request_head = request_tail = NULL; + + if (state) + gtermio_open_workstation(); + else + gtermio_close_workstation(); + + /* Arrange to intercept WM events on toplevel window. */ + wm_delete_window = XInternAtom (XtDisplay(w), + "WM_DELETE_WINDOW", False); + XSetWMProtocols (XtDisplay(w), XtWindow(w), &wm_delete_window, 1); +} + + +/* GIO_DEACTIVATE_CB -- Deactivate callback, called by the gterm widget when + * the user interface is deactivated. In reality we're just a dummy routine + * to intercept a window close action in a GUI to keep from shutting down + * completely. + */ +static +gio_deactivate_cb (dummy, w, state) +int dummy; +Widget w; +int state; +{ +} + + +/* GIO_CONNECT_CB -- Connect callback, called by the gterm widget when a new + * application GUI is initialized or when the display connection is closed. + */ +static +gio_connect_cb (dummy, display, toplevel, state) +int dummy; +Display *display; +Widget toplevel; +int state; +{ + if (state) { + extern Widget term; + extern char *mktemp(); + XrmDatabase db1, db2; + char *fname, buf[256]; + + /* Merge XGterm resources into GUI. There ought to be a way + * to do this without writing a temporary file, but there + * appears to be no alternative at present. + */ + strcpy (buf, "/tmp/XGdbXXXXXX"); + if (fname = mktemp (buf)) { + /* Merge XGterm resources. */ + db1 = XrmGetDatabase (XtDisplay(term)); + XrmPutFileDatabase (db1, fname); + db1 = XrmGetFileDatabase (fname); + db2 = XrmGetDatabase (XtDisplay(toplevel)); + XrmMergeDatabases (db1, &db2); + unlink (fname); + + /* Pass on the default Tek geometry. */ + XtVaSetValues (toplevel, XtNgeometry, + gtermio_getResource ("geometry"), NULL); + } + + XtAugmentTranslations (toplevel, + XtParseTranslationTable (gio_shellTrans)); + } else + memset (gterms, 0, sizeof(gterms)); +} + + +/* GIO_TEKMODE -- Direct input to the graphics window or the text window. + * Normally this is done by the client via the datastream but this routine + * can be called to manually switch the input to a window. + */ +static +gio_tekmode (dummy, onoff) +int dummy; +int onoff; +{ + switch (onoff) { + case 0: + gio_graphicsenabled = 0; + break; + case 1: + if (gio_enabled) + gio_graphicsenabled = 1; + break; + } + + return (gio_graphicsenabled); +} + + +/* GIO_CLEAR -- Clear the graphics window. + */ +static +gio_clear (dummy) +int dummy; +{ + if (gw) { + GtClearScreen (gw); + GtSetRaster (gw, 0); + } + + sl_x = 0; + sl_y = sl_charbase; + cur_x = tx_leftmargin; + cur_y = tx_charbase; +} + +/* debug routine. */ +gio_eventmask (w) +Widget w; +{ + printf ("mask = 0x%x\n", XtBuildEventMask(w)); +} + + +/* GIO_HARDRESET -- Reset everything, including cancelling any cursor read + * that may be in progress. + */ +static +gio_hardreset (dummy) +int dummy; +{ + register RequestPtr rp; + + /* If a cusor read is currently in progress send the application EOF + * to indicate that it should exit graphics mode. + */ + if (wait_cursor) { + gio_retcursor ('\004', 0,0, 0,0,0, 0); /* ctrl/d */ + if (gw) + GtSetCursorType (gw, GtIdleCursor); + } + + /* Send a reset message to the client, if the client posted a reset + * escape sequence. + */ + if (s_reset[0]) + v_write (pty_fd, s_reset, strlen(s_reset)); + + /* The client must reinitialize the client escapes after a reset. */ + s_reset[0] = '\0'; + s_resize[0] = '\0'; + + /* Initialize the object manager (destroys any current user + * interface). + */ + ObmInitialize (obm); + gtermio_close_workstation(); + if (msgbuf) + free (msgbuf); + msgbuf = (char *) malloc (len_msgbuf = SZ_MSGBUF); + msg_op = 0; + + memset (gterms, 0, sizeof(gterms)); + actions_registered = 0; + + /* Initialize the input buffer. */ + g_ip = g_op = g_buf; + g_top = &g_buf[SZ_GBUF]; + + /* Initialize the graphics state. */ + gio_mode = COMMAND_MODE; + gio_graphicsenabled = 0; + workstation_open = 0; + gio_delay = 0; + pty_stop = 0; + + /* Cancel any buffered command output. */ + wait_cursor = 0; + while (rp = request_head) { + request_head = rp->next; + free ((char *)rp); + } + request_head = request_tail = NULL; + return (0); +} + + +/* GIO_RESET -- Reset the state of the gtermio code. Should be called + * whenever any important data structures change, e.g., if the graphics + * window is resized. + */ +static +gio_reset (notused, w, args) +int notused; +register Widget w; +char *args; +{ + register int i; + int new_widget; + + /* Make this the active graphics widget. */ + if ((gw = w) == NULL) + return (0); + + GtReset (w); + GtActivate (w); + + /* Having a callback post a callback can result in an infinite + * loop, so only post the callbacks once per widget. + */ + new_widget = 1; + for (i=0; i < MAX_GTERM; i++) + if (gterms[i] == w) { + new_widget = 0; + break; + } + + if (new_widget) { + /* Tell widget how to talk to gtermio. */ + GtPostResetProc (w, gio_reset, (XtPointer)NULL); + GtPostInputProc (w, gio_keyinput, (XtPointer)NULL); + GtPostResizeProc (w, gio_resize, (XtPointer)NULL); + GtOverrideTranslations (w, gio_tekMenu); + GtTimerInhibit (w, False); + + for (i=0; i < MAX_GTERM; i++) + if (!gterms[i]) { + gterms[i] = w; + break; + } + } + + GtEraseAlphaCursor (w); + GtSetTextRes (w, TEK_ROWS, TEK_COLS); + GtGetPhysRes (w, 0, &win_xres, &win_yres); + GtSetLogRes (w, win_xres, win_yres); + tek_xres = TEK_XRES; + tek_yres = TEK_YRES; + + GtGetAlphaTextSize (w, NULL, + &tx_charwidth, &tx_charheight, &tx_charbase); + tx_maxlines = win_yres / tx_charheight; + tx_maxcols = win_xres / tx_charwidth; + tx_leftmargin = 0; + tx_len = 0; + + GtGetDialogTextSize (w, " ", + &sl_charwidth, &sl_charheight, &sl_charbase); + sl_x = 0; + sl_y = sl_charbase; + + pl_npts = 0; + pl_op = 0; + pl_pointmode = 0; + pl_areamode = 0; + ohiy = 0; oloy = 0; + ohix = 0; olox = 0; + + cur_x = tx_leftmargin; + cur_y = tx_charbase; + + return (0); +} + + +/* GIO_SETGINMODETERM -- Set the GIN mode (cursor read) trailer codes, + * expressed as octal constants in the input string argument. + */ +static +gio_setginmodeterm (dummy, str) +int dummy; +char *str; +{ + register char *ip; + register int n; + + trailer1 = trailer2 = -1; + + for (ip=str; isspace(*ip); ip++) + ; + if (isdigit(*ip)) { + for (n=0; isdigit(*ip); ip++) + n = n * 8 + *ip - '0'; + trailer1 = n; + } + + while (*ip && isspace(*ip)) + ip++; + if (isdigit(*ip)) { + for (n=0; isdigit(*ip); ip++) + n = n * 8 + *ip - '0'; + trailer2 = n; + } + + return (0); +} + + +/* + * Internal procedures. + * -------------------- + */ + + +/* GIO_RESIZE -- Callback procedure called by the gterm widget when the + * drawing window is resized. + */ +static void +gio_resize (notused, w) +XtPointer notused; +Widget w; +{ + /* Ignore the resize callback if the widget being resized is not the + * active widget. + */ + if (w != gw) + return; + + /* Always update the window size variables. */ + if (gw) { + GtGetPhysRes (gw, GtGetRaster(gw), &win_xres, &win_yres); + GtSetLogRes (gw, win_xres, win_yres); + + GtGetAlphaTextSize (gw, NULL, + &tx_charwidth, &tx_charheight, &tx_charbase); + tx_maxlines = win_yres / tx_charheight; + tx_maxcols = win_xres / tx_charwidth; + tx_leftmargin = 0; + tx_len = 0; + + GtGetDialogTextSize (gw, " ", + &sl_charwidth, &sl_charheight, &sl_charbase); + sl_x = 0; + sl_y = sl_charbase; + } + + /* Do not do a full reset and redraw if the resize request occurs + * while we are processing a buffer full of data. This happens when + * the window is first mapped, while processing the first block of + * drawing instructions. + */ + if (!g_havedata) { + if (gw) + gio_reset (NULL, gw, NULL); + + /* If the client posted a resize escape sequence, send this + * value to the client as a cursor read to signal the resize + * event. The window size is returned in the RX,RY fields. + */ + if (s_resize[0]) { + int key = s_resize[0]; + char *strval = s_resize + 1; + gio_queue_request (0,0,0, win_xres, win_yres, key, strval); + } + + if (wait_cursor && gw) + GtSetCursorType (gw, GtBusyCursor); + } +} + + +/* GIO_QUEUE_OUTPUT -- Queue an OBM client request to be sent to the client + * in response to the next client cursor read request. This is a callback + * procedure called by OBM to queue a request (command) to be sent to the + * client process. If the client already has a request for input (cursor + * read) pending, the request will be passed on immediately. + */ +static int +gio_queue_output (fd, tcl, objname, key, strval) +int fd; /* pty */ +XtPointer tcl; /* not used */ +char *objname; /* client object name (not used) */ +int key; /* cursor keystroke or NULL */ +char *strval; /* cursor strval or literal command */ +{ + int mapping, raster; + int sx, sy, rx, ry; + + /* Get the coordinates of the last event processed by the gterm + * widget. This is meaningless for many OBM client requests but + * will be valid for, e.g., GUI translation events within the + * gterm widget. + */ + if (gw) + GtGetCursorPos (gw, &sx, &sy); + else + sx = sy = 0; + + /* Convert screen (window) coordinates to raster coordinates. */ + if (gw && wincursor) { + raster = GtSelectRaster (gw, 0, GtPixel, sx, sy, + GtNDC, &rx, &ry, &mapping); + ry = MAXNDC - ry; + } else + raster = rx = ry = 0; + + return (gio_queue_request (sx, sy, raster, rx, ry, key, strval)); +} + + +/* GIO_QUEUE_REQUEST -- Queue a request. + */ +static int +gio_queue_request (sx, sy, raster, rx, ry, key, strval) +int sx, sy; +int raster, rx, ry; +int key; +char *strval; +{ + register RequestPtr rp; + int buflen, nchars; + char *buf; + + nchars = strlen (strval); + buflen = sizeof(Request) + nchars + 1; + if ((buf = (char *) malloc (buflen)) == NULL) + return (-1); + + rp = (RequestPtr) buf; + rp->key = key; + rp->sx = sx; + rp->sy = sy; + rp->raster = raster; + rp->rx = rx; + rp->ry = ry; + rp->nchars = nchars; + rp->strval = buf + sizeof(Request); + strcpy (rp->strval, strval); + rp->next = NULL; + + /* Link request at tail of request list. */ + if (!request_head) + request_head = request_tail = rp; + else { + request_tail->next = rp; + request_tail = rp; + } + + /* If a client cursor read is currently pending return the next + * available request. + */ + if (wait_cursor) + gio_output(); +} + + +/* GIO_OUTPUT -- Return the next available OBM request from the request + * queue to the client, in response to a ready for input (cursor read) from + * the client. The data sent to the client consists of a cursor value + * struct and/or a data string. If both are sent the cursor value struct + * contains a field giving the length of the data string which follows. + */ +static int +gio_output() +{ + register RequestPtr rp; + + if (!(rp = request_head)) + return (-1); + + /* Return a cursor read as if "key" had been typed. */ + if (rp->key) { + gio_retcursor (rp->key, rp->sx, rp->sy, + rp->raster, rp->rx, rp->ry, rp->nchars); + } + + /* Return the string value, if any. */ + if (rp->nchars > 0) { + v_write (pty_fd, rp->strval, rp->nchars); + if (!rp->key) + v_write (pty_fd, "\r", 1); + } + + /* Remove the request from the head of the queue. */ + if (!(request_head = rp->next)) + request_tail = NULL; + free ((char *)rp); + + return (0); +} + + +/* GIO_PTYINPUT -- Process pty input packets. Output directed to the + * terminal (/dev/tty) by the applications program appears as read-pending + * events on the pty seen by the XGterm program. We let the XGterm pty input + * code monitor the pty and respond to read-pending events. The low level + * read code reads the data and then calls us to process the data packet. We + * extract any graphics output from the packet and append it to the gio + * buffer. If data is added to the gio buffer a gio-data-pending event is + * queued so that the graphics drawing code will be called to process the new + * data. The remaining data, or a null length packet if the packet contained + * only graphics data, is returned to the caller, completing the read. + * Sometime later the graphics drawing code will be called to process the data. + */ +static int +gio_ptyinput (notused, ttybuf, nchars) +int notused; +char *ttybuf; /* raw data on input, tty data on output */ +int nchars; /* nchars of raw data */ +{ + register char *itop = ttybuf + nchars; + register char *op, *ip = ttybuf, ch; + + if (!gio_enabled || nchars <= 0) + return (nchars); + + /* If in text mode, make a quick scan for the graphics start sequence + * and return the entire data packet if graphics mode is not entered. + * Graphics start is indicated either by GS or by the xterm graphics + * start sequence XGS. + */ + if (!gio_graphicsenabled) { + while (ip < itop && *ip != GS && + !(*ip == ESC && strncmp (ip+1, XGS, LEN_XGS) == 0)) + ip++; + if (ip >= itop) + return (nchars); + else + op = ip; + } else + op = ttybuf; + + /* If the gio buffer has reached the high-water mark, call the + * output processing routine to dispose of some of the data. + */ + if (g_spaceleft < max(GB_MINSPACE,nchars)) { + while (g_spaceleft < max(GB_BIGSPACE,nchars)) + if (gio_processdata()) + break; + } + + /* Process rest of data in graphics mode. IP is pointing at the + * first char of graphics data, ITOP at the top of the buffer, + * and OP at the next tty output char. Filter out any NULs in + * the process of copying the data. + */ + while (ip < itop) + if (gio_graphicsenabled) { + while (ip < itop) { + if ((ch = *ip++) == CAN) { +gend: g_putc (ch); + gio_graphicsenabled = 0; + break; + } else if (ch == ESC && strncmp(ip,XGE,LEN_XGE) == 0) { + /* Treat xterm graphics terminator the same as CAN. */ + ip += LEN_XGE; + trailer1 = '\r'; + ch = CAN; + goto gend; + } else if (ch) + g_putc (ch); + } + } else { + while (ip < itop) { + ch = *ip++; + if (ch == GS) { +gstart: g_putc (GS); + gio_graphicsenabled = 1; + break; + } else if (ch == ESC && strncmp(ip,XGS,LEN_XGS) == 0) { + ip += LEN_XGS; + trailer1 = -1; + goto gstart; + } else if (ch) + *op++ = ch; + } + } + + return (op - ttybuf); +} + + +/* GIO_PROCESSDATA -- Called to process graphics instructions and data from + * the gio buffer. This is the routine which actually draws lines and text + * in the graphics window. May be called repeatedly to process any amount of + * data at a time. If there is a great amount of data to be processed the + * routine should return occasionally to allow the other XGterm event handlers + * to run (operation is not fully asynchronous). + * + * Graphics data is processed as a stream with no record boundaries, so that + * operation is not dependent on how data is buffered through the system. + * The graphics engine is a state machine which is by definition always in a + * legal state; garbage input causes garbage output, just like a real terminal. + * The states are as follows: + * + * COMMAND_MODE This is the initial state. Characters are accumulated + * until a known state is recognized. Receipt of ESC + * always causes command mode to be entered, since + * additional characters are needed to define the next + * instruction. + * + * ALPHA_MODE Characters are drawn in the graphics window at the + * "current" position (normally set beforehand with a + * GS/US vector move), using the alpha mode font. + * Receipt of any control code causes alpha mode to be + * exited. + * + * TEXT_MODE Text mode is a special mode used to write transient + * text in the status line, using the text mode font. + * Lines of text are accumulated and displayed on the + * status line in reverse video; successive lines of text + * overwrite one another. The status line is cleared + * when text mode is entered, even if no text is drawn. + * Text mode is terminated by receipt of GS or CAN. + * + * VECTOR_MODE Vector mode refers to both polyline and polypoint + * vector sequences. The vertices of the points are + * accumulated in a buffer and displayed when the buffer + * fills or when vector mode is terminated. Vector + * mode is terminated by receipt of any control code; + * the tektronix coordinate encoding maps all possible + * coordinates into the printable ascii codes. + * + * MESSAGE_MODE In message mode input text is accumulated in a buffer + * and eventually passed to the object manager, which + * delivers the message to the referenced object. + * Messages are used to download the user interface to + * be executed by the object manager, and during + * execution messages are used to set the values of + * user interface parameters to allow the UI to track + * the state of the client application. + * + * WIMAGE_MODE Pixels are accumulated and written to a gterm widget + * image raster. + * + * WCMAP_MODE Color triplets are accumulated and written to the + * gterm widget colormap. + * + * WIOMAP_MODE Colormap indices are accumulated and written to the + * gterm widget iomap. + * + * CURSOR_MODE The crosshair cursor is turned on, signifying to the + * user that the system is waiting on a cursor read. + * Output processing ceases until the user types a key + * or presses a mouse button to trigger the cursor read. + * The cursor value is then encoded and transmitted back + * to the pty, and output processing resumes. + * + * Clearing the screen causes the mode to be reset to command mode, and all + * other drawing parameters to be set to their default values, e.g., data level + * on, solid line type, and so on. + */ +static int +gio_processdata() +{ + register int quota, ch; + unsigned char *save_ip, *ip_start; + int textwidth; + + /* If gio_delay is set wait for the Gterm widget to become ready + * before processing any further graphics input data. + */ + if (gio_delay) { + gio_delay = gw ? !GtReady (gw) : 0; + if (gio_delay) + return (1); + } + + if (!g_havedata) + return (1); + + if (gw) + GtSetCursorType (gw, GtIdleCursor); + g_mark (ip_start); + + /* Process data. + */ + for (quota=MAX_QUOTA; --quota >= 0 && g_getc(ch) >= 0; ) { + if (ch == 0 || gio_enabled < 0) + continue; +again: + switch (gio_mode) { + case COMMAND_MODE: + switch (ch) { + case GS: + case FS: + case RS: + gio_mode = VECTOR_MODE; + pl_pointmode = (ch == FS); + pl_areamode = (ch == RS); + pl_npts = 0; + pl_op = 0; + + /* Only execute an open workstation if we have not already + * done so and if the next command is something other than + * close workstation, i.e., no-op sequences GS-CAN are + * filtered out, since they would only cause a pointless + * switch to the graphics frame and back without drawing. + * The open workstation sequence is GS,US. + */ + if (ch == GS && !workstation_open) { + if (g_getc(ch) < 0) { + g_ungetc (GS); + gio_mode = COMMAND_MODE; + goto exit; + } else if (ch != CAN) { + gtermio_open_workstation(); + if (ch != EM) { + /* Create default UI if none has been + * downloaded already by client. Note + * that this causes a gio_reset. + */ + gio_activate (NULL, 1); + } + if (gw) + GtActivate (gw); + workstation_open = 1; + g_ungetc (ch); + goto exit; + } + } + break; + + case US: + case CR: + gio_mode = ALPHA_MODE; + tx_len = 0; + if (ch == CR) + goto again; + break; + + case EM: + gio_mode = MESSAGE_MODE; + msg_op = 0; + break; + + case CAN: + if (workstation_open) { + gtermio_close_workstation(); + if (gw) { + GtSetCursorType (gw, GtIdleCursor); + GtDeactivate (gw); + } + workstation_open = 0; + } + gio_mode = COMMAND_MODE; + goto exit; + + case ESC: + g_ungetc (ch); + g_mark (save_ip); + if (gw) + GtEraseAlphaCursor (gw); + if ((gio_mode = gio_escape()) == -1) { + gio_mode = COMMAND_MODE; + g_reset (save_ip); + goto exit; + } else if (gio_mode == CURSOR_MODE) + goto again; + break; + + case BEL: + if (gw) + GtBell (gw); + break; + + default: + ; /* ignore unknown control chars */ + } + break; + + case MESSAGE_MODE: + if (isprint (ch) || isspace(ch)) { + if (msg_op >= len_msgbuf) { + len_msgbuf += INC_MSGBUF; + msgbuf = (char *) realloc (msgbuf, len_msgbuf); + } + /* Map CRLF and LFLF into LF. */ + if ((ch == '\n' || ch == '\r') && msg_op > 0 && + msgbuf[msg_op-1] == '\r') + --msg_op; + msgbuf[msg_op++] = ch; + + } else { + msgbuf[msg_op] = '\0'; + if (msg_op) { + char *object, *message; + char *ip; + + for (object=ip=msgbuf; *ip && !isspace(*ip); ip++) + ; + *ip = '\0'; + message = ip + 1; + + ObmDeliverMsg (obm, object, message); + msg_op = 0; + } + gio_mode = COMMAND_MODE; + goto again; + } + break; + + case WIMAGE_MODE: + /* Accumulate pixels and write to a gterm widget image + * raster. + */ + if (ch >= 040) { + if (msg_op >= len_msgbuf) { + len_msgbuf += INC_MSGBUF; + msgbuf = (char *) realloc (msgbuf, len_msgbuf); + } + msgbuf[msg_op++] = ch - 040; + } else { + if (gw && wi_nx*wi_ny <= len_msgbuf) + GtWritePixels (gw, wi_raster, msgbuf, wi_bp, + wi_x1, wi_y1, wi_nx, wi_ny); + + msg_op = 0; + gio_mode = COMMAND_MODE; + goto again; + } + break; + + case WCMAP_MODE: + /* Accumulate colormap triplets and write to the gterm widget + * colormap. + */ + if (ch >= 040) { + if (msg_op >= len_msgbuf) { + len_msgbuf += INC_MSGBUF; + msgbuf = (char *) realloc (msgbuf, len_msgbuf); + } + msgbuf[msg_op++] = ch; + } else { + register int i, j, v; + register char *ip = msgbuf; + unsigned short r[MAX_COLORS], g[MAX_COLORS], b[MAX_COLORS]; + int b1, b2; + + msgbuf[msg_op++] = 0; + for (i=0; i < wc_ncolors; i++) { + for (j=0; j < 3; j++) { + b1 = *ip++; b2 = *ip++; + if (b1 < 040 || b2 < 040) { + wc_ncolors = i; + break; + } else { + v = ((b1 - 040) << 4) | (b2 - 040); + if (j == 0) + r[i] = (v << 8); + else if (j == 1) + g[i] = (v << 8); + else + b[i] = (v << 8); + } + } + } + + if (gw && wc_ncolors) + GtWriteColormap (gw, wc_map, + wc_first, wc_ncolors, r, g, b); + + msg_op = 0; + gio_mode = COMMAND_MODE; + goto again; + } + break; + + case WIOMAP_MODE: + /* Accumulate colormap indices and write to the gterm widget + * iomap. + */ + if (ch >= 040) { + if (msg_op >= len_msgbuf) { + len_msgbuf += INC_MSGBUF; + msgbuf = (char *) realloc (msgbuf, len_msgbuf); + } + msgbuf[msg_op++] = ch; + } else { + register int b1, b2, i; + register char *ip = msgbuf; + unsigned short iomap[MAX_COLORS]; + + msgbuf[msg_op++] = 0; + for (i=0; i < wc_ncolors; i++) { + b1 = *ip++; b2 = *ip++; + if (b1 < 040 || b2 < 040) { + wc_ncolors = i; + break; + } else + iomap[i] = ((b1 - 040) << 4) | (b2 - 040); + } + + if (gw && wc_ncolors) + GtWriteIomap (gw, iomap, wc_first, wc_ncolors); + + msg_op = 0; + gio_mode = COMMAND_MODE; + goto again; + } + break; + + case ALPHA_MODE: + /* Tek alpha mode is used to write text to random positions on + * the screen, or to write lines of text to the gio window in + * "storage scope" mode, where the left and right columns are + * alternately written into with an inclusive-or rop. Alpha + * text is graphics output, part of the graphics being drawn. + */ + if (ch >= 040) { + tx_buf[tx_len++] = ch; + } else if (ch == '\t') { + tx_buf[tx_len++] = 040; + if (tx_leftmargin == 0 && tx_charwidth) + while ((tx_len + (cur_x / tx_charwidth)) % 8 != 0) + tx_buf[tx_len++] = 040; + } else if (ch == '\010' || ch == '\177') { + if (tx_len > 0) + tx_len--; + else if (cur_x > tx_leftmargin) + cur_x -= tx_charwidth; + } else { +flush_alpha: if (tx_len > 0) { + tx_buf[tx_len] = '\0'; + if (gw) { + GtEraseAlphaCursor (gw); + GtDrawAlphaText (gw, cur_x, cur_y, tx_buf); + } + } + + if (gw) { + GtGetAlphaTextSize (gw, tx_buf, + &textwidth, &tx_charheight, &tx_charbase); + cur_x += textwidth; + } else + cur_x += tx_len * tx_charwidth; + tx_len = 0; + + if (ch == '\n' || ch == BREAK_LINE) { + cur_y += tx_charheight; + if (cur_y > win_yres) { + if (tx_leftmargin == 0) + tx_leftmargin = win_xres / 2; + else + tx_leftmargin = 0; + cur_y = tx_charbase; + if (cur_x < tx_leftmargin) + cur_x = tx_leftmargin; + } + if (ch == BREAK_LINE) + cur_x = tx_leftmargin; + } else if (ch == '\r') { + cur_x = tx_leftmargin; + } else if (ch != 0) { + gio_mode = COMMAND_MODE; + goto again; + } + } + + /* Break long lines at the right margin. */ + if (tx_len && cur_x + (tx_len * tx_charwidth) >= win_xres) { + ch = BREAK_LINE; + goto flush_alpha; + } + + break; + + case TEXT_MODE: + /* Status or dialog text. In a graphics application this is + * written to the dialog area of the gterm widget. GUIs can + * intercept this text (which is the stdout or stderr of a + * task when in graphics mode), e.g. to display it in a + * message area. This is done by defining a UI parameter + * "textout" and registering a callback to process the output + * text. If the GUI does not define such a parameter no error + * message is printed. Only multicharacter messages are + * passed on in this way. In graphics applications where the + * user is typing into the status line and single characters + * are being echoed to the status line, this prevents the + * echoed characters from being delivered as messages (it also + * prevents any actual single-character messages from being + * delivered). + */ + if (ch >= 040) + tx_buf[tx_len++] = ch; + else if (ch == '\t') + tx_buf[tx_len++] = 040; + else if (ch == '\010' || ch == '\177') { + if (tx_len > 0) { + char delstr[2]; + delstr[0] = tx_buf[--tx_len]; + delstr[1] = '\0'; + GtGetDialogTextSize (gw, delstr, + &textwidth, &sl_charheight, &sl_charbase); + sl_x -= textwidth; + if (gw) { + GtEraseAlphaCursor (gw); + GtDrawDialogText (gw, sl_x, sl_y, " "); + } + } + } else { + if (tx_len > 0) { + tx_buf[tx_len] = '\0'; + if (tx_len > 1) { + + if (ch == '\n') { + tx_buf[tx_len] = ch; + tx_buf[tx_len+1] = '\0'; + } + tx_buf[tx_len] = '\0'; + if (tx_len) { + char txtbuf[2048]; + sprintf (txtbuf, "setValue {%s}\0", tx_buf); + ObmDeliverMsg (obm, "textout", txtbuf); + } + } +/* if (gw && tx_len == 1) {*/ + if (gw) { + GtEraseAlphaCursor (gw); + GtDrawDialogText (gw, sl_x, sl_y, tx_buf); + } + } + + if (gw) { + GtGetDialogTextSize (gw, tx_buf, + &textwidth, &sl_charheight, &sl_charbase); + sl_x += tx_len * sl_charwidth; + } else + sl_x += tx_len * sl_charwidth; + + if (sl_x > win_xres - sl_charwidth) + sl_x = win_xres - sl_charwidth; + tx_len = 0; + + if (ch == '\r' || ch == '\n') { + if (gw) + GtEndDialog (gw); + sl_x = 0; + } else if (ch != 0) { + gio_mode = COMMAND_MODE; + goto again; + } + } + + /* Truncate long lines. */ + if (sl_charwidth) + if (sl_x / sl_charwidth + tx_len >= MAX_TEXTCHARS) + if (tx_len > 0) + --tx_len; + else + sl_x -= sl_charwidth; + break; + + case VECTOR_MODE: + /* Following receipt of GS, accumulate encoded coordinate data + * until the buffer fills or a control code is received, then + * decode the encoded data to reconstruct the original data + * vector, and draw the vector. + */ + if (ch >= 040) + pl_text[pl_op++] = ch; + if (ch < 040 || pl_op >= MAX_PLPTS) + pl_decodepts(); + + if (ch < 040 || pl_npts >= MAX_PLPTS) { + if (pl_pointmode && pl_npts >= 1) { + if (gw) + GtDrawPolymarker (gw, pl_p, pl_npts); + } else if (pl_areamode && pl_npts >= 1) { + if (gw) + GtDrawPolygon (gw, pl_p, pl_npts); + } else if (pl_npts >= 2) { + if (gw) + GtDrawPolyline (gw, pl_p, pl_npts); + } + + if (pl_npts > 0) { + cur_x = pl_p[pl_npts-1].x; + cur_y = pl_p[pl_npts-1].y; + pl_npts = 0; + } + + if (ch < 040) { + gio_mode = COMMAND_MODE; + pl_op = 0; + goto again; + } + } + + break; + + case CURSOR_MODE: + /* Initiate a cursor read, i.e., inform the GUI that the + * client is ready for the next input command. If a request + * has already been queued for output to the client we send + * it back immediately with gio_output. Otherwise cursor + * mode is entered for the active graphics widget and the + * wait_cursor flag is set to indicate that the client is + * ready for input. + */ + if (wait_cursor++) { + /* This shouldn't ever happen. */ + g_ungetc (ch); + gio_mode = COMMAND_MODE; + if (gw) + GtSetCursorType (gw, GtBusyCursor); + } else { + /* Return the next request from the output queue, or + * enter cursor input mode if no requests are queued. + */ + if (gio_output() == 0) { + wait_cursor = 0; + gio_mode = COMMAND_MODE; + } else { + ObmActivate (obm); + if (gw) + GtSetCursorType (gw, GtGinmodeCursor); + } + } + break; + } + } + +exit: + /* Flush any buffered text before exiting, as applications will assume + * that text appears on the screen as soon as chars are written to the + * terminal (any buffering must be hidden). + */ + if (tx_len > 0) { + ch = 0; + goto again; + } + + if (gw) + GtFlush (gw); + + if (g_havedata && !g_equal(ip_start) && ch != ESC && !wait_cursor) + return (0); /* call again */ + else { + if (!wait_cursor) { + /* Update the alpha cursor to indicate we are ready + * for more input. + */ + if (gw) + GtWriteAlphaCursor (gw, cur_x, cur_y); + } + gio_pending = 0; + return (1); /* all done */ + } +} + + +/* PL_DECODEPTS -- Convert a sequence of textronix encoded polyline vertices + * into a simple array of [x,y] coordinate pairs. Each coordinate pair is + * encoded as a sequence of from 1 to 4 bytes, with bytes being optionally + * eliminated which do not change from one coordinate pair to the next. The + * possible coordinate pair encodings are as follows: + * + * HIY LOY HIX LOX + * 01xxxxx 11xxxxx 01xxxxx 10xxxxx + * 040 140 040 100 + * + * HIY LOX + * HIY LOY LOX + * HIY LOY HIX LOX + * LOY HIX LOX + * LOY LOX + * LOX + * + * In words, bytes which do not change need not be sent, except for the low-x + * byte (LOX). If the high-x byte changes, then the low-x byte must also be + * sent. The current position, stored as the 4 byte encoding, is cleared to + * zero when the screen is cleared. + */ +static void +pl_decodepts() +{ + register char *ip, *itop; + int hiy, loy, hix, lox, type, data, nb; + char *ip_save; + + for (ip_save=ip=pl_text, itop = &pl_text[pl_op]; ip < itop; ) { + hiy = ohiy; loy = oloy; + hix = ohix; lox = olox; + + for (nb=0; nb < 99 && ip < itop; nb++) { + type = (*ip & 0140); + data = (*ip++ & 037); + + switch (type) { + case 040: /* HIY, HIX */ + if (nb == 0) + hiy = data; + else + hix = data; + break; + case 0140: /* LOY */ + loy = data; + break; + + case 0100: + /* Receipt of LOX marks the end of the variable length + * sequence of bytes required to form the next [x,y]. + */ + lox = data; + pl_p[pl_npts].x = X_TEK2WIN ((hix << 5) + lox); + pl_p[pl_npts].y = Y_TEK2WIN ((hiy << 5) + loy); + if (gw && GtGetRaster(gw)) + pl_p[pl_npts].y = (win_yres-1) - pl_p[pl_npts].y; + + /* Update current position. */ + ohiy = hiy; oloy = loy; + ohix = hix; olox = lox; + + ip_save = ip; + pl_npts++; + nb = 99; /* EXIT */ + break; + } + } + } + + /* If there is any data left over (too few bytes to form a coordinate + * pair) move these to the start of the buffer. + */ + for (pl_op=0, ip=ip_save; ip < itop; ) + pl_text[pl_op++] = *ip++; +} + + +/* GIO_KEYINPUT -- Called by the Gterm widget when keyboard input occurs. + * If cursor mode is in effect keyboard input terminates the cursor read, + * causing a cursor value sequence to be output, otherwise character input is + * merely passed on. + */ +static void +gio_keyinput (notused, w, event) +XtPointer notused; +Widget w; +XEvent *event; +{ + XKeyEvent *xkey = &event->xkey; + char strbuf[SZ_STRBUF]; + int mapping, raster, sx, sy, rx, ry; + int nbytes; + + sx = xkey->x; + sy = xkey->y; + + nbytes = XLookupString (xkey, strbuf, SZ_STRBUF, NULL, NULL); + if (nbytes > 0) { + if (wait_cursor) { + /* Return raster number and raster coordinates of raster + * cursor is in, in addition to the usual screen coordinates. + */ + if (wincursor) { + raster = GtSelectRaster (w, 0, GtPixel, sx, sy, + GtNDC, &rx, &ry, &mapping); + ry = MAXNDC - ry; + } else + raster = rx = ry = 0; + + gio_retcursor (strbuf[0], sx, sy, raster, rx, ry, 0); + if (w) + GtSetCursorType (w, GtBusyCursor); + } else + v_write (pty_fd, strbuf, nbytes); + } +} + + +/* GIO_RETCURSOR -- Encode and return a cursor value to the pty (and thence + * to the program which initiated the cursor read). Clear the cursor read + * pending flag so that output processing can resume, and restart the output + * processing routine. + */ +static int +gio_retcursor (key, sx, sy, raster, rx, ry, datalen) +int key; /* key (or whatever) typed to trigger read */ +int sx, sy; /* screen coords of event */ +int raster; /* raster number */ +int rx, ry; /* raster coords of event */ +int datalen; /* nchars of data following cursor value */ +{ + register int n=0, mc_x, mc_y; + char curval[20]; + + /* Ignore cursor events unless requested via program control. + */ + if (!wait_cursor) + return (-1); + + curval[n++] = key; + + mc_x = (sx > 0) ? X_WIN2TEK(sx) : 0; + curval[n++] = ((mc_x >> 5) & 037) | 040; + curval[n++] = ((mc_x ) & 037) | 040; + + mc_y = (sy > 0) ? Y_WIN2TEK(sy) : 0; + curval[n++] = ((mc_y >> 5) & 037) | 040; + curval[n++] = ((mc_y ) & 037) | 040; + + /* The following optional fields are not part of a standard Tek + * cursor return value sequence. + */ + if (wincursor) { + curval[n++] = ((datalen >> 5) & 037) | 040; + curval[n++] = ((datalen ) & 037) | 040; + + curval[n++] = ((raster >> 5) & 037) | 040; + curval[n++] = ((raster ) & 037) | 040; + + mc_x = (rx > 0) ? rx : 0; + curval[n++] = ((mc_x >> 10) & 037) | 040; + curval[n++] = ((mc_x >> 5) & 037) | 040; + curval[n++] = ((mc_x ) & 037) | 040; + + mc_y = (ry > 0) ? ry : 0; + curval[n++] = ((mc_y >> 10) & 037) | 040; + curval[n++] = ((mc_y >> 5) & 037) | 040; + curval[n++] = ((mc_y ) & 037) | 040; + } + + if (trailer1 >= 0) + curval[n++] = trailer1; + if (trailer2 >= 0) + curval[n++] = trailer2; + + v_write (pty_fd, curval, n); + + wait_cursor = 0; + gio_mode = COMMAND_MODE; + + if (!gio_delay) + gio_processdata(); +} + + +/* GIO_RETENQ -- Respond to the ESC ENQ request. + */ +static void +gio_retenq() +{ + register int mc_x, mc_y; + char curval[7]; + int len; + + /* Graphics status word. */ + curval[0] = (061 | ((gio_mode == ALPHA_MODE) << 2) + | ((tx_leftmargin != 0) << 1)); + + /* Alpha cursor position. */ + mc_x = X_WIN2TEK (cur_x); + mc_y = Y_WIN2TEK (cur_y); + + curval[1] = ((mc_x >> 5) & 037) | 040; + curval[2] = ((mc_x ) & 037) | 040; + curval[3] = ((mc_y >> 5) & 037) | 040; + curval[4] = ((mc_y ) & 037) | 040; + curval[5] = trailer1; + curval[6] = trailer2; + + len = 5; + if (trailer1 >= 0) len++; + if (trailer2 >= 0) len++; + v_write (pty_fd, curval, len); +} + + +/* Definitions and data structures for a fast table driven fixed pattern + * escape sequence recognizer. Given character I of the sequence there will + * be N candidate sequences that have matched the first I-1 chars. Examine + * each to produce the next list of candidate sequences. Continue until either + * a sequence is matched or there are no more candidates. Variable length + * sequences such as "ESC[Pl;PcH" are handled as a special case: the general + * form of these is ESC '[' <digits> [';' <digits>...] LET. + */ +#define MAX_CANDIDATES 64 /* max candidate escseq */ +#define MAX_FIELDS 6 /* max fields in an escseq */ + +struct _esc { + char e_tag; /* integer code for escseq */ + char e_seq[MAX_FIELDS+1]; /* the sequence itself */ +}; + +static struct _esc *e_cand1[MAX_CANDIDATES]; /* 1st candidates array */ +static struct _esc *e_cand2[MAX_CANDIDATES]; /* 2nd candidates array */ +static struct _esc **e_pcand, **e_acand; /* candidates arrays */ +static int e_npcand, e_nacand; /* number of candidates */ +static int e_charno; /* char being examined */ +static int scanok; /* clr if decode fails */ +static int startscan(), getint(), getstr(), endscan(); + +static struct _esc e_table[] = { +#include "gtermio.esc" /* Gterm escape sequence table */ + { 0, 0,0,0,0,0,0,0 } +}; + + +/* GIO_ESCAPE -- Recognize and process graphics escape sequences, i.e., + * all multicharacter command codes beginning with ESC. The simple single + * character command codes are handled directly by the data processing code. + * The escapes have no well defined pattern to them, hence we must simply + * consume characters until a legal escape sequence is recognized or the + * sequence is found to not match any known sequence. It is possible that + * all of the characters forming a sequence will not yet have been deposited + * in the input buffer, in which case we return -1, indicating to our caller + * that we should be called back later to rescan the same input, when more + * data becomes available. Otherwise, we take whatever action is implied + * for the escape sequence and return the new mode to the interpreter code. + * If an unrecognized escape sequence is encountered it is discarded and we + * return in alpha mode so that subsequent input appears as garbage on the + * screen. + */ +static int +gio_escape() +{ + register struct _esc *esc; + register int ch, i, j; + struct _esc **e_temp; + int tag; + + /* Discard the ESC and get the first char. */ + g_getc (ch); + if (g_getc (ch) < 0) + return (-1); + + /* Build the initial list of candidates. This is the most expensive + * step, since all sequences must be examined. + */ + for (esc=e_table, e_pcand=e_cand1, e_npcand=0; esc->e_tag; esc++) + if (ch == esc->e_seq[0]) { + if (esc->e_seq[1] == 0) { + tag = esc->e_tag; + goto action; + } + e_pcand[e_npcand++] = esc; + } + + /* If there were no candidates, we are done. */ + if (e_npcand == 0) { + g_ungetc (ch); + return (ALPHA_MODE); + } + + /* Examine successive characters from the input, building a new, + * shorter candidate list on each iteration. This should converge + * very rapidly one way or the other. + */ + for (j=1, e_acand=e_cand2; j < MAX_FIELDS && e_npcand > 0; j++) { + if (g_getc(ch) < 0) + return (-1); + + /* Examine the next character of each sequence in the list of + * candidate sequences. If we have a complete match, we are + * done, else if we have a single character match add the seq + * to the new candidates list. + */ + e_nacand = 0; + for (i=0; i < e_npcand; i++) { + esc = e_pcand[i]; + if (ch == esc->e_seq[j]) { + if (esc->e_seq[j+1] == 0) { + tag = esc->e_tag; + goto action; + } + e_acand[e_nacand++] = esc; + } + } + + e_temp = e_pcand; e_pcand = e_acand; e_acand = e_temp; + e_npcand = e_nacand; + } + + /* If the escape sequence was recognized the above code should have + * vectored off to the action marker below. If we fall through the + * loop it can only mean that we have an unrecognized escape sequence, + * so discard it and return in command mode. + */ + g_ungetc (ch); + return (ALPHA_MODE); + +action: + /* Process the escape sequence. */ + switch (tag) { + case ESC_SETTEXTMODE: + sl_x = 0; + tx_len = 0; + if (gw) + GtStartDialog (gw); + return (TEXT_MODE); + + case ESC_ENQUIRE: + gio_retenq(); + break; + case ESC_READCURSOR: + wincursor = 0; + return (CURSOR_MODE); + case ESC_WINCURSOR: + wincursor = 1; + return (CURSOR_MODE); + case ESC_SETCURSOR: + if (gw) + GtSetCursorPos (gw, cur_x, cur_y); + break; + + case ESC_CLEARSCREEN: + if (gw) { + GtClearScreen (gw); + GtSetRaster (gw, 0); + } + tx_leftmargin = 0; + cur_x = tx_leftmargin; + cur_y = tx_charbase; + ohiy = 0; oloy = 0; + ohix = 0; olox = 0; + gio_datalevel = SET_BITS; + pl_pointmode = 0; + pl_areamode = 0; + return (ALPHA_MODE); + + case ESC_SETCHARSIZE0: + case ESC_SETCHARSIZE1: + case ESC_SETCHARSIZE2: + case ESC_SETCHARSIZE3: + /* Ignore these for now. */ + break; + + case ESC_SETDATALEVEL0: + if (gw) + GtSetDataLevel (gw, GtSet); + break; + case ESC_SETDATALEVEL1: + if (gw) + GtSetDataLevel (gw, GtClear); + break; + case ESC_SETDATALEVEL2: + if (gw) + GtSetDataLevel (gw, GtInvert); + break; + + case ESC_SETLINESTYLE0: + if (gw) + GtSetLineStyle (gw, GtSolid); + break; + case ESC_SETLINESTYLE1: + if (gw) + GtSetLineStyle (gw, GtDashed); + break; + case ESC_SETLINESTYLE2: + if (gw) + GtSetLineStyle (gw, GtDotted); + break; + case ESC_SETLINESTYLE3: + if (gw) + GtSetLineStyle (gw, GtDashDot); + break; + case ESC_SETLINESTYLE4: + if (gw) + GtSetLineStyle (gw, GtDash3Dot); + break; + + case ESC_SETLINEWIDTH0: + if (gw) + GtSetLineWidth (gw, 1); + break; + case ESC_SETLINEWIDTH1: + if (gw) + GtSetLineWidth (gw, 2); + break; + case ESC_SETLINEWIDTH2: + if (gw) + GtSetLineWidth (gw, 3); + break; + + case ESC_SETCOLOR0: + if (gw) + GtSetColorIndex (gw, 0); + break; + case ESC_SETCOLOR1: + if (gw) + GtSetColorIndex (gw, 1); + break; + case ESC_SETCOLOR2: + if (gw) + GtSetColorIndex (gw, 2); + break; + case ESC_SETCOLOR3: + if (gw) + GtSetColorIndex (gw, 3); + break; + case ESC_SETCOLOR4: + if (gw) + GtSetColorIndex (gw, 4); + break; + case ESC_SETCOLOR5: + if (gw) + GtSetColorIndex (gw, 5); + break; + case ESC_SETCOLOR6: + if (gw) + GtSetColorIndex (gw, 6); + break; + case ESC_SETCOLOR7: + if (gw) + GtSetColorIndex (gw, 7); + break; + case ESC_SETCOLOR8: + if (gw) + GtSetColorIndex (gw, 8); + break; + case ESC_SETCOLOR9: /* see also SETCOLORN */ + if (gw) + GtSetColorIndex (gw, 9); + break; + + /* Imaging escape sequences. These are encoded as follows: + * + * ESC r <code> [ P ; P ; ... ] <data> + * + * By the time we get here the input is positioned to just before the + * first '[' as only the fixed pattern part of the escape will have + * been recognized. + * + * Imaging instructions consist of a fixed pattern escape sequence + * identifying the instruction, followed by a fixed number of ASCII + * encoded parameters, followed in some cases by a variable-sized data + * field. + * + * Pixels are encoded as ascii codes by adding 040 to the value of each + * pixel. The range of possible pixel values is about 200. The EC + * field in the read/write pixels instruction specifies the encoding + * type; this field is ignored at present and should be zero. + * + * The query raster instruction returns the raster size as a flag 0/1 + * indicating whether the given raster exists, followed by pair of + * decimal encoded ascii numbers giving the raster size. Raster 0 is + * the gterm window hence this function may be used to query the window + * size. The create raster instruction may be used to request that the + * window size be changed; the server may or may not permit such a + * resize request to succeed. + * + * Colors are RGB color intensity triplets. Intensities are 8 bit + * values (0-255) encoded as two bytes, 4 bits plus 040 in each byte. + * + * Return values are encoded the same as input data, with a two byte + * trailer following the data (usually CR). + */ + + case ESC_SETRESET: + { /* parameters: reset-str */ + if (startscan() || getstr(s_reset) || endscan()) + return (-1); + } + break; + + case ESC_SETRESIZE: + { /* parameters: resize-str */ + if (startscan() || getstr(s_resize) || endscan()) + return (-1); + } + break; + + case ESC_RASTERINIT: + if (gw) + GtRasterInit (gw); + break; + + case ESC_CREATERASTER: + { /* parameters: RN RT NX NY BP */ + int raster, type, width, height, depth; + if (startscan()) + return (-1); + if (getint(&raster) || getint(&type) || + getint(&width) || getint(&height) || getint(&depth)) + return (-1); + if (endscan()) + return (-1); + if (gw && scanok) + GtCreateRaster (gw, raster, type, width, height, depth); + } + break; + + case ESC_DESTROYRASTER: + { /* parameters: RN */ + int raster; + if (startscan() || getint(&raster) || endscan()) + return (-1); + if (gw && scanok) + GtDestroyRaster (gw, raster); + } + break; + + case ESC_QUERYRASTER: + { /* parameters: RN */ + int status, raster, type, width, height, depth; + char obuf[80]; + + if (startscan() || getint(&raster) || endscan()) + return (-1); + if (gw) { + if (!GtReady (gw)) { + gio_delay = 1; + return (-1); + } + status = GtQueryRaster (gw, raster, + &type, &width, &height, &depth); + } + + sprintf (obuf, "\033[5;%d;%d;%d;%d;%d]", + status, type, width, height, depth); + v_write (pty_fd, obuf, strlen(obuf)); + } + break; + + case ESC_SETRASTER: + { /* parameters: RN */ + int raster; + if (startscan() || getint(&raster) || endscan()) + return (-1); + if (gw && scanok) + GtSetRaster (gw, raster); + } + break; + + case ESC_WRITEPIXELS: + { /* parameters: RN EC X1 Y1 NX NY BP (NX*NY pixels follow) */ + if (startscan()) + return (-1); + if (getint(&wi_raster) || getint(&wi_encoding) || + getint(&wi_x1) || getint(&wi_y1) || + getint(&wi_nx) || getint(&wi_ny) || getint(&wi_bp)) + return (-1); + if (endscan()) + return (-1); + msg_op = 0; + return (scanok ? WIMAGE_MODE : COMMAND_MODE); + } + break; + + case ESC_READPIXELS: + { /* parameters: RN EC X1 Y1 NX NY BP (return NX*NY pixels) */ + int raster, encoding, x1, y1, nx, ny, nbits, npix=0; + register unsigned char *data, *op; + unsigned char obuf[128]; + register int i; + + if (startscan()) + return (-1); + if (getint(&raster) || getint(&encoding) || getint(&x1) || + getint(&y1) || getint(&nx) || getint(&ny) || + getint(&nbits)) + return (-1); + if (endscan()) + return (-1); + + if (scanok) { + npix = nx * ny; + if ((data = (unsigned char *) malloc (npix)) == NULL) + return (-1); + if (gw && scanok) { + if (GtReadPixels (gw, raster, data, + nbits, x1, y1, nx, ny) == ERR) + npix = 0; + } + } + + /* Return the pixels bracked by ESC and the trailers. This is + * done even if no data is returned, e.g. due to a parameter + * error or read error. + */ + op = obuf; + *op++ = '\033'; + for (i=0, op=obuf; i < npix; i++) { +/* *op++ = data[i] + 040;*/ + *op++ = ((data[i] >> 4) & 017) + 040; + *op++ = ((data[i] ) & 017) + 040; + if (op - obuf > 100) { + v_write (pty_fd, obuf, op-obuf); + op = obuf; + } + } + if (trailer1 >= 0) *op++ = trailer1; + if (trailer2 >= 0) *op++ = trailer2; + v_write (pty_fd, obuf, op-obuf); + + if (scanok) + free (data); + } + break; + + case ESC_REFRESHPIXELS: + { /* parameters: RN CT X1 Y1 NX NY */ + int x1, y1, nx, ny; + int raster, ct; + + if (startscan()) + return (-1); + if (getint(&raster) || getint(&ct) || + getint(&x1) || getint(&y1) || + getint(&nx) || getint(&ny)) + return (-1); + if (endscan()) + return (-1); + + if (gw && scanok) + GtRefreshPixels (gw, raster, ct, x1,y1,nx,ny); + } + break; + + case ESC_SETPIXELS: + { /* parameters: RN CT X1 Y1 NX NY CO OP */ + int raster, ct, co, op; + int x1, y1, nx, ny; + + if (startscan()) + return (-1); + if (getint(&raster) || getint(&ct) || + getint(&x1) || getint(&y1) || + getint(&nx) || getint(&ny) || + getint(&co) || getint(&op)) + return (-1); + if (endscan()) + return (-1); + + if (gw && scanok) + GtSetPixels (gw, raster, ct, x1,y1,nx,ny, co,op); + } + break; + + case ESC_WRITECMAP: + { /* parameters: MP FC NC (NC color triplets follow) */ + + if (startscan() || getint(&wc_map) || getint(&wc_first) || + getint(&wc_ncolors) || endscan()) + return (-1); + + msg_op = 0; + if (wc_ncolors > MAX_COLORS) + wc_ncolors = MAX_COLORS; + return (scanok ? WCMAP_MODE : COMMAND_MODE); + } + break; + + case ESC_READCMAP: + { /* parameters: MP FC NC (return NC color triplets) */ + int map, first, ncolors, buflen; + unsigned short *buf, *r, *g, *b, v[3]; + unsigned char obuf[128]; + register unsigned char *op; + register int i, j; + + if (startscan() || getint(&map) || getint(&first) || + getint(&ncolors) || endscan()) + return (-1); + + /* Get the colormap data into a buffer. */ + if (scanok) { + buflen = ncolors * 3 * sizeof (unsigned short); + if ((buf = (unsigned short *) malloc (buflen)) == NULL) + return (-1); + b = (g = (r = buf) + ncolors) + ncolors; + if (gw) { + ncolors = GtReadColormap (gw, map,first,ncolors,r,g,b); + if (ncolors == ERR) + ncolors = 0; + } else + ncolors = 0; + } else + ncolors = 0; + + /* Return the encoded colors bracked by ESC and the trailers. + * This is done even if no data is returned, e.g. due to a + * parameter error or read error. + */ + op = obuf; + *op++ = '\033'; + for (i=0, op=obuf; i < ncolors; i++) { + v[0] = (r[i] >> 8); v[1] = (g[i] >> 8); v[2] = (b[i] >> 8); + for (j=0; j < 3; j++) { + *op++ = ((v[j] >> 4) & 017) + 040; + *op++ = ((v[j] ) & 017) + 040; + } + + if (op - obuf > 100) { + v_write (pty_fd, obuf, op-obuf); + op = obuf; + } + } + if (trailer1 >= 0) *op++ = trailer1; + if (trailer2 >= 0) *op++ = trailer2; + v_write (pty_fd, obuf, op-obuf); + + if (scanok) + free (buf); + } + break; + + case ESC_LOADCMAP: + { /* parameters: MP OF DX DY */ + int colormap, gki_offset, dx, dy; + float offset, slope; + + if (startscan() || getint(&colormap) || getint(&gki_offset) || + getint(&dx) || getint(&dy) || endscan()) + return (-1); + + offset = (float)gki_offset / (float)((MAXNDC + 1) / 4); + slope = dx ? (float)dy / (float)dx : MAXNDC; + + if (gw && scanok) + GtLoadColormap (gw, colormap, offset, slope); + } + break; + + case ESC_FREECMAP: + { /* parameters: MP */ + int colormap; + if (startscan() || getint(&colormap) || endscan()) + return (-1); + if (gw && scanok) + GtFreeColormap (gw, colormap); + } + break; + + case ESC_WRITEIOMAP: + { /* parameters: FC NC (NC color triplets follow) */ + + if (startscan() || getint(&wc_first) || + getint(&wc_ncolors) || endscan()) + return (-1); + + msg_op = 0; + if (wc_ncolors > MAX_COLORS) + wc_ncolors = MAX_COLORS; + return (scanok ? WIOMAP_MODE : COMMAND_MODE); + } + break; + + case ESC_READIOMAP: + { /* parameters: FC NC (return NC color triplets) */ + int first, ncolors, buflen; + unsigned short *iomap, v; + unsigned char obuf[128]; + register unsigned char *op; + register int i; + + if (startscan() || getint(&first) || + getint(&ncolors) || endscan()) + return (-1); + + /* Get the iomap data into a buffer. */ + if (scanok) { + buflen = ncolors * sizeof (unsigned short); + if ((iomap = (unsigned short *) malloc (buflen)) == NULL) + return (-1); + if (gw) { + GtReadIomap (gw, iomap, first, ncolors); + } else + ncolors = 0; + } else + ncolors = 0; + + /* Return the encoded array bracked by ESC and the trailers. + * This is done even if no data is returned, e.g. due to a + * parameter error or read error. + */ + op = obuf; + *op++ = '\033'; + for (i=0, op=obuf; i < ncolors; i++) { + v = iomap[i]; + *op++ = ((v >> 4) & 017) + 040; + *op++ = ((v ) & 017) + 040; + + if (op - obuf > 100) { + v_write (pty_fd, obuf, op-obuf); + op = obuf; + } + } + if (trailer1 >= 0) *op++ = trailer1; + if (trailer2 >= 0) *op++ = trailer2; + v_write (pty_fd, obuf, op-obuf); + + if (scanok) + free (iomap); + } + break; + + case ESC_SETCOLORN: + { /* parameters: CN */ + int color; + if (startscan() || getint(&color) || endscan()) + return (-1); + if (gw && scanok) + GtSetColorIndex (gw, color); + } + break; + + case ESC_SETLINEWIDTHN: + { /* parameters: LW */ + int width; + if (startscan() || getint(&width) || endscan()) + return (-1); + if (gw && scanok) + GtSetLineWidth (gw, width); + } + break; + + case ESC_INITMAPPINGS: + if (gw) + GtInitMappings (gw); + break; + + case ESC_COPYRASTER: + { /* parameters: OP SR ST SX SY SW SH DR DT DX DY DW DH */ + int src, dst, rop; + int st, sx, sy, sw, sh; + int dt, dx, dy, dw, dh; + + if (startscan()) + return (-1); + if (getint(&rop) || getint(&src) || getint(&st)) + return (-1); + if (getint(&sx) || getint(&sy) || getint(&sw) || getint(&sh)) + return (-1); + if (getint(&dst) || getint(&dt)) + return (-1); + if (getint(&dx) || getint(&dy) || getint(&dw) || getint(&dh)) + return (-1); + if (endscan()) + return (-1); + + if (gw && scanok) + GtCopyRaster (gw, rop, + src, st, sx, sy, sw, sh, + dst, dt, dx, dy, dw, dh); + } + break; + + case ESC_SETMAPPING: + { /* parameters: MP OP SR ST SX SY SW SH DR DT DX DY DW DH */ + int mapping, rop, src, st, sx, sy, sw, sh; + int dst, dt, dx, dy, dw, dh; + + if (startscan()) + return (-1); + if (getint(&mapping) || getint(&rop)) + return (-1); + if (getint(&src) || getint(&st)) + return (-1); + if (getint(&sx) || getint(&sy) || getint(&sw) || getint(&sh)) + return (-1); + if (getint(&dst) || getint(&dt)) + return (-1); + if (getint(&dx) || getint(&dy) || getint(&dw) || getint(&dh)) + return (-1); + if (endscan()) + return (-1); + + if (gw && scanok) + GtSetMapping (gw, mapping, rop, + src, st, sx, sy, sw, sh, + dst, dt, dx, dy, dw, dh); + } + break; + + case ESC_GETMAPPING: + { /* parameters: MP (return mapping) */ + int mapping, rop, enable; + int src, st, sx, sy, sw, sh; + int dst, dt, dx, dy, dw, dh; + char obuf[128]; + + if (startscan() || getint(&mapping) || endscan()) + return (-1); + + enable = src=st=sx=sy=sw=sh = dst=dt=dx=dy=dw=dh = 0; + if (gw && scanok) { + enable = GtGetMapping (gw, mapping, &rop, + &src, &st, &sx, &sy, &sw, &sh, + &dst, &dt, &dx, &dy, &dw, &dh); + } + + sprintf (obuf, + "\033[6;%d;%d %d;%d;%d;%d;%d;%d %d;%d;%d;%d;%d;%d]", + enable + 1, rop, + src, st, sx, sy, sw, sh, + dst, dt, dx, dy, dw, dh); + v_write (pty_fd, obuf, strlen(obuf)); + } + break; + + case ESC_ENABLEMAPPING: + { /* parameters: MP FL */ + int mapping, flags; + if (startscan() || getint(&mapping) || + getint(&flags) || endscan()) + return (-1); + if (gw && scanok) + GtEnableMapping (gw, mapping, flags); + } + break; + + case ESC_DISABLEMAPPING: + { /* parameters: MP FL */ + int mapping, flags; + if (startscan() || getint(&mapping) || + getint(&flags) || endscan()) + return (-1); + if (gw && scanok) + GtDisableMapping (gw, mapping, flags); + } + break; + + case ESC_REFRESHMAPPING: + { /* parameters: MP */ + int mapping; + if (startscan() || getint(&mapping) || endscan()) + return (-1); + if (gw && scanok) + GtRefreshMapping (gw, mapping); + } + break; + + case ESC_FREEMAPPING: + { /* parameters: MP */ + int mapping; + if (startscan() || getint(&mapping) || endscan()) + return (-1); + if (gw && scanok) + GtFreeMapping (gw, mapping); + } + break; + + default: + ; + } + + return (COMMAND_MODE); +} + + +/* STARTSCAN -- Reset the scanok flag at the start of a scan. + */ +static int +startscan() +{ + register int ch; + + /* Skip forward to the '[' preceeding the first argument. */ + while (g_getc (ch) >= 0) + if (ch == '[') { + scanok = 1; + return (0); + } + + scanok = 0; + return (1); +} + + +/* GETINT -- Get the next integer token from the input stream. A nonzero + * value is returned if the input is exhausted. The scanok flag is cleared + * if a decode error occurs. + */ +static int +getint (value) +int *value; +{ + register int ch; + register int v; + int neg = 0; + + if (scanok) { + /* Skip to the next integer token. */ + for (;;) { + if (g_getc (ch) < 0) + return (1); + if (isdigit(ch) || ch == '-') + break; + else if (ch == '[' || ch == ' ' || ch == ';') + ; + else if (ch < 040) { + g_ungetc (ch); + scanok = 0; + return (1); + } + } + + /* Accumulate the integer value. */ + if (ch == '-') { + neg++; + g_getc (ch); + } else + neg = 0; + if (isdigit (ch)) { + for (v = ch - '0'; ; ) { + if (g_getc (ch) < 0) + return (1); + if (isdigit(ch)) + v = v * 10 + ch - '0'; + else { + *value = neg ? -v : v; + g_ungetc (ch); + break; + } + } + } + } + + return (0); +} + + +/* GETSTR -- Get the next string token from the input stream. A nonzero + * value is returned if the input is exhausted. The scanok flag is cleared + * if a decode error occurs. + */ +static int +getstr (value) +char *value; +{ + register int ch; + register char *op = value; + + if (scanok) { + /* Skip to the next string token. */ + for (;;) { + if (g_getc (ch) < 0) + return (1); + if (ch && ch != '[' && ch != ' ' && ch != ';') + break; + } + + /* Accumulate the string value. */ + for (*op++ = ch; ; ) { + if (g_getc (ch) < 0) + return (1); + if (!isspace(ch) && ch != ';' && ch != ']') + *op++ = ch; + else { + *op = '\0'; + g_ungetc (ch); + break; + } + } + } + + return (0); +} + + +/* ENDSCAN -- Scan forward to the ']' input argument list delimiter. + */ +static int +endscan() +{ + register int ch; + + /* Skip to the ']' delimiter. */ + for (;;) { + if (g_getc (ch) < 0) + return (1); + if (isdigit(ch) || ch == ' ' | ch == ';') + ; + else if (ch == ']') + break; + else if (ch < 040) { + g_ungetc (ch); + scanok = 0; + break; + } + } + + return (0); +} diff --git a/vendor/x11iraf/xgterm/gtermio.esc b/vendor/x11iraf/xgterm/gtermio.esc new file mode 100644 index 00000000..b33b41c1 --- /dev/null +++ b/vendor/x11iraf/xgterm/gtermio.esc @@ -0,0 +1,122 @@ +/* + * GTERMIO.ESC -- Macros and data defining the escape sequences recognized + * by the graphics terminal. Ambiguous cases are resolved in favor of the + * entry which occurs first in the table. + */ +#define ESC_SETTEXTMODE 1 +#define ESC_ENQUIRE 2 +#define ESC_READCURSOR 3 +#define ESC_WINCURSOR 4 +#define ESC_CLEARSCREEN 5 +#define ESC_SETCURSOR 6 +#define ESC_SETCHARSIZE0 7 +#define ESC_SETCHARSIZE1 8 +#define ESC_SETCHARSIZE2 9 +#define ESC_SETCHARSIZE3 10 +#define ESC_SETDATALEVEL0 11 +#define ESC_SETDATALEVEL1 12 +#define ESC_SETDATALEVEL2 13 +#define ESC_SETLINESTYLE0 14 +#define ESC_SETLINESTYLE1 15 +#define ESC_SETLINESTYLE2 16 +#define ESC_SETLINESTYLE3 17 +#define ESC_SETLINESTYLE4 18 +#define ESC_SETLINEWIDTH0 19 +#define ESC_SETLINEWIDTH1 20 +#define ESC_SETLINEWIDTH2 21 +#define ESC_SETLINEWIDTHN 22 +#define ESC_SETCOLOR0 23 +#define ESC_SETCOLOR1 24 +#define ESC_SETCOLOR2 25 +#define ESC_SETCOLOR3 26 +#define ESC_SETCOLOR4 27 +#define ESC_SETCOLOR5 28 +#define ESC_SETCOLOR6 29 +#define ESC_SETCOLOR7 30 +#define ESC_SETCOLOR8 31 +#define ESC_SETCOLOR9 32 +#define ESC_SETCOLORN 33 +#define ESC_SETRESET 34 +#define ESC_SETRESIZE 35 +#define ESC_RASTERINIT 36 +#define ESC_CREATERASTER 37 +#define ESC_DESTROYRASTER 38 +#define ESC_QUERYRASTER 39 +#define ESC_SETRASTER 40 +#define ESC_WRITEPIXELS 41 +#define ESC_READPIXELS 42 +#define ESC_REFRESHPIXELS 43 +#define ESC_SETPIXELS 44 +#define ESC_COPYRASTER 45 +#define ESC_WRITECMAP 46 +#define ESC_READCMAP 47 +#define ESC_LOADCMAP 48 +#define ESC_FREECMAP 49 +#define ESC_WRITEIOMAP 50 +#define ESC_READIOMAP 51 +#define ESC_INITMAPPINGS 52 +#define ESC_SETMAPPING 53 +#define ESC_GETMAPPING 54 +#define ESC_ENABLEMAPPING 55 +#define ESC_DISABLEMAPPING 56 +#define ESC_REFRESHMAPPING 57 +#define ESC_FREEMAPPING 58 + +ESC_SETTEXTMODE, 015, 000, 000, 000, 000, 000, 0, +ESC_ENQUIRE, ENQ, 000, 000, 000, 000, 000, 0, +ESC_READCURSOR, SUB, 000, 000, 000, 000, 000, 0, +ESC_WINCURSOR, '/', SUB, 000, 000, 000, 000, 0, +ESC_CLEARSCREEN, 014, 000, 000, 000, 000, 000, 0, +ESC_SETCURSOR, '/', 'f', 000, 000, 000, 000, 0, +ESC_SETCHARSIZE0, '0', 000, 000, 000, 000, 000, 0, +ESC_SETCHARSIZE1, '1', 000, 000, 000, 000, 000, 0, +ESC_SETCHARSIZE2, '2', 000, 000, 000, 000, 000, 0, +ESC_SETCHARSIZE3, '3', 000, 000, 000, 000, 000, 0, +ESC_SETDATALEVEL0, '/', '0', 'd', 000, 000, 000, 0, +ESC_SETDATALEVEL1, '/', '1', 'd', 000, 000, 000, 0, +ESC_SETDATALEVEL2, '/', '2', 'd', 000, 000, 000, 0, +ESC_SETLINESTYLE0, '`', 000, 000, 000, 000, 000, 0, +ESC_SETLINESTYLE1, 'a', 000, 000, 000, 000, 000, 0, +ESC_SETLINESTYLE2, 'b', 000, 000, 000, 000, 000, 0, +ESC_SETLINESTYLE3, 'c', 000, 000, 000, 000, 000, 0, +ESC_SETLINESTYLE4, 'd', 000, 000, 000, 000, 000, 0, +ESC_SETLINEWIDTH0, '/', '0', 'w', 000, 000, 000, 0, +ESC_SETLINEWIDTH1, '/', '1', 'w', 000, 000, 000, 0, +ESC_SETLINEWIDTH2, '/', '2', 'w', 000, 000, 000, 0, +ESC_SETLINEWIDTHN, '/', 'n', 'w', 000, 000, 000, 0, +ESC_SETCOLOR0, '/', '0', 'c', 000, 000, 000, 0, +ESC_SETCOLOR1, '/', '1', 'c', 000, 000, 000, 0, +ESC_SETCOLOR2, '/', '2', 'c', 000, 000, 000, 0, +ESC_SETCOLOR3, '/', '3', 'c', 000, 000, 000, 0, +ESC_SETCOLOR4, '/', '4', 'c', 000, 000, 000, 0, +ESC_SETCOLOR5, '/', '5', 'c', 000, 000, 000, 0, +ESC_SETCOLOR6, '/', '6', 'c', 000, 000, 000, 0, +ESC_SETCOLOR7, '/', '7', 'c', 000, 000, 000, 0, +ESC_SETCOLOR8, '/', '8', 'c', 000, 000, 000, 0, +ESC_SETCOLOR9, '/', '9', 'c', 000, 000, 000, 0, +ESC_SETCOLORN, '/', 'n', 'c', 000, 000, 000, 0, +ESC_SETRESET, 's', 'r', 'e', 000, 000, 000, 0, +ESC_SETRESIZE, 's', 's', 'z', 000, 000, 000, 0, +ESC_RASTERINIT, 'r', 'i', 'r', 000, 000, 000, 0, +ESC_CREATERASTER, 'r', 'c', 'r', 000, 000, 000, 0, +ESC_DESTROYRASTER, 'r', 'd', 'e', 000, 000, 000, 0, +ESC_QUERYRASTER, 'r', 'q', 'r', 000, 000, 000, 0, +ESC_SETRASTER, 'r', 's', 'r', 000, 000, 000, 0, +ESC_WRITEPIXELS, 'r', 'w', 'r', 000, 000, 000, 0, +ESC_READPIXELS, 'r', 'r', 'd', 000, 000, 000, 0, +ESC_REFRESHPIXELS, 'r', 'r', 'p', 000, 000, 000, 0, +ESC_SETPIXELS, 'r', 's', 'p', 000, 000, 000, 0, +ESC_COPYRASTER, 'r', 'c', 'o', 000, 000, 000, 0, +ESC_WRITECMAP, 'r', 'w', 'c', 000, 000, 000, 0, +ESC_READCMAP, 'r', 'r', 'c', 000, 000, 000, 0, +ESC_LOADCMAP, 'r', 'l', 'c', 000, 000, 000, 0, +ESC_FREECMAP, 'r', 'f', 'c', 000, 000, 000, 0, +ESC_WRITEIOMAP, 'r', 'w', 'o', 000, 000, 000, 0, +ESC_READIOMAP, 'r', 'r', 'o', 000, 000, 000, 0, +ESC_INITMAPPINGS, 'r', 'i', 'm', 000, 000, 000, 0, +ESC_SETMAPPING, 'r', 's', 'm', 000, 000, 000, 0, +ESC_GETMAPPING, 'r', 'g', 'm', 000, 000, 000, 0, +ESC_ENABLEMAPPING, 'r', 'e', 'm', 000, 000, 000, 0, +ESC_DISABLEMAPPING, 'r', 'd', 'm', 000, 000, 000, 0, +ESC_REFRESHMAPPING, 'r', 'r', 'm', 000, 000, 000, 0, +ESC_FREEMAPPING, 'r', 'f', 'm', 000, 000, 000, 0, diff --git a/vendor/x11iraf/xgterm/gtermio.h b/vendor/x11iraf/xgterm/gtermio.h new file mode 100644 index 00000000..1eafe170 --- /dev/null +++ b/vendor/x11iraf/xgterm/gtermio.h @@ -0,0 +1,8 @@ +/* + * GTERMIO.H -- Public definitions for the gterm i/o protocol module. + */ +struct GT_function { + char *name; /* callback name */ + int (*func)(); /* callback function */ + XtPointer data; /* callback data */ +}; diff --git a/vendor/x11iraf/xgterm/input.c b/vendor/x11iraf/xgterm/input.c new file mode 100644 index 00000000..ef806738 --- /dev/null +++ b/vendor/x11iraf/xgterm/input.c @@ -0,0 +1,295 @@ +/* + * $XConsortium: input.c,v 1.18 94/05/14 15:53:34 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* input.c */ + +#include "ptyx.h" /* gets Xt headers, too */ +#include <X11/keysym.h> +#include <X11/DECkeysym.h> +#include <X11/Xutil.h> +#include <stdio.h> + +/* The following are from X11R6 and allow some R6 code to be used below. */ +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#define XK_KP_Left 0xFF96 +#define XK_KP_Up 0xFF97 +#define XK_KP_Right 0xFF98 +#define XK_KP_Down 0xFF99 +#define XK_KP_Prior 0xFF9A +#define XK_KP_Page_Up 0xFF9A +#define XK_KP_Next 0xFF9B +#define XK_KP_Page_Down 0xFF9B +#define XK_KP_End 0xFF9C +#define XK_KP_Begin 0xFF9D +#define XK_KP_Insert 0xFF9E +#define XK_KP_Delete 0xFF9F +#endif + +static XComposeStatus compose_status = {NULL, 0}; +static char *kypd_num = + " XXXXXXXX\tXXX\rXXXxxxxXXXXXXXXXXXXXXXXXXXXX*+,-./0123456789XXX="; +static char *kypd_apl = + " ABCDEFGHIJKLMNOPQRSTUVWXYZ??????abcdefghijklmnopqrstuvwxyzXXX"; +static char *cur = "DACB"; + +static int funcvalue(), sunfuncvalue(); +extern Boolean sunFunctionKeys; + +static void +AdjustAfterInput (screen) +register TScreen *screen; +{ + if(screen->scrollkey && screen->topline != 0) + WindowScroll(screen, 0); + if(screen->marginbell) { + int col = screen->max_col - screen->nmarginbell; + if(screen->bellarmed >= 0) { + if(screen->bellarmed == screen->cur_row) { + if(screen->cur_col >= col) { + Bell(); + screen->bellarmed = -1; + } + } else + screen->bellarmed = + screen->cur_col < col ? screen->cur_row : -1; + } else if(screen->cur_col < col) + screen->bellarmed = screen->cur_row; + } +} + +Input (keyboard, screen, event, eightbit) + register TKeyboard *keyboard; + register TScreen *screen; + register XKeyEvent *event; + Bool eightbit; +{ + +#ifdef I18N +#define STRBUFSIZE 500 +#else +#define STRBUFSIZE 100 +#endif + + char strbuf[STRBUFSIZE]; + register char *string; + register int key = FALSE; + int pty = screen->respond; + int nbytes; + KeySym keysym = 0; + ANSI reply; +#ifdef I18N + Status status_return; +#endif + +#ifdef I18N + if (screen->xic) + nbytes = XmbLookupString (screen->xic, event, strbuf, STRBUFSIZE, + &keysym, &status_return); + else + nbytes = XLookupString (event, strbuf, STRBUFSIZE, + &keysym, &compose_status); +#else + nbytes = XLookupString (event, strbuf, STRBUFSIZE, + &keysym, &compose_status); +#endif + + string = &strbuf[0]; + reply.a_pintro = 0; + reply.a_final = 0; + reply.a_nparam = 0; + reply.a_inters = 0; + + if (keysym >= XK_KP_Home && keysym <= XK_KP_Begin) { + keysym += XK_Home - XK_KP_Home; + } + + if (IsPFKey(keysym)) { + reply.a_type = SS3; + unparseseq(&reply, pty); + unparseputc((char)(keysym-XK_KP_F1+'P'), pty); + key = TRUE; + } else if (IsCursorKey(keysym) && + keysym != XK_Prior && keysym != XK_Next) { + if (keyboard->flags & CURSOR_APL) { + reply.a_type = SS3; + unparseseq(&reply, pty); + unparseputc(cur[keysym-XK_Left], pty); + } else { + reply.a_type = CSI; + reply.a_final = cur[keysym-XK_Left]; + unparseseq(&reply, pty); + } + key = TRUE; + } else if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym) || + keysym == XK_Prior || keysym == XK_Next || + keysym == DXK_Remove || keysym == XK_KP_Delete || + keysym == XK_KP_Insert) { + reply.a_type = CSI; + reply.a_nparam = 1; + if (sunFunctionKeys) { + reply.a_param[0] = sunfuncvalue (keysym); + reply.a_final = 'z'; + } else { + reply.a_param[0] = funcvalue (keysym); + reply.a_final = '~'; + } + if (reply.a_param[0] > 0) + unparseseq(&reply, pty); + key = TRUE; + } else if (IsKeypadKey(keysym)) { + if (keyboard->flags & KYPD_APL) { + reply.a_type = SS3; + unparseseq(&reply, pty); + unparseputc(kypd_apl[keysym-XK_KP_Space], pty); + } else + unparseputc(kypd_num[keysym-XK_KP_Space], pty); + key = TRUE; + } else if (nbytes > 0) { + if ((nbytes == 1) && eightbit) { + if (screen->input_eight_bits) + *string |= 0x80; /* turn on eighth bit */ + else + unparseputc (033, pty); /* escape */ + } + while (nbytes-- > 0) + unparseputc(*string++, pty); + key = TRUE; + } + if (key) + AdjustAfterInput(screen); + return; +} + +StringInput (screen, string, nbytes) + register TScreen *screen; + register char *string; + int nbytes; +{ + int pty = screen->respond; + + while (nbytes-- > 0) + unparseputc(*string++, pty); + AdjustAfterInput(screen); +} + +static int funcvalue (keycode) + int keycode; +{ + switch (keycode) { + case XK_F1: return(11); + case XK_F2: return(12); + case XK_F3: return(13); + case XK_F4: return(14); + case XK_F5: return(15); + case XK_F6: return(17); + case XK_F7: return(18); + case XK_F8: return(19); + case XK_F9: return(20); + case XK_F10: return(21); + case XK_F11: return(23); + case XK_F12: return(24); + case XK_F13: return(25); + case XK_F14: return(26); + case XK_F15: return(28); + case XK_Help: return(28); + case XK_F16: return(29); + case XK_Menu: return(29); + case XK_F17: return(31); + case XK_F18: return(32); + case XK_F19: return(33); + case XK_F20: return(34); + + case XK_Find : return(1); + case XK_Insert: return(2); + case XK_KP_Insert: return(2); + case XK_Delete: return(3); + case XK_KP_Delete: return(3); + case DXK_Remove: return(3); + case XK_Select: return(4); + case XK_Prior: return(5); + case XK_Next: return(6); + default: return(-1); + } +} + + +static int sunfuncvalue (keycode) + int keycode; + { + switch (keycode) { + case XK_F1: return(224); + case XK_F2: return(225); + case XK_F3: return(226); + case XK_F4: return(227); + case XK_F5: return(228); + case XK_F6: return(229); + case XK_F7: return(230); + case XK_F8: return(231); + case XK_F9: return(232); + case XK_F10: return(233); + case XK_F11: return(192); + case XK_F12: return(193); + case XK_F13: return(194); + case XK_F14: return(195); + case XK_F15: return(196); + case XK_Help: return(196); + case XK_F16: return(197); + case XK_Menu: return(197); + case XK_F17: return(198); + case XK_F18: return(199); + case XK_F19: return(200); + case XK_F20: return(201); + + case XK_R1: return(208); + case XK_R2: return(209); + case XK_R3: return(210); + case XK_R4: return(211); + case XK_R5: return(212); + case XK_R6: return(213); + case XK_R7: return(214); + case XK_R8: return(215); + case XK_R9: return(216); + case XK_R10: return(217); + case XK_R11: return(218); + case XK_R12: return(219); + case XK_R13: return(220); + case XK_R14: return(221); + case XK_R15: return(222); + + case XK_Find : return(1); + case XK_Insert: return(2); + case XK_KP_Insert: return(2); + case XK_Delete: return(3); + case XK_KP_Delete: return(3); + case DXK_Remove: return(3); + case XK_Select: return(4); + case XK_Prior: return(5); + case XK_Next: return(6); + default: return(-1); + } +} diff --git a/vendor/x11iraf/xgterm/login.cl b/vendor/x11iraf/xgterm/login.cl new file mode 100644 index 00000000..44856c5a --- /dev/null +++ b/vendor/x11iraf/xgterm/login.cl @@ -0,0 +1,108 @@ +# LOGIN.CL -- User login file for the IRAF command language. + +# Identify login.cl version (checked in images.cl). +if (defpar ("logver")) + logver = "IRAF V2.14.1 September 2008" + +set home = "/home/fitz/x11iraf-2.0/xgterm/" +set imdir = "/iraf/imdirs/fitz/" +set uparm = "home$uparm/" +set userid = "fitz" + +# Set the terminal type. We assume the user has defined this correctly +# when issuing the MKIRAF and no longer key off the unix TERM to set a +# default. +if (access (".hushiraf") == no) + print "setting terminal type to xgterm..." +stty xgterm + + +# Uncomment and edit to change the defaults. +#set editor = vi +#set printer = lp +#set pspage = "letter" +#set stdimage = imt800 +#set stdimcur = stdimage +#set stdplot = lw +#set clobber = no +#set filewait = yes +#set cmbuflen = 512000 +#set min_lenuserarea = 64000 +#set imtype = "imh" +set imextn = "oif:imh fxf:fits,fit fxb:fxb plf:pl qpf:qp stf:hhh,??h" + + +# XIMTOOL/DISPLAY stuff. Set node to the name of your workstation to +# enable remote image display. The trailing "!" is required. +#set node = "my_workstation!" + +# CL parameters you mighth want to change. +#ehinit = "nostandout eol noverify" +#epinit = "standout showall" +showtype = yes + + +# Load the default CL package. Doing so here allows us to override package +# paths and load personalized packages from our loginuser.cl. +clpackage + + +# Default USER package; extend or modify as you wish. Note that this can +# be used to call FORTRAN programs from IRAF. + +package user + +task $adb $bc $cal $cat $comm $cp $csh $date $dbx $df $diff = "$foreign" +task $du $find $finger $ftp $grep $lpq $lprm $ls $mail $make = "$foreign" +task $man $mon $mv $nm $od $ps $rcp $rlogin $rsh $ruptime = "$foreign" +task $rwho $sh $spell $sps $strings $su $telnet $tip $top = "$foreign" +task $vi $emacs $w $wc $less $rusers $sync $pwd $gdb = "$foreign" + +task $xc $mkpkg $generic $rtar $wtar $buglog = "$foreign" +#task $fc = "$xc -h $* -limfort -lsys -lvops -los" +task $fc = ("$" // envget("iraf") // "unix/hlib/fc.csh" // + " -h $* -limfort -lsys -lvops -los") +task $nbugs = ("$(setenv EDITOR 'buglog -e';" // + "less -Cqm +G " // envget ("iraf") // "local/bugs.*)") +task $cls = "$clear;ls" +task $clw = "$clear;w" +task $pg = ("$(less -Cqm $*)") + +if (access ("home$loginuser.cl")) + cl < "home$loginuser.cl" +; + +keep + + +prcache directory +cache directory page type help + +# Print the message of the day. +if (access (".hushiraf")) + menus = no +else { + clear; type hlib$motd +} + +# Delete any old MTIO lock (magtape position) files. +if (deftask ("mtclean")) + mtclean +else + delete uparm$mt?.lok,uparm$*.wcs verify- + +# List any packages you want loaded at login time, ONE PER LINE. +images # general image operators +plot # graphics tasks +dataio # data conversions, import export +lists # list processing + +# The if(deftask...) is needed for V2.9 compatibility. +if (deftask ("proto")) + proto # prototype or ad hoc tasks + +tv # image display +utilities # miscellaneous utilities +noao # optical astronomy packages + +keep diff --git a/vendor/x11iraf/xgterm/main.c b/vendor/x11iraf/xgterm/main.c new file mode 100644 index 00000000..01937cc7 --- /dev/null +++ b/vendor/x11iraf/xgterm/main.c @@ -0,0 +1,5300 @@ +#ifndef lint +static char *rid="$XConsortium: main.c,v 1.222 94/04/17 20:23:28 gildea Exp $"; +#endif /* lint */ + +/* + * W A R N I N G + * + * If you think you know what all of this code is doing, you are + * probably very mistaken. There be serious and nasty dragons here. + * + * This client is *not* to be taken as an example of how to write X + * Toolkit applications. It is in need of a substantial rewrite, + * ideally to create a generic tty widget with several different parsing + * widgets so that you can plug 'em together any way you want. Don't + * hold your breath, though.... + */ + +/*********************************************************** + + +Copyright (c) 1987, 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be used in +advertising or publicity pertaining to distribution of the software +without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + + +/* main.c */ + +#include "ptyx.h" +#include "data.h" +#include "error.h" +#include "menu.h" +#include <ObmW/Gterm.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#ifdef I18N +#include <X11/Xlocale.h> +#endif + +#define TERMCAP_SIZE 1500 + + +/* choose a nice default value for speed - if we make it too low, users who + * mistakenly use $TERM set to vt100 will get padding delays + */ +#define B38400 /* everyone should define this */ +#ifdef B38400 /* everyone should define this */ +#define VAL_LINE_SPEED B38400 +#else /* ...but xterm's used this for a long time */ +#define VAL_LINE_SPEED B9600 +#endif + + +#include <X11/Xos.h> +#include <X11/cursorfont.h> +#include <X11/Xaw/SimpleMenu.h> +#include <pwd.h> +#include <ctype.h> + +#ifdef USE_TTY_GROUP +#include <grp.h> +#endif + +#if defined(SYSV) && !defined(SVR4) && !defined(ISC22) && !defined(ISC30) +/* older SYSV systems cannot ignore SIGHUP. + Shell hangs, or you get extra shells, or something like that */ +#define USE_SYSV_SIGHUP +#endif + +#ifdef __DARWIN__ +#define NEW_GET_PTY +#define NEW_SPAWN +#define USE_HANDSHAKE +#define USE_USG_PTYS +#define TMODE(ind,var) if (ttymodelist[ind].set) var = ttymodelist[ind].value +#define USE_STRUCT_WINSIZE 1 +#define TTYSIZE_STRUCT struct winsize + +#define TTYSIZE_STRUCT struct winsize +#define SET_TTYSIZE(fd, data) ioctl(fd, TIOCSWINSZ, (char *) &data) +#define TTYSIZE_COLS(data) data.ws_col +#define TTYSIZE_ROWS(data) data.ws_row +/* +*/ +#endif + +/* +#ifdef linux +*/ +#if defined(linux) +#define USE_ANY_SYSV_TERMIO +#define USE_SYSV_TERMIO +#define USE_SYSV_PGRP +#define USE_SYSV_UTMP +#define USE_SYSV_SIGNALS + +#define FEDORA +#define NEW_GET_PTY +#define NEW_SPAWN +#define USE_USG_PTYS +/* +#define USE_STRUCT_WINSIZE +*/ +#define TMODE(ind,var) if (ttymodelist[ind].set) var = ttymodelist[ind].value + +#define USE_STRUCT_WINSIZE 1 +#define TTYSIZE_STRUCT struct winsize + +#define TTYSIZE_STRUCT struct winsize +#define SET_TTYSIZE(fd, data) ioctl(fd, TIOCSWINSZ, (char *) &data) +#define TTYSIZE_COLS(data) data.ws_col +#define TTYSIZE_ROWS(data) data.ws_row + +/* +#ifndef SYSV +#define SYSV +#endif +*/ +#endif /* linux */ + + +#ifdef att +#define ATT +#endif + +#ifdef linux +#define USE_SYSV_UTMP +#define USE_SYSV_PGRP +#define USE_TERMIOS +#define USE_HANDSHAKE +#define HAS_UTMP_UT_HOST +/* +#define HAS_BSD_GROUPS +*/ +#undef TIOCCONS +#define CONSLOG "/proc/kmsg" +#endif + +#ifdef SVR4 +#ifndef SYSV +#define SYSV /* SVR4 is (approx) superset of SVR3 */ +#endif +#define ATT +#define USE_SYSV_UTMP +#define USE_TERMIOS +#define HAS_UTMP_UT_HOST +#endif + +#if defined(sgi) && OSMAJORVERSION >= 5 +#ifndef SVR4 +#define SVR4 /* close enough for xterm */ +#endif +#define USE_SYSV_UTMP +#define USE_TERMIOS +#define HAS_UTMP_UT_HOST +#endif + +#ifdef SYSV386 +#define USE_SYSV_UTMP +#define ATT +#define USE_HANDSHAKE +static Bool IsPts = False; +#endif + +#ifdef ATT +#define USE_USG_PTYS +#else +#define USE_HANDSHAKE +#endif + +#if defined(SYSV) && !defined(SVR4) && !defined(AUX) && !defined(ISC22) && !defined(ISC30) +/* older SYSV systems cannot ignore SIGHUP. + Shell hangs, or you get extra shells, or something like that */ +#define USE_SYSV_SIGHUP +#endif + +/* Some local additions to get things to build. (DCT) */ +#ifdef AUX +#include <utmp.h> +struct utmp *getutid(); +extern char *ttyname(); +void *memmove(a,b,n) void *a; const void *b; size_t n; { bcopy(b,a,n); } +#endif +#if defined(sun) && OSMAJORVERSION < 5 +#undef memmove +void *memmove(a,b,n) void *a, *b; int n; { bcopy(b,a,n); } +#endif + +#if defined(sony) && defined(bsd43) && !defined(KANJI) +#define KANJI +#endif + +#include <sys/ioctl.h> +#include <sys/stat.h> + + +#ifdef USE_TERMIOS +#include <termios.h> +/* this hacked termios support only works on SYSV */ +#define USE_SYSV_TERMIO +#define termio termios +#undef TCGETA +#define TCGETA TCGETS +#undef TCSETA +#define TCSETA TCSETS +#else /* USE_TERMIOS */ +#ifdef SYSV +#include <sys/termio.h> +#ifdef SCO /* broken TIOCSWINSZ ioctl so disable it */ +#undef TIOCSWINSZ +#endif +#endif /* SYSV */ +#endif /* USE_TERMIOS else */ + +#if defined(SVR4) || defined(__linux__) +#undef TIOCSLTC /* defined, but not useable */ +#endif +#define USE_TERMCAP_ENVVARS /* every one uses this except SYSV maybe */ + +#if defined(sgi) && OSMAJORVERSION >= 5 +#undef TIOCLSET /* defined, but not useable */ +#endif + +#ifdef SYSV /* { */ +#ifdef USE_USG_PTYS /* AT&T SYSV has no ptyio.h */ +#include <sys/stream.h> /* get typedef used in ptem.h */ +#include <sys/stropts.h> /* for I_PUSH */ +#ifndef SVR4 +#include <sys/ptem.h> /* get struct winsize */ +#endif +#include <poll.h> /* for POLLIN */ +#endif /* USE_USG_PTYS */ +#ifdef FEDORA +#define USE_USG_PTYS +#endif +#define USE_SYSV_TERMIO +#define USE_SYSV_SIGNALS +#define USE_SYSV_PGRP + +#if !defined(TIOCSWINSZ) +#define USE_SYSV_ENVVARS /* COLUMNS/LINES vs. TERMCAP */ +#endif + +#ifndef SCO +#undef USE_TERMCAP_ENVVARS /* SCO wants both TERMCAP and TERMINFO env */ +#endif +/* + * now get system-specific includes + */ +#ifdef CRAY +#define USE_SYSV_UTMP +#define HAS_UTMP_UT_HOST +#define HAS_BSD_GROUPS +#endif +#ifdef _IBMR2 +#define HAS_UTMP_UT_HOST +#define HAS_BSD_GROUPS +#define USE_SYSV_UTMP +#endif +#ifdef macII +#define USE_SYSV_UTMP +#define HAS_UTMP_UT_HOST +#define HAS_BSD_GROUPS +#include <sys/ttychars.h> +#undef USE_SYSV_ENVVARS +#undef FIOCLEX +#undef FIONCLEX +#define setpgrp2 setpgrp +#include <sgtty.h> +#include <sys/resource.h> +#endif +#if defined(hpux) || defined (__hpux) +#define HAS_BSD_GROUPS +#define USE_SYSV_UTMP +#define HAS_UTMP_UT_HOST +#include <sys/ptyio.h> +#endif /* __hpux */ +#ifdef sgi +#include <sys/sysmacros.h> +#endif /* sgi */ +#ifdef sun +#include <sys/strredir.h> +#endif +#ifdef AIXV3 +#define USE_SYSV_UTMP +#define HAS_UTMP_UT_HOST +#endif +#else /* } !SYSV { */ /* BSD systems */ +#ifndef linux +#include <sgtty.h> +#include <sys/resource.h> +#define HAS_UTMP_UT_HOST +#define HAS_BSD_GROUPS +#ifdef __osf__ +#define USE_SYSV_UTMP +#define setpgrp setpgid +#endif +#endif /* !linux */ +#endif /* } !SYSV */ + +#ifdef _POSIX_SOURCE +#define USE_POSIXSYSV_WAIT +#endif +#ifdef SVR4 +#define USE_POSIX_WAIT +#endif + +#include <stdio.h> +#include <errno.h> +#include <setjmp.h> + +#ifdef X_NOT_STDC_ENV +extern int errno; +#define Time_t long +extern Time_t time (); +#else +#include <time.h> +#define Time_t time_t +#endif + +#if defined(hpux) || defined(__hpux) +#include <sys/utsname.h> +#endif /* __hpux */ + +#if defined(apollo) && OSMAJORVERSION == 10 && OSMINORVERSION < 4 +#define ttyslot() 1 +#endif /* apollo */ + +#ifdef SVR4 +#include <utmpx.h> +#define setutent setutxent +#define getutent getutxent +#define getutid getutxid +#define endutent endutxent +#define pututline pututxline +#else +#include <utmp.h> +#if defined(_CRAY) && OSMAJORVERSION < 8 +extern struct utmp *getutid __((struct utmp *_Id)); +#endif +#endif + +#ifdef LASTLOG +#include <lastlog.h> +#endif +#include <sys/param.h> /* for NOFILE */ + +#ifdef PUCC_PTYD +#include <local/openpty.h> +int Ptyfd; +#endif /* PUCC_PTYD */ + +#ifdef sequent +#define USE_GET_PSEUDOTTY +#endif + +#ifndef UTMP_FILENAME +#ifdef UTMP_FILE +#define UTMP_FILENAME UTMP_FILE +#else +#define UTMP_FILENAME "/etc/utmp" +#endif +#endif + +#ifndef LASTLOG_FILENAME +#ifdef _PATH_LASTLOG +#define LASTLOG_FILENAME _PATH_LASTLOG +#else +#define LASTLOG_FILENAME "/usr/adm/lastlog" /* only on BSD systems */ +#endif +#endif + +#ifndef WTMP_FILENAME +#ifdef WTMP_FILE +#define WTMP_FILENAME WTMP_FILE +#else +#if defined(_PATH_WTMP) /* R6 update */ +#define WTMP_FILENAME _PATH_WTMP +#else +#if defined(SYSV) +#define WTMP_FILENAME "/etc/wtmp" +#else +#define WTMP_FILENAME "/usr/adm/wtmp" +#endif +#endif +#endif +#endif + +#include <signal.h> + +#if defined(SCO) || defined(ISC) +#undef SIGTSTP /* defined, but not the BSD way */ +#endif + +#ifdef SIGTSTP +#include <sys/wait.h> +#if defined(hpux) || defined(__hpux) +#include <sys/bsdtty.h> +#endif +#endif + +#ifdef SIGNALRETURNSINT +#define SIGNAL_T int +#define SIGNAL_RETURN return 0 +#else +#define SIGNAL_T void +#define SIGNAL_RETURN return +#endif + +SIGNAL_T Exit(); + +#ifndef X_NOT_POSIX +#include <unistd.h> +#else +extern long lseek(); +#if defined(USG) || defined(SCO324) +extern unsigned sleep(); +#else +extern void sleep(); +#endif +#endif + +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#else +extern char *malloc(); +extern char *calloc(); +extern char *realloc(); +extern char *getenv(); +extern void exit(); +#endif +#ifdef X_NOT_POSIX +extern char *ttyname(); +#endif + +#ifdef SYSV +extern char *ptsname(); +#endif + +extern char *strindex (); +extern void HandlePopupMenu(); +extern void gtermio_connect(); + +int switchfb[] = {0, 2, 1, 3}; + +static SIGNAL_T reapchild (); + +static Bool added_utmp_entry = False; + +static char **command_to_exec; + +#ifdef USE_SYSV_TERMIO +/* The following structures are initialized in main() in order +** to eliminate any assumptions about the internal order of their +** contents. +*/ +static struct termio d_tio; +#ifdef TIOCSLTC +static struct ltchars d_ltc; +#endif /* TIOCSLTC */ +#ifdef TIOCLSET +static unsigned int d_lmode; +#endif /* TIOCLSET */ +#else /* not USE_SYSV_TERMIO */ +static struct sgttyb d_sg = { + 0, 0, 0177, CKILL, EVENP|ODDP|ECHO|XTABS|CRMOD +}; +static struct tchars d_tc = { + CINTR, CQUIT, CSTART, + CSTOP, CEOF, CBRK, +}; +static struct ltchars d_ltc = { + CSUSP, CDSUSP, CRPRNT, + CFLUSH, CWERASE, CLNEXT +}; +static int d_disipline = NTTYDISC; +static long int d_lmode = LCRTBS|LCRTERA|LCRTKIL|LCTLECH; +#ifdef sony +static long int d_jmode = KM_SYSSJIS|KM_ASCII; +static struct jtchars d_jtc = { + 'J', 'B' +}; +#endif /* sony */ +#endif /* USE_SYSV_TERMIO */ + +static int parse_tty_modes (); +/* + * SYSV has the termio.c_cc[V] and ltchars; BSD has tchars and ltchars; + * SVR4 has only termio.c_cc, but it includes everything from ltchars. + */ +#define TTYMODE(name) { name, sizeof(name)-1, 0, 0 } + +static int override_tty_modes = 0; +struct _xttymodes { + char *name; + int len; + int set; + char value; +} ttymodelist[] = { +{ "intr", 4, 0, '\0' }, /* tchars.t_intrc ; VINTR */ +#define XTTYMODE_intr 0 +{ "quit", 4, 0, '\0' }, /* tchars.t_quitc ; VQUIT */ +#define XTTYMODE_quit 1 +{ "erase", 5, 0, '\0' }, /* sgttyb.sg_erase ; VERASE */ +#define XTTYMODE_erase 2 +{ "kill", 4, 0, '\0' }, /* sgttyb.sg_kill ; VKILL */ +#define XTTYMODE_kill 3 +{ "eof", 3, 0, '\0' }, /* tchars.t_eofc ; VEOF */ +#define XTTYMODE_eof 4 +{ "eol", 3, 0, '\0' }, /* VEOL */ +#define XTTYMODE_eol 5 +{ "swtch", 5, 0, '\0' }, /* VSWTCH */ +#define XTTYMODE_swtch 6 +{ "start", 5, 0, '\0' }, /* tchars.t_startc */ +#define XTTYMODE_start 7 +{ "stop", 4, 0, '\0' }, /* tchars.t_stopc */ +#define XTTYMODE_stop 8 +{ "brk", 3, 0, '\0' }, /* tchars.t_brkc */ +#define XTTYMODE_brk 9 +{ "susp", 4, 0, '\0' }, /* ltchars.t_suspc ; VSUSP */ +#define XTTYMODE_susp 10 +{ "dsusp", 5, 0, '\0' }, /* ltchars.t_dsuspc ; VDSUSP */ +#define XTTYMODE_dsusp 11 +{ "rprnt", 5, 0, '\0' }, /* ltchars.t_rprntc ; VREPRINT */ +#define XTTYMODE_rprnt 12 +{ "flush", 5, 0, '\0' }, /* ltchars.t_flushc ; VDISCARD */ +#define XTTYMODE_flush 13 +{ "weras", 5, 0, '\0' }, /* ltchars.t_werasc ; VWERASE */ +#define XTTYMODE_weras 14 +{ "lnext", 5, 0, '\0' }, /* ltchars.t_lnextc ; VLNEXT */ +#define XTTYMODE_lnext 15 + TTYMODE("status"), /* VSTATUS */ +#define XTTYMODE_status 16 + TTYMODE("erase2"), /* VERASE2 */ +#define XTTYMODE_erase2 17 + TTYMODE("eol2"), /* VEOL2 */ +#define XTTYMODE_eol2 18 +{ NULL, 0, 0, '\0' }, /* end of data */ +}; + +#ifdef USE_SYSV_UTMP +#if defined(X_NOT_STDC_ENV) || defined(AIXV3) +extern struct utmp *getutent(); +extern struct utmp *getutid(); +extern struct utmp *getutline(); +extern void setutent(); +extern void endutent(); +#ifdef AIXV3 +extern struct utmp* pututline(); +extern int utmpname(); +#else +extern void pututline(); +extern void utmpname(); +#endif +#endif /* !SVR4 */ + +/*#ifndef SYSV386 /* could remove paragraph unconditionally? */ +#ifdef X_NOT_STDC_ENV /* could remove paragraph unconditionally? */ +extern struct passwd *getpwent(); +extern struct passwd *getpwuid(); +extern struct passwd *getpwnam(); +extern void setpwent(); +extern void endpwent(); +#endif + +extern struct passwd *fgetpwent(); +#else /* not USE_SYSV_UTMP */ +static char etc_utmp[] = UTMP_FILENAME; +#ifdef LASTLOG +static char etc_lastlog[] = LASTLOG_FILENAME; +#endif +#endif /* USE_SYSV_UTMP */ + +#ifdef WTMP +static char etc_wtmp[] = WTMP_FILENAME; +#endif + +/* + * Some people with 4.3bsd /bin/login seem to like to use login -p -f user + * to implement xgterm -ls. They can turn on USE_LOGIN_DASH_P and turn off + * WTMP and LASTLOG. + */ +#ifdef USE_LOGIN_DASH_P +#ifndef LOGIN_FILENAME +#define LOGIN_FILENAME "/bin/login" +#endif +static char bin_login[] = LOGIN_FILENAME; +#endif + +static int inhibit; +static char passedPty[2]; /* name if pty if slave */ + +#if defined(TIOCCONS) || defined(SRIOCSREDIR) +static int Console; +#include <X11/Xmu/SysUtil.h> /* XmuGetHostname */ +#define MIT_CONSOLE_LEN 12 +#define MIT_CONSOLE "MIT_CONSOLE_" +static char mit_console_name[255 + MIT_CONSOLE_LEN + 1] = MIT_CONSOLE; +static Atom mit_console; +#endif /* TIOCCONS */ + +#ifndef USE_SYSV_UTMP +static int tslot; +#endif /* USE_SYSV_UTMP */ +static jmp_buf env; + +char *ProgramName; +Boolean sunFunctionKeys; + +static struct _resource { + char *xgterm_name; + char *icon_geometry; + char *title; + char *icon_name; + char *term_name; + char *tty_modes; + Boolean utmpInhibit; + Boolean sunFunctionKeys; /* %%% should be widget resource? */ + Boolean wait_for_map; + Boolean useInsertMode; +} resource; + +/* used by VT (charproc.c) */ + +#define offset(field) XtOffsetOf(struct _resource, field) + +static XtResource application_resources[] = { + {"name", "Name", XtRString, sizeof(char *), + offset(xgterm_name), XtRString, "xgterm"}, + {"iconGeometry", "IconGeometry", XtRString, sizeof(char *), + offset(icon_geometry), XtRString, (caddr_t) NULL}, + {XtNtitle, XtCTitle, XtRString, sizeof(char *), + offset(title), XtRString, (caddr_t) NULL}, + {XtNiconName, XtCIconName, XtRString, sizeof(char *), + offset(icon_name), XtRString, (caddr_t) NULL}, + {"termName", "TermName", XtRString, sizeof(char *), + offset(term_name), XtRString, (caddr_t) NULL}, + {"ttyModes", "TtyModes", XtRString, sizeof(char *), + offset(tty_modes), XtRString, (caddr_t) NULL}, + {"utmpInhibit", "UtmpInhibit", XtRBoolean, sizeof (Boolean), + offset(utmpInhibit), XtRString, "false"}, + {"sunFunctionKeys", "SunFunctionKeys", XtRBoolean, sizeof (Boolean), + offset(sunFunctionKeys), XtRString, "false"}, + {"waitForMap", "WaitForMap", XtRBoolean, sizeof (Boolean), + offset(wait_for_map), XtRString, "false"}, + {"useInsertMode", "UseInsertMode", XtRBoolean, sizeof (Boolean), + offset(useInsertMode), XtRString, "false"}, +}; +#undef offset + +static char *fallback_resources[] = { + "XGterm*SimpleMenu*menuLabel.vertSpace: 100", + "XGterm*SimpleMenu*HorizontalMargins: 16", + "XGterm*SimpleMenu*Sme.height: 16", + "XGterm*SimpleMenu*Cursor: left_ptr", + "XGterm*mainMenu.Label: Main Options (no app-defaults)", + "XGterm*vtMenu.Label: VT Options (no app-defaults)", + "XGterm*fontMenu.Label: VT Fonts (no app-defaults)", + NULL +}; + +/* Command line options table. Only resources are entered here...there is a + pass over the remaining options after XrmParseCommand is let loose. */ + +static XrmOptionDescRec optionDescList[] = { +{"-geometry", "*vt100.geometry", XrmoptionSepArg, (caddr_t) NULL}, +{"-132", "*c132", XrmoptionNoArg, (caddr_t) "on"}, +{"+132", "*c132", XrmoptionNoArg, (caddr_t) "off"}, +{"-ah", "*alwaysHighlight", XrmoptionNoArg, (caddr_t) "on"}, +{"+ah", "*alwaysHighlight", XrmoptionNoArg, (caddr_t) "off"}, +{"-aw", "*autoWrap", XrmoptionNoArg, (caddr_t) "on"}, +{"+aw", "*autoWrap", XrmoptionNoArg, (caddr_t) "off"}, +{"-b", "*internalBorder", XrmoptionSepArg, (caddr_t) NULL}, +{"-cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "off"}, +{"+cb", "*cutToBeginningOfLine", XrmoptionNoArg, (caddr_t) "on"}, +{"-cc", "*charClass", XrmoptionSepArg, (caddr_t) NULL}, +{"-cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "off"}, +{"+cn", "*cutNewline", XrmoptionNoArg, (caddr_t) "on"}, +{"-cr", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL}, +{"-cu", "*curses", XrmoptionNoArg, (caddr_t) "on"}, +{"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, +{"-dc", "*dynamicColors", XrmoptionNoArg, (caddr_t) "on"}, +{"+dc", "*dynamicColors", XrmoptionNoArg, (caddr_t) "off"}, +{"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, +{"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, +{"-im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "on"}, +{"+im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "off"}, +{"-j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "on"}, +{"+j", "*jumpScroll", XrmoptionNoArg, (caddr_t) "off"}, +/* parse logging options anyway for compatibility */ +{"-l", "*logging", XrmoptionNoArg, (caddr_t) "on"}, +{"+l", "*logging", XrmoptionNoArg, (caddr_t) "off"}, +{"-lf", "*logFile", XrmoptionSepArg, (caddr_t) NULL}, +{"-ls", "*loginShell", XrmoptionNoArg, (caddr_t) "on"}, +{"+ls", "*loginShell", XrmoptionNoArg, (caddr_t) "off"}, +{"-mb", "*marginBell", XrmoptionNoArg, (caddr_t) "on"}, +{"+mb", "*marginBell", XrmoptionNoArg, (caddr_t) "off"}, +{"-mc", "*multiClickTime", XrmoptionSepArg, (caddr_t) NULL}, +{"-ms", "*pointerColor", XrmoptionSepArg, (caddr_t) NULL}, +{"-nb", "*nMarginBell", XrmoptionSepArg, (caddr_t) NULL}, +{"-rw", "*reverseWrap", XrmoptionNoArg, (caddr_t) "on"}, +{"+rw", "*reverseWrap", XrmoptionNoArg, (caddr_t) "off"}, +{"-s", "*multiScroll", XrmoptionNoArg, (caddr_t) "on"}, +{"+s", "*multiScroll", XrmoptionNoArg, (caddr_t) "off"}, +{"-sb", "*scrollBar", XrmoptionNoArg, (caddr_t) "on"}, +{"+sb", "*scrollBar", XrmoptionNoArg, (caddr_t) "off"}, +{"-sbr", "*scrollBarRight", XrmoptionNoArg, (caddr_t) "on"}, +{"+sbr", "*scrollBarRight", XrmoptionNoArg, (caddr_t) "off"}, +{"-sf", "*sunFunctionKeys", XrmoptionNoArg, (caddr_t) "on"}, +{"+sf", "*sunFunctionKeys", XrmoptionNoArg, (caddr_t) "off"}, +{"-si", "*scrollTtyOutput", XrmoptionNoArg, (caddr_t) "off"}, +{"+si", "*scrollTtyOutput", XrmoptionNoArg, (caddr_t) "on"}, +{"-sk", "*scrollKey", XrmoptionNoArg, (caddr_t) "on"}, +{"+sk", "*scrollKey", XrmoptionNoArg, (caddr_t) "off"}, +{"-sl", "*saveLines", XrmoptionSepArg, (caddr_t) NULL}, +{"-t", "*tekStartup", XrmoptionNoArg, (caddr_t) "on"}, +{"+t", "*tekStartup", XrmoptionNoArg, (caddr_t) "off"}, +{"-tm", "*ttyModes", XrmoptionSepArg, (caddr_t) NULL}, +{"-tn", "*termName", XrmoptionSepArg, (caddr_t) NULL}, +{"-ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "on"}, +{"+ut", "*utmpInhibit", XrmoptionNoArg, (caddr_t) "off"}, +{"-vb", "*visualBell", XrmoptionNoArg, (caddr_t) "on"}, +{"+vb", "*visualBell", XrmoptionNoArg, (caddr_t) "off"}, +{"-wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "on"}, +{"+wf", "*waitForMap", XrmoptionNoArg, (caddr_t) "off"}, +/* bogus old compatibility stuff for which there are + standard XtAppInitialize options now */ +{"-G", "*tekGeometry", XrmoptionSepArg, (caddr_t) NULL}, +{"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, +{"#", ".iconGeometry", XrmoptionStickyArg, (caddr_t) NULL}, +{"-T", "*title", XrmoptionSepArg, (caddr_t) NULL}, +{"-n", "*iconName", XrmoptionSepArg, (caddr_t) NULL}, +{"-r", "*reverseVideo", XrmoptionNoArg, (caddr_t) "on"}, +{"+r", "*reverseVideo", XrmoptionNoArg, (caddr_t) "off"}, +{"-rv", "*reverseVideo", XrmoptionNoArg, (caddr_t) "on"}, +{"+rv", "*reverseVideo", XrmoptionNoArg, (caddr_t) "off"}, +{"-w", ".borderWidth", XrmoptionSepArg, (caddr_t) NULL}, +}; + +static struct _options { + char *opt; + char *desc; +} options[] = { +{ "-help", "print out this message" }, +{ "-display displayname", "X server to contact" }, +{ "-geometry geom", "size (in characters) and position" }, +{ "-G geom", "geometry of toplevel graphics window" }, +{ "-/+rv", "turn on/off reverse video" }, +{ "-bg color", "background color" }, +{ "-fg color", "foreground color" }, +{ "-bd color", "border color" }, +{ "-bw number", "border width in pixels" }, +{ "-fn fontname", "normal text font" }, +{ "-iconic", "start iconic" }, +{ "-name string", "client instance, icon, and title strings" }, +{ "-title string", "title string" }, +{ "-xrm resourcestring", "additional resource specifications" }, +{ "-/+132", "turn on/off column switch inhibiting" }, +{ "-/+ah", "turn on/off always highlight" }, +{ "-b number", "internal border in pixels" }, +{ "-/+cb", "turn on/off cut-to-beginning-of-line inhibit" }, +{ "-cc classrange", "specify additional character classes" }, +{ "-/+cn", "turn on/off cut newline inhibit" }, +{ "-cr color", "text cursor color" }, +{ "-/+cu", "turn on/off curses emulation" }, +{ "-/+dc", "turn off/on dynamic color selection" }, +{ "-/+sbr", "turn off/on rightside scrollbar option" }, +{ "-fb fontname", "bold text font" }, +{ "-/+im", "use insert mode for TERMCAP" }, +{ "-/+j", "turn on/off jump scroll" }, +#ifdef ALLOWLOGGING +{ "-/+l", "turn on/off logging" }, +{ "-lf filename", "logging filename" }, +#else +{ "-/+l", "turn on/off logging (not supported)" }, +{ "-lf filename", "logging filename (not supported)" }, +#endif +{ "-/+ls", "turn on/off login shell" }, +{ "-/+mb", "turn on/off margin bell" }, +{ "-mc milliseconds", "multiclick time in milliseconds" }, +{ "-ms color", "pointer color" }, +{ "-nb number", "margin bell in characters from right end" }, +{ "-/+aw", "turn on/off auto wraparound" }, +{ "-/+rw", "turn on/off reverse wraparound" }, +{ "-/+s", "turn on/off multiscroll" }, +{ "-/+sb", "turn on/off scrollbar" }, +{ "-/+sf", "turn on/off Sun Function Key escape codes" }, +{ "-/+si", "turn on/off scroll-on-tty-output inhibit" }, +{ "-/+sk", "turn on/off scroll-on-keypress" }, +{ "-sl number", "number of scrolled lines to save" }, +{ "-tm string", "terminal mode keywords and characters" }, +{ "-tn name", "TERM environment variable name" }, +#ifdef UTMP +{ "-/+ut", "turn on/off utmp inhibit" }, +#else +{ "-/+ut", "turn on/off utmp inhibit (not supported)" }, +#endif +{ "-/+vb", "turn on/off visual bell" }, +{ "-/+wf", "turn on/off wait for map before command exec" }, +{ "-e command args ...", "command to execute" }, +{ "%geom", "Tek window geometry" }, +{ "#geom", "icon window geometry" }, +{ "-T string", "title name for window" }, +{ "-n string", "icon name for window" }, +#if defined(TIOCCONS) || defined(SRIOCSREDIR) +{ "-C", "intercept console messages" }, +#else +{ "-C", "intercept console messages (not supported)" }, +#endif +{ "-Sxxd", "slave mode on \"ttyxx\", file descriptor \"d\"" }, +{ NULL, NULL }}; + +static char *message[] = { +"Fonts must be fixed width and, if both normal and bold are specified, must", +"have the same size. If only a normal font is specified, it will be used for", +"both normal and bold text (by doing overstriking). The -e option, if given,", +"must be appear at the end of the command line, otherwise the user's default", +"shell will be started. Options that start with a plus sign (+) restore the", +"default.", +NULL}; + + +/* The X11IRAF version. */ +char *xgterm_version[] = { +# include "../version.h" + NULL +}; + + +/* + * If we're linked to terminfo, tgetent() will return an empty buffer. We + * cannot use that to adjust the $TERMCAP variable. + */ +static Boolean +get_termcap(char *name, char *buffer, char *resized) +{ + register TScreen *screen = &term->screen; + + *buffer = 0; /* initialize, in case we're using terminfo's tgetent */ + + if (name != 0) { + if (tgetent(buffer, name) == 1) { + if (*buffer) { + if (!screen->TekEmu) { + resize(screen, buffer, resized); + } + } + return True; + } else { + *buffer = 0; /* just in case */ + } + } + return False; +} + + +static void Syntax (badOption) + char *badOption; +{ + struct _options *opt; + int col; + + fprintf (stderr, "%s: bad command line option \"%s\"\r\n\n", + ProgramName, badOption); + + fprintf (stderr, "usage: %s", ProgramName); + col = 8 + strlen(ProgramName); + for (opt = options; opt->opt; opt++) { + int len = 3 + strlen(opt->opt); /* space [ string ] */ + if (col + len > 79) { + fprintf (stderr, "\r\n "); /* 3 spaces */ + col = 3; + } + fprintf (stderr, " [%s]", opt->opt); + col += len; + } + + fprintf (stderr, "\r\n\nType %s -help for a full description.\r\n\n", + ProgramName); + exit (1); +} + +static void Help () +{ + struct _options *opt; + char **cpp; + + fprintf (stderr, "usage:\n %s [-options ...] [-e command args]\n\n", + ProgramName); + fprintf (stderr, "where options include:\n"); + for (opt = options; opt->opt; opt++) { + fprintf (stderr, " %-28s %s\n", opt->opt, opt->desc); + } + + putc ('\n', stderr); + for (cpp = message; *cpp; cpp++) { + fputs (*cpp, stderr); + putc ('\n', stderr); + } + putc ('\n', stderr); + + exit (0); +} + +#if defined(TIOCCONS) || defined(SRIOCSREDIR) +/* ARGSUSED */ +static Boolean +ConvertConsoleSelection(w, selection, target, type, value, length, format) + Widget w; + Atom *selection, *target, *type; + XtPointer *value; + unsigned long *length; + int *format; +{ + /* we don't save console output, so can't offer it */ + return False; +} +#endif /* TIOCCONS */ + + +extern WidgetClass xgtermWidgetClass; + +Arg ourTopLevelShellArgs[] = { + { XtNallowShellResize, (XtArgVal) TRUE }, + { XtNinput, (XtArgVal) TRUE }, +}; +int number_ourTopLevelShellArgs = 2; + +XtAppContext app_con; +Widget toplevel; +Bool waiting_for_initial_map; + +extern void do_hangup(); +extern void xt_error(); + +/* + * DeleteWindow(): Action proc to implement ICCCM delete_window. + */ +/* ARGSUSED */ +void +DeleteWindow(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + if (w == toplevel) + if (term->screen.Tshow) + hide_vt_window(); + else + do_hangup(w); + else + if (term->screen.Vshow) + hide_tek_window(); + else + do_hangup(w); +} + +/* ARGSUSED */ +void +KeyboardMapping(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + switch (event->type) { + case MappingNotify: + XRefreshKeyboardMapping(&event->xmapping); + break; + } +} + +XtActionsRec actionProcs[] = { + "DeleteWindow", DeleteWindow, + "KeyboardMapping", KeyboardMapping, +}; + +Atom wm_delete_window; + + +main (argc, argv) +int argc; +char **argv; +{ + register TScreen *screen; + register int pty; + int Xsocket, mode; + char *base_name(); + int xerror(), xioerror(); + +#ifdef I18N + setlocale(LC_ALL, NULL); +#endif + + ProgramName = argv[0]; + + ttydev = (char *) malloc (strlen (TTYDEV) + 1); + ptydev = (char *) malloc (strlen (PTYDEV) + 1); + if (!ttydev || !ptydev) { + fprintf (stderr, + "%s: unable to allocate memory for ttydev or ptydev\n", + ProgramName); + exit (1); + } + strcpy (ttydev, TTYDEV); + strcpy (ptydev, PTYDEV); + +#ifdef USE_SYSV_TERMIO + /* Initialization is done here rather than above in order + ** to prevent any assumptions about the order of the contents + ** of the various terminal structures (which may change from + ** implementation to implementation). + */ +#if defined(macII) || defined(ATT) || defined(CRAY) + d_tio.c_iflag = ICRNL|IXON; + d_tio.c_oflag = OPOST|ONLCR|TAB3; + d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL; + d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; + +#ifndef USE_TERMIOS + d_tio.c_line = 0; +#endif + + d_tio.c_cc[VINTR] = CINTR; + d_tio.c_cc[VQUIT] = CQUIT; + d_tio.c_cc[VERASE] = CERASE; + d_tio.c_cc[VKILL] = CKILL; + d_tio.c_cc[VEOF] = CEOF; + d_tio.c_cc[VEOL] = CNUL; + d_tio.c_cc[VEOL2] = CNUL; + d_tio.c_cc[VSWTCH] = CNUL; + +#ifdef USE_TERMIOS + d_tio.c_cc[VSUSP] = CSUSP; +#ifdef VDSUSP /* R6 update */ + d_tio.c_cc[VDSUSP] = CDSUSP; +#endif + d_tio.c_cc[VREPRINT] = CNUL; + d_tio.c_cc[VDISCARD] = CNUL; + d_tio.c_cc[VWERASE] = CNUL; + d_tio.c_cc[VLNEXT] = CNUL; +#endif +#ifdef TIOCSLTC + d_ltc.t_suspc = CSUSP; /* t_suspc */ + d_ltc.t_dsuspc = CDSUSP; /* t_dsuspc */ + d_ltc.t_rprntc = 0; /* reserved...*/ + d_ltc.t_flushc = 0; + d_ltc.t_werasc = 0; + d_ltc.t_lnextc = 0; +#endif /* TIOCSLTC */ +#ifdef TIOCLSET + d_lmode = 0; +#endif /* TIOCLSET */ +#else /* else !macII */ + d_tio.c_iflag = ICRNL|IXON; + d_tio.c_oflag = OPOST|ONLCR|TAB3; +#ifdef BAUD_0 + d_tio.c_cflag = CS8|CREAD|PARENB|HUPCL; +#else /* !BAUD_0 */ + d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL; +#endif /* !BAUD_0 */ + d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; +#ifndef sgi + d_tio.c_line = 0; +#endif +#ifdef linux + d_tio.c_cc[VINTR] = 'C' & 0x3f; + d_tio.c_cc[VQUIT] = '\\' & 0x3f; + d_tio.c_cc[VERASE] = 0x7f; + d_tio.c_cc[VKILL] = 'U' & 0x3f; + d_tio.c_cc[VEOF] = 'D' & 0x3f; + d_tio.c_cc[VEOL] = '@' & 0x3f; +#else + d_tio.c_cc[VINTR] = 0x7f; /* DEL */ + d_tio.c_cc[VQUIT] = '\\' & 0x3f; /* '^\' */ + d_tio.c_cc[VERASE] = '#'; /* '#' */ + d_tio.c_cc[VKILL] = '@'; /* '@' */ + d_tio.c_cc[VEOF] = 'D' & 0x3f; /* '^D' */ + d_tio.c_cc[VEOL] = '@' & 0x3f; /* '^@' */ +#endif +#ifdef VSWTCH + d_tio.c_cc[VSWTCH] = '@' & 0x3f; /* '^@' */ +#endif /* VSWTCH */ + /* now, try to inherit tty settings */ + { + int i; + + for (i = 0; i <= 2; i++) { + struct termio deftio; + if (ioctl (i, TCGETA, &deftio) == 0) { + d_tio.c_cc[VINTR] = deftio.c_cc[VINTR]; + d_tio.c_cc[VQUIT] = deftio.c_cc[VQUIT]; + d_tio.c_cc[VERASE] = deftio.c_cc[VERASE]; + d_tio.c_cc[VKILL] = deftio.c_cc[VKILL]; + d_tio.c_cc[VEOF] = deftio.c_cc[VEOF]; + d_tio.c_cc[VEOL] = deftio.c_cc[VEOL]; +#ifdef VSWTCH + d_tio.c_cc[VSWTCH] = deftio.c_cc[VSWTCH]; +#endif /* VSWTCH */ + break; + } + } + } +#ifdef TIOCSLTC + d_ltc.t_suspc = '\000'; /* t_suspc */ + d_ltc.t_dsuspc = '\000'; /* t_dsuspc */ + d_ltc.t_rprntc = '\377'; /* reserved...*/ + d_ltc.t_flushc = '\377'; + d_ltc.t_werasc = '\377'; + d_ltc.t_lnextc = '\377'; +#endif /* TIOCSLTC */ +#ifdef USE_TERMIOS +#ifdef linux + d_tio.c_cc[VSUSP] = 'Z' & 0x3f; +#else + d_tio.c_cc[VSUSP] = '\000'; +#endif +#ifdef VDSUSP + d_tio.c_cc[VDSUSP] = '\000'; +#endif + d_tio.c_cc[VREPRINT] = '\377'; + d_tio.c_cc[VDISCARD] = '\377'; + d_tio.c_cc[VWERASE] = '\377'; + d_tio.c_cc[VLNEXT] = '\377'; +#endif +#ifdef TIOCLSET + d_lmode = 0; +#endif /* TIOCLSET */ +#endif /* macII */ +#endif /* USE_SYSV_TERMIO */ + + /* Init the Toolkit. */ + { +#ifdef HAS_POSIX_SAVED_IDS + uid_t euid = geteuid(); + gid_t egid = getegid(); + uid_t ruid = getuid(); + gid_t rgid = getgid(); + + if (setegid(ruid) == -1) + (void) fprintf(stderr, "setegid(%d): %s\n", + rgid, strerror(errno)); + + if (seteuid(ruid) == -1) + (void) fprintf(stderr, "seteuid(%d): %s\n", + ruid, strerror(errno)); +#endif + + XtSetErrorHandler(xt_error); + toplevel = XtAppInitialize (&app_con, "XGterm", + optionDescList, XtNumber(optionDescList), + &argc, argv, fallback_resources, NULL, 0); + + XtGetApplicationResources(toplevel, (XtPointer) &resource, + application_resources, + XtNumber(application_resources), NULL, 0); + +#ifdef HAS_POSIX_SAVED_IDS + if (seteuid(euid) == -1) + (void) fprintf(stderr, "seteuid(%d): %s\n", + euid, strerror(errno)); + + if (setegid(egid) == -1) + (void) fprintf(stderr, "setegid(%d): %s\n", + egid, strerror(errno)); +#endif + } + + + waiting_for_initial_map = resource.wait_for_map; + + /* + * ICCCM delete_window. + */ + XtAppAddActions(app_con, actionProcs, XtNumber(actionProcs)); + + /* + * fill in terminal modes + */ + if (resource.tty_modes) { + int n = parse_tty_modes (resource.tty_modes, ttymodelist); + if (n < 0) { + fprintf (stderr, "%s: bad tty modes \"%s\"\n", + ProgramName, resource.tty_modes); + } else if (n > 0) { + override_tty_modes = 1; + } + } + + xgterm_name = resource.xgterm_name; + sunFunctionKeys = resource.sunFunctionKeys; + if (strcmp(xgterm_name, "-") == 0) xgterm_name = "xgterm"; + if (resource.icon_geometry != NULL) { + int scr, junk; + int ix, iy; + Arg args[2]; + + for(scr = 0; /* yyuucchh */ + XtScreen(toplevel) != ScreenOfDisplay(XtDisplay(toplevel),scr); + scr++); + + args[0].name = XtNiconX; + args[1].name = XtNiconY; + XGeometry(XtDisplay(toplevel), scr, resource.icon_geometry, "", + 0, 0, 0, 0, 0, &ix, &iy, &junk, &junk); + args[0].value = (XtArgVal) ix; + args[1].value = (XtArgVal) iy; + XtSetValues( toplevel, args, 2); + } + + XtSetValues (toplevel, ourTopLevelShellArgs, + number_ourTopLevelShellArgs); + + + /* Parse the rest of the command line */ + for (argc--, argv++ ; argc > 0 ; argc--, argv++) { + if(**argv != '-') Syntax (*argv); + + switch(argv[0][1]) { + case 'h': + Help (); + /* NOTREACHED */ + case 'C': +#if defined(TIOCCONS) || defined(SRIOCSREDIR) + { + struct stat sbuf; + + /* Must be owner and have read/write permission. + xdm cooperates to give the console the right user. */ + if ( !stat("/dev/console", &sbuf) && + (sbuf.st_uid == getuid()) && + !access("/dev/console", R_OK|W_OK)) + { + Console = TRUE; + } else + Console = FALSE; + } +#endif /* TIOCCONS */ + continue; + case 'S': + if (sscanf(*argv + 2, "%c%c%d", passedPty, passedPty+1, + &am_slave) != 3) + Syntax(*argv); + continue; +#ifdef DEBUG + case 'D': + debug = TRUE; + continue; +#endif /* DEBUG */ + case 'e': + if (argc <= 1) Syntax (*argv); + command_to_exec = ++argv; + argc = 0; + break; + case 'v': + if (strcmp (*argv, "-version") == 0) { + printf ("Version: %s\n", xgterm_version[0]); + exit (1); + } + break; + default: + Syntax (*argv); + } + break; + } + + XawSimpleMenuAddGlobalActions (app_con); + XtRegisterGrabAction (HandlePopupMenu, True, + (ButtonPressMask|ButtonReleaseMask), + GrabModeAsync, GrabModeAsync); + + /* Create the vt100 terminal emulator widget. */ + term = (XgtermWidget) XtCreateManagedWidget ("vt100", + xgtermWidgetClass, toplevel, NULL, 0); + screen = &term->screen; + + if (screen->savelines < 0) screen->savelines = 0; + + term->flags = 0; + if (!screen->jumpscroll) { + term->flags |= SMOOTHSCROLL; + update_jumpscroll(); + } + if (term->misc.reverseWrap) { + term->flags |= REVERSEWRAP; + update_reversewrap(); + } + if (term->misc.autoWrap) { + term->flags |= WRAPAROUND; + update_autowrap(); + } + if (term->misc.re_verse) { + term->flags |= REVERSE_VIDEO; + update_reversevideo(); + } + + inhibit = 0; +#ifdef ALLOWLOGGING + if (term->misc.logInhibit) inhibit |= I_LOG; +#endif + if (term->misc.signalInhibit) inhibit |= I_SIGNAL; + if (term->misc.tekInhibit) inhibit |= I_TEK; + + term->initflags = term->flags; + + if (term->misc.appcursorDefault) { + term->keyboard.flags |= CURSOR_APL; + update_appcursor(); + } + + if (term->misc.appkeypadDefault) { + term->keyboard.flags |= KYPD_APL; + update_appkeypad(); + } + +/* + * Set title and icon name if not specified + */ + + if (command_to_exec) { + Arg args[2]; + + if (!resource.title) { + if (command_to_exec) { + resource.title = base_name (command_to_exec[0]); + } /* else not reached */ + } + + if (!resource.icon_name) + resource.icon_name = resource.title; + XtSetArg (args[0], XtNtitle, resource.title); + XtSetArg (args[1], XtNiconName, resource.icon_name); + + XtSetValues (toplevel, args, 2); + } + +#ifdef DEBUG + { + /* Set up stderr properly. Opening this log file cannot be + done securely by a privileged xgterm process (although we try), + so the debug feature is disabled by default. */ + int i = -1; + if(debug) { + creat_as (getuid(), getgid(), "xgterm.debug.log", 0666); + i = open ("xgterm.debug.log", O_WRONLY | O_TRUNC, 0666); + } + if(i >= 0) { +#if defined(USE_SYSV_TERMIO) && !defined(SVR4) && !defined(linux) + /* SYSV has another pointer which should be part of the + ** FILE structure but is actually a seperate array. + */ + unsigned char *old_bufend; + + old_bufend = (unsigned char *) _bufend(stderr); +#if defined(hpux) || defined(__hpux) + stderr->__fileH = (i >> 8); + stderr->__fileL = i; +#else + stderr->_file = i; +#endif + _bufend(stderr) = old_bufend; +#else /* USE_SYSV_TERMIO */ +#ifdef linux + setfileno(stderr, i); +#else + stderr->_file = i; +#endif +#endif /* USE_SYSV_TERMIO */ + + /* mark this file as close on exec */ + (void) fcntl(i, F_SETFD, 1); + } + } +#endif /* DEBUG */ + + /* open a terminal for client */ + get_terminal (); + spawn (); + + + /* Child process is out there, let's catch its termination */ +#ifdef USE_POSIX_SIGNALS + (void) posix_signal(SIGCHLD, reapchild); +#else + (void) signal(SIGCHLD, reapchild); +#endif + + + /* Realize procs have now been executed */ + + Xsocket = ConnectionNumber(screen->display); + pty = screen->respond; + init_ttyio (pty); + + /* Connect gtermio to the pty. */ + if (!term->misc.tekInhibit) { + gio_setup (app_con, argc, argv, pty); + gio_postconnectcallback (gtermio_connect, NULL); + } + + /* Start up graphics window? */ + if (inhibit & I_TEK) + screen->TekEmu = FALSE; + if (screen->TekEmu) + hide_vt_window(); + + /* Write window id so master end can read and use */ + if (am_slave >= 0) { + char buf[80]; + + buf[0] = '\0'; + sprintf (buf, "%lx\n", XtWindow (XtParent (term))); + write (pty, buf, strlen (buf)); + } + +#ifdef ALLOWLOGGING + if (term->misc.log_on) { + StartLog(screen); + } +#endif + screen->inhibit = inhibit; + +#ifdef AIXV3 + /* In AIXV3, xterms started from /dev/console have CLOCAL set. + * This means we need to clear CLOCAL so that SIGHUP gets sent + * to the slave-pty process when xterm exits. + */ + + { + struct termio tio; + + if(ioctl(pty, TCGETA, &tio) == -1) + SysError(ERROR_TIOCGETP); + + tio.c_cflag &= ~(CLOCAL); + + if (ioctl (pty, TCSETA, &tio) == -1) + SysError(ERROR_TIOCSETP); + } +#endif +#ifdef USE_SYSV_TERMIO + if (0 > (mode = fcntl(pty, F_GETFL, 0))) + Error(); +#ifdef O_NDELAY + mode |= O_NDELAY; +#else + mode |= O_NONBLOCK; +#endif /* O_NDELAY */ + if (fcntl(pty, F_SETFL, mode)) + Error(); +#else /* USE_SYSV_TERMIO */ + mode = 1; + if (ioctl (pty, FIONBIO, (char *)&mode) == -1) SysError (ERROR_FIONBIO); +#endif /* USE_SYSV_TERMIO */ + + pty_mask = 1 << pty; + X_mask = 1 << Xsocket; + Select_mask = pty_mask | X_mask; + max_plus1 = (pty < Xsocket) ? (1 + Xsocket) : (1 + pty); + +#ifdef DEBUG + if (debug) printf ("debugging on\n"); +#endif /* DEBUG */ + XSetErrorHandler(xerror); + XSetIOErrorHandler(xioerror); + for( ; ; ) + VTRun(); +} + +char *base_name(name) +char *name; +{ + register char *cp; + + cp = strrchr(name, '/'); + return(cp ? cp + 1 : name); +} + + + + +#ifdef NEW_GET_PTY + + +#ifdef __DARWIN__ +#define USE_OPENPTY 1 +static int opened_tty = -1; +#endif + +/* + * This function opens up a pty master and stuffs its value into pty. + * + * If it finds one, it returns a value of 0. If it does not find one, + * it returns a value of !0. This routine is designed to be re-entrant, + * so that if a pty master is found and later, we find that the slave + * has problems, we can re-enter this function and get another one. + */ +static int +get_pty(int *pty, char *from) +{ + int result = 1; + + +#if defined(USE_OPENPTY) + result = openpty(pty, &opened_tty, ttydev, NULL, NULL); + +#elif defined(__OpenBSD__) + static int m_tty = -1; + static int m_pty = -1; + struct group *ttygrp; + + + if (pty == NULL) { + result = openpty(&m_pty, &m_tty, ttydev, NULL, NULL); + + seteuid(0); + if ((ttygrp = getgrnam(TTY_GROUP_NAME)) != 0) { + set_owner(ttydev, getuid(), ttygrp->gr_gid, 0600); + } else { + set_owner(ttydev, getuid(), getgid(), 0600); + } + seteuid(getuid()); + } else if (m_pty != -1) { + *pty = m_pty; + result = 0; + } else { + result = -1; + } +#elif defined(PUCC_PTYD) + + result = ((*pty = openrpty(ttydev, ptydev, + (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), + getuid(), from)) < 0); + +/* +#elif defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS)) || defined(__NetBSD__) + + int tty; + result = openpty(pty, &tty, ttydev, NULL, NULL); +*/ +#elif defined(__QNXNTO__) + + result = pty_search(pty); + +#else +#if defined(USE_ISPTS_FLAG) + + /* + The order of this code is *important*. On SYSV/386 we want to open + a /dev/ttyp? first if at all possible. If none are available, then + we'll try to open a /dev/pts??? device. + + The reason for this is because /dev/ttyp? works correctly, where + as /dev/pts??? devices have a number of bugs, (won't update + screen correcly, will hang -- it more or less works, but you + really don't want to use it). + + Most importantly, for boxes of this nature, one of the major + "features" is that you can emulate a 8086 by spawning off a UNIX + program on 80386/80486 in v86 mode. In other words, you can spawn + off multiple MS-DOS environments. On ISC the program that does + this is named "vpix." The catcher is that "vpix" will *not* work + with a /dev/pts??? device, will only work with a /dev/ttyp? device. + + Since we can open either a /dev/ttyp? or a /dev/pts??? device, + the flag "IsPts" is set here so that we know which type of + device we're dealing with in routine spawn(). That's the reason + for the "if (IsPts)" statement in spawn(); we have two different + device types which need to be handled differently. + */ + result = pty_search(pty); + if (!result) + IsPts = 0; + +#endif +#if defined(USE_USG_PTYS) || defined(__CYGWIN__) || defined(FEDORA) +#ifdef __GLIBC__ /* if __GLIBC__ and USE_USG_PTYS, we know glibc >= 2.1 */ + /* GNU libc 2 allows us to abstract away from having to know the + master pty device name. */ + if ((*pty = getpt()) >= 0) { + char *name = ptsname(*pty); + if (name != 0) { /* if filesystem is trashed, this may be null */ + strcpy(ttydev, name); + result = 0; + } + } +#elif defined(__MVS__) + result = pty_search(pty); +#else +#if defined(USE_ISPTS_FLAG) + if (result) { +#endif + result = ((*pty = open("/dev/ptmx", O_RDWR)) < 0); +#endif +#if defined(SVR4) || defined(__SCO__) || defined(USE_ISPTS_FLAG) + if (!result) + strcpy(ttydev, ptsname(*pty)); +#ifdef USE_ISPTS_FLAG + IsPts = !result; /* true if we're successful */ + } +#endif +#endif + +#elif defined(AIXV3) + + if ((*pty = open("/dev/ptc", O_RDWR)) >= 0) { + strcpy(ttydev, ttyname(*pty)); + result = 0; + } +#elif defined(__convex__) + + char *pty_name; + extern char *getpty(void); + + while ((pty_name = getpty()) != NULL) { + if ((*pty = open(pty_name, O_RDWR)) >= 0) { + strcpy(ptydev, pty_name); + strcpy(ttydev, pty_name); + *x_basename(ttydev) = 't'; + result = 0; + break; + } + } + +#elif defined(sequent) + + result = ((*pty = getpseudotty(&ttydev, &ptydev)) < 0); + +#elif defined(__sgi) && (OSMAJORVERSION >= 4) + + char *tty_name; + + tty_name = _getpty(pty, O_RDWR, 0622, 0); + if (tty_name != 0) { + strcpy(ttydev, tty_name); + result = 0; + } +#elif (defined(__sgi) && (OSMAJORVERSION < 4)) || (defined(umips) && defined (SYSTYPE_SYSV)) + + struct stat fstat_buf; + + *pty = open("/dev/ptc", O_RDWR); + if (*pty >= 0 && (fstat(*pty, &fstat_buf)) >= 0) { + result = 0; + sprintf(ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev)); + } +#elif defined(__hpux) + + /* + * Use the clone device if it works, otherwise use pty_search logic. + */ + if ((*pty = open("/dev/ptym/clone", O_RDWR)) >= 0) { + char *name = ptsname(*pty); + if (name != 0) { + strcpy(ttydev, name); + result = 0; + } else { /* permissions, or other unexpected problem */ + close(*pty); + *pty = -1; + result = pty_search(pty); + } + } else { + result = pty_search(pty); + } + +#else + + result = pty_search(pty); + +#endif +#endif + + return result; +} +#else + + + +/* This function opens up a pty master and stuffs its value into pty. + * If it finds one, it returns a value of 0. If it does not find one, + * it returns a value of !0. This routine is designed to be re-entrant, + * so that if a pty master is found and later, we find that the slave + * has problems, we can re-enter this function and get another one. + */ + +get_pty (pty) + int *pty; +{ +#if defined(SYSV) && defined(SYSV386) + /* + The order of this code is *important*. On SYSV/386 we want to open + a /dev/ttyp? first if at all possible. If none are available, then + we'll try to open a /dev/pts??? device. + + The reason for this is because /dev/ttyp? works correctly, where + as /dev/pts??? devices have a number of bugs, (won't update + screen correcly, will hang -- it more or less works, but you + really don't want to use it). + + Most importantly, for boxes of this nature, one of the major + "features" is that you can emulate a 8086 by spawning off a UNIX + program on 80386/80486 in v86 mode. In other words, you can spawn + off multiple MS-DOS environments. On ISC the program that does + this is named "vpix." The catcher is that "vpix" will *not* work + with a /dev/pts??? device, will only work with a /dev/ttyp? device. + + Since we can open either a /dev/ttyp? or a /dev/pts??? device, + the flag "IsPts" is set here so that we know which type of + device we're dealing with in routine spawn(). That's the reason + for the "if (IsPts)" statement in spawn(); we have two different + device types which need to be handled differently. + */ + if (pty_search(pty) == 0) + return 0; +#endif /* SYSV && SYSV386 */ + +/* Need to move this block of code up a bit on IRIX 6.5 systems to avoid + * a segvio when running out of ptys. + */ +#if defined(sgi) && OSMAJORVERSION >= 6 && OSMINORVERSION >= 5 + { + char *tty_name; + + tty_name = _getpty (pty, O_RDWR, 0622, 0); + if (tty_name == 0) + return 1; + strcpy (ttydev, tty_name); + return 0; + } +#endif +#ifdef ATT + if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0) { + return 1; + } +#if defined(SVR4) || defined(SYSV386) + strcpy(ttydev, ptsname(*pty)); +#if defined (SYSV) && defined(SYSV386) + IsPts = True; +#endif +#endif + return 0; +#else /* ATT else */ +#ifdef AIXV3 + if ((*pty = open ("/dev/ptc", O_RDWR)) < 0) { + return 1; + } + strcpy(ttydev, ttyname(*pty)); + return 0; +#endif + +/* Original code for systems below IRIX 6.5 */ +#if defined(sgi) && OSMAJORVERSION >= 4 && (OSMAJORVERSION <= 6 && OSMINORVERSION < 5) + { + char *tty_name; + + tty_name = _getpty (pty, O_RDWR, 0622, 0); + if (tty_name == 0) + return 1; + strcpy (ttydev, tty_name); + return 0; + } +#endif +#ifdef __convex__ + { + char *pty_name, *getpty(); + + while ((pty_name = getpty()) != NULL) { + if ((*pty = open (pty_name, O_RDWR)) >= 0) { + strcpy(ptydev, pty_name); + strcpy(ttydev, pty_name); + ttydev[5] = 't'; + return 0; + } + } + return 1; + } +#endif /* __convex__ */ +#ifdef USE_GET_PSEUDOTTY + return ((*pty = getpseudotty (&ttydev, &ptydev)) >= 0 ? 0 : 1); +#else +#if (defined(sgi) && OSMAJORVERSION < 4) || (defined(umips) && defined (SYSTYPE_SYSV)) + struct stat fstat_buf; + + *pty = open ("/dev/ptc", O_RDWR); + if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0) { + return(1); + } + sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev)); +#ifndef sgi + sprintf (ptydev, "/dev/ptyq%d", minor(fstat_buf.st_rdev)); + if ((*tty = open (ttydev, O_RDWR)) < 0) { + close (*pty); + return(1); + } +#endif /* !sgi */ + /* got one! */ + return(0); +#else /* sgi or umips */ + + return pty_search(pty); + +#endif /* sgi or umips else */ +#endif /* USE_GET_PSEUDOTTY else */ +#endif /* ATT else */ +} +#endif + + +/* + * Called from get_pty to iterate over likely pseudo terminals + * we might allocate. Used on those systems that do not have + * a functional interface for allocating a pty. + * Returns 0 if found a pty, 1 if fails. + */ +int pty_search(pty) + int *pty; +{ + static int devindex, letter = 0; + +#ifdef CRAY + for (; devindex < 256; devindex++) { + sprintf (ttydev, "/dev/ttyp%03d", devindex); + sprintf (ptydev, "/dev/pty/%03d", devindex); + + if ((*pty = open (ptydev, O_RDWR)) >= 0) { + /* We need to set things up for our next entry + * into this function! + */ + (void) devindex++; + return 0; + } + } +#else /* CRAY */ + while (PTYCHAR1[letter]) { + ttydev [strlen(ttydev) - 2] = ptydev [strlen(ptydev) - 2] = + PTYCHAR1 [letter]; + + while (PTYCHAR2[devindex]) { + ttydev [strlen(ttydev) - 1] = ptydev [strlen(ptydev) - 1] = + PTYCHAR2 [devindex]; + /* for next time around loop or next entry to this function */ + devindex++; + if ((*pty = open (ptydev, O_RDWR)) >= 0) { +#ifdef sun + /* Need to check the process group of the pty. + * If it exists, then the slave pty is in use, + * and we need to get another one. + */ + int pgrp_rtn; + if (ioctl(*pty, TIOCGPGRP, &pgrp_rtn) == 0 || errno != EIO) { + close(*pty); + continue; + } +#endif /* sun */ + return 0; + } + } + devindex = 0; + (void) letter++; + } +#endif /* CRAY else */ + /* + * We were unable to allocate a pty master! Return an error + * condition and let our caller terminate cleanly. + */ + return 1; +} + +get_terminal () +/* + * sets up X and initializes the terminal structure except for term.buf.fildes. + */ +{ + register TScreen *screen = &term->screen; + + screen->arrow = make_colored_cursor (XC_left_ptr, + screen->mousecolor, + screen->mousecolorback); +} + +/* + * The only difference in /etc/termcap between 4014 and 4015 is that + * the latter has support for switching character sets. We support the + * 4015 protocol, but ignore the character switches. Therefore, we + * choose 4014 over 4015. + * + * Features of the 4014 over the 4012: larger (19") screen, 12-bit + * graphics addressing (compatible with 4012 10-bit addressing), + * special point plot mode, incremental plot mode (not implemented in + * later Tektronix terminals), and 4 character sizes. + * All of these are supported by xterm. + */ + +static char *tekterm[] = { + "tek4014", + "tek4015", /* 4014 with APL character set support */ + "tek4012", /* 4010 with lower case */ + "tek4013", /* 4012 with APL character set support */ + "tek4010", /* small screen, upper-case only */ + "dumb", + 0 +}; + +/* The VT102 is a VT100 with the Advanced Video Option included standard. + * It also adds Escape sequences for insert/delete character/line. + * The VT220 adds 8-bit character sets, selective erase. + * The VT320 adds a 25th status line, terminal state interrogation. + * The VT420 has up to 48 lines on the screen. + */ + +static char *vtterm[] = { +#ifdef USE_X11TERM + "x11term", /* for people who want special term name */ +#endif + "xgterm", /* technically correct name */ + "xterm", /* more likely to be found */ + "vt102", + "vt100", + "ansi", + "dumb", + 0 +}; + +/* ARGSUSED */ +SIGNAL_T hungtty(i) + int i; +{ + longjmp(env, 1); + SIGNAL_RETURN; +} + +#ifdef USE_HANDSHAKE +typedef enum { /* c == child, p == parent */ + PTY_BAD, /* c->p: can't open pty slave for some reason */ + PTY_FATALERROR, /* c->p: we had a fatal error with the pty */ + PTY_GOOD, /* c->p: we have a good pty, let's go on */ + PTY_NEW, /* p->c: here is a new pty slave, try this */ + PTY_NOMORE, /* p->c; no more pty's, terminate */ + UTMP_ADDED, /* c->p: utmp entry has been added */ + UTMP_TTYSLOT, /* c->p: here is my ttyslot */ + PTY_EXEC /* p->c: window has been mapped the first time */ +} status_t; + +typedef struct { + status_t status; + int error; + int fatal_error; + int tty_slot; + int rows; + int cols; + char buffer[1024]; +} handshake_t; + +/* HsSysError() + * + * This routine does the equivalent of a SysError but it handshakes + * over the errno and error exit to the master process so that it can + * display our error message and exit with our exit code so that the + * user can see it. + */ + +void +HsSysError(pf, error) +int pf; +int error; +{ + handshake_t handshake; + + handshake.status = PTY_FATALERROR; + handshake.error = errno; + handshake.fatal_error = error; + strcpy(handshake.buffer, ttydev); + write(pf, (char *) &handshake, sizeof(handshake)); + exit(error); +} + +static int pc_pipe[2]; /* this pipe is used for parent to child transfer */ +static int cp_pipe[2]; /* this pipe is used for child to parent transfer */ + +void first_map_occurred () +{ + handshake_t handshake; + register TScreen *screen = &term->screen; + + handshake.status = PTY_EXEC; + handshake.rows = screen->max_row; + handshake.cols = screen->max_col; + write (pc_pipe[1], (char *) &handshake, sizeof(handshake)); + close (cp_pipe[0]); + close (pc_pipe[1]); + waiting_for_initial_map = False; +} +#else +/* + * temporary hack to get xgterm working on att ptys + */ +void first_map_occurred () +{ + return; +} +#define HsSysError(a,b) +#endif /* USE_HANDSHAKE else !USE_HANDSHAKE */ + + +#ifdef NEW_SPAWN + +extern char **environ; + +char * +x_basename(char *name) +{ + char *cp; + + cp = strrchr(name, '/'); +#ifdef __UNIXOS2__ + if (cp == 0) + cp = strrchr(name, '\\'); +#endif + return (cp ? cp + 1 : name); +} + + +static void +set_owner(char *device, int uid, int gid, int mode) +{ + if (chown(device, uid, gid) < 0) { + if (errno != ENOENT + && getuid() == 0) { + fprintf(stderr, "Cannot chown %s to %d,%d: %s\n", + device, uid, gid, strerror(errno)); + } + } + chmod(device, mode); +} + + +/* + * sets the value of var to be arg in the Unix 4.2 BSD environment env. + * Var should end with '=' (bindings are of the form "var=value"). + * This procedure assumes the memory for the first level of environ + * was allocated using calloc, with enough extra room at the end so not + * to have to do a realloc(). + */ +void +xtermSetenv(register char *var, register char *value) +{ + register int envindex = 0; + register size_t len = strlen(var); + + while (environ[envindex] != NULL) { + if (strncmp(environ[envindex], var, len) == 0) { + /* found it */ + environ[envindex] = (char *) malloc((unsigned) len + + strlen(value) + 1); + strcpy(environ[envindex], var); + strcat(environ[envindex], value); + return; + } + envindex++; + } + + environ[envindex] = (char *) malloc((unsigned) len + strlen(value) + 1); + (void) strcpy(environ[envindex], var); + strcat(environ[envindex], value); + environ[++envindex] = NULL; +} + + +/* + * Some platforms use names such as /dev/tty01, others /dev/pts/1. Parse off + * the "tty01" or "pts/1" portion, and return that for use as an identifier for + * utmp. + */ +static char * +my_pty_name(char *device) +{ + size_t len = strlen(device); + Boolean name = False; + + while (len != 0) { + int ch = device[len - 1]; + if (isdigit(ch)) { + len--; + } else if (ch == '/') { + if (name) + break; + len--; + } else if (isalpha(ch)) { + name = True; + len--; + } else { + break; + } + } + return device + len; +} + +/* + * If the name contains a '/', it is a "pts/1" case. Otherwise, return the + * last few characters for a utmp identifier. + */ +static char * +my_pty_id(char *device) +{ + char *name = my_pty_name(device); + char *leaf = x_basename(name); + + if (name == leaf) { /* no '/' in the name */ + int len = strlen(leaf); + if (PTYCHARLEN < len) + leaf = leaf + (len - PTYCHARLEN); + } + return leaf; +} + + +/* + * Set the tty/pty identifier + */ +static void +set_pty_id(char *device, char *id) +{ + char *name = my_pty_name(device); + char *leaf = x_basename(name); + + if (name == leaf) { + strcpy(my_pty_id(device), id); + } else { + strcpy(leaf, id); + } +} + + + + +spawn(void) +/* + * Inits pty and tty and forks a login process. + * Does not close fd Xsocket. + * If slave, the pty named in passedPty is already open for use + */ +{ + register TScreen *screen = &term->screen; +#if OPT_PTY_HANDSHAKE + handshake_t handshake; + int done; +#endif +#if OPT_INITIAL_ERASE + int initial_erase = VAL_INITIAL_ERASE; +#endif + int rc = 0; + int tty = -1; +#ifdef USE_ANY_SYSV_TERMIO + struct termio tio; +#ifdef TIOCLSET + unsigned lmode; +#endif /* TIOCLSET */ +#ifdef HAS_LTCHARS + struct ltchars ltc; +#endif /* HAS_LTCHARS */ +#elif defined(USE_POSIX_TERMIOS) + struct termios tio; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + int ldisc = 0; + int discipline; + unsigned lmode; + struct tchars tc; + struct ltchars ltc; + struct sgttyb sg; +#ifdef sony + int jmode; + struct jtchars jtc; +#endif /* sony */ +#endif /* USE_ANY_SYSV_TERMIO */ + + char termcap[TERMCAP_SIZE]; + char newtc[TERMCAP_SIZE]; + char *ptr, *shname, *shname_minus; + int i, no_dev_tty = FALSE; + char **envnew; /* new environment */ + int envsize; /* elements in new environment */ + char buf[64]; + char *TermName = NULL; +#ifdef TTYSIZE_STRUCT + TTYSIZE_STRUCT ts; +#endif + struct passwd *pw = NULL; + char *login_name = NULL; +#ifndef USE_UTEMPTER +#ifdef HAVE_UTMP + struct UTMP_STR utmp; +#ifdef USE_SYSV_UTMP + struct UTMP_STR *utret = NULL; +#endif +#ifdef USE_LASTLOG + struct lastlog lastlog; +#endif +#ifdef USE_LASTLOGX + struct lastlogx lastlog; +#endif /* USE_LASTLOG */ +#endif /* HAVE_UTMP */ +#endif /* !USE_UTEMPTER */ + char *x_basename(); + + /* Noisy compilers (suppress some unused-variable warnings) */ + (void) rc; +#if defined(HAVE_UTMP) && defined(USE_SYSV_UTMP) && !defined(USE_UTEMPTER) + (void) utret; +#endif + + screen->uid = getuid(); + screen->gid = getgid(); + + termcap[0] = '\0'; + newtc[0] = '\0'; + +#ifdef SIGTTOU + /* so that TIOCSWINSZ || TIOCSIZE doesn't block */ + signal(SIGTTOU, SIG_IGN); +#endif + + if (am_slave >= 0) { + screen->respond = am_slave; + set_pty_id(ttydev, passedPty); +#ifdef USE_PTY_DEVICE + set_pty_id(ptydev, passedPty); +#endif + setgid(screen->gid); + setuid(screen->uid); + } else { + Bool tty_got_hung; + + /* + * Sometimes /dev/tty hangs on open (as in the case of a pty + * that has gone away). Simply make up some reasonable + * defaults. + */ + + signal(SIGALRM, hungtty); + alarm(2); /* alarm(1) might return too soon */ + if (!sigsetjmp(env, 1)) { + tty = open("/dev/tty", O_RDWR); + alarm(0); + tty_got_hung = False; + } else { + tty_got_hung = True; + tty = -1; + errno = ENXIO; + } +#if OPT_INITIAL_ERASE + initial_erase = VAL_INITIAL_ERASE; +#endif + signal(SIGALRM, SIG_DFL); + + /* + * Check results and ignore current control terminal if + * necessary. ENXIO is what is normally returned if there is + * no controlling terminal, but some systems (e.g. SunOS 4.0) + * seem to return EIO. Solaris 2.3 is said to return EINVAL. + * Cygwin returns ENOENT. + */ + no_dev_tty = FALSE; + if (tty < 0) { + if (tty_got_hung || errno == ENXIO || errno == EIO || +#ifdef ENODEV + errno == ENODEV || +#endif +#ifdef __CYGWIN__ + errno == ENOENT || +#endif + errno == EINVAL || errno == ENOTTY || errno == EACCES) { + no_dev_tty = TRUE; +#ifdef HAS_LTCHARS + ltc = d_ltc; +#endif /* HAS_LTCHARS */ +#ifdef TIOCLSET + lmode = d_lmode; +#endif /* TIOCLSET */ +#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) + tio = d_tio; +#else /* not USE_ANY_SYSV_TERMIO and not USE_POSIX_TERMIOS */ + sg = d_sg; + tc = d_tc; + discipline = d_disipline; +#ifdef sony + jmode = d_jmode; + jtc = d_jtc; +#endif /* sony */ +#endif /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ + } else { + SysError(ERROR_OPDEVTTY); + } + } else { + + /* Get a copy of the current terminal's state, + * if we can. Some systems (e.g., SVR4 and MacII) + * may not have a controlling terminal at this point + * if started directly from xdm or xinit, + * in which case we just use the defaults as above. + */ +#ifdef HAS_LTCHARS + if (ioctl(tty, TIOCGLTC, &ltc) == -1) + ltc = d_ltc; +#endif /* HAS_LTCHARS */ +#ifdef TIOCLSET + if (ioctl(tty, TIOCLGET, &lmode) == -1) + lmode = d_lmode; +#endif /* TIOCLSET */ +#ifdef USE_ANY_SYSV_TERMIO + if ((rc = ioctl(tty, TCGETA, &tio)) == -1) + tio = d_tio; +#elif defined(USE_POSIX_TERMIOS) + if ((rc = tcgetattr(tty, &tio)) == -1) + tio = d_tio; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + if ((rc = ioctl(tty, TIOCGETP, (char *) &sg)) == -1) + sg = d_sg; + if (ioctl(tty, TIOCGETC, (char *) &tc) == -1) + tc = d_tc; + if (ioctl(tty, TIOCGETD, (char *) &discipline) == -1) + discipline = d_disipline; +#ifdef sony + if (ioctl(tty, TIOCKGET, (char *) &jmode) == -1) + jmode = d_jmode; + if (ioctl(tty, TIOCKGETC, (char *) &jtc) == -1) + jtc = d_jtc; +#endif /* sony */ +#endif /* USE_ANY_SYSV_TERMIO */ + + /* + * If ptyInitialErase is set, we want to get the pty's + * erase value. Just in case that will fail, first get + * the value from /dev/tty, so we will have something + * at least. + */ +#if OPT_INITIAL_ERASE + if (resource.ptyInitialErase) { +#ifdef USE_ANY_SYSV_TERMIO + initial_erase = tio.c_cc[VERASE]; +#elif defined(USE_POSIX_TERMIOS) + initial_erase = tio.c_cc[VERASE]; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + initial_erase = sg.sg_erase; +#endif /* USE_ANY_SYSV_TERMIO */ + } +#endif + + close(tty); + /* tty is no longer an open fd! */ + tty = -1; + } + +#ifdef NEW_GET_PTY + if (get_pty(&screen->respond, XDisplayString(screen->display))) { + SysError(ERROR_PTYS); + } +#else + if (get_pty(&screen->respond))) { + SysError(ERROR_PTYS); + } +#endif +#if OPT_INITIAL_ERASE + if (resource.ptyInitialErase) { +#ifdef USE_ANY_SYSV_TERMIO + struct termio my_tio; + if ((rc = ioctl(screen->respond, TCGETA, &my_tio)) == 0) + initial_erase = my_tio.c_cc[VERASE]; +#elif defined(USE_POSIX_TERMIOS) + struct termios my_tio; + if ((rc = tcgetattr(screen->respond, &my_tio)) == 0) + initial_erase = my_tio.c_cc[VERASE]; +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + struct sgttyb my_sg; + if ((rc = ioctl(screen->respond, TIOCGETP, (char *) &my_sg)) == 0) + initial_erase = my_sg.sg_erase; +#endif /* USE_ANY_SYSV_TERMIO */ + } +#endif /* OPT_INITIAL_ERASE */ + } + + /* avoid double MapWindow requests + */ + XtSetMappedWhenManaged( XtParent(term), False ); + + wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", + False); + + VTInit(); /* realize now so know window size for tty driver */ +#if defined(TIOCCONS) || defined(SRIOCSREDIR) + if (Console) { + /* + * Inform any running xconsole program + * that we are going to steal the console. + */ + XmuGetHostname(mit_console_name + MIT_CONSOLE_LEN, 255); + mit_console = XInternAtom(screen->display, mit_console_name, False); + /* the user told us to be the console, so we can use CurrentTime */ + XtOwnSelection(XtParent(term), + mit_console, CurrentTime, + ConvertConsoleSelection, NULL, NULL); + + } +#endif + + if (screen->TekEmu) { + envnew = tekterm; + ptr = newtc; + } else { + envnew = vtterm; + ptr = termcap; + } + + /* + * This used to exit if no termcap entry was found for the specified + * terminal name. That's a little unfriendly, so instead we'll allow + * the program to proceed (but not to set $TERMCAP) if the termcap + * entry is not found. + */ + if (!get_termcap(TermName = resource.term_name, ptr, newtc)) { + char *last = NULL; + TermName = *envnew; + while (*envnew != NULL) { + if ((last == NULL || strcmp(last, *envnew)) + && get_termcap(*envnew, ptr, newtc)) { + TermName = *envnew; + break; + } + last = *envnew; + envnew++; + } + } + + /* + * Check if ptyInitialErase is not set. If so, we rely on the termcap + * (or terminfo) to tell us what the erase mode should be set to. + */ +#if OPT_INITIAL_ERASE + if (!resource.ptyInitialErase) { + char temp[1024], *p = temp; + char *s = tgetstr(TERMCAP_ERASE, &p); + if (s != 0) { + initial_erase = decode_keyvalue(&s, True); + } + } + + if (resource.backarrow_is_erase) { /* see input.c */ + if (initial_erase == 127) { + term->keyboard.flags &= ~MODE_DECBKM; + } else { + term->keyboard.flags |= MODE_DECBKM; + term->keyboard.reset_DECBKM = 1; + } + } else { + term->keyboard.reset_DECBKM = 2; + } +#endif /* OPT_INITIAL_ERASE */ + +#ifdef TTYSIZE_STRUCT + /* tell tty how big window is */ + +/* + if (screen->TekEmu) { + TTYSIZE_ROWS(ts) = 38; + TTYSIZE_COLS(ts) = 81; +#if defined(USE_STRUCT_WINSIZE) + ts.ws_xpixel = TFullWidth(screen); + ts.ws_ypixel = TFullHeight(screen); +#endif + } else +*/ + + { + TTYSIZE_ROWS(ts) = screen->max_row + 1; + TTYSIZE_COLS(ts) = screen->max_col + 1; +#if defined(USE_STRUCT_WINSIZE) + ts.ws_xpixel = FullWidth(screen); + ts.ws_ypixel = FullHeight(screen); +#endif + } + i = SET_TTYSIZE(screen->respond, ts); +#endif /* TTYSIZE_STRUCT */ + + added_utmp_entry = False; +#if defined(USE_UTEMPTER) +#undef UTMP + if (!resource.utmpInhibit) { + struct UTMP_STR dummy; + char host[sizeof(dummy.ut_host) + 1], *endptr; + + (void) strncpy(host, DisplayString(screen->display), sizeof host); + host[sizeof(host) - 1] = '\0'; + endptr = strrchr(host, ':'); + if (endptr) { + *endptr = '\0'; + } + addToUtmp(ttydev, host, screen->respond); + added_utmp_entry = True; + } +#endif + + if (am_slave < 0) { +#if OPT_PTY_HANDSHAKE + if (resource.ptyHandshake && (pipe(pc_pipe) || pipe(cp_pipe))) + SysError(ERROR_FORK); +#endif + if ((screen->pid = fork()) == -1) + SysError(ERROR_FORK); + + if (screen->pid == 0) { + /* + * now in child process + */ +#if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__convex__) || defined(__SCO__) || defined(__QNX__) + int pgrp = setsid(); /* variable may not be used... */ +#else + int pgrp = getpid(); +#endif + +#ifdef USE_USG_PTYS +#ifdef USE_ISPTS_FLAG + if (IsPts) { /* SYSV386 supports both, which did we open? */ +#endif + int ptyfd = 0; + char *pty_name = 0; + +#ifdef __DARWIN__ + ; +#else + setpgrp(); +#endif + grantpt(screen->respond); + unlockpt(screen->respond); + if ((pty_name = ptsname(screen->respond)) == 0) { + SysError(ERROR_PTSNAME); + } + if ((ptyfd = open(pty_name, O_RDWR)) < 0) { + SysError(ERROR_OPPTSNAME); + } +#ifdef I_PUSH + if (ioctl(ptyfd, I_PUSH, "ptem") < 0) { + SysError(ERROR_PTEM); + } +#if !defined(SVR4) && !(defined(SYSV) && defined(i386)) + if (!getenv("CONSEM") && ioctl(ptyfd, I_PUSH, "consem") < 0) { + SysError(ERROR_CONSEM); + } +#endif /* !SVR4 */ + if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) { + SysError(ERROR_LDTERM); + } +#ifdef SVR4 /* from Sony */ + if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) { + SysError(ERROR_TTCOMPAT); + } +#endif /* SVR4 */ +#endif /* I_PUSH */ + tty = ptyfd; + close(screen->respond); + +#ifdef TTYSIZE_STRUCT + /* tell tty how big window is */ + + if (screen->TekEmu) { + TTYSIZE_ROWS(ts) = 24; + TTYSIZE_COLS(ts) = 80; +/* +#ifdef USE_STRUCT_WINSIZE + ts.ws_xpixel = TFullWidth(screen); + ts.ws_ypixel = TFullHeight(screen); +#endif +*/ + } else + + { + TTYSIZE_ROWS(ts) = screen->max_row + 1; + TTYSIZE_COLS(ts) = screen->max_col + 1; +/* +#ifdef USE_STRUCT_WINSIZE + ts.ws_xpixel = FullWidth(screen); + ts.ws_ypixel = FullHeight(screen); +#endif +*/ + } +#endif /* TTYSIZE_STRUCT */ + +#ifdef USE_ISPTS_FLAG + } else { /* else pty, not pts */ +#endif +#endif /* USE_USG_PTYS */ + + (void) pgrp; /* not all branches use this variable */ + +#if OPT_PTY_HANDSHAKE /* warning, goes for a long ways */ + if (resource.ptyHandshake) { + /* close parent's sides of the pipes */ + close(cp_pipe[0]); + close(pc_pipe[1]); + + /* Make sure that our sides of the pipes are not in the + * 0, 1, 2 range so that we don't fight with stdin, out + * or err. + */ + if (cp_pipe[1] <= 2) { + if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) { + (void) close(cp_pipe[1]); + cp_pipe[1] = i; + } + } + if (pc_pipe[0] <= 2) { + if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) { + (void) close(pc_pipe[0]); + pc_pipe[0] = i; + } + } + + /* we don't need the socket, or the pty master anymore */ + close(ConnectionNumber(screen->display)); + close(screen->respond); + + /* Now is the time to set up our process group and + * open up the pty slave. + */ +#ifdef USE_SYSV_PGRP +#if defined(CRAY) && (OSMAJORVERSION > 5) + (void) setsid(); +#else + (void) setpgrp(); +#endif +#endif /* USE_SYSV_PGRP */ + +#if defined(__QNX__) && !defined(__QNXNTO__) + qsetlogin(getlogin(), ttydev); +#endif + while (1) { +#if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) + if (!no_dev_tty + && (tty = open("/dev/tty", O_RDWR)) >= 0) { + ioctl(tty, TIOCNOTTY, (char *) NULL); + close(tty); + } +#endif /* TIOCNOTTY && !glibc >= 2.1 */ +#ifdef CSRG_BASED + (void) revoke(ttydev); +#endif + if ((tty = open(ttydev, O_RDWR)) >= 0) { +#if defined(CRAY) && defined(TCSETCTTY) + /* make /dev/tty work */ + ioctl(tty, TCSETCTTY, 0); +#endif +#ifdef USE_SYSV_PGRP + /* We need to make sure that we are actually + * the process group leader for the pty. If + * we are, then we should now be able to open + * /dev/tty. + */ + if ((i = open("/dev/tty", O_RDWR)) >= 0) { + /* success! */ + close(i); + break; + } +#else /* USE_SYSV_PGRP */ + break; +#endif /* USE_SYSV_PGRP */ + } + perror("open ttydev"); +#ifdef TIOCSCTTY + ioctl(tty, TIOCSCTTY, 0); +#endif + /* let our master know that the open failed */ + handshake.status = PTY_BAD; + handshake.error = errno; + strcpy(handshake.buffer, ttydev); + write(cp_pipe[1], (char *) &handshake, + sizeof(handshake)); + + /* get reply from parent */ + i = read(pc_pipe[0], (char *) &handshake, + sizeof(handshake)); + if (i <= 0) { + /* parent terminated */ + exit(1); + } + + if (handshake.status == PTY_NOMORE) { + /* No more ptys, let's shutdown. */ + exit(1); + } + + /* We have a new pty to try */ + free(ttydev); + ttydev = (char *) malloc((unsigned) + (strlen(handshake.buffer) + 1)); + if (ttydev == NULL) { + SysError(ERROR_SPREALLOC); + } + strcpy(ttydev, handshake.buffer); + } + + /* use the same tty name that everyone else will use + * (from ttyname) + */ + if ((ptr = ttyname(tty)) != 0) { + /* it may be bigger */ + ttydev = (char *) realloc(ttydev, + (unsigned) (strlen(ptr) + 1)); + if (ttydev == NULL) { + SysError(ERROR_SPREALLOC); + } + (void) strcpy(ttydev, ptr); + } + } +#endif /* OPT_PTY_HANDSHAKE -- from near fork */ + +#ifdef USE_ISPTS_FLAG + } /* end of IsPts else clause */ +#endif + +#ifdef USE_TTY_GROUP + { + struct group *ttygrp; + if ((ttygrp = getgrnam("tty")) != 0) { + /* change ownership of tty to real uid, "tty" gid */ + set_owner(ttydev, screen->uid, ttygrp->gr_gid, 0620); + } else { + /* change ownership of tty to real group and user id */ + set_owner(ttydev, screen->uid, screen->gid, 0622); + } + endgrent(); + } +#else /* else !USE_TTY_GROUP */ + /* change ownership of tty to real group and user id */ + set_owner(ttydev, screen->uid, screen->gid, 0622); +#endif /* USE_TTY_GROUP */ + + /* + * set up the tty modes + */ + { +#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) +#if defined(umips) || defined(CRAY) || defined(linux) + /* If the control tty had its modes screwed around with, + eg. by lineedit in the shell, or emacs, etc. then tio + will have bad values. Let's just get termio from the + new tty and tailor it. */ + if (ioctl(tty, TCGETA, &tio) == -1) + SysError(ERROR_TIOCGETP); + tio.c_lflag |= ECHOE; +#endif /* umips */ + /* Now is also the time to change the modes of the + * child pty. + */ + /* input: nl->nl, don't ignore cr, cr->nl */ + tio.c_iflag &= ~(INLCR | IGNCR); + tio.c_iflag |= ICRNL; + /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */ +#ifndef USE_POSIX_TERMIOS + tio.c_oflag &= + ~(OCRNL + | ONLRET + | NLDLY + | CRDLY + | TABDLY + | BSDLY + | VTDLY + | FFDLY); +#endif /* USE_POSIX_TERMIOS */ +#ifdef ONLCR + tio.c_oflag |= ONLCR; +#endif /* ONLCR */ +#ifdef OPOST + tio.c_oflag |= OPOST; +#endif /* OPOST */ +#ifndef USE_POSIX_TERMIOS +# if defined(Lynx) && !defined(CBAUD) +# define CBAUD V_CBAUD +# endif + tio.c_cflag &= ~(CBAUD); +#ifdef BAUD_0 + /* baud rate is 0 (don't care) */ +#elif defined(HAVE_TERMIO_C_ISPEED) + tio.c_ispeed = tio.c_ospeed = VAL_LINE_SPEED; +#else /* !BAUD_0 */ + tio.c_cflag |= VAL_LINE_SPEED; +#endif /* !BAUD_0 */ +#else /* USE_POSIX_TERMIOS */ + cfsetispeed(&tio, VAL_LINE_SPEED); + cfsetospeed(&tio, VAL_LINE_SPEED); +#ifdef __MVS__ + /* turn off bits that can't be set from the slave side */ + tio.c_cflag &= ~(PACKET | PKT3270 | PTU3270 | PKTXTND); +#endif /* __MVS__ */ + /* Clear CLOCAL so that SIGHUP is sent to us + when the xterm ends */ + tio.c_cflag &= ~CLOCAL; +#endif /* USE_POSIX_TERMIOS */ + tio.c_cflag &= ~CSIZE; + if (screen->input_eight_bits) + tio.c_cflag |= CS8; + else + tio.c_cflag |= CS7; + /* enable signals, canonical processing (erase, kill, etc), + * echo + */ + tio.c_lflag |= ISIG | ICANON | ECHO | ECHOE | ECHOK; +#ifdef ECHOKE + tio.c_lflag |= ECHOKE | IEXTEN; +#endif +#ifdef ECHOCTL + tio.c_lflag |= ECHOCTL | IEXTEN; +#endif +#ifndef __MVS__ + /* reset EOL to default value */ + tio.c_cc[VEOL] = CEOL; /* '^@' */ + /* certain shells (ksh & csh) change EOF as well */ + tio.c_cc[VEOF] = CEOF; /* '^D' */ +#else + if (tio.c_cc[VEOL] == 0) + tio.c_cc[VEOL] = CEOL; /* '^@' */ + if (tio.c_cc[VEOF] == 0) + tio.c_cc[VEOF] = CEOF; /* '^D' */ +#endif +#ifdef VLNEXT + tio.c_cc[VLNEXT] = CLNEXT; +#endif +#ifdef VWERASE + tio.c_cc[VWERASE] = CWERASE; +#endif +#ifdef VREPRINT + tio.c_cc[VREPRINT] = CRPRNT; +#endif +#ifdef VRPRNT + tio.c_cc[VRPRNT] = CRPRNT; +#endif +#ifdef VDISCARD + tio.c_cc[VDISCARD] = CFLUSH; +#endif +#ifdef VFLUSHO + tio.c_cc[VFLUSHO] = CFLUSH; +#endif +#ifdef VSTOP + tio.c_cc[VSTOP] = CSTOP; +#endif +#ifdef VSTART + tio.c_cc[VSTART] = CSTART; +#endif +#ifdef VSUSP + tio.c_cc[VSUSP] = CSUSP; +#endif +#ifdef VDSUSP + tio.c_cc[VDSUSP] = CDSUSP; +#endif + if (override_tty_modes) { + /* sysv-specific */ + TMODE(XTTYMODE_intr, tio.c_cc[VINTR]); + TMODE(XTTYMODE_quit, tio.c_cc[VQUIT]); + TMODE(XTTYMODE_erase, tio.c_cc[VERASE]); + TMODE(XTTYMODE_kill, tio.c_cc[VKILL]); + TMODE(XTTYMODE_eof, tio.c_cc[VEOF]); + TMODE(XTTYMODE_eol, tio.c_cc[VEOL]); +#ifdef VSWTCH + TMODE(XTTYMODE_swtch, tio.c_cc[VSWTCH]); +#endif +#ifdef VSUSP + TMODE(XTTYMODE_susp, tio.c_cc[VSUSP]); +#endif +#ifdef VDSUSP + TMODE(XTTYMODE_dsusp, tio.c_cc[VDSUSP]); +#endif +#ifdef VREPRINT + TMODE(XTTYMODE_rprnt, tio.c_cc[VREPRINT]); +#endif +#ifdef VRPRNT + TMODE(XTTYMODE_rprnt, tio.c_cc[VRPRNT]); +#endif +#ifdef VDISCARD + TMODE(XTTYMODE_flush, tio.c_cc[VDISCARD]); +#endif +#ifdef VFLUSHO + TMODE(XTTYMODE_flush, tio.c_cc[VFLUSHO]); +#endif +#ifdef VWERASE + TMODE(XTTYMODE_weras, tio.c_cc[VWERASE]); +#endif +#ifdef VLNEXT + TMODE(XTTYMODE_lnext, tio.c_cc[VLNEXT]); +#endif +#ifdef VSTART + TMODE(XTTYMODE_start, tio.c_cc[VSTART]); +#endif +#ifdef VSTOP + TMODE(XTTYMODE_stop, tio.c_cc[VSTOP]); +#endif +#ifdef VSTATUS + TMODE(XTTYMODE_status, tio.c_cc[VSTATUS]); +#endif +#ifdef VERASE2 + TMODE(XTTYMODE_erase2, tio.c_cc[VERASE2]); +#endif +#ifdef VEOL2 + TMODE(XTTYMODE_eol2, tio.c_cc[VEOL2]); +#endif +#ifdef HAS_LTCHARS + /* both SYSV and BSD have ltchars */ + TMODE(XTTYMODE_susp, ltc.t_suspc); + TMODE(XTTYMODE_dsusp, ltc.t_dsuspc); + TMODE(XTTYMODE_rprnt, ltc.t_rprntc); + TMODE(XTTYMODE_flush, ltc.t_flushc); + TMODE(XTTYMODE_weras, ltc.t_werasc); + TMODE(XTTYMODE_lnext, ltc.t_lnextc); +#endif + } +#ifdef HAS_LTCHARS +#ifdef __hpux + /* ioctl chokes when the "reserved" process group controls + * are not set to _POSIX_VDISABLE */ + ltc.t_rprntc = ltc.t_rprntc = ltc.t_flushc = + ltc.t_werasc = ltc.t_lnextc = _POSIX_VDISABLE; +#endif /* __hpux */ + if (ioctl(tty, TIOCSLTC, &ltc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETC); +#endif /* HAS_LTCHARS */ +#ifdef TIOCLSET + if (ioctl(tty, TIOCLSET, (char *) &lmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCLSET); +#endif /* TIOCLSET */ +#ifndef USE_POSIX_TERMIOS + if (ioctl(tty, TCSETA, &tio) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); +#else /* USE_POSIX_TERMIOS */ + if (tcsetattr(tty, TCSANOW, &tio) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); +#endif /* USE_POSIX_TERMIOS */ +#else /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ + sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW); + sg.sg_flags |= (ECHO | CRMOD); + /* make sure speed is set on pty so that editors work right */ +/* + sg.sg_ispeed = VAL_LINE_SPEED; + sg.sg_ospeed = VAL_LINE_SPEED; +*/ + /* reset t_brkc to default value */ + tc.t_brkc = -1; +#ifdef LPASS8 + if (screen->input_eight_bits) + lmode |= LPASS8; + else + lmode &= ~(LPASS8); +#endif +#ifdef sony + jmode &= ~KM_KANJI; +#endif /* sony */ + + ltc = d_ltc; + + if (override_tty_modes) { + TMODE(XTTYMODE_intr, tc.t_intrc); + TMODE(XTTYMODE_quit, tc.t_quitc); + TMODE(XTTYMODE_erase, sg.sg_erase); + TMODE(XTTYMODE_kill, sg.sg_kill); + TMODE(XTTYMODE_eof, tc.t_eofc); + TMODE(XTTYMODE_start, tc.t_startc); + TMODE(XTTYMODE_stop, tc.t_stopc); + TMODE(XTTYMODE_brk, tc.t_brkc); + /* both SYSV and BSD have ltchars */ + TMODE(XTTYMODE_susp, ltc.t_suspc); + TMODE(XTTYMODE_dsusp, ltc.t_dsuspc); + TMODE(XTTYMODE_rprnt, ltc.t_rprntc); + TMODE(XTTYMODE_flush, ltc.t_flushc); + TMODE(XTTYMODE_weras, ltc.t_werasc); + TMODE(XTTYMODE_lnext, ltc.t_lnextc); + } + + if (ioctl(tty, TIOCSETP, (char *) &sg) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); + if (ioctl(tty, TIOCSETC, (char *) &tc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETC); + if (ioctl(tty, TIOCSETD, (char *) &discipline) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETD); + if (ioctl(tty, TIOCSLTC, (char *) &ltc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSLTC); + if (ioctl(tty, TIOCLSET, (char *) &lmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCLSET); +#ifdef sony + if (ioctl(tty, TIOCKSET, (char *) &jmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCKSET); + if (ioctl(tty, TIOCKSETC, (char *) &jtc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCKSETC); +#endif /* sony */ +#endif /* !USE_ANY_SYSV_TERMIO */ +#if defined(TIOCCONS) || defined(SRIOCSREDIR) + if (Console) { +#ifdef TIOCCONS + int on = 1; + if (ioctl(tty, TIOCCONS, (char *) &on) == -1) + fprintf(stderr, "%s: cannot open console: %s\n", + "xgterm", strerror(errno)); +#endif +#ifdef SRIOCSREDIR + int fd = open("/dev/console", O_RDWR); + if (fd == -1 || ioctl(fd, SRIOCSREDIR, tty) == -1) + fprintf(stderr, "%s: cannot open console: %s\n", + "xgterm", strerror(errno)); + (void) close(fd); +#endif + } +#endif /* TIOCCONS */ + } + + signal(SIGCHLD, SIG_DFL); +#ifdef USE_SYSV_SIGHUP + /* watch out for extra shells (I don't understand either) */ + signal(SIGHUP, SIG_DFL); +#else + signal(SIGHUP, SIG_IGN); +#endif + /* restore various signals to their defaults */ + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + + /* + * If we're not asked to make the parent process set the + * terminal's erase mode, and if we had no ttyModes resource, + * then set the terminal's erase mode from our best guess. + */ +#if OPT_INITIAL_ERASE + if (!resource.ptyInitialErase + && !override_tty_modes + && !ttymodelist[XTTYMODE_erase].set) { +#ifdef USE_ANY_SYSV_TERMIO + if (ioctl(tty, TCGETA, &tio) == -1) + tio = d_tio; + tio.c_cc[VERASE] = initial_erase; + rc = ioctl(tty, TCSETA, &tio); +#elif defined(USE_POSIX_TERMIOS) + if (tcgetattr(tty, &tio) == -1) + tio = d_tio; + tio.c_cc[VERASE] = initial_erase; + rc = tcsetattr(tty, TCSANOW, &tio); +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + if (ioctl(tty, TIOCGETP, (char *) &sg) == -1) + sg = d_sg; + sg.sg_erase = initial_erase; + rc = ioctl(tty, TIOCSETP, (char *) &sg); +#endif /* USE_ANY_SYSV_TERMIO */ + } +#endif + + /* copy the environment before Setenving */ + for (i = 0; environ[i] != NULL; i++) ; + /* compute number of xtermSetenv() calls below */ + envsize = 1; /* (NULL terminating entry) */ + envsize += 3; /* TERM, WINDOWID, DISPLAY */ +#ifdef HAVE_UTMP + envsize += 1; /* LOGNAME */ +#endif /* HAVE_UTMP */ +#ifdef USE_SYSV_ENVVARS + envsize += 2; /* COLUMNS, LINES */ +#ifdef HAVE_UTMP + envsize += 2; /* HOME, SHELL */ +#endif /* HAVE_UTMP */ +#ifdef OWN_TERMINFO_DIR + envsize += 1; /* TERMINFO */ +#endif +#else /* USE_SYSV_ENVVARS */ + envsize += 1; /* TERMCAP */ +#endif /* USE_SYSV_ENVVARS */ + envnew = (char **) calloc((unsigned) i + envsize, sizeof(char *)); + memmove((char *) envnew, (char *) environ, i * sizeof(char *)); + environ = envnew; + xtermSetenv("TERM=", TermName); + if (!TermName) + *newtc = 0; + + sprintf(buf, "%lu", + ((unsigned long) XtWindow(XtParent(term)))); + xtermSetenv("WINDOWID=", buf); + + /* put the display into the environment of the shell */ + xtermSetenv("DISPLAY=", XDisplayString(screen->display)); + + signal(SIGTERM, SIG_DFL); + + /* this is the time to go and set up stdin, out, and err + */ + { +#if defined(CRAY) && (OSMAJORVERSION >= 6) + (void) close(tty); + (void) close(0); + + if (open("/dev/tty", O_RDWR)) { + SysError(ERROR_OPDEVTTY); + } + (void) close(1); + (void) close(2); + dup(0); + dup(0); +#else + /* dup the tty */ + for (i = 0; i <= 2; i++) + if (i != tty) { + (void) close(i); + (void) dup(tty); + } +#ifndef ATT + /* and close the tty */ + if (tty > 2) + (void) close(tty); +#endif +#endif /* CRAY */ + } + +#if !defined(USE_SYSV_PGRP) +#ifdef TIOCSCTTY + setsid(); + ioctl(0, TIOCSCTTY, 0); +#endif + ioctl(0, TIOCSPGRP, (char *) &pgrp); + setpgrp(0, 0); + close(open(ttydev, O_WRONLY)); + setpgrp(0, pgrp); +#if defined(__QNX__) + tcsetpgrp(0, pgrp /*setsid() */ ); +#endif +#endif /* !USE_SYSV_PGRP */ + +#ifdef Lynx + { + struct termio t; + if (ioctl(0, TCGETA, &t) >= 0) { + /* this gets lost somewhere on our way... */ + t.c_oflag |= OPOST; + ioctl(0, TCSETA, &t); + } + } +#endif + +#ifdef HAVE_UTMP + pw = getpwuid(screen->uid); + login_name = NULL; + if (pw && pw->pw_name) { +#ifdef HAVE_GETLOGIN + /* + * If the value from getlogin() differs from the value we + * get by looking in the password file, check if it does + * correspond to the same uid. If so, allow that as an + * alias for the uid. + * + * Of course getlogin() will fail if we're started from + * a window-manager, since there's no controlling terminal + * to fuss with. In that case, try to get something useful + * from the user's $LOGNAME or $USER environment variables. + */ + if (((login_name = getlogin()) != NULL + || (login_name = getenv("LOGNAME")) != NULL + || (login_name = getenv("USER")) != NULL) + && strcmp(login_name, pw->pw_name)) { + struct passwd *pw2 = getpwnam(login_name); + if (pw2 != 0 + && pw->pw_uid != pw2->pw_uid) { + login_name = NULL; + } + } +#endif + if (login_name == NULL) + login_name = pw->pw_name; + if (login_name != NULL) + login_name = x_strdup(login_name); + } + if (login_name != NULL) { + xtermSetenv("LOGNAME=", login_name); /* for POSIX */ + } +#ifndef USE_UTEMPTER +#ifdef USE_SYSV_UTMP + /* Set up our utmp entry now. We need to do it here + * for the following reasons: + * - It needs to have our correct process id (for + * login). + * - If our parent was to set it after the fork(), + * it might make it out before we need it. + * - We need to do it before we go and change our + * user and group id's. + */ + (void) setutent(); + /* set up entry to search for */ + bzero((char *) &utmp, sizeof(utmp)); + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); + + utmp.ut_type = DEAD_PROCESS; + + /* position to entry in utmp file */ + /* Test return value: beware of entries left behind: PSz 9 Mar 00 */ + if (!(utret = getutid(&utmp))) { + (void) setutent(); + utmp.ut_type = USER_PROCESS; + if (!(utret = getutid(&utmp))) { + (void) setutent(); + } + } + + /* set up the new entry */ + utmp.ut_type = USER_PROCESS; +#ifdef HAVE_UTMP_UT_XSTATUS + utmp.ut_xstatus = 2; +#endif + (void) strncpy(utmp.ut_user, + (login_name != NULL) ? login_name : "????", + sizeof(utmp.ut_user)); + /* why are we copying this string again? (see above) */ + (void) strncpy(utmp.ut_id, my_utmp_id(ttydev), sizeof(utmp.ut_id)); + (void) strncpy(utmp.ut_line, + my_pty_name(ttydev), sizeof(utmp.ut_line)); + +#ifdef HAVE_UTMP_UT_HOST + (void) strncpy(buf, DisplayString(screen->display), sizeof(buf)); +#ifndef linux + { + char *disfin = strrchr(buf, ':'); + if (disfin) + *disfin = '\0'; + } +#endif + (void) strncpy(utmp.ut_host, buf, sizeof(utmp.ut_host)); +#endif + (void) strncpy(utmp.ut_name, + (login_name) ? login_name : "????", + sizeof(utmp.ut_name)); + + utmp.ut_pid = getpid(); +#if defined(HAVE_UTMP_UT_XTIME) +#if defined(HAVE_UTMP_UT_SESSION) + utmp.ut_session = getsid(0); +#endif + utmp.ut_xtime = time((time_t *) 0); + utmp.ut_tv.tv_usec = 0; +#else + utmp.ut_time = time((time_t *) 0); +#endif + + /* write out the entry */ + if (!resource.utmpInhibit) { + errno = 0; + pututline(&utmp); + } +#ifdef WTMP +#if defined(WTMPX_FILE) && (defined(SVR4) || defined(__SCO__)) + if (term->misc.login_shell) + updwtmpx(WTMPX_FILE, &utmp); +#elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)) + if (term->misc.login_shell) + updwtmp(etc_wtmp, &utmp); +#else + if (term->misc.login_shell && + (i = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + write(i, (char *) &utmp, sizeof(utmp)); + close(i); + } +#endif +#endif + /* close the file */ + (void) endutent(); + +#else /* USE_SYSV_UTMP */ + /* We can now get our ttyslot! We can also set the initial + * utmp entry. + */ + tslot = ttyslot(); + added_utmp_entry = False; + { + if (tslot > 0 && pw && !resource.utmpInhibit && + (i = open(etc_utmp, O_WRONLY)) >= 0) { + bzero((char *) &utmp, sizeof(utmp)); + (void) strncpy(utmp.ut_line, + my_pty_name(ttydev), + sizeof(utmp.ut_line)); + (void) strncpy(utmp.ut_name, login_name, + sizeof(utmp.ut_name)); +#ifdef HAVE_UTMP_UT_HOST + (void) strncpy(utmp.ut_host, + XDisplayString(screen->display), + sizeof(utmp.ut_host)); +#endif + /* cast needed on Ultrix 4.4 */ + time((time_t *) & utmp.ut_time); + lseek(i, (long) (tslot * sizeof(utmp)), 0); + write(i, (char *) &utmp, sizeof(utmp)); + close(i); + added_utmp_entry = True; +#if defined(WTMP) + if (term->misc.login_shell && + (i = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + int status; + status = write(i, (char *) &utmp, sizeof(utmp)); + status = close(i); + } +#elif defined(MNX_LASTLOG) + if (term->misc.login_shell && + (i = open(_U_LASTLOG, O_WRONLY)) >= 0) { + lseek(i, (long) (screen->uid * + sizeof(utmp)), 0); + write(i, (char *) &utmp, sizeof(utmp)); + close(i); + } +#endif /* WTMP or MNX_LASTLOG */ + } else + tslot = -tslot; + } + + /* Let's pass our ttyslot to our parent so that it can + * clean up after us. + */ +#if OPT_PTY_HANDSHAKE + if (resource.ptyHandshake) { + handshake.tty_slot = tslot; + } +#endif /* OPT_PTY_HANDSHAKE */ +#endif /* USE_SYSV_UTMP */ + +#ifdef USE_LASTLOGX + if (term->misc.login_shell) { + bzero((char *) &lastlog, sizeof(lastlog)); + (void) strncpy(lastlog.ll_line, + my_pty_name(ttydev), + sizeof(lastlog.ll_line)); + X_GETTIMEOFDAY(&lastlog.ll_tv); + (void) strncpy(lastlog.ll_host, + XDisplayString(screen->display), + sizeof(lastlog.ll_host)); + updlastlogx(_PATH_LASTLOGX, screen->uid, &lastlog); + } +#endif + +#ifdef USE_LASTLOG + if (term->misc.login_shell && + (i = open(etc_lastlog, O_WRONLY)) >= 0) { + bzero((char *) &lastlog, sizeof(struct lastlog)); + (void) strncpy(lastlog.ll_line, + my_pty_name(ttydev), + sizeof(lastlog.ll_line)); + (void) strncpy(lastlog.ll_host, + XDisplayString(screen->display), + sizeof(lastlog.ll_host)); + time(&lastlog.ll_time); + lseek(i, (long) (screen->uid * sizeof(struct lastlog)), 0); + write(i, (char *) &lastlog, sizeof(struct lastlog)); + close(i); + } +#endif /* USE_LASTLOG */ + +#ifdef __OpenBSD__ + /* Switch to real gid after writing utmp entry */ + utmpGid = getegid(); + if (getgid() != getegid()) { + utmpGid = getegid(); + setegid(getgid()); + } +#endif + +#if OPT_PTY_HANDSHAKE + /* Let our parent know that we set up our utmp entry + * so that it can clean up after us. + */ + if (resource.ptyHandshake) { + handshake.status = UTMP_ADDED; + handshake.error = 0; + strcpy(handshake.buffer, ttydev); + (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); + } +#endif /* OPT_PTY_HANDSHAKE */ +#endif /* USE_UTEMPTER */ +#endif /* HAVE_UTMP */ + + (void) setgid(screen->gid); +#ifdef HAS_BSD_GROUPS + if (geteuid() == 0 && pw) { + if (initgroups(login_name, pw->pw_gid)) { + perror("initgroups failed"); + SysError(ERROR_INIGROUPS); + } + } +#endif + if (setuid(screen->uid)) { + SysError(ERROR_SETUID); + } +#if OPT_PTY_HANDSHAKE + if (resource.ptyHandshake) { + /* mark the pipes as close on exec */ + fcntl(cp_pipe[1], F_SETFD, 1); + fcntl(pc_pipe[0], F_SETFD, 1); + + /* We are at the point where we are going to + * exec our shell (or whatever). Let our parent + * know we arrived safely. + */ + handshake.status = PTY_GOOD; + handshake.error = 0; + (void) strcpy(handshake.buffer, ttydev); + (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake)); + + if (waiting_for_initial_map) { + i = read(pc_pipe[0], (char *) &handshake, + sizeof(handshake)); + if (i != sizeof(handshake) || + handshake.status != PTY_EXEC) { + /* some very bad problem occurred */ + exit(ERROR_PTY_EXEC); + } + if (handshake.rows > 0 && handshake.cols > 0) { + screen->max_row = handshake.rows; + screen->max_col = handshake.cols; +#ifdef TTYSIZE_STRUCT + TTYSIZE_ROWS(ts) = screen->max_row + 1; + TTYSIZE_COLS(ts) = screen->max_col + 1; +#if defined(USE_STRUCT_WINSIZE) + ts.ws_xpixel = FullWidth(screen); + ts.ws_ypixel = FullHeight(screen); +#endif +#endif /* TTYSIZE_STRUCT */ + } + } + } +#endif /* OPT_PTY_HANDSHAKE */ + +#ifdef USE_SYSV_ENVVARS + { + char numbuf[12]; + sprintf(numbuf, "%d", screen->max_col + 1); + xtermSetenv("COLUMNS=", numbuf); + sprintf(numbuf, "%d", screen->max_row + 1); + xtermSetenv("LINES=", numbuf); + } +#ifdef HAVE_UTMP + if (pw) { /* SVR4 doesn't provide these */ + if (!getenv("HOME")) + xtermSetenv("HOME=", pw->pw_dir); + if (!getenv("SHELL")) + xtermSetenv("SHELL=", pw->pw_shell); + } +#endif /* HAVE_UTMP */ +#ifdef OWN_TERMINFO_DIR + xtermSetenv("TERMINFO=", OWN_TERMINFO_DIR); +#endif +#else /* USE_SYSV_ENVVARS */ + if (!screen->TekEmu && *newtc) { + strcpy(termcap, newtc); + resize(screen, termcap, newtc); + } +/* + if (term->misc.titeInhibit && !term->misc.tiXtraScroll) { +*/ + if (term->misc.titeInhibit) { + remove_termcap_entry(newtc, "ti="); + remove_termcap_entry(newtc, "te="); + } + /* + * work around broken termcap entries */ + if (resource.useInsertMode) { + remove_termcap_entry(newtc, "ic="); + /* don't get duplicates */ + remove_termcap_entry(newtc, "im="); + remove_termcap_entry(newtc, "ei="); + remove_termcap_entry(newtc, "mi"); + if (*newtc) + strcat(newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); + } + if (*newtc) { +#if OPT_INITIAL_ERASE + unsigned len; + remove_termcap_entry(newtc, TERMCAP_ERASE "="); + len = strlen(newtc); + if (len != 0 && newtc[len - 1] == ':') + len--; + sprintf(newtc + len, ":%s=\\%03o:", + TERMCAP_ERASE, + initial_erase & 0377); +#endif + xtermSetenv("TERMCAP=", newtc); + } +#endif /* USE_SYSV_ENVVARS */ + + /* need to reset after all the ioctl bashing we did above */ +#if OPT_PTY_HANDSHAKE + if (resource.ptyHandshake) { +#ifdef TTYSIZE_STRUCT + i = SET_TTYSIZE(0, ts); +#endif /* TTYSIZE_STRUCT */ + } +#endif /* OPT_PTY_HANDSHAKE */ + signal(SIGHUP, SIG_DFL); + +#ifdef HAVE_UTMP + if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) || + *(ptr = pw->pw_shell) == 0)) +#else /* HAVE_UTMP */ + if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + ((pw = getpwuid(screen->uid)) == NULL || + *(ptr = pw->pw_shell) == 0)) +#endif /* HAVE_UTMP */ + ptr = "/bin/sh"; + shname = x_basename(ptr); + +#if OPT_LUIT_PROG + /* + * Use two copies of command_to_exec, in case luit is not actually + * there, or refuses to run. In that case we will fall-through to + * to command that the user gave anyway. + */ + if (command_to_exec_with_luit) { + execvp(*command_to_exec_with_luit, command_to_exec_with_luit); + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s: %s\n", + "xgterm", *command_to_exec_with_luit, strerror(errno)); + fprintf(stderr, "%s: cannot support your locale.\n", + "xgterm"); + } +#endif + if (command_to_exec) { + execvp(*command_to_exec, command_to_exec); + if (command_to_exec[1] == 0) + execlp(ptr, shname, "-c", command_to_exec[0], (void *) 0); + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s: %s\n", + "xgterm", *command_to_exec, strerror(errno)); + } +#ifdef USE_SYSV_SIGHUP + /* fix pts sh hanging around + signal(SIGHUP, SIG_DFL); + */ +#endif + + shname_minus = (char *) malloc(strlen(shname) + 2); + (void) strcpy(shname_minus, "-"); + (void) strcat(shname_minus, shname); +#if !defined(USE_ANY_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS) + ldisc = XStrCmp("csh", shname + strlen(shname) - 3) == 0 ? + NTTYDISC : 0; + ioctl(0, TIOCSETD, (char *) &ldisc); +#endif /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ + +#ifdef USE_LOGIN_DASH_P + if (term->misc.login_shell && pw && added_utmp_entry) + execl(bin_login, "login", "-p", "-f", login_name, (void *) 0); +#endif + execlp(ptr, + (term->misc.login_shell ? shname_minus : shname), + (void *) 0); + + /* Exec failed. */ + fprintf(stderr, "%s: Could not exec %s: %s\n", "xgterm", + ptr, strerror(errno)); + (void) sleep(5); + exit(ERROR_EXEC); + } + /* end if in child after fork */ +#if OPT_PTY_HANDSHAKE + if (resource.ptyHandshake) { + /* Parent process. Let's handle handshaked requests to our + * child process. + */ + + /* close childs's sides of the pipes */ + close(cp_pipe[1]); + close(pc_pipe[0]); + + for (done = 0; !done;) { + if (read(cp_pipe[0], + (char *) &handshake, + sizeof(handshake)) <= 0) { + /* Our child is done talking to us. If it terminated + * due to an error, we will catch the death of child + * and clean up. + */ + break; + } + + switch (handshake.status) { + case PTY_GOOD: + /* Success! Let's free up resources and + * continue. + */ + done = 1; + break; + + case PTY_BAD: + /* The open of the pty failed! Let's get + * another one. + */ + (void) close(screen->respond); +#ifdef NEW_GET_PTY + if (get_pty(&screen->respond, XDisplayString(screen->display))) { +#else + if (get_pty(&screen->respond)) { +#endif + /* no more ptys! */ + fprintf(stderr, + "%s: child process can find no available ptys: %s\n", + "xgterm", strerror(errno)); + handshake.status = PTY_NOMORE; + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + exit(ERROR_PTYS); + } + handshake.status = PTY_NEW; + (void) strcpy(handshake.buffer, ttydev); + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + break; + + case PTY_FATALERROR: + errno = handshake.error; + close(cp_pipe[0]); + close(pc_pipe[1]); + SysError(handshake.fatal_error); + /*NOTREACHED */ + + case UTMP_ADDED: + /* The utmp entry was set by our slave. Remember + * this so that we can reset it later. + */ + added_utmp_entry = True; +#ifndef USE_SYSV_UTMP + tslot = handshake.tty_slot; +#endif /* USE_SYSV_UTMP */ + free(ttydev); + ttydev = x_strdup(handshake.buffer); + break; + default: + fprintf(stderr, "%s: unexpected handshake status %d\n", + "xgterm", handshake.status); + } + } + /* close our sides of the pipes */ + if (!waiting_for_initial_map) { + close(cp_pipe[0]); + close(pc_pipe[1]); + } + } +#endif /* OPT_PTY_HANDSHAKE */ + } + + /* end if no slave */ + /* + * still in parent (xterm process) + */ +#ifdef USE_SYSV_SIGHUP + /* hung sh problem? (Fedora) + signal(SIGHUP, SIG_DFL); + */ + signal(SIGHUP, SIG_IGN); +#else + signal(SIGHUP, SIG_IGN); +#endif + +/* + * Unfortunately, System V seems to have trouble divorcing the child process + * from the process group of xterm. This is a problem because hitting the + * INTR or QUIT characters on the keyboard will cause xterm to go away if we + * don't ignore the signals. This is annoying. + */ + +#if defined(USE_SYSV_SIGNALS) && !defined(SIGTSTP) + signal(SIGINT, SIG_IGN); + +#ifndef SYSV + /* hung shell problem */ + signal(SIGQUIT, SIG_IGN); +#endif + signal(SIGTERM, SIG_IGN); +#elif defined(SYSV) || defined(__osf__) + /* if we were spawned by a jobcontrol smart shell (like ksh or csh), + * then our pgrp and pid will be the same. If we were spawned by + * a jobcontrol dumb shell (like /bin/sh), then we will be in our + * parent's pgrp, and we must ignore keyboard signals, or we will + * tank on everything. + */ + if (getpid() == getpgrp()) { + (void) signal(SIGINT, Exit); + (void) signal(SIGQUIT, Exit); + (void) signal(SIGTERM, Exit); + } else { + (void) signal(SIGINT, SIG_IGN); + (void) signal(SIGQUIT, SIG_IGN); + (void) signal(SIGTERM, SIG_IGN); + } + (void) signal(SIGPIPE, Exit); +#else /* SYSV */ + signal(SIGINT, Exit); + signal(SIGQUIT, Exit); + signal(SIGTERM, Exit); + signal(SIGPIPE, Exit); +#endif /* USE_SYSV_SIGNALS and not SIGTSTP */ + + return 0; +} /* end spawn */ + +#else + + +spawn () +/* + * Inits pty and tty and forks a login process. + * Does not close fd Xsocket. + * If slave, the pty named in passedPty is already open for use + */ +{ + extern char *SysErrorMsg(); + register TScreen *screen = &term->screen; + int Xsocket = ConnectionNumber(screen->display); +#ifdef USE_HANDSHAKE + handshake_t handshake; +#else + int fds[2]; +#endif + int tty = -1; + int discipline; + int done; +#ifdef USE_SYSV_TERMIO + struct termio tio; + struct termio dummy_tio; +#ifdef TIOCLSET + unsigned lmode; +#endif /* TIOCLSET */ +#ifdef TIOCSLTC + struct ltchars ltc; +#endif /* TIOCSLTC */ + int one = 1; + int zero = 0; + int status; +#else /* else not USE_SYSV_TERMIO */ + unsigned lmode; + struct tchars tc; + struct ltchars ltc; + struct sgttyb sg; +#ifdef sony + int jmode; + struct jtchars jtc; +#endif /* sony */ +#endif /* USE_SYSV_TERMIO */ + + char termcap [1024]; + char newtc [1024]; + char *ptr, *shname, *shname_minus; + int i, no_dev_tty = FALSE; +#ifdef USE_SYSV_TERMIO + char *dev_tty_name = (char *) 0; + int fd; /* for /etc/wtmp */ +#endif /* USE_SYSV_TERMIO */ + char **envnew; /* new environment */ + int envsize; /* elements in new environment */ + char buf[64]; + char *TermName = NULL; + int ldisc = 0; +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + struct ttysize ts; +#endif /* TIOCSSIZE */ +#else /* not sun */ +#ifdef TIOCSWINSZ + struct winsize ws; +#endif /* TIOCSWINSZ */ +#endif /* sun */ + struct passwd *pw = NULL; +#ifdef UTMP +#ifdef SVR4 + struct utmpx utmp; +#else + struct utmp utmp; +#endif +#ifdef LASTLOG + struct lastlog lastlog; +#endif /* LASTLOG */ +#endif /* UTMP */ + + screen->uid = getuid(); + screen->gid = getgid(); + +#ifdef linux + memset(termcap, 0, sizeof(termcap)); + memset(newtc, 0, sizeof(newtc)); +#endif + +#ifdef SIGTTOU + /* so that TIOCSWINSZ || TIOCSIZE doesn't block */ + signal(SIGTTOU,SIG_IGN); +#endif + + if (am_slave) { + screen->respond = am_slave; + ptydev[strlen(ptydev) - 2] = ttydev[strlen(ttydev) - 2] = + passedPty[0]; + ptydev[strlen(ptydev) - 1] = ttydev[strlen(ttydev) - 1] = + passedPty[1]; + + setgid (screen->gid); + setuid (screen->uid); + } else { + Bool tty_got_hung = False; + + /* + * Sometimes /dev/tty hangs on open (as in the case of a pty + * that has gone away). Simply make up some reasonable + * defaults. + */ + signal(SIGALRM, hungtty); + alarm(2); /* alarm(1) might return too soon */ + if (! setjmp(env)) { + tty = open ("/dev/tty", O_RDWR, 0); + alarm(0); + } else { + tty_got_hung = True; + tty = -1; + errno = ENXIO; + } + signal(SIGALRM, SIG_DFL); + + /* + * Check results and ignore current control terminal if + * necessary. ENXIO is what is normally returned if there is + * no controlling terminal, but some systems (e.g. SunOS 4.0) + * seem to return EIO. + */ + if (tty < 0) { + if (tty_got_hung || errno == ENXIO || errno == EIO || + errno == ENOTTY) { + no_dev_tty = TRUE; +#ifdef TIOCSLTC + ltc = d_ltc; +#endif /* TIOCSLTC */ +#ifdef TIOCLSET + lmode = d_lmode; +#endif /* TIOCLSET */ +#ifdef USE_SYSV_TERMIO + tio = d_tio; +#else /* not USE_SYSV_TERMIO */ + sg = d_sg; + tc = d_tc; + discipline = d_disipline; +#ifdef sony + jmode = d_jmode; + jtc = d_jtc; +#endif /* sony */ +#endif /* USE_SYSV_TERMIO */ + } else { + SysError(ERROR_OPDEVTTY); + } + } else { + /* Get a copy of the current terminal's state, + * if we can. Some systems (e.g., SVR4 and MacII) + * may not have a controlling terminal at this point + * if started directly from xdm or xinit, + * in which case we just use the defaults as above. + */ +#ifdef TIOCSLTC + if(ioctl(tty, TIOCGLTC, &ltc) == -1) + ltc = d_ltc; +#endif /* TIOCSLTC */ +#ifdef TIOCLSET + if(ioctl(tty, TIOCLGET, &lmode) == -1) + lmode = d_lmode; +#endif /* TIOCLSET */ +#ifdef USE_SYSV_TERMIO + if(ioctl(tty, TCGETA, &tio) == -1) + tio = d_tio; + +#else /* not USE_SYSV_TERMIO */ + if(ioctl(tty, TIOCGETP, (char *)&sg) == -1) + sg = d_sg; + if(ioctl(tty, TIOCGETC, (char *)&tc) == -1) + tc = d_tc; + if(ioctl(tty, TIOCGETD, (char *)&discipline) == -1) + discipline = d_disipline; +#ifdef sony + if(ioctl(tty, TIOCKGET, (char *)&jmode) == -1) + jmode = d_jmode; + if(ioctl(tty, TIOCKGETC, (char *)&jtc) == -1) + jtc = d_jtc; +#endif /* sony */ +#endif /* USE_SYSV_TERMIO */ + close (tty); + /* tty is no longer an open fd! */ + tty = -1; + } + +#ifdef PUCC_PTYD + if(-1 == (screen->respond = openrpty(ttydev, ptydev, + (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), + getuid(), XDisplayString(screen->display)))) { +#else /* not PUCC_PTYD */ +#ifdef NEW_GET_PTY + if (get_pty(&screen->respond,XDisplayString(screen->display))) { +#else + if (get_pty(&screen->respond)) { +#endif +#endif /* PUCC_PTYD */ + /* no ptys! */ + (void) fprintf(stderr, "%s: no available ptys\n", + xgterm_name); + exit (ERROR_PTYS); +#ifdef PUCC_PTYD + } +#else + } /* keep braces balanced for emacs */ +#endif +#ifdef PUCC_PTYD + else { + /* + * set the fd of the master in a global var so + * we can undo all this on exit + * + */ + Ptyfd = screen->respond; + } +#endif /* PUCC_PTYD */ + } + + /* avoid double MapWindow requests */ + XtSetMappedWhenManaged( XtParent(term), False ); + wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", + False); + VTInit(); /* realize now so know window size for tty driver */ +#if defined(TIOCCONS) || defined(SRIOCSREDIR) + if (Console) { + /* + * Inform any running xconsole program + * that we are going to steal the console. + */ + XmuGetHostname (mit_console_name + MIT_CONSOLE_LEN, 255); + mit_console = XInternAtom(screen->display, mit_console_name, False); + /* the user told us to be the console, so we can use CurrentTime */ + XtOwnSelection (XtParent(term), + mit_console, CurrentTime, + ConvertConsoleSelection, NULL, NULL); + } +#endif + if(screen->TekEmu) { + envnew = tekterm; + ptr = newtc; + } else { + envnew = vtterm; + ptr = termcap; + } + TermName = NULL; + if (resource.term_name) { + if (tgetent (ptr, resource.term_name) == 1) { + TermName = resource.term_name; + if (!screen->TekEmu) + resize (screen, TermName, termcap, newtc); + } else { + fprintf (stderr, "%s: invalid termcap entry \"%s\".\n", + ProgramName, resource.term_name); + } + } + if (!TermName) { + while (*envnew != NULL) { + if(tgetent(ptr, *envnew) == 1) { + TermName = *envnew; + if(!screen->TekEmu) + resize(screen, TermName, termcap, newtc); + break; + } + envnew++; + } + if (TermName == NULL) { + fprintf (stderr, "%s: unable to find usable termcap entry.\n", + ProgramName); + Exit (1); + } + } + +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + /* tell tty how big window is */ + if(screen->TekEmu) { + ts.ts_lines = 35; + ts.ts_cols = 80; + } else { + ts.ts_lines = screen->max_row + 1; + ts.ts_cols = screen->max_col + 1; + } +#endif /* TIOCSSIZE */ +#else /* not sun */ +#ifdef TIOCSWINSZ + /* tell tty how big window is */ + if(screen->TekEmu) { + /* We can only guess at the size at this point. */ + ws.ws_row = 35; + ws.ws_col = 80; + ws.ws_xpixel = 640; + ws.ws_ypixel = 480; + } else { + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); + } +#endif /* TIOCSWINSZ */ +#endif /* sun */ + + if (!am_slave) { +#ifdef USE_HANDSHAKE + if (pipe(pc_pipe) || pipe(cp_pipe)) + SysError (ERROR_FORK); +#endif + if ((screen->pid = fork ()) == -1) + SysError (ERROR_FORK); + + if (screen->pid == 0) { + /* + * now in child process + */ + extern char **environ; +#if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__convex__) + int pgrp = setsid(); +#else + int pgrp = getpid(); +#endif +#ifdef USE_SYSV_TERMIO + char numbuf[12]; +#endif /* USE_SYSV_TERMIO */ +#if defined(UTMP) && defined(USE_SYSV_UTMP) + char *ptyname; +#endif + +#ifdef USE_USG_PTYS +#if defined(SYSV) && defined(SYSV386) + if (IsPts) { /* SYSV386 supports both, which did we open? */ +#endif /* SYSV && SYSV386 */ + int ptyfd; + + setpgrp(); + grantpt (screen->respond); + unlockpt (screen->respond); + if ((ptyfd = open (ptsname(screen->respond), O_RDWR)) < 0) { + SysError (1); + } +#ifdef I_PUSH + if (ioctl (ptyfd, I_PUSH, "ptem") < 0) { + SysError (2); + } +#if !defined(SVR4) && !defined(SYSV386) + if (!getenv("CONSEM") && ioctl (ptyfd, I_PUSH, "consem") < 0) { + SysError (3); + } +#endif /* !SVR4 */ + if (ioctl (ptyfd, I_PUSH, "ldterm") < 0) { + SysError (4); + } +#ifdef SVR4 /* from Sony */ +#if !defined(sgi) && !defined(ibm) + if (ioctl (ptyfd, I_PUSH, "ttcompat") < 0) { + SysError (5); + } +#endif /* !defined(sgi) */ +#endif /* SVR4 */ +#endif /* I_PUSH */ + tty = ptyfd; + close (screen->respond); +#ifdef TIOCSWINSZ + /* tell tty how big window is */ + if(screen->TekEmu) { + ws.ws_row = 35; + ws.ws_col = 80; + ws.ws_xpixel = 640; + ws.ws_ypixel = 480; + } else { + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); + } +#endif +#if defined(SYSV) && defined(SYSV386) + } else { /* else pty, not pts */ +#endif /* SYSV && SYSV386 */ +#endif /* USE_USG_PTYS */ + +#ifdef USE_HANDSHAKE /* warning, goes for a long ways */ + /* close parent's sides of the pipes */ + close (cp_pipe[0]); + close (pc_pipe[1]); + + /* Make sure that our sides of the pipes are not in the + * 0, 1, 2 range so that we don't fight with stdin, out + * or err. + */ + if (cp_pipe[1] <= 2) { + if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) { + (void) close(cp_pipe[1]); + cp_pipe[1] = i; + } + } + if (pc_pipe[0] <= 2) { + if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) { + (void) close(pc_pipe[0]); + pc_pipe[0] = i; + } + } + + /* we don't need the socket, or the pty master anymore */ + close (Xsocket); + close (screen->respond); + + /* Now is the time to set up our process group and + * open up the pty slave. + */ +#ifdef USE_SYSV_PGRP +#if defined(CRAY) && (OSMAJORVERSION > 5) + (void) setsid(); +#else + (void) setpgrp(); +#endif +#endif /* USE_SYSV_PGRP */ + while (1) { + +#ifdef TIOCNOTTY + if (!no_dev_tty && (tty = open ("/dev/tty", O_RDWR)) >= 0) { + ioctl (tty, TIOCNOTTY, (char *) NULL); + close (tty); + } +#endif /* TIOCNOTTY */ + if ((tty = open(ttydev, O_RDWR, 0)) >= 0) { +#if defined(CRAY) && defined(TCSETCTTY) + /* make /dev/tty work */ + ioctl(tty, TCSETCTTY, 0); +#endif +#ifdef USE_SYSV_PGRP + /* We need to make sure that we are acutally + * the process group leader for the pty. If + * we are, then we should now be able to open + * /dev/tty. + */ + if ((i = open("/dev/tty", O_RDWR, 0)) >= 0) { + /* success! */ + close(i); + break; + } +#else /* USE_SYSV_PGRP */ + break; +#endif /* USE_SYSV_PGRP */ + } + +#ifdef TIOCSCTTY + ioctl(tty, TIOCSCTTY, 0); +#endif + /* let our master know that the open failed */ + handshake.status = PTY_BAD; + handshake.error = errno; + strcpy(handshake.buffer, ttydev); + write(cp_pipe[1], (char *) &handshake, + sizeof(handshake)); + + /* get reply from parent */ + i = read(pc_pipe[0], (char *) &handshake, + sizeof(handshake)); + if (i <= 0) { + /* parent terminated */ + exit(1); + } + + if (handshake.status == PTY_NOMORE) { + /* No more ptys, let's shutdown. */ + exit(1); + } + + /* We have a new pty to try */ + free(ttydev); + ttydev = malloc((unsigned) + (strlen(handshake.buffer) + 1)); + strcpy(ttydev, handshake.buffer); + } + + /* use the same tty name that everyone else will use + ** (from ttyname) + */ + if (ptr = ttyname(tty)) + { + /* it may be bigger */ + ttydev = realloc (ttydev, (unsigned) (strlen(ptr) + 1)); + (void) strcpy(ttydev, ptr); + } +#if defined(SYSV) && defined(SYSV386) + } /* end of IsPts else clause */ +#endif /* SYSV && SYSV386 */ + +#endif /* USE_HANDSHAKE -- from near fork */ + +#ifdef USE_TTY_GROUP + { +#include <grp.h> /* R6 update */ + struct group *ttygrp; + if (ttygrp = getgrnam("tty")) { + /* change ownership of tty to real uid, "tty" gid */ + chown (ttydev, screen->uid, ttygrp->gr_gid); + chmod (ttydev, 0620); + } + else { + /* change ownership of tty to real group and user id */ + chown (ttydev, screen->uid, screen->gid); + chmod (ttydev, 0622); + } + endgrent(); + } +#else /* else !USE_TTY_GROUP */ + /* change ownership of tty to real group and user id */ + chown (ttydev, screen->uid, screen->gid); + + /* change protection of tty */ + chmod (ttydev, 0622); +#endif /* USE_TTY_GROUP */ + + /* + * set up the tty modes + */ + { +/* +#ifdef USE_SYSV_TERMIO +*/ +#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) +#if defined(umips) || defined(CRAY) || defined(linux) + /* If the control tty had its modes screwed around with, + eg. by lineedit in the shell, or emacs, etc. then tio + will have bad values. Let's just get termio from the + new tty and tailor it. */ + if (ioctl (tty, TCGETA, &tio) == -1) + SysError (ERROR_TIOCGETP); + tio.c_lflag |= ECHOE; +#endif /* umips */ + /* Now is also the time to change the modes of the + * child pty. + */ + /* input: nl->nl, don't ignore cr, cr->nl */ + tio.c_iflag &= ~(INLCR|IGNCR); + tio.c_iflag |= ICRNL; + /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */ + tio.c_oflag &= + ~(OCRNL|ONLRET|NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); + tio.c_oflag |= ONLCR; +#ifdef OPOST + tio.c_oflag |= OPOST; +#endif /* OPOST */ +#ifdef BAUD_0 + /* baud rate is 0 (don't care) */ + tio.c_cflag &= ~(CBAUD); +#else /* !BAUD_0 */ + /* baud rate is 9600 (nice default) */ + tio.c_cflag &= ~(CBAUD); + tio.c_cflag |= B9600; +#endif /* !BAUD_0 */ + /* enable signals, canonical processing (erase, kill, etc), + ** echo + */ + tio.c_lflag |= ISIG|ICANON|ECHO; + /* reset EOL to defalult value */ + tio.c_cc[VEOL] = '@' & 0x3f; /* '^@' */ + /* certain shells (ksh & csh) change EOF as well */ + tio.c_cc[VEOF] = 'D' & 0x3f; /* '^D' */ + +#define TMODE(ind,var) if (ttymodelist[ind].set) var = ttymodelist[ind].value; + if (override_tty_modes) { + /* sysv-specific */ + TMODE (XTTYMODE_intr, tio.c_cc[VINTR]); + TMODE (XTTYMODE_quit, tio.c_cc[VQUIT]); + TMODE (XTTYMODE_erase, tio.c_cc[VERASE]); + TMODE (XTTYMODE_kill, tio.c_cc[VKILL]); + TMODE (XTTYMODE_eof, tio.c_cc[VEOF]); + TMODE (XTTYMODE_eol, tio.c_cc[VEOL]); +#ifdef VSWTCH + TMODE (XTTYMODE_swtch, d_tio.c_cc[VSWTCH]); +#endif +#ifdef TIOCSLTC + /* both SYSV and BSD have ltchars */ + TMODE (XTTYMODE_susp, ltc.t_suspc); + TMODE (XTTYMODE_dsusp, ltc.t_dsuspc); + TMODE (XTTYMODE_rprnt, ltc.t_rprntc); + TMODE (XTTYMODE_flush, ltc.t_flushc); + TMODE (XTTYMODE_weras, ltc.t_werasc); + TMODE (XTTYMODE_lnext, ltc.t_lnextc); +#endif + } +#undef TMODE + + if (ioctl (tty, TCSETA, &tio) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETP); +#ifdef TIOCSLTC +#ifndef hpux + if (ioctl (tty, TIOCSLTC, &ltc) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCSETC); +#endif +#endif /* TIOCSLTC */ +#ifdef TIOCLSET + if (ioctl (tty, TIOCLSET, (char *)&lmode) == -1) + HsSysError(cp_pipe[1], ERROR_TIOCLSET); +#endif /* TIOCLSET */ +#else /* USE_SYSV_TERMIO */ + sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW); + sg.sg_flags |= ECHO | CRMOD; + /* make sure speed is set on pty so that editors work right*/ + sg.sg_ispeed = B9600; + sg.sg_ospeed = B9600; + /* reset t_brkc to default value */ + tc.t_brkc = -1; +#ifdef sony + if (screen->input_eight_bits) + lmode |= LPASS8; + else + lmode &= ~(LPASS8); + jmode &= ~KM_KANJI; +#endif /* sony */ + +#define TMODE(ind,var) if (ttymodelist[ind].set) var = ttymodelist[ind].value; + if (override_tty_modes) { + TMODE (XTTYMODE_intr, tc.t_intrc); + TMODE (XTTYMODE_quit, tc.t_quitc); + TMODE (XTTYMODE_erase, sg.sg_erase); + TMODE (XTTYMODE_kill, sg.sg_kill); + TMODE (XTTYMODE_eof, tc.t_eofc); + TMODE (XTTYMODE_start, tc.t_startc); + TMODE (XTTYMODE_stop, tc.t_stopc); + TMODE (XTTYMODE_brk, tc.t_brkc); + /* both SYSV and BSD have ltchars */ + TMODE (XTTYMODE_susp, ltc.t_suspc); + TMODE (XTTYMODE_dsusp, ltc.t_dsuspc); + TMODE (XTTYMODE_rprnt, ltc.t_rprntc); + TMODE (XTTYMODE_flush, ltc.t_flushc); + TMODE (XTTYMODE_weras, ltc.t_werasc); + TMODE (XTTYMODE_lnext, ltc.t_lnextc); + } +#undef TMODE + + if (ioctl (tty, TIOCSETP, (char *)&sg) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCSETP); +#ifndef hpux + if (ioctl (tty, TIOCSETC, (char *)&tc) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCSETC); +#endif + if (ioctl (tty, TIOCSETD, (char *)&discipline) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCSETD); + if (ioctl (tty, TIOCSLTC, (char *)&ltc) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCSLTC); + if (ioctl (tty, TIOCLSET, (char *)&lmode) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCLSET); +#ifdef sony + if (ioctl (tty, TIOCKSET, (char *)&jmode) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCKSET); + if (ioctl (tty, TIOCKSETC, (char *)&jtc) == -1) + HsSysError (cp_pipe[1], ERROR_TIOCKSETC); +#endif /* sony */ +#endif /* !USE_SYSV_TERMIO */ +#if defined(TIOCCONS) || defined(SRIOCSREDIR) + if (Console) { +#ifdef TIOCCONS + int on = 1; + if (ioctl (tty, TIOCCONS, (char *)&on) == -1) + fprintf(stderr, "%s: cannot open console\n", + xgterm_name); +#endif +#ifdef SRIOCSREDIR + int fd = open("/dev/console",O_RDWR); + if (fd == -1 || ioctl (fd, SRIOCSREDIR, tty) == -1) + fprintf(stderr, "%s: cannot open console\n", + xgterm_name); + (void) close (fd); +#endif + } +#endif /* TIOCCONS */ + } + + signal (SIGCHLD, SIG_DFL); +#ifdef USE_SYSV_SIGHUP + /* watch out for extra shells (I don't understand either) */ + signal (SIGHUP, SIG_DFL); +#else + signal (SIGHUP, SIG_IGN); +#endif + /* restore various signals to their defaults */ + signal (SIGINT, SIG_DFL); + signal (SIGQUIT, SIG_DFL); + signal (SIGTERM, SIG_DFL); + + /* copy the environment before Setenving */ + for (i = 0 ; environ [i] != NULL ; i++) + ; + /* compute number of Setenv() calls below */ + envsize = 1; /* (NULL terminating entry) */ + envsize += 3; /* TERM, WINDOWID, DISPLAY */ +#ifdef UTMP + envsize += 1; /* LOGNAME */ +#endif /* UTMP */ +#ifdef USE_SYSV_ENVVARS +#ifndef TIOCSWINSZ /* window size not stored in driver? */ + envsize += 2; /* COLUMNS, LINES */ +#endif /* TIOCSWINSZ */ +#ifdef UTMP + envsize += 2; /* HOME, SHELL */ +#endif /* UTMP */ +#else /* USE_SYSV_ENVVARS */ + envsize += 1; /* TERMCAP */ +#endif /* USE_SYSV_ENVVARS */ + envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *)); + memmove( (char *)envnew, (char *)environ, i * sizeof(char *)); + environ = envnew; + Setenv ("TERM=", TermName); + if(!TermName) + *newtc = 0; + + sprintf (buf, "%lu", + ((unsigned long) XtWindow (XtParent(term)))); + Setenv ("WINDOWID=", buf); + /* put the display into the environment of the shell*/ + Setenv ("DISPLAY=", XDisplayString (screen->display)); + + signal(SIGTERM, SIG_DFL); + + /* this is the time to go and set up stdin, out, and err + */ + { +#if defined(CRAY) && (OSMAJORVERSION >= 6) + (void) close(tty); + (void) close(0); + + if (open ("/dev/tty", O_RDWR)) { + fprintf(stderr, "cannot open /dev/tty\n"); + exit(1); + } + (void) close(1); + (void) close(2); + dup(0); + dup(0); +#else + /* dup the tty */ + for (i = 0; i <= 2; i++) + if (i != tty) { + (void) close(i); + (void) dup(tty); + } + +#ifndef ATT + /* and close the tty */ + if (tty > 2) + (void) close(tty); +#endif +#endif /* CRAY */ + } + +#ifndef USE_SYSV_PGRP +#ifdef TIOCSCTTY + setsid(); + ioctl(0, TIOCSCTTY, 0); +#endif + ioctl(0, TIOCSPGRP, (char *)&pgrp); + setpgrp(0,0); + close(open(ttydev, O_WRONLY, 0)); + setpgrp (0, pgrp); +#endif /* !USE_SYSV_PGRP */ + +#ifdef UTMP + pw = getpwuid(screen->uid); + if (pw && pw->pw_name) + Setenv ("LOGNAME=", pw->pw_name); /* for POSIX */ +#ifdef USE_SYSV_UTMP + /* Set up our utmp entry now. We need to do it here + ** for the following reasons: + ** - It needs to have our correct process id (for + ** login). + ** - If our parent was to set it after the fork(), + ** it might make it out before we need it. + ** - We need to do it before we go and change our + ** user and group id's. + */ +#ifdef CRAY +#define PTYCHARLEN 4 +#else +#define PTYCHARLEN 2 +#endif + + (void) setutent (); + /* set up entry to search for */ + ptyname = ttydev; + (void) strncpy(utmp.ut_id,ptyname + strlen(ptyname)-PTYCHARLEN, + sizeof (utmp.ut_id)); + utmp.ut_type = DEAD_PROCESS; + + /* position to entry in utmp file */ + (void) getutid(&utmp); + + /* set up the new entry */ + utmp.ut_type = USER_PROCESS; +#ifndef linux + utmp.ut_exit.e_exit = 2; +#endif + (void) strncpy(utmp.ut_user, + (pw && pw->pw_name) ? pw->pw_name : "????", + sizeof(utmp.ut_user)); + + (void)strncpy(utmp.ut_id, ptyname + strlen(ptyname)-PTYCHARLEN, + sizeof(utmp.ut_id)); + (void) strncpy (utmp.ut_line, + ptyname + strlen("/dev/"), sizeof (utmp.ut_line)); + +#ifdef HAS_UTMP_UT_HOST + (void) strncpy(buf, DisplayString(screen->display), + sizeof(buf)); +#ifndef linux /* R6 update */ + { + char *disfin = strrchr(buf, ':'); + if (disfin) + *disfin = '\0'; + } +#endif /* R6 update */ + (void) strncpy(utmp.ut_host, buf, sizeof(utmp.ut_host)); +#endif + (void) strncpy(utmp.ut_name, pw->pw_name, + sizeof(utmp.ut_name)); + + utmp.ut_pid = getpid(); +#ifdef SVR4 + utmp.ut_session = getsid(0); + utmp.ut_xtime = time ((Time_t *) 0); + utmp.ut_tv.tv_usec = 0; +#else + utmp.ut_time = time ((Time_t *) 0); +#endif + + /* write out the entry */ + if (!resource.utmpInhibit) + (void) pututline(&utmp); +#ifdef WTMP +#ifdef SVR4 + if (term->misc.login_shell) + updwtmpx(WTMPX_FILE, &utmp); +#else + if (term->misc.login_shell && + (i = open(etc_wtmp, O_WRONLY|O_APPEND)) >= 0) { + write(i, (char *)&utmp, sizeof(struct utmp)); + close(i); + } +#endif +#endif + /* close the file */ + (void) endutent(); + +#else /* USE_SYSV_UTMP */ + /* We can now get our ttyslot! We can also set the initial + * UTMP entry. + */ + tslot = ttyslot(); + added_utmp_entry = False; + { + if (pw && !resource.utmpInhibit && + (i = open(etc_utmp, O_WRONLY)) >= 0) { + memset((char *)&utmp, 0, sizeof(struct utmp)); + (void) strncpy(utmp.ut_line, + ttydev + strlen("/dev/"), + sizeof(utmp.ut_line)); + (void) strncpy(utmp.ut_name, pw->pw_name, + sizeof(utmp.ut_name)); +#ifdef HAS_UTMP_UT_HOST + (void) strncpy(utmp.ut_host, + XDisplayString (screen->display), + sizeof(utmp.ut_host)); +#endif + time(&utmp.ut_time); + lseek(i, (long)(tslot * sizeof(struct utmp)), 0); + write(i, (char *)&utmp, sizeof(struct utmp)); + close(i); + added_utmp_entry = True; +#ifdef WTMP + if (term->misc.login_shell && + (i = open(etc_wtmp, O_WRONLY|O_APPEND)) >= 0) { + int status; + status = write(i, (char *)&utmp, + sizeof(struct utmp)); + status = close(i); + } +#endif /* WTMP */ +#ifdef MNX_LASTLOG + if (term->misc.login_shell && + (i = open(_U_LASTLOG, O_WRONLY)) >= 0) { + lseek(i, (long)(screen->uid * + sizeof (struct utmp)), 0); + write(i, (char *)&utmp, + sizeof (struct utmp)); + close(i); + } +#endif /* MNX_LASTLOG */ +#ifdef LASTLOG + if (term->misc.login_shell && + (i = open(etc_lastlog, O_WRONLY)) >= 0) { + memset((char *)&lastlog, 0, + sizeof (struct lastlog)); + (void) strncpy(lastlog.ll_line, ttydev + + sizeof("/dev"), + sizeof (lastlog.ll_line)); + (void) strncpy(lastlog.ll_host, + XDisplayString (screen->display), + sizeof (lastlog.ll_host)); + time(&lastlog.ll_time); + lseek(i, (long)(screen->uid * + sizeof (struct lastlog)), 0); + write(i, (char *)&lastlog, + sizeof (struct lastlog)); + close(i); + } +#endif /* LASTLOG */ + } else + tslot = -tslot; + } + + /* Let's pass our ttyslot to our parent so that it can + * clean up after us. + */ +#ifdef USE_HANDSHAKE + handshake.tty_slot = tslot; +#endif /* USE_HANDSHAKE */ +#endif /* USE_SYSV_UTMP */ + +#ifdef USE_HANDSHAKE + /* Let our parent know that we set up our utmp entry + * so that it can clean up after us. + */ + handshake.status = UTMP_ADDED; + handshake.error = 0; + strcpy(handshake.buffer, ttydev); + (void)write(cp_pipe[1], (char *)&handshake, sizeof(handshake)); +#endif /* USE_HANDSHAKE */ +#endif/* UTMP */ + + (void) setgid (screen->gid); +#ifdef HAS_BSD_GROUPS + if (geteuid() == 0 && pw) + initgroups (pw->pw_name, pw->pw_gid); +#endif + (void) setuid (screen->uid); + +#ifdef USE_HANDSHAKE + /* mark the pipes as close on exec */ + fcntl(cp_pipe[1], F_SETFD, 1); + fcntl(pc_pipe[0], F_SETFD, 1); + + /* We are at the point where we are going to + * exec our shell (or whatever). Let our parent + * know we arrived safely. + */ + handshake.status = PTY_GOOD; + handshake.error = 0; + (void)strcpy(handshake.buffer, ttydev); + (void)write(cp_pipe[1], (char *)&handshake, sizeof(handshake)); + + if (waiting_for_initial_map) { + i = read (pc_pipe[0], (char *) &handshake, + sizeof(handshake)); + if (i != sizeof(handshake) || + handshake.status != PTY_EXEC) { + /* some very bad problem occurred */ + exit (ERROR_PTY_EXEC); + } + if(handshake.rows > 0 && handshake.cols > 0) { + screen->max_row = handshake.rows; + screen->max_col = handshake.cols; +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + ts.ts_lines = screen->max_row + 1; + ts.ts_cols = screen->max_col + 1; +#endif /* TIOCSSIZE */ +#else /* !sun */ +#ifdef TIOCSWINSZ + ws.ws_row = screen->max_row + 1; + ws.ws_col = screen->max_col + 1; + ws.ws_xpixel = FullWidth(screen); + ws.ws_ypixel = FullHeight(screen); +#endif /* TIOCSWINSZ */ +#endif /* sun else !sun */ + } + } +#endif /* USE_HANDSHAKE */ + +#ifdef USE_SYSV_ENVVARS + sprintf (numbuf, "%d", screen->max_col + 1); + Setenv("COLUMNS=", numbuf); + sprintf (numbuf, "%d", screen->max_row + 1); + Setenv("LINES=", numbuf); +#ifdef UTMP + if (pw) { /* SVR4 doesn't provide these */ + if (!getenv("HOME")) + Setenv("HOME=", pw->pw_dir); + if (!getenv("SHELL")) + Setenv("SHELL=", pw->pw_shell); + } +#endif /* UTMP */ +#else /* USE_SYSV_ENVVAR */ + if(!screen->TekEmu) { + strcpy (termcap, newtc); + resize (screen, TermName, termcap, newtc); + } + if (term->misc.titeInhibit) { + remove_termcap_entry (newtc, ":ti="); + remove_termcap_entry (newtc, ":te="); + } + /* + * work around broken termcap entries */ + if (resource.useInsertMode) { + remove_termcap_entry (newtc, ":ic="); + /* don't get duplicates */ + remove_termcap_entry (newtc, ":im="); + remove_termcap_entry (newtc, ":ei="); + remove_termcap_entry (newtc, ":mi"); + strcat (newtc, ":im=\\E[4h:ei=\\E[4l:mi:"); + } + Setenv ("TERMCAP=", newtc); +#endif /* USE_SYSV_ENVVAR */ + + + /* need to reset after all the ioctl bashing we did above */ +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + ioctl (0, TIOCSSIZE, &ts); +#endif /* TIOCSSIZE */ +#else /* not sun */ +#ifdef TIOCSWINSZ + ioctl (0, TIOCSWINSZ, (char *)&ws); +#endif /* TIOCSWINSZ */ +#endif /* sun */ + + signal(SIGHUP, SIG_DFL); + if (command_to_exec) { + execvp(*command_to_exec, command_to_exec); + /* print error message on screen */ + fprintf(stderr, "%s: Can't execvp %s\n", xgterm_name, + *command_to_exec); + } + +#ifdef USE_SYSV_SIGHUP + /* fix pts sh hanging around */ + signal (SIGHUP, SIG_DFL); +#endif +#ifdef _IBMR2 + /* The AIX 3.1 "rsh" command turns off INTR in sigmask. We + must turn it back on. No you cannot solve this by calling + signal(SIGINT,SIG_DFL). Tried. + -- Dan Greening dgreen@ibm.com */ + { + extern int sigprocmask(); + int mask; + sigset_t set, oset; + + sigemptyset(&set); + sigprocmask(SIG_SETMASK,&set,&oset); + } +#endif /* _IBMR2 */ + +#ifdef UTMP + if(((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + ((pw == NULL && (pw = getpwuid(screen->uid)) == NULL) || + *(ptr = pw->pw_shell) == 0)) +#else /* UTMP */ + if(((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + ((pw = getpwuid(screen->uid)) == NULL || + *(ptr = pw->pw_shell) == 0)) +#endif /* UTMP */ + ptr = "/bin/sh"; + if(shname = strrchr(ptr, '/')) + shname++; + else + shname = ptr; + shname_minus = malloc(strlen(shname) + 2); + (void) strcpy(shname_minus, "-"); + (void) strcat(shname_minus, shname); +#ifndef USE_SYSV_TERMIO + ldisc = XStrCmp("csh", shname + strlen(shname) - 3) == 0 ? + NTTYDISC : 0; + ioctl(0, TIOCSETD, (char *)&ldisc); +#endif /* !USE_SYSV_TERMIO */ + +#ifdef USE_LOGIN_DASH_P + if (term->misc.login_shell && pw && added_utmp_entry) + execl (bin_login, "login", "-p", "-f", pw->pw_name, 0); +#endif + execlp (ptr, (term->misc.login_shell ? shname_minus : shname), + 0); + + /* Exec failed. */ + fprintf (stderr, "%s: Could not exec %s!\n", xgterm_name, ptr); + (void) sleep(5); + exit(ERROR_EXEC); + } /* end if in child after fork */ + +#ifdef USE_HANDSHAKE + /* Parent process. Let's handle handshaked requests to our + * child process. + */ + + /* close childs's sides of the pipes */ + close (cp_pipe[1]); + close (pc_pipe[0]); + + for (done = 0; !done; ) { + if (read(cp_pipe[0], (char *) &handshake, sizeof(handshake)) <= 0) { + /* Our child is done talking to us. If it terminated + * due to an error, we will catch the death of child + * and clean up. + */ + break; + } + + switch(handshake.status) { + case PTY_GOOD: + /* Success! Let's free up resources and + * continue. + */ + done = 1; + break; + + case PTY_BAD: + /* The open of the pty failed! Let's get + * another one. + */ + (void) close(screen->respond); +#ifdef NEW_GET_PTY + if (get_pty(&screen->respond, XDisplayString(screen->display))) { +#else + if (get_pty(&screen->respond)) { +#endif + /* no more ptys! */ + (void) fprintf(stderr, + "%s: child process can find no available ptys\n", + xgterm_name); + handshake.status = PTY_NOMORE; + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + exit (ERROR_PTYS); + } + handshake.status = PTY_NEW; + (void) strcpy(handshake.buffer, ttydev); + write(pc_pipe[1], (char *) &handshake, sizeof(handshake)); + break; + + case PTY_FATALERROR: + errno = handshake.error; + close(cp_pipe[0]); + close(pc_pipe[1]); + SysError(handshake.fatal_error); + + case UTMP_ADDED: + /* The utmp entry was set by our slave. Remember + * this so that we can reset it later. + */ + added_utmp_entry = True; +#ifndef USE_SYSV_UTMP + tslot = handshake.tty_slot; +#endif /* USE_SYSV_UTMP */ + free(ttydev); + ttydev = malloc((unsigned) strlen(handshake.buffer) + 1); + strcpy(ttydev, handshake.buffer); + break; + default: + fprintf(stderr, "%s: unexpected handshake status %d\n", + xgterm_name, handshake.status); + } + } + /* close our sides of the pipes */ + if (!waiting_for_initial_map) { + close (cp_pipe[0]); + close (pc_pipe[1]); + } +#endif /* USE_HANDSHAKE */ + } /* end if no slave */ + + /* + * still in parent (xgterm process) + */ + +#ifdef USE_SYSV_SIGHUP + /* hung sh problem? */ + signal (SIGHUP, SIG_DFL); +#else + signal (SIGHUP,SIG_IGN); +#endif + +/* + * Unfortunately, System V seems to have trouble divorcing the child process + * from the process group of xgterm. This is a problem because hitting the + * INTR or QUIT characters on the keyboard will cause xgterm to go away if we + * don't ignore the signals. This is annoying. + */ + +#if defined(USE_SYSV_SIGNALS) && !defined(SIGTSTP) + signal (SIGINT, SIG_IGN); + +#ifndef SYSV + /* hung shell problem */ + signal (SIGQUIT, SIG_IGN); +#endif + signal (SIGTERM, SIG_IGN); +#else /* else is bsd or has job control */ +#ifdef SYSV + /* if we were spawned by a jobcontrol smart shell (like ksh or csh), + * then our pgrp and pid will be the same. If we were spawned by + * a jobcontrol dumb shell (like /bin/sh), then we will be in our + * parent's pgrp, and we must ignore keyboard signals, or we will + * tank on everything. + */ + if (getpid() == getpgrp()) { + (void) signal(SIGINT, Exit); + (void) signal(SIGQUIT, Exit); + (void) signal(SIGTERM, Exit); + } else { + (void) signal(SIGINT, SIG_IGN); + (void) signal(SIGQUIT, SIG_IGN); + (void) signal(SIGTERM, SIG_IGN); + } + (void) signal(SIGPIPE, Exit); +#else /* SYSV */ + signal (SIGINT, Exit); + signal (SIGQUIT, Exit); + signal (SIGTERM, Exit); + signal (SIGPIPE, Exit); +#endif /* SYSV */ +#endif /* USE_SYSV_SIGNALS and not SIGTSTP */ + + return 0; +} /* end spawn */ +#endif + + + +SIGNAL_T +Exit(n) + int n; +{ + register TScreen *screen = &term->screen; + int pty = term->screen.respond; /* file descriptor of pty */ +#ifdef UTMP +#ifdef USE_SYSV_UTMP +#ifdef SVR4 + struct utmpx utmp; + struct utmpx *utptr; +#else + struct utmp utmp; + struct utmp *utptr; +#endif + char *ptyname; +#if defined(WTMP) && !defined(SVR4) + int fd; /* for /etc/wtmp */ + int i; +#endif + +#ifdef PUCC_PTYD + closepty(ttydev, ptydev, (resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN), Ptyfd); +#endif /* PUCC_PTYD */ + + /* cleanup the utmp entry we forged earlier */ + if (!resource.utmpInhibit +#ifdef USE_HANDSHAKE /* without handshake, no way to know */ + && added_utmp_entry +#endif /* USE_HANDSHAKE */ + ) { + ptyname = ttydev; + utmp.ut_type = USER_PROCESS; + (void) strncpy(utmp.ut_id, ptyname + strlen(ptyname) - PTYCHARLEN, + sizeof(utmp.ut_id)); + (void) setutent(); + utptr = getutid(&utmp); + /* write it out only if it exists, and the pid's match */ + if (utptr && (utptr->ut_pid == screen->pid)) { + utptr->ut_type = DEAD_PROCESS; +#ifdef SVR4 + utmp.ut_session = getsid(0); + utmp.ut_xtime = time ((Time_t *) 0); + utmp.ut_tv.tv_usec = 0; +#else + utptr->ut_time = time((Time_t *) 0); +#endif + (void) pututline(utptr); +#ifdef WTMP +#ifdef SVR4 + updwtmpx(WTMPX_FILE, &utmp); +#else + /* set wtmp entry if wtmp file exists */ + if ((fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + i = write(fd, utptr, sizeof(utmp)); + i = close(fd); + } +#endif +#endif + + } + (void) endutent(); + } +#else /* not USE_SYSV_UTMP */ + register int wfd; + register int i; + struct utmp utmp; + + if (!resource.utmpInhibit && added_utmp_entry && + (!am_slave && tslot > 0 && (wfd = open(etc_utmp, O_WRONLY)) >= 0)){ + memset((char *)&utmp, 0, sizeof(struct utmp)); + lseek(wfd, (long)(tslot * sizeof(struct utmp)), 0); + write(wfd, (char *)&utmp, sizeof(struct utmp)); + close(wfd); +#ifdef WTMP + if (term->misc.login_shell && + (wfd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { + (void) strncpy(utmp.ut_line, ttydev + + sizeof("/dev"), sizeof (utmp.ut_line)); + time(&utmp.ut_time); + i = write(wfd, (char *)&utmp, sizeof(struct utmp)); + i = close(wfd); + } +#endif /* WTMP */ + } +#endif /* USE_SYSV_UTMP */ +#endif /* UTMP */ + close(pty); /* close explicitly to avoid race with slave side */ +#ifdef ALLOWLOGGING + if(screen->logging) + CloseLog(screen); +#endif + + if (!am_slave) { + /* restore ownership of tty and pty */ + chown (ttydev, 0, 0); +#ifndef sgi + chown (ptydev, 0, 0); +#endif /* !sgi */ + + /* restore modes of tty and pty */ + chmod (ttydev, 0666); +#ifndef sgi + chmod (ptydev, 0666); +#endif /* !sgi */ + } + exit(n); + SIGNAL_RETURN; +} + +/* ARGSUSED */ +resize(screen, TermName, oldtc, newtc) +TScreen *screen; +char *TermName; +register char *oldtc, *newtc; +{ +#ifndef USE_SYSV_ENVVARS + register char *ptr1, *ptr2; + register int i; + register int li_first = 0; + register char *temp; + + if ((ptr1 = strindex (oldtc, "co#")) == NULL){ + strcat (oldtc, "co#80:"); + ptr1 = strindex (oldtc, "co#"); + } + if ((ptr2 = strindex (oldtc, "li#")) == NULL){ + strcat (oldtc, "li#24:"); + ptr2 = strindex (oldtc, "li#"); + } + if(ptr1 > ptr2) { + li_first++; + temp = ptr1; + ptr1 = ptr2; + ptr2 = temp; + } + ptr1 += 3; + ptr2 += 3; + strncpy (newtc, oldtc, i = ptr1 - oldtc); + newtc += i; + sprintf (newtc, "%d", li_first ? screen->max_row + 1 : + screen->max_col + 1); + newtc += strlen(newtc); + ptr1 = strchr(ptr1, ':'); + strncpy (newtc, ptr1, i = ptr2 - ptr1); + newtc += i; + sprintf (newtc, "%d", li_first ? screen->max_col + 1 : + screen->max_row + 1); + ptr2 = strchr(ptr2, ':'); + strcat (newtc, ptr2); +#endif /* USE_SYSV_ENVVARS */ +} + +/* + * Does a non-blocking wait for a child process. If the system + * doesn't support non-blocking wait, do nothing. + * Returns the pid of the child, or 0 or -1 if none or error. + */ +int +nonblocking_wait() +{ +#ifdef USE_POSIX_WAIT + pid_t pid; + + pid = waitpid(-1, NULL, WNOHANG); +#else /* USE_POSIX_WAIT */ +#if defined(USE_SYSV_SIGNALS) && (defined(CRAY) || !defined(SIGTSTP)) + /* cannot do non-blocking wait */ + int pid = 0; +#else /* defined(USE_SYSV_SIGNALS) && (defined(CRAY) || !defined(SIGTSTP)) */ + /* union wait status; */ int status; + register int pid; + + pid = wait3 (&status, WNOHANG, (struct rusage *)NULL); +#endif /* defined(USE_SYSV_SIGNALS) && !defined(SIGTSTP) */ +#endif /* USE_POSIX_WAIT else */ + + return pid; +} + +/* ARGSUSED */ +static SIGNAL_T reapchild (n) + int n; +{ + int pid; + + pid = wait(NULL); + +#ifdef USE_SYSV_SIGNALS + /* cannot re-enable signal before waiting for child + because then SVR4 loops. Sigh. HP-UX 9.01 too. */ + (void) signal(SIGCHLD, reapchild); +#endif + + do { + if (pid == term->screen.pid) { +#ifdef DEBUG + if (debug) fputs ("Exiting\n", stderr); +#endif + Cleanup (0); + } + } while ( (pid=nonblocking_wait()) > 0); + + SIGNAL_RETURN; +} + +/* VARARGS1 */ +consolepr(fmt,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9) +char *fmt; +{ + extern char *SysErrorMsg(); + int oerrno; + int f; + char buf[ BUFSIZ ]; + + oerrno = errno; + strcpy(buf, "new-xgterm: "); + sprintf(buf+strlen(buf), fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); + strcat(buf, ": "); + strcat(buf, SysErrorMsg (oerrno)); + strcat(buf, "\n"); + f = open("/dev/console",O_WRONLY); + write(f, buf, strlen(buf)); + close(f); +#ifdef TIOCNOTTY + if ((f = open("/dev/tty", 2)) >= 0) { + ioctl(f, TIOCNOTTY, (char *)NULL); + close(f); + } +#endif /* TIOCNOTTY */ +} + + +remove_termcap_entry (buf, str) + char *buf; + char *str; +{ + register char *strinbuf; + + strinbuf = strindex (buf, str); + if (strinbuf) { + register char *colonPtr = strchr(strinbuf+1, ':'); + if (colonPtr) { + while (*colonPtr) { + *strinbuf++ = *colonPtr++; /* copy down */ + } + *strinbuf = '\0'; + } else { + strinbuf[1] = '\0'; + } + } + return 0; +} + +/* + * parse_tty_modes accepts lines of the following form: + * + * [SETTING] ... + * + * where setting consists of the words in the modelist followed by a character + * or ^char. + */ +static int parse_tty_modes (s, modelist) + char *s; + struct _xttymodes *modelist; +{ + struct _xttymodes *mp; + int c; + int count = 0; + + while (1) { + while (*s && isascii(*s) && isspace(*s)) s++; + if (!*s) return count; + + for (mp = modelist; mp->name; mp++) { + if (strncmp (s, mp->name, mp->len) == 0) break; + } + if (!mp->name) return -1; + + s += mp->len; + while (*s && isascii(*s) && isspace(*s)) s++; + if (!*s) return -1; + + if (*s == '^') { + s++; + c = ((*s == '?') ? 0177 : *s & 31); /* keep control bits */ + } else { + c = *s; + } + mp->value = c; + mp->set = 1; + count++; + s++; + } +} + + +int GetBytesAvailable (fd) + int fd; +{ +#ifdef FIONREAD + static long arg; + ioctl (fd, FIONREAD, (char *) &arg); + return (int) arg; +#else +#ifdef FIORDCK + return (ioctl (fd, FIORDCHK, NULL)); +#else + struct pollfd pollfds[1]; + + pollfds[0].fd = fd; + pollfds[0].events = POLLIN; + return poll (pollfds, 1, 0); +#endif +#endif +} + +/* Utility function to try to hide system differences from + everybody who used to call killpg() */ + +int +kill_process_group(pid, sig) + int pid; + int sig; +{ +#ifndef X_NOT_POSIX + return kill (-pid, sig); +#else +#if defined(SVR4) || defined(SYSV) + return kill (-pid, sig); +#else + return killpg (pid, sig); +#endif +#endif +} diff --git a/vendor/x11iraf/xgterm/main.h b/vendor/x11iraf/xgterm/main.h new file mode 100644 index 00000000..59d30407 --- /dev/null +++ b/vendor/x11iraf/xgterm/main.h @@ -0,0 +1,31 @@ +/* + * $XConsortium: main.h,v 1.5 91/02/06 16:00:15 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#define DEFFONT "fixed" +#define DEFBOLDFONT NULL /* no bold font uses overstriking */ +#define DEFBORDER 2 +#define DEFBORDERWIDTH 2 diff --git a/vendor/x11iraf/xgterm/menu.c b/vendor/x11iraf/xgterm/menu.c new file mode 100644 index 00000000..63c7e619 --- /dev/null +++ b/vendor/x11iraf/xgterm/menu.c @@ -0,0 +1,1313 @@ +/* $XConsortium: menu.c,v 1.63 94/04/17 20:23:30 gildea Exp $ */ +/* + +Copyright (c) 1989 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +*/ + +#include "ptyx.h" +#include "data.h" +#include "menu.h" +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/SmeLine.h> +#include <stdio.h> +#include <signal.h> + +extern void FindFontSelection(); + +Arg menuArgs[2] = {{ XtNleftBitmap, (XtArgVal) 0 }, + { XtNsensitive, (XtArgVal) 0 }}; + +void do_hangup(); + +static void do_securekbd(), do_allowsends(), do_visualbell(), +#ifdef ALLOWLOGGING + do_logging(), +#endif + do_redraw(), do_suspend(), do_continue(), do_interrupt(), + do_terminate(), do_kill(), do_quit(), do_scrollbar(), do_jumpscroll(), + do_reversevideo(), do_autowrap(), do_reversewrap(), do_autolinefeed(), + do_appcursor(), do_appkeypad(), do_scrollkey(), do_scrollttyoutput(), + do_allow132(), do_cursesemul(), do_marginbell(), do_altscreen(), + do_softreset(), do_hardreset(), do_clearsavedlines(), + do_vthide(), do_vtshow(), do_vtmode(), do_vtfont(), + do_gioenable(), do_tekshow(), do_tekmode(), do_tekpage(), + do_tekreset(), do_tekcopy(), do_tekhide(), do_colortext(); + + +/* + * The order entries MUST match the values given in menu.h + */ +MenuEntry mainMenuEntries[] = { + { "securekbd", do_securekbd, NULL }, /* 0 */ + { "allowsends", do_allowsends, NULL }, /* 1 */ +#ifdef ALLOWLOGGING + { "logging", do_logging, NULL }, /* 2 */ +#endif + { "redraw", do_redraw, NULL }, /* 3 */ + { "line1", NULL, NULL }, /* 4 */ + { "suspend", do_suspend, NULL }, /* 5 */ + { "continue", do_continue, NULL }, /* 6 */ + { "interrupt", do_interrupt, NULL }, /* 7 */ + { "hangup", do_hangup, NULL }, /* 8 */ + { "terminate", do_terminate, NULL }, /* 9 */ + { "kill", do_kill, NULL }, /* 10 */ + { "line2", NULL, NULL }, /* 11 */ + { "quit", do_quit, NULL }}; /* 12 */ + +MenuEntry vtMenuEntries[] = { + { "scrollbar", do_scrollbar, NULL }, /* 0 */ + { "jumpscroll", do_jumpscroll, NULL }, /* 1 */ + { "reversevideo", do_reversevideo, NULL }, /* 2 */ + { "colortext", do_colortext, NULL }, /* 3 */ + { "line1", NULL, NULL }, /* 4 */ + { "gioenable", do_gioenable, NULL }, /* 5 */ + { "tekshow", do_tekshow, NULL }, /* 6 */ + { "tekmode", do_tekmode, NULL }, /* 7 */ + { "tekreset", do_tekreset, NULL }, /* 8 */ + { "vthide", do_vthide, NULL }, /* 9 */ + { "line2", NULL, NULL }, /* 10 */ + { "autowrap", do_autowrap, NULL }, /* 11 */ + { "reversewrap", do_reversewrap, NULL }, /* 12 */ + { "autolinefeed", do_autolinefeed, NULL }, /* 13 */ + { "appcursor", do_appcursor, NULL }, /* 14 */ + { "appkeypad", do_appkeypad, NULL }, /* 15 */ + { "scrollkey", do_scrollkey, NULL }, /* 16 */ + { "scrollttyoutput",do_scrollttyoutput, NULL }, /* 17 */ + { "allow132", do_allow132, NULL }, /* 18 */ + { "cursesemul", do_cursesemul, NULL }, /* 19 */ + { "visualbell", do_visualbell, NULL }, /* 20 */ + { "marginbell", do_marginbell, NULL }, /* 21 */ + { "altscreen", do_altscreen, NULL }, /* 22 */ + { "line3", NULL, NULL }, /* 23 */ + { "softreset", do_softreset, NULL }, /* 24 */ + { "hardreset", do_hardreset, NULL }, /* 25 */ + { "clearsavedlines",do_clearsavedlines, NULL }}; /* 26 */ + +MenuEntry fontMenuEntries[] = { + { "fontdefault", do_vtfont, NULL }, /* 0 */ + { "font1", do_vtfont, NULL }, /* 1 */ + { "font2", do_vtfont, NULL }, /* 2 */ + { "font3", do_vtfont, NULL }, /* 3 */ + { "font4", do_vtfont, NULL }, /* 4 */ + { "font5", do_vtfont, NULL }, /* 5 */ + { "font6", do_vtfont, NULL }, /* 6 */ + { "fontescape", do_vtfont, NULL }, /* 7 */ + { "fontsel", do_vtfont, NULL }}; /* 8 */ + /* this should match NMENUFONTS in ptyx.h */ + +MenuEntry tekMenuEntries[] = { + { "tekpage", do_tekpage, NULL }, /* 0 */ + { "tekhide", do_tekhide, NULL }, /* 1 */ + { "vtshow", do_vtshow, NULL }, /* 2 */ + { "tekreset", do_tekreset, NULL }}; /* 3 */ + +static Widget create_menu(); +extern Widget toplevel; + +/* + * we really want to do these dynamically + */ +#define check_width 9 +#define check_height 8 +static unsigned char check_bits[] = { + 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00, + 0x31, 0x00, 0x1b, 0x00, 0x0e, 0x00, 0x04, 0x00 +}; + + +/* + * public interfaces + */ + +/* ARGSUSED */ +static Bool domenu (w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* mainMenu, vtMenu, or tekMenu */ + Cardinal *param_count; /* 0 or 1 */ +{ + TScreen *screen = &term->screen; + Widget ww; + + if (*param_count != 1) { + XBell (XtDisplay(w), 0); + return False; + } + + switch (params[0][0]) { + case 'm': + if (!screen->mainMenu) { + screen->mainMenu = create_menu (term, toplevel, "mainMenu", + mainMenuEntries, + XtNumber(mainMenuEntries)); + update_securekbd(); + update_allowsends(); +#ifdef ALLOWLOGGING + update_logging(); +#endif +#ifndef SIGTSTP + set_sensitivity (screen->mainMenu, + mainMenuEntries[mainMenu_suspend].widget, FALSE); +#endif +#ifndef SIGCONT + set_sensitivity (screen->mainMenu, + mainMenuEntries[mainMenu_continue].widget, FALSE); +#endif + } + break; + + case 'v': + if (!screen->vtMenu) { + screen->vtMenu = create_menu (term, toplevel, "vtMenu", + vtMenuEntries, + XtNumber(vtMenuEntries)); + /* and turn off the alternate screen entry */ + set_altscreen_sensitivity (FALSE); + update_scrollbar(); + update_jumpscroll(); + update_reversevideo(); + update_colortext(); + update_autowrap(); + update_reversewrap(); + update_autolinefeed(); + update_appcursor(); + update_appkeypad(); + update_scrollkey(); + update_scrollttyoutput(); + update_allow132(); + update_cursesemul(); + update_visualbell(); + update_marginbell(); + update_gioenable(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + } + + /* Update tekshow entry to reflect current graphics application. */ + if (ww = vtMenuEntries[vtMenu_tekshow].widget) { + char *ip, *op, *start; + char label[128]; + + XtVaGetValues (ww, XtNlabel, &ip, NULL); + for (op=label, start=NULL; *op = *ip; op++, ip++) + if (*op == '(') + start = isspace(*(op-1)) ? op - 1 : op; + if (!start) + start = label + strlen(label); + + op = start; + if (gt_status()) { + *op++ = ' '; + *op++ = '('; + for (ip=gtermio_appname; *ip; ) + *op++ = *ip++; + *op++ = ')'; + } + *op = '\0'; + + XtVaSetValues (ww, XtNlabel, label, NULL); + } + break; + + case 'f': + if (!screen->fontMenu) { + screen->fontMenu = create_menu (term, toplevel, "fontMenu", + fontMenuEntries, + NMENUFONTS); + set_menu_font (True); + set_sensitivity (screen->fontMenu, + fontMenuEntries[fontMenu_fontescape].widget, + (screen->menu_font_names[fontMenu_fontescape] + ? TRUE : FALSE)); + } + FindFontSelection (NULL, True); + set_sensitivity (screen->fontMenu, + fontMenuEntries[fontMenu_fontsel].widget, + (screen->menu_font_names[fontMenu_fontsel] + ? TRUE : FALSE)); + break; + + case 't': + if (!screen->tekMenu) { + screen->tekMenu = create_menu (w, gtermio_toplevel, "tekMenu", + tekMenuEntries, + XtNumber(tekMenuEntries)); + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); + } + break; + + default: + XBell (XtDisplay(w), 0); + return False; + } + + return True; +} + +void HandleCreateMenu (w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* mainMenu, vtMenu, or tekMenu */ + Cardinal *param_count; /* 0 or 1 */ +{ + (void) domenu (w, event, params, param_count); +} + +void HandlePopupMenu (w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; /* mainMenu, vtMenu, or tekMenu */ + Cardinal *param_count; /* 0 or 1 */ +{ + if (domenu (w, event, params, param_count)) { + XtCallActionProc (w, "XawPositionSimpleMenu", event, params, 1); + XtCallActionProc (w, "MenuPopup", event, params, 1); + } +} + + +/* + * private interfaces - keep out! + */ + +/* + * create_menu - create a popup shell and stuff the menu into it. + */ + +static Widget create_menu (w, toplevelw, name, entries, nentries) + Widget w; + Widget toplevelw; + char *name; + struct _MenuEntry *entries; + int nentries; +{ + TScreen *screen = &term->screen; + static XtCallbackRec cb[2] = { { NULL, NULL }, { NULL, NULL }}; + static Arg arg = { XtNcallback, (XtArgVal) cb }; + Arg args[10]; + int nargs; + Widget m; + + if (XtDisplay(w) == gtermio_display) { + if (screen->tek_menu_item_bitmap == None) { + screen->tek_menu_item_bitmap = + XCreateBitmapFromData (XtDisplay(w), + RootWindowOfScreen(XtScreen(w)), + (char *)check_bits, check_width, check_height); + } + } else { + if (screen->menu_item_bitmap == None) { + screen->menu_item_bitmap = + XCreateBitmapFromData (XtDisplay(w), + RootWindowOfScreen(XtScreen(w)), + (char *)check_bits, check_width, check_height); + } + } + + m = XtCreatePopupShell (name, simpleMenuWidgetClass, toplevelw, NULL, 0); + + /* The following produces a double line to separate the menu title from + * it's items. It's not in the R6 xterm code but I left it here because + * it's a nice effect. + */ + nargs = 0; + XtSetArg (args[nargs], XtNheight, 2); + nargs++; + XtCreateManagedWidget ("tline1", smeLineObjectClass, m, args, nargs); + XtCreateManagedWidget ("tline2", smeLineObjectClass, m, args, nargs); + + for (; nentries > 0; nentries--, entries++) { + cb[0].callback = (XtCallbackProc) entries->function; + cb[0].closure = (caddr_t) entries->name; + entries->widget = XtCreateManagedWidget (entries->name, + (entries->function ? + smeBSBObjectClass : + smeLineObjectClass), m, + &arg, (Cardinal) 1); + } + + /* do not realize at this point */ + return m; +} + +init_menu (menu) + char *menu; +{ + register TScreen *screen = &term->screen; + register int i; + + switch (menu[0]) { + case 'f': + screen->fontMenu = NULL; + for (i=0; i < XtNumber(fontMenuEntries); i++) + fontMenuEntries[i].widget = NULL; + break; + case 'm': + screen->mainMenu = NULL; + for (i=0; i < XtNumber(mainMenuEntries); i++) + mainMenuEntries[i].widget = NULL; + break; + case 'v': + screen->vtMenu = NULL; + for (i=0; i < XtNumber(vtMenuEntries); i++) + vtMenuEntries[i].widget = NULL; + break; + case 't': + screen->tekMenu = NULL; + for (i=0; i < XtNumber(tekMenuEntries); i++) + tekMenuEntries[i].widget = NULL; + break; + } +} + +/* ARGSUSED */ +static void handle_send_signal (gw, sig) + Widget gw; + int sig; +{ + register TScreen *screen = &term->screen; + + if (screen->pid > 1) kill_process_group (screen->pid, sig); +} + + +/* + * action routines + */ + +/* ARGSUSED */ +void DoSecureKeyboard (time) + Time time; +{ + do_securekbd (term->screen.mainMenu, NULL, NULL); +} + +static void do_securekbd (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + Time time = CurrentTime; /* XXX - wrong */ + + if (screen->grabbedKbd) { + XUngrabKeyboard (screen->display, time); + ReverseVideo (term); + screen->grabbedKbd = FALSE; + } else { + if (XGrabKeyboard (screen->display, term->core.window, + True, GrabModeAsync, GrabModeAsync, time) + != GrabSuccess) { + XBell (screen->display, 100); + } else { + ReverseVideo (term); + screen->grabbedKbd = TRUE; + } + } + update_securekbd(); +} + + +static void do_allowsends (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + /* + screen->allowSendEvents = !screen->allowSendEvents; + update_allowsends (); + */ +} + +static void do_visualbell (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + screen->visualbell = !screen->visualbell; + update_visualbell(); +} + +#ifdef ALLOWLOGGING +static void do_logging (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + if (screen->logging) { + CloseLog (screen); + } else { + StartLog (screen); + } + /* update_logging done by CloseLog and StartLog */ +} +#endif + +static void do_redraw (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + Redraw (); +} + + +/* + * The following cases use the pid instead of the process group so that we + * don't get hosed by programs that change their process group + */ + + +/* ARGSUSED */ +static void do_suspend (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ +#ifdef SIGTSTP + handle_send_signal (gw, SIGTSTP); +#endif +} + +/* ARGSUSED */ +static void do_continue (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ +#ifdef SIGCONT + handle_send_signal (gw, SIGCONT); +#endif +} + +/* ARGSUSED */ +static void do_interrupt (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_send_signal (gw, SIGINT); +} + +/* ARGSUSED */ +void do_hangup (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_send_signal (gw, SIGHUP); +} + +/* ARGSUSED */ +static void do_terminate (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_send_signal (gw, SIGTERM); +} + +/* ARGSUSED */ +static void do_kill (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_send_signal (gw, SIGKILL); +} + +static void do_quit (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + Cleanup (0); +} + + + +/* + * vt menu callbacks + */ + +static void do_scrollbar (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + if (screen->scrollbar) { + ScrollBarOff (screen); + } else { + ScrollBarOn (term, FALSE, FALSE); + } + update_scrollbar(); +} + + +static void do_jumpscroll (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + term->flags ^= SMOOTHSCROLL; + if (term->flags & SMOOTHSCROLL) { + screen->jumpscroll = FALSE; + if (screen->scroll_amt) FlushScroll(screen); + } else { + screen->jumpscroll = TRUE; + } + update_jumpscroll(); +} + + +static void do_reversevideo (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->flags ^= REVERSE_VIDEO; + ReverseVideo (term); + /* update_reversevideo done in ReverseVideo */ +} + + +static void do_colortext (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->misc.dynamicColors = !term->misc.dynamicColors; + update_colortext (); + Redraw (); +} + + +static void do_autowrap (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->flags ^= WRAPAROUND; + update_autowrap(); +} + + +static void do_reversewrap (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->flags ^= REVERSEWRAP; + update_reversewrap(); +} + + +static void do_autolinefeed (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->flags ^= LINEFEED; + update_autolinefeed(); +} + + +static void do_appcursor (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->keyboard.flags ^= CURSOR_APL; + update_appcursor(); +} + + +static void do_appkeypad (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + term->keyboard.flags ^= KYPD_APL; + update_appkeypad(); +} + + +static void do_scrollkey (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + screen->scrollkey = !screen->scrollkey; + update_scrollkey(); +} + + +static void do_scrollttyoutput (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + screen->scrollttyoutput = !screen->scrollttyoutput; + update_scrollttyoutput(); +} + + +static void do_allow132 (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + screen->c132 = !screen->c132; + update_allow132(); +} + + +static void do_cursesemul (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + screen->curses = !screen->curses; + update_cursesemul(); +} + + +static void do_marginbell (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + if (!(screen->marginbell = !screen->marginbell)) screen->bellarmed = -1; + update_marginbell(); +} + + +static void do_altscreen (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + /* do nothing for now; eventually, will want to flip screen */ +} + + +static void do_softreset (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + VTReset (FALSE); +} + + +static void do_hardreset (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + gt_reset(); + VTReset (TRUE); /* does a longjmp */ +} + + +static void do_clearsavedlines (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + screen->savedlines = 0; + ScrollBarDrawThumb(screen->scrollWidget); + VTReset (TRUE); /* does a longjmp */ +} + +/* ARGSUSED */ +static void do_gioenable (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + gt_enable (!gt_enable(2)); + update_gioenable(); +} + +/* ARGSUSED */ +static void do_tekmode (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + switch_modes (gt_tekmode(2)); /* switch to tek mode */ +} + +static void handle_tekshow (gw, allowswitch) + Widget gw; + Bool allowswitch; +{ + register TScreen *screen = &term->screen; + + if (!gt_activated()) { /* not showing, turn on */ + set_tek_visibility (TRUE); + } else if (screen->Vshow || allowswitch) { /* is showing, turn off */ + set_tek_visibility (FALSE); + } else + Bell(); +} + +/* ARGSUSED */ +static void do_tekshow (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_tekshow (gw, True); +} + +/* ARGSUSED */ +static void do_tekonoff (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_tekshow (gw, False); +} + + +/* ARGSUSED */ +static void do_vthide (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + hide_vt_window(); +} + + +/* + * vtfont menu + */ + +static void do_vtfont (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + char *entryname = (char *) closure; + int i; + + for (i = 0; i < NMENUFONTS; i++) { + if (strcmp (entryname, fontMenuEntries[i].name) == 0) { + SetVTFont (i, True, NULL, NULL); + return; + } + } + Bell(); +} + + +/* + * tek menu + */ + + +static void do_tekpage (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + gt_clear(); +} + + +static void do_tekreset (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + gt_reset(); + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); +} + + +static void do_tekcopy (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + /* TekCopy (); */ +} + + +static void handle_vtshow (gw, allowswitch) + Widget gw; + Bool allowswitch; +{ + register TScreen *screen = &term->screen; + + if (!screen->Vshow) { /* not showing, turn on */ + set_vt_visibility (TRUE); + } else if (gt_activated() || allowswitch) { /* is showing, turn off */ + set_vt_visibility (FALSE); + end_vt_mode (); + } else + Bell(); +} + +static void do_vtshow (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_vtshow (gw, True); +} + +static void do_vtonoff (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + handle_vtshow (gw, False); +} + +static void do_vtmode (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + register TScreen *screen = &term->screen; + + switch_modes (gt_activated()); /* switch to vt, or from */ +} + + +/* ARGSUSED */ +static void do_tekhide (gw, closure, data) + Widget gw; + caddr_t closure, data; +{ + gt_deactivate(); + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); +} + + + +/* + * public handler routines + */ + +static void handle_toggle (proc, var, params, nparams, w, closure, data) + void (*proc)(); + int var; + String *params; + Cardinal nparams; + Widget w; + caddr_t closure, data; +{ + int dir = -2; + + switch (nparams) { + case 0: + dir = -1; + break; + case 1: + if (XmuCompareISOLatin1 (params[0], "on") == 0) dir = 1; + else if (XmuCompareISOLatin1 (params[0], "off") == 0) dir = 0; + else if (XmuCompareISOLatin1 (params[0], "toggle") == 0) dir = -1; + break; + } + + switch (dir) { + case -2: + Bell(); + break; + + case -1: + (*proc) (w, closure, data); + break; + + case 0: + if (var) (*proc) (w, closure, data); + else Bell(); + break; + + case 1: + if (!var) (*proc) (w, closure, data); + else Bell(); + break; + } + return; +} + +void HandleAllowSends(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + /* Currently since we use Xt event processing we cannot easily disable + * sendevents as is done in xevent(). + * + handle_toggle (do_allowsends, (int) term->screen.allowSendEvents, + params, *param_count, w, NULL, NULL); + */ +} + +void HandleSetVisualBell(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_visualbell, (int) term->screen.visualbell, + params, *param_count, w, NULL, NULL); +} + +#ifdef ALLOWLOGGING +void HandleLogging(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_logging, (int) term->screen.logging, + params, *param_count, w, NULL, NULL); +} +#endif + +/* ARGSUSED */ +void HandleRedraw(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_redraw(w, NULL, NULL); +} + +/* ARGSUSED */ +void HandleSendSignal(w, event, params, param_count) + Widget w; + XEvent *event; /* unused */ + String *params; + Cardinal *param_count; +{ + static struct sigtab { + char *name; + int sig; + } signals[] = { +#ifdef SIGTSTP + { "suspend", SIGTSTP }, + { "tstp", SIGTSTP }, +#endif +#ifdef SIGCONT + { "cont", SIGCONT }, +#endif + { "int", SIGINT }, + { "hup", SIGHUP }, + { "quit", SIGQUIT }, + { "alrm", SIGALRM }, + { "alarm", SIGALRM }, + { "term", SIGTERM }, + { "kill", SIGKILL }, + { NULL, 0 }, + }; + + if (*param_count == 1) { + struct sigtab *st; + + for (st = signals; st->name; st++) { + if (XmuCompareISOLatin1 (st->name, params[0]) == 0) { + handle_send_signal (w, st->sig); + return; + } + } + /* one could allow numeric values, but that would be a security hole */ + } + + Bell(); +} + +/* ARGSUSED */ +void HandleQuit(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_quit(w, NULL, NULL); +} + +void HandleScrollbar(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_scrollbar, (int) term->screen.scrollbar, + params, *param_count, w, NULL, NULL); +} + +void HandleJumpscroll(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_jumpscroll, (int) term->screen.jumpscroll, + params, *param_count, w, NULL, NULL); +} + +void HandleReverseVideo(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_reversevideo, (int) (term->flags & REVERSE_VIDEO), + params, *param_count, w, NULL, NULL); +} + +void HandleAutoWrap(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_autowrap, (int) (term->flags & WRAPAROUND), + params, *param_count, w, NULL, NULL); +} + +void HandleReverseWrap(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_reversewrap, (int) (term->flags & REVERSEWRAP), + params, *param_count, w, NULL, NULL); +} + +void HandleAutoLineFeed(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_autolinefeed, (int) (term->flags & LINEFEED), + params, *param_count, w, NULL, NULL); +} + +void HandleAppCursor(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_appcursor, (int) (term->keyboard.flags & CURSOR_APL), + params, *param_count, w, NULL, NULL); +} + +void HandleAppKeypad(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_appkeypad, (int) (term->keyboard.flags & KYPD_APL), + params, *param_count, w, NULL, NULL); +} + +void HandleScrollKey(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_scrollkey, (int) term->screen.scrollkey, + params, *param_count, w, NULL, NULL); +} + +void HandleScrollTtyOutput(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_scrollttyoutput, (int) term->screen.scrollttyoutput, + params, *param_count, w, NULL, NULL); +} + +void HandleAllow132(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_allow132, (int) term->screen.c132, + params, *param_count, w, NULL, NULL); +} + +void HandleCursesEmul(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_cursesemul, (int) term->screen.curses, + params, *param_count, w, NULL, NULL); +} + +void HandleMarginBell(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + handle_toggle (do_marginbell, (int) term->screen.marginbell, + params, *param_count, w, NULL, NULL); +} + +void HandleAltScreen(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + /* eventually want to see if sensitive or not */ + handle_toggle (do_altscreen, (int) term->screen.alternate, + params, *param_count, w, NULL, NULL); +} + +/* ARGSUSED */ +void HandleSoftReset(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_softreset(w, NULL, NULL); +} + +/* ARGSUSED */ +void HandleHardReset(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_hardreset(w, NULL, NULL); +} + +/* ARGSUSED */ +void HandleClearSavedLines(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_clearsavedlines(w, NULL, NULL); +} + +void HandleSetTerminalType(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + if (*param_count == 1) { + switch (params[0][0]) { + case 'v': case 'V': + if (gt_activated()) do_vtmode (w, NULL, NULL); + break; + case 't': case 'T': + if (!gt_activated()) do_tekmode (w, NULL, NULL); + break; + default: + Bell(); + } + } else { + Bell(); + } +} + +void HandleVisibility(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + if (*param_count == 2) { + switch (params[0][0]) { + case 'v': case 'V': + handle_toggle (do_vtonoff, (int) term->screen.Vshow, + params+1, (*param_count) - 1, w, NULL, NULL); + break; + case 't': case 'T': + handle_toggle (do_tekonoff, (int) gt_activated(), + params+1, (*param_count) - 1, w, NULL, NULL); + break; + default: + Bell(); + } + } else { + Bell(); + } +} + +/* ARGSUSED */ +void HandleTekPage(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_tekpage(w, NULL, NULL); +} + +/* ARGSUSED */ +void HandleTekReset(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_tekreset(w, NULL, NULL); +} + +/* ARGSUSED */ +void HandleTekCopy(w, event, params, param_count) + Widget w; + XEvent *event; + String *params; + Cardinal *param_count; +{ + do_tekcopy(w, NULL, NULL); +} diff --git a/vendor/x11iraf/xgterm/menu.h b/vendor/x11iraf/xgterm/menu.h new file mode 100644 index 00000000..4b7d01e3 --- /dev/null +++ b/vendor/x11iraf/xgterm/menu.h @@ -0,0 +1,311 @@ +/* $XConsortium: menu.h,v 1.24 93/02/25 17:21:31 gildea Exp $ */ + +/* Copyright 1989 Massachusetts Institute of Technology */ + +/* +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. M.I.T. makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. +*/ + +typedef struct _MenuEntry { + char *name; + void (*function)(); + Widget widget; +} MenuEntry; + +extern MenuEntry mainMenuEntries[], vtMenuEntries[], tekMenuEntries[]; +extern MenuEntry fontMenuEntries[]; +extern Arg menuArgs[]; + +extern void HandleAllowSends(); +extern void HandleSetVisualBell(); +#ifdef ALLOWLOGGING +extern void HandleLogging(); +#endif +extern void HandleRedraw(); +extern void HandleSendSignal(); +extern void HandleQuit(); +extern void HandleScrollbar(); +extern void HandleJumpscroll(); +extern void HandleReverseVideo(); +extern void HandleColorText(); +extern void HandleAutoWrap(); +extern void HandleReverseWrap(); +extern void HandleAutoLineFeed(); +extern void HandleAppCursor(); +extern void HandleAppKeypad(); +extern void HandleScrollKey(); +extern void HandleScrollTtyOutput(); +extern void HandleAllow132(); +extern void HandleCursesEmul(); +extern void HandleMarginBell(); +extern void HandleAltScreen(); +extern void HandleSoftReset(); +extern void HandleHardReset(); +extern void HandleClearSavedLines(); +extern void HandleSetTerminalType(); +extern void HandleVisibility(); +extern void HandleTekPage(); +extern void HandleTekReset(); +extern void HandleTekCopy(); +extern void DoSecureKeyboard(); + +/* + * The following definitions MUST match the order of entries given in + * the mainMenuEntries, vtMenuEntries, and tekMenuEntries arrays in menu.c. + */ + +/* + * items in primary menu + */ +#define mainMenu_securekbd 0 +#define mainMenu_allowsends 1 +#ifdef ALLOWLOGGING +#define mainMenu_logging 2 +#endif +#define mainMenu_redraw 3 +#define mainMenu_line1 4 +#define mainMenu_suspend 5 +#define mainMenu_continue 6 +#define mainMenu_interrupt 7 +#define mainMenu_hangup 8 +#define mainMenu_terminate 9 +#define mainMenu_kill 10 +#define mainMenu_line2 11 +#define mainMenu_quit 12 + +/* + * items in vt100 mode menu + */ +#define vtMenu_scrollbar 0 +#define vtMenu_jumpscroll 1 +#define vtMenu_reversevideo 2 +#define vtMenu_colortext 3 +#define vtMenu_line1 4 +#define vtMenu_gioenable 5 +#define vtMenu_tekshow 6 +#define vtMenu_tekmode 7 +#define vtMenu_tekreset 8 +#define vtMenu_vthide 9 +#define vtMenu_line2 10 +#define vtMenu_autowrap 11 +#define vtMenu_reversewrap 12 +#define vtMenu_autolinefeed 13 +#define vtMenu_appcursor 14 +#define vtMenu_appkeypad 15 +#define vtMenu_scrollkey 16 +#define vtMenu_scrollttyoutput 17 +#define vtMenu_allow132 18 +#define vtMenu_cursesemul 19 +#define vtMenu_visualbell 20 +#define vtMenu_marginbell 21 +#define vtMenu_altscreen 22 +#define vtMenu_line3 23 +#define vtMenu_softreset 24 +#define vtMenu_hardreset 25 +#define vtMenu_clearsavedlines 26 + +/* + * items in vt100 font menu + */ +#define fontMenu_fontdefault 0 +#define fontMenu_font1 1 +#define fontMenu_font2 2 +#define fontMenu_font3 3 +#define fontMenu_font4 4 +#define fontMenu_font5 5 +#define fontMenu_font6 6 +#define fontMenu_lastBuiltin fontMenu_font6 +#define fontMenu_fontescape 7 +#define fontMenu_fontsel 8 +/* number of non-line items should match NMENUFONTS in ptyx.h */ + + + +/* + * items in tek4014 mode menu + */ +#define tekMenu_tekpage 0 +#define tekMenu_tekhide 1 +#define tekMenu_vtshow 2 +#define tekMenu_tekreset 3 + + +/* + * macros for updating menus + */ + +#define update_menu_item(w,mi,val) { if (mi) { \ + menuArgs[0].value = (XtArgVal) ( \ + (val) ? \ + ((XtDisplay(w) == gtermio_display) ? \ + term->screen.tek_menu_item_bitmap \ + : term->screen.menu_item_bitmap) \ + : None \ + ); \ + XtSetValues (mi, menuArgs, (Cardinal) 1); }} + + +#define set_sensitivity(w,mi,val) { if (mi) { \ + menuArgs[1].value = (XtArgVal) (val); \ + XtSetValues (mi, menuArgs+1, (Cardinal) 1); }} + + + +/* + * there should be one of each of the following for each checkable item + */ + + +#define update_securekbd() \ + update_menu_item (term->screen.mainMenu, \ + mainMenuEntries[mainMenu_securekbd].widget, \ + term->screen.grabbedKbd) + +#define update_allowsends() \ + update_menu_item (term->screen.mainMenu, \ + mainMenuEntries[mainMenu_allowsends].widget, \ + term->screen.allowSendEvents) + +#ifdef ALLOWLOGGING +#define update_logging() \ + update_menu_item (term->screen.mainMenu, \ + mainMenuEntries[mainMenu_logging].widget, \ + term->screen.logging) +#endif + +#define update_scrollbar() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_scrollbar].widget, \ + term->screen.scrollbar) + +#define update_jumpscroll() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_jumpscroll].widget, \ + term->screen.jumpscroll) + +#define update_reversevideo() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_reversevideo].widget, \ + (term->flags & REVERSE_VIDEO)) + +#define update_colortext() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_colortext].widget, \ + term->misc.dynamicColors) + +#define update_autowrap() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_autowrap].widget, \ + (term->flags & WRAPAROUND)) + +#define update_reversewrap() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_reversewrap].widget, \ + (term->flags & REVERSEWRAP)) + +#define update_autolinefeed() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_autolinefeed].widget, \ + (term->flags & LINEFEED)) + +#define update_appcursor() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_appcursor].widget, \ + (term->keyboard.flags & CURSOR_APL)) + +#define update_appkeypad() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_appkeypad].widget, \ + (term->keyboard.flags & KYPD_APL)) + +#define update_scrollkey() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_scrollkey].widget, \ + term->screen.scrollkey) + +#define update_scrollttyoutput() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_scrollttyoutput].widget, \ + term->screen.scrollttyoutput) + +#define update_allow132() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_allow132].widget, \ + term->screen.c132) + +#define update_cursesemul() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_cursesemul].widget, \ + term->screen.curses) + +#define update_visualbell() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_visualbell].widget, \ + term->screen.visualbell) + +#define update_marginbell() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_marginbell].widget, \ + term->screen.marginbell) + +#define update_gioenable() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_gioenable].widget, \ + gt_enable(2)) + +#define update_tekshow() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_tekshow].widget, \ + gt_activated()) + +#define update_tekreset() \ + set_sensitivity (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_tekreset].widget, \ + gt_status()) + +#define update_vttekmode() { \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_tekmode].widget, \ + gt_tekmode(2)); } + +#define update_vtshow() \ + update_menu_item (term->screen.tekMenu, \ + tekMenuEntries[tekMenu_vtshow].widget, \ + term->screen.Vshow) + +#define set_vthide_sensitivity() \ + set_sensitivity (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_vthide].widget, \ + gt_activated()) + +#define set_tekhide_sensitivity() \ + set_sensitivity (term->screen.tekMenu, \ + tekMenuEntries[tekMenu_tekhide].widget, \ + term->screen.Vshow) + +#define set_tekreset_sensitivity() \ + set_sensitivity (term->screen.tekMenu, \ + tekMenuEntries[tekMenu_tekreset].widget, \ + term->screen.Vshow) + +#define update_altscreen() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_altscreen].widget, \ + term->screen.alternate) + +#define set_altscreen_sensitivity(val) \ + set_sensitivity (term->screen.vtMenu,\ + vtMenuEntries[vtMenu_altscreen].widget, (val)) + +#define set_menu_font(val) \ + update_menu_item (term->screen.fontMenu, \ + fontMenuEntries[term->screen.menu_font_number].widget, \ + (val)) diff --git a/vendor/x11iraf/xgterm/misc.c b/vendor/x11iraf/xgterm/misc.c new file mode 100644 index 00000000..66d752ac --- /dev/null +++ b/vendor/x11iraf/xgterm/misc.c @@ -0,0 +1,1530 @@ +/* + * $XConsortium: misc.c,v 1.102 94/03/28 18:27:08 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "ptyx.h" /* X headers included here. */ + +#include <X11/Xos.h> +#include <stdio.h> +#include <setjmp.h> +#include <signal.h> +#include <ctype.h> +#include <pwd.h> +#include <errno.h> + +#include <X11/Xatom.h> +#include <X11/cursorfont.h> + +#include <X11/Shell.h> +#include <X11/Xmu/Error.h> +#include <X11/Xmu/SysUtil.h> +#include <X11/Xmu/WinUtil.h> + +#include "data.h" +#include "error.h" +#include "menu.h" +#include "gtermio.h" + +extern jmp_buf VTend; + +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#else +extern char *malloc(); +extern char *getenv(); +#endif + +static void DoSpecialEnterNotify(); +static void DoSpecialLeaveNotify(); + +extern XtAppContext app_con; + +xevents() +{ + XEvent event; + XtInputMask input_mask; + register TScreen *screen = &term->screen; + + if(screen->scroll_amt) + FlushScroll(screen); + /* + * process timeouts, relying on the fact that XtAppProcessEvent + * will process the timeout and return without blockng on the + * XEvent queue. Other sources i.e. the pty are handled elsewhere + * with select(). + */ + while ((input_mask = XtAppPending(app_con)) & XtIMTimer) + XtAppProcessEvent(app_con, XtIMTimer); + /* + * If there's no XEvents, don't wait around... + */ + if ((input_mask & XtIMXEvent) != XtIMXEvent) + return; + do { + if (waitingForTrackInfo) + return; + XtAppNextEvent (app_con, &event); + /* + * Hack to get around problems with the toolkit throwing away + * eventing during the exclusive grab of the menu popup. By + * looking at the event ourselves we make sure that we can + * do the right thing. + */ + if (event.type == EnterNotify && + (event.xcrossing.window == XtWindow(XtParent(term)))) + DoSpecialEnterNotify (&event.xcrossing); + else if (event.type == LeaveNotify && + (event.xcrossing.window == XtWindow(XtParent(term)))) + DoSpecialLeaveNotify (&event.xcrossing); + + if (!event.xany.send_event || + screen->allowSendEvents || + ((event.xany.type != KeyPress) && + (event.xany.type != KeyRelease) && + (event.xany.type != ButtonPress) && + (event.xany.type != ButtonRelease))) + XtDispatchEvent(&event); + } while ((input_mask = XtAppPending(app_con)) & XtIMXEvent); +} + + +Cursor make_colored_cursor (cursorindex, fg, bg) + int cursorindex; /* index into font */ + unsigned long fg, bg; /* pixel value */ +{ + register TScreen *screen = &term->screen; + Cursor c; + register Display *dpy = screen->display; + + c = XCreateFontCursor (dpy, cursorindex); + if (c == (Cursor) 0) return (c); + + recolor_cursor (c, fg, bg); + return (c); +} + +/* ARGSUSED */ +void HandleKeyPressed(w, event, params, nparams) + Widget w; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register TScreen *screen = &term->screen; + +#ifdef ACTIVEWINDOWINPUTONLY + if (w == (Widget)term) +#endif + Input (&term->keyboard, screen, &event->xkey, False); +} +/* ARGSUSED */ +void HandleEightBitKeyPressed(w, event, params, nparams) + Widget w; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register TScreen *screen = &term->screen; + +#ifdef ACTIVEWINDOWINPUTONLY + if (w == (Widget)term) +#endif + Input (&term->keyboard, screen, &event->xkey, True); +} + +/* ARGSUSED */ +void HandleStringEvent(w, event, params, nparams) + Widget w; + XEvent *event; + String *params; + Cardinal *nparams; +{ + register TScreen *screen = &term->screen; + +#ifdef ACTIVEWINDOWINPUTONLY + if (w != (Widget)term) + return; +#endif + + if (*nparams != 1) return; + + if ((*params)[0] == '0' && (*params)[1] == 'x' && (*params)[2] != '\0') { + char c, *p, hexval[2]; + hexval[0] = hexval[1] = 0; + for (p = *params+2; (c = *p); p++) { + hexval[0] *= 16; + if (isupper(c)) c = tolower(c); + if (c >= '0' && c <= '9') + hexval[0] += c - '0'; + else if (c >= 'a' && c <= 'f') + hexval[0] += c - 'a' + 10; + else break; + } + if (c == '\0') + StringInput (screen, hexval, 1); + } + else { + StringInput (screen, *params, strlen(*params)); + } +} + +static void DoSpecialEnterNotify (ev) + register XEnterWindowEvent *ev; +{ + register TScreen *screen = &term->screen; + +#ifdef ACTIVEWINDOWINPUTONLY + if (ev->window == (Widget)term) +#endif + if (((ev->detail) != NotifyInferior) && + ev->focus && + !(screen->select & FOCUS)) + selectwindow(screen, INWINDOW); +} + +/*ARGSUSED*/ +void HandleEnterWindow(w, eventdata, event) +Widget w; +register XEnterWindowEvent *event; +caddr_t eventdata; +{ + /* This code is necessary as xevent does not see all events anymore. */ + XEvent *ev = (XEvent *) event; + if (ev->type == EnterNotify && + (ev->xcrossing.window == XtWindow(XtParent(term)))) + DoSpecialEnterNotify (&ev->xcrossing); +} + + +static void DoSpecialLeaveNotify (ev) + register XEnterWindowEvent *ev; +{ + register TScreen *screen = &term->screen; + +#ifdef ACTIVEWINDOWINPUTONLY + if (ev->window == (Widget)term) +#endif + if (((ev->detail) != NotifyInferior) && + ev->focus && + !(screen->select & FOCUS)) + unselectwindow(screen, INWINDOW); +} + + +/*ARGSUSED*/ +void HandleLeaveWindow(w, eventdata, event) +Widget w; +register XEnterWindowEvent *event; +caddr_t eventdata; +{ + /* This code is necessary as xevent does not see all events anymore. */ + XEvent *ev = (XEvent *) event; + if (ev->type == LeaveNotify && + (ev->xcrossing.window == XtWindow(XtParent(term)))) + DoSpecialLeaveNotify (&ev->xcrossing); +} + + +/*ARGSUSED*/ +void HandleFocusChange(w, eventdata, event) +Widget w; +register XFocusChangeEvent *event; +caddr_t eventdata; +{ + register TScreen *screen = &term->screen; + + if(event->type == FocusIn) + selectwindow(screen, + (event->detail == NotifyPointer) ? INWINDOW : + FOCUS); + else { + unselectwindow(screen, + (event->detail == NotifyPointer) ? INWINDOW : + FOCUS); + if (screen->grabbedKbd && (event->mode == NotifyUngrab)) { + XBell(screen->display, 100); + ReverseVideo(term); + screen->grabbedKbd = FALSE; + update_securekbd(); + } + } +} + + + +selectwindow(screen, flag) +register TScreen *screen; +register int flag; +{ +#ifdef I18N + if (screen->xic) + XSetICFocus(screen->xic); +#endif + if(screen->cursor_state && + (screen->cursor_col != screen->cur_col || + screen->cursor_row != screen->cur_row)) + HideCursor(); + screen->select |= flag; + if(screen->cursor_state) + ShowCursor(); + return; +} + +unselectwindow(screen, flag) +register TScreen *screen; +register int flag; +{ + if (screen->always_highlight) return; + +#ifdef I18N + if (screen->xic) + XUnsetICFocus(screen->xic); +#endif + screen->select &= ~flag; + if(screen->cursor_state && + (screen->cursor_col != screen->cur_col || + screen->cursor_row != screen->cur_row)) + HideCursor(); + if(screen->cursor_state) + ShowCursor(); +} + +static long lastBellTime; /* in milliseconds */ + +Bell() +{ + extern XgtermWidget term; + register TScreen *screen = &term->screen; + struct timeval curtime; + long now_msecs; + + /* has enough time gone by that we are allowed to ring + the bell again? */ + if(screen->bellSuppressTime) { + if(screen->bellInProgress) { + if (XtAppPending(app_con) || + GetBytesAvailable (ConnectionNumber(screen->display)) > 0) + xevents(); + if(screen->bellInProgress) { /* even after new events? */ + return; + } + } +#ifdef X_GETTIMEOFDAY + X_GETTIMEOFDAY(&curtime); +#else + gettimeofday(&curtime, NULL); +#endif + now_msecs = 1000*curtime.tv_sec + curtime.tv_usec/1000; + if(lastBellTime != 0 && now_msecs - lastBellTime >= 0 && + now_msecs - lastBellTime < screen->bellSuppressTime) { + return; + } + lastBellTime = now_msecs; + } + + if (screen->visualbell) + VisualBell(); + else + XBell(screen->display, 0); + + if(screen->bellSuppressTime) { + /* now we change a property and wait for the notify event to come + back. If the server is suspending operations while the bell + is being emitted (problematic for audio bell), this lets us + know when the previous bell has finished */ + Widget w = (Widget) term; + XChangeProperty(XtDisplay(w), XtWindow(w), + XA_NOTICE, XA_NOTICE, 8, PropModeAppend, NULL, 0); + screen->bellInProgress = TRUE; + } +} + + +VisualBell() +{ + extern XgtermWidget term; + register TScreen *screen = &term->screen; + register Pixel xorPixel = screen->foreground ^ term->core.background_pixel; + XGCValues gcval; + GC visualGC; + + gcval.function = GXxor; + gcval.foreground = xorPixel; + visualGC = XtGetGC((Widget)term, GCFunction+GCForeground, &gcval); + XFillRectangle( + screen->display, + VWindow(screen), + visualGC, + 0, 0, + (unsigned) FullWidth(screen), + (unsigned) FullHeight(screen)); + XFlush(screen->display); + XFillRectangle( + screen->display, + VWindow(screen), + visualGC, + 0, 0, + (unsigned) FullWidth(screen), + (unsigned) FullHeight(screen)); +} + +/* ARGSUSED */ +void HandleBellPropertyChange(w, data, ev, more) + Widget w; + XtPointer data; + XEvent *ev; + Boolean *more; +{ + register TScreen *screen = &term->screen; + + if (ev->xproperty.atom == XA_NOTICE) { + screen->bellInProgress = FALSE; + } +} + +Redraw() +{ + extern XgtermWidget term; + register TScreen *screen = &term->screen; + XExposeEvent event; + + event.type = Expose; + event.display = screen->display; + event.x = 0; + event.y = 0; + event.count = 0; + + if (VWindow(screen)) { + event.window = VWindow(screen); + event.width = term->core.width; + event.height = term->core.height; + (*term->core.widget_class->core_class.expose) ( + (Widget)term, (XEvent *)&event, NULL); + if (screen->scrollbar) + (*screen->scrollWidget->core.widget_class->core_class.expose) ( + screen->scrollWidget, (XEvent *)&event, NULL); + } +} + +#if defined(ALLOWLOGGING) || defined(DEBUG) + +#ifndef X_NOT_POSIX +#define HAS_WAITPID +#endif + +/* + * create a file only if we could with the permissions of the real user id. + * We could emulate this with careful use of access() and following + * symbolic links, but that is messy and has race conditions. + * Forking is messy, too, but we can't count on setreuid() or saved set-uids + * being available. + */ +void +creat_as(uid, gid, pathname, mode) + int uid; + int gid; + char *pathname; + int mode; +{ + int fd; + int waited; + int pid; +#ifndef HAS_WAITPID + int (*chldfunc)(); + + chldfunc = signal(SIGCHLD, SIG_DFL); +#endif + pid = fork(); + switch (pid) + { + case 0: /* child */ + setgid(gid); + setuid(uid); + fd = open(pathname, O_WRONLY|O_CREAT|O_APPEND, mode); + if (fd >= 0) { + close(fd); + _exit(0); + } else + _exit(1); + case -1: /* error */ + return; + default: /* parent */ +#ifdef HAS_WAITPID + waitpid(pid, NULL, 0); +#else + waited = wait(NULL); + signal(SIGCHLD, chldfunc); + /* + Since we had the signal handler uninstalled for a while, + we might have missed the termination of our screen child. + If we can check for this possibility without hanging, do so. + */ + do + if (waited == term->screen.pid) + Cleanup(0); + while ( (waited=nonblocking_wait()) > 0); +#endif + } +} +#endif + +#ifdef ALLOWLOGGING +/* + * logging is a security hole, since it allows a setuid program to + * write arbitrary data to an arbitrary file. So it is disabled + * by default. + */ + +StartLog(screen) +register TScreen *screen; +{ + register char *cp; + register int i; + static char *log_default; +#ifdef ALLOWLOGFILEEXEC + void logpipe(); +#ifdef SYSV + /* SYSV has another pointer which should be part of the + ** FILE structure but is actually a separate array. + */ + unsigned char *old_bufend; +#endif /* SYSV */ +#endif /* ALLOWLOGFILEEXEC */ + + if(screen->logging || (screen->inhibit & I_LOG)) + return; + if(screen->logfile == NULL || *screen->logfile == 0) { + if(screen->logfile) + free(screen->logfile); + if(log_default == NULL) + log_default = log_def_name; + mkstemp(log_default); + if((screen->logfile = malloc((unsigned)strlen(log_default) + 1)) == NULL) + return; + strcpy(screen->logfile, log_default); + } + if(*screen->logfile == '|') { /* exec command */ +#ifdef ALLOWLOGFILEEXEC + /* + * Warning, enabling this "feature" allows arbitrary programs + * to be run. If ALLOWLOGFILECHANGES is enabled, this can be + * done through escape sequences.... You have been warned. + */ + int p[2]; + static char *shell; + + if(pipe(p) < 0 || (i = fork()) < 0) + return; + if(i == 0) { /* child */ + close(p[1]); + dup2(p[0], 0); + close(p[0]); + dup2(fileno(stderr), 1); + dup2(fileno(stderr), 2); +#ifdef SYSV + old_bufend = _bufend(stderr); +#endif /* SYSV */ + close(fileno(stderr)); + stderr->_file = 2; +#ifdef SYSV + _bufend(stderr) = old_bufend; +#endif /* SYSV */ + close(ConnectionNumber(screen->display)); + close(screen->respond); + if(!shell) { + register struct passwd *pw; + struct passwd *getpwuid(); + + if(((cp = getenv("SHELL")) == NULL || *cp == 0) + && ((pw = getpwuid(screen->uid)) == NULL || + *(cp = pw->pw_shell) == 0) || + (shell = malloc((unsigned) strlen(cp) + 1)) == NULL) + shell = "/bin/sh"; + else + strcpy(shell, cp); + } + signal(SIGHUP, SIG_DFL); + signal(SIGCHLD, SIG_DFL); + setgid(screen->gid); + setuid(screen->uid); + execl(shell, shell, "-c", &screen->logfile[1], 0); + fprintf(stderr, "%s: Can't exec `%s'\n", xgterm_name, + &screen->logfile[1]); + exit(ERROR_LOGEXEC); + } + close(p[0]); + screen->logfd = p[1]; + signal(SIGPIPE, logpipe); +#else + Bell(); + Bell(); + return; +#endif + } else { + if(access(screen->logfile, F_OK) != 0) { + if (errno == ENOENT) + creat_as(screen->uid, screen->gid, + screen->logfile, 0644); + else + return; + } + + if(access(screen->logfile, F_OK) != 0 + || access(screen->logfile, W_OK) != 0) + return; + if((screen->logfd = open(screen->logfile, O_WRONLY | O_APPEND, + 0644)) < 0) + return; + } + screen->logstart = bptr; + screen->logging = TRUE; + update_logging(); +} + +CloseLog(screen) +register TScreen *screen; +{ + if(!screen->logging || (screen->inhibit & I_LOG)) + return; + FlushLog(screen); + close(screen->logfd); + screen->logging = FALSE; + update_logging(); +} + +FlushLog(screen) +register TScreen *screen; +{ + register Char *cp; + register int i; + +/* + * With xgterm pty input is read only in one place, hence logging is done + * immediately upon input. + * + * cp = bptr; + * if((i = cp - screen->logstart) > 0) + * write(screen->logfd, (char *)screen->logstart, i); + */ + screen->logstart = buffer; +} + +#ifdef ALLOWLOGFILEEXEC +void logpipe() +{ + register TScreen *screen = &term->screen; + +#ifdef SYSV + (void) signal(SIGPIPE, SIG_IGN); +#endif /* SYSV */ + if(screen->logging) + CloseLog(screen); +} +#endif /* ALLOWLOGFILEEXEC */ +#endif /* ALLOWLOGGING */ + + +do_osc(func) +int (*func)(); +{ + register int mode, c; + register char *cp; + char buf[512]; + char *bufend = &buf[(sizeof buf) - 1]; /* leave room for null */ + Bool okay = True; + + /* + * lines should be of the form <ESC> ] number ; string <BEL> + * + * where number is one of 0, 1, 2, or 46 + */ + mode = 0; + while(isdigit(c = (*func)())) + mode = 10 * mode + (c - '0'); + if (c != ';') okay = False; + cp = buf; + while(isprint((c = (*func)()) & 0x7f) && cp < bufend) + *cp++ = c; + if (c != 7) okay = False; + *cp = 0; + if (okay) switch(mode) { + case 0: /* new icon name and title*/ + Changename(buf); + Changetitle(buf); + break; + + case 1: /* new icon name only */ + Changename(buf); + break; + + case 2: /* new title only */ + Changetitle(buf); + break; + case 10: case 11: case 12: + case 13: case 14: case 15: + case 16: + { + extern Boolean ChangeColorsRequest(); + if (term->misc.dynamicColors) + ChangeColorsRequest(term,mode-10,buf); + } + break; + + +#ifdef ALLOWLOGGING + case 46: /* new log file */ +#ifdef ALLOWLOGFILECHANGES + /* + * Warning, enabling this feature allows people to overwrite + * arbitrary files accessible to the person running xgterm. + */ + if((cp = malloc((unsigned)strlen(buf) + 1)) == NULL) + break; + strcpy(cp, buf); + if(term->screen.logfile) + free(term->screen.logfile); + term->screen.logfile = cp; +#else + Bell(); + Bell(); +#endif + break; +#endif /* ALLOWLOGGING */ + + case 50: + SetVTFont (fontMenu_fontescape, True, buf, NULL); + break; + + /* + * One could write code to send back the display and host names, + * but that could potentially open a fairly nasty security hole. + */ + } +} + +static ChangeGroup(attribute, value) + String attribute; + XtArgVal value; +{ + extern Widget toplevel; + Arg args[1]; + + XtSetArg( args[0], attribute, value ); + XtSetValues( toplevel, args, 1 ); +} + +Changename(name) +register char *name; +{ + ChangeGroup( XtNiconName, (XtArgVal)name ); +} + +Changetitle(name) +register char *name; +{ + ChangeGroup( XtNtitle, (XtArgVal)name ); +} + +/***====================================================================***/ + +ScrnColors *pOldColors= NULL; + +Boolean +GetOldColors(pTerm) +XgtermWidget pTerm; +{ +int i; + if (pOldColors==NULL) { + pOldColors= (ScrnColors *)XtMalloc(sizeof(ScrnColors)); + if (pOldColors==NULL) { + fprintf(stderr,"allocation failure in GetOldColors\n"); + return(FALSE); + } + pOldColors->which= 0; + for (i=0;i<NCOLORS;i++) { + pOldColors->colors[i]= 0; + pOldColors->names[i]= NULL; + } + GetColors(pTerm,pOldColors); + } + return(TRUE); +} + +Boolean +UpdateOldColors(pTerm,pNew) +XgtermWidget pTerm; +ScrnColors *pNew; +{ +int i; + + /* if we were going to free old colors, this would be the place to + * do it. I've decided not to (for now), because it seems likely + * that we'd have a small set of colors we use over and over, and that + * we could save some overhead this way. The only case in which this + * (clearly) fails is if someone is trying a boatload of colors, in + * which case they can restart xterm + */ + for (i=0;i<NCOLORS;i++) { + if (COLOR_DEFINED(pNew,i)) { + if (pOldColors->names[i]!=NULL) { + XtFree(pOldColors->names[i]); + pOldColors->names[i]= NULL; + } + if (pNew->names[i]) { + pOldColors->names[i]= pNew->names[i]; + } + pOldColors->colors[i]= pNew->colors[i]; + } + } + return(TRUE); +} + +void +ReverseOldColors() +{ +register ScrnColors *pOld= pOldColors; +Pixel tmpPix; +char *tmpName; + + if (pOld) { + /* change text cursor, if necesary */ + if (pOld->colors[TEXT_CURSOR]==pOld->colors[TEXT_FG]) { + pOld->colors[TEXT_CURSOR]= pOld->colors[TEXT_BG]; + if (pOld->names[TEXT_CURSOR]) { + XtFree(pOldColors->names[TEXT_CURSOR]); + pOld->names[TEXT_CURSOR]= NULL; + } + if (pOld->names[TEXT_BG]) { + tmpName= XtMalloc(strlen(pOld->names[TEXT_BG])+1); + if (tmpName) { + strcpy(tmpName,pOld->names[TEXT_BG]); + pOld->names[TEXT_CURSOR]= tmpName; + } + } + } + + /* swap text FG and BG */ + tmpPix= pOld->colors[TEXT_FG]; + tmpName= pOld->names[TEXT_FG]; + pOld->colors[TEXT_FG]= pOld->colors[TEXT_BG]; + pOld->names[TEXT_FG]= pOld->names[TEXT_BG]; + pOld->colors[TEXT_BG]= tmpPix; + pOld->names[TEXT_BG]= tmpName; + + /* swap mouse FG and BG */ + tmpPix= pOld->colors[MOUSE_FG]; + tmpName= pOld->names[MOUSE_FG]; + pOld->colors[MOUSE_FG]= pOld->colors[MOUSE_BG]; + pOld->names[MOUSE_FG]= pOld->names[MOUSE_BG]; + pOld->colors[MOUSE_BG]= tmpPix; + pOld->names[MOUSE_BG]= tmpName; + + /* swap Tek FG and BG */ + tmpPix= pOld->colors[TEK_FG]; + tmpName= pOld->names[TEK_FG]; + pOld->colors[TEK_FG]= pOld->colors[TEK_BG]; + pOld->names[TEK_FG]= pOld->names[TEK_BG]; + pOld->colors[TEK_BG]= tmpPix; + pOld->names[TEK_BG]= tmpName; + } + return; +} + +Boolean +AllocateColor(pTerm,pNew,ndx,name) +XgtermWidget pTerm; +ScrnColors *pNew; +int ndx; +char *name; +{ +XColor def; +register TScreen *screen= &pTerm->screen; +Colormap cmap= pTerm->core.colormap; +char *newName; + + if ((XParseColor(screen->display,cmap,name,&def))&& + (XAllocColor(screen->display,cmap,&def))) { + SET_COLOR_VALUE(pNew,ndx,def.pixel); + newName= XtMalloc(strlen(name)+1); + if (newName) { + strcpy(newName,name); + SET_COLOR_NAME(pNew,ndx,newName); + } + return(TRUE); + } + return(FALSE); +} + +Boolean +ChangeColorsRequest(pTerm,start,names) +XgtermWidget pTerm; +int start; +register char *names; +{ +char *thisName; +ScrnColors newColors; +int i,ndx; + + if ((pOldColors==NULL)&&(!GetOldColors(pTerm))) { + return(FALSE); + } + newColors.which= 0; + for (i=0;i<NCOLORS;i++) { + newColors.names[i]= NULL; + } + for (i=start;i<NCOLORS;i++) { + if (term->misc.re_verse) ndx= OPPOSITE_COLOR(i); + else ndx= i; + if ((names==NULL)||(names[0]=='\0')) { + newColors.names[ndx]= NULL; + } + else { + if (names[0]==';') + thisName= NULL; + else thisName= names; + names= index(names,';'); + if (names!=NULL) { + *names= '\0'; + names++; + } + if ((!pOldColors->names[ndx])|| + (thisName&&(strcmp(thisName,pOldColors->names[ndx])))) { + AllocateColor(pTerm,&newColors,ndx,thisName); + } + } + } + + if (newColors.which==0) + return(TRUE); + + ChangeColors(pTerm,&newColors); + UpdateOldColors(pTerm,&newColors); + return(TRUE); +} + +/***====================================================================***/ + + + +#ifndef DEBUG +/* ARGSUSED */ +#endif +Panic(s, a) +char *s; +int a; +{ +#ifdef DEBUG + if(debug) { + fprintf(stderr, "%s: PANIC! ", xgterm_name); + fprintf(stderr, s, a); + fputs("\r\n", stderr); + fflush(stderr); + } +#endif /* DEBUG */ +} + +char *SysErrorMsg (n) + int n; +{ +#if __STDC__ + return strerror(n); +#else + + return((n >= 0) ? (char *)strerror(n) : "unknown error"); +#endif /* __STDC__ */ +} + + +SysError (i) +int i; +{ + int oerrno; + + oerrno = errno; + /* perror(3) write(2)s to file descriptor 2 */ + fprintf (stderr, "%s: Error %d, errno %d: ", xgterm_name, i, oerrno); + fprintf (stderr, "%s\n", SysErrorMsg (oerrno)); + Cleanup(i); +} + +Error (i) +int i; +{ + fprintf (stderr, "%s: Error %d\n", xgterm_name, i); + Cleanup(i); +} + + +/* + * cleanup by sending SIGHUP to client processes + */ +Cleanup (code) +int code; +{ + extern XgtermWidget term; + register TScreen *screen; + + screen = &term->screen; + if (screen->pid > 1) { + (void) kill_process_group (screen->pid, SIGHUP); + } + Exit (code); +} + +/* + * sets the value of var to be arg in the Unix 4.2 BSD environment env. + * Var should end with '=' (bindings are of the form "var=value"). + * This procedure assumes the memory for the first level of environ + * was allocated using calloc, with enough extra room at the end so not + * to have to do a realloc(). + */ +Setenv (var, value) +register char *var, *value; +{ + extern char **environ; + register int envindex = 0; + register int len = strlen(var); + + while (environ [envindex] != NULL) { + if (strncmp (environ [envindex], var, len) == 0) { + /* found it */ + environ[envindex] = (char *)malloc ((unsigned)len + strlen (value) + 1); + strcpy (environ [envindex], var); + strcat (environ [envindex], value); + return; + } + envindex ++; + } + +#ifdef DEBUG + if (debug) fputs ("expanding env\n", stderr); +#endif /* DEBUG */ + + environ [envindex] = (char *) malloc ((unsigned)len + strlen (value) + 1); + (void) strcpy (environ [envindex], var); + strcat (environ [envindex], value); + environ [++envindex] = NULL; +} + +/* + * returns a pointer to the first occurrence of s2 in s1, + * or NULL if there are none. + */ +char *strindex (s1, s2) +register char *s1, *s2; +{ + register char *s3; + int s2len = strlen (s2); + + while ((s3=strchr(s1, *s2)) != NULL) { + if (strncmp(s3, s2, s2len) == 0) + return (s3); + s1 = ++s3; + } + return (NULL); +} + + +/* xerror -- Handle an XLIB server error. A standard X error message is + * printed and then the program either dumps core, exits, or ignores the error, + * depending upon the value of the environment variable XGXERROR, if defined. + */ +/*ARGSUSED*/ +xerror (display, event) +Display *display; +register XErrorEvent *event; +{ + static char *envvar = "XGXERROR"; + static char *env_maxerrs = "XGMAXERROR"; + static int nerrs = 0, maxerrs = -1; + extern char *getenv(); + char fname[128]; + char *action = NULL, *err = NULL; + int pid; + + /* Get the max number of allowable errors before we exit, defaults + * to 50. This is handy either for debugging to trap errors right + * away, or to increase the max value to run longer. + */ + if (maxerrs < 0) + maxerrs = ((err = getenv (env_maxerrs)) ? atoi(err) : 50); + + /* If we define XGXERROR to be 'ignore' don't print out the standard + * error message, and don't count it. + */ + + action = getenv (envvar); + if (!action || (action && strcmp (action, "ignore") != 0)) { + + /* The default action is to ignore BadCursor messages but we + * define a 'catchall' action to let us bypass this. Otherwise, + * print the standard X error message and count it towards the + * final shutdown. + */ + + if (event->error_code == BadCursor || + (action && strcmp (action, "catchall") != 0)) { + return (0); + } else { + fprintf (stderr, + "%s: warning, error event received:\n", xgterm_name); + (void) XmuPrintDefaultErrorMessage (display, event, stderr); + + if (nerrs++ > maxerrs) + Exit (ERROR_XERROR); + } + } + + if (action) { + if (strcmp (action, "dumpcore") == 0) { + if ((pid = fork()) >= 0) { + if (pid) { + fprintf (stderr, "dumping core... "); + fflush (stderr); + sprintf (fname, "core.%d", pid); + wait(NULL); rename ("core", fname); + fprintf (stderr, "core file core.%d written\n", pid); + fflush (stderr); + } else + kill (getpid(), 6); + } else + fprintf (stderr, "fork failed, no core dump produced\n"); + } else if (strcmp (action, "exit") == 0) { + fprintf (stderr, "program terminated\n"); + Exit (ERROR_XERROR); + } else if (strcmp (action, "ignore") != 0) + fprintf (stderr, "%s: unknown action %s\n", envvar, action); + } + + return (0); +} + +/*ARGSUSED*/ +xioerror(dpy) +Display *dpy; +{ + (void) fprintf (stderr, + "%s: fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n", + xgterm_name, errno, SysErrorMsg (errno), + DisplayString (dpy)); + + Exit(ERROR_XIOERROR); +} + +void xt_error(message) + String message; +{ + extern char *ProgramName; + + (void) fprintf (stderr, "%s Xt error: %s\n", ProgramName, message); + exit(1); +} + +XStrCmp(s1, s2) +char *s1, *s2; +{ + if (s1 && s2) return(strcmp(s1, s2)); + if (s1 && *s1) return(1); + if (s2 && *s2) return(-1); + return(0); +} + +static void withdraw_window (dpy, w, scr) + Display *dpy; + Window w; + int scr; +{ + (void) XmuUpdateMapHints (dpy, w, NULL); + XWithdrawWindow (dpy, w, scr); + return; +} + +void set_vt_visibility (on) + Boolean on; +{ + register TScreen *screen = &term->screen; + + if (on) { + if (!screen->Vshow && term) { + VTInit (); + XtMapWidget (term->core.parent); + screen->Vshow = TRUE; + } + } else { + if (screen->Vshow && term) { + withdraw_window (XtDisplay (term), + XtWindow(XtParent(term)), + XScreenNumberOfScreen(XtScreen(term))); + screen->Vshow = FALSE; + } + } + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); +} + +extern Atom wm_delete_window; /* for ICCCM delete window */ + +void set_tek_visibility (on) +Boolean on; +{ + register TScreen *screen = &term->screen; + if (on) { + if (!gt_activated()) + gt_activate(); + } else { + if (gt_activated()) + gt_deactivate(); + } + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); +} + +void end_tek_mode () +{ + register TScreen *screen = &term->screen; + + if (gt_tekmode (2)) { +#ifdef ALLOWLOGGING + if (screen->logging) { + FlushLog (screen); + screen->logstart = buffer; + } +#endif + gt_tekmode (0); + update_vttekmode(); + } +} + +void end_vt_mode () +{ + register TScreen *screen = &term->screen; + + if (!gt_tekmode (2)) { +#ifdef ALLOWLOGGING + if(screen->logging) { + FlushLog(screen); + screen->logstart = Tbuffer; + } +#endif + gt_tekmode (1); + update_vttekmode(); + } + return; +} + +void switch_modes (tovt) + Bool tovt; /* if true, then become vt mode */ +{ + if (tovt) + gt_tekmode (0); + else { + gt_activate(); + gt_tekmode (1); + } + + set_vthide_sensitivity(); + set_tekhide_sensitivity(); + set_tekreset_sensitivity(); + update_vttekmode(); + update_tekshow(); + update_tekreset(); + update_vtshow(); +} + +void hide_vt_window () +{ + register TScreen *screen = &term->screen; + + set_vt_visibility (FALSE); + switch_modes (False); +} + +void hide_tek_window () +{ + register TScreen *screen = &term->screen; + + set_tek_visibility (FALSE); + switch_modes (True); +} + + +/* + * The GTERMIO routines are called by the gtermio code during initialization + * to provide hooks into the xgterm code. + */ + +/* The following is called when a gtermio UI display connection is opened + * or closed. The gtermio UI code uses a separate display connection and + * passes in the display and toplevel widget for this connection. + */ +void +gtermio_connect (notused, display, toplevel, state) +int notused; +Display *display; /* UI display */ +Widget toplevel; /* toplevel widget */ +int state; /* 1=open, 0=close */ +{ + TScreen *screen = &term->screen; + + if (state) { + gtermio_display = display; + gtermio_toplevel = toplevel; + } else { + gtermio_display = NULL; + gtermio_toplevel = NULL; + screen->tek_menu_item_bitmap = (Pixmap) NULL; + init_menu ("tekMenu"); + } +} + + +/* The following are called by the gtermio code when switching between + * vt100 and graphics mode. + */ +static void +set_workstation_state (state) +{ + register TScreen *screen = &term->screen; + + screen->Tshow = state; + set_tekhide_sensitivity(); + set_vthide_sensitivity(); + set_tekreset_sensitivity(); + update_vtshow(); + update_tekshow(); + update_tekreset(); + update_vttekmode(); +} + +gtermio_open_workstation() { set_workstation_state(1); } +gtermio_close_workstation() { set_workstation_state(0); } + + +/* GTERMIO protocol module functions. + */ +int (*gtermio_reset)(); XtPointer gtermio_reset_data; +int (*gtermio_clear)(); XtPointer gtermio_clear_data; +int (*gtermio_input)(); XtPointer gtermio_input_data; +int (*gtermio_output)(); XtPointer gtermio_output_data; +int (*gtermio_activate)(); XtPointer gtermio_activate_data; +int (*gtermio_status)(); XtPointer gtermio_status_data; +int (*gtermio_enable)(); XtPointer gtermio_enable_data; +int (*gtermio_tekmode)(); XtPointer gtermio_tekmode_data; +int (*gtermio_SGMT)(); XtPointer gtermio_SGMT_data; + +/* gtermio_register -- This routine is called by the GTERMIO protocol + * module code during startup to register the protocol module's public + * functions, called by the xgterm code during execution to process + * graphics data, activate or deactivate the graphics window, and so on. + */ +gtermio_register (functions, nfunc) +struct GT_function *functions; +int nfunc; +{ + register struct GT_function *fp; + register int i; + + for (i=0; i < nfunc; i++) { + fp = &functions[i]; + if (strcmp (fp->name, "reset") == 0) { + gtermio_reset = fp->func; + gtermio_reset_data = fp->data; + } else if (strcmp (fp->name, "clear") == 0) { + gtermio_clear = fp->func; + gtermio_clear_data = fp->data; + } else if (strcmp (fp->name, "input") == 0) { + gtermio_input = fp->func; + gtermio_input_data = fp->data; + } else if (strcmp (fp->name, "output") == 0) { + gtermio_output = fp->func; + gtermio_output_data = fp->data; + } else if (strcmp (fp->name, "activate") == 0) { + gtermio_activate = fp->func; + gtermio_activate_data = fp->data; + } else if (strcmp (fp->name, "status") == 0) { + gtermio_status = fp->func; + gtermio_status_data = fp->data; + } else if (strcmp (fp->name, "enable") == 0) { + gtermio_enable = fp->func; + gtermio_enable_data = fp->data; + } else if (strcmp (fp->name, "tekmode") == 0) { + gtermio_tekmode = fp->func; + gtermio_tekmode_data = fp->data; + } else if (strcmp (fp->name, "setGinmodeTrailers") == 0) { + gtermio_SGMT = fp->func; + gtermio_SGMT_data = fp->data; + } + } +} + +/* gtermio_getResource -- Called by the gtermio code to get resource values + * from Xgterm. + */ +char * +gtermio_getResource (name) +char *name; +{ + if (strcmp (name, "geometry") == 0) + return (term->misc.T_geometry); + else + return (NULL); +} + +/* gt_reset -- Reset the graphics window. + */ +gt_reset() +{ + if (gtermio_reset) + (*gtermio_reset)(gtermio_reset_data); +} + +/* gt_clear -- Clear the graphics window. + */ +gt_clear() +{ + if (gtermio_clear) + (*gtermio_clear)(gtermio_clear_data); +} + +/* gt_input -- Filter any graphics data out of the input data stream. The + * number of bytes of data left after the graphics data is removed is + * returned as the function value. + */ +gt_input (bptr, bcnt) +char *bptr; +int bcnt; +{ + if (gtermio_input) + return ((*gtermio_input)(gtermio_input_data, bptr, bcnt)); + else + return (bcnt); +} + +/* gt_flush -- Process the gterm output buffer once. Any buffered input + * graphics data is processed and output to the screen. + */ +gt_flush() +{ + if (gtermio_output) + return ((*gtermio_output) (gtermio_output_data)); + else + return (1); +} + +/* gt_activate -- Activate the graphics window. + */ +gt_activate() +{ + if (gtermio_activate) + (*gtermio_activate)(gtermio_activate_data, 1); +} + +/* gt_deactivate -- Deactivate the graphics window. + */ +gt_deactivate() +{ + if (gtermio_activate) + (*gtermio_activate)(gtermio_activate_data, 0); +} + +/* gt_activated -- Test whether the graphics window is activated. + */ +gt_activated() +{ + if (gtermio_activate) + return ((*gtermio_activate)(gtermio_activate_data, 2)); + else + return (0); +} + +/* gt_status -- Test whether the graphics window is instantiated or reset. + */ +gt_status() +{ + if (gtermio_status) { + char name[256]; + int status; + + if (status = (*gtermio_status)(gtermio_status_data, name, NULL)) { + strncpy (gtermio_appname, name, SZ_APPNAME); + gtermio_appname[SZ_APPNAME] = '\0'; + } else + gtermio_appname[0] = '\0'; + return (status); + + } else { + gtermio_appname[0] = '\0'; + return (0); + } +} + +/* gt_enable -- Enable the graphics window. If the graphics window is + * disabled graphics/text mode switches will be ignored and all output will + * be directed to the text window. + */ +gt_enable (state) +int state; +{ + if (gtermio_enable) + return ((*gtermio_enable)(gtermio_enable_data, state)); + else + return (0); +} + +/* gt_tekmode -- Activate the graphics window. + */ +gt_tekmode (state) +int state; +{ + register TScreen *screen = &term->screen; + int tekEmu; + + if (gtermio_tekmode) { + tekEmu = ((*gtermio_tekmode)(gtermio_tekmode_data, state)); + screen->TekEmu = tekEmu; + } else + return (0); +} + +/* g_set_ginmode_trailers -- Set the trailer codes used to deliminate a + * cursor read value in the gtermio code. + */ +gt_set_ginmode_trailers (trailers) +char *trailers; +{ + if (gtermio_SGMT) + (*gtermio_SGMT)(gtermio_SGMT_data, trailers); +} diff --git a/vendor/x11iraf/xgterm/mkp b/vendor/x11iraf/xgterm/mkp new file mode 100644 index 00000000..7634c769 --- /dev/null +++ b/vendor/x11iraf/xgterm/mkp @@ -0,0 +1 @@ +gcc -m32 -c -g -I../include -I/usr/X11R6/include -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DALLOWLOGGING -DXVENDORNAME='"The X.Org Foundation"' -DXVENDORNAMESHORT='"X.Org"' -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=2 -DOSMINORVERSION=6 -E -C main.c >& main.p diff --git a/vendor/x11iraf/xgterm/ptyx.h b/vendor/x11iraf/xgterm/ptyx.h new file mode 100644 index 00000000..ef69a12e --- /dev/null +++ b/vendor/x11iraf/xgterm/ptyx.h @@ -0,0 +1,557 @@ +/* + * $XConsortium: ptyx.h,v 1.62 93/02/25 17:21:26 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* ptyx.h */ +/* @(#)ptyx.h X10/6.6 11/10/86 */ + +#include <X11/IntrinsicP.h> +#include <X11/Xmu/Misc.h> /* For Max() and Min(). */ +#include <X11/Xfuncs.h> +#include <X11/Xosdefs.h> + + +/* Extra Xlib definitions */ +#define AllButtonsUp(detail, ignore) (\ + ((ignore) == Button1) ? \ + (((detail)&(Button2Mask|Button3Mask)) == 0) \ + : \ + (((ignore) == Button2) ? \ + (((detail)&(Button1Mask|Button3Mask)) == 0) \ + : \ + (((detail)&(Button1Mask|Button2Mask)) == 0)) \ + ) + +#define MAX_COLS 200 +#define MAX_ROWS 128 + +/* +** System V definitions +*/ + +#ifdef SYSV +#ifdef X_NOT_POSIX +#ifndef CRAY +#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ + (close(fd2), fcntl(fd1, F_DUPFD, fd2))) +#endif +#endif +#endif /* SYSV */ + +/* +** allow for mobility of the pty master/slave directories +*/ +#ifndef PTYDEV +#if defined(hpux) || defined(__hpux) +#define PTYDEV "/dev/ptym/ptyxx" +#else /* !__hpux */ +#define PTYDEV "/dev/ptyxx" +#endif /* !__hpux */ +#endif /* !PTYDEV */ + +#ifndef TTYDEV +#if defined(hpux) || defined(__hpux) +#define TTYDEV "/dev/pty/ttyxx" +#else /* !__hpux */ +#define TTYDEV "/dev/ttyxx" +#endif /* !__hpux */ +#endif /* !TTYDEV */ + +#ifndef PTYCHAR1 +#if defined(hpux) || defined(__hpux) +#define PTYCHAR1 "zyxwvutsrqp" +#else /* !__hpux */ +#define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" +#endif /* !__hpux */ +#endif /* !PTYCHAR1 */ + +#ifndef PTYCHAR2 +#if defined(hpux) || defined(__hpux) +#define PTYCHAR2 "fedcba9876543210" +#else /* !__hpux */ +#define PTYCHAR2 "0123456789abcdef" +#endif /* !__hpux */ +#endif /* !PTYCHAR2 */ + +#ifndef PTYCHARLEN +#ifdef CRAY +#define PTYCHARLEN 3 +#elif defined(__MVS__) +#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ +#else +#define PTYCHARLEN 2 +#endif +#endif + + +/* Until the translation manager comes along, I have to do my own translation of + * mouse events into the proper routines. */ + +typedef enum {NORMAL, LEFTEXTENSION, RIGHTEXTENSION} EventMode; + +/* + * The origin of a screen is 0, 0. Therefore, the number of rows + * on a screen is screen->max_row + 1, and similarly for columns. + */ + +typedef unsigned char Char; /* to support 8 bit chars */ +typedef Char **ScrnBuf; + +/* + * ANSI emulation. + */ +#define INQ 0x05 +#define FF 0x0C /* C0, C1 control names */ +#define LS1 0x0E +#define LS0 0x0F +#define CAN 0x18 +#define SUB 0x1A +#define ESC 0x1B +#define US 0x1F +#define DEL 0x7F +#define HTS ('H'+0x40) +#define SS2 0x8E +#define SS3 0x8F +#define DCS 0x90 +#define OLDID 0x9A /* ESC Z */ +#define CSI 0x9B +#define ST 0x9C +#define OSC 0x9D +#define PM 0x9E +#define APC 0x9F +#define RDEL 0xFF + +#define NMENUFONTS 9 /* entries in fontMenu */ + +#define NBOX 5 /* Number of Points in box */ +#define NPARAM 10 /* Max. parameters */ + +#define MINHILITE 32 + +typedef struct { + unsigned char a_type; + unsigned char a_pintro; + unsigned char a_final; + unsigned char a_inters; + char a_nparam; /* # of parameters */ + char a_dflt[NPARAM]; /* Default value flags */ + short a_param[NPARAM]; /* Parameters */ + char a_nastyf; /* Error flag */ +} ANSI; + +typedef struct { + int row; + int col; + unsigned flags; /* Vt100 saves graphics rendition. Ugh! */ + char curgl; + char curgr; + char gsets[4]; +} SavedCursor; + +#define TEK_FONT_LARGE 0 +#define TEK_FONT_2 1 +#define TEK_FONT_3 2 +#define TEK_FONT_SMALL 3 +#define TEKNUMFONTS 4 + +/* Actually there are 5 types of lines, but four are non-solid lines */ +#define TEKNUMLINES 4 + +typedef struct { + int x; + int y; + int fontsize; + int linetype; +} Tmodes; + +typedef struct { + int Twidth; + int Theight; +} T_fontsize; + +typedef struct { + short *bits; + int x; + int y; + int width; + int height; +} BitmapBits; + +#define SAVELINES 256 /* default # lines to save */ +#define SCROLLLINES 1 /* default # lines to scroll */ + +/***====================================================================***/ + +#define TEXT_FG 0 +#define TEXT_BG 1 +#define TEXT_CURSOR 2 +#define MOUSE_FG 3 +#define MOUSE_BG 4 +#define TEK_FG 5 +#define TEK_BG 6 +#define NCOLORS 7 + +#define COLOR_DEFINED(s,w) ((s)->which&(1<<(w))) +#define COLOR_VALUE(s,w) ((s)->colors[w]) +#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w]=(v)),((s)->which|=(1<<(w)))) + +#define COLOR_NAME(s,w) ((s)->names[w]) +#define SET_COLOR_NAME(s,w,v) (((s)->names[w]=(v)),((s)->which|=(1<<(w)))) + +#define UNDEFINE_COLOR(s,w) ((s)->which&=(~((w)<<1))) +#define OPPOSITE_COLOR(n) (((n)==TEXT_FG?TEXT_BG:\ + ((n)==TEXT_BG?TEXT_FG:\ + ((n)==MOUSE_FG?MOUSE_BG:\ + ((n)==MOUSE_BG?MOUSE_FG:\ + ((n)==TEK_FG?TEK_BG:\ + ((n)==TEXT_BG?TEK_FG:(n)))))))) + +typedef struct { + unsigned which; + Pixel colors[NCOLORS]; + char *names[NCOLORS]; +} ScrnColors; + +/***====================================================================***/ + +#define MAXCOLORS 18 +#define COLOR_0 0 +#define COLOR_1 1 +#define COLOR_2 2 +#define COLOR_3 3 +#define COLOR_4 4 +#define COLOR_5 5 +#define COLOR_6 6 +#define COLOR_7 7 +#define COLOR_8 8 +#define COLOR_9 9 +#define COLOR_10 10 +#define COLOR_11 11 +#define COLOR_12 12 +#define COLOR_13 13 +#define COLOR_14 14 +#define COLOR_15 15 +#define COLOR_BD 16 +#define COLOR_UL 17 + + +typedef struct { + Display *display; /* X display for screen */ + int respond; /* socket for responses + (position report, etc.) */ + long pid; /* pid of process on far side */ + int uid; /* user id of actual person */ + int gid; /* group id of actual person */ + GC normalGC; /* normal painting */ + GC reverseGC; /* reverse painting */ + GC normalboldGC; /* normal painting, bold font */ + GC reverseboldGC; /* reverse painting, bold font */ + GC cursorGC; /* normal cursor painting */ + GC reversecursorGC;/* reverse cursor painting */ + GC cursoroutlineGC;/* for painting lines around */ + Pixel foreground; /* foreground color */ + Pixel cursorcolor; /* Cursor color */ + Pixel mousecolor; /* Mouse color */ + Pixel mousecolorback; /* Mouse color background */ + Pixel colors[MAXCOLORS]; /* ANSI color emulation */ + int border; /* inner border */ + Cursor arrow; /* arrow cursor */ + unsigned short send_mouse_pos; /* user wants mouse transition */ + /* and position information */ + int select; /* xgterm selected */ + Boolean visualbell; /* visual bell mode */ + Boolean allowSendEvents;/* SendEvent mode */ + Boolean grabbedKbd; /* keyboard is grabbed */ +#ifdef ALLOWLOGGING + int logging; /* logging mode */ + int logfd; /* file descriptor of log */ + char *logfile; /* log file name */ + unsigned char *logstart; /* current start of log buffer */ +#endif + int inhibit; /* flags for inhibiting changes */ + + /* VT window parameters */ + struct { + Window window; /* X window id */ + int width; /* width of columns */ + int height; /* height of rows */ + int fullwidth; /* full width of window */ + int fullheight; /* full height of window */ + int f_width; /* width of fonts in pixels */ + int f_height; /* height of fonts in pixels */ + } fullVwin; + Cursor pointer_cursor; /* pointer cursor in window */ + + /* Gterm window control */ + Boolean Vshow; /* VT window showing */ + Boolean Tshow; /* Tek window showing */ + Boolean TekEmu; /* true if Tek emulation */ + + /* Terminal fonts must be of the same size and of fixed width */ + XFontStruct *fnt_norm; /* normal font of terminal */ + XFontStruct *fnt_bold; /* bold font of terminal */ + int enbolden; /* overstrike for bold font */ + XPoint *box; /* draw unselected cursor */ + + int cursor_state; /* ON or OFF */ + int cursor_set; /* requested state */ + int cursor_col; /* previous cursor column */ + int cursor_row; /* previous cursor row */ + int cur_col; /* current cursor column */ + int cur_row; /* current cursor row */ + int max_col; /* rightmost column */ + int max_row; /* bottom row */ + int top_marg; /* top line of scrolling region */ + int bot_marg; /* bottom line of " " */ + Widget scrollWidget; /* pointer to scrollbar struct */ + int scrollbar; /* if > 0, width of scrollbar, and + scrollbar is showing */ + int topline; /* line number of top, <= 0 */ + int savedlines; /* number of lines that've been saved */ + int savelines; /* number of lines off top to save */ + int scrolllines; /* number of lines to button scroll */ + Boolean scrollttyoutput; /* scroll to bottom on tty output */ + Boolean scrollkey; /* scroll to bottom on key */ + + ScrnBuf buf; /* ptr to visible screen buf (main) */ + ScrnBuf allbuf; /* screen buffer (may include + lines scrolled off top) */ + char *sbuf_address; /* main screen memory address */ + ScrnBuf altbuf; /* alternate screen buffer */ + char *abuf_address; /* alternate screen memory address */ + Boolean alternate; /* true if using alternate buf */ + unsigned short do_wrap; /* true if cursor in last column + and character just output */ + int incopy; /* 0 idle; 1 XCopyArea issued; + -1 first GraphicsExpose seen, + but last not seen */ + int copy_src_x; /* params from last XCopyArea ... */ + int copy_src_y; + unsigned int copy_width; + unsigned int copy_height; + int copy_dest_x; + int copy_dest_y; + Boolean c132; /* allow change to 132 columns */ + Boolean curses; /* cludge-ups for more and vi */ + Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ + Boolean marginbell; /* true if margin bell on */ + int nmarginbell; /* columns from right margin */ + int bellarmed; /* cursor below bell margin */ + Boolean multiscroll; /* true if multi-scroll */ + int scrolls; /* outstanding scroll count, + used only with multiscroll */ + SavedCursor sc; /* data for restore cursor */ + int save_modes[19]; /* save dec private modes */ + + /* Improved VT100 emulation stuff. */ + char gsets[4]; /* G0 through G3. */ + char curgl; /* Current GL setting. */ + char curgr; /* Current GR setting. */ + char curss; /* Current single shift. */ + int scroll_amt; /* amount to scroll */ + int refresh_amt; /* amount to refresh */ + Boolean jumpscroll; /* whether we should jumpscroll */ + Boolean always_highlight; /* whether to highlight cursor */ + Boolean underline; /* whether to underline text */ + + int multiClickTime; /* time between multiclick selects */ + int bellSuppressTime; /* msecs after Bell before another allowed */ + Boolean bellInProgress; /* still ringing/flashing prev bell? */ + char *charClass; /* for overriding word selection */ + Boolean cutNewline; /* whether or not line cut has \n */ + Boolean cutToBeginningOfLine; /* line cuts to BOL? */ + char *selection; /* the current selection */ + int selection_size; /* size of allocated buffer */ + int selection_length; /* number of significant bytes */ + int selection_time; /* latest event timestamp */ + int startHRow, startHCol, /* highlighted text */ + endHRow, endHCol, + startHCoord, endHCoord; + Atom* selection_atoms; /* which selections we own */ + Cardinal sel_atoms_size; /* how many atoms allocated */ + Cardinal selection_count; /* how many atoms in use */ + Boolean input_eight_bits;/* use 8th bit instead of ESC prefix */ + Boolean output_eight_bits; /* honor all bits or strip */ + Pixmap menu_item_bitmap; + Pixmap tek_menu_item_bitmap; + Widget mainMenu, vtMenu, tekMenu, fontMenu; + char* menu_font_names[NMENUFONTS]; + int menu_font_number; +#ifdef I18N + XIC xic; +#endif +} TScreen; + +/* meaning of bits in screen.select flag */ +#define INWINDOW 01 /* the mouse is in one of the windows */ +#define FOCUS 02 /* one of the windows is the focus window */ + +#define MULTICLICKTIME 250 /* milliseconds */ + +typedef struct +{ + unsigned flags; +} TKeyboard; + +typedef struct _Misc { + char *geo_metry; + char *T_geometry; + char *f_n; + char *f_b; +#ifdef ALLOWLOGGING + Boolean log_on; +#endif + Boolean login_shell; + Boolean re_verse; + int resizeGravity; + Boolean reverseWrap; + Boolean autoWrap; + Boolean logInhibit; + Boolean signalInhibit; + Boolean tekInhibit; + Boolean scrollbar; + Boolean titeInhibit; + Boolean appcursorDefault; + Boolean appkeypadDefault; +#ifdef I18N + char *input_method; + char *preedit_type; + Boolean open_im; + Boolean shared_ic; +#endif + Boolean dynamicColors; /* use colors */ + Boolean sb_right; /* scrollbar on right */ +} Misc; + +typedef struct {int foo;} XgtermClassPart; + +typedef struct _XgtermClassRec { + CoreClassPart core_class; + XgtermClassPart xgterm_class; +} XgtermClassRec; + +/* define masks for flags */ +#define CAPS_LOCK 0x01 +#define KYPD_APL 0x02 +#define CURSOR_APL 0x04 + +#define N_MARGINBELL 10 +#define MAX_TABS 320 +#define TAB_ARRAY_SIZE 10 /* number of ints to provide MAX_TABS bits */ + +typedef unsigned Tabs [TAB_ARRAY_SIZE]; + +typedef struct _XgtermWidgetRec { + CorePart core; + TKeyboard keyboard; /* terminal keyboard */ + TScreen screen; /* terminal screen */ + unsigned flags; /* mode flags */ + unsigned cur_foreground; /* current foreground color */ + unsigned cur_background; /* current background color */ + unsigned initflags; /* initial mode flags */ + Tabs tabs; /* tabstops of the terminal */ + Misc misc; /* miscellaneous parameters */ +} XgtermWidgetRec, *XgtermWidget; + +#define BUF_SIZE 4096 + +/* + * terminal flags + * There are actually two namespaces mixed together here. + * One is the set of flags that can go in screen->buf attributes + * and which must fit in a char. + * The other is the global setting stored in + * term->flags and screen->save_modes. This need only fit in an unsigned. + */ + +#define ATTRIBUTES 0x67 /* mask: user-visible attributes */ +/* global flags and character flags (visible character attributes) */ +#define INVERSE 0x01 /* invert the characters to be output */ +#define UNDERLINE 0x02 /* true if underlining */ +#define BOLD 0x04 +/* character flags (internal attributes) */ +#define LINEWRAPPED 0x08 /* used on the first character in a + * line to indicate that it wraps onto + * the next line so we can tell the + * difference between lines that have + * wrapped around and lines that have + * ended naturally with a CR at column + * max_col. + */ +#define CHARDRAWN 0x10 /* a character has been drawn here on the + screen. Used to distinguish blanks from + empty parts of the screen when selecting */ +/* global flags */ +#define BG_COLOR 0x20 /* true if background set */ +#define FG_COLOR 0x40 /* true if foreground set */ + +/* global flags */ +#define WRAPAROUND 0x400 /* true if auto wraparound mode */ +#define REVERSEWRAP 0x800 /* true if reverse wraparound mode */ +#define REVERSE_VIDEO 0x1000 /* true if screen white on black */ +#define LINEFEED 0x2000 /* true if in auto linefeed mode */ +#define ORIGIN 0x4000 /* true if in origin mode */ +#define INSERT 0x8000 /* true if in insert mode */ +#define SMOOTHSCROLL 0x10000 /* true if in smooth scroll mode */ +#define IN132COLUMNS 0x20000 /* true if in 132 column mode */ + + +#define VWindow(screen) (screen->fullVwin.window) +#define VShellWindow term->core.parent->core.window +#define TextWindow(screen) (screen->fullVwin.window) +#define Width(screen) (screen->fullVwin.width) +#define Height(screen) (screen->fullVwin.height) +#define FullWidth(screen) (screen->fullVwin.fullwidth) +#define FullHeight(screen) (screen->fullVwin.fullheight) +#define FontWidth(screen) (screen->fullVwin.f_width) +#define FontHeight(screen) (screen->fullVwin.f_height) + +#define CursorX(screen,col) (term->misc.sb_right ? \ + (col) * FontWidth(screen) + screen->border : \ + (col) * FontWidth(screen) + screen->border \ + + screen->scrollbar) +#define CursorY(screen,row) ((((row) - screen->topline) * FontHeight(screen)) \ + + screen->border) + +#define WINDOWEVENTS (TWINDOWEVENTS | PointerMotionMask) + +/* flags for cursors */ +#define OFF 0 +#define ON 1 +#define CLEAR 0 +#define TOGGLE 1 + +/* flags for inhibit */ +#ifdef ALLOWLOGGING +#define I_LOG 0x01 +#endif +#define I_SIGNAL 0x02 +#define I_TEK 0x04 + +extern Cursor make_colored_cursor(); +extern int GetBytesAvailable(); +extern void first_map_occurred(); +extern int kill_process_group(); diff --git a/vendor/x11iraf/xgterm/ptyx_new.h b/vendor/x11iraf/xgterm/ptyx_new.h new file mode 100644 index 00000000..f4909646 --- /dev/null +++ b/vendor/x11iraf/xgterm/ptyx_new.h @@ -0,0 +1,1836 @@ +/* $XTermId: ptyx.h,v 1.321 2004/06/06 22:15:25 tom Exp $ */ + +/* + * $Xorg: ptyx.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ + */ + +/* $XFree86: xc/programs/xterm/ptyx.h,v 3.116 2004/06/06 22:15:25 dickey Exp $ */ + +/* + * Copyright 1999-2003,2004 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef included_ptyx_h +#define included_ptyx_h 1 + +#ifdef HAVE_CONFIG_H +#include <xtermcfg.h> +#endif + +/* ptyx.h */ +/* @(#)ptyx.h X10/6.6 11/10/86 */ + +#include <X11/IntrinsicP.h> +#include <X11/Shell.h> /* for XtNdieCallback, etc. */ +#include <X11/StringDefs.h> /* for standard resource names */ +#include <X11/Xmu/Misc.h> /* For Max() and Min(). */ +#include <X11/Xfuncs.h> +#include <X11/Xosdefs.h> +#include <X11/Xmu/Converters.h> +#ifdef XRENDERFONT +#include <X11/Xft/Xft.h> +#endif + +/* adapted from IntrinsicI.h */ +#define MyStackAlloc(size, stack_cache_array) \ + ((size) <= sizeof(stack_cache_array) \ + ? (XtPointer)(stack_cache_array) \ + : (XtPointer)malloc((unsigned)(size))) + +#define MyStackFree(pointer, stack_cache_array) \ + if ((pointer) != ((char *)(stack_cache_array))) free(pointer) + +/* +** System V definitions +*/ + +#ifdef att +#define ATT +#endif + +#ifdef SVR4 +#undef SYSV /* predefined on Solaris 2.4 */ +#define SYSV /* SVR4 is (approx) superset of SVR3 */ +#define ATT +#endif + +#ifdef SYSV +#ifdef X_NOT_POSIX +#if !defined(CRAY) && !defined(SVR4) +#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ + (close(fd2), fcntl(fd1, F_DUPFD, fd2))) +#endif +#endif +#endif /* SYSV */ + +/* + * Newer versions of <X11/Xft/Xft.h> have a version number. We use certain + * features from that. + */ +#if defined(XRENDERFONT) && defined(XFT_VERSION) && XFT_VERSION >= 20100 +#define HAVE_TYPE_FCCHAR32 1 /* compatible: XftChar16 */ +#define HAVE_TYPE_XFTCHARSPEC 1 /* new type XftCharSpec */ +#endif + +/* +** Definitions to simplify ifdef's for pty's. +*/ +#define USE_PTY_DEVICE 1 +#define USE_PTY_SEARCH 1 + +#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__NetBSD__) +#undef USE_PTY_DEVICE +#undef USE_PTY_SEARCH +#define USE_PTS_DEVICE 1 +#elif defined(VMS) +#undef USE_PTY_DEVICE +#undef USE_PTY_SEARCH +#elif defined(PUCC_PTYD) +#undef USE_PTY_SEARCH +#endif + +#if defined(SYSV) && defined(i386) && !defined(SVR4) +#define ATT +#define USE_HANDSHAKE 1 +#define USE_ISPTS_FLAG 1 +#endif + +#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) +#define USE_USG_PTYS +#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */ +#elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386)) +#define USE_USG_PTYS +#else +#define USE_HANDSHAKE 1 +#endif + +/* + * More systems than not require pty-handshaking. + */ +#ifndef USE_HANDSHAKE +#define USE_HANDSHAKE 1 +#endif + +/* +** allow for mobility of the pty master/slave directories +*/ +#ifndef PTYDEV +#if defined(__hpux) +#define PTYDEV "/dev/ptym/ptyxx" +#elif defined(__MVS__) +#define PTYDEV "/dev/ptypxxxx" +#else +#define PTYDEV "/dev/ptyxx" +#endif +#endif /* !PTYDEV */ + +#ifndef TTYDEV +#if defined(__hpux) +#define TTYDEV "/dev/pty/ttyxx" +#elif defined(__MVS__) +#define TTYDEV "/dev/ptypxxxx" +#elif defined(USE_PTS_DEVICE) +#define TTYDEV "/dev/pts/0" +#else +#define TTYDEV "/dev/ttyxx" +#endif +#endif /* !TTYDEV */ + +#ifndef PTYCHAR1 +#ifdef __hpux +#define PTYCHAR1 "zyxwvutsrqp" +#else /* !__hpux */ +#ifdef __UNIXOS2__ +#define PTYCHAR1 "pq" +#else +#define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" +#endif /* !__UNIXOS2__ */ +#endif /* !__hpux */ +#endif /* !PTYCHAR1 */ + +#ifndef PTYCHAR2 +#ifdef __hpux +#define PTYCHAR2 "fedcba9876543210" +#else /* !__hpux */ +#ifdef __FreeBSD__ +#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" +#else /* !__FreeBSD__ */ +#define PTYCHAR2 "0123456789abcdef" +#endif /* !__FreeBSD__ */ +#endif /* !__hpux */ +#endif /* !PTYCHAR2 */ + +#ifndef TTYFORMAT +#if defined(CRAY) +#define TTYFORMAT "/dev/ttyp%03d" +#elif defined(__MVS__) +#define TTYFORMAT "/dev/ttyp%04d" +#else +#define TTYFORMAT "/dev/ttyp%d" +#endif +#endif /* TTYFORMAT */ + +#ifndef PTYFORMAT +#ifdef CRAY +#define PTYFORMAT "/dev/pty/%03d" +#elif defined(__MVS__) +#define PTYFORMAT "/dev/ptyp%04d" +#else +#define PTYFORMAT "/dev/ptyp%d" +#endif +#endif /* PTYFORMAT */ + +#ifndef PTYCHARLEN +#ifdef CRAY +#define PTYCHARLEN 3 +#elif defined(__MVS__) +#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ +#else +#define PTYCHARLEN 2 +#endif +#endif + +#ifndef MAXPTTYS +#ifdef CRAY +#define MAXPTTYS 256 +#else +#define MAXPTTYS 2048 +#endif +#endif + +/* Until the translation manager comes along, I have to do my own translation of + * mouse events into the proper routines. */ + +typedef enum {NORMAL, LEFTEXTENSION, RIGHTEXTENSION} EventMode; + +/* + * The origin of a screen is 0, 0. Therefore, the number of rows + * on a screen is screen->max_row + 1, and similarly for columns. + */ + +typedef unsigned char Char; /* to support 8 bit chars */ +typedef Char **ScrnBuf; + +#define CharOf(n) ((unsigned char)(n)) + +/* + * ANSI emulation, special character codes + */ +#define INQ 0x05 +#define BEL 0x07 +#define FF 0x0C /* C0, C1 control names */ +#define LS1 0x0E +#define LS0 0x0F +#define NAK 0x15 +#define CAN 0x18 +#define SUB 0x1A +#define ESC 0x1B +#define XPOUND 0x1E /* internal mapping for '#' */ +#define US 0x1F +#define DEL 0x7F +#define RI 0x8D +#define SS2 0x8E +#define SS3 0x8F +#define DCS 0x90 +#define SPA 0x96 +#define EPA 0x97 +#define SOS 0x98 +#define OLDID 0x9A /* ESC Z */ +#define CSI 0x9B +#define ST 0x9C +#define OSC 0x9D +#define PM 0x9E +#define APC 0x9F +#define RDEL 0xFF + +#define MIN_DECID 52 /* can emulate VT52 */ +#define MAX_DECID 420 /* ...through VT420 */ + +#ifndef DFT_DECID +#define DFT_DECID "vt100" /* default VT100 */ +#endif + +#ifndef DFT_KBD_DIALECT +#define DFT_KBD_DIALECT "B" /* default USASCII */ +#endif + +/* constants used for utf8 mode */ +#define UCS_REPL 0xfffd +#define UCS_LIMIT 0x80000000U /* both limit and flag for non-UCS */ + +#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ + +#define NMENUFONTS 9 /* font entries in fontMenu */ + +#define NBOX 5 /* Number of Points in box */ +#define NPARAM 30 /* Max. parameters */ + +typedef struct { + char *opt; + char *desc; +} OptionHelp; + +typedef struct { + unsigned char a_type; + unsigned char a_pintro; + unsigned char a_final; + unsigned char a_inters; + char a_nparam; /* # of parameters */ + short a_param[NPARAM]; /* Parameters */ +} ANSI; + +#define TEK_FONT_LARGE 0 +#define TEK_FONT_2 1 +#define TEK_FONT_3 2 +#define TEK_FONT_SMALL 3 +#define TEKNUMFONTS 4 + +/* Actually there are 5 types of lines, but four are non-solid lines */ +#define TEKNUMLINES 4 + +typedef struct { + int x; + int y; + int fontsize; + unsigned linetype; +} Tmodes; + +typedef struct { + int Twidth; + int Theight; +} T_fontsize; + +typedef struct { + short *bits; + int x; + int y; + int width; + int height; +} BitmapBits; + +#define SAVELINES 64 /* default # lines to save */ +#define SCROLLLINES 1 /* default # lines to scroll */ + +#define EXCHANGE(a,b,tmp) tmp = a; a = b; b = tmp + +/***====================================================================***/ + +#if (XtSpecificationRelease < 6) +#ifndef NO_ACTIVE_ICON +#define NO_ACTIVE_ICON 1 /* Note: code relies on an X11R6 function */ +#endif +#endif + +#ifndef OPT_AIX_COLORS +#define OPT_AIX_COLORS 1 /* true if xterm is configured with AIX (16) colors */ +#endif + +#ifndef OPT_BLINK_CURS +#define OPT_BLINK_CURS 1 /* true if xterm has blinking cursor capability */ +#endif + +#ifndef OPT_BLINK_TEXT +#define OPT_BLINK_TEXT OPT_BLINK_CURS /* true if xterm has blinking text capability */ +#endif + +#ifndef OPT_BOX_CHARS +#define OPT_BOX_CHARS 1 /* true if xterm can simulate box-characters */ +#endif + +#ifndef OPT_BROKEN_OSC +#ifdef linux +#define OPT_BROKEN_OSC 1 /* man console_codes, 1st paragraph - cf: ECMA-48 */ +#else +#define OPT_BROKEN_OSC 0 /* true if xterm allows Linux's broken OSC parsing */ +#endif +#endif + +#ifndef OPT_BROKEN_ST +#define OPT_BROKEN_ST 1 /* true if xterm allows old/broken OSC parsing */ +#endif + +#ifndef OPT_C1_PRINT +#define OPT_C1_PRINT 1 /* true if xterm allows C1 controls to be printable */ +#endif + +#ifndef OPT_CLIP_BOLD +#define OPT_CLIP_BOLD 1 /* true if xterm uses clipping to avoid bold-trash */ +#endif + +#ifndef OPT_COLOR_CLASS +#define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ +#endif + +#ifndef OPT_COLOR_RES +#define OPT_COLOR_RES 1 /* true if xterm delays color-resource evaluation */ +#undef OPT_COLOR_RES2 +#endif + +#ifndef OPT_COLOR_RES2 +#define OPT_COLOR_RES2 OPT_COLOR_RES /* true to avoid using extra resources */ +#endif + +#ifndef OPT_DABBREV +#define OPT_DABBREV 0 /* dynamic abbreviations */ +#endif + +#ifndef OPT_DEC_CHRSET +#define OPT_DEC_CHRSET 1 /* true if xterm is configured for DEC charset */ +#endif + +#ifndef OPT_DEC_LOCATOR +#define OPT_DEC_LOCATOR 0 /* true if xterm supports VT220-style mouse events */ +#endif + +#ifndef OPT_DEC_SOFTFONT +#define OPT_DEC_SOFTFONT 0 /* true if xterm is configured for VT220 softfonts */ +#endif + +#ifndef OPT_EBCDIC +#ifdef __MVS__ +#define OPT_EBCDIC 1 +#else +#define OPT_EBCDIC 0 +#endif +#endif + +#ifndef OPT_HP_FUNC_KEYS +#define OPT_HP_FUNC_KEYS 0 /* true if xterm supports HP-style function keys */ +#endif + +#ifndef OPT_I18N_SUPPORT +#if (XtSpecificationRelease >= 5) +#define OPT_I18N_SUPPORT 1 /* true if xterm uses internationalization support */ +#else +#define OPT_I18N_SUPPORT 0 +#endif +#endif + +#ifndef OPT_INITIAL_ERASE +#define OPT_INITIAL_ERASE 1 /* use pty's erase character if it's not 128 */ +#endif + +#ifndef OPT_INPUT_METHOD +#if (XtSpecificationRelease >= 6) +#define OPT_INPUT_METHOD 1 /* true if xterm uses input-method support */ +#else +#define OPT_INPUT_METHOD 0 +#endif +#endif + +#ifndef OPT_ISO_COLORS +#define OPT_ISO_COLORS 1 /* true if xterm is configured with ISO colors */ +#endif + +#ifndef OPT_256_COLORS +#define OPT_256_COLORS 0 /* true if xterm is configured with 256 colors */ +#endif + +#ifndef OPT_88_COLORS +#define OPT_88_COLORS 0 /* true if xterm is configured with 88 colors */ +#endif + +#ifndef OPT_HIGHLIGHT_COLOR +#define OPT_HIGHLIGHT_COLOR 1 /* true if xterm supports color highlighting */ +#endif + +#ifndef OPT_LOAD_VTFONTS +#define OPT_LOAD_VTFONTS 0 /* true if xterm has load-vt-fonts() action */ +#endif + +#ifndef OPT_LUIT_PROG +#define OPT_LUIT_PROG 0 /* true if xterm supports luit */ +#endif + +#ifndef OPT_MAXIMIZE +#define OPT_MAXIMIZE 1 /* add actions for iconify ... maximize */ +#endif + +#ifndef OPT_MOD_FKEYS +#define OPT_MOD_FKEYS 1 /* modify cursor- and function-keys in normal mode */ +#endif + +#ifndef OPT_NUM_LOCK +#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ +#endif + +#ifndef OPT_PC_COLORS +#define OPT_PC_COLORS 1 /* true if xterm supports PC-style (bold) colors */ +#endif + +#ifndef OPT_PTY_HANDSHAKE +#define OPT_PTY_HANDSHAKE USE_HANDSHAKE /* avoid pty races on older systems */ +#endif + +#ifndef OPT_PRINT_COLORS +#define OPT_PRINT_COLORS 1 /* true if we print color information */ +#endif + +#ifndef OPT_READLINE +#define OPT_READLINE 0 /* mouse-click/paste support for readline */ +#endif + +#ifndef OPT_RENDERFONT +#ifdef XRENDERFONT +#define OPT_RENDERFONT 1 +#else +#define OPT_RENDERFONT 0 +#endif +#endif + +#ifndef OPT_RENDERWIDE +#if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) +#define OPT_RENDERWIDE 1 +#else +#define OPT_RENDERWIDE 0 +#endif +#endif + +#ifndef OPT_SAME_NAME +#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ +#endif + +#ifndef OPT_SCO_FUNC_KEYS +#define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ +#endif + +#ifndef OPT_SESSION_MGT +#if defined(XtNdieCallback) && defined(XtNsaveCallback) +#define OPT_SESSION_MGT 1 +#else +#define OPT_SESSION_MGT 0 +#endif +#endif + +#ifndef OPT_SHIFT_FONTS +#define OPT_SHIFT_FONTS 1 /* true if xterm interprets fontsize-shifting */ +#endif + +#ifndef OPT_SUNPC_KBD +#define OPT_SUNPC_KBD 1 /* true if xterm supports Sun/PC keyboard map */ +#endif + +#ifndef OPT_TCAP_QUERY +#define OPT_TCAP_QUERY 0 /* true for experimental termcap query */ +#endif + +#ifndef OPT_TEK4014 +#define OPT_TEK4014 1 /* true if we're using tek4014 emulation */ +#endif + +#ifndef OPT_TOOLBAR +#define OPT_TOOLBAR 0 /* true if xterm supports toolbar menus */ +#endif + +#ifndef OPT_TRACE +#define OPT_TRACE 0 /* true if we're using debugging traces */ +#endif + +#ifndef OPT_VT52_MODE +#define OPT_VT52_MODE 1 /* true if xterm supports VT52 emulation */ +#endif + +#ifndef OPT_WIDE_CHARS +#define OPT_WIDE_CHARS 0 /* true if xterm supports 16-bit characters */ +#endif + +#ifndef OPT_XMC_GLITCH +#define OPT_XMC_GLITCH 0 /* true if xterm supports xmc (magic cookie glitch) */ +#endif + +#ifndef OPT_ZICONBEEP +#define OPT_ZICONBEEP 1 /* true if xterm supports "-ziconbeep" option */ +#endif + +/***====================================================================***/ + +#if OPT_AIX_COLORS && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to support AIX colors */ +#undef OPT_AIX_COLORS +#define OPT_AIX_COLORS 0 +#endif + +#if OPT_COLOR_RES && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to support ColorRes logic */ +#undef OPT_COLOR_RES +#define OPT_COLOR_RES 0 +#endif + +#if OPT_COLOR_RES2 && !(OPT_256_COLORS || OPT_88_COLORS) +/* You must have 88/256 colors to need fake-resource logic */ +#undef OPT_COLOR_RES2 +#define OPT_COLOR_RES2 0 +#endif + +#if OPT_PC_COLORS && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to support PC colors */ +#undef OPT_PC_COLORS +#define OPT_PC_COLORS 0 +#endif + +#if OPT_PRINT_COLORS && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to be able to print them */ +#undef OPT_PRINT_COLORS +#define OPT_PRINT_COLORS 0 +#endif + +#if OPT_256_COLORS && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to support 256 colors */ +#undef OPT_256_COLORS +#define OPT_256_COLORS 0 +#endif + +#if OPT_88_COLORS && !OPT_ISO_COLORS +/* You must have ANSI/ISO colors to support 88 colors */ +#undef OPT_88_COLORS +#define OPT_88_COLORS 0 +#endif + +#if OPT_88_COLORS && OPT_256_COLORS +/* 256 colors supersedes 88 colors */ +#undef OPT_88_COLORS +#define OPT_88_COLORS 0 +#endif + +/***====================================================================***/ + +/* indices for the normal terminal colors in screen.Tcolors[] */ +typedef enum { + TEXT_FG = 0 /* text foreground */ + , TEXT_BG = 1 /* text background */ + , TEXT_CURSOR = 2 /* text cursor */ + , MOUSE_FG = 3 /* mouse foreground */ + , MOUSE_BG = 4 /* mouse background */ +#if OPT_TEK4014 + , TEK_FG = 5 /* tektronix foreground */ + , TEK_BG = 6 /* tektronix background */ +#endif +#if OPT_HIGHLIGHT_COLOR + , HIGHLIGHT_BG = 7 /* highlight background */ +#endif +#if OPT_TEK4014 + , TEK_CURSOR = 8 /* tektronix cursor */ +#endif + , NCOLORS /* total number of colors */ +} TermColors; + +#define COLOR_DEFINED(s,w) ((s)->which & (1<<(w))) +#define COLOR_VALUE(s,w) ((s)->colors[w]) +#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), ((s)->which |= (1<<(w)))) + +#define COLOR_NAME(s,w) ((s)->names[w]) +#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (1<<(w)))) + +#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1))) + +/***====================================================================***/ + +#if OPT_ISO_COLORS +#define if_OPT_ISO_COLORS(screen, code) if(screen->colorMode) code +#define TERM_COLOR_FLAGS (term->flags & (FG_COLOR|BG_COLOR)) +#define COLOR_0 0 +#define COLOR_1 1 +#define COLOR_2 2 +#define COLOR_3 3 +#define COLOR_4 4 +#define COLOR_5 5 +#define COLOR_6 6 +#define COLOR_7 7 +#define COLOR_8 8 +#define COLOR_9 9 +#define COLOR_10 10 +#define COLOR_11 11 +#define COLOR_12 12 +#define COLOR_13 13 +#define COLOR_14 14 +#define COLOR_15 15 +#define MIN_ANSI_COLORS 16 + +#if OPT_256_COLORS +# define NUM_ANSI_COLORS 256 +#elif OPT_88_COLORS +# define NUM_ANSI_COLORS 88 +#else +# define NUM_ANSI_COLORS MIN_ANSI_COLORS +#endif + +#if NUM_ANSI_COLORS > MIN_ANSI_COLORS +# define OPT_EXT_COLORS 1 +#else +# define OPT_EXT_COLORS 0 +#endif + +#define COLOR_BD (NUM_ANSI_COLORS) /* BOLD */ +#define COLOR_UL (NUM_ANSI_COLORS+1) /* UNDERLINE */ +#define COLOR_BL (NUM_ANSI_COLORS+2) /* BLINK */ +#define COLOR_RV (NUM_ANSI_COLORS+3) /* REVERSE */ +#define MAXCOLORS (NUM_ANSI_COLORS+4) +#ifndef DFT_COLORMODE +#define DFT_COLORMODE TRUE /* default colorMode resource */ +#endif + +#define ReverseOrHilite(screen,flags,hilite) \ + (( screen->colorRVMode && hilite ) || \ + ( !screen->colorRVMode && \ + (( (flags & INVERSE) && !hilite) || \ + (!(flags & INVERSE) && hilite)) )) + +/* Define a fake XK code, we need it for the fake color response in + * xtermcapKeycode(). */ +#if OPT_TCAP_QUERY +# define XK_COLORS 0x0003 +#endif + +#else /* !OPT_ISO_COLORS */ + +#define if_OPT_ISO_COLORS(screen, code) /* nothing */ +#define TERM_COLOR_FLAGS 0 + +#define ReverseOrHilite(screen,flags,hilite) \ + (( (flags & INVERSE) && !hilite) || \ + (!(flags & INVERSE) && hilite)) + +#endif /* OPT_ISO_COLORS */ + +#if OPT_AIX_COLORS +#define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code +#else +#define if_OPT_AIX_COLORS(screen, code) /* nothing */ +#endif + +#if OPT_256_COLORS || OPT_88_COLORS +# define if_OPT_EXT_COLORS(screen, code) if(screen->colorMode) code +# define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) /* nothing */ +#elif OPT_ISO_COLORS +# define if_OPT_EXT_COLORS(screen, code) /* nothing */ +# define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) if(screen->colorMode) code +#else +# define if_OPT_EXT_COLORS(screen, code) /* nothing */ +# define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) /*nothing*/ +#endif + +#define COLOR_RES_NAME(root) "color" root + +#if OPT_COLOR_CLASS +#define COLOR_RES_CLASS(root) "Color" root +#else +#define COLOR_RES_CLASS(root) XtCForeground +#endif + +#if OPT_COLOR_RES +#define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) +#define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) +#else +#define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) +#define COLOR_RES2(name,class,offset,value) Cres(name, class, offset, value) +#endif + +/***====================================================================***/ + +#if OPT_DEC_CHRSET +#define if_OPT_DEC_CHRSET(code) code + /* Use 2 bits for encoding the double high/wide sense of characters */ +#define CSET_SWL 0 +#define CSET_DHL_TOP 1 +#define CSET_DHL_BOT 2 +#define CSET_DWL 3 +#define NUM_CHRSET 8 /* normal/bold and 4 CSET_xxx values */ + /* Use remaining bits for encoding the other character-sets */ +#define CSET_NORMAL(code) ((code) == CSET_SWL) +#define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) +#define CSET_EXTEND(code) ((code) > CSET_DWL) + /* for doublesize characters, the first cell in a row holds the info */ +#define SCRN_ROW_CSET(screen,row) (SCRN_BUF_CSETS((screen), row)[0]) +#define CurMaxCol(screen, row) \ + (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ + ? (screen->max_col / 2) \ + : (screen->max_col)) +#define CurCursorX(screen, row, col) \ + (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ + ? CursorX(screen, 2*(col)) \ + : CursorX(screen, (col))) +#define CurFontWidth(screen, row) \ + (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ + ? 2*FontWidth(screen) \ + : FontWidth(screen)) +#else +#define if_OPT_DEC_CHRSET(code) /*nothing*/ +#define CurMaxCol(screen, row) screen->max_col +#define CurCursorX(screen, row, col) CursorX(screen, col) +#define CurFontWidth(screen, row) FontWidth(screen) +#endif + +#if OPT_LUIT_PROG && !OPT_WIDE_CHARS +#error Luit requires the wide-chars configuration +#endif + + /* the number of pointers per row in 'ScrnBuf' */ +#if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS +#define MAX_PTRS term->num_ptrs +#else +#define MAX_PTRS (OFF_ATTRS+1) +#endif + +#define BUF_HEAD 1 + /* the number that point to Char data */ +#define BUF_PTRS (MAX_PTRS - BUF_HEAD) + +/***====================================================================***/ + +#if OPT_EBCDIC +extern int E2A(int); +extern int A2E(int); +#else +#define E2A(a) (a) +#define A2E(a) (a) +#endif + +#define CONTROL(a) (A2E(E2A(a)&037)) + +/***====================================================================***/ + +#if OPT_TEK4014 +#define TEK4014_ACTIVE(screen) ((screen)->TekEmu) +#define CURRENT_EMU_VAL(screen,tek,vt) (TEK4014_ACTIVE(screen) ? tek : vt) +#define CURRENT_EMU(screen) CURRENT_EMU_VAL(screen, (Widget)tekWidget, (Widget)term) +#else +#define TEK4014_ACTIVE(screen) 0 +#define CURRENT_EMU_VAL(screen,tek,vt) (vt) +#define CURRENT_EMU(screen) ((Widget)term) +#endif + +/***====================================================================***/ + +#if OPT_TOOLBAR +#define SHELL_OF(widget) XtParent(XtParent(widget)) +#else +#define SHELL_OF(widget) XtParent(widget) +#endif + +/***====================================================================***/ + +#if OPT_VT52_MODE +#define if_OPT_VT52_MODE(screen, code) if(screen->vtXX_level == 0) code +#else +#define if_OPT_VT52_MODE(screen, code) /* nothing */ +#endif + +/***====================================================================***/ + +#if OPT_XMC_GLITCH +#define if_OPT_XMC_GLITCH(screen, code) if(screen->xmc_glitch) code +#define XMC_GLITCH 1 /* the character we'll show */ +#define XMC_FLAGS (INVERSE|UNDERLINE|BOLD) +#else +#define if_OPT_XMC_GLITCH(screen, code) /* nothing */ +#endif + +/***====================================================================***/ + +#if OPT_WIDE_CHARS +#define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code +#define PAIRED_CHARS(a,b) a,b +typedef unsigned IChar; /* for 8 or 16-bit characters, plus flag */ +#else +#define if_OPT_WIDE_CHARS(screen, code) /* nothing */ +#define PAIRED_CHARS(a,b) a +typedef unsigned char IChar; /* for 8-bit characters */ +#endif + +/***====================================================================***/ + +#ifndef RES_OFFSET +#define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset) +#endif + +#define RES_NAME(name) name +#define RES_CLASS(name) name + +#define Bres(name, class, offset, dftvalue) \ + {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ + RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} + +#define Cres(name, class, offset, dftvalue) \ + {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ + RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} + +#define Tres(name, class, offset, dftvalue) \ + COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \ + +#define Fres(name, class, offset, dftvalue) \ + {RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \ + RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} + +#define Ires(name, class, offset, dftvalue) \ + {RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \ + RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} + +#define Sres(name, class, offset, dftvalue) \ + {RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \ + RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} + +/***====================================================================***/ + +#define BUF_SIZE 4096 +#define FRG_SIZE 128 + +typedef struct { + Char buffer[BUF_SIZE + FRG_SIZE]; + Char * next; + Char * last; + int update; /* HandleInterpret */ +#if OPT_WIDE_CHARS + IChar utf_data; /* resulting character */ + int utf_size; /* ...number of bytes decoded */ +#endif +} PtyData; + +/***====================================================================***/ + +#if OPT_TRACE +#include <trace.h> +#endif + +#ifndef TRACE +#define TRACE(p) /*nothing*/ +#endif + +#ifndef TRACE_ARGV +#define TRACE_ARGV(tag,argv) /*nothing*/ +#endif + +#ifndef TRACE_CHILD +#define TRACE_CHILD /*nothing*/ +#endif + +#ifndef TRACE_HINTS +#define TRACE_HINTS(hints) /*nothing*/ +#endif + +#ifndef TRACE_OPTS +#define TRACE_OPTS(opts,ress,lens) /*nothing*/ +#endif + +#ifndef TRACE_TRANS +#define TRACE_TRANS(name,w) /*nothing*/ +#endif + +#ifndef TRACE2 +#define TRACE2(p) /*nothing*/ +#endif + +/***====================================================================***/ + +/* The order of ifdef's matches the logic for num_ptrs in VTInitialize */ +typedef enum { + OFF_FLAGS = 0 /* BUF_HEAD */ + , OFF_CHARS = 1 + , OFF_ATTRS = 2 +#if OPT_ISO_COLORS +#if OPT_256_COLORS || OPT_88_COLORS + , OFF_FGRND + , OFF_BGRND +#else + , OFF_COLOR +#endif +#endif +#if OPT_DEC_CHRSET + , OFF_CSETS +#endif +#if OPT_WIDE_CHARS + , OFF_WIDEC + , OFF_COM1L + , OFF_COM1H + , OFF_COM2L + , OFF_COM2H +#endif +} BufOffsets; + + /* ScrnBuf-level macros */ +#define BUF_FLAGS(buf, row) (buf[MAX_PTRS * (row) + OFF_FLAGS]) +#define BUF_CHARS(buf, row) (buf[MAX_PTRS * (row) + OFF_CHARS]) +#define BUF_ATTRS(buf, row) (buf[MAX_PTRS * (row) + OFF_ATTRS]) +#define BUF_COLOR(buf, row) (buf[MAX_PTRS * (row) + OFF_COLOR]) +#define BUF_FGRND(buf, row) (buf[MAX_PTRS * (row) + OFF_FGRND]) +#define BUF_BGRND(buf, row) (buf[MAX_PTRS * (row) + OFF_BGRND]) +#define BUF_CSETS(buf, row) (buf[MAX_PTRS * (row) + OFF_CSETS]) +#define BUF_WIDEC(buf, row) (buf[MAX_PTRS * (row) + OFF_WIDEC]) +#define BUF_COM1L(buf, row) (buf[MAX_PTRS * (row) + OFF_COM1L]) +#define BUF_COM1H(buf, row) (buf[MAX_PTRS * (row) + OFF_COM1H]) +#define BUF_COM2L(buf, row) (buf[MAX_PTRS * (row) + OFF_COM2L]) +#define BUF_COM2H(buf, row) (buf[MAX_PTRS * (row) + OFF_COM2H]) + + /* TScreen-level macros */ +#define SCRN_BUF_FLAGS(screen, row) BUF_FLAGS(screen->visbuf, row) +#define SCRN_BUF_CHARS(screen, row) BUF_CHARS(screen->visbuf, row) +#define SCRN_BUF_ATTRS(screen, row) BUF_ATTRS(screen->visbuf, row) +#define SCRN_BUF_COLOR(screen, row) BUF_COLOR(screen->visbuf, row) +#define SCRN_BUF_FGRND(screen, row) BUF_FGRND(screen->visbuf, row) +#define SCRN_BUF_BGRND(screen, row) BUF_BGRND(screen->visbuf, row) +#define SCRN_BUF_CSETS(screen, row) BUF_CSETS(screen->visbuf, row) +#define SCRN_BUF_WIDEC(screen, row) BUF_WIDEC(screen->visbuf, row) +#define SCRN_BUF_COM1L(screen, row) BUF_COM1L(screen->visbuf, row) +#define SCRN_BUF_COM2L(screen, row) BUF_COM2L(screen->visbuf, row) +#define SCRN_BUF_COM1H(screen, row) BUF_COM1H(screen->visbuf, row) +#define SCRN_BUF_COM2H(screen, row) BUF_COM2H(screen->visbuf, row) + +typedef struct { + unsigned chrset; + unsigned flags; + XFontStruct * fs; + GC gc; + char * fn; +} XTermFonts; + + /* indices into save_modes[] */ +typedef enum { + DP_CRS_VISIBLE, + DP_DECANM, + DP_DECARM, + DP_DECAWM, + DP_DECBKM, + DP_DECCKM, + DP_DECCOLM, /* IN132COLUMNS */ + DP_DECOM, + DP_DECPEX, + DP_DECPFF, + DP_DECSCLM, + DP_DECSCNM, + DP_DECTCEM, + DP_DECTEK, + DP_PRN_EXTENT, + DP_PRN_FORMFEED, + DP_X_ALTSCRN, + DP_X_DECCOLM, + DP_X_LOGGING, + DP_X_MARGIN, + DP_X_MORE, + DP_X_MOUSE, + DP_X_REVWRAP, + DP_X_X10MSE, +#if OPT_BLINK_CURS + DP_CRS_BLINK, +#endif + DP_LAST +} SaveModes; + +#define DoSM(code,value) screen->save_modes[code] = value +#define DoRM(code,value) value = screen->save_modes[code] + + /* index into vt_shell[] or tek_shell[] */ +typedef enum { + noMenu = -1, + mainMenu, + vtMenu, + fontMenu, + tekMenu +} MenuIndex; + +#define NUM_POPUP_MENUS 4 + +#if OPT_COLOR_RES +typedef struct { + String resource; + Pixel value; + int mode; +} ColorRes; +#else +#define ColorRes Pixel +#endif + +typedef struct { + unsigned which; /* must have NCOLORS bits */ + Pixel colors[NCOLORS]; + char *names[NCOLORS]; +} ScrnColors; + +typedef struct { + Boolean saved; + int row; + int col; + unsigned flags; /* VTxxx saves graphics rendition */ + char curgl; + char curgr; + char gsets[4]; +#if OPT_ISO_COLORS + int cur_foreground; /* current foreground color */ + int cur_background; /* current background color */ + int sgr_foreground; /* current SGR foreground color */ + int sgr_background; /* current SGR background color */ + Boolean sgr_extended; /* SGR set with extended codes? */ +#endif +} SavedCursor; + +typedef struct { + int width; /* if > 0, width of scrollbar, */ + /* and scrollbar is showing */ + Boolean rv_cached; /* see ScrollBarReverseVideo */ + int rv_active; /* ...current reverse-video */ + Pixel bg; /* ...cached background color */ + Pixel fg; /* ...cached foreground color */ + Pixel bdr; /* ...cached border color */ + Pixmap bdpix; /* ...cached border pixmap */ +} SbInfo; + +struct _vtwin { + Window window; /* X window id */ + int width; /* width of columns */ + int height; /* height of rows */ + int fullwidth; /* full width of window */ + int fullheight; /* full height of window */ + int f_width; /* width of fonts in pixels */ + int f_height; /* height of fonts in pixels */ + int f_ascent; /* ascent of font in pixels */ + int f_descent; /* descent of font in pixels */ + SbInfo sb_info; + GC normalGC; /* normal painting */ + GC reverseGC; /* reverse painting */ + GC normalboldGC; /* normal painting, bold font */ + GC reverseboldGC; /* reverse painting, bold font */ +#if OPT_TOOLBAR + Widget menu_bar; /* toolbar, if initialized */ + Dimension menu_height; /* ...and its height */ +#endif +}; + +struct _tekwin { + Window window; /* X window id */ + int width; /* width of columns */ + int height; /* height of rows */ + int fullwidth; /* full width of window */ + int fullheight; /* full height of window */ + double tekscale; /* scale factor Tek -> vs100 */ +}; + +typedef struct { +/* These parameters apply to both windows */ + Display *display; /* X display for screen */ + int respond; /* socket for responses + (position report, etc.) */ +#if OPT_TCAP_QUERY + int tc_query; +#endif + long pid; /* pid of process on far side */ + int uid; /* user id of actual person */ + int gid; /* group id of actual person */ + GC cursorGC; /* normal cursor painting */ + GC fillCursorGC; /* special cursor painting */ + GC reversecursorGC;/* reverse cursor painting */ + GC cursoroutlineGC;/* for painting lines around */ + ColorRes Tcolors[NCOLORS]; /* terminal colors */ +#if OPT_ISO_COLORS + ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ + int veryBoldColors; /* modifier for boldColors */ + Boolean boldColors; /* can we make bold colors? */ + Boolean colorMode; /* are we using color mode? */ + Boolean colorULMode; /* use color for underline? */ + Boolean colorBDMode; /* use color for bold? */ + Boolean colorBLMode; /* use color for blink? */ + Boolean colorRVMode; /* use color for reverse? */ + Boolean colorAttrMode; /* prefer colorUL/BD to SGR */ +#endif +#if OPT_DEC_CHRSET + Boolean font_doublesize;/* enable font-scaling */ + int cache_doublesize;/* limit of our cache */ + Char cur_chrset; /* character-set index & code */ + int fonts_used; /* count items in double_fonts */ + XTermFonts double_fonts[NUM_CHRSET]; +#endif +#if OPT_WIDE_CHARS + Boolean wide_chars; /* true when 16-bit chars */ + Boolean vt100_graphics; /* true to allow vt100-graphics */ + int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ + int utf_count; /* state of utf_char */ + IChar utf_char; /* in-progress character */ +#endif +#if OPT_BROKEN_OSC + Boolean brokenLinuxOSC; /* true to ignore Linux palette ctls */ +#endif +#if OPT_BROKEN_ST + Boolean brokenStringTerm; /* true to match old OSC parse */ +#endif +#if OPT_C1_PRINT + Boolean c1_printable; /* true if we treat C1 as print */ +#endif + int border; /* inner border */ + Cursor arrow; /* arrow cursor */ + unsigned long event_mask; + unsigned short send_mouse_pos; /* user wants mouse transition */ + /* and position information */ +#if OPT_READLINE + unsigned click1_moves; + unsigned paste_moves; + unsigned dclick3_deletes; + unsigned paste_brackets; + unsigned paste_quotes; + unsigned paste_literal_nl; +#endif /* OPT_READLINE */ +#if OPT_DEC_LOCATOR + Boolean locator_reset; /* turn mouse off after 1 report? */ + Boolean locator_pixels; /* report in pixels? */ + /* if false, report in cells */ + unsigned short locator_events; /* what events to report */ + Boolean loc_filter; /* is filter rectangle active? */ + int loc_filter_top; /* filter rectangle for DEC Locator */ + int loc_filter_left; + int loc_filter_bottom; + int loc_filter_right; +#endif /* OPT_DEC_LOCATOR */ + int mouse_button; /* current button pressed */ + int mouse_row; /* ...and its row */ + int mouse_col; /* ...and its column */ + int select; /* xterm selected */ + Boolean visualbell; /* visual bell mode */ + Boolean poponbell; /* pop on bell mode */ + Boolean allowSendEvents;/* SendEvent mode */ + Boolean allowWindowOps; /* WindowOps mode */ + Boolean awaitInput; /* select-timeout mode */ + Boolean grabbedKbd; /* keyboard is grabbed */ +#ifdef ALLOWLOGGING + int logging; /* logging mode */ + int logfd; /* file descriptor of log */ + char *logfile; /* log file name */ + Char *logstart; /* current start of log buffer */ +#endif + int inhibit; /* flags for inhibiting changes */ + +/* VT window parameters */ + Boolean Vshow; /* VT window showing */ + struct _vtwin fullVwin; +#ifndef NO_ACTIVE_ICON + struct _vtwin iconVwin; + struct _vtwin * whichVwin; +#endif /* NO_ACTIVE_ICON */ + + Cursor pointer_cursor; /* pointer cursor in window */ + + String answer_back; /* response to ENQ */ + String printer_command; /* pipe/shell command string */ + Boolean printer_autoclose; /* close printer when offline */ + Boolean printer_extent; /* print complete page */ + Boolean printer_formfeed; /* print formfeed per function */ + int printer_controlmode; /* 0=off, 1=auto, 2=controller */ + int print_attributes; /* 0=off, 1=normal, 2=color */ + + Boolean fnt_prop; /* true if proportional fonts */ + Boolean fnt_boxes; /* true if font has box-chars */ +#if OPT_BOX_CHARS + Boolean force_box_chars;/* true if we assume that */ + Boolean force_all_chars;/* true to outline missing chars*/ +#endif + Dimension fnt_wide; + Dimension fnt_high; + XFontStruct *fnt_norm; /* normal font of terminal */ + XFontStruct *fnt_bold; /* bold font of terminal */ + Boolean free_bold_box; /* same_font_size's austerity */ +#if OPT_WIDE_CHARS + XFontStruct *fnt_dwd; /* wide font of terminal */ + XFontStruct *fnt_dwdb; /* wide bold font of terminal */ +#endif +#ifndef NO_ACTIVE_ICON + XFontStruct *fnt_icon; /* icon font */ +#endif /* NO_ACTIVE_ICON */ + int enbolden; /* overstrike for bold font */ + XPoint *box; /* draw unselected cursor */ + + int cursor_state; /* ON, OFF, or BLINKED_OFF */ + int cursor_busy; /* do not redraw... */ +#if OPT_BLINK_CURS + Boolean cursor_blink; /* cursor blink enable */ +#endif +#if OPT_BLINK_TEXT + Boolean blink_as_bold; /* text blink disable */ +#endif +#if OPT_BLINK_CURS || OPT_BLINK_TEXT + int blink_state; /* ON, OFF, or BLINKED_OFF */ + int blink_on; /* cursor on time (msecs) */ + int blink_off; /* cursor off time (msecs) */ + XtIntervalId blink_timer; /* timer-id for cursor-proc */ +#endif + int cursor_GC; /* see ShowCursor() */ + int cursor_set; /* requested state */ + int cursor_col; /* previous cursor column */ + int cursor_row; /* previous cursor row */ + int cur_col; /* current cursor column */ + int cur_row; /* current cursor row */ + int max_col; /* rightmost column */ + int max_row; /* bottom row */ + int top_marg; /* top line of scrolling region */ + int bot_marg; /* bottom line of " " */ + Widget scrollWidget; /* pointer to scrollbar struct */ + int topline; /* line number of top, <= 0 */ + int savedlines; /* number of lines that've been saved */ + int savelines; /* number of lines off top to save */ + int scrolllines; /* number of lines to button scroll */ + Boolean scrollttyoutput; /* scroll to bottom on tty output */ + Boolean scrollkey; /* scroll to bottom on key */ + + ScrnBuf visbuf; /* ptr to visible screen buf (main) */ + ScrnBuf allbuf; /* screen buffer (may include + lines scrolled off top) */ + Char *sbuf_address; /* main screen memory address */ + ScrnBuf altbuf; /* alternate screen buffer */ + Char *abuf_address; /* alternate screen memory address */ + Char **save_ptr; /* workspace for save-pointers */ + size_t save_len; /* ...and its length */ + Boolean alternate; /* true if using alternate buf */ + unsigned short do_wrap; /* true if cursor in last column + and character just output */ + int incopy; /* 0 idle; 1 XCopyArea issued; + -1 first GraphicsExpose seen, + but last not seen */ + int copy_src_x; /* params from last XCopyArea ... */ + int copy_src_y; + unsigned int copy_width; + unsigned int copy_height; + int copy_dest_x; + int copy_dest_y; + Boolean c132; /* allow change to 132 columns */ + Boolean curses; /* kludge line wrap for more */ + Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ + Boolean marginbell; /* true if margin bell on */ + int nmarginbell; /* columns from right margin */ + int bellarmed; /* cursor below bell margin */ + Boolean multiscroll; /* true if multi-scroll */ + int scrolls; /* outstanding scroll count, + used only with multiscroll */ + SavedCursor sc[2]; /* data for restore cursor */ + int save_modes[DP_LAST]; /* save dec/xterm private modes */ + + /* Improved VT100 emulation stuff. */ + String keyboard_dialect; /* default keyboard dialect */ + char gsets[4]; /* G0 through G3. */ + char curgl; /* Current GL setting. */ + char curgr; /* Current GR setting. */ + char curss; /* Current single shift. */ + String term_id; /* resource for terminal_id */ + int terminal_id; /* 100=vt100, 220=vt220, etc. */ + int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */ + int ansi_level; /* levels 1,2,3 */ + int scroll_amt; /* amount to scroll */ + int refresh_amt; /* amount to refresh */ + int protected_mode; /* 0=off, 1=DEC, 2=ISO */ + Boolean old_fkeys; /* true for compatible fkeys */ + Boolean delete_is_del; /* true for compatible Delete key */ + Boolean jumpscroll; /* whether we should jumpscroll */ + Boolean always_highlight; /* whether to highlight cursor */ + Boolean underline; /* whether to underline text */ + Boolean bold_mode; /* whether to use bold font */ + +#if OPT_MAXIMIZE + Boolean restore_data; + int restore_x; + int restore_y; + unsigned restore_width; + unsigned restore_height; +#endif + +#if OPT_VT52_MODE + int vt52_save_level; /* save-area for DECANM */ + char vt52_save_curgl; + char vt52_save_curgr; + char vt52_save_curss; + char vt52_save_gsets[4]; +#endif + /* Testing */ +#if OPT_XMC_GLITCH + int xmc_glitch; /* # of spaces to pad on SGR's */ + int xmc_attributes; /* attrs that make a glitch */ + Boolean xmc_inline; /* SGR's propagate only to eol */ + Boolean move_sgr_ok; /* SGR is reset on move */ +#endif + +#if OPT_TEK4014 +/* Tektronix window parameters */ + GC TnormalGC; /* normal painting */ + GC TcursorGC; /* normal cursor painting */ + + Boolean Tshow; /* Tek window showing */ + Boolean waitrefresh; /* postpone refresh */ + struct _tekwin fullTwin; +#ifndef NO_ACTIVE_ICON + struct _tekwin iconTwin; + struct _tekwin *whichTwin; +#endif /* NO_ACTIVE_ICON */ + + GC linepat[TEKNUMLINES]; /* line patterns */ + Boolean TekEmu; /* true if Tektronix emulation */ + int cur_X; /* current x */ + int cur_Y; /* current y */ + Tmodes cur; /* current tek modes */ + Tmodes page; /* starting tek modes on page */ + int margin; /* 0 -> margin 1, 1 -> margin 2 */ + int pen; /* current Tektronix pen 0=up, 1=dn */ + char *TekGIN; /* nonzero if Tektronix GIN mode*/ + int gin_terminator; /* Tek strap option */ +#endif /* OPT_TEK4014 */ + + int multiClickTime; /* time between multiclick selects */ + int visualBellDelay; /* msecs to delay for visibleBell */ + int bellSuppressTime; /* msecs after Bell before another allowed */ + Boolean bellInProgress; /* still ringing/flashing prev bell? */ + char *charClass; /* for overriding word selection */ + Boolean cutNewline; /* whether or not line cut has \n */ + Boolean cutToBeginningOfLine; /* line cuts to BOL? */ + Boolean highlight_selection; /* controls appearance of selection */ + Boolean trim_selection; /* controls trimming of selection */ + Boolean i18nSelections; + Boolean brokenSelections; + Char *selection_data; /* the current selection */ + int selection_size; /* size of allocated buffer */ + int selection_length; /* number of significant bytes */ + Time selection_time; /* latest event timestamp */ + int startHRow, startHCol, /* highlighted text */ + endHRow, endHCol, + startHCoord, endHCoord; + Atom* selection_atoms; /* which selections we own */ + Cardinal sel_atoms_size; /* how many atoms allocated */ + Cardinal selection_count; /* how many atoms in use */ + Boolean input_eight_bits;/* use 8th bit instead of ESC prefix */ + Boolean output_eight_bits; /* honor all bits or strip */ + Boolean control_eight_bits; /* send CSI as 8-bits */ + Boolean backarrow_key; /* backspace/delete */ + Boolean meta_sends_esc; /* Meta-key sends ESC prefix */ + Pixmap menu_item_bitmap; /* mask for checking items */ + String menu_font_names[NMENUFONTS]; + long menu_font_sizes[NMENUFONTS]; + int menu_font_number; + XIC xic; +#if OPT_RENDERFONT + XftFont * renderFontNorm[NMENUFONTS]; + XftFont * renderFontBold[NMENUFONTS]; + XftFont * renderWideNorm[NMENUFONTS]; + XftFont * renderWideBold[NMENUFONTS]; + XftDraw * renderDraw; +#endif +#if OPT_INPUT_METHOD + XFontSet fs; /* fontset for XIM preedit */ + int fs_ascent; /* ascent of fs */ +#endif +#if OPT_DABBREV + int dabbrev_working; /* nonzero during dabbrev process */ + unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ +#endif +} TScreen; + +typedef struct _TekPart { + XFontStruct * Tfont[TEKNUMFONTS]; + int tobaseline[TEKNUMFONTS]; /* top-baseline, each font */ + char * initial_font; /* large, 2, 3, small */ + char * gin_terminator_str; /* ginTerminator resource */ +#if OPT_TOOLBAR + Widget menu_bar; /* toolbar, if initialized */ + Dimension menu_height; /* ...and its height */ +#endif +} TekPart; + +#if OPT_READLINE +#define SCREEN_FLAG(screenp,f) (1&(screenp)->f) +#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) +#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= ~1L) +#define SCREEN_FLAG_save(screenp,f) \ + ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) +#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) +#else +#define SCREEN_FLAG(screenp,f) (0) +#endif + +/* meaning of bits in screen.select flag */ +#define INWINDOW 01 /* the mouse is in one of the windows */ +#define FOCUS 02 /* one of the windows is the focus window */ + +#define MULTICLICKTIME 250 /* milliseconds */ + +typedef enum { + keyboardIsLegacy, /* bogus vt220 codes for F1-F4, etc. */ + keyboardIsDefault, + keyboardIsHP, + keyboardIsSCO, + keyboardIsSun, + keyboardIsVT220 +} xtermKeyboardType; + +typedef struct +{ + xtermKeyboardType type; + unsigned flags; +#if OPT_INITIAL_ERASE + int reset_DECBKM; /* reset should set DECBKM */ +#endif + int modify_cursor_keys; /* how to handle modifiers */ +} TKeyboard; + +typedef struct { + char *f_n; /* the normal font */ + char *f_b; /* the bold font */ +#if OPT_WIDE_CHARS + char *f_w; /* the normal wide font */ + char *f_wb; /* the bold wide font */ +#endif +} VTFontNames; + +typedef struct _Misc { + VTFontNames default_font; + char *geo_metry; + char *T_geometry; +#if OPT_WIDE_CHARS + Boolean cjk_width; /* true when CJK width convention is turned on */ +#endif +#if OPT_LUIT_PROG + Boolean callfilter; /* true to invoke luit */ + Boolean use_encoding; /* true to use -encoding option for luit */ + char *locale_str; /* "locale" resource */ + char *localefilter; /* path for luit */ +#endif +#if OPT_INPUT_METHOD + char *f_x; /* font for XIM */ +#endif + int limit_resize; +#ifdef ALLOWLOGGING + Boolean log_on; +#endif + Boolean login_shell; + Boolean re_verse; + Boolean re_verse0; /* initial value of "-rv" */ + XtGravity resizeGravity; + Boolean reverseWrap; + Boolean autoWrap; + Boolean logInhibit; + Boolean signalInhibit; +#if OPT_TEK4014 + Boolean tekInhibit; + Boolean tekSmall; /* start tek window in small size */ +#endif + Boolean scrollbar; +#ifdef SCROLLBAR_RIGHT + Boolean useRight; +#endif + Boolean titeInhibit; + Boolean tiXtraScroll; + Boolean appcursorDefault; + Boolean appkeypadDefault; +#if OPT_INPUT_METHOD + char* input_method; + char* preedit_type; + Boolean open_im; + Boolean cannot_im; /* true if we cannot use input-method */ +#endif + Boolean dynamicColors; + Boolean shared_ic; +#ifndef NO_ACTIVE_ICON + Boolean active_icon; /* use application icon window */ + int icon_border_width; + Pixel icon_border_pixel; +#endif /* NO_ACTIVE_ICON */ +#if OPT_DEC_SOFTFONT + Boolean font_loadable; +#endif +#if OPT_SHIFT_FONTS + Boolean shift_fonts; /* true if we interpret fontsize-shifting */ +#endif +#if OPT_SUNPC_KBD + int ctrl_fkeys; /* amount to add to XK_F1 for ctrl modifier */ +#endif +#if OPT_NUM_LOCK + Boolean real_NumLock; /* true if we treat NumLock key specially */ + Boolean alwaysUseMods; /* true if we always want f-key modifiers */ + unsigned long num_lock; /* modifier for Num_Lock */ + unsigned long alt_left; /* modifier for Alt_L */ + unsigned long alt_right; /* modifier for Alt_R */ + Boolean meta_trans; /* true if Meta is used in translations */ + unsigned long meta_left; /* modifier for Meta_L */ + unsigned long meta_right; /* modifier for Meta_R */ +#endif +#if OPT_RENDERFONT + char *face_name; + char *face_wide_name; + int face_size; + Boolean render_font; +#endif +} Misc; + +typedef struct {int foo;} XtermClassPart, TekClassPart; + +typedef struct _XtermClassRec { + CoreClassPart core_class; + XtermClassPart xterm_class; +} XtermClassRec; + +extern WidgetClass xtermWidgetClass; + +#define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass) + +#if OPT_TEK4014 +typedef struct _TekClassRec { + CoreClassPart core_class; + TekClassPart tek_class; +} TekClassRec; +#endif + +/* define masks for keyboard.flags */ +#define MODE_KAM 0x01 /* keyboard action mode */ +#define MODE_DECKPAM 0x02 /* keypad application mode */ +#define MODE_DECCKM 0x04 /* cursor keys */ +#define MODE_SRM 0x08 /* send-receive mode */ +#define MODE_DECBKM 0x10 /* backarrow */ + + +#define N_MARGINBELL 10 + +#define TAB_BITS_SHIFT 5 /* 2**5 == 32 */ +#define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) +#define TAB_ARRAY_SIZE 10 /* number of ints to provide MAX_TABS bits */ +#define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) + +typedef unsigned Tabs [TAB_ARRAY_SIZE]; + +typedef struct _XtermWidgetRec { + CorePart core; + TKeyboard keyboard; /* terminal keyboard */ + TScreen screen; /* terminal screen */ + unsigned flags; /* mode flags */ + int cur_foreground; /* current foreground color */ + int cur_background; /* current background color */ + Pixel dft_foreground; /* default foreground color */ + Pixel dft_background; /* default background color */ +#if OPT_ISO_COLORS + int sgr_foreground; /* current SGR foreground color */ + int sgr_background; /* current SGR background color */ + Boolean sgr_extended; /* SGR set with extended codes? */ +#endif +#if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS + int num_ptrs; /* number of pointers per row in 'ScrnBuf' */ +#endif + unsigned initflags; /* initial mode flags */ + Tabs tabs; /* tabstops of the terminal */ + Misc misc; /* miscellaneous parameters */ +} XtermWidgetRec, *XtermWidget; + +#if OPT_TEK4014 +typedef struct _TekWidgetRec { + CorePart core; + TekPart tek; +} TekWidgetRec, *TekWidget; +#endif /* OPT_TEK4014 */ + +/* + * terminal flags + * There are actually two namespaces mixed together here. + * One is the set of flags that can go in screen->visbuf attributes + * and which must fit in a char. + * The other is the global setting stored in + * term->flags and screen->save_modes. This need only fit in an unsigned. + */ + +/* global flags and character flags (visible character attributes) */ +#define INVERSE 0x01 /* invert the characters to be output */ +#define UNDERLINE 0x02 /* true if underlining */ +#define BOLD 0x04 +#define BLINK 0x08 +/* global flags (also character attributes) */ +#define BG_COLOR 0x10 /* true if background set */ +#define FG_COLOR 0x20 /* true if foreground set */ + +/* character flags (internal attributes) */ +#define PROTECTED 0x40 /* a character is drawn that cannot be erased */ +#define CHARDRAWN 0x80 /* a character has been drawn here on the + screen. Used to distinguish blanks from + empty parts of the screen when selecting */ + +#if OPT_BLINK_CURS +#define BOLDATTR(screen) (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) +#else +#define BOLDATTR(screen) (BOLD | BLINK) +#endif + +/* The following attributes make sense in the argument of drawXtermText() */ +#define NOBACKGROUND 0x100 /* Used for overstrike */ +#define NOTRANSLATION 0x200 /* No scan for chars missing in font */ +#define NATIVEENCODING 0x400 /* strings are in the font encoding */ +#define DOUBLEWFONT 0x800 /* The actual X-font is double-width */ +#define DOUBLEHFONT 0x1000 /* The actual X-font is double-height */ +#define CHARBYCHAR 0x2000 /* Draw chars one-by-one */ + +/* The toplevel-call to drawXtermText() should have text-attributes guarded: */ +#define DRAWX_MASK 0xff /* text flags should be bitand'ed */ + +/* The following attribute makes sense in the argument of xtermSpecialFont etc */ +#define NORESOLUTION 0x800000 /* find the font without resolution */ + + /* mask: user-visible attributes */ +#define ATTRIBUTES (INVERSE|UNDERLINE|BOLD|BLINK|BG_COLOR|FG_COLOR|INVISIBLE|PROTECTED) + +#define WRAPAROUND 0x400 /* true if auto wraparound mode */ +#define REVERSEWRAP 0x800 /* true if reverse wraparound mode */ +#define REVERSE_VIDEO 0x1000 /* true if screen white on black */ +#define LINEFEED 0x2000 /* true if in auto linefeed mode */ +#define ORIGIN 0x4000 /* true if in origin mode */ +#define INSERT 0x8000 /* true if in insert mode */ +#define SMOOTHSCROLL 0x10000 /* true if in smooth scroll mode */ +#define IN132COLUMNS 0x20000 /* true if in 132 column mode */ +#define INVISIBLE 0x40000 /* true if writing invisible text */ +#define NATIONAL 0x100000 /* true if writing national charset */ + +/* + * Per-line flags + */ +#define LINEWRAPPED 0x01 /* used once per line to indicate that it wraps + * onto the next line so we can tell the + * difference between lines that have wrapped + * around and lines that have ended naturally + * with a CR at column max_col. + */ +/* + * If we've set protected attributes with the DEC-style DECSCA, then we'll have + * to use DECSED or DECSEL to erase preserving protected text. (The normal ED, + * EL won't preserve protected-text). If we've used SPA, then normal ED and EL + * will preserve protected-text. To keep things simple, just remember the last + * control that was used to begin protected-text, and use that to determine how + * erases are performed (otherwise we'd need 2 bits per protected character). + */ +#define OFF_PROTECT 0 +#define DEC_PROTECT 1 +#define ISO_PROTECT 2 + +#ifdef SCROLLBAR_RIGHT +#define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) +#else +#define OriginX(screen) (ScrollbarWidth(screen) + screen->border) +#endif + +#define CursorX(screen,col) ((col) * FontWidth(screen) + OriginX(screen)) +#define CursorY(screen,row) ((((row) - screen->topline) * FontHeight(screen)) \ + + screen->border) + +#ifndef NO_ACTIVE_ICON +#define IsIcon(screen) ((screen)->whichVwin == &(screen)->iconVwin) +#define VWindow(screen) ((screen)->whichVwin->window) +#define VShellWindow XtWindow(SHELL_OF(term)) +#define TWindow(screen) ((screen)->whichTwin->window) +#define TShellWindow XtWindow(SHELL_OF(tekWidget)) +#define Width(screen) ((screen)->whichVwin->width) +#define Height(screen) ((screen)->whichVwin->height) +#define FullWidth(screen) ((screen)->whichVwin->fullwidth) +#define FullHeight(screen) ((screen)->whichVwin->fullheight) +#define FontWidth(screen) ((screen)->whichVwin->f_width) +#define FontHeight(screen) ((screen)->whichVwin->f_height) +#define FontAscent(screen) (IsIcon(screen) ? (screen)->fnt_icon->ascent \ + : (screen)->whichVwin->f_ascent) +#define FontDescent(screen) (IsIcon(screen) ? (screen)->fnt_icon->descent \ + : (screen)->whichVwin->f_descent) +#define ScrollbarWidth(screen) ((screen)->whichVwin->sb_info.width) +#define NormalGC(screen) ((screen)->whichVwin->normalGC) +#define ReverseGC(screen) ((screen)->whichVwin->reverseGC) +#define NormalBoldGC(screen) ((screen)->whichVwin->normalboldGC) +#define ReverseBoldGC(screen) ((screen)->whichVwin->reverseboldGC) +#define TWidth(screen) ((screen)->whichTwin->width) +#define THeight(screen) ((screen)->whichTwin->height) +#define TFullWidth(screen) ((screen)->whichTwin->fullwidth) +#define TFullHeight(screen) ((screen)->whichTwin->fullheight) +#define TekScale(screen) ((screen)->whichTwin->tekscale) + +#else /* NO_ACTIVE_ICON */ + +#define IsIcon(screen) (False) +#define VWindow(screen) ((screen)->fullVwin.window) +#define VShellWindow XtWindow(SHELL_OF(term)) +#define TWindow(screen) ((screen)->fullTwin.window) +#define TShellWindow XtWindow(SHELL_OF(tekWidget)) +#define Width(screen) ((screen)->fullVwin.width) +#define Height(screen) ((screen)->fullVwin.height) +#define FullWidth(screen) ((screen)->fullVwin.fullwidth) +#define FullHeight(screen) ((screen)->fullVwin.fullheight) +#define FontWidth(screen) ((screen)->fullVwin.f_width) +#define FontHeight(screen) ((screen)->fullVwin.f_height) +#define FontAscent(screen) ((screen)->fullVwin.f_ascent) +#define FontDescent(screen) ((screen)->fullVwin.f_descent) +#define ScrollbarWidth(screen) ((screen)->fullVwin.sb_info.width) +#define NormalGC(screen) ((screen)->fullVwin.normalGC) +#define ReverseGC(screen) ((screen)->fullVwin.reverseGC) +#define NormalBoldGC(screen) ((screen)->fullVwin.normalboldGC) +#define ReverseBoldGC(screen) ((screen)->fullVwin.reverseboldGC) +#define TWidth(screen) ((screen)->fullTwin.width) +#define THeight(screen) ((screen)->fullTwin.height) +#define TFullWidth(screen) ((screen)->fullTwin.fullwidth) +#define TFullHeight(screen) ((screen)->fullTwin.fullheight) +#define TekScale(screen) ((screen)->fullTwin.tekscale) + +#endif /* NO_ACTIVE_ICON */ + +#if OPT_TEK4014 +#define TEK_LINK_BLOCK_SIZE 1024 + +typedef struct Tek_Link +{ + struct Tek_Link *next; /* pointer to next TekLink in list + NULL <=> this is last TekLink */ + short fontsize; /* character size, 0-3 */ + short count; /* number of chars in data */ + char *ptr; /* current pointer into data */ + char data [TEK_LINK_BLOCK_SIZE]; +} TekLink; +#endif /* OPT_TEK4014 */ + +/* flags for cursors */ +#define OFF 0 +#define ON 1 +#define BLINKED_OFF 2 +#define CLEAR 0 +#define TOGGLE 1 + +/* flags for inhibit */ +#ifdef ALLOWLOGGING +#define I_LOG 0x01 +#endif +#define I_SIGNAL 0x02 +#define I_TEK 0x04 + +#endif /* included_ptyx_h */ diff --git a/vendor/x11iraf/xgterm/resize.c b/vendor/x11iraf/xgterm/resize.c new file mode 100644 index 00000000..f13f9fdd --- /dev/null +++ b/vendor/x11iraf/xgterm/resize.c @@ -0,0 +1,584 @@ +/* + * $XConsortium: resize.c,v 1.29 93/09/20 17:42:18 hersh Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + +/* resize.c */ + +#include <X11/Xos.h> +#include <stdio.h> +#include <ctype.h> + +#if defined(att) || (defined(SYSV) && defined(i386)) +#define ATT +#endif + +#ifdef SVR4 +#ifndef SYSV +#define SYSV +#endif +#define ATT +#endif + +#ifdef ATT +#define USE_USG_PTYS +#endif + +#ifdef APOLLO_SR9 +#define CANT_OPEN_DEV_TTY +#endif + +#ifdef _IBMR2 +#define CANT_OPEN_DEV_TTY +#endif + +#ifdef macII +#define USE_SYSV_TERMIO +#undef SYSV /* pretend to be bsd */ +#endif /* macII */ + +#ifdef SCO +#define USE_TERMCAP +#define USE_TERMINFO +#endif + +#if defined(SYSV) || defined(linux) +#define USE_SYSV_TERMIO +#define USE_SYSV_UTMP +#else /* else not SYSV */ +#define USE_TERMCAP +#endif /* SYSV */ + + +/* + * some OS's may want to use both, like SCO for example we catch + * here anyone who hasn't decided what they want. + */ +#if !defined(USE_TERMCAP) && !defined(USE_TERMINFO) +#define USE_TERMINFO +#endif + +#ifdef MINIX +#define USE_TERMIOS +#endif + +#include <sys/ioctl.h> +#ifdef USE_SYSV_TERMIO +#ifdef linux +#include <termio.h> +#define USG +#else +#include <sys/termio.h> +#endif +#else /* else not USE_SYSV_TERMIO */ +#if defined(USE_POSIX_TERMIOS) || defined(MINIX) +#include <termios.h> +#else +#include <sgtty.h> +#endif +#endif /* USE_SYSV_TERMIO */ + +#ifdef USE_USG_PTYS +#include <sys/stream.h> +#include <sys/stropts.h> +#ifndef SVR4 +#include <sys/ptem.h> +#endif +#endif + +#include <signal.h> +#include <pwd.h> + +#ifdef SIGNALRETURNSINT +#define SIGNAL_T int +#else +#define SIGNAL_T void +#endif + +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#else +char *getenv(); +#endif + +#ifdef USE_SYSV_TERMIO +#ifdef X_NOT_POSIX +#if !defined(SYSV) && !defined(i386) +extern struct passwd *getpwuid(); /* does ANYBODY need this? */ +#endif /* SYSV && i386 */ +#endif /* X_NOT_POSIX */ +#endif /* USE_SYSV_TERMIO */ + +#ifdef USE_TERMIOS +#define USE_SYSV_TERMIO +#define termio termios +#define TCGETA TCGETS +#define TCSETAW TCSETSW +#ifndef IUCLC +#define IUCLC 0 +#endif +#endif + +#define EMULATIONS 2 +#define SUN 1 +#define TIMEOUT 10 +#define VT100 0 + +#define SHELL_UNKNOWN 0 +#define SHELL_C 1 +#define SHELL_BOURNE 2 +struct { + char *name; + int type; +} shell_list[] = { + "csh", SHELL_C, /* vanilla cshell */ + "tcsh", SHELL_C, + "jcsh", SHELL_C, + "sh", SHELL_BOURNE, /* vanilla Bourne shell */ + "ksh", SHELL_BOURNE, /* Korn shell (from AT&T toolchest) */ + "ksh-i", SHELL_BOURNE, /* other name for latest Korn shell */ + "bash", SHELL_BOURNE, /* GNU Bourne again shell */ + "jsh", SHELL_BOURNE, + NULL, SHELL_BOURNE /* default (same as xgterm's) */ +}; + +char *emuname[EMULATIONS] = { + "VT100", + "Sun", +}; +char *myname; +int shell_type = SHELL_UNKNOWN; +char *getsize[EMULATIONS] = { + "\0337\033[r\033[999;999H\033[6n", + "\033[18t", +}; +#if !defined(sun) || defined(SVR4) +#ifdef TIOCSWINSZ +char *getwsize[EMULATIONS] = { /* size in pixels */ + 0, + "\033[14t", +}; +#endif /* TIOCSWINSZ */ +#endif /* sun */ +char *restore[EMULATIONS] = { + "\0338", + 0, +}; +char *setname = ""; +char *setsize[EMULATIONS] = { + 0, + "\033[8;%s;%st", +}; +#ifdef USE_SYSV_TERMIO +struct termio tioorig; +#else /* not USE_SYSV_TERMIO */ +struct sgttyb sgorig; +#endif /* USE_SYSV_TERMIO */ +char *size[EMULATIONS] = { + "\033[%d;%dR", + "\033[8;%d;%dt", +}; +char sunname[] = "sunsize"; +int tty; +FILE *ttyfp; +#if !defined(sun) || defined(SVR4) +#ifdef TIOCSWINSZ +char *wsize[EMULATIONS] = { + 0, + "\033[4;%hd;%hdt", +}; +#endif /* TIOCSWINSZ */ +#endif /* sun */ + +char *strindex (); + +SIGNAL_T onintr(); + +/* + resets termcap string to reflect current screen size + */ +main (argc, argv) + int argc; + char **argv; +{ + register char *ptr, *env; + register int emu = VT100; + char *shell; + struct passwd *pw; + int i; + int rows, cols; +#ifdef USE_SYSV_TERMIO + struct termio tio; +#else /* not USE_SYSV_TERMIO */ + struct sgttyb sg; +#endif /* USE_SYSV_TERMIO */ +#ifdef USE_TERMCAP + char termcap [1024]; + char newtc [1024]; +#endif /* USE_TERMCAP */ + char buf[BUFSIZ]; +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + struct ttysize ts; +#endif /* TIOCSSIZE */ +#else /* sun */ +#ifdef TIOCSWINSZ + struct winsize ws; +#endif /* TIOCSWINSZ */ +#endif /* sun */ + char *name_of_tty; +#ifdef CANT_OPEN_DEV_TTY + extern char *ttyname(); +#endif + + ptr = strrchr(myname = argv[0], '/'); + if(ptr) + myname = ptr + 1; + if(strcmp(myname, sunname) == 0) + emu = SUN; + for(argv++, argc-- ; argc > 0 && **argv == '-' ; argv++, argc--) { + switch((*argv)[1]) { + case 's': /* Sun emulation */ + if(emu == SUN) + Usage(); /* Never returns */ + emu = SUN; + break; + case 'u': /* Bourne (Unix) shell */ + shell_type = SHELL_BOURNE; + break; + case 'c': /* C shell */ + shell_type = SHELL_C; + break; + default: + Usage(); /* Never returns */ + } + } + + if (SHELL_UNKNOWN == shell_type) { + /* Find out what kind of shell this user is running. + * This is the same algorithm that xgterm uses. + */ + if (((ptr = getenv("SHELL")) == NULL || *ptr == 0) && + (((pw = getpwuid(getuid())) == NULL) || + *(ptr = pw->pw_shell) == 0)) + /* this is the same default that xgterm uses */ + ptr = "/bin/sh"; + + shell = strrchr(ptr, '/'); + if(shell) + shell++; + else + shell = ptr; + + /* now that we know, what kind is it? */ + for (i = 0; shell_list[i].name; i++) + if (!strcmp(shell_list[i].name, shell)) + break; + shell_type = shell_list[i].type; + } + + if(argc == 2) { + if(!setsize[emu]) { + fprintf(stderr, + "%s: Can't set window size under %s emulation\n", + myname, emuname[emu]); + exit(1); + } + if(!checkdigits(argv[0]) || !checkdigits(argv[1])) + Usage(); /* Never returns */ + } else if(argc != 0) + Usage(); /* Never returns */ + +#ifdef CANT_OPEN_DEV_TTY + if ((name_of_tty = ttyname(fileno(stderr))) == NULL) +#endif + name_of_tty = "/dev/tty"; + + if ((ttyfp = fopen (name_of_tty, "r+")) == NULL) { + fprintf (stderr, "%s: can't open terminal %s\n", + myname, name_of_tty); + exit (1); + } + tty = fileno(ttyfp); +#ifdef USE_TERMCAP + if(!(env = getenv("TERM")) || !*env) { + env = "xgterm"; + if(SHELL_BOURNE == shell_type) + setname = "TERM=xterm;\nexport TERM;\n"; + else + setname = "setenv TERM xterm;\n"; + } + if(tgetent (termcap, env) <= 0) { + fprintf(stderr, "%s: Can't get entry \"%s\"\n", + myname, env); + exit(1); + } +#endif /* USE_TERMCAP */ +#ifdef USE_TERMINFO + if(!(env = getenv("TERM")) || !*env) { + env = "xterm"; + if(SHELL_BOURNE == shell_type) + setname = "TERM=xterm;\nexport TERM;\n"; + else setname = "setenv TERM xterm;\n"; + } +#endif /* USE_TERMINFO */ + +#ifdef USE_SYSV_TERMIO + ioctl (tty, TCGETA, &tioorig); + tio = tioorig; + tio.c_iflag &= ~(ICRNL | IUCLC); + tio.c_lflag &= ~(ICANON | ECHO); + tio.c_cflag |= CS8; + tio.c_cc[VMIN] = 6; + tio.c_cc[VTIME] = 1; +#else /* else not USE_SYSV_TERMIO */ + ioctl (tty, TIOCGETP, &sgorig); + sg = sgorig; + sg.sg_flags |= RAW; + sg.sg_flags &= ~ECHO; +#endif /* USE_SYSV_TERMIO */ + signal(SIGINT, onintr); + signal(SIGQUIT, onintr); + signal(SIGTERM, onintr); +#ifdef USE_SYSV_TERMIO + ioctl (tty, TCSETAW, &tio); +#else /* not USE_SYSV_TERMIO */ + ioctl (tty, TIOCSETP, &sg); +#endif /* USE_SYSV_TERMIO */ + + if (argc == 2) { + sprintf (buf, setsize[emu], argv[0], argv[1]); + write(tty, buf, strlen(buf)); + } + write(tty, getsize[emu], strlen(getsize[emu])); + readstring(ttyfp, buf, size[emu]); + if(sscanf (buf, size[emu], &rows, &cols) != 2) { + fprintf(stderr, "%s: Can't get rows and columns\r\n", myname); + onintr(0); + } + if(restore[emu]) + write(tty, restore[emu], strlen(restore[emu])); +#if defined(sun) && !defined(SVR4) +#ifdef TIOCGSIZE + /* finally, set the tty's window size */ + if (ioctl (tty, TIOCGSIZE, &ts) != -1) { + ts.ts_lines = rows; + ts.ts_cols = cols; + ioctl (tty, TIOCSSIZE, &ts); + } +#endif /* TIOCGSIZE */ +#else /* sun */ +#ifdef TIOCGWINSZ + /* finally, set the tty's window size */ + if(getwsize[emu]) { + /* get the window size in pixels */ + write (tty, getwsize[emu], strlen (getwsize[emu])); + readstring(ttyfp, buf, wsize[emu]); + if(sscanf (buf, wsize[emu], &ws.ws_xpixel, &ws.ws_ypixel) != 2) { + fprintf(stderr, "%s: Can't get window size\r\n", myname); + onintr(0); + } + ws.ws_row = rows; + ws.ws_col = cols; + ioctl (tty, TIOCSWINSZ, &ws); + } else if (ioctl (tty, TIOCGWINSZ, &ws) != -1) { + /* we don't have any way of directly finding out + the current height & width of the window in pixels. We try + our best by computing the font height and width from the "old" + struct winsize values, and multiplying by these ratios...*/ + if (ws.ws_col != 0) + ws.ws_xpixel = cols * (ws.ws_xpixel / ws.ws_col); + if (ws.ws_row != 0) + ws.ws_ypixel = rows * (ws.ws_ypixel / ws.ws_row); + ws.ws_row = rows; + ws.ws_col = cols; + ioctl (tty, TIOCSWINSZ, &ws); + } +#endif /* TIOCGWINSZ */ +#endif /* sun */ + +#ifdef USE_SYSV_TERMIO + ioctl (tty, TCSETAW, &tioorig); +#else /* not USE_SYSV_TERMIO */ + ioctl (tty, TIOCSETP, &sgorig); +#endif /* USE_SYSV_TERMIO */ + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + +#ifdef USE_TERMCAP + /* update termcap string */ + /* first do columns */ + if ((ptr = strindex (termcap, "co#")) == NULL) { + fprintf(stderr, "%s: No `co#'\n", myname); + exit (1); + } + + i = ptr - termcap + 3; + strncpy (newtc, termcap, i); + sprintf (newtc + i, "%d", cols); + ptr = strchr(ptr, ':'); + strcat (newtc, ptr); + + /* now do lines */ + if ((ptr = strindex (newtc, "li#")) == NULL) { + fprintf(stderr, "%s: No `li#'\n", myname); + exit (1); + } + + i = ptr - newtc + 3; + strncpy (termcap, newtc, i); + sprintf (termcap + i, "%d", rows); + ptr = strchr(ptr, ':'); + strcat (termcap, ptr); +#endif /* USE_TERMCAP */ + + if(SHELL_BOURNE == shell_type) { + +#ifdef USE_TERMCAP + printf ("%sTERMCAP='%s';\n", + setname, termcap); +#endif /* USE_TERMCAP */ +#ifdef USE_TERMINFO +#ifndef SVR4 + printf ("%sCOLUMNS=%d;\nLINES=%d;\nexport COLUMNS LINES;\n", + setname, cols, rows); +#endif /* !SVR4 */ +#endif /* USE_TERMINFO */ + + } else { /* not Bourne shell */ + +#ifdef USE_TERMCAP + printf ("set noglob;\n%ssetenv TERMCAP '%s';\nunset noglob;\n", + setname, termcap); +#endif /* USE_TERMCAP */ +#ifdef USE_TERMINFO +#ifndef SVR4 + printf ("set noglob;\n%ssetenv COLUMNS '%d';\nsetenv LINES '%d';\nunset noglob;\n", + setname, cols, rows); +#endif /* !SVR4 */ +#endif /* USE_TERMINFO */ + } + exit(0); +} + +char *strindex (s1, s2) +/* + returns a pointer to the first occurrence of s2 in s1, or NULL if there are + none. + */ +register char *s1, *s2; +{ + register char *s3; + int s2len = strlen (s2); + + while ((s3 = strchr(s1, *s2)) != NULL) + { + if (strncmp (s3, s2, s2len) == 0) return (s3); + s1 = ++s3; + } + return (NULL); +} + +checkdigits(str) +register char *str; +{ + while(*str) { + if(!isdigit(*str)) + return(0); + str++; + } + return(1); +} + +readstring(fp, buf, str) + register FILE *fp; + register char *buf; + char *str; +{ + register int last, c; + SIGNAL_T timeout(); +#if !defined(USG) && !defined(MINIX) && !defined(SCO) + struct itimerval it; +#endif + + signal(SIGALRM, timeout); +#if defined(USG) || defined(MINIX) || defined(SCO) + alarm (TIMEOUT); +#else + memset((char *)&it, 0, sizeof(struct itimerval)); + it.it_value.tv_sec = TIMEOUT; + setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); +#endif + if ((c = getc(fp)) == 0233) { /* meta-escape, CSI */ + *buf++ = c = '\033'; + *buf++ = '['; + } else + *buf++ = c; + if(c != *str) { + fprintf(stderr, "%s: unknown character, exiting.\r\n", myname); + onintr(0); + } + last = str[strlen(str) - 1]; + while((*buf++ = getc(fp)) != last) + ; +#if defined(USG) || defined(MINIX) || defined(SCO) + alarm (0); +#else + memset((char *)&it, 0, sizeof(struct itimerval)); + setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); +#endif + *buf = 0; +} + +Usage() +{ + fprintf(stderr, strcmp(myname, sunname) == 0 ? + "Usage: %s [rows cols]\n" : + "Usage: %s [-u] [-c] [-s [rows cols]]\n", myname); + exit(1); +} + +SIGNAL_T +timeout(sig) + int sig; +{ + fprintf(stderr, "%s: Time out occurred\r\n", myname); + onintr(sig); +} + +/* ARGSUSED */ +SIGNAL_T +onintr(sig) + int sig; +{ +#ifdef USE_SYSV_TERMIO + ioctl (tty, TCSETAW, &tioorig); +#else /* not USE_SYSV_TERMIO */ + ioctl (tty, TIOCSETP, &sgorig); +#endif /* USE_SYSV_TERMIO */ + exit(1); +} diff --git a/vendor/x11iraf/xgterm/resize.man b/vendor/x11iraf/xgterm/resize.man new file mode 100644 index 00000000..e0c83a64 --- /dev/null +++ b/vendor/x11iraf/xgterm/resize.man @@ -0,0 +1,72 @@ +.TH RESIZE 1 "Release 5" "X Version 11" +.SH NAME +resize \- utility to set TERMCAP and terminal settings to current window size +.SH SYNOPSIS +.B resize +[-u] [\-s [row col]] +.SH DESCRIPTION +.I Resize +prints a shell command for setting the TERM and TERMCAP environment variables +to indicate the current size of \fIxgterm\fP window from which the command +is run. For this output to take effect, \fIresize\fP must either be evaluated +as part of the command line (usually done with a shell alias or function) or +else redirected to a file which can then be read in. From the C shell (usually +known as \fI/bin/csh\fP), the following alias could be defined in the +user's \fI.cshrc\fP: +.sp +.nf + % alias rs 'set noglob; `eval resize`' +.fi +.sp +After resizing the window, the user would type: +.sp +.nf + % rs +.fi +.sp +Users of versions of the Bourne shell (usually known as \fI/bin/sh\fP) that +don't have command +functions will need to send the output to a temporary file and the read it back +in with the ``.'' command: +.sp +.nf + $ resize >/tmp/out + $ . /tmp/out +.fi +.SH OPTIONS +The following options may be used with \fIresize\fP: +.TP 8 +.B \-u +This option indicates that Bourne shell commands should be generated even if +the user's current shell isn't \fI/bin/sh\fP. +.TP 8 +.B \-c +This option indicates that C shell commands should be generated even if the +user's current shell isn't \fI/bin/csh\fP. +.TP 8 +.B \-s \fR[\fIrows columns\fP] +This option indicates that that Sun console escape sequences will be used +instead of the special \fIxgterm\fP escape code. If \fIrows\fP and +\fIcolumns\fP are given, \fIresize\fP will ask the \fIxgterm\fP to resize +itself. However, the window manager may choose to disallow the change. +.SH FILES +/etc/termcap for the base termcap entry to modify. +.br +~/.cshrc user's alias for the command. +.SH "SEE ALSO" +csh(1), tset(1), xgterm(1) +.SH AUTHORS +Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley) +.br +Copyright (c) 1984, 1985 by Massachusetts Institute of Technology. +.br +See +.IR X (1) +for a complete copyright notice. +.SH BUGS +The \fI-u\fP or \fI-c\fP must appear to the left of \fI-s\fP if both are +specified. +.PP +There should be some global notion of display size; termcap and +terminfo need to be rethought in the context of window systems. +(Fixed in 4.3BSD, and Ultrix-32 1.2) diff --git a/vendor/x11iraf/xgterm/screen.c b/vendor/x11iraf/xgterm/screen.c new file mode 100644 index 00000000..0928daa9 --- /dev/null +++ b/vendor/x11iraf/xgterm/screen.c @@ -0,0 +1,771 @@ +/* + * $XConsortium: screen.c,v 1.33 94/04/02 17:34:36 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* screen.c */ + +#include "ptyx.h" +#include "error.h" +#include "data.h" + +#include <stdio.h> +#include <signal.h> +#ifdef SVR4 +#include <termios.h> +#else +#include <sys/ioctl.h> +#endif + +#ifdef att +#include <sys/termio.h> +#include <sys/stream.h> /* get typedef used in ptem.h */ +#include <sys/ptem.h> +#endif + +#ifdef MINIX +#include <termios.h> +#endif + + +ScrnBuf Allocate (nrow, ncol, addr) +/* + allocates memory for a 2-dimensional array of chars and returns a pointer + thereto + each line is formed from a pair of char arrays. The first (even) one is + the actual character array and the second (odd) one is the attributes. +> each line is formed from four char arrays. The first one is the actual +> character array, the second one is the attributes, the third is the +> foreground color, and the fourth is the background color. + */ +register int nrow, ncol; +Char **addr; +{ + register ScrnBuf base; + register Char *tmp; + register int i; + + if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 4), sizeof (char *))) == 0) + SysError (ERROR_SCALLOC); + + if ((tmp = (Char *)calloc((unsigned) (nrow * ncol), sizeof(char))) == 0) + SysError (ERROR_SCALLOC2); + + *addr = tmp; + for (i = 0; i < nrow; i++, tmp += ncol) + base[i] = tmp; + + return (base); +} + +/* + * This is called when the screen is resized. + * Returns the number of lines the text was moved down (neg for up). + * (Return value only necessary with SouthWestGravity.) + */ +static +Reallocate(sbuf, sbufaddr, nrow, ncol, oldrow, oldcol) + ScrnBuf *sbuf; + Char **sbufaddr; + int nrow, ncol, oldrow, oldcol; +{ + register ScrnBuf base; + register Char *tmp; + register int i, minrows, mincols; + Char *oldbuf; + int move_down = 0, move_up = 0; + + if (sbuf == NULL || *sbuf == NULL) + return 0; + + oldrow *= 4; + oldbuf = *sbufaddr; + + /* + * Special case if oldcol == ncol - straight forward realloc and + * update of the additional lines in sbuf + */ + + /* this is a good idea, but doesn't seem to be implemented. -gildea */ + + /* + * realloc sbuf, the pointers to all the lines. + * If the screen shrinks, remove lines off the top of the buffer + * if resizeGravity resource says to do so. + */ + nrow *= 4; + if (nrow < oldrow && term->misc.resizeGravity == SouthWestGravity) { + /* Remove lines off the top of the buffer if necessary. */ + move_up = oldrow-nrow + - 4*(term->screen.max_row - term->screen.cur_row); + if (move_up < 0) + move_up = 0; + /* Overlapping memmove here! */ + memmove( *sbuf, *sbuf+move_up, + (oldrow-move_up)*sizeof((*sbuf)[0]) ); + } + *sbuf = (ScrnBuf) realloc((char *) (*sbuf), + (unsigned) (nrow * sizeof(char *))); + if (*sbuf == 0) + SysError(ERROR_RESIZE); + base = *sbuf; + + /* + * create the new buffer space and copy old buffer contents there + * line by line. + */ + if ((tmp = (Char *)calloc((unsigned) (nrow * ncol), sizeof(char))) == 0) + SysError(ERROR_SREALLOC); + *sbufaddr = tmp; + minrows = (oldrow < nrow) ? oldrow : nrow; + mincols = (oldcol < ncol) ? oldcol : ncol; + if (nrow > oldrow && term->misc.resizeGravity == SouthWestGravity) { + /* move data down to bottom of expanded screen */ + move_down = Min(nrow-oldrow, 4*term->screen.savedlines); + tmp += ncol*move_down; + } + for (i = 0; i < minrows; i++, tmp += ncol) { + memmove( tmp, base[i], mincols); + } + /* + * update the pointers in sbuf + */ + for (i = 0, tmp = *sbufaddr; i < nrow; i++, tmp += ncol) + base[i] = tmp; + + /* Now free the old buffer */ + free(oldbuf); + + return move_down ? move_down/4 : -move_up/4; /* convert to rows */ +} + +ScreenWrite (screen, str, flags, cur_fg, cur_bg, length) +/* + Writes str into buf at row row and column col. Characters are set to match + flags. + */ +TScreen *screen; +char *str; +register unsigned flags; +register unsigned cur_fg, cur_bg; +register int length; /* length of string */ +{ + register Char *attrs, *attrs0, *fgs, *bgs; + register int avail = screen->max_col - screen->cur_col + 1; + register Char *col; + register int wrappedbit; + + if (length > avail) + length = avail; + if (length <= 0) + return; + + col = screen->buf[avail = 4 * screen->cur_row] + screen->cur_col; + attrs = attrs0 = screen->buf[avail + 1] + screen->cur_col; + fgs = screen->buf[avail + 2] + screen->cur_col; + bgs = screen->buf[avail + 3] + screen->cur_col; + + wrappedbit = *attrs0&LINEWRAPPED; + flags &= ATTRIBUTES; + flags |= CHARDRAWN; + memmove( col, str, length); + while(length-- > 0) + { + *attrs++ = flags; + *fgs++ = cur_fg; + *bgs++ = cur_bg; + } + if (wrappedbit) + *attrs0 |= LINEWRAPPED; +} + +ScrnInsertLine (sb, last, where, n, size) +/* + Inserts n blank lines at sb + where, treating last as a bottom margin. + Size is the size of each entry in sb. + Requires: 0 <= where < where + n <= last + n <= MAX_ROWS + */ +register ScrnBuf sb; +int last; +register int where, n, size; +{ + register int i; + char *save [4 * MAX_ROWS]; + + + /* save n lines at bottom */ + memmove( (char *) save, (char *) &sb [4 * (last -= n - 1)], + 4 * sizeof (char *) * n); + + /* clear contents of old rows */ + for (i = 4 * n - 1; i >= 0; i--) + bzero ((char *) save [i], size); + + /* + * WARNING, overlapping copy operation. Move down lines (pointers). + * + * +----|---------|--------+ + * + * is copied in the array to: + * + * +--------|---------|----+ + */ + memmove( (char *) &sb [4 * (where + n)], (char *) &sb [4 * where], + 4 * sizeof (char *) * (last - where)); + + /* reuse storage for new lines at where */ + memmove( (char *) &sb[4 * where], (char *)save, 4 * sizeof(char *) * n); +} + + +ScrnDeleteLine (sb, last, where, n, size) +/* + Deletes n lines at sb + where, treating last as a bottom margin. + Size is the size of each entry in sb. + Requires 0 <= where < where + n < = last + n <= MAX_ROWS + */ +register ScrnBuf sb; +register int n, last, size; +int where; +{ + register int i; + char *save [4 * MAX_ROWS]; + + /* save n lines at where */ + memmove( (char *)save, (char *) &sb[4 * where], 4 * sizeof(char *) * n); + + /* clear contents of old rows */ + for (i = 4 * n - 1 ; i >= 0 ; i--) + bzero ((char *) save [i], size); + + /* move up lines */ + memmove( (char *) &sb[4 * where], (char *) &sb[4 * (where + n)], + 4 * sizeof (char *) * ((last -= n - 1) - where)); + + /* reuse storage for new bottom lines */ + memmove( (char *) &sb[4 * last], (char *)save, + 4 * sizeof(char *) * n); +} + + +ScrnInsertChar (sb, row, col, n, size) + /* + Inserts n blanks in sb at row, col. Size is the size of each row. + */ + ScrnBuf sb; + int row, size; + register int col, n; +{ + register int i, j; + register Char *ptr = sb [4 * row]; + register Char *attrs = sb [4 * row + 1]; + int wrappedbit = attrs[0]&LINEWRAPPED; + + attrs[0] &= ~LINEWRAPPED; /* make sure the bit isn't moved */ + for (i = size - 1; i >= col + n; i--) { + ptr[i] = ptr[j = i - n]; + attrs[i] = attrs[j]; + } + + for (i=col; i<col+n; i++) + ptr[i] = ' '; + for (i=col; i<col+n; i++) + attrs[i] = CHARDRAWN; + + if (wrappedbit) + attrs[0] |= LINEWRAPPED; +} + + +ScrnDeleteChar (sb, row, col, n, size) + /* + Deletes n characters in sb at row, col. Size is the size of each row. + */ + ScrnBuf sb; + register int row, size; + register int n, col; +{ + register Char *ptr = sb[4 * row]; + register Char *attrs = sb[4 * row + 1]; + register nbytes = (size - n - col); + int wrappedbit = attrs[0]&LINEWRAPPED; + + memmove( ptr + col, ptr + col + n, nbytes); + memmove( attrs + col, attrs + col + n, nbytes); + bzero (ptr + size - n, n); + bzero (attrs + size - n, n); + if (wrappedbit) + attrs[0] |= LINEWRAPPED; +} + + +ScrnRefresh (screen, toprow, leftcol, nrows, ncols, force) +/* + Repaints the area enclosed by the parameters. + Requires: (toprow, leftcol), (toprow + nrows, leftcol + ncols) are + coordinates of characters in screen; + nrows and ncols positive. + */ +register TScreen *screen; +int toprow, leftcol, nrows, ncols; +Boolean force; /* ... leading/trailing spaces */ +{ + int y = toprow * FontHeight(screen) + screen->border + + screen->fnt_norm->ascent; + register int row; + register int topline = screen->topline; + int maxrow = toprow + nrows - 1; + int scrollamt = screen->scroll_amt; + int max = screen->max_row; + + if(screen->cursor_col >= leftcol && screen->cursor_col <= + (leftcol + ncols - 1) && screen->cursor_row >= toprow + topline && + screen->cursor_row <= maxrow + topline) + screen->cursor_state = OFF; + for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { + register Char *chars; + register Char *attrs; + register Char *fgs, *bgs; + register int col = leftcol; + int maxcol = leftcol + ncols - 1; + int lastind; + int flags; + int fg, bg; + int x, n; + GC gc; + Pixel fg_pix, bg_pix; + Boolean hilite; + + if (row < screen->top_marg || row > screen->bot_marg) + lastind = row; + else + lastind = row - scrollamt; + + if (lastind < 0 || lastind > max) + continue; + + chars = screen->buf [4 * (lastind + topline)]; + attrs = screen->buf [4 * (lastind + topline) + 1]; + fgs = screen->buf [4 * (lastind + topline) + 2]; + bgs = screen->buf [4 * (lastind + topline) + 3]; + + if (row < screen->startHRow || row > screen->endHRow || + (row == screen->startHRow && maxcol < screen->startHCol) || + (row == screen->endHRow && col >= screen->endHCol)) + { + /* row does not intersect selection; don't hilite */ + if (!force) { + while (col <= maxcol && (attrs[col] & ~BOLD) == 0 && + (chars[col] & ~040) == 0) + col++; + + while (col <= maxcol && (attrs[maxcol] & ~BOLD) == 0 && + (chars[maxcol] & ~040) == 0) + maxcol--; + } + hilite = False; + } + else { + /* row intersects selection; split into pieces of single type */ + if (row == screen->startHRow && col < screen->startHCol) { + ScrnRefresh(screen, row, col, 1, screen->startHCol - col, + force); + col = screen->startHCol; + } + if (row == screen->endHRow && maxcol >= screen->endHCol) { + ScrnRefresh(screen, row, screen->endHCol, 1, + maxcol - screen->endHCol + 1, force); + maxcol = screen->endHCol - 1; + } + /* remaining piece should be hilited */ + hilite = True; + } + + if (col > maxcol) continue; + + flags = attrs[col]; + fg = fgs[col]; + bg = bgs[col]; + + fg_pix = (flags & FG_COLOR) ? screen->colors[fg] : + screen->foreground; + bg_pix = (flags & BG_COLOR) ? screen->colors[bg] : + term->core.background_pixel; + + if ( (!hilite && (flags & INVERSE) != 0) || + (hilite && (flags & INVERSE) == 0) ) { + if (flags & BOLD) gc = screen->reverseboldGC; + else gc = screen->reverseGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + } + + } else { + if (flags & BOLD) gc = screen->normalboldGC; + else gc = screen->normalGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } + } + + x = CursorX(screen, col); + lastind = col; + + for (; col <= maxcol; col++) { + if (attrs[col] != flags || + (term->misc.dynamicColors && + ((flags & FG_COLOR && fgs[col] != fg) || + (flags & BG_COLOR && bgs[col] != bg)))) { + + XDrawImageString(screen->display, TextWindow(screen), + gc, x, y, (char *) &chars[lastind], n = col - lastind); + if((flags & BOLD) && screen->enbolden) + XDrawString(screen->display, TextWindow(screen), + gc, x + 1, y, (char *) &chars[lastind], n); + if((flags & UNDERLINE) && screen->underline) + XDrawLine(screen->display, TextWindow(screen), + gc, x, y+1, x+n*FontWidth(screen), y+1); + + x += (col - lastind) * FontWidth(screen); + + lastind = col; + + flags = attrs[col]; + fg = fgs[col]; + bg = bgs[col]; + + fg_pix = (flags & FG_COLOR) ? screen->colors[fg] + : screen->foreground; + bg_pix = (flags & BG_COLOR) ? screen->colors[bg] + : term->core.background_pixel; + + if ( (!hilite && (flags & INVERSE) != 0) || + (hilite && (flags & INVERSE) == 0) ) { + if (flags & BOLD) gc = screen->reverseboldGC; + else gc = screen->reverseGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + } + } else { + if (flags & BOLD) gc = screen->normalboldGC; + else gc = screen->normalGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } + } + } + + if(chars[col] == 0) + chars[col] = ' '; + } + + + if ( (!hilite && (flags & INVERSE) != 0) || + (hilite && (flags & INVERSE) == 0) ) { + if (flags & BOLD) gc = screen->reverseboldGC; + else gc = screen->reverseGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, gc, bg_pix); + XSetBackground(screen->display, gc, fg_pix); + } + + } else { + if (flags & BOLD) gc = screen->normalboldGC; + else gc = screen->normalGC; + + if (term->misc.dynamicColors) { + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } + } + + XDrawImageString(screen->display, TextWindow(screen), gc, + x, y, (char *) &chars[lastind], n = col - lastind); + if((flags & BOLD) && screen->enbolden) + XDrawString(screen->display, TextWindow(screen), gc, + x + 1, y, (char *) &chars[lastind], n); + if((flags & UNDERLINE) && screen->underline) + XDrawLine(screen->display, TextWindow(screen), gc, + x, y+1, x + n * FontWidth(screen), y+1); + } +} + +ClearBufRows (screen, first, last) +/* + Sets the rows first though last of the buffer of screen to spaces. + Requires first <= last; first, last are rows of screen->buf. + */ +register TScreen *screen; +register int first, last; +{ + first *= 4; + last = 4 * last + 3; + while (first <= last) + bzero (screen->buf [first++], (screen->max_col + 1)); +} + +/* + Resizes screen: + 1. If new window would have fractional characters, sets window size so as to + discard fractional characters and returns -1. + Minimum screen size is 1 X 1. + Note that this causes another ExposeWindow event. + 2. Enlarges screen->buf if necessary. New space is appended to the bottom + and to the right + 3. Reduces screen->buf if necessary. Old space is removed from the bottom + and from the right + 4. Cursor is positioned as closely to its former position as possible + 5. Sets screen->max_row and screen->max_col to reflect new size + 6. Maintains the inner border (and clears the border on the screen). + 7. Clears origin mode and sets scrolling region to be entire screen. + 8. Returns 0 + */ +ScreenResize (screen, width, height, flags) + register TScreen *screen; + int width, height; + unsigned *flags; +{ + int rows, cols; + int border = 2 * screen->border; + int move_down_by; +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + struct ttysize ts; +#endif /* TIOCSSIZE */ +#else /* sun */ +#ifdef TIOCSWINSZ + struct winsize ws; +#endif /* TIOCSWINSZ */ +#endif /* sun */ + Window tw = TextWindow (screen); + + /* clear the right and bottom internal border because of NorthWest + gravity might have left junk on the right and bottom edges */ + XClearArea (screen->display, tw, + width - screen->border, 0, /* right edge */ + screen->border, height, /* from top to bottom */ + False); + XClearArea (screen->display, tw, + 0, height - screen->border, /* bottom */ + width, screen->border, /* all across the bottom */ + False); + + /* round so that it is unlikely the screen will change size on */ + /* small mouse movements. */ + rows = (height + FontHeight(screen) / 2 - border) / + FontHeight(screen); + cols = (width + FontWidth(screen) / 2 - border - screen->scrollbar) / + FontWidth(screen); + if (rows < 1) rows = 1; + if (cols < 1) cols = 1; + + /* update buffers if the screen has changed size */ + if (screen->max_row != rows - 1 || screen->max_col != cols - 1) { + register int savelines = screen->scrollWidget ? + screen->savelines : 0; + int delta_rows = rows - (screen->max_row + 1); + + if(screen->cursor_state) + HideCursor(); + if ( screen->alternate + && term->misc.resizeGravity == SouthWestGravity ) + /* swap buffer pointers back to make all this hair work */ + SwitchBufPtrs(screen); + if (screen->altbuf) + (void) Reallocate(&screen->altbuf, (Char **)&screen->abuf_address, + rows, cols, screen->max_row + 1, screen->max_col + 1); + move_down_by = Reallocate(&screen->allbuf, + (Char **)&screen->sbuf_address, + rows + savelines, cols, + screen->max_row + 1 + savelines, + screen->max_col + 1); + screen->buf = &screen->allbuf[4 * savelines]; + + screen->max_row += delta_rows; + screen->max_col = cols - 1; + + if (term->misc.resizeGravity == SouthWestGravity) { + screen->savedlines -= move_down_by; + if (screen->savedlines < 0) + screen->savedlines = 0; + if (screen->savedlines > screen->savelines) + screen->savedlines = screen->savelines; + if (screen->topline < -screen->savedlines) + screen->topline = -screen->savedlines; + screen->cur_row += move_down_by; + screen->cursor_row += move_down_by; + ScrollSelection(screen, move_down_by); + + if (screen->alternate) + SwitchBufPtrs(screen); /* put the pointers back */ + } + + /* adjust scrolling region */ + screen->top_marg = 0; + screen->bot_marg = screen->max_row; + *flags &= ~ORIGIN; + + if (screen->cur_row > screen->max_row) + screen->cur_row = screen->max_row; + if (screen->cur_col > screen->max_col) + screen->cur_col = screen->max_col; + + screen->fullVwin.height = height - border; + screen->fullVwin.width = width - border - screen->scrollbar; + + } else if(FullHeight(screen) == height && FullWidth(screen) == width) + return(0); /* nothing has changed at all */ + + if (screen->scrollWidget) { + if (term->misc.sb_right) { + ResizeScrollBar(screen->scrollWidget, width - + screen->scrollWidget->core.width - + screen->scrollWidget->core.border_width, 0, height -1); + } else { + ResizeScrollBar(screen->scrollWidget, -1, -1, height); + } + } + + screen->fullVwin.fullheight = height; + screen->fullVwin.fullwidth = width; + ResizeSelection (screen, rows, cols); +#if defined(sun) && !defined(SVR4) +#ifdef TIOCSSIZE + /* Set tty's idea of window size */ + ts.ts_lines = rows; + ts.ts_cols = cols; + ioctl (screen->respond, TIOCSSIZE, &ts); +#ifdef SIGWINCH + if(screen->pid > 1) { + int pgrp; + + if (ioctl (screen->respond, TIOCGPGRP, &pgrp) != -1) + kill_process_group(pgrp, SIGWINCH); + } +#endif /* SIGWINCH */ +#endif /* TIOCSSIZE */ +#else /* sun */ +#ifdef TIOCSWINSZ + /* Set tty's idea of window size */ + ws.ws_row = rows; + ws.ws_col = cols; + ws.ws_xpixel = width; + ws.ws_ypixel = height; + ioctl (screen->respond, TIOCSWINSZ, (char *)&ws); +#ifdef notdef /* change to SIGWINCH if this doesn't work for you */ + if(screen->pid > 1) { + int pgrp; + + if (ioctl (screen->respond, TIOCGPGRP, &pgrp) != -1) + kill_process_group(pgrp, SIGWINCH); + } +#endif /* SIGWINCH */ +#endif /* TIOCSWINSZ */ +#endif /* sun */ + return (0); +} + +/* + * Sets the attributes from the row, col, to row, col + length according to + * mask and value. The bits in the attribute byte specified by the mask are + * set to the corresponding bits in the value byte. If length would carry us + * over the end of the line, it stops at the end of the line. + */ +void +ScrnSetAttributes(screen, row, col, mask, value, length) +TScreen *screen; +int row, col; +unsigned mask, value; +register int length; /* length of string */ +{ + register Char *attrs; + register int avail = screen->max_col - col + 1; + + if (length > avail) + length = avail; + if (length <= 0) + return; + attrs = screen->buf[4 * row + 1] + col; + value &= mask; /* make sure we only change the bits allowed by mask*/ + while(length-- > 0) { + *attrs &= ~mask; /* clear the bits */ + *attrs |= value; /* copy in the new values */ + attrs++; + } +} + +/* + * Gets the attributes from the row, col, to row, col + length into the + * supplied array, which is assumed to be big enough. If length would carry us + * over the end of the line, it stops at the end of the line. Returns + * the number of bytes of attributes (<= length) + */ +int +ScrnGetAttributes(screen, row, col, str, length) +TScreen *screen; +int row, col; +Char *str; +register int length; /* length of string */ +{ + register Char *attrs; + register int avail = screen->max_col - col + 1; + int ret; + + if (length > avail) + length = avail; + if (length <= 0) + return 0; + ret = length; + attrs = screen->buf[4 * row + 1] + col; + while(length-- > 0) { + *str++ = *attrs++; + } + return ret; +} +Bool +non_blank_line(sb, row, col, len) +ScrnBuf sb; +register int row, col, len; +{ + register int i; + register Char *ptr = sb [4 * row]; + + for (i = col; i < len; i++) { + if (ptr[i]) + return True; + } + return False; +} diff --git a/vendor/x11iraf/xgterm/scrollbar.c b/vendor/x11iraf/xgterm/scrollbar.c new file mode 100644 index 00000000..ca077b43 --- /dev/null +++ b/vendor/x11iraf/xgterm/scrollbar.c @@ -0,0 +1,531 @@ +/* + * $XConsortium: scrollbar.c,v 1.44 94/04/02 12:42:01 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "ptyx.h" /* gets Xt headers, too */ + +#include <stdio.h> +#include <ctype.h> +#include <X11/Xatom.h> + +#include <X11/StringDefs.h> +#include <X11/Shell.h> + +#include <X11/Xaw/Scrollbar.h> + +#include "data.h" +#include "error.h" +#include "menu.h" + +/* Event handlers */ + +static void ScrollTextTo(); +static void ScrollTextUpDownBy(); + + +/* resize the text window for a terminal screen, modifying the + * appropriate WM_SIZE_HINTS and taking advantage of bit gravity. + */ + +static void ResizeScreen(xw, min_width, min_height ) + register XgtermWidget xw; + int min_width, min_height; +{ + register TScreen *screen = &xw->screen; +#ifndef nothack + XSizeHints sizehints; + long supp; +#endif + XtGeometryResult geomreqresult; + Dimension reqWidth, reqHeight, repWidth, repHeight; + + /* + * I'm going to try to explain, as I understand it, why we + * have to do XGetWMNormalHints and XSetWMNormalHints here, + * although I can't guarantee that I've got it right. + * + * In a correctly written toolkit program, the Shell widget + * parses the user supplied geometry argument. However, + * because of the way xgterm does things, the VT100 widget does + * the parsing of the geometry option, not the Shell widget. + * The result of this is that the Shell widget doesn't set the + * correct window manager hints, and doesn't know that the + * user has specified a geometry. + * + * The XtVaSetValues call below tells the Shell widget to + * change its hints. However, since it's confused about the + * hints to begin with, it doesn't get them all right when it + * does the SetValues -- it undoes some of what the VT100 + * widget did when it originally set the hints. + * + * To fix this, we do the following: + * + * 1. Get the sizehints directly from the window, going around + * the (confused) shell widget. + * 2. Call XtVaSetValues to let the shell widget know which + * hints have changed. Note that this may not even be + * necessary, since we're going to right ahead after that + * and set the hints ourselves, but it's good to put it + * here anyway, so that when we finally do fix the code so + * that the Shell does the right thing with hints, we + * already have the XtVaSetValues in place. + * 3. We set the sizehints directly, this fixing up whatever + * damage was done by the Shell widget during the + * XtVaSetValues. + * + * Gross, huh? + * + * The correct fix is to redo VTRealize, VTInitialize and + * VTSetValues so that font processing happens early enough to + * give back responsibility for the size hints to the Shell. + * + * Someday, we hope to have time to do this. Someday, we hope + * to have time to completely rewrite xgterm. + */ + +#ifndef nothack + /* + * NOTE: If you change the way any of the hints are calculated + * below, make sure you change the calculation both in the + * sizehints assignments and in the XtVaSetValues. + */ + + if (! XGetWMNormalHints(screen->display, XtWindow(XtParent(xw)), + &sizehints, &supp)) + sizehints.flags = 0; + sizehints.base_width = min_width; + sizehints.base_height = min_height; + sizehints.width_inc = FontWidth(screen); + sizehints.height_inc = FontHeight(screen); + sizehints.min_width = sizehints.base_width + sizehints.width_inc; + sizehints.min_height = sizehints.base_height + sizehints.height_inc; + sizehints.flags |= (PBaseSize|PMinSize|PResizeInc); + /* These are obsolete, but old clients may use them */ + sizehints.width = (screen->max_col + 1) * FontWidth(screen) + + min_width; + sizehints.height = (screen->max_row + 1) * FontHeight(screen) + + min_height; +#endif + + /* + * Note: width and height are not set here because they are + * obsolete. + */ + XtVaSetValues(XtParent(xw), + XtNbaseWidth, min_width, + XtNbaseHeight, min_height, + XtNwidthInc, FontWidth(screen), + XtNheightInc, FontHeight(screen), + XtNminWidth, min_width + FontWidth(screen), + XtNminHeight, min_height + FontHeight(screen), + NULL); + + reqWidth = (screen->max_col + 1) * FontWidth(screen) + min_width; + reqHeight = FontHeight(screen) * (screen->max_row + 1) + min_height; + geomreqresult = XtMakeResizeRequest ((Widget)xw, reqWidth, reqHeight, + &repWidth, &repHeight); + + if (geomreqresult == XtGeometryAlmost) { + geomreqresult = XtMakeResizeRequest ((Widget)xw, repWidth, + repHeight, NULL, NULL); + } + +#ifndef nothack + XSetWMNormalHints(screen->display, XtWindow(XtParent(xw)), &sizehints); +#endif +} + +void DoResizeScreen (xw) + register XgtermWidget xw; +{ + int border = 2 * xw->screen.border; + ResizeScreen (xw, border + xw->screen.scrollbar, border); +} + + +static Widget CreateScrollBar(xw, x, y, height) + XgtermWidget xw; + int x, y, height; +{ + Widget scrollWidget; + + static Arg argList[] = { + {XtNx, (XtArgVal) 0}, + {XtNy, (XtArgVal) 0}, + {XtNheight, (XtArgVal) 0}, + {XtNreverseVideo, (XtArgVal) 0}, + {XtNorientation, (XtArgVal) XtorientVertical}, + {XtNborderWidth, (XtArgVal) 1}, + }; + + argList[0].value = (XtArgVal) x; + argList[1].value = (XtArgVal) y; + argList[2].value = (XtArgVal) height; + argList[3].value = (XtArgVal) xw->misc.re_verse; + + scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass, + (Widget)xw, argList, XtNumber(argList)); + XtAddCallback (scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0); + XtAddCallback (scrollWidget, XtNjumpProc, ScrollTextTo, 0); + return (scrollWidget); +} + +static void RealizeScrollBar (sbw, screen) + Widget sbw; + TScreen *screen; +{ + XtRealizeWidget (sbw); +} + + +ScrollBarReverseVideo(scrollWidget) + register Widget scrollWidget; +{ + Arg args[4]; + int nargs = XtNumber(args); + unsigned long bg, fg, bdr; + Pixmap bdpix; + + XtSetArg(args[0], XtNbackground, &bg); + XtSetArg(args[1], XtNforeground, &fg); + XtSetArg(args[2], XtNborderColor, &bdr); + XtSetArg(args[3], XtNborderPixmap, &bdpix); + XtGetValues (scrollWidget, args, nargs); + args[0].value = (XtArgVal) fg; + args[1].value = (XtArgVal) bg; + nargs--; /* don't set border_pixmap */ + if (bdpix == XtUnspecifiedPixmap) { /* if not pixmap then pixel */ + args[2].value = args[1].value; /* set border to new fg */ + } else { /* ignore since pixmap */ + nargs--; /* don't set border pixel */ + } + XtSetValues (scrollWidget, args, nargs); +} + + + +ScrollBarDrawThumb(scrollWidget) + register Widget scrollWidget; +{ + register TScreen *screen = &term->screen; + register int thumbTop, thumbHeight, totalHeight; + + thumbTop = screen->topline + screen->savedlines; + thumbHeight = screen->max_row + 1; + totalHeight = thumbHeight + screen->savedlines; + + XawScrollbarSetThumb(scrollWidget, + ((float)thumbTop) / totalHeight, + ((float)thumbHeight) / totalHeight); + +} + +ResizeScrollBar(scrollWidget, x, y, height) + register Widget scrollWidget; + int x, y; + unsigned height; +{ + XtConfigureWidget(scrollWidget, x, y, scrollWidget->core.width, + height, scrollWidget->core.border_width); + if (term->misc.sb_right) + XtMoveWidget(scrollWidget, x,y); + ScrollBarDrawThumb(scrollWidget); +} + +WindowScroll(screen, top) + register TScreen *screen; + int top; +{ + register int i, lines; + register int scrolltop, scrollheight, refreshtop; + register int x = 0; + + if (top < -screen->savedlines) + top = -screen->savedlines; + else if (top > 0) + top = 0; + if((i = screen->topline - top) == 0) { + ScrollBarDrawThumb(screen->scrollWidget); + return; + } + + if(screen->cursor_state) + HideCursor(); + lines = i > 0 ? i : -i; + if(lines > screen->max_row + 1) + lines = screen->max_row + 1; + scrollheight = screen->max_row - lines + 1; + if(i > 0) + refreshtop = scrolltop = 0; + else { + scrolltop = lines; + refreshtop = scrollheight; + } + x = (term->misc.sb_right? screen->border : screen->scrollbar+screen->border); + scrolling_copy_area(screen, scrolltop, scrollheight, -i); + screen->topline = top; + + ScrollSelection(screen, i); + + XClearArea( + screen->display, + TextWindow(screen), + (int) x, + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) lines * FontHeight(screen), + FALSE); + ScrnRefresh(screen, refreshtop, 0, lines, screen->max_col + 1, False); + + ScrollBarDrawThumb(screen->scrollWidget); +} + + +ScrollBarOn (xw, init, doalloc) + XgtermWidget xw; + int init, doalloc; +{ + register TScreen *screen = &xw->screen; + register int border = 2 * screen->border; + register int i; + + if(screen->scrollbar) + return; + + if (init) { /* then create it only */ + if (screen->scrollWidget) return; + + /* make it a dummy size and resize later */ + if ((screen->scrollWidget = CreateScrollBar (xw, -1, - 1, 5)) + == NULL) { + Bell(); + return; + } + + return; + + } + + if (!screen->scrollWidget) { + Bell (); + Bell (); + return; + } + + if (doalloc && screen->allbuf) { + if((screen->allbuf = + (ScrnBuf) realloc((char *) screen->buf, + (unsigned) 4*(screen->max_row + 2 + + screen->savelines) * + sizeof(char *))) + == NULL) + Error (ERROR_SBRALLOC); + screen->buf = &screen->allbuf[4 * screen->savelines]; + memmove( (char *)screen->buf, (char *)screen->allbuf, + 4 * (screen->max_row + 2) * sizeof (char *)); + for(i = 4 * screen->savelines - 1 ; i >= 0 ; i--) + if((screen->allbuf[i] = + (Char *)calloc((unsigned) screen->max_col+1, sizeof(char))) == + NULL) + Error (ERROR_SBRALLOC2); + } + + if (term->misc.sb_right) { + ResizeScrollBar (screen->scrollWidget, + screen->fullVwin.fullwidth - + screen->scrollWidget->core.width - + screen->scrollWidget->core.border_width, + 0, + Height (screen) + border -1); + } else { + ResizeScrollBar (screen->scrollWidget, -1, -1, + Height (screen) + border); + } + RealizeScrollBar (screen->scrollWidget, screen); + screen->scrollbar = screen->scrollWidget->core.width + + screen->scrollWidget->core.border_width; + + ScrollBarDrawThumb(screen->scrollWidget); + DoResizeScreen (xw); + XtMapWidget(screen->scrollWidget); + update_scrollbar (); + if (screen->buf) { + XClearWindow (screen->display, XtWindow (term)); + Redraw (); + } +} + +ScrollBarOff(screen) + register TScreen *screen; +{ + if(!screen->scrollbar) + return; + XtUnmapWidget(screen->scrollWidget); + screen->scrollbar = 0; + DoResizeScreen (term); + update_scrollbar (); + if (screen->buf) { + XClearWindow (screen->display, XtWindow (term)); + Redraw (); + } +} + +/*ARGSUSED*/ +static void ScrollTextTo(scrollbarWidget, client_data, call_data) + Widget scrollbarWidget; + XtPointer client_data; + XtPointer call_data; +{ + float *topPercent = (float *) call_data; + register TScreen *screen = &term->screen; + int thumbTop; /* relative to first saved line */ + int newTopLine; + +/* + screen->savedlines : Number of offscreen text lines, + screen->maxrow + 1 : Number of onscreen text lines, + screen->topline : -Number of lines above the last screen->max_row+1 lines +*/ + + thumbTop = *topPercent * (screen->savedlines + screen->max_row+1); + newTopLine = thumbTop - screen->savedlines; + WindowScroll(screen, newTopLine); +} + +/*ARGSUSED*/ +static void ScrollTextUpDownBy(scrollbarWidget, client_data, call_data) + Widget scrollbarWidget; + XtPointer client_data; + XtPointer call_data; +{ + int pixels = (int) call_data; + + register TScreen *screen = &term->screen; + register int rowOnScreen, newTopLine; + + rowOnScreen = pixels / FontHeight(screen); + if (rowOnScreen == 0) { + if (pixels < 0) + rowOnScreen = -1; + else if (pixels > 0) + rowOnScreen = 1; + } + newTopLine = screen->topline + rowOnScreen; + WindowScroll(screen, newTopLine); +} + + +/* + * assume that b is lower case and allow plural + */ +static int specialcmplowerwiths (a, b) + char *a, *b; +{ + register char ca, cb; + + if (!a || !b) return 0; + + while (1) { + ca = *a; + cb = *b; + if (isascii(ca) && isupper(ca)) { /* lowercasify */ +#ifdef _tolower + ca = _tolower (ca); +#else + ca = tolower (ca); +#endif + } + if (ca != cb || ca == '\0') break; /* if not eq else both nul */ + a++, b++; + } + if (cb == '\0' && (ca == '\0' || (ca == 's' && a[1] == '\0'))) + return 1; + + return 0; +} + +static int params_to_pixels (screen, params, n) + TScreen *screen; + String *params; + int n; +{ + register mult = 1; + register char *s; + + switch (n > 2 ? 2 : n) { + case 2: + s = params[1]; + if (specialcmplowerwiths (s, "page")) { + mult = (screen->max_row + 1) * FontHeight(screen); + } else if (specialcmplowerwiths (s, "halfpage")) { + mult = ((screen->max_row + 1) * FontHeight(screen)) >> 1; + } else if (specialcmplowerwiths (s, "pixel")) { + mult = 1; + } /* else assume that it is Line */ + mult *= atoi (params[0]); + break; + case 1: + mult = atoi (params[0]) * FontHeight(screen); /* lines */ + break; + default: + mult = screen->scrolllines * FontHeight(screen); + break; + } + + return mult; +} + + +/*ARGSUSED*/ +void HandleScrollForward (gw, event, params, nparams) + Widget gw; + XEvent *event; + String *params; + Cardinal *nparams; +{ + XgtermWidget w = (XgtermWidget) gw; + register TScreen *screen = &w->screen; + + ScrollTextUpDownBy (gw, (XtPointer) NULL, + (XtPointer)params_to_pixels (screen, params, (int) *nparams)); + return; +} + + +/*ARGSUSED*/ +void HandleScrollBack (gw, event, params, nparams) + Widget gw; + XEvent *event; + String *params; + Cardinal *nparams; +{ + XgtermWidget w = (XgtermWidget) gw; + register TScreen *screen = &w->screen; + + ScrollTextUpDownBy (gw, (XtPointer) NULL, + (XtPointer)-params_to_pixels (screen, params, (int) *nparams)); + return; +} diff --git a/vendor/x11iraf/xgterm/tabs.c b/vendor/x11iraf/xgterm/tabs.c new file mode 100644 index 00000000..c4152355 --- /dev/null +++ b/vendor/x11iraf/xgterm/tabs.c @@ -0,0 +1,106 @@ +/* + * $XConsortium: tabs.c,v 1.4 91/05/06 17:12:18 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* tabs.c */ + +#include "ptyx.h" + +/* + * This file presumes 32bits/word. This is somewhat of a crock, and should + * be fixed sometime. + */ + +/* + * places tabstops at only every 8 columns + */ +TabReset(tabs) +Tabs tabs; +{ + register int i; + + for (i=0; i<TAB_ARRAY_SIZE; ++i) + tabs[i] = 0; + + for (i=0; i<MAX_TABS; i+=8) + TabSet(tabs, i); +} + + +/* + * places a tabstop at col + */ +TabSet(tabs, col) + Tabs tabs; + int col; +{ + tabs[col >> 5] |= (1 << (col & 31)); +} + +/* + * clears a tabstop at col + */ +TabClear(tabs, col) + Tabs tabs; + int col; +{ + tabs[col >> 5] &= ~(1 << (col & 31)); +} + +/* + * returns the column of the next tabstop + * (or MAX_TABS - 1 if there are no more). + * A tabstop at col is ignored. + */ +TabNext (tabs, col) + Tabs tabs; + int col; +{ + extern XgtermWidget term; + register TScreen *screen = &term->screen; + + if(screen->curses && screen->do_wrap && (term->flags & WRAPAROUND)) { + Index(screen, 1); + col = screen->cur_col = screen->do_wrap = 0; + } + for (++col; col<MAX_TABS; ++col) + if (tabs[col >> 5] & (1 << (col & 31))) + return (col); + + return (MAX_TABS - 1); +} + +/* + * clears all tabs + */ +TabZonk (tabs) +Tabs tabs; +{ + register int i; + + for (i=0; i<TAB_ARRAY_SIZE; ++i) + tabs[i] = 0; +} diff --git a/vendor/x11iraf/xgterm/termcap b/vendor/x11iraf/xgterm/termcap new file mode 100644 index 00000000..f69c315e --- /dev/null +++ b/vendor/x11iraf/xgterm/termcap @@ -0,0 +1,27 @@ +# $XConsortium: termcap,v 1.6 91/06/24 15:08:52 gildea Exp $ +# +vs|xterm|vs100|xterm terminal emulator (X Window System):\ + :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:UP=\E[%dA:\ + :al=\E[L:am:\ + :bs:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:co#80:\ + :cs=\E[%i%d;%dr:ct=\E[3k:\ + :dc=\E[P:dl=\E[M:\ + :im=\E[4h:ei=\E[4l:mi:\ + :ho=\E[H:\ + :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\ + :rs=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:\ + :kl=\EOD:km:kn#4:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:\ + :li#65:md=\E[1m:me=\E[m:mr=\E[7m:ms:nd=\E[C:pt:\ + :sc=\E7:rc=\E8:sf=\n:so=\E[7m:se=\E[m:sr=\EM:\ + :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:\ + :up=\E[A:us=\E[4m:ue=\E[m:xn: +v2|xterms|vs100s|xterm terminal emulator, small window (X Window System):\ + :co#80:li#24:tc=xterm: +vb|xterm-bold|xterm with bold instead of underline:\ + :us=\E[1m:tc=xterm: +# +# vi may work better with this termcap, because vi +# doesn't use insert mode much +vi|xterm-ic|xterm-vi|xterm with insert character instead of insert mode:\ + :im=:ei=:mi@:ic=\E[@:tc=xterm: diff --git a/vendor/x11iraf/xgterm/terminfo b/vendor/x11iraf/xgterm/terminfo new file mode 100644 index 00000000..98749285 --- /dev/null +++ b/vendor/x11iraf/xgterm/terminfo @@ -0,0 +1,17 @@ +xterm|vs100|xterm terminal emulator, + ind=^J, cols#80, lines#65, + clear=\E[H\E[2J, cub1=^H, am, cup=\E[%i%p1%d;%p2%dH, + cuf1=\E[C, cuu1=\E[A, el=\E[K, ed=\E[J, + cud=\E[%p1%dB, cuu=\E[%p1%dA, cub=\E[%p1%dD, + cuf=\E[%p1%dC, km, + smso=\E[7m, rmso=\E[m, smul@, rmul@, + bold=\E[1m, rev=\E[7m, blink=@, sgr0=\E[m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=@ + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, ht=^I, ri=\EM, + vt@, xon@, csr=\E[%i%p1%d;%p2%dr, + il=\E[%p1%dL, dl=\E[%p1%dM, il1=\E[L, dl1=\E[M, + ich=\E[%p1%d@, dch=\E[%p1%dP, ich1=\E[@, dch1=\E[P, + use=vt100-am, +xterms|vs100s|xterm terminal emulator (small screen 24x80), + cols#80, lines#24, + use=xterm, diff --git a/vendor/x11iraf/xgterm/util.c b/vendor/x11iraf/xgterm/util.c new file mode 100644 index 00000000..f23ce8f8 --- /dev/null +++ b/vendor/x11iraf/xgterm/util.c @@ -0,0 +1,1111 @@ +/* + * $XConsortium: util.c,v 1.31 91/06/20 18:34:47 gildea Exp $ + */ + +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* util.c */ + +#include "ptyx.h" +#include "data.h" +#include "error.h" +#include "menu.h" + +#include <stdio.h> + +static void horizontal_copy_area(); +static void vertical_copy_area(); + +/* + * These routines are used for the jump scroll feature + */ +FlushScroll(screen) +register TScreen *screen; +{ + register int i; + register int shift = -screen->topline; + register int bot = screen->max_row - shift; + register int refreshtop; + register int refreshheight; + register int scrolltop; + register int scrollheight; + + if(screen->cursor_state) + HideCursor(); + if(screen->scroll_amt > 0) { + refreshheight = screen->refresh_amt; + scrollheight = screen->bot_marg - screen->top_marg - + refreshheight + 1; + if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > + (i = screen->max_row - screen->scroll_amt + 1)) + refreshtop = i; + if(screen->scrollWidget && !screen->alternate + && screen->top_marg == 0) { + scrolltop = 0; + if((scrollheight += shift) > i) + scrollheight = i; + if((i = screen->bot_marg - bot) > 0 && + (refreshheight -= i) < screen->scroll_amt) + refreshheight = screen->scroll_amt; + if((i = screen->savedlines) < screen->savelines) { + if((i += screen->scroll_amt) > + screen->savelines) + i = screen->savelines; + screen->savedlines = i; + ScrollBarDrawThumb(screen->scrollWidget); + } + } else { + scrolltop = screen->top_marg + shift; + if((i = bot - (screen->bot_marg - screen->refresh_amt + + screen->scroll_amt)) > 0) { + if(bot < screen->bot_marg) + refreshheight = screen->scroll_amt + i; + } else { + scrollheight += i; + refreshheight = screen->scroll_amt; + if((i = screen->top_marg + screen->scroll_amt - + 1 - bot) > 0) { + refreshtop += i; + refreshheight -= i; + } + } + } + } else { + refreshheight = -screen->refresh_amt; + scrollheight = screen->bot_marg - screen->top_marg - + refreshheight + 1; + refreshtop = screen->top_marg + shift; + scrolltop = refreshtop + refreshheight; + if((i = screen->bot_marg - bot) > 0) + scrollheight -= i; + if((i = screen->top_marg + refreshheight - 1 - bot) > 0) + refreshheight -= i; + } + scrolling_copy_area(screen, scrolltop+screen->scroll_amt, + scrollheight, screen->scroll_amt); + ScrollSelection(screen, -(screen->scroll_amt)); + screen->scroll_amt = 0; + screen->refresh_amt = 0; + if(refreshheight > 0) { + XClearArea ( + screen->display, + TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) refreshheight * FontHeight(screen), + FALSE); + ScrnRefresh(screen, refreshtop, 0, refreshheight, + screen->max_col + 1, False); + } +} + +AddToRefresh(screen) +register TScreen *screen; +{ + register int amount = screen->refresh_amt; + register int row = screen->cur_row; + + if(amount == 0) + return(0); + if(amount > 0) { + register int bottom; + + if(row == (bottom = screen->bot_marg) - amount) { + screen->refresh_amt++; + return(1); + } + return(row >= bottom - amount + 1 && row <= bottom); + } else { + register int top; + + amount = -amount; + if(row == (top = screen->top_marg) + amount) { + screen->refresh_amt--; + return(1); + } + return(row <= top + amount - 1 && row >= top); + } +} + +/* + * scrolls the screen by amount lines, erases bottom, doesn't alter + * cursor position (i.e. cursor moves down amount relative to text). + * All done within the scrolling region, of course. + * requires: amount > 0 + */ +Scroll(screen, amount) +register TScreen *screen; +register int amount; +{ + register int i = screen->bot_marg - screen->top_marg + 1; + register int shift; + register int bot; + register int refreshtop = 0; + register int refreshheight; + register int scrolltop; + register int scrollheight; + + if(screen->cursor_state) + HideCursor(); + if (amount > i) + amount = i; + if(screen->jumpscroll) { + if(screen->scroll_amt > 0) { + if(screen->refresh_amt + amount > i) + FlushScroll(screen); + screen->scroll_amt += amount; + screen->refresh_amt += amount; + } else { + if(screen->scroll_amt < 0) + FlushScroll(screen); + screen->scroll_amt = amount; + screen->refresh_amt = amount; + } + refreshheight = 0; + } else { + ScrollSelection(screen, -(amount)); + if (amount == i) { + ClearScreen(screen); + return; + } + shift = -screen->topline; + bot = screen->max_row - shift; + scrollheight = i - amount; + refreshheight = amount; + if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > + (i = screen->max_row - refreshheight + 1)) + refreshtop = i; + if(screen->scrollWidget && !screen->alternate + && screen->top_marg == 0) { + scrolltop = 0; + if((scrollheight += shift) > i) + scrollheight = i; + if((i = screen->savedlines) < screen->savelines) { + if((i += amount) > screen->savelines) + i = screen->savelines; + screen->savedlines = i; + ScrollBarDrawThumb(screen->scrollWidget); + } + } else { + scrolltop = screen->top_marg + shift; + if((i = screen->bot_marg - bot) > 0) { + scrollheight -= i; + if((i = screen->top_marg + amount - 1 - bot) >= 0) { + refreshtop += i; + refreshheight -= i; + } + } + } + + if (screen->multiscroll && amount == 1 && + screen->topline == 0 && screen->top_marg == 0 && + screen->bot_marg == screen->max_row) { + if (screen->incopy < 0 && screen->scrolls == 0) + CopyWait(screen); + screen->scrolls++; + } + scrolling_copy_area(screen, scrolltop+amount, scrollheight, amount); + if(refreshheight > 0) { + XClearArea ( + screen->display, + TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) refreshheight * FontHeight(screen), + FALSE); + if(refreshheight > shift) + refreshheight = shift; + } + } + if(screen->scrollWidget && !screen->alternate && screen->top_marg == 0) + ScrnDeleteLine(screen->allbuf, screen->bot_marg + + screen->savelines, 0, amount, screen->max_col + 1); + else + ScrnDeleteLine(screen->buf, screen->bot_marg, screen->top_marg, + amount, screen->max_col + 1); + if(refreshheight > 0) + ScrnRefresh(screen, refreshtop, 0, refreshheight, + screen->max_col + 1, False); +} + + +/* + * Reverse scrolls the screen by amount lines, erases top, doesn't alter + * cursor position (i.e. cursor moves up amount relative to text). + * All done within the scrolling region, of course. + * Requires: amount > 0 + */ +RevScroll(screen, amount) +register TScreen *screen; +register int amount; +{ + register int i = screen->bot_marg - screen->top_marg + 1; + register int shift; + register int bot; + register int refreshtop; + register int refreshheight; + register int scrolltop; + register int scrollheight; + + if(screen->cursor_state) + HideCursor(); + if (amount > i) + amount = i; + if(screen->jumpscroll) { + if(screen->scroll_amt < 0) { + if(-screen->refresh_amt + amount > i) + FlushScroll(screen); + screen->scroll_amt -= amount; + screen->refresh_amt -= amount; + } else { + if(screen->scroll_amt > 0) + FlushScroll(screen); + screen->scroll_amt = -amount; + screen->refresh_amt = -amount; + } + } else { + shift = -screen->topline; + bot = screen->max_row - shift; + refreshheight = amount; + scrollheight = screen->bot_marg - screen->top_marg - + refreshheight + 1; + refreshtop = screen->top_marg + shift; + scrolltop = refreshtop + refreshheight; + if((i = screen->bot_marg - bot) > 0) + scrollheight -= i; + if((i = screen->top_marg + refreshheight - 1 - bot) > 0) + refreshheight -= i; + + if (screen->multiscroll && amount == 1 && + screen->topline == 0 && screen->top_marg == 0 && + screen->bot_marg == screen->max_row) { + if (screen->incopy < 0 && screen->scrolls == 0) + CopyWait(screen); + screen->scrolls++; + } + scrolling_copy_area(screen, scrolltop-amount, scrollheight, -amount); + if(refreshheight > 0) + XClearArea ( + screen->display, + TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) refreshheight * FontHeight(screen), + FALSE); + } + ScrnInsertLine (screen->buf, screen->bot_marg, screen->top_marg, + amount, screen->max_col + 1); +} + +/* + * If cursor not in scrolling region, returns. Else, + * inserts n blank lines at the cursor's position. Lines above the + * bottom margin are lost. + */ +InsertLine (screen, n) +register TScreen *screen; +register int n; +{ + register int i; + register int shift; + register int bot; + register int refreshtop; + register int refreshheight; + register int scrolltop; + register int scrollheight; + + if (screen->cur_row < screen->top_marg || + screen->cur_row > screen->bot_marg) + return; + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (i = screen->bot_marg - screen->cur_row + 1)) + n = i; + if(screen->jumpscroll) { + if(screen->scroll_amt <= 0 && + screen->cur_row <= -screen->refresh_amt) { + if(-screen->refresh_amt + n > screen->max_row + 1) + FlushScroll(screen); + screen->scroll_amt -= n; + screen->refresh_amt -= n; + } else if(screen->scroll_amt) + FlushScroll(screen); + } + if(!screen->scroll_amt) { + shift = -screen->topline; + bot = screen->max_row - shift; + refreshheight = n; + scrollheight = screen->bot_marg - screen->cur_row - refreshheight + 1; + refreshtop = screen->cur_row + shift; + scrolltop = refreshtop + refreshheight; + if((i = screen->bot_marg - bot) > 0) + scrollheight -= i; + if((i = screen->cur_row + refreshheight - 1 - bot) > 0) + refreshheight -= i; + vertical_copy_area(screen, scrolltop-n, scrollheight, -n); + if(refreshheight > 0) + XClearArea ( + screen->display, + TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) refreshheight * FontHeight(screen), + FALSE); + } + /* adjust screen->buf */ + ScrnInsertLine(screen->buf, screen->bot_marg, screen->cur_row, n, + screen->max_col + 1); +} + +/* + * If cursor not in scrolling region, returns. Else, deletes n lines + * at the cursor's position, lines added at bottom margin are blank. + */ +DeleteLine(screen, n) +register TScreen *screen; +register int n; +{ + register int i; + register int shift; + register int bot; + register int refreshtop; + register int refreshheight; + register int scrolltop; + register int scrollheight; + + if (screen->cur_row < screen->top_marg || + screen->cur_row > screen->bot_marg) + return; + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (i = screen->bot_marg - screen->cur_row + 1)) + n = i; + if(screen->jumpscroll) { + if(screen->scroll_amt >= 0 && screen->cur_row == screen->top_marg) { + if(screen->refresh_amt + n > screen->max_row + 1) + FlushScroll(screen); + screen->scroll_amt += n; + screen->refresh_amt += n; + } else if(screen->scroll_amt) + FlushScroll(screen); + } + if(!screen->scroll_amt) { + + shift = -screen->topline; + bot = screen->max_row - shift; + scrollheight = i - n; + refreshheight = n; + if((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > + (i = screen->max_row - refreshheight + 1)) + refreshtop = i; + if(screen->scrollWidget && !screen->alternate && screen->cur_row == 0) { + scrolltop = 0; + if((scrollheight += shift) > i) + scrollheight = i; + if((i = screen->savedlines) < screen->savelines) { + if((i += n) > screen->savelines) + i = screen->savelines; + screen->savedlines = i; + ScrollBarDrawThumb(screen->scrollWidget); + } + } else { + scrolltop = screen->cur_row + shift; + if((i = screen->bot_marg - bot) > 0) { + scrollheight -= i; + if((i = screen->cur_row + n - 1 - bot) >= 0) { + refreshheight -= i; + } + } + } + vertical_copy_area(screen, scrolltop+n, scrollheight, n); + if(refreshheight > 0) + XClearArea ( + screen->display, + TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + (int) refreshtop * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) refreshheight * FontHeight(screen), + FALSE); + } + /* adjust screen->buf */ + if(screen->scrollWidget && !screen->alternate && screen->cur_row == 0) + ScrnDeleteLine(screen->allbuf, screen->bot_marg + + screen->savelines, 0, n, screen->max_col + 1); + else + ScrnDeleteLine(screen->buf, screen->bot_marg, screen->cur_row, + n, screen->max_col + 1); +} + +/* + * Insert n blanks at the cursor's position, no wraparound + */ +InsertChar (screen, n) + register TScreen *screen; + register int n; +{ + register int cx, cy; + + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if(screen->cur_row - screen->topline <= screen->max_row) { + if(!AddToRefresh(screen)) { + if(screen->scroll_amt) + FlushScroll(screen); + + /* + * prevent InsertChar from shifting the end of a line over + * if it is being appended to + */ + if (non_blank_line (screen->buf, screen->cur_row, + screen->cur_col, screen->max_col + 1)) + horizontal_copy_area(screen, screen->cur_col, + screen->max_col+1 - (screen->cur_col+n), + n); + + cx = CursorX (screen, screen->cur_col); + cy = CursorY (screen, screen->cur_row); + + XFillRectangle( + screen->display, + TextWindow(screen), + screen->reverseGC, + cx, cy, + (unsigned) n * FontWidth(screen), (unsigned) FontHeight(screen)); + } + } + /* adjust screen->buf */ + ScrnInsertChar(screen->buf, screen->cur_row, screen->cur_col, n, + screen->max_col + 1); +} + +/* + * Deletes n chars at the cursor's position, no wraparound. + */ +DeleteChar (screen, n) + register TScreen *screen; + register int n; +{ + register int width; + + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if (n > (width = screen->max_col + 1 - screen->cur_col)) + n = width; + + if(screen->cur_row - screen->topline <= screen->max_row) { + if(!AddToRefresh(screen)) { + if(screen->scroll_amt) + FlushScroll(screen); + + horizontal_copy_area(screen, screen->cur_col+n, + screen->max_col+1 - (screen->cur_col+n), + -n); + + XFillRectangle + (screen->display, TextWindow(screen), + screen->reverseGC, + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar) + + Width(screen) - n*FontWidth(screen), + CursorY (screen, screen->cur_row), n * FontWidth(screen), + FontHeight(screen)); + } + } + /* adjust screen->buf */ + ScrnDeleteChar (screen->buf, screen->cur_row, screen->cur_col, n, + screen->max_col + 1); + +} + +/* + * Clear from cursor position to beginning of display, inclusive. + */ +ClearAbove (screen) +register TScreen *screen; +{ + register top, height; + + if(screen->cursor_state) + HideCursor(); + if((top = -screen->topline) <= screen->max_row) { + if(screen->scroll_amt) + FlushScroll(screen); + if((height = screen->cur_row + top) > screen->max_row) + height = screen->max_row; + if((height -= top) > 0) + XClearArea(screen->display, TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + top * FontHeight(screen) + screen->border, + Width(screen), height * FontHeight(screen), FALSE); + + if(screen->cur_row - screen->topline <= screen->max_row) + ClearLeft(screen); + } + ClearBufRows(screen, 0, screen->cur_row - 1); +} + +/* + * Clear from cursor position to end of display, inclusive. + */ +ClearBelow (screen) +register TScreen *screen; +{ + register top; + + ClearRight(screen); + if((top = screen->cur_row - screen->topline) <= screen->max_row) { + if(screen->scroll_amt) + FlushScroll(screen); + if(++top <= screen->max_row) + XClearArea(screen->display, TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + top * FontHeight(screen) + screen->border, + Width(screen), (screen->max_row - top + 1) * + FontHeight(screen), FALSE); + } + ClearBufRows(screen, screen->cur_row + 1, screen->max_row); +} + +/* + * Clear last part of cursor's line, inclusive. + */ +ClearRight (screen) +register TScreen *screen; +{ + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if(screen->cur_row - screen->topline <= screen->max_row) { + if(!AddToRefresh(screen)) { + if(screen->scroll_amt) + FlushScroll(screen); + XFillRectangle(screen->display, TextWindow(screen), + screen->reverseGC, + CursorX(screen, screen->cur_col), + CursorY(screen, screen->cur_row), + Width(screen) - screen->cur_col * FontWidth(screen), + FontHeight(screen)); + } + } + memset(screen->buf [4 * screen->cur_row] + screen->cur_col, 0, + (screen->max_col - screen->cur_col + 1)); + memset(screen->buf [4 * screen->cur_row + 1] + screen->cur_col, 0, + (screen->max_col - screen->cur_col + 1)); + memset(screen->buf [4 * screen->cur_row + 2] + screen->cur_col, 0, + (screen->max_col - screen->cur_col + 1)); + memset(screen->buf [4 * screen->cur_row + 3] + screen->cur_col, 0, + (screen->max_col - screen->cur_col + 1)); + /* with the right part cleared, we can't be wrapping */ + screen->buf [4 * screen->cur_row + 1] [0] &= ~LINEWRAPPED; +} + +/* + * Clear first part of cursor's line, inclusive. + */ +ClearLeft (screen) + register TScreen *screen; +{ + int i; + Char *cp; + + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if(screen->cur_row - screen->topline <= screen->max_row) { + if(!AddToRefresh(screen)) { + if(screen->scroll_amt) + FlushScroll(screen); + XFillRectangle (screen->display, TextWindow(screen), + screen->reverseGC, + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + CursorY (screen, screen->cur_row), + (screen->cur_col + 1) * FontWidth(screen), + FontHeight(screen)); + } + } + + for ( i=0, cp=screen->buf[4 * screen->cur_row]; + i < screen->cur_col + 1; + i++, cp++) + *cp = ' '; + for ( i=0, cp=screen->buf[4 * screen->cur_row + 1]; + i < screen->cur_col + 1; + i++, cp++) + *cp = CHARDRAWN; + bzero (screen->buf [4 * screen->cur_row + 2], (screen->cur_col + 1)); + bzero (screen->buf [4 * screen->cur_row + 3], (screen->cur_col + 1)); +} + +/* + * Erase the cursor's line. + */ +ClearLine(screen) +register TScreen *screen; +{ + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if(screen->cur_row - screen->topline <= screen->max_row) { + if(!AddToRefresh(screen)) { + if(screen->scroll_amt) + FlushScroll(screen); + XFillRectangle (screen->display, TextWindow(screen), + screen->reverseGC, + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + CursorY (screen, screen->cur_row), + Width(screen), FontHeight(screen)); + } + } + memset(screen->buf [4 * screen->cur_row], 0, (screen->max_col + 1)); + memset(screen->buf [4 * screen->cur_row + 1], 0, (screen->max_col + 1)); + memset(screen->buf [4 * screen->cur_row + 2], 0, (screen->max_col + 1)); + memset(screen->buf [4 * screen->cur_row + 3], 0, (screen->max_col + 1)); +} + +ClearScreen(screen) +register TScreen *screen; +{ + register int top; + + if(screen->cursor_state) + HideCursor(); + screen->do_wrap = 0; + if((top = -screen->topline) <= screen->max_row) { + if(screen->scroll_amt) + FlushScroll(screen); + if(top == 0) + XClearWindow(screen->display, TextWindow(screen)); + else + XClearArea(screen->display, TextWindow(screen), + (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar), + top * FontHeight(screen) + screen->border, + Width(screen), (screen->max_row - top + 1) * + FontHeight(screen), FALSE); + } + ClearBufRows (screen, 0, screen->max_row); +} + +CopyWait(screen) +register TScreen *screen; +{ + XEvent reply; + XEvent *rep = &reply; + + while (1) { + XWindowEvent (screen->display, VWindow(screen), + ExposureMask, &reply); + switch (reply.type) { + case Expose: + HandleExposure (screen, &reply); + break; + case NoExpose: + case GraphicsExpose: + if (screen->incopy <= 0) { + screen->incopy = 1; + if (screen->scrolls > 0) + screen->scrolls--; + } + if (reply.type == GraphicsExpose) + HandleExposure (screen, &reply); + + if ((reply.type == NoExpose) || + ((XExposeEvent *)rep)->count == 0) { + if (screen->incopy <= 0 && screen->scrolls > 0) + screen->scrolls--; + if (screen->scrolls == 0) { + screen->incopy = 0; + return; + } + screen->incopy = -1; + } + break; + } + } +} + +/* + * used by vertical_copy_area and and horizontal_copy_area + */ +static void +copy_area(screen, src_x, src_y, width, height, dest_x, dest_y) + TScreen *screen; + int src_x, src_y; + unsigned int width, height; + int dest_x, dest_y; +{ + /* wait for previous CopyArea to complete unless + multiscroll is enabled and active */ + if (screen->incopy && screen->scrolls == 0) + CopyWait(screen); + screen->incopy = -1; + + /* save for translating Expose events */ + screen->copy_src_x = src_x; + screen->copy_src_y = src_y; + screen->copy_width = width; + screen->copy_height = height; + screen->copy_dest_x = dest_x; + screen->copy_dest_y = dest_y; + + XCopyArea(screen->display, + TextWindow(screen), TextWindow(screen), + screen->normalGC, + src_x, src_y, width, height, dest_x, dest_y); +} + +/* + * use when inserting or deleting characters on the current line + */ +static void +horizontal_copy_area(screen, firstchar, nchars, amount) + TScreen *screen; + int firstchar; /* char pos on screen to start copying at */ + int nchars; + int amount; /* number of characters to move right */ +{ + int src_x = CursorX(screen, firstchar); + int src_y = CursorY(screen, screen->cur_row); + + copy_area(screen, src_x, src_y, + (unsigned)nchars*FontWidth(screen), FontHeight(screen), + src_x + amount*FontWidth(screen), src_y); +} + +/* + * use when inserting or deleting lines from the screen + */ +static void +vertical_copy_area(screen, firstline, nlines, amount) + TScreen *screen; + int firstline; /* line on screen to start copying at */ + int nlines; + int amount; /* number of lines to move up (neg=down) */ +{ + if(nlines > 0) { + int src_x, src_y; + + src_x = (term->misc.sb_right ? + (int) screen->border : + (int) screen->border + screen->scrollbar); + src_y = firstline * FontHeight(screen) + screen->border; + + copy_area(screen, src_x, src_y, + (unsigned)Width(screen), nlines*FontHeight(screen), + src_x, src_y - amount*FontHeight(screen)); + } +} + +/* + * use when scrolling the entire screen + */ +scrolling_copy_area(screen, firstline, nlines, amount) + TScreen *screen; + int firstline; /* line on screen to start copying at */ + int nlines; + int amount; /* number of lines to move up (neg=down) */ +{ + + if(nlines > 0) { + vertical_copy_area(screen, firstline, nlines, amount); + } +} + +/* + * Handler for Expose events on the VT widget. + * Returns 1 iff the area where the cursor was got refreshed. + */ +HandleExposure (screen, event) + register TScreen *screen; + register XEvent *event; +{ + register XExposeEvent *reply = (XExposeEvent *)event; + + /* if not doing CopyArea or if this is a GraphicsExpose, don't translate */ + if(!screen->incopy || event->type != Expose) + return handle_translated_exposure (screen, reply->x, reply->y, + reply->width, reply->height); + else { + /* compute intersection of area being copied with + area being exposed. */ + int both_x1 = Max(screen->copy_src_x, reply->x); + int both_y1 = Max(screen->copy_src_y, reply->y); + int both_x2 = Min(screen->copy_src_x+screen->copy_width, + reply->x+reply->width); + int both_y2 = Min(screen->copy_src_y+screen->copy_height, + reply->y+reply->height); + int value = 0; + + /* was anything copied affected? */ + if(both_x2 > both_x1 && both_y2 > both_y1) { + /* do the copied area */ + value = handle_translated_exposure + (screen, reply->x + screen->copy_dest_x - screen->copy_src_x, + reply->y + screen->copy_dest_y - screen->copy_src_y, + reply->width, reply->height); + } + /* was anything not copied affected? */ + if(reply->x < both_x1 || reply->y < both_y1 + || reply->x+reply->width > both_x2 + || reply->y+reply->height > both_y2) + value = handle_translated_exposure (screen, reply->x, reply->y, + reply->width, reply->height); + + return value; + } +} + +/* + * Called by the ExposeHandler to do the actual repaint after the coordinates + * have been translated to allow for any CopyArea in progress. + * The rectangle passed in is pixel coordinates. + */ +handle_translated_exposure (screen, rect_x, rect_y, rect_width, rect_height) + register TScreen *screen; + register int rect_x, rect_y; + register unsigned int rect_width, rect_height; +{ + register int toprow, leftcol, nrows, ncols; + extern Bool waiting_for_initial_map; + + toprow = (rect_y - screen->border) / FontHeight(screen); + if(toprow < 0) + toprow = 0; + if (term->misc.sb_right) + leftcol = (rect_x - screen->border) / + FontWidth(screen); + else + leftcol = (rect_x - screen->border - screen->scrollbar) / + FontWidth(screen); + + + if(leftcol < 0) + leftcol = 0; + nrows = (rect_y + rect_height - 1 - screen->border) / + FontHeight(screen) - toprow + 1; + if (term->misc.sb_right) + ncols = (rect_x + rect_width - 1 - screen->border) / + FontWidth(screen) - leftcol + 1; + else + ncols = (rect_x + rect_width - 1 - screen->border - + screen->scrollbar) / FontWidth(screen) - leftcol + 1; + toprow -= screen->scrolls; + if (toprow < 0) { + nrows += toprow; + toprow = 0; + } + if (toprow + nrows - 1 > screen->max_row) + nrows = screen->max_row - toprow + 1; + if (leftcol + ncols - 1 > screen->max_col) + ncols = screen->max_col - leftcol + 1; + + if (nrows > 0 && ncols > 0) { + ScrnRefresh (screen, toprow, leftcol, nrows, ncols, False); + if (waiting_for_initial_map) { + first_map_occurred (); + } + if (screen->cur_row >= toprow && + screen->cur_row < toprow + nrows && + screen->cur_col >= leftcol && + screen->cur_col < leftcol + ncols) + return (1); + + } + return (0); +} + +ReverseVideo (termw) + XgtermWidget termw; +{ + register TScreen *screen = &termw->screen; + GC tmpGC; + unsigned long tmp; + + tmp = termw->core.background_pixel; + if(screen->cursorcolor == screen->foreground) + screen->cursorcolor = tmp; + termw->core.background_pixel = screen->foreground; + screen->foreground = tmp; + + tmp = screen->mousecolorback; + screen->mousecolorback = screen->mousecolor; + screen->mousecolor = tmp; + + tmpGC = screen->normalGC; + screen->normalGC = screen->reverseGC; + screen->reverseGC = tmpGC; + + tmpGC = screen->normalboldGC; + screen->normalboldGC = screen->reverseboldGC; + screen->reverseboldGC = tmpGC; + + recolor_cursor (screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + recolor_cursor (screen->arrow, + screen->mousecolor, screen->mousecolorback); + + termw->misc.re_verse = !termw->misc.re_verse; + + XDefineCursor(screen->display, TextWindow(screen), screen->pointer_cursor); + + if(screen->scrollWidget) + ScrollBarReverseVideo(screen->scrollWidget); + + XSetWindowBackground(screen->display, TextWindow(screen), termw->core.background_pixel); + XClearWindow(screen->display, TextWindow(screen)); + ScrnRefresh (screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); + update_reversevideo(); +} + + +recolor_cursor (cursor, fg, bg) + Cursor cursor; /* X cursor ID to set */ + unsigned long fg, bg; /* pixel indexes to look up */ +{ + register TScreen *screen = &term->screen; + register Display *dpy = screen->display; + XColor colordefs[2]; /* 0 is foreground, 1 is background */ + + colordefs[0].pixel = fg; + colordefs[1].pixel = bg; + XQueryColors (dpy, DefaultColormap (dpy, DefaultScreen (dpy)), + colordefs, 2); + XRecolorCursor (dpy, cursor, colordefs, colordefs+1); + return; +} + + + +void +GetColors(term,pColors) + XgtermWidget term; + ScrnColors *pColors; +{ + register TScreen *screen = &term->screen; + GC tmpGC; + unsigned long tmp; + + + pColors->which= 0; + SET_COLOR_VALUE(pColors,TEXT_FG, screen->foreground); + SET_COLOR_VALUE(pColors,TEXT_BG, term->core.background_pixel); + SET_COLOR_VALUE(pColors,TEXT_CURSOR, screen->cursorcolor); + SET_COLOR_VALUE(pColors,MOUSE_FG, screen->mousecolor); + SET_COLOR_VALUE(pColors,MOUSE_BG, screen->mousecolorback); +} + + +ChangeColors(term,pNew) + XgtermWidget term; + ScrnColors *pNew; +{ + register TScreen *screen = &term->screen; + GC tmpGC; + unsigned long tmp; + Bool newCursor= TRUE; + + + if (COLOR_DEFINED(pNew,TEXT_BG)) { + term->core.background_pixel= COLOR_VALUE(pNew,TEXT_BG); + } + + if (COLOR_DEFINED(pNew,TEXT_CURSOR)) { + screen->cursorcolor= COLOR_VALUE(pNew,TEXT_CURSOR); + } + else if ((screen->cursorcolor == screen->foreground)&& + (COLOR_DEFINED(pNew,TEXT_FG))) { + screen->cursorcolor= COLOR_VALUE(pNew,TEXT_FG); + } + else newCursor= FALSE; + + if (COLOR_DEFINED(pNew,TEXT_FG)) { + Pixel fg= COLOR_VALUE(pNew,TEXT_FG); + screen->foreground= fg; + XSetForeground(screen->display,screen->normalGC,fg); + XSetBackground(screen->display,screen->reverseGC,fg); + XSetForeground(screen->display,screen->normalboldGC,fg); + XSetBackground(screen->display,screen->reverseboldGC,fg); + } + + if (COLOR_DEFINED(pNew,TEXT_BG)) { + Pixel bg= COLOR_VALUE(pNew,TEXT_BG); + term->core.background_pixel= bg; + XSetBackground(screen->display,screen->normalGC,bg); + XSetForeground(screen->display,screen->reverseGC,bg); + XSetBackground(screen->display,screen->normalboldGC,bg); + XSetForeground(screen->display,screen->reverseboldGC,bg); + XSetWindowBackground(screen->display, TextWindow(screen), + term->core.background_pixel); + } + + if (COLOR_DEFINED(pNew,MOUSE_FG)||(COLOR_DEFINED(pNew,MOUSE_BG))) { + if (COLOR_DEFINED(pNew,MOUSE_FG)) + screen->mousecolor= COLOR_VALUE(pNew,MOUSE_FG); + if (COLOR_DEFINED(pNew,MOUSE_BG)) + screen->mousecolorback= COLOR_VALUE(pNew,MOUSE_BG); + + recolor_cursor (screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + recolor_cursor (screen->arrow, + screen->mousecolor, screen->mousecolorback); + XDefineCursor(screen->display, TextWindow(screen), + screen->pointer_cursor); + } + + set_cursor_gcs(screen); + XClearWindow(screen->display, TextWindow(screen)); + ScrnRefresh (screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); +} + diff --git a/vendor/x11iraf/xgterm/xgterm.man b/vendor/x11iraf/xgterm/xgterm.man new file mode 100644 index 00000000..5ed5163d --- /dev/null +++ b/vendor/x11iraf/xgterm/xgterm.man @@ -0,0 +1,981 @@ +.\" @(#)xgterm.1 1.1 16-Dec-96 MJF +.TH XGTERM 1 "16 Dec 1996" "X11IRAF Project" +.SH NAME +xgterm \- terminal emulator for X with graphics and imaging capability +.SH SYNOPSIS +\fBxgterm\fP [\-\fItoolkitoption\fP ...] [\-\fIoption\fP ...] +.SH DESCRIPTION +The \fIxgterm\fP program is a terminal emulator for the X Window System +based largely on \fIxterm\fP but with a completely new graphics and imaging +widget. It provides DEC VT102 and Tektronix 4014 compatible terminals for +programs that can't use the window system directly. \fIXGterm\fP also +serves as a prototype for the \fIWidget Server\fP being developed by the +IRAF Project at NOAO. The \fIObject Manager Library\fP it uses implements a +window system toolkit as an interpreted window-object language, allowing +application GUIs to be defined and executed at runtime without compiling +any code, and with minimal dependence upon the underlying window system +toolkit library. We will concentrate here, however, on it's use as a terminal +emulator and a description of the new \fIGterm\fP widget. +.PP +The Gterm graphics window operates almost identically to the \fIxterm\fP Tek +window, however there are extensions for implementing full-screen cursors, +imaging, area fills, colors, graphics erasure, a "status line" and so on. +Any graphics application capable of running under an \fIxterm\fP Tek window +should also be able to use \fIxgterm\fP as well. Client programs wishing to +make use of the extended features, or those wishing to implement a GUI, are +advised to use the OBM (\fIObject Manager\fP) library supplied with the XGterm +source as part of the X11IRAF package. This provides a much better +programmatic interface to all of the features available; however, as of +this writing it is not yet fully documented. Users are referred to the +\fIXImtool\fP task as an example of a more complex application using the +\fIOBM Library\fP and \fIGterm\fP widget, as well as demo tasks in the +\fIguidemo\fP directory of the X11IRAF sources. Questions or comments may +also be sent to \fIiraf@noao.edu\fP. +.PP +The VT102 text window is unchanged from the original \fIxterm\fR application. +All of it's resources, command-line options and operation are identical to +that used by \fIxterm\fP. The \fItermcap(5)\fP entry for \fIxterm\fP may +be used for \fIxgterm\fP as well. See the \fIxterm(1)\fP man page for details. +.SH OPTIONS +All \fIxterm(1)\fP and X Toolkit command line options are supported, there +are no additional options. +.SH RESOURCES +The program understands all of the core X Toolkit resource names and +classes, all text window resources known to \fIxterm(1)\fP, as well as +the \fIGterm\fP (graphics and imaging widget) resources. The proper Class +name for all resources described here is \fIGterm\fP. A table of +available \fIGterm\fP resources and their defaults may be found below, +some of the more interesting resources are described here in detail: +.TP 5 +\fIbasePixel\fP +Base cell of the custom colormap. This essentially allows you +to reserve \fIbasePixel\fP colors in the global colormap for other +applications. The default is 38, if changed you'll need to also enable +the \fIcmapInitialize\fP resource to force the Gterm widget to +update it's global colormap resource in the X server. +.TP 5 +\fIcmapInitialize\fP +Initialize the ximtool colormap at startup. When resetting the \fIbasePixel\fP +resource or colormap this is required in order to force the Gterm widget to +update it's global colormap resource in the X server. The default is False. +.TP 5 +\fIcmapInterpolate\fP +Interpolate the colormap to the number of display colors. The default is +True. +.TP 5 +\fIcmapName\fP +Name used for private colormap. The default for all IRAF imaging +applications is \fIimage\fP. Gterm widget based imaging applications +which have the same value of cmapName will share the same colormap, +minimizing colormap flashing and allowing multiple applications to be +run at the same time. +.TP 5 +\fIcolor0\fP +The widget background color. The default is black. +.TP 5 +\fIcolor1\fP +The widget foreground color. The default is white. +.TP 5 +\fIcolor2\fP thru \fIcolor9\fP +Optional drawing colors. The line color used for graphics is set using +an escape sequence to select the current color index. See \fIGterm I/O +Escape Sequences\fP below for more details. +.TP 5 +\fIcrosshairCursorColor\fP +Color of the full screen crosshair cursor. +.TP 5 +\fIdefaultMarker\fP +Default marker type. Options include \fItext\fP, \fIline\fP, \fIpolyline\fP, +\fIrectangle\fP, \fIbox\fP, \fIcircle\fP, \fIellipse\fP, and \fIpolygon\fP. +The default is \fIrectangle\fP. +.TP 5 +\fIdeiconifyWindow\fP +De-iconify the Gterm graphics window when activated. The default is False. +.TP 5 +\fIdialogBgColor\fP +Dialog box (i.e. the status line) background color. Dialog text is text which +is drawn into the dialog area at the bottom of the gterm window, it is +transient and is not a permanent part of the graphics being drawn. Dialog +text is normally used to interact with the user or to display messages +during program operation, without affecting the graphics being drawn. +.TP 5 +\fIdialogFgColor\fP +Dialog box (i.e. status line) foreground color. +.TP 5 +\fIginmodeBlinkInterval\fP +Graphics cursor blink interval, time is specified in milliseconds. The +default is 0. +.TP 5 +\fIginmodeCursor\fP +Graphics mode cursor type. The default is a full screen cursor custom to +the widget. +.TP 5 +\fIheight\fP +Height of the Gterm window. The default is 480. +.TP 5 +\fIidleCursor\fP +Cursor to use when not in graphics mode. The default is a plus sign. +.TP 5 +\fImarkerHighlightColor\fP +Highlight color for the active marker. When the pointer moves into a marker +is it marked "active", the highlight color and width change to which marker +is active. The default is green. +.TP 5 +\fImarkerHighlightWidth\fP +Highlight width for the active marker. The default is 2. +.TP 5 +\fImaxColors\fP +The maximum number of colors to use in the private global colormap, the +default is 216. Out of this number 10 colors (the \fIcolor0\fP thru +\fIcolor9\fP values) are reserved by the widget as static colors, the +remainder may be allocated for images. +.TP 5 +\fIraiseWindow\fP +Raise the window when active. The default is False. +.TP 5 +\fIwarpCursor\fP +Warp the cursor to the window when active. The default is False. +.TP 5 +\fIwidth\fP +Width of the Gterm window. The default is 640. + +.SH "GTERM WIDGET RESOURCES" + +.SS "Class Hierarchy" +.PP +\fBCore -> Gterm\fP +.SS "Resources" +.PP +When creating a Gterm widget instance, the following resources are retrieved +from the arguments list or from the resource database: + +.TS +center; +lB lB lB lB +l l l l. +Name Class Type Default Description += +alphaFont1 XFontStruct nil2 Graphics fonts +alphaFont2 XFontStruct 5x8 " +alphaFont3 XFontStruct 6x10 " +alphaFont4 XFontStruct 7x13 " +alphaFont5 XFontStruct 8x13 " +alphaFont6 XFontStruct 9x15 " +alphaFont7 XFontStruct 9x15 " +alphaFont8 XFontStruct 9x15 " +basePixel Int 38 Base of private global colormap +busyCursor String watch Cursor to use when application is busy +busyCursorBgColor Foreground white Busy cursor background color +busyCursorFgColor Foreground black Busy cursor foreground color +cacheRasters String whenNeeded Save rasters as server pixmaps for faster access +cmapInitialize Boolean False Initialize colormap at startup +cmapInterpolate Boolean True Interpolate colormap +cmapName String default Custom colormap name +cmapShadow Int 10 Colormap shadow interval +cmapUpdate Int 60 Colormap update interval +color0 Background black Default graphics background color +color1 Foreground white Default graphics foreground color +color2 Foreground red Optional drawing color +color3 Foreground green " +color4 Foreground blue " +color5 Foreground cyan " +color6 Foreground yellow " +color7 Foreground magenta " +color8 Foreground purple " +color9 Foreground darkslategray " +copyOnResize Boolean True Copy raster when resized +crosshairCursorColor Foreground red Full-screen cursor color +defaultMarker String rectangle Default marker type +deiconifyWindow Boolean False Deiconify window when active +dialogBgColor Foreground yellow Status line background color +dialogFgColor Foreground black Status line foreground color +dialogFont1 XFontStruct nil2 Status line fonts +dialogFont2 XFontStruct 5x8 " +dialogFont3 XFontStruct 6x10 " +dialogFont4 XFontStruct 7x13 " +dialogFont5 XFontStruct 8x13 " +dialogFont6 XFontStruct 9x15 " +dialogFont7 XFontStruct 9x15 " +dialogFont8 XFontStruct 9x15 " +ginmodeBlinkInterval Int 0 Graphics cursor blink interval +ginmodeCursor String full_crosshair Graphics cursor type +ginmodeCursorBgColor Foreground black Graphics cursor background color +ginmodeCursorFgColor Foreground white Graphics cursor foreground color +height Dimension 480 Height of graphics window +idleCursor String Plus Idle cursor type +idleCursorBgColor Foreground white Idle cursor background color +idleCursorFgColor Foreground black Idle cursor foreground color +markerBoxKnotColor Foreground blue Vertex knot color +markerBoxKnotSize Int 0 Vertex knot size +markerBoxLineColor Foreground green Marker border color +markerCircleKnotColor Foreground blue Vertex knot color +markerCircleKnotSize Int 0 Vertex knot size +markerCircleLineColor Foreground green Marker border color +markerCursorBgColor Foreground black Cursor background when in marker +markerCursorFgColor Foreground yellow Cursor foreground when in marker +markerEllipseKnotColor Foreground blue Vertex knot color +markerEllipseKnotSize Int 0 Vertex knot size +markerEllipseLineColor Foreground green Marker border color +markerFill Boolean False Flood fill marker area with \fImarkerFillColor\fP +markerFillBgColor Foreground black Fill area background color +markerFillColor Foreground slategray Flood fill color +markerFillStyle Int FillSolid Fill area style +markerHighlightColor Foreground green Marker highlight color +markerHighlightWidth Int 2 Marker highlight line width +markerLineKnotColor Foreground blue Vertex knot color +markerLineKnotSize Int 5 Vertex knot size +markerLineLineColor Foreground green Line marker color +markerLineStyle Int LineSolid Line marker line style +markerLineWidth Int 1 Line marker width +markerPgonKnotColor Foreground blue Vertex knot color +markerPgonKnotSize Int 5 Vertex knot size +markerPgonLineColor Foreground green Marker border color +markerRectKnotColor Foreground blue Vertex knot color +markerRectKnotSize Int 0 Vertex knot size +markerRectLineColor Foreground green Marker border color +markerTextBgColor Foreground slategray Text marker background color +markerTextBorder Int 2 Text marker border width +markerTextColor Foreground yellow Text marker text color +markerTextFont XFontStruct 6x13 Text marker font +markerTextLineColor Foreground green Text marker line color +markerTextString String NULL Text string +markerTranslations String default Marker event-to-actions translations +maxColors Int 216 Max colors in custom colormap +maxMappings Int 32 Max image mappings +maxRasters Int 512 Max image rasters +nearEdge Int 1 T{ +Distance, in pixels, between pointer and marker edge required +for translation actions for be in effect. +T} +nearVertex Int 4 T{ +Distance, in pixels between pointer and marker vertex (i.e. \fIknot\fP) +required for translation actions for be in effect. +T} +raiseWindow Boolean False Raise window when active +translations String default Event-to-actions translations +useTimers Boolean True Ok to use timers +warpCursor Boolean False Enable warp cursor when active +width Dimension 640 Height of graphics window +xorFill Boolean False Fill with GXxor +xorFillBgColor Int 255 Xor-fill background color +xorFillColor Int 2 Xor-fill color +.TE + +.SH "GTERM WIDGET TRANSLATIONS AND ACTIONS" + +.LP +The default translations for a Gterm window are: +.TS +center; +r l. +<Btn1Down>: m_create() +<Btn2Down>: crosshair(on) +<Btn2Motion>: crosshair(on) +<Btn2Up>: crosshair(off) +<EnterWindow>: enter-window() +<LeaveWindow>: leave-window() +<KeyPress>: graphics-input() +<Motion>: track-cursor() +.TE +.LP +The available action procedures for a Gterm window are: +.RS +.TP 20 +\fIignore()\fP +Ignore an event. +.TP 20 +\fIgraphics-input()\fP +Handle a graphics input request. +.TP 20 +\fIcrosshair(on|off)\fP +Display a crosshair cursor. +.TP 20 +\fItrack-cursor()\fP +Track crosshair cursor position. +.TP 20 +\fIenter-window()\fP +Handle an EnterWindow event. +.TP 20 +\fIleave-window()\fP +Handle an LeaveWindow event. +.TP 20 +\fIreset()\fP +Do a soft reset of the Gterm widget. +.TP 20 +\fIm_create()\fP +Create a new marker. Valid types include +.TS +center; +l l l l. +\fItext line polyline rectangle +box circle ellipse polygon\fP +.TE +The default is \fIrectangle\fP, if no type is given the default type +specified by the \fImarkerType\fP resource will be used. +.RE + +.SH "GTERM MARKER TRANSLATIONS AND ACTIONS" + +.LP +The default translations for a marker are: + +.TS +center; +r l. +!Shift <Btn1Motion>: m_rotateResize() +<Btn1Motion>: m_moveResize() +!Shift <Btn1Down>: m_raise() m_markpos() +<Btn1Down>: m_raise() m_markposAdd() +<Btn1Up>: m_redraw() m_destroyNull() +<Btn2Down>: m_lower() +<Key>BackSpace: m_deleteDestroy() +<Key>Delete: m_deleteDestroy() +<KeyPress>: m_input() +<Motion>: track-cursor() +.TE + +Translations affect only the currently active marker, the cursor must be +within \fInearEdge\fP pixels of a marker edge, or \fInearVertex\fP pixels +of a marker vertex to take effect. + +The available action procedures for a marker are +.RS +.TP 18 +\fIm_create(type)\fP +Create a new marker. Valid types include +.TS +center; +l l l l. +\fItext line polyline rectangle +box circle ellipse polygon\fP +.TE +The default is \fIrectangle\fP, if no type is given the default type +specified by the \fImarkerType\fP resource will be used. +.TP 18 +\fIm_destroy()\fP +Destroy the active marker. +.TP 18 +\fIm_destroyNull()\fP +Destroy the active marker if it is null sized. +.TP 18 +\fIm_set(attribute, value, ....)\fP +Set a marker attribute. Valid attributes include + +.TS +center; +l l l l. +\fIactivated autoRedraw fill fillBgColor +fillColor fillPattern fillStyle font +height highlightColor imageText knotColor +knotSize lineColor lineStyle lineWidth +rotangle sensitive textBgColor textBorder +textColor translations type visible +width x y \fP +.TE +.TP 18 +\fIm_raise()\fP +Raise the active marker to the top of the display list. +.TP 18 +\fIm_lower()\fP +Lower the active marker to the bottom of the display list. +.TP 18 +\fIm_notify(event, event, ....)\fP +Notify any clients that have registered callbacks for the specified type +of events. Recognized events include +.TS +center; +l l l. +\fInotify \fImoveResize \fImodify +\fIredraw \fIdestroy \fIinput +\fIfocusIn \fIfocusOut \fIconstraint\fP +.TE +.TP 18 +\fIm_input()\fP +Notify any clients that have registered a input callback that a input event +has occurred. +.TP 18 +\fIm_markpos()\fP +Mark the current position of the marker, e.g., so that it can later be erased. +.TP 18 +\fIm_markposAdd()\fP +Execute either the markpos or add action, depending upon +the pointer location. If the pointer is over an active marker at a +location where the add action can be executed this is done, otherwise the +markpos action is executed. +.TP 18 +\fIm_redraw()\fP +Redraw the active marker. +.TP 18 +\fIm_addPt()\fP +Add a point (i.e. vertex knot). \fIPolyline\fP and \fIpolygon\fP markers only. +.TP 18 +\fIm_deletePt()\fP +Delete a point (i.e. vertex knot). +.TP 18 +\fIm_movePt()\fP +Move a point (i.e. vertex knot). \fIPolyline\fP and \fIpolygon\fP markers only. +.TP 18 +\fIm_deleteDestroy()\fP +Delete a point or destroy a marker, depending upon the pointer position. +.TP 18 +\fIm_move()\fP +Move a marker. +.TP 18 +\fIm_resize()\fP +Resize a marker. +.TP 18 +\fIm_moveResize()\fP +Move a point or marker, or resize a marker, depending upon the pointer +position. +.TP 18 +\fIm_rotate()\fP +Rotate a marker. +.TP 18 +\fIm_rotateResize()\fP +Rotate or resize a marker. A marker is rotated if near a vertex know, or +resized if near an edge. +.RE + +.SH "GTERM I/O ESCAPE SEQUENCES" +XGterm uses escape sequences to provide graphics emulation. +This protocol is an extension of the Tektronix 4012 graphics protocol. +The basic extensions are patterned after the Retrographics VT640 graphics +terminal, using GS (octal \\035, aka Ctrl-]) and CAN (octal \\030, aka +Ctrl-x) to switch between vt100 and graphics modes. +Additional extensions are defined to support advanced features such as +color, area fills, graphics erasure, setting the cursor location under +program control, interactive dialog via the "status line", and so on. + +While these escape sequences can be used directly, the best programmatic +interface is to use the OBM (\fIObject Manager\fP) library supplied with +the XGterm source as part of the X11IRAF package. Any Tektronix-compatible +graphics library will suffice for producing vector graphics, the added +escape sequences used by the Gterm widget are required to make use of +imaging, area fills, the status line, etc. + +All escape sequences begin with an \fBESC\fP character (octal \\033), followed +by up to three characters defining the action to be taken. All strings in +capital letters refer to the ASCII code (e.g. \fILF\fP is the ASCII linefeed +code), a three digit number preceeded by a '\' refers to an octal code (e.g. +"\012" is octal 12) , all others are characters in the escape code (e.g. +"/bc" are the three characters '/', 'b', and 'c'). + +.SS "ESCAPE SEQUENCES" + +.RS +.TP 15 +\fBUS\fP +.sp -0.5 +.TP 15 +\fBCR\fP +Switch to alpha mode. Characters are drawn in the graphics window at the +"current" position (normally set beforehand with a GS/US vector move), +using the alpha mode font. Receipt of any control code causes alpha mode to be +exited. + +.TP 15 +\fBGS\fP +Switch to vector polyline mode. +.sp -0.5 +.TP 15 +\fBFS\fP +Switch to vector polypoint mode. +.sp -0.5 +.TP 15 +\fBRS\fP +Switch to vector mode, vertices are joined as a polygon. + +With all three codes, vertices and points are accumulated in a buffer and +displayed when the buffer fills or when vector mode is terminated by receipt +of any control code. A workstation open will be done if it hasn't already +been opened, no-op sequences GS-CAN are filtered out, since they would only +cause a pointless switch to the graphics frame and back without drawing. +The open workstation sequence is GS,US, or by the \fIxterm\fP graphics start +escape sequence "[?38h". + +.TP 15 +\fBEM\fP +Enter message mode. In message mode input text is accumulated in a buffer +and eventually passed to the object manager, which delivers the message to +the referenced object. Messages are used to download the user interface to +be executed by the object manager. During execution, messages are used +to set the values of user interface parameters to allow the UI to track +the state of the client application. + +.TP 15 +\fBCAN\fP +Close workstation and enter command mode. +.TP 15 +\fBBEL\fP +Ring the screen bell. + +.TP 15 +\fBENQ\fP +Return terminal status. Returned values include the terminal mode, and alpha +cursor x and y position. +.TP 15 +\fBSUB\fP +Initiate a cursor read, values are returned in window coordinates. +.TP 15 +\fB/SUB\fP +Return window cursor position in raster coordinates. +.TP 15 +\fBFF\fP +Clear the screen. +.TP 15 +\fB/f\fP +Set current cursor position. +.TP 15 +\fB0\fP +Set character size 0. (Currently ignored). +.sp -0.5 +.TP 15 +\fB1\fP +Set character size 1. (Currently ignored). +.sp -0.5 +.TP 15 +\fB2\fP +Set character size 2. (Currently ignored). +.sp -0.5 +.TP 15 +\fB3\fP +Set character size 3. (Currently ignored). +.TP 15 +\fB/0d\fP +Set color index. +.sp -0.5 +.TP 15 +\fB/1d\fP +Clear graphics screen. +.sp -0.5 +.TP 15 +\fB/2d\fP +Invert graphics screen +.TP 15 +\fB`\fP +Select line style 0. (Solid) +.sp -0.5 +.TP 15 +\fBa\fP +Select line style 1. (Dashed) +.sp -0.5 +.TP 15 +\fBb\fP +Select line style 2. (Dotted) +.sp -0.5 +.TP 15 +\fBc\fP +Select line style 3. (DashDot) +.sp -0.5 +.TP 15 +\fBd\fP +Select line style 4. (Dash3Dot) +.TP 15 +\fB/0w\fP +Select line width 0. +.sp -0.5 +.TP 15 +\fB/1w\fP +Select line width 1. +.sp -0.5 +.TP 15 +\fB/2w\fP +Select line width 2. +.sp -0.5 +.TP 15 +\fB/nw\fP +Select line width 3. +.TP 15 +\fB/0c\fP +Select line color 0. +.sp -0.5 +.TP 15 +\fB/1c\fP +Select line color 1. +.sp -0.5 +.TP 15 +\fB/2c\fP +Select line color 2. +.sp -0.5 +.TP 15 +\fB/3c\fP +Select line color 3. +.sp -0.5 +.TP 15 +\fB/4c\fP +Select line color 4. +.sp -0.5 +.TP 15 +\fB/5c\fP +Select line color 5. +.sp -0.5 +.TP 15 +\fB/6c\fP +Select line color 6. +.sp -0.5 +.TP 15 +\fB/7c\fP +Select line color 7. +.sp -0.5 +.TP 15 +\fB/8c\fP +Select line color 8. +.sp -0.5 +.TP 15 +\fB/9c\fP +Select line color 9. +.RE + +.SS "IMAGING ESCAPE SEQUENCES" + +These are encoded as follows: + + \fBESC\fP <code> [ \fIP ; P\fP ; ... ] <\fIdata\fP> + +where \fIcode\fR is a character sequence and \fIP\fP is an ASCII encoded +parameter described below. +.RS +.TP 15 +\fB/nc\fP +Select line color. Parameter is the color number in the range 0-9. +.TP 15 +\fBsre\fP +\fIReset\fP. Parameters are "reset-str". +.TP 15 +\fBssz\fP +\fIResize\fP. Parameters are "resize-str". +.TP 15 +\fBrir\fP +\fIInitialize raster\fP. +.TP 15 +\fBrcr\fP +\fICreate a raster\fP. Parameters are raster number, type, width, height, and +depth. Type is 1 for a normal (client) raster, 2 for cached in server memory, +or 0 if you don't care. Depth may be 1, 8, 16, or 32. +.TP 15 +\fBrde\fP +\fIDestroy a raster\fP. Parameter is raster number. +.TP 15 +\fBrqr\fP +\fIQuery a raster\fP. Parameter is raster number. +Output parameters are status, type, width, height, and depth encoded in the +string ""\\033[5;%d;%d;%d;%d;%d]". +.TP 15 +\fBrsr\fP +\fISelect a raster\fP. Parameter is raster number. +.TP 15 +\fBrwr\fP +\fIWrite pixels to a rectangular region of a raster\fP. Parameters are raster +number, encoding type (not used), x1, y1, nx, ny, and depth followed by +(nx*ny) data pixels. +.TP 15 +\fBrrd\fP +\fIRead from a rectangular region of a raster\fP. Parameters are raster +number, encoding type (not used), x1, y1, nx, ny, and depth followed by (nx*ny) +data pixels. +.TP 15 +\fBrrp\fP +\fIRefresh raster pixels\fP. Parameters are raster number, coordinate type (0 +for pixel, 1 for NDC), x1, y1, nx, ny. +.TP 15 +\fBrsp\fP +\fISet all the raster pixels in a region to a single color\fP. Parameters are +raster number, coordinate type (0 for pixel, 1 for NDC), x1, y1, nx, ny, +color, and raster operand. If nx=ny=0 the entire raster will be written. +Raster operands include transient (octal 020), refresh_all (octal 040), +or refresh_none (octal 100). +.TP 15 +\fBrco\fP +\fICopy a region of the source raster to a region of the +destination raster\fP. Parameters are raster operand, source raster number, +source type, source x coord, source y coord, source width, source height, +destination raster number, destination type, destination x coord, destination +y coord, destination width, destination height, If the input and output +regions are not the same size the subimage is automatically scaled to fit +the destination region. If the destination extent DNX or DNY is negative, +the image is flipped in that axis. The type of spatial scaling performed is +determined by the scale factors (zoom, dezoom, or no scaling). The rasterop +argument is used to exercise fine control over how the mapping is performed, +e.g. to force a refresh, implement a transient mapping, or in the case of a +dezoom (many-to-one) mapping, select the antialiasing technique to be used. +.TP 15 +\fBrwc\fP +\fIWrite a colormap\fP. Parameters are colormap number, first color and the +number of colors followed by NC colors triples in the data. +.TP 15 +\fBrrc\fP +\fIReturn the color assignments for a region of the named colormap\fP. +Parameters are colormap number, first color and the number of colors followed +by NC colors triples in the data. +.TP 15 +\fBrlc\fP +\fILoad a colormap into the display\fP, optionally scaling the colormap via a +linear transformation in the process. Parameters are the colormap number, the +offset value, and the cursor x and Y coordinates in NDC units. The colormap is +unaffected if offset=0.5, scale=1.0. A negative scale inverts the image. +If map=0 the linear transformation is applied directly to the display colormap. +.TP 15 +\fBrfc\fP +\fIFree a colormap\fP. Parameter is the colormap number. +.TP 15 +\fBrwo\fP +\fIWrite the IOmap\fP. Parameters are the first color and the number of colors, +followed by NC color triples in the data. An iomap is an optional lookup +table used to isolate the client application from the color model used within +the Gterm widget. To simplify color allocation the Gterm widget defines a +logical color space where color 0 is the background, 1 the foreground, 2-N are +statically allocated standard colors, and colors N+1 and above are dynamically +allocated by the graphics application. Less-demanding applications use +only the statically allocated, shared colors. The widget internally maps +these logical colors to whatever the window system requires, but providing +a well-defined logical color space isolates the client from the details of +color allocation in the underlying window system. + +An iomap can be used to define a mapping between the color model of the +client application and the Gterm color model (when we say color model here +we mean color allocation schemes for 8 bit pseudocolor). By default the +iomap is one-to-one. The use of an iomap frees the client from having to +worry about color index translations, and allows color tables to be +combined in the widget for greater efficiency when color tables are serially +applied. The iomap applies to all color indices or pixel values passed +in i/o operations between the client and the Gterm widget. +.TP 15 +\fBrro\fP +\fIRead the IOmap\fP. Return values are the first color and the number of +colors, followed by NC color triples in the data. +.TP 15 +\fBrim\fP +\fIDelete all mappings\fP and initialize the mapping subsystem. +.TP 15 +\fBrsm\fP +\fIDefine a new mapping function\fP, or modify an old one. +If a new mapping is defined it is merely enabled, and no refreshing +of the screen takes place until either some mapped data is written +to or the mapping is explicitly refreshed. If an existing mapping is +modified the old and new mappings are examined and only those portions +of the destination rect for which the mapping changed are updated. +This permits minor changes to a mapping (e.g. moving an edge) without +having to redraw the entire region. Regions of the destination drawable +which were previously covered by the mapping but which were exposed by +modifying the mapping are redrawn. +.TP 15 +\fBrgm\fP +\fIReturn the external parameters of a mapping\fP. Parameter is the mapping +number, values returned (in the string +"\\033[6;%d;%d %d;%d;%d;%d;%d;%d %d;%d;%d;%d;%d;%d]") are the mapping +number, rasterop, source mapping, type, x, y, width, height, and destination +mapping, type, x, y, width and height. +.TP 15 +\fBrem\fP +\fIEnable a mapping\fP. Parameters are the mapping number and an integer +flag indicating whether to refresh the mapping. +.TP 15 +\fBrdm\fP +\fIDisable a mapping\fP. Disabling a mapping does not +affect the mapping definition, hence a disabled mapping may later be +reenabled. Parameters are the mapping number and an integer flag indicating +whether to erase the mapping. +.TP 15 +\fBrrm\fP +\fIRefresh a mapping\fP. Parameter is the mapping number. +.TP 15 +\fBrfm\fP +\fIFree a mapping\fP. Parameter is the mapping number. +.RE + +.SH "MORE ON IMAGING" +The imaging model of the Gterm widget defines the following key object or +data types: \fIrasters\fP, \fImappings\fP, and \fIcolors\fP. +.TP 10 +.B "raster" +A raster is a MxN array of pixels. At present pixels are 8 bits deep but +hooks are built into the widget to expand this in the future. Pixel +values are indices into the Gterm virtual colormap, with values starting at +zero. A raster may be any size. A raster is merely a two-dimensional array +in the graphics server; it is not displayed unless mapped. An exception is +raster zero, which is the graphics window. Rasters are referred to by number, +starting with zero. Initially only raster zero exists; new rasters are created +with the create raster escape code \fBrcr\fP. Space for rasters may be +allocated either in the graphics server, or in the X server. This has +implications on performance but is otherwise transparent to the client. +By default rasters are allocated in the graphics server, i.e., in the X client. +.TP 10 +.B "mapping" +A mapping defines a projection of a rectangle of the source raster onto a +rectangle of the destination raster. Mappings may be either enabled (active) +or disabled. When a mapping is enabled, any change to a pixel in the source +rect will cause the corresponding pixels in the destination rect to be +updated. Mappings are referred to by number starting with one. Initially +no mappings are defined. If the size of the input and output rect is not +the same the input rect will be scaled by pixel replication or subsampling +to fill the output rect. If the argument DW (destination width) or DH +(destination height) of the destination rect is negative, the image will be +flipped around the corresponding axis when copied to the destination; the +region of the destination drawn into is the same in either case. Multiple +mappings may reference the same source or destination raster. Mappings are +refreshed in order by the mapping number. Modifying a mapping causes the +changed regions of the destination rect to be refreshed. +.TP 10 +.B "color" +The \fIGterm\fP widget provides a fixed number of preassigned colors +corresponding to pixel values 0 through 9. Zero is the background color, +one is the foreground color, and 2-9 (8 colors) are arbitrary colors defined +by Gterm widget resources. These static colors are normally used to draw +the background, frame, axes, titles, etc. of a plot, or to draw color +graphics within the drawing area. The advantage of static colors is that +they are shared with other X clients, and the values of these colors may be +assigned by the user to personalize the way plots look. + +The \fIGterm\fP widget also allows any number (up to about 200 or so) additional +colors to be defined at runtime by the client application. These color +values start at pixel value 10 and go up to the maximum pixel value assigned +by the client. The client application allocates colors with the +write colormap escape code \fBrwc\fP. Attempts to overwrite the values of +the static colors are ignored. The values of already allocated colors may +be changed dynamically at runtime using write colormap code to write the +desired range of color values. + +Applications should not assume that there are 10 static colors and 200 or +so allocatable colors. The IRAF graphcap entry for the logical device in use, +and resources set for the widget, +defines these parameters for the device. Alternatively, the read colormap +code may be used to dynamically determine how many colors the server has +preallocated when the application starts up. + +An image may use either static and dynamic pixel values or both types of +values, but in most cases imaging applications involve smoothly shaded +surfaces hence will require dynamically assigned private colors. + +If for some reason the client application cannot use the \fIGterm\fP widget +color model, the IOMAP feature can be used to make the widget appear to have +some externally defined (i.e., client defined) color model. +.LP +The maximum number of rasters and maximum number of mappings is defined by +the Gterm widget resources \fImaxRaster\fP and \fImaxMappings\fP (or in the +GUI file) when the graphics application starts up. The maximum values should +be much larger than most applications require. Applications should allocate +raster or mapping numbers sequentially starting at 1 (more or less) to avoid +running out of raster or mapping descriptors. + +The {read|write}pixels escape codes operate directly on +raster pixels. The mapping escape codes support two alternative coordinate +systems, raster pixels and NDC (normalized device coordinates), as indicated +by the ST or DT argument (source or destination coordinate type). Note +that the origin of the pixel coordinate system is the upper left corner of +the display window (consistent with most graphics systems), whereas the origin +of the NDC coordinate system is the lower left corner (consistent with IRAF). + +Pixel coordinates allow precise control of imaging but require the +application to know the window size, and may result in complications e.g. if +the window is resized. NDC coordinates pretty much guarantee that a mapping +will involve sampling, hence are not the most efficient, but the graphics +will be drawn correctly no matter how the window is resized and for most +applications the performance difference is negligible. Most applications +should use NDC coordinates for raster 0 (the display window), and pixel +coordinates for rasters 1-N. + +Although the size of rasters 1 and higher are defined by the client +application, the size of raster zero, the actual gterm display window, is +subject to the constraints of the window system. The client can attempt to +reset the size of the gterm window using create raster escape with raster=0, +however the Gterm widget, UI containing the \fIGterm\fP widget, and the window +manager are all free to deny such a request. The query raster escape should be +called to determine the actual size of the window one will be drawing into. + +.SS AN EXAMPLE IMAGING APPLICATION + +.LP +An example of a simple imaging application might be one that downloads an +image and displays it in the gterm window, filling the window. This could +be done as follows (following a graphics open and other escape codes to +prepare the drawing surface). + +.TP 15 +\fIcreate raster\fP +Create raster 1 the size of the pixel array to be displayed. This need not +be the same as the size of the gterm display window. +.TP 15 +\fIset mapping\fP +Define a mapping between raster 1 and raster 0, the display window, using +NDC coordinates to define the region of the display window to be +filled. The mapping number is arbitrary but mappings should normally be +allocated starting with 1. The mapping is automatically enabled +when first defined. +.TP 15 +\fIwrite colormap\fP +(Optional). Define the pixel value to RGB color assignments for the image +pixels. +.TP 15 +\fIwrite pixels\fP +This escape is called one or more times to write pixels into raster 1. +At most 32K pixels can be written in each call. As each write is +made the affected region of the display window will be updated. +.LP +Alternatively, one could write the pixels and then define the mapping to +cause the entire image to be displayed at once. + +Note that the imaging escape can be combined with normal graphics to draw text +and graphics around or on top of an image region. The order in which drawing +operations occur is important, e.g., to draw graphics or text on top of an +image the image should be drawn first. + +.SH "MARKERS" +Markers are a general feature of the \fIGterm\fP widget and are used more +extensively in other programs (e.g. the prototype IRAF science GUI +applications), but they have no real use in \fIxgterm\fP when used as +simply a graphics terminal. All markers share some of the same characteristics, +so it is worthwhile learning basic marker manipulation keystrokes (as defined +using the default marker translations), especially how to delete an +accidentally created marker: +.RS +.TP 3 +\fBo\fP +\fIDelete\fP or \fIBackspace\fP in a marker deletes it. +.TP 3 +\fBo\fP +MB1 anywhere inside a marker may be used to drag the marker. +.TP 3 +\fBo\fP +MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +.TP 3 +\fBo\fP +Shift-MB1 on the corner of most markers will rotate the marker. +.TP 3 +\fBo\fP +Markers stack, if you have several markers and you put one on top of +the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +.TP 3 +\fBo\fP +MB2 in the body of a marker "lowers" the marker, i.e. moves it to the +bottom of the stacking order. +.RE + +.SH ENVIRONMENT +.I XGterm +sets the environment variables ``TERM'' and ``TERMCAP'' properly for the +size window you have created. +It also uses and sets the environment +variable ``DISPLAY'' to specify which bit map display terminal to use. +The environment variable ``WINDOWID'' is set to the X window id number +of the \fIxgterm\fP window. + +.SH "SEE ALSO" +xterm(1), resize(1), X(1), pty(4), tty(4) +.br +\fIXterm Control Sequences\fP (in the \fIxterm\fP source directory) + +.SH BUGS +Many of the same bugs affecting \fIxterm\fP also apply here. + +\fIXgterm\fP is not normally installed with setuid permissions. On some +Linux systems, for example, where the /dev/tty and /dev/pty devices have +root ownership and permission 600 this can cause problems. Workarounds +are to either install \fIXGterm\fP with setuid permissions or modify the +/dev/tty and /dev/pty devices to have permission 666. + +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + diff --git a/vendor/x11iraf/xgterm/xgterm.ps b/vendor/x11iraf/xgterm/xgterm.ps new file mode 100644 index 00000000..368ba9f7 --- /dev/null +++ b/vendor/x11iraf/xgterm/xgterm.ps @@ -0,0 +1,1298 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.09 +%%CreationDate: Sat Apr 5 14:58:34 1997 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.09 0 +%%Pages: 13 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.09 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 9 +/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0(xgterm \255 terminal emula\ +tor for X with graphics and imaging capability)108 96 Q F1(SYNOPSIS)72 +112.8 Q/F2 10/Times-Bold@0 SF(xgterm)108 124.8 Q F0<5bad>2.5 E/F3 10 +/Times-Italic@0 SF(toolkitoption)A F0(...] [\255)2.5 E F3(option)A F0 +(...])2.5 E F1(DESCRIPTION)72 141.6 Q F0(The)108 153.6 Q F3(xgterm)3.475 +E F0 .975(program is a terminal emulator for the X W)3.475 F(indo)-.4 E +3.474(wS)-.25 G .974(ystem based lar)-3.474 F .974(gely on)-.18 F F3 +(xterm)3.474 E F0 -.2(bu)3.474 G 3.474(tw).2 G .974(ith a)-3.474 F .378 +(completely ne)108 165.6 R 2.878(wg)-.25 G .378 +(raphics and imaging widget. It pro)-2.878 F .379(vides DEC VT102 and T) +-.15 F .379(ektronix 4014 compatible ter)-.7 F(-)-.2 E .636 +(minals for programs that can')108 177.6 R 3.136(tu)-.18 G .635 +(se the windo)-3.136 F 3.135(ws)-.25 G .635(ystem directly)-3.135 F(.) +-.65 E F3(XGterm)5.635 E F0 .635(also serv)3.135 F .635 +(es as a prototype for the)-.15 F F3 -.55(Wi)108 189.6 S(dg).55 E .237 +(et Server)-.1 F F0 .237(being de)2.737 F -.15(ve)-.25 G .237 +(loped by the IRAF Project at NO).15 F -.55(AO)-.35 G 5.238(.T).55 G(he) +-5.238 E F3 .238(Object Mana)2.738 F -.1(ge)-.1 G 2.738(rL).1 G(ibr) +-2.738 E(ary)-.15 E F0 .238(it uses imple-)2.738 F .379(ments a windo) +108 201.6 R 2.879(ws)-.25 G .379(ystem toolkit as an interpreted windo) +-2.879 F .378(w-object language, allo)-.25 F .378 +(wing application GUIs to be)-.25 F 1.984(de\214ned and e)108 213.6 R +-.15(xe)-.15 G 1.984(cuted at runtime without compiling an).15 F 4.484 +(yc)-.15 G 1.985(ode, and with minimal dependence upon the)-4.484 F +1.488(underlying windo)108 225.6 R 3.988(ws)-.25 G 1.488 +(ystem toolkit library)-3.988 F 6.488(.W)-.65 G 3.987(ew)-7.288 G 1.487 +(ill concentrate here, ho)-3.987 F(we)-.25 E -.15(ve)-.25 G 2.287 -.4 +(r, o).15 H 3.987(ni).4 G(t')-3.987 E 3.987(su)-.55 G 1.487 +(se as a terminal)-3.987 F(emulator and a description of the ne)108 +237.6 Q(w)-.25 E F3(Gterm)2.5 E F0(widget.)2.5 E .205 +(The Gterm graphics windo)108 254.4 R 2.705(wo)-.25 G .205 +(perates almost identically to the)-2.705 F F3(xterm)2.705 E F0 -.7(Te) +2.705 G 2.706(kw).7 G(indo)-2.706 E 1.506 -.65(w, h)-.25 H -.25(ow).65 G +-2.15 -.25(ev e).25 H 2.706(rt).25 G .206(here are e)-2.706 F(xten-)-.15 +E .616(sions for implementing full-screen cursors, imaging, area \214ll\ +s, colors, graphics erasure, a "status line" and)108 266.4 R .33(so on.) +108 278.4 R(An)5.33 E 2.83(yg)-.15 G .33 +(raphics application capable of running under an)-2.83 F F3(xterm)2.831 +E F0 -.7(Te)2.831 G 2.831(kw).7 G(indo)-2.831 E 2.831(ws)-.25 G .331 +(hould also be able to use)-2.831 F F3(xgterm)108 290.4 Q F0 .528 +(as well.)3.028 F .528(Client programs wishing to mak)5.528 F 3.028(eu) +-.1 G .528(se of the e)-3.028 F .527 +(xtended features, or those wishing to imple-)-.15 F .019 +(ment a GUI, are advised to use the OBM \()108 302.4 R F3 .019 +(Object Mana)B -.1(ge)-.1 G(r).1 E F0 2.519(\)l)C .019 +(ibrary supplied with the XGterm source as part)-2.519 F .557 +(of the X11IRAF package.)108 314.4 R .557(This pro)5.557 F .557 +(vides a much better programmatic interf)-.15 F .557 +(ace to all of the features a)-.1 F -.25(va)-.2 G(il-).25 E .198 +(able; ho)108 326.4 R(we)-.25 E -.15(ve)-.25 G .998 -.4(r, a).15 H 2.698 +(so).4 G 2.698(ft)-2.698 G .198 +(his writing it is not yet fully documented.)-2.698 F .198 +(Users are referred to the)5.198 F F3(XImtool)2.698 E F0 .198 +(task as an)2.698 F -.15(ex)108 338.4 S .093(ample of a more comple).15 +F 2.593(xa)-.15 G .093(pplication using the)-2.593 F F3 .093(OBM Libr) +2.593 F(ary)-.15 E F0(and)2.593 E F3(Gterm)2.593 E F0 .092 +(widget, as well as demo tasks in)2.593 F(the)108 350.4 Q F3(guidemo) +6.971 E F0 4.471(directory of the X11IRAF sources.)6.971 F 4.472 +(Questions or comments may also be sent to)9.471 F F3(ir)108 362.4 Q +(af@noao.edu)-.15 E F0(.)A .164(The VT102 te)108 379.2 R .164(xt windo) +-.15 F 2.664(wi)-.25 G 2.664(su)-2.664 G .164 +(nchanged from the original)-2.664 F F3(xterm)2.664 E F0 2.664 +(application. All)2.664 F .164(of it')2.664 F 2.664(sr)-.55 G .164 +(esources, command-)-2.664 F .27 +(line options and operation are identical to that used by)108 391.2 R F3 +(xterm)2.77 E F0 5.27(.T)C(he)-5.27 E F3(termcap\(5\))2.77 E F0 .27 +(entry for)2.77 F F3(xterm)2.77 E F0 .27(may be used)2.77 F(for)108 +403.2 Q F3(xgterm)2.5 E F0(as well.)2.5 E(See the)5 E F3(xterm\(1\))2.5 +E F0(man page for details.)2.5 E F1(OPTIONS)72 420 Q F0(All)108 432 Q F3 +(xterm\(1\))2.5 E F0(and X T)2.5 E(oolkit command line options are supp\ +orted, there are no additional options.)-.8 E F1(RESOURCES)72 448.8 Q F0 +.779(The program understands all of the core X T)108 460.8 R .779 +(oolkit resource names and classes, all te)-.8 F .778(xt windo)-.15 F +3.278(wr)-.25 G(esources)-3.278 E(kno)108 472.8 Q .371(wn to)-.25 F F3 +(xterm\(1\))2.871 E F0 2.872(,a)C 2.872(sw)-2.872 G .372(ell as the) +-2.872 F F3(Gterm)2.872 E F0 .372 +(\(graphics and imaging widget\) resources.)2.872 F .372 +(The proper Class name)5.372 F .729(for all resources described here is) +108 484.8 R F3(Gterm)3.229 E F0 5.729(.A)C .729(table of a)-2.5 F -.25 +(va)-.2 G(ilable).25 E F3(Gterm)3.229 E F0 .729(resources and their def) +3.229 F .728(aults may be)-.1 F(found belo)108 496.8 Q 1.3 -.65(w, s) +-.25 H +(ome of the more interesting resources are described here in detail:).65 +E F3(basePixel)108 513.6 Q F0 1.515(Base cell of the custom colormap.) +133 525.6 R 1.515(This essentially allo)6.515 F 1.515(ws you to reserv) +-.25 F(e)-.15 E F3(basePixel)4.016 E F0 1.516(colors in the)4.016 F .75 +(global colormap for other applications.)133 537.6 R .75(The def)5.75 F +.749(ault is 38, if changed you')-.1 F .749(ll need to also enable the) +-.1 F F3(cmapInitialize)133 549.6 Q F0 .971 +(resource to force the Gterm widget to update it')3.471 F 3.471(sg)-.55 +G .972(lobal colormap resource in the X)-3.471 F(serv)133 561.6 Q(er) +-.15 E(.)-.55 E F3(cmapInitialize)108 578.4 Q F0 .385 +(Initialize the ximtool colormap at startup.)133 590.4 R .385 +(When resetting the)5.385 F F3(basePixel)2.885 E F0 .385 +(resource or colormap this is)2.885 F .719 +(required in order to force the Gterm widget to update it')133 602.4 R +3.22(sg)-.55 G .72(lobal colormap resource in the X serv)-3.22 F(er)-.15 +E(.)-.55 E(The def)133 614.4 Q(ault is F)-.1 E(alse.)-.15 E F3 +(cmapInterpolate)108 631.2 Q F0 +(Interpolate the colormap to the number of display colors.)133 643.2 Q +(The def)5 E(ault is T)-.1 E(rue.)-.35 E F3(cmapName)108 660 Q F0 1.276 +(Name used for pri)133 672 R -.25(va)-.25 G 1.276(te colormap.).25 F +1.276(The def)6.276 F 1.276(ault for all IRAF imaging applications is) +-.1 F F3(ima)3.775 E -.1(ge)-.1 G F0 6.275(.G).1 G(term)-6.275 E .16 +(widget based imaging applications which ha)133 684 R .46 -.15(ve t)-.2 +H .16(he same v).15 F .16(alue of cmapName will share the same col-)-.25 +F(ormap, minimizing colormap \215ashing and allo)133 696 Q +(wing multiple applications to be run at the same time.)-.25 E +(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(1)203.45 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 10 +/Times-Italic@0 SF(color0)108 84 Q F0(The widget background color)133 96 +Q 5(.T)-.55 G(he def)-5 E(ault is black.)-.1 E F1(color1)108 112.8 Q F0 +(The widget fore)133 124.8 Q(ground color)-.15 E 5(.T)-.55 G(he def)-5 E +(ault is white.)-.1 E F1(color2)108 141.6 Q F0(thru)5 E F1(color9)5 E F0 +.765(Optional dra)133 153.6 R .765(wing colors.)-.15 F .764(The line co\ +lor used for graphics is set using an escape sequence to select)5.765 F +(the current color inde)133 165.6 Q 2.5(x. See)-.15 F F1 +(Gterm I/O Escape Sequences)2.5 E F0(belo)2.5 E 2.5(wf)-.25 G +(or more details.)-2.5 E F1(cr)108 182.4 Q(osshairCur)-.45 E(sorColor) +-.1 E F0(Color of the full screen crosshair cursor)133 194.4 Q(.)-.55 E +F1(defaultMark)108 211.2 Q(er)-.1 E F0(Def)133 223.2 Q .353(ault mark) +-.1 F .353(er type.)-.1 F .353(Options include)5.353 F F1(te)2.853 E(xt) +-.2 E F0(,)A F1(line)2.853 E F0(,)A F1(polyline)2.853 E F0(,)A F1 -.37 +(re)2.853 G(ctangle).37 E F0(,)A F1(box)2.853 E F0(,)A F1(cir)2.853 E +(cle)-.37 E F0(,)A F1(ellipse)2.853 E F0 2.853(,a)C(nd)-2.853 E F1 +(polygon)2.854 E F0(.)A(The def)133 235.2 Q(ault is)-.1 E F1 -.37(re)2.5 +G(ctangle).37 E F0(.)A F1(deiconifyW)108 252 Q(indow)-.55 E F0 +(De-iconify the Gterm graphics windo)133 264 Q 2.5(ww)-.25 G(hen acti) +-2.5 E -.25(va)-.25 G 2.5(ted. The).25 F(def)2.5 E(ault is F)-.1 E +(alse.)-.15 E F1(dialo)108 280.8 Q(gBgColor)-.1 E F0 .262 +(Dialog box \(i.e. status line\) background color)133 292.8 R 5.261(.D) +-.55 G .261(ialog te)-5.261 F .261(xt is te)-.15 F .261(xt which is dra) +-.15 F .261(wn into the dialog area)-.15 F .769 +(at the bottom of the gterm windo)133 304.8 R 2.069 -.65(w, i)-.25 H +3.269(ti).65 G 3.269(st)-3.269 G .769 +(ransient and is not a permanent part of the graphics being)-3.269 F +(dra)133 316.8 Q 2.925(wn. Dialog)-.15 F(te)2.925 E .424(xt is normally\ + used to interact with the user or to display messages during program) +-.15 F(operation, without af)133 328.8 Q(fecting the graphics being dra) +-.25 E(wn.)-.15 E F1(dialo)108 345.6 Q(gFgColor)-.1 E F0 +(Dialog box \(i.e. status line\) fore)133 357.6 Q(ground color)-.15 E(.) +-.55 E F1(ginmodeBlinkInterval)108 374.4 Q F0 +(Graphics cursor blink interv)133 386.4 Q +(al, time is speci\214ed in milliseconds.)-.25 E(The def)5 E(ault is 0.) +-.1 E F1(ginmodeCur)108 403.2 Q(sor)-.1 E F0(Graphics mode cursor type.) +133 415.2 Q(The def)5 E +(ault is a full screen cursor custom to the widget.)-.1 E F1(height)108 +432 Q F0(Height of the Gterm windo)133 444 Q 3.8 -.65(w. T)-.25 H +(he def).65 E(ault is 480.)-.1 E F1(idleCur)108 460.8 Q(sor)-.1 E F0 +(Cursor to use when not in graphics mode.)133 472.8 Q F1(mark)108 489.6 +Q(erHighlightColor)-.1 E F0 .835(Highlight color for the acti)133 501.6 +R 1.135 -.15(ve m)-.25 H(ark).15 E(er)-.1 E 5.835(.W)-.55 G .835 +(hen the pointer mo)-5.835 F -.15(ve)-.15 G 3.335(si).15 G .835 +(nto a mark)-3.335 F .835(er is it mark)-.1 F .835(ed "acti)-.1 F -.15 +(ve)-.25 G(",).15 E(the highlight color and width change to which mark) +133 513.6 Q(er is acti)-.1 E -.15(ve)-.25 G 5(.T).15 G(he def)-5 E +(ault is green.)-.1 E F1(mark)108 530.4 Q(erHighlightW)-.1 E(idth)-.55 E +F0(Highlight width for the acti)133 542.4 Q .3 -.15(ve m)-.25 H(ark).15 +E(er)-.1 E 2.5(.T)-.55 G(he def)-2.5 E(ault is 2.)-.1 E F1(maxColor)108 +559.2 Q(s)-.1 E F0 .255(The maximum number of colors to use in the pri) +133 571.2 R -.25(va)-.25 G .254(te global colormap, the def).25 F .254 +(ault is 216.)-.1 F .254(Out of this)5.254 F 1.526 +(number 10 colors \(the)133 583.2 R F1(color0)4.026 E F0(theu)4.026 E F1 +(color9)4.026 E F0 -.25(va)4.026 G 1.526(lues\) are reserv).25 F 1.527 +(ed by the widget as static colors, the)-.15 F +(remainder may be allocated for images.)133 595.2 Q F1 -.15(ra)108 612 S +(iseW).15 E(indow)-.55 E F0(Raise the windo)133 624 Q 2.5(ww)-.25 G +(hen acti)-2.5 E -.15(ve)-.25 G 5(.T).15 G(he def)-5 E(ault is F)-.1 E +(alse.)-.15 E F1(warpCur)108 640.8 Q(sor)-.1 E F0 -.8(Wa)133 652.8 S +(rp the cursor to the windo).8 E 2.5(ww)-.25 G(hen acti)-2.5 E -.15(ve) +-.25 G 5(.T).15 G(he def)-5 E(ault is F)-.1 E(alse.)-.15 E F1(width)108 +669.6 Q F0 -.4(Wi)133 681.6 S(dth of the Gterm windo).4 E 3.8 -.65(w. T) +-.25 H(he def).65 E(ault is 640.)-.1 E(X11IRAF Project)72 768 Q +(16 Dec 1996)137.62 E(2)203.45 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 9 +/Times-Bold@0 SF(GTERM WIDGET RESOURCES)72 84 Q/F2 10/Times-Bold@0 SF +(Class Hierar)87 96 Q(ch)-.18 E(y)-.15 E(Cor)108 108 Q 2.5(e-)-.18 G 2.5 +(>G)-2.5 G(term)-2.5 E(Resour)87 124.8 Q(ces)-.18 E F0 1.38 +(When crating a Gterm widget instance, the follo)108 136.8 R 1.38 +(wing resources are retrie)-.25 F -.15(ve)-.25 G 3.88(df).15 G 1.38 +(rom the ar)-3.88 F 1.38(guments list or)-.18 F +(from the resource database:)108 148.8 Q F2 86.29(Name Class)105.715 +172.8 R -.74(Ty)2.5 G 15.59(pe Default).74 F(Description)38.33 E .4 LW +542.285 177.3 105.715 177.3 DL 542.285 179.3 105.715 179.3 DL F0(alphaF) +105.715 188.8 Q 66.43(ont1 XF)-.15 F 12.5(ontStruct nil2)-.15 F +(Graphics fonts)54.43 E(alphaF)105.715 200.8 Q 66.43(ont2 XF)-.15 F 12.5 +(ontStruct 5x8)-.15 F(")69.99 E(alphaF)105.715 212.8 Q 66.43(ont3 XF) +-.15 F 12.5(ontStruct 6x10)-.15 F(")64.99 E(alphaF)105.715 224.8 Q 66.43 +(ont4 XF)-.15 F 12.5(ontStruct 7x13)-.15 F(")64.99 E(alphaF)105.715 +236.8 Q 66.43(ont5 XF)-.15 F 12.5(ontStruct 8x13)-.15 F(")64.99 E +(alphaF)105.715 248.8 Q 66.43(ont6 XF)-.15 F 12.5(ontStruct 9x15)-.15 F +(")64.99 E(alphaF)105.715 260.8 Q 66.43(ont7 XF)-.15 F 12.5 +(ontStruct 9x15)-.15 F(")64.99 E(alphaF)105.715 272.8 Q 66.43(ont8 XF) +-.15 F 12.5(ontStruct 9x15)-.15 F(")64.99 E(basePix)105.715 284.8 Q 73.1 +(el Int)-.15 F 57.49(38 Base)53.19 F(of pri)2.5 E -.25(va)-.25 G +(te global colormap).25 E -.2(bu)105.715 296.8 S 65.37(syCursor String) +.2 F -.1(wa)39.85 G 43.71(tch Cursor).1 F(to use when application is b) +2.5 E(usy)-.2 E -.2(bu)105.715 308.8 S 30.92(syCursorBgColor F).2 F(ore) +-.15 E 15.44(ground white)-.15 F(Busy cursor background color)47.77 E +-.2(bu)105.715 320.8 S 32.03(syCursorFgColor F).2 F(ore)-.15 E 15.44 +(ground black)-.15 F(Busy cursor fore)48.33 E(ground color)-.15 E 59.08 +(cacheRasters String)105.715 332.8 R 15.29(whenNeeded Sa)39.85 F .3 -.15 +(ve r)-.2 H(asters as serv).15 E(er pixmaps for f)-.15 E(aster access) +-.1 E 54.07(cmapInitialize Boolean)105.715 344.8 R -.15(Fa)30.97 G 46.53 +(lse Initialize).15 F(colormap at startup)2.5 E 46.3 +(cmapInterpolate Boolean)105.715 356.8 R -.35(Tr)30.97 G 48.96 +(ue Interpolate).35 F(colormap)2.5 E 65.74(cmapName String)105.715 368.8 +R(def)39.85 E 39.82(ault Custom)-.1 F(colormap name)2.5 E(cmapShado) +105.715 380.8 Q 60.15(wI)-.25 G 50.69(nt 10)-60.15 F(Colormap shado) +59.99 E 2.5(wi)-.25 G(nterv)-2.5 E(al)-.25 E 60.74(cmapUpdate Int) +105.715 392.8 R 57.49(60 Colormap)53.19 F(update interv)2.5 E(al)-.25 E +85.73(color0 Background)105.715 404.8 R 45.83(black Def)15.42 F +(ault graphics background color)-.1 E 85.73(color1 F)105.715 416.8 R +(ore)-.15 E 15.44(ground white)-.15 F(Def)47.77 E(ault graphics fore)-.1 +E(ground color)-.15 E 85.73(color2 F)105.715 428.8 R(ore)-.15 E 15.44 +(ground red)-.15 F(Optional dra)57.22 E(wing color)-.15 E 85.73 +(color3 F)105.715 440.8 R(ore)-.15 E 15.44(ground green)-.15 F(")62.78 E +85.73(color4 F)105.715 452.8 R(ore)-.15 E 15.44(ground blue)-.15 F(") +67.77 E 85.73(color5 F)105.715 464.8 R(ore)-.15 E 15.44(ground c)-.15 F +63.76(yan ")-.15 F 85.73(color6 F)105.715 476.8 R(ore)-.15 E 15.44 +(ground yello)-.15 F 58.02(w")-.25 G 85.73(color7 F)105.715 488.8 R(ore) +-.15 E 15.44(ground magenta)-.15 F(")51.11 E 85.73(color8 F)105.715 +500.8 R(ore)-.15 E 15.44(ground purple)-.15 F(")59.44 E 85.73(color9 F) +105.715 512.8 R(ore)-.15 E 15.44(ground darkslate)-.15 F 28.77(gray ") +-.15 F(cop)105.715 524.8 Q 53.06(yOnResize Boolean)-.1 F -.35(Tr)30.97 G +48.96(ue Cop).35 F 2.5(yr)-.1 G(aster when resized)-2.5 E 25.18 +(crosshairCursorColor F)105.715 536.8 R(ore)-.15 E 15.44(ground red)-.15 +F(Full-screen cursor color)57.22 E(def)105.715 548.8 Q(aultMark)-.1 E +54.28(er String)-.1 F 30.84(rectangle Def)39.85 F(ault mark)-.1 E +(er type)-.1 E(deiconifyW)105.715 560.8 Q(indo)-.4 E 42.22(wB)-.25 G +28.47(oolean F)-42.22 F 46.53(alse Deiconify)-.15 F(windo)2.5 E 2.5(ww) +-.25 G(hen acti)-2.5 E -.15(ve)-.25 G 51.83(dialogBgColor F)105.715 +572.8 R(ore)-.15 E 15.44(ground yello)-.15 F 43.02(wS)-.25 G +(tatus line background color)-43.02 E 52.94(dialogFgColor F)105.715 +584.8 R(ore)-.15 E 15.44(ground black)-.15 F(Status line fore)48.33 E +(ground color)-.15 E(dialogF)105.715 596.8 Q 63.09(ont1 XF)-.15 F 12.5 +(ontStruct nil2)-.15 F(Status line fonts)54.43 E(dialogF)105.715 608.8 Q +63.09(ont2 XF)-.15 F 12.5(ontStruct 5x8)-.15 F(")69.99 E(dialogF)105.715 +620.8 Q 63.09(ont3 XF)-.15 F 12.5(ontStruct 6x10)-.15 F(")64.99 E +(dialogF)105.715 632.8 Q 63.09(ont4 XF)-.15 F 12.5(ontStruct 7x13)-.15 F +(")64.99 E(dialogF)105.715 644.8 Q 63.09(ont5 XF)-.15 F 12.5 +(ontStruct 8x13)-.15 F(")64.99 E(dialogF)105.715 656.8 Q 63.09(ont6 XF) +-.15 F 12.5(ontStruct 9x15)-.15 F(")64.99 E(dialogF)105.715 668.8 Q +63.09(ont7 XF)-.15 F 12.5(ontStruct 9x15)-.15 F(")64.99 E(dialogF) +105.715 680.8 Q 63.09(ont8 XF)-.15 F 12.5(ontStruct 9x15)-.15 F(")64.99 +E(ginmodeBlinkInterv)105.715 692.8 Q 23.2(al Int)-.25 F 64.99(0G)53.19 G +(raphics cursor blink interv)-64.99 E(al)-.25 E 49.06 +(ginmodeCursor String)105.715 704.8 R 12.5(full_crosshair Graphics)39.85 +F(cursor type)2.5 E 14.61(ginmodeCursorBgColor F)105.715 716.8 R(ore) +-.15 E 15.44(ground black)-.15 F(Graphics cursor background color)48.33 +E(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(3)203.45 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R 15.72 +(ginmodeCursorFgColor F)105.715 84 R(ore)-.15 E 15.44(ground white)-.15 +F(Graphics cursor fore)47.77 E(ground color)-.15 E 86.28 +(height Dimension)105.715 96 R 52.49(480 Height)20.41 F +(of graphics windo)2.5 E(w)-.25 E 69.06(idleCursor String)105.715 108 R +50.26(Plus Idle)39.85 F(cursor type)2.5 E 34.61(idleCursorBgColor F) +105.715 120 R(ore)-.15 E 15.44(ground white)-.15 F +(Idle cursor background color)47.77 E 35.72(idleCursorFgColor F)105.715 +132 R(ore)-.15 E 15.44(ground black)-.15 F(Idle cursor fore)48.33 E +(ground color)-.15 E(mark)105.715 144 Q 23.61(erBoxKnotColor F)-.1 F +(ore)-.15 E 15.44(ground blue)-.15 F -1.11(Ve)52.77 G(rte)1.11 E 2.5(xk) +-.15 G(not color)-2.5 E(mark)105.715 156 Q 29.17(erBoxKnotSize Int)-.1 F +64.99(0V)53.19 G(erte)-66.1 E 2.5(xk)-.15 G(not size)-2.5 E(mark)105.715 +168 Q 25.28(erBoxLineColor F)-.1 F(ore)-.15 E 15.44(ground green)-.15 F +(Mark)47.78 E(er border color)-.1 E(mark)105.715 180 Q 15.84 +(erCircleKnotColor F)-.1 F(ore)-.15 E 15.44(ground blue)-.15 F -1.11(Ve) +52.77 G(rte)1.11 E 2.5(xk)-.15 G(not color)-2.5 E(mark)105.715 192 Q +21.4(erCircleKnotSize Int)-.1 F 64.99(0V)53.19 G(erte)-66.1 E 2.5(xk) +-.15 G(not size)-2.5 E(mark)105.715 204 Q 17.51(erCircleLineColor F)-.1 +F(ore)-.15 E 15.44(ground green)-.15 F(Mark)47.78 E(er border color)-.1 +E(mark)105.715 216 Q 21.39(erCursorBgColor F)-.1 F(ore)-.15 E 15.44 +(ground black)-.15 F(Cursor background when in mark)48.33 E(er)-.1 E +(mark)105.715 228 Q 22.5(erCursorFgColor F)-.1 F(ore)-.15 E 15.44 +(ground yello)-.15 F 43.02(wC)-.25 G(ursor fore)-43.02 E +(ground when in mark)-.15 E(er)-.1 E(mark)105.715 240 Q 12.5 +(erEllipseKnotColor F)-.1 F(ore)-.15 E 15.44(ground blue)-.15 F -1.11 +(Ve)52.77 G(rte)1.11 E 2.5(xk)-.15 G(not color)-2.5 E(mark)105.715 252 Q +18.06(erEllipseKnotSize Int)-.1 F 64.99(0V)53.19 G(erte)-66.1 E 2.5(xk) +-.15 G(not size)-2.5 E(mark)105.715 264 Q 14.17(erEllipseLineColor F)-.1 +F(ore)-.15 E 15.44(ground green)-.15 F(Mark)47.78 E(er border color)-.1 +E(mark)105.715 276 Q 69.16(erFill Boolean)-.1 F -.15(Fa)30.97 G 46.53 +(lse Flood).15 F(\214ll mark)2.5 E(er area with)-.1 E/F1 10 +/Times-Italic@0 SF(mark)2.5 E(erF)-.1 E(illColor)-.45 E F0(mark)105.715 +288 Q 34.71(erFillBgColor F)-.1 F(ore)-.15 E 15.44(ground black)-.15 F +(Fill area background color)48.33 E(mark)105.715 300 Q 46.38 +(erFillColor F)-.1 F(ore)-.15 E 15.44(ground slate)-.15 F 31.54 +(gray Flood)-.15 F(\214ll color)2.5 E(mark)105.715 312 Q 48.6 +(erFillStyle Int)-.1 F 32.47(FillSolid Fill)53.19 F(area style)2.5 E +(mark)105.715 324 Q 21.94(erHighlightColor F)-.1 F(ore)-.15 E 15.44 +(ground green)-.15 F(Mark)47.78 E(er highlight color)-.1 E(mark)105.715 +336 Q(erHighlightW)-.1 E 20.12(idth Int)-.4 F 64.99(2M)53.19 G(ark) +-64.99 E(er highlight line width)-.1 E(mark)105.715 348 Q 21.95 +(erLineKnotColor F)-.1 F(ore)-.15 E 15.44(ground blue)-.15 F -1.11(Ve) +52.77 G(rte)1.11 E 2.5(xk)-.15 G(not color)-2.5 E(mark)105.715 360 Q +27.51(erLineKnotSize Int)-.1 F 64.99(5V)53.19 G(erte)-66.1 E 2.5(xk)-.15 +G(not size)-2.5 E(mark)105.715 372 Q 23.62(erLineLineColor F)-.1 F(ore) +-.15 E 15.44(ground green)-.15 F(Line mark)47.78 E(er color)-.1 E(mark) +105.715 384 Q 44.17(erLineStyle Int)-.1 F 28.04(LineSolid Line)53.19 F +(mark)2.5 E(er line style)-.1 E(mark)105.715 396 Q(erLineW)-.1 E 40.13 +(idth Int)-.4 F 64.99(1L)53.19 G(ine mark)-64.99 E(er width)-.1 E(mark) +105.715 408 Q 19.72(erPgonKnotColor F)-.1 F(ore)-.15 E 15.44 +(ground blue)-.15 F -1.11(Ve)52.77 G(rte)1.11 E 2.5(xk)-.15 G(not color) +-2.5 E(mark)105.715 420 Q 25.28(erPgonKnotSize Int)-.1 F 64.99(5V)53.19 +G(erte)-66.1 E 2.5(xk)-.15 G(not size)-2.5 E(mark)105.715 432 Q 21.39 +(erPgonLineColor F)-.1 F(ore)-.15 E 15.44(ground green)-.15 F(Mark)47.78 +E(er border color)-.1 E(mark)105.715 444 Q 21.95(erRectKnotColor F)-.1 F +(ore)-.15 E 15.44(ground blue)-.15 F -1.11(Ve)52.77 G(rte)1.11 E 2.5(xk) +-.15 G(not color)-2.5 E(mark)105.715 456 Q 27.51(erRectKnotSize Int)-.1 +F 64.99(0V)53.19 G(erte)-66.1 E 2.5(xk)-.15 G(not size)-2.5 E(mark) +105.715 468 Q 23.62(erRectLineColor F)-.1 F(ore)-.15 E 15.44 +(ground green)-.15 F(Mark)47.78 E(er border color)-.1 E(mark)105.715 480 +Q(erT)-.1 E -.15(ex)-.7 G 31.13(tBgColor F).15 F(ore)-.15 E 15.44 +(ground slate)-.15 F 31.54(gray T)-.15 F -.15(ex)-.7 G 2.5(tm).15 G(ark) +-2.5 E(er background color)-.1 E(mark)105.715 492 Q(erT)-.1 E -.15(ex) +-.7 G 37.81(tBorder Int).15 F 64.99(2T)53.19 G -.15(ex)-65.69 G 2.5(tm) +.15 G(ark)-2.5 E(er border width)-.1 E(mark)105.715 504 Q(erT)-.1 E -.15 +(ex)-.7 G 42.8(tColor F).15 F(ore)-.15 E 15.44(ground yello)-.15 F 43.02 +(wT)-.25 G -.15(ex)-43.72 G 2.5(tm).15 G(ark)-2.5 E(er te)-.1 E +(xt color)-.15 E(mark)105.715 516 Q(erT)-.1 E -.15(ex)-.7 G(tF).15 E +47.39(ont XF)-.15 F 12.5(ontStruct 6x13)-.15 F -1.25 -.7(Te x)49.99 H +2.5(tm).7 G(ark)-2.5 E(er font)-.1 E(mark)105.715 528 Q(erT)-.1 E -.15 +(ex)-.7 G 24.47(tLineColor F).15 F(ore)-.15 E 15.44(ground green)-.15 F +-1.25 -.7(Te x)47.78 H 2.5(tm).7 G(ark)-2.5 E(er line color)-.1 E(mark) +105.715 540 Q(erT)-.1 E -.15(ex)-.7 G 41.13(tString String).15 F 40.83 +(NULL T)39.85 F -.15(ex)-.7 G 2.5(ts).15 G(tring)-2.5 E(mark)105.715 552 +Q(erT)-.1 E 33.97(ranslations String)-.35 F(def)39.85 E 39.82(ault Mark) +-.1 F(er e)-.1 E -.15(ve)-.25 G(nt-to-actions translations).15 E 67.39 +(maxColors Int)105.715 564 R 52.49(216 Max)53.19 F +(colors in custom colormap)2.5 E 54.06(maxMappings Int)105.715 576 R +57.49(32 Max)53.19 F(image mappings)2.5 E 64.62(maxRasters Int)105.715 +588 R 52.49(512 Max)53.19 F(image rasters)2.5 E 73.52(nearEdge Int) +105.715 600 R(1)53.19 E 5.68(Distance, in pix)353.785 600 R 5.68 +(els, between pointer and)-.15 F(mark)353.785 612 Q 2.674 +(er edge required for translation actions)-.1 F(for be in ef)353.785 624 +Q(fect.)-.25 E(nearV)105.715 636 Q(erte)-1.11 E 70.62(xI)-.15 G 50.69 +(nt 4)-70.62 F .03(Distance, in pix)353.785 636 R .03 +(els between pointer and mark)-.15 F(er)-.1 E -.15(ve)353.785 648 S(rte) +.15 E 8.102(x\()-.15 G(i.e.)-8.102 E F1(knot)8.102 E F0 8.102(\)r)C +5.602(equired for translation)-8.102 F(actions for be in ef)353.785 660 +Q(fect.)-.25 E(raiseW)105.715 672 Q(indo)-.4 E 61.11(wB)-.25 G 28.47 +(oolean F)-61.11 F 46.53(alse Raise)-.15 F(windo)2.5 E 2.5(ww)-.25 G +(hen acti)-2.5 E -.15(ve)-.25 G 65.17(translations String)105.715 684 R +(def)39.85 E 39.82(ault Ev)-.1 F(ent-to-actions translations)-.15 E +(useT)105.715 696 Q 69.97(imers Boolean)-.35 F -.35(Tr)30.97 G 48.96 +(ue Ok).35 F(to use timers)2.5 E -.1(wa)105.715 708 S 64.17 +(rpCursor Boolean).1 F -.15(Fa)30.97 G 46.53(lse Enable).15 F -.1(wa)2.5 +G(rp cursor when acti).1 E -.15(ve)-.25 G(X11IRAF Project)72 768 Q +(16 Dec 1996)137.62 E(4)203.45 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R 88.5 +(width Dimension)105.715 84 R 52.49(640 Height)20.41 F +(of graphics windo)2.5 E(w)-.25 E 84.05(xorFill Boolean)105.715 96 R +-.15(Fa)30.97 G 46.53(lse Fill).15 F(with GXxor)2.5 E 49.6 +(xorFillBgColor Int)105.715 108 R 52.49(255 Xor)53.19 F +(-\214ll background color)-.2 E 61.27(xorFillColor Int)105.715 120 R +64.99(2X)53.19 G(or)-64.99 E(-\214ll color)-.2 E/F1 9/Times-Bold@0 SF +(GTERM WIDGET TRANSLA)72 148.8 Q(TIONS AND A)-.855 E(CTIONS)-.495 E F0 +(The def)108 160.8 Q(ault translations for a Gterm windo)-.1 E 2.5(wa) +-.25 G(re:)-2.5 E(<Btn1Do)262.55 172.8 Q 12.5(wn>: m_create\(\))-.25 F +(<Btn2Do)262.55 184.8 Q 12.5(wn>: crosshair\(on\))-.25 F 12.5 +(<Btn2Motion>: crosshair\(on\))257.29 196.8 R 12.5 +(<Btn2Up>: crosshair\(of)274.52 208.8 R(f\))-.25 E(<EnterW)250.74 220.8 +Q(indo)-.4 E 12.5(w>: enter)-.25 F(-windo)-.2 E(w\(\))-.25 E(<Lea)248.32 +232.8 Q -.15(ve)-.2 G -.4(Wi).15 G(ndo).4 E 12.5(w>: lea)-.25 F -.15(ve) +-.2 G(-windo).15 E(w\(\))-.25 E(<K)268.82 244.8 Q -.15(ey)-.25 G 12.5 +(Press>: graphics-input\(\)).15 F 12.5(<Motion>: track-cursor\(\))276.74 +256.8 R(The a)108 273.6 Q -.25(va)-.2 G +(ilable action procedures for a Gterm windo).25 E 2.5(wa)-.25 G(re:)-2.5 +E/F2 10/Times-Italic@0 SF(ignor)144 290.4 Q(e\(\))-.37 E F0(Ignore an e) +67.6 E -.15(ve)-.25 G(nt.).15 E F2(gr)144 307.2 Q(aphics-input\(\))-.15 +E F0(Handle a graphics input request.)34.6 E F2(cr)144 324 Q +(osshair\(on|of)-.45 E(f\))-.18 E F0(Display a crosshair cursor)32.88 E +(.)-.55 E F2(tr)144 340.8 Q(ac)-.15 E(k-cur)-.2 E(sor\(\))-.1 E F0 -.35 +(Tr)43.8 G(ack crosshair cursor position.).35 E F2(enter)144 357.6 Q +(-window\(\))-.2 E F0(Handle an EnterW)38.54 E(indo)-.4 E 2.5(we)-.25 G +-.15(ve)-2.75 G(nt.).15 E F2(leave-window\(\))144 374.4 Q F0 +(Handle an Lea)37.79 E -.15(ve)-.2 G -.4(Wi).15 G(ndo).4 E 2.5(we)-.25 G +-.15(ve)-2.75 G(nt.).15 E F2 -.37(re)144 391.2 S(set\(\)).37 E F0 +(Do a soft reset of the Gterm widget.)74.27 E F2(m_cr)144 408 Q +(eate\(\))-.37 E F0(Create a ne)56.5 E 2.5(wm)-.25 G(ark)-2.5 E(er)-.1 E +5(.V)-.55 G(alid types include)-6.11 E F2(te)316.18 420 Q 13.26(xt line) +-.2 F 13.06(polyline r)22.21 F(ectangle)-.37 E 13.06(box cir)316.18 432 +R 12.31(cle ellipse)-.37 F(polygon)21.67 E F0 .71(The def)244 444 R .71 +(ault is)-.1 F F2 -.37(re)3.21 G(ctangle).37 E F0 3.21(,i)C 3.21(fn) +-3.21 G 3.21(ot)-3.21 G .71(ype is gi)-3.21 F -.15(ve)-.25 G 3.21(nt).15 +G .71(he def)-3.21 F .71(ault type speci\214ed by)-.1 F(the)244 456 Q F2 +(mark)2.5 E(erT)-.1 E(ype)-.74 E F0(resource will be used.)2.5 E F1 +(GTERM MARKER TRANSLA)72 484.8 Q(TIONS AND A)-.855 E(CTIONS)-.495 E F0 +(The def)108 496.8 Q(ault translations for a mark)-.1 E(er are:)-.1 E +(!Shift <Btn1Motion>:)214.325 520.8 Q(m_rotateResize\(\))15 E 12.5 +(<Btn1Motion>: m_mo)239.605 532.8 R -.15(ve)-.15 G(Resize\(\)).15 E +(!Shift <Btn1Do)219.585 544.8 Q 12.5(wn>: m_raise\(\))-.25 F +(m_markpos\(\))5 E(<Btn1Do)244.865 556.8 Q 12.5(wn>: m_raise\(\))-.25 F +(m_markposAdd\(\))5 E 12.5(<Btn1Up>: m_redra)256.835 568.8 R +(w\(\) m_destro)-.15 E(yNull\(\))-.1 E(<Btn2Do)244.865 580.8 Q 12.5 +(wn>: m_lo)-.25 F(wer\(\))-.25 E(<K)227.815 592.8 Q -.15(ey)-.25 G 12.5 +(>BackSpace: m_deleteDestro).15 F(y\(\))-.1 E(<K)246.145 604.8 Q -.15 +(ey)-.25 G 12.5(>Delete: m_deleteDestro).15 F(y\(\))-.1 E(<K)251.135 +616.8 Q -.15(ey)-.25 G 12.5(Press>: m_input\(\)).15 F 12.5 +(<Motion>: track-cursor\(\))259.055 628.8 R -.35(Tr)108 652.8 S .334 +(anslations af).35 F .333(fect only the currently acti)-.25 F .633 -.15 +(ve m)-.25 H(ark).15 E(er)-.1 E 2.833(,t)-.4 G .333 +(he cursor must be within)-2.833 F F2(nearEdg)2.833 E(e)-.1 E F0(pix) +2.833 E .333(els of a mark)-.15 F(er)-.1 E(edge, or)108 664.8 Q F2 +(nearV)2.5 E(erte)-1.11 E(x)-.2 E F0(pix)2.5 E(els of a mark)-.15 E +(er v)-.1 E(erte)-.15 E 2.5(xt)-.15 G 2.5(ot)-2.5 G(ak)-2.5 E 2.5(ee)-.1 +G -.25(ff)-2.5 G(ect.).25 E(The a)108 688.8 Q -.25(va)-.2 G +(ilable action procedures for a mark).25 E(er are)-.1 E F2(m_cr)144 +705.6 Q(eate\(type\))-.37 E F0(Create a ne)29.84 E 2.5(wm)-.25 G(ark) +-2.5 E(er)-.1 E 5(.V)-.55 G(alid types include)-6.11 E F2(te)311.18 +717.6 Q 13.26(xt line)-.2 F 13.06(polyline r)22.21 F(ectangle)-.37 E F0 +(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(5)203.45 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 10 +/Times-Italic@0 SF 13.06(box cir)311.18 84 R 12.31(cle ellipse)-.37 F +(polygon)21.67 E F0 .322(The def)234 96 R .322(ault is)-.1 F F1 -.37(re) +2.822 G(ctangle).37 E F0 2.822(,i)C 2.822(fn)-2.822 G 2.822(ot)-2.822 G +.322(ype is gi)-2.822 F -.15(ve)-.25 G 2.822(nt).15 G .322(he def)-2.822 +F .322(ault type speci\214ed by the)-.1 F F1(mark)234 108 Q(erT)-.1 E +(ype)-.74 E F0(resource will be used.)2.5 E F1(m_destr)144 124.8 Q +(oy\(\))-.45 E F0(Destro)42.13 E 2.5(yt)-.1 G(he acti)-2.5 E .3 -.15 +(ve m)-.25 H(ark).15 E(er)-.1 E(.)-.55 E F1(m_destr)144 141.6 Q +(oyNull\(\))-.45 E F0(Destro)24.9 E 2.5(yt)-.1 G(he acti)-2.5 E .3 -.15 +(ve m)-.25 H(ark).15 E(er if it is null sized.)-.1 E F1(m_set\(attrib) +144 158.4 Q(ute)-.2 E 2.5(,v)-.1 G(alue)-2.5 E 2.5(,.)-.1 G(...\))-2.5 E +F0(Set a mark)234 170.4 Q(er attrib)-.1 E 2.5(ute. V)-.2 F(alid attrib) +-1.11 E(utes include)-.2 E F1 13.47(activated autoRedr)268.8 194.4 R +22.66(aw \214ll)-.15 F(\214llBgColor)53.74 E 16.23(\214llColor \214llP) +268.8 206.4 R 31.64(attern \214llStyle)-.8 F(font)34.3 E 25.13 +(height highlightColor)268.8 218.4 R(ima)14.44 E -.1(ge)-.1 G -.86 -.92 +(Te x).1 H 23.96(tk).92 G(notColor)-23.96 E 16.8(knotSize lineColor) +268.8 230.4 R 27.36(lineStyle lineW)35.56 F(idth)-.55 E -.45(ro)268.8 +242.4 S 16.69(tangle sensitive).45 F(te)39.46 E 13.11(xtBgColor te)-.2 F +(xtBor)-.2 E(der)-.37 E(te)268.8 254.4 Q 12.55(xtColor tr)-.2 F 23.76 +(anslations type)-.15 F(visible)47.64 E 27.9(width x)268.8 266.4 R(y) +69.46 E(m_r)144 283.2 Q(aise\(\))-.15 E F0(Raise the acti)51.27 E .3 +-.15(ve m)-.25 H(ark).15 E(er to the top of the display list.)-.1 E F1 +(m_lower\(\))144 300 Q F0(Lo)48.34 E(wer the acti)-.25 E .3 -.15(ve m) +-.25 H(ark).15 E(er to the bottom of the display list.)-.1 E F1 +(m_notify\(e)144 316.8 Q(vent, e)-.15 E(vent, ....\))-.15 E F0 1.545 +(Notify an)234 328.8 R 4.045(yc)-.15 G 1.545(lients that ha)-4.045 F +1.845 -.15(ve r)-.2 H -.15(eg).15 G 1.544 +(istered callbacks for the speci\214ed type of).15 F -2.15 -.25(ev e)234 +340.8 T 2.5(nts. Recognized).25 F -2.15 -.25(ev e)2.5 H(nts include).25 +E F1 19.16(notify mo)313.8 352.8 R 12.5(veResize modify)-.1 F -.37(re) +313.8 364.8 S(dr).37 E 13.57(aw destr)-.15 F 30.06(oy input)-.45 F 12.5 +(focusIn focusOut)313.8 376.8 R(constr)25.44 E(aint)-.15 E(m_input\(\)) +144 393.6 Q F0 .097(Notify an)50.56 F 2.597(yc)-.15 G .097 +(lients that ha)-2.597 F .398 -.15(ve r)-.2 H -.15(eg).15 G .098 +(istered a input callback that a input e).15 F -.15(ve)-.25 G .098 +(nt has).15 F(occurred.)234 405.6 Q F1(m_markpos\(\))144 422.4 Q F0 +(Mark the current position of the mark)36.68 E(er)-.1 E 2.5(,e)-.4 G +(.g., so that it can later be erased.)-2.5 E F1(m_markposAdd\(\))144 +439.2 Q F0(Ex)20.57 E .464(ecute either the markpos or add action, depe\ +nding upon the pointer loca-)-.15 F 4.141(tion. If)234 451.2 R 1.641 +(the pointer is o)4.141 F -.15(ve)-.15 G 4.141(ra).15 G 4.141(na)-4.141 +G(cti)-4.141 E 1.941 -.15(ve m)-.25 H(ark).15 E 1.642 +(er at a location where the add)-.1 F 3.254(action can be e)234 463.2 R +-.15(xe)-.15 G 3.254 +(cuted this is done, otherwise the markpos action is).15 F -.15(exe)234 +475.2 S(cuted.).15 E F1(m_r)144 492 Q(edr)-.37 E(aw\(\))-.15 E F0(Redra) +42.75 E 2.5(wt)-.15 G(he acti)-2.5 E .3 -.15(ve m)-.25 H(ark).15 E(er) +-.1 E(.)-.55 E F1(m_addPt\(\))144 508.8 Q F0(Add a point \(i.e. v)47.23 +E(erte)-.15 E 2.5(xk)-.15 G(not\).)-2.5 E F1 -.8(Po)2.5 G(lyline).8 E F0 +(and)2.5 E F1(polygon)2.5 E F0(mark)2.5 E(ers only)-.1 E(.)-.65 E F1 +(m_deletePt\(\))144 525.6 Q F0(Delete a point \(i.e. v)38.35 E(erte)-.15 +E 2.5(xk)-.15 G(not\).)-2.5 E F1(m_mo)144 542.4 Q(vePt\(\))-.1 E F0(Mo) +41.23 E .3 -.15(ve a p)-.15 H(oint \(i.e. v).15 E(erte)-.15 E 2.5(xk) +-.15 G(not\).)-2.5 E F1 -.8(Po)2.5 G(lyline).8 E F0(and)2.5 E F1 +(polygon)2.5 E F0(mark)2.5 E(ers only)-.1 E(.)-.65 E F1(m_deleteDestr) +144 559.2 Q(oy\(\))-.45 E F0(Delete a point or destro)16.03 E 2.5(yam) +-.1 G(ark)-2.5 E(er)-.1 E 2.5(,d)-.4 G +(epending upon the pointer position.)-2.5 E F1(m_mo)144 576 Q(ve\(\))-.1 +E F0(Mo)50.12 E .3 -.15(ve a m)-.15 H(ark).15 E(er)-.1 E(.)-.55 E F1 +(m_r)144 592.8 Q(esize\(\))-.37 E F0(Resize a mark)48.16 E(er)-.1 E(.) +-.55 E F1(m_mo)144 609.6 Q(veResize\(\))-.1 E F0(Mo)24.57 E 2.025 -.15 +(ve a p)-.15 H 1.725(oint or mark).15 F(er)-.1 E 4.225(,o)-.4 G 4.225 +(rr)-4.225 G 1.725(esize a mark)-4.225 F(er)-.1 E 4.225(,d)-.4 G 1.725 +(epending upon the pointer)-4.225 F(position.)234 621.6 Q F1(m_r)144 +638.4 Q(otate\(\))-.45 E F0(Rotate a mark)47.68 E(er)-.1 E(.)-.55 E F1 +(m_r)144 655.2 Q(otateResize\(\))-.45 E F0 1.547 +(Rotate or resize a mark)22.13 F(er)-.1 E 6.547(.A)-.55 G(mark)-2.5 E +1.546(er is rotated if near a v)-.1 F(erte)-.15 E 4.046(xk)-.15 G(no) +-4.046 E 2.846 -.65(w, o)-.25 H(r).65 E(resized if near an edge.)234 +667.2 Q/F2 9/Times-Bold@0 SF(GTERM I/O ESCAPE SEQ)72 696 Q(UENCES)-.09 E +F0 1.075(XGterm uses escape sequences to pro)108 708 R 1.075 +(vide graphics emulation.)-.15 F 1.075(This protocol is an e)6.075 F +1.076(xtension of the T)-.15 F(ek-)-.7 E .536 +(tronix 4012 graphics protocol.)108 720 R .536(The basic e)5.536 F .535 +(xtensions are patterned after the Retrographics VT640 graphics)-.15 F +(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(6)203.45 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R .742(ter\ +minal, using GS \(octal \\035, aka Ctrl-]\) and CAN \(octal \\030, aka \ +Ctrl-x\) to switch between vt100 and)108 84 R 1.079(graphics modes.)108 +96 R 1.079(Additional e)6.079 F 1.079 +(xtensions are de\214ned to support adv)-.15 F 1.078 +(anced features such as color)-.25 F 3.578(,a)-.4 G 1.078(rea \214lls,) +-3.578 F .606(graphics erasure, setting the cursor location under progr\ +am control, interacti)108 108 R .906 -.15(ve d)-.25 H .606 +(ialog via the "status line",).15 F(and so on.)108 120 Q 1.48 +(While these escape sequences can be used directly)108 144 R 3.98(,t) +-.65 G 1.48(he best programmatic interf)-3.98 F 1.48 +(ace is to use the OBM)-.1 F(\()108 156 Q/F1 10/Times-Italic@0 SF 1.19 +(Object Mana)B -.1(ge)-.1 G(r).1 E F0 3.69(\)l)C 1.191 +(ibrary supplied with the XGterm source as part of the X11IRAF package.) +-3.69 F(An)6.191 E 3.691(yT)-.15 G(ek-)-4.391 E .926 +(tronix-compatible graphics library will suf)108 168 R .926 +(\214ce for producing v)-.25 F .926 +(ector graphics, the added escape sequences)-.15 F +(used by the Gterm widget are required to mak)108 180 Q 2.5(eu)-.1 G +(se of imaging, area \214lls, the status line, etc.)-2.5 E .243 +(All escape sequences be)108 204 R .243(gin with an)-.15 F/F2 10 +/Times-Bold@0 SF(ESC)2.743 E F0 .243(character \(octal \\033\), follo) +2.743 F .243(wed by up to three characters de\214ning)-.25 F .636 +(the action to be tak)108 216 R 3.136(en. All)-.1 F .636 +(strings in capital letters refer to the ASCII code \(e.g.)3.136 F F1 +(LF)3.136 E F0 .636(is the ASCII linefeed)3.136 F .319(code\), a three \ +digit number preceeded by a '\264 refers to an octal code \(e.g.)108 228 +R 5("1)5.319 G .319(2" is octal 12\) , all others are)-5 F +(characters in the escape code \(e.g.)108 240 Q +("/bc" are the three characters '/', 'b', and 'c'\).)5 E F2(ESCAPE SEQ) +87 268.8 Q(UENCES)-.1 E(US)144 280.8 Q(CR)144 291.6 Q F0 1.789 +(Switch to alpha mode.)60.56 F 1.788(Characters are dra)6.789 F 1.788 +(wn in the graphics windo)-.15 F 4.288(wa)-.25 G 4.288(tt)-4.288 G(he) +-4.288 E .694 +("current" position \(normally set beforehand with a GS/US v)219 303.6 R +.694(ector mo)-.15 F -.15(ve)-.15 G .694(\), using).15 F 2.016 +(the alpha mode font. Receipt of an)219 315.6 R 4.516(yc)-.15 G 2.016 +(ontrol code causes alpha mode to be)-4.516 F -.15(ex)219 327.6 S(ited.) +.15 E F2(GS)144 356.4 Q F0(Switch to v)61.66 E(ector polyline mode.)-.15 +E F2(FS)144 367.2 Q F0(Switch to v)63.33 E(ector polypoint mode.)-.15 E +F2(RS)144 378 Q F0(Switch to v)62.22 E(ector mode, v)-.15 E +(ertices are joined as a polygon.)-.15 E -.4(Wi)219 402 S 1.185 +(th all three codes, v).4 F 1.185 +(ertices and points are accumulated in a b)-.15 F(uf)-.2 E 1.186 +(fer and dis-)-.25 F .011(played when the b)219 414 R(uf)-.2 E .011 +(fer \214lls or when v)-.25 F .01 +(ector mode is terminated by receipt of an)-.15 F(y)-.15 E .188 +(control code.)219 426 R 2.688(Aw)5.188 G .188 +(orkstation open will be done if it hasn')-2.788 F 2.689(ta)-.18 G .189 +(lready been opened,)-2.689 F .271 +(no-op sequences GS-CAN are \214ltered out, since the)219 438 R 2.771 +(yw)-.15 G .271(ould only cause a point-)-2.871 F .109 +(less switch to the graphics frame and back without dra)219 450 R 2.609 +(wing. The)-.15 F .11(open w)2.61 F(orksta-)-.1 E .034 +(tion sequence is GS,US, or by the)219 462 R F1(xterm)2.534 E F0 .034 +(graphics start escape sequence "[?38h".)2.534 F F2(EM)144 490.8 Q F0 +1.249(Enter message mode.)58.89 F 1.249(In message mode input te)6.249 F +1.249(xt is accumulated in a b)-.15 F(uf)-.2 E(fer)-.25 E .49(and e)219 +502.8 R -.15(ve)-.25 G .489(ntually passed to the object manager).15 F +2.989(,w)-.4 G .489(hich deli)-2.989 F -.15(ve)-.25 G .489 +(rs the message to the).15 F 2.227(referenced object.)219 514.8 R 2.227 +(Messages are used to do)7.227 F 2.227(wnload the user interf)-.25 F +2.228(ace to be)-.1 F -.15(exe)219 526.8 S .52 +(cuted by the object manager).15 F 3.02(,a)-.4 G .52(nd during e)-3.02 F +-.15(xe)-.15 G .52(cution messages are used to set).15 F .723(the v)219 +538.8 R .723(alues of user interf)-.25 F .723(ace parameters to allo)-.1 +F 3.223(wt)-.25 G .724(he UI to track the state of the)-3.223 F +(client application.)219 550.8 Q F2(CAN)144 579.6 Q F0(Close w)53.34 E +(orkstation and enter command mode.)-.1 E F2(BEL)144 596.4 Q F0 +(Ring the screen bell.)54.99 E F2(ENQ)144 625.2 Q F0 .99 +(Return terminal status.)53.33 F .99(Returned v)5.99 F .99 +(alues include the terminal mode, and alpha)-.25 F +(cursor x and y position.)219 637.2 Q F2(SUB)144 654 Q F0 +(Initiate a cursor read, v)55.55 E(alues are returned in windo)-.25 E +2.5(wc)-.25 G(oordinates.)-2.5 E F2(/SUB)144 670.8 Q F0(Return windo) +52.77 E 2.5(wc)-.25 G(ursor position in raster coordinates.)-2.5 E F2 +(FF)144 687.6 Q F0(Clear the screen.)62.78 E F2(/f)144 704.4 Q F0 +(Set current cursor position.)68.89 E(X11IRAF Project)72 768 Q +(16 Dec 1996)137.62 E(7)203.45 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 10 +/Times-Bold@0 SF(0)144 84 Q F0 +(Set character size 0. \(Currently ignored\).)70 E F1(1)144 94.8 Q F0 +(Set character size 1. \(Currently ignored\).)70 E F1(2)144 105.6 Q F0 +(Set character size 2. \(Currently ignored\).)70 E F1(3)144 116.4 Q F0 +(Set character size 3. \(Currently ignored\).)70 E F1(/0d)144 133.2 Q F0 +(Set color inde)61.66 E(x.)-.15 E F1(/1d)144 144 Q F0 +(Clear graphics screen.)61.66 E F1(/2d)144 154.8 Q F0(In)61.66 E -.15 +(ve)-.4 G(rt graphics screen).15 E F1(`)144 171.6 Q F0 +(Select line style 0. \(Solid\))71.67 E F1(a)144 182.4 Q F0 +(Select line style 1. \(Dashed\))70 E F1(b)144 193.2 Q F0 +(Select line style 2. \(Dotted\))69.44 E F1(c)144 204 Q F0 +(Select line style 3. \(DashDot\))70.56 E F1(d)144 214.8 Q F0 +(Select line style 4. \(Dash3Dot\))69.44 E F1(/0w)144 231.6 Q F0 +(Select line width 0.)60 E F1(/1w)144 242.4 Q F0(Select line width 1.)60 +E F1(/2w)144 253.2 Q F0(Select line width 2.)60 E F1(/nw)144 264 Q F0 +(Select line width 3.)59.44 E F1(/0c)144 280.8 Q F0 +(Select line color 0.)62.78 E F1(/1c)144 291.6 Q F0 +(Select line color 1.)62.78 E F1(/2c)144 302.4 Q F0 +(Select line color 2.)62.78 E F1(/3c)144 313.2 Q F0 +(Select line color 3.)62.78 E F1(/4c)144 324 Q F0(Select line color 4.) +62.78 E F1(/5c)144 334.8 Q F0(Select line color 5.)62.78 E F1(/6c)144 +345.6 Q F0(Select line color 6.)62.78 E F1(/7c)144 356.4 Q F0 +(Select line color 7.)62.78 E F1(/8c)144 367.2 Q F0 +(Select line color 8.)62.78 E F1(/9c)144 378 Q F0(Select line color 9.) +62.78 E F1(IMA)87 406.8 Q(GING ESCAPE SEQ)-.55 E(UENCES)-.1 E F0 +(These are encoded as follo)108 418.8 Q(ws:)-.25 E F1(ESC)198.99 442.8 Q +F0(<code> [)2.5 E/F2 10/Times-Italic@0 SF 2.5(P;P)2.5 G F0 2.5(;.)C +(.. ] <)-2.5 E F2(data)A F0(>)A(where)108 466.8 Q F2(code)2.5 E F0 +(is a character sequence and)2.5 E F2(P)2.5 E F0 +(is an ASCII encoded parameter described belo)2.5 E -.65(w.)-.25 G F1 +(/nc)144 483.6 Q F0(Select line color)62.22 E 5(.P)-.55 G +(arameter is the color number in the range 0-9.)-5.15 E F1(sr)144 500.4 +Q(e)-.18 E F2(Reset)62.41 E F0 5(.P)C(arameters are "reset-str".)-5.15 E +F1(ssz)144 517.2 Q F2(Resize)62.78 E F0 2.5(.P)C +(arameters are "resize-str".)-2.65 E F1(rir)144 534 Q F2(Initialize r) +63.34 E(aster)-.15 E F0(.)A F1 -.18(rc)144 550.8 S(r).18 E F2(Cr)61.86 E +.9(eate a r)-.37 F(aster)-.15 E F0 5.9(.P)C .9 +(arameters are raster number)-6.05 F 3.4(,t)-.4 G .9 +(ype, width, height, and depth.)-3.4 F -.8(Ty)219 562.8 S .198 +(pe is 1 for a normal \(client\) raster).8 F 2.698(,2f)-.4 G .198 +(or cached in serv)-2.698 F .197(er memory)-.15 F 2.697(,o)-.65 G 2.697 +(r0i)-2.697 G 2.697(fy)-2.697 G(ou)-2.697 E(don')219 574.8 Q 2.5(tc)-.18 +G 2.5(are. Depth)-2.5 F(may be 1, 8, 16, or 32.)2.5 E F1(rde)144 591.6 Q +F2(Destr)60.56 E(oy a r)-.45 E(aster)-.15 E F0 5(.P)C +(arameter is raster number)-5.15 E(.)-.55 E F1 -.18(rq)144 608.4 S(r).18 +E F2 .149(Query a r)60.74 F(aster)-.15 E F0 5.149(.P)C .149 +(arameter is raster number)-5.299 F 5.149(.O)-.55 G .149 +(utput parameters are status, type,)-5.149 F(width, height, and depth e\ +ncoded in the string ""\\033[5;%d;%d;%d;%d;%d]".)219 620.4 Q F1(rsr)144 +637.2 Q F2(Select a r)62.23 E(aster)-.15 E F0 5(.P)C +(arameter is raster number)-5.15 E(.)-.55 E F1(rwr)144 654 Q F2 .635 +(Write pixels to a r)58.9 F .634(ectangular r)-.37 F -.4(eg)-.37 G .634 +(ion of a r).4 F(aster)-.15 E F0 5.634(.P)C .634 +(arameters are raster number)-5.784 F(,)-.4 E 1.155 +(encoding type \(not used\), x1, y1, nx, n)219 666 R 2.455 -.65(y, a) +-.15 H 1.156(nd depth follo).65 F 1.156(wed by \(nx*n)-.25 F 1.156 +(y\) data)-.15 F(pix)219 678 Q(els.)-.15 E F1(rrd)144 694.8 Q F2 2.223 +(Read fr)60.56 F 2.223(om a r)-.45 F 2.223(ectangular r)-.37 F -.4(eg) +-.37 G 2.223(ion of a r).4 F(aster)-.15 E F0 7.223(.P)C 2.222 +(arameters are raster number)-7.373 F(,)-.4 E 1.155 +(encoding type \(not used\), x1, y1, nx, n)219 706.8 R 2.455 -.65(y, a) +-.15 H 1.156(nd depth follo).65 F 1.156(wed by \(nx*n)-.25 F 1.156 +(y\) data)-.15 F(pix)219 718.8 Q(els.)-.15 E(X11IRAF Project)72 768 Q +(16 Dec 1996)137.62 E(8)203.45 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 10 +/Times-Bold@0 SF(rr)144 84 Q(p)-.1 E/F2 10/Times-Italic@0 SF(Refr)60.66 +E 2.298(esh r)-.37 F 2.298(aster pixels)-.15 F F0 7.298(.P)C 2.298 +(arameters are raster number)-7.448 F 4.798(,c)-.4 G 2.298 +(oordinate type \(0 for)-4.798 F(pix)219 96 Q +(el, 1 for NDC\), x1, y1, nx, n)-.15 E -.65(y.)-.15 G F1(rsp)144 112.8 Q +F2 .048(Set all the r)61.11 F .048(aster pixels in a r)-.15 F -.4(eg) +-.37 G .048(ion to a single color).4 F F0 5.048(.P)C .048 +(arameters are raster num-)-5.198 F(ber)219 124.8 Q 3.484(,c)-.4 G .984 +(oordinate type \(0 for pix)-3.484 F .984 +(el, 1 for NDC\), x1, y1, nx, n)-.15 F 2.284 -.65(y, c)-.15 H(olor).65 E +3.484(,a)-.4 G .984(nd raster)-3.484 F 3.125(operand. If)219 136.8 R +(nx=n)3.125 E .625(y=0 the entire raster will be written.)-.15 F .626 +(Raster operands include)5.626 F(transient \(octal 020\), refresh_all \ +\(octal 040\), or refresh_none \(octal 100\).)219 148.8 Q F1 -.18(rc)144 +165.6 S(o).18 E F2 .142(Copy a r)61.3 F -.4(eg)-.37 G .142 +(ion of the sour).4 F .142(ce r)-.37 F .141(aster to a r)-.15 F -.4(eg) +-.37 G .141(ion of the destination r).4 F(aster)-.15 E F0 7.641(.P)C +(aram-)-7.791 E 2.031(eters are raster operand, source raster number)219 +177.6 R 4.531(,s)-.4 G 2.031(ource type, source x coord,)-4.531 F .424 +(source y coord, source width, source height, destination raster number) +219 189.6 R 2.924(,d)-.4 G(estina-)-2.924 E 1.157(tion type, destinatio\ +n x coord, destination y coord, destination width, destina-)219 201.6 R +.079(tion height, If the input and output re)219 213.6 R .078 +(gions are not the same size the subimage is)-.15 F .247 +(automatically scaled to \214t the destination re)219 225.6 R 2.747 +(gion. If)-.15 F .248(the destination e)2.747 F .248(xtent DNX)-.15 F +.035(or DNY is ne)219 237.6 R -.05(ga)-.15 G(ti).05 E -.15(ve)-.25 G +2.535(,t).15 G .035(he image is \215ipped in that axis.)-2.535 F .034 +(The type of spatial scaling)5.034 F 1.47 +(performed is determined by the scale f)219 249.6 R 1.47 +(actors \(zoom, dezoom, or no scaling\).)-.1 F .481(The rasterop ar)219 +261.6 R .481(gument is used to e)-.18 F -.15(xe)-.15 G .481 +(rcise \214ne control o).15 F -.15(ve)-.15 G 2.981(rh).15 G .98 -.25 +(ow t)-2.981 H .48(he mapping is).25 F .168(performed, e.g. to force a \ +refresh, implement a transient mapping, or in the case)219 273.6 R 1.926 +(of a dezoom \(man)219 285.6 R 1.926 +(y-to-one\) mapping, select the antialiasing technique to be)-.15 F +(used.)219 297.6 Q F1(rwc)144 314.4 Q F2 .247(Write a colormap)58.9 F F0 +5.247(.P)C .247(arameters are colormap number)-5.397 F 2.747<2c8c>-.4 G +.248(rst color and the number)-2.747 F(of colors follo)219 326.4 Q +(wed by NC colors triples in the data.)-.25 E F1(rr)144 343.2 Q(c)-.18 E +F2 .708(Return the color assignments for a r)61.86 F -.4(eg)-.37 G .707 +(ion of the named colormap).4 F F0 5.707(.P)C(arameters)-5.857 E .387 +(are colormap number)219 355.2 R 2.887<2c8c>-.4 G .388 +(rst color and the number of colors follo)-2.887 F .388(wed by NC col-) +-.25 F(ors triples in the data.)219 367.2 Q F1(rlc)144 384 Q F2 .803 +(Load a colormap into the display)63.34 F F0 3.303(,o)C .802 +(ptionally scaling the colormap via a linear)-3.303 F .826 +(transformation in the process.)219 396 R -.15(Pa)5.826 G .826 +(rameters are the colormap number).15 F 3.326(,t)-.4 G .826(he of)-3.326 +F(fset)-.25 E -.25(va)219 408 S .232 +(lue, and the cursor x and Y coordinates in NDC units.).25 F .232 +(The colormap is unaf-)5.232 F 1.211(fected if of)219 420 R 1.212 +(fset=0.5, scale=1.0.)-.25 F 3.712(An)6.212 G -2.25 -.15(eg a)-3.712 H +(ti).15 E 1.512 -.15(ve s)-.25 H 1.212(cale in).15 F -.15(ve)-.4 G 1.212 +(rts the image.).15 F 1.212(If map=0)6.212 F +(the linear transformation is applied directly to the display colormap.) +219 432 Q F1(rfc)144 448.8 Q F2 -1.77 -.55(Fr e)62.79 H 2.5(eac).55 G +(olormap)-2.5 E F0 5(.P)C(arameter is the colormap number)-5.15 E(.)-.55 +E F1(rw)144 465.6 Q(o)-.1 E F2 .927(Write the IOmap)58.44 F F0 3.427(.P) +C .927(arameters are the \214rst color and the number of colors, fol-) +-3.577 F(lo)219 477.6 Q 1.241(wed by NC color triples in the data.)-.25 +F 1.242(An iomap is an optional lookup table)6.241 F 2.215(used to isol\ +ate the client application from the color model used within the)219 +489.6 R .646(Gterm widget.)219 501.6 R 2.246 -.8(To s)5.646 H .646 +(implify color allocation the Gterm widget de\214nes a logical).8 F +1.185(color space where color 0 is the background, 1 the fore)219 513.6 +R 1.184(ground, 2-N are stati-)-.15 F .218 +(cally allocated standard colors, and colors N+1 and abo)219 525.6 R +.518 -.15(ve a)-.15 H .219(re dynamically allo-).15 F 1.567 +(cated by the graphics application.)219 537.6 R 1.566 +(Less-demanding applications use only the)6.567 F .022 +(statically allocated, shared colors.)219 549.6 R .022 +(The widget internally maps these logical col-)5.022 F .54(ors to whate) +219 561.6 R -.15(ve)-.25 G 3.039(rt).15 G .539(he windo)-3.039 F 3.039 +(ws)-.25 G .539(ystem requires, b)-3.039 F .539(ut pro)-.2 F .539 +(viding a well-de\214ned logi-)-.15 F 1.812(cal color space isolates th\ +e client from the details of color allocation in the)219 573.6 R +(underlying windo)219 585.6 Q 2.5(ws)-.25 G(ystem.)-2.5 E 1.702(An ioma\ +p can be used to de\214ne a mapping between the color model of the)219 +609.6 R 1.153(client application and the Gterm color model \(when we sa\ +y color model here)219 621.6 R .235 +(we mean color allocation schemes for 8 bit pseudocolor\).)219 633.6 R +.235(By def)5.235 F .235(ault the iomap)-.1 F .375(is one-to-one.)219 +645.6 R .375(The use of an iomap frees the client from ha)5.375 F .375 +(ving to w)-.2 F .375(orry about)-.1 F .976(color inde)219 657.6 R 3.476 +(xt)-.15 G .976(ranslations, and allo)-3.476 F .976 +(ws color tables to be combined in the widget)-.25 F .412 +(for greater ef)219 669.6 R(\214cienc)-.25 E 2.912(yw)-.15 G .413 +(hen color tables are serially applied.)-2.912 F .413(The iomap applies) +5.413 F 1.073(to all color indices or pix)219 681.6 R 1.072(el v)-.15 F +1.072(alues passed in i/o operations between the client)-.25 F +(and the Gterm widget.)219 693.6 Q F1(rr)144 710.4 Q(o)-.18 E F2 .034 +(Read the IOmap)61.3 F F0 5.034(.R)C .034(eturn v)-5.034 F .034 +(alues are the \214rst color and the number of colors, fol-)-.25 F(lo) +219 722.4 Q(wed by NC color triples in the data.)-.25 E(X11IRAF Project) +72 768 Q(16 Dec 1996)137.62 E(9)203.45 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 10 +/Times-Bold@0 SF(rim)144 84 Q/F2 10/Times-Italic@0 SF +(Delete all mappings)59.45 E F0(and initialize the mapping subsystem.) +2.5 E F1(rsm)144 100.8 Q F2 1.472(De\214ne a ne)58.34 F 3.972(wm)-.15 G +1.472(apping function)-3.972 F F0 3.972(,o)C 3.972(rm)-3.972 G 1.471 +(odify an old one.)-3.972 F 1.471(If a ne)6.471 F 3.971(wm)-.25 G 1.471 +(apping is)-3.971 F 1.115 +(de\214ned it is merely enabled, and no refreshing of the screen tak)219 +112.8 R 1.116(es place until)-.1 F .37 +(either some mapped data is written to or the mapping is e)219 124.8 R +.37(xplicitly refreshed.)-.15 F(If)5.37 E 1.057(an e)219 136.8 R 1.057 +(xisting mapping is modi\214ed the old and ne)-.15 F 3.558(wm)-.25 G +1.058(appings are e)-3.558 F 1.058(xamined and)-.15 F .921(only those p\ +ortions of the destination rect for which the mapping changed are)219 +148.8 R 2.691(updated. This)219 160.8 R .192 +(permits minor changes to a mapping \(e.g. mo)2.691 F .192 +(ving an edge\) with-)-.15 F 1.769(out ha)219 172.8 R 1.769 +(ving to redra)-.2 F 4.268(wt)-.15 G 1.768(he entire re)-4.268 F 4.268 +(gion. Re)-.15 F 1.768(gions of the destination dra)-.15 F -.1(wa)-.15 G +(ble).1 E 1.82(which were pre)219 184.8 R 1.82(viously co)-.25 F -.15 +(ve)-.15 G 1.82(red by the mapping b).15 F 1.82(ut which were e)-.2 F +1.82(xposed by)-.15 F(modifying the mapping are redra)219 196.8 Q(wn.) +-.15 E F1 -.1(rg)144 213.6 S(m).1 E F2 .73(Return the e)57.33 F .729 +(xternal par)-.2 F(ameter)-.15 E 3.229(so)-.1 G 3.229(fam)-3.229 G +(apping)-3.229 E F0 5.729(.P)C .729(arameter is the mapping num-)-5.879 +F(ber)219 225.6 Q 6.444(,v)-.4 G 3.944 +(alues returned \(in the string "\\033[6;%d;%d %d;%d;%d;%d;%d;%d)-6.694 +F 1.213(%d;%d;%d;%d;%d;%d]"\) are the mapping number)219 237.6 R 3.713 +(,r)-.4 G 1.213(asterop, source mapping,)-3.713 F(type, x, y)219 249.6 Q +2.5(,w)-.65 G(idth, height, and destination mapping, type, x, y)-2.5 E +2.5(,w)-.65 G(idth and height.)-2.5 E F1 -.18(re)144 266.4 S(m).18 E F2 +.043(Enable a mapping)57.97 F F0 2.543(.P)C .043 +(arameters are the mapping number and an inte)-2.693 F .044 +(ger \215ag indi-)-.15 F(cating whether to refresh the mapping.)219 +278.4 Q F1(rdm)144 295.2 Q F2 1.329(Disable a mapping)56.67 F F0 3.828 +(.D)C 1.328(isabling a mapping does not af)-3.828 F 1.328 +(fect the mapping de\214ni-)-.25 F .149 +(tion, hence a disabled mapping may later be reenabled. P)219 307.2 R +.15(arameters are the map-)-.15 F(ping number and an inte)219 319.2 Q +(ger \215ag indicating whether to erase the mapping.)-.15 E F1(rrm)144 +336 Q F2(Refr)57.79 E(esh a mapping)-.37 E F0 2.5(.P)C +(arameter is the mapping number)-2.65 E(.)-.55 E F1(rfm)144 352.8 Q F2 +-1.77 -.55(Fr e)58.9 H 2.5(eam).55 G(apping)-2.5 E F0 2.5(.P)C +(arameter is the mapping number)-2.65 E(.)-.55 E/F3 9/Times-Bold@0 SF +(MORE ON IMA)72 381.6 Q(GING)-.495 E F0 .452 +(The imaging model of the Gterm widget de\214nes the follo)108 393.6 R +.452(wing k)-.25 F .752 -.15(ey o)-.1 H .452(bject or data types:).15 F +F2 -.15(ra)2.951 G(ster).15 E(s)-.1 E F0(,)A F2(mappings)2.951 E F0(,)A +(and)108 405.6 Q F2(color)2.5 E(s)-.1 E F0(.)A F1(raster)108 422.4 Q F0 +2.749(Ar)24.46 G .249(aster is a MxN array of pix)-2.749 F 2.749 +(els. At)-.15 F .249(present pix)2.749 F .249(els are 8 bits deep b)-.15 +F .249(ut hooks are b)-.2 F .249(uilt into the)-.2 F .766(widget to e) +158 434.4 R .766(xpand this in the future.)-.15 F(Pix)5.765 E .765(el v) +-.15 F .765(alues are indices into the Gterm virtual colormap,)-.25 F +.82(with v)158 446.4 R .82(alues starting at zero.)-.25 F 3.32(Ar)5.82 G +.821(aster may be an)-3.32 F 3.321(ys)-.15 G 3.321(ize. A)-3.321 F .821 +(raster is merely a tw)3.321 F(o-dimensional)-.1 E 1.232 +(array in the graphics serv)158 458.4 R 1.232 +(er; it is not displayed unless mapped.)-.15 F 1.232(An e)6.232 F 1.232 +(xception is raster zero,)-.15 F .577(which is the graphics windo)158 +470.4 R 4.378 -.65(w. R)-.25 H .578(asters are referred to by number).65 +F 3.078(,s)-.4 G .578(tarting with zero.)-3.078 F(Initially)5.578 E .032 +(only raster zero e)158 482.4 R .032(xists; ne)-.15 F 2.532(wr)-.25 G +.032(asters are created with the create raster escape code)-2.532 F F1 +-.18(rc)2.532 G(r).18 E F0 5.031(.S)C .031(pace for)-5.031 F .329 +(rasters may be allocated either in the graphics serv)158 494.4 R(er) +-.15 E 2.829(,o)-.4 G 2.829(ri)-2.829 G 2.83(nt)-2.829 G .33(he X serv) +-2.83 F(er)-.15 E 5.33(.T)-.55 G .33(his has implications)-5.33 F .03 +(on performance b)158 506.4 R .03 +(ut is otherwise transparent to the client.)-.2 F .029(By def)5.029 F +.029(ault rasters are allocated in the)-.1 F(graphics serv)158 518.4 Q +(er)-.15 E 2.5(,i)-.4 G(.e., in the X client.)-2.5 E F1(mapping)108 +535.2 Q F0 2.737(Am)12.21 G .238(apping de\214nes a projection of a rec\ +tangle of the source raster onto a rectangle of the desti-)-2.737 F +2.348(nation raster)158 547.2 R 7.348(.M)-.55 G 2.348 +(appings may be either enabled \(acti)-7.348 F -.15(ve)-.25 G 4.848(\)o) +.15 G 4.848(rd)-4.848 G 4.847(isabled. When)-4.848 F 4.847(am)4.847 G +2.347(apping is)-4.847 F .148(enabled, an)158 559.2 R 2.648(yc)-.15 G +.149(hange to a pix)-2.648 F .149 +(el in the source rect will cause the corresponding pix)-.15 F .149 +(els in the des-)-.15 F .267(tination rect to be updated.)158 571.2 R +.267(Mappings are referred to by number starting with one.)5.267 F .266 +(Initially no)5.266 F .151(mappings are de\214ned.)158 583.2 R .152(If \ +the size of the input and output rect is not the same the input rect wi\ +ll)5.151 F .064(be scaled by pix)158 595.2 R .063 +(el replication or subsampling to \214ll the output rect.)-.15 F .063 +(If the ar)5.063 F .063(gument D)-.18 F 2.563(W\()-.3 G(desti-)-2.563 E +.769(nation width\) or DH \(destination height\) of the destination rec\ +t is ne)158 607.2 R -.05(ga)-.15 G(ti).05 E -.15(ve)-.25 G 3.269(,t).15 +G .769(he image will be)-3.269 F .078(\215ipped around the correspondin\ +g axis when copied to the destination; the re)158 619.2 R .077 +(gion of the destina-)-.15 F .648(tion dra)158 631.2 R .648 +(wn into is the same in either case.)-.15 F .648 +(Multiple mappings may reference the same source)5.648 F .992 +(or destination raster)158 643.2 R 5.992(.M)-.55 G .992 +(appings are refreshed in order by the mapping number)-5.992 F 5.991(.M) +-.55 G .991(odifying a)-5.991 F(mapping causes the changed re)158 655.2 +Q(gions of the destination rect to be refreshed.)-.15 E F1(color)108 672 +Q F0(The)28.34 E F2(Gterm)2.648 E F0 .148(widget pro)2.648 F .148 +(vides a \214x)-.15 F .149 +(ed number of preassigned colors corresponding to pix)-.15 F .149(el v) +-.15 F(alues)-.25 E 3.202(0t)158 684 S .701 +(hrough 9. Zero is the background color)-3.202 F 3.201(,o)-.4 G .701 +(ne is the fore)-3.201 F .701(ground color)-.15 F 3.201(,a)-.4 G .701 +(nd 2-9 \(8 colors\) are)-3.201 F .907 +(arbitrary colors de\214ned by Gterm widget resources.)158 696 R .908 +(These static colors are normally used to)5.908 F(dra)158 708 Q 3.7(wt) +-.15 G 1.2(he background, frame, ax)-3.7 F 1.199 +(es, titles, etc. of a plot, or to dra)-.15 F 3.699(wc)-.15 G 1.199 +(olor graphics within the)-3.699 F(dra)158 720 Q .772(wing area.)-.15 F +.772(The adv)5.772 F .772(antage of static colors is that the)-.25 F +3.273(ya)-.15 G .773(re shared with other X clients, and)-3.273 F +(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(10)198.45 E EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R(the v)158 +84 Q +(alues of these colors may be assigned by the user to personalize the w) +-.25 E(ay plots look.)-.1 E(The)158 108 Q/F1 10/Times-Italic@0 SF(Gterm) +4.146 E F0 1.646(widget also allo)4.146 F 1.646(ws an)-.25 F 4.146(yn) +-.15 G 1.645(umber \(up to about 200 or so\) additional colors to be) +-4.146 F .655(de\214ned at runtime by the client application.)158 120 R +.655(These color v)5.655 F .655(alues start at pix)-.25 F .655(el v)-.15 +F .655(alue 10 and go)-.25 F .69(up to the maximum pix)158 132 R .69 +(el v)-.15 F .69(alue assigned by the client.)-.25 F .69 +(The client application allocates colors)5.69 F .23 +(with the write colormap escape code)158 144 R/F2 10/Times-Bold@0 SF +(rwc)2.731 E F0 5.231(.A)C .231(ttempts to o)-5.231 F -.15(ve)-.15 G +.231(rwrite the v).15 F .231(alues of the static colors)-.25 F 1.142 +(are ignored.)158 156 R 1.142(The v)6.142 F 1.141(alues of already allo\ +cated colors may be changed dynamically at runtime)-.25 F +(using write colormap code to write the desired range of color v)158 168 +Q(alues.)-.25 E .322(Applications should not assume that there are 10 s\ +tatic colors and 200 or so allocatable colors.)158 192 R .169 +(The graphcap entry for the logical de)158 204 R .169 +(vice in use de\214nes these parameters for the de)-.25 F 2.668 +(vice. Alter)-.25 F(-)-.2 E(nati)158 216 Q -.15(ve)-.25 G(ly).15 E 3.167 +(,t)-.65 G .668 +(he read colormap code may be used to dynamically determine ho)-3.167 F +3.168(wm)-.25 G(an)-3.168 E 3.168(yc)-.15 G .668(olors the)-3.168 F +(serv)158 228 Q(er has preallocated when the application starts up.)-.15 +E .66(An image may use either static and dynamic pix)158 252 R .66(el v) +-.15 F .66(alues or both types of v)-.25 F .66(alues, b)-.25 F .66 +(ut in most)-.2 F 1.124(cases imaging applications in)158 264 R -.2(vo) +-.4 G(lv).2 E 3.624(es)-.15 G 1.124(moothly shaded surf)-3.624 F 1.124 +(aces hence will require dynamically)-.1 F(assigned pri)158 276 Q -.25 +(va)-.25 G(te colors.).25 E .175 +(If for some reason the client application cannot use the)158 300 R F1 +(Gterm)2.675 E F0 .174(widget color model, the IOMAP)2.674 F 1.512 +(feature can be used to mak)158 312 R 4.013(et)-.1 G 1.513 +(he widget appear to ha)-4.013 F 1.813 -.15(ve s)-.2 H 1.513(ome e).15 F +1.513(xternally de\214ned \(i.e., client)-.15 F +(de\214ned\) color model.)158 324 Q 1.969(The maximum number of rasters\ + and maximum number of mappings is de\214ned by the Gterm widget)108 +340.8 R(resources)108 352.8 Q F1(maxRaster)3.398 E F0(and)3.398 E F1 +(maxMappings)3.398 E F0 .898 +(\(or in the GUI \214le\) when the graphics application starts up.)3.398 +F(The)5.898 E .213(maximum v)108 364.8 R .213(alues should be much lar) +-.25 F .212(ger than most applications require.)-.18 F .212 +(Applications should allocate raster)5.212 F 1.369 +(or mapping numbers sequentially starting at 1 \(more or less\) to a)108 +376.8 R -.2(vo)-.2 G 1.37(id running out of raster or mapping).2 F +(descriptors.)108 388.8 Q .81(The {read|write}pix)108 412.8 R .81 +(els escape codes operate directly on raster pix)-.15 F 3.31(els. The) +-.15 F .81(mapping escape codes support)3.31 F(tw)108 424.8 Q 2.793(oa) +-.1 G(lternati)-2.793 E .593 -.15(ve c)-.25 H .294 +(oordinate systems, raster pix).15 F .294(els and NDC \(normalized de) +-.15 F .294(vice coordinates\), as indicated by)-.25 F .223 +(the ST or DT ar)108 436.8 R .223 +(gument \(source or destination coordinate type\).)-.18 F .223 +(Note that the origin of the pix)5.223 F .222(el coordinate)-.15 F .335 +(system is the upper left corner of the display windo)108 448.8 R 2.835 +(w\()-.25 G .335(consistent with most graphics systems\), whereas the) +-2.835 F(origin of the NDC coordinate system is the lo)108 460.8 Q +(wer left corner \(consistent with IRAF\).)-.25 E(Pix)108 484.8 Q .111 +(el coordinates allo)-.15 F 2.611(wp)-.25 G .111 +(recise control of imaging b)-2.611 F .111 +(ut require the application to kno)-.2 F 2.61(wt)-.25 G .11(he windo) +-2.61 F 2.61(ws)-.25 G .11(ize, and)-2.61 F .804 +(may result in complications e.g. if the windo)108 496.8 R 3.304(wi)-.25 +G 3.304(sr)-3.304 G 3.304(esized. NDC)-3.304 F .805 +(coordinates pretty much guarantee that a)3.305 F .086(mapping will in) +108 508.8 R -.2(vo)-.4 G(lv).2 E 2.586(es)-.15 G .086 +(ampling, hence are not the most ef)-2.586 F .086(\214cient, b)-.25 F +.086(ut the graphics will be dra)-.2 F .085(wn correctly no)-.15 F .254 +(matter ho)108 520.8 R 2.754(wt)-.25 G .254(he windo)-2.754 F 2.754(wi) +-.25 G 2.754(sr)-2.754 G .254 +(esized and for most applications the performance dif)-2.754 F .254 +(ference is ne)-.25 F 2.754(gligible. Most)-.15 F 2.022(applications sh\ +ould use NDC coordinates for raster 0 \(the display windo)108 532.8 R +2.021(w\), and pix)-.25 F 2.021(el coordinates for)-.15 F(rasters 1-N.) +108 544.8 Q .856(Although the size of rasters 1 and higher are de\214ne\ +d by the client application, the size of raster zero, the)108 568.8 R +.384(actual gterm display windo)108 580.8 R 1.684 -.65(w, i)-.25 H 2.884 +(ss).65 G .384(ubject to the constraints of the windo)-2.884 F 2.883(ws) +-.25 G 2.883(ystem. The)-2.883 F .383(client can attempt to)2.883 F .45 +(reset the size of the gterm windo)108 592.8 R 2.95(wu)-.25 G .45 +(sing create raster escape with raster=0, ho)-2.95 F(we)-.25 E -.15(ve) +-.25 G 2.95(rt).15 G .45(he Gterm widget, UI)-2.95 F .124 +(containing the)108 604.8 R F1(Gterm)2.624 E F0 .124 +(widget, and the windo)2.624 F 2.624(wm)-.25 G .124 +(anager are all free to den)-2.624 F 2.624(ys)-.15 G .124 +(uch a request.)-2.624 F .123(The query raster)5.124 F +(escape should be called to determine the actual size of the windo)108 +616.8 Q 2.5(wo)-.25 G(ne will be dra)-2.5 E(wing into.)-.15 E F2 +(AN EXAMPLE IMA)87 645.6 Q(GING APPLICA)-.55 E(TION)-.95 E F0 .69(An e) +108 657.6 R .69 +(xample of a simple imaging application might be one that do)-.15 F .691 +(wnloads an image and displays it in the)-.25 F 1.296(gterm windo)108 +669.6 R 2.596 -.65(w, \214)-.25 H 1.296(lling the windo).65 F 5.096 -.65 +(w. T)-.25 H 1.296(his could be done as follo).65 F 1.295(ws \(follo) +-.25 F 1.295(wing a graphics open and other)-.25 F +(escape codes to prepare the dra)108 681.6 Q(wing surf)-.15 E(ace\).)-.1 +E F1(cr)108 710.4 Q(eate r)-.37 E(aster)-.15 E F0 .664 +(Create raster 1 the size of the pix)24.14 F .664 +(el array to be displayed. This need not be the same as)-.15 F +(the size of the gterm display windo)183 722.4 Q -.65(w.)-.25 G +(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(11)198.45 E EP +%%Page: 12 12 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 10 +/Times-Italic@0 SF(set mapping)108 84 Q F0 .331 +(De\214ne a mapping between raster 1 and raster 0, the display windo) +26.39 F 1.63 -.65(w, u)-.25 H .33(sing NDC coordi-).65 F 1.143 +(nates to de\214ne the re)183 96 R 1.143(gion of the display windo)-.15 +F 3.643(wt)-.25 G 3.643(ob)-3.643 G 3.644<658c>-3.643 G 3.644(lled. The) +-3.644 F 1.144(mapping number is)3.644 F 1.69(arbitrary b)183 108 R 1.69 +(ut mappings should normally be allocated starting with 1. The mapping \ +is)-.2 F(automatically enabled when \214rst de\214ned.)183 120 Q F1 +(write colormap)108 136.8 Q F0 2.5(\(Optional\). De\214ne)13.61 F +(the pix)2.5 E(el v)-.15 E +(alue to RGB color assignments for the image pix)-.25 E(els.)-.15 E F1 +(write pixels)108 153.6 Q F0 .252 +(This escape is called one or more times to write pix)28.61 F .252 +(els into raster 1.)-.15 F .252(At most 32K pix)5.252 F(els)-.15 E .098 +(can be written in each call.)183 165.6 R .098 +(As each write is made the af)5.098 F .097(fected re)-.25 F .097 +(gion of the display win-)-.15 F(do)183 177.6 Q 2.5(ww)-.25 G +(ill be updated.)-2.5 E(Alternati)108 194.4 Q -.15(ve)-.25 G(ly).15 E +3.313(,o)-.65 G .814(ne could write the pix)-3.313 F .814 +(els and then de\214ne the mapping to cause the entire image to be dis-) +-.15 F(played at once.)108 206.4 Q .071(Note that the imaging escape ca\ +n be combined with normal graphics to dra)108 230.4 R 2.57(wt)-.15 G +-.15(ex)-2.57 G 2.57(ta).15 G .07(nd graphics around or on)-2.57 F .078 +(top of an image re)108 242.4 R 2.579(gion. The)-.15 F .079 +(order in which dra)2.579 F .079 +(wing operations occur is important, e.g., to dra)-.15 F 2.579(wg)-.15 G +.079(raphics or)-2.579 F(te)108 254.4 Q +(xt on top of an image the image should be dra)-.15 E(wn \214rst.)-.15 E +/F2 9/Times-Bold@0 SF(MARKERS)72 283.2 Q F0(Mark)108 295.2 Q +(ers are a general feature of the)-.1 E F1(Gterm)2.5 E F0 +(widget and are used more e)2.5 E(xtensi)-.15 E -.15(ve)-.25 G +(ly in other programs \(e.g. the).15 E 1.47 +(prototype IRAF science GUI applications\), b)108 307.2 R 1.47(ut the) +-.2 F 3.97(yh)-.15 G -2.25 -.2(av e)-3.97 H 1.47(no real use in)4.17 F +F1(xgterm)3.97 E F0 1.47(when used as simply a)3.97 F 1.134 +(graphics terminal. All mark)108 319.2 R 1.133 +(ers share some of the same characteristics, so it is w)-.1 F 1.133 +(orthwhile learning basic)-.1 F(mark)108 331.2 Q .356(er manipulation k) +-.1 F -.15(ey)-.1 G(strok).15 E .357(es \(as de\214ned using the def)-.1 +F .357(ault mark)-.1 F .357(er translations\), especially ho)-.1 F 2.857 +(wt)-.25 G 2.857(od)-2.857 G(elete)-2.857 E +(an accidentally created mark)108 343.2 Q(er:)-.1 E/F3 10/Times-Bold@0 +SF(o)144 360 Q F1(Delete)10 E F0(or)2.5 E F1(Bac)2.5 E(kspace)-.2 E F0 +(in a mark)2.5 E(er deletes it.)-.1 E F3(o)144 376.8 Q F0(MB1 an)10 E +(ywhere inside a mark)-.15 E(er may be used to drag the mark)-.1 E(er) +-.1 E(.)-.55 E F3(o)144 393.6 Q F0(MB1 near a mark)10 E +(er corner or edge, depending on the type of mark)-.1 E(er)-.1 E 2.5(,r) +-.4 G(esizes the mark)-2.5 E(er)-.1 E(.)-.55 E F3(o)144 410.4 Q F0 +(Shift-MB1 on the corner of most mark)10 E(ers will rotate the mark)-.1 +E(er)-.1 E(.)-.55 E F3(o)144 427.2 Q F0(Mark)10 E 1.238 +(ers stack, if you ha)-.1 F 1.538 -.15(ve s)-.2 H -2.15 -.25(ev e).15 H +1.238(ral mark).25 F 1.238(ers and you put one on top of the other)-.1 F +3.737(.T)-.55 G 1.237(he acti)-3.737 F -.15(ve)-.25 G(mark)159 439.2 Q +.135(er is highlighted to tell you which of the stack)-.1 F .136 +(ed mark)-.1 F .136(ers is acti)-.1 F -.15(ve)-.25 G 2.636(.I).15 G +2.636(ft)-2.636 G .136(he mark)-2.636 F .136(ers o)-.1 F -.15(ve)-.15 G +(rlap,).15 E(this will be mark)159 451.2 Q +(er "on top" in the stacking order)-.1 E(.)-.55 E F3(o)144 468 Q F0 .641 +(MB2 in the body of a mark)10 F .641(er "lo)-.1 F .641(wers" the mark) +-.25 F(er)-.1 E 3.141(,i)-.4 G .64(.e. mo)-3.141 F -.15(ve)-.15 G 3.14 +(si).15 G 3.14(tt)-3.14 G 3.14(ot)-3.14 G .64(he bottom of the stacking) +-3.14 F(order)159 480 Q(.)-.55 E F2(ENVIR)72 508.8 Q(ONMENT)-.27 E F1 +(XGterm)108 520.8 Q F0 .012(sets the en)2.512 F .013(vironment v)-.4 F +.013(ariables `)-.25 F(`TERM')-.74 E 2.513('a)-.74 G .013(nd `)-2.513 F +(`TERMCAP')-.74 E 2.513('p)-.74 G .013(roperly for the size windo)-2.513 +F 2.513(wy)-.25 G .013(ou ha)-2.513 F -.15(ve)-.2 G 3.154(created. It) +108 532.8 R .654(also uses and sets the en)3.154 F .654(vironment v)-.4 +F .654(ariable `)-.25 F(`DISPLA)-.74 E(Y')-1.05 E 3.154('t)-.74 G 3.154 +(os)-3.154 G .653(pecify which bit map display ter)-3.154 F(-)-.2 E .789 +(minal to use.)108 544.8 R .789(The en)5.789 F .789(vironment v)-.4 F +.789(ariable `)-.25 F(`WINDO)-.74 E(WID')-.35 E 3.289('i)-.74 G 3.289 +(ss)-3.289 G .789(et to the X windo)-3.289 F 3.29(wi)-.25 G 3.29(dn) +-3.29 G .79(umber of the)-3.29 F F1(xgterm)3.29 E F0(windo)108 556.8 Q +-.65(w.)-.25 G F2(SEE ALSO)72 585.6 Q F0 +(xterm\(1\), resize\(1\), X\(1\), pty\(4\), tty\(4\))108 597.6 Q F1 +(Xterm Contr)108 609.6 Q(ol Sequences)-.45 E F0(\(in the)2.5 E F1(xterm) +2.5 E F0(source directory\))2.5 E F2 -.09(BU)72 638.4 S(GS).09 E F0(Man) +108 650.4 Q 2.5(yo)-.15 G 2.5(ft)-2.5 G(he same b)-2.5 E(ugs af)-.2 E +(fecting)-.25 E F1(xterm)2.5 E F0(also apply here.)2.5 E F1(Xgterm)108 +674.4 Q F0 .725(is not normally installed with setuid permissions.)3.225 +F .724(On some Linux systems where the /de)5.725 F .724(v/tty and)-.25 F +(/de)108 686.4 Q 1.355(v/pty de)-.25 F 1.355(vices ha)-.25 F 1.655 -.15 +(ve r)-.2 H 1.355(oot o).15 F 1.355 +(wnership and permission 600 this can cause problems.)-.25 F -.8(Wo) +6.355 G 1.355(rkarounds are to).8 F .857(either install)108 698.4 R F1 +(XGterm)3.357 E F0 .857(with setuid permissions or modify the /de)3.357 +F .857(v/tty and /de)-.25 F .856(v/pty de)-.25 F .856(vices to ha)-.25 F +1.156 -.15(ve p)-.2 H(ermis-).15 E(sion 666.)108 710.4 Q +(X11IRAF Project)72 768 Q(16 Dec 1996)137.62 E(12)198.45 E EP +%%Page: 13 13 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 357.74(XGTERM\(1\) XGTERM\(1\))72 48 R/F1 9 +/Times-Bold@0 SF(COPYRIGHT)72 84 Q F0(Cop)108 96 Q +(yright\(c\) 1986 Association of Uni)-.1 E -.15(ve)-.25 G +(rsities for Research in Astronomy Inc.).15 E(X11IRAF Project)72 768 Q +(16 Dec 1996)137.62 E(13)198.45 E EP +%%Trailer +end +%%EOF diff --git a/vendor/x11iraf/xgterm/xterm.man b/vendor/x11iraf/xgterm/xterm.man new file mode 100644 index 00000000..6717bad2 --- /dev/null +++ b/vendor/x11iraf/xgterm/xterm.man @@ -0,0 +1,1649 @@ +.\" $XConsortium: xterm.man,v 1.72 91/08/23 18:46:18 gildea Exp $ +.TH XTERM 1 "Release 5" "X Version 11" +.SH NAME +xterm \- terminal emulator for X +.SH SYNOPSIS +.B xterm +[\-\fItoolkitoption\fP ...] [\-option ...] +.SH DESCRIPTION +The \fIxterm\fP program is a terminal emulator for the X Window System. +It provides DEC VT102 and Tektronix 4014 +compatible terminals for programs that can't +use the window system directly. If the underlying operating system supports +terminal resizing capabilities (for example, the SIGWINCH signal in systems +derived from 4.3bsd), \fIxterm\fP will use the facilities to notify programs +running in the window whenever it is resized. +.PP +The VT102 and Tektronix 4014 terminals each have their own window so that you +can edit text in one and look at graphics in the other at the same time. +To maintain the correct aspect ratio (height/width), Tektronix graphics will +be restricted to the largest box with a 4014's aspect ratio that will fit in +the window. This box is located in the upper left area of the window. +.PP +Although both windows may be displayed at the same time, one of them is +considered the ``active'' window for receiving keyboard input and terminal +output. This is the window that contains the text cursor. +The active window can be chosen through escape sequences, +the ``VT Options'' menu in the VT102 window, and the ``Tek Options'' +menu in the 4014 window. +.SH EMULATIONS +The VT102 emulation is fairly complete, but does not support the blinking +character attribute nor the double-wide and double-size character sets. +.IR Termcap (5) +entries that work with +.I xterm +include ``xterm,'' ``vt102,'' ``vt100'' and ``ansi,'' and +.I xterm +automatically searches the termcap file in this order for these entries and then +sets the ``TERM'' and the ``TERMCAP'' environment variables. +.PP +Many of the special +.I xterm +features (like logging) may be modified under program control +through a set of escape sequences different from the standard VT102 escape +sequences. +(See the +.I "Xterm Control Sequences" +document.) +.PP +The Tektronix 4014 emulation is also fairly good. +Four different font sizes and five different lines types are supported. +The Tektronix text and graphics commands are recorded internally by +.I xterm +and may be written to a file by sending the COPY escape sequence (or through +the +.B Tektronix +menu; see below). +The name of the file will be +``\fBCOPY\fIyy\fB\-\fIMM\fB\-\fIdd\fB.\fIhh\fB:\fImm\fB:\fIss\fR'', where +.IR yy , +.IR MM , +.IR dd , +.IR hh , +.I mm +and +.I ss +are the year, month, day, hour, minute and second when the COPY was performed +(the file is created in the directory +.I xterm +is started in, or the home directory for a login +.IR xterm ). +.SH "OTHER FEATURES" +.I Xterm +automatically highlights the text cursor when the +pointer enters the window (selected) and unhighlights it when the pointer +leaves the window (unselected). +If the window is the focus window, then the text cursor is +highlighted no matter where the pointer is. +.PP +In VT102 mode, there are escape sequences to activate and deactivate +an alternate screen buffer, which is the same size as the display area +of the window. +When activated, the current screen is saved and replaced with the alternate +screen. +Saving of lines scrolled off the top of the window is disabled until the +normal screen is restored. +The +.IR termcap (5) +entry for +.I xterm +allows the visual editor +.IR vi (1) +to switch to the alternate screen for editing and to restore the screen +on exit. +.PP +In either VT102 or Tektronix mode, there are escape sequences to change the +name of the windows and to specify a new log file name. +See \fIXterm Control Sequences\fP for details. +Enabling the escape sequence to change the +log file name is a compile-time option; +by default this escape sequence is ignored for security reasons. +.SH OPTIONS +The \fIxterm\fP terminal emulator +accepts all of the standard X Toolkit command line options as well as +the following (if the option begins with a +.RB ` + ' +instead of a +.RB ` \- ', +the option is restored to its default value): +.TP 8 +.B \-help +This causes \fIxterm\fP to print out a verbose message describing its options. +.TP 8 +.B \-132 +Normally, the VT102 DECCOLM escape sequence that switches between 80 and +132 column mode is ignored. +This option causes the DECCOLM escape sequence to be recognized, and the +.I xterm +window will resize appropriately. +.TP 8 +.B \-ah +This option indicates that +.I xterm +should always highlight the text cursor. By default, +.I xterm +will display a hollow text cursor whenever the focus is lost or the +pointer leaves the window. +.TP 8 +.B \+ah +This option indicates that +.I xterm +should do text cursor highlighting based on focus. +.TP 8 +.BI \-b " number" +This option specifies the size of the inner border (the distance between +the outer edge of the characters and the window border) in pixels. The +default is 2. +.TP 8 +.B "\-cb" +Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to FALSE. +.TP 8 +.B "\+cb" +Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to TRUE. +.TP 8 +.B "\-cc \fIcharacterclassrange\fP:\fIvalue\fP[,...]" +This sets classes indicated by the given ranges for using in selecting by +words. See the section specifying character classes. +.TP 8 +.B "\-cn" +This option indicates that newlines should not be cut in line-mode +selections. +.TP 8 +.B \+cn +This option indicates that newlines should be cut in line-mode selections. +.TP 8 +.BI \-cr " color" +This option specifies the color to use for text cursor. The default is to +use the same foreground color that is used for text. +.TP 8 +.B \-cu +This option indicates that \fIxterm\fP should work around a bug in the +.IR curses (3x) +cursor motion package that causes the +.IR more (1) +program to display lines that are exactly the width of the window and +are followed by a line beginning with a tab to be displayed incorrectly +(the leading tabs are not displayed). +.TP 8 +.B \+cu +This option indicates that that \fIxterm\fP should not work around the +.IR curses (3x) +bug mentioned above. +.TP 8 +.BI \-e " program \[arguments \.\.\.\]" +This option specifies the program (and its command line arguments) to be +run in the \fIxterm\fP window. It also sets the window title and icon +name to be the basename of the program being executed if neither \fI\-T\fP +nor \fI\-n\fP are given on the command line. \fBThis must be the last +option on the command line.\fP +.TP 8 +.BI \-fb " font" +This option specifies a font to be used when displaying bold text. +This font must be the same height and width as the normal font. +If only one of the normal or bold fonts is specified, it will be used as the +normal font and the bold font will be produced by overstriking this font. +The default is to do overstriking of the normal font. +.TP 8 +.B \-im +Turn on the \fBuseInsertMode\fP resource. +.TP 8 +.B +im +Turn off the \fBuseInsertMode\fP resource. +.TP 8 +.B \-j +This option indicates that \fIxterm\fP should do jump scrolling. Normally, +text is scrolled one line at a time; this option allows \fIxterm\fP to move +multiple lines at a time so that it doesn't fall as far behind. Its use is +strongly recommended since it make \fIxterm\fP much faster when scanning +through large amounts of text. The VT100 escape sequences for enabling and +disabling smooth scroll as well as the ``VT Options'' +menu can be used to turn this +feature on or off. +.TP 8 +.B \+j +This option indicates that \fIxterm\fP should not do jump scrolling. +.TP 8 +.B \-l +This option indicates that \fIxterm\fP should send all terminal output to +a log file as well as to the screen. This option can be enabled or disabled +using the ``VT Options'' menu. +.TP 8 +.B \+l +This option indicates that \fIxterm\fP should not do logging. +.TP 8 +.BI \-lf " filename" +This option specifies the name of the file to which the output log described +above is written. If \fIfile\fP begins with a pipe symbol (|), the rest of +the string is assumed to be a command to be used as the endpoint of a pipe. +The ability to log to a pipe is a compile-time option which is +disabled by default for security reasons. +The default filename is ``\fBXtermLog.\fIXXXXX\fR'' (where \fIXXXXX\fP +is the process id of \fIxterm\fP) and is created in the directory from which +\fIxterm\fP was started (or the user's home directory in the case of a +login window). +.TP 8 +.B \-ls +This option indicates that the shell that is started in the \fIxterm\fP window +be a login shell (i.e. the first character of argv[0] will be a dash, +indicating to the shell that it should read the user's .login or .profile). +.TP 8 +.B \+ls +This option indicates that the shell that is started should not be a login +shell (i.e. it will be a normal ``subshell''). +.TP 8 +.B \-mb +This option indicates that \fIxterm\fP should ring a margin bell when +the user types near the right end of a line. This option can be turned on +and off from the ``VT Options'' menu. +.TP 8 +.B \+mb +This option indicates that margin bell should not be rung. +.TP 8 +.B "\-mc milliseconds" +This option specifies the maximum time between multi-click selections. +.TP 8 +.BI \-ms " color" +This option specifies the color to be used for the pointer cursor. The default +is to use the foreground color. +.TP 8 +.BI \-nb " number" +This option specifies the number of characters from the right end of a line +at which the margin bell, if enabled, will ring. The default is 10. +.TP 8 +.B \-rw +This option indicates that reverse-wraparound should be allowed. This allows +the cursor to back up from the leftmost column of one line to the rightmost +column of the previous line. This is very useful for editing long shell +command lines and is encouraged. This option can be turned on and off from +the ``VT Options'' menu. +.TP 8 +.B \+rw +This option indicates that reverse-wraparound should not be allowed. +.TP 8 +.B \-aw +This option indicates that auto-wraparound should be allowed. This +allows the cursor to automatically wrap to the beginning of the next +line when when it is at the rightmost position of a line and text is +output. +.TP 8 +.B \+aw +This option indicates that auto-wraparound should not be allowed. +.TP 8 +.B \-s +This option indicates that \fIxterm\fP may scroll asynchronously, meaning that +the screen does not have to be kept completely up to date while scrolling. +This allows \fIxterm\fP to run faster when network latencies are very high +and is typically useful when running across a very large internet or many +gateways. +.TP 8 +.B \+s +This option indicates that \fIxterm\fP should scroll synchronously. +.TP 8 +.B \-sb +This option indicates that some number of lines that are scrolled off the top +of the window should be saved and that a scrollbar should be displayed so that +those lines can be viewed. This option may be turned on and off from the +``VT Options'' menu. +.TP 8 +.B \+sb +This option indicates that a scrollbar should not be displayed. +.TP 8 +.B \-sf +This option indicates that Sun Function Key escape codes should be generated +for function keys. +.TP 8 +.B \+sf +This option indicates that the standard escape codes should be generated for +function keys. +.TP 8 +.B \-si +This option indicates that output to a window should not automatically +reposition the screen to the bottom of the scrolling region. +This option can be turned on and off from the ``VT Options'' menu. +.TP 8 +.B \+si +This option indicates that output to a window should cause it to +scroll to the bottom. +.TP 8 +.B \-sk +This option indicates that pressing a key while +using the scrollbar to review previous lines of text should +cause the window to be repositioned automatically in the normal position at the +bottom of the scroll region. +.TP 8 +.B \+sk +This option indicates that pressing a key while using the scrollbar +should not cause the window to be repositioned. +.TP 8 +.BI \-sl " number" +This option specifies the number of lines to save that have been scrolled +off the top of the screen. The default is 64. +.TP 8 +.B \-t +This option indicates that \fIxterm\fP should start in Tektronix mode, rather +than in VT102 mode. Switching between the two windows is done using the +``Options'' menus. +.TP 8 +.B \+t +This option indicates that \fIxterm\fP should start in VT102 mode. +.TP 8 +.BI \-tm " string" +This option specifies a series of terminal setting keywords followed by the +characters that should be bound to those functions, similar to the \fIstty\fP +program. Allowable keywords include: intr, quit, erase, kill, eof, +eol, swtch, start, stop, brk, susp, dsusp, rprnt, flush, weras, and lnext. +Control characters may be specified as ^char (e.g. ^c or ^u) and ^? may be +used to indicate delete. +.TP 8 +.BI \-tn " name" +This option specifies the name of the terminal type to be set in the TERM +environment variable. This terminal type must exist in the \fItermcap(5)\fP +database and should have \fIli#\fP and \fIco#\fP entries. +.TP 8 +.B \-ut +This option indicates that \fIxterm\fP shouldn't write a record into the +the system log file \fI/etc/utmp\fP. +.TP 8 +.B \+ut +This option indicates that \fIxterm\fP should write a record into the system +log file \fI/etc/utmp\fP. +.TP 8 +.B \-vb +This option indicates that a visual bell is preferred over an audible one. +Instead of ringing the terminal bell whenever a Control-G is received, the +window will be flashed. +.TP 8 +.B \+vb +This option indicates that a visual bell should not be used. +.TP 8 +.B \-wf +This option indicates that \fIxterm\fP should wait for the window to be mapped +the first time before starting the subprocess so that the initial terminal +size settings and environment variables are correct. It is the application's +responsibility to catch subsequent terminal size changes. +.TP 8 +.B \+wf +This option indicates that \fIxterm\fP show not wait before starting the +subprocess. +.TP 8 +.B \-C +This option indicates that this window should receive console output. This +is not supported on all systems. To obtain console output, you must be the +owner of the console device, and you must have read and write permission +for it. If you are running X under \fIxdm\fP on the console screen you may +need to have the session startup and reset programs explicitly change the +ownership of the console device in order to get this option to work. +.TP 8 +.B \-S\fIccn\fP +This option specifies the last two letters of the name of a pseudoterminal +to use in slave mode, plus the number of the inherited file descriptor. +The option is parsed ``%c%c%d''. +This allows \fIxterm\fP to be used as an input and +output channel for an existing program and is sometimes used in specialized +applications. +.PP +The following command line arguments are provided for compatibility with +older versions. They may not be supported in the next release as the X +Toolkit provides standard options that accomplish the same task. +.TP 8 +.B "%\fIgeom\fP" +This option specifies the preferred size and position of the Tektronix window. +It is shorthand for specifying the ``\fI*tekGeometry\fP'' resource. +.TP 8 +.B \#\fIgeom\fP +This option specifies the preferred position of the icon window. +It is shorthand for specifying the ``\fI*iconGeometry\fP'' resource. +.TP 8 +.BI \-T " string" +This option specifies the title for \fIxterm\fP's windows. +It is equivalent to \fB\-title\fP. +.TP 8 +.BI \-n " string" +This option specifies the icon name for \fIxterm\fP's windows. +It is shorthand for specifying the ``\fI*iconName\fP'' resource. +Note that this is not the same as the toolkit option \fB\-name\fP (see below). +The default icon name is the application name. +.TP 8 +.B \-r +This option indicates that reverse video should be simulated by swapping +the foreground and background colors. It is equivalent to +\fB\-rv\fP. +.TP 8 +.BI \-w " number" +This option specifies the width in pixels of the border surrounding the window. +It is equivalent to \fB\-borderwidth\fP or \fB\-bw\fP. +.PP +The following standard X Toolkit command line arguments are commonly used +with \fIxterm\fP: +.TP 8 +.B \-bg \fIcolor\fP +This option specifies the color to use for the background of the window. +The default is ``white.'' +.TP 8 +.B \-bd \fIcolor\fP +This option specifies the color to use for the border of the window. +The default is ``black.'' +.TP 8 +.B \-bw \fInumber\fP +This option specifies the width in pixels of the border surrounding the window. +.TP 8 +.B \-fg \fIcolor\fP +This option specifies the color to use for displaying text. The default is +``black.'' +.TP 8 +.B \-fn \fIfont\fP +This option specifies the font to be used for displaying normal text. The +default is \fIfixed\fP. +.TP 8 +.B \-name \fIname\fP +This option specifies the application name under which resources are to be +obtained, rather than the default executable file name. +\fIName\fP should not contain ``.'' or ``*'' characters. +.TP 8 +.B \-title \fIstring\fP +This option specifies the window title string, which may be displayed by +window managers if the user so chooses. The default title is the command +line specified after the \fB\-e\fP option, if any, otherwise the application +name. +.TP 8 +.B \-rv +This option indicates that reverse video should be simulated by swapping +the foreground and background colors. +.TP 8 +.B \-geometry \fIgeometry\fP +This option specifies the preferred size and position of the VT102 window; +see \fIX(1)\fP. +.TP 8 +.B \-display \fIdisplay\fP +This option specifies the X server to contact; see \fIX(1)\fP. +.TP 8 +.B \-xrm \fIresourcestring\fP +This option specifies a resource string to be used. This is especially +useful for setting resources that do not have separate command line options. +.TP 8 +.B \-iconic +This option indicates that \fIxterm\fP should ask the window manager to +start it as an icon rather than as the normal window. +.SH RESOURCES +The program understands all of the core X Toolkit resource names and +classes as well as: +.\".in +1in +.TP 8 +.B "iconGeometry (\fPclass\fB IconGeometry)" +Specifies the preferred size and position of the application when iconified. +It is not necessarily obeyed by all window managers. +.TP 8 +.B "iconName (\fPclass\fB IconName)" +Specifies the icon name. The default is the application name. +.TP 8 +.B "termName (\fPclass\fB TermName)" +Specifies the terminal type name to be set in the TERM environment variable. +.TP 8 +.B "title (\fPclass\fB Title)" +Specifies a string that may be used by the window manager when displaying +this application. +.TP 8 +.B "ttyModes (\fPclass\fB TtyModes)" +Specifies a string containing terminal setting keywords and the characters +to which they may be bound. Allowable keywords include: intr, quit, +erase, kill, eof, eol, swtch, start, stop, brk, susp, dsusp, rprnt, flush, +weras, and lnext. Control characters may be specified as ^char (e.g. ^c or ^u) +and ^? may be used to indicate Delete. This is very useful for overriding +the default terminal settings without having to do an \fIstty\fP every time +an \fIxterm\fP is started. +.TP 8 +.B "useInsertMode (\fPclass\fB UseInsertMode) +Force use of insert mode by adding appropriate entries to the TERMCAP +environment variable. This is useful if the system termcap is broken. +The default is ``false.'' +.TP 8 +.B "utmpInhibit (\fPclass\fB UtmpInhibit)" +Specifies whether or not \fIxterm\fP should try to record the user's terminal +in \fI/etc/utmp\fP. +.TP 8 +.B "sunFunctionKeys (\fPclass\fB SunFunctionKeys)" +Specifies whether or not Sun Function Key escape codes should be generated for +function keys instead of standard escape sequences. +.\".in -1in +.TP 8 +.B "waitForMap (\fPclass\fB WaitForMap)" +Specifies whether or not \fIxterm\fP should wait for the initial window map +before starting the subprocess. The default is ``false.'' +.\".in 11in +.sp +.PP +The following resources are specified as part of the \fIvt100\fP widget (class +\fIVT100\fP): +.\".in +1in +.TP 8 +.B "allowSendEvents (\fPclass\fB AllowSendEvents)" +Specifies whether or not synthetic key and button events (generated using +the X protocol SendEvent request) should be interpreted or discarded. +The default is ``false'' meaning they are discarded. Note that allowing +such events creates a very large security hole. +.sp +.TP 8 +.B "alwaysHighlight (\fPclass\fB AlwaysHighlight)" +Specifies whether or not \fIxterm\fP should always display a highlighted +text cursor. By default, a hollow text cursor is displayed whenever the +pointer moves out of the window or the window loses the input focus. +.TP 8 +.B "appcursorDefault (\fPclass\fB AppcursorDefault)" +If ``true,'' the cursor keys are initially in application mode. +The default is ``false.'' +.TP 8 +.B "appkeypadDefault (\fPclass\fB AppkeypadDefault)" +If ``true,'' the keypad keys are initially in application mode. +The default is ``false.'' +.TP 8 +.B "autoWrap (\fPclass\fB AutoWrap)" +Specifies whether or not auto-wraparound should be enabled. The +default is ``true.'' +.TP 8 +.B "bellSuppressTime (\fPclass\fB BellSuppressTime)" +Number of milliseconds after a bell command is sent during which additional +bells will be suppressed. Default is 200. If set non-zero, +additional bells +will also be suppressed until the server reports that processing of +the first bell has been completed; this feature is most useful with +the visible bell. +.TP 8 +.B "boldFont (\fPclass\fB BoldFont)" +Specifies the name of the bold font to use instead of overstriking. +.TP 8 +.B "c132 (\fPclass\fB C132)" +Specifies whether or not the VT102 DECCOLM escape sequence should be honored. +The default is ``false.'' +.TP 8 +.B "cutNewline (\fPclass\fB CutNewline)" +If false, triple clicking to select a line does not include the Newline +at the end of the line. +If true, the Newline is selected. +The default is ``true.'' +.TP 8 +.B "cutToBeginningOfLine (\fPclass\fB CutToBeginningOfLine)" +If false, triple clicking to select a line selects only from the +current word forward. +If true, the entire line is selected. +The default is ``true.'' +.TP 8 +.B "charClass (\fPclass\fB CharClass)" +Specifies comma-separated lists of character class bindings of the form +\[\fIlow\fP-\]\fIhigh\fP:\fIvalue\fP. These are used in determining which +sets of characters should be treated the same when doing cut and paste. +See the section on specifying character classes. +.TP 8 +.B "curses (\fPclass\fB Curses)" +Specifies whether or not the last column bug in +.IR curses (3x) +should be worked around. +The default is ``false.'' +.TP 8 +.B "background (\fPclass\fB Background)" +Specifies the color to use for the background of the window. The default is +``white.'' +.TP 8 +.B "foreground (\fPclass\fB Foreground)" +Specifies the color to use for displaying text in the window. Setting the +class name instead of the instance name is an easy way to have everything +that would normally appear in the text color change color. The default +is ``black.'' +.TP 8 +.B "cursorColor (\fPclass\fB Foreground)" +Specifies the color to use for the text cursor. The default is ``black.'' +.TP 8 +.B "eightBitInput (\fPclass\fB EightBitInput\fP)" +If true, Meta characters input from the keyboard are presented as a +single character with the eighth bit turned on. +If false, Meta characters are converted into a two-character +sequence with the character itself preceded by ESC. +The default is ``true.'' +.TP 8 +.B "eightBitOutput (\fPclass\fB EightBitOutput\fP)" +Specifies whether or not eight-bit characters sent from the host should be +accepted as is or stripped when printed. The default is ``true.'' +.TP 8 +.B "font (\fPclass\fB Font)" +Specifies the name of the normal font. The default is ``fixed.'' +.TP 8 +.B "font1 (\fPclass\fB Font1)" +Specifies the name of the first alternative font. +.TP 8 +.B "font2 (\fPclass\fB Font2)" +Specifies the name of the second alternative font. +.TP 8 +.B "font3 (\fPclass\fB Font3)" +Specifies the name of the third alternative font. +.TP 8 +.B "font4 (\fPclass\fB Font4)" +Specifies the name of the fourth alternative font. +.TP 8 +.B "font5 (\fPclass\fB Font5)" +Specifies the name of the fifth alternative font. +.TP 8 +.B "font6 (\fPclass\fB Font6)" +Specifies the name of the sixth alternative font. +.TP 8 +.B "geometry (\fPclass\fB Geometry)" +Specifies the preferred size and position of the VT102 window. +.TP 8 +.B "internalBorder (\fPclass\fB BorderWidth)" +Specifies the number of pixels between the characters and the window border. +The default is 2. +.TP 8 +.B "jumpScroll (\fPclass\fB JumpScroll)" +Specifies whether or not jump scroll should be used. The default is ``true.'' +.TP 8 +.B "logFile (\fPclass\fB Logfile)" +Specifies the name of the file to which a terminal session is logged. The +default is ``\fBXtermLog.\fIXXXXX\fR'' (where \fIXXXXX\fP +is the process id of \fIxterm\fP). +.TP 8 +.B "logging (\fPclass\fB Logging)" +Specifies whether or not a terminal session should be logged. The default is +``false.'' +.TP 8 +.B "logInhibit (\fPclass\fB LogInhibit)" +Specifies whether or not terminal session logging should be inhibited. The +default is ``false.'' +.TP 8 +.B "loginShell (\fPclass\fB LoginShell)" +Specifies whether or not the shell to be run in the window should be started +as a login shell. The default is ``false.'' +.TP 8 +.B "marginBell (\fPclass\fB MarginBell)" +Specifies whether or not the bell should be run when the user types near the +right margin. The default is ``false.'' +.TP 8 +.B "multiClickTime (\fPclass\fB MultiClickTime)" +Specifies the maximum time in milliseconds between multi-click select +events. The default is 250 milliseconds. +.TP 8 +.B "multiScroll (\fPclass\fB MultiScroll)" +Specifies whether or not scrolling should be done asynchronously. The default +is ``false.'' +.TP 8 +.B "nMarginBell (\fPclass\fB Column)" +Specifies the number of characters from the right margin at which the margin +bell should be rung, when enabled. +.TP 8 +.B "pointerColor (\fPclass\fB Foreground)" +Specifies the foreground color of the pointer. The default is +``XtDefaultForeground.'' +.TP 8 +.B "pointerColorBackground (\fPclass\fB Background)" +Specifies the background color of the pointer. The default is +``XtDefaultBackground.'' +.TP 8 +.B "pointerShape (\fPclass\fB Cursor)" +Specifies the name of the shape of the pointer. The default is ``xterm.'' +.TP 8 +.B "resizeGravity (\fPclass\fB ResizeGravity)" +Affects the behavior when the window is resized to be taller or +shorter. \fBNorthWest\fP +specifies that the top line of text on the screen stay fixed. If the window +is made shorter, lines are dropped from the bottom; if the window is +made taller, blank lines are added at the bottom. This is compatible +with the behavior in R4. \fBSouthWest\fP (the default) specifies that +the bottom line of text on the screen stay fixed. If the window is +made taller, additional saved lines will be scrolled down onto the +screen; if the window is made shorter, lines will be scrolled off the +top of the screen, and the top saved lines will be dropped. +.TP 8 +.B "reverseVideo (\fPclass\fB ReverseVideo)" +Specifies whether or not reverse video should be simulated. The default is +``false.'' +.TP 8 +.B "reverseWrap (\fPclass\fB ReverseWrap)" +Specifies whether or not reverse-wraparound should be enabled. The default is +``false.'' +.TP 8 +.B "saveLines (\fPclass\fB SaveLines)" +Specifies the number of lines to save beyond the top of the screen when a +scrollbar is turned on. The default is 64. +.TP 8 +.B "scrollBar (\fPclass\fB ScrollBar)" +Specifies whether or not the scrollbar should be displayed. The default is +``false.'' +.TP 8 +.B "scrollTtyOutput (\fPclass\fB ScrollCond)" +Specifies whether or not output to the terminal should automatically cause +the scrollbar to go to the bottom of the scrolling region. The default is +``true.'' +.TP 8 +.B "scrollKey (\fPclass\fB ScrollCond)" +Specifies whether or not pressing a key should automatically cause the +scrollbar to go to the bottom of the scrolling region. The default is +``false.'' +.TP 8 +.B "scrollLines (\fPclass\fB ScrollLines)" +Specifies the number of lines that the \fIscroll-back\fP and +\fIscroll-forw\fP actions should use as a default. The default value is 1. +.TP 8 +.B "signalInhibit (\fPclass\fB SignalInhibit)" +Specifies whether or not the entries in the ``Main Options'' menu for sending +signals to \fIxterm\fP should be disallowed. The default is ``false.'' +.TP 8 +.B "tekGeometry (\fPclass\fB Geometry)" +Specifies the preferred size and position of the Tektronix window. +.TP 8 +.B "tekInhibit (\fPclass\fB TekInhibit)" +Specifies whether or not Tektronix mode should be disallowed. The default is +``false.'' +.TP 8 +.B "tekSmall (\fPclass\fB TekSmall)" +Specifies whether or not the Tektronix mode window should start in its smallest +size if no explicit geometry is given. This is useful when running \fIxterm\fP +on displays with small screens. The default is ``false.'' +.TP 8 +.B "tekStartup (\fPclass\fB TekStartup)" +Specifies whether or not \fIxterm\fP should start up in Tektronix mode. +The default is ``false.'' +.TP 8 +.B "titeInhibit (\fPclass\fB TiteInhibit)" +Specifies whether or not \fIxterm\fP should remove remove \fIti\fP and \fIte\fP +termcap entries (used to switch between alternate screens on startup of many +screen-oriented programs) from the TERMCAP string. If set, +\fIxterm\fP also ignores the escape sequence to switch to the +alternate screen. +.TP 8 +.B "translations (\fPclass\fB Translations)" +Specifies the key and button bindings for menus, selections, ``programmed +strings,'' etc. See \fBACTIONS\fP below. +.TP 8 +.B "visualBell (\fPclass\fB VisualBell)" +Specifies whether or not a visible bell (i.e. flashing) should be used instead +of an audible bell when Control-G is received. The default is ``false.'' +.sp +.PP +The following resources are specified as part of the \fItek4014\fP widget +(class \fITek4014\fP): +.\".in +1in +.TP 8 +.B "width (\fPclass\fB Width)" +Specifies the width of the Tektronix window in pixels. +.TP 8 +.B "height (\fPclass\fB Height)" +Specifies the height of the Tektronix window in pixels. +.TP 8 +.B "fontLarge (\fPclass\fB Font)" +Specifies the large font to use in the Tektronix window. +.TP 8 +.B "font2 (\fPclass\fB Font)" +Specifies font number 2 to use in the Tektronix window. +.TP 8 +.B "font3 (\fPclass\fB Font)" +Specifies font number 3 to use in the Tektronix window. +.TP 8 +.B "fontSmall (\fPclass\fB Font)" +Specifies the small font to use in the Tektronix window. +.TP 8 +.B "initialFont (\fPclass\fB InitialFont)" +Specifies which of the four Tektronix fonts to use initially. +Values are the same as for the \fIset-tek-text\fP action. +The default is ``large.'' +.TP 8 +.B "ginTerminator (\fPclass\fB GinTerminator)" +Specifies what character(s) should follow a GIN report or status report. +The possibilities are ``none,'' which sends no terminating characters, +``CRonly,'' which sends CR, and ``CR&EOT,'' which sends both CR and EOT. +The default is ``none.'' +.\".in -1in +.sp +.PP +The resources that may be specified for the various menus are described in +the documentation for the Athena \fBSimpleMenu\fP widget. The name and classes +of the entries in each of the menus are listed below. +.PP +The \fImainMenu\fP has the following entries: +.\".in +1in +.TP 8 +.B "securekbd (\fPclass\fB SmeBSB)" +This entry invokes the \fBsecure()\fP action. +.TP 8 +.B "allowsends (\fPclass\fB SmeBSB)" +This entry invokes the \fBallow-send-events(toggle)\fP action. +.TP 8 +.B "logging (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-logging(toggle)\fP action. +.TP 8 +.B "redraw (\fPclass\fB SmeBSB)" +This entry invokes the \fBredraw()\fP action. +.TP 8 +.B "line1 (\fPclass\fB SmeLine)" +This is a separator. +.TP 8 +.B "suspend (\fPclass\fB SmeBSB)" +This entry invokes the \fBsend-signal(tstp)\fP action on systems that +support job control. +.TP 8 +.B "continue (\fPclass\fB SmeBSB)" +This entry invokes the \fBsend-signal(cont)\fP action on systems that +support job control. +.TP 8 +.B "interrupt (\fPclass\fB SmeBSB)" +This entry invokes the \fBsend-signal(int)\fP action. +.TP 8 +.B "hangup (\fPclass\fB SmeBSB)" +This entry invokes the \fBsend-signal(hup)\fP action. +.TP 8 +.B "terminate (\fPclass\fB SmeBSB)" +This entry invokes the \fBsend-signal(term)\fP action. +.TP 8 +.B "kill (\fPclass\fB SmeBSB)" +This entry invokes the \fBsend-signal(kill)\fP action. +.TP 8 +.B "line2 (\fPclass\fB SmeLine)" +This is a separator. +.TP 8 +.B "quit (\fPclass\fB SmeBSB)" +This entry invokes the \fBquit()\fP action. +.\".in -1in +.sp +.PP +The \fIvtMenu\fP has the following entries: +.\".in +1in +.TP 8 +.B "scrollbar (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-scrollbar(toggle)\fP action. +.TP 8 +.B "jumpscroll (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-jumpscroll(toggle)\fP action. +.TP 8 +.B "reversevideo (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-reverse-video(toggle)\fP action. +.TP 8 +.B "autowrap (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-autowrap(toggle)\fP action. +.TP 8 +.B "reversewrap (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-reversewrap(toggle)\fP action. +.TP 8 +.B "autolinefeed (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-autolinefeed(toggle)\fP action. +.TP 8 +.B "appcursor (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-appcursor(toggle)\fP action. +.TP 8 +.B "appkeypad (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-appkeypad(toggle)\fP action. +.TP 8 +.B "scrollkey (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-scroll-on-key(toggle)\fP action. +.TP 8 +.B "scrollttyoutput (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-scroll-on-tty-output(toggle)\fP action. +.TP 8 +.B "allow132 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-allow132(toggle)\fP action. +.TP 8 +.B "cursesemul (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-cursesemul(toggle)\fP action. +.TP 8 +.B "visualbell (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-visualbell(toggle)\fP action. +.TP 8 +.B "marginbell (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-marginbell(toggle)\fP action. +.TP 8 +.B "altscreen (\fPclass\fB SmeBSB)" +This entry is currently disabled. +.TP 8 +.B "line1 (\fPclass\fB SmeLine)" +This is a separator. +.TP 8 +.B "softreset (\fPclass\fB SmeBSB)" +This entry invokes the \fBsoft-reset()\fP action. +.TP 8 +.B "hardreset (\fPclass\fB SmeBSB)" +This entry invokes the \fBhard-reset()\fP action. +.TP 8 +.B "clearsavedlines" (\fPclass\fB SmeBSB)" +This entry invokes the \fBclear-saved-lines()\fP action. +.TP 8 +.B "line2 (\fPclass\fB SmeLine)" +This is a separator. +.TP 8 +.B "tekshow (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-visibility(tek,toggle)\fP action. +.TP 8 +.B "tekmode (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-terminal-type(tek)\fP action. +.TP 8 +.B "vthide (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-visibility(vt,off)\fP action. +.\".in -1in +.sp +.PP +The \fIfontMenu\fP has the following entries: +.\".in +1in +.TP 8 +.B "fontdefault (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(d)\fP action. +.TP 8 +.B "font1 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(1)\fP action. +.TP 8 +.B "font2 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(2)\fP action. +.TP 8 +.B "font3 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(3)\fP action. +.TP 8 +.B "font4 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(4)\fP action. +.TP 8 +.B "font5 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(5)\fP action. +.TP 8 +.B "font6 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(6)\fP action. +.TP 8 +.B "fontescape (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(e)\fP action. +.TP 8 +.B "fontsel (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-vt-font(s)\fP action. +.\".in -1in +.sp +.PP +The \fItekMenu\fP has the following entries: +.\".in +1in +.TP 8 +.B "tektextlarge (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-tek-text(l)\fP action. +.TP 8 +.B "tektext2 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-tek-text(2)\fP action. +.TP 8 +.B "tektext3 (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-tek-text(3)\fP action. +.TP 8 +.B "tektextsmall (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-tek-text(s)\fP action. +.TP 8 +.B "line1 (\fPclass\fB SmeLine)" +This is a separator. +.TP 8 +.B "tekpage (\fPclass\fB SmeBSB)" +This entry invokes the \fBtek-page()\fP action. +.TP 8 +.B "tekreset (\fPclass\fB SmeBSB)" +This entry invokes the \fBtek-reset()\fP action. +.TP 8 +.B "tekcopy (\fPclass\fB SmeBSB)" +This entry invokes the \fBtek-copy()\fP action. +.TP 8 +.B "line2 (\fPclass\fB SmeLine)" +This is a separator. +.TP 8 +.B "vtshow (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-visibility(vt,toggle)\fP action. +.TP 8 +.B "vtmode (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-terminal-type(vt)\fP action. +.TP 8 +.B "tekhide (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-visibility(tek,toggle)\fP action. +.\".in -1in +.sp +.PP +The following resources are useful when specified for the Athena Scrollbar +widget: +.\".in +1in +.TP 8 +.B "thickness (\fPclass\fB Thickness)" +Specifies the width in pixels of the scrollbar. +.TP 8 +.B "background (\fPclass\fB Background)" +Specifies the color to use for the background of the scrollbar. +.TP 8 +.B "foreground (\fPclass\fB Foreground)" +Specifies the color to use for the foreground of the scrollbar. The ``thumb'' +of the scrollbar is a simple checkerboard pattern alternating pixels for +foreground and background color. +.\".in -1in +.SH "POINTER USAGE" +.PP +Once the VT102 window is created, +.I xterm +allows you to select text and copy it within the same or other windows. +.PP +The selection functions are invoked when the pointer buttons are used with no +modifiers, and when they are used with the ``shift'' key. +The assignment of the functions described below to keys and buttons may +be changed through the resource database; see \fBACTIONS\fP below. +.PP +Pointer button one (usually left) is used to save text into the cut buffer. +Move the cursor to beginning of the text, +and then hold the button down while moving the cursor to the end of the region +and releasing the button. +The selected text is highlighted and is saved in the global cut buffer +and made the PRIMARY selection when +the button is released. Double-clicking selects by words. Triple-clicking +selects by lines. Quadruple-clicking goes back to characters, etc. +Multiple-click is determined by the time from button up to +button down, so you can change the selection unit in the middle of a selection. +If the key/button bindings specify that an X selection is to be made, +\fIxterm\fP will leave the selected text highlighted for as long as it +is the selection owner. +.PP +Pointer button two (usually middle) `types' (pastes) the text from +the PRIMARY selection, if any, otherwise from +the cut buffer, +inserting it as keyboard input. +.PP +Pointer button three (usually right) extends the current selection. +(Without loss of generality, +you can swap ``right'' and ``left'' everywhere in the rest of this +paragraph.) If pressed while closer to +the right edge of the selection than the left, it extends/contracts the +right edge of the selection. If you contract the selection past +the left edge of the selection, +.I xterm +assumes you really meant the left edge, restores the original selection, then +extends/contracts the left edge of the selection. Extension starts in the +selection unit mode +that the last selection or extension was performed in; you can multiple-click +to cycle through them. +.PP +By cutting and pasting pieces of text without trailing new lines, +you can take text from several places in different windows and form a command +to the shell, for example, or take output from a program and insert it into +your favorite editor. +Since the cut buffer is globally shared among different applications, +you should regard it as a `file' whose contents you know. +The terminal emulator and other text programs should be treating it as if it +were a text file, i.e., the text is delimited by new lines. +.PP +The scroll region displays the position and amount of text currently showing +in the window (highlighted) relative to the amount of text actually saved. +As more text is saved (up to the maximum), the size of the highlighted area +decreases. +.PP +Clicking button one with the pointer in the scroll region moves the +adjacent line to the top of the display window. +.PP +Clicking button three moves the top line of the display window down to the +pointer position. +.PP +Clicking button two moves the display to a position in the saved text +that corresponds to the pointer's position in the scrollbar. +.PP +.PP +Unlike the VT102 window, the Tektronix window dows not allow the copying of +text. +It does allow Tektronix GIN mode, and in this mode +the cursor will change from an arrow to a cross. +Pressing any key will send that key and the current coordinate of the +cross cursor. +Pressing button one, two, or three will return the letters `l', `m', and +`r', respectively. +If the `shift' key is pressed when a pointer button is pressed, the corresponding +upper case letter is sent. +To distinguish a pointer button from a key, the high bit of the character is +set (but this is bit is normally stripped unless the terminal mode is RAW; +see +.IR tty (4) +for details). +.SH MENUS +.PP +.I Xterm +has four menus, named +.IR mainMenu , +.IR vtMenu , +.IR fontMenu , +and +.IR tekMenu . +Each menu pops up under the correct combinations of key and button presses. +Most menus are divided into two section, separated by a horizontal line. +The top portion contains various modes that can be altered. +A check mark appears next to a mode that is currently active. +Selecting one of these modes toggles its state. +The bottom portion of the menu are command entries; selecting one of these +performs the indicated function. +.PP +The +.B xterm +menu pops up when the ``control'' key and pointer button one are +pressed in a window. +The \fImainMenu\fP contains items that apply to both the VT102 and Tektronix +windows. +The +.B Secure Keyboard +mode is be used when typing in passwords or other sensitive data in an +unsecure environment; +see \fBSECURITY\fP below. +Notable entries in the command section of the menu are the +.BR Continue , +.BR Suspend , +.BR Interrupt , +.BR Hangup , +.B Terminate +and +.B Kill +which sends the SIGCONT, SIGTSTP, SIGINT, SIGHUP, SIGTERM and +SIGKILL signals, respectively, to the process group of the process running +under +.I xterm +(usually the shell). +The +.B Continue +function is especially useful if the user has accidentally typed CTRL-Z, +suspending the process. +.PP +The +.I vtMenu +sets various modes in the VT102 emulation, and is popped up when the +``control'' key and pointer button two are pressed in the VT102 window. +In the command section of this menu, the soft reset entry will reset +scroll regions. +This can be convenient when some program has left the scroll regions +set incorrectly (often a problem when using VMS or TOPS-20). +The full reset entry will clear the screen, reset tabs to every +eight columns, and reset the terminal modes (such as wrap and smooth scroll) +to their initial states just after +.I xterm +has finished processing the command line options. +.PP +The \fIfontMenu\fP sets the font used in the VT102 window. +In addition to the default font and a number of alternatives that are +set with resources, the menu offers the font last specified by the Set +Font escape sequence (see the document \fIXterm Control Sequences\fP) +and the current selection as a font name (if the PRIMARY selection is owned). +.PP +The +.I tekMenu +sets various modes in the Tektronix emulation, and is popped up when the +``control'' key and pointer button two are pressed in the Tektronix window. +The current font size is checked in the modes section of the menu. +The +.B PAGE +entry in the command section clears the Tektronix window. +.SH SECURITY +.PP +X environments differ in their security consciousness. MIT servers, run +under \fIxdm\fP, are capable of using a ``magic cookie'' authorization +scheme that can provide a reasonable level of security for many people. +If your server is only using a host-based mechanism to control access to +the server (see \fIxhost(1)\fP), then if you enable access for a host and +other users are also permitted to run clients on that same host, there is +every possibility that someone can run an application that will use the +basic services of the X protocol to snoop on your activities, potentially +capturing a transcript of everything you type at the keyboard. +This is of particular concern when you want to type in a password or other +sensitive data. The best solution to this problem is to use a better +authorization mechanism that host-based control, but a simple +mechanism exists for protecting keyboard input in \fIxterm\fP. +.PP +The \fBxterm\fP menu (see \fBMENUS\fP above) contains a \fBSecure Keyboard\fP +entry which, when enabled, ensures that all keyboard input is directed +\fIonly\fP to \fIxterm\fP (using the GrabKeyboard protocol request). +When an application prompts you for a password +(or other sensitive data), you can enable \fBSecure Keyboard\fP using the +menu, type in the data, and then disable \fBSecure Keyboard\fP using +the menu again. Only one X client at a time can secure the keyboard, +so when you attempt to enable \fBSecure Keyboard\fP it may fail. In +this case, the bell will sound. If the \fBSecure Keyboard\fP succeeds, +the foreground and background colors will be exchanged (as if you +selected the \fBReverse Video\fP entry in the \fBModes\fP menu); +they will be exchanged again when you exit secure mode. If the colors +do \fInot\fP switch, then +you should be \fIvery\fP suspicious that you are being spoofed. If +the application you are running displays a prompt before asking for +the password, it is safest to enter secure mode \fIbefore\fP the +prompt gets displayed, and to make sure that the prompt gets displayed +correctly (in the new colors), to minimize the probability of +spoofing. You can also bring up the menu again and make sure that a check +mark appears next to the entry. +.PP +\fBSecure Keyboard\fP mode will be disabled automatically if your xterm +window becomes iconified (or otherwise unmapped), or if you start up +a reparenting window manager (that places a title bar or other decoration +around the window) while in \fBSecure Keyboard\fP mode. (This is a +feature of the X protocol not easily overcome.) When this happens, +the foreground and background colors will be switched back and the bell +will sound in warning. +.SH "CHARACTER CLASSES" +Clicking the middle mouse button twice in rapid succession will cause all +characters of the same class (e.g. letters, white space, punctuation) to be +selected. Since different people have different preferences for what should +be selected (for example, should filenames be selected as a whole or only +the separate subnames), the default mapping can be overridden through the use +of the \fIcharClass\fP (class \fICharClass\fP) resource. +.PP +This resource is simply a list of \fIrange\fP:\fIvalue\fP pairs where the +range is either a single number or \fIlow\fP-\fIhigh\fP in the range of 0 +to 127, corresponding to the ASCII code for the character or characters to be +set. The \fIvalue\fP is arbitrary, although the default table uses the +character number of the first character occurring in the set. +.PP +The default table is +.sp +.in +8 +.ft C \" Courier +.nf +static int charClass[128] = { +/* NUL SOH STX ETX EOT ENQ ACK BEL */ + 32, 1, 1, 1, 1, 1, 1, 1, +/* BS HT NL VT NP CR SO SI */ + 1, 32, 1, 1, 1, 1, 1, 1, +/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* CAN EM SUB ESC FS GS RS US */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* SP ! " # $ % & ' */ + 32, 33, 34, 35, 36, 37, 38, 39, +/* ( ) * + , \- . / */ + 40, 41, 42, 43, 44, 45, 46, 47, +/* 0 1 2 3 4 5 6 7 */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* 8 9 : ; < = > ? */ + 48, 48, 58, 59, 60, 61, 62, 63, +/* @ A B C D E F G */ + 64, 48, 48, 48, 48, 48, 48, 48, +/* H I J K L M N O */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* P Q R S T U V W */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* X Y Z [ \\ ] ^ _ */ + 48, 48, 48, 91, 92, 93, 94, 48, +/* ` a b c d e f g */ + 96, 48, 48, 48, 48, 48, 48, 48, +/* h i j k l m n o */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* p q r s t u v w */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* x y z { | } ~ DEL */ + 48, 48, 48, 123, 124, 125, 126, 1}; +.fi +.ft P +.in -8 +.sp +For example, the string ``33:48,37:48,45-47:48,64:48'' indicates that the +exclamation mark, percent sign, dash, period, slash, and ampersand characters +should be treated the same way as characters and numbers. This is very useful +for cutting and pasting electronic mailing addresses and filenames. +.SH ACTIONS +It is possible to rebind keys (or sequences of keys) to arbitrary strings +for input, by changing the translations for the vt100 or tek4014 widgets. +Changing the translations for events other than key and button events +is not expected, and will cause unpredictable behavior. The following +actions are provided for using within the \fIvt100\fP or \fItek4014\fP +\fBtranslations\fP resources: +.TP 8 +.B "bell([\fIpercent\fP])" +This action rings the keyboard bell at the specified percentage +above or below the base volume. +.TP 8 +.B "ignore()" +This action ignores the event but checks for special pointer position +escape sequences. +.TP 8 +.B "insert()" +This action inserts the character or string associated with +the key that was pressed. +.TP 8 +.B "insert-seven-bit()" +This action is a synonym for \fBinsert()\fP +.TP 8 +.B "insert-eight-bit()" +This action inserts an eight-bit (Meta) version of the character or string +associated with the key that was pressed. +The exact action depends on the value of the \fBeightBitInput\fP resource. +.TP 8 +.B "insert-selection(\fIsourcename\fP [, ...])" +This action inserts the string found in the selection or cutbuffer indicated +by \fIsourcename\fP. Sources are checked in the order given (case is +significant) until one is found. Commonly-used selections include: +\fIPRIMARY\fP, \fISECONDARY\fP, and \fICLIPBOARD\fP. Cut buffers are +typically named \fICUT_BUFFER0\fP through \fICUT_BUFFER7\fP. +.TP 8 +.B "keymap(\fIname\fP)" +This action dynamically defines a new translation table whose resource +name is \fIname\fP with the suffix \fIKeymap\fP (case is significant). +The name \fINone\fP restores the original translation table. +.TP 8 +.B "popup-menu(\fImenuname\fP)" +This action displays the specified popup menu. Valid names (case is +significant) include: \fImainMenu\fP, \fIvtMenu\fP, \fIfontMenu\fP, +and \fItekMenu\fP. +.TP 8 +.B "secure()" +This action toggles the \fISecure Keyboard\fP mode described in the +section named \fBSECURITY\fP, and is invoked from the \fBsecurekbd\fP +entry in \fImainMenu\fP. +.TP 8 +.B "select-start()" +This action begins text selection at the current pointer location. See +the section on \fBPOINTER USAGE\fP for information on making selections. +.TP 8 +.B "select-extend()" +This action tracks the pointer and extends the selection. It +should only be bound to Motion events. +.TP 8 +.B "select-end(\fIdestname\fP [, ...])" +This action puts the currently selected text into all of the selections or +cutbuffers specified by \fIdestname\fP. +.TP 8 +.B "select-cursor-start()" +This action is similar to \fBselect-start\fP except that it begins the +selection at the current text cursor position. +.TP 8 +.B "select-cursor-end(\fIdestname\fP [, ...])" +This action is similar to \fBselect-end\fP except that it should be used +with \fBselect-cursor-start\fP. +.TP 8 +.B "set-vt-font(\fId/1/2/3/4/5/6/e/s\fP [,\fInormalfont\fP [, \fIboldfont\fP]])" +This action sets the font or fonts currently being used in the VT102 window. +The first argument is a single character that specifies the font to be +used: \fId\fP or \fID\fP indicate the default font (the font initially +used when +\fIxterm\fP was started), \fI1\fP through \fI6\fP indicate the fonts +specified by the \fIfont1\fP through \fIfont6\fP resources, \fIe\fP or \fIE\fP +indicate the normal and bold fonts that have been set through escape codes +(or specified as the second and third action arguments, respectively), and +\fIs\fP or \fIS\fP indicate the font selection (as made by programs such as +\fIxfontsel(1)\fP) indicated by the second action argument. +.TP 8 +.B "start-extend()" +This action is similar to \fBselect-start\fP except that the +selection is extended to the current pointer location. +.TP 8 +.B "start-cursor-extend()" +This action is similar to \fBselect-extend\fP except that the +selection is extended to the current text cursor position. +.TP 8 +.B "string(\fIstring\fP)" +This action inserts the specified text string as if it had been typed. +Quotation is necessary if the string contains whitespace or +non-alphanumeric characters. If the string argument begins with the +characters ``0x'', it is interpreted +as a hex character constant. +.TP 8 +.B "scroll-back(\fIcount\fP [,\fIunits\fP])" +This action scrolls the text window backward so that text that had previously +scrolled off the top of the screen is now visible. The \fIcount\fP argument +indicates the number of \fIunits\fP (which may be \fIpage\fP, \fIhalfpage\fP, +\fIpixel\fP, or \fIline\fP) by which to scroll. +.TP 8 +.B "scroll-forw(\fIcount\fP [,\fIunits\fP])" +This action scrolls is similar to \fBscroll-back\fP except that it scrolls +the other direction. +.TP 8 +.B "allow-send-events(\fIon/off/toggle\fP)" +This action set or toggles the \fBallowSendEvents\fP resource and is also +invoked by the \fBallowsends\fP entry in \fImainMenu\fP. +.TP 8 +.B "set-logging(\fIon/off/toggle\fP)" +This action toggles the \fBlogging\fP resource and is also invoked +by the \fBlogging\fP entry in \fImainMenu\fP. +.TP 8 +.B "redraw()" +This action redraws the window and is also invoked by the +\fIredraw\fP entry in \fImainMenu\fP. +.TP 8 +.B "send-signal(\fIsigname\fP)" +This action sends the signal named by \fIsigname\fP +to the \fIxterm\fP subprocess (the shell or program specified with +the \fI\-e\fP command line option) and is also invoked by the +.BR suspend , +.BR continue , +.BR interrupt , +.BR hangup , +.BR terminate , +and +.I kill +entries in \fImainMenu\fP. Allowable signal names are (case is +not significant): +\fItstp\fP (if supported by the operating system), \fIsuspend\fP (same +as \fItstp\fP), \fIcont\fP +(if supported by the operating system), \fIint\fP, \fIhup\fP, \fIterm\fP, +\fIquit\fP, +\fIalrm\fP, \fIalarm\fP (same as \fIalrm\fP) and \fIkill\fP. +.TP 8 +.B "quit()" +This action sends a SIGHUP to the subprogram and exits. It is also invoked +by the \fBquit\fP entry in \fImainMenu\fP. +.TP 8 +.B "set-scrollbar(\fIon/off/toggle\fP)" +This action toggles the \fBscrollbar\fP resource and is also invoked by +the \fBscrollbar\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-jumpscroll(\fIon/off/toggle\fP)" +This action toggles the \fBjumpscroll\fP resource and is also invoked by the +\fBjumpscroll\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-reverse-video(\fIon/off/toggle\fP)" +This action toggles the \fIreverseVideo\fP resource and is also invoked by +the \fBreversevideo\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-autowrap(\fIon/off/toggle\fP)" +This action toggles automatic wrapping of long lines and is also invoked by +the \fBautowrap\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-reversewrap(\fIon/off/toggle\fP)" +This action toggles the \fBreverseWrap\fP resource and is also invoked by +the \fBreversewrap\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-autolinefeed(\fIon/off/toggle\fP)" +This action toggles automatic insertion of linefeeds and is also invoked by +the \fBautolinefeed\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-appcursor(\fIon/off/toggle\fP)" +This action toggles the handling Application Cursor Key mode +and is also invoked by the \Bappcursor\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-appkeypad(\fIon/off/toggle\fP)" +This action toggles the handling of Application Keypad mode and is also +invoked by the \fBappkeypad\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-scroll-on-key(\fIon/off/toggle\fP)" +This action toggles the \fBscrollKey\fP resource and is also invoked from +the \fBscrollkey\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-scroll-on-tty-output(\fIon/off/toggle\fP)" +This action toggles the \fBscrollTtyOutput\fP resource and is also invoked +from the \fBscrollttyoutput\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-allow132(\fIon/off/toggle\fP)" +This action toggles the \fBc132\fP resource and is also invoked from the +\fBallow132\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-cursesemul(\fIon/off/toggle\fP)" +This action toggles the \fBcurses\fP resource and is also invoked from the +\fBcursesemul\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-visual-bell(\fIon/off/toggle\fP)" +This action toggles the \fBvisualBell\fP resource and is also invoked +by the \fBvisualbell\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-marginbell(\fIon/off/toggle\fP)" +This action toggles the \fBmarginBell\fP resource and is also invoked from +the \fBmarginbell\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-altscreen(\fIon/off/toggle\fP)" +This action toggles between the alternate and current screens. +.TP 8 +.B "soft-reset()" +This action resets the scrolling region and is also invoked from the +\fBsoftreset\fP entry in \fIvtMenu\fP. +.TP 8 +.B "hard-reset()" +This action resets the scrolling region, tabs, window size, and cursor keys +and clears the screen. It is also invoked from the \fBhardreset\fP +entry in \fIvtMenu\fP. +.TP 8 +.B "clear-saved-lines()" +This action does \fBhard-reset()\fP (see above) and also clears the history +of lines saved off the top of the screen. +It is also invoked from the \fBclearsavedlines\fP entry in \fIvtMenu\fP. +.TP 8 +.B "set-terminal-type(\fItype\fP)" +This action directs output to either the \fIvt\fP or \fItek\fP windows, +according to the \fItype\fP string. It is also invoked by the +\fBtekmode\fP entry in \fIvtMenu\fP and the \fBvtmode\fP entry in +\fItekMenu\fP. +.TP 8 +.B "set-visibility(\fIvt/tek\fP,\fIon/off/toggle\fP)" +This action controls whether or not the \fIvt\fP or \fItek\fP windows are +visible. It is also invoked from the \fBtekshow\fP and \fBvthide\fP entries +in \fIvtMenu\fP and the \fBvtshow\fP and \fBtekhide\fP entries in +\fItekMenu\fP. +.TP 8 +.B "set-tek-text(\fIlarge/2/3/small\fP)" +This action sets font used in the Tektronix window to the value of the +resources \fBtektextlarge\fP, \fBtektext2\fP, \fBtektext3\fP, and +\fBtektextsmall\fP according to the argument. It is also by the entries +of the same names as the resources in \fItekMenu\fP. +.TP 8 +.B "tek-page()" +This action clears the Tektronix window and is also invoked by the +\fBtekpage\fP entry in \fItekMenu\fP. +.TP 8 +.B "tek-reset()" +This action resets the Tektronix window and is also invoked by the +\fItekreset\fP entry in \fItekMenu\fP. +.TP 8 +.B "tek-copy()" +This action copies the escape codes used to generate the current window +contents to a file in the current directory beginning with the name COPY. +It is also invoked from the \fItekcopy\fP entry in \fItekMenu\fP. +.TP 8 +.B "visual-bell()" +This action flashes the window quickly. +.PP +The Tektronix window also has the following action: +.TP 8 +.B "gin-press(\fIl/L/m/M/r/R\fP)" +This action sends the indicated graphics input code. +.PP +The default bindings in the VT102 window are: +.sp +.in +4 +.DS +.TA 2.5i +.ta 2.5i +.nf + Shift <KeyPress> Prior: scroll-back(1,halfpage) \\n\\ + Shift <KeyPress> Next: scroll-forw(1,halfpage) \\n\\ +Shift <KeyPress> Select: select-cursor-start() \\ + select-cursor-end(PRIMARY, CUT_BUFFER0) \\n\\ +Shift <KeyPress> Insert: insert-selection(PRIMARY, CUT_BUFFER0) \\n\\ + ~Meta<KeyPress>: insert-seven-bit() \\n\\ + Meta<KeyPress>: insert-eight-bit() \\n\\ + !Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\ + !Lock Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\ + ~Meta <Btn1Down>: select-start() \\n\\ + ~Meta <Btn1Motion>: select-extend() \\n\\ + !Ctrl <Btn2Down>: popup-menu(vtMenu) \\n\\ + !Lock Ctrl <Btn2Down>: popup-menu(vtMenu) \\n\\ + ~Ctrl ~Meta <Btn2Down>: ignore() \\n\\ + ~Ctrl ~Meta <Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0) \\n\\ + !Ctrl <Btn3Down>: popup-menu(fontMenu) \\n\\ + !Lock Ctrl <Btn3Down>: popup-menu(fontMenu) \\n\\ + ~Ctrl ~Meta <Btn3Down>: start-extend() \\n\\ + ~Meta <Btn3Motion>: select-extend() \\n\\ + <BtnUp>: select-end(PRIMARY, CUT_BUFFER0) \\n\\ + <BtnDown>: bell(0) +.fi +.DE +.sp +.in -4 +.PP +The default bindings in the Tektronix window are: +.sp +.in +4 +.DS +.TA 2.5i +.ta 2.5i +.nf + ~Meta<KeyPress>: insert-seven-bit() \\n\\ + Meta<KeyPress>: insert-eight-bit() \\n\\ + !Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\ +!Lock Ctrl <Btn1Down>: popup-menu(mainMenu) \\n\\ + !Ctrl <Btn2Down>: popup-menu(tekMenu) \\n\\ +!Lock Ctrl <Btn2Down>: popup-menu(tekMenu) \\n\\ +Shift ~Meta<Btn1Down>: gin-press(L) \\n\\ + ~Meta<Btn1Down>: gin-press(l) \\n\\ +Shift ~Meta<Btn2Down>: gin-press(M) \\n\\ + ~Meta<Btn2Down>: gin-press(m) \\n\\ +Shift ~Meta<Btn3Down>: gin-press(R) \\n\\ + ~Meta<Btn3Down>: gin-press(r) +.fi +.DE +.sp +.in -4 +.PP +Below is a sample how of the \fBkeymap()\fP action is used to add special +keys for entering commonly-typed works: +.sp +.in +4 +.nf +.DS +.TA .5i 1.5i +.ta .5i 1.5i +.nf +*VT100.Translations: #override <Key>F13: keymap(dbx) +*VT100.dbxKeymap.translations: \\ + <Key>F14: keymap(None) \\n\\ + <Key>F17: string("next") string(0x0d) \\n\\ + <Key>F18: string("step") string(0x0d) \\n\\ + <Key>F19: string("continue") string(0x0d) \\n\\ + <Key>F20: string("print ") insert-selection(PRIMARY, CUT_BUFFER0) +.fi +.DE +.sp +.in -4 +.SH ENVIRONMENT +.I Xterm +sets the environment variables ``TERM'' and ``TERMCAP'' properly for the +size window you have created. +It also uses and sets the environment +variable ``DISPLAY'' to specify which bit map display terminal to use. +The environment variable ``WINDOWID'' is set to the X window id number +of the +.I xterm +window. +.SH "SEE ALSO" +resize(1), X(1), pty(4), tty(4) +.br +\fIXterm Control Sequences\fP (in the \fIxterm\fP source directory) +.SH BUGS +.PP +Large pastes do not work on some systems. This is not a bug in +\fIxterm\fP; it is a bug in the pseudo terminal driver of those +systems. \fIxterm\fP feeds large pastes to the pty only as fast as the pty +will accept data, but some pty drivers do not return enough information +to know if the write has succeeded. +.PP +Many of the options are not resettable after +.I xterm +starts. +.PP +The Tek widget does not support key/button re-binding. +.PP +Only fixed-width, character-cell fonts are supported. +.PP +This program still needs to be rewritten. It should be split into very +modular sections, with the various emulators being completely separate +widgets that don't know about each other. Ideally, you'd like to be able to +pick and choose emulator widgets and stick them into a single control widget. +.PP +There needs to be a dialog box to allow entry of log file name +and the COPY file name. +.SH COPYRIGHT +Copyright 1989, Massachusetts Institute of Technology. +.br +See \fIX(1)\fP for a full statement of rights and permissions. +.SH AUTHORS +Far too many people, including: +.sp +Loretta Guarino Reid (DEC-UEG-WSL), +Joel McCormack (DEC-UEG-WSL), Terry Weissman (DEC-UEG-WSL), +Edward Moy (Berkeley), Ralph R. Swick (MIT-Athena), +Mark Vandevoorde (MIT-Athena), Bob McNamara (DEC-MAD), +Jim Gettys (MIT-Athena), Bob Scheifler (MIT X Consortium), Doug Mink (SAO), +Steve Pitschke (Stellar), Ron Newman (MIT-Athena), Jim Fulton (MIT X +Consortium), Dave Serisky (HP), Jonathan Kamens (MIT-Athena) + diff --git a/vendor/x11iraf/xgterm/z b/vendor/x11iraf/xgterm/z new file mode 100755 index 00000000..b7239648 --- /dev/null +++ b/vendor/x11iraf/xgterm/z @@ -0,0 +1,5 @@ +#!/iraf/iraf/bin.macintel/ecl.e -f + +plot +prow dev$pix 23 + diff --git a/vendor/x11iraf/xgterm/zz.c b/vendor/x11iraf/xgterm/zz.c new file mode 100644 index 00000000..9983217d --- /dev/null +++ b/vendor/x11iraf/xgterm/zz.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +main (int argc, char **argv) +{ + char s[128]; + + if (argc) { + printf ("\033[?38h\035\033\033\014"); /* XTerm OW plus GS/ESC/FF */ + +/* printf ("\033[?38h\035^_"); /* XTerm OW plus XGterm OW */ + + } else + printf ("\035^_"); /* XGterm OW */ +} diff --git a/vendor/x11iraf/ximtool/.alias b/vendor/x11iraf/ximtool/.alias new file mode 100644 index 00000000..21e56fc4 --- /dev/null +++ b/vendor/x11iraf/ximtool/.alias @@ -0,0 +1,5 @@ + +alias mx "c;make ; ./ximtool -gui ximtool-alt.gui zz.fits" +alias x "c;./ximtool -gui ximtool-alt.gui zz.fits" +alias z "c;(chdir gui; mkgui) ; ./ximtool -gui ximtool-alt.gui zz.fits" +alias zz "c;(chdir gui; mkgui) ; make; ./ximtool -gui ximtool-alt.gui zz.fits" diff --git a/vendor/x11iraf/ximtool/.gdb_history b/vendor/x11iraf/ximtool/.gdb_history new file mode 100644 index 00000000..9967bc5e --- /dev/null +++ b/vendor/x11iraf/ximtool/.gdb_history @@ -0,0 +1,33 @@ +b bob +run -gui xmin.gui +wgere +where +s +p w->gterm.window +p *w->gterm.window +s +p gc +p *gc +c +s +p w->gterm.window +quit +quit +b wcs_update +run +quit +b wcs_update +run +quit +b wcs_update +run +where +c +c +quit +run +where +quit +run +where +quit diff --git a/vendor/x11iraf/ximtool/BUGS b/vendor/x11iraf/ximtool/BUGS new file mode 100644 index 00000000..5d6a3bbe --- /dev/null +++ b/vendor/x11iraf/ximtool/BUGS @@ -0,0 +1,196 @@ +From stetson@dao.nrc.ca Fri Aug 16 14:21:30 1996 +Received: from noao.edu by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA19724; Fri, 16 Aug 96 14:21:28 MST; for fitz +Received: from dao.nrc.ca (dns.dao.nrc.ca [204.174.103.34]) by noao.edu (8.7.5/8.7.3/SAG-16Aug96) with SMTP id OAA09562 for <fitz@noao.edu>; Fri, 16 Aug 1996 14:21:25 -0700 (MST) +Received: from kwakiutl.nrc.ca by dao.nrc.ca (5.x/SMI-SVR4) + id AA02855; Fri, 16 Aug 1996 14:21:11 -0700 +Received: by kwakiutl.nrc.ca (5.x/SMI-SVR4) + id AA29687; Fri, 16 Aug 1996 14:16:17 -0700 +Date: Fri, 16 Aug 1996 14:16:17 -0700 +From: stetson@dao.nrc.ca (Peter B. Stetson) +Message-Id: <9608162116.AA29687@kwakiutl.nrc.ca> +To: fitz@noao.edu +Subject: Re: two more +Content-Length: 529 +X-Lines: 16 +Status: RO +X-Status: + +Not only does it not reset the toggle on the control panel, it doesn't +seem to cause antialiasing to happen in the main window. + +I am certain that I am not zooming into a blank area of the image. +I am zooming onto the center of the image. Zoom factors + +1 2 3 4 5 6 7 8 + +work fine, but when I go from 8 to 9 the image goes black, going back +to 8 the image reappears. Like other apparent Ximtool anomalies, this +may be a function of my having an oldish X-terminal with 8 Mbytes of +memory? + +Obviously, none of this is vital. + +PBS + +From sharp@noao.edu Fri Sep 20 00:21:01 1996 +Received: from noao.edu by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA00715; Fri, 20 Sep 96 00:20:59 MST; for fitz +Received: from robur.tuc.noao.edu (robur.tuc.noao.edu [140.252.1.10]) by noao.edu (8.7.5/8.7.3/SAG-16Aug96) with SMTP id AAA28798 for <fitz@noao.edu>; Fri, 20 Sep 1996 00:20:57 -0700 (MST) +Received: by vms.noao.edu (MX V4.1 VAX) id 3; Fri, 20 Sep 1996 00:20:53 MST +Sender: sharp@noao.edu +Date: Fri, 20 Sep 1996 00:20:52 MST +From: Nigel Sharp <sharp@vms.noao.edu> +Reply-To: sharp@noao.edu +To: fitz@noao.edu +Cc: sharp@noao.edu +Message-Id: <009A8A12.0BC5D9B4.3@vms.noao.edu> +Subject: Re: ximtool +Status: RO + +I'll tell you first. +a) sometimes I get a display where the image sent from IRAF appears in + the panner window but not in the main window, no matter where I + move the window around in the whole frame. I have soetimes cured this + by quitting ximtool and restarting it. +b) if I use the auotscale to fit the entire image in the window, and + the frame is not the same aspect ratio as the ximtool window, then + I get residual image in the borders around the shrunk-to-fit full + frame. +I can't get these consistently, although it happened several times this +evening (it makes imedit very tricky when there's no image in the main +ximtool window !!). + +From fitz Fri Sep 20 00:34:38 1996 +Received: by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA03455; Fri, 20 Sep 96 00:34:37 MST; for fitz +Date: Fri, 20 Sep 96 00:34:37 MST +From: fitz (Mike Fitzpatrick) +Message-Id: <9609200734.AA03455@tucana.tuc.noao.edu> +To: sharp +Subject: Re: ximtool +Cc: fitz +Status: RO + +I don't really recognize either problem, but have a few comments + +> a) sometimes I get a display where the image sent from IRAF appears in +> the panner window but not in the main window, no matter where I +> move the window around in the whole frame. I have soetimes cured this +> by quitting ximtool and restarting it. + Was the image zoomed at the time. I do know of a bug where a zoom +factor of 9 causes this, zooming out then back in seems to cure it. + +> b) if I use the auotscale to fit the entire image in the window, and +> the frame is not the same aspect ratio as the ximtool window, then +> I get residual image in the borders around the shrunk-to-fit full frame. + On the wishlist is a 'snap-to-equal-aspect' option, I think this +may be what you're talking about. To be honest I haven't played much with +the autoscale so it could be something else. + I'll have a look at both of these but much can't be done until after +the ADASS unfortunately. I'll see if Doug knows more about these (he was +keeper of the buglist until I started working on it, then I got my own +list of bugs!). + +From sharp@noao.edu Fri Sep 20 00:39:37 1996 +Received: from noao.edu by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA03541; Fri, 20 Sep 96 00:39:33 MST; for fitz +Received: from robur.tuc.noao.edu (robur.tuc.noao.edu [140.252.1.10]) by noao.edu (8.7.5/8.7.3/SAG-16Aug96) with SMTP id AAA28981 for <fitz@noao.edu>; Fri, 20 Sep 1996 00:39:27 -0700 (MST) +Received: by vms.noao.edu (MX V4.1 VAX) id 2; Fri, 20 Sep 1996 00:39:23 MST +Sender: sharp@noao.edu +Date: Fri, 20 Sep 1996 00:39:22 MST +From: Nigel Sharp <sharp@vms.noao.edu> +Reply-To: sharp@noao.edu +To: fitz@noao.edu +Cc: sharp@noao.edu +Message-Id: <009A8A14.A14D0BF4.2@vms.noao.edu> +Subject: Re: ximtool +Status: RO + +Oh, it's not urgent and can certainly wait until after ADASS and beyond, +but no, neither thing you mention seems relevant. I don't want to +go to equal aspect necessarily, I just wondered why the border wasn't +cleared when I zoomed out by using auto, and the former is not affected +by anything I can do - zoom in/out, window, anything - the image is +just not there in the main window. + +Anyway, just so it gets into the system somewhere so I don't feel +quite so lonely with my problems (neither JB nor Dave B had seen or +heard of missing images of this sort). + +Time for me to move on - you go on back to ADASS - or your mailing +problem - I have to sleep for a bit. + +From jacoby@noao.edu Fri Sep 20 17:18:43 1996 +Received: from noao.edu by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA10420; Fri, 20 Sep 96 17:18:40 MST; for fitz +Received: from madrona.tuc.noao.edu (madrona.tuc.noao.edu [140.252.3.86]) by noao.edu (8.7.5/8.7.3/SAG-16Aug96) with SMTP id RAA27447 for <fitz>; Fri, 20 Sep 1996 17:18:35 -0700 (MST) +Received: by madrona.tuc.noao.edu (4.1/SAG.sun.11) + id AA02504; Fri, 20 Sep 96 17:18:35 MST; for fitz +Date: Fri, 20 Sep 96 17:18:35 MST +From: jacoby@noao.edu (George Jacoby X292) +Message-Id: <9609210018.AA02504@madrona.tuc.noao.edu> +To: fitz@noao.edu +Subject: minor bug in ximtool +Status: R + + +Mike, + +It seems that the print window text entry for "lpr" also needs +a CR to accept a revision. For example, if I want to enter "lpr -Plw9", +I must hit CR, or the default of "lpr" is used. + +I haven't looked at the "Save As..." window, but it may suffer similarly. + +George + +From jacoby@noao.edu Wed Nov 27 16:58:07 1996 +Received: from noao.edu by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA06536; Wed, 27 Nov 96 16:58:06 MST; for fitz +Received: from madrona.tuc.noao.edu (madrona.tuc.noao.edu [140.252.3.86]) by noao.edu (8.7.5/8.7.3/SAG-16Aug96) with SMTP id QAA06950 for <fitz>; Wed, 27 Nov 1996 16:58:05 -0700 (MST) +Received: by madrona.tuc.noao.edu (4.1/SAG.sun.11) + id AA28504; Wed, 27 Nov 96 16:58:04 MST; for fitz +Date: Wed, 27 Nov 96 16:58:04 MST +From: jacoby@noao.edu (George Jacoby X292) +Message-Id: <9611272358.AA28504@madrona.tuc.noao.edu> +To: fitz@noao.edu +Subject: ximtool +Status: RO + + +Mike, + +I found a couple of oddities in Ximtool. + +1. Loading an image into a frame buffer clears other frame buffers. + I tried to load a GIF file into frame 1, and another into frame 2. + Only the last image loaded survived. + +2. In the load panel, one must hit RETURN after entering a file name + before the load will occur via the LOAD button. This is similar to + earlier problems with the typing buffers. + +3. Also in a typing buffer, if I highlight text and then begin typing, + I expect the highlighted text to be deleted. Instead, the new text + is inserted along with the old text. + +George + +From dbell@bigx Tue Dec 10 14:21:46 1996 +Received: from bigx.tuc.noao.edu by tucana.tuc.noao.edu (4.1/SAG.sat.14) + id AA26048; Tue, 10 Dec 96 14:21:46 MST; for fitz +Received: by bigx.tuc.noao.edu (4.1/SAG.sat.14) + id AA21334; Tue, 10 Dec 96 14:21:45 MST; for fitz +Date: Tue, 10 Dec 96 14:21:45 MST +From: dbell@bigx (David Bell) +Message-Id: <9612102121.AA21334@bigx.tuc.noao.edu> +To: fitz +Status: RO + + +Warning: Cannot convert string "-adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1" to type FontStruct +Warning: Cannot convert string "-adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1" to type FontStruct +Warning: Cannot convert string "-*-helvetica-medium-r-normal-*-12-*-iso8859-1" to type FontStruct +Warning: Cannot convert string "-adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1" to type FontStruct + diff --git a/vendor/x11iraf/ximtool/BUGS-v2.0 b/vendor/x11iraf/ximtool/BUGS-v2.0 new file mode 100644 index 00000000..bf049f20 --- /dev/null +++ b/vendor/x11iraf/ximtool/BUGS-v2.0 @@ -0,0 +1,56 @@ + 11/1/08 +TODO: +----- + - 15/16/32-bit visual support + +BUGS: +----- +1/13 - Compass needs a redraw after a new image display + - Vertical plot marker slow to update when horizontal plot open +??? - Reports of ism_wcspix.e crash +11/8 - GUI layout sizes when plots are closed + - "X" window button closes entire app +11/7 - Packaging of "-alt" and "-old" versions +11/8 - Max app version +11/1 - Check for "v1.3" in gui/docs + - color9 on plot backgrounds not showing up properly + - Opening vertical cut-plot first expands window too wide, doing + horizontal first is okay + +11/4 - Compass color shows up as red, should be yellow + - Window resize breaks colormap focus box +11/4 - Compass doesn't respond to X/Y flips + - When using image data for cut-plots, need to reset plot scale + - Zoom-out => cursor readout becomes invalid when off-image + => magnifier doesn't show black background, shows parts + of the previous background image +11/10 - Resetting the cmap focus box size to less than the full window + and changing the colormap from the control panel updates only + the focus box on the display. +11/10 - Displaying dev$pix into two frames and using the 'Match' button + doesn't clear the entire frame buffer with the background + color +11/10 - Frames display with different colormaps only update to the size of + the cmap focus box when switching frames. +11/10 - Background and text colors for Tcl shell, Info panel, etc "not right" +11/10 - Ctrl-a sets toggles the Auto-register but doesn't reset the toolbar + button +11/10 - Ctrl-t toggles tile-frame on control panel, but doesn't change + image display or toolbar +11/10 - Alt-c doean't properly toggle the Control Panel +11/18 - BadAlloc from XCreatePixmqp seen on some systems (e.g. Leopard PPC) +12/1 - BadValue error from XQueryColors on Leopard Intel systems. + Complaint is about color '0x2f4f4f' (color9=darkslategrey, used in + hcut/vcut in GUI and main color9 resource definition). Duplicated + on Leopard/PPC but only with 15-plane colors (i.e. 'Thousands' in + X11 display preferences). +11/20 - ISM prints 'bad fd' (and perhaps also a 'memory corrupted') message + when quitting ximtool + - The -alt and -old script use of '+' flag on "tail" doesn't work + on newer linux systems +12/5 - Save panel doesn't save a tiled screen display, just the current + display to a window the size of the display + - On PPC systems, Save shows a yellow background for PseudoColor GIF + - Colormap focus box wrong size for e.g. imt4096 zoomed out +12/3 - Print box on Leopard PPC shows garbage status and crashes +12/3 - Save box on Leopard PPC shows garbage status message diff --git a/vendor/x11iraf/ximtool/Imakefile b/vendor/x11iraf/ximtool/Imakefile new file mode 100644 index 00000000..28d4bc8c --- /dev/null +++ b/vendor/x11iraf/ximtool/Imakefile @@ -0,0 +1,100 @@ +# Imakefile for the XImtool image display server. +# 18Aug93 - Doug Tody, NOAO/IRAF + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + +/* Hack to build on NOAO HP systems where the Xmu and Xaw libs had to be added + * specially to the system they don't come with the default X11 development + * system. This also avoids the binary requiring the shared lib version on + * systems which may not have it. + */ + +#define IHaveSubdirs +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + +#if defined(HPArchitecture) && OSMajorVersion >= 10 + XMULIB = /usr/lib/X11R6/libXmu.a + XAWLIB = /usr/lib/X11R6/libXaw.a +#endif + + + CDEBUGFLAGS = -g + XAWLIB = LibXaw3d + + LOCAL_LDFLAGS = $(X11IRAF_LDFLAGS) + EXTRA_INCLUDES = $(X11IRAF_INCLUDES) + OBMLIBS = LibObm LibXpm + MATHLIB = -lm + DEPOBM = DepLibObm + + SRCS = eps.c iis.c load.c print.c raster.c save.c \ + rasio.c fitsio.c ximclient.c ximtool.c quant.c util.c \ + zscale.c gifio.c tiffio.c irafio.c ism.c ism_wcspix.c \ + logo.c + OBJS = eps.o iis.o load.o print.o raster.o save.o \ + rasio.o fitsio.o ximclient.o ximtool.o quant.o util.o \ + zscale.o gifio.o tiffio.o irafio.o ism.o ism_wcspix.o \ + logo.o + ISM_DIRS = clients + ISM_DONE = clients/DONE + + SUBDIRS = $(ISM_DIRS) + + +AllTarget(ximtool ximtool-alt ximtool-old ism_clients) + +all:: + @(cd clients; $(MAKE) $(MFLAGS) all X11IRAFDIR=../../) + +NormalProgramTarget(ximtool,$(OBJS),${DEPOBM},${OBMLIBS} XawClientLibs, $(MATHLIB)) + +ximtool-alt:: + cat ximtool-alt.csh ximtool.gui > ximtool-alt + chmod 755 ximtool-alt + +ximtool-old:: + cat ximtool-old.csh ximtool-old.gui > ximtool-old + chmod 755 ximtool-old + +ism_clients: $(ISM_DIRS) $(ISM_DONE) + @(cd clients; $(MAKE) $(MFLAGS) all X11IRAFDIR=../../) + +#install:: +# @(cd clients; $(MAKE) $(MFLAGS) install X11IRAFDIR=../../) + +clean:: + $(RM) ximtool-old ximtool-alt + + +${DEPOBM}: + +ximtool.o: ximtool.gui.h ../version.h +ximtool.c: ximtool.gui.h +ximclient.o: ximtool.html.h +ximclient.c: ximtool.html.h + +ximtool.gui.h: ximtool.gui + sed -f gui2c.sed ximtool.gui > ximtool.gui.h +ximtool.html.h: ximtool.html + sed -f gui2c.sed ximtool.html > ximtool.html.h + +XCOMM XImtool.ad: ximtool.gui +XCOMM sed -e '1,/^appInitialize/d' -e '/^}/,\$d' ximtool.gui > XImtool.ad + +#if InstallBinaries +install:: ximtool + -@if [ -d X11irafBinDir ]; then set +x; \ + else (set -x; $(MKDIRHIER) X11irafBinDir); fi + $(CP) ximtool X11irafBinDir + $(CP) ximtool-old X11irafBinDir + $(CP) ximtool-alt X11irafBinDir +#endif + +#if InstallManuals +install:: + MakeDir(X11irafManDir) + $(CP) ximtool.man X11irafManDir/ximtool.1 +#endif + +DependTarget() diff --git a/vendor/x11iraf/ximtool/NOTES b/vendor/x11iraf/ximtool/NOTES new file mode 100644 index 00000000..cce5458c --- /dev/null +++ b/vendor/x11iraf/ximtool/NOTES @@ -0,0 +1,222 @@ + XIMTOOL GUI + + +1. CONTROL PANEL + +1.1 View + +current frame: radio button +next frame button +prev frame button + +center: button +fitframe: button +flip X: toggle +flip Y: toggle +flip XY: button +zoom factor: buttons for -8 -4 -2 1 +2 +4 +8 in out + or unzoom, zoom in, zoom out (buttons) + + -- Frame 1 -- + X center: 123.45 + Y center: 123.45 + X scale: 4 + Y scale: 4 + + +1.2 Enhancement + +enhancement: string scrolled list or 2 level menu + + +1.3 Blink + +blink frames: several cycle buttons, reset button +blink rate: numeric display, menu select +register: button +match: button +blink: toggle on/off + +1.4 Options + +panner: toggle on/off +coords box: toggle on/off +autoscale: toggle on/off +antialias: toggle on/off + +1.5 Other + +initialize: button +normalize: button +done: button + + +2. INFO BOX + +version number +gui identification +configuration: number of frames, frame size +image title: string +help: scrolled text +messages: text line +output: scrolled text + + +3. COMMAND ENTRY + +command entry: text (Tcl commands) +control: user assignable buttons, text output + + +--------------------------- +Original Notes + + + XIMTOOL + + +Specifications + + 1 - 4 frame buffers + frame buffers any size, selected from config file + all N frames are the same size + frame buffers are 8 bits deep + + each frame buffer has its own independent zoom/pan, colortable, wcs, etc. + attributes + + +Frame Buffer Strategy + + Frame buffer pixel array is a gterm raster (ximage) + Memory model: fast nice-to-server small + + If server pixmaps are being used the frame raster is mapped to a gterm + server pixmap raster the size of the display window + The server pixmap raster is mapped to the screen with a 1-1 mapping + Zoom and pan are controlled by the ximage->pixmap mapping + The frame being displayed is controlled by the pixmap->screen mapping + + If server pixmaps are not used the first raster will be mapped + either to another ximage raster, or directly to the screen. + The first option still provides a reasonable blink capability, + the second will be slow if zoom is in effect. + + +Program Structure + + main + obm <- gui file + gui program + widget tree + iisio + gterm widget + + + The GUI program handles: + keyboard and function key input + pointer input + frame selection, blink, zoom/pan, colortable selection, windowing + control panel options + + The IISIO section handles: + communication with the client + frame buffer configuration + read/write frame buffer + frame selection + cursor readback + + +Optional features + Magnifier - region under the cursor + Split screen - controlled by popup control panel + Split region - display alternate frame in region under cursor + Zoom box - display de-zoomed or zoomed subregion in a marker + Load/save file (sunraster or fits) + + +CLIENT STATE + + nframes number of frame buffers + frame size frame buffer width, height + frame depth frame buffer depth, bits + frame number current display frame + frame event something frame related changed (string) + frame title title of current frame + enhancement color enhancement selected (name offset slope) + cursor mode cursor mode on/off + + +GUI SPECIFICATION + + Menu bar + File -> + View -> + Options -> + + File menu + Load + Save + Print + Quit + + View menu + Next frame + Prev frame + Zoom + Unzoom + Normalize + Flip X + Flip Y + Blink [on|off] ** + + Options menu + Enhancement -> + grayscale + pseudocolor + (etc.) + Fitframe + Match colortables + Autoscale {on off} + Coords {on off} + Locator {on off} ** + Other (popup) ** + Exit cursor mode + Initialize + + Title display ** + horiz scrolled text + button to popup full label + + Buttons + forward + back + flip X + flip Y + zoom/dezoom + + Help ** + + Marker menu + Zoom + Fill + Print + Attributes -> ** + Destroy + + Image menu + Zoom + Dezoom + Unzoom + Pan + Marker -> + marker type + Enhancement -> + grayscale + pseudocolor + (etc.) + Next + Prev + + +oo diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-0.5.info b/vendor/x11iraf/ximtool/OLD/ximtool-0.5.info new file mode 100644 index 00000000..c9346675 --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-0.5.info @@ -0,0 +1,798 @@ +Path: iraf!irafmail-gateway +From: tody@noao.edu (Doug Tody) +Newsgroups: adass.iraf.announce +Subject: XImtool version 0.5 released +Date: 24 May 1994 00:26:46 -0700 +Organization: IRAF Project, National Optical Astronomy Observatories +Lines: 787 +Sender: daemon@iraf.noao.edu +Message-ID: <9405240726.AA11099@lepus.tuc.noao.edu> +NNTP-Posting-Host: tucana.tuc.noao.edu + + XIMTOOL VERSION 0.5 + May 22 1994 + + +Version 0.5 of the alpha test ximtool is now available in pub/v2103-beta +on iraf.noao.edu and consists of the following files: + + 1589248 May 22 15:14 ximtool-0.5 # executable + +Anyone using an earlier version of ximtool is encouraged to update to the +new version, which is a major new version. Keep the old version around in +case you run into any problems. + +This is ALPHA TEST software. This means that the software is still under +development and may lack planned features. The software is only partially +tested and can be expected to have some bugs. Anyone using an alpha test +version of ximtool is asked to update to version 1.0 when it becomes +available. + + +INSTALLATION + +To install ximtool, download the executable, rename it "ximtool" and place +it somewhere in your search path (e.g. /usr/bin/X11 or /usr/local/bin). +An app-defaults file is not required to run ximtool. + +Don't install the new version while someone is using ximtool, or you will +crash their session. The simplest way to avoid this is to "mv" the old +executable to change the name, e.g. "mv ximtool ximtool.old". + +Since this is still alpha test software, all we are releasing is a snapshot +from our development system, which is a Sun sparc running SunOS. Hence only +a Sun binary is available at this time (unless someone wants to hack the +sources and generate their own binary for a new platform). + + +BASIC USAGE + +Ximtool is an image display server. To view images with it you need some +client software, such as IRAF, to load images into the display. Ximtool is +upwards compatible with older display servers such as SAOimage and imtool. +For example, to use ximtool instead of SAOimage, start up ximtool instead of +SAOimage and display in the usual fashion. + +You shouldn't need much documentation to be able to use ximtool effectively. +Just start it up, load images into one or more frames, and experiment with +the GUI to see what can be done to manipulate the display. Most of the +controls are obvious, but here are a few things which might not be obvious: + + o Clicking and dragging MB1 (mouse button 1) in the main image + window creates a rectangular region marker, used to select a + region of the image. If you do this accidentally and don't want + the marker, put the pointer in the marker and type DELETE or + BACKSPACE to delete the marker. With the pointer in the marker, + MB3 will call up a menu listing some thing you can do with the + marker, like zoom the outlined region. MB1 can be used to drag + or resize the marker. + + o Clicking on MB2 in the main image window pans (one click) or + zooms (two clicks) the image. Further clicks cycle through the + builtin zoom factors. Moving the pointer to a new location and + clicking moves the feature under the pointer to the center of + the display window. + + o MB3 is used to adjust the contrast and brightness of the displayed + image. The position of the pointer within the display window + determines the contrast and brightness values. Click once to + set the values corresponding to the pointer location, or click + and drag to continuously adjust the display. + + o Ctrl-f, Ctrl-b can be used to move forward or backward through + the current set of frame buffers. + + A frame buffer is an image (picture) stored in the display server. + Ximtool supports up to four frame buffers. Frame buffers can be any + size; the size is set by the client when an image is loaded into a + frame. For example, in IRAF "set stdimage = imt800" would set the + frame buffer size to 800x800 pixels. Changing the frame buffer size + forces an initialize of the display server. In IRAF the command + "gdev" will list the frame buffer configurations defined on your + system. + +Ximtool has a control panel which can be used to exercise most the +capabilities the program has for image display. The control panel can be +accessed either via the Options menu from the main window menubar, or by +pressing the leftmost button in the row of buttons at the upper right side +of the display. + +A more detailed overview of the ximtool capabilities and usage is given +below. + + +THINGS TO WATCH OUT FOR + + o It is possible to run multiple ximtools, or ximtool and other + display servers such as saoimage, imtool, skyview, etc., + simultaneously on the same computer, but don't attempt this unless + you know how to set the servers up on different i/o ports. In the + default configuration there will be conflicts with multiple servers + trying to listen on the same port. + + o Most workstations have a single 8 bit, 256 element colortable per + screen. This means that only 256 unique colors can be displayed at + any one time. Image display programs like ximtool (or SAOimage, or + xv, xloadimage, mosaic, etc.) need a lot of colortable entries in + order to display smoothly varying images. If you try to run + multiple image display programs at the same time you are likely to + run out of colortable space. This may result in warning messages + when a program starts up, cause images to be displayed funny, + causing flashing when the pointer moves in and out of image display + windows, and so on. + + It is best to avoid these problems by killing off any other display + programs when running ximtool. If you do run out of colortable + space when using ximtool this is harmless, but the image won't be + displayed correctly when the pointer is not in the image window. To + correct this condition, free up some colortable space (by killing + off some other X programs, especially any display programs) and then + move the pointer into the ximtool image window and back out. This + will cause ximtool to update the default colormap of the display and + in most cases will make the ximtool image display correctly. + Ximtool will always display correctly when the pointer is in the + image window, the problem occurs only when the pointer (colormap + focus) is in other windows. + + +WHAT'S NEW? + +Ximtool 0.5, while still incomplete, is a major new version, probably the +first really usable version of ximtool. Major new features in this version +include the following: + + o A popup control panel, providing control over frame selection, + zoom and pan, colortable selection from a list (including user + defined colortables), contrast and brightness display and controls, + blink control, including blink frames and blink rate, and option + control. (The ximtool control panel uses the new widgets and other + OBM enhancements discussed in the Xgterm 0.11 announcement.) + + o An option called the "panner". The panner displays a reduced + version of the entire frame buffer, with the region currently + displayed outlined with a marker. One can pan and zoom within + the panner window, e.g. by dragging the panner region marker, + to pan or zoom the main image window. This is useful when viewing + images too large to fit on the screen. + + o Autoscale option. If autoscale is enabled then at zoom=1, the + frame buffer will be automatically scaled to fit within the display + window. With autoscale disabled (the default), the image scale + is more predictable, but the image may be clipped by the display + window, or may not fill the display window. + + o Integer zoom. Ximtool supports both fractional zoom and integer + zoom. Fractional zoom uses a non-integer scale factor to scale an + image region as necessary to fill the display window. Integer zoom + ensures that each frame buffer pixel is displayed as exactly N + display pixels. Integer zoom is slightly faster than a fractional + zoom. + + o Antialiasing. When dezooming an image, i.e., displaying a large + image in a smaller display window, antialiasing causes all the + data to be used to compute the displayed image. If antialiasing + is disabled then image is subsampled to compute the displayed image. + Antialiasing can prevent subsampling from omitting image features + that don't fall in the sample grid, but it is significantly slower + than dezooming via subsampling. The default is no antialising. + + o Tile frames. The default display mode is to view one frame at a + time. In tile frames mode, 2 or 4 frames may be viewed + simultaneously in the display window. All the usual operations + (zoom and pan, colortable enhancement, cursor readback, etc.) + still work for each frame even when in tile frames mode. + + o Fitframe now works. Fitframe resizes the display window to the + same size as the frame buffer. + + o Ximtool allows clients to connect in any of the following ways: + + fifo pipes The traditional approach. The default, + global /dev/imt1[io] pipes may be used, + or a private set of fifos. + + tcp/ip socket Clients connect via a tcp/ip socket. + There is a default port, or a custom port + may be specified. This permits connecting + to the server over a remote network + connection anywhere on the Internet. + + unix domain socket Like a tcp/ip socket, but limited to a + single host system. Usually faster than a + tcp/ip socket, and comparable to a fifo. By + default each user gets their own unix domain + socket, so this option allows multiple users + to run ximtools on the same host without + having to customize things. + + By default ximtool listens simultaneously for client connctions on + all three types of ports. + + o Ximtool now supports multiple simultaneous client connections. + For example, one can be using the IRAF imexamine task to interact + with the image displayed in frame 1, while some other program + simultaneously displays an image in frame 2 (or any frame, including + the frame being examined). + + o An improved set of builtin colormaps are now provided. The user + can define additional custom colormaps when ximtool is started. + +There were many additional minor changes and bug fixes not worth going into +here. + + +TECHNICAL NOTES + +This isn't the place to write a detailed comprehensive reference manual for +ximtool, but since there isn't any such manual yet (this is still prerelease +software) some additional information on a few selected topics will probably +be useful. + + +COMMAND LINE OPTIONS + +This prerelease version of ximtool doesn't support general command line +options yet (except for the -defgui option described below). However, one +can accomplish the same thing by setting resources on the command line. For +example, + + ximtool \ + -xrm "*port:0" \ + -xrm "*input_fifo:none" \ + -xrm "*userCmapDir1:/user/smith/cmaps" \ + -xrm "*displayPanner:false" + +would start up ximtool with tcp/ip sockets and fifos disabled (leaving +only unix sockets for client connections). Ximtool will look for user +colormaps in the directory /user/smith/cmaps. The panner option will be +disabled at startup. + + +RESOURCES + +Ximtool has a ton of resources (hundreds of them), but in practice only a +few are likely to be useful at the user level. + +BUILTIN RESOURCES + + Resource Name Default Value + + defConfig: 1 + defNFrames: 0 + tileBorderWidth: 3 + tileBorderColor: 9 + autoscale: false + antialias: false + tileFrames: false + highlightFrames: true + gui: default + imtoolrc: /usr/local/lib/imtoolrc + memModel: fast + cmap1: none + cmap2: none + cmapDir1: none + cmapDir2: /usr/local/lib/imtoolcmap + input_fifo: /dev/imt1i + output_fifo: /dev/imt1o + unixaddr: /tmp/.IMT%d + port: 5137 + +All of these are application resources, hence they would be specified in +the .Xdefaults file as, e.g., "XImtool.autoscale: true", etc. + + +Description of ximtool client resources: + + defConfig Default frame buffer configuration on startup. + + defNFrames Default number of frames on startup. Set to zero + to use value from imtoolrc file. There isn't a + whole lot of reason to preallocate frames here, + since new frames will be created on demand if needed. + + tileBorderWidth Used by the tile frames option. Specifies how far + tileBorderColor apart to space the frames in tile frames mode. + Color "9" refers to the Gterm widget resource color9, + which is assigned a color with its own resource. + + autoscale Enable/disable the autoscale option. + antialias Enable/disable the antialias option. + tileFrames Enable/disable the tile frames option. + + highlightFrames Determines whether the current frame is highlighted + when in tile frames mode. + + gui The GUI to be executed. "default" refers to the + default, builtin ximtool GUI. You can replace this + with your own GUI file if you are bold enough, and + completely change the look and functionality of + the GUI if desired. + + imtoolrc Where to find the imtoolrc file. This defines the + recognized frame buffer configurations. + + memModel Determines how ximtool uses memory in the ximtool + client and the X server. The options are "fast", + "beNiceToServer", and "small". The default is fast, + which uses server pixmaps to make frame blink fast. + This is recommended unless server memory is very + limited. Note that even in fast mode, the server + pixmap is only the size of the display window, so + memory usage is reasonable even if the frame buffer + is very large. + + cmap1 User colormap files. The intent here is to allow + cmap2 individual colormaps to be conveniently specified + on the command line. + + cmapDir1 User or system colormap directories. By default + cmapDir2 cmapDir2 points to the system directory + /usr/local/lib/imtoolcmap, allowing a set of site + default colormaps to be defined here. This leaves + cmapDir1 available to a user colormap directory. + + input_fifo The input and output fifos for fifo i/o. "Input" + output_fifo and "output" are from the client's point of view. + Note that only one display server can use a + fifo-pair at one time. + + unixaddr Template address for unix domain socket. The user + must have write permission on this directory, or + the file must already exist. %d, if given, is + replaced by the user's UID. + + port TCP/IP port for the server. Note that only one + server can listen on a port at one time, so if + multiple ximtool servers are desired on the same + machine, they should be given different ports. + + +GUI RESOURCES + +In principle ximtool can have any number of different GUIs, each of which +defines its own set of resources. GUIs typically define a great many +resources, but most of these are not really intended for modification by +the user (although one can modify them if desired). + +The following are some of the more useful resources used by the default +ximtool GUI. + + Resource Name Default Value + + .geometry: + *controlShell.geometry: + *info.geometry: 420x120 + + *cmapName: image + *basePixel: 64 + *maxColors: 216 + + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.color8: #7c8498 + *imagewin.color9: steelblue + + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *warnings: True + + +Description of selected resources: + + .geometry Geometry of main image window + *controlShell.geometry Geometry of control panel shell + *info.geometry Geometry of info box + + *cmapName Name used for private colormap. + The default for all IRAF imaging + applications is "image". Gterm + widget based imaging applications + which have the same value of cmapName + will share the same colormap, + minimizing colormap flashing and + allowing multiple applications to be + run at the same time. + + *basePixel These two resources determine the + *maxColors region of colormap space used to + render image pixels. + + *imagewin.warpCursor Warp pointer into image window when + initiating a cursor read. + *imagewin.raiseWindow Raise image window when initiating + a cursor read. + *imagewin.deiconifyWindow Deiconify image window if necessary + when initiating a cursor read. + + *imagewin.ginmodeCursor Type of cursor when a cursor read + is in progress. The default is a + circle. Any selection from the X + cursor font can be used. A special + case is "full_crosshair" which is + the full crosshair cursor of the + Gterm widget. + + *imagewin.ginmodeBlinkInterval Determines whether the cursor blinks + when a cursor read is in progress. + The value is given in milliseconds. + + *imagewin.color8 Color assigned the panner window. + *imagewin.color9 Color used for the tileFrames highlight. + + *pannerArea Area in pixels of the panner window. + *pannerGeom Where to place the panner window. + *wcsboxGeom Where to place the coords box. + *maxContrast Maximum contrast value. + +For a complete description of the ximtool resources, refer to the GUI file. +The "appInitialize" command contains the full resource list for the GUI. + + +CONTROL PANEL NOTES + +VIEW CONTROLS + + o The "Frame" box will list only the frame buffers you currently have + defined. Currently, the only way to destroy a frame buffer is to + change the frame buffer configuration. + + o The text display gives the field X,Y center, X,Y scale factors, and + the X,Y zoom factors. The scale factor and the zoom factor will be + the same unless autoscale is enabled. The scale is in units of + display pixels per frame buffer pixel, and is an absolute measure + (it doesn't matter whether or not autoscale is enabled). Zoom is + relative to the autoscale factor, which is 1.0 if autoscaling is + disabled. + + o The numbers in the Zoom box are zoom factors. Blue numbers zoom, + red numbers dezoom. Zoom In and Zoom Out may be used to go to + larger or smaller zoom factors, e.g. "5" followed by "Zoom In" will + get you to zoom factor 10. Center centers the field. Toggle Zoom + toggles between the current zoom/center values, and the unzoomed + image. + + o Aspect recomputes the view so that the aspect ratio is 1.0. Aspect + also integerizes the zoom factor (use the version in the View menu + if you don't want integerization). + + o Fit Frame makes the display window the same size as the frame buffer. + Note that autoscale has much the same effect, and allows you to + resize the display window to any size you want, or view images to + large to fit on the screen. + + +ENHANCEMENT CONTROLS + + o At the top is a scrolled list of all the available colormaps. Click + on the one you want to load it. You can add your own custom colormaps + to this list. + + o The two sliders adjust the contrast (upper slider) and brightness + (lower slider) of the display. The Invert button inverts the + colormap (multiples the contrast by -1.0). Note that due to the use + of the private colormap the sliders are a bit sluggish when dragged + to window the display. If this is annoying, using MB3 in the + display window is faster. + + o The Normalize button (on the bottom of the control panel) will + normalize the enhancement, i.e. set the contrast and brightness to + the default one-to-one values (1.0, 0.5). This is the preferred + setting for many of the pseudocolor colortables. + + +BLINK CONTROLS + + o Blink frames is the list of frames to be blink. When blink mode is + in effect ximtool just cycles through these frames endlessly, + pausing "blink rate" seconds between each frame. The same frame + can be entered in the list more than once. To program an arbitrary + list of blink frames, hit the Reset button and click on each blink + frame button until it is set to the desired frame number. + + o The blink rate can be adjusted as slow or as fast as you want using + the arrow buttons. If you set the blink rate small enough it will + go to zero, enabling single step mode (see below). + + o The Register button registers all the blink frames with the current + display frame. Frames not in the blink list are not affected. + + o The Match LUTs button sets the enhancement of all blink frames to + the same values as the display frame. Frames not in the blink list + are not affected. + + o The Blink button turns blink on and off. When the blink rate is + set to zero the Blink button will single step through the blink + frames, one frame per button press. + + NOTE: you can blink no matter what ximtool options are in effect, but + many of these will slow blink down. To get the fastest blink you may + want to turn off the panner and coords box, and match the LUTs of all + the blink frames. All the ximtool controls are fully active during + blink mode, plus you can load frames etc. + + +OPTIONS CONTROLS + + o The options box contains a set of option toggles. If the toggle + is yellow the option is in effect. + + +OTHER + + o Initialize initializes ximtool. This resets a lot of things, but + tries to not change the view. Select Reset in the File menu on the + main window menubar to fully reset things. + + o Normalize normalizes the view for the current display frame. + + o Done makes the control panel go away. + + +CUSTOM COLOR TABLES + +The cmap[12] and cmapDir[12] resources are used to tell ximtool where to +look for colortables. The colortables are loaded when ximtool starts up, or +when it is reinitialized (e.g. by pressing the Initialize button in the +control panel). Ximtool will ignore any files in the colormap directory +which do not look like colortables. + +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, +and blue values scaled to the range 0.0 (off) to 1.0 (full intensity). + + R G B + R G B + (etc.) + +Blank lines and comment lines (# ...) are ignored. + +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. Ximtool will interpolate the table as necessary to +compute the colortable values used in Ximtool. Ximtool uses only 201 colors +to render pixel data, so it is usually necessary to interpolate the table +when it is loaded. + +Tables are loaded into Ximtool by setting one of the user colormap directory +resources. When Ximtool starts up it will read all the files in the +colormap directory, disregarding any files that are unreadable or that do +not appear to be colortables. The name of the colortable as it will appear +in the Ximtool control panel is the root name of the file, e.g., if the file +is "rainbow.lut" the colortable name will be "rainbow". Lower case names +are suggested to avoid name collisions with the builtin colortables. If the +same colortable file appears in multiple user colortable directories, the +first one will be used. + +The directory "luts" in the ximtool source directory contains a sample set +of colortable files. This can be installed as /usr/local/lib/imtoolcmap +when ximtool is installed. + + +THE MARKER MENU + + o MB3 (mouse button 3) calls up the marker menu (by default). + + o Zoom does an equal aspect zoom of the region outlined by the marker. + In this way you can mark a region of the image and zoom it up. + + o Fill exactly zooms the area outlined by the marker, making it fill + the display window. Since the marker is not likely to be exactly + square, the aspect ratio of the resultant image will not be unitary. + + o Print prints a description of the marked region. The text is printed + in the Info box. + + o Unrotate unrotates a rotated marker. + + o Color is a menu of possible marker colors. + + o Type is a menu of possible marker types. This is still a little + buggy and it isn't very useful, but you can use it to play with + different types of markers. + + o Destroy destroys the marker. You can also hit the delete or + backspace key in a marker to destroy the marker. + + +MORE ON GRAPHICS MARKERS + +Although ximtool doesn't do much with markers currently, they are a general +feature of the Gterm widget and are used more extensively in other programs +(e.g. the prototype IRAF science GUI applications). Ximtool uses markers +for the marker zoom feature discussed above, and also for the panner and the +coords box. All markers share some of the same characteristics, so it is +worthwhile learning basic marker manipulation keystrokes. + + o MB1 anywhere inside a marker may be used to drag the marker. + + o MB1 near a marker corner or edge, depending on the type of marker, + resizes the marker. + + o Shift-MB1 on the corner of most markers will rotate the marker. + + o Markers stack, if you have several markers and you put one on top + of the other. The active marker is highlighted to tell you which + of the stacked markers is active. If the markers overlap, this + will be marker "on top" in the stacking order. + + o MB2 in the body of a marker "lowers" the marker, i.e. moves it to + the bottom of the stacking order. + + o Delete or backspace in a marker deletes the marker. + +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back). + + +NOTES ON THE PANNER + +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. + +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned above apply to these markers as well, e.g. you can use MB1 to +reposition on the panner window within the main image display window, or to +drag the region marker within the panner (pan the image). Resizing the +region marker zooms the image; this is a non-aspect constrained zoom. +The panner window itself can be resized by dragging a corner with MB1. +Typing delete or backspace anywhere in the panner window deletes the panner. + +A special case is MB2. Typing MB2 anywhere in the panner window pans the +image to that point. This is analogous to typing MB2 in the main display +window to pan the image. + + +THE COORDS BOX + +Ximtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +client defined coordinate system. The coords box feature is used to display +these world coordinates as the pointer is moved about in the image window. + +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated +a "+" will be displayed after the intensity value. + +The coords box is a marker (text marker) and it can be moved and resized +with the pointer like any other marker. + + +VIEWING THE IMAGE TITLE + +The title of the image loaded into the current display frame is displayed +centered in the control area at the top of the main display window. If the +title string is too long to be fully displayed it will be clipped at either +end. To see the full title string, either resize the display window, or +pop up the Info box. The Info box always displays the full image title. + + +NOTES ON CLIENT-SERVER I/O + +As mentioned earlier ximtool allows clients to connect using any of three +different communications domains: fifos, tcp/ip sockets, and unix domain +sockets. + +By default ximtool will listen and accept connections on all three types of +ports. This is fine if there is only one display server running on a host, +but conflicts arise if multiple display servers try to listen on the same +port. If this happens one needs to either disable a port, or change the +address. + + FIFOs The default fifos are /dev/imt1i and /dev/imt1o. + The resources input_fifo and output_fifo may be + set to use a different set of fifos. To disable + the fifo port entirely set input_fifo=none. The + fifos must be created and must have read and write + permission, before starting ximtool. + + TCP/IP socket The default tcp/ip port is 5137. The resource + "port" may be set to set a different port. To + disable tcp/ip sockets completely set port=0. + If ximtool is terminated it may take a couple of + minutes before unix allows ximtool to use the + port again. + + UNIX socket The default unix domain socket is /tmp/.IMT%d, + where %d is the user's UID number. Hence, each user + has a private unix domain socket, allowing multiple + ximtools to be run on the same host (but only one + per user unless the addresss is changed). To + disable unix domain sockets set unixaddr=none. The + server will automatically create and delete the unix + domain socket if none exists. + +In 2.10.3 beta-3 and later versions of IRAF the default action when +connecting to the display server is to first try a unix domain socket +connection using the socket /tmp/.IMT%d. If this fails the IRAF client +tries to connect via the old style FIFOs /dev/imt1[io]. Hence, if ximtool +is being used with only newer versions of IRAF and all connections are +local, FIFOs and tcp/ip sockets can be disabled and different users can +transparently run ximtool on the same host system. + +IRAF 2.10.3 or later uses the new ZFIOND network driver (described +elsewhere) to connect to the server. The graphcap file defines how to +connect to the server. This can be overridden however, by defining IMTDEV +in the host environment. For example to connect to a TCP/IP socket on host +foo.bar.edu, one could define + + setenv IMTDEV inet:5137:foo.bar.edu + +before logging into IRAF. + + +CUSTOM GUIs + +The default GUI of ximtool can be viewed by running ximtool as follows: + + ximtool -defgui + +This will print the default builtin GUI to the standard output. If this +output is saved in a file one can set the "gui" resource to point to this +file, and when ximtool starts up it will use this GUI file instead of the +builtin default GUI. The user can modify the GUI file as desired to +customize the GUI. Since the full GUI of ximtool is encapsulated in the GUI +file, ths is a very powerful option; one can generate quite a different +program merely by modifying the GUI file, without need to recompile any code. + + +PLANNED FUTURE WORK + +The following items are on the near term TODO list for ximtool. + + o Print dialog. Will be used to print whatever is displayed in the + main image window, generating a variety of types of output. + + o File load/save. For standalone use it is desirable to be able to + load the display from a disk file. The plan is to support at least + FITS for file input. + + o Info box. The info box is due for a major rewrite (the existing + one isn't very useful). + + o TclShell. This will allow experienced users to type Tcl commands + directly into the OBM interpreter at the heart of ximtool. + + o Add global translation actions for a variety of GUI functions, so + that the user can bind keystrokes and function keys to these actions. + + o Implement online help (question mark button in main window). + + o "Snap to equal aspect" feature for use when resizing panner. + +There are still quite a few useful features that could be implemented. +For example, a magnifier window (similar to the panner but displays a +magnified view of the region under the cursor). Similarly, one could have +a magnifier which pops up under the pointer. Split screen would be useful +for comparing multiple frame buffers. A window into an alternate frame +would be a useful alternative to frame blink. The Optimize button in the +Enhancement portion of the control panel will be used to automatically +compute the optimum contrast and brightness valus for the region for the +image in the main display window. + +More dramatically, alternate, completely different GUIs for ximtool are +possible, merely by loading a different GUI file. The planned SAOtng user +interface (being developed by SAO) is an example of this. SAOtng will +also provide enhanced client-server communications via an alternative, +more general communications protocol based on the X selection mechanism. diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-alt.man b/vendor/x11iraf/ximtool/OLD/ximtool-alt.man new file mode 100644 index 00000000..4ca5b8a7 --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-alt.man @@ -0,0 +1,1568 @@ +.\" @(#)ximtool.1 1.1 10-Dec-96 MJF +.TH XIMTOOL-ALT 1 "10 Dec 1996" "X11IRAF Project" +.SH NAME +ximtool-alt \- interactive image display program for the X Window System with experimental GUI +.SH SYNOPSIS +.B "ximtool-alt" [\-\fItoolkitoption\fP ...] [ \fIoptions\fP ...] [\fIimagename\fP] +.SH OPTIONS +.TP 5 +.B "-basePixel \fIN\fP" +The base colormap cell used by the colormap. This essentially allows you +to reserve \fIbasePixel\fP colors in the global colormap for other applications. +The default is 64, if changed you'll need to also specify the +\fI-cmapInitialize\fP option or resource. +.TP 5 +.B "-cmap1 \fIfile\fP" +User colormap 1. This flag allows you to specify a colormap to be made +available at task startup. +.TP 5 +.B "-cmap2 \fIfile\fP" +User colormap 2. This flag allows you to specify a second colormap to be +made available at task startup. +.TP 5 +.B "-cmapDir1 \fIdir\fP" +User colormap directory 1. Specifies a directory to be searched for colormaps. +.TP 5 +.B "-cmapDir2 \fIdir\fP" +User colormap directory 2. Specifies a directory to be searched for colormaps. +By default this points to the system directory /usr/local/lib/imtoolcmap, +allowing a set of site default colormaps to be defined here. +.TP 5 +.B "-cmapInitialize \fIbool\fP" +Initialize the ximtool colormap at startup. When setting the \fIbasePixel\fP +option or resource this is required in order to force the Gterm widget to +update its global colormap resource in the X server. The default is +\fIfalse\fP. +.TP 5 +.B "-cmapName \fIname\fP" +Name used for private colormap. The default for all IRAF imaging +applications is \fIimage\fP. Gterm widget based imaging applications +which have the same value of cmapName will share the same colormap, +minimizing colormap flashing and allowing multiple applications to be +run at the same time. +.TP 5 +.B "-config \fIN\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-defgui" +Print the default GUI to the stdout. The GUI is a Tcl program that may be +customized by the user and reloaded using the \fI-gui\fP option or +the \fIgui\fP resource parameter. +.TP 5 +.B "-displayPanner \fIbool\fP" +Display panner marker window at startup. If set, a panner window showing +the full frame buffer will appear in the upper-right side of the main display +window. +.TP 5 +.B "-displayMagnifier \fIbool\fP" +Display magnifier marker window at startup. If set, a magnifier window showing +a zoomed section around the cursor will appear in the upper-left side of the +mail display window. +.TP 5 +.B "-displayCoords \fIbool\fP" +Display WCS coordinate marker window at startup. If set, a coordinate +readout text marker showing will appear in the lower-right side of the main +display window. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-gui \fIfile\fP" +Specifies the GUI file to be used. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-invert" +Start XImtool using inverted colormaps. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 5 +.B "-maxColors \fIN\fP" +Specify the max number of colors to be used for the display. +.TP 5 +.B "-memModel \fItype\fP" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are \fIfast\fP, \fIbeNiceToServer\fP, and \fIsmall\fP. The +default is \fIfast\fP, which uses server pixmaps to make frame blink fast. +This is recommended unless server memory is very limited. Note that even in +fast mode, the server pixmap is only the size of the display window, so memory +usage is reasonable even if the frame buffer is very large. +.TP 5 +.B "-nframes \fIN\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port \fIN\fP" +Specifies the port number to use when connecting through an inet socket. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-printConfig \fIname\fP" +Specifies the printer configuration file to use. By default this will be +/usr/local/lib/ximprint.cfg. See below for more information on configuring +output devices. +.TP 5 +.B "-showToolBar" +Show the Toolbox menubar at startup. +.TP 5 +.B "-showPanelBar" +Show the Panels menubar at startup. +.TP 5 +.B "-tile" +The default display mode is to view one frame at a time. In tile frames mode, +2 or 4 frames may be viewed simultaneously in the display window. All the +usual operations (zoom and pan, colortable enhancement, cursor readback, etc.) +still work for each frame even when in tile frames mode. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "RESOURCES" +XImtool is implemented as a client program which is responsible for loading +the frame buffers/colormaps, communicating with clients, etc, and a +user-modifiable GUI file written as a Tcl script which handles all the user +interface details. The \fIclient resources\fP described below will be common +to any user-defined GUI, the \fIgui resources\fP may change depending on how +extensively the GUI has been modified by the user. Each of these components +has its own set of resources, but to the user setting them is the same as +with any other application. + +\fIGterm\fP widget resources (i.e. those for the main image window or +colorbar) may be set as either client or GUI resources. See the +\fIxgterm(1)\fP man page for a complete description of \fIGterm\fP widget +resources. + +.SS "CLIENT RESOURCES" +The client resources generally define the initial state of the application +or set configuration parameters. +.RS +.TP 25 +.B "Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 25 +defConfig +1 +.sp -0.5 +.TP 25 +defNFrames +0 +.sp -0.5 +.TP 25 +tileBorderWidth +3 +.sp -0.5 +.TP 25 +tileBorderColor +9 +.sp -0.5 +.TP 25 +autoscale +false +.sp -0.5 +.TP 25 +antialias +false +.sp -0.5 +.TP 25 +antialiasType +boxcar +.sp -0.5 +.TP 25 +tileFrames +false +.sp -0.5 +.TP 25 +highlightFrames +true +.sp -0.5 +.TP 25 +gui +default +.sp -0.5 +.TP 25 +imtoolrc +/usr/local/lib/imtoolrc +.sp -0.5 +.TP 25 +invert +false +.sp -0.5 +.TP 25 +memModel +fast +.sp -0.5 +.TP 25 +basePixel: +64 +.sp -0.5 +.TP 25 +maxColors: +216 +.sp -0.5 +.TP 25 +cmapInitialize: +false +.sp -0.5 +.TP 25 +cmap1 +none +.sp -0.5 +.TP 25 +cmap2 +none +.sp -0.5 +.TP 25 +cmapDir1 +none +.sp -0.5 +.TP 25 +cmapDir2 +/usr/local/lib/imtoolcmap +.sp -0.5 +.TP 25 +input_fifo +/dev/imt1i +.sp -0.5 +.TP 25 +output_fifo +/dev/imt1o +.sp -0.5 +.TP 25 +unixaddr +/tmp/.IMT%d +.sp -0.5 +.TP 25 +port +5137 +.RE +.LP +Description of ximtool client resources: + +.TP 18 +.B "defConfig" +Default frame buffer configuration number on startup. See below for more +information on frame buffers. +.TP 18 +.B "defNFrames" +Default number of frames on startup. Set to zero to use the value from +the frame buffer configuration (\fIimtoolrc\fP) file. +.TP 18 +.B "tileBorderWidth" +.sp -0.5 +.TP 18 +.B "tileBorderColor" +Used by the tile frames option. Specifies how far +apart to space the frames in tile frames mode. +Color "9" refers to the Gterm widget resource color9, +which is assigned a color with its own resource. +.TP 18 +.B "autoscale" +Enable/disable the autoscale option. +.TP 18 +.B "antialias" +Enable/disable the antialias option. +.TP 18 +.B "antialiasType" +Type of antialiasing. +.TP 18 +.B "tileFrames" +Enable/disable the tile frames option. +.TP 18 +.B "highlightFrames" +Determines whether the current frame is highlighted when in tile frames mode. +.TP 18 +.B "gui" +The GUI to be executed. "default" refers to the default, builtin ximtool GUI. +You can replace this with your own GUI file if you are bold enough, and +completely change the look and functionality of the GUI if desired. +.TP 18 +.B "imtoolrc" +Where to find the imtoolrc file. This defines the +recognized frame buffer configurations. +.TP 18 +.B "invert" +Start Ximtool using an inverted colormap. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 18 +.B "memModel" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are "fast", "beNiceToServer", and "small". The default is fast, +which uses server pixmaps to make frame blink fast. This is recommended +unless server memory is very limited. Note that even in fast mode, the server +pixmap is only the size of the display window, so memory usage is reasonable +even if the frame buffer is very large. +.sp -0.5 +.TP 18 +.B "basePixel" +.sp -0.5 +.TP 18 +.B "maxColors" +These two resources determine the region of colormap space used to +render image pixels. +.TP 18 +.B "cmapInitialize" +Initialize the ximtool colormap at startup. This is sometimes necessary to +clear a previous ximtool colormap allowing a new basePixel and maxColors to +take effect. +.TP 18 +.B "cmap1" +.sp -0.5 +.TP 18 +.B "cmap2" +User colormap files. The intent here is to allow individual colormaps to be +conveniently specified as a resource. +.TP 18 +.B "cmapDir1" +.sp -0.5 +.TP 18 +.B "cmapDir2" +User or system colormap directories. By default cmapDir2 points to the system +directory /usr/local/lib/imtoolcmap, allowing a set of site default colormaps +to be defined here. This leaves cmapDir1 available to a user colormap +directory. +.TP 18 +.B "input_fifo" +.sp -0.5 +.TP 18 +.B "output_fifo" +The input and output fifos for fifo i/o. "Input" and "output" are from the +client's point of view. Note that only one display server can use a +fifo-pair at one time. +.TP 18 +.B "unixaddr" +Template address for unix domain socket. The user must have write permission +on this directory, or the file must already exist. %d, if given, is +replaced by the user's UID. +.TP 18 +.B "port" +TCP/IP port for the server. Note that only one server can listen on a port +at one time, so if multiple ximtool servers are desired on the same +machine, they should be given different ports. + +.SS "GUI RESOURCES" + +In principle ximtool can have any number of different GUIs, each of which +defines its own set of resources. GUIs typically define a great many +resources, but most of these are not really intended for modification by +the user (although one can modify them if desired). + +The following are some of the more useful resources used by the default +ximtool GUI. The \fIimagewin\fR resources are Gterm widget resources. +.RS +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + .geometry: + +.sp -0.5 +.TP 35 + *controlShell.geometry: + +.sp -0.5 +.TP 35 + *info.geometry: +420x240 +.sp -0.5 +.TP 35 + *load_panel.geometry: + +.sp -0.5 +.TP 35 + *save_panel.geometry: + +.sp -0.5 +.TP 35 + *print_panel.geometry: + +.sp -0.5 +.TP 35 + *help_panel.geometry: + +.sp -0.5 +.TP 35 + *cmapName: +image +.sp -0.5 +.TP 35 + *basePixel: +64 +.sp -0.5 +.TP 35 + *imagewin.warpCursor: +true +.sp -0.5 +.TP 35 + *imagewin.raiseWindow: +true +.sp -0.5 +.TP 35 + *imagewin.deiconifyWindow: +true +.sp -0.5 +.TP 35 + *imagewin.ginmodeCursor: +circle +.sp -0.5 +.TP 35 + *imagewin.ginmodeBlinkInterval: +500 +.sp -0.5 +.TP 35 + *imagewin.color0: +black +.sp -0.5 +.TP 35 + *imagewin.color1: +white +.sp -0.5 +.TP 35 + *imagewin.color8: +#7c8498 +.sp -0.5 +.TP 35 + *imagewin.color9: +steelblue +.sp -0.5 +.TP 35 + *imagewin.width: +512 +.sp -0.5 +.TP 35 + *imagewin.height: +512 +.sp -0.5 +.TP 35 + *autoscale: +True +.sp -0.5 +.TP 35 + *zoomfactors: +1 2 4 8 +.sp -0.5 +.TP 35 + *displayCoords: +True +.sp -0.5 +.TP 35 + *displayPanner: +True +.sp -0.5 +.TP 35 + *displayMagnifier: +False +.sp -0.5 +.TP 35 + *showToolBar: +False +.sp -0.5 +.TP 35 + *showPanelBar: +False +.sp -0.5 +.TP 35 +.TP 35 + *blinkRate: +1.0 +.sp -0.5 +.TP 35 + *pannerArea: +150*150 +.sp -0.5 +.TP 35 + *pannerGeom: +-5+5 +.sp -0.5 +.TP 35 + *magnifierArea: +100*100 +.sp -0.5 +.TP 35 + *magnifierGeom: ++5+5 +.sp -0.5 +.TP 35 + *wcsboxGeom: +-5-5 +.sp -0.5 +.TP 35 + *maxContrast: +5.0 +.sp -0.5 +.TP 35 + *warnings: +True +.RE +.LP +Description of selected resources: + +.TP 22 +.B ".geometry" +Geometry of main image window. +.TP 22 +.B "*controlShell.geometry" +Geometry of control panel shell. +.TP 22 +.B "*info.geometry" +Geometry of info box. +.TP 22 +.B "*load_panel.geometry" +Geometry of file load panel. +.TP 22 +.B "*save_panel.geometry" +Geometry of save control panel. +.TP 22 +.B "*print_panel.geometry" +Geometry of print control panel. +.TP 22 +.B "*help_panel.geometry" +Geometry of help box. +.TP 22 +.B "*cmapName" +Name used for private colormap. The default for all IRAF imaging applications +is "image". Gterm widget based imaging applications which have the same value +of cmapName will share the same colormap, minimizing colormap flashing and +allowing multiple applications to be run at the same time. +.TP 22 +.B "*basePixel" +The base colormap cell used by the display colormap. +.TP 22 +.B "*imagewin.warpCursor" +Warp pointer into image window when initiating a cursor read. +.TP 22 +.B "*imagewin.raiseWindow" +Raise image window when initiating a cursor read. +.TP 22 +.B "*imagewin.deiconifyWindow" +Deiconify image window if necessary when initiating a cursor read. +.TP 22 +.B "*imagewin.ginmodeCursor" +Type of cursor when a cursor read is in progress. The default is a +circle. Any selection from the X cursor font can be used. A special +case is "full_crosshair" which is the full crosshair cursor of the +Gterm widget. +.TP 22 +.B "*imagewin.ginmodeBlinkInterval" +Determines whether the cursor blinks when a cursor read is in progress. +The value is given in milliseconds. +.TP 22 +.B "*imagewin.color0" +Background color. +.TP 22 +.B "*imagewin.color1" +Foreground color. +.TP 22 +.B "*imagewin.color8" +Color assigned the panner window. +.TP 22 +.B "*imagewin.color9" +Color used for the tileFrames highlight. +.TP 22 +.B "*imagewin.width" +Width of the main image window. +.TP 22 +.B "*imagewin.height" +Height of the main image window. +.TP 22 +.B "*pannerArea" +Area in pixels of the panner/magnifier window. +.TP 22 +.B "*pannerGeom" +Where to place the panner/magnifier window. +.TP 22 +.B "*magnifierArea" +Area in pixels of the magnifier window. +.TP 22 +.B "*magnifierGeom" +Where to place the magnifier window. +.TP 22 +.B "*wcsboxGeom" +Where to place the coords box. +.TP 22 +.B "*maxContrast" +Maximum contrast value. +.TP 22 +.B "*showToolBar" +Show the Toolbox menubar on startup. +.TP 22 +.B "*showPanelBar" +Show the Panels menubar on startup. + +.sp +.SH DESCRIPTION +.LP +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept client connections +simultaneously on fifo pipes, unix domain sockets, or inet sockets. A +display client like the IRAF \fIDISPLAY\fP task makes a connection and sends +the image across using an IIS protocol. Once the image is loaded in the +display buffer it may be enhanced, saved to a disk file in a number of +different formats, or printed as Encapsulated Postscript to a printer or +disk file. Up to four frame buffers are allowed, these may be displayed +simultaneously in a tiled mode, or blinked frame-to-frame. Each frame may +have its own colormap or brightness/contrast enhancement. Pan/Zoom and +cursor readout are permitted using \fImarkers\fP, on-line help is also +available. + +When run in standalone mode, images (currently IRAF OIF, GIF, Sun Rasterfiles +or simple FITS formats are permitted) may be loaded on the command line or by +using the Load Panel. This allows you to browse images and perform the same +manipulations as if they had been displayed by a client. + +.SS "GUI OVERVIEW" + +The GUI consists of a large image display window and a number of smaller +pannels that control various specific functions such as image Load, Save +and Print as well as a general purpose Control Panel. The main window +menubar has several menu buttons to the left: the \fIFiles\fR menu is used +to load/save/print an image as well as quit the task. The \fIView\fR menu +let's you select the image orientation, zoom, colormap or frame. The +\fIOptions\fR menu allows you to call up control panels, toggle markers +or blinking etc. Some of this functionality is duplicated elsewhere in +the GUI. + +The right side of the menubar contains command buttons to flip the +image as well as buttons for frame selection. The \fIToolbox Button\fR is +labelled with a 'T', when this is enabled a second menubar appears below +the main one containing a number of command buttons providing quick access +to functions otherwise found elsewhere in the GUI. From the left these +buttons include: +.nf + + symbol - zoom in + Magnify - set zoom factor 1 + - symbol - zoom out + Inv - Invert contrast + Norm - Normalize colormap + Match - Match LUTs + Reg - Register + Cntr - Center frame + < arrow - decrease blink interval + Blink - Toggle frame blink + > arrow - inrease blink interval + <-> symbol - X-flip and Y-flip + |+| symbol - Tile Frame toggle + < arrow - previous frame + <number> - select frame + > arrow - next frame +.fi +The image flip and +frame selection buttons are also moved from the main menubar to provide +more space for the image title. Next to the toolbox toggle is the +\fIControl Panels\fR button which operates in a similar manner. When enabled +a second menubar appears with more buttons: on the left side are two icons +used as accelerators for a disk save (the floppy icon) and print function +(the printer icon), the parameters used for these operations are those which +have seen set through their respective control panel or the task resources. +The middle two sections of buttons are toggles which manage the control +panels for each function or the main imagewindow markers. Finally a help +and a quit button for the task. By default these two extra menubars are +disabled to provide more screen space for the image, they are controlled +by the task \fI*showToolBar\fR and \fI*showPanelBar\fR resources or the +\fI-showToolBar\fR and \fI-showPanelBar\fR command line flags. + +For more detailed information on the operation of the control panels please +see the on-line help (i.e. use the '?' button or Alt-h keystroke in the +main image window). + +.SS "MOUSE OPERATIONS" + +Clicking and dragging MB1 (mouse button 1) in the main image window creates +a rectangular region marker, used to select a region of the image. If you do +this accidentally and don't want the marker, put the pointer in the marker +and type DELETE or BACKSPACE to delete the marker. With the pointer in the +marker, MB3 will call up a marker menu listing some things you can do with +the marker, like zoom the outlined region. MB1 can be used to drag or resize +the marker. See below for more information on markers. + +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. + +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the +display. + +.SS "KEYSTROKE ACCELERATORS" + +The following keystrokes are currently defined in the GUI: + +.TP 12 +.B "Ctrl-b" +Backward frame +.sp -0.5 +.TP 12 +.B "Ctrl-c" +Center frame +.sp -0.5 +.TP 12 +.B "Ctrl-f" +Forward frame +.sp -0.5 +.TP 12 +.B "Ctrl-i" +Invert +.sp -0.5 +.TP 12 +.B "Ctrl-m" +Toggle magnifier +.sp -0.5 +.TP 12 +.B "Ctrl-n" +Normalize +.sp -0.5 +.TP 12 +.B "Ctrl-p" +Toggle panner +.sp -0.5 +.TP 12 +.B "Ctrl-r" +Register +.sp -0.5 +.TP 12 +.B "Ctrl-s" +Match LUT scaling +.sp -0.5 +.TP 12 +.B "Ctrl-t" +Tile frames toggle +.sp -0.5 +.TP 12 +.B "Ctrl-u" +Unzoom (zoom=1) +.sp -0.5 +.TP 12 +.B "Ctrl-x" +Flip X +.sp -0.5 +.TP 12 +.B "Ctrl-y" +Flip Y + +.TP 12 +.B "Alt-b" +Blink frames (toggle) +.sp -0.5 +.TP 12 +.B "Alt-c" +Control panel (toggle) +.sp -0.5 +.TP 12 +.B "Alt-h" +Help popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-i" +Info box popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-l" +Load file popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-p" +Print popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-s" +Save popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-t" +TclShell popup (toggle) + +.TP 12 +.B "Ctrl-Alt-q" +Quit +.sp -0.5 +.TP 12 +.B "Ctrl-Alt-f" +Fitframe + +.TP 12 +.B "Ctrl-=" +Print using current setup +.sp -0.5 +.TP 12 +.B "Ctrl-<" +Decrease blink rate (blink faster) +.sp -0.5 +.TP 12 +.B "Ctrl->" +Increase blink rate (blink slower) +.sp -0.5 +.TP 12 +.B "Ctrl-+" +Zoom in +.sp -0.5 +.TP 12 +.B "Ctrl--" +Zoom out + +.TP 12 +.B "Ctrl-[hjkl] or <arrow_key>" +Move cursor one pixel in each direction +.sp -0.5 +.TP 12 +.B "Ctrl-Shift-[hjkl] or Shift-<arrow_key>" +Move cursor ten pixels in each direction +.sp -0.5 +.TP 12 +.B "Ctrl-<arrow_key>" +Move one full panner frame in each direction +.sp -0.5 +.TP 12 +.B "Ctrl-Alt-<arrow_key>" +Move one half panner frame in each direction +.sp -0.5 +.TP 12 +.B "Alt-1 thru Alt-4" +Set frame displayed +.sp -0.5 +.TP 12 +.B "Ctrl-1 thru Ctrl-9" +Set integer zoom factor + +.LP +\fBNOTE:\fP These keystrokes only work with the cursor in the main image window, +not on the subwindows or in markers since they are implemented as +\fIimagewin\fP translations. If a command does not work, check the cursor +location. + +.SH "CLIENT CONNECTIONS" +.LP +XImtool allows clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument or \fI*fifo\fP resource. Values should +be specified as the root pathname to a pair of fifo pipes whose last +character is 'i' or 'o', these characters will be added automatically when +opening the pipes. For example, to use the default pipes the path would +be specified as simply "/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch or +a \fI*port\fP resource. This permits connecting to the server +over a remote network connection anywhere on the Internet. +A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch or the \fI*unixaddr\fR resource. Legal values +should be specified as a filename to be used for the socket, up to two "%d" +fields are allowed and will be replaced by the userid. An empty string value +disables this connection. +.LP +By default ximtool listens simultaneously for client connections on all three +types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + +.SS "COMMUNICATIONS PROTOCOL" + +Clients communicate with XImtool using a protocol developed originally for +IIS (International Imaging Systems) Frame Buffer hardware, the so-called +"IIS protocol"; other more modern protocols will likely be supported in the +future. The IIS protocol is basically a command packet stream with a header +describing the operation to be performed (select frame, load display, read +cursor, etc), and an optional data packet containing e.g. pixels. It is beyond +the scope of this document to describe fully the details of the protocol; +interested users should contact \fIiraf@noao.edu\fP for further information. + +.SH "FRAME BUFFERS" + +XImtool starts up using default frame buffer size of 512x512 pixels, two +(of four possible) frames will be created. When loading +disk images (i.e. run in standalone mode) the frame buffer configuration file +will be searched for a defined frame buffer that is the same size or larger +than the current image, if no suitable buffer can be found a custom frame +buffer the same size as the image will be created in an unused portion of +the configuration table. When used as a display server the frame buffer +configuration number is passed in by the client and loaded explicitly even +if it means clipping the image. If a new frame buffer is +a different size than previously defined frames, all available frames +will be initialized and cleared prior to the display. The default frame buffer +configuration file is /usr/local/lib/imtoolrc, +this can be overridden by defining a IMTOOLRC environment variable naming +the file to be used, by creating a .imtoolrc file in your home directory, or +a new file may be specified using the \fI-imtoolrc\fR command line flag or +\fIimtoolrc\fR application resource. + +The format of the frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 4 frames, configuration numbers need not be sequential. + +\fBNOTE:\fR When defining a new frame buffer for use with client software +such as IRAF the user must also remember to define those frame buffers in +the IRAF \fIdev$graphcap\fR file. + +.SH "MARKERS" + +Although ximtool doesn't do much with markers currently, they are a general +feature of the \fIGterm\fP widget and are used more extensively in other +programs (e.g. the prototype IRAF science GUI applications). XImtool uses +markers for the marker zoom feature discussed above, and also for the panner, +magnifier and the coordinates box. All markers share some of the same +characteristics, so it is worthwhile learning basic marker manipulation +keystrokes. +.TP 3 +\fBo\fP +MB1 anywhere inside a marker may be used to drag the marker. +.TP 3 +\fBo\fP +MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +.TP 3 +\fBo\fP +Shift-MB1 on the corner of most markers will rotate the marker. +.TP 3 +\fBo\fP +Markers stack, if you have several markers and you put one on top of +the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +.TP 3 +\fBo\fP +MB2 in the body of a marker "lowers" the marker, i.e. moves it to the +bottom of the stacking order. +.TP 3 +\fBo\fP +Delete or backspace in a marker deletes it. +.TP 3 +\fBo\fP +Markers have their own translation resources and so the default +keystroke commands will not be recognized when the cursor is in a marker. +.LP +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back if you delete it, or you can reset the toggle in +the control panel). + +.SS "PANNER MARKER" + +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. + +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned below apply to these markers as well, e.g. you can use MB1 to +reposition on the panner window within the main image display window, or to +drag the region marker within the panner (pan the image). Resizing the +region marker zooms the image; this is a non-aspect constrained zoom. The +panner window itself can be resized by dragging a corner with MB1. Typing +delete or backspace anywhere in the panner window deletes the panner. + +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to hitting MB2 in the main display +window to pan the image. + +The panner marker can be disabled by defining the \fIdisplayPanner\fP +GUI resource, its size and location can be controlled using the +\fIpannerArea\fP and \fIpannerGeom\fP GUI resources respectively. + +.SS "MAGNIFIER MARKER" + +The magnifier marker can be used to zoom in on a small area around the cursor. +It will be updated as the cursor moves but only for small motions (either +mouse movement or with the cursor movement keystrokes) to minimize the +impact on the system. The zoom factor is expressed as some fraction of the +size of the magnifier marker itself. The default zoom is 4, i.e. the area +in the marker represents and area in the image that's one-fourth the size +of the marker. Other zoom factors may be selected using the popup menu +created by hitting MB1 in the marker. + +By default the magnifier marker is not visible, to toggle it select the +\fIMagnifier\fR option from the \fIOptions\fR menubar button. Alternatively, +for just a quick look holding down the Shift and MB1 buttons will display +the marker until the button is released. + +The magnifier marker can be disabled by defining the \fIdisplayMagnifier\fP +GUI resource, its size and location can be controlled using the +\fImagnifierArea\fP and \fImagnifierGeom\fP GUI resources respectively. + +.SS "COORDS BOX MARKER" + +XImtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +linear client-defined coordinate system. The coords box feature is used to +display these world coordinates as the pointer is moved about in the image +window. + +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated a +"+" will be displayed after the intensity value. + +The coords box is a text marker, it can be moved and resized +with the pointer like any other marker. The coords box marker can be +disabled by defining the \fIdisplayCoords\fP GUI resource, its location +can be controlled by the \fIwcsboxGeom\fP GUI resource. + +.SS "MARKER MENU OPTIONS" + +Except for the panner and WCS markers, MB3 (mouse button 3) calls up the +marker menu providing a limited set of functions common to all markers: +.TP 3 +\fBo +Zoom\fP does an equal aspect zoom of the region outlined by the marker. In +this way you can mark a region of the image and zoom it up. +.TP 3 +\fBo +Fill\fP exactly zooms the area outlined by the marker, making it fill the +display window. Since the marker is not likely to be exactly square, +the aspect ratio of the resultant image will not be unitary. +.TP 3 +\fBo +Print\fP prints the region outlined by the marker to the printer or file +currently configured by the Print Panel. +.TP 3 +\fBo +Save\fP saves the region outlined by the marker to the file currently +configured by the Save Panel. +.TP 3 +\fBo +Info\fP prints a description of the marked region. The text is printed in +the Info Panel. +.TP 3 +\fBo +Unrotate\fP unrotates a rotated marker. +.TP 3 +\fBo +Color\fP is a menu of possible marker colors. +.TP 3 +\fBo +Type\fP is a menu of possible marker types. This is still a little buggy +and it isn't very useful, but you can use it to play with different +types of markers. +.TP 3 +\fBo +Destroy\fP destroys the marker. You can also hit the delete or backspace +key in a marker to destroy the marker. + +.SH "CONTROL PANEL" + +XImtool has a control panel which can be used to exercise most of the +capabilities the program has for image display. The control panel can be +accessed either via the \fBOptions\fP menu from the main window menubar, or by +pressing the leftmost button in the row of buttons at the upper right side +of the display. + +.SS "VIEW CONTROLS" + +The \fBFrame box\fP will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 4) will be created +automatically if requested by the client. The number of frame buffers +created at startup can be controlled using the \fI-nframes\fP command-line +switch or the \fIdefNFrames\fP resource. + +The \fBtext display\fP window gives the field X,Y center, X,Y scale factors, +and the X,Y zoom factors. The scale factor and the zoom factor will be the same +unless \fIautoscale\fP is enabled. The scale is in units of display pixels per +frame buffer pixel, and is an absolute measure (it doesn't matter whether or +not autoscale is enabled). Zoom is relative to the autoscale factor, which +is 1.0 if autoscaling is disabled. This information is also presented in the +Info panel. + +The numbers in the \fBZoom box\fP are zoom factors. Blue numbers zoom, red +numbers dezoom. \fIZoom In\fP and \fIZoom Out\fP may be used to go to larger +or smaller zoom factors, e.g. "Ctrl-5" followed by "Zoom In" will get you to +zoom factor 10. Specific zoom factors may also be accessed directly as Control +keystrokes, e.g. Ctrl-5 will set zoom factor 5. \fICenter\fP centers the field. +\fIToggle Zoom\fP toggles between the current zoom/center values, and the +unzoomed image. + +\fIAspect\fP recomputes the view so that the aspect ratio is 1.0. Aspect also +integerizes the zoom factor (use the version in the View menu if you don't +want integerization). + +\fIFit Frame\fP makes the display window the same size as the frame buffer. Note +that autoscale has much the same effect, and allows you to resize the +display window to any size you want, or view images too large to fit on the +screen. + +.SS "ENHANCEMENT CONTROLS" + +At the top is a scrolled list of all the available colormaps. Click on the +one you want to load. You can add your own colormaps to this list by +defining the \fIcmap[12]\fP or \fIcmapDir[12]\fP command line flags or +application resources. + +The two sliders adjust the contrast (upper slider) and brightness (lower +slider) of the display. The \fIInvert\fP button inverts the colormap (multiples +the contrast by -1.0). Note that due to the use of the private colormap the +sliders are a bit sluggish when dragged to window the display. If this is +annoying, using MB3 in the display window is faster. + +The \fINormalize\fP button (on the bottom of the control panel) will normalize +the enhancement, i.e. set the contrast and brightness to the default one-to-one +values (1.0, 0.5). This is the preferred setting for many of the pseudocolor +colortables and for private colormaps loaded from disk images. The +\fIInitialize\fP button does a reset of the server. + +.SS "BLINK CONTROLS" + +\fIBlink frames\fP is the list of frames to be blinked. When blink mode is +in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered +in the list more than once. To program an arbitrary list of blink +frames, hit the Reset button and click on each blink frame button until +it is set to the desired frame number. + +The \fIBlink Rate\fP can be adjusted as slow or as fast as you want using the +arrow buttons. If you set the blink rate small enough it will go to +zero, enabling single step mode (see below). + +The \fIRegister\fP button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. + +The \fIMatch LUTs\fP button sets the enhancement of all blink frames to the +same values as the display frame. Frames not in the blink list are not affected. + +The \fIBlink\fP button turns blink on and off. When the blink rate is set to +zero the Blink button will single step through the blink frames, one +frame per button press. + +\fBNOTE:\fP You can blink no matter what ximtool options are in effect, but +many of these will slow blink down. To get the fastest blink you may want to +turn off the panner and coords box, and match the LUTs of all the blink frames. +All the ximtool controls are fully active during blink mode, plus you can +load frames etc. + +.SS "OPTIONS:" +.TP 5 +.B "Panner" +Toggles whether to display the panner marker. +.TP 5 +.B "Coords Box" +Toggles whether to display the coordinate box marker. +.TP 5 +.B "Autoscale" +If autoscale is enabled then at zoom=1, the frame buffer will be +automatically scaled to fit within the display window. With autoscale +disabled (the default), the image scale is more predictable, but the +image may be clipped by the display window, or may not fill the display +window. +.TP 5 +.B "Antialiasing" +When dezooming an image, i.e., displaying a large image in a smaller +display window, antialiasing causes all the data to be used to compute +the displayed image. If antialiasing is disabled then image is +subsampled to compute the displayed image. Antialiasing can prevent +subsampling from omitting image features that don't fall in the sample +grid, but it is significantly slower than dezooming via subsampling. +The default is no antialising. +.TP 5 +.B "Tile Frames" +The default display mode is to view one frame at a time. In tile frames +mode, 2 or 4 frames may be viewed simultaneously in the display window. +All the usual operations (zoom and pan, colortable enhancement, cursor +readback, etc.) still work for each frame even when in tile frames mode. +.TP 5 +.B "Warnings" +The warnings options toggles whether you see warning dialog boxes in +situations like overwriting an existing file, clearing the frame +buffer, etc. + +.SH "COLORMAP SELECTION" + +By default XImtool will display images using either a grayscale colormap (e.g. +if loaded by a client), or a private colormap when loading an image from disk +that contains a colormap. Each frame defines its own colormap so you can +define different colormaps or enhancements for each frame, they will change +automatically as you cycle through the frames. + +.SS "BUILTIN COLORMAPS" + +Once loaded, the colormap may either be changed using the builtin colormap +menu under the View menu button on the main window, or from the Enhancement +box on the control panel. XImtool has about a dozen colormap options +builtin, other user-defined colormaps may optionally be loaded. It is not +presently possible to save colormaps for later use. + +.SS "USER-DEFINED COLORMAPS" + +The \fIcmap[12]\fP and \fIcmapDir[12]\fP resources (or command line arguments) +are used to tell which specific colormaps to make available or where to look +for colortables respectively. The colortables are loaded when ximtool starts +up, or when it is reinitialized (e.g. by pressing the Initialize button in +the control panel). XImtool will ignore any files in the colormap directory +which do not look like colortables. New colortables will also be added +automatically for each image loaded from disk. + +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, and +blue values scaled to the range 0.0 (off) to 1.0 (full intensity). + + R G B + R G B + (etc.) + +Blank and comment lines (lines beginning with a '#') are ignored. + +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. XImtool will interpolate the table as necessary to +compute the colortable values used in XImtool. XImtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. + +The name of the colortable as it will appear in the XImtool control panel is +the root name of the file, e.g., if the file is "rainbow.lut" the colortable +name will be "rainbow". Lower case names are suggested to avoid name +collisions with the builtin colortables. Private colormaps for disk images +will be have the same name as the image loaded. If the same colortable file +appears in multiple user colortable directories, the first one found will be +used. + +.SS "MINIMIZING COLORMAP CONFLICTS" + +The Gterm widget used by XImtool (i.e. the main display window) uses a private +global colormap for display, this allows it to have greater control over color +cell allocation but can occasionally also cause "colormap flashing" as the +mouse is moved in and out of the application. The problem here is that +in a system with only an 8-bit colormap (256 colors) all applications must +compete for colors, programs such as XV or Netscape allocate colors from the +default colormap leaving only a few free cells for XImtool. Since XImtool +defines a private global colormap it is still able to allocate the needed +cells rather than failing, but it's allocating cells already used by other +applications. As the mouse moves out of the ximtool window those cells are +once again defined in terms of the default colormap, so the ximtool window +is then using a different colormap. It is this switching of the colormap +context that causes the flashing to occur, but there are a few things that +can be done to help minimize this. + +XImtool logically defines 200 colors which the client image display program +can use to render pixels. However, ximtool may or may not actually allocate +all of those colors. By default it currently allocates only about 192 +colors, to reserve 64 colors for the other windows on the screen. You don't +normally notice this as 1) usually the default screen colormap has enough +free cells to allow ximtool to match the colors, and 2) the extra unallocated +cells correspond to the brightest pixels in the rendered image, and these +colors may not be used or usually only correspond to a few small regions +near the saturated cores of bright objects. + +You can eliminate this problem by setting the \fIbasePixel\fP resource to e.g. +48 instead of 64, which will let the gterm widget allocate all 200 colors. +However, this isn't recommended for normal use as it will increase the +likelihood of colormap flashing. If you change \fIbasePixel\fP, either restart +the X server or set the resource \fIcmapInitialize\fP=\fITrue\fP to force the +gterm widget to update its global colormap resource in the X server. +The colormap resource may also be deleted by using the command + + \fIxprop -root -remove GT_image\fP + +These options may also be set on the command line when first starting up. + +In general one can set the Gterm widget resources \fIbasePixel\fP +and \fImaxColors\fP to specify the region of colormap space to be used for +image display. If you set \fImaxColors\fP to a small value, the 200 logical +colors defined by the widget will be mapped by the imtool color model into +whatever number of colors are actually available to the widget. For example, +in the default setup, 200 color values are really being mapped into 192 color +cells used for display, the remaining colors are used for buttons, menus etc +and are allocated from the default colormap by the X toolkit when the +application starts up. + +Even though the Gterm widget uses a private colormap, it is a private +\fIglobal\fP colormap meaning that all Gterm widgets share the same colormap. +An example of colormap sharing in ximtool is the main image window and the +colorbar window. These are two separate gterm widgets that share the same +colormap. They have to share the same colormap, as otherwise when you +windowed the main image window the colorbar window would not accurately +reflect the modified colormap. By default two separate ximtools would also +share the same colormap meaning contrast enhancements in one window would +affect the other. By resetting the \fIcmapName\fP command line option or +resource you can change the name of the private colormap used causing +separate ximtools to use different colormaps, but note this also creates +colormap flashing between the two windows that cannot easily be avoided. +By setting the \fIcmapName\fR to "default" the widget will allocate colors +from the default colormap, but this is of little use at the moment. + +There are a number of other resources that can be used to modify the behavior +of the Gterm widget color management scheme, but these are the most useful ones. +For question and further information feel free to contact \fIiraf@noao.edu\fP. + +.SH "LOAD PANEL" + +The Load Panel allows you load images from disk directly to the frame +buffer, this is analogous to loading an image on the command line except +that browsing is possible. At present recognized formats include IRAF OIF +format (i.e. \fI.imh\fP extension), simple FITS files, GIF, and Sun rasterfiles. +The task will automatically sense the format of the image and load it +appropriately. Images with private colormaps (such as GIF) will be loaded +using the private colormap (meaning that changing the brightness/contrast +enhancements will render a random-colored image), all others will be loaded +with a grayscale colormap. If the \fIGrayscale\fP button is enabled the image +colormap will be converted to grayscale and loaded as the standard grayscale +colormap. The Load panel will close automatically once the image has loaded +unless the \fIBrowse\fP button has been set. + +When loading new images the frame buffer configuration table will +be searched for a frame buffer that is the same size or larger than the new +image size, if no frame buffer can be found a custom buffer exactly the size +of the image will be created. This means that the image may not fill the +display window when loaded, or you may see a subsection of the image in the +main display window. Setting the \fIautoscale\fP option will scale the entire +image to fit the main display window, the full frame buffer will always be +visible in the Panner marker window. + +Images with more colors than can be displayed will automatically be +quantized to the number of available colors before display, 24-bit formats +are not currently supported (but may be in the future and will be similarly +quantized). + +Formats which permit larger than 8-bit pixels will be sampled on a grid +to determine an optimal range in the data to be used to compute a linear +transformation to the number of display colors. This is the same sampling +and transformation used by the IRAF \fIDISPLAY\fR task when computing the +\fIz1/z2\fP values and provides a much better initial display than simple +truncation to 8-bits. +.TP 5 +.B "Directory Browsing" +The load panel contains a list of files in the current directory that +may be selected for loading by selecting with left mouse button. If the +file is a directory the contents of the new directory will be loaded, +if it's a plain file an attempt will be made to load it as an image +otherwise an error popup will appear. Directories in the list are identified +with a trailing '/' character, you will always see any subdirectories +listed even if a filter is specified. + +The \fIRoot\fP button will reset the current directory to the system root +directory. The \fIHome\fP button will reset the current directory to the +user's login directory, the \fIUp\fP button moves up one directory level, and +\fIRescan\fP reloads the file list by rescanning the directory. The current +working directory is given below the file selection window. +.TP 5 +.B "File Patterns" +By default all files and directories will be listed. You may specify a +filter to e.g. select only those files with a given extension like +"*.fits" to list only files with a ".fits" extension. Directories will +always be seen in the list and are identified with a trailing '/' +character. Any valid unix pattern matching string will be recognized. +.TP 5 +.B "Direct File Load" +If you know exactly which file you wish to load, you may enter its +name in the \fILoad File\fP text box and either hit <cr> or the Load button +to load it. An absolute or relative path name may be given, if a simple +filename is specified it will be searched for in the current working directory. +.TP 5 +.B "Frame Selections" +By default images will be loaded into frame number 1, you may select a +different frame using the Frame menu button to cycle through the available +frames. + +.SH "SAVE PANEL" + +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, any general graphics +markers, or overlay graphics displayed by the client program). Presently, +only the contents of the main display window may be saved, there is no +facility for saving the undisplayed contents of the entire frame buffer +other than to enable the autoscale feature. A limited number of formats are +currently available, others will be added in future versions. +.TP 5 +.B "File Name" +The File Name text box allows you to enter the file name of the saved +file. A "%d" anywhere in the name will be replaced by a sequence number +allowing multiple frames to be saved with unique names. +.TP 5 +.B "Format" +The Format box allows you to choose the format of the image to be +created. Not all formats are currently implemented. +.TP 5 +.B "Color" +The Color box lets you choose the color type of the image to be +created. The options will change depending on the format, e.g. FITS +doesn't allow color so no color options will be allowed. Formats which +allow 24-bit images will be written using the current colormap after +converting to a 24-bit image, pseudocolor images will be written with +the current colormap. + +.SH "PRINT PANEL" + +The Print Panel allows you dump the contents of the main display window as +Encapsulated Postscript to either a named printer device or to a disk file. +The \fIPrint To\fP selects the type of output, the \fIPrint Command\fP box +will adjust accordingly, either as a Unix printer command or as a file name. +A "%d" anywhere in the name for disk output will be replaced by a sequence +number allowing multiple frames to be saved with unique names. Selecting +printers from the installed list will automatically change the command to be +used to generate the output. This command does not necessarily need to be a +printer command, the printer configuration file lets you define any command +string to process the image. + +.SS "COLOR OPTIONS" + +The Color box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap +and enhancements. + +.SS "POSTSCRIPT OPTIONS" + +.TP 5 +.B "Orientation" +Set the page orientation. +.TP 5 +.B "Paper Size" +Select the paper size to be used. +.TP 5 +.B "Image Scale" +Set the scale factor used to compute the final image size. No checking is +done to make sure the image will fit correctly on the page. + +.SS "PROCESSING OPTIONS" +.TP 5 +.B "Auto Scale" +Toggles whether or not the image is automatically scaled +to fit the page. If not enabled, the image scale will be used to +determine the output image size, otherwise the image will be scaled down +(if necessary) to fit on the page. +.TP 5 +.B "Auto Rotate" +Determines whether or not the image will be rotated to fit +on the page. When set, an image larger than the current orientation +will be rotated and possibly scaled to fit the page, otherwise the image +may be scaled so that it fits in the current orientation. +.TP 5 +.B "Max Aspect" +Automatically increases the scale so the image fills the page in the current +orientation. +.TP 5 +.B "Annotate" +The annotate option toggles whether or not the final file includes +annotation such as the image title, a colorbar, and axis labels. There is +currently no option for partial annotation. + +.SS "ANNOTATION OPTIONS" + +.TP 5 +.B "Annotate" +Selects whether Postscript image is to be annotated. +.B "Title" +Annotate with a title on the top of the image. +.B "Borders" +Annotate with borders surrounding the image giving image coordinates. +.B "Colorbar" +Annotate with colorbar at the bottom of the image +.B "Title String" +Title string to use when \fItitle\fR is selected. The special value +\fIimtitle\fR will force the title to be the currently displayed image title, +otherwise it will be this user-selected field. + +.SS "PRINTER SELECTION" + +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the \fI-printConfig\fP command line switch or \fIprintConfig\fP +resource. The format of the file is simply + + \fIname\\tcommand\fP + +The \fIname\fP value is what appears in the selection list and may be more +than a single word, the \fIcommand\fP can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command +will be a simple \fIlpr -Pfoo\fP or some such, but can also include converters +or previewers. At most 128 printer commands may be used. + +.SH "INFO PANEL" + +The information panel is underused at present but is meant to provide basic +information about the frame being displayed. It is updated to be current +while changing enhancements, pan/zoom regions, or frame selection. In cases +where the image title string is truncated in the main display window, the +user can always pop up the info window to see the full title. + +.SH "TCLSHELL" + +The \fITclShell\fP allows the user to type commands directly to the TCL +interpreter, letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. It is used as a +development or debugging tool for the GUI, but for an example of what it +does, bring it up and type a command such as + + \fIsend helpButton set background red\fP + + +.SH ENVIRONMENT +DISPLAY specifies which display terminal to use +.br +IMTOOLRC frame buffer configuration file +.br +imtoolrc frame buffer configuration file (alternative) + +.SH FILES +/usr/local/lib/imtoolrc default frame buffer configuration file +.br +/usr/local/lib/ximprint.cfg default printer configuration file +.br +/usr/local/lib/imtoolcmap default colormap directory +.br +/dev/imt1i default input fifo +.br +/dev/imt1o default output fifo +.br +/tmp/.IMT%d default unix socket + +.SH BUGS + +.SH SEE ALSO +xgterm(1), xtapemon(1) + +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-mag b/vendor/x11iraf/ximtool/OLD/ximtool-mag new file mode 100755 index 00000000..8e051fc8 --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-mag @@ -0,0 +1,5494 @@ +#!/bin/csh -f +# +# XIMTOOL-ALT -- Script wrapper to start XImtool using the alternate GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# Arguments specific to this GUI include: +# +# -displayMagnifier <bool> show magnifier marker on startup +# -showToolBar <bool> show toolbar on startup +# -showPanelBar <bool> show panelbar on startup +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 106 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool Experimental GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm <resource>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else if ("$1" == "-displayMagnifier") then + if ("$2" != "") then + shift + else + echo "missing argument to '-displayMagnifier <bool>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.displayMagnifier:$1$q" + else if ("$1" == "-showToolBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showToolBar <bool>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showToolBar:$1$q" + else if ("$1" == "-showPanelBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showPanelBar <bool>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showPanelBar:$1$q" + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-ALT.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + +#!/usr/local/bin/obmsh +# +# XIMTOOL-MAG.GUI -- Default GUI for the Ximtool-mag image display server. +# +# Version 1.2 -- Released 4/30/2000 + + +reset-server +appInitialize ximtool XImtool { + *objects:\ + toplevel Layout display \ + display Layout menubar \ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar TextBox imageTitle \ + menubar Toggle panelButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ + display Gterm imagewin \ + display Gterm colorbar \ +\ + toplevel TopLevelShell info \ + info Paned infoPanel \ + infoPanel Box infoBox \ + infoBox Command infoDone \ + infoBox Command infoDown \ + infoBox Command infoUp \ + infoBox Command infoSave \ + infoBox Command infoUpdate \ + infoBox Command infoClear \ + infoPanel AsciiText infoText \ +\ + toplevel TopLevelShell controlShell \ + controlShell Layout controlPanel \ + controlPanel Group viewBox \ + controlPanel Group enhancementBox \ + controlPanel Group blinkBox \ + controlPanel Group optionsBox \ + controlPanel Frame controlBox \ +\ + viewBox Layout view \ + view Group frameSelect \ + frameSelect Layout frameBox \ + frameBox TextToggle frame1 \ + frameBox TextToggle frame2 \ + frameBox TextToggle frame3 \ + frameBox TextToggle frame4 \ + frameBox Command prevFrame \ + frameBox Command nextFrame \ + view Frame frameDataBox \ + frameDataBox TextBox frameData \ + view Group zoomBox \ + zoomBox Layout zoom \ + zoom TextButton toggleZoom \ + zoom TextButton zoomIn \ + zoom Command x1 \ + zoom Command z2 \ + zoom Command z3 \ + zoom Command z4 \ + zoom Command z5 \ + zoom Command z8 \ + zoom TextButton zoomOut \ + zoom TextButton centerFrame \ + zoom Command d2 \ + zoom Command d3 \ + zoom Command d4 \ + zoom Command d5 \ + zoom Command d8 \ + view Layout viewButtons \ + viewButtons Command aspect \ + viewButtons Command flipX \ + viewButtons Command flipY \ + viewButtons Command flipXY \ + viewButtons Command clearFrame \ + viewButtons Command fitFrame \ +\ + enhancementBox Layout enhance \ + enhance Scrollbar2 colorlistScroll \ + enhance Frame colorlistFrame \ + colorlistFrame Porthole colorlistPort \ + colorlistPort MultiList colorlist \ + enhance Frame colordataFrame \ + colordataFrame TextBox colordata \ + enhance Label contrastLabel \ + enhance Slider2d contrastSlider \ + enhance Label brightnessLabel \ + enhance Slider2d brightnessSlider \ + enhance Command invertButton \ + enhance Command optimizeButton \ +\ + blinkBox Layout blink \ + blink Label blinkFramesLabel \ + blink Command blinkFrame1 \ + blink Command blinkFrame2 \ + blink Command blinkFrame3 \ + blink Command blinkFrame4 \ + blink Command blinkReset \ + blink Label blinkRateLabel \ + blink Frame BRframe \ + BRframe Layout BRlayout \ + BRlayout Arrow BRdecrease \ + BRlayout TextBox BRtext \ + BRlayout Arrow BRincrease \ + blink Command registerButton \ + blink Command matchButton \ + blink Toggle blinkButton \ +\ + optionsBox TextToggle pannerButton \ + optionsBox TextToggle magnifierButton \ + optionsBox TextToggle coordsBoxButton \ + optionsBox TextToggle autoscaleButton \ + optionsBox TextToggle antialiasButton \ + optionsBox TextToggle tileFramesButton \ + optionsBox TextToggle warningsButton \ +\ + controlBox Layout control \ + control Command initializeButton \ + control Command normalizeButton \ + control Command doneButton \ +\ + toplevel TopLevelShell tclShell\ + tclShell Paned tclPanel\ + tclPanel Box tclForm\ + tclForm Label tclLabel\ + tclForm Command tclClear\ + tclForm Command tclExecute\ + tclForm Command tclcloseButton\ + tclPanel AsciiText tclEntry\ +\ + toplevel TransientShell warning \ + warning Layout warn \ + warn Frame warnFrame \ + warnFrame Layout WFlayout \ + WFlayout Icon warnIcon \ + WFlayout TextBox warnText \ + warn TextButton warnOk \ + warn TextButton warnCancel \ + warn TextButton warnHelp \ +\ + toplevel TopLevelShell print_panel\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame \ + ScaleFrame Layout ScaleLayout \ + ScaleLayout Arrow SCdecrease \ + ScaleLayout TextBox SCtext \ + ScaleLayout Arrow SCincrease \ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle annotateButton\ + options TextToggle compressButton\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers \ + printers Scrollbar2 printlistScroll \ + printers Frame printlistFrame \ + printlistFrame Porthole printlistPort \ + printlistPort MultiList printlist \ +\ + cmdGroup Layout cmdLayout\ + cmdLayout TextButton okayPrint\ + cmdLayout Label printStatus\ + cmdLayout TextButton donePrint\ +\ + toplevel TopLevelShell save_panel\ + save_panel Layout saveLayout\ +\ + saveLayout Group saveNameGroup\ + saveLayout Group saveOptGroup\ + saveLayout Group saveCmdGroup\ +\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox \ + saveDataBox TextBox saveData \ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle x11Button\ + formats TextToggle pnmButton\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout TextButton okaySave\ + saveCmdLayout Label saveStatus\ + saveCmdLayout TextButton doneSave\ +\ + toplevel TopLevelShell load_panel \ + load_panel Layout filesLayout \ + filesLayout Group imagesGroup \ + imagesGroup Layout imagesLayout \ + imagesLayout Label imtemplateLabel \ + imagesLayout Frame imtemplateFrame \ + imtemplateFrame AsciiText imtemplateText \ + imagesLayout Scrollbar2 imlistScrollbar \ + imagesLayout Frame imlistFrame \ + imlistFrame Porthole imlistPorthole \ + imlistPorthole MultiList imageList \ + imagesLayout TextButton rootButton \ + imagesLayout TextButton homeButton \ + imagesLayout TextButton upButton \ + imagesLayout TextButton rescanButton \ + imagesLayout TextToggle grayToggle \ + imagesLayout TextToggle browseToggle \ + imagesLayout Label dirLabel \ + imagesLayout Label fnameLabel \ + imagesLayout Frame filnamFrame \ + imagesLayout Label frameLabel \ + imagesLayout Command frameFrame \ + filnamFrame AsciiText fnameText \ +\ + filesLayout Group fbuttonsGroup \ + fbuttonsGroup Layout fbuttonsLayout \ + fbuttonsLayout Command filesLoadButton \ + fbuttonsLayout Label filesStatus \ + fbuttonsLayout Command filesCloseButton \ +\ + toplevel TopLevelShell help_panel \ + help_panel Layout helpLayout \ + helpLayout Layout helpMenuLayout \ + helpLayout Layout helpInfoLayout \ +\ + helpMenuLayout Command helpBack \ + helpMenuLayout Command helpForward \ + helpMenuLayout Command helpHome \ + helpMenuLayout Command helpClose \ +\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText \ +\ + helpInfoLayout Label helpIRAFLogo \ + helpInfoLayout Label helpInfo1 \ + helpInfoLayout Label helpInfo2 \ + helpInfoLayout Label helpInfo3 \ + helpInfoLayout Label helpNOAOLogo \ +\ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter filelist\ + ximtool Parameter help + + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + + *display.background: gray + *display.borderWidth: 0 + + *display.debug: False + *display.layout: horizontal { \ + -1 \ + vertical { \ + 3 \ + menubar < +inf -inf * > \ + 3 \ + imagewin < +inf -inf * +inf - inf > \ + 3 \ + colorbar < +inf -inf * > \ + } \ + -1 \ + } + + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + panelButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.background: gray65 + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 512 + *menubar*background: gray + *menubar*foreground: black + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.color8: #7c8498 + *imagewin.color9: steelblue + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(panel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !Shift<Btn1Down>: call(setDynamicMagnifier,1) \n\ + !Shift<Btn1Up>: call(setDynamicMagnifier,0) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift<Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 512 + *colorbar.height: 10 + + ! INFO box resources. + ! ------------------------------ + *info.geometry: 420x240 + *info.title: Information Panel + *info*Command.font: 7x13bold + *infoPanel*background: gray + *infoDone.label: Done + *infoDown.label: Down + *infoDown.sensitive: False + *infoUp.label: Up + *infoUp.sensitive: False + *infoSave.label: Save + *infoSave.sensitive: False + *infoUpdate.label: Update + *infoClear.label: Clear + *infoText*scrollVertical: always + *infoText*scrollHorizontal: whenNeeded + *infoText*displayCaret: False + *infoText*editType: append + *info*ScrollbarBackground: #c0c0c0 + *info*Scrollbar*background: #c0c0c0 + *info*Scrollbar*width: 17 + *info*Scrollbar*height: 17 + *info*Scrollbar*shadowWidth: 2 + *info*Scrollbar*cursorName: top_left_arrow + *info*Scrollbar*pushThumb: true + + + ! Main Control Panel. + ! ------------------------------ + *controlShell.title: XImtool Control + *controlShell.iconName: XimCon + *controlPanel*background: gray + *controlPanel*foreground: black + *controlPanel*TextBox.background: gray63 + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + *controlPanel*Command.highlightThickness: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + *blinkFrame1.font: 7x13bold + *blinkFrame2.font: 7x13bold + *blinkFrame3.font: 7x13bold + *blinkFrame4.font: 7x13bold + + *controlPanel.debug: False + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -1 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + controlBox < +inf * > \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 5 + + *view.debug: False + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + -1 \ + vertical { \ + 5 < -5 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 5 < -5 > \ + } \ + -1 \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 2 + *frameData.width: 130 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 5 + *frameSelect.innerOffset: 5 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame: + + *frameBox.debug: False + *frameBox.layout: vertical { \ + frame1 < +inf * > \ + frame2 < +inf * > \ + frame3 < +inf * > \ + frame4 < +inf * > \ + 10 < +inf -10 > \ + horizontal { \ + -1 \ + prevFrame \ + 10 < +inf -5 > \ + nextFrame \ + -1 \ + } \ + -1 \ + } + + *frameBox*location: 0 0 10 20 + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*highlightThickness: 0 + *frameBox*frame1.label: \ 1\ \ + *frameBox*frame2.label: \ 2\ \ + *frameBox*frame3.label: \ 3\ \ + *frameBox*frame4.label: \ 4\ \ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xx + *frameBox*nextFrame.label: xx + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 5 + *zoomBox.shrinkToFit: True + + *zoom.debug: False + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { \ + toggleZoom < +inf * +inf > \ + 2 \ + } \ + 2 \ + vertical { \ + 2 < +inf > \ + z5 \ + 1 < +inf > \ + z3 \ + 0 < +inf > \ + } \ + 2 \ + vertical { \ + zoomIn < +inf * +inf > \ + 2 \ + } \ + } \ + 1 < +inf > \ + horizontal { \ + 2 < +inf > \ + d8 d4 d2 x1 z2 z4 z8 \ + 2 < +inf > \ + } \ + 1 < +inf > \ + horizontal { \ + vertical { \ + 2 \ + zoomOut < +inf * +inf > \ + } \ + 2 \ + vertical { \ + 0 < +inf > \ + d3 \ + 1 < +inf > \ + d5 \ + 2 < +inf > \ + } \ + 2 \ + vertical { \ + 2 \ + centerFrame < +inf * +inf > \ + } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 0 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 0 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 0 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 0 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.debug: False + *viewButtons.layout: horizontal { \ + 5 < -2 > \ + aspect < +inf * > \ + 5 < -2 > \ + flipX < +inf * > \ + 5 < -2 > \ + flipY < +inf * > \ + 5 < -2 > \ + flipXY < +inf * > \ + 5 < -2 > \ + clearFrame < +inf * > \ + 5 < -2 > \ + fitFrame < +inf * > \ + 5 < -2 > \ + } + + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 5 + + *enhance.debug: False + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistScroll < * +inff -inff > \ + -1 \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + -1 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { \ + -1 \ + contrastLabel \ + 3 < -3 > \ + brightnessLabel \ + -1 \ + } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*FrameType: sunken + *enhance*FrameWidth: 2 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + *enhance*thumbColor: gray + + *colorlistScroll.location: 0 0 20 10 + *colorlistScroll.vertical: True + *colorlistScroll*minsize: 10 + *colorlist.width: 100 + *colorlist.height: 78 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 20 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 20 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + ! BLINK + ! --------------------- + *blinkBox.label: Blink + *blinkBox.location: 0 0 230 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 5 + + + *blink.debug: False + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + 3 \ + registerButton < +inf * > \ + 5 < -5 > \ + matchButton < +inf * > \ + 5 < -5 > \ + blinkButton < +inf * > \ + 2 \ + } \ + 3 < -3 > \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *controlPanel*blink*Arrow.foreground: gray + *controlPanel*blink*Arrow.background: gray63 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + *blinkFramesLabel.label: Blink Frames: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 2 + *BRtext.width: 40 + *BRtext.height: 25 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 5 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 25 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *magnifierButton.label: Magnifier + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *warningsButton.label: Warnings + + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 5 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.debug: False + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + doneButton < +inf * > \ + 1 \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize + *doneButton.label: Done + + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*background: gray + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + *warning*TextButton.frameWidth: 2 + *warning*TextButton.width: 40 + *warning*TextButton.height: 25 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 5 < -5 > \ + warnFrame < +inf * +inf > \ + 5 < -5 > \ + } \ + 1 < -1 > \ + horizontal { \ + 5 < -5 > \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 5 < +inf -5 > \ + warnHelp < +inf * > \ + 5 < -5 > \ + } \ + 1 < -1 > \ + } + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { \ + 5 < +inf -5 > \ + warnIcon \ + 5 < +inf -5 > \ + } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnOk.label: OK + *warnCancel.label: Cancel + *warnHelp.label: Help + *warnHelp.sensitive: False + + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel.title: Printer Setup + *print_panel.highlightThickness: 1 + *print_panel*background: gray + *print_panel*TextBox.background: gray63 + *print_panel*TextBox.foreground: black + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.background: gray63 + *print_panel*Arrow.foreground: gray + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 25 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*Label.background: gray + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -1 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 85 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 2 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout*Label.font: 7x13bold + *printCmdLayout.layout: horizontal { \ + -1 \ + labelLayout \ + 5 < -5 > \ + inputLayout < +inf -inf * +inf > \ + 2 \ + } + + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { \ + 5 \ + toLabel \ + 11 \ + printerLabel \ + -3 \ + } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + + *inputLayout*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { \ + 5 < -5 > \ + toPrinter \ + 5 < -5 > \ + toFile \ + 5 < +inf -inf > \ + } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + *printcmd*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 265 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 0 + *optLayout*borderWidth: 0 + *optLayout.layout: horizontal { \ + -1 \ + vertical { \ + 5 < -5 > \ + epsPageGroup < +inf -inf * > \ + 0 < -0 > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + 0 < -0 > \ + vertical { \ + 5 < -5 > \ + printColorGroup < +inf -inf * > \ + 0 < -0 > \ + printerGroup < +inf * +inf > \ + -1 \ + } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 5 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage*Label.font: 7x13bold + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel \ + 4 < -4 > \ + horizontal { \ + 10 \ + epsPortButton \ + epsLandButton \ + -1 \ + } \ + 4 < -4 > \ + epsSizeLabel \ + -1 \ + horizontal { \ + 10 \ + epsLetterButton \ + epsLegalButton \ + epsA4Button \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + epsScaleLabel \ + 4 < -4 > \ + ScaleFrame \ + } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 90 + *epsLandButton.label: Landscape + *epsLandButton.width: 90 + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 75 + *epsLegalButton.label: Legal + *epsLegalButton.width: 75 + *epsA4Button.label: A4 + *epsA4Button.width: 75 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Image Scale: + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 2 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 50 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease \ + SCtext < +inf -100% * > \ + SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 25 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 5 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 100 + *optionsGroup*TextToggle.highlightColor: yellow + *options.frameWidth: 2 + *options.location: 0 0 250 75 + *options.layout: horizontal { \ + 10 \ + vertical { \ + -1 \ + epsscaleButton \ + 2 \ + autorotateButton \ + 2 \ + aspectButton \ + -1 \ + } \ + 3 \ + vertical { \ + -1 \ + annotateButton \ + 2 \ + compressButton \ + 25 \ + -1 \ + } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *annotateButton.label: Annotate + *aspectButton.label: Max Aspect + *compressButton.label: Compress + *compressButton.sensitive: False + +! *epsscaleButton.on: True +! *autorotateButton.on: False +! *spectButton.on: False +! *annotateButton.on: True +! *compressButton.on: False + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 5 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 100 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 15 \ + vertical { \ + -1 \ + prGrayButton \ + 2 \ + prPseudoButton \ + 2 \ + prRGBButton \ + -1 \ + } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 100 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 5 + + *printers.debug: False + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + -1 \ + printlistScroll < * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*FrameType: sunken + *printers*FrameWidth: 2 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + *printers*thumbColor: gray + + *printlistScroll.location: 0 0 20 10 + *printlistScroll.vertical: True + *printlistScroll*minsize: 10 + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 54 + *cmdGroup*Command.font: 7x13bold + *cmdLayout.borderWidth: 0 + *cmdLayout.layout: horizontal { \ + -1 \ + okayPrint \ + 1 < +inf -1 > \ + printStatus < +inf -inf * +inf -inf > \ + 1 < +inf -1 > \ + donePrint \ + -1 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print + *donePrint.label: Done + + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel.title: Save to Disk... + *save_panel*background: gray + *save_panel*TextBox.background: gray63 + *save_panel*TextToggle.alignment: left + *save_panel*AsciiText*background: gray63 + *save_panel*Arrow.background: gray63 + *save_panel*Arrow.foreground: gray + *save_panel*Arrow.width: 16 + *save_panel*Arrow.height: 25 + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + + *save_panel*debug: False + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + -1 \ + saveNameGroup < +inf * > \ + -1 \ + saveOptGroup < +inf -inf * +inf -inf > \ + -1 \ + saveCmdGroup < +inf * > \ + -1\ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 60 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 2 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *saveNameGroup*TextBox*font:-*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout*Label.font: 7x13bold + *saveNameLayout.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + saveLabel \ + 5 \ + fnameFrame < +inf -inf * > \ + 5 \ + } \ + 5 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 +! *save_panel*saveFile*background: gray63 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 145 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { \ + 5 < -5 > \ + fmtGroup < +inf * +inf > \ + -1 \ + } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -100% * +inff -100% > \ + 5 < -5 > \ + } \ + -1 \ + vertical { \ + 5 < -5 > \ + saveColorGroup < +inf * +inf > \ + -1 \ + } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 125 120 + *saveColorGroup.outerOffset: 5 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 100 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + svGrayButton \ + 2 \ + svPseudoButton \ + 2 \ + svRGBButton \ + -1 \ + } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svPseudoButton.on: true + *svRGBButton.label: RGB + + *saveDataBox*TextBox.background: gray63 + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 2 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 5 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { \ + 7 \ + fitsButton \ + 2 \ + gifButton \ + 2 \ + x11Button \ + 2 \ + rawButton \ + -1 \ + } \ + 2 < -2 > \ + vertical { \ + 7 \ + rasButton \ + 2 \ + tiffButton \ + 2 \ + jpegButton \ + 2 \ + pnmButton \ + -1 \ + } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *pnmButton.label: PNM + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: false + *x11Button.sensitive: false + *pnmButton.sensitive: false + *rawButton.sensitive: false + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 54 +! *saveCmdLayout*Command.font: 7x13bold + *saveCmdLayout.layout: horizontal { \ + -1 \ + okaySave \ + 1 < +inf -1 > \ + saveStatus \ + 1 < +inf -1 > \ + doneSave \ + -1 \ + } + *okaySave.label: Save + *doneSave.label: Done + + ! File Load Control Panel. + !------------------------------- + *load_panel.geometry: 400x320 + *load_panel.title: File Load Panel + *filesLayout*borderWidth: 0 + *filesLayout*highlightThickness: 0 + *filesLayout*background: gray + *filesLayout*Group.outerOffset: 7 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 2 + *filesLayout*Text*background: gray63 + *filesLayout*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *filesLayout*TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.width: 80 + *filesLayout*TextToggle.alignment: left + *filesLayout*Scrollbar2*background: gray63 + *filesLayout*scrollbarForeground: gray + *filesLayout*Scrollbar2*location: 0 0 20 10 + *filesLayout*Scrollbar2*vertical: True + *filesLayout*Scrollbar2*minsize: 20 + *filesLayout*MultiList*background: gray63 + *filesLayout*MultiList*foreground: black + *filesLayout*MultiList*shadeSurplus: False + *filesLayout*MultiList*width: 120 + *filesLayout*MultiList.font: 7x13bold + *filesLayout*Label.font: 7x13bold + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + 5 < +0 -5 > \ + horizontal { \ + 0 < +0 -0 > \ + imagesGroup < +inf -inf * +inf -inf > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + fbuttonsGroup < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + } + + *imagesGroup.label: Images + *imagesGroup.frameWidth: 2 +! *imagesGroup.outerOffset: 5 + *imagesGroup*offIcon: square0s + *imagesGroup*onIcon: square1s + *imagesGroup*highlightColor: yellow + *imagesLayout*Label.shadowWidth: 0 + *imagesLayout*Label.justify: left + *imagesLayout*Command.width: 90 + *imagesLayout*TextButton.width: 90 + *imagesLayout*TextButton.height: 23 + *imagesLayout*TextButton.font: *times*medium*r*normal*-12-* + *imagesLayout.layout: vertical { \ + 7 < +0 -7 > \ + horizontal { \ + 5 \ + rootButton < +inf -inf * > \ + 2 \ + homeButton < +inf -inf * > \ + 2 \ + upButton < +inf -inf * > \ + 2 \ + rescanButton < +inf -inf * > \ + 5 \ + } \ + 7 \ + horizontal { \ + 5 < +0 -5 > \ + vertical { \ + 5 \ + imtemplateLabel < * > \ + 5 \ + imtemplateFrame < +inf -inf * > \ + 10 < +inf -inf > \ + grayToggle < * > \ + 5 \ + browseToggle < * > \ + 5 \ + } \ + 5 \ + horizontal { \ + 5 < +0 -5 > \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 < +0 -3 > \ + imlistScrollbar < * +inf - inf > \ + 0 < +0 -0 > \ + } \ + 5 < +0 -5 > \ + } \ + 5 \ + horizontal { \ + 5 \ + dirLabel < +inf -inf * > \ + 5 \ + } \ + 10 \ + horizontal { \ + 5 < +0 -5 > \ + fnameLabel < * > \ + 5 < +0 -5 > \ + filnamFrame < +inf -inf * > \ + 5 < +0 -5 > \ + frameLabel < * > \ + 5 < +0 -5 > \ + frameFrame < -50% * > \ + 5 < +0 -5 > \ + } \ + 5 < +0 -5 > \ + } + *imtemplateLabel.label: File Pattern: + *imtemplateText*editType: edit + *imtemplateText.height: 20 + *imageList.width: 100 + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *browseToggle.label: Browse + *browseToggle.on: True + *grayToggle.label: Greyscale + *dirLabel.label: Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 20 + *frameLabel.label: Frame: + *frameFrame.label: 1 + + *fbuttonsGroup.label: + *fbuttonsGroup*frameWidth: 2 + *fbuttonsGroup*outerOffset: 5 + *fbuttonsGroup*innerOffset: 5 + *fbuttonsGroup.frameType: sunken + *fbuttonsGroup*Command.font: 7x13bold + *fbuttonsLayout*Command.height: 50 + *fbuttonsLayout*Command.width: 70 + *fbuttonsLayout.layout: horizontal { \ + -1 \ + filesLoadButton \ + 1 < +inf -1 > \ + filesStatus \ + 1 < +inf -1 > \ + filesCloseButton \ + -1 \ + } + + *filesLoadButton.label: Load + *filesStatus.label: + *filesCloseButton.label: Done + + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 450 + *help_panel.height: 525 + *helpLayout*borderWidth: 0 + *helpLayout.background: gray + *helpLayout*Frame*frameType: sunken + *helpLayout*Frame*frameWidth: 2 + *helpLayout*Frame.background: gray + *helpLayout*Layout.background: gray + *helpLayout*ScrollbarBackground: #c0c0c0 + *helpLayout*Scrollbar*background: #c0c0c0 + *helpLayout*Scrollbar*width: 17 + *helpLayout*Scrollbar*height: 17 + *helpLayout*Scrollbar*shadowWidth: 2 + *helpLayout*Scrollbar*cursorName: top_left_arrow + *helpLayout*Scrollbar*pushThumb: true + + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { \ + 0 < +0 -0 > \ + helpMenuLayout < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + helpTextFrame < +inf -inf * +inf -inf > \ + 0 \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + helpInfoLayout < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + -1 \ + } + *helptext*background: white + *helptext*foreground: black + + *helpMenuLayout*background: gray + *helpMenuLayout*Command.highlightThickness: 2 + *helpMenuLayout*Command.internalHeight: 2 + *helpMenuLayout*Command.font: -*-helvetica-bold-r-normal-*-12-*-*-* + *helpMenuLayout.layout: vertical { \ + 5 \ + horizontal { \ + 5 < +0 -5 > \ + helpBack \ + 2 < +0 -2 > \ + helpForward \ + 2 < +0 -2 > \ + helpHome \ + 20 < +inf -20 > \ + helpClose \ + 5 < +0 -5 > \ + } \ + 5 \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Done + + *helpInfoLayout*background: gray + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { \ + 5 \ + helpIRAFLogo \ + 5 \ + } \ + 1 \ + vertical { \ + 5 \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo1 \ + 0 < +inf -inf > \ + } \ + 0 < +inf -0 > \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo2 \ + 0 < +inf -inf > \ + } \ + 0 < +inf -0 > \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo3 \ + 0 < +inf -inf > \ + } \ + 5 \ + } \ + 1 \ + vertical { \ + 5 \ + helpNOAOLogo \ + 5 \ + } \ + 5 \ + } + *helpInfo1.label: XImtool V1.2 -- Released: 4/30/2000 + *helpInfo2.label: iraf@noao.edu (520) 318-8160 + *helpInfo3.label: NOAO is operated by AURA under cooperative agreement with the NSF + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalheight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: steelblue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalheight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: steelblue + *helpInfoLayout.helpNOAOLogo.background: white + + *helpText.width: 450 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText.plainFont: 6x13 + + + ! Define a debug Tcl shell. + !-------------------------------- + *tclShell.title: Interactive Tcl Shell + *tclForm.background: gray + *tclForm*Label.background: gray + *tclForm*Label.borderWidth: 0 + *tclForm*Label.resize: False + *tclForm*Command.resize: False + *tclForm*Command.background: grey75 + *tclForm*Command.font: 7x13bold + *tclLabel.label: Server Command Entry + *tclClear.label: Clear + *tclExecute.label: Execute + *tclEntry*Text.font: 7x13 + *tclEntry*width: 500 + *tclEntry*borderWidth: 1 + *tclEntry*height: 150 + *tclEntry*editType: edit + *tclEntry*scrollHorizontal: whenNeeded + *tclEntry*scrollVertical: never + *tclEntry*displayCaret: True + *tclcloseButton.label: Done + + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *warnings: True +} + +# Start up the GUI. +createObjects +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate +activate + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 1.2" + +set winWidth [send imagewin get width] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set blinkFrames "1 2" ;# list of blink/tile frames + +set loadP_up 0 +set saveP_up 0 +set printP_up 0 +set infoP_up 0 +set panel_up 0 +set helpP_up 0 + + +proc winResize {w width height} \ + { global winWidth winHeight; set winWidth $width; set winHeight $height} +send imagewin addCallback winResize resize + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { warnings } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set enhancement($i) none ;# colortable enhancement +} + +# Called when the number of frames changes. +proc setNFrames {param old new} { + global frameMenuDescription nframes frames + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + editMenu frameMenu frameButton $frameMenuDescription + } + foreach i $frames { + if {$i <= $nframes} { + send frameBox manage frame$i + } else { + send frameBox unmanage frame$i + } + } +}; send nframes addCallback setNFrames + +set frameMenuDescription { + { 1 f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + { 2 f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + { 3 f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + { 4 f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + +# Called when the frame being displayed changes. +proc frameChanged {param old new} { + global frame + set frame $new + send frameButton set label $frame +}; send frame addCallback frameChanged + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} { + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} { + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frame + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] +}; send frameView addCallback setFrameView + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} { + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} { + send imageTitle set label [string trimright $new] +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} { + send ${param}Button set state [true $new] +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. +proc Quit args { send client Quit } +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x } +proc yflip args { send client flip y } +proc xyflip args { send client flip x y } + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}; + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00}; + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00}; + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00}; + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f}; + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00}; + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00}; + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +send panelButton "set bitmap panel; addCallback panel" +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send helpButton "set bitmap qmark; addCallback Help" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" + + +# WINDOW the current frame. +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs $xmag $ymag $xcen $ycen + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>s: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.line } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.line } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + +# WCSBOX -- Real time coordinate display. +set track_enable 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$track_enable} { + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + } else { + set text [format " %7.2f %7.2f %7.1f " $rx $ry $rz] + } + send wcsbox "set text \{$text\}; redraw noerase" + } +} + +proc setTrack {state} \ +{ + global track_enable wcsboxGeom + global winWidth winHeight + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 25ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + } +} + +proc wcsboxDestroyCallback args { + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args { + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + } +} + +proc wcsboxMoved {marker event position} { + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} { + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>s: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Btn2Up>: call(pannerPanXY,$x,$y) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args { + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args { + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args { + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} { + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} { + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + send client zoom $xscale $yscale $x $y + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} { + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} { + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} { + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} { + global winWidth winHeight + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args { + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} { + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(magzoomMenu) + <Btn3Up>: popdown(magzoomMenu) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + + +proc toggleMagnifier args { + global magnifier_enable + + if {$magnifier_enable} { + setMagnifier 0 + send pbMagM set state False + } else { + setMagnifier 1 + send pbMagM set state True + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args { + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} { + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} { + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} { + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args { + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} { + global magnifierGeom displayMagnifier + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args { + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + + if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI the magnifier is still (mostly) correctly. + set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ + (($last_mag_y-$y) * ($last_mag_y-$y))] + if {$diff > 36} { + set last_mag_x $x + set last_mag_y $y + return + } + } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } { + return + } + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +# FRAME BLINK. +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args { + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args { + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args { + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args { + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client windowColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { + send info map + infoUpdate + } } + { "Load" f.exec { + send client setLoadOption rescan + send load_panel map + set loadP_up 1 + } } + { "Save" f.exec { + Save + } } + { "Save As..." f.exec { + send save_panel map + set saveP_up 1 + } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { + send print_panel map + set printP_up 1 + } } + { "TclShell" f.exec { + send tclShell map + } } + { f.line } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Quit" f.exec Quit } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.line } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.line } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Colormaps" f.title } + { f.dblline } + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.line } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.line } + { "Control Panel" f.exec { panel + set panel_up 1 + } } + { "Print Panel" f.exec { send print_panel map + set printP_up 1 + } } + { "Load Panel" f.exec { send client setLoadOption rescan + send load_panel map + set loadP_up 1 + } } + { "Save Panel" f.exec { send save_panel map + set saveP_up 1 + } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + +# MAIN CONTROL PANEL +# --------------------------- + + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 + +proc controlPanelDone args { + global panel_up + send controlShell unmap + send panelButton set state 0 + set panel_up 0 +}; send doneButton addCallback controlPanelDone + +# panel -- Toggle control panel display. +proc panel args { + global panel_up + if {$panel_up} { + send controlShell unmap + send panelButton set state 0 + set panel_up 0 + } else { + send controlShell map + send panelButton set state 1 + set panel_up 1 + } +} + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} { + global frame nframes frames + global displayPanner displayCoords displayMagnifier + global blinkFrames warnings + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i $blinkFrames { + send blinkFrame$button set label $i + incr button + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + } + } +}; send initialize addCallback resetPanel + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} { + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} { + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +foreach i $frames {send frame$i addCallback cpSetFrame} + +# Frame buttons. +proc cpFrameAction {widget args} { + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args { + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args { + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +}; + +proc initFitFrame { param old new } { + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} { + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} { + global frameZoomX frameZoomY zoomindex frame + + if {$mode == "fixed"} { + send client zoom $zoom_x $zoom_y + } else { + send client zoom \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args { + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget {toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8} { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 + +proc cpDisplayFrameData {name old new} { + global cpFrame cpXcen cpYcen + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpYmag $ymag + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args { + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} { + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args { + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args { + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} { + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set cpScrollHeight 0 + +proc cpSetColorList {param old new} { + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc cpResizeScrollbar {widget cbtype flags x y w h cw ch} { + global cpScrollHeight + set newHeight [expr $ch - $h] + if {$newHeight && $newHeight != $cpScrollHeight} { + send colorlistScroll setScrollbar 0.0 [expr double($h) / $ch] + set rowHeight [send colorlist get rowHeight] + set rowSpacing [send colorlist get rowSpacing] + send colorlistScroll set increment [expr ($ch <= $h) ? 0 : \ + "double ($rowHeight + $rowSpacing) / ($ch - $h)"] + set cpScrollHeight $newHeight + } +}; send colorlistPort addCallback cpResizeScrollbar + +proc cpScrollColorlist {widget cbtype pos} { + global cpScrollHeight + send colorlist set y [expr -int($cpScrollHeight * $pos)] +}; send colorlistScroll addCallback cpScrollColorlist scroll + +proc cpSelectColor {widget cbtype selections indices} { + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate + +proc cpSetBlinkRate {widget args} { + global blinkRate + if {$widget == "BRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate +} +foreach widget {BRincrease BRdecrease} { + send $widget addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} { + global blinkFrames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i $frames {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} { + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send $widget set state 0 + blink + } elseif {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } +}; send blinkButton addCallback cpBlink + +proc cpResetBlink args { + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i $frames { + send blinkFrame$i set label " " + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + set blinkIndex 0 +}; send blinkReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} { + upvar $name blinkId + send blinkButton set state [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} { + global blinkFrames frames + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + foreach i $blinkFrames { + send blinkFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args { + global blinkFrames + send client registerFrames \{$blinkFrames\} +}; send registerButton addCallback cpRegisterFrames + +proc cpMatchFrames args { + global blinkFrames + send client matchFrames \{$blinkFrames\} +}; send matchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} { + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} { + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} { + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} { + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} { + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} { + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args { + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args { + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} { + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args { + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} { + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames args { + global blinkFrames + set value [send tileFramesButton get on] + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $blinkFrames \} +}; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} { + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. + +set W_object "" +set W_ok_command "" +set W_cancel_command "" + +proc Wexec {object msg args} { + global W_object W_ok_command W_cancel_command + set W_object $object + set W_ok_command [lindex $args 0] + set W_cancel_command [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} { + global W_object W_ok_command W_cancel_command + switch $widget { + warnOk { if [llength $W_ok_command] { + send $W_object $W_ok_command + } + } + warnCancel { if [llength $W_cancel_command] { + send $W_object $W_cancel_command + } + } + } + send warning unmap +}; foreach w {warnOk warnCancel} {send $w addCallback Wbutton} + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} { + Wexec client [lindex $new 0] [lindex $new 1] [lindex $new 2] +}; send alert addCallback setAlert + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args { + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + + +# INFO box. +#----------- +proc infoDone args { send info unmap } +send infoDone addCallback infoDone +proc infoClear args { send infoText set string "" } +send infoUpdate addCallback infoUpdate +send infoClear addCallback infoClear + +proc infoUpdate args { + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen + global cpXmag cpYmag cpXscale cpYscale + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set center [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $center] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 + ] + } +} +foreach param { frame frameView nframes frameSize frameTitle enhancement } { + send $param addCallback infoUpdate +} + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } { + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Print Panel Functions. +#------------------------ +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args { + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } { + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + } elseif { $val == "False" } { + send annotateButton set on false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton +} + +proc prPrintCommand { widget cbtype args } { + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prOptionToggle { widget cbtype args } { + global imageScale + + # Handle the image scale widgets first. + #print [ format "prOptionToggle %s" $widget ] + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } { + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set psScrollHeight 0 + +proc psSetPrintList {param old new} { + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc psResizeScrollbar {widget cbtype flags x y w h cw ch} { + global psScrollHeight + set newHeight [expr $ch - $h] + if {$newHeight && $newHeight != $psScrollHeight} { + send printlistScroll setScrollbar 0.0 [expr double($h) / $ch] + set rowHeight [send printlist get rowHeight] + set rowSpacing [send printlist get rowSpacing] + send printlistScroll set increment [expr ($ch <= $h) ? 0 : \ + "double ($rowHeight + $rowSpacing) / ($ch - $h)"] + set psScrollHeight $newHeight + } +}; send printlistPort addCallback psResizeScrollbar + +proc psScrollPrintlist {widget cbtype pos} { + global psScrollHeight + send printlist set y [expr -int($psScrollHeight * $pos)] +}; send printlistScroll addCallback psScrollPrintlist scroll + +proc psSelectPrint {widget cbtype selections indices} { + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc printQuit { args } { + send print_panel unmap +} ; send donePrint addCallback printQuit + +proc Print { args } { + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } { + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + +#-------------------------- +# Save panel functions. +#-------------------------- +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button pnmButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } { + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + pnmButton { send client setSaveOption format pnm } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } { + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } { + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + pnm { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format pnmButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + +send doneSave addCallback "send save_panel unmap" + +proc Save { args } { + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle + #send save_panel unmap +} ; send okaySave addCallback Save + + +# ------------------------------------------ +# Image and objects list display and section +# ------------------------------------------ + +set load_frame 1 + +proc filesTextHighlight { widget event args } { + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +send imtemplateText addEventHandler filesTextHighlight enterWindowMask +send imtemplateText addEventHandler filesTextHighlight leaveWindowMask +send fnameText addEventHandler filesTextHighlight enterWindowMask +send fnameText addEventHandler filesTextHighlight leaveWindowMask + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +proc setPattern { widget mode pattern args } { + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + +proc doLoadOptions { param old new } { + global warnings loadP_up + + set val [ join [lrange $new 1 end] " " ] + + #print [format "doLoadOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format "Directory: %s" $val ] } + newfile { send fnameText set string $val + if { [ string last / $val ] < 0 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + } + status { send filesStatus set label $val + if { ! $loadP_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayToggle set on $val } + } +} ; send loadOptions addCallback doLoadOptions + +proc toggleGraymap { widget args } { + send client setLoadOption gray [ send grayToggle get on ] +} ; send grayToggle addCallback toggleGraymap + +proc fileLoad { widget mode fname args } { + global load_frame loadP_up + send imagewin setCursorType busy + send client load $fname $load_frame + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] \ + $fname ] + if { [ string last / $fname ] < 0 && [ file isfile $fpath] == 1 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + send imagewin setCursorType idle +} ; send fnameText addCallback fileLoad + + +set imlistScrollheight 0 + +proc setFileList {param old new} { + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flresizeScrollbar { widget cbtype flags x y w h cw ch } { + global imlistScrollheight + set newheight [expr $ch - $h] + if { $newheight != $imlistScrollheight } { + send imlistScrollbar setScrollbar 0.0 [expr double($h) / $ch] + set imlistScrollheight $newheight + } +} ; send imlistPorthole addCallback flresizeScrollbar + +proc flscrollList { widget cbtype pos } { + global imlistScrollheight + send imageList set y [expr -int($imlistScrollheight * $pos)] +} ; send imlistScrollbar addCallback flscrollList scroll + +proc flSelectPrint {widget cbtype selections args} { + global load_frame loadP_up + foreach selection $selections { + send client load $selection $load_frame + if { [ string last / $selection ] < 0 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + } +}; send imageList addCallback flSelectPrint + +proc fileSetFrame {widget args} { + global nframes load_frame + + set frame [send $widget get label] + if {$frame == $nframes} { + set frame 1 + } else { + incr frame + } + send $widget set label $frame + set load_frame $frame +}; send frameFrame addCallback fileSetFrame + +proc fileLoadB args { + global load_frame loadP_up + send imagewin setCursorType busy + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + send client load $fname $load_frame + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] \ + $fname ] + if { [ string last / $fname ] < 0 && [ file isfile $fpath] == 1 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + send imagewin setCursorType idle + } +} ; send filesLoadButton addCallback fileLoadB + +proc fileQuit args { + send load_panel unmap + set loadP_up 0 +} ; send filesCloseButton addCallback fileQuit + + +# More Panel toggles + +proc infoPanel args { + global infoP_up + if {$infoP_up} { + send info unmap + set infoP_up 0 + } else { + send info map + set infoP_up 1 + } +} + +proc pannerPanel args { + global panner_enable + setPanner [expr !$panner_enable] +} + +proc magnifierPanel args { + global magnifier_enable + setMagnifier [expr !$magnifier_enable] +} + +proc wcsPanel args { + global track_enable + setTrack [expr !$track_enable] +} + +proc loadPanel args { + global loadP_up + if {$loadP_up} { + send load_panel unmap + set loadP_up 0 + } else { + send client setLoadOption rescan + send load_panel map + set loadP_up 1 + } +} + +proc savePanel args { + global saveP_up + if {$saveP_up} { + send save_panel unmap + set saveP_up 0 + } else { + send save_panel map + set saveP_up 1 + } +} + +proc printPanel args { + global printP_up + if {$printP_up} { + send print_panel unmap + set printP_up 0 + } else { + send print_panel map + set printP_up 1 + } +} + + +#------------------------------------ +# Define procedure for the help panel +#------------------------------------ + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +send helpInfo1 set label $version + +proc Help args { + global helpP_up + if {$helpP_up == 0} { + send client help + } else { + send help_panel unmap + set helpP_up 0 + } +} + +proc helpPanel args { + global helpP_up + if {$helpP_up} { + send help_panel unmap + set helpP_up 0 + } else { + send help_panel map + set helpP_up 1 + } +} + +proc helpQuit args { + global helpP_up + send help_panel unmap + set helpP_up 0 + send helpButton set state 0 + send helpText setText "" +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } { + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} { + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack set sensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward set sensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward set sensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward set sensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} { + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args { + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward set sensitive False + send helpBack set sensitive True + } else { + send helpBack set sensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args { + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack set sensitive False } + if {$linkIndex >= 0} { send helpForward set sensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args { + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward set sensitive False + send helpBack set sensitive False +}; send helpHome addCallback hlpHome + + + +#------------------------------------ +# Define some TCL debug procedures. +#------------------------------------ + +set tclP_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tclShell unmap } +proc tclOpen { args } { + global tclP_up + send tclShell map + set tclP_up 1 +} + +proc tclPanel args { + global tclP_up + if {$tclP_up} { + send tclShell unmap + set tclP_up 0 + } else { + send tclShell map + set tclP_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclcloseButton addCallback tclClose + diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-mag.c b/vendor/x11iraf/ximtool/OLD/ximtool-mag.c new file mode 100644 index 00000000..142a99fc --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-mag.c @@ -0,0 +1,419 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <Obm.h> + +#define XIMTOOL_MAIN +#include "ximtool.h" + +/* + * XIMTOOL -- X11 based image display server and standalone image display + * client. This program is based on the IRAF prototype widget server (object + * manager library or OBM) and the gterm-image widget. + */ + +/* Compatibility hacks. */ +#ifdef AUX +void *memmove(a,b,n) void *a; const void *b; size_t n; { bcopy(b,a,n); } +#else +#if defined(sun) && !defined(SYSV) +void *memmove(a,b,n) void *a, *b; int n; { bcopy(b,a,n); } +#endif +#endif + +/* Data. */ +XtAppContext app_context; +static char server[] = "server"; + +/* The builtin default GUI. */ +char *defgui_text[] = { +# include "ximtool.gui.h" + NULL +}; + + + +/* MAIN -- XImtool main program. This is the only ximtool routine containing + * window system specific code. + */ +main (argc, argv) +int argc; +char *argv[]; +{ + register XimDataPtr xim = &ximtool_data; + register int i; + XtPointer obm; + char **sv_argv, *init_file = NULL, *str; + int sv_argc, ncolors, base; + + + /* Process the command line arguments. Scan the arglist first to see + * if we're requesting help or a printout of the default GUI, if so + * print these out and exit. + */ + if (argc > 1) { + if (strcmp (argv[1], "-help") == 0) { + Usage (); + exit (-1); + + } else if (strcmp (argv[1], "-defgui") == 0) { + register int i; + for (i=0; defgui_text[i]; i++) + printf ("%s\n", defgui_text[i]); + exit (0); + } + } + + + /* Loop over the command line options and preprocess the ones that + * are widget/GUI resources we want to make available more easily. + * To do this we'll tweak the argument list so it appears to be a + * "-xrm" resource setting, this means the X initialization code + * below will do all the real work. + */ + for (i=1; i < argc; i++) { + + if (strcmp (argv[i], "-cmapName") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*cmapName:%s\0", str); + + } else if (strcmp (argv[i], "-maxColors") == 0) { + ncolors = atoi (argv[++i]); + ncolors = max (32, min (201, ncolors)); + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*maxColors:%d\0", ncolors); + + } else if (strcmp (argv[i], "-basePixel") == 0) { + base = atoi (argv[++i]); + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*basePixel:%d", base); + + } else if (strcmp (argv[i], "-cmapInitialize") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*cmapInitialize:%s", str); + + } else if (strcmp (argv[i], "-displayPanner") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*displayPanner:%s", str); + + } else if (strcmp (argv[i], "-displayMagnifier") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*displayMagnifier:%s", str); + + } else if (strcmp (argv[i], "-displayCoords") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*displayCoords:%s", str); + + } else if (strcmp (argv[i], "-printConfig") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*printConfig:%s", str); + } + } + + /* Get local copy of argc and argv. */ + if ((sv_argc = argc) > 0) { + sv_argv = (char **) XtMalloc (argc * sizeof(char *)); + memmove (sv_argv, argv, argc * sizeof(char *)); + } else + sv_argv = argv; + + /* Initialize applications context. We don't use the top level + * shell created here, but we need to deal with it in order to + * get the application resources. The object manager opens its own + * connection to the display server and manages a separate window + * hierarchy with its own top level shell. + */ + xim->toplevel = XtAppInitialize (&app_context, "XImtool", + (XrmOptionDescList) NULL, 0, &sv_argc, sv_argv, + (String *) NULL, (ArgList) NULL, 0); + + /* Free saved arglist. */ + free ((char *)sv_argv); + + /* Get application resources. */ + XtVaGetApplicationResources (xim->toplevel, xim, + resources, XtNumber(resources), + /* Add any resource overrides here */ + NULL); + + /* Initialize the object manager. */ + xim->obm = obm = (XtPointer) ObmOpen (app_context, argc, argv); + ObmAddCallback (obm, OBMCB_setGterm|OBMCB_preserve, xim_reset, + (XtPointer)xim); + + + /* Loop over the command line options. The default xim structure + * should be defined at this point so the command options can be + * used to override them. + */ + for (i=1; i < argc; i++) { + + /* Anything without a '-' is a file name to load at startup. + * Only use the first name defined. + */ + if (argv[i][0] != '-') { /* File name */ + if (!init_file) { + init_file = argv[i]; + if (access (init_file, R_OK) < 0) { + fprintf (stderr, "%s: File does not exist: '%s'\n", + argv[0], init_file); + exit (-1); + } + } + + } else if (strcmp (argv[i], "-gui") == 0) { + xim->gui = argv[++i]; + + } else if (strcmp (argv[i], "-cmap1") == 0) { + xim->userCMap1 = argv[++i]; + + } else if (strcmp (argv[i], "-cmap2") == 0) { + xim->userCMap2 = argv[++i]; + + } else if (strcmp (argv[i], "-cmapDir1") == 0) { + xim->userCMapDir1 = argv[++i]; + + } else if (strcmp (argv[i], "-cmapDir1") == 0) { + xim->userCMapDir2 = argv[++i]; + + } else if (strcmp (argv[i], "-imtoolrc") == 0) { + xim->imtoolrc = argv[++i]; + + } else if (strcmp (argv[i], "-memModel") == 0) { + xim->memModel = argv[++i]; + + } else if (strcmp (argv[i], "-config") == 0) { + xim->def_config = atoi (argv[++i]); + + } else if (strcmp (argv[i], "-nframes") == 0) { + i++; + xim->def_nframes = min (MAX_FRAMES, atoi (argv[i])); + + } else if (strcmp (argv[i], "-tile") == 0) { + xim->tileFrames++; + + } else if (strcmp (argv[i], "-invert") == 0) { + xim->invert++; + + } else if (strcmp (argv[i], "-fifo") == 0) { + xim->input_fifo = malloc (strlen (argv[++i]+2)); + xim->output_fifo = malloc (strlen (argv[i]+2)); + sprintf (xim->input_fifo, "%si", argv[i]); + sprintf (xim->output_fifo, "%so", argv[i]); + + } else if (strcmp (argv[i], "-port") == 0) { + if (xim->port != 0 ) + xim->port = atoi (argv[++i]); + else + i++; + + } else if (strcmp (argv[i], "-unix") == 0) { + if (strcmp ("none", xim->input_fifo) ) + xim->unixaddr = argv[++i]; + else + i++; + + } else if (strcmp (argv[i], "-fifo_only") == 0) { + xim->unixaddr = "none"; + xim->port = 0; + + } else if (strcmp (argv[i], "-inet_only") == 0 || + strcmp (argv[i], "-port_only") == 0 ) { + xim->input_fifo = ""; + xim->unixaddr = "none"; + + } else if (strcmp (argv[i], "-unix_only") == 0) { + xim->input_fifo = ""; + xim->port = 0; + + + /* Skip any standard X toolkit flags, they're handled above. + */ + } else if (strcmp (argv[i], "-bg") == 0) { + i++; + } else if (strcmp (argv[i], "-fg") == 0) { + i++; + } else if (strcmp (argv[i], "-iconic") == 0) { + ; + } else if (strcmp (argv[i], "-display") == 0) { + i++; + } else if (strcmp (argv[i], "-geometry") == 0) { + i++; + } else if (strcmp (argv[i], "-title") == 0) { + i++; + } else if (strcmp (argv[i], "-xrm") == 0) { + i++; + + } else { + fprintf (stderr, "Unrecognized flag '%s'\n", argv[i]); + Usage(); + exit (-1); + } + } + + + /* Initialize the ximtool/obm client code. */ + xim_clientOpen (xim); + + /* Load the Ximtool GUI. If the GUI name is "default" the builtin + * default GUI is used. This is stored as an array of text lines, + * which we must append newlines to and concatenate together to + * form the GUI message. + */ + if (strcmp (xim->gui, "default") == 0 || + (ObmDeliverMsgFromFile (obm, server, xim->gui) != 0)) { + + register char *ip, *op; + char *message; + int i; + + message = (char *) malloc (204800); + for (i=0, op=message; ip = defgui_text[i]; i++) { + while (*ip) + *op++ = *ip++; + *op++ = '\n'; + } + *op++ = '\0'; + + ObmDeliverMsg (obm, server, message); + free ((char *)message); + + } + + /* Activate the GUI. */ + ObmActivate (obm); + + /* Initialize the frame buffers and graphics pipeline. */ + xim_initialize (xim, xim->def_config, xim->def_nframes, 1); + + /* Listen for a client connection. */ + xim_iisopen (xim); + + /* Initialize the hardcopy option and printer configuration. */ + xim_initPrinterOps (xim); + + /* Open the file Load/Save structures. */ + xim_initLoad (xim); + xim_initSave (xim); + + /* Load a file at startup if it was defined. */ + if ( init_file != NULL ) + xim_loadFile (xim, init_file, 1); + + /* EXECUTE */ + XtAppMainLoop (app_context); + + xim_shutdown (xim); +} + + +/* XIM_SHUTDOWN -- Terminate ximtool. + */ +xim_shutdown (xim) +register XimDataPtr xim; +{ + eps_close (xim->psim); + xim_loadClose (xim); + xim_saveClose (xim); + xim_clientClose (xim); + xim_iisclose (xim); + xim_close (xim); + ObmClose (xim->obm); + exit (0); +} + + +/* XIM_ADDINPUT -- Register a procedure to be called when there is input + * to be processed on the given input source. The ximtool code doesn't + * talk to X directly so we need to provide this interface routine. + */ +XtPointer +xim_addInput (xim, input, proc, client_data) +register XimDataPtr xim; +int input; +void (*proc)(); +XtPointer client_data; +{ + return ((XtPointer) XtAppAddInput (app_context, input, + (XtPointer)XtInputReadMask, *proc, client_data)); +} + + +/* XIM_REMOVEINPUT -- Remove a callback previously posted with xim_addInput. + */ +void +xim_removeInput (xim, id) +register XimDataPtr xim; +XtPointer id; +{ + XtRemoveInput ((XtInputId)id); +} + + +/* USAGE -- Print a list of command-line options. + */ +Usage () +{ + fprintf (stderr, "Usage:\n\n"); + printoption (" ximtool"); + printoption ("[-basePixel <num>]"); /* base cmap pixel */ + printoption ("[-cmap1 <file>]"); /* User cmap 1 */ + printoption ("[-cmap2 <file>]"); /* User cmap 2 */ + printoption ("[-cmapDir1 <dir>]"); /* User cmapDir 1 */ + printoption ("[-cmapDir1 <dir>]"); /* User cmapDir 2 */ + printoption ("[-cmapInitialize <bool>]"); /* initialize colormap */ + printoption ("[-cmapName <name>]"); /* colormap name */ + printoption ("[-config <num>]"); /* initial config */ + printoption ("[-defgui]"); /* Print default GUI */ + printoption ("[-displayPanner <bool>]"); /* display panner box */ + printoption ("[-displayMagnifier <bool>]"); /* display magnifier */ + printoption ("[-displayCoords <bool>]"); /* display coords box */ + printoption ("[-fifo <pipe>]"); /* fifo pipe */ + printoption ("[-fifo_only]"); /* use fifo only */ + printoption ("[-gui <file>]"); /* GUI file */ + printoption ("[-help]"); /* Print help */ + printoption ("[-imtoolrc <file>]"); /* fbconfig file */ + printoption ("[-inet_only | -port_only]"); /* use inet only */ + printoption ("[-invert]"); /* invert colormap */ + printoption ("[-maxColors <num>]"); /* # of colors */ + printoption ("[-memModel <type>]"); /* memory model */ + printoption ("[-nframes <num>]"); /* # of frames */ + printoption ("[-port <num>]"); /* inet port */ + printoption ("[-printConfig <name>]"); /* printer config file */ + printoption ("[-tile]"); /* tile frames */ + printoption ("[-unix <name>]"); /* unix socket */ + printoption ("[-unix_only]"); /* use unix only */ + printoption ("[<file>]"); /* file to load */ + fprintf (stderr,"\n"); +} + + +/* PRINTOPTION -- Pretty-print an option string. + */ +static int cpos = 0; +printoption(st) +char *st; +{ + if (strlen(st) + cpos > 78) { + fprintf (stderr,"\n\t"); + cpos = 8; + } + fprintf (stderr,"%s ",st); + cpos = cpos + strlen(st) + 1; +} diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-mag.gui b/vendor/x11iraf/ximtool/OLD/ximtool-mag.gui new file mode 100644 index 00000000..19167e6e --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-mag.gui @@ -0,0 +1,5388 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL-MAG.GUI -- Default GUI for the Ximtool-mag image display server. +# +# Version 1.2 -- Released 4/30/2000 + + +reset-server +appInitialize ximtool XImtool { + *objects:\ + toplevel Layout display \ + display Layout menubar \ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar TextBox imageTitle \ + menubar Toggle panelButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ + display Gterm imagewin \ + display Gterm colorbar \ +\ + toplevel TopLevelShell info \ + info Paned infoPanel \ + infoPanel Box infoBox \ + infoBox Command infoDone \ + infoBox Command infoDown \ + infoBox Command infoUp \ + infoBox Command infoSave \ + infoBox Command infoUpdate \ + infoBox Command infoClear \ + infoPanel AsciiText infoText \ +\ + toplevel TopLevelShell controlShell \ + controlShell Layout controlPanel \ + controlPanel Group viewBox \ + controlPanel Group enhancementBox \ + controlPanel Group blinkBox \ + controlPanel Group optionsBox \ + controlPanel Frame controlBox \ +\ + viewBox Layout view \ + view Group frameSelect \ + frameSelect Layout frameBox \ + frameBox TextToggle frame1 \ + frameBox TextToggle frame2 \ + frameBox TextToggle frame3 \ + frameBox TextToggle frame4 \ + frameBox Command prevFrame \ + frameBox Command nextFrame \ + view Frame frameDataBox \ + frameDataBox TextBox frameData \ + view Group zoomBox \ + zoomBox Layout zoom \ + zoom TextButton toggleZoom \ + zoom TextButton zoomIn \ + zoom Command x1 \ + zoom Command z2 \ + zoom Command z3 \ + zoom Command z4 \ + zoom Command z5 \ + zoom Command z8 \ + zoom TextButton zoomOut \ + zoom TextButton centerFrame \ + zoom Command d2 \ + zoom Command d3 \ + zoom Command d4 \ + zoom Command d5 \ + zoom Command d8 \ + view Layout viewButtons \ + viewButtons Command aspect \ + viewButtons Command flipX \ + viewButtons Command flipY \ + viewButtons Command flipXY \ + viewButtons Command clearFrame \ + viewButtons Command fitFrame \ +\ + enhancementBox Layout enhance \ + enhance Scrollbar2 colorlistScroll \ + enhance Frame colorlistFrame \ + colorlistFrame Porthole colorlistPort \ + colorlistPort MultiList colorlist \ + enhance Frame colordataFrame \ + colordataFrame TextBox colordata \ + enhance Label contrastLabel \ + enhance Slider2d contrastSlider \ + enhance Label brightnessLabel \ + enhance Slider2d brightnessSlider \ + enhance Command invertButton \ + enhance Command optimizeButton \ +\ + blinkBox Layout blink \ + blink Label blinkFramesLabel \ + blink Command blinkFrame1 \ + blink Command blinkFrame2 \ + blink Command blinkFrame3 \ + blink Command blinkFrame4 \ + blink Command blinkReset \ + blink Label blinkRateLabel \ + blink Frame BRframe \ + BRframe Layout BRlayout \ + BRlayout Arrow BRdecrease \ + BRlayout TextBox BRtext \ + BRlayout Arrow BRincrease \ + blink Command registerButton \ + blink Command matchButton \ + blink Toggle blinkButton \ +\ + optionsBox TextToggle pannerButton \ + optionsBox TextToggle magnifierButton \ + optionsBox TextToggle coordsBoxButton \ + optionsBox TextToggle autoscaleButton \ + optionsBox TextToggle antialiasButton \ + optionsBox TextToggle tileFramesButton \ + optionsBox TextToggle warningsButton \ +\ + controlBox Layout control \ + control Command initializeButton \ + control Command normalizeButton \ + control Command doneButton \ +\ + toplevel TopLevelShell tclShell\ + tclShell Paned tclPanel\ + tclPanel Box tclForm\ + tclForm Label tclLabel\ + tclForm Command tclClear\ + tclForm Command tclExecute\ + tclForm Command tclcloseButton\ + tclPanel AsciiText tclEntry\ +\ + toplevel TransientShell warning \ + warning Layout warn \ + warn Frame warnFrame \ + warnFrame Layout WFlayout \ + WFlayout Icon warnIcon \ + WFlayout TextBox warnText \ + warn TextButton warnOk \ + warn TextButton warnCancel \ + warn TextButton warnHelp \ +\ + toplevel TopLevelShell print_panel\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame \ + ScaleFrame Layout ScaleLayout \ + ScaleLayout Arrow SCdecrease \ + ScaleLayout TextBox SCtext \ + ScaleLayout Arrow SCincrease \ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle annotateButton\ + options TextToggle compressButton\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers \ + printers Scrollbar2 printlistScroll \ + printers Frame printlistFrame \ + printlistFrame Porthole printlistPort \ + printlistPort MultiList printlist \ +\ + cmdGroup Layout cmdLayout\ + cmdLayout TextButton okayPrint\ + cmdLayout Label printStatus\ + cmdLayout TextButton donePrint\ +\ + toplevel TopLevelShell save_panel\ + save_panel Layout saveLayout\ +\ + saveLayout Group saveNameGroup\ + saveLayout Group saveOptGroup\ + saveLayout Group saveCmdGroup\ +\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox \ + saveDataBox TextBox saveData \ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle x11Button\ + formats TextToggle pnmButton\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout TextButton okaySave\ + saveCmdLayout Label saveStatus\ + saveCmdLayout TextButton doneSave\ +\ + toplevel TopLevelShell load_panel \ + load_panel Layout filesLayout \ + filesLayout Group imagesGroup \ + imagesGroup Layout imagesLayout \ + imagesLayout Label imtemplateLabel \ + imagesLayout Frame imtemplateFrame \ + imtemplateFrame AsciiText imtemplateText \ + imagesLayout Scrollbar2 imlistScrollbar \ + imagesLayout Frame imlistFrame \ + imlistFrame Porthole imlistPorthole \ + imlistPorthole MultiList imageList \ + imagesLayout TextButton rootButton \ + imagesLayout TextButton homeButton \ + imagesLayout TextButton upButton \ + imagesLayout TextButton rescanButton \ + imagesLayout TextToggle grayToggle \ + imagesLayout TextToggle browseToggle \ + imagesLayout Label dirLabel \ + imagesLayout Label fnameLabel \ + imagesLayout Frame filnamFrame \ + imagesLayout Label frameLabel \ + imagesLayout Command frameFrame \ + filnamFrame AsciiText fnameText \ +\ + filesLayout Group fbuttonsGroup \ + fbuttonsGroup Layout fbuttonsLayout \ + fbuttonsLayout Command filesLoadButton \ + fbuttonsLayout Label filesStatus \ + fbuttonsLayout Command filesCloseButton \ +\ + toplevel TopLevelShell help_panel \ + help_panel Layout helpLayout \ + helpLayout Layout helpMenuLayout \ + helpLayout Layout helpInfoLayout \ +\ + helpMenuLayout Command helpBack \ + helpMenuLayout Command helpForward \ + helpMenuLayout Command helpHome \ + helpMenuLayout Command helpClose \ +\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText \ +\ + helpInfoLayout Label helpIRAFLogo \ + helpInfoLayout Label helpInfo1 \ + helpInfoLayout Label helpInfo2 \ + helpInfoLayout Label helpInfo3 \ + helpInfoLayout Label helpNOAOLogo \ +\ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter filelist\ + ximtool Parameter help + + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + + *display.background: gray + *display.borderWidth: 0 + + *display.debug: False + *display.layout: horizontal { \ + -1 \ + vertical { \ + 3 \ + menubar < +inf -inf * > \ + 3 \ + imagewin < +inf -inf * +inf - inf > \ + 3 \ + colorbar < +inf -inf * > \ + } \ + -1 \ + } + + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + panelButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.background: gray65 + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 512 + *menubar*background: gray + *menubar*foreground: black + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.color8: #7c8498 + *imagewin.color9: steelblue + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(panel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !Shift<Btn1Down>: call(setDynamicMagnifier,1) \n\ + !Shift<Btn1Up>: call(setDynamicMagnifier,0) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift<Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 512 + *colorbar.height: 10 + + ! INFO box resources. + ! ------------------------------ + *info.geometry: 420x240 + *info.title: Information Panel + *info*Command.font: 7x13bold + *infoPanel*background: gray + *infoDone.label: Done + *infoDown.label: Down + *infoDown.sensitive: False + *infoUp.label: Up + *infoUp.sensitive: False + *infoSave.label: Save + *infoSave.sensitive: False + *infoUpdate.label: Update + *infoClear.label: Clear + *infoText*scrollVertical: always + *infoText*scrollHorizontal: whenNeeded + *infoText*displayCaret: False + *infoText*editType: append + *info*ScrollbarBackground: #c0c0c0 + *info*Scrollbar*background: #c0c0c0 + *info*Scrollbar*width: 17 + *info*Scrollbar*height: 17 + *info*Scrollbar*shadowWidth: 2 + *info*Scrollbar*cursorName: top_left_arrow + *info*Scrollbar*pushThumb: true + + + ! Main Control Panel. + ! ------------------------------ + *controlShell.title: XImtool Control + *controlShell.iconName: XimCon + *controlPanel*background: gray + *controlPanel*foreground: black + *controlPanel*TextBox.background: gray63 + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + *controlPanel*Command.highlightThickness: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + *blinkFrame1.font: 7x13bold + *blinkFrame2.font: 7x13bold + *blinkFrame3.font: 7x13bold + *blinkFrame4.font: 7x13bold + + *controlPanel.debug: False + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -1 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + controlBox < +inf * > \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 5 + + *view.debug: False + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + -1 \ + vertical { \ + 5 < -5 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 5 < -5 > \ + } \ + -1 \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 2 + *frameData.width: 130 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 5 + *frameSelect.innerOffset: 5 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame: + + *frameBox.debug: False + *frameBox.layout: vertical { \ + frame1 < +inf * > \ + frame2 < +inf * > \ + frame3 < +inf * > \ + frame4 < +inf * > \ + 10 < +inf -10 > \ + horizontal { \ + -1 \ + prevFrame \ + 10 < +inf -5 > \ + nextFrame \ + -1 \ + } \ + -1 \ + } + + *frameBox*location: 0 0 10 20 + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*highlightThickness: 0 + *frameBox*frame1.label: \ 1\ \ + *frameBox*frame2.label: \ 2\ \ + *frameBox*frame3.label: \ 3\ \ + *frameBox*frame4.label: \ 4\ \ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xx + *frameBox*nextFrame.label: xx + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 5 + *zoomBox.shrinkToFit: True + + *zoom.debug: False + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { \ + toggleZoom < +inf * +inf > \ + 2 \ + } \ + 2 \ + vertical { \ + 2 < +inf > \ + z5 \ + 1 < +inf > \ + z3 \ + 0 < +inf > \ + } \ + 2 \ + vertical { \ + zoomIn < +inf * +inf > \ + 2 \ + } \ + } \ + 1 < +inf > \ + horizontal { \ + 2 < +inf > \ + d8 d4 d2 x1 z2 z4 z8 \ + 2 < +inf > \ + } \ + 1 < +inf > \ + horizontal { \ + vertical { \ + 2 \ + zoomOut < +inf * +inf > \ + } \ + 2 \ + vertical { \ + 0 < +inf > \ + d3 \ + 1 < +inf > \ + d5 \ + 2 < +inf > \ + } \ + 2 \ + vertical { \ + 2 \ + centerFrame < +inf * +inf > \ + } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 0 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 0 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 0 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 0 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.debug: False + *viewButtons.layout: horizontal { \ + 5 < -2 > \ + aspect < +inf * > \ + 5 < -2 > \ + flipX < +inf * > \ + 5 < -2 > \ + flipY < +inf * > \ + 5 < -2 > \ + flipXY < +inf * > \ + 5 < -2 > \ + clearFrame < +inf * > \ + 5 < -2 > \ + fitFrame < +inf * > \ + 5 < -2 > \ + } + + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 5 + + *enhance.debug: False + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistScroll < * +inff -inff > \ + -1 \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + -1 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { \ + -1 \ + contrastLabel \ + 3 < -3 > \ + brightnessLabel \ + -1 \ + } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*FrameType: sunken + *enhance*FrameWidth: 2 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + *enhance*thumbColor: gray + + *colorlistScroll.location: 0 0 20 10 + *colorlistScroll.vertical: True + *colorlistScroll*minsize: 10 + *colorlist.width: 100 + *colorlist.height: 78 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 20 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 20 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + ! BLINK + ! --------------------- + *blinkBox.label: Blink + *blinkBox.location: 0 0 230 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 5 + + + *blink.debug: False + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + 3 \ + registerButton < +inf * > \ + 5 < -5 > \ + matchButton < +inf * > \ + 5 < -5 > \ + blinkButton < +inf * > \ + 2 \ + } \ + 3 < -3 > \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *controlPanel*blink*Arrow.foreground: gray + *controlPanel*blink*Arrow.background: gray63 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + *blinkFramesLabel.label: Blink Frames: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 2 + *BRtext.width: 40 + *BRtext.height: 25 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 5 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 25 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *magnifierButton.label: Magnifier + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *warningsButton.label: Warnings + + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 5 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.debug: False + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + doneButton < +inf * > \ + 1 \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize + *doneButton.label: Done + + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*background: gray + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + *warning*TextButton.frameWidth: 2 + *warning*TextButton.width: 40 + *warning*TextButton.height: 25 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 5 < -5 > \ + warnFrame < +inf * +inf > \ + 5 < -5 > \ + } \ + 1 < -1 > \ + horizontal { \ + 5 < -5 > \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 5 < +inf -5 > \ + warnHelp < +inf * > \ + 5 < -5 > \ + } \ + 1 < -1 > \ + } + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { \ + 5 < +inf -5 > \ + warnIcon \ + 5 < +inf -5 > \ + } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnOk.label: OK + *warnCancel.label: Cancel + *warnHelp.label: Help + *warnHelp.sensitive: False + + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel.title: Printer Setup + *print_panel.highlightThickness: 1 + *print_panel*background: gray + *print_panel*TextBox.background: gray63 + *print_panel*TextBox.foreground: black + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.background: gray63 + *print_panel*Arrow.foreground: gray + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 25 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*Label.background: gray + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -1 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 85 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 2 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout*Label.font: 7x13bold + *printCmdLayout.layout: horizontal { \ + -1 \ + labelLayout \ + 5 < -5 > \ + inputLayout < +inf -inf * +inf > \ + 2 \ + } + + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { \ + 5 \ + toLabel \ + 11 \ + printerLabel \ + -3 \ + } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + + *inputLayout*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { \ + 5 < -5 > \ + toPrinter \ + 5 < -5 > \ + toFile \ + 5 < +inf -inf > \ + } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + *printcmd*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 265 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 0 + *optLayout*borderWidth: 0 + *optLayout.layout: horizontal { \ + -1 \ + vertical { \ + 5 < -5 > \ + epsPageGroup < +inf -inf * > \ + 0 < -0 > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + 0 < -0 > \ + vertical { \ + 5 < -5 > \ + printColorGroup < +inf -inf * > \ + 0 < -0 > \ + printerGroup < +inf * +inf > \ + -1 \ + } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 5 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage*Label.font: 7x13bold + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel \ + 4 < -4 > \ + horizontal { \ + 10 \ + epsPortButton \ + epsLandButton \ + -1 \ + } \ + 4 < -4 > \ + epsSizeLabel \ + -1 \ + horizontal { \ + 10 \ + epsLetterButton \ + epsLegalButton \ + epsA4Button \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + epsScaleLabel \ + 4 < -4 > \ + ScaleFrame \ + } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 90 + *epsLandButton.label: Landscape + *epsLandButton.width: 90 + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 75 + *epsLegalButton.label: Legal + *epsLegalButton.width: 75 + *epsA4Button.label: A4 + *epsA4Button.width: 75 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Image Scale: + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 2 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 50 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease \ + SCtext < +inf -100% * > \ + SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 25 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 5 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 100 + *optionsGroup*TextToggle.highlightColor: yellow + *options.frameWidth: 2 + *options.location: 0 0 250 75 + *options.layout: horizontal { \ + 10 \ + vertical { \ + -1 \ + epsscaleButton \ + 2 \ + autorotateButton \ + 2 \ + aspectButton \ + -1 \ + } \ + 3 \ + vertical { \ + -1 \ + annotateButton \ + 2 \ + compressButton \ + 25 \ + -1 \ + } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *annotateButton.label: Annotate + *aspectButton.label: Max Aspect + *compressButton.label: Compress + *compressButton.sensitive: False + +! *epsscaleButton.on: True +! *autorotateButton.on: False +! *spectButton.on: False +! *annotateButton.on: True +! *compressButton.on: False + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 5 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 100 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 15 \ + vertical { \ + -1 \ + prGrayButton \ + 2 \ + prPseudoButton \ + 2 \ + prRGBButton \ + -1 \ + } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 100 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 5 + + *printers.debug: False + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + -1 \ + printlistScroll < * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*FrameType: sunken + *printers*FrameWidth: 2 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + *printers*thumbColor: gray + + *printlistScroll.location: 0 0 20 10 + *printlistScroll.vertical: True + *printlistScroll*minsize: 10 + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 54 + *cmdGroup*Command.font: 7x13bold + *cmdLayout.borderWidth: 0 + *cmdLayout.layout: horizontal { \ + -1 \ + okayPrint \ + 1 < +inf -1 > \ + printStatus < +inf -inf * +inf -inf > \ + 1 < +inf -1 > \ + donePrint \ + -1 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print + *donePrint.label: Done + + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel.title: Save to Disk... + *save_panel*background: gray + *save_panel*TextBox.background: gray63 + *save_panel*TextToggle.alignment: left + *save_panel*AsciiText*background: gray63 + *save_panel*Arrow.background: gray63 + *save_panel*Arrow.foreground: gray + *save_panel*Arrow.width: 16 + *save_panel*Arrow.height: 25 + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + + *save_panel*debug: False + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + -1 \ + saveNameGroup < +inf * > \ + -1 \ + saveOptGroup < +inf -inf * +inf -inf > \ + -1 \ + saveCmdGroup < +inf * > \ + -1\ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 60 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 2 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *saveNameGroup*TextBox*font:-*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout*Label.font: 7x13bold + *saveNameLayout.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + saveLabel \ + 5 \ + fnameFrame < +inf -inf * > \ + 5 \ + } \ + 5 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 +! *save_panel*saveFile*background: gray63 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 145 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { \ + 5 < -5 > \ + fmtGroup < +inf * +inf > \ + -1 \ + } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -100% * +inff -100% > \ + 5 < -5 > \ + } \ + -1 \ + vertical { \ + 5 < -5 > \ + saveColorGroup < +inf * +inf > \ + -1 \ + } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 125 120 + *saveColorGroup.outerOffset: 5 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 100 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + svGrayButton \ + 2 \ + svPseudoButton \ + 2 \ + svRGBButton \ + -1 \ + } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svPseudoButton.on: true + *svRGBButton.label: RGB + + *saveDataBox*TextBox.background: gray63 + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 2 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 5 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { \ + 7 \ + fitsButton \ + 2 \ + gifButton \ + 2 \ + x11Button \ + 2 \ + rawButton \ + -1 \ + } \ + 2 < -2 > \ + vertical { \ + 7 \ + rasButton \ + 2 \ + tiffButton \ + 2 \ + jpegButton \ + 2 \ + pnmButton \ + -1 \ + } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *pnmButton.label: PNM + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: false + *x11Button.sensitive: false + *pnmButton.sensitive: false + *rawButton.sensitive: false + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 54 +! *saveCmdLayout*Command.font: 7x13bold + *saveCmdLayout.layout: horizontal { \ + -1 \ + okaySave \ + 1 < +inf -1 > \ + saveStatus \ + 1 < +inf -1 > \ + doneSave \ + -1 \ + } + *okaySave.label: Save + *doneSave.label: Done + + ! File Load Control Panel. + !------------------------------- + *load_panel.geometry: 400x320 + *load_panel.title: File Load Panel + *filesLayout*borderWidth: 0 + *filesLayout*highlightThickness: 0 + *filesLayout*background: gray + *filesLayout*Group.outerOffset: 7 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 2 + *filesLayout*Text*background: gray63 + *filesLayout*Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *filesLayout*TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.width: 80 + *filesLayout*TextToggle.alignment: left + *filesLayout*Scrollbar2*background: gray63 + *filesLayout*scrollbarForeground: gray + *filesLayout*Scrollbar2*location: 0 0 20 10 + *filesLayout*Scrollbar2*vertical: True + *filesLayout*Scrollbar2*minsize: 20 + *filesLayout*MultiList*background: gray63 + *filesLayout*MultiList*foreground: black + *filesLayout*MultiList*shadeSurplus: False + *filesLayout*MultiList*width: 120 + *filesLayout*MultiList.font: 7x13bold + *filesLayout*Label.font: 7x13bold + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + 5 < +0 -5 > \ + horizontal { \ + 0 < +0 -0 > \ + imagesGroup < +inf -inf * +inf -inf > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + fbuttonsGroup < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + } + + *imagesGroup.label: Images + *imagesGroup.frameWidth: 2 +! *imagesGroup.outerOffset: 5 + *imagesGroup*offIcon: square0s + *imagesGroup*onIcon: square1s + *imagesGroup*highlightColor: yellow + *imagesLayout*Label.shadowWidth: 0 + *imagesLayout*Label.justify: left + *imagesLayout*Command.width: 90 + *imagesLayout*TextButton.width: 90 + *imagesLayout*TextButton.height: 23 + *imagesLayout*TextButton.font: *times*medium*r*normal*-12-* + *imagesLayout.layout: vertical { \ + 7 < +0 -7 > \ + horizontal { \ + 5 \ + rootButton < +inf -inf * > \ + 2 \ + homeButton < +inf -inf * > \ + 2 \ + upButton < +inf -inf * > \ + 2 \ + rescanButton < +inf -inf * > \ + 5 \ + } \ + 7 \ + horizontal { \ + 5 < +0 -5 > \ + vertical { \ + 5 \ + imtemplateLabel < * > \ + 5 \ + imtemplateFrame < +inf -inf * > \ + 10 < +inf -inf > \ + grayToggle < * > \ + 5 \ + browseToggle < * > \ + 5 \ + } \ + 5 \ + horizontal { \ + 5 < +0 -5 > \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 < +0 -3 > \ + imlistScrollbar < * +inf - inf > \ + 0 < +0 -0 > \ + } \ + 5 < +0 -5 > \ + } \ + 5 \ + horizontal { \ + 5 \ + dirLabel < +inf -inf * > \ + 5 \ + } \ + 10 \ + horizontal { \ + 5 < +0 -5 > \ + fnameLabel < * > \ + 5 < +0 -5 > \ + filnamFrame < +inf -inf * > \ + 5 < +0 -5 > \ + frameLabel < * > \ + 5 < +0 -5 > \ + frameFrame < -50% * > \ + 5 < +0 -5 > \ + } \ + 5 < +0 -5 > \ + } + *imtemplateLabel.label: File Pattern: + *imtemplateText*editType: edit + *imtemplateText.height: 20 + *imageList.width: 100 + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *browseToggle.label: Browse + *browseToggle.on: True + *grayToggle.label: Greyscale + *dirLabel.label: Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 20 + *frameLabel.label: Frame: + *frameFrame.label: 1 + + *fbuttonsGroup.label: + *fbuttonsGroup*frameWidth: 2 + *fbuttonsGroup*outerOffset: 5 + *fbuttonsGroup*innerOffset: 5 + *fbuttonsGroup.frameType: sunken + *fbuttonsGroup*Command.font: 7x13bold + *fbuttonsLayout*Command.height: 50 + *fbuttonsLayout*Command.width: 70 + *fbuttonsLayout.layout: horizontal { \ + -1 \ + filesLoadButton \ + 1 < +inf -1 > \ + filesStatus \ + 1 < +inf -1 > \ + filesCloseButton \ + -1 \ + } + + *filesLoadButton.label: Load + *filesStatus.label: + *filesCloseButton.label: Done + + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 450 + *help_panel.height: 525 + *helpLayout*borderWidth: 0 + *helpLayout.background: gray + *helpLayout*Frame*frameType: sunken + *helpLayout*Frame*frameWidth: 2 + *helpLayout*Frame.background: gray + *helpLayout*Layout.background: gray + *helpLayout*ScrollbarBackground: #c0c0c0 + *helpLayout*Scrollbar*background: #c0c0c0 + *helpLayout*Scrollbar*width: 17 + *helpLayout*Scrollbar*height: 17 + *helpLayout*Scrollbar*shadowWidth: 2 + *helpLayout*Scrollbar*cursorName: top_left_arrow + *helpLayout*Scrollbar*pushThumb: true + + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { \ + 0 < +0 -0 > \ + helpMenuLayout < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + helpTextFrame < +inf -inf * +inf -inf > \ + 0 \ + } \ + 0 < +0 -0 > \ + horizontal { \ + 0 < +0 -0 > \ + helpInfoLayout < +inf -inf * > \ + 0 < +0 -0 > \ + } \ + -1 \ + } + *helptext*background: white + *helptext*foreground: black + + *helpMenuLayout*background: gray + *helpMenuLayout*Command.highlightThickness: 2 + *helpMenuLayout*Command.internalHeight: 2 + *helpMenuLayout*Command.font: -*-helvetica-bold-r-normal-*-12-*-*-* + *helpMenuLayout.layout: vertical { \ + 5 \ + horizontal { \ + 5 < +0 -5 > \ + helpBack \ + 2 < +0 -2 > \ + helpForward \ + 2 < +0 -2 > \ + helpHome \ + 20 < +inf -20 > \ + helpClose \ + 5 < +0 -5 > \ + } \ + 5 \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Done + + *helpInfoLayout*background: gray + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { \ + 5 \ + helpIRAFLogo \ + 5 \ + } \ + 1 \ + vertical { \ + 5 \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo1 \ + 0 < +inf -inf > \ + } \ + 0 < +inf -0 > \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo2 \ + 0 < +inf -inf > \ + } \ + 0 < +inf -0 > \ + horizontal { \ + 0 < +inf -inf > \ + helpInfo3 \ + 0 < +inf -inf > \ + } \ + 5 \ + } \ + 1 \ + vertical { \ + 5 \ + helpNOAOLogo \ + 5 \ + } \ + 5 \ + } + *helpInfo1.label: XImtool V1.2 -- Released: 4/30/2000 + *helpInfo2.label: iraf@noao.edu (520) 318-8160 + *helpInfo3.label: NOAO is operated by AURA under cooperative agreement with the NSF + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalheight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: steelblue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalheight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: steelblue + *helpInfoLayout.helpNOAOLogo.background: white + + *helpText.width: 450 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText.plainFont: 6x13 + + + ! Define a debug Tcl shell. + !-------------------------------- + *tclShell.title: Interactive Tcl Shell + *tclForm.background: gray + *tclForm*Label.background: gray + *tclForm*Label.borderWidth: 0 + *tclForm*Label.resize: False + *tclForm*Command.resize: False + *tclForm*Command.background: grey75 + *tclForm*Command.font: 7x13bold + *tclLabel.label: Server Command Entry + *tclClear.label: Clear + *tclExecute.label: Execute + *tclEntry*Text.font: 7x13 + *tclEntry*width: 500 + *tclEntry*borderWidth: 1 + *tclEntry*height: 150 + *tclEntry*editType: edit + *tclEntry*scrollHorizontal: whenNeeded + *tclEntry*scrollVertical: never + *tclEntry*displayCaret: True + *tclcloseButton.label: Done + + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *warnings: True +} + +# Start up the GUI. +createObjects +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate +activate + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 1.2" + +set winWidth [send imagewin get width] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set blinkFrames "1 2" ;# list of blink/tile frames + +set loadP_up 0 +set saveP_up 0 +set printP_up 0 +set infoP_up 0 +set panel_up 0 +set helpP_up 0 + + +proc winResize {w width height} \ + { global winWidth winHeight; set winWidth $width; set winHeight $height} +send imagewin addCallback winResize resize + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { warnings } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set enhancement($i) none ;# colortable enhancement +} + +# Called when the number of frames changes. +proc setNFrames {param old new} { + global frameMenuDescription nframes frames + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + editMenu frameMenu frameButton $frameMenuDescription + } + foreach i $frames { + if {$i <= $nframes} { + send frameBox manage frame$i + } else { + send frameBox unmanage frame$i + } + } +}; send nframes addCallback setNFrames + +set frameMenuDescription { + { 1 f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + { 2 f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + { 3 f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + { 4 f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + +# Called when the frame being displayed changes. +proc frameChanged {param old new} { + global frame + set frame $new + send frameButton set label $frame +}; send frame addCallback frameChanged + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} { + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} { + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frame + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] +}; send frameView addCallback setFrameView + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} { + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} { + send imageTitle set label [string trimright $new] +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} { + send ${param}Button set state [true $new] +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. +proc Quit args { send client Quit } +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x } +proc yflip args { send client flip y } +proc xyflip args { send client flip x y } + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}; + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00}; + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00}; + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00}; + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f}; + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00}; + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00}; + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +send panelButton "set bitmap panel; addCallback panel" +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send helpButton "set bitmap qmark; addCallback Help" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" + + +# WINDOW the current frame. +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs $xmag $ymag $xcen $ycen + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>s: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.line } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.line } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + +# WCSBOX -- Real time coordinate display. +set track_enable 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$track_enable} { + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + } else { + set text [format " %7.2f %7.2f %7.1f " $rx $ry $rz] + } + send wcsbox "set text \{$text\}; redraw noerase" + } +} + +proc setTrack {state} \ +{ + global track_enable wcsboxGeom + global winWidth winHeight + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 25ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + } +} + +proc wcsboxDestroyCallback args { + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args { + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + } +} + +proc wcsboxMoved {marker event position} { + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} { + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>s: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Btn2Up>: call(pannerPanXY,$x,$y) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args { + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args { + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args { + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} { + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} { + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + send client zoom $xscale $yscale $x $y + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} { + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} { + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} { + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} { + global winWidth winHeight + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args { + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} { + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(magzoomMenu) + <Btn3Up>: popdown(magzoomMenu) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + + +proc toggleMagnifier args { + global magnifier_enable + + if {$magnifier_enable} { + setMagnifier 0 + send pbMagM set state False + } else { + setMagnifier 1 + send pbMagM set state True + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args { + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} { + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} { + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} { + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args { + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} { + global magnifierGeom displayMagnifier + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args { + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + + if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI the magnifier is still (mostly) correctly. + set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ + (($last_mag_y-$y) * ($last_mag_y-$y))] + if {$diff > 36} { + set last_mag_x $x + set last_mag_y $y + return + } + } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } { + return + } + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +# FRAME BLINK. +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args { + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args { + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args { + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args { + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client windowColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { + send info map + infoUpdate + } } + { "Load" f.exec { + send client setLoadOption rescan + send load_panel map + set loadP_up 1 + } } + { "Save" f.exec { + Save + } } + { "Save As..." f.exec { + send save_panel map + set saveP_up 1 + } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { + send print_panel map + set printP_up 1 + } } + { "TclShell" f.exec { + send tclShell map + } } + { f.line } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Quit" f.exec Quit } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.line } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.line } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Colormaps" f.title } + { f.dblline } + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.line } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.line } + { "Control Panel" f.exec { panel + set panel_up 1 + } } + { "Print Panel" f.exec { send print_panel map + set printP_up 1 + } } + { "Load Panel" f.exec { send client setLoadOption rescan + send load_panel map + set loadP_up 1 + } } + { "Save Panel" f.exec { send save_panel map + set saveP_up 1 + } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + +# MAIN CONTROL PANEL +# --------------------------- + + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 + +proc controlPanelDone args { + global panel_up + send controlShell unmap + send panelButton set state 0 + set panel_up 0 +}; send doneButton addCallback controlPanelDone + +# panel -- Toggle control panel display. +proc panel args { + global panel_up + if {$panel_up} { + send controlShell unmap + send panelButton set state 0 + set panel_up 0 + } else { + send controlShell map + send panelButton set state 1 + set panel_up 1 + } +} + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} { + global frame nframes frames + global displayPanner displayCoords displayMagnifier + global blinkFrames warnings + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i $blinkFrames { + send blinkFrame$button set label $i + incr button + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + } + } +}; send initialize addCallback resetPanel + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} { + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} { + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +foreach i $frames {send frame$i addCallback cpSetFrame} + +# Frame buttons. +proc cpFrameAction {widget args} { + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args { + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args { + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +}; + +proc initFitFrame { param old new } { + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} { + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} { + global frameZoomX frameZoomY zoomindex frame + + if {$mode == "fixed"} { + send client zoom $zoom_x $zoom_y + } else { + send client zoom \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args { + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget {toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8} { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 + +proc cpDisplayFrameData {name old new} { + global cpFrame cpXcen cpYcen + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpYmag $ymag + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args { + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} { + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args { + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args { + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} { + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set cpScrollHeight 0 + +proc cpSetColorList {param old new} { + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc cpResizeScrollbar {widget cbtype flags x y w h cw ch} { + global cpScrollHeight + set newHeight [expr $ch - $h] + if {$newHeight && $newHeight != $cpScrollHeight} { + send colorlistScroll setScrollbar 0.0 [expr double($h) / $ch] + set rowHeight [send colorlist get rowHeight] + set rowSpacing [send colorlist get rowSpacing] + send colorlistScroll set increment [expr ($ch <= $h) ? 0 : \ + "double ($rowHeight + $rowSpacing) / ($ch - $h)"] + set cpScrollHeight $newHeight + } +}; send colorlistPort addCallback cpResizeScrollbar + +proc cpScrollColorlist {widget cbtype pos} { + global cpScrollHeight + send colorlist set y [expr -int($cpScrollHeight * $pos)] +}; send colorlistScroll addCallback cpScrollColorlist scroll + +proc cpSelectColor {widget cbtype selections indices} { + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate + +proc cpSetBlinkRate {widget args} { + global blinkRate + if {$widget == "BRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate +} +foreach widget {BRincrease BRdecrease} { + send $widget addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} { + global blinkFrames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i $frames {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} { + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send $widget set state 0 + blink + } elseif {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } +}; send blinkButton addCallback cpBlink + +proc cpResetBlink args { + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i $frames { + send blinkFrame$i set label " " + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + set blinkIndex 0 +}; send blinkReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} { + upvar $name blinkId + send blinkButton set state [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} { + global blinkFrames frames + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + foreach i $blinkFrames { + send blinkFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args { + global blinkFrames + send client registerFrames \{$blinkFrames\} +}; send registerButton addCallback cpRegisterFrames + +proc cpMatchFrames args { + global blinkFrames + send client matchFrames \{$blinkFrames\} +}; send matchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} { + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} { + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} { + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} { + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} { + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} { + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args { + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args { + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} { + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args { + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} { + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames args { + global blinkFrames + set value [send tileFramesButton get on] + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $blinkFrames \} +}; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} { + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. + +set W_object "" +set W_ok_command "" +set W_cancel_command "" + +proc Wexec {object msg args} { + global W_object W_ok_command W_cancel_command + set W_object $object + set W_ok_command [lindex $args 0] + set W_cancel_command [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} { + global W_object W_ok_command W_cancel_command + switch $widget { + warnOk { if [llength $W_ok_command] { + send $W_object $W_ok_command + } + } + warnCancel { if [llength $W_cancel_command] { + send $W_object $W_cancel_command + } + } + } + send warning unmap +}; foreach w {warnOk warnCancel} {send $w addCallback Wbutton} + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} { + Wexec client [lindex $new 0] [lindex $new 1] [lindex $new 2] +}; send alert addCallback setAlert + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args { + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + + +# INFO box. +#----------- +proc infoDone args { send info unmap } +send infoDone addCallback infoDone +proc infoClear args { send infoText set string "" } +send infoUpdate addCallback infoUpdate +send infoClear addCallback infoClear + +proc infoUpdate args { + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen + global cpXmag cpYmag cpXscale cpYscale + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set center [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $center] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 + ] + } +} +foreach param { frame frameView nframes frameSize frameTitle enhancement } { + send $param addCallback infoUpdate +} + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } { + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Print Panel Functions. +#------------------------ +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args { + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } { + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + } elseif { $val == "False" } { + send annotateButton set on false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton +} + +proc prPrintCommand { widget cbtype args } { + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prOptionToggle { widget cbtype args } { + global imageScale + + # Handle the image scale widgets first. + #print [ format "prOptionToggle %s" $widget ] + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } { + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set psScrollHeight 0 + +proc psSetPrintList {param old new} { + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc psResizeScrollbar {widget cbtype flags x y w h cw ch} { + global psScrollHeight + set newHeight [expr $ch - $h] + if {$newHeight && $newHeight != $psScrollHeight} { + send printlistScroll setScrollbar 0.0 [expr double($h) / $ch] + set rowHeight [send printlist get rowHeight] + set rowSpacing [send printlist get rowSpacing] + send printlistScroll set increment [expr ($ch <= $h) ? 0 : \ + "double ($rowHeight + $rowSpacing) / ($ch - $h)"] + set psScrollHeight $newHeight + } +}; send printlistPort addCallback psResizeScrollbar + +proc psScrollPrintlist {widget cbtype pos} { + global psScrollHeight + send printlist set y [expr -int($psScrollHeight * $pos)] +}; send printlistScroll addCallback psScrollPrintlist scroll + +proc psSelectPrint {widget cbtype selections indices} { + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc printQuit { args } { + send print_panel unmap +} ; send donePrint addCallback printQuit + +proc Print { args } { + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } { + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + +#-------------------------- +# Save panel functions. +#-------------------------- +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button pnmButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } { + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + pnmButton { send client setSaveOption format pnm } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } { + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } { + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + pnm { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format pnmButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + +send doneSave addCallback "send save_panel unmap" + +proc Save { args } { + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle + #send save_panel unmap +} ; send okaySave addCallback Save + + +# ------------------------------------------ +# Image and objects list display and section +# ------------------------------------------ + +set load_frame 1 + +proc filesTextHighlight { widget event args } { + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +send imtemplateText addEventHandler filesTextHighlight enterWindowMask +send imtemplateText addEventHandler filesTextHighlight leaveWindowMask +send fnameText addEventHandler filesTextHighlight enterWindowMask +send fnameText addEventHandler filesTextHighlight leaveWindowMask + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +proc setPattern { widget mode pattern args } { + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + +proc doLoadOptions { param old new } { + global warnings loadP_up + + set val [ join [lrange $new 1 end] " " ] + + #print [format "doLoadOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format "Directory: %s" $val ] } + newfile { send fnameText set string $val + if { [ string last / $val ] < 0 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + } + status { send filesStatus set label $val + if { ! $loadP_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayToggle set on $val } + } +} ; send loadOptions addCallback doLoadOptions + +proc toggleGraymap { widget args } { + send client setLoadOption gray [ send grayToggle get on ] +} ; send grayToggle addCallback toggleGraymap + +proc fileLoad { widget mode fname args } { + global load_frame loadP_up + send imagewin setCursorType busy + send client load $fname $load_frame + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] \ + $fname ] + if { [ string last / $fname ] < 0 && [ file isfile $fpath] == 1 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + send imagewin setCursorType idle +} ; send fnameText addCallback fileLoad + + +set imlistScrollheight 0 + +proc setFileList {param old new} { + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flresizeScrollbar { widget cbtype flags x y w h cw ch } { + global imlistScrollheight + set newheight [expr $ch - $h] + if { $newheight != $imlistScrollheight } { + send imlistScrollbar setScrollbar 0.0 [expr double($h) / $ch] + set imlistScrollheight $newheight + } +} ; send imlistPorthole addCallback flresizeScrollbar + +proc flscrollList { widget cbtype pos } { + global imlistScrollheight + send imageList set y [expr -int($imlistScrollheight * $pos)] +} ; send imlistScrollbar addCallback flscrollList scroll + +proc flSelectPrint {widget cbtype selections args} { + global load_frame loadP_up + foreach selection $selections { + send client load $selection $load_frame + if { [ string last / $selection ] < 0 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + } +}; send imageList addCallback flSelectPrint + +proc fileSetFrame {widget args} { + global nframes load_frame + + set frame [send $widget get label] + if {$frame == $nframes} { + set frame 1 + } else { + incr frame + } + send $widget set label $frame + set load_frame $frame +}; send frameFrame addCallback fileSetFrame + +proc fileLoadB args { + global load_frame loadP_up + send imagewin setCursorType busy + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + send client load $fname $load_frame + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] \ + $fname ] + if { [ string last / $fname ] < 0 && [ file isfile $fpath] == 1 } { + if { [send browseToggle get on] == 0 } { + send load_panel unmap + set loadP_up 0 + } + } + send imagewin setCursorType idle + } +} ; send filesLoadButton addCallback fileLoadB + +proc fileQuit args { + send load_panel unmap + set loadP_up 0 +} ; send filesCloseButton addCallback fileQuit + + +# More Panel toggles + +proc infoPanel args { + global infoP_up + if {$infoP_up} { + send info unmap + set infoP_up 0 + } else { + send info map + set infoP_up 1 + } +} + +proc pannerPanel args { + global panner_enable + setPanner [expr !$panner_enable] +} + +proc magnifierPanel args { + global magnifier_enable + setMagnifier [expr !$magnifier_enable] +} + +proc wcsPanel args { + global track_enable + setTrack [expr !$track_enable] +} + +proc loadPanel args { + global loadP_up + if {$loadP_up} { + send load_panel unmap + set loadP_up 0 + } else { + send client setLoadOption rescan + send load_panel map + set loadP_up 1 + } +} + +proc savePanel args { + global saveP_up + if {$saveP_up} { + send save_panel unmap + set saveP_up 0 + } else { + send save_panel map + set saveP_up 1 + } +} + +proc printPanel args { + global printP_up + if {$printP_up} { + send print_panel unmap + set printP_up 0 + } else { + send print_panel map + set printP_up 1 + } +} + + +#------------------------------------ +# Define procedure for the help panel +#------------------------------------ + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +send helpInfo1 set label $version + +proc Help args { + global helpP_up + if {$helpP_up == 0} { + send client help + } else { + send help_panel unmap + set helpP_up 0 + } +} + +proc helpPanel args { + global helpP_up + if {$helpP_up} { + send help_panel unmap + set helpP_up 0 + } else { + send help_panel map + set helpP_up 1 + } +} + +proc helpQuit args { + global helpP_up + send help_panel unmap + set helpP_up 0 + send helpButton set state 0 + send helpText setText "" +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } { + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} { + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack set sensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward set sensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward set sensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward set sensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} { + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args { + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward set sensitive False + send helpBack set sensitive True + } else { + send helpBack set sensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args { + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack set sensitive False } + if {$linkIndex >= 0} { send helpForward set sensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args { + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward set sensitive False + send helpBack set sensitive False +}; send helpHome addCallback hlpHome + + + +#------------------------------------ +# Define some TCL debug procedures. +#------------------------------------ + +set tclP_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tclShell unmap } +proc tclOpen { args } { + global tclP_up + send tclShell map + set tclP_up 1 +} + +proc tclPanel args { + global tclP_up + if {$tclP_up} { + send tclShell unmap + set tclP_up 0 + } else { + send tclShell map + set tclP_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclcloseButton addCallback tclClose + diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-mag.html b/vendor/x11iraf/ximtool/OLD/ximtool-mag.html new file mode 100644 index 00000000..96a959f7 --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-mag.html @@ -0,0 +1,697 @@ +<HTML> <HEAD> +<TITLE>XImtool On-Line Help Summary</TITLE> +</HEAD> <BODY> +<H2>Welcome to XImtool V1.1</H2> + +XImtool is an image display server developed by the IRAF Project at the +National Optical Astronomy Observatories. To view images you need +client software (such as IRAF) to load images into the display, or it can +load images directly when run as a standalone task. XImtool is +interchangeable with older display servers such as <I>SAOimage</I> / +<I>IMTOOL</I> and with newer servers like <I>SAOtng</I>, but offers many new +features not available elsewhere. +<P> +More <a href=#toc>detailed help</a> is available on the following topics: +<DL><DL> +<DT>Basic Usage:</DT> +<UL> +<LI><A HREF="#basic">Getting Started</A> -- The basics. </LI> +<LI><A HREF="#gui">GUI Overview</A> -- What it looks like. </LI> +<LI><A HREF="#mouse">Mouse Operations</A> -- Doing stuff. </LI> +<LI><A HREF="#keystroke">Keystroke Accelerators</A> -- Keystroke summary.</LI> +<LI><A HREF="#markers">Markers</A> -- Pan/Mag/WCS markers, general markers.</LI> +<LI><A HREF="#control">Control Panel</A> -- Operating the Control panel.</LI> +<LI><A HREF="#load">Load Panel</A> -- Load panel operation and options.</LI> +<LI><A HREF="#save">Save Panel</A> -- Save panel operation and options.</LI> +<LI><A HREF="#print">Print Panel</A> -- Print panel operation and options.</LI> +<LI><A HREF="#info">Info Panel</A> -- Information panel.</LI> +</UL></DL></DL> +<DL><DL> +<DT>Advanced Features:</DT> +<UL> +<LI><A HREF="#comline">Command-line Options</A> -- Startup flags. </LI> +<LI><A HREF="#client">Client Connections</A> -- Use as a display server. </LI> +<LI><A HREF="#framebuf">Frame Buffers</A> -- Explanation of Frame buffers. </LI> +<LI><A HREF="#pprinter">Printer Configurations</A> -- Configuring output devices. </LI> +<LI><A HREF="#tclshell">TclShell</A> -- Expert-mode interactive shell.</LI> +</UL></DL></DL> +<P> +Please contact <I>iraf@noao.edu</I> with comments, bugs, or suggestions. +<P> +<HR></P> + +<a name=#toc> <h2>Table of Contents:</h2> </a> +<PRE> + <A HREF="#basic">Getting Started</A> + <A HREF="#gui">GUI Overview</A> + <A HREF="#mouse">Mouse Operations</A> + <A HREF="#keystroke">Keystroke Accelerators</A> + <A HREF="#comline">Command-line Options</A> + <A HREF="#client">Client Connections</A> + <A HREF="#framebuf">Frame Buffers</A> + <A HREF="#markers">Markers</A> + <A HREF="#panner">Panner Marker</A> + <A HREF="#magnifier">Magnifier Marker</A> + <A HREF="#coords">Coords Box Marker</A> + <A HREF="#genmark">General Markers</A> + <A HREF="#markmenu">Menu Options</A> + <A HREF="#control">Control Panel</A> + <A HREF="#cview">View Controls</A> + <A HREF="#cenhance">Enhancement Controls</A> + <A HREF="#cblink">Blink Controls</A> + <A HREF="#copts">Options:</A> + <A HREF="#cautoscale">Autoscale</A> + <A HREF="#cantialias">Antialiasing</A> + <A HREF="#ctile">Tile Frames</A> + <A HREF="#cwarnings">Warnings</A> + <A HREF="#ccmap">Colormap Selection</A> + <A HREF="#cbltin">Builtin Colormaps</A> + <A HREF="#cuser">User-defined Colormaps</A> + <A HREF="#load">Load Panel</A> + <A HREF="#lbrowse">Directory browsing</A> + <A HREF="#lpattern">File Patterns</A> + <A HREF="#lload">Direct File Load</A> + <A HREF="#lframe">Frame Selections</A> + <A HREF="#save">Save Panel</A> + <A HREF="#sfname">File Name</A> + <A HREF="#sformat">Format</A> + <A HREF="#scolor">Color</A> + <A HREF="#print">Print Panel</A> + <A HREF="#popts">Postscript Options</A> + <A HREF="#pcolors">Color Options</A> + <A HREF="#pproc">Processing Options</A> + <A HREF="#pprinter">Printer selection</A> + <A HREF="#info">Info Panel</A> + <A HREF="#tclshell">TclShell</A> +</PRE> +<P> +<HR> +<h2><a name=#basic>Getting Started</a></h2> +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept +<a href=#client>client connections</a> simultaneously on fifo pipes, unix +domain sockets, or inet sockets. A display client like the IRAF DISPLAY +task makes a connection and sends the image across using an IIS protocol +(other/different protocols may be supported in the future). Once the image +is loaded in the display buffer it may be <a href=#cenhance>enhanced</a>, +<a href=#save>saved to a disk file</a> in a number of different formats, or +<a href=#print>printed</a> as Encapsulated Postscript to a printer or disk file. +<P> +When run in standalone mode, images may be loaded on the +<a href=#comline>command line</a> or by using the <a href=#load>Load Panel</a>. +This allows you to browse images and perform the same manipulations as if +they had been displayed by a client. +<hr> + +<h2><a name=#gui>GUI Overview</a></h2> +<p> +The GUI consists of a large image display window and a number of smaller +pannels that control various specific functions such as image +<a href=#load>Load</a>, <a href=#save>Save</a> and <a href=#print>Print</a> +as well as a general purpose <a href=#control>Control Panel</a>. The main +window menubar has several menu buttons to the left: the <I>Files</I> menu +is used to load/save/print an image as well as quit the task. The <I>View</I> +menu let's you select the image orientation, zoom, colormap or frame. The +<I>Options</I> menu allows you to call up control panels, toggle markers +or blinking etc. Some of this functionality is duplicated elsewhere in +the GUI. The right side of the menubar contains command buttons to flip the +image as well as buttons for frame selection and the help button. +<p> +For more detailed information on the operation of the control panels please +see the on-line help (i.e. use the '?' button or Alt-h keystroke in the +main image window). + +<h2><a name=#mouse>Mouse Operations</a></h2> +Clicking and dragging MB1 (mouse button 1) in the main image +window creates a rectangular region <a href=#markers>marker</a>, used +to select a region of the image. If you do this accidentally and don't +want the marker, put the pointer in the marker and type DELETE or +BACKSPACE to delete the marker. With the pointer in the marker, +MB3 will call up a <a href=#markmenu>marker menu</a> listing some things + you can do with the marker, like zoom the outlined region. MB1 can be used +to drag or resize the marker. <a href=#markers>See below</a> for more +information on markers. +<p> +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. +<p> +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the display. +<hr> + +<h2><a name=#keystroke>Keystroke Accelerators</a></h2> + The following keystrokes are currently defined in the GUI: +<pre> + +Ctrl-b Backward frame Alt-b Blink frames (toggle) +Ctrl-c Center frame? Alt-c Control panel +Ctrl-f Forward frame Alt-h Help +Ctrl-i Invert? Alt-i Info box popup +Ctrl-m Match LUTs Alt-l Load file popup +Ctrl-n Normalize Alt-p Print popup +Ctrl-p Print Alt-s Save popup +Ctrl-r Register Alt-t TclShell popup +Ctrl-t Tile frames toggle +Ctrl-u Unzoom (zoom=1) +Ctrl-x Flip X Ctrl-Alt-q Quit +Ctrl-y Flip Y Ctrl-Alt-f Fitframe + +Ctrl-= Print +Ctrl-< Decrease blink rate Ctrl-+ Zoom in +Ctrl-> Increase blink rate Ctrl-- Zoom out + +Ctrl-[hjkl] Move cursor one pixel +Ctrl-[arrow] Move cursor one pixel +Ctrl-Shift-[hjkl] Move cursor ten pixels +Ctrl-Shift-[arrow] Move cursor ten pixels +Alt-1 thru Alt-4 Set frame displayed +Ctrl-1 thru Ctrl-9 Set integer zoom factor +</pre> +NOTE: These keystrokes only work with the cursor in the main image window, +not on the subwindows or in markers. +<hr> + +<h2><a name=#client>Client Connections</a></h2> +Ximtool allows clients to connect in any of the following ways: +</DL> +<DT><B>fifo pipes</B></DT> +<DD>The traditional approach. The default, global /dev/imt1[io] pipes may +be used, or a private set of fifos.</DD> +<DT><B>tcp/ip socket</B></DT> +<DD>Clients connect via a tcp/ip socket. There is a default port, or a +custom port may be specified. This permits connecting to the server over a +remote network connection anywhere on the Internet.</DD> +<DT><B>unix domain socket</B></DT> +<DD> Like a tcp/ip socket, but limited to a single host system. Usually +faster than a tcp/ip socket, and comparable to a fifo. By default each user +gets their own unix domain socket, so this option allows multiple users +to run ximtools on the same host without having to customize things.</DD> +</DL> +By default ximtool listens simultaneously for client connctions on all three +types of ports. Clients communicate with XImtool using the IIS protocol, +other protocols may be supported in the future. +<hr> + +<h2><a name=#framebuf>Frame Buffers</a></h2> +XImtool starts up using default frame buffer of 512x512 pixels. When loading +disk images the frame buffer configuration file will be searched for a +defined frame buffer that is the same size or larger than the current image, +when used as a display server the frame buffer configuration number is passed +in by the client. The default file used is /usr/local/lib/imtoolrc, this can +be overridden by defining a <b>IMTOOLRC</b> environment variable naming the +file to be used, or by creating a <b>.imtoolrc</b> file in your home +directory. +<P> +The format of the frame buffer configuration file is +<pre> + configno nframes width height [extra fields] +e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment +</pre> +At most 128 frame buffer sizes may be defined. +<hr> + +<h2><a name=#comline>Command-line Options</a></h2> + The following command-line options are currently recognized: +<pre> + -basePixel &lt num &gt Base colormap pixel number + -cmap1 &lt file &gt User cmap 1 + -cmap2 &lt file &gt User cmap 2 + -cmapDir1 &lt dir &gt User cmapDir 1 + -cmapDir1 &lt dir &gt User cmapDir 2 + -cmapInitialize &lt bool &gt Initialize colormap at startup + -cmapName &lt name &gt Private colormap name + -config &lt num &gt Initial config number + -defgui Print default GUI to stdout + -displayPanner &lt bool &gt Display panner box + -displayCoords &lt bool &gt Display wcs coords box + -displayMagnifier &lt bool &gt Display magnifier box + -fifo &lt pipe &gt Fifo pipe to use + -fifo_only Use fifo pipes only + -gui &lt file &gt GUI file to use + -help Print command-line summary + -imtoolrc &lt file &gt Frame buffer configuration file + -inet_only Use inet sockets only + -invert Invert colormap on startup? + -maxColors &lt num &gt Number of colors + -memModel &lt type &gt Memory model (fast,small,beNiceToServer) + -nframes &lt num &gt Number of frames at startup + -port &lt num &gt Inet port to use + -printConfig &lt file &gt Printer configuration file + -port_only Use inet sockets only + -tile Tile frames on startup? + -unix &lt name &gt Unix socket to use + -unix_only Use unix sockets only + &lt file &gt File to load on startup +</pre> +<hr> +<h2><a name=#markers>Markers</a></h2> +<h3><a name=#panner>Panner Marker</a></h3> +<P> +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. +<P> +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned <a href=#genmark>below</a> apply to these markers as well, e.g. +you can use MB1 to reposition on the panner window within the main image +display window, or to drag the region marker within the panner (pan the +image). Resizing the region marker zooms the image; this is a non-aspect +constrained zoom. The panner window itself can be resized by dragging a +corner with MB1. Typing delete or backspace anywhere in the panner window +deletes the panner. +<P> +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to typing MB2 in the main display +window to pan the image. + +<h3><a name=#magnifier>Magnifier Marker</a></h3> +<P> +The magnifier marker can be used to zoom in on a small area around the +cursor. It will be updated as the cursor moves but only for small motions +(either mouse movement or with the <a href=#mouse>cursor movement +keystrokes</a>) to minimize the +impact on the system. The zoom factor is expressed as some fraction of the +size of the magnifier marker itself. The default zoom is 4, i.e. the area +in the marker represents and area in the image that's one-fourth the size +of the marker. Other zoom factors may be selected using the popup menu +created by hitting MB1 in the marker. +<P> +By default the magnifier marker is not visible, to toggle it select the +<I>Magnifier</I> option from the <I>Options</I> menubar button. Alternatively, +for just a quick look holding down the Shift and MB1 buttons will display +the marker until the button is released. + +<h3><a name=#coords>Coords Box Marker</a></h3> +<P> +Ximtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +client defined coordinate system. The coords box feature is used to display +these world coordinates as the pointer is moved about in the image window. +<P> +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated +a "+" will be displayed after the intensity value. +<P> +The coords box is a marker (text marker) and it can be moved and resized +with the pointer like any other marker. + +<h3><a name=#genmark>General Markers</a></h3> +Although ximtool doesn't do much with markers currently, they are a general +feature of the Gterm widget and are used more extensively in other programs +(e.g. the prototype IRAF science GUI applications). Ximtool uses markers +for the marker zoom feature discussed above, and also for the +<a href=#panner>panner</a> and the <a href=#coords>coords box</a>. All +markers share some of the same characteristics, so it is worthwhile learning +basic marker manipulation keystrokes. +<UL> +<LI> MB1 anywhere inside a marker may be used to drag the marker. +<LI> MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +<LI> Shift-MB1 on the corner of most markers will rotate the marker. +<LI> Markers stack, if you have several markers and you put one on top +of the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +<LI> MB2 in the body of a marker "lowers" the marker, i.e. moves it to +the bottom of the stacking order. +<LI> Delete or backspace in a marker deletes it. +<LI> Markers have their own translation resources and so the default +<a href=#keystroke>keystroke commands</a> will not be recognized when the +cursor is in a marker. +</UL> +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back if you delete it). +<P> +<h4><a name=#markmenu>Marker Menu Options</a></h4> +<UL> +<LI> MB3 (mouse button 3) calls up the marker menu (by default). +<LI> <B>Zoom</B> does an equal aspect zoom of the region outlined by the marker. +In this way you can mark a region of the image and zoom it up. +<LI> <B>Fill</B> exactly zooms the area outlined by the marker, making it fill +the display window. Since the marker is not likely to be exactly square, +the aspect ratio of the resultant image will not be unitary. +<LI> <B>Print</B> prints the region outlined by the marker to the printer or +file currently configured by the <a href=#print>Print Panel</a>. +<LI> <B>Save</B> saves the region outlined by the marker to the file currently +configured by the <a href=#save>Save Panel</a>. +<LI> <B>Info</B> prints a description of the marked region. The text is +printed in the <a href=#info>Info Panel</a>. +<LI> <B>Unrotate</B> unrotates a rotated marker. +<LI> <B>Color</B> is a menu of possible marker colors. +<LI> <B>Type</B> is a menu of possible marker types. This is still a little +buggy and it isn't very useful, but you can use it to play with different +types of markers. +<LI> <B>Destroy</B> destroys the marker. You can also hit the delete or +backspace key in a marker to destroy the marker. +</UL> + +<hr> +<h2><a name=#control>Control Panel</a></h2> +<h3><a name=#cview>View Controls</a></h3> +<P> The <b>Frame</b> box will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 4) will be created +automatically if requested by the client. +<P> The <b>text display window</b> gives the field X,Y center, X,Y scale +factors, and the X,Y zoom factors. The scale factor and the zoom factor +will be the same unless autoscale is enabled. The scale is in units of +display pixels per frame buffer pixel, and is an absolute measure (it doesn't +matter whether or not <a href=#cautoscale>autoscale</a> is enabled). Zoom is +relative to the autoscale factor, which is 1.0 if autoscaling is disabled. +This information is also presented in the <a href=#info>Info panel</a>. +<P> The numbers in the <b>Zoom</b> box are zoom factors. Blue numbers zoom, +red numbers dezoom. <b>Zoom In</b> and <b>Zoom Out</b> may be used to go to +larger or smaller zoom factors, e.g. "Ctrl-5" followed by "Zoom In" will get you +to zoom factor 10. Specific zoom factors may also be accessed directly as +Control <a href=#keystrokes>keystrokes</a>, e.g. Ctrl-5 will set zoom factor 5. +<b>Center</b> centers the field. <b>Toggle Zoom</b> toggles between the +current zoom/center values, and the unzoomed image. +<P> <b>Aspect</b> recomputes the view so that the aspect ratio is 1.0. +Aspect also integerizes the zoom factor (use the version in the View menu +if you don't want integerization). +<P> <b>Fit Frame</b> makes the display window the same size as the frame +buffer. Note that <a href=#cautoscale>autoscale</a> has much the same effect, +and allows you to resize the display window to any size you want, or view +images to large to fit on the screen. + +<h3><a name=#cenhance>Enhancement Controls</a></h3> + +<P> At the top is a scrolled list of all the <a href=#cbltin>available +colormaps</a>. Click on the one you want to load it. You can add your own +<a href=#cuser>colormaps</a> to this list. +<P> The two sliders adjust the <b>contrast</b> (upper slider) and +<b>brightness</b> (lower slider) of the display. The <b>Invert</b> button +inverts the colormap (multiples the contrast by -1.0). Note that due to the +use of the private colormap the sliders are a bit sluggish when dragged to +window the display. If this is annoying, using MB3 in the display window is +faster. +<P>The <b>Normalize</b> button (on the bottom of the control panel) will +normalize the enhancement, i.e. set the contrast and brightness to the default +one-to-one values (1.0, 0.5). This is the preferred setting for many of the +pseudocolor colortables and for private colormaps loaded from disk images. + +<h3><a name=#cblink>Blink Controls</a></h3> +<UL> +<LI> <b>Blink frames</b> is the list of frames to be blinked. When blink +mode is in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered in +the list more than once. To program an arbitrary list of blink frames, hit +the <b>Reset</b> button and click on each blink frame button until it is set +to the desired frame number. +<LI> The <b>Blink Rate</b> can be adjusted as slow or as fast as you want +using the arrow buttons. If you set the blink rate small enough it will go +to zero, enabling single step mode (see below). +<LI> The <b>Register</b> button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. +<LI> The <b>Match LUTs</b> button sets the enhancement of all blink frames to +the same values as the display frame. Frames not in the blink list are not +affected. +<LI> The <b>Blink</b> button turns blink on and off. When the blink rate is +set to zero the Blink button will single step through the blink frames, one +frame per button press. +</UL> +<P> +NOTE: you can blink no matter what ximtool options are in effect, but many +of these will slow blink down. To get the fastest blink you may want to +turn off the panner and coords box, and match the LUTs of all the blink +frames. All the ximtool controls are fully active during blink mode, plus +you can load frames etc. + + +<h3><a name=#copts>Options:</a></h3> +<DL> +<DT><b><a name=#cautoscale>Autoscale</a></b></DT> +<DD> If autoscale is enabled then at zoom=1, the frame buffer will be +automatically scaled to fit within the display window. With autoscale +disabled (the default), the image scale is more predictable, but the image +may be clipped by the display window, or may not fill the display window.</DD> + +<DT><b><a name=#cantialias>Antialiasing</a></b></DT> +<DD> When dezooming an image, i.e., displaying a large image in a smaller +display window, antialiasing causes all the data to be used to compute the +displayed image. If antialiasing is disabled then image is subsampled to +compute the displayed image. Antialiasing can prevent subsampling from +omitting image features that don't fall in the sample grid, but it is +significantly slower than dezooming via subsampling. The default is no +antialising. </DD> + +<DT><b><a name=#ctile>Tile Frames</a></b></DT> +<DD> The default display mode is to view one frame at a time. In tile frames +mode, 2 or 4 frames may be viewed simultaneously in the display window. All +the usual operations (zoom and pan, colortable enhancement, cursor readback, +etc.) still work for each frame even when in tile frames mode. </DD> + +<DT><b><a name=#cwarnings>Warnings</a></b></DT> +<DD> The warnings options toggles whether you see warning dialog boxes in +situations like overwriting an existing file, clearing the frame buffer, etc. +</DD> +</DL> + +<h3><a name=#ccmap>Colormap Selection</a></h3> +By default XImtool will display images using either a grayscale colormap +if loaded by a client, or a private colormap when loading an image from +disk that contains a colormap. Each frame defines its own colormap so +you can define different colormaps or enhancements for each frame, they +will change automatically as you cycle through the frames. + +<h4><a name=#cbltin>Builtin Colormaps</a></h4> +Once loaded, the colormap may either be changed using the builtin colormap +menu under the <b>View</b> menu button on the main window, or from the +<a href=#cenhance>Enhancement</a> box on the <a href=#control>control panel</a>. Ximtool has about a dozen colormap +options builtin, other <a href=#cuser>user-defined colormaps</a> may +optionally be loaded. + +<h4><a name=#cuser>User-defined Colormaps</a></h4> +The cmap[12] and cmapDir[12] resources (or <a href=#comline>command line +arguments</a> are used to tell ximtool which specific colormaps to make +available or where to look for colortables respectively. The colortables +are loaded when ximtool starts up, or when it is reinitialized (e.g. by +pressing the <b>Initialize</b> button in the <a href=#control>control +panel</a>). Ximtool will ignore any files in the colormap directory +which do not look like colortables. New colortables will also be added +for each images loaded from disk. +<P> +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, +and blue values scaled to the range 0.0 (off) to 1.0 (full intensity). +<PRE> + R G B + R G B + (etc.) +</PRE> +Blank lines and comment lines (# ...) are ignored. +<P> +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. Ximtool will interpolate the table as necessary to +compute the colortable values used in Ximtool. Ximtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. +<P> +The name of the colortable as it will appear in the Ximtool control panel +is the root name of the file, e.g., if the file is "rainbow.lut" the +colortable name will be "rainbow". Lower case names are suggested to avoid +name collisions with the builtin colortables. Private colormaps for disk +images will be have the same name as the image loaded. If the same colortable +file appears in multiple user colortable directories, the first one will be +used. +<P> +The directory "luts" in the ximtool source directory contains a sample set +of colortable files. This can be installed as /usr/local/lib/imtoolcmap +when ximtool is installed. +<hr> + +<h2><a name=#load>Load Panel</a></h2> +The Load Panel allows you load images from disk directly to the frame buffer, +this is analogous to loading an image on the command line except that +browsing is possible. At present recognized formats include IRAF OIF format +(i.e. .imh extension), simple FITS files, GIF, and Sun rasterfiles. The +task will automatically sense the format of the image and load it +appropriately. Images with private colormaps (such as GIF) will be loaded +using the private colormap by default (meaning that changing the +brightness/contrast enhancements will render a random-colored image). If +the <b>Grayscale</b> button is enabled the image will be converted to +grayscale and loaded with the standard grayscale colormap. +<P> +When loading new images the frame buffer configuration table +(<em>imtoolrc</em>) will be searched for a frame buffer that is the same size +or larger than the new image size, if no frame buffer can be found a custom +buffer exactly the size of the image will be created. This means that the +image may not fill the display window when loaded, or you may see a subsection +of the image in the main display window. Setting the +<a href=#cautoscale>autoscale</a> option will scale the entire image to fit +the main display window. +<P> +Images with more colors than can be displayed will automatically be quantized +to the number of available colors before display. Formats which allow more +than 8-bit pixels will be sampled to determine an optimal range in the data +to be used to compute the transformation to the number of display colors. +This is the same transformation used by the IRAF DISPLAY task. + +<DL> +<DT><B><a name=#lbrowse>Directory browsing</a></B></DT> +<DD> +The load panel contains a list of files in the current directory that may +be selected for loading by selecting with left mouse button. If the file +is a directory the contents of the new directory will be loaded, if it's +a plain file an attempt will be made to load it as an image. Directories +in the list are identified with a trailing '/' character, you will always +see any directories available even if a <a href=#lpattern>filter</a> is +specified. +<P> +The <b>Root</b> button will reset the current directory to the system root +directory. The <b>Home</b> button will reset the current directory to the +user's login directory, the <b>Up</b> button moves up one directory level, +and <b>Rescan</b> reloads the file list by rescanning the directory. The +current working directory is given below the file selection window.</DD> + +<DT><B><a name=#lpattern>File Patterns</a></B></DT> +<DD> By default all files and directories will be listed. You may specify a +filter to e.g. select only those files with a given extension like "*.fits" +to list only files with a ".fits" extension. Directories will always be seen +in the list and are identified with a trailing '/' character. Any valid +unix pattern matching string will be recognized.</DD> +<DT><B><a name=#lload>Direct File Load</a></B></DT> +<DD> If you know exactly which file you wish to load, you may enter its name +in the <b>Load File</b> text box and either hit <cr> or the Load button to +load it. An absolute or relative path name may be given, if a simple filename +is specified it will be searched for in the current working directory.</DD> +<DT><B><a name=#lframe>Frame Selections</a></B></DT> +<DD> By default images will be loaded into frame number 1, you may select a +different frame using the <b>Frame</b> menu button.</DD> +</DL> +<hr> + +<h2><a name=#save>Save Panel</a></h2> +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, any general graphics +markers, or overlay graphics displayed by the client program). Presently, +only the contents of the main display window may be saved, there is no +facility for saving the undisplayed contents of the entire frame buffer +other than to enable the <a href=#cautoscale>autoscale</a> feature. A limited +number of formats are currently available, others will be added in future +versions. +<DL> +<DT><b><a name=#sfname>File Name</a></b></DT> +<DD> The <b>File Name</b> text box allows you to enter the file name of the +saved file. A "%d" anywhere in the name will be replaced by a sequence number +allowing multiple frames to be saved with unique names. </DD> +<DT><b><a name=#sformat>Format</a></b></DT> +<DD> The <B>Format</B> box allows you to choose the format of the image to be +created. Not all formats are currently implemented. </DD> +<DT><b><a name=#scolor>Color</a></b></DT> +<DD> The <b>Color</b> box lets you choose the color type of the image to be +created. The options will change depending on the format, e.g. FITS doesn't +allow color so no color options will be allowed. Formats which allow 24-bit +images will be written using the current colormap after converting to a 24-bit +image, pseudocolor images will be written with the current colormap. </DD> +</DL> +<hr> + +<h2><a name=#print>Print Panel</a></h2> +The Print Panel allows you dump the contents of the main display window as +Enacpsulated Postscript to either a named printer device or to a disk file. +The <b>Print To</b> selects the type of output, the <b>Print Command</b> +box will adjust accordingly, either as a Unix printer command or as a file +name. A "%d" anywhere in the name for disk output will be replaced by a +sequence number allowing multiple frames to be saved with unique names. +<a href=#pprinter>Selecting printers</a> from the installed list will +automatically change the command to be used to generate the output. This +command does not necessarily need to be a printer command, the +<a href=#pprinter>printer configuration file</a> lets you define any command +string to process the image. +<h3><a name=#pcolors>Color Options</a></h3> +The <b>Color</b> box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap. +<h3><a name=#popts>Postscript Options</a></h3> +<DL> +<DT>Orientation</DT> +<DD> Set the page orientation. +<DT>Paper Size</DT> +<DD> Select the paper size to be used. +<DT>Image Scale</DT> +<DD> Set the scale factor used to compute the final image size. +</DL> +<h3><a name=#pproc>Processing Options</a></h3> +<DL> +<DT>Auto Scale</DT> +<DD> The auto scale toggles whether or not the image is automatically scaled +to fit the page. If not enabled, the <b>image scale</b> will be used to +dtermine the output image size. +<DT>Auto Rotate</DT> +<DD> Auto rotate determines whether or not the image will be rotated to fit +on the page. When set, an image larger than the current orientation will be +rotated and possibly scaled to fit the page. +<DT>Max Aspect</DT> +<DD> Max Aspect takes images smaller than the page and automatically increases +the scale so the image fills the page in the current orientation. +<DT>Annotate</DT> +<DD> The annotate option toggles whether or not the final file includes +annotation such as the image title, a colorbar, and axis labels. +</DL> +<h3><a name=#pprinter>Printer selection</a></h3> +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the <em>printConfig</em> resource. The format of the file is simply +<pre> + <b>name</b> &lt tab &gt <em>command</em> +</pre> +The <b>name</b> value is what appears in the selection list and may be more +than a single word, the <em>command</em> can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command will be +a simple 'lpr -Pfoo' or some such, but can also include converters or +previewers. At most 128 printer commands may be used. +<hr> + +<h2><a name=#info>Info Panel</a></h2> + The information panel is underused at present but is meant to provide +basic information about the frame being displayed. It is updated to be +current while changing enhancements, pan/zoom regions, or frame selection. +In cases where the image title string is truncated in the main display window, +the user can always pop up the info window to see the full title. +<hr> + +<h2><a name=#tclshell>TclShell</a></h2> + The <em>TclShell</em> is mostly used as a development or debugging +tool for the GUI. It allows the user to type commands directly to the +TCL interpreter letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. Most users will +never need this, but for an example of what it does, bring it up and type a +command such as +<pre> + send helpButton set background red +</pre> +Cool, huh. +<hr> + +<h2><a name=#acknowledgements>Acknowledgements</a></h2> + <I>XImtool</I> was developed by the IRAF Group at the National Optical +Astronomy Observatories in Tucson, AZ. For further information or to report +problems please contact <I>iraf@noao.edu</I> +<hr> +This document was last updated 11/6/96. + +</BODY> +</HTML> diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-mag.man b/vendor/x11iraf/ximtool/OLD/ximtool-mag.man new file mode 100644 index 00000000..c4fcaae0 --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-mag.man @@ -0,0 +1,1493 @@ +.\" @(#)ximtool.1 1.1 10-Dec-96 MJF +.TH XIMTOOL-MAG 1 "10 Dec 1996" "X11IRAF Project" +.SH NAME +ximtool-mag \- interactive image display program for the X Window System with experimental GUI +.SH SYNOPSIS +.B "ximtool-mag" [\-\fItoolkitoption\fP ...] [ \fIoptions\fP ...] [\fIimagename\fP] +.SH OPTIONS +.TP 5 +.B "-basePixel \fIN\fP" +The base colormap cell used by the colormap. This essentially allows you +to reserve \fIbasePixel\fP colors in the global colormap for other applications. +The default is 64, if changed you'll need to also specify the +\fI-cmapInitialize\fP option or resource. +.TP 5 +.B "-cmap1 \fIfile\fP" +User colormap 1. This flag allows you to specify a colormap to be made +available at task startup. +.TP 5 +.B "-cmap2 \fIfile\fP" +User colormap 2. This flag allows you to specify a second colormap to be +made available at task startup. +.TP 5 +.B "-cmapDir1 \fIdir\fP" +User colormap directory 1. Specifies a directory to be searched for colormaps. +.TP 5 +.B "-cmapDir2 \fIdir\fP" +User colormap directory 2. Specifies a directory to be searched for colormaps. +By default this points to the system directory /usr/local/lib/imtoolcmap, +allowing a set of site default colormaps to be defined here. +.TP 5 +.B "-cmapInitialize \fIbool\fP" +Initialize the ximtool colormap at startup. When setting the \fIbasePixel\fP +option or resource this is required in order to force the Gterm widget to +update its global colormap resource in the X server. The default is +\fIfalse\fP. +.TP 5 +.B "-cmapName \fIname\fP" +Name used for private colormap. The default for all IRAF imaging +applications is \fIimage\fP. Gterm widget based imaging applications +which have the same value of cmapName will share the same colormap, +minimizing colormap flashing and allowing multiple applications to be +run at the same time. +.TP 5 +.B "-config \fIN\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-defgui" +Print the default GUI to the stdout. The GUI is a Tcl program that may be +customized by the user and reloaded using the \fI-gui\fP option or +the \fIgui\fP resource parameter. +.TP 5 +.B "-displayPanner \fIbool\fP" +Display panner marker window at startup. If set, a panner window showing +the full frame buffer will appear in the upper-right side of the main display +window. +.TP 5 +.B "-displayMagnifier \fIbool\fP" +Display magnifier marker window at startup. If set, a magnifier window showing +a zoomed section around the cursor will appear in the upper-left side of the +mail display window. +.TP 5 +.B "-displayCoords \fIbool\fP" +Display WCS coordinate marker window at startup. If set, a coordinate +readout text marker showing will appear in the lower-right side of the main +display window. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-gui \fIfile\fP" +Specifies the GUI file to be used. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-invert" +Start XImtool using inverted colormaps. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 5 +.B "-maxColors \fIN\fP" +Specify the max number of colors to be used for the display. +.TP 5 +.B "-memModel \fItype\fP" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are \fIfast\fP, \fIbeNiceToServer\fP, and \fIsmall\fP. The +default is \fIfast\fP, which uses server pixmaps to make frame blink fast. +This is recommended unless server memory is very limited. Note that even in +fast mode, the server pixmap is only the size of the display window, so memory +usage is reasonable even if the frame buffer is very large. +.TP 5 +.B "-nframes \fIN\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port \fIN\fP" +Specifies the port number to use when connecting through an inet socket. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-printConfig \fIname\fP" +Specifies the printer configuration file to use. By default this will be +/usr/local/lib/ximprint.cfg. See below for more information on configuring +output devices. +.TP 5 +.B "-tile" +The default display mode is to view one frame at a time. In tile frames mode, +2 or 4 frames may be viewed simultaneously in the display window. All the +usual operations (zoom and pan, colortable enhancement, cursor readback, etc.) +still work for each frame even when in tile frames mode. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "RESOURCES" +XImtool is implemented as a client program which is responsible for loading +the frame buffers/colormaps, communicating with clients, etc, and a +user-modifiable GUI file written as a Tcl script which handles all the user +interface details. The \fIclient resources\fP described below will be common +to any user-defined GUI, the \fIgui resources\fP may change depending on how +extensively the GUI has been modified by the user. Each of these components +has its own set of resources, but to the user setting them is the same as +with any other application. + +\fIGterm\fP widget resources (i.e. those for the main image window or +colorbar) may be set as either client or GUI resources. See the +\fIxgterm(1)\fP man page for a complete description of \fIGterm\fP widget +resources. + +.SS "CLIENT RESOURCES" +The client resources generally define the initial state of the application +or set configuration parameters. +.RS +.TP 25 +.B "Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 25 +defConfig +1 +.sp -0.5 +.TP 25 +defNFrames +0 +.sp -0.5 +.TP 25 +tileBorderWidth +3 +.sp -0.5 +.TP 25 +tileBorderColor +9 +.sp -0.5 +.TP 25 +autoscale +false +.sp -0.5 +.TP 25 +antialias +false +.sp -0.5 +.TP 25 +antialiasType +boxcar +.sp -0.5 +.TP 25 +tileFrames +false +.sp -0.5 +.TP 25 +highlightFrames +true +.sp -0.5 +.TP 25 +gui +default +.sp -0.5 +.TP 25 +imtoolrc +/usr/local/lib/imtoolrc +.sp -0.5 +.TP 25 +invert +false +.sp -0.5 +.TP 25 +memModel +fast +.sp -0.5 +.TP 25 +basePixel: +64 +.sp -0.5 +.TP 25 +maxColors: +216 +.sp -0.5 +.TP 25 +cmapInitialize: +false +.sp -0.5 +.TP 25 +cmap1 +none +.sp -0.5 +.TP 25 +cmap2 +none +.sp -0.5 +.TP 25 +cmapDir1 +none +.sp -0.5 +.TP 25 +cmapDir2 +/usr/local/lib/imtoolcmap +.sp -0.5 +.TP 25 +input_fifo +/dev/imt1i +.sp -0.5 +.TP 25 +output_fifo +/dev/imt1o +.sp -0.5 +.TP 25 +unixaddr +/tmp/.IMT%d +.sp -0.5 +.TP 25 +port +5137 +.RE +.LP +Description of ximtool client resources: + +.TP 18 +.B "defConfig" +Default frame buffer configuration number on startup. See below for more +information on frame buffers. +.TP 18 +.B "defNFrames" +Default number of frames on startup. Set to zero to use the value from +the frame buffer configuration (\fIimtoolrc\fP) file. +.TP 18 +.B "tileBorderWidth" +.sp -0.5 +.TP 18 +.B "tileBorderColor" +Used by the tile frames option. Specifies how far +apart to space the frames in tile frames mode. +Color "9" refers to the Gterm widget resource color9, +which is assigned a color with its own resource. +.TP 18 +.B "autoscale" +Enable/disable the autoscale option. +.TP 18 +.B "antialias" +Enable/disable the antialias option. +.TP 18 +.B "antialiasType" +Type of antialiasing. +.TP 18 +.B "tileFrames" +Enable/disable the tile frames option. +.TP 18 +.B "highlightFrames" +Determines whether the current frame is highlighted when in tile frames mode. +.TP 18 +.B "gui" +The GUI to be executed. "default" refers to the default, builtin ximtool GUI. +You can replace this with your own GUI file if you are bold enough, and +completely change the look and functionality of the GUI if desired. +.TP 18 +.B "imtoolrc" +Where to find the imtoolrc file. This defines the +recognized frame buffer configurations. +.TP 18 +.B "invert" +Start Ximtool using an inverted colormap. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 18 +.B "memModel" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are "fast", "beNiceToServer", and "small". The default is fast, +which uses server pixmaps to make frame blink fast. This is recommended +unless server memory is very limited. Note that even in fast mode, the server +pixmap is only the size of the display window, so memory usage is reasonable +even if the frame buffer is very large. +.sp -0.5 +.TP 18 +.B "basePixel" +.sp -0.5 +.TP 18 +.B "maxColors" +These two resources determine the region of colormap space used to +render image pixels. +.TP 18 +.B "cmapInitialize" +Initialize the ximtool colormap at startup. This is sometimes necessary to +clear a previous ximtool colormap allowing a new basePixel and maxColors to +take effect. +.TP 18 +.B "cmap1" +.sp -0.5 +.TP 18 +.B "cmap2" +User colormap files. The intent here is to allow individual colormaps to be +conveniently specified as a resource. +.TP 18 +.B "cmapDir1" +.sp -0.5 +.TP 18 +.B "cmapDir2" +User or system colormap directories. By default cmapDir2 points to the system +directory /usr/local/lib/imtoolcmap, allowing a set of site default colormaps +to be defined here. This leaves cmapDir1 available to a user colormap +directory. +.TP 18 +.B "input_fifo" +.sp -0.5 +.TP 18 +.B "output_fifo" +The input and output fifos for fifo i/o. "Input" and "output" are from the +client's point of view. Note that only one display server can use a +fifo-pair at one time. +.TP 18 +.B "unixaddr" +Template address for unix domain socket. The user must have write permission +on this directory, or the file must already exist. %d, if given, is +replaced by the user's UID. +.TP 18 +.B "port" +TCP/IP port for the server. Note that only one server can listen on a port +at one time, so if multiple ximtool servers are desired on the same +machine, they should be given different ports. + +.SS "GUI RESOURCES" + +In principle ximtool can have any number of different GUIs, each of which +defines its own set of resources. GUIs typically define a great many +resources, but most of these are not really intended for modification by +the user (although one can modify them if desired). + +The following are some of the more useful resources used by the default +ximtool GUI. The \fIimagewin\fR resources are Gterm widget resources. +.RS +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + .geometry: + +.sp -0.5 +.TP 35 + *controlShell.geometry: + +.sp -0.5 +.TP 35 + *info.geometry: +420x240 +.sp -0.5 +.TP 35 + *load_panel.geometry: + +.sp -0.5 +.TP 35 + *save_panel.geometry: + +.sp -0.5 +.TP 35 + *print_panel.geometry: + +.sp -0.5 +.TP 35 + *help_panel.geometry: + +.sp -0.5 +.TP 35 + *cmapName: +image +.sp -0.5 +.TP 35 + *basePixel: +64 +.sp -0.5 +.TP 35 + *imagewin.warpCursor: +true +.sp -0.5 +.TP 35 + *imagewin.raiseWindow: +true +.sp -0.5 +.TP 35 + *imagewin.deiconifyWindow: +true +.sp -0.5 +.TP 35 + *imagewin.ginmodeCursor: +circle +.sp -0.5 +.TP 35 + *imagewin.ginmodeBlinkInterval: +500 +.sp -0.5 +.TP 35 + *imagewin.color0: +black +.sp -0.5 +.TP 35 + *imagewin.color1: +white +.sp -0.5 +.TP 35 + *imagewin.color8: +#7c8498 +.sp -0.5 +.TP 35 + *imagewin.color9: +steelblue +.sp -0.5 +.TP 35 + *imagewin.width: +512 +.sp -0.5 +.TP 35 + *imagewin.height: +512 +.sp -0.5 +.TP 35 + *autoscale: +True +.sp -0.5 +.TP 35 + *zoomfactors: +1 2 4 8 +.sp -0.5 +.TP 35 + *displayCoords: +True +.sp -0.5 +.TP 35 + *displayPanner: +True +.sp -0.5 +.TP 35 + *displayMagnifier: +False +.sp -0.5 +.TP 35 + *blinkRate: +1.0 +.sp -0.5 +.TP 35 + *pannerArea: +150*150 +.sp -0.5 +.TP 35 + *pannerGeom: +-5+5 +.sp -0.5 +.TP 35 + *magnifierArea: +100*100 +.sp -0.5 +.TP 35 + *magnifierGeom: ++5+5 +.sp -0.5 +.TP 35 + *wcsboxGeom: +-5-5 +.sp -0.5 +.TP 35 + *maxContrast: +5.0 +.sp -0.5 +.TP 35 + *warnings: +True +.RE +.LP +Description of selected resources: + +.TP 22 +.B ".geometry" +Geometry of main image window. +.TP 22 +.B "*controlShell.geometry" +Geometry of control panel shell. +.TP 22 +.B "*info.geometry" +Geometry of info box. +.TP 22 +.B "*load_panel.geometry" +Geometry of file load panel. +.TP 22 +.B "*save_panel.geometry" +Geometry of save control panel. +.TP 22 +.B "*print_panel.geometry" +Geometry of print control panel. +.TP 22 +.B "*help_panel.geometry" +Geometry of help box. +.TP 22 +.B "*cmapName" +Name used for private colormap. The default for all IRAF imaging applications +is "image". Gterm widget based imaging applications which have the same value +of cmapName will share the same colormap, minimizing colormap flashing and +allowing multiple applications to be run at the same time. +.TP 22 +.B "*basePixel" +The base colormap cell used by the display colormap. +.TP 22 +.B "*imagewin.warpCursor" +Warp pointer into image window when initiating a cursor read. +.TP 22 +.B "*imagewin.raiseWindow" +Raise image window when initiating a cursor read. +.TP 22 +.B "*imagewin.deiconifyWindow" +Deiconify image window if necessary when initiating a cursor read. +.TP 22 +.B "*imagewin.ginmodeCursor" +Type of cursor when a cursor read is in progress. The default is a +circle. Any selection from the X cursor font can be used. A special +case is "full_crosshair" which is the full crosshair cursor of the +Gterm widget. +.TP 22 +.B "*imagewin.ginmodeBlinkInterval" +Determines whether the cursor blinks when a cursor read is in progress. +The value is given in milliseconds. +.TP 22 +.B "*imagewin.color0" +Background color. +.TP 22 +.B "*imagewin.color1" +Foreground color. +.TP 22 +.B "*imagewin.color8" +Color assigned the panner window. +.TP 22 +.B "*imagewin.color9" +Color used for the tileFrames highlight. +.TP 22 +.B "*imagewin.width" +Width of the main image window. +.TP 22 +.B "*imagewin.height" +Height of the main image window. +.TP 22 +.B "*pannerArea" +Area in pixels of the panner window. +.TP 22 +.B "*pannerGeom" +Where to place the panner window. +.TP 22 +.B "*magnifierArea" +Area in pixels of the magnifier window. +.TP 22 +.B "*magnifierGeom" +Where to place the magnifier window. +.TP 22 +.B "*wcsboxGeom" +Where to place the coords box. +.TP 22 +.B "*maxContrast" +Maximum contrast value. + +.sp +.SH DESCRIPTION +.LP +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept client connections +simultaneously on fifo pipes, unix domain sockets, or inet sockets. A +display client like the IRAF \fIDISPLAY\fP task makes a connection and sends +the image across using an IIS protocol. Once the image is loaded in the +display buffer it may be enhanced, saved to a disk file in a number of +different formats, or printed as Encapsulated Postscript to a printer or +disk file. Up to four frame buffers are allowed, these may be displayed +simultaneously in a tiled mode, or blinked frame-to-frame. Each frame may +have its own colormap or brightness/contrast enhancement. Pan/Zoom and +cursor readout are permitted using \fImarkers\fP, on-line help is also +available. + +When run in standalone mode, images (currently IRAF OIF, GIF, Sun Rasterfiles +or simple FITS formats are permitted) may be loaded on the command line or by +using the Load Panel. This allows you to browse images and perform the same +manipulations as if they had been displayed by a client. + +.SS "MOUSE OPERATIONS" + +Clicking and dragging MB1 (mouse button 1) in the main image window creates +a rectangular region marker, used to select a region of the image. If you do +this accidentally and don't want the marker, put the pointer in the marker +and type DELETE or BACKSPACE to delete the marker. With the pointer in the +marker, MB3 will call up a marker menu listing some things you can do with +the marker, like zoom the outlined region. MB1 can be used to drag or resize +the marker. See below for more information on markers. + +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. + +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the +display. + +.SS "KEYSTROKE ACCELERATORS" + +The following keystrokes are currently defined in the GUI: + +.TP 12 +.B "Ctrl-b" +Backward frame +.sp -0.5 +.TP 12 +.B "Ctrl-c" +Center frame +.sp -0.5 +.TP 12 +.B "Ctrl-f" +Forward frame +.sp -0.5 +.TP 12 +.B "Ctrl-i" +Invert +.sp -0.5 +.B "Ctrl-m" +Toggle magnifier +.sp -0.5 +.TP 12 +.TP 12 +.B "Ctrl-n" +Normalize +.sp -0.5 +.TP 12 +.B "Ctrl-p" +Toggle panner +.sp -0.5 +.TP 12 +.B "Ctrl-r" +Register +.sp -0.5 +.TP 12 +.B "Ctrl-s" +Match LUT scaling +.sp -0.5 +.TP 12 +.B "Ctrl-t" +Tile frames toggle +.sp -0.5 +.TP 12 +.B "Ctrl-u" +Unzoom (zoom=1) +.sp -0.5 +.TP 12 +.B "Ctrl-x" +Flip X +.sp -0.5 +.TP 12 +.B "Ctrl-y" +Flip Y + +.TP 12 +.B "Alt-b" +Blink frames (toggle) +.sp -0.5 +.TP 12 +.B "Alt-c" +Control panel (toggle) +.sp -0.5 +.TP 12 +.B "Alt-h" +Help popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-i" +Info box popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-l" +Load file popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-p" +Print popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-s" +Save popup (toggle) +.sp -0.5 +.TP 12 +.B "Alt-t" +TclShell popup (toggle) + +.TP 12 +.B "Ctrl-Alt-q" +Quit +.sp -0.5 +.TP 12 +.B "Ctrl-Alt-f" +Fitframe + +.TP 12 +.B "Ctrl-=" +Print using current setup +.sp -0.5 +.TP 12 +.B "Ctrl-<" +Decrease blink rate (blink faster) +.sp -0.5 +.TP 12 +.B "Ctrl->" +Increase blink rate (blink slower) +.sp -0.5 +.TP 12 +.B "Ctrl-+" +Zoom in +.sp -0.5 +.TP 12 +.B "Ctrl--" +Zoom out + +.TP 12 +.B "Ctrl-[hjkl] or <arrow_key>" +Move cursor one pixel in each direction +.sp -0.5 +.TP 12 +.B "Ctrl-Shift-[hjkl] or Shift-<arrow_key>" +Move cursor ten pixels in each direction +.sp -0.5 +.TP 12 +.B "Ctrl-<arrow_key>" +Move panner one full width in each direction +.sp -0.5 +.TP 12 +.B "Ctrl-Alt-<arrow_key>" +Move panner one half width in each direction +.sp -0.5 +.TP 12 +.B "Alt-1 thru Alt-4" +Set frame displayed +.sp -0.5 +.TP 12 +.B "Ctrl-1 thru Ctrl-9" +Set integer zoom factor + +.LP +\fBNOTE:\fP These keystrokes only work with the cursor in the main image window, +not on the subwindows or in markers since they are implemented as +\fIimagewin\fP translations. If a command does not work, check the cursor +location. + +.SH "CLIENT CONNECTIONS" +.LP +XImtool allows clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument or \fI*fifo\fP resource. Values should +be specified as the root pathname to a pair of fifo pipes whose last +character is 'i' or 'o', these characters will be added automatically when +opening the pipes. For example, to use the default pipes the path would +be specified as simply "/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch or +a \fI*port\fP resource. This permits connecting to the server +over a remote network connection anywhere on the Internet. +A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch or the \fI*unixaddr\fR resource. Legal values +should be specified as a filename to be used for the socket, up to two "%d" +fields are allowed and will be replaced by the userid. An empty string value +disables this connection. +.LP +By default ximtool listens simultaneously for client connections on all three +types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + +.SS "COMMUNICATIONS PROTOCOL" + +Clients communicate with XImtool using a protocol developed originally for +IIS (International Imaging Systems) Frame Buffer hardware, the so-called +"IIS protocol"; other more modern protocols will likely be supported in the +future. The IIS protocol is basically a command packet stream with a header +describing the operation to be performed (select frame, load display, read +cursor, etc), and an optional data packet containing e.g. pixels. It is beyond +the scope of this document to describe fully the details of the protocol; +interested users should contact \fIiraf@noao.edu\fP for further information. + +.SH "FRAME BUFFERS" + +XImtool starts up using default frame buffer size of 512x512 pixels, two +(of four possible) frames will be created. When loading +disk images (i.e. run in standalone mode) the frame buffer configuration file +will be searched for a defined frame buffer that is the same size or larger +than the current image, if no suitable buffer can be found a custom frame +buffer the same size as the image will be created in an unused portion of +the configuration table. When used as a display server the frame buffer +configuration number is passed in by the client and loaded explicitly even +if it means clipping the image. If a new frame buffer is +a different size than previously defined frames, all available frames +will be initialized and cleared prior to the display. The default frame buffer +configuration file is /usr/local/lib/imtoolrc, +this can be overridden by defining a IMTOOLRC environment variable naming +the file to be used, by creating a .imtoolrc file in your home directory, or +a new file may be specified using the \fI-imtoolrc\fR command line flag or +\fIimtoolrc\fR application resource. + +The format of the frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 4 frames, configuration numbers need not be sequential. + +\fBNOTE:\fR When defining a new frame buffer for use with client software +such as IRAF the user must also remember to define those frame buffers in +the IRAF \fIdev$graphcap\fR file. + +.SH "MARKERS" + +Although ximtool doesn't do much with markers currently, they are a general +feature of the \fIGterm\fP widget and are used more extensively in other +programs (e.g. the prototype IRAF science GUI applications). XImtool uses +markers for the marker zoom feature discussed above, and also for the panner, +magnifier and the coordinates box. All markers share some of the same +characteristics, so it is worthwhile learning basic marker manipulation +keystrokes. +.TP 3 +\fBo\fP +MB1 anywhere inside a marker may be used to drag the marker. +.TP 3 +\fBo\fP +MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +.TP 3 +\fBo\fP +Shift-MB1 on the corner of most markers will rotate the marker. +.TP 3 +\fBo\fP +Markers stack, if you have several markers and you put one on top of +the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +.TP 3 +\fBo\fP +MB2 in the body of a marker "lowers" the marker, i.e. moves it to the +bottom of the stacking order. +.TP 3 +\fBo\fP +Delete or backspace in a marker deletes it. +.TP 3 +\fBo\fP +Markers have their own translation resources and so the default +keystroke commands will not be recognized when the cursor is in a marker. +.LP +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back if you delete it, or you can reset the toggle in +the control panel). + +.SS "PANNER MARKER" + +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. + +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned below apply to these markers as well, e.g. you can use MB1 to +reposition on the panner window within the main image display window, or to +drag the region marker within the panner (pan the image). Resizing the +region marker zooms the image; this is a non-aspect constrained zoom. The +panner window itself can be resized by dragging a corner with MB1. Typing +delete or backspace anywhere in the panner window deletes the panner. + +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to hitting MB2 in the main display +window to pan the image. + +The panner marker can be disabled by defining the \fIdisplayPanner\fP +GUI resource, its size and location can be controlled using the +\fIpannerArea\fP and \fIpannerGeom\fP GUI resources respectively. + +.SS "MAGNIFIER MARKER" + +The magnifier marker can be used to zoom in on a small area around the cursor. +It will be updated as the cursor moves but only for small motions (either +mouse movement or with the cursor movement keystrokes) to minimize the +impact on the system. The zoom factor is expressed as some fraction of the +size of the magnifier marker itself. The default zoom is 4, i.e. the area +in the marker represents and area in the image that's one-fourth the size +of the marker. Other zoom factors may be selected using the popup menu +created by hitting MB1 in the marker. + +By default the magnifier marker is not visible, to toggle it select the +\fIMagnifier\fR option from the \fIOptions\fR menubar button. Alternatively, +for just a quick look holding down the Shift and MB1 buttons will display +the marker until the button is released. + +The magnifier marker can be disabled by defining the \fIdisplayMagnifier\fP +GUI resource, its size and location can be controlled using the +\fImagnifierArea\fP and \fImagnifierGeom\fP GUI resources respectively. + +.SS "COORDS BOX MARKER" + +XImtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +linear client-defined coordinate system. The coords box feature is used to +display these world coordinates as the pointer is moved about in the image +window. + +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated a +"+" will be displayed after the intensity value. + +The coords box is a text marker, it can be moved and resized +with the pointer like any other marker. The coords box marker can be +disabled by defining the \fIdisplayCoords\fP GUI resource, its location +can be controlled by the \fIwcsboxGeom\fP GUI resource. + +.SS "MARKER MENU OPTIONS" + +Except for the panner and WCS markers, MB3 (mouse button 3) calls up the +marker menu providing a limited set of functions common to all markers: +.TP 3 +\fBo +Zoom\fP does an equal aspect zoom of the region outlined by the marker. In +this way you can mark a region of the image and zoom it up. +.TP 3 +\fBo +Fill\fP exactly zooms the area outlined by the marker, making it fill the +display window. Since the marker is not likely to be exactly square, +the aspect ratio of the resultant image will not be unitary. +.TP 3 +\fBo +Print\fP prints the region outlined by the marker to the printer or file +currently configured by the Print Panel. +.TP 3 +\fBo +Save\fP saves the region outlined by the marker to the file currently +configured by the Save Panel. +.TP 3 +\fBo +Info\fP prints a description of the marked region. The text is printed in +the Info Panel. +.TP 3 +\fBo +Unrotate\fP unrotates a rotated marker. +.TP 3 +\fBo +Color\fP is a menu of possible marker colors. +.TP 3 +\fBo +Type\fP is a menu of possible marker types. This is still a little buggy +and it isn't very useful, but you can use it to play with different +types of markers. +.TP 3 +\fBo +Destroy\fP destroys the marker. You can also hit the delete or backspace +key in a marker to destroy the marker. + +.SH "CONTROL PANEL" + +XImtool has a control panel which can be used to exercise most of the +capabilities the program has for image display. The control panel can be +accessed either via the \fBOptions\fP menu from the main window menubar, or by +pressing the leftmost button in the row of buttons at the upper right side +of the display. + +.SS "VIEW CONTROLS" + +The \fBFrame box\fP will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 4) will be created +automatically if requested by the client. The number of frame buffers +created at startup can be controlled using the \fI-nframes\fP command-line +switch or the \fIdefNFrames\fP resource. + +The \fBtext display\fP window gives the field X,Y center, X,Y scale factors, +and the X,Y zoom factors. The scale factor and the zoom factor will be the same +unless \fIautoscale\fP is enabled. The scale is in units of display pixels per +frame buffer pixel, and is an absolute measure (it doesn't matter whether or +not autoscale is enabled). Zoom is relative to the autoscale factor, which +is 1.0 if autoscaling is disabled. This information is also presented in the +Info panel. + +The numbers in the \fBZoom box\fP are zoom factors. Blue numbers zoom, red +numbers dezoom. \fIZoom In\fP and \fIZoom Out\fP may be used to go to larger +or smaller zoom factors, e.g. "Ctrl-5" followed by "Zoom In" will get you to +zoom factor 10. Specific zoom factors may also be accessed directly as Control +keystrokes, e.g. Ctrl-5 will set zoom factor 5. \fICenter\fP centers the field. +\fIToggle Zoom\fP toggles between the current zoom/center values, and the +unzoomed image. + +\fIAspect\fP recomputes the view so that the aspect ratio is 1.0. Aspect also +integerizes the zoom factor (use the version in the View menu if you don't +want integerization). + +\fIFit Frame\fP makes the display window the same size as the frame buffer. Note +that autoscale has much the same effect, and allows you to resize the +display window to any size you want, or view images too large to fit on the +screen. + +.SS "ENHANCEMENT CONTROLS" + +At the top is a scrolled list of all the available colormaps. Click on the +one you want to load. You can add your own colormaps to this list by +defining the \fIcmap[12]\fP or \fIcmapDir[12]\fP command line flags or +application resources. + +The two sliders adjust the contrast (upper slider) and brightness (lower +slider) of the display. The \fIInvert\fP button inverts the colormap (multiples +the contrast by -1.0). Note that due to the use of the private colormap the +sliders are a bit sluggish when dragged to window the display. If this is +annoying, using MB3 in the display window is faster. + +The \fINormalize\fP button (on the bottom of the control panel) will normalize +the enhancement, i.e. set the contrast and brightness to the default one-to-one +values (1.0, 0.5). This is the preferred setting for many of the pseudocolor +colortables and for private colormaps loaded from disk images. The +\fIInitialize\fP button does a reset of the server. + +.SS "BLINK CONTROLS" + +\fIBlink frames\fP is the list of frames to be blinked. When blink mode is +in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered +in the list more than once. To program an arbitrary list of blink +frames, hit the Reset button and click on each blink frame button until +it is set to the desired frame number. + +The \fIBlink Rate\fP can be adjusted as slow or as fast as you want using the +arrow buttons. If you set the blink rate small enough it will go to +zero, enabling single step mode (see below). + +The \fIRegister\fP button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. + +The \fIMatch LUTs\fP button sets the enhancement of all blink frames to the +same values as the display frame. Frames not in the blink list are not affected. + +The \fIBlink\fP button turns blink on and off. When the blink rate is set to +zero the Blink button will single step through the blink frames, one +frame per button press. + +\fBNOTE:\fP You can blink no matter what ximtool options are in effect, but +many of these will slow blink down. To get the fastest blink you may want to +turn off the panner and coords box, and match the LUTs of all the blink frames. +All the ximtool controls are fully active during blink mode, plus you can +load frames etc. + +.SS "OPTIONS:" +.TP 5 +.B "Panner" +Toggles whether to display the panner marker. +.TP 5 +.B "Coords Box" +Toggles whether to display the coordinate box marker. +.TP 5 +.B "Autoscale" +If autoscale is enabled then at zoom=1, the frame buffer will be +automatically scaled to fit within the display window. With autoscale +disabled (the default), the image scale is more predictable, but the +image may be clipped by the display window, or may not fill the display +window. +.TP 5 +.B "Antialiasing" +When dezooming an image, i.e., displaying a large image in a smaller +display window, antialiasing causes all the data to be used to compute +the displayed image. If antialiasing is disabled then image is +subsampled to compute the displayed image. Antialiasing can prevent +subsampling from omitting image features that don't fall in the sample +grid, but it is significantly slower than dezooming via subsampling. +The default is no antialising. +.TP 5 +.B "Tile Frames" +The default display mode is to view one frame at a time. In tile frames +mode, 2 or 4 frames may be viewed simultaneously in the display window. +All the usual operations (zoom and pan, colortable enhancement, cursor +readback, etc.) still work for each frame even when in tile frames mode. +.TP 5 +.B "Warnings" +The warnings options toggles whether you see warning dialog boxes in +situations like overwriting an existing file, clearing the frame +buffer, etc. + +.SH "COLORMAP SELECTION" + +By default XImtool will display images using either a grayscale colormap (e.g. +if loaded by a client), or a private colormap when loading an image from disk +that contains a colormap. Each frame defines its own colormap so you can +define different colormaps or enhancements for each frame, they will change +automatically as you cycle through the frames. + +.SS "BUILTIN COLORMAPS" + +Once loaded, the colormap may either be changed using the builtin colormap +menu under the View menu button on the main window, or from the Enhancement +box on the control panel. XImtool has about a dozen colormap options +builtin, other user-defined colormaps may optionally be loaded. It is not +presently possible to save colormaps for later use. + +.SS "USER-DEFINED COLORMAPS" + +The \fIcmap[12]\fP and \fIcmapDir[12]\fP resources (or command line arguments) +are used to tell which specific colormaps to make available or where to look +for colortables respectively. The colortables are loaded when ximtool starts +up, or when it is reinitialized (e.g. by pressing the Initialize button in +the control panel). XImtool will ignore any files in the colormap directory +which do not look like colortables. New colortables will also be added +automatically for each image loaded from disk. + +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, and +blue values scaled to the range 0.0 (off) to 1.0 (full intensity). + + R G B + R G B + (etc.) + +Blank and comment lines (lines beginning with a '#') are ignored. + +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. XImtool will interpolate the table as necessary to +compute the colortable values used in XImtool. XImtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. + +The name of the colortable as it will appear in the XImtool control panel is +the root name of the file, e.g., if the file is "rainbow.lut" the colortable +name will be "rainbow". Lower case names are suggested to avoid name +collisions with the builtin colortables. Private colormaps for disk images +will be have the same name as the image loaded. If the same colortable file +appears in multiple user colortable directories, the first one found will be +used. + +.SS "MINIMIZING COLORMAP CONFLICTS" + +The Gterm widget used by XImtool (i.e. the main display window) uses a private +global colormap for display, this allows it to have greater control over color +cell allocation but can occasionally also cause "colormap flashing" as the +mouse is moved in and out of the application. The problem here is that +in a system with only an 8-bit colormap (256 colors) all applications must +compete for colors, programs such as XV or Netscape allocate colors from the +default colormap leaving only a few free cells for XImtool. Since XImtool +defines a private global colormap it is still able to allocate the needed +cells rather than failing, but it's allocating cells already used by other +applications. As the mouse moves out of the ximtool window those cells are +once again defined in terms of the default colormap, so the ximtool window +is then using a different colormap. It is this switching of the colormap +context that causes the flashing to occur, but there are a few things that +can be done to help minimize this. + +XImtool logically defines 200 colors which the client image display program +can use to render pixels. However, ximtool may or may not actually allocate +all of those colors. By default it currently allocates only about 192 +colors, to reserve 64 colors for the other windows on the screen. You don't +normally notice this as 1) usually the default screen colormap has enough +free cells to allow ximtool to match the colors, and 2) the extra unallocated +cells correspond to the brightest pixels in the rendered image, and these +colors may not be used or usually only correspond to a few small regions +near the saturated cores of bright objects. + +You can eliminate this problem by setting the \fIbasePixel\fP resource to e.g. +48 instead of 64, which will let the gterm widget allocate all 200 colors. +However, this isn't recommended for normal use as it will increase the +likelihood of colormap flashing. If you change \fIbasePixel\fP, either restart +the X server or set the resource \fIcmapInitialize\fP=\fITrue\fP to force the +gterm widget to update its global colormap resource in the X server. +The colormap resource may also be deleted by using the command + + \fIxprop -root -remove GT_image\fP + +These options may also be set on the command line when first starting up. + +In general one can set the Gterm widget resources \fIbasePixel\fP +and \fImaxColors\fP to specify the region of colormap space to be used for +image display. If you set \fImaxColors\fP to a small value, the 200 logical +colors defined by the widget will be mapped by the imtool color model into +whatever number of colors are actually available to the widget. For example, +in the default setup, 200 color values are really being mapped into 192 color +cells used for display, the remaining colors are used for buttons, menus etc +and are allocated from the default colormap by the X toolkit when the +application starts up. + +Even though the Gterm widget uses a private colormap, it is a private +\fIglobal\fP colormap meaning that all Gterm widgets share the same colormap. +An example of colormap sharing in ximtool is the main image window and the +colorbar window. These are two separate gterm widgets that share the same +colormap. They have to share the same colormap, as otherwise when you +windowed the main image window the colorbar window would not accurately +reflect the modified colormap. By default two separate ximtools would also +share the same colormap meaning contrast enhancements in one window would +affect the other. By resetting the \fIcmapName\fP command line option or +resource you can change the name of the private colormap used causing +separate ximtools to use different colormaps, but note this also creates +colormap flashing between the two windows that cannot easily be avoided. +By setting the \fIcmapName\fR to "default" the widget will allocate colors +from the default colormap, but this is of little use at the moment. + +There are a number of other resources that can be used to modify the behavior +of the Gterm widget color management scheme, but these are the most useful ones. +For question and further information feel free to contact \fIiraf@noao.edu\fP. + +.SH "LOAD PANEL" + +The Load Panel allows you load images from disk directly to the frame +buffer, this is analogous to loading an image on the command line except +that browsing is possible. At present recognized formats include IRAF OIF +format (i.e. \fI.imh\fP extension), simple FITS files, GIF, and Sun rasterfiles. +The task will automatically sense the format of the image and load it +appropriately. Images with private colormaps (such as GIF) will be loaded +using the private colormap (meaning that changing the brightness/contrast +enhancements will render a random-colored image), all others will be loaded +with a grayscale colormap. If the \fIGrayscale\fP button is enabled the image +colormap will be converted to grayscale and loaded as the standard grayscale +colormap. The Load panel will close automatically once the image has loaded +unless the \fIBrowse\fP button has been set. + +When loading new images the frame buffer configuration table will +be searched for a frame buffer that is the same size or larger than the new +image size, if no frame buffer can be found a custom buffer exactly the size +of the image will be created. This means that the image may not fill the +display window when loaded, or you may see a subsection of the image in the +main display window. Setting the \fIautoscale\fP option will scale the entire +image to fit the main display window, the full frame buffer will always be +visible in the Panner marker window. + +Images with more colors than can be displayed will automatically be +quantized to the number of available colors before display, 24-bit formats +are not currently supported (but may be in the future and will be similarly +quantized). + +Formats which permit larger than 8-bit pixels will be sampled on a grid +to determine an optimal range in the data to be used to compute a linear +transformation to the number of display colors. This is the same sampling +and transformation used by the IRAF \fIDISPLAY\fR task when computing the +\fIz1/z2\fP values and provides a much better initial display than simple +truncation to 8-bits. +.TP 5 +.B "Directory Browsing" +The load panel contains a list of files in the current directory that +may be selected for loading by selecting with left mouse button. If the +file is a directory the contents of the new directory will be loaded, +if it's a plain file an attempt will be made to load it as an image +otherwise an error popup will appear. Directories in the list are identified +with a trailing '/' character, you will always see any subdirectories +listed even if a filter is specified. + +The \fIRoot\fP button will reset the current directory to the system root +directory. The \fIHome\fP button will reset the current directory to the +user's login directory, the \fIUp\fP button moves up one directory level, and +\fIRescan\fP reloads the file list by rescanning the directory. The current +working directory is given below the file selection window. +.TP 5 +.B "File Patterns" +By default all files and directories will be listed. You may specify a +filter to e.g. select only those files with a given extension like +"*.fits" to list only files with a ".fits" extension. Directories will +always be seen in the list and are identified with a trailing '/' +character. Any valid unix pattern matching string will be recognized. +.TP 5 +.B "Direct File Load" +If you know exactly which file you wish to load, you may enter its +name in the \fILoad File\fP text box and either hit <cr> or the Load button +to load it. An absolute or relative path name may be given, if a simple +filename is specified it will be searched for in the current working directory. +.TP 5 +.B "Frame Selections" +By default images will be loaded into frame number 1, you may select a +different frame using the Frame menu button to cycle through the available +frames. + +.SH "SAVE PANEL" + +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, any general graphics +markers, or overlay graphics displayed by the client program). Presently, +only the contents of the main display window may be saved, there is no +facility for saving the undisplayed contents of the entire frame buffer +other than to enable the autoscale feature. A limited number of formats are +currently available, others will be added in future versions. +.TP 5 +.B "File Name" +The File Name text box allows you to enter the file name of the saved +file. A "%d" anywhere in the name will be replaced by a sequence number +allowing multiple frames to be saved with unique names. +.TP 5 +.B "Format" +The Format box allows you to choose the format of the image to be +created. Not all formats are currently implemented. +.TP 5 +.B "Color" +The Color box lets you choose the color type of the image to be +created. The options will change depending on the format, e.g. FITS +doesn't allow color so no color options will be allowed. Formats which +allow 24-bit images will be written using the current colormap after +converting to a 24-bit image, pseudocolor images will be written with +the current colormap. + +.SH "PRINT PANEL" + +The Print Panel allows you dump the contents of the main display window as +Encapsulated Postscript to either a named printer device or to a disk file. +The \fIPrint To\fP selects the type of output, the \fIPrint Command\fP box +will adjust accordingly, either as a Unix printer command or as a file name. +A "%d" anywhere in the name for disk output will be replaced by a sequence +number allowing multiple frames to be saved with unique names. Selecting +printers from the installed list will automatically change the command to be +used to generate the output. This command does not necessarily need to be a +printer command, the printer configuration file lets you define any command +string to process the image. + +.SS "COLOR OPTIONS" + +The Color box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap +and enhancements. + +.SS "POSTSCRIPT OPTIONS" + +.TP 5 +.B "Orientation" +Set the page orientation. +.TP 5 +.B "Paper Size" +Select the paper size to be used. +.TP 5 +.B "Image Scale" +Set the scale factor used to compute the final image size. No checking is +done to make sure the image will fit correctly on the page. + +.SS "PROCESSING OPTIONS" +.TP 5 +.B "Auto Scale" +Toggles whether or not the image is automatically scaled +to fit the page. If not enabled, the image scale will be used to +determine the output image size, otherwise the image will be scaled down +(if necessary) to fit on the page. +.TP 5 +.B "Auto Rotate" +Determines whether or not the image will be rotated to fit +on the page. When set, an image larger than the current orientation +will be rotated and possibly scaled to fit the page, otherwise the image +may be scaled so that it fits in the current orientation. +.TP 5 +.B "Max Aspect" +Automatically increases the scale so the image fills the page in the current +orientation. +.TP 5 +.B "Annotate" +The annotate option toggles whether or not the final file includes +annotation such as the image title, a colorbar, and axis labels. There is +currently no option for partial annotation. + +.SS "PRINTER SELECTION" + +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the \fI-printConfig\fP command line switch or \fIprintConfig\fP +resource. The format of the file is simply + + \fIname\\tcommand\fP + +The \fIname\fP value is what appears in the selection list and may be more +than a single word, the \fIcommand\fP can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command +will be a simple \fIlpr -Pfoo\fP or some such, but can also include converters +or previewers. At most 128 printer commands may be used. + +.SS "ANNOTATION OPTIONS" + +.TP 5 +.B "Annotate" +Selects whether Postscript image is to be annotated. +.B "Title" +Annotate with a title on the top of the image. +.B "Borders" +Annotate with borders surrounding the image giving image coordinates. +.B "Colorbar" +Annotate with colorbar at the bottom of the image +.B "Title String" +Title string to use when \fItitle\fR is selected. The special value +\fIimtitle\fR will force the title to be the currently displayed image title, +otherwise it will be this user-selected field. + + +.SH "INFO PANEL" + +The information panel is underused at present but is meant to provide basic +information about the frame being displayed. It is updated to be current +while changing enhancements, pan/zoom regions, or frame selection. In cases +where the image title string is truncated in the main display window, the +user can always pop up the info window to see the full title. + +.SH "TCLSHELL" + +The \fITclShell\fP allows the user to type commands directly to the TCL +interpreter, letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. It is used as a +development or debugging tool for the GUI, but for an example of what it +does, bring it up and type a command such as + + \fIsend helpButton set background red\fP + + +.SH ENVIRONMENT +DISPLAY specifies which display terminal to use +.br +IMTOOLRC frame buffer configuration file +.br +imtoolrc frame buffer configuration file (alternative) + +.SH FILES +/usr/local/lib/imtoolrc default frame buffer configuration file +.br +/usr/local/lib/ximprint.cfg default printer configuration file +.br +/usr/local/lib/imtoolcmap default colormap directory +.br +/dev/imt1i default input fifo +.br +/dev/imt1o default output fifo +.br +/tmp/.IMT%d default unix socket + +.SH BUGS + +.SH SEE ALSO +xgterm(1), xtapemon(1) + +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/ximtool/OLD/ximtool-mag.ps b/vendor/x11iraf/ximtool/OLD/ximtool-mag.ps new file mode 100644 index 00000000..aa974a41 --- /dev/null +++ b/vendor/x11iraf/ximtool/OLD/ximtool-mag.ps @@ -0,0 +1,10025 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Wed Sep 10 10:17:53 1997 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/Y{/Symbol FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(ximtool-mag)S +1807(\261)S +1887(interactive)S +2338(image)S +2612(display)S +2931(program)S +3299(for)S +3445(the)S +3597(X)S +3699(Window)S +4073(System)S +4398(with)S +4606(experimental)S +5157(GUI)S +1248 V +9 B +900(SYNOPSIS)S +1368 V +10 B +1260(ximtool-mag)S +1828([\261)S +10 I +1911(toolkitoption)S +10 B +2453(...])S +2591([)S +10 I +2654(options)S +10 B +2979(...])S +1536 V +9 B +900(OPTIONS)S +1656 V +10 B +1260(-basePixel)S +10 I +1723(N)S +1776 V +10 R +1510(The)S +1709(base)S +1930(colormap)S +2351(cell)S +2539(used)S +2766(by)S +2910(the)S +3076(colormap.)S +3552(This)S +3774(essentially)S +4240(allows)S +4545(you)S +4739(to)S +4861(reserve)S +10 I +5192(basePixel)S +1896 V +10 R +1510(colors)S +1793(in)S +1910(the)S +2071(global)S +2360(colormap)S +2776(for)S +2931(other)S +3175(applications.)S +3752(The)S +3946(default)S +4262(is)S +4367(64,)S +4530(if)S +4629(changed)S +4999(you'll)S +5276(need)S +5502(to)S +2016 V +1510(also)S +1701(specify)S +2019(the)S +10 I +2171(-cmapInitialize)S +10 R +2806(option)S +3092(or)S +3205(resource.)S +2184 V +10 B +1260(-cmap1)S +10 I +1606(\256le)S +2304 V +10 R +1510(User)S +1728(colormap)S +2135(1.)S +2270(This)S +2478(\257ag)S +2658(allows)S +2949(you)S +3129(to)S +3237(specify)S +3555(a)S +3629(colormap)S +4036(to)S +4144(be)S +4268(made)S +4514(available)S +4904(at)S +5006(task)S +5197(startup.)S +2472 V +10 B +1260(-cmap2)S +10 I +1606(\256le)S +2592 V +10 R +1510(User)S +1734(colormap)S +2147(2.)S +2288(This)S +2502(\257ag)S +2688(allows)S +2985(you)S +3171(to)S +3285(specify)S +3609(a)S +3689(second)S +4002(colormap)S +4415(to)S +4529(be)S +4660(made)S +4913(available)S +5310(at)S +5419(task)S +2712 V +1510(startup.)S +2880 V +10 B +1260(-cmapDir1)S +10 I +1750(dir)S +3000 V +10 R +1510(User)S +1728(colormap)S +2135(directory)S +2525(1.)S +2660(Speci\256es)S +3051(a)S +3125(directory)S +3515(to)S +3623(be)S +3747(searched)S +4125(for)S +4271(colormaps.)S +3168 V +10 B +1260(-cmapDir2)S +10 I +1750(dir)S +3288 V +10 R +1510(User)S +1742(colormap)S +2164(directory)S +2569(2.)S +2719(Speci\256es)S +3125(a)S +3214(directory)S +3619(to)S +3742(be)S +3881(searched)S +4274(for)S +4435(colormaps.)S +4951(By)S +5113(default)S +5435(this)S +3408 V +1510(points)S +1790(to)S +1903(the)S +2060(system)S +2373(directory)S +2768(/usr/local/lib/imtoolcmap,)S +3840(allowing)S +4225(a)S +4304(set)S +4450(of)S +4568(site)S +4741(default)S +5052(colormaps)S +5502(to)S +3528 V +1510(be)S +1634(de\256ned)S +1958(here.)S +3696 V +10 B +1260(-cmapInitialize)S +10 I +1934(bool)S +3816 V +10 R +1510(Initialize)S +1908(the)S +2073(ximtool)S +2428(colormap)S +2848(at)S +2963(startup.)S +3333(When)S +3614(setting)S +3924(the)S +10 I +4089(basePixel)S +10 R +4520(option)S +4819(or)S +4945(resource)S +5325(this)S +5513(is)S +3936 V +1510(required)S +1876(in)S +1988(order)S +2232(to)S +2344(force)S +2582(the)S +2738(Gterm)S +3027(widget)S +3333(to)S +3445(update)S +3745(its)S +3874(global)S +4158(colormap)S +4569(resource)S +4940(in)S +5052(the)S +5207(X)S +5312(server.)S +4056 V +1510(The)S +1695(default)S +2002(is)S +10 I +2099(false)S +10 R +2288(.)S +4224 V +10 B +1260(-cmapName)S +10 I +1805(name)S +4344 V +10 R +1510(Name)S +1784(used)S +2003(for)S +2156(private)S +2470(colormap.)S +2939(The)S +3131(default)S +3445(for)S +3598(all)S +3735(IRAF)S +4000(imaging)S +4365(applications)S +4885(is)S +10 I +4989(image)S +10 R +5233(.)S +5325(Gterm)S +4464 V +1510(widget)S +1822(based)S +2089(imaging)S +2457(applications)S +2980(which)S +3264(have)S +3492(the)S +3654(same)S +3899(value)S +4155(of)S +4277(cmapName)S +4770(will)S +4965(share)S +5214(the)S +5375(same)S +4584 V +1510(colormap,)S +1950(minimizing)S +2450(colormap)S +2865(\257ashing)S +3220(and)S +3402(allowing)S +3790(multiple)S +4162(applications)S +4683(to)S +4799(be)S +4931(run)S +5103(at)S +5214(the)S +5375(same)S +4704 V +1510(time.)S +4872 V +10 B +1260(-con\256g)S +10 I +1579(N)S +4992 V +10 R +1510(Initial)S +1799(frame)S +2081(bu)S +2181 H + (f)show 10 -.5 mul h (f)show +10 R +2242(er)S +2369(con\256guration)S +2952(number.)S +3362(The)S +3567(default)S +3894(value)S +4160(is)S +4277(1,)S +4402(indicating)S +4852(a)S +4947(512x512)S +5348(frame)S +5112 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(er)S +1778(with)S +1986(2)S +2066(frames.)S +2422(See)S +2596(below)S +2870(for)S +3016(information)S +3518(on)S +3648(the)S +3800(frame)S +4062(bu)S +4162 H + (f)show 10 -.5 mul h (f)show +10 R +4223(ers.)S +5280 V +10 B +1260(-defgui)S +5400 V +10 R +1510(Print)S +1737(the)S +1892(default)S +2202(GUI)S +2412(to)S +2523(the)S +2678(stdout.)S +3011(The)S +3199(GUI)S +3409(is)S +3509(a)S +3586(Tcl)S +3752(program)S +4123(that)S +4306(may)S +4511(be)S +4638(customized)S +5126(by)S +5259(the)S +5414(user)S +5520 V +1510(and)S +1684(reloaded)S +2057(using)S +2304(the)S +10 I +2456(-gui)S +10 R +2647(option)S +2933(or)S +3046(the)S +10 I +3198(gui)S +10 R +3356(resource)S +3723(parameter.)S +5688 V +10 B +1260(-displayPanner)S +10 I +1941(bool)S +5808 V +10 R +1510(Display)S +1859(panner)S +2168(marker)S +2488(window)S +2848(at)S +2958(startup.)S +3323(If)S +3427(set,)S +3601(a)S +3683(panner)S +3993(window)S +4354(showing)S +4732(the)S +4893(full)S +5071(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +5928 V +1510(will)S +1696(appear)S +1991(in)S +2099(the)S +2251(upper-right)S +2730(side)S +2921(of)S +3034(the)S +3186(main)S +3416(display)S +3735(window.)S +6096 V +10 B +1260(-displayMagni\256er)S +10 I +2052(bool)S +6216 V +10 R +1510(Display)S +1852(magni\256er)S +2266(marker)S +2579(window)S +2932(at)S +3035(startup.)S +3393(If)S +3490(set,)S +3657(a)S +3733(magni\256er)S +4148(window)S +4502(showing)S +4873(a)S +4949(zoomed)S +5297(section)S +6336 V +1510(around)S +1817(the)S +1969(cursor)S +2248(will)S +2434(appear)S +2729(in)S +2837(the)S +2989(upper-left)S +3412(side)S +3603(of)S +3716(the)S +3868(mail)S +4076(display)S +4395(window.)S +6504 V +10 B +1260(-displayCoords)S +10 I +1941(bool)S +6624 V +10 R +1510(Display)S +1855(WCS)S +2106(coordinate)S +2561(marker)S +2877(window)S +3233(at)S +3339(startup.)S +3700(If)S +3800(set,)S +3970(a)S +4048(coordinate)S +4503(readout)S +4836(text)S +5020(marker)S +5336(show-)S +6744 V +1510(ing)S +1668(will)S +1854(appear)S +2149(in)S +2257(the)S +2409(lower-right)S +2888(side)S +3079(of)S +3192(the)S +3344(main)S +3574(display)S +3893(window.)S +6912 V +10 B +1260(-\256fo)S +10 I +1462(pipe)S +7032 V +10 R +1510(Speci\256es)S +1901(the)S +2053(name)S +2299(of)S +2412(the)S +2564(\256fo)S +2733(pipe)S +2936(to)S +3045(be)S +3170(used,)S +3409(the)S +10 I +3562(i)S +10 R +3621(and)S +10 I +3796(o)S +10 R +3877(su)S +3966 H + (f)show 10 -.5 mul h (\256)show +10 R +4050(xes)S +4214(will)S +4401(be)S +4526(added)S +4795(automatically.)S +5425(The)S +7152 V +1510(default)S +1817(pipe)S +2019(names)S +2304(will)S +2490(be)S +2614(/dev/imt1i)S +3056(\(input)S +3325(pipe\))S +3560(and)S +3734(/dev/imt1o)S +4198(\(output)S +4517(pipe\).)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(1)S +7920 V +EP +%%Page: 2 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(-\256fo_only)S +1080 V +10 R +1510(If)S +1615(set,)S +1790(only)S +2007(\256fo)S +2185(pipes)S +2435(will)S +2630(be)S +2763(used)S +2985(for)S +3140(communication)S +3801(with)S +4018(a)S +4101(client)S +4363(program,)S +4766(sockets)S +5100(will)S +5296(be)S +5430(dis-)S +1200 V +1510(abled.)S +1368 V +10 B +1260(-gui)S +10 I +1457(\256le)S +1488 V +10 R +1510(Speci\256es)S +1901(the)S +2053(GUI)S +2260(\256le)S +2418(to)S +2526(be)S +2650(used.)S +1656 V +10 B +1260(-help)S +10 R +1510(Print)S +1735(a)S +1809(summary)S +2211(of)S +2324(command)S +2748(line)S +2928(options)S +3253(to)S +3361(the)S +3513(screen.)S +1824 V +10 B +1260(-imtoolrc)S +10 I +1683(\256le)S +1944 V +10 R +1510(Speci\256es)S +1923(the)S +2097(frame)S +2381(bu)S +2481 H + (f)show 10 -.5 mul h (f)show +10 R +2542(er)S +2671(con\256guration)S +3257(\256le)S +3438(to)S +3569(be)S +3716(used.)S +4007(See)S +4204(below)S +4501(for)S +4670(information)S +5195(on)S +5348(frame)S +2064 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(ers.)S +2232 V +10 B +1260(-inet_only)S +2352 V +10 R +1510(If)S +1611(set,)S +1782(only)S +1995(inet)S +2180(sockets)S +2509(will)S +2700(be)S +2829(used)S +3047(for)S +3198(communication)S +3855(with)S +4068(a)S +4147(client)S +4404(program,)S +4802(\256fo)S +4976(pipes)S +5222(and)S +5402(unix)S +2472 V +1510(sockets)S +1834(will)S +2020(be)S +2144(disabled.)S +2640 V +10 B +1260(-invert)S +2760 V +10 R +1510(Start)S +1748(XImtool)S +2136(using)S +2402(inverted)S +2778(colormaps.)S +3298(When)S +3585(set,)S +3770(a)S +3863("normalized")S +4443(display)S +4781(will)S +4987(always)S +5314(be)S +5458(the)S +2880 V +1510(inverse)S +1828(of)S +1941(the)S +2093(selected)S +2444(colormap.)S +3048 V +10 B +1260(-maxColors)S +10 I +1789(N)S +3168 V +10 R +1510(Specify)S +1845(the)S +1997(max)S +2199(number)S +2534(of)S +2647(colors)S +2921(to)S +3029(be)S +3153(used)S +3366(for)S +3512(the)S +3664(display.)S +3336 V +10 B +1260(-memModel)S +10 I +1805(type)S +3456 V +10 R +1510(Determines)S +2003(how)S +2208(ximtool)S +2553(uses)S +2758(memory)S +3125(in)S +3237(the)S +3393(ximtool)S +3739(client)S +3995(and)S +4173(the)S +4329(X)S +4435(server.)S +4737(The)S +4926(options)S +5255(are)S +10 I +5410(fast)S +10 R +5555(,)S +3576 V +10 I +1510(beNiceToServer)S +10 R +2153(,)S +2220(and)S +10 I +2406(small)S +10 R +2623(.)S +2720(The)S +2917(default)S +3236(is)S +10 I +3345(fast)S +10 R +3490(,)S +3557(which)S +3843(uses)S +4057(server)S +4342(pixmaps)S +4723(to)S +4843(make)S +5101(frame)S +5374(blink)S +3696 V +1510(fast.)S +1742(This)S +1953(is)S +2053(recommended)S +2651(unless)S +2934(server)S +3210(memory)S +3576(is)S +3676(very)S +3886(limited.)S +4258(Note)S +4485(that)S +4668(even)S +4889(in)S +5000(fast)S +5177(mode,)S +5458(the)S +3816 V +1510(server)S +1792(pixmap)S +2131(is)S +2237(only)S +2454(the)S +2615(size)S +2808(of)S +2929(the)S +3089(display)S +3416(window,)S +3801(so)S +3928(memory)S +4299(usage)S +4564(is)S +4669(reasonable)S +5133(even)S +5359(if)S +5458(the)S +3936 V +1510(frame)S +1772(bu)S +1872 H + (f)show 10 -.5 mul h (f)show +10 R +1933(er)S +2040(is)S +2137(very)S +2344(large.)S +4104 V +10 B +1260(-nframes)S +10 I +1672(N)S +4224 V +10 R +1510(Speci\256es)S +1913(the)S +2077(number)S +2424(of)S +2549(frame)S +2823(bu)S +2923 H + (f)show 10 -.5 mul h (f)show +10 R +2984(ers)S +3142(to)S +3262(con\256gure)S +3681(at)S +3795(startup.)S +4164(By)S +4323(default)S +4642(there)S +4883(will)S +5081(be)S +5217(2)S +5309(frames)S +4344 V +1510(available,)S +1925(a)S +1999(maximum)S +2435(of)S +2548(4)S +2628(frames)S +2929(are)S +3080(allowed.)S +4512 V +10 B +1260(-port)S +10 I +1506(N)S +4632 V +10 R +1510(Speci\256es)S +1901(the)S +2053(port)S +2244(number)S +2579(to)S +2687(use)S +2850(when)S +3096(connecting)S +3564(through)S +3905(an)S +4029(inet)S +4209(socket.)S +4800 V +10 B +1260(-port_only)S +4920 V +10 R +1510(Same)S +1770(as)S +10 I +1891(-inet_only)S +10 R +2334(option.)S +2683(If)S +2787(set,)S +2961(only)S +3177(inet)S +3365(sockets)S +3697(will)S +3891(be)S +4023(used)S +4244(for)S +4398(communication)S +5058(with)S +5275(a)S +5358(client)S +5040 V +1510(program.)S +5208 V +10 B +1260(-printCon\256g)S +10 I +1824(name)S +5328 V +10 R +1510(Speci\256es)S +1916(the)S +2083(printer)S +2394(con\256guration)S +2973(\256le)S +3147(to)S +3271(use.)S +3505(By)S +3668(default)S +3991(this)S +4182(will)S +4384(be)S +4524(/usr/local/lib/ximprint.cfg.)S +5448 V +1510(See)S +1684(below)S +1958(for)S +2104(more)S +2339(information)S +2841(on)S +2971(con\256guring)S +3462(output)S +3748(devices.)S +5616 V +10 B +1260(-tile)S +10 R +1510(The)S +1695(default)S +2002(display)S +2321(mode)S +2573(is)S +2670(to)S +2778(view)S +3002(one)S +3177(frame)S +3440(at)S +3543(a)S +3618(time.)S +3852(In)S +3966(tile)S +4125(frames)S +4427(mode,)S +4705(2)S +4786(or)S +4900(4)S +4981(frames)S +5283(may)S +5486(be)S +5736 V +1510(viewed)S +1834(simultaneously)S +2476(in)S +2590(the)S +2748(display)S +3073(window.)S +3486(All)S +3650(the)S +3808(usual)S +4055(operations)S +4507(\(zoom)S +4798(and)S +4977(pan,)S +5181(colortable)S +5856 V +1510(enhancement,)S +2091(cursor)S +2370(readback,)S +2784(etc.\))S +3018(still)S +3199(work)S +3434(for)S +3580(each)S +3792(frame)S +4054(even)S +4272(when)S +4518(in)S +4626(tile)S +4784(frames)S +5085(mode.)S +6024 V +10 B +1260(-unix)S +10 I +1513(name)S +6144 V +10 R +1510(Speci\256es)S +1909(the)S +2069(unix)S +2285(domain)S +2623(socket)S +2916(name)S +3170(to)S +3286(use.)S +3512(A)S +3622("%d")S +3876(in)S +3993(the)S +4154(\256lename)S +4537(will)S +4732(be)S +4865(replaced)S +5241(with)S +5458(the)S +6264 V +1510(user)S +1706(id.)S +6432 V +10 B +1260(-unix_only)S +6552 V +10 R +1510(If)S +1607(set,)S +1774(only)S +1983(unix)S +2192(domain)S +2523(sockets)S +2848(will)S +3035(be)S +3160(used)S +3374(for)S +3521(communication)S +4174(with)S +4383(a)S +4458(client)S +4711(program,)S +5105(inet)S +5286(sockets)S +6672 V +1510(and)S +1684(\256fos)S +1892(will)S +2078(be)S +2202(disabled.)S +6960 V +9 B +900(RESOURCES)S +7080 V +10 R +1260(XImtool)S +1629(is)S +1726(implemented)S +2278(as)S +2391(a)S +2465(client)S +2717(program)S +3085(which)S +3359(is)S +3456(responsible)S +3941(for)S +4087(loading)S +4418(the)S +4571(frame)S +4834(bu)S +4934 H + (f)show 10 -.5 mul h (f)show +10 R +4995(ers/colormaps,)S +7200 V +1260(communicating)S +1917(with)S +2130(clients,)S +2451(etc,)S +2627(and)S +2806(a)S +2885(user-modi\256able)S +3547(GUI)S +3759(\256le)S +3922(written)S +4240(as)S +4358(a)S +4437(Tcl)S +4605(script)S +4862(which)S +5141(handles)S +5480(all)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(2)S +7920 V +EP +%%Page: 3 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(the)S +1412(user)S +1608(interface)S +1986(details.)S +2332(The)S +10 I +2517(client)S +2770(resources)S +10 R +3189(described)S +3602(below)S +3877(will)S +4064(be)S +4189(common)S +4570(to)S +4679(any)S +4854(user-de\256ned)S +5378(GUI,)S +1080 V +1260(the)S +10 I +1426(gui)S +1598(resources)S +10 R +2030(may)S +2246(change)S +2572(depending)S +3032(on)S +3176(how)S +3392(extensively)S +3890(the)S +4055(GUI)S +4275(has)S +4451(been)S +4682(modi\256ed)S +5081(by)S +5224(the)S +5389(user.)S +1200 V +1260(Each)S +1495(of)S +1615(these)S +1857(components)S +2377(has)S +2547(its)S +2679(own)S +2888(set)S +3036(of)S +3156(resources,)S +3594(but)S +3759(to)S +3874(the)S +4033(user)S +4236(setting)S +4540(them)S +4777(is)S +4881(the)S +5040(same)S +5282(as)S +5402(with)S +1320 V +1260(any)S +1434(other)S +1669(application.)S +1560 V +10 I +1260(Gterm)S +10 R +1548(widget)S +1853(resources)S +2262(\(i.e.)S +2450(those)S +2694(for)S +2844(the)S +3000(main)S +3234(image)S +3512(window)S +3868(or)S +3985(colorbar\))S +4384(may)S +4590(be)S +4718(set)S +4863(as)S +4980(either)S +5241(client)S +5497(or)S +1680 V +1260(GUI)S +1467(resources.)S +1928(See)S +2102(the)S +10 I +2254(xgterm\(1\))S +10 R +2677(man)S +2879(page)S +3097(for)S +3243(a)S +3317(complete)S +3713(description)S +4187(of)S +10 I +4300(Gterm)S +10 R +4585(widget)S +4887(resources.)S +1968 V +9 B +1080(CLIENT)S +1452(RESOURCES)S +2088 V +10 R +1260(The)S +1445(client)S +1697(resources)S +2103(generally)S +2504(de\256ne)S +2778(the)S +2930(initial)S +3194(state)S +3407(of)S +3520(the)S +3672(application)S +4146(or)S +4259(set)S +4400(con\256guration)S +4963(parameters.)S +2256 V +10 B +1620(Resource)S +2043(Name)S +2870(Default)S +3216(Value)S +2364 V +10 R +1620(defCon\256g)S +2870(1)S +2472 V +1620(defNFrames)S +2870(0)S +2580 V +1620(tileBorderWidth)S +2870(3)S +2688 V +1620(tileBorderColor)S +2870(9)S +2796 V +1620(autoscale)S +2870(false)S +2904 V +1620(antialias)S +2870(false)S +3012 V +1620(antialiasType)S +2870(boxcar)S +3120 V +1620(tileFrames)S +2870(false)S +3228 V +1620(highlightFrames)S +2870(true)S +3336 V +1620(gui)S +2870(default)S +3444 V +1620(imtoolrc)S +2870(/usr/local/lib/imtoolrc)S +3552 V +1620(invert)S +2870(false)S +3660 V +1620(memModel)S +2870(fast)S +3768 V +1620(basePixel:)S +2870(64)S +3876 V +1620(maxColors:)S +2870(216)S +3984 V +1620(cmapInitialize:)S +2870(false)S +4092 V +1620(cmap1)S +2870(none)S +4200 V +1620(cmap2)S +2870(none)S +4308 V +1620(cmapDir1)S +2870(none)S +4416 V +1620(cmapDir2)S +2870(/usr/local/lib/imtoolcmap)S +4524 V +1620(input_\256fo)S +2870(/dev/imt1i)S +4632 V +1620(output_\256fo)S +2870(/dev/imt1o)S +4740 V +1620(unixaddr)S +2870(/tmp/.IMT%d)S +4848 V +1620(port)S +2870(5137)S +5016 V +1260(Description)S +1756(of)S +1869(ximtool)S +2211(client)S +2463(resources:)S +5304 V +10 B +1260(defCon\256g)S +10 R +2160(Default)S +2499(frame)S +2772(bu)S +2872 H + (f)show 10 -.5 mul h (f)show +10 R +2933(er)S +3051(con\256guration)S +3625(number)S +3971(on)S +4112(startup.)S +4480(See)S +4665(below)S +4950(for)S +5107(more)S +5353(infor-)S +5424 V +2160(mation)S +2468(on)S +2598(frame)S +2860(bu)S +2960 H + (f)show 10 -.5 mul h (f)show +10 R +3021(ers.)S +5592 V +10 B +1260(defNFrames)S +10 R +2160(Default)S +2496(number)S +2838(of)S +2958(frames)S +3266(on)S +3403(startup.)S +3767(Set)S +3932(to)S +4047(zero)S +4255(to)S +4371(use)S +4542(the)S +4702(value)S +4956(from)S +5188(the)S +5348(frame)S +5712 V +2160(bu)S +2260 H + (f)show 10 -.5 mul h (f)show +10 R +2321(er)S +2428(con\256guration)S +2991(\()S +10 I +3024(imtoolrc)S +10 R +3363(\))S +3426(\256le.)S +5880 V +10 B +1260(tileBorderWidth)S +5988 V +1260(tileBorderColor)S +10 R +2160(Used)S +2401(by)S +2537(the)S +2695(tile)S +2859(frames)S +3166(option.)S +3513(Speci\256es)S +3910(how)S +4118(far)S +4264(apart)S +4499(to)S +4613(space)S +4870(the)S +5029(frames)S +5337(in)S +5452(tile)S +6108 V +2160(frames)S +2484(mode.)S +2814(Color)S +3095("9")S +3280(refers)S +3559(to)S +3690(the)S +3865(Gterm)S +4172(widget)S +4496(resource)S +4885(color9,)S +5217(which)S +5513(is)S +6228 V +2160(assigned)S +2534(a)S +2608(color)S +2843(with)S +3051(its)S +3176(own)S +3378(resource.)S +6396 V +10 B +1260(autoscale)S +10 R +2160(Enable/disable)S +2778(the)S +2930(autoscale)S +3331(option.)S +6564 V +10 B +1260(antialias)S +10 R +2160(Enable/disable)S +2778(the)S +2930(antialias)S +3293(option.)S +6732 V +10 B +1260(antialiasType)S +10 R +2160(Type)S +2395(of)S +2508(antialiasing.)S +6900 V +10 B +1260(tileFrames)S +10 R +2160(Enable/disable)S +2778(the)S +2930(tile)S +3088(frames)S +3389(option.)S +7068 V +10 B +1260(highlightFrames)S +10 R +2160(Determines)S +2650(whether)S +3001(the)S +3153(current)S +3465(frame)S +3727(is)S +3824(highlighted)S +4310(when)S +4556(in)S +4664(tile)S +4822(frames)S +5123(mode.)S +7236 V +10 B +1260(gui)S +10 R +2160(The)S +2349(GUI)S +2560(to)S +2672(be)S +2800(executed.)S +3243("default")S +3636(refers)S +3896(to)S +4008(the)S +4164(default,)S +4500(builtin)S +4796(ximtool)S +5142(GUI.)S +5408(You)S +7716 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(3)S +7920 V +EP +%%Page: 4 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +2160(can)S +2341(replace)S +2671(this)S +2859(with)S +3080(your)S +3306(own)S +3521(GUI)S +3741(\256le)S +3911(if)S +4014(you)S +4206(are)S +4369(bold)S +4589(enough,)S +4950(and)S +5136(completely)S +1080 V +2160(change)S +2472(the)S +2624(look)S +2832(and)S +3006(functionality)S +3547(of)S +3660(the)S +3812(GUI)S +4019(if)S +4110(desired.)S +1248 V +10 B +1260(imtoolrc)S +10 R +2160(Where)S +2496(to)S +2645(\256nd)S +2872(the)S +3065(imtoolrc)S +3475(\256le.)S +3730(This)S +3980(de\256nes)S +4335(the)S +4529(recognized)S +5038(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +1368 V +2160(con\256gurations.)S +1536 V +10 B +1260(invert)S +10 R +2160(Start)S +2388(Ximtool)S +2761(using)S +3017(an)S +3150(inverted)S +3516(colormap.)S +3987(When)S +4264(set,)S +4440(a)S +4524("normalized")S +5095(display)S +5424(will)S +1656 V +2160(always)S +2467(be)S +2591(the)S +2743(inverse)S +3061(of)S +3174(the)S +3326(selected)S +3677(colormap.)S +1824 V +10 B +1260(memModel)S +10 R +2160(Determines)S +2656(how)S +2864(ximtool)S +3212(uses)S +3420(memory)S +3789(in)S +3904(the)S +4063(ximtool)S +4412(client)S +4671(and)S +4852(the)S +5011(X)S +5120(server.)S +5425(The)S +1944 V +2160(options)S +2493(are)S +2652("fast",)S +2941("beNiceToServer",)S +3739(and)S +3920("small".)S +4311(The)S +4503(default)S +4817(is)S +4921(fast,)S +5127(which)S +5408(uses)S +2064 V +2160(server)S +2457(pixmaps)S +2851(to)S +2984(make)S +3255(frame)S +3542(blink)S +3803(fast.)S +4057(This)S +4290(is)S +4412(recommended)S +5032(unless)S +5337(server)S +2184 V +2160(memory)S +2525(is)S +2624(very)S +2833(limited.)S +3204(Note)S +3430(that)S +3612(even)S +3831(in)S +3940(fast)S +4115(mode,)S +4393(the)S +4546(server)S +4820(pixmap)S +5151(is)S +5249(only)S +5458(the)S +2304 V +2160(size)S +2346(of)S +2460(the)S +2613(display)S +2933(window,)S +3311(so)S +3431(memory)S +3795(usage)S +4054(is)S +4153(reasonable)S +4611(even)S +4831(if)S +4924(the)S +5078(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +2424 V +2160(is)S +2257(very)S +2464(large.)S +2532 V +10 Y +1260(*)S +10 B +1310(basePixel)S +2640 V +10 Y +1260(*)S +10 B +1310(maxColors)S +10 R +2160(These)S +2434(two)S +2620(resources)S +3032(determine)S +3467(the)S +3626(region)S +3918(of)S +4038(colormap)S +4452(space)S +4710(used)S +4930(to)S +5045(render)S +5336(image)S +2760 V +2160(pixels.)S +2928 V +10 Y +1260(*)S +10 B +1310(cmapInitialize)S +10 R +2160(Initialize)S +2555(the)S +2717(ximtool)S +3069(colormap)S +3486(at)S +3598(startup.)S +3965(This)S +4183(is)S +4290(sometimes)S +4758(necessary)S +5185(to)S +5303(clear)S +5536(a)S +3048 V +2160(previous)S +2534(ximtool)S +2876(colormap)S +3283(allowing)S +3663(a)S +3737(new)S +3933(basePixel)S +4346(and)S +4520(maxColors)S +4989(to)S +5097(take)S +5293(e)S +5337 H + (f)show 10 -.5 mul h (f)show +10 R +5398(ect.)S +3216 V +10 B +1260(cmap1)S +3324 V +1260(cmap2)S +10 R +2160(User)S +2389(colormap)S +2807(\256les.)S +3070(The)S +3266(intent)S +3535(here)S +3748(is)S +3857(to)S +3977(allow)S +4241(individual)S +4689(colormaps)S +5147(to)S +5267(be)S +5403(con-)S +3444 V +2160(veniently)S +2562(speci\256ed)S +2947(as)S +3060(a)S +3134(resource.)S +3612 V +10 B +1260(cmapDir1)S +3720 V +1260(cmapDir2)S +10 R +2160(User)S +2393(or)S +2521(system)S +2844(colormap)S +3266(directories.)S +3788(By)S +3951(default)S +4274(cmapDir2)S +4719(points)S +5010(to)S +5134(the)S +5302(system)S +3840 V +2160(directory)S +2564(/usr/local/lib/imtoolcmap,)S +3644(allowing)S +4037(a)S +4124(set)S +4278(of)S +4404(site)S +4586(default)S +4906(colormaps)S +5365(to)S +5486(be)S +3960 V +2160(de\256ned)S +2484(here.)S +2740(This)S +2948(leaves)S +3227(cmapDir1)S +3656(available)S +4046(to)S +4154(a)S +4228(user)S +4424(colormap)S +4831(directory.)S +4128 V +10 B +1260(input_\256fo)S +4236 V +1260(output_\256fo)S +10 R +2160(The)S +2354(input)S +2600(and)S +2784(output)S +3080(\256fos)S +3298(for)S +3454(\256fo)S +3633(i/o.)S +3834("Input")S +4167(and)S +4351("output")S +4729(are)S +4890(from)S +5124(the)S +5286(client's)S +4356 V +2160(point)S +2396(of)S +2509(view.)S +2788(Note)S +3012(that)S +3192(only)S +3400(one)S +3574(display)S +3893(server)S +4166(can)S +4334(use)S +4497(a)S +4571(\256fo-pair)S +4928(at)S +5030(one)S +5204(time.)S +4524 V +10 B +1260(unixaddr)S +10 R +2160(Template)S +2569(address)S +2900(for)S +3048(unix)S +3258(domain)S +3591(socket.)S +3934(The)S +4122(user)S +4321(must)S +4549(have)S +4770(write)S +5008(permission)S +5480(on)S +4644 V +2160(this)S +2338(directory,)S +2756(or)S +2872(the)S +3027(\256le)S +3188(must)S +3416(already)S +3742(exist.)S +4019(%d,)S +4210(if)S +4304(given,)S +4584(is)S +4684(replaced)S +5054(by)S +5187(the)S +5342(user's)S +4764 V +2160(UID.)S +4932 V +10 B +1260(port)S +10 R +2160(TCP/IP)S +2500(port)S +2700(for)S +2855(the)S +3017(server.)S +3355(Note)S +3589(that)S +3779(only)S +3997(one)S +4181(server)S +4464(can)S +4642(listen)S +4899(on)S +5039(a)S +5123(port)S +5324(at)S +5436(one)S +5052 V +2160(time,)S +2402(so)S +2530(if)S +2630(multiple)S +3003(ximtool)S +3354(servers)S +3675(are)S +3835(desired)S +4161(on)S +4299(the)S +4459(same)S +4702(machine,)S +5103(they)S +5313(should)S +5172 V +2160(be)S +2284(given)S +2536(di)S +2614 H + (f)show 10 -.5 mul h (f)show +10 R +2675(erent)S +2904(ports.)S +5460 V +9 B +1080(GUI)S +1277(RESOURCES)S +5580 V +10 R +1260(In)S +1394(principle)S +1800(ximtool)S +2163(can)S +2352(have)S +2592(any)S +2788(number)S +3145(of)S +3280(di)S +3358 H + (f)show 10 -.5 mul h (f)show +10 R +3419(erent)S +3670(GUIs,)S +3963(each)S +4197(of)S +4332(which)S +4628(de\256nes)S +4963(its)S +5110(own)S +5334(set)S +5497(of)S +5700 V +1260(resources.)S +1733(GUIs)S +1991(typically)S +2383(de\256ne)S +2669(a)S +2755(great)S +2996(many)S +3260(resources,)S +3703(but)S +3873(most)S +4110(of)S +4234(these)S +4480(are)S +4642(not)S +4811(really)S +5079(intended)S +5464(for)S +5820 V +1260(modi\256cation)S +1796(by)S +1926(the)S +2078(user)S +2274(\(although)S +2687(one)S +2861(can)S +3029(modify)S +3348(them)S +3578(if)S +3669(desired\).)S +6060 V +1260(The)S +1455(following)S +1884(are)S +2045(some)S +2296(of)S +2419(the)S +2581(more)S +2826(useful)S +3110(resources)S +3526(used)S +3749(by)S +3889(the)S +4051(default)S +4369(ximtool)S +4722(GUI.)S +4995(The)S +10 I +5191(imagewin)S +6180 V +10 R +1260(resources)S +1666(are)S +1817(Gterm)S +2102(widget)S +2404(resources.)S +6348 V +10 B +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +6456 V +10 R +1650(.geometry:)S +6564 V +10 Y +1650(*)S +10 R +1700(controlShell.geometry:)S +6672 V +10 Y +1650(*)S +10 R +1700(info.geometry:)S +3370(420x240)S +6780 V +10 Y +1650(*)S +10 R +1700(load_panel.geometry:)S +6888 V +10 Y +1650(*)S +10 R +1700(save_panel.geometry:)S +6996 V +10 Y +1650(*)S +10 R +1700(print_panel.geometry:)S +7104 V +10 Y +1650(*)S +10 R +1700(help_panel.geometry:)S +7212 V +10 Y +1650(*)S +10 R +1700(cmapName:)S +3370(image)S +7692 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(4)S +7920 V +EP +%%Page: 5 5 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 Y +1650(*)S +10 R +1700(basePixel:)S +3370(64)S +1068 V +10 Y +1650(*)S +10 R +1700(imagewin.warpCursor:)S +3370(true)S +1176 V +10 Y +1650(*)S +10 R +1700(imagewin.raiseWindow:)S +3370(true)S +1284 V +10 Y +1650(*)S +10 R +1700(imagewin.deiconifyWindow:)S +3370(true)S +1392 V +10 Y +1650(*)S +10 R +1700(imagewin.ginmodeCursor:)S +3370(circle)S +1500 V +10 Y +1650(*)S +10 R +1700(imagewin.ginmodeBlinkInterval:)S +3370(500)S +1608 V +10 Y +1650(*)S +10 R +1700(imagewin.color0:)S +3370(black)S +1716 V +10 Y +1650(*)S +10 R +1700(imagewin.color1:)S +3370(white)S +1824 V +10 Y +1650(*)S +10 R +1700(imagewin.color8:)S +3370(#7c8498)S +1932 V +10 Y +1650(*)S +10 R +1700(imagewin.color9:)S +3370(steelblue)S +2040 V +10 Y +1650(*)S +10 R +1700(imagewin.width:)S +3370(512)S +2148 V +10 Y +1650(*)S +10 R +1700(imagewin.height:)S +3370(512)S +2256 V +10 Y +1650(*)S +10 R +1700(autoscale:)S +3370(True)S +2364 V +10 Y +1650(*)S +10 R +1700(zoomfactors:)S +3370(1)S +3450(2)S +3530(4)S +3610(8)S +2472 V +10 Y +1650(*)S +10 R +1700(displayCoords:)S +3370(True)S +2580 V +10 Y +1650(*)S +10 R +1700(displayPanner:)S +3370(True)S +2688 V +10 Y +1650(*)S +10 R +1700(displayMagni\256er:)S +3370(False)S +2796 V +10 Y +1650(*)S +10 R +1700(blinkRate:)S +3370(1.0)S +2904 V +10 Y +1650(*)S +10 R +1700(pannerArea:)S +3370(150)S +10 Y +3520(*)S +10 R +3570(150)S +3012 V +10 Y +1650(*)S +10 R +1700(pannerGeom:)S +3370(-5+5)S +3120 V +10 Y +1650(*)S +10 R +1700(magni\256erArea:)S +3370(100)S +10 Y +3520(*)S +10 R +3570(100)S +3228 V +10 Y +1650(*)S +10 R +1700(magni\256erGeom:)S +3370(+5+5)S +3336 V +10 Y +1650(*)S +10 R +1700(wcsboxGeom:)S +3370(-5-5)S +3444 V +10 Y +1650(*)S +10 R +1700(maxContrast:)S +3370(5.0)S +3552 V +10 Y +1650(*)S +10 R +1700(warnings:)S +3370(True)S +3720 V +1260(Description)S +1756(of)S +1869(selected)S +2220(resources:)S +4008 V +10 B +1260(.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(main)S +3132(image)S +3406(window.)S +4176 V +10 Y +1260(*)S +10 B +1310(controlShell.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(control)S +3215(panel)S +3461(shell.)S +4344 V +10 Y +1260(*)S +10 B +1310(info.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(info)S +3093(box.)S +4512 V +10 Y +1260(*)S +10 B +1310(load_panel.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(\256le)S +3060(load)S +3262(panel.)S +4680 V +10 Y +1260(*)S +10 B +1310(save_panel.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(save)S +3109(control)S +3422(panel.)S +4848 V +10 Y +1260(*)S +10 B +1310(print_panel.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(print)S +3121(control)S +3434(panel.)S +5016 V +10 Y +1260(*)S +10 B +1310(help_panel.geometry)S +10 R +2360(Geometry)S +2789(of)S +2902(help)S +3104(box.)S +5184 V +10 Y +1260(*)S +10 B +1310(cmapName)S +10 R +2360(Name)S +2638(used)S +2861(for)S +3018(private)S +3336(colormap.)S +3809(The)S +4005(default)S +4323(for)S +4480(all)S +4621(IRAF)S +4890(imaging)S +5259(applica-)S +5304 V +2360(tions)S +2601(is)S +2714("image".)S +3141(Gterm)S +3442(widget)S +3760(based)S +4033(imaging)S +4407(applications)S +4936(which)S +5225(have)S +5458(the)S +5424 V +2360(same)S +2597(value)S +2845(of)S +2961(cmapName)S +3448(will)S +3637(share)S +3880(the)S +4035(same)S +4273(colormap,)S +4708(minimizing)S +5203(colormap)S +5544 V +2360(\257ashing)S +2707(and)S +2881(allowing)S +3261(multiple)S +3625(applications)S +4138(to)S +4246(be)S +4370(run)S +4533(at)S +4635(the)S +4787(same)S +5022(time.)S +5712 V +10 Y +1260(*)S +10 B +1310(basePixel)S +10 R +2360(The)S +2545(base)S +2752(colormap)S +3159(cell)S +3333(used)S +3546(by)S +3676(the)S +3828(display)S +4147(colormap.)S +5880 V +10 Y +1260(*)S +10 B +1310(imagewin.warpCursor)S +10 R +2360(Warp)S +2611(pointer)S +2924(into)S +3110(image)S +3384(window)S +3736(when)S +3982(initiating)S +4374(a)S +4448(cursor)S +4727(read.)S +6048 V +10 Y +1260(*)S +10 B +1310(imagewin.raiseWindow)S +10 R +2360(Raise)S +2612(image)S +2886(window)S +3238(when)S +3484(initiating)S +3876(a)S +3950(cursor)S +4229(read.)S +6216 V +10 Y +1260(*)S +10 B +1310(imagewin.deiconifyWindow)S +6336 V +10 R +2360(Deiconify)S +2789(image)S +3063(window)S +3415(if)S +3506(necessary)S +3923(when)S +4169(initiating)S +4561(a)S +4635(cursor)S +4914(read.)S +6504 V +10 Y +1260(*)S +10 B +1310(imagewin.ginmodeCursor)S +6624 V +10 R +2360(Type)S +2596(of)S +2710(cursor)S +2990(when)S +3237(a)S +3312(cursor)S +3592(read)S +3795(is)S +3894(in)S +4004(progress.)S +4429(The)S +4616(default)S +4925(is)S +5024(a)S +5100(circle.)S +5408(Any)S +6744 V +2360(selection)S +2800(from)S +3079(the)S +3285(X)S +3441(cursor)S +3774(font)S +4019(can)S +4241(be)S +4419(used.)S +4741(A)S +4897(special)S +5258(case)S +5513(is)S +6864 V +2360("full_crosshair")S +3021(which)S +3295(is)S +3392(the)S +3544(full)S +3713(crosshair)S +4103(cursor)S +4382(of)S +4495(the)S +4647(Gterm)S +4932(widget.)S +7032 V +10 Y +1260(*)S +10 B +1310(imagewin.ginmodeBlinkInterval)S +7152 V +10 R +2360(Determines)S +2857(whether)S +3215(the)S +3374(cursor)S +3660(blinks)S +3942(when)S +4195(a)S +4277(cursor)S +4564(read)S +4773(is)S +4878(in)S +4994(progress.)S +5425(The)S +7272 V +2360(value)S +2606(is)S +2703(given)S +2955(in)S +3063(milliseconds.)S +7752 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(5)S +7920 V +EP +%%Page: 6 6 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 Y +1260(*)S +10 B +1310(imagewin.color0)S +10 R +2360(Background)S +2878(color.)S +1128 V +10 Y +1260(*)S +10 B +1310(imagewin.color1)S +10 R +2360(Foreground)S +2856(color.)S +1296 V +10 Y +1260(*)S +10 B +1310(imagewin.color8)S +10 R +2360(Color)S +2618(assigned)S +2992(the)S +3144(panner)S +3445(window.)S +1464 V +10 Y +1260(*)S +10 B +1310(imagewin.color9)S +10 R +2360(Color)S +2618(used)S +2831(for)S +2977(the)S +3129(tileFrames)S +3581(highlight.)S +1632 V +10 Y +1260(*)S +10 B +1310(imagewin.width)S +10 R +2360(Width)S +2640(of)S +2753(the)S +2905(main)S +3135(image)S +3409(window.)S +1800 V +10 Y +1260(*)S +10 B +1310(imagewin.height)S +10 R +2360(Height)S +2662(of)S +2775(the)S +2927(main)S +3157(image)S +3431(window.)S +1968 V +10 Y +1260(*)S +10 B +1310(pannerArea)S +10 R +2360(Area)S +2583(in)S +2691(pixels)S +2960(of)S +3073(the)S +3225(panner)S +3526(window.)S +2136 V +10 Y +1260(*)S +10 B +1310(pannerGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(panner)S +3456(window.)S +2304 V +10 Y +1260(*)S +10 B +1310(magni\256erArea)S +10 R +2360(Area)S +2583(in)S +2691(pixels)S +2960(of)S +3073(the)S +3225(magni\256er)S +3638(window.)S +2472 V +10 Y +1260(*)S +10 B +1310(magni\256erGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(magni\256er)S +3568(window.)S +2640 V +10 Y +1260(*)S +10 B +1310(wcsboxGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(coords)S +3451(box.)S +2808 V +10 Y +1260(*)S +10 B +1310(maxContrast)S +10 R +2360(Maximum)S +2807(contrast)S +3153(value.)S +3216 V +9 B +900(DESCRIPTION)S +3336 V +10 R +1260(As)S +1401(a)S +1475(display)S +1794(server,)S +2092(XImtool)S +2461(is)S +2558(started)S +2854(as)S +2967(a)S +3041(separate)S +3397(process)S +3726(from)S +3950(client)S +4202(software)S +4575(such)S +4788(as)S +4901(IRAF.)S +5185(Once)S +5426(it)S +5513(is)S +3456 V +1260(running)S +1606(it)S +1697(will)S +1888(accept)S +2177(client)S +2434(connections)S +2946(simultaneously)S +3587(on)S +3721(\256fo)S +3894(pipes,)S +4164(unix)S +4376(domain)S +4710(sockets,)S +5063(or)S +5180(inet)S +5364(sock-)S +3576 V +1260(ets.)S +1432(A)S +1540(display)S +1865(client)S +2123(like)S +2309(the)S +2467(IRAF)S +10 I +2731(DISPLAY)S +10 R +3156(task)S +3353(makes)S +3644(a)S +3724(connection)S +4198(and)S +4378(sends)S +4637(the)S +4796(image)S +5077(across)S +5363(using)S +3696 V +1260(an)S +1385(IIS)S +1538(protocol.)S +1957(Once)S +2198(the)S +2351(image)S +2625(is)S +2722(loaded)S +3018(in)S +3126(the)S +3278(display)S +3597(bu)S +3697 H + (f)show 10 -.5 mul h (f)show +10 R +3758(er)S +3865(it)S +3951(may)S +4153(be)S +4277(enhanced,)S +4708(saved)S +4965(to)S +5073(a)S +5147(disk)S +5344(\256le)S +5502(in)S +3816 V +1260(a)S +1340(number)S +1681(of)S +1800(di)S +1878 H + (f)show 10 -.5 mul h (f)show +10 R +1939(erent)S +2174(formats,)S +2540(or)S +2659(printed)S +2978(as)S +3097(Encapsulated)S +3665(Postscript)S +4097(to)S +4212(a)S +4293(printer)S +4596(or)S +4716(disk)S +4920(\256le.)S +5140(Up)S +5299(to)S +5414(four)S +3936 V +1260(frame)S +1531(bu)S +1631 H + (f)show 10 -.5 mul h (f)show +10 R +1692(ers)S +1847(are)S +2007(allowed,)S +2387(these)S +2631(may)S +2842(be)S +2975(displayed)S +3397(simultaneously)S +4042(in)S +4159(a)S +4242(tiled)S +4459(mode,)S +4745(or)S +4866(blinked)S +5204(frame-to-)S +4056 V +1260(frame.)S +1582(Each)S +1816(frame)S +2083(may)S +2290(have)S +2513(its)S +2643(own)S +2850(colormap)S +3262(or)S +3380(brightness/contrast)S +4170(enhancement.)S +4787(Pan/Zoom)S +5240(and)S +5420(cur-)S +4176 V +1260(sor)S +1412(readout)S +1741(are)S +1892(permitted)S +2305(using)S +10 I +2552(markers)S +10 R +2879(,)S +2934(on-line)S +3247(help)S +3449(is)S +3546(also)S +3737(available.)S +4416 V +1260(When)S +1530(run)S +1695(in)S +1805(standalone)S +2264(mode,)S +2543(images)S +2858(\(currently)S +3283(IRAF)S +3543(OIF,)S +3761(GIF,)S +3979(Sun)S +4167(Raster\256les)S +4621(or)S +4736(simple)S +5036(FITS)S +5275(formats)S +4536 V +1260(are)S +1428(permitted\))S +1891(may)S +2110(be)S +2251(loaded)S +2564(on)S +2711(the)S +2880(command)S +3321(line)S +3518(or)S +3648(by)S +3795(using)S +4059(the)S +4228(Load)S +4480(Panel.)S +4774(This)S +4999(allows)S +5306(you)S +5502(to)S +4656 V +1260(browse)S +1578(images)S +1891(and)S +2065(perform)S +2416(the)S +2568(same)S +2803(manipulations)S +3400(as)S +3513(if)S +3604(they)S +3806(had)S +3980(been)S +4198(displayed)S +4611(by)S +4741(a)S +4815(client.)S +4944 V +9 B +1080(MOUSE)S +1437(OPERATIONS)S +5064 V +10 R +1260(Clicking)S +1648(and)S +1835(dragging)S +2233(MB1)S +2482(\(mouse)S +2819(button)S +3118(1\))S +3244(in)S +3365(the)S +3530(main)S +3773(image)S +4060(window)S +4425(creates)S +4745(a)S +4833(rectangular)S +5325(region)S +5184 V +1260(marker,)S +1604(used)S +1824(to)S +1939(select)S +2203(a)S +2284(region)S +2576(of)S +2696(the)S +2855(image.)S +3161(If)S +3264(you)S +3451(do)S +3588(this)S +3770(accidentally)S +4289(and)S +4470(don't)S +4718(want)S +4949(the)S +5108(marker,)S +5452(put)S +5304 V +1260(the)S +1419(pointer)S +1739(in)S +1854(the)S +2013(marker)S +2332(and)S +2513(type)S +2722(DELETE)S +3137(or)S +3258(BACKSPACE)S +3886(to)S +4002(delete)S +4278(the)S +4438(marker.)S +4783(With)S +5021(the)S +5181(pointer)S +5502(in)S +5424 V +1260(the)S +1417(marker,)S +1759(MB3)S +2000(will)S +2191(call)S +2370(up)S +2505(a)S +2584(marker)S +2901(menu)S +3158(listing)S +3444(some)S +3690(things)S +3970(you)S +4155(can)S +4328(do)S +4463(with)S +4676(the)S +4833(marker,)S +5174(like)S +5358(zoom)S +5544 V +1260(the)S +1420(outlined)S +1786(region.)S +2104(MB1)S +2348(can)S +2524(be)S +2656(used)S +2877(to)S +2993(drag)S +3208(or)S +3329(resize)S +3599(the)S +3759(marker.)S +4104(See)S +4287(below)S +4570(for)S +4725(more)S +4969(information)S +5480(on)S +5664 V +1260(markers.)S +5904 V +1260(Clicking)S +1642(on)S +1779(MB2)S +2022(in)S +2137(the)S +2296(main)S +2533(image)S +2814(window)S +3173(pans)S +3394(\(one)S +3609(click\))S +3874(or)S +3995(zooms)S +4294(\(two)S +4515(clicks\))S +4819(the)S +4979(image.)S +5286(Further)S +6024 V +1260(clicks)S +1529(cycle)S +1775(through)S +2122(the)S +2280(builtin)S +2578(zoom)S +2836(factors.)S +3198(Moving)S +3551(the)S +3709(pointer)S +4028(to)S +4142(a)S +4222(new)S +4424(location)S +4782(and)S +4962(clicking)S +5319(moves)S +6144 V +1260(the)S +1425(feature)S +1744(under)S +2014(the)S +2179(pointer)S +2505(to)S +2627(the)S +2793(center)S +3080(of)S +3207(the)S +3373(display)S +3706(window.)S +4127(Holding)S +4499(down)S +4765(the)S +4931(Shift)S +5170(key)S +5358(while)S +6264 V +1260(clicking)S +1620(MB2)S +1864(will)S +2058(cause)S +2317(a)S +2399(full-screen)S +2863(crosshair)S +3261(cursor)S +3547(to)S +3662(appear)S +3964(until)S +4185(the)S +4344(button)S +4637(is)S +4741(released,)S +5129(this)S +5311(can)S +5486(be)S +6384 V +1260(useful)S +1534(for)S +1680(\256ne)S +1860(positioning)S +2341(of)S +2454(the)S +2606(cursor.)S +6624 V +1260(MB3)S +1507(is)S +1615(used)S +1839(to)S +1958(adjust)S +2238(the)S +2401(contrast)S +2758(and)S +2943(brightness)S +3395(of)S +3519(the)S +3682(displayed)S +4106(image.)S +4446(The)S +4643(position)S +5008(of)S +5133(the)S +5297(pointer)S +6744 V +1260(within)S +1560(the)S +1726(display)S +2059(window)S +2425(determines)S +2906(the)S +3071(contrast)S +3430(and)S +3617(brightness)S +4071(values.)S +4394(Click)S +4654(once)S +4885(to)S +5006(set)S +5160(the)S +5325(values)S +6864 V +1260(corresponding)S +1861(to)S +1969(the)S +2121(pointer)S +2434(location,)S +2811(or)S +2924(click)S +3148(and)S +3322(drag)S +3529(to)S +3637(continuously)S +4184(adjust)S +4453(the)S +4605(display.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(6)S +7920 V +EP +%%Page: 7 7 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(KEYSTROKE)S +1677(ACCELERATORS)S +1080 V +10 R +1260(The)S +1445(following)S +1864(keystrokes)S +2321(are)S +2472(currently)S +2862(de\256ned)S +3186(in)S +3294(the)S +3446(GUI:)S +1368 V +10 B +1260(Ctrl-b)S +10 R +1860(Backward)S +2294(frame)S +1476 V +10 B +1260(Ctrl-c)S +10 R +1860(Center)S +2156(frame?)S +1584 V +10 B +1260(Ctrl-f)S +10 R +1860(Forward)S +2228(frame)S +1692 V +10 B +1260(Ctrl-i)S +10 R +1860(Invert?)S +1800 V +10 B +1260(Ctrl-m)S +10 R +1860(Match)S +2145(LUTs)S +1908 V +10 B +1260(Ctrl-n)S +10 R +1860(Normalize)S +2016 V +10 B +1260(Ctrl-r)S +10 R +1860(Register)S +2124 V +10 B +1260(Ctrl-t)S +10 R +1860(Tile)S +2051(frames)S +2352(toggle)S +2232 V +10 B +1260(Ctrl-u)S +10 R +1860(Unzoom)S +2234(\(zoom=1\))S +2340 V +10 B +1260(Ctrl-x)S +10 R +1860(Flip)S +2052(X)S +2448 V +10 B +1260(Ctrl-y)S +10 R +1860(Flip)S +2052(Y)S +2736 V +10 B +1260(Alt-b)S +10 R +1860(Blink)S +2113(frames)S +2414(\(toggle\))S +2844 V +10 B +1260(Alt-c)S +10 R +1860(Control)S +2196(panel)S +2442(\(toggle\))S +2952 V +10 B +1260(Alt-h)S +10 R +1860(Help)S +2084(popup)S +2364(\(toggle\))S +3060 V +10 B +1260(Alt-i)S +10 R +1860(Info)S +2056(box)S +2236(popup)S +2516(\(toggle\))S +3168 V +10 B +1260(Alt-l)S +10 R +1860(Load)S +2095(\256le)S +2253(popup)S +2533(\(toggle\))S +3276 V +10 B +1260(Alt-p)S +10 R +1860(Print)S +2085(popup)S +2365(\(toggle\))S +3384 V +10 B +1260(Alt-s)S +10 R +1860(Save)S +2084(popup)S +2364(\(toggle\))S +3492 V +10 B +1260(Alt-t)S +10 R +1860(TclShell)S +2229(popup)S +2509(\(toggle\))S +3780 V +10 B +1260(Ctrl-Alt-q)S +10 R +1860(Quit)S +3888 V +10 B +1260(Ctrl-Alt-f)S +10 R +1860(Fitframe)S +4176 V +10 B +1260(Ctrl-=)S +10 R +1860(Print)S +2085(using)S +2332(current)S +2644(setup)S +4284 V +10 B +1260(Ctrl-<)S +10 R +1860(Decrease)S +2254(blink)S +2490(rate)S +2669(\(blink)S +2938(faster\))S +4392 V +10 B +1260(Ctrl->)S +10 R +1860(Increase)S +2221(blink)S +2457(rate)S +2636(\(blink)S +2905(slower\))S +4500 V +10 B +1260(Ctrl-+)S +10 R +1860(Zoom)S +2129(in)S +4608 V +10 B +1260(Ctrl--)S +10 R +1860(Zoom)S +2129(out)S +4896 V +10 B +1260(Ctrl-[hjkl])S +1769(or)S +1923(Ctrl-[arrow_key])S +5016 V +10 R +1860(Move)S +2123(cursor)S +2402(one)S +2576(pixel)S +2806(in)S +2914(each)S +3126(direction)S +5124 V +10 B +1260(Ctrl-Shift-[hjkl])S +2008(or)S +2162(Ctrl-Shift-[arrow_key])S +5244 V +10 R +1860(Move)S +2123(cursor)S +2402(ten)S +2554(pixels)S +2823(in)S +2931(each)S +3143(direction)S +5352 V +10 B +1260(Alt-1)S +1506(thru)S +1725(Alt-4)S +5472 V +10 R +1860(Set)S +2018(frame)S +2280(displayed)S +5580 V +10 B +1260(Ctrl-1)S +1550(thru)S +1769(Ctrl-9)S +5700 V +10 R +1860(Set)S +2018(integer)S +2325(zoom)S +2577(factor)S +5988 V +10 B +1260(NOTE:)S +10 R +1612(These)S +1885(keystrokes)S +2347(only)S +2560(work)S +2800(with)S +3013(the)S +3170(cursor)S +3454(in)S +3567(the)S +3724(main)S +3959(image)S +4239(window,)S +4622(not)S +4786(on)S +4922(the)S +5080(subwindows)S +6108 V +1260(or)S +1378(in)S +1491(markers)S +1847(since)S +2087(they)S +2294(are)S +2450(implemented)S +3007(as)S +10 I +3125(imagewin)S +10 R +3549(translations.)S +4099(If)S +4199(a)S +4277(command)S +4705(does)S +4922(not)S +5084(work,)S +5348(check)S +6228 V +1260(the)S +1412(cursor)S +1691(location.)S +6516 V +9 B +900(CLIENT)S +1272(CONNECTIONS)S +6636 V +10 R +1260(XImtool)S +1629(allows)S +1920(clients)S +2211(to)S +2319(connect)S +2659(in)S +2767(any)S +2941(of)S +3054(the)S +3206(following)S +3625(ways:)S +6804 V +10 B +1260(\256fo)S +1429(pipes)S +6924 V +10 R +1510(The)S +1706(traditional)S +2158(approach.)S +2589(The)S +2785(default)S +3103(global)S +3394(/dev/imt1[io])S +3963(pipes)S +4215(may)S +4428(be)S +4564(used,)S +4814(or)S +4939(a)S +5025(private)S +5344(set)S +5497(of)S +7044 V +1510(\256fos)S +1728(can)S +1906(be)S +2040(speci\256ed)S +2435(using)S +2692(the)S +10 I +2854(-\256fo)S +10 R +3055(command)S +3489(line)S +3678(argument)S +4094(or)S +10 Y +4216(*)S +10 I +4266(\256fo)S +10 R +4433(resource.)S +4864(Values)S +5180(should)S +5486(be)S +7164 V +1510(speci\256ed)S +1895(as)S +2008(the)S +2160(root)S +2351(pathname)S +2769(to)S +2877(a)S +2951(pair)S +3136(of)S +3250(\256fo)S +3420(pipes)S +3662(whose)S +3948(last)S +4118(character)S +4513(is)S +4611('i')S +4736(or)S +4850('o',)S +5052(these)S +5288(charac-)S +7284 V +1510(ters)S +1687(will)S +1876(be)S +2003(added)S +2274(automatically)S +2851(when)S +3100(opening)S +3455(the)S +3610(pipes.)S +3909(For)S +4081(example,)S +4477(to)S +4587(use)S +4752(the)S +4906(default)S +5215(pipes)S +5458(the)S +7764 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(7)S +7920 V +EP +%%Page: 8 8 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(path)S +1712(would)S +1992(be)S +2116(speci\256ed)S +2501(as)S +2614(simply)S +2917("/dev/imt1".)S +3438(A)S +3540(value)S +3786(of)S +3899("none")S +4205(disables)S +4557(this)S +4732(connection.)S +1128 V +10 B +1260(tcp/ip)S +1535(sockets)S +1248 V +10 R +1510(Clients)S +1836(connect)S +2188(via)S +2352(a)S +2438(tcp/ip)S +2708(socket.)S +3030(The)S +3227(default)S +3546(port)S +3749(is)S +10 I +3858(5137)S +10 R +4058(,)S +4125(or)S +4250(a)S +4337(custom)S +4669(port)S +4873(may)S +5088(be)S +5225(speci\256ed)S +1368 V +1510(using)S +1758(the)S +10 I +1911(-port)S +10 R +2142(command)S +2567(line)S +2747(switch)S +3038(or)S +3151(a)S +10 Y +3225(*)S +10 I +3275(port)S +10 R +3472(resource.)S +3864(This)S +4072(permits)S +4402(connecting)S +4870(to)S +4978(the)S +5130(server)S +5403(over)S +1488 V +1510(a)S +1584(remote)S +1891(network)S +2248(connection)S +2716(anywhere)S +3133(on)S +3263(the)S +3415(Internet.)S +3780(A)S +3883(port)S +4075(number)S +4411(of)S +4525(0)S +4606(\(zero\))S +4874(disables)S +5227(this)S +5403(con-)S +1608 V +1510(nection.)S +1776 V +10 B +1260(unix)S +1480(domain)S +1833(sockets)S +1896 V +10 R +1510(Like)S +1733(a)S +1817(tcp/ip)S +2085(socket,)S +2405(but)S +2573(limited)S +2898(to)S +3017(a)S +3102(single)S +3382(host)S +3590(system.)S +3934(Usually)S +4286(faster)S +4548(than)S +4761(a)S +4846(tcp/ip)S +5115(socket,)S +5436(and)S +2016 V +1510(comparable)S +2008(to)S +2119(a)S +2196(\256fo.)S +2393(By)S +2543(default)S +2853(each)S +3068(user)S +3267(gets)S +3460(their)S +3675(own)S +3879(unix)S +4089(domain)S +4421(socket,)S +4733(so)S +4854(this)S +5031(option)S +5319(allows)S +2136 V +1510(multiple)S +1882(users)S +2125(to)S +2241(run)S +2413(ximtools)S +2803(on)S +2942(the)S +3103(same)S +3347(host)S +3553(without)S +3898(having)S +4209(to)S +4326(customize)S +4770(things.)S +5109(The)S +5303(default)S +2256 V +1510(value)S +1761(is)S +1863("/tmp/.IMT%d",)S +2558(other)S +2798(sockets)S +3126(may)S +3332(be)S +3460(de\256ned)S +3788(using)S +4039(the)S +10 I +4195(-unix)S +10 R +4434(command)S +4862(line)S +5046(switch)S +5341(or)S +5458(the)S +2376 V +10 Y +1510(*)S +10 I +1560(unixaddr)S +10 R +1953(resource.)S +2377(Legal)S +2636(values)S +2923(should)S +3222(be)S +3348(speci\256ed)S +3735(as)S +3850(a)S +3926(\256lename)S +4302(to)S +4412(be)S +4538(used)S +4753(for)S +4901(the)S +5056(socket,)S +5369(up)S +5502(to)S +2496 V +1510(two)S +1693("%d")S +1941(\256elds)S +2190(are)S +2343(allowed)S +2691(and)S +2867(will)S +3055(be)S +3181(replaced)S +3550(by)S +3682(the)S +3836(userid.)S +4137(An)S +4291(empty)S +4573(string)S +4833(value)S +5081(disables)S +5435(this)S +2616 V +1510(connection.)S +2784 V +1260(By)S +1410(default)S +1720(ximtool)S +2065(listens)S +2354(simultaneously)S +2993(for)S +3142(client)S +3397(connections)S +3908(on)S +4042(all)S +4176(three)S +4409(types)S +4654(of)S +4771(ports.)S +5090(Clients)S +5408(may)S +2904 V +1260(connect)S +1614(simultaneously)S +2264(by)S +2408(di)S +2486 H + (f)show 10 -.5 mul h (f)show +10 R +2547(erent)S +2790(means)S +3089(allowing)S +3483(up)S +3627(to)S +3748(three)S +3990(di)S +4068 H + (f)show 10 -.5 mul h (f)show +10 R +4129(erent)S +4371(displays)S +4742(to)S +4863(be)S +5000(loading)S +5343(at)S +5458(the)S +3024 V +1260(same)S +1495(time)S +1703(into)S +1889(di)S +1967 H + (f)show 10 -.5 mul h (f)show +10 R +2028(erent)S +2257(frames.)S +3312 V +9 B +1080(COMMUNICATIONS)S +1987(PROTOCOL)S +3432 V +10 R +1260(Clients)S +1583(communicate)S +2160(with)S +2377(XImtool)S +2755(using)S +3011(a)S +3094(protocol)S +3467(developed)S +3917(originally)S +4346(for)S +4502(IIS)S +4664(\(International)S +5247(Imaging)S +3552 V +1260(Systems\))S +1659(Frame)S +1946(Bu)S +2063 H + (f)show 10 -.5 mul h (f)show +10 R +2124(er)S +2232(hardware,)S +2658(the)S +2811(so-called)S +3202("IIS)S +3396(protocol";)S +3829(other)S +4065(more)S +4301(modern)S +4637(protocols)S +5040(will)S +5227(likely)S +5486(be)S +3672 V +1260(supported)S +1687(in)S +1798(the)S +1953(future.)S +2279(The)S +2467(IIS)S +2622(protocol)S +2988(is)S +3088(basically)S +3476(a)S +3553(command)S +3981(packet)S +4275(stream)S +4575(with)S +4787(a)S +4865(header)S +5164(describing)S +3792 V +1260(the)S +1421(operation)S +1837(to)S +1954(be)S +2087(performed)S +2541(\(select)S +2840(frame,)S +3136(load)S +3347(display,)S +3700(read)S +3910(cursor,)S +4223(etc\),)S +4436(and)S +4618(an)S +4750(optional)S +5116(data)S +5320(packet)S +3912 V +1260(containing)S +1712(e.g.)S +1886(pixels.)S +2180(It)S +2271(is)S +2368(beyond)S +2692(the)S +2844(scope)S +3101(of)S +3214(this)S +3390(document)S +3815(to)S +3924(describe)S +4287(fully)S +4507(the)S +4660(details)S +4952(of)S +5066(the)S +5219(protocol;)S +4032 V +1260(interested)S +1678(users)S +1913(should)S +2210(contact)S +10 I +2528(iraf@noao.edu)S +10 R +3164(for)S +3310(further)S +3611(information.)S +4320 V +9 B +900(FRAME)S +1257(BUFFERS)S +4440 V +10 R +1260(XImtool)S +1630(starts)S +1872(up)S +2003(using)S +2251(default)S +2560(frame)S +2824(bu)S +2924 H + (f)show 10 -.5 mul h (f)show +10 R +2985(er)S +3094(size)S +3281(of)S +3396(512x512)S +3778(pixels,)S +4074(two)S +4256(\(of)S +4404(four)S +4602(possible\))S +4995(frames)S +5298(will)S +5486(be)S +4560 V +1260(created.)S +1610(When)S +1886(loading)S +2224(disk)S +2429(images)S +2750(\(i.e.)S +2943(run)S +3114(in)S +3230(standalone)S +3694(mode\))S +3986(the)S +4145(frame)S +4414(bu)S +4514 H + (f)show 10 -.5 mul h (f)show +10 R +4575(er)S +4689(con\256guration)S +5259(\256le)S +5424(will)S +4680 V +1260(be)S +1385(searched)S +1764(for)S +1911(a)S +1986(de\256ned)S +2311(frame)S +2574(bu)S +2674 H + (f)show 10 -.5 mul h (f)show +10 R +2735(er)S +2843(that)S +3024(is)S +3122(the)S +3275(same)S +3511(size)S +3697(or)S +3811(larger)S +4074(than)S +4277(the)S +4430(current)S +4743(image,)S +5044(if)S +5137(no)S +5269(suitable)S +4800 V +1260(bu)S +1360 H + (f)show 10 -.5 mul h (f)show +10 R +1421(er)S +1529(can)S +1698(be)S +1822(found)S +2085(a)S +2159(custom)S +2478(frame)S +2740(bu)S +2840 H + (f)show 10 -.5 mul h (f)show +10 R +2901(er)S +3008(the)S +3160(same)S +3395(size)S +3580(as)S +3693(the)S +3845(image)S +4119(will)S +4305(be)S +4429(created)S +4746(in)S +4854(an)S +4978(unused)S +5291(portion)S +4920 V +1260(of)S +1373(the)S +1525(con\256guration)S +2088(table.)S +2367(When)S +2635(used)S +2848(as)S +2962(a)S +3037(display)S +3357(server)S +3631(the)S +3784(frame)S +4047(bu)S +4147 H + (f)show 10 -.5 mul h (f)show +10 R +4208(er)S +4316(con\256guration)S +4880(number)S +5216(is)S +5314(passed)S +5040 V +1260(in)S +1381(by)S +1524(the)S +1689(client)S +1954(and)S +2140(loaded)S +2448(explicitly)S +2868(even)S +3098(if)S +3201(it)S +3299(means)S +3596(clipping)S +3966(the)S +4130(image.)S +4471(If)S +4579(a)S +4665(new)S +4873(frame)S +5147(bu)S +5247 H + (f)show 10 -.5 mul h (f)show +10 R +5308(er)S +5427(is)S +5536(a)S +5160 V +1260(di)S +1338 H + (f)show 10 -.5 mul h (f)show +10 R +1399(erent)S +1635(size)S +1827(than)S +2036(previously)S +2495(de\256ned)S +2826(frames,)S +3159(all)S +3296(available)S +3693(frames)S +4001(will)S +4194(be)S +4325(initialized)S +4763(and)S +4945(cleared)S +5270(prior)S +5502(to)S +5280 V +1260(the)S +1422(display.)S +1806(The)S +2001(default)S +2318(frame)S +2590(bu)S +2690 H + (f)show 10 -.5 mul h (f)show +10 R +2751(er)S +2868(con\256guration)S +3441(\256le)S +3609(is)S +3716(/usr/local/lib/imtoolrc,)S +4654(this)S +4838(can)S +5015(be)S +5148(overridden)S +5400 V +1260(by)S +1391(de\256ning)S +1750(a)S +1825(IMTOOLRC)S +2378(environment)S +2914(variable)S +3266(naming)S +3597(the)S +3750(\256le)S +3909(to)S +4019(be)S +4145(used,)S +4385(by)S +4517(creating)S +4870(a)S +4946(.imtoolrc)S +5342(\256le)S +5502(in)S +5520 V +1260(your)S +1482(home)S +1743(directory,)S +2167(or)S +2289(a)S +2372(new)S +2577(\256le)S +2744(may)S +2955(be)S +3088(speci\256ed)S +3482(using)S +3738(the)S +10 I +3899(-imtoolrc)S +10 R +4310(command)S +4743(line)S +4932(\257ag)S +5120(or)S +10 I +5241(imtoolrc)S +5640 V +10 R +1260(application)S +1734(resource.)S +5880 V +1260(The)S +1445(format)S +1741(of)S +1854(the)S +2006(frame)S +2268(bu)S +2368 H + (f)show 10 -.5 mul h (f)show +10 R +2429(er)S +2536(con\256guration)S +3099(\256le)S +3257(is)S +6120 V +10 I +1410(con\256gno)S +1784(nframes)S +2136(width)S +2389(height)S +2669([extra)S +2943(\256elds])S +6240 V +10 R +1290(e.g.)S +6360 V +1560(1)S +1670(2)S +1780(512)S +1990(512)S +6480 V +1560(2)S +1670(2)S +1780(800)S +1990(800)S +6600 V +1560(3)S +1670(1)S +1750(1024)S +1980(1024)S +2480(#)S +2560(comment)S +6720 V +1560(:)S +1648(:)S +1766(:)S +1914(:)S +6960 V +1260(At)S +1420(most)S +1675(128)S +1885(frame)S +2177(bu)S +2277 H + (f)show 10 -.5 mul h (f)show +10 R +2338(er)S +2475(sizes)S +2730(may)S +2963(be)S +3118(de\256ned,)S +3498(each)S +3741(con\256guration)S +4335(may)S +4568(de\256ne)S +4873(up)S +5034(to)S +5173(4)S +5284(frames,)S +7080 V +1260(con\256guration)S +1823(numbers)S +2197(need)S +2415(not)S +2573(be)S +2697(sequential.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(8)S +7920 V +EP +%%Page: 9 9 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(NOTE:)S +10 R +1640(When)S +1911(de\256ning)S +2272(a)S +2349(new)S +2548(frame)S +2813(bu)S +2913 H + (f)show 10 -.5 mul h (f)show +10 R +2974(er)S +3084(for)S +3233(use)S +3399(with)S +3610(client)S +3865(software)S +4241(such)S +4457(as)S +4573(IRAF)S +4834(the)S +4990(user)S +5190(must)S +5419(also)S +1080 V +1260(remember)S +1694(to)S +1802(de\256ne)S +2076(those)S +2317(frame)S +2579(bu)S +2679 H + (f)show 10 -.5 mul h (f)show +10 R +2740(ers)S +2886(in)S +2994(the)S +3146(IRAF)S +10 I +3404(dev$graphcap)S +10 R +4005(\256le.)S +1368 V +9 B +900(MARKERS)S +1488 V +10 R +1260(Although)S +1668(ximtool)S +2010(doesn't)S +2334(do)S +2464(much)S +2717(with)S +2926(markers)S +3278(currently,)S +3694(they)S +3897(are)S +4049(a)S +4124(general)S +4448(feature)S +4755(of)S +4869(the)S +10 I +5022(Gterm)S +10 R +5308(widget)S +1608 V +1260(and)S +1450(are)S +1616(used)S +1844(more)S +2094(extensively)S +2594(in)S +2717(other)S +2967(programs)S +3389(\(e.g.)S +3611(the)S +3778(prototype)S +4206(IRAF)S +4479(science)S +4817(GUI)S +5039(applications\).)S +1728 V +1260(XImtool)S +1639(uses)S +1851(markers)S +2212(for)S +2368(the)S +2530(marker)S +2852(zoom)S +3114(feature)S +3430(discussed)S +3853(above,)S +4156(and)S +4340(also)S +4541(for)S +4697(the)S +4860(panner,)S +5197(magni\256er)S +1848 V +1260(and)S +1439(the)S +1596(coordinates)S +2091(box.)S +2301(All)S +2464(markers)S +2820(share)S +3064(some)S +3309(of)S +3426(the)S +3582(same)S +3821(characteristics,)S +4450(so)S +4573(it)S +4663(is)S +4764(worthwhile)S +5253(learning)S +1968 V +1260(basic)S +1495(marker)S +1807(manipulation)S +2365(keystrokes.)S +2136 V +10 B +1260(o)S +10 R +1410(MB1)S +1646(anywhere)S +2063(inside)S +2332(a)S +2406(marker)S +2718(may)S +2920(be)S +3044(used)S +3257(to)S +3365(drag)S +3572(the)S +3724(marker.)S +2304 V +10 B +1260(o)S +10 R +1410(MB1)S +1646(near)S +1847(a)S +1921(marker)S +2233(corner)S +2517(or)S +2630(edge,)S +2873(depending)S +3319(on)S +3449(the)S +3601(type)S +3803(of)S +3916(marker,)S +4253(resizes)S +4554(the)S +4706(marker.)S +2472 V +10 B +1260(o)S +10 R +1410(Shift-MB1)S +1874(on)S +2004(the)S +2156(corner)S +2440(of)S +2553(most)S +2778(markers)S +3129(will)S +3315(rotate)S +3572(the)S +3724(marker.)S +2640 V +10 B +1260(o)S +10 R +1410(Markers)S +1775(stack,)S +2038(if)S +2132(you)S +2315(have)S +2536(several)S +2851(markers)S +3205(and)S +3382(you)S +3565(put)S +3726(one)S +3903(on)S +4037(top)S +4199(of)S +4316(the)S +4472(other.)S +4736(The)S +4925(active)S +5197(marker)S +5513(is)S +2760 V +1410(highlighted)S +1909(to)S +2030(tell)S +2201(you)S +2394(which)S +2681(of)S +2807(the)S +2972(stacked)S +3314(markers)S +3678(is)S +3788(active.)S +4094(If)S +4203(the)S +4368(markers)S +4732(overlap,)S +5099(this)S +5287(will)S +5486(be)S +2880 V +1410(marker)S +1722("on)S +1893(top")S +2092(in)S +2200(the)S +2352(stacking)S +2715(order.)S +3048 V +10 B +1260(o)S +10 R +1410(MB2)S +1646(in)S +1754(the)S +1906(body)S +2136(of)S +2249(a)S +2323(marker)S +2635("lowers")S +3013(the)S +3165(marker,)S +3502(i.e.)S +3654(moves)S +3945(it)S +4031(to)S +4139(the)S +4291(bottom)S +4605(of)S +4718(the)S +4870(stacking)S +5233(order.)S +3216 V +10 B +1260(o)S +10 R +1410(Delete)S +1700(or)S +1813(backspace)S +2252(in)S +2360(a)S +2434(marker)S +2746(deletes)S +3053(it.)S +3384 V +10 B +1260(o)S +10 R +1410(Markers)S +1789(have)S +2024(their)S +2254(own)S +2473(translation)S +2942(resources)S +3365(and)S +3557(so)S +3694(the)S +3864(default)S +4189(keystroke)S +4625(commands)S +5106(will)S +5310(not)S +5486(be)S +3504 V +1410(recognized)S +1877(when)S +2123(the)S +2275(cursor)S +2554(is)S +2651(in)S +2759(a)S +2833(marker.)S +3672 V +1260(For)S +1433(example,)S +1830(try)S +1976(placing)S +2305(the)S +2462(pointer)S +2780(anywhere)S +3202(in)S +3315(the)S +3472(coords)S +3773(box,)S +3983(then)S +4190(press)S +4430(MB1)S +4671(and)S +4850(hold)S +5063(it)S +5154(down,)S +5436(and)S +3792 V +1260(drag)S +1474(the)S +1633(coords)S +1936(box)S +2123(marker)S +2442(somewhere)S +2933(else)S +3125(on)S +3262(the)S +3421(screen.)S +3737(You)S +3946(can)S +4121(also)S +4319(resize)S +4588(the)S +4746(coords)S +5048(box)S +5234(by)S +5370(drag-)S +3912 V +1260(ging)S +1478(a)S +1562(corner,)S +1881(or)S +2004(delete)S +2282(it)S +2379(with)S +2598(the)S +2761(delete)S +3040(or)S +3164(backspace)S +3614(key.)S +3824(\(The)S +4053(Initialize)S +4449(button)S +4746(will)S +4943(get)S +5106(the)S +5269(original)S +4032 V +1260(coords)S +1556(box)S +1736(back)S +1954(if)S +2045(you)S +2225(delete)S +2493(it,)S +2604(or)S +2717(you)S +2897(can)S +3065(reset)S +3283(the)S +3435(toggle)S +3715(in)S +3823(the)S +3975(control)S +4288(panel\).)S +4320 V +9 B +1080(PANNER)S +1482(MARKER)S +4440 V +10 R +1260(The)S +1449(panner)S +1754(window)S +2110(always)S +2421(displays)S +2783(the)S +2939(full)S +3112(frame)S +3379(bu)S +3479 H + (f)show 10 -.5 mul h (f)show +10 R +3540(er.)S +3677(Try)S +3856(setting)S +4158(the)S +4315(frame)S +4582(bu)S +4682 H + (f)show 10 -.5 mul h (f)show +10 R +4743(er)S +4855(con\256guration)S +5423(to)S +5536(a)S +4560 V +1260(nonsquare)S +1708(frame)S +1978(bu)S +2078 H + (f)show 10 -.5 mul h (f)show +10 R +2139(er)S +2254(\(e.g.)S +2469(imtcryo\))S +2851(and)S +3033(then)S +3243(displaying)S +3698(a)S +3780(square)S +4078(image)S +4360(\(e.g.)S +4575(dev$pix\))S +4968(and)S +5150(the)S +5309(panner)S +4680 V +1260(will)S +1446(show)S +1687(you)S +1867(exactly)S +2185(where)S +2458(the)S +2610(image)S +2884(has)S +3047(been)S +3265(loaded)S +3561(into)S +3747(the)S +3899(frame.)S +4920 V +1260(The)S +1450(panner)S +1756(window)S +2113(uses)S +2321(two)S +2507(markers,)S +2889(one)S +3069(for)S +3221(the)S +3379(window)S +3737(border)S +4033(and)S +4213(one)S +4393(to)S +4507(mark)S +4748(the)S +4906(displayed)S +5325(region)S +5040 V +1260(of)S +1379(the)S +1537(frame.)S +1830(Most)S +2072(of)S +2191(the)S +2349(usual)S +2596(marker)S +2914(keystrokes)S +3377(mentioned)S +3835(below)S +4115(apply)S +4373(to)S +4487(these)S +4728(markers)S +5085(as)S +5204(well,)S +5436(e.g.)S +5160 V +1260(you)S +1443(can)S +1614(use)S +1780(MB1)S +2019(to)S +2130(reposition)S +2563(on)S +2696(the)S +2851(panner)S +3156(window)S +3512(within)S +3802(the)S +3958(main)S +4192(image)S +4470(display)S +4793(window,)S +5174(or)S +5291(to)S +5403(drag)S +5280 V +1260(the)S +1414(region)S +1701(marker)S +2015(within)S +2303(the)S +2457(panner)S +2760(\(pan)S +2969(the)S +3123(image\).)S +3456(Resizing)S +3837(the)S +3990(region)S +4276(marker)S +4589(zooms)S +4881(the)S +5034(image;)S +5337(this)S +5513(is)S +5400 V +1260(a)S +1336(non-aspect)S +1800(constrained)S +2292(zoom.)S +2571(The)S +2758(panner)S +3061(window)S +3415(itself)S +3647(can)S +3817(be)S +3943(resized)S +4257(by)S +4389(dragging)S +4776(a)S +4852(corner)S +5138(with)S +5349(MB1.)S +5520 V +1260(Typing)S +1579(delete)S +1847(or)S +1960(backspace)S +2399(anywhere)S +2816(in)S +2924(the)S +3076(panner)S +3377(window)S +3729(deletes)S +4036(the)S +4188(panner.)S +5760 V +1260(A)S +1362(special)S +1669(case)S +1870(is)S +1967(MB2.)S +2228(Hitting)S +2542(MB2)S +2778(anywhere)S +3195(in)S +3303(the)S +3455(panner)S +3757(window)S +4110(pans)S +4324(the)S +4477(image)S +4752(to)S +4861(that)S +5042(point.)S +5304(This)S +5513(is)S +5880 V +1260(analogous)S +1695(to)S +1803(hitting)S +2095(MB2)S +2331(in)S +2439(the)S +2591(main)S +2821(display)S +3140(window)S +3492(to)S +3600(pan)S +3774(the)S +3926(image.)S +6120 V +1260(The)S +1447(panner)S +1750(marker)S +2064(can)S +2234(be)S +2360(disabled)S +2725(by)S +2857(de\256ning)S +3218(the)S +10 I +3373(displayPanner)S +10 R +3989(GUI)S +4199(resource,)S +4594(its)S +4722(size)S +4910(and)S +5087(location)S +5442(can)S +6240 V +1260(be)S +1384(controlled)S +1819(using)S +2066(the)S +10 I +2218(pannerArea)S +10 R +2725(and)S +10 I +2899(pannerGeom)S +10 R +3450(GUI)S +3657(resources)S +4063(respectively.)S +6528 V +9 B +1080(MAGNIFIER)S +1642(MARKER)S +6648 V +10 R +1260(The)S +1445(magni\256er)S +1858(marker)S +2170(can)S +2338(be)S +2462(used)S +2676(to)S +2785(zoom)S +3038(in)S +3147(on)S +3278(a)S +3353(small)S +3601(area)S +3797(around)S +4105(the)S +4258(cursor.)S +4593(It)S +4685(will)S +4872(be)S +4997(updated)S +5344(as)S +5458(the)S +6768 V +1260(cursor)S +1552(moves)S +1856(but)S +2027(only)S +2248(for)S +2407(small)S +2666(motions)S +3031(\(either)S +3333(mouse)S +3636(movement)S +4100(or)S +4225(with)S +4445(the)S +4609(cursor)S +4900(movement)S +5364(keys-)S +6888 V +1260(trokes\))S +1570(to)S +1681(minimize)S +2092(the)S +2247(impact)S +2552(on)S +2685(the)S +2840(system.)S +3207(The)S +3396(zoom)S +3652(factor)S +3918(is)S +4019(expressed)S +4446(as)S +4563(some)S +4808(fraction)S +5152(of)S +5269(the)S +5425(size)S +7008 V +1260(of)S +1381(the)S +1541(magni\256er)S +1962(marker)S +2282(itself.)S +2575(The)S +2768(default)S +3083(zoom)S +3343(is)S +3448(4,)S +3561(i.e.)S +3721(the)S +3881(area)S +4084(in)S +4200(the)S +4359(marker)S +4678(represents)S +5119(and)S +5300(area)S +5502(in)S +7128 V +1260(the)S +1417(image)S +1696(that's)S +1953(one-fourth)S +2409(the)S +2566(size)S +2756(of)S +2874(the)S +3031(marker.)S +3403(Other)S +3665(zoom)S +3922(factors)S +4228(may)S +4435(be)S +4564(selected)S +4920(using)S +5172(the)S +5330(popup)S +7248 V +1260(menu)S +1512(created)S +1829(by)S +1959(hitting)S +2251(MB1)S +2487(in)S +2595(the)S +2747(marker.)S +7728 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5530(9)S +7920 V +EP +%%Page: 10 10 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(By)S +1414(default)S +1728(the)S +1887(magni\256er)S +2307(marker)S +2626(is)S +2730(not)S +2895(visible,)S +3224(to)S +3339(toggle)S +3626(it)S +3720(select)S +3985(the)S +10 I +4145(Magni\256er)S +10 R +4577(option)S +4871(from)S +5103(the)S +10 I +5263(Options)S +1080 V +10 R +1260(menubar)S +1660(button.)S +2022(Alternatively,)S +2625(for)S +2792(just)S +2988(a)S +3083(quick)S +3356(look)S +3584(holding)S +3940(down)S +4212(the)S +4384(Shift)S +4629(and)S +4823(MB1)S +5079(buttons)S +5424(will)S +1200 V +1260(display)S +1579(the)S +1731(marker)S +2043(until)S +2257(the)S +2409(button)S +2695(is)S +2792(released.)S +1440 V +1260(The)S +1453(magni\256er)S +1874(marker)S +2194(can)S +2370(be)S +2502(disabled)S +2873(by)S +3011(de\256ning)S +3377(the)S +10 I +3537(displayMagni\256er)S +10 R +4258(GUI)S +4473(resource,)S +4873(its)S +5006(size)S +5199(and)S +5381(loca-)S +1560 V +1260(tion)S +1446(can)S +1614(be)S +1738(controlled)S +2173(using)S +2420(the)S +10 I +2572(magni\256erArea)S +10 R +3179(and)S +10 I +3353(magni\256erGeom)S +10 R +4004(GUI)S +4211(resources)S +4617(respectively.)S +1848 V +9 B +1080(COORDS)S +1492(BOX)S +1714(MARKER)S +1968 V +10 R +1260(XImtool)S +1629(provides)S +2003(a)S +2077(limited)S +2391(notion)S +2677(of)S +2790(world)S +3054(coordinates,)S +3570(allowing)S +3951(frame)S +4214(bu)S +4314 H + (f)show 10 -.5 mul h (f)show +10 R +4375(er)S +4483(pixel)S +4714(coordinates)S +5205(and)S +5380(pixel)S +2088 V +1260(values)S +1546(to)S +1655(be)S +1780(converted)S +2204(to)S +2312(some)S +2553(arbitrary)S +2926(linear)S +3183(client-de\256ned)S +3762(coordinate)S +4213(system.)S +4546(The)S +4731(coords)S +5027(box)S +5207(feature)S +5513(is)S +2208 V +1260(used)S +1473(to)S +1581(display)S +1900(these)S +2135(world)S +2398(coordinates)S +2888(as)S +3001(the)S +3153(pointer)S +3466(is)S +3563(moved)S +3865(about)S +4117(in)S +4225(the)S +4377(image)S +4651(window.)S +2448 V +1260(The)S +1445(quantities)S +1865(displayed)S +2279(in)S +2388(the)S +2541(coords)S +2838(box)S +3019(are)S +3171(X,)S +3299(Y,)S +3427(and)S +3602(Z:)S +3722(the)S +3875(X,Y)S +4075(world)S +4339(coordinates)S +4830(of)S +4944(the)S +5097(pointer,)S +5436(and)S +2568 V +1260(Z,)S +1379(the)S +1534(world)S +1800(equivalent)S +2249(of)S +2365(the)S +2520(pixel)S +2753(value)S +3002(under)S +3262(the)S +3417(pointer.)S +3758(All)S +3919(coordinate)S +4373(systems)S +4723(are)S +4877(linear.)S +5161(The)S +5348(preci-)S +2688 V +1260(sion)S +1466(of)S +1588(a)S +1671(displayed)S +2093(quantity)S +2460(is)S +2566(limited)S +2889(by)S +3028(the)S +3189(range)S +3449(of)S +3571(values)S +3865(of)S +3988(the)S +4150(associated)S +4600(raw)S +4789(frame)S +5061(bu)S +5161 H + (f)show 10 -.5 mul h (f)show +10 R +5222(er)S +5339(value.)S +2808 V +1260(For)S +1431(example,)S +1826(if)S +1919(the)S +2073(display)S +2394(window)S +2748(is)S +2846(512x512)S +3227(only)S +3436(512)S +3617(coordinate)S +4069(values)S +4355(are)S +4507(possible)S +4866(in)S +4975(either)S +5233(axis)S +5425(\(the)S +2928 V +1260(positional)S +1687(precision)S +2085(can)S +2256(be)S +2383(increased)S +2792(however)S +3168(by)S +3301(zooming)S +3684(the)S +3839(image\).)S +4174(More)S +4423(seriously,)S +4842(at)S +4947(most)S +5175(about)S +5430(200)S +3048 V +1260(pixel)S +1501(values)S +1797(can)S +1976(be)S +2111(displayed)S +2534(since)S +2779(this)S +2964(is)S +3071(the)S +3233(limit)S +3463(on)S +3603(the)S +3765(range)S +4026(of)S +4149(pixel)S +4389(values)S +4684(loaded)S +4990(into)S +5186(the)S +5348(frame)S +3168 V +1260(bu)S +1360 H + (f)show 10 -.5 mul h (f)show +10 R +1421(er.)S +1553(If)S +1649(a)S +1723(display)S +2042(pixel)S +2272(is)S +2369(saturated)S +2759(a)S +2833("+")S +3001(will)S +3187(be)S +3311(displayed)S +3724(after)S +3936(the)S +4088(intensity)S +4463(value.)S +3408 V +1260(The)S +1446(coords)S +1743(box)S +1924(is)S +2022(a)S +2097(text)S +2278(marker,)S +2616(it)S +2703(can)S +2872(be)S +2997(moved)S +3300(and)S +3475(resized)S +3788(with)S +3997(the)S +4150(pointer)S +4464(like)S +4645(any)S +4820(other)S +5056(marker.)S +5425(The)S +3528 V +1260(coords)S +1561(box)S +1746(marker)S +2063(can)S +2236(be)S +2365(disabled)S +2733(by)S +2868(de\256ning)S +3231(the)S +10 I +3388(displayCoords)S +10 R +4007(GUI)S +4219(resource,)S +4616(its)S +4746(location)S +5103(can)S +5275(be)S +5403(con-)S +3648 V +1260(trolled)S +1551(by)S +1681(the)S +10 I +1833(wcsboxGeom)S +10 R +2395(GUI)S +2602(resource.)S +3936 V +9 B +1080(MARKER)S +1517(MENU)S +1819(OPTIONS)S +4056 V +10 R +1260(Except)S +1575(for)S +1729(the)S +1889(panner)S +2198(and)S +2380(WCS)S +2635(markers,)S +3019(MB3)S +3263(\(mouse)S +3595(button)S +3889(3\))S +4010(calls)S +4231(up)S +4369(the)S +4529(marker)S +4849(menu)S +5109(providing)S +5536(a)S +4176 V +1260(limited)S +1574(set)S +1715(of)S +1828(functions)S +2230(common)S +2610(to)S +2718(all)S +2848(markers:)S +4344 V +10 B +1260(o)S +10 R +1410(Zoom)S +1686(does)S +1906(an)S +2037(equal)S +2291(aspect)S +2578(zoom)S +2838(of)S +2959(the)S +3119(region)S +3412(outlined)S +3778(by)S +3916(the)S +4076(marker.)S +4421(In)S +4542(this)S +4725(way)S +4929(you)S +5117(can)S +5293(mark)S +5536(a)S +4464 V +1410(region)S +1695(of)S +1808(the)S +1960(image)S +2234(and)S +2408(zoom)S +2660(it)S +2746(up.)S +4632 V +10 B +1260(o)S +10 R +1410(Fill)S +1597(exactly)S +1933(zooms)S +2242(the)S +2412(area)S +2625(outlined)S +3001(by)S +3149(the)S +3319(marker,)S +3674(making)S +4022(it)S +4126(\256ll)S +4286(the)S +4456(display)S +4793(window.)S +5188(Since)S +5458(the)S +4752 V +1410(marker)S +1722(is)S +1819(not)S +1977(likely)S +2235(to)S +2343(be)S +2467(exactly)S +2785(square,)S +3100(the)S +3252(aspect)S +3531(ratio)S +3744(of)S +3857(the)S +4009(resultant)S +4383(image)S +4657(will)S +4843(not)S +5001(be)S +5125(unitary.)S +4920 V +10 B +1260(o)S +10 R +1410(Print)S +1643(prints)S +1909(the)S +2069(region)S +2362(outlined)S +2728(by)S +2866(the)S +3027(marker)S +3348(to)S +3465(the)S +3626(printer)S +3931(or)S +4053(\256le)S +4220(currently)S +4619(con\256gured)S +5085(by)S +5224(the)S +5385(Print)S +5040 V +1410(Panel.)S +5208 V +10 B +1260(o)S +10 R +1410(Save)S +1634(saves)S +1880(the)S +2032(region)S +2317(outlined)S +2675(by)S +2805(the)S +2957(marker)S +3269(to)S +3377(the)S +3529(\256le)S +3687(currently)S +4077(con\256gured)S +4534(by)S +4664(the)S +4816(Save)S +5040(Panel.)S +5376 V +10 B +1260(o)S +10 R +1410(Info)S +1606(prints)S +1864(a)S +1938(description)S +2412(of)S +2525(the)S +2677(marked)S +3006(region.)S +3316(The)S +3501(text)S +3681(is)S +3778(printed)S +4091(in)S +4199(the)S +4351(Info)S +4547(Panel.)S +5544 V +10 B +1260(o)S +10 R +1410(Unrotate)S +1789(unrotates)S +2185(a)S +2259(rotated)S +2566(marker.)S +5712 V +10 B +1260(o)S +10 R +1410(Color)S +1668(is)S +1765(a)S +1839(menu)S +2091(of)S +2204(possible)S +2562(marker)S +2874(colors.)S +5880 V +10 B +1260(o)S +10 R +1410(Type)S +1651(is)S +1754(a)S +1834(menu)S +2092(of)S +2211(possible)S +2575(marker)S +2893(types.)S +3165(This)S +3379(is)S +3482(still)S +3669(a)S +3749(little)S +3969(buggy)S +4256(and)S +4437(it)S +4530(isn't)S +4745(very)S +4959(useful,)S +5265(but)S +5430(you)S +6000 V +1410(can)S +1578(use)S +1741(it)S +1827(to)S +1935(play)S +2137(with)S +2345(di)S +2423 H + (f)show 10 -.5 mul h (f)show +10 R +2484(erent)S +2713(types)S +2954(of)S +3067(markers.)S +6168 V +10 B +1260(o)S +10 R +1410(Destroy)S +1760(destroys)S +2127(the)S +2283(marker.)S +2624(You)S +2830(can)S +3002(also)S +3197(hit)S +3337(the)S +3493(delete)S +3766(or)S +3884(backspace)S +4328(key)S +4507(in)S +4620(a)S +4699(marker)S +5016(to)S +5129(destroy)S +5458(the)S +6288 V +1410(marker.)S +6576 V +9 B +900(CONTROL)S +1382(PANEL)S +6696 V +10 R +1260(XImtool)S +1636(has)S +1806(a)S +1887(control)S +2207(panel)S +2460(which)S +2741(can)S +2917(be)S +3049(used)S +3270(to)S +3386(exercise)S +3750(most)S +3983(of)S +4104(the)S +4264(capabilities)S +4757(the)S +4917(program)S +5293(has)S +5464(for)S +6816 V +1260(image)S +1544(display.)S +1928(The)S +2123(control)S +2445(panel)S +2700(can)S +2877(be)S +3010(accessed)S +3397(either)S +3663(via)S +3824(the)S +10 B +3985(Options)S +10 R +4364(menu)S +4625(from)S +4858(the)S +5019(main)S +5258(window)S +6936 V +1260(menubar,)S +1664(or)S +1777(by)S +1907(pressing)S +2270(the)S +2422(leftmost)S +2780(button)S +3066(in)S +3174(the)S +3326(row)S +3511(of)S +3624(buttons)S +3949(at)S +4051(the)S +4203(upper)S +4460(right)S +4679(side)S +4870(of)S +4983(the)S +5135(display.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(10)S +7920 V +EP +%%Page: 11 11 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(VIEW)S +1357(CONTROLS)S +1080 V +10 R +1260(The)S +10 B +1452(Frame)S +1771(box)S +10 R +1964(will)S +2157(list)S +2317(only)S +2532(the)S +2692(frame)S +2962(bu)S +3062 H + (f)show 10 -.5 mul h (f)show +10 R +3123(ers)S +3277(you)S +3465(currently)S +3863(have)S +4089(de\256ned.)S +4476(Currently,)S +4922(the)S +5082(only)S +5298(way)S +5502(to)S +1200 V +1260(destroy)S +1594(a)S +1678(frame)S +1950(bu)S +2050 H + (f)show 10 -.5 mul h (f)show +10 R +2111(er)S +2228(is)S +2335(to)S +2453(change)S +2775(the)S +2937(frame)S +3209(bu)S +3309 H + (f)show 10 -.5 mul h (f)show +10 R +3370(er)S +3487(con\256guration,)S +4085(new)S +4291(frame)S +4563(bu)S +4663 H + (f)show 10 -.5 mul h (f)show +10 R +4724(ers)S +4880(\(up)S +5052(to)S +5169(4\))S +5291(will)S +5486(be)S +1320 V +1260(created)S +1586(automatically)S +2169(if)S +2269(requested)S +2690(by)S +2829(the)S +2990(client.)S +3306(The)S +3500(number)S +3845(of)S +3968(frame)S +4240(bu)S +4340 H + (f)show 10 -.5 mul h (f)show +10 R +4401(ers)S +4557(created)S +4884(at)S +4996(startup)S +5308(can)S +5486(be)S +1440 V +1260(controlled)S +1695(using)S +1942(the)S +10 I +2094(-nframes)S +10 R +2479(command-line)S +3086(switch)S +3377(or)S +3490(the)S +10 I +3642(defNFrames)S +10 R +4166(resource.)S +1680 V +1260(The)S +10 B +1453(text)S +1651(display)S +10 R +1996(window)S +2356(gives)S +2605(the)S +2765(\256eld)S +2981(X,Y)S +3189(center,)S +3496(X,Y)S +3704(scale)S +3942(factors,)S +4277(and)S +4460(the)S +4621(X,Y)S +4829(zoom)S +5090(factors.)S +5425(The)S +1800 V +1260(scale)S +1501(factor)S +1774(and)S +1959(the)S +2122(zoom)S +2385(factor)S +2658(will)S +2855(be)S +2990(the)S +3153(same)S +3399(unless)S +10 I +3690(autoscale)S +10 R +4114(is)S +4222(enabled.)S +4598(The)S +4794(scale)S +5034(is)S +5142(in)S +5261(units)S +5497(of)S +1920 V +1260(display)S +1583(pixels)S +1856(per)S +2017(frame)S +2283(bu)S +2383 H + (f)show 10 -.5 mul h (f)show +10 R +2444(er)S +2555(pixel,)S +2814(and)S +2992(is)S +3093(an)S +3221(absolute)S +3589(measure)S +3956(\(it)S +4080(doesn't)S +4409(matter)S +4699(whether)S +5055(or)S +5173(not)S +5336(autos-)S +2040 V +1260(cale)S +1464(is)S +1575(enabled\).)S +1987(Zoom)S +2270(is)S +2381(relative)S +2724(to)S +2845(the)S +3010(autoscale)S +3424(factor,)S +3724(which)S +4011(is)S +4121(1.0)S +4289(if)S +4393(autoscaling)S +4891(is)S +5001(disabled.)S +5402(This)S +2160 V +1260(information)S +1762(is)S +1859(also)S +2050(presented)S +2462(in)S +2570(the)S +2722(Info)S +2918(panel.)S +2400 V +1260(The)S +1446(numbers)S +1821(in)S +1930(the)S +10 B +2083(Zoom)S +2364(box)S +10 R +2551(are)S +2703(zoom)S +2956(factors.)S +3283(Blue)S +3503(numbers)S +3878(zoom,)S +4156(red)S +4314(numbers)S +4689(dezoom.)S +10 I +5061(Zoom)S +5321(In)S +10 R +5436(and)S +2520 V +10 I +1260(Zoom)S +1522(Out)S +10 R +1706(may)S +1912(be)S +2039(used)S +2255(to)S +2366(go)S +2499(to)S +2610(larger)S +2875(or)S +2991(smaller)S +3318(zoom)S +3573(factors,)S +3902(e.g.)S +4079("Ctrl-5")S +4433(followed)S +4821(by)S +4954("Zoom)S +5267(In")S +5424(will)S +2640 V +1260(get)S +1421(you)S +1610(to)S +1727(zoom)S +1988(factor)S +2259(10.)S +2453(Speci\256c)S +2814(zoom)S +3075(factors)S +3385(may)S +3596(also)S +3796(be)S +3929(accessed)S +4316(directly)S +4660(as)S +4782(Control)S +5128(keystrokes,)S +2760 V +1260(e.g.)S +1448(Ctrl-5)S +1731(will)S +1931(set)S +2086(zoom)S +2352(factor)S +2628(5.)S +10 I +2747(Center)S +10 R +3063(centers)S +3389(the)S +3555(\256eld.)S +10 I +3832(Toggle)S +4154(Zoom)S +10 R +4426(toggles)S +4758(between)S +5133(the)S +5298(current)S +2880 V +1260(zoom/center)S +1783(values,)S +2093(and)S +2267(the)S +2419(unzoomed)S +2865(image.)S +3120 V +10 I +1260(Aspect)S +10 R +1564(recomputes)S +2062(the)S +2222(view)S +2454(so)S +2581(that)S +2769(the)S +2929(aspect)S +3217(ratio)S +3439(is)S +3545(1.0.)S +3734(Aspect)S +4050(also)S +4250(integerizes)S +4721(the)S +4882(zoom)S +5143(factor)S +5414(\(use)S +3240 V +1260(the)S +1412(version)S +1736(in)S +1844(the)S +1996(View)S +2242(menu)S +2494(if)S +2585(you)S +2765(don't)S +3006(want)S +3230(integerization\).)S +3480 V +10 I +1260(Fit)S +1408(Frame)S +10 R +1706(makes)S +1993(the)S +2147(display)S +2468(window)S +2822(the)S +2976(same)S +3213(size)S +3400(as)S +3515(the)S +3669(frame)S +3933(bu)S +4033 H + (f)show 10 -.5 mul h (f)show +10 R +4094(er.)S +4228(Note)S +4454(that)S +4636(autoscale)S +5039(has)S +5204(much)S +5458(the)S +3600 V +1260(same)S +1499(e)S +1543 H + (f)show 10 -.5 mul h (f)show +10 R +1604(ect,)S +1779(and)S +1957(allows)S +2252(you)S +2436(to)S +2548(resize)S +2814(the)S +2970(display)S +3293(window)S +3649(to)S +3761(any)S +3938(size)S +4126(you)S +4309(want,)S +4561(or)S +4677(view)S +4904(images)S +5220(too)S +5381(large)S +3720 V +1260(to)S +1368(\256t)S +1482(on)S +1612(the)S +1764(screen.)S +4008 V +9 B +1080(ENHANCEMENT)S +1827(CONTROLS)S +4128 V +10 R +1260(At)S +1398(the)S +1558(top)S +1724(is)S +1829(a)S +1911(scrolled)S +2265(list)S +2426(of)S +2547(all)S +2685(the)S +2845(available)S +3243(colormaps.)S +3722(Click)S +3977(on)S +4115(the)S +4275(one)S +4457(you)S +4645(want)S +4878(to)S +4995(load.)S +5231(You)S +5442(can)S +4248 V +1260(add)S +1447(your)S +1673(own)S +1888(colormaps)S +2347(to)S +2468(this)S +2656(list)S +2822(by)S +2965(de\256ning)S +3336(the)S +10 I +3501(cmap[12])S +10 R +3938(or)S +10 I +4063(cmapDir[12])S +10 R +4638(command)S +5074(line)S +5266(\257ags)S +5497(or)S +4368 V +1260(application)S +1734(resources.)S +4608 V +1260(The)S +1451(two)S +1637(sliders)S +1934(adjust)S +2209(the)S +2367(contrast)S +2719(\(upper)S +3015(slider\))S +3306(and)S +3486(brightness)S +3933(\(lower)S +4229(slider\))S +4520(of)S +4640(the)S +4799(display.)S +5150(The)S +10 I +5342(Invert)S +4728 V +10 R +1260(button)S +1549(inverts)S +1854(the)S +2009(colormap)S +2419(\(multiples)S +2858(the)S +3013(contrast)S +3362(by)S +3495(-1.0\).)S +3744(Note)S +3971(that)S +4154(due)S +4331(to)S +4442(the)S +4597(use)S +4763(of)S +4879(the)S +5033(private)S +5342(color-)S +4848 V +1260(map)S +1464(the)S +1618(sliders)S +1911(are)S +2064(a)S +2140(bit)S +2278(sluggish)S +2644(when)S +2892(dragged)S +3245(to)S +3355(window)S +3709(the)S +3863(display.)S +4209(If)S +4307(this)S +4484(is)S +4583(annoying,)S +5013(using)S +5263(MB3)S +5502(in)S +4968 V +1260(the)S +1412(display)S +1731(window)S +2083(is)S +2180(faster.)S +5208 V +1260(The)S +10 I +1454(Normalize)S +10 R +1910(button)S +2205(\(on)S +2377(the)S +2538(bottom)S +2861(of)S +2983(the)S +3145(control)S +3468(panel\))S +3757(will)S +3953(normalize)S +4392(the)S +4554(enhancement,)S +5145(i.e.)S +5307(set)S +5458(the)S +5328 V +1260(contrast)S +1613(and)S +1794(brightness)S +2242(to)S +2357(the)S +2516(default)S +2830(one-to-one)S +3299(values)S +3590(\(1.0,)S +3809(0.5\).)S +4028(This)S +4242(is)S +4345(the)S +4503(preferred)S +4903(setting)S +5206(for)S +5358(many)S +5448 V +1260(of)S +1381(the)S +1541(pseudocolor)S +2067(colortables)S +2543(and)S +2725(for)S +2879(private)S +3194(colormaps)S +3648(loaded)S +3952(from)S +4184(disk)S +4389(images.)S +4735(The)S +10 I +4929(Initialize)S +10 R +5324(button)S +5568 V +1260(does)S +1473(a)S +1547(reset)S +1765(of)S +1878(the)S +2030(server.)S +5856 V +9 B +1080(BLINK)S +1397(CONTROLS)S +5976 V +10 I +1260(Blink)S +1503(frames)S +10 R +1807(is)S +1907(the)S +2062(list)S +2218(of)S +2334(frames)S +2638(to)S +2749(be)S +2876(blinked.)S +3234(When)S +3505(blink)S +3744(mode)S +3999(is)S +4099(in)S +4210(e)S +4254 H + (f)show 10 -.5 mul h (f)show +10 R +4315(ect)S +4464(ximtool)S +4809(just)S +4987(cycles)S +5269(through)S +6096 V +1260(these)S +1498(frames)S +1802(endlessly,)S +2232(pausing)S +2576("blink)S +2856(rate")S +3079(seconds)S +3428(between)S +3793(each)S +4008(frame.)S +4298(The)S +4486(same)S +4724(frame)S +4989(can)S +5160(be)S +5287(entered)S +6216 V +1260(in)S +1371(the)S +1526(list)S +1682(more)S +1920(than)S +2125(once.)S +2371(To)S +2515(program)S +2886(an)S +3013(arbitrary)S +3389(list)S +3545(of)S +3662(blink)S +3902(frames,)S +4232(hit)S +4372(the)S +4528(Reset)S +4784(button)S +5074(and)S +5252(click)S +5480(on)S +6336 V +1260(each)S +1472(blink)S +1708(frame)S +1970(button)S +2256(until)S +2470(it)S +2556(is)S +2653(set)S +2794(to)S +2902(the)S +3054(desired)S +3372(frame)S +3634(number.)S +6576 V +1260(The)S +10 I +1455(Blink)S +1706(Rate)S +10 R +1929(can)S +2107(be)S +2242(adjusted)S +2616(as)S +2740(slow)S +2970(or)S +3094(as)S +3218(fast)S +3403(as)S +3527(you)S +3718(want)S +3953(using)S +4211(the)S +4374(arrow)S +4647(buttons.)S +5008(If)S +5115(you)S +5306(set)S +5458(the)S +6696 V +1260(blink)S +1496(rate)S +1675(small)S +1922(enough)S +2246(it)S +2332(will)S +2518(go)S +2648(to)S +2756(zero,)S +2982(enabling)S +3356(single)S +3625(step)S +3816(mode)S +4068(\(see)S +4258(below\).)S +6936 V +1260(The)S +10 I +1449(Register)S +10 R +1816(button)S +2106(registers)S +2478(all)S +2612(the)S +2768(blink)S +3008(frames)S +3313(with)S +3525(the)S +3681(current)S +3997(display)S +4320(frame.)S +4612(Frames)S +4941(not)S +5104(in)S +5217(the)S +5374(blink)S +7056 V +1260(list)S +1413(are)S +1564(not)S +1722(a)S +1766 H + (f)show 10 -.5 mul h (f)show +10 R +1827(ected.)S +7296 V +1260(The)S +10 I +1446(Match)S +1732(LUTs)S +10 R +1986(button)S +2273(sets)S +2454(the)S +2607(enhancement)S +3164(of)S +3278(all)S +3409(blink)S +3646(frames)S +3948(to)S +4057(the)S +4210(same)S +4446(values)S +4733(as)S +4848(the)S +5002(display)S +5323(frame.)S +7776 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(11)S +7920 V +EP +%%Page: 12 12 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(Frames)S +1584(not)S +1742(in)S +1850(the)S +2002(blink)S +2238(list)S +2391(are)S +2542(not)S +2700(a)S +2744 H + (f)show 10 -.5 mul h (f)show +10 R +2805(ected.)S +1200 V +1260(The)S +10 I +1453(Blink)S +10 R +1702(button)S +1996(turns)S +2234(blink)S +2478(on)S +2616(and)S +2799(o)S +2849 H + (f)show 10 -.5 mul h (f)show +10 R +2910(.)S +2974(When)S +3251(the)S +3412(blink)S +3657(rate)S +3845(is)S +3951(set)S +4101(to)S +4218(zero)S +4428(the)S +4589(Blink)S +4851(button)S +5146(will)S +5341(single)S +1320 V +1260(step)S +1451(through)S +1792(the)S +1944(blink)S +2180(frames,)S +2506(one)S +2680(frame)S +2942(per)S +3099(button)S +3385(press.)S +1560 V +10 B +1260(NOTE:)S +10 R +1615(You)S +1825(can)S +2001(blink)S +2245(no)S +2383(matter)S +2677(what)S +2910(ximtool)S +3261(options)S +3595(are)S +3755(in)S +3872(e)S +3916 H + (f)show 10 -.5 mul h (f)show +10 R +3977(ect,)S +4157(but)S +4324(many)S +4585(of)S +4707(these)S +4951(will)S +5146(slow)S +5374(blink)S +1680 V +1260(down.)S +1541(To)S +1686(get)S +1842(the)S +1998(fastest)S +2287(blink)S +2527(you)S +2711(may)S +2917(want)S +3145(to)S +3257(turn)S +3451(o)S +3501 H + (f)show 10 -.5 mul h (f)show +10 R +3595(the)S +3750(panner)S +4054(and)S +4231(coords)S +4530(box,)S +4738(and)S +4915(match)S +5192(the)S +5347(LUTs)S +1800 V +1260(of)S +1382(all)S +1521(the)S +1682(blink)S +1927(frames.)S +2292(All)S +2459(the)S +2620(ximtool)S +2971(controls)S +3332(are)S +3492(fully)S +3721(active)S +3999(during)S +4300(blink)S +4546(mode,)S +4833(plus)S +5040(you)S +5230(can)S +5408(load)S +1920 V +1260(frames)S +1561(etc.)S +2208 V +9 B +1080(OPTIONS:)S +2328 V +10 B +1260(Panner)S +2448 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(panner)S +3093(marker.)S +2616 V +10 B +1260(Coords)S +1601(Box)S +2736 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(coordinate)S +3243(box)S +3423(marker.)S +2904 V +10 B +1260(Autoscale)S +3024 V +10 R +1510(If)S +1613(autoscale)S +2021(is)S +2126(enabled)S +2474(then)S +2684(at)S +2794(zoom=1,)S +3185(the)S +3345(frame)S +3615(bu)S +3715 H + (f)show 10 -.5 mul h (f)show +10 R +3776(er)S +3891(will)S +4085(be)S +4217(automatically)S +4799(scaled)S +5086(to)S +5202(\256t)S +5324(within)S +3144 V +1510(the)S +1667(display)S +1991(window.)S +2373(With)S +2608(autoscale)S +3014(disabled)S +3382(\(the)S +3572(default\),)S +3942(the)S +4099(image)S +4377(scale)S +4610(is)S +4711(more)S +4950(predictable,)S +5452(but)S +3264 V +1510(the)S +1662(image)S +1936(may)S +2138(be)S +2262(clipped)S +2586(by)S +2716(the)S +2868(display)S +3187(window,)S +3564(or)S +3677(may)S +3879(not)S +4037(\256ll)S +4179(the)S +4331(display)S +4650(window.)S +3432 V +10 B +1260(Antialiasing)S +3552 V +10 R +1510(When)S +1780(dezooming)S +2257(an)S +2384(image,)S +2686(i.e.,)S +2866(displaying)S +3316(a)S +3393(large)S +3625(image)S +3902(in)S +4013(a)S +4090(smaller)S +4417(display)S +4739(window,)S +5119(antialiasing)S +3672 V +1510(causes)S +1802(all)S +1933(the)S +2086(data)S +2283(to)S +2392(be)S +2517(used)S +2731(to)S +2840(compute)S +3215(the)S +3368(displayed)S +3782(image.)S +4082(If)S +4179(antialiasing)S +4671(is)S +4769(disabled)S +5133(then)S +5336(image)S +3792 V +1510(is)S +1607(subsampled)S +2109(to)S +2217(compute)S +2592(the)S +2745(displayed)S +3159(image.)S +3459(Antialiasing)S +3979(can)S +4148(prevent)S +4478(subsampling)S +5015(from)S +5240(omitting)S +3912 V +1510(image)S +1792(features)S +2145(that)S +2333(don't)S +2582(fall)S +2753(in)S +2869(the)S +3028(sample)S +3348(grid,)S +3571(but)S +3736(it)S +3829(is)S +3933(signi\256cantly)S +4465(slower)S +4768(than)S +4977(dezooming)S +5458(via)S +4032 V +1510(subsampling.)S +2101(The)S +2286(default)S +2593(is)S +2690(no)S +2820(antialising.)S +4200 V +10 B +1260(Tile)S +1457(Frames)S +4320 V +10 R +1510(The)S +1695(default)S +2002(display)S +2321(mode)S +2573(is)S +2670(to)S +2778(view)S +3002(one)S +3177(frame)S +3440(at)S +3543(a)S +3618(time.)S +3852(In)S +3966(tile)S +4125(frames)S +4427(mode,)S +4705(2)S +4786(or)S +4900(4)S +4981(frames)S +5283(may)S +5486(be)S +4440 V +1510(viewed)S +1834(simultaneously)S +2476(in)S +2590(the)S +2748(display)S +3073(window.)S +3486(All)S +3650(the)S +3808(usual)S +4055(operations)S +4507(\(zoom)S +4798(and)S +4977(pan,)S +5181(colortable)S +4560 V +1510(enhancement,)S +2091(cursor)S +2370(readback,)S +2784(etc.\))S +2988(still)S +3169(work)S +3404(for)S +3550(each)S +3762(frame)S +4024(even)S +4242(when)S +4488(in)S +4596(tile)S +4754(frames)S +5055(mode.)S +4728 V +10 B +1260(Warnings)S +4848 V +10 R +1510(The)S +1701(warnings)S +2103(options)S +2435(toggles)S +2761(whether)S +3119(you)S +3306(see)S +3470(warning)S +3834(dialog)S +4121(boxes)S +4391(in)S +4506(situations)S +4927(like)S +5114(overwriting)S +4968 V +1510(an)S +1634(existing)S +1981(\256le,)S +2164(clearing)S +2515(the)S +2667(frame)S +2929(bu)S +3029 H + (f)show 10 -.5 mul h (f)show +10 R +3090(er,)S +3222(etc.)S +5256 V +9 B +900(COLORMAP)S +1462(SELECTION)S +5376 V +10 R +1260(By)S +1410(default)S +1721(XImtool)S +2094(will)S +2284(display)S +2607(images)S +2924(using)S +3175(either)S +3436(a)S +3514(grayscale)S +3924(colormap)S +4335(\(e.g.)S +4576(if)S +4671(loaded)S +4971(by)S +5105(a)S +5183(client\),)S +5497(or)S +5496 V +1260(a)S +1346(private)S +1665(colormap)S +2084(when)S +2342(loading)S +2684(an)S +2820(image)S +3106(from)S +3342(disk)S +3551(that)S +3743(contains)S +4118(a)S +4204(colormap.)S +4648(Each)S +4888(frame)S +5161(de\256nes)S +5485(its)S +5616 V +1260(own)S +1470(colormap)S +1885(so)S +2013(you)S +2202(can)S +2379(de\256ne)S +2662(di)S +2740 H + (f)show 10 -.5 mul h (f)show +10 R +2801(erent)S +3039(colormaps)S +3494(or)S +3616(enhancements)S +4220(for)S +4375(each)S +4596(frame,)S +4892(they)S +5103(will)S +5298(change)S +5736 V +1260(automatically)S +1834(as)S +1947(you)S +2127(cycle)S +2367(through)S +2708(the)S +2860(frames.)S +6024 V +9 B +1080(BUILTIN)S +1487(COLORMAPS)S +6144 V +10 R +1260(Once)S +1501(loaded,)S +1823(the)S +1976(colormap)S +2384(may)S +2588(either)S +2847(be)S +2973(changed)S +3337(using)S +3586(the)S +3740(builtin)S +4034(colormap)S +4443(menu)S +4697(under)S +4956(the)S +5110(View)S +5358(menu)S +6264 V +1260(button)S +1559(on)S +1702(the)S +1867(main)S +2110(window,)S +2500(or)S +2625(from)S +2861(the)S +3025(Enhancement)S +3610(box)S +3802(on)S +3944(the)S +4108(control)S +4433(panel.)S +4716(XImtool)S +5097(has)S +5272(about)S +5536(a)S +6384 V +1260(dozen)S +1556(colormap)S +1991(options)S +2344(builtin,)S +2689(other)S +2952(user-de\256ned)S +3503(colormaps)S +3977(may)S +4208(optionally)S +4673(be)S +4826(loaded.)S +5206(It)S +5326(is)S +5452(not)S +6504 V +1260(presently)S +1656(possible)S +2014(to)S +2122(save)S +2329(colormaps)S +2775(for)S +2921(later)S +3128(use.)S +6792 V +9 B +1080(USER-DEFINED)S +1782(COLORMAPS)S +6912 V +10 R +1260(The)S +10 I +1454(cmap[12])S +10 R +1887(and)S +10 I +2070(cmapDir[12])S +10 R +2642(resources)S +3057(\(or)S +3212(command)S +3645(line)S +3834(arguments\))S +4322(are)S +4482(used)S +4705(to)S +4823(tell)S +4991(which)S +5275(speci\256c)S +7032 V +1260(colormaps)S +1719(to)S +1840(make)S +2099(available)S +2502(or)S +2628(where)S +2914(to)S +3035(look)S +3256(for)S +3415(colortables)S +3895(respectively.)S +4474(The)S +4671(colortables)S +5151(are)S +5314(loaded)S +7152 V +1260(when)S +1519(ximtool)S +1874(starts)S +2128(up,)S +2296(or)S +2422(when)S +2681(it)S +2780(is)S +2890(reinitialized)S +3410(\(e.g.)S +3630(by)S +3773(pressing)S +4149(the)S +4314(Initialize)S +4712(button)S +5011(in)S +5132(the)S +5297(control)S +7272 V +1260(panel\).)S +1598(XImtool)S +1971(will)S +2161(ignore)S +2450(any)S +2628(\256les)S +2829(in)S +2941(the)S +3097(colormap)S +3508(directory)S +3901(which)S +4178(do)S +4311(not)S +4472(look)S +4683(like)S +4866(colortables.)S +5392(New)S +7752 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(12)S +7920 V +EP +%%Page: 13 13 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(colortables)S +1728(will)S +1914(also)S +2105(be)S +2229(added)S +2497(automatically)S +3071(for)S +3217(each)S +3429(image)S +3703(loaded)S +3999(from)S +4223(disk.)S +1200 V +1260(The)S +1451(format)S +1753(of)S +1872(a)S +1952(user)S +2154(lookup)S +2468(table)S +2698(is)S +2801(very)S +3015(simple:)S +3347(each)S +3566(row)S +3758(de\256nes)S +4078(one)S +4259(colortable)S +4695(entry,)S +4962(and)S +5143(consists)S +5497(of)S +1320 V +1260(three)S +1489(columns)S +1858(de\256ning)S +2216(the)S +2368(red,)S +2550(green,)S +2826(and)S +3000(blue)S +3202(values)S +3487(scaled)S +3766(to)S +3874(the)S +4026(range)S +4277(0.0)S +4432(\(o)S +4515 H + (f)show 10 -.5 mul h (f)show +10 R +4576(\))S +4639(to)S +4747(1.0)S +4902(\(full)S +5104(intensity\).)S +1560 V +1500(R)S +1597(G)S +1699(B)S +1680 V +1500(R)S +1597(G)S +1699(B)S +1800 V +1500(\(etc.\))S +2040 V +1260(Blank)S +1529(and)S +1703(comment)S +2105(lines)S +2324(\(lines)S +2576(beginning)S +3006(with)S +3214(a)S +3288('#'\))S +3467(are)S +3618(ignored.)S +2280 V +1260(Usually)S +1605(256)S +1789(rows)S +2017(are)S +2172(provided,)S +2586(but)S +2748(the)S +2904(number)S +3243(may)S +3449(actually)S +3799(be)S +3927(anything)S +4311(in)S +4423(the)S +4579(range)S +4834(1)S +4918(to)S +5031(256.)S +5241(XImtool)S +2400 V +1260(will)S +1451(interpolate)S +1912(the)S +2068(table)S +2296(as)S +2413(necessary)S +2834(to)S +2946(compute)S +3324(the)S +3480(colortable)S +3913(values)S +4202(used)S +4419(in)S +4531(XImtool.)S +4929(XImtool)S +5302(uses)S +5508(at)S +2520 V +1260(most)S +1485(201)S +1665(colors)S +1939(to)S +2047(render)S +2331(pixel)S +2561(data,)S +2782(so)S +2901(it)S +2987(is)S +3084(usually)S +3403(necessary)S +3820(to)S +3928(interpolate)S +4385(the)S +4537(table)S +4761(when)S +5007(it)S +5093(is)S +5190(loaded.)S +2760 V +1260(The)S +1446(name)S +1693(of)S +1807(the)S +1960(colortable)S +2390(as)S +2504(it)S +2591(will)S +2778(appear)S +3074(in)S +3183(the)S +3336(XImtool)S +3706(control)S +4020(panel)S +4267(is)S +4365(the)S +4518(root)S +4710(name)S +4957(of)S +5072(the)S +5226(\256le,)S +5411(e.g.,)S +2880 V +1260(if)S +1365(the)S +1531(\256le)S +1703(is)S +1814("rainbow.lut")S +2398(the)S +2564(colortable)S +3007(name)S +3267(will)S +3467(be)S +3605("rainbow".)S +4083(Lower)S +4387(case)S +4602(names)S +4901(are)S +5065(suggested)S +5502(to)S +3000 V +1260(avoid)S +1525(name)S +1784(collisions)S +2211(with)S +2432(the)S +2597(builtin)S +2902(colortables.)S +3408(Private)S +3734(colormaps)S +4193(for)S +4352(disk)S +4562(images)S +4888(will)S +5088(be)S +5226(have)S +5458(the)S +3120 V +1260(same)S +1497(name)S +1745(as)S +1860(the)S +2014(image)S +2290(loaded.)S +2613(If)S +2711(the)S +2865(same)S +3102(colortable)S +3533(\256le)S +3693(appears)S +4029(in)S +4139(multiple)S +4505(user)S +4703(colortable)S +5134(directories,)S +3240 V +1260(the)S +1412(\256rst)S +1598(one)S +1772(found)S +2035(will)S +2221(be)S +2345(used.)S +3528 V +9 B +1080(MINIMIZING)S +1677(COLORMAP)S +2239(CONFLICTS)S +3648 V +10 R +1260(The)S +1456(Gterm)S +1752(widget)S +2065(used)S +2289(by)S +2430(XImtool)S +2810(\(i.e.)S +3006(the)S +3169(main)S +3410(display)S +3740(window\))S +4136(uses)S +4349(a)S +4434(private)S +4753(global)S +5045(colormap)S +5464(for)S +3768 V +1260(display,)S +1615(this)S +1801(allows)S +2103(it)S +2200(to)S +2319(have)S +2548(greater)S +2865(control)S +3189(over)S +3407(color)S +3653(cell)S +3838(allocation)S +4273(but)S +4441(can)S +4619(occasionally)S +5158(also)S +5359(cause)S +3888 V +1260("colormap)S +1712(\257ashing")S +2104(as)S +2221(the)S +2377(mouse)S +2672(is)S +2773(moved)S +3079(in)S +3191(and)S +3370(out)S +3533(of)S +3651(the)S +3808(application.)S +4372(The)S +4562(problem)S +4930(here)S +5136(is)S +5238(that)S +5423(in)S +5536(a)S +4008 V +1260(system)S +1572(with)S +1784(only)S +1996(an)S +2124(8-bit)S +2347(colormap)S +2758(\(256)S +2975(colors\))S +3286(all)S +3420(applications)S +3937(must)S +4165(compete)S +4536(for)S +4685(colors,)S +4987(programs)S +5397(such)S +4128 V +1260(as)S +1380(XV)S +1561(or)S +1681(Netscape)S +2083(allocate)S +2430(colors)S +2711(from)S +2942(the)S +3102(default)S +3417(colormap)S +3832(leaving)S +4164(only)S +4380(a)S +4462(few)S +4649(free)S +4841(cells)S +5062(for)S +5216(XImtool.)S +4248 V +1260(Since)S +1513(XImtool)S +1883(de\256nes)S +2197(a)S +2271(private)S +2578(global)S +2858(colormap)S +3265(it)S +3351(is)S +3448(still)S +3629(able)S +3825(to)S +3933(allocate)S +4273(the)S +4425(needed)S +4737(cells)S +4950(rather)S +5212(than)S +5414(fail-)S +4368 V +1260(ing,)S +1449(but)S +1613(it's)S +1777(allocating)S +2207(cells)S +2426(already)S +2755(used)S +2974(by)S +3110(other)S +3351(applications.)S +3925(As)S +4072(the)S +4230(mouse)S +4527(moves)S +4824(out)S +4989(of)S +5109(the)S +5268(ximtool)S +4488 V +1260(window)S +1623(those)S +1875(cells)S +2099(are)S +2261(once)S +2490(again)S +2747(de\256ned)S +3082(in)S +3201(terms)S +3464(of)S +3587(the)S +3749(default)S +4066(colormap,)S +4508(so)S +4637(the)S +4799(ximtool)S +5151(window)S +5513(is)S +4608 V +1260(then)S +1470(using)S +1725(a)S +1807(di)S +1885 H + (f)show 10 -.5 mul h (f)show +10 R +1946(erent)S +2183(colormap.)S +2653(It)S +2752(is)S +2857(this)S +3040(switching)S +3467(of)S +3588(the)S +3748(colormap)S +4164(context)S +4497(that)S +4686(causes)S +4985(the)S +5146(\257ashing)S +5502(to)S +4728 V +1260(occur,)S +1536(but)S +1694(there)S +1923(are)S +2074(a)S +2148(few)S +2327(things)S +2602(that)S +2782(can)S +2950(be)S +3074(done)S +3298(to)S +3406(help)S +3608(minimize)S +4016(this.)S +4968 V +1260(XImtool)S +1640(logically)S +2031(de\256nes)S +2356(200)S +2548(colors)S +2834(which)S +3120(the)S +3284(client)S +3548(image)S +3834(display)S +4165(program)S +4545(can)S +4725(use)S +4900(to)S +5020(render)S +5316(pixels.)S +5088 V +1260(However,)S +1687(ximtool)S +2036(may)S +2245(or)S +2365(may)S +2574(not)S +2739(actually)S +3092(allocate)S +3439(all)S +3576(of)S +3695(those)S +3942(colors.)S +4277(By)S +4430(default)S +4743(it)S +4835(currently)S +5231(allocates)S +5208 V +1260(only)S +1479(about)S +1743(192)S +1935(colors,)S +2246(to)S +2366(reserve)S +2695(64)S +2837(colors)S +3123(for)S +3281(the)S +3445(other)S +3692(windows)S +4095(on)S +4237(the)S +4401(screen.)S +4752(You)S +4966(don't)S +5219(normally)S +5328 V +1260(notice)S +1539(this)S +1719(as)S +1837(1\))S +1955(usually)S +2279(the)S +2436(default)S +2748(screen)S +3037(colormap)S +3449(has)S +3617(enough)S +3946(free)S +4135(cells)S +4353(to)S +4466(allow)S +4722(ximtool)S +5068(to)S +5180(match)S +5458(the)S +5448 V +1260(colors,)S +1570(and)S +1755(2\))S +1879(the)S +2042(extra)S +2282(unallocated)S +2784(cells)S +3009(correspond)S +3494(to)S +3614(the)S +3778(brightest)S +4170(pixels)S +4451(in)S +4571(the)S +4735(rendered)S +5125(image,)S +5436(and)S +5568 V +1260(these)S +1496(colors)S +1771(may)S +1974(not)S +2132(be)S +2256(used)S +2469(or)S +2582(usually)S +2901(only)S +3109(correspond)S +3582(to)S +3690(a)S +3764(few)S +3943(small)S +4190(regions)S +4514(near)S +4715(the)S +4867(saturated)S +5257(cores)S +5497(of)S +5688 V +1260(bright)S +1529(objects.)S +5928 V +1260(You)S +1465(can)S +1636(eliminate)S +2041(this)S +2219(problem)S +2585(by)S +2718(setting)S +3018(the)S +10 I +3173(basePixel)S +10 R +3594(resource)S +3965(to)S +4077(e.g.)S +4285(48)S +4419(instead)S +4736(of)S +4853(64,)S +5012(which)S +5290(will)S +5480(let)S +6048 V +1260(the)S +1428(gterm)S +1707(widget)S +2025(allocate)S +2381(all)S +2527(200)S +2723(colors.)S +3068(However,)S +3504(this)S +3695(isn't)S +3918(recommended)S +4528(for)S +4689(normal)S +5017(use)S +5195(as)S +5323(it)S +5424(will)S +6168 V +1260(increase)S +1624(the)S +1784(likelihood)S +2228(of)S +2349(colormap)S +2764(\257ashing.)S +3174(If)S +3278(you)S +3466(change)S +10 I +3787(basePixel)S +10 R +4175(,)S +4239(either)S +4505(restart)S +4793(the)S +4954(X)S +5065(server)S +5347(or)S +5469(set)S +6288 V +1260(the)S +1418(resource)S +10 I +1791(cmapInitialize)S +10 R +2363(=)S +10 I +2419(True)S +10 R +2644(to)S +2758(force)S +2998(the)S +3156(gterm)S +3425(widget)S +3732(to)S +3845(update)S +4146(its)S +4276(global)S +4561(colormap)S +4973(resource)S +5345(in)S +5458(the)S +6408 V +1260(X)S +1362(server.)S +1660(The)S +1845(colormap)S +2252(resource)S +2619(may)S +2821(also)S +3012(be)S +3136(deleted)S +3454(by)S +3584(using)S +3831(the)S +3983(command)S +6648 V +10 I +1980(xprop)S +2243(-root)S +2473(-remove)S +2829(GT_image)S +6888 V +10 R +1260(These)S +1528(options)S +1853(may)S +2055(also)S +2246(be)S +2370(set)S +2511(on)S +2641(the)S +2793(command)S +3217(line)S +3397(when)S +3643(\256rst)S +3829(starting)S +4159(up.)S +7128 V +1260(In)S +1388(general)S +1726(one)S +1915(can)S +2098(set)S +2254(the)S +2421(Gterm)S +2721(widget)S +3039(resources)S +10 I +3461(basePixel)S +10 R +3895(and)S +10 I +4085(maxColors)S +10 R +4570(to)S +4694(specify)S +5028(the)S +5196(region)S +5497(of)S +7248 V +1260(colormap)S +1680(space)S +1944(to)S +2065(be)S +2202(used)S +2428(for)S +2587(image)S +2874(display.)S +3261(If)S +3370(you)S +3563(set)S +10 I +3717(maxColors)S +10 R +4199(to)S +4320(a)S +4407(small)S +4667(value,)S +4951(the)S +5116(200)S +5308(logical)S +7728 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(13)S +7920 V +EP +%%Page: 14 14 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(colors)S +1541(de\256ned)S +1872(by)S +2009(the)S +2168(widget)S +2477(will)S +2670(be)S +2801(mapped)S +3154(by)S +3291(the)S +3450(imtool)S +3749(color)S +3991(model)S +4278(into)S +4471(whatever)S +4873(number)S +5215(of)S +5336(colors)S +1080 V +1260(are)S +1417(actually)S +1769(available)S +2165(to)S +2279(the)S +2437(widget.)S +2800(For)S +2974(example,)S +3372(in)S +3485(the)S +3642(default)S +3954(setup,)S +4225(200)S +4410(color)S +4650(values)S +4940(are)S +5096(really)S +5358(being)S +1200 V +1260(mapped)S +1606(into)S +1792(192)S +1972(color)S +2207(cells)S +2420(used)S +2633(for)S +2779(display,)S +3123(the)S +3275(remaining)S +3710(colors)S +3984(are)S +4135(used)S +4348(for)S +4494(buttons,)S +4845(menus)S +5137(etc)S +5284(and)S +5459(are)S +1320 V +1260(allocated)S +1650(from)S +1874(the)S +2026(default)S +2333(colormap)S +2740(by)S +2870(the)S +3022(X)S +3124(toolkit)S +3416(when)S +3662(the)S +3814(application)S +4288(starts)S +4529(up.)S +1560 V +1260(Even)S +1501(though)S +1815(the)S +1973(Gterm)S +2264(widget)S +2572(uses)S +2780(a)S +2860(private)S +3174(colormap,)S +3613(it)S +3706(is)S +3810(a)S +3891(private)S +10 I +4205(global)S +10 R +4498(colormap)S +4912(meaning)S +5293(that)S +5480(all)S +1680 V +1260(Gterm)S +1550(widgets)S +1896(share)S +2141(the)S +2298(same)S +2537(colormap.)S +3003(An)S +3159(example)S +3531(of)S +3648(colormap)S +4059(sharing)S +4387(in)S +4499(ximtool)S +4845(is)S +4946(the)S +5102(main)S +5336(image)S +1800 V +1260(window)S +1619(and)S +1800(the)S +1959(colorbar)S +2328(window.)S +2742(These)S +3017(are)S +3175(two)S +3362(separate)S +3725(gterm)S +3995(widgets)S +4343(that)S +4530(share)S +4777(the)S +4936(same)S +5178(colormap.)S +1920 V +1260(They)S +1506(have)S +1735(to)S +1854(share)S +2105(the)S +2268(same)S +2514(colormap,)S +2957(as)S +3080(otherwise)S +3508(when)S +3764(you)S +3954(windowed)S +4410(the)S +4572(main)S +4812(image)S +5096(window)S +5458(the)S +2040 V +1260(colorbar)S +1630(window)S +1990(would)S +2278(not)S +2444(accurately)S +2891(re\257ect)S +3178(the)S +3338(modi\256ed)S +3732(colormap.)S +4203(By)S +4359(default)S +4675(two)S +4864(separate)S +5229(ximtools)S +2160 V +1260(would)S +1556(also)S +1763(share)S +2019(the)S +2186(same)S +2436(colormap)S +2858(meaning)S +3247(contrast)S +3608(enhancements)S +4218(in)S +4341(one)S +4530(window)S +4897(would)S +5192(a)S +5236 H + (f)show 10 -.5 mul h (f)show +10 R +5297(ect)S +5458(the)S +2280 V +1260(other.)S +1563(By)S +1723(resetting)S +2110(the)S +10 I +2275(cmapName)S +10 R +2767(command)S +3204(line)S +3397(option)S +3696(or)S +3822(resource)S +4203(you)S +4397(can)S +4579(change)S +4905(the)S +5071(name)S +5331(of)S +5458(the)S +2400 V +1260(private)S +1582(colormap)S +2004(used)S +2232(causing)S +2582(separate)S +2953(ximtools)S +3349(to)S +3472(use)S +3650(di)S +3728 H + (f)show 10 -.5 mul h (f)show +10 R +3789(erent)S +4033(colormaps,)S +4519(but)S +4692(note)S +4909(this)S +5099(also)S +5304(creates)S +2520 V +1260(colormap)S +1671(\257ashing)S +2022(between)S +2388(the)S +2544(two)S +2728(windows)S +3123(that)S +3307(cannot)S +3607(easily)S +3874(be)S +4002(avoided.)S +4407(By)S +4559(setting)S +4861(the)S +10 I +5018(cmapName)S +10 R +5502(to)S +2640 V +1260("default")S +1649(the)S +1801(widget)S +2103(will)S +2289(allocate)S +2629(colors)S +2903(from)S +3127(the)S +3279(default)S +3586(colormap,)S +4018(but)S +4176(this)S +4351(is)S +4448(of)S +4561(little)S +4775(use)S +4938(at)S +5040(the)S +5192(moment.)S +2880 V +1260(There)S +1524(are)S +1677(a)S +1753(number)S +2090(of)S +2205(other)S +2442(resources)S +2850(that)S +3032(can)S +3202(be)S +3328(used)S +3543(to)S +3653(modify)S +3974(the)S +4129(behavior)S +4511(of)S +4627(the)S +4782(Gterm)S +5070(widget)S +5375(color)S +3000 V +1260(management)S +1801(scheme,)S +2156(but)S +2315(these)S +2551(are)S +2703(the)S +2856(most)S +3082(useful)S +3356(ones.)S +3624(For)S +3793(question)S +4162(and)S +4336(further)S +4637(information)S +5139(feel)S +5318(free)S +5502(to)S +3120 V +1260(contact)S +10 I +1578(iraf@noao.edu)S +10 R +2184(.)S +3408 V +9 B +900(LOAD)S +1187(PANEL)S +3528 V +10 R +1260(The)S +1448(Load)S +1687(Panel)S +1943(allows)S +2238(you)S +2422(load)S +2628(images)S +2945(from)S +3173(disk)S +3374(directly)S +3713(to)S +3825(the)S +3981(frame)S +4247(bu)S +4347 H + (f)show 10 -.5 mul h (f)show +10 R +4408(er,)S +4544(this)S +4723(is)S +4824(analogous)S +5263(to)S +5375(load-)S +3648 V +1260(ing)S +1439(an)S +1584(image)S +1879(on)S +2030(the)S +2203(command)S +2648(line)S +2848(except)S +3158(that)S +3358(browsing)S +3780(is)S +3897(possible.)S +4300(At)S +4450(present)S +4788(recognized)S +5275(formats)S +3768 V +1260(include)S +1587(IRAF)S +1848(OIF)S +2042(format)S +2341(\(i.e.)S +10 I +2529(.imh)S +10 R +2737(extension\),)S +3211(simple)S +3511(FITS)S +3750(\256les,)S +3975(GIF,)S +4195(and)S +4373(Sun)S +4563(raster\256les.)S +5040(The)S +5229(task)S +5424(will)S +3888 V +1260(automatically)S +1850(sense)S +2112(the)S +2280(format)S +2592(of)S +2721(the)S +2888(image)S +3177(and)S +3366(load)S +3583(it)S +3684(appropriately.)S +4286(Images)S +4619(with)S +4842(private)S +5164(colormaps)S +4008 V +1260(\(such)S +1515(as)S +1637(GIF\))S +1870(will)S +2065(be)S +2198(loaded)S +2503(using)S +2759(the)S +2920(private)S +3236(colormap)S +3652(\(meaning)S +4068(that)S +4257(changing)S +4663(the)S +4825(brightness/contrast)S +4128 V +1260(enhancements)S +1861(will)S +2053(render)S +2343(a)S +2423(random-colored)S +3096(image\),)S +3434(all)S +3570(others)S +3850(will)S +4042(be)S +4172(loaded)S +4474(with)S +4688(a)S +4767(grayscale)S +5178(colormap.)S +4248 V +1260(If)S +1363(the)S +10 I +1522(Grayscale)S +10 R +1969(button)S +2262(is)S +2366(enabled)S +2713(the)S +2872(image)S +3153(colormap)S +3567(will)S +3760(be)S +3891(converted)S +4321(to)S +4437(grayscale)S +4851(and)S +5033(loaded)S +5337(as)S +5458(the)S +4368 V +1260(standard)S +1633(grayscale)S +2044(colormap.)S +2511(The)S +2701(Load)S +2941(panel)S +3192(will)S +3383(close)S +3623(automatically)S +4202(once)S +4425(the)S +4582(image)S +4861(has)S +5029(loaded)S +5330(unless)S +4488 V +1260(the)S +10 I +1412(Browse)S +10 R +1742(button)S +2028(has)S +2191(been)S +2409(set.)S +4728 V +1260(When)S +1531(loading)S +1864(new)S +2063(images)S +2379(the)S +2534(frame)S +2799(bu)S +2899 H + (f)show 10 -.5 mul h (f)show +10 R +2960(er)S +3070(con\256guration)S +3636(table)S +3863(will)S +4053(be)S +4181(searched)S +4563(for)S +4713(a)S +4791(frame)S +5057(bu)S +5157 H + (f)show 10 -.5 mul h (f)show +10 R +5218(er)S +5329(that)S +5513(is)S +4848 V +1260(the)S +1417(same)S +1657(size)S +1847(or)S +1965(larger)S +2231(than)S +2437(the)S +2593(new)S +2793(image)S +3071(size,)S +3285(if)S +3380(no)S +3514(frame)S +3780(bu)S +3880 H + (f)show 10 -.5 mul h (f)show +10 R +3941(er)S +4052(can)S +4224(be)S +4352(found)S +4619(a)S +4697(custom)S +5020(bu)S +5120 H + (f)show 10 -.5 mul h (f)show +10 R +5181(er)S +5292(exactly)S +4968 V +1260(the)S +1420(size)S +1613(of)S +1734(the)S +1894(image)S +2176(will)S +2370(be)S +2502(created.)S +2852(This)S +3068(means)S +3361(that)S +3549(the)S +3709(image)S +3991(may)S +4201(not)S +4367(\256ll)S +4517(the)S +4677(display)S +5004(window)S +5364(when)S +5088 V +1260(loaded,)S +1596(or)S +1724(you)S +1919(may)S +2136(see)S +2308(a)S +2397(subsection)S +2864(of)S +2992(the)S +3159(image)S +3447(in)S +3569(the)S +3735(main)S +3979(display)S +4312(window.)S +4703(Setting)S +5031(the)S +10 I +5197(autoscale)S +5208 V +10 R +1260(option)S +1557(will)S +1754(scale)S +1994(the)S +2157(entire)S +2425(image)S +2710(to)S +2829(\256t)S +2954(the)S +3117(main)S +3358(display)S +3688(window,)S +4076(the)S +4239(full)S +4419(frame)S +4692(bu)S +4792 H + (f)show 10 -.5 mul h (f)show +10 R +4853(er)S +4971(will)S +5168(always)S +5486(be)S +5328 V +1260(visible)S +1557(in)S +1665(the)S +1817(Panner)S +2124(marker)S +2436(window.)S +5568 V +1260(Images)S +1578(with)S +1786(more)S +2021(colors)S +2295(than)S +2497(can)S +2665(be)S +2789(displayed)S +3202(will)S +3389(automatically)S +3964(be)S +4089(quantized)S +4508(to)S +4617(the)S +4770(number)S +5106(of)S +5220(available)S +5688 V +1260(colors)S +1546(before)S +1842(display,)S +2198(24-bit)S +2479(formats)S +2826(are)S +2988(not)S +3157(currently)S +3558(supported)S +3993(\(but)S +4195(may)S +4408(be)S +4543(in)S +4662(the)S +4825(future)S +5104(and)S +5289(will)S +5486(be)S +5808 V +1260(similarly)S +1646(quantized\).)S +6048 V +1260(Formats)S +1620(which)S +1896(permit)S +2189(larger)S +2454(than)S +2659(8-bit)S +2881(pixels)S +3153(will)S +3342(be)S +3469(sampled)S +3835(on)S +3968(a)S +4045(grid)S +4239(to)S +4350(determine)S +4782(an)S +4909(optimal)S +5248(range)S +5502(in)S +6168 V +1260(the)S +1418(data)S +1620(to)S +1734(be)S +1864(used)S +2083(to)S +2197(compute)S +2577(a)S +2657(linear)S +2920(transformation)S +3544(to)S +3658(the)S +3816(number)S +4157(of)S +4275(display)S +4599(colors.)S +4903(This)S +5116(is)S +5218(the)S +5375(same)S +6288 V +1260(sampling)S +1660(and)S +1837(transformation)S +2458(used)S +2674(by)S +2807(the)S +2962(IRAF)S +10 I +3223(DISPLAY)S +10 R +3645(task)S +3839(when)S +4089(computing)S +4551(the)S +10 I +4707(z1/z2)S +10 R +4947(values)S +5236(and)S +5414(pro-)S +6408 V +1260(vides)S +1501(a)S +1575(much)S +1827(better)S +2084(initial)S +2348(display)S +2667(than)S +2869(simple)S +3166(truncation)S +3601(to)S +3709(8-bits.)S +6576 V +10 B +1260(Directory)S +1699(Browsing)S +6696 V +10 R +1510(The)S +1702(load)S +1911(panel)S +2165(contains)S +2536(a)S +2618(list)S +2779(of)S +2900(\256les)S +3105(in)S +3221(the)S +3381(current)S +3701(directory)S +4099(that)S +4287(may)S +4497(be)S +4629(selected)S +4988(for)S +5142(loading)S +5480(by)S +6816 V +1510(selecting)S +1901(with)S +2115(left)S +2284(mouse)S +2581(button.)S +2898(If)S +3000(the)S +3158(\256le)S +3322(is)S +3425(a)S +3504(directory)S +3899(the)S +4056(contents)S +4424(of)S +4542(the)S +4699(new)S +4900(directory)S +5295(will)S +5486(be)S +6936 V +1510(loaded,)S +1836(if)S +1932(it's)S +2095(a)S +2174(plain)S +2409(\256le)S +2572(an)S +2701(attempt)S +3036(will)S +3227(be)S +3356(made)S +3607(to)S +3720(load)S +3927(it)S +4018(as)S +4137(an)S +4267(image)S +4547(otherwise)S +4971(an)S +5101(error)S +5330(popup)S +7056 V +1510(will)S +1706(appear.)S +2065(Directories)S +2547(in)S +2664(the)S +2825(list)S +2987(are)S +3147(identi\256ed)S +3564(with)S +3781(a)S +3864(trailing)S +4192('/')S +4325(character,)S +4753(you)S +4942(will)S +5137(always)S +5453(see)S +7176 V +1510(any)S +1684(subdirectories)S +2274(listed)S +2521(even)S +2739(if)S +2830(a)S +2904(\256lter)S +3123(is)S +3220(speci\256ed.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(14)S +7920 V +EP +%%Page: 15 15 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(The)S +10 I +1698(Root)S +10 R +1920(button)S +2209(will)S +2398(reset)S +2619(the)S +2774(current)S +3089(directory)S +3482(to)S +3593(the)S +3748(system)S +4059(root)S +4254(directory.)S +4673(The)S +10 I +4862(Home)S +10 R +5134(button)S +5424(will)S +1080 V +1510(reset)S +1730(the)S +1884(current)S +2198(directory)S +2590(to)S +2700(the)S +2854(user's)S +3124(login)S +3362(directory,)S +3779(the)S +10 I +3932(Up)S +10 R +4085(button)S +4372(moves)S +4664(up)S +4795(one)S +4970(directory)S +5361(level,)S +1200 V +1510(and)S +10 I +1688(Rescan)S +10 R +2010(reloads)S +2332(the)S +2488(\256le)S +2650(list)S +2807(by)S +2942(rescanning)S +3409(the)S +3566(directory.)S +3986(The)S +4176(current)S +4493(working)S +4861(directory)S +5256(is)S +5358(given)S +1320 V +1510(below)S +1784(the)S +1936(\256le)S +2094(selection)S +2479(window.)S +1488 V +10 B +1260(File)S +1451(Patterns)S +1608 V +10 R +1510(By)S +1663(default)S +1976(all)S +2112(\256les)S +2315(and)S +2495(directories)S +2952(will)S +3144(be)S +3274(listed.)S +3552(You)S +3760(may)S +3968(specify)S +4292(a)S +4372(\256lter)S +4597(to)S +4711(e.g.)S +4891(select)S +5154(only)S +5369(those)S +1728 V +1510(\256les)S +1718(with)S +1936(a)S +2020(given)S +2282(extension)S +2705(like)S +2895(")S +10 Y +2936(*)S +10 R +2986(.\256ts")S +3215(to)S +3333(list)S +3496(only)S +3714(\256les)S +3921(with)S +4139(a)S +4223(".\256ts")S +4493(extension.)S +4941(Directories)S +5424(will)S +1848 V +1510(always)S +1830(be)S +1967(seen)S +2187(in)S +2308(the)S +2473(list)S +2639(and)S +2826(are)S +2990(identi\256ed)S +3411(with)S +3632(a)S +3719(trailing)S +4051('/')S +4188(character.)S +4621(Any)S +4837(valid)S +5081(unix)S +5303(pattern)S +1968 V +1510(matching)S +1912(string)S +2170(will)S +2356(be)S +2480(recognized.)S +2136 V +10 B +1260(Direct)S +1555(File)S +1746(Load)S +2256 V +10 R +1510(If)S +1608(you)S +1791(know)S +2046(exactly)S +2367(which)S +2644(\256le)S +2805(you)S +2988(wish)S +3210(to)S +3321(load,)S +3551(you)S +3734(may)S +3939(enter)S +4171(its)S +4299(name)S +4548(in)S +4659(the)S +10 I +4814(Load)S +5053(File)S +10 R +5247(text)S +5430(box)S +2376 V +1510(and)S +1688(either)S +1949(hit)S +2089(<cr>)S +2312(or)S +2429(the)S +2585(Load)S +2824(button)S +3114(to)S +3226(load)S +3432(it.)S +3577(An)S +3733(absolute)S +4099(or)S +4215(relative)S +4547(path)S +4752(name)S +5001(may)S +5206(be)S +5333(given,)S +2496 V +1510(if)S +1601(a)S +1675(simple)S +1972(\256lename)S +2346(is)S +2443(speci\256ed)S +2828(it)S +2914(will)S +3100(be)S +3224(searched)S +3602(for)S +3748(in)S +3856(the)S +4008(current)S +4320(working)S +4683(directory.)S +2664 V +10 B +1260(Frame)S +1572(Selections)S +2784 V +10 R +1510(By)S +1662(default)S +1974(images)S +2292(will)S +2483(be)S +2612(loaded)S +2914(into)S +3106(frame)S +3374(number)S +3715(1,)S +3826(you)S +4012(may)S +4220(select)S +4483(a)S +4563(di)S +4641 H + (f)show 10 -.5 mul h (f)show +10 R +4702(erent)S +4937(frame)S +5205(using)S +5458(the)S +2904 V +1510(Frame)S +1795(menu)S +2047(button)S +2333(to)S +2441(cycle)S +2681(through)S +3022(the)S +3174(available)S +3564(frames.)S +3192 V +9 B +900(SAVE)S +1167(PANEL)S +3312 V +10 R +1260(The)S +1445(Save)S +1669(Panel)S +1921(lets)S +2090(you)S +2270(save)S +2477(the)S +2629(current)S +2941(contents)S +3304(of)S +3418(the)S +3571(main)S +3802(display)S +4122(window)S +4475(to)S +4584(a)S +4659(disk)S +4857(\256le)S +5016(\(including)S +5458(the)S +3432 V +1260(Panner/Coords)S +1896(markers,)S +2284(any)S +2470(general)S +2805(graphics)S +3185(markers,)S +3573(or)S +3698(overlay)S +4039(graphics)S +4419(displayed)S +4844(by)S +4986(the)S +5150(client)S +5414(pro-)S +3552 V +1260(gram\).)S +1554(Presently,)S +1982(only)S +2191(the)S +2344(contents)S +2708(of)S +2822(the)S +2975(main)S +3206(display)S +3526(window)S +3879(may)S +4082(be)S +4207(saved,)S +4490(there)S +4720(is)S +4819(no)S +4951(facility)S +5266(for)S +5414(sav-)S +3672 V +1260(ing)S +1424(the)S +1582(undisplayed)S +2101(contents)S +2470(of)S +2589(the)S +2747(entire)S +3010(frame)S +3278(bu)S +3378 H + (f)show 10 -.5 mul h (f)show +10 R +3439(er)S +3552(other)S +3792(than)S +3999(to)S +4112(enable)S +4407(the)S +4564(autoscale)S +4970(feature.)S +5306(A)S +5413(lim-)S +3792 V +1260(ited)S +1440(number)S +1775(of)S +1888(formats)S +2223(are)S +2374(currently)S +2764(available,)S +3179(others)S +3453(will)S +3639(be)S +3763(added)S +4031(in)S +4139(future)S +4407(versions.)S +3960 V +10 B +1260(File)S +1451(Name)S +4080 V +10 R +1510(The)S +1695(File)S +1881(Name)S +2149(text)S +2329(box)S +2509(allows)S +2800(you)S +2980(to)S +3088(enter)S +3317(the)S +3469(\256le)S +3627(name)S +3873(of)S +3987(the)S +4140(saved)S +4398(\256le.)S +4582(A)S +4685("%d")S +4931(anywhere)S +5349(in)S +5458(the)S +4200 V +1510(name)S +1770(will)S +1970(be)S +2108(replaced)S +2489(by)S +2632(a)S +2719(sequence)S +3127(number)S +3475(allowing)S +3868(multiple)S +4245(frames)S +4559(to)S +4680(be)S +4817(saved)S +5087(with)S +5308(unique)S +4320 V +1510(names.)S +4488 V +10 B +1260(Format)S +4608 V +10 R +1510(The)S +1704(Format)S +2032(box)S +2221(allows)S +2521(you)S +2710(to)S +2827(choose)S +3143(the)S +3305(format)S +3611(of)S +3734(the)S +3896(image)S +4180(to)S +4298(be)S +4432(created.)S +4784(Not)S +4974(all)S +5114(formats)S +5459(are)S +4728 V +1510(currently)S +1900(implemented.)S +4896 V +10 B +1260(Color)S +5016 V +10 R +1510(The)S +1701(Color)S +1965(box)S +2151(lets)S +2326(you)S +2512(choose)S +2825(the)S +2983(color)S +3224(type)S +3432(of)S +3551(the)S +3709(image)S +3989(to)S +4103(be)S +4233(created.)S +4581(The)S +4773(options)S +5105(will)S +5298(change)S +5136 V +1510(depending)S +1965(on)S +2104(the)S +2265(format,)S +2595(e.g.)S +2778(FITS)S +3023(doesn't)S +3356(allow)S +3617(color)S +3861(so)S +3989(no)S +4127(color)S +4370(options)S +4703(will)S +4897(be)S +5029(allowed.)S +5408(For-)S +5256 V +1510(mats)S +1741(which)S +2027(allow)S +2291(24-bit)S +2572(images)S +2897(will)S +3095(be)S +3231(written)S +3556(using)S +3815(the)S +3979(current)S +4303(colormap)S +4722(after)S +4946(converting)S +5415(to)S +5536(a)S +5376 V +1510(24-bit)S +1779(image,)S +2078(pseudocolor)S +2596(images)S +2909(will)S +3095(be)S +3219(written)S +3532(with)S +3740(the)S +3892(current)S +4204(colormap.)S +5664 V +9 B +900(PRINT)S +1207(PANEL)S +5784 V +10 R +1260(The)S +1449(Print)S +1678(Panel)S +1934(allows)S +2229(you)S +2413(dump)S +2675(the)S +2831(contents)S +3198(of)S +3315(the)S +3471(main)S +3706(display)S +4030(window)S +4387(as)S +4505(Encapsulated)S +5072(Postscript)S +5502(to)S +5904 V +1260(either)S +1526(a)S +1608(named)S +1912(printer)S +2216(device)S +2514(or)S +2635(to)S +2751(a)S +2833(disk)S +3038(\256le.)S +3259(The)S +10 I +3452(Print)S +3696(To)S +10 R +3840(selects)S +4144(the)S +4304(type)S +4514(of)S +4635(output,)S +4954(the)S +10 I +5114(Print)S +5358(Com-)S +6024 V +1260(mand)S +10 R +1513(box)S +1694(will)S +1881(adjust)S +2151(accordingly,)S +2678(either)S +2936(as)S +3050(a)S +3125(Unix)S +3356(printer)S +3653(command)S +4078(or)S +4192(as)S +4306(a)S +4381(\256le)S +4540(name.)S +4842(A)S +4946("%d")S +5193(anywhere)S +6144 V +1260(in)S +1372(the)S +1528(name)S +1778(for)S +1928(disk)S +2129(output)S +2419(will)S +2609(be)S +2737(replaced)S +3108(by)S +3242(a)S +3320(sequence)S +3719(number)S +4058(allowing)S +4442(multiple)S +4810(frames)S +5115(to)S +5226(be)S +5353(saved)S +6264 V +1260(with)S +1469(unique)S +1772(names.)S +2083(Selecting)S +2486(printers)S +2822(from)S +3047(the)S +3200(installed)S +3570(list)S +3724(will)S +3911(automatically)S +4486(change)S +4799(the)S +4952(command)S +5377(to)S +5486(be)S +6384 V +1260(used)S +1474(to)S +1583(generate)S +1951(the)S +2104(output.)S +2416(This)S +2625(command)S +3049(does)S +3262(not)S +3420(necessarily)S +3893(need)S +4111(to)S +4219(be)S +4343(a)S +4417(printer)S +4713(command,)S +5162(the)S +5314(printer)S +6504 V +1260(con\256guration)S +1823(\256le)S +1981(lets)S +2150(you)S +2330(de\256ne)S +2604(any)S +2778(command)S +3202(string)S +3460(to)S +3568(process)S +3897(the)S +4049(image.)S +6792 V +9 B +1080(COLOR)S +1437(OPTIONS)S +6912 V +10 R +1260(The)S +1469(Color)S +1751(box)S +1955(lets)S +2148(you)S +2352(choose)S +2683(the)S +2859(color)S +3118(type)S +3344(of)S +3481(the)S +3657(image)S +3955(to)S +4087(be)S +4235(created.)S +4631(PseudoColor)S +5203(or)S +5341(24-bit)S +7032 V +1260(postscript)S +1679(will)S +1865(be)S +1989(created)S +2306(using)S +2553(the)S +2705(current)S +3017(colormap)S +3424(and)S +3598(enhancements.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(15)S +7920 V +EP +%%Page: 16 16 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(POSTSCRIPT)S +1672(OPTIONS)S +1080 V +10 B +1260(Orientation)S +1200 V +10 R +1510(Set)S +1668(the)S +1820(page)S +2038(orientation.)S +1368 V +10 B +1260(Paper)S +1545(Size)S +1488 V +10 R +1510(Select)S +1784(the)S +1936(paper)S +2187(size)S +2372(to)S +2480(be)S +2604(used.)S +1656 V +10 B +1260(Image)S +1556(Scale)S +1776 V +10 R +1510(Set)S +1677(the)S +1838(scale)S +2076(factor)S +2347(used)S +2569(to)S +2686(compute)S +3069(the)S +3230(\256nal)S +3447(image)S +3730(size.)S +3979(No)S +4140(checking)S +4539(is)S +4645(done)S +4878(to)S +4996(make)S +5252(sure)S +5458(the)S +1896 V +1510(image)S +1784(will)S +1970(\256t)S +2084(correctly)S +2468(on)S +2598(the)S +2750(page.)S +2184 V +9 B +1080(PROCESSING)S +1692(OPTIONS)S +2304 V +10 B +1260(Auto)S +1501(Scale)S +2424 V +10 R +1510(Toggles)S +1865(whether)S +2219(or)S +2335(not)S +2496(the)S +2651(image)S +2928(is)S +3028(automatically)S +3605(scaled)S +3887(to)S +3998(\256t)S +4116(the)S +4272(page.)S +4549(If)S +4649(not)S +4811(enabled,)S +5180(the)S +5336(image)S +2544 V +1510(scale)S +1744(will)S +1935(be)S +2064(used)S +2282(to)S +2395(determine)S +2829(the)S +2986(output)S +3277(image)S +3556(size,)S +3771(otherwise)S +4194(the)S +4351(image)S +4629(will)S +4819(be)S +4947(scaled)S +5230(down)S +5486(\(if)S +2664 V +1510(necessary\))S +1960(to)S +2068(\256t)S +2182(on)S +2312(the)S +2464(page.)S +2832 V +10 B +1260(Auto)S +1501(Rotate)S +2952 V +10 R +1510(Determines)S +2005(whether)S +2361(or)S +2479(not)S +2642(the)S +2800(image)S +3080(will)S +3272(be)S +3402(rotated)S +3715(to)S +3829(\256t)S +3949(on)S +4085(the)S +4243(page.)S +4492(When)S +4766(set,)S +4938(an)S +5068(image)S +5348(larger)S +3072 V +1510(than)S +1717(the)S +1874(current)S +2191(orientation)S +2659(will)S +2850(be)S +2979(rotated)S +3291(and)S +3470(possibly)S +3839(scaled)S +4123(to)S +4236(\256t)S +4355(the)S +4511(page,)S +4758(otherwise)S +5180(the)S +5336(image)S +3192 V +1510(may)S +1712(be)S +1836(scaled)S +2115(so)S +2234(that)S +2414(it)S +2500(\256ts)S +2653(in)S +2761(the)S +2913(current)S +3225(orientation.)S +3360 V +10 B +1260(Max)S +1484(Aspect)S +3480 V +10 R +1510(Automatically)S +2112(increases)S +2507(the)S +2659(scale)S +2888(so)S +3007(the)S +3159(image)S +3433(\256lls)S +3614(the)S +3766(page)S +3984(in)S +4092(the)S +4244(current)S +4556(orientation.)S +3648 V +10 B +1260(Annotate)S +3768 V +10 R +1510(The)S +1696(annotate)S +2065(option)S +2352(toggles)S +2672(whether)S +3024(or)S +3138(not)S +3297(the)S +3450(\256nal)S +3660(\256le)S +3820(includes)S +4185(annotation)S +4639(such)S +4854(as)S +4969(the)S +5123(image)S +5399(title,)S +3888 V +1510(a)S +1584(colorbar,)S +1971(and)S +2145(axis)S +2336(labels.)S +2654(There)S +2916(is)S +3013(currently)S +3403(no)S +3533(option)S +3819(for)S +3965(partial)S +4250(annotation.)S +4176 V +9 B +1080(PRINTER)S +1512(SELECTION)S +4296 V +10 R +1260(The)S +1487(printer)S +1825(selection)S +2252(list)S +2447(lets)S +2658(choose)S +3007(the)S +3201(printer)S +3540(to)S +3691(be)S +3858(used.)S +4139(The)S +4367(printer)S +4706(con\256guration)S +5312(\256le)S +5513(is)S +4416 V +1260(/usr/local/lib/ximprint.cfg)S +2342(by)S +2493(default)S +2821(or)S +2954(may)S +3176(be)S +3320(reset)S +3558(using)S +3825(the)S +10 I +3997(-printCon\256g)S +10 R +4542(command)S +4986(line)S +5186(switch)S +5497(or)S +4536 V +10 I +1260(printCon\256g)S +10 R +1752(resource.)S +2144(The)S +2329(format)S +2625(of)S +2738(the)S +2890(\256le)S +3048(is)S +3145(simply)S +4776 V +10 I +1950(name\\tcommand)S +5016 V +10 R +1260(The)S +10 I +1450(name)S +10 R +1701(value)S +1952(is)S +2054(what)S +2284(appears)S +2624(in)S +2738(the)S +2896(selection)S +3287(list)S +3446(and)S +3626(may)S +3834(be)S +3964(more)S +4205(than)S +4413(a)S +4493(single)S +4768(word,)S +5034(the)S +10 I +5192(command)S +5136 V +10 R +1260(can)S +1432(be)S +1560(any)S +1738(command)S +2166(that)S +2350(accepts)S +2677(EPS)S +2884(input)S +3124(from)S +3352(a)S +3429(pipe,)S +3659(the)S +3814(two)S +3997(\256elds)S +4247(must)S +4475(be)S +4602(separated)S +5011(by)S +5144(a)S +5221(tab)S +5376(char-)S +5256 V +1260(acter.)S +1538(Normally)S +1951(the)S +2103(command)S +2527(will)S +2713(be)S +2837(a)S +2912(simple)S +10 I +3210(lpr)S +3358(-Pfoo)S +10 R +3611(or)S +3725(some)S +3967(such,)S +4206(but)S +4365(can)S +4534(also)S +4726(include)S +5051(converters)S +5497(or)S +5376 V +1260(previewers.)S +1752(At)S +1882(most)S +2107(128)S +2287(printer)S +2583(commands)S +3046(may)S +3248(be)S +3372(used.)S +5664 V +9 B +900(INFO)S +1152(PANEL)S +5784 V +10 R +1260(The)S +1450(information)S +1957(panel)S +2208(is)S +2310(underused)S +2755(at)S +2862(present)S +3185(but)S +3348(is)S +3450(meant)S +3729(to)S +3842(provide)S +4183(basic)S +4424(information)S +4932(about)S +5190(the)S +5348(frame)S +5904 V +1260(being)S +1524(displayed.)S +1974(It)S +2077(is)S +2186(updated)S +2544(to)S +2664(be)S +2800(current)S +3124(while)S +3388(changing)S +3796(enhancements,)S +4428(pan/zoom)S +4864(regions,)S +5224(or)S +5348(frame)S +6024 V +1260(selection.)S +1684(In)S +1811(cases)S +2065(where)S +2352(the)S +2518(image)S +2806(title)S +3006(string)S +3278(is)S +3389(truncated)S +3804(in)S +3926(the)S +4093(main)S +4338(display)S +4672(window,)S +5064(the)S +5231(user)S +5442(can)S +6144 V +1260(always)S +1567(pop)S +1747(up)S +1877(the)S +2029(info)S +2220(window)S +2572(to)S +2680(see)S +2837(the)S +2989(full)S +3158(title.)S +6432 V +9 B +900(TCLSHELL)S +6552 V +10 R +1260(The)S +10 I +1446(TclShell)S +10 R +1805(allows)S +2097(the)S +2250(user)S +2447(to)S +2556(type)S +2759(commands)S +3224(directly)S +3561(to)S +3671(the)S +3825(TCL)S +4046(interpreter,)S +4518(letting)S +4806(you)S +4988(send)S +5203(messages)S +6672 V +1260(to)S +1369(the)S +1522(object)S +1797(manager)S +2171(or)S +2284(execute)S +2618(speci\256c)S +2953(procedures)S +3420(in)S +3528(the)S +3680(TCL)S +3899(code)S +4117(that)S +4297(makes)S +4582(up)S +4712(the)S +4864(GUI.)S +5096(It)S +5187(is)S +5284(used)S +5497(as)S +6792 V +1260(a)S +1338(development)S +1888(or)S +2005(debugging)S +2461(tool)S +2651(for)S +2801(the)S +2957(GUI,)S +3193(but)S +3355(for)S +3505(an)S +3633(example)S +4005(of)S +4122(what)S +4350(it)S +4440(does,)S +4682(bring)S +4927(it)S +5017(up)S +5151(and)S +5329(type)S +5536(a)S +6912 V +1260(command)S +1684(such)S +1897(as)S +7152 V +10 I +1380(send)S +1593(helpButton)S +2062(set)S +2203(background)S +2710(red)S +7680 V +10 R +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(16)S +7920 V +EP +%%Page: 17 17 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(ENVIRONMENT)S +1080 V +10 R +1260(DISPLAY)S +2700(speci\256es)S +3074(which)S +3348(display)S +3667(terminal)S +4030(to)S +4138(use)S +1200 V +1260(IMTOOLRC)S +2700(frame)S +2962(bu)S +3062 H + (f)show 10 -.5 mul h (f)show +10 R +3123(er)S +3230(con\256guration)S +3793(\256le)S +1320 V +1260(imtoolrc)S +2700(frame)S +2962(bu)S +3062 H + (f)show 10 -.5 mul h (f)show +10 R +3123(er)S +3230(con\256guration)S +3793(\256le)S +3951(\(alternative\))S +1608 V +9 B +900(FILES)S +1728 V +10 R +1260(/usr/local/lib/imtoolrc)S +2700(default)S +3007(frame)S +3269(bu)S +3369 H + (f)show 10 -.5 mul h (f)show +10 R +3430(er)S +3537(con\256guration)S +4100(\256le)S +1848 V +1260(/usr/local/lib/ximprint.cfg)S +2700(default)S +3007(printer)S +3303(con\256guration)S +3866(\256le)S +1968 V +1260(/usr/local/lib/imtoolcmap)S +2700(default)S +3007(colormap)S +3414(directory)S +2088 V +1260(/dev/imt1i)S +2700(default)S +3007(input)S +3243(\256fo)S +2208 V +1260(/dev/imt1o)S +2700(default)S +3007(output)S +3293(\256fo)S +2328 V +1260(/tmp/.IMT%d)S +2700(default)S +3007(unix)S +3215(socket)S +2616 V +9 B +900(BUGS)S +2736 V +900(SEE)S +1112(ALSO)S +2856 V +10 R +1260(xgterm\(1\),)S +1714(xtapemon\(1\))S +3144 V +9 B +900(COPYRIGHT)S +3264 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(X11IRAF Project)S +2709(Last change: 10 Dec 1996)S +5480(17)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol +%%Pages: 17 + \ No newline at end of file diff --git a/vendor/x11iraf/ximtool/TODO b/vendor/x11iraf/ximtool/TODO new file mode 100644 index 00000000..cccda8ee --- /dev/null +++ b/vendor/x11iraf/ximtool/TODO @@ -0,0 +1,241 @@ + TODO -- XIMTOOL -- TODO + +============================================================================== +V1.3 TODO List + + - Revise installation script + - CDL needs the new WCS mappings + - Update documentation + - online help + - document ISM protocol + - loading image standalone + - WCS/Info shows incorrect dest rect dnx/dny + - switching images seems to hang ISM + - MEF support in ISM + +============================================================================== + + +============================================================================== +- Translations should use #augment so users can add translations easily +- Gui box to edit/create/save LUTs +- snap to equal aspect +- Need a way to rotate an image by +/- 90 deg +- Create a new frame when running in standalone +- Convert private colormap-to-grayscale option + + +============================================================================== + + +Tue Oct 18 13:11:36 MST 1994 + + o Cache a more useful default imtoolrc internally, providing more than + just the 512sq frame buffer. + + +============================================================================== +OLD NOTES BELOW +============================================================================== + +Miscellaneous +------------------------------ + + o Add cursor marking feature - each cursor read leaves a mark in + the frame buffer. + + +Wed May 11 12:13:31 MST 1994 +------------------------------ + +Thoughts on priorities for next few changes: + + o Revise menubar. New menus, improve font. + + o Add toggle button to map/unmap control panel. + + o Support for command line options. + + o Should be a way to have some system wide resource overrides without + losing all the builtin fallback resources. + + o Print dialog. Add Quit confirm popup if print is enabled, so that + an accidental menu selection doesn't terminate program. + + o Revise info box. Separate version and configuration information + from output text area. Add "messages" line for informational + messages generated during execution. + + o Add command entry dialog, for entering GUI commands. + + o Add actions for common ximtool operations (frame select, zoom, pan, + window, print, etc.) so that users can bind keys to these functions. + Note that this can already be done using "call". + + o Help feature. + + +Print dialog + Print command: lpr -Plw %s + Options: + Type of output: postscript, EPS, sunraster + Enhancement: color or grayscale + Annotation: none, wysiwyg, manufacture + Compression: enabled, disabled + Buttons: + Print, Dismiss, Help + + +Info Box + Types of information displayed + Program version and origin + GUI being run + Title of current frame + Message and status display + Program state + frame buffer configuration, number of frames, frame size + window size, mapping from frame to window + active ports + number and type of client connections + number of defined colortables, current colortable + memory model + base pixel, ncolors + imtoolrc file - defined fb configurations + Text output (markers etc.) + + +Command Entry + command entry text widget + accumulate text until complete command is entered; handle + backslash and curly brace continuation before returning + command string. callback occurs when return is hit and + complete command has been entered. + command entry + enter command and hit return to execute + hitting return after executing command, with no changes, + clears command buffer + use arrow keys to move up and down in history list + command output + scrolled text + debug output + output of print, OBMDEBUG, etc. + scrolled text, append + controls + set debug level + clear output + done + + Support required: + new "command mode" callback for text widget + when appending text to text widget, should be able to specify + maximum size of saved text, with automatic truncation + OBM - modifications to optionally direct output of print, + debug, and error mesages to callbacks + OBM - need to be able to set debug level from GUI + + +Menus + File Menu + Info + Load + Save + Print + Execute + ----- + Reset + Quit + + View Menu + Next frame Colortable + Prev frame Normalize + ----- Invert + Colortable Optimize + Flip ----- + ----- Colormaps + Equal aspect Flip + Integer zoom X + Toggle zoom Y + Unzoom XY + + Options Menu + Autoscale + Antialias + Panner + Coords box + Match LUTs + Register + Blink frames + Clear frame + Tile frames + Fit frame + Control panel + + +Mon Apr 4 18:20:50 MST 1994 +------------------------------ + +1. Colormap enhancements + +[DONE] Allow arbitrary base pixel, number of gray levels; client + colortable still has 200 entries, but if there is insufficient + space some of them may map to the same screen pixel. + +[DONE] Option to force private colormap to be re-installed in server. + +[DONE] Figure out why colormap gets messed up when passing through + colorbar window. + +[DONE] Optimize update_default_colormap code, which currently uses an + inefficient technique to invert the colormap when updating the + default colormap. + + o Optional support for default colormap (should this be the default?) + + o Add option to automatically invert colormap when initializing. + + +2. Required Features + +[DONE] Implement tile frames option. + +[DONE] Fix fitframe function. + +[DONE] Add socket i/o option. + +[DONE] Add support for simultaneous connections to multiple clients, + maintaining the state separately for each (i.e. reference frame, + i/o streams, etc.). + + o Add main window button to bring up control panel. + + o Revise main window menubar. + + o Check out memoryModel options. + + o Add online help. + + +3. Add When Time Permits + + o "snap-to equal aspect" feature for panner window. + + o Implement Optimize enhancement feature. + + o Print dialog. + + o File load/save functions. + + +4. Other + + o Update manual page. Program options, client-server protocol. + + +5. Optional Features + + o Magnifier option. + + o Split screen. + + o Porthole option (view into alternate frame). + diff --git a/vendor/x11iraf/ximtool/clients.old/.DONE b/vendor/x11iraf/ximtool/clients.old/.DONE new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients.old/DONE b/vendor/x11iraf/ximtool/clients.old/DONE new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients.old/Imakefile b/vendor/x11iraf/ximtool/clients.old/Imakefile new file mode 100644 index 00000000..3ab5b034 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/Imakefile @@ -0,0 +1,32 @@ +XCOMM Imakefile for the Image Support Module components. + +X11IRAFDIR = ../../ +#include <../../X11IRAF.tmpl> + + WC_SRCS = wcspix/t_wcspix.x wcspix/wcimage.x wcspix/wcmef.x \ + wcspix/wcmspec.x wcspix/wcspix.h + LIB_SRCS = lib/dspmmap.x lib/reopen.x lib/ximtool.x + + +all:: ism_wcspix.e + +ism_wcspix.e: $(WC_SRCS) $(LIB_SRCS) + mkpkg relink + touch DONE + +SubdirLibraryRule($(WC_SRCS) $(LIB_SRCS)) + +clean:: + $(RM) *.[aeo] + touch DONE + +includes:: + +#if InstallBinaries +install:: ism_wcspix.e + -@if [ -d X11irafBinDir ]; then set +x; \ + else (set -x; $(MKDIRHIER) X11irafBinDir); fi + mv ism_wcspix.e X11irafBinDir +#endif + +DependTarget() diff --git a/vendor/x11iraf/ximtool/clients.old/README b/vendor/x11iraf/ximtool/clients.old/README new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients.old/_spplint b/vendor/x11iraf/ximtool/clients.old/_spplint new file mode 100644 index 00000000..28486ee8 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/_spplint @@ -0,0 +1,489 @@ +/u2/fitz/iraf/ximtool/clients/x_ism.x + sys_runtask: +/u2/fitz/iraf/ximtool/clients/wcspix/t_wcspix.x + t_wcspix: + wp_initialize: + wp_cache: + wp_uncache: + wp_wcstran: + wp_wcslist: + wp_objinfo: + wp_setpar: + wp_getpar: + wp_init: + wp_shutdown: + wp_class: + wp_id2obj: + wp_class_init: + wp_load_class: + wcspix_message: + wp_cnvdate: + dbg_printcache: +/u2/fitz/iraf/ximtool/clients/wcspix/wcimage.x + img_init: + img_cache: + img_uncache: + img_wcstran: + img_wcslist: + img_get_data: + img_objinfo: + img_send_header: + img_send_compass: + img_send_wcsinfo: + img_send_pixtab: + img_amp_wcs: + img_det_wcs: + img_coord_labels: + img_coord_fmt: + img_get_coord: +/u2/fitz/iraf/ximtool/clients/wcspix/wcmef.x + mef_init: + mef_cache: + mef_uncache: + mef_wcstran: + mef_wcslist: + mef_objinfo: +/u2/fitz/iraf/ximtool/clients/wcspix/wcmspec.x + msp_init: + msp_cache: + msp_uncache: + msp_wcstran: + msp_wcslist: + msp_objinfo: +/u2/fitz/iraf/ximtool/clients/wcspix/wcunknown.x + unk_init: + unk_cache: + unk_uncache: + unk_wcstran: + unk_wcslist: + unk_getdata: + unk_objinfo: +/u2/fitz/iraf/ximtool/clients/lib/dspmmap.x + ds_pmmap: + ds_pmimmap: + ds_match: +/u2/fitz/iraf/ximtool/clients/lib/reopen.x + reopen: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/skdecode.x + sk_decwcs: + sk_decwstr: + sk_decim: + sk_strwcs: + sk_imwcs: + sk_enwcs: + sk_copy: + sk_close: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/sksaveim.x + sk_saveim: + sk_ctypeim: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/skset.x + sk_setd: + sk_seti: + sk_sets: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/skstat.x + sk_statd: + sk_stati: + sk_stats: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/sktransform.x + sk_ultran: + sk_lltran: + sk_equatorial: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/skwrdstr.x + sk_wrdstr: +/u2/fitz/iraf/ximtool/clients/lib/skywcs/skwrite.x + sk_iiprint: + sk_iiwrite: + sk_inprint: + sk_inwrite: + sk_imprint: + sk_imwrite: +/u2/fitz/iraf/ximtool/clients/lib/ximtool.x + xim_connect: + xim_disconnect: + xim_message: + xim_alert: + xim_write: + xim_read: + xim_intrhandler: + xim_zxwhen: + xim_onerror: +/u2/fitz/iraf/ximtool/clients/lib/idxstr.x + idxstr: +/u2/fitz/iraf/ximtool/clients/lib/wcsgfterm.x + wcs_gfterm: +Making function prototype file..... +FTN.f: + dspmmp: + dspmip: + dsmath: +Warning on line 279 of FTN.f: inconsistent calling sequences for mwctrd: + here 4, previously 3 args and string lengths. + idxstr: + reopen: + skdecs: + skdecr: + skdecm: + skstrs: + skimws: + skenws: + skcopy: + skcloe: + sksavm: + skctym: + sksetd: + skseti: + sksets: + skstad: + skstai: + skstas: + skultn: + sklltn: + skequl: + skwrdr: + skiipt: + skiiwe: + skinpt: + skinwe: + skimpt: + skimwe: + twcspx: + wpinie: + wpcace: + wpunce: + wpwcsn: +Warning on line 4823 of FTN.f: inconsistent calling sequences for zcall4, + arg 4: here real variable, previously integer variable. + wpwcst: + wpobjo: + wpsetr: + wpgetr: + wpinit: + wpshun: + wpclas: + wpid2j: + wpclat: + wploas: + wcspie: + wpcnve: + dbgpre: + imgint: + imgcae: + imgune: + imgwcn: + imgwct: + imggea: + imgobo: + imgser: + imgses: + imgseo: + imgseb: + imgams: + imgdes: + imgcos: + imgcot: + imgged: + mefint: + mefcae: + mefune: + mefwcn: + mefwct: + mefobo: + mspint: + mspcae: + mspune: + mspwcn: + mspwct: + mspobo: + wcsgfm: + unkint: + unkcae: + unkune: + unkwcn: + unkwct: + unkgea: + unkobo: + sysruk: + ximcot: + ximdit: + ximmee: + ximalt: + ximwre: + ximred: + ximinr: + ximzxn: + ximonr: +Warning on line 8474 of FTN.f: inconsistent calling sequences for ximalt, + arg 2: here integer variable, previously integer*2 variable. +Rerunning "f2c -P ... FTN.f FTN.P" may change prototypes or declarations. +Converting fortran source file..... +First pass.... +FTN.f: + dspmmp: + dspmip: + dsmath: +Warning on line 264 of FTN.f: inconsistent calling sequences for mwctrd: + here 3, previously 4 args and string lengths. + idxstr: + reopen: + skdecs: + skdecr: + skdecm: + skstrs: + skimws: + skenws: + skcopy: + skcloe: + sksavm: + skctym: + sksetd: + skseti: + sksets: + skstad: + skstai: + skstas: + skultn: + sklltn: + skequl: + skwrdr: + skiipt: + skiiwe: + skinpt: + skinwe: + skimpt: + skimwe: + twcspx: + wpinie: + wpcace: + wpunce: + wpwcsn: +Warning on line 4823 of FTN.f: inconsistent calling sequences for zcall4, + arg 4: here real variable, previously integer variable. + wpwcst: + wpobjo: + wpsetr: + wpgetr: + wpinit: + wpshun: + wpclas: + wpid2j: + wpclat: + wploas: + wcspie: + wpcnve: + dbgpre: + imgint: + imgcae: + imgune: + imgwcn: + imgwct: + imggea: + imgobo: + imgser: + imgses: + imgseo: + imgseb: + imgams: + imgdes: + imgcos: + imgcot: + imgged: + mefint: + mefcae: + mefune: + mefwcn: + mefwct: + mefobo: + mspint: + mspcae: + mspune: + mspwcn: + mspwct: + mspobo: + wcsgfm: + unkint: + unkcae: + unkune: + unkwcn: + unkwct: + unkgea: + unkobo: + sysruk: + ximcot: + ximdit: + ximmee: + ximalt: + ximwre: + ximred: + ximinr: + ximzxn: + ximonr: +Warning on line 8474 of FTN.f: inconsistent calling sequences for ximalt, + arg 2: here integer variable, previously integer*2 variable. +Second pass.... +dspmmap.f: + dspmmp: + dspmip: + dsmath: +Warning on line 264 of dspmmap.f: inconsistent calling sequences for mwctrd: + here 3, previously 4 args and string lengths. +idxstr.f: + idxstr: +reopen.f: + reopen: +skdecode.f: + skdecs: + skdecr: + skdecm: + skstrs: + skimws: + skenws: + skcopy: + skcloe: +sksaveim.f: + sksavm: + skctym: +skset.f: + sksetd: + skseti: + sksets: +skstat.f: + skstad: + skstai: + skstas: +sktransform.f: + skultn: + sklltn: + skequl: +skwrdstr.f: + skwrdr: +skwrite.f: + skiipt: + skiiwe: + skinpt: + skinwe: + skimpt: + skimwe: +t_wcspix.f: + twcspx: + wpinie: + wpcace: + wpunce: + wpwcsn: +Warning on line 414 of t_wcspix.f: inconsistent calling sequences for zcall4, + arg 4: here real variable, previously integer variable. + wpwcst: + wpobjo: + wpsetr: + wpgetr: + wpinit: + wpshun: + wpclas: + wpid2j: + wpclat: + wploas: + wcspie: + wpcnve: + dbgpre: +wcimage.f: + imgint: + imgcae: + imgune: + imgwcn: + imgwct: + imggea: + imgobo: + imgser: + imgses: + imgseo: + imgseb: + imgams: + imgdes: + imgcos: + imgcot: + imgged: +wcmef.f: + mefint: + mefcae: + mefune: + mefwcn: + mefwct: + mefobo: +wcmspec.f: + mspint: + mspcae: + mspune: + mspwcn: + mspwct: + mspobo: +wcsgfterm.f: + wcsgfm: +wcunknown.f: + unkint: + unkcae: + unkune: + unkwcn: + unkwct: + unkgea: + unkobo: +x_ism.f: + sysruk: +ximtool.f: + ximcot: + ximdit: + ximmee: + ximalt: + ximwre: + ximred: + ximinr: + ximzxn: + ximonr: +Warning on line 482 of ximtool.f: inconsistent calling sequences for ximalt, + arg 2: here integer variable, previously integer*2 variable. +Running LINT on converted C source.... +dspmmap.c: +dspmmap.c(152): warning: argument refim unused in function dspmip_ +idxstr.c: +reopen.c: +skdecode.c: +sksaveim.c: +skset.c: +skstat.c: +sktransform.c: +skwrdstr.c: +skwrite.c: +t_wcspix.c: +t_wcspix.c(830): warning: argument wp unused in function wpgetr_ +wcimage.c: +wcimage.c(257): warning: argument id unused in function imgune_ +wcimage.c(380): warning: im set but not used in function imgwcn_ +wcimage.c(430): warning: argument id unused in function imgwct_ +wcimage.c(470): warning: im set but not used in function imgwct_ +wcimage.c(510): warning: argument id unused in function imggea_ +wcimage.c(609): warning: argument id unused in function imgobo_ +wcimage.c(899): warning: co set but not used in function imgses_ +wcmef.c: +wcmspec.c: +wcsgfterm.c: +wcsgfterm.c(122): warning: errcoe set but not used in function wcsgfm_ +wcunknown.c: +wcunknown.c(108): warning: argument id unused in function unkune_ +wcunknown.c(173): warning: wp set but not used in function unkwcn_ +wcunknown.c(144): warning: argument id unused in function unkwcn_ +wcunknown.c(208): warning: argument cp unused in function unkwct_ +wcunknown.c(208): warning: argument id unused in function unkwct_ +wcunknown.c(234): warning: argument id unused in function unkgea_ +wcunknown.c(284): warning: argument id unused in function unkobo_ +x_ism.c: +ximtool.c: +ximtool.c(573): warning: argument nexthr unused in function ximzxn_ +ximtool.c(603): warning: code set but not used in function ximonr_ +Lint pass2: +mwctrd_: variable # of args. dspmmap.c(362) :: dspmmap.c(395) +zcall4_, arg. 4 used inconsistently t_wcspix.c(441) :: t_wcspix.c(525) +zcall4_, arg. 5 used inconsistently t_wcspix.c(441) :: t_wcspix.c(525) +ximalt_, arg. 2 used inconsistently ximtool.c(295) :: ximtool.c(607) +ximalt_, arg. 3 used inconsistently ximtool.c(295) :: ximtool.c(607) +Saving output.... +Cleaning up.... +/bin/rm: No match. +Done. diff --git a/vendor/x11iraf/ximtool/clients.old/doc/Notes b/vendor/x11iraf/ximtool/clients.old/doc/Notes new file mode 100644 index 00000000..da021306 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/doc/Notes @@ -0,0 +1,199 @@ + + +define MAX_WCSLINES 4 + +define SZ_WPIX 6 +define WP_CPTR Memi[$1 ] # cache pointer +define WP_PTABSZ Memi[$1+1] # pixel table size +define WP_SYSTEMS Memi[$1+2] # WCS readout systems +define WP_FORMATS Memi[$1+3] # WCS readout formats + +define SYSTEMS Memi[WP_SYSTEMS($1)+$2-1] # WCS systems per line +define FORMATS Memi[WP_FORMATS($1)+$2-1] # WCS formats per line +define OBJCACHE Memi[WP_CPTR($1)+$2] # object cache + +# Element of an object cache. +define SZ_CNODE 135 # size of a cache node +define SZ_OBJREF 128 # size of a object reference + +define C_OBJID Memi[$1] # object id +define C_REGID Memi[$1+1] # region id +define C_CLASS Memi[$1+2] # object class +define C_DATA Memi[$1+3] # object data ptr +define C_REF Memc[P2C($1+4)] # object reference file + +# Object class definitions. +define IMAGE_CLASS 1 # generic image class +define MEF_CLASS 2 # Mosaic MEF image class +define MULTISPEC_CLASS 3 # multispec data class + +# Class methods. +define LEN_CL 6 # length of class table +define MAX_CL 6 # max supported classes +define SZ_CLNAME 16 # size of a class name + +define CL_INIT cl_table[1,$1] # class initializer +define CL_CACHE cl_table[2,$1] # cache the object +define CL_UNCACHE cl_table[3,$1] # uncache the object +define CL_WCSTRAN cl_table[4,$1] # WCS tranformations +define CL_WCSLIST cl_table[5,$1] # list available WCS +define CL_GETDATA cl_table[6,$1] # get object data +define CL_NAME cl_names[1,$1] # class name + +# Class common. +int cl_nclasses # number of defined functions +int cl_table[LEN_CL,MAX_CL] # class table +char cl_names[SZ_CLNAME,MAX_CL] # class names +common /class_com/ cl_nclasses, cl_table, cl_names + + +# Image class data. +define O_IM Memi[$1+2] # image pointer +define O_MW Memi[$1+3] # image wcs pointer +define O_CO Memi[$1+3] # skywcs transform pointer +define O_CT Memi[$1+4] # mwcs transform pointer +define O_ROT Memr[$1+5] # rotation angle +define O_SCALE Memr[$1+6] # plate scale + + + +-------------------------------------------------------------------------------- +ISM Methods: +-------------------------------------------------------------------------------- + + initialize + cache <objid> <ref> + uncache <objid> + wcstran <objid> <x> <y> [[<region-name> <x> <y>] ["NDC" <x> <y>]] + wcslist <objid> + getheader <objid> <template-list> + + +procedure initialize +begin + for (each object in the cache) + uncache object + send startup req to GUI +end + +procedure cache +begin +end + +procedure uncache +begin +end + +procedure wcstran +begin +end + +procedure wcslist +begin +end + +procedure getheader +begin +end + + +-------------------------------------------------------------------------------- +GUI Callbacks +-------------------------------------------------------------------------------- + +proc ism_msg { param old new } { + + set target [lindex $new 0] ;# name of ism module + + switch [lindex $new 0] { + source { source [lindex $new 1] } ;# source Tcl code + alert { Wexec client [lindex $new 1] } ;# alert from ism client + + deliver { set ism [lindex $new 0] ;# determine ISM name + set argv [lrange $new 1 end] ;# get args + set argc [llength $argv] + ${ism}_msg $argc $argv ;# call module + } + } +} ; send ism_msg addCallback ism_msg + + +proc wpix_msg { argc argv } { + + switch [lindex $argv 0] { + startup { wpix_startup } + shutdown { wpix_shutdown } + cache { .... save image name to GUI cache list + } + uncache { .... remove image name from GUI cache list + } + wcstran { .... parse argv for WCS field and update display + } + pixtab { + } + wcslist { + } + wcstype { set type [lindex $argv 1] ;# Set WCS for a line + set line [lindex $argv 2] + send sysWcs$line set label $type + if {$type == "None"} { + send wpWcs$line set on False + } else { + send wpWcs$line set on True + } + setCoordPanelHeight + } + wcsfmt { set fmt [lindex $argv 1] ;# Set fmt for a line + set line [lindex $argv 2] + send fmtWcs$line set label $fmt + } + header { set type [lindex $argv 1] ;# write header text + set text [lindex $argv 2] + switch $type { + imghdr {send hdrText append $text} + wcshdr {send hdrKGText append $text} + wcsinfo {send hdrIGText append $text} + } + } + } ;# end switch +} + +proc wpix_startup args { + global ismEnabled frameCache + + set ismEnabled 1 ;# initialize buttons + send ismToggle set on True + send imageHeader setSensitive True + setCoordPanelSensitivity + + resizeCoordsBox $up_todo ;# resize wcsbox marker + updateCoordsBox + + foreach c [array names frameCache] { ;# initialize local frame cache + if {$c != "0"} { unset frameCache($c) } + } + + catch { ;# update ISM with GUI settings + send wpix set psize $psize + set wcsfmt [string tolower [send wcsFmtMenu get label]] + send wpix set wcsfmt $wcsfmt + if {[send wcsSysAltWCS get on]} { + setAltSystem + } + } +} + +proc wpix_shutdown args { + global ismEnabled + + set ismEnabled 0 + send ismToggle set on False + send imageHeader setSensitive False + setCoordPanelSensitivity + wcsFmtIValue "" + wcsFmtImWCS "" "" "" + wcsFmtAltWCS "" "" "" + resizeCoordsBox 0 +} + + diff --git a/vendor/x11iraf/ximtool/clients.old/doc/README b/vendor/x11iraf/ximtool/clients.old/doc/README new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients.old/lib/README b/vendor/x11iraf/ximtool/clients.old/lib/README new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients.old/lib/dspmmap.f b/vendor/x11iraf/ximtool/clients.old/lib/dspmmap.f new file mode 100644 index 00000000..3542286f --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/dspmmap.f @@ -0,0 +1,356 @@ + integer function dspmmp (pmname, refim) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer refim + integer*2 pmname(*) + integer im + integer*2 fname(255 +1) + integer nowhie + integer errcoe + logical streq + integer impmmp + integer dspmip + logical xerpop + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(6) + integer*2 st0002(4) + integer*2 st0003(4) + save + data st0001 / 69, 77, 80, 84, 89, 0/ + data st0002 / 66, 80, 77, 0/ + data st0003 / 66, 80, 77, 0/ + if (.not.(nowhie (pmname, fname, 255 ) .eq. 0)) goto 110 + dspmmp = (0) + goto 100 +110 continue + if (.not.(streq (fname, st0001))) goto 120 + dspmmp = (0) + goto 100 +120 continue + if (.not.(fname(1) .eq. 33)) goto 130 + call xerpsh + call imgstr (refim, fname(2), fname, 255 ) + if (.not.xerpop()) goto 140 + fname(1) = 0 +140 continue + goto 131 +130 continue + if (.not.(streq (fname, st0002))) goto 150 + call xerpsh + call imgstr (refim, st0003, fname, 255 ) + if (.not.xerpop()) goto 160 + dspmmp = (0) + goto 100 +160 continue +150 continue +131 continue + call xerpsh + im = impmmp (fname, 1 , 0) + if (.not.xerpop()) goto 170 + sw0001=(errcoe()) + goto 180 +190 continue + im = dspmip (fname, refim) + if (xerflg) goto 100 + goto 181 +200 continue + call erract (2 ) + if (xerflg) goto 100 + goto 181 +180 continue + if (sw0001.eq.743) goto 190 + if (sw0001.eq.921) goto 190 + goto 200 +181 continue +170 continue + call xerpsh + call dsmath (im, refim) + if (.not.xerpop()) goto 210 + call erract (3 ) + if (xerflg) goto 100 +210 continue + dspmmp = (im) + goto 100 +100 return + end + integer function dspmip (pmname, refim) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer refim + integer*2 pmname(*) + integer i + integer ndim + integer npix + integer val + integer sp + integer v1 + integer v2 + integer imin + integer imout + integer pm + integer mw + integer data + integer imgnli + integer immap + integer pmnewk + integer impmmo + integer imgl1i + integer mwopem + logical xerflg + common /xercom/ xerflg + save + call smark (sp) + call salloc (v1, 7 , 5) + call salloc (v2, 7 , 5) + call amovkl (int(1), meml(v1), 7 ) + call amovkl (int(1), meml(v2), 7 ) + imin = immap (pmname, 1 , 0) + if (xerflg) goto 100 + pm = pmnewk (imin, 27) + ndim = memi(imin+200 +7) + npix = meml(imin+200 +1+8-1) +110 if (.not.(imgnli (imin, data, meml(v1)) .ne. -2)) goto 111 + do 120 i = 0, npix-1 + val = memi(data+i) + if (.not.(val .lt. 0)) goto 130 + memi(data+i) = 0 +130 continue +120 continue +121 continue + call pmplpi (pm, meml(v2), memi(data), 0, npix, 12 ) + call amovl (meml(v1), meml(v2), ndim) + goto 110 +111 continue + imout = impmmo (pm, imin) + data = imgl1i (imout) + mw = mwopem (imin) + if (xerflg) goto 100 + call mwsavm (mw, imout) + call mwcloe (mw) + call imunmp (imin) + call sfree (sp) + dspmip = (imout) + goto 100 +100 return + end + subroutine dsmath (im, refim) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer refim + integer i + integer j + integer k + integer l + integer i1 + integer i2 + integer j1 + integer j2 + integer nc + integer nl + integer ncpm + integer nlpm + integer nx + integer val + double precision x1 + double precision x2 + double precision y1 + double precision y2 + double precision lt(6) + double precision lt1(6) + double precision lt2(6) + integer*4 vold(7 ) + integer*4 vnew(7 ) + integer pm + integer pmnew + integer imnew + integer mw + integer ctx + integer cty + integer bufref + integer bufpm + integer imstai + integer plopen + integer mwopem + integer impmmo + integer imgl1i + integer mwsctn + logical pmempy + logical pmliny + logical xerflg + common /xercom/ xerflg + integer*2 st0001(40) + integer*2 st0002(8) + integer*2 st0003(9) + integer*2 st0004(8) + integer*2 st0005(9) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 73,109, 97,103,101, 32, 97,110/ + data (st0001(iyy),iyy= 9,16) /100, 32,109, 97,115,107, 32,104/ + data (st0001(iyy),iyy=17,24) / 97,118,101, 32, 97, 32,114,101/ + data (st0001(iyy),iyy=25,32) /108, 97,116,105,118,101, 32,114/ + data (st0001(iyy),iyy=33,40) /111,116, 97,116,105,111,110, 0/ + data st0002 /108,111,103,105, 99, 97,108, 0/ + data (st0003(iyy),iyy= 1, 8) /112,104,121,115,105, 99, 97,108/ + data (st0003(iyy),iyy= 9, 9) / 0/ + data st0004 /108,111,103,105, 99, 97,108, 0/ + data (st0005(iyy),iyy= 1, 8) /112,104,121,115,105, 99, 97,108/ + data (st0005(iyy),iyy= 9, 9) / 0/ + if (.not.(im .eq. 0)) goto 110 + goto 100 +110 continue + nc = meml(refim+200 +1+8-1) + nl = meml(refim+200 +2+8-1) + ncpm = meml(im+200 +1+8-1) + nlpm = meml(im+200 +2+8-1) + pm = imstai (im, 16 ) + if (.not.(pmempy(pm) .and. nc .eq. ncpm .and. nl .eq. nlpm)) + * goto 120 + goto 100 +120 continue + mw = mwopem (im) + if (xerflg) goto 100 + call mwgltd (mw, lt, lt(5), 2) + call mwcloe (mw) + mw = mwopem (refim) + if (xerflg) goto 100 + call mwgltd (mw, lt2, lt2(5), 2) + call mwcloe (mw) + call mwinvd (lt, lt1, 2) + call mwmmud (lt1, lt2, lt, 2) + call mwvmud (lt, lt(5), lt(5), 2) + lt(5) = lt2(5) - lt(5) + lt(6) = lt2(6) - lt(6) + do 130 i = 1, 6 + lt(i) = nint (1d6 * (lt(i)-int(lt(i)))) / 1d6 + int(lt(i)) +130 continue +131 continue + if (.not.(lt(2) .ne. 0. .or. lt(3) .ne. 0.)) goto 140 + call xerror(1, st0001) + if (xerflg) goto 100 +140 continue + if (.not.(lt(1) .eq. 1d0 .and. lt(4) .eq. 1d0 .and. lt(5) .eq. + * 0d0 .and. lt(6) .eq. 0d0)) goto 150 + goto 100 +150 continue + mw = mwopem (im) + if (xerflg) goto 100 + call mwsltd (mw, lt, lt(5), 2) + ctx = mwsctn (mw, st0002, st0003, 1) + cty = mwsctn (mw, st0004, st0005, 2) + pmnew = plopen(0) + if (xerflg) goto 100 + call plssie(pmnew, 2, meml(refim+200 +1+8-1) , 27) + imnew = impmmo (pmnew, 0) + bufref = imgl1i (imnew) + call mwctrd (ctx, 1-0.5d0, x1, 1) + call mwctrd (ctx, nc+0.5d0, x2, 1) + i1 = max (1, nint(min(x1,x2)+1d-5)) + i2 = min (ncpm, nint(max(x1,x2)-1d-5)) + call mwctrd (cty, 1-0.5d0, y1, 1) + call mwctrd (cty, nl+0.5d0, y2, 1) + j1 = max (1, nint(min(y1,y2)+1d-5)) + j2 = min (nlpm, nint(max(y1,y2)-1d-5)) + if (.not.(i1 .le. i2 .and. j1 .le. j2)) goto 160 + nx = i2 - i1 + 1 + call xmallc(bufpm, nx, 4) + call xmallc(bufref, nc, 4) + vold(1) = i1 + vnew(1) = 1 + do 170 j = 1, nl + call mwctrd (cty, j-0.5d0, y1, 1) + call mwctrd (cty, j+0.5d0, y2, 1) + j1 = max (1, nint(min(y1,y2)+1d-5)) + j2 = min (nlpm, nint(max(y1,y2)-1d-5)) + if (.not.(j2 .lt. j1)) goto 180 + goto 170 +180 continue + vnew(2) = j + call aclri (memi(bufref), nc) + do 190 l = j1, j2 + vold(2) = l + if (.not.(.not.pmliny (pm, vold))) goto 200 + goto 190 +200 continue + call pmglpi (pm, vold, memi(bufpm), 0, nx, 0) + do 210 i = 1, nc + call mwctrd (ctx, i-0.5d0, x1, 1) + call mwctrd (ctx, i+0.5d0, x2, 1) + i1 = max (1, nint(min(x1,x2)+1d-5)) + i2 = min (ncpm, nint(max(x1,x2)-1d-5)) + if (.not.(i2 .lt. i1)) goto 220 + goto 210 +220 continue + val = memi(bufref+i-1) + do 230 k = i1-vold(1), i2-vold(1) + val = max (val, memi(bufpm+k)) +230 continue +231 continue + memi(bufref+i-1) = val +210 continue +211 continue +190 continue +191 continue + call pmplpi (pmnew, vnew, memi(bufref), 0, nc, 12 ) +170 continue +171 continue + call xmfree(bufref, 4) + call xmfree(bufpm, 4) +160 continue + call mwcloe (mw) + call imunmp (im) + im = imnew + call imseti (im, 16 , pmnew) +100 return + end +c pmliny pm_linenotempty +c mwmmud mw_mmuld +c errcoe errcode +c mwsltd mw_sltermd +c mwinvd mw_invertd +c impmmo im_pmmapo +c plssie pl_ssize +c mwctrd mw_ctrand +c pmempy pm_empty +c mwvmud mw_vmuld +c dsmath ds_match +c plopen pl_open +c mwsavm mw_saveim +c mwopem mw_openim +c imunmp imunmap +c mwsctn mw_sctran +c impmmp im_pmmap +c dspmip ds_pmimmap +c dspmmp ds_pmmap +c imstai imstati +c nowhie nowhite +c mwcloe mw_close +c pmnewk pm_newmask +c mwgltd mw_gltermd diff --git a/vendor/x11iraf/ximtool/clients.old/lib/dspmmap.x b/vendor/x11iraf/ximtool/clients.old/lib/dspmmap.x new file mode 100644 index 00000000..621f0372 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/dspmmap.x @@ -0,0 +1,244 @@ +include <mach.h> +include <ctype.h> +include <error.h> +include <imhdr.h> +include <imset.h> +include <pmset.h> +include <syserr.h> + + +# DS_PMMAP -- Open a pixel mask READ_ONLY. +# +# Open the pixel mask. If a regular image is specified convert it to +# a pixel mask. Match the mask to the reference image based on the +# physical coordinates. A null filename is allowed and returns NULL. + +pointer procedure ds_pmmap (pmname, refim) + +char pmname[ARB] #I Pixel mask name +pointer refim #I Reference image pointer + +pointer im +char fname[SZ_FNAME] +int nowhite(), errcode() +bool streq() +pointer im_pmmap(), ds_pmimmap() +errchk ds_pmimmap, ds_match + +begin + if (nowhite (pmname, fname, SZ_FNAME) == 0) + return (NULL) + if (streq (fname, "EMPTY")) + return (NULL) + if (fname[1] == '!') { + iferr (call imgstr (refim, fname[2], fname, SZ_FNAME)) + fname[1] = EOS + } else if (streq (fname, "BPM")) { + iferr (call imgstr (refim, "BPM", fname, SZ_FNAME)) + return (NULL) + } + + iferr (im = im_pmmap (fname, READ_ONLY, NULL)) { + switch (errcode()) { + case SYS_FOPNNEXFIL, SYS_PLBADSAVEF: + im = ds_pmimmap (fname, refim) + default: + call erract (EA_ERROR) + } + } + + iferr (call ds_match (im, refim)) + call erract (EA_WARN) + + return (im) +end + + +# DS_PMIMMAP -- Open a pixel mask from a non-pixel list image. +# Return error if the image cannot be opened. + +pointer procedure ds_pmimmap (pmname, refim) + +char pmname[ARB] #I Image name +pointer refim #I Reference image pointer + +int i, ndim, npix, val +pointer sp, v1, v2, im_in, im_out, pm, mw, data + +int imgnli() +pointer immap(), pm_newmask(), im_pmmapo(), imgl1i(), mw_openim() +errchk immap, mw_openim + +begin + call smark (sp) + call salloc (v1, IM_MAXDIM, TY_LONG) + call salloc (v2, IM_MAXDIM, TY_LONG) + + call amovkl (long(1), Meml[v1], IM_MAXDIM) + call amovkl (long(1), Meml[v2], IM_MAXDIM) + + im_in = immap (pmname, READ_ONLY, 0) + pm = pm_newmask (im_in, 27) + + ndim = IM_NDIM(im_in) + npix = IM_LEN(im_in,1) + + while (imgnli (im_in, data, Meml[v1]) != EOF) { + do i = 0, npix-1 { + val = Memi[data+i] + if (val < 0) + Memi[data+i] = 0 + } + call pmplpi (pm, Meml[v2], Memi[data], 0, npix, PIX_SRC) + call amovl (Meml[v1], Meml[v2], ndim) + } + + im_out = im_pmmapo (pm, im_in) + data = imgl1i (im_out) # Force I/O to set header + mw = mw_openim (im_in) # Set WCS + call mw_saveim (mw, im_out) + call mw_close (mw) + + call imunmap (im_in) + call sfree (sp) + return (im_out) +end + + +# DS_MATCH -- Set the pixel mask to match the reference image. +# This matches sizes and physical coordinates and allows the +# original mask to be smaller or larger than the reference image. +# Subsequent use of the pixel mask can then work in the logical +# coordinates of the reference image. The mask values are the maximum +# of the mask values which overlap each reference image pixel. +# A null input returns a null output. + +procedure ds_match (im, refim) + +pointer im #U Pixel mask image pointer +pointer refim #I Reference image pointer + +int i, j, k, l, i1, i2, j1, j2, nc, nl, ncpm, nlpm, nx, val +double x1, x2, y1, y2, lt[6], lt1[6], lt2[6] +long vold[IM_MAXDIM], vnew[IM_MAXDIM] +pointer pm, pmnew, imnew, mw, ctx, cty, bufref, bufpm + +int imstati() +pointer pm_open(), mw_openim(), im_pmmapo(), imgl1i(), mw_sctran() +bool pm_empty(), pm_linenotempty() +errchk pm_open, mw_openim + +begin + if (im == NULL) + return + + # Set sizes. + nc = IM_LEN(refim,1) + nl = IM_LEN(refim,2) + ncpm = IM_LEN(im,1) + nlpm = IM_LEN(im,2) + + # If the mask is empty and the sizes are the same then it does not + # matter if the two are actually matched in physical coordinates. + pm = imstati (im, IM_PMDES) + if (pm_empty(pm) && nc == ncpm && nl == nlpm) + return + + # Compute transformation between reference (logical) coordinates + # and mask (physical) coordinates. + + mw = mw_openim (im) + call mw_gltermd (mw, lt, lt[5], 2) + call mw_close (mw) + + mw = mw_openim (refim) + call mw_gltermd (mw, lt2, lt2[5], 2) + call mw_close (mw) + + # Combine lterms. + call mw_invertd (lt, lt1, 2) + call mw_mmuld (lt1, lt2, lt, 2) + call mw_vmuld (lt, lt[5], lt[5], 2) + lt[5] = lt2[5] - lt[5] + lt[6] = lt2[6] - lt[6] + do i = 1, 6 + lt[i] = nint (1D6 * (lt[i]-int(lt[i]))) / 1D6 + int(lt[i]) + + # Check for a rotation. For now don't allow any rotation. + if (lt[2] != 0. || lt[3] != 0.) + call error (1, "Image and mask have a relative rotation") + + # Check for an exact match. + if (lt[1] == 1D0 && lt[4] == 1D0 && lt[5] == 0D0 && lt[6] == 0D0) + return + + # Set reference to mask coordinates. + mw = mw_openim (im) + call mw_sltermd (mw, lt, lt[5], 2) + ctx = mw_sctran (mw, "logical", "physical", 1) + cty = mw_sctran (mw, "logical", "physical", 2) + + # Create a new pixel mask of the required size and offset. + # Do dummy image I/O to set the header. + pmnew = pm_open (NULL) + call pm_ssize (pmnew, 2, IM_LEN(refim,1), 27) + imnew = im_pmmapo (pmnew, NULL) + bufref = imgl1i (imnew) + + # Compute region of mask overlapping the reference image. + call mw_ctrand (ctx, 1-0.5D0, x1, 1) + call mw_ctrand (ctx, nc+0.5D0, x2, 1) + i1 = max (1, nint(min(x1,x2)+1D-5)) + i2 = min (ncpm, nint(max(x1,x2)-1D-5)) + call mw_ctrand (cty, 1-0.5D0, y1, 1) + call mw_ctrand (cty, nl+0.5D0, y2, 1) + j1 = max (1, nint(min(y1,y2)+1D-5)) + j2 = min (nlpm, nint(max(y1,y2)-1D-5)) + + # Set the new mask values to the maximum of all mask values falling + # within each reference pixel in the overlap region. + if (i1 <= i2 && j1 <= j2) { + nx = i2 - i1 + 1 + call malloc (bufpm, nx, TY_INT) + call malloc (bufref, nc, TY_INT) + vold[1] = i1 + vnew[1] = 1 + do j = 1, nl { + call mw_ctrand (cty, j-0.5D0, y1, 1) + call mw_ctrand (cty, j+0.5D0, y2, 1) + j1 = max (1, nint(min(y1,y2)+1D-5)) + j2 = min (nlpm, nint(max(y1,y2)-1D-5)) + if (j2 < j1) + next + + vnew[2] = j + call aclri (Memi[bufref], nc) + do l = j1, j2 { + vold[2] = l + if (!pm_linenotempty (pm, vold)) + next + call pmglpi (pm, vold, Memi[bufpm], 0, nx, 0) + do i = 1, nc { + call mw_ctrand (ctx, i-0.5D0, x1, 1) + call mw_ctrand (ctx, i+0.5D0, x2, 1) + i1 = max (1, nint(min(x1,x2)+1D-5)) + i2 = min (ncpm, nint(max(x1,x2)-1D-5)) + if (i2 < i1) + next + val = Memi[bufref+i-1] + do k = i1-vold[1], i2-vold[1] + val = max (val, Memi[bufpm+k]) + Memi[bufref+i-1] = val + } + } + call pmplpi (pmnew, vnew, Memi[bufref], 0, nc, PIX_SRC) + } + call mfree (bufref, TY_INT) + call mfree (bufpm, TY_INT) + } + + call mw_close (mw) + call imunmap (im) + im = imnew + call imseti (im, IM_PMDES, pmnew) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/idxstr.f b/vendor/x11iraf/ximtool/clients.old/lib/idxstr.f new file mode 100644 index 00000000..ac16febf --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/idxstr.f @@ -0,0 +1,44 @@ + integer function idxstr (index, outstr, maxch, dict) + integer index + integer maxch + integer*2 outstr(*) + integer*2 dict(*) + integer i + integer len + integer start + integer count + integer xstrln + save + outstr(1) = 0 + if (.not.(dict(1) .eq. 0)) goto 110 + idxstr = (0) + goto 100 +110 continue + count = 1 + len = xstrln(dict) + start = 2 +120 if (.not.(count .lt. index)) goto 122 + if (.not.(dict(start) .eq. dict(1))) goto 130 + count = count + 1 +130 continue + if (.not.(start .eq. len)) goto 140 + idxstr = (0) + goto 100 +140 continue +121 start = start + 1 + goto 120 +122 continue + i = start +150 if (.not.(dict(i) .ne. 0 .and. dict(i) .ne. dict(1))) goto 152 + if (.not.(i - start + 1 .gt. maxch)) goto 160 + goto 152 +160 continue + outstr(i - start + 1) = dict(i) +151 i = i + 1 + goto 150 +152 continue + outstr(i - start + 1) = 0 + idxstr = (count) + goto 100 +100 return + end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/idxstr.x b/vendor/x11iraf/ximtool/clients.old/lib/idxstr.x new file mode 100644 index 00000000..7b055658 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/idxstr.x @@ -0,0 +1,54 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + + +# IDXSTR -- Search a dictionary string for a given string index number. +# This is the opposite function of strdic(), that returns the index for +# given string. The entries in the dictionary string are separated by +# a delimiter character which is the first character of the dictionary +# string. The index of the string found is returned as the function value. +# Otherwise, if there is no string for that index, a zero is returned. + +int procedure idxstr (index, outstr, maxch, dict) + +int index #i String index +char outstr[ARB] #o Output string as found in dictionary +int maxch #i Maximum length of output string +char dict[ARB] #i Dictionary string + +int i, len, start, count + +int strlen() + +begin + # Clear the output string. + outstr[1] = EOS + + # Return if the dictionary is not long enough. + if (dict[1] == EOS) + return (0) + + # Initialize the counters. + count = 1 + len = strlen (dict) + + # Search the dictionary string. This loop only terminates + # successfully if the index is found. Otherwise the procedure + # returns with and error condition. + for (start = 2; count < index; start = start + 1) { + if (dict[start] == dict[1]) + count = count + 1 + if (start == len) + return (0) + } + + # Extract the output string from the dictionary. + for (i = start; dict[i] != EOS && dict[i] != dict[1]; i = i + 1) { + if (i - start + 1 > maxch) + break + outstr[i - start + 1] = dict[i] + } + outstr[i - start + 1] = EOS + + # Return index for output string. + return (count) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/mkpkg b/vendor/x11iraf/ximtool/clients.old/lib/mkpkg new file mode 100644 index 00000000..3c6a6c14 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/mkpkg @@ -0,0 +1,17 @@ +# Make the ISM Client tasks. + +$checkout libpkg.a ../ +$update libpkg.a +$checkin libpkg.a ../ +$exit + +libpkg.a: + @skywcs + idxstr.x + reopen.x <config.h> <fio.com> <fio.h> + dspmmap.x <ctype.h> <error.h> <imhdr.h> <imset.h> \ + <mach.h> <pmset.h> + wcsgfterm.x + ximtool.x <config.h> <mach.h> <xwhen.h> + ; + diff --git a/vendor/x11iraf/ximtool/clients.old/lib/reopen.f b/vendor/x11iraf/ximtool/clients.old/lib/reopen.f new file mode 100644 index 00000000..f7a1c456 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/reopen.f @@ -0,0 +1,70 @@ + integer function reopen (fd, mode) + integer fd + integer mode + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer newfp + integer ffp + integer newfd + integer fgetfd + integer*4 boffst(4096 ) + integer bufptr(4096 ) + integer buftop(4096 ) + integer iop(4096 ) + integer itop(4096 ) + integer otop(4096 ) + integer fiodes(4096 ) + integer fflags(4096 ) + integer redird(4096 ) + integer zdev(150 ) + integer nextdv + integer fp + integer*2 pathne(511 +1) + logical xerflg + common /xercom/ xerflg + common /fiocom/ boffst, bufptr, buftop, iop, itop, otop, fiodes, + *fflags, redird, zdev, nextdv, fp, pathne + save + ffp = fiodes(fd) + if (.not.(fd .le. 0 .or. ffp .eq. 0)) goto 110 + call syserr (733) + if (xerflg) goto 100 +110 continue + if (.not.(memi(ffp+1) .eq. 1 .and. mode .ne. 1 )) goto 120 + call filerr (memc((((ffp+20+(10+256))-1)*2+1)) , 750) +120 continue + if (.not.(memi(ffp+2) .ne. 12)) goto 130 + call filerr (memc((((ffp+20+(10+256))-1)*2+1)) , 751) +130 continue + newfd = fgetfd (memc((((ffp+20+(10+256))-1)*2+1)) , mode, 12) + newfp = fiodes(newfd) + memi(newfp+3) = memi(ffp+3) + memi(newfp+4) = memi(ffp+4) + memi(newfp) = memi(ffp) + if (.not.(memi(ffp+18) .eq. (ffp+20) )) goto 140 + call xmallc(memi(ffp+18) , (10+256), 10 ) + if (xerflg) goto 100 + call amovi (memi((ffp+20) ), memi(memi(ffp+18) ), (10+256)) +140 continue + memi(memi(ffp+18) ) = memi(memi(ffp+18) ) + 1 + memi(newfp+18) = memi(ffp+18) + if (.not.(mode .eq. 4)) goto 150 + call xfseek(newfd, -2) + if (xerflg) goto 100 +150 continue + reopen = (newfd) + goto 100 +100 return + end +c nextdv next_dev +c boffst boffset +c redird redir_fd +c pathne pathname diff --git a/vendor/x11iraf/ximtool/clients.old/lib/reopen.x b/vendor/x11iraf/ximtool/clients.old/lib/reopen.x new file mode 100644 index 00000000..59ddba30 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/reopen.x @@ -0,0 +1,55 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <config.h> +include <syserr.h> +include <fio.h> + +# REOPEN -- Reopen a binary file. Used to gain two or more independent +# sets of buffers to access a binary file. No protection against two +# file descriptors trying to write to the same part of the file at the +# same time, which may result in loss of data. The file descriptors and +# buffers of reopened files are independent, but all files accessing the +# same channel share the same channel descriptor (necessary to synchronize +# i/o requests and to maintain a unique file size parameter). + +int procedure reopen (fd, mode) + +int fd, mode +pointer newfp, ffp +int newfd, fgetfd() +errchk syserr, malloc, seek +include <fio.com> + +begin + ffp = fiodes[fd] + if (fd <= 0 || ffp == NULL) + call syserr (SYS_FILENOTOPEN) + + if (FMODE(ffp) == READ_ONLY && mode != READ_ONLY) + call filerr (FNAME(ffp), SYS_FREOPNMODE) + if (FTYPE(ffp) != BINARY_FILE) + call filerr (FNAME(ffp), SYS_FREOPNTYPE) + + newfd = fgetfd (FNAME(ffp), mode, BINARY_FILE) + newfp = fiodes[newfd] + + FDEV(newfp) = FDEV(ffp) + FBUFSIZE(newfp) = FBUFSIZE(ffp) + FCHAN(newfp) = FCHAN(ffp) + + # If this is the first reopen, allocate space for a separate channel + # descriptor and copy the channel descriptor from the original file. + + if (FCD(ffp) == FLCD(ffp)) { + call malloc (FCD(ffp), LEN_CHANDES, TY_STRUCT) + call amovi (Memi[FLCD(ffp)], Memi[FCD(ffp)], LEN_CHANDES) + } + + FREFCNT(ffp) = FREFCNT(ffp) + 1 # bump ref count + FCD(newfp) = FCD(ffp) + + if (mode == APPEND) + call seek (newfd, EOFL) + + return (newfd) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/README b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/README new file mode 100644 index 00000000..d15ab738 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/README @@ -0,0 +1,302 @@ + SKYWCS: The Sky Coordinates Package + +1. Introduction + + The skywcs package contains a simple set of routines for doing managing sky +coordinate information and for transforming from one sky coordinate system to +another. The sky coordinate system is defined either by a system name, e.g. +"J2000", "galactic, etc., or by an image system name, e.g. "dev$ypix" or +"dev$ypix world". + + The skywcs routine are layered on the Starlink Positional Astronomy library +SLALIB which is installed in the IRAF MATH package. Type "help slalib option= +sys" for more information about SLALIB. + + +2. The Interface Routines + +The package prefix is sk. The interface routines are listed below. + + stat = sk_decwcs (ccsystem, mw, coo, imcoo) + stat = sk_decwstr (ccsystem, coo, imcoo) + stat = sk_decim (im, wcs, mw, coo) + sk_enwcs (coo, ccsystem, maxch) + newcoo = sk_copy (coo) + sk_iiprint (label, imagesys, mw, coo) + sk_iiwrite (fd, label, imagesys, mw, coo) +[id]val = sk_stat[id] (coo, param) + sk_stats (coo, param, str, maxch) + sk_set[id] (coo, param, [id]val) + sk_sets (coo, param, str) + sk_ultran (incoo, outcoo, ilng, ilat, olng, olat, npts) + sk_lltran (incoo, outoo, ilng, ilat, ipmlng, ipmlat, px, rv, + olng, olat) + sk_equatorial (incoo, outcoo, ilng, ilat, ipmlng, ipmlat, px, + rv, olng, olat) + sk_saveim (coo, mw, im) + sk_close (coo) + + +3. Notes + + An "include <pkg/skywcs.h>" statement must be included in the calling +program to make the skywcs package parameter definitions visible to the calling +program. + + An "-lxtools -lslalib" must be included in the calling program link line +to link in the skywcs and the slalib routines. + + The sky coordinate descriptor is created with a call to one of the +sk_decwcs, sk_decwstr, or sk_imwcs routines. If the source of the sky +coordinate descriptor is an image then an IRAF MWCS descriptor will be returned +with the sky oordinate descriptor. The sky coordinate descriptor is freed with a +call to sk_close. A separate call to mw_close must be made to free the MWCS +descriptor if one was allocated. + + By default the main skywcs coordinate transformation routine sk_ultran +assumes that the input and output sky coordinates are in hours and degrees +if the input and output coordinate systems are equatorial, otherwise the +coordinates are assumed to be in degrees and degrees. The default input and +output sky coordinate units can be reset with calls to sk_seti. Two lower level +coordinate transformations for handling proper motions sk_lltran and +sk_equatorial are also available. These routines that the input and output +coordinates and proper motions are in radians. + + Calling programs working with both sky coordinate and MWCS descriptors +need to be aware that the MWCS routines assume that all sky coordinates +must be input in degrees and will be output in degrees and adjust their +code accordingly. + + The skywcs routine sk_saveim can be used to update an image header. + + +3. Examples + +Example 1: Convert from B1950 coordinates to J2000 coordinates. + + include <skywcs.h> + + .... + + # Open input coordinate system. + instat = sk_decwstr ("B1950", incoo, NULL) + if (instat == ERR) { + call sk_close (incoo) + return + } + + # Open output coordinate system. + outstat = sk_decwstr ("J2000", outcoo, NULL) + if (outstat == ERR) { + call sk_close (outcoo) + return + } + + # Do the transformation assuming the input coordinates are in hours + # and degrees. The output coordinates will be in hours and degrees + # as well. + call sk_ultran (incoo, outcoo, rain, decin, raout, decout, npts) + + # Close the coordinate descriptors. + call sk_close (incoo) + call sk_close (outcoo) + + ... + + +Example 2: Repeat example 1 but convert to galactic coordinates. + + include <skywcs.h> + + .... + + # Open the input coordinate system. + instat = sk_decwstr ("B1950", incoo, NULL) + if (instat == ERR) { + call sk_close (incoo) + return + } + + # Open the output coordinate system. + outstat = sk_decwstr ("galactic", outcoo, NULL) + if (outstat == ERR) { + call sk_close (outcoo) + return + } + + # Dd the transformation assuming the input coordinates are in hours and + # degrees. The output coordinates will be in degrees and degrees. + call sk_ultran (incoo, outcoo, rain, decin, raout, decout, npts) + + # Close the coordinate descriptors. + call sk_close (incoo) + call sk_close (outcoo) + + ... + +Example 3: Convert a grid of pixel coordinates in the input image to the +equivalent pixel coordinate in the output image using the image world +coordinate systems to connect the two. + + include <skywcs.h> + + .... + + # Mwref will be defined because the input system is an image. + refstat = sk_decwcs ("refimage logical", mwref, refcoo, NULL) + if (refstat == ERR || mwref == NULL) { + if (mwref != NULL) + call mw_close (mwref) + call sk_close (refcoo) + return + } + + # Set the reference coordinate descriptor so it expects input in degrees + # and degrees. + call sk_seti (refcoo, S_NLNGUNUTS, SKY_DEGREES) + call sk_seti (refcoo, S_NLATUNUTS, SKY_DEGREES) + + # Mwout will be defined because the output system is an image. + outstat = sk_decwcs ("image logical", mwout, outcoo, NULL) + if (outstat == ERR || mwout == NULL) { + if (mwout != NULL) + call mw_close (mwout) + call sk_close (outcoo) + call mw_close (mwref) + call sk_close (refcoo) + return + } + + # Set the output coordinate descriptor so it will output coordinates + # in degrees and degrees. + call sk_seti (outcoo, S_NLNGUNUTS, SKY_DEGREES) + call sk_seti (outcoo, S_NLATUNUTS, SKY_DEGREES) + + # Compute pixel grid in refimage and store coordinate in the arrays + # xref and yref. + npts = 0 + do j = 1, IM_LEN(im,2), 100 { + do i = 1, IM_LEN(im,1), 100 { + npts = npts + 1 + xref[npts] = i + yref[npts] = j + } + } + + # Convert xref and yref to celestial coordinates raref and decref using + # mwref. The output coordinates will be in degrees and degrees. + ctref = mw_sctran (mwref, "logical", "world", 03B) + do i = 1, npts + call mw_c2trand (ctref, xref[i], yref[i], raref[i], decref[i]) + call ct_free (ctref) + + # Convert the reference celestial coordinates to the output celestial + # coordinate system using the coordinate descriptors. + call sk_ultran (refcoo, outcoo, raref, decref, raout, decout, npts) + + # Convert the output celestial coordinates to pixel coordinates in + # the other image using mwout. + ctout = mw_sctran (mwout, "world", "logical", 03B) + do i = 1, npts + call mw_c2trand (ctout, raout[i], decout[i], xout[i], yout[i]) + call ct_free (ctout) + + # Print the input and output pixel coordinates. + do i = 1, npts { + call printf ("%10.3f %10.3f %10.3f %10.3f\n") + call pargd (xref[i]) + call pargd (yref[i]) + call pargd (xout[i]) + call pargd (yout[i]) + } + + # Tidy up. + call mw_close (mwref) + call mw_close (mwout) + call sk_close (refcoo) + call sk_close (outcoo) + + +Example 4: Convert a 2D image with an J2000 tangent plane projection wcs to the +equivalent galactic wcs. The transformation requires a shift in origin and a +rotation. Assume that the ra axis is 1 and the dec axis is 2. The details of +how to compute the rotation are not shown here. See the imcctran task for +details. + + include <mwset.h> + include <skywcs.h> + + ... + + # Open image. + im = immap (image, READ_WRITE, 0) + + # Open the image coordinate system. + instat = sk_decim (im, "logical", mwin, cooin) + if (instat == ERR || mwin == NULL) { + ... + call sk_close (cooin) + ... + } + + # Get the dimensions of the mwcs descriptor. This should be 2. + ndim = mw_ndim (mwin, MW_NPHYSDIM) + + # Get the default coordinates to degrees and degreees. + call sk_seti (cooin, S_NLNGUNITS, SKY_DEGREES) + call sk_seti (cooin, S_NATGUNITS, SKY_DEGREES) + + # Open the output coordinate system. Mwout is NULL because this system + # is not an image. + outstat = sk_decwstr ("galactic", mwout, cooout, cooin) + if (outstat == ERR) { + ... + call sk_close (outstat) + ... + } + + # Make a copy of the mwcs descriptor. + mwout = mw_newcopy (mwin) + + # Allocate space for the r and w vectors and cd matrix. + call malloc (r, ndim, TY_DOUBLE) + call malloc (w, ndim, TY_DOUBLE) + call malloc (cd, ndim * ndim, TY_DOUBLE) + call malloc (newcd, ndim * ndim, TY_DOUBLE) + + # Assume for simplicty that the MWCS LTERM is the identify transform. + # so we don't have to worry about it. Get the WTERM which consists + # of r the reference point in pixels, w the reference point in degrees, + # and the cd matrix in degrees per pixel. + call mw_gwtermd (mwin, Memd[r], Memd[w], Memd[cd], ndim) + + # Convert the world coordinates zero point. The pixel zero point + # remains the same. + tilng = Memd[w] + tilat = Memd[w+1] + call sk_ultran (incoo, outcoo, tilng, tilat, tolng, tolat, 1) + Memd[w] = tolng + Memd[w+1] = tolat + + # Figure out how much to rotate the coordinate system and edit the + # compute a new CD matrix. Call it newcd. + ... + + # Enter the new CD matrix and zero point. + call mw_swterm (mwout, Memd[r], Memd[w], Memd[newcd], ndim) + + # Update the header. + call sk_saveim (cooout, mwout, im) + call mw_saveim (mwout, im) + ... + + # Tidy up. + call mfree (r, TY_DOUBLE) + call mfree (w, TY_DOUBLE) + call mfree (cd, TY_DOUBLE) + call mfree (newcd, TY_DOUBLE) + call mw_close (mwin) + call mw_close (mwout) + call sk_close (cooin) + call sk_close (cooout) + call imunmap (im) diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/ccsystems.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/ccsystems.hlp new file mode 100644 index 00000000..e812fc8d --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/ccsystems.hlp @@ -0,0 +1,134 @@ +.help ccsystems Mar00 Skywcs +.ih +NAME +ccsystems -- list and describe the supported sky coordinate systems +.ih +USAGE +help ccsystems + +.ih +SKY COORDINATE SYSTEMS + +The sky package supports the equatorial ("fk4", "fk4-noe", "fk5", "icrs"), +ecliptic, galactic, and supergalactic celestial coordinate systems. In most +cases and unless otherwise noted users can input their coordinates in +any one of these systems as long as they specify the coordinate system +correctly. + +Considerable flexibility is permitted in how the coordinate systems are +specified, e.g. J2000.0, j2000.0, 2000.0, fk5, fk5 J2000, and fk5 2000.0 +all specify the mean place post-IAU 1976 or FK5 system. Missing equinox and +epoch fields assume reasonable defaults. In most cases the +systems of most interest to users are are "icrs", "j2000", and "b1950" +which stand for the ICRS J2000.0, FK5 J2000.0 and FK4 B1950.0 celestial +coordinate systems respectively. The full set of options are listed below: + +.ls equinox [epoch] +The equatorial mean place post-IAU 1976 (FK5) system if equinox is a +Julian epoch, e.g. J2000.0 or 2000.0, or the equatorial mean place +pre-IAU 1976 system (FK4) if equinox is a Besselian epoch, e.g. B1950.0 +or 1950.0. Julian equinoxes are prefixed by a J or j, Besselian equinoxes +by a B or b. Equinoxes without the J / j or B / b prefix are treated as +Besselian epochs if they are < 1984.0, Julian epochs if they are >= 1984.0. +Epoch is the epoch of the observation and may be a Julian +epoch, a Besselian epoch, or a Julian date. Julian epochs +are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to the epoch type of +equinox if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. If undefined epoch defaults to equinox. +.le +.ls icrs [equinox] [epoch] +The International Celestial Reference System where equinox is +a Julian or Besselian epoch e.g. J2000.0 or B1980.0. +Equinoxes without the J / j or B / b prefix are treated as Julian epochs. +The default value of equinox is J2000.0. +Epoch is a Besselian epoch, a Julian epoch, or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Julian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. If undefined epoch defaults to equinox. +.le +.ls fk5 [equinox] [epoch] +The equatorial mean place post-IAU 1976 (FK5) system where equinox is +a Julian or Besselian epoch e.g. J2000.0 or B1980.0. +Equinoxes without the J / j or B / b prefix are treated as Julian epochs. +The default value of equinox is J2000.0. +Epoch is a Besselian epoch, a Julian epoch, or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Julian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. If undefined epoch defaults to equinox. +.le +.ls fk4 [equinox] [epoch] +The equatorial mean place pre-IAU 1976 (FK4) system where equinox is a +Besselian or Julian epoch e.g. B1950.0 or J2000.0, +and epoch is the Besselian epoch, the Julian epoch, or the Julian date of the +observation. +Equinoxes without the J / j or B / b prefix are treated +as Besselian epochs. The default value of equinox is B1950.0. Epoch +is a Besselian epoch, a Julian epoch, or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Besselian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. If undefined epoch defaults to equinox. +.le +.ls noefk4 [equinox] [epoch] +The equatorial mean place pre-IAU 1976 (FK4) system but without the E-terms +where equinox is a Besselian or Julian epoch e.g. B1950.0 or J2000.0, +and epoch is the Besselian epoch, the Julian epoch, or the Julian date of the +observation. +Equinoxes without the J / j or B / b prefix are treated +as Besselian epochs. The default value of equinox is B1950.0. +Epoch is a Besselian epoch, a Julian epoch, or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Besselian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian day. If undefined epoch defaults to equinox. +.le +.ls apparent epoch +The equatorial geocentric apparent place post-IAU 1976 system where +epoch is the epoch of observation. +Epoch is a Besselian epoch, a Julian epoch or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Besselian +epochs if the epoch value < 1984.0, Julian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. +.le +.ls ecliptic epoch +The ecliptic coordinate system where epoch is the epoch of observation. +Epoch is a Besselian epoch, a Julian epoch, or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Besselian epochs +if the epoch values < 1984.0, Julian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian day. +.le +.ls galactic [epoch] +The IAU 1958 galactic coordinate system. +Epoch is a Besselian epoch, a Julian epoch or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Besselian +epochs if the epoch value < 1984.0, Julian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. The default value of epoch is B1950.0. +.le +.ls supergalactic [epoch] +The deVaucouleurs supergalactic coordinate system. +Epoch is a Besselian epoch, a Julian epoch or a Julian date. +Julian epochs are prefixed by a J or j, Besselian epochs by a B or b. +Epochs without the J / j or B / b prefix default to Besselian +epochs if the epoch value < 1984.0, Julian epochs +if the epoch value <= 3000.0, otherwise epoch is interpreted as +a Julian date. The default value of epoch is B1950.0. +.le + +Fields enclosed in [] are optional with the defaults as described. The epoch +field for the "icrs" , "fk5", "galactic", and "supergalactic" coordinate +systems is only used if the input coordinates are in the equatorial fk4, +noefk4, fk5, or icrs systems and proper motions are used to transform from +coordinate system to another. + +.ih +SEE ALSO +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skclose.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skclose.hlp new file mode 100644 index 00000000..191b08b5 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skclose.hlp @@ -0,0 +1,23 @@ +.help skclose Mar00 Skywcs +.ih +NAME +skclose -- free the sky coordinate descriptor +.ih +SYNOPSIS +call sk_close (coo) + +.nf +pointer coo # the sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor to be freed. +.le +.ih +DESCRIPTION +Sk_close frees a previously allocated sky coordinate descriptor. +.ih +SEE ALSO +skdecwcs, skdecwstr, skdecim, skcopy +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skcopy.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skcopy.hlp new file mode 100644 index 00000000..68219c0d --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skcopy.hlp @@ -0,0 +1,24 @@ +.help skcopy Mar00 Skywcs +.ih +NAME +skcopy -- copy a sky coordinate descriptor +.ih +SYNOPSIS +newcoo = sk_copy (coo) + +.nf +pointer coo # the sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor to be copied. +.le +.ih +DESCRIPTION +Sk_copy is a pointer function which returns a copy of the input sky coordinate +descriptor as its function value. +.ih +SEE ALSO +skdecwcs, skdecwstr, skdecim, skclose +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecim.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecim.hlp new file mode 100644 index 00000000..c8f7b2e7 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecim.hlp @@ -0,0 +1,55 @@ +.help skdecim Mar00 Skywcs +.ih +NAME +skdecim -- open a sky coordinate descriptor using an image descriptor +.ih +SYNOPSIS +stat = sk_decim (im, mw, coo, imcoo) + +.nf +pointer im # the input image descriptor +pointer mw # the output mwcs descriptor +pointer coo # the output sky coordinate descriptor +pointer imcoo # the input image sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls im +The input image descriptor. +.le +.ls mw +The output mwcs descriptor. A NULL value for mw is returned if the image +world coordinate system cannot be read. +.le +.ls coo +The output sky coordinate descriptor. +.le +.ls imcoo +The parent image sky coordinate descriptor. Imcoo is set to NULL +except in cases where the sky coordinate descriptor for an image is +transformed and written back to the same image. +.ih +DESCRIPTION +Sk_decim is an integer function which returns OK or ERR as its function +value. ERR is returned if a valid sky coordinate system cannot be opened, +OK otherwise. + +Sk_decim returns the image MWCS descriptor mw. The MWCS descriptor is used +to convert from pixel coordinates to world coordinates and vice versa. +The MWCS descriptor must be freed with a call to the MWCS routine +mw_close before task termination. + +Sk_decim returns the sky descriptor coo. The sky coordinate descriptor +is defined even if an error is detected in reading the image celestial +coordinate system, and must be freed with a call to sk_close before +task termination. + +.ih +NOTES +Type "help ccsystems" to see the list of the supported sky coordinate systems. + +Type "help mwcs$MWCS.hlp fi+" to find out more about the IRAF image world +coordinate system library MWCS. +SEE ALSO +skdecwcs, skdecwstr, skcopy, skclose +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwcs.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwcs.hlp new file mode 100644 index 00000000..2081fd50 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwcs.hlp @@ -0,0 +1,62 @@ +.help skdecwcs Mar00 Skywcs +.ih +NAME +skdecwcs -- open a sky coordinate descriptor using an image or system name +.ih +SYNOPSIS +stat = sk_decwcs (ccsystem, mw, coo, imcoo) + +.nf +char ccsystem # the input celestial coordinate system name +pointer mw # the output mwcs descriptor +pointer coo # the output sky coordinate descriptor +pointer imcoo # the input image sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls ccsystem. +The celestial coordinate system name. Ccsystem is a either an image system +name, e.g. "dev$ypix logical" or "dev$ypix world" or a system name, e.g. +"J2000" or "galactic". +.le +.ls mw +The output mwcs descriptor. A NULL value for mw is returned if the +image world coordinate system cannot be read or ccsystem is not an image +system name. +.le +.ls coo +The output sky coordinate descriptor. +.le +.ls imcoo +The parent image coordinate descriptor. Imcoo is set to NULL +except in cases where the sky coordinate descriptor for an image is +transformed and written back to the same image. +.le +.ih +DESCRIPTION +Sk_decwcs is an integer function which returns OK or ERR as its function +value. ERR is returned if a valid sky coordinate system cannot be opened, +OK otherwise. + +Sk_decwcs returns the image MWCS descriptor mw if ccsystem is an image +system, otherwise it returns NULL. The MWCS descriptor is used +to convert from pixel coordinates to world coordinates and vice versa. +The MWCS descriptor must be freed with a call to the MWCS routine +mw_close before task termination. + +Sk_decwcs returns the sky descriptor coo. The sky coordinate descriptor +is defined even if an error is detected in reading the image celestial +coordinate system, and must be freed with a call to sk_close before +task termination. + +.ih +NOTES +Type "help ccsystems" to see the list of the supported sky coordinate systems. + +Type "help mwcs$MWCS.hlp fi+" to find out more about the IRAF image world +coordinate system library MWCS. + + +SEE ALSO +skdecwstr, skdecim +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwstr.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwstr.hlp new file mode 100644 index 00000000..f81c2d48 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skdecwstr.hlp @@ -0,0 +1,46 @@ +.help skdecwstr Mar00 Skywcs +.ih +NAME +skdecwstr -- open a sky coordinate descriptor using a system name +.ih +SYNOPSIS +stat = sk_decwstr (csystem, coo, imcoo) + +.nf +char csystem # the input celestial coordinate system name +pointer coo # the output sky coordinate descriptor +pointer imcoo # the input image sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls csystem +The sky coordinates definition. Ccsystem is a system name, e.g. "J2000" +or "galactic. +.le +.ls coo +The output sky coordinate descriptor. +.le +.ls imcoo +The parent image coordinate descriptor. Imcoo is set to NULL +except in cases where the sky coordinate descriptor for an image is +transformed and written back to the same image. +.le +.ih +DESCRIPTION +Sk_decwstr is an integer function which returns OK or ERR as its function +value. ERR is returned if a valid sky coordinate system cannot be opened, +OK otherwise. + +Sk_decwstr returns the sky descriptor coo. The sky coordinate descriptor +is defined even if an error is detected in reading the image celestial +coordinate system, and must be freed with a call to sk_close before +task termination. + +.ih +NOTES + +Type "help ccsystems" to get a list of the supported sky coordinate systems. + +SEE ALSO +skdecwcs, skdecim, skcopy, skclose +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skenwcs.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skenwcs.hlp new file mode 100644 index 00000000..cc388108 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skenwcs.hlp @@ -0,0 +1,32 @@ +.help skenwcs Mar00 Skywcs +.ih +NAME +skenwcs -- encode a system name using a sky coordinate descriptor +.ih +SYNOPSIS + +call sk_enwcs (coo, csystem, maxch) + +.nf +pointer coo # the input sky coordinate descriptor +char csystem # the output system name +int maxch # the maximum size of the output system name +.fi +.ih +ARGUMENTS +.ls coo +The input sky coordinate descriptor +.le +.ls csystem +The output system name, e.g. "galactic". +.le +.ls maxch +The maximum size of the output system name. +.le +.ih +DESCRIPTION +Sk_enwcs returns the sky coordinate system name. +.ih +SEE ALSO +skdecwcs, skdecwstr +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skequatorial.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skequatorial.hlp new file mode 100644 index 00000000..4adc7590 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skequatorial.hlp @@ -0,0 +1,59 @@ +.help skequatorial Mar00 Skywcs +.ih +NAME +skequatorial -- apply pm and transform between equatorial coordinate systems +.ih +SYNOPSIS +call sk_equatorial (incoo, outcoo, ilng, ilat, ipmlng, ipmlat, px, rv, + olng, olat) + +.nf +pointer incoo # the input sky coordinate descriptor +pointer outcoo # the output sky coordinate descriptor +double ilng, ilat # the input sky coordinates in radians +double ipmlng, ipmlat # the input proper motions in radians / year +double px # the input parallax in arcsec +double rv # the input radial velocity in km / sec (+ve receding) +double olng, olat # the output output sky coordinates in radians +.fi +.ih +ARGUMENTS +.ls incoo +The input sky coordinate descriptor. +.le +.ls parameter +.ls outcoo +The output sky coordinate descriptor. +.le +.ls ilng, ilat +The input sky coordinates in radians. +.le +.ls ipmlng, ipmlat +The input proper motions. If proper motions are unknown do not set ipmlng +and ipmlat to 0.0, use sk_ultran instead. Note that the ra proper motion +is in dra not cos (dec) * dra units. +.le +.ls px +The parallax in arcseconds. Use 0.0 if the proper motion is unknown unknown. +The parallax value is used only if proper motions are defined. +.le +.ls rv +The radial velocity in km / sec. Use 0.0 if the radial velocity is unknown. +The radial velocity value is used only if proper motions are defined. +.le +.ls olng, olat +The output sky coordinates in radians. +.le +.ih +DESCRIPTION +The coordinates in the input sky coordinate system are converted to +coordinates in the output sky coordinate system. +.ih +NOTES +If the proper motions are undefined use the routine sk_ultran. Zero valued +proper motions are not the same as undefined proper motions. + +.ih +SEE ALSO +sk_lltran, sk_ultran +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiprint.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiprint.hlp new file mode 100644 index 00000000..217819c2 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiprint.hlp @@ -0,0 +1,39 @@ +.help skiiprint Mar00 Skywcs +.ih +NAME +skiiprint -- print the sky coordinate system summary +.ih +SYNOPSIS + +call sk_iprint (label, imagesys, mw, coo) + +.nf +char label # the input user label +char imagesys # the input image system +pointer mw # the input mwcs descriptor +pointer coo # the sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls label +The input user supplied label, e.g. "Input System", "Ref System", +"Output System" etc. +.le +.ls imagesys +The input image system, e.g. "dev$ypix logical", "dev$ypix world", etc. +.le +.ls mwcs +The input image mwcs descriptor if defined. If mwcs is defined then +information about which sky coordinate corresponds to which image +axis etc is read from the mwcs descriptor. +.le +.ls coo +The input sky coordinate descriptor. +.le +.ih +DESCRIPTION +A summary of the sky coordinate system is printed on the standard output. +.ih +SEE ALSO +skiiwrite +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiwrite.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiwrite.hlp new file mode 100644 index 00000000..c82472f4 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skiiwrite.hlp @@ -0,0 +1,43 @@ +.help skiiwrite Mar00 Skywcs +.ih +NAME +skiiwrite -- write the sky coordinate system summary to a file +.ih +SYNOPSIS + +call sk_iiwrite (outfd, label, imagesys, mw, coo) + +.nf +int outfd # the input file descriptor +char label # the input user label +char imagesys # the input image system +pointer mw # the input mwcs descriptor +pointer coo # the sky coordinate descriptor +.fi +.ih +ARGUMENTS +.ls outfd +The input file descriptor. +.le +.ls label +The input user supplied label, e.g. "Input System", "Ref System", +"Output System" etc. +.le +.ls imagesys +The input image system, e.g. "dev$ypix logical", "dev$ypix world", etc. +.le +.ls mwcs +The input image mwcs descriptor if defined. If mwcs is defined then +information about which sky coordinate corresponds to which image +axis etc is read from the mwcs descriptor. +.le +.ls coo +The input sky coordinate descriptor. +.le +.ih +DESCRIPTION +A summary of the sky coordinate system is written to a file. +.ih +SEE ALSO +skiiprint +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sklltran.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sklltran.hlp new file mode 100644 index 00000000..a0040507 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sklltran.hlp @@ -0,0 +1,60 @@ +.help sklltran Mar00 Skywcs +.ih +NAME +sklltran -- apply pm and transform between coordinate systems +.ih +SYNOPSIS +call sk_lltran (incoo, outcoo, ilng, ilat, ipmlng, ipmlat, px, rv, olng, olat) + +.nf +pointer incoo # the input sky coordinate descriptor +pointer outcoo # the output sky coordinate descriptor +double ilng, ilat # the input sky coordinates in radians +double ipmlng, ipmlat # the input proper motions in radians / year +double px # the input parallax in arcsec +double rv # the input radial velocity in km / sec (+ve receding) +double olng, olat # the output sky coordinates in radians +.fi +.ih +ARGUMENTS +.ls incoo +The input sky coordinate descriptor. +.le +.ls parameter +.ls outcoo +The output sky coordinate descriptor. +.le +.ls ilng, ilat +The input sky coordinates in radians. +.le +.ls ipmlng, ipmlat +The input proper motions. For these to be applied the input coordinate +system must be an equatorial coordinate system. If proper motions are +unknown do not set ipmlng and ipmlat to 0.0, use sk_ultran instead. Note that +the ra proper motion is in dra not cos (dec) * dra units. +.le +.ls px +The parallax in arcseconds. Use 0.0 if the proper motion is unknown unknown. +The parallax value is used only if proper motions are defined. +.le +.ls rv +The radial velocity in km / sec. Use 0.0 if the radial velocity is unknown. +The radial velocity value is used only if proper motions are defined. +.le +.ls olng, olat +The onput sky coordinates in radians. +.le + +.ih +DESCRIPTION +The coordinates in the input sky coordinate system are converted to +coordinates in the output sky coordinate system. +.ih +NOTES +If the proper motions are undefined use the routine sk_ultran. Zero valued +proper motions are not the same as undefined proper motions. + +.ih +SEE ALSO +sk_ultran, sk_equatorial +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksaveim.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksaveim.hlp new file mode 100644 index 00000000..82c16f3f --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksaveim.hlp @@ -0,0 +1,39 @@ +.help sksaveim Mar00 Skywcs +.ih +NAME +sksaveim -- update the image header using a sky coordinate descriptor +.ih +SYNOPSIS +call sk_saveim (coo, mw, im) + +.nf +pointer coo # the input sky coordinate descriptor +pointer mw # the input mwcs descriptor +pointer im # the input image descriptor +.fi +.ih +ARGUMENTS +.ls coo +The input sky coordinate descriptor. +.le +.ls mw +The IRAF mwcs descriptor. +.le +.ls im +The input image descriptor. +.le +.ih +DESCRIPTION +The image world coordinate system is updated using information in +the sky coordinate descriptor and the mwcs descriptor. + +.ih +NOTES +Note that the sk_saveim call does not include a call to the MWCS mw_saveim +routine. This call must be made separately. + +Type "help mwcs$MWCS.hlp fi+" to find out more about the IRAF image world +coordinate system code. +SEE ALSO +skdecwcs, skdecim +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksetd.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksetd.hlp new file mode 100644 index 00000000..f518d71c --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksetd.hlp @@ -0,0 +1,53 @@ +.help sksetd Mar00 Skywcs +.ih +NAME +sksetd -- set a double sky coordinate descriptor parameter +.ih +SYNOPSIS +include <skywcs.h> + +call sk_setd (coo, parameter, dval) + +.nf +pointer coo # the input sky coordinate descriptor +int parameter # the double parameter to be set +double dval # the value of the parameter to be set +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor. +.le +.ls parameter +The parameter to be set. The double parameter definitions in skywcs.h are: +.nf + S_VXOFF # the logical ra / longitude offset in pixels + S_VYOFF # the logical dec / latitude offset in pixels + S_VXSTEP # the logical ra / longitude step size in pixels + S_VYSTEP # the logical dec / latitude step size in pixels + S_EQUINOX # the equinox in years + S_EPOCH # the MJD of the observation +.fi +.le +.ls dval +The value of the parameter to be set. +.le +.ih +DESCRIPTION +Sk_setd sets the values of double sky coordinate descriptor parameters. +.ih +NOTES +The offsets and step sizes default to 0 and 1 for both axes. However +if the sky coordinate descriptor was derived from an input image section, e.g. +"dev$ypix[100:300,100:300]" these numbers may assume other values in some +circumstances. + +The equinox and epoch of observation are normally set by the calling program +when the sky coordinate descriptor is initialized, e.g. they default +to 2000.0 and 51544.50000 if the input coordinate system was "fk5". + +In most cases these parameters should not be set by the user. +.ih +SEE ALSO +skseti, sksets +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skseti.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skseti.hlp new file mode 100644 index 00000000..b08be476 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skseti.hlp @@ -0,0 +1,93 @@ +.help skseti Mar00 Skywcs +.ih +NAME +skseti -- set an integer sky coordinate descriptor parameter +.ih +SYNOPSIS +include <skywcs.h> + +call sk_seti (coo, parameter, ival) + +.nf +pointer coo # the input sky coordinate descriptor +int parameter # the integer parameter to be set +int ival # the value of the parameter to be set +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor. +.le +.ls parameter +The parameter to be set. The double parameter definitions in skywcs.h are: +.nf + S_CTYPE # the celestial coordinate system type + S_RADECSYS # the equatorial system type + S_NLNGUNITS # the ra / longitude units + S_NLATUNITS # the dec/ latitude units + S_WTYPE # the projection type + S_PLNGAX # the physical ra / longitude axis + S_PLATAX # the physical dec / latitude axis + S_XLAX # the logical ra / longitude axis + S_YLAX # the logical dec / latitude axis + S_PIXTYPE # the IRAF pixel coordinate system type + S_NLNGAX # the length of ra / longitude axis + S_NLATAX # the length of dec / latitude axis + S_STATUS # the coordinate system status +.fi +.le +.ls ival +The value of the parameter to be set. +.le +.ih +DESCRIPTION +Sk_seti sets the values of integer sky coordinate descriptor parameters. +.ih +NOTES +Permitted values of S_CTYPE are CTYPE_EQUATORIAL, CTYPE_ECLIPTIC, +CTYPE_GALACTIC, and CTYPE_SUPERGALACTIC. The corresponding string dictionary +is CTYPE_LIST. + +Permitted types of S_RADECSYS are EQTYPE_FK4, EQTYPE_FK4NOE, +EQTYPE_FK5, EQTYPE, ICRS, and EQTYPE_GAPPT. The corresponding string +dictionary is EQTYPE_LIST. + +Permitted values of S_WTYPE are WTYPE_LIN, WTYPE_AZP, WTYPE_TAN, WTYPE_SIN, +WTYPE_STG, WTYPE_ARC, WTYPE_ZPN, WTYPE_ZEA, WTYPE_AIR, WTYPE_CYP, WTYPE_CAR, +WTYPE_MER, WTYPE_CEA, WTYPE_COP, WTYPE_COD, WTYPE_COE, WTYPE_COO, WTYPE_BON, +WTYPE_PCO, WTYPE_GLS, WTYPE_PAR, WTYPE_AIT, WTYPE_MOL, WTYPE_CSC, WTYPE_QSC, +WTYPE_TSC, WTYPE_TNX, WTYPE_ZPX. The corresponding string dictionary is +WTYPE_LIST. + +Permitted values of S_PIXTYPE are PIXTYPE_LOGICAL, PIXTYPE_TV, +PIXTYPE_PHYSICAL. and PIXTPE_WORLD. The corresponding string dictionary +is PIXTYPE_LIST. + +Permitted values of S_NLNGUNITS are SKY_HOURS, SKY_DEGREES, and SKY_RADIANS. +The corresponding string dictionary is SKY_LNG_UNITLIST. +Permitted values of S_NLATUNITS are SKY_DEGREES, and SKY_RADIANS. +The corresponding string dictionary is SKY_LAT_UNITLIST. + +The parameters S_CTYPE, S_RADECSYS, S_NLNGUNITS, and S_NLATUNITS are +important for all sky coordinate descriptors regardless of the source. +The parameters S_WTYPE, S_PLNGAX, S_PLATAX, S_XLAX, S_YLAX, S_PIXTYPE, +S_NLNGAX, and S_NLATAX are only important for sky coordinate descriptors +derived from an image sky coordinate systems. S_STATUS is OK if the sky +coordinate descriptor describes a valid celestial coordinate system, ERR +otherwise. + +In most cases these parameters should not be modified by the user. The +major exceptions are the units parameters S_NLNGUNITS and N_LATUNITS +which assumes default values fo hours and degrees for equatorial sky +coordinate systems and degrees and degrees for other sky coordinate systems. +If the user input and output units are different from the normal defaults +then the units parameters should be set appropriately. + +Parameters that occasionally need to be reset when a coordinate system +is created, edited, or saved to an image are S_WTYPE, S_PIXTYPE, S_PLNGAX, +and S_PLATAX. + +.ih +SEE ALSO +sksetd, sksets +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksets.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksets.hlp new file mode 100644 index 00000000..8e4179b4 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/sksets.hlp @@ -0,0 +1,36 @@ +.help sksets Mar00 Skywcs +.ih +NAME +sksets -- set a string sky coordinate descriptor parameter +.ih +SYNOPSIS +include <skywcs.h> + +call sk_sets (coo, parameter, str) + +.nf +pointer coo # the input sky coordinate descriptor +int parameter # the string parameter to be set +char str # the value of the string parameter to be set +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor. +.le +.ls parameter +The parameter to be set. The string parameter definitions in skywcs.h are: +.nf + S_COOSYSTEM # the celestial coordinate system name +.fi +.le +.ls str +The value of the parameter to be set. +.le +.ih +DESCRIPTION +Sk_sets sets the values of string sky coordinate descriptor parameters. +.ih +SEE ALSO +sksetd, skseti +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstatd.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstatd.hlp new file mode 100644 index 00000000..52dc0c70 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstatd.hlp @@ -0,0 +1,49 @@ +.help skstatd Mar00 Skywcs +.ih +NAME +skstatd -- get a double sky coordinate descriptor parameter +.ih +SYNOPSIS +include <skywcs.h> + +dval = sk_statd (coo, parameter) + +.nf +pointer coo # the input sky coordinate descriptor +int parameter # the double parameter to be returned +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor. +.le +.ls parameter +The oarameter to be returned. The double parameter definitions in skywcs.h are: +.nf + S_VXOFF # the logical ra / longitude offset in pixels + S_VYOFF # the logical dec / latitude offset in pixels + S_VXSTEP # the logical ra / longitude step size in pixels + S_VYSTEP # the logical dec / latitude step size in pixels + S_EQUINOX # the equinox in years + S_EPOCH # the MJD of the observation +.fi +.le +.ih +DESCRIPTION +Sk_statd returns the values of double sky coordinate descriptor parameters. + +.ih +NOTES +The offsets and step sizes default to 0 and 1 for both axes. However +if the sky coordinate descriptor was derived from an input image section, e.g. +"dev$ypix[100:300,100:300]" these numbers may assume other values in some +circumstances. + +The equinox and epoch of observation are normally set by the calling program +when the sky coordinate descriptor is initialized, e.g. they default +to 2000.0 and 51544.50000 if the input coordinate system was "fk5". + +.ih +SEE ALSO +skstati, skstats +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstati.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstati.hlp new file mode 100644 index 00000000..90d33eb1 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstati.hlp @@ -0,0 +1,79 @@ +.help skstati Mar00 Skywcs +.ih +NAME +skstati -- get an integer sky coordinate descriptor parameter +.ih +SYNOPSIS +include <skywcs.h> + +ival = sk_stati (coo, parameter) + +.nf +pointer coo # the input sky coordinate descriptor +int parameter # the integer parameter to be returned +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor. +.le +.ls parameter +Parameter to be returned. The integer parameter definitions in skywcs.h are: +.nf + S_CTYPE # the celestial coordinate system type + S_RADECSYS # the equatorial system type + S_NLNGUNITS # the ra / longitude units + S_NLATUNITS # the dec/ latitude units + S_WTYPE # the projection type + S_PLNGAX # the physical ra / longitude axis + S_PLATAX # the physical dec / latitude axis + S_XLAX # the logical ra / longitude axis + S_YLAX # the logical dec / latitude axis + S_PIXTYPE # the IRAF pixel coordinate system type + S_NLNGAX # the length of the ra / longitude axis + S_NLATAX # the length of the dec / latitude axis + S_STATUS # the coordinate system status +.fi +.le +.ih +DESCRIPTION +Sk_stati returns the values of integer sky coordinate descriptor parameters. + +.ih +NOTES +Permitted values of S_CTYPE are CTYPE_EQUATORIAL, CTYPE_ECLIPTIC, +CTYPE_GALACTIC, and CTYPE_SUPERGALACTIC. The corresponding string dictionary +is CTYPE_LIST. + +Permitted types of S_RADECSYS are EQTYPE_FK4, EQTYPE_FK4NOE, +EQTYPE_FK5, EQTYPE, ICRS, and EQTYPE_GAPPT. The corresponding string +dictionary is EQTYPE_LIST. + +Permitted values of S_WTYPE are WTYPE_LIN, WTYPE_AZP, WTYPE_TAN, WTYPE_SIN, +WTYPE_STG, WTYPE_ARC, WTYPE_ZPN, WTYPE_ZEA, WTYPE_AIR, WTYPE_CYP, WTYPE_CAR, +WTYPE_MER, WTYPE_CEA, WTYPE_COP, WTYPE_COD, WTYPE_COE, WTYPE_COO, WTYPE_BON, +WTYPE_PCO, WTYPE_GLS, WTYPE_PAR, WTYPE_AIT, WTYPE_MOL, WTYPE_CSC, WTYPE_QSC, +WTYPE_TSC, WTYPE_TNX, WTYPE_ZPX. The corresponding string dictionary is +WTYPE_LIST. + +Permitted values of S_PIXTYPE are PIXTYPE_LOGICAL, PIXTYPE_TV, +PIXTYPE_PHYSICAL. and PIXTPE_WORLD. The corresponding string dictionary +is PIXTYPE_LIST. + +Permitted values of S_NLNGUNITS are SKY_HOURS, SKY_DEGREES, and SKY_RADIANS. +The corresponding string dictionary is SKY_LNG_UNITLIST. +Permitted values of S_NLATUNITS are SKY_DEGREES, and SKY_RADIANS. +The corresponding string dictionary is SKY_LAT_UNITLIST. + +The parameters S_CTYPE, S_RADECSYS, S_NLNGUNITS, and S_NLATUNITS are +important for all sky coordinate descriptors regardless of the source. +The parameters S_WTYPE, S_PLNGAX, S_PLATAX, S_XLAX, S_YLAX, S_PIXTYPE, +S_NLNGAX, and S_NLATAX are only important for sky coordinate descriptors +derived from an image sky coordinate systems. S_STATUS is OK if the sky +coordinate descriptor describes a valid celestial coordinate system, ERR +otherwise. + +.ih +SEE ALSO +skstatd, skstats +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstats.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstats.hlp new file mode 100644 index 00000000..483ed3e5 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skstats.hlp @@ -0,0 +1,40 @@ +.help skstats Mar00 Skywcs +.ih +NAME +skstats -- get a string sky coordinate descriptor parameter +.ih +SYNOPSIS +include <skywcs.h> + +call sk_stats (coo, parameter, str, maxch) + +.nf +pointer coo # the input sky coordinate descriptor +int parameter # the string parameter to be returned +char str # the returned string parameter value +int maxch # the maximum size of the returned string parameter +.fi +.ih +ARGUMENTS +.ls coo +The sky coordinate descriptor. +.le +.ls parameter +The parameter to be returned. The string parameter definitions in skywcs.h are: +.nf + S_COOSYSTEM # the celestial coordinate system name +.fi +.le +.ls str +The value of the returned string. +.le +.ls maxch +The maximum size of the returned string. +.le +.ih +DESCRIPTION +Sk_stats returns the values of string sky coordinate descriptor parameters. +.ih +SEE ALSO +skstati, skstatd +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skultran.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skultran.hlp new file mode 100644 index 00000000..417eaba6 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skultran.hlp @@ -0,0 +1,51 @@ +.help skultran Mar00 Skywcs +.ih +NAME +skultran -- transform between coordinate systems +.ih +SYNOPSIS +call sk_ultran (incoo, outcoo, ilng, ilat, olng, olat, npts) + +.nf +pointer incoo # the input sky coordinate descriptor +pointer outcoo # the output sky coordinate descriptor +double ilng, ilat # the input celestial coordinates in expected units +double olng, olat # the output celestial coordinates in expected units +int npts # the number of input and output coordinate pairs +.fi +.ih +ARGUMENTS +.ls incoo +The input sky coordinate descriptor. +.le +.ls parameter +.ls outcoo +The output sky coordinate descriptor. +.le +.ls ilng, ilat +The input sky coordinates in the units defined by the integer parameters +S_NLNGUNITS and S_NLATUNITS. +.le +.ls olng, olat +The output sky coordinates in the units defined by the integer parameters +S_NLNGUNITS and S_NLATUNITS. +.le +.ls npts +The number of input and output coordinate pairs. +.le +.ih +DESCRIPTION +The coordinates in the input coordinate system are converted to +coordinates in the output coordinates system. + +If the calling program has not set the S_NLNGUNITS and S_NLATUNITS parameters +in either system the expected coordinates are hours and degrees for +equatorial sky coordinate systems and degrees and degrees for other sky +coordinate systems. The calling program must either perform the necessary +coordinate conversions or set the units parameters in the input and output +sky coordinate descriptors appropriately. + +.ih +SEE ALSO +sk_lltran, sk_equatorial +.endhelp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hd b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hd new file mode 100644 index 00000000..74bac140 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hd @@ -0,0 +1,25 @@ +# Help directory for the SKYWCS library + +$doc = "./" +$source = "../" + +skdecwcs hlp=doc$skdecwcs.hlp, src=source$skdecode.x +skdecwstr hlp=doc$skdecwstr.hlp, src=source$skdecode.x +skdecim hlp=doc$skdecim.hlp, src=source$skdecode.x +skenwcs hlp=doc$skenwcs.hlp, src=source$skdecode.x +skcopy hlp=doc$skcopy.hlp, src=source$skdecode.x +skiiprint hlp=doc$skiiprint.hlp, src=source$skwrite.x +skiiwrite hlp=doc$skiiwrite.hlp, src=source$skwrite.x +skstati hlp=doc$skstati.hlp, src=source$skstat.x +skstatd hlp=doc$skstatd.hlp, src=source$skstat.x +skstats hlp=doc$skstats.hlp, src=source$skstat.x +skseti hlp=doc$skseti.hlp, src=source$skset.x +sksetd hlp=doc$sksetd.hlp, src=source$skset.x +sksets hlp=doc$sksets.hlp, src=source$skset.x +skultran hlp=doc$skultran.hlp, src=source$skytransform.x +sklltran hlp=doc$sklltran.hlp, src=source$skytransform.x +skequatorial hlp=doc$skequatorial.hlp, src=source$skytransform.x +sksaveim hlp=doc$sksaveim.hlp, src=source$sksaveim.x +skclose hlp=doc$skclose.hlp, src=source$skdecode.x + +ccsystems hlp=doc$ccsystems.hlp diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hlp b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hlp new file mode 100644 index 00000000..498f9b43 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.hlp @@ -0,0 +1,306 @@ +.help skywcs Oct00 xtools +.ih +NAME +skywcs -- sky coordinates package +.ih +SYNOPSIS + +.nf + stat = sk_decwcs (ccsystem, mw, coo, imcoo) + stat = sk_decwstr (ccsystem, coo, imcoo) + stat = sk_decim (im, wcs, mw, coo) + sk_enwcs (coo, ccsystem, maxch) + newcoo = sk_copy (coo) + sk_iiprint (label, imagesys, mw, coo) + sk_iiwrite (fd, label, imagesys, mw, coo) +[id]val = sk_stat[id] (coo, param) + sk_stats (coo, param, str, maxch) + sk_set[id] (coo, param, [id]val) + sk_sets (coo, param, str) + sk_ultran (incoo, outcoo, ilng, ilat, olng, olat, npts) + sk_lltran (incoo, outoo, ilng, ilat, ipmlng, ipmlat, px, rv, + olng, olat) + sk_equatorial (incoo, outcoo, ilng, ilat, ipmlng, ipmlat, px, + rv, olng, olat) + sk_saveim (coo, mw, im) + sk_close (coo) + +.fi +.ih +DESCRIPTION + +The skywcs package contains a simple set of routines for doing managing +sky coordinate information and for transforming from one sky coordinate +system to another. The sky coordinate system is defined either by a system +name, e.g. "J2000", "galactic, etc. or by an image system name, e.g. +"dev$ypix" or "dev$ypix world". + +The skywcs routine are layered on the Starlink Positional Astronomy library +SLALIB which is installed in the IRAF MATH package. Type "help slalib +option=sys" for more information about SLALIB. + + +.ih +NOTES + +An "include <skywcs.h>" statement must be included in the calling program +to make the skywcs package parameter definitions visible to the calling +program. + +The sky coordinate descriptor is created with a call to one of the sk_decwcs +sk_decwstr or sk_imwcs routines. If the source of sky coordinate descriptor +is an image then an IRAF MWCS descriptor will be returned with the sky +oordinate descriptor. The sky coordinate descriptor is freed with a +call to sk_close. A separate call to mw_close must be made to free the +MWCS descriptor if one was allocated. + +By default the main skywcs coordinate transformation routine sk_ultran +assumes that the input and output sky coordinates are in hours and degrees +if the input and output coordinate systems are equatorial, otherwise the +coordinates are assumed to be in degrees and degrees. The default input and +output sky coordinate units can be reset with calls to sk_seti. Two lower level +coordinate transformations for handling proper motions sk_lltran and +sk_equatorial are also available. These routines that the input and output +coordinates and proper motions are in radians. + +Calling programs working with both sky coordinate and MWCS descriptors +need to be aware that the MWCS routines assume that all sky coordinates +must be input in degrees and will be output in degrees and adjust their +code accordingly. + +The skywcs routine sk_saveim can be used to update an image header. + + +.ih +EXAMPLES +.nf +Example 1: Convert from B1950 coordinates to J2000 coordinates. + + include <skywcs.h> + + .... + + # Open input coordinate system. + instat = sk_decwstr ("B1950", incoo, NULL) + if (instat == ERR) { + call sk_close (incoo) + return + } + + # Open output coordinate system. + outstat = sk_decwstr ("J2000", outcoo, NULL) + if (outstat == ERR) { + call sk_close (outcoo) + return + } + + # Do the transformation assuming the input coordinates are in hours + # and degrees. The output coordinates will be in hours and degrees + # as well. + call sk_ultran (incoo, outcoo, rain, decin, raout, decout, npts) + + # Close the coordinate descriptors. + call sk_close (incoo) + call sk_close (outcoo) + + ... + + +Example 2: Repeat example 1 but convert to galactic coordinates. + + include <skywcs.h> + + .... + + # Open the input coordinate system. + instat = sk_decwstr ("B1950", incoo, NULL) + if (instat == ERR) { + call sk_close (incoo) + return + } + + # Open the output coordinate system. + outstat = sk_decwstr ("galactic", outcoo, NULL) + if (outstat == ERR) { + call sk_close (outcoo) + return + } + + # Dd the transformation assuming the input coordinates are in hours and + # degrees. The output coordinates will be in degrees and degrees. + call sk_ultran (incoo, outcoo, rain, decin, raout, decout, npts) + + # Close the coordinate descriptors. + call sk_close (incoo) + call sk_close (outcoo) + + ... + +Example 3: Convert a grid of pixel coordinates in the input image to the + equivalent pixel coordinate in the output image using the + image world coordinate systems to connect the two. + + include <skywcs.h> + + .... + + # Mwref will be defined because the input system is an image. + refstat = sk_decwcs ("refimage logical", mwref, refcoo, NULL) + if (refstat == ERR || mwref == NULL) { + if (mwref != NULL) + call mw_close (mwref) + call sk_close (refcoo) + return + } + + # Set the reference coordinate descriptor so it expects input in degrees + # and degrees. + call sk_seti (refcoo, S_NLNGUNUTS, SKY_DEGREES) + call sk_seti (refcoo, S_NLATUNUTS, SKY_DEGREES) + + # Mwout will be defined because the output system is an image. + outstat = sk_decwcs ("image logical", mwout, outcoo, NULL) + if (outstat == ERR || mwout == NULL) { + if (mwout != NULL) + call mw_close (mwout) + call sk_close (outcoo) + call mw_close (mwref) + call sk_close (refcoo) + return + } + + # Set the output coordinate descriptor so it will output coordinates + # in degrees and degrees. + call sk_seti (outcoo, S_NLNGUNUTS, SKY_DEGREES) + call sk_seti (outcoo, S_NLATUNUTS, SKY_DEGREES) + + # Compute pixel grid in refimage and store coordinate in the arrays + # xref and yref. + npts = 0 + do j = 1, IM_LEN(im,2), 100 { + do i = 1, IM_LEN(im,1), 100 { + npts = npts + 1 + xref[npts] = i + yref[npts] = j + } + } + + # Convert xref and yref to celestial coordinates raref and decref using + # mwref. The output coordinates will be in degrees and degrees. + ctref = mw_sctran (mwref, "logical", "world", 03B) + do i = 1, npts + call mw_c2trand (ctref, xref[i], yref[i], raref[i], decref[i]) + call ct_free (ctref) + + # Convert the reference celestial coordinates to the output celestial + # coordinate system using the coordinate descriptors. + call sk_ultran (refcoo, outcoo, raref, decref, raout, decout, npts) + + # Convert the output celestial coordinates to pixel coordinates in + # the other image using mwout. + ctout = mw_sctran (mwout, "world", "logical", 03B) + do i = 1, npts + call mw_c2trand (ctout, raout[i], decout[i], xout[i], yout[i]) + call ct_free (ctout) + + # Print the input and output pixel coordinates. + do i = 1, npts { + call printf ("%10.3f %10.3f %10.3f %10.3f\n") + call pargd (xref[i]) + call pargd (yref[i]) + call pargd (xout[i]) + call pargd (yout[i]) + } + + # Tidy up. + call mw_close (mwref) + call mw_close (mwout) + call sk_close (refcoo) + call sk_close (outcoo) + + +Example 4: Convert a 2D image with an J2000 tangent plane projection + wcs to the equivalent galactic wcs. The transformation + requires a shift in origin and a rotation. Assume that the ra + axis is 1 and the dec axis is 2. The details of how to compute + the rotation are not shown here. See the + imcctran task for details. + + include <mwset.h> + include <skywcs.h> + + ... + + # Open image. + im = immap (image, READ_WRITE, 0) + + # Open the image coordinate system. + instat = sk_decim (im, "logical", mwin, cooin) + if (instat == ERR || mwin == NULL) { + ... + call sk_close (cooin) + ... + } + + # Get the dimensions of the mwcs descriptor. This should be 2. + ndim = mw_ndim (mwin, MW_NPHYSDIM) + + # Get the default coordinates to degrees and degreees. + call sk_seti (cooin, S_NLNGUNITS, SKY_DEGREES) + call sk_seti (cooin, S_NATGUNITS, SKY_DEGREES) + + # Open the output coordinate system. Mwout is NULL because this system + # is not an image. + outstat = sk_decwstr ("galactic", mwout, cooout, cooin) + if (outstat == ERR) { + ... + call sk_close (outstat) + ... + } + + # Make a copy of the mwcs descriptor. + mwout = mw_newcopy (mwin) + + # Allocate space for the r and w vectors and cd matrix. + call malloc (r, ndim, TY_DOUBLE) + call malloc (w, ndim, TY_DOUBLE) + call malloc (cd, ndim * ndim, TY_DOUBLE) + call malloc (newcd, ndim * ndim, TY_DOUBLE) + + # Assume for simplicty that the MWCS LTERM is the identify transform. + # so we don't have to worry about it. Get the WTERM which consists + # of r the reference point in pixels, w the reference point in degrees, + # and the cd matrix in degrees per pixel. + call mw_gwtermd (mwin, Memd[r], Memd[w], Memd[cd], ndim) + + # Convert the world coordinates zero point. The pixel zero point + # remains the same. + tilng = Memd[w] + tilat = Memd[w+1] + call sk_ultran (incoo, outcoo, tilng, tilat, tolng, tolat, 1) + Memd[w] = tolng + Memd[w+1] = tolat + + # Figure out how much to rotate the coordinate system and edit the + # compute a new CD matrix. Call it newcd. + ... + + # Enter the new CD matrix and zero point. + call mw_swterm (mwout, Memd[r], Memd[w], Memd[newcd], ndim) + + # Update the header. + call sk_saveim (cooout, mwout, im) + call mw_saveim (mwout, im) + ... + + # Tidy up. + call mfree (r, TY_DOUBLE) + call mfree (w, TY_DOUBLE) + call mfree (cd, TY_DOUBLE) + call mfree (newcd, TY_DOUBLE) + call mw_close (mwin) + call mw_close (mwout) + call sk_close (cooin) + call sk_close (cooout) + call imunmap (im) +.fi diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.men b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.men new file mode 100644 index 00000000..9eecc277 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/doc/skywcs.men @@ -0,0 +1,15 @@ + skdecwcs - Open a sky coordinate descriptor usning an image or system name + skdecwstr - Open a sky coordinate descriptor using a system name + skdecim - Open a sky coordinate descriptor using an image descriptor + skenwcs - Encode a system name using a sky coordinate descriptor + skcopy - Copy a sky coordinate descriptor + skstat[ids] - Get a sky coordinate descriptor parameter value + skset[ids] - Set a sky coordinate descriptor parameter value + skiiprint - Print a sky coordinate descriptor summary + skiiwrite - Write a sky coordinate descriptor summary + skultran - Transform between coordinate systems + sklltran - Apply pm and transform between coordinates systems +skequatorial - Apply pm and transform between equatorial coordinate systems + sksaveim - Update image header using sky coordinate descriptor + skclose - Close the sky coordinate descriptor + ccsystems - Describe the supported celestial coordinate systems diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/mkpkg b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/mkpkg new file mode 100644 index 00000000..ad049271 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/mkpkg @@ -0,0 +1,16 @@ +# Libary for the celestial coordinate sytem pacakge + +$checkout libpkg.a ../../ +$update libpkg.a +$checkin libpkg.a ../../ +$exit + +libpkg.a: + skdecode.x <imio.h> <imhdr.h> <mwset.h> skywcsdef.h skywcs.h + skwrite.x skywcsdef.h skywcs.h + skstat.x skywcsdef.h skywcs.h + skset.x skywcsdef.h skywcs.h + sktransform.x <math.h> skywcsdef.h skywcs.h + sksaveim.x skywcsdef.h skywcs.h + skwrdstr.x + ; diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.f new file mode 100644 index 00000000..03e49f1b --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.f @@ -0,0 +1,1412 @@ + integer function skdecs (instr, mw, coo, imcoo) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer mw + integer coo + integer imcoo + integer*2 instr(*) + integer stat + integer sp + integer str1 + integer str2 + integer laxno + integer paxval + integer im + integer skstrs + integer skdecm + integer immap + logical xerpop + logical xerflg + common /xercom/ xerflg + integer sw0001 + save + call xcallc(coo, (30 + 255 + 1), 10 ) + call xstrcy(instr, memc((((coo+25)-1)*2+1)) , 255 ) + call smark (sp) + call salloc (str1, 1023 , 2) + call salloc (str2, 1023 , 2) + call salloc (laxno, 7 , 4) + call salloc (paxval, 7 , 4) + call sscan (instr) + call gargwd (memc(str1), 1023 ) + call gargwd (memc(str2), 1023 ) + call xerpsh + im = immap (memc(str1), 1 , 0) + if (xerflg) goto 112 +112 if (.not.xerpop()) goto 110 + mw = 0 + if (.not.(imcoo .eq. 0)) goto 120 + memi(coo+20) = 2048 + memi(coo+21) = 2048 + memi(coo+15) = 1 + memi(coo+16) = 2 + memi(coo+17) = 1 + memi(coo+18) = 2 + memd((((coo)-1)/2+1)) = 0.0d0 + memd((((coo+2)-1)/2+1)) = 0.0d0 + memd((((coo+4)-1)/2+1)) = 1.0d0 + memd((((coo+6)-1)/2+1)) = 1.0d0 + memi(coo+14) = 0 + goto 121 +120 continue + memi(coo+20) = memi(imcoo+20) + memi(coo+21) = memi(imcoo+21) + memi(coo+15) = memi(imcoo+15) + memi(coo+16) = memi(imcoo+16) + memi(coo+17) = memi(imcoo+17) + memi(coo+18) = memi(imcoo+18) + memd((((coo)-1)/2+1)) = memd((((imcoo)-1)/2+1)) + memd((((coo+2)-1)/2+1)) = memd((((imcoo+2)-1)/2+1)) + memd((((coo+4)-1)/2+1)) = memd((((imcoo+4)-1)/2+1)) + memd((((coo+6)-1)/2+1)) = memd((((imcoo+6)-1)/2+1)) + memi(coo+14) = memi(imcoo+14) +121 continue + memi(coo+19) = 4 + stat = skstrs (instr, memi(coo+12) , memi(coo+13) , memd(((( + * coo+8)-1)/2+1)) , memd((((coo+10)-1)/2+1)) ) + sw0001=(memi(coo+12) ) + goto 130 +140 continue + memi(coo+22) = 3 + memi(coo+23) = 1 + goto 131 +150 continue + memi(coo+22) = 1 + memi(coo+23) = 1 + goto 131 +130 continue + if (sw0001.eq.1) goto 140 + goto 150 +131 continue + goto 111 +110 continue + stat = skdecm (im, memc(str2), mw, coo) + call imunmp (im) +111 continue + call sfree (sp) + memi(coo+24) = stat + skdecs = (stat) + goto 100 +100 return + end + integer function skdecr (instr, coo, imcoo) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer imcoo + integer*2 instr(*) + integer stat + integer skstrs + integer sw0001 + save + call xcallc(coo, (30 + 255 + 1), 10 ) + call xstrcy(instr, memc((((coo+25)-1)*2+1)) , 255 ) + if (.not.(imcoo .eq. 0)) goto 110 + memi(coo+20) = 2048 + memi(coo+21) = 2048 + memi(coo+15) = 1 + memi(coo+16) = 2 + memi(coo+17) = 1 + memi(coo+18) = 2 + memd((((coo)-1)/2+1)) = 0.0d0 + memd((((coo+2)-1)/2+1)) = 0.0d0 + memd((((coo+4)-1)/2+1)) = 1.0d0 + memd((((coo+6)-1)/2+1)) = 1.0d0 + memi(coo+14) = 0 + goto 111 +110 continue + memi(coo+20) = memi(imcoo+20) + memi(coo+21) = memi(imcoo+21) + memi(coo+15) = memi(imcoo+15) + memi(coo+16) = memi(imcoo+16) + memi(coo+17) = memi(imcoo+17) + memi(coo+18) = memi(imcoo+18) + memd((((coo)-1)/2+1)) = memd((((imcoo)-1)/2+1)) + memd((((coo+2)-1)/2+1)) = memd((((imcoo+2)-1)/2+1)) + memd((((coo+4)-1)/2+1)) = memd((((imcoo+4)-1)/2+1)) + memd((((coo+6)-1)/2+1)) = memd((((imcoo+6)-1)/2+1)) + memi(coo+14) = memi(imcoo+14) +111 continue + memi(coo+19) = 4 + stat = skstrs (instr, memi(coo+12) , memi(coo+13) , memd((((coo + * +8)-1)/2+1)) , memd((((coo+10)-1)/2+1)) ) + sw0001=(memi(coo+12) ) + goto 120 +130 continue + memi(coo+22) = 3 + memi(coo+23) = 1 + goto 121 +140 continue + memi(coo+22) = 1 + memi(coo+23) = 1 + goto 121 +120 continue + if (sw0001.eq.1) goto 130 + goto 140 +121 continue + memi(coo+24) = stat + skdecr = (stat) + goto 100 +100 return + end + integer function skdecm (im, wcs, mw, coo) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer mw + integer coo + integer*2 wcs(*) + integer stat + integer sp + integer str1 + integer laxno + integer paxval + integer skimws + integer strdic + integer mwstai + integer mwopem + logical xerpop + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(6) + integer*2 st0002(28) + save + integer iyy + data st0001 / 37,115, 32, 37,115, 0/ + data (st0002(iyy),iyy= 1, 8) /124,108,111,103,105, 99, 97,108/ + data (st0002(iyy),iyy= 9,16) /124,116,118,124,112,104,121,115/ + data (st0002(iyy),iyy=17,24) /105, 99, 97,108,124,119,111,114/ + data (st0002(iyy),iyy=25,28) /108,100,124, 0/ + call xmallc(coo, (30 + 255 + 1), 10 ) + call sprinf (memc((((coo+25)-1)*2+1)) , 255 , st0001) + call pargsr (memc((((im+200 +165)-1)*2+1)) ) + call pargsr (wcs) + call smark (sp) + call salloc (str1, 1023 , 2) + call salloc (laxno, 7 , 4) + call salloc (paxval, 7 , 4) + call xerpsh + mw = mwopem (im) + if (xerflg) goto 112 +112 if (.not.xerpop()) goto 110 + memi(coo+12) = 0 + memi(coo+13) = 0 + memd((((coo+8)-1)/2+1)) = 1.6d308 + memd((((coo+10)-1)/2+1)) = 1.6d308 + mw = 0 + memi(coo+15) = 1 + memi(coo+16) = 2 + memi(coo+17) = 1 + memi(coo+18) = 2 + memi(coo+20) = 2048 + memi(coo+21) = 2048 + memd((((coo)-1)/2+1)) = 0.0d0 + memd((((coo+2)-1)/2+1)) = 0.0d0 + memd((((coo+4)-1)/2+1)) = 1.0d0 + memd((((coo+6)-1)/2+1)) = 1.0d0 + memi(coo+14) = 0 + memi(coo+19) = 1 + memi(coo+22) = 1 + memi(coo+23) = 1 + stat = -1 + goto 111 +110 continue + memi(coo+19) = strdic (wcs, memc(str1), 1023 , st0002) + if (.not.(memi(coo+19) .le. 0)) goto 120 + memi(coo+19) = 1 +120 continue + if (.not.(skimws (im, mw, memi(coo+12) , memi(coo+15) , memi + * (coo+16) , memi(coo+14) , memi(coo+13) , memd((((coo+8)-1)/2 + * +1)) , memd((((coo+10)-1)/2+1)) ) .eq. 0)) goto 130 + sw0001=(memi(coo+12) ) + goto 140 +150 continue + memi(coo+22) = 3 + memi(coo+23) = 1 + goto 141 +160 continue + memi(coo+22) = 1 + memi(coo+23) = 1 + goto 141 +140 continue + if (sw0001.eq.1) goto 150 + goto 160 +141 continue + call mwgaxp (mw, memi(laxno), memi(paxval), mwstai(mw, 5 + * )) + if (.not.(memi(laxno+memi(coo+15) -1) .lt. memi(laxno+ + * memi(coo+16) -1))) goto 170 + memi(coo+17) = memi(laxno+memi(coo+15) -1) + memi(coo+18) = memi(laxno+memi(coo+16) -1) + goto 171 +170 continue + memi(coo+17) = memi(laxno+memi(coo+16) -1) + memi(coo+18) = memi(laxno+memi(coo+15) -1) +171 continue + if (.not.(memi(coo+17) .le. 0 .or. memi(coo+18) .le. 0)) + * goto 180 + memd((((coo)-1)/2+1)) = 0.0d0 + memd((((coo+2)-1)/2+1)) = 0.0d0 + memd((((coo+4)-1)/2+1)) = 1.0d0 + memd((((coo+6)-1)/2+1)) = 1.0d0 + memi(coo+20) = 2048 + memi(coo+21) = 2048 + stat = -1 + goto 181 +180 continue + memd((((coo)-1)/2+1)) = meml(im+memi(im+memi(coo+17) + + * 47-1) +54-1) + memd((((coo+2)-1)/2+1)) = meml(im+memi(im+memi(coo+18) + * +47-1) +54-1) + memd((((coo+4)-1)/2+1)) = memi(im+memi(coo+17) +59-1) + memd((((coo+6)-1)/2+1)) = memi(im+memi(coo+18) +59-1) + memi(coo+20) = meml(im+200 +memi(coo+17) +8-1) + memi(coo+21) = meml(im+200 +memi(coo+18) +8-1) + stat = 0 +181 continue + goto 131 +130 continue + call mwcloe (mw) + mw = 0 + memi(coo+17) = 1 + memi(coo+18) = 2 + memi(coo+20) = 2048 + memi(coo+21) = 2048 + memd((((coo)-1)/2+1)) = 0.0d0 + memd((((coo+2)-1)/2+1)) = 0.0d0 + memd((((coo+4)-1)/2+1)) = 1.0d0 + memd((((coo+6)-1)/2+1)) = 1.0d0 + memi(coo+22) = 1 + memi(coo+23) = 1 + stat = -1 +131 continue +111 continue + call sfree (sp) + memi(coo+24) = stat + skdecm = (stat) + goto 100 +100 return + end + integer function skstrs (instr, ctype, radecs, equinx, epoch) + integer ctype + integer radecs + double precision equinx + double precision epoch + integer*2 instr(*) + integer ip + integer nitems + integer sctype + integer srades + integer stat + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer str1 + integer str2 + integer strdic + integer nscan + integer ctod + double precision slej2d + double precision slepb + double precision sleb2d + double precision slepj + integer sw0001,sw0002,sw0003 + integer*2 st0001(63) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /124,102,107, 52,124,110,111,101/ + data (st0001(iyy),iyy= 9,16) /102,107, 52,124,102,107, 53,124/ + data (st0001(iyy),iyy=17,24) /105, 99,114,115,124, 97,112,112/ + data (st0001(iyy),iyy=25,32) / 97,114,101,110,116,124,101, 99/ + data (st0001(iyy),iyy=33,40) /108,105,112,116,105, 99,124,103/ + data (st0001(iyy),iyy=41,48) / 97,108, 97, 99,116,105, 99,124/ + data (st0001(iyy),iyy=49,56) /115,117,112,101,114,103, 97,108/ + data (st0001(iyy),iyy=57,63) / 97, 99,116,105, 99,124, 0/ + ctype = 0 + radecs = 0 + equinx = 1.6d308 + epoch = 1.6d308 + call smark (sp) + call salloc (str1, 1023 , 2) + call salloc (str2, 1023 , 2) + call sscan (instr) + call gargwd (memc(str1), 1023 ) + if (.not.(memc(str1) .eq. 0 .or. nscan() .lt. 1)) goto 110 + call sfree (sp) + skstrs = (-1) + goto 100 +110 continue + nitems = 1 +111 continue + sctype = strdic (memc(str1), memc(str2), 1023 , st0001) + if (.not.(sctype .le. 0)) goto 120 + ctype = 1 + goto 121 +120 continue + sw0001=(sctype) + goto 130 +140 continue + ctype = 1 + radecs = 1 + goto 131 +150 continue + ctype = 1 + radecs = 2 + goto 131 +160 continue + ctype = 1 + radecs = 3 + goto 131 +170 continue + ctype = 1 + radecs = 4 + goto 131 +180 continue + ctype = 1 + radecs = 5 + goto 131 +190 continue + ctype = 2 + goto 131 +200 continue + ctype = 3 + goto 131 +210 continue + ctype = 4 + goto 131 +130 continue + if (sw0001.lt.1.or.sw0001.gt.8) goto 131 + goto (140,150,160,170,180,190,200,210),sw0001 +131 continue + call gargwd (memc(str1), 1023 ) + if (.not.(nscan() .gt. nitems)) goto 220 + nitems = nitems + 1 +220 continue +121 continue + sctype = ctype + srades = radecs + sw0002=(sctype) + goto 230 +240 continue + sw0003=(srades) + goto 250 +260 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106 .or + * . memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) goto 270 + ip = 2 + goto 271 +270 continue + ip = 1 +271 continue + if (.not.(ctod (memc(str1), ip, equinx) .le. 0)) goto 280 + equinx = 1950.0d0 +280 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106)) + * goto 290 + equinx = slepb (slej2d (equinx)) +290 continue + call gargwd (memc(str2), 1023 ) + if (.not.(nscan() .le. nitems)) goto 300 + epoch = sleb2d (equinx) + goto 301 +300 continue + if (.not.(memc(str2) .eq. 74 .or. memc(str2) .eq. 106 + * .or. memc(str2) .eq. 66 .or. memc(str2) .eq. 98)) goto + * 310 + ip = 2 + goto 311 +310 continue + ip = 1 +311 continue + if (.not.(ctod (memc(str2), ip, epoch) .le. 0)) goto + * 320 + epoch = sleb2d (equinx) + goto 321 +320 continue + if (.not.(epoch .le. 3000.0d0 .and. (memc(str2) .eq. + * 74 .or. memc(str2) .eq. 106))) goto 330 + epoch = slej2d (epoch) + goto 331 +330 continue + if (.not.(epoch .gt. 3000.0d0)) goto 340 + epoch = epoch - 2400000.5d0 + goto 341 +340 continue + epoch = sleb2d (epoch) +341 continue +331 continue +321 continue +301 continue + goto 251 +350 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106 .or + * . memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) goto 360 + ip = 2 + goto 361 +360 continue + ip = 1 +361 continue + if (.not.(ctod (memc(str1), ip, equinx) .le. 0)) goto 370 + equinx = 2000.0d0 +370 continue + if (.not.(memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) + * goto 380 + equinx = slepj(sleb2d (equinx)) +380 continue + call gargwd (memc(str2), 1023 ) + if (.not.(nscan() .le. nitems)) goto 390 + epoch = slej2d (equinx) + goto 391 +390 continue + if (.not.(memc(str2) .eq. 74 .or. memc(str2) .eq. 106 + * .or. memc(str2) .eq. 66 .or. memc(str2) .eq. 98)) goto + * 400 + ip = 2 + goto 401 +400 continue + ip = 1 +401 continue + if (.not.(ctod (memc(str2), ip, epoch) .le. 0)) goto + * 410 + epoch = slej2d (equinx) + goto 411 +410 continue + if (.not.(epoch .le. 3000.0d0 .and. (memc(str2) .eq. + * 66 .or. memc(str2) .eq. 98))) goto 420 + epoch = sleb2d (epoch) + goto 421 +420 continue + if (.not.(epoch .gt. 3000.0d0)) goto 430 + epoch = epoch - 2400000.5d0 + goto 431 +430 continue + epoch = slej2d (epoch) +431 continue +421 continue +411 continue +391 continue + goto 251 +440 continue + equinx = 2000.0d0 + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106 .or + * . memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) goto 450 + ip = 2 + goto 451 +450 continue + ip = 1 +451 continue + if (.not.(ctod (memc(str1), ip, epoch) .le. 0)) goto 460 + epoch = 1.6d308 + goto 461 +460 continue + if (.not.(epoch .le. 3000.0d0)) goto 470 + if (.not.(memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) + * goto 480 + epoch = sleb2d (epoch) + goto 481 +480 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106) + * ) goto 490 + epoch = slej2d (epoch) + goto 491 +490 continue + if (.not.(epoch .lt. 1984.0d0)) goto 500 + epoch = sleb2d (epoch) + goto 501 +500 continue + epoch = slej2d (epoch) +501 continue +491 continue +481 continue + goto 471 +470 continue + epoch = epoch - 2400000.5d0 +471 continue +461 continue + goto 251 +510 continue + ip = 1 + if (.not.(memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) + * goto 520 + radecs = 1 + ip = ip + 1 + if (.not.(ctod (memc(str1), ip, equinx) .le. 0)) goto + * 530 + equinx = 1950.0d0 +530 continue + call gargwd (memc(str2), 1023 ) + if (.not.(nscan() .le. nitems)) goto 540 + epoch = sleb2d (equinx) + goto 541 +540 continue + if (.not.(memc(str2) .eq. 74 .or. memc(str2) .eq. + * 106)) goto 550 + ip = 2 + goto 551 +550 continue + if (.not.(memc(str2) .eq. 66 .or. memc(str2) .eq. + * 98)) goto 560 + ip = 2 + goto 561 +560 continue + ip = 1 +561 continue +551 continue + if (.not.(ctod (memc(str2), ip, epoch) .le. 0)) + * goto 570 + epoch = sleb2d (equinx) + goto 571 +570 continue + if (.not.(epoch .le. 3000.0d0 .and. (memc(str2) .eq + * . 74 .or. memc(str2) .eq. 106))) goto 580 + epoch = slej2d (epoch) + goto 581 +580 continue + if (.not.(epoch .gt. 3000.0d0)) goto 590 + epoch = epoch - 2400000.5d0 + goto 591 +590 continue + epoch = sleb2d (epoch) +591 continue +581 continue +571 continue +541 continue + goto 521 +520 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106)) + * goto 600 + radecs = 3 + ip = ip + 1 + if (.not.(ctod (memc(str1), ip, equinx) .le. 0)) goto + * 610 + equinx = 2000.0d0 +610 continue + call gargwd (memc(str2), 1023 ) + if (.not.(nscan() .le. nitems)) goto 620 + epoch = slej2d (equinx) + goto 621 +620 continue + if (.not.(memc(str2) .eq. 74 .or. memc(str2) .eq. + * 106 .or. memc(str2) .eq. 66 .or. memc(str2) .eq. 98 + * )) goto 630 + ip = 2 + goto 631 +630 continue + ip = 1 +631 continue + if (.not.(ctod (memc(str2), ip, epoch) .le. 0)) + * goto 640 + epoch = slej2d (equinx) + goto 641 +640 continue + if (.not.(epoch .le. 3000.0d0 .and. (memc(str2) .eq + * . 66 .or. memc(str2) .eq. 98))) goto 650 + epoch = sleb2d (epoch) + goto 651 +650 continue + if (.not.(epoch .gt. 3000.0d0)) goto 660 + epoch = epoch - 2400000.5d0 + goto 661 +660 continue + epoch = slej2d (epoch) +661 continue +651 continue +641 continue +621 continue + goto 601 +600 continue + if (.not.(ctod (memc(str1), ip, equinx) .le. 0)) goto 670 + ctype = 0 + radecs = 0 + equinx = 1.6d308 + epoch = 1.6d308 + goto 671 +670 continue + if (.not.(equinx .lt. 1984.0d0)) goto 680 + radecs = 1 + call gargwd (memc(str2), 1023 ) + if (.not.(nscan() .le. nitems)) goto 690 + epoch = sleb2d (equinx) + goto 691 +690 continue + if (.not.(memc(str2) .eq. 74 .or. memc(str2) .eq. + * 106 .or. memc(str2) .eq. 66 .or. memc(str2) .eq. 98 + * )) goto 700 + ip = 2 + goto 701 +700 continue + ip = 1 +701 continue + if (.not.(ctod (memc(str2), ip, epoch) .le. 0)) + * goto 710 + epoch = sleb2d (equinx) + goto 711 +710 continue + if (.not.(epoch .le. 3000.0d0 .and. (memc(str2) .eq + * . 74 .or. memc(str2) .eq. 106))) goto 720 + epoch = slej2d (epoch) + goto 721 +720 continue + if (.not.(epoch .gt. 3000.0d0)) goto 730 + epoch = epoch - 2400000.5d0 + goto 731 +730 continue + epoch = sleb2d (epoch) +731 continue +721 continue +711 continue +691 continue + goto 681 +680 continue + radecs = 3 + call gargwd (memc(str2), 1023 ) + if (.not.(nscan() .le. nitems)) goto 740 + epoch = slej2d (equinx) + goto 741 +740 continue + if (.not.(memc(str2) .eq. 74 .or. memc(str2) .eq. + * 106 .or. memc(str2) .eq. 66 .or. memc(str2) .eq. 98 + * )) goto 750 + ip = 2 + goto 751 +750 continue + ip = 1 +751 continue + if (.not.(ctod (memc(str2), ip, epoch) .le. 0)) + * goto 760 + epoch = slej2d (equinx) + goto 761 +760 continue + if (.not.(epoch .le. 3000.0d0 .and. (memc(str2) .eq + * . 66 .or. memc(str2) .eq. 98))) goto 770 + epoch = sleb2d (epoch) + goto 771 +770 continue + if (.not.(epoch .gt. 3000.0d0)) goto 780 + epoch = epoch - 2400000.5d0 + goto 781 +780 continue + epoch = slej2d (epoch) +781 continue +771 continue +761 continue +741 continue +681 continue +671 continue +601 continue +521 continue + goto 251 +250 continue + if (sw0003.lt.1.or.sw0003.gt.5) goto 510 + goto (260,260,350,350,440),sw0003 +251 continue + goto 231 +790 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106 .or. + * memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) goto 800 + ip = 2 + goto 801 +800 continue + ip = 1 +801 continue + if (.not.(ctod (memc(str1), ip, epoch) .le. 0)) goto 810 + epoch = 1.6d308 + goto 811 +810 continue + if (.not.(epoch .le. 3000.0d0)) goto 820 + if (.not.(memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) + * goto 830 + epoch = sleb2d (epoch) + goto 831 +830 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106)) + * goto 840 + epoch = slej2d (epoch) + goto 841 +840 continue + if (.not.(epoch .lt. 1984.0d0)) goto 850 + epoch = sleb2d (epoch) + goto 851 +850 continue + epoch = slej2d (epoch) +851 continue +841 continue +831 continue + goto 821 +820 continue + epoch = epoch - 2400000.5d0 +821 continue +811 continue + goto 231 +860 continue + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106 .or. + * memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) goto 870 + ip = 2 + goto 871 +870 continue + ip = 1 +871 continue + if (.not.(ctod (memc(str1), ip, epoch) .le. 0)) goto 880 + epoch = sleb2d (1950.0d0) + goto 881 +880 continue + if (.not.(epoch .le. 3000.0d0)) goto 890 + if (.not.(memc(str1) .eq. 74 .or. memc(str1) .eq. 106)) + * goto 900 + epoch = slej2d (epoch) + goto 901 +900 continue + if (.not.(memc(str1) .eq. 66 .or. memc(str1) .eq. 98)) + * goto 910 + epoch = sleb2d (epoch) + goto 911 +910 continue + if (.not.(epoch .lt. 1984.0d0)) goto 920 + epoch = sleb2d (epoch) + goto 921 +920 continue + epoch = slej2d (epoch) +921 continue +911 continue +901 continue + goto 891 +890 continue + epoch = epoch - 2400000.5d0 +891 continue +881 continue + goto 231 +230 continue + if (sw0002.lt.1.or.sw0002.gt.4) goto 231 + goto (240,790,860,860),sw0002 +231 continue + if (.not.(ctype .eq. 0)) goto 930 + stat = -1 + goto 931 +930 continue + if (.not.(ctype .eq. 1 .and. (radecs .eq. 0 .or. ((equinx).eq.1 + * .6d308) .or. ((epoch).eq.1.6d308)))) goto 940 + stat = -1 + goto 941 +940 continue + if (.not.(ctype .eq. 2 .and. ((epoch).eq.1.6d308))) goto 950 + stat = -1 + goto 951 +950 continue + stat = 0 +951 continue +941 continue +931 continue + call sfree (sp) + skstrs = (stat) + goto 100 +100 return + end + integer function skimws (im, mw, ctype, lngax, latax, wtype, + *radecs, equinx, epoch) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer mw + integer ctype + integer lngax + integer latax + integer wtype + integer radecs + double precision equinx + double precision epoch + integer i + integer ndim + integer axtype + integer day + integer month + integer year + integer ier + integer oldfis + integer sp + integer atval + double precision hours + double precision imgetd + double precision sleb2d + double precision slej2d + integer mwstai + integer strdic + integer dtmdee + logical xerpop + logical xerflg + common /xercom/ xerflg + integer sw0001,sw0002,sw0003 + integer*2 st0001(7) + integer*2 st0002(6) + integer*2 st0003(39) + integer*2 st0004(6) + integer*2 st0005(6) + integer*2 st0006(7) + integer*2 st0007(114) + integer*2 st0008(8) + integer*2 st0009(6) + integer*2 st0010(9) + integer*2 st0011(30) + integer*2 st0012(8) + integer*2 st0013(8) + integer*2 st0014(9) + integer*2 st0015(8) + integer*2 st0016(8) + integer*2 st0017(9) + integer*2 st0018(8) + integer*2 st0019(8) + integer*2 st0020(9) + save + integer iyy + data st0001 / 97,120,116,121,112,101, 0/ + data st0002 / 73, 78, 68, 69, 70, 0/ + data (st0003(iyy),iyy= 1, 8) /124,114, 97,124,100,101, 99,124/ + data (st0003(iyy),iyy= 9,16) /103,108,111,110,124,103,108, 97/ + data (st0003(iyy),iyy=17,24) /116,124,101,108,111,110,124,101/ + data (st0003(iyy),iyy=25,32) /108, 97,116,124,115,108,111,110/ + data (st0003(iyy),iyy=33,39) /124,115,108, 97,116,124, 0/ + data st0004 /119,116,121,112,101, 0/ + data st0005 /119,116,121,112,101, 0/ + data st0006 /108,105,110,101, 97,114, 0/ + data (st0007(iyy),iyy= 1, 8) /124,108,105,110,124, 97,122,112/ + data (st0007(iyy),iyy= 9,16) /124,116, 97,110,124,115,105,110/ + data (st0007(iyy),iyy=17,24) /124,115,116,103,124, 97,114, 99/ + data (st0007(iyy),iyy=25,32) /124,122,112,110,124,122,101, 97/ + data (st0007(iyy),iyy=33,40) /124, 97,105,114,124, 99,121,112/ + data (st0007(iyy),iyy=41,48) /124, 99, 97,114,124,109,101,114/ + data (st0007(iyy),iyy=49,56) /124, 99,101, 97,124, 99,111,112/ + data (st0007(iyy),iyy=57,64) /124, 99,111,100,124, 99,111,101/ + data (st0007(iyy),iyy=65,72) /124, 99,111,111,124, 98,111,110/ + data (st0007(iyy),iyy=73,80) /124,112, 99,111,124,103,108,115/ + data (st0007(iyy),iyy=81,88) /124,112, 97,114,124, 97,105,116/ + data (st0007(iyy),iyy=89,96) /124,109,111,108,124, 99,115, 99/ + data (st0007(iyy),iyy=97,104) /124,113,115, 99,124,116,115, 99/ + data (st0007(iyy),iyy=105,112) /124,116,110,120,124,122,112,120/ + data (st0007(iyy),iyy=113,114) /124, 0/ + data st0008 / 69, 81, 85, 73, 78, 79, 88, 0/ + data st0009 / 69, 80, 79, 67, 72, 0/ + data (st0010(iyy),iyy= 1, 8) / 82, 65, 68, 69, 67, 83, 89, 83/ + data (st0010(iyy),iyy= 9, 9) / 0/ + data (st0011(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0011(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0011(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0011(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0012 / 77, 74, 68, 45, 87, 67, 83, 0/ + data st0013 / 77, 74, 68, 45, 79, 66, 83, 0/ + data (st0014(iyy),iyy= 1, 8) / 68, 65, 84, 69, 45, 79, 66, 83/ + data (st0014(iyy),iyy= 9, 9) / 0/ + data st0015 / 77, 74, 68, 45, 87, 67, 83, 0/ + data st0016 / 77, 74, 68, 45, 79, 66, 83, 0/ + data (st0017(iyy),iyy= 1, 8) / 68, 65, 84, 69, 45, 79, 66, 83/ + data (st0017(iyy),iyy= 9, 9) / 0/ + data st0018 / 77, 74, 68, 45, 87, 67, 83, 0/ + data st0019 / 77, 74, 68, 45, 79, 66, 83, 0/ + data (st0020(iyy),iyy= 1, 8) / 68, 65, 84, 69, 45, 79, 66, 83/ + data (st0020(iyy),iyy= 9, 9) / 0/ + call smark (sp) + call salloc (atval, 1023 , 2) + ctype = 0 + lngax = 0 + latax = 0 + wtype = 0 + radecs = 0 + equinx = 1.6d308 + epoch = 1.6d308 + ndim = mwstai (mw, 5 ) + do 110 i = 1, ndim + call xerpsh + call mwgwas (mw, i, st0001, memc(atval), 1023 ) + if (.not.xerpop()) goto 120 + call xstrcy(st0002, memc(atval), 1023 ) +120 continue + axtype = strdic (memc(atval), memc(atval), 1023 , st0003) + sw0001=(axtype) + goto 130 +140 continue + ctype = 1 + goto 131 +150 continue + ctype = 2 + goto 131 +160 continue + ctype = 3 + goto 131 +170 continue + ctype = 4 + goto 131 +180 continue + goto 131 +130 continue + if (sw0001.lt.1.or.sw0001.gt.8) goto 180 + goto (140,140,160,160,150,150,170,170),sw0001 +131 continue + sw0002=(axtype) + goto 190 +200 continue + lngax = i + goto 191 +210 continue + latax = i + goto 191 +220 continue + goto 191 +190 continue + if (sw0002.lt.1.or.sw0002.gt.8) goto 220 + goto (200,210,200,210,200,210,200,210),sw0002 +191 continue +110 continue +111 continue + if (.not.(ctype .eq. 0 .or. lngax .eq. 0 .or. latax .eq. 0)) + * goto 230 + call sfree (sp) + skimws = (-1) + goto 100 +230 continue + call xerpsh + call mwgwas (mw, lngax, st0004, memc(atval), 1023 ) + if (xerflg) goto 242 +242 if (.not.xerpop()) goto 240 + call xerpsh + call mwgwas(mw, latax, st0005, memc(atval), 1023 ) + if (.not.xerpop()) goto 250 + call xstrcy(st0006, memc(atval), 1023 ) +250 continue +240 continue + wtype = strdic (memc(atval), memc(atval), 1023 , st0007) + if (.not.(wtype .eq. 0)) goto 260 + call sfree (sp) + skimws = (-1) + goto 100 +260 continue + if (.not.(ctype .eq. 1)) goto 270 + call xerpsh + equinx = imgetd (im, st0008) + if (xerflg) goto 282 +282 if (.not.xerpop()) goto 280 + call xerpsh + equinx = imgetd (im, st0009) + if (xerflg) goto 292 +292 if (.not.xerpop()) goto 290 + equinx = 1.6d308 +290 continue +280 continue + call xerpsh + call imgstr (im, st0010, memc(atval), 1023 ) + if (xerflg) goto 302 +302 if (.not.xerpop()) goto 300 + radecs = 0 + goto 301 +300 continue + call strlwr (memc(atval)) + radecs = strdic (memc(atval), memc(atval), 1023 , st0011) +301 continue + if (.not.(radecs .eq. 0)) goto 310 + if (.not.(((equinx).eq.1.6d308))) goto 320 + radecs = 3 + goto 321 +320 continue + if (.not.(equinx .lt. 1984.0d0)) goto 330 + radecs = 1 + goto 331 +330 continue + radecs = 3 +331 continue +321 continue +310 continue + call xerpsh + epoch = imgetd (im, st0012) + if (xerflg) goto 342 +342 if (.not.xerpop()) goto 340 + call xerpsh + epoch = imgetd (im, st0013) + if (xerflg) goto 352 +352 if (.not.xerpop()) goto 350 + call xerpsh + call imgstr (im, st0014, memc(atval), 1023 ) + if (xerflg) goto 362 +362 if (.not.xerpop()) goto 360 + epoch = 1.6d308 + goto 361 +360 continue + if (.not.(dtmdee (memc(atval), year, month, day, hours + * , oldfis) .eq. 0)) goto 370 + call slcadj (year, month, day, epoch, ier) + if (.not.(ier .ne. 0)) goto 380 + epoch = 1.6d308 + goto 381 +380 continue + if (.not.(.not. ((hours).eq.1.6d308) .and. hours . + * ge. 0.0d0 .and. hours .le. 24.0d0)) goto 390 + epoch = epoch + hours / 24.0d0 +390 continue +381 continue + goto 371 +370 continue + epoch = 1.6d308 +371 continue +361 continue +350 continue +340 continue + sw0003=(radecs) + goto 400 +410 continue + if (.not.(((equinx).eq.1.6d308))) goto 420 + equinx = 1950.0d0 +420 continue + if (.not.(((epoch).eq.1.6d308))) goto 430 + epoch = sleb2d (1950.0d0) +430 continue + goto 401 +440 continue + if (.not.(((equinx).eq.1.6d308))) goto 450 + equinx = 2000.0d0 +450 continue + if (.not.(((epoch).eq.1.6d308))) goto 460 + epoch = slej2d (2000.0d0) +460 continue + goto 401 +470 continue + equinx = 2000.0d0 + goto 401 +400 continue + if (sw0003.lt.1.or.sw0003.gt.5) goto 401 + goto (410,410,440,440,470),sw0003 +401 continue + if (.not.(((epoch).eq.1.6d308))) goto 480 + call sfree (sp) + skimws = (-1) + goto 100 +480 continue +270 continue + if (.not.(ctype .eq. 2)) goto 490 + call xerpsh + epoch = imgetd (im, st0015) + if (xerflg) goto 502 +502 if (.not.xerpop()) goto 500 + call xerpsh + epoch = imgetd (im, st0016) + if (xerflg) goto 512 +512 if (.not.xerpop()) goto 510 + call xerpsh + call imgstr (im, st0017, memc(atval), 1023 ) + if (xerflg) goto 522 +522 if (.not.xerpop()) goto 520 + epoch = 1.6d308 + goto 521 +520 continue + if (.not.(dtmdee (memc(atval), year, month, day, hours + * , oldfis) .eq. 0)) goto 530 + call slcadj (year, month, day, epoch, ier) + if (.not.(ier .ne. 0)) goto 540 + epoch = 1.6d308 + goto 541 +540 continue + if (.not.(.not. ((hours).eq.1.6d308) .and. hours . + * ge. 0.0d0 .and. hours .le. 24.0d0)) goto 550 + epoch = epoch + hours / 24.0d0 +550 continue +541 continue + goto 531 +530 continue + epoch = 1.6d308 +531 continue +521 continue +510 continue +500 continue + if (.not.(((epoch).eq.1.6d308))) goto 560 + call sfree (sp) + skimws = (-1) + goto 100 +560 continue +490 continue + if (.not.(ctype .eq. 3 .or. ctype .eq. 4)) goto 570 + call xerpsh + epoch = imgetd (im, st0018) + if (xerflg) goto 582 +582 if (.not.xerpop()) goto 580 + call xerpsh + epoch = imgetd (im, st0019) + if (xerflg) goto 592 +592 if (.not.xerpop()) goto 590 + call xerpsh + call imgstr (im, st0020, memc(atval), 1023 ) + if (xerflg) goto 602 +602 if (.not.xerpop()) goto 600 + epoch = sleb2d (1950.0d0) + goto 601 +600 continue + if (.not.(dtmdee (memc(atval), year, month, day, hours + * , oldfis) .eq. 0)) goto 610 + call slcadj (year, month, day, epoch, ier) + if (.not.(ier .ne. 0)) goto 620 + epoch = sleb2d (1950.0d0) + goto 621 +620 continue + if (.not.(.not. ((hours).eq.1.6d308) .and. hours + * .ge. 0.0d0 .and. hours .le. 24.0d0)) goto 630 + epoch = epoch + hours / 24.0d0 +630 continue +621 continue + goto 611 +610 continue + epoch = sleb2d (1950.0d0) +611 continue +601 continue +590 continue +580 continue +570 continue + call sfree (sp) + skimws = (0) + goto 100 +100 return + end + subroutine skenws (coo, wcsstr, maxch) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer maxch + integer*2 wcsstr(*) + double precision skstad + double precision slepj + double precision slepb + integer skstai + integer sw0001,sw0002 + integer*2 st0001(9) + integer*2 st0002(16) + integer*2 st0003(18) + integer*2 st0004(19) + integer*2 st0005(18) + integer*2 st0006(21) + integer*2 st0007(9) + integer*2 st0008(16) + integer*2 st0009(16) + integer*2 st0010(21) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 97,112,112, 97,114,101,110,116/ + data (st0001(iyy),iyy= 9, 9) / 0/ + data (st0002(iyy),iyy= 1, 8) / 97,112,112, 97,114,101,110,116/ + data (st0002(iyy),iyy= 9,16) / 32, 74, 37, 48, 46, 56,102, 0/ + data (st0003(iyy),iyy= 1, 8) /102,107, 53, 32, 74, 37, 48, 46/ + data (st0003(iyy),iyy= 9,16) / 51,102, 32, 74, 37, 48, 46, 56/ + data (st0003(iyy),iyy=17,18) /102, 0/ + data (st0004(iyy),iyy= 1, 8) /105, 99,114,115, 32, 74, 37, 48/ + data (st0004(iyy),iyy= 9,16) / 46, 51,102, 32, 74, 37, 48, 46/ + data (st0004(iyy),iyy=17,19) / 56,102, 0/ + data (st0005(iyy),iyy= 1, 8) /102,107, 52, 32, 66, 37, 48, 46/ + data (st0005(iyy),iyy= 9,16) / 51,102, 32, 66, 37, 48, 46, 56/ + data (st0005(iyy),iyy=17,18) /102, 0/ + data (st0006(iyy),iyy= 1, 8) /102,107, 52,110,111,101, 32, 66/ + data (st0006(iyy),iyy= 9,16) / 37, 48, 46, 51,102, 32, 66, 37/ + data (st0006(iyy),iyy=17,21) / 48, 46, 56,102, 0/ + data (st0007(iyy),iyy= 1, 8) /101, 99,108,105,112,116,105, 99/ + data (st0007(iyy),iyy= 9, 9) / 0/ + data (st0008(iyy),iyy= 1, 8) /101, 99,108,105,112,116,105, 99/ + data (st0008(iyy),iyy= 9,16) / 32, 74, 37, 48, 46, 56,102, 0/ + data (st0009(iyy),iyy= 1, 8) /103, 97,108, 97, 99,116,105, 99/ + data (st0009(iyy),iyy= 9,16) / 32, 74, 37, 48, 46, 56,102, 0/ + data (st0010(iyy),iyy= 1, 8) /115,117,112,101,114,103, 97,108/ + data (st0010(iyy),iyy= 9,16) / 97, 99,116,105, 99, 32,106, 37/ + data (st0010(iyy),iyy=17,21) / 48, 46, 56,102, 0/ + sw0001=(skstai (coo, 7)) + goto 110 +120 continue + sw0002=(skstai(coo, 8)) + goto 130 +140 continue + if (.not.(((skstad(coo, 6)).eq.1.6d308))) goto 150 + call sprinf (wcsstr, maxch, st0001) + goto 151 +150 continue + call sprinf (wcsstr, maxch, st0002) + call pargd (slepj(skstad(coo, 6))) +151 continue + goto 131 +160 continue + call sprinf (wcsstr, maxch, st0003) + call pargd (skstad(coo, 5)) + call pargd (slepj(skstad(coo, 6))) + goto 131 +170 continue + call sprinf (wcsstr, maxch, st0004) + call pargd (skstad(coo, 5)) + call pargd (slepj(skstad(coo, 6))) + goto 131 +180 continue + call sprinf (wcsstr, maxch, st0005) + call pargd (skstad(coo, 5)) + call pargd (slepb(skstad(coo, 6))) + goto 131 +190 continue + call sprinf (wcsstr, maxch, st0006) + call pargd (skstad(coo, 5)) + call pargd (slepb(skstad(coo, 6))) + goto 131 +200 continue + wcsstr(1) = 0 + goto 131 +130 continue + if (sw0002.lt.1.or.sw0002.gt.5) goto 200 + goto (180,190,160,170,140),sw0002 +131 continue + goto 111 +210 continue + if (.not.(((skstad(coo, 6)).eq.1.6d308))) goto 220 + call sprinf (wcsstr, maxch, st0007) + goto 221 +220 continue + call sprinf (wcsstr, maxch, st0008) + call pargd (slepj(skstad(coo, 6))) +221 continue + goto 111 +230 continue + call sprinf (wcsstr, maxch, st0009) + call pargd (slepj(skstad(coo, 6))) + goto 111 +240 continue + call sprinf (wcsstr, maxch, st0010) + call pargd (slepj(skstad(coo, 6))) + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 111 + goto (120,210,230,240),sw0001 +111 continue +100 return + end + integer function skcopy (cooin) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cooin + integer cooout + save + if (.not.(cooin .eq. 0)) goto 110 + cooout = 0 + goto 111 +110 continue + call xcallc(cooout, (30 + 255 + 1), 10 ) + memd((((cooout)-1)/2+1)) = memd((((cooin)-1)/2+1)) + memd((((cooout+2)-1)/2+1)) = memd((((cooin+2)-1)/2+1)) + memd((((cooout+4)-1)/2+1)) = memd((((cooin+4)-1)/2+1)) + memd((((cooout+6)-1)/2+1)) = memd((((cooin+6)-1)/2+1)) + memd((((cooout+8)-1)/2+1)) = memd((((cooin+8)-1)/2+1)) + memd((((cooout+10)-1)/2+1)) = memd((((cooin+10)-1)/2+1)) + memi(cooout+12) = memi(cooin+12) + memi(cooout+13) = memi(cooin+13) + memi(cooout+14) = memi(cooin+14) + memi(cooout+15) = memi(cooin+15) + memi(cooout+16) = memi(cooin+16) + memi(cooout+17) = memi(cooin+17) + memi(cooout+18) = memi(cooin+18) + memi(cooout+19) = memi(cooin+19) + memi(cooout+20) = memi(cooin+20) + memi(cooout+21) = memi(cooin+21) + memi(cooout+22) = memi(cooin+22) + memi(cooout+23) = memi(cooin+23) + call xstrcy(memc((((cooin+25)-1)*2+1)) , memc((((cooout+25)- + * 1)*2+1)) , 255 ) +111 continue + skcopy = (cooout) + goto 100 +100 return + end + subroutine skcloe (coo) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + save + if (.not.(coo .ne. 0)) goto 110 + call xmfree(coo, 10 ) +110 continue +100 return + end +c sprinf sprintf +c dtmdee dtm_decode +c skenws sk_enwcs +c skstad sk_statd +c radecs radecsys +c equinx equinox +c skdecs sk_decwcs +c skimws sk_imwcs +c skstrs sk_strwcs +c skdecr sk_decwstr +c skstai sk_stati +c mwstai mw_stati +c skdecm sk_decim +c mwgaxp mw_gaxmap +c gargwd gargwrd +c sleb2d sl_eb2d +c mwopem mw_openim +c oldfis oldfits +c imunmp imunmap +c mwgwas mw_gwattrs +c skcopy sk_copy +c slej2d sl_ej2d +c srades sradecsys +c slcadj sl_cadj +c skcloe sk_close +c pargsr pargstr +c mwcloe mw_close diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.x new file mode 100644 index 00000000..5fa88f3b --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skdecode.x @@ -0,0 +1,999 @@ +include <imio.h> +include <imhdr.h> +include <mwset.h> +include "skywcs.h" +include "skywcsdef.h" + +# SK_DECWCS -- Decode the wcs string which may be either an image name +# plus wcs, e.g. "dev$pix logical" or a string describing the celestial +# coordinate system, e.g. "J2000" or "galactic" into a celestial coordinate +# structure. If the input wcs is an image wcs then a non-NULL pointer to +# the image wcs structure is also returned. ERR is returned if a valid +# celestial coordinate structure cannot be created. + +int procedure sk_decwcs (instr, mw, coo, imcoo) + +char instr[ARB] #I the input wcs string +pointer mw #O the pointer to the image wcs structure +pointer coo #O the pointer to the coordinate structure +pointer imcoo #I pointer to an existing coordinate structure + +int stat +pointer sp, str1, str2, laxno, paxval, im +int sk_strwcs(), sk_decim() +pointer immap() +errchk immap() + +begin + call calloc (coo, LEN_SKYCOOSTRUCT, TY_STRUCT) + call strcpy (instr, SKY_COOSYSTEM(coo), SZ_FNAME) + + # Allocate some working space. + call smark (sp) + call salloc (str1, SZ_LINE, TY_CHAR) + call salloc (str2, SZ_LINE, TY_CHAR) + call salloc (laxno, IM_MAXDIM, TY_INT) + call salloc (paxval, IM_MAXDIM, TY_INT) + + # Decode the wcs. + call sscan (instr) + call gargwrd (Memc[str1], SZ_LINE) + call gargwrd (Memc[str2], SZ_LINE) + + # First try to open an image wcs. + iferr { + im = immap (Memc[str1], READ_ONLY, 0) + + # Decode the user wcs. + } then { + + # Initialize. + mw = NULL + if (imcoo == NULL) { + SKY_NLNGAX(coo) = 2048 + SKY_NLATAX(coo) = 2048 + SKY_PLNGAX(coo) = 1 + SKY_PLATAX(coo) = 2 + SKY_XLAX(coo) = 1 + SKY_YLAX(coo) = 2 + SKY_VXOFF(coo) = 0.0d0 + SKY_VYOFF(coo) = 0.0d0 + SKY_VXSTEP(coo) = 1.0d0 + SKY_VYSTEP(coo) = 1.0d0 + SKY_WTYPE(coo) = 0 + } else { + SKY_NLNGAX(coo) = SKY_NLNGAX(imcoo) + SKY_NLATAX(coo) = SKY_NLATAX(imcoo) + SKY_PLNGAX(coo) = SKY_PLNGAX(imcoo) + SKY_PLATAX(coo) = SKY_PLATAX(imcoo) + SKY_XLAX(coo) = SKY_XLAX(imcoo) + SKY_YLAX(coo) = SKY_YLAX(imcoo) + SKY_VXOFF(coo) = SKY_VXOFF(imcoo) + SKY_VYOFF(coo) = SKY_VYOFF(imcoo) + SKY_VXSTEP(coo) = SKY_VXSTEP(imcoo) + SKY_VYSTEP(coo) = SKY_VYSTEP(imcoo) + SKY_WTYPE(coo) = SKY_WTYPE(imcoo) + } + SKY_PIXTYPE(coo) = PIXTYPE_WORLD + + # Decode the actual wcs. + stat = sk_strwcs (instr, SKY_CTYPE(coo), SKY_RADECSYS(coo), + SKY_EQUINOX(coo), SKY_EPOCH(coo)) + switch (SKY_CTYPE(coo)) { + case CTYPE_EQUATORIAL: + SKY_NLNGUNITS(coo) = SKY_HOURS + SKY_NLATUNITS(coo) = SKY_DEGREES + default: + SKY_NLNGUNITS(coo) = SKY_DEGREES + SKY_NLATUNITS(coo) = SKY_DEGREES + } + + # Decode the image wcs. + } else { + stat = sk_decim (im, Memc[str2], mw, coo) + call imunmap (im) + } + + call sfree (sp) + + SKY_STATUS(coo) = stat + return (stat) +end + + +# SK_DECWSTR -- Decode the wcs string coordinate system, e.g. "J2000" or +# "galactic" into a celestial coordinate structure. ERR is returned if a +# valid celestial coordinate structure cannot be created. + +int procedure sk_decwstr (instr, coo, imcoo) + +char instr[ARB] #I the input wcs string +pointer coo #O the pointer to the coordinate structure +pointer imcoo #I pointer to an existing coordinate structure + +int stat +int sk_strwcs() + +begin + call calloc (coo, LEN_SKYCOOSTRUCT, TY_STRUCT) + call strcpy (instr, SKY_COOSYSTEM(coo), SZ_FNAME) + + # Initialize. + if (imcoo == NULL) { + SKY_NLNGAX(coo) = 2048 + SKY_NLATAX(coo) = 2048 + SKY_PLNGAX(coo) = 1 + SKY_PLATAX(coo) = 2 + SKY_XLAX(coo) = 1 + SKY_YLAX(coo) = 2 + SKY_VXOFF(coo) = 0.0d0 + SKY_VYOFF(coo) = 0.0d0 + SKY_VXSTEP(coo) = 1.0d0 + SKY_VYSTEP(coo) = 1.0d0 + SKY_WTYPE(coo) = 0 + } else { + SKY_NLNGAX(coo) = SKY_NLNGAX(imcoo) + SKY_NLATAX(coo) = SKY_NLATAX(imcoo) + SKY_PLNGAX(coo) = SKY_PLNGAX(imcoo) + SKY_PLATAX(coo) = SKY_PLATAX(imcoo) + SKY_XLAX(coo) = SKY_XLAX(imcoo) + SKY_YLAX(coo) = SKY_YLAX(imcoo) + SKY_VXOFF(coo) = SKY_VXOFF(imcoo) + SKY_VYOFF(coo) = SKY_VYOFF(imcoo) + SKY_VXSTEP(coo) = SKY_VXSTEP(imcoo) + SKY_VYSTEP(coo) = SKY_VYSTEP(imcoo) + SKY_WTYPE(coo) = SKY_WTYPE(imcoo) + } + SKY_PIXTYPE(coo) = PIXTYPE_WORLD + + # Decode the actual wcs. + stat = sk_strwcs (instr, SKY_CTYPE(coo), SKY_RADECSYS(coo), + SKY_EQUINOX(coo), SKY_EPOCH(coo)) + switch (SKY_CTYPE(coo)) { + case CTYPE_EQUATORIAL: + SKY_NLNGUNITS(coo) = SKY_HOURS + SKY_NLATUNITS(coo) = SKY_DEGREES + default: + SKY_NLNGUNITS(coo) = SKY_DEGREES + SKY_NLATUNITS(coo) = SKY_DEGREES + } + + SKY_STATUS(coo) = stat + + return (stat) +end + + +# SK_DECIM -- Given an image descriptor and an image wcs string create a +# celstial coordinate structure. A non-NULL pointer to the image wcs structure +# is also returned. ERR is returned if a valid celestial coordinate descriptor +# cannot be created. + + +int procedure sk_decim (im, wcs, mw, coo) + +pointer im #I the pointer to the input image +char wcs[ARB] #I the wcs string [logical|tv|physical|world] +pointer mw #O the pointer to the image wcs structure +pointer coo #O the pointer to the coordinate structure + +int stat +pointer sp, str1, laxno, paxval +int sk_imwcs(), strdic(), mw_stati() +pointer mw_openim() +errchk mw_openim() + +begin + call malloc (coo, LEN_SKYCOOSTRUCT, TY_STRUCT) + call sprintf (SKY_COOSYSTEM(coo), SZ_FNAME, "%s %s") + call pargstr (IM_HDRFILE(im)) + call pargstr (wcs) + + call smark (sp) + call salloc (str1, SZ_LINE, TY_CHAR) + call salloc (laxno, IM_MAXDIM, TY_INT) + call salloc (paxval, IM_MAXDIM, TY_INT) + + # Try to open the image wcs. + iferr { + mw = mw_openim (im) + + # Set up a dummy wcs. + } then { + + #Initialize. + SKY_CTYPE(coo) = 0 + SKY_RADECSYS(coo) = 0 + SKY_EQUINOX(coo) = INDEFD + SKY_EPOCH(coo) = INDEFD + mw = NULL + SKY_PLNGAX(coo) = 1 + SKY_PLATAX(coo) = 2 + SKY_XLAX(coo) = 1 + SKY_YLAX(coo) = 2 + SKY_NLNGAX(coo) = 2048 + SKY_NLATAX(coo) = 2048 + SKY_VXOFF(coo) = 0.0d0 + SKY_VYOFF(coo) = 0.0d0 + SKY_VXSTEP(coo) = 1.0d0 + SKY_VYSTEP(coo) = 1.0d0 + SKY_WTYPE(coo) = 0 + SKY_PIXTYPE(coo) = PIXTYPE_LOGICAL + SKY_NLNGUNITS(coo) = SKY_DEGREES + SKY_NLATUNITS(coo) = SKY_DEGREES + stat = ERR + + # Decode the wcs. + } else { + SKY_PIXTYPE(coo) = strdic (wcs, Memc[str1], SZ_LINE, PIXTYPE_LIST) + if (SKY_PIXTYPE(coo) <= 0) + SKY_PIXTYPE(coo) = PIXTYPE_LOGICAL + if (sk_imwcs (im, mw, SKY_CTYPE(coo), SKY_PLNGAX(coo), + SKY_PLATAX(coo), SKY_WTYPE(coo), SKY_RADECSYS(coo), + SKY_EQUINOX(coo), SKY_EPOCH(coo)) == OK) { + switch (SKY_CTYPE(coo)) { + case CTYPE_EQUATORIAL: + SKY_NLNGUNITS(coo) = SKY_HOURS + SKY_NLATUNITS(coo) = SKY_DEGREES + default: + SKY_NLNGUNITS(coo) = SKY_DEGREES + SKY_NLATUNITS(coo) = SKY_DEGREES + } + call mw_gaxmap (mw, Memi[laxno], Memi[paxval], mw_stati(mw, + MW_NPHYSDIM)) + if (Memi[laxno+SKY_PLNGAX(coo)-1] < + Memi[laxno+SKY_PLATAX(coo)-1]) { + SKY_XLAX(coo) = Memi[laxno+SKY_PLNGAX(coo)-1] + SKY_YLAX(coo) = Memi[laxno+SKY_PLATAX(coo)-1] + } else { + SKY_XLAX(coo) = Memi[laxno+SKY_PLATAX(coo)-1] + SKY_YLAX(coo) = Memi[laxno+SKY_PLNGAX(coo)-1] + } + if (SKY_XLAX(coo) <= 0 || SKY_YLAX(coo) <= 0) { + SKY_VXOFF(coo) = 0.0d0 + SKY_VYOFF(coo) = 0.0d0 + SKY_VXSTEP(coo) = 1.0d0 + SKY_VYSTEP(coo) = 1.0d0 + SKY_NLNGAX(coo) = 2048 + SKY_NLATAX(coo) = 2048 + stat = ERR + } else { + SKY_VXOFF(coo) = IM_VOFF(im,IM_VMAP(im,SKY_XLAX(coo))) + SKY_VYOFF(coo) = IM_VOFF(im,IM_VMAP(im,SKY_YLAX(coo))) + SKY_VXSTEP(coo) = IM_VSTEP(im,SKY_XLAX(coo)) + SKY_VYSTEP(coo) = IM_VSTEP(im,SKY_YLAX(coo)) + SKY_NLNGAX(coo) = IM_LEN(im,SKY_XLAX(coo)) + SKY_NLATAX(coo) = IM_LEN(im,SKY_YLAX(coo)) + stat = OK + } + } else { + call mw_close (mw) + mw = NULL + SKY_XLAX(coo) = 1 + SKY_YLAX(coo) = 2 + SKY_NLNGAX(coo) = 2048 + SKY_NLATAX(coo) = 2048 + SKY_VXOFF(coo) = 0.0d0 + SKY_VYOFF(coo) = 0.0d0 + SKY_VXSTEP(coo) = 1.0d0 + SKY_VYSTEP(coo) = 1.0d0 + SKY_NLNGUNITS(coo) = SKY_DEGREES + SKY_NLATUNITS(coo) = SKY_DEGREES + stat = ERR + } + } + + call sfree (sp) + + SKY_STATUS(coo) = stat + return (stat) +end + + +# SK_STRWCS -- Decode the sky coordinate system from an input string. +# The string syntax is [ctype] equinox [epoch]. The various options +# have been placed case statements. Although there is considerable +# duplication of code in the case statements, there are minor differences +# and I found it clearer to write it out rather than trying to be +# concise. I might want to clean this up a bit later. + +int procedure sk_strwcs (instr, ctype, radecsys, equinox, epoch) + +char instr[ARB] #I the input wcs string +int ctype #O the output coordinate type +int radecsys #O the output equatorial reference system +double equinox #O the output equinox +double epoch #O the output epoch of the observation + +int ip, nitems, sctype, sradecsys, stat +pointer sp, str1, str2 +int strdic(), nscan(), ctod() +double sl_ej2d(), sl_epb(), sl_eb2d(), sl_epj() + +begin + # Initialize. + ctype = 0 + radecsys = 0 + equinox = INDEFD + epoch = INDEFD + + # Allocate working space. + call smark (sp) + call salloc (str1, SZ_LINE, TY_CHAR) + call salloc (str2, SZ_LINE, TY_CHAR) + + # Determine the coordinate string. + call sscan (instr) + call gargwrd (Memc[str1], SZ_LINE) + + # Return with an error if the string is blank. + if (Memc[str1] == EOS || nscan() < 1) { + call sfree (sp) + return (ERR) + } else + nitems = 1 + + # If the coordinate type is undefined temporarily default it to + # equatorial. + sctype = strdic (Memc[str1], Memc[str2], SZ_LINE, FTYPE_LIST) + if (sctype <= 0) { + ctype = CTYPE_EQUATORIAL + } else { + switch (sctype) { + case FTYPE_FK4: + ctype = CTYPE_EQUATORIAL + radecsys = EQTYPE_FK4 + case FTYPE_FK4NOE: + ctype = CTYPE_EQUATORIAL + radecsys = EQTYPE_FK4NOE + case FTYPE_FK5: + ctype = CTYPE_EQUATORIAL + radecsys = EQTYPE_FK5 + case FTYPE_ICRS: + ctype = CTYPE_EQUATORIAL + radecsys = EQTYPE_ICRS + case FTYPE_GAPPT: + ctype = CTYPE_EQUATORIAL + radecsys = EQTYPE_GAPPT + case FTYPE_ECLIPTIC: + ctype = CTYPE_ECLIPTIC + case FTYPE_GALACTIC: + ctype = CTYPE_GALACTIC + case FTYPE_SUPERGALACTIC: + ctype = CTYPE_SUPERGALACTIC + } + call gargwrd (Memc[str1], SZ_LINE) + if (nscan() > nitems) + nitems = nitems + 1 + } + sctype = ctype + sradecsys = radecsys + + # Decode the coordinate system. + switch (sctype) { + + # Decode the equatorial system, equinox, and epoch. + case CTYPE_EQUATORIAL: + + switch (sradecsys) { + case EQTYPE_FK4, EQTYPE_FK4NOE: + if (Memc[str1] == 'J' || Memc[str1] == 'j' || + Memc[str1] == 'B' || Memc[str1] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str1], ip, equinox) <= 0) + equinox = 1950.0d0 + if (Memc[str1] == 'J' || Memc[str1] == 'j') + equinox = sl_epb (sl_ej2d (equinox)) + + call gargwrd (Memc[str2], SZ_LINE) + if (nscan() <= nitems) + epoch = sl_eb2d (equinox) + else { + if (Memc[str2] == 'J' || Memc[str2] == 'j' || + Memc[str2] == 'B' || Memc[str2] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str2], ip, epoch) <= 0) + epoch = sl_eb2d (equinox) + else if (epoch <= 3000.0d0 && (Memc[str2] == 'J' || + Memc[str2] == 'j')) + epoch = sl_ej2d (epoch) + else if (epoch > 3000.0d0) + epoch = epoch - 2400000.5d0 + else + epoch = sl_eb2d (epoch) + } + + case EQTYPE_FK5, EQTYPE_ICRS: + if (Memc[str1] == 'J' || Memc[str1] == 'j' || + Memc[str1] == 'B' || Memc[str1] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str1], ip, equinox) <= 0) + equinox = 2000.0d0 + if (Memc[str1] == 'B' || Memc[str1] == 'b') + equinox = sl_epj(sl_eb2d (equinox)) + + call gargwrd (Memc[str2], SZ_LINE) + if (nscan() <= nitems) + epoch = sl_ej2d (equinox) + else { + if (Memc[str2] == 'J' || Memc[str2] == 'j' || + Memc[str2] == 'B' || Memc[str2] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str2], ip, epoch) <= 0) + epoch = sl_ej2d (equinox) + else if (epoch <= 3000.0d0 && (Memc[str2] == 'B' || + Memc[str2] == 'b')) + epoch = sl_eb2d (epoch) + else if (epoch > 3000.0d0) + epoch = epoch - 2400000.5d0 + else + epoch = sl_ej2d (epoch) + } + + case EQTYPE_GAPPT: + equinox = 2000.0d0 + if (Memc[str1] == 'J' || Memc[str1] == 'j' || + Memc[str1] == 'B' || Memc[str1] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str1], ip, epoch) <= 0) { + epoch = INDEFD + } else if (epoch <= 3000.0d0) { + if (Memc[str1] == 'B' || Memc[str1] == 'b') + epoch = sl_eb2d (epoch) + else if (Memc[str1] == 'J' || Memc[str1] == 'j') + epoch = sl_ej2d (epoch) + else if (epoch < 1984.0d0) + epoch = sl_eb2d (epoch) + else + epoch = sl_ej2d (epoch) + } else { + epoch = epoch - 2400000.5d0 + } + + default: + ip = 1 + if (Memc[str1] == 'B' || Memc[str1] == 'b') { + radecsys = EQTYPE_FK4 + ip = ip + 1 + if (ctod (Memc[str1], ip, equinox) <= 0) + equinox = 1950.0d0 + + call gargwrd (Memc[str2], SZ_LINE) + if (nscan() <= nitems) + epoch = sl_eb2d (equinox) + else { + if (Memc[str2] == 'J' || Memc[str2] == 'j') + ip = 2 + else if (Memc[str2] == 'B' || Memc[str2] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str2], ip, epoch) <= 0) + epoch = sl_eb2d (equinox) + else if (epoch <= 3000.0d0 && (Memc[str2] == 'J' || + Memc[str2] == 'j')) + epoch = sl_ej2d (epoch) + else if (epoch > 3000.0d0) + epoch = epoch - 2400000.5d0 + else + epoch = sl_eb2d (epoch) + } + + } else if (Memc[str1] == 'J' || Memc[str1] == 'j') { + radecsys = EQTYPE_FK5 + ip = ip + 1 + if (ctod (Memc[str1], ip, equinox) <= 0) + equinox = 2000.0d0 + + call gargwrd (Memc[str2], SZ_LINE) + if (nscan() <= nitems) + epoch = sl_ej2d (equinox) + else { + if (Memc[str2] == 'J' || Memc[str2] == 'j' || + Memc[str2] == 'B' || Memc[str2] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str2], ip, epoch) <= 0) + epoch = sl_ej2d (equinox) + else if (epoch <= 3000.0d0 && (Memc[str2] == 'B' || + Memc[str2] == 'b')) + epoch = sl_eb2d (epoch) + else if (epoch > 3000.0d0) + epoch = epoch - 2400000.5d0 + else + epoch = sl_ej2d (epoch) + } + + } else if (ctod (Memc[str1], ip, equinox) <= 0) { + ctype = 0 + radecsys = 0 + equinox = INDEFD + epoch = INDEFD + + } else if (equinox < 1984.0d0) { + radecsys = EQTYPE_FK4 + call gargwrd (Memc[str2], SZ_LINE) + if (nscan() <= nitems) + epoch = sl_eb2d (equinox) + else { + if (Memc[str2] == 'J' || Memc[str2] == 'j' || + Memc[str2] == 'B' || Memc[str2] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str2], ip, epoch) <= 0) + epoch = sl_eb2d (equinox) + else if (epoch <= 3000.0d0 && (Memc[str2] == 'J' || + Memc[str2] == 'j')) + epoch = sl_ej2d (epoch) + else if (epoch > 3000.0d0) + epoch = epoch - 2400000.5d0 + else + epoch = sl_eb2d (epoch) + } + + } else { + radecsys = EQTYPE_FK5 + call gargwrd (Memc[str2], SZ_LINE) + if (nscan() <= nitems) + epoch = sl_ej2d (equinox) + else { + if (Memc[str2] == 'J' || Memc[str2] == 'j' || + Memc[str2] == 'B' || Memc[str2] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str2], ip, epoch) <= 0) + epoch = sl_ej2d (equinox) + else if (epoch <= 3000.0d0 && (Memc[str2] == 'B' || + Memc[str2] == 'b')) + epoch = sl_eb2d (epoch) + else if (epoch > 3000.0d0) + epoch = epoch - 2400000.5d0 + else + epoch = sl_ej2d (epoch) + } + } + } + + # Decode the ecliptic coordinate system. + case CTYPE_ECLIPTIC: + if (Memc[str1] == 'J' || Memc[str1] == 'j' || + Memc[str1] == 'B' || Memc[str1] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str1], ip, epoch) <= 0) { + epoch = INDEFD + } else if (epoch <= 3000.0d0) { + if (Memc[str1] == 'B' || Memc[str1] == 'b') + epoch = sl_eb2d (epoch) + else if (Memc[str1] == 'J' || Memc[str1] == 'j') + epoch = sl_ej2d (epoch) + else if (epoch < 1984.0d0) + epoch = sl_eb2d (epoch) + else + epoch = sl_ej2d (epoch) + } else { + epoch = epoch - 2400000.5d0 + } + + # Decode the galactic and supergalactic coordinate system. + case CTYPE_GALACTIC, CTYPE_SUPERGALACTIC: + if (Memc[str1] == 'J' || Memc[str1] == 'j' || + Memc[str1] == 'B' || Memc[str1] == 'b') + ip = 2 + else + ip = 1 + if (ctod (Memc[str1], ip, epoch) <= 0) { + epoch = sl_eb2d (1950.0d0) + } else if (epoch <= 3000.0d0) { + if (Memc[str1] == 'J' || Memc[str1] == 'j') + epoch = sl_ej2d (epoch) + else if (Memc[str1] == 'B' || Memc[str1] == 'b') + epoch = sl_eb2d (epoch) + else if (epoch < 1984.0d0) + epoch = sl_eb2d (epoch) + else + epoch = sl_ej2d (epoch) + } else { + epoch = epoch - 2400000.5d0 + } + } + + # Return the appropriate error status. + if (ctype == 0) + stat = ERR + else if (ctype == CTYPE_EQUATORIAL && (radecsys == 0 || + IS_INDEFD(equinox) || IS_INDEFD(epoch))) + stat = ERR + else if (ctype == CTYPE_ECLIPTIC && IS_INDEFD(epoch)) + stat = ERR + else + stat = OK + + call sfree (sp) + + return (stat) +end + + +# SK_IMWCS -- Decode the sky coordinate system of the image. Return +# an error if the sky coordinate system is not one of the supported types +# or required information is missing from the image header. + +int procedure sk_imwcs (im, mw, ctype, lngax, latax, wtype, radecsys, + equinox, epoch) + +pointer im #I the image pointer +pointer mw #I pointer to the world coordinate system +int ctype #O the output coordinate type +int lngax #O the output ra/glon/elon axis +int latax #O the output dec/glat/elat axis +int wtype #O the output projection type +int radecsys #O the output equatorial reference system +double equinox #O the output equinox +double epoch #O the output epoch of the observation + +int i, ndim, axtype, day, month, year, ier, oldfits +pointer sp, atval +double hours +double imgetd(), sl_eb2d(), sl_ej2d() +int mw_stati(), strdic(), dtm_decode() +errchk mw_gwattrs(), imgstr(), imgetd() + +begin + call smark (sp) + call salloc (atval, SZ_LINE, TY_CHAR) + + # Initialize + ctype = 0 + lngax = 0 + latax = 0 + wtype = 0 + radecsys = 0 + equinox = INDEFD + epoch = INDEFD + + # Determine the sky coordinate system of the image. + ndim = mw_stati (mw, MW_NPHYSDIM) + do i = 1, ndim { + iferr (call mw_gwattrs (mw, i, "axtype", Memc[atval], SZ_LINE)) + call strcpy ("INDEF", Memc[atval], SZ_LINE) + axtype = strdic (Memc[atval], Memc[atval], SZ_LINE, AXTYPE_LIST) + switch (axtype) { + case AXTYPE_RA, AXTYPE_DEC: + ctype = CTYPE_EQUATORIAL + case AXTYPE_ELON, AXTYPE_ELAT: + ctype = CTYPE_ECLIPTIC + case AXTYPE_GLON, AXTYPE_GLAT: + ctype = CTYPE_GALACTIC + case AXTYPE_SLON, AXTYPE_SLAT: + ctype = CTYPE_SUPERGALACTIC + default: + ; + } + switch (axtype) { + case AXTYPE_RA, AXTYPE_ELON, AXTYPE_GLON, AXTYPE_SLON: + lngax = i + case AXTYPE_DEC, AXTYPE_ELAT, AXTYPE_GLAT, AXTYPE_SLAT: + latax = i + default: + ; + } + } + + # Return if the sky coordinate system cannot be decoded. + if (ctype == 0 || lngax == 0 || latax == 0) { + call sfree (sp) + return (ERR) + } + + # Decode the sky projection. + iferr { + call mw_gwattrs (mw, lngax, "wtype", Memc[atval], SZ_LINE) + } then { + iferr (call mw_gwattrs(mw, latax, "wtype", Memc[atval], SZ_LINE)) + call strcpy ("linear", Memc[atval], SZ_LINE) + } + wtype = strdic (Memc[atval], Memc[atval], SZ_LINE, WTYPE_LIST) + + # Return if the sky projection system is not supported. + if (wtype == 0) { + call sfree (sp) + return (ERR) + } + + # Determine the RA/DEC system and equinox. + if (ctype == CTYPE_EQUATORIAL) { + + # Get the equinox of the coordinate system. The EQUINOX keyword + # takes precedence over EPOCH. + iferr { + equinox = imgetd (im, "EQUINOX") + } then { + iferr { + equinox = imgetd (im, "EPOCH") + } then { + equinox = INDEFD + } + } + + # Determine which equatorial system will be used. The default + # is FK4 if equinox < 1984.0, FK5 if equinox is >= 1984. + iferr { + call imgstr (im, "RADECSYS", Memc[atval], SZ_LINE) + } then { + radecsys = 0 + } else { + call strlwr (Memc[atval]) + radecsys = strdic (Memc[atval], Memc[atval], SZ_LINE, + EQTYPE_LIST) + } + if (radecsys == 0) { + if (IS_INDEFD(equinox)) + radecsys = EQTYPE_FK5 + else if (equinox < 1984.0d0) + radecsys = EQTYPE_FK4 + else + radecsys = EQTYPE_FK5 + } + + # Get the MJD of the observation. If there is no MJD in the + # header use the DATE_OBS keyword value and transform it to + # an MJD. + iferr { + epoch = imgetd (im, "MJD-WCS") + } then { + iferr { + epoch = imgetd (im, "MJD-OBS") + } then { + iferr { + call imgstr (im, "DATE-OBS", Memc[atval], SZ_LINE) + } then { + epoch = INDEFD + } else if (dtm_decode (Memc[atval], year, month, day, + hours, oldfits) == OK) { + call sl_cadj (year, month, day, epoch, ier) + if (ier != 0) + epoch = INDEFD + else if (! IS_INDEFD(hours) && hours >= 0.0d0 && + hours <= 24.0d0) + epoch = epoch + hours / 24.0d0 + } else + epoch = INDEFD + } + } + + # Set the default equinox and epoch appropriate for each + # equatorial system if these are undefined. + switch (radecsys) { + case EQTYPE_FK4, EQTYPE_FK4NOE: + if (IS_INDEFD(equinox)) + equinox = 1950.0d0 + if (IS_INDEFD(epoch)) + epoch = sl_eb2d (1950.0d0) + case EQTYPE_FK5, EQTYPE_ICRS: + if (IS_INDEFD(equinox)) + equinox = 2000.0d0 + if (IS_INDEFD(epoch)) + epoch = sl_ej2d (2000.0d0) + case EQTYPE_GAPPT: + equinox = 2000.0d0 + ; + } + + # Return if the epoch is undefined. This can only occur if + # the equatorial coordinate system is GAPPT and there is NO + # epoch of observation in the image header. + if (IS_INDEFD(epoch)) { + call sfree (sp) + return (ERR) + } + } + + # Get the MJD of the observation. If there is no MJD in the + # header use the DATE_OBS keyword value and transform it to + # an MJD. + if (ctype == CTYPE_ECLIPTIC) { + + iferr { + epoch = imgetd (im, "MJD-WCS") + } then { + iferr { + epoch = imgetd (im, "MJD-OBS") + } then { + iferr { + call imgstr (im, "DATE-OBS", Memc[atval], SZ_LINE) + } then { + epoch = INDEFD + } else if (dtm_decode (Memc[atval], year, month, day, + hours, oldfits) == OK) { + call sl_cadj (year, month, day, epoch, ier) + if (ier != 0) + epoch = INDEFD + else if (! IS_INDEFD(hours) && hours >= 0.0d0 && + hours <= 24.0d0) + epoch = epoch + hours / 24.0d0 + } else + epoch = INDEFD + } + } + + # Return if the epoch is undefined. + if (IS_INDEFD(epoch)) { + call sfree (sp) + return (ERR) + } + } + + if (ctype == CTYPE_GALACTIC || ctype == CTYPE_SUPERGALACTIC) { + + # Get the MJD of the observation. If there is no MJD in the + # header use the DATE_OBS keyword value and transform it to + # an MJD. + iferr { + epoch = imgetd (im, "MJD-WCS") + } then { + iferr { + epoch = imgetd (im, "MJD-OBS") + } then { + iferr { + call imgstr (im, "DATE-OBS", Memc[atval], SZ_LINE) + } then { + epoch = sl_eb2d (1950.0d0) + } else if (dtm_decode (Memc[atval], year, month, day, + hours, oldfits) == OK) { + call sl_cadj (year, month, day, epoch, ier) + if (ier != 0) + epoch = sl_eb2d (1950.0d0) + else { + if (! IS_INDEFD(hours) && hours >= 0.0d0 && + hours <= 24.0d0) + epoch = epoch + hours / 24.0d0 + #if (epoch < 1984.0d0) + #epoch = sl_eb2d (epoch) + #else + #epoch = sl_ej2d (epoch) + } + } else + epoch = sl_eb2d (1950.0d0) + } + } + } + + call sfree (sp) + + return (OK) +end + + +# SK_ENWCS -- Encode the celestial wcs system. + +procedure sk_enwcs (coo, wcsstr, maxch) + +pointer coo #I the celestial coordinate system descriptor +char wcsstr[ARB] #O the output wcs string +int maxch #I the size of the output string + +double sk_statd(), sl_epj(), sl_epb() +int sk_stati() + +begin + switch (sk_stati (coo, S_CTYPE)) { + + case CTYPE_EQUATORIAL: + + switch (sk_stati(coo, S_RADECSYS)) { + + case EQTYPE_GAPPT: + if (IS_INDEFD(sk_statd(coo, S_EPOCH))) { + call sprintf (wcsstr, maxch, "apparent") + } else { + call sprintf (wcsstr, maxch, "apparent J%0.8f") + call pargd (sl_epj(sk_statd(coo, S_EPOCH))) + } + + case EQTYPE_FK5: + call sprintf (wcsstr, maxch, "fk5 J%0.3f J%0.8f") + call pargd (sk_statd(coo, S_EQUINOX)) + call pargd (sl_epj(sk_statd(coo, S_EPOCH))) + + case EQTYPE_ICRS: + call sprintf (wcsstr, maxch, "icrs J%0.3f J%0.8f") + call pargd (sk_statd(coo, S_EQUINOX)) + call pargd (sl_epj(sk_statd(coo, S_EPOCH))) + + case EQTYPE_FK4: + call sprintf (wcsstr, maxch, "fk4 B%0.3f B%0.8f") + call pargd (sk_statd(coo, S_EQUINOX)) + call pargd (sl_epb(sk_statd(coo, S_EPOCH))) + + case EQTYPE_FK4NOE: + call sprintf (wcsstr, maxch, "fk4noe B%0.3f B%0.8f") + call pargd (sk_statd(coo, S_EQUINOX)) + call pargd (sl_epb(sk_statd(coo, S_EPOCH))) + + default: + wcsstr[1] = EOS + } + + case CTYPE_ECLIPTIC: + if (IS_INDEFD(sk_statd(coo, S_EPOCH))) { + call sprintf (wcsstr, maxch, "ecliptic") + } else { + call sprintf (wcsstr, maxch, "ecliptic J%0.8f") + call pargd (sl_epj(sk_statd(coo, S_EPOCH))) + } + + case CTYPE_GALACTIC: + call sprintf (wcsstr, maxch, "galactic J%0.8f") + call pargd (sl_epj(sk_statd(coo, S_EPOCH))) + + case CTYPE_SUPERGALACTIC: + call sprintf (wcsstr, maxch, "supergalactic j%0.8f") + call pargd (sl_epj(sk_statd(coo, S_EPOCH))) + } +end + + +# SK_COPY -- Copy the coodinate structure. + +pointer procedure sk_copy (cooin) + +pointer cooin #I the pointer to the input structure + +pointer cooout + +begin + if (cooin == NULL) + cooout = NULL + else { + call calloc (cooout, LEN_SKYCOOSTRUCT, TY_STRUCT) + SKY_VXOFF(cooout) = SKY_VXOFF(cooin) + SKY_VYOFF(cooout) = SKY_VYOFF(cooin) + SKY_VXSTEP(cooout) = SKY_VXSTEP(cooin) + SKY_VYSTEP(cooout) = SKY_VYSTEP(cooin) + SKY_EQUINOX(cooout) = SKY_EQUINOX(cooin) + SKY_EPOCH(cooout) = SKY_EPOCH(cooin) + SKY_CTYPE(cooout) = SKY_CTYPE(cooin) + SKY_RADECSYS(cooout) = SKY_RADECSYS(cooin) + SKY_WTYPE(cooout) = SKY_WTYPE(cooin) + SKY_PLNGAX(cooout) = SKY_PLNGAX(cooin) + SKY_PLATAX(cooout) = SKY_PLATAX(cooin) + SKY_XLAX(cooout) = SKY_XLAX(cooin) + SKY_YLAX(cooout) = SKY_YLAX(cooin) + SKY_PIXTYPE(cooout) = SKY_PIXTYPE(cooin) + SKY_NLNGAX(cooout) = SKY_NLNGAX(cooin) + SKY_NLATAX(cooout) = SKY_NLATAX(cooin) + SKY_NLNGUNITS(cooout) = SKY_NLNGUNITS(cooin) + SKY_NLATUNITS(cooout) = SKY_NLATUNITS(cooin) + call strcpy (SKY_COOSYSTEM(cooin), SKY_COOSYSTEM(cooout), + SZ_FNAME) + } + + return (cooout) +end + + +# SK_CLOSE -- Free the coordinate structure. + +procedure sk_close (coo) + +pointer coo #U the input coordinate structure + +begin + if (coo != NULL) + call mfree (coo, TY_STRUCT) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.f new file mode 100644 index 00000000..63e39d30 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.f @@ -0,0 +1,363 @@ + subroutine sksavm (coo, mw, im) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer mw + integer im + logical xerpop + logical xerflg + common /xercom/ xerflg + integer sw0001,sw0002 + integer*2 st0001(7) + integer*2 st0002(3) + integer*2 st0003(7) + integer*2 st0004(4) + integer*2 st0005(9) + integer*2 st0006(4) + integer*2 st0007(8) + integer*2 st0008(8) + integer*2 st0009(9) + integer*2 st0010(7) + integer*2 st0011(8) + integer*2 st0012(8) + integer*2 st0013(9) + integer*2 st0014(4) + integer*2 st0015(8) + integer*2 st0016(8) + integer*2 st0017(9) + integer*2 st0018(5) + integer*2 st0019(8) + integer*2 st0020(8) + integer*2 st0021(9) + integer*2 st0022(6) + integer*2 st0023(8) + integer*2 st0024(8) + integer*2 st0025(7) + integer*2 st0026(5) + integer*2 st0027(7) + integer*2 st0028(5) + integer*2 st0029(9) + integer*2 st0030(8) + integer*2 st0031(8) + integer*2 st0032(7) + integer*2 st0033(5) + integer*2 st0034(7) + integer*2 st0035(5) + integer*2 st0036(9) + integer*2 st0037(8) + integer*2 st0038(8) + integer*2 st0039(7) + integer*2 st0040(5) + integer*2 st0041(7) + integer*2 st0042(5) + integer*2 st0043(9) + integer*2 st0044(8) + integer*2 st0045(8) + save + integer iyy + data st0001 / 97,120,116,121,112,101, 0/ + data st0002 /114, 97, 0/ + data st0003 / 97,120,116,121,112,101, 0/ + data st0004 /100,101, 99, 0/ + data (st0005(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0005(iyy),iyy= 9, 9) / 0/ + data st0006 / 70, 75, 52, 0/ + data st0007 /101,113,117,105,110,111,120, 0/ + data st0008 /109,106,100, 45,119, 99,115, 0/ + data (st0009(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0009(iyy),iyy= 9, 9) / 0/ + data st0010 / 70, 75, 52, 78, 79, 69, 0/ + data st0011 /101,113,117,105,110,111,120, 0/ + data st0012 /109,106,100, 45,119, 99,115, 0/ + data (st0013(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0013(iyy),iyy= 9, 9) / 0/ + data st0014 / 70, 75, 53, 0/ + data st0015 /101,113,117,105,110,111,120, 0/ + data st0016 /109,106,100, 45,119, 99,115, 0/ + data (st0017(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0017(iyy),iyy= 9, 9) / 0/ + data st0018 / 73, 67, 82, 83, 0/ + data st0019 /101,113,117,105,110,111,120, 0/ + data st0020 /109,106,100, 45,119, 99,115, 0/ + data (st0021(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0021(iyy),iyy= 9, 9) / 0/ + data st0022 / 71, 65, 80, 80, 84, 0/ + data st0023 /101,113,117,105,110,111,120, 0/ + data st0024 /109,106,100, 45,119, 99,115, 0/ + data st0025 / 97,120,116,121,112,101, 0/ + data st0026 /101,108,111,110, 0/ + data st0027 / 97,120,116,121,112,101, 0/ + data st0028 /101,108, 97,116, 0/ + data (st0029(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0029(iyy),iyy= 9, 9) / 0/ + data st0030 /101,113,117,105,110,111,120, 0/ + data st0031 /109,106,100, 45,119, 99,115, 0/ + data st0032 / 97,120,116,121,112,101, 0/ + data st0033 /103,108,111,110, 0/ + data st0034 / 97,120,116,121,112,101, 0/ + data st0035 /103,108, 97,116, 0/ + data (st0036(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0036(iyy),iyy= 9, 9) / 0/ + data st0037 /101,113,117,105,110,111,120, 0/ + data st0038 /109,106,100, 45,119, 99,115, 0/ + data st0039 / 97,120,116,121,112,101, 0/ + data st0040 /115,108,111,110, 0/ + data st0041 / 97,120,116,121,112,101, 0/ + data st0042 /115,108, 97,116, 0/ + data (st0043(iyy),iyy= 1, 8) /114, 97,100,101, 99,115,121,115/ + data (st0043(iyy),iyy= 9, 9) / 0/ + data st0044 /101,113,117,105,110,111,120, 0/ + data st0045 /109,106,100, 45,119, 99,115, 0/ + sw0001=(memi(coo+12) ) + goto 110 +120 continue + call mwswas (mw, memi(coo+15) , st0001, st0002) + call mwswas (mw, memi(coo+16) , st0003, st0004) + sw0002=(memi(coo+13) ) + goto 130 +140 continue + call imastr (im, st0005, st0006) + call imaddd (im, st0007, memd((((coo+8)-1)/2+1)) ) + call imaddd (im, st0008, memd((((coo+10)-1)/2+1)) ) + goto 131 +150 continue + call imastr (im, st0009, st0010) + call imaddd (im, st0011, memd((((coo+8)-1)/2+1)) ) + call imaddd (im, st0012, memd((((coo+10)-1)/2+1)) ) + goto 131 +160 continue + call imastr (im, st0013, st0014) + call imaddd (im, st0015, memd((((coo+8)-1)/2+1)) ) + call xerpsh + call imdelf (im, st0016) + if (.not.xerpop()) goto 170 +170 continue + goto 131 +180 continue + call imastr (im, st0017, st0018) + call imaddd (im, st0019, memd((((coo+8)-1)/2+1)) ) + call xerpsh + call imdelf (im, st0020) + if (.not.xerpop()) goto 190 +190 continue + goto 131 +200 continue + call imastr (im, st0021, st0022) + call xerpsh + call imdelf (im, st0023) + if (.not.xerpop()) goto 210 +210 continue + call imaddd (im, st0024, memd((((coo+10)-1)/2+1)) ) + goto 131 +130 continue + if (sw0002.lt.1.or.sw0002.gt.5) goto 131 + goto (140,150,160,180,200),sw0002 +131 continue + goto 111 +220 continue + call mwswas (mw, memi(coo+15) , st0025, st0026) + call mwswas (mw, memi(coo+16) , st0027, st0028) + call xerpsh + call imdelf (im, st0029) + if (.not.xerpop()) goto 230 +230 continue + call xerpsh + call imdelf (im, st0030) + if (.not.xerpop()) goto 240 +240 continue + call imaddd (im, st0031, memd((((coo+10)-1)/2+1)) ) + goto 111 +250 continue + call mwswas (mw, memi(coo+15) , st0032, st0033) + call mwswas (mw, memi(coo+16) , st0034, st0035) + call xerpsh + call imdelf (im, st0036) + if (.not.xerpop()) goto 260 +260 continue + call xerpsh + call imdelf (im, st0037) + if (.not.xerpop()) goto 270 +270 continue + call xerpsh + call imdelf (im, st0038) + if (.not.xerpop()) goto 280 +280 continue + goto 111 +290 continue + call mwswas (mw, memi(coo+15) , st0039, st0040) + call mwswas (mw, memi(coo+16) , st0041, st0042) + call xerpsh + call imdelf (im, st0043) + if (.not.xerpop()) goto 300 +300 continue + call xerpsh + call imdelf (im, st0044) + if (.not.xerpop()) goto 310 +310 continue + call xerpsh + call imdelf (im, st0045) + if (.not.xerpop()) goto 320 +320 continue + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 111 + goto (120,220,250,290),sw0001 +111 continue +100 return + end + subroutine skctym (coo, im) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer im + integer sp + integer wtype + integer key1 + integer key2 + integer attr + integer skwrdr + integer sw0001 + integer*2 st0001(8) + integer*2 st0002(8) + integer*2 st0003(7) + integer*2 st0004(7) + integer*2 st0005(114) + integer*2 st0006(4) + integer*2 st0007(9) + integer*2 st0008(9) + integer*2 st0009(9) + integer*2 st0010(9) + integer*2 st0011(9) + integer*2 st0012(9) + integer*2 st0013(9) + integer*2 st0014(9) + integer*2 st0015(7) + integer*2 st0016(7) + save + integer iyy + data st0001 / 67, 84, 89, 80, 69, 37,100, 0/ + data st0002 / 67, 84, 89, 80, 69, 37,100, 0/ + data st0003 / 76, 73, 78, 69, 65, 82, 0/ + data st0004 / 76, 73, 78, 69, 65, 82, 0/ + data (st0005(iyy),iyy= 1, 8) /124,108,105,110,124, 97,122,112/ + data (st0005(iyy),iyy= 9,16) /124,116, 97,110,124,115,105,110/ + data (st0005(iyy),iyy=17,24) /124,115,116,103,124, 97,114, 99/ + data (st0005(iyy),iyy=25,32) /124,122,112,110,124,122,101, 97/ + data (st0005(iyy),iyy=33,40) /124, 97,105,114,124, 99,121,112/ + data (st0005(iyy),iyy=41,48) /124, 99, 97,114,124,109,101,114/ + data (st0005(iyy),iyy=49,56) /124, 99,101, 97,124, 99,111,112/ + data (st0005(iyy),iyy=57,64) /124, 99,111,100,124, 99,111,101/ + data (st0005(iyy),iyy=65,72) /124, 99,111,111,124, 98,111,110/ + data (st0005(iyy),iyy=73,80) /124,112, 99,111,124,103,108,115/ + data (st0005(iyy),iyy=81,88) /124,112, 97,114,124, 97,105,116/ + data (st0005(iyy),iyy=89,96) /124,109,111,108,124, 99,115, 99/ + data (st0005(iyy),iyy=97,104) /124,113,115, 99,124,116,115, 99/ + data (st0005(iyy),iyy=105,112) /124,116,110,120,124,122,112,120/ + data (st0005(iyy),iyy=113,114) /124, 0/ + data st0006 /116, 97,110, 0/ + data (st0007(iyy),iyy= 1, 8) / 82, 65, 45, 45, 45, 37, 51,115/ + data (st0007(iyy),iyy= 9, 9) / 0/ + data (st0008(iyy),iyy= 1, 8) / 68, 69, 67, 45, 45, 37, 51,115/ + data (st0008(iyy),iyy= 9, 9) / 0/ + data (st0009(iyy),iyy= 1, 8) / 69, 76, 79, 78, 45, 37, 51,115/ + data (st0009(iyy),iyy= 9, 9) / 0/ + data (st0010(iyy),iyy= 1, 8) / 69, 76, 65, 84, 45, 37, 51,115/ + data (st0010(iyy),iyy= 9, 9) / 0/ + data (st0011(iyy),iyy= 1, 8) / 71, 76, 79, 78, 45, 37, 51,115/ + data (st0011(iyy),iyy= 9, 9) / 0/ + data (st0012(iyy),iyy= 1, 8) / 71, 76, 65, 84, 45, 37, 51,115/ + data (st0012(iyy),iyy= 9, 9) / 0/ + data (st0013(iyy),iyy= 1, 8) / 83, 76, 79, 78, 45, 37, 51,115/ + data (st0013(iyy),iyy= 9, 9) / 0/ + data (st0014(iyy),iyy= 1, 8) / 83, 76, 65, 84, 45, 37, 51,115/ + data (st0014(iyy),iyy= 9, 9) / 0/ + data st0015 / 76, 73, 78, 69, 65, 82, 0/ + data st0016 / 76, 73, 78, 69, 65, 82, 0/ + call smark (sp) + call salloc (key1, 8, 2) + call salloc (key2, 8, 2) + call salloc (wtype, 3, 2) + call salloc (attr, 8, 2) + call sprinf (memc(key1), 8, st0001) + call pargi (memi(coo+15) ) + call sprinf (memc(key2), 8, st0002) + call pargi (memi(coo+16) ) + if (.not.(memi(coo+14) .le. 0 .or. memi(coo+14) .eq. 1)) goto + * 110 + call imastr (im, memc(key1), st0003) + call imastr (im, memc(key2), st0004) + call sfree (sp) + goto 100 +110 continue + if (.not.(skwrdr (memi(coo+14) , memc(wtype), 3, st0005) .le. 0 + * )) goto 120 + call xstrcy(st0006, memc(wtype), 3) +120 continue + call strupr (memc(wtype)) + sw0001=(memi(coo+12) ) + goto 130 +140 continue + call sprinf (memc(attr), 8, st0007) + call pargsr (memc(wtype)) + call imastr (im, memc(key1), memc(attr)) + call sprinf (memc(attr), 8, st0008) + call pargsr (memc(wtype)) + call imastr (im, memc(key2), memc(attr)) + goto 131 +150 continue + call sprinf (memc(attr), 8, st0009) + call pargsr (memc(wtype)) + call imastr (im, memc(key1), memc(attr)) + call sprinf (memc(attr), 8, st0010) + call pargsr (memc(wtype)) + call imastr (im, memc(key2), memc(attr)) + goto 131 +160 continue + call sprinf (memc(attr), 8, st0011) + call pargsr (memc(wtype)) + call imastr (im, memc(key1), memc(attr)) + call sprinf (memc(attr), 8, st0012) + call pargsr (memc(wtype)) + call imastr (im, memc(key2), memc(attr)) + goto 131 +170 continue + call sprinf (memc(attr), 8, st0013) + call pargsr (memc(wtype)) + call imastr (im, memc(key1), memc(attr)) + call sprinf (memc(attr), 8, st0014) + call pargsr (memc(wtype)) + call imastr (im, memc(key2), memc(attr)) + goto 131 +180 continue + call imastr (im, memc(key1), st0015) + call imastr (im, memc(key2), st0016) + goto 131 +130 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 180 + goto (140,150,160,170),sw0001 +131 continue + call sfree (sp) +100 return + end +c sprinf sprintf +c skctym sk_ctypeim +c skwrdr sk_wrdstr +c sksavm sk_saveim +c mwswas mw_swattrs +c pargsr pargstr diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.x new file mode 100644 index 00000000..77b5a1d9 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sksaveim.x @@ -0,0 +1,157 @@ +include "skywcsdef.h" +include "skywcs.h" + +# SK_SAVEIM -- Update the image header keywords that describe the +# fundamental coordinate system, CTYPE, RADECSYS, EQUINOX (EPOCH), and +# MJD-WCS. + +procedure sk_saveim (coo, mw, im) + +pointer coo #I pointer to the coordinate structure +pointer mw #I pointer to the mwcs structure +pointer im #I image descriptor + +errchk imdelf() + +begin + # Move all this to a separate routine + switch (SKY_CTYPE(coo)) { + + case CTYPE_EQUATORIAL: + call mw_swattrs (mw, SKY_PLNGAX(coo), "axtype", "ra") + call mw_swattrs (mw, SKY_PLATAX(coo), "axtype", "dec") + switch (SKY_RADECSYS(coo)) { + case EQTYPE_FK4: + call imastr (im, "radecsys", "FK4") + call imaddd (im, "equinox", SKY_EQUINOX(coo)) + call imaddd (im, "mjd-wcs", SKY_EPOCH(coo)) + case EQTYPE_FK4NOE: + call imastr (im, "radecsys", "FK4NOE") + call imaddd (im, "equinox", SKY_EQUINOX(coo)) + call imaddd (im, "mjd-wcs", SKY_EPOCH(coo)) + case EQTYPE_FK5: + call imastr (im, "radecsys", "FK5") + call imaddd (im, "equinox", SKY_EQUINOX(coo)) + iferr (call imdelf (im, "mjd-wcs")) + ; + case EQTYPE_ICRS: + call imastr (im, "radecsys", "ICRS") + call imaddd (im, "equinox", SKY_EQUINOX(coo)) + iferr (call imdelf (im, "mjd-wcs")) + ; + case EQTYPE_GAPPT: + call imastr (im, "radecsys", "GAPPT") + iferr (call imdelf (im, "equinox")) + ; + call imaddd (im, "mjd-wcs", SKY_EPOCH(coo)) + } + + case CTYPE_ECLIPTIC: + call mw_swattrs (mw, SKY_PLNGAX(coo), "axtype", "elon") + call mw_swattrs (mw, SKY_PLATAX(coo), "axtype", "elat") + iferr (call imdelf (im, "radecsys")) + ; + iferr (call imdelf (im, "equinox")) + ; + call imaddd (im, "mjd-wcs", SKY_EPOCH(coo)) + + case CTYPE_GALACTIC: + call mw_swattrs (mw, SKY_PLNGAX(coo), "axtype", "glon") + call mw_swattrs (mw, SKY_PLATAX(coo), "axtype", "glat") + iferr (call imdelf (im, "radecsys")) + ; + iferr (call imdelf (im, "equinox")) + ; + iferr (call imdelf (im, "mjd-wcs")) + ; + + case CTYPE_SUPERGALACTIC: + call mw_swattrs (mw, SKY_PLNGAX(coo), "axtype", "slon") + call mw_swattrs (mw, SKY_PLATAX(coo), "axtype", "slat") + iferr (call imdelf (im, "radecsys")) + ; + iferr (call imdelf (im, "equinox")) + ; + iferr (call imdelf (im, "mjd-wcs")) + ; + } +end + + +# SK_CTYPEIM -- Modify the CTYPE keywords appropriately. This step will +# become unnecessary when MWCS is updated to deal with non-equatorial celestial +# coordinate systems. + +procedure sk_ctypeim (coo, im) + +pointer coo #I pointer to the coordinate structure +pointer im #I image descriptor + +pointer sp, wtype, key1, key2, attr +int sk_wrdstr() + +begin + call smark (sp) + call salloc (key1, 8, TY_CHAR) + call salloc (key2, 8, TY_CHAR) + call salloc (wtype, 3, TY_CHAR) + call salloc (attr, 8, TY_CHAR) + + call sprintf (Memc[key1], 8, "CTYPE%d") + call pargi (SKY_PLNGAX(coo)) + call sprintf (Memc[key2], 8, "CTYPE%d") + call pargi (SKY_PLATAX(coo)) + + if (SKY_WTYPE(coo) <= 0 || SKY_WTYPE(coo) == WTYPE_LIN) { + call imastr (im, Memc[key1], "LINEAR") + call imastr (im, Memc[key2], "LINEAR") + call sfree (sp) + return + } + + if (sk_wrdstr (SKY_WTYPE(coo), Memc[wtype], 3, WTYPE_LIST) <= 0) + call strcpy ("tan", Memc[wtype], 3) + call strupr (Memc[wtype]) + + # Move all this to a separate routine + switch (SKY_CTYPE(coo)) { + + case CTYPE_EQUATORIAL: + call sprintf (Memc[attr], 8, "RA---%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key1], Memc[attr]) + call sprintf (Memc[attr], 8, "DEC--%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key2], Memc[attr]) + + case CTYPE_ECLIPTIC: + call sprintf (Memc[attr], 8, "ELON-%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key1], Memc[attr]) + call sprintf (Memc[attr], 8, "ELAT-%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key2], Memc[attr]) + + case CTYPE_GALACTIC: + call sprintf (Memc[attr], 8, "GLON-%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key1], Memc[attr]) + call sprintf (Memc[attr], 8, "GLAT-%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key2], Memc[attr]) + + case CTYPE_SUPERGALACTIC: + call sprintf (Memc[attr], 8, "SLON-%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key1], Memc[attr]) + call sprintf (Memc[attr], 8, "SLAT-%3s") + call pargstr (Memc[wtype]) + call imastr (im, Memc[key2], Memc[attr]) + + default: + call imastr (im, Memc[key1], "LINEAR") + call imastr (im, Memc[key2], "LINEAR") + } + + call sfree (sp) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.f new file mode 100644 index 00000000..65765222 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.f @@ -0,0 +1,179 @@ + subroutine sksetd (coo, param, value) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer param + double precision value + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(46) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 83, 75, 89, 95, 83, 69, 84, 68/ + data (st0001(iyy),iyy= 9,16) / 58, 32, 85,110,107,110,111,119/ + data (st0001(iyy),iyy=17,24) /110, 32, 99,111,111,114,100,105/ + data (st0001(iyy),iyy=25,32) /110, 97,116,101, 32,115,121,115/ + data (st0001(iyy),iyy=33,40) /116,101,109, 32,112, 97,114, 97/ + data (st0001(iyy),iyy=41,46) /109,101,116,101,114, 0/ + sw0001=(param) + goto 110 +120 continue + memd((((coo)-1)/2+1)) = value + goto 111 +130 continue + memd((((coo+2)-1)/2+1)) = value + goto 111 +140 continue + memd((((coo+4)-1)/2+1)) = value + goto 111 +150 continue + memd((((coo+6)-1)/2+1)) = value + goto 111 +160 continue + memd((((coo+8)-1)/2+1)) = value + goto 111 +170 continue + memd((((coo+10)-1)/2+1)) = value + goto 111 +180 continue + call xerror(0, st0001) + if (xerflg) goto 100 + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.6) goto 180 + goto (120,130,140,150,160,170),sw0001 +111 continue +100 return + end + subroutine skseti (coo, param, value) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer param + integer value + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(46) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 83, 75, 89, 95, 83, 69, 84, 73/ + data (st0001(iyy),iyy= 9,16) / 58, 32, 85,110,107,110,111,119/ + data (st0001(iyy),iyy=17,24) /110, 32, 99,111,111,114,100,105/ + data (st0001(iyy),iyy=25,32) /110, 97,116,101, 32,115,121,115/ + data (st0001(iyy),iyy=33,40) /116,101,109, 32,112, 97,114, 97/ + data (st0001(iyy),iyy=41,46) /109,101,116,101,114, 0/ + sw0001=(param) + goto 110 +120 continue + memi(coo+12) = value + goto 111 +130 continue + memi(coo+13) = value + goto 111 +140 continue + memi(coo+14) = value + goto 111 +150 continue + memi(coo+15) = value + goto 111 +160 continue + memi(coo+16) = value + goto 111 +170 continue + memi(coo+17) = value + goto 111 +180 continue + memi(coo+18) = value + goto 111 +190 continue + memi(coo+19) = value + goto 111 +200 continue + memi(coo+20) = value + goto 111 +210 continue + memi(coo+21) = value + goto 111 +220 continue + memi(coo+22) = value + goto 111 +230 continue + memi(coo+23) = value + goto 111 +240 continue + memi(coo+24) = value + goto 111 +250 continue + call xerror(0, st0001) + if (xerflg) goto 100 + goto 111 +110 continue + sw0001=sw0001-6 + if (sw0001.lt.1.or.sw0001.gt.14) goto 250 + goto (120,130,140,150,160,170,180,190,200,210,220,230,250, + * 240),sw0001 +111 continue +100 return + end + subroutine sksets (coo, param, value) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer param + integer*2 value(*) + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(48) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 83, 75, 89, 95, 83, 69, 84, 83/ + data (st0001(iyy),iyy= 9,16) / 84, 82, 58, 32, 85,110,107,110/ + data (st0001(iyy),iyy=17,24) /111,119,110, 32, 99,111,111,114/ + data (st0001(iyy),iyy=25,32) /100,105,110, 97,116,101, 32,115/ + data (st0001(iyy),iyy=33,40) /121,115,116,101,109, 32,112, 97/ + data (st0001(iyy),iyy=41,48) /114, 97,109,101,116,101,114, 0/ + sw0001=(param) + goto 110 +120 continue + call xstrcy(value, memc((((coo+25)-1)*2+1)) , 255 ) + goto 111 +130 continue + call xerror(0, st0001) + if (xerflg) goto 100 + goto 111 +110 continue + if (sw0001.eq.19) goto 120 + goto 130 +111 continue +100 return + end +c sksetd sk_setd +c skseti sk_seti +c sksets sk_sets diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.x new file mode 100644 index 00000000..9e7191c3 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skset.x @@ -0,0 +1,90 @@ +include "skywcsdef.h" +include "skywcs.h" + + +# SK_SETD -- Set a double precision coordinate parameter. + +procedure sk_setd (coo, param, value) + +pointer coo #I pointer to the coordinate structure +int param #I the input parameter +double value #I the parameter value + +begin + switch (param) { + case S_VXOFF: + SKY_VXOFF(coo) = value + case S_VYOFF: + SKY_VYOFF(coo) = value + case S_VXSTEP: + SKY_VXSTEP(coo) = value + case S_VYSTEP: + SKY_VYSTEP(coo) = value + case S_EQUINOX: + SKY_EQUINOX(coo) = value + case S_EPOCH: + SKY_EPOCH(coo) = value + default: + call error (0, "SKY_SETD: Unknown coordinate system parameter") + } +end + + +# SK_SETI -- Set an integer coordinate parameter. + +procedure sk_seti (coo, param, value) + +pointer coo #I pointer to the coordinate structure +int param #I the input parameter +int value #I the parameter value + +begin + switch (param) { + case S_CTYPE: + SKY_CTYPE(coo) = value + case S_RADECSYS: + SKY_RADECSYS(coo) = value + case S_WTYPE: + SKY_WTYPE(coo) = value + case S_PLNGAX: + SKY_PLNGAX(coo) = value + case S_PLATAX: + SKY_PLATAX(coo) = value + case S_XLAX: + SKY_XLAX(coo) = value + case S_YLAX: + SKY_YLAX(coo) = value + case S_PIXTYPE: + SKY_PIXTYPE(coo) = value + case S_NLNGAX: + SKY_NLNGAX(coo) = value + case S_NLATAX: + SKY_NLATAX(coo) = value + case S_NLNGUNITS: + SKY_NLNGUNITS(coo) = value + case S_NLATUNITS: + SKY_NLATUNITS(coo) = value + case S_STATUS: + SKY_STATUS(coo) = value + default: + call error (0, "SKY_SETI: Unknown coordinate system parameter") + } +end + + +# SK_SETS -- Set a character string coordinate parameter. + +procedure sk_sets (coo, param, value) + +pointer coo #I pointer to the coordinate structure +int param #I the input parameter +char value[ARB] #I the parameter value + +begin + switch (param) { + case S_COOSYSTEM: + call strcpy (value, SKY_COOSYSTEM(coo), SZ_FNAME) + default: + call error (0, "SKY_SETSTR: Unknown coordinate system parameter") + } +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.f new file mode 100644 index 00000000..4c3c8397 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.f @@ -0,0 +1,179 @@ + double precision function skstad (coo, param) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer param + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(47) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 83, 75, 89, 95, 83, 84, 65, 84/ + data (st0001(iyy),iyy= 9,16) / 68, 58, 32, 85,110,107,110,111/ + data (st0001(iyy),iyy=17,24) /119,110, 32, 99,111,111,114,100/ + data (st0001(iyy),iyy=25,32) /105,110, 97,116,101, 32,115,121/ + data (st0001(iyy),iyy=33,40) /115,116,101,109, 32,112, 97,114/ + data (st0001(iyy),iyy=41,47) / 97,109,101,116,101,114, 0/ + skstad = 0 + sw0001=(param) + goto 110 +120 continue + skstad = (memd((((coo)-1)/2+1)) ) + goto 100 +130 continue + skstad = (memd((((coo+2)-1)/2+1)) ) + goto 100 +140 continue + skstad = (memd((((coo+4)-1)/2+1)) ) + goto 100 +150 continue + skstad = (memd((((coo+6)-1)/2+1)) ) + goto 100 +160 continue + skstad = (memd((((coo+8)-1)/2+1)) ) + goto 100 +170 continue + skstad = (memd((((coo+10)-1)/2+1)) ) + goto 100 +180 continue + call xerror(0, st0001) + if (xerflg) goto 100 + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.6) goto 180 + goto (120,130,140,150,160,170),sw0001 +111 continue +100 return + end + integer function skstai (coo, param) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer param + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(47) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 83, 75, 89, 95, 83, 84, 65, 84/ + data (st0001(iyy),iyy= 9,16) / 73, 58, 32, 85,110,107,110,111/ + data (st0001(iyy),iyy=17,24) /119,110, 32, 99,111,111,114,100/ + data (st0001(iyy),iyy=25,32) /105,110, 97,116,101, 32,115,121/ + data (st0001(iyy),iyy=33,40) /115,116,101,109, 32,112, 97,114/ + data (st0001(iyy),iyy=41,47) / 97,109,101,116,101,114, 0/ + sw0001=(param) + goto 110 +120 continue + skstai = (memi(coo+12) ) + goto 100 +130 continue + skstai = (memi(coo+13) ) + goto 100 +140 continue + skstai = (memi(coo+14) ) + goto 100 +150 continue + skstai = (memi(coo+15) ) + goto 100 +160 continue + skstai = (memi(coo+16) ) + goto 100 +170 continue + skstai = (memi(coo+17) ) + goto 100 +180 continue + skstai = (memi(coo+18) ) + goto 100 +190 continue + skstai = (memi(coo+19) ) + goto 100 +200 continue + skstai = (memi(coo+20) ) + goto 100 +210 continue + skstai = (memi(coo+21) ) + goto 100 +220 continue + skstai = (memi(coo+22) ) + goto 100 +230 continue + skstai = (memi(coo+23) ) + goto 100 +240 continue + skstai = (memi(coo+24) ) + goto 100 +250 continue + call xerror(0, st0001) + if (xerflg) goto 100 + goto 111 +110 continue + sw0001=sw0001-6 + if (sw0001.lt.1.or.sw0001.gt.14) goto 250 + goto (120,130,140,150,160,170,180,190,200,210,220,230,250, + * 240),sw0001 +111 continue +100 return + end + subroutine skstas (coo, param, value, maxch) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer coo + integer param + integer*2 value + integer maxch + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(48) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 83, 75, 89, 95, 71, 69, 84, 83/ + data (st0001(iyy),iyy= 9,16) / 84, 82, 58, 32, 85,110,107,110/ + data (st0001(iyy),iyy=17,24) /111,119,110, 32, 99,111,111,114/ + data (st0001(iyy),iyy=25,32) /100,105,110, 97,116,101, 32,115/ + data (st0001(iyy),iyy=33,40) /121,115,116,101,109, 32,112, 97/ + data (st0001(iyy),iyy=41,48) /114, 97,109,101,116,101,114, 0/ + sw0001=(param) + goto 110 +120 continue + call xstrcy(memc((((coo+25)-1)*2+1)) , value, maxch) + goto 111 +130 continue + call xerror(0, st0001) + if (xerflg) goto 100 + goto 111 +110 continue + if (sw0001.eq.19) goto 120 + goto 130 +111 continue +100 return + end +c skstad sk_statd +c skstai sk_stati +c skstas sk_stats diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.x new file mode 100644 index 00000000..82d2f1c2 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skstat.x @@ -0,0 +1,90 @@ +include "skywcsdef.h" +include "skywcs.h" + + +# SK_STATD -- Get a double precision coordinate parameter. + +double procedure sk_statd (coo, param) + +pointer coo #I pointer to the coordinate structure +int param #I the input parameter + +begin + switch (param) { + case S_VXOFF: + return (SKY_VXOFF(coo)) + case S_VYOFF: + return (SKY_VYOFF(coo)) + case S_VXSTEP: + return (SKY_VXSTEP(coo)) + case S_VYSTEP: + return (SKY_VYSTEP(coo)) + case S_EQUINOX: + return (SKY_EQUINOX(coo)) + case S_EPOCH: + return (SKY_EPOCH(coo)) + default: + call error (0, "SKY_STATD: Unknown coordinate system parameter") + } +end + + +# SK_STATI -- Get an integer coordinate parameter. + +int procedure sk_stati (coo, param) + +pointer coo #I pointer to the coordinate structure +int param #I the input parameter + +begin + switch (param) { + case S_CTYPE: + return (SKY_CTYPE(coo)) + case S_RADECSYS: + return (SKY_RADECSYS(coo)) + case S_WTYPE: + return (SKY_WTYPE(coo)) + case S_PLNGAX: + return (SKY_PLNGAX(coo)) + case S_PLATAX: + return (SKY_PLATAX(coo)) + case S_XLAX: + return (SKY_XLAX(coo)) + case S_YLAX: + return (SKY_YLAX(coo)) + case S_PIXTYPE: + return (SKY_PIXTYPE(coo)) + case S_NLNGAX: + return (SKY_NLNGAX(coo)) + case S_NLATAX: + return (SKY_NLATAX(coo)) + case S_NLNGUNITS: + return (SKY_NLNGUNITS(coo)) + case S_NLATUNITS: + return (SKY_NLATUNITS(coo)) + case S_STATUS: + return (SKY_STATUS(coo)) + default: + call error (0, "SKY_STATI: Unknown coordinate system parameter") + } +end + + + +# SK_STATS -- Get a character string coordinate parameter. + +procedure sk_stats (coo, param, value, maxch) + +pointer coo #I pointer to the coordinate structure +int param #I the input parameter +char value #O the output string +int maxch #I the maximum size of the string + +begin + switch (param) { + case S_COOSYSTEM: + call strcpy (SKY_COOSYSTEM(coo), value, maxch) + default: + call error (0, "SKY_GETSTR: Unknown coordinate system parameter") + } +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.f new file mode 100644 index 00000000..85aff7b1 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.f @@ -0,0 +1,756 @@ + subroutine skultn (cooin, cooout, ilng, ilat, olng, olat, npts) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cooin + integer cooout + integer npts + double precision ilng(*) + double precision ilat(*) + double precision olng(*) + double precision olat(*) + double precision tilng + double precision tilat + double precision tolng + double precision tolat + integer i + integer sw0001,sw0002,sw0003,sw0004 + save + do 110 i = 1, npts + sw0001=(memi(cooin+22) ) + goto 120 +130 continue + tilng = ((15.0d0 * ilng(i))/57.295779513082320877) + goto 121 +140 continue + tilng = ((ilng(i))/57.295779513082320877) + goto 121 +150 continue + tilng = ilng(i) + goto 121 +160 continue + tilng = ilng(i) + goto 121 +120 continue + if (sw0001.lt.1.or.sw0001.gt.3) goto 160 + goto (140,150,130),sw0001 +121 continue + sw0002=(memi(cooin+23) ) + goto 170 +180 continue + tilat = ((15.0d0 * ilat(i))/57.295779513082320877) + goto 171 +190 continue + tilat = ((ilat(i))/57.295779513082320877) + goto 171 +200 continue + tilat = ilat(i) + goto 171 +210 continue + tilat = ilat(i) + goto 171 +170 continue + if (sw0002.lt.1.or.sw0002.gt.3) goto 210 + goto (190,200,180),sw0002 +171 continue + call sklltn (cooin, cooout, tilng, tilat, 1.6d308, 1.6d308, + * 0.0d0, 0.0d0, tolng, tolat) + sw0003=(memi(cooout+22) ) + goto 220 +230 continue + olng(i) = ((tolng)*57.295779513082320877) / 15.0d0 + goto 221 +240 continue + olng(i) = ((tolng)*57.295779513082320877) + goto 221 +250 continue + olng(i) = tolng + goto 221 +260 continue + olng(i) = tolng + goto 221 +220 continue + if (sw0003.lt.1.or.sw0003.gt.3) goto 260 + goto (240,250,230),sw0003 +221 continue + sw0004=(memi(cooout+23) ) + goto 270 +280 continue + olat(i) = ((tolat)*57.295779513082320877) / 15.0d0 + goto 271 +290 continue + olat(i) = ((tolat)*57.295779513082320877) + goto 271 +300 continue + olat(i) = tolat + goto 271 +310 continue + olat(i) = tolat + goto 271 +270 continue + if (sw0004.lt.1.or.sw0004.gt.3) goto 310 + goto (290,300,280),sw0004 +271 continue +110 continue +111 continue +100 return + end + subroutine sklltn (cooin, cooout, ilng, ilat, ipmlng, ipmlat, px, + *rv, olng, olat) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cooin + integer cooout + double precision ilng + double precision ilat + double precision ipmlng + double precision ipmlat + double precision px + double precision rv + double precision olng + double precision olat + integer pmflag + double precision pmr + double precision pmd + double precision slepj + double precision slepb + integer sw0001,sw0002,sw0003,sw0004,sw0005,sw0006,sw0007,sw0008, + *sw0009,sw0010 + save + if (.not.(memi(cooin+12) .eq. memi(cooout+12) )) goto 110 + sw0001=(memi(cooin+12) ) + goto 120 +130 continue + call skequl (cooin, cooout, ilng, ilat, ipmlng, ipmlat, + * px, rv, olng, olat) + goto 121 +140 continue + if (.not.(memd((((cooin+10)-1)/2+1)) .eq. memd((((cooout+ + * 10)-1)/2+1)) )) goto 150 + olng = ilng + olat = ilat + goto 151 +150 continue + call sleceq (ilng, ilat, memd((((cooin+10)-1)/2+1)) , + * olng, olat) + call sleqec (olng, olat, memd((((cooout+10)-1)/2+1)) , + * olng, olat) +151 continue + goto 121 +160 continue + olng = ilng + olat = ilat + goto 121 +120 continue + if (sw0001.eq.1) goto 130 + if (sw0001.eq.2) goto 140 + goto 160 +121 continue + goto 100 +110 continue + if (.not.(.not. ((ipmlng).eq.1.6d308) .and. .not. ((ipmlat).eq. + * 1.6d308))) goto 170 + pmflag = 1 + goto 171 +170 continue + pmflag = 0 +171 continue + sw0002=(memi(cooin+12) ) + goto 180 +190 continue + sw0003=(memi(cooin+13) ) + goto 200 +210 continue + if (.not.(pmflag .eq. 1)) goto 220 + call slpm (ilng, ilat, ipmlng, ipmlat, px, rv, slepb ( + * memd((((cooin+10)-1)/2+1)) ), slepb (memd((((cooout+10 + * )-1)/2+1)) ), olng, olat) + goto 221 +220 continue + olng = ilng + olat = ilat +221 continue + if (.not.(memi(cooin+13) .eq. 1)) goto 230 + call slsuet (olng, olat, memd((((cooin+8)-1)/2+1)) , + * olng, olat) +230 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 1950.0d0)) goto + * 240 + call slprcs (1, memd((((cooin+8)-1)/2+1)) , 1950.0d0, + * olng, olat) +240 continue + call sladet (olng, olat, 1950.0d0, olng, olat) + if (.not.(pmflag .eq. 1)) goto 250 + call slf45z (olng, olat, slepb(memd((((cooout+10)-1)/2 + * +1)) ), olng, olat) + goto 251 +250 continue + call slf45z (olng, olat, slepb (memd((((cooin+10)-1)/2 + * +1)) ), olng, olat) +251 continue + goto 201 +260 continue + if (.not.(pmflag .eq. 1)) goto 270 + call slpm (ilng, ilat, ipmlng, ipmlat, px, rv, slepj ( + * memd((((cooin+10)-1)/2+1)) ), slepj(memd((((cooout+10) + * -1)/2+1)) ), olng, olat) + goto 271 +270 continue + olng = ilng + olat = ilat +271 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 280 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +280 continue + goto 201 +290 continue + if (.not.(pmflag .eq. 1)) goto 300 + call slpm (ilng, ilat, ipmlng, ipmlat, px, rv, slepj ( + * memd((((cooin+10)-1)/2+1)) ), slepj(memd((((cooout+10) + * -1)/2+1)) ), olng, olat) + goto 301 +300 continue + olng = ilng + olat = ilat +301 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 310 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +310 continue + call slhf5z (olng, olat, 2000.0d0, olng, olat, pmr, pmd) + goto 201 +320 continue + call slamp (ilng, ilat, memd((((cooin+10)-1)/2+1)) , 2000 + * .0d0, olng, olat) + goto 201 +200 continue + if (sw0003.lt.1.or.sw0003.gt.5) goto 201 + goto (210,210,260,290,320),sw0003 +201 continue + sw0004=(memi(cooout+12) ) + goto 330 +340 continue + call sleqec (olng, olat, memd((((cooout+10)-1)/2+1)) , + * olng, olat) + goto 331 +350 continue + call sleqga (olng, olat, olng, olat) + goto 331 +360 continue + call sleqga (olng, olat, olng, olat) + call slgasu (olng, olat, olng, olat) + goto 331 +370 continue + olng = ilng + olat = ilat + goto 331 +330 continue + sw0004=sw0004-1 + if (sw0004.lt.1.or.sw0004.gt.3) goto 370 + goto (340,350,360),sw0004 +331 continue + goto 181 +380 continue + call sleceq (ilng, ilat, memd((((cooin+10)-1)/2+1)) , olng, + * olat) + sw0005=(memi(cooout+12) ) + goto 390 +400 continue + sw0006=(memi(cooout+13) ) + goto 410 +420 continue + call slf54z (olng, olat, slepb(memd((((cooout+10)-1)/2 + * +1)) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) + * goto 430 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +430 continue + if (.not.(memi(cooout+13) .eq. 1)) goto 440 + call sladet (olng, olat, memd((((cooout+8)-1)/2+1)) + * , olng, olat) +440 continue + goto 411 +450 continue + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) + * goto 460 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +460 continue + goto 411 +470 continue + call slf5hz (olng, olat, 2000.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) + * goto 480 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +480 continue + goto 411 +490 continue + call slmap (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000. + * 0d0, memd((((cooout+10)-1)/2+1)) , olng, olat) + goto 411 +410 continue + if (sw0006.lt.1.or.sw0006.gt.5) goto 411 + goto (420,420,450,470,490),sw0006 +411 continue + goto 391 +500 continue + call sleqga (olng, olat, olng, olat) + goto 391 +510 continue + call sleqga (olng, olat, olng, olat) + call slgasu (olng, olat, olng, olat) + goto 391 +520 continue + olng = ilng + olat = ilat + goto 391 +390 continue + if (sw0005.lt.1.or.sw0005.gt.4) goto 520 + goto (400,520,500,510),sw0005 +391 continue + goto 181 +530 continue + sw0007=(memi(cooout+12) ) + goto 540 +550 continue + call slgaeq (ilng, ilat, olng, olat) + sw0008=(memi(cooout+13) ) + goto 560 +570 continue + call slf54z (olng, olat, slepb(memd((((cooout+10)-1)/2 + * +1)) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) + * goto 580 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +580 continue + if (.not.(memi(cooout+13) .eq. 1)) goto 590 + call sladet (olng, olat, memd((((cooout+8)-1)/2+1)) + * , olng, olat) +590 continue + goto 561 +600 continue + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) + * goto 610 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +610 continue + goto 561 +620 continue + call slf5hz (olng, olat, 2000.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) + * goto 630 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +630 continue + goto 561 +640 continue + call slmap (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000. + * 0d0, memd((((cooout+10)-1)/2+1)) , olng, olat) + goto 561 +560 continue + if (sw0008.lt.1.or.sw0008.gt.5) goto 561 + goto (570,570,600,620,640),sw0008 +561 continue + goto 541 +650 continue + call slgaeq (ilng, ilat, olng, olat) + call sleqec (olng, olat, memd((((cooout+10)-1)/2+1)) , + * olng, olat) + goto 541 +660 continue + call slgasu (ilng, ilat, olng, olat) + goto 541 +670 continue + olng = ilng + olat = ilat + goto 541 +540 continue + if (sw0007.lt.1.or.sw0007.gt.4) goto 670 + goto (550,650,670,660),sw0007 +541 continue + goto 181 +680 continue + sw0009=(memi(cooout+12) ) + goto 690 +700 continue + call slsuga (ilng, ilat, olng, olat) + sw0010=(memi(cooout+13) ) + goto 710 +720 continue + call slgaeq (olng, olat, olng, olat) + call slf54z (olng, olat, slepb (memd((((cooout+10)-1)/ + * 2+1)) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) + * goto 730 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +730 continue + call sladet (olng, olat, memd((((cooout+8)-1)/2+1)) , + * olng, olat) + goto 711 +740 continue + call slgaeq (olng, olat, olng, olat) + call slf54z (olng, olat, slepb (memd((((cooout+10)-1)/ + * 2+1)) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) + * goto 750 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +750 continue + goto 711 +760 continue + call slgaeq (olng, olat, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) + * goto 770 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +770 continue + goto 711 +780 continue + call slgaeq (olng, olat, olng, olat) + call slf5hz (olng, olat, 2000.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) + * goto 790 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1) + * ) , olng, olat) +790 continue + goto 711 +800 continue + call slgaeq (olng, olat, olng, olat) + call slmap (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000. + * 0d0, memd((((cooout+10)-1)/2+1)) , olng, olat) + goto 711 +710 continue + if (sw0010.lt.1.or.sw0010.gt.5) goto 711 + goto (720,740,760,780,800),sw0010 +711 continue + goto 691 +810 continue + call slsuga (ilng, ilat, olng, olat) + call slgaeq (olng, olat, olng, olat) + call sleqec (olng, olat, memd((((cooout+10)-1)/2+1)) , + * olng, olat) + goto 691 +820 continue + call slsuga (ilng, ilat, olng, olat) + goto 691 +830 continue + olng = ilng + olat = ilat + goto 691 +690 continue + if (sw0009.lt.1.or.sw0009.gt.3) goto 830 + goto (700,810,820),sw0009 +691 continue + goto 181 +840 continue + olng = ilng + olat = ilat + goto 181 +180 continue + if (sw0002.lt.1.or.sw0002.gt.4) goto 840 + goto (190,380,530,680),sw0002 +181 continue +100 return + end + subroutine skequl (cooin, cooout, ilng, ilat, ipmlng, ipmlat, px, + *rv, olng, olat) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cooin + integer cooout + double precision ilng + double precision ilat + double precision ipmlng + double precision ipmlat + double precision px + double precision rv + double precision olng + double precision olat + integer pmflag + double precision pmr + double precision pmd + double precision slepb + double precision slepj + integer sw0001,sw0002,sw0003,sw0004 + save + if (.not.((memi(cooin+13) .eq. memi(cooout+13) ) .and. (memd((( + * (cooin+8)-1)/2+1)) .eq. memd((((cooout+8)-1)/2+1)) ) .and. ( + * memd((((cooin+10)-1)/2+1)) .eq. memd((((cooout+10)-1)/2+1)) ))) + * goto 110 + olng = ilng + olat = ilat + goto 100 +110 continue + if (.not.(.not. ((ipmlng).eq.1.6d308) .and. .not. ((ipmlat).eq. + * 1.6d308))) goto 120 + pmflag = 1 + goto 121 +120 continue + pmflag = 0 +121 continue + sw0001=(memi(cooin+13) ) + goto 130 +140 continue + if (.not.(pmflag .eq. 1)) goto 150 + call slpm (ilng, ilat, ipmlng, ipmlat, px, rv, slepb ( + * memd((((cooin+10)-1)/2+1)) ), slepb (memd((((cooout+10)-1 + * )/2+1)) ), olng, olat) + goto 151 +150 continue + olng = ilng + olat = ilat +151 continue + if (.not.(memi(cooin+13) .eq. 1)) goto 160 + call slsuet (olng, olat, memd((((cooin+8)-1)/2+1)) , olng + * , olat) +160 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 1950.0d0)) goto 170 + call slprcs (1, memd((((cooin+8)-1)/2+1)) , 1950.0d0, + * olng, olat) +170 continue + call sladet (olng, olat, 1950.0d0, olng, olat) + if (.not.(pmflag .eq. 1)) goto 180 + call slf45z (olng, olat, slepb (memd((((cooout+10)-1)/2+1 + * )) ), olng, olat) + goto 181 +180 continue + call slf45z (olng, olat, slepb (memd((((cooin+10)-1)/2+1) + * ) ), olng, olat) +181 continue + sw0002=(memi(cooout+13) ) + goto 190 +200 continue + call slf54z (olng, olat, slepb (memd((((cooout+10)-1)/2+1 + * )) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) goto + * 210 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +210 continue + if (.not.(memi(cooout+13) .eq. 1)) goto 220 + call sladet (olng, olat, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +220 continue + goto 191 +230 continue + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 240 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +240 continue + goto 191 +250 continue + call slf5hz (olng, olat, 2000.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 260 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +260 continue + goto 191 +270 continue + call slmap (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000.0d0 + * , memd((((cooout+10)-1)/2+1)) , olng, olat) + goto 191 +190 continue + if (sw0002.lt.1.or.sw0002.gt.5) goto 191 + goto (200,200,230,250,270),sw0002 +191 continue + goto 131 +280 continue + if (.not.(memi(cooin+13) .eq. 3)) goto 290 + if (.not.(pmflag .eq. 1)) goto 300 + call slpm (ilng, ilat, ipmlng, ipmlat, px, rv, slepj ( + * memd((((cooin+10)-1)/2+1)) ), slepj (memd((((cooout+10 + * )-1)/2+1)) ), olng, olat) + goto 301 +300 continue + olng = ilng + olat = ilat +301 continue + goto 291 +290 continue + call slamp (ilng, ilat, memd((((cooin+10)-1)/2+1)) , 2000 + * .0d0, olng, olat) +291 continue + sw0003=(memi(cooout+13) ) + goto 310 +320 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 330 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +330 continue + call slf54z (olng, olat, slepb(memd((((cooout+10)-1)/2+1) + * ) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) goto + * 340 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +340 continue + if (.not.(memi(cooout+13) .eq. 1)) goto 350 + call sladet (olng, olat, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +350 continue + goto 311 +360 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. memd((((cooout+8 + * )-1)/2+1)) )) goto 370 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , memd(((( + * cooout+8)-1)/2+1)) , olng, olat) +370 continue + goto 311 +380 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 390 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +390 continue + call slf5hz (olng, olat, slepj(memd((((cooin+10)-1)/2+1)) + * ), olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 400 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +400 continue + goto 311 +410 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 420 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +420 continue + call slmap (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000.0d0 + * , memd((((cooout+10)-1)/2+1)) , olng, olat) + goto 311 +310 continue + if (sw0003.lt.1.or.sw0003.gt.5) goto 311 + goto (320,320,360,380,410),sw0003 +311 continue + goto 131 +430 continue + if (.not.(pmflag .eq. 1)) goto 440 + call slpm (ilng, ilat, ipmlng, ipmlat, px, rv, slepj ( + * memd((((cooin+10)-1)/2+1)) ), slepj (memd((((cooout+10)-1 + * )/2+1)) ), olng, olat) + goto 441 +440 continue + olng = ilng + olat = ilat +441 continue + sw0004=(memi(cooout+13) ) + goto 450 +460 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 470 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +470 continue + call slhf5z (olng, olat, 2000.0d0, olng, olat, pmr, pmd) + call slf54z (olng, olat, slepb(memd((((cooout+10)-1)/2+1) + * ) ), olng, olat, pmr, pmd) + call slsuet (olng, olat, 1950.0d0, olng, olat) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 1950.0d0)) goto + * 480 + call slprcs (1, 1950.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +480 continue + if (.not.(memi(cooout+13) .eq. 1)) goto 490 + call sladet (olng, olat, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +490 continue + goto 451 +500 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 510 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +510 continue + call slhf5z (olng, olat, slepj(memd((((cooout+10)-1)/2+1) + * ) ), olng, olat, pmr, pmd) + if (.not.(memd((((cooout+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 520 + call slprcs (2, 2000.0d0, memd((((cooout+8)-1)/2+1)) , + * olng, olat) +520 continue + goto 451 +530 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. memd((((cooout+8 + * )-1)/2+1)) )) goto 540 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , memd(((( + * cooout+8)-1)/2+1)) , olng, olat) +540 continue + goto 451 +550 continue + if (.not.(memd((((cooin+8)-1)/2+1)) .ne. 2000.0d0)) goto + * 560 + call slprcs (2, memd((((cooin+8)-1)/2+1)) , 2000.0d0, + * olng, olat) +560 continue + call slhf5z (olng, olat, slepj(memd((((cooout+10)-1)/2+1) + * ) ), olng, olat, pmr, pmd) + call slmap (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000.0d0 + * , memd((((cooout+10)-1)/2+1)) , olng, olat) + goto 451 +450 continue + if (sw0004.lt.1.or.sw0004.gt.5) goto 451 + goto (460,460,500,530,550),sw0004 +451 continue + goto 131 +130 continue + if (sw0001.lt.1.or.sw0001.gt.5) goto 131 + goto (140,140,280,430,280),sw0001 +131 continue +100 return + end +c sleceq sl_eceq +c sleqec sl_eqec +c sladet sl_adet +c sleqga sl_eqga +c slgaeq sl_gaeq +c slf45z sl_f45z +c slf54z sl_f54z +c slhf5z sl_hf5z +c slf5hz sl_f5hz +c slgasu sl_gasu +c slsuga sl_suga +c skequl sk_equatorial +c sklltn sk_lltran +c slprcs sl_prcs +c skultn sk_ultran +c slsuet sl_suet diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.x new file mode 100644 index 00000000..a8cf87c3 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/sktransform.x @@ -0,0 +1,577 @@ +include <math.h> +include "skywcsdef.h" +include "skywcs.h" + +# SK_ULTRAN -- Transform the sky coordinates from the input coordinate +# system to the output coordinate system using the units conversions as +# appropriate. + +procedure sk_ultran (cooin, cooout, ilng, ilat, olng, olat, npts) + +pointer cooin #I pointer to the input coordinate system structure +pointer cooout #I pointer to the output coordinate system structure +double ilng[ARB] #I the input ra/longitude in radians +double ilat[ARB] #I the input dec/latitude in radians +double olng[ARB] #O the output ra/longitude in radians +double olat[ARB] #O the output dec/latitude in radians +int npts #I the number of points to be converted + +double tilng, tilat, tolng, tolat +int i + +begin + do i = 1, npts { + + switch (SKY_NLNGUNITS(cooin)) { + case SKY_HOURS: + tilng = DEGTORAD(15.0d0 * ilng[i]) + case SKY_DEGREES: + tilng = DEGTORAD(ilng[i]) + case SKY_RADIANS: + tilng = ilng[i] + default: + tilng = ilng[i] + } + switch (SKY_NLATUNITS(cooin)) { + case SKY_HOURS: + tilat = DEGTORAD(15.0d0 * ilat[i]) + case SKY_DEGREES: + tilat = DEGTORAD(ilat[i]) + case SKY_RADIANS: + tilat = ilat[i] + default: + tilat = ilat[i] + } + + call sk_lltran (cooin, cooout, tilng, tilat, INDEFD, INDEFD, + 0.0d0, 0.0d0, tolng, tolat) + + switch (SKY_NLNGUNITS(cooout)) { + case SKY_HOURS: + olng[i] = RADTODEG(tolng) / 15.0d0 + case SKY_DEGREES: + olng[i] = RADTODEG(tolng) + case SKY_RADIANS: + olng[i] = tolng + default: + olng[i] = tolng + } + switch (SKY_NLATUNITS(cooout)) { + case SKY_HOURS: + olat[i] = RADTODEG(tolat) / 15.0d0 + case SKY_DEGREES: + olat[i] = RADTODEG(tolat) + case SKY_RADIANS: + olat[i] = tolat + default: + olat[i] = tolat + } + } +end + + +# SK_LLTRAN -- Transform the sky coordinate from the input coordinate +# system to the output coordinate system assuming that all the coordinate +# are in radians. + +procedure sk_lltran (cooin, cooout, ilng, ilat, ipmlng, ipmlat, px, rv, + olng, olat) + +pointer cooin #I pointer to the input coordinate system structure +pointer cooout #I pointer to the output coordinate system structure +double ilng #I the input ra/longitude in radians +double ilat #I the input dec/latitude in radians +double ipmlng #I the input proper motion in ra in radians +double ipmlat #I the input proper motion in dec in radians +double px #I the input parallax in arcseconds +double rv #I the input radial velocity in km / second +double olng #O the output ra/longitude in radians +double olat #O the output dec/latitude in radians + +int pmflag +double pmr, pmd +double sl_epj(), sl_epb() + +begin + # Test for the case where the input coordinate system is the + # same as the output coordinate system. + if (SKY_CTYPE(cooin) == SKY_CTYPE(cooout)) { + + switch (SKY_CTYPE(cooin)) { + + case CTYPE_EQUATORIAL: + call sk_equatorial (cooin, cooout, ilng, ilat, ipmlng, + ipmlat, px, rv, olng, olat) + + case CTYPE_ECLIPTIC: + if (SKY_EPOCH(cooin) == SKY_EPOCH(cooout)) { + olng = ilng + olat = ilat + } else { + call sl_eceq (ilng, ilat, SKY_EPOCH(cooin), olng, olat) + call sl_eqec (olng, olat, SKY_EPOCH(cooout), olng, olat) + } + + default: + olng = ilng + olat = ilat + } + + return + } + + # Compute proper motions ? + if (! IS_INDEFD(ipmlng) && ! IS_INDEFD(ipmlat)) + pmflag = YES + else + pmflag = NO + + # Cover the remaining cases. + switch (SKY_CTYPE(cooin)) { + + # The input system is equatorial. + case CTYPE_EQUATORIAL: + + switch (SKY_RADECSYS(cooin)) { + + case EQTYPE_FK4, EQTYPE_FK4NOE: + if (pmflag == YES) { + call sl_pm (ilng, ilat, ipmlng, ipmlat, px, rv, + sl_epb (SKY_EPOCH(cooin)), sl_epb (SKY_EPOCH(cooout)), + olng, olat) + } else { + olng = ilng + olat = ilat + } + if (SKY_RADECSYS(cooin) == EQTYPE_FK4) + call sl_suet (olng, olat, SKY_EQUINOX(cooin), olng, olat) + if (SKY_EQUINOX(cooin) != 1950.0d0) + call sl_prcs (1, SKY_EQUINOX(cooin), 1950.0d0, olng, olat) + call sl_adet (olng, olat, 1950.0d0, olng, olat) + if (pmflag == YES) + call sl_f45z (olng, olat, sl_epb(SKY_EPOCH(cooout)), + olng, olat) + else + call sl_f45z (olng, olat, sl_epb (SKY_EPOCH(cooin)), + olng, olat) + + case EQTYPE_FK5: + if (pmflag == YES) { + call sl_pm (ilng, ilat, ipmlng, ipmlat, px, rv, + sl_epj (SKY_EPOCH(cooin)), sl_epj(SKY_EPOCH(cooout)), + olng, olat) + } else { + olng = ilng + olat = ilat + } + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + + case EQTYPE_ICRS: + if (pmflag == YES) { + call sl_pm (ilng, ilat, ipmlng, ipmlat, px, rv, + sl_epj (SKY_EPOCH(cooin)), sl_epj(SKY_EPOCH(cooout)), + olng, olat) + } else { + olng = ilng + olat = ilat + } + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_hf5z (olng, olat, 2000.0d0, olng, olat, pmr, pmd) + + case EQTYPE_GAPPT: + call sl_amp (ilng, ilat, SKY_EPOCH(cooin), 2000.0d0, olng, olat) + + } + + switch (SKY_CTYPE(cooout)) { + + # The output coordinate system is ecliptic. + case CTYPE_ECLIPTIC: + call sl_eqec (olng, olat, SKY_EPOCH(cooout), olng, olat) + + # The output coordinate system is galactic. + case CTYPE_GALACTIC: + call sl_eqga (olng, olat, olng, olat) + + # The output coordinate system is supergalactic. + case CTYPE_SUPERGALACTIC: + call sl_eqga (olng, olat, olng, olat) + call sl_gasu (olng, olat, olng, olat) + + default: + olng = ilng + olat = ilat + } + + # The input coordinate system is ecliptic. + case CTYPE_ECLIPTIC: + + call sl_eceq (ilng, ilat, SKY_EPOCH(cooin), olng, olat) + switch (SKY_CTYPE(cooout)) { + + # The output coordinate system is equatorial. + case CTYPE_EQUATORIAL: + + switch (SKY_RADECSYS(cooout)) { + case EQTYPE_FK4, EQTYPE_FK4NOE: + call sl_f54z (olng, olat, sl_epb(SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), + olng, olat) + if (SKY_RADECSYS(cooout) == EQTYPE_FK4) + call sl_adet (olng, olat, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_FK5: + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_ICRS: + #call sl_f5hz (olng, olat, sl_epj(SKY_EPOCH(cooin)), + #olng, olat) + call sl_f5hz (olng, olat, 2000.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_GAPPT: + call sl_map (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, + 2000.0d0, SKY_EPOCH(cooout), olng, olat) + } + + # The output coordinate system is galactic. + case CTYPE_GALACTIC: + call sl_eqga (olng, olat, olng, olat) + + # The output system is supergalactic. + case CTYPE_SUPERGALACTIC: + call sl_eqga (olng, olat, olng, olat) + call sl_gasu (olng, olat, olng, olat) + + default: + olng = ilng + olat = ilat + } + + # The input coordinate system is galactic. + case CTYPE_GALACTIC: + + switch (SKY_CTYPE(cooout)) { + + # The output coordinate system is equatorial. + case CTYPE_EQUATORIAL: + call sl_gaeq (ilng, ilat, olng, olat) + + switch (SKY_RADECSYS(cooout)) { + case EQTYPE_FK4, EQTYPE_FK4NOE: + call sl_f54z (olng, olat, sl_epb(SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), + olng, olat) + if (SKY_RADECSYS(cooout) == EQTYPE_FK4) + call sl_adet (olng, olat, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_FK5: + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_ICRS: + call sl_f5hz (olng, olat, 2000.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_GAPPT: + call sl_map (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, + 2000.0d0, SKY_EPOCH(cooout), olng, olat) + } + + # The output coordinate system is ecliptic. + case CTYPE_ECLIPTIC: + call sl_gaeq (ilng, ilat, olng, olat) + call sl_eqec (olng, olat, SKY_EPOCH(cooout), olng, olat) + + # The output coordinate system is supergalactic. + case CTYPE_SUPERGALACTIC: + call sl_gasu (ilng, ilat, olng, olat) + + default: + olng = ilng + olat = ilat + } + + # The input coordinates are supergalactic. + case CTYPE_SUPERGALACTIC: + + switch (SKY_CTYPE(cooout)) { + + case CTYPE_EQUATORIAL: + call sl_suga (ilng, ilat, olng, olat) + + switch (SKY_RADECSYS(cooout)) { + + case EQTYPE_FK4: + call sl_gaeq (olng, olat, olng, olat) + call sl_f54z (olng, olat, sl_epb (SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), + olng, olat) + call sl_adet (olng, olat, SKY_EQUINOX(cooout), olng, olat) + + case EQTYPE_FK4NOE: + call sl_gaeq (olng, olat, olng, olat) + call sl_f54z (olng, olat, sl_epb (SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_FK5: + call sl_gaeq (olng, olat, olng, olat) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_ICRS: + call sl_gaeq (olng, olat, olng, olat) + call sl_f5hz (olng, olat, 2000.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), + olng, olat) + + case EQTYPE_GAPPT: + call sl_gaeq (olng, olat, olng, olat) + call sl_map (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, + 2000.0d0, SKY_EPOCH(cooout), olng, olat) + } + + case CTYPE_ECLIPTIC: + call sl_suga (ilng, ilat, olng, olat) + call sl_gaeq (olng, olat, olng, olat) + call sl_eqec (olng, olat, SKY_EPOCH(cooout), olng, olat) + + case CTYPE_GALACTIC: + call sl_suga (ilng, ilat, olng, olat) + + default: + olng = ilng + olat = ilat + } + + default: + olng = ilng + olat = ilat + } +end + + +# SK_EQUATORIAL -- Convert / precess equatorial coordinates. + +procedure sk_equatorial (cooin, cooout, ilng, ilat, ipmlng, ipmlat, + px, rv, olng, olat) + +pointer cooin #I the input coordinate system structure +pointer cooout #I the output coordinate system structure +double ilng #I the input ra in radians +double ilat #I the input dec in radians +double ipmlng #I the input proper motion in ra in radians +double ipmlat #I the input proper motion in dec in radians +double px #I the input parallax in arcseconds +double rv #I the input radial valocity in km / second +double olng #O the output ra in radians +double olat #O the output dec in radians + +int pmflag +double pmr, pmd +double sl_epb(), sl_epj() + +begin + # Check to see whether or not conversion / precession is necessary. + if ((SKY_RADECSYS(cooin) == SKY_RADECSYS(cooout)) && + (SKY_EQUINOX(cooin) == SKY_EQUINOX(cooout)) && + (SKY_EPOCH(cooin) == SKY_EPOCH(cooout))) { + olng = ilng + olat = ilat + return + } + + # Compute proper motions ? + if (! IS_INDEFD(ipmlng) && ! IS_INDEFD(ipmlat)) + pmflag = YES + else + pmflag = NO + + switch (SKY_RADECSYS(cooin)) { + + # The input coordinate system is FK4 with or without the E terms. + case EQTYPE_FK4, EQTYPE_FK4NOE: + + if (pmflag == YES) { + call sl_pm (ilng, ilat, ipmlng, ipmlat, px, rv, + sl_epb (SKY_EPOCH(cooin)), sl_epb (SKY_EPOCH(cooout)), + olng, olat) + } else { + olng = ilng + olat = ilat + } + if (SKY_RADECSYS(cooin) == EQTYPE_FK4) + call sl_suet (olng, olat, SKY_EQUINOX(cooin), olng, olat) + if (SKY_EQUINOX(cooin) != 1950.0d0) + call sl_prcs (1, SKY_EQUINOX(cooin), 1950.0d0, olng, olat) + call sl_adet (olng, olat, 1950.0d0, olng, olat) + if (pmflag == YES) + call sl_f45z (olng, olat, sl_epb (SKY_EPOCH(cooout)), + olng, olat) + else + call sl_f45z (olng, olat, sl_epb (SKY_EPOCH(cooin)), + olng, olat) + + switch (SKY_RADECSYS(cooout)) { + + # The output coordinate system is FK4 with and without the E terms. + case EQTYPE_FK4, EQTYPE_FK4NOE: + call sl_f54z (olng, olat, sl_epb (SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), + olng, olat) + if (SKY_RADECSYS(cooout) == EQTYPE_FK4) + call sl_adet (olng, olat, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is FK5. + case EQTYPE_FK5: + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is ICRS (Hipparcos). + case EQTYPE_ICRS: + call sl_f5hz (olng, olat, 2000.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is geocentric apparent. + case EQTYPE_GAPPT: + call sl_map (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000.0d0, + SKY_EPOCH(cooout), olng, olat) + } + + # The input coordinate system is FK5 or geocentric apparent. + case EQTYPE_FK5, EQTYPE_GAPPT: + + if (SKY_RADECSYS(cooin) == EQTYPE_FK5) { + if (pmflag == YES) { + call sl_pm (ilng, ilat, ipmlng, ipmlat, px, rv, + sl_epj (SKY_EPOCH(cooin)), sl_epj (SKY_EPOCH(cooout)), + olng, olat) + } else { + olng = ilng + olat = ilat + } + } else + call sl_amp (ilng, ilat, SKY_EPOCH(cooin), 2000.0d0, olng, olat) + + switch (SKY_RADECSYS(cooout)) { + + # The output coordinate system is FK4 with or without the E terms. + case EQTYPE_FK4, EQTYPE_FK4NOE: + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_f54z (olng, olat, sl_epb(SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), olng, olat) + if (SKY_RADECSYS(cooout) == EQTYPE_FK4) + call sl_adet (olng, olat, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is FK5. + case EQTYPE_FK5: + if (SKY_EQUINOX(cooin) != SKY_EQUINOX(cooout)) + call sl_prcs (2, SKY_EQUINOX(cooin), SKY_EQUINOX(cooout), + olng, olat) + + # The output coordinate system is ICRS. + case EQTYPE_ICRS: + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_f5hz (olng, olat, sl_epj(SKY_EPOCH(cooin)), olng, olat) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is geocentric apparent. + case EQTYPE_GAPPT: + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_map (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000.0d0, + SKY_EPOCH(cooout), olng, olat) + } + + # The input coordinate system is ICRS. + case EQTYPE_ICRS: + + if (pmflag == YES) { + call sl_pm (ilng, ilat, ipmlng, ipmlat, px, rv, + sl_epj (SKY_EPOCH(cooin)), sl_epj (SKY_EPOCH(cooout)), + olng, olat) + } else { + olng = ilng + olat = ilat + } + + switch (SKY_RADECSYS(cooout)) { + + # The output coordinate system is FK4 with or without the E terms. + case EQTYPE_FK4, EQTYPE_FK4NOE: + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_hf5z (olng, olat, 2000.0d0, olng, olat, + pmr, pmd) + call sl_f54z (olng, olat, sl_epb(SKY_EPOCH(cooout)), olng, olat, + pmr, pmd) + call sl_suet (olng, olat, 1950.0d0, olng, olat) + if (SKY_EQUINOX(cooout) != 1950.0d0) + call sl_prcs (1, 1950.0d0, SKY_EQUINOX(cooout), olng, olat) + if (SKY_RADECSYS(cooout) == EQTYPE_FK4) + call sl_adet (olng, olat, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is FK5. + case EQTYPE_FK5: + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_hf5z (olng, olat, sl_epj(SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + if (SKY_EQUINOX(cooout) != 2000.0d0) + call sl_prcs (2, 2000.0d0, SKY_EQUINOX(cooout), olng, olat) + + # The output coordinate system is ICRS. + case EQTYPE_ICRS: + if (SKY_EQUINOX(cooin) != SKY_EQUINOX(cooout)) + call sl_prcs (2, SKY_EQUINOX(cooin), SKY_EQUINOX(cooout), + olng, olat) + + # The output coordinate system is geocentric apparent. + case EQTYPE_GAPPT: + if (SKY_EQUINOX(cooin) != 2000.0d0) + call sl_prcs (2, SKY_EQUINOX(cooin), 2000.0d0, olng, olat) + call sl_hf5z (olng, olat, sl_epj(SKY_EPOCH(cooout)), + olng, olat, pmr, pmd) + call sl_map (olng, olat, 0.0d0, 0.0d0, px, 0.0d0, 2000.0d0, + SKY_EPOCH(cooout), olng, olat) + + } + + } +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.f new file mode 100644 index 00000000..41fd369e --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.f @@ -0,0 +1,45 @@ + integer function skwrdr (index, outstr, maxch, dict) + integer index + integer maxch + integer*2 outstr(*) + integer*2 dict(*) + integer i + integer len + integer start + integer count + integer xstrln + save + outstr(1) = 0 + if (.not.(dict(1) .eq. 0)) goto 110 + skwrdr = (0) + goto 100 +110 continue + count = 1 + len = xstrln(dict) + start = 2 +120 if (.not.(count .lt. index)) goto 122 + if (.not.(dict(start) .eq. dict(1))) goto 130 + count = count + 1 +130 continue + if (.not.(start .eq. len)) goto 140 + skwrdr = (0) + goto 100 +140 continue +121 start = start + 1 + goto 120 +122 continue + i = start +150 if (.not.(dict(i) .ne. 0 .and. dict(i) .ne. dict(1))) goto 152 + if (.not.(i - start + 1 .gt. maxch)) goto 160 + goto 152 +160 continue + outstr(i - start + 1) = dict(i) +151 i = i + 1 + goto 150 +152 continue + outstr(i - start + 1) = 0 + skwrdr = (count) + goto 100 +100 return + end +c skwrdr sk_wrdstr diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.x new file mode 100644 index 00000000..a7c6b359 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrdstr.x @@ -0,0 +1,53 @@ + +# SK_WRDSTR -- Search a dictionary string for a given string index number. +# This is the opposite function of strdic(), that returns the index for +# given string. The entries in the dictionary string are separated by +# a delimiter character which is the first character of the dictionary +# string. The index of the string found is returned as the function value. +# Otherwise, if there is no string for that index, a zero is returned. + +int procedure sk_wrdstr (index, outstr, maxch, dict) + +int index #I the string index +char outstr[ARB] #O the output string as found in dictionary +int maxch #I the maximum length of output string +char dict[ARB] #I the dictionary string + +int i, len, start, count + +int strlen() + +begin + # Clear output string + outstr[1] = EOS + + # Return if the dictionary is not long enough + if (dict[1] == EOS) + return (0) + + # Initialize counters + count = 1 + len = strlen (dict) + + # Search the dictionary string. This loop only terminates + # successfully if the index is found. Otherwise the procedure + # returns with and error condition. + for (start = 2; count < index; start = start + 1) { + if (dict[start] == dict[1]) + count = count + 1 + if (start == len) + return (0) + } + + # Extract the output string from the dictionary + for (i = start; dict[i] != EOS && dict[i] != dict[1]; i = i + 1) { + if (i - start + 1 > maxch) + break + outstr[i - start + 1] = dict[i] + } + + outstr[i - start + 1] = EOS + + # Return index for output string + return (count) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.f b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.f new file mode 100644 index 00000000..223f8f1e --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.f @@ -0,0 +1,1014 @@ + subroutine skiipt (label, images, mw, coo) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer mw + integer coo + integer*2 label(*) + integer*2 images(*) + save + if (.not.(mw .eq. 0)) goto 110 + call skinpt (label, images, memi(coo+12) , memi(coo+13) , + * memd((((coo+8)-1)/2+1)) , memd((((coo+10)-1)/2+1)) ) + goto 111 +110 continue + call skimpt (label, images, memi(coo+12) , memi(coo+15) , + * memi(coo+16) , memi(coo+14) , memi(coo+19) , memi(coo+13) , + * memd((((coo+8)-1)/2+1)) , memd((((coo+10)-1)/2+1)) ) +111 continue +100 return + end + subroutine skiiwe (fd, label, images, mw, coo) + integer fd + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer mw + integer coo + integer*2 label(*) + integer*2 images(*) + save + if (.not.(mw .eq. 0)) goto 110 + call skinwe (fd, label, images, memi(coo+12) , memi(coo+13) + * , memd((((coo+8)-1)/2+1)) , memd((((coo+10)-1)/2+1)) ) + goto 111 +110 continue + call skimwe (fd, label, images, memi(coo+12) , memi(coo+15) + * , memi(coo+16) , memi(coo+14) , memi(coo+19) , memi(coo+13) + * , memd((((coo+8)-1)/2+1)) , memd((((coo+10)-1)/2+1)) ) +111 continue +100 return + end + subroutine skinpt (label, system, ctype, radecs, equinx, epoch) + integer ctype + integer radecs + double precision equinx + double precision epoch + integer*2 label(*) + integer*2 system(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer radecr + double precision slepj + double precision slepb + integer skwrdr + integer sw0001,sw0002 + integer*2 st0001(30) + integer*2 st0002(4) + integer*2 st0003(36) + integer*2 st0004(37) + integer*2 st0005(46) + integer*2 st0006(46) + integer*2 st0007(31) + integer*2 st0008(37) + integer*2 st0009(31) + integer*2 st0010(37) + integer*2 st0011(36) + integer*2 st0012(37) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0001(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0001(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0001(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0002 / 70, 75, 53, 0/ + data (st0003(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 32/ + data (st0003(iyy),iyy= 9,16) / 67,111,111,114,100,105,110, 97/ + data (st0003(iyy),iyy=17,24) /116,101,115, 58, 32,101,113,117/ + data (st0003(iyy),iyy=25,32) / 97,116,111,114,105, 97,108, 32/ + data (st0003(iyy),iyy=33,36) / 37,115, 10, 0/ + data (st0004(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0004(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0004(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0004(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0004(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + data (st0005(iyy),iyy= 1, 8) / 32, 32, 32, 32, 69,113,117,105/ + data (st0005(iyy),iyy= 9,16) /110,111,120, 58, 32, 74, 37, 48/ + data (st0005(iyy),iyy=17,24) / 46, 51,102, 32, 69,112,111, 99/ + data (st0005(iyy),iyy=25,32) /104, 58, 32, 74, 37, 48, 46, 56/ + data (st0005(iyy),iyy=33,40) /102, 32, 77, 74, 68, 58, 32, 37/ + data (st0005(iyy),iyy=41,46) / 48, 46, 53,102, 10, 0/ + data (st0006(iyy),iyy= 1, 8) / 32, 32, 32, 32, 69,113,117,105/ + data (st0006(iyy),iyy= 9,16) /110,111,120, 58, 32, 66, 37, 48/ + data (st0006(iyy),iyy=17,24) / 46, 51,102, 32, 69,112,111, 99/ + data (st0006(iyy),iyy=25,32) /104, 58, 32, 66, 37, 48, 46, 56/ + data (st0006(iyy),iyy=33,40) /102, 32, 77, 74, 68, 58, 32, 37/ + data (st0006(iyy),iyy=41,46) / 48, 46, 53,102, 10, 0/ + data (st0007(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 32/ + data (st0007(iyy),iyy= 9,16) / 67,111,111,114,100,105,110, 97/ + data (st0007(iyy),iyy=17,24) /116,101,115, 58, 32,101, 99,108/ + data (st0007(iyy),iyy=25,31) /105,112,116,105, 99, 10, 0/ + data (st0008(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0008(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0008(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0008(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0008(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + data (st0009(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 32/ + data (st0009(iyy),iyy= 9,16) / 67,111,111,114,100,105,110, 97/ + data (st0009(iyy),iyy=17,24) /116,101,115, 58, 32,103, 97,108/ + data (st0009(iyy),iyy=25,31) / 97, 99,116,105, 99, 10, 0/ + data (st0010(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0010(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0010(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0010(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0010(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + data (st0011(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 32/ + data (st0011(iyy),iyy= 9,16) / 67,111,111,114,100,105,110, 97/ + data (st0011(iyy),iyy=17,24) /116,101,115, 58, 32,115,117,112/ + data (st0011(iyy),iyy=25,32) /101,114,103, 97,108, 97, 99,116/ + data (st0011(iyy),iyy=33,36) /105, 99, 10, 0/ + data (st0012(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0012(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0012(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0012(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0012(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + call smark (sp) + call salloc (radecr, 255 , 2) + sw0001=(ctype) + goto 110 +120 continue + if (.not.(skwrdr (radecs, memc(radecr), 255 , st0001) .le. 0 + * )) goto 130 + call xstrcy(st0002, memc(radecr), 255 ) +130 continue + call strupr (memc(radecr)) + call xprinf(st0003) + call pargsr (label) + call pargsr (system) + call pargsr (memc(radecr)) + sw0002=(radecs) + goto 140 +150 continue + call xprinf(st0004) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 160 + call pargd (1.6d308) + call pargd (1.6d308) + goto 161 +160 continue + call pargd (slepj (epoch)) + call pargd (slepb (epoch)) +161 continue + goto 141 +170 continue + call xprinf(st0005) + call pargd (equinx) + call pargd (slepj(epoch)) + call pargd (epoch) + goto 141 +180 continue + call xprinf(st0006) + call pargd (equinx) + call pargd (slepb(epoch)) + call pargd (epoch) + goto 141 +140 continue + sw0002=sw0002-2 + if (sw0002.lt.1.or.sw0002.gt.3) goto 180 + goto (170,170,150),sw0002 +141 continue + goto 111 +190 continue + call xprinf(st0007) + call pargsr (label) + call pargsr (system) + call xprinf(st0008) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 200 + call pargd (1.6d308) + call pargd (1.6d308) + goto 201 +200 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +201 continue + goto 111 +210 continue + call xprinf(st0009) + call pargsr (label) + call pargsr (system) + call xprinf(st0010) + call pargd (epoch) + call pargd (slepj (epoch)) + call pargd (slepb (epoch)) + goto 111 +220 continue + call xprinf(st0011) + call pargsr (label) + call pargsr (system) + call xprinf(st0012) + call pargd (epoch) + call pargd (slepj (epoch)) + call pargd (slepb (epoch)) + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 111 + goto (120,190,210,220),sw0001 +111 continue + call sfree (sp) +100 return + end + subroutine skinwe (fd, label, system, ctype, radecs, equinx, epoch + *) + integer fd + integer ctype + integer radecs + double precision equinx + double precision epoch + integer*2 label(*) + integer*2 system(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer radecr + double precision slepj + double precision slepb + integer skwrdr + integer sw0001,sw0002 + integer*2 st0001(30) + integer*2 st0002(4) + integer*2 st0003(38) + integer*2 st0004(39) + integer*2 st0005(48) + integer*2 st0006(48) + integer*2 st0007(33) + integer*2 st0008(39) + integer*2 st0009(33) + integer*2 st0010(39) + integer*2 st0011(38) + integer*2 st0012(39) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0001(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0001(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0001(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0002 / 70, 75, 53, 0/ + data (st0003(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0003(iyy),iyy= 9,16) / 32, 32, 67,111,111,114,100,105/ + data (st0003(iyy),iyy=17,24) /110, 97,116,101,115, 58, 32,101/ + data (st0003(iyy),iyy=25,32) /113,117, 97,116,111,114,105, 97/ + data (st0003(iyy),iyy=33,38) /108, 32, 37,115, 10, 0/ + data (st0004(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0004(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0004(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0004(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0004(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + data (st0005(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 69,113/ + data (st0005(iyy),iyy= 9,16) /117,105,110,111,120, 58, 32, 74/ + data (st0005(iyy),iyy=17,24) / 37, 48, 46, 51,102, 32, 69,112/ + data (st0005(iyy),iyy=25,32) /111, 99,104, 58, 32, 74, 37, 48/ + data (st0005(iyy),iyy=33,40) / 46, 56,102, 32, 77, 74, 68, 58/ + data (st0005(iyy),iyy=41,48) / 32, 37, 48, 46, 53,102, 10, 0/ + data (st0006(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 69,113/ + data (st0006(iyy),iyy= 9,16) /117,105,110,111,120, 58, 32, 66/ + data (st0006(iyy),iyy=17,24) / 37, 48, 46, 51,102, 32, 69,112/ + data (st0006(iyy),iyy=25,32) /111, 99,104, 58, 32, 66, 37, 48/ + data (st0006(iyy),iyy=33,40) / 46, 56,102, 32, 77, 74, 68, 58/ + data (st0006(iyy),iyy=41,48) / 32, 37, 48, 46, 53,102, 10, 0/ + data (st0007(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0007(iyy),iyy= 9,16) / 32, 32, 67,111,111,114,100,105/ + data (st0007(iyy),iyy=17,24) /110, 97,116,101,115, 58, 32,101/ + data (st0007(iyy),iyy=25,32) / 99,108,105,112,116,105, 99, 10/ + data (st0007(iyy),iyy=33,33) / 0/ + data (st0008(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0008(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0008(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0008(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0008(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + data (st0009(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0009(iyy),iyy= 9,16) / 32, 32, 67,111,111,114,100,105/ + data (st0009(iyy),iyy=17,24) /110, 97,116,101,115, 58, 32,103/ + data (st0009(iyy),iyy=25,32) / 97,108, 97, 99,116,105, 99, 10/ + data (st0009(iyy),iyy=33,33) / 0/ + data (st0010(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0010(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0010(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0010(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0010(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + data (st0011(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0011(iyy),iyy= 9,16) / 32, 32, 67,111,111,114,100,105/ + data (st0011(iyy),iyy=17,24) /110, 97,116,101,115, 58, 32,115/ + data (st0011(iyy),iyy=25,32) /117,112,101,114,103, 97,108, 97/ + data (st0011(iyy),iyy=33,38) / 99,116,105, 99, 10, 0/ + data (st0012(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0012(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0012(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0012(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0012(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + call smark (sp) + call salloc (radecr, 255 , 2) + sw0001=(ctype) + goto 110 +120 continue + if (.not.(skwrdr (radecs, memc(radecr), 255 , st0001) .le. 0 + * )) goto 130 + call xstrcy(st0002, memc(radecr), 255 ) +130 continue + call strupr (memc(radecr)) + call fprinf (fd, st0003) + call pargsr (label) + call pargsr (system) + call pargsr (memc(radecr)) + sw0002=(radecs) + goto 140 +150 continue + call fprinf (fd, st0004) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 160 + call pargd (1.6d308) + call pargd (1.6d308) + goto 161 +160 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +161 continue + goto 141 +170 continue + call fprinf (fd, st0005) + call pargd (equinx) + call pargd (slepj(epoch)) + call pargd (epoch) + goto 141 +180 continue + call fprinf (fd, st0006) + call pargd (equinx) + call pargd (slepb(epoch)) + call pargd (epoch) + goto 141 +140 continue + sw0002=sw0002-2 + if (sw0002.lt.1.or.sw0002.gt.3) goto 180 + goto (170,170,150),sw0002 +141 continue + goto 111 +190 continue + call fprinf (fd, st0007) + call pargsr (label) + call pargsr (system) + call fprinf (fd, st0008) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 200 + call pargd (1.6d308) + call pargd (1.6d308) + goto 201 +200 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +201 continue + goto 111 +210 continue + call fprinf (fd, st0009) + call pargsr (label) + call pargsr (system) + call fprinf (fd, st0010) + call pargd (epoch) + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) + goto 111 +220 continue + call fprinf (fd, st0011) + call pargsr (label) + call pargsr (system) + call fprinf (fd, st0012) + call pargd (epoch) + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 111 + goto (120,190,210,220),sw0001 +111 continue + call sfree (sp) +100 return + end + subroutine skimpt (label, images, ctype, lngax, latax, wtype, + *ptype, radecs, equinx, epoch) + integer ctype + integer lngax + integer latax + integer wtype + integer ptype + integer radecs + double precision equinx + double precision epoch + integer*2 label(*) + integer*2 images(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer imname + integer projsr + integer wcsstr + integer radecr + double precision slepj + double precision slepb + integer skwrdr + integer sw0001,sw0002 + integer*2 st0001(114) + integer*2 st0002(7) + integer*2 st0003(28) + integer*2 st0004(6) + integer*2 st0005(30) + integer*2 st0006(4) + integer*2 st0007(47) + integer*2 st0008(32) + integer*2 st0009(37) + integer*2 st0010(48) + integer*2 st0011(30) + integer*2 st0012(48) + integer*2 st0013(30) + integer*2 st0014(51) + integer*2 st0015(27) + integer*2 st0016(37) + integer*2 st0017(51) + integer*2 st0018(27) + integer*2 st0019(38) + integer*2 st0020(51) + integer*2 st0021(32) + integer*2 st0022(37) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /124,108,105,110,124, 97,122,112/ + data (st0001(iyy),iyy= 9,16) /124,116, 97,110,124,115,105,110/ + data (st0001(iyy),iyy=17,24) /124,115,116,103,124, 97,114, 99/ + data (st0001(iyy),iyy=25,32) /124,122,112,110,124,122,101, 97/ + data (st0001(iyy),iyy=33,40) /124, 97,105,114,124, 99,121,112/ + data (st0001(iyy),iyy=41,48) /124, 99, 97,114,124,109,101,114/ + data (st0001(iyy),iyy=49,56) /124, 99,101, 97,124, 99,111,112/ + data (st0001(iyy),iyy=57,64) /124, 99,111,100,124, 99,111,101/ + data (st0001(iyy),iyy=65,72) /124, 99,111,111,124, 98,111,110/ + data (st0001(iyy),iyy=73,80) /124,112, 99,111,124,103,108,115/ + data (st0001(iyy),iyy=81,88) /124,112, 97,114,124, 97,105,116/ + data (st0001(iyy),iyy=89,96) /124,109,111,108,124, 99,115, 99/ + data (st0001(iyy),iyy=97,104) /124,113,115, 99,124,116,115, 99/ + data (st0001(iyy),iyy=105,112) /124,116,110,120,124,122,112,120/ + data (st0001(iyy),iyy=113,114) /124, 0/ + data st0002 /108,105,110,101, 97,114, 0/ + data (st0003(iyy),iyy= 1, 8) /124,108,111,103,105, 99, 97,108/ + data (st0003(iyy),iyy= 9,16) /124,116,118,124,112,104,121,115/ + data (st0003(iyy),iyy=17,24) /105, 99, 97,108,124,119,111,114/ + data (st0003(iyy),iyy=25,28) /108,100,124, 0/ + data st0004 /119,111,114,108,100, 0/ + data (st0005(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0005(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0005(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0005(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0006 / 70, 75, 53, 0/ + data (st0007(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 37/ + data (st0007(iyy),iyy= 9,16) /115, 32, 32, 80,114,111,106,101/ + data (st0007(iyy),iyy=17,24) / 99,116,105,111,110, 58, 32, 37/ + data (st0007(iyy),iyy=25,32) /115, 32, 32, 82, 97, 47, 68,101/ + data (st0007(iyy),iyy=33,40) / 99, 32, 97,120,101,115, 58, 32/ + data (st0007(iyy),iyy=41,47) / 37,100, 47, 37,100, 10, 0/ + data (st0008(iyy),iyy= 1, 8) / 32, 32, 32, 32, 67,111,111,114/ + data (st0008(iyy),iyy= 9,16) /100,105,110, 97,116,101,115, 58/ + data (st0008(iyy),iyy=17,24) / 32,101,113,117, 97,116,111,114/ + data (st0008(iyy),iyy=25,32) /105, 97,108, 32, 37,115, 10, 0/ + data (st0009(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0009(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0009(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0009(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0009(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + data (st0010(iyy),iyy= 1, 8) / 32, 32, 32, 32, 67,111,111,114/ + data (st0010(iyy),iyy= 9,16) /100,105,110, 97,116,101,115, 58/ + data (st0010(iyy),iyy=17,24) / 32,101,113,117, 97,116,111,114/ + data (st0010(iyy),iyy=25,32) /105, 97,108, 32, 37,115, 32, 69/ + data (st0010(iyy),iyy=33,40) /113,117,105,110,111,120, 58, 32/ + data (st0010(iyy),iyy=41,48) / 74, 37, 48, 46, 51,102, 10, 0/ + data (st0011(iyy),iyy= 1, 8) / 32, 32, 32, 32, 69,112,111, 99/ + data (st0011(iyy),iyy= 9,16) /104, 58, 32, 74, 37, 48, 46, 56/ + data (st0011(iyy),iyy=17,24) /102, 32, 77, 74, 68, 58, 32, 37/ + data (st0011(iyy),iyy=25,30) / 48, 46, 53,102, 10, 0/ + data (st0012(iyy),iyy= 1, 8) / 32, 32, 32, 32, 67,111,111,114/ + data (st0012(iyy),iyy= 9,16) /100,105,110, 97,116,101,115, 58/ + data (st0012(iyy),iyy=17,24) / 32,101,113,117, 97,116,111,114/ + data (st0012(iyy),iyy=25,32) /105, 97,108, 32, 37,115, 32, 69/ + data (st0012(iyy),iyy=33,40) /113,117,105,110,111,120, 58, 32/ + data (st0012(iyy),iyy=41,48) / 66, 37, 48, 46, 51,102, 10, 0/ + data (st0013(iyy),iyy= 1, 8) / 32, 32, 32, 32, 69,112,111, 99/ + data (st0013(iyy),iyy= 9,16) /104, 58, 32, 66, 37, 48, 46, 56/ + data (st0013(iyy),iyy=17,24) /102, 32, 77, 74, 68, 58, 32, 37/ + data (st0013(iyy),iyy=25,30) / 48, 46, 53,102, 10, 0/ + data (st0014(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 37/ + data (st0014(iyy),iyy= 9,16) /115, 32, 32, 80,114,111,106,101/ + data (st0014(iyy),iyy=17,24) / 99,116,105,111,110, 58, 32, 37/ + data (st0014(iyy),iyy=25,32) /115, 32, 32, 69,108,111,110,103/ + data (st0014(iyy),iyy=33,40) / 47, 69,108, 97,116, 32, 97,120/ + data (st0014(iyy),iyy=41,48) /101,115, 58, 32, 37,100, 47, 37/ + data (st0014(iyy),iyy=49,51) /100, 10, 0/ + data (st0015(iyy),iyy= 1, 8) / 32, 32, 32, 32, 67,111,111,114/ + data (st0015(iyy),iyy= 9,16) /100,105,110, 97,116,101,115, 58/ + data (st0015(iyy),iyy=17,24) / 32,101, 99,108,105,112,116,105/ + data (st0015(iyy),iyy=25,27) / 99, 10, 0/ + data (st0016(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0016(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0016(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0016(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0016(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + data (st0017(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 37/ + data (st0017(iyy),iyy= 9,16) /115, 32, 32, 80,114,111,106,101/ + data (st0017(iyy),iyy=17,24) / 99,116,105,111,110, 58, 32, 37/ + data (st0017(iyy),iyy=25,32) /115, 32, 32, 71,108,111,110,103/ + data (st0017(iyy),iyy=33,40) / 47, 71,108, 97,116, 32, 97,120/ + data (st0017(iyy),iyy=41,48) /101,115, 58, 32, 37,100, 47, 37/ + data (st0017(iyy),iyy=49,51) /100, 10, 0/ + data (st0018(iyy),iyy= 1, 8) / 32, 32, 32, 32, 67,111,111,114/ + data (st0018(iyy),iyy= 9,16) /100,105,110, 97,116,101,115, 58/ + data (st0018(iyy),iyy=17,24) / 32,103, 97,108, 97, 99,116,105/ + data (st0018(iyy),iyy=25,27) / 99, 10, 0/ + data (st0019(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0019(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 32/ + data (st0019(iyy),iyy=17,24) / 69,112,111, 99,104, 58, 32, 74/ + data (st0019(iyy),iyy=25,32) / 37, 48, 46, 56,102, 32, 66, 37/ + data (st0019(iyy),iyy=33,38) / 48, 46, 56,102, 10, 0/ + data (st0020(iyy),iyy= 1, 8) / 37,115, 58, 32, 37,115, 32, 37/ + data (st0020(iyy),iyy= 9,16) /115, 32, 32, 80,114,111,106,101/ + data (st0020(iyy),iyy=17,24) / 99,116,105,111,110, 58, 32, 37/ + data (st0020(iyy),iyy=25,32) /115, 32, 32, 83,108,111,110,103/ + data (st0020(iyy),iyy=33,40) / 47, 83,108, 97,116, 32, 97,120/ + data (st0020(iyy),iyy=41,48) /101,115, 58, 32, 37,100, 47, 37/ + data (st0020(iyy),iyy=49,51) /100, 10, 0/ + data (st0021(iyy),iyy= 1, 8) / 32, 32, 32, 32, 67,111,111,114/ + data (st0021(iyy),iyy= 9,16) /100,105,110, 97,116,101,115, 58/ + data (st0021(iyy),iyy=17,24) / 32,115,117,112,101,114,103, 97/ + data (st0021(iyy),iyy=25,32) /108, 97, 99,116,105, 99, 10, 0/ + data (st0022(iyy),iyy= 1, 8) / 32, 32, 32, 32, 77, 74, 68, 58/ + data (st0022(iyy),iyy= 9,16) / 32, 37, 48, 46, 53,102, 32, 69/ + data (st0022(iyy),iyy=17,24) /112,111, 99,104, 58, 32, 74, 37/ + data (st0022(iyy),iyy=25,32) / 48, 46, 56,102, 32, 66, 37, 48/ + data (st0022(iyy),iyy=33,37) / 46, 56,102, 10, 0/ + call smark (sp) + call salloc (imname, 255 , 2) + call salloc (projsr, 255 , 2) + call salloc (wcsstr, 255 , 2) + call salloc (radecr, 255 , 2) + call sscan (images) + call gargwd (memc(imname), 255 ) + if (.not.(skwrdr (wtype, memc(projsr), 255 , st0001) .le. 0)) + * goto 110 + call xstrcy(st0002, memc(projsr), 255 ) +110 continue + call strupr (memc(projsr)) + if (.not.(skwrdr (ptype, memc(wcsstr), 255 , st0003) .le. 0)) + * goto 120 + call xstrcy(st0004, memc(wcsstr), 255 ) +120 continue + call strlwr (memc(wcsstr)) + sw0001=(ctype) + goto 130 +140 continue + if (.not.(skwrdr (radecs, memc(radecr), 255 , st0005) .le. 0 + * )) goto 150 + call xstrcy(st0006, memc(radecr), 255 ) +150 continue + call strupr (memc(radecr)) + call xprinf( st0007) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + sw0002=(radecs) + goto 160 +170 continue + call xprinf(st0008) + call pargsr (memc(radecr)) + call xprinf(st0009) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 180 + call pargd (1.6d308) + call pargd (1.6d308) + goto 181 +180 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +181 continue + goto 161 +190 continue + call xprinf(st0010) + call pargsr (memc(radecr)) + call pargd (equinx) + call xprinf(st0011) + call pargd (slepj (epoch)) + call pargd (epoch) + goto 161 +200 continue + call xprinf(st0012) + call pargsr (memc(radecr)) + call pargd (equinx) + call xprinf(st0013) + call pargd (slepb (epoch)) + call pargd (epoch) + goto 161 +160 continue + sw0002=sw0002-2 + if (sw0002.lt.1.or.sw0002.gt.3) goto 200 + goto (190,190,170),sw0002 +161 continue + goto 131 +210 continue + call xprinf( st0014) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + call xprinf(st0015) + call xprinf(st0016) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 220 + call pargd (1.6d308) + call pargd (1.6d308) + goto 221 +220 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +221 continue + goto 131 +230 continue + call xprinf( st0017) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + call xprinf(st0018) + call xprinf(st0019) + call pargd (epoch) + call pargd (slepj (epoch)) + call pargd (slepb (epoch)) + goto 131 +240 continue + call xprinf( st0020) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + call xprinf(st0021) + call xprinf(st0022) + call pargd (epoch) + call pargd (slepj (epoch)) + call pargd (slepb (epoch)) + goto 131 +130 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 131 + goto (140,210,230,240),sw0001 +131 continue + call sfree (sp) +100 return + end + subroutine skimwe (fd, label, images, ctype, lngax, latax, wtype, + *ptype, radecs, equinx, epoch) + integer fd + integer ctype + integer lngax + integer latax + integer wtype + integer ptype + integer radecs + double precision equinx + double precision epoch + integer*2 label(*) + integer*2 images(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer imname + integer projsr + integer wcsstr + integer radecr + double precision slepj + double precision slepb + integer skwrdr + integer sw0001,sw0002 + integer*2 st0001(114) + integer*2 st0002(7) + integer*2 st0003(28) + integer*2 st0004(6) + integer*2 st0005(30) + integer*2 st0006(4) + integer*2 st0007(49) + integer*2 st0008(34) + integer*2 st0009(39) + integer*2 st0010(50) + integer*2 st0011(32) + integer*2 st0012(50) + integer*2 st0013(32) + integer*2 st0014(53) + integer*2 st0015(29) + integer*2 st0016(40) + integer*2 st0017(53) + integer*2 st0018(29) + integer*2 st0019(39) + integer*2 st0020(53) + integer*2 st0021(34) + integer*2 st0022(39) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /124,108,105,110,124, 97,122,112/ + data (st0001(iyy),iyy= 9,16) /124,116, 97,110,124,115,105,110/ + data (st0001(iyy),iyy=17,24) /124,115,116,103,124, 97,114, 99/ + data (st0001(iyy),iyy=25,32) /124,122,112,110,124,122,101, 97/ + data (st0001(iyy),iyy=33,40) /124, 97,105,114,124, 99,121,112/ + data (st0001(iyy),iyy=41,48) /124, 99, 97,114,124,109,101,114/ + data (st0001(iyy),iyy=49,56) /124, 99,101, 97,124, 99,111,112/ + data (st0001(iyy),iyy=57,64) /124, 99,111,100,124, 99,111,101/ + data (st0001(iyy),iyy=65,72) /124, 99,111,111,124, 98,111,110/ + data (st0001(iyy),iyy=73,80) /124,112, 99,111,124,103,108,115/ + data (st0001(iyy),iyy=81,88) /124,112, 97,114,124, 97,105,116/ + data (st0001(iyy),iyy=89,96) /124,109,111,108,124, 99,115, 99/ + data (st0001(iyy),iyy=97,104) /124,113,115, 99,124,116,115, 99/ + data (st0001(iyy),iyy=105,112) /124,116,110,120,124,122,112,120/ + data (st0001(iyy),iyy=113,114) /124, 0/ + data st0002 /108,105,110,101, 97,114, 0/ + data (st0003(iyy),iyy= 1, 8) /124,108,111,103,105, 99, 97,108/ + data (st0003(iyy),iyy= 9,16) /124,116,118,124,112,104,121,115/ + data (st0003(iyy),iyy=17,24) /105, 99, 97,108,124,119,111,114/ + data (st0003(iyy),iyy=25,28) /108,100,124, 0/ + data st0004 /119,111,114,108,100, 0/ + data (st0005(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0005(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0005(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0005(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0006 / 70, 75, 53, 0/ + data (st0007(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0007(iyy),iyy= 9,16) / 32, 37,115, 32, 32, 80,114,111/ + data (st0007(iyy),iyy=17,24) /106,101, 99,116,105,111,110, 58/ + data (st0007(iyy),iyy=25,32) / 32, 37,115, 32, 32, 82, 97, 47/ + data (st0007(iyy),iyy=33,40) / 68,101, 99, 32, 97,120,101,115/ + data (st0007(iyy),iyy=41,48) / 58, 32, 37,100, 47, 37,100, 10/ + data (st0007(iyy),iyy=49,49) / 0/ + data (st0008(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 67,111/ + data (st0008(iyy),iyy= 9,16) /111,114,100,105,110, 97,116,101/ + data (st0008(iyy),iyy=17,24) /115, 58, 32,101,113,117, 97,116/ + data (st0008(iyy),iyy=25,32) /111,114,105, 97,108, 32, 37,115/ + data (st0008(iyy),iyy=33,34) / 10, 0/ + data (st0009(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0009(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0009(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0009(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0009(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + data (st0010(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 67,111/ + data (st0010(iyy),iyy= 9,16) /111,114,100,105,110, 97,116,101/ + data (st0010(iyy),iyy=17,24) /115, 58, 32,101,113,117, 97,116/ + data (st0010(iyy),iyy=25,32) /111,114,105, 97,108, 32, 37,115/ + data (st0010(iyy),iyy=33,40) / 32, 69,113,117,105,110,111,120/ + data (st0010(iyy),iyy=41,48) / 58, 32, 74, 37, 48, 46, 51,102/ + data (st0010(iyy),iyy=49,50) / 10, 0/ + data (st0011(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 69,112/ + data (st0011(iyy),iyy= 9,16) /111, 99,104, 58, 32, 74, 37, 48/ + data (st0011(iyy),iyy=17,24) / 46, 56,102, 32, 77, 74, 68, 58/ + data (st0011(iyy),iyy=25,32) / 32, 37, 48, 46, 53,102, 10, 0/ + data (st0012(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 67,111/ + data (st0012(iyy),iyy= 9,16) /111,114,100,105,110, 97,116,101/ + data (st0012(iyy),iyy=17,24) /115, 58, 32,101,113,117, 97,116/ + data (st0012(iyy),iyy=25,32) /111,114,105, 97,108, 32, 37,115/ + data (st0012(iyy),iyy=33,40) / 32, 69,113,117,105,110,111,120/ + data (st0012(iyy),iyy=41,48) / 58, 32, 66, 37, 48, 46, 51,102/ + data (st0012(iyy),iyy=49,50) / 10, 0/ + data (st0013(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 69,112/ + data (st0013(iyy),iyy= 9,16) /111, 99,104, 58, 32, 66, 37, 48/ + data (st0013(iyy),iyy=17,24) / 46, 56,102, 32, 77, 74, 68, 58/ + data (st0013(iyy),iyy=25,32) / 32, 37, 48, 46, 53,102, 10, 0/ + data (st0014(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0014(iyy),iyy= 9,16) / 32, 37,115, 32, 32, 80,114,111/ + data (st0014(iyy),iyy=17,24) /106,101, 99,116,105,111,110, 58/ + data (st0014(iyy),iyy=25,32) / 32, 37,115, 32, 32, 69,108,111/ + data (st0014(iyy),iyy=33,40) /110,103, 47, 69,108, 97,116, 32/ + data (st0014(iyy),iyy=41,48) / 97,120,101,115, 58, 32, 37,100/ + data (st0014(iyy),iyy=49,53) / 47, 37,100, 10, 0/ + data (st0015(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 67,111/ + data (st0015(iyy),iyy= 9,16) /111,114,100,105,110, 97,116,101/ + data (st0015(iyy),iyy=17,24) /115, 58, 32,101, 99,108,105,112/ + data (st0015(iyy),iyy=25,29) /116,105, 99, 10, 0/ + data (st0016(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0016(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0016(iyy),iyy=17,24) / 32, 32, 69,112,111, 99,104, 58/ + data (st0016(iyy),iyy=25,32) / 32, 74, 37, 48, 46, 56,102, 32/ + data (st0016(iyy),iyy=33,40) / 66, 37, 48, 46, 56,102, 10, 0/ + data (st0017(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0017(iyy),iyy= 9,16) / 32, 37,115, 32, 32, 80,114,111/ + data (st0017(iyy),iyy=17,24) /106,101, 99,116,105,111,110, 58/ + data (st0017(iyy),iyy=25,32) / 32, 37,115, 32, 32, 71,108,111/ + data (st0017(iyy),iyy=33,40) /110,103, 47, 71,108, 97,116, 32/ + data (st0017(iyy),iyy=41,48) / 97,120,101,115, 58, 32, 37,100/ + data (st0017(iyy),iyy=49,53) / 47, 37,100, 10, 0/ + data (st0018(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 67,111/ + data (st0018(iyy),iyy= 9,16) /111,114,100,105,110, 97,116,101/ + data (st0018(iyy),iyy=17,24) /115, 58, 32,103, 97,108, 97, 99/ + data (st0018(iyy),iyy=25,29) /116,105, 99, 10, 0/ + data (st0019(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0019(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0019(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0019(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0019(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + data (st0020(iyy),iyy= 1, 8) / 35, 32, 37,115, 58, 32, 37,115/ + data (st0020(iyy),iyy= 9,16) / 32, 37,115, 32, 32, 80,114,111/ + data (st0020(iyy),iyy=17,24) /106,101, 99,116,105,111,110, 58/ + data (st0020(iyy),iyy=25,32) / 32, 37,115, 32, 32, 83,108,111/ + data (st0020(iyy),iyy=33,40) /110,103, 47, 83,108, 97,116, 32/ + data (st0020(iyy),iyy=41,48) / 97,120,101,115, 58, 32, 37,100/ + data (st0020(iyy),iyy=49,53) / 47, 37,100, 10, 0/ + data (st0021(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 67,111/ + data (st0021(iyy),iyy= 9,16) /111,114,100,105,110, 97,116,101/ + data (st0021(iyy),iyy=17,24) /115, 58, 32,115,117,112,101,114/ + data (st0021(iyy),iyy=25,32) /103, 97,108, 97, 99,116,105, 99/ + data (st0021(iyy),iyy=33,34) / 10, 0/ + data (st0022(iyy),iyy= 1, 8) / 35, 32, 32, 32, 32, 32, 77, 74/ + data (st0022(iyy),iyy= 9,16) / 68, 58, 32, 37, 48, 46, 53,102/ + data (st0022(iyy),iyy=17,24) / 32, 69,112,111, 99,104, 58, 32/ + data (st0022(iyy),iyy=25,32) / 74, 37, 48, 46, 56,102, 32, 66/ + data (st0022(iyy),iyy=33,39) / 37, 48, 46, 56,102, 10, 0/ + call smark (sp) + call salloc (imname, 255 , 2) + call salloc (projsr, 255 , 2) + call salloc (wcsstr, 255 , 2) + call salloc (radecr, 255 , 2) + call sscan (images) + call gargwd (memc(imname), 255 ) + if (.not.(skwrdr (wtype, memc(projsr), 255 , st0001) .le. 0)) + * goto 110 + call xstrcy(st0002, memc(projsr), 255 ) +110 continue + call strupr (memc(projsr)) + if (.not.(skwrdr (ptype, memc(wcsstr), 255 , st0003) .le. 0)) + * goto 120 + call xstrcy(st0004, memc(wcsstr), 255 ) +120 continue + call strlwr (memc(wcsstr)) + sw0001=(ctype) + goto 130 +140 continue + if (.not.(skwrdr (radecs, memc(radecr), 255 , st0005) .le. 0 + * )) goto 150 + call xstrcy(st0006, memc(radecr), 255 ) +150 continue + call strupr (memc(radecr)) + call fprinf (fd, st0007) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + sw0002=(radecs) + goto 160 +170 continue + call fprinf (fd, st0008) + call pargsr (memc(radecr)) + call fprinf (fd, st0009) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 180 + call pargd (1.6d308) + call pargd (1.6d308) + goto 181 +180 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +181 continue + goto 161 +190 continue + call fprinf (fd, st0010) + call pargsr (memc(radecr)) + call pargd (equinx) + call fprinf (fd, st0011) + call pargd (slepj(epoch)) + call pargd (epoch) + goto 161 +200 continue + call fprinf (fd, st0012) + call pargsr (memc(radecr)) + call pargd (equinx) + call fprinf (fd, st0013) + call pargd (slepb (epoch)) + call pargd (epoch) + goto 161 +160 continue + sw0002=sw0002-2 + if (sw0002.lt.1.or.sw0002.gt.3) goto 200 + goto (190,190,170),sw0002 +161 continue + goto 131 +210 continue + call fprinf (fd, st0014) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + call fprinf (fd, st0015) + call fprinf (fd, st0016) + call pargd (epoch) + if (.not.(((epoch).eq.1.6d308))) goto 220 + call pargd (1.6d308) + call pargd (1.6d308) + goto 221 +220 continue + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) +221 continue + goto 131 +230 continue + call fprinf (fd, st0017) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + call fprinf (fd, st0018) + call fprinf (fd, st0019) + call pargd (epoch) + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) + goto 131 +240 continue + call fprinf (fd, st0020) + call pargsr (label) + call pargsr (memc(imname)) + call pargsr (memc(wcsstr)) + call pargsr (memc(projsr)) + call pargi (lngax) + call pargi (latax) + call fprinf (fd, st0021) + call fprinf (fd, st0022) + call pargd (epoch) + call pargd (slepj(epoch)) + call pargd (slepb(epoch)) + goto 131 +130 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 131 + goto (140,210,230,240),sw0001 +131 continue + call sfree (sp) +100 return + end +c radecs radecsys +c equinx equinox +c images imagesys +c skwrdr sk_wrdstr +c skiiwe sk_iiwrite +c skiipt sk_iiprint +c skimwe sk_imwrite +c skinwe sk_inwrite +c skimpt sk_imprint +c skinpt sk_inprint +c projsr projstr +c gargwd gargwrd +c fprinf fprintf +c radecr radecstr +c pargsr pargstr diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.x b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.x new file mode 100644 index 00000000..2e779b09 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skwrite.x @@ -0,0 +1,510 @@ +include "skywcsdef.h" +include "skywcs.h" + + +# SK_IIPRINT -- Print a summary of the input image or list coordinate system. + +procedure sk_iiprint (label, imagesys, mw, coo) + +char label[ARB] #I the input label +char imagesys[ARB] #I the input image name and wcs +pointer mw #I pointer to the image wcs +pointer coo #I pointer to the coordinate system structure + +begin + if (mw == NULL) + call sk_inprint (label, imagesys, SKY_CTYPE(coo), + SKY_RADECSYS(coo), SKY_EQUINOX(coo), SKY_EPOCH(coo)) + else + call sk_imprint (label, imagesys, SKY_CTYPE(coo), SKY_PLNGAX(coo), + SKY_PLATAX(coo), SKY_WTYPE(coo), SKY_PIXTYPE(coo), + SKY_RADECSYS(coo), SKY_EQUINOX(coo), SKY_EPOCH(coo)) +end + + +# SK_IIWRITE -- Write a summary of the input image or list coordinate system +# to the output file + +procedure sk_iiwrite (fd, label, imagesys, mw, coo) + +int fd #I the output file descriptor +char label[ARB] #I the input label +char imagesys[ARB] #I the input image name and wcs +pointer mw #I pointer to the image wcs +pointer coo #I pointer to the coordinate system structure + +begin + if (mw == NULL) + call sk_inwrite (fd, label, imagesys, SKY_CTYPE(coo), + SKY_RADECSYS(coo), SKY_EQUINOX(coo), SKY_EPOCH(coo)) + else + call sk_imwrite (fd, label, imagesys, SKY_CTYPE(coo), + SKY_PLNGAX(coo), SKY_PLATAX(coo), SKY_WTYPE(coo), + SKY_PIXTYPE(coo), SKY_RADECSYS(coo), SKY_EQUINOX(coo), + SKY_EPOCH(coo)) +end + + +# SK_INPRINT -- Print a summary of the input list coordinate system. +# This should probably be a call to sk_inwrite with the file descriptor +# set to STDOUT to avoid duplication of code. There was a reason for +# having two routines at one point but I can't remember what it was ... + +procedure sk_inprint (label, system, ctype, radecsys, equinox, epoch) + +char label[ARB] #I the input label +char system[ARB] #I the input system +int ctype #I the input coordinate type +int radecsys #I the input equatorial reference system +double equinox #I the input equinox +double epoch #I the input epoch of the observation + +pointer sp, radecstr +double sl_epj(), sl_epb() +int sk_wrdstr() + +begin + call smark (sp) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + switch (ctype) { + + case CTYPE_EQUATORIAL: + if (sk_wrdstr (radecsys, Memc[radecstr], SZ_FNAME, + EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call printf ("%s: %s Coordinates: equatorial %s\n") + call pargstr (label) + call pargstr (system) + call pargstr (Memc[radecstr]) + switch (radecsys) { + case EQTYPE_GAPPT: + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj (epoch)) + call pargd (sl_epb (epoch)) + } + case EQTYPE_FK5, EQTYPE_ICRS: + call printf (" Equinox: J%0.3f Epoch: J%0.8f MJD: %0.5f\n") + call pargd (equinox) + call pargd (sl_epj(epoch)) + call pargd (epoch) + default: + call printf (" Equinox: B%0.3f Epoch: B%0.8f MJD: %0.5f\n") + call pargd (equinox) + call pargd (sl_epb(epoch)) + call pargd (epoch) + } + + case CTYPE_ECLIPTIC: + call printf ("%s: %s Coordinates: ecliptic\n") + call pargstr (label) + call pargstr (system) + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + + case CTYPE_GALACTIC: + call printf ("%s: %s Coordinates: galactic\n") + call pargstr (label) + call pargstr (system) + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj (epoch)) + call pargd (sl_epb (epoch)) + + case CTYPE_SUPERGALACTIC: + call printf ("%s: %s Coordinates: supergalactic\n") + call pargstr (label) + call pargstr (system) + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj (epoch)) + call pargd (sl_epb (epoch)) + + } + + call sfree (sp) +end + + +# SK_INWRITE -- Write a summary of the input coordinate system. + +procedure sk_inwrite (fd, label, system, ctype, radecsys, equinox, epoch) + +int fd #I the output file descriptor +char label[ARB] #I the input label +char system[ARB] #I the input system +int ctype #I the input coordinate type +int radecsys #I the input equatorial reference system +double equinox #I the input equinox +double epoch #I the input epoch of the observation + +pointer sp, radecstr +double sl_epj(), sl_epb() +int sk_wrdstr() + +begin + call smark (sp) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + switch (ctype) { + + case CTYPE_EQUATORIAL: + if (sk_wrdstr (radecsys, Memc[radecstr], SZ_FNAME, + EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call fprintf (fd, "# %s: %s Coordinates: equatorial %s\n") + call pargstr (label) + call pargstr (system) + call pargstr (Memc[radecstr]) + switch (radecsys) { + case EQTYPE_GAPPT: + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + case EQTYPE_FK5, EQTYPE_ICRS: + call fprintf (fd, + "# Equinox: J%0.3f Epoch: J%0.8f MJD: %0.5f\n") + call pargd (equinox) + call pargd (sl_epj(epoch)) + call pargd (epoch) + default: + call fprintf (fd, + "# Equinox: B%0.3f Epoch: B%0.8f MJD: %0.5f\n") + call pargd (equinox) + call pargd (sl_epb(epoch)) + call pargd (epoch) + } + + case CTYPE_ECLIPTIC: + call fprintf (fd, "# %s: %s Coordinates: ecliptic\n") + call pargstr (label) + call pargstr (system) + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + + case CTYPE_GALACTIC: + call fprintf (fd, "# %s: %s Coordinates: galactic\n") + call pargstr (label) + call pargstr (system) + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + + case CTYPE_SUPERGALACTIC: + call fprintf (fd, "# %s: %s Coordinates: supergalactic\n") + call pargstr (label) + call pargstr (system) + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + + } + + call sfree (sp) +end + + +# SK_IMPRINT -- Print a summary of the input image coordinate system. +# This should probably be a call to sk_imwrite with the file descriptor +# set to STDOUT to avoid duplication of code. There was a reason for +# having two routines at one point but I can't remember what it was ... + +procedure sk_imprint (label, imagesys, ctype, lngax, latax, wtype, ptype, + radecsys, equinox, epoch) + +char label[ARB] #I input label +char imagesys[ARB] #I the input image name and system +int ctype #I the image coordinate type +int lngax #I the image ra/glon/elon axis +int latax #I the image dec/glat/elat axis +int wtype #I the image projection type +int ptype #I the image image wcs type +int radecsys #I the image equatorial reference system +double equinox #I the image equinox +double epoch #I the image epoch of the observation + +pointer sp, imname, projstr, wcsstr, radecstr +double sl_epj(), sl_epb() +int sk_wrdstr() + +begin + call smark (sp) + call salloc (imname, SZ_FNAME, TY_CHAR) + call salloc (projstr, SZ_FNAME, TY_CHAR) + call salloc (wcsstr, SZ_FNAME, TY_CHAR) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + call sscan (imagesys) + call gargwrd (Memc[imname], SZ_FNAME) + if (sk_wrdstr (wtype, Memc[projstr], SZ_FNAME, WTYPE_LIST) <= 0) + call strcpy ("linear", Memc[projstr], SZ_FNAME) + call strupr (Memc[projstr]) + if (sk_wrdstr (ptype, Memc[wcsstr], SZ_FNAME, PIXTYPE_LIST) <= 0) + call strcpy ("world", Memc[wcsstr], SZ_FNAME) + call strlwr (Memc[wcsstr]) + + switch (ctype) { + + case CTYPE_EQUATORIAL: + if (sk_wrdstr (radecsys, Memc[radecstr], SZ_FNAME, + EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call printf ( + "%s: %s %s Projection: %s Ra/Dec axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + switch (radecsys) { + case EQTYPE_GAPPT: + call printf (" Coordinates: equatorial %s\n") + call pargstr (Memc[radecstr]) + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + case EQTYPE_FK5, EQTYPE_ICRS: + call printf (" Coordinates: equatorial %s Equinox: J%0.3f\n") + call pargstr (Memc[radecstr]) + call pargd (equinox) + call printf (" Epoch: J%0.8f MJD: %0.5f\n") + call pargd (sl_epj (epoch)) + call pargd (epoch) + default: + call printf (" Coordinates: equatorial %s Equinox: B%0.3f\n") + call pargstr (Memc[radecstr]) + call pargd (equinox) + call printf (" Epoch: B%0.8f MJD: %0.5f\n") + call pargd (sl_epb (epoch)) + call pargd (epoch) + } + + case CTYPE_ECLIPTIC: + call printf ( + "%s: %s %s Projection: %s Elong/Elat axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + call printf (" Coordinates: ecliptic\n") + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + + case CTYPE_GALACTIC: + call printf ( + "%s: %s %s Projection: %s Glong/Glat axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + call printf (" Coordinates: galactic\n") + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj (epoch)) + call pargd (sl_epb (epoch)) + + case CTYPE_SUPERGALACTIC: + call printf ( + "%s: %s %s Projection: %s Slong/Slat axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + call printf (" Coordinates: supergalactic\n") + call printf (" MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj (epoch)) + call pargd (sl_epb (epoch)) + } + + call sfree (sp) +end + + +# SK_IMWRITE -- Write a summary of the image coordinate system to the +# output file. + +procedure sk_imwrite (fd, label, imagesys, ctype, lngax, latax, wtype, ptype, + radecsys, equinox, epoch) + +int fd #I the output file descriptor +char label[ARB] #I input label +char imagesys[ARB] #I the input image name and wcs +int ctype #I the image coordinate type +int lngax #I the image ra/glon/elon axis +int latax #I the image dec/glat/elat axis +int wtype #I the image projection type +int ptype #I the image image wcs type +int radecsys #I the image equatorial reference system +double equinox #I the image equinox +double epoch #I the image epoch of the observation + +pointer sp, imname, projstr, wcsstr, radecstr +double sl_epj(), sl_epb() +int sk_wrdstr() + +begin + call smark (sp) + call salloc (imname, SZ_FNAME, TY_CHAR) + call salloc (projstr, SZ_FNAME, TY_CHAR) + call salloc (wcsstr, SZ_FNAME, TY_CHAR) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + call sscan (imagesys) + call gargwrd (Memc[imname], SZ_FNAME) + if (sk_wrdstr (wtype, Memc[projstr], SZ_FNAME, WTYPE_LIST) <= 0) + call strcpy ("linear", Memc[projstr], SZ_FNAME) + call strupr (Memc[projstr]) + if (sk_wrdstr (ptype, Memc[wcsstr], SZ_FNAME, PIXTYPE_LIST) <= 0) + call strcpy ("world", Memc[wcsstr], SZ_FNAME) + call strlwr (Memc[wcsstr]) + + switch (ctype) { + + case CTYPE_EQUATORIAL: + if (sk_wrdstr (radecsys, Memc[radecstr], SZ_FNAME, + EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call fprintf (fd, + "# %s: %s %s Projection: %s Ra/Dec axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + switch (radecsys) { + case EQTYPE_GAPPT: + call fprintf (fd, "# Coordinates: equatorial %s\n") + call pargstr (Memc[radecstr]) + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + case EQTYPE_FK5, EQTYPE_ICRS: + call fprintf (fd, + "# Coordinates: equatorial %s Equinox: J%0.3f\n") + call pargstr (Memc[radecstr]) + call pargd (equinox) + call fprintf (fd, "# Epoch: J%0.8f MJD: %0.5f\n") + call pargd (sl_epj(epoch)) + call pargd (epoch) + default: + call fprintf (fd, + "# Coordinates: equatorial %s Equinox: B%0.3f\n") + call pargstr (Memc[radecstr]) + call pargd (equinox) + call fprintf (fd, "# Epoch: B%0.8f MJD: %0.5f\n") + call pargd (sl_epb (epoch)) + call pargd (epoch) + } + + case CTYPE_ECLIPTIC: + call fprintf (fd, + "# %s: %s %s Projection: %s Elong/Elat axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + call fprintf (fd, "# Coordinates: ecliptic\n") + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + if (IS_INDEFD(epoch)) { + call pargd (INDEFD) + call pargd (INDEFD) + } else { + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + + case CTYPE_GALACTIC: + call fprintf (fd, + "# %s: %s %s Projection: %s Glong/Glat axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + call fprintf (fd, "# Coordinates: galactic\n") + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + + case CTYPE_SUPERGALACTIC: + call fprintf (fd, + "# %s: %s %s Projection: %s Slong/Slat axes: %d/%d\n") + call pargstr (label) + call pargstr (Memc[imname]) + call pargstr (Memc[wcsstr]) + call pargstr (Memc[projstr]) + call pargi (lngax) + call pargi (latax) + call fprintf (fd, "# Coordinates: supergalactic\n") + call fprintf (fd, "# MJD: %0.5f Epoch: J%0.8f B%0.8f\n") + call pargd (epoch) + call pargd (sl_epj(epoch)) + call pargd (sl_epb(epoch)) + } + + call sfree (sp) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcs.h b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcs.h new file mode 100644 index 00000000..c0c6a3b7 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcs.h @@ -0,0 +1,132 @@ +# Public definitions file for the SKYWCS library. + +# Define the SKYWCS library parameters. + +define S_VXOFF 1 +define S_VYOFF 2 +define S_VXSTEP 3 +define S_VYSTEP 4 +define S_EQUINOX 5 +define S_EPOCH 6 +define S_CTYPE 7 +define S_RADECSYS 8 +define S_WTYPE 9 +define S_PLNGAX 10 +define S_PLATAX 11 +define S_XLAX 12 +define S_YLAX 13 +define S_PIXTYPE 14 +define S_NLNGAX 15 +define S_NLATAX 16 +define S_NLNGUNITS 17 +define S_NLATUNITS 18 +define S_COOSYSTEM 19 +define S_STATUS 20 + +# Define the list of supported fundamental coordinate systems. + +define FTYPE_LIST "|fk4|noefk4|fk5|icrs|apparent|ecliptic|galactic|\ +supergalactic|" + +define FTYPE_FK4 1 +define FTYPE_FK4NOE 2 +define FTYPE_FK5 3 +define FTYPE_ICRS 4 +define FTYPE_GAPPT 5 +define FTYPE_ECLIPTIC 6 +define FTYPE_GALACTIC 7 +define FTYPE_SUPERGALACTIC 8 + +# Define the list of supported coordinate systems. + +define CTYPE_LIST "|equatorial|ecliptic|galactic|supergalactic|" + +define CTYPE_EQUATORIAL 1 +define CTYPE_ECLIPTIC 2 +define CTYPE_GALACTIC 3 +define CTYPE_SUPERGALACTIC 4 + +# Define the supported equatoral reference systems. + +define EQTYPE_LIST "|fk4|fk4-no-e|fk5|icrs|gappt|" + +define EQTYPE_FK4 1 +define EQTYPE_FK4NOE 2 +define EQTYPE_FK5 3 +define EQTYPE_ICRS 4 +define EQTYPE_GAPPT 5 + +# Define the input coordinate file longitude latitude units. + +define SKY_LNG_UNITLIST "|degrees|radians|hours|" +define SKY_LAT_UNITLIST "|degrees|radians|" + +define SKY_DEGREES 1 +define SKY_RADIANS 2 +define SKY_HOURS 3 + +# Define the list of supported image sky projection types. + +define WTYPE_LIST "|lin|azp|tan|sin|stg|arc|zpn|zea|air|cyp|car|\ +mer|cea|cop|cod|coe|coo|bon|pco|gls|par|ait|mol|csc|qsc|tsc|tnx|zpx|" + +define PTYPE_LIST "|z|z|z|z|z|z|z|z|z|c|c|c|c|n|n|n|n|c|c|c|c|c|c|c|c|c|\ +x|x|" + +define WTYPE_LIN 1 +define WTYPE_AZP 2 +define WTYPE_TAN 3 +define WTYPE_SIN 4 +define WTYPE_STG 5 +define WTYPE_ARC 6 +define WTYPE_ZPN 7 +define WTYPE_ZEA 8 +define WTYPE_AIR 9 +define WTYPE_CYP 10 +define WTYPE_CAR 11 +define WTYPE_MER 12 +define WTYPE_CEA 13 +define WTYPE_COP 14 +define WTYPE_COD 15 +define WTYPE_COE 16 +define WTYPE_COO 17 +define WTYPE_BON 18 +define WTYPE_PCO 19 +define WTYPE_GLS 20 +define WTYPE_PAR 21 +define WTYPE_AIT 22 +define WTYPE_MOL 23 +define WTYPE_CSC 24 +define WTYPE_QSC 25 +define WTYPE_TSC 26 +define WTYPE_TNX 27 +define WTYPE_ZPX 28 + +define PTYPE_NAMES "|z|c|n|x|" + +define PTYPE_ZEN 1 +define PTYPE_CYL 2 +define PTYPE_CON 3 +define PTYPE_EXP 4 + +# Define the supported image axis types. + +define AXTYPE_LIST "|ra|dec|glon|glat|elon|elat|slon|slat|" + +define AXTYPE_RA 1 +define AXTYPE_DEC 2 +define AXTYPE_GLON 3 +define AXTYPE_GLAT 4 +define AXTYPE_ELON 5 +define AXTYPE_ELAT 6 +define AXTYPE_SLON 7 +define AXTYPE_SLAT 8 + +# Define the supported image pixel coordinate systems. + +define PIXTYPE_LIST "|logical|tv|physical|world|" + +define PIXTYPE_LOGICAL 1 +define PIXTYPE_TV 2 +define PIXTYPE_PHYSICAL 3 +define PIXTYPE_WORLD 4 diff --git a/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcsdef.h b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcsdef.h new file mode 100644 index 00000000..433247bd --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/skywcs/skywcsdef.h @@ -0,0 +1,24 @@ +# The SKYWCS library structure. + +define LEN_SKYCOOSTRUCT (30 + SZ_FNAME + 1) + +define SKY_VXOFF Memd[P2D($1)] # logical ra/longitude offset +define SKY_VYOFF Memd[P2D($1+2)] # logical dec/tatitude offset +define SKY_VXSTEP Memd[P2D($1+4)] # logical ra/longitude stepsize +define SKY_VYSTEP Memd[P2D($1+6)] # logical dec/latitude stepsize +define SKY_EQUINOX Memd[P2D($1+8)] # equinox of ra/dec system (B or J) +define SKY_EPOCH Memd[P2D($1+10)] # epoch of observation (MJD) +define SKY_CTYPE Memi[$1+12] # celestial coordinate system code +define SKY_RADECSYS Memi[$1+13] # ra/dec system code +define SKY_WTYPE Memi[$1+14] # sky projection function code +define SKY_PLNGAX Memi[$1+15] # physical ra/longitude axis +define SKY_PLATAX Memi[$1+16] # physical dec/latitude axis +define SKY_XLAX Memi[$1+17] # logical ra/longitude axis +define SKY_YLAX Memi[$1+18] # logical dec/latitude axis +define SKY_PIXTYPE Memi[$1+19] # iraf wcs system code +define SKY_NLNGAX Memi[$1+20] # length of ra/longitude axis +define SKY_NLATAX Memi[$1+21] # length of dec/latitude axis +define SKY_NLNGUNITS Memi[$1+22] # the native ra/longitude units +define SKY_NLATUNITS Memi[$1+23] # the native dec/latitude units +define SKY_STATUS Memi[$1+24] # the status (OK or ERR) +define SKY_COOSYSTEM Memc[P2C($1+25)] # the coordinate system name diff --git a/vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.f b/vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.f new file mode 100644 index 00000000..a8f7b191 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.f @@ -0,0 +1,89 @@ + subroutine wcsgfm (mw, crpix, crval, cd, ndim) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer mw + integer ndim + double precision crpix(ndim) + double precision crval(ndim) + double precision cd(ndim,ndim) + integer sp + integer r + integer wcd + integer ltv + integer ltm + integer iltm + integer alert + integer errmsg + integer i + integer errcoe + integer errget + logical xerpop + logical xerflg + common /xercom/ xerflg + integer*2 st0001(8) + integer*2 st0002(26) + integer*2 st0003(1) + integer*2 st0004(1) + save + integer iyy + data st0001 / 37,115, 10, 34, 37,115, 34, 0/ + data (st0002(iyy),iyy= 1, 8) / 69,114,114,111,114, 32,100,101/ + data (st0002(iyy),iyy= 9,16) / 99,111,100,105,110,103, 32,105/ + data (st0002(iyy),iyy=17,24) /109, 97,103,101, 32, 87, 67, 83/ + data (st0002(iyy),iyy=25,26) / 58, 0/ + data st0003 / 0/ + data st0004 / 0/ + call smark (sp) + call salloc (r, ndim, 7) + call salloc (wcd, ndim * ndim, 7) + call salloc (ltv, ndim, 7) + call salloc (ltm, ndim * ndim, 7) + call salloc (iltm, ndim * ndim, 7) + call xerpsh + call mwgwtd (mw, memd(r), crval, memd(wcd), ndim) + if (xerflg) goto 112 + call mwgltd (mw, memd(ltm), memd(ltv), ndim) + if (xerflg) goto 112 + call mwvmud (memd(ltm), memd(r), crpix, ndim) + call aaddd (crpix, memd(ltv), crpix, ndim) + call mwinvd (memd(ltm), memd(iltm), ndim) + call mwmmud (memd(wcd), memd(iltm), cd, ndim) +112 if (.not.xerpop()) goto 110 + call salloc (alert, 1023 , 2) + call salloc (errmsg, 1023 , 2) + call aclrd (cd, ndim*ndim) + i=1 +120 if (.not.(i .le. ndim)) goto 122 + crpix(i) = 1.0d0 + crval(i) = 1.0d0 + cd(i,i) = 1.0d0 +121 i=i+1 + goto 120 +122 continue + errcoe = errget (memc(errmsg), 1023 ) + call sprinf (memc(alert), 255 , st0001) + call pargsr (st0002) + call pargsr (memc(errmsg)) + call ximalt (memc(alert), st0003, st0004) +110 continue + call sfree (sp) +100 return + end +c sprinf sprintf +c mwinvd mwinvertd +c mwvmud mwvmuld +c errcoe errcode +c mwgwtd mw_gwtermd +c ximalt xim_alert +c mwmmud mwmmuld +c pargsr pargstr +c wcsgfm wcs_gfterm +c mwgltd mw_gltermd diff --git a/vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.x b/vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.x new file mode 100644 index 00000000..8b97a55b --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/wcsgfterm.x @@ -0,0 +1,61 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + + +# WCS_GFTERM -- Compute the output FITS CRPIX, CRVAL, and CD arrays from the +# MWCS LTERM and WTERM. Note that the CD matrix terms are still transposed +# from the usual Fortran order. + +procedure wcs_gfterm (mw, crpix, crval, cd, ndim) + +pointer mw #i the input mwcs pointer +double crpix[ndim] #o the output FITS CRPIX array +double crval[ndim] #o the output FITS CRVAL array +double cd[ndim,ndim] #o the output FITS CD matrix +int ndim #i the dimensionality of the wcs + +pointer sp, r, wcd, ltv, ltm, iltm +pointer alert, errmsg +int i, errcode + +int errget() + +errchk mw_gwtermd, mw_gltermd + +begin + call smark (sp) + call salloc (r, ndim, TY_DOUBLE) + call salloc (wcd, ndim * ndim, TY_DOUBLE) + call salloc (ltv, ndim, TY_DOUBLE) + call salloc (ltm, ndim * ndim, TY_DOUBLE) + call salloc (iltm, ndim * ndim, TY_DOUBLE) + + iferr { + call mw_gwtermd (mw, Memd[r], crval, Memd[wcd], ndim) + call mw_gltermd (mw, Memd[ltm], Memd[ltv], ndim) + call mwvmuld (Memd[ltm], Memd[r], crpix, ndim) + call aaddd (crpix, Memd[ltv], crpix, ndim) + call mwinvertd (Memd[ltm], Memd[iltm], ndim) + call mwmmuld (Memd[wcd], Memd[iltm], cd, ndim) + + } then { + call salloc (alert, SZ_LINE, TY_CHAR) + call salloc (errmsg, SZ_LINE, TY_CHAR) + + # Set up a default value. + call aclrd (cd, ndim*ndim) + for (i=1; i <= ndim; i=i+1) { + crpix[i] = 1.0d0 + crval[i] = 1.0d0 + cd[i,i] = 1.0d0 + } + + # Send alert to the GUI. + errcode = errget (Memc[errmsg], SZ_LINE) + call sprintf (Memc[alert], SZ_FNAME, "%s\n\"%s\"") + call pargstr ("Error decoding image WCS:") + call pargstr (Memc[errmsg]) + call xim_alert (Memc[alert], "", "") + } + + call sfree (sp) +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/ximtool.f b/vendor/x11iraf/ximtool/clients.old/lib/ximtool.f new file mode 100644 index 00000000..80dabf3f --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/ximtool.f @@ -0,0 +1,510 @@ + integer function ximcot (device, name, type) + integer*2 device(*) + integer*2 name(*) + integer*2 type(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer cmsg + integer dev + integer buf + integer msglen + integer*2 connet(255 +1) + integer ndopen + integer reopen + integer xstrln + integer ximred + logical streq + external ximonr + integer fdin + integer fdout + integer mode + integer nbuf + integer nr + integer nw + integer*2 buffer(2047+1) + integer ximepa + integer ximstt + integer oldont + integer ximfd + integer ximjmp(64 ) + integer ximert + logical xerpop + logical xerflg + common /xercom/ xerflg + common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + common /ximcom/ ximfd, ximjmp, ximepa, ximstt, oldont + common /ximecm/ ximert + integer*2 st0001(6) + integer*2 st0002(5) + integer*2 st0003(12) + integer*2 st0004(8) + integer*2 st0005(12) + integer*2 st0006(21) + integer*2 st0007(10) + integer*2 st0008(8) + save + integer iyy + data st0001 / 37,115, 58, 37,115, 0/ + data st0002 /116,101,120,116, 0/ + data (st0003(iyy),iyy= 1, 8) / 99,111,110,110,101, 99,116, 32/ + data (st0003(iyy),iyy= 9,12) / 37,115, 0, 0/ + data st0004 /120,105,109,116,111,111,108, 0/ + data (st0005(iyy),iyy= 1, 8) /117,110,105,120, 58, 37,115, 58/ + data (st0005(iyy),iyy= 9,12) / 37,115, 0, 0/ + data (st0006(iyy),iyy= 1, 8) / 82,101, 99,111,110,110,101, 99/ + data (st0006(iyy),iyy= 9,16) /116,101,100, 32,111,110, 32, 39/ + data (st0006(iyy),iyy=17,21) / 37,115, 39, 10, 0/ + data (st0007(iyy),iyy= 1, 8) /114,101, 97,100,121, 32, 37,115/ + data (st0007(iyy),iyy= 9,10) / 0, 0/ + data st0008 /120,105,109,116,111,111,108, 0/ + data ximert /0/ + call smark (sp) + call salloc (buf, 1023 , 2) + call salloc (cmsg, 1023 , 2) + call salloc (dev, 255 , 2) + call aclrc (memc(buf), 1023 ) + call aclrc (memc(cmsg), 1023 ) + call aclrc (memc(dev), 255 ) + call aclrc (buffer, 2047) + fdin = 0 + fdout = 0 + nbuf = 0 + nr = 0 + nw = 0 + call sprinf (memc(dev), 255 , st0001) + call pargsr (device) + call pargsr (type) + if (.not.(streq (type, st0002))) goto 110 + mode = 1 + goto 111 +110 continue + mode = 2 +111 continue + call xerpsh + fdin = ndopen (memc(dev), 2) + if (.not.xerpop()) goto 120 + call sfree (sp) + ximcot = (-1) + goto 100 +120 continue + fdout = reopen (fdin, 2) + call sprinf (memc(cmsg), 1023 , st0003) + call pargsr (name) + msglen = xstrln(memc(cmsg)) + call ximmee (st0004, memc(cmsg)) + if (.not.(ximred (memc(buf), msglen) .eq. -2)) goto 130 + call sfree (sp) + ximcot = (-1) + goto 100 +130 continue + call xfcloe(fdout) + call xfcloe(fdin) + call sprinf (connet, 1023 , st0005) + call pargsr (memc(buf+8)) + call pargsr (type) + call xerpsh + fdin = ndopen (connet, 2) + if (.not.xerpop()) goto 140 + call sfree (sp) + ximcot = (-1) + goto 100 +140 continue + fdout = reopen (fdin, 2) + if (.not.(.true.)) goto 150 + call eprinf (st0006) + call pargsr (connet) +150 continue + call sprinf (memc(cmsg), 1023 , st0007) + call pargsr (name) + msglen = xstrln(memc(cmsg)) + call ximmee (st0008, memc(cmsg)) + call onerrr (ximonr) + call sfree (sp) + ximcot = (0) + goto 100 +100 return + end + subroutine ximdit (sendqt) + integer sendqt + integer fdin + integer fdout + integer mode + integer nbuf + integer nr + integer nw + integer*2 buffer(2047+1) + common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + integer*2 st0001(8) + integer*2 st0002(5) + save + data st0001 /120,105,109,116,111,111,108, 0/ + data st0002 /113,117,105,116, 0/ + if (.not.(sendqt .eq. 1)) goto 110 + call ximmee (st0001, st0002) +110 continue + call xffluh(fdout) + call xfcloe(fdin) + call xfcloe(fdout) + fdin = 0 + fdout = 0 +100 return + end + subroutine ximmee (object, messae) + integer*2 object(*) + integer*2 messae(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer msgbuf + integer msglen + integer olen + integer mlen + integer ip + integer xstrln + logical streq + integer*2 st0001(8) + integer*2 st0002(6) + integer*2 st0003(4) + integer*2 st0004(4) + save + data st0001 /120,105,109,116,111,111,108, 0/ + data st0002 /115,101,110,100, 32, 0/ + data st0003 / 32,123, 32, 0/ + data st0004 / 32,125, 0, 0/ + olen = xstrln(object) + mlen = xstrln(messae) + msglen = olen + mlen + 20 + call smark (sp) + call salloc (msgbuf, msglen, 2) + call aclrc (memc(msgbuf), msglen) + if (.not.(streq (object, st0001))) goto 110 + call xstrcy(messae, memc(msgbuf), msglen) + goto 111 +110 continue + ip = 0 + call amovc (st0002, memc(msgbuf+ip), 5) + ip = ip + 5 + call amovc (object, memc(msgbuf+ip), olen) + ip = ip + olen + call amovc (st0003, memc(msgbuf+ip), 3) + ip = ip + 3 + call amovc (messae, memc(msgbuf+ip), mlen) + ip = ip + mlen + call amovc (st0004, memc(msgbuf+ip), 2) + ip = ip + 3 +111 continue + msglen = xstrln(memc(msgbuf)) + call ximwre (memc(msgbuf), msglen) + call sfree (sp) +100 return + end + subroutine ximalt (text, ok, cancel) + integer*2 text(*) + integer*2 ok(*) + integer*2 cancel(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer msg + integer*2 st0001(15) + integer*2 st0002(6) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /123, 37,115,125, 32,123, 37,115/ + data (st0001(iyy),iyy= 9,15) /125, 32,123, 37,115,125, 0/ + data st0002 / 97,108,101,114,116, 0/ + call smark (sp) + call salloc (msg, 1023 , 2) + call sprinf (memc(msg), 1023 , st0001) + call pargsr (text) + call pargsr (ok) + call pargsr (cancel) + call ximmee (st0002, memc(msg)) + call sfree (sp) +100 return + end + subroutine ximwre (messae, len) + integer len + integer*2 messae(*) + integer nleft + integer n + integer ip + integer*2 msgbuf(2047+1) + integer xstrln + integer fdin + integer fdout + integer mode + integer nbuf + integer nr + integer nw + integer*2 buffer(2047+1) + common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + logical xerflg + common /xercom/ xerflg + integer*2 st0001(42) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /120,105,109, 95,119,114,105,116/ + data (st0001(iyy),iyy= 9,16) /101, 58, 32, 39, 37, 46, 52, 53/ + data (st0001(iyy),iyy=17,24) /115, 39, 32,108,101,110, 61, 37/ + data (st0001(iyy),iyy=25,32) /100, 32,109,111,100,101, 61, 37/ + data (st0001(iyy),iyy=33,40) /100, 32,116,111,116, 61, 37,100/ + data (st0001(iyy),iyy=41,42) / 10, 0/ + len = xstrln(messae) + 1 + messae(len) = 0 + if (.not.(mod(len,2) .eq. 1)) goto 110 + len = len + 1 + messae(len) = 0 +110 continue + ip = 1 + nleft = len +120 if (.not.(nleft .gt. 0)) goto 121 + n = min (nleft, 2047) + call amovc (messae(ip), msgbuf, n) + if (.not.(mode .eq. 2)) goto 130 + call achtcb (msgbuf, msgbuf, n) + call xfwrie(fdout, msgbuf, n / 2 ) + if (xerflg) goto 100 + goto 131 +130 continue + call xfwrie(fdout, msgbuf, n) + if (xerflg) goto 100 +131 continue + ip = ip + n + nleft = nleft - n + goto 120 +121 continue + nw = nw + len + call xffluh(fdout) + if (xerflg) goto 100 + if (.not.(.true.)) goto 140 + call eprinf (st0001) + call pargsr (messae) + call pargi (len) + call pargi (mode) + call pargi (nw) +140 continue +100 return + end + integer function ximred (messae, len) + integer len + integer*2 messae(*) + integer i + integer n + integer nleft + integer xfread + integer fdin + integer fdout + integer mode + integer nbuf + integer nr + integer nw + integer*2 buffer(2047+1) + integer ximepa + integer ximstt + integer oldont + integer ximfd + integer ximjmp(64 ) + logical xerpop + logical xerflg + common /xercom/ xerflg + common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + common /ximcom/ ximfd, ximjmp, ximepa, ximstt, oldont + integer*2 st0001(42) + integer*2 st0002(40) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /120,105,109, 95,114,101, 97,100/ + data (st0001(iyy),iyy= 9,16) / 58, 32,116,111,116, 61, 37,100/ + data (st0001(iyy),iyy=17,24) / 32,108,101,110, 61, 37,100, 47/ + data (st0001(iyy),iyy=25,32) / 37,100, 32,109,115,103, 61, 39/ + data (st0001(iyy),iyy=33,40) / 37, 51, 48, 46, 51, 48,115, 39/ + data (st0001(iyy),iyy=41,42) / 10, 0/ + data (st0002(iyy),iyy= 1, 8) /120,105,109, 95,114,101, 97,100/ + data (st0002(iyy),iyy= 9,16) / 58, 32,110, 98,117,102, 61, 37/ + data (st0002(iyy),iyy=17,24) /100, 32,110,108,101,102,116, 61/ + data (st0002(iyy),iyy=25,32) / 37,100, 32, 98,117,102,102,101/ + data (st0002(iyy),iyy=33,40) /114, 61, 39, 37,115, 39, 10, 0/ + if (.not.(nbuf .eq. 0)) goto 110 + call aclrc (buffer, 2047) + nbuf = 0 + call xerpsh + n = xfread(fdin, messae, 2047) + if (xerflg) goto 122 + if (.not.(n .lt. 0)) goto 130 + ximred = (-2) + goto 100 +130 continue +122 if (.not.xerpop()) goto 120 + call xerret() + call zdojmp (ximjmp, 504 ) +120 continue + if (.not.(mode .eq. 2)) goto 140 + len = n * 2 + call achtbc (messae, messae, len) + goto 141 +140 continue + len = n +141 continue + call amovc (messae, buffer, len) + if (.not.(buffer(len) .eq. 0 .and. buffer(len-1) .eq. 0)) + * goto 150 + nbuf = len + goto 151 +150 continue + nbuf = len + 1 +151 continue + buffer(nbuf) = -2 +110 continue + i=1 +160 if (.not.(buffer(i) .ne. 0 .and. buffer(i) .ne. -2 .and. i .le. + * nbuf)) goto 162 + messae(i) = buffer(i) +161 i=i+1 + goto 160 +162 continue + messae(i) = 0 + len = i + nleft = nbuf - i + nr = nr + len + if (.not.(buffer(i) .eq. 0 .and. buffer(i+1) .eq. -2)) goto 170 + if (.not.(i .gt. 1 .and. nleft .gt. 1)) goto 180 + call amovc (buffer(i+1), buffer, nleft) +180 continue + nbuf = 0 + goto 171 +170 continue + if (.not.(nleft .gt. 0)) goto 190 + call amovc (buffer(i+1), buffer, nleft) +190 continue + nbuf = nleft +171 continue + if (.not.(.true.)) goto 200 + call eprinf (st0001) + call pargi(nr) + call pargi (len) + call pargsr(messae) + call eprinf (st0002) + call pargi (nbuf) + call pargi(nleft) + call pargsr(buffer) +200 continue + ximred = (nleft) + goto 100 +100 return + end + integer function ximinr () + external ximzxn + integer ximepa + integer ximstt + integer oldont + integer ximfd + integer ximjmp(64 ) + common /ximcom/ ximfd, ximjmp, ximepa, ximstt, oldont + save + call zlocpr (ximzxn, ximepa) + call xwhen (503 , ximepa, oldont) + call zsvjmp (ximjmp, ximstt) + if (.not.(ximstt .eq. 0)) goto 110 + ximinr = (0) + goto 100 +110 continue + ximinr = (-1) + goto 100 +111 continue +100 return + end + subroutine ximzxn (vex, nexthr) + integer vex + integer nexthr + integer ximepa + integer ximstt + integer oldont + integer ximfd + integer ximjmp(64 ) + common /ximcom/ ximfd, ximjmp, ximepa, ximstt, oldont + save + call ximdit (1) + call xerret() + call zdojmp (ximjmp, vex) +100 return + end + subroutine ximonr (status) + integer status + integer ximert + integer code + integer*2 buf(1023 +1) + integer*2 errmsg(1023 +1) + integer errget + integer ximepa + integer ximstt + integer oldont + integer ximfd + integer ximjmp(64 ) + common /ximecm/ ximert + common /ximcom/ ximfd, ximjmp, ximepa, ximstt, oldont + integer*2 st0001(25) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 73, 83, 77, 32, 69,114,114,111/ + data (st0001(iyy),iyy= 9,16) /114, 44, 32, 99,111,100,101, 32/ + data (st0001(iyy),iyy=17,24) / 37,100, 58, 10, 96, 37,115, 39/ + data (st0001(iyy),iyy=25,25) / 0/ + if (.not.(status .ne. 0)) goto 110 + code = errget (errmsg, 1023 ) + call sprinf (buf, 1023 , st0001) + call pargi (status) + call pargsr (errmsg) + call ximalt (buf, 0, 0) + call ximdit (1) +110 continue +100 return + end +c ximonr xim_onerror +c sprinf sprintf +c onerrr onerror +c ximstt ximstat +c ximmee xim_message +c messae message +c ximcot xim_connect +c connet connect +c ximinr xim_intrhandler +c ximalt xim_alert +c oldont old_onint +c ximecm ximecom +c ximred xim_read +c ximjmp xim_jmp +c sendqt send_quit +c eprinf eprintf +c nexthr next_handler +c ximzxn xim_zxwhen +c xerret xer_reset +c ximdit xim_disconnect +c ximwre xim_write +c pargsr pargstr +c ximert xim_errstat diff --git a/vendor/x11iraf/ximtool/clients.old/lib/ximtool.x b/vendor/x11iraf/ximtool/clients.old/lib/ximtool.x new file mode 100644 index 00000000..dff5869c --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/ximtool.x @@ -0,0 +1,459 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <config.h> +include <mach.h> +include <xwhen.h> + + +# XIMTOOL.X -- Interface routines for client programs to connect to +# XImtool on the message bus. +# +# status = xim_connect (device, name, mode) +# status = xim_file_connect (infile, outfile, name) +# xim_disconnect (send_quit) +# xim_message (object, message) +# xim_alert (text, ok_action, cancel_action) +# +# xim_write (message, len) +# nremain = xim_read (message, len) +# +# Client programs should install an exception handler to first disconnect +# from the device before shutting down. The procedure xim_zxwhen() is +# provided for this purpose. + + +define XIM_DBG TRUE + +define SZ_MESSAGE 2047 + +define XIM_TEXT 1 +define XIM_BINARY 2 + + +# XIM_CONNECT -- Negotiate a connection on the named device. Once +# established we can begin sending and reading messages from the server. + +int procedure xim_connect (device, name, type) + +char device[ARB] #I socket to connect on +char name[ARB] #I module name +char type[ARB] #I requested connection mode + +pointer sp, cmsg, dev, buf +int msglen +char connect[SZ_FNAME] + +int ndopen(), reopen(), strlen() +int xim_read() +bool streq() + +extern xim_onerror() + +# I/O common. +int fdin, fdout, mode, nbuf, nr, nw +char buffer[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +# Exception handler variables common. +int xim_errstat +data xim_errstat /OK/ +common /ximecom/ xim_errstat + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call salloc (cmsg, SZ_LINE, TY_CHAR) + call salloc (dev, SZ_FNAME, TY_CHAR) + + # Initialize. + call aclrc (Memc[buf], SZ_LINE) + call aclrc (Memc[cmsg], SZ_LINE) + call aclrc (Memc[dev], SZ_FNAME) + call aclrc (buffer, SZ_MESSAGE) + fdin = NULL + fdout = NULL + nbuf = 0 + nr = 0 + nw = 0 + + # Generate the device name. We assume the call was made with either + # a "unix:" or "inet:" prefix, so just append the type and set the + # mode. + + call sprintf (Memc[dev], SZ_FNAME, "%s:%s") + call pargstr (device) + call pargstr (type) + if (streq (type, "text")) + mode = XIM_TEXT + else + mode = XIM_BINARY + + # Open the initial connection + iferr (fdin = ndopen (Memc[dev], READ_WRITE)) { + call sfree (sp) + return (ERR) + } + fdout = reopen (fdin, READ_WRITE) + + # Send the connect request. + call sprintf (Memc[cmsg], SZ_LINE, "connect %s\0") + call pargstr (name) + msglen = strlen (Memc[cmsg]) + call xim_message ("ximtool", Memc[cmsg]) + + # Read the acknowledgement. + if (xim_read (Memc[buf], msglen) == EOF) { + call sfree (sp) + return (ERR) + } + + # Close the original socket. + call close (fdout) + call close (fdin) + + # Get the new device name. + call sprintf (connect, SZ_LINE, "unix:%s:%s\0") + call pargstr (Memc[buf+8]) + call pargstr (type) + + # Open the new channel. + iferr (fdin = ndopen (connect, READ_WRITE)) { + call sfree (sp) + return (ERR) + } + fdout = reopen (fdin, READ_WRITE) + + if (XIM_DBG) { + call eprintf ("Reconnected on '%s'\n"); call pargstr (connect) + } + + # Tell the server we're ready to begin. + call sprintf (Memc[cmsg], SZ_LINE, "ready %s\0") + call pargstr (name) + msglen = strlen (Memc[cmsg]) + call xim_message ("ximtool", Memc[cmsg]) + + + # Post the xim_onerror procedure to be executed upon process shutdown + # to issue a warning to the server in case we don't close normally. + + call onerror (xim_onerror) + + call sfree (sp) + return (OK) +end + + +# XIM_DISCONNECT -- Disconnect from the currect channel. + +procedure xim_disconnect (send_quit) + +int send_quit + +# I/O common. +int fdin, fdout, mode, nbuf, nr, nw +char buffer[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + +begin + # Send a QUIT message to the server so we shut down the connection. + if (send_quit == YES) + call xim_message ("ximtool", "quit") + + call flush (fdout) # Close the socket connection. + call close (fdin) + call close (fdout) + fdin = NULL + fdout = NULL +end + + +# XIM_MESSAGE -- Send a message to an XImtool named object. If the object +# is 'ximtool' then just pass the message directly without formatting it. + +procedure xim_message (object, message) + +char object[ARB] #I object name +char message[ARB] #I message to send + +pointer sp, msgbuf +int msglen, olen, mlen, ip + +int strlen() +bool streq() + +begin + # Get the message length plus some extra for the braces and padding. + olen = strlen (object) + mlen = strlen (message) + msglen = olen + mlen + 20 + + # Allocate and clear the message buffer. + call smark (sp) + call salloc (msgbuf, msglen, TY_CHAR) + call aclrc (Memc[msgbuf], msglen) + + if (streq (object, "ximtool")) { + # Just send the message. + call strcpy (message, Memc[msgbuf], msglen) + } else { + # Format the message. We can't use a sprintf here since the + # message may be bigger than that allowed by a pargstr(). + ip = 0 + call amovc ("send ", Memc[msgbuf+ip], 5) ; ip = ip + 5 + call amovc (object, Memc[msgbuf+ip], olen) ; ip = ip + olen + call amovc (" { ", Memc[msgbuf+ip], 3) ; ip = ip + 3 + call amovc (message, Memc[msgbuf+ip], mlen) ; ip = ip + mlen + call amovc (" }\0", Memc[msgbuf+ip], 2) ; ip = ip + 3 + } + msglen = strlen (Memc[msgbuf]) + + # Now send the message. The write routine does the strpak(). + call xim_write (Memc[msgbuf], msglen) + + call sfree (sp) +end + + +# XIM_ALERT -- Send an alert message to XImtool. + +procedure xim_alert (text, ok, cancel) + +char text[ARB] #I warning text +char ok[ARB] #i client OK message +char cancel[ARB] #i client CANCEL message + +pointer sp, msg + +begin + call smark (sp) + call salloc (msg, SZ_LINE, TY_CHAR) + + call sprintf (Memc[msg], SZ_LINE, "{%s} {%s} {%s}") + call pargstr (text) + call pargstr (ok) + call pargstr (cancel) + + call xim_message ("alert", Memc[msg]) + + call sfree (sp) +end + + +# XIM_WRITE -- Low-level write of a message to the socket. Writes exactly +# len bytes to the stream. + +procedure xim_write (message, len) + +char message[ARB] #I message to send +int len #I length of message + +int nleft, n, ip +char msgbuf[SZ_MESSAGE] +int strlen() + +# I/O common. +int fdin, fdout, mode, nbuf, nr, nw +char buffer[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + +errchk write, flush + +begin + # Pad message with a NULL to terminate it. + len = strlen (message) + 1 + message[len] = '\0' + + if (mod(len,2) == 1) { + len = len + 1 + message[len] = '\0' + } + + ip = 1 + nleft = len + while (nleft > 0) { + n = min (nleft, SZ_MESSAGE) + call amovc (message[ip], msgbuf, n) + if (mode == XIM_BINARY) { + call achtcb (msgbuf, msgbuf, n) + call write (fdout, msgbuf, n / SZB_CHAR) + } else + call write (fdout, msgbuf, n) + + ip = ip + n + nleft = nleft - n + } + nw = nw + len + call flush (fdout) + + if (XIM_DBG) { + call eprintf ("xim_write: '%.45s' len=%d mode=%d tot=%d\n") + call pargstr (message);call pargi (len) + call pargi (mode); call pargi (nw) + } +end + + +# XIM_READ -- Low-level read from the socket. + +int procedure xim_read (message, len) + +char message[ARB] #O message read +int len #O length of message + +int i, n, nleft, read() + +# I/O common. +int fdin, fdout, mode, nbuf, nr, nw +char buffer[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nr, nw + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +errchk read + +begin + # No data left in the buffer so read from the socket + if (nbuf == 0) { + call aclrc (buffer, SZ_MESSAGE) + nbuf = 0 + + iferr { + n = read (fdin, message, SZ_MESSAGE) + if (n < 0) + return (EOF) + } then { + call xer_reset() + call zdojmp (xim_jmp, X_IPC) + } + + if (mode == XIM_BINARY) { + len = n * SZB_CHAR + call achtbc (message, message, len) + } else + len = n + + # Save the data read to a local buffer. Remove any extra + # EOS padding and append an EOF on the string. + call amovc (message, buffer, len) + if (buffer[len] == EOS && buffer[len-1] == EOS) + nbuf = len + else + nbuf = len + 1 + buffer[nbuf] = EOF + } + + for (i=1; buffer[i] != EOS && buffer[i] != EOF && i <= nbuf; i=i+1) + message[i] = buffer[i] + message[i] = '\0' + len = i # length of the current message + nleft = nbuf - i # nchars left in the buffer + nr = nr + len + + if (buffer[i] == EOS && buffer[i+1] == EOF) { + # That was the last message, force a new read next time we're + # called. + if (i > 1 && nleft > 1) + call amovc (buffer[i+1], buffer, nleft) + nbuf = 0 + } else { + # More of the message is left in the buffer. + if (nleft > 0) + call amovc (buffer[i+1], buffer, nleft) + nbuf = nleft + } + + if (XIM_DBG) { + call eprintf ("xim_read: tot=%d len=%d/%d msg='%30.30s'\n") + call pargi(nr); call pargi (len) + call pargstr(message) + call eprintf ("xim_read: nbuf=%d nleft=%d buffer='%s'\n") + call pargi (nbuf); call pargi(nleft); call pargstr(buffer) + } + + #return (len) + return (nleft) +end + + +# XIM_INTRHANDLER -- User-callable interrupt handler so the ISM client code +# doesn't need to know about our internals. + +int procedure xim_intrhandler() + +extern xim_zxwhen() + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +begin + call zlocpr (xim_zxwhen, ximepa) + call xwhen (X_INT, ximepa, old_onint) + call zsvjmp (xim_jmp, ximstat) + + if (ximstat == OK) + return (OK) + else + return (ERR) +end + + +# XIM_ZXWHEN -- Interrupt handler for the Ximtool client task. Branches back +# to ZSVJMP in the user routine to permit shutdown without an error message +# after first disconnecting from the socket. + +procedure xim_zxwhen (vex, next_handler) + +int vex # virtual exception +int next_handler # not used + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +begin + call xim_disconnect (YES) + call xer_reset() + call zdojmp (xim_jmp, vex) +end + + +# XIM_ONERROR -- Error exit handler for the interface. If this is a normal exit +# the shut down quietly, otherwise notify the server. + +procedure xim_onerror (status) + +int status #i not used (req. for ONEXIT) + +# Exception handler variables common. +int xim_errstat +common /ximecom/ xim_errstat + +int code +char buf[SZ_LINE], errmsg[SZ_LINE] + +int errget() + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +begin + if (status != OK) { + code = errget (errmsg, SZ_LINE) + call sprintf (buf, SZ_LINE, "ISM Error, code %d:\n`%s\'") + call pargi (status) + call pargstr (errmsg) + + call xim_alert (buf, NULL, NULL) + call xim_disconnect (YES) + } +end diff --git a/vendor/x11iraf/ximtool/clients.old/lib/zfiond.c b/vendor/x11iraf/ximtool/clients.old/lib/zfiond.c new file mode 100644 index 00000000..1ae65048 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/lib/zfiond.c @@ -0,0 +1,723 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/file.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/un.h> +#include <netdb.h> +#include <fcntl.h> + +#ifdef LINUX +#include <sys/time.h> +#endif + +#include <errno.h> +#include <stdio.h> + +#define import_kernel +#define import_knames +#define import_zfstat +#define import_spp +#include <iraf.h> + +/* + * ZFIOND -- This driver provides a FIO-compatible interface to network or + * IPC streaming devices such as Berkeley sockets, FIFOs, and the like. + * Any connection-oriented stream type network interface can be supported. + * + * The type of connection desired is determined at device open time by the + * "filename" and file access mode arguments. The syntax for the filename + * argument is as follows: + * + * <domain> : <address> [ : <flag ] [ : flag...] + * + * where <domain> is one of "inet" (internet tcp/ip socket), "unix" (unix + * domain socket) or "fifo" (named pipe). The form of the address depends + * upon the domain, as illustrated in the examples below. + * + * inet:5187 Server connection to port 5187 on the local + * host. For a client, a connection to the + * given port on the local host. + * + * inet:5187:foo.bar.edu Client connection to port 5187 on internet + * host foo.bar.edu. The dotted form of address + * may also be used. + * + * unix:/tmp/.IMT212 Unix domain socket with the given pathname + * IPC method, local host only. + * + * fifo:/dev/imt1i:/dev/imt1o FIFO or named pipe with the given pathname. + * IPC method, local host only. Two pathnames + * are required, one for input and one for + * output, since FIFOs are not bidirectional. + * For a client the first fifo listed will be + * the client's input fifo; for a server the + * first fifo will be the server's output fifo. + * This allows the same address to be used for + * both the client and the server, as for the + * other domains. + * + * The address field may contain up to two "%d" fields. If present, the + * user's UID will be substituted (e.g. "unix:/tmp/.IMT%d"). + * + * The only protocol flags currently supported are "text" and "binary". + * If "text" is specified the datastream is assumed to consist only of byte + * packed ascii text and is automatically converted by the driver to and + * from SPP chars during i/o. The default is binary i/o (no conversions). + * + * Client connections normally use mode READ_WRITE, although READ_ONLY and + * WRITE_ONLY are permitted. APPEND is the same as WRITE_ONLY. A server + * connection is indicated by the mode NEW_FILE. The endpoints of the server + * connection will be created if necessary. A client connection will timeout + * if no server responds. + * + * An INET or UNIX domain server connection will block indefinitely until a + * client connects. Since connections are synchronous only a single client + * can be supported. The server sees an EOF on the input stream when the + * client disconnects. + * + * FIFO domain connection are slightly different. When the server opens a FIFO + * connection the open returns immediately. When the server reads from the + * input fifo the server will block until some data is written to the fifo by a + * client. The server connection will remain open over multiple client + * connections until it is closed by the server. This is done to avoid a race + * condition that could otherwise occur at open time, with both the client and + * the server blocked waiting for an open on the opposite stream. + */ + +#define SZ_NAME 256 +#define SZ_OBUF 4096 +#define MAXCONN 5 +#define MAXSEL 32 + +#define INET 1 +#define UNIX 2 +#define FIFO 3 + +#define F_SERVER 00001 +#define F_DEL1 00002 +#define F_DEL2 00004 +#define F_TEXT 00010 + +/* Network portal descriptor. */ +struct portal { + int domain; + int flags; + int datain; + int dataout; + int keepalive; + char path1[SZ_NAME]; + char path2[SZ_NAME]; +}; + +#define get_desc(fd) ((struct portal *)zfd[fd].fp) +#define set_desc(fd,np) zfd[fd].fp = (FILE *)np +#define min(a,b) (((a)<(b))?(a):(b)) + +extern int errno; +static int getstr(); + + +/* ZOPNND -- Open a network device. + */ +ZOPNND (pk_osfn, mode, chan) +PKCHAR *pk_osfn; /* UNIX name of file */ +XINT *mode; /* file access mode */ +XINT *chan; /* file number (output) */ +{ + register int fd; + register struct portal *np; + unsigned short host_port; + unsigned long host_addr; + char osfn[SZ_NAME*2]; + char flag[SZ_NAME]; + char *ip; + + /* Get network device descriptor. */ + if (!(np = (struct portal *) calloc (1, sizeof(struct portal)))) { + *chan = XERR; + return; + } + + /* Expand any %d fields in the network address to the UID. */ + sprintf (osfn, (char *)pk_osfn, getuid(), getuid()); + + /* Parse the network filename to determine the domain type and + * network address. + */ + if (strncmp (osfn, "inet:", 5) == 0) { + /* Internet connection. + */ + char port_str[SZ_NAME]; + char host_str[SZ_NAME]; + unsigned short port; + struct servent *sv; + struct hostent *hp; + + /* Get port number. This may be specified either as a service + * name or as a decimal port number. + */ + ip = osfn + 5; + if (getstr (&ip, port_str, SZ_NAME) <= 0) + goto err; + if (isdigit (port_str[0])) { + port = atoi (port_str); + host_port = htons (port); + } else if (sv = getservbyname(port_str,"tcp")) { + host_port = sv->s_port; + } else + goto err; + + /* Get host address. This may be specified either has a host + * name or as an Internet address in dot notation. If no host + * name is specified default to the local host. + */ + if (getstr (&ip, host_str, SZ_NAME) <= 0) + strcpy (host_str, "localhost"); + if (isdigit (host_str[0])) { + host_addr = inet_addr (host_str); + if ((int)host_addr == -1) + goto err; + } else if (hp = gethostbyname(host_str)) { + bcopy (hp->h_addr, (char *)&host_addr, sizeof(host_addr)); + } else + goto err; + + np->domain = INET; + + } else if (strncmp (osfn, "unix:", 5) == 0) { + /* Unix domain socket connection. + */ + ip = osfn + 5; + if (!getstr (&ip, np->path1, SZ_NAME)) + goto err; + np->domain = UNIX; + + } else if (strncmp (osfn, "fifo:", 5) == 0) { + /* FIFO (named pipe) connection. + */ + ip = osfn + 5; + if (*mode == NEW_FILE) { + /* Server. */ + if (!getstr (&ip, np->path2, SZ_NAME)) + goto err; + if (!getstr (&ip, np->path1, SZ_NAME)) + goto err; + } else { + /* Client. */ + if (!getstr (&ip, np->path1, SZ_NAME)) + goto err; + if (!getstr (&ip, np->path2, SZ_NAME)) + goto err; + } + np->domain = FIFO; + + } else + goto err; + + /* Process any optional protocol flags. + */ + while (getstr (&ip, flag, SZ_NAME) > 0) { + /* Get content type (text or binary). If the stream will be used + * only for byte-packed character data the content type can be + * specified as "text" and data will be automatically packed and + * unpacked during i/o. + */ + if (strcmp (flag, "text") == 0) + np->flags |= F_TEXT; + if (strcmp (flag, "binary") == 0) + np->flags &= ~F_TEXT; + } + + /* Open the network connection. + */ + switch (*mode) { + case READ_ONLY: + /* Client side read only FIFO connection. */ + if (np->domain == FIFO) { + if ((fd = open (np->path1, O_RDONLY|O_NDELAY)) != ERR) + fcntl (fd, F_SETFL, O_RDONLY); + np->datain = fd; + np->dataout = -1; + break; + } + /* fall through */ + + case WRITE_ONLY: + case APPEND: + /* Client side write only FIFO connection. */ + if (np->domain == FIFO) { + if ((fd = open (np->path2, O_WRONLY|O_NDELAY)) != ERR) + fcntl (fd, F_SETFL, O_WRONLY); + np->datain = -1; + np->dataout = fd; + break; + } + /* fall through */ + + case READ_WRITE: + if (np->domain == INET) { + /* Client side Internet domain connection. */ + struct sockaddr_in sockaddr; + + /* Get socket. */ + if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) + goto err; + + /* Compose network address. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = host_port; + bcopy ((char *)&host_addr, (char *)&sockaddr.sin_addr, + sizeof(host_addr)); + + /* Connect to server. */ + if (fd >= MAXOFILES || connect (fd, + (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) { + close (fd); + fd = ERR; + } else { + np->datain = fd; + np->dataout = fd; + } + + } else if (np->domain == UNIX) { + /* Client side Unix domain socket connection. */ + struct sockaddr_un sockaddr; + + /* Get socket. */ + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + /* Compose network address. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strncpy (sockaddr.sun_path, + np->path1, sizeof(sockaddr.sun_path)); + + /* Connect to server. */ + if (fd >= MAXOFILES || connect (fd, + (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) { + close (fd); + fd = ERR; + } else { + np->datain = fd; + np->dataout = fd; + } + + } else if (np->domain == FIFO) { + /* Client side FIFO connection. */ + int fd1, fd2; + + /* Open the fifos. */ + if ((fd1 = open (np->path1, O_RDONLY|O_NDELAY)) != ERR) + fcntl (fd1, F_SETFL, O_RDONLY); + if ((fd2 = open (np->path2, O_WRONLY|O_NDELAY)) != ERR) + fcntl (fd2, F_SETFL, O_WRONLY); + + /* Clean up if there is an error. */ + if (fd1 < 0 || fd1 > MAXOFILES || fd2 < 0 || fd2 > MAXOFILES) { + if (fd1 > 0) + close (fd1); + if (fd2 > 0) + close (fd2); + fd = ERR; + } else { + np->datain = fd1; + np->dataout = fd2; + fd = fd1; + } + } else + goto err; + break; + + case NEW_FILE: + /* Connect to a client. */ + np->flags |= F_SERVER; + + if (np->domain == INET) { + /* Server side Internet domain connection. */ + struct sockaddr_in sockaddr; + int s, reuse=1; + + /* Get socket. */ + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) + goto err; + + /* Bind server port to socket. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = host_port; + sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); + + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, + sizeof(reuse)) < 0) { + close (s); + goto err; + } + + if (bind (s, + (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) { + close (s); + goto err; + } + + /* Wait for client to connect. */ + if (listen (s, MAXCONN) < 0) { + close (s); + goto err; + } + if ((fd = accept (s, (struct sockaddr *)0, (int *)0)) < 0) { + close (s); + goto err; + } else + close (s); + + np->datain = fd; + np->dataout = fd; + + } else if (np->domain == UNIX) { + /* Server side Unix domain connection. */ + struct sockaddr_un sockaddr; + int addrlen, s; + + /* Get socket. */ + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + /* Bind server port to socket. */ + bzero ((char *)&sockaddr, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strncpy (sockaddr.sun_path,np->path1,sizeof(sockaddr.sun_path)); + addrlen = sizeof(sockaddr) - sizeof(sockaddr.sun_path) + + strlen(np->path1); + + unlink (np->path1); + if (bind (s, (struct sockaddr *)&sockaddr, addrlen) < 0) { + close (s); + goto err; + } + + /* Wait for client to connect. */ + if (listen (s, MAXCONN) < 0) { + close (s); + goto err; + } + if ((fd = accept (s, (struct sockaddr *)0, (int *)0)) < 0) { + close (s); + goto err; + } else + close (s); + + np->datain = fd; + np->dataout = fd; + np->flags |= F_DEL1; + + } else if (np->domain == FIFO) { + /* Server side FIFO connection. */ + int fd1, fd2, keepalive; + + /* Create fifos if necessary. */ + if (access (np->path1, 0) < 0) { + if (mknod (np->path1, 010660, 0) < 0) + goto err; + else + np->flags |= F_DEL1; + } + if (access (np->path2, 0) < 0) { + if (mknod (np->path2, 010660, 0) < 0) { + unlink (np->path1); + goto err; + } else + np->flags |= F_DEL2; + } + + /* Open the output fifo (which is the client's input fifo). + * We have to open it ourselves first as a client to get + * around the fifo open-no-client error. + */ + if ((fd1 = open (np->path2, O_RDONLY|O_NDELAY)) != -1) { + if ((fd2 = open (np->path2, O_WRONLY|O_NDELAY)) != -1) + fcntl (fd2, F_SETFL, O_WRONLY); + close (fd1); + } + + /* Open the input fifo. */ + if ((fd1 = open (np->path1, O_RDONLY|O_NDELAY)) == -1) + fprintf (stderr, "Warning: cannot open %s\n", np->path1); + else { + /* Clear O_NDELAY for reading. */ + fcntl (fd1, F_SETFL, O_RDONLY); + + /* Open the client's output fifo as a pseudo-client to + * make it appear that a client is connected. + */ + keepalive = open (np->path1, O_WRONLY); + } + + /* Clean up if there is an error. */ + if (fd1 < 0 || fd1 > MAXOFILES || fd2 < 0 || fd2 > MAXOFILES) { + if (fd1 > 0) { + close (fd1); + close (keepalive); + } + if (fd2 > 0) + close (fd2); + fd = ERR; + } else { + np->datain = fd1; + np->dataout = fd2; + np->keepalive = keepalive; + fd = fd1; + } + + } else + goto err; + break; + + default: + fd = ERR; + } + + /* Initialize the kernel file descriptor. Seeks are illegal for a + * network device; network devices are "streaming" files (blksize=1) + * which can only be accessed sequentially. + */ + if ((*chan = fd) == ERR) { +err: free (np); + *chan = XERR; + } else if (fd >= MAXOFILES) { + free (np); + close (fd); + *chan = XERR; + } else { + zfd[fd].fp = NULL; + zfd[fd].fpos = 0L; + zfd[fd].nbytes = 0; + zfd[fd].flags = 0; + zfd[fd].filesize = 0; + set_desc(fd,np); + } +} + + +/* ZCLSND -- Close a network device. + */ +ZCLSND (fd, status) +XINT *fd; +XINT *status; +{ + register struct portal *np = get_desc(*fd); + register int flags; + + if (np) { + flags = np->flags; + + if (np->datain > 0) + close (np->datain); + if (np->dataout > 0 && np->dataout != np->datain) + close (np->dataout); + if (np->keepalive > 0) + close (np->keepalive); + + if (flags & F_DEL1) + unlink (np->path1); + if (flags & F_DEL2) + unlink (np->path2); + + free (np); + set_desc(*fd,NULL); + *status = XOK; + + } else + *status = XERR; +} + + +/* ZARDND -- "Asynchronous" binary block read. Initiate a read of at most + * maxbytes bytes from the file FD into the buffer BUF. Status is returned + * in a subsequent call to ZAWTND. + */ +ZARDND (chan, buf, maxbytes, offset) +XINT *chan; /* UNIX file number */ +XCHAR *buf; /* output buffer */ +XINT *maxbytes; /* max bytes to read */ +XLONG *offset; /* 1-indexed file offset to read at */ +{ + register int n; + int fd = *chan; + struct fiodes *kfp = &zfd[fd]; + register struct portal *np = get_desc (fd); + register char *ip; + register XCHAR *op; + int nbytes, maxread; + + /* Determine maximum amount of data to be read. */ + maxread = (np->flags & F_TEXT) ? *maxbytes/sizeof(XCHAR) : *maxbytes; + + /* The following call to select shouldn't be necessary, but it + * appears that, due to the way we open a FIFO with O_NDELAY, read + * can return zero if read is called before the process on the other + * end writes any data. This happens even though fcntl is called to + * restore blocking i/o after the open. + */ + if (np->domain == FIFO && np->datain < MAXSEL) { +#ifdef SOLARIS + fd_set readfds; + FD_ZERO (&readfds); + FD_SET (np->datain, &readfds); +#else + int readfds = (1 << np->datain); +#endif + select (MAXSEL, &readfds, NULL, NULL, NULL); + nbytes = read (np->datain, (char *)buf, maxread); + } else + nbytes = read (np->datain, (char *)buf, maxread); + + if ((n = nbytes) && (np->flags & F_TEXT)) { + op = (XCHAR *) buf; + op[n] = XEOS; + for (ip = (char *)buf; --n >= 0; ) + op[n] = ip[n]; + nbytes *= sizeof(XCHAR); + } + + kfp->nbytes = nbytes; +} + + +/* ZAWRND -- "Asynchronous" binary block write. Initiate a write of exactly + * nbytes bytes from the buffer BUF to the file FD. Status is returned in a + * subsequent call to ZAWTND. + */ +ZAWRND (chan, buf, nbytes, offset) +XINT *chan; /* UNIX file number */ +XCHAR *buf; /* buffer containing data */ +XINT *nbytes; /* nbytes to be written */ +XLONG *offset; /* 1-indexed file offset */ +{ + register int fd = *chan; + register struct fiodes *kfp = &zfd[fd]; + register struct portal *np = get_desc (fd); + int nwritten, maxbytes, n; + char *text, *ip = (char *)buf; + char obuf[SZ_OBUF]; + + maxbytes = (np->domain == FIFO || (np->flags & F_TEXT)) ? SZ_OBUF : 0; + for (nwritten=0; nwritten < *nbytes; nwritten += n, ip+=n) { + n = *nbytes - nwritten; + if (maxbytes) + n = min (maxbytes, n); + + if (np->flags & F_TEXT) { + register XCHAR *ipp = (XCHAR *)ip; + register char *op = (char *)obuf; + register int nbytes = n; + + while (--nbytes >= 0) + *op++ = *ipp++; + text = obuf; + if ((n = write (np->dataout, text, n / sizeof(XCHAR))) < 0) + break; + n *= sizeof(XCHAR); + + } else { + text = ip; + if ((n = write (np->dataout, text, n)) < 0) + break; + } + } + + kfp->nbytes = nwritten; +} + + +/* ZAWTND -- "Wait" for an "asynchronous" read or write to complete, and + * return the number of bytes read or written, or ERR. + */ +ZAWTND (fd, status) +XINT *fd; +XINT *status; +{ + if ((*status = zfd[*fd].nbytes) == ERR) + *status = XERR; +} + + +/* ZSTTND -- Return file status information for a network device. + */ +ZSTTND (fd, param, lvalue) +XINT *fd; +XINT *param; +XLONG *lvalue; +{ + register struct fiodes *kfp = &zfd[*fd]; + struct stat filstat; + + switch (*param) { + case FSTT_BLKSIZE: + (*lvalue) = 0L; + break; + + case FSTT_FILSIZE: + (*lvalue) = 0L; + break; + + case FSTT_OPTBUFSIZE: + /* On some systems this parameter may be device dependent in which + * case device dependent code should be substituted here. + */ + (*lvalue) = ND_OPTBUFSIZE; + break; + + case FSTT_MAXBUFSIZE: + /* On some systems this parameter may be device dependent in which + * case device dependent code should be substituted here. + */ + (*lvalue) = ND_MAXBUFSIZE; + break; + + default: + (*lvalue) = XERR; + break; + } +} + + +/* + * Internal routines. + * ---------------------------- + */ + +/* GETSTR -- Internal routine to extract a colon delimited string from a + * network filename. + */ +static int +getstr (ipp, obuf, maxch) +char **ipp; +char *obuf; +int maxch; +{ + register char *ip = *ipp, *op = obuf; + register char *otop = obuf + maxch; + char *start; + + while (isspace(*ip)) + ip++; + for (start=ip; *ip; ip++) { + if (*ip == ':') { + ip++; + break; + } else if (op && op < otop) + *op++ = *ip; + } + + if (op) + *op = '\0'; + *ipp = ip; + + return (ip - start); +} diff --git a/vendor/x11iraf/ximtool/clients.old/mkpkg b/vendor/x11iraf/ximtool/clients.old/mkpkg new file mode 100644 index 00000000..3b50a906 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/mkpkg @@ -0,0 +1,34 @@ +# Make the ISM Client tasks. + +$call relink +$exit + +update: + $call relink + $call install + ; + +relink: + $set LIBS = "-lslalib" + $update libpkg.a + $omake x_ism.x + $link -z x_ism.o libpkg.a -o ism_wcspix.e $(LIBS) + ; + +debug: + $set LIBS = "-lslalib" + $set XFLAGS = "$(XFLAGS) -xqF" + $update libpkg.a + $omake x_ism.x + $link -z -x x_ism.o libpkg.a -o ism_wcspix.e $(LIBS) + ; + +install: + $move ism_wcspix.e ../../bin/ism_wcspix.e + ; + + +libpkg.a: + @lib + @wcspix + ; diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/README b/vendor/x11iraf/ximtool/clients.old/wcspix/README new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/class.com b/vendor/x11iraf/ximtool/clients.old/wcspix/class.com new file mode 100644 index 00000000..c6116c11 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/class.com @@ -0,0 +1,6 @@ +# Class common. +int cl_nclass # number of defined functions +int cl_table[LEN_CLASS,MAX_CLASSES] # class table +char cl_names[SZ_CLNAME,MAX_CLASSES] # class names +common /class_com/ cl_nclass, cl_table, cl_names + diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/mkpkg b/vendor/x11iraf/ximtool/clients.old/wcspix/mkpkg new file mode 100644 index 00000000..baa3b090 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/mkpkg @@ -0,0 +1,15 @@ +# Make the WCSPIX ISM Client task. + +$checkout libpkg.a ../ +$update libpkg.a +$checkin libpkg.a ../ +$exit + +libpkg.a: + t_wcspix.x wcspix.h class.com + wcimage.x wcspix.h + wcmef.x wcspix.h + wcmspec.x wcspix.h + wcunknown.x wcspix.h + ; + diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.f b/vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.f new file mode 100644 index 00000000..a1fce8a5 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.f @@ -0,0 +1,1124 @@ + subroutine twcspx () + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer len + integer discot + integer ncmd + integer*2 socket(255 +1) + integer*2 cmd(255 +1) + integer*2 messae(1023 +1) + integer*2 buf(12 +1) + integer objid + integer regid + real x + real y + integer*2 ref(255 +1) + integer*2 temple(1023 +1) + integer*2 param(255 +1) + logical debug + integer*4 clktie + integer wpinit + integer envges + integer envgei + integer strdic + integer ximcot + integer wpread + integer ximinr + logical xerpop + logical xerflg + common /xercom/ xerflg + integer sw0001 + integer*2 st0001(7) + integer*2 st0002(17) + integer*2 st0003(7) + integer*2 st0004(5) + integer*2 st0005(13) + integer*2 st0006(28) + integer*2 st0007(8) + integer*2 st0008(22) + integer*2 st0009(73) + integer*2 st0010(31) + integer*2 st0011(35) + integer*2 st0012(41) + integer*2 st0013(8) + integer*2 st0014(16) + integer*2 st0015(38) + integer*2 st0016(8) + integer*2 st0017(25) + integer*2 st0018(16) + integer*2 st0019(27) + integer*2 st0020(30) + save + integer iyy + data st0001 / 73, 83, 77, 68, 69, 86, 0/ + data (st0002(iyy),iyy= 1, 8) /117,110,105,120, 58, 47,116,109/ + data (st0002(iyy),iyy= 9,16) /112, 47, 46, 73, 83, 77, 37,100/ + data (st0002(iyy),iyy=17,17) / 0/ + data st0003 /119, 99,115,112,105,120, 0/ + data st0004 /116,101,120,116, 0/ + data (st0005(iyy),iyy= 1, 8) / 87, 67, 83, 80, 73, 88, 95, 68/ + data (st0005(iyy),iyy= 9,13) / 69, 66, 85, 71, 0/ + data (st0006(iyy),iyy= 1, 8) /105,110,102,111, 32,123, 32, 37/ + data (st0006(iyy),iyy= 9,16) /115, 58, 32, 87, 67, 83, 80, 73/ + data (st0006(iyy),iyy=17,24) / 88, 32, 67,111,110,110,101, 99/ + data (st0006(iyy),iyy=25,28) /116,125, 10, 0/ + data st0007 /105,115,109, 95,109,115,103, 0/ + data (st0008(iyy),iyy= 1, 8) /109,101,115,115, 97,103,101, 58/ + data (st0008(iyy),iyy= 9,16) / 32, 39, 37,115, 39, 32,108,101/ + data (st0008(iyy),iyy=17,22) /110, 61, 37,100, 10, 0/ + data (st0009(iyy),iyy= 1, 8) /124,115,101,116,124,103,101,116/ + data (st0009(iyy),iyy= 9,16) /124,113,117,105,116,124,105,110/ + data (st0009(iyy),iyy=17,24) /105,116,105, 97,108,105,122,101/ + data (st0009(iyy),iyy=25,32) /124, 99, 97, 99,104,101,124,117/ + data (st0009(iyy),iyy=33,40) /110, 99, 97, 99,104,101, 9, 9/ + data (st0009(iyy),iyy=41,48) / 9, 32,124,119, 99,115,116,114/ + data (st0009(iyy),iyy=49,56) / 97,110,124,119, 99,115,108,105/ + data (st0009(iyy),iyy=57,64) /115,116,124,111, 98,106,105,110/ + data (st0009(iyy),iyy=65,72) /102,111,124,100,101, 98,117,103/ + data (st0009(iyy),iyy=73,73) / 0/ + data (st0010(iyy),iyy= 1, 8) /105,110,102,111, 32,123, 32, 37/ + data (st0010(iyy),iyy= 9,16) /115, 58, 32, 87, 67, 83, 80, 73/ + data (st0010(iyy),iyy=17,24) / 88, 32, 73,110,105,116,105, 97/ + data (st0010(iyy),iyy=25,31) /108,105,122,101,125, 10, 0/ + data (st0011(iyy),iyy= 1, 8) / 99, 97, 99,104,101, 58, 32,111/ + data (st0011(iyy),iyy= 9,16) / 98,106,105,100, 61, 37,100, 32/ + data (st0011(iyy),iyy=17,24) /114,101,103,105,100, 61, 37,100/ + data (st0011(iyy),iyy=25,32) / 32,114,101,102, 61, 39, 37,115/ + data (st0011(iyy),iyy=33,35) / 39, 10, 0/ + data (st0012(iyy),iyy= 1, 8) /105,110,102,111, 32,123, 32, 37/ + data (st0012(iyy),iyy= 9,16) /115, 58, 32, 87, 67, 83, 80, 73/ + data (st0012(iyy),iyy=17,24) / 88, 32, 67, 97, 99,104,101, 32/ + data (st0012(iyy),iyy=25,32) / 32, 32,111, 98,106,105,100, 61/ + data (st0012(iyy),iyy=33,40) / 37, 51,100, 32, 37,115,125, 10/ + data (st0012(iyy),iyy=41,41) / 0/ + data st0013 /105,115,109, 95,109,115,103, 0/ + data (st0014(iyy),iyy= 1, 8) /117,110, 99, 97, 99,104,101, 58/ + data (st0014(iyy),iyy= 9,16) / 32,105,100, 61, 37,100, 10, 0/ + data (st0015(iyy),iyy= 1, 8) /105,110,102,111, 32,123, 32, 37/ + data (st0015(iyy),iyy= 9,16) /115, 58, 32, 87, 67, 83, 80, 73/ + data (st0015(iyy),iyy=17,24) / 88, 32, 85,110, 99, 97, 99,104/ + data (st0015(iyy),iyy=25,32) /101, 32,111, 98,106,105,100, 61/ + data (st0015(iyy),iyy=33,38) / 37, 51,100,125, 10, 0/ + data st0016 /105,115,109, 95,109,115,103, 0/ + data (st0017(iyy),iyy= 1, 8) /119, 99,115,116,114, 97,110, 58/ + data (st0017(iyy),iyy= 9,16) / 32,105,100, 61, 37,100, 32, 32/ + data (st0017(iyy),iyy=17,24) / 40, 37,103, 44, 37,103, 41, 10/ + data (st0017(iyy),iyy=25,25) / 0/ + data (st0018(iyy),iyy= 1, 8) /119, 99,115,108,105,115,116, 58/ + data (st0018(iyy),iyy= 9,16) / 32,105,100, 61, 37,100, 10, 0/ + data (st0019(iyy),iyy= 1, 8) /111, 98,106,105,110,102,111, 58/ + data (st0019(iyy),iyy= 9,16) / 32,105,100, 61, 37,100, 32, 32/ + data (st0019(iyy),iyy=17,24) /116,101,109,112, 61, 39, 37,115/ + data (st0019(iyy),iyy=25,27) / 39, 10, 0/ + data (st0020(iyy),iyy= 1, 8) / 73, 83, 77, 32,100,101,102, 97/ + data (st0020(iyy),iyy= 9,16) /117,108,116, 58, 32,108,101,110/ + data (st0020(iyy),iyy=17,24) / 61, 37,100, 32,109,115,103, 61/ + data (st0020(iyy),iyy=25,30) / 39, 37,115, 39, 10, 0/ + call aclrc (messae, 1023 ) + call aclrc (cmd, 255 ) + call aclrc (socket, 255 ) + if (.not.(envges (st0001, socket, 255 ) .le. 0).and.(.not. + * xerflg)) goto 110 + if (xerflg) goto 100 + call xstrcy(st0002, socket, 255 ) +110 continue + if (.not.(ximcot (socket, st0003, st0004) .eq. -1)) goto 120 + goto 100 +120 continue + if (.not.(ximinr() .eq. -1)) goto 130 + goto 100 +130 continue + wp = wpinit () + call xerpsh + memi(wp+6) = envgei (st0005) + if (.not.xerpop()) goto 140 + memi(wp+6) = 0 +140 continue + call wpcnve (clktie(0), buf, 12 ) + call sprinf (messae, 1023 , st0006) + call pargsr (buf) + call ximmee (st0007, messae) + discot = 1 + debug = (.false. .or. memi(wp+6) .gt. 0) +150 if (.not.(wpread (messae, len) .ne. -2).and.(.not.xerflg)) goto + * 151 + if (xerflg) goto 100 + if (.not.(debug)) goto 160 + call eprinf(st0008) + call pargsr (messae) + call pargi (len) +160 continue + if (.not.(len .le. 0)) goto 170 + discot = 0 + goto 151 +170 continue + call sscan (messae) + call gargwd (cmd, 1023 ) + ncmd = strdic (cmd, cmd, 1023 , st0009) + sw0001=(ncmd) + goto 180 +190 continue + discot = 0 + goto 151 +200 continue + call wpcnve (clktie(0), buf, 12 ) + call sprinf (messae, 1023 , st0010) + call pargsr (buf) + call wpinie (wp) + goto 181 +210 continue + call gargwd (ref, 255 ) + call gargi (objid) + call gargi (regid) + if (.not.(debug)) goto 220 + call xprinf(st0011) + call pargi(objid) + call pargi(regid) + call pargsr(ref) +220 continue + call wpcnve (clktie(0), buf, 12 ) + call sprinf (messae, 1023 , st0012) + call pargsr (buf) + call pargi (objid) + call pargsr (ref) + call ximmee (st0013, messae) + call wpcace (wp, objid, regid, ref) + goto 181 +230 continue + call gargi (objid) + if (.not.(debug)) goto 240 + call xprinf(st0014) + call pargi(objid) +240 continue + call wpcnve (clktie(0), buf, 12 ) + call sprinf (messae, 1023 , st0015) + call pargsr (buf) + call pargi (objid) + call ximmee (st0016, messae) + call wpunce (wp, objid) + goto 181 +250 continue + call gargi (objid) + call gargr (x) + call gargr (y) + if (.not.(debug)) goto 260 + call xprinf(st0017) + call pargi(objid) + call pargr (x) + call pargr (y) +260 continue + call wpwcsn (wp, objid, x, y) + goto 181 +270 continue + call gargi (objid) + if (.not.(debug)) goto 280 + call xprinf(st0018) + call pargi(objid) +280 continue + call wpwcst (wp, objid) + goto 181 +290 continue + call gargi (objid) + call gargwd (temple, 255 ) + if (.not.(debug)) goto 300 + call xprinf(st0019) + call pargi(objid) + call pargsr (temple) +300 continue + call wpobjo (wp, objid, temple) + goto 181 +310 continue + call gargwd (param, 255 ) + call wpsetr (wp, param) + goto 181 +320 continue + goto 181 +330 continue + debug = .not.(debug) + goto 181 +340 continue + if (.not.(debug)) goto 350 + call eprinf (st0020) + call pargi(len) + call pargsr(messae) +350 continue + goto 181 +180 continue + if (sw0001.lt.1.or.sw0001.gt.10) goto 340 + goto (310,320,190,200,210,230,250,270,290,330),sw0001 +181 continue + call aclrc (messae, 1023 ) + goto 150 +151 continue + call ximdit (discot) + call wpshun (wp) +100 return + end + subroutine wpinie (wp) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer cp + integer wpid2j + integer i + save + i=0 +110 if (.not.(i .lt. 256 )) goto 112 + cp = wpid2j (wp, i) + if (.not.(cp .ne. 0 .and. memi(cp) .ne. 0)) goto 120 + call wpunce (wp, memi(cp) ) +120 continue +111 i=i+1 + goto 110 +112 continue +100 return + end + subroutine wpcace (wp, objid, regid, ref) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer objid + integer regid + integer*2 ref(*) + integer cp + integer i + integer class + integer*2 alert(255 +1) + integer wpclas + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + common /classm/ clncls, cltabe, clnams + integer*2 st0001(29) + integer*2 st0002(1) + integer*2 st0003(1) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /119,112, 95, 99, 97, 99,104,101/ + data (st0001(iyy),iyy= 9,16) / 58, 32, 85,110, 97, 98,108,101/ + data (st0001(iyy),iyy=17,24) / 32,116,111, 32, 99, 97, 99,104/ + data (st0001(iyy),iyy=25,29) /101, 10, 37,115, 0/ + data st0002 / 0/ + data st0003 / 0/ + i=0 +110 if (.not.(i .lt. 256 )) goto 112 + cp = memi(memi(wp ) +i) + if (.not.(memi(cp+4) .eq. 0)) goto 120 + goto 112 +120 continue +111 i=i+1 + goto 110 +112 continue + class = wpclas (ref) + if (.not.(class .eq. -1)) goto 130 + call sprinf (alert, 255 , st0001) + call pargsr (ref) + call ximalt (alert, st0002, st0003) + goto 100 +130 continue + memi(cp+2) = class + if (.not.(class .ne. 0 .and. cltabe(1,class) .ne. 0)) goto 140 + call zcall2 (cltabe(1,class) , cp, wp) +140 continue + if (.not.(class .ne. 0 .and. cltabe(2,class) .ne. 0)) goto 150 + call zcall4 (cltabe(2,class) , cp, objid, regid, ref) +150 continue +100 return + end + subroutine wpunce (wp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer id + integer cp + integer wpid2j + integer class + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + common /classm/ clncls, cltabe, clnams + save + cp = wpid2j (wp, id) + if (.not.(cp .eq. 0)) goto 110 + goto 100 +110 continue + class = memi(cp+2) + if (.not.(class .ne. 0 .and. cltabe(3,class) .ne. 0)) goto 120 + call zcall2 (cltabe(3,class) , cp, id) +120 continue + memi(cp+4) = 0 +100 return + end + subroutine wpwcsn (wp, id, x, y) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer id + real x + real y + integer cp + integer wpid2j + integer class + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + common /classm/ clncls, cltabe, clnams + save + cp = wpid2j (wp, id) + if (.not.(cp .eq. 0)) goto 110 + goto 100 +110 continue + class = memi(cp+2) + if (.not.(class .ne. 0 .and. cltabe(4,class) .ne. 0)) goto 120 + call zcall4 (cltabe(4,class) , cp, id, x, y) +120 continue +100 return + end + subroutine wpwcst (wp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer id + integer cp + integer wpid2j + integer class + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + common /classm/ clncls, cltabe, clnams + save + cp = wpid2j (wp, id) + if (.not.(cp .eq. 0)) goto 110 + goto 100 +110 continue + class = memi(cp+2) + if (.not.(class .ne. 0 .and. cltabe(5,class) .ne. 0)) goto 120 + call zcall2 (cltabe(5,class) , cp, id) +120 continue +100 return + end + subroutine wpobjo (wp, id, temple) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer id + integer*2 temple(*) + integer cp + integer wpid2j + integer class + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + common /classm/ clncls, cltabe, clnams + save + cp = wpid2j (wp, id) + if (.not.(cp .eq. 0)) goto 110 + goto 100 +110 continue + class = memi(cp+2) + if (.not.(class .ne. 0 .and. cltabe(6,class) .ne. 0)) goto 120 + call zcall3 (cltabe(6,class) , cp, id, temple) +120 continue +100 return + end + subroutine wpsetr (wp, param) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer*2 param(255 +1) + integer*2 arg(32 +1) + integer*2 buf(32 +1) + integer*2 msg(32 +1) + integer line + integer strdic + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + integer sw0001,sw0002,sw0003 + common /classm/ clncls, cltabe, clnams + integer*2 st0001(11) + integer*2 st0002(23) + integer*2 st0003(4) + integer*2 st0004(4) + integer*2 st0005(66) + integer*2 st0006(12) + integer*2 st0007(14) + integer*2 st0008(30) + integer*2 st0009(12) + integer*2 st0010(13) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /115,101,116, 58, 32, 37,115, 32/ + data (st0001(iyy),iyy= 9,11) / 61, 32, 0/ + data (st0002(iyy),iyy= 1, 8) /124,112,115,105,122,101,124, 98/ + data (st0002(iyy),iyy= 9,16) /112,109,124,119, 99,115,124,102/ + data (st0002(iyy),iyy=17,23) /111,114,109, 97,116,124, 0/ + data st0003 / 37,100, 10, 0/ + data st0004 / 37,100, 10, 0/ + data (st0005(iyy),iyy= 1, 8) /124,110,111,110,101,124,108,111/ + data (st0005(iyy),iyy= 9,16) /103,105, 99, 97,108,124,112,104/ + data (st0005(iyy),iyy=17,24) /121,115,105, 99, 97,108,124,119/ + data (st0005(iyy),iyy=25,32) /111,114,108,100,124,115,107,121/ + data (st0005(iyy),iyy=33,40) / 9, 9, 9,124, 97,109,112,108/ + data (st0005(iyy),iyy=41,48) /105,102,105,101,114,124, 99, 99/ + data (st0005(iyy),iyy=49,56) /100,124,100,101,116,101, 99,116/ + data (st0005(iyy),iyy=57,64) /111,114,124,111,116,104,101,114/ + data (st0005(iyy),iyy=65,66) /124, 0/ + data (st0006(iyy),iyy= 1, 8) / 37,115, 32,108,105,110,101, 61/ + data (st0006(iyy),iyy= 9,12) / 37,100, 10, 0/ + data (st0007(iyy),iyy= 1, 8) /119, 99,115,116,121,112,101, 32/ + data (st0007(iyy),iyy= 9,14) / 37,115, 32, 37,100, 0/ + data (st0008(iyy),iyy= 1, 8) /124,100,101,102, 97,117,108,116/ + data (st0008(iyy),iyy= 9,16) /124,104,109,115,124,100,101,103/ + data (st0008(iyy),iyy=17,24) /114,101,101,115,124,114, 97,100/ + data (st0008(iyy),iyy=25,30) /105, 97,110,115,124, 0/ + data (st0009(iyy),iyy= 1, 8) / 37,115, 32,108,105,110,101, 61/ + data (st0009(iyy),iyy= 9,12) / 37,100, 10, 0/ + data (st0010(iyy),iyy= 1, 8) /119, 99,115,102,109,116, 32, 37/ + data (st0010(iyy),iyy= 9,13) /115, 32, 37,100, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) + call pargsr(param) +110 continue + sw0001=(strdic (param, param, 32 , st0002)) + goto 120 +130 continue + call gargi (memi(wp+1) ) + if (.not.(.false.)) goto 140 + call xprinf(st0003) + call pargi(memi(wp+1) ) +140 continue + goto 121 +150 continue + call gargi (memi(wp+2) ) + if (.not.(.false.)) goto 160 + call xprinf(st0004) + call pargi(memi(wp+2) ) +160 continue + goto 121 +170 continue + call gargwd (buf, 255 ) + call gargi (line) + call xstrcy(buf, arg, 32 ) + call strlwr (buf) + sw0002=(strdic (buf, buf, 255 , st0005)) + goto 180 +190 continue + memi(memi(wp+3) +line-1) = 2 + goto 181 +200 continue + memi(memi(wp+3) +line-1) = 3 + goto 181 +210 continue + memi(memi(wp+3) +line-1) = 4 + goto 181 +220 continue + memi(memi(wp+3) +line-1) = 1 + goto 181 +230 continue + memi(memi(wp+3) +line-1) = 6 + goto 181 +240 continue + memi(memi(wp+3) +line-1) = 3 + goto 181 +250 continue + memi(memi(wp+3) +line-1) = 8 + goto 181 +260 continue + memi(memi(wp+3) +line-1) = 5 + goto 181 +180 continue + if (sw0002.lt.1.or.sw0002.gt.8) goto 260 + goto (220,190,200,210,260,230,240,250),sw0002 +181 continue + call xstrcy(buf, memc(memi(wp+4) +(32 *(line-1))), 32 ) + if (.not.(.false.)) goto 270 + call xprinf(st0006) + call pargsr(buf) + call pargi(line) +270 continue + call sprinf (msg, 255 , st0007) + call pargsr (arg) + call pargi (line) + call wcspie (msg) + goto 121 +280 continue + call gargwd (buf, 255 ) + call gargi (line) + call xstrcy(buf, arg, 32 ) + call strlwr (buf) + sw0003=(strdic (buf, buf, 255 , st0008)) + goto 290 +300 continue + memi(memi(wp+5) +line-1) = 1 + goto 291 +310 continue + memi(memi(wp+5) +line-1) = 2 + goto 291 +320 continue + memi(memi(wp+5) +line-1) = 3 + goto 291 +330 continue + memi(memi(wp+5) +line-1) = 4 + goto 291 +340 continue + memi(memi(wp+5) +line-1) = 1 + goto 291 +290 continue + if (sw0003.lt.1.or.sw0003.gt.4) goto 340 + goto (300,310,320,330),sw0003 +291 continue + if (.not.(.false.)) goto 350 + call xprinf(st0009) + call pargsr(buf) + call pargi(line) +350 continue + call sprinf (msg, 255 , st0010) + call pargsr (arg) + call pargi (line) + call wcspie (msg) + goto 121 +120 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 121 + goto (130,150,170,280),sw0001 +121 continue +100 return + end + subroutine wpgetr (wp, param) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer*2 param(255 +1) + integer strdic + integer sw0001 + integer*2 st0001(11) + integer*2 st0002(23) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /115,101,116, 58, 32, 37,115, 32/ + data (st0001(iyy),iyy= 9,11) / 61, 32, 0/ + data (st0002(iyy),iyy= 1, 8) /124,112,115,105,122,101,124, 98/ + data (st0002(iyy),iyy= 9,16) /112,109,124,119, 99,115,124,102/ + data (st0002(iyy),iyy=17,23) /111,114,109, 97,116,124, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) + call pargsr(param) +110 continue + sw0001=(strdic (param, param, 32 , st0002)) + goto 120 +130 continue + goto 121 +140 continue + goto 121 +150 continue + goto 121 +160 continue + goto 121 +120 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 121 + goto (130,140,150,160),sw0001 +121 continue +100 return + end + integer function wpinit () + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer i + logical xerpop + logical xerflg + common /xercom/ xerflg + integer*2 st0001(37) + integer*2 st0002(5) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 69,114,114,111,114, 32,111,112/ + data (st0001(iyy),iyy= 9,16) /101,110,105,110,103, 32, 87, 67/ + data (st0001(iyy),iyy=17,24) / 83, 80, 73, 88, 32,116, 97,115/ + data (st0001(iyy),iyy=25,32) /107, 32,115,116,114,117, 99,116/ + data (st0001(iyy),iyy=33,37) /117,114,101, 46, 0/ + data st0002 /110,111,110,101, 0/ + call xerpsh + call xcallc(wp, 7, 10 ) + if (.not.xerpop()) goto 110 + call xerror(0, st0001) + if (xerflg) goto 100 +110 continue + call xcallc(memi(wp+3) , 4 , 4) + call xcallc(memi(wp+5) , 4 , 4) + call xcallc(memi(wp+4) , (32 *4 ), 2) + i=1 +120 if (.not.(i .le. 4 )) goto 122 + memi(memi(wp+5) +i-1) = 1 + memi(memi(wp+3) +i-1) = 2 + call xstrcy(st0002, memc(memi(wp+4) +(32 *(i-1))), 32 ) +121 i=i+1 + goto 120 +122 continue + call xcallc(memi(wp ) , 256 , 10 ) + i=0 +130 if (.not.(i .lt. 256 )) goto 132 + call xcallc(memi(memi(wp ) +i) , 135 , 10 ) +131 i=i+1 + goto 130 +132 continue + memi(wp+1) = 0 + memi(wp+2) = 1 + call wpclat() + wpinit = (wp) + goto 100 +100 return + end + integer function wpread (messae, len) + integer len + integer*2 messae(*) + integer nread + integer ximred + logical xerflg + common /xercom/ xerflg + save + nread = ximred (messae, len) + if (xerflg) goto 100 + wpread = (nread) + goto 100 +100 return + end + subroutine wpshun (wp) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer i + save + call xmfree(memi(wp+4) , 2) + call xmfree(memi(wp+5) , 4) + call xmfree(memi(wp+3) , 4) + i=0 +110 if (.not.(i .lt. 256 )) goto 112 + call xmfree(memi(memi(wp ) +i) , 10 ) +111 i=i+1 + goto 110 +112 continue + call xmfree(memi(wp ) , 10 ) + call xmfree(wp, 10 ) +100 return + end + integer function wpclas (object) + integer*2 object(*) + integer n + integer class + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer*2 ch + integer*2 buf(255 +1) + integer xstrln + integer stridx + logical streq + integer immap + logical xerpop + logical xerflg + common /xercom/ xerflg + integer*2 st0001(9) + integer*2 st0002(8) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 47,100,101,118, 47,112,105,120/ + data (st0001(iyy),iyy= 9, 9) / 0/ + data st0002 /100,101,118, 36,112,105,120, 0/ + call imgime (object, buf, 255 ) + n = xstrln(buf) - 7 + if (.not.(streq (buf(n), st0001))) goto 110 + call xstrcy(st0002, buf, 255 ) + ch = 91 + n = stridx (ch, object) + if (.not.(n .gt. 0)) goto 120 + call xstrct(object(n), buf, 255 ) +120 continue + call xstrcy(buf, object, 255 ) +110 continue + class = 1 + call xerpsh + im = immap (object, 1 , 0) + if (xerpop()) goto 130 + class = 2 + call imunmp (im) +130 continue + wpclas = (class) + goto 100 +100 return + end + integer function wpid2j (wp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer id + integer i + integer cp + save + i=0 +110 if (.not.(i .lt. 256 )) goto 112 + cp = memi(memi(wp ) +i) + if (.not.(memi(cp) .eq. id)) goto 120 + wpid2j = (cp) + goto 100 +120 continue +111 i=i+1 + goto 110 +112 continue + wpid2j = (0) + goto 100 +100 return + end + subroutine wpclat () + external imgint + external imgcae + external imgune + external imgwcn + external imgwct + external imgobo + external mefint + external mefcae + external mefune + external mefwcn + external mefwct + external mefobo + external mspint + external mspcae + external mspune + external mspwcn + external mspwct + external mspobo + external unkint + external unkcae + external unkune + external unkwcn + external unkwct + external unkobo + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + integer locpr + common /classm/ clncls, cltabe, clnams + integer*2 st0001(8) + integer*2 st0002(6) + integer*2 st0003(4) + integer*2 st0004(10) + save + integer iyy + data st0001 /117,110,107,110,111,119,110, 0/ + data st0002 /105,109, 97,103,101, 0/ + data st0003 /109,101,102, 0/ + data (st0004(iyy),iyy= 1, 8) /109,117,108,116,105,115,112,101/ + data (st0004(iyy),iyy= 9,10) / 99, 0/ + clncls = 0 + call wploas (st0001, locpr(unkint), locpr(unkcae), locpr(unkune + * ), locpr(unkwcn), locpr(unkwct), locpr(unkobo)) + call wploas (st0002, locpr(imgint), locpr(imgcae), locpr(imgune + * ), locpr(imgwcn), locpr(imgwct), locpr(imgobo)) + call wploas (st0003, locpr(mefint), locpr(mefcae), locpr(mefune + * ), locpr(mefwcn), locpr(mefwct), locpr(mefobo)) + call wploas (st0004, locpr(mspint), locpr(mspcae), locpr(mspune + * ), locpr(mspwcn), locpr(mspwct), locpr(mspobo)) +100 return + end + subroutine wploas (name, init, cache, uncace, tran, list, info) + integer init + integer cache + integer uncace + integer tran + integer list + integer info + integer*2 name(*) + integer clncls + integer cltabe(6 ,16 ) + integer*2 clnams(32 +1,16 ) + logical xerflg + common /xercom/ xerflg + common /classm/ clncls, cltabe, clnams + save + if (.not.(clncls + 1 .gt. 16 )) goto 110 + goto 100 +110 continue + clncls = clncls + 1 + cltabe(1,clncls) = init + cltabe(2,clncls) = cache + cltabe(3,clncls) = uncace + cltabe(4,clncls) = tran + cltabe(5,clncls) = list + cltabe(6,clncls) = info + call xstrcy(name, clnams(1,clncls) , 255 ) +100 return + end + subroutine wcspie (messae) + integer*2 messae(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer msgbuf + integer msglen + integer mlen + integer ip + integer xstrln + integer*2 st0001(18) + integer*2 st0002(4) + integer*2 st0003(8) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /100,101,108,105,118,101,114, 32/ + data (st0001(iyy),iyy= 9,16) /119, 99,115,112,105,120, 32,123/ + data (st0001(iyy),iyy=17,18) / 32, 0/ + data st0002 / 32,125, 0, 0/ + data st0003 /105,115,109, 95,109,115,103, 0/ + mlen = xstrln(messae) + msglen = mlen + 64 + call smark (sp) + call salloc (msgbuf, msglen, 2) + call aclrc (memc(msgbuf), msglen) + ip = 0 + call amovc (st0001, memc(msgbuf), 17) + ip = ip + 17 + call amovc (messae, memc(msgbuf+ip), mlen) + ip = ip + mlen + call amovc (st0002, memc(msgbuf+ip), 2) + ip = ip + 2 + call ximmee (st0003, memc(msgbuf)) + call sfree (sp) +100 return + end + subroutine wpcnve (ltime, outstr, maxch) + integer*4 ltime + integer maxch + integer*2 outstr(*) + integer tm(8 ) + integer*2 st0001(14) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 37, 50,100, 58, 37, 48, 50,100/ + data (st0001(iyy),iyy= 9,14) / 58, 37, 48, 50,100, 0/ + call brktie (ltime, tm) + call sprinf (outstr, maxch, st0001) + call pargi (tm(3) ) + call pargi (tm(2) ) + call pargi (tm(1) ) +100 return + end + subroutine dbgpre (wp, buf) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer wp + integer*2 buf(*) + integer cp + integer wpid2j + integer i + integer*2 st0001(4) + integer*2 st0002(23) + save + integer iyy + data st0001 / 37,115, 10, 0/ + data (st0002(iyy),iyy= 1, 8) / 37, 51,100, 58, 32, 32,105,100/ + data (st0002(iyy),iyy= 9,16) / 61, 37,100, 32, 32,114,101,102/ + data (st0002(iyy),iyy=17,23) / 61, 39, 37,115, 39, 10, 0/ + call xprinf(st0001) + call pargsr (buf) + i=0 +110 if (.not.(i .lt. 256 )) goto 112 + cp = wpid2j (wp, i) + if (.not.(memi(cp+3) .ne. 0)) goto 120 + call xprinf(st0002) + call pargi(i) + call pargi(memi(cp) ) + call pargsr(memc((((cp+6)-1)*2+1)) ) +120 continue +111 i=i+1 + goto 110 +112 continue +100 return + end +c temple template +c sprinf sprintf +c wpclas wp_class +c clncls cl_nclass +c wcspie wcspix_message +c classm class_com +c unkwct unk_wcslist +c mefcae mef_cache +c mspwct msp_wcslist +c cltabe cl_table +c unkint unk_init +c wpread wp_read +c mspint msp_init +c ximmee xim_message +c wpcace wp_cache +c imgcae img_cache +c messae message +c unkobo unk_objinfo +c mspobo msp_objinfo +c clktie clktime +c ximcot xim_connect +c wpshun wp_shutdown +c wpclat wp_class_init +c imgime imgimage +c mefune mef_uncache +c mefwcn mef_wcstran +c ximinr xim_intrhandler +c clnams cl_names +c gargwd gargwrd +c ximalt xim_alert +c brktie brktime +c twcspx t_wcspix +c wpunce wp_uncache +c wpwcsn wp_wcstran +c imgune img_uncache +c imgwcn img_wcstran +c envgei envgeti +c wpgetr wp_getpar +c mefwct mef_wcslist +c wpinie wp_initialize +c ximred xim_read +c mefint mef_init +c unkcae unk_cache +c wpwcst wp_wcslist +c imunmp imunmap +c imgwct img_wcslist +c mspcae msp_cache +c eprinf eprintf +c wpinit wp_init +c imgint img_init +c mefobo mef_objinfo +c envges envgets +c ximdit xim_disconnect +c discot disconnect +c dbgpre dbg_printcache +c wpcnve wp_cnvdate +c wpsetr wp_setpar +c wpid2j wp_id2obj +c wpobjo wp_objinfo +c imgobo img_objinfo +c unkune unk_uncache +c unkwcn unk_wcstran +c wploas wp_load_class +c uncace uncache +c pargsr pargstr +c mspune msp_uncache +c mspwcn msp_wcstran diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.x b/vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.x new file mode 100644 index 00000000..675fb57a --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/t_wcspix.x @@ -0,0 +1,769 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> +include <time.h> +include "wcspix.h" + + +# T_WCSPIX -- Entry point for the WCSPIX Image Support Module for XImtool. +# The WCSPIX task is responsible for converting image coordinates and getting +# pixel values from images of various types. Results are returned to the +# GUI directly using ISM messaging. + +procedure t_wcspix () + +pointer wp +int len, disconnect, ncmd +char socket[SZ_FNAME], cmd[SZ_FNAME], message[SZ_LINE], buf[SZ_DATE] + +int objid, regid +real x, y +char ref[SZ_FNAME], template[SZ_LINE], param[SZ_FNAME] + +bool debug + +long clktime() +pointer wp_init() +int envgets(), envgeti(), strdic() + +# Standard declarations for the Ximtool WCSPIX client interface. +int xim_connect(), wp_read(), xim_intrhandler() +errchk wp_read, envgets, envgeti + +begin + call aclrc (message, SZ_LINE) + call aclrc (cmd, SZ_FNAME) + call aclrc (socket, SZ_FNAME) + + # Get the connection socket name from the environment if defined + # or else use the default socket. + if (envgets ("ISMDEV", socket, SZ_FNAME) <= 0) + call strcpy (WCSPIX_CONNECT, socket, SZ_FNAME) + + # Open the socket connection on a negotiated socket. + if (xim_connect (socket, WCSPIX_NAME, WCSPIX_MODE) == ERR) + return + + # Install an interrupt exception handler so we can exit cleanly. + if (xim_intrhandler() == ERR) + return + + + # Initialize the task data structures. + wp = wp_init () + + # Check for a runtime debug level. + iferr (WP_DBGLEVEL(wp) = envgeti ("WCSPIX_DEBUG")) + WP_DBGLEVEL(wp) = 0 + + # Log the connection. + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, "info { %s: WCSPIX Connect}\n") + call pargstr (buf) + call xim_message ("ism_msg", message) + + # Loop over the commands read on the connection and process. + disconnect = 1 + debug = (WCSPIX_DBG || WP_DBGLEVEL(wp) > 0) + while (wp_read (message, len) != EOF) { + + if (debug) { + call eprintf("message: '%s' len=%d\n") + call pargstr (message); call pargi (len) + } + if (len <= 0) { + # Server has disconnected. + disconnect = 0 + break + } + + # Scan the command string and get the first word. + call sscan (message) + call gargwrd (cmd, SZ_LINE) + ncmd = strdic (cmd, cmd, SZ_LINE, WCSPIX_CMDS) + + switch (ncmd) { + case QUIT: + # Server wants us to shut down. + disconnect = 0 + break + + case INITIALIZE: + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, + "info { %s: WCSPIX Initialize}\n") + call pargstr (buf) + call wp_initialize (wp) + + case CACHE: + # <ref> <objid> <regid> + call gargwrd (ref, SZ_FNAME) + call gargi (objid) + call gargi (regid) + if (debug) { + call printf ("cache: objid=%d regid=%d ref='%s'\n") + call pargi(objid); call pargi(regid); call pargstr(ref) + } + + # Log the event. + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, + "info { %s: WCSPIX Cache objid=%3d %s}\n") + call pargstr (buf) + call pargi (objid) + call pargstr (ref) + call xim_message ("ism_msg", message) + + call wp_cache (wp, objid, regid, ref) + + case UNCACHE: + # <id> + call gargi (objid) + if (debug) { call printf("uncache: id=%d\n");call pargi(objid) } + + # Log the event. + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, + "info { %s: WCSPIX Uncache objid=%3d}\n") + call pargstr (buf) + call pargi (objid) + call xim_message ("ism_msg", message) + + call wp_uncache (wp, objid) + + case WCSTRAN: + # <id> <x> <y> [[<region> <x> <y>] ["NDC" <x> <y> ]] + call gargi (objid) + call gargr (x) ; call gargr (y) + if (debug) { + call printf ("wcstran: id=%d (%g,%g)\n") + call pargi(objid); call pargr (x); call pargr (y) + } + call wp_wcstran (wp, objid, x, y) + + case WCSLIST: + # <id> + call gargi (objid) + if (debug) { call printf ("wcslist: id=%d\n");call pargi(objid)} + call wp_wcslist (wp, objid) + + case OBJINFO: + # <id> <template_list> + call gargi (objid) + call gargwrd (template, SZ_FNAME) + if (debug) { + call printf ("objinfo: id=%d temp='%s'\n") + call pargi(objid); call pargstr (template); + } + call wp_objinfo (wp, objid, template) + + case SET: + # <param> <value> + call gargwrd (param, SZ_FNAME) + call wp_setpar (wp, param) + + case GET: + # <param> + + case DEBUG: + debug = !(debug) + + default: + if (debug) { + call eprintf ("ISM default: len=%d msg='%s'\n") + call pargi(len); call pargstr(message) + } + } + + # Clear the buffer for the next read. + call aclrc (message, SZ_LINE) + } + + # Disconnect from the server and clean up. + call xim_disconnect (disconnect) + call wp_shutdown (wp) +end + + +# WP_INITIALIZE -- Initialize the WCSPIX, uncache any previously cached images. + +procedure wp_initialize (wp) + +pointer wp #i WCSPIX structure + +pointer cp, wp_id2obj() +int i + +begin + for (i=0; i < SZ_CACHE; i=i+1) { + cp = wp_id2obj (wp, i) + if (cp != NULL && C_OBJID(cp) != NULL) + call wp_uncache (wp, C_OBJID(cp)) + } +end + + +# WP_CACHE -- Associate and object reference with a unique object id. + +procedure wp_cache (wp, objid, regid, ref) + +pointer wp #i WCSPIX structure +int objid #i object id +int regid #i region id +char ref[ARB] #i object ref + +pointer cp +int i, class +char alert[SZ_FNAME] + +int wp_class() + +include "class.com" + +begin + # Find an unused slot in the object cache. + for (i=0; i < SZ_CACHE; i=i+1) { + cp = OBJCACHE(wp,i) + if (C_NREF(cp) == 0) + break + } + + # Get the object class. + class = wp_class (ref) + if (class == ERR) { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "wp_cache: Unable to cache\n%s") + call pargstr (ref) + call xim_alert (alert, "", "") + + # Setup for linear system. + return + } + C_CLASS(cp) = class + + # Initialize the object. + if (class != NULL && CL_INIT(class) != NULL) + call zcall2 (CL_INIT(class), cp, wp) + + # Call the cache function. + if (class != NULL && CL_CACHE(class) != NULL) + call zcall4 (CL_CACHE(class), cp, objid, regid, ref) +end + + +# WP_UNCACHE -- Remove an object from the WCSPIX cache. + +procedure wp_uncache (wp, id) + +pointer wp #i WCSPIX structure +int id #i object id + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_UNCACHE(class) != NULL) + call zcall2 (CL_UNCACHE(class), cp, id) + + C_NREF(cp) = 0 +end + + +# WP_WCSTRAN -- Translate image coords to WCS values. + +procedure wp_wcstran (wp, id, x, y) + +pointer wp #i WCSPIX structure +int id #i object id +real x, y #i image coords + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_WCSTRAN(class) != NULL) + call zcall4 (CL_WCSTRAN(class), cp, id, x, y) +end + + +# WP_WCSLIST -- List the available world coordinate systems for the given +# object. + +procedure wp_wcslist (wp, id) + +pointer wp #i WCSPIX structure +int id #i object id + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_WCSLIST(class) != NULL) + call zcall2 (CL_WCSLIST(class), cp, id) +end + + +# WP_OBJINFO -- Get and image header or keyword templates for the given +# object. + +procedure wp_objinfo (wp, id, template) + +pointer wp #i WCSPIX structure +int id #i object id +char template[ARB] #i keyword template + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_OBJINFO(class) != NULL) + call zcall3 (CL_OBJINFO(class), cp, id, template) +end + + +# WP_SETPAR -- Set the value of a WCSPIX ISM parameter. + +procedure wp_setpar (wp, param) + +pointer wp #i WCSPIX structure pointer +char param[SZ_FNAME] #i WCSPIX param name + +char arg[SZ_PARAM], buf[SZ_PARAM], msg[SZ_PARAM] +int line + +int strdic() + +include "class.com" + +begin + if (WCSPIX_DBG) { call printf ("set: %s = ");call pargstr(param) } + + switch (strdic (param, param, SZ_PARAM, WCSPIX_PARAMS)) { + case PAR_PSIZE: + call gargi (WP_PTABSZ(wp)) + if (WCSPIX_DBG) { call printf ("%d\n");call pargi(WP_PTABSZ(wp)) } + + case PAR_BPM: + call gargi (WP_BPM(wp)) + if (WCSPIX_DBG) { call printf ("%d\n");call pargi(WP_BPM(wp)) } + + case PAR_WCS: + call gargwrd (buf, SZ_FNAME) + call gargi (line) + + call strcpy (buf, arg, SZ_PARAM) + call strlwr (buf) + switch (strdic (buf, buf, SZ_FNAME, WCSPIX_SYSTEMS)) { + case SYS_LOGICAL: SYSTEMS(wp,line) = SYS_LOGICAL + case SYS_PHYSICAL: SYSTEMS(wp,line) = SYS_PHYSICAL + case SYS_WORLD: SYSTEMS(wp,line) = SYS_WORLD + case SYS_NONE: SYSTEMS(wp,line) = SYS_NONE + case SYS_AMP: SYSTEMS(wp,line) = SYS_AMP + case SYS_CCD: SYSTEMS(wp,line) = SYS_PHYSICAL + case SYS_DETECTOR: SYSTEMS(wp,line) = SYS_DETECTOR + default: SYSTEMS(wp,line) = SYS_SKY + } + call strcpy (buf, WCSNAME(wp,line), LEN_WCSNAME) + + if (WCSPIX_DBG) { + call printf("%s line=%d\n");call pargstr(buf);call pargi(line) } + + call sprintf (msg, SZ_FNAME, "wcstype %s %d") + call pargstr (arg) + call pargi (line) + call wcspix_message (msg) + + case PAR_FMT: + call gargwrd (buf, SZ_FNAME) + call gargi (line) + + call strcpy (buf, arg, SZ_PARAM) + call strlwr (buf) + switch (strdic (buf, buf, SZ_FNAME, WCSPIX_FMT)) { + case FMT_DEFAULT: FORMATS(wp,line) = FMT_DEFAULT + case FMT_HMS: FORMATS(wp,line) = FMT_HMS + case FMT_DEG: FORMATS(wp,line) = FMT_DEG + case FMT_RAD: FORMATS(wp,line) = FMT_RAD + default: FORMATS(wp,line) = FMT_DEFAULT + } + + if (WCSPIX_DBG) { + call printf("%s line=%d\n");call pargstr(buf);call pargi(line) } + + call sprintf (msg, SZ_FNAME, "wcsfmt %s %d") + call pargstr (arg) + call pargi (line) + call wcspix_message (msg) + } +end + + +# WP_GETPAR -- Get the value of a WCSPIX ISM parameter. + +procedure wp_getpar (wp, param) + +pointer wp #i WCSPIX structure pointer +char param[SZ_FNAME] #i WCSPIX param name + +int strdic() + +begin + if (WCSPIX_DBG) { call printf ("set: %s = ");call pargstr(param) } + + switch (strdic (param, param, SZ_PARAM, WCSPIX_PARAMS)) { + case PAR_PSIZE: + case PAR_BPM: + case PAR_WCS: + case PAR_FMT: + } +end + + +################################################################################ +# +# Private procedures. +# +################################################################################ + + +# WP_INIT -- Initialize the WCSPIX task and data structures. + +pointer procedure wp_init () + +pointer wp #r WCSPIX structure pointer +int i + +begin + # Allocate the task structure. + iferr (call calloc (wp, SZ_WCSPIX, TY_STRUCT)) + call error (0, "Error opening WCSPIX task structure.") + + call calloc (WP_SYSTEMS(wp), MAX_WCSLINES, TY_INT) + call calloc (WP_FORMATS(wp), MAX_WCSLINES, TY_INT) + call calloc (WP_WCS(wp), (LEN_WCSNAME*MAX_WCSLINES), TY_CHAR) + for (i=1; i <= MAX_WCSLINES; i=i+1) { + FORMATS(wp,i) = DEF_FMT + SYSTEMS(wp,i) = DEF_SYSTEM + call strcpy ("none", WCSNAME(wp,i), LEN_WCSNAME) + } + + # Allocate the object cache. + call calloc (WP_CPTR(wp), SZ_CACHE, TY_STRUCT) + for (i=0; i < SZ_CACHE; i=i+1) + call calloc (OBJCACHE(wp,i), SZ_CNODE, TY_STRUCT) + + WP_PTABSZ(wp) = DEF_PTABSZ + WP_BPM(wp) = DEF_BPM_FLAG + + # Initialize the class modules. + call wp_class_init() + + return (wp) +end + + +# WP_READ -- Read messages from the connection and process them optimally for +# this ISM. This means we segment the messages and handle only the last +# few WCS requests so we can keep up with the server requests. Presumably +# there are more cursor events coming which are no longer valid so some are +# thrown out. + +int procedure wp_read (message, len) + +char message[ARB] #o message buffer +int len #o length of message + +int nread + +int xim_read() # low-level i/o +errchk xim_read + +begin + nread = xim_read (message, len) + + return (nread) +end + + +# WP_SHUTDOWN -- Shut down the WCSPIX, freeing all storage + +procedure wp_shutdown (wp) + +pointer wp #i WCSPIX structure +int i + +begin + # Free the structures. + call mfree (WP_WCS(wp), TY_CHAR) + call mfree (WP_FORMATS(wp), TY_INT) + call mfree (WP_SYSTEMS(wp), TY_INT) + for (i=0; i < SZ_CACHE; i=i+1) + call mfree (OBJCACHE(wp,i), TY_STRUCT) + + call mfree (WP_CPTR(wp), TY_STRUCT) + call mfree (wp, TY_STRUCT) +end + + +# WP_CLASS -- Determine the object class for the named image/file. + +int procedure wp_class (object) + +char object[ARB] #i object reference + +int n, class +pointer im +char ch, buf[SZ_FNAME] + +int strlen(), stridx() +bool streq() +pointer immap() + +errchk immap + +begin + # The following kludge is necessary to protect against the case + # where dev$pix is used as a test image. The 'object' pathname in + # this case is "node!/path/dev/pix" which lacks the extension + # and causes the task to fail to open because of a conflict with + # the pix.hhh in the same directory. Most IRAF tasks work since + # the imio$iki code treats the string "dev$pix" as a special case. + + call imgimage (object, buf, SZ_FNAME) + n = strlen (buf) - 7 + if (streq (buf[n], "/dev/pix")) { + call strcpy ("dev$pix", buf, SZ_FNAME) + ch = '[' + n = stridx (ch, object) + if (n > 0) + call strcat (object[n], buf, SZ_FNAME) + call strcpy (buf, object, SZ_FNAME) + } + + + # See if we can map the image to get at least an image class. If + # so then check for special subclasses like Mosaic files, spectra, etc. + + class = UNKNOWN_CLASS + ifnoerr (im = immap (object, READ_ONLY, 0)) { + class = IMAGE_CLASS + + # Now check for subclasses. (TBD) + + call imunmap (im) + } + + return (class) +end + + +# WP_ID2OBJ -- Utility routine to convert and object id to the cache pointer. + +pointer procedure wp_id2obj (wp, id) + +pointer wp #i WCSPIX structure +int id #i object id + +int i +pointer cp + +begin + for (i=0; i < SZ_CACHE; i=i+1) { + cp = OBJCACHE(wp,i) + if (C_OBJID(cp) == id) + return (cp) + } + return (NULL) +end + + +# WP_CLASS_INIT -- Initialize the WCSPIX ISM class modules. + +procedure wp_class_init() + +extern img_init(), img_cache(), img_uncache() +extern img_wcstran(), img_wcslist(), img_objinfo() + +extern mef_init(), mef_cache(), mef_uncache() +extern mef_wcstran(), mef_wcslist(), mef_objinfo() + +extern msp_init(), msp_cache(), msp_uncache() +extern msp_wcstran(), msp_wcslist(), msp_objinfo() + +extern unk_init(), unk_cache(), unk_uncache() +extern unk_wcstran(), unk_wcslist(), unk_objinfo() + +include "class.com" +int locpr() + +begin + cl_nclass = 0 + + # Load the class modules. + call wp_load_class ("unknown", + locpr(unk_init), locpr(unk_cache), locpr(unk_uncache), + locpr(unk_wcstran), locpr(unk_wcslist), locpr(unk_objinfo)) + call wp_load_class ("image", + locpr(img_init), locpr(img_cache), locpr(img_uncache), + locpr(img_wcstran), locpr(img_wcslist), locpr(img_objinfo)) + call wp_load_class ("mef", + locpr(mef_init), locpr(mef_cache), locpr(mef_uncache), + locpr(mef_wcstran), locpr(mef_wcslist), locpr(mef_objinfo)) + call wp_load_class ("multispec", + locpr(msp_init), locpr(msp_cache), locpr(msp_uncache), + locpr(msp_wcstran), locpr(msp_wcslist), locpr(msp_objinfo)) +end + + +# WP_LOAD_CLASS -- Load an object class module for the ISM task. + +procedure wp_load_class (name, init, cache, uncache, tran, list, info) + +char name[ARB] #I module name +int init #I initialize procedure +int cache #I cache the object procedure +int uncache #I uncache the object procedure +int tran #I translate WCS procedure +int list #I list WCS proedure +int info #I get header procedure + +errchk syserrs +include "class.com" + +begin + # Get a new driver slot. + if (cl_nclass + 1 > MAX_CLASSES) + return + cl_nclass = cl_nclass + 1 + + # Load the driver. + CL_INIT(cl_nclass) = init + CL_CACHE(cl_nclass) = cache + CL_UNCACHE(cl_nclass) = uncache + CL_WCSTRAN(cl_nclass) = tran + CL_WCSLIST(cl_nclass) = list + CL_OBJINFO(cl_nclass) = info + call strcpy (name, CL_NAME(cl_nclass), SZ_FNAME) +end + + +# WCSPIX_MESSAGE -- Deliver a message to the ISM callback, tagged with +# our name so it can be passed off to the correct code. + +procedure wcspix_message (message) + +char message[ARB] #I message to send + +pointer sp, msgbuf +int msglen, mlen, ip + +int strlen() + +begin + # Get the message length plus some extra for the braces and padding. + mlen = strlen (message) + msglen = mlen + 64 + + # Allocate and clear the message buffer. + call smark (sp) + call salloc (msgbuf, msglen, TY_CHAR) + call aclrc (Memc[msgbuf], msglen) + + ip = 0 + call amovc ("deliver wcspix { ", Memc[msgbuf], 17) ; ip = ip + 17 + call amovc (message, Memc[msgbuf+ip], mlen) ; ip = ip + mlen + call amovc (" }\0", Memc[msgbuf+ip], 2) ; ip = ip + 2 + + call xim_message ("ism_msg", Memc[msgbuf]) + + call sfree (sp) +end + + +define SZ_WEEKDAY 3 +define SZ_MONTH 3 + +# WP_CNVDATE -- Convert a time in integer seconds since midnight on Jan 1, 1980 +# into a short string such as "5/15 18:24". + +procedure wp_cnvdate (ltime, outstr, maxch) + +long ltime # seconds since 00:00:00 10-Jan-1980 +char outstr[ARB] +int maxch + +int tm[LEN_TMSTRUCT] + +begin + call brktime (ltime, tm) + +# call sprintf (outstr, maxch, "%2d/%2d %2d:%02d") +# call pargi (TM_MONTH(tm)) +# call pargi (TM_MDAY(tm)) +# call pargi (TM_HOUR(tm)) +# call pargi (TM_MIN(tm)) + +# call sprintf (outstr, maxch, "%2d:%02d") +# call pargi (TM_HOUR(tm)) +# call pargi (TM_MIN(tm)) + + call sprintf (outstr, maxch, "%2d:%02d:%02d") + call pargi (TM_HOUR(tm)) + call pargi (TM_MIN(tm)) + call pargi (TM_SEC(tm)) +end + + + +#---------------- +# DEBUG ROUTINES. +#---------------- +procedure dbg_printcache (wp, buf) +pointer wp +char buf[ARB] +pointer cp, wp_id2obj() +int i +begin + call printf ("%s\n") ; call pargstr (buf) + for (i=0; i < SZ_CACHE; i=i+1) { + cp = wp_id2obj (wp, i) + if (C_DATA(cp) != NULL) { + call printf ("%3d: id=%d ref='%s'\n") + call pargi(i) + call pargi(C_OBJID(cp)) + call pargstr(C_REF(cp)) + } + } +end diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.f b/vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.f new file mode 100644 index 00000000..116b7106 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.f @@ -0,0 +1,1975 @@ + subroutine imgint (cp, wp) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer wp + integer img + logical xerpop + logical xerflg + common /xercom/ xerflg + integer*2 st0001(12) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95,105,110,105,116/ + data (st0001(iyy),iyy= 9,12) / 58, 32, 10, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + if (.not.(memi(cp+3) .eq. 0)) goto 120 + call xerpsh + call xcallc(memi(cp+3) , 15, 10 ) + if (.not.xerpop()) goto 130 + goto 100 +130 continue +120 continue + img = memi(cp+3) + memi(img ) = wp + memi(img+1) = 0 + memi(img+3) = 0 + memi(img+4) = 0 + memi(img+5) = 0 + memi(img+6) = 0 + memr(img+9) = 0.0 + memr(img+10) = 0.0 + memi(img+11) = 1 +100 return + end + subroutine imgcae (cp, objid, regid, ref) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer objid + integer regid + integer*2 ref(*) + integer img + integer im + integer wp + integer stat + integer*2 alert(1023 +1) + integer immap + integer dspmmp + integer mwsctn + integer imgams + integer imgdes + integer imaccf + integer skdecm + logical xerpop + logical xerflg + common /xercom/ xerflg + integer*2 st0001(13) + integer*2 st0002(19) + integer*2 st0003(1) + integer*2 st0004(1) + integer*2 st0005(6) + integer*2 st0006(8) + integer*2 st0007(6) + integer*2 st0008(8) + integer*2 st0009(9) + integer*2 st0010(7) + integer*2 st0011(7) + integer*2 st0012(5) + integer*2 st0013(5) + integer*2 st0014(7) + integer*2 st0015(7) + integer*2 st0016(5) + integer*2 st0017(5) + integer*2 st0018(30) + integer*2 st0019(1) + integer*2 st0020(1) + integer*2 st0021(4) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95, 99, 97, 99,104/ + data (st0001(iyy),iyy= 9,13) /101, 58, 32, 10, 0/ + data (st0002(iyy),iyy= 1, 8) / 85,110, 97, 98,108,101, 32,116/ + data (st0002(iyy),iyy= 9,16) /111, 32, 99, 97, 99,104,101, 10/ + data (st0002(iyy),iyy=17,19) / 37,115, 0/ + data st0003 / 0/ + data st0004 / 0/ + data st0005 /119,111,114,108,100, 0/ + data st0006 /108,111,103,105, 99, 97,108, 0/ + data st0007 /119,111,114,108,100, 0/ + data st0008 /108,111,103,105, 99, 97,108, 0/ + data (st0009(iyy),iyy= 1, 8) /112,104,121,115,105, 99, 97,108/ + data (st0009(iyy),iyy= 9, 9) / 0/ + data st0010 / 65, 84, 77, 49, 95, 49, 0/ + data st0011 / 65, 84, 77, 50, 95, 50, 0/ + data st0012 / 65, 84, 86, 49, 0/ + data st0013 / 65, 84, 86, 50, 0/ + data st0014 / 68, 84, 77, 49, 95, 49, 0/ + data st0015 / 68, 84, 77, 50, 95, 50, 0/ + data st0016 / 68, 84, 86, 49, 0/ + data st0017 / 68, 84, 86, 50, 0/ + data (st0018(iyy),iyy= 1, 8) / 85,110, 97, 98,108,101, 32,116/ + data (st0018(iyy),iyy= 9,16) /111, 32,100,101, 99,111,100,101/ + data (st0018(iyy),iyy=17,24) / 32,105,109, 97,103,101, 32, 87/ + data (st0018(iyy),iyy=25,30) / 67, 83, 10, 37,115, 0/ + data st0019 / 0/ + data st0020 / 0/ + data st0021 / 66, 80, 77, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + img = memi(cp+3) + wp = memi(img ) + call xerpsh + memi(img+1) = immap (ref, 1 , 0) + if (.not.xerpop()) goto 120 + call sprinf (alert, 255 , st0002) + call pargsr (ref) + call ximalt (alert, st0003, st0004) + goto 100 +120 continue + memi(img+4) = 0 + memi(img+5) = 0 + memi(img+6) = 0 + call xerpsh + stat = skdecm (memi(img+1) , st0005, memi(img+3) , memi(img+4) + * ) + if (xerflg) goto 132 + if (.not.(stat .eq. -1 .or. memi(img+3) .eq. 0)) goto 140 + memi(img+11) = 1 +140 continue + if (.not.(memi(img+3) .ne. 0)) goto 150 + memi(img+5) = mwsctn (memi(img+3) , st0006, st0007, 3) + if (xerflg) goto 132 + memi(img+6) = mwsctn (memi(img+3) , st0008, st0009, 3) + if (xerflg) goto 132 + im = memi(img+1) + if (.not.(imaccf(im,st0010) .eq. 1 .and. imaccf(im,st0011) . + * eq. 1 .and. imaccf(im,st0012) .eq. 1 .and. imaccf(im,st0013) + * .eq. 1)) goto 160 + memi(img+7) = imgams (im, memi(img+3) ) +160 continue + if (.not.(imaccf(im,st0014) .eq. 1 .and. imaccf(im,st0015) . + * eq. 1 .and. imaccf(im,st0016) .eq. 1 .and. imaccf(im,st0017) + * .eq. 1)) goto 170 + memi(img+8) = imgdes (im, memi(img+3) ) +170 continue +150 continue +132 if (.not.xerpop()) goto 130 + call sprinf (alert, 255 , st0018) + call pargsr (ref) + call ximalt (alert, st0019, st0020) + memi(img+11) = 1 +130 continue + if (.not.(memi(wp+2) .eq. 1)) goto 180 + call xerpsh + memi(img+2) = dspmmp (st0021, memi(img+1) ) + if (.not.xerpop()) goto 190 + memi(img+2) = 0 +190 continue +180 continue + memi(cp) = objid + memi(cp+1) = regid + memi(cp+4) = memi(cp+4) + 1 + call xstrcy(ref, memc((((cp+6)-1)*2+1)) , 128) +100 return + end + subroutine imgune (cp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + integer img + integer*2 st0001(15) + integer*2 st0002(1) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95,117,110, 99, 97/ + data (st0001(iyy),iyy= 9,15) / 99,104,101, 58, 32, 10, 0/ + data st0002 / 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + memi(cp) = 0 + memi(cp+4) = 0 + call xstrcy(st0002, memc((((cp+6)-1)*2+1)) , 255 ) + img = memi(cp+3) + if (.not.(memi(img+3) .ne. 0)) goto 120 + call mwcloe (memi(img+3) ) +120 continue + if (.not.(memi(img+2) .ne. 0)) goto 130 + call imunmp (memi(img+2) ) +130 continue + if (.not.(memi(img+1) .ne. 0)) goto 140 + call imunmp (memi(img+1) ) +140 continue + memi(img+1) = 0 + memi(img+2) = 0 + memi(img+3) = 0 + memi(img+5) = 0 + memi(img+6) = 0 + memi(img+4) = 0 + memr(img+9) = 0.0 + memr(img+10) = 0.0 + memi(img+11) = 0 + call xmfree(memi(cp+3) , 10 ) + memi(cp+3) = 0 +100 return + end + subroutine imgwcn (cp, id, x, y) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + real x + real y + integer img + integer im + integer wp + integer co + double precision dx + double precision dy + double precision wx + double precision wy + double precision pixval + real rx + real ry + integer i + integer bpm + integer*2 buf(1023 +1) + integer*2 msg(1023 +1) + integer*2 wcs(32 +1) + integer*2 xc(32 +1) + integer*2 yc(32 +1) + integer*2 xunits(32 +1) + integer*2 yunits(32 +1) + double precision skstad + integer*2 st0001(15) + integer*2 st0002(37) + integer*2 st0003(29) + integer*2 st0004(41) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95,119, 99,115,116/ + data (st0001(iyy),iyy= 9,15) /114, 97,110, 58, 32, 10, 0/ + data (st0002(iyy),iyy= 1, 8) /119, 99,115,116,114, 97,110, 32/ + data (st0002(iyy),iyy= 9,16) /123, 32,111, 98,106,101, 99,116/ + data (st0002(iyy),iyy=17,24) / 32, 37,100, 32,125, 32,123, 32/ + data (st0002(iyy),iyy=25,32) /114,101,103,105,111,110, 32, 37/ + data (st0002(iyy),iyy=33,37) /100, 32,125, 32, 0/ + data (st0003(iyy),iyy= 1, 8) /123, 32,112,105,120,118, 97,108/ + data (st0003(iyy),iyy= 9,16) / 32, 37, 57, 46, 57,103, 32,125/ + data (st0003(iyy),iyy=17,24) / 32,123, 32, 98,112,109, 32, 37/ + data (st0003(iyy),iyy=25,29) /100, 32,125, 10, 0/ + data (st0004(iyy),iyy= 1, 8) /123, 99,111,111,114,100, 32,123/ + data (st0004(iyy),iyy= 9,16) / 37, 57,115,125, 32,123, 37, 49/ + data (st0004(iyy),iyy=17,24) / 50,115,125, 32,123, 37, 49, 50/ + data (st0004(iyy),iyy=25,32) /115,125, 32,123, 37, 52,115,125/ + data (st0004(iyy),iyy=33,40) / 32,123, 37, 52,115,125,125, 10/ + data (st0004(iyy),iyy=41,41) / 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + img = memi(cp+3) + co = memi(img+4) + wp = memi(img ) + im = memi(img+1) + dx = (dble(x) - skstad(co,1)) / skstad(co,3) + dy = (dble(y) - skstad(co,2)) / skstad(co,4) + rx = dx + ry = dy + call imggea (cp, id, rx, ry, pixval, bpm) + call aclrc (msg, 1023 ) + call sprinf (msg, 1023 , st0002) + call pargi (memi(cp) ) + call pargi (memi(cp+1) ) + call sprinf (buf, 1023 , st0003) + call pargd (pixval) + call pargi (bpm) + call xstrct(buf, msg, 1023 ) + i=1 +120 if (.not.(i .le. 4 )) goto 122 + call imgged (img, dx, dy, memi(memi(wp+3) +i-1), memc(memi( + * wp+4) +(32 *(i-1))), wx, wy) + call imgcos (cp, i, wcs, xunits, yunits) + call imgcot (cp, i, wx, wy, xc, yc) + call sprinf (buf, 1023 , st0004) + call pargsr (wcs) + call pargsr (xc) + call pargsr (yc) + call pargsr (xunits) + call pargsr (yunits) + call xstrct(buf, msg, 1023 ) +121 i=i+1 + goto 120 +122 continue + call wcspie (msg) +100 return + end + subroutine imgwct (cp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + integer img + integer im + integer mw + integer*2 msg(1023 +1) + integer*2 st0001(15) + integer*2 st0002(43) + integer*2 st0003(12) + integer*2 st0004(11) + integer*2 st0005(6) + integer*2 st0006(7) + integer*2 st0007(60) + integer*2 st0008(2) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95,119, 99,115,108/ + data (st0001(iyy),iyy= 9,15) /105,115,116, 58, 32, 10, 0/ + data (st0002(iyy),iyy= 1, 8) /119, 99,115,108,105,115,116, 32/ + data (st0002(iyy),iyy= 9,16) /123, 78,111,110,101, 32, 76,111/ + data (st0002(iyy),iyy=17,24) /103,105, 99, 97,108, 32, 87,111/ + data (st0002(iyy),iyy=25,32) /114,108,100, 32, 80,104,121,115/ + data (st0002(iyy),iyy=33,40) /105, 99, 97,108, 32,108,105,110/ + data (st0002(iyy),iyy=41,43) /101, 32, 0/ + data (st0003(iyy),iyy= 1, 8) / 32, 65,109,112,108,105,102,105/ + data (st0003(iyy),iyy= 9,12) /101,114, 32, 0/ + data (st0004(iyy),iyy= 1, 8) / 32, 68,101,116,101, 99,116,111/ + data (st0004(iyy),iyy= 9,11) /114, 32, 0/ + data st0005 / 32, 67, 67, 68, 32, 0/ + data st0006 / 32,108,105,110,101, 32, 0/ + data (st0007(iyy),iyy= 1, 8) / 70, 75, 53, 32, 70, 75, 52, 32/ + data (st0007(iyy),iyy= 9,16) / 73, 67, 82, 83, 32, 71, 65, 80/ + data (st0007(iyy),iyy=17,24) / 80, 84, 32, 70, 75, 52, 45, 78/ + data (st0007(iyy),iyy=25,32) / 79, 45, 69, 32, 69, 99,108,105/ + data (st0007(iyy),iyy=33,40) /112,116,105, 99, 32, 71, 97,108/ + data (st0007(iyy),iyy=41,48) / 97, 99,116,105, 99, 32, 83,117/ + data (st0007(iyy),iyy=49,56) /112,101,114,103, 97,108, 97, 99/ + data (st0007(iyy),iyy=57,60) /116,105, 99, 0/ + data st0008 /125, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + img = memi(cp+3) + mw = memi(img+3) + im = memi(img+1) + call xstrcy(st0002, msg, 1023 ) + if (.not.(memi(img+7) .ne. 0)) goto 120 + call xstrct(st0003, msg, 1023 ) +120 continue + if (.not.(memi(img+8) .ne. 0)) goto 130 + call xstrct(st0004, msg, 1023 ) +130 continue + if (.not.(memi(img+7) .ne. 0 .or. memi(img+8) .ne. 0)) goto 140 + call xstrct(st0005, msg, 1023 ) +140 continue + call xstrct(st0006, msg, 1023 ) + if (.not.(mw .ne. 0)) goto 150 + call xstrct(st0007, msg, 1023 ) +150 continue + call xstrct(st0008, msg, 1023 ) + call wcspie (msg) +100 return + end + subroutine imggea (cp, id, x, y, pixval, bpmpix) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + real x + real y + double precision pixval + integer bpmpix + integer img + integer wp + integer im + integer bpm + integer pix + integer nl + integer nc + integer ix + integer iy + integer size + integer x1 + integer x2 + integer y1 + integer y2 + integer imgs2r + integer imgs2i + integer*2 st0001(16) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95,103,101,116, 95/ + data (st0001(iyy),iyy= 9,16) /100, 97,116, 97, 58, 32, 10, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + img = memi(cp+3) + wp = memi(img ) + im = memi(img+1) + bpm = memi(img+2) + nc = meml(im+200 +1+8-1) + nl = meml(im+200 +2+8-1) + size = memi(wp+1) + if (.not.(x .lt. 0.0 .or. y .lt. 0.0 .or. x .gt. nc .or. y .gt. + * nl)) goto 120 + goto 100 +120 continue + ix = int (x + 0.5) + iy = int (y + 0.5) + ix = max (size/2+1, ix) + iy = max (size/2+1, iy) + ix = min (ix, (nc-(size/2)-1)) + iy = min (iy, (nl-(size/2)-1)) + x1 = ix - size / 2 + 0.5 + x2 = ix + size / 2 + 0.5 + y1 = iy - size / 2 + 0.5 + y2 = iy + size / 2 + 0.5 + x1 = max (1, x1) + x2 = min (nc, x2) + y1 = max (1, y1) + y2 = min (nl, y2) + pix = imgs2r (im, int(x1), int(x2), int(y1), int(y2)) + if (.not.(bpm .ne. 0 .and. memi(wp+2) .eq. 1)) goto 130 + bpmpix = memi(imgs2i (bpm, ix, ix, iy, iy)) + goto 131 +130 continue + bpmpix = 0 +131 continue + pixval = memr(pix + ((size/2)*size) + (size/2)) * 1.0d0 + if (.not.(memi(wp+1) .gt. 1)) goto 140 + call imgseb (memr(pix), memi(wp+1) , x1, x2, y1, y2) +140 continue +100 return + end + subroutine imgobo (cp, id, temple) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + integer*2 temple(*) + integer im + integer img + integer*2 st0001(15) + integer*2 st0002(7) + integer*2 st0003(7) + integer*2 st0004(96) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /105,109,103, 95,111, 98,106,105/ + data (st0001(iyy),iyy= 9,15) /110,102,111, 58, 32, 10, 0/ + data st0002 /105,109,103,104,100,114, 0/ + data st0003 /119, 99,115,104,100,114, 0/ + data (st0004(iyy),iyy= 1, 8) / 87, 67, 83, 68, 73, 77, 44, 67/ + data (st0004(iyy),iyy= 9,16) / 84, 89, 80, 69, 42, 44, 67, 82/ + data (st0004(iyy),iyy=17,24) / 80, 73, 88, 42, 44, 67, 82, 86/ + data (st0004(iyy),iyy=25,32) / 65, 76, 42, 44, 67, 68, 42, 44/ + data (st0004(iyy),iyy=33,40) / 67, 82, 79, 84, 65, 50, 44, 76/ + data (st0004(iyy),iyy=41,48) / 84, 86, 42, 44, 76, 84, 77, 42/ + data (st0004(iyy),iyy=49,56) / 44, 87, 83, 86, 42, 44, 87, 65/ + data (st0004(iyy),iyy=57,64) / 84, 42, 44, 82, 65, 42, 44, 68/ + data (st0004(iyy),iyy=65,72) / 69, 67, 42, 44, 69, 81, 85, 73/ + data (st0004(iyy),iyy=73,80) / 78, 79, 88, 44, 69, 80, 79, 67/ + data (st0004(iyy),iyy=81,88) / 72, 44, 77, 74, 68, 42, 44, 68/ + data (st0004(iyy),iyy=89,96) / 65, 84, 69, 45, 79, 66, 83, 0/ + if (.not.(.false.)) goto 110 + call xprinf(st0001) +110 continue + img = memi(cp+3) + im = memi(img+1) + call imgser (im, st0002, temple) + call imgser (im, st0003, st0004) + call imgseo (im, cp) + call imgses (im, cp) +100 return + end + subroutine imgser (im, object, temple) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer*2 object(*) + integer*2 temple(*) + integer sp + integer hdr + integer lbuf + integer line + integer field + integer keyw + integer dict + integer ip + integer lp + integer list + integer nlines + integer in + integer out + integer i + integer hdrsie + logical keywfr + integer stropn + integer getlie + integer stridx + integer imgnfn + integer strdic + integer imofnu + logical streq + logical xerflg + common /xercom/ xerflg + integer*2 st0001(5) + integer*2 st0002(2) + integer*2 st0003(2) + integer*2 st0004(2) + integer*2 st0005(3) + integer*2 st0006(2) + integer*2 st0007(5) + integer*2 st0008(2) + integer*2 st0009(11) + save + integer iyy + data st0001 / 37,115, 32,123, 0/ + data st0002 / 42, 0/ + data st0003 /124, 0/ + data st0004 /124, 0/ + data st0005 / 91,123, 0/ + data st0006 /125, 0/ + data st0007 / 37,115, 32,123, 0/ + data st0008 /125, 0/ + data (st0009(iyy),iyy= 1, 8) / 37,100, 32,123, 32, 10, 10, 10/ + data (st0009(iyy),iyy= 9,11) / 32,125, 0/ + hdrsie = (200 + memi(im+30) - (200 +1024 ) ) * 2 - 1 + hdrsie = hdrsie + 1023 + call smark (sp) + call salloc (hdr, hdrsie, 2) + call salloc (dict, hdrsie, 2) + call salloc (field, 1023 , 2) + call salloc (lbuf, 1023 , 2) + call salloc (line, 1023 , 2) + call salloc (keyw, 8, 2) + in = stropn (memc((im+(200 +1024 ) -1)*2 + 1), hdrsie, 1 ) + if (xerflg) goto 100 + out = stropn (memc(hdr), hdrsie, 3) + if (xerflg) goto 100 + call fprinf (out, st0001) + call pargsr (object) + keywfr = (.not.streq (temple, st0002)) + if (.not.(keywfr)) goto 110 + list = imofnu (im, temple) + if (xerflg) goto 100 + call xstrcy(st0003, memc(dict), hdrsie) +120 if (.not.(imgnfn (list, memc(field), 255 ) .ne. -2).and.(. + * not.xerflg)) goto 121 + if (xerflg) goto 100 + call xstrct(memc(field), memc(dict), hdrsie) + call xstrct(st0004, memc(dict), hdrsie) + goto 120 +121 continue + call imcfnl (list) +110 continue + nlines = 0 +130 if (.not.(getlie (in, memc(lbuf)) .ne. -2).and.(.not.xerflg)) + * goto 131 + if (xerflg) goto 100 + call aclrc (memc(line), 1023 ) + ip = lbuf + lp = line +140 if (.not.(memc(ip) .ne. 0 .and. memc(ip) .ne. 10)) goto 141 + if (.not.(stridx (memc(ip), st0005) .gt. 0)) goto 150 + memc(lp) = 92 + lp = lp + 1 +150 continue + memc(lp) = memc(ip) + ip = ip + 1 + lp = lp + 1 + goto 140 +141 continue + memc(lp) = 10 + memc(lp+1) = 0 + if (.not.(keywfr)) goto 160 + i=0 +170 if (.not.(i .lt. 8 .and. .not.(memc(line+i).eq.32.or.memc + * (line+i).eq.9))) goto 172 + memc(keyw+i) = memc(line+i) +171 i=i+1 + goto 170 +172 continue + memc(keyw+i) = 0 + if (.not.(strdic (memc(keyw), memc(keyw), 8, memc(dict)) + * .eq. 0).and.(.not.xerflg)) goto 180 + if (xerflg) goto 100 + goto 130 +180 continue +160 continue + call putci (out, 32) + if (xerflg) goto 100 + call putlie (out, memc(line)) + if (xerflg) goto 100 + nlines = nlines + 1 + if (.not.(mod(nlines,10) .eq. 0)) goto 190 + call fprinf (out, st0006) + call xfcloe(out) + call wcspie (memc(hdr)) + call aclrc (memc(hdr), hdrsie) + out = stropn (memc(hdr), hdrsie, 3) + if (xerflg) goto 100 + call fprinf (out, st0007) + call pargsr (object) +190 continue + goto 130 +131 continue + call fprinf (out, st0008) + call xfcloe(in) + call xfcloe(out) + call wcspie (memc(hdr)) + call sprinf (memc(hdr), 1023 , st0009) + call pargsr (object) + call wcspie (memc(hdr)) + call sfree (sp) +100 return + end + subroutine imgses (im, cp) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer cp + integer sp + integer buf + integer img + integer co + double precision cx + double precision cy + double precision cx1 + double precision cy1 + double precision dx + double precision dy + double precision x1 + double precision y1 + double precision cosa + double precision sina + double precision angle + integer i + integer j + integer compx + integer compy + integer*4 axis(7 ) + integer*4 lv(7 ) + integer*4 pv1(7 ) + integer*4 pv2(7 ) + integer*2 st0001(24) + integer*2 st0002(4) + integer*2 st0003(4) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 99,111,109,112, 97,115,115, 32/ + data (st0001(iyy),iyy= 9,16) / 37,100, 32, 37,103, 32, 37,100/ + data (st0001(iyy),iyy=17,24) / 32, 37,100, 32, 37,115, 0, 0/ + data st0002 / 69, 32, 78, 0/ + data st0003 / 88, 32, 89, 0/ + call smark (sp) + call salloc (buf, 1023 , 2) + call aclrc (memc(buf), 1023 ) + img = memi(cp+3) + co = memi(img+4) + if (.not.(memi(img+5) .ne. 0)) goto 110 + if (.not.(memr(img+9) .gt. 0.0)) goto 120 + angle = -memr(img+9) + goto 121 +120 continue + angle = memr(img+9) + 360.0 +121 continue + cosa = cos (((angle)/57.295779513082320877)) + sina = sin (((angle)/57.295779513082320877)) + cx = meml(im+200 +1+8-1) / 2.0d0 + cy = meml(im+200 +2+8-1) / 2.0d0 + call mwc2td (memi(img+5) , cx, cy, cx1, cy1) + dx = cx + ( 10.0 * sina) + dy = cy + ( 10.0 * cosa) + call mwc2td (memi(img+5) , dx, dy, x1, y1) + if (.not.(y1 .ge. cy1)) goto 130 + compy = 1 + goto 131 +130 continue + compy = -1 +131 continue + dx = cx + (-10.0 * cosa) + dy = cy + ( 10.0 * sina) + call mwc2td (memi(img+5) , dx, dy, x1, y1) + if (.not.(x1 .ge. cx1)) goto 140 + compx = 1 + goto 141 +140 continue + compx = -1 +141 continue + goto 111 +110 continue + lv(1) = 0 + lv(2) = 0 + call imaplv (im, lv, pv1, 2) + lv(1) = 1 + lv(2) = 1 + call imaplv (im, lv, pv2, 2) + i = 1 + axis(1) = 1 + axis(2) = 2 + do 150 j = 1, 7 + if (.not.(pv1(j) .ne. pv2(j))) goto 160 + axis(i) = j + i = i + 1 +160 continue +150 continue +151 continue + compx = - (pv2(axis(1)) - pv1(axis(1))) + compy = (pv2(axis(2)) - pv1(axis(2))) +111 continue + call sprinf (memc(buf), 1023 , st0001) + call pargi (memi(cp) ) + call pargr (memr(img+9) ) + call pargi (compx) + call pargi (compy) + if (.not.(memi(img+3) .ne. 0)) goto 170 + call pargsr (st0002) + goto 171 +170 continue + call pargsr (st0003) +171 continue + call wcspie (memc(buf)) + call sfree (sp) +100 return + end + subroutine imgseo (im, cp) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer cp + integer sp + integer co + integer img + integer mw + integer buf + integer proj + integer radecr + integer fd + integer radecs + integer ctype + integer wtype + integer ndim + double precision crpix1 + double precision crpix2 + double precision crval1 + double precision crval2 + double precision cval1 + double precision cval2 + double precision xscale + double precision yscale + double precision xrot + double precision yrot + double precision r(7 ) + double precision w(7 ) + double precision cd(7 ,7 ) + integer idxstr + integer skstai + integer stropn + integer mwstai + double precision skstad + double precision slepj + double precision slepb + logical fpequd + integer sw0001,sw0002 + logical xerflg + common /xercom/ xerflg + integer*2 st0001(21) + integer*2 st0002(15) + integer*2 st0003(15) + integer*2 st0004(29) + integer*2 st0005(15) + integer*2 st0006(15) + integer*2 st0007(30) + integer*2 st0008(4) + integer*2 st0009(114) + integer*2 st0010(8) + integer*2 st0011(11) + integer*2 st0012(52) + integer*2 st0013(11) + integer*2 st0014(9) + integer*2 st0015(1) + integer*2 st0016(9) + integer*2 st0017(1) + integer*2 st0018(14) + integer*2 st0019(1) + integer*2 st0020(7) + integer*2 st0021(1) + integer*2 st0022(25) + integer*2 st0023(41) + integer*2 st0024(53) + integer*2 st0025(4) + integer*2 st0026(4) + integer*2 st0027(4) + integer*2 st0028(4) + integer*2 st0029(53) + integer*2 st0030(4) + integer*2 st0031(4) + integer*2 st0032(4) + integer*2 st0033(4) + integer*2 st0034(58) + integer*2 st0035(55) + integer*2 st0036(57) + integer*2 st0037(2) + integer*2 st0038(2) + integer*2 st0039(2) + integer*2 st0040(2) + integer*2 st0041(2) + integer*2 st0042(2) + integer*2 st0043(25) + integer*2 st0044(7) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 87, 67, 83, 32, 73,110,102,111/ + data (st0001(iyy),iyy= 9,16) / 58, 10, 61, 61, 61, 61, 61, 61/ + data (st0001(iyy),iyy=17,21) / 61, 61, 61, 10, 0/ + data (st0002(iyy),iyy= 1, 8) / 82, 32,116,101,114,109, 58, 32/ + data (st0002(iyy),iyy= 9,15) / 37,103, 32, 37,103, 10, 0/ + data (st0003(iyy),iyy= 1, 8) / 87, 32,116,101,114,109, 58, 32/ + data (st0003(iyy),iyy= 9,15) / 37,103, 32, 37,103, 10, 0/ + data (st0004(iyy),iyy= 1, 8) / 32, 32, 32, 32, 99,100, 58, 32/ + data (st0004(iyy),iyy= 9,16) / 37,103, 32, 37,103, 10, 32, 32/ + data (st0004(iyy),iyy=17,24) / 32, 32, 32, 32, 32, 32, 37,103/ + data (st0004(iyy),iyy=25,29) / 32, 37,103, 10, 0/ + data (st0005(iyy),iyy= 1, 8) / 32,115, 99, 97,108,101, 58, 32/ + data (st0005(iyy),iyy= 9,15) / 37,103, 32, 37,103, 10, 0/ + data (st0006(iyy),iyy= 1, 8) / 32, 32, 32,114,111,116, 58, 32/ + data (st0006(iyy),iyy= 9,15) / 37,103, 32, 37,103, 10, 0/ + data (st0007(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0007(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0007(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0007(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0008 / 70, 75, 53, 0/ + data (st0009(iyy),iyy= 1, 8) /124,108,105,110,124, 97,122,112/ + data (st0009(iyy),iyy= 9,16) /124,116, 97,110,124,115,105,110/ + data (st0009(iyy),iyy=17,24) /124,115,116,103,124, 97,114, 99/ + data (st0009(iyy),iyy=25,32) /124,122,112,110,124,122,101, 97/ + data (st0009(iyy),iyy=33,40) /124, 97,105,114,124, 99,121,112/ + data (st0009(iyy),iyy=41,48) /124, 99, 97,114,124,109,101,114/ + data (st0009(iyy),iyy=49,56) /124, 99,101, 97,124, 99,111,112/ + data (st0009(iyy),iyy=57,64) /124, 99,111,100,124, 99,111,101/ + data (st0009(iyy),iyy=65,72) /124, 99,111,111,124, 98,111,110/ + data (st0009(iyy),iyy=73,80) /124,112, 99,111,124,103,108,115/ + data (st0009(iyy),iyy=81,88) /124,112, 97,114,124, 97,105,116/ + data (st0009(iyy),iyy=89,96) /124,109,111,108,124, 99,115, 99/ + data (st0009(iyy),iyy=97,104) /124,113,115, 99,124,116,115, 99/ + data (st0009(iyy),iyy=105,112) /124,116,110,120,124,122,112,120/ + data (st0009(iyy),iyy=113,114) /124, 0/ + data st0010 /108,111,103,105, 99, 97,108, 0/ + data (st0011(iyy),iyy= 1, 8) /119, 99,115,105,110,102,111, 32/ + data (st0011(iyy),iyy= 9,11) /123, 10, 0/ + data (st0012(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 32, 80,114/ + data (st0012(iyy),iyy= 9,16) /111,106,101, 99,116,105,111,110/ + data (st0012(iyy),iyy=17,24) / 58, 32, 32, 37, 45, 54,115, 9/ + data (st0012(iyy),iyy=25,32) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0012(iyy),iyy=33,40) / 32, 32, 32, 32, 83,121,115,116/ + data (st0012(iyy),iyy=41,48) /101,109, 58, 32, 32, 37,115, 32/ + data (st0012(iyy),iyy=49,52) / 37,115, 10, 0/ + data (st0013(iyy),iyy= 1, 8) / 69,113,117, 97,116,111,114,105/ + data (st0013(iyy),iyy= 9,11) / 97,108, 0/ + data (st0014(iyy),iyy= 1, 8) / 69, 99,108,105,112,116,105, 99/ + data (st0014(iyy),iyy= 9, 9) / 0/ + data st0015 / 0/ + data (st0016(iyy),iyy= 1, 8) / 71, 97,108, 97, 99,116,105, 99/ + data (st0016(iyy),iyy= 9, 9) / 0/ + data st0017 / 0/ + data (st0018(iyy),iyy= 1, 8) / 83,117,112,101,114, 71, 97,108/ + data (st0018(iyy),iyy= 9,14) / 97, 99,116,105, 99, 0/ + data st0019 / 0/ + data st0020 / 76,105,110,101, 97,114, 0/ + data st0021 / 0/ + data (st0022(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 82, 97, 47/ + data (st0022(iyy),iyy= 9,16) / 68,101, 99, 32, 97,120,101,115/ + data (st0022(iyy),iyy=17,24) / 58, 32, 32, 37,100, 47, 37,100/ + data (st0022(iyy),iyy=25,25) / 0/ + data (st0023(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0023(iyy),iyy= 9,16) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0023(iyy),iyy=17,24) / 32, 32, 68,105,109,101,110,115/ + data (st0023(iyy),iyy=25,32) /105,111,110,115, 58, 32, 32, 37/ + data (st0023(iyy),iyy=33,40) /100, 32,120, 32, 37,100, 10, 10/ + data (st0023(iyy),iyy=41,41) / 0/ + data (st0024(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 32, 67,101/ + data (st0024(iyy),iyy= 9,16) /110,116,101,114, 32, 80,111,115/ + data (st0024(iyy),iyy=17,24) / 58, 32, 37, 51,115, 58, 32, 32/ + data (st0024(iyy),iyy=25,32) / 37, 45, 49, 50, 72, 32, 32, 32/ + data (st0024(iyy),iyy=33,40) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0024(iyy),iyy=41,48) / 37, 51,115, 58, 32, 32, 37, 45/ + data (st0024(iyy),iyy=49,53) / 49, 50,104, 10, 0/ + data st0025 / 32, 82, 65, 0/ + data st0026 / 76,111,110, 0/ + data st0027 / 68,101, 99, 0/ + data st0028 / 76, 97,116, 0/ + data (st0029(iyy),iyy= 1, 8) / 32, 32, 32, 82,101,102,101,114/ + data (st0029(iyy),iyy= 9,16) /101,110, 99,101, 32, 80,111,115/ + data (st0029(iyy),iyy=17,24) / 58, 32, 37, 51,115, 58, 32, 32/ + data (st0029(iyy),iyy=25,32) / 37, 45, 49, 50, 72, 32, 32, 32/ + data (st0029(iyy),iyy=33,40) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0029(iyy),iyy=41,48) / 37, 51,115, 58, 32, 32, 37, 45/ + data (st0029(iyy),iyy=49,53) / 49, 50,104, 10, 0/ + data st0030 / 32, 82, 65, 0/ + data st0031 / 76,111,110, 0/ + data st0032 / 68,101, 99, 0/ + data st0033 / 76, 97,116, 0/ + data (st0034(iyy),iyy= 1, 8) / 32, 82,101,102,101,114,101,110/ + data (st0034(iyy),iyy= 9,16) / 99,101, 32, 80,105,120,101,108/ + data (st0034(iyy),iyy=17,24) / 58, 32, 32, 32, 88, 58, 32, 32/ + data (st0034(iyy),iyy=25,32) / 37, 45, 57, 46, 52,102, 32, 32/ + data (st0034(iyy),iyy=33,40) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0034(iyy),iyy=41,48) / 32, 32, 32, 32, 32, 32, 89, 58/ + data (st0034(iyy),iyy=49,56) / 32, 32, 37, 45, 57, 46, 52,102/ + data (st0034(iyy),iyy=57,58) / 10, 0/ + data (st0035(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 80,108, 97/ + data (st0035(iyy),iyy= 9,16) /116,101, 32, 83, 99, 97,108,101/ + data (st0035(iyy),iyy=17,24) / 58, 32, 32, 37, 45, 56,102, 32/ + data (st0035(iyy),iyy=25,32) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0035(iyy),iyy=33,40) / 32, 32, 32, 32, 32, 82,111,116/ + data (st0035(iyy),iyy=41,48) / 32, 65,110,103,108,101, 58, 32/ + data (st0035(iyy),iyy=49,55) / 32, 37, 45, 56,102, 10, 0/ + data (st0036(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0036(iyy),iyy= 9,16) / 32, 69,113,117,105,110,111,120/ + data (st0036(iyy),iyy=17,24) / 58, 32, 32, 37,115, 37, 56,102/ + data (st0036(iyy),iyy=25,32) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0036(iyy),iyy=33,40) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0036(iyy),iyy=41,48) / 32, 69,112,111, 99,104, 58, 32/ + data (st0036(iyy),iyy=49,56) / 32, 37,115, 37, 46, 54,102, 10/ + data (st0036(iyy),iyy=57,57) / 0/ + data st0037 / 74, 0/ + data st0038 / 74, 0/ + data st0039 / 32, 0/ + data st0040 / 32, 0/ + data st0041 / 66, 0/ + data st0042 / 66, 0/ + data (st0043(iyy),iyy= 1, 8) / 32, 32, 32, 32, 32, 32, 32, 32/ + data (st0043(iyy),iyy= 9,16) / 32, 32, 32, 32, 32, 77, 74, 68/ + data (st0043(iyy),iyy=17,24) / 58, 32, 32, 37, 46, 54,102, 10/ + data (st0043(iyy),iyy=25,25) / 0/ + data st0044 /125, 10, 32, 10, 32, 10, 0/ + call smark (sp) + call salloc (buf, 1023 , 2) + call salloc (proj, 255 , 2) + call salloc (radecr, 255 , 2) + fd = stropn (memc(buf), 1023 , 3) + if (xerflg) goto 100 + img = memi(cp+3) + co = memi(img+4) + radecs = skstai (co, 8) + ctype = skstai (co, 7) + wtype = skstai (co, 9) + mw = memi(img+3) + if (.not.(mw .ne. 0)) goto 110 + ndim = mwstai (mw, 5 ) + call wcsgfm (mw, r, w, cd, ndim) + crpix1 = r(1) + crpix2 = r(2) + crval1 = w(1) + crval2 = w(2) + xscale = sqrt (cd(1,1)**2 + cd(2,1)**2) * 3600.0d0 + yscale = sqrt (cd(1,2)**2 + cd(2,2)**2) * 3600.0d0 + xrot = 0.0 + yrot = 0.0 + if (.not.(.not.fpequd (cd(1,1), 0.0d0))) goto 120 + xrot = ((atan ( cd(2,1) / cd(1,1)))*57.295779513082320877 + * d0) +120 continue + if (.not.(.not.fpequd (cd(2,2), 0.0d0))) goto 130 + yrot = ((atan (-cd(1,2) / cd(2,2)))*57.295779513082320877 + * d0) +130 continue + goto 111 +110 continue + ndim = 2 + xscale = 1.0 + yscale = 1.0 + xrot = 0.0 + yrot = 0.0 +111 continue + if (.not.(.false.)) goto 140 + call xprinf(st0001) + call xprinf(st0002) + call pargd(r(1)) + call pargd(r(2)) + call xprinf(st0003) + call pargd(w(1)) + call pargd(w(2)) + call xprinf(st0004) + call pargd(cd(1,1)) + call pargd(cd(1,2)) + call pargd(cd(2,1)) + call pargd(cd(2,2)) + call xprinf(st0005) + call pargd(xscale) + call pargd(yscale) + call xprinf(st0006) + call pargd(xrot) + call pargd(yrot) +140 continue + memr(img+10) = (xscale + yscale) / 2.0d0 + memr(img+9) = xrot + if (.not.(idxstr (radecs, memc(radecr), 255 , st0007) .le. 0)) + * goto 150 + call xstrcy(st0008, memc(radecr), 255 ) +150 continue + call strupr (memc(radecr)) + if (.not.(idxstr (wtype, memc(proj), 255 , st0009) .le. 0)) + * goto 160 + call xstrcy(st0010, memc(proj), 255 ) +160 continue + call strupr (memc(proj)) + call fprinf (fd, st0011) + call fprinf (fd, st0012) + call pargsr (memc(proj)) + sw0001=(ctype) + goto 170 +180 continue + call pargsr (st0013) + call pargsr (memc(radecr)) + goto 171 +190 continue + call pargsr (st0014) + call pargsr (st0015) + goto 171 +200 continue + call pargsr (st0016) + call pargsr (st0017) + goto 171 +210 continue + call pargsr (st0018) + call pargsr (st0019) + goto 171 +220 continue + call pargsr (st0020) + call pargsr (st0021) + goto 171 +170 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 220 + goto (180,190,200,210),sw0001 +171 continue + call fprinf (fd, st0022) + call pargi (skstai (co, 10)) + call pargi (skstai (co, 11)) + call fprinf (fd, st0023) + call pargi (meml(im+200 +1+8-1) ) + call pargi (meml(im+200 +2+8-1) ) + call fprinf (fd, st0024) + if (.not.(ctype .eq. 1)) goto 230 + call pargsr (st0025) + goto 231 +230 continue + call pargsr (st0026) +231 continue + call pargd (cval1) + if (.not.(ctype .eq. 1)) goto 240 + call pargsr (st0027) + goto 241 +240 continue + call pargsr (st0028) +241 continue + call pargd (cval2) + call fprinf (fd, st0029) + if (.not.(ctype .eq. 1)) goto 250 + call pargsr (st0030) + goto 251 +250 continue + call pargsr (st0031) +251 continue + call pargd (crval1) + if (.not.(ctype .eq. 1)) goto 260 + call pargsr (st0032) + goto 261 +260 continue + call pargsr (st0033) +261 continue + call pargd (crval2) + call fprinf (fd, st0034) + call pargd (crpix1) + call pargd (crpix2) + call fprinf (fd, st0035) + call pargr (memr(img+10) ) + call pargr (memr(img+9) ) + call fprinf (fd, st0036) + sw0002=(radecs) + goto 270 +280 continue + call pargsr (st0037) + call pargd (skstad(co,5)) + call pargsr (st0038) + call pargd (slepj(skstad(co,6))) + goto 271 +290 continue + if (.not.(memi(img+11) .eq. 1)) goto 300 + call pargsr (st0039) + call pargd (1.6d308) + call pargsr (st0040) + call pargd (1.6d308) + goto 301 +300 continue + call pargsr (st0041) + call pargd (skstad(co,5)) + call pargsr (st0042) + call pargd (slepb(skstad(co,6))) +301 continue + goto 271 +270 continue + if (sw0002.eq.3) goto 280 + if (sw0002.eq.4) goto 280 + goto 290 +271 continue + call fprinf (fd, st0043) + call pargd (skstad(co,6)) + call fprinf (fd, st0044) + call xfcloe(fd) + call wcspie (memc(buf)) + call sfree (sp) +100 return + end + subroutine imgseb (pixtab, size, x1, x2, y1, y2) + integer size + integer x1 + integer x2 + integer y1 + integer y2 + real pixtab(*) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer sp + integer buf + integer el + integer i + integer j + integer npix + real pix + real sum + real sum2 + real mean + real var + real stdev + real x + real y + integer*2 st0001(20) + integer*2 st0002(10) + integer*2 st0003(2) + integer*2 st0004(5) + integer*2 st0005(2) + integer*2 st0006(10) + integer*2 st0007(3) + integer*2 st0008(2) + integer*2 st0009(10) + integer*2 st0010(3) + integer*2 st0011(20) + integer*2 st0012(2) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /112,105,120,116, 97, 98, 32,123/ + data (st0001(iyy),iyy= 9,16) / 10,123, 10,116, 97, 98,108,101/ + data (st0001(iyy),iyy=17,20) / 32,123, 10, 0/ + data (st0002(iyy),iyy= 1, 8) / 32,123, 37, 49, 48, 46, 49,102/ + data (st0002(iyy),iyy= 9,10) /125, 0/ + data st0003 / 10, 0/ + data st0004 /125, 10,125, 10, 0/ + data st0005 /123, 0/ + data (st0006(iyy),iyy= 1, 8) / 32,123, 37, 49, 48, 46, 49,102/ + data (st0006(iyy),iyy= 9,10) /125, 0/ + data st0007 /125, 10, 0/ + data st0008 /123, 0/ + data (st0009(iyy),iyy= 1, 8) / 32,123, 37, 49, 48, 46, 49,102/ + data (st0009(iyy),iyy= 9,10) /125, 0/ + data st0010 /125, 10, 0/ + data (st0011(iyy),iyy= 1, 8) / 32,123, 32, 37, 49, 48, 46, 50/ + data (st0011(iyy),iyy= 9,16) /102, 32, 37, 49, 48, 46, 52,102/ + data (st0011(iyy),iyy=17,20) / 32,125, 10, 0/ + data st0012 /125, 0/ + call smark (sp) + call salloc (buf, (6*1023 ), 2) + call salloc (el, 255 , 2) + call xstrcy(st0001, memc(buf), (6*1023 )) + sum = 0.0 + sum2 = 0.0 + npix = size * size + i=size - 1 +110 if (.not.(i .ge. 0)) goto 112 + j=1 +120 if (.not.(j .le. size)) goto 122 + pix = pixtab((i * size) + j) + sum = sum + pix + sum2 = sum2 + (pix * pix) + call sprinf (memc(el), 255 , st0002) + call pargr (pix) + call xstrct(memc(el), memc(buf), (6*1023 )) +121 j=j+1 + goto 120 +122 continue + call xstrct(st0003, memc(buf), (6*1023 )) +111 i=i-1 + goto 110 +112 continue + call xstrct(st0004, memc(buf), (6*1023 )) + call xstrct(st0005, memc(buf), (6*1023 )) + x = x1 +130 if (.not.(x .le. x2)) goto 132 + call sprinf (memc(el), 255 , st0006) + call pargr (x) + call xstrct(memc(el), memc(buf), (6*1023 )) +131 x = x + 1. + goto 130 +132 continue + call xstrct(st0007, memc(buf), (6*1023 )) + call xstrct(st0008, memc(buf), (6*1023 )) + y = y2 +140 if (.not.(y .ge. y1)) goto 142 + call sprinf (memc(el), 255 , st0009) + call pargr (y) + call xstrct(memc(el), memc(buf), (6*1023 )) +141 y = y - 1. + goto 140 +142 continue + call xstrct(st0010, memc(buf), (6*1023 )) + mean = sum / real(npix) + var = (sum2 - sum * mean) / real(npix - 1) + if (.not.(var .le. 0)) goto 150 + stdev = 0.0 + goto 151 +150 continue + stdev = sqrt (var) +151 continue + call sprinf (memc(el), 255 , st0011) + call pargr (mean) + call pargr (stdev) + call xstrct(memc(el), memc(buf), (6*1023 )) + call xstrct(st0012, memc(buf), (6*1023 )) + call wcspie (memc(buf)) + call sfree (sp) +100 return + end + integer function imgams (im, mw) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer mw + integer ct + double precision r(7 ) + double precision w(7 ) + double precision cd(7 ,7 ) + double precision imgetd + integer mwsctn + integer*2 st0001(5) + integer*2 st0002(5) + integer*2 st0003(7) + integer*2 st0004(7) + integer*2 st0005(10) + integer*2 st0006(8) + integer*2 st0007(10) + save + integer iyy + data st0001 / 65, 84, 86, 49, 0/ + data st0002 / 65, 84, 86, 50, 0/ + data st0003 / 65, 84, 77, 49, 95, 49, 0/ + data st0004 / 65, 84, 77, 50, 95, 50, 0/ + data (st0005(iyy),iyy= 1, 8) / 97,109,112,108,105,102,105,101/ + data (st0005(iyy),iyy= 9,10) /114, 0/ + data st0006 /108,111,103,105, 99, 97,108, 0/ + data (st0007(iyy),iyy= 1, 8) / 97,109,112,108,105,102,105,101/ + data (st0007(iyy),iyy= 9,10) /114, 0/ + r(1) = 0.0d0 + r(2) = 0.0d0 + w(1) = imgetd (im, st0001) + w(2) = imgetd (im, st0002) + cd(1,1) = imgetd (im, st0003) + cd(1,2) = 0.0d0 + cd(2,1) = 0.0d0 + cd(2,2) = imgetd (im, st0004) + call mwnewm (mw, st0005, 2) + call mwswtd (mw, r, w, cd, 2) + ct = mwsctn (mw, st0006, st0007, 3) + call mwsdes (mw) + imgams = (ct) + goto 100 +100 return + end + integer function imgdes (im, mw) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer im + integer mw + integer ct + double precision r(7 ) + double precision w(7 ) + double precision cd(7 ,7 ) + double precision imgetd + integer mwsctn + integer*2 st0001(5) + integer*2 st0002(5) + integer*2 st0003(7) + integer*2 st0004(7) + integer*2 st0005(9) + integer*2 st0006(8) + integer*2 st0007(9) + save + integer iyy + data st0001 / 68, 84, 86, 49, 0/ + data st0002 / 68, 84, 86, 50, 0/ + data st0003 / 68, 84, 77, 49, 95, 49, 0/ + data st0004 / 68, 84, 77, 50, 95, 50, 0/ + data (st0005(iyy),iyy= 1, 8) /100,101,116,101, 99,116,111,114/ + data (st0005(iyy),iyy= 9, 9) / 0/ + data st0006 /108,111,103,105, 99, 97,108, 0/ + data (st0007(iyy),iyy= 1, 8) /100,101,116,101, 99,116,111,114/ + data (st0007(iyy),iyy= 9, 9) / 0/ + r(1) = 0.0d0 + r(2) = 0.0d0 + w(1) = imgetd (im, st0001) + w(2) = imgetd (im, st0002) + cd(1,1) = imgetd (im, st0003) + cd(1,2) = 0.0d0 + cd(2,1) = 0.0d0 + cd(2,2) = imgetd (im, st0004) + call mwnewm (mw, st0005, 2) + call mwswtd (mw, r, w, cd, 2) + ct = mwsctn (mw, st0006, st0007, 3) + call mwsdes (mw) + imgdes = (ct) + goto 100 +100 return + end + subroutine imgcos (cp, line, wcsnae, xunits, yunits) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer line + integer*2 wcsnae(*) + integer*2 xunits(*) + integer*2 yunits(*) + integer img + integer co + integer wp + integer sp + integer proj + integer radecr + integer xstrcp + integer skstai + integer idxstr + integer sw0001,sw0002 + integer*2 st0001(5) + integer*2 st0002(5) + integer*2 st0003(5) + integer*2 st0004(5) + integer*2 st0005(5) + integer*2 st0006(5) + integer*2 st0007(5) + integer*2 st0008(5) + integer*2 st0009(9) + integer*2 st0010(5) + integer*2 st0011(5) + integer*2 st0012(9) + integer*2 st0013(5) + integer*2 st0014(5) + integer*2 st0015(14) + integer*2 st0016(5) + integer*2 st0017(5) + integer*2 st0018(5) + integer*2 st0019(5) + integer*2 st0020(2) + integer*2 st0021(2) + integer*2 st0022(9) + integer*2 st0023(3) + integer*2 st0024(4) + integer*2 st0025(4) + integer*2 st0026(5) + integer*2 st0027(5) + integer*2 st0028(30) + integer*2 st0029(4) + integer*2 st0030(2) + integer*2 st0031(3) + integer*2 st0032(114) + integer*2 st0033(7) + integer*2 st0034(4) + integer*2 st0035(4) + integer*2 st0036(5) + integer*2 st0037(6) + integer*2 st0038(9) + save + integer iyy + data st0001 / 32, 32, 82, 65, 0/ + data st0002 / 32, 68,101, 99, 0/ + data st0003 / 69, 76,111,110, 0/ + data st0004 / 69, 76, 97,116, 0/ + data st0005 / 71, 76,111,110, 0/ + data st0006 / 71, 76, 97,116, 0/ + data st0007 / 83, 76,111,110, 0/ + data st0008 / 83, 76, 97,116, 0/ + data (st0009(iyy),iyy= 1, 8) /101, 99,108,105,112,116,105, 99/ + data (st0009(iyy),iyy= 9, 9) / 0/ + data st0010 / 69, 76,111,110, 0/ + data st0011 / 69, 76, 97,116, 0/ + data (st0012(iyy),iyy= 1, 8) /103, 97,108, 97, 99,116,105, 99/ + data (st0012(iyy),iyy= 9, 9) / 0/ + data st0013 / 71, 76,111,110, 0/ + data st0014 / 71, 76, 97,116, 0/ + data (st0015(iyy),iyy= 1, 8) /115,117,112,101,114,103, 97,108/ + data (st0015(iyy),iyy= 9,14) / 97, 99,116,105, 99, 0/ + data st0016 / 83, 76,111,110, 0/ + data st0017 / 83, 76, 97,116, 0/ + data st0018 / 32, 32, 82, 65, 0/ + data st0019 / 32, 68,101, 99, 0/ + data st0020 / 88, 0/ + data st0021 / 89, 0/ + data (st0022(iyy),iyy= 1, 8) / 37,115, 45, 37,115, 45, 37,115/ + data (st0022(iyy),iyy= 9, 9) / 0/ + data st0023 / 69, 81, 0/ + data st0024 / 69, 67, 76, 0/ + data st0025 / 71, 65, 76, 0/ + data st0026 / 83, 71, 65, 76, 0/ + data st0027 / 85, 78, 75, 78, 0/ + data (st0028(iyy),iyy= 1, 8) /124,102,107, 52,124,102,107, 52/ + data (st0028(iyy),iyy= 9,16) / 45,110,111, 45,101,124,102,107/ + data (st0028(iyy),iyy=17,24) / 53,124,105, 99,114,115,124,103/ + data (st0028(iyy),iyy=25,30) / 97,112,112,116,124, 0/ + data st0029 / 70, 75, 53, 0/ + data st0030 / 45, 0/ + data st0031 / 45, 45, 0/ + data (st0032(iyy),iyy= 1, 8) /124,108,105,110,124, 97,122,112/ + data (st0032(iyy),iyy= 9,16) /124,116, 97,110,124,115,105,110/ + data (st0032(iyy),iyy=17,24) /124,115,116,103,124, 97,114, 99/ + data (st0032(iyy),iyy=25,32) /124,122,112,110,124,122,101, 97/ + data (st0032(iyy),iyy=33,40) /124, 97,105,114,124, 99,121,112/ + data (st0032(iyy),iyy=41,48) /124, 99, 97,114,124,109,101,114/ + data (st0032(iyy),iyy=49,56) /124, 99,101, 97,124, 99,111,112/ + data (st0032(iyy),iyy=57,64) /124, 99,111,100,124, 99,111,101/ + data (st0032(iyy),iyy=65,72) /124, 99,111,111,124, 98,111,110/ + data (st0032(iyy),iyy=73,80) /124,112, 99,111,124,103,108,115/ + data (st0032(iyy),iyy=81,88) /124,112, 97,114,124, 97,105,116/ + data (st0032(iyy),iyy=89,96) /124,109,111,108,124, 99,115, 99/ + data (st0032(iyy),iyy=97,104) /124,113,115, 99,124,116,115, 99/ + data (st0032(iyy),iyy=105,112) /124,116,110,120,124,122,112,120/ + data (st0032(iyy),iyy=113,114) /124, 0/ + data st0033 /108,105,110,101, 97,114, 0/ + data st0034 /102,107, 52, 0/ + data st0035 /102,107, 53, 0/ + data st0036 /105, 99,114,115, 0/ + data st0037 /103, 97,112,112,116, 0/ + data (st0038(iyy),iyy= 1, 8) /102,107, 52, 45,110,111, 45,101/ + data (st0038(iyy),iyy= 9, 9) / 0/ + img = memi(cp+3) + co = memi(img+4) + wp = memi(img ) + if (.not.(memi(memi(wp+3) +line-1) .eq. 4 )) goto 110 + sw0001=(skstai(co,7)) + goto 120 +130 continue + call xstrcy(st0001, xunits, 32 ) + call xstrcy(st0002, yunits, 32 ) + goto 121 +140 continue + call xstrcy(st0003, xunits, 32 ) + call xstrcy(st0004, yunits, 32 ) + goto 121 +150 continue + call xstrcy(st0005, xunits, 32 ) + call xstrcy(st0006, yunits, 32 ) + goto 121 +160 continue + call xstrcy(st0007, xunits, 32 ) + call xstrcy(st0008, yunits, 32 ) + goto 121 +120 continue + if (sw0001.lt.1.or.sw0001.gt.4) goto 121 + goto (130,140,150,160),sw0001 +121 continue + goto 111 +110 continue + if (.not.(memi(memi(wp+3) +line-1) .eq. 5 )) goto 170 + call xstrcy(memc(memi(wp+4) +(32 *(line-1))), wcsnae, 32 ) + call strlwr (wcsnae) + if (.not.(xstrcp(wcsnae,st0009) .eq. 0)) goto 180 + call xstrcy(st0010, xunits, 32 ) + call xstrcy(st0011, yunits, 32 ) + goto 181 +180 continue + if (.not.(xstrcp(wcsnae,st0012) .eq. 0)) goto 190 + call xstrcy(st0013, xunits, 32 ) + call xstrcy(st0014, yunits, 32 ) + goto 191 +190 continue + if (.not.(xstrcp(wcsnae,st0015) .eq. 0)) goto 200 + call xstrcy(st0016, xunits, 32 ) + call xstrcy(st0017, yunits, 32 ) + goto 201 +200 continue + call xstrcy(st0018, xunits, 32 ) + call xstrcy(st0019, yunits, 32 ) +201 continue +191 continue +181 continue + goto 171 +170 continue + call xstrcy(st0020, xunits, 32 ) + call xstrcy(st0021, yunits, 32 ) +171 continue +111 continue + if (.not.(memi(memi(wp+3) +line-1) .ne. 4 )) goto 210 + call xstrcy(memc(memi(wp+4) +(32 *(line-1))), wcsnae, 32 ) + goto 211 +210 continue + call smark (sp) + call salloc (radecr, 255 , 2) + call salloc (proj, 255 , 2) + call sprinf (wcsnae, 32 , st0022) + sw0002=(skstai(co,7)) + goto 220 +230 continue + call pargsr (st0023) + goto 221 +240 continue + call pargsr (st0024) + goto 221 +250 continue + call pargsr (st0025) + goto 221 +260 continue + call pargsr (st0026) + goto 221 +270 continue + call pargsr (st0027) + goto 221 +220 continue + if (sw0002.lt.1.or.sw0002.gt.4) goto 270 + goto (230,240,250,260),sw0002 +221 continue + if (.not.(skstai(co,7) .eq. 1)) goto 280 + if (.not.(idxstr(skstai(co,8), memc(radecr), 255 , st0028 + * ) .le. 0)) goto 290 + call xstrcy(st0029, memc(radecr), 255 ) +290 continue + call strupr (memc(radecr)) + call pargsr (memc(radecr)) + goto 281 +280 continue + if (.not.(skstai(co,7) .eq. 4)) goto 300 + call pargsr (st0030) + goto 301 +300 continue + call pargsr (st0031) +301 continue +281 continue + if (.not.(idxstr(skstai(co,9), memc(proj), 255 , st0032) .le + * . 0)) goto 310 + call xstrcy(st0033, memc(proj), 255 ) +310 continue + call strupr (memc(proj)) + call pargsr (memc(proj)) + call sfree (sp) +211 continue + if (.not.(xstrcp(wcsnae, st0034) .eq. 0 .or. xstrcp(wcsnae, + * st0035) .eq. 0 .or. xstrcp(wcsnae, st0036) .eq. 0 .or. xstrcp( + * wcsnae, st0037) .eq. 0 .or. xstrcp(wcsnae, st0038) .eq. 0)) + * goto 320 + call strupr (wcsnae) + goto 321 +320 continue + if (.not.((wcsnae(1).ge.97.and.wcsnae(1).le.122))) goto 330 + wcsnae(1) = (wcsnae(1)+65-97) +330 continue +321 continue +100 return + end + subroutine imgcot (cp, line, xval, yval, xc, yc) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer line + double precision xval + double precision yval + integer*2 xc(*) + integer*2 yc(*) + integer img + integer co + integer wp + integer*2 xfmt(32 +1) + integer*2 yfmt(32 +1) + integer skstai + logical streq + integer*2 st0001(7) + integer*2 st0002(7) + integer*2 st0003(9) + integer*2 st0004(9) + integer*2 st0005(14) + integer*2 st0006(3) + integer*2 st0007(5) + integer*2 st0008(5) + integer*2 st0009(7) + integer*2 st0010(7) + integer*2 st0011(5) + integer*2 st0012(5) + integer*2 st0013(3) + integer*2 st0014(7) + integer*2 st0015(7) + save + integer iyy + data st0001 / 37, 49, 48, 46, 50,102, 0/ + data st0002 / 37, 49, 48, 46, 50,102, 0/ + data (st0003(iyy),iyy= 1, 8) /101, 99,108,105,112,116,105, 99/ + data (st0003(iyy),iyy= 9, 9) / 0/ + data (st0004(iyy),iyy= 1, 8) /103, 97,108, 97, 99,116,105, 99/ + data (st0004(iyy),iyy= 9, 9) / 0/ + data (st0005(iyy),iyy= 1, 8) /115,117,112,101,114,103, 97,108/ + data (st0005(iyy),iyy= 9,14) / 97, 99,116,105, 99, 0/ + data st0006 / 37,104, 0/ + data st0007 / 37, 46, 50, 72, 0/ + data st0008 / 37, 46, 49,104, 0/ + data st0009 / 37, 49, 48, 46, 50,102, 0/ + data st0010 / 37, 49, 48, 46, 50,102, 0/ + data st0011 / 37, 46, 50, 72, 0/ + data st0012 / 37, 46, 49,104, 0/ + data st0013 / 37,104, 0/ + data st0014 / 37, 49, 48, 46, 50,102, 0/ + data st0015 / 37, 49, 48, 46, 50,102, 0/ + img = memi(cp+3) + co = memi(img+4) + wp = memi(img ) + if (.not.(memi(memi(wp+5) +line-1) .eq. 1 )) goto 110 + if (.not.(memi(img+3) .eq. 0)) goto 120 + call xstrcy(st0001, xfmt, 32 ) + call xstrcy(st0002, yfmt, 32 ) + goto 121 +120 continue + if (.not.(memi(memi(wp+3) +line-1) .eq. 4 .or. memi(memi( + * wp+3) +line-1) .eq. 5 )) goto 130 + if (.not.(streq(memc(memi(wp+4) +(32 *(line-1))), + * st0003) .or. streq(memc(memi(wp+4) +(32 *(line-1))), + * st0004) .or. streq(memc(memi(wp+4) +(32 *(line-1))), + * st0005))) goto 140 + call xstrcy(st0006, xfmt, 32 ) + goto 141 +140 continue + call xstrcy(st0007, xfmt, 32 ) +141 continue + call xstrcy(st0008, yfmt, 32 ) + goto 131 +130 continue + call xstrcy(st0009, xfmt, 32 ) + call xstrcy(st0010, yfmt, 32 ) +131 continue +121 continue + goto 111 +110 continue + if (.not.(memi(memi(wp+5) +line-1) .eq. 2 )) goto 150 + if (.not.(skstai(co, 7) .eq. 1)) goto 160 + call xstrcy(st0011, xfmt, 32 ) + goto 161 +160 continue + call xstrcy(st0012, xfmt, 32 ) +161 continue + call xstrcy(st0013, yfmt, 32 ) + goto 151 +150 continue + call xstrcy(st0014, xfmt, 32 ) + call xstrcy(st0015, yfmt, 32 ) +151 continue +111 continue + call sprinf (xc, 32 , xfmt) + if (.not.(memi(memi(wp+5) +line-1) .ne. 4 )) goto 170 + call pargd (xval) + goto 171 +170 continue + call pargd (((xval)/57.295779513082320877)) +171 continue + call sprinf (yc, 32 , yfmt) + if (.not.(memi(memi(wp+5) +line-1) .ne. 4 )) goto 180 + call pargd (yval) + goto 181 +180 continue + call pargd (((yval)/57.295779513082320877)) +181 continue +100 return + end + subroutine imgged (img, x, y, system, wcsnae, wx, wy) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer img + double precision x + double precision y + integer system + double precision wx + double precision wy + integer*2 wcsnae(*) + double precision ox + double precision oy + real epoch + integer im + integer co + integer nco + integer*2 buf(1023 +1) + integer stat + real imgetr + integer imaccf + integer skstai + integer skdecr + logical streq + integer sw0001 + logical xerflg + common /xercom/ xerflg + integer*2 st0001(9) + integer*2 st0002(6) + integer*2 st0003(6) + integer*2 st0004(6) + integer*2 st0005(8) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /101, 99,108,105,112,116,105, 99/ + data (st0001(iyy),iyy= 9, 9) / 0/ + data st0002 /103, 97,112,112,116, 0/ + data st0003 / 69, 80, 79, 67, 72, 0/ + data st0004 / 69, 80, 79, 67, 72, 0/ + data st0005 / 37,115, 32, 37, 46, 49,102, 0/ + im = memi(img+1) + co = memi(img+4) + wx = x + wy = y + sw0001=(system) + goto 110 +120 continue + wx = x + wy = y + goto 111 +130 continue + if (.not.(memi(img+6) .ne. 0)) goto 140 + call mwc2td (memi(img+6) , x, y, wx, wy) +140 continue + goto 111 +150 continue + if (.not.(memi(img+5) .ne. 0)) goto 160 + call mwc2td (memi(img+5) , x, y, wx, wy) +160 continue + goto 111 +170 continue + if (.not.(memi(img+7) .ne. 0)) goto 180 + call mwc2td (memi(img+7) , x, y, wx, wy) +180 continue + goto 111 +190 continue + goto 111 +200 continue + if (.not.(memi(img+8) .ne. 0)) goto 210 + call mwc2td (memi(img+8) , x, y, wx, wy) +210 continue + goto 111 +220 continue + if (.not.(streq (wcsnae, st0001) .or. streq (wcsnae, st0002) + * )) goto 230 + if (.not.(imaccf (im, st0003) .eq. 1)) goto 240 + epoch = imgetr (im, st0004) + if (xerflg) goto 100 + if (.not.(epoch .eq. 0.0 .or. ((epoch).eq.1.6e38))) + * goto 250 + epoch = 1950.0 +250 continue + goto 241 +240 continue + epoch = 1950.0 +241 continue + call sprinf (buf, 1023 , st0005) + call pargsr (wcsnae) + call pargr (epoch) + goto 231 +230 continue + call xstrcy(wcsnae, buf, 1023 ) +231 continue + stat = skdecr (buf, nco, co) + if (.not.(stat .ne. -1)) goto 260 + if (.not.(memi(img+5) .ne. 0)) goto 270 + call mwc2td (memi(img+5) , x, y, ox, oy) +270 continue + call sklltn (co, nco, ((ox)/57.295779513082320877), ((oy) + * /57.295779513082320877), 1.6d308, 1.6d308, 0.0d0, 0.0d0, + * wx, wy) + if (.not.(skstai(co,11) .lt. skstai(co,10))) goto 280 + wx = ((wy)*57.295779513082320877) + wy = ((wx)*57.295779513082320877) + goto 281 +280 continue + wx = ((wx)*57.295779513082320877) + wy = ((wy)*57.295779513082320877) +281 continue +260 continue + goto 111 +290 continue + goto 111 +300 continue + wx = x + wy = y + goto 111 +110 continue + if (sw0001.lt.1.or.sw0001.gt.9) goto 300 + goto (120,300,130,150,220,170,190,200,290),sw0001 +111 continue +100 return + end +c sprinf sprintf +c temple template +c skstad sk_statd +c wcspie wcspix_message +c imgser img_send_header +c radecs radecsys +c stropn stropen +c skstai sk_stati +c skdecr sk_decwstr +c imgcae img_cache +c mwstai mw_stati +c getlie getline +c skdecm sk_decim +c imgses img_send_compass +c imgseo img_send_wcsinfo +c ximalt xim_alert +c wcsnae wcsname +c bpmpix bpm_pix +c mwc2td mw_c2trand +c imgune img_uncache +c imgwcn img_wcstran +c mwswtd mw_swtermd +c sklltn sk_lltran +c mwsctn mw_sctran +c imunmp imunmap +c imgwct img_wcslist +c keywfr keyw_filter +c imgged img_get_coord +c fprinf fprintf +c imgint img_init +c imofnu imofnlu +c dspmmp ds_pmmap +c imggea img_get_data +c imgseb img_send_pixtab +c imgcos img_coord_labels +c imgcot img_coord_fmt +c imgobo img_objinfo +c putlie putline +c imgdes img_det_wcs +c hdrsie hdr_size +c radecr radecstr +c imgams img_amp_wcs +c pargsr pargstr +c mwcloe mw_close +c mwnewm mw_newsystem +c wcsgfm wcs_gfterm +c fpequd fp_equald +c mwsdes mw_sdefwcs diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.x b/vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.x new file mode 100644 index 00000000..a21571a3 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcimage.x @@ -0,0 +1,1268 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <math.h> +include <imio.h> +include <imhdr.h> +include <ctype.h> +include <mwset.h> +include "../lib/skywcs/skywcs.h" +include "wcspix.h" + + +# Image class data. +define LEN_IMGDATA 15 +define IMG_WP Memi[$1 ] # wcspix back-pointer +define IMG_IM Memi[$1+1] # image pointer +define IMG_BPM Memi[$1+2] # bad pixel mask pointer +define IMG_MW Memi[$1+3] # image wcs pointer +define IMG_CO Memi[$1+4] # skywcs transform pointer +define IMG_CTW Memi[$1+5] # mwcs log->world transform ptr +define IMG_CTP Memi[$1+6] # mwcs log->phys transform ptr +define IMG_CTA Memi[$1+7] # mwcs log->amplifier transform +define IMG_CTD Memi[$1+8] # mwcs log->detector transform +define IMG_ROT Memr[$1+9] # rotation angle +define IMG_SCALE Memr[$1+10] # plate scale +define IMG_LINEAR Memi[$1+11] # linear coords + + +define IMG_DEBUG FALSE + + +# IMG_INIT -- Initialize the object structure. + +procedure img_init (cp, wp) + +pointer cp #i cache pointer +pointer wp #i WCSPIX structure + +pointer img # data pointer + +begin + if (IMG_DEBUG) call printf ("img_init: \n") + + # Allocate the image data structure if not previously allocated. + if (C_DATA(cp) == NULL) { + iferr (call calloc (C_DATA(cp), LEN_IMGDATA, TY_STRUCT)) + return + } + + img = C_DATA(cp) + IMG_WP(img) = wp + IMG_IM(img) = NULL + IMG_MW(img) = NULL + IMG_CO(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_ROT(img) = 0.0 + IMG_SCALE(img) = 0.0 + IMG_LINEAR(img) = YES +end + + +# IMG_CACHE -- Cache an image in the object cache. + +procedure img_cache (cp, objid, regid, ref) + +pointer cp #i cache pointer +int objid #i object id +int regid #i region id +char ref[ARB] #i object reference + +pointer img, im, wp +int stat +char alert[SZ_LINE] + +pointer immap(), ds_pmmap(), mw_sctran() +pointer img_amp_wcs(), img_det_wcs() +int imaccf(), sk_decim() + +errchk immap, ds_pmmap(), mw_sctran, sk_decim + +begin + if (IMG_DEBUG) call printf ("img_cache: \n") + + # Now map the image and WCS. + img = C_DATA(cp) + wp = IMG_WP(img) + + iferr (IMG_IM(img) = immap (ref, READ_ONLY, 0)) { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "Unable to cache\n%s") + call pargstr (ref) + call xim_alert (alert, "", "") + return + } + + IMG_CO(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + iferr { + stat = sk_decim (IMG_IM(img), "world", IMG_MW(img), IMG_CO(img)) + if (stat == ERR || IMG_MW(img) == NULL) + IMG_LINEAR(img) = YES + + if (IMG_MW(img) != NULL) { + IMG_CTW(img) = mw_sctran (IMG_MW(img), "logical", "world", 03B) + IMG_CTP(img) = mw_sctran (IMG_MW(img), "logical", "physical", + 03B) + + # Get the amplifier transformation values if present. + im = IMG_IM(img) + if (imaccf(im,"ATM1_1") == YES && + imaccf(im,"ATM2_2") == YES && + imaccf(im,"ATV1") == YES && + imaccf(im,"ATV2") == YES) + IMG_CTA(img) = img_amp_wcs (im, IMG_MW(img)) + + if (imaccf(im,"DTM1_1") == YES && + imaccf(im,"DTM2_2") == YES && + imaccf(im,"DTV1") == YES && + imaccf(im,"DTV2") == YES) + IMG_CTD(img) = img_det_wcs (im, IMG_MW(img)) + } + + } then { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "Unable to decode image WCS\n%s") + call pargstr (ref) + call xim_alert (alert, "", "") + IMG_LINEAR(img) = YES + } + + # See if we can find a bad pixel mask. + if (WP_BPM(wp) == YES) { + iferr (IMG_BPM(img) = ds_pmmap ("BPM", IMG_IM(img))) + IMG_BPM(img) = NULL + } + + C_OBJID(cp) = objid + C_REGID(cp) = regid + C_NREF(cp) = C_NREF(cp) + 1 + call strcpy (ref, C_REF(cp), 128) +end + + +# IMG_UNCACHE -- Uncache an image in the object cache. + +procedure img_uncache (cp, id) + +pointer cp #i cache pointer +int id #i image id + +pointer img + +begin + if (IMG_DEBUG) call printf ("img_uncache: \n") + + C_OBJID(cp) = NULL + C_NREF(cp) = 0 + call strcpy ("", C_REF(cp), SZ_FNAME) + + img = C_DATA(cp) + if (IMG_MW(img) != NULL) + call mw_close (IMG_MW(img)) + if (IMG_BPM(img) != NULL) + call imunmap (IMG_BPM(img)) + if (IMG_IM(img) != NULL) + call imunmap (IMG_IM(img)) + + IMG_IM(img) = NULL + IMG_BPM(img) = NULL + IMG_MW(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CO(img) = NULL + IMG_ROT(img) = 0.0 + IMG_SCALE(img) = 0.0 + IMG_LINEAR(img) = NO + + call mfree (C_DATA(cp), TY_STRUCT) + C_DATA(cp) = NULL +end + + +# IMG_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. Message is returned as something like: +# +# set value { +# { object <objid> } { region <regionid> } +# { pixval <pixel_value> [<units>] } +# { bpm <bpm_pixel_value> } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# : +# } + + +procedure img_wcstran (cp, id, x, y) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords + +pointer img, im, wp, co +double dx, dy, wx, wy, pixval +real rx, ry +int i, bpm + +# Use static storage to avoid allocation overhead. +char buf[SZ_LINE] +char msg[SZ_LINE], wcs[LEN_WCSNAME], xc[LEN_WCSNAME], yc[LEN_WCSNAME] +char xunits[LEN_WCSNAME], yunits[LEN_WCSNAME] + +double sk_statd() + +begin + if (IMG_DEBUG) call printf ("img_wcstran: \n") + + img = C_DATA(cp) # initialize + co = IMG_CO(img) + wp = IMG_WP(img) + im = IMG_IM(img) + + # Get the translation to the image section. + dx = (double(x) - sk_statd(co,S_VXOFF)) / sk_statd(co,S_VXSTEP) + dy = (double(y) - sk_statd(co,S_VYOFF)) / sk_statd(co,S_VYSTEP) + rx = dx + ry = dy + + # Read the pixel data. + call img_get_data (cp, id, rx, ry, pixval, bpm) + + # Begin formatting the message. + call aclrc (msg, SZ_LINE) + call sprintf (msg, SZ_LINE, "wcstran { object %d } { region %d } ") + call pargi (C_OBJID(cp)) + call pargi (C_REGID(cp)) + + call sprintf (buf, SZ_LINE, "{ pixval %9.9g } { bpm %d }\n") + call pargd (pixval) + call pargi (bpm) + call strcat (buf, msg, SZ_LINE) + + # Now loop over the requested systems and generate a coordinate + # for each. + for (i=1; i <= MAX_WCSLINES; i=i+1) { + + # Get the coordinate value. + call img_get_coord (img, dx, dy, SYSTEMS(wp,i), WCSNAME(wp,i), + wx, wy) + + # Get the system name, labels, and formats strings for the WCS. + call img_coord_labels (cp, i, wcs, xunits, yunits) + + # Format the values as requested. + call img_coord_fmt (cp, i, wx, wy, xc, yc) + + # Format the coord buffer and append it to the message. + call sprintf (buf, SZ_LINE, + "{coord {%9s} {%12s} {%12s} {%4s} {%4s}}\n") + call pargstr (wcs) + call pargstr (xc) + call pargstr (yc) + call pargstr (xunits) + call pargstr (yunits) + call strcat (buf, msg, SZ_LINE) + } + + # Now send the completed message. + call wcspix_message (msg); +end + + +# IMG_WCSLIST -- List the WCSs available for the given image. + +procedure img_wcslist (cp, id) + +pointer cp #i cache pointer +int id #i image id + +pointer img, im, mw +char msg[SZ_LINE] + +begin + if (IMG_DEBUG) call printf ("img_wcslist: \n") + + img = C_DATA(cp) # initialize + mw = IMG_MW(img) + im = IMG_IM(img) + + call strcpy ("wcslist {None Logical World Physical line ", msg, SZ_LINE) + + # See if we can do amplifier/detector coords by checking for ATM/ATV + # and DTM/DTV keywords. + + if (IMG_CTA(img) != NULL) + call strcat (" Amplifier ", msg, SZ_LINE) + if (IMG_CTD(img) != NULL) + call strcat (" Detector ", msg, SZ_LINE) + if (IMG_CTA(img) != NULL || IMG_CTD(img) != NULL) + call strcat (" CCD ", msg, SZ_LINE) + call strcat (" line ", msg, SZ_LINE) + + # If we have a MWCS pointer list the sky projections. + if (mw != NULL) + call strcat (SKYPROJ, msg, SZ_LINE) + + # Close the message. + call strcat ("}", msg, SZ_LINE) + + call wcspix_message (msg) +end + + +# IMG_GET_DATA -- Get data from the image. + +procedure img_get_data (cp, id, x, y, pixval, bpm_pix) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords +double pixval #o central pixel value +int bpm_pix #o bad pixel mask value + +pointer img, wp, im, bpm, pix +int nl, nc, ix, iy +int size, x1, x2, y1, y2 + +pointer imgs2r(), imgs2i() + +begin + if (IMG_DEBUG) call printf ("img_get_data: \n") + + img = C_DATA(cp) + wp = IMG_WP(img) + im = IMG_IM(img) + bpm = IMG_BPM(img) + nc = IM_LEN(im,1) + nl = IM_LEN(im,2) + size = WP_PTABSZ(wp) + + # Sanity check on the cursor image position. + if (x < 0.0 || y < 0.0 || x > nc || y > nl) + return + + # Bounds checking. Rather than deal with out of bounds pixels we'll + # adjust the center pixel so we get the same size raster up to each + # boundary. + + ix = int (x + 0.5) ; iy = int (y + 0.5) + ix = max (size/2+1, ix) ; iy = max (size/2+1, iy) + ix = min (ix, (nc-(size/2)-1)) ; iy = min (iy, (nl-(size/2)-1)) + + # Compute the box offset given the center and size. + x1 = ix - size / 2 + 0.5 + x2 = ix + size / 2 + 0.5 + y1 = iy - size / 2 + 0.5 + y2 = iy + size / 2 + 0.5 + + # Get the image pixels + x1 = max (1, x1) + x2 = min (nc, x2) + y1 = max (1, y1) + y2 = min (nl, y2) + pix = imgs2r (im, int(x1), int(x2), int(y1), int(y2)) + + if (bpm != NULL && WP_BPM(wp) == YES) + bpm_pix = Memi[imgs2i (bpm, ix, ix, iy, iy)] + else + bpm_pix = 0 + + # Compute the image pixel associated with the requested coords. + pixval = Memr[pix + ((size/2)*size) + (size/2)] * 1.0d0 + + # Send the pixel table. + if (WP_PTABSZ(wp) > 1) + call img_send_pixtab (Memr[pix], WP_PTABSZ(wp), x1, x2, y1, y2) +end + + +# IMG_OBJINFO -- Get header information from the image. + +procedure img_objinfo (cp, id, template) + +pointer cp #i cache pointer +int id #i image id +char template[ARB] #i keyword template + +pointer im, img + +define WCS_TEMPLATE "WCSDIM,CTYPE*,CRPIX*,CRVAL*,CD*,CROTA2,LTV*,LTM*,WSV*,WAT*,RA*,DEC*,EQUINOX,EPOCH,MJD*,DATE-OBS" + +begin + if (IMG_DEBUG) call printf ("img_objinfo: \n") + + # Send the full header (or keyword filtered header), only the WCS + # keywords, and a plain-text explanation of the WCS. + + img = C_DATA(cp) + im = IMG_IM(img) + + call img_send_header (im, "imghdr", template) + call img_send_header (im, "wcshdr", WCS_TEMPLATE) + call img_send_wcsinfo (im, cp) + call img_send_compass (im, cp) +end + + + +#============================================================================== + +# IMG_SEND_HEADER -- Send an image header to the named GUI object. Keywords +# are filtered according to a specified template + +procedure img_send_header (im, object, template) + +pointer im #i image descriptor +char object[ARB] #i object for the message +char template[ARB] #i keyword template + +pointer sp, hdr, lbuf, line, field, keyw, dict +pointer ip, lp, list +int nlines, in, out, i, hdr_size +bool keyw_filter + +int stropen(), getline(), stridx(), imgnfn(), strdic() +pointer imofnlu() +bool streq() +errchk stropen, getline, putci, putline, imgnfn, imofnlu, strdic + +define USER_AREA Memc[($1+IMU-1)*SZ_STRUCT + 1] +define SZ_KEYW 8 + +begin + hdr_size = (LEN_IMDES + IM_LENHDRMEM(im) - IMU) * SZ_STRUCT - 1 + hdr_size = hdr_size + SZ_LINE + + call smark (sp) + call salloc (hdr, hdr_size, TY_CHAR) + call salloc (dict, hdr_size, TY_CHAR) + call salloc (field, SZ_LINE, TY_CHAR) + call salloc (lbuf, SZ_LINE, TY_CHAR) + call salloc (line, SZ_LINE, TY_CHAR) + call salloc (keyw, SZ_KEYW, TY_CHAR) + + in = stropen (USER_AREA(im), hdr_size, READ_ONLY) + out = stropen (Memc[hdr], hdr_size, WRITE_ONLY) + call fprintf (out, "%s {") + call pargstr (object) + + # Build up a dictionary of header keywords based on the template. + keyw_filter = (!streq (template, "*")) + if (keyw_filter) { + list = imofnlu (im, template) + call strcpy ("|", Memc[dict], hdr_size) + while (imgnfn (list, Memc[field], SZ_FNAME) != EOF) { + call strcat (Memc[field], Memc[dict], hdr_size) + call strcat ("|", Memc[dict], hdr_size) + } + call imcfnl (list) + } + + + # Copy header records to the output, stripping any trailing + # whitespace and clipping at the right margin. We also filter + # against the keyword dictionary found above. + + nlines = 0 + while (getline (in, Memc[lbuf]) != EOF) { + + call aclrc (Memc[line], SZ_LINE) + + # Escape any brackets passed to the Tcl. + ip = lbuf + lp = line + while (Memc[ip] != EOS && Memc[ip] != '\n') { + if (stridx (Memc[ip], "[{") > 0) { + Memc[lp] = '\\' + lp = lp + 1 + } + Memc[lp] = Memc[ip] + ip = ip + 1 + lp = lp + 1 + } + Memc[lp] = '\n' + Memc[lp+1] = EOS + + # See whether the line matches a keyword we want to output. + if (keyw_filter) { + for (i=0; i < SZ_KEYW && !IS_WHITE(Memc[line+i]); i=i+1) + Memc[keyw+i] = Memc[line+i] + Memc[keyw+i] = '\0' + + # If not in the dictionary skip to the next line. + if (strdic (Memc[keyw], Memc[keyw], SZ_KEYW, Memc[dict]) == 0) + next + } + + call putci (out, ' ') + call putline (out, Memc[line]) + + # Send the header in small chunks so we don't overflow the + # message buffer. + nlines = nlines + 1 + if (mod(nlines,10) == 0) { + call fprintf (out, "}") + call close (out) + call wcspix_message (Memc[hdr]); + call aclrc (Memc[hdr], hdr_size) + out = stropen (Memc[hdr], hdr_size, WRITE_ONLY) + call fprintf (out, "%s {") + call pargstr (object) + } + } + call fprintf (out, "}") + + call close (in) + call close (out) + + # Send the final message. + call wcspix_message (Memc[hdr]) + + # Pad a few lines for the GUI + call sprintf (Memc[hdr], SZ_LINE, "%d { \n\n\n }") + call pargstr (object) + call wcspix_message (Memc[hdr]) + + call sfree (sp) +end + + +# IMG_SEND_COMPASS -- Send information about the image WCS in a plain-english +# string. + +procedure img_send_compass (im, cp) + +pointer im #i image descriptor +pointer cp #i cache element pointer + +pointer sp, buf, img, co +double cx, cy, cx1, cy1, dx, dy, x1, y1 +double cosa, sina, angle +int i, j, comp_x, comp_y +long axis[IM_MAXDIM], lv[IM_MAXDIM], pv1[IM_MAXDIM], pv2[IM_MAXDIM] + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call aclrc (Memc[buf], SZ_LINE) + + # Get the data pointer. + img = C_DATA(cp) + co = IMG_CO(img) + + # Get world coords at the image corners. + if (IMG_CTW(img) != NULL) { + + if (IMG_ROT(img) > 0.0) + angle = -IMG_ROT(img) + else + angle = IMG_ROT(img) + 360.0 + cosa = cos (DEGTORAD(angle)) + sina = sin (DEGTORAD(angle)) + + # Image center position + cx = IM_LEN(im,1) / 2.0d0 + cy = IM_LEN(im,2) / 2.0d0 + call mw_c2trand (IMG_CTW(img), cx, cy, cx1, cy1) + + # Extend a unit vector up from the center assuming it's North + # and rotate it by the wcs angle. + dx = cx + ( 10.0 * sina) + dy = cy + ( 10.0 * cosa) + call mw_c2trand (IMG_CTW(img), dx, dy, x1, y1) + + # Check new point Y value relative to the center position. + if (y1 >= cy1) + comp_y = 1 # North is up + else + comp_y = -1 # North is down + + # Extend a unit vector left from the center assuming it's East + # and rotate it by the wcs angle. + dx = cx + (-10.0 * cosa) + dy = cy + ( 10.0 * sina) + call mw_c2trand (IMG_CTW(img), dx, dy, x1, y1) + + # Check new point X value relative to the center position. + if (x1 >= cx1) + comp_x = 1 # East is left and we have a WCS + else + comp_x = -1 # East is right + + } else { + # Determine the logical to physical mapping by evaluating two + # points and determining the axis reduction if any. pv1 will be + # the offset and pv2-pv1 will be the scale. + + lv[1] = 0; lv[2] = 0; call imaplv (im, lv, pv1, 2) + lv[1] = 1; lv[2] = 1; call imaplv (im, lv, pv2, 2) + + i = 1 + axis[1] = 1; axis[2] = 2 + do j = 1, IM_MAXDIM { + if (pv1[j] != pv2[j]) { + axis[i] = j + i = i + 1 + } + } + comp_x = - (pv2[axis[1]] - pv1[axis[1]]) + comp_y = (pv2[axis[2]] - pv1[axis[2]]) + } + + call sprintf (Memc[buf], SZ_LINE, "compass %d %g %d %d %s\0") + call pargi (C_OBJID(cp)) + call pargr (IMG_ROT(img)) + call pargi (comp_x) + call pargi (comp_y) + if (IMG_MW(img) != NULL) + call pargstr ("E N") + else + call pargstr ("X Y") + + call wcspix_message (Memc[buf]) + call sfree (sp) +end + + +# IMG_SEND_WCSINFO -- Send information about the image WCS in a plain-english +# string. + +procedure img_send_wcsinfo (im, cp) + +pointer im #i image descriptor +pointer cp #i cache element pointer + +pointer sp, co, img, mw +pointer buf, proj, radecstr +int fd, radecsys, ctype, wtype, ndim +double crpix1, crpix2, crval1, crval2, cval1, cval2 +double xscale, yscale, xrot, yrot +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM], + +int idxstr(), sk_stati(), stropen(), mw_stati() +double sk_statd(), sl_epj(), sl_epb() +bool fp_equald() + +errchk stropen + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call salloc (proj, SZ_FNAME, TY_CHAR) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + # Open a string on a file. + fd = stropen (Memc[buf], SZ_LINE, WRITE_ONLY) + + # Get the data pointer. + img = C_DATA(cp) + + # Get the coordinate transform descriptor. + co = IMG_CO(img) + radecsys = sk_stati (co, S_RADECSYS) + ctype = sk_stati (co, S_CTYPE) + wtype = sk_stati (co, S_WTYPE) + + mw = IMG_MW(img) + if (mw != NULL) { + # Now get the mwcs Rterm (CRPIXi), Wterm (CRVALi), and CD matrix. + ndim = mw_stati (mw, MW_NPHYSDIM) + call wcs_gfterm (mw, r, w, cd, ndim) + crpix1 = r[1] + crpix2 = r[2] + crval1 = w[1] + crval2 = w[2] + + xscale = sqrt (cd[1,1]**2 + cd[2,1]**2) * 3600.0d0 + yscale = sqrt (cd[1,2]**2 + cd[2,2]**2) * 3600.0d0 + xrot = 0.0 + yrot = 0.0 + if (!fp_equald (cd[1,1], 0.0d0)) + xrot = DRADTODEG(atan ( cd[2,1] / cd[1,1])) + if (!fp_equald (cd[2,2], 0.0d0)) + yrot = DRADTODEG(atan (-cd[1,2] / cd[2,2])) + } else { + ndim = 2 + xscale = 1.0 + yscale = 1.0 + xrot = 0.0 + yrot = 0.0 + } + + if (IMG_DEBUG) { + call printf("WCS Info:\n=========\n") + call printf("R term: %g %g\n"); call pargd(r[1]); call pargd(r[2]) + call printf("W term: %g %g\n"); call pargd(w[1]); call pargd(w[2]) + call printf(" cd: %g %g\n %g %g\n") + call pargd(cd[1,1]); call pargd(cd[1,2]) + call pargd(cd[2,1]); call pargd(cd[2,2]) + call printf(" scale: %g %g\n");call pargd(xscale);call pargd(yscale) + call printf(" rot: %g %g\n");call pargd(xrot);call pargd(yrot) + } + + IMG_SCALE(img) = (xscale + yscale) / 2.0d0 + #IMG_ROT(img) = (xrot + yrot) / 2.0d0 + IMG_ROT(img) = xrot + + + # Now format a WCS text panel such as + # + # Projection: TAN System: Equatorial FK5 + # Ra/Dec axes: 1/2 Dimensions: 512 x 512 + # + # Center Pos: RA: 13:29:52.856 Dec: +47:11:40.39 + # Reference Pos: RA: 13:29:52.856 Dec: +47:11:40.39 + # Ref pixel coord: X: 250.256 Y: 266.309 + # Plate Scale: 0.765194 Rot Angle: 1.02939 + # Equinox: J2000.000 Epoch: J1987.25775240 + # MJD: 46890.39406 + + # Get some preliminary values. + if (idxstr (radecsys, Memc[radecstr], SZ_FNAME, EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + + if (idxstr (wtype, Memc[proj], SZ_FNAME, WTYPE_LIST) <= 0) + call strcpy ("logical", Memc[proj], SZ_FNAME) + call strupr (Memc[proj]) + + call fprintf (fd, "wcsinfo {\n") + + call fprintf (fd, + " Projection: %-6s\t System: %s %s\n") + call pargstr (Memc[proj]) + switch (ctype) { + case CTYPE_EQUATORIAL: + call pargstr ("Equatorial") + call pargstr (Memc[radecstr]) + case CTYPE_ECLIPTIC: + call pargstr ("Ecliptic") + call pargstr ("") + case CTYPE_GALACTIC: + call pargstr ("Galactic") + call pargstr ("") + case CTYPE_SUPERGALACTIC: + call pargstr ("SuperGalactic") + call pargstr ("") + default: + call pargstr ("Linear") + call pargstr ("") + } + + call fprintf (fd, " Ra/Dec axes: %d/%d") + call pargi (sk_stati (co, S_PLNGAX)) + call pargi (sk_stati (co, S_PLATAX)) + call fprintf (fd, " Dimensions: %d x %d\n\n") + call pargi (IM_LEN(im,1)) + call pargi (IM_LEN(im,2)) + + call fprintf (fd, + " Center Pos: %3s: %-12H %3s: %-12h\n") + if (ctype == CTYPE_EQUATORIAL) + call pargstr (" RA") + else + call pargstr ("Lon") + call pargd (cval1) + if (ctype == CTYPE_EQUATORIAL) + call pargstr ("Dec") + else + call pargstr ("Lat") + call pargd (cval2) + + call fprintf (fd, + " Reference Pos: %3s: %-12H %3s: %-12h\n") + if (ctype == CTYPE_EQUATORIAL) + call pargstr (" RA") + else + call pargstr ("Lon") + call pargd (crval1) + if (ctype == CTYPE_EQUATORIAL) + call pargstr ("Dec") + else + call pargstr ("Lat") + call pargd (crval2) + + call fprintf (fd, + " Reference Pixel: X: %-9.4f Y: %-9.4f\n") + call pargd (crpix1) + call pargd (crpix2) + + call fprintf (fd, + " Plate Scale: %-8f Rot Angle: %-8f\n") + call pargr (IMG_SCALE(img)) + call pargr (IMG_ROT(img)) + + call fprintf (fd, + " Equinox: %s%8f Epoch: %s%.6f\n") + switch (radecsys) { + case EQTYPE_FK5, EQTYPE_ICRS: + call pargstr ("J") ; call pargd (sk_statd(co,S_EQUINOX)) + call pargstr ("J") ; call pargd (sl_epj(sk_statd(co,S_EPOCH))) + default: + if (IMG_LINEAR(img) == YES) { + call pargstr (" ") ; call pargd (INDEFD) + call pargstr (" ") ; call pargd (INDEFD) + } else { + call pargstr ("B") + call pargd (sk_statd(co,S_EQUINOX)) + call pargstr ("B") + call pargd (sl_epb(sk_statd(co,S_EPOCH))) + } + } + + call fprintf (fd, " MJD: %.6f\n") + call pargd (sk_statd(co,S_EPOCH)) + + call fprintf (fd, "}\n \n \n") + + # Close the formatted string and send the message. + call close (fd) + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_SEND_PIXTAB -- Send a 'pixtab' message. Format of the message is +# +# pixtab { +# { {pix} {pix} ... } # pixel table values +# { {x1} {x2} ... } # column label values +# { {y1} {y2} ... } # row label values +# { <mean> <stdev> } # pixtab statistics +# } +# + +procedure img_send_pixtab (pixtab, size, x1, x2, y1, y2) + +real pixtab[ARB] #i pixtab array +int size #i pixtab size +int x1, x2, y1, y2 #i raster boundaries + +pointer sp, buf, el +int i, j, npix +real pix, sum, sum2, mean, var, stdev, x, y + +define SZ_PIXTAB (6*SZ_LINE) + +begin + call smark (sp) + call salloc (buf, SZ_PIXTAB, TY_CHAR) + call salloc (el, SZ_FNAME, TY_CHAR) + + # Begin the pixtab message. + call strcpy ("pixtab {\n{\ntable {\n", Memc[buf], SZ_PIXTAB) + + # Format the pixels into a table for presentation. Do the y-flip + # here so the pixels are in order for the List widget in the GUI. + # Accumulate the pixel statistics so we don't have to do it in the + # GUI where it's slower. + + sum = 0.0 + sum2 = 0.0 + npix = size * size + + for (i=size - 1; i >= 0; i=i-1) { + for (j=1; j <= size; j=j+1) { + pix = pixtab[(i * size) + j] + sum = sum + pix + sum2 = sum2 + (pix * pix) + + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (pix) + + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("\n", Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n}\n", Memc[buf], SZ_PIXTAB) + + + # Do the row and column label parts of the message. + call strcat ("{", Memc[buf], SZ_PIXTAB) + for (x = x1; x <= x2; x = x + 1.) { + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (x) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n", Memc[buf], SZ_PIXTAB) + + call strcat ("{", Memc[buf], SZ_PIXTAB) + for (y = y2; y >= y1; y = y - 1.) { + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (y) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n", Memc[buf], SZ_PIXTAB) + + + # Compute the statistics for the raster. + mean = sum / real(npix) + var = (sum2 - sum * mean) / real(npix - 1) + if (var <= 0) + stdev = 0.0 + else + stdev = sqrt (var) + + call sprintf (Memc[el], SZ_FNAME, " { %10.2f %10.4f }\n") + call pargr (mean) + call pargr (stdev) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + + + # Close the message. + call strcat ("}", Memc[buf], SZ_PIXTAB) + + # Send the formatted message. + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_AMP_WCS -- Create a WCS transformation for the amplifier coordinates. + +pointer procedure img_amp_wcs (im, mw) + +pointer im #i image pointer +pointer mw #i MWCS descriptor + +pointer ct +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] + +double imgetd() +pointer mw_sctran() + +begin + r[1] = 0.0d0 + r[2] = 0.0d0 + w[1] = imgetd (im, "ATV1") + w[2] = imgetd (im, "ATV2") + cd[1,1] = imgetd (im, "ATM1_1") + cd[1,2] = 0.0d0 + cd[2,1] = 0.0d0 + cd[2,2] = imgetd (im, "ATM2_2") + + # Create a new named system. + call mw_newsystem (mw, "amplifier", 2) + + # Set the new Wterm for the system. + call mw_swtermd (mw, r, w, cd, 2) + + # Set up the transform. + ct = mw_sctran (mw, "logical", "amplifier", 03B) + + # Reset the default world system. + call mw_sdefwcs (mw) + + return (ct) +end + + +# IMG_DET_WCS -- Create a WCS transformation for the detector coordinates. + +pointer procedure img_det_wcs (im, mw) + +pointer im #i image pointer +pointer mw #i MWCS descriptor + +pointer ct +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] + +double imgetd() +pointer mw_sctran() + +begin + r[1] = 0.0d0 + r[2] = 0.0d0 + w[1] = imgetd (im, "DTV1") + w[2] = imgetd (im, "DTV2") + cd[1,1] = imgetd (im, "DTM1_1") + cd[1,2] = 0.0d0 + cd[2,1] = 0.0d0 + cd[2,2] = imgetd (im, "DTM2_2") + + # Create a new named system. + call mw_newsystem (mw, "detector", 2) + + # Set the new Wterm for the system. + call mw_swtermd (mw, r, w, cd, 2) + + # Set up the transform. + ct = mw_sctran (mw, "logical", "detector", 03B) + + # Reset the default world system. + call mw_sdefwcs (mw) + + return (ct) +end + + +# IMG_COORD_LABELS -- Get the WCS name, coord labels and format strings for +# the specified object. + +procedure img_coord_labels (cp, line, wcsname, xunits, yunits) + +pointer cp #i cache pointer +pointer line #i WCS output line +char wcsname[ARB] #o WCS name string +char xunits[ARB], yunits[ARB] #o WCS coord labels + +pointer img, co, wp +pointer sp, proj, radecstr + +int strcmp(), sk_stati(), idxstr() + +begin + img = C_DATA(cp) # initialize ptrs + co = IMG_CO(img) + wp = IMG_WP(img) + + if (SYSTEMS(wp,line) == SYS_WORLD) { + switch (sk_stati(co,S_CTYPE)) { + case CTYPE_EQUATORIAL: + call strcpy (" RA", xunits, LEN_WCSNAME) + call strcpy (" Dec", yunits, LEN_WCSNAME) + case CTYPE_ECLIPTIC: + call strcpy ("ELon", xunits, LEN_WCSNAME) + call strcpy ("ELat", yunits, LEN_WCSNAME) + case CTYPE_GALACTIC: + call strcpy ("GLon", xunits, LEN_WCSNAME) + call strcpy ("GLat", yunits, LEN_WCSNAME) + case CTYPE_SUPERGALACTIC: + call strcpy ("SLon", xunits, LEN_WCSNAME) + call strcpy ("SLat", yunits, LEN_WCSNAME) + } + } else if (SYSTEMS(wp,line) == SYS_SKY) { + call strcpy (WCSNAME(wp,line), wcsname, LEN_WCSNAME) + call strlwr (wcsname) + if (strcmp (wcsname,"ecliptic") == 0) { + call strcpy ("ELon", xunits, LEN_WCSNAME) + call strcpy ("ELat", yunits, LEN_WCSNAME) + } else if (strcmp (wcsname,"galactic") == 0) { + call strcpy ("GLon", xunits, LEN_WCSNAME) + call strcpy ("GLat", yunits, LEN_WCSNAME) + } else if (strcmp (wcsname,"supergalactic") == 0) { + call strcpy ("SLon", xunits, LEN_WCSNAME) + call strcpy ("SLat", yunits, LEN_WCSNAME) + } else { + call strcpy (" RA", xunits, LEN_WCSNAME) + call strcpy (" Dec", yunits, LEN_WCSNAME) + } + } else { + call strcpy ("X", xunits, LEN_WCSNAME) + call strcpy ("Y", yunits, LEN_WCSNAME) + } + + + # Now get the format strings. For systems other than the image + # default just use the WCS string as the name, otherwise format a + # string giving more information about the system. + if (SYSTEMS(wp,line) != SYS_WORLD) + call strcpy (WCSNAME(wp,line), wcsname, LEN_WCSNAME) + + else { + call smark (sp) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + call salloc (proj, SZ_FNAME, TY_CHAR) + + call sprintf (wcsname, LEN_WCSNAME, "%s-%s-%s") + + switch (sk_stati(co,S_CTYPE)) { + case CTYPE_EQUATORIAL: call pargstr ("EQ") + case CTYPE_ECLIPTIC: call pargstr ("ECL") + case CTYPE_GALACTIC: call pargstr ("GAL") + case CTYPE_SUPERGALACTIC: call pargstr ("SGAL") + default: call pargstr ("UNKN") + } + + if (sk_stati(co,S_CTYPE) == CTYPE_EQUATORIAL) { + if (idxstr(sk_stati(co,S_RADECSYS), Memc[radecstr], + SZ_FNAME, EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call pargstr (Memc[radecstr]) + } else { + if (sk_stati(co,S_CTYPE) == CTYPE_SUPERGALACTIC) + call pargstr ("-") + else + call pargstr ("--") + } + + if (idxstr(sk_stati(co,S_WTYPE), Memc[proj], SZ_FNAME, + WTYPE_LIST) <= 0) + call strcpy ("linear", Memc[proj], SZ_FNAME) + call strupr (Memc[proj]) + call pargstr (Memc[proj]) + + call sfree (sp) + } + + # Now fix up the WCS system name. + if (strcmp (wcsname, "fk4") == 0 || + strcmp (wcsname, "fk5") == 0 || + strcmp (wcsname, "icrs") == 0 || + strcmp (wcsname, "gappt") == 0 || + strcmp (wcsname, "fk4-no-e") == 0) { + call strupr (wcsname) + + } else if (IS_LOWER(wcsname[1])) + wcsname[1] = TO_UPPER(wcsname[1]) +end + + +# IMG_COORD_FMT -- Format the coordinate strings. + +procedure img_coord_fmt (cp, line, xval, yval, xc, yc) + +pointer cp #i object cache pointer +int line #i output line number +double xval, yval #i input coords +char xc[ARB], yc[ARB] #o formatted coord strings + +pointer img, co, wp +char xfmt[LEN_WCSNAME], yfmt[LEN_WCSNAME] + +int sk_stati() +bool streq() + +begin + img = C_DATA(cp) # initialize ptrs + co = IMG_CO(img) + wp = IMG_WP(img) + + # Convert coords to the requested format. + if (FORMATS(wp,line) == FMT_DEFAULT) { + if (IMG_MW(img) == NULL) { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } else { + if (SYSTEMS(wp,line) == SYS_WORLD || + SYSTEMS(wp,line) == SYS_SKY) { + + if (streq(WCSNAME(wp,line),"ecliptic") || + streq(WCSNAME(wp,line),"galactic") || + streq(WCSNAME(wp,line),"supergalactic")) + call strcpy ("%h", xfmt, LEN_WCSNAME) + else + call strcpy ("%.2H", xfmt, LEN_WCSNAME) + call strcpy ("%.1h", yfmt, LEN_WCSNAME) + } else { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } + } + + } else if (FORMATS(wp,line) == FMT_HMS) { + if (sk_stati(co, S_CTYPE) == CTYPE_EQUATORIAL) + call strcpy ("%.2H", xfmt, LEN_WCSNAME) + else + call strcpy ("%.1h", xfmt, LEN_WCSNAME) + call strcpy ("%h", yfmt, LEN_WCSNAME) + } else { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } + + # Convert the value to the requested format + call sprintf (xc, LEN_WCSNAME, xfmt) + if (FORMATS(wp,line) != FMT_RAD) + call pargd (xval) + else + call pargd (DEGTORAD(xval)) + + call sprintf (yc, LEN_WCSNAME, yfmt) + if (FORMATS(wp,line) != FMT_RAD) + call pargd (yval) + else + call pargd (DEGTORAD(yval)) +end + + +# IMG_GET_COORD -- Given an x,y position in the image return the coordinate in +# the given system. + +procedure img_get_coord (img, x, y, system, wcsname, wx, wy) + +pointer img #i IMG struct pointer +double x, y #i input image position +int system #i coordinate system requested +char wcsname[ARB] #i desired WCS name +double wx, wy #o output coordinates + +double ox, oy +real epoch +pointer im, co, nco +char buf[SZ_LINE] +int stat + +real imgetr() +int imaccf(), sk_stati(), sk_decwstr() +bool streq() + +errchk imgetr + +begin + im = IMG_IM(img) + co = IMG_CO(img) + + wx = x # fallback values + wy = y + + switch (system) { + case SYS_NONE: + wx = x + wy = y + case SYS_PHYSICAL: + if (IMG_CTP(img) != NULL) + call mw_c2trand (IMG_CTP(img), x, y, wx, wy) + case SYS_WORLD: + if (IMG_CTW(img) != NULL) + call mw_c2trand (IMG_CTW(img), x, y, wx, wy) + case SYS_AMP: + if (IMG_CTA(img) != NULL) + call mw_c2trand (IMG_CTA(img), x, y, wx, wy) + case SYS_CCD: + ; # TBD + case SYS_DETECTOR: + if (IMG_CTD(img) != NULL) + call mw_c2trand (IMG_CTD(img), x, y, wx, wy) + case SYS_SKY: + # Note Ecliptic/GAPPT coords need an epoch value. + if (streq (wcsname, "ecliptic") || streq (wcsname, "gappt")) { + if (imaccf (im, "EPOCH") == YES) { + epoch = imgetr (im, "EPOCH") + if (epoch == 0.0 || IS_INDEFR(epoch)) + epoch = 1950.0 + } else + epoch = 1950.0 + + call sprintf (buf, SZ_LINE, "%s %.1f") + call pargstr (wcsname) + call pargr (epoch) + } else + call strcpy (wcsname, buf, SZ_LINE) + + stat = sk_decwstr (buf, nco, co) + if (stat != ERR) { + if (IMG_CTW(img) != NULL) + call mw_c2trand (IMG_CTW(img), x, y, ox, oy) + call sk_lltran (co, nco, DEGTORAD(ox), DEGTORAD(oy), + INDEFD, INDEFD, 0.0d0, 0.0d0, wx, wy) + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) { + wx = RADTODEG(wy) # transposed image + wy = RADTODEG(wx) + } else { + wx = RADTODEG(wx) # regular image + wy = RADTODEG(wy) + } + } + case SYS_OTHER: + ; # TBD + + default: # default coords + wx = x + wy = y + } +end diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.f b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.f new file mode 100644 index 00000000..d98ff3e6 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.f @@ -0,0 +1,30 @@ + subroutine mefint () + save +100 return + end + subroutine mefcae () + save +100 return + end + subroutine mefune () + save +100 return + end + subroutine mefwcn () + save +100 return + end + subroutine mefwct () + save +100 return + end + subroutine mefobo () + save +100 return + end +c mefcae mef_cache +c mefune mef_uncache +c mefwcn mef_wcstran +c mefwct mef_wcslist +c mefint mef_init +c mefobo mef_objinfo diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.x b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.x new file mode 100644 index 00000000..050e5596 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmef.x @@ -0,0 +1,50 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "wcspix.h" + + +# MEF Image class data. + + +# MEF_INIT -- Initialize the MEF Class module. + +procedure mef_init () +begin +end + + +# MEF_CACHE -- Cache an image in the object cache. + +procedure mef_cache () +begin +end + + +# MEF_UNCACHE -- Uncache an image in the object cache. + +procedure mef_uncache () +begin +end + + +# MEF_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. + +procedure mef_wcstran () +begin +end + + +# MEF_WCSLIST -- List the WCSs available for the given image. + +procedure mef_wcslist () +begin +end + + +# MEF_OBJINFO -- Get header information from the image. + +procedure mef_objinfo () +begin +end + diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.f b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.f new file mode 100644 index 00000000..c2924bd1 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.f @@ -0,0 +1,30 @@ + subroutine mspint () + save +100 return + end + subroutine mspcae () + save +100 return + end + subroutine mspune () + save +100 return + end + subroutine mspwcn () + save +100 return + end + subroutine mspwct () + save +100 return + end + subroutine mspobo () + save +100 return + end +c mspwct msp_wcslist +c mspint msp_init +c mspobo msp_objinfo +c mspcae msp_cache +c mspune msp_uncache +c mspwcn msp_wcstran diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.x b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.x new file mode 100644 index 00000000..64198d69 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcmspec.x @@ -0,0 +1,50 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "wcspix.h" + + +# Multispec image class data. + + +# MSP_INIT -- Initialize the Image Class module. + +procedure msp_init () +begin +end + + +# MSP_CACHE -- Cache an image in the object cache. + +procedure msp_cache () +begin +end + + +# MSP_UNCACHE -- Uncache an image in the object cache. + +procedure msp_uncache () +begin +end + + +# MSP_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. + +procedure msp_wcstran () +begin +end + + +# MSP_WCSLIST -- List the WCSs available for the given image. + +procedure msp_wcslist () +begin +end + + +# MSP_OBJINFO -- Get header information from the image. + +procedure msp_objinfo () +begin +end + diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcspix.h b/vendor/x11iraf/ximtool/clients.old/wcspix/wcspix.h new file mode 100644 index 00000000..e0657154 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcspix.h @@ -0,0 +1,111 @@ +# WCSPIX.H -- Include file for the WCS/Pixel value ISM task + +define WCSPIX_NAME "wcspix" +define WCSPIX_MODE "text" +define WCSPIX_CONNECT "unix:/tmp/.ISM%d" + +define WCSPIX_DBG FALSE + +# Main task data structures. +define MAX_WCSLINES 4 # max WCS output lines +define LEN_PIXTAB 81 # size of pixel table +define LEN_WCSNAME 32 # size of a WCS name + +define SZ_WCSPIX 7 +define WP_CPTR Memi[$1 ] # object cache pointer +define WP_PTABSZ Memi[$1+1] # pixel table size +define WP_BPM Memi[$1+2] # get BPM data +define WP_SYSTEMS Memi[$1+3] # WCS readout systems +define WP_WCS Memi[$1+4] # WCS system string +define WP_FORMATS Memi[$1+5] # WCS readout formats +define WP_DBGLEVEL Memi[$1+6] # debug level + +define OBJCACHE Memi[WP_CPTR($1)+$2] # object cache +define SYSTEMS Memi[WP_SYSTEMS($1)+$2-1] +define FORMATS Memi[WP_FORMATS($1)+$2-1] +define WCSNAME Memc[WP_WCS($1)+(LEN_WCSNAME*($2-1))] + + +# Element of an object cache. +define SZ_CACHE 256 # size of object cache +define SZ_CNODE 135 # size of a cache node +define SZ_OBJREF 128 # size of a object reference + +define C_OBJID Memi[$1] # object id +define C_REGID Memi[$1+1] # region id +define C_CLASS Memi[$1+2] # object class +define C_DATA Memi[$1+3] # object data ptr +define C_NREF Memi[$1+4] # no. times object referenced +define C_REF Memc[P2C($1+6)] # object reference file + + +# WCSPIX ISM task methods. +define WCSPIX_CMDS "|set|get|quit|initialize|cache|uncache\ + |wcstran|wcslist|objinfo|debug" + +define SET 1 +define GET 2 +define QUIT 3 +define INITIALIZE 4 +define CACHE 5 +define UNCACHE 6 +define WCSTRAN 7 +define WCSLIST 8 +define OBJINFO 9 +define DEBUG 10 + +# Parameters definable from the GUI +define SZ_PARAM 32 # size of a parameter string + +define WCSPIX_SYSTEMS "|none|logical|physical|world|sky\ + |amplifier|ccd|detector|other|" +define SYS_NONE 1 # no coords requested +define SYS_LOGICAL 2 # logical coords +define SYS_PHYSICAL 3 # physical coords +define SYS_WORLD 4 # world coords +define SYS_SKY 5 # sky coords +define SYS_AMP 6 # amplifier coords +define SYS_CCD 7 # CCD coords +define SYS_DETECTOR 8 # detector coords +define SYS_OTHER 9 # ??? coords + +define SKYPROJ "FK5 FK4 ICRS GAPPT FK4-NO-E Ecliptic Galactic Supergalactic" + + +define WCSPIX_PARAMS "|psize|bpm|wcs|format|" +define PAR_PSIZE 1 # pixel table size +define PAR_BPM 2 # get BPM data +define PAR_WCS 3 # WCS system +define PAR_FMT 4 # WCS format + +define WCSPIX_FMT "|default|hms|degrees|radians|" +define FMT_DEFAULT 1 # no formatting +define FMT_HMS 2 # covert to sexigesimal +define FMT_DEG 3 # output degrees +define FMT_RAD 4 # output radians + +define DEF_PTABSZ 0 # default pixtable size +define DEF_FMT FMT_DEFAULT # default output format +define DEF_SYSTEM SYS_LOGICAL # default coord system +define DEF_BPM_FLAG YES # default get-BPM-data flag + + +# Object class definitions. +define UNKNOWN_CLASS 1 # unknown class +define IMAGE_CLASS 2 # generic image class +define MEF_CLASS 3 # Mosaic MEF image class +define MULTISPEC_CLASS 4 # multispec data class + +# Class methods. +define LEN_CLASS 6 # length of class table +define MAX_CLASSES 16 # max supported classes +define SZ_CLNAME 32 # size of a class name + +define CL_INIT cl_table[1,$1] # class initializer +define CL_CACHE cl_table[2,$1] # cache the object +define CL_UNCACHE cl_table[3,$1] # uncache the object +define CL_WCSTRAN cl_table[4,$1] # WCS tranformations +define CL_WCSLIST cl_table[5,$1] # list available WCS +define CL_OBJINFO cl_table[6,$1] # get object header +define CL_NAME cl_names[1,$1] # class name + diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.f b/vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.f new file mode 100644 index 00000000..0061fbcd --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.f @@ -0,0 +1,229 @@ + subroutine unkint (cp, wp) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer wp + logical xerpop + logical xerflg + common /xercom/ xerflg + save + if (.not.(memi(cp+3) .eq. 0)) goto 110 + call xerpsh + call xcallc(memi(cp+3) , 1, 10 ) + if (.not.xerpop()) goto 120 + goto 100 +120 continue +110 continue + memi(memi(cp+3) ) = wp +100 return + end + subroutine unkcae (cp, objid, regid, ref) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer objid + integer regid + integer*2 ref(*) + save + memi(cp) = objid + memi(cp+1) = regid + memi(cp+4) = memi(cp+4) + 1 + call xstrcy(ref, memc((((cp+6)-1)*2+1)) , 128) +100 return + end + subroutine unkune (cp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + integer*2 st0001(1) + save + data st0001 / 0/ + memi(cp) = 0 + memi(cp+4) = 0 + call xstrcy(st0001, memc((((cp+6)-1)*2+1)) , 255 ) + call xmfree(memi(cp+3) , 10 ) + memi(cp+3) = 0 +100 return + end + subroutine unkwcn (cp, id, x, y) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + real x + real y + integer wp + integer i + integer*2 buf(1023 +1) + integer*2 msg(1023 +1) + integer*2 st0001(37) + integer*2 st0002(27) + integer*2 st0003(37) + integer*2 st0004(5) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) /119, 99,115,116,114, 97,110, 32/ + data (st0001(iyy),iyy= 9,16) /123, 32,111, 98,106,101, 99,116/ + data (st0001(iyy),iyy=17,24) / 32, 37,100, 32,125, 32,123, 32/ + data (st0001(iyy),iyy=25,32) /114,101,103,105,111,110, 32, 37/ + data (st0001(iyy),iyy=33,37) /100, 32,125, 32, 0/ + data (st0002(iyy),iyy= 1, 8) /123, 32,112,105,120,118, 97,108/ + data (st0002(iyy),iyy= 9,16) / 32, 48, 46, 48, 32,125, 32,123/ + data (st0002(iyy),iyy=17,24) / 32, 98,112,109, 32, 48, 32,125/ + data (st0002(iyy),iyy=25,27) / 32, 10, 0/ + data (st0003(iyy),iyy= 1, 8) /123, 99,111,111,114,100, 32,123/ + data (st0003(iyy),iyy= 9,16) / 37, 57,115,125, 32,123, 37, 49/ + data (st0003(iyy),iyy=17,24) / 50,103,125, 32,123, 37, 49, 50/ + data (st0003(iyy),iyy=25,32) /103,125, 32,123, 88,125, 32,123/ + data (st0003(iyy),iyy=33,37) / 89,125,125, 10, 0/ + data st0004 / 85, 78, 75, 78, 0/ + wp = memi(memi(cp+3) ) + call aclrc (msg, 1023 ) + call sprinf (msg, 1023 , st0001) + call pargi (memi(cp) ) + call pargi (memi(cp+1) ) + call xstrct(st0002, msg, 1023 ) + i=1 +110 if (.not.(i .le. 4 )) goto 112 + call sprinf (buf, 1023 , st0003) + call pargsr (st0004) + call pargr (x) + call pargr (y) + call xstrct(buf, msg, 1023 ) +111 i=i+1 + goto 110 +112 continue + call wcspie (msg) +100 return + end + subroutine unkwct (cp, id) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + save +100 return + end + subroutine unkgea (cp, id, x, y, pixval) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + real x + real y + real pixval + integer wp + integer pix + integer size + integer x1 + integer x2 + integer y1 + integer y2 + save + wp = memi(memi(cp+3) ) + size = memi(wp+1) + x1 = x - size / 2 + 0.5 + x2 = x + size / 2 + 0.5 + y1 = y - size / 2 + 0.5 + y2 = y + size / 2 + 0.5 + pixval = 0.0 + if (.not.(size .gt. 1)) goto 110 + call xcallc(pix, size * size, 6) + call imgseb (memr(pix), size, x1, x2, y1, y2) + call xmfree(pix, 6) +110 continue +100 return + end + subroutine unkobo (cp, id, temple) + logical Memb(1) + integer*2 Memc(1) + integer*2 Mems(1) + integer Memi(1) + integer*4 Meml(1) + real Memr(1) + double precision Memd(1) + complex Memx(1) + equivalence (Memb, Memc, Mems, Memi, Meml, Memr, Memd, Memx) + common /Mem/ Memd + integer cp + integer id + integer*2 temple(*) + integer sp + integer buf + integer*2 st0001(25) + save + integer iyy + data (st0001(iyy),iyy= 1, 8) / 99,111,109,112, 97,115,115, 32/ + data (st0001(iyy),iyy= 9,16) / 37,100, 32, 48, 46, 48, 32, 45/ + data (st0001(iyy),iyy=17,24) / 49, 32, 49, 32, 88, 32, 89, 0/ + data (st0001(iyy),iyy=25,25) / 0/ + call smark (sp) + call salloc (buf, 1023 , 2) + call aclrc (memc(buf), 1023 ) + call sprinf (memc(buf), 1023 , st0001) + call pargi (memi(cp) ) + call wcspie (memc(buf)) + call sfree (sp) +100 return + end +c sprinf sprintf +c temple template +c wcspie wcspix_message +c unkwct unk_wcslist +c unkint unk_init +c unkobo unk_objinfo +c unkcae unk_cache +c imgseb img_send_pixtab +c unkune unk_uncache +c unkwcn unk_wcstran +c pargsr pargstr +c unkgea unk_getdata diff --git a/vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.x b/vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.x new file mode 100644 index 00000000..9a1afe1b --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/wcspix/wcunknown.x @@ -0,0 +1,185 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> +include "wcspix.h" + + +# Unknown class data. +define LEN_UNKDATA 1 +define UNK_WP Memi[$1 ] # wcspix back-pointer + + +# UNK_INIT -- Initialize the object structure. + +procedure unk_init (cp, wp) + +pointer cp #i cache pointer +pointer wp #i WCSPIX structure + +begin + # Allocate the image data structure if not previously allocated. + if (C_DATA(cp) == NULL) { + iferr (call calloc (C_DATA(cp), LEN_UNKDATA, TY_STRUCT)) + return + } + + UNK_WP(C_DATA(cp)) = wp +end + + +# UNK_CACHE -- Cache an image in the object cache. Since we don't know +# what this is we simply setup so that a query to the object id will still +# return a result of some kind rather than ignore it. In most cases this +# just means the input arguments are echoed back (e.g. coords), or default +# values such as a rotation value can be retrieved. + +procedure unk_cache (cp, objid, regid, ref) + +pointer cp #i cache pointer +int objid #i object id +int regid #i region id +char ref[ARB] #i object reference + +begin + C_OBJID(cp) = objid + C_REGID(cp) = regid + C_NREF(cp) = C_NREF(cp) + 1 + call strcpy (ref, C_REF(cp), 128) +end + + +# UNK_UNCACHE -- Uncache an unknown image in the object cache. + +procedure unk_uncache (cp, id) + +pointer cp #i cache pointer +int id #i image id + +begin + C_OBJID(cp) = NULL + C_NREF(cp) = 0 + call strcpy ("", C_REF(cp), SZ_FNAME) + + call mfree (C_DATA(cp), TY_STRUCT) + C_DATA(cp) = NULL +end + + +# UNK_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. Message is returned as something like: +# +# set value { +# { object <objid> } { region <regionid> } +# { pixval <pixelvalue> [<units>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# } + + +procedure unk_wcstran (cp, id, x, y) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords + +pointer wp +int i + +# Use static storage to avoid allocation overhead. +char buf[SZ_LINE], msg[SZ_LINE] + +begin + wp = UNK_WP(C_DATA(cp)) + + # Begin formatting the message. + call aclrc (msg, SZ_LINE) + call sprintf (msg, SZ_LINE, "wcstran { object %d } { region %d } ") + call pargi (C_OBJID(cp)) + call pargi (C_REGID(cp)) + call strcat ("{ pixval 0.0 } { bpm 0 } \n", msg, SZ_LINE) + + + # Now loop over the requested systems and generate a coordinate + # for each. + for (i=1; i <= MAX_WCSLINES; i=i+1) { + + # Format the coord buffer and append it to the message. + call sprintf (buf, SZ_LINE, "{coord {%9s} {%12g} {%12g} {X} {Y}}\n") + call pargstr ("UNKN") + call pargr (x) + call pargr (y) + call strcat (buf, msg, SZ_LINE) + } + + # Now send the completed message. + call wcspix_message (msg) +end + + +# UNK_WCSLIST -- List the WCSs available for the given image. + +procedure unk_wcslist (cp, id) + +pointer cp #i cache pointer +int id #i image id + +begin + #call wcspix_message ("wcslist {None Logical}") +end + + +# UNK_GETDATA -- Get data from the image. + +procedure unk_getdata (cp, id, x, y, pixval) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords +real pixval #o central pixel value + +pointer wp, pix +int size, x1, x2, y1, y2 + +begin + wp = UNK_WP(C_DATA(cp)) + size = WP_PTABSZ(wp) + + # Compute the box offset given the center and size. + x1 = x - size / 2 + 0.5 + x2 = x + size / 2 + 0.5 + y1 = y - size / 2 + 0.5 + y2 = y + size / 2 + 0.5 + + pixval = 0.0 + + # Send the pixel table. + if (size > 1) { + call calloc (pix, size * size, TY_REAL) + call img_send_pixtab (Memr[pix], size, x1, x2, y1, y2) + call mfree (pix, TY_REAL) + } +end + + +# UNK_OBJINFO -- Get header information from the image. + +procedure unk_objinfo (cp, id, template) + +pointer cp #i cache pointer +int id #i image id +char template[ARB] #i keyword template + +pointer sp, buf + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + + # Send a default (X,Y) compass indicator. + call aclrc (Memc[buf], SZ_LINE) + call sprintf (Memc[buf], SZ_LINE, "compass %d 0.0 -1 1 X Y\0") + call pargi (C_OBJID(cp)) + call wcspix_message (Memc[buf]) + + call sfree (sp) +end diff --git a/vendor/x11iraf/ximtool/clients.old/x_ism.f b/vendor/x11iraf/ximtool/clients.old/x_ism.f new file mode 100644 index 00000000..218b5d0b --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/x_ism.f @@ -0,0 +1,145 @@ + integer function sysruk (task, cmd, rukarf, rukint) + integer rukarf + integer rukint + integer*2 task(*) + integer*2 cmd(*) + integer i + integer ntasks + integer lmarg + integer rmarg + integer maxch + integer ncol + integer rukean + integer envgei + integer envscn + logical streq + logical xerpop + logical xerflg + common /xercom/ xerflg + integer iyy + integer dp(2) + integer*2 dict(7) + integer*2 st0001(9) + integer*2 st0002(6) + integer*2 st0003(3) + integer*2 st0004(6) + integer*2 st0005(6) + integer*2 st0006(4) + integer*2 st0007(6) + integer*2 st0008(2) + integer*2 st0009(29) + integer*2 st0010(25) + save + data dict /119, 99,115,112,105,120, 0/ + data (st0001(iyy),iyy= 1, 8) /116,116,121,110, 99,111,108,115/ + data (st0001(iyy),iyy= 9, 9) / 0/ + data st0002 / 99,104,100,105,114, 0/ + data st0003 / 99,100, 0/ + data st0004 /104,111,109,101, 36, 0/ + data st0005 / 72, 79, 77, 69, 36, 0/ + data st0006 /115,101,116, 0/ + data st0007 /114,101,115,101,116, 0/ + data st0008 / 9, 0/ + data (st0009(iyy),iyy= 1, 8) /105,110,118, 97,108,105,100, 32/ + data (st0009(iyy),iyy= 9,16) /115,101,116, 32,115,116, 97,116/ + data (st0009(iyy),iyy=17,24) /101,109,101,110,116, 58, 32, 39/ + data (st0009(iyy),iyy=25,29) / 37,115, 39, 10, 0/ + data (st0010(iyy),iyy= 1, 8) /105,110,118, 97,108,105,100, 32/ + data (st0010(iyy),iyy= 9,16) / 83, 69, 84, 32,105,110, 32, 73/ + data (st0010(iyy),iyy=17,24) / 82, 65, 70, 32, 77, 97,105,110/ + data (st0010(iyy),iyy=25,25) / 0/ + data (dp(iyy),iyy= 1, 2) / 1, 0/ + data lmarg /5/, maxch /0/, ncol /0/, rukean /3/ + data ntasks /0/ + if (.not.(ntasks .eq. 0)) goto 110 + i=1 +120 if (.not.(dp(i) .ne. 0)) goto 122 +121 i=i+1 + goto 120 +122 continue + ntasks = i - 1 +110 continue + if (.not.(task(1) .eq. 63)) goto 130 + call xerpsh + rmarg = envgei (st0001) + if (.not.xerpop()) goto 140 + rmarg = 80 +140 continue + call strtbl (4, dict, dp, ntasks, lmarg, rmarg, maxch, ncol) + sysruk = (0) + goto 100 +130 continue + if (.not.(streq(task,st0002) .or. streq(task,st0003))) goto 150 + call xerpsh + if (.not.(cmd(rukarf) .eq. 0)) goto 170 + call xerpsh + call xfchdr(st0004) + if (.not.xerpop()) goto 180 + call xfchdr(st0005) +180 continue + goto 171 +170 continue + call xfchdr(cmd(rukarf)) +171 continue +162 if (.not.xerpop()) goto 160 + if (.not.(rukint .eq. 1)) goto 190 + call erract (rukean) + if (xerflg) goto 100 + goto 191 +190 continue +191 continue +160 continue + sysruk = (0) + goto 100 +150 continue + if (.not.(streq(task,st0006) .or. streq(task,st0007))) goto 200 + call xerpsh + if (.not.(cmd(rukarf) .eq. 0)) goto 220 + call envlit (4, st0008, 1) + call xffluh(4) + goto 221 +220 continue + if (.not.(envscn (cmd) .le. 0)) goto 230 + if (.not.(rukint .eq. 1)) goto 240 + call eprinf (st0009) + call pargsr (cmd) + goto 241 +240 continue + goto 91 +241 continue +230 continue +221 continue +212 if (.not.xerpop()) goto 210 + if (.not.(rukint .eq. 1)) goto 250 + call erract (rukean) + if (xerflg) goto 100 + goto 251 +250 continue +91 call syspac (0, st0010) +251 continue +210 continue + sysruk = (0) + goto 100 +200 continue +151 continue +131 continue + if (.not.(streq (task, dict(dp(1))))) goto 260 + call twcspx + sysruk = (0) + goto 100 +260 continue + sysruk = (-1) + goto 100 +100 return + end +c rukint ruk_interact +c sysruk sys_runtask +c envscn envscan +c twcspx t_wcspix +c envgei envgeti +c syspac sys_panic +c eprinf eprintf +c rukarf ruk_argoff +c rukean ruk_eawarn +c pargsr pargstr +c envlit envlist diff --git a/vendor/x11iraf/ximtool/clients.old/x_ism.x b/vendor/x11iraf/ximtool/clients.old/x_ism.x new file mode 100644 index 00000000..8f401873 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients.old/x_ism.x @@ -0,0 +1 @@ +task wcspix = t_wcspix diff --git a/vendor/x11iraf/ximtool/clients/DONE b/vendor/x11iraf/ximtool/clients/DONE new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients/Imakefile b/vendor/x11iraf/ximtool/clients/Imakefile new file mode 100644 index 00000000..0c126522 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/Imakefile @@ -0,0 +1,32 @@ +XCOMM Imakefile for the Image Support Module components. + +X11IRAFDIR = ../../ +#include <../../X11IRAF.tmpl> + + WC_SRCS = wcspix/t_wcspix.x wcspix/wcimage.x wcspix/wcmef.x \ + wcspix/wcmspec.x wcspix/wcspix.h + LIB_SRCS = lib/dspmmap.x lib/ism.x lib/idxstr.x lib/wcsgfterm.x + + +all:: ism_wcspix.e + +ism_wcspix.e: $(WC_SRCS) $(LIB_SRCS) + @(SHELL=/bin/sh ; export SHELL ; mkpkg relink) + touch DONE + +SubdirLibraryRule($(WC_SRCS) $(LIB_SRCS)) + +clean:: + @(rmbin -v .) + touch DONE + +includes:: + +#if InstallBinaries +install:: ism_wcspix.e + -@if [ -d X11irafBinDir ]; then set +x; \ + else (set -x; $(MKDIRHIER) X11irafBinDir); fi + mv ism_wcspix.e X11irafBinDir +#endif + +DependTarget() diff --git a/vendor/x11iraf/ximtool/clients/Makefile b/vendor/x11iraf/ximtool/clients/Makefile new file mode 100644 index 00000000..9de62c08 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/Makefile @@ -0,0 +1,1067 @@ +# Makefile generated by imake - do not edit! +# $Xorg: imake.c,v 1.6 2001/02/09 02:03:15 xorgcvs Exp $ + +# ---------------------------------------------------------------------- +# Makefile generated from "Imake.tmpl" and <Imakefile> +# $Xorg: Imake.tmpl,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/Imake.tmpl,v 3.138 2002/12/10 03:20:41 dawes Exp $ +# ---------------------------------------------------------------------- + +all:: + +.SUFFIXES: .i + +# $Xorg: Imake.cf,v 1.4 2000/08/17 19:41:45 cpqbld Exp $ + +# $XFree86: xc/config/cf/Imake.cf,v 3.80 2003/01/15 02:52:12 dawes Exp $ + +# Keep cpp from replacing path elements containing i486/i586/i686 + +# ----------------------------------------------------------------------- +# site-specific configuration parameters that need to come before +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# $XFree86: xc/config/cf/xf86site.def,v 3.181 2002/02/22 21:32:33 dawes Exp $ + +# ---------------------------------------------------------------------- +# platform-specific configuration parameters - edit linux.cf to change + +# platform: $Xorg: linux.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ + +# platform: $XFree86: xc/config/cf/linux.cf,v 3.201tsi Exp $ + +# operating system: Linux 2.4.29-4aslsmp i686 [ELF] (2.4.29) +# libc: (6.3.2) +# binutils: (213) + +# $Xorg: lnxLib.rules,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.rules,v 3.43 2002/04/04 14:05:33 eich Exp $ + +# $XFree86: xc/config/cf/xfree86.cf,v 3.439.2.1 2003/03/13 04:10:40 tsi Exp $ + +# $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ + +VENDORMANNAME = XFree86 +VENDORMANVERSION = `echo 4 3 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + +AFB_DEFS = -DUSE_AFB + +DRIVERSDKDIR = $(USRLIBDIR)/Server +DRIVERSDKMODULEDIR = $(USRLIBDIR)/Server/modules +DRIVERSDKINCLUDEDIR = $(USRLIBDIR)/Server/include + + XF86SRC = $(SERVERSRC)/hw/xfree86 + XF86COMSRC = $(XF86SRC)/common + XF86PARSERSRC = $(XF86SRC)/parser + XF86OSSRC = $(XF86SRC)/os-support + XF86DRIVERSRC = $(XF86SRC)/drivers + DRIVERSRC = $(XF86DRIVERSRC) + + XFREE86DOCDIR = $(DOCDIR) + XFREE86PSDOCDIR = $(DOCPSDIR) + XFREE86HTMLDOCDIR = $(DOCHTMLDIR) +XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese + +# $Xorg: xf86.rules,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ + +# $XFree86: xc/config/cf/xf86.rules,v 3.33 2001/01/17 16:38:51 dawes Exp $ + +# ---------------------------------------------------------------------- +# site-specific configuration parameters that go after +# the platform-specific parameters - edit site.def to change + +# site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ + +# site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ + +# --------------------------------------------------------------------- +# Imake rules for building libraries, programs, scripts, and data files +# rules: $Xorg: Imake.rules,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# rules: $XFree86: xc/config/cf/Imake.rules,v 3.112 2002/11/14 21:01:13 tsi Exp $ + + _NULLCMD_ = @ echo -n + +GLIDE2INCDIR = /usr/include/glide + +GLIDE3INCDIR = /usr/include/glide3 + +GLIDE3LIBNAME = glide3 + +TKLIBNAME = + +TKLIBDIR = + +TCLLIBNAME = + +TCLIBDIR = + + PATHSEP = / + SHELL = /bin/sh -e + + TOP = ../.. + CURRENT_DIR = ximtool/clients + + IMAKE = imake + DEPEND = gccmakedep + MKDIRHIER = mkdir -p + REVPATH = revpath + EXPORTLISTGEN = + RMAN = rman + RMANBASENAME = rman + RMANOPTIONS = -f HTML + CONFIGSRC = $(TOP)/config + IMAKESRC = $(CONFIGSRC)/imake + DEPENDSRC = $(CONFIGSRC)/util + + INCROOT = /usr/X11R6/include + USRLIBDIR = /usr/X11R6/lib + VARDIR = /var + VARLIBDIR = $(VARDIR)/lib + SYSTEMUSRLIBDIR = /usr/lib + SYSTEMUSRINCDIR = /usr/include + SHLIBDIR = /usr/X11R6/lib + LINTLIBDIR = $(USRLIBDIR)/lint + MANPATH = /usr/X11R6/man + MANSOURCEPATH = $(MANPATH)/man + MANDIR = $(MANSOURCEPATH)1 + LIBMANDIR = $(MANSOURCEPATH)3 + FILEMANDIR = $(MANSOURCEPATH)5 + MISCMANDIR = $(MANSOURCEPATH)7 + DRIVERMANDIR = $(MANSOURCEPATH)4 + ICONDIR = /usr/share/icons + XCURSORPATH = "~/.icons:/usr/share/icons:/usr/share/pixmaps" + LOGDIRECTORY = $(VARDIR)/log + + VARRUNDIR = $(VARDIR)/run + + VARDBDIR = $(VARDIR)/lib + + AR = ar clq + +# Nice try but useless: make will inherit BOOTSTRAPCFLAGS +# from top Makefile + BOOTSTRAPCFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -pipe + + CC = gcc -m32 + AS = gcc -m32 -c -x assembler + +.SUFFIXES: .cc + + CXX = c++ -m32 + + CXXFILT = c++filt + CXXLIB = + CXXDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe +CXXDEPENDINCLUDES = + CXXEXTRA_DEFINES = +CXXEXTRA_INCLUDES = + CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(CXXPROJECT_DEFINES) + CXXOPTIONS = + CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) + CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(DEFINES) $(CXXEXTRA_DEFINES) + CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) + + COMPRESS = compress + GZIPCMD = gzip + + CPP = /usr/bin/cpp $(STD_CPP_DEFINES) + RAWCPP = /usr/bin/cpp -undef $(STD_CPP_OPTIONS) + PREPROCESSCMD = gcc -m32 -E $(STD_CPP_DEFINES) + + INSTALL = install + INSTALLFLAGS = -c + + LD = gcc -m32 -nostdlib + + LEX = flex -l + M4 = m4 + M4FLAGS = + LEXLIB = -lfl + YACC = bison -y + CCYACC = bison -y + + LINT = lint + + LINTLIBFLAG = -C + LINTOPTS = -axz + LN = ln -s + MAKE = make + MV = mv -f + CP = cp + + RANLIB = ranlib + + RANLIBINSTFLAGS = + + RM = rm -f + PERL = perl + PERLOPTS = + MANSUFFIX = 1x + LIBMANSUFFIX = 3x + FILEMANSUFFIX = 5x + MISCMANSUFFIX = 7x + DRIVERMANSUFFIX = 4x + MANSRCSUFFIX = man + MANNEWSUFFIX = _man + MANDEFS = -D__apploaddir__=$(XAPPLOADDIR) -D__filemansuffix__=$(FILEMANSUFFIX) -D__libmansuffix__=$(LIBMANSUFFIX) -D__miscmansuffix__=$(MISCMANSUFFIX) -D__drivermansuffix__=$(DRIVERMANSUFFIX) -D__projectroot__=$(PROJECTROOT) $(XORGMANDEFS) $(VENDORMANDEFS) + + COMPRESSMANCMD = gzip -n + + TROFF = groff -Tps + NROFF = nroff + MSMACROS = -ms + MANMACROS = -man + TBL = tbl + EQN = eqn + NEQN = neqn + COL = col + COLFLAGS = -b + + MODCC = gcc -m32 + + MODCPP = /usr/bin/cpp + MODCFLAGS = $(CFLAGS) + MODAS = gcc -m32 -c -x assembler + MODASFLAGS = + + MODLD = gcc -m32 -nostdlib + + MODLDFLAGS = +MODLDCOMBINEFLAGS = -r + MODAR = ar clq + + MODRANLIB = ranlib + + STD_INCLUDES = + STD_CPP_OPTIONS = -traditional + STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) + STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) + EXTRA_LOAD_FLAGS = + EXTRA_LDOPTIONS = + EXTRA_LIBRARIES = + TAGS = ctags + + PARALLELMFLAGS = + + SHAREDCODEDEF = + SHLIBDEF = + + SHLIBLDFLAGS = -shared $(SHLIBGLOBALSFLAGS) + + PICFLAGS = -fPIC + + CXXPICFLAGS = -fPIC + + PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO + + INSTPGMFLAGS = + + INSTBINFLAGS = -m 0755 + INSTUIDFLAGS = -m 4711 + INSTLIBFLAGS = -m 0644 + INSTINCFLAGS = -m 0444 + INSTMANFLAGS = -m 0444 + INSTDATFLAGS = -m 0444 + INSTKMEMFLAGS = -m 4711 + + PROJECTROOT = /usr/X11R6 + + CDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe + CCOPTIONS = + + ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) + CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) + LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) + LDPRELIB = -L$(USRLIBDIR) $(INSTALLED_LIBS) + LDPOSTLIB = + LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) + + LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) + + CCLINK = $(CC) + + CXXLINK = $(CXX) + + LDSTRIPFLAGS = -x + LDCOMBINEFLAGS = -r + DEPENDFLAGS = + DEPEND_DEFINES = + +# Not sure this belongs here + TKLIBDIR = + TKINCDIR = + TKLIBNAME = + TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME) + TCLLIBDIR = + TCLINCDIR = + TCLLIBNAME = + TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME) + + MACROFILE = linux.cf + RM_CMD = $(RM) + + IMAKE_DEFINES = + IMAKE_WARNINGS = -Wundef + + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_WARNINGS) + + ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) + +# $Xorg: X11.rules,v 1.4 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/X11.rules,v 1.5 2000/11/06 19:24:00 dawes Exp $ + +# ---------------------------------------------------------------------- +# X Window System Build Parameters and Rules +# $Xorg: X11.tmpl,v 1.6 2000/08/17 19:41:46 cpqbld Exp $ +# +# +# +# +# $XFree86: xc/config/cf/X11.tmpl,v 1.196.2.2 2003/09/17 05:58:15 herrb Exp $ + +XORGRELSTRING = Release 6.6 +XORGMANNAME = X Version 11 + +VENDORMANNAME = XFree86 +VENDORMANVERSION = `echo 4 3 0 | sed -e 's/ /./g' -e 's/^/Version\\\ /'` + +STICKY_DEFINES = -DHAS_STICKY_DIR_BIT + +FCHOWN_DEFINES = -DHAS_FCHOWN + +# ----------------------------------------------------------------------- +# X Window System make variables; these need to be coordinated with rules + + XTOP = $(TOP) + BINDIR = /usr/X11R6/bin + BUILDINCROOT = $(TOP)/exports + BUILDINCDIR = $(BUILDINCROOT)/include + BUILDINCTOP = ../.. + BUILDLIBDIR = $(TOP)/exports/lib + BUILDLIBTOP = ../.. + BUILDBINDIR = $(TOP)/exports/bin + BUILDBINTOP = ../.. + BUILDMODULEDIR = $(BUILDLIBDIR)/modules + BUILDMODULETOP = $(BUILDLIBTOP)/.. + XBUILDINCROOT = $(XTOP)/exports + XBUILDINCDIR = $(XBUILDINCROOT)/include/X11 + XBUILDINCTOP = ../../.. + XBUILDBINDIR = $(XBUILDINCROOT)/bin + INCDIR = $(INCROOT) + ADMDIR = /var/log + LIBDIR = /usr/X11R6/lib/X11 + LIBEXECDIR = /usr/X11R6/libexec + MODULEDIR = $(USRLIBDIR)/modules + TOP_X_INCLUDES = + + ETCX11DIR = /etc/X11 + + CONFDIR = $(ETCX11DIR) + + DOCDIR = $(LIBDIR)/doc + DOCHTMLDIR = $(DOCDIR)/html + DOCPSDIR = $(DOCDIR)/PostScript + FONTDIR = $(LIBDIR)/fonts + ENCODINGSDIR = $(FONTDIR)/encodings + XINITDIR = /etc/X11/xinit + XDMDIR = /etc/X11/xdm + XDMVARDIR = $(VARLIBDIR)/xdm + TWMDIR = $(LIBDIR)/twm + XSMDIR = $(LIBDIR)/xsm + NLSDIR = $(LIBDIR)/nls + XLOCALEDIR = $(LIBDIR)/locale + PEXAPIDIR = $(LIBDIR)/PEX + LBXPROXYDIR = /etc/X11/lbxproxy + PROXYMANAGERDIR = /etc/X11/proxymngr + XPRINTDIR = /etc/X11/xserver + XAPPLOADDIR = $(LIBDIR)/app-defaults + FONTCFLAGS = -t + + INSTAPPFLAGS = $(INSTDATFLAGS) + + RGB = $(BINDIR)/rgb + FONTC = $(BINDIR)/bdftopcf + MKFONTDIR = $(BINDIR)/mkfontdir + MKHTMLINDEX = $(BINDIR)/mkhtmlindex + UCS2ANY = $(BINDIR)/ucs2any + BDFTRUNCATE = $(BINDIR)/bdftruncate + UCSMAPPREFIX = $(FONTDIR)/util/map- + XCURSORGEN = $(BINDIR)/xcursorgen + + HTMLINDEXCMD = HtmlIndexCmd + + DOCUTILSRC = $(XTOP)/doc/util + CLIENTSRC = $(TOP)/clients + DEMOSRC = $(TOP)/demos + XDOCMACROS = $(DOCUTILSRC)/macros.t + XIDXMACROS = $(DOCUTILSRC)/indexmacros.t + PROGRAMSRC = $(TOP)/programs + LIBSRC = $(XTOP)/lib + FONTSRC = $(XTOP)/fonts + ENCODINGSSRC = $(FONTSRC)/encodings + INCLUDESRC = $(BUILDINCROOT)/include + XINCLUDESRC = $(INCLUDESRC)/X11 + SERVERSRC = $(XTOP)/programs/Xserver + CONTRIBSRC = $(XTOP)/../contrib + UNSUPPORTEDSRC = $(XTOP)/unsupported + DOCSRC = $(XTOP)/doc + RGBSRC = $(XTOP)/programs/rgb + BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf + MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir + FONTSERVERSRC = $(PROGRAMSRC)/xfs + FONTINCSRC = $(XTOP)/include/fonts + EXTINCSRC = $(XTOP)/include/extensions + FTSOURCEDIR = $(TOP)/extras/FreeType + XTTSOURCEDIR = $(TOP)/extras/X-TrueType + MESASRCDIR = $(TOP)/extras/Mesa + OGLSAMPLESRCDIR = $(TOP)/extras/ogl-sample + PSWRAPSRC = $(XTOP)/config/pswrap + TRANSCOMMSRC = $(LIBSRC)/xtrans + TRANS_INCLUDES = -I$(TRANSCOMMSRC) + CONNECTION_FLAGS = -DUNIXCONN -DTCPCONN $(STICKY_DEFINES) $(FCHOWN_DEFINES) + + XORGMANDEFS = -D__xorgversion__='"$(XORGRELSTRING)" "$(XORGMANNAME)"' + VENDORMANDEFS = -D__vendorversion__="\"Version $(VENDORMANVERSION)\" $(VENDORMANNAME)" + + XENVLIBDIR = $(USRLIBDIR) + CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR) + +# $Xorg: lnxLib.tmpl,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ +# $XFree86: xc/config/cf/lnxLib.tmpl,v 3.13 2001/01/17 16:22:32 dawes Exp $ + + XLIBSRC = $(LIBSRC)/X11 + +SOXLIBREV = 6.2 +DEPXONLYLIB = +XONLYLIB = -lX11 + +LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln + + XLIBONLY = $(XONLYLIB) + + XEXTLIBSRC = $(LIBSRC)/Xext + +SOXEXTREV = 6.4 +DEPEXTENSIONLIB = +EXTENSIONLIB = -lXext + +LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln + +LINTEXTENSIONLIB = $(LINTEXTENSION) + DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) + XLIB = $(EXTENSIONLIB) $(XONLYLIB) + LINTXLIB = $(LINTXONLYLIB) + + XSSLIBSRC = $(LIBSRC)/Xss + +DEPXSSLIB = $(USRLIBDIR)/libXss.a +XSSLIB = -lXss + +LINTXSS = $(LINTLIBDIR)/llib-lXss.ln + + XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc + +DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a +XXF86MISCLIB = -lXxf86misc + +LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln + + XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm + +DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a +XXF86VMLIB = -lXxf86vm + +LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln + + XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga + +DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a +XXF86DGALIB = -lXxf86dga + +LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln + + XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush + +DEPXXF86RUSHLIB = $(USRLIBDIR)/libXxf86rush.a +XXF86RUSHLIB = -lXxf86rush + +LINTXXF86RUSH = $(LINTLIBDIR)/llib-lXxf86rush.ln + + XVLIBSRC = $(LIBSRC)/Xv + +SOXVREV = 1.0 +DEPXVLIB = +XVLIB = -lXv + +LINTXV = $(LINTLIBDIR)/llib-lXv.ln + + XVMCLIBSRC = $(LIBSRC)/XvMC + +DEPXVMCLIB = $(USRLIBDIR)/libXvMC.a +XVMCLIB = -lXvMC + +LINTXVMC = $(LINTLIBDIR)/llib-lXvMC.ln + + XINERAMALIBSRC = $(LIBSRC)/Xinerama + +DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a +XINERAMALIB = -lXinerama + +LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln + + XRESLIBSRC = $(LIBSRC)/XRes + +DEPXRESLIB = $(USRLIBDIR)/libXRes.a +XRESLIB = -lXRes + +LINTXRES = $(LINTLIBDIR)/llib-lXRes.ln + + DPSLIBSRC = $(LIBSRC)/dps + +SODPSREV = 1.0 +DEPDPSLIB = +DPSLIB = -ldps + +LINTDPS = $(LINTLIBDIR)/llib-ldps.ln + + DPSTKLIBSRC = $(LIBSRC)/dpstk + +SODPSTKREV = 1.0 +DEPDPSTKLIB = +DPSTKLIB = -ldpstk + +LINTDPSTK = $(LINTLIBDIR)/llib-ldpstk.ln + + PSRESLIBSRC = $(LIBSRC)/psres + +SOPSRESREV = 1.0 +DEPPSRESLIB = +PSRESLIB = -lpsres + +LINTPSRES = $(LINTLIBDIR)/llib-lpsres.ln + + GLULIBSRC = $(LIBSRC)/GLU + +SOGLUREV = 1.3 +DEPGLULIB = +GLULIB = -lGLU + +LINTGLU = $(LINTLIBDIR)/llib-lGLU.ln + + GLXLIBSRC = $(LIBSRC)/GL + +SOGLREV = 1.2 +DEPGLXLIB = +GLXLIB = -lGL + +LINTGLX = $(LINTLIBDIR)/llib-lGL.ln + + GLWIDGETSRC = $(LIBSRC)/GLw + +DEPGLWLIB = $(USRLIBDIR)/libGLw.a +GLWLIB = -lGLw + +LINTGLW = $(LINTLIBDIR)/llib-lGLw.ln + + XRENDERLIBSRC = $(LIBSRC)/Xrender + +SOXRENDERREV = 1.2 +DEPXRENDERLIB = +XRENDERLIB = -lXrender + +LINTXRENDER = $(LINTLIBDIR)/llib-lXrender.ln + + XRANDRRLIBSRC = $(LIBSRC)/Xrandr + +SOXRANDRREV = 2.0 +DEPXRANDRLIB = +XRANDRLIB = -lXrandr + +LINTXRANDR = $(LINTLIBDIR)/llib-lXrandr.ln + + XCURSORRLIBSRC = $(LIBSRC)/Xcursor + +SOXCURSORREV = 1.0 +DEPXCURSORLIB = +XCURSORLIB = -lXcursor + +LINTXCURSOR = $(LINTLIBDIR)/llib-lXcursor.ln + + XFONTCACHELIBSRC = $(LIBSRC)/Xfontcache + +DEPXFONTCACHELIB = $(USRLIBDIR)/libXfontcache.a +XFONTCACHELIB = -lXfontcache + +LINTXFONTCACHE = $(LINTLIBDIR)/llib-lXfontcache.ln + + XAUTHSRC = $(LIBSRC)/Xau + +DEPXAUTHLIB = $(USRLIBDIR)/libXau.a +XAUTHLIB = -lXau + +LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln + + XDMCPLIBSRC = $(LIBSRC)/Xdmcp + +DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a +XDMCPLIB = -lXdmcp + +LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln + + XMUSRC = $(LIBSRC)/Xmu + +SOXMUREV = 6.2 +DEPXMULIB = +XMULIB = -lXmu + +LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln + + XMUUSRC = $(LIBSRC)/Xmuu + +SOXMUUREV = 1.0 +DEPXMUULIB = +XMUULIB = -lXmuu + +LINTXMUU = $(LINTLIBDIR)/llib-lXmuu.ln + + OLDXLIBSRC = $(LIBSRC)/oldX + +DEPOLDXLIB = $(USRLIBDIR)/liboldX.a +OLDXLIB = -loldX + +LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln + + XPLIBSRC = $(LIBSRC)/Xp + +SOXPREV = 6.2 +DEPXPLIB = +XPLIB = -lXp + +LINTXP = $(LINTLIBDIR)/llib-lXp.ln + + TOOLKITSRC = $(LIBSRC)/Xt + +SOXTREV = 6.0 +DEPXTOOLONLYLIB = +XTOOLONLYLIB = -lXt + +LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln + + DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) + XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) + LINTXTOOLLIB = $(LINTXTOOLONLYLIB) + + XALIBSRC = $(LIBSRC)/Xa + +SOXAREV = 1.0 +DEPXALIB = +XALIB = -lXa + +LINTXA = $(LINTLIBDIR)/llib-lXa.ln + + AWIDGETSRC = $(LIBSRC)/Xaw + +SOXAWREV = 7.0 +DEPXAWLIB = +XAWLIB = -lXaw + +LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln + + AWIDGET6SRC = $(LIBSRC)/Xaw6 + +SOXAW6REV = 6.1 +DEPXAW6LIB = +XAW6LIB = -lXaw + +LINTXAW6 = $(LINTLIBDIR)/llib-lXaw.ln + + XILIBSRC = $(LIBSRC)/Xi + +SOXINPUTREV = 6.0 +DEPXILIB = +XILIB = -lXi + +LINTXI = $(LINTLIBDIR)/llib-lXi.ln + + XTESTLIBSRC = $(LIBSRC)/Xtst + +SOXTESTREV = 6.1 +DEPXTESTLIB = +XTESTLIB = -lXtst + +LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln + + PEXLIBSRC = $(LIBSRC)/PEX5 + +SOPEXREV = 6.0 +DEPPEXLIB = +PEXLIB = -lPEX5 + +LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln + + XIELIBSRC = $(LIBSRC)/XIE + +SOXIEREV = 6.0 +DEPXIELIB = +XIELIB = -lXIE + +LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln + + PHIGSLIBSRC = $(LIBSRC)/PHIGS + +DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a +PHIGSLIB = -lphigs + +LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln + +DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a +XBSDLIB = -lXbsd + +LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln + + ICESRC = $(LIBSRC)/ICE + +SOICEREV = 6.3 +DEPICELIB = +ICELIB = -lICE + +LINTICE = $(LINTLIBDIR)/llib-lICE.ln + + SMSRC = $(LIBSRC)/SM + +SOSMREV = 6.0 +DEPSMLIB = +SMLIB = -lSM + +LINTSM = $(LINTLIBDIR)/llib-lSM.ln + + XKEYSRC = $(LIBSRC)/Xkey + +SOXKEYREV = 6.0 +DEPXKEYLIB = +XKEYLIB = -lXkey + +LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln + + FSLIBSRC = $(LIBSRC)/FS + +DEPFSLIB = $(USRLIBDIR)/libFS.a +FSLIB = -lFS + +LINTFS = $(LINTLIBDIR)/llib-lFS.ln + + FONTLIBSRC = $(LIBSRC)/font + +SOFONTREV = 1.4 +DEPFONTLIB = +FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln +# +SOFONTREV = 1.4 +DEPXFONTLIB = +XFONTLIB = -lXfont + +LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln + + FONTSTUBLIBSRC = $(FONTLIBSRC)/stubs + +DEPFONTSTUBLIB = $(USRLIBDIR)/libfntstubs.a +FONTSTUBLIB = -lfntstubs + +LINTFONTSTUB = $(LINTLIBDIR)/llib-lfntstubs.ln + DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) + FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) $(FONTFT2LIB) + + FONTENCLIBSRC = $(LIBSRC)/fontenc + +DEPXFONTENCLIB = $(USRLIBDIR)/libfontenc.a +XFONTENCLIB = -lfontenc + +LINTXFONTENC = $(LINTLIBDIR)/llib-lfontenc.ln + + XPMLIBSRC = $(LIBSRC)/Xpm + +SOXPMREV = 4.11 +DEPXPMLIB = +XPMLIB = -lXpm + +LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln + +FREETYPE2DIR = /usr +FREETYPE2LIBDIR = /usr/lib +FREETYPE2INCDIR = /usr/include/freetype2 + +FREETYPE2LIB = -lfreetype + +FREETYPE2INCLUDES = -I$(FREETYPE2INCDIR) +FREETYPE2DEFINES = -DFREETYPE2 + + EXPATLIBSRC = $(LIBSRC)/expat + +SOEXPATREV = 1.0 +DEPEXPATLIB = +EXPATLIB = -lexpat + +LINTEXPAT = $(LINTLIBDIR)/llib-lexpat.ln + +EXPATDIR = /usr +EXPATLIBDIR = /usr/lib +EXPATINCDIR = /usr/include + +EXPATINCLUDES = + +EXPATLIB = -lexpat + +EXPATDEFINES = -DEXPAT + + XFT1LIBSRC = $(LIBSRC)/Xft1 + +SOXFT1REV = 1.1 +DEPXFT1LIB = +XFT1LIB = -lXft + +LINTXFT1 = $(LINTLIBDIR)/llib-lXft.ln + + XFTLIBSRC = $(LIBSRC)/Xft + +SOXFTREV = 2.1 +DEPXFTLIB = +XFTLIB = -lXft + +LINTXFT = $(LINTLIBDIR)/llib-lXft.ln + +XFTINCLUDES=$(FONTCONFIGINCLUDES) $(FREETYPE2INCLUDES) + +FONTCONFIGDIR = /usr +FONTCONFIGLIBDIR = /usr/lib +FONTCONFIGINCDIR = /usr/include +FONTCONFIGBINDIR = /usr/bin + +FONTCONFIGLIB = -lfontconfig + +FONTCONFIGINCLUDES = + +FCCACHE = $(FONTCONFIGBINDIR)/fc-cache + +FONTCONFIGDEFINES = -DFONTCONFIG + +LIBPNGINCDIR = /usr/include + +LIBPNGINC= + +LIBPNGDIR = /usr +LIBPNGLIBDIR = /usr/lib +LIBPNGINCDIR = /usr/include + +LIBPNGLIB = -lpng + + XKBFILELIBSRC = $(LIBSRC)/xkbfile + +DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a +XKBFILELIB = -lxkbfile + +LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln + + XKBCOMPCMD = $(BINDIR)/xkbcomp + + XKBUILIBSRC = $(LIBSRC)/xkbui + +DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a +XKBUILIB = -lxkbui + +LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln + + XTRAPLIBSRC = $(LIBSRC)/XTrap + +SOXTRAPREV = 6.4 +DEPXTRAPLIB = +XTRAPLIB = -lXTrap + +LINTXTRAP = $(LINTLIBDIR)/llib-lXTrap.ln + + DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) + + DEPLIBS1 = $(DEPLIBS) + DEPLIBS2 = $(DEPLIBS) + DEPLIBS3 = $(DEPLIBS) + DEPLIBS4 = $(DEPLIBS) + DEPLIBS5 = $(DEPLIBS) + DEPLIBS6 = $(DEPLIBS) + DEPLIBS7 = $(DEPLIBS) + DEPLIBS8 = $(DEPLIBS) + DEPLIBS9 = $(DEPLIBS) + DEPLIBS10 = $(DEPLIBS) + +XMULIBONLY = -lXmu +XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) + + CONFIGDIR = $(LIBDIR)/config + + USRLIBDIRPATH = $(USRLIBDIR) + LDPRELIBS = -L$(USRLIBDIR) $(INSTALLED_LIBS) + LDPOSTLIBS = + TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES) + PROJECT_DEFINES = + +CXXPROJECT_DEFINES = + +# ---------------------------------------------------------------------- +# start of Imakefile + +# Imakefile for the Image Support Module components. + +X11IRAFDIR = ../../ + +# $Xorg: Library.tmpl,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ + +# $XFree86: xc/config/cf/Library.tmpl,v 3.20 2002/11/25 14:04:47 eich Exp $ + + CC = gcc -m32 + + CCOPTIONS = +STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) +CDEBUGFLAGS = -O2 -pipe -march=i386 -mcpu=i686 -fno-strict-aliasing -pipe +CLIBDEBUGFLAGS = + CFLAGS = $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) + +LIB_MT_DEFINES = LibraryMTDefines + +SOSYMLINK = true + + X11IRAFBINDIR = $(X11IRAFDIR)/bin + X11IRAFMANDIR = $(X11IRAFDIR)/man + X11IRAFLIBDIR = $(X11IRAFDIR)/lib + X11IRAFINCDIR = $(X11IRAFDIR)/include + + XGTERMDIR = $(X11IRAFDIR)/xgterm + XIMTOOLDIR = $(X11IRAFDIR)/ximtool + XTAPEMONDIR = $(X11IRAFDIR)/xtapemon + OBMSHDIR = $(X11IRAFDIR)/obmsh + OBMDIR = $(X11IRAFDIR)/obm + XPMDIR = $(X11IRAFDIR)/xpm + XAW3DDIR = $(X11IRAFDIR)/xaw3d + CDLDIR = $(X11IRAFDIR)/cdl + + DEPLIBOBM = $(OBMDIR)/libobm.a + LIBOBM = -lobm + DEPLIBXPM = $(XPMDIR)/libXpm.a + LIBXPM = -lXpm + DEPLIBXAW3D = $(XAW3DDIR)/libXaw3d.a + LIBXAW3D = -lXaw3d + LIBCDL = -lcdl + + X11IRAF_LDFLAGS = -L$(X11IRAFDIR)/lib -L../lib + X11IRAF_INCLUDES = -I$(X11IRAFDIR)/include -I../include + + CP = cp -p + + WC_SRCS = wcspix/t_wcspix.x wcspix/wcimage.x wcspix/wcmef.x wcspix/wcmspec.x wcspix/wcspix.h + + LIB_SRCS = lib/dspmmap.x lib/ism.x lib/idxstr.x lib/wcsgfterm.x + +all:: ism_wcspix.e + +ism_wcspix.e: $(WC_SRCS) $(LIB_SRCS) + @(SHELL=/bin/sh ; export SHELL ; mkpkg relink) + touch DONE + +all:: DONE + +DONE: $(WC_SRCS) $(LIB_SRCS) + $(RM) $@ + touch $@ + +cleandir:: + $(RM) DONE + +cleandir:: + @(rmbin -v .) + touch DONE + +includes:: + +install:: ism_wcspix.e + -@if [ -d $(X11IRAFDIR)/bin ]; then set +x; else (set -x; $(MKDIRHIER) $(X11IRAFDIR)/bin); fi + + mv ism_wcspix.e $(X11IRAFDIR)/bin + +depend:: + $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) + +# ---------------------------------------------------------------------- +# common rules for all Makefiles - do not edit + +.c.i: + $(RM) $@ + $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ + +.SUFFIXES: .s + +.c.s: + $(RM) $@ + $(CC) -S $(CFLAGS) $(_NOOP_) $*.c + +emptyrule:: + +cleandir:: + $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* + +Makefile:: + -@if [ -f Makefile ]; then set -x; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) + +tags:: + $(TAGS) -w *.[ch] + $(TAGS) -xw *.[ch] > TAGS + +man_keywords:: + +html_index:: + +clean:: cleandir + +distclean:: cleandir + +# ---------------------------------------------------------------------- +# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install in $(CURRENT_DIR) done" + +install.man:: + @echo "install.man in $(CURRENT_DIR) done" + +install.sdk:: + @echo "install.sdk in $(CURRENT_DIR) done" + +Makefiles:: + +includes:: + +depend:: + +distclean:: + $(RM) Makefile Makefile.dep + +# ---------------------------------------------------------------------- +# dependencies generated by makedepend + diff --git a/vendor/x11iraf/ximtool/clients/README b/vendor/x11iraf/ximtool/clients/README new file mode 100644 index 00000000..c668daaa --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/README @@ -0,0 +1,3 @@ +# +# CLIENTS -- This directory contains the code for the ISM client tasks. +# diff --git a/vendor/x11iraf/ximtool/clients/doc/Notes b/vendor/x11iraf/ximtool/clients/doc/Notes new file mode 100644 index 00000000..da021306 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/doc/Notes @@ -0,0 +1,199 @@ + + +define MAX_WCSLINES 4 + +define SZ_WPIX 6 +define WP_CPTR Memi[$1 ] # cache pointer +define WP_PTABSZ Memi[$1+1] # pixel table size +define WP_SYSTEMS Memi[$1+2] # WCS readout systems +define WP_FORMATS Memi[$1+3] # WCS readout formats + +define SYSTEMS Memi[WP_SYSTEMS($1)+$2-1] # WCS systems per line +define FORMATS Memi[WP_FORMATS($1)+$2-1] # WCS formats per line +define OBJCACHE Memi[WP_CPTR($1)+$2] # object cache + +# Element of an object cache. +define SZ_CNODE 135 # size of a cache node +define SZ_OBJREF 128 # size of a object reference + +define C_OBJID Memi[$1] # object id +define C_REGID Memi[$1+1] # region id +define C_CLASS Memi[$1+2] # object class +define C_DATA Memi[$1+3] # object data ptr +define C_REF Memc[P2C($1+4)] # object reference file + +# Object class definitions. +define IMAGE_CLASS 1 # generic image class +define MEF_CLASS 2 # Mosaic MEF image class +define MULTISPEC_CLASS 3 # multispec data class + +# Class methods. +define LEN_CL 6 # length of class table +define MAX_CL 6 # max supported classes +define SZ_CLNAME 16 # size of a class name + +define CL_INIT cl_table[1,$1] # class initializer +define CL_CACHE cl_table[2,$1] # cache the object +define CL_UNCACHE cl_table[3,$1] # uncache the object +define CL_WCSTRAN cl_table[4,$1] # WCS tranformations +define CL_WCSLIST cl_table[5,$1] # list available WCS +define CL_GETDATA cl_table[6,$1] # get object data +define CL_NAME cl_names[1,$1] # class name + +# Class common. +int cl_nclasses # number of defined functions +int cl_table[LEN_CL,MAX_CL] # class table +char cl_names[SZ_CLNAME,MAX_CL] # class names +common /class_com/ cl_nclasses, cl_table, cl_names + + +# Image class data. +define O_IM Memi[$1+2] # image pointer +define O_MW Memi[$1+3] # image wcs pointer +define O_CO Memi[$1+3] # skywcs transform pointer +define O_CT Memi[$1+4] # mwcs transform pointer +define O_ROT Memr[$1+5] # rotation angle +define O_SCALE Memr[$1+6] # plate scale + + + +-------------------------------------------------------------------------------- +ISM Methods: +-------------------------------------------------------------------------------- + + initialize + cache <objid> <ref> + uncache <objid> + wcstran <objid> <x> <y> [[<region-name> <x> <y>] ["NDC" <x> <y>]] + wcslist <objid> + getheader <objid> <template-list> + + +procedure initialize +begin + for (each object in the cache) + uncache object + send startup req to GUI +end + +procedure cache +begin +end + +procedure uncache +begin +end + +procedure wcstran +begin +end + +procedure wcslist +begin +end + +procedure getheader +begin +end + + +-------------------------------------------------------------------------------- +GUI Callbacks +-------------------------------------------------------------------------------- + +proc ism_msg { param old new } { + + set target [lindex $new 0] ;# name of ism module + + switch [lindex $new 0] { + source { source [lindex $new 1] } ;# source Tcl code + alert { Wexec client [lindex $new 1] } ;# alert from ism client + + deliver { set ism [lindex $new 0] ;# determine ISM name + set argv [lrange $new 1 end] ;# get args + set argc [llength $argv] + ${ism}_msg $argc $argv ;# call module + } + } +} ; send ism_msg addCallback ism_msg + + +proc wpix_msg { argc argv } { + + switch [lindex $argv 0] { + startup { wpix_startup } + shutdown { wpix_shutdown } + cache { .... save image name to GUI cache list + } + uncache { .... remove image name from GUI cache list + } + wcstran { .... parse argv for WCS field and update display + } + pixtab { + } + wcslist { + } + wcstype { set type [lindex $argv 1] ;# Set WCS for a line + set line [lindex $argv 2] + send sysWcs$line set label $type + if {$type == "None"} { + send wpWcs$line set on False + } else { + send wpWcs$line set on True + } + setCoordPanelHeight + } + wcsfmt { set fmt [lindex $argv 1] ;# Set fmt for a line + set line [lindex $argv 2] + send fmtWcs$line set label $fmt + } + header { set type [lindex $argv 1] ;# write header text + set text [lindex $argv 2] + switch $type { + imghdr {send hdrText append $text} + wcshdr {send hdrKGText append $text} + wcsinfo {send hdrIGText append $text} + } + } + } ;# end switch +} + +proc wpix_startup args { + global ismEnabled frameCache + + set ismEnabled 1 ;# initialize buttons + send ismToggle set on True + send imageHeader setSensitive True + setCoordPanelSensitivity + + resizeCoordsBox $up_todo ;# resize wcsbox marker + updateCoordsBox + + foreach c [array names frameCache] { ;# initialize local frame cache + if {$c != "0"} { unset frameCache($c) } + } + + catch { ;# update ISM with GUI settings + send wpix set psize $psize + set wcsfmt [string tolower [send wcsFmtMenu get label]] + send wpix set wcsfmt $wcsfmt + if {[send wcsSysAltWCS get on]} { + setAltSystem + } + } +} + +proc wpix_shutdown args { + global ismEnabled + + set ismEnabled 0 + send ismToggle set on False + send imageHeader setSensitive False + setCoordPanelSensitivity + wcsFmtIValue "" + wcsFmtImWCS "" "" "" + wcsFmtAltWCS "" "" "" + resizeCoordsBox 0 +} + + diff --git a/vendor/x11iraf/ximtool/clients/doc/README b/vendor/x11iraf/ximtool/clients/doc/README new file mode 100644 index 00000000..142c9652 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/doc/README @@ -0,0 +1,3 @@ +# +# This directory contains documentation on the ISM client tasks. +# diff --git a/vendor/x11iraf/ximtool/clients/lib/README b/vendor/x11iraf/ximtool/clients/lib/README new file mode 100644 index 00000000..f91f44ce --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/README @@ -0,0 +1,11 @@ +# +# ISM LIBRARY UTILITIES -- This directory contains various utility +# procedures which may be used by one or more ISM client tasks. +o + + dsppmmap.x -- Opens a pixel mask associated with an image BPM keyword + idxstr.x -- Inverse strdic() function + ism.x -- Low-level ISM communications routines + wcsgterm.x -- Compute the output FITS CRPIX, CRVAL, and CD arrays from + the # MWCS LTERM and WTERM + diff --git a/vendor/x11iraf/ximtool/clients/lib/dspmmap.x b/vendor/x11iraf/ximtool/clients/lib/dspmmap.x new file mode 100644 index 00000000..621f0372 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/dspmmap.x @@ -0,0 +1,244 @@ +include <mach.h> +include <ctype.h> +include <error.h> +include <imhdr.h> +include <imset.h> +include <pmset.h> +include <syserr.h> + + +# DS_PMMAP -- Open a pixel mask READ_ONLY. +# +# Open the pixel mask. If a regular image is specified convert it to +# a pixel mask. Match the mask to the reference image based on the +# physical coordinates. A null filename is allowed and returns NULL. + +pointer procedure ds_pmmap (pmname, refim) + +char pmname[ARB] #I Pixel mask name +pointer refim #I Reference image pointer + +pointer im +char fname[SZ_FNAME] +int nowhite(), errcode() +bool streq() +pointer im_pmmap(), ds_pmimmap() +errchk ds_pmimmap, ds_match + +begin + if (nowhite (pmname, fname, SZ_FNAME) == 0) + return (NULL) + if (streq (fname, "EMPTY")) + return (NULL) + if (fname[1] == '!') { + iferr (call imgstr (refim, fname[2], fname, SZ_FNAME)) + fname[1] = EOS + } else if (streq (fname, "BPM")) { + iferr (call imgstr (refim, "BPM", fname, SZ_FNAME)) + return (NULL) + } + + iferr (im = im_pmmap (fname, READ_ONLY, NULL)) { + switch (errcode()) { + case SYS_FOPNNEXFIL, SYS_PLBADSAVEF: + im = ds_pmimmap (fname, refim) + default: + call erract (EA_ERROR) + } + } + + iferr (call ds_match (im, refim)) + call erract (EA_WARN) + + return (im) +end + + +# DS_PMIMMAP -- Open a pixel mask from a non-pixel list image. +# Return error if the image cannot be opened. + +pointer procedure ds_pmimmap (pmname, refim) + +char pmname[ARB] #I Image name +pointer refim #I Reference image pointer + +int i, ndim, npix, val +pointer sp, v1, v2, im_in, im_out, pm, mw, data + +int imgnli() +pointer immap(), pm_newmask(), im_pmmapo(), imgl1i(), mw_openim() +errchk immap, mw_openim + +begin + call smark (sp) + call salloc (v1, IM_MAXDIM, TY_LONG) + call salloc (v2, IM_MAXDIM, TY_LONG) + + call amovkl (long(1), Meml[v1], IM_MAXDIM) + call amovkl (long(1), Meml[v2], IM_MAXDIM) + + im_in = immap (pmname, READ_ONLY, 0) + pm = pm_newmask (im_in, 27) + + ndim = IM_NDIM(im_in) + npix = IM_LEN(im_in,1) + + while (imgnli (im_in, data, Meml[v1]) != EOF) { + do i = 0, npix-1 { + val = Memi[data+i] + if (val < 0) + Memi[data+i] = 0 + } + call pmplpi (pm, Meml[v2], Memi[data], 0, npix, PIX_SRC) + call amovl (Meml[v1], Meml[v2], ndim) + } + + im_out = im_pmmapo (pm, im_in) + data = imgl1i (im_out) # Force I/O to set header + mw = mw_openim (im_in) # Set WCS + call mw_saveim (mw, im_out) + call mw_close (mw) + + call imunmap (im_in) + call sfree (sp) + return (im_out) +end + + +# DS_MATCH -- Set the pixel mask to match the reference image. +# This matches sizes and physical coordinates and allows the +# original mask to be smaller or larger than the reference image. +# Subsequent use of the pixel mask can then work in the logical +# coordinates of the reference image. The mask values are the maximum +# of the mask values which overlap each reference image pixel. +# A null input returns a null output. + +procedure ds_match (im, refim) + +pointer im #U Pixel mask image pointer +pointer refim #I Reference image pointer + +int i, j, k, l, i1, i2, j1, j2, nc, nl, ncpm, nlpm, nx, val +double x1, x2, y1, y2, lt[6], lt1[6], lt2[6] +long vold[IM_MAXDIM], vnew[IM_MAXDIM] +pointer pm, pmnew, imnew, mw, ctx, cty, bufref, bufpm + +int imstati() +pointer pm_open(), mw_openim(), im_pmmapo(), imgl1i(), mw_sctran() +bool pm_empty(), pm_linenotempty() +errchk pm_open, mw_openim + +begin + if (im == NULL) + return + + # Set sizes. + nc = IM_LEN(refim,1) + nl = IM_LEN(refim,2) + ncpm = IM_LEN(im,1) + nlpm = IM_LEN(im,2) + + # If the mask is empty and the sizes are the same then it does not + # matter if the two are actually matched in physical coordinates. + pm = imstati (im, IM_PMDES) + if (pm_empty(pm) && nc == ncpm && nl == nlpm) + return + + # Compute transformation between reference (logical) coordinates + # and mask (physical) coordinates. + + mw = mw_openim (im) + call mw_gltermd (mw, lt, lt[5], 2) + call mw_close (mw) + + mw = mw_openim (refim) + call mw_gltermd (mw, lt2, lt2[5], 2) + call mw_close (mw) + + # Combine lterms. + call mw_invertd (lt, lt1, 2) + call mw_mmuld (lt1, lt2, lt, 2) + call mw_vmuld (lt, lt[5], lt[5], 2) + lt[5] = lt2[5] - lt[5] + lt[6] = lt2[6] - lt[6] + do i = 1, 6 + lt[i] = nint (1D6 * (lt[i]-int(lt[i]))) / 1D6 + int(lt[i]) + + # Check for a rotation. For now don't allow any rotation. + if (lt[2] != 0. || lt[3] != 0.) + call error (1, "Image and mask have a relative rotation") + + # Check for an exact match. + if (lt[1] == 1D0 && lt[4] == 1D0 && lt[5] == 0D0 && lt[6] == 0D0) + return + + # Set reference to mask coordinates. + mw = mw_openim (im) + call mw_sltermd (mw, lt, lt[5], 2) + ctx = mw_sctran (mw, "logical", "physical", 1) + cty = mw_sctran (mw, "logical", "physical", 2) + + # Create a new pixel mask of the required size and offset. + # Do dummy image I/O to set the header. + pmnew = pm_open (NULL) + call pm_ssize (pmnew, 2, IM_LEN(refim,1), 27) + imnew = im_pmmapo (pmnew, NULL) + bufref = imgl1i (imnew) + + # Compute region of mask overlapping the reference image. + call mw_ctrand (ctx, 1-0.5D0, x1, 1) + call mw_ctrand (ctx, nc+0.5D0, x2, 1) + i1 = max (1, nint(min(x1,x2)+1D-5)) + i2 = min (ncpm, nint(max(x1,x2)-1D-5)) + call mw_ctrand (cty, 1-0.5D0, y1, 1) + call mw_ctrand (cty, nl+0.5D0, y2, 1) + j1 = max (1, nint(min(y1,y2)+1D-5)) + j2 = min (nlpm, nint(max(y1,y2)-1D-5)) + + # Set the new mask values to the maximum of all mask values falling + # within each reference pixel in the overlap region. + if (i1 <= i2 && j1 <= j2) { + nx = i2 - i1 + 1 + call malloc (bufpm, nx, TY_INT) + call malloc (bufref, nc, TY_INT) + vold[1] = i1 + vnew[1] = 1 + do j = 1, nl { + call mw_ctrand (cty, j-0.5D0, y1, 1) + call mw_ctrand (cty, j+0.5D0, y2, 1) + j1 = max (1, nint(min(y1,y2)+1D-5)) + j2 = min (nlpm, nint(max(y1,y2)-1D-5)) + if (j2 < j1) + next + + vnew[2] = j + call aclri (Memi[bufref], nc) + do l = j1, j2 { + vold[2] = l + if (!pm_linenotempty (pm, vold)) + next + call pmglpi (pm, vold, Memi[bufpm], 0, nx, 0) + do i = 1, nc { + call mw_ctrand (ctx, i-0.5D0, x1, 1) + call mw_ctrand (ctx, i+0.5D0, x2, 1) + i1 = max (1, nint(min(x1,x2)+1D-5)) + i2 = min (ncpm, nint(max(x1,x2)-1D-5)) + if (i2 < i1) + next + val = Memi[bufref+i-1] + do k = i1-vold[1], i2-vold[1] + val = max (val, Memi[bufpm+k]) + Memi[bufref+i-1] = val + } + } + call pmplpi (pmnew, vnew, Memi[bufref], 0, nc, PIX_SRC) + } + call mfree (bufref, TY_INT) + call mfree (bufpm, TY_INT) + } + + call mw_close (mw) + call imunmap (im) + im = imnew + call imseti (im, IM_PMDES, pmnew) +end diff --git a/vendor/x11iraf/ximtool/clients/lib/idxstr.x b/vendor/x11iraf/ximtool/clients/lib/idxstr.x new file mode 100644 index 00000000..7b055658 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/idxstr.x @@ -0,0 +1,54 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + + +# IDXSTR -- Search a dictionary string for a given string index number. +# This is the opposite function of strdic(), that returns the index for +# given string. The entries in the dictionary string are separated by +# a delimiter character which is the first character of the dictionary +# string. The index of the string found is returned as the function value. +# Otherwise, if there is no string for that index, a zero is returned. + +int procedure idxstr (index, outstr, maxch, dict) + +int index #i String index +char outstr[ARB] #o Output string as found in dictionary +int maxch #i Maximum length of output string +char dict[ARB] #i Dictionary string + +int i, len, start, count + +int strlen() + +begin + # Clear the output string. + outstr[1] = EOS + + # Return if the dictionary is not long enough. + if (dict[1] == EOS) + return (0) + + # Initialize the counters. + count = 1 + len = strlen (dict) + + # Search the dictionary string. This loop only terminates + # successfully if the index is found. Otherwise the procedure + # returns with and error condition. + for (start = 2; count < index; start = start + 1) { + if (dict[start] == dict[1]) + count = count + 1 + if (start == len) + return (0) + } + + # Extract the output string from the dictionary. + for (i = start; dict[i] != EOS && dict[i] != dict[1]; i = i + 1) { + if (i - start + 1 > maxch) + break + outstr[i - start + 1] = dict[i] + } + outstr[i - start + 1] = EOS + + # Return index for output string. + return (count) +end diff --git a/vendor/x11iraf/ximtool/clients/lib/ism.x b/vendor/x11iraf/ximtool/clients/lib/ism.x new file mode 100644 index 00000000..1d7310cc --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/ism.x @@ -0,0 +1,432 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <config.h> +include <mach.h> +include <xwhen.h> + + +# ISM.X -- Interface routines for client programs to connect to the +# XImtool ISM port on the local socket +# +# status = ism_connect (device, name, mode) +# ism_disconnect (send_quit) +# ism_message (object, message) +# ism_alert (text, ok_action, cancel_action) +# +# ism_write (message, len) +# nread = ism_read (message, len) +# +# Client programs should install an exception handler to first disconnect +# from the device before shutting down. The procedure ism_zxwhen() is +# provided for this purpose. + + +define ISM_DBG FALSE + +define SZ_MESSAGE 2047 + +define ISM_TEXT 1 +define ISM_BINARY 2 + + +# ISM_CONNECT -- Negotiate a connection on the named device. Once +# established we can begin sending and reading messages from the server. + +int procedure ism_connect (device, name, type) + +char device[ARB] #I socket to connect on +char name[ARB] #I module name +char type[ARB] #I requested connection mode + +pointer sp, cmsg, dev, buf +int msglen +char connect[SZ_FNAME] + +int ndopen(), reopen(), strlen() +int ism_read() +bool streq() + +extern ism_onerror() + +include "ismfd.com" # I/O common +include "ismcom.com" # Interrupt handler variables + +# Exception handler variables common. +int ism_errstat +data ism_errstat /OK/ +common /ismecom/ ism_errstat + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call salloc (cmsg, SZ_LINE, TY_CHAR) + call salloc (dev, SZ_FNAME, TY_CHAR) + + # Initialize. + call aclrc (Memc[buf], SZ_LINE) + call aclrc (Memc[cmsg], SZ_LINE) + call aclrc (Memc[dev], SZ_FNAME) + call aclrc (buffer, 2*SZ_MESSAGE+1) + fdin = NULL + fdout = NULL + nbuf = 0 + bp = 0 + ep = 0 + + # Generate the device name. We assume the call was made with either + # a "unix:" or "inet:" prefix, so just append the type and set the + # mode. + + call sprintf (Memc[dev], SZ_FNAME, "%s:%s") + call pargstr (device) + call pargstr (type) + if (streq (type, "text")) + mode = ISM_TEXT + else + mode = ISM_BINARY + + # Open the initial connection + iferr (fdin = ndopen (Memc[dev], READ_WRITE)) { + call sfree (sp) + return (ERR) + } + fdout = reopen (fdin, READ_WRITE) + + # Send the connect request. + call sprintf (Memc[cmsg], SZ_LINE, "connect %s\0") + call pargstr (name) + msglen = strlen (Memc[cmsg]) + call ism_message ("ximtool", Memc[cmsg]) + + # Read the acknowledgement. + if (ism_read (Memc[buf], msglen) == EOF) { + call sfree (sp) + return (ERR) + } + + # Close the original socket. + call close (fdout) + call close (fdin) + + # Get the new device name. + call sprintf (connect, SZ_LINE, "unix:%s:%s\0") + call pargstr (Memc[buf+8]) + call pargstr (type) + + # Open the new channel. + iferr (fdin = ndopen (connect, READ_WRITE)) { + call sfree (sp) + return (ERR) + } + fdout = reopen (fdin, READ_WRITE) + + if (ISM_DBG) { + call eprintf ("Reconnected on '%s'\n"); call pargstr (connect) + } + + # Tell the server we're ready to begin. + call sprintf (Memc[cmsg], SZ_LINE, "ready %s\0") + call pargstr (name) + msglen = strlen (Memc[cmsg]) + call ism_message ("ximtool", Memc[cmsg]) + + + # Post the ism_onerror procedure to be executed upon process shutdown + # to issue a warning to the server in case we don't close normally. + + call onerror (ism_onerror) + + call sfree (sp) + return (OK) +end + + +# ISM_DISCONNECT -- Disconnect from the currect channel. + +procedure ism_disconnect (send_quit) + +int send_quit + +include "ismfd.com" # I/O common + +begin + # Send a QUIT message to the server so we shut down the connection. + if (send_quit == YES) + call ism_message ("ximtool", "quit") + + call close (fdin) # Close the socket connection. + call close (fdout) + fdin = NULL + fdout = NULL +end + + +# ISM_MESSAGE -- Send a message to an XImtool named object. If the object +# is 'ximtool' then just pass the message directly without formatting it. + +procedure ism_message (object, message) + +char object[ARB] #I object name +char message[ARB] #I message to send + +pointer sp, msgbuf +int msglen, olen, mlen, ip + +int strlen() +bool streq() + +begin + # Get the message length plus some extra for the braces and padding. + olen = strlen (object) + mlen = strlen (message) + msglen = olen + mlen + 20 + + # Allocate and clear the message buffer. + call smark (sp) + call salloc (msgbuf, msglen, TY_CHAR) + call aclrc (Memc[msgbuf], msglen) + + if (streq (object, "ximtool")) { + # Just send the message. + call strcpy (message, Memc[msgbuf], msglen) + } else { + # Format the message. We can't use a sprintf here since the + # message may be bigger than that allowed by a pargstr(). + ip = 0 + call amovc ("send ", Memc[msgbuf+ip], 5) ; ip = ip + 5 + call amovc (object, Memc[msgbuf+ip], olen) ; ip = ip + olen + call amovc (" { ", Memc[msgbuf+ip], 3) ; ip = ip + 3 + call amovc (message, Memc[msgbuf+ip], mlen) ; ip = ip + mlen + call amovc (" }\0", Memc[msgbuf+ip], 2) ; ip = ip + 3 + } + msglen = strlen (Memc[msgbuf]) + + # Now send the message. The write routine does the strpak(). + call ism_write (Memc[msgbuf], msglen) + + call sfree (sp) +end + + +# ISM_ALERT -- Send an alert message to XImtool. + +procedure ism_alert (text, ok, cancel) + +char text[ARB] #I warning text +char ok[ARB] #i client OK message +char cancel[ARB] #i client CANCEL message + +pointer sp, msg + +begin + call smark (sp) + call salloc (msg, SZ_LINE, TY_CHAR) + + call sprintf (Memc[msg], SZ_LINE, "{%s} {%s} {%s}") + call pargstr (text) + call pargstr (ok) + call pargstr (cancel) + + call ism_message ("alert", Memc[msg]) + + call sfree (sp) +end + + +# ISM_WRITE -- Low-level write of a message to the socket. Writes exactly +# len bytes to the stream. + +procedure ism_write (message, len) + +char message[ARB] #I message to send +int len #I length of message + +int nleft, n, ip +char msgbuf[SZ_MESSAGE] +int strlen() + +include "ismfd.com" # I/O common + +errchk write, flush + +begin + # Pad message with a NULL to terminate it. + len = strlen (message) + 1 + message[len] = '\0' + + if (mod(len,2) == 1) { + len = len + 1 + message[len] = '\0' + } + + ip = 1 + nleft = len + while (nleft > 0) { + n = min (nleft, SZ_MESSAGE) + call amovc (message[ip], msgbuf, n) + if (mode == ISM_BINARY) { + call achtcb (msgbuf, msgbuf, n) + call write (fdout, msgbuf, n / SZB_CHAR) + } else + call write (fdout, msgbuf, n) + + ip = ip + n + nleft = nleft - n + } + call flush (fdout) + + if (ISM_DBG) { + call eprintf ("ism_write: '%.45s' len=%d mode=%d\n") + call pargstr (message);call pargi (len); call pargi (mode) + } +end + + +# ISM_READ -- Low-level read from the socket. + +int procedure ism_read (message, len) + +char message[ARB] #O message read +int len #O length of message + +int i, n, nleft, read() + +include "ismfd.com" # I/O common +include "ismcom.com" # Interrupt handler variables + +errchk read + +begin + # No data left in the buffer so read from the socket + if (nbuf == 0) { + call aclrc (buffer, SZ_MESSAGE) + #call amovkc (EOF, buffer, SZ_MESSAGE) + nbuf = 0 + + iferr { + n = read (fdin, message, SZ_MESSAGE) + if (n < 0) + return (EOF) + } then { + if (n < 0) + return (EOF) + call xer_reset() + call zdojmp (ism_jmp, X_IPC) + } + + if (mode == ISM_BINARY) { + len = n * SZB_CHAR + call achtbc (message, message, len) + } else + len = n + + # Save the data read to a local buffer. Remove any extra + # EOS padding and append an EOF on the string. + call amovc (message, buffer, len) + if (buffer[len] == EOS && buffer[len-1] == EOS) + nbuf = len + else + nbuf = len + 1 + buffer[nbuf] = EOF + } + + for (i=1; buffer[i] != EOS && buffer[i] != EOF && i <= nbuf; i=i+1) + message[i] = buffer[i] + message[i] = '\0' + len = i # length of the current message + nleft = nbuf - i # nchars left in the buffer + + if (buffer[i] == EOS && buffer[i+1] == EOF) { + # That was the last message, force a new read next time we're + # called. + if (i > 1 && nleft > 1) + call amovc (buffer[i+1], buffer, nleft) + nbuf = 0 + } else { + # More of the message is left in the buffer. + if (nleft > 0) + call amovc (buffer[i+1], buffer, nleft) + nbuf = nleft + } + + if (ISM_DBG) { + message[len] = '\0'; + call eprintf ("ism_read: len=%d msg='%s'\n") + call pargi (len); call pargstr(message) + call eprintf ("ism_read: nbuf=%d nleft=%d buffer='%s'\n") + call pargi (nbuf); call pargi(nleft); call pargstr(buffer) + } + + return (nleft) +end + + +# ISM_INTRHANDLER -- User-callable interrupt handler so the ISM client code +# doesn't need to know about our internals. + +int procedure ism_intrhandler() + +extern ism_zxwhen() + +include "ismcom.com" # Interrupt handler variables + +begin + call zlocpr (ism_zxwhen, ismepa) + call xwhen (X_INT, ismepa, old_onint) + call zsvjmp (ism_jmp, ismstat) + + if (ismstat == OK) + return (OK) + else + return (ERR) +end + + +# ISM_ZXWHEN -- Interrupt handler for the ISM client task. Branches back +# to ZSVJMP in the user routine to permit shutdown without an error message +# after first disconnecting from the socket. + +procedure ism_zxwhen (vex, next_handler) + +int vex # virtual exception +int next_handler # not used + +include "ismcom.com" # Interrupt handler variables + +begin + call ism_disconnect (YES) + call xer_reset() + call zdojmp (ism_jmp, vex) +end + + +# ISM_ONERROR -- Error exit handler for the interface. If this is a normal exit +# the shut down quietly, otherwise notify the server. + +procedure ism_onerror (status) + +int status #i not used (req. for ONEXIT) + +# Exception handler variables common. +int ism_errstat +common /ismecom/ ism_errstat + +int code +char buf[SZ_LINE], errmsg[SZ_LINE] + +int errget() + +include "ismcom.com" # Interrupt handler variables + +begin + if (status != OK) { + code = errget (errmsg, SZ_LINE) + call sprintf (buf, SZ_LINE, "ISM Error, code %d:\n`%s\'") + call pargi (status) + call pargstr (errmsg) + + call ism_alert (buf, "", "") + call ism_disconnect (YES) + } +end diff --git a/vendor/x11iraf/ximtool/clients/lib/ismcom.com b/vendor/x11iraf/ximtool/clients/lib/ismcom.com new file mode 100644 index 00000000..fd2c2939 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/ismcom.com @@ -0,0 +1,4 @@ +# ISM interrupt handler variables common. +int ismepa, ismstat, old_onint, ism_fd, ism_jmp[LEN_JUMPBUF] +common /ismcom/ ism_fd, ism_jmp, ismepa, ismstat, old_onint + diff --git a/vendor/x11iraf/ximtool/clients/lib/ismfd.com b/vendor/x11iraf/ximtool/clients/lib/ismfd.com new file mode 100644 index 00000000..ebb94d9a --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/ismfd.com @@ -0,0 +1,11 @@ +# ISM I/O common. +int fdin # input descriptor +int fdout # output descriptor +int mode # file mode +int nbuf # no. chars in buffer +int bp # begin buffer ptr +int ep # end buffer ptr +char buffer[2*SZ_MESSAGE+1] # text buffer + +common /ismfd/ fdin, fdout, mode, nbuf, buffer, bp, ep + diff --git a/vendor/x11iraf/ximtool/clients/lib/mkpkg b/vendor/x11iraf/ximtool/clients/lib/mkpkg new file mode 100644 index 00000000..896134d4 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/mkpkg @@ -0,0 +1,15 @@ +# Make the ISM Client utility procedures. + +$checkout libpkg.a ../ +$update libpkg.a +$checkin libpkg.a ../ +$exit + +libpkg.a: +# dspmmap.x <ctype.h> <error.h> <imhdr.h> <imset.h> \ +# <mach.h> <pmset.h> + idxstr.x + ism.x ismfd.com ismcom.com <config.h> <mach.h> <xwhen.h> + wcsgfterm.x + ; + diff --git a/vendor/x11iraf/ximtool/clients/lib/wcsgfterm.x b/vendor/x11iraf/ximtool/clients/lib/wcsgfterm.x new file mode 100644 index 00000000..ea026f89 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/wcsgfterm.x @@ -0,0 +1,61 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + + +# WCS_GFTERM -- Compute the output FITS CRPIX, CRVAL, and CD arrays from the +# MWCS LTERM and WTERM. Note that the CD matrix terms are still transposed +# from the usual Fortran order. + +procedure wcs_gfterm (mw, crpix, crval, cd, ndim) + +pointer mw #i the input mwcs pointer +double crpix[ndim] #o the output FITS CRPIX array +double crval[ndim] #o the output FITS CRVAL array +double cd[ndim,ndim] #o the output FITS CD matrix +int ndim #i the dimensionality of the wcs + +pointer sp, r, wcd, ltv, ltm, iltm +pointer alert, errmsg +int i, errcode + +int errget() + +errchk mw_gwtermd, mw_gltermd + +begin + call smark (sp) + call salloc (r, ndim, TY_DOUBLE) + call salloc (wcd, ndim * ndim, TY_DOUBLE) + call salloc (ltv, ndim, TY_DOUBLE) + call salloc (ltm, ndim * ndim, TY_DOUBLE) + call salloc (iltm, ndim * ndim, TY_DOUBLE) + + iferr { + call mw_gwtermd (mw, Memd[r], crval, Memd[wcd], ndim) + call mw_gltermd (mw, Memd[ltm], Memd[ltv], ndim) + call mwvmuld (Memd[ltm], Memd[r], crpix, ndim) + call aaddd (crpix, Memd[ltv], crpix, ndim) + call mwinvertd (Memd[ltm], Memd[iltm], ndim) + call mwmmuld (Memd[wcd], Memd[iltm], cd, ndim) + + } then { + call salloc (alert, SZ_LINE, TY_CHAR) + call salloc (errmsg, SZ_LINE, TY_CHAR) + + # Set up a default value. + call aclrd (cd, ndim*ndim) + for (i=1; i <= ndim; i=i+1) { + crpix[i] = 1.0d0 + crval[i] = 1.0d0 + cd[i,i] = 1.0d0 + } + + # Send alert to the GUI. + errcode = errget (Memc[errmsg], SZ_LINE) + call sprintf (Memc[alert], SZ_FNAME, "%s\n\"%s\"") + call pargstr ("Error decoding image WCS:") + call pargstr (Memc[errmsg]) + call ism_alert (Memc[alert], "", "") + } + + call sfree (sp) +end diff --git a/vendor/x11iraf/ximtool/clients/lib/ximtool.x b/vendor/x11iraf/ximtool/clients/lib/ximtool.x new file mode 100644 index 00000000..108b325e --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/lib/ximtool.x @@ -0,0 +1,531 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <error.h> +include <config.h> +include <mach.h> +include <xwhen.h> + + +# XIMTOOL.X -- Interface routines for client programs to connect to +# XImtool on the message bus. +# +# status = xim_connect (device, name, mode) +# xim_disconnect (send_quit) +# xim_message (object, message) +# xim_alert (text, ok_action, cancel_action) +# +# xim_write (message, len) +# nread = xim_read (message, len) +# +# Client programs should install an exception handler to first disconnect +# from the device before shutting down. The procedure xim_zxwhen() is +# provided for this purpose. + + +define XIM_DBG FALSE + +define SZ_MESSAGE 2047 + +define XIM_TEXT 1 +define XIM_BINARY 2 + + +# XIM_CONNECT -- Negotiate a connection on the named device. Once +# established we can begin sending and reading messages from the server. + +int procedure xim_connect (device, name, type) + +char device[ARB] #I socket to connect on +char name[ARB] #I module name +char type[ARB] #I requested connection mode + +pointer sp, cmsg, dev, buf +int msglen +char connect[SZ_FNAME] + +int ndopen(), reopen(), strlen() +int xim_read() +bool streq() + +extern xim_onerror() + +# I/O common. +int fdin, fdout, mode, nbuf, nsave, nr, nw +char buffer[SZ_MESSAGE], bufsave[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nsave, bufsave, nr, nw + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +# Exception handler variables common. +int xim_errstat +data xim_errstat /OK/ +common /ximecom/ xim_errstat + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call salloc (cmsg, SZ_LINE, TY_CHAR) + call salloc (dev, SZ_FNAME, TY_CHAR) + + # Initialize. + call aclrc (Memc[buf], SZ_LINE) + call aclrc (Memc[cmsg], SZ_LINE) + call aclrc (Memc[dev], SZ_FNAME) + call aclrc (buffer, SZ_MESSAGE) + fdin = NULL + fdout = NULL + nbuf = 0 + nsave = 0 + nr = 0 + nw = 0 + + # Generate the device name. We assume the call was made with either + # a "unix:" or "inet:" prefix, so just append the type and set the + # mode. + + call sprintf (Memc[dev], SZ_FNAME, "%s:%s") + call pargstr (device) + call pargstr (type) + if (streq (type, "text")) + mode = XIM_TEXT + else + mode = XIM_BINARY + + # Open the initial connection + iferr (fdin = ndopen (Memc[dev], READ_WRITE)) { + call sfree (sp) + return (ERR) + } + fdout = reopen (fdin, READ_WRITE) + + # Send the connect request. + call sprintf (Memc[cmsg], SZ_LINE, "connect %s\0") + call pargstr (name) + msglen = strlen (Memc[cmsg]) + call xim_message ("ximtool", Memc[cmsg]) + + # Read the acknowledgement. + if (xim_read (Memc[buf], msglen) == EOF) { + call sfree (sp) + return (ERR) + } + + # Close the original socket. + call close (fdout) + call close (fdin) + + # Get the new device name. + call sprintf (connect, SZ_LINE, "unix:%s:%s\0") + call pargstr (Memc[buf+8]) + call pargstr (type) + + # Open the new channel. + iferr (fdin = ndopen (connect, READ_WRITE)) { + call sfree (sp) + return (ERR) + } + fdout = reopen (fdin, READ_WRITE) + + if (XIM_DBG) { + call eprintf ("Reconnected on '%s'\n"); call pargstr (connect) + } + + # Tell the server we're ready to begin. + call sprintf (Memc[cmsg], SZ_LINE, "ready %s\0") + call pargstr (name) + msglen = strlen (Memc[cmsg]) + call xim_message ("ximtool", Memc[cmsg]) + + + # Post the xim_onerror procedure to be executed upon process shutdown + # to issue a warning to the server in case we don't close normally. + + call onerror (xim_onerror) + + call sfree (sp) + return (OK) +end + + +# XIM_DISCONNECT -- Disconnect from the currect channel. + +procedure xim_disconnect (send_quit) + +int send_quit + +# I/O common. +int fdin, fdout, mode, nbuf, nsave, nr, nw +char buffer[SZ_MESSAGE], bufsave[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nsave, bufsave, nr, nw + +begin + # Send a QUIT message to the server so we shut down the connection. + if (send_quit == YES) + call xim_message ("ximtool", "quit") + + call flush (fdout) # Close the socket connection. + call close (fdin) + call close (fdout) + fdin = NULL + fdout = NULL +end + + +# XIM_MESSAGE -- Send a message to an XImtool named object. If the object +# is 'ximtool' then just pass the message directly without formatting it. + +procedure xim_message (object, message) + +char object[ARB] #I object name +char message[ARB] #I message to send + +pointer sp, msgbuf +int msglen, olen, mlen, ip + +int strlen() +bool streq() + +begin + # Get the message length plus some extra for the braces and padding. + olen = strlen (object) + mlen = strlen (message) + msglen = olen + mlen + 20 + + # Allocate and clear the message buffer. + call smark (sp) + call salloc (msgbuf, msglen, TY_CHAR) + call aclrc (Memc[msgbuf], msglen) + + if (streq (object, "ximtool")) { + # Just send the message. + call strcpy (message, Memc[msgbuf], msglen) + } else { + # Format the message. We can't use a sprintf here since the + # message may be bigger than that allowed by a pargstr(). + ip = 0 + call amovc ("send ", Memc[msgbuf+ip], 5) ; ip = ip + 5 + call amovc (object, Memc[msgbuf+ip], olen) ; ip = ip + olen + call amovc (" { ", Memc[msgbuf+ip], 3) ; ip = ip + 3 + call amovc (message, Memc[msgbuf+ip], mlen) ; ip = ip + mlen + call amovc (" }\0", Memc[msgbuf+ip], 2) ; ip = ip + 3 + } + msglen = strlen (Memc[msgbuf]) + + # Now send the message. The write routine does the strpak(). + call xim_write (Memc[msgbuf], msglen) + + call sfree (sp) +end + + +# XIM_ALERT -- Send an alert message to XImtool. + +procedure xim_alert (text, ok, cancel) + +char text[ARB] #I warning text +char ok[ARB] #i client OK message +char cancel[ARB] #i client CANCEL message + +pointer sp, msg + +begin + call smark (sp) + call salloc (msg, SZ_LINE, TY_CHAR) + + call sprintf (Memc[msg], SZ_LINE, "{%s} {%s} {%s}") + call pargstr (text) + call pargstr (ok) + call pargstr (cancel) + + call xim_message ("alert", Memc[msg]) + + call sfree (sp) +end + + +# XIM_WRITE -- Low-level write of a message to the socket. Writes exactly +# len bytes to the stream. + +procedure xim_write (message, len) + +char message[ARB] #I message to send +int len #I length of message + +int nleft, n, ip +char msgbuf[SZ_MESSAGE] +int strlen() + +# I/O common. +int fdin, fdout, mode, nbuf, nsave, nr, nw +char buffer[SZ_MESSAGE], bufsave[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nsave, bufsave, nr, nw + +errchk write, flush + +begin + # Pad message with a NULL to terminate it. + len = strlen (message) + 1 + message[len] = '\0' + + if (mod(len,2) == 1) { + len = len + 1 + message[len] = '\0' + } + + ip = 1 + nleft = len + while (nleft > 0) { + n = min (nleft, SZ_MESSAGE) + call amovc (message[ip], msgbuf, n) + if (mode == XIM_BINARY) { + call achtcb (msgbuf, msgbuf, n) + call write (fdout, msgbuf, n / SZB_CHAR) + } else + call write (fdout, msgbuf, n) + + ip = ip + n + nleft = nleft - n + } + nw = nw + len + call flush (fdout) + + if (XIM_DBG) { + call eprintf ("xim_write: '%.45s' len=%d mode=%d tot=%d\n") + call pargstr (message);call pargi (len) + call pargi (mode); call pargi (nw) + } +end + + +# XIM_READ -- Low-level read from the socket. + +int procedure xim_read2 (message, len) + +char message[ARB] #O message read +int len #O length of message + +int i, n, nleft, read() + +# I/O common. +int fdin, fdout, mode, nbuf, nsave, nr, nw +char buffer[SZ_MESSAGE], bufsave[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nsave, bufsave, nr, nw + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +errchk read + +begin + if (nbuf == 0) { + clear the message buffer + n = read (fdin, message, SZ_MESSAGE) + if (n < 0) + return (EOF) + + if (mode == XIM_BINARY) + msglen = N * SZ_CHAR + unpack binary data + } else + msglen = N + + if (message[msglen] != EOS) + # Incomplete message so save the partial to a local buffer. + for (i=msglen; message[i] != EOS && i > 0; i=i-1) { + ; + nsave = msglen - i + 1 + call strcpy (message[i+1], bufsave) # save partial + call aclrc (message[i+1], nsave) # clear partial + nbuf = i + } else { + # Complete message. + nbuf = msglen + nsave = 0 + call aclrc (bufsave, SZ_MESSAGE) + } + } + + # Pull out a null-terminated message from the buffer. + for (i=1; buffer[i] != EOS && buffer[i] != EOF && i <= nbuf; i=i+1) + message[i] = buffer[i] + message[i] = '\0' + len = i # length of the current message + nleft = nbuf - i # nchars left in the buffer + nr = nr + len + + if (buffer[i] == EOS && buffer[i+1] == EOF) { + # That was the last message, force a new read next time we're + # called. + if (i > 1 && nleft > 1) + call amovc (buffer[i+1], buffer, nleft) + nbuf = 0 + } else { + # More of the message is left in the buffer. + if (nleft > 0) + call amovc (buffer[i+1], buffer, nleft) + nbuf = nleft + } +end + + +# XIM_READ -- Low-level read from the socket. + +int procedure xim_read (message, len) + +char message[ARB] #O message read +int len #O length of message + +int i, n, nleft, read() + +# I/O common. +int fdin, fdout, mode, nbuf, nsave, nr, nw +char buffer[SZ_MESSAGE], bufsave[SZ_MESSAGE] +common /ximfd/ fdin, fdout, mode, nbuf, buffer, nsave, bufsave, nr, nw + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +errchk read + +begin + # No data left in the buffer so read from the socket + if (nbuf == 0) { + call aclrc (buffer, SZ_MESSAGE) + #call amovkc (EOF, buffer, SZ_MESSAGE) + nbuf = 0 + + iferr { + n = read (fdin, message, SZ_MESSAGE) + if (n < 0) + return (EOF) + } then { + call xer_reset() + call zdojmp (xim_jmp, X_IPC) + } + + if (mode == XIM_BINARY) { + len = n * SZB_CHAR + call achtbc (message, message, len) + } else + len = n + + # Save the data read to a local buffer. Remove any extra + # EOS padding and append an EOF on the string. + call amovc (message, buffer, len) + if (buffer[len] == EOS && buffer[len-1] == EOS) + nbuf = len + else + nbuf = len + 1 + buffer[nbuf] = EOF + } + + for (i=1; buffer[i] != EOS && buffer[i] != EOF && i <= nbuf; i=i+1) + message[i] = buffer[i] + message[i] = '\0' + len = i # length of the current message + nleft = nbuf - i # nchars left in the buffer + nr = nr + len + + if (buffer[i] == EOS && buffer[i+1] == EOF) { + # That was the last message, force a new read next time we're + # called. + if (i > 1 && nleft > 1) + call amovc (buffer[i+1], buffer, nleft) + nbuf = 0 + } else { + # More of the message is left in the buffer. + if (nleft > 0) + call amovc (buffer[i+1], buffer, nleft) + nbuf = nleft + } + + if (XIM_DBG) { + call eprintf ("xim_read: tot=%d len=%d msg='%s'\n") + call pargi(nr); call pargi (len); + call pargstr(message) + call eprintf ("xim_read: nbuf=%d nleft=%d buffer='%s'\n") + call pargi (nbuf); call pargi(nleft); call pargstr(buffer) + } + + return (len) +end + + +# XIM_INTRHANDLER -- User-callable interrupt handler so the ISM client code +# doesn't need to know about our internals. + +int procedure xim_intrhandler() + +extern xim_zxwhen() + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +begin + call zlocpr (xim_zxwhen, ximepa) + call xwhen (X_INT, ximepa, old_onint) + call zsvjmp (xim_jmp, ximstat) + + if (ximstat == OK) + return (OK) + else + return (ERR) +end + + +# XIM_ZXWHEN -- Interrupt handler for the Ximtool client task. Branches back +# to ZSVJMP in the user routine to permit shutdown without an error message +# after first disconnecting from the socket. + +procedure xim_zxwhen (vex, next_handler) + +int vex # virtual exception +int next_handler # not used + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +begin + call xim_disconnect (YES) + call xer_reset() + call zdojmp (xim_jmp, vex) +end + + +# XIM_ONERROR -- Error exit handler for the interface. If this is a normal exit +# the shut down quietly, otherwise notify the server. + +procedure xim_onerror (status) + +int status #i not used (req. for ONEXIT) + +# Exception handler variables common. +int xim_errstat +common /ximecom/ xim_errstat + +int code +char buf[SZ_LINE], errmsg[SZ_LINE] + +int errget() + +# Interrupt handler variables common. +int ximepa, ximstat, old_onint, xim_fd, xim_jmp[LEN_JUMPBUF] +common /ximcom/ xim_fd, xim_jmp, ximepa, ximstat, old_onint + +begin + if (status != OK) { + code = errget (errmsg, SZ_LINE) + call sprintf (buf, SZ_LINE, "ISM Error, code %d:\n`%s\'") + call pargi (status) + call pargstr (errmsg) + + call xim_alert (buf, NULL, NULL) + call xim_disconnect (YES) + } +end diff --git a/vendor/x11iraf/ximtool/clients/mkpkg b/vendor/x11iraf/ximtool/clients/mkpkg new file mode 100644 index 00000000..52fdef97 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/mkpkg @@ -0,0 +1,34 @@ +# Make the ISM Client tasks. + +$call relink +$exit + +update: + $call relink + $call install + ; + +relink: + $set LIBS = "-lds -lxtools -liminterp -lslalib" + $update libpkg.a + $omake x_ism.x + $link -z x_ism.o libpkg.a -o ism_wcspix.e $(LIBS) + ; + +debug: + $set LIBS = "-lds -lxtools -lslalib" + $set XFLAGS = "$(XFLAGS) -xqF" + $update libpkg.a + $omake x_ism.x + $link -z -x x_ism.o libpkg.a -o ism_wcspix.e $(LIBS) + ; + +install: + $move ism_wcspix.e ../../bin/ism_wcspix.e + ; + + +libpkg.a: + @lib + @wcspix + ; diff --git a/vendor/x11iraf/ximtool/clients/wcspix/README b/vendor/x11iraf/ximtool/clients/wcspix/README new file mode 100644 index 00000000..e69de29b diff --git a/vendor/x11iraf/ximtool/clients/wcspix/class.com b/vendor/x11iraf/ximtool/clients/wcspix/class.com new file mode 100644 index 00000000..c6116c11 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/class.com @@ -0,0 +1,6 @@ +# Class common. +int cl_nclass # number of defined functions +int cl_table[LEN_CLASS,MAX_CLASSES] # class table +char cl_names[SZ_CLNAME,MAX_CLASSES] # class names +common /class_com/ cl_nclass, cl_table, cl_names + diff --git a/vendor/x11iraf/ximtool/clients/wcspix/mkpkg b/vendor/x11iraf/ximtool/clients/wcspix/mkpkg new file mode 100644 index 00000000..80b80f48 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/mkpkg @@ -0,0 +1,16 @@ +# Make the WCSPIX ISM Client task. + +$checkout libpkg.a ../ +$update libpkg.a +$checkin libpkg.a ../ +$exit + +libpkg.a: + t_wcspix.x wcspix.h class.com <ctype.h> <time.h> + wcimage.x wcspix.h <ctype.h> <imhdr.h> <imio.h> <math.h> \ + <time.h> <mwset.h> <pkg/skywcs.h> wcspix.h + wcmef.x wcspix.h + wcmspec.x wcspix.h + wcunknown.x wcspix.h <ctype.h> + ; + diff --git a/vendor/x11iraf/ximtool/clients/wcspix/t_wcspix.x b/vendor/x11iraf/ximtool/clients/wcspix/t_wcspix.x new file mode 100644 index 00000000..b0170f5b --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/t_wcspix.x @@ -0,0 +1,792 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> +include <time.h> +include "wcspix.h" + + +# T_WCSPIX -- Entry point for the WCSPIX Image Support Module for XImtool. +# The WCSPIX task is responsible for converting image coordinates and getting +# pixel values from images of various types. Results are returned to the +# GUI directly using ISM messaging. + +procedure t_wcspix () + +pointer wp +real x, y +int len, disconnect, ncmd, objid, regid +char socket[SZ_FNAME], cmd[SZ_FNAME], message[SZ_LINE], buf[SZ_DATE] +char ref[SZ_FNAME], template[SZ_LINE], param[SZ_FNAME] +bool debug + +long clktime() +pointer wp_init() +int envgets(), envgeti(), strdic() + +# Standard declarations for the Ximtool WCSPIX client interface. +int ism_connect(), wp_read(), ism_intrhandler() +errchk wp_read, envgets, envgeti + +begin + # Initialize local storage. + call aclrc (buf, SZ_DATE) + call aclrc (cmd, SZ_FNAME) + call aclrc (ref, SZ_FNAME) + call aclrc (param, SZ_FNAME) + call aclrc (socket, SZ_FNAME) + call aclrc (message, SZ_LINE) + call aclrc (template, SZ_LINE) + + # Get the connection socket name from the environment if defined + # or else use the default socket. + if (envgets ("ISMDEV", socket, SZ_FNAME) <= 0) + call strcpy (WCSPIX_CONNECT, socket, SZ_FNAME) + + # Open the socket connection on a negotiated socket. + if (ism_connect (socket, WCSPIX_NAME, WCSPIX_MODE) == ERR) + return + + # Install an interrupt exception handler so we can exit cleanly. + if (ism_intrhandler() == ERR) + return + + + # Initialize the task data structures. + wp = wp_init () + + # Check for a runtime debug level. + iferr (WP_DBGLEVEL(wp) = envgeti ("WCSPIX_DEBUG")) + WP_DBGLEVEL(wp) = 0 + + # Log the connection. + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, "info { %s: WCSPIX Connect}\n") + call pargstr (buf) + call ism_message ("ism_msg", message) + + # Loop over the commands read on the connection and process. + disconnect = 1 + debug = (WCSPIX_DBG || WP_DBGLEVEL(wp) > 0) + while (wp_read (wp, message, len) != EOF) { + + if (debug) { + message[len] = '\0' + call eprintf("message: '%s' len=%d\n") + call pargstr (message); call pargi (len) + } + if (len <= 0) { + # Server has disconnected. + disconnect = 0 + break + } + + # Scan the command string and get the first word. + call sscan (message) + call gargwrd (cmd, SZ_LINE) + ncmd = strdic (cmd, cmd, SZ_LINE, WCSPIX_CMDS) + + switch (ncmd) { + case QUIT: + # Server wants us to shut down. + disconnect = 0 + break + + case INITIALIZE: + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, + "info { %s: WCSPIX Initialize}\n") + call pargstr (buf) + call wp_initialize (wp) + + case CACHE: + # <ref> <objid> <regid> + call gargwrd (ref, SZ_FNAME) + call gargi (objid) + call gargi (regid) + if (debug) { + call printf ("cache: objid=%d regid=%d ref='%s'\n") + call pargi(objid); call pargi(regid); call pargstr(ref) + } + + # Log the event. + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, + "info { %s: WCSPIX Cache objid=%3d %s}\n") + call pargstr (buf) + call pargi (objid) + call pargstr (ref) + call ism_message ("ism_msg", message) + + call wp_cache (wp, objid, regid, ref) + + case UNCACHE: + # <id> + call gargi (objid) + if (debug) { call printf("uncache: id=%d\n");call pargi(objid) } + + # Log the event. + call wp_cnvdate (clktime(0), buf, SZ_DATE) + call sprintf (message, SZ_LINE, + "info { %s: WCSPIX Uncache objid=%3d}\n") + call pargstr (buf) + call pargi (objid) + call ism_message ("ism_msg", message) + + call wp_uncache (wp, objid) + + case WCSTRAN: + # <id> <x> <y> [[<region> <x> <y>] ["NDC" <x> <y> ]] + call gargi (objid) + call gargr (x) ; call gargr (y) + if (debug) { + call printf ("wcstran: id=%d (%g,%g)\n") + call pargi(objid); call pargr (x); call pargr (y) + } + call wp_wcstran (wp, objid, x, y) + + case WCSLIST: + # <id> + call gargi (objid) + if (debug) { call printf ("wcslist: id=%d\n");call pargi(objid)} + call wp_wcslist (wp, objid) + + case OBJINFO: + # <id> <template_list> + call gargi (objid) + call gargwrd (template, SZ_FNAME) + if (debug) { + call printf ("objinfo: id=%d temp='%s'\n") + call pargi(objid); call pargstr (template); + } + call wp_objinfo (wp, objid, template) + + case SET: + # <param> <value> + call gargwrd (param, SZ_FNAME) + call wp_setpar (wp, param) + + case GET: + # <param> + + case DEBUG: + debug = !(debug) + + default: + if (debug) { + call eprintf ("ISM default: len=%d msg='%s'\n") + call pargi(len); call pargstr(message) + } + } + + # Clear the buffer for the next read. + call aclrc (message, SZ_LINE) + } + + # Disconnect from the server and clean up. + call ism_disconnect (disconnect) + call wp_shutdown (wp) +end + + +# WP_INITIALIZE -- Initialize the WCSPIX, uncache any previously cached images. + +procedure wp_initialize (wp) + +pointer wp #i WCSPIX structure + +pointer cp, wp_id2obj() +int i + +begin + for (i=0; i < SZ_CACHE; i=i+1) { + cp = wp_id2obj (wp, i) + if (cp != NULL && C_OBJID(cp) != NULL) + call wp_uncache (wp, C_OBJID(cp)) + } +end + + +# WP_CACHE -- Associate and object reference with a unique object id. + +procedure wp_cache (wp, objid, regid, ref) + +pointer wp #i WCSPIX structure +int objid #i object id +int regid #i region id +char ref[ARB] #i object ref + +pointer cp +int i, class +char alert[SZ_FNAME] + +int wp_class() + +include "class.com" + +begin + # Find an unused slot in the object cache. + for (i=0; i < SZ_CACHE; i=i+1) { + cp = OBJCACHE(wp,i) + if (C_NREF(cp) == 0) + break + } + + # Get the object class. + class = wp_class (ref) + if (class == ERR) { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "wp_cache: Unable to cache\n%s") + call pargstr (ref) + call ism_alert (alert, "", "") + + # Setup for linear system. + return + } + C_CLASS(cp) = class + + # Initialize the object. + if (class != NULL && CL_INIT(class) != NULL) + call zcall2 (CL_INIT(class), cp, wp) + + # Call the cache function. + if (class != NULL && CL_CACHE(class) != NULL) + call zcall4 (CL_CACHE(class), cp, objid, regid, ref) +end + + +# WP_UNCACHE -- Remove an object from the WCSPIX cache. + +procedure wp_uncache (wp, id) + +pointer wp #i WCSPIX structure +int id #i object id + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_UNCACHE(class) != NULL) + call zcall2 (CL_UNCACHE(class), cp, id) + + C_NREF(cp) = 0 +end + + +# WP_WCSTRAN -- Translate image coords to WCS values. + +procedure wp_wcstran (wp, id, x, y) + +pointer wp #i WCSPIX structure +int id #i object id +real x, y #i image coords + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_WCSTRAN(class) != NULL) + call zcall4 (CL_WCSTRAN(class), cp, id, x, y) +end + + +# WP_WCSLIST -- List the available world coordinate systems for the given +# object. + +procedure wp_wcslist (wp, id) + +pointer wp #i WCSPIX structure +int id #i object id + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_WCSLIST(class) != NULL) + call zcall2 (CL_WCSLIST(class), cp, id) +end + + +# WP_OBJINFO -- Get and image header or keyword templates for the given +# object. + +procedure wp_objinfo (wp, id, template) + +pointer wp #i WCSPIX structure +int id #i object id +char template[ARB] #i keyword template + +pointer cp, wp_id2obj() +int class + +include "class.com" + +begin + cp = wp_id2obj (wp, id) + if (cp == NULL) + return + + # Call the uncache function. + class = C_CLASS(cp) + if (class != NULL && CL_OBJINFO(class) != NULL) + call zcall3 (CL_OBJINFO(class), cp, id, template) +end + + +# WP_SETPAR -- Set the value of a WCSPIX ISM parameter. + +procedure wp_setpar (wp, param) + +pointer wp #i WCSPIX structure pointer +char param[SZ_FNAME] #i WCSPIX param name + +char arg[SZ_PARAM], buf[SZ_PARAM], msg[SZ_PARAM] +int line + +int strdic() + +include "class.com" + +begin + if (WCSPIX_DBG) { call printf ("set: %s = ");call pargstr(param) } + + switch (strdic (param, param, SZ_PARAM, WCSPIX_PARAMS)) { + case PAR_PSIZE: + call gargi (WP_PTABSZ(wp)) + if (WCSPIX_DBG) { call printf ("%d\n");call pargi(WP_PTABSZ(wp)) } + + case PAR_BPM: + call gargi (WP_BPM(wp)) + if (WCSPIX_DBG) { call printf ("%d\n");call pargi(WP_BPM(wp)) } + + case PAR_WCS: + call gargwrd (buf, SZ_FNAME) + call gargi (line) + + call strcpy (buf, arg, SZ_PARAM) + call strlwr (buf) + switch (strdic (buf, buf, SZ_FNAME, WCSPIX_SYSTEMS)) { + case SYS_DISPLAY: SYSTEMS(wp,line) = SYS_DISPLAY + case SYS_LOGICAL: SYSTEMS(wp,line) = SYS_LOGICAL + case SYS_PHYSICAL: SYSTEMS(wp,line) = SYS_PHYSICAL + case SYS_WORLD: SYSTEMS(wp,line) = SYS_WORLD + case SYS_NONE: SYSTEMS(wp,line) = SYS_NONE + case SYS_AMP: SYSTEMS(wp,line) = SYS_AMP + case SYS_CCD: SYSTEMS(wp,line) = SYS_PHYSICAL + case SYS_DETECTOR: SYSTEMS(wp,line) = SYS_DETECTOR + default: SYSTEMS(wp,line) = SYS_SKY + } + call strcpy (buf, WCSNAME(wp,line), LEN_WCSNAME) + + if (WCSPIX_DBG) { + call printf("%s line=%d\n");call pargstr(buf);call pargi(line) } + + call sprintf (msg, SZ_FNAME, "wcstype %s %d") + call pargstr (arg) + call pargi (line) + call wcspix_message (msg) + + case PAR_FMT: + call gargwrd (buf, SZ_FNAME) + call gargi (line) + + call strcpy (buf, arg, SZ_PARAM) + call strlwr (buf) + switch (strdic (buf, buf, SZ_FNAME, WCSPIX_FMT)) { + case FMT_DEFAULT: FORMATS(wp,line) = FMT_DEFAULT + case FMT_HMS: FORMATS(wp,line) = FMT_HMS + case FMT_DEG: FORMATS(wp,line) = FMT_DEG + case FMT_RAD: FORMATS(wp,line) = FMT_RAD + default: FORMATS(wp,line) = FMT_DEFAULT + } + + if (WCSPIX_DBG) { + call printf("%s line=%d\n");call pargstr(buf);call pargi(line) } + + call sprintf (msg, SZ_FNAME, "wcsfmt %s %d") + call pargstr (arg) + call pargi (line) + call wcspix_message (msg) + } +end + + +# WP_GETPAR -- Get the value of a WCSPIX ISM parameter. + +procedure wp_getpar (wp, param) + +pointer wp #i WCSPIX structure pointer +char param[SZ_FNAME] #i WCSPIX param name + +int strdic() + +begin + if (WCSPIX_DBG) { call printf ("set: %s = ");call pargstr(param) } + + switch (strdic (param, param, SZ_PARAM, WCSPIX_PARAMS)) { + case PAR_PSIZE: + case PAR_BPM: + case PAR_WCS: + case PAR_FMT: + } +end + + +################################################################################ +# +# Private procedures. +# +################################################################################ + + +# WP_INIT -- Initialize the WCSPIX task and data structures. + +pointer procedure wp_init () + +pointer wp #r WCSPIX structure pointer +int i + +begin + # Allocate the task structure. + iferr (call calloc (wp, SZ_WCSPIX, TY_STRUCT)) + call error (0, "Error opening WCSPIX task structure.") + + call calloc (WP_SYSTEMS(wp), MAX_WCSLINES, TY_INT) + call calloc (WP_FORMATS(wp), MAX_WCSLINES, TY_INT) + call calloc (WP_WCS(wp), (LEN_WCSNAME*MAX_WCSLINES), TY_CHAR) + for (i=1; i <= MAX_WCSLINES; i=i+1) { + FORMATS(wp,i) = DEF_FMT + SYSTEMS(wp,i) = DEF_SYSTEM + call strcpy ("none", WCSNAME(wp,i), LEN_WCSNAME) + } + + # Allocate the object cache. + call calloc (WP_CPTR(wp), SZ_CACHE, TY_STRUCT) + for (i=0; i < SZ_CACHE; i=i+1) + call calloc (OBJCACHE(wp,i), SZ_CNODE, TY_STRUCT) + + WP_PTABSZ(wp) = 0 + WP_BPM(wp) = DEF_BPM_FLAG + + # Initialize the class modules. + call wp_class_init() + + return (wp) +end + + +# WP_READ -- Read messages from the connection and process them optimally for +# this ISM. This means we segment the messages and handle only the last +# few WCS requests so we can keep up with the server requests. Presumably +# there are more cursor events coming which are no longer valid so some are +# thrown out. + +int procedure wp_read (wp, message, len) + +pointer wp #i WCSPIX structure pointer +char message[ARB] #o message buffer +int len #o length of message + +int nleft + +int ism_read(), strncmp() +errchk ism_read + +begin + while (true) { + nleft = ism_read (message, len) + + # Return EOF if the server hung up on us. + if (nleft == EOF) + return (EOF) + + # In debug mode process all messages. + if (WP_DBGLEVEL(wp) > 0) + break + + # Pass back all non-wcstran messages. + if (strncmp ("wcstran", message, 7) != 0) + break + + # Only pass back the last wcstran messages received (eat the rest). + if (strncmp ("wcstran", message, 7) == 0 && nleft <= 1) + break + } + + return (len) +end + + +# WP_SHUTDOWN -- Shut down the WCSPIX, freeing all storage + +procedure wp_shutdown (wp) + +pointer wp #i WCSPIX structure +int i + +begin + # Free the structures. + call mfree (WP_WCS(wp), TY_CHAR) + call mfree (WP_FORMATS(wp), TY_INT) + call mfree (WP_SYSTEMS(wp), TY_INT) + for (i=0; i < SZ_CACHE; i=i+1) + call mfree (OBJCACHE(wp,i), TY_STRUCT) + + call mfree (WP_CPTR(wp), TY_STRUCT) + call mfree (wp, TY_STRUCT) +end + + +# WP_CLASS -- Determine the object class for the named image/file. + +int procedure wp_class (object) + +char object[ARB] #i object reference + +int n, class +pointer im +char ch, buf[SZ_FNAME] + +int strlen(), stridx() +bool streq() +pointer immap() + +errchk immap + +begin + # The following kludge is necessary to protect against the case + # where dev$pix is used as a test image. The 'object' pathname in + # this case is "node!/path/dev/pix" which lacks the extension + # and causes the task to fail to open because of a conflict with + # the pix.hhh in the same directory. Most IRAF tasks work since + # the imio$iki code treats the string "dev$pix" as a special case. + + call imgimage (object, buf, SZ_FNAME) + n = strlen (buf) - 7 + if (streq (buf[n], "/dev/pix")) { + call strcpy ("dev$pix", buf, SZ_FNAME) + ch = '[' + n = stridx (ch, object) + if (n > 0) + call strcat (object[n], buf, SZ_FNAME) + call strcpy (buf, object, SZ_FNAME) + } + + + # See if we can map the image to get at least an image class. If + # so then check for special subclasses like Mosaic files, spectra, etc. + + class = UNKNOWN_CLASS + ifnoerr (im = immap (object, READ_ONLY, 0)) { + class = IMAGE_CLASS + + # Now check for subclasses. (TBD) + + call imunmap (im) + } + + return (class) +end + + +# WP_ID2OBJ -- Utility routine to convert and object id to the cache pointer. + +pointer procedure wp_id2obj (wp, id) + +pointer wp #i WCSPIX structure +int id #i object id + +int i +pointer cp + +begin + for (i=0; i < SZ_CACHE; i=i+1) { + cp = OBJCACHE(wp,i) + if (C_OBJID(cp) == id) + return (cp) + } + return (NULL) +end + + +# WP_CLASS_INIT -- Initialize the WCSPIX ISM class modules. + +procedure wp_class_init() + +extern img_init(), img_cache(), img_uncache() +extern img_wcstran(), img_wcslist(), img_objinfo() + +extern mef_init(), mef_cache(), mef_uncache() +extern mef_wcstran(), mef_wcslist(), mef_objinfo() + +extern msp_init(), msp_cache(), msp_uncache() +extern msp_wcstran(), msp_wcslist(), msp_objinfo() + +extern unk_init(), unk_cache(), unk_uncache() +extern unk_wcstran(), unk_wcslist(), unk_objinfo() + +include "class.com" +int locpr() + +begin + cl_nclass = 0 + + # Load the class modules. + call wp_load_class ("unknown", + locpr(unk_init), locpr(unk_cache), locpr(unk_uncache), + locpr(unk_wcstran), locpr(unk_wcslist), locpr(unk_objinfo)) + call wp_load_class ("image", + locpr(img_init), locpr(img_cache), locpr(img_uncache), + locpr(img_wcstran), locpr(img_wcslist), locpr(img_objinfo)) + call wp_load_class ("mef", + locpr(mef_init), locpr(mef_cache), locpr(mef_uncache), + locpr(mef_wcstran), locpr(mef_wcslist), locpr(mef_objinfo)) + call wp_load_class ("multispec", + locpr(msp_init), locpr(msp_cache), locpr(msp_uncache), + locpr(msp_wcstran), locpr(msp_wcslist), locpr(msp_objinfo)) +end + + +# WP_LOAD_CLASS -- Load an object class module for the ISM task. + +procedure wp_load_class (name, init, cache, uncache, tran, list, info) + +char name[ARB] #I module name +int init #I initialize procedure +int cache #I cache the object procedure +int uncache #I uncache the object procedure +int tran #I translate WCS procedure +int list #I list WCS proedure +int info #I get header procedure + +errchk syserrs +include "class.com" + +begin + # Get a new driver slot. + if (cl_nclass + 1 > MAX_CLASSES) + return + cl_nclass = cl_nclass + 1 + + # Load the driver. + CL_INIT(cl_nclass) = init + CL_CACHE(cl_nclass) = cache + CL_UNCACHE(cl_nclass) = uncache + CL_WCSTRAN(cl_nclass) = tran + CL_WCSLIST(cl_nclass) = list + CL_OBJINFO(cl_nclass) = info + call strcpy (name, CL_NAME(cl_nclass), SZ_FNAME) +end + + +# WCSPIX_MESSAGE -- Deliver a message to the ISM callback, tagged with +# our name so it can be passed off to the correct code. + +procedure wcspix_message (message) + +char message[ARB] #I message to send + +pointer sp, msgbuf +int msglen, mlen, ip + +int strlen() + +begin + # Get the message length plus some extra for the braces and padding. + mlen = strlen (message) + msglen = mlen + 64 + + # Allocate and clear the message buffer. + call smark (sp) + call salloc (msgbuf, msglen, TY_CHAR) + call aclrc (Memc[msgbuf], msglen) + + ip = 0 + call amovc ("deliver wcspix { ", Memc[msgbuf], 17) ; ip = ip + 17 + call amovc (message, Memc[msgbuf+ip], mlen) ; ip = ip + mlen + call amovc (" }\0", Memc[msgbuf+ip], 2) ; ip = ip + 2 + + call ism_message ("ism_msg", Memc[msgbuf]) + + call sfree (sp) +end + + +define SZ_WEEKDAY 3 +define SZ_MONTH 3 + +# WP_CNVDATE -- Convert a time in integer seconds since midnight on Jan 1, 1980 +# into a short string such as "5/15 18:24". + +procedure wp_cnvdate (ltime, outstr, maxch) + +long ltime # seconds since 00:00:00 10-Jan-1980 +char outstr[ARB] +int maxch + +int tm[LEN_TMSTRUCT] + +begin + call brktime (ltime, tm) + +# call sprintf (outstr, maxch, "%2d/%2d %2d:%02d") +# call pargi (TM_MONTH(tm)) +# call pargi (TM_MDAY(tm)) +# call pargi (TM_HOUR(tm)) +# call pargi (TM_MIN(tm)) + +# call sprintf (outstr, maxch, "%2d:%02d") +# call pargi (TM_HOUR(tm)) +# call pargi (TM_MIN(tm)) + + call sprintf (outstr, maxch, "%2d:%02d:%02d") + call pargi (TM_HOUR(tm)) + call pargi (TM_MIN(tm)) + call pargi (TM_SEC(tm)) +end + + + +#---------------- +# DEBUG ROUTINES. +#---------------- +procedure dbg_printcache (wp, buf) +pointer wp +char buf[ARB] +pointer cp, wp_id2obj() +int i +begin + call printf ("%s\n") ; call pargstr (buf) + for (i=0; i < SZ_CACHE; i=i+1) { + cp = wp_id2obj (wp, i) + if (C_DATA(cp) != NULL) { + call printf ("%3d: id=%d ref='%s'\n") + call pargi(i) + call pargi(C_OBJID(cp)) + call pargstr(C_REF(cp)) + } + } +end diff --git a/vendor/x11iraf/ximtool/clients/wcspix/wcimage.x b/vendor/x11iraf/ximtool/clients/wcspix/wcimage.x new file mode 100644 index 00000000..4a27af46 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/wcimage.x @@ -0,0 +1,1465 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <math.h> +include <imio.h> +include <imhdr.h> +include <time.h> +include <ctype.h> +include <mwset.h> +include <pkg/skywcs.h> +include "wcspix.h" + + +# Image class data. +define LEN_IMGDATA 15 +define IMG_WP Memi[$1 ] # wcspix back-pointer +define IMG_IM Memi[$1+1] # image pointer +define IMG_BPM Memi[$1+2] # bad pixel mask pointer +define IMG_MW Memi[$1+3] # image wcs pointer +define IMG_CO Memi[$1+4] # skywcs transform pointer +define IMG_CTW Memi[$1+5] # mwcs log->world transform ptr +define IMG_CTP Memi[$1+6] # mwcs log->phys transform ptr +define IMG_CTA Memi[$1+7] # mwcs log->amplifier transform +define IMG_CTD Memi[$1+8] # mwcs log->detector transform +define IMG_ROT Memr[$1+9] # rotation angle +define IMG_SCALE Memr[$1+10] # plate scale +define IMG_LINEAR Memi[$1+11] # linear coords + + +define IMG_DEBUG FALSE + + +# IMG_INIT -- Initialize the object structure. + +procedure img_init (cp, wp) + +pointer cp #i cache pointer +pointer wp #i WCSPIX structure + +pointer img # data pointer + +begin + if (IMG_DEBUG) call printf ("img_init: \n") + + # Allocate the image data structure if not previously allocated. + if (C_DATA(cp) == NULL) { + iferr (call calloc (C_DATA(cp), LEN_IMGDATA, TY_STRUCT)) + return + } + + img = C_DATA(cp) + IMG_WP(img) = wp + IMG_IM(img) = NULL + IMG_BPM(img) = NULL + IMG_MW(img) = NULL + IMG_CO(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CTA(img) = NULL + IMG_CTD(img) = NULL + IMG_ROT(img) = 0.0 + IMG_SCALE(img) = 0.0 + IMG_LINEAR(img) = YES +end + + +# IMG_CACHE -- Cache an image in the object cache. + +procedure img_cache (cp, objid, regid, ref) + +pointer cp #i cache pointer +int objid #i object id +int regid #i region id +char ref[ARB] #i object reference + +pointer img, im, wp, co +int stat, i1, i2 +char alert[SZ_LINE] + +pointer immap(), ds_pmmap(), mw_sctran() +pointer img_amp_wcs(), img_det_wcs() +int imaccf(), sk_decim() + +errchk immap, ds_pmmap, mw_sctran, sk_decim, sk_setd + +begin + if (IMG_DEBUG) call printf ("img_cache: \n") + + # Now map the image and WCS. + img = C_DATA(cp) + wp = IMG_WP(img) + + iferr (IMG_IM(img) = immap (ref, READ_ONLY, 0)) { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "Unable to cache\n%s") + call pargstr (ref) + call ism_alert (alert, "", "") + return + } + im = IMG_IM(img) + + IMG_CO(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CTA(img) = NULL + IMG_CTD(img) = NULL + iferr { + stat = sk_decim (IMG_IM(img), "world", IMG_MW(img), IMG_CO(img)) + if (IMG_DEBUG) { + call eprintf ("img_cache - decim: stat=%d mw=%d co=%d \n") + call pargi(stat);call pargi(IMG_MW(img)) + call pargi(IMG_CO(img)); + } + if (stat == ERR || IMG_MW(img) == NULL) { + IMG_LINEAR(img) = YES + + co = IMG_CO(img) + i1 = IM_VMAP(im,1) + i2 = IM_VMAP(im,2) + call sk_setd (co, S_VXOFF, double(IM_VOFF(im,i1))) + call sk_setd (co, S_VYOFF, double(IM_VOFF(im,i2))) + call sk_setd (co, S_VXSTEP, double(IM_VSTEP(im,i1))) + call sk_setd (co, S_VYSTEP, double(IM_VSTEP(im,i2))) + + IMG_MW(img) = NULL + IMG_LINEAR(img) = YES + } + + if (IMG_MW(img) != NULL) { + IMG_CTW(img) = mw_sctran (IMG_MW(img), "logical", "world", 03B) + IMG_CTP(img) = mw_sctran (IMG_MW(img), "logical", "physical", + 03B) + + # Get the amplifier transformation values if present. + if (imaccf(im,"ATM1_1") == YES && + imaccf(im,"ATM2_2") == YES && + imaccf(im,"ATV1") == YES && + imaccf(im,"ATV2") == YES) + IMG_CTA(img) = img_amp_wcs (im, IMG_MW(img)) + + if (imaccf(im,"DTM1_1") == YES && + imaccf(im,"DTM2_2") == YES && + imaccf(im,"DTV1") == YES && + imaccf(im,"DTV2") == YES) + IMG_CTD(img) = img_det_wcs (im, IMG_MW(img)) + } + + } then { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "Unable to decode image WCS\n%s") + call pargstr (ref) + call ism_alert (alert, "", "") + IMG_LINEAR(img) = YES + } + + + # See if we can find a bad pixel mask. + IMG_BPM(img) = NULL + if (WP_BPM(wp) == YES) { + iferr (IMG_BPM(img) = ds_pmmap ("BPM", IMG_IM(img))) + IMG_BPM(img) = NULL + } + + C_OBJID(cp) = objid + C_REGID(cp) = regid + C_NREF(cp) = C_NREF(cp) + 1 + call strcpy (ref, C_REF(cp), 128) +end + + +# IMG_UNCACHE -- Uncache an image in the object cache. + +procedure img_uncache (cp, id) + +pointer cp #i cache pointer +int id #i image id + +pointer img + +begin + if (IMG_DEBUG) call printf ("img_uncache: \n") + + C_OBJID(cp) = NULL + C_NREF(cp) = 0 + call strcpy ("", C_REF(cp), SZ_FNAME) + + img = C_DATA(cp) + if (IMG_MW(img) != NULL) + call mw_close (IMG_MW(img)) + if (IMG_BPM(img) != NULL) + call imunmap (IMG_BPM(img)) + if (IMG_IM(img) != NULL) + call imunmap (IMG_IM(img)) + + IMG_IM(img) = NULL + IMG_BPM(img) = NULL + IMG_MW(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CTA(img) = NULL + IMG_CTD(img) = NULL + IMG_CO(img) = NULL + IMG_ROT(img) = 0.0 + IMG_SCALE(img) = 0.0 + IMG_LINEAR(img) = NO + + call mfree (C_DATA(cp), TY_STRUCT) + C_DATA(cp) = NULL +end + + +# IMG_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. Message is returned as something like: +# +# set value { +# { object <objid> } { region <regionid> } +# { pixval <pixel_value> [<units>] } +# { bpm <bpm_pixel_value> } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# : +# } + + +procedure img_wcstran (cp, id, x, y) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords + +pointer img, im, wp, co +double dx, dy, wx, wy +real rx, ry, pixval +int i, bpm + +# Use static storage to avoid allocation overhead. +char buf[SZ_LINE] +char msg[SZ_LINE], wcs[LEN_WCSNAME], xc[LEN_WCSNAME], yc[LEN_WCSNAME] +char xunits[LEN_WCSNAME], yunits[LEN_WCSNAME] + +double sk_statd() + +begin + if (IMG_DEBUG) call printf ("img_wcstran: \n") + + img = C_DATA(cp) # initialize + co = IMG_CO(img) + wp = IMG_WP(img) + im = IMG_IM(img) + + # Get the translation to the image section. + dx = (double(x) - sk_statd(co,S_VXOFF)) / sk_statd(co,S_VXSTEP) + dy = (double(y) - sk_statd(co,S_VYOFF)) / sk_statd(co,S_VYSTEP) + rx = dx + ry = dy + + # Read the pixel data. + call img_get_data (cp, id, rx, ry, pixval, bpm) + + # Begin formatting the message. + call aclrc (msg, SZ_LINE) + call sprintf (msg, SZ_LINE, "wcstran { object %d } { region %d } ") + call pargi (C_OBJID(cp)) + call pargi (C_REGID(cp)) + + call sprintf (buf, SZ_LINE, "{ pixval %9.9g } { bpm %d }\n") + call pargr (pixval) + call pargi (bpm) + call strcat (buf, msg, SZ_LINE) + + # Now loop over the requested systems and generate a coordinate + # for each. + for (i=1; i <= MAX_WCSLINES; i=i+1) { + + # Get the coordinate value. + call img_get_coord (img, dx, dy, SYSTEMS(wp,i), WCSNAME(wp,i), + wx, wy) + + # Get the system name, labels, and formats strings for the WCS. + call img_coord_labels (cp, i, wcs, xunits, yunits) + + # Format the values as requested. + call img_coord_fmt (cp, i, wx, wy, xc, yc) + + # Format the coord buffer and append it to the message. + call sprintf (buf, SZ_LINE, + "{coord {%9s} {%12s} {%12s} {%4s} {%4s}}\n") + call pargstr (wcs) + call pargstr (xc) + call pargstr (yc) + call pargstr (xunits) + call pargstr (yunits) + call strcat (buf, msg, SZ_LINE) + } + + # Now send the completed message. + call wcspix_message (msg); +end + + +# IMG_WCSLIST -- List the WCSs available for the given image. + +procedure img_wcslist (cp, id) + +pointer cp #i cache pointer +int id #i image id + +pointer img, im, mw +char msg[SZ_LINE] + +begin + if (IMG_DEBUG) call printf ("img_wcslist: \n") + + img = C_DATA(cp) # initialize + mw = IMG_MW(img) + im = IMG_IM(img) + + call strcpy ("wcslist {None Display Logical World Physical line ", + msg, SZ_LINE) + + # See if we can do amplifier/detector coords by checking for ATM/ATV + # and DTM/DTV keywords. + + if (IMG_CTA(img) != NULL) + call strcat (" Amplifier ", msg, SZ_LINE) + if (IMG_CTD(img) != NULL) + call strcat (" Detector ", msg, SZ_LINE) + if (IMG_CTA(img) != NULL || IMG_CTD(img) != NULL) + call strcat (" CCD ", msg, SZ_LINE) + + # If we have a MWCS pointer list the sky projections. + if (mw != NULL) { + call strcat (" line ", msg, SZ_LINE) + call strcat (SKYPROJ, msg, SZ_LINE) + } + + # Close the message. + call strcat ("}", msg, SZ_LINE) + + call wcspix_message (msg) +end + + +# IMG_GET_DATA -- Get data from the image. + +procedure img_get_data (cp, id, x, y, pixval, bpm_pix) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords +real pixval #o central pixel value +int bpm_pix #o bad pixel mask value + +pointer img, wp, im, bpm, pix, sp, msg, buf +int nl, nc, ix, iy, s2 +int size, x1, x2, y1, y2 + +long clktime() +pointer imgs2r(), imgs2i(), ds_pmmap() +errchk ds_pmmap + +begin + + img = C_DATA(cp) + wp = IMG_WP(img) + im = IMG_IM(img) + bpm = IMG_BPM(img) + nc = IM_LEN(im,1) + nl = IM_LEN(im,2) +# size = WP_PTABSZ(wp) + size = min(min(nc,nl),WP_PTABSZ(wp)) + + if (IMG_DEBUG) { + call printf ("img_get_data: \n") + call eprintf ("\tx: %g y: %g nc: %d nl: %d\n") + call pargr(x); call pargr(y); call pargi(nc); call pargi(nl) + } + + # Sanity check on the cursor image position. + if (x < 0.0 || y < 0.0 || x > (nc+0.5) || y > (nl+0.5)) + return + + # Bounds checking. Rather than deal with out of bounds pixels we'll + # adjust the center pixel so we get the same size raster up to each + # boundary. + + ix = int (x + 0.5) ; iy = int (y + 0.5) + ix = min (ix, (nc-(size/2)-1)) ; iy = min (iy, (nl-(size/2)-1)) + ix = max (size/2+1, ix) ; iy = max (size/2+1, iy) + + # Compute the box offset given the center and size. + x1 = ix - size / 2 + 0.5 + x2 = ix + size / 2 + 0.5 + y1 = iy - size / 2 + 0.5 + y2 = iy + size / 2 + 0.5 + + if (IMG_DEBUG) { + call printf ("img_get_data: \n") + call eprintf ("\tix: %d iy: %g size: %d\n") + call pargi(ix); call pargi(iy); call pargi(size) + call eprintf ("\tx1: %d y1: %d x2: %d y2: %d\n") + call pargi(x1); call pargi(y1); + call pargi(x2); call pargi(y2); + } + + x1 = max (1, x1) + x2 = min (nc, x2) + y1 = max (1, y1) + y2 = min (nl, y2) + + if (IMG_DEBUG) { + call eprintf ("\tx1: %d y1: %d x2: %d y2: %d\n") + call pargi(x1); call pargi(y1); + call pargi(x2); call pargi(y2); + } + + # Get the image pixels + pix = imgs2r (im, int(x1), int(x2), int(y1), int(y2)) + + if (WP_BPM(wp) == YES) { + if (bpm != NULL) { + bpm_pix = Memi[imgs2i (bpm, ix, ix, iy, iy)] + } else { + # See if we can find a bad pixel mask. The option is enabled + # but we haven't mappend the mask yet. + + # Log the event. + call smark (sp) + call salloc (msg, SZ_LINE, TY_CHAR) + call salloc (buf, SZ_LINE, TY_CHAR) + call wp_cnvdate (clktime(0), Memc[buf], SZ_DATE) + call sprintf (Memc[msg], SZ_LINE, + "info { %s: WCSPIX BPM map objid=%3d %s}\n") + call pargstr (Memc[buf]) + call pargi (C_OBJID(cp)) + call pargstr (C_REF(cp)) + call ism_message ("ism_msg", Memc[msg]) + + iferr (IMG_BPM(img) = ds_pmmap ("BPM", im)) { + IMG_BPM(img) = NULL + bpm_pix = 0 + + # Send alert to the GUI. + call sprintf (Memc[buf], SZ_FNAME, + "Unable to map BPM image for\n%s") + call pargstr (C_REF(cp)) + call ism_alert (Memc[buf], "", "") + } else + bpm_pix = Memi[imgs2i (IMG_BPM(img), ix, ix, iy, iy)] + + call sfree (sp) + } + } else + bpm_pix = 0 + + # See if we're near an edge... + s2 = size / 2 + if (int(x)<s2 || int(x)>(nl-s2-1) || int(y)<s2 || int(x)>(nc-s2-1)) { + # Compute the image pixel associated with the requested coords. + ix = int (x + 0.5) + iy = int (y + 0.5) + pixval = Memr[imgs2r(im, ix, ix, iy, iy)] + } else { + pixval = Memr[pix + ((size/2)*size) + (size/2)] + } + + # Send the pixel table. + if (WP_PTABSZ(wp) > 1) + call img_send_pixtab (Memr[pix], WP_PTABSZ(wp), x1, x2, y1, y2) + + if (IMG_DEBUG) { + call printf ("img_get_data: pixval=%g\n") ; call pargr (pixval) + } +end + + +# IMG_OBJINFO -- Get header information from the image. + +procedure img_objinfo (cp, id, template) + +pointer cp #i cache pointer +int id #i image id +char template[ARB] #i keyword template + +pointer im, img + +define WCS_TEMPLATE "WCSDIM,CTYPE*,CRPIX*,CRVAL*,CD*,CROTA2,LTV*,LTM*,WSV*,WAT*,RA*,DEC*,EQUINOX,EPOCH,MJD*,DATE-OBS" + +begin + if (IMG_DEBUG) call printf ("img_objinfo: \n") + + # Send the full header (or keyword filtered header), only the WCS + # keywords, and a plain-text explanation of the WCS. + + img = C_DATA(cp) + im = IMG_IM(img) + + call img_send_header (im, "imghdr", template) + call img_send_header (im, "wcshdr", WCS_TEMPLATE) + call img_send_wcsinfo (im, cp) + call img_send_compass (im, cp) +end + + + +#============================================================================== + +# IMG_SEND_HEADER -- Send an image header to the named GUI object. Keywords +# are filtered according to a specified template + +procedure img_send_header (im, object, template) + +pointer im #i image descriptor +char object[ARB] #i object for the message +char template[ARB] #i keyword template + +pointer sp, hdr, lbuf, line, field, keyw, dict +pointer ip, lp, list +int nlines, in, out, i, hdr_size +bool keyw_filter + +int stropen(), getline(), stridx(), imgnfn(), strdic() +pointer imofnlu() +bool streq() +errchk stropen, getline, putci, putline, imgnfn, imofnlu, strdic + +define USER_AREA Memc[($1+IMU-1)*SZ_STRUCT + 1] +define SZ_KEYW 8 + +begin + hdr_size = (LEN_IMDES + IM_LENHDRMEM(im) - IMU) * SZ_STRUCT - 1 + hdr_size = hdr_size + SZ_LINE + + call smark (sp) + call salloc (hdr, hdr_size, TY_CHAR) + call salloc (dict, hdr_size, TY_CHAR) + call salloc (field, SZ_LINE, TY_CHAR) + call salloc (lbuf, SZ_LINE, TY_CHAR) + call salloc (line, SZ_LINE, TY_CHAR) + call salloc (keyw, SZ_KEYW, TY_CHAR) + + in = stropen (USER_AREA(im), hdr_size, READ_ONLY) + out = stropen (Memc[hdr], hdr_size, WRITE_ONLY) + call fprintf (out, "%s {") + call pargstr (object) + + # Build up a dictionary of header keywords based on the template. + keyw_filter = (!streq (template, "*")) + if (keyw_filter) { + list = imofnlu (im, template) + call strcpy ("|", Memc[dict], hdr_size) + while (imgnfn (list, Memc[field], SZ_FNAME) != EOF) { + call strcat (Memc[field], Memc[dict], hdr_size) + call strcat ("|", Memc[dict], hdr_size) + } + call imcfnl (list) + } + + + # Copy header records to the output, stripping any trailing + # whitespace and clipping at the right margin. We also filter + # against the keyword dictionary found above. + + nlines = 0 + while (getline (in, Memc[lbuf]) != EOF) { + + call aclrc (Memc[line], SZ_LINE) + + # Escape any brackets passed to the Tcl. + ip = lbuf + lp = line + while (Memc[ip] != EOS && Memc[ip] != '\n') { + if (stridx (Memc[ip], "[{") > 0) { + Memc[lp] = '\\' + lp = lp + 1 + } + Memc[lp] = Memc[ip] + ip = ip + 1 + lp = lp + 1 + } + Memc[lp] = '\n' + Memc[lp+1] = EOS + + # See whether the line matches a keyword we want to output. + if (keyw_filter) { + for (i=0; i < SZ_KEYW && !IS_WHITE(Memc[line+i]); i=i+1) + Memc[keyw+i] = Memc[line+i] + Memc[keyw+i] = '\0' + + # If not in the dictionary skip to the next line. + if (strdic (Memc[keyw], Memc[keyw], SZ_KEYW, Memc[dict]) == 0) + next + } + + call putci (out, ' ') + call putline (out, Memc[line]) + + # Send the header in small chunks so we don't overflow the + # message buffer. + nlines = nlines + 1 + if (mod(nlines,10) == 0) { + call fprintf (out, "}") + call close (out) + call wcspix_message (Memc[hdr]); + call aclrc (Memc[hdr], hdr_size) + out = stropen (Memc[hdr], hdr_size, WRITE_ONLY) + call fprintf (out, "%s {") + call pargstr (object) + } + } + call fprintf (out, "}") + + call close (in) + call close (out) + + # Send the final message. + call wcspix_message (Memc[hdr]) + + # Pad a few lines for the GUI + call sprintf (Memc[hdr], SZ_LINE, "%d { \n\n\n }") + call pargstr (object) + call wcspix_message (Memc[hdr]) + + call sfree (sp) +end + + +# IMG_SEND_COMPASS -- Send information about the image WCS in a plain-english +# string. + +procedure img_send_compass (im, cp) + +pointer im #i image descriptor +pointer cp #i cache element pointer + +pointer sp, buf, img, co, mw +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] +int i, j +long axis[IM_MAXDIM], lv[IM_MAXDIM], pv1[IM_MAXDIM], pv2[IM_MAXDIM] + +real north[2], east[2] + +int mw_stati(), sk_stati() + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call aclrc (Memc[buf], SZ_LINE) + + # Get the data pointer. + img = C_DATA(cp) + co = IMG_CO(img) + + # Get world coords at the image corners. + if (IMG_CTW(img) != NULL) { + + # Get the CD matrix for the image. + mw = IMG_MW(img) + call wcs_gfterm (mw, r, w, cd, mw_stati(mw, MW_NPHYSDIM)) + + # Compute a Nort and East vector for the CD matrix. + call img_cvectors (cd, 1.0, north, east) + + } else { + # Determine the logical to physical mapping by evaluating two + # points and determining the axis reduction if any. pv1 will be + # the offset and pv2-pv1 will be the scale. + + lv[1] = 0; lv[2] = 0; call imaplv (im, lv, pv1, 2) + lv[1] = 1; lv[2] = 1; call imaplv (im, lv, pv2, 2) + + i = 1 + axis[1] = 1; axis[2] = 2 + do j = 1, IM_MAXDIM { + if (pv1[j] != pv2[j]) { + axis[i] = j + i = i + 1 + } + } + north[1] = 0.0 + north[2] = (pv2[axis[2]] - pv1[axis[2]]) + east[1] = -(pv2[axis[1]] - pv1[axis[1]]) + east[2] = 0.0 + } + + call sprintf (Memc[buf], SZ_LINE, "compass %d %g %g %g %g %g %d %s\0") + call pargi (C_OBJID(cp)) + call pargr (IMG_ROT(img)) + call pargr (north[1]) + call pargr (north[2]) + call pargr (east[1]) + call pargr (east[2]) + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) + call pargi (1) # transposed image + else + call pargi (0) + if (IMG_MW(img) != NULL) + call pargstr ("E N") + else + call pargstr ("X Y") + + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_CVECTORS -- Get north and east vectors for the compass + +procedure img_cvectors (cd, length, north, east) + +double cd[2,2] #i CD matrix +real length #i length of vectors +real north[2] #o vector pointing north +real east[2] #o vector pointing east + +double d # determinant of CD matrix +double x, y # scratch for vector components +double l # length of a vector + +begin + d = cd[1,1] * cd[2,2] - cd[1,2] * cd[2,1] + if (d == 0.d0) + call error (1, "CD matrix is singular") + + # North. + x = -cd[1,2] / d + y = cd[1,1] / d + + # Normalize by the length and copy to output. + l = sqrt (x**2 + y**2) + north[1] = x * length / l + north[2] = y * length / l + + # East. + x = cd[2,2] / d + y = -cd[2,1] / d + l = sqrt (x**2 + y**2) + east[1] = x * length / l + east[2] = y * length / l +end + + +# IMG_SEND_WCSINFO -- Send information about the image WCS in a plain-english +# string. + +procedure img_send_wcsinfo (im, cp) + +pointer im #i image descriptor +pointer cp #i cache element pointer + +pointer sp, co, img, mw +pointer buf, proj, radecstr +int fd, radecsys, ctype, wtype, ndim +double crpix1, crpix2, crval1, crval2, cval1, cval2 +double xscale, yscale, xrot, yrot +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM], + +int idxstr(), sk_stati(), stropen(), mw_stati() +double sk_statd(), sl_epj(), sl_epb() +bool fp_equald() + +errchk stropen + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call salloc (proj, SZ_FNAME, TY_CHAR) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + # Open a string on a file. + fd = stropen (Memc[buf], SZ_LINE, WRITE_ONLY) + + # Get the data pointer. + img = C_DATA(cp) + + # Get the coordinate transform descriptor. + co = IMG_CO(img) + radecsys = sk_stati (co, S_RADECSYS) + ctype = sk_stati (co, S_CTYPE) + wtype = sk_stati (co, S_WTYPE) + + mw = IMG_MW(img) + if (mw != NULL) { + # Now get the mwcs Rterm (CRPIXi), Wterm (CRVALi), and CD matrix. + ndim = mw_stati (mw, MW_NPHYSDIM) + call wcs_gfterm (mw, r, w, cd, ndim) + crpix1 = r[1] + crpix2 = r[2] + crval1 = w[1] + crval2 = w[2] + + xscale = sqrt (cd[1,1]**2 + cd[2,1]**2) * 3600.0d0 + yscale = sqrt (cd[1,2]**2 + cd[2,2]**2) * 3600.0d0 + xrot = 0.0 + yrot = 0.0 + if (!fp_equald (cd[1,1], 0.0d0)) + xrot = DRADTODEG(atan ( cd[2,1] / cd[1,1])) + if (!fp_equald (cd[2,2], 0.0d0)) + yrot = DRADTODEG(atan (-cd[1,2] / cd[2,2])) + } else { + ndim = 2 + xscale = 1.0 + yscale = 1.0 + xrot = 0.0 + yrot = 0.0 + } + + if (IMG_DEBUG) { + call printf("WCS Info:\n=========\n") + call printf("R term: %g %g\n"); call pargd(r[1]); call pargd(r[2]) + call printf("W term: %g %g\n"); call pargd(w[1]); call pargd(w[2]) + call printf(" cd: %g %g\n %g %g\n") + call pargd(cd[1,1]); call pargd(cd[1,2]) + call pargd(cd[2,1]); call pargd(cd[2,2]) + call printf(" scale: %g %g\n");call pargd(xscale);call pargd(yscale) + call printf(" rot: %g %g\n");call pargd(xrot);call pargd(yrot) + } + + IMG_SCALE(img) = (xscale + yscale) / 2.0d0 + #IMG_ROT(img) = (xrot + yrot) / 2.0d0 + IMG_ROT(img) = xrot + + + # Now format a WCS text panel such as + # + # Projection: TAN System: Equatorial FK5 + # Ra/Dec axes: 1/2 Dimensions: 512 x 512 + # + # Center Pos: RA: 13:29:52.856 Dec: +47:11:40.39 + # Reference Pos: RA: 13:29:52.856 Dec: +47:11:40.39 + # Ref pixel coord: X: 250.256 Y: 266.309 + # Plate Scale: 0.765194 Rot Angle: 1.02939 + # Equinox: J2000.000 Epoch: J1987.25775240 + # MJD: 46890.39406 + + # Get some preliminary values. + if (idxstr (radecsys, Memc[radecstr], SZ_FNAME, EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + + if (idxstr (wtype, Memc[proj], SZ_FNAME, WTYPE_LIST) <= 0) + call strcpy ("logical", Memc[proj], SZ_FNAME) + call strupr (Memc[proj]) + + call fprintf (fd, "wcsinfo {\n") + + call fprintf (fd, + " Projection: %-6s\t System: %s %s\n") + call pargstr (Memc[proj]) + switch (ctype) { + case CTYPE_EQUATORIAL: + call pargstr ("Equatorial") + call pargstr (Memc[radecstr]) + case CTYPE_ECLIPTIC: + call pargstr ("Ecliptic") + call pargstr ("") + case CTYPE_GALACTIC: + call pargstr ("Galactic") + call pargstr ("") + case CTYPE_SUPERGALACTIC: + call pargstr ("SuperGalactic") + call pargstr ("") + default: + call pargstr ("Linear") + call pargstr ("") + } + + call fprintf (fd, " Ra/Dec axes: %d/%d") + call pargi (sk_stati (co, S_PLNGAX)) + call pargi (sk_stati (co, S_PLATAX)) + call fprintf (fd, " Dimensions: %d x %d\n\n") + call pargi (IM_LEN(im,1)) + call pargi (IM_LEN(im,2)) + + call fprintf (fd, + " Center Pos: %3s: %-12H %3s: %-12h\n") + if (ctype == CTYPE_EQUATORIAL) + call pargstr (" RA") + else + call pargstr ("Lon") + call pargd (cval1) + if (ctype == CTYPE_EQUATORIAL) + call pargstr ("Dec") + else + call pargstr ("Lat") + call pargd (cval2) + + call fprintf (fd, + " Reference Pos: %3s: %-12H %3s: %-12h\n") + if (ctype == CTYPE_EQUATORIAL) + call pargstr (" RA") + else + call pargstr ("Lon") + call pargd (crval1) + if (ctype == CTYPE_EQUATORIAL) + call pargstr ("Dec") + else + call pargstr ("Lat") + call pargd (crval2) + + call fprintf (fd, + " Reference Pixel: X: %-9.4f Y: %-9.4f\n") + call pargd (crpix1) + call pargd (crpix2) + + call fprintf (fd, + " Plate Scale: %-8f Rot Angle: %-8f\n") + call pargr (IMG_SCALE(img)) + call pargr (IMG_ROT(img)) + + call fprintf (fd, + " Equinox: %s%8f Epoch: %s%.6f\n") + switch (radecsys) { + case EQTYPE_FK5, EQTYPE_ICRS: + call pargstr ("J") ; call pargd (sk_statd(co,S_EQUINOX)) + call pargstr ("J") ; call pargd (sl_epj(sk_statd(co,S_EPOCH))) + default: + if (IMG_LINEAR(img) == YES) { + call pargstr (" ") ; call pargd (INDEFD) + call pargstr (" ") ; call pargd (INDEFD) + } else { + call pargstr ("B") + call pargd (sk_statd(co,S_EQUINOX)) + call pargstr ("B") + call pargd (sl_epb(sk_statd(co,S_EPOCH))) + } + } + + call fprintf (fd, " MJD: %.6f\n") + call pargd (sk_statd(co,S_EPOCH)) + + call fprintf (fd, "}\n \n \n") + + # Close the formatted string and send the message. + call close (fd) + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_SEND_PIXTAB -- Send a 'pixtab' message. Format of the message is +# +# pixtab { +# { {pix} {pix} ... } # pixel table values +# { {x1} {x2} ... } # column label values +# { {y1} {y2} ... } # row label values +# { <mean> <stdev> } # pixtab statistics +# } +# + +procedure img_send_pixtab (pixtab, size, x1, x2, y1, y2) + +real pixtab[ARB] #i pixtab array +int size #i pixtab size +int x1, x2, y1, y2 #i raster boundaries + +pointer sp, buf, el +int i, j, npix +real pix, sum, sum2, mean, var, stdev, x, y + +define SZ_PIXTAB (6*SZ_LINE) + +begin + call smark (sp) + call salloc (buf, SZ_PIXTAB, TY_CHAR) + call salloc (el, SZ_FNAME, TY_CHAR) + + # Begin the pixtab message. + call strcpy ("pixtab {\n{\ntable {\n", Memc[buf], SZ_PIXTAB) + + # Format the pixels into a table for presentation. Do the y-flip + # here so the pixels are in order for the List widget in the GUI. + # Accumulate the pixel statistics so we don't have to do it in the + # GUI where it's slower. + + sum = 0.0 + sum2 = 0.0 + npix = size * size + + for (i=size - 1; i >= 0; i=i-1) { + for (j=1; j <= size; j=j+1) { + pix = pixtab[(i * size) + j] + sum = sum + pix + sum2 = sum2 + (pix * pix) + + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (pix) + + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("\n", Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n}\n", Memc[buf], SZ_PIXTAB) + + + # Do the row and column label parts of the message. + call strcat ("{", Memc[buf], SZ_PIXTAB) + for (x = x1; x <= x2; x = x + 1.) { + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (x) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n", Memc[buf], SZ_PIXTAB) + + call strcat ("{", Memc[buf], SZ_PIXTAB) + for (y = y2; y >= y1; y = y - 1.) { + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (y) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n", Memc[buf], SZ_PIXTAB) + + + # Compute the statistics for the raster. + mean = sum / real(npix) + var = (sum2 - sum * mean) / real(npix - 1) + if (var <= 0) + stdev = 0.0 + else + stdev = sqrt (var) + + call sprintf (Memc[el], SZ_FNAME, " { %10.2f %10.4f }\n") + call pargr (mean) + call pargr (stdev) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + + + # Close the message. + call strcat ("}", Memc[buf], SZ_PIXTAB) + + if (IMG_DEBUG) { + call eprintf ("pixtab: %s\n");call pargstr(Memc[buf]) + } + + # Send the formatted message. + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_AMP_WCS -- Create a WCS transformation for the amplifier coordinates. + +pointer procedure img_amp_wcs (im, mw) + +pointer im #i image pointer +pointer mw #i MWCS descriptor + +pointer ct +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] + +double imgetd() +pointer mw_sctran() + +begin + r[1] = 0.0d0 + r[2] = 0.0d0 + w[1] = imgetd (im, "ATV1") + w[2] = imgetd (im, "ATV2") + cd[1,1] = imgetd (im, "ATM1_1") + cd[1,2] = 0.0d0 + cd[2,1] = 0.0d0 + cd[2,2] = imgetd (im, "ATM2_2") + + # Create a new named system. + call mw_newsystem (mw, "amplifier", 2) + + # Set the new Wterm for the system. + call mw_swtermd (mw, r, w, cd, 2) + + # Set up the transform. + ct = mw_sctran (mw, "logical", "amplifier", 03B) + + # Reset the default world system. + call mw_sdefwcs (mw) + + return (ct) +end + + +# IMG_DET_WCS -- Create a WCS transformation for the detector coordinates. + +pointer procedure img_det_wcs (im, mw) + +pointer im #i image pointer +pointer mw #i MWCS descriptor + +pointer ct +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] + +double imgetd() +pointer mw_sctran() + +begin + r[1] = 0.0d0 + r[2] = 0.0d0 + w[1] = imgetd (im, "DTV1") + w[2] = imgetd (im, "DTV2") + cd[1,1] = imgetd (im, "DTM1_1") + cd[1,2] = 0.0d0 + cd[2,1] = 0.0d0 + cd[2,2] = imgetd (im, "DTM2_2") + + # Create a new named system. + call mw_newsystem (mw, "detector", 2) + + # Set the new Wterm for the system. + call mw_swtermd (mw, r, w, cd, 2) + + # Set up the transform. + ct = mw_sctran (mw, "logical", "detector", 03B) + + # Reset the default world system. + call mw_sdefwcs (mw) + + return (ct) +end + + +# IMG_COORD_LABELS -- Get the WCS name, coord labels and format strings for +# the specified object. + +procedure img_coord_labels (cp, line, wcsname, xunits, yunits) + +pointer cp #i cache pointer +pointer line #i WCS output line +char wcsname[ARB] #o WCS name string +char xunits[ARB], yunits[ARB] #o WCS coord labels + +pointer img, co, wp +pointer sp, proj, radecstr + +int strcmp(), sk_stati(), idxstr() + +begin + img = C_DATA(cp) # initialize ptrs + co = IMG_CO(img) + wp = IMG_WP(img) + + if (SYSTEMS(wp,line) == SYS_WORLD) { + switch (sk_stati(co,S_CTYPE)) { + case CTYPE_EQUATORIAL: + call strcpy (" RA", xunits, LEN_WCSNAME) + call strcpy (" Dec", yunits, LEN_WCSNAME) + case CTYPE_ECLIPTIC: + call strcpy ("ELon", xunits, LEN_WCSNAME) + call strcpy ("ELat", yunits, LEN_WCSNAME) + case CTYPE_GALACTIC: + call strcpy ("GLon", xunits, LEN_WCSNAME) + call strcpy ("GLat", yunits, LEN_WCSNAME) + case CTYPE_SUPERGALACTIC: + call strcpy ("SLon", xunits, LEN_WCSNAME) + call strcpy ("SLat", yunits, LEN_WCSNAME) + } + } else if (SYSTEMS(wp,line) == SYS_SKY) { + call strcpy (WCSNAME(wp,line), wcsname, LEN_WCSNAME) + call strlwr (wcsname) + if (strcmp (wcsname,"ecliptic") == 0) { + call strcpy ("ELon", xunits, LEN_WCSNAME) + call strcpy ("ELat", yunits, LEN_WCSNAME) + } else if (strcmp (wcsname,"galactic") == 0) { + call strcpy ("GLon", xunits, LEN_WCSNAME) + call strcpy ("GLat", yunits, LEN_WCSNAME) + } else if (strcmp (wcsname,"supergalactic") == 0) { + call strcpy ("SLon", xunits, LEN_WCSNAME) + call strcpy ("SLat", yunits, LEN_WCSNAME) + } else { + call strcpy (" RA", xunits, LEN_WCSNAME) + call strcpy (" Dec", yunits, LEN_WCSNAME) + } + } else { + call strcpy ("X", xunits, LEN_WCSNAME) + call strcpy ("Y", yunits, LEN_WCSNAME) + } + + + # Now get the format strings. For systems other than the image + # default just use the WCS string as the name, otherwise format a + # string giving more information about the system. + if (SYSTEMS(wp,line) != SYS_WORLD) + call strcpy (WCSNAME(wp,line), wcsname, LEN_WCSNAME) + + else { + call smark (sp) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + call salloc (proj, SZ_FNAME, TY_CHAR) + + call sprintf (wcsname, LEN_WCSNAME, "%s-%s-%s") + + switch (sk_stati(co,S_CTYPE)) { + case CTYPE_EQUATORIAL: call pargstr ("EQ") + case CTYPE_ECLIPTIC: call pargstr ("ECL") + case CTYPE_GALACTIC: call pargstr ("GAL") + case CTYPE_SUPERGALACTIC: call pargstr ("SGAL") + default: call pargstr ("UNKN") + } + + if (sk_stati(co,S_CTYPE) == CTYPE_EQUATORIAL) { + if (idxstr(sk_stati(co,S_RADECSYS), Memc[radecstr], + SZ_FNAME, EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call pargstr (Memc[radecstr]) + } else { + if (sk_stati(co,S_CTYPE) == CTYPE_SUPERGALACTIC) + call pargstr ("-") + else + call pargstr ("--") + } + + if (idxstr(sk_stati(co,S_WTYPE), Memc[proj], SZ_FNAME, + WTYPE_LIST) <= 0) + call strcpy ("linear", Memc[proj], SZ_FNAME) + call strupr (Memc[proj]) + call pargstr (Memc[proj]) + + call sfree (sp) + } + + # Now fix up the WCS system name. + if (strcmp (wcsname, "fk4") == 0 || + strcmp (wcsname, "fk5") == 0 || + strcmp (wcsname, "icrs") == 0 || + strcmp (wcsname, "gappt") == 0 || + strcmp (wcsname, "fk4-no-e") == 0) { + call strupr (wcsname) + + } else if (IS_LOWER(wcsname[1])) + wcsname[1] = TO_UPPER(wcsname[1]) +end + + +# IMG_COORD_FMT -- Format the coordinate strings. + +procedure img_coord_fmt (cp, line, xval, yval, xc, yc) + +pointer cp #i object cache pointer +int line #i output line number +double xval, yval #i input coords +char xc[ARB], yc[ARB] #o formatted coord strings + +pointer img, co, wp +char xfmt[LEN_WCSNAME], yfmt[LEN_WCSNAME] +int ctype + +int sk_stati() +bool streq() + +begin + img = C_DATA(cp) # initialize ptrs + co = IMG_CO(img) + wp = IMG_WP(img) + + + ctype = sk_stati (co, S_CTYPE) + + # Convert coords to the requested format. + if (FORMATS(wp,line) == FMT_DEFAULT) { + if (IMG_MW(img) == NULL) { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } else { + if (SYSTEMS(wp,line) == SYS_WORLD || + SYSTEMS(wp,line) == SYS_SKY) { + + if (streq(WCSNAME(wp,line),"ecliptic") || + streq(WCSNAME(wp,line),"galactic") || + streq(WCSNAME(wp,line),"supergalactic")) + call strcpy ("%h", xfmt, LEN_WCSNAME) + else { + if (sk_stati(co, S_CTYPE) == CTYPE_EQUATORIAL) + call strcpy ("%.2H", xfmt, LEN_WCSNAME) + else + call strcpy ("%.2h", xfmt, LEN_WCSNAME) + } + call strcpy ("%.1h", yfmt, LEN_WCSNAME) + } else { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } + } + + } else if (FORMATS(wp,line) == FMT_HMS) { + if (sk_stati(co, S_CTYPE) == CTYPE_EQUATORIAL) + call strcpy ("%.2H", xfmt, LEN_WCSNAME) + else + call strcpy ("%.1h", xfmt, LEN_WCSNAME) + call strcpy ("%h", yfmt, LEN_WCSNAME) + } else { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } + + # Convert the value to the requested format + call sprintf (xc, LEN_WCSNAME, xfmt) + if (FORMATS(wp,line) != FMT_RAD) + call pargd (xval) + else + call pargd (DEGTORAD(xval)) + + call sprintf (yc, LEN_WCSNAME, yfmt) + if (FORMATS(wp,line) != FMT_RAD) + call pargd (yval) + else + call pargd (DEGTORAD(yval)) +end + + +# IMG_GET_COORD -- Given an x,y position in the image return the coordinate in +# the given system. + +procedure img_get_coord (img, x, y, system, wcsname, wx, wy) + +pointer img #i IMG struct pointer +double x, y #i input image position +int system #i coordinate system requested +char wcsname[ARB] #i desired WCS name +double wx, wy #o output coordinates + +double ox, oy, tmp +real epoch +pointer im, co, nco +char buf[SZ_LINE] +int stat + +real imgetr() +int imaccf(), sk_stati(), sk_decwstr() +bool streq() + +errchk imgetr + +begin + im = IMG_IM(img) + co = IMG_CO(img) + + wx = x # fallback values + wy = y + + switch (system) { + case SYS_NONE: + wx = x + wy = y + case SYS_DISPLAY: + call img_ltov (im, x, y, wx, wy) + #wx = x + #wy = y + case SYS_PHYSICAL: + if (IMG_CTP(img) != NULL) + call mw_c2trand (IMG_CTP(img), x, y, wx, wy) + case SYS_WORLD: + if (IMG_CTW(img) != NULL) { + call mw_c2trand (IMG_CTW(img), x, y, wx, wy) + + # Check for transposed image. + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) { + tmp = wx + wx = wy + wy = tmp + } + } + case SYS_AMP: + if (IMG_CTA(img) != NULL) + call mw_c2trand (IMG_CTA(img), x, y, wx, wy) + case SYS_CCD: + if (IMG_CTD(img) != NULL) + call mw_c2trand (IMG_CTD(img), x, y, wx, wy) + case SYS_DETECTOR: + if (IMG_CTD(img) != NULL) + call mw_c2trand (IMG_CTD(img), x, y, wx, wy) + case SYS_SKY: + # Note Ecliptic/GAPPT coords need an epoch value. + if (imaccf (im, "EPOCH") == YES) { + epoch = imgetr (im, "EPOCH") + if (epoch == 0.0 || IS_INDEFR(epoch)) + epoch = 1950.0 + } else + epoch = 1950.0 + + if (streq (wcsname, "ecliptic") || streq (wcsname, "gappt")) { + call sprintf (buf, SZ_LINE, "%s %.1f") + if (streq (wcsname, "gappt")) + call pargstr ("apparent") + else + call pargstr (wcsname) + call pargr (epoch) + } else { + call sprintf (buf, SZ_LINE, "%s") + if (streq(wcsname,"gappt")) + call pargstr ("apparent") + else if (streq(wcsname,"fk4-no-e")) + call pargstr ("noefk4") + else + call pargstr (wcsname) + } + + stat = sk_decwstr (buf, nco, co) + if (stat != ERR) { + if (IMG_CTW(img) != NULL) + call mw_c2trand (IMG_CTW(img), x, y, ox, oy) + call sk_lltran (co, nco, DEGTORAD(ox), DEGTORAD(oy), + INDEFD, INDEFD, 0.0d0, 0.0d0, wx, wy) + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) { + wx = RADTODEG(wy) # transposed image + wy = RADTODEG(wx) + } else { + wx = RADTODEG(wx) # regular image + wy = RADTODEG(wy) + } + } else { + wx = x + wy = y + } + case SYS_OTHER: + ; # TBD + + default: # default coords + wx = x + wy = y + } +end + + +# IMG_LTOV -- Convert coordinate from the logical coordinate system to the +# output coordinate system. + +procedure img_ltov (im, xin, yin, xout, yout) + +pointer im # the input image descriptor +double xin # the input x coordinate +double yin # the input y coordinate +double xout # the output x coordinate +double yout # the output y coordinate + +int index1, index2 + +begin + index1 = IM_VMAP(im,1) + index2 = IM_VMAP(im,2) + + xout = xin * IM_VSTEP(im,index1) + IM_VOFF(im,index1) + yout = yin * IM_VSTEP(im,index2) + IM_VOFF(im,index2) +end + + +# IMG_VTOL -- Convert coordinate from the tv coordinate system to the +# logical coordinate system. + +procedure img_vtol (im, xin, yin, xout, yout) + +pointer im # the input image descriptor +double xin # the input x coordinate +double yin # the input y coordinate +double xout # the output x coordinate +double yout # the output y coordinate + +int index1, index2 + +begin + index1 = IM_VMAP(im,1) + index2 = IM_VMAP(im,2) + + xout = (xin - IM_VOFF(im,index1)) / IM_VSTEP(im,index1) + yout = (yin - IM_VOFF(im,index2)) / IM_VSTEP(im,index2) +end diff --git a/vendor/x11iraf/ximtool/clients/wcspix/wcimage.x.bak b/vendor/x11iraf/ximtool/clients/wcspix/wcimage.x.bak new file mode 100644 index 00000000..87a12a39 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/wcimage.x.bak @@ -0,0 +1,1515 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <math.h> +include <imio.h> +include <imhdr.h> +include <time.h> +include <ctype.h> +include <mwset.h> +include <pkg/skywcs.h> +include "wcspix.h" + + +# Image class data. +define LEN_IMGDATA 15 +define IMG_WP Memi[$1 ] # wcspix back-pointer +define IMG_IM Memi[$1+1] # image pointer +define IMG_BPM Memi[$1+2] # bad pixel mask pointer +define IMG_MW Memi[$1+3] # image wcs pointer +define IMG_CO Memi[$1+4] # skywcs transform pointer +define IMG_CTW Memi[$1+5] # mwcs log->world transform ptr +define IMG_CTP Memi[$1+6] # mwcs log->phys transform ptr +define IMG_CTA Memi[$1+7] # mwcs log->amplifier transform +define IMG_CTD Memi[$1+8] # mwcs log->detector transform +define IMG_ROT Memr[$1+9] # rotation angle +define IMG_SCALE Memr[$1+10] # plate scale +define IMG_LINEAR Memi[$1+11] # linear coords + + +define IMG_DEBUG FALSE + + +# IMG_INIT -- Initialize the object structure. + +procedure img_init (cp, wp) + +pointer cp #i cache pointer +pointer wp #i WCSPIX structure + +pointer img # data pointer + +begin + if (IMG_DEBUG) call printf ("img_init: \n") + + # Allocate the image data structure if not previously allocated. + if (C_DATA(cp) == NULL) { + iferr (call calloc (C_DATA(cp), LEN_IMGDATA, TY_STRUCT)) + return + } + + img = C_DATA(cp) + IMG_WP(img) = wp + IMG_IM(img) = NULL + IMG_BPM(img) = NULL + IMG_MW(img) = NULL + IMG_CO(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CTA(img) = NULL + IMG_CTD(img) = NULL + IMG_ROT(img) = 0.0 + IMG_SCALE(img) = 0.0 + IMG_LINEAR(img) = YES +end + + +# IMG_CACHE -- Cache an image in the object cache. + +procedure img_cache (cp, objid, regid, ref) + +pointer cp #i cache pointer +int objid #i object id +int regid #i region id +char ref[ARB] #i object reference + +pointer img, im, wp, co +int stat, i1, i2 +char alert[SZ_LINE] + +pointer immap(), ds_pmmap(), mw_sctran() +pointer img_amp_wcs(), img_det_wcs() +int imaccf(), sk_decim() + +errchk immap, ds_pmmap, mw_sctran, sk_decim, sk_setd + +begin + if (IMG_DEBUG) call printf ("img_cache: \n") + + # Now map the image and WCS. + img = C_DATA(cp) + wp = IMG_WP(img) + + iferr (IMG_IM(img) = immap (ref, READ_ONLY, 0)) { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "Unable to cache\n%s") + call pargstr (ref) + call ism_alert (alert, "", "") + return + } + im = IMG_IM(img) + + IMG_CO(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CTA(img) = NULL + IMG_CTD(img) = NULL + iferr { + stat = sk_decim (IMG_IM(img), "world", IMG_MW(img), IMG_CO(img)) + if (IMG_DEBUG) { + call eprintf ("img_cache - decim: stat=%d mw=%d co=%d \n") + call pargi(stat);call pargi(IMG_MW(img)) + call pargi(IMG_CO(img)); + } + if (stat == ERR || IMG_MW(img) == NULL) { + IMG_LINEAR(img) = YES + + co = IMG_CO(img) + i1 = IM_VMAP(im,1) + i2 = IM_VMAP(im,2) + call sk_setd (co, S_VXOFF, double(IM_VOFF(im,i1))) + call sk_setd (co, S_VYOFF, double(IM_VOFF(im,i2))) + call sk_setd (co, S_VXSTEP, double(IM_VSTEP(im,i1))) + call sk_setd (co, S_VYSTEP, double(IM_VSTEP(im,i2))) + + IMG_MW(img) = NULL + IMG_LINEAR(img) = YES + } + + if (IMG_MW(img) != NULL) { + IMG_CTW(img) = mw_sctran (IMG_MW(img), "logical", "world", 03B) + IMG_CTP(img) = mw_sctran (IMG_MW(img), "logical", "physical", + 03B) + + # Get the amplifier transformation values if present. + if (imaccf(im,"ATM1_1") == YES && + imaccf(im,"ATM2_2") == YES && + imaccf(im,"ATV1") == YES && + imaccf(im,"ATV2") == YES) + IMG_CTA(img) = img_amp_wcs (im, IMG_MW(img)) + + if (imaccf(im,"DTM1_1") == YES && + imaccf(im,"DTM2_2") == YES && + imaccf(im,"DTV1") == YES && + imaccf(im,"DTV2") == YES) + IMG_CTD(img) = img_det_wcs (im, IMG_MW(img)) + } + + } then { + # Send alert to the GUI. + call sprintf (alert, SZ_FNAME, "Unable to decode image WCS\n%s") + call pargstr (ref) + call ism_alert (alert, "", "") + IMG_LINEAR(img) = YES + } + + + # See if we can find a bad pixel mask. + IMG_BPM(img) = NULL + if (WP_BPM(wp) == YES) { + iferr (IMG_BPM(img) = ds_pmmap ("BPM", IMG_IM(img))) + IMG_BPM(img) = NULL + } + + C_OBJID(cp) = objid + C_REGID(cp) = regid + C_NREF(cp) = C_NREF(cp) + 1 + call strcpy (ref, C_REF(cp), 128) +end + + +# IMG_UNCACHE -- Uncache an image in the object cache. + +procedure img_uncache (cp, id) + +pointer cp #i cache pointer +int id #i image id + +pointer img + +begin + if (IMG_DEBUG) call printf ("img_uncache: \n") + + C_OBJID(cp) = NULL + C_NREF(cp) = 0 + call strcpy ("", C_REF(cp), SZ_FNAME) + + img = C_DATA(cp) + if (IMG_MW(img) != NULL) + call mw_close (IMG_MW(img)) + if (IMG_BPM(img) != NULL) + call imunmap (IMG_BPM(img)) + if (IMG_IM(img) != NULL) + call imunmap (IMG_IM(img)) + + IMG_IM(img) = NULL + IMG_BPM(img) = NULL + IMG_MW(img) = NULL + IMG_CTW(img) = NULL + IMG_CTP(img) = NULL + IMG_CTA(img) = NULL + IMG_CTD(img) = NULL + IMG_CO(img) = NULL + IMG_ROT(img) = 0.0 + IMG_SCALE(img) = 0.0 + IMG_LINEAR(img) = NO + + call mfree (C_DATA(cp), TY_STRUCT) + C_DATA(cp) = NULL +end + + +# IMG_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. Message is returned as something like: +# +# set value { +# { object <objid> } { region <regionid> } +# { pixval <pixel_value> [<units>] } +# { bpm <bpm_pixel_value> } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# : +# } + + +procedure img_wcstran (cp, id, x, y) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords + +pointer img, im, wp, co +double dx, dy, wx, wy +real rx, ry, pixval +int i, bpm + +# Use static storage to avoid allocation overhead. +char buf[SZ_LINE] +char msg[SZ_LINE], wcs[LEN_WCSNAME], xc[LEN_WCSNAME], yc[LEN_WCSNAME] +char xunits[LEN_WCSNAME], yunits[LEN_WCSNAME] + +double sk_statd() + +begin + if (IMG_DEBUG) call printf ("img_wcstran: \n") + + img = C_DATA(cp) # initialize + co = IMG_CO(img) + wp = IMG_WP(img) + im = IMG_IM(img) + + # Get the translation to the image section. + dx = (double(x) - sk_statd(co,S_VXOFF)) / sk_statd(co,S_VXSTEP) + dy = (double(y) - sk_statd(co,S_VYOFF)) / sk_statd(co,S_VYSTEP) + rx = dx + ry = dy + + # Read the pixel data. + call img_get_data (cp, id, rx, ry, pixval, bpm) + + # Begin formatting the message. + call aclrc (msg, SZ_LINE) + call sprintf (msg, SZ_LINE, "wcstran { object %d } { region %d } ") + call pargi (C_OBJID(cp)) + call pargi (C_REGID(cp)) + + call sprintf (buf, SZ_LINE, "{ pixval %9.9g } { bpm %d }\n") + call pargr (pixval) + call pargi (bpm) + call strcat (buf, msg, SZ_LINE) + + # Now loop over the requested systems and generate a coordinate + # for each. + for (i=1; i <= MAX_WCSLINES; i=i+1) { + + # Get the coordinate value. + call img_get_coord (img, dx, dy, SYSTEMS(wp,i), WCSNAME(wp,i), + wx, wy) + + # Get the system name, labels, and formats strings for the WCS. + call img_coord_labels (cp, i, wcs, xunits, yunits) + + # Format the values as requested. + call img_coord_fmt (cp, i, wx, wy, xc, yc) + + # Format the coord buffer and append it to the message. + call sprintf (buf, SZ_LINE, + "{coord {%9s} {%12s} {%12s} {%4s} {%4s}}\n") + call pargstr (wcs) + call pargstr (xc) + call pargstr (yc) + call pargstr (xunits) + call pargstr (yunits) + call strcat (buf, msg, SZ_LINE) + } + + # Now send the completed message. + call wcspix_message (msg); +end + + +# IMG_WCSLIST -- List the WCSs available for the given image. + +procedure img_wcslist (cp, id) + +pointer cp #i cache pointer +int id #i image id + +pointer img, im, mw +char msg[SZ_LINE] + +begin + if (IMG_DEBUG) call printf ("img_wcslist: \n") + + img = C_DATA(cp) # initialize + mw = IMG_MW(img) + im = IMG_IM(img) + + call strcpy ("wcslist {None Display Logical World Physical line ", + msg, SZ_LINE) + + # See if we can do amplifier/detector coords by checking for ATM/ATV + # and DTM/DTV keywords. + + if (IMG_CTA(img) != NULL) + call strcat (" Amplifier ", msg, SZ_LINE) + if (IMG_CTD(img) != NULL) + call strcat (" Detector ", msg, SZ_LINE) + if (IMG_CTA(img) != NULL || IMG_CTD(img) != NULL) + call strcat (" CCD ", msg, SZ_LINE) + + # If we have a MWCS pointer list the sky projections. + if (mw != NULL) { + call strcat (" line ", msg, SZ_LINE) + call strcat (SKYPROJ, msg, SZ_LINE) + } + + # Close the message. + call strcat ("}", msg, SZ_LINE) + + call wcspix_message (msg) +end + + +# IMG_GET_DATA -- Get data from the image. + +procedure img_get_data (cp, id, x, y, pixval, bpm_pix) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords +real pixval #o central pixel value +int bpm_pix #o bad pixel mask value + +pointer img, wp, im, bpm, pix, sp, msg, buf +int nl, nc, ix, iy, s2 +int size, x1, x2, y1, y2 + +long clktime() +pointer imgs2r(), imgs2i(), ds_pmmap() +errchk ds_pmmap + +begin + + img = C_DATA(cp) + wp = IMG_WP(img) + im = IMG_IM(img) + bpm = IMG_BPM(img) + nc = IM_LEN(im,1) + nl = IM_LEN(im,2) +# size = WP_PTABSZ(wp) + size = min(min(nc,nl),WP_PTABSZ(wp)) + + if (IMG_DEBUG) { + call printf ("img_get_data: \n") + call eprintf ("\tx: %g y: %g nc: %d nl: %d\n") + call pargr(x); call pargr(y); call pargi(nc); call pargi(nl) + } + + # Sanity check on the cursor image position. + if (x < 0.0 || y < 0.0 || x > (nc+0.5) || y > (nl+0.5)) + return + + # Bounds checking. Rather than deal with out of bounds pixels we'll + # adjust the center pixel so we get the same size raster up to each + # boundary. + + ix = int (x + 0.5) ; iy = int (y + 0.5) + ix = min (ix, (nc-(size/2)-1)) ; iy = min (iy, (nl-(size/2)-1)) + ix = max (size/2+1, ix) ; iy = max (size/2+1, iy) + + # Compute the box offset given the center and size. + x1 = ix - size / 2 + 0.5 + x2 = ix + size / 2 + 0.5 + y1 = iy - size / 2 + 0.5 + y2 = iy + size / 2 + 0.5 + + if (IMG_DEBUG) { + call printf ("img_get_data: \n") + call eprintf ("\tix: %d iy: %g size: %d\n") + call pargi(ix); call pargi(iy); call pargi(size) + call eprintf ("\tx1: %d y1: %d x2: %d y2: %d\n") + call pargi(x1); call pargi(y1); + call pargi(x2); call pargi(y2); + } + + x1 = max (1, x1) + x2 = min (nc, x2) + y1 = max (1, y1) + y2 = min (nl, y2) + + if (IMG_DEBUG) { + call eprintf ("\tx1: %d y1: %d x2: %d y2: %d\n") + call pargi(x1); call pargi(y1); + call pargi(x2); call pargi(y2); + } + + # Get the image pixels + pix = imgs2r (im, int(x1), int(x2), int(y1), int(y2)) + + if (WP_BPM(wp) == YES) { + if (bpm != NULL) { + bpm_pix = Memi[imgs2i (bpm, ix, ix, iy, iy)] + } else { + # See if we can find a bad pixel mask. The option is enabled + # but we haven't mappend the mask yet. + + # Log the event. + call smark (sp) + call salloc (msg, SZ_LINE, TY_CHAR) + call salloc (buf, SZ_LINE, TY_CHAR) + call wp_cnvdate (clktime(0), Memc[buf], SZ_DATE) + call sprintf (Memc[msg], SZ_LINE, + "info { %s: WCSPIX BPM map objid=%3d %s}\n") + call pargstr (Memc[buf]) + call pargi (C_OBJID(cp)) + call pargstr (C_REF(cp)) + call ism_message ("ism_msg", Memc[msg]) + + iferr (IMG_BPM(img) = ds_pmmap ("BPM", im)) { + IMG_BPM(img) = NULL + bpm_pix = 0 + + # Send alert to the GUI. + call sprintf (Memc[buf], SZ_FNAME, + "Unable to map BPM image for\n%s") + call pargstr (C_REF(cp)) + call ism_alert (Memc[buf], "", "") + } else + bpm_pix = Memi[imgs2i (IMG_BPM(img), ix, ix, iy, iy)] + + call sfree (sp) + } + } else + bpm_pix = 0 + + # See if we're near an edge... + s2 = size / 2 + if (int(x)<s2 || int(x)>(nl-s2-1) || int(y)<s2 || int(x)>(nc-s2-1)) { + # Compute the image pixel associated with the requested coords. + ix = int (x + 0.5) + iy = int (y + 0.5) + pixval = Memr[imgs2r(im, ix, ix, iy, iy)] + } else { + pixval = Memr[pix + ((size/2)*size) + (size/2)] + } + + # Send the pixel table. + if (WP_PTABSZ(wp) > 1) + call img_send_pixtab (Memr[pix], WP_PTABSZ(wp), x1, x2, y1, y2) + + if (IMG_DEBUG) { + call printf ("img_get_data: pixval=%g\n") ; call pargr (pixval) + } +end + + +# IMG_OBJINFO -- Get header information from the image. + +procedure img_objinfo (cp, id, template) + +pointer cp #i cache pointer +int id #i image id +char template[ARB] #i keyword template + +pointer im, img + +define WCS_TEMPLATE "WCSDIM,CTYPE*,CRPIX*,CRVAL*,CD*,CROTA2,LTV*,LTM*,WSV*,WAT*,RA*,DEC*,EQUINOX,EPOCH,MJD*,DATE-OBS" + +begin + if (IMG_DEBUG) call printf ("img_objinfo: \n") + + # Send the full header (or keyword filtered header), only the WCS + # keywords, and a plain-text explanation of the WCS. + + img = C_DATA(cp) + im = IMG_IM(img) + + call img_send_header (im, "imghdr", template) + call img_send_header (im, "wcshdr", WCS_TEMPLATE) + call img_send_wcsinfo (im, cp) + call img_send_compass (im, cp) +end + + + +#============================================================================== + +# IMG_SEND_HEADER -- Send an image header to the named GUI object. Keywords +# are filtered according to a specified template + +procedure img_send_header (im, object, template) + +pointer im #i image descriptor +char object[ARB] #i object for the message +char template[ARB] #i keyword template + +pointer sp, hdr, lbuf, line, field, keyw, dict +pointer ip, lp, list +int nlines, in, out, i, hdr_size +bool keyw_filter + +int stropen(), getline(), stridx(), imgnfn(), strdic() +pointer imofnlu() +bool streq() +errchk stropen, getline, putci, putline, imgnfn, imofnlu, strdic + +define USER_AREA Memc[($1+IMU-1)*SZ_STRUCT + 1] +define SZ_KEYW 8 + +begin + hdr_size = (LEN_IMDES + IM_LENHDRMEM(im) - IMU) * SZ_STRUCT - 1 + hdr_size = hdr_size + SZ_LINE + + call smark (sp) + call salloc (hdr, hdr_size, TY_CHAR) + call salloc (dict, hdr_size, TY_CHAR) + call salloc (field, SZ_LINE, TY_CHAR) + call salloc (lbuf, SZ_LINE, TY_CHAR) + call salloc (line, SZ_LINE, TY_CHAR) + call salloc (keyw, SZ_KEYW, TY_CHAR) + + in = stropen (USER_AREA(im), hdr_size, READ_ONLY) + out = stropen (Memc[hdr], hdr_size, WRITE_ONLY) + call fprintf (out, "%s {") + call pargstr (object) + + # Build up a dictionary of header keywords based on the template. + keyw_filter = (!streq (template, "*")) + if (keyw_filter) { + list = imofnlu (im, template) + call strcpy ("|", Memc[dict], hdr_size) + while (imgnfn (list, Memc[field], SZ_FNAME) != EOF) { + call strcat (Memc[field], Memc[dict], hdr_size) + call strcat ("|", Memc[dict], hdr_size) + } + call imcfnl (list) + } + + + # Copy header records to the output, stripping any trailing + # whitespace and clipping at the right margin. We also filter + # against the keyword dictionary found above. + + nlines = 0 + while (getline (in, Memc[lbuf]) != EOF) { + + call aclrc (Memc[line], SZ_LINE) + + # Escape any brackets passed to the Tcl. + ip = lbuf + lp = line + while (Memc[ip] != EOS && Memc[ip] != '\n') { + if (stridx (Memc[ip], "[{") > 0) { + Memc[lp] = '\\' + lp = lp + 1 + } + Memc[lp] = Memc[ip] + ip = ip + 1 + lp = lp + 1 + } + Memc[lp] = '\n' + Memc[lp+1] = EOS + + # See whether the line matches a keyword we want to output. + if (keyw_filter) { + for (i=0; i < SZ_KEYW && !IS_WHITE(Memc[line+i]); i=i+1) + Memc[keyw+i] = Memc[line+i] + Memc[keyw+i] = '\0' + + # If not in the dictionary skip to the next line. + if (strdic (Memc[keyw], Memc[keyw], SZ_KEYW, Memc[dict]) == 0) + next + } + + call putci (out, ' ') + call putline (out, Memc[line]) + + # Send the header in small chunks so we don't overflow the + # message buffer. + nlines = nlines + 1 + if (mod(nlines,10) == 0) { + call fprintf (out, "}") + call close (out) + call wcspix_message (Memc[hdr]); + call aclrc (Memc[hdr], hdr_size) + out = stropen (Memc[hdr], hdr_size, WRITE_ONLY) + call fprintf (out, "%s {") + call pargstr (object) + } + } + call fprintf (out, "}") + + call close (in) + call close (out) + + # Send the final message. + call wcspix_message (Memc[hdr]) + + # Pad a few lines for the GUI + call sprintf (Memc[hdr], SZ_LINE, "%d { \n\n\n }") + call pargstr (object) + call wcspix_message (Memc[hdr]) + + call sfree (sp) +end + + +# IMG_SEND_COMPASS -- Send information about the image WCS in a plain-english +# string. + +procedure img_send_compass (im, cp) + +pointer im #i image descriptor +pointer cp #i cache element pointer + +pointer sp, buf, img, co, mw +double cx, cy, cx1, cy1, dx, dy, x1, y1 +double cosa, sina, angle +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] +int i, j, comp_x, comp_y +long axis[IM_MAXDIM], lv[IM_MAXDIM], pv1[IM_MAXDIM], pv2[IM_MAXDIM] +bool fp_equalr() + +real length, north[2], east[2] + +int mw_stati(), sk_stati() + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call aclrc (Memc[buf], SZ_LINE) + + # Get the data pointer. + img = C_DATA(cp) + co = IMG_CO(img) + + # Get world coords at the image corners. + if (IMG_CTW(img) != NULL) { + + if (fp_equalr(IMG_ROT(img),0.0)) + angle = -IMG_ROT(img) + else if (IMG_ROT(img) > 0.0) + angle = -IMG_ROT(img) + else + angle = IMG_ROT(img) + 360.0 + cosa = cos (DEGTORAD(angle)) + sina = sin (DEGTORAD(angle)) +call eprintf ("compass: angle = %g sina=%g cosa=%g\n") +call pargd(angle); call pargd(sina); call pargd(cosa) + + # Image center position + cx = IM_LEN(im,1) / 2.0d0 + cy = IM_LEN(im,2) / 2.0d0 + call mw_c2trand (IMG_CTW(img), cx, cy, cx1, cy1) + + # Extend a unit vector up from the center assuming it's North + # and rotate it by the wcs angle. + dx = cx + ( 10.0 * sina) + dy = cy + ( 10.0 * cosa) + call mw_c2trand (IMG_CTW(img), dx, dy, x1, y1) + + # Check new point Y value relative to the center position. + if (y1 >= cy1) + comp_y = 1 # North is up + else + comp_y = -1 # North is down +call eprintf ("compass: y1=%g cy1=%g \n");call pargd(y1);call pargd(cy1) + + # Extend a unit vector left from the center assuming it's East + # and rotate it by the wcs angle. + dx = cx + (-10.0 * cosa) + dy = cy + ( 10.0 * sina) + call mw_c2trand (IMG_CTW(img), dx, dy, x1, y1) + + # Check new point X value relative to the center position. + if (x1 >= cx1) + comp_x = 1 # East is left and we have a WCS + else + comp_x = -1 # East is right +call eprintf ("compass: x1=%g cx1=%g \n");call pargd(x1);call pargd(cx1) + +#------------------------------ +# New compass algorithm +#------------------------------ + + # Get the CD matrix for the image. + mw = IMG_MW(img) + call wcs_gfterm (mw, r, w, cd, mw_stati(mw, MW_NPHYSDIM)) + call img_cvectors (cd, 1.0, north, east) + + if (y1 >= 0.0) + comp_y = 1 # North is up + else + comp_y = -1 # North is down + + if (x1 >= 0.0) + comp_x = 1 # East is left + else + comp_x = -1 # East is right + + } else { + # Determine the logical to physical mapping by evaluating two + # points and determining the axis reduction if any. pv1 will be + # the offset and pv2-pv1 will be the scale. + + lv[1] = 0; lv[2] = 0; call imaplv (im, lv, pv1, 2) + lv[1] = 1; lv[2] = 1; call imaplv (im, lv, pv2, 2) + + i = 1 + axis[1] = 1; axis[2] = 2 + do j = 1, IM_MAXDIM { + if (pv1[j] != pv2[j]) { + axis[i] = j + i = i + 1 + } + } + comp_x = - (pv2[axis[1]] - pv1[axis[1]]) + comp_y = (pv2[axis[2]] - pv1[axis[2]]) + } + + call sprintf (Memc[buf], SZ_LINE, "compass %d %g %d %d %d %s\0") + call pargi (C_OBJID(cp)) + call pargr (IMG_ROT(img)) + call pargi (comp_x) + call pargi (comp_y) + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) + call pargi (1) # transposed image + else + call pargi (0) + if (IMG_MW(img) != NULL) + call pargstr ("E N") + else + call pargstr ("X Y") +call eprintf ("msg: '%s'\n");call pargstr(Memc[buf]) + + call wcspix_message (Memc[buf]) + call sfree (sp) +end + + +# IMG_CVECTORS -- Get north and east vectors for the compass + +procedure img_cvectors (cd, length, north, east) + +double cd[2,2] #i CD matrix +real length #i length of vectors +real north[2] #o vector pointing north +real east[2] #o vector pointing east + +double d # determinant of CD matrix +double x, y # scratch for vector components +double l # length of a vector + +begin + d = cd[1,1] * cd[2,2] - cd[1,2] * cd[2,1] + if (d == 0.d0) + call error (1, "CD matrix is singular") + + # North. + x = -cd[1,2] / d + y = cd[1,1] / d + + # Normalize by the length and copy to output. + l = sqrt (x**2 + y**2) + north[1] = x * length / l + north[2] = y * length / l + + # East. + x = cd[2,2] / d + y = -cd[2,1] / d + l = sqrt (x**2 + y**2) + east[1] = x * length / l + east[2] = y * length / l + +call eprintf ("new: north (%g,%g) east (%g,%g)\n") +call pargr(north[1]);call pargr(north[2]) +call pargr(east[1]) ;call pargr(east[2]) +end + + + +# IMG_SEND_WCSINFO -- Send information about the image WCS in a plain-english +# string. + +procedure img_send_wcsinfo (im, cp) + +pointer im #i image descriptor +pointer cp #i cache element pointer + +pointer sp, co, img, mw +pointer buf, proj, radecstr +int fd, radecsys, ctype, wtype, ndim +double crpix1, crpix2, crval1, crval2, cval1, cval2 +double xscale, yscale, xrot, yrot +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM], + +int idxstr(), sk_stati(), stropen(), mw_stati() +double sk_statd(), sl_epj(), sl_epb() +bool fp_equald() + +errchk stropen + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + call salloc (proj, SZ_FNAME, TY_CHAR) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + + # Open a string on a file. + fd = stropen (Memc[buf], SZ_LINE, WRITE_ONLY) + + # Get the data pointer. + img = C_DATA(cp) + + # Get the coordinate transform descriptor. + co = IMG_CO(img) + radecsys = sk_stati (co, S_RADECSYS) + ctype = sk_stati (co, S_CTYPE) + wtype = sk_stati (co, S_WTYPE) + + mw = IMG_MW(img) + if (mw != NULL) { + # Now get the mwcs Rterm (CRPIXi), Wterm (CRVALi), and CD matrix. + ndim = mw_stati (mw, MW_NPHYSDIM) + call wcs_gfterm (mw, r, w, cd, ndim) + crpix1 = r[1] + crpix2 = r[2] + crval1 = w[1] + crval2 = w[2] + + xscale = sqrt (cd[1,1]**2 + cd[2,1]**2) * 3600.0d0 + yscale = sqrt (cd[1,2]**2 + cd[2,2]**2) * 3600.0d0 + xrot = 0.0 + yrot = 0.0 + if (!fp_equald (cd[1,1], 0.0d0)) + xrot = DRADTODEG(atan ( cd[2,1] / cd[1,1])) + if (!fp_equald (cd[2,2], 0.0d0)) + yrot = DRADTODEG(atan (-cd[1,2] / cd[2,2])) + } else { + ndim = 2 + xscale = 1.0 + yscale = 1.0 + xrot = 0.0 + yrot = 0.0 + } + + if (IMG_DEBUG) { + call printf("WCS Info:\n=========\n") + call printf("R term: %g %g\n"); call pargd(r[1]); call pargd(r[2]) + call printf("W term: %g %g\n"); call pargd(w[1]); call pargd(w[2]) + call printf(" cd: %g %g\n %g %g\n") + call pargd(cd[1,1]); call pargd(cd[1,2]) + call pargd(cd[2,1]); call pargd(cd[2,2]) + call printf(" scale: %g %g\n");call pargd(xscale);call pargd(yscale) + call printf(" rot: %g %g\n");call pargd(xrot);call pargd(yrot) + } + + IMG_SCALE(img) = (xscale + yscale) / 2.0d0 + #IMG_ROT(img) = (xrot + yrot) / 2.0d0 + IMG_ROT(img) = xrot + + + # Now format a WCS text panel such as + # + # Projection: TAN System: Equatorial FK5 + # Ra/Dec axes: 1/2 Dimensions: 512 x 512 + # + # Center Pos: RA: 13:29:52.856 Dec: +47:11:40.39 + # Reference Pos: RA: 13:29:52.856 Dec: +47:11:40.39 + # Ref pixel coord: X: 250.256 Y: 266.309 + # Plate Scale: 0.765194 Rot Angle: 1.02939 + # Equinox: J2000.000 Epoch: J1987.25775240 + # MJD: 46890.39406 + + # Get some preliminary values. + if (idxstr (radecsys, Memc[radecstr], SZ_FNAME, EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + + if (idxstr (wtype, Memc[proj], SZ_FNAME, WTYPE_LIST) <= 0) + call strcpy ("logical", Memc[proj], SZ_FNAME) + call strupr (Memc[proj]) + + call fprintf (fd, "wcsinfo {\n") + + call fprintf (fd, + " Projection: %-6s\t System: %s %s\n") + call pargstr (Memc[proj]) + switch (ctype) { + case CTYPE_EQUATORIAL: + call pargstr ("Equatorial") + call pargstr (Memc[radecstr]) + case CTYPE_ECLIPTIC: + call pargstr ("Ecliptic") + call pargstr ("") + case CTYPE_GALACTIC: + call pargstr ("Galactic") + call pargstr ("") + case CTYPE_SUPERGALACTIC: + call pargstr ("SuperGalactic") + call pargstr ("") + default: + call pargstr ("Linear") + call pargstr ("") + } + + call fprintf (fd, " Ra/Dec axes: %d/%d") + call pargi (sk_stati (co, S_PLNGAX)) + call pargi (sk_stati (co, S_PLATAX)) + call fprintf (fd, " Dimensions: %d x %d\n\n") + call pargi (IM_LEN(im,1)) + call pargi (IM_LEN(im,2)) + + call fprintf (fd, + " Center Pos: %3s: %-12H %3s: %-12h\n") + if (ctype == CTYPE_EQUATORIAL) + call pargstr (" RA") + else + call pargstr ("Lon") + call pargd (cval1) + if (ctype == CTYPE_EQUATORIAL) + call pargstr ("Dec") + else + call pargstr ("Lat") + call pargd (cval2) + + call fprintf (fd, + " Reference Pos: %3s: %-12H %3s: %-12h\n") + if (ctype == CTYPE_EQUATORIAL) + call pargstr (" RA") + else + call pargstr ("Lon") + call pargd (crval1) + if (ctype == CTYPE_EQUATORIAL) + call pargstr ("Dec") + else + call pargstr ("Lat") + call pargd (crval2) + + call fprintf (fd, + " Reference Pixel: X: %-9.4f Y: %-9.4f\n") + call pargd (crpix1) + call pargd (crpix2) + + call fprintf (fd, + " Plate Scale: %-8f Rot Angle: %-8f\n") + call pargr (IMG_SCALE(img)) + call pargr (IMG_ROT(img)) + + call fprintf (fd, + " Equinox: %s%8f Epoch: %s%.6f\n") + switch (radecsys) { + case EQTYPE_FK5, EQTYPE_ICRS: + call pargstr ("J") ; call pargd (sk_statd(co,S_EQUINOX)) + call pargstr ("J") ; call pargd (sl_epj(sk_statd(co,S_EPOCH))) + default: + if (IMG_LINEAR(img) == YES) { + call pargstr (" ") ; call pargd (INDEFD) + call pargstr (" ") ; call pargd (INDEFD) + } else { + call pargstr ("B") + call pargd (sk_statd(co,S_EQUINOX)) + call pargstr ("B") + call pargd (sl_epb(sk_statd(co,S_EPOCH))) + } + } + + call fprintf (fd, " MJD: %.6f\n") + call pargd (sk_statd(co,S_EPOCH)) + + call fprintf (fd, "}\n \n \n") + + # Close the formatted string and send the message. + call close (fd) + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_SEND_PIXTAB -- Send a 'pixtab' message. Format of the message is +# +# pixtab { +# { {pix} {pix} ... } # pixel table values +# { {x1} {x2} ... } # column label values +# { {y1} {y2} ... } # row label values +# { <mean> <stdev> } # pixtab statistics +# } +# + +procedure img_send_pixtab (pixtab, size, x1, x2, y1, y2) + +real pixtab[ARB] #i pixtab array +int size #i pixtab size +int x1, x2, y1, y2 #i raster boundaries + +pointer sp, buf, el +int i, j, npix +real pix, sum, sum2, mean, var, stdev, x, y + +define SZ_PIXTAB (6*SZ_LINE) + +begin + call smark (sp) + call salloc (buf, SZ_PIXTAB, TY_CHAR) + call salloc (el, SZ_FNAME, TY_CHAR) + + # Begin the pixtab message. + call strcpy ("pixtab {\n{\ntable {\n", Memc[buf], SZ_PIXTAB) + + # Format the pixels into a table for presentation. Do the y-flip + # here so the pixels are in order for the List widget in the GUI. + # Accumulate the pixel statistics so we don't have to do it in the + # GUI where it's slower. + + sum = 0.0 + sum2 = 0.0 + npix = size * size + + for (i=size - 1; i >= 0; i=i-1) { + for (j=1; j <= size; j=j+1) { + pix = pixtab[(i * size) + j] + sum = sum + pix + sum2 = sum2 + (pix * pix) + + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (pix) + + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("\n", Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n}\n", Memc[buf], SZ_PIXTAB) + + + # Do the row and column label parts of the message. + call strcat ("{", Memc[buf], SZ_PIXTAB) + for (x = x1; x <= x2; x = x + 1.) { + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (x) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n", Memc[buf], SZ_PIXTAB) + + call strcat ("{", Memc[buf], SZ_PIXTAB) + for (y = y2; y >= y1; y = y - 1.) { + call sprintf (Memc[el], SZ_FNAME, " {%10.1f}") + call pargr (y) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + } + call strcat ("}\n", Memc[buf], SZ_PIXTAB) + + + # Compute the statistics for the raster. + mean = sum / real(npix) + var = (sum2 - sum * mean) / real(npix - 1) + if (var <= 0) + stdev = 0.0 + else + stdev = sqrt (var) + + call sprintf (Memc[el], SZ_FNAME, " { %10.2f %10.4f }\n") + call pargr (mean) + call pargr (stdev) + call strcat (Memc[el], Memc[buf], SZ_PIXTAB) + + + # Close the message. + call strcat ("}", Memc[buf], SZ_PIXTAB) + + if (IMG_DEBUG) { + call eprintf ("pixtab: %s\n");call pargstr(Memc[buf]) + } + + # Send the formatted message. + call wcspix_message (Memc[buf]) + + call sfree (sp) +end + + +# IMG_AMP_WCS -- Create a WCS transformation for the amplifier coordinates. + +pointer procedure img_amp_wcs (im, mw) + +pointer im #i image pointer +pointer mw #i MWCS descriptor + +pointer ct +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] + +double imgetd() +pointer mw_sctran() + +begin + r[1] = 0.0d0 + r[2] = 0.0d0 + w[1] = imgetd (im, "ATV1") + w[2] = imgetd (im, "ATV2") + cd[1,1] = imgetd (im, "ATM1_1") + cd[1,2] = 0.0d0 + cd[2,1] = 0.0d0 + cd[2,2] = imgetd (im, "ATM2_2") + + # Create a new named system. + call mw_newsystem (mw, "amplifier", 2) + + # Set the new Wterm for the system. + call mw_swtermd (mw, r, w, cd, 2) + + # Set up the transform. + ct = mw_sctran (mw, "logical", "amplifier", 03B) + + # Reset the default world system. + call mw_sdefwcs (mw) + + return (ct) +end + + +# IMG_DET_WCS -- Create a WCS transformation for the detector coordinates. + +pointer procedure img_det_wcs (im, mw) + +pointer im #i image pointer +pointer mw #i MWCS descriptor + +pointer ct +double r[IM_MAXDIM], w[IM_MAXDIM], cd[IM_MAXDIM,IM_MAXDIM] + +double imgetd() +pointer mw_sctran() + +begin + r[1] = 0.0d0 + r[2] = 0.0d0 + w[1] = imgetd (im, "DTV1") + w[2] = imgetd (im, "DTV2") + cd[1,1] = imgetd (im, "DTM1_1") + cd[1,2] = 0.0d0 + cd[2,1] = 0.0d0 + cd[2,2] = imgetd (im, "DTM2_2") + + # Create a new named system. + call mw_newsystem (mw, "detector", 2) + + # Set the new Wterm for the system. + call mw_swtermd (mw, r, w, cd, 2) + + # Set up the transform. + ct = mw_sctran (mw, "logical", "detector", 03B) + + # Reset the default world system. + call mw_sdefwcs (mw) + + return (ct) +end + + +# IMG_COORD_LABELS -- Get the WCS name, coord labels and format strings for +# the specified object. + +procedure img_coord_labels (cp, line, wcsname, xunits, yunits) + +pointer cp #i cache pointer +pointer line #i WCS output line +char wcsname[ARB] #o WCS name string +char xunits[ARB], yunits[ARB] #o WCS coord labels + +pointer img, co, wp +pointer sp, proj, radecstr + +int strcmp(), sk_stati(), idxstr() + +begin + img = C_DATA(cp) # initialize ptrs + co = IMG_CO(img) + wp = IMG_WP(img) + + if (SYSTEMS(wp,line) == SYS_WORLD) { + switch (sk_stati(co,S_CTYPE)) { + case CTYPE_EQUATORIAL: + call strcpy (" RA", xunits, LEN_WCSNAME) + call strcpy (" Dec", yunits, LEN_WCSNAME) + case CTYPE_ECLIPTIC: + call strcpy ("ELon", xunits, LEN_WCSNAME) + call strcpy ("ELat", yunits, LEN_WCSNAME) + case CTYPE_GALACTIC: + call strcpy ("GLon", xunits, LEN_WCSNAME) + call strcpy ("GLat", yunits, LEN_WCSNAME) + case CTYPE_SUPERGALACTIC: + call strcpy ("SLon", xunits, LEN_WCSNAME) + call strcpy ("SLat", yunits, LEN_WCSNAME) + } + } else if (SYSTEMS(wp,line) == SYS_SKY) { + call strcpy (WCSNAME(wp,line), wcsname, LEN_WCSNAME) + call strlwr (wcsname) + if (strcmp (wcsname,"ecliptic") == 0) { + call strcpy ("ELon", xunits, LEN_WCSNAME) + call strcpy ("ELat", yunits, LEN_WCSNAME) + } else if (strcmp (wcsname,"galactic") == 0) { + call strcpy ("GLon", xunits, LEN_WCSNAME) + call strcpy ("GLat", yunits, LEN_WCSNAME) + } else if (strcmp (wcsname,"supergalactic") == 0) { + call strcpy ("SLon", xunits, LEN_WCSNAME) + call strcpy ("SLat", yunits, LEN_WCSNAME) + } else { + call strcpy (" RA", xunits, LEN_WCSNAME) + call strcpy (" Dec", yunits, LEN_WCSNAME) + } + } else { + call strcpy ("X", xunits, LEN_WCSNAME) + call strcpy ("Y", yunits, LEN_WCSNAME) + } + + + # Now get the format strings. For systems other than the image + # default just use the WCS string as the name, otherwise format a + # string giving more information about the system. + if (SYSTEMS(wp,line) != SYS_WORLD) + call strcpy (WCSNAME(wp,line), wcsname, LEN_WCSNAME) + + else { + call smark (sp) + call salloc (radecstr, SZ_FNAME, TY_CHAR) + call salloc (proj, SZ_FNAME, TY_CHAR) + + call sprintf (wcsname, LEN_WCSNAME, "%s-%s-%s") + + switch (sk_stati(co,S_CTYPE)) { + case CTYPE_EQUATORIAL: call pargstr ("EQ") + case CTYPE_ECLIPTIC: call pargstr ("ECL") + case CTYPE_GALACTIC: call pargstr ("GAL") + case CTYPE_SUPERGALACTIC: call pargstr ("SGAL") + default: call pargstr ("UNKN") + } + + if (sk_stati(co,S_CTYPE) == CTYPE_EQUATORIAL) { + if (idxstr(sk_stati(co,S_RADECSYS), Memc[radecstr], + SZ_FNAME, EQTYPE_LIST) <= 0) + call strcpy ("FK5", Memc[radecstr], SZ_FNAME) + call strupr (Memc[radecstr]) + call pargstr (Memc[radecstr]) + } else { + if (sk_stati(co,S_CTYPE) == CTYPE_SUPERGALACTIC) + call pargstr ("-") + else + call pargstr ("--") + } + + if (idxstr(sk_stati(co,S_WTYPE), Memc[proj], SZ_FNAME, + WTYPE_LIST) <= 0) + call strcpy ("linear", Memc[proj], SZ_FNAME) + call strupr (Memc[proj]) + call pargstr (Memc[proj]) + + call sfree (sp) + } + + # Now fix up the WCS system name. + if (strcmp (wcsname, "fk4") == 0 || + strcmp (wcsname, "fk5") == 0 || + strcmp (wcsname, "icrs") == 0 || + strcmp (wcsname, "gappt") == 0 || + strcmp (wcsname, "fk4-no-e") == 0) { + call strupr (wcsname) + + } else if (IS_LOWER(wcsname[1])) + wcsname[1] = TO_UPPER(wcsname[1]) +end + + +# IMG_COORD_FMT -- Format the coordinate strings. + +procedure img_coord_fmt (cp, line, xval, yval, xc, yc) + +pointer cp #i object cache pointer +int line #i output line number +double xval, yval #i input coords +char xc[ARB], yc[ARB] #o formatted coord strings + +pointer img, co, wp +char xfmt[LEN_WCSNAME], yfmt[LEN_WCSNAME] + +int sk_stati() +bool streq() + +begin + img = C_DATA(cp) # initialize ptrs + co = IMG_CO(img) + wp = IMG_WP(img) + + # Convert coords to the requested format. + if (FORMATS(wp,line) == FMT_DEFAULT) { + if (IMG_MW(img) == NULL) { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } else { + if (SYSTEMS(wp,line) == SYS_WORLD || + SYSTEMS(wp,line) == SYS_SKY) { + + if (streq(WCSNAME(wp,line),"ecliptic") || + streq(WCSNAME(wp,line),"galactic") || + streq(WCSNAME(wp,line),"supergalactic")) + call strcpy ("%h", xfmt, LEN_WCSNAME) + else + call strcpy ("%.2H", xfmt, LEN_WCSNAME) + call strcpy ("%.1h", yfmt, LEN_WCSNAME) + } else { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } + } + + } else if (FORMATS(wp,line) == FMT_HMS) { + if (sk_stati(co, S_CTYPE) == CTYPE_EQUATORIAL) + call strcpy ("%.2H", xfmt, LEN_WCSNAME) + else + call strcpy ("%.1h", xfmt, LEN_WCSNAME) + call strcpy ("%h", yfmt, LEN_WCSNAME) + } else { + call strcpy ("%10.2f", xfmt, LEN_WCSNAME) + call strcpy ("%10.2f", yfmt, LEN_WCSNAME) + } + + # Convert the value to the requested format + call sprintf (xc, LEN_WCSNAME, xfmt) + if (FORMATS(wp,line) != FMT_RAD) + call pargd (xval) + else + call pargd (DEGTORAD(xval)) + + call sprintf (yc, LEN_WCSNAME, yfmt) + if (FORMATS(wp,line) != FMT_RAD) + call pargd (yval) + else + call pargd (DEGTORAD(yval)) +end + + +# IMG_GET_COORD -- Given an x,y position in the image return the coordinate in +# the given system. + +procedure img_get_coord (img, x, y, system, wcsname, wx, wy) + +pointer img #i IMG struct pointer +double x, y #i input image position +int system #i coordinate system requested +char wcsname[ARB] #i desired WCS name +double wx, wy #o output coordinates + +double ox, oy, tmp +real epoch +pointer im, co, nco +char buf[SZ_LINE] +int stat + +real imgetr() +int imaccf(), sk_stati(), sk_decwstr() +bool streq() + +errchk imgetr + +begin + im = IMG_IM(img) + co = IMG_CO(img) + + wx = x # fallback values + wy = y + + switch (system) { + case SYS_NONE: + wx = x + wy = y + case SYS_DISPLAY: + call img_ltov (im, x, y, wx, wy) + #wx = x + #wy = y + case SYS_PHYSICAL: + if (IMG_CTP(img) != NULL) + call mw_c2trand (IMG_CTP(img), x, y, wx, wy) + case SYS_WORLD: + if (IMG_CTW(img) != NULL) { + call mw_c2trand (IMG_CTW(img), x, y, wx, wy) + + # Check for transposed image. + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) { + tmp = wx + wx = wy + wy = tmp + } + } + case SYS_AMP: + if (IMG_CTA(img) != NULL) + call mw_c2trand (IMG_CTA(img), x, y, wx, wy) + case SYS_CCD: + if (IMG_CTD(img) != NULL) + call mw_c2trand (IMG_CTD(img), x, y, wx, wy) + case SYS_DETECTOR: + if (IMG_CTD(img) != NULL) + call mw_c2trand (IMG_CTD(img), x, y, wx, wy) + case SYS_SKY: + # Note Ecliptic/GAPPT coords need an epoch value. + if (imaccf (im, "EPOCH") == YES) { + epoch = imgetr (im, "EPOCH") + if (epoch == 0.0 || IS_INDEFR(epoch)) + epoch = 1950.0 + } else + epoch = 1950.0 + + if (streq (wcsname, "ecliptic") || streq (wcsname, "gappt")) { + call sprintf (buf, SZ_LINE, "%s %.1f") + if (streq (wcsname, "gappt")) + call pargstr ("apparent") + else + call pargstr (wcsname) + call pargr (epoch) + } else { + call sprintf (buf, SZ_LINE, "%s") + if (streq(wcsname,"gappt")) + call pargstr ("apparent") + else if (streq(wcsname,"fk4-no-e")) + call pargstr ("noefk4") + else + call pargstr (wcsname) + } + + stat = sk_decwstr (buf, nco, co) + if (stat != ERR) { + if (IMG_CTW(img) != NULL) + call mw_c2trand (IMG_CTW(img), x, y, ox, oy) + call sk_lltran (co, nco, DEGTORAD(ox), DEGTORAD(oy), + INDEFD, INDEFD, 0.0d0, 0.0d0, wx, wy) + if (sk_stati(co,S_PLATAX) < sk_stati(co,S_PLNGAX)) { + wx = RADTODEG(wy) # transposed image + wy = RADTODEG(wx) + } else { + wx = RADTODEG(wx) # regular image + wy = RADTODEG(wy) + } + } else { + wx = x + wy = y + } + case SYS_OTHER: + ; # TBD + + default: # default coords + wx = x + wy = y + } +end + + +# IMG_LTOV -- Convert coordinate from the logical coordinate system to the +# output coordinate system. + +procedure img_ltov (im, xin, yin, xout, yout) + +pointer im # the input image descriptor +double xin # the input x coordinate +double yin # the input y coordinate +double xout # the output x coordinate +double yout # the output y coordinate + +int index1, index2 + +begin + index1 = IM_VMAP(im,1) + index2 = IM_VMAP(im,2) + + xout = xin * IM_VSTEP(im,index1) + IM_VOFF(im,index1) + yout = yin * IM_VSTEP(im,index2) + IM_VOFF(im,index2) +end + + +# IMG_VTOL -- Convert coordinate from the tv coordinate system to the +# logical coordinate system. + +procedure img_vtol (im, xin, yin, xout, yout) + +pointer im # the input image descriptor +double xin # the input x coordinate +double yin # the input y coordinate +double xout # the output x coordinate +double yout # the output y coordinate + +int index1, index2 + +begin + index1 = IM_VMAP(im,1) + index2 = IM_VMAP(im,2) + + xout = (xin - IM_VOFF(im,index1)) / IM_VSTEP(im,index1) + yout = (yin - IM_VOFF(im,index2)) / IM_VSTEP(im,index2) +end diff --git a/vendor/x11iraf/ximtool/clients/wcspix/wcmef.x b/vendor/x11iraf/ximtool/clients/wcspix/wcmef.x new file mode 100644 index 00000000..050e5596 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/wcmef.x @@ -0,0 +1,50 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "wcspix.h" + + +# MEF Image class data. + + +# MEF_INIT -- Initialize the MEF Class module. + +procedure mef_init () +begin +end + + +# MEF_CACHE -- Cache an image in the object cache. + +procedure mef_cache () +begin +end + + +# MEF_UNCACHE -- Uncache an image in the object cache. + +procedure mef_uncache () +begin +end + + +# MEF_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. + +procedure mef_wcstran () +begin +end + + +# MEF_WCSLIST -- List the WCSs available for the given image. + +procedure mef_wcslist () +begin +end + + +# MEF_OBJINFO -- Get header information from the image. + +procedure mef_objinfo () +begin +end + diff --git a/vendor/x11iraf/ximtool/clients/wcspix/wcmspec.x b/vendor/x11iraf/ximtool/clients/wcspix/wcmspec.x new file mode 100644 index 00000000..64198d69 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/wcmspec.x @@ -0,0 +1,50 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "wcspix.h" + + +# Multispec image class data. + + +# MSP_INIT -- Initialize the Image Class module. + +procedure msp_init () +begin +end + + +# MSP_CACHE -- Cache an image in the object cache. + +procedure msp_cache () +begin +end + + +# MSP_UNCACHE -- Uncache an image in the object cache. + +procedure msp_uncache () +begin +end + + +# MSP_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. + +procedure msp_wcstran () +begin +end + + +# MSP_WCSLIST -- List the WCSs available for the given image. + +procedure msp_wcslist () +begin +end + + +# MSP_OBJINFO -- Get header information from the image. + +procedure msp_objinfo () +begin +end + diff --git a/vendor/x11iraf/ximtool/clients/wcspix/wcspix.h b/vendor/x11iraf/ximtool/clients/wcspix/wcspix.h new file mode 100644 index 00000000..0233ff21 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/wcspix.h @@ -0,0 +1,112 @@ +# WCSPIX.H -- Include file for the WCS/Pixel value ISM task + +define WCSPIX_NAME "wcspix" +define WCSPIX_MODE "text" +define WCSPIX_CONNECT "unix:/tmp/.ISM%d" + +define WCSPIX_DBG FALSE + +# Main task data structures. +define MAX_WCSLINES 4 # max WCS output lines +define LEN_PIXTAB 81 # size of pixel table +define LEN_WCSNAME 32 # size of a WCS name + +define SZ_WCSPIX 7 +define WP_CPTR Memi[$1 ] # object cache pointer +define WP_PTABSZ Memi[$1+1] # pixel table size +define WP_BPM Memi[$1+2] # get BPM data +define WP_SYSTEMS Memi[$1+3] # WCS readout systems +define WP_WCS Memi[$1+4] # WCS system string +define WP_FORMATS Memi[$1+5] # WCS readout formats +define WP_DBGLEVEL Memi[$1+6] # debug level + +define OBJCACHE Memi[WP_CPTR($1)+$2] # object cache +define SYSTEMS Memi[WP_SYSTEMS($1)+$2-1] +define FORMATS Memi[WP_FORMATS($1)+$2-1] +define WCSNAME Memc[WP_WCS($1)+(LEN_WCSNAME*($2-1))] + + +# Element of an object cache. +define SZ_CACHE 256 # size of object cache +define SZ_CNODE 135 # size of a cache node +define SZ_OBJREF 128 # size of a object reference + +define C_OBJID Memi[$1] # object id +define C_REGID Memi[$1+1] # region id +define C_CLASS Memi[$1+2] # object class +define C_DATA Memi[$1+3] # object data ptr +define C_NREF Memi[$1+4] # no. times object referenced +define C_REF Memc[P2C($1+6)] # object reference file + + +# WCSPIX ISM task methods. +define WCSPIX_CMDS "|set|get|quit|initialize|cache|uncache\ + |wcstran|wcslist|objinfo|debug" + +define SET 1 +define GET 2 +define QUIT 3 +define INITIALIZE 4 +define CACHE 5 +define UNCACHE 6 +define WCSTRAN 7 +define WCSLIST 8 +define OBJINFO 9 +define DEBUG 10 + +# Parameters definable from the GUI +define SZ_PARAM 32 # size of a parameter string + +define WCSPIX_SYSTEMS "|none|display|logical|physical|world|sky\ + |amplifier|ccd|detector|other|" +define SYS_NONE 1 # no coords requested +define SYS_DISPLAY 2 # image display coords +define SYS_LOGICAL 3 # logical coords +define SYS_PHYSICAL 4 # physical coords +define SYS_WORLD 5 # world coords +define SYS_SKY 6 # sky coords +define SYS_AMP 7 # amplifier coords +define SYS_CCD 8 # CCD coords +define SYS_DETECTOR 9 # detector coords +define SYS_OTHER 10 # ??? coords + +define SKYPROJ "FK5 FK4 ICRS GAPPT FK4-NO-E Ecliptic Galactic Supergalactic" + + +define WCSPIX_PARAMS "|psize|bpm|wcs|format|" +define PAR_PSIZE 1 # pixel table size +define PAR_BPM 2 # get BPM data +define PAR_WCS 3 # WCS system +define PAR_FMT 4 # WCS format + +define WCSPIX_FMT "|default|hms|degrees|radians|" +define FMT_DEFAULT 1 # no formatting +define FMT_HMS 2 # covert to sexigesimal +define FMT_DEG 3 # output degrees +define FMT_RAD 4 # output radians + +define DEF_PTABSZ 0 # default pixtable size +define DEF_FMT FMT_DEFAULT # default output format +define DEF_SYSTEM SYS_LOGICAL # default coord system +define DEF_BPM_FLAG NO # default get-BPM-data flag + + +# Object class definitions. +define UNKNOWN_CLASS 1 # unknown class +define IMAGE_CLASS 2 # generic image class +define MEF_CLASS 3 # Mosaic MEF image class +define MULTISPEC_CLASS 4 # multispec data class + +# Class methods. +define LEN_CLASS 6 # length of class table +define MAX_CLASSES 16 # max supported classes +define SZ_CLNAME 32 # size of a class name + +define CL_INIT cl_table[1,$1] # class initializer +define CL_CACHE cl_table[2,$1] # cache the object +define CL_UNCACHE cl_table[3,$1] # uncache the object +define CL_WCSTRAN cl_table[4,$1] # WCS tranformations +define CL_WCSLIST cl_table[5,$1] # list available WCS +define CL_OBJINFO cl_table[6,$1] # get object header +define CL_NAME cl_names[1,$1] # class name + diff --git a/vendor/x11iraf/ximtool/clients/wcspix/wcunknown.x b/vendor/x11iraf/ximtool/clients/wcspix/wcunknown.x new file mode 100644 index 00000000..86e5e6d8 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/wcspix/wcunknown.x @@ -0,0 +1,185 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <ctype.h> +include "wcspix.h" + + +# Unknown class data. +define LEN_UNKDATA 1 +define UNK_WP Memi[$1 ] # wcspix back-pointer + + +# UNK_INIT -- Initialize the object structure. + +procedure unk_init (cp, wp) + +pointer cp #i cache pointer +pointer wp #i WCSPIX structure + +begin + # Allocate the image data structure if not previously allocated. + if (C_DATA(cp) == NULL) { + iferr (call calloc (C_DATA(cp), LEN_UNKDATA, TY_STRUCT)) + return + } + + UNK_WP(C_DATA(cp)) = wp +end + + +# UNK_CACHE -- Cache an image in the object cache. Since we don't know +# what this is we simply setup so that a query to the object id will still +# return a result of some kind rather than ignore it. In most cases this +# just means the input arguments are echoed back (e.g. coords), or default +# values such as a rotation value can be retrieved. + +procedure unk_cache (cp, objid, regid, ref) + +pointer cp #i cache pointer +int objid #i object id +int regid #i region id +char ref[ARB] #i object reference + +begin + C_OBJID(cp) = objid + C_REGID(cp) = regid + C_NREF(cp) = C_NREF(cp) + 1 + call strcpy (ref, C_REF(cp), 128) +end + + +# UNK_UNCACHE -- Uncache an unknown image in the object cache. + +procedure unk_uncache (cp, id) + +pointer cp #i cache pointer +int id #i image id + +begin + C_OBJID(cp) = NULL + C_NREF(cp) = 0 + call strcpy ("", C_REF(cp), SZ_FNAME) + + call mfree (C_DATA(cp), TY_STRUCT) + C_DATA(cp) = NULL +end + + +# UNK_WCSTRAN -- Translate object source (x,y) coordinates to the +# desired output WCSs. Message is returned as something like: +# +# set value { +# { object <objid> } { region <regionid> } +# { pixval <pixelvalue> [<units>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# { coord <wcsname> <x> <y> [<xunits> <yunits>] } +# } + + +procedure unk_wcstran (cp, id, x, y) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords + +pointer wp +int i + +# Use static storage to avoid allocation overhead. +char buf[SZ_LINE], msg[SZ_LINE] + +begin + wp = UNK_WP(C_DATA(cp)) + + # Begin formatting the message. + call aclrc (msg, SZ_LINE) + call sprintf (msg, SZ_LINE, "wcstran { object %d } { region %d } ") + call pargi (C_OBJID(cp)) + call pargi (C_REGID(cp)) + call strcat ("{ pixval 0.0 } { bpm 0 } \n", msg, SZ_LINE) + + + # Now loop over the requested systems and generate a coordinate + # for each. + for (i=1; i <= MAX_WCSLINES; i=i+1) { + + # Format the coord buffer and append it to the message. + call sprintf (buf, SZ_LINE, "{coord {%9s} {%12g} {%12g} {X} {Y}}\n") + call pargstr ("UNKN") + call pargr (x) + call pargr (y) + call strcat (buf, msg, SZ_LINE) + } + + # Now send the completed message. + call wcspix_message (msg) +end + + +# UNK_WCSLIST -- List the WCSs available for the given image. + +procedure unk_wcslist (cp, id) + +pointer cp #i cache pointer +int id #i image id + +begin + #call wcspix_message ("wcslist {None Logical}") +end + + +# UNK_GETDATA -- Get data from the image. + +procedure unk_getdata (cp, id, x, y, pixval) + +pointer cp #i cache pointer +int id #i image id +real x, y #i source coords +real pixval #o central pixel value + +pointer wp, pix +int size, x1, x2, y1, y2 + +begin + wp = UNK_WP(C_DATA(cp)) + size = WP_PTABSZ(wp) + + # Compute the box offset given the center and size. + x1 = x - size / 2 + 0.5 + x2 = x + size / 2 + 0.5 + y1 = y - size / 2 + 0.5 + y2 = y + size / 2 + 0.5 + + pixval = 0.0 + + # Send the pixel table. + if (size > 1) { + call calloc (pix, size * size, TY_REAL) + call img_send_pixtab (Memr[pix], size, x1, x2, y1, y2) + call mfree (pix, TY_REAL) + } +end + + +# UNK_OBJINFO -- Get header information from the image. + +procedure unk_objinfo (cp, id, template) + +pointer cp #i cache pointer +int id #i image id +char template[ARB] #i keyword template + +pointer sp, buf + +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + + # Send a default (X,Y) compass indicator. + call aclrc (Memc[buf], SZ_LINE) + call sprintf (Memc[buf], SZ_LINE, "compass %d 0.0 -1 1 0 X Y\0") + call pargi (C_OBJID(cp)) + call wcspix_message (Memc[buf]) + + call sfree (sp) +end diff --git a/vendor/x11iraf/ximtool/clients/x_ism.x b/vendor/x11iraf/ximtool/clients/x_ism.x new file mode 100644 index 00000000..8f401873 --- /dev/null +++ b/vendor/x11iraf/ximtool/clients/x_ism.x @@ -0,0 +1 @@ +task wcspix = t_wcspix diff --git a/vendor/x11iraf/ximtool/data/README b/vendor/x11iraf/ximtool/data/README new file mode 100644 index 00000000..c033f821 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/README @@ -0,0 +1,2 @@ +The files in this directory are included in Ximtool, either at compile time +or manually in the GUI file. diff --git a/vendor/x11iraf/ximtool/data/aips0.lut b/vendor/x11iraf/ximtool/data/aips0.lut new file mode 100644 index 00000000..351cc2e4 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/aips0.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.19608, 0.19608, 0.19608, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.47451, 0.00000, 0.60784, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78431, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.37255, 0.65490, 0.92549, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96471, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.69412, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000 diff --git a/vendor/x11iraf/ximtool/data/blue.lut b/vendor/x11iraf/ximtool/data/blue.lut new file mode 100644 index 00000000..3f9caf87 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/blue.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00392, +0.00000, 0.00000, 0.00784, +0.00000, 0.00000, 0.01176, +0.00000, 0.00000, 0.01569, +0.00000, 0.00000, 0.01961, +0.00000, 0.00000, 0.02353, +0.00000, 0.00000, 0.02745, +0.00000, 0.00000, 0.03137, +0.00000, 0.00000, 0.03529, +0.00000, 0.00000, 0.03922, +0.00000, 0.00000, 0.04314, +0.00000, 0.00000, 0.04706, +0.00000, 0.00000, 0.05098, +0.00000, 0.00000, 0.05490, +0.00000, 0.00000, 0.05882, +0.00000, 0.00000, 0.06275, +0.00000, 0.00000, 0.06667, +0.00000, 0.00000, 0.07059, +0.00000, 0.00000, 0.07451, +0.00000, 0.00000, 0.07843, +0.00000, 0.00000, 0.08235, +0.00000, 0.00000, 0.08627, +0.00000, 0.00000, 0.09020, +0.00000, 0.00000, 0.09412, +0.00000, 0.00000, 0.09804, +0.00000, 0.00000, 0.10196, +0.00000, 0.00000, 0.10588, +0.00000, 0.00000, 0.10980, +0.00000, 0.00000, 0.11373, +0.00000, 0.00000, 0.11765, +0.00000, 0.00000, 0.12157, +0.00000, 0.00000, 0.12549, +0.00000, 0.00000, 0.12941, +0.00000, 0.00000, 0.13333, +0.00000, 0.00000, 0.13725, +0.00000, 0.00000, 0.14118, +0.00000, 0.00000, 0.14510, +0.00000, 0.00000, 0.14902, +0.00000, 0.00000, 0.15294, +0.00000, 0.00000, 0.15686, +0.00000, 0.00000, 0.16078, +0.00000, 0.00000, 0.16471, +0.00000, 0.00000, 0.16863, +0.00000, 0.00000, 0.17255, +0.00000, 0.00000, 0.17647, +0.00000, 0.00000, 0.18039, +0.00000, 0.00000, 0.18431, +0.00000, 0.00000, 0.18824, +0.00000, 0.00000, 0.19216, +0.00000, 0.00000, 0.19608, +0.00000, 0.00000, 0.20000, +0.00000, 0.00000, 0.20392, +0.00000, 0.00000, 0.20784, +0.00000, 0.00000, 0.21176, +0.00000, 0.00000, 0.21569, +0.00000, 0.00000, 0.21961, +0.00000, 0.00000, 0.22353, +0.00000, 0.00000, 0.22745, +0.00000, 0.00000, 0.23137, +0.00000, 0.00000, 0.23529, +0.00000, 0.00000, 0.23922, +0.00000, 0.00000, 0.24314, +0.00000, 0.00000, 0.24706, +0.00000, 0.00000, 0.25098, +0.00000, 0.00000, 0.25490, +0.00000, 0.00000, 0.25882, +0.00000, 0.00000, 0.26275, +0.00000, 0.00000, 0.26667, +0.00000, 0.00000, 0.27059, +0.00000, 0.00000, 0.27451, +0.00000, 0.00000, 0.27843, +0.00000, 0.00000, 0.28235, +0.00000, 0.00000, 0.28627, +0.00000, 0.00000, 0.29020, +0.00000, 0.00000, 0.29412, +0.00000, 0.00000, 0.29804, +0.00000, 0.00000, 0.30196, +0.00000, 0.00000, 0.30588, +0.00000, 0.00000, 0.30980, +0.00000, 0.00000, 0.31373, +0.00000, 0.00000, 0.31765, +0.00000, 0.00000, 0.32157, +0.00000, 0.00000, 0.32549, +0.00000, 0.00000, 0.32941, +0.00000, 0.00000, 0.33333, +0.00000, 0.00000, 0.33725, +0.00000, 0.00000, 0.34118, +0.00000, 0.00000, 0.34510, +0.00000, 0.00000, 0.34902, +0.00000, 0.00000, 0.35294, +0.00000, 0.00000, 0.35686, +0.00000, 0.00000, 0.36078, +0.00000, 0.00000, 0.36471, +0.00000, 0.00000, 0.36863, +0.00000, 0.00000, 0.37255, +0.00000, 0.00000, 0.37647, +0.00000, 0.00000, 0.38039, +0.00000, 0.00000, 0.38431, +0.00000, 0.00000, 0.38824, +0.00000, 0.00000, 0.39216, +0.00000, 0.00000, 0.39608, +0.00000, 0.00000, 0.40000, +0.00000, 0.00000, 0.40392, +0.00000, 0.00000, 0.40784, +0.00000, 0.00000, 0.41176, +0.00000, 0.00000, 0.41569, +0.00000, 0.00000, 0.41961, +0.00000, 0.00000, 0.42353, +0.00000, 0.00000, 0.42745, +0.00000, 0.00000, 0.43137, +0.00000, 0.00000, 0.43529, +0.00000, 0.00000, 0.43922, +0.00000, 0.00000, 0.44314, +0.00000, 0.00000, 0.44706, +0.00000, 0.00000, 0.45098, +0.00000, 0.00000, 0.45490, +0.00000, 0.00000, 0.45882, +0.00000, 0.00000, 0.46275, +0.00000, 0.00000, 0.46667, +0.00000, 0.00000, 0.47059, +0.00000, 0.00000, 0.47451, +0.00000, 0.00000, 0.47843, +0.00000, 0.00000, 0.48235, +0.00000, 0.00000, 0.48627, +0.00000, 0.00000, 0.49020, +0.00000, 0.00000, 0.49412, +0.00000, 0.00000, 0.49804, +0.00000, 0.00000, 0.50196, +0.00000, 0.00000, 0.50588, +0.00000, 0.00000, 0.50980, +0.00000, 0.00000, 0.51373, +0.00000, 0.00000, 0.51765, +0.00000, 0.00000, 0.52157, +0.00000, 0.00000, 0.52549, +0.00000, 0.00000, 0.52941, +0.00000, 0.00000, 0.53333, +0.00000, 0.00000, 0.53725, +0.00000, 0.00000, 0.54118, +0.00000, 0.00000, 0.54510, +0.00000, 0.00000, 0.54902, +0.00000, 0.00000, 0.55294, +0.00000, 0.00000, 0.55686, +0.00000, 0.00000, 0.56078, +0.00000, 0.00000, 0.56471, +0.00000, 0.00000, 0.56863, +0.00000, 0.00000, 0.57255, +0.00000, 0.00000, 0.57647, +0.00000, 0.00000, 0.58039, +0.00000, 0.00000, 0.58431, +0.00000, 0.00000, 0.58824, +0.00000, 0.00000, 0.59216, +0.00000, 0.00000, 0.59608, +0.00000, 0.00000, 0.60000, +0.00000, 0.00000, 0.60392, +0.00000, 0.00000, 0.60784, +0.00000, 0.00000, 0.61176, +0.00000, 0.00000, 0.61569, +0.00000, 0.00000, 0.61961, +0.00000, 0.00000, 0.62353, +0.00000, 0.00000, 0.62745, +0.00000, 0.00000, 0.63137, +0.00000, 0.00000, 0.63529, +0.00000, 0.00000, 0.63922, +0.00000, 0.00000, 0.64314, +0.00000, 0.00000, 0.64706, +0.00000, 0.00000, 0.65098, +0.00000, 0.00000, 0.65490, +0.00000, 0.00000, 0.65882, +0.00000, 0.00000, 0.66275, +0.00000, 0.00000, 0.66667, +0.00000, 0.00000, 0.67059, +0.00000, 0.00000, 0.67451, +0.00000, 0.00000, 0.67843, +0.00000, 0.00000, 0.68235, +0.00000, 0.00000, 0.68627, +0.00000, 0.00000, 0.69020, +0.00000, 0.00000, 0.69412, +0.00000, 0.00000, 0.69804, +0.00000, 0.00000, 0.70196, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70980, +0.00000, 0.00000, 0.71373, +0.00000, 0.00000, 0.71765, +0.00000, 0.00000, 0.72157, +0.00000, 0.00000, 0.72549, +0.00000, 0.00000, 0.72941, +0.00000, 0.00000, 0.73333, +0.00000, 0.00000, 0.73725, +0.00000, 0.00000, 0.74118, +0.00000, 0.00000, 0.74510, +0.00000, 0.00000, 0.74902, +0.00000, 0.00000, 0.75294, +0.00000, 0.00000, 0.75686, +0.00000, 0.00000, 0.76078, +0.00000, 0.00000, 0.76471, +0.00000, 0.00000, 0.76863, +0.00000, 0.00000, 0.77255, +0.00000, 0.00000, 0.77647, +0.00000, 0.00000, 0.78039, +0.00000, 0.00000, 0.78431, +0.00000, 0.00000, 0.78824, +0.00000, 0.00000, 0.79216, +0.00000, 0.00000, 0.79608, +0.00000, 0.00000, 0.80000, +0.00000, 0.00000, 0.80392, +0.00000, 0.00000, 0.80784, +0.00000, 0.00000, 0.81176, +0.00000, 0.00000, 0.81569, +0.00000, 0.00000, 0.81961, +0.00000, 0.00000, 0.82353, +0.00000, 0.00000, 0.82745, +0.00000, 0.00000, 0.83137, +0.00000, 0.00000, 0.83529, +0.00000, 0.00000, 0.83922, +0.00000, 0.00000, 0.84314, +0.00000, 0.00000, 0.84706, +0.00000, 0.00000, 0.85098, +0.00000, 0.00000, 0.85490, +0.00000, 0.00000, 0.85882, +0.00000, 0.00000, 0.86275, +0.00000, 0.00000, 0.86667, +0.00000, 0.00000, 0.87059, +0.00000, 0.00000, 0.87451, +0.00000, 0.00000, 0.87843, +0.00000, 0.00000, 0.88235, +0.00000, 0.00000, 0.88627, +0.00000, 0.00000, 0.89020, +0.00000, 0.00000, 0.89412, +0.00000, 0.00000, 0.89804, +0.00000, 0.00000, 0.90196, +0.00000, 0.00000, 0.90588, +0.00000, 0.00000, 0.90980, +0.00000, 0.00000, 0.91373, +0.00000, 0.00000, 0.91765, +0.00000, 0.00000, 0.92157, +0.00000, 0.00000, 0.92549, +0.00000, 0.00000, 0.92941, +0.00000, 0.00000, 0.93333, +0.00000, 0.00000, 0.93725, +0.00000, 0.00000, 0.94118, +0.00000, 0.00000, 0.94510, +0.00000, 0.00000, 0.94902, +0.00000, 0.00000, 0.95294, +0.00000, 0.00000, 0.95686, +0.00000, 0.00000, 0.96078, +0.00000, 0.00000, 0.96471, +0.00000, 0.00000, 0.96863, +0.00000, 0.00000, 0.97255, +0.00000, 0.00000, 0.97647, +0.00000, 0.00000, 0.98039, +0.00000, 0.00392, 0.98431, +0.00000, 0.00784, 0.98824, +0.00000, 0.01176, 0.99216, +0.00000, 0.01569, 0.99608, +0.00000, 0.00392, 1.00000 diff --git a/vendor/x11iraf/ximtool/data/brightness.xbm b/vendor/x11iraf/ximtool/data/brightness.xbm new file mode 100644 index 00000000..ce875ea6 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/brightness.xbm @@ -0,0 +1,6 @@ +#define brightness_width 15 +#define brightness_height 15 +static char brightness_bits[] = { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/color.lut b/vendor/x11iraf/ximtool/data/color.lut new file mode 100644 index 00000000..580a589e --- /dev/null +++ b/vendor/x11iraf/ximtool/data/color.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.18431, 0.18431, 0.18431, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.37255, 0.37255, 0.37255, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.56078, 0.56078, 0.56078, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.74902, 0.74902, 0.74902, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.93725, 0.93725, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.18431, 0.93725, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.37255, 0.74902, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.49804, 0.49804, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.74902, 0.30980, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.93725, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.30980, 0.62353, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.49804, 0.49804, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.62353, 0.30980, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980, +0.74902, 0.00000, 0.30980 diff --git a/vendor/x11iraf/ximtool/data/contrast.xbm b/vendor/x11iraf/ximtool/data/contrast.xbm new file mode 100644 index 00000000..07e4a20f --- /dev/null +++ b/vendor/x11iraf/ximtool/data/contrast.xbm @@ -0,0 +1,6 @@ +#define contrast_width 15 +#define contrast_height 15 +static char contrast_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/green.lut b/vendor/x11iraf/ximtool/data/green.lut new file mode 100644 index 00000000..1af43427 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/green.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.00000, 0.00392, 0.00000, +0.00000, 0.00784, 0.00000, +0.00000, 0.01176, 0.00000, +0.00000, 0.01569, 0.00000, +0.00000, 0.01961, 0.00000, +0.00000, 0.02353, 0.00000, +0.00000, 0.02745, 0.00000, +0.00000, 0.03137, 0.00000, +0.00000, 0.03529, 0.00000, +0.00000, 0.03922, 0.00000, +0.00000, 0.04314, 0.00000, +0.00000, 0.04706, 0.00000, +0.00000, 0.05098, 0.00000, +0.00000, 0.05490, 0.00000, +0.00000, 0.05882, 0.00000, +0.00000, 0.06275, 0.00000, +0.00000, 0.06667, 0.00000, +0.00000, 0.07059, 0.00000, +0.00000, 0.07451, 0.00000, +0.00000, 0.07843, 0.00000, +0.00000, 0.08235, 0.00000, +0.00000, 0.08627, 0.00000, +0.00000, 0.09020, 0.00000, +0.00000, 0.09412, 0.00000, +0.00000, 0.09804, 0.00000, +0.00000, 0.10196, 0.00000, +0.00000, 0.10588, 0.00000, +0.00000, 0.10980, 0.00000, +0.00000, 0.11373, 0.00000, +0.00000, 0.11765, 0.00000, +0.00000, 0.12157, 0.00000, +0.00000, 0.12549, 0.00000, +0.00000, 0.12941, 0.00000, +0.00000, 0.13333, 0.00000, +0.00000, 0.13725, 0.00000, +0.00000, 0.14118, 0.00000, +0.00000, 0.14510, 0.00000, +0.00000, 0.14902, 0.00000, +0.00000, 0.15294, 0.00000, +0.00000, 0.15686, 0.00000, +0.00000, 0.16078, 0.00000, +0.00000, 0.16471, 0.00000, +0.00000, 0.16863, 0.00000, +0.00000, 0.17255, 0.00000, +0.00000, 0.17647, 0.00000, +0.00000, 0.18039, 0.00000, +0.00000, 0.18431, 0.00000, +0.00000, 0.18824, 0.00000, +0.00000, 0.19216, 0.00000, +0.00000, 0.19608, 0.00000, +0.00000, 0.20000, 0.00000, +0.00000, 0.20392, 0.00000, +0.00000, 0.20784, 0.00000, +0.00000, 0.21176, 0.00000, +0.00000, 0.21569, 0.00000, +0.00000, 0.21961, 0.00000, +0.00000, 0.22353, 0.00000, +0.00000, 0.22745, 0.00000, +0.00000, 0.23137, 0.00000, +0.00000, 0.23529, 0.00000, +0.00000, 0.23922, 0.00000, +0.00000, 0.24314, 0.00000, +0.00000, 0.24706, 0.00000, +0.00000, 0.25098, 0.00000, +0.00000, 0.25490, 0.00000, +0.00000, 0.25882, 0.00000, +0.00000, 0.26275, 0.00000, +0.00000, 0.26667, 0.00000, +0.00000, 0.27059, 0.00000, +0.00000, 0.27451, 0.00000, +0.00000, 0.27843, 0.00000, +0.00000, 0.28235, 0.00000, +0.00000, 0.28627, 0.00000, +0.00000, 0.29020, 0.00000, +0.00000, 0.29412, 0.00000, +0.00000, 0.29804, 0.00000, +0.00000, 0.30196, 0.00000, +0.00000, 0.30588, 0.00000, +0.00000, 0.30980, 0.00000, +0.00000, 0.31373, 0.00000, +0.00000, 0.31765, 0.00000, +0.00000, 0.32157, 0.00000, +0.00000, 0.32549, 0.00000, +0.00000, 0.32941, 0.00000, +0.00000, 0.33333, 0.00000, +0.00000, 0.33725, 0.00000, +0.00000, 0.34118, 0.00000, +0.00000, 0.34510, 0.00000, +0.00000, 0.34902, 0.00000, +0.00000, 0.35294, 0.00000, +0.00000, 0.35686, 0.00000, +0.00000, 0.36078, 0.00000, +0.00000, 0.36471, 0.00000, +0.00000, 0.36863, 0.00000, +0.00000, 0.37255, 0.00000, +0.00000, 0.37647, 0.00000, +0.00000, 0.38039, 0.00000, +0.00000, 0.38431, 0.00000, +0.00000, 0.38824, 0.00000, +0.00000, 0.39216, 0.00000, +0.00000, 0.39608, 0.00000, +0.00000, 0.40000, 0.00000, +0.00000, 0.40392, 0.00000, +0.00000, 0.40784, 0.00000, +0.00000, 0.41176, 0.00000, +0.00000, 0.41569, 0.00000, +0.00000, 0.41961, 0.00000, +0.00000, 0.42353, 0.00000, +0.00000, 0.42745, 0.00000, +0.00000, 0.43137, 0.00000, +0.00000, 0.43529, 0.00000, +0.00000, 0.43922, 0.00000, +0.00000, 0.44314, 0.00000, +0.00000, 0.44706, 0.00000, +0.00000, 0.45098, 0.00000, +0.00000, 0.45490, 0.00000, +0.00000, 0.45882, 0.00000, +0.00000, 0.46275, 0.00000, +0.00000, 0.46667, 0.00000, +0.00000, 0.47059, 0.00000, +0.00000, 0.47451, 0.00000, +0.00000, 0.47843, 0.00000, +0.00000, 0.48235, 0.00000, +0.00000, 0.48627, 0.00000, +0.00000, 0.49020, 0.00000, +0.00000, 0.49412, 0.00000, +0.00000, 0.49804, 0.00000, +0.00000, 0.50196, 0.00000, +0.00000, 0.50588, 0.00000, +0.00000, 0.50980, 0.00000, +0.00000, 0.51373, 0.00000, +0.00000, 0.51765, 0.00000, +0.00000, 0.52157, 0.00000, +0.00000, 0.52549, 0.00000, +0.00000, 0.52941, 0.00000, +0.00000, 0.53333, 0.00000, +0.00000, 0.53725, 0.00000, +0.00000, 0.54118, 0.00000, +0.00000, 0.54510, 0.00000, +0.00000, 0.54902, 0.00000, +0.00000, 0.55294, 0.00000, +0.00000, 0.55686, 0.00000, +0.00000, 0.56078, 0.00000, +0.00000, 0.56471, 0.00000, +0.00000, 0.56863, 0.00000, +0.00000, 0.57255, 0.00000, +0.00000, 0.57647, 0.00000, +0.00000, 0.58039, 0.00000, +0.00000, 0.58431, 0.00000, +0.00000, 0.58824, 0.00000, +0.00000, 0.59216, 0.00000, +0.00000, 0.59608, 0.00000, +0.00000, 0.60000, 0.00000, +0.00000, 0.60392, 0.00000, +0.00000, 0.60784, 0.00000, +0.00000, 0.61176, 0.00000, +0.00000, 0.61569, 0.00000, +0.00000, 0.61961, 0.00000, +0.00000, 0.62353, 0.00000, +0.00000, 0.62745, 0.00000, +0.00000, 0.63137, 0.00000, +0.00000, 0.63529, 0.00000, +0.00000, 0.63922, 0.00000, +0.00000, 0.64314, 0.00000, +0.00000, 0.64706, 0.00000, +0.00000, 0.65098, 0.00000, +0.00000, 0.65490, 0.00000, +0.00000, 0.65882, 0.00000, +0.00000, 0.66275, 0.00000, +0.00000, 0.66667, 0.00000, +0.00000, 0.67059, 0.00000, +0.00000, 0.67451, 0.00000, +0.00000, 0.67843, 0.00000, +0.00000, 0.68235, 0.00000, +0.00000, 0.68627, 0.00000, +0.00000, 0.69020, 0.00000, +0.00000, 0.69412, 0.00000, +0.00000, 0.69804, 0.00000, +0.00000, 0.70196, 0.00000, +0.00000, 0.70588, 0.00000, +0.00000, 0.70980, 0.00000, +0.00000, 0.71373, 0.00000, +0.00000, 0.71765, 0.00000, +0.00000, 0.72157, 0.00000, +0.00000, 0.72549, 0.00000, +0.00000, 0.72941, 0.00000, +0.00000, 0.73333, 0.00000, +0.00000, 0.73725, 0.00000, +0.00000, 0.74118, 0.00000, +0.00000, 0.74510, 0.00000, +0.00000, 0.74902, 0.00000, +0.00000, 0.75294, 0.00000, +0.00000, 0.75686, 0.00000, +0.00000, 0.76078, 0.00000, +0.00000, 0.76471, 0.00000, +0.00000, 0.76863, 0.00000, +0.00000, 0.77255, 0.00000, +0.00000, 0.77647, 0.00000, +0.00000, 0.78039, 0.00000, +0.00000, 0.78431, 0.00000, +0.00000, 0.78824, 0.00000, +0.00000, 0.79216, 0.00000, +0.00000, 0.79608, 0.00000, +0.00000, 0.80000, 0.00000, +0.00000, 0.80392, 0.00000, +0.00000, 0.80784, 0.00000, +0.00000, 0.81176, 0.00000, +0.00000, 0.81569, 0.00000, +0.00000, 0.81961, 0.00000, +0.00000, 0.82353, 0.00000, +0.00000, 0.82745, 0.00000, +0.00000, 0.83137, 0.00000, +0.00000, 0.83529, 0.00000, +0.00000, 0.83922, 0.00000, +0.00000, 0.84314, 0.00000, +0.00000, 0.84706, 0.00000, +0.00000, 0.85098, 0.00000, +0.00000, 0.85490, 0.00000, +0.00000, 0.85882, 0.00000, +0.00000, 0.86275, 0.00000, +0.00000, 0.86667, 0.00000, +0.00000, 0.87059, 0.00000, +0.00000, 0.87451, 0.00000, +0.00000, 0.87843, 0.00000, +0.00000, 0.88235, 0.00000, +0.00000, 0.88627, 0.00000, +0.00000, 0.89020, 0.00000, +0.00000, 0.89412, 0.00000, +0.00000, 0.89804, 0.00000, +0.00000, 0.90196, 0.00000, +0.00000, 0.90588, 0.00000, +0.00000, 0.90980, 0.00000, +0.00000, 0.91373, 0.00000, +0.00000, 0.91765, 0.00000, +0.00000, 0.92157, 0.00000, +0.00000, 0.92549, 0.00000, +0.00000, 0.92941, 0.00000, +0.00000, 0.93333, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.94118, 0.00000, +0.00000, 0.94510, 0.00000, +0.00000, 0.94902, 0.00000, +0.00000, 0.95294, 0.00000, +0.00000, 0.95686, 0.00000, +0.00000, 0.96078, 0.00000, +0.00000, 0.96471, 0.00000, +0.00000, 0.96863, 0.00000, +0.00000, 0.97255, 0.00000, +0.00000, 0.97647, 0.00000, +0.00000, 0.98039, 0.00000, +0.00000, 0.98431, 0.00000, +0.00000, 0.98824, 0.00000, +0.00000, 0.99216, 0.00000, +0.00000, 0.99608, 0.00392, +0.00000, 1.00000, 0.00784 diff --git a/vendor/x11iraf/ximtool/data/halley.lut b/vendor/x11iraf/ximtool/data/halley.lut new file mode 100644 index 00000000..ac00326a --- /dev/null +++ b/vendor/x11iraf/ximtool/data/halley.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.86275, +0.00000, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.51765, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98431, 0.81176, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 1.00000, +0.00000, 1.00000, 1.00000, +0.47059, 0.78431, 1.00000, +0.47059, 0.78431, 1.00000, +0.47059, 0.78431, 1.00000, +0.62745, 0.62745, 1.00000, +0.62745, 0.62745, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +1.00000, 0.70588, 1.00000, +1.00000, 0.70588, 1.00000, +1.00000, 0.76863, 1.00000, +1.00000, 0.86275, 1.00000, +1.00000, 0.86275, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 0.89804, 1.00000, +1.00000, 0.86275, 1.00000, +1.00000, 0.86275, 1.00000, +1.00000, 0.86275, 1.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.92157, 0.61961, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.78431, 0.47059, 1.00000, +0.65882, 0.59608, 1.00000, +0.62745, 0.62745, 1.00000, +0.62745, 0.62745, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +0.00000, 0.00000, 1.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.70588, +0.00000, 1.00000, 0.65490, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 1.00000, 0.00000, +0.36078, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.70588, 1.00000, 0.00000, +0.98431, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +0.99608, 0.97647, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98431, 0.85098, 0.00000, +0.98824, 0.77647, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +0.98824, 0.72549, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.36863, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.00000, +1.00000, 0.00000, 0.46667, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 0.70588, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +1.00000, 0.00000, 1.00000, +0.91373, 0.00000, 0.97255, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.70588, 0.00000, 0.90196, +0.53333, 0.00000, 0.87451, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +0.47059, 0.00000, 0.86275, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +1.00000, 1.00000, 1.00000, +0.00000, 0.00000, 0.86275, +0.00000, 0.00000, 0.86275, +0.00000, 0.00000, 0.86275, +0.00000, 0.00000, 0.86275, +0.00000, 0.00000, 0.80392, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.70588, +0.00000, 0.00000, 0.13725, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000, +0.00000, 0.00000, 0.00000 diff --git a/vendor/x11iraf/ximtool/data/heat.lut b/vendor/x11iraf/ximtool/data/heat.lut new file mode 100644 index 00000000..124a70f4 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/heat.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.01176, 0.00392, 0.00000, +0.02353, 0.00784, 0.00000, +0.03529, 0.01176, 0.00000, +0.04706, 0.01569, 0.00000, +0.05882, 0.01961, 0.00000, +0.07059, 0.02353, 0.00000, +0.08235, 0.02745, 0.00000, +0.09412, 0.03137, 0.00000, +0.10588, 0.03529, 0.00000, +0.11765, 0.03922, 0.00000, +0.12941, 0.04314, 0.00000, +0.14118, 0.04706, 0.00000, +0.15294, 0.05098, 0.00000, +0.16471, 0.05490, 0.00000, +0.17647, 0.05882, 0.00000, +0.18824, 0.06275, 0.00000, +0.20000, 0.06667, 0.00000, +0.21176, 0.07059, 0.00000, +0.22353, 0.07451, 0.00000, +0.23529, 0.07843, 0.00000, +0.24706, 0.08235, 0.00000, +0.25882, 0.08627, 0.00000, +0.27059, 0.09020, 0.00000, +0.28235, 0.09412, 0.00000, +0.29412, 0.09804, 0.00000, +0.30588, 0.10196, 0.00000, +0.31765, 0.10588, 0.00000, +0.32941, 0.10980, 0.00000, +0.34118, 0.11373, 0.00000, +0.35294, 0.11765, 0.00000, +0.36471, 0.12157, 0.00000, +0.37647, 0.12549, 0.00000, +0.38824, 0.12941, 0.00000, +0.40000, 0.13333, 0.00000, +0.41176, 0.13725, 0.00000, +0.42353, 0.14118, 0.00000, +0.43529, 0.14510, 0.00000, +0.44706, 0.14902, 0.00000, +0.45882, 0.15294, 0.00000, +0.47059, 0.15686, 0.00000, +0.48235, 0.16078, 0.00000, +0.49412, 0.16471, 0.00000, +0.50588, 0.16863, 0.00000, +0.51765, 0.17255, 0.00000, +0.52941, 0.17647, 0.00000, +0.54118, 0.18039, 0.00000, +0.55294, 0.18431, 0.00000, +0.56471, 0.18824, 0.00000, +0.57647, 0.19216, 0.00000, +0.58824, 0.19608, 0.00000, +0.60000, 0.20000, 0.00000, +0.61176, 0.20392, 0.00000, +0.62353, 0.20784, 0.00000, +0.63529, 0.21176, 0.00000, +0.64706, 0.21569, 0.00000, +0.65882, 0.21961, 0.00000, +0.67059, 0.22353, 0.00000, +0.68235, 0.22745, 0.00000, +0.69412, 0.23137, 0.00000, +0.70588, 0.23529, 0.00000, +0.71765, 0.23922, 0.00000, +0.72941, 0.24314, 0.00000, +0.74118, 0.24706, 0.00000, +0.75294, 0.25098, 0.00000, +0.76471, 0.25490, 0.00000, +0.77647, 0.25882, 0.00000, +0.78824, 0.26275, 0.00000, +0.80000, 0.26667, 0.00000, +0.81176, 0.27059, 0.00000, +0.82353, 0.27451, 0.00000, +0.83529, 0.27843, 0.00000, +0.84706, 0.28235, 0.00000, +0.85882, 0.28627, 0.00000, +0.87059, 0.29020, 0.00000, +0.88235, 0.29412, 0.00000, +0.89412, 0.29804, 0.00000, +0.90588, 0.30196, 0.00000, +0.91765, 0.30588, 0.00000, +0.92941, 0.30980, 0.00000, +0.94118, 0.31373, 0.00000, +0.95294, 0.31765, 0.00000, +0.96471, 0.32157, 0.00000, +0.97647, 0.32549, 0.00000, +0.98824, 0.32941, 0.00000, +1.00000, 0.33333, 0.00000, +1.00000, 0.33725, 0.00000, +1.00000, 0.34118, 0.00000, +1.00000, 0.34510, 0.00000, +1.00000, 0.34902, 0.00000, +1.00000, 0.35294, 0.00000, +1.00000, 0.35686, 0.00000, +1.00000, 0.36078, 0.00000, +1.00000, 0.36471, 0.00000, +1.00000, 0.36863, 0.00000, +1.00000, 0.37255, 0.00000, +1.00000, 0.37647, 0.00000, +1.00000, 0.38039, 0.00000, +1.00000, 0.38431, 0.00000, +1.00000, 0.38824, 0.00000, +1.00000, 0.39216, 0.00000, +1.00000, 0.39608, 0.00000, +1.00000, 0.40000, 0.00000, +1.00000, 0.40392, 0.00000, +1.00000, 0.40784, 0.00000, +1.00000, 0.41176, 0.00000, +1.00000, 0.41569, 0.00000, +1.00000, 0.41961, 0.00000, +1.00000, 0.42353, 0.00000, +1.00000, 0.42745, 0.00000, +1.00000, 0.43137, 0.00000, +1.00000, 0.43529, 0.00000, +1.00000, 0.43922, 0.00000, +1.00000, 0.44314, 0.00000, +1.00000, 0.44706, 0.00000, +1.00000, 0.45098, 0.00000, +1.00000, 0.45490, 0.00000, +1.00000, 0.45882, 0.00000, +1.00000, 0.46275, 0.00000, +1.00000, 0.46667, 0.00000, +1.00000, 0.47059, 0.00000, +1.00000, 0.47451, 0.00000, +1.00000, 0.47843, 0.00000, +1.00000, 0.48235, 0.00000, +1.00000, 0.48627, 0.00000, +1.00000, 0.49020, 0.00000, +1.00000, 0.49412, 0.00000, +1.00000, 0.49804, 0.00000, +1.00000, 0.50196, 0.00000, +1.00000, 0.50588, 0.00000, +1.00000, 0.50980, 0.00000, +1.00000, 0.51373, 0.00000, +1.00000, 0.51765, 0.00000, +1.00000, 0.52157, 0.00000, +1.00000, 0.52549, 0.00000, +1.00000, 0.52941, 0.00000, +1.00000, 0.53333, 0.00000, +1.00000, 0.53725, 0.00000, +1.00000, 0.54118, 0.00000, +1.00000, 0.54510, 0.00000, +1.00000, 0.54902, 0.00000, +1.00000, 0.55294, 0.00000, +1.00000, 0.55686, 0.00000, +1.00000, 0.56078, 0.00000, +1.00000, 0.56471, 0.00000, +1.00000, 0.56863, 0.00000, +1.00000, 0.57255, 0.00000, +1.00000, 0.57647, 0.00000, +1.00000, 0.58039, 0.00000, +1.00000, 0.58431, 0.00000, +1.00000, 0.58824, 0.00000, +1.00000, 0.59216, 0.00000, +1.00000, 0.59608, 0.00000, +1.00000, 0.60000, 0.00000, +1.00000, 0.60392, 0.00000, +1.00000, 0.60784, 0.00000, +1.00000, 0.61176, 0.00000, +1.00000, 0.61569, 0.00000, +1.00000, 0.61961, 0.00000, +1.00000, 0.62353, 0.00000, +1.00000, 0.62745, 0.00000, +1.00000, 0.63137, 0.00000, +1.00000, 0.63529, 0.00000, +1.00000, 0.63922, 0.00000, +1.00000, 0.64314, 0.00000, +1.00000, 0.64706, 0.00000, +1.00000, 0.65098, 0.01176, +1.00000, 0.65490, 0.02353, +1.00000, 0.65882, 0.03529, +1.00000, 0.66275, 0.04706, +1.00000, 0.66667, 0.05882, +1.00000, 0.67059, 0.07059, +1.00000, 0.67451, 0.08235, +1.00000, 0.67843, 0.09412, +1.00000, 0.68235, 0.10588, +1.00000, 0.68627, 0.11765, +1.00000, 0.69020, 0.12941, +1.00000, 0.69412, 0.14118, +1.00000, 0.69804, 0.15294, +1.00000, 0.70196, 0.16471, +1.00000, 0.70588, 0.17647, +1.00000, 0.70980, 0.18824, +1.00000, 0.71373, 0.20000, +1.00000, 0.71765, 0.21176, +1.00000, 0.72157, 0.22353, +1.00000, 0.72549, 0.23529, +1.00000, 0.72941, 0.24706, +1.00000, 0.73333, 0.25882, +1.00000, 0.73725, 0.27059, +1.00000, 0.74118, 0.28235, +1.00000, 0.74510, 0.29412, +1.00000, 0.74902, 0.30588, +1.00000, 0.75294, 0.31765, +1.00000, 0.75686, 0.32941, +1.00000, 0.76078, 0.34118, +1.00000, 0.76471, 0.35294, +1.00000, 0.76863, 0.36471, +1.00000, 0.77255, 0.37647, +1.00000, 0.77647, 0.38824, +1.00000, 0.78039, 0.40000, +1.00000, 0.78431, 0.41176, +1.00000, 0.78824, 0.42353, +1.00000, 0.79216, 0.43529, +1.00000, 0.79608, 0.44706, +1.00000, 0.80000, 0.45882, +1.00000, 0.80392, 0.47059, +1.00000, 0.80784, 0.48235, +1.00000, 0.81176, 0.49412, +1.00000, 0.81569, 0.50588, +1.00000, 0.81961, 0.51765, +1.00000, 0.82353, 0.52941, +1.00000, 0.82745, 0.54118, +1.00000, 0.83137, 0.55294, +1.00000, 0.83529, 0.56471, +1.00000, 0.83922, 0.57647, +1.00000, 0.84314, 0.58824, +1.00000, 0.84706, 0.60000, +1.00000, 0.85098, 0.61176, +1.00000, 0.85490, 0.62353, +1.00000, 0.85882, 0.63529, +1.00000, 0.86275, 0.64706, +1.00000, 0.86667, 0.65882, +1.00000, 0.87059, 0.67059, +1.00000, 0.87451, 0.68235, +1.00000, 0.87843, 0.69412, +1.00000, 0.88235, 0.70588, +1.00000, 0.88627, 0.71765, +1.00000, 0.89020, 0.72941, +1.00000, 0.89412, 0.74118, +1.00000, 0.89804, 0.75294, +1.00000, 0.90196, 0.76471, +1.00000, 0.90588, 0.77647, +1.00000, 0.90980, 0.78824, +1.00000, 0.91373, 0.80000, +1.00000, 0.91765, 0.81176, +1.00000, 0.92157, 0.82353, +1.00000, 0.92549, 0.83529, +1.00000, 0.92941, 0.84706, +1.00000, 0.93333, 0.85882, +1.00000, 0.93725, 0.87059, +1.00000, 0.94118, 0.88235, +1.00000, 0.94510, 0.89412, +1.00000, 0.94902, 0.90588, +1.00000, 0.95294, 0.91765, +1.00000, 0.95686, 0.92941, +1.00000, 0.96078, 0.94118, +1.00000, 0.96471, 0.95294, +1.00000, 0.96863, 0.96471, +1.00000, 0.97255, 0.97647, +1.00000, 0.97647, 0.98824, +1.00000, 0.98039, 1.00000, +1.00000, 0.98431, 1.00000, +1.00000, 0.98824, 1.00000, +1.00000, 0.99216, 1.00000, +1.00000, 0.99608, 1.00000, +1.00000, 1.00000, 1.00000 diff --git a/vendor/x11iraf/ximtool/data/hflip.xbm b/vendor/x11iraf/ximtool/data/hflip.xbm new file mode 100644 index 00000000..44b105bb --- /dev/null +++ b/vendor/x11iraf/ximtool/data/hflip.xbm @@ -0,0 +1,6 @@ +#define hflip_width 16 +#define hflip_height 16 +static char hflip_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x06, 0x60, + 0x0e, 0x70, 0xfe, 0x7f, 0xfe, 0x7f, 0x0e, 0x70, 0x06, 0x60, 0x02, 0x40, + 0x02, 0x40, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/larrow.xbm b/vendor/x11iraf/ximtool/data/larrow.xbm new file mode 100644 index 00000000..47272aa6 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/larrow.xbm @@ -0,0 +1,6 @@ +#define larrow_width 16 +#define larrow_height 16 +static char larrow_bits[] = { + 0x00, 0x02, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x1f, 0xe0, 0x1f, 0xf0, 0x1f, + 0xf8, 0x1f, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x1f, 0xf0, 0x1f, 0xe0, 0x1f, + 0xc0, 0x1f, 0x80, 0x03, 0x00, 0x03, 0x00, 0x02}; diff --git a/vendor/x11iraf/ximtool/data/panel.xbm b/vendor/x11iraf/ximtool/data/panel.xbm new file mode 100644 index 00000000..2b2b99b1 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/panel.xbm @@ -0,0 +1,6 @@ +#define panel_width 16 +#define panel_height 16 +static char panel_bits[] = { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f}; diff --git a/vendor/x11iraf/ximtool/data/panel1.xbm b/vendor/x11iraf/ximtool/data/panel1.xbm new file mode 100644 index 00000000..405605c2 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/panel1.xbm @@ -0,0 +1,6 @@ +#define panel1_width 16 +#define panel1_height 16 +static char panel1_bits[] = { + 0x00, 0x00, 0xfc, 0x3f, 0xfc, 0x3f, 0x0c, 0x30, 0x0c, 0x30, 0xcc, 0x33, + 0x4c, 0x32, 0x4c, 0x32, 0x4c, 0x32, 0x4c, 0x32, 0x4c, 0x32, 0xcc, 0x33, + 0x0c, 0x30, 0x0c, 0x30, 0xfc, 0x3f, 0xfc, 0x3f}; diff --git a/vendor/x11iraf/ximtool/data/qmark.xbm b/vendor/x11iraf/ximtool/data/qmark.xbm new file mode 100644 index 00000000..f6edbc04 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/qmark.xbm @@ -0,0 +1,6 @@ +#define qmark_width 16 +#define qmark_height 16 +static char qmark_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/rainbow.lut b/vendor/x11iraf/ximtool/data/rainbow.lut new file mode 100644 index 00000000..a26cbca6 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/rainbow.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.16471, +0.02745, 0.00000, 0.18431, +0.05882, 0.00000, 0.20000, +0.08627, 0.00000, 0.21961, +0.11373, 0.00000, 0.23922, +0.14510, 0.00000, 0.25882, +0.17647, 0.00000, 0.27843, +0.20392, 0.00000, 0.29804, +0.23137, 0.00000, 0.31765, +0.26275, 0.00000, 0.33725, +0.29412, 0.00000, 0.35686, +0.32157, 0.00000, 0.37647, +0.35294, 0.00000, 0.39608, +0.38039, 0.00000, 0.41569, +0.41176, 0.00000, 0.43529, +0.43922, 0.00000, 0.45490, +0.47059, 0.00000, 0.47451, +0.49804, 0.00000, 0.49412, +0.52941, 0.00000, 0.51373, +0.55686, 0.00000, 0.53725, +0.58824, 0.00000, 0.55686, +0.55686, 0.00000, 0.57647, +0.52941, 0.00000, 0.59608, +0.49804, 0.00000, 0.61569, +0.47059, 0.00000, 0.63922, +0.43922, 0.00000, 0.65882, +0.41176, 0.00000, 0.67843, +0.38039, 0.00000, 0.70196, +0.35294, 0.00000, 0.72157, +0.32157, 0.00000, 0.74118, +0.29412, 0.00000, 0.76471, +0.26275, 0.00000, 0.78431, +0.23137, 0.00000, 0.80392, +0.20392, 0.00000, 0.82745, +0.17647, 0.00000, 0.84706, +0.14510, 0.00000, 0.87059, +0.11373, 0.00000, 0.89020, +0.08627, 0.00000, 0.91373, +0.05882, 0.00000, 0.93333, +0.02745, 0.00000, 0.95686, +0.00000, 0.00000, 0.97647, +0.00000, 0.00000, 1.00000, +0.00000, 0.02353, 0.97647, +0.00000, 0.04706, 0.95686, +0.00000, 0.06275, 0.93333, +0.00000, 0.08235, 0.91373, +0.00000, 0.09804, 0.89020, +0.00000, 0.11373, 0.87059, +0.00000, 0.12941, 0.84706, +0.00000, 0.14118, 0.82745, +0.00000, 0.15686, 0.80392, +0.00000, 0.16863, 0.78431, +0.00000, 0.18431, 0.76471, +0.00000, 0.19608, 0.74118, +0.00000, 0.21176, 0.72157, +0.00000, 0.22353, 0.70196, +0.00000, 0.23529, 0.67843, +0.00000, 0.25098, 0.65882, +0.00000, 0.26275, 0.63922, +0.00000, 0.27451, 0.61569, +0.00000, 0.28627, 0.59608, +0.00000, 0.29804, 0.57647, +0.00000, 0.30980, 0.55686, +0.00000, 0.32157, 0.53725, +0.00000, 0.33333, 0.51373, +0.00000, 0.34510, 0.49412, +0.00000, 0.35686, 0.47451, +0.00000, 0.36863, 0.45490, +0.00000, 0.38039, 0.43529, +0.00000, 0.39216, 0.41569, +0.00000, 0.40392, 0.39608, +0.00000, 0.41176, 0.37647, +0.00000, 0.42353, 0.35686, +0.00000, 0.43529, 0.33725, +0.00000, 0.44706, 0.31765, +0.00000, 0.45882, 0.29804, +0.00000, 0.46667, 0.27843, +0.00000, 0.47843, 0.25882, +0.00000, 0.49020, 0.23922, +0.00000, 0.49804, 0.21961, +0.00000, 0.50980, 0.20000, +0.00000, 0.52157, 0.18431, +0.00000, 0.52941, 0.16471, +0.00000, 0.54118, 0.14510, +0.00000, 0.55294, 0.12941, +0.00000, 0.56078, 0.10980, +0.00000, 0.57255, 0.09412, +0.00000, 0.58431, 0.07451, +0.00000, 0.59216, 0.05882, +0.00000, 0.60392, 0.04314, +0.00000, 0.61176, 0.02745, +0.00000, 0.62353, 0.01176, +0.00000, 0.63137, 0.00000, +0.00000, 0.64314, 0.00000, +0.00000, 0.65098, 0.00000, +0.00000, 0.66275, 0.00000, +0.00000, 0.67059, 0.00000, +0.00000, 0.68235, 0.00000, +0.00000, 0.69020, 0.00000, +0.00000, 0.70196, 0.00000, +0.00000, 0.70980, 0.00000, +0.00000, 0.72157, 0.00000, +0.00000, 0.72941, 0.00000, +0.00000, 0.74118, 0.00000, +0.00000, 0.74902, 0.00000, +0.00000, 0.76078, 0.00000, +0.00000, 0.76863, 0.00000, +0.00000, 0.77647, 0.00000, +0.00000, 0.78824, 0.00000, +0.00000, 0.79608, 0.00000, +0.00000, 0.80784, 0.00000, +0.00000, 0.81569, 0.00000, +0.00000, 0.82353, 0.00000, +0.00000, 0.83529, 0.00000, +0.00000, 0.84314, 0.00000, +0.00000, 0.85490, 0.00000, +0.00000, 0.86275, 0.00000, +0.00000, 0.87059, 0.00000, +0.00000, 0.88235, 0.00000, +0.00000, 0.89020, 0.00000, +0.00000, 0.89804, 0.00000, +0.00000, 0.90980, 0.00000, +0.00000, 0.91765, 0.00000, +0.00000, 0.92549, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.94510, 0.00000, +0.00000, 0.95294, 0.00000, +0.00000, 0.96078, 0.00000, +0.00000, 0.97255, 0.00000, +0.00000, 0.98039, 0.00000, +0.00000, 0.98824, 0.00000, +0.00000, 1.00000, 0.00000, +0.00000, 0.98824, 0.00000, +0.00000, 0.98039, 0.00000, +0.00000, 0.97255, 0.00000, +0.00000, 0.96078, 0.00000, +0.00000, 0.95294, 0.00000, +0.00000, 0.94510, 0.00000, +0.00000, 0.93725, 0.00000, +0.00000, 0.92549, 0.00000, +0.00000, 0.91765, 0.00000, +0.00000, 0.90980, 0.00000, +0.00000, 0.89804, 0.00000, +0.00000, 0.89020, 0.00000, +0.00000, 0.88235, 0.00000, +0.00000, 0.87059, 0.00000, +0.00000, 0.86275, 0.00000, +0.00000, 0.85490, 0.00000, +0.00000, 0.84314, 0.00000, +0.00000, 0.83529, 0.00000, +0.00000, 0.82353, 0.00000, +0.00000, 0.81569, 0.00000, +0.00000, 0.80784, 0.00000, +0.00000, 0.79608, 0.00000, +0.00000, 0.78824, 0.00000, +0.00000, 0.77647, 0.00000, +0.00784, 0.76863, 0.00000, +0.03529, 0.77647, 0.00000, +0.06667, 0.78824, 0.00000, +0.09804, 0.80000, 0.00000, +0.12941, 0.81176, 0.00000, +0.16471, 0.82745, 0.00000, +0.20000, 0.84314, 0.00000, +0.23529, 0.85882, 0.00000, +0.26667, 0.87059, 0.00000, +0.30588, 0.89020, 0.00000, +0.34118, 0.90196, 0.00000, +0.37647, 0.92157, 0.00000, +0.41176, 0.93333, 0.00000, +0.44706, 0.95294, 0.00000, +0.48627, 0.96863, 0.00000, +0.52157, 0.98824, 0.00000, +0.56078, 1.00000, 0.00000, +0.59608, 1.00000, 0.00000, +0.63529, 1.00000, 0.00000, +0.67059, 1.00000, 0.00000, +0.70980, 1.00000, 0.00000, +0.74902, 1.00000, 0.00000, +0.78431, 1.00000, 0.00000, +0.82353, 1.00000, 0.00000, +0.85882, 1.00000, 0.00000, +0.89804, 1.00000, 0.00000, +0.93333, 1.00000, 0.00000, +0.97647, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +1.00000, 1.00000, 0.00000, +0.99608, 1.00000, 0.00000, +0.98039, 1.00000, 0.00000, +0.96078, 0.97647, 0.00000, +0.94510, 0.93725, 0.00000, +0.92549, 0.89804, 0.00000, +0.90980, 0.85882, 0.00000, +0.89412, 0.81961, 0.00000, +0.87451, 0.78039, 0.00000, +0.85882, 0.74118, 0.00000, +0.83922, 0.70196, 0.00000, +0.82353, 0.66275, 0.00000, +0.80392, 0.62353, 0.00000, +0.78824, 0.58431, 0.00000, +0.76863, 0.54510, 0.00000, +0.75686, 0.50980, 0.00000, +0.74118, 0.46667, 0.00000, +0.72549, 0.43137, 0.00000, +0.70980, 0.39216, 0.00000, +0.69412, 0.35294, 0.00000, +0.68235, 0.31765, 0.00000, +0.66275, 0.27451, 0.00000, +0.65098, 0.23922, 0.00000, +0.63529, 0.20000, 0.00000, +0.62745, 0.16863, 0.00000, +0.61569, 0.12941, 0.00000, +0.60784, 0.09804, 0.00000, +0.61961, 0.08235, 0.00000, +0.62745, 0.06275, 0.00000, +0.63922, 0.04706, 0.00000, +0.64706, 0.02353, 0.00000, +0.65882, 0.00000, 0.00000, +0.66667, 0.00000, 0.00000, +0.67843, 0.00000, 0.00000, +0.68627, 0.00000, 0.00000, +0.69804, 0.00000, 0.00000, +0.70980, 0.00000, 0.00000, +0.71765, 0.00000, 0.00000, +0.72941, 0.00000, 0.00000, +0.73725, 0.00000, 0.00000, +0.74902, 0.00000, 0.00000, +0.75686, 0.00000, 0.00000, +0.76863, 0.00000, 0.00000, +0.77647, 0.00000, 0.00000, +0.78824, 0.00000, 0.00000, +0.80000, 0.00784, 0.00784, +0.80784, 0.02745, 0.02745, +0.81961, 0.05098, 0.05098, +0.82745, 0.08235, 0.08235, +0.83922, 0.11373, 0.11373, +0.84706, 0.14902, 0.14902, +0.85882, 0.19216, 0.19216, +0.86667, 0.23137, 0.23137, +0.87843, 0.27843, 0.27843, +0.88627, 0.32549, 0.32549, +0.89804, 0.37647, 0.37647, +0.90980, 0.43137, 0.43137, +0.91765, 0.48627, 0.48627, +0.92941, 0.54118, 0.54118, +0.93725, 0.60000, 0.60000, +0.94902, 0.66275, 0.66275, +0.95686, 0.72549, 0.72549, +0.96863, 0.79216, 0.79216, +0.97647, 0.85882, 0.85882, +0.98824, 0.92941, 0.92941, +1.00000, 1.00000, 1.00000 diff --git a/vendor/x11iraf/ximtool/data/rarrow.xbm b/vendor/x11iraf/ximtool/data/rarrow.xbm new file mode 100644 index 00000000..ef327106 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/rarrow.xbm @@ -0,0 +1,6 @@ +#define rarrow_width 16 +#define rarrow_height 16 +static char rarrow_bits[] = { + 0x40, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x0f, + 0xf8, 0x1f, 0xf8, 0x3f, 0xf8, 0x3f, 0xf8, 0x1f, 0xf8, 0x0f, 0xf8, 0x07, + 0xf8, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x40, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/red.lut b/vendor/x11iraf/ximtool/data/red.lut new file mode 100644 index 00000000..0af15037 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/red.lut @@ -0,0 +1,257 @@ +256, +0.00000, 0.00000, 0.00000, +0.00392, 0.00000, 0.00000, +0.00784, 0.00000, 0.00000, +0.01176, 0.00000, 0.00000, +0.01569, 0.00000, 0.00000, +0.01961, 0.00000, 0.00000, +0.02353, 0.00000, 0.00000, +0.02745, 0.00000, 0.00000, +0.03137, 0.00000, 0.00000, +0.03529, 0.00000, 0.00000, +0.03922, 0.00000, 0.00000, +0.04314, 0.00000, 0.00000, +0.04706, 0.00000, 0.00000, +0.05098, 0.00000, 0.00000, +0.05490, 0.00000, 0.00000, +0.05882, 0.00000, 0.00000, +0.06275, 0.00000, 0.00000, +0.06667, 0.00000, 0.00000, +0.07059, 0.00000, 0.00000, +0.07451, 0.00000, 0.00000, +0.07843, 0.00000, 0.00000, +0.08235, 0.00000, 0.00000, +0.08627, 0.00000, 0.00000, +0.09020, 0.00000, 0.00000, +0.09412, 0.00000, 0.00000, +0.09804, 0.00000, 0.00000, +0.10196, 0.00000, 0.00000, +0.10588, 0.00000, 0.00000, +0.10980, 0.00000, 0.00000, +0.11373, 0.00000, 0.00000, +0.11765, 0.00000, 0.00000, +0.12157, 0.00000, 0.00000, +0.12549, 0.00000, 0.00000, +0.12941, 0.00000, 0.00000, +0.13333, 0.00000, 0.00000, +0.13725, 0.00000, 0.00000, +0.14118, 0.00000, 0.00000, +0.14510, 0.00000, 0.00000, +0.14902, 0.00000, 0.00000, +0.15294, 0.00000, 0.00000, +0.15686, 0.00000, 0.00000, +0.16078, 0.00000, 0.00000, +0.16471, 0.00000, 0.00000, +0.16863, 0.00000, 0.00000, +0.17255, 0.00000, 0.00000, +0.17647, 0.00000, 0.00000, +0.18039, 0.00000, 0.00000, +0.18431, 0.00000, 0.00000, +0.18824, 0.00000, 0.00000, +0.19216, 0.00000, 0.00000, +0.19608, 0.00000, 0.00000, +0.20000, 0.00000, 0.00000, +0.20392, 0.00000, 0.00000, +0.20784, 0.00000, 0.00000, +0.21176, 0.00000, 0.00000, +0.21569, 0.00000, 0.00000, +0.21961, 0.00000, 0.00000, +0.22353, 0.00000, 0.00000, +0.22745, 0.00000, 0.00000, +0.23137, 0.00000, 0.00000, +0.23529, 0.00000, 0.00000, +0.23922, 0.00000, 0.00000, +0.24314, 0.00000, 0.00000, +0.24706, 0.00000, 0.00000, +0.25098, 0.00000, 0.00000, +0.25490, 0.00000, 0.00000, +0.25882, 0.00000, 0.00000, +0.26275, 0.00000, 0.00000, +0.26667, 0.00000, 0.00000, +0.27059, 0.00000, 0.00000, +0.27451, 0.00000, 0.00000, +0.27843, 0.00000, 0.00000, +0.28235, 0.00000, 0.00000, +0.28627, 0.00000, 0.00000, +0.29020, 0.00000, 0.00000, +0.29412, 0.00000, 0.00000, +0.29804, 0.00000, 0.00000, +0.30196, 0.00000, 0.00000, +0.30588, 0.00000, 0.00000, +0.30980, 0.00000, 0.00000, +0.31373, 0.00000, 0.00000, +0.31765, 0.00000, 0.00000, +0.32157, 0.00000, 0.00000, +0.32549, 0.00000, 0.00000, +0.32941, 0.00000, 0.00000, +0.33333, 0.00000, 0.00000, +0.33725, 0.00000, 0.00000, +0.34118, 0.00000, 0.00000, +0.34510, 0.00000, 0.00000, +0.34902, 0.00000, 0.00000, +0.35294, 0.00000, 0.00000, +0.35686, 0.00000, 0.00000, +0.36078, 0.00000, 0.00000, +0.36471, 0.00000, 0.00000, +0.36863, 0.00000, 0.00000, +0.37255, 0.00000, 0.00000, +0.37647, 0.00000, 0.00000, +0.38039, 0.00000, 0.00000, +0.38431, 0.00000, 0.00000, +0.38824, 0.00000, 0.00000, +0.39216, 0.00000, 0.00000, +0.39608, 0.00000, 0.00000, +0.40000, 0.00000, 0.00000, +0.40392, 0.00000, 0.00000, +0.40784, 0.00000, 0.00000, +0.41176, 0.00000, 0.00000, +0.41569, 0.00000, 0.00000, +0.41961, 0.00000, 0.00000, +0.42353, 0.00000, 0.00000, +0.42745, 0.00000, 0.00000, +0.43137, 0.00000, 0.00000, +0.43529, 0.00000, 0.00000, +0.43922, 0.00000, 0.00000, +0.44314, 0.00000, 0.00000, +0.44706, 0.00000, 0.00000, +0.45098, 0.00000, 0.00000, +0.45490, 0.00000, 0.00000, +0.45882, 0.00000, 0.00000, +0.46275, 0.00000, 0.00000, +0.46667, 0.00000, 0.00000, +0.47059, 0.00000, 0.00000, +0.47451, 0.00000, 0.00000, +0.47843, 0.00000, 0.00000, +0.48235, 0.00000, 0.00000, +0.48627, 0.00000, 0.00000, +0.49020, 0.00000, 0.00000, +0.49412, 0.00000, 0.00000, +0.49804, 0.00000, 0.00000, +0.50196, 0.00000, 0.00000, +0.50588, 0.00000, 0.00000, +0.50980, 0.00000, 0.00000, +0.51373, 0.00000, 0.00000, +0.51765, 0.00000, 0.00000, +0.52157, 0.00000, 0.00000, +0.52549, 0.00000, 0.00000, +0.52941, 0.00000, 0.00000, +0.53333, 0.00000, 0.00000, +0.53725, 0.00000, 0.00000, +0.54118, 0.00000, 0.00000, +0.54510, 0.00000, 0.00000, +0.54902, 0.00000, 0.00000, +0.55294, 0.00000, 0.00000, +0.55686, 0.00000, 0.00000, +0.56078, 0.00000, 0.00000, +0.56471, 0.00000, 0.00000, +0.56863, 0.00000, 0.00000, +0.57255, 0.00000, 0.00000, +0.57647, 0.00000, 0.00000, +0.58039, 0.00000, 0.00000, +0.58431, 0.00000, 0.00000, +0.58824, 0.00000, 0.00000, +0.59216, 0.00000, 0.00000, +0.59608, 0.00000, 0.00000, +0.60000, 0.00000, 0.00000, +0.60392, 0.00000, 0.00000, +0.60784, 0.00000, 0.00000, +0.61176, 0.00000, 0.00000, +0.61569, 0.00000, 0.00000, +0.61961, 0.00000, 0.00000, +0.62353, 0.00000, 0.00000, +0.62745, 0.00000, 0.00000, +0.63137, 0.00000, 0.00000, +0.63529, 0.00000, 0.00000, +0.63922, 0.00000, 0.00000, +0.64314, 0.00000, 0.00000, +0.64706, 0.00000, 0.00000, +0.65098, 0.00000, 0.00000, +0.65490, 0.00000, 0.00000, +0.65882, 0.00000, 0.00000, +0.66275, 0.00000, 0.00000, +0.66667, 0.00000, 0.00000, +0.67059, 0.00000, 0.00000, +0.67451, 0.00000, 0.00000, +0.67843, 0.00000, 0.00000, +0.68235, 0.00000, 0.00000, +0.68627, 0.00000, 0.00000, +0.69020, 0.00000, 0.00000, +0.69412, 0.00000, 0.00000, +0.69804, 0.00000, 0.00000, +0.70196, 0.00000, 0.00000, +0.70588, 0.00000, 0.00000, +0.70980, 0.00000, 0.00000, +0.71373, 0.00000, 0.00000, +0.71765, 0.00000, 0.00000, +0.72157, 0.00000, 0.00000, +0.72549, 0.00000, 0.00000, +0.72941, 0.00000, 0.00000, +0.73333, 0.00000, 0.00000, +0.73725, 0.00000, 0.00000, +0.74118, 0.00000, 0.00000, +0.74510, 0.00000, 0.00000, +0.74902, 0.00000, 0.00000, +0.75294, 0.00000, 0.00000, +0.75686, 0.00000, 0.00000, +0.76078, 0.00000, 0.00000, +0.76471, 0.00000, 0.00000, +0.76863, 0.00000, 0.00000, +0.77255, 0.00000, 0.00000, +0.77647, 0.00000, 0.00000, +0.78039, 0.00000, 0.00000, +0.78431, 0.00000, 0.00000, +0.78824, 0.00000, 0.00000, +0.79216, 0.00000, 0.00000, +0.79608, 0.00000, 0.00000, +0.80000, 0.00000, 0.00000, +0.80392, 0.00000, 0.00000, +0.80784, 0.00000, 0.00000, +0.81176, 0.00000, 0.00000, +0.81569, 0.00000, 0.00000, +0.81961, 0.00000, 0.00000, +0.82353, 0.00000, 0.00000, +0.82745, 0.00000, 0.00000, +0.83137, 0.00000, 0.00000, +0.83529, 0.00000, 0.00000, +0.83922, 0.00000, 0.00000, +0.84314, 0.00000, 0.00000, +0.84706, 0.00000, 0.00000, +0.85098, 0.00000, 0.00000, +0.85490, 0.00000, 0.00000, +0.85882, 0.00000, 0.00000, +0.86275, 0.00000, 0.00000, +0.86667, 0.00000, 0.00000, +0.87059, 0.00000, 0.00000, +0.87451, 0.00000, 0.00000, +0.87843, 0.00000, 0.00000, +0.88235, 0.00000, 0.00000, +0.88627, 0.00000, 0.00000, +0.89020, 0.00000, 0.00000, +0.89412, 0.00000, 0.00000, +0.89804, 0.00000, 0.00000, +0.90196, 0.00000, 0.00000, +0.90588, 0.00000, 0.00000, +0.90980, 0.00000, 0.00000, +0.91373, 0.00000, 0.00000, +0.91765, 0.00000, 0.00000, +0.92157, 0.00000, 0.00000, +0.92549, 0.00000, 0.00000, +0.92941, 0.00000, 0.00000, +0.93333, 0.00000, 0.00000, +0.93725, 0.00000, 0.00000, +0.94118, 0.00000, 0.00000, +0.94510, 0.00000, 0.00000, +0.94902, 0.00000, 0.00000, +0.95294, 0.00000, 0.00000, +0.95686, 0.00000, 0.00000, +0.96078, 0.00000, 0.00000, +0.96471, 0.00000, 0.00000, +0.96863, 0.00000, 0.00000, +0.97255, 0.00000, 0.00000, +0.97647, 0.00000, 0.00000, +0.98039, 0.00000, 0.00000, +0.98431, 0.00000, 0.00000, +0.98824, 0.00000, 0.00000, +0.99216, 0.00000, 0.00000, +0.99608, 0.00000, 0.00392, +1.00000, 0.00000, 0.00784 diff --git a/vendor/x11iraf/ximtool/data/solid.xbm b/vendor/x11iraf/ximtool/data/solid.xbm new file mode 100644 index 00000000..4e24b3a0 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/solid.xbm @@ -0,0 +1,19 @@ +#define solid_width 64 +#define solid_height 24 +static char solid_bits[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/staircase.lut b/vendor/x11iraf/ximtool/data/staircase.lut new file mode 100644 index 00000000..88e84057 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/staircase.lut @@ -0,0 +1,257 @@ +256, +0.00392, 0.00392, 0.31373, +0.00784, 0.00784, 0.31373, +0.01176, 0.01176, 0.31373, +0.01569, 0.01569, 0.31373, +0.01961, 0.01961, 0.31373, +0.02353, 0.02353, 0.31373, +0.02745, 0.02745, 0.31373, +0.03137, 0.03137, 0.31373, +0.03529, 0.03529, 0.31373, +0.03922, 0.03922, 0.31373, +0.04314, 0.04314, 0.31373, +0.04706, 0.04706, 0.31373, +0.05098, 0.05098, 0.31373, +0.05490, 0.05490, 0.31373, +0.05882, 0.05882, 0.31373, +0.06275, 0.06275, 0.31373, +0.06667, 0.06667, 0.47059, +0.07059, 0.07059, 0.47059, +0.07451, 0.07451, 0.47059, +0.07843, 0.07843, 0.47059, +0.08235, 0.08235, 0.47059, +0.08627, 0.08627, 0.47059, +0.09020, 0.09020, 0.47059, +0.09412, 0.09412, 0.47059, +0.09804, 0.09804, 0.47059, +0.10196, 0.10196, 0.47059, +0.10588, 0.10588, 0.47059, +0.10980, 0.10980, 0.47059, +0.11373, 0.11373, 0.47059, +0.11765, 0.11765, 0.47059, +0.12157, 0.12157, 0.47059, +0.12549, 0.12549, 0.47059, +0.12941, 0.12941, 0.62745, +0.13333, 0.13333, 0.62745, +0.13725, 0.13725, 0.62745, +0.14118, 0.14118, 0.62745, +0.14510, 0.14510, 0.62745, +0.14902, 0.14902, 0.62745, +0.15294, 0.15294, 0.62745, +0.15686, 0.15686, 0.62745, +0.16078, 0.16078, 0.62745, +0.16471, 0.16471, 0.62745, +0.16863, 0.16863, 0.62745, +0.17255, 0.17255, 0.62745, +0.17647, 0.17647, 0.62745, +0.18039, 0.18039, 0.62745, +0.18431, 0.18431, 0.62745, +0.18824, 0.18824, 0.62745, +0.19216, 0.19216, 0.78431, +0.19608, 0.19608, 0.78431, +0.20000, 0.20000, 0.78431, +0.20392, 0.20392, 0.78431, +0.20784, 0.20784, 0.78431, +0.21176, 0.21176, 0.78431, +0.21569, 0.21569, 0.78431, +0.21961, 0.21961, 0.78431, +0.22353, 0.22353, 0.78431, +0.22745, 0.22745, 0.78431, +0.23137, 0.23137, 0.78431, +0.23529, 0.23529, 0.78431, +0.23922, 0.23922, 0.78431, +0.24314, 0.24314, 0.78431, +0.24706, 0.24706, 0.78431, +0.25098, 0.25098, 0.78431, +0.25490, 0.25490, 0.94118, +0.25882, 0.25882, 0.94118, +0.26275, 0.26275, 0.94118, +0.26667, 0.26667, 0.94118, +0.27059, 0.27059, 0.94118, +0.27451, 0.27451, 0.94118, +0.27843, 0.27843, 0.94118, +0.28235, 0.28235, 0.94118, +0.28627, 0.28627, 0.94118, +0.29020, 0.29020, 0.94118, +0.29412, 0.29412, 0.94118, +0.29804, 0.29804, 0.94118, +0.30196, 0.30196, 0.94118, +0.30588, 0.30588, 0.94118, +0.30980, 0.30980, 0.94118, +0.31373, 0.31373, 0.94118, +0.31765, 0.31765, 0.95294, +0.32157, 0.32157, 0.96471, +0.32549, 0.32549, 0.97647, +0.32941, 0.32941, 0.98824, +0.33333, 0.33333, 1.00000, +0.00392, 0.31373, 0.00392, +0.00784, 0.31373, 0.00784, +0.01176, 0.31373, 0.01176, +0.01569, 0.31373, 0.01569, +0.01961, 0.31373, 0.01961, +0.02353, 0.31373, 0.02353, +0.02745, 0.31373, 0.02745, +0.03137, 0.31373, 0.03137, +0.03529, 0.31373, 0.03529, +0.03922, 0.31373, 0.03922, +0.04314, 0.31373, 0.04314, +0.04706, 0.31373, 0.04706, +0.05098, 0.31373, 0.05098, +0.05490, 0.31373, 0.05490, +0.05882, 0.31373, 0.05882, +0.06275, 0.31373, 0.06275, +0.06667, 0.47059, 0.06667, +0.07059, 0.47059, 0.07059, +0.07451, 0.47059, 0.07451, +0.07843, 0.47059, 0.07843, +0.08235, 0.47059, 0.08235, +0.08627, 0.47059, 0.08627, +0.09020, 0.47059, 0.09020, +0.09412, 0.47059, 0.09412, +0.09804, 0.47059, 0.09804, +0.10196, 0.47059, 0.10196, +0.10588, 0.47059, 0.10588, +0.10980, 0.47059, 0.10980, +0.11373, 0.47059, 0.11373, +0.11765, 0.47059, 0.11765, +0.12157, 0.47059, 0.12157, +0.12549, 0.47059, 0.12549, +0.12941, 0.62745, 0.12941, +0.13333, 0.62745, 0.13333, +0.13725, 0.62745, 0.13725, +0.14118, 0.62745, 0.14118, +0.14510, 0.62745, 0.14510, +0.14902, 0.62745, 0.14902, +0.15294, 0.62745, 0.15294, +0.15686, 0.62745, 0.15686, +0.16078, 0.62745, 0.16078, +0.16471, 0.62745, 0.16471, +0.16863, 0.62745, 0.16863, +0.17255, 0.62745, 0.17255, +0.17647, 0.62745, 0.17647, +0.18039, 0.62745, 0.18039, +0.18431, 0.62745, 0.18431, +0.18824, 0.62745, 0.18824, +0.19216, 0.78431, 0.19216, +0.19608, 0.78431, 0.19608, +0.20000, 0.78431, 0.20000, +0.20392, 0.78431, 0.20392, +0.20784, 0.78431, 0.20784, +0.21176, 0.78431, 0.21176, +0.21569, 0.78431, 0.21569, +0.21961, 0.78431, 0.21961, +0.22353, 0.78431, 0.22353, +0.22745, 0.78431, 0.22745, +0.23137, 0.78431, 0.23137, +0.23529, 0.78431, 0.23529, +0.23922, 0.78431, 0.23922, +0.24314, 0.78431, 0.24314, +0.24706, 0.78431, 0.24706, +0.25098, 0.78431, 0.25098, +0.25490, 0.94118, 0.25490, +0.25882, 0.94118, 0.25882, +0.26275, 0.94118, 0.26275, +0.26667, 0.94118, 0.26667, +0.27059, 0.94118, 0.27059, +0.27451, 0.94118, 0.27451, +0.27843, 0.94118, 0.27843, +0.28235, 0.94118, 0.28235, +0.28627, 0.94118, 0.28627, +0.29020, 0.94118, 0.29020, +0.29412, 0.94118, 0.29412, +0.29804, 0.94118, 0.29804, +0.30196, 0.94118, 0.30196, +0.30588, 0.94118, 0.30588, +0.30980, 0.94118, 0.30980, +0.31373, 0.94118, 0.31373, +0.31765, 0.95294, 0.31765, +0.32157, 0.96471, 0.32157, +0.32549, 0.97647, 0.32549, +0.32941, 0.98824, 0.32941, +0.33333, 1.00000, 0.33333, +0.31373, 0.00392, 0.00392, +0.31373, 0.00784, 0.00784, +0.31373, 0.01176, 0.01176, +0.31373, 0.01569, 0.01569, +0.31373, 0.01961, 0.01961, +0.31373, 0.02353, 0.02353, +0.31373, 0.02745, 0.02745, +0.31373, 0.03137, 0.03137, +0.31373, 0.03529, 0.03529, +0.31373, 0.03922, 0.03922, +0.31373, 0.04314, 0.04314, +0.31373, 0.04706, 0.04706, +0.31373, 0.05098, 0.05098, +0.31373, 0.05490, 0.05490, +0.31373, 0.05882, 0.05882, +0.31373, 0.06275, 0.06275, +0.47059, 0.06667, 0.06667, +0.47059, 0.07059, 0.07059, +0.47059, 0.07451, 0.07451, +0.47059, 0.07843, 0.07843, +0.47059, 0.08235, 0.08235, +0.47059, 0.08627, 0.08627, +0.47059, 0.09020, 0.09020, +0.47059, 0.09412, 0.09412, +0.47059, 0.09804, 0.09804, +0.47059, 0.10196, 0.10196, +0.47059, 0.10588, 0.10588, +0.47059, 0.10980, 0.10980, +0.47059, 0.11373, 0.11373, +0.47059, 0.11765, 0.11765, +0.47059, 0.12157, 0.12157, +0.47059, 0.12549, 0.12549, +0.62745, 0.12941, 0.12941, +0.62745, 0.13333, 0.13333, +0.62745, 0.13725, 0.13725, +0.62745, 0.14118, 0.14118, +0.62745, 0.14510, 0.14510, +0.62745, 0.14902, 0.14902, +0.62745, 0.15294, 0.15294, +0.62745, 0.15686, 0.15686, +0.62745, 0.16078, 0.16078, +0.62745, 0.16471, 0.16471, +0.62745, 0.16863, 0.16863, +0.62745, 0.17255, 0.17255, +0.62745, 0.17647, 0.17647, +0.62745, 0.18039, 0.18039, +0.62745, 0.18431, 0.18431, +0.62745, 0.18824, 0.18824, +0.78431, 0.19216, 0.19216, +0.78431, 0.19608, 0.19608, +0.78431, 0.20000, 0.20000, +0.78431, 0.20392, 0.20392, +0.78431, 0.20784, 0.20784, +0.78431, 0.21176, 0.21176, +0.78431, 0.21569, 0.21569, +0.78431, 0.21961, 0.21961, +0.78431, 0.22353, 0.22353, +0.78431, 0.22745, 0.22745, +0.78431, 0.23137, 0.23137, +0.78431, 0.23529, 0.23529, +0.78431, 0.23922, 0.23922, +0.78431, 0.24314, 0.24314, +0.78431, 0.24706, 0.24706, +0.78431, 0.25098, 0.25098, +0.94118, 0.25490, 0.25490, +0.94118, 0.25882, 0.25882, +0.94118, 0.26275, 0.26275, +0.94118, 0.26667, 0.26667, +0.94118, 0.27059, 0.27059, +0.94118, 0.27451, 0.27451, +0.94118, 0.27843, 0.27843, +0.94118, 0.28235, 0.28235, +0.94118, 0.28627, 0.28627, +0.94118, 0.29020, 0.29020, +0.94118, 0.29412, 0.29412, +0.94118, 0.29804, 0.29804, +0.94118, 0.30196, 0.30196, +0.94118, 0.30588, 0.30588, +0.94118, 0.30980, 0.30980, +0.94118, 0.31373, 0.31373, +0.94902, 0.39216, 0.39216, +0.96078, 0.52941, 0.52941, +0.97255, 0.66667, 0.66667, +0.98431, 0.80392, 0.80392, +0.99216, 0.80000, 0.80000, +1.00000, 1.00000, 1.00000 diff --git a/vendor/x11iraf/ximtool/data/standard.lut b/vendor/x11iraf/ximtool/data/standard.lut new file mode 100644 index 00000000..f77dcf02 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/standard.lut @@ -0,0 +1,257 @@ +256, +0.00392, 0.00392, 0.33333, +0.00784, 0.00784, 0.34118, +0.01176, 0.01176, 0.34902, +0.01569, 0.01569, 0.35686, +0.01961, 0.01961, 0.36471, +0.02353, 0.02353, 0.37255, +0.02745, 0.02745, 0.38039, +0.03137, 0.03137, 0.38824, +0.03529, 0.03529, 0.39608, +0.03922, 0.03922, 0.40392, +0.04314, 0.04314, 0.41176, +0.04706, 0.04706, 0.41961, +0.05098, 0.05098, 0.42745, +0.05490, 0.05490, 0.43529, +0.05882, 0.05882, 0.44314, +0.06275, 0.06275, 0.45098, +0.06667, 0.06667, 0.45882, +0.07059, 0.07059, 0.46667, +0.07451, 0.07451, 0.47451, +0.07843, 0.07843, 0.48235, +0.08235, 0.08235, 0.49020, +0.08627, 0.08627, 0.49804, +0.09020, 0.09020, 0.50588, +0.09412, 0.09412, 0.51373, +0.09804, 0.09804, 0.52157, +0.10196, 0.10196, 0.52941, +0.10588, 0.10588, 0.53725, +0.10980, 0.10980, 0.54510, +0.11373, 0.11373, 0.55294, +0.11765, 0.11765, 0.56078, +0.12157, 0.12157, 0.56863, +0.12549, 0.12549, 0.57647, +0.12941, 0.12941, 0.58431, +0.13333, 0.13333, 0.59210, +0.13725, 0.13725, 0.60000, +0.14118, 0.14118, 0.60784, +0.14510, 0.14510, 0.61569, +0.14902, 0.14902, 0.62353, +0.15294, 0.15294, 0.63137, +0.15686, 0.15686, 0.63922, +0.16078, 0.16078, 0.64706, +0.16471, 0.16471, 0.65490, +0.16863, 0.16863, 0.66275, +0.17255, 0.17255, 0.67059, +0.17647, 0.17647, 0.67843, +0.18039, 0.18039, 0.68627, +0.18431, 0.18431, 0.69412, +0.18824, 0.18824, 0.70196, +0.19216, 0.19216, 0.70980, +0.19608, 0.19608, 0.71765, +0.20000, 0.20000, 0.72549, +0.20392, 0.20392, 0.73333, +0.20784, 0.20784, 0.74118, +0.21176, 0.21176, 0.74902, +0.21569, 0.21569, 0.75686, +0.21961, 0.21961, 0.76471, +0.22353, 0.22353, 0.77255, +0.22745, 0.22745, 0.78039, +0.23137, 0.23137, 0.78824, +0.23529, 0.23529, 0.79608, +0.23922, 0.23922, 0.80392, +0.24314, 0.24314, 0.81176, +0.24706, 0.24706, 0.81961, +0.25098, 0.25098, 0.82745, +0.25490, 0.25490, 0.83529, +0.25882, 0.25882, 0.84314, +0.26275, 0.26275, 0.85098, +0.26667, 0.26667, 0.85882, +0.27059, 0.27059, 0.86667, +0.27451, 0.27451, 0.87451, +0.27843, 0.27843, 0.88235, +0.28235, 0.28235, 0.89020, +0.28627, 0.28627, 0.89804, +0.29020, 0.29020, 0.90588, +0.29412, 0.29412, 0.91373, +0.29804, 0.29804, 0.92157, +0.30196, 0.30196, 0.92941, +0.30588, 0.30588, 0.93725, +0.30980, 0.30980, 0.94510, +0.31373, 0.31373, 0.95294, +0.31765, 0.31765, 0.96078, +0.32157, 0.32157, 0.96863, +0.32549, 0.32549, 0.97647, +0.32941, 0.32941, 0.98431, +0.33333, 0.33333, 0.99216, +0.00392, 0.33333, 0.00392, +0.00784, 0.34118, 0.00784, +0.01176, 0.34902, 0.01176, +0.01569, 0.35686, 0.01569, +0.01961, 0.36471, 0.01961, +0.02353, 0.37255, 0.02353, +0.02745, 0.38039, 0.02745, +0.03137, 0.38824, 0.03137, +0.03529, 0.39608, 0.03529, +0.03922, 0.40392, 0.03922, +0.04314, 0.41176, 0.04314, +0.04706, 0.41961, 0.04706, +0.05098, 0.42745, 0.05098, +0.05490, 0.43529, 0.05490, +0.05882, 0.44314, 0.05882, +0.06275, 0.45098, 0.06275, +0.06667, 0.45882, 0.06667, +0.07059, 0.46667, 0.07059, +0.07451, 0.47451, 0.07451, +0.07843, 0.48235, 0.07843, +0.08235, 0.49020, 0.08235, +0.08627, 0.49804, 0.08627, +0.09020, 0.50588, 0.09020, +0.09412, 0.51373, 0.09412, +0.09804, 0.52157, 0.09804, +0.10196, 0.52941, 0.10196, +0.10588, 0.53725, 0.10588, +0.10980, 0.54510, 0.10980, +0.11373, 0.55294, 0.11373, +0.11765, 0.56078, 0.11765, +0.12157, 0.56863, 0.12157, +0.12549, 0.57647, 0.12549, +0.12941, 0.58431, 0.12941, +0.13333, 0.59210, 0.13333, +0.13725, 0.60000, 0.13725, +0.14118, 0.60784, 0.14118, +0.14510, 0.61569, 0.14510, +0.14902, 0.62353, 0.14902, +0.15294, 0.63137, 0.15294, +0.15686, 0.63922, 0.15686, +0.16078, 0.64706, 0.16078, +0.16471, 0.65490, 0.16471, +0.16863, 0.66275, 0.16863, +0.17255, 0.67059, 0.17255, +0.17647, 0.67843, 0.17647, +0.18039, 0.68627, 0.18039, +0.18431, 0.69412, 0.18431, +0.18824, 0.70196, 0.18824, +0.19216, 0.70980, 0.19216, +0.19608, 0.71765, 0.19608, +0.20000, 0.72549, 0.20000, +0.20392, 0.73333, 0.20392, +0.20784, 0.74118, 0.20784, +0.21176, 0.74902, 0.21176, +0.21569, 0.75686, 0.21569, +0.21961, 0.76471, 0.21961, +0.22353, 0.77255, 0.22353, +0.22745, 0.78039, 0.22745, +0.23137, 0.78824, 0.23137, +0.23529, 0.79608, 0.23529, +0.23922, 0.80392, 0.23922, +0.24314, 0.81176, 0.24314, +0.24706, 0.81961, 0.24706, +0.25098, 0.82745, 0.25098, +0.25490, 0.83529, 0.25490, +0.25882, 0.84314, 0.25882, +0.26275, 0.85098, 0.26275, +0.26667, 0.85882, 0.26667, +0.27059, 0.86667, 0.27059, +0.27451, 0.87451, 0.27451, +0.27843, 0.88235, 0.27843, +0.28235, 0.89020, 0.28235, +0.28627, 0.89804, 0.28627, +0.29020, 0.90588, 0.29020, +0.29412, 0.91373, 0.29412, +0.29804, 0.92157, 0.29804, +0.30196, 0.92941, 0.30196, +0.30588, 0.93725, 0.30588, +0.30980, 0.94510, 0.30980, +0.31373, 0.95294, 0.31373, +0.31765, 0.96078, 0.31765, +0.32157, 0.96863, 0.32157, +0.32549, 0.97647, 0.32549, +0.32941, 0.98431, 0.32941, +0.33333, 0.99216, 0.33333, +0.33333, 0.00392, 0.00392, +0.34118, 0.00784, 0.00784, +0.34902, 0.01176, 0.01176, +0.35686, 0.01569, 0.01569, +0.36471, 0.01961, 0.01961, +0.37255, 0.02353, 0.02353, +0.38039, 0.02745, 0.02745, +0.38824, 0.03137, 0.03137, +0.39608, 0.03529, 0.03529, +0.40392, 0.03922, 0.03922, +0.41176, 0.04314, 0.04314, +0.41961, 0.04706, 0.04706, +0.42745, 0.05098, 0.05098, +0.43529, 0.05490, 0.05490, +0.44314, 0.05882, 0.05882, +0.45098, 0.06275, 0.06275, +0.45882, 0.06667, 0.06667, +0.46667, 0.07059, 0.07059, +0.47451, 0.07451, 0.07451, +0.48235, 0.07843, 0.07843, +0.49020, 0.08235, 0.08235, +0.49804, 0.08627, 0.08627, +0.50588, 0.09020, 0.09020, +0.51373, 0.09412, 0.09412, +0.52157, 0.09804, 0.09804, +0.52941, 0.10196, 0.10196, +0.53725, 0.10588, 0.10588, +0.54510, 0.10980, 0.10980, +0.55294, 0.11373, 0.11373, +0.56078, 0.11765, 0.11765, +0.56863, 0.12157, 0.12157, +0.57647, 0.12549, 0.12549, +0.58431, 0.12941, 0.12941, +0.59210, 0.13333, 0.13333, +0.60000, 0.13725, 0.13725, +0.60784, 0.14118, 0.14118, +0.61569, 0.14510, 0.14510, +0.62353, 0.14902, 0.14902, +0.63137, 0.15294, 0.15294, +0.63922, 0.15686, 0.15686, +0.64706, 0.16078, 0.16078, +0.65490, 0.16471, 0.16471, +0.66275, 0.16863, 0.16863, +0.67059, 0.17255, 0.17255, +0.67843, 0.17647, 0.17647, +0.68627, 0.18039, 0.18039, +0.69412, 0.18431, 0.18431, +0.70196, 0.18824, 0.18824, +0.70980, 0.19216, 0.19216, +0.71765, 0.19608, 0.19608, +0.72549, 0.20000, 0.20000, +0.73333, 0.20392, 0.20392, +0.74118, 0.20784, 0.20784, +0.74902, 0.21176, 0.21176, +0.75686, 0.21569, 0.21569, +0.76471, 0.21961, 0.21961, +0.77255, 0.22353, 0.22353, +0.78039, 0.22745, 0.22745, +0.78824, 0.23137, 0.23137, +0.79608, 0.23529, 0.23529, +0.80392, 0.23922, 0.23922, +0.81176, 0.24314, 0.24314, +0.81961, 0.24706, 0.24706, +0.82745, 0.25098, 0.25098, +0.83529, 0.25490, 0.25490, +0.84314, 0.25882, 0.25882, +0.85098, 0.26275, 0.26275, +0.85882, 0.26667, 0.26667, +0.86667, 0.27059, 0.27059, +0.87451, 0.27451, 0.27451, +0.88235, 0.27843, 0.27843, +0.89020, 0.28235, 0.28235, +0.89804, 0.28627, 0.28627, +0.90588, 0.29020, 0.29020, +0.91373, 0.29412, 0.29412, +0.92157, 0.29804, 0.29804, +0.92941, 0.30196, 0.30196, +0.93725, 0.30588, 0.30588, +0.94510, 0.30980, 0.30980, +0.95294, 0.31373, 0.31373, +0.96078, 0.31765, 0.31765, +0.96863, 0.32157, 0.32157, +0.97647, 0.32549, 0.32549, +0.98431, 0.32941, 0.32941, +0.99216, 0.33333, 0.33333, +1.00000, 0.33725, 0.33725 diff --git a/vendor/x11iraf/ximtool/data/vflip.xbm b/vendor/x11iraf/ximtool/data/vflip.xbm new file mode 100644 index 00000000..73426f85 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/vflip.xbm @@ -0,0 +1,6 @@ +#define vflip_width 16 +#define vflip_height 16 +static char vflip_bits[] = { + 0x00, 0x00, 0xfc, 0x3f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, + 0xc0, 0x03, 0xe0, 0x07, 0xfc, 0x3f, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/xflip.xbm b/vendor/x11iraf/ximtool/data/xflip.xbm new file mode 100644 index 00000000..bdbbeb43 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/xflip.xbm @@ -0,0 +1,6 @@ +#define xflip_width 16 +#define xflip_height 16 +static char xflip_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/xflip2.xbm b/vendor/x11iraf/ximtool/data/xflip2.xbm new file mode 100644 index 00000000..326cff7b --- /dev/null +++ b/vendor/x11iraf/ximtool/data/xflip2.xbm @@ -0,0 +1,6 @@ +#define xflip2_width 16 +#define xflip2_height 16 +static char xflip2_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x18, 0x18, + 0x0c, 0x30, 0xfe, 0x7f, 0x06, 0x60, 0xfe, 0x7f, 0x0c, 0x30, 0x18, 0x18, + 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/yflip.xbm b/vendor/x11iraf/ximtool/data/yflip.xbm new file mode 100644 index 00000000..69603e9c --- /dev/null +++ b/vendor/x11iraf/ximtool/data/yflip.xbm @@ -0,0 +1,6 @@ +#define yflip_width 16 +#define yflip_height 16 +static char yflip_bits[] = { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/data/yflip2.xbm b/vendor/x11iraf/ximtool/data/yflip2.xbm new file mode 100644 index 00000000..6ea8ae78 --- /dev/null +++ b/vendor/x11iraf/ximtool/data/yflip2.xbm @@ -0,0 +1,6 @@ +#define yflip2_width 16 +#define yflip2_height 16 +static char yflip2_bits[] = { + 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0x70, 0x07, 0x58, 0x0d, 0x48, 0x09, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x48, 0x09, 0x58, 0x0d, + 0x70, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x00, 0x00}; diff --git a/vendor/x11iraf/ximtool/eps.c b/vendor/x11iraf/ximtool/eps.c new file mode 100644 index 00000000..ec7f83a8 --- /dev/null +++ b/vendor/x11iraf/ximtool/eps.c @@ -0,0 +1,1902 @@ +#include <stdio.h> +#include <math.h> +#include <time.h> +#include <pwd.h> +#include "eps.h" + +#ifdef __STDC__ +#include <stdlib.h> +#include <string.h> +#endif + +#ifdef SOLARIS +#include <sys/systeminfo.h> +#endif + + +/* +** EPS.C -- EPS hardcopy routines. This code takes an input structure +** containing the pixels, colormap, and output specifications and creates +** and Encapsulated PostScript file. +** +** #include "eps.h" # flags, macro defs, etc. +** +** psim = eps_init () +** eps_print (psim, fp, &data, xdim, ydim, depth, pad) +** eps_close (psim) +** +** eps_setPage (psim, orient, paper_size, scale, flags) +** eps_setCmap (psim, &r, &g, &b, ncolors) +** eps_setCompress (psim, ctype) +** eps_setColorType (psim, otype) +** eps_setLabel (psim, &label) +** eps_setTransform (psim, z1, z2, ztype, offset, slope, cmap_name) +** eps_setCorners (psim, llx, lly, urx, ury) +** +** eps_getImageSize (psim, xdim, ydim, &width, &height) +** eps_getImagePos (psim, xdim, ydim, &llx, &llx) +** +** # Read-only Macro functions: Result type +** ---------------------------- ----------- +** Orientation (psim) EPS_PORTRAIT | EPS_LANDSCAPE +** Scale (psim) float scale value +** MaxScale (psim) float maxaspect scale value +** DoAutoScale (psim) bool +** DoAutoRotate (psim) bool +** DoMaxAspect (psim) bool +** PageType (psim) EPS_LETTER | EPS_LEGAL | ... +** PageXdim (psim) page pixel width +** PageYdim (psim) page pixel height +** PageWidth (psim) page size in inches +** PageHeight (psim) page size in inches +** +** The first three routines are all that's required to output an array of +** pixels to an open file descriptor. The default output produced is a +** grayscale EPS file, centered in a portrait orientation (unless a rotation +** is required to make it fit on the page) and auto scaled to fit on a normal +** 8.5"x11" page. +** +** The remaining routines can be used to set various options, new colormaps +** labels, etc. They are not required unless you need to override one or +** more of the output defaults. +*/ + +#define MAX_LENLABEL 256 +#define SZ_EPSBUF 8193 + +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + + +static char *hextab = "0123456789abcdef"; +static int pixnum = 0, lpix = 0; +static uchar *pixbuf; + + +/* Public procedures. +*/ +void eps_setPage(), eps_setTransform(), eps_setCorners(); + + +/* Private procedures. +*/ +static void eps_simpleHeader(), eps_colorHeader(); +static void eps_pageParams(), eps_simpleTrailer(); +static void eps_writeCmap(), eps_writeTrailer(); +static void eps_writeMono(), eps_writePix(); +static void eps_writeMonoRGB(), eps_writeRGB(); +static void eps_putPix(), eps_flushPix(); +static void eps_annotate(), eps_portLabels(), eps_landLabels(); +static void eps_doColorbar(); +static float ticstep(); +static char *make_label(); + + +static int debug = 0; + + +/* EPS_INIT -- Allocate and return an initialized pointer to a structure +** containing the default output setup. +*/ +PSImage * +eps_init() +{ + register int i, n; + register PSImage *ps; + register uchar *op; + + + /* Allocate the structure. */ + ps = (PSImage *) calloc ((unsigned)1, sizeof (PSImage)); + + /* Initialize the structure. */ + ps->cols = 0; + ps->rows = 0; + ps->colorClass = EPS_GRAYSCALE; + ps->compression = NoCompression; + ps->annotate = 1; + ps->label = (char *) calloc (MAX_LENLABEL, sizeof (uchar)); + ps->z1 = 0.0; + ps->z2 = 255.0; + ps->ztype = 0; + + /* Set up a default grayscale colormap. */ + ps->cmap.ncolors = 256; + for (i=0; i<ps->cmap.ncolors; i++) + ps->cmap.r[i] = ps->cmap.g[i] = ps->cmap.b[i] = i; + ps->cmap.IsDefault = 1; + + /* Load the page information defaults. */ + eps_setPage (ps, EPS_PORTRAIT, EPS_LETTER, 100, EPS_AUTOSCALE); + + /* Initialize the annotation flags */ + ps->page.flags |= (EPS_DOTITLE|EPS_DOBORDERS|EPS_DOCOLORBAR); + + /* Initialize the pixel buffer array */ + pixbuf = (uchar *) calloc (SZ_EPSBUF, sizeof (uchar)); + + return (ps); +} + + +/* EPS_PRINT -- Dump the given array of pixels to the output file as an EPS +** format file. The data array may contain 8-bit, 24-bit RGB triplets, or +** 32-bit RGBA pixels. +*/ +void +eps_print (psim, fp, data, xdim, ydim, depth, pad) +PSImage *psim; /* EPS image structure */ +FILE *fp; /* output file descriptor */ +uchar *data; /* array of image pixels */ +int xdim, ydim; /* image dimensions */ +int depth; /* bits / pixel, must be 8,24, or 32 */ +int pad; /* bytes per line of padding */ +{ + int npix = xdim * ydim; + uchar *pix = data; + + + psim->cols = xdim; /* save it for the headers */ + psim->rows = ydim; + + if (debug) + fprintf (stderr, "eps_print: w=%d h=%d d=%d pad=%d\n", + xdim, ydim, depth, pad); + + switch (psim->colorClass) { + case EPS_GRAYSCALE: + /* Regardless of the color type desired we'll either write the + * pixels directly or convert from pseudocolor or RGB. For a + * start dump the header. + */ + eps_simpleHeader (psim, fp); + + if (psim->cmap.IsDefault && depth == 8) { + /* We're using the default grayscale colormap with an + * 8-bit image, so just dump the pixels. + */ + if (debug) + fprintf (stderr,"eps_print: straight grayscale.\n"); + eps_writePix (fp, pix, &psim->cmap, npix, xdim, pad); + + } else if (!psim->cmap.IsDefault && depth == 8) { + /* We're using an arbitrary colormap with an 8-bit image, + * so convert to grayscale and write the pixels. + */ + if (debug) + fprintf (stderr,"eps_print: pseudo cnv to grayscale.\n"); + eps_writeMono (fp, pix, &psim->cmap, npix, xdim, pad); + + } else { + /* Convert RGBA to grayscale. */ + if (debug) + fprintf (stderr,"eps_print: RGB cnv to grayscale.\n"); + eps_writeMonoRGB (fp, pix, npix, xdim, depth, pad); + + } + + /* Now that the image is out we restore the graphics context. */ + fprintf (fp, "grestore\n" ); + + /* Write the colorbar. */ + if (psim->annotate) + eps_annotate (psim, fp); + + /* Write the trailer. */ + eps_simpleTrailer (fp); + break; + + case EPS_PSEUDOCOLOR: + /* Write the color prolog header. */ + eps_colorHeader (psim, fp); + + /* Dump the colormap. */ + eps_writeCmap (&psim->cmap, fp); + + /* Write color indices. */ + eps_writePix (fp, pix, &psim->cmap, npix, xdim, pad); + + /* Write the colorbar. */ + if (psim->annotate) + eps_annotate (psim, fp); + + /* Write the trailer to finish it off. */ + eps_writeTrailer (fp); + break; + + case EPS_TRUECOLOR: + /* Write the seudocolor prolog header. */ + eps_colorHeader (psim, fp); + + eps_writeRGB (fp, pix, &psim->cmap, npix, xdim, depth, pad); + + /* Write the colorbar. */ + if (psim->annotate) + eps_annotate (psim, fp); + + /* Write the trailer to finish it off. */ + eps_writeTrailer (fp); + break; + + default: + perror ("Bad colorClass specification.\n"); + break; + } + + fflush (fp); +} + + +/* EPS_CLOSE -- Close down the EPS output structure. +*/ +void +eps_close (psim) +PSImage *psim; /* EPS image structure */ +{ + if (psim->label) + (void) free ((char *) psim->label); + (void) free ((char *) pixbuf); + (void) free (psim); +} + + +/* EPS_SETPAGE -- Inialize the page setup with a different size, orientation, +** or scale options. +*/ +void +eps_setPage (psim, orientation, paper_size, scale, flags) +PSImage *psim; /* EPS image structure */ +int orientation; /* page orientation flag */ +int paper_size; /* paper size flag */ +int scale; /* image scale percentage */ +int flags; /* option flags */ +{ + int NPageTypes = sizeof (PageInfo) / sizeof (PSPageInfo); + + + /* Set the orientation of the output */ + if (orientation == EPS_PORTRAIT) + psim->page.orientation = EPS_PORTRAIT; + else if (orientation == EPS_LANDSCAPE) + psim->page.orientation = EPS_LANDSCAPE; + else + perror ("eps_setPage: Invalid orientation."); + + /* Set the output paper size */ + if (paper_size >= 0 && paper_size <= NPageTypes) + psim->page.page_type = paper_size; + else + perror ("eps_setPage: Invalid paper size."); + + /* Set scale and recompute dpi resolution. */ + psim->page.scale = (float) scale / 100.0; + psim->page.maxscale = (float) scale / 100.0; + psim->page.dpi = 72; /* need to recalculate */ + + /* Set the option flags */ + psim->page.flags = flags; + + if (debug) { + fprintf (stderr, + "eps_setPage: orientation:%d size:%d scale:%g\n", + Orientation(psim), PageType(psim), Scale(psim)); + fprintf (stderr,"\tautoscale:%d autorotate:%d maxaspect:%d\n", + DoAutoScale(psim), DoAutoRotate(psim), DoMaxAspect(psim)); + } +} + + +/* EPS_SETCMAP -- Define a given colormap to be used on output. +*/ +void +eps_setCmap (psim, r, g, b, ncolors) +PSImage *psim; /* EPS image structure */ +uchar *r, *g, *b; /* color components */ +int ncolors; /* number of colors in colormap */ +{ + register int i = 0; + + /* Load the colormap. */ + psim->cmap.ncolors = ncolors; + /* for (i=0; i < ncolors; i++) { */ + for (i=0; i < 256; i++) { + psim->cmap.r[i] = r[i]; + psim->cmap.g[i] = g[i]; + psim->cmap.b[i] = b[i]; + } + + psim->cmap.IsDefault = 0; +} + + +/* EPS_SETCOMPRESS -- Define the type of output compression to use. +*/ +void +eps_setCompress (psim, compress) +PSImage *psim; /* EPS image structure */ +int compress; /* compression type flag */ +{ + /* Set the compression type to use. */ + switch (compress) { + case NoCompression: + case RLECompression: + psim->compression = compress; + break; + case LZWCompression: + case JPEGCompression: + default: + perror ("eps_setCompress: Invalid compression type."); + } +} + + +/* EPS_SETCOLORTYPE -- Set the type of output image to be written, e.g. even +** though we have an RGB or pseudocolor image we may wish to coerce it to +** a grayscale on output. +*/ +void +eps_setColorType (psim, color_class) +PSImage *psim; /* EPS image structure */ +int color_class; /* output color class */ +{ + /* Set the compression type to use. */ + switch (color_class) { + case EPS_GRAYSCALE: + case EPS_PSEUDOCOLOR: + case EPS_TRUECOLOR: + psim->colorClass = color_class; + break; + default: + perror ("eps_setColorType: Invalid output color type."); + } +} + + +/* EPS_SETLABEL -- Set the output label to be used in annotation. +*/ +void +eps_setLabel (psim, label) +register PSImage *psim; /* EPS image structure */ +char *label; /* Label string */ +{ + register int maxlen = MAX_LENLABEL; + + if (!psim->label) + psim->label = (char *) malloc (maxlen); + + if (psim->page.flags & EPS_DOTITLE) { + (void) strncpy (psim->label, label, maxlen-1); + psim->label[maxlen-1] = '\0'; + } else + psim->label[0] = '\0'; +} + + +/* EPS_SETTRANSFORM -- Set the color transformation parameters, i.e. the +** z1/z2 values that map the image pixel values being displayed to the number +** of colors we have available. This is used in the annotation when labeling +** the colorbar. +*/ +void +eps_setTransform (psim, z1, z2, ztype, offset, scale, cmap_name) +PSImage *psim; /* EPS image structure */ +float z1, z2; /* zscale values */ +int ztype; /* Transformation type */ +float offset, scale; /* brightness/contrast values */ +char *cmap_name; /* colormap name */ +{ + psim->z1 = z1; + psim->z2 = z2; + psim->ztype = ztype; + psim->offset = offset; + psim->scale = scale; + if (!psim->cmap.cmap_name) + psim->cmap.cmap_name = (char *) malloc (16); + strcpy (psim->cmap.cmap_name, cmap_name); + + if (debug) { + fprintf (stderr, + "setTransform: z1=%g z2=%g zt=%d offset=%g scale=%g name='%s'\n", + psim->z1, psim->z2, psim->ztype, + psim->offset, psim->scale, + psim->cmap.cmap_name); + } +} + + +/* EPS_SETCORNERS -- Set the image corner values. +*/ +void +eps_setCorners (psim, llx, lly, urx, ury) +PSImage *psim; /* EPS image structure */ +int llx, lly, urx, ury; /* image corners */ +{ + psim->llx = llx; + psim->lly = lly; + psim->urx = urx; + psim->ury = ury; +} + + +/* EPS_GETIMAGESIZE -- Given the current page parameters and image dimensions, +** compute the size of the image (in inches) on the page. +*/ +void +eps_getImageSize (psim, xdim, ydim, width, height) +PSImagePtr psim; /* EPS image struct */ +int xdim, ydim; /* image dimensions */ +float *width, *height; /* width x height of image on page */ +{ + int icols, irows, scols, srows, turnflag; + float llx, lly; + + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + *width = (scols / (float) psim->page.dpi); + *height = (srows / (float) psim->page.dpi); +} + + +/* EPS_GETIMAGEPOS -- Given the current page parameters and image dimensions, +** compute the position of the image (in pixels) on the page. +*/ +void +eps_getImagePos (psim, xdim, ydim, llx, lly) +PSImagePtr psim; /* EPS image struct */ +int xdim, ydim; /* image dimensions */ +int *llx, *lly; /* LL coords for centered image */ +{ + int icols, irows, scols, srows, turnflag; + float lx, ly; + + + /* Get the common page parameters. */ + eps_pageParams (psim, &lx, &ly, &icols, &irows, &scols, &srows, + &turnflag); + + *llx = (int) lx; + *lly = (int) ly; +} + + +/************************ + * Private Procedures * + ************************/ + + +/* EPS_PAGEPARAMS -- Compute the EPS page parameters. +*/ +static void +eps_pageParams (psim, llx, lly, icols, irows, scols, srows, turnflag) +PSImagePtr psim; /* EPS image struct */ +float *llx, *lly; /* LL coords for centered image */ +int *icols, *irows; /* final image rows/cols */ +int *scols, *srows; /* scaled rows/cols */ +int *turnflag; /* turn the image? */ +{ + int devpix, pwidth, pheight, cols=0, rows=0; + float pixfac, scale = Scale(psim), margin; + + + /* See if we need to rotate the image to fit on the page. */ + margin = (psim->annotate ? 0.9 : 0.95); + pwidth = (int) PageXdim(psim) * margin; + pheight = (int) PageYdim(psim) * margin; + *icols = cols = psim->cols; + *irows = rows = psim->rows; + *turnflag = 0; + if (DoAutoRotate(psim)) { + if (psim->cols > psim->rows && (scale * psim->cols) > pwidth) { + if (debug) fprintf (stderr, "Rotating image....\n"); + *turnflag = 1; + cols = *irows; + rows = *icols; + } + } else if (psim->page.orientation == EPS_LANDSCAPE) { + if (debug) fprintf (stderr, "Rotating image....\n"); + *turnflag = 1; + cols = *irows; + rows = *icols; + } + + if (turnflag) { + margin = (turnflag ? 0.825 : margin); + pwidth = (int) PageXdim(psim) * margin; + pheight = (int) PageYdim(psim) * margin; + } + + /* Figure out the image size. */ + devpix = psim->page.dpi / 72.0 + 0.5; /* device pixels per unit */ + pixfac = 72.0 / psim->page.dpi * devpix; + *scols = psim->page.scale * cols * pixfac; + *srows = psim->page.scale * rows * pixfac; + + /* See if we need to fiddle with the size to get it on the page + * the way we want. + */ + if (debug) { + fprintf (stderr, "before: scale=%g scols=%d srows=%d pixfac=%g\n", + scale, *scols, *srows, pixfac); + fprintf (stderr, "\tpwidth=%d pheight=%d\n", pwidth, pheight); + fprintf (stderr,"\tautoscale:%d autorotate:%d maxaspect:%d\n", + DoAutoScale(psim), DoAutoRotate(psim), DoMaxAspect(psim)); + } + if ( *scols > pwidth || *srows > pheight ) { + + /* Image is larger than we think will fit on the page. If we're + * autoscaling reset the scale. + */ + if (DoAutoScale(psim)) { + if (debug) + fprintf (stderr, "Image too big, autoscaling...\n"); + if ( *scols >= pwidth ) { + if (*scols >= *srows) { + scale *= (float)PageXdim(psim) / (float)*scols * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } else { + scale *= (float)PageYdim(psim) / (float)*srows * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } + } + if (debug) + fprintf (stderr, ": scale=%f scols=%d srows=%d pixfac=%g\n", + scale, *scols, *srows, pixfac); + if ( *srows >= pheight ) { + if (*scols >= *srows) { + scale *= (float)PageXdim(psim) / (float)*scols * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } else { + scale *= (float)PageYdim(psim) / (float)*srows * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } + } + if (debug) + fprintf (stderr, ": scale=%f scols=%d srows=%d pixfac=%g\n", + scale, *scols, *srows, pixfac); + psim->page.maxscale = scale; /* update new scale factor */ + + } else { + /* Notify user that the image won't fit and suggest a scale. */ + if ( *scols > pwidth ) + scale *= (float) PageXdim(psim) / (float) *scols * margin; + if ( *srows > pheight ) + scale *= (float) PageYdim(psim) / (float) *srows * margin; + psim->page.maxscale = scale; /* update new scale factor */ + + fprintf (stderr, + "Image too big for the page, no autoscaling set...\n"); + fprintf (stderr, "Reset autoscale flag or use scale < %g\n", + scale); + } + + } + + if (DoMaxAspect(psim)) { + /* Image will fit on page, but blow it up to a maximum size for + * the page orientation but retain the image aspect. + */ + if (debug) + fprintf (stderr, "Doing max aspect..."); + if ( *scols >= *srows ) { + scale *= (float) PageXdim(psim) / (float) *scols * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } else if ( *srows > *scols ) { + scale *= (float) PageYdim(psim) / (float) *srows * margin; + *scols = scale * cols * pixfac; + *srows = scale * rows * pixfac; + } + psim->page.maxscale = scale; /* update new scale factor */ + } + + /* Center it on the page. */ + *llx = (PageXdim(psim) - *scols) / 2 - (*turnflag ? 10 : 0); + *lly = (PageYdim(psim) - *srows) / 2 + (*turnflag ? 0 : 10); + + if (debug) { + fprintf(stderr,"after: scale=%g scols=%d srows=%d ", + scale, *scols, *srows); + fprintf(stderr,"icols=%d irows=%d llx=%g lly=%g\n", + *icols, *irows, *llx, *lly); + } +} + + +/* EPS_WRITEPIX -- Write the pixels or color indices directly. +*/ +static void +eps_writePix (fp, pix, cmap, npix, xdim, pad) +FILE *fp; +uchar *pix; +PSCmap *cmap; +int npix; +int xdim; +int pad; +{ + register int i, min, max; + + + min = *pix; + max = *pix; + while (npix > 0) { + min = (min > *pix ? *pix : min); + max = (max < *pix ? *pix : max); + + /* Write the pixels. */ + for (i=0; i < PIX_PER_LINE && npix--; i+=2) { + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1)) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + /* Skip the pad chars. */ + for (i=0; i<pad && npix; i++, npix--) + pix++; + } + cmap->min = min; + cmap->max = max; + eps_flushPix (fp); +} + + +/* EPS_WRITEMONO -- Write a pseudocolor image and convert to grayscale. +*/ +static void +eps_writeMono (fp, pix, cmap, npix, xdim, pad) +FILE *fp; +uchar *pix; +PSCmap *cmap; +int npix; +int xdim; +int pad; +{ + register int i, min, max; + register uchar pval; + + min = *pix; + max = *pix; + while (npix > 0) { + min = (min > *pix ? *pix : min); + max = (max < *pix ? *pix : max); + + /* Write the pixels. */ + for (i=0; i < PIX_PER_LINE && npix; i+=2, npix-- ) { + pval = (uchar) MONO (cmap->r[*pix], + cmap->g[*pix], + cmap->b[*pix++]); + pixbuf[pixnum++] = (uchar) hextab[(pval >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[(pval & 0x0F)]; + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1) || !npix) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + /* skip the pad chars */ + for (i=0; i<pad && npix; i++, npix--) + pix++; + } + cmap->min = min; + cmap->max = max; + eps_flushPix (fp); +} + + +/* EPS_WRITEMONORGB -- Write RGB data converted to grayscale. +*/ +static void +eps_writeMonoRGB (fp, pix, npix, xdim, depth, pad) +FILE *fp; +uchar *pix; +int npix; +int xdim; +int depth; +int pad; +{ + register int i; + register uchar pval; + + + while (npix > 0) { + /* Write the pixels. */ + if (depth < 24) { + for (i=0; i < PIX_PER_LINE && npix; i+=2, npix-=3 ) { + pval = (uchar) MONO (*pix++, *pix++, *pix++); + pixbuf[pixnum++] = (uchar) hextab[(pval >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[(pval & 0x0F)]; + } + } else { + /* Skip alpha channel in the loop */ + for (i=0; i < PIX_PER_LINE && npix; i+=2, npix-=3, pix++ ) { + pval = (uchar) MONO (*pix++, *pix++, *pix++); + pixbuf[pixnum++] = (uchar) hextab[(pval >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[(pval & 0x0F)]; + } + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1)) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + /* skip the pad chars */ + for (i=0; i<pad && npix; i++, npix--) + pix++; + } + eps_flushPix (fp); +} + + +/* EPS_WRITERGB -- Write the pixels in RGB format, skipping a possible alpha +** channel. +*/ +static void +eps_writeRGB (fp, pix, cmap, npix, xdim, depth, pad) +FILE *fp; +uchar *pix; +PSCmap *cmap; +int npix; +int xdim; +int depth; +int pad; +{ + register int i, j, min, max; + register uchar val; + + + min = *pix; + max = *pix; + while (npix > 0) { + min = (min > *pix ? *pix : min); + max = (max < *pix ? *pix : max); + + /* Write the pixels. */ + if (depth < 24) { + for (i=0; i < PIX_PER_LINE && npix; i+=6, npix--, pix++ ) { + val = (uchar) cmap->r[*pix]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val & 0x0F)]; + val = (uchar) cmap->g[*pix]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val & 0x0F)]; + val = (uchar) cmap->b[*pix]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)val & 0x0F)]; + } + } else { + /* Skip alpha channel in the loop */ + for (i=0; i < PIX_PER_LINE && npix; i+=6, npix-=3, pix++ ) { + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix >> 4)]; + pixbuf[pixnum++] = (uchar) hextab[((uchar)*pix++ & 0x0F)]; + } + } + pixbuf[pixnum++] = '\n'; + + if (pixnum >= (SZ_EPSBUF - PIX_PER_LINE - 1)) { + pixbuf[pixnum] = '\0'; + fwrite ((char *)pixbuf, sizeof(char), pixnum, fp); + pixnum = 0; + } + + + /* skip the pad chars */ + for (i=0; i<pad && npix; i++, npix--) + pix++; + } + cmap->min = min; + cmap->max = max; + eps_flushPix (fp); +} + + +/* EPS_WRITECMAP -- Output Postscript colormap. +*/ +static void +eps_writeCmap (cmap, fp) +PSCmap *cmap; +FILE *fp; +{ + register int i, j; + + /* Dump number of colors and colormap used. */ + fprintf (fp, "256\n"); + for (i=0; i < 256; ) { + for (j=0; j < 10 && i < 256; i++, j++) { + fprintf (fp, "%02x%02x%02x", + cmap->r[i], cmap->g[i], cmap->b[i]); + } + fprintf (fp, "\n"); + } +} + + +/* EPS_SIMPLEHEADER -- Output simple Postscript header. +*/ +static char *EPSSimpleRLEProlog[]= { + "/rlestr1 1 string def\n", + "/readrlestring { /* s -- nr */\n", + " /rlestr exch def /* - */\n", + " currentfile rlestr1 readhexstring pop /* s1 */\n", + " 0 get /* c */\n", + " dup 127 le { /* c */\n", + " currentfile rlestr 0 /* c f s 0 */\n", + " 4 3 roll /* f s 0 c */\n", + " 1 add getinterval /* f s */\n", + " readhexstring pop /* s */\n", + " length /* nr */\n", + " } { /* c */\n", + " 256 exch sub dup /* n n */\n", + " currentfile rlestr1 readhexstring pop /* n n s1 */\n", + " 0 get /* n n c */\n", + " exch 0 exch 1 exch 1 sub { /* n c 0 1 n-1*/\n", + " rlestr exch 2 index put\n", + " } for /* n c */\n", + " pop /* nr */\n", + " } ifelse /* nr */\n", + "} bind def\n", + "/readstring { /* s -- s */\n", + " dup length 0 { /* s l 0 */\n", + " 3 copy exch /* s l n s n l*/\n", + " 1 index sub /* s l n s n r*/\n", + " getinterval /* s l n ss */\n", + " readrlestring /* s l n nr */\n", + " add /* s l n */\n", + " 2 copy le { exit } if /* s l n */\n", + " } loop /* s l l */\n", + " pop pop /* s */\n", + "} bind def\n", + NULL +}; + +static void +eps_simpleHeader (psim, fp) +PSImagePtr psim; +FILE *fp; +{ + register char **line; + int icols=0, irows=0, scols=0, srows=0, turnflag=0; + float llx = 0.0, lly = 0.0; + time_t timer; + + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + /* Now write header and prolog stuff */ + fprintf (fp, "%%!PS-Adobe-3.0 EPSF-3.0\n" ); + fprintf (fp, "%%%%Title: XImtool Screen Hardcopy\n"); + fprintf (fp, "%%%%Creator: XImtool\n"); + timer = time ((time_t *) NULL); + (void) localtime (&timer); + fprintf (fp, "%%%%CreationDate: %s", ctime(&timer)); + if (psim->annotate) + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - X_ANNOT_MARGIN)), + (int) (MAX (0, lly - Y_ANNOT_MARGIN)), + (int) ( llx + scols + 0.5 + X_ANNOT_MARGIN), + (int) ( lly + srows + 0.5 + Y_ANNOT_MARGIN) ); + else + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - 10)), + (int) (MAX (0, lly - 10)), + (int) ( llx + scols + 0.5 + 10), + (int) ( lly + srows + 0.5 + 10) ); + fprintf (fp, "%%%%Pages: 1\n"); + fprintf (fp, "%%%%EndComments\n" ); + + if ( psim->compression == RLECompression ) { + for (line = EPSSimpleRLEProlog; *line; line++) + fprintf (fp, "%s\n",*line); + } else { + fprintf (fp, "/readstring {\n" ); /* s -- s */ + fprintf (fp, " currentfile exch readhexstring pop\n" ); + fprintf (fp, "} bind def\n" ); + } + + if (psim->colorClass == EPS_TRUECOLOR) { + fprintf (fp, "/rpicstr %d string def\n", icols ); + fprintf (fp, "/gpicstr %d string def\n", icols ); + fprintf (fp, "/bpicstr %d string def\n", icols ); + } else + fprintf (fp, "/picstr %d string def\n", icols ); + fprintf (fp, "%%%%EndProlog\n" ); + fprintf (fp, "%%%%Page: 1 1\n" ); + fprintf (fp, "gsave\n" ); + + fprintf (fp, "%g %g translate\n", llx, lly ); + fprintf (fp, "%d %d scale\n", scols, srows ); + if ( turnflag ) { + if (debug) fprintf (stderr, "turnflag enabled....\n"); + fprintf (fp, "0.5 0.5 translate 90 rotate -0.5 -0.5 translate\n"); + } + fprintf (fp, "%d %d 8\n", icols, irows); + fprintf (fp, "[ %d 0 0 -%d 0 %d ]\n", icols, irows, irows ); + + if (psim->colorClass == EPS_TRUECOLOR) { + fprintf (fp, "{ rpicstr readstring }\n" ); + fprintf (fp, "{ gpicstr readstring }\n" ); + fprintf (fp, "{ bpicstr readstring }\n" ); + fprintf (fp, "true 3\n" ); + fprintf (fp, "colorimage\n" ); + } else { + fprintf (fp, "{ picstr readstring }\n" ); + fprintf (fp, "image\n" ); + } +} + + +/* EPS_ANNOTATE -- Annotate the main image window with axis labels, +** colorbars, and the title string. +*/ + +static void +eps_annotate (psim, fp) +PSImagePtr psim; +FILE *fp; +{ + register char **line; + register int i; + int icols=0, irows=0, scols=0, srows=0, turnflag=0; + int cbar_size, nlabels; + int xpos, xstep, ypos, ystep; + float Mval, xval, yval, tic, mtic, Mtic; + float llx = 0.0, lly = 0.0; + + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + /* Main image title. */ + if (psim->label != NULL && (psim->page.flags & EPS_DOTITLE)) { + /* Write the annotation prolog stufd. */ + fprintf (fp, "gsave\n" ); + + fprintf (fp, + "/labelfont /NewCenturySchlbk-Roman findfont 16 scalefont def\n"); + if (turnflag) { + fprintf (fp, "/label { moveto labelfont setfont\n"); + fprintf (fp, " 90 rotate show -90 rotate\n} def\n" ); + fprintf (fp, "(%s) %g %g label\n", psim->label, + llx - TITLE_OFFSET, + lly + (srows/2) - 8.25*(strlen(psim->label)/2) ); + } else { + fprintf (fp, "/label { moveto labelfont setfont show } def\n" ); + fprintf (fp, "(%s) %g %g label\n", psim->label, + llx + (scols/2) - 8.25*(strlen(psim->label)/2), + lly + srows + TITLE_OFFSET); + } + fprintf (fp, "grestore\n"); + } + + /* A border for the image axes. */ + if (psim->page.flags & EPS_DOBORDERS) { + fprintf (fp, "gsave\n" ); + fprintf (fp, "/imBorder {\n"); + fprintf (fp, " %-4d %-4d moveto %% Outer axis\n", + (int)(llx - AXIS_OOFFSET), + (int)(lly - AXIS_OOFFSET)); + fprintf (fp, " 0 %-4d rlineto\n", srows + (2 * AXIS_OOFFSET)); + fprintf (fp, " %-4d 0 rlineto\n", scols + (2 * AXIS_OOFFSET)); + fprintf (fp, " 0 -%-4d rlineto\n", srows + (2 * AXIS_OOFFSET)); + fprintf (fp, " closepath\n"); + fprintf (fp, " %g setlinewidth\n", AXIS_OWIDTH); + fprintf (fp, " stroke\n"); + + fprintf (fp, " %-4d %-4d moveto %% Inner axis\n", + (int)(llx - AXIS_IOFFSET), + (int)(lly - AXIS_IOFFSET)); + fprintf (fp, " 0 %-4d rlineto\n", srows + (2 * AXIS_IOFFSET)); + fprintf (fp, " %-4d 0 rlineto\n", scols + (2 * AXIS_IOFFSET)); + fprintf (fp, " 0 -%-4d rlineto\n", srows + (2 * AXIS_IOFFSET)); + fprintf (fp, " closepath\n"); + fprintf (fp, " %g setlinewidth\n", AXIS_IWIDTH); + fprintf (fp, " stroke\n"); + + fprintf (fp, "} def\n"); + fprintf (fp, "imBorder\n"); + + /* Axis label font definitions. */ + fprintf (fp,"/axlabelfont /Times-Roman findfont 8 scalefont def\n"); + fprintf (fp, + "/axlabel { moveto axlabelfont setfont %s show %s } def\n", + (turnflag ? "90 rotate" : " "), + (turnflag ? "-90 rotate" : " ")); + + /* Axis ticmark procedures. */ + fprintf (fp, "/xMajorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " 0 %d rlineto ", MAJOR_TICK_SIZE); + fprintf (fp, " 0 %d rmoveto ", + srows + MAJOR_TICK_SIZE + (2 * AXIS_IOFFSET) ); + fprintf (fp, " 0 -%d rlineto\n", MAJOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MAJOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + fprintf (fp, "/yMajorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " %d 0 rlineto ", MAJOR_TICK_SIZE); + fprintf (fp, " %d 0 rmoveto ", + scols + MAJOR_TICK_SIZE + (2 * AXIS_IOFFSET) ); + fprintf (fp, " -%d 0 rlineto\n", MAJOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MAJOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + fprintf (fp, "/xMinorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " 0 %d rlineto ", MINOR_TICK_SIZE); + fprintf (fp, " 0 %d rmoveto ", + srows + MAJOR_TICK_SIZE + (2*AXIS_IOFFSET) + + (MAJOR_TICK_SIZE - MINOR_TICK_SIZE) ); + fprintf (fp, " 0 -%d rlineto\n", MINOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MINOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + fprintf (fp, "/yMinorTicmark {\n"); + fprintf (fp, " moveto\n"); + fprintf (fp, " %d 0 rlineto ", MINOR_TICK_SIZE); + fprintf (fp, " %d 0 rmoveto ", + scols + MAJOR_TICK_SIZE + (2*AXIS_IOFFSET) + + (MAJOR_TICK_SIZE - MINOR_TICK_SIZE) ); + fprintf (fp, " -%d 0 rlineto\n", MINOR_TICK_SIZE); + fprintf (fp, " %g setlinewidth\n stroke\n", MINOR_TICK_WIDTH); + fprintf (fp, "} def\n"); + + /* The axis labeling. */ + if (turnflag) + eps_landLabels (fp, psim, scols, srows, icols, irows, llx, lly); + else + eps_portLabels (fp, psim, scols, srows, icols, irows, llx, lly); + fprintf (fp, "grestore\n"); + } + + /* The colorbar. */ + if (psim->page.flags & EPS_DOCOLORBAR) { + eps_doColorbar (fp, psim, scols, srows, llx, lly, turnflag); + + /* Print the transform information. */ + fprintf (fp, "gsave\n"); + fprintf (fp, "/Times-Roman findfont 8 scalefont setfont\n"); + if (turnflag) { + cbar_size = MIN (512, MAX (256, srows + 2)); + fprintf (fp, "%d %d moveto\n", + (int)llx + scols + 26, + (int)lly + (srows/2) - (cbar_size/2)-(cbar_size==256?5:1)); + } else { + cbar_size = MIN (512, MAX (256, scols + 2)); + fprintf (fp, "%d %d moveto\n", + (int)llx + (scols/2) - (cbar_size/2)-(cbar_size==256?5:1), + (int)(lly-29)); + } + fprintf (fp, "(z1=%.2f z2=%.2f ztrans=%s Con=%.2f Brt=%.2f cmap=%s ncolors=%d) %s show %s\n", + psim->z1, psim->z2, + (psim->ztype==EPS_UNITARY ? "unitary": + (psim->ztype==EPS_LINEAR ? "linear" : "log")), + psim->scale, psim->offset, + psim->cmap.cmap_name, + psim->cmap.max - psim->cmap.min + 1, + (turnflag ? "90 rotate" : " "), + (turnflag ? "-90 rotate" : " ")); + fprintf (fp, "grestore\n"); + } + + /* Print the timestamp. */ + fprintf (fp, "gsave\n"); + fprintf (fp, "/Times-Roman findfont 6 scalefont setfont\n"); + fprintf (fp, "20 15 moveto\n(%s) show\n", make_label()); + fprintf (fp, "grestore\n"); + + if (debug) { + fprintf (stderr, "colormap: min/max = %d/%d\n", + psim->cmap.min, psim->cmap.max); + fprintf (stderr, "label: '%s'", make_label()); + } +} + + +/* EPS_PORTRAITLABELS -- Write out the labeling procedures for a portrait +** mode image. +*/ + +static void +eps_portLabels (fp, psim, scols, srows, icols, irows, llx, lly) +FILE *fp; +PSImagePtr psim; +int scols, srows; +int icols, irows; +float llx, lly; +{ + int start, end, range, nlabels; + float xpos, xstep, ypos, ystep; + float Mval, xval=0.0, yval=0.0, tic, mtic, Mtic; + + + /* X Axis labeling and ticmarks. + */ + nlabels = (scols > 256 ? 5 : 3); + fprintf (fp, "/axLabelX {\n"); + if (psim->urx > psim->llx) { + start = psim->llx; + end = psim->urx; + } else { + start = psim->urx; + end = psim->llx; + } + range = end - start + 1; + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + xval = ( (int)(start + mtic) / (int) mtic) * mtic; + xstep = mtic * ((float)scols/(float)(range)); + if (psim->urx > psim->llx) + xpos = llx + ( (float)(xval - start) / (float)range * scols); + else { + xpos = (llx + scols) - ((float)(xval-start) / (float)range * scols); + xstep = -xstep; + } + while (xval <= end) { + if ( xval == Mval ) { + fprintf (fp, " %4d %4d xMajorTicmark\t", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + fprintf (fp, " (%g) %d %d axlabel\n", + xval, + (int)xpos-(xval>=1000?8:(xval>=100?5:2)), + (int)(lly-14)); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d xMinorTicmark\n", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + xval += mtic; + xpos += xstep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelX\n"); + + /* Y Axis labeling and ticmarks. */ + nlabels = (srows > 256 ? 5 : 3); + fprintf (fp, "/axLabelY {\n"); + if (psim->ury > psim->lly) { + start = psim->lly; + end = psim->ury; + } else { + start = psim->ury; + end = psim->lly; + } + range = end - start + 1; + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + yval = ( (int)(start + mtic) / (int) mtic) * mtic; + ystep = mtic * ((float)srows/(float)(range)); + if (psim->ury > psim->lly) + ypos = lly + ( (float)(yval - start) / (float)range * srows); + else { + ypos = (lly + srows) - ((float)(yval-start) / (float)range * srows); + ystep = -ystep; + } + while (yval <= end) { + if ( yval == Mval ) { + fprintf (fp, " %4d %4d yMajorTicmark\t", + (int)(llx-AXIS_OOFFSET), (int)ypos); + fprintf (fp, " (%g) %d %d axlabel\n", + yval, + (int)(llx-(yval>=1000?27:(yval>=100?20:16))), + (int)ypos-2); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d yMinorTicmark\n", + (int)(llx-AXIS_OOFFSET), (int)ypos); + yval += mtic; + ypos += ystep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelY\n"); +} + + +/* EPS_LANDSCAPELABELS -- Write out the labeling procedures for a landscape +** mode image. +*/ +static void +eps_landLabels (fp, psim, scols, srows, icols, irows, llx, lly) +FILE *fp; +PSImagePtr psim; +int scols, srows; +int icols, irows; +float llx, lly; +{ + float xpos, xstep, ypos, ystep; + int start, end, range, nlabels; + float Mval, xval=0.0, yval=0.0, tic, mtic, Mtic; + + + /* X Axis labeling and ticmarks. */ + nlabels = (srows > 256 ? 5 : 3); + fprintf (fp, "/axLabelX {\n"); + if (psim->ury > psim->lly) { + start = psim->lly; + end = psim->ury; + } else { + start = psim->ury; + end = psim->lly; + } + range = end - start + 1; + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + xval = ( (int)(start + mtic) / (int) mtic) * mtic; + xstep = mtic * ((float)scols/(float)(range)); + if (psim->ury > psim->lly) + xpos = (llx + scols) - ((float)(xval-start) / (float)range * scols); + else { + xpos = llx + ((float)(xval-start) / (float)range * scols); + xstep = -xstep; + } + while (xval <= end ) { + if ( xval == Mval ) { + fprintf (fp, " %4d %4d xMajorTicmark\t", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + fprintf (fp, " (%g) %d %d axlabel\n", + xval, + (int)xpos+2, + (int)(lly-(yval>=1000?30:(yval>=100?25:20))) ); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d xMinorTicmark\n", + (int)xpos, (int)(lly-AXIS_OOFFSET)); + xval += mtic; + xpos -= xstep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelX\n"); + + /* Y Axis labeling and ticmarks. */ + nlabels = (srows > 256 ? 5 : 3); + fprintf (fp, "/axLabelY {\n"); + if (psim->urx > psim->llx) { + start = psim->llx; + end = psim->urx; + } else { + start = psim->urx; + end = psim->llx; + } + Mtic = tic = ticstep ((float)range, (range>=256 ? NTICMARKS : 3)); + mtic = (float) tic / (tic < 100 ? 5. : 10.); + Mval = ( (int)(start + Mtic) / (int) Mtic) * Mtic; + yval = ( (int)(start + mtic) / (int) mtic) * mtic; + ystep = mtic * ((float)scols/(float)(range)); + if (psim->urx > psim->llx) + ypos = lly + ( (float)(yval - start) / (float)range * scols); + else { + ypos = (lly + srows) - ((float)(yval-start) / (float)range * scols); + ystep = -ystep; + } + while (yval <= end) { + if ( yval == Mval ) { + fprintf (fp, " %4d %4d yMajorTicmark\t", + (int)(llx-AXIS_OOFFSET), (int)ypos); + fprintf (fp, " (%g) %d %d axlabel\n", + yval, + (int)(llx+scols+(2*AXIS_OOFFSET)+2), + (int)ypos-(yval>=1000?9:(yval>=100?6:2)) ); + Mval += Mtic; + } else + fprintf (fp, "\t%4d %4d yMinorTicmark\n", + (int)(llx-AXIS_OOFFSET), (int)ypos); + yval += mtic; + ypos += ystep; + } + fprintf (fp, "} def\n"); + fprintf (fp, "axLabelY\n"); +} + + +/* EPS_DOCOLORBAR -- Annotate the image with a colorbar. +*/ + +static void +eps_doColorbar (fp, psim, scols, srows, llx, lly, turnflag) +FILE *fp; +PSImagePtr psim; +int scols, srows; +float llx, lly; +int turnflag; +{ + register int i, j, cbar_size; + int ncolors, nlabels, pos, step, cmel, cmstep, val; + + + /* Colorbar label font definitions. */ + fprintf (fp, "/cblabelfont /Times-Roman findfont 10 scalefont def\n"); + fprintf (fp, "/cblabel { moveto cblabelfont setfont %s show %s } def\n", + (turnflag ? "90 rotate" : " "), + (turnflag ? "-90 rotate" : " ")); + + /* A border for the colorbar. */ + fprintf (fp, "/cbarBorder {\n"); + if (turnflag) { + cbar_size = MIN (512, MAX (256, srows + 2)) - 1; + fprintf (fp, " %4d %4d moveto\n", + (int)llx + scols + 31, + (int)lly + (srows/2) - (cbar_size/2) - 1); + fprintf (fp, " 17 0 rlineto\n"); + fprintf (fp, " 0 %4d rlineto\n", cbar_size + 3); + fprintf (fp, " -17 0 rlineto\n"); + } else { + cbar_size = MIN (512, MAX (256, scols + 2)); + fprintf (fp, " %-4d %4d moveto\n", + (int)llx + (scols/2) - (cbar_size/2) - 1, + (int)(lly - 46)); + fprintf (fp, " 0 14 rlineto\n"); + fprintf (fp, " %-4d 0 rlineto\n", cbar_size + 3); + fprintf (fp, " 0 -14 rlineto\n"); + } + fprintf (fp, " closepath\n"); + fprintf (fp, " 1 setlinewidth\n"); + fprintf (fp, " stroke\n"); + fprintf (fp, "} def\n"); + fprintf (fp, "cbarBorder\n"); + + /* Draw the colorbar labels, but only for grayscale images. */ + ncolors = psim->cmap.max - psim->cmap.min + 1; + nlabels = 5; + if (turnflag) + pos = (int)lly + (srows/2) - (cbar_size/2); + else + pos = (int)llx + (scols/2) - (cbar_size/2); + step = cbar_size / nlabels; + cmel = psim->cmap.min; + cmstep = ncolors / nlabels; + for (i=0; i <= nlabels; i++) { + val = MONO(psim->cmap.r[cmel], /* get grayscale value */ + psim->cmap.g[cmel], + psim->cmap.b[cmel]); + if (psim->z1 != 0.0 && psim->z2 != 0.0) { + /* We have a transformation defined, convert the grayscale + * value to original image values. Assumes a linear + * transformation, for a log transformation the wcsbox + * reports only screen units so we'll do that here as well. + */ + if (psim->ztype == EPS_LINEAR) + val = ((psim->z2-psim->z1)/(float)ncolors)*cmel + psim->z1; + } + + if (turnflag) + fprintf (fp, "(%d) %d %d cblabel\n", + val, + (int)llx + scols + 57, + pos-(val<100?3:6)); + else + fprintf (fp, "(%d) %d %d cblabel\n", + val, + pos-(val<100?3:6), + (int)(lly-55)); + cmel += cmstep; + cmel = (cmel < psim->cmap.max ? cmel : psim->cmap.max); + pos += step; + } + + /* Draw the colorbar. */ + if (psim->colorClass == EPS_GRAYSCALE) { + fprintf (fp, "/cbarstr %d string def\n", ncolors); + fprintf (fp, "gsave\n" ); + if (turnflag) { + fprintf (fp, "%d %d translate\n", + (int)(llx + scols + 45), + (int)(lly + (srows/2) - (cbar_size/2)) + 1); + fprintf (fp, + "0.5 0.5 translate 90 rotate -0.5 -0.5 translate\n"); + } else { + fprintf (fp, "%g %g translate\n", + llx + (scols/2) - (cbar_size/2) + 1, + lly - 45 ); + } + fprintf (fp, "%d 12 scale\n", cbar_size); + fprintf (fp, "%d 1 8 [ %d 0 0 1 0 0 ]\n", ncolors, ncolors); + + fprintf (fp, "{ cbarstr readstring }\n" ); + fprintf (fp, "image\n" ); + + } else { + fprintf (fp, "DisplayImage\n" ); + if (turnflag) { + fprintf (fp, "%d %d\n", + (int)(llx + scols + 34), + (int)(lly + (srows/2) - (cbar_size/2))); + fprintf (fp, "12 %d\n", cbar_size); + } else { + fprintf (fp, "%d %d\n", + (int)llx + (scols/2) - (cbar_size/2), + (int)lly - 45 ); + fprintf (fp, "%d 12\n", cbar_size); + } + fprintf (fp, "%d 1\n", ncolors); + fprintf (fp, "%d\n", turnflag); + fprintf (fp, "0\n"); + fprintf (fp, "1\n"); + } + + /* Write out the colormap used. */ + if (psim->colorClass == EPS_GRAYSCALE) { + for (i=psim->cmap.min; i <= psim->cmap.max; i++ ) { + fprintf (fp, "%02x", + MONO(psim->cmap.r[i],psim->cmap.g[i], psim->cmap.b[i])); + if ((i+1) % 32 == 0) + fprintf (fp, "\n"); + } + fprintf (fp, "\n"); + fprintf (fp, "grestore\n"); + } else { + for (j=1, i=psim->cmap.min; i <= psim->cmap.max; i++, j++ ) + fprintf (fp, "%02x%02x%02x\n", + psim->cmap.r[i],psim->cmap.g[i], psim->cmap.b[i]); + if (j % 12 ==0) + fprintf (fp, "\n"); + } +} + + +/* EPS_COLORHEADER - Write the pseudocolor header prolog and compute EPS page +** parameters. +*/ +static char *EPSColorProlog[]= + { + "%%BeginProlog", + "%", + "% Display a color image. The image is displayed in color on", + "% Postscript viewers or printers that support color, otherwise", + "% it is displayed as grayscale.", + "%", + "/buffer 512 string def", + "/byte 1 string def", + "/color_packet 3 string def", + "/pixels 768 string def", + "", + "/DirectClassPacket", + "{", + " %", + " % Get a DirectClass packet.", + " %", + " % Parameters: ", + " % red.", + " % green.", + " % blue.", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile color_packet readhexstring pop pop", + " compression 0 gt", + " {", + " /number_pixels 3 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add 3 mul def", + " } ifelse", + " 0 3 number_pixels 1 sub", + " {", + " pixels exch color_packet putinterval", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/DirectClassImage", + "{", + " %", + " % Display a DirectClass image.", + " %", + " systemdict /colorimage known", + " {", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { DirectClassPacket } false 3 colorimage", + " }", + " {", + " %", + " % No colorimage operator; convert to grayscale.", + " %", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { GrayDirectClassPacket } image", + " } ifelse", + "} bind def", + "", + "/GrayDirectClassPacket", + "{", + " %", + " % Get a DirectClass packet; convert to grayscale.", + " %", + " % Parameters: ", + " % red", + " % green", + " % blue", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile color_packet readhexstring pop pop", + " color_packet 0 get 0.299 mul", + " color_packet 1 get 0.587 mul add", + " color_packet 2 get 0.114 mul add", + " cvi", + " /gray_packet exch def", + " compression 0 gt", + " {", + " /number_pixels 1 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add def", + " } ifelse", + " 0 1 number_pixels 1 sub", + " {", + " pixels exch gray_packet put", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/GrayPseudoClassPacket", + "{", + " %", + " % Get a PseudoClass packet; convert to grayscale.", + " %", + " % Parameters: ", + " % index: index into the colormap.", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile byte readhexstring pop 0 get", + " /offset exch 3 mul def", + " /color_packet colormap offset 3 getinterval def", + " color_packet 0 get 0.299 mul", + " color_packet 1 get 0.587 mul add", + " color_packet 2 get 0.114 mul add", + " cvi", + " /gray_packet exch def", + " compression 0 gt", + " {", + " /number_pixels 1 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add def", + " } ifelse", + " 0 1 number_pixels 1 sub", + " {", + " pixels exch gray_packet put", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/PseudoClassPacket", + "{", + " %", + " % Get a PseudoClass packet.", + " %", + " % Parameters: ", + " % index: index into the colormap.", + " % length: number of pixels minus one of this color (optional).", + " %", + " currentfile byte readhexstring pop 0 get", + " /offset exch 3 mul def", + " /color_packet colormap offset 3 getinterval def", + " compression 0 gt", + " {", + " /number_pixels 3 def", + " }", + " {", + " currentfile byte readhexstring pop 0 get", + " /number_pixels exch 1 add 3 mul def", + " } ifelse", + " 0 3 number_pixels 1 sub", + " {", + " pixels exch color_packet putinterval", + " } for", + " pixels 0 number_pixels getinterval", + "} bind def", + "", + "/PseudoClassImage", + "{", + " %", + " % Display a PseudoClass image.", + " %", + " % Parameters: ", + " % colors: number of colors in the colormap.", + " % colormap: red, green, blue color packets.", + " %", + " currentfile buffer readline pop", + " token pop /colors exch def pop", + " /colors colors 3 mul def", + " /colormap colors string def", + " currentfile colormap readhexstring pop pop", + " systemdict /colorimage known", + " {", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { PseudoClassPacket } false 3 colorimage", + " }", + " {", + " %", + " % No colorimage operator; convert to grayscale.", + " %", + " columns rows 8", + " [", + " columns 0 0", + " rows neg 0 rows", + " ]", + " { GrayPseudoClassPacket } image", + " } ifelse", + "} bind def", + "", + "/DisplayImage", + "{", + " %", + " % Display a DirectClass or PseudoClass image.", + " %", + " % Parameters: ", + " % x & y translation.", + " % x & y scale.", + " % image columns & rows.", + " % orientation: 0-Portrait or 1-Landscape", + " % class: 0-DirectClass or 1-PseudoClass.", + " % compression: 0-RunlengthEncodedCompression or 1-NoCompression.", + " % hex color packets.", + " %", + " gsave", + " currentfile buffer readline pop", + " token pop /x exch def", + " token pop /y exch def pop", + " x y translate", + " currentfile buffer readline pop", + " token pop /x exch def", + " token pop /y exch def pop", + " x y scale", + " currentfile buffer readline pop", + " token pop /columns exch def", + " token pop /rows exch def pop", + " currentfile buffer readline pop", + " token pop /orient exch def pop", + " orient 0 gt { 0.5 0.5 translate 90 rotate -0.5 -0.5 translate } if", + " currentfile buffer readline pop", + " token pop /class exch def pop", + " currentfile buffer readline pop", + " token pop /compression exch def pop", + " class 0 gt { PseudoClassImage } { DirectClassImage } ifelse", + " grestore", + "} bind def", + "%%EndProlog", + "%%Page: 1 1", + NULL +}; + + +static void +eps_colorHeader (psim, fp) +PSImagePtr psim; +FILE *fp; +{ + register char **line; + int icols=0, irows=0, scols=0, srows=0, turnflag=0; + float llx = 0.0, lly = 0.0; + time_t timer; + + + /* Get the common page parameters. */ + eps_pageParams (psim, &llx, &lly, &icols, &irows, &scols, &srows, + &turnflag); + + /* Now write header and prolog stuff */ + fprintf (fp, "%%!PS-Adobe-3.0 EPSF-3.0\n"); + fprintf (fp, "%%%%Title: XImtool Screen Hardcopy\n"); + fprintf (fp, "%%%%Creator: XImtool\n"); + timer = time ((time_t *) NULL); + (void) localtime (&timer); + fprintf (fp, "%%%%CreationDate: %s", ctime(&timer)); + if (psim->annotate) + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - X_ANNOT_MARGIN)), + (int) (MAX (0, lly - Y_ANNOT_MARGIN)), + (int) ( llx + scols + 0.5 + X_ANNOT_MARGIN), + (int) ( lly + srows + 0.5 + Y_ANNOT_MARGIN) ); + else + fprintf (fp, "%%%%BoundingBox: %d %d %d %d\n", + (int) (MAX (0, llx - 10)), + (int) (MAX (0, lly - 10)), + (int) ( llx + scols + 0.5 + 10), + (int) ( lly + srows + 0.5 + 10) ); + fprintf (fp, "%%%%Pages: 1\n"); + fprintf (fp, "%%%%EndComments\n"); + + /* Output remaining Postscript prolog commands. */ + for (line = EPSColorProlog; *line; line++) + fprintf (fp, "%s\n",*line); + fprintf (fp, "userdict begin\n"); + fprintf (fp, "%%%%BeginData:\n"); + + fprintf (fp, "DisplayImage\n"); + + /* Now write the image display parameters, specifically + * + * x & y translation. + * x & y scale. + * image columns & rows. + * orientation: 0-Portrait or 1-Landscape + * class: 0-DirectClass or 1-PseudoClass. + * compression: 0-RunlengthEncodedCompression or 1-NoCompression. + * hex color packets. + */ + + fprintf (fp, "%d %d\n%u %u\n%u %u\n%d\n%d\n%d\n", + (int) llx, (int) lly, + (int) scols, (int) srows, + psim->cols, psim->rows, + turnflag, + psim->colorClass == EPS_PSEUDOCOLOR, + psim->compression == NoCompression); +} + + +/* EPS_WRITETRAILER -- Output Postscript trailer blurb. +*/ +static void +eps_writeTrailer (fp) +FILE *fp; +{ + fprintf (fp, "\n"); + fprintf (fp, "showpage\n"); + fprintf (fp, "%%%%EndData\n"); + fprintf (fp, "end\n"); + fprintf (fp, "%%%%PageTrailer\n"); + fprintf (fp, "%%%%Trailer\n"); + fprintf (fp, "%%%%EOF\n"); +} + + +/* EPS_SIMPLETRAILER -- Output Postscript trailer blurb. +*/ +static void +eps_simpleTrailer (fp) +FILE *fp; +{ + fprintf (fp, "showpage\n"); +} + + +static void +eps_flushPix (fp) +FILE *fp; +{ + pixbuf[pixnum] = '\0'; + fprintf (fp, "%s", pixbuf); + pixnum = 0; + lpix = 0; +} + + +/* Utility Routines. +*/ + +/* TICSTEP -- calculate nice intervals for the ticmarks. +*/ +static float +ticstep (range,nsteps) +float range; +int nsteps; +{ + double df, t2, t5, p1, p2, p3; + float ticstep; + int logtic; + + + df = range / (float)(nsteps + 1); + t2 = 0.301029996; + t5 = 0.698970004; + p1 = log10 ((double)(df > 0.0 ? df : -df)); + p2 = (int) p1; + p3 = p1 - p2; + if(p3 < 0.) { + p3 = p2 + 1.; + p2 = p2 - 1.; + } + + if (p3 < 1.0e-10) + ticstep = pow((double)10.0,(double)(p2)); + else if (p3 > 0. && p3 <= t2) + ticstep = pow((double)10.0,(double)(p2+t2)); + else if (p3 > t2 && p3 <= t5) + ticstep = pow((double)10.0,(double)(p2+t5)); + else if (p3 > t5 && p3 <= 1.) + ticstep = pow((double)10.0,(double)(p2+1.)); + else + ticstep = df; + + logtic = (int) log10(ticstep) - 1; + ticstep = (int)( (ticstep / pow((double)10.,(double)logtic)) * + pow((double)10.,(double)logtic) ); + + if (ticstep < 0.1) ticstep = 0.10; + + return (ticstep); +} + + +/* MAKE_LABEL -- Generate the label for the output printer page. +*/ +static char * +make_label() +{ + static char buf[128]; + char hostname[32]; + char username[32]; + struct passwd *pw; + long clock; + + + bzero (buf, 128); + bzero (hostname, 32); + bzero (username, 32); + +#ifdef SOLARIS + sysinfo (SI_HOSTNAME, hostname, 32); +#else + gethostname (hostname, 32); +#endif + + clock = time(0); + pw = getpwuid (getuid()); + strcpy (username, pw->pw_name); + endpwent(); + + sprintf (buf, "NOAO/IRAF %s@%s %s", + username, hostname, asctime(localtime(&clock))); + + return (buf); +} diff --git a/vendor/x11iraf/ximtool/eps.h b/vendor/x11iraf/ximtool/eps.h new file mode 100644 index 00000000..89427ee1 --- /dev/null +++ b/vendor/x11iraf/ximtool/eps.h @@ -0,0 +1,146 @@ +/* + * EPS.H -- Include definitions for EPS hardcopy routines. + */ + + +/* Handy macro definitions */ + +#define MONO(rd,gn,bl) ((int)(rd*11 + gn*16 + bl*5) >> 5) /*.33R+ .5G+ .17B*/ +#undef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#undef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + + +#define Orientation(ps) ( ps->page.orientation ) +#define Scale(ps) ( ps->page.scale ) +#define MaxScale(ps) ( ps->page.maxscale ) +#define PageType(ps) ( ps->page.page_type ) +#define DoAutoScale(ps) ( ps->page.flags & EPS_AUTOSCALE ) +#define DoAutoRotate(ps) ( ps->page.flags & EPS_AUTOROTATE ) +#define DoMaxAspect(ps) ( ps->page.flags & EPS_MAXASPECT ) + +#define PIX_PER_LINE 72 + +/* Compression options. */ +#define NoCompression 0 /* Don't compress image */ +#define RLECompression 1 /* RLE compression */ +#define LZWCompression 2 /* LZW compression (not implemted) */ +#define JPEGCompression 3 /* JPEG compression (not implemted) */ + +/* Output color classes. */ +#define EPS_GRAYSCALE 0 /* Write a grayscale image */ +#define EPS_PSEUDOCOLOR 1 /* Write a pseudocolor image */ +#define EPS_TRUECOLOR 2 /* Write a RGB image */ + +/* Page option flags. */ +#define EPS_PORTRAIT 0 /* Page orientations */ +#define EPS_LANDSCAPE 1 +#define EPS_AUTOSCALE 0x01 /* Auto scale to fit on page */ +#define EPS_AUTOROTATE 0x02 /* Auto rotate to fit on page */ +#define EPS_MAXASPECT 0x04 /* Increase scale to max aspect */ +#define EPS_DOTITLE 0x10 /* Do title string */ +#define EPS_DOBORDERS 0x20 /* Do image borders */ +#define EPS_DOCOLORBAR 0x40 /* Do colorbar */ + +/* Transformation parameters. */ +#define EPS_UNITARY 0 +#define EPS_LINEAR 1 +#define EPS_LOG 2 + +/* Page layout structure. */ +typedef struct { + int orientation; /* page orioentation */ + float scale; /* image scale factor */ + float maxscale; /* maxaspect image scale factor */ + int dpi; /* dpi resolution */ + int page_type; /* type of paper being used */ + int flags; /* option flags */ +} PSPage, *PSPagePtr; + +/* Colormap structure. */ +typedef struct { + int IsDefault; /* Are we using the default colormap? */ + int ncolors; /* number of colormap colors */ + int min, max; /* image min/max */ + unsigned char r[256]; /* red colormap */ + unsigned char g[256]; /* green colormap */ + unsigned char b[256]; /* blue colormap */ + char *cmap_name; /* colormap name */ +} PSCmap, *PSCmapPtr; + +/* Main EPS structure. */ +typedef struct { + int cols; /* num output columns */ + int rows; /* num output rows */ + int colorClass; /* output color class */ + int compression; /* output compression type */ + int annotate; /* annotate the output image? */ + int llx, lly, urx, ury; /* image coordinate corners */ + float z1, z2; /* zscale transform values */ + int ztype; /* type of transformation */ + float offset, scale; /* brightness/contrast values */ + char *label; /* label string */ + + PSPage page; /* Page layout structure */ + PSCmap cmap; /* Colormap struct */ +} PSImage, *PSImagePtr; + + +/* Page sizes and resolution information. */ +#define EPS_LETTER 0 +#define EPS_LEGAL 1 +#define EPS_A4 2 +#define EPS_B5 3 +#define EPS_BSIZE 4 +#define EPS_4BY5 5 +#define EPS_35MM 6 + +#define PageXdim(ps) ( PageInfo[ps->page.page_type].npixx ) +#define PageYdim(ps) ( PageInfo[ps->page.page_type].npixy ) +#define PageWidth(ps) ( PageInfo[ps->page.page_type].sizex ) +#define PageHeight(ps) ( PageInfo[ps->page.page_type].sizey ) + +/* Page layout definitions. */ +#define X_ANNOT_MARGIN 30 /* margin in pixels for annotation */ +#define Y_ANNOT_MARGIN 60 /* margin in pixels for annotation */ +#define TITLE_OFFSET 20 /* Offset for title string */ +#define AXIS_OOFFSET 7 /* Outer offset for axis */ +#define AXIS_IOFFSET 2 /* Inner offset for axis */ +#define AXIS_OWIDTH 1.5 /* Outer axis width */ +#define AXIS_IWIDTH 1.0 /* Inner axis width */ +#define MAJOR_TICK_SIZE 5 /* Size of major tic mark */ +#define MAJOR_TICK_WIDTH 1.5 /* Width of major tic mark */ +#define MINOR_TICK_SIZE 3 /* Size of major tic mark */ +#define MINOR_TICK_WIDTH 0.5 /* Width of major tic mark */ +#define NTICMARKS 5 /* Number of major tick marks */ + + +typedef struct { + float sizex, sizey; /* page size in inches */ + int npixx, npixy; /* pix resolution at 72 dpi */ +} PSPageInfo; + +static PSPageInfo PageInfo[] = { /* assumes 300 dpi */ + { 8.500, 11.000, /* US NORMAL, aka LETTER */ + 612, 762 + }, + { 8.500, 14.000, /* US LEGAL */ + 612, 1008 + }, + { 8.267, 11.811, /* A4 */ + 595, 850 + }, + { 7.283, 10.630, /* B5 */ + 524, 765 + }, + {11.000, 17.000, /* B-size */ + 762, 1224 + }, + { 3.875, 4.875, /* 4 by 5 */ + 279, 351 + }, + { 0.945, 1.417, /* 35mm (24x36) */ + 68, 102 + } +}; diff --git a/vendor/x11iraf/ximtool/fitsio.c b/vendor/x11iraf/ximtool/fitsio.c new file mode 100644 index 00000000..9bbd50c1 --- /dev/null +++ b/vendor/x11iraf/ximtool/fitsio.c @@ -0,0 +1,923 @@ +/* + * FITSIO.C -- Routines to load and save simple FITS files. + * + * ival = isFITS (fname) + * loadFITS (fname, pixels, w, h, r, g, b, ncolors, + * zsc, zr, &z1, &z2, nsample) + * writeFITS (fp, pixels, pixtype, w,h, r,g,b, ncolors) + * str = getFITSHdr (fname) + + * LoadFITS(fname, numcols) - loads a FITS file + * WriteFITS(fp, pic, w, h, rmap, gmap, bmap, numcols) + * + * isFITS -- returns nonzero if the named file is a FITS file. + * loadFITS -- reads a FITS file and returns the decoded pixel array and gray- + * scale 8 bit colormap. The caller is responsible for freeing + * the pixels buffer. + * writeFITS -- performs the converse operation, writing the given pixel array + * and colormap to the output Sun rasterfile. + * Based on contributed FITS I/O software for XV by David Robinson. + */ + + +#include <stdio.h> +#include <math.h> +#include <ctype.h> + +#define NCARDS 36 +#define BLOCKSIZE 2880 +#define EPSILON 1.192e-7 + + +#define CONTRAST 0.25 /* zscaling parameters */ +#define NSAMPLE 1000 + + +/* MONO returns total intensity of r,g,b components */ +#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ + +/* data types */ +enum datatype { T_INT, T_LOG, T_REAL, T_NOVAL, T_STRING }; + +typedef unsigned char byte; +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + +typedef struct { + FILE *fp; /* file pointer */ + int bitpix, size; /* bits per pixel, sizeof(unit) */ + int naxis; /* number of axes */ + long int axes[2]; /* size of each axis */ + long int ndata; /* number of elements in data */ + long int cpos; /* current position in data file */ + char title[80]; /* image title */ + int extend; /* image has extensions? */ + int nextend; /* number of extensions */ + float bscale, bzero; /* scaling parameters */ +} FITS; + +/* Function prototypes */ +#ifdef __STDC__ + +#include <stddef.h> +#include <stdlib.h> + +static char *ftopen2d (FITS *fs, char *file, int *nx, int *ny, int *bitpix); +static void ftclose (FITS *fs); +static char *ftgbyte (FITS *fs, uchar *buffer, int nelem, int zsc, int zr, float *z1, float *z2, int nsample); +static char *rdheader (FITS *fs); +static char *wrheader (FILE *fp, int nx, int ny); +static char *rdcard (char *card, char *name, enum datatype dtype, long int *kvalue, float *rvalue); +static void wrcard (char *card, char *name, enum datatype dtype, int kvalue); +static char *ftgdata (FITS *fs, void *buffer, int nelem); +static char *ftfixdata (FITS *fs, void *buffer, int nelem); +#else +static char *ftopen2d (); +static void ftclose (); +static char *ftgbyte (); +static char *rdheader (); +static char *wrheader (); +static char *rdcard (); +static void wrcard (); +static char *ftgdata (); +static char *ftfixdata (); +#endif + + +/* ---------------- + * Public routines. + * ----------------*/ + + +/* loadFits - Load a simple FITS file. + */ +char * +loadFITS (fname, pix, nx, ny, r,g,b, ncolors, zsc, zr, z1, z2, nsample) +char *fname; /* input filename */ +uchar **pix; /* output pixels */ +int *nx, *ny; /* dimensions */ +uchar *r, *g, *b; /* colormap */ +int *ncolors; /* number of colors */ +int zsc, zr; /* z-scaling flags */ +float *z1, *z2; /* zscale values */ +int nsample; /* number of sample pts */ + +{ + FITS fs; + int i, w = 0, h = 0, bitpix, np; + byte *image; + char *error; + + error = ftopen2d (&fs, fname, &w, &h, &bitpix); + if (error) + return error; + if (fs.extend) + return "Load support for MEF files\nis not currently implemented"; + + /* allocate memory for image and read it in */ + np = w * h; + image = (byte *) malloc (np); + if (image == NULL) + return "Insufficient memory"; + + error = ftgbyte (&fs, image, np, zsc, zr, z1, z2, nsample); + ftclose (&fs); + if (error) { + free (image); + return error; + } + + /* There seems to be a convention that fits files be displayed using + * a cartesian coordinate system. Thus the first pixel is in the lower + * left corner. Fix this by reflecting in the line y=h/2. + */ + flip (image, w, h); + + /* sucess ! */ + *pix = (unsigned char *) image; + *nx = w; + *ny = h; + *ncolors = 256; + for (i = 0; i < 256; i++) + r[i] = g[i] = b[i] = i; + + return NULL; +} + + +/* writeFITS -- Write the current frame buffer out as a FITS image. + */ + +char * +writeFITS (fp, image, w, h, rmap, gmap, bmap, numcols) +FILE *fp; +byte *image; +int w, h; +byte *rmap, *gmap, *bmap; +int numcols; +{ + register int i, j, np, nend; + register byte *ptr; + char *error; + byte rgb[256]; + + error = wrheader(fp, w, h); + if (error != NULL) + return error; + + for (i = 0; i < numcols; i++) + rgb[i] = MONO(rmap[i], gmap[i], bmap[i]); + + /* flip line ordering when writing out */ + for (i = h - 1; i >= 0; i--) { + ptr = &image[i*w]; + for (j = 0; j < w; j++, ptr++) + putc(rgb[*ptr], fp); + } + + np = w * h; + /* nend is the number of padding characters at the end of the last + * block. + */ + nend = ((np + BLOCKSIZE - 1) / BLOCKSIZE) * BLOCKSIZE - np; + + if (nend) + for (i = 0; i < nend; i++) + putc('\0', fp); + + return NULL; +} + + +/* IsFITS -- Test a file to see if it is a FITS file. + */ +int +isFITS (fname) +char *fname; /* input filename */ +{ + register FILE *fp; + int value = 0; + char keyw[8], val; + + if (fp = fopen (fname, "r")) { + fscanf (fp, "%6s = %c", keyw, &val); + if (strcmp ("SIMPLE", keyw) == 0 && val == 'T') + value = 1; + fclose (fp); + } + return value; +} + + +/* getFITSHdr -- Get some set of header information for the GUI. + */ + +char * +getFITSHdr (fname) +char *fname; +{ + FITS fs; + char *error, *title, *line; + int w, h, bitpix; + + line = (char *) malloc (80); + + error = ftopen2d (&fs, fname, &w, &h, &bitpix); + if (error) { + strcpy (line, error); + return (line); + } + + if (fs.extend) { + sprintf (line, "%-16.16s %3d (%2d extns) %s", + fname, bitpix, fs.nextend, fs.title); + } else { + sprintf (line, "%-16.16s %3d %5dx%-5d %s", + fname, bitpix, w,h, fs.title); + } + + ftclose (&fs); + + return (line); +} + + + +/* + * Private Procedures + * ------------------ + */ + +/* Writes a minimalist FITS file header */ +static char +*wrheader (fp, nx, ny) +FILE *fp; +int nx, ny; +{ + char *block; + int i; + + block = (char *) malloc (BLOCKSIZE); + if (block == NULL) + return "Insufficient memory for workspace"; + memset(block, ' ', BLOCKSIZE); + + i = 0; + wrcard(&block[80*i++], "SIMPLE", T_LOG, 1); /* SIMPLE keyword */ + wrcard(&block[80*i++], "BITPIX", T_INT, 8); /* BITPIX keyword */ + wrcard(&block[80*i++], "NAXIS", T_INT, 2); /* NAXIS keyword */ + wrcard(&block[80*i++], "NAXIS1", T_INT, nx); /* NAXIS1 keyword */ + wrcard(&block[80*i++], "NAXIS2", T_INT, ny); /* NAXIS2 keyword */ + wrcard(&block[80*i++], "END", T_NOVAL, 0); /* END keyword */ + i = fwrite(block, sizeof(char), BLOCKSIZE, fp); + if (i != BLOCKSIZE) + return "Error writing FITS file"; + return NULL; +} + + +/* open a 2-dimensional fits file. + * Stores the dimensions of the file in nx and ny, and updates the FITS + * structure passed in fs. + * If successful, returns NULL otherwise returns an error message. + * Will return an error message if the primary data unit is not a 2-dimensional + * array. + */ +static char +*ftopen2d(fs, file, nx, ny, bitpix) +FITS *fs; +char *file; +int *nx, *ny, *bitpix; +{ + FILE *fp; + int naxis, i; + char *error; + + fp = fopen(file, "rb"); + if (fp == NULL) + return "Unable to open FITS file"; + + fs->fp = fp; + fs->bitpix = 0; + fs->naxis = 0; + fs->cpos = 0; + + /* read header */ + error = rdheader(fs); + + if (error != NULL) { + ftclose(fs); + return error; + } + + /* get number of data */ + fs->ndata = 1; + for (i = 0; i < fs->naxis; i++) + fs->ndata = fs->ndata * fs->axes[i]; + + naxis = fs->naxis; + + *nx = fs->axes[0]; + *ny = fs->axes[1]; + *bitpix = fs->bitpix; + + return error; +} + + +/* closes a fits file */ +static void +ftclose (fs) +FITS *fs; +{ + if (fs == NULL) + return; + if (fs->fp != NULL) + fclose(fs->fp); +} + + +/* reads the fits header, and updates the FITS structure fs. + * Returns NULL on success, or an error message otherwise. + */ +static char * +rdheader (fs) +FITS *fs; +{ + int i, j, res; + char name[9]; + char *block; + char *error; + long int val; /* the value */ + float rval; /* floating point value */ + + block = (char *) malloc(BLOCKSIZE); + if (block == NULL) + return "Insufficient memory for workspace"; + + res = fread(block, sizeof(char), BLOCKSIZE, fs->fp); + if (res != BLOCKSIZE) + return "Error reading FITS file"; + i = 0; + + /* read SIMPLE key */ + error = rdcard(block, "SIMPLE", T_LOG, &val, &rval); + if (error != NULL) + return error; + /* + if (val == 0) + return "Not a SIMPLE FITS file"; + */ + i++; + + /* read BITPIX key */ + error = rdcard(&block[80], "BITPIX", T_INT, &val, &rval); + if (error != NULL) + return error; + if (val != 8 && val != 16 && val != 32 && val != 64 && val != -32 && + val != -64) + return "Bad BITPIX value in FITS file"; + fs->bitpix = val; + j = fs->bitpix; + if (j < 0) + j = -j; + fs->size = j / 8; + i++; + + /* read NAXIS key */ + error = rdcard(&block[2*80], "NAXIS", T_INT, &val, &rval); + if (error != NULL) + return error; + if (val < 0 || val > 999) + return "Bad NAXIS value in FITS file"; + if (val == 1 || val > 2) + return "FITS file is not a two-dimensional image"; + fs->naxis = val; + i++; + + /* Check for an EXTEND/NEXTEND keyword pair. */ + error = rdcard(&block[3*80], "EXTEND", T_LOG, &val, &rval); + if (error == NULL) { + fs->extend = val; i++; + } else + fs->extend = 0; + error = rdcard(&block[4*80], "NEXTEND", T_INT, &val, &rval); + if (error == NULL) { + fs->nextend = val; i++; + } else + fs->nextend = 0; + + + /* read NAXISnnn keys. + * We allow NAXIS to be > 2 iff the dimensions of the extra axes are 1 + */ + for (j = 0; j < fs->naxis; j++) { + if (i == NCARDS) { + res = fread(block, sizeof(char), BLOCKSIZE, fs->fp); + if (res != BLOCKSIZE) + return "Error reading FITS file"; + i = 0; + } + + sprintf(name, "NAXIS%d", j + 1); + error = rdcard(&block[i*80], name, T_INT, &val, &rval); + if (error != NULL) + return error; + if (val < 0) + return "Bad NAXISn value in FITS file"; + if (j < 2) + fs->axes[j] = val; + else if (val != 1) + return "FITS file is not a two-dimensional image"; + i++; + } + fs->naxis = 2; + + /* do remainder */ + fs->bscale = 1.0; + fs->bzero = 0.0; + memset(fs->title, '\0', 80); + strcpy (fs->title, "No Title"); + for (; ; ) { + + if (block[i*80] == 'B') { + /* Try reading a BSCALE or BZERO keyword from this card. */ + error = rdcard(&block[i*80], "BSCALE", T_REAL, &val, &rval); + if (error == NULL) + fs->bscale = rval; + error = rdcard(&block[i*80], "BZERO", T_REAL, &val, &rval); + if (error == NULL) + fs->bzero = rval; + } + + if (i == NCARDS) { + res = fread(block, sizeof(char), BLOCKSIZE, fs->fp); + if (res != BLOCKSIZE) + return "Unexpected eof in FITS file"; + i = 0; + } + + if (strncmp(&block[i*80], "OBJECT ", 8) == 0) { + char *ip = &block[i*80]; + int i = 0, j = 0; + + /* Skip ahead to opening quote. */ + while (*ip != '\'' && i < 80) ip++, i++; + ip++, i++; + for (j=0; j < 80 && *ip != '\''; j++) { + fs->title[j] = *ip; + ip++; + } + fs->title[j] = '\0'; + } + + if (strncmp(&block[i*80], "END ", 8) == 0) + break; + i++; + } + free(block); + return NULL; +} + + +/* write a header record into the 80 byte buffer card. + * The keyword name is passed in name. The value type is in dtype; this + * can have the following values: + * dtype = T_NOVAL + * no keyword value is written + * dtype = T_LOG + * a logical value, either 'T' or 'F' in column 30 is written + * dtype = T_INT + * an integer is written, right justified in columns 11-30 + */ +static void +wrcard (card, name, dtype, kvalue) +char *card, *name; +enum datatype dtype; /* type of value */ +int kvalue; +{ + int l; + memset(card, ' ', 80); + l = strlen(name); + if (l) + memcpy(card, name, l); /* copy name */ + + if (dtype == T_NOVAL) + return; + + card[8] = '='; + + if (dtype == T_LOG) + card[29] = kvalue ? 'T' : 'F'; + else /* an integer */ { + sprintf(&card[10], "%20d", kvalue); + card[30] = ' '; + } + +} + + +/* Read a header record, from the 80 byte buffer card. + * the keyword name must match 'name'; and parse its value according to + * dtype. This can have the following values: + * dtype = T_LOG + * value is logical, either 'T' or 'F' in column 30. + * dtype = T_INT + * value is an integer, right justified in columns 11-30. + * dtype = T_REAL + * value is a real + * + * The value is stored in kvalue. + * It returns NULL on success, or an error message otherwise. + */ +static char * +rdcard (card, name, dtype, kvalue, rvalue) +char *card, *name; +enum datatype dtype; /* type of value */ +long int *kvalue; +float *rvalue; +{ + int i, ptr; + char namestr[9]; + static char error[45]; + + memcpy(namestr, card, 8); + i = 8; + do + i--; + while (i >= 0 && namestr[i] == ' '); + namestr[i+1] = '\0'; + + if (strcmp(namestr, name) != 0) { + sprintf(error, "Keyword %s not found in FITS file", name); + return error; + } + + /* get start of value */ + ptr = 10; + while (ptr < 80 && card[ptr] == ' ') + ptr++; + if (ptr == 80 || card[ptr] == '/') + return "FITS file has missing keyword value"; /* no value */ + + if (dtype == T_LOG) { + if ((card[ptr] != 'T' && card[ptr] != 'F')) + return "Keyword has bad logical value in FITS file"; + *kvalue = (card[ptr] == 'T'); + + } else /* an integer or real */ { + int j, end; + long int ival; + float fval; + char num[21]; + + /* + if (ptr > 29) + return "Keyword has bad integer value in FITS file"; + */ + end = ptr; + while (end < 80 && (card[end] != ' ' && card[end] != '/')) + end++; + memcpy(num, &card[ptr], end - ptr); + num[end-ptr] = '\0'; + if (dtype == T_INT) { + j = sscanf(num, "%ld", &ival); + if (j != 1) + return "Keyword has bad integer value in FITS file"; + *kvalue = ival; + *rvalue = 0.0; + } else if (dtype == T_REAL) { + j = sscanf(num, "%g", &fval); + if (j != 1) + return "Keyword has bad real value in FITS file"; + *kvalue = 0; + *rvalue = fval; + } + } + + return NULL; +} + + +/* reads nelem values into the buffer. + * returns NULL for success or an error message. + * Copes with the fact that the last 2880 byte record of the FITS file + * may be truncated, and should be padded out with zeros. + */ +static char * +ftgdata (fs, buffer, nelem) +FITS *fs; +void *buffer; +int nelem; +{ + int res; + + if (nelem == 0) + return NULL; + + res = fread(buffer, fs->size, nelem, fs->fp); + /* if failed to read all the data */ + if (res != nelem) { + /* nblock is the number of elements in a record. size is + * always a factor of BLOCKSIZE */ + int loffs, nblock = BLOCKSIZE / fs->size; + + if (!feof(fs->fp)) + return "I/O error reading FITS file"; + + /* The last record might be short; check this. + * loffs is the offset of the start of the last record from + * the current position. + */ + loffs = ((fs->ndata + nblock - 1) / nblock - 1) * nblock - fs->cpos; + + /* if we didn't read to the end of the penultimate record */ + if (res < loffs) + return "Unexpected EOF reading FITS file"; + + /* pad with zeros */ + memset((char *)buffer + res * fs->size, '\0', + (nelem - res) * fs->size); + } + fs->cpos += res; + return ftfixdata(fs, buffer, nelem); +} + + +/* convert the raw data, as stored in the FITS file, to the format + * appropiate for the data representation of the host computer. + * Assumes that + * short int = 2 byte integer + * int = 4 byte integer + */ +static char * +ftfixdata (fs, buffer, nelem) +FITS *fs; +void *buffer; +int nelem; +{ + register int i, n = nelem; + register uchar *ptr = buffer; + + /* conversions. Although the data may be signed, reverse using unsigned + * variables. Convert from big-endian two-byte signed integer to + * native form + */ + if (fs->bitpix == 16) + for (i = 0; i < n; i++, ptr += 2) + *(unsigned short int *)ptr = (((int)*ptr) << 8) | (int)(ptr[1]); + + /* convert from big-endian four-byte signed integer to native form */ + else if (fs->bitpix == 32) + for (i = 0; i < n; i++, ptr += 4) + *(unsigned int *)ptr = (((unsigned int)*ptr) << 24) | + ((unsigned int)ptr[1] << 16) | + ((unsigned int)ptr[2] << 8) | + (unsigned int)ptr[3]; + + /* convert from IEE 754 single precision to native form */ + else if (fs->bitpix == -32) { + register int j, k, expo; + static float *exps = NULL; + + if (exps == NULL) { + exps = (float *)calloc(256, sizeof(float)); + if (exps == NULL) + return "Insufficient memory for workspace"; + exps[150] = 1.; + for (i = 151; i < 256; i++) + exps[i] = 2. * exps[i-1]; + for (i = 149; i >= 0; i--) + exps[i] = 0.5 * exps[i+1]; + } + + + for (i = 0; i < n; i++, ptr += 4) { + k = (int)*ptr; + j = ((int)ptr[1] << 16) | ((int)ptr[2] << 8) | (int)ptr[3]; + expo = ((k & 127) << 1) | (j >> 23); + if ((expo | j) == 0) + *(float *)ptr = 0.; + else + *(float *)ptr = exps[expo] * (float)(j | 0x800000); + if (k & 128) + *(float *)ptr = -*(float *)ptr; + } + + /* convert from IEE 754 double precision to native form */ + } else if (fs->bitpix == -64) { + register int expo, k, l; + register unsigned int j; + static double *exps = NULL; + + if (exps == NULL) { + exps = (double *)calloc(2048, sizeof(double)); + if (exps == NULL) + return "Insufficient memory for workspace"; + exps[1075] = 1.; + for (i = 1076; i < 2048; i++) + exps[i] = 2. * exps[i-1]; + for (i = 1074; i >= 0; i--) + exps[i] = 0.5 * exps[i+1]; + } + + for (i = 0; i < n; i++, ptr += 8) { + k = (int)*ptr; + j = ((unsigned int)ptr[1] << 24) | ((unsigned int)ptr[2] << 16) | + ((unsigned int)ptr[3] << 8) | (unsigned int)ptr[4]; + l = ((int)ptr[5] << 16) | ((int)ptr[6] << 8) | (int)ptr[7]; + expo = ((k & 127) << 4) | (j >> 28); + if ((expo | j | l) == 0) + *(double *)ptr = 0.; + else + *(double *)ptr = exps[expo] * (16777216. * + (double)((j & 0x0FFFFFFF) | 0x10000000) + (double)l); + if (k & 128) + *(double *)ptr = -*(double *)ptr; + } + } + return NULL; +} + + +#undef max +#define f_max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define f_min(a,b) ((a) < (b) ? (a) : (b)) + + +/* Reads a byte image from the FITS file fs. The image contains nelem pixels. + * If bitpix = 8, then the image is loaded as stored in the file if not scaled. + * Otherwise, it is rescaled so that the minimum value is stored as 0, and + * the maximum is stored as 255 + */ +static char * +ftgbyte(fs, cbuff, nelem, zsc, zr, z1, z2, nsample) +FITS *fs; +uchar *cbuff; +int nelem; +int zsc, zr; +float *z1, *z2; +int nsample; +{ + char * voidbuff; + register int i, n = nelem; + char *error; + int pmin = 0, pmax = 255; + int npts, stdline; + extern void zscale(); + + /* if the data is uchar, then read it directly */ + if (fs->bitpix == 8 && (fs->bscale == 1.0 && fs->bzero == 0.0)) { + *z1 = 0.0; + *z2 = 255.0; + return ftgdata(fs, cbuff, nelem); + } + + /* allocate a buffer to store the image */ + if (fabs((double)fs->bscale-1.0) > EPSILON || + fabs((double)fs->bzero) > EPSILON) + voidbuff = (char * )malloc(nelem * f_max(fs->size,4)); + else + voidbuff = (char * )malloc(nelem * fs->size); + if (voidbuff == NULL) + return "Insufficient memory for workspace"; + error = ftgdata(fs, voidbuff, nelem); + if (error != NULL) { + printf ("ftgbyte: %s\n", error); + return error; + } + + /* If we've got BSCALE/BZERO values compute the original pixel values + * and convert the buffer to floating point before processing it. + * The voidbuff was allocated above with this in mind so it should be + * large enough that we can fix the pixels in place. + */ + + npts = fs->axes[0] * fs->axes[1]; + stdline = (int)((float)fs->axes[1] / sqrt((float)npts/(float)nsample)); + if (fs->bscale != 1.0 || fs->bzero != 0.0) { + register float *buf; + + buf = (float *)voidbuff; + + if (fs->bitpix == 8) { + for (i=(nelem-1); i >= 0; i--) + buf[i] = (float) voidbuff[i] * fs->bscale + fs->bzero; + } else if (fs->bitpix == 16) { + register short *old; + for (i=(nelem-1); i >= 0; i--) { + old = (short *) &voidbuff[i * 2]; + buf[i] = (float) *old * fs->bscale + fs->bzero; + } + } else if (fs->bitpix == 32) { + register int *old; + for (i=(nelem-1); i >= 0; i--) { + old = (int *) &voidbuff[i * 4]; + buf[i] = (float) *old * fs->bscale + fs->bzero; + } + } else if (fs->bitpix == -32) { + register float *old; + for (i=(nelem-1); i >= 0; i--) { + old = (float *) &voidbuff[i * 4]; + buf[i] = (float) *old * fs->bscale + fs->bzero; + } + } else if (fs->bitpix == -64) { + register double *old, *dbuf; + register float *fpix; + + dbuf = (double *) malloc (nelem * sizeof(double)); + for (i=(nelem-1); i >= 0; i--) { + old = (double *) &voidbuff[i * 8]; + dbuf[i] = (float) *old * fs->bscale + fs->bzero; + } + fpix = (float *) voidbuff; + for (i=0; i<nelem; i++) + buf[i] = fpix[i] = (float) dbuf[i]; + free ((double *) dbuf); + } + + fs->size = 4; + fs->bitpix = -32; + + /* compute the optimal zscale values */ + if (zsc) + zscale ((char *)buf, fs->axes[0], fs->axes[1], fs->bitpix, + z1, z2, CONTRAST, nsample, stdline); + else if (zr) + min_max ((float *)buf, nelem, fs->bitpix, z1, z2); + + } else { + /* compute the optimal zscale values */ + if (zsc) + zscale (voidbuff, fs->axes[0], fs->axes[1], fs->bitpix, + z1, z2, CONTRAST, nsample, stdline); + else if (zr) + min_max ((float *)voidbuff, nelem, fs->bitpix, z1, z2); + } + + /* convert short int to uchar */ + if (fs->bitpix == 16) { + register short int *buffer = (short *)voidbuff; + register int max, min; + register float scale; + + min = (int) *z1; + max = (int) *z2; + scale = (max == min) ? 0. : 255. / (*z2 -*z1); + + /* rescale and convert */ + for (i = 0, buffer = (short *)voidbuff; i < n; i++) + cbuff[i] = f_max (pmin, f_min (pmax, + (int)(scale * (float)((int)buffer[i] - min)) )); + + /* convert long int to uchar */ + } else if (fs->bitpix == 32) { + register int *buffer = (int *)voidbuff; + register int max, min; + register float scale; + + min = (int) *z1; + max = (int) *z2; + scale = (max == min) ? 0. : 255. / (*z2 - *z1); + + /* rescale and convert */ + for (i = 0, buffer = (int *)voidbuff; i < n; i++) + cbuff[i] = f_max (pmin, f_min (pmax, + (int)(scale * (float)((int)buffer[i] - min)) )); + + /* convert float to uchar */ + } else if (fs->bitpix == -32) { + register float *buffer = (float *)voidbuff; + register float max, min, scale; + + min = *z1; + max = *z2; + scale = (max == min) ? 0. : 255. / (*z2 - *z1); + + /* rescale and convert */ + for (i = 0, buffer = (float *)voidbuff; i < n; i++) + cbuff[i] = f_max (pmin, f_min (pmax, + (int)(scale * ((float)buffer[i] - min)) )); + + /* convert double to uchar */ + } else if (fs->bitpix == -64) { + register double *buffer = (double *)voidbuff; + register double max, min, scale; + + min = (double) *z1; + max = (double) *z2; + scale = (max == min) ? 0. : 255. / (*z2 - *z1); + + /* rescale and convert */ + for (i = 0, buffer = (double *)voidbuff; i < n; i++) + cbuff[i] = f_max (pmin, f_min (pmax, + (int)(scale * ((double)buffer[i] - min)) )); + } + + free( (char *)voidbuff); + return NULL; +} diff --git a/vendor/x11iraf/ximtool/gifio.c b/vendor/x11iraf/ximtool/gifio.c new file mode 100644 index 00000000..de81085b --- /dev/null +++ b/vendor/x11iraf/ximtool/gifio.c @@ -0,0 +1,1325 @@ +/* + * GIFIO.C -- Routines to load and save simple GIF files. + * + * ival = isGIF (fname) + * loadGIF (fname, pixels, pixtype, w,h, r,g,b, ncolors) + * writeGIF (fp, pixels, pixtype, w,h, r,g,b, ncolors, gray) + + * LoadGIF(fname, numcols) - loads a GIF file + * WriteGIF(fp, pic, w, h, rmap, gmap, bmap, numcols) + * + * isGIF -- returns nonzero if the named file is a GIF file. + * loadGIF -- reads a GIF file and returns the decoded pixel array and gray- + * scale 8 bit colormap. The caller is responsible for freeing + * the pixels buffer. + * writeGIF -- performs the converse operation, writing the given pixel array + * and colormap to the output GIF file. + * + * Based on GIFENCOD by David Rowley <mgardi@watdscu.waterloo.edu>.A + * Lempel-Zim compression based on "compress". + */ + +#include <stdio.h> +#include <math.h> + + +/* a code_int must be able to hold 2**GIFBITS values of type int, and also -1 + */ +typedef int code_int; +typedef long int count_int; +typedef unsigned char byte; +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + +#define MAXCOLORS 256 +#define TRUE 1 +#define FALSE 0 + +#define CM_RED 0 +#define CM_GREEN 1 +#define CM_BLUE 2 + +#define GIFBITS 12 + +#define INTERLACE 0x40 +#define LOCALCOLORMAP 0x80 + +#define BitSet(byte, bit) (((byte) & (bit)) == (bit)) +#define ReadOK(file,buffer,len) (fread(buffer, len, 1, file) != 0) +#define LM_to_uint(a,b) (((b)<<8)|(a)) + +static struct { + unsigned int Width; + unsigned int Height; + unsigned int BitPixel; + unsigned int ColorResolution; + unsigned int Background; + unsigned int AspectRatio; +} GifScreen; + +static struct { + int transparent; + int delayTime; + int inputFlag; + int disposal; +} Gif89 = { + -1, -1, -1, 0 }; + + + +/* MONO returns total intensity of r,g,b components */ +#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ + + +/* Function prototypes */ +#ifdef __STDC__ + +#include <stddef.h> +#include <stdlib.h> + +static int colorstobpp (int colors); +static int GetPixel (int x, int y); +static void BumpPixel (void); +static int GIFNextPixel (); +static void GIFEncode (FILE* fp, int GWidth, int GHeight, int GInterlace, + int Background, int BitsPerPixel, int Red[], int Green[], int Blue[]); +static void Putword (int w, FILE* fp); +static void compress (int init_bits, FILE* outfile); +static void output (code_int code); +static void cl_block (void); +static void cl_hash (count_int hsize); +static void writeerr (void); +static void char_init (void); +static void char_out (int c); +static void flush_char (void); + +static char *ReadGIF (FILE *fd, int imageNumber, uchar **pix, int *nx, int *ny, + uchar *r, uchar *g, uchar *b, int *ncolors); +static int ReadColorMap (FILE *fd, int number, uchar *r, uchar *g, uchar *b ); +static int DoExtension (FILE *fd, int label ); +static int GetDataBlock (FILE *fd, uchar *buf ); +static int GetCode (FILE *fd, int code_size, int flag ); +static int LWZReadByte (FILE *fd, int flag, int input_code_size ); +static char *ReadImage (FILE *fd, int len, int height, + int interlace, int ignore, uchar **image ); + +#else +static int colorstobpp(), GIFNextPixel(); +static void BumpPixel (), GIFEncode (), Putword (), compress (); +static void output (), cl_block (), cl_hash (), writeerr (), char_init (); +static void char_out (), flush_char (); + +static char *ReadGIF (), *ReadImage (); +static int ReadColorMap (), DoExtension (), GetDataBlock (); +static int GetCode (), LWZReadByte (); +#endif + +static byte *pixels; +static int nrows, ncols; +static char *errstr = NULL; + + +/* ---------------- + * Public routines. + * ----------------*/ + + +/* loadGIF - Load a GIF file. + */ + +char * +loadGIF (fname, pix, nx, ny, r,g,b, ncolors, gray) +char *fname; /* input filename */ +uchar **pix; /* output pixels */ +int *nx, *ny; /* dimensions */ +uchar *r, *g, *b; /* colormap */ +int *ncolors; /* number of colors */ +int gray; /* read as a grayscale? */ +{ + register FILE *fd; + register int i, imageNumber = 1; + + if ((fd = fopen(fname, "rb")) == NULL) + return "Unable to open FITS file"; + + for (i=0; i < 256; i++) + r[i] = g[i] = b[i] = 0; + + errstr = ReadGIF(fd, imageNumber, pix, nx, ny, r, g, b, ncolors); + + /* If we requested grayscale reset the colormap and pixels. */ + if (gray) + for (i=0; i < 256; i++) + r[i] = g[i] = b[i] = MONO(r[i],g[i],b[i]); + + fclose (fd); + return (errstr); +} + + +/* writeGIF -- Write a GIF image. + */ + +int +writeGIF (fp, image, w, h, rmap, gmap, bmap, numcols, gray) +FILE *fp; /* output file descriptor */ +byte *image; /* image pixels */ +int w, h; /* image dimensions */ +byte *rmap, *gmap, *bmap; /* colormap */ +int numcols; /* number of colors */ +int gray; /* save as grayscale? */ +{ + register int i, bpp, npix; + int r[MAXCOLORS], g[MAXCOLORS], b[MAXCOLORS]; + + /* Change type of the colormap. */ + if (gray) + for (i = 0; i < MAXCOLORS; i++) + r[i] = g[i] = b[i] = (int) MONO(rmap[i],gmap[i],bmap[i]); + else + for (i = 0; i < MAXCOLORS; i++) { + r[i] = (int) rmap[i]; + g[i] = (int) gmap[i]; + b[i] = (int) bmap[i]; + } + bpp = colorstobpp (numcols); + + /* Load the pixel buffer */ + npix = w * h; + ncols = w; + nrows = h; + pixels = (byte *) malloc (npix * sizeof(byte)); + for (i = 0; i < npix; i++) + pixels[i] = image[i]; + + /* All set, write it out. */ + GIFEncode (fp, w, h, 0, 0, bpp, r, g, b); + + /* Clean up. */ + free ((byte *)pixels); +} + + +/* IsGIF -- Test a file to see if it is a GIF file. + */ +int +isGIF (fname) +char *fname; /* input filename */ +{ + register FILE *fp; + int value = 0; + char tag[5]; + + if (fp = fopen (fname, "r")) { + fread (tag, sizeof(char), 4, fp); + if (strncmp ("GIF8", tag, 4) == 0) + value = 1; + fclose (fp); + } + return value; +} + + +/* getGIFHdr -- Get some set of header information for the GUI. + */ + +char * +getGIFHdr (fname) +char *fname; +{ + FILE *fp; + char *line; + uchar buf[16], version[4]; + int nx, ny, ncolors; + + + /* Open the image. */ + fp = fopen (fname, "r"); + if (!fp) + return NULL; + + /* Get the version. */ + if (!ReadOK(fp, buf, 6) || strncmp(buf, "GIF", 3) != 0) + return NULL; + strncpy(version, buf + 3, 3); + version[3] = '\0'; + + + /* Read the image header. */ + if (!ReadOK(fp, buf, 7)) + return NULL; + nx = LM_to_uint(buf[0], buf[1]); + ny = LM_to_uint(buf[2], buf[3]); + ncolors = 2 << (buf[4] & 0x07); + + /* Format the description. */ + line = (char *) malloc (80); + sprintf (line, "%-16.16s 8 %5dx%-5d GIF%s Image (%d colors)", + fname, nx, ny, version, ncolors); + + fclose (fp); + return (line); +} + + + +/* ------------------ + * Private Procedures + * ------------------*/ + + +/* COLORSTOBPP -- Convert the numbers of colors we're writing to a + * bits-per-pixel value. + */ +static int +colorstobpp (colors) +int colors; +{ + int bpp; + + if (colors <= 2) + bpp = 1; + else if (colors <= 4) + bpp = 2; + else if (colors <= 8) + bpp = 3; + else if (colors <= 16) + bpp = 4; + else if (colors <= 32) + bpp = 5; + else if (colors <= 64) + bpp = 6; + else if (colors <= 128) + bpp = 7; + else if (colors <= 256) + bpp = 8; + else + perror ("can't happen"); + + return bpp; +} + + + +/*---------------------- + * GIF Input Procedures + *----------------------*/ + + +/* +-------------------------------------------------------------------+ + * | Copyright 1990, David Koblas. | + * | Permission to use, copy, modify, and distribute this software | + * | and its documentation for any purpose and without fee is hereby | + * | granted, provided that the above copyright notice appear in all | + * | copies and that both that copyright notice and this permission | + * | notice appear in supporting documentation. This software is | + * | provided "as is" without express or implied warranty. | + * +-------------------------------------------------------------------+ + */ + + +static char * +ReadGIF(fd, imageNumber, pix, nx, ny, r, g, b, ncolors) +FILE *fd; +int imageNumber; +uchar **pix; +int *nx, *ny; +uchar *r, *g, *b; +int *ncolors; +{ + uchar buf[16]; + uchar c; + int useGlobalColormap; + int bitPixel; + int imageCount = 0; + char version[4]; + + if (!ReadOK(fd, buf, 6)) + return "error reading magic number"; + + if (strncmp(buf, "GIF", 3) != 0) + return "not a GIF file"; + + strncpy(version, buf + 3, 3); + version[3] = '\0'; + + if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) + return "bad version number, not '87a' or '89a'"; + + if (!ReadOK(fd, buf, 7)) + return "failed to read screen descriptor"; + + *nx = GifScreen.Width = LM_to_uint(buf[0], buf[1]); + *ny = GifScreen.Height = LM_to_uint(buf[2], buf[3]); + *ncolors = GifScreen.BitPixel = 2 << (buf[4] & 0x07); + GifScreen.ColorResolution = (((buf[4] & 0x70) >> 3) + 1); + GifScreen.Background = buf[5]; + GifScreen.AspectRatio = buf[6]; + + if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */ + if (ReadColorMap(fd, *ncolors, r, g, b)) + return "error reading global colormap"; + } + + if (GifScreen.AspectRatio != 0 && GifScreen.AspectRatio != 49) { + float r; + r = ( (float) GifScreen.AspectRatio + 15.0 ) / 64.0; + } + + for (; ; ) { + if (!ReadOK(fd, &c, 1)) + return "EOF / read error on image data"; + + if (c == ';') { /* GIF terminator */ + if (imageCount < imageNumber) + return "requested image number not found"; + return; + } + + if (c == '!') { /* Extension */ + if (!ReadOK(fd, &c, 1)) + return "OF / read error on extention function code"; + DoExtension(fd, c); + continue; + } + + if (c != ',') /* Not a valid start character */ + continue; + + ++imageCount; + + if (!ReadOK(fd, buf, 9)) + return "couldn't read left/top/width/height"; + + useGlobalColormap = !BitSet(buf[8], LOCALCOLORMAP); + + bitPixel = 1 << ((buf[8] & 0x07) + 1); + + if (!useGlobalColormap) { + if (ReadColorMap(fd, bitPixel, r, g, b)) + return "error reading local colormap"; + return (ReadImage(fd, LM_to_uint(buf[4], buf[5]), + LM_to_uint(buf[6], buf[7]), BitSet(buf[8], INTERLACE), + imageCount != imageNumber, pix )); + } else { + return (ReadImage(fd, LM_to_uint(buf[4], buf[5]), + LM_to_uint(buf[6], buf[7]), BitSet(buf[8], INTERLACE), + imageCount != imageNumber, pix )); + } + + } +} + + +static int +ReadColorMap(fd, number, r, g, b) +FILE *fd; +int number; +uchar *r, *g, *b; +{ + int i; + uchar rgb[3]; + + for (i = 0; i < number; ++i) { + if (!ReadOK(fd, rgb, sizeof(rgb))) + return TRUE; + + r[i] = rgb[0] ; + g[i] = rgb[1] ; + b[i] = rgb[2] ; + } + return FALSE; +} + + +static int +DoExtension(fd, label) +FILE *fd; +int label; +{ + static char buf[256]; + char *str; + + switch (label) { + case 0x01: /* Plain Text Extension */ + str = "Plain Text Extension"; + break; + case 0xff: /* Application Extension */ + str = "Application Extension"; + break; + case 0xfe: /* Comment Extension */ + str = "Comment Extension"; + while (GetDataBlock(fd, (uchar * ) buf) != 0) + ; + return FALSE; + case 0xf9: /* Graphic Control Extension */ + str = "Graphic Control Extension"; + (void) GetDataBlock(fd, (uchar * ) buf); + Gif89.disposal = (buf[0] >> 2) & 0x7; + Gif89.inputFlag = (buf[0] >> 1) & 0x1; + Gif89.delayTime = LM_to_uint(buf[1], buf[2]); + if ((buf[0] & 0x1) != 0) + Gif89.transparent = buf[3]; + + while (GetDataBlock(fd, (uchar * ) buf) != 0) + ; + return FALSE; + default: + str = buf; + sprintf(buf, "UNKNOWN (0x%02x)", label); + break; + } + + while (GetDataBlock(fd, (uchar * ) buf) != 0) ; + + return FALSE; +} + + +static int ZeroDataBlock = FALSE; + +static int +GetDataBlock(fd, buf) +FILE *fd; +uchar *buf; +{ + uchar count; + + if (!ReadOK(fd, &count, 1)) + return - 1; + + ZeroDataBlock = count == 0; + + if ((count != 0) && (!ReadOK(fd, buf, count))) + return - 1; + + return count; +} + + +static int +GetCode(fd, code_size, flag) +FILE *fd; +int code_size; +int flag; +{ + static uchar buf[280]; + static int curbit, lastbit, done, last_byte; + int i, j, ret; + uchar count; + + if (flag) { + curbit = 0; + lastbit = 0; + done = FALSE; + return 0; + } + + if ( (curbit + code_size) >= lastbit) { + if (done) + return - 1; + buf[0] = buf[last_byte-2]; + buf[1] = buf[last_byte-1]; + + if ((count = GetDataBlock(fd, &buf[2])) == 0) + done = TRUE; + + last_byte = 2 + count; + curbit = (curbit - lastbit) + 16; + lastbit = (2 + count) * 8 ; + } + + ret = 0; + for (i = curbit, j = 0; j < code_size; ++i, ++j) + ret |= ((buf[ i / 8 ] & (1 << (i % 8))) != 0) << j; + + curbit += code_size; + + return ret; +} + + +static int +LWZReadByte(fd, flag, input_code_size) +FILE *fd; +int flag; +int input_code_size; +{ + static int fresh = FALSE; + int code, incode; + static int code_size, set_code_size; + static int max_code, max_code_size; + static int firstcode, oldcode; + static int clear_code, end_code; + static int table[2][(1<< GIFBITS)]; + static int stack[(1<<(GIFBITS))*2], *sp; + register int i; + + if (flag) { + set_code_size = input_code_size; + code_size = set_code_size + 1; + clear_code = 1 << set_code_size ; + end_code = clear_code + 1; + max_code_size = 2 * clear_code; + max_code = clear_code + 2; + + GetCode(fd, 0, TRUE); + + fresh = TRUE; + + for (i = 0; i < clear_code; ++i) { + table[0][i] = 0; + table[1][i] = i; + } + for (; i < (1 << GIFBITS); ++i) + table[0][i] = table[1][0] = 0; + + sp = stack; + + return 0; + } else if (fresh) { + fresh = FALSE; + do { + firstcode = oldcode = + GetCode(fd, code_size, FALSE); + } while (firstcode == clear_code); + return firstcode; + } + + if (sp > stack) + return * --sp; + + while ((code = GetCode(fd, code_size, FALSE)) >= 0) { + if (code == clear_code) { + for (i = 0; i < clear_code; ++i) { + table[0][i] = 0; + table[1][i] = i; + } + for (; i < (1 << GIFBITS); ++i) + table[0][i] = table[1][i] = 0; + code_size = set_code_size + 1; + max_code_size = 2 * clear_code; + max_code = clear_code + 2; + sp = stack; + firstcode = oldcode = + GetCode(fd, code_size, FALSE); + return firstcode; + } else if (code == end_code) { + int count; + uchar buf[260]; + + if (ZeroDataBlock) + return - 2; + + while ((count = GetDataBlock(fd, buf)) > 0) + ; + + return - 2; + } + + incode = code; + + if (code >= max_code) { + *sp++ = firstcode; + code = oldcode; + } + + while (code >= clear_code) { + *sp++ = table[1][code]; + code = table[0][code]; + } + + *sp++ = firstcode = table[1][code]; + + if ((code = max_code) < (1 << GIFBITS)) { + table[0][code] = oldcode; + table[1][code] = firstcode; + ++max_code; + if ((max_code >= max_code_size) && + (max_code_size < (1 << GIFBITS))) { + max_code_size *= 2; + ++code_size; + } + } + + oldcode = incode; + + if (sp > stack) + return * --sp; + } + return code; +} + + +static char * +ReadImage(fd, len, height, interlace, ignore, image) +FILE *fd; +int len, height; +int interlace, ignore; +uchar **image; +{ + uchar c; + int v; + int xpos = 0, ypos = 0, pass = 0; + + /* Initialize the Compression routines */ + if (!ReadOK(fd, &c, 1)) + return "EOF / read error on image data"; + + if (LWZReadByte(fd, TRUE, c) < 0) + return "error reading image"; + + /* If this is an "uninteresting picture" ignore it. */ + if (ignore) { + while (LWZReadByte(fd, FALSE, c) >= 0) + ; + return; + } + + if ((*image = (uchar *)malloc(len * height)) == NULL) + return "couldn't alloc space for image"; + + while ((v = LWZReadByte(fd, FALSE, c)) >= 0 ) { + (*image)[ypos * len + xpos] = v; + + ++xpos; + if (xpos == len) { + xpos = 0; + if (interlace) { + switch (pass) { + case 0: + case 1: + ypos += 8; + break; + case 2: + ypos += 4; + break; + case 3: + ypos += 2; + break; + } + + if (ypos >= height) { + ++pass; + switch (pass) { + case 1: + ypos = 4; + break; + case 2: + ypos = 2; + break; + case 3: + ypos = 1; + break; + default: + goto fini; + } + } + } else { + ++ypos; + } + } + if (ypos >= height) + break; + } + +fini: + return NULL; +} + + + +/*----------------------- + * GIF Output Procedures + *-----------------------*/ + +/***************************************************************************** + * + * GIFENCODE.C - GIF Image compression interface + * + * GIFEncode (FName, GHeight, GWidth, GInterlace, Background, + * BitsPerPixel, Red, Green, Blue) + * + *****************************************************************************/ + +#define TRUE 1 +#define FALSE 0 + +static int Width, Height; +static int curx, cury; +static long CountDown; +static int Pass = 0; +static int Interlace; + + + +static void +GIFEncode (fp, GWidth, GHeight, GInterlace, Background, +BitsPerPixel, Red, Green, Blue) + +FILE*fp; +int GWidth, GHeight; +int GInterlace; +int Background; +int BitsPerPixel; +int Red[], Green[], Blue[]; +{ + int B; + int RWidth, RHeight; + int LeftOfs, TopOfs; + int Resolution; + int ColorMapSize; + int InitCodeSize; + int i; + + Interlace = GInterlace; + + ColorMapSize = 1 << BitsPerPixel; + + RWidth = Width = GWidth; + RHeight = Height = GHeight; + LeftOfs = TopOfs = 0; + + Resolution = BitsPerPixel; + + /* Calculate number of bits we are expecting */ + CountDown = (long)Width * (long)Height; + + /* Indicate which pass we are on (if interlace) */ + Pass = 0; + + /* The initial code size */ + if (BitsPerPixel <= 1) + InitCodeSize = 2; + else + InitCodeSize = BitsPerPixel; + + /* Set up the current x and y position */ + curx = cury = 0; + + /* Write the Magic header */ + fwrite ("GIF87a", 1, 6, fp); + + /* Write out the screen width and height */ + Putword (RWidth, fp); + Putword (RHeight, fp); + + /* Indicate that there is a global colour map */ + B = 0x80; /* Yes, there is a color map */ + + /* OR in the resolution */ + B |= (Resolution - 1) << 5; + + /* OR in the Bits per Pixel */ + B |= (BitsPerPixel - 1); + + /* Write it out */ + fputc (B, fp); + + /* Write out the Background colour */ + fputc (Background, fp); + + /* Byte of 0's (future expansion) */ + fputc (0, fp); + + /* Write out the Global Colour Map */ + for (i = 0; i < ColorMapSize; ++i) { + fputc (Red[i], fp); + fputc (Green[i], fp); + fputc (Blue[i], fp); + } + + /* Write an Image separator */ + fputc (',', fp); + + /* Write the Image header */ + Putword (LeftOfs, fp); + Putword (TopOfs, fp); + Putword (Width, fp); + Putword (Height, fp); + + /* Write out whether or not the image is interlaced */ + if (Interlace) + fputc (0x40, fp); + else + fputc (0x00, fp); + + /* Write out the initial code size */ + fputc (InitCodeSize, fp); + + /* Go and actually compress the data */ + compress (InitCodeSize + 1, fp); + + /* Write out a Zero-length packet (to end the series) */ + fputc (0, fp); + + /* Write the GIF file terminator */ + fputc (';', fp); +} + + +/* Bump the 'curx' and 'cury' to point to the next pixel + */ +static void +BumpPixel() +{ + /* Bump the current X position */ + ++curx; + + /* If we are at the end of a scan line, set curx back to the beginning + * If we are interlaced, bump the cury to the appropriate spot, + * otherwise, just increment it. + */ + if (curx == Width) { + curx = 0; + + if (!Interlace) + ++cury; + else { + switch (Pass) { + case 0: + cury += 8; + if (cury >= Height) { + ++Pass; + cury = 4; + } + break; + case 1: + cury += 8; + if (cury >= Height) { + ++Pass; + cury = 2; + } + break; + case 2: + cury += 4; + if (cury >= Height) { + ++Pass; + cury = 1; + } + break; + case 3: + cury += 2; + break; + } + } + } +} + + +/* Return the next pixel from the image + */ +static int +GIFNextPixel () +{ + int r; + + if (CountDown == 0) + return EOF; + + --CountDown; + r = (int) pixels[ cury * ncols + curx ] ; + BumpPixel(); + return r; +} + + +/* Write out a word to the GIF file + */ +static void +Putword (w, fp) +int w; +FILE*fp; +{ + fputc (w & 0xff, fp); + fputc ((w / 256) & 0xff, fp); +} + + +/*************************************************************************** + * + * GIFCOMPR.C - GIF Image compression routines + * + * Lempel-Ziv compression based on 'compress'. GIF modifications by + * David Rowley (mgardi@watdcsu.waterloo.edu) + * + ***************************************************************************/ + +/* + * General DEFINEs + */ + +#define GIFBITS 12 +#define HSIZE 5003 /* 80% occupancy */ + +#ifdef NO_UCHAR +typedef char char_type; +#else /*NO_UCHAR*/ +typedef unsigned char char_type; +#endif /*NO_UCHAR*/ + +/* + * + * GIF Image compression - modified 'compress' + * + * Based on: compress.c - File compression ala IEEE Computer, June 1984. + * + * By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) + * Jim McKie (decvax!mcvax!jim) + * Steve Davies (decvax!vax135!petsd!peora!srd) + * Ken Turkowski (decvax!decwrl!turtlevax!ken) + * James A. Woods (decvax!ihnp4!ames!jaw) + * Joe Orost (decvax!vax135!petsd!joe) + * + */ +#include <ctype.h> + +#define ARGVAL() (*++(*argv) || (--argc && *++argv)) + +static int n_bits; /* number of bits/code */ +static int maxbits = GIFBITS; /* user settable max # bits/code */ +static code_int maxcode; /* maximum code, given n_bits */ + /* should NEVER generate this code */ +static code_int maxmaxcode = (code_int) 1 << GIFBITS; +#ifdef COMPATIBLE /* But wrong! */ +# define MAXCODE(n_bits) ((code_int) 1 << (n_bits) - 1) +#else /*COMPATIBLE*/ +# define MAXCODE(n_bits) (((code_int) 1 << (n_bits)) - 1) +#endif /*COMPATIBLE*/ + +static count_int htab [HSIZE]; +static unsigned short codetab [HSIZE]; +#define HashTabOf(i) htab[i] +#define CodeTabOf(i) codetab[i] + +/*static*/ code_int hsize = HSIZE; /* for dynamic table sizing */ + +/* To save much memory, we overlay the table used by compress() with those + * used by decompress(). The tab_prefix table is the same size and type + * as the codetab. The tab_suffix table needs 2**GIFBITS characters. We + * get this from the beginning of htab. The output stack uses the rest + * of htab, and contains characters. There is plenty of room for any + * possible stack (stack used to be 8000 characters). + */ + +#define tab_prefixof(i) CodeTabOf(i) +#define tab_suffixof(i) ((char_type*)(htab))[i] +#define de_stack ((char_type*)&tab_suffixof((code_int)1<<GIFBITS)) + +static code_int free_ent = 0; /* first unused entry */ + +/* + * block compression parameters -- after all codes are used up, + * and compression rate changes, start over. + */ +static int clear_flg = 0; + +static int offset; +static long int in_count = 1; /* length of input */ +static long int out_count = 0; /* # of codes output (for debugging) */ + +/* + * compress stdin to stdout + * + * Algorithm: use open addressing double hashing (no chaining) on the + * prefix code / next character combination. We do a variant of Knuth's + * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime + * secondary probe. Here, the modular division first probe is gives way + * to a faster exclusive-or manipulation. Also do block compression with + * an adaptive reset, whereby the code table is cleared when the compression + * ratio decreases, but after the table fills. The variable-length output + * codes are re-sized at this point, and a special CLEAR code is generated + * for the decompressor. Late addition: construct the table according to + * file size for noticeable speed improvement on small files. Please direct + * questions about this implementation to ames!jaw. + */ + +static int g_init_bits; +static FILE *g_outfile; + +static int ClearCode; +static int EOFCode; + +static unsigned long cur_accum = 0; +static int cur_bits = 0; +static unsigned long masks[] = { + 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, + 0x001F, 0x003F, 0x007F, 0x00FF, + 0x01FF, 0x03FF, 0x07FF, 0x0FFF, + 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; + +static int a_count; /* Number of characters so far in this 'packet' */ +static char accum[ 256 ]; /* Define the storage for the packet accumulator */ + +static void +compress (init_bits, outfile) +int init_bits; +FILE*outfile; +{ + register long fcode; + register code_int i /* = 0 */; + register int c; + register code_int ent; + register code_int disp; + register code_int hsize_reg; + register int hshift; + + /* + * Set up the globals: g_init_bits - initial number of bits + * g_outfile - pointer to output file + */ + g_init_bits = init_bits; + g_outfile = outfile; + + /* + * Set up the necessary values + */ + offset = 0; + out_count = 0; + clear_flg = 0; + cur_accum = 0; + cur_bits = 0; + in_count = 1; + maxbits = GIFBITS; + maxcode = MAXCODE(n_bits = g_init_bits); + + ClearCode = (1 << (init_bits - 1)); + EOFCode = ClearCode + 1; + free_ent = ClearCode + 2; + + char_init(); + for (i=0; i<HSIZE; i++) { + htab[i] = 0; + codetab[i] = 0; + } + + ent = GIFNextPixel (); + + hshift = 0; + for (fcode = (long) hsize; fcode < 65536L; fcode *= 2L) + ++hshift; + hshift = 8 - hshift; /* set hash code range bound */ + + hsize_reg = hsize; + cl_hash ((count_int) hsize_reg); /* clear hash table */ + + output ((code_int)ClearCode); + + while ((c = GIFNextPixel ()) != EOF) { + + ++in_count; + + fcode = (long) (((long) c << maxbits) + ent); + i = (((code_int)c << hshift) ^ ent); /* xor hashing */ + + if (HashTabOf (i) == fcode) { + ent = CodeTabOf (i); + continue; + } else if ((long)HashTabOf (i) < 0) /* empty slot */ + goto nomatch; + disp = hsize_reg - i; /* secondary hash (after G. Knott) */ + if (i == 0) + disp = 1; +probe: + if ((i -= disp) < 0) + i += hsize_reg; + + if (HashTabOf (i) == fcode) { + ent = CodeTabOf (i); + continue; + } + if ((long)HashTabOf (i) > 0) + goto probe; +nomatch: + output ((code_int) ent); + ++out_count; + ent = c; + if (free_ent < maxmaxcode) { /* } */ + CodeTabOf (i) = free_ent++; /* code -> hashtable */ + HashTabOf (i) = fcode; + } else + cl_block(); + } + + /* + * Put out the final code. + */ + output ((code_int)ent); + ++out_count; + output ((code_int) EOFCode); +} + +/***************************************************************** + * TAG (output) + * + * Output the given code. + * Inputs: + * code: A n_bits-bit integer. If == -1, then EOF. This assumes + * that n_bits =< (long)wordsize - 1. + * Outputs: + * Outputs code to the file. + * Assumptions: + * Chars are 8 bits long. + * Algorithm: + * Maintain a GIFBITS character long buffer (so that 8 codes will + * fit in it exactly). Use the VAX insv instruction to insert each + * code in turn. When the buffer fills up empty it and start over. + */ + + +static void +output (code) +code_int code; +{ + cur_accum &= masks[ cur_bits ]; + + if (cur_bits > 0) + cur_accum |= ((long)code << cur_bits); + else + cur_accum = code; + + cur_bits += n_bits; + + while (cur_bits >= 8) { + char_out ((unsigned int)(cur_accum & 0xff)); + cur_accum >>= 8; + cur_bits -= 8; + } + + /* + * If the next entry is going to be too big for the code size, + * then increase it, if possible. + */ + if (free_ent > maxcode || clear_flg) { + + if (clear_flg) { + maxcode = MAXCODE (n_bits = g_init_bits); + clear_flg = 0; + } else { + ++n_bits; + if (n_bits == maxbits) + maxcode = maxmaxcode; + else + maxcode = MAXCODE(n_bits); + } + } + + if (code == EOFCode) { + /* At EOF, write the rest of the buffer. */ + while (cur_bits > 0) { + char_out ((unsigned int)(cur_accum & 0xff)); + cur_accum >>= 8; + cur_bits -= 8; + } + flush_char(); + fflush (g_outfile); + if (ferror (g_outfile)) + writeerr(); + } +} + + +/* + * Clear out the hash table + */ +static void +cl_block () /* table clear for block compress */ +{ + + cl_hash ((count_int) hsize); + free_ent = ClearCode + 2; + clear_flg = 1; + + output ((code_int)ClearCode); +} + +static void +cl_hash(hsize) /* reset code table */ +register count_int hsize; +{ + + register count_int *htab_p = htab + hsize; + + register long i; + register long m1 = -1; + + i = hsize - 16; + do { /* might use Sys V memset(3) here */ + *(htab_p - 16) = m1; + *(htab_p - 15) = m1; + *(htab_p - 14) = m1; + *(htab_p - 13) = m1; + *(htab_p - 12) = m1; + *(htab_p - 11) = m1; + *(htab_p - 10) = m1; + *(htab_p - 9) = m1; + *(htab_p - 8) = m1; + *(htab_p - 7) = m1; + *(htab_p - 6) = m1; + *(htab_p - 5) = m1; + *(htab_p - 4) = m1; + *(htab_p - 3) = m1; + *(htab_p - 2) = m1; + *(htab_p - 1) = m1; + htab_p -= 16; + } while ((i -= 16) >= 0); + + for (i += 16; i > 0; --i) + *--htab_p = m1; +} + +static void +writeerr() +{ + perror ("error writing output file"); +} + + +/****************************************************************************** + * + * GIF Specific routines + * + ******************************************************************************/ + + +/* Set up the 'byte output' routine + */ +static void +char_init() +{ + register int i; + + a_count = 0; + for (i=0; i<256; i++) + accum[i] = 0; +} + + +/* + * Add a character to the end of the current packet, and if it is 254 + * characters, flush the packet to disk. + */ +static void +char_out (c) +int c; +{ + accum[ a_count++ ] = c; + if (a_count >= 254) + flush_char(); +} + +/* + * Flush the packet to disk, and reset the accumulator + */ +static void +flush_char() +{ + if (a_count > 0) { + fputc (a_count, g_outfile); + fwrite (accum, 1, a_count, g_outfile); + a_count = 0; + } +} diff --git a/vendor/x11iraf/ximtool/gui.bak/blink.obj b/vendor/x11iraf/ximtool/gui.bak/blink.obj new file mode 100644 index 00000000..dfae6861 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/blink.obj @@ -0,0 +1,46 @@ + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/blink.res b/vendor/x11iraf/ximtool/gui.bak/blink.res new file mode 100644 index 00000000..311bad2a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/blink.res @@ -0,0 +1,167 @@ + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/boot.tcl b/vendor/x11iraf/ximtool/gui.bak/boot.tcl new file mode 100644 index 00000000..936273a5 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/boot.tcl @@ -0,0 +1,74 @@ + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + diff --git a/vendor/x11iraf/ximtool/gui.bak/compass.tcl b/vendor/x11iraf/ximtool/gui.bak/compass.tcl new file mode 100644 index 00000000..2822e1d8 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/compass.tcl @@ -0,0 +1,205 @@ + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set n_x [lindex $Compass($id) 1] + set n_y [lindex $Compass($id) 2] + set e_x [lindex $Compass($id) 3] + set e_y [lindex $Compass($id) 4] + set trans [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set n_x 0.0 ; set n_y 1.0 + set e_x 1.0 ; set e_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set trans 0 + set Compass($id) { 0.0 0.0 1.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($n_y,$n_x)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the graphics. + send imagewin setColorIndex $compassColor + send imagewin setFillType solid + + # Now draw the parts of the compass. + drawCompassAxes $n_x $n_y $e_x $e_y $trans $xflip $yflip $scale \ + $pcx $pcy + drawCompassLabels $n_x $n_y $e_x $e_y $trans $xflip $yflip $scale\ + $pcx $pcy $xlab $ylab + drawCompassPtr $n_x $n_y $e_x $e_y $trans $xflip $yflip $scale \ + $pcx $pcy $angle + + # Reset the logical resolution of the window. + send imagewin setLogRes $sv_xl $sv_yl + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc drawCompassAxes {n_x n_y e_x e_y trans xflip yflip scale pcx pcy} \ +{ + set cpoints { } + lappend cpoints [list $e_x $e_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $n_x $n_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($trans > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($trans > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + lappend pts $rx $ry + } + + # Draw the compass axes. + send imagewin drawPolyline $pts +} + +proc drawCompassLabels {n_x n_y e_x e_y trans xflip yflip scale pcx pcy xlab ylab} \ +{ + + set pts { } + set lpoints { } + + set xo [expr (0.2 * [expr "($xflip > 0) ? -1 : 1"])] + set yo [expr (0.2 * [expr "($yflip > 0) ? 1 : -1"])] + + lappend lpoints [list [expr "$e_x+$xo"] $e_y ] + lappend lpoints [list $n_x [expr "$n_y+$yo"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($trans > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($trans > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + lappend pts $rx $ry + } + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 0] [lindex $pts 1] $xlab + send imagewin drawAlphaText [lindex $pts 2] [lindex $pts 3] $ylab +} + +proc drawCompassPtr {n_x n_y e_x e_y trans xflip yflip scale pcx pcy angle} \ +{ + + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + + # Initialize the drawing points. + set pts {} + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($trans > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($trans > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($n_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($n_y - ($sx * $sino + $sy * $coso))] + + # Get the scaled position. + set sx [expr ($scale * $rx)] + set sy [expr ($scale * $ry)] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + lappend pts $rx $ry + } + + # Draw the compass pointer. + send imagewin drawPolygon $pts +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + diff --git a/vendor/x11iraf/ximtool/gui.bak/compass.tcl.bak b/vendor/x11iraf/ximtool/gui.bak/compass.tcl.bak new file mode 100644 index 00000000..761b99c3 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/compass.tcl.bak @@ -0,0 +1,195 @@ + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + diff --git a/vendor/x11iraf/ximtool/gui.bak/display.res b/vendor/x11iraf/ximtool/gui.bak/display.res new file mode 100644 index 00000000..2f3f47e2 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/display.res @@ -0,0 +1,451 @@ + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/func.tcl b/vendor/x11iraf/ximtool/gui.bak/func.tcl new file mode 100644 index 00000000..3f521a0f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/func.tcl @@ -0,0 +1,123 @@ + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/global.res b/vendor/x11iraf/ximtool/gui.bak/global.res new file mode 100644 index 00000000..59bb1e67 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/global.res @@ -0,0 +1,103 @@ + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: gray77 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: gray68 + *Text*background: gray68 + *AsciiText*background: gray68 + *TextBox.background: gray68 + *MultiList*background: gray68 + *Slider2d.thumbColor: gray77 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: gray77 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: gray90 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: gray77 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: gray61 + *SimpleMenu.line2.foreground: gray91 + *SimpleMenu.line3.foreground: gray61 + *SimpleMenu.line4.foreground: gray91 + *SimpleMenu.line5.foreground: gray61 + *SimpleMenu.line6.foreground: gray91 + *SimpleMenu.line7.foreground: gray61 + *SimpleMenu.line8.foreground: gray91 + *SimpleMenu.line9.foreground: gray61 + *SimpleMenu.line10.foreground: gray91 + *SimpleMenu.line11.foreground: gray61 + *SimpleMenu.line12.foreground: gray91 + *SimpleMenu.line13.foreground: gray61 + *SimpleMenu.line14.foreground: gray91 + *SimpleMenu.line15.foreground: gray61 + *SimpleMenu.line16.foreground: gray91 + *SimpleMenu.line17.foreground: gray61 + *SimpleMenu.line18.foreground: gray91 + *SimpleMenu.line19.foreground: gray61 + *SimpleMenu.line20.foreground: gray91 + *SimpleMenu.line21.foreground: gray61 + *SimpleMenu.line22.foreground: gray91 + *SimpleMenu.line23.foreground: gray61 + *SimpleMenu.line24.foreground: gray91 + *SimpleMenu.line25.foreground: gray61 + *SimpleMenu.line26.foreground: gray91 + *SimpleMenu.line27.foreground: gray61 + *SimpleMenu.line28.foreground: gray91 + *SimpleMenu.line29.foreground: gray61 + *SimpleMenu.line30.foreground: gray91 + *SimpleMenu.line31.foreground: gray61 + *SimpleMenu.line32.foreground: gray91 + *SimpleMenu.line33.foreground: gray61 + *SimpleMenu.line34.foreground: gray91 + *SimpleMenu.line35.foreground: gray61 + *SimpleMenu.line36.foreground: gray91 + *SimpleMenu.line37.foreground: gray61 + *SimpleMenu.line38.foreground: gray91 + *SimpleMenu.line39.foreground: gray61 + *SimpleMenu.line40.foreground: gray91 +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/global.tcl b/vendor/x11iraf/ximtool/gui.bak/global.tcl new file mode 100644 index 00000000..4908e752 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/global.tcl @@ -0,0 +1,147 @@ + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 1.3EXPORT" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/hdr.obj b/vendor/x11iraf/ximtool/gui.bak/hdr.obj new file mode 100644 index 00000000..5940a85a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/hdr.obj @@ -0,0 +1,36 @@ + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/hdr.res b/vendor/x11iraf/ximtool/gui.bak/hdr.res new file mode 100644 index 00000000..b0b96528 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/hdr.res @@ -0,0 +1,138 @@ + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: gray77 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: gray68 + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: gray77 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: gray77 + *hdrIGFrame.frameWidth: 0 +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/hdr.tcl b/vendor/x11iraf/ximtool/gui.bak/hdr.tcl new file mode 100644 index 00000000..4dc7489a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/hdr.tcl @@ -0,0 +1,105 @@ + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + diff --git a/vendor/x11iraf/ximtool/gui.bak/help.obj b/vendor/x11iraf/ximtool/gui.bak/help.obj new file mode 100644 index 00000000..36759f63 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/help.obj @@ -0,0 +1,27 @@ + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/help.res b/vendor/x11iraf/ximtool/gui.bak/help.res new file mode 100644 index 00000000..ca70390b --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/help.res @@ -0,0 +1,111 @@ + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: iraf@noao.edu (520) 318-8160 + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/help.tcl b/vendor/x11iraf/ximtool/gui.bak/help.tcl new file mode 100644 index 00000000..cc55e978 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/help.tcl @@ -0,0 +1,209 @@ + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + diff --git a/vendor/x11iraf/ximtool/gui.bak/imagewin.tcl b/vendor/x11iraf/ximtool/gui.bak/imagewin.tcl new file mode 100644 index 00000000..5969ac6c --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/imagewin.tcl @@ -0,0 +1,1123 @@ + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client windowColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} diff --git a/vendor/x11iraf/ximtool/gui.bak/info.res b/vendor/x11iraf/ximtool/gui.bak/info.res new file mode 100644 index 00000000..227681fb --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/info.res @@ -0,0 +1,58 @@ + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: gray77 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/info.tcl b/vendor/x11iraf/ximtool/gui.bak/info.tcl new file mode 100644 index 00000000..3f0e89fc --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/info.tcl @@ -0,0 +1,86 @@ + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + diff --git a/vendor/x11iraf/ximtool/gui.bak/ism.tcl b/vendor/x11iraf/ximtool/gui.bak/ism.tcl new file mode 100644 index 00000000..e0947d90 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/ism.tcl @@ -0,0 +1,423 @@ + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "<pre>%s\n%s</pre>" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2]} + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/ism.tcl.bak b/vendor/x11iraf/ximtool/gui.bak/ism.tcl.bak new file mode 100644 index 00000000..4dd43305 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/ism.tcl.bak @@ -0,0 +1,411 @@ + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +set Compass(0) { 0.0 1 1 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "<pre>%s\n%s</pre>" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2]} + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + set transpose [lindex $argv 4] + set xlab [lindex $argv 5] + set ylab [lindex $argv 6] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/load.res b/vendor/x11iraf/ximtool/gui.bak/load.res new file mode 100644 index 00000000..6686f5c4 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/load.res @@ -0,0 +1,173 @@ + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/load.tcl b/vendor/x11iraf/ximtool/gui.bak/load.tcl new file mode 100644 index 00000000..425f0226 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/load.tcl @@ -0,0 +1,247 @@ + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/magnifier.tcl b/vendor/x11iraf/ximtool/gui.bak/magnifier.tcl new file mode 100644 index 00000000..74e43f94 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/magnifier.tcl @@ -0,0 +1,576 @@ + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(magzoomMenu) + <Btn3Up>: popdown(magzoomMenu) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/main-old.obj b/vendor/x11iraf/ximtool/gui.bak/main-old.obj new file mode 100644 index 00000000..87617b81 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/main-old.obj @@ -0,0 +1,51 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL.GUI -- Default GUI for the Ximtool image display server. +# +# Version 1.3 -- EXPORT VERSION + + +set Version "NOAO/IRAF XImtool Version 1.3EXPORT" + + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display \ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar Label imageTitle \ + menubar Toggle controlButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/main-old.res b/vendor/x11iraf/ximtool/gui.bak/main-old.res new file mode 100644 index 00000000..70d95cc0 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/main-old.res @@ -0,0 +1,422 @@ + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.foreground: Black + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: Black + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: Black + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: Black + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 0 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + -2 \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + vcutFrame < * +inf -inf > \ + } \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 plotOpts -4 } \ + } \ + horizontal { \ + cbarFrame < +inf -inf * > \ + hcut 2 vcut \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 0 + *hcutFrame.outerOffset: 0 + *hcutPlot.color0: gray77 + *hcutPlot.color1: black + *hcutPlot.color0: darkslategray + *hcutPlot.color1: ivory2 + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 5 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + *vcutPlot.color0: gray77 + *vcutPlot.color1: black + *vcutPlot.color0: darkslategray + *vcutPlot.color1: ivory2 + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 5 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 40 + *menuGroup.width: 518 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + controlButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: white + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 518 + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 518 + *imageFrame.height: 518 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 518 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.color8: #7c8498 + *imagewin.color9: steelblue + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>Left: call(moveFrame,-1,0) \n\ + !Ctrl <Key>Down: call(moveFrame,0,1) \n\ + !Ctrl <Key>Up: call(moveFrame,0,-1) \n\ + !Ctrl <Key>Right: call(moveFrame,1,0) \n\ + !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \n\ + !Ctrl <Key>a: call(toggleAutoReg) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>o: call(offset,$x,$y) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl <Key>\[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl <Key>\]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl <Key>0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift<Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \n\ + !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.borderWidth: 0 + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 50 + *colorbar.height: 17 +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/main.obj b/vendor/x11iraf/ximtool/gui.bak/main.obj new file mode 100644 index 00000000..c866908f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/main.obj @@ -0,0 +1,85 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL-ALT.GUI -- Default GUI for the Ximtool-alt image display server. +# +# Version 1.3 -- EXPORT VERSION + +set Version "NOAO/IRAF XImtool Version 1.3EXPORT" + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display\ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton\ + menubar MenuButton viewButton\ + menubar MenuButton optionsButton\ + menubar Label imageTitle\ + menubar Toggle mXflipButton\ + menubar Toggle mYflipButton\ + menubar Command mPrevButton\ + menubar MenuButton mFrameButton\ + menubar Command mNextButton\ + menubar Toggle toolButton\ + menubar Toggle panelButton\ +\ + display Layout toolbar\ + toolbar Command tbZoomIn\ + toolbar Command tbZoom0\ + toolbar Command tbZoomOut\ + toolbar Command tbInvert\ + toolbar Command tbNormalize\ + toolbar Command tbMatchLUT\ + toolbar Toggle tbAutoReg\ + toolbar Command tbRegister\ + toolbar Command tbCenter\ + toolbar Command tbBlinkDec\ + toolbar Toggle tbBlink\ + toolbar Command tbBlinkInc\ + toolbar Toggle xflipButton\ + toolbar Toggle yflipButton\ + toolbar Toggle tbTile\ + toolbar Toggle tbCompass\ + toolbar Command prevButton\ + toolbar MenuButton frameButton\ + toolbar Command nextButton\ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +\ + display Layout panelbar\ + panelbar Toggle pbDisplayP\ + panelbar Toggle pbLoadP\ + panelbar Toggle pbSaveP\ + panelbar Toggle pbPrintP\ + panelbar Toggle pbInfoP\ + panelbar Toggle pbTileP\ + panelbar Toggle pbCoordP\ + panelbar Toggle pbPanM\ + panelbar Toggle pbMagM\ + panelbar Toggle pbWcsM\ + panelbar Toggle pbIsm\ + panelbar Toggle helpButton\ + panelbar Command pbQuit\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/main.res b/vendor/x11iraf/ximtool/gui.bak/main.res new file mode 100644 index 00000000..3f1ccb84 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/main.res @@ -0,0 +1,521 @@ + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: White + *rulerMenu.foreground: White + *display.imagewin.markerMenu.foreground: White + *display.imagewin.rulerMenu.foreground: White + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: White + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: White + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerColor.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: White + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: White + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 0 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + horizontal { 1 toolbar < +inf -inf * > 1 } \ + 1 < -1 > \ + horizontal { 1 panelbar < +inf -inf * > 1 } \ + 1 < -1 > \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + vcutFrame < * +inf -inf > \ + } \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 plotOpts -4 } \ + } \ + horizontal { \ + cbarFrame < +inf -inf * > \ + hcut 2 vcut \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 0 + *hcutFrame.outerOffset: 0 + *hcutPlot.color0: gray77 + *hcutPlot.color1: black + *hcutPlot.color0: darkslategray + *hcutPlot.color1: ivory2 + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 5 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + *vcutPlot.color0: gray77 + *vcutPlot.color1: black + *vcutPlot.color0: darkslategray + *vcutPlot.color1: ivory2 + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 5 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 40 + *menuGroup.width: 518 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 2 < -2 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + mXflipButton 1 < -1 > mYflipButton \ + 1 < -1 > \ + mPrevButton 1 < -1 > mFrameButton 1 < -1 > mNextButton \ + 1 < -1 > \ + toolButton 1 < -1 > panelButton \ + 2 < -2 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: White + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *menubar.width: 518 + *menubar*borderWidth: 0 + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *toolbar.layout: horizontal { \ + tbZoomIn < +inf -inf * > 1 < -1 > \ + tbZoom0 < +inf -inf * > 1 < -1 > \ + tbZoomOut < +inf -inf * > 1 < -1 > \ + tbInvert < +inf -inf * > 1 < -1 > \ + tbNormalize < +inf -inf * > 1 < -1 > \ + tbMatchLUT < +inf -inf * > 1 < -1 > \ + tbAutoReg < +inf -inf * > 1 < -1 > \ + tbRegister < +inf -inf * > 1 < -1 > \ + tbCenter < +inf -inf * > 1 < -1 > \ + tbBlinkDec < +inf -inf * > 1 < -1 > \ + tbBlink < +inf -inf * > 1 < -1 > \ + tbBlinkInc < +inf -inf * > 1 < -1 > \ + xflipButton < +inf -inf * > 1 < -1 > \ + yflipButton < +inf -inf * > 1 < -1 > \ + tbCompass < +inf -inf * > 1 < -1 > \ + tbTile < +inf -inf * > 1 < -1 > \ + prevButton < +inf -inf * > 1 < -1 > \ + frameButton < +inf -inf * > 1 < -1 > \ + nextButton < +inf -inf * > 1 < -1 > \ + } + *toolbar.width: 518 + *toolbar.height: 25 + *toolbar*borderWidth: 0 + *toolbar*Command.internalWidth: 3 + *toolbar*Command.borderWidth: 0 + *toolbar*Toggle.internalWidth: 2 + *toolbar*Toggle.borderWidth: 0 + + *panelbar.layout: horizontal { \ + pbDisplayP < +inf -inf * > 1 < -1 > \ + pbPrintP < +inf -inf * > 1 < -1 > \ + pbLoadP < +inf -inf * > 1 < -1 > \ + pbSaveP < +inf -inf * > 1 < -1 > \ + pbInfoP < +inf -inf * > 1 < -1 > \ + pbTileP < +inf -inf * > 1 < -1 > \ + pbCoordP < +inf -inf * > 1 < -1 > \ + pbPanM < +inf -inf * > 1 < -1 > \ + pbMagM < +inf -inf * > 1 < -1 > \ + pbWcsM < +inf -inf * > 1 < -1 > \ + pbIsm < +inf -inf * > 1 < -1 > \ + helpButton < +inf -inf * > 1 < -1 > \ + pbQuit < +inf -inf * > 1 < -1 > \ + } + *panelbar*SimpleMenu.borderColor: Black + *panelbar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *panelbar.width: 12 + *panelbar.height: 25 + *panelbar*borderWidth: 0 + *panelbar*Label.internalWidth: 4 + *panelbar*Label.borderWidth: 0 + *panelbar*Command.internalWidth: 4 + *panelbar*Command.borderWidth: 0 + *panelbar*Toggle.internalWidth: 3 + *panelbar*Toggle.borderWidth: 0 + + *pbLoadP.label: Load + *pbDisplayP.label: Display + *pbSaveP.label: Save + *pbPrintP.label: Print + *pbInfoP.label: Info + *pbTileP.label: Tile + *pbCoordP.label: Coords + *pbPanM.label: Pan + *pbPanM.state: 1 + *pbMagM.label: Mag + *pbMagM.state: 0 + *pbWcsM.label: WCS + *pbWcsM.state: 1 + *pbIsm.label: ISM + *pbIsm.state: 0 + *helpButton.label: + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *toolButton.label: + *toolButton.state: 0 + *panelButton.label: + *panelButton.state: 0 + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + *mFrameButton.menuName: mFrameMenu + *mFrameButton.label: 1 + *mFrameButton.width: 20 + *pbQuit.label: Quit + *tbZoom0.label: Mag + *tbBlink.label: Blink + *tbBlink.internalWidth: 3 + *tbCenter.label: Cntr + *tbAutoReg.label: AReg + *tbRegister.label: Reg + *tbInvert.label: Inv + *tbNormalize.label: Norm + *tbMatchLUT.label: Match + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *panelbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *toolbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 518 + *imageFrame.height: 518 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 518 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.idleCursor: crosshair + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.color8: #7c8498 + *imagewin.color9: SteelBlue + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Ctrl <Key>Left: call(moveFrame,-1,0) \n\ + !Ctrl <Key>Down: call(moveFrame,0,1) \n\ + !Ctrl <Key>Up: call(moveFrame,0,-1) \n\ + !Ctrl <Key>Right: call(moveFrame,1,0) \n\ + !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>a: call(tbToggleAutoReg) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>o: call(offset,$x,$y) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tbTileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl <Key>\[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl <Key>\]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl <Key>0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !Shift<Btn1Down>: call(setDynamicMagnifier,1) \n\ + !Shift<Btn1Up>: call(setDynamicMagnifier,0) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift <Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \n\ + !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.height: 17 + *colorbar.width: 50 + *colorbar.borderWidth: 0 +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/mkgui b/vendor/x11iraf/ximtool/gui.bak/mkgui new file mode 100755 index 00000000..76f9f288 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/mkgui @@ -0,0 +1,81 @@ +#!/bin/csh -f + +set old = 0 +set file = ximtool.gui + +old: + +echo -n "Building $file ..." +if ($old == 0) then + cat main.obj > $file +else + cat main-old.obj > $file +endif +cat panel.obj >> $file +cat param.obj >> $file +cat help.obj >> $file +cat blink.obj >> $file +cat hdr.obj >> $file +cat pixtab.obj >> $file +cat tcl.obj >> $file +cat warn.obj >> $file + +cat global.res >> $file +if ($old == 0) then + cat main.res >> $file +else + cat main-old.res >> $file +endif +cat panel.res >> $file +cat display.res >> $file +cat print.res >> $file +cat info.res >> $file +cat load.res >> $file +cat save.res >> $file +cat tile.res >> $file +cat wcs.res >> $file +cat blink.res >> $file +cat hdr.res >> $file +cat pixtab.res >> $file +cat help.res >> $file +cat tcl.res >> $file +cat warn.res >> $file +cat resources.res >> $file + +cat boot.tcl >> $file +cat global.tcl >> $file +cat plots.tcl >> $file +cat imagewin.tcl >> $file +cat func.tcl >> $file +cat panel.tcl >> $file +cat magnifier.tcl >> $file +cat panner.tcl >> $file +cat print.tcl >> $file +cat info.tcl >> $file +cat load.tcl >> $file +cat save.tcl >> $file +cat tile.tcl >> $file +cat wcs.tcl >> $file +cat compass.tcl >> $file +cat rulers.tcl >> $file +cat help.tcl >> $file +cat hdr.tcl >> $file +cat pixtab.tcl >> $file +cat warn.tcl >> $file +cat tcl.tcl >> $file +cat ism.tcl >> $file +if ($old == 0) then + cat toolbars.tcl >> $file +endif + +echo "Done" + +if ($old == 0) then + set old = 1 + set file = ximtool-old.gui + goto old +endif + +echo -n "Installing files ..." +mv *.gui ../ +echo "Done" diff --git a/vendor/x11iraf/ximtool/gui.bak/panel.obj b/vendor/x11iraf/ximtool/gui.bak/panel.obj new file mode 100644 index 00000000..26157cef --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/panel.obj @@ -0,0 +1,412 @@ + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/panel.res b/vendor/x11iraf/ximtool/gui.bak/panel.res new file mode 100644 index 00000000..52e27826 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/panel.res @@ -0,0 +1,69 @@ + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/panel.tcl b/vendor/x11iraf/ximtool/gui.bak/panel.tcl new file mode 100644 index 00000000..0c873862 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/panel.tcl @@ -0,0 +1,833 @@ + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $widget set state 0 + set panel_up 0 + return + } + + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/panner.tcl b/vendor/x11iraf/ximtool/gui.bak/panner.tcl new file mode 100644 index 00000000..6bdea0c7 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/panner.tcl @@ -0,0 +1,535 @@ + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn2Up>: call(pannerPanXY,$x,$y) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>s: call(cpMatchFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + diff --git a/vendor/x11iraf/ximtool/gui.bak/param.obj b/vendor/x11iraf/ximtool/gui.bak/param.obj new file mode 100644 index 00000000..b9a2d734 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/param.obj @@ -0,0 +1,32 @@ + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/pixtab.obj b/vendor/x11iraf/ximtool/gui.bak/pixtab.obj new file mode 100644 index 00000000..1da660a2 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/pixtab.obj @@ -0,0 +1,30 @@ + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/pixtab.res b/vendor/x11iraf/ximtool/gui.bak/pixtab.res new file mode 100644 index 00000000..b41296c7 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/pixtab.res @@ -0,0 +1,128 @@ + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: gray77 + *pixtabFrame*MultiList.background: gray77 + *pixtabFrame*TextToggle.background: gray77 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/pixtab.tcl b/vendor/x11iraf/ximtool/gui.bak/pixtab.tcl new file mode 100644 index 00000000..d23827c9 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/pixtab.tcl @@ -0,0 +1,144 @@ + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + diff --git a/vendor/x11iraf/ximtool/gui.bak/plots.tcl b/vendor/x11iraf/ximtool/gui.bak/plots.tcl new file mode 100644 index 00000000..c4abd426 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/plots.tcl @@ -0,0 +1,659 @@ + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos + + catch { + if {$doHcut} { plotHcut $xpos $ypos } + if {$doVcut} { plotVcut $xpos $ypos } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/print.res b/vendor/x11iraf/ximtool/gui.bak/print.res new file mode 100644 index 00000000..aa88bd37 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/print.res @@ -0,0 +1,304 @@ + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/print.tcl b/vendor/x11iraf/ximtool/gui.bak/print.tcl new file mode 100644 index 00000000..983d2a15 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/print.tcl @@ -0,0 +1,342 @@ + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + diff --git a/vendor/x11iraf/ximtool/gui.bak/resources.res b/vendor/x11iraf/ximtool/gui.bak/resources.res new file mode 100644 index 00000000..201e2e16 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/resources.res @@ -0,0 +1,26 @@ + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + diff --git a/vendor/x11iraf/ximtool/gui.bak/rulers.tcl b/vendor/x11iraf/ximtool/gui.bak/rulers.tcl new file mode 100644 index 00000000..98f30a0f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/rulers.tcl @@ -0,0 +1,524 @@ + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: call(deleteNamedRuler,NAME,$x,$y) + <Key>Delete: call(deleteNamedRuler,NAME,$x,$y) + <KeyPress>: m_input() + <Btn3Down>: call(setRulerMenu) popup(rulerMenu) + <Btn3Up>: popdown(rulerMenu) +!Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + diff --git a/vendor/x11iraf/ximtool/gui.bak/save.res b/vendor/x11iraf/ximtool/gui.bak/save.res new file mode 100644 index 00000000..81c45ace --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/save.res @@ -0,0 +1,143 @@ + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/save.tcl b/vendor/x11iraf/ximtool/gui.bak/save.tcl new file mode 100644 index 00000000..36706d31 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/save.tcl @@ -0,0 +1,156 @@ + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + diff --git a/vendor/x11iraf/ximtool/gui.bak/tcl.obj b/vendor/x11iraf/ximtool/gui.bak/tcl.obj new file mode 100644 index 00000000..3bea2d87 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/tcl.obj @@ -0,0 +1,13 @@ + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/tcl.res b/vendor/x11iraf/ximtool/gui.bak/tcl.res new file mode 100644 index 00000000..6c250bc7 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/tcl.res @@ -0,0 +1,44 @@ +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/tcl.tcl b/vendor/x11iraf/ximtool/gui.bak/tcl.tcl new file mode 100644 index 00000000..44d5e04e --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/tcl.tcl @@ -0,0 +1,36 @@ + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { send tcl_panel unmap } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + diff --git a/vendor/x11iraf/ximtool/gui.bak/tile.res b/vendor/x11iraf/ximtool/gui.bak/tile.res new file mode 100644 index 00000000..29390013 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/tile.res @@ -0,0 +1,149 @@ + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: gray77 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: gray68 + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: gray68 + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/tile.tcl b/vendor/x11iraf/ximtool/gui.bak/tile.tcl new file mode 100644 index 00000000..279475ab --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/tile.tcl @@ -0,0 +1,214 @@ + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False diff --git a/vendor/x11iraf/ximtool/gui.bak/toolbars.tcl b/vendor/x11iraf/ximtool/gui.bak/toolbars.tcl new file mode 100644 index 00000000..626b93e3 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/toolbars.tcl @@ -0,0 +1,555 @@ + + +################################################################################ +# +# XIMTOOL-ALT -- Procedures and declarations for the ALT GUI. +# +################################################################################ + +# Creat the bitmaps needed for the alternate optional bars. + +createBitmap tools 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, + 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap control 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xe3, 0xc7, 0xe3, 0xcf, 0x33, 0xcc, + 0x33, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x33, 0xcc, 0xf3, 0xcf, + 0xe3, 0xc7, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap tile 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff}; + +createBitmap compass 16 16 { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x80, 0x0f, 0xc0, 0x1f, 0x00, 0x07, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0xfc, 0x07, + 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00} + +createBitmap plus 11 11 { + 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00}; + +createBitmap minus 11 11 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap disk 16 16 { + 0xfe,0x1f,0x11,0x25,0x11,0x45,0x11,0x44,0xf1,0x47,0x01,0x40,0x01,0x40,0xf9, + 0x4f,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0xff,0x7f, + 0x00,0x00}; + +createBitmap printer 32 16 { + 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x12, 0x00, + 0x00, 0x02, 0x22, 0x00, 0x00, 0x02, 0x3e, 0x00, 0x00, 0x02, 0x20, 0x00, + 0x00, 0x02, 0x20, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0x10, 0x03, 0xe0, 0x06, + 0x08, 0xff, 0x7f, 0x09, 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, + 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x08, + 0xf8, 0xff, 0xff, 0x0f}; + + +send tbBlinkDec "set bitmap larrow" ;# Assign the bitmaps to the buttons. +send tbBlinkInc "set bitmap rarrow" +send tbZoomIn "set bitmap plus" +send tbZoomOut "set bitmap minus" +send tbTile "set bitmap tile" +send tbCompass "set bitmap compass; addCallback toggleCompass" +#send helpButton "set bitmap qmark; addCallback Help" +send mXflipButton "set bitmap xflip; addCallback xflip" +send mYflipButton "set bitmap yflip; addCallback yflip" +send mNextButton "set bitmap rarrow; addCallback nextFrame" +send mPrevButton "set bitmap larrow; addCallback prevFrame" + + +# toolBox -- Toggle the toolbox and panelbar display. + +set toolbox_up [ true $showToolBar ] +set panelbar_up [ true $showPanelBar ] + +proc toolBoxToggle args \ +{ + global toolbox_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$toolbox_up} { + send toolbar set height 0 + send toolButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w; set height $nh" + set toolbox_up 0 + send mXflipButton map + send mYflipButton map + send mPrevButton map + send mFrameButton map + send mNextButton map + } else { + send toolbar set height 25 + send toolButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set toolbox_up 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap + } +} + +proc panelBarToggle args \ +{ + global panelbar_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$panelbar_up} { + send panelbar set height 0 + send panelButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w ; set height $nh" + set panelbar_up 0 + } else { + send panelbar set height 25 + send panelButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set panelbar_up 1 + } +} + + + +# Initialize the bars to be displayed if the resource was set. + +send toolButton "set bitmap tools; addCallback toolBoxToggle" +if { ! [ true $showToolBar ] } { + send display set height [expr [send display get height] - 25] + send toolbar set height 0 + send toolButton set state 0 +} else { + send toolButton set state 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap +} + +send panelButton "deleteCallback panel" +send panelButton "set bitmap control; addCallback panelBarToggle" + +if { ! [ true $showPanelBar ] } { + send display set height [expr [send display get height] - 25] + send panelbar set height 0 + send panelButton set state 0 +} else { + send panelButton set state 1 +} + + +############################################## +# Panelbar callbacks. +############################################## + +send pbQuit addCallback Quit +send helpClose addCallback "send helpButton set state 0" + + +# Control Panel. +#------------------------------------------------------ +proc pbToggleControl {name element op} \ +{ + upvar $name panel_up + send pbDisplayP set state [expr !($panel_up)] +} ; #trace variable panel_up w pbToggleControl + +proc pbResetPanel {param old new} \ +{ + global displayPanner displayMagnifier displayCoords + switch $new { + done { send pbPanM set state [true $displayPanner] + send pbMagM set state [true $displayMagnifier] + send pbWcsM set state [true $displayCoords] + } + } +} ; send initialize addCallback pbResetPanel + +set WidgetToTab(pbDisplayP) display_panel +set WidgetToTab(pbInfoP) info_panel +set WidgetToTab(pbLoadP) load_panel +set WidgetToTab(pbPrintP) print_panel +set WidgetToTab(pbSaveP) save_panel +set WidgetToTab(pbTileP) tile_panel +set WidgetToTab(pbCoordP) wcs_panel + +set TabToWidget(display_panel) pbDisplayP +set TabToWidget(print_panel) pbPrintP +set TabToWidget(load_panel) pbLoadP +set TabToWidget(save_panel) pbSaveP +set TabToWidget(info_panel) pbInfoP +set TabToWidget(tile_panel) pbTileP +set TabToWidget(wcs_panel) pbCoordP + +set pbTabTop "pbDisplayP" + +proc pbPanelDismiss args \ +{ + global tabTop TabToWidget WidgetToTab + set panel $TabToWidget($tabTop) + send $panel set state 0 +} ; send panelClose addCallback pbPanelDismiss + +proc pbResizeCB {widget event a b c d e args} \ +{ + global pbTabTop TabToWidget WidgetToTab + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + send $pbTabTop set state 0 + set new $TabToWidget($widget) + send $new set state 1 + set pbTabTop $new + } +} ; foreach w $cpTabs {send $w addEventHandler pbResizeCB exposureMask} + +proc pbPanelTabs { widget type state args } \ +{ + global pbTabTop tabTop panel_up + global TabToWidget WidgetToTab + + set panel $WidgetToTab($widget) + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $widget set state 0 + set panel_up 0 + return + } + + send $TabToWidget($tabTop) set state 0 + set tabTop $panel + set pbTabTop $TabToWidget($panel) + send panelTabs setTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send $widget set state 1 + send panelShell map + set panel_up 1 + } +} +foreach w { pbDisplayP pbInfoP pbLoadP pbPrintP pbSaveP pbTileP pbCoordP } { + send $w addCallback pbPanelTabs +} + + + +# Load Panel. (Really need to clean this up.) +#------------------------------------------------------ +proc pbDoLoadOptions { param old new } \ +{ + set val [ join [lrange $new 1 end] " " ] + switch [lindex $new 0] { + newfile { send fnameText set string $val } + } +} ; send loadOptions addCallback pbDoLoadOptions + +proc pbFileLoad { widget mode fname args } \ +{ + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + send imagewin setCursorType idle +} ; send fnameText addCallback pbFileLoad + +proc pbflSelectPrint {widget cbtype selections args} \ +{ + foreach selection $selections { + ; + } +}; #send imageList addCallback pbflSelectPrint + +proc pbFileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname != ""} { + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + } +} ; send filesLoadButton addCallback pbFileLoadB + + +# Panner Marker. +#------------------------------------------------------ +proc pbTracePanner {name element op} \ +{ + global last_compass + + catch { + upvar $name panner_enable + send pbPanM set state $panner_enable + + if { $panner_enable } { + send tbCompass "setSensitive True ; set state $last_compass" + drawCompass + } else { + send tbCompass "setSensitive False ; set state False" + eraseCompass + } + } +} ; trace variable panner_enable w pbTracePanner + +proc pannerPanel args \ +{ + global panner_enable displayPanner + + setPanner [expr !$panner_enable] + send pannerButton set on [expr $panner_enable] +}; send pbPanM addCallback pannerPanel + + +# Magnifier Marker. +#------------------------------------------------------ +proc pbTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send pbMagM set state $magnifier_enable +} ; trace variable magnifier_enable w pbTraceMagnifier + +proc magnifierPanel args \ +{ + global magnifier_enable displayMagnifier + setMagnifier [expr !$magnifier_enable] + send magnifierButton set on [expr $magnifier_enable] +}; send pbMagM addCallback magnifierPanel + + +# CoordsBox Marker. +#------------------------------------------------------ +proc pbTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send pbWcsM set state $track_enable +} ; trace variable track_enable w pbTraceCoordsBox + +proc wcsPanel args \ +{ + global track_enable + setTrack [expr !$track_enable] +}; send pbWcsM addCallback wcsPanel + + + +# WPIX ISM Callbacks. +#------------------------------------------------------ + +proc altIsmToggle { widget type state args } \ +{ + ismToggle pbIsm junk $state +} ; send pbIsm addCallback altIsmToggle + +proc pbTraceIsm {name element op} \ +{ + upvar $name ism_enable + send pbIsm set state $ism_enable +} ; trace variable ism_enable w pbTraceIsm + + +proc altIsmMsgCB { param old new } \ +{ + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + deliver { ${ism}_alt_msg $argc $argv } + } +} ; send ism_msg addCallback altIsmMsgCB + + +proc wcspix_alt_msg { argc argv } \ +{ + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + switch $cmd { + startup { } + shutdown { } + disable { send pbIsm "set state False ; setSensitive False" } + capable { send pbIsm "setSensitive True" } + } +} + + + +############################################## +# Toolbar callbacks. +############################################## + +send tbNormalize addCallback normalize +send tbInvert addCallback cpInvert +send tbRegister addCallback cpRegisterFrames +send tbMatchLUT addCallback cpMatchFrames + + +# Frame Selection. +#------------------ +createMenu mFrameMenu mFrameButton $frameMenuDescription + +proc altFrameChanged {param old new} \ +{ + send mFrameButton set label $new +} ; send frame addCallback altFrameChanged + + +# Image Flipping. +#------------------------------------------------------ +proc tbSetFlip {param old new} \ +{ + if {$param == "xflip"} { + send mXflipButton set state [true $new] + } else { + send mYflipButton set state [true $new] + } +}; foreach i {xflip yflip} { send $i addCallback tbSetFlip } + + +# Zoom/Pan buttons. +#------------------------------------------------------ +proc tbZoomAction { widget args } \ +{ + global frameWidth frameHeight + + switch $widget { + tbZoom0 { cpZoom 1 1 fixed } + tbZoomIn { cpZoom 2.0 2.0 relative } + tbZoomOut { cpZoom 0.5 0.5 relative } + tbCenter { send client pan [expr $frameWidth/2.0] [expr $frameHeight/2.0] } + } +} +foreach widget { tbCenter tbZoomIn tbZoom0 tbZoomOut } { + send $widget addCallback tbZoomAction +} + + +# Frame Blink. +#------------------------------------------------------ +proc tbSetBlinkRate {w args} \ +{ + if {$w == "tbBlinkInc"} { + cpSetBlinkRate BRincrease + } else { + cpSetBlinkRate BRdeccrease + } +} +foreach w {tbBlinkDec tbBlinkInc} { send $w addCallback tbSetBlinkRate } + +proc tbBlink { widget args } \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send tbBlink set state 0 + } else { + if {$widget != "tbBlink"} { + if {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } + } else { + if {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } + } + } +} ; send tbBlink addCallback tbBlink + +proc tbTraceBlink {name element op} \ +{ + upvar $name blinkId + send tbBlink set state [expr $blinkId != 0] +} ; trace variable blinkId w tbTraceBlink + + +# Auto-register. +#------------------------------------------------------ +proc tbAutoRegister { widget type state args } \ +{ + send tbAutoReg set state $state +} +foreach w {autoregButton brAregButton tbAutoReg} { + send $w addCallback cpAutoRegister +} + +proc tbToggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + + +# Frame Tiles. +#------------------------------------------------------ +proc tbSetTileFrames args \ +{ + global tileOpt + + # Send the option to the client. + if {[send tbTile get state ]} { + if {$tileOpt == 0} { + # If mode is disabled, turn on the tile selection. + selectTileOrientation junk junk Best + } else { + # Otherwise, turn on in current mode. + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } + } else { + selectTileOrientation junk junk Disabled + } +}; send tbTile addCallback tbSetTileFrames + +proc tbTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] + send tbTile set state $new +}; send tileFrames addCallback tbTrackTileFrames + +proc tbTileFramesToggle args \ +{ + set value [send tileFramesButton get on] + if {$value} { set not 0 } else { set not 1 } + + send tileFramesButton set on [expr $not] + send tbTile set on [expr $not] + cpSetTileFrames +} + + +# Compass Indicator. +#------------------------------------------------------ +proc tbToggleCompass { widget type state args } \ +{ + global frame + + if {$state} { + send compass set on True + send tbCompass set state 1 + drawCompass + } else { + send compass set on False + send tbCompass set state 0 + eraseCompass + } +} ; foreach w {compass tbCompass} { send $w addCallback tbToggleCompass } + + diff --git a/vendor/x11iraf/ximtool/gui.bak/warn.obj b/vendor/x11iraf/ximtool/gui.bak/warn.obj new file mode 100644 index 00000000..51c617e0 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/warn.obj @@ -0,0 +1,12 @@ + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/warn.res b/vendor/x11iraf/ximtool/gui.bak/warn.res new file mode 100644 index 00000000..e1608938 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/warn.res @@ -0,0 +1,49 @@ + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: gray77 +} + + + diff --git a/vendor/x11iraf/ximtool/gui.bak/warn.tcl b/vendor/x11iraf/ximtool/gui.bak/warn.tcl new file mode 100644 index 00000000..e0465bc3 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/warn.tcl @@ -0,0 +1,49 @@ + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + diff --git a/vendor/x11iraf/ximtool/gui.bak/wcs.res b/vendor/x11iraf/ximtool/gui.bak/wcs.res new file mode 100644 index 00000000..0f9ec8d5 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/wcs.res @@ -0,0 +1,212 @@ + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + diff --git a/vendor/x11iraf/ximtool/gui.bak/wcs.tcl b/vendor/x11iraf/ximtool/gui.bak/wcs.tcl new file mode 100644 index 00000000..8b14db4f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/wcs.tcl @@ -0,0 +1,464 @@ + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + diff --git a/vendor/x11iraf/ximtool/gui.bak/zztest b/vendor/x11iraf/ximtool/gui.bak/zztest new file mode 100644 index 00000000..c7eabfe1 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui.bak/zztest @@ -0,0 +1,56 @@ + +# Test to see if we can create a new panel. +appExtend { + *test_objects:\ + toplevel TopLevelShell testPanel\ + testPanel Form testForm\ + testForm Label testLabel\ + testForm Command testQuit + + *testPanel.geometry: 250x40 + *testLabel.label: Hello, world! + *testQuit.fromHoriz: testLabel + *testQuit.label: Quit +} +createObjects test_objects + + +#------------------------------------------------------------------------------ +# Test to see if we can add a widget to an existing widget tree, i.e. create +# a widget and assign an existing parent. Try adding a new button to the +# ximtool panelbar. + +appExtend { + *par_objects:\ + panelbar Toggle pbTest + + *pbTest.label: TESTING +} +createObjects par_objects + +# change the layout to include the new widget. +#send panelbar unmap +send panelbar set layout "horizontal \{ \ + pbTest < +inf -inf * > 1 < -1 > \ + pbDisplayP < +inf -inf * > 1 < -1 > \ + pbPrintP < +inf -inf * > 1 < -1 > \ + pbLoadP < +inf -inf * > 1 < -1 > \ + pbSaveP < +inf -inf * > 1 < -1 > \ + pbInfoP < +inf -inf * > 1 < -1 > \ + pbTileP < +inf -inf * > 1 < -1 > \ + pbCoordP < +inf -inf * > 1 < -1 > \ + pbPanM < +inf -inf * > 1 < -1 > \ + pbMagM < +inf -inf * > 1 < -1 > \ + pbWcsM < +inf -inf * > 1 < -1 > \ + pbIsm < +inf -inf * > 1 < -1 > \ + helpButton < +inf -inf * > 1 < -1 > \ + pbQuit < +inf -inf * > 1 < -1 > \ + \}" +#send panelbar map + +# Do the callbacks +proc testToggle { widget type state args } \ +{ + if {$state} { send testPanel map } else { send testPanel unmap } +} ; send pbTest addCallback testToggle +send testQuit addCallback "send testPanel unmap; send pbTest set state False" diff --git a/vendor/x11iraf/ximtool/gui/blink.obj b/vendor/x11iraf/ximtool/gui/blink.obj new file mode 100644 index 00000000..dfae6861 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/blink.obj @@ -0,0 +1,46 @@ + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + diff --git a/vendor/x11iraf/ximtool/gui/blink.res b/vendor/x11iraf/ximtool/gui/blink.res new file mode 100644 index 00000000..311bad2a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/blink.res @@ -0,0 +1,167 @@ + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + diff --git a/vendor/x11iraf/ximtool/gui/boot.tcl b/vendor/x11iraf/ximtool/gui/boot.tcl new file mode 100644 index 00000000..936273a5 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/boot.tcl @@ -0,0 +1,74 @@ + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + diff --git a/vendor/x11iraf/ximtool/gui/compass.tcl b/vendor/x11iraf/ximtool/gui/compass.tcl new file mode 100644 index 00000000..13f5bed8 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/compass.tcl @@ -0,0 +1,215 @@ + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +# This is a kludge to redraw the compass after it is erased when displaying +# a new image. Once the user moves the mouse back into the main window we'll +# do the redraw. +send imagewin addEventHandler drawCompass enterWindowMask + + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + diff --git a/vendor/x11iraf/ximtool/gui/compass.tcl.bak b/vendor/x11iraf/ximtool/gui/compass.tcl.bak new file mode 100644 index 00000000..761b99c3 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/compass.tcl.bak @@ -0,0 +1,195 @@ + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + diff --git a/vendor/x11iraf/ximtool/gui/compass.tcl.new b/vendor/x11iraf/ximtool/gui/compass.tcl.new new file mode 100644 index 00000000..2822e1d8 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/compass.tcl.new @@ -0,0 +1,205 @@ + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set n_x [lindex $Compass($id) 1] + set n_y [lindex $Compass($id) 2] + set e_x [lindex $Compass($id) 3] + set e_y [lindex $Compass($id) 4] + set trans [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set n_x 0.0 ; set n_y 1.0 + set e_x 1.0 ; set e_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set trans 0 + set Compass($id) { 0.0 0.0 1.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($n_y,$n_x)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the graphics. + send imagewin setColorIndex $compassColor + send imagewin setFillType solid + + # Now draw the parts of the compass. + drawCompassAxes $n_x $n_y $e_x $e_y $trans $xflip $yflip $scale \ + $pcx $pcy + drawCompassLabels $n_x $n_y $e_x $e_y $trans $xflip $yflip $scale\ + $pcx $pcy $xlab $ylab + drawCompassPtr $n_x $n_y $e_x $e_y $trans $xflip $yflip $scale \ + $pcx $pcy $angle + + # Reset the logical resolution of the window. + send imagewin setLogRes $sv_xl $sv_yl + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +proc drawCompassAxes {n_x n_y e_x e_y trans xflip yflip scale pcx pcy} \ +{ + set cpoints { } + lappend cpoints [list $e_x $e_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $n_x $n_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($trans > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($trans > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + lappend pts $rx $ry + } + + # Draw the compass axes. + send imagewin drawPolyline $pts +} + +proc drawCompassLabels {n_x n_y e_x e_y trans xflip yflip scale pcx pcy xlab ylab} \ +{ + + set pts { } + set lpoints { } + + set xo [expr (0.2 * [expr "($xflip > 0) ? -1 : 1"])] + set yo [expr (0.2 * [expr "($yflip > 0) ? 1 : -1"])] + + lappend lpoints [list [expr "$e_x+$xo"] $e_y ] + lappend lpoints [list $n_x [expr "$n_y+$yo"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($trans > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($trans > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + lappend pts $rx $ry + } + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 0] [lindex $pts 1] $xlab + send imagewin drawAlphaText [lindex $pts 2] [lindex $pts 3] $ylab +} + +proc drawCompassPtr {n_x n_y e_x e_y trans xflip yflip scale pcx pcy angle} \ +{ + + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + + # Initialize the drawing points. + set pts {} + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($trans > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($trans > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($n_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($n_y - ($sx * $sino + $sy * $coso))] + + # Get the scaled position. + set sx [expr ($scale * $rx)] + set sy [expr ($scale * $ry)] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + lappend pts $rx $ry + } + + # Draw the compass pointer. + send imagewin drawPolygon $pts +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + diff --git a/vendor/x11iraf/ximtool/gui/display.res b/vendor/x11iraf/ximtool/gui/display.res new file mode 100644 index 00000000..155d8e17 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/display.res @@ -0,0 +1,451 @@ + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + diff --git a/vendor/x11iraf/ximtool/gui/func.tcl b/vendor/x11iraf/ximtool/gui/func.tcl new file mode 100644 index 00000000..3144e214 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/func.tcl @@ -0,0 +1,202 @@ + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + diff --git a/vendor/x11iraf/ximtool/gui/global.res b/vendor/x11iraf/ximtool/gui/global.res new file mode 100644 index 00000000..c91dde63 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/global.res @@ -0,0 +1,161 @@ + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + diff --git a/vendor/x11iraf/ximtool/gui/global.tcl b/vendor/x11iraf/ximtool/gui/global.tcl new file mode 100644 index 00000000..38115f93 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/global.tcl @@ -0,0 +1,147 @@ + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + diff --git a/vendor/x11iraf/ximtool/gui/hdr.obj b/vendor/x11iraf/ximtool/gui/hdr.obj new file mode 100644 index 00000000..5940a85a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/hdr.obj @@ -0,0 +1,36 @@ + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + diff --git a/vendor/x11iraf/ximtool/gui/hdr.res b/vendor/x11iraf/ximtool/gui/hdr.res new file mode 100644 index 00000000..44e7c79a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/hdr.res @@ -0,0 +1,138 @@ + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + diff --git a/vendor/x11iraf/ximtool/gui/hdr.tcl b/vendor/x11iraf/ximtool/gui/hdr.tcl new file mode 100644 index 00000000..4dc7489a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/hdr.tcl @@ -0,0 +1,105 @@ + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + diff --git a/vendor/x11iraf/ximtool/gui/help.obj b/vendor/x11iraf/ximtool/gui/help.obj new file mode 100644 index 00000000..36759f63 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/help.obj @@ -0,0 +1,27 @@ + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + diff --git a/vendor/x11iraf/ximtool/gui/help.res b/vendor/x11iraf/ximtool/gui/help.res new file mode 100644 index 00000000..affdeb2a --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/help.res @@ -0,0 +1,111 @@ + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + diff --git a/vendor/x11iraf/ximtool/gui/help.tcl b/vendor/x11iraf/ximtool/gui/help.tcl new file mode 100644 index 00000000..cc55e978 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/help.tcl @@ -0,0 +1,209 @@ + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + diff --git a/vendor/x11iraf/ximtool/gui/imagewin.tcl b/vendor/x11iraf/ximtool/gui/imagewin.tcl new file mode 100644 index 00000000..af1208d1 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/imagewin.tcl @@ -0,0 +1,1155 @@ + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + diff --git a/vendor/x11iraf/ximtool/gui/info.res b/vendor/x11iraf/ximtool/gui/info.res new file mode 100644 index 00000000..7fafa106 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/info.res @@ -0,0 +1,58 @@ + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + diff --git a/vendor/x11iraf/ximtool/gui/info.tcl b/vendor/x11iraf/ximtool/gui/info.tcl new file mode 100644 index 00000000..3f0e89fc --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/info.tcl @@ -0,0 +1,86 @@ + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + diff --git a/vendor/x11iraf/ximtool/gui/ism.tcl b/vendor/x11iraf/ximtool/gui/ism.tcl new file mode 100644 index 00000000..0882f37b --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/ism.tcl @@ -0,0 +1,423 @@ + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "<pre>%s\n%s</pre>" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/ximtool/gui/ism.tcl.bak b/vendor/x11iraf/ximtool/gui/ism.tcl.bak new file mode 100644 index 00000000..4dd43305 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/ism.tcl.bak @@ -0,0 +1,411 @@ + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +set Compass(0) { 0.0 1 1 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "<pre>%s\n%s</pre>" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2]} + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + set transpose [lindex $argv 4] + set xlab [lindex $argv 5] + set ylab [lindex $argv 6] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/ximtool/gui/load.res b/vendor/x11iraf/ximtool/gui/load.res new file mode 100644 index 00000000..6686f5c4 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/load.res @@ -0,0 +1,173 @@ + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + diff --git a/vendor/x11iraf/ximtool/gui/load.tcl b/vendor/x11iraf/ximtool/gui/load.tcl new file mode 100644 index 00000000..425f0226 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/load.tcl @@ -0,0 +1,247 @@ + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + diff --git a/vendor/x11iraf/ximtool/gui/magnifier.tcl b/vendor/x11iraf/ximtool/gui/magnifier.tcl new file mode 100644 index 00000000..beb57e2b --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/magnifier.tcl @@ -0,0 +1,577 @@ + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(magzoomMenu) + <Btn3Up>: popdown(magzoomMenu) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + diff --git a/vendor/x11iraf/ximtool/gui/main-old.obj b/vendor/x11iraf/ximtool/gui/main-old.obj new file mode 100644 index 00000000..a3af5486 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/main-old.obj @@ -0,0 +1,52 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL.GUI -- Default GUI for the Ximtool image display server. +# +# Version 2.0 -- BETA VERSION + + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display \ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar Label imageTitle \ + menubar Toggle controlButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +} + diff --git a/vendor/x11iraf/ximtool/gui/main-old.res b/vendor/x11iraf/ximtool/gui/main-old.res new file mode 100644 index 00000000..02a9b19e --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/main-old.res @@ -0,0 +1,422 @@ + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.foreground: Black + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: Black + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: Black + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: Black + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 0 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + -2 \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + vcutFrame < * +inf -inf > \ + } \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 plotOpts -4 } \ + } \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 0 + *hcutFrame.outerOffset: 0 + *hcutPlot.color0: #c4c4c4 + *hcutPlot.color1: black + *hcutPlot.color0: darkslategray + *hcutPlot.color1: #eeeee0 + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + *vcutPlot.color0: #c4c4c4 + *vcutPlot.color1: black + *vcutPlot.color0: darkslategray + *vcutPlot.color1: #eeeee0 + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 40 + *menuGroup.width: 518 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + controlButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: white + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 518 + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 518 + *imageFrame.height: 518 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 518 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>Left: call(moveFrame,-1,0) \n\ + !Ctrl <Key>Down: call(moveFrame,0,1) \n\ + !Ctrl <Key>Up: call(moveFrame,0,-1) \n\ + !Ctrl <Key>Right: call(moveFrame,1,0) \n\ + !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \n\ + !Ctrl <Key>a: call(toggleAutoReg) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>o: call(offset,$x,$y) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl <Key>\[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl <Key>\]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl <Key>0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift<Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Up>: call(updateColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \n\ + !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.borderWidth: 0 + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 50 + *colorbar.height: 17 +} + diff --git a/vendor/x11iraf/ximtool/gui/main.obj b/vendor/x11iraf/ximtool/gui/main.obj new file mode 100644 index 00000000..c8481e04 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/main.obj @@ -0,0 +1,86 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL-ALT.GUI -- Default GUI for the Ximtool-alt image display server. +# +# Version 2.0 -- BETA VERSION + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display\ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton\ + menubar MenuButton viewButton\ + menubar MenuButton optionsButton\ + menubar Label imageTitle\ + menubar Toggle mXflipButton\ + menubar Toggle mYflipButton\ + menubar Command mPrevButton\ + menubar MenuButton mFrameButton\ + menubar Command mNextButton\ + menubar Toggle toolButton\ + menubar Toggle panelButton\ +\ + display Layout toolbar\ + toolbar Command tbZoomIn\ + toolbar Command tbZoom0\ + toolbar Command tbZoomOut\ + toolbar Command tbInvert\ + toolbar Command tbNormalize\ + toolbar Command tbMatchLUT\ + toolbar Toggle tbAutoReg\ + toolbar Command tbRegister\ + toolbar Command tbCenter\ + toolbar Command tbBlinkDec\ + toolbar Toggle tbBlink\ + toolbar Command tbBlinkInc\ + toolbar Toggle xflipButton\ + toolbar Toggle yflipButton\ + toolbar Toggle tbTile\ + toolbar Toggle tbCompass\ + toolbar Command prevButton\ + toolbar MenuButton frameButton\ + toolbar Command nextButton\ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +\ + display Layout panelbar\ + panelbar Toggle pbDisplayP\ + panelbar Toggle pbLoadP\ + panelbar Toggle pbSaveP\ + panelbar Toggle pbPrintP\ + panelbar Toggle pbInfoP\ + panelbar Toggle pbTileP\ + panelbar Toggle pbCoordP\ + panelbar Toggle pbPanM\ + panelbar Toggle pbMagM\ + panelbar Toggle pbWcsM\ + panelbar Toggle pbIsm\ + panelbar Toggle helpButton\ + panelbar Command pbQuit\ +} + diff --git a/vendor/x11iraf/ximtool/gui/main.res b/vendor/x11iraf/ximtool/gui/main.res new file mode 100644 index 00000000..011b7a6f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/main.res @@ -0,0 +1,525 @@ + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: White + *rulerMenu.foreground: White + *display.imagewin.markerMenu.foreground: White + *display.imagewin.rulerMenu.foreground: White + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: White + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: White + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerColor.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: White + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: White + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 2 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + horizontal { 1 toolbar < +inf -inf * > 1 } \ + 1 < -1 > \ + horizontal { 1 panelbar < +inf -inf * > 1 } \ + 1 < -1 > \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + -2 \ + vcutFrame < * +inf -inf > \ + } \ + -3 \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 horizontal { -4 plotOpts} -4 } \ + } \ + -3 \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 1 + *hcutFrame.outerOffset: 1 + //*hcutPlot.color0: #c4c4c4 + //*hcutPlot.color1: #000000 + *hcutPlot.color0: #000000 + *hcutPlot.color1: #ffffff + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(displayPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + //*vcutPlot.color0: #c4c4c4 + //*vcutPlot.color1: black + *vcutPlot.color0: #000000 + *vcutPlot.color1: #ffffff + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(displayPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 38 + *menuGroup.width: 512 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 2 < -2 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + mXflipButton 1 < -1 > mYflipButton \ + 1 < -1 > \ + mPrevButton 1 < -1 > mFrameButton 1 < -1 > mNextButton \ + 1 < -1 > \ + toolButton 1 < -1 > panelButton \ + 2 < -2 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: White + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *menubar.width: 512 + *menubar*borderWidth: 0 + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *toolbar.layout: horizontal { \ + tbZoomIn < +inf -inf * > 1 < -1 > \ + tbZoom0 < +inf -inf * > 1 < -1 > \ + tbZoomOut < +inf -inf * > 1 < -1 > \ + tbInvert < +inf -inf * > 1 < -1 > \ + tbNormalize < +inf -inf * > 1 < -1 > \ + tbMatchLUT < +inf -inf * > 1 < -1 > \ + tbAutoReg < +inf -inf * > 1 < -1 > \ + tbRegister < +inf -inf * > 1 < -1 > \ + tbCenter < +inf -inf * > 1 < -1 > \ + tbBlinkDec < +inf -inf * > 1 < -1 > \ + tbBlink < +inf -inf * > 1 < -1 > \ + tbBlinkInc < +inf -inf * > 1 < -1 > \ + xflipButton < +inf -inf * > 1 < -1 > \ + yflipButton < +inf -inf * > 1 < -1 > \ + tbCompass < +inf -inf * > 1 < -1 > \ + tbTile < +inf -inf * > 1 < -1 > \ + prevButton < +inf -inf * > 1 < -1 > \ + frameButton < +inf -inf * > 1 < -1 > \ + nextButton < +inf -inf * > 1 < -1 > \ + } + *toolbar.width: 512 + *toolbar.height: 25 + *toolbar*borderWidth: 0 + *toolbar*Command.internalWidth: 3 + *toolbar*Command.borderWidth: 0 + *toolbar*Toggle.internalWidth: 2 + *toolbar*Toggle.borderWidth: 0 + + *panelbar.layout: horizontal { \ + pbDisplayP < +inf -inf * > 1 < -1 > \ + pbPrintP < +inf -inf * > 1 < -1 > \ + pbLoadP < +inf -inf * > 1 < -1 > \ + pbSaveP < +inf -inf * > 1 < -1 > \ + pbInfoP < +inf -inf * > 1 < -1 > \ + pbTileP < +inf -inf * > 1 < -1 > \ + pbCoordP < +inf -inf * > 1 < -1 > \ + pbPanM < +inf -inf * > 1 < -1 > \ + pbMagM < +inf -inf * > 1 < -1 > \ + pbWcsM < +inf -inf * > 1 < -1 > \ + pbIsm < +inf -inf * > 1 < -1 > \ + helpButton < +inf -inf * > 1 < -1 > \ + pbQuit < +inf -inf * > 1 < -1 > \ + } + *panelbar*SimpleMenu.borderColor: Black + *panelbar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *panelbar.width: 12 + *panelbar.height: 25 + *panelbar*borderWidth: 0 + *panelbar*Label.internalWidth: 4 + *panelbar*Label.borderWidth: 0 + *panelbar*Command.internalWidth: 4 + *panelbar*Command.borderWidth: 0 + *panelbar*Toggle.internalWidth: 3 + *panelbar*Toggle.borderWidth: 0 + + *pbLoadP.label: Load + *pbDisplayP.label: Display + *pbSaveP.label: Save + *pbPrintP.label: Print + *pbInfoP.label: Info + *pbTileP.label: Tile + *pbCoordP.label: Coords + *pbPanM.label: Pan + *pbPanM.state: 1 + *pbMagM.label: Mag + *pbMagM.state: 0 + *pbWcsM.label: WCS + *pbWcsM.state: 1 + *pbIsm.label: ISM + *pbIsm.state: 0 + *helpButton.label: + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *toolButton.label: + *toolButton.state: 0 + *panelButton.label: + *panelButton.state: 0 + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + *mFrameButton.menuName: mFrameMenu + *mFrameButton.label: 1 + *mFrameButton.width: 20 + *pbQuit.label: Quit + *tbZoom0.label: Mag + *tbBlink.label: Blink + *tbBlink.internalWidth: 3 + *tbCenter.label: Cntr + *tbAutoReg.label: AReg + *tbRegister.label: Reg + *tbInvert.label: Inv + *tbNormalize.label: Norm + *tbMatchLUT.label: Match + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *panelbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *toolbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 512 + *imageFrame.height: 512 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 512 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.idleCursor: crosshair + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Ctrl <Key>Left: call(moveFrame,-1,0) \n\ + !Ctrl <Key>Down: call(moveFrame,0,1) \n\ + !Ctrl <Key>Up: call(moveFrame,0,-1) \n\ + !Ctrl <Key>Right: call(moveFrame,1,0) \n\ + !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>a: call(tbToggleAutoReg) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>o: call(offset,$x,$y) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tbTileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl <Key>\[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl <Key>\]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl <Key>0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(displayPanel) \n\ + !Ctrl Shift <Key>c: call(displayPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !Ctrl Shift <Key>t: call(tclPanel) \n\ + !Shift<Btn1Down>: call(setDynamicMagnifier,1) \n\ + !Shift<Btn1Up>: call(setDynamicMagnifier,0) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift <Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Up>: call(updateColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \n\ + !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.height: 17 + *colorbar.width: 50 + *colorbar.borderWidth: 0 +} + diff --git a/vendor/x11iraf/ximtool/gui/mkgui b/vendor/x11iraf/ximtool/gui/mkgui new file mode 100755 index 00000000..76f9f288 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/mkgui @@ -0,0 +1,81 @@ +#!/bin/csh -f + +set old = 0 +set file = ximtool.gui + +old: + +echo -n "Building $file ..." +if ($old == 0) then + cat main.obj > $file +else + cat main-old.obj > $file +endif +cat panel.obj >> $file +cat param.obj >> $file +cat help.obj >> $file +cat blink.obj >> $file +cat hdr.obj >> $file +cat pixtab.obj >> $file +cat tcl.obj >> $file +cat warn.obj >> $file + +cat global.res >> $file +if ($old == 0) then + cat main.res >> $file +else + cat main-old.res >> $file +endif +cat panel.res >> $file +cat display.res >> $file +cat print.res >> $file +cat info.res >> $file +cat load.res >> $file +cat save.res >> $file +cat tile.res >> $file +cat wcs.res >> $file +cat blink.res >> $file +cat hdr.res >> $file +cat pixtab.res >> $file +cat help.res >> $file +cat tcl.res >> $file +cat warn.res >> $file +cat resources.res >> $file + +cat boot.tcl >> $file +cat global.tcl >> $file +cat plots.tcl >> $file +cat imagewin.tcl >> $file +cat func.tcl >> $file +cat panel.tcl >> $file +cat magnifier.tcl >> $file +cat panner.tcl >> $file +cat print.tcl >> $file +cat info.tcl >> $file +cat load.tcl >> $file +cat save.tcl >> $file +cat tile.tcl >> $file +cat wcs.tcl >> $file +cat compass.tcl >> $file +cat rulers.tcl >> $file +cat help.tcl >> $file +cat hdr.tcl >> $file +cat pixtab.tcl >> $file +cat warn.tcl >> $file +cat tcl.tcl >> $file +cat ism.tcl >> $file +if ($old == 0) then + cat toolbars.tcl >> $file +endif + +echo "Done" + +if ($old == 0) then + set old = 1 + set file = ximtool-old.gui + goto old +endif + +echo -n "Installing files ..." +mv *.gui ../ +echo "Done" diff --git a/vendor/x11iraf/ximtool/gui/panel.obj b/vendor/x11iraf/ximtool/gui/panel.obj new file mode 100644 index 00000000..26157cef --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/panel.obj @@ -0,0 +1,412 @@ + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + diff --git a/vendor/x11iraf/ximtool/gui/panel.res b/vendor/x11iraf/ximtool/gui/panel.res new file mode 100644 index 00000000..52e27826 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/panel.res @@ -0,0 +1,69 @@ + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + diff --git a/vendor/x11iraf/ximtool/gui/panel.tcl b/vendor/x11iraf/ximtool/gui/panel.tcl new file mode 100644 index 00000000..257f253c --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/panel.tcl @@ -0,0 +1,835 @@ + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + diff --git a/vendor/x11iraf/ximtool/gui/panner.tcl b/vendor/x11iraf/ximtool/gui/panner.tcl new file mode 100644 index 00000000..fb374fa2 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/panner.tcl @@ -0,0 +1,536 @@ + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn2Up>: call(pannerPanXY,$x,$y) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>s: call(cpMatchFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + diff --git a/vendor/x11iraf/ximtool/gui/param.obj b/vendor/x11iraf/ximtool/gui/param.obj new file mode 100644 index 00000000..405ec018 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/param.obj @@ -0,0 +1,33 @@ + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + diff --git a/vendor/x11iraf/ximtool/gui/pixtab.obj b/vendor/x11iraf/ximtool/gui/pixtab.obj new file mode 100644 index 00000000..1da660a2 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/pixtab.obj @@ -0,0 +1,30 @@ + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + diff --git a/vendor/x11iraf/ximtool/gui/pixtab.res b/vendor/x11iraf/ximtool/gui/pixtab.res new file mode 100644 index 00000000..74001dd0 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/pixtab.res @@ -0,0 +1,128 @@ + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + diff --git a/vendor/x11iraf/ximtool/gui/pixtab.tcl b/vendor/x11iraf/ximtool/gui/pixtab.tcl new file mode 100644 index 00000000..d23827c9 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/pixtab.tcl @@ -0,0 +1,144 @@ + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + diff --git a/vendor/x11iraf/ximtool/gui/plots.tcl b/vendor/x11iraf/ximtool/gui/plots.tcl new file mode 100644 index 00000000..9ea56c8b --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/plots.tcl @@ -0,0 +1,667 @@ + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + diff --git a/vendor/x11iraf/ximtool/gui/print.res b/vendor/x11iraf/ximtool/gui/print.res new file mode 100644 index 00000000..3327cb48 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/print.res @@ -0,0 +1,304 @@ + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + diff --git a/vendor/x11iraf/ximtool/gui/print.tcl b/vendor/x11iraf/ximtool/gui/print.tcl new file mode 100644 index 00000000..983d2a15 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/print.tcl @@ -0,0 +1,342 @@ + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + diff --git a/vendor/x11iraf/ximtool/gui/resources.res b/vendor/x11iraf/ximtool/gui/resources.res new file mode 100644 index 00000000..201e2e16 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/resources.res @@ -0,0 +1,26 @@ + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + diff --git a/vendor/x11iraf/ximtool/gui/rulers.tcl b/vendor/x11iraf/ximtool/gui/rulers.tcl new file mode 100644 index 00000000..98f30a0f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/rulers.tcl @@ -0,0 +1,524 @@ + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: call(deleteNamedRuler,NAME,$x,$y) + <Key>Delete: call(deleteNamedRuler,NAME,$x,$y) + <KeyPress>: m_input() + <Btn3Down>: call(setRulerMenu) popup(rulerMenu) + <Btn3Up>: popdown(rulerMenu) +!Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + diff --git a/vendor/x11iraf/ximtool/gui/save.res b/vendor/x11iraf/ximtool/gui/save.res new file mode 100644 index 00000000..81c45ace --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/save.res @@ -0,0 +1,143 @@ + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + diff --git a/vendor/x11iraf/ximtool/gui/save.tcl b/vendor/x11iraf/ximtool/gui/save.tcl new file mode 100644 index 00000000..36706d31 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/save.tcl @@ -0,0 +1,156 @@ + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + diff --git a/vendor/x11iraf/ximtool/gui/tcl.obj b/vendor/x11iraf/ximtool/gui/tcl.obj new file mode 100644 index 00000000..3bea2d87 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/tcl.obj @@ -0,0 +1,13 @@ + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + diff --git a/vendor/x11iraf/ximtool/gui/tcl.res b/vendor/x11iraf/ximtool/gui/tcl.res new file mode 100644 index 00000000..6c250bc7 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/tcl.res @@ -0,0 +1,44 @@ +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + diff --git a/vendor/x11iraf/ximtool/gui/tcl.tcl b/vendor/x11iraf/ximtool/gui/tcl.tcl new file mode 100644 index 00000000..b3fb08d8 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/tcl.tcl @@ -0,0 +1,36 @@ + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { tclPanel } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + diff --git a/vendor/x11iraf/ximtool/gui/tile.res b/vendor/x11iraf/ximtool/gui/tile.res new file mode 100644 index 00000000..2c1a9607 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/tile.res @@ -0,0 +1,149 @@ + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + diff --git a/vendor/x11iraf/ximtool/gui/tile.tcl b/vendor/x11iraf/ximtool/gui/tile.tcl new file mode 100644 index 00000000..279475ab --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/tile.tcl @@ -0,0 +1,214 @@ + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False diff --git a/vendor/x11iraf/ximtool/gui/toolbars.tcl b/vendor/x11iraf/ximtool/gui/toolbars.tcl new file mode 100644 index 00000000..85e6946e --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/toolbars.tcl @@ -0,0 +1,557 @@ + + +################################################################################ +# +# XIMTOOL-ALT -- Procedures and declarations for the ALT GUI. +# +################################################################################ + +# Creat the bitmaps needed for the alternate optional bars. + +createBitmap tools 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, + 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap control 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xe3, 0xc7, 0xe3, 0xcf, 0x33, 0xcc, + 0x33, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x33, 0xcc, 0xf3, 0xcf, + 0xe3, 0xc7, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap tile 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff}; + +createBitmap compass 16 16 { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x80, 0x0f, 0xc0, 0x1f, 0x00, 0x07, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0xfc, 0x07, + 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00} + +createBitmap plus 11 11 { + 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00}; + +createBitmap minus 11 11 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap disk 16 16 { + 0xfe,0x1f,0x11,0x25,0x11,0x45,0x11,0x44,0xf1,0x47,0x01,0x40,0x01,0x40,0xf9, + 0x4f,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0xff,0x7f, + 0x00,0x00}; + +createBitmap printer 32 16 { + 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x12, 0x00, + 0x00, 0x02, 0x22, 0x00, 0x00, 0x02, 0x3e, 0x00, 0x00, 0x02, 0x20, 0x00, + 0x00, 0x02, 0x20, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0x10, 0x03, 0xe0, 0x06, + 0x08, 0xff, 0x7f, 0x09, 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, + 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x08, + 0xf8, 0xff, 0xff, 0x0f}; + + +send tbBlinkDec "set bitmap larrow" ;# Assign the bitmaps to the buttons. +send tbBlinkInc "set bitmap rarrow" +send tbZoomIn "set bitmap plus" +send tbZoomOut "set bitmap minus" +send tbTile "set bitmap tile" +send tbCompass "set bitmap compass; addCallback toggleCompass" +#send helpButton "set bitmap qmark; addCallback Help" +send mXflipButton "set bitmap xflip; addCallback xflip" +send mYflipButton "set bitmap yflip; addCallback yflip" +send mNextButton "set bitmap rarrow; addCallback nextFrame" +send mPrevButton "set bitmap larrow; addCallback prevFrame" + + +# toolBox -- Toggle the toolbox and panelbar display. + +set toolbox_up [ true $showToolBar ] +set panelbar_up [ true $showPanelBar ] + +proc toolBoxToggle args \ +{ + global toolbox_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$toolbox_up} { + send toolbar set height 0 + send toolButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w; set height $nh" + set toolbox_up 0 + send mXflipButton map + send mYflipButton map + send mPrevButton map + send mFrameButton map + send mNextButton map + } else { + send toolbar set height 25 + send toolButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set toolbox_up 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap + } +} + +proc panelBarToggle args \ +{ + global panelbar_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$panelbar_up} { + send panelbar set height 0 + send panelButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w ; set height $nh" + set panelbar_up 0 + } else { + send panelbar set height 25 + send panelButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set panelbar_up 1 + } +} + + + +# Initialize the bars to be displayed if the resource was set. + +send toolButton "set bitmap tools; addCallback toolBoxToggle" +if { ! [ true $showToolBar ] } { + send display set height [expr [send display get height] - 25] + send toolbar set height 0 + send toolButton set state 0 +} else { + send toolButton set state 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap +} + +send panelButton "deleteCallback panel" +send panelButton "set bitmap control; addCallback panelBarToggle" + +if { ! [ true $showPanelBar ] } { + send display set height [expr [send display get height] - 25] + send panelbar set height 0 + send panelButton set state 0 +} else { + send panelButton set state 1 +} + + +############################################## +# Panelbar callbacks. +############################################## + +send pbQuit addCallback Quit +send helpClose addCallback "send helpButton set state 0" + + +# Control Panel. +#------------------------------------------------------ +proc pbToggleControl {name element op} \ +{ + upvar $name panel_up + send pbDisplayP set state [expr !($panel_up)] +} ; #trace variable panel_up w pbToggleControl + +proc pbResetPanel {param old new} \ +{ + global displayPanner displayMagnifier displayCoords + switch $new { + done { send pbPanM set state [true $displayPanner] + send pbMagM set state [true $displayMagnifier] + send pbWcsM set state [true $displayCoords] + } + } +} ; send initialize addCallback pbResetPanel + +set WidgetToTab(pbDisplayP) display_panel +set WidgetToTab(pbInfoP) info_panel +set WidgetToTab(pbLoadP) load_panel +set WidgetToTab(pbPrintP) print_panel +set WidgetToTab(pbSaveP) save_panel +set WidgetToTab(pbTileP) tile_panel +set WidgetToTab(pbCoordP) wcs_panel + +set TabToWidget(display_panel) pbDisplayP +set TabToWidget(print_panel) pbPrintP +set TabToWidget(load_panel) pbLoadP +set TabToWidget(save_panel) pbSaveP +set TabToWidget(info_panel) pbInfoP +set TabToWidget(tile_panel) pbTileP +set TabToWidget(wcs_panel) pbCoordP + +set pbTabTop "pbDisplayP" + +proc pbPanelDismiss args \ +{ + global tabTop TabToWidget WidgetToTab + set panel $TabToWidget($tabTop) + send $panel set state 0 +} ; send panelClose addCallback pbPanelDismiss + +proc pbResizeCB {widget event a b c d e args} \ +{ + global pbTabTop TabToWidget WidgetToTab + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + send $pbTabTop set state 0 + set new $TabToWidget($widget) + send $new set state 1 + set pbTabTop $new + } +} ; foreach w $cpTabs {send $w addEventHandler pbResizeCB exposureMask} + +proc pbPanelTabs { widget type state args } \ +{ + global pbTabTop tabTop panel_up + global TabToWidget WidgetToTab + + set panel $WidgetToTab($widget) + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $widget set state 0 + set panel_up 0 + return + } + + send $TabToWidget($tabTop) set state 0 + set tabTop $panel + set pbTabTop $TabToWidget($panel) + send panelTabs setTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send $widget set state 1 + send panelShell map + set panel_up 1 + } +} +foreach w { pbDisplayP pbInfoP pbLoadP pbPrintP pbSaveP pbTileP pbCoordP } { + send $w addCallback pbPanelTabs +} + + + +# Load Panel. (Really need to clean this up.) +#------------------------------------------------------ +proc pbDoLoadOptions { param old new } \ +{ + set val [ join [lrange $new 1 end] " " ] + switch [lindex $new 0] { + newfile { send fnameText set string $val } + } +} ; send loadOptions addCallback pbDoLoadOptions + +proc pbFileLoad { widget mode fname args } \ +{ + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + send imagewin setCursorType idle +} ; send fnameText addCallback pbFileLoad + +proc pbflSelectPrint {widget cbtype selections args} \ +{ + foreach selection $selections { + ; + } +}; #send imageList addCallback pbflSelectPrint + +proc pbFileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname != ""} { + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + } +} ; send filesLoadButton addCallback pbFileLoadB + + +# Panner Marker. +#------------------------------------------------------ +proc pbTracePanner {name element op} \ +{ + global last_compass + + catch { + upvar $name panner_enable + send pbPanM set state $panner_enable + + if { $panner_enable } { + send tbCompass "setSensitive True ; set state $last_compass" + drawCompass + } else { + send tbCompass "setSensitive False ; set state False" + eraseCompass + } + } +} ; trace variable panner_enable w pbTracePanner + +proc pannerPanel args \ +{ + global panner_enable displayPanner + + setPanner [expr !$panner_enable] + send pannerButton set on [expr $panner_enable] +}; send pbPanM addCallback pannerPanel + + +# Magnifier Marker. +#------------------------------------------------------ +proc pbTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send pbMagM set state $magnifier_enable +} ; trace variable magnifier_enable w pbTraceMagnifier + +proc magnifierPanel args \ +{ + global magnifier_enable displayMagnifier + setMagnifier [expr !$magnifier_enable] + send magnifierButton set on [expr $magnifier_enable] +}; send pbMagM addCallback magnifierPanel + + +# CoordsBox Marker. +#------------------------------------------------------ +proc pbTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send pbWcsM set state $track_enable +} ; trace variable track_enable w pbTraceCoordsBox + +proc wcsPanel args \ +{ + global track_enable + setTrack [expr !$track_enable] +}; send pbWcsM addCallback wcsPanel + + + +# WPIX ISM Callbacks. +#------------------------------------------------------ + +proc altIsmToggle { widget type state args } \ +{ + ismToggle pbIsm junk $state +} ; send pbIsm addCallback altIsmToggle + +proc pbTraceIsm {name element op} \ +{ + upvar $name ism_enable + send pbIsm set state $ism_enable +} ; trace variable ism_enable w pbTraceIsm + + +proc altIsmMsgCB { param old new } \ +{ + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + deliver { ${ism}_alt_msg $argc $argv } + } +} ; send ism_msg addCallback altIsmMsgCB + + +proc wcspix_alt_msg { argc argv } \ +{ + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + switch $cmd { + startup { } + shutdown { } + disable { send pbIsm "set state False ; setSensitive False" } + capable { send pbIsm "setSensitive True" } + } +} + + + +############################################## +# Toolbar callbacks. +############################################## + +send tbNormalize addCallback normalize +send tbInvert addCallback cpInvert +send tbRegister addCallback cpRegisterFrames +send tbMatchLUT addCallback cpMatchFrames + + +# Frame Selection. +#------------------ +createMenu mFrameMenu mFrameButton $frameMenuDescription + +proc altFrameChanged {param old new} \ +{ + send mFrameButton set label $new +} ; send frame addCallback altFrameChanged + + +# Image Flipping. +#------------------------------------------------------ +proc tbSetFlip {param old new} \ +{ + if {$param == "xflip"} { + send mXflipButton set state [true $new] + } else { + send mYflipButton set state [true $new] + } +}; foreach i {xflip yflip} { send $i addCallback tbSetFlip } + + +# Zoom/Pan buttons. +#------------------------------------------------------ +proc tbZoomAction { widget args } \ +{ + global frameWidth frameHeight + + switch $widget { + tbZoom0 { cpZoom 1 1 fixed } + tbZoomIn { cpZoom 2.0 2.0 relative } + tbZoomOut { cpZoom 0.5 0.5 relative } + tbCenter { send client pan [expr $frameWidth/2.0] [expr $frameHeight/2.0] } + } +} +foreach widget { tbCenter tbZoomIn tbZoom0 tbZoomOut } { + send $widget addCallback tbZoomAction +} + + +# Frame Blink. +#------------------------------------------------------ +proc tbSetBlinkRate {w args} \ +{ + if {$w == "tbBlinkInc"} { + cpSetBlinkRate BRincrease + } else { + cpSetBlinkRate BRdeccrease + } +} +foreach w {tbBlinkDec tbBlinkInc} { send $w addCallback tbSetBlinkRate } + +proc tbBlink { widget args } \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send tbBlink set state 0 + } else { + if {$widget != "tbBlink"} { + if {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } + } else { + if {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } + } + } +} ; send tbBlink addCallback tbBlink + +proc tbTraceBlink {name element op} \ +{ + upvar $name blinkId + send tbBlink set state [expr $blinkId != 0] +} ; trace variable blinkId w tbTraceBlink + + +# Auto-register. +#------------------------------------------------------ +proc tbAutoRegister { widget type state args } \ +{ + send tbAutoReg set state $state +} +foreach w {autoregButton brAregButton tbAutoReg} { + send $w addCallback cpAutoRegister +} + +proc tbToggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + send tbAutoReg set state 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + send tbAutoReg set state 1 + } +} + + +# Frame Tiles. +#------------------------------------------------------ +proc tbSetTileFrames args \ +{ + global tileOpt + + # Send the option to the client. + if {[send tbTile get state ]} { + if {$tileOpt == 0} { + # If mode is disabled, turn on the tile selection. + selectTileOrientation junk junk Best + } else { + # Otherwise, turn on in current mode. + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } + } else { + selectTileOrientation junk junk Disabled + } +}; send tbTile addCallback tbSetTileFrames + +proc tbTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] + send tbTile set state $new +}; send tileFrames addCallback tbTrackTileFrames + +proc tbTileFramesToggle args \ +{ + set value [send tileFramesButton get on] + if {$value} { set not 0 } else { set not 1 } + + send tileFramesButton set on $not + send tbTile set state $not + cpSetTileFrames tbTile junk $not +} + + +# Compass Indicator. +#------------------------------------------------------ +proc tbToggleCompass { widget type state args } \ +{ + global frame + + if {$state} { + send compass set on True + send tbCompass set state 1 + drawCompass + } else { + send compass set on False + send tbCompass set state 0 + eraseCompass + } +} ; foreach w {compass tbCompass} { send $w addCallback tbToggleCompass } + + diff --git a/vendor/x11iraf/ximtool/gui/warn.obj b/vendor/x11iraf/ximtool/gui/warn.obj new file mode 100644 index 00000000..51c617e0 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/warn.obj @@ -0,0 +1,12 @@ + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + diff --git a/vendor/x11iraf/ximtool/gui/warn.res b/vendor/x11iraf/ximtool/gui/warn.res new file mode 100644 index 00000000..2be08804 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/warn.res @@ -0,0 +1,49 @@ + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + diff --git a/vendor/x11iraf/ximtool/gui/warn.tcl b/vendor/x11iraf/ximtool/gui/warn.tcl new file mode 100644 index 00000000..e0465bc3 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/warn.tcl @@ -0,0 +1,49 @@ + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + diff --git a/vendor/x11iraf/ximtool/gui/wcs.res b/vendor/x11iraf/ximtool/gui/wcs.res new file mode 100644 index 00000000..0f9ec8d5 --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/wcs.res @@ -0,0 +1,212 @@ + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + diff --git a/vendor/x11iraf/ximtool/gui/wcs.tcl b/vendor/x11iraf/ximtool/gui/wcs.tcl new file mode 100644 index 00000000..8b14db4f --- /dev/null +++ b/vendor/x11iraf/ximtool/gui/wcs.tcl @@ -0,0 +1,464 @@ + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + diff --git a/vendor/x11iraf/ximtool/gui2c.sed b/vendor/x11iraf/ximtool/gui2c.sed new file mode 100644 index 00000000..9a70a93c --- /dev/null +++ b/vendor/x11iraf/ximtool/gui2c.sed @@ -0,0 +1,6 @@ +s/\\/\\\\/g +s/"/\\"/g +s/^/"/ +s/$/",/ +p +d diff --git a/vendor/x11iraf/ximtool/iis.c b/vendor/x11iraf/ximtool/iis.c new file mode 100644 index 00000000..8217feca --- /dev/null +++ b/vendor/x11iraf/ximtool/iis.c @@ -0,0 +1,1698 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/errno.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/un.h> +#include <fcntl.h> + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include "ximtool.h" +#include "iis.h" + +/* + * IIS.C -- IRAF/IIS "imtool" protocol module. This code is responsible for + * accepting connections from remote network clients and communicating with + * them via the imtool/iis image display server communications prototcol. + * + * fd = xim_iisOpen (xim) + * xim_iisClose (xim) + * xim_iisio (xim, &fd, &id) + * + * xim_frameLabel (xim) + * xim_encodewcs (xim, sx, sy, sz, obuf) + * xim_retCursorVal (xim, sx, sy, frame, wcs, key, strval) + * + * xim_iisiomap (w, iomap, &iomap_len) + * xim_iiscolormap (w, r, g, b, &first, &ngray, &rgb_len) + * + * xim_iisio is a callback procedure called by Xt when there is input to be + * processed on the stream used to communicate with the remote client. + */ + +#define MEMORY 01 /* frame buffer i/o */ +#define LUT 02 /* lut i/o */ +#define FEEDBACK 05 /* used for frame clears */ +#define IMCURSOR 020 /* logical image cursor */ +#define WCS 021 /* used to set WCS */ +#define SZ_IOBUF 65536 /* max size data transfer */ +#define IO_TIMEOUT 30 /* i/o not getting anywhere */ +#define MAXCONN 5 + + +#define IIS_VERSION 11 /* version 10 => 1.0 */ + /* v1.1 => fast subraster write */ +#define IIS_DEBUG 0 /* local debug flag */ + +#define SZ_IMCURVAL 160 +#define PACKED 0040000 +#define COMMAND 0100000 +#define IIS_READ 0100000 +#define IMC_SAMPLE 0040000 +#define IMT_FBCONFIG 077 +#define XYMASK 077777 +#define ALLBITPL 255 + +struct iism70 { + short tid; + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; +}; + +/* Running id for frame mappings. We keep a separate id for each of the + * currently allowed MAX_FRAMES since the object id is used in the WCS + * code for the image along with the (frame_num * 100). + */ +int objid[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; +static int *wcspix_enabled = NULL; + +static int iis_debug = -1; /* protocol debug */ + +static void set_fbconfig(), add_mapping(); +static void xim_connectClient(), xim_disconnectClient(); +static int chan_read(), chan_write(), decode_frameno(); + +static CtranPtr wcs_update(); +static IoChanPtr open_fifo(), open_inet(), open_unix(); +static IoChanPtr get_iochan(); +static MappingPtr xim_getMapping(); + +extern int errno; + + +/* XIM_IISOPEN -- Initialize the IIS protocol module and ready the module to + * accept client connections and begin processing client requests. Clients + * may connect to the server using a fifo connection or an internet or + * UNIX domain socket connection. All three types of server ports are + * simultaneously ready to receive client connections. + */ +xim_iisOpen (xim) +register XimDataPtr xim; +{ + int i, port, last_port = (xim->port + xim->nports - 1); + int nopen = 0; + + + if (open_unix (xim)) + nopen++; + if (open_fifo (xim)) + nopen++; + + for (port=xim->port; port > 0 && port <= last_port; port++) { + if (open_inet (xim, port)) + nopen++; + } + + return (nopen); +} + + +/* XIM_IISCLOSE -- Close down the IIS protocol module. + */ +void +xim_iisClose (xim) +register XimDataPtr xim; +{ + register IoChanPtr chan; + register int i; + + for (i=0, chan=NULL; i < XtNumber(xim->chan); i++) { + chan = &xim->chan[i]; + if (chan->id) { + xim_removeInput (xim, chan->id); + chan->id = NULL; + } + + switch (chan->type) { + case IO_FIFO: + if (chan->keepalive >= 0) + close (chan->keepalive); + if (chan->datain >= 0) + close (chan->datain); + if (chan->dataout >= 0) + close (chan->dataout); + chan->type = 0; + break; + + case IO_INET: + close (chan->datain); + chan->type = 0; + break; + + case IO_UNIX: + close (chan->datain); + unlink (chan->path); + chan->type = 0; + break; + } + } +} + + +/* OPEN_FIFO -- Open the imtool fifo port and make ready to accept client + * connections and begin processing client requests. There is no client + * yet at this stage. + */ +static IoChanPtr +open_fifo (xim) +register XimDataPtr xim; +{ + register IoChanPtr chan; + int datain, dataout; + int keepalive; + + +#if defined (__DARWIN__) || defined(__CYGWIN__) + /* On OS X we don't use fifos. */ + xim->input_fifo = "none"; + return (NULL); +#endif + + /* Setting the input fifo to "none" or the null string disables + * fifo support. + */ + if (!xim->input_fifo[0] || strcmp(xim->input_fifo,"none")==0) + return (NULL); + + datain = dataout = -1; + + if (IIS_DEBUG) + printf ("Opening fifo: '%s'\n", xim->input_fifo); + + /* Open the output fifo (which is the client's input fifo). We have + * to open it ourselves first as a client to get around the fifo + * open-no-client error. + */ + if ((datain = open (xim->input_fifo, O_RDONLY|O_NDELAY)) != -1) { + if ((dataout = open (xim->input_fifo, O_WRONLY|O_NDELAY)) != -1) + fcntl (dataout, F_SETFL, O_WRONLY); + else + goto done; + close (datain); + } else + goto done; + + /* Open the input stream, a FIFO pseudodevice file used by + * applications to send us commands and data. + */ + if ((datain = open (xim->output_fifo, O_RDONLY|O_NDELAY)) == -1) + goto done; + else { + /* Clear O_NDELAY for reading. */ + fcntl (datain, F_SETFL, O_RDONLY); + + /* Open the client's output fifo as a pseudo-client to make it + * appear that a client is connected. + */ + keepalive = open (xim->output_fifo, O_WRONLY); + } +done: + /* Allocate and fill in i/o channel descriptor. */ + if (datain > 0 && dataout > 0 && (chan = get_iochan(xim))) { + chan->xim = (XtPointer) xim; + chan->type = IO_FIFO; + chan->datain = datain; + chan->dataout = dataout; + chan->keepalive = keepalive; + chan->reference_frame = 1; + chan->version = 0; + chan->rf_p = &xim->frames[0]; + } else { + fprintf (stderr, "Warning: cannot open %s\n", xim->output_fifo); + xim->input_fifo = "none"; + return (NULL); + } + + /* Register input callback. */ + if (chan) { + chan->id = xim_addInput (xim, chan->datain, xim_iisio, + (XtPointer)chan); + } else { + if (datain > 0) + close (datain); + if (dataout > 0) + close (dataout); + } + + return (chan); +} + + +/* OPEN_INET -- Set up a port to be used for incoming client connections + * using internet domain sockets. + */ +static IoChanPtr +open_inet (xim, portnum) +register XimDataPtr xim; +int portnum; +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_in sockaddr; + int reuse = 1; + + /* Setting the port to zero disables inet socket support. */ + if (portnum <= 0) + return (NULL); + + + if (IIS_DEBUG) + printf ("Opening inet port: %d\n", portnum); + + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons((short)portnum); + sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, + sizeof(reuse)) < 0) + goto err; + + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if (chan = get_iochan(xim)) { + chan->xim = (XtPointer) xim; + chan->type = IO_INET; + chan->datain = s; + chan->dataout = s; + chan->reference_frame = 1; + chan->version = 0; + chan->rf_p = &xim->frames[0]; + + /* Register connectClient callback. */ + chan->id = xim_addInput (xim,s,xim_connectClient,(XtPointer)chan); + return (chan); + } + + +err: + if (errno == EADDRINUSE) { + fprintf (stderr,"ximtool: inet port %d already in use - disabled\n", + portnum); + } else { + fprintf (stderr, "ximtool: can't open inet socket %d, errno=%d\n", + portnum, errno); + } + xim->port = 0; + if (s) + close (s); + return (NULL); +} + + +/* OPEN_UNIX -- Set up a port to be used for incoming client connections + * using unix domain sockets. + */ +static IoChanPtr +open_unix (xim) +register XimDataPtr xim; +{ + register int s = 0; + register IoChanPtr chan; + struct sockaddr_un sockaddr; + int addrlen; + char path[256]; + + /* Setting the addr to "none" or the null string disables unix + * socket support. + */ + if (!xim->unixaddr[0] || strcmp(xim->unixaddr,"none")==0) + return (NULL); + + + if (IIS_DEBUG) + printf ("Opening unix socket: '%s'\n", xim->unixaddr); + + /* Get path to be used for the unix domain socket. */ + sprintf (path, xim->unixaddr, getuid()); + unlink (path); + + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strcpy (sockaddr.sun_path, path); + addrlen = sizeof(sockaddr) - sizeof(sockaddr.sun_path) + strlen(path); + if (bind (s, (struct sockaddr *)&sockaddr, addrlen) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) + goto err; + + /* Allocate and fill in i/o channel descriptor. */ + if (chan = get_iochan(xim)) { + chan->xim = (XtPointer) xim; + chan->type = IO_UNIX; + chan->datain = s; + chan->dataout = s; + chan->reference_frame = 1; + chan->version = 0; + chan->rf_p = &xim->frames[0]; + strncpy (chan->path, path, SZ_FNAME); + + /* Register connectClient callback. */ + chan->id = xim_addInput (xim,s,xim_connectClient,(XtPointer)chan); + return (chan); + } +err: + if (errno == EADDRINUSE) { + fprintf (stderr,"ximtool: unix addr %s already in use - disabled\n", + path); + } else { + fprintf (stderr,"ximtool: cannot open unix socket '%s', errno=%d\n", + path, errno); + } + strcpy (xim->unixaddr, "none"); + if (s) + close (s); + return (NULL); +} + + +/* XIM_CONNECTCLIENT -- Called when a client has attempted a connection on + * a socket port. Accept the connection and set up a new i/o channel to + * communicate with the new client. + */ +static void +xim_connectClient (chan_port, source, id) +IoChanPtr chan_port; +int *source; +XtPointer id; +{ + register XimDataPtr xim = (XimDataPtr) chan_port->xim; + register IoChanPtr chan; + register int s; + + /* Accept connection. */ + if ((s = accept ((int)*source, (struct sockaddr *)0, (int *)0)) < 0) + return; +/* + if (fcntl (s, F_SETFL, O_RDWR|O_NDELAY) < 0) { + close (s); + return; + } +*/ + + /* Allocate and fill in i/o channel descriptor. */ + if (chan = get_iochan(xim)) { + chan->xim = (XtPointer) xim; + chan->type = chan_port->type; + chan->datain = s; + chan->dataout = s; + chan->reference_frame = 1; + chan->version = 0; + chan->rf_p = &xim->frames[0]; + chan->id = xim_addInput (xim, s, xim_iisio, (XtPointer)chan); + } +} + + +/* XIM_DISCONNECTCLIENT -- Called to close a client connection when EOF is + * seen on the input port. Close the connection and free the channel + * descriptor. + */ +static void +xim_disconnectClient (chan) +register IoChanPtr chan; +{ + switch (chan->type) { + case IO_INET: + case IO_UNIX: + close (chan->datain); + if (chan->id) { + xim_removeInput (chan->xim, chan->id); + chan->id = NULL; + } + chan->type = 0; + break; + default: + break; + } +} + + +/* GET_IOCHAN --- Get an i/o channel descriptor. + */ +static IoChanPtr +get_iochan (xim) +register XimDataPtr xim; +{ + register IoChanPtr chan; + register int i; + + for (i=0; i < XtNumber(xim->chan); i++) + if (!xim->chan[i].type) + return (&xim->chan[i]); + + return (NULL); +} + + +/* XIM_IISIO -- Xt file i/o callback procedure, called when there is input + * pending on the data stream to the ximtool client. + */ +void +xim_iisio (chan, fd_addr, id_addr) +IoChanPtr chan; +int *fd_addr; +XtInputId *id_addr; +{ + register XimDataPtr xim = (XimDataPtr) chan->xim; + register MappingPtr mp = (MappingPtr) NULL; + register FrameBufPtr fb; + register int sum, i; + register short *p; + int datain = *fd_addr; + int dataout = chan->dataout; + int ndatabytes, nbytes, n, newframe, ntrys=0; + struct iism70 iis; + char buf[SZ_FIFOBUF]; + static int errmsg=0, bswap=0; + + + /* Initialize the debug output. */ + if (iis_debug == -1) + iis_debug = (getenv("DEBUG_IIS") != (char *)NULL); + + /* Get the IIS header. */ + if ((n = chan_read (datain, (char *)&iis, sizeof(iis))) < sizeof(iis)) { + if (n != 0) + fprintf (stderr, + "ximtool: command input read error, n=%d of %d, errno=%d\n", + n, sizeof(iis), errno); + if (n <= 0) + xim_disconnectClient (chan); + return; + } else if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + + /* Verify the checksum. If it fails swap the bytes and try again. + */ + for (;;) { + for (i=0, sum=0, p=(short *)&iis; i < 8; i++) + sum += *p++; + if ((sum & 0177777) == 0177777) + break; + + if (ntrys++) { + if (!errmsg++) { + fprintf (stderr, "ximtool: bad data header checksum\n"); + if (bswap) + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, "noswap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + fprintf (stderr, " swap:"); + for (i=0, p=(short *)&iis; i < 8; i++) + fprintf (stderr, " %6o", p[i]); + fprintf (stderr, "\n"); + } + break; + + } else { + bswap2 ((char *)&iis, (char *)&iis, sizeof(iis)); + bswap = !bswap; + } + } + + ndatabytes = -iis.thingct; + if (!(iis.tid & PACKED)) + ndatabytes *= 2; + + if (iis_debug) { + fprintf (stderr, + "subunit=%06o tid=%06o nbytes=%7d x=%06o y=%06o z=%06o t=%06o\n", + iis.subunit & 077, + iis.tid, + ndatabytes, + iis.x & 0177777, + iis.y & 0177777, + iis.z & 0177777, + iis.t & 0177777); + fflush (stderr); + } + + + switch (iis.subunit & 077) { + case FEEDBACK: + /* The feedback unit is used only to clear a frame. The + * xim_eraseFrame() procedure takes care of uncaching the + * mappings associated with this frame. + */ + newframe = decode_frameno (iis.z & 0177777); + xim_setReferenceFrame (chan, newframe); + if (newframe == chan->reference_frame) + xim_eraseFrame (xim, chan->reference_frame); + + /* ISM: Uncache all mappings associated with this frame. */ + fb = &xim->frames[newframe-1]; + for (i=0; i < fb->nmaps; i++) { + mp = &fb->mapping[i]; + if (mp->id) { + sprintf (buf, "uncache %d", mp->id); + ism_message (xim, "wcspix", buf); + wcspix_message (xim, buf); + mp->id = 0; + } + } + + /* Reset various counters for the new frame and release the + * mappings. + */ + fb->nmaps = 0; + fb->ctran.valid = 0; + objid[newframe-1] = 0; + fb->nmaps = 0; + + if (iis_debug) + fprintf (stderr, "erase frame %d - ref = %d\n", + newframe, chan->reference_frame); + break; + + case LUT: + /* Data mode writes to the frame lookup tables are not implemented. + * A command mode write to the LUT subunit is used to connect + * image memories up to the RGB channels, i.e., to select the frame + * to be displayed. We ignore any attempt to assign multiple + * frames to multiple color channels, and just do a simple frame + * select. + */ + if (iis.subunit & COMMAND) { + int frame, z, n; + short x[17]; + + if (chan_read (datain, (char *)x, ndatabytes) == ndatabytes) { + if (bswap) + bswap2 ((char *)x, (char *)x, ndatabytes); + + z = x[0]; + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + frame = max (1, n + 1); + if (frame > xim->nframes) { + if (frame <= MAX_FRAMES) { + set_fbconfig (chan, xim->fb_configno, frame); + if (iis_debug) + fprintf (stderr, "set_fbconfig (%d, %d)\n", + xim->fb_configno, frame); + } else { + fprintf (stderr, "ximtool warning: "); + fprintf (stderr, + "attempt to display nonexistent frame %d\n", + frame); + return; + } + } + + xim_setDisplayFrame (xim, frame); + if (iis_debug) + fprintf (stderr, "set_frame (%d)\n", frame); + return; + } + } + + case MEMORY: + /* Load data into the frame buffer. Data is assumed to be byte + * packed. + */ + if (iis.tid & IIS_READ) { + /* Read from the display. + */ + unsigned char *ip, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to read from. */ + xim_setReferenceFrame (chan, decode_frameno (iis.z & 0177777)); + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + if (x < 0 || x >= xim->width || y < 0 || y >= xim->height) { + fprintf (stderr, + "ximtool: attempted read out of bounds on framebuf\n"); + fprintf (stderr, + "read %d bytes at [%d,%d]\n", nbytes, x, y); + memset ((void *)iobuf, 0, nbytes); + } else { + int nx, ny; + + /********** OLD CODE ********* + GtReadPixels (xim->gt, chan->rf_p->raster, iobuf, 8, x, y, + min(xim->width-x,nbytes), max(1,nbytes/xim->width)); + ********** OLD CODE **********/ + + /* If the iis.t element is set, it will contain the width + ** of the subraster being read. In the old scheme we + ** assumed we were reading the entire width of the FB. + */ + if (iis.t > 0 && iis.t != ALLBITPL) { + nx = min (xim->width-x, iis.t); + ny = max (1, nbytes/iis.t); + } else { + nx = min (xim->width-x, nbytes); + ny = max (1, nbytes/xim->width); + } + GtReadPixels (xim->gt, chan->rf_p->raster, iobuf, 8, x, y, + nx, ny); + + if (iis_debug) + fprintf (stderr, + "read %d bytes at [%d,%d]\n", nbytes, x, y); + } + + /* Return the data from the frame buffer. */ + starttime = time(0); + for (nleft=nbytes, ip=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = chan_write (dataout, ip, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) { + fprintf (stderr, "XIMTOOL: timeout on write\n"); + break; + } + } else + ip += n; + } + + return; + + } else { + /* Write to the display. + */ + unsigned char *op, iobuf[SZ_IOBUF]; + int nbytes, nleft, n, x, y; + long starttime; + + /* Get the frame to be written into (encoded with a bit for + * each frame, 01 is frame 1, 02 is frame 2, 04 is frame 3, + * and so on). + */ + xim_setReferenceFrame (chan, decode_frameno (iis.z & 0177777)); + + nbytes = ndatabytes; + x = iis.x & XYMASK; + y = iis.y & XYMASK; + + /* Read the data into the frame buffer. + */ + starttime = time(0); + for (nleft=nbytes, op=iobuf; nleft > 0; nleft -= n) { + n = (nleft < SZ_FIFOBUF) ? nleft : SZ_FIFOBUF; + if ((n = chan_read (datain, op, n)) <= 0) { + if (n < 0 || (time(0) - starttime > IO_TIMEOUT)) { + fprintf (stderr, "XIMTOOL: timeout on read\n"); + break; + } + } else + op += n; + } + + if (x < 0 || x >= xim->width || y < 0 || y >= xim->height) { + fprintf (stderr, + "ximtool: attempted write out of bounds on framebuf\n"); + fprintf (stderr, + "write %d bytes at [%d,%d]\n", nbytes, x, y); + memset ((void *)iobuf, 0, nbytes); + } else { + int nx, ny; + + /********** OLD CODE ********* + GtWritePixels (xim->gt, chan->rf_p->raster, iobuf, 8, x, y, + min(xim->width-x,nbytes), max(1,nbytes/xim->width)); + ********** OLD CODE **********/ + + /* If the iis.t element is set, it will contain the width + ** of the subraster being written. In the old scheme we + ** assumed we were writing the entire width of the FB. + */ + if (iis.t > 0 && iis.t != ALLBITPL) { + nx = min (xim->width-x, iis.t); + ny = max (1, nbytes/iis.t); + } else { + nx = min (xim->width-x, nbytes); + ny = max (1, nbytes/xim->width); + } + GtWritePixels (xim->gt, chan->rf_p->raster, iobuf, 8, + x, y, nx, ny); + + if (iis_debug) + fprintf (stderr, "write %d bytes at x=%d, y=%d\n", + nbytes, x, y, nx, ny); + } + + return; + } + break; + + case WCS: + /* Read or write the WCS for a frame. The frame number to + * which the WCS applies is passed in Z and the frame buffer + * configuration in T. The client changes the frame buffer + * configuration in a WCS set. The WCS text follows the header + * as byte packed ASCII data. + */ + if (iis.tid & IIS_READ) { + /* Return the WCS for the referenced frame. + */ + char emsg[SZ_WCSBUF]; + char *text; + int frame, wcsnum; + + memset ((char *)emsg, 0, SZ_WCSBUF); + + if ((iis.x & 017777) && (iis.y & 017777)) { + /* This is a check by the client on our capabilities. + * Return with a version number which can be used by the + * client. However we write back using the old WCS + * buffer size for compatability. + */ + sprintf (text=emsg, "version=%d", IIS_VERSION); + chan->version = IIS_VERSION; + + chan_write (dataout, text, SZ_OLD_WCSBUF); + if (iis_debug) + fprintf (stderr, "version query wcs: %s\n",text); + + } else if ((iis.x & 017777) && (iis.t & 017777)) { + /* Return the buffer for a specified WCS number. + */ + CtranPtr ct = (CtranPtr) NULL; + FrameBufPtr fr = (FrameBufPtr) NULL; + int wcsnum = (iis.t & 017777); + register int i, j; + + + /* Decode the requested wcs number. */ + frame = decode_frameno (iis.z & 0177777); + + /* Search for the requested WCS number. */ + mp = (MappingPtr) NULL; + for (j=0; j < xim->nframes; j++) { + fr = &xim->frames[j]; + if (fr->frameno != frame) + continue; + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + if (mp->id == wcsnum) { + /* found the mapping */ + ct = &(mp->ctran); + goto map_found; + } + } + } + + /* Encode the WCS and mapping information. */ +map_found: if (ct) { + char wcs[SZ_WCSBUF], mapping[SZ_WCSBUF]; + + sprintf (wcs, "%s\n%f %f %f %f %f %f %f %f %d\n", + ct->imtitle, ct->a, ct->b, ct->c, ct->d, + ct->tx, ct->ty, ct->z1, ct->z2, ct->zt); + sprintf (mapping, "%s %f %f %d %d %d %d %d %d\n%s\n", + mp->region, mp->sx, mp->sy, mp->snx, mp->sny, + mp->dx, mp->dy, mp->dnx, mp->dny, mp->ref); + + strcpy (text=emsg, wcs); + strcat (text, mapping); + } else + strcpy (text=emsg, "[NOSUCHWCS]\n"); + + chan_write (dataout, text, SZ_WCSBUF); + + if (iis_debug) { + fprintf (stderr, "query specified wcs=%d frame=%d\n", + wcsnum, frame); + write (2, text, strlen (text)); + } + + } else { + frame = decode_frameno (iis.z & 0177777); + xim_setReferenceFrame (chan, frame); + + if (chan->rf_p->frameno <= 0) + strcpy (text=emsg, "[NOSUCHFRAME]\n"); + else + text = chan->rf_p->wcsbuf; + + if ((iis.x & 0777)) + chan_write (dataout, text, SZ_WCSBUF); + else + chan_write (dataout, text, SZ_OLD_WCSBUF); + + if (iis_debug) { + fprintf (stderr, "query wcs: frame = %d\n", frame); + write (2, text, strlen(text)); + } + } + + } else { + /* Set the WCS for the referenced frame. + */ + register CtranPtr ct; + int fb_config, frame, new_wcs = 0; + + frame = decode_frameno (iis.z & 0177777); + fb_config = (iis.t & 0777) + 1; + new_wcs = (iis.x & 0777); + + /* See if we need to change the frame buffer configuration, + * or allocate a new frame. + */ + if (fb_config != xim->fb_configno) + set_fbconfig (chan, fb_config, frame); + else if (frame > xim->nframes && frame <= MAX_FRAMES) + set_fbconfig (chan, xim->fb_configno, frame); + + /* Read in and set up the WCS. */ + xim_setReferenceFrame (chan, frame); + memset ((char *)buf, 0, SZ_WCSBUF); + if (chan_read (datain, buf, ndatabytes) == ndatabytes) + strncpy (chan->rf_p->wcsbuf, buf, + (new_wcs ? SZ_WCSBUF : SZ_OLD_WCSBUF)); + + if (iis_debug) { + fprintf (stderr, "set wcs:\n"); + write (2, buf, ndatabytes); + } + + strcpy (chan->rf_p->ctran.format, W_DEFFORMAT); + chan->rf_p->ctran.imtitle[0] = '\0'; + chan->rf_p->ctran.valid = 0; + ct = wcs_update (xim, chan->rf_p); + + /* If we're connected to an old-style client, disable the + * WCSPIX ISM, otherwise just let the GUI know it capable. + */ + wcspix_message (xim, (new_wcs ? "capable" : "disable")); + + /* Add the mapping information. */ + add_mapping (xim, ct, chan->rf_p->wcsbuf, + &xim->frames[chan->reference_frame-1]); + + xim_message (xim, "frameTitle", ct->imtitle); + } + return; + + case IMCURSOR: + /* Read or write the logical image cursor. This is an extension + * added to provide a high level cursor read facility; this is + * not the same as a low level access to the IIS cursor subunit. + * Cursor reads may be either nonblocking (immediate) or blocking, + * using the keyboard or mouse to terminate the read, and + * coordinates may be returned in either image (world) or frame + * buffer pixel coordinates. + */ + if (iis.tid & IIS_READ) { + /* Read the logical image cursor. In the case of a blocking + * read all we do is initiate a cursor read; completion occurs + * when the user hits a key or button. + */ + if (iis_debug) + fprintf (stderr, "read cursor position\n"); + if (iis.tid & IMC_SAMPLE) { + /* Sample the cursor position and return the cursor value + * on the output datastream encoded in a fixed size + * ascii buffer. + */ + int wcs = iis.z; + int raster, frame; + float sx, sy; + IoChanPtr sv_chan; + + /* Save the cursor channel so that sampled cursor reads + * can occur on one channel without affecting any + * interactive cursor reads in progress on another + * channel. + */ + sv_chan = xim->cursor_chan; + xim->cursor_chan = chan; + xim_getCursorPos (xim, &sx, &sy, &raster, &frame); + xim_retCursorVal (xim, sx, sy, frame, wcs, 0, ""); + xim->cursor_chan = sv_chan; + + } else { + /* Initiate a user triggered cursor read. */ + if (xim->cursor_chan) { + int frame = xim->cursor_chan->reference_frame; + xim_retCursorVal (xim, 0., 0., frame, 0, EOF, ""); + } + xim->cursor_chan = chan; + xim_cursorMode (xim, 1); + } + + } else { + /* Write (set) the logical image cursor position. */ + register CtranPtr ct; + int sx = iis.x, sy = iis.y; + float wx = sx, wy = sy; + int wcs = iis.z; + + if (iis_debug) + fprintf(stderr, "write cursor position: [%d,%d]\n", sx, sy); + if (wcs) { + ct = wcs_update (xim, xim->df_p); + if (ct->valid) { + if (abs(ct->a) > .001) + sx = (wx - ct->tx) / ct->a; + if (abs(ct->d) > .001) + sy = (wy - ct->ty) / ct->d; + } + } + + xim_setCursorPos (xim, sx, sy); + } + return; + + default: + /* Ignore unsupported command input. + */ + break; + } + + /* Discard any data following the header. */ + if (!(iis.tid & IIS_READ)) + for (nbytes = ndatabytes; nbytes > 0; nbytes -= n) { + n = (nbytes < SZ_FIFOBUF) ? nbytes : SZ_FIFOBUF; + if ((n = chan_read (datain, buf, n)) <= 0) { + if (iis_debug) + fprintf (stderr, + "discarding %d bytes following header:\n", n); + break; + } + } +} + + +/* XIM_IISIOMAP, XIM_IISCOLORMAP -- Set the iomap and colormap for a Gterm + * widget to emulate the color allocation scheme assumed by the imtool + * protocol. + * + * The nominal pixel mappings are as follows. + * + * Imtool Gterm Description + * + * 0 0 background + * 1 - 200 10-209 image data + * 201 210 cursor (white) + * 202 0 background (black) + * 203 1 white + * 204 2 red + * 205 3 green + * 206 4 blue + * 207 6 yellow + * 208 5 cyan + * 209 7 magenta + * 210 211 coral + * 211 212 maroon + * 212 213 orange + * 213 214 khaki + * 214 215 orchid + * 215 216 turquoise + * 216 217 violet + * 217 218 wheat + * + * The Gterm color allocation is the standard 10 static colors, followed by + * 200 dynamically allocated colors used to display image data, followed by + * a few additional colors. Only the block of 200 colors are subject to + * modification when the display is windowed or a new colortable is loaded. + * + * If the gterm widget is permitted a sufficient number of dynamic colors then + * pixels will be allocated as in the figure above. If there are too few + * colormap cells available to allocate all the colors then the image data + * region of gterm colormap space will be shrunk to make up the difference. + * The full set of static colors (imtool:201-217) are always allocated; it + * is the range 1-200 which is reduced if there are too few colors. The + * iomap always makes it appear to the client that the full range of 200 + * image levels and 17 static colors are available, even if the actual number + * of color cells available is less. + * + * The input arrays should be dimension of length 256. The number of + * iomap entries and number of RGB entries set is returned in the output + * variables iomap_len and rgb_len. + */ +xim_iisiomap (w, iomap, iomap_len) +register XtPointer w; +unsigned short *iomap; +int *iomap_len; +{ + register int i; + int first, nelem, maxelem; + int delta; + + GtQueryColormap (w, 0, &first, &nelem, &maxelem); + delta = min(maxelem,209) - 209; + + /* Set the iomap. */ + iomap[0] = 0; + for (i=1; i < 201; i++) + iomap[i] = (200 + delta) * (i-1) / 200 + first; + iomap[201] = first + 200 + delta; + for (i=0; i < 8; i++) + iomap[202+i] = i; + iomap[207] = 6; + iomap[208] = 5; + for (i=0; i < 8; i++) + iomap[210+i] = first + 201 + i + delta; + *iomap_len = 218; +} + + +/* xim_iiscolormap -- This is the gterm colormap for the IIS emulation, set + * before the IIS iomap is defined. The first colormap cell corresponds to + * first = gterm color 10. + */ +xim_iiscolormap (w, r, g, b, first, ngray, rgb_len) +register XtPointer w; +unsigned short *r, *g, *b; +int *first, *ngray, *rgb_len; +{ + register int i, j; + int nelem, maxelem; + int delta; + + GtQueryColormap (w, 0, first, &nelem, &maxelem); + delta = min(maxelem,209) - 209; + + /* Set the colormap. */ + for (i=0; i < 256; i++) + r[i] = g[i] = b[i] = 0; + for (i=0; i < 200 + delta; i++) + r[i] = g[i] = b[i] = (i * 255 / (200 + delta)); + + r[i] = 255; g[i] = 255; b[i] = 255; i++; /* 210=cursor */ + r[i] = 255; g[i] = 127; b[i] = 0; i++; /* 211=coral */ + r[i] = 142; g[i] = 35; b[i] = 107; i++; /* 212=maroon */ + r[i] = 204; g[i] = 50; b[i] = 50; i++; /* 213=orange */ + r[i] = 159; g[i] = 159; b[i] = 95; i++; /* 214=khaki */ + r[i] = 219; g[i] = 112; b[i] = 219; i++; /* 215=orchid */ + r[i] = 112; g[i] = 219; b[i] = 219; i++; /* 216=turquoise */ + r[i] = 159; g[i] = 95; b[i] = 159; i++; /* 217=violet */ + r[i] = 216; g[i] = 216; b[i] = 191; i++; /* 218=wheat */ + + /* Scale colormap values to 16 bits. */ + for (j=0; j < i; j++) { + r[j] <<= 8; + g[j] <<= 8; + b[j] <<= 8; + } + + *ngray = 200 + delta; + *rgb_len = i; +} + + +/* SET_FBCONFIG -- Set the frame buffer configuration, or add additional + * frames to the current configuration. + */ +static void +set_fbconfig (chan, config, frame) +IoChanPtr chan; +int config; +int frame; +{ + register XimDataPtr xim = (XimDataPtr) chan->xim; + register FrameBufPtr fb = &xim->frames[frame-1]; + register int i; + + if (config != xim->fb_configno) { + /* Change the frame buffer configuration. */ + xim_initialize (xim, config, + max (xim->fb_config[config-1].nframes, frame), 1); + + /* Reinitialize the tile framing if enabled. */ + if (xim->tileFrames) + xim_tileFrames (xim, xim->tileFramesList); + + /* Initialize the ISM to uncache all images when we change + * frame buffer configs. + */ + ism_message (xim, "wcspix", "initialize"); + + } else if (frame > xim->nframes) { + /* Add additional frames. */ + for (i=1; i <= frame; i++) { + fb = &xim->frames[i-1]; + if (fb->frameno != i) { + xim_initFrame (xim, i, frame, + &xim->fb_config[config-1], xim->memModel); + + /* If we're in tile mode, add the frame to the tile list + * and if needed resize the tile frames. + */ + if (xim->tileFrames) { + xim->tileFramesList |= (1 << (i-1)); + xim->nTileFrames++; + xim_tileFrames (xim, xim->tileFramesList); + } + } + } + } + + xim_setReferenceFrame (chan, frame); + if (frame != xim->display_frame) + xim_setDisplayFrame (xim, frame); +} + + +/* DECODE_FRAMENO -- Decode encoded IIS register frame number. + */ +static +decode_frameno (z) +register int z; +{ + register int n; + + /* Get the frame number, encoded with a bit for each frame, 01 is + * frame 1, 02 is frame 2, 04 is frame 3, and so on. + */ + if (!z) z = 1; + for (n=0; !(z & 1); z >>= 1) + n++; + + return (max (1, n + 1)); +} + + +/* XIM_RETCURSORVAL -- Return the cursor value on the output datastream to + * the client which requested the cursor read. + */ +xim_retCursorVal (xim, sx, sy, frame, wcs, key, strval) +register XimDataPtr xim; +float sx, sy; /* cursor screen coordinates */ +int frame; /* frame number */ +int wcs; /* nonzero if WCS coords desired */ +int key; /* keystroke used as trigger */ +char *strval; /* optional string value */ +{ + register CtranPtr ct; + register MappingPtr mp = (MappingPtr) NULL; + int dataout, wcscode; + char curval[SZ_IMCURVAL]; + char keystr[20]; + float wx, wy; + + if (xim->cursor_chan) + dataout = xim->cursor_chan->dataout; + else + return; + + /* Compute cursor coordinates. */ + if (wcs) { + ct = wcs_update (xim, xim->df_p); + if (ct->valid) { + /* The imtool WCS assumes that the center of the first display + * pixel is at (0,0) but actually it is at (0.5,0.5). + */ + sx -= 0.5; + sy -= 0.5; + + if (abs(ct->a) > .001) + wx = ct->a * sx + ct->c * sy + ct->tx; + if (abs(ct->d) > .001) + wy = ct->b * sx + ct->d * sy + ct->ty; + } + } else { + wx = sx; + wy = sy; + } + + /* Compute WCS code. */ + wcscode = frame * 100 + wcs; + if (wcspix_enabled != NULL && *wcspix_enabled) { + if ((mp = xim_getMapping (xim, sx, sy, frame))) { + wcscode = mp->id; + + /* Return the coordinates in terms of the mapping. */ + ct = &(mp->ctran); + wx = ct->a * sx + ct->c * sy + ct->tx; + wy = ct->b * sx + ct->d * sy + ct->ty; + } + } + + /* Encode the cursor value. */ + if (key == EOF) + sprintf (curval, "EOF\n"); + else { + if (isprint (key) && !isspace(key)) { + keystr[0] = key; + keystr[1] = '\0'; + } else + sprintf (keystr, "\\%03o", key); + + sprintf (curval, "%10.3f %10.3f %d %s %s\n", + wx, wy, wcscode, keystr, strval); + } + + + if (iis_debug) fprintf (stderr, "curval: %s", curval); + + /* Send it to the client program and terminate cursor mode. */ + chan_write (dataout, curval, sizeof(curval)); + xim_cursorMode (xim, 0); + xim->cursor_chan = NULL; +} + + +/* XIM_ENCODEWCS -- Transform the input screen (raster) coordinates and + * pixel value and return a string giving X, Y, and the pixel intensity in + * world units. + */ +xim_encodewcs (xim, sx, sy, sz, obuf) +register XimDataPtr xim; +float sx, sy; /* screen (raster) pixel coordinates */ +int sz; /* screen pixel value */ +char *obuf; /* receives encoded string */ +{ + register CtranPtr ct; + MappingPtr mp = (MappingPtr) NULL; + float wx, wy, wz; + float y = xim->height - sy; + register int j=0, i=0, ch, map_found = 0; + char buf[SZ_LINE]; + + + /* The first time we're called get the address of the wcspix + * connected flag so we can check whether to get screen pixel + * or real-image values. + */ + if (wcspix_enabled == NULL) { + register IsmModule ism; + extern ismModule ism_modules[]; + extern int ism_nmodules; + + for (i=0; i < ism_nmodules; i++) { + ism = &ism_modules[i]; + if (strcmp ("wcspix", ism->name) == 0) + wcspix_enabled = &(ism->connected); + } + } + + + /* Now lookup the coordinate mapping and update the WCS and real + * pixel value if the ISM is running. + */ + if (wcspix_enabled != NULL && *wcspix_enabled) { + if ((mp = xim_getMapping (xim, sx+1.0, sy, xim->display_frame))) { + ct = &(mp->ctran); + sx -= 0.5; + sy -= 0.5; + wx = ct->a * sx + ct->c * sy + ct->tx; + wy = ct->b * sx + ct->d * sy + ct->ty; + +/* +printf ("sx: %f sy: %f\n", sx, sy); +printf ("ct: %s\n%f %f %f %f %f %f %f %f %d\n", + ct->imtitle, ct->a, ct->b, ct->c, ct->d, + ct->tx, ct->ty, ct->z1, ct->z2, ct->zt); +printf ("mp: %s %f %f %d %d %d %d %d %d\n%s\n\n", + mp->region, mp->sx, mp->sy, mp->snx, mp->sny, + mp->dx, mp->dy, mp->dnx, mp->dny, mp->ref); +printf ("wx: %f wy: %f\n", wx, wy); +*/ + + /* Found the image mapping so request the WCS + * and pixel information from the WPIX ISM. + */ + if (mp->ref != NULL) { + sprintf (buf, "wcstran %d %g %g\n", mp->id, wx, wy); + ism_message (xim, "wcspix", buf); + } + map_found++; + } + } + + ct = wcs_update (xim, xim->df_p); + if (ct->valid) { + /* The imtool WCS assumes that the center of the first display + * pixel is at (0,0) but actually it is at (0.5,0.5). + */ + + wx = ct->a * sx + ct->c * sy + ct->tx; + wy = ct->b * sx + ct->d * sy + ct->ty; + + if (sz == 0) + wz = 0.0; + else { + switch (ct->zt) { + case W_LINEAR: + wz = ((sz - CMS_DATASTART) * (ct->z2 - ct->z1) / + (CMS_DATARANGE-1)) + ct->z1; + break; + default: + wz = sz; + break; + } + } + } else { + wx = sx; + wy = sy; + wz = sz; + } + + ch = ' '; + if (sz && ct->valid) { + if (ct->z1 < ct->z2) { + if (wz < (ct->z1 + 0.01)) + ch = '-'; + else if (wz > (ct->z2 - 0.01)) + ch = '+'; + } else if (ct->z1 > ct->z2) { + if (wz < (ct->z2 + 0.01)) + ch = '-'; + else if (wz > (ct->z1 - 0.01)) + ch = '+'; + } + } + sprintf (obuf, ct->format, wx + 0.005, wy + 0.005, wz, ch); +} + + +/* XIM_GETMAPPING -- Return the mapping struct for the given screen coords. + */ +static MappingPtr +xim_getMapping (xim, sx, sy, frame) +register XimDataPtr xim; +float sx, sy; /* screen (raster) pixel coordinates */ +int frame; +{ + FrameBufPtr fb = (FrameBufPtr) NULL; + MappingPtr mp = (MappingPtr) NULL; + register int j=0, i=0; + float y = xim->height - sy; + char buf[SZ_LINE]; + register map_debug = 0; + + + /* Loop through the frame buffers until we find the current one. + * The mappings aren't stored in the display fb so we need to + * search. + */ + for (j=0; j < xim->nframes; j++) { + fb = &xim->frames[j]; + + if (frame == fb->frameno) { + /* Got the right frame, now search for mappings on this + * frame which intersect the screen coords. We assume there + * are no overlapping image mappings. + */ + for (i=0; i < fb->nmaps; i++) { + mp = &fb->mapping[i]; + if (map_debug) { + printf ("%d: sx=%.2f sy=%.2f / %.2f --> ",i,sx,sy,y); + printf ("mp->dx=%d+%d=%d mp->dy=%d+%d=%d", + mp->dx, mp->dnx, mp->dx+mp->dnx, + mp->dy, mp->dny, mp->dy+mp->dny); + } + if ((sx >= mp->dx && sx <= (mp->dx + mp->dnx)) && + ( y >= mp->dy && y <= (mp->dy + mp->dny))) { + if (map_debug) printf (" YES\n"); + return (mp); + } + if (map_debug) printf (" NO\n"); + } + } + } + + return ((MappingPtr) NULL); +} + + +/* XIM_FRAMELABEL -- Return a pointer to the frame label string for the current + * frame. + */ +char * +xim_frameLabel (xim) +register XimDataPtr xim; +{ + register FrameBufPtr df_p = xim->df_p; + + sprintf (df_p->label, "[%d] %s", df_p->frameno, df_p->ctran.imtitle); + return (df_p->label); +} + + +/* WCS_UPDATE -- Load the screen WCS, if not yet validated, from the user + * wcs file, if any. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". Mapping information is parsed + * elsewhere if needed, our only purpose here is to extract the frame WCS. + */ +static CtranPtr +wcs_update (xim, fr) +register XimDataPtr xim; +FrameBufPtr fr; +{ + register CtranPtr ct = &fr->ctran; + char buf[1024], *format; + + + /* Get the new WCS. */ + if (!ct->valid) { + fr->label[0] = '\0'; + ct->zt = W_UNITARY; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (fr->wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (fr->wcsbuf[0]) + fprintf (stderr, "ximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->valid++; + } + + /* Determine best format for wcs output. */ + if (ct->valid && ct->zt == W_LINEAR) { + float z1, z2, zrange; + z1 = ct->z1; + z2 = ct->z2; + zrange = (z1 > z2) ? z1 - z2 : z2 - z1; + if (zrange < 0.01 || (abs(z1) + abs(z2)) / 2.0 < 0.01) + format = " %7.2f %7.2f %9.3g%c"; + else if (zrange < 100.0 && (abs(z1) + abs(z2)) / 2.0 < 200.0) + format = " %7.2f %7.2f %7.3f%c"; + else if (zrange > 99999.0 || (abs(z1) + abs(z2)) / 2.0 > 99999.0) + format = " %7.2f %7.2f %9.3g%c"; + else + format = W_DEFFORMAT; + } else + format = " %7.2f %7.2f %7.0f%c"; + + strcpy (ct->format, format); + return (ct); +} + + +/* ADD_MAPPING -- Add a mapping for the current frame. + * + * File format (two lines): + * + * image title (imtool header label string)\n + * a b c d tx ty z1 z2 zt \n + * region_name sx sy snx sny dx dy dnx dny\n + * object_ref + * + * The WCS text is passed in via the data stream as a write to the subunit + * WCS and left in the buffer "wcsbuf". Mapping information is parsed + * elsewhere if needed, our only purpose here is to extract the frame WCS. + */ + +static void +add_mapping (xim, ctran, wcsbuf, fr) +register XimDataPtr xim; +CtranPtr ctran; +char *wcsbuf; +FrameBufPtr fr; +{ + register MappingPtr mp = &fr->mapping[fr->nmaps]; + register CtranPtr ct = &mp->ctran; + register int i, j, frame = fr->frameno; + char buf[SZ_WCSBUF], *format; + + /* Attempt to read the WCS and set up a unitary transformation + * if the information cannot be read. + */ + if (sscanf (wcsbuf, "%[^\n]\n%f%f%f%f%f%f%f%f%d", + buf, &ct->a, &ct->b, &ct->c, &ct->d, &ct->tx, &ct->ty, + &ct->z1, &ct->z2, &ct->zt) < 7) { + + if (wcsbuf[0]) + fprintf (stderr, "ximtool: error decoding WCS\n"); + + strncpy (ct->imtitle, "[NO WCS]\n", SZ_IMTITLE); + ct->a = ct->d = 1; + ct->b = ct->c = 0; + ct->tx = ct->ty = 0; + ct->zt = W_UNITARY; + } else + strncpy (ct->imtitle, buf, SZ_IMTITLE); + + ct->valid = 1; + + + /* Skip over the first two lines of WCS data. + */ + strcpy (buf, wcsbuf); + for (i=0, j=0; j < 2 && buf[i]; i++) + if (buf[i] == '\n') + j++; + + /* Attempt to read the mapping. + */ + mp->regid = (++objid[frame-1]) + (frame * 100); + mp->id = mp->regid; + mp->ref[0] = '\0'; + mp->region[0] = '\0'; + + if (sscanf (&buf[i], "%s%f%f%d%d%d%d%d%d\n%s\n", + mp->region, &mp->sx, &mp->sy, &mp->snx, &mp->sny, + &mp->dx, &mp->dy, &mp->dnx, &mp->dny, mp->ref) < 10) { + + if (!wcsbuf[0]) + fprintf (stderr, "ximtool: error decoding WCS mapping\n"); + strncpy (mp->region, "none", SZ_IMTITLE); + strncpy (mp->ref, "none", SZ_IMTITLE); + + mp->sx = 1.0; + mp->sy = 1.0; + mp->snx = xim->width; + mp->sny = xim->height; + mp->dx = 1; + mp->dy = 1; + mp->dnx = xim->width; + mp->dny = xim->height; + } + memmove (ctran, &mp->ctran, sizeof (Ctran)); + + + /* Tell the ISM to cache this mapping if we have an object ref. */ + sprintf (buf, "cache %s %d", mp->ref, mp->id); + ism_message (xim, "wcspix", buf); + sprintf (buf, "wcslist %d", mp->id); + ism_message (xim, "wcspix", buf); + + /* Send the object ref to the GUI. */ + sprintf (buf, "cache %s %d %d", mp->ref, fr->frameno, mp->id); + wcspix_message (xim, buf); + sprintf (buf, "orient %d %d %d %d", + mp->id, fr->frameno, (int)ctran->a, (int)(-1 * ctran->d)); + wcspix_message (xim, buf); + + fr->nmaps++; + + + /* Debug the mappings. */ + if (getenv("DEBUG_MAPPINGS") != NULL) print_mappings (fr); +} + + +/* PRINT_MAPPINGS -- Debug routine to print all mappings on a frame. + */ +print_mappings (fr) +FrameBufPtr fr; +{ + MappingPtr mp; + register int i; + + if (fr->nmaps == 0) printf ("No mappings for frame %d\n", fr->frameno); + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + printf ("Mapping %d of %d: id=%d frame=%d:\n", + i+1, fr->nmaps, mp->id, fr->frameno); + printf ("\t%s %f %f %d %d %d %d %d %d\n\t%s\n", + mp->region, mp->sx, mp->sy, mp->snx, mp->sny, + mp->dx, mp->dy, mp->dnx, mp->dny, mp->ref); + } +} + + +/* CHAN_READ -- Read exactly "n" bytes from a descriptor. + */ + +static int +chan_read (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +{ + char *ptr = vptr; + int nread = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = read(fd, ptr, nleft)) < 0) { + if (errno == EINTR) + nb = 0; /* and call read() again */ + else + return(-1); + } else if (nb == 0) + break; /* EOF */ + nleft -= nb; + ptr += nb; + nread += nb; + } + return (nread); /* return no. of bytes read */ +} + + +/* CHAN_WRITE -- Write exactly "n" bytes to a descriptor. + */ + +static int +chan_write (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +{ + char *ptr = vptr; + int nwritten = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = write(fd, ptr, nleft)) <= 0) { + if (errno == EINTR) + nb = 0; /* and call write() again */ + else + return(-1); /* error */ + } + nleft -= nb; + ptr += nb; + nwritten += nb; + } + return (nwritten); +} diff --git a/vendor/x11iraf/ximtool/iis.h b/vendor/x11iraf/ximtool/iis.h new file mode 100644 index 00000000..9689957e --- /dev/null +++ b/vendor/x11iraf/ximtool/iis.h @@ -0,0 +1,18 @@ +/* IIS.H -- Public definitions for the IIS protocol module. + */ + +/* IIS data pixel values. */ +#define CMS_DATASTART 1 +#define CMS_DATAEND 200 +#define CMS_DATARANGE 200 + +/* IIS color assignments. */ +#define CMS_CURSOR 201 +#define CMS_BACKGROUND 202 +#define CMS_FOREGROUND 203 +#define CMS_RED 204 +#define CMS_GREEN 205 +#define CMS_BLUE 206 +#define CMS_YELLOW 207 +#define CMS_CYAN 208 +#define CMS_MAGENTA 209 diff --git a/vendor/x11iraf/ximtool/irafio.c b/vendor/x11iraf/ximtool/irafio.c new file mode 100644 index 00000000..e90ec507 --- /dev/null +++ b/vendor/x11iraf/ximtool/irafio.c @@ -0,0 +1,585 @@ +/* + * IRAF.C -- Routines to load and save simple IRAF files. + * + * ival = isIRAF (fname) + * loadIRAF (fname, pixels, w,h, r,g,b, ncolors, zsc, zr, z1, z2, nsample) + * + * isIRAF -- returns nonzero if the named file is a IRAF file. + * loadIRAF -- reads a IRAF file and returns the decoded pixel array and gray- + * scale 8 bit colormap. The caller is responsible for freeing + * the pixels buffer. + */ + + +#include <stdio.h> +#include <math.h> +#ifdef ULTRIX +#include <sys/types.h> +#endif +#include <unistd.h> + + +#define VERSION_1 1 +#define VERSION_2 2 + +/* Image header parmeters. */ +#define SZ_V1PIXFILE 79 +#define SZ_V1HDR 2048 +#define SZ_V1TITLE 79 + +/* Offsets into header (in sizeof(int) units) for various parameters */ +#define IM_V1PIXTYPE 4 /* datatype of the pixels */ +#define IM_V1NDIM 5 /* number of dimensions */ +#define IM_V1LEN 6 /* image dimensions */ +#define IM_V1PHYSLEN 13 /* physical length (as stored) */ +#define IM_V1PIXOFF 22 /* offset of the pixels */ +#define IM_V1PIXFILE 103 /* name of pixel storage file */ +#define IM_V1TITLE 183 /* image title string */ + +/* Image header parmeters. */ +#define SZ_V2PIXFILE 255 +#define SZ_V2HDR 2046 +#define SZ_V2TITLE 732 + +/* Offsets into header (in sizeof(int) units) for various parameters */ +#define IM_V2PIXTYPE 10 /* datatype of the pixels */ +#define IM_V2SWAPPED 14 /* number of dimensions */ +#define IM_V2NDIM 18 /* number of dimensions */ +#define IM_V2LEN 22 /* image dimensions */ +#define IM_V2PHYSLEN 50 /* physical length (as stored) */ +#define IM_V2PIXOFF 86 /* offset of the pixels */ +#define IM_V2PIXFILE 126 /* name of pixel storage file */ +#define IM_V2TITLE 638 /* image title string */ + +/* IRAF dataype codes */ +#define TY_CHAR 2 +#define TY_SHORT 3 +#define TY_INT 4 +#define TY_LONG 5 +#define TY_REAL 6 +#define TY_DOUBLE 7 +#define TY_USHORT 11 +#define TY_UCHAR 12 + +#define CONTRAST 0.25 /* zscaling parameters */ +#define NSAMPLE 1000 + + +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + +/* Function prototypes */ +#ifdef __STDC__ + +#include <stddef.h> +#include <stdlib.h> + +#else + +#endif + +char *index(); +char *getIRAFHdr(); + +static char *irafReadPixels(); +static void irafGetPixfile (); + + +/* +------------------+ + * | Public routines. | + * +------------------+ + */ + + +/* loadIRAF - Load a IRAF file. + */ +char * +loadIRAF (fname, image, nx, ny, r,g,b, ncolors, zsc, zr, z1, z2, nsample) +char *fname; /* input filename */ +uchar **image; /* output pixels */ +int *nx, *ny; /* dimensions */ +uchar *r, *g, *b; /* colormap */ +int *ncolors; /* number of colors */ +int zsc, zr; /* z-scaling flags */ +float *z1, *z2; /* zscale values */ +int nsample; /* nu,ber of sample pts */ +{ + FILE *hdr; + int i, len, px, py, version, swapped; + int ptype, offset; + char temp[SZ_V1PIXFILE], *ip; + char path[SZ_V1PIXFILE]; + + /* Get the format version. */ + version = isIRAF (fname); + + if ((hdr = fopen (fname, "r")) == NULL) + return "cannot open image"; + + if (version == VERSION_1) { + int header_v1[SZ_V1HDR]; + char pixfile_v1[SZ_V1PIXFILE]; + + + /* Read in the image header. */ + fread ((char *)header_v1, sizeof (char), SZ_V1HDR, hdr); + + /* Get the interesting stuff. */ + px = header_v1[IM_V1PHYSLEN]; + py = header_v1[IM_V1PHYSLEN+1]; + *nx = header_v1[IM_V1LEN]; + *ny = header_v1[IM_V1LEN+1]; + ptype = header_v1[IM_V1PIXTYPE]; + offset = (header_v1[IM_V1PIXOFF] - 1) * sizeof(short); + + /* Find the pixfile and see if it exists. */ + strpak ((char *)&header_v1[IM_V1PIXFILE], pixfile_v1, SZ_V1PIXFILE); + irafGetPixfile (fname, pixfile_v1); + if (access (pixfile_v1, R_OK) != 0) { + fclose (hdr); + return "Cannot access pixel file"; + } + + /* Now read the data and return a pointer to the scaled pixels. */ + irafReadPixels (pixfile_v1, 0, offset, ptype, image, + *nx, *ny, px, py, zsc, zr, z1, z2, nsample); + + } else if (version == VERSION_2) { + char header_v2[SZ_V2HDR]; + char pixfile_v2[SZ_V2PIXFILE]; + + + /* Read in the image header. */ + fread ((char *)header_v2, sizeof (char), SZ_V2HDR, hdr); + + /* Get the interesting stuff. */ + if (is_swapped()) + bswap4 (&header_v2[IM_V2SWAPPED], 1, &swapped, 1, sizeof(int)); + else + bcopy ((char *)&header_v2[IM_V2SWAPPED], &swapped, sizeof(int)); + + if (is_swapped()) { + bswap4 (&header_v2[IM_V2PHYSLEN], 1, &px, 1, sizeof(int)); + bswap4 (&header_v2[IM_V2PHYSLEN+sizeof(int)], 1, &py, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2LEN], 1, nx, 1, sizeof(int)); + bswap4 (&header_v2[IM_V2LEN+sizeof(int)], 1, ny, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2PIXTYPE], 1, &ptype, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2PIXOFF], 1, &offset, 1, + sizeof(int)); + } else { + bcopy ((char *)&header_v2[IM_V2PHYSLEN], &px, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PHYSLEN+sizeof(int)], &py, + sizeof(int)); + bcopy ((char *)&header_v2[IM_V2LEN], nx, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2LEN+sizeof(int)], ny, + sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PIXTYPE], &ptype, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PIXOFF], &offset, sizeof(int)); + } + offset = (offset - 1) * sizeof(short); + + /* Find the pixfile and see if it exists. */ + bcopy ((char *)&header_v2[IM_V2PIXFILE], pixfile_v2, SZ_V2PIXFILE); + irafGetPixfile (fname, pixfile_v2); + if (access (pixfile_v2, R_OK) != 0) { + fclose (hdr); + return "Cannot access pixel file"; + } + + /* Now read the data and return a pointer to the scaled pixels. + */ + irafReadPixels (pixfile_v2, + (swapped != is_swapped()), + offset, ptype, image, *nx, *ny, px, py, + zsc, zr, z1, z2, nsample); + } + + /* Set the (grayscale) colormap. */ + for (i=0; i<256; i++) + r[i] = g[i] = b[i] = i; + *ncolors = 256; + + fclose (hdr); /* we're done with the header */ + return NULL; +} + + +/* IsIRAF -- Test a file to see if it is a IRAF file. + */ +int +isIRAF (fname) +char *fname; /* input filename */ +{ + register FILE *fp; + int value = 0; + char magic[24]; + + if (fp = fopen (fname, "r")) { + fread ((char *)magic, sizeof (char), 12, fp); + fclose (fp); + + /* See if this is a valid OIF header file. */ + if (strncmp(magic, "imhv2", 5) == 0) + value = 2; + else { + strpak (magic, magic, 5); + if (strncmp(magic, "imhdr", 5) == 0) + value = 1; + } + return value; + } + + return value; +} + + +/* getIRAFHdr -- Get some set of header information for the GUI. + */ + +char * +getIRAFHdr (fname) +char *fname; +{ + FILE *hdr; + char *error, *title, *line; + int i, bitpix, len, nx, ny, version, swapped, ptype; + + + /* Get the format version. */ + version = isIRAF (fname); + + if ((hdr = fopen (fname, "r")) == NULL) + return ((char *)NULL); + + if (version == VERSION_1) { + int header_v1[SZ_V1HDR]; + char pixfile_v1[SZ_V1PIXFILE]; + char title_v1[SZ_V1TITLE]; + + + /* Read in the image header. */ + fread ((char *)header_v1, sizeof (char), SZ_V1HDR, hdr); + + /* Get the interesting stuff. */ + nx = header_v1[IM_V1LEN]; + ny = header_v1[IM_V1LEN+1]; + ptype = header_v1[IM_V1PIXTYPE]; + + bcopy ((char *)&header_v1[IM_V1TITLE], title_v1, SZ_V1TITLE); + strpak ((char *)&header_v1[IM_V1TITLE], title_v1, SZ_V1TITLE); + + title = (char *) malloc (SZ_V1TITLE); + strncpy (title, title_v1, SZ_V1TITLE); + + } else if (version == VERSION_2) { + char header_v2[SZ_V2HDR]; + char pixfile_v2[SZ_V2PIXFILE]; + char title_v2[SZ_V2TITLE]; + + + /* Read in the image header. */ + fread ((char *)header_v2, sizeof (char), SZ_V2HDR, hdr); + + /* Get the interesting stuff. */ + if (is_swapped()) + bswap4 (&header_v2[IM_V2SWAPPED], 1, &swapped, 1, sizeof(int)); + else + bcopy ((char *)&header_v2[IM_V2SWAPPED], &swapped, sizeof(int)); + + if (is_swapped()) { + bswap4 (&header_v2[IM_V2LEN], 1, &nx, 1, sizeof(int)); + bswap4 (&header_v2[IM_V2LEN+sizeof(int)], 1, &ny, 1, + sizeof(int)); + bswap4 (&header_v2[IM_V2PIXTYPE], 1, &ptype, 1, + sizeof(int)); + } else { + bcopy ((char *)&header_v2[IM_V2LEN], &nx, sizeof(int)); + bcopy ((char *)&header_v2[IM_V2LEN+sizeof(int)], &ny, + sizeof(int)); + bcopy ((char *)&header_v2[IM_V2PIXTYPE], &ptype, sizeof(int)); + } + + bcopy ((char *)&header_v2[IM_V2TITLE], title_v2, SZ_V2TITLE); + title = (char *) malloc (SZ_V2TITLE); + strncpy (title, title_v2, SZ_V2TITLE/2); + } + fclose (hdr); /* we're done with the header */ + + + /* Convert the pixel type flag to a BITPIX value. */ + switch (ptype) { + case 2: bitpix = 16; break; /* TY_CHAR */ + case 3: bitpix = 16; break; /* TY_SHORT */ + case 4: bitpix = 32; break; /* TY_INT */ + case 5: bitpix = 64; break; /* TY_LONG */ + case 6: bitpix = -32; break; /* TY_REAL */ + case 7: bitpix = -64; break; /* TY_REAL */ + default: bitpix = 0; break; /* Error */ + } + + /* Format the header string. */ + line = (char *) malloc (80); + + sprintf (line, "%-16.16s %3d %5dx%-5d %s", + fname, bitpix, nx, ny, title); + + free ((char *)title); + return (line); +} + + + +/* ------------------ + * Private routines. + * ------------------ + */ + +#undef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define min(a,b) ((a) < (b) ? (a) : (b)) + + + +/* IRAFGETPIXFILE -- Get the pixelfile pathname. + */ + +static void +irafGetPixfile (fname, pfile) +char *fname; +char *pfile; +{ + char temp[SZ_V1PIXFILE], *ip; + int len; + char *index(); + + if (strncmp (pfile, "HDR$", 4) == 0) { + /* Handle the special case of a HDR$ pixfile path, prepend the + * current working directory name to the pixfile. + */ + ip = pfile + 4; + (void) strncpy (temp, ip, SZ_V1PIXFILE); + (void) strncpy (pfile, fname, SZ_V1PIXFILE); + + /* Find the end of the pathname. */ + len = strlen (pfile); + while ( (len > 0) && (pfile[len-1] != '/') ) + len--; + + /* Add the image name. */ + pfile[len] = '\0'; + (void) strncat (pfile, temp, SZ_V1PIXFILE); + + } else if (index (pfile, '!') != NULL) { + /* Strip out the leading node! prefix from the pixfile path. */ + for (ip = pfile; *ip != '!' ; ) + ip++; + (void) strcpy (pfile, ++ip); + } +} + + +/* IRAFREADPIXELS -- Read the pixel file and scale the data. + */ + +static char * +irafReadPixels (pixfile, swap, pix_offset, pixtype, image, nx,ny, px,py, + zsc, zr, z1, z2, nsample) +char *pixfile; /* pixfile pathname */ +int swap; /* byte-swap pixels */ +int pix_offset; /* offset to pixel data */ +int pixtype; /* pixel types */ +uchar **image; /* output image pixels */ +int nx, ny; /* image dimensions */ +int px, py; /* physical storage dims */ +int zsc, zr; /* z-scaling flags */ +float *z1, *z2; +int nsample; +{ + FILE *fd; + register int i, j, npix, stdline; + register float scale; + uchar *line; + unsigned short *uspix, *usline; + short *spix, *sline; + int *ipix, *iline; + float *fpix, *fline; + double *dpix, *dline; + + + /* Open the pixel file and seek to the beginning of the data. */ + fd = fopen (pixfile, "r"); + lseek (fileno(fd), (off_t)pix_offset, SEEK_SET); + + /* Allocat the pointer for the pixels. */ + npix = nx * ny; + *image = (uchar *) malloc (npix * sizeof (uchar)); + + stdline = (int) ((float)ny / sqrt(((double)npix / (double)nsample)) ); + + switch (pixtype) { + case TY_USHORT: + uspix = (unsigned short *) malloc (npix * sizeof (unsigned short)); + usline = (unsigned short *) malloc (px * sizeof (unsigned short)); + for (i=0; i<ny; i++) { + fread ((char *)usline, sizeof (unsigned short), px, fd); + for (j=0; j<nx; j++) + uspix[i*nx+j] = usline[j]; + } + free ((unsigned short *)usline); + + if (swap) + bswap2 ((char *)uspix, (char *)uspix, nx * ny * sizeof(short)); + + /* Do the zscale of the image. */ + if (zsc) + zscale ((char *)uspix, nx, ny, 16, z1, z2, + CONTRAST, nsample, stdline); + else if (zr) + min_max ((char *)uspix, npix, 16, z1, z2); + + /* rescale and convert */ + scale = (*z2 == *z1) ? 0. : 255. / (*z2 -*z1); + for (i = 0; i < npix; i++) + (*image)[i] = max (0, min (255, + (int)(scale * (float)((int)uspix[i] - *z1)) )); + + free ((unsigned short *)uspix); + break; + + case TY_SHORT: + spix = (short *) malloc (npix * sizeof (short)); + sline = (short *) malloc (px * sizeof (short)); + for (i=0; i<ny; i++) { + fread ((char *)sline, sizeof (short), px, fd); + for (j=0; j<nx; j++) + spix[i*nx+j] = sline[j]; + } + free ((short *)sline); + + if (swap) + bswap2 ((char *)spix, (char *)spix, nx * ny * sizeof(short)); + + /* Do the zscale of the image. */ + if (zsc) + zscale ((char *)spix, nx, ny, 16, z1, z2, + CONTRAST, nsample, stdline); + else if (zr) + min_max ((char *)spix, npix, 16, z1, z2); + + /* rescale and convert */ + scale = (*z2 == *z1) ? 0. : 255. / (*z2 -*z1); + for (i = 0; i < npix; i++) + (*image)[i] = max (0, min (255, + (int)(scale * (float)((int)spix[i] - *z1)) )); + + free ((short *)spix); + break; + + case TY_INT: + case TY_LONG: + ipix = (int *) malloc (npix * sizeof (int)); + iline = (int *) malloc (px * sizeof (int)); + for (i=0; i<ny; i++) { + fread ((char *)iline, sizeof (int), px, fd); + for (j=0; j<nx; j++) + ipix[i*nx+j] = iline[j]; + } + free ((int *)iline); + + if (swap) + bswap4((char *)ipix, 1, (char *)ipix, 1, nx * ny * sizeof(int)); + + /* Do the zscale of the image. */ + if (zsc) + zscale ((char *)ipix, nx, ny, 32, z1, z2, + CONTRAST, nsample, stdline); + else if (zr) + min_max ((char *)ipix, npix, 32, z1, z2); + + /* rescale and convert */ + scale = (*z2 == *z1) ? 0. : 255. / (*z2 -*z1); + for (i = 0; i < npix; i++) + (*image)[i] = max (0, min (255, + (int)(scale * (float)((int)ipix[i] - *z1)) )); + + free ((int *)ipix); + break; + + case TY_REAL: + fpix = (float *) malloc (npix * sizeof (float)); + fline = (float *) malloc (px * sizeof (float)); + for (i=0; i<ny; i++) { + fread ((char *)fline, sizeof (float), px, fd); + for (j=0; j<nx; j++) + fpix[i*nx+j] = fline[j]; + } + free ((float *)fline); + + if (swap) + bswap4((char *)fpix, 1, (char *)fpix, 1, + nx * ny * sizeof(float)); + + /* Do the zscale of the image. */ + if (zsc) + zscale ((char *)fpix, nx, ny, -32, z1, z2, + CONTRAST, nsample, stdline); + else if (zr) + min_max ((char *)fpix, npix, -32, z1, z2); + + /* rescale and convert */ + scale = (*z2 == *z1) ? 0. : 255. / (*z2 -*z1); + for (i = 0; i < npix; i++) + (*image)[i] = max (0, min (255, + (int)(scale * (float)(fpix[i] - *z1)) )); + + free ((float *)fpix); + break; + + case TY_DOUBLE: + dpix = (double *) malloc (npix * sizeof (double)); + dline = (double *) malloc (px * sizeof (double)); + for (i=0; i<ny; i++) { + fread ((char *)dline, sizeof (double), px, fd); + for (j=0; j<nx; j++) + dpix[i*nx+j] = dline[j]; + } + free ((double *)dline); + + if (swap) + bswap8((char *)dpix, 1, (char *)dpix, 1, + nx * ny * sizeof(double)); + + /* Do the zscale of the image. */ + if (zsc) + zscale ((char *)dpix, nx, ny, -64, z1, z2, + CONTRAST, nsample, stdline); + else if (zr) + min_max ((char *)dpix, npix, -64, z1, z2); + + /* rescale and convert */ + scale = (*z2 == *z1) ? 0. : 255. / (*z2 -*z1); + for (i = 0; i < npix; i++) + (*image)[i] = max (0, min (255, + (int)(scale * (float)(dpix[i] - *z1)) )); + + free ((double *)dpix); + break; + + default: + fclose (fd); + return "invalid pixel type in image"; + } + + /* Flip the image so it's displayed correctly. */ + flip (*image, nx, ny); + + fclose (fd); + return NULL; +} diff --git a/vendor/x11iraf/ximtool/ism.c b/vendor/x11iraf/ximtool/ism.c new file mode 100644 index 00000000..ec9d6b62 --- /dev/null +++ b/vendor/x11iraf/ximtool/ism.c @@ -0,0 +1,706 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/errno.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/tcp.h> +#include <fcntl.h> +#include <sys/un.h> + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <Tcl/tcl.h> +#include <Obm.h> +#include <ObmW/Gterm.h> +#include "ximtool.h" + +/* + * ISM.C -- IRAF Image Support Module (ISM) routines. + * + * xim_ismOpen (xim) + * xim_ismClose (xim) + * + * ism_connectClient (chan_port, source, id) + * ism_disconnectClient (chan) + * ism_io (chan, fd_addr, id_addr) + * + * ism_execute (xim, task) + * ism_evaluate (object, command) + * + * ism_openSocket (path) + * ism_read (fd, ptr, nbytes) + * ism_write (fd, ptr, nbytes) + */ + + + +#define CALLBACK 0 +#define QUIT 1 +#define SEND 2 +#define READY 3 + + +#define MAXCONN 5 +#define MAX_TRY 5 + +void xim_ismOpen(), xim_ismClose(); +IsmModule ismNameToPtr(); + +static void ism_connectClient(), ism_disconnectClient(), ism_io(); +static int ism_read(), ism_write(), ism_type(), ism_parseSend(); +static int ism_openSocket(); +static IsmIoChanPtr ism_getChannel(); +static char *ism_parse(); + +static int ism_debug = 0; +extern int errno; + + +/* WCS/Pixel ISM client callbacks. + */ +#define WCSPIX_CMD DEF_ISM_CMD + +void wcspix_connect(), wcspix_disconnect(), wcspix_command(); + + +/* Definitions for the supported ISM Modules. */ +int ism_nmodules = 0; + +ismModule ism_modules[] = { + {"wcspix", WCSPIX_CMD, wcspix_connect, wcspix_disconnect, wcspix_command, 0}, +}; + + + +/* XIM_ISMOPEN -- Initialize the ISM protocol module and ready the module to + * accept client connections and begin processing client requests. This + * procedure only opens the ISM connection port, once clients are connected + * they negotiate for a separate channel and I/O resumes there. Once, + * connected, the client disconnects from this port and it is free to be used + * by another client. Unix sockets are used since we only want to connect to + * local processes and we want to use the uid for a unique address. + */ +void +xim_ismOpen (xim) +register XimDataPtr xim; +{ + register int s = 0; + register IsmIoChanPtr chan = &(xim->ism_chan); + char path[SZ_FNAME], *ism_path; + + + if (getenv("DEBUG_ISM") != NULL) + ism_debug = atoi(getenv("DEBUG_ISM")); + + /* Setting the addr to "none" or the null string disables ISM + * socket support. + */ + if (!xim->ism_addr[0] || strcmp(xim->ism_addr,"none")==0) + return ; + + /* Get path to be used for the unix domain socket. */ + if ((ism_path = getenv ("ISMDEV")) != NULL) { + char *dev = ism_path; + + while (1) { + if (*dev == (char)NULL) { + dev = ism_path; + break; + } else if (*dev == ':') { + ++dev; + break; + } + dev++; + } + sprintf (path, dev, getuid()); + } else + sprintf (path, xim->ism_addr, getuid()); + unlink (path); + + if ((s = ism_openSocket (path))) { + /* Fill in i/o channel descriptor. */ + chan->xim = (XtPointer) xim; + chan->datain = s; + chan->dataout = s; + chan->connected = 0; + strncpy (chan->name, "", SZ_FNAME); + strncpy (chan->path, path, SZ_FNAME); + + if (ism_debug) printf ("opened connection on '%s' %d\n", path, s); + + /* Register connectClient callback. */ + chan->id = xim_addInput (xim, s, ism_connectClient, + (XtPointer)chan); + } + + ism_nmodules = XtNumber (ism_modules); + + /* Set the default ISM path in the GUI. */ + sprintf (path, "wcspix_cmd {%s}", DEF_ISM_CMD); + wcspix_message (xim, path); +} + + +/* XIM_ISMCLOSE -- Close down the ISM protocol module. Disconnect all connected + * clients and close the port. + */ +void +xim_ismClose (xim) +register XimDataPtr xim; +{ + register IsmIoChanPtr chan = &(xim->ism_chan); + register int i; + + /* Send a 'quit' message to all connected clients. */ + for (i=0, chan=NULL; i < XtNumber(xim->ism_client); i++) { + chan = &xim->ism_client[i]; + if (chan->id) { + xim_removeInput (xim, chan->id); + chan->id = NULL; + } + + if (chan->connected) + ism_write (chan->dataout, "quit", 4); + + close (chan->datain); + } + + /* Close the ISM request socket. */ + chan = &(xim->ism_chan); + if (chan->id) { + xim_removeInput (xim, chan->id); + chan->id = NULL; + } + close (chan->datain); + unlink (chan->path); +} + + +/* ISMNAMETOPTR -- Utility procedure to lookup an ISM struct pointer given + * the ISM name. + */ +IsmModule +ismNameToPtr (name) +char *name; +{ + IsmModule ism; + register int i; + + for (i=0; i < ism_nmodules; i++) { + ism = &ism_modules[i]; + if (strcmp (name, ism->name) == 0) + return (ism); + } + return ((IsmModule)NULL); +} + + +/******************************* + * TRANSPORT LAYER PROCEDURES + ******************************/ + + +/* ISM_CONNECTCLIENT -- Called when a client has attempted a connection on + * a socket port. Accept the connection and set up a new i/o channel to + * communicate with the new client. + */ +static void +ism_connectClient (chan, source, id) +IsmIoChanPtr chan; +int *source; +XtPointer id; +{ + register XimDataPtr xim = (XimDataPtr) chan->xim; + register int s; + + /* Accept connection. */ + if ((s = accept ((int)*source, (struct sockaddr *)0, (int *)0)) < 0) + return; + /*if (fcntl (s, F_SETFL, O_RDWR|O_NDELAY) < 0) {*/ + if (fcntl (s, F_SETFL, O_NDELAY) < 0) { + close (s); + return; + } + + /* Fill in the ISM i/o channel descriptor. */ + chan->datain = s; + chan->dataout = s; + chan->connected = 1; + chan->id = xim_addInput (xim, s, ism_io, (XtPointer)chan); +} + + +/* ISM_DISCONNECTCLIENT -- Called to close a client connection when EOF is + * seen on the input port. Close the connection and free the channel + * descriptor. + */ +static void +ism_disconnectClient (chan) +register IsmIoChanPtr chan; +{ + close (chan->datain); + if (chan->id) { + xim_removeInput (chan->xim, chan->id); + chan->connected = 0; + chan->id = NULL; + } +} + + +/* ISM_IO -- Xt file i/o callback procedure, called when there is input + * pending on the data stream to the ximtool client. + */ +static void +ism_io (chan, fd_addr, id_addr) +IsmIoChanPtr chan; +int *fd_addr; +XtInputId *id_addr; +{ + register XimDataPtr xim = (XimDataPtr) chan->xim; + register IsmModule ism; + IsmIoChanPtr new_chan; + int datain = *fd_addr; + int dataout = chan->dataout; + int s, n, ip, type, count = 0; + char name[SZ_FNAME], path[SZ_FNAME]; + char message[2*SZ_ISMBUF+1]; + char buf[SZ_ISMBUF+1]; + char *text = NULL; + static int incomplete_msg = 0; + static int null_count = 0; + static long pkt=0, nread=0; + + + /* Read the message. */ + bzero (buf, SZ_ISMBUF+1); + count = read (datain, buf, SZ_ISMBUF); + nread += count; + if (count > SZ_ISMBUF || count == 0) { + if (null_count++ > MAX_TRY) { + null_count = 0; + ism_disconnectClient (chan); + } + return; + } + + /* Build up a complete message buffer including any incomplete + * text from the last read. + */ + bzero (message, 2*SZ_ISMBUF+1); + if (chan->msgbuf[0]) { + n = strlen(chan->msgbuf); + + memmove (message, chan->msgbuf, n); + memmove (&message[n], buf, count); + count += n; + } else { + bcopy (buf, message, count); + } + bzero (chan->msgbuf, SZ_ISMBUF); + + if (ism_debug >= 2) + printf("\nism_io: nread=%d pkt=%d count=%d n=%d\n",nread,pkt++,count,n); + + + ip = 0; + incomplete_msg = 0; + while (text = ism_parse (message, &ip, &incomplete_msg, count)) { + + if (incomplete_msg) { + /* Save the incomplete message to the buffer for later parsing. + */ + if (ism_debug >= 2) + printf ("INCOMPLETE '%s' ip=%d len=%d\n", text,ip,strlen(text)); + strcpy (chan->msgbuf, text); + break; + } + + + /* Messages + * + * CALLBACK - Negotiate a connection on another socket + * QUIT - client is shutting down and disconnecting + * SEND - send a message to another object + * READY - client is ready to begin processing + */ + switch (ism_type (text)) { + case CALLBACK: + + /* Get the requesting client's name. */ + sscanf (text, "connect %s", name); + + /* Get a new i/o channel. */ + if (new_chan = ism_getChannel (xim)) { + + /* Get path to be used for the unix domain socket. */ + sprintf (path, DEF_ISM_TEMPLATE, getuid(), new_chan->id); + unlink (path); + + if (ism_debug) + printf("ism_io: CONNECT '%s' on socket '%s'\n", name, path); + + if ((s = ism_openSocket (path))) { + /* Fill in i/o channel descriptor. */ + new_chan->xim = (XtPointer) xim; + new_chan->datain = s; + new_chan->dataout = s; + new_chan->connected = 0; + strncpy (new_chan->path, path, SZ_FNAME); + strncpy (new_chan->name, name, SZ_FNAME); + + /* Register connectClient callback. */ + new_chan->id = xim_addInput (xim, s, ism_connectClient, + (XtPointer)new_chan); + } + } + + /* Create a new OBM object for the client, save the client name + * one the channel descriptor so we'll know who disconnected. + */ + if (ismObjects (name) == 0) + obmNewObject (xim->obm, name, "Client", NULL, NULL, 0); + strcpy (chan->name, name); + + /* Now tell the client to call us back on the new channel */ + sprintf (buf, "connect %s", path); + if (ism_debug) printf ("ism_io: msg '%s'\n", buf); + ism_write (dataout, buf, strlen(buf)); + + /* Hang up the current connection. */ + if (ism_debug) printf ("CALLBACK: disconnecting '%s'\n",chan->path); + ism_disconnectClient (chan); + + break; + + case READY: + if (ism_debug) printf ("READY: ready '%s'\n", chan->name); + + /* Execute the ISM startup callback to initialize it. + */ + for (n=0; n < XtNumber (ism_modules) ; n++) { + ism = &ism_modules[n]; + if (strcmp (chan->name, ism->name) == 0) { + ism->connected = 1; + ism->chan = chan; + (*ism->startupCB) (xim, ism); + } + } + break; + + case QUIT: + if (ism_debug) + printf ("QUIT: quit '%s' on '%s'\n", chan->name, chan->path); + + /* Execute the ISM shutdown callback. + */ + for (n=0; n < XtNumber (ism_modules) ; n++) { + ism = &ism_modules[n]; + if (strcmp (chan->name, ism->name) == 0) { + (*ism->shutdownCB) (xim, ism); + ism->connected = 0; + ism->chan = (IsmIoChanPtr) NULL; + } + } + ism_disconnectClient (chan); + + break; + + case SEND: + /* Deliver the message to the named object. + */ + ism_parseSend (text, name, buf); + if (ism_debug >= 3) + printf ("SEND: len=%d '%s'->'%.45s'\n", strlen(buf), name, buf); + xim_message (xim, name, buf); + break; + + default: + fprintf (stderr, "ism_io: Unknown message '%s'\n", text); + break; + } + } +} + + +/* ISM_PARSE -- Parse the client message, returning the type as the function + * value. + */ +static char * +ism_parse (msg, ip, incomplete, maxch) +char *msg; +int *ip; +int *incomplete; +int maxch; +{ + register int j, i = *ip, count=0; + char text[SZ_ISMBUF+1]; + + if (msg[*ip] == '\0') { +/* *incomplete = 1;*/ + return (NULL); + } + + /* Zero the retrun buffer and skip any leading NULL input chars. */ + bzero (text, SZ_ISMBUF+1); + while ((msg[i] == '\0') && i < maxch) i++; + + /* Copy the message up to the terminating NULL. */ + for (j=0; (msg[i] != '\0') && (i < maxch); ) + text[j++] = msg[i++]; + text[j] = msg[i]; + + /* If we hit the end of the input buffer without seeing a null + * then we're parsing a partial message. + */ + *incomplete = (i < maxch ? 0 : 1); + + /* update the position ptr */ + while ((msg[i] == '\0') && i < maxch) i++; + *ip = i; + + if (ism_debug >= 3 && text[0]) { + printf ("ism_parse: ip=%d msg=%d i=%d j=%d inc=%d\n", + *ip, msg[i], i, j, *incomplete); + } + + + return (text[0] ? text : NULL); +} + + +/* ISM_TYPE -- Determine the message type. + */ +static int +ism_type (message) +char *message; +{ + register char *ip; + + for (ip=message; isspace(*ip); ip++) ; /* skip whitespace */ + + if (strncmp (ip, "connect", 7) == 0) + return (CALLBACK); + else if (strncmp (ip, "quit", 4) == 0) + return (QUIT); + else if (strncmp (ip, "ready", 4) == 0) + return (READY); + else if (strncmp (ip, "send", 4) == 0) + return (SEND); + else + return (ERR); +} + + +/* ISM_PARSESEND -- Parse the client SEND message. + */ +static int +ism_parseSend (msg, object, text) +char *msg; +char *object; +char *text; +{ + register int i=0, ip=4, count=0; + + /* skip leading whitespace */ + for ( ; isspace(msg[ip]) && msg[ip]; ip++) ; + + /* Get the object name */ + for (i=0; !isspace(msg[ip]) && msg[ip]; i++, ip++) + object[i] = msg[ip]; + object[i] = '\0'; + + for ( ; msg[ip] != '{'; ip++) ; /* skip to open bracket */ + + /* Get the message text. Count brackets so we can pass + * Tcl code properly. + */ + for (i=0, ip++; msg[ip]; i++, ip++) { + text[i] = msg[ip]; + if (msg[ip] == '{') + count++; + else if (msg[ip] == '}') { + if (count <= 0) { ip++; break; } + count--; + } + } + text[i] = '\0'; +} + + +/* ISM_EVALUATE -- Evaluate a command for the named object. Used by the + * clientEvaluate() method. Can also be used by the rest of ximtool to + * send messages to the ISM, which will be ignored if the client is not + * connected. + */ +ism_evaluate (xim, object, command) +register XimDataPtr xim; +char *object; +char *command; +{ + register IsmIoChanPtr chan; + register int i=0; + register int len = strlen(command) + 1; + char *buf = XtCalloc (len+1, sizeof(char)); + + for (i=0; i < XtNumber (xim->ism_client); i++) { + chan = &xim->ism_client[i]; + if (chan->connected && strcmp (chan->name, object) == 0) { + sprintf (buf, "%s\0", command); + len = strlen (buf) + 1; /* +1 to send the NULL */ + ism_write (chan->dataout, buf, len); + if (ism_debug >= 2) printf("writing %d bytes: '%s'\n", len,buf); + break; + } + } + + XtFree ((char *)buf); +} + + +/* ISM_MESSAGE -- Convenience wrapper for the evaluate procedure. + */ +ism_message (xim, object, command) +register XimDataPtr xim; +char *object, *command; +{ + ism_evaluate (xim, object, command); +} + + +/* ISM_OPENSOCKET -- Open a unix socket on the named path. + */ +static int +ism_openSocket (path) +char *path; /* path to the socket */ +{ + int addrlen, s = 0, on = 1; + struct sockaddr_un sockaddr; + + if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + goto err; + + memset ((void *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sun_family = AF_UNIX; + strcpy (sockaddr.sun_path, path); + addrlen = sizeof(sockaddr) - sizeof(sockaddr.sun_path) + strlen(path); + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&on,sizeof(on)) < 0) + goto err; +/* + if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *)&on,sizeof(on)) < 0) + goto err; +*/ + if (bind (s, (struct sockaddr *)&sockaddr, addrlen) < 0) + goto err; + + if (listen (s, MAXCONN) < 0) { +err: fprintf (stderr, "ximtool: can't open ISM socket on %s, errno=%d\n", + path, errno); + if (s) + close (s); + return (0); + } + + return (s); +} + + + +/* ISM_GETCHANNEL --- Get an ISM i/o channel descriptor. + */ +static IsmIoChanPtr +ism_getChannel (xim) +register XimDataPtr xim; +{ + register IsmIoChanPtr chan; + register int i; + + for (i=0; i < XtNumber(xim->ism_client); i++) { + if (!xim->ism_client[i].connected) { + xim->ism_client[i].id = (XtPointer) i; + return (&xim->ism_client[i]); + } + } + + return (NULL); +} + + +/* ISMOBJECTS -- Add the named client to the list of known objects, or + * return zero if this is a new object. We keep a list so we don't keep + * creating the same object in the OBM each time a client connects. + */ +ismObjects (name) +char *name; +{ + static char objects[SZ_LINE] = ""; + + if (strstr (objects, name) == NULL) { + strcat (objects, name); + strcat (objects, "|\0"); + return (0); + } else + return (1); +} + + +/* ISM_READ -- Read exactly "n" bytes from a descriptor. + */ + +static int +ism_read (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +{ + char *ptr = vptr; + int nread = 0, nleft = nbytes, nb = 0; + + while (nleft > 0) { + if ( (nb = read(fd, ptr, nleft)) < 0) { + if (errno == EINTR) + nb = 0; /* and call read() again */ + else + return(-1); + } else if (nb == 0) + break; /* EOF */ + nleft -= nb; + ptr += nb; + nread += nb; + } + + return (nread); /* return no. of bytes read */ +} + + +/* ISM_WRITE -- Write exactly "n" bytes to a descriptor. + */ + +static int +ism_write (fd, vptr, nbytes) +int fd; +void *vptr; +int nbytes; +{ + char *ptr = vptr; + int nwritten = 0, nleft = nbytes, nb = 0; + + /* Send the bytecount first. + if ((nb = write (fd, &nleft, sizeof (int))) <= 0) + return (-1); + */ + + /* Now send the message. */ + while (nleft > 0) { + if ( (nb = write(fd, ptr, nleft)) <= 0) { + if (errno == EINTR) + nb = 0; /* and call write() again */ + else + return (-1); /* error */ + } + nleft -= nb; + ptr += nb; + nwritten += nb; + } + + return (nwritten); +} diff --git a/vendor/x11iraf/ximtool/ism_wcspix.c b/vendor/x11iraf/ximtool/ism_wcspix.c new file mode 100644 index 00000000..5c8600ea --- /dev/null +++ b/vendor/x11iraf/ximtool/ism_wcspix.c @@ -0,0 +1,140 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/errno.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <Tcl/tcl.h> +#include "ximtool.h" + +/* + * ISM_WCSPIX.C -- Client callbacks for the WCS/Pixel value ISM. + * + * wcspix_connect (xim) + * wcspix_disconnect (xim) + * wcspix_command (xim, argc, argv) + */ + + +static int wcspix_debug = 0; +extern int errno; + + +/* WCS/Pixel ISM client callbacks. */ +void wcspix_connect(), wcspix_disconnect(), wcspix_command(), wcspix_message(); + + + +/* WCSPIX_CONNECT -- Called when the WCSPIX ISM first connects to the server. + * Used to update with the current cache of mappings as well as initialize + * the GUI that we are alive. + */ +void +wcspix_connect (xim, ism) +register XimDataPtr xim; +register IsmModule ism; + +{ + MappingPtr mp; + FrameBufPtr fr; + register int i, j; + char buf[SZ_LINE]; + + if (wcspix_debug) printf ("ConnectCB for '%s' ....\n", ism->name); + + wcspix_message (xim, "startup"); + + /* Update the ISM with the current set of mappings. */ + for (j=0; j < xim->nframes; j++) { + fr = &xim->frames[j]; + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + sprintf (buf, "cache %s %d", mp->ref, mp->id); + ism_message (xim, ism->name, buf); + sprintf (buf, "wcslist %d", mp->id); + ism_message (xim, ism->name, buf); + + /* Send the object ref to the GUI. */ + sprintf (buf, "cache %s %d %d", mp->ref, fr->frameno, mp->id); + wcspix_message (xim, buf); + + if (wcspix_debug) printf ("connectCB: '%s'\n", buf); + } + } +} + + +/* WCSPIX_DISCONNECT -- Called to shut down the WCSPIX ISM. Send a "quit" + * command to the module and notify the GUI. + */ +void +wcspix_disconnect (xim, ism) +register XimDataPtr xim; +register IsmModule ism; +{ + MappingPtr mp; + FrameBufPtr fr; + register int i, j; + char buf[SZ_LINE]; + + if (wcspix_debug) printf ("DisconnectCB for '%s' ....\n", ism->name); + + /* Uncache all the mapped images in the GUI. */ + for (j=0; j < xim->nframes; j++) { + fr = &xim->frames[j]; + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + sprintf (buf, "uncache %d", mp->id); + wcspix_message (xim, buf); + } + } + + /* If we got here from a GUI command send a quit command to the + * ISM, if the ISM shut down itself it will already be disconnected + * so check to see if we're still alive. + */ + if (ism->connected) + ism_message (xim, ism->name, "quit"); + + /* Notify the GUI that we're done. */ + wcspix_message (xim, "shutdown"); +} + + +/* WCSPIX_COMMAND -- Handle all WCSPIX ISM specific commands. + * + * set wcspix_cmd <path> + * pixtab_size <size> + * + */ +void +wcspix_command (xim, ism, argc, argv) +register XimDataPtr xim; +register IsmModule ism; +int argc; +char **argv; +{ + register int i; + char cmd[SZ_FNAME]; + + if (wcspix_debug) printf ("CommandCB....\n"); + + for (i=0; i < argc; i = i + 1) { + printf ("ism_cmd: %d '%s'\n", i, argv[i]); + } +} + + +/* WCSPIX_MESSAGE -- Send a message to the user interface ism_msg callback, + * but format it so it's delivered to the WCSPIX callback procedures. + */ +void +wcspix_message (xim, message) +register XimDataPtr xim; +char *message; +{ + char msgbuf[SZ_MSGBUF]; + + sprintf (msgbuf, "setValue { deliver wcspix { %s } }", message); + ObmDeliverMsg (xim->obm, "ism_msg", msgbuf); +} + diff --git a/vendor/x11iraf/ximtool/load.c b/vendor/x11iraf/ximtool/load.c new file mode 100644 index 00000000..665f6cfb --- /dev/null +++ b/vendor/x11iraf/ximtool/load.c @@ -0,0 +1,925 @@ +#include <sys/types.h> +#include <dirent.h> +#include <sys/stat.h> +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> + +#include "ximtool.h" + +/* LOAD.C -- Package for browsing directories and loading raster files into + * the display. + * + * xim_initLoad (xim) + * xim_loadClose (xim) + * + * xim_dirRescan (xim) + * xim_scanHeaders (xim) + * status = xim_loadFile (xim, fname, frame) + * + * xim_dirRescan scans the current directory and sends the file list to + * the GUI "filelist" parameter. xim_loadFile loads the named raster file + * into the current display frame. + */ + +#define True 1 +#define False 0 + +#undef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define min(a,b) ((a) < (b) ? (a) : (b)) + +static char **listFiles(); +static int fileCompare(), globExpression(), fileType(), ucharCompare(); +static void amapc(), sortGraymap(), loadstat(), strsort(); + +extern char *getcwd(), *getenv(); + +static int debug = False; + + +/* XIM_INITLOAD -- Initialize the file load structure. + */ +void +xim_initLoad (xim) +register XimDataPtr xim; +{ + register fileLoadPtr flp; + char buf[SZ_LINE]; + + xim->flp = flp = (fileLoadPtr) calloc (1, sizeof (fileLoad)); + if (!flp) + return; + + strcpy (flp->homedir, getenv("HOME")); + if (getcwd (flp->curdir, SZ_FNAME) == NULL) + strcpy (flp->curdir, flp->homedir); + strcpy (flp->pattern, "*.fits,*.imh"); + flp->gray = 0; + flp->zscale = 1; + flp->zrange = 1; + flp->z1 = 0.0; + flp->z2 = 0.0; + flp->nsample = 1000; + + /* Update the GUI with the initial state. */ + sprintf (buf, "curdir %s\0", flp->curdir); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "pattern %s\0", flp->pattern); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "gray %d\0", flp->gray); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "zscale %d\0", flp->zscale); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "zrange %d\0", flp->zrange); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "z1 %g\0", flp->z1); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "z2 %g\0", flp->z2); + xim_message (xim, "loadOptions", buf); + sprintf (buf, "nsample %d\0", flp->nsample); + xim_message (xim, "loadOptions", buf); +} + + +/* XIM_LOADCLOSE -- Close the load struct. + */ +void +xim_loadClose (xim) +XimDataPtr xim; +{ + register fileLoadPtr flp = xim->flp; + register int i; + + if (flp->FileList) + for (i=0; i < flp->nfiles; i++) + free (flp->FileList[i]); + + free ((fileLoadPtr) flp); +} + + +/* XIM_LOADFILE -- Try loading a disk raster file into a display frame and + * colormap. + */ +int +xim_loadFile (xim, fname, frame) +register XimDataPtr xim; +char *fname; +int frame; +{ + register int i, new_config=-1; + register char *ip; + register fileLoadPtr flp = xim->flp; + register FrameBufPtr fr; + register MappingPtr mp; + register FbConfigPtr cf; + + float z1=0.0, z2=0.0; + int status = 0, has_private_cmap = 0, pixtype, w, h, ncolors; + int zscale = flp->zscale, zrange = flp->zrange, nsamp=flp->nsample; + unsigned char *pix=NULL, r[256], g[256], b[256]; + char *mapname, *err, buf[SZ_LINE]; + + extern char *loadSunRas(); + extern char *loadFITS(); + extern char *loadGIF(); + extern char *loadIRAF(); + extern int objid[]; + + /* Make sure the file exists. */ + if (access(fname, R_OK) != 0) { + sprintf (buf, "warning %s\0", "Error: File not found."); + xim_message (xim, "loadOptions", buf); + return (-1); + } + + switch (fileType(fname)) { + case XIM_RAS: /* Sun rasterfile. */ + loadstat (xim, "Reading rasterfile..."); + if (err = loadSunRas(fname,&pix,&pixtype,&w,&h,r,g,b,&ncolors, + flp->gray)) { + pix = NULL; + xim_alert (xim, err, NULL, NULL); + } + if (pixtype > 8) { + xim_alert (xim, "Error: 24 bit Sun rasterfile.", NULL, NULL); + free ((char *) pix); + pix = NULL; + } + has_private_cmap = 1; + break; + + case XIM_FITS: /* FITS file. */ + loadstat (xim, "Reading FITS file..."); + z1 = flp->z1; + z2 = flp->z2; + if (err = loadFITS(fname, &pix, &w, &h, r,g,b, &ncolors, + zscale, zrange, &z1, &z2, flp->nsample)){ + pix = NULL; + xim_alert (xim, err, NULL, NULL); + } + has_private_cmap = 0; + break; + + case XIM_GIF: /* GIF image */ + loadstat (xim, "Reading GIF fle..."); + if (err = loadGIF(fname, &pix, &w,&h, r,g,b, &ncolors, flp->gray)) { + pix = NULL; + xim_alert (xim, err, NULL, NULL); + } + has_private_cmap = 1; + break; + + case XIM_OIF: /* OIF image */ + loadstat (xim, "Reading IRAF image..."); + z1 = flp->z1; + z2 = flp->z2; + if (err = loadIRAF(fname, &pix, &w, &h, r,g,b, &ncolors, + zscale, zrange, &z1, &z2, flp->nsample)){ + pix = NULL; + xim_alert (xim, err, NULL, NULL); + } + has_private_cmap = 0; + break; + + case XIM_TIFF: /* TIFF image */ + case XIM_JPEG: /* JPEG image */ + case XIM_X11: /* X11 image */ + case XIM_RAW: /* RAW binary image */ + /* fall through */ + + default: + /* We don't know what this is so give up and notify the GUI. */ + sprintf (buf, "warning %s\0", "Error: Unknown raster file type."); + xim_message (xim, "loadOptions", buf); + return (-1); + } + + if (debug) { + fprintf (stderr, + "Load: pix=%d w=%d h=%d xnc=%d nc=%d pcm=%d z1=%g z2=%g\n", + pix, w, h, xim->ncolors, ncolors, has_private_cmap, z1, z2); + fflush (stderr); + } + + /* If the new image has more colors that we're allowed to display, + * quantize it to the available number before display. + */ + if (ncolors > xim->ncolors) { + if ( has_private_cmap && ! flp->gray) { + /* Quantize the colormap to the number of display colors. */ + loadstat (xim, "Quantizing colors..."); + ppmquant (pix, r, g, b, w, h, ncolors, xim->ncolors); + } + + if (! has_private_cmap || (has_private_cmap && flp->gray)) { + /* It's a grayscale map, so sort the colors into something + * that can be adjusted when displayed. + */ + loadstat (xim, "Sorting colormap..."); + sortGraymap (pix, pix, w*h, r, g, b, xim->ncolors); + + /* Force a grayscale colormap. */ + for (i=0; i<xim->ncolors; i++) + r[i] = g[i] = b[i] = (float)i / (float)(xim->ncolors) * 255; + } + ncolors = xim->ncolors; + xim->psim->cmap.ncolors = xim->ncolors; + } + + /* Use filename as the colormap name. */ + for (ip=mapname=fname; *ip; ip++) + if (*ip == '/') + mapname = ip + 1; + + /* Now check the dimensions against the current frame buffer config- + * uration. Change the fbconfig if needed. + */ + if (w > xim->width || h > xim->height) { + + register int width, height, tmin = 100000, edges; + + loadstat (xim, "Initializing frame buffer..."); + + /* First look for a frame buffer at least as large as the image. */ + for (i=0; i < MAX_FBCONFIG; i++) { + width = xim->fb_config[i].width; + height = xim->fb_config[i].height; + if (width == w && height == h) { + /* Get an exact match first. */ + new_config = i + 1; + break; + } else if (width >= w && height >= h) { + /* Look for match with smallest padding. */ + edges = width - w + height - h; + if (edges < tmin) { + tmin = edges; + new_config = i + 1; + } + } + } + + if (debug) { + fprintf (stderr, "Load: new_config=%d w=%d h=%d\n", new_config, + xim->fb_config[new_config-1].width, + xim->fb_config[new_config-1].height); + } + + + /* We didn't find a large enough buffer, so create a new one with + * the right size as one of the last available configs. This will + * overwrite anything there but they shouldn't normally be used + * and we'll use the frame as an offset for each display frame. + */ + if (new_config < 0) { + new_config = MAX_FBCONFIG - frame + 1; + cf = &xim->fb_config[new_config-1]; + cf->nframes = xim->nframes; + cf->width = w; + cf->height = h; + } else { + cf = &xim->fb_config[new_config-1]; + cf->nframes = (cf->nframes < frame ? frame : cf->nframes); + cf->nframes = (cf->nframes < xim->nframes ? xim->nframes : + cf->nframes); + xim->fb_configno = new_config; + } + + /* Change the frame buffer configuration. */ + sprintf (buf, "%d %d %d\0", cf->width, cf->height, 8); + xim_message (xim, "frameSize", buf); + + /* Create the frame. */ + for (i=1; i <= cf->nframes; i++) + xim_initFrame (xim, i, cf->nframes, cf, xim->memModel); + + xim->width = cf->width; + xim->height = cf->height; + GtSetLogRes (xim->gt, cf->width, cf->height); + + /* Fit the frame. */ + xim_message (xim, "frameFit", "init"); + } + + /* Take the pixels and colormap and write them to the display. */ + if ((pix == NULL) || (xim_writeDisplay (xim, + frame, mapname, pix, w, h, r, g, b, ncolors) < 0)) + status = -1; + + /* Reset the image title string. */ + loadstat (xim, ""); + xim_message (xim, "frameTitle", mapname); + eps_setLabel (xim->psim, mapname); + + + /* Notify the GUI that we are capable of using the ISM. + */ + wcspix_message (xim, "capable"); + + + /* ISM: Uncache all mappings associated with this frame. */ + fr = &xim->frames[frame-1]; + for (i=0; i < fr->nmaps; i++) { + mp = &fr->mapping[i]; + if (mp->id) { + sprintf (buf, "uncache %d", mp->id); + ism_message (xim, "wcspix", buf); + wcspix_message (xim, buf); + mp->id = 0; + } + } + + /* Now save the mapping information */ + fr->nmaps = 0; + mp = &(fr->mapping[fr->nmaps]); + objid[fr->frameno-1] = 0; + + mp->id = mp->regid = (++objid[fr->frameno-1]) + (fr->frameno * 100); + sprintf (mp->region, "%s", "image"); + if (fname[0] != '/' && getcwd (buf, (size_t) SZ_LINE)) + sprintf (mp->ref, "%s/%s", buf, fname); + else + sprintf (mp->ref, "%s", fname); + + mp->sx = 1.0; + mp->sy = 1.0; + mp->snx = w; + mp->sny = h; + mp->dx = (float) (xim->width - w) / 2.0; + mp->dy = (float) (xim->height - h) / 2.0; + mp->dnx = w; + mp->dny = h; + + /* Load a WCS for the frame. */ + mp->ctran.z1 = fr->ctran.z1 = z1; + mp->ctran.z2 = fr->ctran.z2 = z2; + mp->ctran.zt = fr->ctran.zt = W_LINEAR; + mp->ctran.a = fr->ctran.a = 1.; + mp->ctran.b = fr->ctran.b = 0.; + mp->ctran.c = fr->ctran.c = 0.; + mp->ctran.d = fr->ctran.d = -1.; + mp->ctran.tx = fr->ctran.tx = ((float)w/2.)-((float)xim->width/2.) + 1; + mp->ctran.ty = fr->ctran.ty = ((float)xim->height/2.)+((float)h / 2.); + mp->ctran.valid = fr->ctran.valid = 1; + strcpy (fr->ctran.imtitle, mapname); + strcpy (mp->ctran.imtitle, mapname); + + + /* Tell the ISM to cache this mapping if we have an object ref. */ + sprintf (buf, "cache %s %d", mp->ref, mp->id); + ism_message (xim, "wcspix", buf); + sprintf (buf, "wcslist %d", mp->id); + ism_message (xim, "wcspix", buf); + + /* Send the object ref to the GUI. */ + sprintf (buf, "cache %s %d %d", mp->ref, fr->frameno, mp->id); + wcspix_message (xim, buf); + sprintf (buf, "orient %d %d 1 1", mp->id, fr->frameno); + wcspix_message (xim, buf); + + fr->nmaps++; /* update number of mappings */ + + + /* DEBUG prints. */ + if (debug || getenv("DEBUG_MAPPINGS") != NULL) { + fprintf (stderr,"%s -\n%g %g %g %g %g %g %g %g %d\n", mapname, + fr->ctran.a, fr->ctran.b, fr->ctran.c, fr->ctran.d, + fr->ctran.tx, fr->ctran.ty, fr->ctran.z1, fr->ctran.z2, + fr->ctran.zt); + fprintf (stderr,"%s %d\n%g %g %d %d %d %d %d %d\n", + mp->region, mp->regid, mp->sx, mp->sy, mp->snx, mp->sny, + mp->dx, mp->dy, mp->dnx, mp->dny); + + print_mappings (fr); + } + + + if (pix != NULL) + free ((char *) pix); + return (status); +} + + +/* XIM_DIRRESCAN -- Rescan the current directory and send the resulting file + * list to the GUI. + */ +void +xim_dirRescan (xim) +register XimDataPtr xim; +{ + register fileLoadPtr flp = xim->flp; + register char *ip, *op, *flist; + register int i; + + if (flp->FileList) { + for (i=0; i < flp->nfiles; i++) + free (flp->FileList[i]); + } + + flp->FileList = listFiles (flp->curdir, flp->pattern, &flp->nfiles, 0); + + /* Turn the directory listing into something the GUI wants. */ + if (!(flist = (char *) malloc (SZ_NAME * flp->nfiles))) + return; + + strcpy (flist, "setValue {"); + for (i=0, op = flist+10; i < flp->nfiles; i++) { + *op++ = '"'; + for (ip = flp->FileList[i]; *op = *ip++; op++) + ; + *op++ = '"'; + *op++ = '\n'; + } + *op++ = '}'; + *op = '\0'; + + /* Send the file list to the GUI. */ + ObmDeliverMsg (xim->obm, "filelist", flist); + free ((char *)flist); +} + + +/* XIM_SCANHEADERS -- + */ +void +xim_scanHeaders (xim) +register XimDataPtr xim; +{ + register fileLoadPtr flp = xim->flp; + register char *ip, *op; + register char *entry = (char *)NULL, *flist = (char *)NULL; + register int i; + extern char *getFITSHdr(), *getIRAFHdr(); + extern char *getSunRasHdr(), *getGIFHdr(); + + if (flp->FileList) { + for (i=0; i < flp->nfiles; i++) + free (flp->FileList[i]); + } + + flp->FileList = listFiles (flp->curdir, flp->pattern, &flp->nfiles, 1); + + /* Turn the directory listing into something the GUI wants. */ + if (!(flist = (char *) malloc (SZ_NAME * flp->nfiles))) + return; + + strcpy (flist, "setValue {"); + op = flist+10; + for (i=0; i < flp->nfiles; i++) { + + switch (fileType (flp->FileList[i])) { + case XIM_FITS: entry = getFITSHdr (flp->FileList[i]); break; + case XIM_OIF: entry = getIRAFHdr (flp->FileList[i]); break; + case XIM_GIF: entry = getGIFHdr (flp->FileList[i]); break; + case XIM_RAS: entry = getSunRasHdr (flp->FileList[i]); break; + } + + if (entry) { + /* Copy the entry to the list. */ + *op++ = '"'; + for (ip = entry; *op = *ip++; op++) + ; + *op++ = '"'; + *op++ = '\n'; + + free ((char *) entry); + entry = NULL; + } + } + *op++ = '}'; + *op = '\0'; + + /* Send the file list to the GUI. */ + ObmDeliverMsg (xim->obm, "filelist", flist); + free ((char *) flist); +} + + + +/* ------------------ + * Internal routines. + * ------------------ + */ + +/* fileType -- Given a filename return what type of file it is. + */ +static int +fileType (fname) +char *fname; +{ + int format; + + if (isFITS (fname)) + format = XIM_FITS; + else if (isIRAF (fname)) + format = XIM_OIF; + else if (isSunRas (fname)) + format = XIM_RAS; + else if (isGIF (fname)) + format = XIM_GIF; + else { + /* + * FILL IN WITH REMAINDER OF FORMATS LATER. + */ + format = -1; + } + + return (format); +} + + +/* listFiles -- reads the directory specified and returns a list of + * filenames matching the given pattern contained in the directory + * sorted in ascending alphabetic order. + * + * Adapted from the ImageMagick package originally developed by John Christy. + */ +static char ** +listFiles (directory, pattern, number_entries, files_only) +char *directory; /* directory to be listed */ +char *pattern; /* pattern to be matched */ +int *number_entries; /* number of filenames in the list */ +int files_only; /* list only files, not dirs */ +{ + char **filelist, *ip; + char patterns[64][20]; + DIR *current_directory; + struct dirent *entry; + struct stat file_info; + unsigned int max_entries; + register int i=0, npatterns = 0; + int status, pattern_matches; + + /* Open directory. */ + *number_entries = 0; + status = chdir (directory); + if (status != 0) + return((char **) NULL); + (void) getcwd (directory, SZ_FNAME); + current_directory = opendir (directory); + if (current_directory == (DIR * ) NULL) + return((char **) NULL); + + /* Allocate filelist. */ + max_entries = 4096; + filelist = (char **) malloc (max_entries * sizeof(char *)); + if (filelist == (char **) NULL) { + (void) closedir (current_directory); + return((char **) NULL); + } + + /* Split the pattern list. */ + if (pattern) { + for (ip=pattern, i=0; *ip; ip++) { + if (*ip == ',') { + patterns[npatterns][i] = '\0'; + npatterns++; + i = 0; + } else + patterns[npatterns][i++] = *ip; + } + patterns[npatterns][i] = '\0'; + npatterns++; + } else + npatterns = 0; + + + /* Save the current and change to the new directory. */ + (void) chdir (directory); + entry = readdir (current_directory); + while (entry != (struct dirent *) NULL) { + if (*entry->d_name == '.') { + entry = readdir (current_directory); + continue; + } + (void) stat (entry->d_name, &file_info); + + /* Directory always matches. */ + pattern_matches = 0; + if ((S_ISDIR(file_info.st_mode) && !files_only)) { + pattern_matches = 1; + } else { + /* Otherwise, check the filename against the pattern list. */ + for (i=0; i < npatterns; i++) { + if (globExpression(entry->d_name, &patterns[i])) { + pattern_matches = 1; + break; + } + } + } + + if (pattern_matches) { + + /* Reallocate the list if necessary. */ + if (*number_entries >= max_entries) { + max_entries <<= 1; + filelist = (char **) + realloc((char *)filelist, max_entries * sizeof(char *)); + if (filelist == (char **) NULL) { + (void) closedir(current_directory); + return((char **) NULL); + } + } + filelist[*number_entries] = + (char *) malloc (strlen(entry->d_name) + 2); + if (filelist[*number_entries] == (char *) NULL) + break; + (void) strcpy (filelist[*number_entries], entry->d_name); + if (S_ISDIR(file_info.st_mode)) + strcat (filelist[*number_entries],"/"); + (*number_entries)++; + } + entry = readdir (current_directory); + } + (void) closedir (current_directory); + + /* Sort filelist in ascending order. */ + (void) strsort(filelist, *number_entries); + + return (filelist); +} + + +/* fileCompare -- Comparison routine needed by quicksort for listFiles. + * Adapted from the ImageMagick package originally developed by John Christy. + */ +static int +fileCompare (x, y) +void *x, *y; +{ + register char *p, *q; + + p = (char *) * ((char **) x); + q = (char *) * ((char **) y); + while ((*p != '\0') && (*q != '\0') && (*p == *q)) { + p++; + q++; + } + return (*p - (*q)); +} + + +/* globExpression -- returns True if the expression matches the given pattern. + * Adapted from the ImageMagick package originally developed by John Christy. + */ +static int +globExpression (expression, pattern) +char *expression; /* file name */ +char *pattern; /* matching pattern */ +{ + register int done, match, status; + register char c, *p; + + + if (pattern == (char *) NULL) + return (True); + if (strlen (pattern) == 0) + return (True); + if (strcmp (pattern, "*") == 0) + return (True); + done = False; + + while ((*pattern != '\0') && !done) { + if (*expression == '\0') + if ((*pattern != '{') && (*pattern != '*')) + break; + + switch (*pattern) { + case '\\': + pattern++; + if (*pattern != '\0') + pattern++; + break; + case '*': + pattern++; + status = False; + while ((*expression != '\0') && !status) + status = globExpression((char *) expression++, pattern); + if (status) { + while (*expression != '\0') + expression++; + while (*pattern != '\0') + pattern++; + } + break; + case '[': + pattern++; + for ( ; ; ) { + if ((*pattern == '\0') || (*pattern == ']')) { + done = True; + break; + } + if (*pattern == '\\') { + pattern++; + if (*pattern == '\0') { + done = True; + break; + } + } + if (*(pattern + 1) == '-') { + c = (*pattern); + pattern += 2; + if (*pattern == ']') { + done = True; + break; + } + if (*pattern == '\\') { + pattern++; + if (*pattern == '\0') { + done = True; + break; + } + } + if ((*expression < c) || (*expression > *pattern)) { + pattern++; + continue; + } + } else if (*pattern != *expression) { + pattern++; + continue; + } + pattern++; + while ((*pattern != ']') && (*pattern != '\0')) { + if ((*pattern == '\\') && (*(pattern + 1) != '\0')) + pattern++; + pattern++; + } + if (*pattern != '\0') { + pattern++; + expression++; + } + break; + } + break; + case '?': + pattern++; + expression++; + break; + case '{': + pattern++; + while ((*pattern != '}') && (*pattern != '\0')) { + p = expression; + match = True; + while ((*p != '\0') && (*pattern != '\0') && + (*pattern != ',') && (*pattern != '}') && match) { + if (*pattern == '\\') + pattern++; + match = (*pattern == *p); + p++; + pattern++; + } + if (*pattern == '\0') { + match = False; + done = True; + break; + } else if (match) { + expression = p; + while ((*pattern != '}') && (*pattern != '\0')) { + pattern++; + if (*pattern == '\\') { + pattern++; + if (*pattern == '}') + pattern++; + } + } + } else { + while ((*pattern != '}') && (*pattern != ',') && + (*pattern != '\0')) { + pattern++; + if (*pattern == '\\') { + pattern++; + if ((*pattern == '}') || (*pattern == ',')) + pattern++; + } + } + } + if (*pattern != '\0') + pattern++; + } + break; + default: + if (*expression != *pattern) + done = True; + else { + expression++; + pattern++; + } + } + } + + while (*pattern == '*') + pattern++; + + return ((*expression == '\0') && (*pattern == '\0')); +} + + +/* AMAPC -- Vector linear transformation. Map the range of pixel values + * a1,a2 from a into the range b1,b2 in b. It is assumed that a1 < a2 + * and b1 < b2. + */ + +static void +amapc (a, b, npix, a1, a2, b1, b2) +char *a, *b; +int npix, a1, a2, b1, b2; +{ + register int i, minout, maxout, aoff, boff, pixval; + register double scalar; + + scalar = ((double) b2 - (double) b1) / ((double) a2 - (double) a1); + + minout = min (b1, b2); + maxout = max (b1, b2); + aoff = a1; + boff = b1; + + for (i=0; i < npix; i++) { + pixval = (a[i] - aoff) * scalar; + b[i] = (char) max(minout, min(maxout, pixval + boff)); + } +} + + +/* SORTGRAYMAP -- Sort a random grayscale colormap. + */ + +static void +sortGraymap (a, b, npix, red, green, blue, ncols) +unsigned char *a, *b; +unsigned char *red, *green, *blue; +int npix, ncols; +{ + register int i, pmin=0, pmax=255; + register float scale; + + /* Reset the pixels so they are the final grayscale values. */ + scale = 255.0 / (float) (ncols - 1); + for (i=0; i<npix; i++) + b[i] = (unsigned char) ((float) red[a[i]] / scale); + + /* Sort the input colormap. */ + qsort (red, ncols, sizeof (unsigned char), ucharCompare); + + /* Set the new colormap. 0-ncols are the scaled colors in the desired + * number of cells, everything above that we set to zero. + */ + for (i=0; i<ncols; i++) + green[i] = blue[i] = (unsigned char)min(pmax,max(pmin,(int)red[i])); + for (i=ncols; i<256; i++) + red[i] = green[i] = blue[i] = 0; +} + +static int +ucharCompare (i, j) +unsigned char *i, *j; +{ + return (*i - *j); +} + + +/* LOADSTAT -- Internal routine for load status messages. + */ +static void +loadstat (xim, message) +register XimDataPtr xim; +char *message; +{ + char text[SZ_LINE]; + sprintf (text, "status {%s}", message); + xim_message (xim, "loadOptions", text); +} + + +/* STRSORT -- Shell sort an array of string pointers via strcmp() + */ +static void +strsort (array, array_size) +char **array; +int array_size; +{ + int gap, i, j; + char **a, **b, *tmp; + + for (gap = 0; ++gap < array_size; ) + gap *= 2; + while (gap /= 2) { + for (i = gap; i < array_size; i++) { + for (j = i - gap; ;j -= gap) { + a = array + j; + b = a + gap; + if (strcmp(*a, *b) <= 0) + break; + tmp = *a; + *a = *b; + *b = tmp; + if (j < gap) + break; + } + } + } +} diff --git a/vendor/x11iraf/ximtool/logo.c b/vendor/x11iraf/ximtool/logo.c new file mode 100644 index 00000000..92d4bb8e --- /dev/null +++ b/vendor/x11iraf/ximtool/logo.c @@ -0,0 +1,36 @@ +#include <sys/types.h> +#include <dirent.h> +#include <sys/stat.h> +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> + +#include "ximtool.h" +#include "logo.h" + + +xim_displayLogo (xim) +register XimDataPtr xim; +{ + register int i; + unsigned char r[256], g[256], b[256]; + + + if (!xim || !xim->gt) + return; + + /* Create the default colormap. + */ + for (i=0; i < 200; i++) + r[i] = g[i] = b[i] = (float)i / (float)(LOGO_NCOLORS) * 255; + + /* Set the logical resolution of the display. + */ + GtSetLogRes (xim->gt, LOGO_XDIM, LOGO_YDIM); + + if (xim_writeDisplay (xim, 1, "logo", logo_data, + LOGO_XDIM, LOGO_YDIM, r, g, b, LOGO_NCOLORS) < 0) + return; +} diff --git a/vendor/x11iraf/ximtool/logo.h b/vendor/x11iraf/ximtool/logo.h new file mode 100644 index 00000000..b821727a --- /dev/null +++ b/vendor/x11iraf/ximtool/logo.h @@ -0,0 +1,17485 @@ +#define LOGO_XDIM 512 +#define LOGO_YDIM 512 +#define LOGO_NCOLORS 200 +#define LOGO_NBYTES 262144 + +unsigned char logo_data[] = { + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15, + 0x15,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x11,0x11, + 0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13, + 0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11, + 0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11, + 0x11,0x11,0x11,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x13,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x13,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x11,0x11,0x11,0x11,0x11,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14, + 0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x06,0x0c,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0c,0x06,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x10,0x10,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13, + 0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0f,0x10,0x0f,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x12,0x13,0x12,0x12,0x12,0x13,0x13,0x13, + 0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x14,0x15,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x13, + 0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x11,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x11,0x11,0x11,0x12,0x12,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x14,0x14,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x14,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0e,0x0e,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0e,0x0e, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0e,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x10,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8, + 0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0e,0x0e,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14, + 0x14,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14, + 0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0c,0x06,0x0f,0x0f,0x10,0x12, + 0x32,0x57,0x57,0x38,0x2b,0x19,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x06,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x06,0x0f,0x0f,0x0f,0x6a, + 0x90,0xa9,0xbc,0xbc,0xbc,0xbc,0xbc,0xaf,0xa3,0x90,0x77,0x4b,0x10,0x10,0x10, + 0x10,0x10,0x06,0x10,0x06,0x10,0x06,0x06,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e,0x0e,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10, + 0x10,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x77, + 0xaf,0xbc,0xc2,0xbc,0xb5,0xaf,0xa3,0xa3,0xa3,0xaf,0xb5,0xbc,0xbc,0xbc,0xaf, + 0x96,0x6a,0x2b,0x10,0x10,0x10,0x06,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0e,0x0e,0x0e,0x0e,0x0e, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x10,0x10,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x4b, + 0xa3,0xbc,0xbc,0xbc,0xa3,0x6a,0x2b,0x10,0x10,0x10,0x10,0x10,0x19,0x4b,0x70, + 0x90,0xa9,0xbc,0xbc,0xb5,0x96,0x51,0x10,0x10,0x10,0x06,0x06,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0e,0x0e,0x0e, + 0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x5e,0xaf,0xbc,0xbc,0xb5,0x6a,0x10,0x10,0x10,0x06,0x10,0x10,0x10,0x06,0x10, + 0x10,0x10,0x10,0x10,0x38,0x77,0xa3,0xb5,0xbc,0xa9,0x6a,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0e, + 0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x10,0x10,0x06,0x10,0x10,0x10,0x06,0x0c,0x06,0x10,0x10,0x10,0x10,0x10, + 0x10,0x5e,0xb5,0xbc,0xbc,0xaf,0x4b,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x45,0x83,0xaf,0xbc,0xa9,0x6a, + 0x10,0x10,0x06,0x10,0x10,0x0c,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0xc8,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x10,0x10,0x10,0x06,0x10,0x0c,0x06,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x45,0xaf,0xbc,0xbc,0xb5,0x51,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x06,0x10,0x10,0x10,0x10,0x6a, + 0xa9,0xbc,0xa3,0x45,0x10,0x10,0x06,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0xc8,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x06,0x06,0x06,0x10,0x10,0x10,0x10,0x10, + 0x57,0x7d,0x96,0x83,0xa3,0xbc,0xbc,0xbc,0x77,0x10,0x06,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0c,0x10,0x06,0x10, + 0x10,0x10,0x10,0x6a,0xaf,0xb5,0x7d,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0xc8,0x0e,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x06,0x06,0x10,0x19,0x4b,0x32, + 0x70,0xa9,0xb5,0xbc,0xbc,0xa3,0xbc,0xbc,0xbc,0xa3,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x06, + 0x06,0x10,0x0c,0x10,0x10,0x10,0x19,0x8a,0xb5,0xa3,0x25,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x06,0x10,0x10,0x10,0x10,0x10,0x10,0x45,0x7d, + 0x7d,0xa9,0xbc,0xbc,0xbc,0xbc,0xa3,0xaf,0xbc,0xbc,0xbc,0x57,0x10,0x0c,0x06, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x51,0xaf,0xaf,0x4b,0x11, + 0x06,0x06,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x06,0x10,0x0c,0x0c,0x10,0x10,0x6a, + 0x8a,0x90,0xb5,0xbc,0xbc,0xaf,0x7d,0x32,0x77,0xbc,0xbc,0xbc,0xa3,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0xa3, + 0xb5,0x51,0x11,0x06,0x06,0x06,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x0c,0x0c,0x06,0x10,0x10, + 0x77,0x9c,0x8a,0xbc,0xbc,0xbc,0x8a,0x1f,0x10,0x10,0xa9,0xbc,0xbc,0xbc,0x6a, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x06,0x10, + 0x10,0x11,0x96,0xb5,0x5e,0x11,0x11,0x06,0x11,0x11,0x11,0x11,0x11,0x11,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0c,0x10, + 0x10,0x7d,0xa9,0x8a,0xbc,0xbc,0xb5,0x70,0x10,0x10,0x10,0x51,0xb5,0xbc,0xbc, + 0xaf,0x1f,0x10,0x0c,0x10,0x10,0x10,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x0c,0x11,0x11,0x11,0x11,0x96,0xb5,0x51,0x11,0x06,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x12,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x06, + 0x10,0x10,0x6a,0xaf,0x8a,0xb5,0xbc,0xbc,0x70,0x10,0x06,0x10,0x10,0x83,0xbc, + 0xbc,0xbc,0x96,0x10,0x10,0x10,0x06,0x10,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x06,0x11,0x06,0x06,0x11,0x11,0x9c,0xb5,0x38,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x4b,0xb5,0x96,0xa9,0xbc,0xbc,0x8a,0x10,0x10,0x10,0x10,0x10, + 0xa3,0xbc,0xbc,0xbc,0x70,0x10,0x10,0x10,0x10,0x10,0x0f,0x0f,0x0f,0x0f,0x10, + 0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x19,0xa9,0xa9,0x12,0x11, + 0x11,0x11,0x11,0x0c,0x11,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x17,0x17,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x12,0xa9,0xaf,0x90,0xbc,0xbc,0xa9,0x06,0x10,0x06,0x10, + 0x10,0x38,0xb5,0xbc,0xbc,0xb5,0x4b,0x10,0x10,0x10,0x10,0x10,0x10,0x0f,0x0f, + 0x0f,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x4b,0xb5, + 0x83,0x11,0x06,0x06,0x11,0x11,0x11,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x17,0x17, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x7d,0xbc,0x83,0xb5,0xbc,0xb5,0x51,0x10,0x10, + 0x10,0x45,0x6a,0x8a,0xbc,0xbc,0xbc,0xaf,0x25,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x06,0x06, + 0x11,0x7d,0xb5,0x32,0x11,0x06,0x06,0x0c,0x11,0x10,0x10,0x11,0x11,0x11,0x11, + 0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x45,0xb5,0xa3,0x96,0xbc,0xbc,0x90,0x10, + 0x38,0x57,0x77,0x70,0x4b,0x7d,0xbc,0xbc,0xbc,0xa3,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x06,0x11,0x12,0xa9,0x90,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x0f,0x0f,0x0f,0x0f,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x96,0xbc,0x7d,0xaf,0xbc,0xb5, + 0x5e,0x70,0x70,0x5e,0x25,0x10,0x10,0x90,0xbc,0xbc,0xbc,0x90,0x10,0x10,0x10, + 0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x06,0x11,0x11,0x5e,0xaf,0x2b,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0xc8,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x4b,0xb5,0xa9,0x8a,0xbc, + 0xbc,0x9c,0x6a,0x38,0x12,0x10,0x10,0x0f,0x0f,0x9c,0xbc,0xbc,0xbc,0x83,0x10, + 0x10,0x11,0x11,0x11,0x11,0x11,0x0c,0x11,0x11,0x06,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x0c,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0xa3,0x83,0x11,0x0c,0x11,0x11, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x19,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0xc8,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x06,0x10,0x10,0x8a,0xc2,0x9c, + 0x96,0x90,0x51,0x10,0x10,0x10,0x10,0x10,0x10,0x0f,0x0f,0xa3,0xbc,0xbc,0xbc, + 0x77,0x10,0x11,0x11,0x11,0x11,0x11,0x06,0x0c,0x11,0x06,0x11,0x11,0x11,0x11, + 0x11,0x06,0x06,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x6a,0xa3,0x19,0x11, + 0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x14,0x13, + 0x13,0x13,0x13,0x12,0x12,0x13,0x13,0x13,0x14,0x13,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x25,0xb5, + 0xbc,0x77,0x1f,0x10,0x10,0x10,0x10,0x06,0x10,0x10,0x10,0x0f,0x0f,0xa9,0xbc, + 0xbc,0xbc,0x6a,0x10,0x10,0x11,0x11,0x11,0x11,0x06,0x11,0x11,0x11,0x06,0x11, + 0x11,0x11,0x11,0x11,0x06,0x11,0x11,0x06,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x0c,0xa3, + 0x57,0x11,0x06,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13, + 0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x11,0x11,0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x06,0x10, + 0x70,0xbc,0xa9,0x10,0x10,0x10,0x06,0x10,0x0c,0x0c,0x10,0x10,0x10,0x0c,0x57, + 0xaf,0xbc,0xbc,0xbc,0x57,0x0f,0x10,0x10,0x10,0x11,0x11,0x11,0x06,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x06,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x83,0x8a,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x18,0x17,0x16,0x16, + 0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x9c,0xc2,0x83,0x10,0x06,0x10,0x10,0x10,0x10,0x10,0x12,0x4b,0x5e, + 0x77,0x70,0xaf,0xbc,0xbc,0xbc,0x57,0x0f,0x10,0x10,0x10,0x10,0x11,0x11,0x06, + 0x77,0x90,0x90,0x90,0x90,0x90,0x90,0x8a,0x3e,0x11,0x11,0x4b,0x5e,0x4b,0x3e, + 0x2b,0x0c,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x51,0xa3,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x19, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x32,0xaf,0xbc,0x57,0x10,0x10,0x10,0x10,0x25,0x45,0x70,0x77, + 0x6a,0x51,0x0c,0x2b,0xaf,0xbc,0xbc,0xbc,0x57,0x10,0x10,0x11,0x11,0x11,0x11, + 0x11,0x11,0xa3,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0x57,0x11,0x11,0x8a,0xbc, + 0xbc,0xb5,0xaf,0xa9,0xa3,0x90,0x2b,0x12,0x0c,0x19,0x11,0x11,0x11,0x11,0x11, + 0x06,0x0c,0x11,0x11,0x12,0x12,0x9c,0x57,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x15,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x17,0x17,0x17,0x18,0x18, + 0x18,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x0c,0x10,0x57,0xbc,0xaf,0x1f,0x10,0x12,0x57,0x70,0x70,0x70, + 0x3e,0x2b,0x10,0x10,0x0f,0x32,0xaf,0xbc,0xbc,0xbc,0x57,0x10,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0xa3,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xb5,0x57,0x11,0x11, + 0x8a,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0x4b,0x12,0x38,0xa3,0xa3,0x8a,0x70, + 0x3e,0x06,0x11,0x11,0x11,0x12,0x06,0x12,0x83,0x7d,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x15, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x18,0x18,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x06,0x10,0x83,0xbc,0xa3,0x4b,0x6a,0x77,0x5e,0x51, + 0x12,0x10,0x10,0x10,0x06,0x11,0x10,0x32,0xaf,0xbc,0xbc,0xbc,0x57,0x11,0x11, + 0x11,0x12,0x12,0x12,0x12,0x12,0xa3,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0x57, + 0x12,0x12,0x90,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xb5,0x4b,0x12,0x32,0xb5,0xbc, + 0xbc,0xbc,0xb5,0x6a,0x12,0x25,0x38,0x12,0x12,0x12,0x6a,0x90,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0xc8,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0f,0x0f,0x0f, + 0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x9c,0xbc,0x9c,0x5e,0x45,0x06, + 0x10,0x11,0x11,0x11,0x11,0x0c,0x11,0x11,0x10,0x25,0xaf,0xbc,0xbc,0xbc,0x57, + 0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x8a,0xa3,0xa3,0x96,0x96,0x96,0x96, + 0x90,0x3e,0x12,0x12,0x6a,0x9c,0xa3,0xaf,0xaf,0xb5,0xbc,0xb5,0x4b,0x12,0x38, + 0xb5,0xbc,0xbc,0xbc,0xbc,0x77,0x12,0x57,0xaf,0xa3,0x70,0x2b,0x45,0x90,0x19, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x16,0x16,0x17, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0xc8, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0f, + 0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xaf,0xbc,0x6a,0x10, + 0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x0c,0x25,0x6a,0xaf,0xbc,0xbc, + 0xbc,0x6a,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x0c,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x19,0x1f,0x2b,0x4b,0x57,0x19, + 0x12,0x25,0xa3,0xbc,0xbc,0xbc,0xbc,0x77,0x12,0x57,0xbc,0xbc,0xbc,0x7d,0x12, + 0x90,0x38,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x0f,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0xb5,0xbc, + 0x45,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x32,0x51,0x5e,0x77,0x70,0x57,0xa9, + 0xbc,0xbc,0xbc,0x77,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x1f,0x4b,0x77,0x96,0xaf,0x70,0x12,0x57,0xbc,0xbc,0xbc, + 0x77,0x12,0x90,0x4b,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x17,0x17, + 0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x0f,0x0f,0x0f,0x0f,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x51, + 0xb5,0xb5,0x1f,0x11,0x11,0x11,0x2b,0x3e,0x6a,0x70,0x6a,0x6a,0x51,0x12,0x11, + 0x11,0xa3,0xbc,0xbc,0xbc,0x7d,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x19,0x12,0x45,0xaf, + 0xbc,0xbc,0x70,0x12,0x83,0x57,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x17,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x6a,0xbc,0xa9,0x12,0x3e,0x6a,0x70,0x70,0x70,0x4b,0x32,0x12,0x11,0x11, + 0x11,0x06,0x11,0x9c,0xbc,0xbc,0xbc,0x8a,0x12,0x12,0x12,0x12,0x12,0x11,0x11, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x06,0x12,0x13,0x13,0x12,0x12, + 0x12,0x25,0x70,0x9c,0x51,0x12,0x70,0x5e,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x70,0xbc,0xa9,0x77,0x6a,0x51,0x45,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x06,0x06,0x11,0x90,0xbc,0xbc,0xbc,0x96,0x12,0x12,0x12,0x12,0x12, + 0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x06, + 0x06,0x06,0x13,0x12,0x12,0x12,0x12,0x12,0x5e,0x70,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xc8,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x7d,0xc2,0x96,0x0c,0x11,0x11,0x11,0x06,0x06,0x11, + 0x11,0x11,0x06,0x11,0x06,0x11,0x11,0x77,0xbc,0xbc,0xbc,0xa3,0x12,0x12,0x12, + 0x12,0x12,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x06,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x0c,0x06,0x13,0x12,0x12,0x12,0x12,0x12,0x57,0x70,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xc8,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11, + 0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x7d,0xc2,0x7d,0x12,0x12,0x12,0x12,0x0c, + 0x06,0x06,0x11,0x11,0x11,0x11,0x11,0x0c,0x2b,0x83,0xbc,0xbc,0xbc,0xaf,0x7d, + 0x7d,0x8a,0x96,0x96,0x96,0x96,0xa3,0xa3,0xa3,0xa3,0xa3,0x96,0x90,0x96,0x96, + 0x90,0x83,0x83,0x77,0x70,0x5e,0x51,0x38,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x0c,0x13,0x12,0x12,0x12,0x12,0x12,0x57,0x70,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14, + 0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x16,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11, + 0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7d,0xc2,0x7d,0x12,0x06,0x06, + 0x12,0x12,0x12,0x11,0x11,0x2b,0x4b,0x51,0x6a,0x77,0x70,0x51,0x57,0xa3,0xbc, + 0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xc2,0xc2,0xbc,0xc2,0xc2,0xc2,0xc2,0xbc, + 0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xbc,0xb5,0xb5,0xaf,0xa3,0x96,0x7d, + 0x5e,0x4b,0x2b,0x12,0x13,0x13,0x13,0x13,0x13,0x06,0x06,0x12,0x12,0x12,0x51, + 0x5e,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x16,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x7d,0xc2,0x7d,0x12, + 0x12,0x12,0x1f,0x32,0x4b,0x70,0x70,0x6a,0x5e,0x5e,0x38,0x0c,0x11,0x11,0x11, + 0x8a,0xbc,0xbc,0xbc,0xb5,0xaf,0xaf,0xa3,0xa3,0x96,0x90,0x90,0x83,0x7d,0x7d, + 0x83,0x77,0x70,0x70,0x70,0x70,0x70,0x7d,0x83,0x83,0x83,0x90,0x96,0x9c,0xa3, + 0xa9,0xaf,0xb5,0xb5,0xa9,0xa3,0x90,0x77,0x51,0x32,0x12,0x12,0x12,0x12,0x06, + 0x12,0x51,0x51,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11, + 0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x70,0xbc, + 0x90,0x45,0x64,0x6a,0x6a,0x70,0x6a,0x3e,0x32,0x19,0x12,0x12,0x12,0x06,0x11, + 0x06,0x11,0x4b,0x7d,0x6a,0x51,0x2b,0x25,0x19,0x0c,0x11,0x11,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x19,0x25,0x38,0x57,0x77,0x8a,0x90,0x9c,0x96,0x8a,0x77,0x57, + 0x12,0x06,0x12,0x4b,0x2b,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x15,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x11,0x11,0x11,0x11,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11, + 0x5e,0xbc,0xaf,0x5e,0x4b,0x4b,0x19,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x2b,0x51, + 0x5e,0x6a,0x6a,0x2b,0x12,0x19,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x38,0xb5,0xb5,0x2b,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x06,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x06,0x11,0xa9,0xbc,0x70,0x12,0x12,0x12,0x12,0x0c,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x06,0x06,0x12,0x12,0x12,0x06,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x83,0xc2,0xa3,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x12,0x12,0x12,0x12,0x12,0x06,0x0c,0x12,0x0c,0x12,0x13,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x17,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x10,0x10, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x4b,0xb5,0xbc,0x5e,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x06,0x13,0x13,0x06,0x12,0x12,0x06,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x06,0x11,0x11,0x96,0xc2,0xa9, + 0x12,0x12,0x06,0x0c,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x19,0x45,0x3e,0x4b,0x5e,0x5e,0x5e,0x5e,0x5e,0x6a,0x77, + 0x77,0x77,0x77,0x77,0x77,0x70,0x5e,0x5e,0x5e,0x5e,0x5e,0x4b,0x45,0x45,0x1f, + 0x0c,0x0c,0x0c,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x06,0x13, + 0x13,0x06,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0xc8,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x12, + 0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x06,0x11,0x45, + 0xb5,0xbc,0x83,0x12,0x12,0x12,0x12,0x12,0x2b,0x3e,0x4b,0x57,0x6a,0x7d,0x8a, + 0x96,0x9c,0xa9,0xa9,0xaf,0xa9,0xa9,0xa9,0xa9,0xa3,0xa9,0xa3,0x96,0x9c,0x96, + 0x8a,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x8a,0x8a,0x8a,0x8a,0x83,0x8a,0x90, + 0x90,0x8a,0x9c,0x90,0x8a,0x83,0x7d,0x70,0x6a,0x57,0x57,0x51,0x3e,0x1f,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0xc8,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x12,0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x06,0x12,0x70,0xbc,0xbc,0x83,0x83,0x96,0xa3,0xa9,0xaf,0xb5,0xb5,0xbc,0xbc, + 0xb5,0xaf,0xa3,0x9c,0x8a,0x7d,0x77,0x6a,0x5e,0x45,0x3e,0x06,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x0c,0x25,0x45,0x4b,0x5e,0x5e,0x77,0x70,0x6a,0x6a, + 0x6a,0x6a,0x6a,0x5e,0x45,0x1f,0x13,0x13,0x0c,0x0c,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0xc8,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x11,0x06,0x0c,0x0c,0x12,0x96,0xbc,0xbc,0xbc,0xbc,0xbc,0xaf,0xa3,0x96,0x7d, + 0x6a,0x45,0x25,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x06, + 0x06,0x12,0x12,0x12,0x12,0x06,0x12,0x12,0x12,0x12,0x0c,0x12,0x12,0x12,0x12, + 0x12,0x12,0x06,0x06,0x06,0x0c,0x0c,0x06,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x06,0x1f,0x2b,0x2b,0x2b,0x45,0x4b,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x0c,0x06,0x0c,0x12,0x8a,0xbc,0xbc,0x90,0x5e,0x4b,0x2b,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x06,0x06,0x12,0x06,0x06,0x0c,0x12,0x12,0x12,0x12,0x0c,0x12,0x06, + 0x06,0x13,0x13,0x06,0x13,0x06,0x13,0x06,0x06,0x13,0x13,0x13,0x13,0x13,0x13, + 0x06,0x06,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x19,0x18,0x18, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x90,0xbc,0xb5,0x3e,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x19, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x11,0x11,0x11, + 0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x90,0xbc,0xb5,0x4b, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0xc8,0x11, + 0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x11,0x11,0x11,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x90,0xbc, + 0xb5,0x4b,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x13,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x16,0x16,0x16,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x17,0x17, + 0x17,0x17,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x90,0xbc,0xb5,0x4b,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x90,0xbc,0xb5,0x4b,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x15,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x16,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x19,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x90,0xbc,0xb5,0x4b,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x0c,0x06,0x06,0x12,0x13,0x06,0x13,0x13,0x06,0x13,0x12,0x12,0x12,0x12,0x13, + 0x0c,0x13,0x13,0x13,0x0c,0x0c,0x06,0x13,0x06,0x13,0x06,0x13,0x0c,0x0c,0x06, + 0x13,0x0c,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x90,0xbc,0xb5,0x4b,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x06,0x06,0x06,0x12,0x13,0x06,0x06,0x13,0x13,0x13,0x12,0x12,0x12, + 0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x06,0x13,0x06,0x06,0x06,0x0c, + 0x13,0x06,0x06,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16, + 0x16,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x90,0xbc,0xb5,0x4b,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x12,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x16,0x16,0x16,0x15,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x16,0x16,0x16,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0xc8,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x90,0xbc,0xb5,0x4b,0x12, + 0x12,0x12,0x12,0x12,0x12,0x1f,0x3e,0x51,0x64,0x6a,0x7d,0x7d,0x64,0x8a,0x96, + 0x96,0x96,0x96,0x9c,0x9c,0x9c,0x9c,0x9c,0x96,0x96,0x96,0x90,0x90,0x83,0x70, + 0x57,0x57,0x38,0x38,0x2b,0x06,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0xc8,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x06,0x11,0x90,0xbc,0xb5, + 0x4b,0x12,0x12,0x1f,0x51,0x7d,0x83,0x96,0x96,0x9c,0x9c,0x9c,0x9c,0x9c,0x64, + 0x9c,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9, + 0xa9,0xa9,0xa9,0x96,0x96,0x8a,0x8a,0x6a,0x6a,0x4b,0x3e,0x32,0x1f,0x06,0x06, + 0x14,0x14,0x14,0x14,0x14,0x0c,0x06,0x14,0x14,0x0c,0x14,0x14,0x14,0x14,0x14, + 0x14,0x0c,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a, + 0x1a,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0xc8, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x06,0x06,0x06,0x0c,0x11,0x90, + 0xbc,0xb5,0x4b,0x5e,0x8a,0xa9,0xa9,0xa9,0xa9,0xa9,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x64,0x9c,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa9,0xa9,0xa9,0xa9,0xa9, + 0xa9,0xa9,0xa9,0xa9,0x96,0x96,0x96,0x8a,0x8a,0x8a,0x70,0x70,0x70,0x70,0x4b, + 0x32,0x4b,0x4b,0x3e,0x32,0x19,0x19,0x14,0x14,0x14,0x14,0x14,0x14,0x06,0x06, + 0x06,0x06,0x14,0x06,0x0c,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x1a,0x1a,0x1a,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x06,0x12,0x06, + 0x12,0x90,0xbc,0xb5,0x70,0xb5,0xb5,0xb5,0xa9,0xa9,0xa9,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x64,0x9c,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa9,0xa9,0xa9, + 0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0x96,0x96,0x96,0x8a,0x8a,0x70,0x70,0x70, + 0x70,0x4b,0x3e,0x57,0x57,0x57,0x57,0x3e,0x8a,0x83,0x83,0x77,0x3e,0x3e,0x12, + 0x14,0x14,0x14,0x14,0x14,0x14,0x06,0x06,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1a,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x90,0xbc,0xb5,0x77,0xb5,0xb5,0xb5,0xa9,0xa9,0xa9,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x64,0x9c,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0x9c,0x96, + 0x90,0x90,0x90,0x83,0x83,0x83,0x83,0x83,0x70,0x70,0x70,0x70,0x70,0x6a,0x6a, + 0x6a,0x4b,0x4b,0x4b,0x3e,0x57,0x57,0x57,0x57,0x3e,0x8a,0x8a,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x83,0x77,0x51,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x15,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x18, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1b,0x1c,0x1a,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1b,0x1a,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x0c,0x12,0x4b,0x7d,0x8a,0xbc,0xb5,0x77,0xb5,0xb5,0xb5,0xa9,0xa9,0xa9, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x64,0x8a,0x8a,0x7d,0x6a,0x57,0x4b,0x2b, + 0x1f,0x19,0x12,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x0c,0x0c,0x06,0x19,0x1f,0x32,0x32,0x1f,0x3e,0x77,0x83, + 0x83,0x83,0x9c,0x9c,0xa9,0xa9,0x9c,0x77,0x9c,0x83,0x77,0x51,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1c,0x1a,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x0c, + 0x12,0x12,0x12,0x12,0x64,0xb5,0xaf,0x77,0xbc,0xb5,0x77,0xb5,0xb5,0xb5,0xa9, + 0xa9,0xa9,0xa9,0x9c,0x9c,0x96,0x83,0x6a,0x51,0x1f,0x19,0x13,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x1f,0x3e,0x3e,0x51,0x77,0x77,0x77,0xa9,0xa9,0xa9,0xa9,0xa9, + 0x9c,0x51,0x51,0x2b,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x06, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1a,0xc8,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13, + 0x13,0x13,0x13,0x13,0x12,0x64,0xbc,0xc2,0xa9,0x77,0xbc,0xb5,0x77,0xb5,0xb5, + 0xb5,0xb5,0xa9,0xa9,0x96,0x6a,0x51,0x19,0x14,0x13,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x13,0x13, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x2b,0x51, + 0x77,0x77,0x9c,0x51,0x9c,0x9c,0x9c,0x77,0x51,0x3e,0x06,0x15,0x15,0x15,0x06, + 0x06,0x0c,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a, + 0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0xc8,0x12,0x12,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13, + 0x13,0x14,0x0c,0x06,0x06,0x13,0x4b,0xbc,0xc2,0xc2,0xa9,0x77,0xbc,0xb5,0x77, + 0xb5,0xb5,0xb5,0xa9,0x83,0x51,0x12,0x14,0x14,0x14,0x06,0x13,0x13,0x13,0x06, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x06,0x06,0x14,0x14,0x14,0x06, + 0x15,0x15,0x15,0x15,0x15,0x15,0x2b,0x3e,0x77,0x83,0x9c,0x9c,0x77,0x77,0x51, + 0x1f,0x0c,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0xc8,0x12, + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x14,0x14,0x14,0x14,0x14,0x19,0xaf,0xc2,0xc2,0xc2,0xa9,0x77,0xbc, + 0xb5,0x77,0xb5,0xa9,0x7d,0x32,0x13,0x13,0x13,0x14,0x14,0x0c,0x14,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x06,0x06,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x1f,0x51, + 0x51,0x77,0x77,0x77,0x51,0x3e,0x12,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x1a,0x19,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1a,0x19,0x19,0x1a,0x1c,0x1c,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1c, + 0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x13,0x13,0x13,0x14,0x14,0x14,0x06,0x14,0x14,0x8a,0xc2,0xc2,0xc2,0xc2,0xa9, + 0x77,0xbc,0xb5,0x70,0x8a,0x2b,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x0c,0x15,0x15,0x15,0x15, + 0x15,0x15,0x14,0x14,0x15,0x12,0x3e,0x51,0x1f,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1a,0x1a,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1b,0x1b,0x1d,0x1d,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1c,0x1c,0x1b,0x19,0x19,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1b,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x2b,0xbc,0xc2,0xc2,0xc2, + 0xc2,0xa9,0x7d,0xc2,0xa3,0x32,0x13,0x13,0x12,0x0c,0x13,0x13,0x13,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x17,0x17, + 0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1c,0x1b,0x1c,0x1b,0x1a,0x1a, + 0x1b,0x1a,0x1a,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b,0x1a,0x1a,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x12,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x8a,0xc2,0xc2, + 0xc2,0xc2,0xc2,0xa9,0x77,0x90,0x19,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17, + 0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1b,0x1c,0x1c,0x1d,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x0c,0xb5, + 0xc2,0xc2,0xc2,0xc2,0xc2,0xaf,0x1f,0x13,0x13,0x0c,0x13,0x13,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x06,0x06,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1c,0x1b,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0xc8,0x12,0x12,0x12,0x12,0x12,0x12, + 0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x2b,0xc2,0xc2,0xc2,0xc2,0xc2,0xc2,0x7d,0x13,0x13,0x06,0x13,0x13,0x13,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x13,0x13,0x13, + 0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x0c, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x1a,0x1b,0x1c,0x1c,0x1b,0x1b,0x1a,0x19,0x1a,0x1b,0x1c, + 0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0xc8,0x12,0x12,0x12,0x12, + 0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x64,0xc2,0xc2,0xc2,0xc2,0xc2,0x90,0x13,0x13,0x0c,0x06,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x13, + 0x13,0x13,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b,0x1a,0x19,0x19,0x1a, + 0x1b,0x1c,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xc8,0x12,0x12, + 0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x83,0xc2,0xc2,0xc2,0xc2,0xaf,0x19,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14, + 0x14,0x14,0x14,0x13,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1b, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xc8, + 0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x83,0xc2,0xc2,0xc2,0xc2,0x57,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b, + 0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x83,0xc2,0xc2,0xc2,0xa3,0x14,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1b,0x1b, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0xc8,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x83,0xc2,0xc2,0xc2,0x57, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x16,0x17,0x17,0x17,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x19,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1a, + 0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0xc8,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x77,0xc2,0xc2, + 0xaf,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x18,0x18,0x17,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c,0x1d,0x1c,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0xc8,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x51, + 0xc2,0xc2,0x90,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x15, + 0x15,0x15,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x18,0x18,0x18,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c,0x1d,0x1c, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xc8,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x25,0xc2,0xc2,0x6a,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x16,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b, + 0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c, + 0x1d,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xc8,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x12,0xb5,0xc2,0x45,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x16,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x17,0x17,0x17,0x17,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1d,0x1d,0x1c,0x1b,0x1b,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b, + 0x1c,0x1c,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0xc8,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x9c,0xc2,0x12,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x16,0x15, + 0x15,0x15,0x16,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x17,0x17,0x17,0x17, + 0x17,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1c,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1b,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0xc8,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x70,0xb5,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x16,0x15,0x15,0x16,0x17,0x18,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1b,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0xc8,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x06,0x14,0x19,0xa3,0x0c,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x16,0x15,0x15,0x16,0x17,0x17,0x18,0x18,0x18,0x18,0x17,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1c,0x1c,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1d,0x1d,0xc8,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x45,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1c,0x1c,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1d,0x1e,0x1f,0x1e,0x1d,0x1c,0x1c,0x1c,0x1d,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0xc8,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x20,0x1e,0x1d,0x1c,0x1c,0x1c,0x1d,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0xc8,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16,0x15,0x15,0x15,0x15, + 0x16,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x17,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1e,0x1d,0x1e,0x1e,0xc8,0x14,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0xc8,0x14,0x14, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a, + 0x1b,0x1c,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b, + 0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1d,0x1d,0x1c,0x1b, + 0x1a,0x1a,0x1b,0x1d,0x1d,0x1e,0x1d,0x1d,0x1c,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d, + 0x1c,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e, + 0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0xc8, + 0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x19,0x19, + 0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1d,0x1d, + 0x1d,0x1b,0x1b,0x1b,0x1c,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e, + 0x1d,0x1d,0x1c,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f, + 0x1e,0x1f,0x1f,0x1f,0x1e,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1e,0x1f,0x1f,0x20,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x1f, + 0x1e,0xc8,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1a,0x1a,0x1b,0x1c,0x1b,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1e,0x1f,0x20,0x20,0x1f, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1f, + 0x20,0x20,0x20,0x20,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0xc8,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x17,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18, + 0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19, + 0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1b,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1d,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1c,0x1c,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1d,0x1e,0x20, + 0x20,0x20,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1d,0x1d,0xc8,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1b,0x1b,0x1c,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1e,0x20,0x20,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d, + 0x1d,0x1e,0x20,0x20,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0xc8,0x14,0x14,0x14,0x14,0x14,0x14,0x14, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1c, + 0x1b,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x1e, + 0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x1f,0x1e,0x1d,0x1e,0x1e,0x1e,0x1f,0x20,0x1f, + 0x1e,0x1d,0x1d,0x1e,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0xc8,0x14,0x14,0x14,0x14,0x14, + 0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18,0x19, + 0x19,0x19,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d, + 0x1d,0x1c,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1e,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x1f,0x1f,0x1e, + 0x1e,0x1f,0x1f,0x1d,0x1d,0x1e,0x1e,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x20,0x1e,0x1d,0x1f,0x1f,0x1e,0x1f, + 0x20,0x20,0x1e,0x1d,0x1d,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0xc8,0x14,0x14,0x14, + 0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1d,0x1d,0x1c,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b, + 0x1b,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1d,0x1c,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1f,0x20, + 0x1f,0x1f,0x20,0x20,0x1f,0x1e,0x1f,0x20,0x21,0x21,0x20,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0xc8,0x14, + 0x14,0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x16,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a, + 0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1d,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1c,0x1c,0x1b,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x20, + 0x20,0x1f,0x1e,0x1e,0x1e,0x1f,0x1e,0x1d,0x1c,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x1f,0x1f, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x21,0x20,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1e,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e, + 0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x19, + 0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e, + 0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1f, + 0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b, + 0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1d,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c, + 0x1c,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1c,0x1d,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e, + 0x1e,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e, + 0x1d,0x1e,0x1f,0x20,0x20,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x21,0x20, + 0x20,0x1d,0x1e,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1b,0x1a,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a, + 0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1c,0x1d,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20, + 0x1f,0x1e,0x1d,0x1e,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x20,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c,0x1d,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xc8,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x15,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x19,0x1a,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1e,0x1e,0x1d,0x1e,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x20,0x20,0x20,0x1f,0x1f,0x1e, + 0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x20,0x1f,0x1f,0x20,0x21,0x21,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x21,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0xc8,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x19,0x19,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1d,0x1c,0x1b,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e, + 0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x20,0x20,0x1e,0x1e,0x1f,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20, + 0x20,0x20,0x20,0x21,0x21,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0xc8,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x17,0x17,0x17,0x17,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1d,0x1d,0x1c,0x1c,0x1b,0x1c,0x1d,0x1c,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x21,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x1f, + 0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xc8, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x16,0x16,0x16, + 0x16,0x16,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1d,0x1d,0x1c,0x1b,0x1a,0x1b,0x1d,0x1c,0x1a,0x1b,0x1c,0x1c, + 0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1e,0x1e,0x1d,0x1c, + 0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x1d,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1f,0x20, + 0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20, + 0x1f,0x1f,0x1f,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20, + 0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x20, + 0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x21,0x21,0x21,0x20,0x1f,0x1f,0x1f,0x20, + 0x20,0x1f,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1b,0x1a,0x1a,0x1b,0x1d,0x1c,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1e,0x1e, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x20, + 0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1e, + 0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x21,0x21,0x21,0x20,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x19,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1a,0x1a,0x1b,0x1d,0x1c, + 0x1b,0x1c,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x20, + 0x20,0x21,0x20,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x1e,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x20,0x20,0x21,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21,0x20, + 0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1a,0x1a,0x1b, + 0x1d,0x1c,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1b,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e, + 0x1e,0x1f,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x21,0x21,0x21,0x22,0x22,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1e,0x1f,0x20,0x21,0x21,0x20,0x1e,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b, + 0x1b,0x1c,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1b,0x1b,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f, + 0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1e,0x1f,0x20,0x21,0x21,0x20,0x1d,0x1e,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20, + 0x21,0x22,0x22,0x21,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20, + 0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0xc8,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1b,0x1c,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x21,0x20,0x20,0x20,0x1f,0x1f, + 0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x22,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x20,0x21,0x21,0x20,0x1e,0x1e, + 0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x21,0x21,0x21,0x21, + 0x20,0x21,0x21,0x22,0x21,0x21,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0xc8,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x20,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x20,0x20,0x21,0x20,0x20,0x1f,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x1f,0x1e,0x1f,0x20,0x21,0x21,0x20, + 0x1e,0x1e,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x22,0x22,0x21,0x21,0x21,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0xc8,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x16,0x16, + 0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1c,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f, + 0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x20,0x20,0x21,0x20,0x20,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x1f,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1f,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x21,0x21, + 0x21,0x21,0x20,0x20,0x21,0x21,0x22,0x22,0x20,0x20,0x22,0x22,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x21,0x21,0x22,0x22,0x22,0x21, + 0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1c,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20, + 0x20,0x1f,0x1e,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1f,0x20,0x20,0x20, + 0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1e,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20, + 0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20, + 0x21,0x21,0x21,0x21,0x20,0x21,0x21,0x22,0x22,0x22,0x21,0x20,0x22,0x22,0x21, + 0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x16,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1c,0x1d,0x1d,0x1e,0x1d,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x20,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1f, + 0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x22,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x22, + 0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x22,0x23,0x23,0x22,0x21,0x21,0x22, + 0x22,0x21,0x20,0x20,0x21,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x16,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1c,0x1c,0x1d,0x1e, + 0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1f,0x20,0x20,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f, + 0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x21,0x20,0x20,0x20,0x21,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x22,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x21, + 0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x22,0x23,0x23,0x22,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x23,0x23,0x22,0x21, + 0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0xc8,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1d,0x1d,0x1b,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1e,0x1f,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x1f, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20, + 0x20,0x20,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1d,0x1d,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x21,0x20,0x20, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x22,0x22,0x21,0x21,0x20,0x20,0x21,0x23,0x22,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x20,0x20,0x20,0x20,0x20,0x21,0x22, + 0x23,0x22,0x21,0x21,0x21,0x22,0x20,0x20,0x20,0x22,0x23,0x23,0x22,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x23,0x22,0x21,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x23, + 0x23,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0xc8,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17, + 0x18,0x19,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x17,0x18,0x18,0x18,0x19,0x18, + 0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1b,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20, + 0x20,0x1f,0x1f,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1f,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x21, + 0x21,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x21,0x21,0x20,0x20,0x21,0x23,0x23,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21, + 0x22,0x22,0x23,0x22,0x22,0x22,0x23,0x23,0x22,0x21,0x21,0x22,0x22,0x22,0x21, + 0x21,0x21,0x21,0x20,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x23,0x22,0x22,0x22,0x23,0x22,0x21,0x21,0x20,0x21,0x22,0x22,0x22,0x22, + 0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x23,0xc8,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1c,0x1c,0x1b,0x1b,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f, + 0x20,0x20,0x1f,0x1f,0x1e,0x1d,0x1e,0x1f,0x1e,0x1e,0x1e,0x20,0x20,0x20,0x1f, + 0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1e,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x20,0x20,0x21,0x22,0x22,0x22,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x20,0x1e,0x1d,0x1e,0x20,0x20,0x22,0x22,0x21,0x20,0x1e,0x1f,0x20,0x21,0x22, + 0x22,0x21,0x20,0x20,0x20,0x20,0x22,0x23,0x23,0x21,0x20,0x1f,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x20,0x20,0x1f,0x20, + 0x20,0x20,0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x23, + 0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x20, + 0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x23,0x24,0x23, + 0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x23,0x22,0x22,0x21, + 0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x21,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0xc8,0x15,0x15, + 0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1b,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x1f,0x1e,0x1e,0x1f,0x20, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1e,0x1d,0x1e,0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x21,0x21,0x21,0x20,0x20, + 0x1f,0x1f,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x1f,0x1e,0x20,0x21,0x21,0x21,0x21,0x20,0x1f,0x1f,0x20, + 0x21,0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x21,0x23,0x24,0x22,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x21,0x21,0x22,0x22,0x21,0x20,0x21,0x21,0x20,0x20,0x20,0x22,0x22,0x22,0x21, + 0x21,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x24, + 0x24,0x23,0x23,0x22,0x23,0x23,0x23,0x22,0x22,0x23,0x23,0x24,0x24,0x23,0x22, + 0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x22,0x22,0x22,0x22,0x23,0x24,0x24,0xc8, + 0x15,0x15,0x15,0x15,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18, + 0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1b,0x1c,0x1c,0x1b,0x1b,0x1c, + 0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1e,0x1e, + 0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x21,0x21,0x21, + 0x21,0x20,0x1f,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x1f, + 0x20,0x20,0x21,0x22,0x22,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x24,0x22,0x21, + 0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x20,0x21,0x21,0x20,0x20,0x20,0x22,0x22, + 0x22,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x23, + 0x22,0x23,0x24,0x23,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x23,0x23,0x24,0x23, + 0x23,0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x23,0x24,0x24,0x23,0x22, + 0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x23,0x23,0x24, + 0x24,0xc8,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x16,0x16,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x19, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1b,0x1d,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1f,0x20,0x20,0x1f, + 0x1e,0x1d,0x1e,0x1f,0x1f,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x23, + 0x22,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x20,0x20,0x20, + 0x21,0x22,0x22,0x21,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x24,0x23,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x22,0x22, + 0x21,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0xc8,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x18,0x17,0x17,0x17,0x17, + 0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1d, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1d,0x1e, + 0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1f,0x1e,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1e,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x22,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x21,0x21,0x21,0x20,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x22,0x23,0x24,0x23, + 0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x22,0x21, + 0x20,0x20,0x21,0x22,0x22,0x21,0x20,0x20,0x21,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x23,0x23, + 0x23,0x23,0x24,0x23,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23, + 0x23,0x23,0x23,0x23,0x24,0xc8,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19, + 0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a, + 0x1b,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1a,0x1b,0x1c, + 0x1e,0x20,0x20,0x20,0x1f,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1e,0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1e,0x1f,0x20,0x20, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x23, + 0x24,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22, + 0x22,0x21,0x20,0x20,0x21,0x22,0x22,0x22,0x21,0x21,0x22,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24, + 0x24,0x23,0x23,0x23,0x24,0x24,0x23,0x22,0x22,0x22,0x21,0x21,0x22,0x23,0x23, + 0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22, + 0x21,0x21,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x23,0x23,0x23,0xc8,0x16,0x16,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a, + 0x1b,0x1b,0x1a,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1a,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b, + 0x1c,0x1d,0x1e,0x1f,0x20,0x1f,0x1d,0x1c,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x1f,0x1f,0x1e,0x1e,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1e,0x1d,0x1d,0x1e, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x20,0x21,0x22,0x21,0x21,0x21,0x21,0x21,0x20,0x20, + 0x20,0x20,0x20,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x23, + 0x23,0x22,0x22,0x23,0x24,0x24,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x20,0x20, + 0x20,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x20, + 0x20,0x21,0x22,0x21,0x20,0x20,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x21,0x22,0x22,0x21,0x21,0x22,0x23, + 0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0xc8,0x16,0x16,0x16,0x16,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d, + 0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1f,0x20,0x20,0x20,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1f,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x1d, + 0x1d,0x1e,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20, + 0x20,0x20,0x21,0x21,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21, + 0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x20,0x20,0x21,0x21,0x20,0x20,0x21,0x21, + 0x22,0x22,0x23,0x22,0x22,0x24,0x24,0x24,0x23,0x23,0x22,0x22,0x21,0x21,0x21, + 0x20,0x20,0x20,0x22,0x23,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x21,0x20,0x22,0x23,0x22,0x21,0x20,0x21,0x22,0x23,0x23,0x23,0x24,0x24, + 0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x22,0x22,0x21,0x21, + 0x22,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0xc8,0x15,0x15,0x16, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1c,0x1c,0x1b,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1c,0x1d,0x1d,0x1f,0x1f,0x1e,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x20, + 0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22, + 0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22, + 0x21,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x23,0x23, + 0x23,0x23,0x23,0x22,0x21,0x24,0x24,0x24,0x22,0x21,0x21,0x21,0x22,0x22,0x22, + 0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x22,0x22, + 0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x22,0x22,0x23,0x23, + 0x23,0x22,0x22,0x21,0x21,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0xc8,0x15, + 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1a,0x19,0x19,0x19,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1c,0x1c,0x1b,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1c,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1c,0x1c,0x1d,0x1e,0x1f,0x20, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x20,0x20,0x1f,0x1f,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x21, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22, + 0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x22, + 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x23,0x23,0x23,0x22,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x23,0x25,0x25,0x24,0x23,0x21,0x21,0x22,0x22, + 0x21,0x21,0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x23,0x23,0x22,0x22, + 0x22,0x23,0x23,0x22,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x23,0x23, + 0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x24,0x24,0x23,0x23,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0xc8,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1f, + 0x20,0x20,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x22,0x23,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x23,0x23, + 0x23,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x23, + 0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x23,0x22, + 0x22,0x21,0x20,0x20,0x20,0x20,0x21,0x23,0x24,0x26,0x26,0x24,0x22,0x21,0x22, + 0x22,0x22,0x22,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x24,0x24,0x24,0x24,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24, + 0x24,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0xc8,0x16,0x16,0x16,0x16,0x16,0x16,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1b,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f, + 0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20, + 0x20,0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1d, + 0x1d,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20, + 0x1f,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f, + 0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x21,0x21, + 0x22,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23, + 0x22,0x23,0x24,0x24,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x21,0x20,0x20, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24, + 0x24,0x23,0x22,0x22,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x21, + 0x20,0x22,0x24,0x24,0x24,0x23,0x22,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x26, + 0x25,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x23,0x23,0xc8,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x18,0x18,0x18,0x18,0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x18,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1b,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x1f,0x1e,0x1d,0x1e,0x1e, + 0x1f,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20, + 0x20,0x21,0x21,0x21,0x21,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21, + 0x21,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22, + 0x23,0x22,0x22,0x23,0x24,0x24,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22, + 0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x24,0x23,0x23,0x22,0x22,0x23,0x23,0x24,0x24,0x23,0x23,0x24,0x24, + 0x23,0x21,0x21,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x23,0xc8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x17,0x18,0x1a, + 0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20, + 0x1f,0x1e,0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22, + 0x21,0x1f,0x1f,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x22,0x23,0x23,0x22, + 0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x22,0x22,0x23,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x22, + 0x21,0x21,0x22,0x22,0x23,0x24,0x24,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x23,0x22,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x26,0x25,0x23,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0xc8,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x20,0x20,0x1f,0x1f,0x1f,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x22,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x21,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22, + 0x23,0x22,0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x20,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x24,0x23,0x23,0x23,0x24,0x23,0x23, + 0x23,0x22,0x21,0x21,0x22,0x22,0x23,0x23,0x24,0x23,0x23,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x22,0x22, + 0x23,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x22,0x23,0x22, + 0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x23,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0xc8,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x22,0x22,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x22,0x22,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x20,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x22,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0xc8,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1b,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1b,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22, + 0x22,0x22,0x23,0x23,0x24,0x23,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x23,0x23, + 0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x24,0x24,0x23,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x24,0x24,0x25,0x26,0x25, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x25,0x24,0xc8, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1b,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21, + 0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x24,0x23,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x22,0x22,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23, + 0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x23,0x24,0x24,0x23,0x23,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x24,0x24,0x24,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x25, + 0x26,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26, + 0x25,0xc8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19, + 0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b, + 0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x1e,0x1f,0x20, + 0x20,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x21,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x21, + 0x21,0x22,0x21,0x21,0x21,0x20,0x20,0x21,0x22,0x23,0x23,0x23,0x22,0x22,0x22, + 0x22,0x23,0x24,0x23,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x21,0x21,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23, + 0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25, + 0x24,0x25,0x25,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x25,0x26, + 0x26,0x26,0x26,0xc8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1f, + 0x1f,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e, + 0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x21,0x21,0x21,0x20, + 0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x21,0x21,0x20,0x21, + 0x21,0x22,0x22,0x23,0x22,0x22,0x22,0x21,0x20,0x21,0x22,0x23,0x23,0x23,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21, + 0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x21, + 0x22,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x25,0x26,0x26,0x25,0xc8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1d, + 0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20, + 0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22, + 0x21,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x21,0x22,0x22,0x23,0x23, + 0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x22, + 0x21,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22, + 0x22,0x21,0x22,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x26,0x26,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0xc8,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c, + 0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x21,0x22,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x22,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x22,0x21,0x22,0x24,0x25,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24, + 0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x26,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x27,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xc8,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x23,0x23,0x23, + 0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x22,0x21,0x22,0x24,0x24,0x24,0x24,0x23,0x23,0x22,0x23, + 0x23,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x26,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25, + 0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x26,0x25,0x25,0x25,0x25, + 0x25,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xc8,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x21,0x22,0x21,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x23,0x23,0x23, + 0x23,0x23,0x22,0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x22,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x24,0x24,0x23, + 0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x23,0x24,0x24,0x24,0x23,0x23,0x22, + 0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24, + 0x25,0x25,0x25,0x26,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x27,0x26,0x25,0x25, + 0x26,0x26,0x26,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x26,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0xc8,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19, + 0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20, + 0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20, + 0x22,0x21,0x20,0x20,0x20,0x22,0x22,0x22,0x21,0x21,0x22,0x21,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x23, + 0x23,0x22,0x22,0x22,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22, + 0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x23,0x23,0x23,0x21,0x20,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x22,0x21, + 0x21,0x22,0x23,0x23,0x23,0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x23,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x23,0x22,0x23,0x24,0x24,0x24,0x24, + 0x23,0x22,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x25,0x25,0x25, + 0x24,0x24,0x25,0x25,0x26,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x25,0x26,0x25,0x24,0x24,0x25,0x25,0x25,0x26,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x25,0x25,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x26, + 0x25,0x24,0x25,0x25,0x25,0x25,0x26,0x27,0x27,0x27,0x26,0x26,0x25,0x25,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x27,0x26, + 0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x24,0x25,0x26,0x26,0x26,0x26,0x27,0x26, + 0x26,0x25,0x24,0x24,0x24,0x25,0x26,0x27,0x27,0x26,0x25,0x25,0x24,0x24,0x25, + 0xc8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1a,0x19,0x1a,0x1a,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1f, + 0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21, + 0x20,0x21,0x22,0x22,0x21,0x20,0x21,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x21,0x20,0x21,0x21,0x22,0x22, + 0x22,0x22,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x23,0x23,0x23,0x21,0x20,0x22,0x23,0x23,0x23,0x23,0x23,0x22, + 0x22,0x22,0x22,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x23,0x22,0x22,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x25, + 0x25,0x25,0x24,0x24,0x25,0x25,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x25, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28, + 0x27,0x26,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x26,0x25,0x24,0x24,0x25,0x26,0x27,0x28,0x27,0x27,0x26,0x26,0x25, + 0x25,0x25,0xc8,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1a,0x1a,0x19,0x1a,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1a,0x1a, + 0x1a,0x1a,0x1b,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x22,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x22,0x23,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x21,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x24,0x24,0x23,0x22, + 0x21,0x21,0x22,0x23,0x23,0x22,0x24,0x25,0x24,0x24,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x22, + 0x23,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24, + 0x24,0x24,0x24,0x25,0x25,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x27,0x27, + 0x26,0x26,0x26,0x25,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x24,0x24,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x27,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0x28,0x27,0x27,0x26,0x25,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x27,0x25, + 0x25,0x26,0x27,0x27,0x28,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0xc8,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x17,0x17,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1b,0x1a,0x1a,0x1a,0x1b, + 0x1a,0x19,0x1a,0x1a,0x1b,0x1c,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f, + 0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x22,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20, + 0x20,0x20,0x22,0x23,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x21, + 0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x24,0x24,0x24, + 0x23,0x22,0x21,0x21,0x22,0x23,0x23,0x22,0x23,0x25,0x24,0x24,0x23,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23, + 0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x26,0x26, + 0x27,0x26,0x26,0x26,0x25,0x25,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x27,0x27, + 0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x26,0x26,0x25,0x26,0x27,0x27,0x27,0x27, + 0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0xc8,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1b,0x1a,0x1a,0x19, + 0x19,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x20,0x20,0x20,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x23,0x22,0x22,0x23,0x23,0x23,0x22,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x26, + 0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x27, + 0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x27,0x27,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0xc8,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a, + 0x1a,0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x19, + 0x1a,0x1c,0x1b,0x1b,0x1b,0x1c,0x1b,0x1c,0x1b,0x1b,0x1a,0x1b,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x21,0x21, + 0x21,0x21,0x20,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x26,0x25,0x25,0x24,0x25,0x25,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x27, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x27,0x26,0x27,0x27,0x28,0x28,0x27,0x27,0x26,0x26,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0xc8,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x19,0x1a,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1a,0x19,0x1a,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x25,0x25,0x25,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26, + 0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x25, + 0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0xc8,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x19,0x19,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x28,0x28,0x27,0x27,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x27, + 0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0xc8, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x18, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1b, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x19,0x1a,0x1a,0x1b,0x1c,0x1d,0x1d,0x1d, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x26,0x26,0x25, + 0x25,0x25,0x25,0x26,0x27,0x27,0x27,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x26,0x26,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0xc8,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x18,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1c,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x22,0x21,0x21, + 0x22,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x25, + 0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x28,0x27,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x26,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x27,0x27, + 0x27,0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0xc8,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x18, + 0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1b, + 0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x1a, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20, + 0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x21, + 0x21,0x21,0x22,0x23,0x23,0x24,0x24,0x23,0x23,0x22,0x23,0x23,0x24,0x24,0x24, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26, + 0x26,0x26,0x26,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26, + 0x26,0x25,0x25,0x25,0x26,0x26,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x27,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26, + 0x27,0x27,0x27,0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0xc8,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x18,0x18, + 0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1a, + 0x1a,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x23,0x23,0x22,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23, + 0x22,0x22,0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23, + 0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x25, + 0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x25, + 0x25,0x27,0x27,0x26,0x25,0x25,0x26,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x26, + 0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x26,0x27,0x27,0x27,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0xc8,0x18,0x18,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20,0x20, + 0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x22,0x23,0x23,0x22,0x22,0x21, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21, + 0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26, + 0x26,0x25,0x25,0x28,0x28,0x27,0x26,0x26,0x27,0x27,0x28,0x27,0x27,0x27,0x27, + 0x27,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27, + 0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0xc8,0x18,0x18,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x18,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1c,0x1d,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x22,0x22,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x22,0x23,0x22, + 0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x21,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x22, + 0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24, + 0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x24,0x25,0x24,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x25,0x26,0x28,0x28,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28, + 0x28,0x27,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0xc8,0x19,0x19,0x19, + 0x19,0x1a,0x1a,0x19,0x19,0x19,0x18,0x18,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1a,0x19,0x1b,0x1c,0x1d,0x1d,0x1d,0x1c, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1e,0x1f,0x1e,0x1d,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21, + 0x22,0x22,0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21, + 0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x23,0x23,0x24,0x25, + 0x24,0x24,0x24,0x24,0x26,0x26,0x26,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x26, + 0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26, + 0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27, + 0x28,0x28,0x28,0x27,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27, + 0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0xc8,0x19, + 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x19,0x19, + 0x18,0x19,0x19,0x1a,0x1a,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a, + 0x1a,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1c,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1b,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x22, + 0x22,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x25,0x24,0x24,0x24, + 0x24,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x27,0x27,0x27, + 0x27,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x27,0x26,0x26,0x26, + 0x26,0x27,0x27,0x28,0x28,0x27,0x27,0x26,0x27,0x28,0x28,0x26,0x26,0x27,0x28, + 0x28,0x28,0x28,0x27,0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0xc8,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b, + 0x19,0x19,0x18,0x19,0x19,0x1b,0x1c,0x1b,0x19,0x19,0x19,0x19,0x19,0x19,0x19, + 0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b,0x1c, + 0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1b,0x1b,0x1d,0x1d,0x1d,0x1c,0x19,0x1a,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1d,0x20, + 0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x21,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x23,0x23, + 0x23,0x23,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x26,0x27,0x27,0x27,0x26,0x25, + 0x24,0x25,0x25,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x27,0x27, + 0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x28,0x28,0x26,0x26, + 0x26,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x2a,0x2a,0x29,0x28,0x28,0x28,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0xc8,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1a,0x19,0x19,0x19,0x1a,0x1c,0x1c,0x1c,0x1a,0x19,0x19,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1a,0x1a, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1c,0x19,0x1a,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x21,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20, + 0x20,0x20,0x21,0x21,0x22,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x28,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x27,0x27,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x27, + 0x28,0x27,0x27,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x25,0x26,0x28,0x27, + 0x26,0x26,0x26,0x28,0x28,0x28,0x28,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29, + 0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x29,0x29, + 0x28,0x28,0x28,0x28,0xc8,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1a,0x19,0x19,0x19,0x1a,0x1c,0x1c,0x1c,0x1b,0x1a,0x19, + 0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c, + 0x1b,0x1a,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1c,0x1d,0x1d,0x1c,0x1a,0x1a,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x21,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x23,0x22, + 0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x27,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x27,0x26,0x26,0x26,0x25,0x25,0x24,0x24,0x24,0x24, + 0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x28,0x28,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x26,0x27,0x28,0x28,0x27,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x26,0x26, + 0x28,0x28,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x26,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x29, + 0x29,0x29,0x29,0x28,0x28,0x29,0xc8,0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x1a, + 0x1b,0x1c,0x1c,0x1c,0x1b,0x1a,0x19,0x19,0x19,0x19,0x1a,0x1b,0x1c,0x1c,0x1a, + 0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1a,0x1b,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x21,0x21, + 0x21,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x22,0x22, + 0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x22,0x21,0x21,0x22,0x22, + 0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x21,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x23,0x24, + 0x24,0x24,0x24,0x23,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x28,0x26, + 0x26,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27, + 0x26,0x27,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0xc8,0x1a,0x1a,0x1a,0x19,0x19,0x19, + 0x1a,0x1b,0x1c,0x1d,0x1c,0x1c,0x1c,0x1b,0x1a,0x19,0x19,0x19,0x1a,0x1b,0x1b, + 0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1b, + 0x1c,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x20,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1e,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x20,0x20,0x21,0x21,0x22, + 0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22, + 0x23,0x24,0x24,0x23,0x22,0x21,0x21,0x21,0x22,0x23,0x23,0x22,0x22,0x21,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x27, + 0x27,0x26,0x25,0x24,0x24,0x24,0x26,0x27,0x27,0x27,0x26,0x25,0x26,0x27,0x26, + 0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x26,0x27,0x27,0x27,0x27,0x27,0x28,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0x28,0x28,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x27,0x26,0x27,0x28,0x28,0x28,0x27,0x28,0x28,0x28,0x29,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x28,0x28,0x28,0x28, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x29,0x29,0x29,0x29,0x29, + 0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x29,0x29, + 0x29,0x29,0x29,0x29,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0xc8,0x1b,0x1b,0x1b,0x1a, + 0x19,0x1a,0x1a,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1b,0x1a,0x1a,0x19,0x1a,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1d,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1d,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x20,0x20,0x21, + 0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x24,0x24,0x24,0x24,0x23,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x26, + 0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26, + 0x27,0x27,0x26,0x25,0x24,0x24,0x24,0x24,0x26,0x27,0x27,0x26,0x26,0x25,0x26, + 0x27,0x27,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28, + 0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29, + 0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a, + 0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29, + 0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0xc8,0x1c,0x1c, + 0x1b,0x1a,0x1a,0x1a,0x1b,0x1c,0x1d,0x1d,0x1d,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20, + 0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x1f,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x22,0x22,0x22,0x21, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x25, + 0x25,0x25,0x26,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x26, + 0x27,0x27,0x26,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x27,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x25, + 0x25,0x26,0x27,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x28,0x28,0x29,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x2a,0x29, + 0x29,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x29,0x28,0x28,0x29, + 0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a, + 0x2a,0x2a,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2b,0x2b,0x2a, + 0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2b,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0xc8, + 0x1c,0x1c,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1c,0x1d,0x1c,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x20,0x20, + 0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f, + 0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x21, + 0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x22,0x22,0x23,0x23, + 0x22,0x22,0x22,0x23,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24, + 0x25,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x26, + 0x26,0x26,0x27,0x27,0x27,0x26,0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x27,0x26,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26, + 0x25,0x25,0x25,0x26,0x27,0x27,0x26,0x26,0x26,0x25,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x28,0x29,0x2a,0x29,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a, + 0x2a,0x2a,0x29,0x28,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x29,0x28, + 0x28,0x29,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2b, + 0x2b,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x29,0x29, + 0x29,0xc8,0x1c,0x1c,0x1b,0x1b,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x21,0x22,0x21,0x21, + 0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22, + 0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x22,0x22, + 0x22,0x23,0x23,0x24,0x24,0x23,0x22,0x22,0x23,0x23,0x23,0x22,0x22,0x23,0x23, + 0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x24,0x24,0x24,0x25, + 0x25,0x25,0x25,0x26,0x27,0x27,0x27,0x27,0x26,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x26,0x26,0x27,0x26,0x25,0x26,0x26,0x27,0x27,0x27,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x29,0x29,0x28,0x28,0x28,0x29,0x29, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x29,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a, + 0x29,0x29,0x29,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x22,0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x21,0x23, + 0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22, + 0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x22,0x23,0x23,0x23,0x23, + 0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24, + 0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x25,0x26,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x24, + 0x25,0x25,0x25,0x25,0x25,0x26,0x27,0x27,0x27,0x27,0x26,0x25,0x24,0x24,0x25, + 0x26,0x26,0x26,0x26,0x25,0x26,0x26,0x27,0x27,0x26,0x26,0x26,0x27,0x27,0x27, + 0x27,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x28,0x28,0x29, + 0x29,0x2a,0x2b,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20, + 0x21,0x23,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x23,0x23,0x23, + 0x23,0x23,0x22,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x22,0x22, + 0x22,0x22,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x27,0x27,0x27,0x27,0x27,0x26,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x28, + 0x28,0x29,0x2a,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1e,0x1e,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22, + 0x22,0x21,0x22,0x23,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21, + 0x21,0x21,0x22,0x22,0x21,0x21,0x20,0x20,0x21,0x23,0x23,0x22,0x21,0x20,0x22, + 0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23, + 0x22,0x22,0x22,0x22,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24, + 0x24,0x23,0x23,0x24,0x24,0x25,0x26,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x27,0x27,0x27, + 0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x27,0x27, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x27,0x27,0x27,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x27,0x27,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x29,0x29,0x29,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x2a,0x29,0x28,0x28,0x28,0x28,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2a, + 0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29, + 0x29,0x28,0x28,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x29,0x29,0x2a,0x2a, + 0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x22, + 0x22,0x22,0x22,0x21,0x22,0x23,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x23,0x23,0x22,0x22, + 0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x24,0x24,0x24,0x23,0x22,0x23,0x24,0x25,0x26,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x27, + 0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x28,0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x29,0x29,0x29,0x28,0x28,0x28,0x28, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2b,0x2b,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x29,0x2a, + 0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0xc8,0x1a,0x1a,0x1a, + 0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1c,0x1c,0x1c,0x1b,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1e, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x22,0x23,0x22,0x22,0x23,0x23, + 0x23,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x23,0x22,0x22,0x24,0x24,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x28,0x28,0x27,0x27,0x27,0x26, + 0x26,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x29,0x28,0x28,0x28,0x28,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0xc8,0x1b, + 0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d,0x1e,0x1f,0x1f,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x22, + 0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x21,0x21,0x22,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x25,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0x27,0x27,0x27,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x26,0x26,0x26, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x28,0x28,0x29,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x29,0x28,0x28, + 0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0xc8,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x21,0x21,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23, + 0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x29, + 0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x2a,0x2a,0x2a,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x29,0x29, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1f,0x20,0x1f,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x21,0x21,0x22,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x24,0x24,0x24,0x24,0x24,0x23, + 0x23,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26, + 0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x28,0x28,0x27, + 0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x26,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2b,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x21,0x21, + 0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26, + 0x26,0x25,0x26,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25, + 0x26,0x26,0x27,0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x27,0x26,0x26,0x27,0x28, + 0x28,0x27,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x26,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x29, + 0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1c,0x1c,0x1c,0x1c, + 0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1d,0x1d, + 0x1e,0x1f,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x22,0x22,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x26, + 0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x27,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26, + 0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x28,0x28,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c, + 0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0xc8,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c, + 0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1f,0x1e,0x1e, + 0x1d,0x1d,0x1e,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x26,0x26,0x26,0x25,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0xc8,0x1b,0x1b,0x1b,0x1b, + 0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1d,0x1e,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x27,0x27,0x27, + 0x26,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0xc8,0x1c,0x1c, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1e,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20, + 0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x24,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x25, + 0x25,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x25,0x25,0x25,0x26,0x28, + 0x28,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x25, + 0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x2a, + 0x29,0x28,0x29,0x2a,0x2a,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x29,0x29, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0xc8, + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1d,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1d,0x1d,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1e,0x1f,0x20,0x20,0x1f,0x1e, + 0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x25,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x25, + 0x25,0x25,0x26,0x26,0x25,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x25,0x25,0x25,0x25, + 0x26,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x26,0x26, + 0x26,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x28, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2a,0x28,0x28,0x28,0x29,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2a,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2c, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d, + 0x2d,0xc8,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e, + 0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1e,0x1f,0x1f,0x20, + 0x20,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x28,0x27,0x25,0x25, + 0x25,0x25,0x26,0x27,0x27,0x26,0x26,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26, + 0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28,0x27,0x27,0x28,0x28, + 0x28,0x28,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28, + 0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x2a,0x2b,0x2b,0x2b,0x2c,0x2b,0x2a,0x2a,0x2a,0x29,0x28,0x29,0x29,0x29,0x29, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2b,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2a,0x2a,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2c,0x2d,0x2d,0x2d,0x2d,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0xc8,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1e,0x1e,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e, + 0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x21,0x20,0x20, + 0x1f,0x1f,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x27,0x28,0x28,0x28,0x27,0x26,0x26,0x26,0x26,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28, + 0x28,0x28,0x28,0x28,0x29,0x2a,0x29,0x28,0x28,0x28,0x27,0x27,0x26,0x26,0x27, + 0x27,0x26,0x26,0x26,0x26,0x25,0x24,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x25,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x28,0x28,0x28,0x28,0x28,0x2a,0x2b,0x2a,0x29,0x29,0x29,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2b,0x2a,0x2b,0x2b,0x2c,0x2d,0x2e,0x2e,0x2c,0x2b,0x2b,0x2a,0x2a,0x29,0x29, + 0x29,0x29,0x29,0x28,0x28,0x28,0x29,0x29,0x29,0x28,0x28,0x28,0x29,0x2a,0x2a, + 0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2d,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2c, + 0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2f,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2d,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2b,0x2a, + 0x2a,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0xc8,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1e,0x1e,0x1e,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1e,0x1f,0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x21, + 0x20,0x1f,0x1f,0x1f,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x26,0x28,0x28,0x29,0x29,0x2a,0x29,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x27,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b, + 0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x29,0x29,0x28,0x28,0x28, + 0x28,0x27,0x28,0x28,0x28,0x26,0x25,0x24,0x24,0x24,0x26,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x29, + 0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2b, + 0x2b,0x2c,0x2b,0x2b,0x2b,0x2d,0x2f,0x2f,0x2f,0x2f,0x2e,0x2c,0x2b,0x2b,0x2a, + 0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2d,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2f, + 0x2f,0x2e,0x2d,0x2d,0x2c,0x2b,0x2b,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31, + 0x31,0x32,0x31,0x30,0x2f,0x2f,0x2f,0x2f,0x2e,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0xc8,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x21,0x20,0x20,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x25,0x25,0x27,0x28,0x28,0x29,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2d, + 0x2d,0x2c,0x2c,0x2d,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2b, + 0x2a,0x29,0x29,0x28,0x28,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x26,0x27, + 0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c, + 0x2b,0x2c,0x2b,0x2b,0x2b,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x29,0x29,0x29, + 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x30,0x30,0x30,0x31,0x31,0x31,0x2f,0x2d,0x2c, + 0x2c,0x2c,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2c,0x2b,0x2b, + 0x2b,0x2d,0x2d,0x2e,0x2f,0x2f,0x30,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32, + 0x31,0x31,0x30,0x30,0x2f,0x2f,0x2e,0x2e,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2d,0x2d,0x2c,0x2e,0x2f,0x2f,0x30,0x31,0x32,0x32,0x32, + 0x33,0x33,0x33,0x33,0x34,0x34,0x33,0x32,0x32,0x30,0x2f,0x2e,0x2e,0x2c,0x2c, + 0x2d,0x2c,0x2c,0x2d,0x2c,0x2c,0x2d,0x2d,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2d,0x2d,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0xc8,0x1d,0x1d,0x1d,0x1d,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x20, + 0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x24,0x24, + 0x24,0x24,0x25,0x25,0x27,0x28,0x2a,0x2a,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x2f,0x30,0x2f,0x2f,0x30,0x30,0x32,0x32,0x33,0x32,0x32,0x31,0x31,0x30,0x30, + 0x2f,0x2e,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x28,0x28,0x27,0x26,0x26,0x26,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2b,0x2c,0x2d,0x2d,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2e,0x2d,0x2c,0x2b,0x2b,0x2a,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29, + 0x2a,0x2b,0x2b,0x2c,0x2d,0x2f,0x30,0x31,0x32,0x33,0x33,0x33,0x33,0x32,0x31, + 0x30,0x2f,0x2e,0x2d,0x2c,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2d,0x2d,0x2e,0x2f,0x2f,0x30,0x31,0x32,0x34,0x35,0x35,0x36,0x36,0x36, + 0x36,0x36,0x34,0x34,0x33,0x32,0x32,0x31,0x2f,0x2f,0x2e,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2d,0x2e,0x2e,0x2f,0x30,0x32,0x32,0x33,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x34,0x33,0x32,0x30,0x2f, + 0x2f,0x2e,0x2d,0x2d,0x2c,0x2d,0x2d,0x2c,0x2d,0x2d,0x2c,0x2c,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d, + 0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0xc8,0x1e,0x1e,0x1d, + 0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1f, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x1f,0x1e,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x21,0x21,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x24,0x24,0x24,0x25,0x25,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2e,0x2f,0x30,0x30, + 0x32,0x32,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x32,0x32,0x32,0x33, + 0x33,0x33,0x33,0x34,0x33,0x33,0x33,0x35,0x37,0x37,0x38,0x37,0x37,0x36,0x36, + 0x34,0x34,0x32,0x31,0x2f,0x2e,0x2c,0x2b,0x2b,0x2a,0x2a,0x29,0x29,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x2a,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x28,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2b,0x2b,0x2d,0x2f,0x2f,0x2f,0x30,0x31, + 0x32,0x32,0x32,0x32,0x32,0x30,0x2f,0x2e,0x2c,0x2c,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2d,0x2e,0x30,0x31,0x32,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4, + 0x36,0x34,0x32,0x31,0x2f,0x2e,0x2d,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2d,0x2d,0x2e,0x2f,0x2f,0x30,0x31,0x32,0x34,0x35,0x36,0x38,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x39,0x38,0x37,0x35,0x34,0x32,0x32,0x30,0x2f,0x2e,0x2c, + 0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2e,0x2f,0x2f,0x32,0x33,0x35, + 0x36,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x37,0x36,0x34, + 0x33,0x31,0x30,0x2f,0x2e,0x2d,0x2d,0x2c,0x2c,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2f,0x2f,0x2e,0x2d,0x2d,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0xc8,0x1e, + 0x1e,0x1d,0x1d,0x1d,0x1d,0x1c,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1d,0x1d,0x1d, + 0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f, + 0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x21,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0x24,0x25,0x25,0x26,0x27,0x28,0x2a,0x55,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc1,0x38,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x55,0xc7,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xae,0x37,0x37,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x35,0x32,0x31,0x2f,0x2e,0x2c,0x2c,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2e,0x2f,0x30,0x32,0xc4, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x36,0x36,0x33,0x32,0x30,0x2f,0x2e,0x2c,0x2c,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2f,0x30,0x32,0x33,0x36,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc4,0x39,0x36,0x35,0x33,0x31,0x30,0x2f,0x2d,0x2c,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2d,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x30,0x31,0x32,0x33,0x42,0x7b,0xa3,0xb7,0xc3, + 0xc7,0xc8,0xc8,0xc7,0xc4,0xb6,0x8e,0x45,0x3a,0x39,0x38,0x36,0x34,0x32,0x30, + 0x2f,0x2f,0x2d,0x2d,0x2d,0x2b,0x2b,0x2c,0x2c,0x2d,0x2e,0x2f,0x30,0x32,0x34, + 0x36,0x38,0x46,0x95,0xb9,0xc5,0xc8,0xc8,0xc8,0xc5,0xba,0x95,0x48,0x3b,0x3a, + 0x39,0x36,0x35,0x33,0x32,0x30,0x2f,0x2e,0x2d,0x2c,0x2c,0x2d,0x2d,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e, + 0xc8,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1d,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20, + 0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22, + 0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x27,0x28,0x29,0x2b,0x2d,0x8f,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xa0,0x3a,0x3a,0x39,0x39,0x39,0x39,0x3a,0xbe,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc3,0x42,0x3a,0x3a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x38,0x35,0x33,0x32,0x2f,0x2f,0x2f,0x2f, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2e,0x2e,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2f,0x2f,0x30,0x32,0x33, + 0x35,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x3a,0x39,0x37,0x36,0x33,0x32,0x30,0x2f, + 0x2e,0x2d,0x2c,0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2c,0x2c, + 0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x32,0x35,0x36,0x39,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc4,0x3b,0x3a,0x38,0x36,0x33,0x31,0x2f,0x2e,0x2d,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x32,0x32,0x34,0x82,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc6,0x8b,0x3d,0x3b,0x39,0x36, + 0x35,0x32,0x30,0x2f,0x2f,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2e,0x2f,0x30,0x32, + 0x35,0x37,0x3a,0x8d,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7, + 0x8d,0x3e,0x3c,0x3a,0x38,0x36,0x33,0x32,0x2f,0x2f,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d, + 0x2e,0x2e,0xc8,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x22,0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24, + 0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x27,0x28,0x2a,0x2c,0x2f, + 0x31,0xb9,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x6a,0x3e,0x3e,0x3d,0x3e,0x3e,0x9d, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x67,0x3e,0x3e,0x3e,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x3b,0x38,0x36,0x35,0x32,0x32, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x32,0x33, + 0x36,0x38,0x3a,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x3f,0x3d,0x3c,0x39,0x36,0x35, + 0x32,0x31,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x2f, + 0x2f,0x2f,0x2e,0x2e,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2f,0x2f,0x2f,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x33,0x35,0x36,0x3a,0x3c, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x3f,0x3d,0x3a,0x38,0x35,0x32,0x30,0x2f,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x31,0x2f,0x2f, + 0x2f,0x2f,0x31,0x31,0x31,0x32,0x31,0x31,0x33,0x34,0x35,0x36,0x37,0x93,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x9b,0x3f, + 0x3c,0x3a,0x37,0x34,0x32,0x30,0x2f,0x2e,0x2d,0x2d,0x2d,0x2d,0x2f,0x2f,0x31, + 0x32,0x35,0x37,0x3b,0x9d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x9d,0x3f,0x3d,0x3a,0x38,0x36,0x33,0x31,0x2f,0x2f,0x2e,0x2e, + 0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e, + 0x2e,0x2e,0x2e,0x2e,0xc8,0x1e,0x1e,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e, + 0x1e,0x1e,0x1f,0x1e,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f, + 0x20,0x21,0x22,0x23,0x23,0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x26,0x28,0x29,0x2b, + 0x2d,0x30,0x33,0x4b,0xc6,0xc8,0xc8,0xc8,0xc8,0xc8,0xc3,0x48,0x43,0x43,0x43, + 0x6d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x97,0x42,0x41,0x41,0x41,0xc7,0xc7,0xc7, + 0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0xc7,0xc7,0xc7,0x3e,0x3b,0x3a,0x37, + 0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x35,0x36,0x39,0x3c,0x3d,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x45,0x42,0x40,0x3d, + 0x3a,0x38,0x36,0x34,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33, + 0x33,0x32,0x32,0x31,0x31,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31,0x31,0x32, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x37,0x3a, + 0x3c,0x40,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x42,0x40,0x3d,0x3a,0x37,0x34,0x31, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x31,0x32,0x32,0x32,0x33,0x33,0x33,0x33, + 0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x34,0x35,0x36,0x37,0x37,0x3a, + 0x93,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x6d,0x40,0x3d,0x3a,0x36,0x33,0x32,0x2f,0x2f,0x2e,0x2d,0x2d,0x2f,0x2f, + 0x30,0x32,0x35,0x37,0x3a,0x74,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x78,0x41,0x3d,0x3b,0x38,0x36,0x33,0x31,0x2f, + 0x2f,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d, + 0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0xc8,0x1d,0x1d,0x1d,0x1d,0x1d,0x1d,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1f,0x20,0x21,0x22,0x23,0x23,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x20, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x23,0x23,0x23, + 0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x28, + 0x29,0x2b,0x2e,0x32,0x35,0x38,0x7e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa8,0x49, + 0x49,0x4e,0xc3,0xc8,0xc8,0xc8,0xc8,0xc8,0xb9,0x46,0x45,0x45,0x44,0x44,0x45, + 0x47,0x48,0x4b,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x4e,0x4c,0x48,0x45,0x41,0x3e, + 0x3c,0x3a,0x39,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x37,0x36,0x36,0x36,0x36, + 0x36,0x37,0x39,0x3a,0x3c,0x3f,0x42,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x4b,0x48, + 0x45,0x42,0x3f,0x3c,0x3a,0x39,0x37,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x39, + 0x39,0x38,0x37,0x36,0x36,0x36,0x35,0x34,0x33,0x32,0x32,0x32,0x32,0x33,0x34, + 0x35,0x36,0x36,0x38,0x39,0x39,0x3a,0x3a,0x38,0x38,0x37,0x37,0x37,0x38,0x39, + 0x3a,0x3d,0x3f,0x42,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x45,0x42,0x3f,0x3c,0x39, + 0x36,0x33,0x32,0x30,0x2f,0x2f,0x2f,0x31,0x32,0x33,0x34,0x36,0x35,0x36,0x36, + 0x36,0x36,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x38,0x38,0x37,0x38,0x39,0x3a, + 0x3a,0x3c,0x95,0xc8,0xc8,0xc2,0x98,0x65,0x4b,0x4d,0x5e,0xa1,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xb3,0x44,0x40,0x3c,0x38,0x35,0x32,0x30,0x2f,0x2f,0x2e,0x2f, + 0x2f,0x30,0x32,0x35,0x36,0x3a,0x3d,0xc0,0xc8,0xc8,0xc8,0xc8,0xc8,0xb7,0x68, + 0x53,0x69,0xb9,0xc8,0xc8,0xc8,0xc8,0xc8,0xc0,0x45,0x41,0x3d,0x3b,0x37,0x35, + 0x32,0x30,0x2f,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0xc8,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e, + 0x1f,0x20,0x20,0x20,0x1f,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1e,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26, + 0x27,0x28,0x2a,0x2c,0x2f,0x32,0x37,0x3a,0x3e,0xae,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x7a,0x50,0xad,0xc8,0xc8,0xc8,0xc8,0xc8,0xc6,0x5a,0x48,0x48,0x45,0x45, + 0x45,0x46,0x49,0x4c,0x4e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x52,0x4f,0x4c,0x48, + 0x44,0x41,0x3e,0x3d,0x3c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x3e,0x4c,0x9c,0xc0, + 0xc7,0xc8,0xc5,0xb4,0x6d,0x3d,0x3d,0x3c,0x3c,0x7e,0xb5,0xc6,0xc8,0xc7,0xbb, + 0x7e,0x3b,0x3b,0x3c,0x3c,0x3e,0x41,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x41,0x3f,0x3d,0x3c,0x3b,0x3a,0x47,0x92,0xb9,0xc4, + 0xc8,0xc8,0xc8,0xc4,0xb9,0x93,0x48,0x3a,0x3a,0x37,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x45,0x91,0xb9,0xc4,0xc8,0xc8,0xc8,0xc4,0xb9,0x94,0x49,0x3c,0x3c, + 0x3c,0x3c,0x3e,0x40,0x43,0x46,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x49,0x46,0x42, + 0x3d,0x3a,0x37,0x34,0x32,0x31,0x30,0x30,0x32,0x32,0x88,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xb0,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0xb8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0x60,0x3c,0x3c,0x3d,0x95,0xc4,0x80,0x45,0x48,0x4a,0x4c,0x4f,0x51,0x53,0x93, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x46,0x43,0x3e,0x3b,0x37,0x35,0x32,0x30,0x30, + 0x2f,0x2f,0x30,0x31,0x33,0x36,0x39,0x3c,0x6d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc2, + 0x57,0x57,0x57,0x57,0x59,0xc3,0xc8,0xc8,0xc8,0xc8,0xc8,0x6e,0x43,0x40,0x3c, + 0x39,0x36,0x33,0x31,0x2f,0x2e,0x2e,0x2d,0x2d,0x2e,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2d,0x2c,0x2d,0x2d,0x2d,0x2c,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0xc8,0x1e,0x1e,0x1e,0x1e, + 0x1e,0x1f,0x1f,0x20,0x20,0x20,0x20,0x1f,0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1e,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x23, + 0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x25,0x26,0x27,0x28,0x2a,0x2c,0x2f,0x33,0x37,0x3b,0x40,0x4c,0xc4,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc4,0x89,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x80,0x4d,0x4b,0x48, + 0x48,0x45,0x45,0x48,0x4b,0x4c,0x50,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x54,0x51, + 0x4d,0x49,0x46,0x42,0x41,0x3f,0x3e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x9b,0xc7, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x98,0x42,0x70,0xc0,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xa5,0x40,0x40,0x41,0x42,0x45,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x45,0x42,0x41,0x40,0x3f,0x94,0xc7,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0x95,0x3d,0x3d,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x93,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7, + 0x95,0x3f,0x40,0x41,0x42,0x45,0x47,0x49,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x4c, + 0x48,0x44,0x40,0x3c,0x38,0x35,0x33,0x32,0x31,0x32,0x32,0x35,0x3f,0xc7,0xc8, + 0xc8,0xc8,0xc8,0xc6,0x40,0x3d,0x3d,0x3d,0x3d,0x3d,0x48,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc0,0x3d,0x3d,0x3f,0x40,0x4a,0x46,0x44,0x46,0x48,0x4b,0x4d,0x50,0x53, + 0x54,0x57,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0x49,0x45,0x41,0x3c,0x39,0x36,0x33, + 0x31,0x30,0x30,0x30,0x31,0x32,0x35,0x37,0x3b,0x3f,0xa3,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x9a,0x59,0x59,0x5a,0x5a,0x5b,0x9e,0xc8,0xc8,0xc8,0xc8,0xc8,0xa3,0x46, + 0x42,0x3e,0x3b,0x37,0x35,0x32,0x30,0x2f,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0xc8,0x20,0x20, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20, + 0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x20,0x21,0x22,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x26,0x27,0x28,0x2a,0x2d,0x30,0x34,0x38,0x3b,0x40,0x45,0x73, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa9,0x51,0x4e, + 0x4c,0x49,0x48,0x46,0x46,0x48,0x4c,0x4e,0x51,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4, + 0x57,0x52,0x4f,0x4a,0x47,0x45,0x42,0x41,0x41,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xb3,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x7e,0x45,0x45,0x47,0x48,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x48,0x47,0x45,0x45,0xae,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xae,0x41,0x41, + 0x40,0x3f,0x3f,0x40,0xae,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xaf,0x45,0x45,0x47,0x48,0x4b,0x4d,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc4,0x4f,0x4a,0x45,0x41,0x3d,0x39,0x36,0x33,0x32,0x32,0x32,0x35,0x36,0x38, + 0xb1,0xc8,0xc8,0xc8,0xc8,0xc8,0x7b,0x42,0x42,0x41,0x42,0x42,0x89,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x95,0x41,0x41,0x41,0x41,0x41,0x42,0x44,0x46,0x48,0x4c,0x4e, + 0x50,0x53,0x55,0x57,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0x4c,0x47,0x42,0x3e,0x3b, + 0x37,0x34,0x32,0x30,0x30,0x30,0x32,0x33,0x36,0x39,0x3d,0x41,0xbb,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x74,0x5b,0x5b,0x5b,0x5c,0x5b,0x77,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xba,0x4a,0x45,0x41,0x3d,0x39,0x36,0x33,0x31,0x30,0x2f,0x2f,0x2e,0x2f,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0xc8, + 0x20,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x21,0x22,0x22,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x23,0x23,0x22,0x23,0x23,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x23, + 0x23,0x23,0x23,0x24,0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x28,0x2a,0x2d,0x2f,0x33,0x38,0x3b,0x40, + 0x45,0x4b,0xa3,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc0,0x58, + 0x53,0x50,0x4c,0x48,0x48,0x47,0x46,0x48,0x4c,0x4e,0x51,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc4,0x57,0x53,0x4f,0x4c,0x48,0x46,0x44,0x44,0x45,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xbd,0x49,0x49,0x4c,0x4d,0xc7,0xc7, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0xc7,0xc7,0xc7,0xc7,0x4c,0x4a,0x48,0x9e, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0x9c,0x45,0x45,0x45,0x45,0x9c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x9d,0x4b,0x4c,0x4c,0x4f,0x50,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc4,0x50,0x4c,0x46,0x42,0x3d,0x3a,0x36,0x34,0x33,0x32,0x33,0x36, + 0x38,0x3a,0x74,0xc8,0xc8,0xc8,0xc8,0xc8,0xb0,0x46,0x46,0x46,0x46,0x47,0xb7, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x52,0x43,0x42,0x41,0x41,0x41,0x42,0x43,0x46,0x49, + 0x4c,0x4e,0x50,0x53,0x56,0x5e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x4e,0x48,0x44, + 0x40,0x3c,0x38,0x36,0x33,0x32,0x31,0x31,0x32,0x35,0x36,0x3a,0x3e,0x43,0xc4, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x5d,0x5c,0x5c,0x5c,0x5d,0x5c,0x5e,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc4,0x4d,0x48,0x44,0x3f,0x3b,0x38,0x35,0x32,0x31,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x30,0x30,0x2f,0x2f, + 0x30,0xc8,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x21,0x22,0x21,0x21,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x20,0x21,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x21,0x21,0x22, + 0x23,0x23,0x23,0x23,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x27,0x28,0x2a,0x2b,0x2f,0x32,0x36, + 0x3a,0x40,0x45,0x4b,0x52,0xc0,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7, + 0x72,0x57,0x53,0x50,0x4c,0x48,0x46,0x45,0x45,0x48,0x4b,0x4e,0x51,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc4,0x57,0x53,0x4f,0x4b,0x48,0x47,0x45,0x45,0x47,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc4,0x9c,0x7d,0x8a,0xbf,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc6,0xa4,0x7d,0x83,0xb6,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x50,0x4f,0x4f,0x51, + 0x53,0x55,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x5e,0x5b,0x58,0x55,0x52,0x50,0x4e, + 0x5f,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa7,0x5c,0x50,0x5e,0xa8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x5d,0x4a,0x49,0x5d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa7,0x5c, + 0x51,0x5e,0xa8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x61,0x4f,0x50,0x52,0x53,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc4,0x52,0x4d,0x48,0x43,0x3e,0x3a,0x37,0x35,0x33,0x33, + 0x34,0x36,0x39,0x3c,0x3f,0xc4,0xc8,0xc8,0xc8,0xc8,0xc6,0x4c,0x4c,0x4c,0x4c, + 0x52,0xc7,0xc8,0xc8,0xc8,0xc8,0xb7,0x48,0x46,0x45,0x44,0x42,0x41,0x42,0x44, + 0x45,0x48,0x4a,0x4d,0x50,0x53,0x56,0x99,0xc8,0xc8,0xc8,0xc8,0xc8,0xb5,0x4f, + 0x49,0x45,0x41,0x3d,0x39,0x36,0x33,0x32,0x32,0x32,0x33,0x36,0x38,0x3c,0x41, + 0x45,0xc7,0xc8,0xc8,0xc8,0xc8,0xc6,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0xc7, + 0xc8,0xc8,0xc8,0xc8,0xc7,0x50,0x4b,0x46,0x41,0x3c,0x3a,0x37,0x34,0x32,0x31, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x31,0x31, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x31,0x31,0x30,0x30, + 0x30,0x30,0x30,0xc8,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x1e,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x22,0x22,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x23,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x23,0x23,0x23,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x27,0x27,0x28,0x29,0x2b,0x2f, + 0x31,0x35,0x3a,0x3f,0x45,0x4b,0x50,0x6d,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x96,0x5d,0x58,0x54,0x50,0x4c,0x48,0x45,0x45,0x45,0x46,0x48,0x4c,0x50, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x57,0x53,0x50,0x4c,0x49,0x48,0x46,0x46,0x48, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x5b,0x58,0x57,0x58,0x65,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0x63,0x58,0x57,0x57,0x58,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0x69,0x51, + 0x52,0x53,0x55,0x58,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x61,0x5e,0x5a,0x57,0x54, + 0x53,0x51,0xa3,0xc8,0xc8,0xc8,0xc8,0xc8,0xb2,0x54,0x54,0x55,0x55,0x55,0xb2, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xa3,0x50,0x4f,0xa3,0xc8,0xc8,0xc8,0xc8,0xc8,0xb2, + 0x54,0x55,0x56,0x56,0x56,0xb2,0xc8,0xc8,0xc8,0xc8,0xc8,0xa3,0x53,0x54,0x54, + 0x57,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x53,0x4e,0x49,0x45,0x3f,0x3a,0x37,0x35, + 0x34,0x34,0x35,0x36,0x3a,0x3d,0x41,0xa4,0xc8,0xc8,0xc8,0xc8,0xc8,0x80,0x50, + 0x51,0x50,0x8b,0xc8,0xc8,0xc8,0xc8,0xc8,0x84,0x4a,0x48,0x46,0x44,0x42,0x41, + 0x41,0x43,0x44,0x46,0x48,0x4c,0x4f,0x52,0x60,0xc6,0xc8,0xc8,0xc8,0xc8,0xc8, + 0x81,0x50,0x4b,0x46,0x41,0x3d,0x3a,0x36,0x34,0x33,0x33,0x33,0x35,0x37,0x3a, + 0x3e,0x42,0x47,0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x5e,0x5e,0x5e,0x5e,0x5d,0x5e, + 0x5e,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0x53,0x4d,0x48,0x43,0x3e,0x3a,0x37,0x34, + 0x32,0x31,0x30,0x30,0x30,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x30,0x30,0x30,0x30,0x31,0x30,0x30, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f, + 0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x31, + 0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, + 0x31,0x30,0x30,0x30,0x30,0xc8,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x20,0x1f,0x1e,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x22,0x23,0x23,0x21,0x20,0x20,0x20,0x20,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x26,0x26,0x26,0x27,0x28,0x29, + 0x2b,0x2f,0x31,0x34,0x39,0x3e,0x44,0x4a,0x50,0x57,0xb2,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x75,0x5e,0x5a,0x54,0x50,0x4c,0x48,0x45,0x43,0x43,0x45,0x47, + 0x4b,0x4f,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x57,0x54,0x50,0x4c,0x4a,0x48,0x47, + 0x48,0x49,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5b,0x5b,0x5b,0x5b,0x5c,0xc5,0xc8, + 0xc8,0xc8,0xc8,0xc8,0x5c,0x5b,0x5b,0x5a,0x5a,0xbd,0xc8,0xc8,0xc8,0xc8,0xc8, + 0x77,0x54,0x54,0x55,0x57,0x59,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x62,0x5f,0x5c, + 0x59,0x57,0x54,0x53,0xbf,0xc8,0xc8,0xc8,0xc8,0xc8,0x75,0x57,0x57,0x58,0x58, + 0x59,0x79,0xc8,0xc8,0xc8,0xc8,0xc8,0xbf,0x54,0x54,0xc0,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x77,0x58,0x59,0x59,0x59,0x59,0x79,0xc8,0xc8,0xc8,0xc8,0xc8,0xbf,0x55, + 0x57,0x58,0x59,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x53,0x50,0x4b,0x45,0x40,0x3a, + 0x37,0x35,0x34,0x34,0x35,0x37,0x3b,0x3e,0x42,0x62,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xb1,0x55,0x56,0x54,0xb6,0xc8,0xc8,0xc8,0xc8,0xc6,0x50,0x4c,0x49,0x46,0x44, + 0x42,0x41,0x41,0x41,0x43,0x45,0x48,0x4c,0x4f,0x53,0xba,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xbd,0x55,0x50,0x4c,0x46,0x41,0x3d,0x3a,0x37,0x35,0x33,0x33,0x34,0x36, + 0x38,0x3b,0x3f,0x44,0x49,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5f,0x5f,0x5e,0x5e, + 0x5d,0x5e,0x5e,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x53,0x4f,0x49,0x45,0x3f,0x3b, + 0x37,0x34,0x32,0x32,0x31,0x30,0x30,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31, + 0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x30,0x30,0x30,0xc8,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x22,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20, + 0x21,0x21,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x24,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x27,0x27,0x27,0x28, + 0x28,0x2a,0x2b,0x2e,0x30,0x34,0x38,0x3e,0x44,0x49,0x51,0x7b,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc0,0x61,0x5a,0x55,0x50,0x4b,0x47,0x45,0x42,0x43, + 0x44,0x46,0x49,0x4e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x57,0x53,0x50,0x4d,0x4a, + 0x48,0x48,0x48,0x4c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5e,0x5e,0x5e,0x5f,0x5f, + 0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x5e,0x5e,0x5e,0x5e,0x5d,0xbb,0xc8,0xc8,0xc8, + 0xc8,0xc8,0x7b,0x57,0x57,0x57,0x58,0x5a,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x61, + 0x5e,0x5c,0x58,0x57,0x55,0x54,0xc7,0xc8,0xc8,0xc8,0xc8,0xc7,0x5a,0x5a,0x5a, + 0x5b,0x5b,0x5c,0x5c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0x5a,0x5a,0xc7,0xc8,0xc8, + 0xc8,0xc8,0xc7,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,0x5b,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc7,0x58,0x5a,0x5a,0x5a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x54,0x4f,0x4a,0x45, + 0x40,0x3b,0x38,0x36,0x35,0x35,0x36,0x38,0x3b,0x3f,0x44,0x48,0xbf,0xc8,0xc8, + 0xc8,0xc8,0xc6,0x59,0x59,0x5b,0xc7,0xc8,0xc8,0xc8,0xc8,0xab,0x50,0x4d,0x49, + 0x46,0x44,0x41,0x41,0x41,0x41,0x43,0x45,0x48,0x4c,0x50,0xb0,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc7,0x70,0x55,0x51,0x4c,0x47,0x41,0x3e,0x3a,0x38,0x36,0x36,0x35, + 0x36,0x37,0x3a,0x3d,0x41,0x45,0x4a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x60,0x5f, + 0x5e,0x5e,0x5e,0x5e,0x5e,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0x53,0x4f,0x4a,0x45, + 0x40,0x3c,0x37,0x35,0x32,0x32,0x31,0x31,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f, + 0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0xc8,0x20,0x20,0x20,0x1f,0x1f, + 0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x21,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21, + 0x21,0x20,0x21,0x22,0x23,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23, + 0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x26,0x27,0x27, + 0x27,0x28,0x28,0x29,0x2b,0x2e,0x30,0x35,0x39,0x3d,0x44,0x4a,0x58,0xc4,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa6,0x5a,0x55,0x4f,0x4a,0x47,0x43, + 0x42,0x42,0x43,0x45,0x48,0x4d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x57,0x53,0x50, + 0x4d,0x4a,0x48,0x48,0x4a,0x4c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5f,0x5f,0x60, + 0x61,0x61,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x61,0x60,0x60,0x5e,0x5e,0xbc,0xc8, + 0xc8,0xc8,0xc8,0xc8,0x7c,0x59,0x57,0x58,0x59,0x5a,0xc4,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x62,0x5f,0x5d,0x59,0x57,0x57,0x56,0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x5d, + 0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0x5d,0x5d,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc5,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5d,0xc5,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x5b,0x5b,0x5c,0x5d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x54,0x4f, + 0x49,0x45,0x40,0x3b,0x38,0x36,0x35,0x35,0x36,0x38,0x3b,0x3f,0x44,0x49,0x96, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x86,0x5e,0x8d,0xc8,0xc8,0xc8,0xc8,0xc8,0x71,0x51, + 0x4e,0x4b,0x47,0x44,0x41,0x41,0x41,0x41,0x43,0x45,0x48,0x4c,0xae,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0x8d,0x59,0x54,0x50,0x4c,0x47,0x41,0x3e,0x3b,0x39,0x37, + 0x36,0x37,0x37,0x3a,0x3d,0x3f,0x43,0x47,0x4c,0xc7,0xc8,0xc8,0xc8,0xc8,0xc6, + 0x60,0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0xc7,0xc8,0xc8,0xc8,0xc8,0xc7,0x54,0x4f, + 0x49,0x45,0x41,0x3c,0x38,0x35,0x34,0x32,0x31,0x31,0x30,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31, + 0x31,0x30,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x31,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0xc8,0x20,0x20,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x21,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x23,0x20,0x20,0x20,0x20,0x20,0x21, + 0x22,0x22,0x21,0x21,0x21,0x22,0x23,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x28,0x28,0x29,0x2b,0x2e,0x31,0x36,0x39,0x3e,0x44,0x4b,0xb2, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x7a,0x55,0x4f,0x4a, + 0x47,0x43,0x42,0x42,0x43,0x45,0x49,0x4e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x57, + 0x53,0x50,0x4d,0x4a,0x48,0x49,0x4c,0x4d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5f, + 0x60,0x61,0x61,0x62,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x62,0x61,0x60,0x60,0x5f, + 0xbc,0xc8,0xc8,0xc8,0xc8,0xc8,0x7d,0x5a,0x59,0x59,0x5a,0x5a,0xc4,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x62,0x5f,0x5d,0x5a,0x58,0x57,0x57,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc5,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0x60, + 0x60,0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x61,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0xc5, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x5d,0x5d,0x5d,0x5d,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4, + 0x54,0x4f,0x4a,0x45,0x41,0x3c,0x39,0x36,0x35,0x35,0x36,0x39,0x3b,0x40,0x45, + 0x49,0x58,0xc8,0xc8,0xc8,0xc8,0xc8,0xb2,0x61,0xb6,0xc8,0xc8,0xc8,0xc8,0xc1, + 0x56,0x52,0x4e,0x4b,0x47,0x44,0x41,0x41,0x41,0x41,0x44,0x46,0x4c,0xb4,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x99,0x5a,0x57,0x53,0x50,0x4b,0x47,0x41,0x3f,0x3c, + 0x3a,0x38,0x38,0x38,0x3a,0x3b,0x3d,0x41,0x45,0x48,0x4c,0xc4,0xc8,0xc8,0xc8, + 0xc8,0xc8,0x61,0x5e,0x5e,0x5d,0x5d,0x5d,0x5f,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4, + 0x54,0x4f,0x4a,0x45,0x41,0x3d,0x38,0x36,0x34,0x32,0x31,0x31,0x30,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x30,0x31,0x31, + 0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0xc8,0x1f, + 0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x1f,0x1f,0x1f, + 0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x22,0x22,0x21,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20,0x20,0x22,0x22,0x21,0x20,0x20,0x20, + 0x20,0x21,0x22,0x23,0x22,0x22,0x22,0x22,0x23,0x23,0x22,0x22,0x22,0x22,0x22, + 0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24, + 0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x26, + 0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x28,0x28,0x29,0x2b,0x2e,0x32,0x36,0x3a,0x3f,0x45, + 0x88,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0xc3,0x5a, + 0x50,0x4b,0x46,0x43,0x41,0x41,0x42,0x46,0x4a,0x4e,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc4,0x57,0x54,0x50,0x4d,0x4c,0x4a,0x4b,0x4c,0x4f,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc4,0x5f,0x61,0x61,0x62,0x62,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x62,0x62,0x61, + 0x61,0x60,0xbc,0xc8,0xc8,0xc8,0xc8,0xc8,0x7e,0x5a,0x59,0x59,0x5a,0x5a,0xc4, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x61,0x5e,0x5d,0x5a,0x58,0x57,0x57,0xc7,0xc8,0xc8, + 0xc8,0xc8,0xc7,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0xc7,0xc8,0xc8,0xc8,0xc8, + 0xc7,0x62,0x63,0xc7,0xc8,0xc8,0xc8,0xc8,0xc7,0x62,0x60,0x5f,0x5f,0x5e,0x5e, + 0x5f,0xc7,0xc8,0xc8,0xc8,0xc8,0xc7,0x5f,0x5e,0x5e,0x5e,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc4,0x55,0x50,0x4a,0x45,0x41,0x3d,0x39,0x36,0x36,0x36,0x36,0x39,0x3c, + 0x3f,0x44,0x49,0x4e,0xb6,0xc8,0xc8,0xc8,0xc8,0xc6,0x65,0xc7,0xc8,0xc8,0xc8, + 0xc8,0x9e,0x57,0x52,0x4e,0x4b,0x47,0x45,0x42,0x41,0x41,0x44,0x45,0x53,0xbd, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x98,0x5c,0x5a,0x57,0x53,0x4f,0x4b,0x47,0x43, + 0x40,0x3d,0x3c,0x3a,0x3a,0x3a,0x3b,0x3d,0x3f,0x41,0x45,0x49,0x4d,0xbc,0xc8, + 0xc8,0xc8,0xc8,0xc8,0x78,0x5e,0x5d,0x5d,0x5c,0x5c,0x79,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xbb,0x54,0x50,0x4a,0x45,0x41,0x3d,0x39,0x36,0x34,0x32,0x30,0x30,0x30, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x2f,0x30,0x30, + 0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x31,0x31, + 0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x32,0x32, + 0xc8,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x1f,0x1f,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x21, + 0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x20,0x20,0x20,0x21,0x22,0x21,0x21, + 0x20,0x20,0x21,0x22,0x23,0x23,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22, + 0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x26,0x25,0x25,0x25,0x25,0x24,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x28,0x28,0x2a,0x2b,0x2e,0x32,0x36,0x3a, + 0x3f,0x5a,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xa4,0x8c,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xae,0x50,0x4c,0x47,0x44,0x42,0x42,0x44,0x47,0x4a,0x4f,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc4,0x58,0x55,0x51,0x4e,0x4c,0x4b,0x4b,0x4c,0x4f,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc4,0x5f,0x60,0x61,0x61,0x61,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x62, + 0x61,0x60,0x5f,0x5f,0xbc,0xc8,0xc8,0xc8,0xc8,0xc8,0x7e,0x5a,0x59,0x58,0x59, + 0x5a,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x60,0x5e,0x5b,0x5a,0x58,0x57,0x57,0xc0, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x78,0x5e,0x5e,0x5e,0x5e,0x5f,0x75,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc0,0x65,0x65,0xc0,0xc8,0xc8,0xc8,0xc8,0xc8,0x7b,0x61,0x5f,0x5f, + 0x5f,0x5f,0x76,0xc8,0xc8,0xc8,0xc8,0xc8,0xc0,0x5f,0x5f,0x5f,0x5e,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc4,0x54,0x50,0x4b,0x45,0x41,0x3d,0x39,0x36,0x36,0x35,0x36, + 0x37,0x3b,0x3e,0x43,0x48,0x4d,0x83,0xc8,0xc8,0xc8,0xc8,0xc8,0xa7,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x65,0x57,0x52,0x4e,0x4a,0x46,0x44,0x43,0x42,0x43,0x45,0x67, + 0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0x8c,0x5e,0x5c,0x59,0x57,0x53,0x4f,0x4b, + 0x47,0x44,0x41,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3f,0x41,0x43,0x46,0x4a,0x4f, + 0xa7,0xc8,0xc8,0xc8,0xc8,0xc8,0xa0,0x5e,0x5e,0x5d,0x5d,0x5c,0xa1,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xa6,0x53,0x50,0x4b,0x45,0x41,0x3d,0x38,0x36,0x33,0x32,0x30, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x2f, + 0x2f,0x30,0x30,0x30,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31, + 0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x31,0x32,0x32,0x31,0x31, + 0x32,0x32,0xc8,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x21,0x22,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x23,0x22,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x28,0x29,0x2b,0x2c,0x2f,0x32, + 0x36,0x3b,0x40,0xbd,0xc8,0xc8,0xc8,0xc8,0xc8,0xc0,0x68,0x69,0xb2,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0x82,0x4c,0x48,0x45,0x45,0x45,0x45,0x48,0x4c,0x50,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc4,0x58,0x55,0x52,0x4f,0x4c,0x4c,0x4c,0x4e,0x50,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc4,0x5e,0x5e,0x5f,0x5f,0x60,0xc4,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x61,0x60,0x5f,0x5e,0x5e,0xbb,0xc8,0xc8,0xc8,0xc8,0xc8,0x7e,0x5a,0x59, + 0x58,0x58,0x5a,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x76,0x5d,0x5c,0x5a,0x59,0x57, + 0x58,0xa6,0xc8,0xc8,0xc8,0xc8,0xc8,0xb2,0x5f,0x5f,0x5f,0x5f,0x5f,0xb3,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xa9,0x65,0x65,0xaa,0xc8,0xc8,0xc8,0xc8,0xc8,0xb2,0x61, + 0x5f,0x5f,0x5f,0x5f,0xb3,0xc8,0xc8,0xc8,0xc8,0xc8,0xa8,0x60,0x5f,0x5e,0x5f, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x54,0x50,0x4b,0x46,0x41,0x3c,0x39,0x36,0x35, + 0x34,0x36,0x36,0x3a,0x3d,0x41,0x46,0x4c,0x52,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xb9,0x5b,0x57,0x52,0x4d,0x49,0x46,0x44,0x44,0x44,0x45, + 0x85,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x79,0x5f,0x5e,0x5c,0x5a,0x57,0x53, + 0x4f,0x4b,0x48,0x45,0x42,0x40,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x42,0x45,0x47, + 0x4b,0x4f,0x79,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x62,0x5e,0x5e,0x5e,0x61,0xc4, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x7a,0x54,0x50,0x4a,0x45,0x41,0x3c,0x38,0x36,0x34, + 0x32,0x31,0x30,0x30,0x30,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31, + 0x31,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x30,0x31,0x32,0x31,0x31,0x31,0x31, + 0x30,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x32,0x31,0x31,0x31,0x30, + 0x30,0x30,0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31, + 0x31,0x31,0x31,0x31,0xc8,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x20,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20, + 0x20,0x20,0x21,0x22,0x23,0x22,0x22,0x22,0x21,0x21,0x22,0x22,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x24,0x23,0x23,0x23,0x22,0x22,0x21,0x22,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x23,0x24,0x24, + 0x24,0x24,0x25,0x24,0x24,0x24,0x23,0x22,0x24,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x29,0x2b,0x2c,0x2e, + 0x2f,0x32,0x37,0x3c,0x9a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0x77,0x65,0x67,0x6c, + 0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0xc5,0x59,0x4a,0x48,0x45,0x45,0x47,0x48,0x4d, + 0x51,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x58,0x55,0x52,0x4f,0x4d,0x4c,0x4c,0x4e, + 0x50,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5e,0x5e,0x5d,0x5d,0x5e,0xc4,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x5f,0x5e,0x5d,0x5c,0x5d,0xbb,0xc8,0xc8,0xc8,0xc8,0xc8,0x7d, + 0x59,0x57,0x57,0x57,0x58,0xc0,0xc8,0xc8,0xc8,0xc8,0xc8,0xbd,0x6a,0x5c,0x6d, + 0x9d,0x59,0x59,0x6a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xac,0x6c,0x5f,0x6a,0xaa, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x72,0x63,0x63,0x72,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xac,0x6d,0x5f,0x6a,0xaa,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x6e,0x5e,0x5e, + 0x5e,0x5e,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x53,0x4f,0x4a,0x45,0x41,0x3c,0x39, + 0x36,0x34,0x33,0x34,0x36,0x39,0x3c,0x41,0x45,0x4b,0x50,0xaa,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x8c,0x5a,0x56,0x51,0x4c,0x49,0x46,0x45,0x44, + 0x48,0xa8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xba,0x68,0x61,0x61,0x5e,0x5e,0x5a, + 0x56,0x53,0x4f,0x4c,0x48,0x45,0x43,0x41,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x45, + 0x46,0x48,0x4c,0x4f,0x53,0xc2,0xc8,0xc8,0xc8,0xc8,0xc8,0xbb,0x73,0x5f,0x73, + 0xbc,0xc8,0xc8,0xc8,0xc8,0xc8,0xc2,0x58,0x53,0x4f,0x49,0x45,0x40,0x3b,0x38, + 0x36,0x34,0x32,0x31,0x30,0x30,0x30,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x31,0x31,0x30,0x30,0x30,0x30,0x31,0x31,0x30,0x2f,0x31,0x32,0x31,0x31, + 0x31,0x30,0x30,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x31,0x31, + 0x32,0x31,0x31,0x32,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x32,0x32,0x31, + 0x31,0x30,0x30,0x30,0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x31,0x31,0x31,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x31,0x31,0xc8,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x20,0x1f,0x1f,0x1f,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x20,0x1f,0x21,0x22,0x23,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x24,0x24,0x23,0x23,0x23,0x22,0x22,0x22,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x23,0x23,0x24,0x25,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x29,0x29,0x2b, + 0x2c,0x2f,0x31,0x35,0x39,0x67,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x9c,0x60,0x62, + 0x64,0x64,0x89,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xb5,0x4c,0x48,0x48,0x47,0xc7, + 0xc7,0xc7,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0xc7,0xc7,0xc7,0x4e,0x4c, + 0x4c,0x4f,0x50,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x5a,0x5b,0x5b,0x5b,0x5a,0xc4, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x5d,0x5d,0x5c,0x5a,0x5a,0xbb,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x7c,0x57,0x57,0x56,0x56,0x57,0xae,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x58,0x59,0x59,0xa4,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa5,0x62,0x62,0x61,0x61,0xa7,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa4,0x5e, + 0x5d,0x5d,0x5c,0x5c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x53,0x4e,0x4a,0x45,0x3f, + 0x3b,0x38,0x36,0x33,0x33,0x33,0x36,0x37,0x3b,0x3e,0x44,0x49,0x4e,0x6e,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc6,0x5e,0x59,0x55,0x50,0x4c,0x48,0x46, + 0x45,0x45,0xc0,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0xc7,0xc7,0xc7,0xc7, + 0xc7,0xc7,0xc7,0xc7,0xc7,0x4c,0x48,0x47,0x45,0x44,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc4,0x46,0x47,0x49,0x4c,0x4f,0x52,0x84,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x89,0x57,0x53,0x4d,0x48,0x43,0x3f, + 0x3a,0x38,0x36,0x34,0x32,0x32,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x31,0x32, + 0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x32,0x31,0x30,0x30,0x30, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x32, + 0x32,0x32,0x31,0x30,0x30,0x30,0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34, + 0x34,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0xc8,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x1f,0x20,0x20,0x20,0x20,0x20, + 0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x22,0x22,0x22,0x20,0x20,0x22,0x23,0x24,0x23,0x22,0x21,0x21,0x22,0x22, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24, + 0x24,0x24,0x24,0x24,0x26,0x26,0x26,0x25,0x25,0x24,0x25,0x26,0x26,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x2a,0x2b,0x2c,0x2f,0x32,0x36,0x42,0xc3,0xc8,0xc8,0xc8,0xc8,0xc8,0xbd,0x5a, + 0x5c,0x5e,0x5f,0x5f,0x5f,0xb1,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x8d,0x4a,0x48, + 0x48,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0x4e,0x4c,0x4d,0x4e,0x4f,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x59,0x59,0x58,0x58, + 0x58,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x5b,0x5a,0x5a,0x59,0x59,0xbb,0xc8,0xc8, + 0xc8,0xc8,0xc8,0x7b,0x55,0x55,0x54,0x54,0x55,0x73,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x56,0x56,0x57,0x58,0xb4,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xb4,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e, + 0xb5,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xb3, + 0x5c,0x5b,0x5b,0x5b,0x5a,0x5a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x51,0x4d,0x48, + 0x44,0x3e,0x3b,0x38,0x36,0x34,0x34,0x34,0x35,0x36,0x3a,0x3d,0x41,0x46,0x4c, + 0x51,0xc0,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xae,0x5b,0x58,0x53,0x4f,0x4b, + 0x48,0x46,0x45,0x46,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x4c,0x49,0x47,0x45,0x45,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc4,0x48,0x48,0x49,0x4c,0x4e,0x50,0x53,0xa5,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xa9,0x57,0x53,0x50,0x4b,0x46, + 0x42,0x3d,0x3a,0x37,0x35,0x33,0x32,0x32,0x32,0x32,0x30,0x30,0x30,0x30,0x30, + 0x30,0x31,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30, + 0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x30, + 0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x33,0xc8,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x22,0x22,0x23,0x21,0x21,0x23,0x24,0x24,0x23,0x22,0x21,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x25,0x24,0x25,0x26,0x26, + 0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x2a,0x2b,0x2d,0x2f,0x32,0x36,0xac,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7, + 0x68,0x57,0x59,0x59,0x5b,0x5b,0x5b,0x61,0xc5,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7, + 0x61,0x48,0x48,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0x4e,0x4c,0x4c,0x4d,0x4f,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x57,0x56, + 0x56,0x56,0x55,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x58,0x57,0x57,0x56,0x57,0xba, + 0xc8,0xc8,0xc8,0xc8,0xc8,0x79,0x53,0x53,0x51,0x51,0x52,0x54,0x9b,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x54,0x54,0x54,0x56,0x57,0xa0,0xc7,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0xa0,0x5c,0x5b,0x5b,0x5a,0x5a, + 0x5a,0x5a,0x5b,0xa0,0xc7,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7, + 0xa0,0x5a,0x59,0x59,0x59,0x58,0x57,0x57,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x50, + 0x4c,0x47,0x43,0x3e,0x3a,0x37,0x35,0x34,0x32,0x32,0x34,0x36,0x38,0x3c,0x40, + 0x45,0x49,0x4e,0x9b,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x76,0x59,0x56,0x51, + 0x4c,0x49,0x47,0x45,0x45,0x45,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x4c,0x49,0x48,0x47,0x46,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc4,0x48,0x48,0x49,0x4b,0x4c,0x4f,0x51,0x54,0x98,0xc7, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc7,0x9b,0x58,0x55,0x51,0x4d, + 0x48,0x45,0x40,0x3d,0x39,0x36,0x34,0x33,0x32,0x32,0x32,0x32,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x30,0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31, + 0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0xc8,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x20,0x20, + 0x20,0x20,0x21,0x22,0x22,0x22,0x22,0x21,0x20,0x20,0x21,0x22,0x22,0x22,0x22, + 0x21,0x20,0x20,0x20,0x21,0x22,0x23,0x24,0x22,0x22,0x24,0x24,0x24,0x24,0x22, + 0x22,0x22,0x23,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24, + 0x24,0x25,0x26,0x25,0x24,0x24,0x24,0x25,0x26,0x27,0x27,0x26,0x25,0x24,0x25, + 0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x2b,0x2b,0x2d,0x2f,0x32,0x7a,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0x92,0x52,0x53,0x54,0x55,0x57,0x57,0x57,0x57,0x82,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xbd,0x4a,0x4a,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0x4d,0x4c,0x4b,0x4c,0x4c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4, + 0x53,0x53,0x52,0x52,0x52,0xc4,0xc8,0xc8,0xc8,0xc8,0xc8,0x56,0x54,0x54,0x53, + 0x53,0xba,0xc8,0xc8,0xc8,0xc8,0xc8,0x77,0x50,0x50,0x4e,0x4e,0x4f,0x50,0x51, + 0x75,0xb2,0xc4,0xc7,0xc8,0xc8,0xc7,0xc3,0xb5,0x52,0x52,0x53,0x53,0x54,0x56, + 0x62,0x9e,0xbd,0xc5,0xc8,0xc8,0xc8,0xc5,0xbc,0x9e,0x63,0x59,0x58,0x57,0x57, + 0x56,0x56,0x56,0x56,0x57,0x58,0x64,0x9f,0xbd,0xc5,0xc8,0xc8,0xc8,0xc5,0xbc, + 0x9f,0x62,0x59,0x57,0x57,0x56,0x56,0x54,0x53,0x53,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc4,0x4d,0x49,0x45,0x41,0x3d,0x3a,0x37,0x34,0x32,0x32,0x32,0x33,0x35,0x37, + 0x3a,0x3d,0x41,0x46,0x4c,0x5c,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc1,0x59,0x56, + 0x53,0x4e,0x4a,0x47,0x45,0x44,0x44,0x45,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0x4c,0x4a,0x48,0x47, + 0x47,0xc8,0xc8,0xc8,0xc8,0xc8,0xc4,0x48,0x48,0x49,0x4a,0x4c,0x4e,0x50,0x52, + 0x55,0x62,0xa0,0xbd,0xc5,0xc8,0xc8,0xc8,0xc6,0xbd,0xa2,0x65,0x58,0x56,0x53, + 0x4f,0x4a,0x46,0x43,0x3f,0x3c,0x3a,0x36,0x33,0x32,0x32,0x32,0x32,0x32,0x30, + 0x2f,0x2f,0x2f,0x30,0x31,0x31,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0xc8, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21, + 0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x20,0x20,0x22,0x22,0x22, + 0x22,0x22,0x22,0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x22,0x22,0x23,0x24,0x24, + 0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x26,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x25, + 0x25,0x26,0x28,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x2a,0x29,0x2b,0x2b,0x2d,0x2f,0x32,0x36,0x39,0x3d,0x41, + 0x45,0x48,0x4a,0x4c,0x4e,0x4f,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x51,0x50, + 0x50,0x4f,0x4c,0x4b,0x4a,0x49,0x49,0x4a,0x4c,0x4f,0x51,0x54,0x55,0x57,0x57, + 0x57,0x57,0x54,0x53,0x50,0x4d,0x4c,0x49,0x48,0x49,0x4a,0x4c,0x4c,0x4e,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x51,0x51,0x51,0x51,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x4e,0x4d,0x4c,0x4b,0x4b,0x4c, + 0x4c,0x4e,0x50,0x51,0x52,0x53,0x53,0x53,0x53,0x51,0x50,0x50,0x4f,0x50,0x50, + 0x50,0x52,0x53,0x54,0x54,0x55,0x56,0x57,0x57,0x57,0x56,0x55,0x56,0x55,0x54, + 0x53,0x51,0x51,0x50,0x51,0x52,0x52,0x53,0x54,0x56,0x57,0x57,0x57,0x58,0x58, + 0x57,0x57,0x57,0x57,0x55,0x54,0x53,0x53,0x51,0x50,0x50,0x50,0x50,0x51,0x51, + 0x51,0x50,0x4d,0x4b,0x47,0x43,0x3f,0x3c,0x38,0x36,0x34,0x32,0x32,0x32,0x32, + 0x35,0x36,0x39,0x3c,0x40,0x44,0x49,0x4d,0x52,0x55,0x58,0x5a,0x5a,0x59,0x58, + 0x55,0x52,0x4f,0x4b,0x47,0x45,0x42,0x41,0x43,0x45,0x47,0x49,0x4e,0x51,0x56, + 0x58,0x5b,0x5e,0x5e,0x5e,0x5e,0x5d,0x5b,0x58,0x56,0x53,0x50,0x4e,0x4b,0x49, + 0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x4a,0x4b, + 0x4e,0x4f,0x52,0x53,0x56,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x58,0x56, + 0x53,0x4f,0x4c,0x48,0x45,0x41,0x3d,0x3a,0x39,0x36,0x33,0x32,0x32,0x32,0x32, + 0x32,0x31,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x33,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0xc8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22, + 0x22,0x22,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x26,0x26,0x26, + 0x25,0x25,0x26,0x27,0x27,0x26,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x27,0x28,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2b,0x2c,0x2e,0x30,0x32,0x36,0x39, + 0x3c,0x3f,0x42,0x45,0x48,0x49,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4a,0x48,0x48,0x48,0x48,0x48,0x4b,0x4c,0x4f,0x51,0x53, + 0x53,0x54,0x54,0x53,0x51,0x4f,0x4c,0x4a,0x48,0x48,0x46,0x46,0x47,0x48,0x49, + 0x4b,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x49,0x48,0x48,0x48, + 0x48,0x48,0x48,0x4a,0x4c,0x4d,0x4e,0x4f,0x50,0x50,0x4f,0x4e,0x4d,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4e,0x50,0x51,0x51,0x53,0x53,0x53,0x53,0x53,0x52,0x51, + 0x50,0x4f,0x4e,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x51,0x51,0x50,0x4f,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4c,0x4c,0x49,0x47,0x44,0x41,0x3e,0x3a,0x37,0x36,0x33,0x32,0x32, + 0x32,0x32,0x33,0x35,0x37,0x3a,0x3e,0x41,0x45,0x4a,0x4e,0x51,0x53,0x56,0x55, + 0x55,0x53,0x51,0x4e,0x4a,0x47,0x45,0x42,0x41,0x41,0x41,0x43,0x45,0x48,0x4c, + 0x4f,0x53,0x56,0x58,0x5a,0x5b,0x5b,0x5a,0x59,0x58,0x56,0x53,0x50,0x4e,0x4b, + 0x49,0x47,0x47,0x46,0x46,0x46,0x47,0x48,0x48,0x47,0x46,0x46,0x47,0x46,0x46, + 0x47,0x48,0x4a,0x4c,0x4f,0x50,0x52,0x54,0x56,0x56,0x56,0x56,0x57,0x56,0x56, + 0x54,0x52,0x4f,0x4c,0x48,0x45,0x41,0x3e,0x3b,0x3a,0x37,0x35,0x35,0x33,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x33,0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x34,0x33,0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x35,0x35, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35, + 0x34,0x33,0x33,0xc8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x25,0x24,0x24,0x24,0x25, + 0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x26,0x26,0x26,0x26,0x25, + 0x25,0x25,0x25,0x26,0x26,0x27,0x28,0x28,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2d,0x30,0x32, + 0x34,0x37,0x3a,0x3d,0x3f,0x42,0x44,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x47, + 0x47,0x48,0x48,0x48,0x48,0x48,0x47,0x45,0x45,0x45,0x45,0x45,0x48,0x49,0x4c, + 0x4c,0x4e,0x4f,0x50,0x50,0x4f,0x4d,0x4b,0x48,0x46,0x45,0x45,0x44,0x43,0x44, + 0x45,0x45,0x46,0x47,0x47,0x47,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x47,0x46,0x47,0x47,0x47,0x47,0x47,0x46,0x46,0x45, + 0x43,0x43,0x43,0x44,0x45,0x47,0x48,0x48,0x4b,0x4c,0x4c,0x4c,0x4c,0x4b,0x49, + 0x48,0x48,0x48,0x48,0x48,0x49,0x4b,0x4c,0x4c,0x4d,0x4f,0x4f,0x4f,0x4f,0x4e, + 0x4e,0x4c,0x4c,0x4b,0x49,0x48,0x47,0x48,0x48,0x48,0x49,0x4b,0x4c,0x4d,0x4e, + 0x4f,0x4f,0x50,0x50,0x50,0x4f,0x4e,0x4e,0x4c,0x4c,0x4a,0x48,0x47,0x46,0x46, + 0x48,0x48,0x48,0x49,0x48,0x48,0x47,0x44,0x41,0x3f,0x3d,0x3a,0x37,0x35,0x33, + 0x32,0x32,0x32,0x32,0x32,0x34,0x36,0x39,0x3c,0x3e,0x41,0x46,0x49,0x4d,0x4f, + 0x50,0x51,0x50,0x4f,0x4c,0x49,0x47,0x45,0x42,0x40,0x3f,0x3f,0x40,0x41,0x43, + 0x47,0x49,0x4c,0x50,0x52,0x54,0x56,0x57,0x57,0x57,0x56,0x54,0x53,0x50,0x4e, + 0x4c,0x49,0x48,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x45, + 0x44,0x45,0x44,0x45,0x47,0x48,0x4a,0x4c,0x4d,0x50,0x51,0x53,0x53,0x52,0x53, + 0x51,0x51,0x50,0x4e,0x4b,0x48,0x45,0x42,0x3f,0x3c,0x3a,0x38,0x36,0x35,0x34, + 0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32, + 0x32,0x32,0x32,0x32,0x33,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x33,0x33,0x33, + 0x34,0x34,0x34,0x34,0x33,0x34,0x34,0x34,0x34,0x34,0x33,0x32,0x32,0x32,0x33, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x34, + 0x34,0x33,0x33,0x33,0x33,0xc8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x26,0x25,0x24,0x24,0x24, + 0x24,0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x26,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2b,0x2d, + 0x2f,0x31,0x33,0x36,0x38,0x3a,0x3d,0x3e,0x3f,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x45, + 0x45,0x48,0x48,0x49,0x4a,0x4b,0x4b,0x4a,0x48,0x46,0x45,0x42,0x41,0x41,0x40, + 0x40,0x40,0x41,0x41,0x42,0x43,0x43,0x43,0x42,0x43,0x43,0x43,0x43,0x43,0x43, + 0x44,0x45,0x45,0x45,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42, + 0x41,0x40,0x3f,0x3f,0x3f,0x40,0x41,0x43,0x44,0x45,0x46,0x46,0x47,0x47,0x47, + 0x46,0x45,0x45,0x44,0x44,0x44,0x44,0x45,0x46,0x46,0x48,0x49,0x49,0x4a,0x4b, + 0x4a,0x49,0x48,0x48,0x47,0x45,0x44,0x44,0x43,0x42,0x42,0x44,0x45,0x45,0x47, + 0x48,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4a,0x4a,0x49,0x48,0x47,0x45,0x44,0x43, + 0x42,0x43,0x44,0x44,0x44,0x45,0x44,0x44,0x42,0x41,0x3e,0x3c,0x3a,0x37,0x36, + 0x33,0x32,0x32,0x31,0x31,0x32,0x32,0x33,0x35,0x37,0x3a,0x3c,0x3f,0x41,0x45, + 0x48,0x49,0x4b,0x4c,0x4b,0x49,0x48,0x45,0x43,0x41,0x3f,0x3d,0x3d,0x3d,0x3d, + 0x3f,0x41,0x44,0x47,0x49,0x4c,0x4e,0x50,0x51,0x52,0x52,0x52,0x51,0x50,0x4f, + 0x4c,0x4a,0x48,0x47,0x45,0x44,0x43,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x42, + 0x42,0x41,0x41,0x41,0x41,0x41,0x43,0x45,0x45,0x48,0x49,0x4c,0x4c,0x4e,0x4e, + 0x4d,0x4e,0x4e,0x4c,0x4c,0x4a,0x47,0x45,0x41,0x3f,0x3c,0x3a,0x39,0x36,0x35, + 0x35,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x32, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35, + 0x34,0x34,0x33,0x33,0x33,0x33,0x33,0xc8,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x24,0x24,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a, + 0x2b,0x2c,0x2e,0x30,0x32,0x34,0x36,0x38,0x3a,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3e, + 0x3f,0x40,0x41,0x42,0x44,0x45,0x45,0x45,0x45,0x45,0x43,0x42,0x40,0x3e,0x3d, + 0x3d,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3f,0x3f,0x3f,0x3e,0x3e,0x3f,0x3f,0x3f, + 0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3d,0x3d,0x3d,0x3c,0x3a,0x3a,0x3c,0x3d,0x3e,0x40,0x41,0x41,0x43,0x43, + 0x43,0x44,0x42,0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x42,0x44,0x44,0x45,0x46, + 0x46,0x46,0x46,0x45,0x45,0x44,0x42,0x41,0x41,0x3f,0x3e,0x3e,0x3f,0x3f,0x40, + 0x41,0x41,0x44,0x45,0x45,0x46,0x47,0x47,0x47,0x46,0x45,0x44,0x43,0x41,0x41, + 0x3f,0x3e,0x3f,0x3f,0x40,0x41,0x41,0x41,0x40,0x40,0x3f,0x3d,0x3c,0x3a,0x37, + 0x36,0x36,0x32,0x32,0x31,0x30,0x30,0x31,0x32,0x33,0x34,0x36,0x37,0x3a,0x3c, + 0x3f,0x41,0x43,0x45,0x45,0x46,0x45,0x45,0x43,0x41,0x40,0x3d,0x3c,0x3a,0x3a, + 0x3a,0x3b,0x3d,0x3e,0x41,0x43,0x45,0x47,0x49,0x4b,0x4c,0x4c,0x4d,0x4c,0x4c, + 0x4b,0x4a,0x48,0x48,0x45,0x44,0x43,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x40,0x40,0x40,0x3f,0x3e,0x3f,0x3e,0x3e,0x40,0x41,0x42,0x44,0x45,0x48,0x49, + 0x49,0x49,0x49,0x4a,0x49,0x48,0x47,0x45,0x43,0x41,0x3f,0x3d,0x3a,0x39,0x37, + 0x35,0x35,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x33, + 0x33,0x33,0x33,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x35, + 0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0xc8,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x21,0x21,0x21,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24,0x23,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x24,0x24,0x25, + 0x25,0x25,0x24,0x25,0x25,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x27,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29, + 0x2a,0x2a,0x2b,0x2c,0x2d,0x2f,0x31,0x33,0x34,0x36,0x37,0x39,0x3a,0x39,0x3a, + 0x3a,0x39,0x39,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3a,0x3c,0x3c,0x3d,0x3d,0x40,0x40,0x41,0x41,0x40,0x40,0x3f,0x3d,0x3c, + 0x3b,0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x38,0x37,0x37,0x38,0x39,0x3b,0x3b,0x3d,0x3d, + 0x3e,0x3e,0x3f,0x3f,0x3e,0x3e,0x3d,0x3d,0x3c,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f, + 0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x3a,0x3a, + 0x3b,0x3c,0x3c,0x3e,0x3f,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f, + 0x3d,0x3d,0x3c,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3a,0x39, + 0x37,0x36,0x36,0x34,0x33,0x31,0x30,0x30,0x31,0x31,0x32,0x32,0x33,0x34,0x35, + 0x37,0x3a,0x3c,0x3d,0x3f,0x40,0x41,0x41,0x41,0x41,0x3f,0x3d,0x3c,0x3a,0x3a, + 0x38,0x38,0x38,0x39,0x3a,0x3c,0x3d,0x40,0x41,0x43,0x45,0x46,0x48,0x48,0x48, + 0x48,0x48,0x46,0x45,0x44,0x43,0x42,0x41,0x40,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3e,0x3e,0x40,0x41, + 0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x43,0x42,0x41,0x40,0x3f,0x3d,0x3b,0x3a, + 0x38,0x36,0x35,0x34,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32, + 0x32,0x32,0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x34, + 0x34,0x34,0x33,0x33,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x35, + 0x35,0x35,0x34,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x34,0x34, + 0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x36,0xc8,0x20,0x20,0x20, + 0x20,0x20,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x21,0x21,0x21,0x21, + 0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x23,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x26,0x27,0x27,0x27,0x26,0x25,0x25,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x28,0x27,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x2b,0x2b,0x2c,0x2d,0x2e,0x30,0x31,0x32,0x34,0x34,0x36,0x36, + 0x36,0x36,0x36,0x36,0x35,0x36,0x36,0x35,0x36,0x36,0x37,0x37,0x37,0x37,0x38, + 0x38,0x38,0x38,0x37,0x37,0x38,0x3a,0x3a,0x3b,0x3b,0x3c,0x3d,0x3d,0x3c,0x3b, + 0x3a,0x38,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37, + 0x36,0x37,0x37,0x37,0x37,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x37,0x37, + 0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x38,0x39, + 0x39,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x39,0x39,0x39,0x39,0x3a,0x3a, + 0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3b,0x3a,0x39,0x39,0x37,0x38, + 0x37,0x37,0x38,0x38,0x3a,0x3a,0x3b,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c, + 0x3c,0x3b,0x3a,0x3a,0x38,0x37,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x38, + 0x37,0x37,0x36,0x36,0x35,0x34,0x32,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x32, + 0x33,0x33,0x36,0x37,0x38,0x3a,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3b,0x3a, + 0x39,0x38,0x37,0x37,0x37,0x38,0x39,0x3a,0x3b,0x3d,0x3e,0x40,0x41,0x42,0x42, + 0x42,0x43,0x42,0x42,0x42,0x41,0x40,0x40,0x3e,0x3d,0x3d,0x3c,0x3c,0x3b,0x3b, + 0x3b,0x3b,0x3c,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3b, + 0x3c,0x3d,0x40,0x41,0x40,0x40,0x40,0x40,0x3f,0x40,0x3e,0x3d,0x3d,0x3b,0x3a, + 0x39,0x37,0x36,0x36,0x34,0x33,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x32,0x33,0x33,0x34,0x34,0x33,0x32,0x32,0x32,0x32,0x33,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x33,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x34, + 0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36, + 0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x35,0x35, + 0x34,0x34,0x34,0x35,0x36,0x36,0x35,0x34,0x34,0x34,0x35,0x36,0x36,0xc8,0x20, + 0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23,0x23,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25, + 0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x27,0x27,0x26,0x26,0x25, + 0x25,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2d,0x2e,0x2f,0x30,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x33,0x34,0x36,0x36,0x36,0x37,0x38,0x38,0x39,0x38, + 0x37,0x37,0x36,0x36,0x34,0x35,0x34,0x34,0x33,0x33,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34, + 0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x37, + 0x36,0x36,0x37,0x37,0x38,0x39,0x39,0x39,0x39,0x39,0x38,0x37,0x36,0x37,0x36, + 0x35,0x35,0x35,0x35,0x35,0x35,0x37,0x37,0x37,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x39,0x38,0x37,0x37,0x36,0x36,0x35,0x35,0x36,0x37,0x37,0x39,0x39,0x38, + 0x37,0x36,0x36,0x36,0x36,0x34,0x34,0x33,0x31,0x31,0x31,0x30,0x30,0x31,0x32, + 0x32,0x32,0x32,0x32,0x33,0x36,0x37,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x39, + 0x39,0x38,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x37,0x39,0x3a,0x3b,0x3c,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3b,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x38,0x39,0x38,0x37,0x37,0x37,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3d,0x3d,0x3d,0x3c,0x3b,0x3c,0x3d,0x3d,0x3c,0x3b,0x3a, + 0x3a,0x38,0x37,0x36,0x36,0x35,0x34,0x33,0x33,0x34,0x34,0x33,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x32,0x32,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x35,0x34,0x34,0x33,0x33,0x33,0x33,0x34, + 0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x34,0x34,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36, + 0x36,0x35,0x35,0x34,0x34,0x35,0x36,0x36,0x35,0x34,0x34,0x34,0x35,0x35,0x36, + 0xc8,0x20,0x20,0x20,0x20,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x23,0x23, + 0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x26,0x26,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x27,0x27,0x27,0x26, + 0x26,0x25,0x25,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2d,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x32,0x32,0x32,0x33,0x34,0x35,0x35, + 0x35,0x35,0x34,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31, + 0x31,0x32,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x33, + 0x34,0x34,0x33,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x34,0x33, + 0x34,0x34,0x33,0x32,0x32,0x32,0x32,0x33,0x35,0x35,0x35,0x36,0x36,0x37,0x37, + 0x36,0x36,0x36,0x36,0x35,0x35,0x34,0x34,0x33,0x33,0x32,0x34,0x35,0x36,0x36, + 0x36,0x36,0x35,0x34,0x33,0x34,0x34,0x34,0x32,0x32,0x31,0x31,0x30,0x30,0x30, + 0x31,0x32,0x32,0x32,0x31,0x32,0x33,0x33,0x35,0x36,0x36,0x37,0x37,0x37,0x37, + 0x37,0x36,0x36,0x36,0x36,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x37,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x38,0x39, + 0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x35, + 0x35,0x37,0x37,0x37,0x37,0x37,0x3a,0x3a,0x3a,0x3a,0x39,0x3a,0x3a,0x3a,0x3a, + 0x38,0x38,0x37,0x36,0x36,0x36,0x34,0x34,0x33,0x33,0x33,0x34,0x33,0x33,0x32, + 0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x33,0x32,0x33,0x33,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x33,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x34,0x34,0x33,0x33, + 0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x33,0x33,0x33,0x34, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x35,0x34,0x34,0x35,0x36,0x36,0x35,0x34,0x34,0x35,0x35, + 0x35,0x35,0xc8,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22,0x23, + 0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x25,0x25,0x25, + 0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x27, + 0x27,0x26,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2c,0x2d, + 0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x30,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x30,0x2f,0x2f,0x2f,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x33, + 0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x34, + 0x35,0x35,0x35,0x35,0x35,0x34,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x34,0x33,0x32,0x32,0x31,0x30,0x30, + 0x31,0x31,0x32,0x32,0x32,0x31,0x32,0x31,0x32,0x33,0x34,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37, + 0x37,0x36,0x36,0x36,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x36,0x37,0x38,0x38,0x37,0x37,0x37,0x38, + 0x39,0x38,0x37,0x36,0x36,0x36,0x35,0x34,0x33,0x33,0x34,0x34,0x34,0x35,0x34, + 0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x34,0x34, + 0x34,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x35,0x35,0x35,0x35,0x35,0x34, + 0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x35, + 0x35,0x36,0x36,0x36,0xc8,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22,0x22, + 0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25, + 0x25,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x25,0x25, + 0x25,0x25,0x24,0x25,0x25,0x25,0x26,0x27,0x27,0x26,0x26,0x25,0x25,0x25,0x26, + 0x26,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x2a,0x29,0x29,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x2f,0x30,0x2f,0x30,0x30, + 0x30,0x2f,0x2f,0x30,0x30,0x2f,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31, + 0x31,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x31,0x30,0x30,0x2f,0x2f,0x30,0x30,0x31,0x31,0x32,0x32, + 0x32,0x32,0x33,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x31,0x31,0x31, + 0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31, + 0x31,0x30,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x34,0x33,0x33,0x34,0x34,0x33,0x32,0x33,0x33,0x33,0x33,0x33,0x34, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x35, + 0x34,0x33,0x33,0x33,0x33,0x34,0x35,0x34,0x34,0x35,0x36,0x36,0x36,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x34,0x34,0x33,0x33,0x34,0x34,0x34,0x33, + 0x34,0x34,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x34, + 0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x35,0x36, + 0x36,0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34, + 0x35,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0xc8,0x21,0x21,0x21,0x21,0x22,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27, + 0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x35,0x35,0x35,0x34,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x33,0x32,0x32,0x33,0x34,0x33,0x33,0x33,0x35,0x36,0x36, + 0x35,0x34,0x36,0x36,0x36,0x35,0x35,0x35,0x34,0x33,0x33,0x33,0x34,0x34,0x34, + 0x33,0x33,0x35,0x35,0x34,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xc8,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x26,0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x26,0x26,0x26,0x25, + 0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x27, + 0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x26,0x27,0x28,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x31,0x32,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31, + 0x31,0x31,0x31,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x31,0x31,0x32,0x31, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34, + 0x34,0x34,0x33,0x33,0x34,0x34,0x34,0x33,0x32,0x33,0x33,0x32,0x32,0x32,0x34, + 0x35,0x35,0x35,0x35,0x36,0x35,0x35,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x34, + 0x33,0x33,0x33,0x34,0x36,0x36,0x35,0x34,0x33,0x33,0x32,0x33,0x33,0x33,0x33, + 0x33,0x34,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x35,0x36,0x36,0x35,0x35,0x34, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35, + 0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x35,0x35,0x34,0x34,0x34, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xc8,0x23,0x23,0x23,0x23, + 0x22,0x22,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x26,0x26,0x25,0x24,0x24,0x25,0x25,0x25,0x26,0x26, + 0x26,0x25,0x25,0x26,0x26,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x26, + 0x26,0x28,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31, + 0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34, + 0x34,0x34,0x34,0x34,0x34,0x33,0x34,0x34,0x34,0x33,0x33,0x34,0x34,0x32,0x32, + 0x33,0x34,0x35,0x35,0x34,0x35,0x36,0x36,0x35,0x35,0x34,0x34,0x34,0x33,0x33, + 0x34,0x33,0x33,0x33,0x34,0x35,0x36,0x36,0x35,0x35,0x34,0x34,0x33,0x34,0x34, + 0x33,0x33,0x34,0x34,0x35,0x35,0x34,0x35,0x34,0x34,0x34,0x35,0x35,0x36,0x35, + 0x35,0x34,0x35,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x35,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35, + 0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xc8,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x26,0x26,0x26, + 0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x28,0x26,0x26,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x27,0x28,0x28,0x28,0x27,0x27,0x26,0x26,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x2a,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x37,0x37,0x36,0x35,0x35,0x34,0x34,0x34,0x35,0x36,0x36,0x37, + 0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x37, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0xc8, + 0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x26, + 0x26,0x26,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x27,0x27,0x27,0x27,0x26,0x26, + 0x26,0x27,0x26,0x26,0x26,0x26,0x27,0x28,0x28,0x27,0x26,0x26,0x25,0x25,0x25, + 0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x27,0x27,0x28,0x28, + 0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x2a,0x2a,0x29,0x29,0x29,0x28,0x29,0x28,0x28,0x28,0x28,0x28,0x29, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e, + 0x2e,0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x34,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x34, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x35, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36, + 0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x37, + 0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x38, + 0x38,0xc8,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x22,0x22,0x22,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x24,0x25,0x27,0x27,0x27,0x27, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x27,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x26,0x26,0x27,0x27,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x30,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x32,0x32,0x32,0x32,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35, + 0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x38,0x38,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38, + 0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38, + 0x38,0x38,0x38,0xc8,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23, + 0x23,0x23,0x23,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x26,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x27, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28, + 0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2d,0x2c,0x2c,0x2c,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x37,0x37,0x37, + 0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x39,0x38,0x38,0xc8,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x23,0x23,0x23,0x23,0x23,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x25,0x25,0x26, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27, + 0x27,0x27,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x29,0x29,0x28,0x29,0x29,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2c,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x33,0x33,0x33,0x33,0x32,0x32,0x32, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x35,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x38,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38, + 0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x39,0x38,0x38,0xc8,0x23,0x23,0x23,0x23,0x24,0x24,0x24, + 0x24,0x24,0x24,0x23,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x26,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x25,0x25,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2e,0x2e,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2c,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x33,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x34,0x35,0x35,0x35,0x35, + 0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x37,0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x37, + 0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x37,0x37,0x37,0x37,0x38,0x38, + 0x38,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0xc8,0x23,0x23,0x23,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x23,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x25, + 0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2c,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2d,0x2e, + 0x2e,0x2d,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2d, + 0x2c,0x2d,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x2f,0x2f,0x2f,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x30,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x32,0x31,0x31, + 0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34, + 0x34,0x33,0x34,0x34,0x34,0x34,0x35,0x34,0x35,0x34,0x34,0x33,0x34,0x35,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x37,0x36,0x36,0x36, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x37,0x38,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x38,0x38,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x38,0x38,0x37,0x37,0x38, + 0x39,0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x39,0x38,0x38,0x38,0x38, + 0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0xc8,0x23,0x23,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x23,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d, + 0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x38,0x38, + 0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0xc8,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27, + 0x27,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x28, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34, + 0x34,0x34,0x33,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35, + 0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x35, + 0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38, + 0x38,0x38,0x38,0x37,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39, + 0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x38,0x38,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x38,0x39,0x39,0x39,0x39,0x39, + 0xc8,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x28, + 0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x28,0x28, + 0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2e, + 0x2e,0x2e,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x30,0x30,0x30,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31, + 0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34, + 0x34,0x34,0x34,0x34,0x33,0x32,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37, + 0x37,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x38,0x39,0x39,0x39, + 0x39,0x39,0xc8,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x29,0x29,0x29,0x29, + 0x28,0x28,0x28,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x29,0x29, + 0x29,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2d,0x2d,0x2c,0x2c,0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d, + 0x2d,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b, + 0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x3a, + 0x3a,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39, + 0x39,0x3a,0x3a,0x3a,0xc8,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x28,0x29,0x29,0x29,0x29,0x2a,0x2a,0x29, + 0x29,0x29,0x28,0x28,0x28,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2a,0x2b,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33, + 0x33,0x34,0x34,0x34,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x37,0x38,0x38,0x38,0x38, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0xc8,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x2a, + 0x2a,0x2a,0x29,0x29,0x28,0x28,0x28,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31,0x30,0x30,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30, + 0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x37,0x38,0x38, + 0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0xc8,0x24,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c, + 0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x30,0x2f,0x2f, + 0x30,0x30,0x31,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x34,0x33,0x33,0x32,0x32,0x33,0x34,0x34,0x35,0x35,0x35,0x35, + 0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x35,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x36,0x35,0x35,0x34,0x35,0x36,0x36, + 0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36, + 0x36,0x37,0x38,0x38,0x37,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x37,0x37,0x38,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x38, + 0x38,0x38,0x38,0x38,0x39,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0xc8,0x24,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24, + 0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x29,0x29,0x29,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a, + 0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31, + 0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x33,0x33,0x33,0x33,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x35,0x35,0x34,0x35, + 0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x38,0x38,0x37,0x37, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x38,0x38, + 0x37,0x36,0x36,0x37,0x38,0x39,0x38,0x37,0x36,0x37,0x37,0x37,0x36,0x36,0x36, + 0x36,0x38,0x38,0x38,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0xc8,0x24,0x24, + 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x27,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x29,0x29,0x29,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31, + 0x31,0x31,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x35,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x38, + 0x38,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x37,0x37, + 0x37,0x38,0x38,0x38,0x37,0x37,0x38,0x38,0x39,0x38,0x37,0x38,0x38,0x36,0x37, + 0x38,0x37,0x37,0x3a,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0xc8, + 0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x25,0x25,0x25,0x24,0x24,0x25,0x25,0x26,0x25,0x26,0x26,0x26,0x27,0x26, + 0x26,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2b,0x2b,0x2b,0x2c, + 0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2d,0x2d,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x31,0x31,0x31,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x33,0x34,0x35,0x35,0x35, + 0x35,0x34,0x34,0x33,0x33,0x33,0x34,0x35,0x36,0x35,0x35,0x34,0x34,0x35,0x35, + 0x36,0x35,0x35,0x35,0x35,0x36,0x35,0x35,0x34,0x34,0x35,0x35,0x36,0x36,0x36, + 0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x38,0x38,0x38,0x38,0x37,0x37,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x38,0x38, + 0x38,0x38,0x37,0x38,0x38,0x39,0x38,0x37,0x37,0x38,0x3a,0x38,0x36,0x37,0x38, + 0x37,0x38,0x39,0x37,0x37,0x38,0x38,0x37,0x39,0x3a,0x38,0x38,0x38,0x38,0x39, + 0x39,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3a,0x3b,0x3b,0x3b,0x3b,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3a,0x3b,0x3b, + 0x3a,0x3a,0x3b,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0xc8,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x25,0x26,0x26,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26,0x26,0x26,0x26,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x28, + 0x28,0x28,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e, + 0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x32,0x33,0x34,0x36, + 0x36,0x36,0x36,0x35,0x33,0x33,0x33,0x33,0x33,0x35,0x36,0x36,0x36,0x35,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x36,0x36,0x37,0x38,0x38,0x38, + 0x38,0x38,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x38,0x38,0x38,0x3a,0x39,0x36, + 0x37,0x38,0x38,0x39,0x3a,0x38,0x36,0x37,0x37,0x37,0x3a,0x3a,0x38,0x38,0x38, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0xc8,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2e,0x2d,0x2d,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x33,0x33, + 0x35,0x36,0x36,0x36,0x36,0x35,0x34,0x33,0x34,0x33,0x34,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x38, + 0x38,0x39,0x38,0x37,0x39,0x3a,0x39,0x37,0x36,0x38,0x39,0x3a,0x39,0x39,0x38, + 0x39,0x3a,0x38,0x36,0x36,0x36,0x37,0x39,0x3a,0x3a,0x39,0x38,0x37,0x37,0x38, + 0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0xc8,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25, + 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2e,0x2e,0x2d,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x34, + 0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x35,0x35,0x34,0x35,0x34,0x34,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x36, + 0x36,0x36,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37, + 0x37,0x38,0x39,0x39,0x38,0x38,0x39,0x3a,0x39,0x37,0x37,0x38,0x39,0x3a,0x3a, + 0x39,0x38,0x39,0x3a,0x38,0x36,0x36,0x36,0x36,0x3a,0x3b,0x3a,0x39,0x39,0x37, + 0x37,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b, + 0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0xc8,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26, + 0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2e,0x2e,0x2d,0x2c,0x2c,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x31, + 0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35, + 0x35,0x35,0x36,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x38,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x39,0x3a,0x3a, + 0x3a,0x39,0x39,0x39,0x3a,0x3a,0x38,0x37,0x3a,0x3a,0x37,0x3a,0x3b,0x37,0x37, + 0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0xc8,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x26,0x26,0x26,0x26,0x26,0x26, + 0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2e,0x2e,0x2d,0x2d,0x2c, + 0x2c,0x2d,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2f,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x31,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30, + 0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32, + 0x32,0x33,0x33,0x33,0x32,0x33,0x34,0x34,0x34,0x33,0x34,0x35,0x35,0x35,0x35, + 0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34, + 0x35,0x35,0x35,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38, + 0x37,0x37,0x37,0x36,0x37,0x36,0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x38,0x37,0x37,0x38,0x38,0x39,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x3a,0x3a,0x38,0x37,0x38,0x3a,0x3a, + 0x3b,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x39,0x38,0x3a,0x3d,0x3c,0x38,0x3a,0x3a, + 0x36,0x36,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a, + 0x3a,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0xc8,0x26,0x26,0x26, + 0x26,0x26,0x26,0x26,0x26,0x26,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x27,0x27,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2e,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x30,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x37, + 0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38, + 0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x37, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x39,0x38,0x38,0x38, + 0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x3a,0x3b,0x3c,0x37,0x36,0x38, + 0x3a,0x3c,0x3b,0x3a,0x39,0x3a,0x3a,0x3a,0x3a,0x38,0x39,0x3b,0x3e,0x3d,0x39, + 0x3a,0x3a,0x36,0x37,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0xc8,0x27, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x34,0x34, + 0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x35, + 0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36, + 0x37,0x38,0x38,0x38,0x38,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x38,0x39,0x39,0x39,0x38, + 0x38,0x38,0x37,0x36,0x36,0x36,0x36,0x37,0x38,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39, + 0x39,0x39,0x39,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3c,0x38, + 0x37,0x39,0x3b,0x3c,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a, + 0x39,0x38,0x3a,0x3b,0x3b,0x3b,0x3a,0x36,0x36,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0xc8,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x2f,0x30,0x30,0x31,0x31,0x31, + 0x31,0x32,0x32,0x31,0x31,0x30,0x31,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35, + 0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38, + 0x38,0x38,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x36,0x36,0x36,0x37,0x37, + 0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x38,0x38,0x39,0x39, + 0x39,0x39,0x38,0x38,0x37,0x37,0x36,0x37,0x37,0x38,0x38,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a, + 0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x38,0x39,0x3b,0x3c,0x3a,0x37,0x38,0x3b,0x3e,0x3d,0x38,0x37,0x3b,0x3d, + 0x3e,0x3c,0x3a,0x3a,0x39,0x3a,0x3d,0x3d,0x3a,0x36,0x37,0x3b,0x3c,0x3b,0x3b, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x3f,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0xc8,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x28,0x28,0x28,0x29,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c, + 0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2d,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x30,0x30,0x30,0x2f,0x2f,0x30,0x30, + 0x30,0x2f,0x2f,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35, + 0x35,0x35,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x38,0x39,0x39,0x39,0x38,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37, + 0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x38,0x38,0x38,0x38,0x38, + 0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x39,0x39,0x38,0x3a,0x3d,0x3c,0x39,0x34,0x36,0x3d,0x41,0x40,0x36,0x34, + 0x38,0x3e,0x42,0x40,0x40,0x3e,0x37,0x35,0x3a,0x3a,0x39,0x3a,0x3b,0x3c,0x3c, + 0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x40, + 0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0xc8,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x27,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x29,0x29,0x2a,0x29,0x29,0x29, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2c,0x2c, + 0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2d,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x31,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x34, + 0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x34,0x34,0x34,0x34, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x38,0x39,0x39,0x38,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x39,0x38, + 0x38,0x38,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x38,0x38,0x37,0x38,0x38, + 0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x39,0x38,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x39,0x3a,0x3d,0x3f,0x3d, + 0x35,0x39,0x41,0x36,0x2f,0x30,0x38,0x41,0x41,0x3e,0x3a,0x39,0x3a,0x3c,0x3d, + 0x3d,0x3d,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3e,0x3e,0x3f, + 0x3f,0x40,0x3f,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x3f,0x3f,0x3e,0x3e, + 0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x3e,0x3e,0x3f,0x3f,0xc8,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2a, + 0x2a,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x31,0x31,0x30,0x30,0x30,0x30,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33, + 0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x39, + 0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37, + 0x37,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x37,0x38,0x38,0x38,0x38,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3d,0x3a,0x36,0x3a,0x3d,0x3d,0x3d,0x3b, + 0x3b,0x3a,0x37,0x3d,0x42,0x28,0x18,0x1e,0x2c,0x3c,0x42,0x42,0x3b,0x3a,0x3a, + 0x3c,0x3e,0x3f,0x3e,0x3c,0x3a,0x3a,0x3c,0x3d,0x3d,0x3d,0x3c,0x3b,0x3b,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3f,0x3f,0x40,0x40,0x40,0x3f,0x3f, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3f,0xc8,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a, + 0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d, + 0x2d,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x31,0x32,0x31,0x30,0x30,0x30,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34, + 0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x39,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3a,0x39,0x38,0x3a,0x3c,0x3a, + 0x3a,0x3b,0x36,0x36,0x40,0x3a,0x2b,0x18,0x10,0x19,0x21,0x26,0x26,0x2e,0x40, + 0x40,0x39,0x3a,0x3d,0x3e,0x3e,0x3d,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c, + 0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3f,0x3f,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x40,0x41,0x40,0x40,0x40,0x3f,0x3f,0xc8,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2d,0x2d,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2d,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x31,0x32,0x31,0x31,0x30,0x30,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x38, + 0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3b,0x39,0x39,0x3b,0x3c, + 0x3c,0x3a,0x3b,0x3d,0x36,0x36,0x47,0x3a,0x1d,0x0e,0x09,0x12,0x15,0x14,0x12, + 0x20,0x45,0x47,0x3a,0x3a,0x3b,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3f,0x3f,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0xc8,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,0x2a, + 0x29,0x29,0x29,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x31,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x33,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38, + 0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3b,0x39,0x3a, + 0x3d,0x3d,0x3c,0x3c,0x3d,0x3e,0x39,0x3a,0x4b,0x3a,0x1a,0x09,0x03,0x0a,0x0a, + 0x07,0x08,0x1c,0x47,0x4c,0x3e,0x3b,0x3a,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d, + 0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3e,0x3e,0x3d,0x3d,0x3e,0x3f, + 0x40,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e, + 0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xc8, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x29,0x2a,0x29, + 0x2a,0x2a,0x2a,0x29,0x2a,0x2a,0x2b,0x2b,0x2a,0x29,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2d,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x2f,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x34,0x34,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x35,0x35,0x35,0x35,0x34,0x33,0x33,0x34,0x33,0x33,0x34,0x34,0x34,0x35,0x34, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x38,0x37, + 0x38,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x38,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3b,0x3c,0x3e,0x3b,0x3a,0x3e,0x3d,0x3b,0x3b,0x3d,0x42,0x30,0x13,0x05,0x00, + 0x04,0x04,0x03,0x04,0x13,0x34,0x41,0x40,0x3c,0x3a,0x3d,0x3e,0x3e,0x3d,0x3d, + 0x3d,0x3c,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3f,0x3e,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e, + 0x3f,0x3f,0x40,0x40,0x3f,0x3e,0x3e,0x3f,0x3e,0x3f,0x40,0x3f,0x3e,0x3e,0x3e, + 0x3f,0x40,0x40,0x40,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x3f,0x3f,0x3f,0x3f,0x40,0x3f,0x40,0x3f,0x3f,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f, + 0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x3f, + 0x3f,0x3e,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x42,0x41,0x41,0x41,0x41, + 0x41,0xc8,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x28,0x28,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x31, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32, + 0x32,0x33,0x34,0x34,0x34,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37, + 0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37,0x38, + 0x38,0x38,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x37,0x38,0x38,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3a,0x39,0x3f,0x3d,0x38,0x3d,0x3f,0x36,0x23,0x0c, + 0x03,0x00,0x02,0x03,0x03,0x03,0x0b,0x1d,0x32,0x41,0x3e,0x3b,0x3d,0x3e,0x3e, + 0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x3e,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x40,0x40,0x40,0x3f,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x3f, + 0x3e,0x3e,0x3f,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x40,0x40,0x40,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x42,0x41,0x41, + 0x41,0x41,0x41,0xc8,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e, + 0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x35,0x34,0x33, + 0x32,0x32,0x33,0x33,0x34,0x34,0x34,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34, + 0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x36,0x36,0x35,0x35, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38, + 0x38,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37, + 0x37,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3a,0x3a,0x3f,0x3d,0x39,0x42,0x43,0x30, + 0x19,0x05,0x02,0x03,0x06,0x07,0x07,0x05,0x07,0x0b,0x28,0x47,0x44,0x3e,0x3d, + 0x3d,0x3e,0x3f,0x3e,0x3d,0x3d,0x3d,0x3e,0x3f,0x40,0x3f,0x3e,0x3d,0x3d,0x3e, + 0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x41, + 0x40,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0xc8,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29, + 0x29,0x29,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x35, + 0x34,0x33,0x32,0x33,0x33,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x34,0x34,0x34, + 0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x38,0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x37,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3d,0x3c,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3c,0x46, + 0x45,0x2f,0x16,0x03,0x02,0x04,0x06,0x07,0x07,0x05,0x03,0x03,0x20,0x45,0x45, + 0x40,0x3d,0x3d,0x3e,0x3f,0x3f,0x3e,0x3d,0x3d,0x3e,0x3f,0x40,0x40,0x40,0x3e, + 0x3d,0x3e,0x3f,0x3f,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x41,0x41,0x41,0x40,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40, + 0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xc8,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a, + 0x2a,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a,0x2a,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c,0x2d, + 0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x34, + 0x34,0x35,0x35,0x34,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3c,0x3c,0x3c, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3b,0x3a,0x3b,0x3e,0x3f,0x3c,0x3c, + 0x40,0x48,0x46,0x30,0x19,0x03,0x01,0x02,0x02,0x03,0x03,0x03,0x02,0x03,0x1c, + 0x3b,0x41,0x41,0x3d,0x3d,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3f,0x3f,0x40,0x41, + 0x41,0x3e,0x3d,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x3f,0x3f, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40, + 0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xc8,0x28,0x28,0x28,0x28,0x28, + 0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a,0x2a,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2b,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31,0x30,0x30,0x30,0x30, + 0x30,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x32,0x31,0x32,0x32,0x32,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x34, + 0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x34, + 0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x36, + 0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3c, + 0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x40,0x40,0x3d,0x3b,0x3c,0x3f,0x40, + 0x3a,0x3a,0x3f,0x45,0x42,0x2e,0x18,0x05,0x02,0x02,0x02,0x03,0x04,0x02,0x01, + 0x03,0x15,0x2c,0x3f,0x45,0x3d,0x3d,0x3e,0x3f,0x3f,0x40,0x3f,0x3f,0x3f,0x3f, + 0x40,0x41,0x41,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40, + 0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x40,0x40,0x40,0x40,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x41,0x41,0x41,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xc8,0x28,0x28,0x28, + 0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x29,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2a, + 0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x33,0x32,0x32,0x33,0x33,0x34,0x34, + 0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34, + 0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39, + 0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x40,0x41,0x3e,0x3d,0x3d, + 0x3f,0x3f,0x3a,0x3a,0x3d,0x44,0x40,0x2b,0x18,0x07,0x03,0x03,0x03,0x03,0x03, + 0x03,0x02,0x04,0x0d,0x1d,0x3b,0x48,0x3e,0x3c,0x3d,0x3e,0x3f,0x40,0x40,0x3f, + 0x3f,0x3f,0x40,0x41,0x41,0x3f,0x3e,0x3f,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40, + 0x41,0x41,0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41, + 0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xc8,0x28, + 0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x30,0x30,0x30,0x30,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32, + 0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x35,0x33,0x33,0x33,0x33,0x34, + 0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3b,0x3b, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3e,0x3f,0x40, + 0x40,0x3f,0x3e,0x3d,0x3d,0x3d,0x3f,0x47,0x44,0x2e,0x19,0x07,0x03,0x03,0x03, + 0x02,0x00,0x02,0x03,0x04,0x07,0x10,0x35,0x48,0x3e,0x3d,0x3d,0x3e,0x40,0x41, + 0x41,0x40,0x3f,0x3e,0x40,0x41,0x42,0x40,0x3f,0x40,0x40,0x41,0x40,0x40,0x40, + 0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x42,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x43,0x42,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x42,0x42, + 0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x42,0x42,0x42,0x42, + 0xc8,0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2c, + 0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x34,0x35,0x34,0x33,0x33, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x38,0x39,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3b,0x3c,0x3c, + 0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x41,0x41,0x3e,0x3e,0x3e,0x3f,0x3d,0x3d,0x48,0x47,0x2d,0x17,0x07,0x03, + 0x03,0x03,0x02,0x00,0x02,0x03,0x04,0x03,0x09,0x30,0x45,0x3e,0x3d,0x3f,0x3f, + 0x40,0x41,0x41,0x40,0x3e,0x3e,0x40,0x41,0x42,0x41,0x40,0x40,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x41,0x41,0x41,0x42,0x43,0x43, + 0x43,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42, + 0x42,0x42,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x42, + 0x42,0x42,0xc8,0x29,0x29,0x29,0x29,0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e, + 0x2e,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x32, + 0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x34,0x35,0x34, + 0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x38,0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x37,0x37,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3c,0x3c,0x3c, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x41, + 0x41,0x41,0x41,0x42,0x41,0x3d,0x3f,0x41,0x3d,0x3a,0x39,0x49,0x4a,0x2b,0x14, + 0x06,0x03,0x03,0x02,0x02,0x02,0x01,0x02,0x04,0x03,0x07,0x2c,0x42,0x3e,0x40, + 0x42,0x41,0x40,0x40,0x40,0x40,0x3d,0x3e,0x41,0x42,0x43,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x43,0x43,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x41,0x41,0x42,0x43, + 0x43,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x42,0x42,0x43,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x42, + 0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0xc8,0x2a,0x2a,0x2a,0x2a,0x29,0x29,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2d,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2c,0x2d,0x2d, + 0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x2f,0x30,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33, + 0x32,0x33,0x33,0x34,0x34,0x34,0x33,0x33,0x33,0x34,0x35,0x35,0x35,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x36,0x35,0x34,0x34,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3c, + 0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c, + 0x3c,0x3c,0x3c,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3d,0x3e,0x3f,0x3f,0x3f,0x40,0x3f,0x3f, + 0x40,0x41,0x41,0x42,0x42,0x43,0x41,0x3d,0x3f,0x40,0x3e,0x3b,0x3a,0x48,0x47, + 0x28,0x12,0x05,0x03,0x03,0x02,0x02,0x03,0x02,0x02,0x05,0x03,0x07,0x28,0x3e, + 0x42,0x43,0x42,0x41,0x40,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x42,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x41,0x42,0x43,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42, + 0x42,0x42,0x42,0x43,0x43,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x41,0x42, + 0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x42,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x43,0x44,0x44, + 0x44,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x43,0xc8,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a,0x2a, + 0x2a,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c, + 0x2c,0x2d,0x2e,0x2e,0x2e,0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x36,0x36, + 0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3f,0x3f,0x3e,0x3f,0x3f,0x40,0x40,0x40, + 0x3f,0x3f,0x40,0x41,0x41,0x42,0x43,0x44,0x41,0x3d,0x3f,0x40,0x3f,0x3d,0x3d, + 0x47,0x44,0x2a,0x14,0x05,0x03,0x03,0x02,0x02,0x03,0x02,0x03,0x04,0x03,0x06, + 0x21,0x3a,0x46,0x46,0x40,0x41,0x41,0x3e,0x3e,0x3f,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x41,0x42,0x42,0x43,0x43,0x42, + 0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x44,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x44,0xc8,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35, + 0x35,0x35,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b, + 0x3c,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x40,0x40,0x3f,0x3f,0x40,0x41, + 0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x43,0x44,0x44,0x41,0x3f,0x3f,0x40,0x41, + 0x3f,0x3f,0x46,0x44,0x31,0x19,0x04,0x02,0x03,0x01,0x02,0x02,0x02,0x02,0x03, + 0x02,0x05,0x1a,0x32,0x49,0x48,0x3d,0x41,0x43,0x40,0x3e,0x3f,0x41,0x42,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x43, + 0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x43,0x43,0x44,0x44,0x45, + 0x45,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x44, + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0xc8,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34, + 0x35,0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x34,0x34,0x35,0x35,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x40,0x40,0x3f,0x40, + 0x40,0x41,0x41,0x41,0x41,0x40,0x41,0x41,0x41,0x43,0x44,0x43,0x42,0x41,0x40, + 0x40,0x41,0x41,0x41,0x45,0x45,0x3a,0x21,0x04,0x01,0x02,0x01,0x01,0x02,0x02, + 0x02,0x02,0x01,0x03,0x13,0x2b,0x4b,0x48,0x3b,0x41,0x45,0x41,0x40,0x40,0x41, + 0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44, + 0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44, + 0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x43,0x44, + 0x45,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45, + 0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0xc8,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2c,0x2c, + 0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x31,0x31,0x30,0x30,0x30,0x31,0x31,0x30,0x2f,0x2f,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x35, + 0x35,0x35,0x35,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39, + 0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x41,0x41, + 0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x42,0x42, + 0x42,0x41,0x41,0x40,0x40,0x41,0x43,0x45,0x45,0x2b,0x06,0x01,0x01,0x01,0x01, + 0x01,0x02,0x02,0x01,0x00,0x03,0x0d,0x25,0x4b,0x48,0x39,0x41,0x45,0x43,0x42, + 0x41,0x42,0x41,0x41,0x42,0x44,0x43,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x42, + 0x42,0x43,0x43,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x44, + 0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0xc8, + 0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2b, + 0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x30,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x30,0x30, + 0x30,0x31,0x32,0x31,0x31,0x31,0x31,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x33,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38, + 0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x37,0x38,0x37,0x37,0x37,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x3a,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3b,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3e,0x3e,0x3f,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x40, + 0x40,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x43,0x43, + 0x42,0x42,0x43,0x42,0x41,0x40,0x40,0x41,0x40,0x43,0x4c,0x32,0x0a,0x03,0x02, + 0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x03,0x09,0x21,0x4c,0x49,0x39,0x41,0x45, + 0x45,0x44,0x43,0x43,0x42,0x40,0x42,0x45,0x43,0x42,0x42,0x42,0x43,0x43,0x44, + 0x44,0x43,0x42,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x43,0x43,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x43,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x45,0x45,0x45,0x46,0x46,0x46,0x45,0x46,0x46,0x47,0x47,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0xc8,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x30,0x31,0x31,0x31,0x31,0x31,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x30,0x30,0x30,0x31,0x32,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38, + 0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x37,0x37, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x40,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41, + 0x43,0x44,0x42,0x42,0x43,0x42,0x41,0x41,0x41,0x41,0x3e,0x41,0x50,0x39,0x12, + 0x05,0x02,0x03,0x03,0x02,0x02,0x02,0x01,0x01,0x03,0x07,0x1e,0x4c,0x4c,0x3b, + 0x40,0x45,0x45,0x45,0x44,0x45,0x43,0x40,0x42,0x45,0x43,0x42,0x42,0x43,0x43, + 0x44,0x44,0x44,0x44,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46, + 0x46,0x46,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x45, + 0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x47,0x46,0x46,0x46, + 0x46,0x46,0x46,0xc8,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x30,0x30,0x31,0x31,0x31,0x31, + 0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x30,0x30,0x30,0x30,0x31, + 0x31,0x31,0x30,0x30,0x31,0x31,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x34,0x34,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x43,0x43,0x42,0x41,0x41, + 0x41,0x42,0x44,0x45,0x43,0x42,0x42,0x42,0x43,0x43,0x44,0x44,0x3e,0x40,0x50, + 0x3d,0x19,0x08,0x01,0x03,0x03,0x00,0x01,0x01,0x00,0x01,0x03,0x04,0x1c,0x4c, + 0x4e,0x40,0x40,0x42,0x44,0x45,0x45,0x45,0x44,0x41,0x42,0x45,0x43,0x43,0x43, + 0x43,0x44,0x44,0x45,0x45,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x46, + 0x46,0x46,0x46,0x46,0x47,0x47,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x47,0x47,0x47,0x47,0xc8,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x30,0x30,0x31,0x31, + 0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x30,0x30, + 0x30,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x39,0x3a,0x39,0x39,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3c,0x3b,0x3c,0x3b,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x42, + 0x41,0x41,0x42,0x42,0x44,0x44,0x44,0x43,0x42,0x43,0x43,0x44,0x45,0x47,0x40, + 0x40,0x50,0x41,0x21,0x0b,0x01,0x04,0x03,0x00,0x00,0x01,0x00,0x01,0x03,0x03, + 0x18,0x46,0x4e,0x45,0x41,0x41,0x44,0x45,0x45,0x46,0x45,0x42,0x42,0x44,0x43, + 0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46, + 0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x47,0x47,0x47,0xc8,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b,0x2b, + 0x2b,0x2b,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x30,0x30, + 0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35, + 0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x37, + 0x37,0x38,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x44,0x44, + 0x43,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x43,0x43,0x43,0x43,0x46, + 0x49,0x41,0x40,0x4f,0x45,0x29,0x0f,0x01,0x04,0x03,0x00,0x00,0x01,0x01,0x01, + 0x02,0x01,0x14,0x3e,0x4b,0x48,0x42,0x40,0x44,0x45,0x45,0x46,0x45,0x44,0x43, + 0x43,0x44,0x44,0x44,0x44,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x47,0x47,0x47,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x46, + 0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x49,0x49,0x49,0x48, + 0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0xc8,0x2c,0x2c,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2d,0x2f,0x2f,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31, + 0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x38,0x37,0x36,0x36,0x37, + 0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39, + 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c, + 0x3c,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3d,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40, + 0x40,0x41,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x42,0x41,0x41,0x41,0x41,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43, + 0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x44,0x42,0x43,0x45,0x45,0x44,0x43,0x41, + 0x41,0x45,0x49,0x41,0x3f,0x4d,0x46,0x30,0x12,0x01,0x04,0x03,0x00,0x00,0x02, + 0x02,0x02,0x02,0x01,0x11,0x35,0x47,0x4b,0x44,0x41,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x46,0x47,0x46,0x45,0x45,0x45,0x45, + 0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x47,0x47,0x48,0x48,0x47,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x49,0x4a,0x4a,0x4a, + 0x4a,0x49,0x49,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0xc8,0x2c,0x2c,0x2c, + 0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2f,0x2f,0x2e,0x2e,0x2e,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31, + 0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x37,0x37, + 0x37,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x42,0x42,0x41,0x41,0x41,0x42, + 0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42, + 0x43,0x43,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x44,0x43,0x43,0x46,0x46,0x45, + 0x43,0x41,0x40,0x43,0x47,0x41,0x40,0x4c,0x47,0x33,0x15,0x02,0x05,0x03,0x00, + 0x01,0x02,0x03,0x02,0x02,0x01,0x0e,0x2d,0x42,0x4d,0x45,0x42,0x46,0x45,0x45, + 0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x46,0x45,0x45, + 0x45,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x47,0x47,0x46,0x46,0x46,0x46,0x46, + 0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49, + 0x49,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0xc8,0x2d, + 0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2e, + 0x2e,0x2f,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x30,0x2f,0x2f,0x30,0x32,0x32,0x32,0x32,0x30,0x30,0x30,0x32, + 0x32,0x32,0x30,0x2f,0x30,0x31,0x32,0x32,0x33,0x32,0x32,0x32,0x31,0x31,0x31, + 0x31,0x31,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34, + 0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x37,0x37, + 0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3b,0x3a, + 0x3a,0x3b,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3e,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x41, + 0x41,0x41,0x41,0x40,0x40,0x3f,0x3f,0x3f,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x43, + 0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x44,0x45,0x45,0x44, + 0x43,0x44,0x45,0x45,0x45,0x45,0x45,0x42,0x44,0x4f,0x47,0x31,0x15,0x04,0x04, + 0x02,0x00,0x00,0x02,0x02,0x02,0x02,0x01,0x0b,0x25,0x3f,0x50,0x48,0x42,0x46, + 0x45,0x43,0x46,0x48,0x48,0x47,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x46,0x46,0x47,0x47,0x48,0x48, + 0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x48, + 0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x49,0x49,0x48,0x48,0x48,0x48, + 0x48,0x49,0x4a,0x4a,0x4a,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0xc8,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2d, + 0x2d,0x2e,0x2f,0x2f,0x2f,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x31,0x31,0x31,0x30,0x30, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x2f,0x30,0x31,0x32,0x32,0x32,0x31,0x30, + 0x31,0x32,0x32,0x32,0x30,0x2f,0x30,0x31,0x32,0x33,0x33,0x32,0x32,0x32,0x31, + 0x31,0x31,0x31,0x31,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x34,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x39,0x39,0x38,0x38, + 0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x39, + 0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c, + 0x3c,0x3b,0x3a,0x3b,0x3c,0x3d,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x40,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x40,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x43,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x43,0x43,0x44,0x45,0x45, + 0x45,0x42,0x42,0x44,0x45,0x45,0x46,0x45,0x43,0x41,0x45,0x4f,0x46,0x2f,0x15, + 0x03,0x03,0x02,0x00,0x00,0x01,0x02,0x02,0x02,0x01,0x0a,0x20,0x3d,0x52,0x48, + 0x42,0x46,0x45,0x44,0x47,0x48,0x48,0x47,0x46,0x46,0x46,0x46,0x45,0x45,0x45, + 0x45,0x45,0x46,0x47,0x47,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x46,0x46,0x47,0x46,0x46,0x46,0x46,0x46,0x47,0x48,0x48, + 0x48,0x48,0x48,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x47, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x49,0x49,0x48, + 0x48,0x48,0x48,0x49,0x4a,0x4a,0x4a,0x4a,0x49,0x48,0x48,0x48,0x48,0x48,0x49, + 0x48,0x48,0xc8,0x2d,0x2d,0x2d,0x2d,0x2c,0x2c,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x31,0x31,0x31, + 0x31,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x33,0x33,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x33,0x33, + 0x33,0x33,0x33,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x36, + 0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a,0x39,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3b,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3b,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x40,0x3e,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x41,0x41,0x41,0x41,0x42,0x43,0x42,0x42,0x41,0x41,0x42,0x42,0x42, + 0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x45,0x45,0x45,0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x45, + 0x45,0x45,0x45,0x43,0x43,0x44,0x43,0x43,0x44,0x43,0x42,0x41,0x44,0x4c,0x45, + 0x31,0x14,0x02,0x03,0x02,0x00,0x00,0x01,0x02,0x02,0x03,0x02,0x0a,0x1e,0x3b, + 0x53,0x48,0x41,0x47,0x47,0x45,0x48,0x48,0x47,0x46,0x45,0x46,0x47,0x47,0x46, + 0x46,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x48, + 0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x48,0x47,0x47,0x47,0x47,0x47,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x49, + 0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4a, + 0x49,0x49,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a, + 0x4a,0x4a,0x49,0x49,0xc8,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2c,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x30,0x2f,0x2f,0x30,0x30, + 0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x31, + 0x32,0x33,0x33,0x33,0x32,0x31,0x31,0x31,0x32,0x32,0x31,0x32,0x32,0x33,0x33, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x37,0x36,0x37,0x37, + 0x37,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a, + 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b, + 0x3c,0x3c,0x3c,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3e,0x3e,0x40,0x40,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x40,0x40,0x40,0x40, + 0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x42,0x41,0x42,0x42,0x42,0x42,0x43,0x42,0x41,0x41,0x41,0x41, + 0x42,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x43,0x44,0x43,0x42,0x42,0x42,0x43, + 0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x44,0x43,0x45, + 0x4c,0x48,0x36,0x16,0x02,0x03,0x02,0x02,0x01,0x02,0x02,0x02,0x03,0x02,0x09, + 0x1c,0x3b,0x54,0x48,0x41,0x48,0x48,0x46,0x48,0x48,0x47,0x46,0x45,0x46,0x47, + 0x47,0x47,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x47,0x47,0x47, + 0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x49,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x4a, + 0x4a,0x49,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a, + 0x4a,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b, + 0x4c,0x4c,0x4b,0x4b,0x4a,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4b,0x4b,0x4a,0x49,0xc8,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x32,0x32,0x32,0x31,0x31,0x31, + 0x31,0x31,0x32,0x33,0x34,0x34,0x33,0x32,0x31,0x31,0x32,0x33,0x32,0x32,0x32, + 0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x38,0x38,0x38,0x38,0x37, + 0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a, + 0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3c,0x3d,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e, + 0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3e,0x3f,0x40,0x40,0x40, + 0x40,0x40,0x40,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42, + 0x42,0x42,0x44,0x44,0x44,0x44,0x44,0x44,0x43,0x43,0x44,0x44,0x44,0x43,0x42, + 0x42,0x43,0x44,0x44,0x43,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x47,0x48,0x48,0x48,0x48,0x46,0x45,0x45,0x45,0x45, + 0x46,0x48,0x4c,0x4a,0x3d,0x19,0x02,0x03,0x03,0x03,0x03,0x02,0x02,0x02,0x03, + 0x01,0x07,0x19,0x3b,0x57,0x49,0x41,0x48,0x48,0x47,0x48,0x48,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48,0x48,0x49,0x49,0x48,0x49,0x49, + 0x4a,0x4a,0x4a,0x4a,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4b,0x4a,0x4a,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d, + 0x4d,0x4d,0x4d,0x4c,0x4c,0x4b,0x4a,0x4a,0xc8,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x33,0x33,0x34, + 0x34,0x34,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x39,0x39,0x39, + 0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3d, + 0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41, + 0x41,0x41,0x41,0x41,0x40,0x3f,0x40,0x40,0x40,0x41,0x41,0x40,0x40,0x40,0x41, + 0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x42, + 0x42,0x43,0x43,0x42,0x41,0x41,0x42,0x42,0x43,0x43,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44, + 0x43,0x42,0x42,0x43,0x44,0x45,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x48,0x47,0x45,0x45,0x45, + 0x46,0x47,0x47,0x48,0x4a,0x4b,0x44,0x1d,0x03,0x04,0x04,0x05,0x03,0x02,0x02, + 0x02,0x02,0x00,0x07,0x18,0x3c,0x5a,0x4b,0x42,0x48,0x49,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a, + 0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4b,0x4a,0x4a,0x4a,0x4a,0x4c,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0xc8,0x2d,0x2d,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x33,0x34,0x34,0x35,0x34,0x33, + 0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x38,0x39, + 0x39,0x39,0x39,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x40,0x40,0x40,0x41,0x41,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43, + 0x43,0x42,0x42,0x43,0x43,0x42,0x42,0x41,0x42,0x42,0x43,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x44,0x43,0x43,0x43,0x44,0x45,0x45,0x45,0x44,0x44,0x44,0x45,0x45,0x46, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x46,0x45,0x46,0x47,0x46,0x45, + 0x45,0x45,0x46,0x48,0x48,0x48,0x48,0x4b,0x48,0x20,0x03,0x03,0x04,0x05,0x03, + 0x02,0x02,0x02,0x02,0x01,0x07,0x15,0x3a,0x5a,0x4c,0x42,0x48,0x49,0x48,0x48, + 0x48,0x49,0x4a,0x4a,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48,0x48,0x48,0x48, + 0x49,0x4a,0x49,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4c, + 0x4c,0x4a,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4b,0x4b,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0xc8,0x2d,0x2d, + 0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2e,0x2e,0x2e, + 0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x33,0x32,0x31,0x31,0x32,0x33,0x34, + 0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x33,0x34,0x35,0x35, + 0x35,0x34,0x33,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x34,0x34,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38, + 0x38,0x39,0x39,0x3a,0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c, + 0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e, + 0x3e,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3f,0x3f,0x40, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x41,0x40,0x3f,0x40,0x40,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x41,0x41,0x41,0x41,0x41, + 0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43, + 0x43,0x43,0x42,0x42,0x42,0x43,0x43,0x42,0x42,0x42,0x42,0x43,0x44,0x45,0x45, + 0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45, + 0x45,0x46,0x46,0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47, + 0x46,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x46,0x47,0x48,0x46,0x45,0x46,0x46, + 0x45,0x45,0x45,0x45,0x47,0x48,0x48,0x48,0x45,0x4a,0x4a,0x20,0x01,0x02,0x03, + 0x03,0x02,0x01,0x03,0x03,0x02,0x01,0x06,0x12,0x36,0x59,0x4c,0x43,0x48,0x48, + 0x48,0x48,0x48,0x4a,0x4b,0x4b,0x49,0x48,0x49,0x4a,0x4a,0x4a,0x4a,0x49,0x49, + 0x49,0x4a,0x4a,0x4b,0x49,0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4b,0x4c,0x4c,0x4b,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0xc8, + 0x2d,0x2d,0x2d,0x2e,0x2d,0x2e,0x2f,0x2f,0x2f,0x2f,0x2e,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x31,0x31,0x31,0x31,0x31,0x32, + 0x32,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x34,0x35,0x35,0x34,0x32,0x31,0x31,0x32, + 0x34,0x35,0x34,0x32,0x32,0x32,0x33,0x34,0x34,0x33,0x33,0x33,0x33,0x34,0x35, + 0x35,0x35,0x35,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x35,0x35,0x35,0x35,0x34, + 0x34,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x39,0x38,0x38,0x39,0x39,0x39,0x39,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3a,0x3a,0x3b,0x3b, + 0x3c,0x3b,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40, + 0x40,0x41,0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x41,0x41,0x41,0x40,0x3f,0x40, + 0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x43,0x44, + 0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x43,0x43,0x43,0x44,0x44,0x43,0x43,0x43, + 0x44,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x45,0x45, + 0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x46,0x47, + 0x47,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x46,0x46,0x47,0x48,0x48,0x47, + 0x48,0x47,0x47,0x46,0x46,0x47,0x48,0x49,0x4a,0x48,0x44,0x4a,0x4d,0x21,0x02, + 0x01,0x02,0x03,0x02,0x01,0x03,0x02,0x01,0x02,0x05,0x0c,0x31,0x56,0x4c,0x45, + 0x48,0x49,0x49,0x49,0x49,0x4a,0x4c,0x4c,0x49,0x48,0x49,0x4a,0x4a,0x4a,0x4a, + 0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4a,0x48,0x48,0x49,0x4a,0x4a,0x49,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4a,0x4a,0x4b,0x4a,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4b,0x4a,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4c, + 0x4c,0x4b,0x4b,0x4c,0x4c,0x4e,0x4e,0x4e,0x4e,0x4d,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4e,0x4e,0x4d,0x4d,0x4d,0x4d,0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4d,0x4d,0x4d, + 0x4d,0xc8,0x2d,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x34,0x35,0x35,0x35,0x33,0x32, + 0x31,0x32,0x34,0x35,0x35,0x33,0x32,0x33,0x34,0x34,0x34,0x34,0x33,0x33,0x34, + 0x35,0x35,0x36,0x36,0x35,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x35,0x35,0x35, + 0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x3a,0x3a,0x3a,0x39,0x39,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3a,0x3a, + 0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x42,0x42,0x41, + 0x40,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x43,0x43, + 0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x43,0x43,0x43,0x44,0x44,0x43, + 0x43,0x43,0x44,0x44,0x45,0x46,0x46,0x46,0x45,0x45,0x46,0x46,0x47,0x47,0x46, + 0x46,0x46,0x46,0x46,0x47,0x47,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x48,0x48,0x48,0x48,0x47,0x48,0x48,0x47,0x47,0x47,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x4a,0x4b,0x48,0x43,0x4b,0x50, + 0x24,0x03,0x02,0x02,0x03,0x02,0x01,0x03,0x02,0x00,0x02,0x03,0x07,0x2b,0x52, + 0x4c,0x46,0x48,0x49,0x4a,0x49,0x4a,0x4b,0x4c,0x4c,0x49,0x48,0x49,0x4a,0x4a, + 0x4a,0x4a,0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4a,0x49,0x49,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4d,0x4c,0x4c,0x4c,0x4c,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e,0x4d,0x4c,0x4c, + 0x4d,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4e,0x4e,0x4d,0x4d,0x4e, + 0x4e,0x4e,0x4e,0xc8,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x31,0x31,0x31,0x32, + 0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x35,0x35, + 0x34,0x33,0x33,0x33,0x34,0x35,0x35,0x34,0x33,0x34,0x35,0x35,0x35,0x35,0x34, + 0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x3a, + 0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3c,0x3c, + 0x3b,0x3b,0x3c,0x3c,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3e,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40, + 0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42, + 0x43,0x41,0x41,0x41,0x42,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x45,0x45,0x44,0x45,0x45,0x45, + 0x45,0x45,0x44,0x44,0x44,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x4a,0x48,0x42, + 0x4c,0x53,0x27,0x05,0x04,0x03,0x02,0x02,0x02,0x03,0x02,0x00,0x02,0x03,0x04, + 0x28,0x4e,0x4d,0x49,0x49,0x4a,0x4c,0x4a,0x4a,0x4c,0x4c,0x4c,0x49,0x48,0x4a, + 0x4a,0x4b,0x4b,0x4a,0x4a,0x49,0x49,0x49,0x4b,0x4c,0x4b,0x4a,0x4a,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4d,0x4d,0x4d,0x4d,0x4c,0x4d,0x4e,0x4e,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4e, + 0x4d,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x4f, + 0x4f,0x50,0x50,0x4f,0x4f,0xc8,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x30, + 0x30,0x30,0x31,0x31,0x32,0x31,0x31,0x31,0x30,0x30,0x30,0x30,0x31,0x31,0x31, + 0x31,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x33,0x33,0x32,0x32,0x32, + 0x32,0x33,0x33,0x33,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x33,0x34, + 0x35,0x35,0x36,0x35,0x34,0x34,0x33,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x39,0x38,0x38,0x38,0x38,0x38,0x38,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39, + 0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3e,0x3d, + 0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3e,0x3d,0x3e,0x3f,0x3f, + 0x3f,0x3f,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x42,0x41,0x41,0x41,0x42, + 0x42,0x43,0x43,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x46,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x46, + 0x46,0x47,0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x47,0x46,0x46,0x46,0x46,0x46, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x49,0x48,0x48,0x49,0x49,0x48,0x49,0x49,0x48,0x48,0x48,0x4b, + 0x49,0x43,0x4d,0x56,0x28,0x07,0x05,0x03,0x01,0x01,0x03,0x04,0x02,0x00,0x02, + 0x03,0x03,0x25,0x4c,0x4f,0x4c,0x4a,0x4b,0x4c,0x4b,0x4a,0x4c,0x4c,0x4c,0x49, + 0x49,0x4b,0x4b,0x4c,0x4c,0x4c,0x4b,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e, + 0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e, + 0x4e,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, + 0x4d,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e, + 0x4f,0x50,0x50,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x4f,0xc8,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x30,0x31,0x31, + 0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x34,0x33,0x33, + 0x33,0x33,0x33,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34, + 0x33,0x33,0x34,0x36,0x36,0x36,0x36,0x35,0x33,0x33,0x34,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3f, + 0x3f,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x40,0x40,0x40, + 0x40,0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42, + 0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46, + 0x45,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x47,0x46,0x46, + 0x47,0x47,0x48,0x48,0x48,0x48,0x47,0x46,0x46,0x46,0x48,0x47,0x46,0x46,0x46, + 0x46,0x46,0x47,0x47,0x47,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49, + 0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x4b,0x4b,0x4a,0x4b,0x4c,0x49,0x48, + 0x48,0x4c,0x4c,0x45,0x4f,0x57,0x2a,0x07,0x05,0x02,0x01,0x01,0x03,0x04,0x02, + 0x00,0x02,0x03,0x03,0x25,0x4c,0x50,0x4e,0x4a,0x4b,0x4c,0x4b,0x4a,0x4c,0x4c, + 0x4c,0x4b,0x4a,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4c,0x4c,0x4d,0x4e, + 0x4f,0x50,0x50,0x4f,0x4e,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4e,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f, + 0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x4f,0x4e, + 0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x51,0x50,0x50,0x50,0x50,0x50,0xc8,0x2f,0x2f,0x2f,0x2f,0x2f, + 0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x30,0x30,0x2f,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31, + 0x32,0x32,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x34,0x35,0x34,0x34, + 0x34,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x34,0x34,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x37,0x38, + 0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x3a,0x3a, + 0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a, + 0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3f, + 0x3f,0x3e,0x3e,0x3f,0x40,0x40,0x40,0x40,0x3f,0x40,0x40,0x41,0x41,0x40,0x40, + 0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x46,0x47, + 0x47,0x47,0x45,0x45,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x46,0x46, + 0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x48,0x48,0x48,0x48,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48,0x48,0x48,0x48,0x48,0x49, + 0x49,0x49,0x48,0x48,0x48,0x49,0x4a,0x4b,0x4b,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4a,0x4a,0x4b,0x4c,0x4b,0x47,0x4f,0x54,0x2b,0x0b,0x05,0x03,0x03,0x03,0x03, + 0x03,0x01,0x00,0x01,0x02,0x03,0x24,0x4b,0x52,0x50,0x48,0x49,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4e,0x4e,0x4d,0x4d,0x4d, + 0x4e,0x4f,0x4f,0x50,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4e,0x4f, + 0x4f,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x4f,0x4f,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0x50,0x4f, + 0x4f,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x50,0x50,0xc8,0x2f,0x2f,0x2f, + 0x2f,0x2f,0x30,0x30,0x30,0x30,0x2f,0x2f,0x2f,0x2f,0x2f,0x30,0x30,0x30,0x31, + 0x31,0x31,0x31,0x30,0x2f,0x2f,0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x31, + 0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x35, + 0x35,0x34,0x33,0x33,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37, + 0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x36,0x37,0x36,0x36, + 0x37,0x39,0x39,0x39,0x38,0x37,0x37,0x38,0x39,0x39,0x39,0x38,0x38,0x39,0x39, + 0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39, + 0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f, + 0x3e,0x40,0x40,0x3f,0x3e,0x3e,0x3f,0x40,0x41,0x40,0x3f,0x40,0x41,0x41,0x41, + 0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x40, + 0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x43,0x43,0x43, + 0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x46, + 0x46,0x47,0x47,0x47,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x46, + 0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x48,0x48,0x48, + 0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x4a,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b, + 0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4a,0x48,0x4f,0x53,0x2d,0x0e,0x05,0x03,0x04, + 0x04,0x03,0x01,0x01,0x01,0x01,0x01,0x02,0x23,0x4a,0x53,0x50,0x47,0x48,0x4c, + 0x4e,0x4e,0x4e,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4e,0x4d, + 0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x4f,0x4f, + 0x4f,0x50,0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x52,0x52,0x51,0x50,0x50, + 0x50,0x50,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0xc8,0x30, + 0x30,0x2f,0x2f,0x30,0x30,0x31,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34, + 0x34,0x35,0x35,0x34,0x33,0x34,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x38,0x37,0x37,0x37,0x37,0x38, + 0x38,0x37,0x38,0x39,0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40, + 0x40,0x3f,0x3f,0x40,0x41,0x40,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x45, + 0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x48,0x48, + 0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x48, + 0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4b,0x4b,0x4b,0x4c,0x4d,0x4c,0x4b,0x48,0x50,0x53,0x2f,0x0f,0x06, + 0x03,0x04,0x03,0x03,0x01,0x01,0x01,0x02,0x01,0x01,0x23,0x4a,0x52,0x50,0x48, + 0x49,0x4d,0x4e,0x4f,0x4f,0x4e,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x4e,0x4d,0x4d,0x4e,0x4f,0x4f,0x4e,0x4e, + 0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4f,0x4f, + 0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x50,0x4f,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51, + 0x52,0x51,0x51,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x51,0x50,0x51,0x51,0x50, + 0x50,0x51,0x52,0x52,0x52,0x52,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x51,0x50, + 0xc8,0x30,0x30,0x30,0x2f,0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x31,0x31,0x31, + 0x30,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x31,0x31,0x31,0x31,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x33,0x33,0x33,0x33, + 0x34,0x34,0x35,0x35,0x35,0x35,0x34,0x34,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x38,0x38,0x38,0x37,0x37, + 0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3b,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3b, + 0x3b,0x3a,0x3a,0x3a,0x3b,0x3c,0x3b,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3b,0x3b, + 0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x40,0x41,0x41,0x40,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x48, + 0x47,0x46,0x45,0x45,0x45,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b, + 0x4b,0x49,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4c,0x4c,0x4d,0x4c,0x4c,0x49,0x51,0x55,0x30, + 0x11,0x07,0x03,0x04,0x03,0x02,0x01,0x01,0x01,0x03,0x03,0x02,0x22,0x49,0x53, + 0x52,0x4a,0x4b,0x4e,0x4e,0x4f,0x50,0x50,0x4e,0x4d,0x4c,0x4c,0x4d,0x4d,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4f,0x50,0x4f,0x4e,0x4d,0x4e,0x4f,0x4f, + 0x4f,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4e,0x4e,0x4f,0x50, + 0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x50,0x50,0x50,0x50,0x51,0x51, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x53,0x52,0x51, + 0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x52,0x51,0x52, + 0x52,0x52,0x52,0x52,0x53,0x52,0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x52,0x52, + 0x52,0x51,0xc8,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x32,0x32,0x31,0x31,0x31, + 0x32,0x32,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x34,0x34, + 0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x39,0x39, + 0x38,0x38,0x38,0x39,0x3a,0x3a,0x39,0x39,0x38,0x38,0x38,0x39,0x3a,0x3b,0x3b, + 0x3b,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a, + 0x3a,0x3c,0x3b,0x3a,0x3a,0x3a,0x3c,0x3c,0x3c,0x3b,0x3a,0x3a,0x3b,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42, + 0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43, + 0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47, + 0x48,0x48,0x48,0x47,0x46,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48, + 0x48,0x48,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b, + 0x4c,0x4c,0x4c,0x4a,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4d,0x4c,0x49,0x52, + 0x57,0x32,0x13,0x07,0x03,0x03,0x03,0x02,0x01,0x01,0x02,0x03,0x03,0x03,0x21, + 0x47,0x53,0x54,0x4c,0x4c,0x4f,0x4d,0x4e,0x51,0x50,0x4f,0x4d,0x4d,0x4d,0x4d, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x50,0x50,0x50,0x4e,0x4e,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x50,0x50,0x4f,0x4f, + 0x4f,0x50,0x50,0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x51,0x51,0x51,0x51, + 0x51,0x52,0x51,0x50,0x50,0x50,0x51,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53, + 0x53,0x50,0x50,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x52, + 0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x52,0x52,0xc8,0x30,0x30,0x2f,0x2f,0x30,0x31,0x31,0x31,0x31,0x31, + 0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x37,0x37, + 0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x39, + 0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x39,0x38,0x37,0x37,0x38,0x39,0x3a, + 0x3a,0x3b,0x3a,0x3a,0x3a,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3a,0x3b,0x3c,0x3c,0x3c,0x3b,0x3a,0x3a,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e, + 0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x40,0x40, + 0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x41,0x41, + 0x40,0x40,0x41,0x41,0x42,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43, + 0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44, + 0x45,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x46, + 0x46,0x47,0x48,0x48,0x48,0x48,0x47,0x46,0x46,0x47,0x47,0x48,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c, + 0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4e,0x4f,0x4e,0x4c, + 0x4a,0x52,0x57,0x34,0x15,0x07,0x03,0x03,0x02,0x01,0x01,0x01,0x02,0x03,0x03, + 0x02,0x1d,0x40,0x53,0x57,0x4c,0x4c,0x50,0x4e,0x4e,0x50,0x50,0x4f,0x4e,0x4d, + 0x4e,0x4f,0x4f,0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x51,0x50,0x50, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x51,0x50, + 0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x52,0x53,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x53, + 0x53,0x53,0x53,0x53,0x53,0x52,0xc8,0x30,0x30,0x2f,0x2f,0x30,0x31,0x31,0x31, + 0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x38,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38, + 0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x39,0x37,0x38,0x38, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3b, + 0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3e,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f, + 0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x41,0x41, + 0x41,0x41,0x40,0x40,0x41,0x41,0x42,0x42,0x41,0x41,0x42,0x42,0x42,0x42,0x42, + 0x42,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43, + 0x43,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x44,0x45,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x4a,0x4b,0x4b, + 0x4b,0x4a,0x4a,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f, + 0x4e,0x4c,0x4b,0x52,0x57,0x35,0x15,0x07,0x02,0x03,0x02,0x01,0x01,0x01,0x02, + 0x03,0x03,0x01,0x16,0x36,0x52,0x5a,0x4b,0x4c,0x51,0x50,0x4f,0x50,0x50,0x50, + 0x4f,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51, + 0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x51,0x51, + 0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x51,0x51,0x52,0x53,0x53, + 0x53,0x52,0x50,0x50,0x51,0x51,0x52,0x53,0x52,0x52,0x52,0x53,0x53,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54, + 0x54,0x53,0x53,0x54,0x54,0x54,0x53,0x53,0xc8,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x30,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35, + 0x35,0x34,0x34,0x35,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x37, + 0x37,0x38,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3a,0x3a,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x3f,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40, + 0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x42,0x42,0x41,0x41,0x41,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x44,0x45,0x48,0x48,0x48,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x48, + 0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4b, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4a, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d, + 0x4e,0x4f,0x4e,0x4c,0x4b,0x52,0x56,0x36,0x17,0x07,0x01,0x03,0x02,0x01,0x02, + 0x02,0x02,0x03,0x02,0x00,0x0e,0x29,0x50,0x5c,0x4a,0x4c,0x52,0x50,0x50,0x50, + 0x51,0x51,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x51,0x51,0x51,0x52,0x52,0x52, + 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x51,0x51,0x51,0x51,0x51, + 0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x51,0x51,0x52, + 0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x52,0x52,0x53,0x52,0x52,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x54, + 0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x53,0x54,0x54,0x54,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x54,0x54,0x53,0x53,0x53,0x53, + 0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x54,0x53,0x52,0xc8,0x30,0x30,0x30,0x30, + 0x30,0x31,0x31,0x31,0x31,0x30,0x30,0x30,0x31,0x31,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36, + 0x36,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x37,0x38,0x38,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3a,0x3a,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x41,0x41,0x41, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x42,0x41,0x42,0x43, + 0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46, + 0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x48,0x48,0x48,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x4a, + 0x49,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4f,0x50,0x4e,0x4d,0x4d,0x4d,0x4d,0x4c, + 0x4c,0x4d,0x4e,0x4f,0x4e,0x4d,0x4b,0x51,0x55,0x36,0x18,0x07,0x01,0x03,0x01, + 0x01,0x02,0x02,0x02,0x03,0x02,0x00,0x09,0x1f,0x4d,0x5f,0x4b,0x4c,0x53,0x51, + 0x50,0x50,0x50,0x51,0x50,0x50,0x50,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x52, + 0x52,0x52,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x51,0x51, + 0x51,0x51,0x50,0x50,0x51,0x51,0x52,0x53,0x53,0x53,0x52,0x52,0x50,0x50,0x51, + 0x51,0x52,0x53,0x53,0x54,0x53,0x53,0x53,0x53,0x52,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x54,0x54, + 0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x54,0x54,0x53, + 0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x56,0x55,0x55,0x54,0x54, + 0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x53,0x53,0xc8,0x31,0x31, + 0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x35,0x35,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x39,0x39,0x39,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3d,0x3c,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e, + 0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x40,0x40,0x40,0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x42, + 0x42,0x41,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43, + 0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46, + 0x47,0x47,0x47,0x47,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x47,0x48,0x48,0x49, + 0x4a,0x4a,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x4a,0x4a,0x4a,0x49,0x49,0x49, + 0x49,0x49,0x49,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d, + 0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x4f,0x50,0x4f,0x4e,0x4e,0x4e, + 0x4e,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4d,0x4b,0x51,0x55,0x37,0x19,0x06,0x01, + 0x03,0x01,0x00,0x02,0x02,0x01,0x02,0x03,0x02,0x06,0x16,0x4c,0x62,0x4e,0x4e, + 0x53,0x52,0x50,0x4f,0x50,0x51,0x50,0x50,0x51,0x52,0x52,0x53,0x53,0x53,0x53, + 0x53,0x52,0x52,0x52,0x51,0x50,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52, + 0x52,0x50,0x50,0x51,0x51,0x51,0x53,0x53,0x54,0x55,0x55,0x55,0x54,0x53,0x52, + 0x51,0x51,0x51,0x52,0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55, + 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x56,0x55,0x55,0x55,0x54, + 0x54,0x54,0x53,0x53,0x54,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56, + 0x56,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x55,0x54,0xc8, + 0x32,0x32,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x31,0x32,0x33, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x37,0x37,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x36,0x37,0x37,0x38, + 0x38,0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x38,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3b,0x3a,0x3a,0x3a,0x3a,0x3c,0x3c, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x43, + 0x44,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x44,0x44, + 0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47, + 0x47,0x47,0x47,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48,0x48,0x48,0x47,0x47,0x48, + 0x48,0x48,0x49,0x49,0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4a,0x49, + 0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4c,0x4c, + 0x4c,0x4c,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4d,0x4d,0x4e,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x4f, + 0x4f,0x4f,0x4f,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x4e,0x4b,0x51,0x56,0x39,0x1b, + 0x07,0x01,0x03,0x01,0x00,0x02,0x02,0x02,0x02,0x03,0x04,0x05,0x12,0x49,0x62, + 0x51,0x50,0x53,0x53,0x51,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x53,0x53,0x53, + 0x53,0x53,0x52,0x52,0x52,0x51,0x51,0x50,0x51,0x51,0x51,0x51,0x52,0x52,0x52, + 0x53,0x53,0x52,0x50,0x51,0x53,0x53,0x53,0x53,0x54,0x55,0x56,0x56,0x56,0x55, + 0x54,0x53,0x53,0x52,0x52,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x53,0x53, + 0x53,0x54,0x54,0x54,0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x55, + 0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x56,0x55, + 0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x56, + 0x55,0xc8,0x32,0x32,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x33,0x33,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x33, + 0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x37,0x37,0x36,0x36,0x37, + 0x38,0x38,0x38,0x38,0x38,0x37,0x37,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3c,0x3b,0x3a,0x3a,0x3a, + 0x3b,0x3c,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x42,0x43,0x43,0x43,0x43, + 0x43,0x44,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x45,0x44,0x44, + 0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x49,0x49,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4c, + 0x4b,0x4b,0x4a,0x4b,0x4b,0x4a,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4e,0x4e,0x4e,0x4f,0x50,0x50, + 0x50,0x50,0x50,0x50,0x4f,0x4f,0x4e,0x50,0x50,0x50,0x50,0x4e,0x4c,0x52,0x57, + 0x3a,0x1d,0x07,0x01,0x03,0x01,0x00,0x03,0x03,0x02,0x03,0x03,0x05,0x04,0x0e, + 0x46,0x61,0x54,0x51,0x51,0x53,0x53,0x51,0x51,0x51,0x51,0x52,0x52,0x53,0x53, + 0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x51,0x51,0x52,0x52,0x53,0x52,0x52,0x52, + 0x52,0x53,0x53,0x53,0x53,0x52,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55, + 0x56,0x55,0x55,0x56,0x55,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x55, + 0x55,0x54,0x53,0x55,0x55,0x55,0x56,0x56,0x55,0x55,0x55,0x55,0x55,0x55,0x55, + 0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57, + 0x56,0x56,0x57,0x57,0x56,0x56,0x56,0x56,0x55,0x56,0x56,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x56,0x57,0x57,0x57,0x57, + 0x57,0x57,0x56,0xc8,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32,0x32,0x32,0x32, + 0x32,0x32,0x33,0x34,0x34,0x33,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34, + 0x34,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x36,0x35, + 0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x38,0x38,0x37,0x37, + 0x37,0x37,0x37,0x38,0x39,0x39,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a,0x3c,0x3d,0x3d,0x3d,0x3c,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3c,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x41, + 0x41,0x41,0x40,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x42,0x43,0x43, + 0x43,0x43,0x44,0x45,0x45,0x44,0x43,0x43,0x44,0x45,0x43,0x43,0x44,0x45,0x45, + 0x45,0x45,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46, + 0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x46,0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4e,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e, + 0x4e,0x4f,0x4f,0x4f,0x4d,0x4d,0x4f,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x50,0x4f,0x4c, + 0x53,0x57,0x3b,0x1d,0x08,0x02,0x03,0x01,0x00,0x03,0x03,0x02,0x03,0x03,0x03, + 0x01,0x0b,0x42,0x5e,0x56,0x52,0x50,0x53,0x54,0x53,0x53,0x53,0x53,0x53,0x53, + 0x54,0x55,0x55,0x54,0x54,0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x54,0x54, + 0x53,0x53,0x53,0x53,0x55,0x55,0x54,0x53,0x54,0x55,0x54,0x54,0x53,0x53,0x53, + 0x53,0x53,0x53,0x54,0x55,0x57,0x57,0x55,0x54,0x54,0x54,0x54,0x55,0x55,0x56, + 0x56,0x56,0x56,0x55,0x54,0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56, + 0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x56,0x56,0x57,0x57,0x57,0x57,0x57, + 0x58,0x58,0x57,0x57,0x58,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x56,0x55,0xc8,0x31,0x31,0x31,0x31,0x31,0x31,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x33,0x34,0x33,0x33,0x33,0x32,0x32,0x33,0x33,0x34,0x34, + 0x34,0x34,0x34,0x33,0x33,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x35,0x36, + 0x36,0x36,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37, + 0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x36,0x36,0x37,0x38,0x38, + 0x37,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x40,0x3f,0x40,0x41,0x41,0x41,0x41,0x42,0x42,0x41, + 0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x42,0x42,0x42, + 0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x44,0x43,0x44, + 0x45,0x45,0x46,0x45,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x46,0x46,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4d,0x4e,0x4e,0x4e,0x4f, + 0x4f,0x4f,0x4f,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x4f, + 0x4f,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x51,0x51,0x50,0x51,0x51,0x51,0x50, + 0x4f,0x4c,0x53,0x59,0x3c,0x1e,0x08,0x01,0x02,0x01,0x01,0x03,0x03,0x02,0x03, + 0x03,0x03,0x00,0x08,0x3d,0x5b,0x57,0x53,0x51,0x53,0x55,0x54,0x53,0x53,0x53, + 0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x54,0x53,0x53,0x53,0x53,0x54,0x55,0x55, + 0x55,0x55,0x54,0x54,0x55,0x55,0x56,0x56,0x55,0x55,0x55,0x55,0x54,0x54,0x54, + 0x54,0x54,0x53,0x53,0x54,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x56,0x55,0x55, + 0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x56,0x56, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x58,0x57,0x57,0x57,0x58,0x58,0x58,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x58,0x58,0x57, + 0x58,0x58,0x58,0x57,0x57,0x56,0x55,0xc8,0x32,0x32,0x31,0x31,0x30,0x30,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x33,0x33,0x33,0x33,0x33,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3b, + 0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3a,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3f,0x40,0x40, + 0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x43, + 0x43,0x42,0x42,0x43,0x44,0x44,0x44,0x43,0x43,0x44,0x45,0x45,0x45,0x45,0x45, + 0x44,0x43,0x44,0x45,0x46,0x45,0x45,0x44,0x45,0x46,0x46,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x48,0x48,0x49, + 0x49,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4d,0x4e,0x4e, + 0x4f,0x4f,0x50,0x50,0x50,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x4f,0x4f,0x50,0x50,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x53,0x53, + 0x52,0x51,0x50,0x4d,0x55,0x5a,0x3d,0x1e,0x08,0x00,0x00,0x01,0x03,0x04,0x03, + 0x02,0x02,0x03,0x05,0x00,0x06,0x39,0x57,0x58,0x57,0x53,0x55,0x56,0x53,0x53, + 0x53,0x54,0x55,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x54,0x53,0x53,0x54,0x56, + 0x57,0x56,0x56,0x55,0x55,0x56,0x57,0x57,0x57,0x56,0x56,0x55,0x55,0x54,0x55, + 0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x56,0x55,0x56,0x59,0x5a,0x58,0x57, + 0x56,0x55,0x55,0x55,0x55,0x55,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58, + 0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5a, + 0x59,0x59,0x5a,0x5a,0x59,0x58,0x57,0x57,0x57,0xc8,0x32,0x32,0x32,0x31,0x31, + 0x31,0x32,0x32,0x32,0x33,0x32,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x33,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x36,0x37,0x37,0x38,0x38,0x37,0x37,0x37,0x37, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x3a,0x39,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x42,0x41,0x41,0x42,0x42,0x43,0x44,0x44,0x44,0x43,0x43,0x43,0x44, + 0x44,0x44,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x43,0x44,0x44,0x45,0x45, + 0x45,0x45,0x44,0x44,0x44,0x45,0x46,0x46,0x45,0x45,0x45,0x46,0x46,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x46,0x45,0x45,0x45,0x46,0x46,0x46,0x46, + 0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x48,0x48, + 0x48,0x49,0x49,0x49,0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4b,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b, + 0x4c,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4e,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0x50, + 0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x53,0x53,0x52,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x52,0x50,0x4f,0x56,0x5a,0x3d,0x1e,0x08,0x00,0x00,0x01,0x03, + 0x03,0x03,0x02,0x02,0x03,0x04,0x00,0x05,0x36,0x55,0x59,0x56,0x51,0x53,0x54, + 0x53,0x52,0x52,0x54,0x54,0x53,0x53,0x54,0x55,0x55,0x56,0x55,0x54,0x54,0x54, + 0x55,0x56,0x56,0x56,0x55,0x54,0x55,0x56,0x56,0x57,0x56,0x56,0x56,0x55,0x55, + 0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x58,0x57,0x57,0x57,0x57,0x57,0x58,0x59, + 0x58,0x58,0x57,0x56,0x56,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59, + 0x59,0x58,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x59, + 0x59,0x58,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58, + 0x58,0x59,0x59,0x59,0x58,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x58,0x58,0xc8,0x32,0x32,0x32, + 0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x32,0x32,0x33,0x34,0x34,0x34,0x34, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x37, + 0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x43,0x43, + 0x43,0x44,0x44,0x44,0x44,0x43,0x44,0x44,0x45,0x45,0x44,0x44,0x44,0x44,0x44, + 0x45,0x45,0x45,0x45,0x45,0x44,0x45,0x45,0x47,0x47,0x45,0x45,0x45,0x47,0x47, + 0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x46,0x45,0x46,0x47,0x47, + 0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x48,0x48, + 0x48,0x48,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x49,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4a,0x4b,0x4c,0x4c,0x4c,0x4b, + 0x4b,0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e, + 0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x52,0x51, + 0x50,0x50,0x50,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x52,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x52,0x50,0x57,0x5a,0x3d,0x1e,0x07,0x00,0x01, + 0x01,0x02,0x03,0x03,0x02,0x02,0x03,0x03,0x00,0x05,0x32,0x53,0x5b,0x57,0x50, + 0x53,0x55,0x53,0x53,0x52,0x53,0x54,0x53,0x54,0x54,0x55,0x56,0x56,0x56,0x55, + 0x55,0x56,0x57,0x56,0x55,0x55,0x55,0x54,0x55,0x55,0x56,0x56,0x56,0x56,0x56, + 0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x57,0x57,0x57, + 0x57,0x57,0x58,0x59,0x58,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x57,0x58,0x59, + 0x59,0x59,0x59,0x58,0x58,0x58,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x58,0x59, + 0x59,0x59,0x59,0x59,0x58,0x59,0x58,0x59,0x59,0x5a,0x59,0x59,0x59,0x59,0x59, + 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0xc8,0x32, + 0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x33,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a, + 0x39,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40, + 0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45, + 0x44,0x44,0x44,0x44,0x45,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x48,0x47,0x46,0x45,0x45, + 0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x47,0x47, + 0x48,0x48,0x48,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a, + 0x49,0x48,0x48,0x49,0x49,0x4a,0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x4e,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x4f, + 0x50,0x50,0x4f,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53, + 0x52,0x51,0x50,0x50,0x50,0x51,0x53,0x53,0x54,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x54,0x53,0x50,0x57,0x5b,0x3e,0x1f,0x08, + 0x01,0x03,0x02,0x01,0x02,0x02,0x02,0x02,0x03,0x05,0x01,0x06,0x2e,0x4f,0x5f, + 0x5c,0x53,0x57,0x5a,0x57,0x55,0x53,0x54,0x55,0x55,0x54,0x55,0x56,0x57,0x57, + 0x57,0x57,0x57,0x57,0x58,0x57,0x56,0x56,0x55,0x55,0x55,0x56,0x56,0x57,0x57, + 0x57,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x59,0x59,0x58, + 0x58,0x57,0x57,0x57,0x59,0x5a,0x59,0x59,0x58,0x57,0x58,0x59,0x59,0x58,0x58, + 0x58,0x59,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5b,0x5c,0x5b,0x5b,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59, + 0xc8,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x33,0x33,0x32,0x33, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x37, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x37,0x37, + 0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x38,0x38,0x38,0x38,0x39, + 0x3a,0x3a,0x3a,0x38,0x38,0x38,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x40,0x41,0x41,0x41,0x41,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x44,0x44,0x45,0x45,0x44,0x44,0x44,0x45,0x45,0x45,0x46,0x46, + 0x45,0x45,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x46,0x48,0x48,0x46, + 0x46,0x46,0x48,0x48,0x48,0x48,0x48,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49, + 0x4a,0x4a,0x4a,0x49,0x48,0x49,0x4a,0x4a,0x4a,0x49,0x49,0x49,0x4a,0x4b,0x4c, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4d,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4f,0x50,0x4f,0x4f,0x4e,0x4d,0x4d,0x4e,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x50,0x51, + 0x51,0x51,0x51,0x50,0x50,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x52, + 0x52,0x53,0x53,0x52,0x51,0x51,0x51,0x52,0x53,0x54,0x54,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x55,0x54,0x53,0x51,0x58,0x5d,0x41, + 0x20,0x07,0x01,0x04,0x02,0x01,0x02,0x02,0x02,0x02,0x02,0x03,0x00,0x04,0x28, + 0x4a,0x63,0x5e,0x53,0x58,0x5a,0x58,0x56,0x54,0x55,0x56,0x56,0x56,0x56,0x57, + 0x58,0x58,0x57,0x57,0x58,0x58,0x59,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x59, + 0x59,0x58,0x58,0x58,0x57,0x58,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x59, + 0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5b,0x5a, + 0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5a,0x5a,0x5b,0x5c,0x5c,0x5c, + 0x5c,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,0x5b,0x5b,0x5b,0x5a, + 0x5a,0x5a,0xc8,0x32,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x33,0x33,0x33, + 0x32,0x33,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x37,0x37,0x37,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38, + 0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3a,0x3a,0x3b,0x3c, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40, + 0x40,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42, + 0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x45,0x45,0x46, + 0x46,0x47,0x46,0x46,0x46,0x46,0x47,0x46,0x46,0x46,0x46,0x45,0x45,0x46,0x48, + 0x48,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x49,0x49,0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4b,0x4b,0x4a,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x4f,0x4e, + 0x4d,0x4d,0x4c,0x4c,0x4d,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4e,0x4e, + 0x4f,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52, + 0x51,0x51,0x52,0x52,0x52,0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x54,0x54,0x53,0x53, + 0x53,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x54,0x53,0x51,0x59, + 0x5e,0x43,0x24,0x07,0x00,0x04,0x03,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x00, + 0x03,0x22,0x45,0x65,0x61,0x51,0x57,0x59,0x57,0x56,0x55,0x57,0x57,0x57,0x57, + 0x57,0x59,0x59,0x59,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x59,0x59, + 0x59,0x5a,0x5a,0x59,0x59,0x59,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59, + 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5a,0x5a, + 0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c, + 0x5c,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,0x5b,0x5d, + 0x5d,0x5d,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5c,0x5c,0x5d,0x5e,0x5d, + 0x5c,0x5c,0x5c,0x5c,0xc8,0x32,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x34,0x34, + 0x33,0x33,0x33,0x34,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x37,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x39,0x39, + 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3b,0x3b, + 0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x41, + 0x41,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x42,0x42, + 0x42,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x47,0x48,0x48,0x47,0x47,0x47,0x48,0x48,0x47,0x46,0x46,0x46,0x46,0x45, + 0x46,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x48, + 0x48,0x49,0x49,0x49,0x49,0x49,0x4a,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4a,0x4b,0x4a,0x4b,0x4b,0x4a, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4d,0x4e,0x4f, + 0x4f,0x4f,0x4e,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50, + 0x4f,0x4f,0x50,0x50,0x51,0x51,0x52,0x51,0x51,0x50,0x50,0x51,0x51,0x51,0x51, + 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x50,0x51,0x51,0x52,0x52,0x53,0x53,0x53, + 0x53,0x53,0x52,0x52,0x53,0x53,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x54,0x54,0x54,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x55, + 0x54,0x54,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x55,0x53, + 0x52,0x5a,0x60,0x46,0x27,0x09,0x00,0x05,0x03,0x02,0x02,0x02,0x03,0x03,0x03, + 0x03,0x02,0x07,0x20,0x43,0x6a,0x64,0x51,0x56,0x59,0x59,0x59,0x59,0x59,0x58, + 0x58,0x58,0x59,0x59,0x5a,0x5a,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5b,0x5b,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x59, + 0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d, + 0x5c,0x5a,0x59,0x59,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5b,0x5b,0x5b,0x5c,0x5b,0x5b,0x5b,0x5c, + 0x5c,0x5c,0x5c,0x5c,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5c,0x5c,0x5c, + 0x5c,0x5d,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e, + 0x5e,0x5d,0x5c,0x5c,0x5c,0x5c,0xc8,0x32,0x32,0x33,0x34,0x34,0x34,0x34,0x35, + 0x35,0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37, + 0x37,0x37,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x38, + 0x38,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3a, + 0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3d,0x3d,0x3c, + 0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x41,0x41,0x41,0x42,0x41,0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x42,0x42,0x42, + 0x42,0x42,0x42,0x43,0x43,0x42,0x42,0x42,0x42,0x43,0x43,0x44,0x44,0x45,0x45, + 0x45,0x45,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x45,0x45,0x45,0x46,0x46,0x46,0x46, + 0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x47,0x48,0x48,0x48,0x47,0x46,0x47,0x47, + 0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x49,0x49,0x49,0x4a,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4e,0x4d,0x4d,0x4d,0x4e,0x4f,0x4f,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x51,0x51,0x50,0x51,0x51,0x51, + 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x53,0x53, + 0x53,0x53,0x54,0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x55,0x56,0x56,0x55,0x55, + 0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x56,0x55,0x53,0x5a,0x61,0x49,0x2b,0x0a,0x01,0x05,0x03,0x03,0x02,0x02,0x03, + 0x03,0x03,0x04,0x03,0x08,0x1a,0x3d,0x6b,0x65,0x51,0x55,0x59,0x5a,0x5b,0x5b, + 0x5a,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x5a,0x5a,0x5b, + 0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5b,0x5c,0x5d,0x5b,0x5a,0x5a,0x5b, + 0x5d,0x5e,0x5d,0x5b,0x5a,0x5a,0x5b,0x5d,0x5d,0x5d,0x5d,0x5e,0x5d,0x5d,0x5c, + 0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5c,0x5c,0x5b,0x5c,0x5c,0x5c,0x5d, + 0x5d,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5d,0x5d, + 0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5d,0x5e,0x5e,0x5d,0x5d,0x5c,0x5c,0x5c,0xc8,0x33,0x33,0x33,0x34,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x39,0x39,0x38, + 0x38,0x38,0x39,0x3a,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3d, + 0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x42,0x43,0x43,0x43,0x43,0x42,0x41,0x41,0x41,0x41,0x42,0x43, + 0x43,0x43,0x42,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46, + 0x46,0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x46,0x46,0x46,0x46,0x47, + 0x47,0x48,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x47,0x47,0x48,0x49,0x49,0x48,0x48,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4f,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x4f,0x4f,0x4e,0x4f,0x50,0x50,0x50,0x50, + 0x50,0x51,0x51,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x52,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x56,0x55, + 0x54,0x53,0x53,0x54,0x55,0x56,0x57,0x56,0x56,0x54,0x54,0x56,0x56,0x57,0x57, + 0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58, + 0x58,0x58,0x57,0x57,0x54,0x5b,0x62,0x4d,0x2f,0x0a,0x00,0x04,0x03,0x03,0x02, + 0x02,0x02,0x03,0x03,0x03,0x02,0x04,0x0f,0x30,0x65,0x63,0x50,0x55,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5c,0x5c, + 0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5c,0x5a, + 0x5a,0x5b,0x5d,0x5e,0x5e,0x5c,0x5b,0x5b,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f, + 0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5c,0x5c,0x5d,0xc8,0x33,0x34,0x34,0x35, + 0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a, + 0x39,0x39,0x38,0x38,0x39,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3b,0x3c,0x3c,0x3c,0x3d,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f, + 0x40,0x40,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x43,0x43,0x42,0x42,0x43, + 0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46, + 0x47,0x46,0x47,0x46,0x45,0x45,0x45,0x46,0x47,0x47,0x48,0x47,0x47,0x46,0x47, + 0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x49,0x49,0x48,0x48,0x48,0x49,0x4a,0x4a,0x49,0x49,0x4a,0x4b,0x4a, + 0x4a,0x4a,0x4a,0x4b,0x4a,0x4a,0x49,0x4a,0x4a,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b, + 0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x50,0x50,0x51,0x52, + 0x51,0x51,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51, + 0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54, + 0x54,0x54,0x54,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x56, + 0x57,0x56,0x55,0x54,0x54,0x55,0x56,0x57,0x57,0x57,0x56,0x55,0x55,0x56,0x57, + 0x57,0x57,0x57,0x56,0x56,0x56,0x57,0x57,0x58,0x58,0x57,0x57,0x57,0x57,0x57, + 0x57,0x58,0x59,0x59,0x59,0x57,0x56,0x5d,0x62,0x50,0x32,0x0c,0x00,0x03,0x03, + 0x03,0x03,0x02,0x02,0x02,0x03,0x04,0x03,0x03,0x07,0x28,0x62,0x64,0x53,0x58, + 0x5c,0x5c,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5d,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e, + 0x5d,0x5c,0x5c,0x5c,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e, + 0x5d,0x5b,0x5b,0x5c,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5e,0x5e, + 0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60, + 0x60,0x60,0x60,0x5f,0x5f,0x60,0x61,0x61,0x60,0x5f,0x5f,0x5e,0xc8,0x34,0x34, + 0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x39,0x39,0x39, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x44,0x45,0x45,0x45, + 0x45,0x44,0x44,0x44,0x45,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x46,0x46, + 0x46,0x47,0x47,0x47,0x47,0x47,0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x47, + 0x47,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x48,0x48,0x48, + 0x48,0x49,0x48,0x48,0x4a,0x4a,0x49,0x48,0x48,0x4a,0x4b,0x4b,0x4a,0x4a,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4d,0x4e,0x4e,0x4d,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x51,0x51,0x51, + 0x53,0x53,0x53,0x52,0x51,0x51,0x51,0x52,0x53,0x53,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x55, + 0x56,0x56,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x55,0x55,0x55, + 0x55,0x56,0x57,0x57,0x57,0x56,0x56,0x56,0x57,0x57,0x58,0x57,0x57,0x56,0x56, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58, + 0x57,0x57,0x57,0x59,0x5a,0x5a,0x5a,0x58,0x57,0x5e,0x63,0x53,0x35,0x0d,0x00, + 0x03,0x03,0x03,0x03,0x02,0x01,0x02,0x03,0x06,0x04,0x03,0x03,0x23,0x62,0x66, + 0x57,0x5b,0x5e,0x5e,0x5d,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e, + 0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5e,0x5e,0x5f,0x5f,0x5f,0x5e,0x5f,0x60,0x60, + 0x60,0x5f,0x5f,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x60,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x61,0x61,0x61,0x61,0x60,0x60,0x62,0x62,0x63,0x63,0x63,0x62,0x62,0xc8, + 0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x36,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x37,0x37,0x38,0x38,0x38,0x39,0x39,0x39,0x39,0x39,0x39, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c, + 0x3c,0x3c,0x3c,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e, + 0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x43,0x44,0x45,0x45,0x43,0x43, + 0x44,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x43,0x43,0x44,0x45, + 0x45,0x46,0x45,0x45,0x44,0x44,0x45,0x45,0x46,0x46,0x45,0x45,0x46,0x46,0x46, + 0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x47,0x47,0x46,0x47,0x47,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x48, + 0x48,0x48,0x49,0x4a,0x49,0x4a,0x4b,0x4a,0x4a,0x49,0x49,0x4a,0x4b,0x4c,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c, + 0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, + 0x4d,0x4d,0x4e,0x4f,0x4f,0x4e,0x4e,0x4d,0x4c,0x4d,0x4e,0x4f,0x4e,0x4e,0x4f, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x50,0x50,0x50,0x52,0x52,0x52,0x52, + 0x52,0x52,0x53,0x53,0x53,0x52,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53, + 0x52,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x56, + 0x57,0x57,0x57,0x57,0x57,0x56,0x56,0x56,0x56,0x56,0x55,0x55,0x55,0x56,0x56, + 0x56,0x56,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x58,0x57, + 0x57,0x58,0x59,0x59,0x59,0x59,0x58,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x58, + 0x59,0x58,0x58,0x57,0x58,0x59,0x59,0x5a,0x5a,0x58,0x57,0x5e,0x63,0x54,0x36, + 0x0e,0x00,0x02,0x03,0x03,0x03,0x02,0x01,0x02,0x03,0x03,0x03,0x05,0x04,0x24, + 0x65,0x69,0x57,0x58,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d, + 0x5d,0x5d,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x5f,0x5e,0x5d,0x5d,0x5e,0x60,0x61,0x61,0x5e, + 0x5c,0x5e,0x5f,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x61,0x60,0x60,0x60, + 0x60,0x60,0x60,0x5f,0x5f,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61, + 0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x60,0x61,0x62,0x63,0x64,0x64, + 0x63,0xc8,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x36,0x35,0x35,0x35,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x38,0x38,0x39,0x39,0x39,0x39, + 0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3b, + 0x3b,0x3b,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3e,0x3f,0x3f,0x40,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x40, + 0x40,0x40,0x3f,0x3f,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x44,0x45,0x45, + 0x44,0x43,0x44,0x45,0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x45,0x45,0x44,0x44, + 0x44,0x45,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x45,0x46,0x46, + 0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x47,0x47,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4a,0x4a,0x4a,0x4b,0x4b, + 0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4f,0x4e,0x4e, + 0x4e,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e,0x4d,0x4d,0x4e,0x4f,0x4f, + 0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x50,0x50,0x51,0x52, + 0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x52,0x52,0x53,0x53,0x54,0x54,0x54, + 0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56, + 0x57,0x57,0x57,0x57,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x56,0x56, + 0x57,0x57,0x57,0x57,0x56,0x57,0x58,0x58,0x58,0x57,0x57,0x58,0x59,0x5a,0x59, + 0x58,0x57,0x59,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x58,0x58,0x58,0x58,0x59,0x59, + 0x5a,0x5a,0x59,0x59,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x59,0x57,0x5d,0x62, + 0x57,0x3c,0x0e,0x00,0x01,0x02,0x03,0x03,0x02,0x01,0x03,0x03,0x01,0x02,0x04, + 0x04,0x24,0x66,0x6a,0x58,0x58,0x59,0x59,0x5a,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x61,0x61,0x5f,0x5e,0x5e,0x5f,0x61,0x62, + 0x62,0x5f,0x5d,0x5e,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61, + 0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x60,0x5f,0x61,0x62, + 0x64,0x64,0x63,0xc8,0x34,0x34,0x35,0x35,0x36,0x36,0x36,0x35,0x35,0x34,0x35, + 0x36,0x36,0x37,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x44, + 0x44,0x44,0x45,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45, + 0x46,0x46,0x43,0x44,0x47,0x47,0x46,0x45,0x45,0x46,0x46,0x46,0x47,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4a,0x4a,0x4a, + 0x4a,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4b,0x4b,0x4c,0x4c,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4e,0x4d,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50, + 0x50,0x4f,0x4f,0x4e,0x4d,0x4d,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x50,0x50, + 0x51,0x52,0x52,0x51,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54, + 0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x54,0x54,0x56,0x57,0x57,0x56,0x56,0x56, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x55,0x56,0x57,0x57,0x58,0x59,0x58, + 0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x58,0x58,0x58,0x58,0x59,0x5a, + 0x5a,0x59,0x57,0x57,0x59,0x5a,0x59,0x59,0x58,0x58,0x58,0x59,0x59,0x59,0x59, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x59,0x58, + 0x5b,0x5e,0x5d,0x45,0x11,0x00,0x00,0x01,0x02,0x01,0x02,0x03,0x03,0x03,0x04, + 0x02,0x01,0x02,0x23,0x64,0x6b,0x5e,0x5e,0x5d,0x58,0x5a,0x5d,0x5c,0x5b,0x5c, + 0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5e,0x5e,0x5f, + 0x5f,0x5f,0x60,0x60,0x60,0x60,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x60,0x61,0x62, + 0x61,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x61,0x60,0x5f,0x5f,0x5f,0x60,0x61, + 0x61,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x61,0x61,0x61,0x61,0x61, + 0x60,0x5f,0x5e,0x5e,0x5f,0x5f,0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x61, + 0x62,0x62,0x62,0x62,0x62,0xc8,0x34,0x34,0x35,0x36,0x36,0x36,0x36,0x36,0x35, + 0x34,0x35,0x36,0x37,0x38,0x37,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38,0x38, + 0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3d,0x3e,0x3e, + 0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f, + 0x40,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41, + 0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x42,0x42,0x43,0x43,0x43, + 0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x47,0x46,0x42,0x44,0x47,0x47,0x46,0x45,0x46,0x48,0x47,0x46,0x47, + 0x47,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x49, + 0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x49,0x4a,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e, + 0x4d,0x4d,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x50,0x4f,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x51,0x52,0x52,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x54,0x54,0x55, + 0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x55,0x55,0x56,0x57,0x57,0x57, + 0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x56,0x57,0x57,0x58,0x59, + 0x59,0x59,0x59,0x58,0x58,0x58,0x58,0x58,0x59,0x59,0x59,0x58,0x58,0x58,0x58, + 0x59,0x5a,0x5a,0x5a,0x58,0x58,0x5a,0x5a,0x59,0x59,0x58,0x59,0x59,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5c,0x5c,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b, + 0x5a,0x5a,0x5b,0x5e,0x62,0x4c,0x13,0x00,0x01,0x02,0x03,0x01,0x02,0x03,0x03, + 0x03,0x03,0x02,0x01,0x00,0x20,0x63,0x6a,0x5c,0x5e,0x5e,0x5b,0x5c,0x5e,0x5c, + 0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x61,0x60,0x61,0x62,0x61,0x61,0x61, + 0x61,0x62,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x60,0x61,0x62, + 0x62,0x62,0x62,0x62,0x63,0x64,0x64,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x61,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x63, + 0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x63,0x63,0x62,0xc8,0x35,0x35,0x36,0x36,0x36,0x36,0x36, + 0x36,0x36,0x35,0x36,0x36,0x38,0x38,0x37,0x36,0x36,0x37,0x37,0x38,0x38,0x38, + 0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3c,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x44,0x44,0x44,0x44,0x44,0x45,0x46,0x46,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x46,0x46,0x45,0x43,0x45,0x47,0x47,0x46,0x45,0x46,0x48,0x47, + 0x46,0x48,0x47,0x46,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x49,0x49,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4d,0x4c,0x4c,0x4d,0x4e, + 0x4f,0x4f,0x4e,0x4e,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x4f, + 0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51, + 0x50,0x50,0x50,0x50,0x51,0x50,0x50,0x51,0x52,0x52,0x51,0x51,0x51,0x51,0x50, + 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54, + 0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x56,0x57,0x57, + 0x57,0x57,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58, + 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x58,0x59,0x59,0x59, + 0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5c,0x5b,0x5a,0x59,0x59,0x5a,0x5a, + 0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5c,0x5b,0x5a,0x5b,0x5b,0x5c,0x5c, + 0x5c,0x5c,0x5c,0x5b,0x5c,0x5e,0x65,0x52,0x16,0x01,0x03,0x03,0x03,0x00,0x02, + 0x04,0x03,0x01,0x00,0x02,0x04,0x00,0x1c,0x63,0x69,0x5a,0x5c,0x5e,0x60,0x60, + 0x5f,0x5e,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x60,0x60,0x61,0x61,0x61,0x61,0x62,0x62, + 0x61,0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x63,0x63,0x63,0x63,0x64,0x65,0x65,0x63,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x63,0x63,0x63,0x63,0x62,0x63,0x64,0x63,0x62,0x60,0x60,0x61,0x62, + 0x64,0x65,0x65,0x65,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x63,0x62,0x62,0x62, + 0x62,0x63,0x64,0x64,0x63,0x63,0x64,0x64,0x64,0x63,0x62,0x62,0x63,0x63,0x63, + 0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0xc8,0x36,0x36,0x36,0x36,0x37, + 0x37,0x37,0x36,0x36,0x36,0x36,0x37,0x38,0x38,0x37,0x36,0x36,0x36,0x37,0x38, + 0x38,0x39,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3c,0x3c,0x3c,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3c,0x3d,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x3f, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x43,0x43,0x43,0x43,0x43,0x44, + 0x44,0x44,0x44,0x44,0x45,0x44,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x45,0x45,0x46,0x46,0x45,0x45,0x47, + 0x47,0x45,0x45,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x49,0x4a,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4a,0x4a,0x4a,0x4a, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4e,0x4c,0x4d, + 0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50, + 0x50,0x4f,0x4e,0x4e,0x4f,0x50,0x50,0x51,0x52,0x51,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x53,0x52,0x52,0x52, + 0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, + 0x55,0x55,0x55,0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x57,0x57,0x56, + 0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58, + 0x57,0x57,0x58,0x57,0x57,0x57,0x58,0x57,0x58,0x58,0x59,0x59,0x58,0x59,0x5a, + 0x5a,0x5a,0x59,0x59,0x59,0x59,0x5a,0x5b,0x5b,0x5b,0x5d,0x5c,0x5a,0x59,0x59, + 0x59,0x5a,0x5c,0x5d,0x5d,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,0x5b,0x5c, + 0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x6a,0x58,0x1b,0x03,0x03,0x04,0x04, + 0x00,0x03,0x06,0x03,0x00,0x01,0x03,0x07,0x00,0x1c,0x64,0x6d,0x5e,0x5c,0x5e, + 0x61,0x62,0x62,0x5f,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x60,0x60,0x60,0x61,0x61,0x61,0x61,0x60,0x60,0x60,0x60,0x61,0x62, + 0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x64,0x64,0x64,0x64,0x63,0x63,0x63,0x64,0x65,0x63,0x62,0x62,0x62, + 0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x63,0x62,0x62,0x62, + 0x62,0x62,0x63,0x64,0x65,0x65,0x65,0x65,0x63,0x64,0x65,0x65,0x65,0x65,0x65, + 0x64,0x63,0x63,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x64,0x64,0x65, + 0x65,0x65,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0xc8,0x37,0x36,0x36, + 0x36,0x37,0x37,0x37,0x36,0x36,0x36,0x36,0x38,0x39,0x39,0x37,0x36,0x36,0x36, + 0x37,0x38,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3f, + 0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x43,0x43,0x44,0x44,0x44,0x43,0x42, + 0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x43,0x43,0x43, + 0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x46,0x46,0x46,0x45,0x45, + 0x46,0x47,0x47,0x45,0x45,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x49,0x49,0x49,0x49,0x4a,0x4a,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4a,0x4a, + 0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e,0x4f,0x50, + 0x50,0x50,0x50,0x4f,0x4f,0x4e,0x4f,0x50,0x50,0x51,0x52,0x51,0x51,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x52,0x52,0x53,0x53,0x53,0x53,0x52,0x52,0x53,0x53,0x53,0x53,0x53, + 0x54,0x54,0x54,0x54,0x54,0x54,0x53,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x56, + 0x56,0x56,0x56,0x55,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x57, + 0x57,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x58,0x59,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x5a,0x59, + 0x5a,0x5b,0x5b,0x5b,0x5a,0x5a,0x59,0x5a,0x5a,0x5b,0x5c,0x5c,0x5d,0x5c,0x5a, + 0x5a,0x59,0x5a,0x5b,0x5d,0x5e,0x5e,0x5e,0x5d,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c, + 0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x6d,0x5e,0x20,0x06,0x03, + 0x04,0x04,0x01,0x03,0x06,0x02,0x00,0x02,0x04,0x07,0x00,0x1c,0x5f,0x6d,0x65, + 0x5e,0x5c,0x5f,0x62,0x64,0x61,0x5f,0x5f,0x60,0x60,0x60,0x60,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x5f,0x60,0x62,0x61,0x62,0x62,0x62,0x61,0x61,0x61,0x60,0x60,0x60, + 0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x65,0x65,0x65,0x65,0x64,0x62,0x62,0x62, + 0x62,0x63,0x63,0x64,0x65,0x65,0x65,0x64,0x63,0x63,0x63,0x64,0x65,0x64,0x63, + 0x62,0x63,0x63,0x64,0x65,0x65,0x65,0x64,0x64,0x64,0x65,0x64,0x63,0x63,0x63, + 0x64,0x63,0x63,0x62,0x62,0x63,0x64,0x65,0x66,0x65,0x64,0x64,0x65,0x65,0x66, + 0x66,0x66,0x65,0x65,0x64,0x65,0x64,0x65,0x65,0x66,0x67,0x67,0x66,0x66,0x65, + 0x65,0x65,0x66,0x66,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0xc8,0x38, + 0x38,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x38,0x3a,0x39,0x38,0x37, + 0x36,0x36,0x37,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x39,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d, + 0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x43,0x44,0x44,0x45, + 0x44,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47, + 0x47,0x47,0x47,0x47,0x47,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x47, + 0x45,0x45,0x47,0x47,0x46,0x45,0x45,0x47,0x48,0x49,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f, + 0x4f,0x4f,0x50,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4e,0x4e, + 0x50,0x50,0x50,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x51,0x51, + 0x51,0x51,0x51,0x51,0x51,0x52,0x51,0x51,0x51,0x51,0x52,0x53,0x54,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x53, + 0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x55,0x56,0x57,0x57,0x56,0x56, + 0x56,0x57,0x57,0x57,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x58, + 0x58,0x57,0x57,0x57,0x57,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59, + 0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x59,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5c,0x5a,0x5a,0x5a,0x5a,0x5c,0x5c,0x5d,0x5d, + 0x5c,0x5b,0x5a,0x5a,0x5a,0x5c,0x5e,0x5f,0x5f,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d, + 0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5d,0x5b,0x6f,0x62,0x24, + 0x07,0x02,0x03,0x04,0x02,0x03,0x04,0x02,0x00,0x02,0x03,0x03,0x00,0x19,0x53, + 0x69,0x6b,0x62,0x5b,0x5a,0x5e,0x62,0x61,0x60,0x61,0x61,0x61,0x61,0x61,0x61, + 0x60,0x60,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x63,0x62,0x62,0x62,0x61,0x61, + 0x61,0x62,0x62,0x62,0x64,0x63,0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x64,0x64, + 0x63,0x63,0x63,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x63,0x63,0x63,0x63,0x63, + 0x64,0x64,0x64,0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x64,0x64,0x65,0x63,0x62, + 0x63,0x64,0x65,0x65,0x65,0x64,0x64,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x66, + 0x66,0x66,0x66,0x66,0x66,0x66,0x65,0x65,0x65,0x66,0x66,0x67,0x68,0x68,0x68, + 0x68,0x67,0x67,0x67,0x67,0x67,0x67,0x66,0x66,0x65,0x66,0x66,0x66,0x65,0x65, + 0xc8,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x36,0x36,0x36,0x37,0x38,0x3a,0x3a, + 0x38,0x37,0x36,0x36,0x37,0x38,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b, + 0x3b,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x44, + 0x44,0x45,0x45,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x45,0x46,0x47,0x47,0x47,0x47,0x46,0x46,0x47, + 0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x48,0x49,0x4b, + 0x49,0x47,0x46,0x46,0x48,0x48,0x47,0x45,0x46,0x48,0x49,0x4a,0x49,0x49,0x48, + 0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50, + 0x4f,0x4f,0x50,0x50,0x51,0x52,0x52,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x54,0x55, + 0x54,0x54,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x54,0x53,0x54,0x54, + 0x54,0x54,0x54,0x55,0x56,0x55,0x55,0x55,0x56,0x55,0x54,0x55,0x56,0x57,0x57, + 0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x57,0x58, + 0x58,0x59,0x58,0x58,0x57,0x57,0x58,0x58,0x58,0x58,0x57,0x58,0x58,0x59,0x59, + 0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d, + 0x5d,0x5d,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5d,0x5d,0x5c,0x5c,0x5c,0x5d,0x5d, + 0x5d,0x5e,0x5d,0x5c,0x5b,0x5b,0x5c,0x5e,0x5e,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x5e,0x5b,0x70, + 0x65,0x28,0x0a,0x01,0x02,0x03,0x03,0x03,0x03,0x01,0x01,0x03,0x03,0x01,0x00, + 0x15,0x48,0x64,0x6e,0x65,0x5e,0x5d,0x5e,0x5f,0x60,0x61,0x62,0x62,0x62,0x62, + 0x62,0x62,0x61,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x63,0x63,0x63,0x63,0x62, + 0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x65,0x64,0x63,0x63,0x64,0x65,0x65,0x65, + 0x65,0x65,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x64,0x64, + 0x64,0x64,0x65,0x65,0x65,0x64,0x64,0x65,0x65,0x66,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x66,0x66,0x65,0x64,0x66,0x69, + 0x69,0x67,0x66,0x66,0x65,0x66,0x66,0x67,0x68,0x68,0x69,0x69,0x68,0x68,0x69, + 0x69,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x67, + 0x67,0x66,0xc8,0x38,0x38,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x38, + 0x3a,0x3a,0x38,0x37,0x37,0x37,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x40,0x3f,0x3f, + 0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x42,0x42,0x42,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43, + 0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x4b,0x4c,0x4a,0x48,0x47,0x48,0x49,0x48,0x48,0x48,0x48,0x4b,0x4b,0x4a,0x4a, + 0x4a,0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x50,0x4f,0x4f,0x4f,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x54, + 0x55,0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x56,0x55,0x54, + 0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,0x55,0x56,0x57, + 0x57,0x57,0x56,0x56,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x59,0x59,0x59, + 0x58,0x58,0x59,0x59,0x59,0x59,0x59,0x58,0x59,0x59,0x59,0x59,0x58,0x59,0x59, + 0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5c,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x5f,0x5f,0x5f,0x60,0x61,0x62,0x5e, + 0x5c,0x70,0x67,0x2b,0x0b,0x00,0x00,0x03,0x04,0x03,0x01,0x01,0x03,0x04,0x03, + 0x00,0x00,0x12,0x41,0x60,0x70,0x66,0x60,0x62,0x5f,0x5e,0x61,0x62,0x62,0x63, + 0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x64, + 0x64,0x63,0x63,0x64,0x65,0x65,0x66,0x67,0x67,0x65,0x65,0x63,0x63,0x63,0x64, + 0x64,0x65,0x65,0x65,0x65,0x65,0x67,0x66,0x65,0x65,0x65,0x65,0x66,0x66,0x65, + 0x65,0x65,0x65,0x65,0x67,0x67,0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x66,0x66, + 0x66,0x67,0x68,0x68,0x67,0x66,0x65,0x66,0x68,0x69,0x6b,0x6a,0x69,0x66,0x63, + 0x66,0x6d,0x6c,0x69,0x67,0x65,0x65,0x65,0x67,0x69,0x69,0x6a,0x6b,0x6a,0x68, + 0x68,0x69,0x69,0x69,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0xc8,0x38,0x38,0x37,0x37,0x37,0x37,0x38,0x38,0x38,0x38, + 0x38,0x39,0x3a,0x3a,0x39,0x38,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f,0x40, + 0x40,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3f,0x3e,0x3e,0x3d,0x3e,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x48,0x48, + 0x48,0x49,0x4b,0x4c,0x4a,0x48,0x48,0x48,0x49,0x49,0x48,0x49,0x4a,0x4c,0x4c, + 0x4b,0x4a,0x4a,0x4a,0x4a,0x4a,0x49,0x4a,0x4a,0x4b,0x4c,0x4c,0x4d,0x4d,0x4d, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x50,0x50,0x50,0x4f,0x4f,0x4f,0x50, + 0x50,0x51,0x51,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54, + 0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x54,0x54,0x54, + 0x54,0x54,0x55,0x56,0x56,0x55,0x55,0x54,0x55,0x55,0x56,0x56,0x56,0x56,0x57, + 0x56,0x55,0x55,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x59,0x59,0x59,0x59,0x5a, + 0x5a,0x5a,0x59,0x59,0x59,0x59,0x5a,0x5a,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x59, + 0x59,0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,0x5c,0x5c, + 0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5e,0x5e,0x5e,0x5f,0x60,0x60, + 0x60,0x60,0x5f,0x5e,0x5e,0x5f,0x5f,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5e,0x5e, + 0x5e,0x5e,0x5f,0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x62,0x62, + 0x63,0x60,0x5e,0x72,0x69,0x2e,0x0e,0x00,0x00,0x03,0x05,0x03,0x00,0x01,0x03, + 0x04,0x03,0x01,0x00,0x15,0x44,0x63,0x71,0x64,0x5e,0x65,0x64,0x61,0x62,0x63, + 0x63,0x64,0x64,0x65,0x65,0x65,0x64,0x64,0x64,0x64,0x65,0x64,0x63,0x64,0x65, + 0x65,0x65,0x65,0x64,0x64,0x65,0x65,0x65,0x66,0x67,0x67,0x66,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x68,0x67,0x66,0x65,0x65,0x65,0x66, + 0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x68,0x67,0x67,0x67,0x67,0x67,0x68,0x68, + 0x69,0x69,0x69,0x68,0x69,0x69,0x69,0x67,0x67,0x67,0x69,0x6a,0x6b,0x6b,0x6a, + 0x68,0x65,0x68,0x6c,0x6b,0x69,0x68,0x67,0x67,0x67,0x69,0x69,0x6a,0x6a,0x6a, + 0x6a,0x69,0x69,0x69,0x69,0x69,0x69,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x6a,0x69,0x69,0x69,0x69,0xc8,0x38,0x38,0x37,0x37,0x37,0x38,0x38,0x38, + 0x38,0x38,0x39,0x39,0x3a,0x3a,0x39,0x39,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3f,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x4a,0x4a,0x4b,0x49,0x48,0x48,0x49,0x4a,0x49,0x48,0x4b,0x4c, + 0x4c,0x4c,0x4b,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d, + 0x4d,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0x50,0x50,0x4f,0x4f, + 0x4f,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x54, + 0x54,0x55,0x55,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x54, + 0x54,0x54,0x54,0x54,0x55,0x56,0x56,0x56,0x55,0x55,0x56,0x56,0x57,0x57,0x57, + 0x57,0x57,0x57,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x58,0x58,0x59,0x58,0x58,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x59,0x5a,0x5b,0x5b, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d, + 0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60, + 0x61,0x62,0x62,0x61,0x60,0x60,0x60,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x5f, + 0x5f,0x5e,0x5e,0x5e,0x5f,0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x64,0x61,0x5f,0x74,0x6a,0x2f,0x0e,0x01,0x00,0x03,0x04,0x03,0x00, + 0x02,0x03,0x03,0x02,0x01,0x00,0x15,0x42,0x64,0x74,0x62,0x5c,0x66,0x66,0x64, + 0x64,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x65,0x65,0x65,0x65,0x66,0x65,0x65, + 0x66,0x66,0x66,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x67, + 0x67,0x68,0x68,0x68,0x68,0x67,0x67,0x66,0x66,0x67,0x68,0x68,0x66,0x66,0x66, + 0x66,0x67,0x68,0x68,0x68,0x69,0x69,0x69,0x68,0x68,0x69,0x69,0x69,0x68,0x67, + 0x68,0x69,0x6a,0x6a,0x69,0x69,0x69,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a, + 0x6a,0x6a,0x69,0x69,0x69,0x6a,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6a, + 0x6a,0x69,0x69,0x69,0x69,0x6a,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b, + 0x6a,0x69,0x69,0x6a,0x6a,0x69,0x69,0x69,0xc8,0x38,0x38,0x37,0x37,0x37,0x37, + 0x38,0x39,0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3b, + 0x3b,0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x40,0x40,0x40,0x40, + 0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x44,0x44,0x44, + 0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x48,0x48,0x48,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x49,0x48,0x4a,0x4c,0x4b,0x4a,0x49, + 0x4c,0x4c,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4e,0x4e,0x4d,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x50,0x50, + 0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x54,0x55,0x54, + 0x54,0x54,0x54,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55, + 0x55,0x54,0x54,0x54,0x54,0x55,0x56,0x57,0x57,0x56,0x56,0x56,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58, + 0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5a,0x5a,0x5a,0x5b, + 0x5d,0x5c,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5f,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x5f,0x5f,0x5e, + 0x5f,0x61,0x62,0x62,0x62,0x62,0x61,0x61,0x61,0x60,0x5f,0x5f,0x5f,0x60,0x61, + 0x61,0x61,0x60,0x5f,0x5f,0x5f,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x63,0x64,0x62,0x60,0x75,0x6b,0x2e,0x0e,0x01,0x01,0x03,0x03, + 0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x12,0x38,0x5e,0x77,0x63,0x5a,0x63, + 0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x66,0x66,0x66,0x66,0x67, + 0x67,0x67,0x67,0x67,0x67,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x67,0x68, + 0x69,0x69,0x69,0x69,0x6b,0x6b,0x6a,0x69,0x69,0x68,0x67,0x68,0x69,0x69,0x67, + 0x67,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x69,0x69,0x6a,0x6a,0x69, + 0x68,0x68,0x69,0x69,0x6b,0x6b,0x6a,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6a, + 0x69,0x69,0x69,0x69,0x6a,0x6b,0x6a,0x68,0x69,0x69,0x6a,0x6b,0x6c,0x6d,0x6c, + 0x6b,0x6a,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6a,0x6a,0x6a,0x6a,0x6a,0x6b, + 0x6c,0x6c,0x6c,0x6a,0x6a,0x6a,0x6a,0x6b,0x6a,0x6a,0xc8,0x38,0x38,0x37,0x37, + 0x37,0x38,0x39,0x39,0x3a,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3a,0x3a,0x3b,0x3c,0x3c,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f, + 0x3e,0x3e,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x40,0x40,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44, + 0x45,0x45,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4a, + 0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x49,0x4c,0x4d,0x4c, + 0x4a,0x4a,0x4d,0x4e,0x4b,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4d,0x4e,0x4e,0x4e,0x4e,0x4d,0x4d,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x52,0x52,0x52,0x53,0x53,0x54,0x55, + 0x56,0x56,0x55,0x54,0x54,0x54,0x54,0x55,0x55,0x54,0x55,0x55,0x55,0x55,0x55, + 0x56,0x57,0x56,0x56,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x56,0x57,0x57, + 0x57,0x58,0x58,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58, + 0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x59,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5a, + 0x5a,0x5c,0x5e,0x5e,0x5d,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x60,0x60,0x60,0x60,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x61,0x61, + 0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x60,0x5f,0x5f,0x60, + 0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x62,0x62,0x62,0x62, + 0x62,0x63,0x63,0x63,0x63,0x64,0x65,0x62,0x60,0x75,0x6a,0x2b,0x0c,0x01,0x01, + 0x03,0x01,0x01,0x03,0x02,0x02,0x02,0x01,0x01,0x01,0x0c,0x24,0x53,0x79,0x6a, + 0x60,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x66,0x67,0x67,0x67,0x67,0x66,0x66, + 0x67,0x67,0x67,0x66,0x66,0x66,0x66,0x66,0x66,0x67,0x67,0x67,0x67,0x68,0x69, + 0x69,0x6a,0x6a,0x69,0x69,0x69,0x6a,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x69,0x6a,0x6d, + 0x6d,0x6c,0x69,0x68,0x69,0x6a,0x6c,0x6c,0x6a,0x69,0x69,0x69,0x6a,0x6b,0x6c, + 0x6c,0x6b,0x6a,0x6a,0x6a,0x6a,0x6b,0x6c,0x6b,0x69,0x69,0x6b,0x6c,0x6d,0x6d, + 0x6d,0x6c,0x6b,0x6b,0x6a,0x6a,0x6b,0x6d,0x6d,0x6d,0x6d,0x6c,0x6b,0x6b,0x6b, + 0x6b,0x6c,0x6d,0x6d,0x6d,0x6c,0x6b,0x6c,0x6c,0x6d,0x6c,0x6c,0xc8,0x38,0x38, + 0x37,0x37,0x38,0x39,0x39,0x3a,0x3a,0x3a,0x3a,0x3a,0x3b,0x3a,0x3a,0x3a,0x3a, + 0x3b,0x3b,0x3b,0x3b,0x3b,0x3a,0x3a,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f,0x40,0x40, + 0x40,0x40,0x3f,0x3e,0x3e,0x3d,0x3e,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x40,0x40, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42, + 0x42,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46, + 0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4a, + 0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4e, + 0x4f,0x4d,0x4c,0x4b,0x4e,0x4e,0x4c,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4d, + 0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4e,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x51,0x51,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x52, + 0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54, + 0x55,0x56,0x57,0x57,0x56,0x55,0x54,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x57,0x57,0x57,0x57, + 0x57,0x57,0x58,0x59,0x59,0x59,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58, + 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e, + 0x5d,0x5c,0x5b,0x5e,0x5f,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x60,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e,0x5f,0x60, + 0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x61,0x60, + 0x60,0x60,0x61,0x62,0x62,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x63,0x63,0x63, + 0x63,0x63,0x63,0x64,0x64,0x64,0x65,0x65,0x65,0x62,0x5f,0x75,0x6a,0x2a,0x0a, + 0x02,0x02,0x02,0x00,0x01,0x03,0x03,0x02,0x03,0x03,0x03,0x03,0x06,0x0f,0x46, + 0x7b,0x72,0x68,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x67,0x67,0x67, + 0x67,0x67,0x67,0x67,0x67,0x66,0x65,0x65,0x65,0x66,0x66,0x68,0x69,0x69,0x69, + 0x69,0x6a,0x6b,0x6d,0x6c,0x6b,0x69,0x69,0x69,0x68,0x68,0x69,0x69,0x6a,0x6c, + 0x6d,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6a,0x69,0x69,0x69,0x6a,0x6b,0x6b, + 0x6c,0x6e,0x6e,0x6d,0x6a,0x69,0x69,0x6b,0x6d,0x6d,0x6b,0x69,0x69,0x6a,0x6b, + 0x6b,0x6b,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6c,0x6c,0x6c,0x6b,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6c,0x6b,0x6b,0x6c,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6d,0x6c, + 0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0xc8, + 0x38,0x38,0x38,0x39,0x39,0x3a,0x3a,0x39,0x3a,0x3a,0x3a,0x3a,0x3b,0x3c,0x3b, + 0x3a,0x3a,0x3a,0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x40,0x40,0x40, + 0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x47, + 0x47,0x47,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x49,0x4a,0x49, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x4a, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4d,0x4e,0x4e,0x4e,0x4d,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4d,0x4d, + 0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x4f,0x4f,0x4e,0x4f,0x4f, + 0x4f,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x53, + 0x53,0x52,0x52,0x51,0x52,0x52,0x51,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x56,0x56,0x56,0x56,0x55,0x54,0x53, + 0x53,0x54,0x54,0x54,0x56,0x57,0x55,0x55,0x55,0x56,0x57,0x55,0x56,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x59, + 0x58,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x59, + 0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5c,0x5b,0x5a,0x5a,0x5c,0x5c,0x5c,0x5b, + 0x5b,0x5b,0x5c,0x5d,0x5d,0x5d,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x60,0x60,0x5f,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5e,0x5e,0x5f,0x60,0x60,0x60,0x60,0x61,0x61,0x61,0x60,0x5f, + 0x60,0x61,0x62,0x62,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x64, + 0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x64,0x65,0x64,0x64,0x65,0x64,0x64, + 0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x67,0x63,0x62,0x78,0x6d, + 0x2c,0x0d,0x04,0x02,0x01,0x00,0x02,0x05,0x03,0x01,0x03,0x03,0x03,0x02,0x01, + 0x03,0x3f,0x7d,0x72,0x68,0x66,0x65,0x64,0x66,0x68,0x68,0x69,0x69,0x69,0x69, + 0x69,0x68,0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x68,0x68,0x69,0x69,0x69, + 0x69,0x6a,0x6a,0x69,0x6a,0x6c,0x6d,0x6c,0x6c,0x6b,0x6a,0x69,0x69,0x6a,0x6c, + 0x6d,0x6e,0x6e,0x6d,0x6c,0x6c,0x6b,0x6b,0x6b,0x6b,0x6b,0x6a,0x6a,0x6b,0x6b, + 0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6c,0x6b,0x6b,0x6b,0x6c,0x6d,0x6c,0x6b,0x6c, + 0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x70,0x70,0x6f,0x6f,0x6f,0x6e, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x6e,0x6e,0x6e,0x6e, + 0x6e,0xc8,0x38,0x38,0x39,0x3a,0x3a,0x3a,0x3a,0x39,0x39,0x3a,0x3a,0x3a,0x3c, + 0x3d,0x3c,0x3b,0x3a,0x3a,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41, + 0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x42,0x41,0x41,0x41,0x41, + 0x42,0x43,0x43,0x44,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x49, + 0x4a,0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a, + 0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52, + 0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x54,0x55,0x54,0x53,0x54,0x54,0x55,0x55,0x56,0x57,0x57,0x57,0x57, + 0x57,0x55,0x55,0x56,0x54,0x53,0x56,0x57,0x55,0x55,0x56,0x57,0x57,0x55,0x56, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5c,0x5b,0x5c,0x5e,0x5e, + 0x5e,0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x60,0x60,0x60,0x60,0x5f,0x5f,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x62, + 0x62,0x61,0x62,0x62,0x63,0x62,0x61,0x61,0x62,0x62,0x63,0x64,0x64,0x64,0x64, + 0x65,0x65,0x63,0x62,0x64,0x64,0x64,0x63,0x63,0x63,0x64,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x68,0x69,0x65,0x63, + 0x7a,0x70,0x32,0x12,0x06,0x02,0x01,0x00,0x03,0x05,0x03,0x01,0x02,0x02,0x02, + 0x02,0x00,0x00,0x3a,0x7b,0x71,0x68,0x67,0x65,0x65,0x67,0x68,0x69,0x69,0x69, + 0x69,0x69,0x6a,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x69, + 0x69,0x6a,0x6a,0x6b,0x6a,0x69,0x6a,0x6c,0x6d,0x6d,0x6d,0x6d,0x6c,0x6b,0x6b, + 0x6c,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6c,0x6b,0x6c,0x6c,0x6c,0x6c,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6c,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6e,0x6e, + 0x6e,0x6e,0x6e,0x6f,0x6f,0x6e,0x6e,0x6f,0x70,0x70,0x6f,0x70,0x70,0x6f,0x6f, + 0x6f,0x6f,0x6e,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x6f, + 0x6e,0x6e,0x6f,0xc8,0x39,0x39,0x3a,0x3a,0x39,0x39,0x39,0x38,0x38,0x3a,0x3a, + 0x3b,0x3d,0x3d,0x3c,0x3b,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40, + 0x40,0x40,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x47,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x50,0x51,0x51,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54, + 0x54,0x54,0x54,0x54,0x55,0x56,0x55,0x54,0x54,0x54,0x55,0x55,0x55,0x56,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x58, + 0x57,0x57,0x58,0x59,0x58,0x58,0x58,0x59,0x59,0x58,0x58,0x59,0x59,0x59,0x59, + 0x5a,0x5b,0x5b,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5c,0x5c,0x5d,0x5e,0x5e,0x5d,0x5d,0x5c,0x5b,0x5b,0x5c,0x5d, + 0x5e,0x5f,0x5f,0x5e,0x5f,0x5f,0x60,0x60,0x5f,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f, + 0x5f,0x5f,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61, + 0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x63,0x64,0x64,0x64,0x64,0x64, + 0x65,0x65,0x64,0x64,0x64,0x65,0x65,0x64,0x62,0x62,0x63,0x64,0x65,0x65,0x65, + 0x65,0x65,0x66,0x66,0x64,0x63,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66, + 0x66,0x66,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x68,0x68,0x69, + 0x65,0x63,0x7a,0x73,0x3c,0x18,0x05,0x02,0x02,0x00,0x01,0x03,0x02,0x01,0x00, + 0x01,0x01,0x03,0x01,0x00,0x38,0x75,0x71,0x6b,0x6a,0x69,0x69,0x67,0x67,0x69, + 0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6b,0x6b,0x6b,0x6b,0x6b, + 0x6a,0x6a,0x6a,0x6a,0x6c,0x6c,0x6b,0x6b,0x6b,0x6d,0x6d,0x6d,0x6e,0x6e,0x6d, + 0x6d,0x6d,0x6d,0x6c,0x6b,0x6a,0x6b,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x70,0x6f,0x6f,0x6e,0x6e,0x6e,0x6d,0x6d, + 0x6e,0x6e,0x6e,0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70, + 0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x70,0xc8,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a,0x3a, + 0x3a,0x3b,0x3d,0x3e,0x3e,0x3d,0x3c,0x3b,0x3b,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3f,0x40,0x41,0x41,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41, + 0x42,0x42,0x43,0x43,0x42,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43, + 0x43,0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x47, + 0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a, + 0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e,0x4e, + 0x4e,0x4f,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x51, + 0x51,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54, + 0x54,0x55,0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x56,0x56,0x56,0x56,0x56,0x56, + 0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x57,0x57,0x58,0x59,0x57,0x58,0x58, + 0x59,0x59,0x57,0x58,0x59,0x5a,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5c,0x5c,0x5c,0x5b,0x5b,0x5b,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5d,0x5c,0x5b,0x5b, + 0x5c,0x5e,0x5e,0x5f,0x60,0x60,0x61,0x61,0x61,0x60,0x60,0x5e,0x5e,0x5e,0x5f, + 0x60,0x60,0x60,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x64,0x64, + 0x64,0x65,0x65,0x65,0x64,0x64,0x64,0x65,0x65,0x65,0x64,0x64,0x64,0x65,0x65, + 0x66,0x66,0x66,0x65,0x67,0x67,0x65,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x66,0x66,0x66,0x66,0x67,0x68,0x68,0x68,0x68,0x68,0x67,0x67,0x68,0x68,0x69, + 0x69,0x69,0x65,0x63,0x79,0x76,0x46,0x20,0x04,0x01,0x03,0x01,0x01,0x02,0x02, + 0x01,0x00,0x00,0x01,0x04,0x03,0x00,0x33,0x6e,0x72,0x6f,0x6b,0x6a,0x69,0x69, + 0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6c,0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6c,0x6c, + 0x6c,0x6c,0x6b,0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6e,0x6f,0x6f,0x6e,0x6e,0x6e, + 0x6e,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x70,0x6f,0x6f,0x6e,0x6e,0x6f, + 0x70,0x70,0x70,0x70,0x6f,0x6e,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x72,0x71,0x70,0x70,0x70,0x70,0x70,0x70, + 0x71,0x71,0x70,0x70,0x70,0x71,0x72,0x72,0x71,0x70,0x71,0x71,0x71,0x70,0x70, + 0x71,0x71,0x71,0x71,0x71,0x71,0x71,0xc8,0x3a,0x3a,0x3b,0x3b,0x3b,0x3b,0x3b, + 0x3b,0x3b,0x3c,0x3d,0x3d,0x3f,0x3e,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x42,0x43,0x43,0x43,0x43,0x43,0x42,0x41,0x41,0x41,0x42,0x42,0x43,0x43, + 0x44,0x44,0x43,0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51, + 0x51,0x52,0x52,0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53, + 0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54, + 0x54,0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x59,0x59,0x58,0x5a,0x5a,0x59, + 0x59,0x59,0x5a,0x59,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b, + 0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5c,0x5c,0x5c,0x5b,0x5b,0x5c,0x5c,0x5c, + 0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d, + 0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x61,0x61,0x61,0x60,0x5f,0x5e, + 0x60,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x62,0x62,0x63, + 0x63,0x63,0x63,0x65,0x65,0x64,0x63,0x63,0x64,0x65,0x66,0x65,0x65,0x65,0x65, + 0x65,0x66,0x66,0x66,0x66,0x66,0x67,0x67,0x66,0x65,0x66,0x67,0x67,0x66,0x66, + 0x66,0x67,0x67,0x67,0x67,0x67,0x68,0x69,0x68,0x68,0x68,0x68,0x68,0x68,0x68, + 0x69,0x69,0x69,0x6a,0x65,0x62,0x79,0x78,0x4f,0x25,0x03,0x01,0x03,0x02,0x01, + 0x01,0x02,0x02,0x00,0x00,0x00,0x04,0x03,0x00,0x2f,0x67,0x74,0x74,0x6b,0x69, + 0x69,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6c,0x6b,0x6b,0x6c,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6e,0x6e, + 0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6e,0x6f,0x6f,0x6f,0x6f, + 0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x6e, + 0x6e,0x70,0x70,0x71,0x71,0x71,0x70,0x70,0x6f,0x70,0x70,0x71,0x71,0x71,0x72, + 0x72,0x72,0x72,0x72,0x71,0x71,0x71,0x70,0x70,0x73,0x73,0x71,0x70,0x70,0x71, + 0x71,0x70,0x72,0x73,0x70,0x71,0x72,0x74,0x74,0x73,0x73,0x72,0x72,0x72,0x72, + 0x72,0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0xc8,0x39,0x39,0x3a,0x3a,0x3a, + 0x3b,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42,0x42,0x43, + 0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x51,0x51,0x52,0x53,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x52, + 0x53,0x53,0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55, + 0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x57,0x58, + 0x58,0x59,0x59,0x59,0x59,0x58,0x58,0x58,0x58,0x58,0x58,0x5a,0x59,0x59,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b, + 0x5b,0x5c,0x5b,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5d,0x5d,0x5d,0x5c,0x5c,0x5d, + 0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x60,0x60,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x60,0x60,0x61, + 0x60,0x60,0x61,0x62,0x62,0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x64, + 0x65,0x66,0x65,0x65,0x65,0x66,0x67,0x66,0x65,0x65,0x67,0x68,0x67,0x66,0x65, + 0x65,0x65,0x66,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x66,0x67,0x67,0x68,0x68, + 0x68,0x67,0x67,0x67,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x68,0x69,0x68,0x69, + 0x69,0x69,0x69,0x6a,0x6b,0x6c,0x66,0x62,0x79,0x7a,0x52,0x27,0x03,0x01,0x03, + 0x02,0x02,0x02,0x03,0x03,0x01,0x00,0x01,0x04,0x03,0x00,0x2b,0x62,0x79,0x7b, + 0x6a,0x67,0x69,0x6b,0x6d,0x6d,0x6e,0x6f,0x6e,0x6d,0x6d,0x6b,0x6b,0x6b,0x6c, + 0x6d,0x6d,0x6f,0x6f,0x6e,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6e,0x6e, + 0x6f,0x6f,0x6f,0x6e,0x6d,0x6d,0x6d,0x6f,0x70,0x70,0x71,0x72,0x71,0x6f,0x6f, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x6f,0x6e,0x6f,0x70,0x70,0x71,0x72,0x72,0x71,0x70,0x70,0x70,0x71,0x72,0x72, + 0x72,0x73,0x73,0x73,0x74,0x73,0x73,0x72,0x72,0x71,0x71,0x73,0x73,0x72,0x71, + 0x71,0x73,0x72,0x71,0x72,0x73,0x73,0x73,0x74,0x74,0x74,0x73,0x73,0x72,0x72, + 0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0xc8,0x38,0x38,0x39, + 0x3a,0x3a,0x3b,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3c,0x3c, + 0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x42,0x42,0x42,0x42, + 0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x46,0x45, + 0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x47, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x4a,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x51, + 0x51,0x51,0x51,0x51,0x52,0x53,0x53,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x52,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x54,0x55,0x56, + 0x57,0x56,0x55,0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x57, + 0x57,0x57,0x58,0x59,0x5a,0x5a,0x59,0x59,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a, + 0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5c,0x5c,0x5c,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x60,0x60,0x60,0x60,0x60,0x5f,0x5f, + 0x5f,0x5f,0x60,0x61,0x62,0x62,0x60,0x60,0x60,0x5f,0x5f,0x5f,0x5f,0x5f,0x60, + 0x61,0x62,0x62,0x62,0x62,0x63,0x63,0x64,0x64,0x64,0x63,0x62,0x62,0x62,0x62, + 0x62,0x62,0x63,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66, + 0x65,0x65,0x66,0x67,0x66,0x66,0x66,0x67,0x68,0x67,0x66,0x66,0x68,0x69,0x67, + 0x67,0x66,0x66,0x66,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x68, + 0x69,0x69,0x69,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6c,0x6d,0x67,0x62,0x7a,0x7b,0x50,0x25,0x03, + 0x00,0x03,0x02,0x02,0x02,0x03,0x03,0x01,0x01,0x02,0x03,0x01,0x00,0x27,0x5b, + 0x7c,0x81,0x6a,0x67,0x6b,0x6d,0x6d,0x6e,0x70,0x70,0x70,0x6f,0x6d,0x6c,0x6c, + 0x6c,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6e,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x6f, + 0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x6f,0x70,0x70,0x71,0x72,0x72,0x73,0x72, + 0x70,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71, + 0x71,0x71,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x71,0x71,0x70,0x71,0x72, + 0x72,0x72,0x72,0x73,0x73,0x74,0x74,0x74,0x73,0x73,0x73,0x72,0x72,0x74,0x74, + 0x73,0x73,0x73,0x74,0x74,0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x73,0x72, + 0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x74,0xc8,0x39, + 0x3a,0x3a,0x3a,0x3c,0x3c,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,0x3b,0x3c,0x3d,0x3d, + 0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x42, + 0x42,0x43,0x43,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x4a,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x51,0x50,0x50,0x51,0x52,0x52,0x53, + 0x53,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54, + 0x53,0x53,0x53,0x53,0x54,0x55,0x56,0x56,0x55,0x55,0x54,0x54,0x55,0x55,0x56, + 0x57,0x57,0x58,0x57,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59, + 0x59,0x57,0x55,0x55,0x57,0x57,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x61,0x61,0x61,0x61, + 0x61,0x61,0x61,0x61,0x62,0x62,0x63,0x63,0x62,0x62,0x62,0x61,0x61,0x61,0x60, + 0x61,0x61,0x62,0x63,0x63,0x64,0x63,0x63,0x64,0x65,0x65,0x64,0x63,0x63,0x63, + 0x63,0x63,0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x66,0x66,0x65,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x65,0x65,0x66, + 0x67,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x68,0x68,0x68, + 0x69,0x69,0x69,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a,0x69,0x69,0x6a,0x6b,0x6b, + 0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6e,0x68,0x63,0x7c,0x7b,0x4a, + 0x21,0x03,0x00,0x02,0x02,0x02,0x03,0x03,0x03,0x00,0x01,0x03,0x02,0x00,0x00, + 0x22,0x53,0x7e,0x86,0x6a,0x69,0x6e,0x6d,0x6d,0x6f,0x70,0x70,0x70,0x6f,0x6e, + 0x6d,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x6f,0x70,0x70,0x70, + 0x70,0x6f,0x6f,0x6f,0x70,0x71,0x72,0x73,0x73,0x72,0x72,0x71,0x71,0x71,0x71, + 0x71,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x72,0x72, + 0x72,0x73,0x73,0x74,0x73,0x72,0x71,0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x72, + 0x72,0x72,0x72,0x72,0x72,0x72,0x73,0x74,0x74,0x74,0x73,0x73,0x74,0x73,0x73, + 0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x74, + 0x74,0x73,0x72,0x72,0x73,0x74,0x75,0x75,0x74,0x74,0x75,0x75,0x76,0x75,0x74, + 0xc8,0x3b,0x3b,0x3b,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3c,0x3d, + 0x3d,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3f,0x40,0x3f,0x3f, + 0x3f,0x40,0x41,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x41,0x41, + 0x41,0x42,0x43,0x42,0x42,0x42,0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43, + 0x43,0x43,0x43,0x43,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46, + 0x47,0x47,0x47,0x48,0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48, + 0x49,0x48,0x48,0x49,0x48,0x48,0x48,0x49,0x4a,0x4a,0x49,0x49,0x4a,0x4a,0x4a, + 0x4a,0x4a,0x4a,0x49,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4d, + 0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x51,0x52,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55, + 0x55,0x55,0x54,0x54,0x54,0x55,0x56,0x57,0x57,0x57,0x56,0x56,0x55,0x55,0x55, + 0x56,0x57,0x57,0x58,0x58,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x58, + 0x59,0x5a,0x5a,0x58,0x56,0x56,0x57,0x57,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5b, + 0x5c,0x5c,0x5a,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d, + 0x5e,0x5e,0x5d,0x5c,0x5c,0x5d,0x5d,0x5d,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x61,0x61,0x60,0x60,0x61,0x61, + 0x61,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x62,0x63,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x63,0x63,0x64,0x65,0x64,0x64,0x64,0x65,0x65,0x65,0x64, + 0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x66,0x66,0x66,0x66,0x66,0x67,0x68,0x67,0x67,0x66,0x67,0x68,0x68,0x67, + 0x67,0x68,0x69,0x68,0x69,0x69,0x69,0x69,0x68,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x6a,0x6a,0x6b,0x6b,0x6a,0x6a,0x69,0x69,0x6a,0x6b,0x6b,0x6a,0x6b, + 0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x68,0x64,0x7f, + 0x7b,0x44,0x1c,0x03,0x00,0x01,0x01,0x02,0x03,0x03,0x02,0x00,0x02,0x03,0x03, + 0x00,0x00,0x1c,0x46,0x7b,0x86,0x6a,0x6a,0x71,0x6f,0x6e,0x70,0x70,0x71,0x71, + 0x70,0x6f,0x6f,0x6f,0x70,0x70,0x71,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71, + 0x71,0x72,0x71,0x70,0x70,0x70,0x71,0x72,0x74,0x74,0x74,0x74,0x73,0x72,0x71, + 0x71,0x71,0x71,0x70,0x71,0x71,0x71,0x72,0x72,0x72,0x73,0x73,0x73,0x73,0x73, + 0x73,0x73,0x74,0x74,0x74,0x75,0x75,0x74,0x73,0x73,0x73,0x73,0x74,0x74,0x74, + 0x74,0x74,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75, + 0x74,0x74,0x75,0x75,0x74,0x75,0x76,0x77,0x76,0x74,0x74,0x74,0x74,0x74,0x75, + 0x76,0x76,0x75,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x77, + 0x77,0x76,0xc8,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3d,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x40, + 0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42, + 0x42,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44, + 0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f, + 0x4f,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51, + 0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53, + 0x53,0x53,0x54,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x53,0x54, + 0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x56, + 0x56,0x56,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x59,0x59,0x59,0x59, + 0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a, + 0x5b,0x5c,0x5d,0x5d,0x5b,0x5c,0x5d,0x5c,0x5d,0x5e,0x5e,0x5e,0x5d,0x5e,0x5e, + 0x5e,0x5e,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5f, + 0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x60, + 0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x63,0x63,0x63, + 0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x64,0x64,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66, + 0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x69,0x6a,0x6a,0x69,0x69,0x69,0x69,0x6a, + 0x69,0x69,0x69,0x6a,0x6b,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a, + 0x6a,0x69,0x69,0x6b,0x6c,0x6c,0x6c,0x6c,0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c, + 0x6c,0x6d,0x6d,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x69, + 0x65,0x81,0x7b,0x3d,0x17,0x03,0x00,0x01,0x01,0x02,0x03,0x02,0x01,0x00,0x02, + 0x04,0x03,0x00,0x00,0x14,0x38,0x74,0x86,0x6a,0x6c,0x73,0x70,0x6f,0x70,0x71, + 0x72,0x72,0x72,0x70,0x70,0x70,0x71,0x71,0x72,0x72,0x72,0x73,0x73,0x73,0x73, + 0x73,0x73,0x74,0x74,0x74,0x73,0x71,0x71,0x72,0x74,0x74,0x75,0x74,0x74,0x73, + 0x72,0x72,0x72,0x72,0x72,0x72,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x77,0x77,0x76,0x75,0x74,0x75,0x75,0x76, + 0x76,0x76,0x76,0x75,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x75, + 0x76,0x77,0x76,0x75,0x77,0x77,0x76,0x77,0x78,0x78,0x78,0x75,0x76,0x76,0x74, + 0x74,0x75,0x77,0x77,0x76,0x76,0x75,0x74,0x74,0x75,0x75,0x74,0x76,0x77,0x77, + 0x78,0x78,0x78,0x78,0xc8,0x3c,0x3c,0x3c,0x3c,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42, + 0x42,0x42,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x43,0x43, + 0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c, + 0x4b,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f, + 0x50,0x50,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51, + 0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x52,0x52,0x52,0x52,0x52,0x52, + 0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x54,0x55,0x55,0x55,0x55,0x55,0x55, + 0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5c,0x5d,0x5d,0x5d,0x5c,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5e,0x5f,0x60,0x60,0x5f,0x5f,0x5f,0x5f,0x5f,0x5e,0x5e,0x5f, + 0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x61,0x61,0x62,0x62,0x62,0x63,0x62,0x62,0x62,0x62,0x61,0x60,0x61,0x63, + 0x63,0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x66,0x66,0x66,0x66,0x66,0x65,0x65,0x66,0x66,0x66,0x67,0x67, + 0x67,0x67,0x67,0x67,0x67,0x68,0x68,0x68,0x68,0x69,0x69,0x6a,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a, + 0x6b,0x6c,0x6c,0x6b,0x6a,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e, + 0x6f,0x6a,0x67,0x83,0x7c,0x3a,0x15,0x03,0x00,0x01,0x01,0x03,0x03,0x02,0x01, + 0x01,0x02,0x03,0x03,0x01,0x01,0x0c,0x29,0x6d,0x86,0x6d,0x6d,0x72,0x71,0x71, + 0x72,0x73,0x74,0x74,0x73,0x71,0x71,0x71,0x72,0x72,0x72,0x73,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x74,0x74,0x74,0x74,0x75,0x74,0x74, + 0x74,0x73,0x72,0x73,0x74,0x74,0x75,0x75,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x76,0x77,0x77,0x77,0x76,0x76,0x77, + 0x77,0x78,0x78,0x78,0x78,0x77,0x77,0x76,0x76,0x76,0x76,0x76,0x77,0x78,0x78, + 0x78,0x77,0x77,0x78,0x78,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x76,0x77, + 0x77,0x75,0x75,0x77,0x78,0x78,0x78,0x77,0x77,0x77,0x77,0x77,0x76,0x76,0x78, + 0x78,0x78,0x78,0x78,0x78,0x79,0xc8,0x3b,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d, + 0x3d,0x3d,0x3d,0x3d,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x40,0x41,0x42,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42, + 0x43,0x43,0x43,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x43,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a, + 0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4d, + 0x4d,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4f,0x4f,0x4f,0x4e,0x4e,0x4f,0x4f,0x50, + 0x50,0x50,0x50,0x50,0x50,0x4f,0x4f,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51, + 0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x57, + 0x57,0x57,0x57,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x58,0x59,0x59,0x59,0x58,0x57,0x58,0x58,0x59,0x5a,0x59,0x59,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5c,0x5c,0x5b, + 0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5d,0x5d,0x5d,0x5e,0x5f,0x5e,0x5d,0x5e,0x5f, + 0x5f,0x5e,0x5e,0x60,0x5f,0x5e,0x5f,0x60,0x60,0x60,0x60,0x61,0x61,0x61,0x60, + 0x60,0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63, + 0x63,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x62,0x62, + 0x62,0x64,0x64,0x63,0x64,0x65,0x65,0x66,0x66,0x65,0x65,0x65,0x65,0x66,0x66, + 0x66,0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x66,0x66,0x66,0x67,0x68,0x67, + 0x68,0x69,0x69,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6a, + 0x69,0x69,0x69,0x6a,0x6a,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6c, + 0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6d,0x6d, + 0x6d,0x6e,0x6e,0x6f,0x6f,0x6e,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x70, + 0x70,0x70,0x70,0x6b,0x68,0x84,0x7c,0x38,0x13,0x03,0x00,0x01,0x02,0x03,0x03, + 0x02,0x01,0x01,0x02,0x02,0x02,0x02,0x03,0x07,0x1d,0x69,0x87,0x70,0x6d,0x71, + 0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x73,0x72,0x72,0x72,0x72,0x72,0x73,0x74, + 0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x76,0x75,0x75,0x75,0x75,0x75, + 0x75,0x74,0x74,0x74,0x74,0x75,0x76,0x77,0x77,0x77,0x76,0x76,0x76,0x76,0x76, + 0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x77,0x76,0x75,0x76,0x77,0x77,0x77,0x77, + 0x77,0x78,0x78,0x78,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79, + 0x7a,0x7a,0x79,0x78,0x78,0x78,0x78,0x78,0x7b,0x7a,0x79,0x78,0x78,0x78,0x78, + 0x77,0x78,0x78,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x79,0x79,0x79,0x79,0x79,0x79,0xc8,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e, + 0x3f,0x40,0x40,0x40,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f, + 0x3f,0x3f,0x40,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x43, + 0x43,0x43,0x43,0x44,0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a, + 0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f, + 0x4f,0x4f,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x4f,0x4f,0x50, + 0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x54,0x54,0x54,0x55, + 0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x57,0x57,0x57, + 0x58,0x59,0x58,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x56,0x56,0x56,0x57,0x57, + 0x56,0x57,0x58,0x5a,0x5a,0x5b,0x5a,0x5a,0x59,0x59,0x59,0x5a,0x5b,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5c,0x5c, + 0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e,0x5f,0x5e,0x5d, + 0x5f,0x5f,0x5f,0x5d,0x5e,0x60,0x5e,0x5e,0x5f,0x60,0x60,0x60,0x61,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x63,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x64, + 0x64,0x64,0x64,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x65,0x65,0x66,0x66, + 0x67,0x68,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x68,0x68,0x67,0x66,0x66,0x67, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6a,0x6b,0x6c,0x6d, + 0x6d,0x6d,0x6c,0x6c,0x6c,0x6d,0x6d,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e, + 0x6d,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x6f,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x6f, + 0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70, + 0x71,0x71,0x71,0x71,0x71,0x6c,0x68,0x84,0x7d,0x38,0x12,0x03,0x00,0x02,0x03, + 0x03,0x03,0x02,0x01,0x01,0x00,0x00,0x01,0x03,0x04,0x04,0x17,0x68,0x8a,0x75, + 0x70,0x70,0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x73,0x73,0x73,0x73,0x74, + 0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x76,0x75,0x75,0x75, + 0x75,0x76,0x77,0x77,0x77,0x77,0x77,0x78,0x77,0x77,0x75,0x75,0x77,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x77,0x77,0x77,0x77,0x77, + 0x77,0x77,0x77,0x77,0x77,0x76,0x75,0x74,0x76,0x78,0x78,0x78,0x78,0x78,0x78, + 0x79,0x7b,0x7b,0x7b,0x7b,0x79,0x78,0x78,0x78,0x79,0x7b,0x7b,0x7a,0x78,0x78, + 0x78,0x78,0x77,0x78,0x79,0x79,0x7a,0x7a,0x7a,0x79,0x78,0x78,0x79,0x79,0x7a, + 0x7a,0x7b,0x7a,0x79,0x78,0x78,0x78,0x79,0x79,0x79,0xc8,0x3d,0x3d,0x3d,0x3d, + 0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x42,0x42,0x42,0x42,0x43,0x43,0x42, + 0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4a, + 0x4a,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e, + 0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x50,0x50,0x51,0x52,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55, + 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x56,0x57, + 0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x58,0x57,0x57,0x57, + 0x57,0x57,0x58,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d, + 0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x5f, + 0x5e,0x5e,0x5f,0x60,0x5f,0x5e,0x5f,0x60,0x5f,0x5f,0x61,0x62,0x61,0x62,0x62, + 0x62,0x62,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64, + 0x64,0x65,0x64,0x65,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x66,0x65,0x65,0x66, + 0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x6a,0x69,0x6a,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6e,0x6e,0x6f,0x6e,0x6e,0x6e,0x6e,0x6f,0x6f,0x6e,0x6e,0x6e,0x6e,0x6f,0x70, + 0x70,0x70,0x70,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x6f,0x70,0x70, + 0x70,0x71,0x71,0x71,0x71,0x71,0x72,0x6d,0x6a,0x86,0x7d,0x38,0x13,0x03,0x01, + 0x02,0x03,0x04,0x04,0x02,0x00,0x02,0x02,0x02,0x02,0x03,0x03,0x01,0x12,0x64, + 0x8a,0x78,0x73,0x70,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x76,0x76,0x76,0x76,0x76,0x76, + 0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x77,0x77,0x78, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x76,0x78,0x79,0x79,0x79,0x79, + 0x79,0x79,0x7a,0x7b,0x7b,0x7b,0x7a,0x79,0x79,0x78,0x79,0x7a,0x7b,0x7b,0x7a, + 0x79,0x79,0x79,0x78,0x78,0x79,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7a,0x7a,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0xc8,0x3c,0x3c, + 0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3e,0x3e, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x40,0x41,0x41,0x42,0x42,0x42,0x43,0x43, + 0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x47,0x48,0x49,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x49,0x49, + 0x4a,0x4b,0x4b,0x49,0x48,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x54,0x54,0x54,0x55, + 0x55,0x55,0x55,0x54,0x54,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x59, + 0x59,0x59,0x59,0x59,0x5a,0x5a,0x58,0x57,0x57,0x58,0x5a,0x5b,0x5b,0x5b,0x5a, + 0x59,0x57,0x5a,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e, + 0x5e,0x5d,0x5c,0x5c,0x5d,0x5e,0x5e,0x5f,0x61,0x62,0x62,0x61,0x60,0x60,0x5f, + 0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62, + 0x62,0x62,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x62,0x63,0x64,0x64,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66, + 0x66,0x66,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x67,0x69,0x69,0x67,0x65, + 0x65,0x67,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6c,0x6b,0x6b,0x6b,0x6c,0x6c,0x6d,0x6d,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d, + 0x6c,0x6d,0x6d,0x6f,0x6f,0x6f,0x6f,0x6e,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f, + 0x70,0x70,0x70,0x71,0x71,0x70,0x6f,0x6f,0x70,0x70,0x70,0x71,0x72,0x70,0x6f, + 0x6f,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x72,0x6f,0x6d,0x86,0x7d,0x3c,0x15, + 0x03,0x01,0x02,0x02,0x03,0x05,0x01,0x00,0x02,0x03,0x04,0x03,0x03,0x03,0x00, + 0x0f,0x5f,0x87,0x7b,0x74,0x71,0x74,0x77,0x76,0x76,0x76,0x76,0x76,0x76,0x76, + 0x76,0x76,0x76,0x75,0x76,0x76,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x77,0x77, + 0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79,0x79,0x79,0x78,0x78,0x78,0x79, + 0x7a,0x7b,0x7b,0x7b,0x7a,0x7a,0x79,0x7a,0x7a,0x7b,0x7b,0x7a,0x7a,0x7a,0x7a, + 0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x79,0x79,0x79,0x79,0x79,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d,0x7f,0x7f,0x7e,0x7e,0x7d,0x7d,0x7d,0xc8, + 0x3d,0x3d,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3f, + 0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x41,0x42,0x42,0x43, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x45,0x44,0x44,0x44,0x45,0x45, + 0x45,0x45,0x46,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46, + 0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49, + 0x49,0x49,0x4a,0x4b,0x4b,0x4a,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x4f,0x50,0x50,0x50,0x50,0x50,0x51, + 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52,0x51,0x51, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x55,0x55, + 0x55,0x55,0x56,0x56,0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x58,0x57,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x59,0x5a,0x5b,0x5a,0x5a,0x59,0x5a,0x5a,0x5b,0x5c,0x5c, + 0x5c,0x5b,0x5a,0x5a,0x5c,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5e,0x5e,0x5e,0x5f, + 0x5f,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x61,0x60,0x5f,0x5f, + 0x5f,0x60,0x60,0x60,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66, + 0x67,0x68,0x68,0x68,0x67,0x66,0x66,0x66,0x66,0x67,0x67,0x66,0x69,0x69,0x6a, + 0x69,0x67,0x69,0x69,0x6b,0x6b,0x6a,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6b, + 0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6e, + 0x6d,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x71,0x72,0x72,0x72,0x72,0x72,0x72,0x71,0x71,0x71,0x71,0x71,0x72,0x72, + 0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x72,0x73,0x73,0x74,0x6f,0x6c,0x84,0x7f, + 0x48,0x1f,0x03,0x01,0x03,0x00,0x01,0x03,0x01,0x00,0x01,0x03,0x04,0x02,0x01, + 0x04,0x00,0x0c,0x5a,0x82,0x7c,0x77,0x72,0x76,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x77,0x77,0x76,0x75,0x76,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79, + 0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7a,0x7a,0x7a, + 0x7b,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7c,0x7d,0x7d,0x7d, + 0x7d,0x7d,0x7c,0x7b,0x7b,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7d,0x7d,0x7d, + 0x7d,0xc8,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e, + 0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x42, + 0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x45,0x45,0x45,0x44,0x45, + 0x45,0x45,0x45,0x46,0x46,0x46,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49, + 0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4d,0x4d,0x4d,0x4d, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x53, + 0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x56,0x56, + 0x55,0x55,0x56,0x56,0x57,0x56,0x56,0x57,0x56,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x58,0x59,0x59,0x58,0x58,0x58,0x58,0x59,0x58,0x58,0x58,0x59, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c, + 0x5d,0x5d,0x5c,0x5c,0x5c,0x5c,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x5f,0x5f,0x5f,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63, + 0x63,0x62,0x63,0x63,0x64,0x65,0x65,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65, + 0x65,0x65,0x66,0x66,0x67,0x67,0x67,0x66,0x65,0x65,0x65,0x65,0x66,0x66,0x66, + 0x67,0x67,0x68,0x69,0x69,0x69,0x69,0x68,0x68,0x68,0x68,0x69,0x69,0x67,0x69, + 0x69,0x6a,0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6b,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b, + 0x6b,0x6b,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6d, + 0x6d,0x6e,0x6d,0x6e,0x6e,0x6e,0x6f,0x6e,0x6e,0x6e,0x6d,0x6e,0x6f,0x70,0x70, + 0x70,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x72,0x72, + 0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x72,0x72,0x72,0x72, + 0x72,0x72,0x71,0x70,0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x75,0x70,0x6d, + 0x83,0x82,0x57,0x28,0x02,0x01,0x04,0x00,0x00,0x01,0x02,0x02,0x00,0x02,0x04, + 0x01,0x01,0x04,0x00,0x0a,0x52,0x7c,0x7f,0x79,0x72,0x77,0x79,0x78,0x78,0x78, + 0x79,0x79,0x79,0x78,0x78,0x78,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x79,0x79,0x79,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x7a,0x7a,0x7a, + 0x7a,0x7b,0x7b,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c, + 0x7b,0x7c,0x7d,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d, + 0x7e,0x7d,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7d,0x7d,0x7d,0x7d,0x7d, + 0x7d,0x7d,0x7d,0x7d,0x7d,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7d,0x7d, + 0x7d,0x7d,0x7d,0xc8,0x3e,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x3e,0x3e,0x3e,0x3e, + 0x3e,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x40,0x41,0x41,0x41,0x42, + 0x43,0x43,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x46,0x46,0x46, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x49, + 0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4b,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51, + 0x51,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x54,0x54,0x53,0x53,0x53,0x54,0x55,0x55,0x54,0x54,0x54,0x54,0x54,0x56,0x57, + 0x57,0x57,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58, + 0x57,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x59,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d, + 0x5e,0x5e,0x5e,0x5d,0x5d,0x5d,0x5d,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x5f,0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61,0x61, + 0x62,0x62,0x62,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63, + 0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x64,0x64,0x65,0x65, + 0x66,0x65,0x65,0x66,0x66,0x67,0x67,0x68,0x68,0x67,0x67,0x67,0x67,0x67,0x67, + 0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x69, + 0x68,0x68,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6b,0x6a,0x6a,0x6b,0x6c,0x6c, + 0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e, + 0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x70,0x70, + 0x70,0x71,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x72, + 0x72,0x73,0x73,0x73,0x74,0x74,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x72, + 0x71,0x71,0x73,0x74,0x73,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x77, + 0x72,0x6f,0x85,0x86,0x64,0x32,0x03,0x02,0x06,0x03,0x01,0x00,0x03,0x03,0x00, + 0x01,0x03,0x02,0x02,0x03,0x00,0x09,0x49,0x75,0x82,0x7c,0x72,0x76,0x78,0x78, + 0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x79,0x79,0x78,0x79,0x79,0x79,0x79,0x79, + 0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d,0x7c,0x7c,0x7c,0x7d, + 0x7c,0x7b,0x7b,0x7c,0x7e,0x7e,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7e,0x7e,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7e,0x7e,0x7d,0x7d, + 0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f, + 0x7f,0x7e,0x7e,0x7e,0x7e,0xc8,0x3f,0x3f,0x3e,0x3f,0x3f,0x40,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40,0x40,0x40,0x40,0x3f,0x3f,0x40,0x41,0x41, + 0x41,0x42,0x43,0x43,0x43,0x43,0x44,0x45,0x44,0x44,0x44,0x44,0x45,0x45,0x45, + 0x45,0x46,0x46,0x45,0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x47,0x47,0x47, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48, + 0x48,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x4f,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51, + 0x51,0x51,0x51,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x54,0x54,0x54,0x54,0x53,0x53,0x54,0x55,0x56,0x56,0x55,0x55,0x55,0x55,0x56, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59, + 0x59,0x58,0x58,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b, + 0x5b,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x61,0x61,0x61,0x62,0x61,0x61,0x61,0x61, + 0x62,0x62,0x62,0x62,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64, + 0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x66,0x65,0x65,0x65, + 0x65,0x66,0x67,0x67,0x66,0x67,0x67,0x68,0x68,0x69,0x69,0x68,0x68,0x68,0x68, + 0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b, + 0x6c,0x6a,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6d,0x6d,0x6c,0x6c,0x6c,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6f, + 0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x70,0x70,0x70,0x70, + 0x70,0x71,0x71,0x72,0x72,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71, + 0x72,0x72,0x72,0x73,0x73,0x73,0x74,0x74,0x73,0x73,0x73,0x73,0x73,0x73,0x73, + 0x73,0x72,0x72,0x71,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x75,0x74,0x75, + 0x76,0x78,0x73,0x70,0x85,0x88,0x68,0x34,0x02,0x00,0x03,0x04,0x02,0x00,0x02, + 0x03,0x02,0x01,0x01,0x03,0x03,0x03,0x00,0x09,0x43,0x70,0x86,0x7f,0x71,0x77, + 0x7a,0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7a,0x7a,0x7b,0x7a,0x7a,0x7a, + 0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d, + 0x7c,0x7c,0x7b,0x7b,0x7c,0x7d,0x7d,0x7c,0x7c,0x7d,0x7e,0x7e,0x7f,0x7e,0x7d, + 0x7d,0x7e,0x7d,0x7c,0x7c,0x7d,0x7f,0x7f,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0xc8,0x3f,0x3f,0x3f,0x3f,0x40,0x40,0x40, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x41,0x41,0x41,0x42,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48, + 0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x54, + 0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x59,0x59,0x59, + 0x59,0x5a,0x5a,0x59,0x58,0x58,0x58,0x59,0x5a,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c, + 0x5c,0x5d,0x5d,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f, + 0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x64,0x63,0x62,0x62,0x62,0x62,0x62,0x63, + 0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x66, + 0x66,0x66,0x67,0x68,0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6a,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b, + 0x6c,0x6d,0x6d,0x6d,0x6b,0x6a,0x6a,0x6b,0x6c,0x6d,0x6e,0x6e,0x6e,0x6e,0x6d, + 0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x70,0x70, + 0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x70,0x70,0x71,0x72,0x72,0x72,0x71, + 0x71,0x71,0x71,0x72,0x72,0x73,0x73,0x73,0x72,0x72,0x72,0x72,0x72,0x72,0x72, + 0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x73,0x73,0x73, + 0x73,0x73,0x73,0x73,0x73,0x73,0x75,0x76,0x75,0x75,0x75,0x76,0x77,0x77,0x76, + 0x75,0x76,0x77,0x78,0x74,0x70,0x86,0x88,0x68,0x34,0x01,0x00,0x02,0x04,0x03, + 0x00,0x01,0x02,0x03,0x01,0x00,0x04,0x06,0x02,0x00,0x09,0x3f,0x6d,0x89,0x81, + 0x71,0x78,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7c,0x7b,0x7c, + 0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d, + 0x7e,0x7e,0x7e,0x7d,0x7c,0x7c,0x7d,0x7e,0x7f,0x7f,0x7e,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7e,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80, + 0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80, + 0x80,0x80,0x82,0x82,0x81,0x81,0x80,0x80,0x80,0xc8,0x3f,0x3f,0x3f,0x40,0x41, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x41,0x41, + 0x41,0x41,0x41,0x42,0x42,0x43,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x50,0x50, + 0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x50,0x50,0x51,0x51,0x52, + 0x53,0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x54,0x54,0x54,0x54, + 0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x57,0x57,0x57,0x56,0x56,0x56,0x56,0x57, + 0x57,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5c,0x5d,0x5d,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5c,0x5c,0x5c,0x5d,0x5e,0x5d,0x5d,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5e,0x5e,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61, + 0x62,0x62,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x63,0x62,0x63,0x64,0x65,0x64,0x64,0x64,0x64,0x64, + 0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x69,0x69,0x68,0x68,0x68, + 0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6d,0x6d,0x6c,0x6c,0x6c,0x6b,0x6b,0x6b,0x6b, + 0x6c,0x6d,0x6d,0x6d,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x70,0x70, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70, + 0x71,0x71,0x71,0x71,0x71,0x72,0x73,0x73,0x73,0x72,0x72,0x72,0x72,0x72,0x73, + 0x72,0x72,0x72,0x72,0x72,0x73,0x73,0x74,0x74,0x74,0x73,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x75,0x76,0x76,0x75,0x75,0x74,0x74,0x75,0x75,0x76,0x75,0x75, + 0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x77,0x78,0x78,0x77,0x76,0x76,0x78,0x78, + 0x78,0x78,0x77,0x77,0x78,0x78,0x74,0x71,0x86,0x89,0x69,0x35,0x02,0x00,0x02, + 0x03,0x02,0x00,0x00,0x01,0x04,0x02,0x00,0x04,0x06,0x03,0x00,0x09,0x40,0x6e, + 0x8a,0x82,0x72,0x7a,0x7f,0x7d,0x7d,0x7d,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c, + 0x7c,0x7d,0x7d,0x7c,0x7c,0x7b,0x7c,0x7d,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7d, + 0x7b,0x7c,0x7d,0x7c,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7d,0x7d,0x7d,0x7e,0x7e, + 0x7f,0x7f,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x80,0x81,0x80,0x7f,0x7f,0x80, + 0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82, + 0x82,0x82,0x82,0x82,0x82,0x82,0x81,0x81,0x81,0x81,0x81,0x82,0x82,0x82,0x82, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x81,0xc8,0x3f,0x3f,0x40, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x40,0x41,0x41,0x41, + 0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4a,0x4a,0x49,0x49,0x49,0x49, + 0x49,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d, + 0x4e,0x4e,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51, + 0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55, + 0x55,0x56,0x56,0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x59,0x58,0x57,0x57,0x56, + 0x57,0x57,0x58,0x59,0x5a,0x5a,0x59,0x58,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5f,0x60,0x61,0x61,0x60,0x5f,0x5f,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x61,0x62,0x63,0x63,0x63,0x63,0x63,0x63,0x62,0x62,0x63,0x63,0x64,0x65,0x64, + 0x64,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65, + 0x65,0x66,0x66,0x67,0x67,0x68,0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x68, + 0x68,0x68,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x69,0x69, + 0x69,0x69,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x6e,0x6d,0x6d,0x6e,0x70,0x70, + 0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x70,0x70,0x70,0x70,0x70,0x71, + 0x71,0x72,0x72,0x73,0x73,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75, + 0x76,0x76,0x76,0x76,0x77,0x77,0x78,0x78,0x78,0x77,0x76,0x76,0x76,0x77,0x78, + 0x78,0x78,0x78,0x78,0x77,0x77,0x77,0x78,0x78,0x79,0x79,0x78,0x78,0x77,0x78, + 0x78,0x79,0x79,0x79,0x78,0x78,0x78,0x79,0x75,0x73,0x88,0x8a,0x6d,0x38,0x03, + 0x00,0x03,0x02,0x02,0x03,0x01,0x01,0x04,0x02,0x00,0x03,0x05,0x05,0x00,0x09, + 0x42,0x71,0x8a,0x82,0x74,0x7b,0x7f,0x7e,0x7e,0x7e,0x7d,0x7c,0x7b,0x7b,0x7c, + 0x7c,0x7d,0x7e,0x7e,0x7f,0x7e,0x7d,0x7d,0x7d,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7e,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x80,0x81,0x82,0x82,0x82,0x82,0x81,0x80,0x80,0x81,0x82,0x81,0x81, + 0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x82,0x7f,0x80,0x80, + 0x80,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x84,0x84, + 0x84,0x84,0x83,0x83,0x83,0x83,0x84,0x83,0x82,0x82,0x82,0x82,0x82,0x83,0x83, + 0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x83,0x83,0x83,0x82,0x82,0xc8,0x40, + 0x40,0x40,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x41,0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x46,0x46,0x47,0x47,0x48,0x47,0x47,0x47,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4a,0x4a,0x4a, + 0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d, + 0x4d,0x4e,0x4f,0x4f,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50, + 0x50,0x51,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x52,0x52,0x52, + 0x51,0x51,0x51,0x52,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x56,0x56, + 0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x5a,0x59,0x58, + 0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5c,0x5b,0x5b,0x5b,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d, + 0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5e,0x5f,0x5f,0x5f, + 0x5f,0x60,0x61,0x61,0x62,0x62,0x62,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x67,0x67, + 0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x68,0x68, + 0x68,0x68,0x68,0x68,0x69,0x6a,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b, + 0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x70, + 0x70,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x6f,0x6e,0x6e,0x6f, + 0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x73,0x73,0x73,0x73,0x73,0x72,0x72,0x72, + 0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x74,0x74,0x74, + 0x74,0x75,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x76, + 0x76,0x76,0x76,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x79,0x79,0x7a,0x79,0x78,0x78,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x79,0x78, + 0x78,0x78,0x79,0x7a,0x7b,0x7b,0x7b,0x7a,0x7a,0x7b,0x78,0x76,0x88,0x8c,0x76, + 0x40,0x05,0x03,0x07,0x01,0x03,0x06,0x03,0x01,0x03,0x02,0x00,0x00,0x03,0x07, + 0x00,0x07,0x46,0x76,0x8b,0x84,0x76,0x7b,0x7f,0x7e,0x7e,0x7e,0x7d,0x7d,0x7d, + 0x7d,0x7d,0x7e,0x7f,0x7f,0x7f,0x80,0x7f,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x82,0x82,0x81,0x81, + 0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x82,0x81,0x81,0x81,0x81,0x82, + 0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x82,0x82,0x82,0x83,0x83,0x84,0x82,0x81, + 0x81,0x82,0x82,0x82,0x83,0x83,0x83,0x84,0x83,0x83,0x83,0x82,0x82,0x82,0x83, + 0x85,0x85,0x85,0x84,0x84,0x84,0x84,0x84,0x85,0x85,0x84,0x84,0x84,0x84,0x84, + 0x85,0x85,0x85,0x85,0x86,0x86,0x85,0x85,0x85,0x85,0x84,0x84,0x84,0x83,0x83, + 0xc8,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x41,0x41,0x41,0x41,0x42,0x42,0x41, + 0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x44,0x44,0x44,0x44,0x44,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x47,0x48,0x48,0x48,0x47,0x47,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b, + 0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4d,0x4d,0x4d, + 0x4d,0x4d,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x51,0x52,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x53, + 0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x54,0x55,0x55,0x55,0x56,0x56,0x56,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x5a, + 0x5a,0x59,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5b,0x5a,0x5a,0x5b,0x5b,0x5a, + 0x5a,0x5b,0x5c,0x5c,0x5d,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60, + 0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x62,0x62,0x62,0x62,0x62,0x63,0x63, + 0x63,0x63,0x62,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x68,0x68,0x68, + 0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x68,0x68,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6b,0x6c,0x6c,0x6c,0x6c, + 0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6f,0x6e,0x6e,0x6e,0x6e, + 0x6f,0x70,0x70,0x71,0x71,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x70, + 0x70,0x71,0x73,0x73,0x72,0x71,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x75, + 0x75,0x75,0x75,0x76,0x76,0x75,0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x77, + 0x77,0x78,0x77,0x76,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79, + 0x79,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x79,0x79,0x79,0x7a,0x7b,0x7b,0x7c,0x7b, + 0x7b,0x7a,0x79,0x79,0x7a,0x7b,0x7c,0x7d,0x7c,0x7b,0x7b,0x7b,0x79,0x77,0x85, + 0x8a,0x7e,0x45,0x04,0x03,0x06,0x00,0x01,0x05,0x02,0x00,0x02,0x02,0x02,0x00, + 0x02,0x07,0x00,0x07,0x46,0x77,0x8c,0x86,0x78,0x7b,0x7e,0x7e,0x7e,0x7f,0x7e, + 0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x81,0x81,0x81,0x80,0x80,0x80,0x7f,0x7f,0x7f, + 0x7f,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x83, + 0x83,0x83,0x83,0x83,0x83,0x82,0x82,0x82,0x83,0x83,0x83,0x82,0x82,0x82,0x82, + 0x82,0x82,0x83,0x84,0x83,0x83,0x83,0x84,0x84,0x83,0x82,0x82,0x82,0x83,0x84, + 0x83,0x83,0x83,0x83,0x84,0x84,0x84,0x84,0x85,0x86,0x85,0x85,0x85,0x84,0x83, + 0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x84,0x85,0x85,0x85,0x86,0x85, + 0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x85,0x85, + 0x84,0x85,0xc8,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x42,0x42, + 0x42,0x41,0x41,0x41,0x41,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d, + 0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x51,0x52,0x53,0x51,0x50,0x51,0x51,0x51,0x52,0x52,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x56,0x56,0x56,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x5a, + 0x5a,0x5a,0x5a,0x59,0x59,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5b,0x5b,0x5b,0x5c, + 0x5c,0x5b,0x5b,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x61,0x61,0x61,0x61,0x61, + 0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x62,0x62,0x62,0x63, + 0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x64,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x67,0x68,0x69, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x6e, + 0x6e,0x6e,0x6f,0x70,0x70,0x71,0x71,0x71,0x71,0x70,0x71,0x72,0x72,0x73,0x74, + 0x73,0x72,0x71,0x73,0x74,0x74,0x74,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x76, + 0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77, + 0x78,0x78,0x78,0x78,0x78,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79, + 0x79,0x7a,0x7a,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b, + 0x7c,0x7d,0x7d,0x7b,0x7b,0x7a,0x7b,0x7d,0x7e,0x7e,0x7e,0x7d,0x7c,0x7c,0x7a, + 0x78,0x82,0x88,0x85,0x4b,0x03,0x00,0x03,0x00,0x01,0x03,0x00,0x00,0x01,0x03, + 0x03,0x01,0x02,0x06,0x00,0x07,0x45,0x76,0x8d,0x87,0x79,0x7c,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x82,0x82,0x82,0x82,0x81,0x81,0x81,0x81, + 0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x83,0x83,0x83,0x83,0x84,0x84,0x85, + 0x85,0x85,0x85,0x85,0x85,0x85,0x84,0x84,0x83,0x83,0x83,0x83,0x83,0x83,0x82, + 0x82,0x83,0x84,0x84,0x85,0x85,0x84,0x84,0x84,0x85,0x85,0x84,0x84,0x83,0x82, + 0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86, + 0x85,0x84,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x85,0x85,0x86, + 0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x87,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x86,0xc8,0x42,0x42,0x43,0x43,0x43,0x43,0x42,0x41,0x41,0x41, + 0x41,0x42,0x42,0x42,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x45, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x47,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x4f,0x4f,0x50,0x50,0x51, + 0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x53,0x52,0x51,0x52,0x53,0x52,0x52,0x53, + 0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x56,0x56,0x56,0x56, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x59,0x59,0x59, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x5a,0x5a,0x5b,0x5c, + 0x5d,0x5d,0x5d,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5d,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x60,0x61,0x62,0x61,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x63,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66, + 0x66,0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x68,0x67,0x66,0x65,0x66,0x67, + 0x67,0x67,0x67,0x66,0x65,0x66,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6a, + 0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6d,0x6e,0x6e,0x6f, + 0x70,0x70,0x6f,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x71,0x71,0x72,0x74,0x74,0x72, + 0x73,0x74,0x72,0x70,0x70,0x73,0x74,0x74,0x74,0x72,0x73,0x74,0x74,0x74,0x74, + 0x74,0x74,0x75,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x76,0x76, + 0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x79, + 0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c, + 0x7c,0x7c,0x7d,0x7e,0x7f,0x7d,0x7b,0x7b,0x7c,0x7e,0x7f,0x7f,0x7f,0x7e,0x7d, + 0x7d,0x7b,0x7a,0x81,0x87,0x8a,0x4e,0x01,0x00,0x02,0x03,0x03,0x00,0x00,0x00, + 0x01,0x03,0x05,0x03,0x01,0x02,0x00,0x0a,0x44,0x74,0x8e,0x88,0x79,0x7e,0x81, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82, + 0x82,0x82,0x81,0x81,0x82,0x82,0x82,0x83,0x84,0x84,0x85,0x85,0x85,0x84,0x84, + 0x85,0x85,0x85,0x85,0x85,0x85,0x84,0x85,0x86,0x86,0x85,0x85,0x84,0x84,0x85, + 0x85,0x85,0x85,0x86,0x86,0x87,0x86,0x84,0x84,0x84,0x85,0x86,0x86,0x86,0x86, + 0x85,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87, + 0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x88,0x89,0x88,0x88,0x87,0x86, + 0x86,0x88,0x88,0x87,0x87,0x87,0x87,0x88,0x88,0x89,0x88,0x87,0x87,0x87,0x88, + 0x88,0x87,0x87,0x87,0x87,0x87,0xc8,0x44,0x44,0x43,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x44,0x44,0x44,0x44, + 0x45,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x48,0x48, + 0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x49,0x4a,0x4a,0x4a,0x4a,0x4b, + 0x4b,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e, + 0x4e,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x4f,0x50,0x50, + 0x51,0x51,0x51,0x50,0x50,0x50,0x50,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x55,0x55,0x56,0x55,0x56,0x56,0x56,0x56, + 0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x58,0x59,0x59, + 0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5a,0x5a,0x5a,0x5a,0x5b, + 0x5c,0x5d,0x5e,0x5d,0x5d,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5e,0x5e,0x5f,0x61,0x62,0x62,0x62,0x62,0x61,0x62,0x62,0x62,0x63,0x63, + 0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63, + 0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x65,0x66,0x67,0x67,0x67,0x67,0x67, + 0x68,0x68,0x68,0x67,0x67,0x67,0x68,0x68,0x68,0x69,0x69,0x69,0x68,0x67,0x67, + 0x67,0x68,0x68,0x68,0x68,0x67,0x67,0x67,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b, + 0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6d,0x6d, + 0x6e,0x6e,0x6f,0x70,0x6f,0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x6f,0x6f,0x6f, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x74,0x74, + 0x74,0x73,0x74,0x74,0x73,0x71,0x71,0x73,0x74,0x74,0x74,0x73,0x74,0x74,0x74, + 0x74,0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x76,0x76,0x76,0x77,0x77, + 0x77,0x77,0x77,0x77,0x78,0x78,0x77,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79, + 0x79,0x79,0x79,0x79,0x79,0x79,0x7a,0x79,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7c,0x7b,0x7c,0x7c,0x7b,0x7b,0x7c,0x7d, + 0x7d,0x7d,0x7d,0x7d,0x7d,0x7f,0x80,0x7f,0x7d,0x7c,0x7d,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7e,0x7d,0x7c,0x7c,0x81,0x87,0x8d,0x50,0x01,0x00,0x02,0x05,0x03,0x00, + 0x00,0x01,0x01,0x03,0x06,0x03,0x01,0x02,0x00,0x09,0x3e,0x6f,0x90,0x8a,0x7a, + 0x80,0x84,0x84,0x85,0x85,0x84,0x84,0x83,0x82,0x82,0x82,0x82,0x83,0x83,0x82, + 0x83,0x83,0x83,0x82,0x82,0x82,0x82,0x83,0x84,0x85,0x85,0x86,0x86,0x86,0x86, + 0x86,0x86,0x85,0x85,0x85,0x85,0x85,0x85,0x84,0x85,0x87,0x87,0x86,0x85,0x85, + 0x85,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x86,0x85,0x85,0x86,0x86,0x87,0x88, + 0x88,0x87,0x86,0x86,0x86,0x87,0x87,0x88,0x87,0x87,0x87,0x87,0x87,0x87,0x87, + 0x88,0x88,0x89,0x89,0x89,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x89,0x89, + 0x88,0x88,0x88,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x88, + 0x88,0x89,0x8a,0x89,0x88,0x88,0x88,0x88,0xc8,0x45,0x45,0x42,0x41,0x3f,0x41, + 0x42,0x45,0x45,0x45,0x44,0x41,0x40,0x41,0x43,0x43,0x43,0x43,0x44,0x45,0x45, + 0x46,0x45,0x45,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49, + 0x49,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x4b,0x4b,0x4a,0x4a,0x4a, + 0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4e,0x4d,0x4c,0x4c,0x4d,0x4e,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x51,0x52,0x52,0x52,0x51,0x51,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x56,0x57,0x56,0x56,0x56, + 0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5c,0x5c,0x5d, + 0x5d,0x5e,0x5e,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x60, + 0x60,0x61,0x61,0x5f,0x5e,0x5f,0x60,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x65,0x65,0x64,0x64, + 0x65,0x66,0x65,0x65,0x63,0x62,0x62,0x61,0x62,0x62,0x65,0x66,0x68,0x68,0x68, + 0x69,0x69,0x69,0x69,0x69,0x68,0x68,0x68,0x68,0x68,0x69,0x69,0x6a,0x6a,0x6a, + 0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6b,0x6a,0x6b,0x6b,0x6b, + 0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6e,0x6e,0x6f,0x6f,0x70,0x71,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71, + 0x71,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x73,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x75,0x75,0x75,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x76, + 0x76,0x76,0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d,0x7c, + 0x7c,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d, + 0x7d,0x7e,0x7e,0x7e,0x7e,0x7d,0x7d,0x7f,0x81,0x80,0x7f,0x7f,0x7e,0x7f,0x7f, + 0x7f,0x7f,0x7e,0x7d,0x7c,0x7c,0x7f,0x82,0x88,0x8e,0x51,0x01,0x00,0x04,0x03, + 0x01,0x00,0x00,0x01,0x01,0x03,0x04,0x01,0x01,0x06,0x00,0x06,0x35,0x67,0x91, + 0x8c,0x7b,0x82,0x86,0x86,0x86,0x86,0x86,0x85,0x84,0x83,0x82,0x82,0x83,0x85, + 0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x85,0x85,0x85,0x86,0x86,0x86,0x86, + 0x86,0x87,0x87,0x86,0x86,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x87,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x87,0x87,0x87,0x87,0x88, + 0x88,0x89,0x8a,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89, + 0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x89,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x89,0x88,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8b,0x8a,0x8a,0x89,0x89,0x89,0x89,0xc8,0x44,0x44,0x42,0x41, + 0x41,0x42,0x44,0x45,0x45,0x45,0x43,0x42,0x41,0x42,0x43,0x44,0x44,0x44,0x45, + 0x46,0x46,0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x49, + 0x4a,0x4a,0x4a,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b, + 0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4d,0x4d,0x4e, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51, + 0x51,0x50,0x50,0x52,0x52,0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x53,0x53, + 0x54,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x57, + 0x56,0x57,0x57,0x57,0x58,0x58,0x57,0x58,0x59,0x59,0x59,0x59,0x59,0x59,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c, + 0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x60, + 0x60,0x61,0x61,0x62,0x62,0x61,0x60,0x61,0x62,0x62,0x62,0x61,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x64,0x64,0x65,0x66,0x68,0x69, + 0x68,0x67,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a, + 0x6a,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x6e,0x6e,0x6d,0x6d, + 0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x72,0x71,0x71,0x72,0x72,0x72,0x72,0x72, + 0x72,0x72,0x72,0x72,0x71,0x71,0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x76,0x75,0x75,0x75,0x75,0x75,0x76,0x76, + 0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x79,0x79,0x79,0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7e, + 0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7d,0x7e,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x82,0x82,0x81,0x80,0x80, + 0x80,0x81,0x81,0x80,0x80,0x80,0x7f,0x7e,0x7e,0x82,0x89,0x94,0x57,0x03,0x00, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x04,0x00,0x01,0x07,0x01,0x05,0x32, + 0x64,0x92,0x8e,0x7d,0x82,0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x84,0x83,0x84, + 0x85,0x86,0x86,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x87,0x87,0x88,0x88,0x89,0x88,0x87,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x89, + 0x88,0x87,0x86,0x87,0x87,0x87,0x87,0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x88, + 0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x89,0x8a,0x8a,0x8a,0x8b,0x8b, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8b,0x8c,0x8c,0x8b,0x8a,0x8a,0x8a,0x8a,0xc8,0x42,0x42, + 0x42,0x43,0x44,0x45,0x45,0x44,0x43,0x42,0x42,0x43,0x44,0x44,0x44,0x44,0x44, + 0x45,0x45,0x46,0x46,0x46,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x49,0x49, + 0x4a,0x4a,0x4a,0x4b,0x4b,0x4a,0x4a,0x4a,0x4b,0x4b,0x4a,0x4a,0x4a,0x4b,0x4b, + 0x4b,0x4b,0x4b,0x4c,0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4e, + 0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51, + 0x52,0x52,0x52,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53, + 0x53,0x54,0x55,0x54,0x54,0x54,0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x57,0x57, + 0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x59,0x59, + 0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c,0x5c, + 0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x5e,0x5e,0x5f,0x60,0x60,0x60, + 0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66, + 0x66,0x66,0x66,0x65,0x64,0x65,0x65,0x66,0x67,0x68,0x68,0x68,0x68,0x68,0x69, + 0x69,0x69,0x68,0x66,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a, + 0x6a,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e, + 0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x72,0x72,0x72,0x73, + 0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x75,0x75, + 0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77, + 0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79, + 0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7b,0x7b,0x7b,0x7b,0x7c,0x7d, + 0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f, + 0x7f,0x80,0x80,0x7f,0x7f,0x80,0x81,0x81,0x81,0x81,0x80,0x81,0x82,0x82,0x82, + 0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x80,0x7e,0x80,0x89,0x9a,0x5e, + 0x07,0x00,0x00,0x00,0x02,0x03,0x03,0x02,0x01,0x03,0x04,0x00,0x01,0x07,0x02, + 0x06,0x2f,0x62,0x94,0x91,0x7f,0x83,0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x85, + 0x85,0x86,0x86,0x87,0x87,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x88, + 0x88,0x88,0x89,0x89,0x89,0x89,0x8a,0x8a,0x89,0x89,0x88,0x88,0x89,0x89,0x8a, + 0x8a,0x8a,0x8a,0x89,0x88,0x88,0x89,0x89,0x88,0x87,0x87,0x87,0x88,0x89,0x89, + 0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8d,0x8d,0x8c,0x8c,0x8b,0x8b,0x8b,0xc8, + 0x42,0x42,0x43,0x44,0x45,0x46,0x45,0x45,0x43,0x42,0x42,0x44,0x45,0x45,0x45, + 0x44,0x45,0x45,0x45,0x47,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b, + 0x4b,0x4c,0x4b,0x4b,0x4c,0x4c,0x4c,0x4e,0x4e,0x4d,0x4d,0x4d,0x4e,0x4f,0x50, + 0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x51,0x51, + 0x51,0x51,0x52,0x53,0x53,0x52,0x52,0x52,0x52,0x53,0x53,0x54,0x55,0x55,0x55, + 0x54,0x53,0x53,0x54,0x55,0x54,0x54,0x54,0x55,0x56,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5c,0x5d,0x5d,0x5e,0x5d,0x5d,0x5d, + 0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x5e,0x5e,0x5e,0x5f,0x60,0x61, + 0x61,0x61,0x61,0x5f,0x5f,0x60,0x61,0x62,0x63,0x62,0x62,0x63,0x63,0x63,0x63, + 0x62,0x62,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x66,0x66,0x67,0x66,0x66,0x65,0x66,0x67,0x68,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x6a,0x69,0x68,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x69,0x69,0x69, + 0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x72,0x73,0x73,0x73,0x73, + 0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75, + 0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x77,0x77,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79, + 0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7c,0x7d,0x7d, + 0x7d,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x81,0x81,0x80,0x80,0x80,0x7f,0x7f, + 0x7f,0x7f,0x80,0x80,0x81,0x80,0x80,0x80,0x81,0x81,0x82,0x82,0x82,0x81,0x81, + 0x80,0x80,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x83,0x82,0x82,0x81,0x7f,0x88, + 0x9d,0x63,0x0e,0x00,0x00,0x02,0x03,0x04,0x02,0x00,0x01,0x03,0x03,0x00,0x02, + 0x07,0x03,0x06,0x2b,0x5e,0x95,0x94,0x81,0x83,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x87,0x87,0x87,0x87,0x87,0x88,0x88,0x88, + 0x88,0x89,0x8a,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8b,0x8a,0x8a,0x8a,0x8a,0x8a,0x8c,0x8c,0x8c,0x8c,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8d,0x8d, + 0x8c,0x8c,0x8c,0x8c,0x8b,0x8c,0x8c,0x8d,0x8d,0x8e,0x8d,0x8c,0x8b,0x8c,0x8c, + 0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8c,0xc8,0x43,0x43,0x44,0x45,0x45,0x46,0x46,0x45,0x44,0x43,0x44,0x45,0x46, + 0x46,0x45,0x45,0x45,0x45,0x46,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4f,0x4e,0x4e,0x4e, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52, + 0x52,0x51,0x51,0x51,0x52,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x54,0x55,0x56, + 0x57,0x56,0x55,0x53,0x53,0x54,0x55,0x55,0x54,0x54,0x56,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x58,0x57,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5b,0x5b,0x5a,0x5a,0x5b,0x5a,0x5b,0x5b,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x5f,0x5e,0x5e,0x5f,0x61, + 0x61,0x61,0x61,0x61,0x60,0x5f,0x5f,0x60,0x61,0x62,0x63,0x63,0x62,0x63,0x63, + 0x63,0x63,0x63,0x63,0x64,0x65,0x65,0x66,0x66,0x66,0x65,0x65,0x66,0x66,0x65, + 0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x68,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0x69,0x6a,0x69,0x69,0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6a, + 0x69,0x6a,0x6a,0x6a,0x6b,0x6c,0x6b,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e, + 0x6e,0x6e,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x74, + 0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75, + 0x75,0x75,0x76,0x76,0x77,0x78,0x78,0x78,0x78,0x77,0x77,0x77,0x77,0x78,0x78, + 0x78,0x79,0x79,0x79,0x79,0x79,0x79,0x79,0x79,0x7a,0x7a,0x7a,0x79,0x7a,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7c,0x7d,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7e,0x7e, + 0x7e,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x81,0x82,0x82,0x82,0x81,0x81,0x81, + 0x81,0x80,0x7f,0x7f,0x80,0x81,0x81,0x80,0x80,0x80,0x80,0x81,0x82,0x82,0x82, + 0x82,0x81,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x84,0x84,0x83,0x83,0x83,0x83, + 0x80,0x87,0xa0,0x69,0x15,0x01,0x00,0x04,0x05,0x03,0x01,0x00,0x01,0x02,0x03, + 0x01,0x02,0x07,0x03,0x04,0x24,0x58,0x97,0x96,0x82,0x85,0x86,0x86,0x86,0x87, + 0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x89,0x89,0x88,0x88,0x89,0x89,0x88,0x89, + 0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8b,0x8c,0x8d,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,0x8c, + 0x8d,0x8c,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,0x8d,0x8e,0x8f,0x8e,0x8e, + 0x8e,0x8d,0x8d,0xc8,0x45,0x45,0x44,0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x48,0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4c,0x4b, + 0x4b,0x4c,0x4c,0x4d,0x4d,0x4e,0x4f,0x4e,0x4e,0x4d,0x4d,0x4e,0x4f,0x50,0x4f, + 0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52, + 0x53,0x53,0x52,0x51,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55, + 0x56,0x57,0x57,0x57,0x56,0x55,0x54,0x56,0x57,0x56,0x56,0x56,0x56,0x57,0x57, + 0x57,0x57,0x57,0x58,0x59,0x59,0x59,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5c,0x5c,0x5e,0x5e,0x5f,0x60,0x60,0x61,0x61,0x61,0x60,0x5f,0x5e, + 0x60,0x62,0x62,0x62,0x61,0x60,0x60,0x5f,0x5f,0x61,0x62,0x62,0x64,0x63,0x62, + 0x62,0x63,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x66,0x67,0x67,0x66,0x66,0x67, + 0x67,0x66,0x66,0x66,0x66,0x67,0x67,0x68,0x68,0x68,0x69,0x6a,0x69,0x69,0x69, + 0x69,0x68,0x68,0x68,0x68,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6c,0x6c,0x6c, + 0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f, + 0x6f,0x6f,0x6f,0x6f,0x6f,0x6e,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x71,0x71, + 0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x76,0x76, + 0x76,0x76,0x76,0x76,0x76,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7c,0x7c,0x7c,0x7c, + 0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x7f, + 0x7f,0x7f,0x7f,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x81,0x81,0x81, + 0x81,0x82,0x82,0x82,0x80,0x80,0x82,0x82,0x82,0x81,0x80,0x80,0x80,0x81,0x82, + 0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x84, + 0x85,0x86,0x80,0x87,0xa1,0x6e,0x1d,0x05,0x00,0x07,0x05,0x01,0x00,0x00,0x01, + 0x02,0x03,0x01,0x03,0x07,0x02,0x03,0x1d,0x52,0x98,0x98,0x82,0x86,0x89,0x89, + 0x89,0x89,0x89,0x88,0x88,0x88,0x88,0x88,0x89,0x8a,0x89,0x89,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8c,0x8b,0x8b,0x8b, + 0x8b,0x8c,0x8c,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8b,0x8b,0x8c,0x8c,0x8c, + 0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e, + 0x8f,0x8e,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x90, + 0x90,0x8f,0x8f,0x8f,0x8e,0xc8,0x45,0x45,0x45,0x44,0x45,0x45,0x45,0x45,0x46, + 0x46,0x46,0x45,0x45,0x45,0x47,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x50,0x4f,0x4f,0x4e,0x4e,0x4e,0x4f, + 0x50,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52, + 0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x55, + 0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57, + 0x57,0x58,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x59,0x59,0x59,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e, + 0x5f,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5f,0x60,0x61,0x62,0x62,0x63,0x63,0x62, + 0x61,0x60,0x62,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x63,0x64,0x64, + 0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67, + 0x68,0x68,0x68,0x68,0x68,0x67,0x67,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x6a,0x6a,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6c,0x6c, + 0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f, + 0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71, + 0x71,0x71,0x71,0x71,0x71,0x72,0x72,0x71,0x72,0x73,0x74,0x75,0x75,0x75,0x75, + 0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x77,0x77, + 0x77,0x78,0x77,0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x79,0x79, + 0x78,0x78,0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7a,0x7a,0x7a,0x7b,0x7b, + 0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7d, + 0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x81,0x81, + 0x81,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x7f,0x7f,0x80,0x80,0x81,0x82,0x82, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x83,0x82,0x82,0x81,0x82, + 0x82,0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x85,0x85,0x86,0x86,0x86, + 0x85,0x85,0x85,0x86,0x81,0x8a,0xa6,0x74,0x23,0x07,0x00,0x05,0x03,0x00,0x01, + 0x02,0x01,0x02,0x02,0x01,0x03,0x07,0x02,0x02,0x16,0x4c,0x9a,0x99,0x83,0x88, + 0x8b,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8d,0x8d,0x8e,0x8e,0x8f,0x8f, + 0x8e,0x8d,0x8d,0x8d,0x8e,0x8d,0x8d,0x8d,0x8e,0x8d,0x8e,0x8f,0x8e,0x8f,0x90, + 0x90,0x90,0x91,0x90,0x8e,0x8e,0x8e,0x8e,0x8f,0x90,0x90,0x90,0x90,0x8f,0x8e, + 0x8d,0x8d,0x8f,0x90,0x90,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90, + 0x91,0x91,0x91,0x91,0x90,0x90,0x90,0xc8,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x45,0x46,0x47,0x47,0x46,0x45,0x46,0x48,0x48,0x47,0x48,0x48,0x48,0x48,0x48, + 0x48,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x4f,0x4e,0x4e, + 0x4f,0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51, + 0x52,0x53,0x53,0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x54, + 0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x57,0x57, + 0x57,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5f,0x5f,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x62,0x62,0x63,0x64, + 0x64,0x64,0x63,0x62,0x63,0x63,0x62,0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x65, + 0x65,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6a,0x69, + 0x68,0x69,0x6a,0x6a,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6b,0x6b,0x6c,0x6c,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6f,0x70,0x70,0x6f,0x6e,0x6e,0x6e,0x6f, + 0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x73,0x72,0x72,0x72,0x72, + 0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x73,0x73,0x72,0x73,0x74,0x75,0x76,0x76, + 0x76,0x76,0x74,0x74,0x74,0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x77, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x7b, + 0x7a,0x7a,0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x81,0x81,0x81,0x81, + 0x82,0x82,0x82,0x82,0x81,0x81,0x82,0x82,0x82,0x82,0x81,0x82,0x82,0x82,0x82, + 0x82,0x82,0x82,0x82,0x82,0x83,0x84,0x84,0x84,0x85,0x85,0x86,0x85,0x84,0x83, + 0x82,0x83,0x84,0x85,0x86,0x86,0x86,0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86, + 0x86,0x86,0x86,0x85,0x85,0x85,0x81,0x8b,0xaa,0x79,0x27,0x08,0x00,0x03,0x02, + 0x00,0x02,0x03,0x01,0x01,0x02,0x01,0x02,0x06,0x01,0x02,0x10,0x46,0x9c,0x9c, + 0x83,0x89,0x8d,0x8b,0x8b,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b, + 0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f, + 0x8e,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8f,0x8f,0x8e,0x8f,0x8f,0x8f, + 0x8f,0x8f,0x8f,0x8e,0x8e,0x8f,0x8f,0x8f,0x8e,0x8f,0x8f,0x8f,0x90,0x90,0x90, + 0x91,0x91,0x91,0x91,0x91,0x91,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91, + 0x91,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x90,0x90,0x90,0x90,0x90,0x90,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0xc8,0x44,0x44,0x45,0x45,0x45, + 0x45,0x45,0x45,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x4f,0x4e,0x4e, + 0x4e,0x4e,0x50,0x50,0x4f,0x4e,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x51, + 0x52,0x53,0x53,0x53,0x54,0x55,0x55,0x54,0x53,0x53,0x53,0x53,0x54,0x54,0x55, + 0x55,0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x59,0x59, + 0x58,0x58,0x58,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5c,0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x60,0x60,0x61,0x60,0x60,0x60,0x60,0x60,0x61,0x61,0x61,0x61,0x62, + 0x62,0x63,0x64,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x64,0x65,0x66,0x67, + 0x66,0x65,0x65,0x64,0x65,0x65,0x66,0x67,0x67,0x67,0x66,0x66,0x66,0x67,0x67, + 0x68,0x67,0x67,0x69,0x69,0x69,0x6a,0x6a,0x69,0x69,0x6a,0x6a,0x6b,0x6b,0x6c, + 0x6b,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x71,0x70,0x6f,0x70, + 0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x72,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x74,0x74,0x74,0x75, + 0x76,0x77,0x77,0x76,0x74,0x74,0x74,0x76,0x78,0x77,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x79,0x79,0x7a,0x79,0x79,0x79,0x79,0x79,0x7a,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7c, + 0x7c,0x7c,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82, + 0x82,0x82,0x82,0x83,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x84,0x84,0x84, + 0x85,0x85,0x84,0x84,0x84,0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x85,0x84,0x84,0x85,0x86,0x86,0x87,0x86,0x85,0x85,0x85,0x85,0x85,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x82,0x8c,0xae,0x7c,0x28,0x09,0x00, + 0x02,0x03,0x03,0x02,0x02,0x01,0x01,0x01,0x01,0x02,0x05,0x02,0x03,0x0c,0x42, + 0xa0,0xa0,0x84,0x89,0x8c,0x8b,0x8a,0x8a,0x8a,0x8b,0x8b,0x8a,0x8a,0x8a,0x8a, + 0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f,0x8e, + 0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x91,0x91, + 0x90,0x90,0x90,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x8f,0x8f,0x90,0x90,0x8f,0x8f, + 0x90,0x90,0x90,0x90,0x90,0x8f,0x8f,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x91,0x91,0x91,0x91,0x91,0x90,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x91,0x91,0xc8,0x44,0x44,0x45, + 0x46,0x46,0x46,0x46,0x45,0x45,0x46,0x47,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x49,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4d,0x4e,0x4e,0x4e, + 0x4e,0x4e,0x4e,0x4f,0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50, + 0x51,0x52,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x54,0x54,0x53,0x53,0x54,0x54, + 0x55,0x55,0x55,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57, + 0x59,0x5a,0x59,0x58,0x58,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5e,0x5f, + 0x5f,0x5f,0x60,0x60,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x61,0x62,0x62,0x62,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x64,0x64,0x65,0x66, + 0x67,0x67,0x67,0x66,0x65,0x64,0x65,0x66,0x67,0x68,0x68,0x68,0x67,0x68,0x68, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6b,0x6b,0x6b,0x6a,0x6b,0x6b,0x6c, + 0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6f, + 0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x71,0x71, + 0x70,0x71,0x71,0x71,0x71,0x72,0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x77,0x77,0x76,0x76, + 0x76,0x76,0x77,0x78,0x77,0x76,0x75,0x74,0x74,0x77,0x78,0x78,0x78,0x78,0x79, + 0x79,0x79,0x79,0x7a,0x7a,0x7a,0x79,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7d,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80, + 0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82, + 0x82,0x83,0x83,0x83,0x83,0x84,0x84,0x83,0x83,0x84,0x84,0x84,0x84,0x84,0x85, + 0x85,0x85,0x86,0x86,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x87,0x88, + 0x88,0x87,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x87,0x87,0x87,0x87,0x88,0x88,0x89,0x8a,0x82,0x8b,0xae,0x7f,0x2e, + 0x0c,0x00,0x02,0x03,0x04,0x02,0x00,0x01,0x01,0x01,0x01,0x02,0x04,0x02,0x03, + 0x08,0x40,0xa3,0xa2,0x84,0x89,0x8d,0x8c,0x8b,0x8a,0x8b,0x8c,0x8c,0x8b,0x8a, + 0x8a,0x8b,0x8b,0x8d,0x8e,0x8d,0x8e,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f, + 0x8f,0x8f,0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x90,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x92,0x94,0x95,0x95,0x93,0x92,0x91,0x92,0x91,0x91,0x91, + 0x91,0x91,0x92,0x91,0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93,0x93,0xc8,0x44, + 0x44,0x45,0x46,0x47,0x47,0x46,0x45,0x45,0x46,0x47,0x48,0x48,0x48,0x49,0x48, + 0x48,0x49,0x49,0x49,0x4a,0x4a,0x49,0x49,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e, + 0x4f,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51, + 0x51,0x51,0x52,0x53,0x53,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x55, + 0x55,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x57, + 0x57,0x57,0x59,0x5a,0x59,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x60, + 0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63, + 0x63,0x63,0x62,0x62,0x63,0x63,0x64,0x65,0x64,0x64,0x64,0x64,0x64,0x64,0x65, + 0x65,0x65,0x66,0x67,0x67,0x66,0x66,0x65,0x65,0x66,0x67,0x68,0x68,0x68,0x68, + 0x69,0x69,0x6a,0x6b,0x6c,0x6d,0x6b,0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6c,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6f,0x70,0x6f,0x6d,0x6d,0x6c,0x6c,0x6c,0x6d,0x6d, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x72,0x72,0x72,0x72,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x77,0x77,0x78,0x78,0x78, + 0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x79, + 0x79,0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x82,0x82, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x83, + 0x83,0x83,0x83,0x84,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86, + 0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x87, + 0x88,0x89,0x88,0x88,0x87,0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x88, + 0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8a,0x8c,0x8d,0x82,0x89,0xab, + 0x83,0x39,0x10,0x00,0x03,0x05,0x04,0x02,0x00,0x00,0x01,0x01,0x01,0x02,0x03, + 0x02,0x03,0x05,0x3d,0xa7,0xa4,0x84,0x8a,0x8d,0x8d,0x8c,0x8c,0x8c,0x8d,0x8d, + 0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x90,0x90, + 0x90,0x90,0x90,0x8f,0x8f,0x8f,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92, + 0x92,0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x92,0x92,0x93,0x94,0x94,0x93,0x93, + 0x92,0x92,0x91,0x91,0x91,0x92,0x92,0x92,0x91,0x91,0x91,0x91,0x92,0x92,0x92, + 0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93, + 0x93,0x92,0x92,0x92,0x92,0x93,0x93,0x94,0x95,0x95,0x93,0x93,0x93,0x93,0x93, + 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x94,0x94,0x95,0x94,0x94, + 0xc8,0x45,0x45,0x46,0x46,0x47,0x46,0x45,0x46,0x46,0x47,0x48,0x48,0x48,0x48, + 0x49,0x48,0x48,0x49,0x49,0x49,0x4a,0x4b,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f, + 0x50,0x50,0x51,0x51,0x51,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x52,0x51,0x52, + 0x52,0x52,0x51,0x51,0x52,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x56,0x56,0x56, + 0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x58,0x57,0x57,0x57,0x58,0x59,0x5a,0x5a, + 0x5a,0x58,0x57,0x57,0x5a,0x5c,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5c,0x5d,0x5d,0x5c,0x5c,0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x61, + 0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x63,0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x68,0x68,0x68, + 0x68,0x67,0x67,0x68,0x69,0x6b,0x6c,0x6d,0x6c,0x69,0x69,0x6b,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x6e,0x6d,0x6d,0x6d,0x6e, + 0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x70,0x70,0x70,0x70, + 0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x76, + 0x76,0x76,0x76,0x76,0x76,0x75,0x75,0x76,0x76,0x76,0x76,0x77,0x77,0x78,0x78, + 0x78,0x77,0x78,0x78,0x79,0x79,0x79,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79, + 0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x80, + 0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x82,0x82,0x82,0x82,0x82, + 0x82,0x82,0x82,0x82,0x83,0x82,0x83,0x83,0x82,0x83,0x84,0x84,0x85,0x85,0x85, + 0x85,0x85,0x84,0x84,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x87,0x87,0x86,0x86,0x86,0x87,0x88,0x89,0x88,0x88,0x87,0x86,0x87,0x87,0x88, + 0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x89,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x89,0x88, + 0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8d,0x8e,0x82, + 0x87,0xaa,0x88,0x45,0x15,0x00,0x03,0x03,0x02,0x03,0x02,0x00,0x00,0x01,0x00, + 0x01,0x03,0x01,0x02,0x03,0x3d,0xa8,0xa4,0x82,0x8b,0x90,0x8e,0x8d,0x8d,0x8d, + 0x8e,0x8e,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x90,0x90,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x90,0x91,0x91,0x92,0x92,0x93,0x92,0x92,0x91, + 0x92,0x92,0x93,0x93,0x92,0x92,0x94,0x94,0x93,0x93,0x92,0x93,0x94,0x94,0x94, + 0x93,0x92,0x93,0x92,0x92,0x91,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x93, + 0x93,0x92,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, + 0x94,0x94,0x95,0x94,0x94,0x94,0x93,0x93,0x94,0x94,0x95,0x95,0x95,0x94,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x96,0x96, + 0x96,0x95,0xc8,0x45,0x45,0x46,0x46,0x46,0x45,0x45,0x47,0x48,0x48,0x48,0x48, + 0x48,0x48,0x49,0x49,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4d, + 0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f, + 0x50,0x50,0x51,0x52,0x53,0x53,0x53,0x52,0x51,0x51,0x51,0x53,0x53,0x53,0x53, + 0x53,0x53,0x53,0x52,0x52,0x52,0x53,0x53,0x55,0x55,0x56,0x56,0x56,0x56,0x56, + 0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x59,0x59,0x58,0x58,0x58,0x5a,0x5a, + 0x5b,0x5b,0x5b,0x5a,0x57,0x57,0x5a,0x5d,0x5c,0x5b,0x5a,0x5a,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x60,0x60, + 0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62, + 0x62,0x62,0x62,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x68,0x68,0x68,0x67,0x67, + 0x67,0x66,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x67,0x69,0x69,0x69,0x68,0x68, + 0x68,0x68,0x68,0x67,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6b,0x69,0x6a,0x6c,0x6d, + 0x6d,0x6e,0x6e,0x6d,0x6e,0x6e,0x6f,0x6f,0x6f,0x6e,0x6e,0x6e,0x6f,0x6f,0x70, + 0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x6f,0x70,0x70,0x71,0x71,0x71,0x71, + 0x72,0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x76, + 0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x78,0x77,0x77,0x77,0x77,0x77,0x77,0x78, + 0x78,0x78,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x79,0x79,0x78,0x79,0x7a,0x7b, + 0x7b,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7b, + 0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80, + 0x80,0x80,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82, + 0x82,0x83,0x83,0x83,0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x85,0x86,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x87,0x87, + 0x87,0x88,0x88,0x88,0x88,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x89,0x89, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b, + 0x8a,0x8a,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8d, + 0x8d,0x82,0x88,0xa7,0x8d,0x53,0x19,0x00,0x02,0x02,0x00,0x03,0x04,0x01,0x00, + 0x00,0x00,0x00,0x02,0x01,0x03,0x01,0x3a,0xa8,0xa5,0x82,0x8d,0x92,0x91,0x90, + 0x90,0x8f,0x8f,0x8f,0x8f,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f,0x90,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x94,0x94,0x94,0x94, + 0x93,0x92,0x93,0x93,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x93,0x93,0x93,0x94, + 0x94,0x94,0x93,0x92,0x93,0x93,0x92,0x92,0x92,0x93,0x93,0x93,0x93,0x93,0x93, + 0x94,0x94,0x94,0x93,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x94,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x95,0x95,0x95,0x95,0x97,0x97,0x97, + 0x98,0x98,0x98,0x97,0xc8,0x46,0x46,0x45,0x45,0x46,0x46,0x46,0x48,0x48,0x49, + 0x48,0x48,0x48,0x48,0x4a,0x4a,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f,0x50,0x4f, + 0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x51,0x51,0x50,0x51,0x51,0x51,0x52,0x53, + 0x53,0x53,0x53,0x54,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x56,0x56,0x56, + 0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x59,0x58,0x57,0x58,0x59, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x61,0x62,0x62, + 0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67, + 0x66,0x66,0x66,0x66,0x66,0x67,0x68,0x69,0x69,0x69,0x69,0x68,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6c,0x6d,0x6c,0x6b,0x6b, + 0x6b,0x6c,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6d,0x6e,0x6e,0x6e,0x6e,0x6f,0x70, + 0x70,0x71,0x71,0x71,0x70,0x70,0x70,0x70,0x71,0x71,0x72,0x72,0x73,0x74,0x74, + 0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x74,0x74,0x75, + 0x76,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79,0x79,0x78, + 0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x79,0x79,0x7a,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b, + 0x7c,0x7d,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c,0x7d,0x7d,0x7e, + 0x7d,0x7d,0x7e,0x7f,0x7f,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x82, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82, + 0x83,0x83,0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x85,0x85,0x86,0x86,0x86, + 0x87,0x87,0x87,0x88,0x87,0x87,0x87,0x89,0x89,0x88,0x88,0x87,0x87,0x87,0x87, + 0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x8a,0x89,0x89,0x8a,0x8a,0x8a, + 0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8c,0x8a,0x8a,0x8a,0x8b,0x8c,0x8c,0x8c, + 0x8c,0x8c,0x8d,0x8d,0x8d,0x8c,0x8c,0x8c,0x8c,0x8b,0x8a,0x8b,0x8d,0x8d,0x8d, + 0x8d,0x8c,0x8a,0x86,0x8d,0xa3,0x91,0x61,0x20,0x00,0x02,0x02,0x01,0x03,0x04, + 0x03,0x01,0x00,0x01,0x01,0x00,0x01,0x05,0x00,0x36,0xa5,0xa6,0x87,0x8f,0x93, + 0x91,0x91,0x92,0x91,0x91,0x90,0x90,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91, + 0x91,0x91,0x92,0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93,0x93,0x94,0x94,0x94, + 0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x94,0x94,0x94,0x94,0x95,0x95,0x96,0x96, + 0x96,0x96,0x96,0x96,0x96,0x96,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97, + 0x97,0x97,0x96,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x95,0x95, + 0x95,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x97, + 0x98,0x98,0x98,0x98,0x97,0x96,0xc8,0x47,0x47,0x46,0x46,0x46,0x47,0x48,0x48, + 0x49,0x4a,0x49,0x48,0x48,0x48,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4a,0x4b,0x4b, + 0x4c,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x50, + 0x50,0x50,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x51,0x50,0x50,0x51,0x52,0x53, + 0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x56, + 0x56,0x56,0x55,0x56,0x56,0x57,0x57,0x58,0x58,0x57,0x57,0x58,0x59,0x59,0x57, + 0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5b,0x5b,0x5c,0x5d,0x5d,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x60,0x61,0x61, + 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x64,0x64,0x64, + 0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x67,0x67,0x68,0x68,0x67, + 0x68,0x67,0x66,0x67,0x67,0x67,0x67,0x69,0x6a,0x6b,0x6c,0x6b,0x6a,0x69,0x69, + 0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6c,0x6d,0x6d,0x6f,0x70,0x70,0x6f,0x6e,0x6e,0x6e,0x6f,0x6f,0x70, + 0x70,0x71,0x72,0x73,0x73,0x72,0x71,0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x74, + 0x75,0x75,0x75,0x75,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x77,0x77,0x76,0x75, + 0x74,0x76,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7b, + 0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7b,0x7b,0x7b,0x7c,0x7e,0x7e,0x7e, + 0x7d,0x7d,0x7e,0x7f,0x7d,0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x7e,0x7e,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x80,0x81,0x82,0x82,0x82,0x81,0x81,0x80,0x80,0x80,0x80, + 0x81,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x84, + 0x84,0x84,0x85,0x85,0x86,0x86,0x86,0x87,0x87,0x87,0x87,0x87,0x86,0x86,0x86, + 0x87,0x88,0x88,0x89,0x89,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x89,0x89,0x88, + 0x88,0x88,0x88,0x89,0x89,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8a,0x8a,0x8b,0x8a,0x8b,0x8b,0x8a,0x8a,0x8c,0x8c,0x8a, + 0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x8f,0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,0x8d,0x8e, + 0x8f,0x8f,0x8d,0x8d,0x8d,0x88,0x8e,0xa3,0x93,0x67,0x23,0x00,0x03,0x03,0x01, + 0x03,0x03,0x03,0x01,0x00,0x02,0x02,0x00,0x01,0x03,0x00,0x32,0xa2,0xa7,0x8d, + 0x91,0x94,0x92,0x94,0x95,0x94,0x92,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92, + 0x92,0x92,0x92,0x93,0x94,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95, + 0x94,0x94,0x94,0x95,0x95,0x96,0x96,0x97,0x97,0x97,0x97,0x96,0x96,0x96,0x96, + 0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x97,0x95,0x95,0x95,0x95,0x95,0x96,0x97, + 0x98,0x98,0x98,0x98,0x98,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x96,0x96,0x96,0x96,0x97,0x97,0x98,0x98,0x98,0x98, + 0x97,0x96,0x96,0x96,0x97,0x97,0x97,0x97,0x96,0x96,0x96,0x97,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x98,0x97,0x96,0xc8,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x4a,0x4a,0x4b,0x4a,0x4a,0x49,0x49,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x4f,0x4e,0x4e,0x4e,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x53,0x53,0x53,0x53,0x53,0x52,0x52,0x53, + 0x53,0x54,0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x59,0x59,0x59,0x5a, + 0x59,0x59,0x5a,0x5b,0x5c,0x5b,0x5a,0x5a,0x5b,0x5d,0x5d,0x5d,0x5c,0x5b,0x5c, + 0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x62,0x61,0x60,0x60,0x61,0x61, + 0x61,0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x62,0x62,0x63,0x64,0x64,0x65, + 0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x67,0x67,0x68,0x68,0x68,0x69,0x69,0x69, + 0x69,0x69,0x69,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6a, + 0x6a,0x6b,0x6c,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f, + 0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x72,0x72,0x72,0x70,0x70,0x70,0x70,0x70, + 0x70,0x71,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75, + 0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x77,0x77,0x77,0x78,0x78, + 0x77,0x76,0x76,0x78,0x78,0x7a,0x7a,0x79,0x79,0x79,0x79,0x79,0x79,0x7a,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7f,0x7f,0x7e,0x7d,0x7d,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x7f,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x81, + 0x81,0x81,0x81,0x82,0x82,0x82,0x82,0x83,0x84,0x83,0x83,0x82,0x82,0x82,0x82, + 0x82,0x81,0x82,0x84,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x87,0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x89,0x89,0x89,0x87, + 0x87,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8d,0x8c,0x8b,0x8d, + 0x8e,0x8d,0x8c,0x8d,0x8e,0x8d,0x8b,0x8b,0x8d,0x8d,0x8d,0x8a,0x8a,0x8b,0x8e, + 0x8d,0x87,0x88,0x8a,0x8d,0x8f,0x90,0x90,0x90,0x8f,0x8f,0x8f,0x8f,0x8e,0x8e, + 0x8e,0x90,0x91,0x90,0x8f,0x91,0x92,0x8a,0x8d,0xa7,0x95,0x65,0x21,0x00,0x06, + 0x05,0x02,0x03,0x03,0x01,0x01,0x02,0x03,0x03,0x03,0x01,0x00,0x00,0x2d,0x9f, + 0xa9,0x92,0x93,0x94,0x94,0x95,0x95,0x95,0x94,0x93,0x93,0x94,0x94,0x94,0x94, + 0x94,0x95,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x95,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x97,0x97,0x98,0x98,0x98,0x97,0x97,0x97, + 0x97,0x97,0x98,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97,0x97, + 0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x99, + 0x99,0x99,0x99,0x99,0x99,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99, + 0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x97,0x97,0xc8,0x49,0x49,0x48,0x48, + 0x48,0x49,0x4a,0x4a,0x4b,0x4c,0x4b,0x4a,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x4f, + 0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x53,0x53,0x54,0x54,0x54,0x53,0x53, + 0x53,0x53,0x54,0x55,0x54,0x53,0x54,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x5a,0x5a,0x59, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5c,0x5d,0x5c,0x5a,0x5b,0x5b,0x5d,0x5e,0x5e,0x5d, + 0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x62,0x62,0x62,0x61,0x62, + 0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x63,0x64,0x64,0x63,0x63,0x64,0x65, + 0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6b, + 0x6a,0x6a,0x6b,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x71,0x71,0x70,0x71,0x72,0x73,0x73,0x73,0x71,0x70,0x70, + 0x70,0x70,0x72,0x73,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x76,0x77,0x77, + 0x76,0x76,0x76,0x76,0x75,0x75,0x75,0x75,0x75,0x76,0x77,0x78,0x78,0x78,0x77, + 0x78,0x79,0x78,0x77,0x77,0x78,0x7a,0x7b,0x7a,0x79,0x7a,0x7a,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7e,0x80,0x81,0x7f,0x7f,0x7e, + 0x7f,0x7f,0x80,0x7f,0x7f,0x7f,0x7f,0x81,0x80,0x7f,0x7f,0x80,0x80,0x81,0x81, + 0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x83, + 0x83,0x83,0x84,0x83,0x84,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x89,0x89,0x88,0x88,0x88,0x89,0x89, + 0x8a,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b, + 0x8c,0x8b,0x8b,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,0x8c, + 0x8d,0x90,0x8e,0x8a,0x8b,0x8e,0x91,0x91,0x8f,0x90,0x91,0x90,0x90,0x91,0x91, + 0x90,0x8f,0x90,0x91,0x91,0x91,0x91,0x91,0x93,0x8a,0x90,0xac,0x91,0x57,0x1b, + 0x00,0x06,0x05,0x01,0x03,0x03,0x02,0x01,0x02,0x02,0x03,0x03,0x02,0x00,0x00, + 0x2a,0x98,0xa9,0x98,0x95,0x93,0x95,0x95,0x95,0x95,0x95,0x94,0x94,0x95,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x97, + 0x97,0x97,0x96,0x97,0x97,0x96,0x96,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x97, + 0x97,0x98,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x97,0x97,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x99,0x99,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99, + 0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x98,0x98,0x98,0x98,0x98,0x99, + 0x99,0x9a,0x9a,0x99,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x99,0x99,0x99,0x98,0x98,0x98,0x99,0x99,0x98,0x98,0x98,0xc8,0x4a,0x4a, + 0x49,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4c,0x4c,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4f,0x50,0x50,0x50, + 0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x53,0x54,0x55,0x54,0x54, + 0x53,0x53,0x53,0x53,0x55,0x56,0x55,0x54,0x55,0x55,0x56,0x57,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x59,0x59,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5d,0x5c,0x5b,0x5b,0x5c,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x61,0x62,0x62, + 0x62,0x62,0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62,0x63,0x65,0x65,0x64,0x65, + 0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6c, + 0x6c,0x6b,0x6b,0x6b,0x6c,0x6d,0x6f,0x6f,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x70, + 0x70,0x70,0x71,0x71,0x71,0x71,0x72,0x72,0x71,0x72,0x72,0x73,0x73,0x73,0x72, + 0x71,0x70,0x70,0x71,0x73,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x77, + 0x78,0x78,0x77,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x78,0x79,0x79, + 0x78,0x77,0x79,0x7a,0x78,0x78,0x78,0x7a,0x7b,0x7b,0x7a,0x79,0x7a,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7e,0x7f,0x81,0x82,0x80, + 0x7f,0x7f,0x7f,0x80,0x80,0x80,0x7f,0x7f,0x80,0x81,0x81,0x81,0x81,0x81,0x81, + 0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x84, + 0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x89,0x89,0x88,0x88,0x88, + 0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8b,0x8c,0x8c,0x8c,0x8c,0x8b,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8e,0x90,0x8d,0x8d,0x8f,0x8f,0x8f,0x8d,0x8d,0x90,0x8e,0x8d,0x8d,0x8e, + 0x8e,0x8e,0x8e,0x8f,0x8f,0x8e,0x90,0x92,0x95,0x93,0x8d,0x8f,0x91,0x91,0x91, + 0x91,0x92,0x91,0x90,0x91,0x91,0x93,0x93,0x92,0x91,0x91,0x8a,0x92,0xb1,0x8d, + 0x48,0x15,0x00,0x05,0x04,0x01,0x02,0x03,0x02,0x02,0x01,0x00,0x01,0x03,0x03, + 0x03,0x00,0x28,0x91,0xa8,0x9f,0x95,0x91,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x96,0x95,0x95,0x95,0x95,0x95,0x96,0x97, + 0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x97,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x98,0x98,0x98,0x99,0x99,0x99, + 0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x98,0x98,0x98,0x99, + 0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x99,0x99,0x99,0x99,0x99,0x99,0x99, + 0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9a,0x99,0x98,0xc8, + 0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x50,0x50, + 0x51,0x52,0x52,0x51,0x51,0x51,0x52,0x53,0x53,0x53,0x52,0x52,0x53,0x53,0x54, + 0x54,0x54,0x53,0x53,0x53,0x54,0x55,0x56,0x55,0x55,0x55,0x56,0x57,0x57,0x57, + 0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5a,0x5a,0x5b,0x5d,0x5d,0x5c,0x5c,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x60,0x60,0x61,0x61,0x61,0x61,0x61,0x60,0x60,0x60,0x61, + 0x62,0x62,0x62,0x62,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x64,0x65,0x65, + 0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x69, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6d,0x6e,0x6f,0x70,0x70, + 0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x71,0x71,0x72,0x72,0x72,0x73,0x73, + 0x73,0x72,0x71,0x71,0x71,0x72,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75, + 0x76,0x77,0x78,0x78,0x77,0x76,0x76,0x77,0x77,0x78,0x78,0x78,0x78,0x79,0x7a, + 0x7b,0x7b,0x79,0x78,0x7a,0x7b,0x7a,0x78,0x78,0x7b,0x7c,0x7c,0x7b,0x7a,0x7b, + 0x7c,0x7d,0x7d,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x81, + 0x81,0x80,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x7f,0x7f,0x80,0x81,0x82,0x82,0x82, + 0x82,0x82,0x82,0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84, + 0x84,0x85,0x86,0x86,0x86,0x86,0x87,0x87,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x87,0x86,0x87,0x87,0x88,0x89,0x89,0x89,0x8a,0x8a,0x89,0x88, + 0x89,0x89,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8c,0x8d,0x8d,0x8d,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8e,0x8f,0x8d,0x8d,0x8f,0x90,0x8d,0x8d,0x8e,0x91,0x90,0x8d,0x8f,0x91, + 0x90,0x90,0x91,0x91,0x90,0x8d,0x8d,0x8f,0x91,0x91,0x93,0x91,0x8e,0x90,0x92, + 0x91,0x92,0x93,0x93,0x93,0x91,0x91,0x92,0x93,0x94,0x93,0x92,0x91,0x8c,0x95, + 0xb5,0x8e,0x45,0x15,0x00,0x05,0x04,0x03,0x03,0x04,0x03,0x02,0x00,0x00,0x00, + 0x02,0x05,0x07,0x00,0x26,0x89,0xa6,0xa3,0x96,0x91,0x94,0x95,0x95,0x95,0x95, + 0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x97,0x97,0x97,0x96,0x96,0x96,0x96,0x97, + 0x97,0x98,0x98,0x98,0x98,0x99,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x9a,0x99,0x99,0x99,0x99, + 0x9a,0x9a,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x9a,0x99,0x99,0x99, + 0x99,0x99,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x9a,0x9a, + 0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9b, + 0x9b,0xc8,0x49,0x49,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4b,0x4c,0x4c,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50, + 0x50,0x51,0x52,0x52,0x52,0x52,0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x52,0x53, + 0x53,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x56,0x56,0x56,0x55,0x56,0x57,0x57, + 0x57,0x57,0x58,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5c,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e, + 0x5e,0x5e,0x5f,0x5e,0x5e,0x5f,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x61, + 0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x68,0x68,0x68,0x68,0x68,0x68, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6b,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x70, + 0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x73,0x73,0x73, + 0x74,0x74,0x74,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x75,0x75, + 0x75,0x76,0x77,0x78,0x78,0x79,0x78,0x77,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7c,0x7b,0x79,0x7b,0x7c,0x7b,0x7a,0x7a,0x7c,0x7e,0x7d,0x7b, + 0x7b,0x7c,0x7d,0x7f,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x80,0x81,0x81,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x82,0x82, + 0x83,0x83,0x83,0x84,0x84,0x84,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x85, + 0x85,0x85,0x85,0x86,0x86,0x87,0x88,0x88,0x87,0x87,0x87,0x86,0x86,0x86,0x86, + 0x86,0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e, + 0x8e,0x8e,0x8e,0x8e,0x8d,0x8d,0x8e,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8f, + 0x8f,0x8f,0x8f,0x8f,0x91,0x8f,0x8e,0x90,0x91,0x8f,0x8f,0x90,0x91,0x91,0x90, + 0x91,0x92,0x90,0x90,0x92,0x92,0x91,0x90,0x90,0x91,0x91,0x90,0x92,0x92,0x91, + 0x91,0x93,0x93,0x93,0x95,0x95,0x94,0x92,0x92,0x93,0x94,0x95,0x94,0x94,0x94, + 0x8d,0x96,0xb5,0x94,0x51,0x1a,0x00,0x05,0x04,0x02,0x03,0x03,0x03,0x01,0x01, + 0x00,0x00,0x02,0x05,0x07,0x00,0x24,0x86,0xa5,0xa5,0x96,0x90,0x95,0x96,0x95, + 0x95,0x95,0x95,0x95,0x95,0x96,0x97,0x96,0x97,0x97,0x97,0x98,0x98,0x97,0x97, + 0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x99,0x99,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9a, + 0x9a,0x9a,0x9a,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d, + 0x9d,0x9c,0x9c,0xc8,0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50, + 0x50,0x50,0x51,0x52,0x53,0x53,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x53, + 0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56, + 0x57,0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5e,0x5c,0x5c,0x5d,0x5e, + 0x5e,0x5f,0x60,0x61,0x61,0x60,0x5e,0x5e,0x5f,0x61,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x63,0x64,0x63,0x63,0x63,0x63,0x64,0x64,0x65,0x65,0x65,0x66, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x68,0x68,0x69,0x69,0x69,0x6a, + 0x6a,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71, + 0x71,0x72,0x73,0x73,0x73,0x72,0x72,0x71,0x71,0x71,0x72,0x72,0x74,0x74,0x74, + 0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x76,0x76,0x74,0x74,0x76,0x76,0x77, + 0x77,0x77,0x77,0x77,0x77,0x78,0x7a,0x7b,0x79,0x78,0x79,0x7b,0x7b,0x7b,0x7c, + 0x7d,0x7c,0x7c,0x7c,0x7c,0x7c,0x7b,0x7b,0x7c,0x7d,0x7c,0x7b,0x7c,0x7e,0x7f, + 0x7e,0x7d,0x7c,0x7d,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x80,0x80,0x81,0x82,0x82,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x83, + 0x83,0x83,0x83,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87, + 0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x89,0x89,0x88,0x88,0x87,0x87,0x89,0x89, + 0x89,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b, + 0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8e,0x8f,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e, + 0x8f,0x8f,0x8f,0x90,0x90,0x90,0x90,0x90,0x90,0x8f,0x8e,0x8e,0x8e,0x8f,0x8f, + 0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x90,0x90,0x92,0x93,0x92,0x90, + 0x91,0x95,0x94,0x91,0x8f,0x90,0x94,0x92,0x91,0x96,0x96,0x92,0x90,0x90,0x93, + 0x94,0x95,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x93,0x93,0x95,0x95,0x95,0x94, + 0x95,0x96,0x8d,0x94,0xb1,0x9c,0x67,0x21,0x00,0x04,0x03,0x00,0x02,0x03,0x00, + 0x01,0x03,0x02,0x02,0x03,0x05,0x05,0x00,0x22,0x86,0xa6,0xa5,0x96,0x91,0x97, + 0x98,0x97,0x97,0x97,0x97,0x96,0x95,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x99, + 0x98,0x98,0x99,0x99,0x9a,0x9a,0x9a,0x99,0x99,0x9a,0x9a,0x9a,0x9a,0x99,0x99, + 0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9d,0x9d,0xc8,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4b,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x4f,0x50, + 0x50,0x50,0x50,0x50,0x51,0x52,0x53,0x53,0x52,0x52,0x53,0x53,0x53,0x54,0x54, + 0x55,0x55,0x55,0x54,0x54,0x53,0x54,0x55,0x56,0x57,0x57,0x57,0x56,0x56,0x57, + 0x57,0x57,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5c,0x5b,0x5b, + 0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x60,0x5f,0x5d,0x5d, + 0x5e,0x5f,0x60,0x60,0x62,0x62,0x62,0x61,0x5f,0x5f,0x60,0x61,0x62,0x62,0x62, + 0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x65,0x64,0x64,0x64,0x65,0x65,0x65, + 0x66,0x67,0x67,0x67,0x67,0x66,0x66,0x66,0x66,0x67,0x67,0x68,0x69,0x69,0x69, + 0x6a,0x6b,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e, + 0x6e,0x6e,0x6f,0x6f,0x6f,0x6f,0x6e,0x6e,0x6f,0x70,0x70,0x71,0x71,0x71,0x70, + 0x71,0x72,0x72,0x73,0x74,0x74,0x74,0x73,0x72,0x71,0x72,0x72,0x73,0x74,0x74, + 0x75,0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x77,0x76,0x76,0x77, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x7b,0x7b,0x7b,0x7a,0x7b,0x7b,0x7c, + 0x7d,0x7e,0x7e,0x7d,0x7d,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e, + 0x7f,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x80,0x80,0x7f,0x7f,0x7f,0x80,0x80,0x81, + 0x80,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x84,0x85,0x85,0x85,0x85, + 0x85,0x85,0x85,0x83,0x83,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88, + 0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x8a,0x8a,0x8a,0x8a,0x89,0x88,0x89, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f, + 0x8f,0x8f,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x90,0x90,0x90,0x90, + 0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x93, + 0x93,0x93,0x93,0x93,0x93,0x93,0x94,0x93,0x8f,0x8b,0x8a,0x8f,0x8e,0x8a,0x91, + 0x97,0x96,0x95,0x94,0x94,0x94,0x94,0x95,0x96,0x96,0x95,0x94,0x94,0x95,0x95, + 0x95,0x95,0x95,0x95,0x8d,0x93,0xaf,0xa0,0x6f,0x24,0x00,0x03,0x03,0x00,0x01, + 0x02,0x00,0x02,0x03,0x01,0x02,0x05,0x05,0x03,0x00,0x23,0x87,0xa7,0xa6,0x97, + 0x91,0x99,0x99,0x98,0x98,0x98,0x98,0x97,0x96,0x98,0x98,0x99,0x98,0x98,0x99, + 0x99,0x9a,0x9a,0x99,0x9a,0x9b,0x9c,0x9c,0x9b,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b, + 0x9b,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9d,0x9e,0x9e,0x9e,0x9d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9d,0x9d,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, + 0x9f,0x9f,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e, + 0x9e,0x9e,0x9f,0x9f,0x9f,0x9e,0x9e,0xc8,0x49,0x49,0x4a,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4c,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f, + 0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x53,0x53,0x52,0x52,0x53,0x53,0x54, + 0x55,0x55,0x55,0x56,0x56,0x55,0x55,0x54,0x55,0x56,0x57,0x57,0x57,0x57,0x57, + 0x57,0x58,0x5a,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b, + 0x5b,0x5b,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x61,0x60, + 0x5e,0x5e,0x5e,0x60,0x61,0x61,0x62,0x62,0x62,0x62,0x60,0x61,0x62,0x62,0x62, + 0x62,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65, + 0x65,0x65,0x66,0x67,0x68,0x68,0x68,0x68,0x67,0x67,0x67,0x68,0x69,0x69,0x69, + 0x69,0x6a,0x6b,0x6c,0x6d,0x6d,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6e,0x6e,0x6e,0x70,0x70,0x70,0x6f,0x6e,0x6e,0x6e,0x70,0x71,0x72,0x72, + 0x72,0x71,0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x73,0x73,0x72,0x73,0x73,0x74, + 0x74,0x75,0x76,0x76,0x77,0x77,0x76,0x76,0x76,0x76,0x76,0x77,0x78,0x78,0x78, + 0x78,0x78,0x78,0x79,0x79,0x79,0x78,0x79,0x7a,0x7b,0x7b,0x7c,0x7b,0x7b,0x7b, + 0x7c,0x7d,0x7e,0x7e,0x7e,0x7e,0x7d,0x7c,0x7c,0x7c,0x7d,0x7e,0x7d,0x7d,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x81,0x81,0x80,0x80,0x80,0x81, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x83,0x84,0x85,0x86,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x84,0x83,0x85,0x86,0x86,0x87,0x87,0x86,0x86,0x86, + 0x87,0x88,0x89,0x89,0x88,0x88,0x88,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c, + 0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f, + 0x8f,0x8f,0x8f,0x90,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x92,0x92,0x91,0x90,0x94,0x95, + 0x93,0x93,0x93,0x96,0x95,0x91,0x91,0x94,0x97,0x96,0x91,0x8d,0x8d,0x90,0x8e, + 0x8a,0x93,0x9b,0x98,0x95,0x92,0x94,0x95,0x95,0x95,0x96,0x96,0x96,0x95,0x95, + 0x95,0x96,0x96,0x95,0x95,0x94,0x8d,0x95,0xaf,0xa0,0x70,0x24,0x00,0x02,0x02, + 0x00,0x01,0x02,0x00,0x03,0x04,0x00,0x00,0x05,0x04,0x01,0x00,0x23,0x83,0xa6, + 0xa8,0x98,0x93,0x9c,0x9c,0x99,0x98,0x99,0x99,0x98,0x97,0x98,0x9a,0x9a,0x99, + 0x98,0x9a,0x9b,0x9b,0x9b,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9b,0x9a,0x9b, + 0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9d,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9e,0x9e,0x9e,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9c,0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa0,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, + 0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0x9f,0xc8,0x4a,0x4b,0x4b,0x4c,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x52,0x53,0x53,0x52,0x52,0x53, + 0x53,0x54,0x56,0x56,0x56,0x56,0x56,0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x58, + 0x58,0x57,0x57,0x59,0x5b,0x5a,0x5a,0x5b,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x61,0x60,0x5e,0x5e,0x5f,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x61,0x62,0x63, + 0x63,0x62,0x62,0x63,0x63,0x64,0x64,0x65,0x65,0x65,0x64,0x65,0x67,0x67,0x66, + 0x65,0x65,0x65,0x65,0x66,0x67,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x70,0x71, + 0x73,0x73,0x73,0x72,0x71,0x71,0x72,0x73,0x74,0x74,0x74,0x74,0x73,0x73,0x74, + 0x74,0x74,0x75,0x76,0x77,0x78,0x78,0x78,0x77,0x76,0x76,0x77,0x78,0x78,0x78, + 0x78,0x79,0x79,0x78,0x79,0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c, + 0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f,0x7e, + 0x7d,0x7f,0x81,0x82,0x80,0x7f,0x7f,0x80,0x81,0x80,0x80,0x82,0x82,0x81,0x81, + 0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x84,0x84,0x85,0x86,0x86, + 0x86,0x87,0x88,0x88,0x87,0x86,0x86,0x85,0x84,0x85,0x86,0x86,0x87,0x87,0x87, + 0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x8a,0x8a,0x8b,0x8c, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8f,0x90,0x90,0x90,0x90,0x91,0x91,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x92, + 0x92,0x91,0x91,0x91,0x91,0x92,0x93,0x93,0x93,0x93,0x93,0x92,0x91,0x92,0x93, + 0x92,0x93,0x94,0x94,0x95,0x94,0x94,0x94,0x94,0x93,0x8e,0x98,0xab,0xb1,0xb2, + 0xb5,0xb0,0xa4,0x95,0x8d,0x97,0x98,0x94,0x95,0x96,0x96,0x96,0x97,0x97,0x96, + 0x95,0x95,0x96,0x96,0x96,0x95,0x94,0x93,0x90,0x98,0xb3,0x9e,0x69,0x24,0x00, + 0x03,0x03,0x02,0x04,0x04,0x02,0x03,0x03,0x00,0x00,0x03,0x04,0x03,0x00,0x1f, + 0x70,0x9e,0xae,0x9a,0x93,0x9c,0x9c,0x9a,0x99,0x9a,0x9b,0x99,0x98,0x99,0x9b, + 0x9b,0x9b,0x9a,0x9c,0x9c,0x9c,0x9b,0x9b,0x9b,0x9c,0x9d,0x9d,0x9d,0x9c,0x9c, + 0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0x9f,0xa0,0x9f, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9d,0x9d,0x9e,0x9f,0x9f,0x9f,0x9f,0x9e, + 0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9e,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa0,0xa0,0xa0,0xc8,0x4b,0x4b,0x4c, + 0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x4f,0x4f,0x4f, + 0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x51,0x51,0x52,0x53,0x53,0x52, + 0x52,0x53,0x53,0x55,0x56,0x57,0x57,0x56,0x55,0x55,0x56,0x56,0x56,0x57,0x57, + 0x58,0x58,0x59,0x59,0x59,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x61,0x60,0x5e,0x5f,0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62, + 0x62,0x63,0x63,0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x66,0x66,0x65,0x66,0x67, + 0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x69,0x69,0x6a,0x6b,0x6b,0x6b, + 0x6a,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6e,0x6e,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x72,0x73,0x74,0x73,0x72,0x72,0x72,0x73,0x74,0x74,0x75,0x75,0x74,0x74, + 0x74,0x74,0x75,0x75,0x76,0x76,0x78,0x78,0x79,0x79,0x78,0x77,0x77,0x78,0x78, + 0x79,0x79,0x7a,0x7b,0x7b,0x7a,0x79,0x79,0x7a,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c, + 0x7c,0x7d,0x7f,0x7f,0x7f,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f,0x80,0x80,0x81, + 0x81,0x7f,0x7e,0x80,0x82,0x83,0x81,0x7f,0x7f,0x82,0x82,0x81,0x81,0x83,0x82, + 0x82,0x82,0x82,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86, + 0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x87,0x86,0x86,0x86,0x86,0x86,0x86,0x87, + 0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8b, + 0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e, + 0x8e,0x8e,0x8f,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x90,0x90,0x91,0x91,0x91, + 0x93,0x94,0x93,0x92,0x92,0x92,0x93,0x93,0x93,0x94,0x94,0x94,0x94,0x93,0x92, + 0x93,0x94,0x92,0x92,0x93,0x94,0x95,0x94,0x95,0x97,0x96,0x96,0x98,0x9b,0x9e, + 0x9b,0x95,0x90,0x98,0xa7,0x9c,0x8f,0x95,0x96,0x95,0x96,0x98,0x97,0x97,0x98, + 0x98,0x97,0x96,0x96,0x97,0x98,0x97,0x95,0x95,0x95,0x91,0x99,0xb4,0x9e,0x69, + 0x24,0x00,0x04,0x03,0x01,0x04,0x05,0x02,0x02,0x03,0x02,0x01,0x02,0x03,0x03, + 0x00,0x17,0x58,0x94,0xb6,0x9d,0x93,0x9e,0x9e,0x9b,0x9b,0x9b,0x9c,0x9a,0x98, + 0x9a,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9c,0x9b,0x9c,0x9c,0x9e,0x9f,0x9f, + 0x9d,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f, + 0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0, + 0xa0,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa2,0xa1,0xa1,0xa1,0xa1, + 0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa1,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa1,0xa1,0xa1,0xc8,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c,0x4d,0x50,0x50, + 0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x51,0x51,0x52,0x53, + 0x53,0x52,0x52,0x53,0x53,0x54,0x56,0x57,0x57,0x56,0x55,0x56,0x56,0x57,0x57, + 0x57,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c, + 0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5d,0x5d,0x5e,0x5e,0x5f,0x60,0x60,0x60,0x5f, + 0x5f,0x60,0x60,0x60,0x61,0x60,0x5f,0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x63, + 0x63,0x63,0x62,0x62,0x62,0x61,0x61,0x61,0x62,0x63,0x65,0x66,0x67,0x68,0x68, + 0x67,0x66,0x67,0x68,0x69,0x69,0x69,0x68,0x68,0x68,0x68,0x69,0x69,0x6a,0x6d, + 0x6d,0x6c,0x6b,0x6b,0x6a,0x6a,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x71,0x70,0x70,0x71,0x71,0x72, + 0x72,0x72,0x73,0x73,0x74,0x74,0x73,0x72,0x73,0x74,0x75,0x76,0x78,0x77,0x77, + 0x76,0x75,0x75,0x75,0x76,0x76,0x77,0x78,0x78,0x7a,0x7b,0x7a,0x79,0x79,0x79, + 0x79,0x7a,0x7b,0x7b,0x7c,0x7c,0x7b,0x7b,0x7a,0x7a,0x7b,0x7b,0x7d,0x7e,0x7e, + 0x7d,0x7c,0x7c,0x7f,0x80,0x7f,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x80,0x81,0x82, + 0x83,0x83,0x83,0x7f,0x7f,0x82,0x84,0x86,0x82,0x7f,0x80,0x82,0x85,0x83,0x82, + 0x84,0x84,0x83,0x83,0x83,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x87,0x87,0x88,0x88,0x88, + 0x88,0x88,0x88,0x88,0x88,0x88,0x87,0x87,0x86,0x89,0x8c,0x8b,0x8b,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e, + 0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x90, + 0x91,0x90,0x90,0x90,0x91,0x91,0x92,0x92,0x93,0x92,0x92,0x91,0x91,0x91,0x91, + 0x92,0x93,0x94,0x95,0x94,0x94,0x93,0x93,0x94,0x94,0x94,0x95,0x95,0x95,0x95, + 0x95,0x95,0x95,0x94,0x94,0x93,0x93,0x94,0x95,0x96,0x97,0x98,0x98,0x9c,0xae, + 0x9b,0x69,0x51,0x41,0x2e,0x4c,0x8f,0xa2,0xa0,0x92,0x8f,0x95,0x98,0x99,0x98, + 0x98,0x98,0x98,0x98,0x97,0x97,0x98,0x98,0x98,0x96,0x97,0x98,0x91,0x97,0xb2, + 0xa0,0x6d,0x24,0x00,0x04,0x03,0x00,0x02,0x03,0x01,0x02,0x03,0x04,0x03,0x01, + 0x03,0x04,0x00,0x0e,0x3d,0x88,0xbe,0xa0,0x93,0x9f,0x9f,0x9c,0x9c,0x9c,0x9d, + 0x9b,0x99,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9d,0x9c,0x9c,0x9d,0x9f, + 0xa0,0xa0,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, + 0x9f,0x9f,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1, + 0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3, + 0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa1,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xc8,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x50,0x50,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x51,0x51, + 0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x56,0x57,0x57,0x56,0x55,0x56,0x57, + 0x57,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b, + 0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5d,0x5e,0x5e,0x5e,0x5f,0x60,0x60, + 0x5f,0x5e,0x5f,0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x63,0x62, + 0x62,0x62,0x62,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x65,0x65,0x66,0x66,0x67, + 0x68,0x68,0x67,0x67,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a, + 0x6b,0x6c,0x6c,0x6c,0x6c,0x6b,0x6b,0x6b,0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6d, + 0x6d,0x6e,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x71,0x70,0x71, + 0x72,0x73,0x74,0x74,0x74,0x74,0x73,0x74,0x74,0x74,0x74,0x75,0x76,0x77,0x78, + 0x78,0x78,0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x78,0x79,0x7a,0x7a,0x7a,0x7a, + 0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c, + 0x7d,0x7e,0x7d,0x7d,0x7d,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80, + 0x81,0x82,0x82,0x82,0x82,0x81,0x81,0x83,0x85,0x86,0x84,0x82,0x82,0x83,0x85, + 0x85,0x85,0x84,0x84,0x83,0x83,0x84,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x87,0x87,0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x87,0x88,0x89, + 0x89,0x8a,0x8a,0x8a,0x8a,0x89,0x88,0x88,0x89,0x8a,0x8a,0x8b,0x8d,0x8d,0x8d, + 0x8d,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e, + 0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x8f,0x90,0x90,0x90,0x90,0x90,0x91, + 0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x94,0x94,0x93,0x93,0x93,0x92, + 0x92,0x93,0x93,0x94,0x95,0x95,0x95,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x96, + 0x96,0x96,0x95,0x95,0x95,0x96,0x95,0x95,0x95,0x97,0x99,0x98,0x96,0x93,0x99, + 0xa0,0xa0,0x78,0x2e,0x1a,0x16,0x09,0x19,0x46,0x84,0xab,0x98,0x91,0x96,0x98, + 0x99,0x98,0x97,0x97,0x99,0x9a,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x91, + 0x97,0xb3,0xa3,0x72,0x24,0x00,0x05,0x05,0x02,0x01,0x01,0x03,0x03,0x03,0x02, + 0x03,0x05,0x07,0x06,0x00,0x0a,0x35,0x85,0xc0,0xa2,0x93,0x9d,0x9e,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9d,0x9e,0x9f,0x9e,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9d,0x9e,0x9f,0x9f,0x9e,0x9f,0x9f,0x9f,0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0x9f, + 0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa1,0xa2,0xa2,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa3, + 0xa3,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa2,0xa2,0xa2,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xc8,0x4c,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f, + 0x4f,0x50,0x50,0x50,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51, + 0x51,0x51,0x52,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x57,0x57,0x56,0x55, + 0x57,0x57,0x58,0x59,0x59,0x58,0x58,0x58,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c,0x5e,0x5e,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x60,0x60,0x5f,0x5e,0x5f,0x62,0x64,0x64,0x62,0x62,0x65,0x65,0x65,0x64,0x64, + 0x64,0x63,0x62,0x62,0x62,0x64,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x67, + 0x66,0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x6b, + 0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f, + 0x6f,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x72, + 0x72,0x72,0x73,0x74,0x75,0x75,0x74,0x74,0x73,0x73,0x74,0x76,0x76,0x75,0x76, + 0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x7b,0x7b,0x79,0x79,0x79,0x79, + 0x79,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x80,0x81,0x81,0x81,0x81,0x82,0x82,0x83,0x85,0x86,0x86,0x86,0x85,0x83, + 0x84,0x85,0x86,0x86,0x84,0x84,0x84,0x84,0x85,0x85,0x85,0x85,0x86,0x86,0x86, + 0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x89,0x89,0x88,0x88,0x88, + 0x89,0x8a,0x8a,0x8b,0x8c,0x8c,0x8b,0x8a,0x89,0x89,0x8a,0x8c,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e, + 0x8e,0x8e,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x90,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x93,0x94,0x94,0x95,0x95,0x95,0x94, + 0x94,0x94,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x97, + 0x97,0x97,0x97,0x97,0x97,0x95,0x97,0x98,0x96,0x96,0x98,0x9a,0x9b,0x99,0x95, + 0x91,0x9e,0xa0,0x7b,0x44,0x03,0x00,0x02,0x00,0x00,0x08,0x68,0xb3,0x9f,0x95, + 0x99,0x99,0x99,0x99,0x98,0x96,0x98,0x9b,0x9a,0x98,0x97,0x98,0x9a,0x99,0x99, + 0x98,0x91,0x98,0xb5,0xa4,0x73,0x24,0x00,0x05,0x06,0x03,0x01,0x01,0x05,0x05, + 0x03,0x00,0x01,0x07,0x08,0x06,0x00,0x0a,0x33,0x83,0xc1,0xa5,0x95,0x9b,0x9d, + 0x9d,0x9d,0x9c,0x9b,0x9c,0x9d,0x9f,0x9f,0x9d,0x9f,0xa0,0x9e,0x9d,0x9c,0x9d, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0x9f,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xc8,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4f, + 0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52, + 0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x57,0x57, + 0x57,0x57,0x57,0x58,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5c, + 0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60, + 0x5f,0x60,0x62,0x62,0x62,0x62,0x62,0x65,0x66,0x65,0x62,0x62,0x64,0x65,0x65, + 0x64,0x64,0x65,0x64,0x63,0x63,0x64,0x65,0x65,0x66,0x67,0x67,0x68,0x68,0x68, + 0x67,0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6c, + 0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x70, + 0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x73, + 0x73,0x73,0x74,0x74,0x74,0x75,0x76,0x76,0x75,0x74,0x74,0x74,0x75,0x77,0x77, + 0x76,0x77,0x78,0x79,0x79,0x78,0x78,0x78,0x78,0x78,0x79,0x7b,0x7b,0x7a,0x7a, + 0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7d,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7e, + 0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x82,0x81, + 0x81,0x81,0x80,0x80,0x80,0x81,0x81,0x82,0x83,0x84,0x85,0x86,0x86,0x86,0x86, + 0x85,0x83,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87, + 0x87,0x88,0x88,0x88,0x88,0x89,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x89, + 0x89,0x89,0x8a,0x8a,0x8b,0x8c,0x8d,0x8d,0x8c,0x8c,0x8c,0x8c,0x8d,0x8e,0x8f, + 0x8e,0x8e,0x8e,0x8f,0x8f,0x8f,0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x8f,0x8f,0x8f, + 0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92, + 0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93,0x94,0x94,0x95,0x95,0x95,0x95,0x96, + 0x96,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x95,0x95,0x95,0x95,0x95,0x96,0x97, + 0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x97,0x98,0x98,0x94,0x96,0x9d,0x9a,0x95, + 0x95,0x99,0xa0,0xab,0x9a,0x3b,0x0a,0x09,0x03,0x00,0x06,0x05,0x0a,0x69,0xb5, + 0x9f,0x96,0x9d,0x9c,0x9c,0xa0,0x9c,0x95,0x98,0x99,0x98,0x97,0x97,0x9a,0x9c, + 0x9c,0x9b,0x99,0x93,0x9a,0xb5,0xa0,0x6a,0x24,0x00,0x03,0x02,0x00,0x03,0x04, + 0x03,0x03,0x03,0x03,0x02,0x02,0x03,0x04,0x00,0x0c,0x2f,0x80,0xc2,0xa8,0x98, + 0x9c,0x9e,0xa0,0x9f,0x9e,0x9d,0x9b,0x9a,0x9d,0xa0,0xa0,0xa0,0xa0,0xa0,0x9f, + 0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa1,0xa1,0xa0,0xa0,0xa1,0xa0,0xa0,0xa0,0xa1, + 0xa2,0xa2,0xa2,0xa1,0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa2, + 0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xc8,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e, + 0x4e,0x4f,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x52, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x56,0x56,0x57,0x57, + 0x57,0x58,0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5b,0x5c,0x5c,0x5d,0x5c,0x5b, + 0x5c,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x60, + 0x61,0x61,0x5f,0x60,0x62,0x63,0x63,0x62,0x63,0x65,0x65,0x65,0x62,0x62,0x64, + 0x65,0x65,0x64,0x64,0x65,0x65,0x65,0x64,0x65,0x67,0x67,0x67,0x67,0x68,0x68, + 0x68,0x68,0x68,0x67,0x68,0x68,0x69,0x69,0x6a,0x6b,0x6b,0x6a,0x6a,0x6a,0x6b, + 0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x70, + 0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x72,0x72,0x71,0x71,0x71,0x72,0x72,0x73, + 0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x75,0x75,0x74,0x75,0x77, + 0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x78,0x78,0x78,0x79,0x79,0x79,0x7b,0x7b, + 0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80,0x81,0x80,0x80,0x81,0x82,0x82, + 0x83,0x83,0x82,0x82,0x81,0x81,0x81,0x82,0x82,0x83,0x85,0x85,0x86,0x86,0x86, + 0x86,0x85,0x84,0x84,0x84,0x85,0x86,0x86,0x86,0x87,0x87,0x87,0x87,0x88,0x88, + 0x88,0x88,0x89,0x8a,0x8a,0x8a,0x89,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e, + 0x8e,0x8f,0x8e,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x93,0x93,0x93,0x93, + 0x93,0x93,0x94,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x96,0x96,0x96,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x95,0x95,0x95,0x96, + 0x96,0x97,0x98,0x98,0x98,0x99,0x99,0x99,0x98,0x98,0x98,0x98,0x97,0x98,0x9d, + 0x99,0x94,0x95,0x9c,0xa8,0xaf,0x92,0x20,0x00,0x09,0x07,0x03,0x07,0x05,0x08, + 0x62,0xae,0xa0,0x9a,0x9d,0x9c,0x9c,0x9e,0x9c,0x98,0x99,0x9a,0x99,0x9a,0x9c, + 0x9b,0x9a,0x98,0x98,0x98,0x94,0x9b,0xb3,0x9d,0x69,0x24,0x00,0x01,0x01,0x00, + 0x03,0x03,0x02,0x02,0x03,0x03,0x03,0x00,0x01,0x03,0x00,0x0a,0x28,0x7b,0xc2, + 0xaa,0x99,0x9b,0xa0,0xa3,0xa1,0x9f,0x9d,0x9d,0x9e,0x9e,0xa0,0xa1,0xa1,0xa0, + 0xa1,0xa0,0xa0,0x9f,0x9e,0x9f,0xa0,0xa2,0xa2,0xa2,0xa1,0xa1,0xa1,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa5,0xa6,0xa6,0xa5, + 0xa5,0xa4,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xc8,0x4d,0x4d,0x4c,0x4c,0x4c,0x4c, + 0x4d,0x4e,0x4e,0x4f,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x56,0x56,0x57,0x57, + 0x57,0x58,0x58,0x59,0x59,0x59,0x58,0x58,0x59,0x5a,0x5b,0x5d,0x5e,0x5e,0x5d, + 0x5d,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x61, + 0x61,0x61,0x61,0x61,0x5f,0x60,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x62, + 0x62,0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x67,0x68,0x68,0x68, + 0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6b,0x6b,0x6a, + 0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6e,0x6e,0x6f,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x73, + 0x73,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x75,0x75,0x75, + 0x77,0x78,0x7a,0x79,0x78,0x78,0x78,0x79,0x79,0x79,0x79,0x79,0x7a,0x7a,0x7a, + 0x7b,0x7b,0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7d,0x7d, + 0x7f,0x7f,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81, + 0x82,0x84,0x85,0x85,0x84,0x82,0x82,0x82,0x82,0x82,0x83,0x85,0x86,0x86,0x86, + 0x86,0x86,0x86,0x85,0x85,0x85,0x85,0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x88, + 0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8c,0x8c,0x8c,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8d,0x8e,0x8e, + 0x8e,0x8e,0x8e,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8e,0x8e,0x8f,0x91,0x91, + 0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93,0x94,0x94,0x94,0x94, + 0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x95,0x96,0x96,0x96,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x96, + 0x96,0x96,0x96,0x97,0x98,0x98,0x99,0x99,0x9a,0x9a,0x99,0x98,0x98,0x98,0x9d, + 0x9d,0x99,0x98,0x98,0x97,0x9e,0xab,0xa6,0x82,0x24,0x00,0x02,0x05,0x07,0x03, + 0x00,0x01,0x51,0x9a,0xa4,0xa1,0x98,0x9b,0x9c,0x95,0x96,0x9d,0x9d,0x9c,0x9c, + 0xa0,0xa3,0x9c,0x95,0x91,0x92,0x95,0x93,0x9a,0xb1,0x9e,0x6d,0x24,0x00,0x02, + 0x03,0x03,0x02,0x00,0x00,0x00,0x00,0x03,0x04,0x02,0x02,0x02,0x00,0x06,0x1f, + 0x77,0xc3,0xaa,0x98,0x98,0xa0,0xa7,0xa3,0x9e,0x9c,0xa1,0xa6,0xa0,0x9f,0xa0, + 0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa1,0xa1,0xa2, + 0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6, + 0xa6,0xa6,0xa6,0xa5,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xc8,0x4d,0x4d,0x4d,0x4c, + 0x4c,0x4c,0x4d,0x4d,0x4e,0x4f,0x50,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x52, + 0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x56,0x56,0x57,0x57, + 0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x59,0x59,0x58,0x59,0x5a,0x5b,0x5d,0x5e, + 0x5e,0x5d,0x5d,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x60,0x62,0x62,0x63,0x62,0x61,0x61,0x62,0x63,0x63,0x62,0x63,0x64,0x63, + 0x63,0x62,0x63,0x64,0x64,0x64,0x64,0x65,0x65,0x66,0x65,0x65,0x65,0x66,0x68, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6d,0x6c, + 0x6c,0x6b,0x6b,0x6b,0x6c,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6e,0x6f,0x70,0x70, + 0x70,0x70,0x70,0x71,0x70,0x71,0x71,0x71,0x71,0x71,0x72,0x71,0x71,0x72,0x72, + 0x73,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x76,0x76,0x77,0x76,0x76,0x75, + 0x75,0x76,0x78,0x78,0x7a,0x79,0x78,0x78,0x78,0x79,0x79,0x7a,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e, + 0x7e,0x7e,0x7f,0x80,0x80,0x80,0x81,0x81,0x82,0x81,0x81,0x81,0x81,0x81,0x81, + 0x81,0x82,0x83,0x85,0x86,0x86,0x85,0x84,0x82,0x82,0x83,0x84,0x85,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x89, + 0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8b,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e, + 0x90,0x90,0x90,0x8f,0x8f,0x8e,0x8e,0x8e,0x8f,0x8f,0x8f,0x8e,0x8e,0x8f,0x90, + 0x91,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x92,0x93,0x94,0x94,0x94,0x94,0x94, + 0x95,0x95,0x95,0x95,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96, + 0x96,0x96,0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x97,0x97, + 0x96,0x96,0x96,0x96,0x97,0x98,0x98,0x99,0x99,0x9a,0x9b,0x9a,0x9a,0x9b,0x9b, + 0x9c,0x9c,0x9b,0x98,0x9a,0x9c,0x98,0xa0,0xae,0x7d,0x3c,0x0f,0x00,0x07,0x06, + 0x04,0x04,0x00,0x00,0x36,0x78,0xa9,0xae,0x92,0x9a,0xa0,0x93,0x97,0xa5,0x9c, + 0x95,0x9a,0xa3,0xae,0xb3,0xb5,0xb4,0xa9,0x9a,0x93,0x9a,0xb2,0xa2,0x74,0x26, + 0x00,0x05,0x05,0x02,0x00,0x00,0x02,0x01,0x01,0x03,0x05,0x07,0x06,0x03,0x00, + 0x04,0x19,0x74,0xc4,0xaa,0x9b,0xa1,0xa1,0xa0,0x9f,0xa0,0xa1,0xa3,0xa3,0xa0, + 0xa0,0xa1,0xa2,0xa2,0xa1,0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa1,0xa1,0xa1,0xa1, + 0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa5,0xa4,0xa4,0xa4, + 0xa4,0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa5,0xa6,0xa5,0xa5,0xa5,0xa5,0xa5, + 0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa5,0xa5,0xa4,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa4,0xa4,0xa4,0xa5,0xa5, + 0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa4,0xa4,0xa5,0xa6,0xa6,0xa6,0xc8,0x4e,0x4e, + 0x4e,0x4d,0x4d,0x4d,0x4d,0x4e,0x4f,0x50,0x50,0x51,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x56,0x56,0x57,0x57, + 0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x5a,0x5b, + 0x5d,0x5e,0x5e,0x5d,0x5d,0x5c,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5f,0x60,0x62,0x63,0x64,0x64,0x62,0x62,0x63,0x64,0x64,0x63,0x64, + 0x65,0x64,0x63,0x63,0x64,0x65,0x65,0x64,0x64,0x65,0x66,0x66,0x66,0x65,0x65, + 0x66,0x69,0x6a,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6c,0x6d, + 0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x70, + 0x70,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71, + 0x71,0x72,0x73,0x74,0x74,0x75,0x76,0x76,0x76,0x76,0x76,0x76,0x77,0x77,0x77, + 0x76,0x76,0x77,0x77,0x78,0x79,0x7a,0x79,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7b, + 0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82, + 0x82,0x82,0x82,0x82,0x84,0x85,0x86,0x86,0x86,0x84,0x84,0x83,0x85,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x89,0x89,0x89, + 0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b, + 0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x90,0x90,0x90,0x8f,0x8f, + 0x90,0x90,0x91,0x91,0x91,0x91,0x90,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x8f,0x8f, + 0x90,0x91,0x91,0x92,0x92,0x92,0x93,0x93,0x93,0x93,0x93,0x93,0x94,0x94,0x94, + 0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x96,0x97,0x97,0x97,0x96,0x96,0x97,0x97,0x97,0x97,0x97,0x97,0x98,0x97,0x98, + 0x98,0x98,0x97,0x97,0x97,0x97,0x98,0x98,0x99,0x9a,0x9a,0x9b,0x9b,0x9b,0x9c, + 0x9c,0x9e,0x9f,0x9a,0x98,0x98,0x9c,0x9d,0x97,0xa2,0xb4,0x5e,0x03,0x00,0x03, + 0x0b,0x06,0x01,0x07,0x04,0x00,0x1e,0x56,0xac,0xb9,0x90,0x99,0xa3,0x96,0x99, + 0xa5,0x9e,0x98,0x9f,0x9c,0x95,0x9f,0xaa,0xb5,0xb1,0xa4,0x98,0x9a,0xb3,0xa7, + 0x7c,0x2a,0x00,0x07,0x05,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x05,0x0a,0x08, + 0x04,0x00,0x03,0x14,0x70,0xc3,0xa8,0x9c,0xa5,0xa0,0x9b,0x9e,0xa2,0xa6,0xa3, + 0x9f,0xa0,0xa1,0xa2,0xa3,0xa3,0xa2,0xa1,0xa2,0xa3,0xa4,0xa4,0xa3,0xa1,0xa0, + 0xa0,0xa2,0xa3,0xa3,0xa3,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa5,0xa5,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa5,0xa5, + 0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa5, + 0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa4,0xa4,0xa4, + 0xa4,0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xc8, + 0x50,0x50,0x4f,0x4f,0x4f,0x4f,0x4f,0x50,0x50,0x50,0x52,0x53,0x53,0x53,0x51, + 0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x57,0x57,0x57, + 0x57,0x58,0x58,0x59,0x58,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5d,0x5e,0x5e,0x5e,0x5d,0x5d,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5f,0x61,0x61,0x60,0x61,0x61,0x60,0x60,0x61,0x62,0x62, + 0x61,0x62,0x64,0x63,0x63,0x65,0x66,0x66,0x66,0x65,0x65,0x66,0x67,0x68,0x67, + 0x66,0x67,0x68,0x69,0x6b,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6b,0x6c,0x6c,0x6d, + 0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6d,0x6d,0x6e,0x6e,0x70,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x72,0x72,0x73,0x72,0x73,0x73,0x72,0x71, + 0x71,0x71,0x72,0x72,0x73,0x74,0x75,0x76,0x77,0x77,0x76,0x76,0x76,0x76,0x77, + 0x78,0x78,0x77,0x77,0x78,0x78,0x78,0x79,0x7a,0x79,0x79,0x78,0x79,0x79,0x7a, + 0x7b,0x7b,0x7c,0x7d,0x7e,0x7e,0x7f,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80, + 0x80,0x80,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x83, + 0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x86, + 0x87,0x87,0x87,0x87,0x86,0x86,0x86,0x87,0x88,0x89,0x89,0x89,0x89,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c, + 0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x90,0x91,0x91,0x91,0x91,0x90,0x91,0x91,0x92,0x92,0x92, + 0x91,0x91,0x91,0x92,0x94,0x95,0x95,0x95,0x95,0x94,0x94,0x94,0x94,0x94,0x94, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x97,0x97,0x97,0x97, + 0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x9a, + 0x9a,0x9a,0x9a,0x9a,0x99,0x99,0x99,0x99,0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9f,0xa0,0x9b,0x9a,0x9e,0x9a,0x96,0x95,0xa9,0xc4,0x6a,0x09, + 0x00,0x03,0x08,0x04,0x00,0x04,0x03,0x00,0x14,0x46,0xaa,0xbf,0x98,0x97,0x9c, + 0x9f,0x99,0x92,0xaa,0xbd,0xb9,0x7f,0x2c,0x1f,0x2f,0x51,0x89,0xbd,0xa6,0x99, + 0xb2,0xad,0x89,0x2e,0x00,0x02,0x04,0x03,0x01,0x00,0x00,0x01,0x02,0x00,0x01, + 0x03,0x02,0x00,0x00,0x02,0x0a,0x69,0xbf,0xa4,0x93,0x98,0x9c,0xa2,0xa6,0xa5, + 0xa1,0xa2,0xa3,0xa4,0xa5,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa5,0xa4,0xa4, + 0xa4,0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa5,0xa5,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6, + 0xa6,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa6,0xa6,0xa6, + 0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa5,0xa5,0xa5, + 0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa4,0xa5,0xa6,0xa7,0xa6,0xa7,0xa7,0xa7, + 0xa7,0xc8,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x53,0x53,0x53, + 0x53,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x56,0x57,0x57, + 0x58,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5a,0x5b,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x5f,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x60,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x62,0x63,0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x66,0x66,0x67,0x69, + 0x69,0x69,0x68,0x69,0x69,0x6b,0x6c,0x6b,0x6a,0x6a,0x6a,0x6b,0x6b,0x6c,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x6f,0x6f,0x6f,0x6f,0x70,0x71, + 0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x73,0x74,0x74,0x74,0x74, + 0x73,0x73,0x73,0x73,0x73,0x74,0x74,0x75,0x76,0x77,0x77,0x77,0x76,0x76,0x77, + 0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a,0x7a, + 0x7b,0x7b,0x7b,0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x81,0x81, + 0x82,0x82,0x82,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x84, + 0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x85,0x85,0x85,0x85,0x86, + 0x86,0x87,0x88,0x88,0x88,0x88,0x87,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x90,0x90,0x91,0x91,0x91,0x91,0x90,0x90,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x90,0x90,0x91,0x91,0x91,0x91,0x92,0x93,0x94, + 0x94,0x94,0x94,0x93,0x94,0x95,0x95,0x95,0x96,0x96,0x96,0x95,0x95,0x95,0x95, + 0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x97,0x97,0x97,0x97,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b, + 0x9b,0x9c,0x9c,0x9c,0x9c,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9c,0x9d,0xa0,0x9b,0x96,0x98,0xac,0xc6, + 0x71,0x12,0x05,0x02,0x03,0x03,0x03,0x06,0x03,0x00,0x06,0x2f,0x9a,0xbb,0xa0, + 0x98,0x98,0xa0,0x9e,0x96,0xaa,0xac,0x89,0x46,0x00,0x00,0x00,0x14,0x53,0x98, + 0xa0,0xa4,0xb5,0xaf,0x8e,0x2f,0x00,0x00,0x03,0x04,0x03,0x01,0x00,0x01,0x03, + 0x01,0x00,0x00,0x00,0x01,0x03,0x01,0x03,0x61,0xbd,0xb3,0xa8,0xa7,0xa1,0x9e, + 0xa4,0xa5,0xa1,0xa3,0xa7,0xa6,0xa5,0xa4,0xa3,0xa3,0xa5,0xa5,0xa5,0xa4,0xa3, + 0xa3,0xa4,0xa5,0xa5,0xa5,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa6,0xa7,0xa7,0xa7, + 0xa6,0xa6,0xa6,0xa7,0xa7,0xa6,0xa6,0xa6,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6, + 0xa6,0xa6,0xa6,0xa6,0xa5,0xa5,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa8,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6, + 0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xc8,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x52,0x53,0x53, + 0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x56,0x57,0x57,0x57, + 0x58,0x59,0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b, + 0x5b,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x5f,0x60,0x60, + 0x60,0x60,0x60,0x61,0x60,0x60,0x60,0x60,0x61,0x62,0x62,0x64,0x65,0x66,0x65, + 0x65,0x65,0x65,0x65,0x65,0x66,0x68,0x67,0x67,0x67,0x67,0x68,0x67,0x67,0x67, + 0x68,0x69,0x69,0x69,0x69,0x69,0x6a,0x6c,0x6d,0x6c,0x6b,0x6b,0x6b,0x6b,0x6d, + 0x6d,0x6d,0x6e,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x71,0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x74,0x74, + 0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x77,0x77,0x77,0x77,0x77, + 0x77,0x78,0x78,0x78,0x79,0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7c,0x7c,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x84, + 0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x86,0x86,0x86,0x86,0x86, + 0x86,0x87,0x88,0x89,0x89,0x89,0x89,0x8a,0x89,0x89,0x8a,0x8a,0x8b,0x8c,0x8c, + 0x8c,0x8b,0x8b,0x8b,0x8b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8f,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x94, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x97,0x97,0x97,0x97, + 0x97,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9d,0x9d,0x9e,0x9e,0x9f,0xa1,0x9c,0x98,0x9e,0xa0,0x9d,0x9c,0x9d,0x9e, + 0xac,0xbe,0x70,0x1a,0x07,0x00,0x00,0x03,0x08,0x09,0x06,0x01,0x00,0x13,0x7d, + 0xad,0xa9,0x9f,0x97,0x9e,0xa6,0xaa,0x98,0x6d,0x20,0x01,0x03,0x02,0x02,0x00, + 0x18,0x45,0x8b,0xb9,0xb8,0xae,0x8d,0x2f,0x00,0x00,0x01,0x03,0x04,0x03,0x01, + 0x03,0x04,0x03,0x02,0x02,0x03,0x04,0x07,0x03,0x00,0x57,0xb5,0xc8,0xc8,0xc3, + 0xaa,0x96,0x9c,0xa1,0xa4,0xa7,0xa7,0xa3,0xa3,0xa3,0xa3,0xa3,0xa6,0xa7,0xa7, + 0xa4,0xa3,0xa3,0xa4,0xa7,0xa7,0xa7,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa6,0xa6, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa6,0xa6,0xa7,0xa7,0xa8,0xa9,0xa9,0xa9,0xa8,0xa8, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8, + 0xa8,0xa8,0xa9,0xa9,0xa9,0xa9,0xa9,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9, + 0xa8,0xa8,0xa8,0xa8,0xa8,0xc8,0x4f,0x4f,0x4f,0x50,0x50,0x51,0x52,0x52,0x53, + 0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x57,0x57, + 0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b,0x5c,0x5c, + 0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x60,0x61,0x61, + 0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x61,0x62,0x62,0x63,0x64,0x65,0x66, + 0x66,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x68,0x67,0x66,0x67,0x68,0x69,0x69, + 0x68,0x67,0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x6b,0x6d,0x6d,0x6d,0x6c,0x6c,0x6c, + 0x6c,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x71,0x71, + 0x71,0x71,0x71,0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x75,0x74,0x75,0x76,0x77,0x77,0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7c,0x7b, + 0x7c,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80,0x81, + 0x81,0x82,0x82,0x83,0x83,0x83,0x83,0x82,0x82,0x83,0x83,0x84,0x84,0x85,0x85, + 0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x89,0x88,0x88,0x88, + 0x87,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8a,0x8a,0x8b,0x8c,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e, + 0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x91,0x91,0x91,0x91,0x91,0x92, + 0x91,0x91,0x91,0x92,0x93,0x93,0x94,0x94,0x94,0x94,0x93,0x94,0x94,0x95,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x98,0x97,0x97, + 0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99, + 0x99,0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9c,0x9c,0x9c,0x9d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9d,0x9d,0x9e,0x9f,0x9e,0xa0,0xa2,0x9d,0x99,0xa0,0xa1,0x9d,0x9c, + 0x9c,0x99,0xa8,0xc0,0x73,0x19,0x04,0x00,0x04,0x06,0x06,0x06,0x04,0x03,0x00, + 0x0a,0x5c,0x98,0xb8,0xa3,0x92,0xa7,0xaf,0xa4,0x64,0x25,0x01,0x00,0x07,0x04, + 0x00,0x00,0x03,0x20,0x82,0xc0,0xb3,0xa6,0x8a,0x31,0x00,0x00,0x00,0x02,0x04, + 0x04,0x01,0x01,0x02,0x03,0x03,0x03,0x03,0x04,0x06,0x01,0x00,0x42,0x8c,0x8d, + 0x8a,0x8b,0xa5,0xb9,0xa4,0x9d,0xa6,0xa7,0xa5,0xa3,0xa5,0xa8,0xa6,0xa4,0xa7, + 0xa7,0xa7,0xa5,0xa4,0xa3,0xa5,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6, + 0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa9,0xaa,0xaa,0xaa, + 0xa9,0xa9,0xa8,0xa8,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9, + 0xa9,0xa9,0xa9,0xa9,0xaa,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9, + 0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa8,0xc8,0x4e,0x4e,0x4f,0x50,0x50,0x51,0x52, + 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x57,0x57,0x57,0x57,0x57, + 0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5b, + 0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x61,0x62, + 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x65, + 0x65,0x65,0x66,0x64,0x64,0x64,0x65,0x65,0x65,0x67,0x68,0x66,0x65,0x68,0x69, + 0x69,0x69,0x69,0x68,0x69,0x6a,0x6a,0x6a,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x71, + 0x71,0x72,0x72,0x72,0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74, + 0x74,0x75,0x75,0x75,0x75,0x75,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x78, + 0x78,0x78,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d, + 0x7d,0x7c,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x81,0x81, + 0x81,0x81,0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x84,0x85,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x8a,0x8a,0x8a, + 0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8c,0x8c,0x8d, + 0x8d,0x8d,0x8e,0x8e,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f, + 0x8f,0x8f,0x90,0x91,0x90,0x90,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91, + 0x92,0x92,0x92,0x92,0x92,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96, + 0x97,0x97,0x97,0x96,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x97,0x97,0x98,0x98, + 0x97,0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a, + 0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c, + 0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d, + 0x9c,0x9c,0x9c,0x9d,0x9d,0x9e,0x9f,0x9f,0x9f,0xa0,0xa1,0x9f,0x9d,0xa0,0xa1, + 0x9e,0x9d,0x9c,0x95,0xa5,0xc4,0x7c,0x24,0x06,0x00,0x08,0x06,0x02,0x02,0x03, + 0x04,0x00,0x07,0x39,0x7f,0xc2,0xa9,0x91,0xb3,0xae,0x84,0x2e,0x00,0x00,0x05, + 0x08,0x04,0x00,0x00,0x00,0x0d,0x7b,0xc1,0xb2,0xa1,0x82,0x30,0x00,0x00,0x00, + 0x02,0x03,0x03,0x01,0x00,0x00,0x02,0x03,0x03,0x03,0x03,0x04,0x01,0x00,0x28, + 0x53,0x45,0x3b,0x42,0x88,0xc4,0xae,0xa2,0xa5,0xa5,0xa5,0xa4,0xa7,0xac,0xa9, + 0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa8,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xa9,0xa8,0xa8, + 0xa8,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa8,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9, + 0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa8,0xa8,0xc8,0x4e,0x4e,0x4f,0x50,0x51, + 0x52,0x53,0x53,0x53,0x54,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x55,0x56,0x56, + 0x56,0x56,0x57,0x57,0x58,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b, + 0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x60,0x61,0x62, + 0x62,0x62,0x62,0x62,0x61,0x61,0x61,0x62,0x62,0x63,0x63,0x63,0x63,0x63,0x64, + 0x65,0x65,0x65,0x65,0x65,0x63,0x63,0x64,0x65,0x66,0x67,0x69,0x6a,0x69,0x67, + 0x69,0x69,0x6a,0x6a,0x69,0x69,0x6a,0x6b,0x6b,0x6b,0x6a,0x6c,0x6d,0x6e,0x6e, + 0x6d,0x6d,0x6d,0x6d,0x6d,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x71,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76, + 0x76,0x76,0x76,0x77,0x76,0x76,0x75,0x76,0x77,0x78,0x79,0x79,0x7a,0x7a,0x7a, + 0x7a,0x7a,0x79,0x79,0x79,0x79,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c, + 0x7e,0x7f,0x7e,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x81,0x82, + 0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x84,0x84,0x84,0x84,0x84,0x85,0x86,0x86, + 0x87,0x87,0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x89,0x88,0x89,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x90, + 0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x91,0x91,0x91,0x92,0x92, + 0x92,0x92,0x93,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x97,0x97,0x97,0x97,0x97,0x98,0x98, + 0x99,0x99,0x98,0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9f,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e, + 0x9f,0x9e,0x9e,0x9d,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0x9d,0x9d,0xa0,0xa2,0xa1,0x97,0xa6,0xc5,0x93,0x49,0x12,0x00,0x03,0x02,0x00, + 0x02,0x05,0x07,0x00,0x02,0x15,0x5f,0xc0,0xaf,0x9a,0xc1,0x99,0x3d,0x0f,0x00, + 0x04,0x05,0x02,0x02,0x02,0x00,0x00,0x04,0x70,0xbc,0xbe,0xa6,0x75,0x28,0x00, + 0x02,0x03,0x02,0x01,0x01,0x02,0x02,0x02,0x01,0x01,0x01,0x00,0x00,0x05,0x04, + 0x00,0x09,0x12,0x10,0x0b,0x0b,0x45,0x8a,0xb3,0xb8,0x9f,0xa3,0xaa,0xa6,0xa4, + 0xa7,0xa9,0xa9,0xa6,0xa5,0xa6,0xaa,0xae,0xad,0xa9,0xa3,0xa3,0xa4,0xa8,0xa9, + 0xa7,0xa7,0xa7,0xa7,0xa8,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xaa, + 0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab, + 0xab,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xa9,0xaa,0xab,0xab,0xaa,0xaa,0xab,0xab,0xab,0xab,0xac, + 0xac,0xab,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xa9,0xa8,0xa8,0xc8,0x4f,0x4f,0x50, + 0x50,0x51,0x52,0x53,0x53,0x53,0x54,0x54,0x53,0x53,0x53,0x53,0x53,0x54,0x55, + 0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x59,0x5a,0x59,0x5a,0x5a,0x5b,0x5b,0x5a, + 0x5a,0x5b,0x5b,0x5c,0x5d,0x5c,0x5b,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f, + 0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x61,0x62,0x62,0x63,0x63,0x63,0x63,0x63, + 0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x68,0x69,0x6a, + 0x69,0x69,0x69,0x6a,0x6c,0x6c,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d, + 0x6e,0x6e,0x6e,0x6e,0x6e,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x70,0x71,0x72,0x73,0x74,0x74,0x74,0x75,0x75,0x74,0x74,0x74,0x74,0x75, + 0x75,0x76,0x77,0x78,0x78,0x78,0x77,0x77,0x77,0x77,0x78,0x79,0x7a,0x7a,0x7a, + 0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7b,0x7b, + 0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x81,0x81, + 0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x84,0x84,0x85,0x86,0x85,0x85,0x85,0x86, + 0x86,0x87,0x87,0x88,0x89,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x89,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x90, + 0x90,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x93,0x94,0x94,0x93,0x92,0x93,0x93, + 0x93,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x97,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x99,0x99,0x99,0x99,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0x9f,0x9f,0x9e,0x9e,0x9f,0xa0,0xa1,0xa1,0xa1,0xa1,0xa0,0x9f, + 0xa0,0xa2,0x9f,0x9f,0xa2,0xa3,0xa1,0x98,0xa3,0xbe,0xa8,0x74,0x1e,0x00,0x00, + 0x03,0x04,0x03,0x04,0x07,0x03,0x00,0x00,0x49,0xbb,0xb2,0xa2,0xc8,0x8d,0x19, + 0x00,0x01,0x06,0x03,0x00,0x01,0x03,0x03,0x00,0x02,0x5a,0xa5,0xc2,0xad,0x73, + 0x26,0x00,0x02,0x03,0x02,0x01,0x01,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00, + 0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x16,0x50,0xab,0xc4,0xa1,0xa4,0xab, + 0xa7,0xa4,0xa6,0xa9,0xaa,0xa7,0xa7,0xa8,0xaa,0xaa,0xaa,0xaa,0xa8,0xa6,0xa6, + 0xa8,0xa9,0xa8,0xa9,0xa9,0xa8,0xa9,0xaa,0xab,0xab,0xaa,0xab,0xab,0xab,0xab, + 0xab,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xab,0xab, + 0xab,0xac,0xab,0xab,0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xab,0xaa,0xab,0xab, + 0xab,0xab,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xac,0xab,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xad,0xad,0xac,0xac,0xac,0xac,0xab, + 0xab,0xac,0xac,0xab,0xab,0xab,0xab,0xab,0xaa,0xaa,0xa9,0xa8,0xa8,0xc8,0x51, + 0x51,0x52,0x52,0x52,0x51,0x51,0x52,0x53,0x53,0x54,0x54,0x53,0x53,0x55,0x56, + 0x57,0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x59,0x5a,0x57,0x59,0x5b,0x5c, + 0x5c,0x5a,0x5a,0x5a,0x5d,0x5e,0x5e,0x5c,0x5a,0x5c,0x5e,0x5f,0x60,0x60,0x5f, + 0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x62,0x62,0x62,0x62,0x63,0x64,0x64,0x64, + 0x64,0x63,0x63,0x64,0x65,0x65,0x66,0x67,0x67,0x68,0x68,0x68,0x68,0x68,0x68, + 0x68,0x69,0x69,0x69,0x6a,0x6b,0x6d,0x6d,0x6d,0x6b,0x6b,0x6c,0x6d,0x6d,0x6e, + 0x6e,0x6d,0x6e,0x6f,0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x71,0x71,0x71,0x71, + 0x72,0x73,0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x75,0x76,0x76,0x76,0x76,0x75, + 0x74,0x74,0x74,0x75,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x7a,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d, + 0x7e,0x7e,0x7e,0x7d,0x7d,0x7d,0x7f,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81, + 0x82,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x84,0x85,0x86,0x86,0x86,0x86, + 0x86,0x86,0x86,0x86,0x86,0x88,0x89,0x88,0x87,0x87,0x87,0x88,0x89,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8d,0x8d,0x8e,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x91,0x91, + 0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x94,0x95,0x95,0x94,0x93,0x93, + 0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x96, + 0x96,0x96,0x96,0x97,0x98,0x99,0x9a,0x9a,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a, + 0x9a,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9b,0x9b,0x9b,0x9c,0x9e,0x9f,0x9f, + 0x9f,0x9f,0x9f,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0x9f,0x9f,0xa0,0xa0,0xa2,0xa2,0xa2,0xa1, + 0xa0,0x9f,0xa0,0xa2,0xa3,0xa3,0xa3,0xa3,0xa0,0x99,0xa0,0xb1,0xb9,0x9d,0x29, + 0x00,0x00,0x07,0x0b,0x03,0x02,0x05,0x04,0x02,0x00,0x3d,0xb2,0xb4,0xa9,0xc8, + 0x88,0x15,0x00,0x01,0x03,0x01,0x00,0x00,0x03,0x05,0x00,0x03,0x3f,0x82,0xbe, + 0xb4,0x7a,0x2a,0x00,0x00,0x00,0x02,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x00,0x00,0x01,0x01,0x02,0x09,0x07,0x00,0x00,0x20,0x99,0xc7,0xaa, + 0xa7,0xa8,0xa7,0xa7,0xa9,0xa9,0xa9,0xaa,0xab,0xab,0xa7,0xa2,0xa3,0xa9,0xb0, + 0xad,0xa9,0xa7,0xa8,0xa9,0xac,0xad,0xaa,0xaa,0xac,0xac,0xab,0xaa,0xab,0xad, + 0xab,0xaa,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xab,0xac, + 0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xad,0xad,0xad,0xae,0xae,0xae,0xac,0xab, + 0xac,0xac,0xac,0xab,0xab,0xaa,0xaa,0xab,0xac,0xac,0xac,0xac,0xab,0xab,0xac, + 0xad,0xad,0xac,0xab,0xab,0xab,0xab,0xac,0xac,0xad,0xaf,0xae,0xae,0xad,0xad, + 0xac,0xac,0xac,0xab,0xab,0xaa,0xaa,0xaa,0xab,0xab,0xaa,0xaa,0xa9,0xa8,0xa8, + 0xc8,0x50,0x50,0x52,0x53,0x53,0x53,0x52,0x51,0x51,0x52,0x53,0x54,0x54,0x55, + 0x56,0x57,0x57,0x57,0x56,0x56,0x57,0x57,0x57,0x57,0x57,0x59,0x5a,0x58,0x59, + 0x5b,0x5c,0x5c,0x5a,0x5a,0x5b,0x5e,0x5e,0x5e,0x5d,0x5b,0x5d,0x5e,0x60,0x61, + 0x62,0x61,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64, + 0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x67, + 0x67,0x68,0x68,0x69,0x69,0x69,0x69,0x6b,0x6c,0x6c,0x6b,0x6a,0x6a,0x6a,0x6c, + 0x6d,0x6d,0x6d,0x6d,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72, + 0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x76,0x76,0x76,0x76,0x76, + 0x76,0x77,0x76,0x75,0x75,0x76,0x77,0x78,0x79,0x79,0x79,0x79,0x79,0x7a,0x7b, + 0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7f,0x7e, + 0x7e,0x7f,0x7f,0x7f,0x7f,0x7e,0x7d,0x7d,0x7e,0x7f,0x81,0x82,0x82,0x82,0x82, + 0x82,0x82,0x82,0x82,0x83,0x84,0x84,0x84,0x84,0x84,0x84,0x85,0x86,0x86,0x86, + 0x86,0x87,0x87,0x87,0x86,0x87,0x87,0x89,0x89,0x88,0x88,0x88,0x88,0x89,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x90,0x8f,0x90,0x91, + 0x91,0x91,0x90,0x91,0x91,0x92,0x91,0x91,0x91,0x92,0x93,0x94,0x95,0x95,0x94, + 0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x97, + 0x97,0x97,0x97,0x97,0x97,0x98,0x99,0x9a,0x9b,0x9b,0x9a,0x9a,0x9a,0x9a,0x9a, + 0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9c,0x9c,0x9c,0x9e,0x9f, + 0xa0,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa3, + 0xa3,0xa2,0xa2,0xa3,0xa3,0xa3,0xa0,0xa0,0xa2,0xa5,0xa6,0x9e,0x9e,0xa7,0xbe, + 0xae,0x2f,0x00,0x00,0x03,0x07,0x03,0x03,0x05,0x06,0x03,0x00,0x36,0xa9,0xb3, + 0xac,0xc2,0x87,0x1d,0x03,0x00,0x05,0x05,0x01,0x01,0x03,0x05,0x00,0x00,0x36, + 0x7a,0xbf,0xb5,0x79,0x28,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x02,0x01,0x02,0x03,0x03,0x03,0x06,0x05,0x01,0x00,0x11,0x8d, + 0xc0,0xac,0xa7,0xa5,0xa6,0xa8,0xab,0xaa,0xa9,0xa8,0xa7,0xa6,0xaa,0xab,0xa8, + 0xa6,0xa5,0xa6,0xa6,0xa3,0xa1,0xa1,0xa9,0xae,0xab,0xaa,0xaa,0xa9,0xaa,0xac, + 0xab,0xa9,0xaa,0xac,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xab,0xac,0xac, + 0xac,0xac,0xac,0xac,0xac,0xac,0xad,0xac,0xad,0xad,0xad,0xad,0xad,0xae,0xae, + 0xad,0xac,0xad,0xad,0xad,0xad,0xac,0xac,0xac,0xad,0xad,0xad,0xad,0xad,0xad, + 0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xad,0xad,0xad,0xae,0xae,0xae,0xae,0xae, + 0xad,0xac,0xab,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xa9,0xaa,0xaa,0xa9,0xa8,0xa7, + 0xa7,0xa7,0xc8,0x4f,0x4f,0x52,0x53,0x54,0x53,0x53,0x51,0x50,0x51,0x53,0x53, + 0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x57,0x57,0x58,0x57,0x57,0x57,0x5a,0x5a, + 0x58,0x59,0x5b,0x5c,0x5c,0x5b,0x5b,0x5c,0x5e,0x5e,0x5e,0x5e,0x5c,0x5e,0x5f, + 0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x62,0x62,0x62,0x62,0x62, + 0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x68,0x67,0x66,0x66,0x66, + 0x66,0x67,0x68,0x68,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6b,0x6a,0x69, + 0x69,0x6b,0x6d,0x6d,0x6d,0x6d,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x71,0x71, + 0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x77,0x77,0x77,0x77, + 0x76,0x76,0x77,0x78,0x78,0x77,0x77,0x78,0x78,0x78,0x79,0x79,0x7a,0x7a,0x7a, + 0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f, + 0x80,0x7f,0x7f,0x7f,0x80,0x80,0x7f,0x7f,0x7e,0x7e,0x7f,0x7f,0x81,0x82,0x82, + 0x82,0x82,0x82,0x82,0x83,0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86, + 0x86,0x86,0x87,0x87,0x87,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8f,0x8f,0x90,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x90, + 0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x91,0x92,0x92,0x94,0x95,0x95, + 0x95,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96, + 0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x9b,0x9b,0x9a,0x9a,0x9a, + 0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9d,0x9e,0x9f, + 0x9f,0xa0,0xa0,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa1,0xa1,0xa0,0xa1,0xa2, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa6,0xa6,0xa3,0x9f,0x9e,0xa1,0xa7,0xa9,0xa2,0x9f, + 0xa2,0xbd,0xb5,0x3a,0x00,0x00,0x00,0x02,0x03,0x03,0x04,0x07,0x05,0x00,0x2f, + 0x95,0xaf,0xb4,0xbd,0x81,0x20,0x03,0x00,0x07,0x07,0x02,0x02,0x03,0x03,0x00, + 0x00,0x2f,0x70,0xbe,0xb9,0x7c,0x28,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x02,0x03,0x03,0x03,0x04,0x04,0x03,0x03,0x03,0x00, + 0x0c,0x76,0xae,0xb1,0xaa,0xa3,0xa7,0xaa,0xac,0xab,0xaa,0xa7,0xa6,0xa4,0xaa, + 0xae,0xab,0xa7,0xa5,0xa8,0xab,0xaa,0xa5,0xa0,0xa7,0xad,0xad,0xab,0xaa,0xa9, + 0xaa,0xae,0xab,0xa7,0xab,0xad,0xab,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xac, + 0xad,0xad,0xad,0xad,0xac,0xac,0xac,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad, + 0xad,0xad,0xad,0xad,0xae,0xae,0xae,0xae,0xad,0xad,0xad,0xae,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xad,0xad,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa8, + 0xa7,0xa7,0xa7,0xa7,0xc8,0x50,0x50,0x52,0x53,0x53,0x53,0x52,0x52,0x52,0x53, + 0x53,0x54,0x54,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x58,0x58,0x59, + 0x5a,0x5a,0x59,0x59,0x5a,0x5b,0x5b,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x61,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x64,0x64,0x63,0x63,0x63, + 0x63,0x63,0x64,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x66,0x68,0x6a,0x6a,0x69, + 0x69,0x69,0x69,0x69,0x69,0x6b,0x6c,0x6c,0x6c,0x6c,0x6c,0x6d,0x6d,0x6e,0x6d, + 0x6c,0x6c,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x72,0x72,0x73,0x72,0x72, + 0x71,0x71,0x72,0x73,0x74,0x74,0x74,0x73,0x74,0x75,0x76,0x76,0x77,0x77,0x77, + 0x77,0x77,0x77,0x76,0x78,0x79,0x79,0x78,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7e,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x80,0x81, + 0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x84,0x85,0x85,0x86,0x86,0x86,0x86,0x87, + 0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e, + 0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x93,0x94,0x94,0x93,0x93,0x93,0x94,0x95, + 0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x97,0x97,0x96,0x96,0x96,0x97,0x97, + 0x97,0x97,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x9a,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0x9f,0x9f,0x9f, + 0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2,0xa2, + 0xa2,0xa3,0xa3,0xa4,0xa5,0xa4,0xa4,0xa6,0xa4,0xa3,0xa3,0xa4,0xa5,0xa4,0xa3, + 0xa4,0xa3,0xa3,0xbf,0xb9,0x4b,0x0b,0x02,0x00,0x03,0x03,0x02,0x02,0x06,0x07, + 0x00,0x21,0x6f,0xa9,0xc5,0xb8,0x6d,0x07,0x00,0x01,0x04,0x04,0x02,0x02,0x02, + 0x03,0x00,0x03,0x1e,0x59,0xba,0xc2,0x8b,0x2f,0x00,0x05,0x06,0x03,0x03,0x03, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x05,0x05, + 0x04,0x00,0x07,0x48,0x8a,0xbf,0xb6,0xa3,0xaa,0xac,0xa9,0xaa,0xab,0xaa,0xad, + 0xaf,0xa3,0x9b,0xa1,0xb2,0xc8,0xc8,0xc8,0xc8,0xc4,0xb5,0xac,0xa8,0xab,0xaa, + 0xaa,0xaf,0xb2,0xac,0xad,0xaf,0xae,0xad,0xac,0xac,0xab,0xab,0xab,0xac,0xac, + 0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xad,0xad,0xae,0xae, + 0xae,0xad,0xae,0xaf,0xaf,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xad,0xad,0xac, + 0xac,0xab,0xab,0xab,0xaa,0xa9,0xa9,0xa9,0xa9,0xa9,0xa8,0xa8,0xa7,0xa7,0xa8, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xc8,0x51,0x51,0x51,0x51,0x51,0x51,0x52,0x53, + 0x53,0x54,0x54,0x54,0x53,0x54,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x59, + 0x59,0x59,0x5a,0x5b,0x5a,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e, + 0x5e,0x5e,0x5f,0x60,0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x64,0x64,0x64,0x63, + 0x63,0x63,0x63,0x64,0x64,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x69,0x6b, + 0x6b,0x6a,0x69,0x69,0x69,0x69,0x6a,0x6c,0x6d,0x6d,0x6d,0x6d,0x6c,0x6d,0x6e, + 0x6e,0x6e,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x73,0x73, + 0x73,0x72,0x71,0x71,0x72,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x77, + 0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x7a,0x7a,0x79,0x79,0x79,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7e, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x81,0x81,0x81,0x81,0x82, + 0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x84,0x84,0x85,0x85,0x86,0x86,0x86,0x86, + 0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8b,0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8f, + 0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x92,0x93,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95, + 0x95,0x95,0x96,0x97,0x96,0x96,0x96,0x96,0x96,0x97,0x97,0x98,0x98,0x98,0x98, + 0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x9a,0x9a,0x9a,0x99,0x99,0x9a,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d, + 0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0x9f, + 0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa2,0xa3,0xa3,0xa2,0xa2, + 0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa4,0xa3,0xa7,0xa8,0xa7, + 0xa3,0xa2,0xa6,0xa4,0xa0,0xbb,0xbe,0x6a,0x29,0x04,0x00,0x04,0x04,0x03,0x01, + 0x03,0x05,0x00,0x16,0x4c,0x9c,0xc8,0xc1,0x73,0x07,0x00,0x01,0x02,0x02,0x01, + 0x01,0x02,0x01,0x00,0x03,0x0a,0x3e,0xb2,0xc7,0x97,0x33,0x00,0x04,0x05,0x03, + 0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x02, + 0x04,0x06,0x07,0x00,0x03,0x20,0x65,0xbe,0xbc,0xa7,0xaa,0xab,0xaa,0xaa,0xab, + 0xae,0xaf,0xaf,0xa7,0xa6,0xb5,0xb1,0xa0,0x95,0x90,0x92,0xa3,0xb9,0xb4,0xac, + 0xaa,0xaa,0xab,0xaf,0xb1,0xae,0xae,0xaf,0xae,0xae,0xae,0xae,0xad,0xad,0xad, + 0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xaf,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xae, + 0xae,0xae,0xae,0xad,0xae,0xae,0xae,0xad,0xad,0xac,0xac,0xac,0xac,0xac,0xab, + 0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xc8,0x51,0x51,0x50,0x50,0x50,0x51, + 0x52,0x53,0x54,0x55,0x55,0x55,0x53,0x53,0x55,0x56,0x57,0x57,0x57,0x57,0x58, + 0x59,0x59,0x59,0x59,0x5b,0x5c,0x5a,0x5a,0x5a,0x5a,0x5b,0x5d,0x5d,0x5e,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x60,0x5f,0x60,0x60,0x62,0x62,0x63,0x64, + 0x64,0x64,0x63,0x63,0x64,0x64,0x65,0x65,0x66,0x67,0x67,0x66,0x66,0x67,0x68, + 0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6b,0x6b,0x6c,0x6d,0x6d,0x6a, + 0x6b,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x6f,0x6f,0x70,0x71,0x73, + 0x74,0x74,0x73,0x73,0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x75,0x75,0x76, + 0x76,0x76,0x76,0x76,0x77,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x7a,0x7a,0x7a,0x7b, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7e, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x81,0x81,0x82,0x82,0x82, + 0x83,0x83,0x83,0x83,0x83,0x83,0x83,0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x86, + 0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f, + 0x8f,0x8f,0x90,0x90,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x92,0x92,0x92,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x96,0x97,0x97,0x98,0x98,0x98,0x97,0x97,0x97,0x97,0x98,0x98,0x98, + 0x98,0x98,0x99,0x9a,0x9a,0x9b,0x9a,0x99,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x9a, + 0x9b,0x9c,0x9c,0x9c,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, + 0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa2,0xa3,0xa4,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa3,0xa4, + 0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa5,0xa6,0xa6,0xa6,0xa5,0xa3,0xa3,0xa6,0xa8, + 0xa7,0xa5,0xa5,0xa6,0xa7,0xa3,0x9a,0xb4,0xc0,0x91,0x4e,0x06,0x00,0x05,0x06, + 0x04,0x01,0x00,0x01,0x02,0x0e,0x2f,0x8b,0xc8,0xc8,0x87,0x19,0x00,0x00,0x01, + 0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x24,0xa7,0xc8,0xa0,0x36,0x00,0x00, + 0x02,0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x04,0x0a,0x05,0x02,0x03,0x43,0xb0,0xbc,0xab,0xa8,0xaa,0xae, + 0xac,0xab,0xaf,0xad,0xa7,0xb3,0xc3,0xc8,0x9c,0x41,0x26,0x1e,0x1b,0x53,0xa3, + 0xb8,0xb7,0xac,0xaa,0xae,0xaa,0xab,0xb0,0xae,0xa9,0xac,0xae,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xad,0xac,0xab,0xaa,0xaa,0xaa,0xab,0xab, + 0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa8,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa5,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xc8,0x50,0x50,0x50,0x50, + 0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x55,0x55,0x54,0x56,0x57,0x57,0x57, + 0x57,0x58,0x59,0x59,0x58,0x58,0x5a,0x5b,0x5b,0x5b,0x5a,0x5b,0x5c,0x5d,0x5e, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x60,0x5f,0x60,0x61,0x62,0x62, + 0x63,0x64,0x65,0x65,0x64,0x64,0x64,0x65,0x65,0x66,0x67,0x66,0x66,0x65,0x66, + 0x67,0x69,0x69,0x68,0x68,0x68,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6d, + 0x6d,0x6b,0x6b,0x6d,0x6e,0x6f,0x6e,0x6f,0x70,0x70,0x70,0x70,0x6f,0x6f,0x71, + 0x73,0x74,0x74,0x74,0x74,0x73,0x73,0x74,0x74,0x75,0x75,0x75,0x75,0x75,0x76, + 0x76,0x77,0x77,0x77,0x77,0x77,0x78,0x78,0x7a,0x7b,0x7b,0x7b,0x7a,0x7a,0x7a, + 0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x82,0x82, + 0x83,0x83,0x84,0x84,0x84,0x84,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x87,0x87,0x87,0x87,0x88,0x89,0x88,0x89,0x89,0x89,0x89,0x89,0x89,0x89, + 0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e, + 0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x90,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x96,0x97,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x99,0x99,0x9a,0x9a,0x9b,0x9c,0x9c,0x9a,0x9a,0x9b,0x9c,0x9c,0x9c,0x9b, + 0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9b,0x9c,0x9c,0x9c,0x9d,0x9e,0x9d,0x9e, + 0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa0,0xa1,0xa2,0xa3,0xa3,0xa3,0xa4, + 0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa5,0xa5,0xa4, + 0xa4,0xa4,0xa5,0xa5,0xa4,0xa4,0xa3,0xa4,0xa5,0xa6,0xa7,0xa7,0xa6,0xa3,0xa3, + 0xa5,0xa7,0xa7,0xa4,0xa5,0xa7,0xa8,0xa3,0x9c,0xae,0xba,0xa0,0x5f,0x05,0x00, + 0x07,0x05,0x03,0x00,0x01,0x03,0x04,0x03,0x0e,0x7a,0xc8,0xb7,0x6f,0x11,0x00, + 0x00,0x00,0x00,0x03,0x03,0x02,0x01,0x01,0x00,0x00,0x1f,0xa4,0xc8,0xa6,0x39, + 0x00,0x00,0x02,0x00,0x01,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x02,0x07,0x06,0x03,0x00,0x32,0xa0,0xb8,0xb2,0xa7, + 0xa7,0xae,0xae,0xac,0xa9,0xaa,0xb0,0xb8,0xb3,0x98,0x5d,0x14,0x03,0x01,0x00, + 0x18,0x4b,0x97,0xc4,0xb5,0xaf,0xaf,0xac,0xab,0xb0,0xae,0xab,0xad,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf, + 0xaf,0xaf,0xb0,0xb0,0xb0,0xb0,0xb0,0xb0,0xaf,0xaf,0xae,0xae,0xaf,0xaf,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xac,0xab,0xaa,0xaa,0xaa, + 0xab,0xac,0xac,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa8,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa5,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xc8,0x4e,0x4e, + 0x50,0x51,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x54,0x57,0x56,0x54,0x56,0x57, + 0x57,0x57,0x57,0x58,0x59,0x58,0x58,0x58,0x59,0x5a,0x5c,0x5c,0x5b,0x5c,0x5c, + 0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x61,0x62,0x61,0x61,0x60,0x61,0x62, + 0x62,0x63,0x64,0x65,0x65,0x65,0x65,0x64,0x65,0x65,0x66,0x67,0x67,0x65,0x65, + 0x65,0x65,0x66,0x68,0x69,0x67,0x68,0x68,0x69,0x69,0x69,0x6a,0x6b,0x6a,0x6b, + 0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x70,0x6f,0x70,0x70,0x70,0x70,0x70,0x70, + 0x70,0x72,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x75,0x76, + 0x76,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x7b,0x7a, + 0x7a,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7f, + 0x7f,0x7f,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x82,0x83,0x82,0x82,0x82,0x82, + 0x82,0x83,0x84,0x84,0x84,0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x87, + 0x87,0x87,0x87,0x87,0x88,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8e,0x8e, + 0x8e,0x8e,0x8f,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91, + 0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x93,0x93,0x94,0x95,0x95,0x95,0x95,0x95, + 0x95,0x95,0x95,0x96,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x99,0x99,0x99,0x9a,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9b,0x9a,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9e, + 0x9e,0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa1,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa1,0xa1,0xa2,0xa3,0xa3,0xa4, + 0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa5,0xa5, + 0xa5,0xa5,0xa4,0xa5,0xa5,0xa5,0xa5,0xa4,0xa4,0xa5,0xa6,0xa7,0xa7,0xa7,0xa6, + 0xa5,0xa4,0xa4,0xa6,0xa7,0xa4,0xa5,0xa7,0xa7,0xa5,0xa1,0xaa,0xb2,0xab,0x6e, + 0x09,0x00,0x05,0x03,0x02,0x00,0x02,0x05,0x05,0x00,0x00,0x6d,0xc0,0x99,0x53, + 0x05,0x00,0x02,0x00,0x01,0x04,0x03,0x02,0x02,0x02,0x02,0x00,0x1f,0x9f,0xc8, + 0xae,0x3c,0x00,0x00,0x02,0x01,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x05,0x06,0x00,0x2a,0x95,0xb5, + 0xb8,0xa9,0xa6,0xad,0xaf,0xae,0xa4,0xad,0xbd,0xa5,0x7e,0x4c,0x22,0x02,0x00, + 0x00,0x00,0x00,0x02,0x6d,0xbd,0xbb,0xb5,0xae,0xad,0xae,0xae,0xaf,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xae,0xae,0xae,0xae,0xae,0xae, + 0xaf,0xb0,0xb0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb0,0xaf,0xae,0xaf, + 0xaf,0xae,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xae,0xae,0xac,0xac, + 0xab,0xab,0xac,0xac,0xac,0xac,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa8, + 0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xc8, + 0x4f,0x4f,0x50,0x50,0x51,0x53,0x53,0x53,0x54,0x53,0x54,0x55,0x56,0x56,0x55, + 0x57,0x57,0x57,0x58,0x58,0x59,0x5a,0x58,0x57,0x57,0x59,0x5a,0x5c,0x5c,0x5c, + 0x5c,0x5c,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x61,0x61,0x61,0x61,0x62, + 0x62,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66,0x66,0x66, + 0x65,0x65,0x65,0x65,0x66,0x68,0x69,0x68,0x69,0x6a,0x6b,0x6c,0x6c,0x6d,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x72, + 0x72,0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x77,0x77, + 0x76,0x76,0x77,0x77,0x78,0x78,0x79,0x79,0x79,0x79,0x79,0x79,0x79,0x79,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x7e,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x80,0x80,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x84,0x84,0x84, + 0x84,0x83,0x83,0x84,0x84,0x85,0x85,0x84,0x84,0x86,0x87,0x87,0x87,0x87,0x87, + 0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8a,0x8a,0x8b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x90,0x90, + 0x90,0x90,0x8f,0x8f,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92, + 0x92,0x92,0x93,0x93,0x93,0x93,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x96,0x95,0x95,0x95,0x95,0x96,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x98, + 0x99,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9d,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9c,0x9d,0x9d,0x9e,0x9e, + 0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa2,0xa1,0xa1,0xa1,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa2,0xa3, + 0xa3,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5, + 0xa5,0xa6,0xa6,0xa5,0xa5,0xa5,0xa6,0xa6,0xa5,0xa5,0xa5,0xa6,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa3,0xa2,0xa7,0xa9,0xa7,0xa5,0xa3,0xa5,0xa7,0xaa,0xa9,0xaa, + 0xbb,0x86,0x15,0x00,0x00,0x03,0x03,0x02,0x03,0x03,0x03,0x00,0x00,0x6c,0xb8, + 0x8c,0x48,0x02,0x00,0x0a,0x06,0x02,0x00,0x00,0x01,0x00,0x01,0x03,0x00,0x1d, + 0x93,0xc7,0xb8,0x40,0x00,0x00,0x01,0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x02,0x02,0x01,0x01,0x01,0x04,0x03,0x00,0x03,0x05,0x00,0x2a, + 0x95,0xba,0xbe,0xac,0xa5,0xa9,0xad,0xae,0xaa,0xba,0xc8,0x68,0x12,0x0b,0x0a, + 0x0a,0x03,0x02,0x0b,0x03,0x00,0x48,0x91,0xb9,0xbb,0xa7,0xac,0xb0,0xac,0xad, + 0xaf,0xac,0xab,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xb0, + 0xb1,0xb1,0xb1,0xb0,0xb0,0xb0,0xb1,0xb2,0xb2,0xb2,0xb1,0xb0,0xb0,0xb1,0xb0, + 0xaf,0xae,0xad,0xad,0xac,0xac,0xac,0xab,0xaa,0xa9,0xa9,0xa8,0xa9,0xa9,0xa9, + 0xa9,0xa8,0xa8,0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa5,0xa5,0xa6,0xa6,0xa7,0xa7, + 0xa7,0xc8,0x50,0x50,0x50,0x50,0x50,0x51,0x53,0x54,0x55,0x55,0x55,0x55,0x55, + 0x56,0x56,0x57,0x58,0x58,0x58,0x58,0x5a,0x5a,0x59,0x58,0x57,0x59,0x5a,0x5b, + 0x5c,0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x61, + 0x61,0x62,0x63,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x66, + 0x66,0x66,0x65,0x65,0x65,0x66,0x67,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6d, + 0x6d,0x6d,0x6d,0x6e,0x6e,0x6d,0x6e,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x71, + 0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x76, + 0x77,0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x79,0x79,0x79,0x79, + 0x79,0x79,0x7b,0x7b,0x7b,0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x80,0x81, + 0x80,0x7f,0x80,0x80,0x81,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x83,0x84, + 0x84,0x84,0x84,0x83,0x83,0x84,0x85,0x86,0x86,0x85,0x85,0x86,0x87,0x88,0x87, + 0x87,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8b, + 0x8b,0x8b,0x8c,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f, + 0x90,0x91,0x90,0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92, + 0x92,0x92,0x93,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x95,0x96,0x96,0x96,0x95,0x95,0x96,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x99, + 0x99,0x9a,0x9a,0x9a,0x9b,0x9c,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9e,0x9f,0x9f,0x9e,0x9e,0x9e,0x9e, + 0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa1, + 0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2, + 0xa2,0xa3,0xa3,0xa4,0xa4,0xa4,0xa3,0xa3,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5, + 0xa6,0xa6,0xa6,0xa7,0xa7,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa5,0xa3,0xa7,0xa9,0xa8,0xa7,0xa6,0xa4,0xa6,0xaa, + 0xa7,0xa9,0xc4,0x95,0x27,0x04,0x00,0x03,0x04,0x02,0x03,0x03,0x02,0x00,0x00, + 0x65,0xa6,0x6e,0x32,0x00,0x01,0x09,0x06,0x03,0x01,0x01,0x01,0x00,0x02,0x04, + 0x00,0x19,0x80,0xbd,0xc0,0x44,0x00,0x00,0x01,0x03,0x02,0x01,0x00,0x00,0x00, + 0x00,0x00,0x01,0x02,0x03,0x02,0x02,0x01,0x00,0x01,0x03,0x03,0x01,0x03,0x05, + 0x00,0x28,0x8a,0xb8,0xc4,0xae,0xa5,0xaa,0xae,0xae,0xaa,0xbb,0xc8,0x80,0x30, + 0x04,0x00,0x0a,0x07,0x05,0x0c,0x04,0x00,0x2c,0x6d,0xb8,0xc0,0xa4,0xab,0xb1, + 0xae,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xaf,0xb0,0xb0,0xb0, + 0xb0,0xb0,0xb0,0xb0,0xb0,0xb0,0xb0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, + 0xb1,0xb2,0xb3,0xb3,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb3,0xb2,0xb2,0xb1,0xb1, + 0xb2,0xb1,0xaf,0xae,0xad,0xac,0xac,0xab,0xaa,0xaa,0xa9,0xa7,0xa7,0xa8,0xa8, + 0xa9,0xa9,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6,0xa5,0xa4,0xa5,0xa6, + 0xa7,0xa7,0xa7,0xc8,0x52,0x52,0x50,0x4f,0x4f,0x50,0x52,0x54,0x56,0x56,0x56, + 0x55,0x54,0x55,0x57,0x57,0x58,0x59,0x59,0x59,0x5a,0x5a,0x59,0x58,0x58,0x5a, + 0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f, + 0x60,0x60,0x61,0x62,0x63,0x65,0x65,0x65,0x65,0x64,0x64,0x64,0x65,0x66,0x65, + 0x65,0x65,0x66,0x66,0x66,0x66,0x67,0x67,0x68,0x69,0x69,0x6a,0x6a,0x6a,0x6a, + 0x6b,0x6c,0x6d,0x6d,0x6e,0x6e,0x6d,0x6d,0x6d,0x6f,0x70,0x70,0x70,0x70,0x70, + 0x70,0x71,0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x74,0x74,0x75, + 0x76,0x77,0x78,0x78,0x78,0x77,0x77,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x7a, + 0x7a,0x7a,0x79,0x7a,0x7b,0x7c,0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x80, + 0x81,0x82,0x80,0x80,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x83, + 0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86,0x88, + 0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x89,0x89,0x89,0x89,0x8a,0x8b,0x8b, + 0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8f,0x8f,0x8f,0x8f,0x8f, + 0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92, + 0x92,0x92,0x93,0x93,0x93,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96, + 0x95,0x95,0x95,0x96,0x96,0x97,0x96,0x96,0x96,0x98,0x99,0x99,0x99,0x99,0x99, + 0x99,0x99,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0x9f,0x9f, + 0x9f,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6, + 0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa8,0xa8,0xa8,0xa7,0xa7,0xa7,0xa7,0xa8,0xa7,0xa7,0xa9,0xab,0xab,0xa6, + 0xa3,0xa4,0xa5,0xac,0xc6,0x9c,0x38,0x0e,0x00,0x03,0x03,0x00,0x03,0x04,0x01, + 0x00,0x00,0x5c,0x92,0x4c,0x1a,0x01,0x00,0x03,0x03,0x03,0x04,0x03,0x03,0x02, + 0x03,0x04,0x00,0x13,0x68,0xae,0xc6,0x47,0x00,0x00,0x02,0x03,0x03,0x02,0x01, + 0x00,0x00,0x00,0x00,0x02,0x03,0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x02,0x05, + 0x07,0x06,0x00,0x25,0x78,0xb0,0xc8,0xad,0xa5,0xaf,0xb0,0xae,0xa9,0xb3,0xc5, + 0xc8,0x9c,0x22,0x00,0x04,0x07,0x07,0x05,0x00,0x00,0x18,0x52,0xb5,0xc4,0xa6, + 0xaa,0xb1,0xb2,0xb0,0xae,0xb4,0xb5,0xb1,0xaf,0xb0,0xb1,0xb1,0xb1,0xb1,0xb1, + 0xb1,0xb1,0xb1,0xb1,0xb1,0xb2,0xb3,0xb3,0xb3,0xb3,0xb3,0xb3,0xb4,0xb4,0xb3, + 0xb3,0xb3,0xb3,0xb4,0xb4,0xb4,0xb4,0xb3,0xb3,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, + 0xb1,0xb0,0xae,0xae,0xad,0xac,0xab,0xaa,0xaa,0xaa,0xa9,0xa8,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa8,0xa9,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa5,0xa4, + 0xa5,0xa6,0xa7,0xa7,0xa7,0xc8,0x51,0x51,0x50,0x50,0x50,0x52,0x53,0x54,0x54, + 0x54,0x54,0x54,0x55,0x56,0x56,0x57,0x58,0x58,0x59,0x5a,0x5a,0x5b,0x5a,0x59, + 0x58,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x5f,0x5f, + 0x5e,0x60,0x61,0x60,0x60,0x61,0x62,0x64,0x65,0x64,0x64,0x64,0x64,0x64,0x66, + 0x67,0x66,0x65,0x65,0x65,0x66,0x67,0x68,0x68,0x69,0x69,0x69,0x6b,0x6c,0x6c, + 0x6b,0x6a,0x6b,0x6c,0x6d,0x6f,0x70,0x6f,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f, + 0x70,0x70,0x72,0x73,0x73,0x73,0x74,0x74,0x75,0x74,0x74,0x75,0x76,0x77,0x76, + 0x76,0x76,0x77,0x78,0x78,0x79,0x79,0x78,0x78,0x78,0x78,0x79,0x79,0x7a,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f, + 0x7f,0x80,0x81,0x82,0x81,0x81,0x82,0x82,0x82,0x83,0x83,0x84,0x84,0x84,0x84, + 0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x85,0x85,0x86,0x86,0x87,0x87,0x86,0x86, + 0x87,0x8a,0x8a,0x89,0x89,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b, + 0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8e,0x8f,0x90,0x90, + 0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92, + 0x92,0x92,0x92,0x92,0x93,0x93,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x96,0x97, + 0x97,0x96,0x95,0x95,0x95,0x96,0x97,0x98,0x98,0x97,0x98,0x98,0x9a,0x9b,0x9a, + 0x9a,0x99,0x99,0x9a,0x9b,0x9b,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa3,0xa3, + 0xa4,0xa5,0xa5,0xa4,0xa4,0xa4,0xa5,0xa6,0xa7,0xa7,0xa6,0xa6,0xa6,0xa6,0xa6, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa8,0xa9,0xa9,0xa9,0xa8,0xa8,0xa8,0xa9,0xaa,0xa9,0xa9,0xa9,0xaa, + 0xaa,0xa9,0xa9,0xa9,0xa3,0xa5,0xc8,0xa2,0x3d,0x10,0x00,0x04,0x06,0x02,0x01, + 0x01,0x01,0x00,0x00,0x63,0xa0,0x5a,0x24,0x00,0x01,0x07,0x02,0x00,0x02,0x03, + 0x03,0x00,0x01,0x03,0x00,0x11,0x53,0x9e,0xc3,0x46,0x00,0x01,0x03,0x01,0x03, + 0x03,0x01,0x00,0x00,0x00,0x00,0x02,0x03,0x03,0x03,0x02,0x01,0x00,0x00,0x00, + 0x00,0x04,0x07,0x07,0x00,0x1b,0x61,0xa3,0xc8,0xaf,0xa7,0xb0,0xb0,0xae,0xaf, + 0xb4,0xb5,0x8d,0x53,0x11,0x00,0x04,0x03,0x03,0x04,0x02,0x00,0x00,0x31,0xaf, + 0xc8,0xb2,0xae,0xae,0xb2,0xb2,0xaf,0xb2,0xb3,0xb2,0xb1,0xb1,0xb2,0xb2,0xb2, + 0xb2,0xb2,0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1, + 0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb0,0xaf,0xae,0xae,0xae,0xae,0xad, + 0xac,0xaa,0xa9,0xa8,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8, + 0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xaa,0xa9,0xa9,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9, + 0xa7,0xa7,0xa7,0xa8,0xaa,0xaa,0xaa,0xc8,0x50,0x50,0x50,0x51,0x52,0x53,0x53, + 0x53,0x53,0x53,0x53,0x54,0x57,0x57,0x56,0x57,0x57,0x57,0x58,0x5a,0x5a,0x5b, + 0x5a,0x5a,0x59,0x5a,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d,0x5d,0x5e,0x5f,0x60, + 0x60,0x60,0x5f,0x60,0x61,0x60,0x60,0x61,0x62,0x64,0x64,0x63,0x63,0x63,0x64, + 0x65,0x66,0x68,0x66,0x65,0x65,0x65,0x65,0x67,0x69,0x69,0x69,0x6a,0x69,0x6b, + 0x6d,0x6d,0x6c,0x6b,0x6c,0x6d,0x6e,0x70,0x70,0x70,0x6e,0x6d,0x6d,0x6d,0x6e, + 0x6e,0x70,0x70,0x72,0x73,0x74,0x74,0x74,0x74,0x75,0x76,0x75,0x74,0x75,0x77, + 0x78,0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x7a,0x7a,0x79,0x78,0x78,0x79,0x7a, + 0x7a,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c,0x7d,0x7e,0x7e,0x7e, + 0x7e,0x7f,0x7f,0x80,0x82,0x82,0x82,0x82,0x82,0x83,0x83,0x84,0x84,0x84,0x85, + 0x85,0x85,0x85,0x85,0x86,0x87,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x88, + 0x87,0x86,0x88,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8d,0x8d,0x8e,0x8e,0x90, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x91,0x91,0x91, + 0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95, + 0x96,0x97,0x97,0x97,0x97,0x96,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x99,0x9b, + 0x9b,0x9b,0x9a,0x9a,0x9a,0x9b,0x9c,0x9b,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9d, + 0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa1,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5, + 0xa4,0xa4,0xa6,0xa6,0xa6,0xa5,0xa5,0xa5,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa8,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa8,0xa9,0xaa,0xaa,0xa9,0xa8,0xa8,0xa9,0xaa,0xaa,0xaa,0xaa, + 0xa9,0xa8,0xa8,0xac,0xae,0xac,0xa2,0xa0,0xc7,0xa7,0x4a,0x16,0x00,0x04,0x07, + 0x03,0x00,0x00,0x01,0x00,0x00,0x59,0x92,0x62,0x2d,0x00,0x03,0x0a,0x02,0x00, + 0x00,0x02,0x03,0x00,0x00,0x01,0x00,0x0e,0x40,0x8d,0xbe,0x45,0x00,0x02,0x03, + 0x01,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x03,0x03,0x02,0x01,0x00, + 0x00,0x00,0x00,0x03,0x07,0x08,0x00,0x12,0x4c,0x98,0xc8,0xb1,0xa7,0xb0,0xb0, + 0xb0,0xb1,0xb6,0xb0,0x54,0x07,0x00,0x00,0x05,0x01,0x00,0x04,0x04,0x02,0x00, + 0x19,0x9a,0xc7,0xbd,0xb2,0xac,0xb2,0xb2,0xb0,0xb0,0xb1,0xb2,0xb2,0xb2,0xb2, + 0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb0,0xb0,0xaf,0xae,0xae,0xae,0xae,0xae,0xae, + 0xad,0xad,0xac,0xad,0xad,0xad,0xad,0xad,0xad,0xac,0xab,0xaa,0xaa,0xa9,0xa9, + 0xa9,0xa8,0xa7,0xa6,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa8,0xa9,0xa9, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xab,0xab,0xaa,0xaa,0xac,0xad,0xae,0xae,0xad,0xc8,0x4f,0x4f,0x50,0x51,0x53, + 0x53,0x53,0x53,0x53,0x53,0x53,0x55,0x56,0x57,0x56,0x57,0x57,0x57,0x57,0x58, + 0x5a,0x5b,0x5b,0x5a,0x5a,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f, + 0x60,0x61,0x61,0x60,0x60,0x5f,0x5f,0x60,0x62,0x63,0x64,0x65,0x64,0x63,0x62, + 0x63,0x63,0x64,0x66,0x68,0x68,0x67,0x67,0x66,0x66,0x67,0x68,0x69,0x69,0x69, + 0x68,0x69,0x6d,0x6d,0x6d,0x6c,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x6f,0x6f, + 0x6f,0x70,0x70,0x72,0x73,0x74,0x74,0x73,0x73,0x73,0x74,0x74,0x75,0x74,0x74, + 0x74,0x74,0x75,0x75,0x75,0x76,0x77,0x77,0x77,0x77,0x77,0x79,0x7b,0x79,0x78, + 0x78,0x7b,0x7c,0x7d,0x7c,0x7b,0x7b,0x7b,0x7d,0x7e,0x7d,0x7e,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x80,0x81,0x82,0x82,0x83,0x83,0x83,0x83,0x83,0x84,0x85,0x85, + 0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x87,0x87,0x87,0x89, + 0x8a,0x8a,0x89,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8a,0x8a,0x8a,0x8c,0x8c,0x8c,0x8c,0x8d,0x8c,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e, + 0x8e,0x8f,0x91,0x91,0x91,0x92,0x92,0x91,0x91,0x91,0x91,0x91,0x92,0x94,0x94, + 0x94,0x93,0x93,0x93,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95, + 0x96,0x96,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x98,0x98,0x98,0x98, + 0x99,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d, + 0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa5,0xa4,0xa3,0xa4,0xa4,0xa5,0xa5,0xa4,0xa4,0xa4,0xa5, + 0xa4,0xa3,0xa5,0xa7,0xa8,0xa7,0xa5,0xa3,0xa3,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa8,0xa7,0xa8,0xa8,0xa8,0xa9,0xa9,0xaa,0xa9,0xa9,0xa8,0xa8,0xa9, + 0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xaa,0xab, + 0xa9,0xa7,0xa9,0xaa,0xaa,0xac,0xab,0xa7,0xa3,0xa7,0xc3,0xae,0x68,0x28,0x00, + 0x02,0x03,0x02,0x02,0x02,0x02,0x00,0x01,0x26,0x43,0x41,0x27,0x01,0x05,0x0a, + 0x02,0x00,0x00,0x03,0x05,0x02,0x00,0x00,0x00,0x0a,0x2a,0x7b,0xbc,0x47,0x00, + 0x00,0x03,0x06,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x01, + 0x01,0x00,0x00,0x02,0x02,0x02,0x06,0x07,0x00,0x0e,0x3d,0x91,0xc8,0xaf,0xa7, + 0xb4,0xb4,0xaf,0xa7,0xb6,0xc4,0x62,0x0a,0x01,0x01,0x05,0x03,0x01,0x04,0x06, + 0x06,0x00,0x12,0x69,0xa3,0xc1,0xb7,0xae,0xb3,0xb3,0xb1,0xb2,0xb2,0xb4,0xb4, + 0xb2,0xb1,0xaf,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xac,0xab,0xaa,0xaa,0xaa, + 0xa9,0xa9,0xa9,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xa9,0xa8,0xa7, + 0xa7,0xa7,0xa7,0xa9,0xa9,0xaa,0xaa,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xab,0xab,0xac,0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xae,0xae,0xaf,0xb0,0xaf,0xb0,0xb2,0xb3,0xb2,0xb0,0xae,0xc8,0x4f,0x50,0x50, + 0x52,0x53,0x53,0x53,0x54,0x54,0x55,0x56,0x57,0x58,0x57,0x56,0x57,0x57,0x57, + 0x57,0x57,0x59,0x5a,0x5b,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x60,0x61,0x61,0x61,0x61,0x60,0x60,0x61,0x62,0x63,0x64,0x65,0x64, + 0x63,0x63,0x63,0x64,0x65,0x66,0x68,0x68,0x68,0x67,0x67,0x67,0x68,0x69,0x69, + 0x69,0x69,0x69,0x69,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x6f,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x72,0x73,0x74,0x74,0x73,0x73,0x73,0x73,0x74,0x74,0x75, + 0x75,0x75,0x75,0x75,0x75,0x75,0x76,0x76,0x77,0x78,0x78,0x78,0x77,0x78,0x7a, + 0x7a,0x7a,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7d,0x7e,0x7f, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x81,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x84,0x85, + 0x85,0x85,0x86,0x86,0x86,0x86,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x88,0x88, + 0x88,0x89,0x8a,0x8a,0x8a,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8b,0x8b,0x8b,0x8a,0x8b,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8f, + 0x8f,0x8e,0x8f,0x90,0x91,0x91,0x92,0x93,0x93,0x92,0x91,0x91,0x91,0x92,0x93, + 0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96, + 0x96,0x97,0x97,0x98,0x98,0x98,0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9a,0x98,0x98, + 0x98,0x99,0x9a,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0x9f,0x9f,0xa0,0xa0,0xa0,0xa1, + 0xa1,0xa1,0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa4,0xa6,0xa6,0xa5,0xa5, + 0xa5,0xa6,0xa5,0xa5,0xa7,0xa7,0xa7,0xa5,0xa4,0xa7,0xa7,0xa6,0xa7,0xa8,0xa7, + 0xa7,0xa7,0xa9,0xaa,0xa9,0xa9,0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xa9,0xa9, + 0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab, + 0xaa,0xaa,0xa9,0xaa,0xab,0xab,0xab,0xac,0xab,0xa8,0xa6,0xaa,0xbe,0xb8,0x91, + 0x3d,0x00,0x00,0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x0a,0x13,0x20,0x16,0x02, + 0x03,0x07,0x01,0x00,0x03,0x03,0x03,0x03,0x02,0x00,0x00,0x07,0x1f,0x77,0xc1, + 0x49,0x00,0x00,0x03,0x06,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x00,0x00,0x01,0x02,0x03,0x04,0x04,0x00,0x09,0x2a,0x86,0xc8, + 0xb3,0xaa,0xb2,0xb2,0xaf,0xa7,0xb9,0xc8,0x67,0x0c,0x03,0x01,0x03,0x03,0x03, + 0x04,0x07,0x07,0x00,0x0d,0x46,0x8b,0xc5,0xba,0xad,0xb2,0xb2,0xb1,0xb1,0xb2, + 0xb2,0xb1,0xb0,0xae,0xad,0xac,0xac,0xac,0xac,0xac,0xab,0xab,0xaa,0xaa,0xaa, + 0xaa,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xac, + 0xac,0xac,0xad,0xad,0xad,0xae,0xae,0xae,0xaf,0xb1,0xb2,0xb2,0xb1,0xaf,0xaf, + 0xaf,0xae,0xae,0xaf,0xaf,0xaf,0xb0,0xb0,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1, + 0xb1,0xb1,0xb1,0xb1,0xb2,0xb2,0xb2,0xb2,0xb3,0xb3,0xb2,0xaf,0xad,0xc8,0x50, + 0x50,0x51,0x53,0x54,0x55,0x56,0x57,0x57,0x57,0x58,0x59,0x5a,0x59,0x56,0x56, + 0x57,0x57,0x57,0x57,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5c,0x5d, + 0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x63, + 0x64,0x64,0x64,0x64,0x65,0x65,0x66,0x67,0x68,0x68,0x68,0x67,0x67,0x68,0x69, + 0x69,0x6b,0x6c,0x6c,0x6b,0x6b,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x70,0x70,0x70, + 0x70,0x70,0x71,0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x72,0x73,0x74,0x74,0x74, + 0x74,0x75,0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x78,0x78,0x78,0x79,0x79,0x79, + 0x79,0x79,0x7b,0x7c,0x7d,0x7c,0x7b,0x7b,0x7d,0x7f,0x7f,0x7f,0x7e,0x7d,0x7d, + 0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x81,0x81,0x81,0x81,0x82,0x83,0x84,0x84, + 0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x87,0x87,0x88,0x88,0x88,0x88,0x88,0x88, + 0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b, + 0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f, + 0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x92,0x93,0x93,0x93,0x93,0x92,0x92,0x92, + 0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96, + 0x97,0x97,0x98,0x98,0x98,0x99,0x99,0x99,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c, + 0x98,0x98,0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa1,0xa1,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4, + 0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5, + 0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa6,0xa5,0xa3,0xa4,0xae,0xae,0xa5,0xa7, + 0xa9,0xa7,0xa7,0xa9,0xaa,0xaa,0xaa,0xaa,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xab,0xae,0xab,0xa8,0xac,0xae,0xae,0xad,0xac,0xab,0xac,0xaf,0xab,0xaa,0xb7, + 0xc1,0xbb,0x54,0x00,0x00,0x03,0x07,0x03,0x00,0x04,0x06,0x04,0x02,0x00,0x02, + 0x03,0x03,0x01,0x00,0x00,0x03,0x07,0x02,0x00,0x03,0x03,0x01,0x00,0x04,0x1a, + 0x77,0xc8,0x4a,0x00,0x01,0x04,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x05,0x03,0x00,0x01,0x04,0x15, + 0x7b,0xc8,0xba,0xae,0xae,0xaf,0xb0,0xad,0xbd,0xc8,0x65,0x0c,0x03,0x00,0x01, + 0x03,0x03,0x04,0x07,0x09,0x00,0x07,0x30,0x7c,0xc8,0xbb,0xaa,0xae,0xaf,0xaf, + 0xaf,0xae,0xac,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xab, + 0xab,0xab,0xab,0xab,0xab,0xac,0xad,0xae,0xae,0xae,0xaf,0xb0,0xb1,0xb0,0xb0, + 0xb1,0xb2,0xb3,0xb4,0xb5,0xb5,0xb5,0xb5,0xb4,0xb3,0xb2,0xb4,0xb6,0xb6,0xb5, + 0xb4,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, + 0xb2,0xb2,0xb2,0xb2,0xb2,0xb1,0xb2,0xb2,0xb1,0xb0,0xaf,0xae,0xae,0xac,0xab, + 0xc8,0x50,0x50,0x51,0x52,0x53,0x54,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57, + 0x56,0x57,0x57,0x57,0x57,0x57,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c, + 0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x61,0x62,0x62,0x63,0x63,0x62,0x62,0x62,0x62, + 0x62,0x63,0x64,0x64,0x65,0x65,0x65,0x66,0x67,0x67,0x67,0x68,0x68,0x68,0x68, + 0x69,0x69,0x6a,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x70,0x70, + 0x70,0x71,0x71,0x71,0x71,0x72,0x73,0x73,0x73,0x72,0x72,0x73,0x74,0x74,0x74, + 0x75,0x75,0x75,0x76,0x77,0x78,0x78,0x78,0x79,0x79,0x79,0x79,0x79,0x79,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x7f,0x7f,0x7f,0x80,0x81,0x82,0x81,0x82,0x82,0x82,0x83,0x83,0x83,0x83,0x84, + 0x84,0x84,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x88, + 0x89,0x88,0x88,0x89,0x8a,0x8a,0x8b,0x8b,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b, + 0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x90,0x90,0x8f,0x8f,0x8f,0x8f, + 0x90,0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x93,0x93,0x94,0x94,0x93,0x93, + 0x92,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x97, + 0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x9a,0x9b,0x9b,0x9c,0x9c, + 0x9c,0x9c,0x99,0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,0x9e,0x9e, + 0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa0,0xa0, + 0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa6, + 0xa6,0xa6,0xa7,0xa6,0xa6,0xa6,0xa7,0xa7,0xa5,0xa7,0xaa,0xa9,0xa7,0xa9,0xa9, + 0xa8,0xa7,0xa7,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xab, + 0xab,0xab,0xac,0xad,0xab,0xaa,0xad,0xae,0xab,0xac,0xac,0xaa,0xaa,0xad,0xab, + 0xaa,0xaa,0xb9,0xc8,0x6f,0x12,0x02,0x01,0x07,0x07,0x05,0x03,0x03,0x03,0x01, + 0x00,0x00,0x03,0x07,0x03,0x00,0x00,0x03,0x03,0x00,0x00,0x03,0x04,0x03,0x00, + 0x00,0x0a,0x5e,0xae,0x46,0x00,0x00,0x01,0x01,0x02,0x02,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x03,0x03,0x03, + 0x00,0x07,0x6d,0xc8,0xba,0xb0,0xae,0xae,0xb0,0xae,0xbe,0xc8,0x62,0x08,0x00, + 0x00,0x03,0x03,0x03,0x03,0x07,0x0a,0x00,0x04,0x21,0x71,0xc8,0xb9,0xa5,0xa7, + 0xa9,0xaa,0xaa,0xaa,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xaa,0xaa,0xab,0xab,0xac, + 0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xaf, + 0xb0,0xb1,0xb1,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb1,0xb0,0xb0,0xb0,0xb2, + 0xb2,0xb1,0xaf,0xae,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xae, + 0xae,0xaf,0xaf,0xaf,0xae,0xae,0xac,0xab,0xac,0xac,0xaa,0xa9,0xaa,0xaa,0xab, + 0xad,0xad,0xc8,0x50,0x50,0x50,0x52,0x53,0x53,0x53,0x54,0x54,0x55,0x54,0x53, + 0x53,0x54,0x56,0x57,0x57,0x57,0x57,0x57,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a, + 0x5b,0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x61,0x62,0x63,0x64,0x64,0x62,0x62, + 0x62,0x62,0x62,0x63,0x65,0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x67,0x68,0x69, + 0x69,0x69,0x69,0x69,0x6a,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x70, + 0x70,0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x74,0x74,0x73,0x73,0x73,0x74,0x74, + 0x75,0x76,0x76,0x76,0x76,0x76,0x77,0x78,0x78,0x79,0x7a,0x7a,0x7a,0x7a,0x7a, + 0x7a,0x7b,0x7c,0x7c,0x7d,0x7d,0x7c,0x7c,0x7d,0x7f,0x80,0x80,0x7f,0x7f,0x7f, + 0x7f,0x81,0x81,0x7f,0x80,0x81,0x82,0x82,0x82,0x83,0x84,0x84,0x85,0x85,0x85, + 0x84,0x84,0x84,0x84,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x88,0x88,0x88,0x88, + 0x88,0x89,0x89,0x89,0x89,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8b,0x8c, + 0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8e,0x8f,0x91,0x91,0x90,0x90, + 0x90,0x90,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x91,0x92,0x93,0x94,0x94,0x94, + 0x94,0x93,0x93,0x93,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x97, + 0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x9a,0x9b, + 0x9b,0x9c,0x9c,0x9c,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9e, + 0x9f,0x9f,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4, + 0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa7,0xa8,0xa9,0xa9, + 0xa8,0xa7,0xa6,0xa7,0xa7,0xa7,0xa6,0xa5,0xa7,0xa7,0xa5,0xa7,0xac,0xac,0xa9, + 0xa4,0xa5,0xaa,0xaa,0xa9,0xaa,0xaa,0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xab, + 0xab,0xab,0xab,0xac,0xac,0xab,0xac,0xad,0xae,0xac,0xaa,0xaa,0xac,0xaa,0xaa, + 0xaa,0xab,0xaa,0xa3,0xb2,0xc8,0x8b,0x3b,0x0d,0x00,0x07,0x09,0x07,0x03,0x01, + 0x02,0x03,0x03,0x03,0x06,0x08,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x03,0x03, + 0x03,0x00,0x00,0x00,0x3d,0x82,0x3a,0x01,0x00,0x00,0x00,0x02,0x02,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x02, + 0x05,0x03,0x00,0x00,0x60,0xba,0xb8,0xb2,0xae,0xae,0xaf,0xaf,0xbe,0xc5,0x5d, + 0x03,0x00,0x00,0x04,0x03,0x01,0x03,0x07,0x0a,0x00,0x04,0x22,0x71,0xc8,0xb8, + 0xa3,0xa6,0xa7,0xa8,0xa9,0xaa,0xaa,0xa9,0xa9,0xaa,0xaa,0xaa,0xab,0xab,0xac, + 0xad,0xae,0xae,0xae,0xae,0xad,0xad,0xac,0xac,0xad,0xad,0xad,0xad,0xad,0xac, + 0xad,0xad,0xae,0xae,0xae,0xae,0xad,0xad,0xad,0xad,0xad,0xac,0xac,0xab,0xaa, + 0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa,0xab,0xaa,0xab,0xaa,0xa9, + 0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xa9,0xa7,0xa6,0xa5,0xa5,0xa5,0xa3,0xa2,0xa3, + 0xa4,0xa6,0xa8,0xa9,0xc8,0x50,0x51,0x51,0x52,0x53,0x53,0x53,0x54,0x54,0x54, + 0x53,0x53,0x53,0x53,0x57,0x57,0x58,0x58,0x58,0x59,0x5a,0x5b,0x5b,0x5a,0x5a, + 0x5a,0x5b,0x5a,0x5b,0x5c,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x62,0x62, + 0x62,0x61,0x61,0x62,0x62,0x64,0x65,0x66,0x66,0x66,0x65,0x65,0x65,0x66,0x67, + 0x68,0x69,0x6a,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6c,0x6c,0x6c,0x6d,0x6e, + 0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x73,0x73,0x73,0x73,0x74, + 0x74,0x76,0x77,0x78,0x78,0x77,0x76,0x76,0x76,0x77,0x78,0x79,0x79,0x7a,0x7a, + 0x7b,0x7b,0x7b,0x7b,0x7c,0x7e,0x7f,0x7f,0x7d,0x7c,0x7c,0x7f,0x81,0x81,0x7f, + 0x7e,0x7e,0x7f,0x82,0x82,0x80,0x80,0x81,0x82,0x82,0x82,0x83,0x84,0x85,0x85, + 0x85,0x84,0x84,0x84,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x88,0x88, + 0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8d,0x8d,0x8d,0x8c,0x8c, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x90,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x93,0x93,0x92,0x92,0x93,0x94, + 0x94,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x96,0x95,0x95,0x96,0x96,0x96,0x97, + 0x97,0x97,0x97,0x98,0x98,0x98,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x99,0x9a,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e,0x9e, + 0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6, + 0xa7,0xa8,0xa8,0xa7,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa9,0xa9,0xa5,0xa0, + 0xa3,0xa6,0xa7,0xa8,0xaa,0xae,0xaf,0xaa,0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xab, + 0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xab,0xab,0xac,0xac,0xac, + 0xab,0xab,0xab,0xab,0xac,0xad,0xac,0xa9,0xab,0xae,0xac,0xaa,0xab,0xac,0xad, + 0xae,0xad,0xaa,0xae,0xb0,0xa7,0xb0,0xc4,0xa7,0x6e,0x19,0x00,0x06,0x04,0x03, + 0x06,0x05,0x02,0x00,0x00,0x03,0x03,0x01,0x01,0x01,0x01,0x00,0x00,0x02,0x03, + 0x01,0x01,0x02,0x00,0x00,0x00,0x1e,0x42,0x20,0x04,0x03,0x03,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x02,0x00,0x00,0x00,0x52,0xa4,0xb4,0xb5,0xb0,0xae,0xae,0xb1,0xbd, + 0xbf,0x57,0x00,0x00,0x00,0x05,0x03,0x02,0x03,0x06,0x0a,0x00,0x08,0x38,0x82, + 0xc8,0xb9,0xa7,0xac,0xae,0xae,0xb1,0xb2,0xb2,0xb1,0xb1,0xb0,0xb0,0xb0,0xb0, + 0xb0,0xb0,0xb0,0xb0,0xb0,0xb0,0xaf,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xac, + 0xab,0xab,0xab,0xab,0xaa,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa8,0xa7,0xa6, + 0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa6,0xa6,0xa6,0xa6, + 0xa6,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa5,0xa3,0xa2,0xa1,0xa0,0xa0,0xa0,0x9d, + 0x9c,0x9b,0x9a,0x99,0x98,0x98,0xc8,0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x54, + 0x55,0x55,0x54,0x54,0x53,0x54,0x57,0x58,0x58,0x58,0x58,0x59,0x5a,0x5b,0x5b, + 0x5b,0x5a,0x5b,0x5b,0x5a,0x5b,0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f,0x60, + 0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x64,0x65,0x66,0x66,0x66,0x65,0x65,0x65, + 0x66,0x67,0x68,0x69,0x6a,0x6a,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6b,0x6c, + 0x6d,0x6d,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x72,0x72,0x73, + 0x73,0x74,0x74,0x76,0x77,0x78,0x78,0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x79, + 0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,0x7d,0x7e,0x7e,0x7e,0x7d,0x7d,0x7e,0x7f,0x80, + 0x7f,0x7f,0x7f,0x7f,0x80,0x82,0x82,0x81,0x81,0x82,0x82,0x82,0x82,0x83,0x84, + 0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x88,0x88, + 0x88,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x90,0x91,0x91,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x93,0x94,0x94,0x93,0x93, + 0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x96,0x96,0x95,0x96,0x96, + 0x96,0x97,0x97,0x97,0x98,0x98,0x98,0x99,0x99,0x99,0x98,0x98,0x98,0x98,0x98, + 0x98,0x98,0x99,0x99,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e, + 0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1, + 0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2,0xa3,0xa3,0xa3, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6, + 0xa6,0xa6,0xa7,0xa8,0xa7,0xa7,0xa6,0xa7,0xa7,0xa8,0xa9,0xa9,0xaa,0xaa,0xa4, + 0xa8,0xb2,0xb3,0xb0,0xa8,0xa7,0xab,0xad,0xad,0xaa,0xa9,0xa9,0xaa,0xaa,0xaa, + 0xab,0xac,0xac,0xac,0xab,0xab,0xab,0xab,0xac,0xad,0xac,0xab,0xab,0xac,0xac, + 0xac,0xac,0xac,0xac,0xac,0xac,0xac,0xad,0xac,0xaa,0xab,0xae,0xab,0xab,0xae, + 0xae,0xac,0xaf,0xaf,0xad,0xaf,0xb1,0xaa,0xae,0xb9,0xbc,0x9a,0x2a,0x00,0x03, + 0x02,0x01,0x04,0x05,0x03,0x02,0x01,0x04,0x03,0x00,0x02,0x03,0x00,0x00,0x01, + 0x03,0x03,0x00,0x00,0x03,0x03,0x00,0x00,0x0c,0x1d,0x12,0x07,0x03,0x03,0x03, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x03,0x04,0x04,0x02,0x00,0x00,0x4c,0x9c,0xb4,0xb9,0xb3,0xae,0xae, + 0xb5,0xbe,0xb9,0x52,0x00,0x00,0x01,0x03,0x04,0x03,0x02,0x05,0x0a,0x00,0x0d, + 0x4c,0x91,0xc8,0xb9,0xaa,0xb1,0xb2,0xb2,0xb5,0xb6,0xb5,0xb4,0xb3,0xb2,0xb2, + 0xb1,0xb0,0xaf,0xaf,0xae,0xae,0xae,0xae,0xab,0xaa,0xaa,0xa9,0xa9,0xa9,0xa9, + 0xa8,0xa7,0xa7,0xa7,0xa6,0xa6,0xa5,0xa4,0xa3,0xa3,0xa2,0xa3,0xa3,0xa3,0xa3, + 0xa2,0xa1,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa1,0xa1,0xa0,0xa0,0xa0,0x9f,0x9f,0x9e,0x9c,0x9a,0x98,0x97,0x95,0x95, + 0x95,0x94,0x92,0x90,0x8d,0x8b,0x8a,0x89,0xc8,0x52,0x52,0x51,0x51,0x52,0x52, + 0x53,0x54,0x56,0x56,0x56,0x56,0x55,0x55,0x57,0x57,0x58,0x58,0x58,0x59,0x5a, + 0x5b,0x5b,0x5b,0x5a,0x5b,0x5b,0x5b,0x5b,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f, + 0x60,0x61,0x61,0x61,0x62,0x62,0x62,0x62,0x62,0x64,0x65,0x66,0x66,0x66,0x65, + 0x65,0x65,0x66,0x67,0x68,0x69,0x6a,0x6a,0x6a,0x69,0x69,0x69,0x69,0x69,0x6a, + 0x6b,0x6c,0x6d,0x6d,0x6f,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x72,0x72,0x71, + 0x71,0x72,0x73,0x74,0x74,0x75,0x76,0x77,0x77,0x77,0x77,0x78,0x78,0x78,0x78, + 0x78,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7c,0x7b,0x7e,0x7f,0x80, + 0x7f,0x7f,0x7e,0x7f,0x81,0x82,0x82,0x81,0x81,0x82,0x83,0x83,0x83,0x83,0x83, + 0x83,0x84,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x89,0x89,0x8a, + 0x8a,0x8a,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8c,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8e,0x8d,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x93,0x94,0x95,0x95, + 0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x96,0x96, + 0x96,0x96,0x97,0x97,0x97,0x98,0x98,0x98,0x99,0x99,0x9a,0x9a,0x99,0x99,0x99, + 0x99,0x99,0x99,0x9a,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2, + 0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa9,0xaa,0xaa, + 0xa9,0xa0,0xab,0xc8,0xc5,0xb9,0xa9,0xa7,0xad,0xa9,0xa6,0xaa,0xaa,0xa9,0xaa, + 0xab,0xac,0xac,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xae,0xad,0xac,0xad, + 0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xad,0xae,0xad,0xac,0xac, + 0xae,0xb2,0xae,0xab,0xae,0xb0,0xb0,0xaf,0xae,0xad,0xac,0xac,0xc7,0xb9,0x3f, + 0x03,0x03,0x01,0x02,0x01,0x03,0x05,0x05,0x04,0x03,0x03,0x03,0x05,0x05,0x00, + 0x01,0x04,0x02,0x00,0x00,0x01,0x04,0x05,0x03,0x00,0x05,0x0e,0x0c,0x07,0x00, + 0x01,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x03,0x04,0x07,0x0a,0x05,0x00,0x00,0x4b,0x9c,0xb7,0xbe,0xb6, + 0xb0,0xaf,0xb9,0xc1,0xb6,0x50,0x00,0x00,0x01,0x02,0x04,0x06,0x02,0x04,0x08, + 0x00,0x11,0x5b,0x9c,0xc8,0xb9,0xab,0xb2,0xb5,0xb4,0xb5,0xb5,0xb4,0xb2,0xb2, + 0xb1,0xaf,0xae,0xad,0xab,0xaa,0xaa,0xa9,0xa9,0xa8,0xa4,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa2,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa0,0x9f,0x9d,0x9c,0x9c, + 0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0x9e,0x9d,0x9c,0x9c,0x9b,0x99,0x98,0x98,0x96,0x95,0x92,0x90,0x8d,0x8b, + 0x8a,0x8a,0x8a,0x8a,0x89,0x87,0x85,0x82,0x80,0x7f,0xc8,0x51,0x51,0x51,0x51, + 0x51,0x52,0x52,0x53,0x54,0x55,0x56,0x56,0x55,0x55,0x56,0x57,0x57,0x57,0x57, + 0x58,0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e,0x5f, + 0x60,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x65, + 0x65,0x65,0x66,0x67,0x66,0x66,0x68,0x69,0x6a,0x6a,0x69,0x69,0x69,0x69,0x69, + 0x69,0x69,0x6b,0x6c,0x6d,0x6e,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x72, + 0x72,0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x75,0x76,0x77,0x78,0x78,0x79,0x7a, + 0x7a,0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7d,0x7c,0x7c,0x7e, + 0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x81,0x82,0x82,0x82,0x83,0x85,0x85,0x85,0x85, + 0x85,0x84,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x88,0x89,0x8a, + 0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8f,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f,0x90,0x91, + 0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x92,0x93,0x94,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x98,0x98, + 0x98,0x97,0x97,0x97,0x98,0x98,0x98,0x98,0x99,0x99,0x9a,0x9a,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9e,0x9e, + 0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa9,0xa9,0xa9,0xa9,0xa8,0xa7,0xa7,0xa8,0xa9, + 0xaa,0xa7,0xa9,0xb8,0xaa,0x86,0x7f,0x8b,0xaf,0xb7,0xa8,0xaa,0xad,0xac,0xaa, + 0xaa,0xaa,0xac,0xad,0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xae,0xaf,0xae, + 0xac,0xae,0xaf,0xaf,0xae,0xad,0xad,0xae,0xaf,0xae,0xad,0xb2,0xaf,0xa8,0xc0, + 0xb9,0x55,0x16,0x02,0x02,0x08,0x07,0x05,0x03,0x03,0x03,0x01,0x01,0x02,0x03, + 0x02,0x00,0x00,0x02,0x02,0x01,0x03,0x03,0x02,0x03,0x04,0x06,0x06,0x04,0x03, + 0x03,0x03,0x03,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x04,0x04,0x05,0x00,0x00,0x41,0x8e,0xb9, + 0xc1,0xae,0xae,0xb3,0xba,0xc1,0xb9,0x52,0x00,0x00,0x02,0x04,0x03,0x03,0x04, + 0x06,0x06,0x00,0x12,0x5e,0x9c,0xc7,0xb8,0xaa,0xb0,0xb3,0xb3,0xb2,0xb0,0xb0, + 0xb0,0xaf,0xae,0xad,0xab,0xa9,0xa7,0xa7,0xa6,0xa5,0xa5,0xa5,0xa4,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa2,0xa2,0xa1,0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0x9e,0x9c,0x9b, + 0x9a,0x99,0x99,0x9a,0x9b,0x9b,0x9c,0x9c,0x9b,0x99,0x99,0x9a,0x9a,0x9a,0x9a, + 0x99,0x99,0x98,0x97,0x96,0x95,0x94,0x93,0x93,0x93,0x92,0x92,0x91,0x91,0x91, + 0x90,0x90,0x90,0x91,0x91,0x8e,0x8d,0x8e,0x90,0x91,0x91,0x91,0xc8,0x51,0x51, + 0x51,0x51,0x51,0x52,0x52,0x53,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x56,0x57, + 0x57,0x57,0x57,0x59,0x5a,0x5a,0x59,0x59,0x5a,0x5b,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x61,0x62,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x65, + 0x65,0x65,0x65,0x65,0x67,0x68,0x67,0x66,0x68,0x69,0x6a,0x69,0x69,0x69,0x69, + 0x69,0x6a,0x6a,0x6a,0x6b,0x6d,0x6d,0x6e,0x6f,0x70,0x70,0x70,0x70,0x71,0x71, + 0x71,0x72,0x72,0x73,0x74,0x74,0x74,0x74,0x74,0x74,0x74,0x75,0x77,0x78,0x79, + 0x7a,0x7b,0x7b,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d, + 0x7e,0x7e,0x7e,0x7e,0x7f,0x80,0x80,0x81,0x81,0x82,0x82,0x84,0x85,0x86,0x86, + 0x86,0x86,0x86,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x87,0x87,0x87,0x88, + 0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8e,0x8e,0x8e,0x8e,0x8e,0x8f,0x90, + 0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x94, + 0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x96,0x96,0x96,0x97,0x97,0x98, + 0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x9a,0x9b,0x9b,0x9b, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9e, + 0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1, + 0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa9,0xaa,0xa9,0xa8,0xaa,0xaa,0xaa,0xa8,0xa7, + 0xa9,0xaa,0xaa,0xa6,0xa9,0xc8,0xa1,0x41,0x33,0x57,0xb1,0xc6,0xa5,0xaa,0xb0, + 0xac,0xab,0xab,0xac,0xac,0xad,0xad,0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xae,0xae,0xae,0xaf,0xae,0xac,0xae,0xb0,0xae,0xad,0xae,0xae,0xae,0xb4,0xb1, + 0xa7,0xb9,0xb7,0x73,0x32,0x02,0x02,0x0c,0x0a,0x05,0x00,0x00,0x01,0x00,0x00, + 0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x03,0x04,0x03,0x00,0x00,0x03,0x08,0x06, + 0x00,0x00,0x02,0x05,0x03,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x01,0x05,0x00,0x00,0x36, + 0x7f,0xb9,0xc3,0xa8,0xac,0xb5,0xb8,0xc0,0xbb,0x52,0x00,0x00,0x03,0x07,0x02, + 0x00,0x06,0x07,0x03,0x00,0x12,0x62,0xa0,0xc5,0xb7,0xa9,0xae,0xb2,0xb3,0xaf, + 0xae,0xae,0xae,0xae,0xad,0xac,0xaa,0xa9,0xa7,0xa7,0xa6,0xa5,0xa5,0xa5,0xa7, + 0xa7,0xa7,0xa7,0xa6,0xa5,0xa5,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2,0xa1, + 0xa0,0xa0,0x9f,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9c,0x99,0x99,0x9a,0x9a, + 0x9a,0x9a,0x99,0x98,0x98,0x97,0x96,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96, + 0x97,0x98,0x98,0x98,0x99,0x9a,0x99,0x96,0x95,0x99,0x9c,0x9e,0xa0,0xa0,0xc8, + 0x52,0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x55,0x54,0x54,0x54, + 0x55,0x56,0x56,0x56,0x57,0x58,0x59,0x5a,0x5a,0x59,0x5a,0x5a,0x5b,0x5c,0x5d, + 0x5d,0x5d,0x5d,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x61,0x62,0x63,0x63,0x63,0x64, + 0x65,0x65,0x64,0x64,0x63,0x65,0x66,0x69,0x68,0x67,0x68,0x69,0x69,0x69,0x69, + 0x69,0x69,0x6a,0x6a,0x6b,0x6b,0x6c,0x6d,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x70, + 0x71,0x71,0x71,0x71,0x72,0x74,0x74,0x74,0x75,0x76,0x75,0x76,0x76,0x76,0x77, + 0x78,0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d, + 0x7e,0x7f,0x7f,0x7d,0x7c,0x7d,0x7f,0x82,0x82,0x82,0x80,0x81,0x82,0x85,0x86, + 0x84,0x84,0x85,0x85,0x85,0x84,0x84,0x84,0x84,0x85,0x85,0x85,0x85,0x86,0x87, + 0x87,0x87,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a, + 0x8b,0x8c,0x8d,0x8d,0x8d,0x8c,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f, + 0x8f,0x90,0x90,0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93, + 0x94,0x95,0x95,0x95,0x95,0x95,0x96,0x97,0x97,0x96,0x96,0x97,0x97,0x97,0x97, + 0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9b,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9d,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa0, + 0xa0,0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4, + 0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa8, + 0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xa8,0xa7,0xa6,0xa8,0xaa,0xaa, + 0xa9,0xa7,0xaa,0xac,0xad,0xa9,0xa9,0xc2,0x8a,0x18,0x07,0x34,0xa7,0xc8,0xa9, + 0xa7,0xa9,0xaa,0xad,0xb0,0xae,0xac,0xac,0xac,0xac,0xad,0xad,0xae,0xae,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf,0xb0,0xb0,0xaf,0xae, + 0xae,0xad,0xac,0xae,0xaf,0xaf,0xae,0xab,0xaf,0xb4,0xb2,0xb0,0xb0,0xb2,0xb3, + 0xb1,0xaa,0xa5,0xbb,0xc4,0x9e,0x57,0x03,0x00,0x0a,0x03,0x01,0x02,0x01,0x01, + 0x03,0x03,0x03,0x03,0x03,0x04,0x02,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x00, + 0x01,0x00,0x00,0x03,0x05,0x01,0x00,0x00,0x02,0x03,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,0x00,0x02,0x05,0x05,0x00, + 0x00,0x2f,0x71,0xb5,0xc4,0xa7,0xac,0xb4,0xb4,0xba,0xb6,0x4e,0x00,0x00,0x03, + 0x08,0x03,0x00,0x07,0x06,0x02,0x00,0x15,0x70,0xaa,0xc5,0xb7,0xab,0xb1,0xb4, + 0xb5,0xb3,0xb1,0xb1,0xb1,0xb2,0xb1,0xb0,0xaf,0xae,0xad,0xac,0xab,0xab,0xaa, + 0xaa,0xac,0xac,0xab,0xaa,0xa9,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xaa, + 0xac,0xad,0xae,0xae,0xaf,0xaf,0xaf,0xae,0xac,0xaa,0xaa,0xa8,0xa7,0xa8,0xa8, + 0xa8,0xa8,0xa8,0xa7,0xa7,0xa7,0xa6,0xa6,0xa5,0xa4,0xa5,0xa7,0xa7,0xa5,0xa4, + 0xa3,0xa3,0xa3,0xa3,0xa2,0xa0,0xa0,0x9f,0x9f,0x9f,0xa0,0xa1,0xa2,0xa1,0xa0, + 0x9c,0xc8,0x50,0x50,0x50,0x51,0x52,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54, + 0x54,0x54,0x56,0x56,0x56,0x56,0x57,0x58,0x59,0x5a,0x5a,0x59,0x5a,0x5b,0x5b, + 0x5b,0x5c,0x5d,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x61,0x62,0x62, + 0x63,0x65,0x65,0x65,0x64,0x63,0x63,0x65,0x66,0x68,0x68,0x68,0x69,0x69,0x68, + 0x68,0x68,0x68,0x69,0x6a,0x6b,0x6c,0x6c,0x6d,0x6e,0x6e,0x6e,0x6e,0x6f,0x6f, + 0x70,0x70,0x71,0x71,0x71,0x71,0x72,0x73,0x74,0x74,0x75,0x77,0x77,0x78,0x78, + 0x78,0x78,0x78,0x78,0x78,0x79,0x7a,0x7a,0x7b,0x7b,0x7b,0x7b,0x7b,0x7c,0x7c, + 0x7d,0x7e,0x7e,0x7f,0x80,0x7f,0x7e,0x7e,0x7f,0x81,0x82,0x82,0x81,0x82,0x82, + 0x84,0x84,0x82,0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x85,0x86,0x86, + 0x86,0x87,0x87,0x87,0x87,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8b,0x8a,0x8a, + 0x8a,0x8a,0x8b,0x8c,0x8d,0x8d,0x8c,0x8b,0x8d,0x8d,0x8f,0x8f,0x8f,0x8f,0x8f, + 0x8f,0x8f,0x8f,0x90,0x90,0x91,0x91,0x91,0x92,0x92,0x92,0x92,0x93,0x93,0x93, + 0x93,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x97,0x97,0x97,0x96,0x96,0x97,0x97, + 0x97,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9b, + 0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d, + 0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1, + 0xa2,0xa1,0xa1,0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7, + 0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xaa,0xa7,0xa5,0xa8, + 0xaa,0xab,0xa9,0xa7,0xaa,0xac,0xae,0xa8,0xa8,0xc4,0x8c,0x17,0x00,0x1c,0x9b, + 0xc8,0xad,0xa8,0xa7,0xaa,0xae,0xb1,0xae,0xac,0xac,0xac,0xac,0xad,0xad,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xb0,0xb0,0xb0, + 0xaf,0xae,0xad,0xad,0xae,0xaf,0xaf,0xaf,0xae,0xad,0xaf,0xb1,0xb1,0xb0,0xb0, + 0xb2,0xb3,0xb0,0xab,0xa8,0xb9,0xc2,0xb3,0x6d,0x04,0x00,0x06,0x01,0x00,0x03, + 0x02,0x02,0x03,0x03,0x02,0x03,0x03,0x03,0x03,0x00,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x00,0x00,0x02,0x02,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x00,0x03,0x06, + 0x04,0x00,0x00,0x29,0x67,0xb3,0xc5,0xa8,0xaa,0xb0,0xb2,0xb5,0xab,0x48,0x00, + 0x00,0x03,0x05,0x04,0x03,0x05,0x03,0x00,0x00,0x19,0x84,0xb7,0xc1,0xb4,0xa9, + 0xae,0xb0,0xb2,0xb0,0xaf,0xaf,0xaf,0xb0,0xb0,0xb0,0xb0,0xaf,0xae,0xad,0xac, + 0xac,0xab,0xaa,0xab,0xaa,0xaa,0xa9,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xaa, + 0xaa,0xae,0xaf,0xb0,0xb0,0xb0,0xaf,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xae,0xae, + 0xae,0xad,0xac,0xac,0xab,0xaa,0xa9,0xa8,0xa7,0xa7,0xa6,0xa5,0xa6,0xa7,0xa7, + 0xa5,0xa4,0xa3,0xa3,0xa2,0xa0,0x9e,0x9b,0x98,0x97,0x96,0x96,0x95,0x95,0x94, + 0x94,0x94,0x93,0xc8,0x4d,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x53,0x53,0x53, + 0x53,0x53,0x54,0x55,0x56,0x57,0x56,0x56,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a, + 0x5b,0x5b,0x5c,0x5d,0x5e,0x5e,0x5d,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f, + 0x60,0x61,0x63,0x65,0x65,0x65,0x64,0x63,0x63,0x64,0x65,0x67,0x68,0x68,0x69, + 0x69,0x68,0x67,0x67,0x68,0x69,0x69,0x6b,0x6c,0x6d,0x6d,0x6e,0x6e,0x6e,0x6e, + 0x6e,0x6f,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x72,0x73,0x74,0x75,0x77,0x78, + 0x78,0x78,0x78,0x78,0x77,0x76,0x76,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x7b,0x7b, + 0x7b,0x7c,0x7d,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x7f,0x7f,0x80,0x82,0x82, + 0x83,0x83,0x82,0x82,0x82,0x83,0x84,0x86,0x86,0x86,0x86,0x86,0x86,0x86,0x86, + 0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x87,0x88,0x89,0x8a,0x8a,0x8b,0x8c,0x8c, + 0x8b,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c,0x8c,0x8b,0x8b,0x8c,0x8d,0x8f,0x8f,0x8f, + 0x8f,0x8f,0x8f,0x8f,0x90,0x90,0x90,0x91,0x91,0x91,0x92,0x92,0x93,0x93,0x93, + 0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x97,0x97,0x97,0x96,0x96, + 0x96,0x96,0x97,0x98,0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a, + 0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0xa0,0xa0,0xa0,0xa0, + 0xa1,0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xaa,0xac,0xaa, + 0xa7,0xa9,0xab,0xac,0xa9,0xa7,0xa9,0xab,0xac,0xa5,0xa7,0xc8,0x9e,0x32,0x00, + 0x0f,0x8d,0xc0,0xb1,0xac,0xa9,0xac,0xae,0xaf,0xae,0xad,0xad,0xad,0xad,0xad, + 0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf, + 0xb0,0xb0,0xaf,0xae,0xac,0xad,0xb1,0xb2,0xb0,0xaf,0xb0,0xb2,0xae,0xab,0xae, + 0xaf,0xaf,0xaf,0xaf,0xb0,0xaf,0xae,0xb4,0xb8,0xb9,0x78,0x0a,0x00,0x00,0x03, + 0x03,0x03,0x02,0x02,0x02,0x01,0x00,0x00,0x01,0x01,0x02,0x03,0x00,0x00,0x01, + 0x01,0x01,0x00,0x00,0x02,0x03,0x02,0x00,0x00,0x02,0x04,0x05,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03, + 0x03,0x04,0x04,0x00,0x00,0x24,0x60,0xb2,0xc7,0xaa,0xa7,0xaa,0xb3,0xb2,0x9d, + 0x41,0x00,0x02,0x03,0x00,0x07,0x09,0x03,0x01,0x01,0x00,0x1c,0x98,0xc4,0xbc, + 0xae,0xa5,0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xad,0xad,0xad,0xac,0xab, + 0xaa,0xaa,0xa9,0xa9,0xa8,0xa7,0xa7,0xa6,0xa6,0xa6,0xa7,0xa7,0xa8,0xa9,0xaa, + 0xab,0xad,0xae,0xae,0xae,0xac,0xaa,0xa8,0xa7,0xa5,0xa6,0xa7,0xa9,0xab,0xae, + 0xb1,0xaf,0xab,0xaa,0xaa,0xa8,0xa7,0xa5,0xa3,0xa2,0xa1,0xa0,0x9f,0x9e,0x9e, + 0x9f,0x9e,0x9c,0x9c,0x9b,0x99,0x98,0x96,0x93,0x90,0x8d,0x8b,0x8a,0x87,0x84, + 0x81,0x80,0x81,0x86,0x8a,0xc8,0x4e,0x4e,0x4e,0x4e,0x4f,0x50,0x52,0x53,0x53, + 0x53,0x53,0x53,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x58,0x58,0x58, + 0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5e, + 0x5e,0x5f,0x60,0x61,0x62,0x63,0x65,0x65,0x64,0x63,0x62,0x63,0x65,0x66,0x65, + 0x65,0x66,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6d, + 0x6e,0x6e,0x6f,0x70,0x70,0x70,0x71,0x71,0x71,0x70,0x70,0x72,0x73,0x73,0x74, + 0x75,0x77,0x77,0x77,0x78,0x77,0x77,0x77,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c, + 0x7d,0x7c,0x7b,0x7b,0x7d,0x7e,0x7e,0x7e,0x7e,0x7c,0x7c,0x7f,0x81,0x82,0x82, + 0x82,0x7f,0x82,0x86,0x85,0x83,0x83,0x84,0x85,0x86,0x86,0x86,0x86,0x86,0x86, + 0x86,0x87,0x87,0x87,0x87,0x88,0x89,0x89,0x8a,0x89,0x89,0x89,0x89,0x8a,0x8a, + 0x8a,0x8a,0x8c,0x8d,0x8c,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8e,0x92,0x91,0x8d,0x8e,0x91,0x92,0x91,0x91,0x91,0x91,0x92,0x92,0x93, + 0x92,0x92,0x94,0x95,0x94,0x95,0x96,0x94,0x94,0x96,0x96,0x96,0x95,0x97,0x98, + 0x96,0x94,0x95,0x96,0x95,0x97,0x98,0x98,0x98,0x98,0x98,0x99,0x98,0x98,0x98, + 0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9e,0x9f,0x9f,0x9f,0x9f, + 0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xaa, + 0xab,0xaa,0xa7,0xa8,0xaa,0xac,0xaa,0xa7,0xaa,0xac,0xaa,0xa3,0xa6,0xc8,0xa5, + 0x46,0x09,0x0b,0x82,0xb9,0xb5,0xac,0xa6,0xae,0xb0,0xae,0xad,0xac,0xac,0xac, + 0xac,0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xae,0xae,0xae,0xad, + 0xac,0xad,0xae,0xb1,0xb0,0xae,0xad,0xad,0xae,0xb2,0xb3,0xb0,0xb0,0xb4,0xb1, + 0xad,0xab,0xad,0xb2,0xb2,0xb0,0xb0,0xb0,0xb0,0xae,0xb1,0xc4,0x91,0x2c,0x07, + 0x00,0x03,0x05,0x02,0x00,0x00,0x02,0x01,0x00,0x00,0x02,0x02,0x02,0x01,0x02, + 0x01,0x01,0x01,0x01,0x00,0x01,0x02,0x02,0x02,0x00,0x00,0x02,0x03,0x03,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x02,0x03,0x03,0x00,0x00,0x20,0x5a,0xae,0xc5,0xa8,0xa3,0xa7,0xb6, + 0xb2,0x96,0x3c,0x00,0x03,0x05,0x01,0x03,0x06,0x05,0x04,0x03,0x00,0x1b,0x9a, + 0xc5,0xb9,0xad,0xa6,0xaa,0xaa,0xa9,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xaa,0xab, + 0xac,0xae,0xae,0xae,0xae,0xad,0xab,0xa9,0xa7,0xa7,0xa7,0xa7,0xa8,0xa7,0xa7, + 0xa7,0xa7,0xa9,0xa7,0xa4,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa2,0xa2,0xa2,0xa2,0xa0,0x9d,0x9c,0x9c,0x9c,0x9c,0x9b,0x9a,0x99,0x98, + 0x98,0x98,0x95,0x92,0x90,0x91,0x93,0xc8,0x4f,0x4f,0x4e,0x4e,0x4f,0x50,0x52, + 0x53,0x53,0x53,0x53,0x53,0x55,0x56,0x56,0x55,0x55,0x56,0x56,0x57,0x57,0x57, + 0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5a,0x5b,0x5d,0x5e,0x5e,0x5e,0x5e, + 0x5f,0x5f,0x5f,0x60,0x60,0x61,0x62,0x62,0x63,0x64,0x63,0x62,0x62,0x62,0x64, + 0x65,0x65,0x64,0x65,0x67,0x69,0x6a,0x6a,0x69,0x69,0x68,0x68,0x69,0x69,0x69, + 0x6a,0x6c,0x6d,0x6e,0x6f,0x6f,0x6f,0x70,0x70,0x71,0x71,0x70,0x70,0x72,0x72, + 0x73,0x74,0x74,0x74,0x75,0x76,0x76,0x77,0x77,0x77,0x77,0x77,0x78,0x78,0x79, + 0x7a,0x7c,0x7e,0x7e,0x7b,0x79,0x7c,0x7e,0x7c,0x7d,0x7e,0x7d,0x7e,0x7f,0x81, + 0x82,0x82,0x81,0x7e,0x82,0x87,0x86,0x84,0x83,0x84,0x85,0x86,0x86,0x86,0x85, + 0x85,0x86,0x86,0x87,0x87,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x89,0x89, + 0x89,0x89,0x89,0x89,0x8c,0x8d,0x8d,0x8d,0x8d,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8b,0x8c,0x8f,0x93,0x92,0x8c,0x8e,0x92,0x93,0x92,0x90,0x90,0x91,0x91, + 0x92,0x93,0x93,0x93,0x94,0x95,0x94,0x95,0x96,0x94,0x94,0x95,0x96,0x96,0x95, + 0x97,0x98,0x95,0x94,0x96,0x96,0x95,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x98, + 0x98,0x98,0x99,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, + 0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7, + 0xa7,0xa7,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa9,0xa9, + 0xa9,0xaa,0xaa,0xaa,0xa8,0xa8,0xaa,0xac,0xaa,0xa8,0xac,0xad,0xaa,0xa3,0xa7, + 0xc7,0xaa,0x58,0x14,0x0b,0x78,0xb2,0xb9,0xae,0xa5,0xae,0xb1,0xae,0xad,0xac, + 0xac,0xac,0xac,0xad,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xae,0xaf, + 0xae,0xad,0xac,0xac,0xae,0xb0,0xb0,0xae,0xad,0xac,0xab,0xaf,0xb2,0xb0,0xb0, + 0xb3,0xb2,0xaf,0xac,0xae,0xb3,0xb2,0xb0,0xb0,0xb1,0xb2,0xab,0xac,0xc8,0xa8, + 0x57,0x1d,0x00,0x03,0x05,0x02,0x01,0x01,0x02,0x02,0x00,0x02,0x03,0x02,0x01, + 0x00,0x02,0x03,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x00,0x01,0x02,0x03,0x00,0x00,0x1d,0x56,0xad,0xc5,0xa9,0xa3, + 0xa8,0xbb,0xb4,0x90,0x38,0x00,0x03,0x06,0x02,0x01,0x02,0x06,0x07,0x06,0x00, + 0x1a,0x98,0xc4,0xb9,0xaf,0xaa,0xae,0xae,0xaa,0xaa,0xaa,0xa8,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,0xab,0xad,0xad,0xad,0xac, + 0xad,0xae,0xb0,0xb1,0xb0,0xaf,0xad,0xac,0xab,0xa8,0xa7,0xa7,0xaa,0xab,0xab, + 0xaa,0xa7,0xa5,0xa4,0xa5,0xa5,0xa4,0xa3,0xa4,0xa4,0xa5,0xa7,0xa7,0xa9,0xaa, + 0xaa,0xaa,0xaa,0xa9,0xa8,0xa9,0xaa,0xa7,0xa5,0xa5,0xa6,0xa7,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa9,0xa9,0xaa,0xa7,0xa3,0xa0,0x9f,0xc8,0x4f,0x4f,0x4e,0x4e,0x4f, + 0x50,0x53,0x53,0x53,0x53,0x53,0x53,0x55,0x56,0x55,0x55,0x55,0x56,0x57,0x57, + 0x58,0x58,0x58,0x58,0x59,0x5a,0x5a,0x5c,0x5c,0x5a,0x5a,0x5b,0x5e,0x5f,0x5f, + 0x5e,0x5c,0x5d,0x5e,0x61,0x60,0x5f,0x60,0x61,0x62,0x63,0x63,0x63,0x62,0x62, + 0x62,0x64,0x65,0x65,0x64,0x65,0x66,0x68,0x69,0x69,0x68,0x68,0x69,0x69,0x69, + 0x6a,0x6b,0x6b,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x70,0x71,0x72, + 0x71,0x71,0x72,0x73,0x74,0x74,0x74,0x75,0x76,0x76,0x77,0x77,0x77,0x78,0x78, + 0x76,0x76,0x78,0x7b,0x7d,0x7d,0x7b,0x7a,0x7b,0x7c,0x7b,0x7c,0x7f,0x88,0x89, + 0x81,0x7f,0x7f,0x7c,0x7e,0x81,0x85,0x87,0x83,0x82,0x82,0x83,0x84,0x85,0x85, + 0x85,0x85,0x85,0x86,0x86,0x86,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x89,0x89, + 0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8e,0x91,0x90,0x90,0x90,0x91,0x91,0x92,0x91,0x90,0x91, + 0x93,0x91,0x92,0x95,0x96,0x95,0x94,0x93,0x95,0x95,0x95,0x98,0x97,0x95,0x95, + 0x95,0x97,0x97,0x95,0x96,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x9b,0x9b, + 0x9b,0x9a,0x99,0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d, + 0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4, + 0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9, + 0xa9,0xa9,0xa9,0xaa,0xab,0xaa,0xa8,0xaa,0xaa,0xab,0xaa,0xaa,0xab,0xad,0xac, + 0xa5,0xa7,0xc6,0xae,0x65,0x1c,0x0a,0x70,0xad,0xc0,0xb5,0xa8,0xad,0xaf,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf,0xae,0xae,0xae,0xae,0xaf, + 0xaf,0xaf,0xaf,0xaf,0xb0,0xae,0xae,0xae,0xb0,0xb1,0xab,0xa8,0xa8,0xa9,0xaa, + 0xae,0xb0,0xae,0xae,0xb0,0xb3,0xb3,0xae,0xae,0xae,0xb2,0xb3,0xb2,0xaa,0xaa, + 0xc1,0xb5,0x86,0x34,0x00,0x02,0x05,0x03,0x05,0x06,0x02,0x01,0x03,0x03,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x06,0x02,0x00,0x1b,0x53,0xad,0xc8, + 0xad,0xa7,0xac,0xc0,0xb5,0x89,0x35,0x00,0x03,0x05,0x02,0x01,0x02,0x04,0x07, + 0x09,0x00,0x1a,0x98,0xc3,0xba,0xb5,0xb2,0xb5,0xb4,0xb0,0xae,0xae,0xaf,0xaf, + 0xae,0xae,0xae,0xae,0xae,0xae,0xaf,0xb0,0xb0,0xb1,0xb0,0xaf,0xb0,0xb2,0xb2, + 0xb2,0xb1,0xb1,0xb1,0xb2,0xb2,0xaf,0xad,0xaa,0xac,0xae,0xac,0xaa,0xa9,0xaa, + 0xab,0xab,0xab,0xaa,0xaa,0xaa,0xab,0xae,0xb1,0xb1,0xb1,0xb0,0xb0,0xb1,0xb1, + 0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb2,0xb2,0xb1,0xb1,0xb1,0xb0, + 0xae,0xaa,0xad,0xaf,0xaa,0xaa,0xae,0xb2,0xb4,0xaf,0xa8,0xc8,0x4e,0x4e,0x4d, + 0x4d,0x4e,0x50,0x51,0x52,0x52,0x52,0x52,0x53,0x53,0x54,0x54,0x54,0x54,0x55, + 0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x58,0x59,0x5c,0x5c,0x5a,0x59,0x5a,0x5e, + 0x5f,0x5e,0x5d,0x5b,0x5c,0x5e,0x61,0x60,0x5f,0x60,0x61,0x62,0x62,0x63,0x63, + 0x62,0x62,0x62,0x64,0x65,0x64,0x64,0x65,0x66,0x67,0x67,0x67,0x67,0x68,0x69, + 0x69,0x6a,0x6b,0x6b,0x6b,0x6c,0x6d,0x6e,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x70, + 0x71,0x72,0x71,0x71,0x72,0x72,0x73,0x74,0x74,0x75,0x75,0x76,0x77,0x77,0x77, + 0x78,0x78,0x74,0x76,0x79,0x7b,0x7b,0x7a,0x7b,0x7c,0x7e,0x7d,0x7a,0x7e,0x83, + 0x86,0x84,0x7f,0x7e,0x7f,0x7c,0x7e,0x82,0x84,0x83,0x82,0x82,0x82,0x83,0x84, + 0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x87,0x88,0x88,0x89,0x89,0x89, + 0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b,0x8b,0x8b,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x90,0x91,0x90,0x90,0x91,0x91,0x91,0x92,0x91, + 0x91,0x92,0x93,0x92,0x93,0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x98,0x96, + 0x94,0x95,0x96,0x97,0x96,0x95,0x98,0x99,0x98,0x98,0x98,0x98,0x98,0x98,0x99, + 0x9a,0x9a,0x9b,0x9a,0x99,0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9d,0x9d,0x9e,0x9f,0x9e,0x9f,0x9f,0xa0,0x9f,0xa0,0x9f,0x9f,0x9f, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8, + 0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,0xab,0xa9,0xa7,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xac,0xad,0xa7,0xa7,0xc3,0xb2,0x78,0x27,0x07,0x62,0xa3,0xc4,0xb8,0xa7,0xad, + 0xaf,0xae,0xaf,0xb0,0xaf,0xae,0xae,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xae,0xae, + 0xaf,0xaf,0xb0,0xaf,0xae,0xaf,0xb1,0xb1,0xb1,0xaf,0xae,0xae,0xab,0xaf,0xbb, + 0xbb,0xb6,0xb2,0xaf,0xaf,0xae,0xaf,0xb3,0xb4,0xb0,0xae,0xae,0xb1,0xb2,0xb2, + 0xac,0xaa,0xb7,0xbc,0xad,0x48,0x00,0x00,0x04,0x01,0x03,0x05,0x03,0x03,0x03, + 0x03,0x02,0x02,0x01,0x00,0x00,0x02,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x06,0x03,0x00,0x1b,0x51, + 0xae,0xc8,0xae,0xaa,0xaf,0xc5,0xb4,0x80,0x31,0x00,0x03,0x05,0x02,0x02,0x02, + 0x03,0x05,0x06,0x00,0x1d,0x9e,0xc8,0xba,0xb5,0xb3,0xb6,0xb5,0xb4,0xb3,0xb3, + 0xb5,0xb5,0xb4,0xb3,0xb3,0xb3,0xb3,0xb4,0xb5,0xb5,0xb5,0xb5,0xb5,0xb4,0xb4, + 0xb5,0xb6,0xb6,0xb5,0xb5,0xb6,0xb7,0xb7,0xb5,0xb3,0xb1,0xb4,0xb6,0xb5,0xb3, + 0xb2,0xb3,0xb4,0xb5,0xb5,0xb5,0xb5,0xb5,0xb6,0xb8,0xb9,0xb9,0xb8,0xb8,0xb7, + 0xb6,0xb5,0xb5,0xb5,0xb4,0xb3,0xb2,0xb2,0xb1,0xaf,0xae,0xb0,0xb0,0xaf,0xae, + 0xac,0xac,0xaa,0xa8,0xa8,0xa7,0xa3,0xa3,0xa7,0xa7,0xa4,0x9d,0x97,0xc8,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4e,0x4f,0x50,0x50,0x50,0x50,0x51,0x53,0x53,0x53,0x53, + 0x53,0x53,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x5a,0x5a,0x59,0x59, + 0x5a,0x5c,0x5e,0x5e,0x5c,0x5b,0x5c,0x5e,0x60,0x5f,0x5f,0x60,0x61,0x62,0x62, + 0x63,0x63,0x62,0x62,0x63,0x63,0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x67, + 0x68,0x69,0x69,0x6a,0x6c,0x6b,0x6a,0x6c,0x6d,0x6f,0x6f,0x6f,0x6f,0x6f,0x70, + 0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x72,0x74,0x74,0x74,0x75,0x76,0x77, + 0x77,0x78,0x79,0x78,0x74,0x76,0x7b,0x7b,0x7a,0x76,0x79,0x7e,0x7f,0x7e,0x7c, + 0x80,0x82,0x74,0x71,0x7d,0x81,0x81,0x7f,0x80,0x83,0x81,0x7f,0x82,0x83,0x82, + 0x83,0x84,0x85,0x85,0x85,0x85,0x85,0x86,0x86,0x86,0x86,0x86,0x88,0x88,0x89, + 0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8d,0x8c,0x8c,0x8d,0x8e,0x8f, + 0x8e,0x8e,0x8e,0x8e,0x8f,0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x91,0x91, + 0x91,0x92,0x93,0x92,0x91,0x93,0x94,0x92,0x92,0x93,0x95,0x96,0x96,0x97,0x97, + 0x95,0x95,0x95,0x96,0x97,0x96,0x96,0x97,0x98,0x98,0x99,0x98,0x98,0x98,0x98, + 0x99,0x98,0x96,0x98,0x9a,0x99,0x98,0x98,0x99,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9d,0x9d,0x9d,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0, + 0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa7,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8, + 0xa8,0xa8,0xa8,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xa8,0xa7,0xaa,0xaa,0xa9,0xaa, + 0xaa,0xaa,0xaa,0xac,0xa7,0xa7,0xbd,0xb7,0x90,0x33,0x03,0x4e,0x95,0xc6,0xb8, + 0xa3,0xae,0xb0,0xad,0xae,0xb0,0xaf,0xaf,0xae,0xae,0xae,0xae,0xae,0xaf,0xaf, + 0xaf,0xae,0xae,0xae,0xaf,0xb0,0xae,0xae,0xae,0xb2,0xb4,0xb2,0xac,0xa8,0xae, + 0xb9,0xc6,0xc6,0xbf,0xb5,0xb0,0xb2,0xb1,0xae,0xaf,0xb2,0xb5,0xb2,0xae,0xae, + 0xb0,0xb1,0xae,0xad,0xac,0xbb,0xc8,0x5d,0x00,0x00,0x03,0x00,0x00,0x00,0x03, + 0x03,0x02,0x01,0x02,0x05,0x03,0x00,0x02,0x03,0x03,0x02,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x01,0x00,0x00,0x03,0x02,0x01, + 0x1a,0x4f,0xad,0xc8,0xae,0xaa,0xb2,0xc7,0xb2,0x77,0x2b,0x00,0x04,0x07,0x03, + 0x02,0x02,0x04,0x03,0x00,0x00,0x23,0xa8,0xc8,0xba,0xb3,0xb1,0xb3,0xb5,0xb5, + 0xb6,0xb7,0xb8,0xb8,0xb7,0xb6,0xb6,0xb5,0xb5,0xb6,0xb7,0xb7,0xb7,0xb7,0xb7, + 0xb6,0xb6,0xb8,0xb8,0xb8,0xb8,0xb9,0xba,0xbc,0xbd,0xbd,0xbc,0xbb,0xbc,0xbd, + 0xbd,0xbd,0xbc,0xbd,0xbd,0xbf,0xc0,0xc0,0xc0,0xbf,0xc0,0xbd,0xb9,0xb9,0xb8, + 0xb7,0xb5,0xb4,0xb2,0xb2,0xb1,0xaf,0xae,0xae,0xac,0xa7,0xa5,0xa4,0xa3,0xa3, + 0xa4,0xa2,0x9f,0x9f,0xa0,0xa1,0x9c,0x98,0x97,0x97,0x97,0x90,0x86,0x7c,0x7a, + 0xc8,0x4c,0x4c,0x4c,0x4c,0x4c,0x4e,0x50,0x50,0x50,0x51,0x51,0x52,0x53,0x53, + 0x53,0x53,0x53,0x53,0x54,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x57,0x58,0x59, + 0x58,0x59,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x60, + 0x61,0x62,0x62,0x63,0x62,0x62,0x62,0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x65, + 0x65,0x66,0x67,0x68,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6d,0x6e,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x72,0x72,0x73,0x74,0x74,0x75, + 0x76,0x76,0x77,0x78,0x78,0x78,0x76,0x76,0x78,0x78,0x7a,0x7d,0x7c,0x7a,0x74, + 0x79,0x8a,0x80,0x69,0x46,0x52,0x8d,0x8f,0x7f,0x7d,0x7e,0x81,0x81,0x80,0x80, + 0x80,0x82,0x82,0x83,0x84,0x84,0x84,0x84,0x85,0x85,0x86,0x86,0x86,0x86,0x87, + 0x88,0x88,0x88,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,0x8c,0x8d,0x8c,0x8c,0x8d, + 0x8e,0x8f,0x8f,0x8e,0x8e,0x8f,0x8f,0x90,0x91,0x91,0x8f,0x8e,0x92,0x92,0x8f, + 0x8f,0x8f,0x8f,0x91,0x94,0x91,0x8e,0x93,0x95,0x93,0x91,0x90,0x90,0x92,0x97, + 0x98,0x96,0x94,0x95,0x97,0x96,0x96,0x99,0x99,0x97,0x92,0x91,0x99,0x9b,0x98, + 0x98,0x98,0x96,0x98,0x99,0x9a,0x99,0x98,0x98,0x98,0x99,0x9a,0x9a,0x9b,0x9c, + 0x9c,0x9c,0x9d,0x9d,0x9c,0x9c,0x9d,0x9d,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0, + 0xa0,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa6, + 0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xaa,0xaa,0xaa,0xa8,0xa7,0xa9,0xaa, + 0xa9,0xaa,0xaa,0xaa,0xaa,0xac,0xa7,0xa7,0xb7,0xb9,0xa5,0x41,0x00,0x35,0x7d, + 0xc2,0xb6,0xa3,0xaf,0xb2,0xac,0xad,0xae,0xae,0xae,0xad,0xad,0xae,0xae,0xae, + 0xae,0xaf,0xaf,0xae,0xae,0xac,0xac,0xae,0xb3,0xb0,0xac,0xae,0xb1,0xb4,0xae, + 0xa9,0xc0,0xae,0x6a,0x63,0x7d,0xaa,0xbd,0xb1,0xaf,0xb0,0xac,0xae,0xb5,0xb4, + 0xb0,0xae,0xad,0xad,0xb0,0xb2,0xac,0xb7,0xc6,0x7f,0x31,0x0a,0x00,0x04,0x03, + 0x03,0x04,0x03,0x00,0x00,0x01,0x04,0x03,0x00,0x01,0x01,0x01,0x01,0x02,0x01, + 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x03, + 0x01,0x00,0x12,0x43,0xa8,0xc8,0xb1,0xac,0xb2,0xc7,0xaf,0x71,0x29,0x00,0x05, + 0x08,0x03,0x02,0x02,0x06,0x03,0x00,0x00,0x2b,0xad,0xc8,0xb7,0xb2,0xb2,0xb4, + 0xb5,0xb5,0xb5,0xb5,0xb6,0xb6,0xb5,0xb5,0xb4,0xb3,0xb2,0xb2,0xb2,0xb2,0xb1, + 0xb1,0xb0,0xb0,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xae,0xaf,0xb1,0xb1,0xb1,0xb0, + 0xb0,0xaf,0xb0,0xaf,0xae,0xae,0xad,0xac,0xac,0xab,0xaa,0xa9,0xa7,0xa3,0xa0, + 0x9f,0x9e,0x9d,0x9c,0x9b,0x99,0x98,0x97,0x96,0x95,0x95,0x94,0x94,0x91,0x8f, + 0x8e,0x8f,0x91,0x92,0x91,0x91,0x91,0x91,0x91,0x8e,0x8f,0x8e,0x8c,0x87,0x82, + 0x7f,0x7f,0xc8,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x50,0x50,0x50,0x51,0x51,0x52, + 0x52,0x53,0x53,0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x56,0x56,0x56,0x56,0x56, + 0x56,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5c,0x5e,0x5e,0x5d,0x5c,0x5e,0x5e, + 0x5f,0x5f,0x60,0x61,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x64,0x65,0x65,0x65, + 0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x68,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e, + 0x6f,0x6f,0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x71,0x71,0x72,0x73,0x74, + 0x74,0x74,0x75,0x75,0x76,0x76,0x78,0x78,0x78,0x77,0x75,0x76,0x79,0x7f,0x7d, + 0x77,0x6d,0x78,0x95,0x7c,0x4f,0x26,0x3f,0x97,0x97,0x7d,0x7b,0x7c,0x7f,0x81, + 0x82,0x7f,0x7f,0x80,0x82,0x82,0x82,0x83,0x83,0x83,0x84,0x85,0x85,0x86,0x86, + 0x86,0x86,0x87,0x86,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8b, + 0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8f,0x8f,0x8f,0x8d,0x8d,0x93, + 0x94,0x8d,0x8d,0x90,0x8e,0x90,0x95,0x91,0x8d,0x93,0x95,0x93,0x90,0x8d,0x8c, + 0x90,0x97,0x98,0x95,0x91,0x93,0x99,0x96,0x94,0x9a,0x99,0x91,0x8d,0x8d,0x98, + 0x9b,0x98,0x98,0x98,0x95,0x97,0x9c,0x9a,0x99,0x98,0x98,0x98,0x99,0x99,0x9a, + 0x9a,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e,0x9f,0x9f,0x9f, + 0x9f,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa5, + 0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xaa,0xaa,0xaa,0xa9,0xa8, + 0xa9,0xaa,0xa9,0xaa,0xaa,0xaa,0xab,0xab,0xa8,0xa8,0xb2,0xbb,0xb6,0x4e,0x00, + 0x1b,0x65,0xbe,0xb9,0xa5,0xb0,0xb1,0xab,0xac,0xae,0xad,0xac,0xac,0xac,0xad, + 0xae,0xae,0xae,0xaf,0xaf,0xae,0xae,0xac,0xac,0xae,0xb4,0xb2,0xac,0xac,0xae, + 0xb2,0xb1,0xb1,0xc0,0x91,0x1d,0x0e,0x3d,0x9e,0xc8,0xaf,0xae,0xb0,0xac,0xae, + 0xb3,0xb4,0xb2,0xaf,0xad,0xac,0xb1,0xb4,0xac,0xb4,0xc2,0x9c,0x5e,0x12,0x00, + 0x0a,0x07,0x04,0x04,0x03,0x02,0x01,0x01,0x03,0x03,0x02,0x01,0x00,0x00,0x00, + 0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x02,0x03,0x00,0x00,0x0a,0x36,0xa2,0xc8,0xb4,0xae,0xb0,0xc6,0xae,0x70,0x28, + 0x00,0x06,0x09,0x04,0x02,0x02,0x07,0x04,0x00,0x02,0x34,0xae,0xc8,0xb4,0xb3, + 0xb4,0xb5,0xb5,0xb5,0xb4,0xb5,0xb5,0xb5,0xb5,0xb4,0xb3,0xb2,0xb2,0xb0,0xaf, + 0xae,0xae,0xae,0xad,0xac,0xaa,0xaa,0xaa,0xa9,0xa8,0xa7,0xa7,0xa8,0xa9,0xaa, + 0xaa,0xa9,0xa8,0xa7,0xa7,0xa7,0xa6,0xa4,0xa2,0xa0,0xa0,0xa0,0x9f,0x9c,0x9a, + 0x98,0x95,0x95,0x95,0x94,0x93,0x92,0x91,0x91,0x90,0x8f,0x8f,0x8e,0x8f,0x91, + 0x8f,0x8c,0x8d,0x8d,0x90,0x92,0x93,0x93,0x91,0x90,0x91,0x94,0x94,0x93,0x91, + 0x90,0x91,0x92,0x93,0xc8,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x50,0x50, + 0x50,0x51,0x51,0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,0x54,0x54, + 0x55,0x55,0x55,0x56,0x58,0x5a,0x5a,0x59,0x59,0x5a,0x5c,0x5e,0x5e,0x5d,0x5b, + 0x5c,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x62,0x62,0x62,0x62,0x61,0x62,0x63, + 0x63,0x63,0x64,0x65,0x65,0x66,0x66,0x66,0x66,0x66,0x65,0x67,0x6b,0x6b,0x6a, + 0x6a,0x6a,0x6b,0x6c,0x6c,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x71, + 0x72,0x73,0x73,0x74,0x74,0x74,0x74,0x74,0x75,0x76,0x76,0x78,0x78,0x78,0x77, + 0x78,0x78,0x78,0x73,0x7c,0x94,0x70,0x3d,0x28,0x45,0x8f,0x91,0x7b,0x7a,0x7b, + 0x7f,0x7f,0x80,0x7f,0x80,0x80,0x81,0x81,0x82,0x82,0x82,0x82,0x82,0x84,0x85, + 0x85,0x85,0x84,0x85,0x85,0x85,0x86,0x86,0x87,0x88,0x88,0x88,0x88,0x89,0x89, + 0x89,0x8a,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d, + 0x8d,0x95,0x95,0x8d,0x8f,0x94,0x91,0x91,0x94,0x93,0x92,0x95,0x95,0x92,0x8d, + 0x8b,0x8d,0x91,0x94,0x96,0x95,0x8a,0x8e,0x9d,0x97,0x91,0x98,0x91,0x84,0x8a, + 0x92,0x97,0x98,0x97,0x99,0x9a,0x95,0x95,0x98,0x99,0x99,0x99,0x99,0x99,0x9a, + 0x9a,0x9a,0x9a,0x99,0x99,0x9a,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e, + 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1,0xa2,0xa2,0xa2, + 0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4, + 0xa5,0xa5,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,0xaa, + 0xaa,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xac,0xac,0xab,0xaa,0xaa,0xaf,0xbc,0xc1, + 0x57,0x00,0x03,0x4f,0xbe,0xc0,0xac,0xae,0xae,0xad,0xad,0xad,0xac,0xac,0xac, + 0xac,0xac,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xae,0xae,0xb1,0xb1,0xad,0xaf,0xb3, + 0xb2,0xad,0xa7,0xb5,0xc0,0xa2,0x64,0x0d,0x00,0x21,0x97,0xc8,0xaf,0xab,0xae, + 0xb2,0xb2,0xaf,0xaf,0xb1,0xaf,0xb0,0xb2,0xb2,0xaf,0xaa,0xb5,0xc6,0xa9,0x6e, + 0x13,0x00,0x0e,0x07,0x00,0x01,0x06,0x0b,0x09,0x04,0x00,0x02,0x07,0x04,0x02, + 0x01,0x01,0x02,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x02,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x03,0x04,0x02,0x00,0x00,0x03,0x2a,0x9b,0xc8,0xb7,0xae,0xaf,0xc7,0xb0, + 0x73,0x29,0x00,0x06,0x08,0x03,0x01,0x02,0x08,0x06,0x03,0x0d,0x40,0xac,0xc8, + 0xb3,0xb6,0xb9,0xb6,0xb5,0xb5,0xb5,0xb6,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5,0xb5, + 0xb5,0xb5,0xb4,0xb3,0xb3,0xb2,0xaf,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xb0,0xb0, + 0xb0,0xb0,0xaf,0xaf,0xae,0xae,0xae,0xae,0xad,0xab,0xaa,0xaa,0xab,0xad,0xae, + 0xad,0xac,0xad,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae, + 0xae,0xad,0xaa,0xaa,0xae,0xaf,0xab,0xaa,0xab,0xaf,0xae,0xa7,0xa9,0xac,0xac, + 0xac,0xad,0xae,0xb1,0xb1,0xb1,0xc8,0x4b,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4d, + 0x4e,0x4f,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x52,0x53,0x53,0x54,0x53, + 0x53,0x54,0x54,0x55,0x55,0x57,0x58,0x59,0x59,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d, + 0x5c,0x5b,0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x60,0x61,0x62,0x62,0x62,0x60, + 0x62,0x63,0x63,0x63,0x64,0x65,0x66,0x66,0x67,0x66,0x66,0x66,0x65,0x67,0x6a, + 0x6a,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d,0x6e,0x6f,0x70, + 0x70,0x70,0x71,0x72,0x73,0x73,0x73,0x73,0x73,0x73,0x74,0x75,0x75,0x76,0x78, + 0x78,0x78,0x78,0x78,0x78,0x73,0x7d,0x94,0x74,0x45,0x2b,0x46,0x8f,0x8d,0x77, + 0x7a,0x7c,0x7e,0x7f,0x7f,0x80,0x81,0x80,0x80,0x81,0x82,0x82,0x82,0x82,0x83, + 0x84,0x84,0x85,0x84,0x84,0x85,0x85,0x85,0x85,0x86,0x87,0x88,0x88,0x88,0x88, + 0x87,0x87,0x88,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,0x8d,0x8d,0x8d,0x8d, + 0x8c,0x8c,0x8d,0x91,0x90,0x8b,0x8e,0x93,0x91,0x90,0x8f,0x91,0x94,0x92,0x90, + 0x8e,0x8d,0x8d,0x90,0x92,0x95,0x95,0x93,0x88,0x8d,0x9c,0x92,0x8a,0x94,0x92, + 0x89,0x87,0x8c,0x97,0x98,0x92,0x97,0x99,0x95,0x96,0x9a,0x99,0x98,0x98,0x98, + 0x99,0x99,0x9a,0x9a,0x9a,0x99,0x99,0x99,0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9d,0x9d,0x9e,0x9e,0x9e,0x9e,0x9d,0x9e,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1, + 0xa2,0xa2,0xa2,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa4,0xa4,0xa5,0xa4,0xa4,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xaa, + 0xaa,0xaa,0xaa,0xaa,0xa9,0xaa,0xac,0xaa,0xaa,0xac,0xad,0xab,0xaa,0xab,0xae, + 0xbd,0xc8,0x5b,0x00,0x00,0x43,0xc0,0xc5,0xaf,0xaa,0xab,0xaf,0xae,0xad,0xad, + 0xad,0xac,0xac,0xad,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xb0,0xb1,0xb0,0xac, + 0xae,0xb2,0xb4,0xaf,0xa5,0xbb,0xc5,0x7f,0x39,0x06,0x00,0x10,0x7f,0xbc,0xb5, + 0xb1,0xad,0xb3,0xb3,0xad,0xae,0xb0,0xae,0xaf,0xb2,0xb1,0xae,0xac,0xb2,0xbb, + 0xb9,0x93,0x2f,0x02,0x05,0x03,0x03,0x03,0x05,0x08,0x07,0x05,0x02,0x03,0x04, + 0x03,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x03,0x05,0x01,0x00,0x01,0x00,0x21,0x95,0xc5,0xb9,0xb0,0xaf, + 0xc8,0xb0,0x70,0x28,0x00,0x05,0x07,0x03,0x01,0x03,0x08,0x05,0x02,0x1b,0x53, + 0xb1,0xc6,0xb3,0xb7,0xb9,0xb6,0xb5,0xb5,0xb8,0xb9,0xb6,0xb5,0xb6,0xb6,0xb6, + 0xb7,0xb8,0xb9,0xb9,0xb9,0xb8,0xb8,0xb8,0xb6,0xb5,0xb6,0xb6,0xb6,0xb6,0xb6, + 0xb6,0xb5,0xb5,0xb5,0xb4,0xb4,0xb4,0xb5,0xb5,0xb5,0xb4,0xb2,0xb2,0xb2,0xb3, + 0xb5,0xb5,0xb5,0xb5,0xb5,0xb7,0xb7,0xb7,0xb8,0xb9,0xb9,0xb9,0xb9,0xb9,0xb9, + 0xb9,0xba,0xba,0xb9,0xb9,0xb9,0xb9,0xb9,0xb5,0xb6,0xb8,0xba,0xb9,0xb4,0xb5, + 0xb9,0xb6,0xb6,0xb9,0xb9,0xb9,0xb9,0xba,0xc8,0x49,0x49,0x4a,0x4a,0x4b,0x4c, + 0x4c,0x4c,0x4d,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x52,0x53, + 0x53,0x53,0x53,0x54,0x55,0x55,0x57,0x57,0x57,0x57,0x59,0x5a,0x5b,0x5b,0x5b, + 0x5b,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x60,0x61,0x62,0x62, + 0x61,0x60,0x61,0x62,0x63,0x64,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x66, + 0x67,0x69,0x69,0x69,0x69,0x69,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,0x6c,0x6d,0x6e, + 0x6e,0x6f,0x70,0x70,0x71,0x72,0x72,0x72,0x72,0x72,0x72,0x72,0x74,0x76,0x74, + 0x74,0x74,0x77,0x79,0x7a,0x79,0x77,0x70,0x7b,0x94,0x7e,0x57,0x2f,0x44,0x92, + 0x8d,0x72,0x7a,0x7e,0x7c,0x7d,0x7f,0x80,0x81,0x80,0x80,0x81,0x82,0x82,0x82, + 0x82,0x83,0x84,0x84,0x85,0x84,0x84,0x86,0x86,0x85,0x85,0x86,0x87,0x89,0x89, + 0x89,0x88,0x87,0x87,0x88,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8c,0x8d,0x8d, + 0x8d,0x8d,0x8d,0x8d,0x8c,0x8b,0x8a,0x8a,0x8d,0x8f,0x91,0x8e,0x8a,0x8f,0x94, + 0x8d,0x8a,0x8a,0x8c,0x8f,0x8f,0x92,0x97,0x95,0x91,0x8a,0x8d,0x97,0x8a,0x82, + 0x91,0x97,0x94,0x86,0x82,0x97,0x98,0x8d,0x92,0x97,0x96,0x98,0x9c,0x99,0x97, + 0x97,0x98,0x98,0x99,0x99,0x9a,0x9a,0x99,0x9a,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9f,0xa0,0xa0,0xa0,0xa0, + 0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa4,0xa4,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6, + 0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa8,0xa9,0xa9, + 0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xa8,0xa9,0xac,0xaa,0xa9,0xac,0xac,0xaa,0xab, + 0xac,0xac,0xbd,0xc8,0x5d,0x00,0x00,0x3e,0xc1,0xc7,0xb0,0xa7,0xa9,0xb1,0xaf, + 0xae,0xae,0xae,0xad,0xad,0xad,0xae,0xaf,0xaf,0xaf,0xaf,0xaf,0xb0,0xb1,0xae, + 0xae,0xb0,0xae,0xae,0xb3,0xb2,0xaa,0xbe,0xc3,0x62,0x1a,0x05,0x00,0x08,0x62, + 0xa4,0xbd,0xb9,0xac,0xb1,0xb2,0xad,0xae,0xb0,0xae,0xae,0xaf,0xaf,0xaf,0xb0, + 0xae,0xaa,0xc4,0xbc,0x60,0x20,0x02,0x03,0x0a,0x08,0x03,0x00,0x01,0x04,0x06, + 0x03,0x00,0x00,0x00,0x03,0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x02,0x01,0x00,0x02,0x04,0x00,0x00,0x03,0x00,0x1b,0x8e,0xc3,0xba, + 0xb2,0xb1,0xc8,0xac,0x64,0x24,0x00,0x04,0x05,0x02,0x01,0x03,0x07,0x02,0x00, + 0x2b,0x6c,0xb8,0xc7,0xb3,0xb5,0xb7,0xb5,0xb5,0xb6,0xb9,0xb9,0xb7,0xb6,0xb7, + 0xb7,0xb7,0xb9,0xb9,0xb9,0xba,0xba,0xba,0xba,0xba,0xbc,0xbd,0xbc,0xbc,0xbb, + 0xba,0xb9,0xb9,0xb8,0xb8,0xb7,0xb7,0xb7,0xb8,0xb9,0xb9,0xb9,0xb9,0xb8,0xb7, + 0xb7,0xb8,0xb9,0xb9,0xb9,0xb7,0xb7,0xb6,0xb6,0xb6,0xb7,0xb7,0xb8,0xb8,0xb8, + 0xb8,0xb8,0xb8,0xb8,0xb8,0xba,0xbb,0xbc,0xb8,0xb5,0xb5,0xb8,0xba,0xba,0xb9, + 0xb8,0xb9,0xba,0xb7,0xb7,0xb9,0xb6,0xb3,0xb2,0xb6,0xc8,0x4a,0x4a,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x50,0x51,0x51,0x50,0x51,0x52, + 0x53,0x53,0x54,0x54,0x55,0x55,0x56,0x57,0x57,0x57,0x57,0x57,0x58,0x59,0x5a, + 0x5a,0x5a,0x5a,0x5a,0x5a,0x5a,0x5c,0x5d,0x5c,0x5d,0x5d,0x5d,0x5d,0x5f,0x60, + 0x62,0x62,0x61,0x5f,0x61,0x62,0x62,0x63,0x64,0x65,0x65,0x65,0x66,0x66,0x67, + 0x67,0x66,0x67,0x68,0x68,0x69,0x69,0x6a,0x6c,0x6d,0x6d,0x6c,0x6b,0x6b,0x6c, + 0x6c,0x6d,0x6e,0x6e,0x6f,0x70,0x70,0x70,0x71,0x71,0x71,0x71,0x71,0x71,0x74, + 0x74,0x73,0x74,0x75,0x78,0x78,0x75,0x76,0x78,0x75,0x7e,0x90,0x77,0x4e,0x2d, + 0x45,0x94,0x8d,0x72,0x79,0x7d,0x7d,0x7c,0x7d,0x7f,0x7f,0x80,0x80,0x81,0x81, + 0x81,0x82,0x82,0x82,0x83,0x84,0x84,0x84,0x84,0x86,0x86,0x85,0x85,0x86,0x87, + 0x88,0x89,0x89,0x88,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8a,0x8b,0x8c, + 0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x8f,0x8c,0x8b,0x8c,0x8c,0x8d,0x92,0x91,0x8a, + 0x8e,0x93,0x90,0x8c,0x88,0x8e,0x91,0x86,0x8a,0x9a,0x94,0x8d,0x93,0x92,0x8c, + 0x80,0x80,0x9a,0x97,0x80,0x84,0x8f,0x9c,0x9c,0x92,0x94,0x97,0x98,0x97,0x96, + 0x95,0x95,0x95,0x96,0x98,0x98,0x98,0x99,0x99,0x99,0x9a,0x9b,0x9c,0x9c,0x9b, + 0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9f,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa2, + 0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5, + 0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa8,0xa9,0xa9,0xa9,0xa9,0xaa,0xa8,0xa9,0xaa,0xaa,0xa9,0xaa,0xaa, + 0xaa,0xaa,0xab,0xaa,0xbb,0xc8,0x65,0x03,0x00,0x3a,0xb4,0xc0,0xb0,0xa6,0xa7, + 0xb0,0xaf,0xae,0xae,0xad,0xad,0xad,0xad,0xae,0xae,0xae,0xaf,0xaf,0xaf,0xae, + 0xad,0xae,0xb1,0xb2,0xae,0xaa,0xb1,0xb1,0xa9,0xbe,0xc4,0x6b,0x24,0x05,0x00, + 0x07,0x5a,0x9e,0xc0,0xbb,0xaa,0xae,0xb1,0xaf,0xae,0xaf,0xb2,0xb0,0xac,0xae, + 0xb0,0xb1,0xaf,0xad,0xb6,0xb9,0xa8,0x78,0x33,0x0c,0x00,0x03,0x06,0x04,0x03, + 0x03,0x06,0x04,0x00,0x03,0x05,0x03,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x06,0x02,0x00,0x02,0x00,0x14,0x87, + 0xc0,0xc0,0xb6,0xb2,0xc8,0xa0,0x49,0x18,0x00,0x05,0x04,0x00,0x01,0x03,0x07, + 0x00,0x00,0x3d,0x82,0xbc,0xc3,0xaf,0xb2,0xb5,0xb5,0xb6,0xb6,0xb5,0xb5,0xb5, + 0xb5,0xb5,0xb5,0xb4,0xb3,0xb3,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2, + 0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb4,0xb5,0xb5,0xb5,0xb5,0xb5,0xb6,0xb7, + 0xb8,0xb8,0xb8,0xb9,0xb9,0xb9,0xb8,0xb7,0xb7,0xb6,0xb6,0xb6,0xb7,0xb7,0xb7, + 0xb6,0xb5,0xb5,0xb5,0xb4,0xb4,0xb4,0xb3,0xb5,0xb7,0xb9,0xb9,0xb7,0xb3,0xb1, + 0xb6,0xbd,0xc4,0xbe,0xb5,0xb8,0xb8,0xb4,0xb1,0xae,0xad,0xab,0xc8,0x4b,0x4b, + 0x4b,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x50,0x50,0x50,0x50,0x50,0x52,0x51,0x51, + 0x51,0x52,0x53,0x53,0x54,0x54,0x54,0x54,0x56,0x56,0x55,0x56,0x57,0x57,0x57, + 0x57,0x57,0x58,0x59,0x5a,0x5a,0x5a,0x59,0x5b,0x5c,0x5c,0x5b,0x5b,0x5b,0x5c, + 0x5e,0x5f,0x61,0x61,0x60,0x5f,0x60,0x62,0x62,0x62,0x62,0x63,0x63,0x64,0x64, + 0x65,0x65,0x65,0x66,0x66,0x67,0x67,0x68,0x69,0x6b,0x6d,0x6d,0x6c,0x6a,0x6a, + 0x6b,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x6f,0x70,0x70,0x70,0x71,0x71,0x71, + 0x71,0x72,0x73,0x72,0x73,0x74,0x77,0x77,0x73,0x74,0x77,0x75,0x7e,0x90,0x71, + 0x46,0x2b,0x47,0x93,0x8d,0x72,0x78,0x7c,0x7d,0x7c,0x7b,0x7c,0x7e,0x7f,0x7f, + 0x7f,0x7f,0x80,0x80,0x81,0x82,0x82,0x83,0x82,0x82,0x83,0x85,0x85,0x83,0x83, + 0x84,0x86,0x87,0x87,0x87,0x87,0x88,0x88,0x89,0x89,0x89,0x8a,0x8a,0x8a,0x8a, + 0x8b,0x8b,0x8c,0x8d,0x8d,0x8d,0x8d,0x8f,0x90,0x8e,0x8d,0x8c,0x89,0x89,0x91, + 0x92,0x8b,0x8b,0x8e,0x91,0x8e,0x88,0x8e,0x91,0x82,0x86,0x98,0x91,0x89,0x95, + 0x91,0x82,0x7c,0x83,0x9e,0x96,0x7a,0x85,0x93,0x95,0x94,0x92,0x95,0x97,0x98, + 0x95,0x91,0x93,0x96,0x95,0x96,0x97,0x97,0x98,0x98,0x98,0x98,0x99,0x9a,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9e, + 0x9e,0x9f,0x9f,0x9f,0xa0,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1, + 0xa0,0xa1,0xa1,0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa4,0xa4,0xa3,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xa9,0xa8,0xa8,0xa8,0xa9,0xa9, + 0xa9,0xa9,0xaa,0xaa,0xab,0xa8,0xb8,0xc8,0x72,0x19,0x00,0x31,0x9e,0xb7,0xb4, + 0xa7,0xa7,0xae,0xae,0xad,0xad,0xac,0xad,0xad,0xad,0xae,0xae,0xae,0xae,0xae, + 0xae,0xac,0xaa,0xae,0xb2,0xb2,0xae,0xaa,0xaf,0xb0,0xa9,0xbc,0xc2,0x7b,0x38, + 0x07,0x00,0x07,0x56,0x99,0xc0,0xbb,0xaa,0xad,0xb0,0xb0,0xaf,0xaf,0xb2,0xb1, + 0xab,0xad,0xb0,0xb1,0xb1,0xb0,0xab,0xb0,0xc8,0xb5,0x74,0x32,0x04,0x00,0x03, + 0x09,0x05,0x02,0x04,0x04,0x03,0x06,0x07,0x03,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x06,0x03,0x01,0x01,0x00, + 0x10,0x82,0xbf,0xc4,0xba,0xb3,0xc8,0x92,0x2b,0x0a,0x02,0x06,0x04,0x00,0x01, + 0x05,0x07,0x00,0x00,0x4b,0x95,0xbe,0xc0,0xac,0xaf,0xb3,0xb5,0xb5,0xb5,0xb2, + 0xb2,0xb5,0xb5,0xb4,0xb2,0xb2,0xb0,0xae,0xae,0xae,0xad,0xad,0xad,0xac,0xac, + 0xab,0xab,0xab,0xab,0xac,0xac,0xad,0xad,0xae,0xb0,0xb2,0xb2,0xb1,0xb0,0xb1, + 0xb2,0xb3,0xb4,0xb5,0xb5,0xb5,0xb5,0xb5,0xb4,0xb4,0xb3,0xb3,0xb3,0xb3,0xb4, + 0xb4,0xb3,0xb2,0xb1,0xb0,0xaf,0xae,0xaf,0xae,0xab,0xac,0xaf,0xb4,0xb5,0xb1, + 0xae,0xad,0xad,0xab,0xa9,0xac,0xb0,0xb1,0xaf,0xab,0xaa,0xaa,0xa7,0xa2,0xc8, + 0x48,0x49,0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4e,0x4e,0x4f,0x4e,0x50,0x51, + 0x50,0x50,0x50,0x50,0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x53,0x53,0x54,0x57, + 0x57,0x57,0x54,0x54,0x55,0x58,0x5a,0x5a,0x59,0x57,0x5a,0x5b,0x5a,0x5a,0x5a, + 0x5a,0x5a,0x5c,0x5e,0x5f,0x5f,0x5e,0x5e,0x5f,0x60,0x61,0x61,0x61,0x61,0x61, + 0x62,0x62,0x62,0x63,0x64,0x65,0x65,0x66,0x67,0x68,0x69,0x69,0x6a,0x69,0x69, + 0x68,0x68,0x69,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,0x6e,0x6e,0x6f,0x70,0x70,0x70, + 0x70,0x70,0x70,0x70,0x70,0x74,0x71,0x6f,0x73,0x76,0x76,0x74,0x71,0x6e,0x7a, + 0x95,0x75,0x45,0x2b,0x45,0x91,0x8b,0x70,0x75,0x7a,0x7c,0x7c,0x7b,0x7b,0x7c, + 0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x81,0x82,0x81,0x81,0x81,0x83,0x83, + 0x82,0x81,0x82,0x83,0x85,0x86,0x86,0x86,0x86,0x87,0x89,0x87,0x86,0x88,0x8a, + 0x8a,0x8a,0x89,0x8a,0x8a,0x8a,0x8b,0x8c,0x8c,0x8c,0x8d,0x8f,0x8d,0x86,0x80, + 0x7f,0x8c,0x90,0x8a,0x85,0x84,0x8e,0x90,0x87,0x8b,0x8f,0x89,0x8a,0x91,0x8c, + 0x86,0x8a,0x85,0x7c,0x82,0x8c,0x95,0x97,0x91,0x89,0x80,0x78,0x7b,0x88,0x92, + 0x98,0x95,0x92,0x91,0x95,0x98,0x97,0x97,0x96,0x97,0x97,0x97,0x97,0x97,0x97, + 0x98,0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9d,0x9e,0x9d,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9d,0x9e,0x9e,0xa0, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4,0xa4, + 0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa8,0xa8,0xa7,0xa9,0xa8,0xa7, + 0xa9,0xaa,0xa8,0xa8,0xaa,0xaa,0xaa,0xa7,0xb4,0xc5,0x84,0x36,0x03,0x24,0x81, + 0xae,0xbd,0xaa,0xa6,0xab,0xac,0xab,0xaa,0xaa,0xaa,0xab,0xac,0xad,0xae,0xae, + 0xae,0xad,0xad,0xac,0xac,0xae,0xae,0xae,0xae,0xad,0xb0,0xb0,0xac,0xb9,0xbb, + 0x8a,0x4b,0x0a,0x00,0x05,0x4e,0x91,0xbe,0xba,0xa9,0xad,0xb0,0xb0,0xb1,0xb0, + 0xae,0xad,0xae,0xae,0xaf,0xb0,0xb0,0xaf,0xae,0xae,0xb1,0xb8,0xb7,0x7b,0x37, + 0x04,0x00,0x09,0x05,0x00,0x01,0x02,0x04,0x03,0x03,0x02,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x01, + 0x03,0x00,0x12,0x82,0xbd,0xc4,0xbb,0xb4,0xc5,0x82,0x0c,0x00,0x03,0x07,0x05, + 0x00,0x02,0x06,0x07,0x00,0x00,0x53,0x9f,0xbf,0xbd,0xac,0xae,0xb2,0xb2,0xb2, + 0xb2,0xb1,0xb2,0xb5,0xb5,0xb4,0xb2,0xb1,0xb1,0xb0,0xb0,0xb0,0xb0,0xb1,0xb1, + 0xb2,0xb1,0xb0,0xb0,0xaf,0xaf,0xb0,0xb1,0xb0,0xaf,0xae,0xae,0xaf,0xaf,0xae, + 0xae,0xae,0xae,0xad,0xad,0xad,0xad,0xad,0xac,0xac,0xac,0xad,0xad,0xac,0xac, + 0xad,0xad,0xad,0xad,0xab,0xaa,0xaa,0xa9,0xa8,0xa8,0xa7,0xa3,0xa4,0xa8,0xa9, + 0xa6,0x9f,0xab,0xb6,0x9b,0x77,0x53,0x78,0xab,0xa0,0x99,0xa2,0xa4,0xa4,0xa0, + 0x9d,0xc8,0x48,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4c,0x4c,0x4d,0x4d, + 0x4e,0x4f,0x4f,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x51, + 0x53,0x55,0x56,0x55,0x53,0x53,0x53,0x57,0x59,0x5a,0x59,0x57,0x58,0x5a,0x5a, + 0x5b,0x5a,0x59,0x59,0x5b,0x5c,0x5e,0x65,0x66,0x5e,0x5e,0x60,0x5f,0x5e,0x5e, + 0x5f,0x60,0x5f,0x60,0x62,0x62,0x62,0x63,0x65,0x66,0x66,0x66,0x67,0x68,0x68, + 0x68,0x68,0x67,0x68,0x69,0x6b,0x6c,0x6b,0x6b,0x6b,0x6c,0x6d,0x6d,0x6d,0x6d, + 0x6e,0x6f,0x70,0x70,0x70,0x70,0x70,0x72,0x70,0x6e,0x71,0x74,0x76,0x74,0x70, + 0x6c,0x78,0x94,0x75,0x45,0x2b,0x45,0x8e,0x8a,0x70,0x76,0x7a,0x7b,0x7b,0x7b, + 0x7b,0x7b,0x7b,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7e,0x7f,0x7f,0x81,0x7f,0x7e, + 0x81,0x81,0x80,0x80,0x80,0x82,0x83,0x85,0x84,0x84,0x86,0x86,0x86,0x86,0x87, + 0x88,0x88,0x87,0x8a,0x89,0x86,0x86,0x88,0x89,0x89,0x8a,0x8a,0x89,0x8e,0x8e, + 0x88,0x80,0x7d,0x8c,0x90,0x86,0x7e,0x7c,0x8f,0x91,0x82,0x88,0x8d,0x82,0x80, + 0x87,0x8d,0x8d,0x7e,0x77,0x79,0x84,0x8e,0x91,0x94,0x96,0x8f,0x81,0x6b,0x6f, + 0x83,0x8d,0x93,0x91,0x92,0x95,0x95,0x95,0x94,0x97,0x9a,0x98,0x97,0x96,0x95, + 0x95,0x99,0x9b,0x98,0x98,0x9a,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d,0x9d,0x9d,0x9e, + 0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa3, + 0xa4,0xa4,0xa4,0xa5,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,0xa7,0xa7, + 0xa7,0xa7,0xa9,0xaa,0xa7,0xa7,0xa8,0xaa,0xaa,0xa3,0xb1,0xc4,0x8d,0x45,0x07, + 0x19,0x68,0xa3,0xc2,0xad,0xa6,0xa9,0xaa,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xac, + 0xad,0xae,0xad,0xad,0xad,0xad,0xac,0xac,0xad,0xae,0xae,0xae,0xae,0xae,0xad, + 0xb8,0xb9,0x91,0x55,0x0b,0x00,0x05,0x40,0x82,0xbf,0xbc,0xa7,0xac,0xae,0xae, + 0xb0,0xb2,0xad,0xac,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaa,0xb3,0xc0, + 0xaa,0x7d,0x3c,0x13,0x00,0x00,0x02,0x05,0x05,0x03,0x02,0x02,0x03,0x02,0x00, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00, + 0x00,0x00,0x02,0x00,0x10,0x78,0xb5,0xc4,0xc0,0xb8,0xbc,0x74,0x03,0x00,0x01, + 0x06,0x06,0x03,0x03,0x03,0x04,0x00,0x03,0x62,0xaf,0xbe,0xba,0xae,0xb0,0xb2, + 0xb1,0xb1,0xb2,0xb2,0xb2,0xb4,0xb4,0xb3,0xb2,0xb2,0xb2,0xb2,0xb2,0xb1,0xb1, + 0xb1,0xb2,0xb2,0xb1,0xb0,0xb2,0xb3,0xb3,0xb2,0xb1,0xb2,0xb2,0xb1,0xae,0xae, + 0xae,0xae,0xad,0xad,0xad,0xab,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xaa,0xa9, + 0xa9,0xaa,0xaa,0xab,0xab,0xab,0xaa,0xa9,0xa6,0xa7,0xaa,0xa9,0xa7,0xa5,0xa7, + 0xaa,0xa7,0xa2,0x98,0x95,0x90,0x7f,0x62,0x41,0x63,0x95,0x90,0x90,0x9b,0x9c, + 0x99,0x95,0x94,0xc8,0x48,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x4e,0x4f,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x53,0x53,0x53,0x53,0x53,0x53,0x56,0x57,0x57,0x57,0x57,0x57, + 0x57,0x5a,0x5c,0x5c,0x57,0x57,0x5a,0x5b,0x5d,0x68,0x69,0x5e,0x5e,0x60,0x5e, + 0x5d,0x5c,0x5e,0x61,0x5f,0x5f,0x62,0x62,0x62,0x62,0x63,0x65,0x65,0x65,0x65, + 0x65,0x66,0x67,0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x69,0x6a,0x6a,0x6b, + 0x6b,0x6c,0x6d,0x6d,0x6e,0x6e,0x6f,0x70,0x71,0x70,0x70,0x70,0x72,0x74,0x74, + 0x73,0x72,0x6d,0x77,0x90,0x72,0x45,0x2b,0x45,0x8d,0x89,0x71,0x78,0x7b,0x78, + 0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7d,0x7d,0x7c,0x7c,0x7c,0x7c,0x7e,0x81, + 0x7e,0x7b,0x7e,0x7f,0x7f,0x7f,0x80,0x81,0x82,0x85,0x83,0x83,0x86,0x85,0x83, + 0x86,0x88,0x88,0x86,0x84,0x89,0x8a,0x84,0x85,0x87,0x86,0x86,0x8a,0x87,0x86, + 0x8d,0x8f,0x8b,0x82,0x7d,0x8e,0x91,0x81,0x78,0x78,0x91,0x92,0x7b,0x84,0x8c, + 0x78,0x72,0x7e,0x92,0x98,0x74,0x69,0x78,0x85,0x8e,0x8d,0x8e,0x91,0x93,0x8a, + 0x6d,0x6d,0x81,0x87,0x8a,0x8c,0x93,0x9b,0x96,0x91,0x90,0x95,0x9d,0x99,0x95, + 0x95,0x95,0x95,0x9c,0x9e,0x96,0x96,0x99,0x98,0x98,0x98,0x98,0x98,0x99,0x9a, + 0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9b,0x9c,0x9c,0x9c,0x9d,0x9d,0x9d,0x9d, + 0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0x9f,0x9f,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1,0xa0, + 0xa0,0xa2,0xa3,0xa1,0xa1,0xa1,0xa2,0xa3,0xa3,0xa2,0xa1,0xa1,0xa2,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa6,0xa7,0xa7, + 0xa7,0xa6,0xa6,0xa7,0xa8,0xa8,0xa6,0xa5,0xa6,0xa8,0xa9,0xa0,0xae,0xc5,0x8f, + 0x46,0x09,0x12,0x55,0x9b,0xc4,0xae,0xa5,0xa8,0xaa,0xac,0xac,0xab,0xaa,0xa8, + 0xa8,0xaa,0xac,0xae,0xad,0xad,0xae,0xad,0xac,0xaa,0xab,0xaf,0xb0,0xaf,0xac, + 0xab,0xad,0xb9,0xbb,0x95,0x58,0x0c,0x00,0x05,0x2d,0x6f,0xbf,0xbf,0xa6,0xab, + 0xae,0xab,0xae,0xb2,0xaf,0xae,0xae,0xae,0xae,0xad,0xad,0xae,0xae,0xae,0xae, + 0xaa,0xa9,0xbe,0xbd,0x8d,0x48,0x02,0x00,0x03,0x0b,0x09,0x02,0x03,0x03,0x04, + 0x03,0x00,0x01,0x02,0x03,0x03,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00, + 0x01,0x02,0x01,0x01,0x00,0x00,0x0d,0x6d,0xaa,0xc3,0xc7,0xba,0xa3,0x5f,0x05, + 0x00,0x00,0x03,0x05,0x07,0x03,0x00,0x00,0x00,0x0d,0x76,0xc1,0xbd,0xb6,0xb1, + 0xb3,0xb4,0xb1,0xb2,0xb4,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb3,0xb4,0xb3,0xb2, + 0xb1,0xb0,0xaf,0xb0,0xb1,0xaf,0xaf,0xb2,0xb5,0xb5,0xb2,0xb1,0xb3,0xb4,0xb3, + 0xae,0xae,0xb0,0xaf,0xae,0xae,0xae,0xad,0xab,0xaa,0xab,0xab,0xaa,0xaa,0xaa, + 0xaa,0xaa,0xa9,0xaa,0xac,0xae,0xad,0xac,0xad,0xab,0xa6,0xa9,0xb0,0xae,0xaa, + 0xaa,0xad,0xae,0xa6,0x9d,0x96,0x74,0x53,0x63,0x68,0x5a,0x68,0x7f,0x88,0x90, + 0x96,0x94,0x8e,0x8d,0x8b,0xc8,0x46,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48, + 0x49,0x49,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4e,0x4e,0x4f,0x50,0x50, + 0x4f,0x4f,0x4f,0x4f,0x50,0x52,0x53,0x53,0x53,0x52,0x53,0x54,0x56,0x56,0x56, + 0x56,0x57,0x57,0x57,0x58,0x58,0x55,0x55,0x57,0x60,0x62,0x45,0x3e,0x56,0x5d, + 0x5e,0x5c,0x5d,0x60,0x60,0x60,0x62,0x61,0x5e,0x60,0x62,0x62,0x62,0x64,0x64, + 0x64,0x64,0x64,0x65,0x65,0x66,0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x68,0x69, + 0x69,0x69,0x6a,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6f,0x70,0x6d,0x70,0x72,0x74, + 0x73,0x70,0x70,0x70,0x69,0x74,0x8e,0x70,0x42,0x28,0x44,0x90,0x8b,0x71,0x78, + 0x7b,0x77,0x75,0x75,0x78,0x79,0x7b,0x7a,0x7a,0x7c,0x7c,0x7b,0x7b,0x7c,0x7d, + 0x7e,0x7e,0x7e,0x7e,0x7e,0x7c,0x7b,0x80,0x84,0x82,0x7f,0x7e,0x82,0x84,0x7d, + 0x81,0x8a,0x87,0x85,0x86,0x86,0x86,0x83,0x85,0x8b,0x8b,0x89,0x88,0x88,0x8a, + 0x8a,0x88,0x8d,0x8b,0x82,0x7b,0x7a,0x90,0x90,0x79,0x78,0x82,0x93,0x90,0x7a, + 0x7f,0x86,0x79,0x76,0x7f,0x91,0x96,0x70,0x66,0x76,0x8d,0x99,0x89,0x85,0x8a, + 0x8a,0x87,0x80,0x7e,0x80,0x82,0x85,0x89,0x8e,0x94,0x94,0x94,0x95,0x95,0x93, + 0x91,0x91,0x98,0x9b,0x9a,0x99,0x95,0x8f,0x92,0x98,0x98,0x98,0x98,0x98,0x98, + 0x98,0x99,0x99,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9b,0x9b,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9d,0x9d,0x9e,0x9f,0xa0,0xa0,0x9f,0x9f,0x9f,0x9e,0x9f,0xa0,0xa0, + 0xa0,0xa0,0x9f,0xa0,0xa2,0xa1,0xa0,0xa0,0xa1,0xa2,0xa2,0xa2,0xa1,0xa2,0xa2, + 0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa3,0xa4,0xa4,0xa5,0xa5,0xa5,0xa6,0xa5, + 0xa4,0xa3,0xa3,0xa7,0xa9,0xa7,0xa3,0xa2,0xa4,0xa7,0xa7,0xa8,0xa7,0x9e,0xad, + 0xc4,0x8a,0x40,0x07,0x0e,0x4c,0x9a,0xc8,0xaa,0xa1,0xa7,0xaa,0xaa,0xab,0xaa, + 0xaa,0xa9,0xaa,0xab,0xac,0xad,0xac,0xac,0xac,0xab,0xaa,0xab,0xac,0xad,0xad, + 0xad,0xb0,0xb0,0xac,0xb7,0xbd,0x9c,0x5f,0x0e,0x00,0x03,0x1f,0x5e,0xb9,0xbf, + 0xaa,0xad,0xb0,0xb1,0xb0,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf,0xb0,0xb0, + 0xb0,0xaf,0xad,0xaa,0xb1,0xb6,0xb9,0x8b,0x40,0x0e,0x00,0x00,0x04,0x05,0x08, + 0x08,0x02,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x00,0x00,0x01,0x04,0x06,0x05,0x02,0x00,0x0e,0x6b,0xa7,0xc0,0xc8,0xb5,0x65, + 0x28,0x02,0x00,0x04,0x02,0x03,0x06,0x03,0x00,0x00,0x03,0x1a,0x83,0xc8,0xb8, + 0xb2,0xb2,0xb3,0xb4,0xb3,0xb3,0xb3,0xb2,0xb2,0xb3,0xb3,0xb2,0xb2,0xb3,0xb3, + 0xb3,0xb3,0xb3,0xb3,0xb3,0xb3,0xb3,0xb2,0xb1,0xb1,0xb2,0xb3,0xb5,0xb5,0xb5, + 0xb2,0xae,0xb0,0xb1,0xb2,0xb2,0xb2,0xb2,0xb2,0xb0,0xaf,0xae,0xb0,0xb1,0xb1, + 0xb0,0xb0,0xae,0xae,0xad,0xaf,0xb1,0xae,0xac,0xab,0xae,0xaf,0xaa,0xae,0xb1, + 0xa8,0x9e,0x98,0xa2,0xaa,0x8a,0x7c,0x8f,0x62,0x32,0x69,0x86,0x73,0x81,0x96, + 0x97,0x95,0x95,0x92,0x90,0x91,0x94,0xc8,0x44,0x44,0x45,0x46,0x47,0x48,0x47, + 0x46,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4b,0x4c,0x4b,0x4b,0x4c,0x4c,0x4d,0x4e, + 0x4e,0x4e,0x4d,0x4d,0x4e,0x4e,0x50,0x51,0x52,0x53,0x52,0x51,0x51,0x53,0x54, + 0x54,0x54,0x54,0x56,0x57,0x55,0x54,0x55,0x55,0x54,0x55,0x65,0x67,0x27,0x1b, + 0x51,0x5f,0x5e,0x5c,0x5d,0x61,0x60,0x5e,0x62,0x60,0x5d,0x5f,0x62,0x61,0x62, + 0x62,0x63,0x62,0x62,0x63,0x63,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x66, + 0x66,0x67,0x68,0x68,0x69,0x69,0x69,0x6a,0x6b,0x6c,0x6d,0x6d,0x6d,0x6c,0x6f, + 0x73,0x72,0x70,0x6e,0x70,0x70,0x68,0x71,0x8d,0x6d,0x3d,0x26,0x44,0x91,0x8a, + 0x6f,0x78,0x7a,0x75,0x74,0x74,0x77,0x78,0x7a,0x78,0x78,0x7a,0x7b,0x7a,0x7b, + 0x7b,0x7f,0x7e,0x7b,0x7d,0x7f,0x7e,0x7b,0x79,0x7f,0x82,0x80,0x7e,0x7c,0x80, + 0x82,0x7a,0x7f,0x8a,0x8a,0x88,0x85,0x84,0x84,0x80,0x82,0x8b,0x8b,0x86,0x87, + 0x89,0x8a,0x89,0x8a,0x8c,0x86,0x78,0x73,0x78,0x8d,0x8c,0x72,0x79,0x88,0x90, + 0x89,0x76,0x7f,0x88,0x7a,0x77,0x81,0x8c,0x8b,0x70,0x68,0x74,0x8d,0x9b,0x86, + 0x80,0x88,0x86,0x83,0x86,0x7f,0x75,0x7f,0x89,0x88,0x8a,0x8c,0x92,0x98,0x98, + 0x91,0x88,0x8a,0x90,0x99,0x9c,0x9a,0x95,0x91,0x8d,0x91,0x98,0x97,0x96,0x97, + 0x97,0x98,0x98,0x98,0x99,0x99,0x99,0x98,0x98,0x99,0x99,0x9a,0x9b,0x9b,0x9b, + 0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9e,0x9e,0x9f,0x9e,0x9e,0x9e,0x9e, + 0x9e,0x9f,0x9f,0x9e,0x9e,0xa0,0xa1,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1, + 0xa1,0xa2,0xa2,0xa2,0xa2,0xa1,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa5,0xa5,0xa5, + 0xa5,0xa4,0xa3,0xa1,0xa1,0xa7,0xa9,0xa6,0xa2,0xa0,0xa4,0xa7,0xa8,0xa7,0xa4, + 0x9d,0xad,0xc4,0x87,0x3c,0x07,0x0b,0x41,0x95,0xc8,0xa9,0xa0,0xa9,0xa9,0xa9, + 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xab,0xac, + 0xab,0xaa,0xaa,0xb1,0xb1,0xa9,0xb5,0xbd,0x9e,0x62,0x10,0x00,0x00,0x0f,0x4d, + 0xb4,0xc0,0xac,0xac,0xaf,0xb3,0xaf,0xaa,0xac,0xad,0xad,0xad,0xae,0xaf,0xb0, + 0xb1,0xb1,0xb0,0xaf,0xae,0xac,0xa7,0xaa,0xc4,0xb5,0x84,0x45,0x13,0x03,0x00, + 0x03,0x08,0x09,0x02,0x01,0x04,0x03,0x02,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x00,0x00,0x02,0x04,0x06,0x07,0x05,0x00,0x0f,0x70,0xad,0xc0,0xc7, + 0xa2,0x33,0x00,0x01,0x04,0x07,0x01,0x01,0x03,0x04,0x03,0x00,0x0a,0x29,0x8d, + 0xc8,0xb3,0xae,0xb3,0xb2,0xb2,0xb4,0xb3,0xb1,0xb2,0xb3,0xb4,0xb4,0xb3,0xb2, + 0xb2,0xb2,0xb2,0xb3,0xb4,0xb5,0xb5,0xb5,0xb5,0xb3,0xb2,0xb2,0xb0,0xb0,0xb5, + 0xb6,0xb3,0xaf,0xad,0xb1,0xb2,0xb2,0xb3,0xb5,0xb3,0xb2,0xb2,0xb0,0xb0,0xb2, + 0xb3,0xb3,0xb3,0xb3,0xb1,0xb1,0xb1,0xb2,0xb2,0xaf,0xad,0xab,0xae,0xb0,0xae, + 0xaf,0xb0,0xa7,0x9c,0x91,0x9e,0xa9,0x7b,0x66,0x80,0x63,0x41,0x66,0x84,0x8c, + 0x9e,0xae,0xa7,0xa1,0x9c,0x9a,0x9b,0x9d,0xa1,0xc8,0x42,0x43,0x44,0x45,0x45, + 0x46,0x45,0x45,0x45,0x45,0x46,0x48,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4b,0x4c, + 0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4e,0x4f,0x50,0x51,0x51,0x50,0x50,0x50, + 0x51,0x52,0x53,0x53,0x53,0x53,0x53,0x55,0x53,0x52,0x56,0x57,0x53,0x65,0x69, + 0x1c,0x11,0x56,0x65,0x61,0x5e,0x5c,0x5c,0x5c,0x5d,0x5d,0x5e,0x5e,0x5f,0x60, + 0x5e,0x5f,0x62,0x62,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x63,0x63,0x62,0x63, + 0x65,0x65,0x65,0x65,0x66,0x66,0x67,0x68,0x69,0x69,0x6a,0x6b,0x6b,0x6a,0x69, + 0x69,0x6d,0x6f,0x6b,0x6b,0x70,0x72,0x70,0x69,0x72,0x8c,0x69,0x38,0x25,0x43, + 0x8c,0x84,0x6a,0x74,0x78,0x74,0x76,0x7a,0x79,0x78,0x77,0x77,0x76,0x74,0x77, + 0x7c,0x7b,0x7a,0x7d,0x7d,0x7b,0x7c,0x7d,0x7d,0x7d,0x7c,0x79,0x78,0x7a,0x7f, + 0x85,0x7c,0x79,0x83,0x83,0x81,0x91,0x97,0x86,0x7f,0x7f,0x82,0x84,0x80,0x7e, + 0x7e,0x82,0x85,0x84,0x85,0x86,0x8a,0x82,0x6f,0x6d,0x76,0x86,0x82,0x6d,0x78, + 0x87,0x86,0x7c,0x6d,0x85,0x95,0x74,0x6f,0x82,0x80,0x78,0x73,0x70,0x70,0x7f, + 0x8a,0x86,0x86,0x8a,0x8a,0x84,0x74,0x65,0x5d,0x81,0x99,0x8b,0x85,0x86,0x93, + 0x9a,0x97,0x8b,0x80,0x8a,0x92,0x93,0x92,0x91,0x94,0x95,0x95,0x95,0x96,0x96, + 0x95,0x95,0x96,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x9a, + 0x9a,0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9c, + 0x9c,0x9c,0x9d,0x9d,0x9e,0x9e,0x9d,0x9f,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0x9f, + 0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0xa1,0xa2,0xa2,0xa3,0xa4,0xa4, + 0xa3,0xa3,0xa3,0xa3,0xa5,0xa6,0xa5,0xa4,0xa3,0xa3,0xa4,0xa5,0xa5,0xa6,0xa6, + 0xa6,0xa3,0x9e,0xae,0xc5,0x8a,0x3f,0x0c,0x07,0x2e,0x89,0xc6,0xa9,0xa3,0xae, + 0xab,0xa7,0xa8,0xa9,0xa8,0xa8,0xa8,0xa8,0xa9,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xab,0xac,0xac,0xaa,0xa7,0xab,0xaa,0xa1,0xb1,0xbc,0x99,0x5d,0x0e,0x00,0x00, + 0x00,0x3a,0xb2,0xc0,0xaa,0xa7,0xa9,0xae,0xab,0xa7,0xa9,0xaa,0xaa,0xaa,0xaa, + 0xac,0xae,0xae,0xae,0xae,0xad,0xab,0xaa,0xae,0xb1,0xae,0xb3,0xba,0xa7,0x76, + 0x20,0x00,0x00,0x00,0x03,0x05,0x06,0x06,0x04,0x02,0x00,0x00,0x00,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x00,0x03,0x0a,0x00,0x0e,0x7e,0xbd, + 0xc4,0xb0,0x7b,0x1e,0x00,0x03,0x03,0x02,0x00,0x00,0x03,0x06,0x05,0x00,0x0e, + 0x38,0x95,0xc8,0xaf,0xac,0xb5,0xb2,0xaf,0xb1,0xaf,0xad,0xb0,0xb3,0xb3,0xb3, + 0xb2,0xb2,0xb2,0xb0,0xb0,0xb1,0xb2,0xb2,0xb3,0xb3,0xb3,0xb2,0xb3,0xb5,0xb1, + 0xad,0xb0,0xb1,0xae,0xb0,0xb2,0xb1,0xaf,0xae,0xb0,0xb1,0xae,0xae,0xae,0xad, + 0xad,0xaf,0xb0,0xae,0xb0,0xb0,0xae,0xb0,0xb2,0xae,0xad,0xb0,0xb0,0xad,0xad, + 0xad,0xad,0xad,0xae,0xb1,0xaf,0xa7,0xab,0xad,0x86,0x6a,0x68,0x7e,0x8b,0x4b, + 0x4a,0xa0,0xb9,0xb5,0xb5,0xb2,0xaf,0xae,0xaf,0xaf,0xaf,0xc8,0x41,0x41,0x43, + 0x44,0x45,0x45,0x45,0x44,0x43,0x44,0x45,0x46,0x48,0x48,0x48,0x48,0x48,0x49, + 0x49,0x4a,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4b,0x4d,0x4e,0x4f,0x50,0x50,0x4f, + 0x4f,0x4f,0x50,0x50,0x51,0x51,0x51,0x50,0x52,0x55,0x53,0x50,0x55,0x57,0x54, + 0x62,0x62,0x1a,0x12,0x57,0x65,0x61,0x5e,0x5a,0x57,0x59,0x5a,0x5a,0x5b,0x5e, + 0x5e,0x5e,0x5c,0x5e,0x61,0x61,0x60,0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x62, + 0x62,0x62,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x69,0x69,0x6a,0x6a, + 0x68,0x68,0x6d,0x6d,0x6b,0x69,0x6b,0x70,0x71,0x70,0x67,0x70,0x8d,0x68,0x33, + 0x22,0x41,0x8a,0x82,0x67,0x71,0x76,0x74,0x75,0x78,0x79,0x78,0x77,0x76,0x75, + 0x76,0x78,0x7a,0x79,0x78,0x78,0x7a,0x7d,0x7c,0x7b,0x7d,0x7d,0x7c,0x78,0x78, + 0x7b,0x7f,0x81,0x79,0x7a,0x8b,0x82,0x6c,0x64,0x6d,0x8a,0x87,0x78,0x7b,0x84, + 0x8d,0x91,0x8f,0x87,0x82,0x82,0x83,0x84,0x82,0x82,0x80,0x74,0x6c,0x7b,0x7f, + 0x73,0x78,0x7f,0x75,0x6e,0x6e,0x82,0x8f,0x7a,0x70,0x76,0x76,0x77,0x7c,0x79, + 0x70,0x75,0x79,0x74,0x7f,0x91,0x8c,0x7b,0x60,0x5e,0x70,0x8b,0x99,0x8a,0x86, + 0x8a,0x92,0x97,0x94,0x88,0x7e,0x8d,0x96,0x8d,0x87,0x86,0x91,0x98,0x95,0x95, + 0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x97,0x97,0x97,0x97,0x97,0x98,0x98, + 0x98,0x99,0x99,0x99,0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9b,0x99,0x99,0x9a,0x9b, + 0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9e,0x9d,0x9d,0x9d,0x9e,0x9e,0x9e,0x9d, + 0x9d,0x9d,0x9e,0x9f,0xa0,0xa0,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa2, + 0xa3,0xa3,0xa2,0xa2,0xa1,0xa1,0xa3,0xa3,0xa3,0xa2,0xa2,0xa3,0xa4,0xa4,0xa3, + 0xa4,0xa6,0xa6,0xa3,0x9c,0xab,0xc5,0x95,0x51,0x13,0x01,0x1d,0x7c,0xc1,0xad, + 0xa5,0xaa,0xa8,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xaa,0xaa,0xaa, + 0xa9,0xa9,0xaa,0xaa,0xac,0xaa,0xa6,0xa9,0xa7,0x9e,0xaf,0xbd,0x9d,0x60,0x0e, + 0x00,0x01,0x00,0x30,0xb2,0xc1,0xaa,0xa5,0xa6,0xab,0xaa,0xa7,0xa8,0xa8,0xa7, + 0xa7,0xa8,0xaa,0xab,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xae,0xae,0xa5,0xaa,0xb9, + 0xbe,0xaa,0x70,0x46,0x28,0x0a,0x00,0x02,0x06,0x07,0x04,0x02,0x00,0x00,0x00, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x05,0x00,0x03,0x0a,0x00,0x0f, + 0x81,0xc2,0xc8,0x93,0x4b,0x0e,0x00,0x06,0x04,0x02,0x01,0x02,0x04,0x06,0x04, + 0x00,0x1d,0x5b,0xa4,0xc8,0xaf,0xab,0xb2,0xb1,0xaf,0xaf,0xae,0xad,0xb0,0xb2, + 0xb2,0xb2,0xb2,0xb2,0xb2,0xb1,0xb0,0xaf,0xaf,0xb0,0xb1,0xb2,0xb2,0xb2,0xb2, + 0xb3,0xb1,0xae,0xad,0xae,0xae,0xb0,0xb0,0xae,0xae,0xb1,0xb1,0xaf,0xad,0xad, + 0xae,0xae,0xad,0xae,0xae,0xac,0xae,0xaf,0xae,0xae,0xb0,0xae,0xad,0xaf,0xaf, + 0xae,0xad,0xac,0xad,0xae,0xb0,0xb2,0xb2,0xae,0xaf,0xaf,0xa2,0x8e,0x7a,0x8a, + 0x99,0x55,0x52,0xa9,0xbf,0xb8,0xb5,0xb0,0xad,0xb0,0xb4,0xb3,0xb2,0xc8,0x41, + 0x41,0x42,0x42,0x43,0x43,0x43,0x43,0x43,0x43,0x44,0x45,0x46,0x47,0x47,0x48, + 0x48,0x48,0x48,0x48,0x49,0x49,0x4a,0x4a,0x4a,0x4a,0x4a,0x4c,0x4d,0x4e,0x4f, + 0x4f,0x4e,0x4e,0x4e,0x4f,0x4f,0x50,0x50,0x50,0x50,0x52,0x55,0x53,0x50,0x53, + 0x56,0x57,0x5e,0x57,0x1d,0x1a,0x55,0x62,0x5e,0x5b,0x57,0x53,0x56,0x59,0x57, + 0x59,0x5e,0x5e,0x5c,0x5a,0x5c,0x5f,0x5f,0x5f,0x5f,0x5f,0x60,0x61,0x61,0x61, + 0x61,0x62,0x62,0x62,0x63,0x63,0x64,0x65,0x65,0x65,0x65,0x65,0x66,0x67,0x69, + 0x69,0x69,0x66,0x68,0x70,0x6d,0x67,0x69,0x6d,0x6d,0x6f,0x6e,0x64,0x6f,0x8f, + 0x66,0x2e,0x1d,0x3f,0x8b,0x83,0x67,0x6e,0x73,0x74,0x73,0x72,0x76,0x78,0x78, + 0x75,0x75,0x7a,0x7a,0x75,0x75,0x76,0x74,0x77,0x7e,0x7b,0x79,0x7b,0x7c,0x7b, + 0x7b,0x7b,0x7f,0x7c,0x78,0x78,0x7e,0x8f,0x7e,0x57,0x2a,0x34,0x8f,0x95,0x74, + 0x76,0x85,0x9c,0xa1,0x9b,0x8c,0x82,0x82,0x83,0x84,0x7b,0x82,0x97,0x7e,0x60, + 0x70,0x7c,0x7e,0x79,0x70,0x63,0x65,0x77,0x7d,0x7f,0x82,0x78,0x64,0x6f,0x7f, + 0x83,0x7e,0x72,0x71,0x6f,0x61,0x72,0x95,0x86,0x6c,0x53,0x66,0x93,0x98,0x91, + 0x87,0x89,0x90,0x8f,0x8e,0x91,0x87,0x7e,0x92,0x99,0x88,0x7f,0x7e,0x8f,0x98, + 0x91,0x91,0x94,0x94,0x94,0x94,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0x96,0x96, + 0x96,0x96,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x9a,0x98,0x98, + 0x99,0x9a,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9d,0x9c,0x9c,0x9d,0x9d, + 0x9d,0x9c,0x9c,0x9c,0x9c,0x9e,0x9f,0x9f,0x9d,0x9e,0xa0,0xa0,0xa0,0xa0,0xa0, + 0xa0,0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0x9f,0x9f,0xa0,0xa0,0xa2,0xa3,0xa3, + 0xa1,0xa0,0xa3,0xa6,0xa6,0xa2,0x98,0xa7,0xc3,0xa3,0x69,0x1a,0x00,0x0f,0x70, + 0xbc,0xb2,0xa8,0xa2,0xa3,0xa6,0xa5,0xa5,0xa6,0xa6,0xa6,0xa6,0xa7,0xa8,0xa9, + 0xa9,0xa7,0xa7,0xa8,0xa7,0xa8,0xab,0xaa,0xa7,0xa8,0xa6,0x9f,0xb0,0xbe,0xa6, + 0x69,0x0e,0x00,0x03,0x00,0x2c,0xad,0xc1,0xad,0xa7,0xa6,0xab,0xaa,0xa8,0xa9, + 0xa8,0xa7,0xa7,0xa7,0xa8,0xa9,0xa9,0xa8,0xa8,0xa8,0xa9,0xaa,0xaa,0xa8,0xa7, + 0xa1,0x9d,0xab,0xba,0xc5,0xaa,0x72,0x2b,0x00,0x00,0x03,0x07,0x04,0x01,0x00, + 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x05,0x08,0x03,0x02,0x07, + 0x00,0x12,0x81,0xc2,0xc8,0x72,0x1b,0x04,0x00,0x07,0x05,0x03,0x04,0x05,0x06, + 0x04,0x02,0x00,0x31,0x86,0xb5,0xc4,0xb1,0xab,0xae,0xb0,0xb1,0xae,0xae,0xae, + 0xaf,0xb0,0xb1,0xb1,0xb2,0xb2,0xb2,0xb2,0xb1,0xaf,0xae,0xad,0xae,0xb0,0xb2, + 0xb0,0xaf,0xb0,0xb1,0xb0,0xab,0xac,0xb2,0xae,0xaa,0xaa,0xae,0xb4,0xb2,0xaf, + 0xad,0xae,0xb1,0xaf,0xae,0xae,0xae,0xab,0xae,0xaf,0xae,0xae,0xac,0xae,0xb0, + 0xae,0xae,0xaf,0xae,0xae,0xaf,0xb1,0xb2,0xae,0xad,0xaf,0xaf,0xb0,0xbe,0xbb, + 0x9e,0x8b,0x7e,0x70,0x7f,0xab,0xb9,0xb5,0xa7,0x9f,0x9e,0xa7,0xb1,0xae,0xaf, + 0xc8,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x42,0x43,0x44,0x45,0x46, + 0x46,0x46,0x46,0x47,0x47,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x4a,0x4b,0x4c, + 0x4c,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4e,0x51,0x52,0x50,0x50, + 0x50,0x4e,0x53,0x5e,0x5e,0x4f,0x19,0x18,0x53,0x5e,0x56,0x54,0x54,0x56,0x57, + 0x57,0x5a,0x5a,0x5a,0x5c,0x5c,0x59,0x5a,0x5d,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e, + 0x5f,0x5f,0x60,0x60,0x60,0x60,0x62,0x62,0x62,0x63,0x64,0x64,0x64,0x65,0x65, + 0x66,0x67,0x68,0x68,0x66,0x67,0x6d,0x6c,0x69,0x6a,0x6a,0x69,0x69,0x69,0x61, + 0x6d,0x8c,0x5e,0x23,0x1a,0x3f,0x88,0x83,0x6b,0x6f,0x71,0x70,0x6f,0x6f,0x71, + 0x74,0x74,0x71,0x70,0x76,0x75,0x71,0x73,0x76,0x79,0x7a,0x78,0x75,0x74,0x77, + 0x78,0x78,0x78,0x79,0x7a,0x7b,0x7b,0x79,0x7c,0x88,0x7e,0x65,0x39,0x3f,0x90, + 0x98,0x7f,0x91,0x8f,0x6c,0x50,0x48,0x70,0x88,0x82,0x82,0x82,0x7d,0x7f,0x86, + 0x78,0x65,0x66,0x72,0x85,0x72,0x5b,0x5f,0x71,0x8b,0x89,0x81,0x85,0x78,0x5e, + 0x6e,0x7f,0x73,0x6d,0x6f,0x7a,0x80,0x7a,0x7e,0x86,0x6c,0x5b,0x6b,0x7c,0x8d, + 0x95,0x93,0x80,0x82,0x8e,0x86,0x86,0x95,0x8b,0x7b,0x8d,0x95,0x84,0x7f,0x83, + 0x91,0x97,0x8d,0x8e,0x92,0x92,0x92,0x92,0x92,0x93,0x93,0x93,0x94,0x94,0x95, + 0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x97,0x97,0x98,0x98,0x98,0x98,0x98, + 0x98,0x98,0x99,0x9a,0x9b,0x9b,0x9a,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c,0x9b,0x9c, + 0x9c,0x9d,0x9c,0x9c,0x9b,0x9b,0x9c,0x9d,0x9e,0x9d,0x9c,0x9d,0xa0,0x9f,0x9f, + 0x9f,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa0,0x9f,0xa3,0xa4, + 0xa2,0xa0,0xa0,0xa3,0xa5,0xa3,0xa2,0xa1,0x9e,0xaa,0xbd,0xa8,0x75,0x1d,0x00, + 0x04,0x69,0xba,0xb4,0xae,0xaa,0xa7,0xa4,0xa4,0xa4,0xa5,0xa6,0xa7,0xa7,0xa7, + 0xa8,0xa8,0xa7,0xa4,0xa5,0xa7,0xa7,0xa7,0xa8,0xa8,0xa8,0xac,0xaa,0xa3,0xad, + 0xb9,0xb2,0x79,0x0f,0x00,0x03,0x00,0x2b,0x9e,0xbb,0xb4,0xaa,0xa9,0xaf,0xac, + 0xa8,0xaa,0xaa,0xa9,0xa8,0xa9,0xaa,0xaa,0xaa,0xaa,0xa9,0xa9,0xaa,0xaa,0xaa, + 0xaa,0xae,0xaa,0xa3,0xa7,0xae,0xb1,0xb5,0xae,0x78,0x3c,0x0a,0x00,0x05,0x03, + 0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x02,0x04,0x05,0x01, + 0x01,0x03,0x00,0x12,0x8d,0xc8,0xbe,0x58,0x00,0x03,0x05,0x04,0x02,0x01,0x03, + 0x03,0x02,0x03,0x00,0x00,0x3b,0xa8,0xbd,0xb9,0xb0,0xac,0xac,0xaf,0xb0,0xae, + 0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xaf,0xb0,0xaf,0xae,0xac,0xac,0xad, + 0xaf,0xb1,0xad,0xae,0xb3,0xb0,0xad,0xae,0xb0,0xb1,0xab,0xa7,0xa8,0xac,0xb1, + 0xb2,0xb0,0xae,0xaf,0xb1,0xb0,0xae,0xaf,0xae,0xac,0xae,0xaf,0xaf,0xae,0xae, + 0xad,0xad,0xaf,0xae,0xad,0xac,0xae,0xb3,0xb2,0xae,0xaa,0xab,0xb2,0xb0,0xaa, + 0xb5,0xb5,0xa7,0x76,0x4c,0x7a,0xa2,0xb2,0xb8,0xae,0x8a,0x7f,0x95,0xa7,0xb3, + 0xae,0xad,0xc8,0x41,0x41,0x40,0x40,0x40,0x41,0x41,0x41,0x42,0x41,0x42,0x43, + 0x44,0x45,0x45,0x45,0x45,0x45,0x46,0x46,0x47,0x48,0x48,0x48,0x49,0x49,0x49, + 0x49,0x4a,0x4b,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4c,0x4d,0x51,0x51, + 0x4c,0x4d,0x50,0x4c,0x51,0x61,0x5e,0x49,0x14,0x15,0x54,0x5b,0x50,0x50,0x52, + 0x57,0x57,0x57,0x5a,0x5b,0x59,0x5a,0x5b,0x57,0x57,0x5a,0x5a,0x5a,0x5b,0x5b, + 0x5c,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x61,0x62,0x62,0x62,0x63, + 0x63,0x64,0x64,0x65,0x65,0x66,0x65,0x65,0x67,0x69,0x6b,0x69,0x66,0x65,0x68, + 0x6a,0x63,0x6d,0x87,0x57,0x1b,0x1a,0x41,0x83,0x7f,0x69,0x6c,0x6f,0x6f,0x6d, + 0x6c,0x6d,0x6f,0x6f,0x70,0x70,0x70,0x70,0x70,0x71,0x74,0x78,0x78,0x74,0x71, + 0x70,0x74,0x76,0x78,0x78,0x78,0x75,0x78,0x7b,0x78,0x79,0x84,0x7b,0x69,0x57, + 0x5f,0x89,0x8d,0x82,0x97,0x86,0x3d,0x1b,0x1e,0x62,0x8a,0x82,0x82,0x82,0x80, + 0x7c,0x78,0x70,0x69,0x5e,0x6b,0x8b,0x70,0x50,0x62,0x78,0x8c,0x7f,0x70,0x7f, + 0x78,0x5e,0x72,0x82,0x6d,0x63,0x67,0x78,0x89,0x8e,0x82,0x69,0x57,0x5a,0x85, + 0x8d,0x7f,0x8d,0x91,0x7f,0x82,0x8e,0x80,0x7e,0x98,0x8f,0x78,0x88,0x8f,0x80, + 0x80,0x89,0x91,0x92,0x8c,0x8d,0x91,0x91,0x91,0x91,0x91,0x92,0x91,0x92,0x92, + 0x93,0x94,0x94,0x94,0x93,0x94,0x94,0x95,0x95,0x95,0x95,0x96,0x96,0x97,0x97, + 0x97,0x98,0x98,0x98,0x98,0x99,0x9a,0x9a,0x99,0x99,0x99,0x9a,0x9a,0x99,0x99, + 0x9a,0x9b,0x9c,0x9c,0x9c,0x9c,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9c,0x9f, + 0x9e,0x9e,0x9e,0x9d,0x9e,0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0xa0,0xa1,0xa0,0xa0, + 0xa3,0xa3,0xa0,0xa0,0xa1,0xa3,0xa3,0xa0,0xa0,0xa1,0xa1,0xa9,0xb5,0xaa,0x80, + 0x1e,0x00,0x00,0x60,0xb1,0xab,0xa8,0xa9,0xa7,0xa5,0xa3,0xa3,0xa3,0xa5,0xa6, + 0xa6,0xa7,0xa8,0xa8,0xa7,0xa3,0xa4,0xa7,0xa6,0xa5,0xa7,0xa8,0xaa,0xae,0xad, + 0xa5,0xaa,0xb3,0xba,0x86,0x12,0x00,0x03,0x00,0x29,0x8d,0xb3,0xb9,0xae,0xaa, + 0xb0,0xad,0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xab,0xab,0xaa,0xaa,0xaa,0xaa,0xaa, + 0xab,0xaa,0xaa,0xae,0xae,0xaa,0xa8,0xa3,0x9c,0xad,0xc4,0xb1,0x77,0x15,0x00, + 0x03,0x03,0x02,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x02, + 0x02,0x01,0x00,0x01,0x00,0x15,0x9b,0xc4,0x94,0x3a,0x00,0x03,0x07,0x03,0x00, + 0x00,0x06,0x06,0x03,0x01,0x00,0x00,0x4b,0xbb,0xbd,0xae,0xae,0xad,0xab,0xae, + 0xae,0xac,0xac,0xad,0xac,0xab,0xae,0xad,0xab,0xaa,0xab,0xad,0xae,0xad,0xab, + 0xab,0xac,0xae,0xaf,0xad,0xad,0xb2,0xae,0xab,0xaf,0xb0,0xad,0xae,0xaf,0xb0, + 0xaf,0xac,0xae,0xaf,0xae,0xae,0xae,0xae,0xae,0xae,0xae,0xad,0xad,0xae,0xae, + 0xae,0xb0,0xac,0xaa,0xae,0xae,0xac,0xab,0xad,0xb1,0xaf,0xab,0xaa,0xac,0xb2, + 0xae,0xa7,0xac,0xac,0xa3,0x70,0x44,0x78,0xa4,0xb6,0xb2,0xa0,0x7b,0x76,0x94, + 0xa7,0xb2,0xad,0xaa,0xc8,0x3f,0x3f,0x3d,0x3d,0x3d,0x3e,0x40,0x41,0x41,0x41, + 0x41,0x41,0x41,0x42,0x43,0x43,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x47,0x48, + 0x48,0x48,0x48,0x48,0x48,0x49,0x4a,0x4b,0x4b,0x4b,0x4b,0x4b,0x4c,0x4b,0x4c, + 0x4f,0x4e,0x48,0x4c,0x51,0x4d,0x52,0x60,0x5a,0x45,0x12,0x17,0x59,0x5e,0x50, + 0x50,0x51,0x55,0x56,0x57,0x58,0x59,0x58,0x59,0x59,0x56,0x56,0x58,0x59,0x59, + 0x59,0x5a,0x5a,0x5a,0x5b,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5e,0x5f,0x5f, + 0x60,0x60,0x61,0x62,0x62,0x62,0x62,0x63,0x64,0x63,0x60,0x65,0x6a,0x64,0x60, + 0x63,0x6d,0x74,0x6d,0x71,0x84,0x53,0x19,0x1e,0x45,0x80,0x77,0x5c,0x62,0x6a, + 0x70,0x6d,0x69,0x6b,0x6d,0x6d,0x71,0x74,0x6e,0x6d,0x70,0x71,0x70,0x6d,0x6f, + 0x74,0x72,0x70,0x75,0x78,0x7a,0x7b,0x7a,0x74,0x71,0x73,0x72,0x77,0x86,0x74, + 0x59,0x77,0x88,0x77,0x71,0x72,0x76,0x5e,0x21,0x26,0x4d,0x74,0x86,0x7f,0x81, + 0x84,0x81,0x7c,0x75,0x6d,0x65,0x5a,0x6a,0x91,0x77,0x56,0x67,0x72,0x6e,0x51, + 0x42,0x6d,0x78,0x65,0x7b,0x8d,0x7e,0x69,0x58,0x66,0x7b,0x8c,0x73,0x43,0x50, + 0x70,0x97,0x91,0x73,0x7e,0x8a,0x86,0x8d,0x93,0x7d,0x79,0x99,0x90,0x76,0x84, + 0x8a,0x7a,0x7f,0x8b,0x8b,0x8b,0x8e,0x8f,0x90,0x90,0x91,0x90,0x91,0x91,0x91, + 0x91,0x91,0x92,0x93,0x93,0x93,0x92,0x92,0x93,0x93,0x94,0x94,0x95,0x95,0x95, + 0x96,0x96,0x96,0x96,0x96,0x97,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x99,0x99, + 0x99,0x98,0x99,0x9b,0x9b,0x9c,0x9c,0x9c,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c, + 0x9c,0x9d,0x9d,0x9c,0x9c,0x9c,0x9c,0x9d,0x9e,0x9e,0x9f,0x9f,0xa0,0x9f,0x9c, + 0x9f,0xa2,0x9e,0x9d,0xa0,0xa3,0xa4,0x9d,0x9a,0x9a,0xa0,0xa3,0xa0,0xa4,0xac, + 0xad,0x8a,0x21,0x00,0x01,0x57,0x9c,0x95,0x94,0x98,0xa3,0xa8,0xa4,0xa3,0xa3, + 0xa3,0xa3,0xa3,0xa4,0xa7,0xa7,0xa6,0xa2,0xa4,0xa7,0xa5,0xa4,0xa7,0xa9,0xa9, + 0xaa,0xaa,0xa6,0xa9,0xae,0xbd,0x8b,0x13,0x00,0x00,0x00,0x22,0x7c,0xaa,0xba, + 0xac,0xa5,0xaa,0xab,0xaa,0xa9,0xa8,0xa9,0xa9,0xaa,0xaa,0xaa,0xaa,0xa9,0xa8, + 0xa8,0xa9,0xaa,0xaa,0xa7,0xa0,0xa5,0xb0,0xae,0xa8,0xa3,0xa3,0xa9,0xbf,0x9c, + 0x1a,0x00,0x03,0x03,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x02,0x01,0x00,0x02,0x03,0x02,0x00,0x1e,0xa6,0xab,0x43,0x15,0x00,0x03,0x05, + 0x05,0x03,0x04,0x0b,0x0e,0x0d,0x02,0x03,0x1a,0x65,0xbd,0xb3,0xa3,0xab,0xae, + 0xad,0xac,0xab,0xaa,0xaa,0xaa,0xa9,0xaa,0xae,0xac,0xaa,0xa8,0xa8,0xaa,0xab, + 0xab,0xab,0xab,0xab,0xac,0xae,0xaf,0xad,0xa6,0xaa,0xaf,0xaa,0xa7,0xa8,0xb9, + 0xc8,0xc4,0xb8,0xa7,0xa8,0xac,0xab,0xaa,0xaa,0xaa,0xaa,0xad,0xad,0xac,0xaa, + 0xaa,0xaa,0xac,0xad,0xac,0xab,0xaa,0xac,0xae,0xae,0xaa,0xa7,0xa8,0xae,0xb0, + 0xaf,0xaa,0xa8,0xa8,0xb0,0xaa,0x91,0x83,0x7a,0x69,0x7b,0xb5,0xa7,0x85,0x89, + 0x92,0x9d,0xa6,0xaa,0xa8,0xa7,0xc8,0x3d,0x3c,0x3b,0x3a,0x3b,0x3d,0x3e,0x3f, + 0x3f,0x3e,0x3e,0x3f,0x40,0x40,0x41,0x41,0x41,0x42,0x42,0x43,0x44,0x44,0x45, + 0x45,0x45,0x46,0x46,0x45,0x45,0x46,0x47,0x48,0x48,0x48,0x48,0x48,0x48,0x49, + 0x49,0x49,0x4c,0x4c,0x48,0x4c,0x50,0x4d,0x50,0x5a,0x51,0x3a,0x11,0x1a,0x5a, + 0x5e,0x50,0x50,0x51,0x51,0x53,0x55,0x53,0x55,0x57,0x57,0x55,0x53,0x53,0x57, + 0x57,0x57,0x57,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5b,0x5c, + 0x5c,0x5d,0x5e,0x5e,0x5e,0x5e,0x5f,0x60,0x60,0x61,0x62,0x62,0x5f,0x62,0x65, + 0x61,0x60,0x65,0x6c,0x71,0x67,0x6d,0x86,0x55,0x1a,0x1f,0x44,0x7e,0x6e,0x50, + 0x5a,0x67,0x6f,0x65,0x5c,0x68,0x6d,0x6b,0x6d,0x70,0x71,0x72,0x72,0x6f,0x67, + 0x57,0x5e,0x78,0x78,0x73,0x70,0x72,0x75,0x76,0x75,0x73,0x70,0x6f,0x76,0x7a, + 0x78,0x63,0x50,0x81,0x93,0x64,0x48,0x40,0x5a,0x62,0x45,0x57,0x7a,0x81,0x80, + 0x7b,0x7b,0x7e,0x81,0x7f,0x76,0x65,0x59,0x64,0x75,0x88,0x6f,0x53,0x61,0x66, + 0x5d,0x42,0x3a,0x6d,0x79,0x61,0x70,0x83,0x84,0x6c,0x47,0x61,0x7e,0x80,0x5f, + 0x32,0x56,0x82,0x94,0x8b,0x74,0x79,0x82,0x8a,0x91,0x92,0x7b,0x76,0x93,0x8c, + 0x77,0x82,0x86,0x75,0x7a,0x86,0x80,0x7f,0x8b,0x8e,0x8e,0x8e,0x8f,0x8f,0x8f, + 0x90,0x90,0x90,0x90,0x91,0x91,0x92,0x92,0x91,0x91,0x91,0x92,0x92,0x93,0x94, + 0x94,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0x96,0x96,0x96,0x96,0x97,0x98, + 0x98,0x98,0x98,0x98,0x98,0x99,0x99,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b, + 0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9c,0x9c,0x9c,0x9c,0x9c,0x9d,0x9d,0x9e,0xa0, + 0x9f,0x9e,0x9e,0x9e,0x9c,0x9d,0xa0,0xa0,0x9e,0xa0,0xa5,0xaa,0xa1,0x98,0x9d, + 0xa5,0xad,0xa7,0x80,0x1e,0x00,0x00,0x57,0x9d,0x97,0x91,0x90,0x9f,0xa8,0xa3, + 0xa1,0xa0,0xa1,0xa1,0xa0,0xa1,0xa4,0xa6,0xa6,0xa3,0xa3,0xa7,0xa3,0xa3,0xa7, + 0xa8,0xa7,0xa7,0xa7,0xa6,0xa9,0xad,0xbe,0x8d,0x15,0x00,0x01,0x00,0x1d,0x6f, + 0xa3,0xbc,0xaa,0xa1,0xa6,0xaa,0xaa,0xa7,0xa5,0xa7,0xa7,0xa8,0xa8,0xa8,0xa7, + 0xa7,0xa7,0xa7,0xa7,0xa7,0xa8,0xa7,0xa2,0xa5,0xad,0xac,0xa8,0xa5,0xa3,0xa5, + 0xc1,0xa9,0x35,0x05,0x03,0x01,0x03,0x03,0x02,0x01,0x00,0x00,0x01,0x01,0x01, + 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x00,0x00,0x01,0x02,0x05,0x03,0x00,0x08,0x2f,0x98,0x88,0x18,0x00,0x01, + 0x05,0x06,0x05,0x07,0x08,0x08,0x0a,0x0c,0x00,0x07,0x33,0x7a,0xc0,0xb3,0xa3, + 0xaa,0xac,0xab,0xaa,0xaa,0xac,0xab,0xaa,0xa9,0xaa,0xae,0xad,0xaa,0xa9,0xa9, + 0xa9,0xaa,0xab,0xac,0xac,0xac,0xab,0xab,0xac,0xaa,0xa7,0xaa,0xad,0xa7,0xaa, + 0xb2,0xa4,0x97,0x9d,0xa7,0xb1,0xad,0xa8,0xaa,0xa9,0xa7,0xa8,0xaa,0xac,0xad, + 0xac,0xa9,0xa8,0xaa,0xab,0xaa,0xaa,0xab,0xab,0xac,0xad,0xad,0xaa,0xa6,0xa8, + 0xac,0xac,0xaa,0xaa,0xab,0xad,0xac,0xa6,0x99,0x9e,0x9f,0x6f,0x70,0xb1,0x9c, + 0x77,0x92,0xa6,0xa6,0xa1,0x9a,0x90,0x94,0xc8,0x3a,0x3a,0x38,0x38,0x39,0x3a, + 0x3c,0x3d,0x3d,0x3c,0x3c,0x3d,0x3e,0x3e,0x3e,0x3e,0x3f,0x40,0x40,0x41,0x41, + 0x41,0x42,0x42,0x43,0x44,0x44,0x43,0x43,0x44,0x45,0x45,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x48,0x49,0x4a,0x4a,0x4c,0x4f,0x4c,0x4e,0x56,0x47,0x2e,0x0f, + 0x1d,0x5a,0x5e,0x50,0x51,0x50,0x4d,0x50,0x53,0x50,0x50,0x56,0x54,0x51,0x50, + 0x51,0x56,0x56,0x56,0x56,0x56,0x57,0x57,0x57,0x58,0x58,0x59,0x59,0x59,0x59, + 0x59,0x5a,0x5a,0x5a,0x5c,0x5c,0x5c,0x5c,0x5d,0x5e,0x5e,0x5e,0x5f,0x60,0x61, + 0x5f,0x5e,0x5f,0x63,0x69,0x65,0x5e,0x54,0x64,0x8b,0x5a,0x19,0x1d,0x41,0x7a, + 0x67,0x47,0x58,0x65,0x69,0x58,0x4e,0x66,0x6f,0x66,0x60,0x60,0x71,0x78,0x74, + 0x6b,0x5c,0x41,0x50,0x79,0x7b,0x74,0x6b,0x69,0x6d,0x6e,0x70,0x73,0x70,0x6d, + 0x7d,0x7f,0x63,0x52,0x52,0x80,0x8b,0x54,0x27,0x14,0x50,0x79,0x77,0x88,0x98, + 0x86,0x79,0x77,0x75,0x75,0x7e,0x80,0x7a,0x5c,0x48,0x70,0x82,0x76,0x62,0x53, + 0x57,0x5a,0x5a,0x49,0x46,0x75,0x79,0x57,0x5b,0x6c,0x7f,0x69,0x39,0x5f,0x82, + 0x6b,0x4c,0x34,0x65,0x90,0x85,0x7f,0x7b,0x78,0x7b,0x8a,0x90,0x8d,0x7b,0x74, + 0x89,0x86,0x78,0x7f,0x80,0x71,0x76,0x80,0x75,0x74,0x87,0x8d,0x8c,0x8d,0x8d, + 0x8d,0x8d,0x8e,0x8e,0x8e,0x8e,0x8f,0x90,0x91,0x91,0x90,0x90,0x91,0x91,0x91, + 0x92,0x92,0x92,0x93,0x93,0x94,0x94,0x94,0x93,0x93,0x94,0x94,0x94,0x94,0x94, + 0x95,0x96,0x97,0x97,0x97,0x97,0x98,0x98,0x98,0x98,0x98,0x99,0x9a,0x9a,0x9a, + 0x9a,0x9a,0x9a,0x9a,0x99,0x98,0x98,0x99,0x9a,0x9a,0x9b,0x9b,0x9b,0x9c,0x9c, + 0x9d,0x9e,0xa0,0xa0,0x9c,0x99,0x9c,0x9e,0xa0,0x9a,0x97,0xa3,0xaf,0xb5,0xa0, + 0x8e,0x99,0xa7,0xb2,0xa0,0x70,0x1a,0x00,0x00,0x57,0xa2,0xa3,0x9a,0x8f,0x9c, + 0xa7,0xa2,0xa0,0x9f,0xa0,0xa0,0x9e,0xa0,0xa3,0xa5,0xa5,0xa3,0xa3,0xa4,0xa2, + 0xa2,0xa6,0xa6,0xa4,0xa3,0xa3,0xa5,0xa7,0xac,0xbd,0x8e,0x15,0x00,0x04,0x00, + 0x18,0x62,0x9d,0xbd,0xa8,0x9d,0xa3,0xa7,0xa9,0xa4,0xa3,0xa4,0xa5,0xa6,0xa5, + 0xa4,0xa4,0xa4,0xa5,0xa5,0xa5,0xa5,0xa6,0xa8,0xaa,0xa8,0xa5,0xa6,0xa7,0xa4, + 0xa6,0xaa,0xba,0xa5,0x53,0x1e,0x03,0x00,0x03,0x03,0x02,0x00,0x00,0x00,0x02, + 0x02,0x02,0x01,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x02,0x01,0x00,0x01,0x04,0x07,0x03,0x00,0x13,0x38,0x73,0x5b,0x07, + 0x00,0x00,0x07,0x08,0x05,0x09,0x0a,0x02,0x02,0x07,0x00,0x0d,0x4f,0x8f,0xc0, + 0xb6,0xa7,0xa8,0xa9,0xa9,0xaa,0xab,0xad,0xad,0xab,0xa9,0xa9,0xac,0xad,0xad, + 0xac,0xaa,0xaa,0xaa,0xaa,0xab,0xac,0xac,0xab,0xaa,0xa7,0xa8,0xad,0xab,0xa9, + 0xa7,0xb2,0xbf,0x7d,0x42,0x5a,0x89,0xbe,0xb7,0xa5,0xa9,0xa9,0xa6,0xa8,0xab, + 0xac,0xac,0xac,0xa8,0xa7,0xac,0xab,0xa8,0xa8,0xaa,0xae,0xac,0xa9,0xaa,0xab, + 0xaa,0xaa,0xaa,0xa4,0xa4,0xad,0xb0,0xae,0xa5,0xa3,0xac,0xb3,0xae,0x7b,0x74, + 0xaa,0x94,0x73,0x98,0xae,0xaa,0x9c,0x8a,0x79,0x7f,0xc8,0x36,0x36,0x36,0x36, + 0x36,0x39,0x3b,0x3b,0x3b,0x3a,0x3a,0x3b,0x3d,0x3d,0x3c,0x3d,0x3d,0x3d,0x3e, + 0x3e,0x3f,0x3f,0x40,0x40,0x41,0x41,0x42,0x41,0x42,0x42,0x43,0x45,0x45,0x45, + 0x45,0x45,0x45,0x45,0x45,0x46,0x48,0x48,0x48,0x4a,0x4c,0x47,0x4b,0x58,0x45, + 0x26,0x0b,0x1d,0x5a,0x5d,0x4c,0x4c,0x4e,0x4f,0x50,0x50,0x4f,0x50,0x50,0x51, + 0x50,0x4f,0x50,0x54,0x55,0x54,0x54,0x54,0x54,0x55,0x56,0x56,0x57,0x57,0x57, + 0x57,0x57,0x58,0x58,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5c,0x5c,0x5d,0x5d,0x5d, + 0x5c,0x5e,0x5e,0x5e,0x5a,0x60,0x74,0x53,0x28,0x2c,0x53,0x8f,0x57,0x08,0x17, + 0x3c,0x68,0x60,0x50,0x69,0x6c,0x57,0x4a,0x4c,0x6d,0x71,0x57,0x3e,0x38,0x5e, + 0x76,0x7c,0x6b,0x56,0x48,0x56,0x73,0x71,0x6a,0x6b,0x6d,0x6f,0x71,0x71,0x70, + 0x6c,0x6a,0x7c,0x7c,0x58,0x50,0x5f,0x86,0x8a,0x53,0x41,0x4c,0x79,0x7f,0x4a, + 0x59,0x7f,0x7b,0x75,0x77,0x79,0x79,0x6d,0x71,0x85,0x5d,0x37,0x68,0x7b,0x67, + 0x66,0x66,0x53,0x5b,0x79,0x62,0x4f,0x74,0x77,0x57,0x49,0x4c,0x67,0x5d,0x3a, + 0x57,0x6d,0x4c,0x43,0x52,0x7c,0x95,0x7b,0x73,0x77,0x74,0x78,0x86,0x8d,0x8c, + 0x7c,0x76,0x82,0x7f,0x75,0x74,0x73,0x6d,0x78,0x86,0x76,0x74,0x8d,0x90,0x8a, + 0x8a,0x8a,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,0x8d,0x8d,0x8d,0x8e,0x8e,0x8f,0x8f, + 0x90,0x91,0x91,0x91,0x91,0x91,0x91,0x92,0x91,0x92,0x93,0x93,0x94,0x93,0x92, + 0x93,0x93,0x94,0x95,0x95,0x97,0x96,0x95,0x95,0x96,0x95,0x95,0x97,0x98,0x99, + 0x99,0x99,0x99,0x98,0x98,0x99,0x98,0x98,0x98,0x98,0x9a,0x9a,0x9a,0x9a,0x9a, + 0x9a,0x9b,0x9c,0x9d,0x9c,0x9a,0x9b,0x9c,0x9c,0x9a,0x98,0x9f,0xa3,0x9b,0x8d, + 0x80,0x95,0xa8,0x98,0x9e,0xb2,0xa7,0x7c,0x20,0x00,0x00,0x3d,0x7e,0xa4,0xab, + 0x9d,0x9f,0xa0,0x9d,0x9d,0x9f,0xa0,0xa0,0x9f,0xa0,0xa3,0xa5,0xa4,0xa0,0xa0, + 0xa2,0xa2,0xa2,0xa3,0xa0,0x9e,0xa2,0xa3,0xa0,0x9f,0xa1,0xb9,0x8d,0x13,0x00, + 0x07,0x00,0x14,0x55,0x95,0xbe,0xa6,0x9c,0xa6,0xa5,0xa2,0xa3,0xa4,0xa5,0xa6, + 0xa6,0xa4,0xa3,0xa3,0xa3,0xa5,0xa6,0xa6,0xa6,0xa6,0xa6,0xa7,0xa3,0x9e,0xa2, + 0xa5,0xa1,0xa3,0xa7,0xae,0x96,0x4e,0x1b,0x00,0x00,0x05,0x03,0x01,0x00,0x00, + 0x00,0x02,0x03,0x03,0x01,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x00,0x01,0x03,0x02,0x02,0x03,0x02,0x00,0x0a,0x19,0x27, + 0x1d,0x03,0x02,0x07,0x08,0x07,0x03,0x03,0x03,0x03,0x04,0x06,0x00,0x0f,0x7f, + 0xaf,0xb2,0xae,0xa9,0xa7,0xa7,0xa7,0xa8,0xa9,0xa7,0xa9,0xaa,0xa9,0xa7,0xa7, + 0xa9,0xac,0xad,0xac,0xa9,0xa7,0xa7,0xa9,0xaa,0xaa,0xa8,0xa7,0xa9,0xaa,0xa8, + 0xa7,0xa8,0xac,0xb2,0xb0,0x5a,0x12,0x2c,0x6e,0xc0,0xb7,0x9e,0xa7,0xa9,0xa5, + 0xa7,0xaa,0xa9,0xa8,0xa9,0xa6,0xa6,0xad,0xad,0xa9,0xa8,0xa7,0xa7,0xa7,0xa7, + 0xab,0xac,0xa6,0xa8,0xad,0xa7,0xa6,0xac,0xa7,0xa0,0xa4,0xa9,0xaa,0xa5,0x96, + 0x68,0x68,0xa2,0x99,0x80,0x94,0xa2,0xa4,0x9f,0x97,0x94,0x86,0xc8,0x36,0x35, + 0x35,0x35,0x36,0x37,0x37,0x37,0x37,0x39,0x39,0x3a,0x3a,0x3b,0x3a,0x3b,0x3b, + 0x3c,0x3c,0x3d,0x3d,0x3d,0x3d,0x3d,0x3e,0x3f,0x40,0x3f,0x40,0x41,0x41,0x42, + 0x43,0x44,0x44,0x44,0x43,0x44,0x45,0x45,0x46,0x46,0x45,0x47,0x47,0x42,0x48, + 0x5a,0x42,0x1e,0x0a,0x20,0x5a,0x5a,0x47,0x48,0x4c,0x4e,0x4f,0x4e,0x4e,0x4d, + 0x4c,0x4e,0x50,0x4e,0x50,0x53,0x53,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x54, + 0x54,0x54,0x54,0x55,0x56,0x57,0x57,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b, + 0x5b,0x5a,0x5a,0x5a,0x5d,0x5e,0x56,0x5e,0x7a,0x46,0x05,0x12,0x45,0x8e,0x53, + 0x00,0x14,0x37,0x5d,0x5c,0x56,0x6d,0x67,0x42,0x3d,0x49,0x67,0x66,0x48,0x2b, + 0x24,0x4c,0x69,0x78,0x65,0x4f,0x47,0x56,0x70,0x6c,0x65,0x6a,0x6d,0x6e,0x70, + 0x70,0x6c,0x69,0x6a,0x79,0x74,0x4e,0x56,0x75,0x83,0x78,0x50,0x5c,0x80,0x91, + 0x7a,0x32,0x3f,0x6b,0x6d,0x6d,0x74,0x79,0x78,0x64,0x68,0x86,0x60,0x37,0x5e, + 0x6e,0x5e,0x66,0x6d,0x50,0x57,0x80,0x6d,0x57,0x6c,0x6d,0x58,0x3d,0x32,0x54, + 0x58,0x44,0x4f,0x53,0x34,0x40,0x6b,0x88,0x8f,0x74,0x6c,0x72,0x73,0x76,0x80, + 0x86,0x87,0x7f,0x7b,0x7d,0x7b,0x76,0x6b,0x67,0x6f,0x7a,0x83,0x78,0x78,0x8d, + 0x8d,0x87,0x88,0x89,0x89,0x8a,0x8b,0x8a,0x8a,0x8a,0x8a,0x8c,0x8c,0x8d,0x8d, + 0x8d,0x8e,0x8e,0x8e,0x8e,0x8f,0x8f,0x8e,0x8f,0x90,0x90,0x91,0x92,0x92,0x92, + 0x92,0x92,0x91,0x91,0x91,0x94,0x94,0x8f,0x8f,0x91,0x95,0x96,0x95,0x95,0x94, + 0x95,0x97,0x98,0x98,0x95,0x97,0x98,0x98,0x97,0x97,0x97,0x97,0x98,0x99,0x99, + 0x98,0x98,0x98,0x99,0x9a,0x9b,0x99,0x95,0x98,0x9c,0x9a,0x96,0x93,0xa5,0xad, + 0x87,0x5f,0x42,0x82,0xbd,0xa0,0x97,0xa3,0xa3,0x82,0x24,0x00,0x03,0x27,0x5d, + 0xa1,0xb4,0xa3,0x9f,0x9c,0x9b,0x9b,0x9c,0xa0,0xa1,0xa0,0xa0,0xa0,0xa3,0xa3, + 0x9f,0x9f,0xa0,0xa1,0xa1,0xa0,0x9c,0x9b,0xa1,0xa3,0x9b,0x98,0x9c,0xb5,0x8a, + 0x12,0x00,0x08,0x00,0x10,0x45,0x8c,0xc0,0xa6,0x9b,0xa7,0xa3,0x9e,0xa1,0xa4, + 0xa6,0xa6,0xa5,0xa3,0xa3,0xa2,0xa3,0xa4,0xa5,0xa6,0xa5,0xa5,0xa4,0xa4,0xa0, + 0x9c,0xa0,0xa2,0x9f,0xa0,0xa3,0xa6,0x95,0x64,0x36,0x0f,0x06,0x03,0x03,0x02, + 0x00,0x00,0x00,0x02,0x03,0x02,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x04,0x03,0x00,0x01,0x02,0x02,0x03, + 0x02,0x00,0x00,0x05,0x07,0x08,0x07,0x05,0x02,0x00,0x00,0x05,0x05,0x03,0x00, + 0x2b,0xa3,0xc1,0xa5,0xa5,0xa7,0xa7,0xa5,0xa4,0xa6,0xa6,0xa2,0xa3,0xa5,0xa4, + 0xa3,0xa2,0xa5,0xa9,0xaa,0xaa,0xa7,0xa6,0xa4,0xa5,0xa7,0xa7,0xa6,0xa5,0xaa, + 0xa9,0xa3,0xa3,0xa7,0xae,0xb2,0xa7,0x4a,0x00,0x0b,0x53,0xb9,0xb6,0x9f,0xa4, + 0xa6,0xa3,0xa6,0xa8,0xa8,0xa7,0xa3,0x9b,0x99,0xa5,0xaa,0xaa,0xa9,0xa8,0xa6, + 0xa5,0xa7,0xaa,0xa9,0xa3,0xa5,0xab,0xa8,0xa7,0xa9,0x9f,0x92,0x9a,0xa2,0xa4, + 0x94,0x7a,0x5e,0x60,0x83,0x7f,0x74,0x8b,0x9a,0x9c,0x9a,0x99,0xa3,0x89,0xc8, + 0x38,0x38,0x35,0x35,0x37,0x34,0x30,0x2f,0x32,0x38,0x39,0x37,0x35,0x36,0x3a, + 0x3a,0x39,0x3a,0x3a,0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x3c,0x3d,0x3a,0x3d,0x41, + 0x40,0x3f,0x40,0x41,0x42,0x41,0x41,0x41,0x42,0x43,0x44,0x45,0x45,0x43,0x41, + 0x3f,0x47,0x59,0x3b,0x13,0x0e,0x27,0x5a,0x56,0x42,0x46,0x49,0x49,0x4d,0x4f, + 0x4c,0x49,0x47,0x4c,0x52,0x4f,0x4f,0x52,0x50,0x4e,0x52,0x53,0x52,0x52,0x53, + 0x52,0x52,0x53,0x53,0x53,0x53,0x53,0x54,0x55,0x57,0x58,0x57,0x57,0x58,0x5a, + 0x5a,0x5a,0x59,0x5a,0x5a,0x58,0x5a,0x5d,0x55,0x5d,0x79,0x47,0x07,0x10,0x3f, + 0x86,0x53,0x07,0x14,0x36,0x5e,0x5d,0x52,0x5d,0x50,0x2c,0x33,0x45,0x4c,0x49, + 0x3d,0x33,0x32,0x41,0x53,0x61,0x57,0x45,0x33,0x48,0x73,0x71,0x68,0x67,0x67, + 0x68,0x69,0x69,0x68,0x6a,0x6e,0x74,0x69,0x44,0x60,0x92,0x71,0x50,0x45,0x66, + 0x91,0x82,0x69,0x51,0x5b,0x6f,0x61,0x5e,0x70,0x73,0x6d,0x66,0x6a,0x78,0x64, + 0x4c,0x57,0x5e,0x5a,0x5c,0x5a,0x48,0x48,0x5e,0x60,0x5d,0x5b,0x5b,0x5a,0x38, + 0x27,0x4f,0x5f,0x57,0x48,0x36,0x27,0x41,0x75,0x82,0x7e,0x6e,0x6a,0x70,0x75, + 0x78,0x78,0x7b,0x7f,0x83,0x82,0x78,0x7a,0x7e,0x67,0x61,0x77,0x79,0x74,0x7a, + 0x7f,0x82,0x83,0x85,0x89,0x8a,0x87,0x8a,0x8d,0x8c,0x8a,0x88,0x8a,0x8d,0x8c, + 0x8b,0x8b,0x8d,0x8f,0x8c,0x8b,0x8c,0x8d,0x8d,0x8b,0x8b,0x8d,0x8e,0x8f,0x91, + 0x90,0x8d,0x91,0x93,0x91,0x8e,0x8d,0x95,0x94,0x7e,0x7f,0x8e,0x95,0x98,0x98, + 0x95,0x90,0x8f,0x91,0x98,0x95,0x8e,0x94,0x98,0x95,0x95,0x97,0x95,0x95,0x95, + 0x97,0x98,0x97,0x96,0x97,0x98,0x98,0x98,0x96,0x95,0x95,0x97,0x97,0x95,0x94, + 0xaa,0xad,0x6b,0x2f,0x0c,0x65,0xbe,0xae,0x96,0x82,0x8a,0x79,0x22,0x00,0x03, + 0x1d,0x4c,0x9b,0xaf,0x99,0x99,0x9c,0x9c,0x9a,0x98,0x9c,0x9f,0x9e,0x9b,0x99, + 0xa0,0xa3,0x9e,0x9d,0xa0,0xa0,0xa0,0x9e,0x9d,0x9e,0xa0,0xa0,0x98,0x99,0x9f, + 0xb3,0x86,0x12,0x00,0x07,0x00,0x0c,0x32,0x81,0xc1,0xa7,0x9a,0xa3,0xa3,0xa0, + 0xa0,0xa2,0xa4,0xa3,0xa1,0xa0,0xa0,0xa1,0xa1,0xa2,0xa3,0xa3,0xa3,0xa3,0xa4, + 0xa4,0xa3,0xa1,0x9d,0x9c,0x9d,0x9d,0x9d,0xa6,0xaa,0xa5,0x7b,0x3f,0x14,0x00, + 0x03,0x04,0x03,0x02,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x02,0x01,0x00,0x03,0x03, + 0x00,0x02,0x04,0x02,0x04,0x08,0x05,0x03,0x05,0x04,0x03,0x03,0x03,0x03,0x00, + 0x00,0x2b,0x69,0xb2,0xbc,0x9f,0x9c,0x9f,0xa4,0xa5,0xa2,0xa3,0xa1,0x9d,0x9a, + 0x98,0x98,0x9b,0xa0,0xa2,0xa3,0xa3,0xa4,0xa7,0xa6,0xa3,0xa2,0xa2,0xa3,0xa3, + 0xa4,0xa7,0xa5,0xa0,0xa0,0xa3,0xab,0xb3,0xaf,0x52,0x00,0x00,0x3a,0xa8,0xb7, + 0xa9,0xa2,0xa0,0xa0,0xa2,0xa5,0xab,0xa7,0x99,0x83,0x7b,0x93,0xa1,0xa7,0xad, + 0xae,0xaa,0xa8,0xa7,0xa4,0xa2,0xa0,0xa3,0xa5,0xa3,0xa2,0xa6,0x9c,0x8c,0x82, + 0x8a,0xa2,0x89,0x62,0x69,0x62,0x46,0x3a,0x45,0x7e,0x9c,0x92,0x8b,0x87,0x93, + 0x7b,0xc8,0x37,0x36,0x32,0x32,0x37,0x36,0x33,0x30,0x32,0x36,0x36,0x35,0x33, + 0x34,0x35,0x36,0x36,0x3a,0x3a,0x38,0x37,0x38,0x3a,0x39,0x37,0x38,0x39,0x3a, + 0x3c,0x3e,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3f,0x41,0x41,0x3e,0x40,0x41,0x41, + 0x40,0x3e,0x41,0x4a,0x58,0x36,0x0d,0x0f,0x2b,0x59,0x53,0x41,0x48,0x4b,0x45, + 0x48,0x4c,0x4b,0x48,0x45,0x49,0x4e,0x4c,0x4c,0x50,0x4e,0x4c,0x4e,0x4f,0x50, + 0x50,0x50,0x4f,0x50,0x51,0x51,0x50,0x50,0x52,0x53,0x52,0x50,0x51,0x53,0x55, + 0x56,0x57,0x57,0x57,0x57,0x56,0x57,0x5a,0x5a,0x59,0x53,0x5e,0x78,0x48,0x09, + 0x09,0x33,0x7d,0x50,0x09,0x12,0x32,0x5d,0x56,0x41,0x3d,0x31,0x1f,0x33,0x49, + 0x3d,0x37,0x39,0x36,0x35,0x33,0x3d,0x4d,0x47,0x3d,0x3a,0x4c,0x6b,0x6c,0x66, + 0x65,0x65,0x69,0x67,0x66,0x66,0x70,0x78,0x63,0x51,0x50,0x70,0x91,0x57,0x35, + 0x4d,0x65,0x76,0x6b,0x60,0x5f,0x6f,0x7c,0x59,0x50,0x71,0x71,0x65,0x67,0x65, + 0x5d,0x55,0x53,0x5e,0x63,0x5e,0x60,0x5d,0x40,0x3f,0x5a,0x63,0x61,0x52,0x53, + 0x61,0x54,0x46,0x47,0x50,0x5a,0x4b,0x3c,0x3d,0x50,0x6d,0x75,0x77,0x74,0x70, + 0x6d,0x76,0x7b,0x78,0x76,0x78,0x84,0x86,0x73,0x74,0x7c,0x69,0x62,0x73,0x6b, + 0x60,0x7b,0x8a,0x82,0x81,0x82,0x87,0x88,0x84,0x86,0x89,0x89,0x87,0x85,0x87, + 0x8a,0x8a,0x88,0x87,0x89,0x8a,0x8a,0x8a,0x8b,0x8a,0x89,0x88,0x8a,0x8c,0x8c, + 0x8b,0x8c,0x8c,0x8d,0x8e,0x8f,0x8d,0x8b,0x8a,0x96,0x96,0x7a,0x7b,0x8d,0x8d, + 0x8d,0x95,0x95,0x90,0x8e,0x90,0x95,0x94,0x91,0x92,0x93,0x93,0x92,0x91,0x91, + 0x91,0x8f,0x90,0x91,0x92,0x93,0x95,0x94,0x92,0x95,0x95,0x95,0x95,0x96,0x93, + 0x92,0x94,0xa9,0xab,0x72,0x32,0x00,0x3c,0x8b,0xa4,0x9c,0x80,0x90,0x86,0x26, + 0x00,0x03,0x21,0x54,0x9e,0xae,0x93,0x96,0x9b,0x98,0x98,0x97,0x99,0x9a,0x9a, + 0x9a,0x9b,0x9d,0x9d,0x9a,0x9b,0x9c,0x9d,0x9c,0x99,0x9a,0x9d,0xa0,0x9f,0x9b, + 0x9b,0xa0,0xb3,0x86,0x13,0x00,0x04,0x00,0x0a,0x29,0x7c,0xc0,0xa5,0x96,0x9f, + 0xa0,0x9e,0x9f,0xa0,0x9f,0xa0,0xa1,0x9f,0x9f,0xa1,0xa0,0xa0,0xa0,0xa0,0xa2, + 0xa1,0xa1,0xa1,0xa0,0xa0,0x9c,0x9b,0x9f,0x9e,0x9c,0x9f,0xa0,0x9c,0x7f,0x50, + 0x1b,0x00,0x03,0x04,0x03,0x01,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00, + 0x03,0x04,0x02,0x03,0x03,0x04,0x05,0x05,0x03,0x02,0x04,0x05,0x04,0x04,0x04, + 0x03,0x00,0x09,0x5c,0xa1,0xae,0xaa,0x9e,0x9c,0x9e,0xa3,0xa4,0xa2,0xa2,0xa1, + 0x9e,0x9b,0x99,0x98,0x9c,0xa3,0xa0,0x98,0x96,0x99,0xa0,0xa3,0xa3,0xa0,0xa0, + 0xa4,0xa4,0xa3,0xa5,0xa5,0xa3,0xa3,0xa4,0xa4,0xae,0xb7,0x62,0x0a,0x00,0x30, + 0x9d,0xb3,0xab,0xa1,0x9c,0x9c,0x9a,0x9a,0xa1,0xa3,0x9d,0x7a,0x6a,0x8d,0x93, + 0x86,0x7f,0x7f,0x82,0x95,0xac,0xaa,0xa3,0x9f,0x9f,0xa0,0x9d,0xa0,0xa8,0x94, + 0x74,0x66,0x78,0xac,0x8a,0x50,0x62,0x69,0x53,0x46,0x49,0x79,0x8b,0x77,0x6b, + 0x64,0x65,0x59,0xc8,0x2e,0x2d,0x29,0x2b,0x34,0x39,0x3a,0x36,0x34,0x33,0x32, + 0x32,0x35,0x34,0x31,0x32,0x34,0x3a,0x39,0x35,0x34,0x35,0x39,0x38,0x35,0x35, + 0x36,0x3b,0x3c,0x3b,0x3b,0x3c,0x3c,0x3a,0x37,0x39,0x3d,0x41,0x3f,0x3b,0x3d, + 0x3d,0x3e,0x3e,0x3f,0x43,0x4b,0x57,0x32,0x0a,0x12,0x2f,0x56,0x50,0x41,0x4c, + 0x4d,0x43,0x44,0x47,0x49,0x48,0x45,0x46,0x48,0x48,0x4a,0x4c,0x4c,0x4c,0x48, + 0x4a,0x4e,0x4d,0x4c,0x4c,0x4d,0x50,0x4e,0x4d,0x4f,0x51,0x53,0x4f,0x4b,0x49, + 0x4e,0x54,0x53,0x51,0x51,0x53,0x55,0x51,0x53,0x5e,0x5a,0x53,0x52,0x5e,0x74, + 0x48,0x0d,0x03,0x27,0x70,0x4a,0x09,0x0e,0x2c,0x57,0x4a,0x2c,0x1f,0x19,0x1b, + 0x37,0x4c,0x37,0x2f,0x36,0x36,0x31,0x27,0x2c,0x3d,0x3a,0x39,0x48,0x54,0x5e, + 0x62,0x64,0x63,0x65,0x6a,0x67,0x65,0x67,0x74,0x7d,0x50,0x3d,0x69,0x7b,0x75, + 0x41,0x2d,0x57,0x58,0x48,0x53,0x5f,0x65,0x7a,0x85,0x53,0x48,0x73,0x71,0x62, + 0x65,0x5b,0x44,0x42,0x50,0x68,0x6f,0x62,0x67,0x64,0x3a,0x3a,0x64,0x69,0x61, + 0x4e,0x51,0x66,0x73,0x6d,0x41,0x3b,0x55,0x50,0x4c,0x5e,0x62,0x5d,0x68,0x74, + 0x7b,0x74,0x69,0x74,0x7d,0x79,0x74,0x73,0x82,0x85,0x6e,0x6e,0x78,0x6d,0x65, + 0x67,0x5b,0x53,0x7b,0x92,0x87,0x82,0x80,0x83,0x84,0x81,0x81,0x82,0x83,0x83, + 0x82,0x83,0x85,0x86,0x85,0x83,0x83,0x85,0x86,0x87,0x8a,0x87,0x85,0x87,0x89, + 0x8a,0x89,0x87,0x86,0x89,0x8d,0x8d,0x8a,0x8a,0x89,0x89,0x95,0x96,0x7e,0x7d, + 0x8a,0x82,0x7f,0x8e,0x93,0x91,0x91,0x91,0x8f,0x91,0x94,0x90,0x8e,0x91,0x8f, + 0x8b,0x8d,0x8c,0x88,0x87,0x88,0x8c,0x90,0x93,0x90,0x8c,0x91,0x94,0x94,0x95, + 0x95,0x8f,0x8d,0x92,0xa3,0xa8,0x8b,0x50,0x08,0x12,0x45,0x90,0xa6,0x8e,0xa4, + 0x98,0x2e,0x00,0x03,0x2a,0x62,0xa4,0xad,0x8e,0x94,0x9a,0x95,0x95,0x98,0x97, + 0x96,0x98,0x9b,0x9d,0x9a,0x98,0x96,0x97,0x98,0x9a,0x98,0x94,0x96,0x9b,0x9c, + 0x9d,0x9d,0x9c,0x9e,0xb2,0x86,0x14,0x00,0x03,0x00,0x09,0x26,0x79,0xbf,0xa2, + 0x92,0x9b,0x9b,0x9a,0x9d,0x9c,0x99,0x9d,0xa0,0x9d,0x9d,0xa0,0x9f,0x9c,0x9b, + 0x9c,0xa0,0x9e,0x9d,0x9c,0x9c,0x9b,0x9a,0x9b,0x9f,0xa0,0x9c,0x98,0x8c,0x77, + 0x68,0x55,0x20,0x00,0x03,0x03,0x02,0x00,0x00,0x02,0x03,0x03,0x01,0x00,0x00, + 0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x02,0x00, + 0x00,0x00,0x02,0x03,0x04,0x03,0x02,0x04,0x04,0x01,0x02,0x03,0x05,0x06,0x07, + 0x06,0x04,0x03,0x0c,0x28,0x8a,0xc6,0xa0,0x97,0xa0,0x9f,0xa0,0xa3,0xa3,0xa1, + 0xa2,0xa2,0xa0,0x9e,0x9e,0x9e,0xa0,0xa4,0x9c,0x8e,0x8b,0x8e,0x98,0x9e,0xa0, + 0x9c,0x9d,0xa5,0xa3,0xa1,0xa3,0xa5,0xa5,0xa6,0xa5,0x9c,0xa7,0xbd,0x76,0x24, + 0x01,0x2e,0x94,0xae,0xab,0xa2,0x9c,0x9c,0x95,0x91,0x91,0x9b,0xa4,0x76,0x5c, + 0x83,0x7d,0x58,0x45,0x42,0x51,0x78,0xa3,0xa6,0xa0,0xa0,0x9e,0x9c,0x9b,0xa0, + 0xaa,0x86,0x56,0x4d,0x6d,0xb5,0x8e,0x48,0x53,0x6b,0x82,0x78,0x66,0x78,0x78, + 0x5f,0x54,0x4c,0x40,0x41,0xc8,0x12,0x12,0x11,0x18,0x28,0x33,0x3a,0x3a,0x36, + 0x33,0x32,0x32,0x37,0x37,0x32,0x33,0x34,0x35,0x36,0x37,0x37,0x37,0x37,0x38, + 0x3a,0x3a,0x3c,0x3d,0x3c,0x3a,0x39,0x3a,0x3f,0x41,0x40,0x3d,0x3d,0x40,0x41, + 0x42,0x3f,0x3f,0x42,0x45,0x45,0x3a,0x3d,0x51,0x2f,0x0a,0x20,0x3b,0x50,0x4a, + 0x3d,0x41,0x44,0x44,0x41,0x41,0x46,0x48,0x45,0x45,0x46,0x48,0x48,0x46,0x48, + 0x4a,0x48,0x49,0x4b,0x4b,0x4b,0x4c,0x4e,0x4f,0x4c,0x4c,0x4e,0x50,0x50,0x50, + 0x4e,0x4c,0x50,0x54,0x50,0x4d,0x50,0x50,0x50,0x51,0x55,0x5a,0x55,0x4d,0x4e, + 0x57,0x6a,0x46,0x13,0x03,0x1d,0x5c,0x3f,0x0a,0x06,0x1a,0x41,0x3a,0x28,0x2b, + 0x2b,0x27,0x32,0x3d,0x36,0x33,0x33,0x2e,0x28,0x24,0x2b,0x39,0x3b,0x3b,0x41, + 0x49,0x54,0x5f,0x66,0x65,0x63,0x61,0x60,0x63,0x6d,0x6b,0x61,0x48,0x4a,0x7d, + 0x6c,0x3d,0x49,0x4f,0x3c,0x2f,0x2e,0x56,0x72,0x74,0x74,0x6c,0x4f,0x4e,0x72, + 0x74,0x66,0x5d,0x53,0x4c,0x47,0x49,0x61,0x67,0x5b,0x5d,0x5a,0x3d,0x3d,0x5d, + 0x5c,0x54,0x55,0x5a,0x63,0x5a,0x4b,0x3c,0x40,0x52,0x45,0x41,0x5b,0x61,0x58, + 0x63,0x6c,0x66,0x65,0x66,0x6e,0x73,0x70,0x6d,0x6b,0x7c,0x82,0x6d,0x6f,0x7b, + 0x71,0x64,0x58,0x5f,0x70,0x80,0x86,0x80,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f, + 0x81,0x82,0x82,0x81,0x80,0x84,0x85,0x82,0x82,0x82,0x81,0x83,0x89,0x87,0x85, + 0x88,0x88,0x85,0x86,0x87,0x8a,0x8a,0x8a,0x8a,0x8b,0x8d,0x8c,0x8a,0x8d,0x8d, + 0x85,0x7f,0x7d,0x78,0x7b,0x8a,0x8b,0x86,0x91,0x95,0x8d,0x88,0x86,0x8e,0x92, + 0x8d,0x8d,0x8f,0x8a,0x85,0x82,0x80,0x81,0x86,0x8d,0x91,0x91,0x8d,0x8e,0x8f, + 0x8f,0x91,0x93,0x8f,0x8c,0x8b,0x9b,0xa6,0x98,0x5f,0x09,0x00,0x22,0x8d,0xb3, + 0x9c,0xad,0x9f,0x3b,0x06,0x03,0x20,0x56,0xa3,0xaf,0x8d,0x8e,0x93,0x91,0x95, + 0x9d,0xa2,0xa3,0x9e,0x97,0x91,0x96,0x98,0x95,0x94,0x94,0x97,0x98,0x98,0x9a, + 0x9b,0x97,0x95,0x98,0x9a,0x9c,0xae,0x82,0x13,0x00,0x03,0x00,0x07,0x20,0x74, + 0xbb,0xa1,0x92,0x98,0x98,0x98,0x99,0x99,0x98,0x99,0x9b,0x9c,0x9c,0x9c,0x99, + 0x98,0x97,0x98,0x9a,0x9b,0x9b,0x99,0x98,0x97,0x95,0x95,0x98,0x9b,0x9e,0x9c, + 0x91,0x7a,0x74,0x6b,0x28,0x00,0x04,0x03,0x00,0x00,0x01,0x01,0x01,0x02,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x03,0x06,0x07,0x05,0x01,0x00,0x03,0x01,0x01,0x05,0x07,0x06,0x05,0x05,0x04, + 0x06,0x08,0x01,0x00,0x00,0x32,0x7f,0xa7,0xb2,0x9c,0x97,0x9d,0x9c,0x9c,0x9c, + 0x9c,0x9c,0x9c,0x9c,0x99,0x99,0x9b,0x9b,0x9a,0x99,0x96,0x92,0x8e,0x8d,0x93, + 0x96,0x98,0x96,0x97,0x9b,0x98,0x96,0x9e,0xa0,0x9a,0x9e,0xa2,0x9c,0xa7,0xbb, + 0x80,0x36,0x04,0x25,0x88,0xad,0xb5,0xa7,0xa1,0xa5,0xaa,0xa3,0x88,0x90,0xa7, + 0x6a,0x3d,0x55,0x56,0x48,0x3f,0x45,0x62,0x65,0x5b,0x65,0x7f,0xab,0xb1,0xa2, + 0xa7,0xa7,0x98,0x6a,0x3c,0x43,0x66,0xa0,0x8d,0x5b,0x42,0x53,0x90,0x86,0x69, + 0x70,0x79,0x81,0x86,0x86,0x83,0x82,0xc8,0x02,0x02,0x01,0x08,0x17,0x23,0x2b, + 0x2b,0x2b,0x29,0x2a,0x2d,0x36,0x38,0x36,0x36,0x36,0x35,0x35,0x36,0x35,0x34, + 0x34,0x35,0x36,0x37,0x3a,0x3d,0x3b,0x37,0x35,0x36,0x3e,0x42,0x42,0x3b,0x36, + 0x36,0x3a,0x40,0x3d,0x3e,0x45,0x47,0x42,0x2a,0x28,0x3e,0x23,0x07,0x2e,0x43, + 0x3d,0x39,0x38,0x41,0x45,0x44,0x41,0x41,0x44,0x46,0x46,0x45,0x45,0x45,0x45, + 0x45,0x47,0x4a,0x4b,0x48,0x44,0x46,0x49,0x4a,0x49,0x48,0x48,0x49,0x4b,0x4c, + 0x4b,0x4b,0x4c,0x4d,0x4e,0x4f,0x4c,0x4b,0x4d,0x4d,0x4c,0x50,0x53,0x57,0x52, + 0x4c,0x49,0x52,0x63,0x44,0x17,0x04,0x19,0x51,0x3a,0x0c,0x00,0x12,0x3d,0x3a, + 0x2b,0x2d,0x30,0x30,0x2b,0x2a,0x35,0x36,0x2b,0x27,0x25,0x28,0x2c,0x32,0x41, + 0x49,0x3b,0x3c,0x49,0x59,0x63,0x63,0x60,0x5b,0x5d,0x62,0x6d,0x5c,0x40,0x4c, + 0x61,0x78,0x53,0x20,0x50,0x62,0x30,0x1c,0x21,0x4a,0x6a,0x74,0x67,0x51,0x4a, + 0x52,0x67,0x6c,0x66,0x58,0x51,0x53,0x4c,0x47,0x53,0x54,0x47,0x48,0x4b,0x40, + 0x42,0x51,0x52,0x4e,0x4c,0x4d,0x50,0x42,0x3a,0x4d,0x53,0x49,0x35,0x32,0x5c, + 0x67,0x5b,0x5e,0x60,0x57,0x5d,0x6a,0x6d,0x6b,0x64,0x62,0x66,0x76,0x7b,0x6e, + 0x70,0x76,0x6d,0x60,0x55,0x69,0x86,0x7e,0x77,0x7b,0x7b,0x7a,0x7d,0x7e,0x7b, + 0x7c,0x7f,0x7e,0x7f,0x82,0x7f,0x7b,0x7f,0x82,0x82,0x82,0x80,0x7e,0x80,0x86, + 0x84,0x82,0x86,0x86,0x81,0x83,0x86,0x88,0x86,0x83,0x86,0x88,0x88,0x86,0x83, + 0x85,0x86,0x87,0x80,0x74,0x71,0x73,0x79,0x7e,0x82,0x89,0x8d,0x8e,0x85,0x7b, + 0x86,0x8d,0x8a,0x8d,0x91,0x84,0x7b,0x77,0x7a,0x7f,0x7f,0x86,0x92,0x8f,0x87, + 0x89,0x8c,0x8f,0x8f,0x8d,0x8e,0x8c,0x86,0x92,0x9e,0xa0,0x6d,0x0e,0x00,0x12, + 0x82,0xac,0x94,0x9a,0x8b,0x42,0x13,0x03,0x15,0x45,0x9c,0xaa,0x86,0x86,0x8d, + 0x92,0x95,0x91,0x86,0x86,0x99,0x98,0x8d,0x91,0x95,0x94,0x92,0x91,0x93,0x97, + 0x99,0x98,0x96,0x91,0x90,0x93,0x96,0x9a,0xa9,0x7d,0x12,0x00,0x03,0x00,0x05, + 0x19,0x6b,0xb5,0xa0,0x93,0x96,0x96,0x95,0x95,0x95,0x97,0x96,0x96,0x98,0x98, + 0x96,0x95,0x94,0x95,0x95,0x95,0x97,0x98,0x98,0x96,0x93,0x93,0x93,0x94,0x96, + 0x98,0x9b,0x98,0x8b,0x8b,0x85,0x3c,0x08,0x07,0x03,0x00,0x02,0x03,0x02,0x01, + 0x01,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x03,0x07,0x08,0x07,0x02,0x00,0x02,0x01,0x01,0x03,0x05,0x07,0x07, + 0x06,0x04,0x04,0x04,0x06,0x11,0x2b,0x6a,0xb5,0xae,0x9b,0x98,0x98,0x9a,0x99, + 0x98,0x97,0x96,0x96,0x97,0x96,0x93,0x94,0x97,0x96,0x94,0x8f,0x91,0x95,0x91, + 0x8d,0x8e,0x8e,0x8d,0x8d,0x8b,0x8b,0x89,0x87,0x8d,0x8e,0x89,0x8b,0x8f,0x8a, + 0x97,0xac,0x7f,0x41,0x07,0x1c,0x71,0xa3,0xb7,0x9d,0x97,0xa3,0xa1,0x91,0x67, + 0x66,0x7a,0x49,0x20,0x28,0x2e,0x31,0x32,0x3c,0x57,0x45,0x20,0x32,0x5d,0x9c, + 0x9d,0x83,0xa0,0xa8,0x87,0x62,0x45,0x4f,0x69,0x8d,0x82,0x62,0x3a,0x48,0x91, + 0x93,0x7c,0x7f,0x8c,0x9d,0xa0,0x9c,0x96,0x8d,0xc8,0x06,0x05,0x01,0x02,0x06, + 0x09,0x0a,0x09,0x0b,0x11,0x19,0x22,0x2c,0x34,0x39,0x39,0x39,0x3c,0x36,0x2c, + 0x28,0x28,0x2f,0x2e,0x29,0x27,0x2b,0x3a,0x3a,0x33,0x2e,0x2f,0x37,0x3b,0x3a, + 0x2e,0x24,0x20,0x25,0x2f,0x34,0x3a,0x42,0x41,0x35,0x15,0x0a,0x19,0x0b,0x03, + 0x39,0x44,0x1b,0x1d,0x32,0x50,0x54,0x41,0x42,0x48,0x43,0x44,0x48,0x47,0x45, + 0x41,0x44,0x4b,0x4c,0x4c,0x50,0x47,0x3a,0x40,0x47,0x43,0x3d,0x39,0x41,0x48, + 0x45,0x44,0x42,0x3f,0x40,0x49,0x48,0x41,0x48,0x4c,0x49,0x4b,0x4d,0x49,0x4b, + 0x53,0x53,0x4d,0x45,0x4c,0x63,0x45,0x16,0x03,0x19,0x53,0x3b,0x0c,0x00,0x1b, + 0x53,0x4f,0x33,0x1b,0x1b,0x31,0x25,0x1b,0x30,0x32,0x20,0x23,0x2b,0x32,0x2f, + 0x28,0x4c,0x62,0x3c,0x30,0x3d,0x4e,0x5a,0x5c,0x5d,0x5e,0x60,0x63,0x66,0x48, + 0x23,0x5b,0x7b,0x53,0x36,0x2c,0x4a,0x57,0x40,0x2e,0x24,0x28,0x3d,0x62,0x57, + 0x3c,0x45,0x4d,0x50,0x58,0x61,0x5a,0x54,0x51,0x4f,0x4b,0x45,0x37,0x27,0x2a, + 0x36,0x41,0x45,0x42,0x51,0x54,0x2e,0x20,0x2d,0x3a,0x50,0x7a,0x70,0x3c,0x1e, + 0x25,0x69,0x7b,0x67,0x5a,0x52,0x55,0x63,0x74,0x73,0x67,0x54,0x57,0x65,0x70, + 0x74,0x71,0x6c,0x65,0x5e,0x5b,0x63,0x77,0x88,0x72,0x69,0x79,0x79,0x74,0x7e, + 0x80,0x76,0x78,0x7e,0x7a,0x7a,0x7f,0x7d,0x78,0x77,0x7b,0x82,0x81,0x7c,0x7d, + 0x7e,0x7e,0x7d,0x7d,0x7f,0x80,0x7f,0x82,0x84,0x81,0x7d,0x79,0x7e,0x7f,0x76, + 0x73,0x74,0x7d,0x84,0x83,0x7e,0x75,0x6f,0x65,0x57,0x69,0x87,0x79,0x75,0x90, + 0x8a,0x77,0x74,0x79,0x87,0x8d,0x8c,0x7b,0x6e,0x67,0x73,0x80,0x74,0x79,0x95, + 0x8a,0x75,0x7f,0x8c,0x95,0x8f,0x87,0x8b,0x8b,0x86,0x88,0x8e,0xa3,0x7a,0x1a, + 0x00,0x10,0x6d,0x8a,0x6d,0x65,0x5a,0x3f,0x20,0x06,0x0a,0x33,0x8d,0x9d,0x7a, + 0x7c,0x89,0x9c,0x92,0x70,0x36,0x30,0x84,0x9f,0x94,0x8d,0x8b,0x91,0x91,0x8e, + 0x90,0x92,0x93,0x8f,0x8b,0x8d,0x8f,0x8e,0x92,0x97,0xa5,0x7a,0x11,0x00,0x06, + 0x01,0x03,0x12,0x60,0xaa,0x9e,0x93,0x94,0x91,0x90,0x8f,0x90,0x92,0x93,0x93, + 0x93,0x92,0x91,0x91,0x92,0x95,0x95,0x93,0x91,0x92,0x96,0x95,0x90,0x92,0x95, + 0x97,0x92,0x8b,0x8e,0x97,0xa5,0xaa,0x9e,0x5e,0x27,0x0b,0x01,0x02,0x04,0x06, + 0x03,0x02,0x02,0x05,0x05,0x02,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x05,0x05,0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x02,0x00,0x00, + 0x00,0x04,0x07,0x05,0x00,0x00,0x18,0x48,0x90,0xaf,0xad,0x9b,0x8f,0x97,0x98, + 0x96,0x97,0x96,0x94,0x93,0x93,0x93,0x92,0x8f,0x91,0x94,0x93,0x91,0x8b,0x8e, + 0x92,0x8e,0x8a,0x87,0x86,0x84,0x7f,0x7b,0x76,0x76,0x77,0x71,0x6f,0x71,0x6e, + 0x69,0x64,0x73,0x90,0x72,0x40,0x0b,0x12,0x4d,0x8c,0xaa,0x7f,0x78,0x8b,0x6d, + 0x45,0x27,0x18,0x15,0x0e,0x0a,0x09,0x0a,0x0c,0x0e,0x12,0x16,0x0f,0x08,0x1f, + 0x41,0x68,0x55,0x34,0x7a,0x9f,0x7c,0x74,0x77,0x70,0x74,0x85,0x70,0x50,0x40, + 0x53,0x8c,0xa3,0xa9,0xad,0xac,0xa3,0x8a,0x6c,0x50,0x42,0xc8,0x03,0x03,0x01, + 0x01,0x03,0x02,0x00,0x00,0x00,0x05,0x0a,0x10,0x16,0x1d,0x20,0x21,0x20,0x21, + 0x1e,0x19,0x16,0x16,0x19,0x18,0x15,0x12,0x15,0x22,0x22,0x1b,0x17,0x18,0x1f, + 0x21,0x1f,0x16,0x0f,0x0e,0x12,0x16,0x1b,0x20,0x24,0x23,0x1b,0x08,0x00,0x07, + 0x03,0x06,0x26,0x28,0x07,0x15,0x32,0x48,0x43,0x28,0x2f,0x3a,0x2d,0x2b,0x34, + 0x3a,0x3f,0x42,0x44,0x45,0x3d,0x3b,0x48,0x48,0x40,0x46,0x4c,0x48,0x44,0x42, + 0x48,0x4c,0x47,0x45,0x46,0x47,0x49,0x4d,0x4c,0x49,0x4d,0x50,0x4c,0x52,0x57, + 0x4f,0x44,0x3a,0x46,0x56,0x4e,0x4f,0x5d,0x43,0x1c,0x08,0x17,0x47,0x32,0x0b, + 0x06,0x21,0x57,0x53,0x38,0x1e,0x1b,0x2b,0x28,0x28,0x45,0x40,0x1d,0x18,0x20, + 0x36,0x3f,0x40,0x50,0x56,0x3d,0x2c,0x29,0x49,0x63,0x5b,0x56,0x55,0x5a,0x5f, + 0x60,0x4a,0x32,0x5e,0x6d,0x35,0x2d,0x3e,0x3d,0x3a,0x39,0x2e,0x20,0x1e,0x35, + 0x68,0x57,0x30,0x3d,0x4c,0x55,0x58,0x57,0x4e,0x4c,0x52,0x51,0x4c,0x45,0x36, + 0x24,0x2b,0x37,0x36,0x3f,0x52,0x57,0x4e,0x31,0x1f,0x1d,0x3a,0x5a,0x6c,0x53, + 0x20,0x28,0x45,0x68,0x6c,0x5a,0x57,0x57,0x58,0x63,0x73,0x74,0x68,0x46,0x50, + 0x70,0x6d,0x68,0x6a,0x69,0x65,0x57,0x53,0x5d,0x73,0x84,0x71,0x68,0x74,0x74, + 0x72,0x76,0x78,0x78,0x78,0x79,0x76,0x78,0x7c,0x78,0x74,0x76,0x7a,0x7e,0x7b, + 0x78,0x7e,0x7f,0x79,0x79,0x7a,0x7b,0x7d,0x7f,0x7f,0x7f,0x7f,0x7b,0x77,0x78, + 0x75,0x68,0x64,0x69,0x74,0x7f,0x86,0x85,0x7b,0x6d,0x57,0x39,0x57,0x8d,0x6e, + 0x5e,0x7f,0x86,0x7c,0x69,0x69,0x83,0x8e,0x8a,0x73,0x5c,0x4d,0x65,0x83,0x74, + 0x74,0x8c,0x83,0x72,0x79,0x7e,0x7d,0x7d,0x7f,0x85,0x86,0x82,0x80,0x85,0xa3, + 0x82,0x2a,0x06,0x08,0x3a,0x48,0x34,0x38,0x3c,0x32,0x1d,0x06,0x05,0x26,0x7b, + 0x89,0x67,0x78,0x8f,0x9d,0x8a,0x5d,0x19,0x12,0x78,0x99,0x8f,0x89,0x86,0x8c, + 0x8d,0x8c,0x8b,0x8b,0x8d,0x8b,0x88,0x8d,0x8f,0x8a,0x8c,0x91,0x9f,0x75,0x0f, + 0x00,0x05,0x02,0x01,0x09,0x56,0xa0,0x99,0x90,0x8e,0x8c,0x8b,0x8d,0x8e,0x8e, + 0x91,0x91,0x8e,0x8d,0x8d,0x8d,0x8d,0x90,0x90,0x8e,0x8d,0x8d,0x93,0x91,0x8d, + 0x8e,0x90,0x91,0x8e,0x8a,0x8c,0x91,0x98,0x8a,0x6c,0x3d,0x19,0x05,0x03,0x08, + 0x06,0x03,0x03,0x03,0x04,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x01,0x05,0x05,0x02,0x00,0x00,0x05,0x05,0x01,0x02,0x03, + 0x02,0x02,0x03,0x04,0x03,0x00,0x07,0x20,0x51,0x7f,0x9c,0x9f,0x8f,0x86,0x85, + 0x8c,0x8e,0x8d,0x8e,0x8e,0x8b,0x8b,0x8c,0x8c,0x8b,0x89,0x8b,0x8d,0x8d,0x8b, + 0x8a,0x8a,0x8a,0x8d,0x8b,0x86,0x83,0x82,0x7e,0x7b,0x78,0x7a,0x7a,0x74,0x70, + 0x70,0x71,0x72,0x6b,0x78,0x91,0x79,0x4c,0x12,0x05,0x24,0x48,0x5c,0x3f,0x3a, + 0x48,0x31,0x17,0x0a,0x00,0x00,0x01,0x05,0x05,0x03,0x02,0x05,0x06,0x01,0x00, + 0x02,0x0e,0x1e,0x2f,0x20,0x0e,0x3f,0x5a,0x44,0x45,0x4e,0x49,0x54,0x74,0x5e, + 0x3d,0x4c,0x70,0xa3,0xa0,0x86,0x7f,0x71,0x5d,0x47,0x32,0x21,0x1a,0xc8,0x00, + 0x00,0x01,0x03,0x05,0x04,0x03,0x01,0x00,0x02,0x01,0x00,0x00,0x01,0x02,0x03, + 0x02,0x00,0x01,0x04,0x05,0x04,0x01,0x01,0x02,0x00,0x01,0x07,0x05,0x00,0x00, + 0x00,0x04,0x04,0x02,0x00,0x00,0x02,0x02,0x00,0x01,0x02,0x00,0x01,0x02,0x01, + 0x00,0x00,0x05,0x0a,0x0a,0x04,0x00,0x13,0x2c,0x30,0x23,0x0a,0x15,0x21,0x10, + 0x0d,0x19,0x26,0x32,0x3c,0x3d,0x34,0x26,0x21,0x36,0x42,0x45,0x49,0x4b,0x49, + 0x4b,0x4d,0x4e,0x4b,0x45,0x44,0x48,0x51,0x54,0x4e,0x4e,0x51,0x4e,0x4b,0x4a, + 0x53,0x5c,0x4f,0x38,0x1c,0x32,0x58,0x56,0x53,0x57,0x43,0x25,0x0d,0x11,0x30, + 0x22,0x0a,0x0c,0x23,0x4b,0x48,0x36,0x2a,0x23,0x22,0x2b,0x3a,0x58,0x4c,0x1b, + 0x0d,0x14,0x33,0x4a,0x56,0x4c,0x40,0x3f,0x2f,0x1b,0x48,0x6b,0x5c,0x51,0x4c, + 0x55,0x5a,0x57,0x52,0x4f,0x57,0x4e,0x25,0x32,0x51,0x2f,0x1a,0x28,0x24,0x1b, + 0x22,0x3d,0x6e,0x57,0x2b,0x3a,0x4e,0x5d,0x5a,0x50,0x42,0x41,0x4f,0x51,0x4f, + 0x4c,0x41,0x2d,0x3a,0x45,0x28,0x34,0x65,0x5c,0x45,0x42,0x32,0x1b,0x39,0x55, + 0x46,0x29,0x0e,0x3e,0x69,0x5c,0x4d,0x44,0x56,0x64,0x5a,0x5f,0x6d,0x73,0x66, + 0x3d,0x50,0x7b,0x6b,0x5b,0x60,0x68,0x6a,0x53,0x46,0x50,0x65,0x79,0x74,0x6d, + 0x6d,0x70,0x73,0x6d,0x6d,0x78,0x77,0x71,0x72,0x74,0x78,0x74,0x6f,0x77,0x79, + 0x75,0x73,0x74,0x7d,0x7d,0x75,0x75,0x78,0x79,0x7b,0x7d,0x7a,0x78,0x7d,0x7d, + 0x77,0x74,0x6d,0x5d,0x57,0x5d,0x6b,0x7b,0x87,0x88,0x7f,0x69,0x4c,0x24,0x4b, + 0x8d,0x69,0x50,0x68,0x7b,0x82,0x65,0x5e,0x80,0x8c,0x86,0x69,0x4b,0x32,0x54, + 0x83,0x78,0x73,0x7e,0x7d,0x77,0x71,0x66,0x58,0x64,0x75,0x7a,0x7b,0x7b,0x79, + 0x7f,0x9f,0x86,0x3b,0x13,0x01,0x07,0x08,0x06,0x22,0x36,0x25,0x13,0x04,0x03, + 0x1d,0x69,0x77,0x5b,0x78,0x95,0x9b,0x81,0x51,0x16,0x14,0x71,0x8f,0x86,0x85, + 0x85,0x85,0x86,0x89,0x86,0x85,0x89,0x89,0x88,0x8d,0x8d,0x86,0x86,0x8b,0x98, + 0x71,0x0f,0x00,0x03,0x02,0x00,0x01,0x4c,0x98,0x93,0x8b,0x89,0x86,0x86,0x8d, + 0x8d,0x8a,0x8c,0x8d,0x8a,0x89,0x8a,0x88,0x88,0x8a,0x8a,0x88,0x89,0x8b,0x8d, + 0x8d,0x8a,0x89,0x88,0x87,0x8a,0x8f,0x8e,0x85,0x72,0x52,0x2b,0x12,0x03,0x00, + 0x05,0x0d,0x06,0x00,0x02,0x04,0x06,0x02,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x04,0x04,0x02,0x02,0x07,0x06,0x00, + 0x02,0x04,0x05,0x07,0x09,0x06,0x02,0x00,0x1d,0x56,0x8a,0x9f,0x7c,0x6b,0x69, + 0x71,0x78,0x7b,0x7d,0x7f,0x81,0x81,0x7f,0x7f,0x82,0x81,0x81,0x80,0x82,0x85, + 0x84,0x84,0x86,0x84,0x82,0x8a,0x8b,0x85,0x83,0x83,0x82,0x82,0x84,0x85,0x84, + 0x82,0x7f,0x79,0x82,0x89,0x80,0x87,0x99,0x7e,0x4e,0x15,0x00,0x01,0x02,0x02, + 0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0a,0x09,0x09,0x0c,0x0a,0x06,0x07,0x08, + 0x02,0x03,0x07,0x04,0x01,0x00,0x00,0x03,0x07,0x09,0x04,0x04,0x07,0x0a,0x24, + 0x59,0x48,0x28,0x4e,0x7f,0xac,0x85,0x41,0x2c,0x19,0x03,0x00,0x00,0x07,0x07, + 0xc8,0x01,0x01,0x01,0x02,0x02,0x01,0x00,0x01,0x02,0x03,0x03,0x03,0x02,0x01, + 0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x03,0x07,0x06,0x03,0x00,0x00,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x01,0x00,0x00,0x01,0x00,0x00, + 0x03,0x01,0x01,0x03,0x03,0x03,0x06,0x04,0x00,0x06,0x0e,0x10,0x0c,0x05,0x08, + 0x0b,0x03,0x04,0x0c,0x0e,0x0f,0x15,0x17,0x15,0x0e,0x0b,0x15,0x1d,0x24,0x29, + 0x2d,0x2e,0x30,0x32,0x33,0x30,0x27,0x25,0x2a,0x3a,0x41,0x33,0x33,0x38,0x2d, + 0x25,0x2a,0x32,0x36,0x29,0x1a,0x11,0x21,0x3c,0x42,0x4d,0x62,0x50,0x2f,0x0f, + 0x06,0x13,0x0e,0x04,0x08,0x13,0x24,0x23,0x20,0x2b,0x26,0x13,0x22,0x37,0x40, + 0x2f,0x0a,0x0c,0x1c,0x2c,0x2d,0x24,0x37,0x48,0x43,0x37,0x2c,0x3f,0x53,0x5c, + 0x5c,0x59,0x61,0x5c,0x3d,0x3c,0x4a,0x42,0x3a,0x37,0x46,0x53,0x2b,0x11,0x1c, + 0x17,0x12,0x2a,0x42,0x53,0x3e,0x27,0x50,0x59,0x31,0x41,0x60,0x53,0x45,0x3d, + 0x4c,0x5c,0x57,0x3d,0x18,0x33,0x52,0x2c,0x2b,0x52,0x53,0x48,0x48,0x37,0x1e, + 0x20,0x2c,0x3e,0x3d,0x2f,0x3e,0x4a,0x3f,0x3c,0x43,0x56,0x5e,0x48,0x55,0x74, + 0x69,0x55,0x40,0x50,0x6e,0x5e,0x53,0x62,0x67,0x62,0x40,0x35,0x50,0x5a,0x5d, + 0x69,0x6e,0x6b,0x6f,0x74,0x70,0x6c,0x69,0x69,0x69,0x6d,0x6f,0x70,0x72,0x70, + 0x66,0x65,0x6d,0x73,0x76,0x74,0x70,0x6d,0x6e,0x71,0x76,0x74,0x6e,0x6e,0x70, + 0x76,0x76,0x72,0x74,0x6e,0x58,0x48,0x45,0x62,0x7b,0x7b,0x74,0x6a,0x63,0x51, + 0x2b,0x45,0x7b,0x73,0x66,0x67,0x6d,0x73,0x65,0x65,0x7e,0x7d,0x6d,0x59,0x42, + 0x2b,0x4b,0x7a,0x7f,0x7b,0x76,0x7d,0x80,0x65,0x4c,0x3d,0x55,0x70,0x62,0x60, + 0x6b,0x6f,0x78,0x97,0x88,0x4d,0x20,0x03,0x07,0x12,0x25,0x58,0x6e,0x35,0x0f, + 0x02,0x02,0x1f,0x66,0x7e,0x71,0x76,0x82,0x99,0x7f,0x44,0x12,0x18,0x70,0x8d, + 0x83,0x83,0x82,0x82,0x81,0x80,0x83,0x82,0x7c,0x7d,0x81,0x86,0x85,0x7f,0x85, + 0x8e,0x98,0x70,0x12,0x00,0x02,0x03,0x00,0x00,0x46,0x92,0x8e,0x87,0x85,0x84, + 0x84,0x83,0x84,0x84,0x7d,0x7a,0x86,0x8a,0x84,0x83,0x83,0x87,0x86,0x84,0x88, + 0x8a,0x85,0x83,0x84,0x84,0x84,0x82,0x89,0x90,0x87,0x6b,0x36,0x36,0x50,0x45, + 0x2f,0x12,0x06,0x04,0x03,0x04,0x06,0x04,0x03,0x05,0x05,0x01,0x00,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x07, + 0x07,0x02,0x03,0x05,0x03,0x01,0x00,0x00,0x03,0x21,0x4a,0x73,0x74,0x6b,0x62, + 0x5c,0x58,0x5a,0x5e,0x61,0x64,0x65,0x69,0x69,0x69,0x6b,0x6d,0x6e,0x70,0x71, + 0x74,0x77,0x76,0x78,0x7d,0x7e,0x7d,0x82,0x86,0x84,0x82,0x82,0x86,0x86,0x81, + 0x7e,0x7d,0x7e,0x81,0x84,0x86,0x85,0x75,0x7a,0x8b,0x57,0x1d,0x08,0x02,0x05, + 0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x08,0x0b,0x09,0x07,0x05,0x08,0x06,0x02, + 0x03,0x04,0x02,0x03,0x05,0x03,0x01,0x00,0x03,0x09,0x02,0x00,0x03,0x04,0x04, + 0x01,0x0c,0x28,0x23,0x16,0x25,0x37,0x46,0x32,0x13,0x0a,0x03,0x00,0x00,0x02, + 0x00,0x00,0xc8,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x04,0x04, + 0x04,0x03,0x01,0x00,0x02,0x06,0x04,0x00,0x00,0x02,0x08,0x08,0x04,0x03,0x02, + 0x00,0x01,0x03,0x02,0x01,0x01,0x01,0x03,0x03,0x04,0x04,0x03,0x00,0x02,0x03, + 0x02,0x03,0x04,0x01,0x02,0x05,0x03,0x00,0x03,0x06,0x03,0x00,0x00,0x00,0x00, + 0x03,0x03,0x01,0x00,0x02,0x07,0x03,0x00,0x00,0x00,0x01,0x03,0x03,0x01,0x04, + 0x0a,0x0e,0x13,0x15,0x18,0x19,0x19,0x15,0x0f,0x0d,0x0f,0x1f,0x25,0x19,0x19, + 0x1d,0x11,0x0a,0x10,0x14,0x15,0x0c,0x07,0x0b,0x13,0x1d,0x26,0x37,0x51,0x45, + 0x28,0x0c,0x00,0x03,0x02,0x02,0x06,0x08,0x09,0x09,0x0e,0x20,0x1e,0x0a,0x15, + 0x24,0x20,0x12,0x00,0x0d,0x1d,0x1e,0x13,0x03,0x28,0x47,0x3d,0x36,0x36,0x39, + 0x40,0x4a,0x52,0x59,0x65,0x5d,0x2f,0x2c,0x43,0x3d,0x3a,0x40,0x50,0x59,0x2f, + 0x14,0x1a,0x13,0x0e,0x2f,0x41,0x35,0x26,0x23,0x56,0x58,0x19,0x30,0x60,0x5e, + 0x4e,0x37,0x4c,0x64,0x53,0x36,0x16,0x31,0x50,0x3a,0x2d,0x32,0x43,0x52,0x50, + 0x41,0x29,0x1a,0x1a,0x31,0x41,0x48,0x3a,0x2f,0x3b,0x41,0x44,0x53,0x5a,0x48, + 0x57,0x75,0x5d,0x45,0x47,0x53,0x5f,0x57,0x53,0x61,0x5e,0x52,0x3a,0x38,0x58, + 0x57,0x48,0x58,0x66,0x6c,0x70,0x70,0x6a,0x65,0x62,0x63,0x66,0x6c,0x6a,0x61, + 0x69,0x70,0x62,0x5b,0x5e,0x69,0x72,0x6c,0x69,0x6c,0x6e,0x70,0x76,0x71,0x64, + 0x65,0x6b,0x6d,0x6f,0x6e,0x6d,0x67,0x57,0x43,0x36,0x5a,0x74,0x63,0x5a,0x57, + 0x5f,0x5a,0x36,0x46,0x6e,0x71,0x69,0x5e,0x62,0x6b,0x65,0x69,0x7d,0x76,0x61, + 0x4e,0x3a,0x25,0x41,0x6c,0x7f,0x7f,0x6d,0x6d,0x6b,0x4a,0x32,0x2b,0x49,0x66, + 0x52,0x50,0x67,0x6a,0x70,0x8e,0x87,0x5b,0x28,0x04,0x08,0x16,0x2f,0x66,0x7c, + 0x35,0x0b,0x01,0x03,0x1c,0x57,0x75,0x7b,0x73,0x76,0x96,0x7b,0x3c,0x10,0x19, + 0x71,0x8c,0x81,0x81,0x80,0x7f,0x7c,0x7b,0x7f,0x7f,0x7d,0x7f,0x82,0x7f,0x7b, + 0x78,0x82,0x8d,0x95,0x6d,0x12,0x00,0x01,0x03,0x00,0x00,0x42,0x8d,0x8b,0x84, + 0x80,0x81,0x82,0x7e,0x7f,0x82,0x70,0x68,0x83,0x8a,0x7e,0x7d,0x80,0x82,0x82, + 0x7f,0x83,0x86,0x7f,0x7d,0x7f,0x7f,0x7f,0x7e,0x83,0x89,0x82,0x69,0x36,0x3d, + 0x5e,0x5b,0x44,0x18,0x03,0x00,0x01,0x04,0x07,0x03,0x00,0x05,0x07,0x01,0x00, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x03, + 0x05,0x04,0x03,0x02,0x02,0x03,0x02,0x06,0x0e,0x19,0x2f,0x54,0x71,0x7f,0x69, + 0x56,0x5f,0x61,0x5c,0x5b,0x5b,0x5d,0x5e,0x61,0x62,0x62,0x62,0x62,0x64,0x63, + 0x65,0x68,0x69,0x69,0x69,0x6c,0x71,0x74,0x76,0x78,0x7b,0x7c,0x7b,0x78,0x7d, + 0x7e,0x7a,0x7a,0x7c,0x83,0x87,0x86,0x74,0x5e,0x50,0x53,0x61,0x2f,0x00,0x01, + 0x07,0x08,0x04,0x03,0x09,0x0a,0x07,0x03,0x03,0x0a,0x0a,0x07,0x04,0x03,0x04, + 0x03,0x00,0x02,0x04,0x03,0x03,0x04,0x05,0x04,0x02,0x07,0x0d,0x05,0x01,0x06, + 0x07,0x07,0x03,0x03,0x08,0x0b,0x0b,0x07,0x04,0x02,0x01,0x00,0x00,0x00,0x03, + 0x05,0x06,0x03,0x01,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x02, + 0x01,0x01,0x00,0x01,0x03,0x02,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02, + 0x03,0x03,0x00,0x01,0x05,0x03,0x01,0x01,0x04,0x07,0x05,0x03,0x02,0x02,0x03, + 0x01,0x02,0x06,0x03,0x00,0x01,0x03,0x03,0x02,0x01,0x00,0x02,0x07,0x06,0x02, + 0x01,0x00,0x00,0x04,0x07,0x03,0x01,0x05,0x07,0x07,0x03,0x01,0x01,0x05,0x07, + 0x03,0x02,0x03,0x03,0x05,0x07,0x09,0x08,0x04,0x03,0x05,0x04,0x02,0x04,0x06, + 0x07,0x06,0x04,0x04,0x05,0x06,0x04,0x03,0x03,0x05,0x07,0x06,0x04,0x07,0x0f, + 0x1d,0x19,0x0c,0x04,0x01,0x03,0x02,0x02,0x07,0x08,0x04,0x03,0x03,0x07,0x0a, + 0x08,0x06,0x04,0x03,0x03,0x04,0x0c,0x12,0x0a,0x07,0x0b,0x23,0x33,0x28,0x27, + 0x2f,0x38,0x37,0x23,0x2a,0x44,0x5b,0x5a,0x31,0x2c,0x41,0x51,0x50,0x33,0x44, + 0x62,0x3d,0x21,0x24,0x1b,0x14,0x2d,0x35,0x1e,0x16,0x1d,0x41,0x48,0x25,0x2e, + 0x48,0x5c,0x5a,0x42,0x53,0x63,0x3f,0x2c,0x32,0x37,0x3e,0x4c,0x39,0x0c,0x30, + 0x5e,0x5f,0x51,0x3a,0x32,0x2b,0x17,0x24,0x46,0x33,0x2b,0x5a,0x5d,0x41,0x4f, + 0x5e,0x63,0x6a,0x6f,0x50,0x3d,0x53,0x57,0x53,0x57,0x5a,0x5b,0x4d,0x3d,0x47, + 0x57,0x66,0x5a,0x44,0x45,0x55,0x70,0x71,0x65,0x55,0x54,0x66,0x6c,0x6d,0x73, + 0x67,0x4b,0x57,0x6d,0x70,0x61,0x44,0x52,0x69,0x68,0x6a,0x71,0x75,0x78,0x7b, + 0x73,0x64,0x63,0x66,0x65,0x69,0x6d,0x5f,0x54,0x58,0x4b,0x38,0x55,0x64,0x43, + 0x3c,0x49,0x5e,0x61,0x41,0x4d,0x6d,0x5e,0x4d,0x4a,0x5b,0x71,0x66,0x66,0x7d, + 0x7b,0x67,0x49,0x2e,0x1b,0x32,0x5a,0x77,0x7b,0x62,0x48,0x30,0x20,0x1a,0x20, + 0x3e,0x59,0x4c,0x54,0x72,0x6d,0x67,0x84,0x84,0x64,0x2d,0x01,0x03,0x05,0x0a, + 0x33,0x49,0x1d,0x04,0x02,0x03,0x11,0x32,0x53,0x6f,0x70,0x74,0x91,0x77,0x3c, + 0x0e,0x16,0x72,0x8d,0x80,0x7f,0x7d,0x7a,0x7b,0x7d,0x78,0x7c,0x8d,0x92,0x8d, + 0x7b,0x71,0x74,0x7b,0x85,0x8d,0x68,0x12,0x00,0x03,0x04,0x01,0x00,0x3f,0x84, + 0x88,0x82,0x7b,0x7b,0x7f,0x7c,0x7f,0x82,0x69,0x5c,0x7f,0x87,0x75,0x78,0x7c, + 0x7b,0x78,0x74,0x7a,0x7e,0x7c,0x7b,0x7b,0x7b,0x7b,0x7b,0x79,0x78,0x80,0x87, + 0x89,0x69,0x3c,0x3c,0x31,0x0a,0x00,0x02,0x00,0x00,0x03,0x02,0x00,0x00,0x01, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x03, + 0x07,0x12,0x17,0x03,0x00,0x00,0x00,0x00,0x03,0x19,0x3d,0x69,0x8a,0x91,0x8b, + 0x7d,0x7b,0x7a,0x79,0x78,0x77,0x78,0x78,0x74,0x74,0x74,0x74,0x71,0x6d,0x6b, + 0x69,0x65,0x63,0x65,0x64,0x61,0x61,0x62,0x63,0x68,0x6c,0x6a,0x69,0x6b,0x68, + 0x64,0x65,0x69,0x71,0x7b,0x86,0x96,0x95,0x7c,0x46,0x15,0x0f,0x12,0x19,0x0c, + 0x00,0x05,0x06,0x02,0x00,0x00,0x03,0x05,0x06,0x07,0x06,0x03,0x02,0x03,0x04, + 0x04,0x04,0x03,0x02,0x05,0x07,0x06,0x04,0x03,0x06,0x07,0x04,0x06,0x08,0x07, + 0x04,0x00,0x02,0x06,0x09,0x08,0x03,0x05,0x0a,0x03,0x00,0x02,0x08,0x0d,0x07, + 0x03,0x04,0x02,0x01,0x09,0x0a,0xc8,0x00,0x00,0x01,0x01,0x00,0x01,0x02,0x03, + 0x03,0x01,0x00,0x00,0x00,0x01,0x02,0x01,0x01,0x01,0x01,0x02,0x01,0x00,0x00, + 0x00,0x00,0x02,0x03,0x01,0x02,0x03,0x02,0x00,0x02,0x03,0x04,0x03,0x02,0x02, + 0x02,0x02,0x02,0x02,0x03,0x03,0x02,0x02,0x02,0x01,0x01,0x02,0x03,0x03,0x05, + 0x04,0x03,0x01,0x01,0x02,0x03,0x05,0x03,0x03,0x02,0x05,0x07,0x03,0x01,0x00, + 0x03,0x06,0x04,0x03,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x02, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x03,0x01,0x00,0x00,0x02,0x04,0x02,0x00, + 0x00,0x01,0x06,0x04,0x01,0x07,0x10,0x19,0x0e,0x00,0x03,0x05,0x03,0x01,0x00, + 0x00,0x02,0x05,0x02,0x00,0x00,0x00,0x03,0x07,0x07,0x03,0x04,0x0c,0x14,0x19, + 0x19,0x1a,0x1e,0x29,0x2b,0x19,0x19,0x2b,0x48,0x4f,0x2d,0x28,0x37,0x55,0x57, + 0x28,0x2c,0x48,0x3a,0x2a,0x25,0x1f,0x1b,0x28,0x2a,0x1a,0x15,0x1b,0x32,0x3d, + 0x34,0x31,0x36,0x4d,0x56,0x4c,0x4f,0x50,0x32,0x31,0x4c,0x49,0x41,0x43,0x2f, + 0x0a,0x27,0x4d,0x50,0x4f,0x48,0x39,0x25,0x0b,0x0f,0x28,0x1d,0x19,0x40,0x3f, + 0x26,0x38,0x4f,0x5b,0x65,0x67,0x51,0x43,0x4f,0x52,0x50,0x57,0x5c,0x5e,0x50, + 0x3f,0x47,0x4e,0x4c,0x4d,0x4f,0x48,0x52,0x70,0x6d,0x59,0x4d,0x53,0x6c,0x76, + 0x75,0x67,0x57,0x49,0x50,0x5e,0x6a,0x5e,0x3d,0x4c,0x67,0x77,0x79,0x70,0x6f, + 0x6d,0x69,0x67,0x65,0x5e,0x5a,0x64,0x6a,0x6b,0x60,0x55,0x53,0x45,0x36,0x50, + 0x5c,0x3a,0x2f,0x3a,0x50,0x57,0x3d,0x45,0x5a,0x50,0x45,0x3e,0x57,0x79,0x69, + 0x62,0x75,0x74,0x64,0x41,0x24,0x15,0x27,0x46,0x57,0x55,0x3f,0x2b,0x1c,0x15, + 0x15,0x1c,0x30,0x45,0x4c,0x54,0x60,0x63,0x6c,0x89,0x8d,0x73,0x34,0x00,0x00, + 0x00,0x01,0x2d,0x45,0x19,0x04,0x04,0x03,0x0a,0x1e,0x3d,0x5f,0x63,0x6a,0x8a, + 0x6d,0x2c,0x09,0x19,0x6e,0x86,0x77,0x74,0x74,0x76,0x75,0x75,0x7b,0x7b,0x70, + 0x70,0x74,0x7d,0x7b,0x6d,0x70,0x7b,0x88,0x65,0x10,0x00,0x06,0x04,0x00,0x00, + 0x3a,0x7b,0x86,0x81,0x73,0x73,0x77,0x78,0x79,0x78,0x62,0x58,0x77,0x7e,0x70, + 0x7b,0x86,0x80,0x7b,0x76,0x73,0x73,0x76,0x78,0x78,0x75,0x74,0x78,0x78,0x75, + 0x78,0x78,0x72,0x53,0x29,0x1f,0x1c,0x1a,0x10,0x03,0x01,0x02,0x04,0x03,0x00, + 0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02, + 0x03,0x02,0x05,0x3a,0x63,0x49,0x33,0x28,0x2c,0x37,0x43,0x56,0x6e,0x86,0x94, + 0x8f,0x85,0x78,0x7b,0x80,0x80,0x7e,0x7b,0x7c,0x7d,0x7b,0x79,0x79,0x76,0x72, + 0x6e,0x6b,0x68,0x64,0x63,0x67,0x65,0x62,0x62,0x62,0x5d,0x5c,0x5c,0x5b,0x5a, + 0x59,0x5e,0x65,0x62,0x65,0x72,0x70,0x68,0x63,0x5b,0x4d,0x24,0x00,0x00,0x00, + 0x00,0x00,0x03,0x06,0x05,0x01,0x00,0x01,0x02,0x02,0x03,0x04,0x03,0x03,0x02, + 0x02,0x02,0x03,0x03,0x02,0x01,0x03,0x04,0x03,0x03,0x04,0x03,0x03,0x03,0x03, + 0x03,0x05,0x04,0x01,0x02,0x04,0x07,0x05,0x00,0x03,0x07,0x01,0x00,0x02,0x07, + 0x0a,0x05,0x03,0x03,0x01,0x02,0x08,0x09,0xc8,0x00,0x00,0x02,0x03,0x02,0x02, + 0x02,0x03,0x02,0x01,0x01,0x01,0x02,0x02,0x01,0x00,0x01,0x03,0x03,0x02,0x00, + 0x00,0x02,0x01,0x00,0x00,0x02,0x03,0x03,0x01,0x00,0x00,0x02,0x01,0x00,0x00, + 0x00,0x03,0x02,0x00,0x03,0x03,0x00,0x02,0x06,0x03,0x00,0x00,0x00,0x02,0x07, + 0x06,0x00,0x00,0x02,0x00,0x02,0x05,0x02,0x00,0x04,0x03,0x00,0x00,0x02,0x01, + 0x01,0x00,0x00,0x01,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x06,0x00, + 0x02,0x07,0x04,0x00,0x00,0x03,0x07,0x02,0x00,0x03,0x03,0x01,0x00,0x00,0x02, + 0x02,0x02,0x01,0x01,0x00,0x00,0x01,0x0e,0x1f,0x2f,0x1b,0x00,0x00,0x02,0x03, + 0x03,0x01,0x00,0x01,0x03,0x02,0x02,0x03,0x03,0x02,0x00,0x00,0x02,0x06,0x0a, + 0x04,0x03,0x0e,0x0f,0x0b,0x15,0x1d,0x19,0x14,0x14,0x2d,0x39,0x23,0x1e,0x28, + 0x48,0x4c,0x1b,0x12,0x21,0x29,0x29,0x1f,0x1d,0x1d,0x1e,0x1d,0x1b,0x18,0x19, + 0x23,0x2f,0x39,0x2f,0x25,0x36,0x45,0x4c,0x41,0x32,0x28,0x34,0x56,0x53,0x42, + 0x2b,0x1b,0x15,0x20,0x2c,0x32,0x3d,0x48,0x30,0x14,0x07,0x03,0x05,0x03,0x06, + 0x12,0x0f,0x06,0x1c,0x33,0x40,0x4c,0x55,0x4e,0x45,0x3e,0x41,0x48,0x4c,0x50, + 0x58,0x50,0x41,0x3a,0x2f,0x23,0x37,0x55,0x50,0x53,0x69,0x5e,0x46,0x44,0x4e, + 0x62,0x70,0x6e,0x4c,0x3d,0x48,0x46,0x45,0x52,0x4e,0x38,0x46,0x61,0x7b,0x7b, + 0x61,0x57,0x52,0x48,0x4d,0x5c,0x4d,0x44,0x5a,0x65,0x65,0x66,0x5f,0x48,0x38, + 0x34,0x48,0x52,0x3b,0x2f,0x2d,0x3a,0x3f,0x30,0x33,0x40,0x43,0x41,0x3a,0x53, + 0x74,0x60,0x55,0x62,0x62,0x54,0x33,0x1a,0x12,0x1f,0x31,0x2f,0x27,0x18,0x15, + 0x19,0x1c,0x1b,0x18,0x21,0x31,0x45,0x4c,0x45,0x57,0x6f,0x82,0x88,0x7c,0x3d, + 0x03,0x01,0x03,0x0d,0x41,0x5a,0x20,0x05,0x06,0x02,0x05,0x17,0x2f,0x49,0x4f, + 0x5c,0x82,0x60,0x17,0x03,0x1d,0x69,0x7c,0x6e,0x6d,0x6f,0x72,0x6e,0x6b,0x81, + 0x78,0x41,0x36,0x4b,0x7b,0x8a,0x6a,0x69,0x74,0x84,0x63,0x0e,0x00,0x08,0x03, + 0x00,0x00,0x35,0x70,0x82,0x7f,0x6c,0x6b,0x70,0x75,0x73,0x69,0x5d,0x5a,0x70, + 0x76,0x70,0x7c,0x85,0x7b,0x78,0x7c,0x71,0x6a,0x70,0x75,0x77,0x72,0x70,0x74, + 0x78,0x78,0x6f,0x5a,0x36,0x28,0x26,0x10,0x12,0x3b,0x2b,0x03,0x02,0x04,0x05, + 0x03,0x00,0x02,0x03,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x02,0x02,0x00,0x01,0x57,0xa6,0x96,0x7a,0x5e,0x66,0x7a,0x88,0x8f,0x8e, + 0x82,0x77,0x72,0x70,0x70,0x73,0x78,0x7b,0x78,0x72,0x74,0x77,0x76,0x75,0x74, + 0x70,0x6d,0x69,0x67,0x65,0x62,0x64,0x69,0x69,0x65,0x67,0x65,0x5c,0x57,0x54, + 0x56,0x55,0x50,0x5b,0x69,0x64,0x64,0x6b,0x57,0x38,0x1b,0x10,0x16,0x0e,0x03, + 0x04,0x03,0x00,0x02,0x05,0x05,0x03,0x02,0x03,0x03,0x03,0x01,0x00,0x00,0x00, + 0x04,0x04,0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x04,0x01,0x00, + 0x01,0x02,0x01,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x02,0x03,0x04,0x02,0x01, + 0x03,0x03,0x01,0x01,0x01,0x00,0x02,0x03,0x04,0x03,0xc8,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x02, + 0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x01,0x01,0x00,0x01,0x02,0x00,0x01,0x03,0x01,0x00,0x00,0x00, + 0x01,0x03,0x02,0x00,0x00,0x01,0x00,0x01,0x02,0x01,0x00,0x03,0x03,0x01,0x01, + 0x01,0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x00,0x00,0x01,0x00,0x00,0x00,0x03, + 0x03,0x00,0x01,0x03,0x02,0x00,0x00,0x01,0x03,0x01,0x00,0x02,0x02,0x01,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x03,0x09,0x11,0x18,0x0e,0x00,0x00, + 0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x02,0x02,0x01,0x00,0x00,0x01, + 0x03,0x03,0x02,0x01,0x05,0x06,0x03,0x07,0x0a,0x0a,0x0a,0x08,0x10,0x14,0x0e, + 0x0c,0x0f,0x1a,0x1b,0x0a,0x07,0x0a,0x0e,0x0f,0x0c,0x0c,0x0c,0x0b,0x0a,0x0a, + 0x0a,0x0a,0x0d,0x12,0x16,0x12,0x0e,0x20,0x2d,0x31,0x25,0x16,0x0f,0x19,0x34, + 0x2f,0x1d,0x0e,0x07,0x0a,0x0c,0x0e,0x10,0x15,0x19,0x12,0x08,0x04,0x02,0x02, + 0x03,0x03,0x06,0x05,0x03,0x0b,0x13,0x17,0x1c,0x20,0x20,0x1f,0x1c,0x1c,0x1d, + 0x1d,0x1e,0x27,0x24,0x1a,0x15,0x10,0x0b,0x19,0x31,0x3f,0x4a,0x50,0x3d,0x24, + 0x21,0x24,0x29,0x2c,0x2b,0x1e,0x19,0x1d,0x1c,0x1a,0x1e,0x1d,0x19,0x28,0x3a, + 0x43,0x3c,0x26,0x1d,0x1b,0x1a,0x1e,0x24,0x1e,0x1a,0x21,0x35,0x53,0x6e,0x6c, + 0x30,0x25,0x3d,0x36,0x31,0x3c,0x3c,0x34,0x27,0x1b,0x14,0x20,0x34,0x2c,0x2c, + 0x42,0x46,0x3e,0x32,0x2e,0x38,0x36,0x2d,0x19,0x0f,0x14,0x19,0x1e,0x19,0x14, + 0x0d,0x0a,0x0e,0x21,0x22,0x10,0x17,0x24,0x20,0x2a,0x42,0x54,0x58,0x3b,0x42, + 0x66,0x45,0x17,0x02,0x0a,0x2e,0x67,0x78,0x24,0x00,0x03,0x00,0x06,0x20,0x26, + 0x20,0x2e,0x4b,0x80,0x5d,0x0a,0x00,0x19,0x69,0x7f,0x74,0x7e,0x80,0x72,0x69, + 0x66,0x7a,0x69,0x24,0x0f,0x24,0x6b,0x90,0x7d,0x7d,0x81,0x84,0x5f,0x0e,0x00, + 0x04,0x07,0x03,0x00,0x30,0x68,0x77,0x75,0x6a,0x6d,0x75,0x7c,0x76,0x65,0x5b, + 0x5f,0x7a,0x86,0x82,0x67,0x4c,0x3d,0x55,0x84,0x82,0x75,0x72,0x75,0x7b,0x7b, + 0x76,0x6e,0x70,0x78,0x74,0x5e,0x2f,0x2e,0x45,0x36,0x3a,0x62,0x3f,0x02,0x00, + 0x03,0x03,0x03,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01, + 0x01,0x02,0x03,0x03,0x01,0x00,0x02,0x2c,0x5f,0x86,0x8f,0x80,0x7c,0x79,0x71, + 0x70,0x75,0x6f,0x68,0x66,0x65,0x64,0x6a,0x6f,0x6d,0x6a,0x68,0x6c,0x70,0x6e, + 0x6d,0x6a,0x69,0x68,0x69,0x67,0x63,0x64,0x65,0x66,0x63,0x5f,0x62,0x62,0x60, + 0x65,0x6f,0x78,0x77,0x6c,0x5f,0x54,0x5a,0x50,0x36,0x23,0x14,0x07,0x03,0x07, + 0x05,0x03,0x03,0x03,0x01,0x03,0x03,0x03,0x02,0x00,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x02,0x02,0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x02, + 0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x02,0x01,0x01,0x02,0x02,0x03, + 0x02,0x02,0x03,0x02,0x01,0x01,0x01,0x00,0x01,0x02,0x02,0x01,0xc8,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02, + 0x02,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x03,0x04,0x05,0x05,0x03, + 0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x00,0x01,0x02,0x01,0x01,0x01,0x00,0x00,0x02,0x03,0x03,0x00, + 0x00,0x00,0x01,0x01,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x03,0x0f,0x16,0x16,0x0e,0x05,0x00, + 0x07,0x16,0x0f,0x03,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x02,0x03, + 0x03,0x03,0x03,0x04,0x03,0x03,0x05,0x03,0x01,0x00,0x00,0x00,0x03,0x05,0x05, + 0x03,0x02,0x00,0x00,0x06,0x05,0x00,0x01,0x02,0x02,0x07,0x12,0x26,0x32,0x2e, + 0x1e,0x0b,0x09,0x07,0x03,0x01,0x00,0x03,0x04,0x03,0x03,0x02,0x01,0x01,0x04, + 0x0f,0x19,0x15,0x0d,0x02,0x00,0x00,0x01,0x02,0x01,0x03,0x03,0x00,0x12,0x35, + 0x55,0x56,0x19,0x13,0x31,0x21,0x19,0x34,0x39,0x2c,0x16,0x06,0x05,0x16,0x2d, + 0x22,0x20,0x37,0x2d,0x15,0x0e,0x10,0x17,0x16,0x10,0x07,0x07,0x12,0x12,0x0f, + 0x0b,0x09,0x08,0x05,0x07,0x1b,0x1e,0x0b,0x0f,0x15,0x07,0x15,0x3d,0x47,0x39, + 0x0b,0x14,0x4d,0x45,0x28,0x06,0x0d,0x39,0x6a,0x73,0x20,0x00,0x02,0x00,0x08, + 0x25,0x23,0x0e,0x21,0x44,0x74,0x52,0x04,0x00,0x1c,0x71,0x82,0x6d,0x73,0x71, + 0x5e,0x5a,0x5f,0x71,0x5d,0x13,0x00,0x0b,0x4a,0x72,0x72,0x73,0x71,0x73,0x52, + 0x0d,0x00,0x02,0x07,0x04,0x00,0x2c,0x62,0x74,0x77,0x6d,0x6c,0x6f,0x78,0x72, + 0x62,0x5a,0x5d,0x74,0x78,0x69,0x42,0x20,0x11,0x2f,0x67,0x6f,0x6a,0x66,0x65, + 0x65,0x63,0x5d,0x4f,0x57,0x6a,0x78,0x67,0x2b,0x25,0x3f,0x46,0x53,0x6f,0x44, + 0x00,0x00,0x03,0x01,0x02,0x03,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x01,0x02,0x02,0x03,0x02,0x03,0x06,0x0c,0x20,0x53,0x74,0x7e,0x7b, + 0x71,0x63,0x5e,0x61,0x5f,0x5e,0x61,0x5e,0x5a,0x5f,0x62,0x5f,0x5e,0x5e,0x62, + 0x65,0x65,0x64,0x62,0x5f,0x5f,0x62,0x62,0x61,0x63,0x66,0x67,0x64,0x61,0x64, + 0x66,0x68,0x6b,0x70,0x77,0x74,0x65,0x4a,0x33,0x3c,0x32,0x0f,0x03,0x02,0x02, + 0x02,0x02,0x03,0x03,0x03,0x02,0x03,0x03,0x02,0x02,0x01,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x00,0x00,0xc8, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x02, + 0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x02,0x02,0x01,0x01,0x01,0x02,0x02, + 0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x02,0x03,0x05,0x07,0x05,0x04,0x03,0x03, + 0x01,0x00,0x03,0x07,0x03,0x00,0x07,0x09,0x03,0x03,0x02,0x02,0x01,0x01,0x02, + 0x02,0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x04,0x03,0x02,0x01,0x00,0x01,0x02, + 0x03,0x02,0x00,0x00,0x01,0x03,0x03,0x02,0x01,0x07,0x0a,0x07,0x03,0x02,0x07, + 0x09,0x06,0x04,0x04,0x03,0x01,0x00,0x01,0x02,0x03,0x03,0x04,0x04,0x04,0x05, + 0x03,0x00,0x03,0x06,0x03,0x02,0x01,0x03,0x06,0x05,0x03,0x02,0x05,0x08,0x07, + 0x07,0x0a,0x15,0x19,0x07,0x03,0x0a,0x0c,0x12,0x20,0x1e,0x11,0x0a,0x07,0x0a, + 0x18,0x28,0x28,0x21,0x12,0x09,0x04,0x03,0x04,0x09,0x07,0x03,0x02,0x03,0x09, + 0x08,0x05,0x03,0x03,0x06,0x04,0x03,0x07,0x0b,0x0d,0x08,0x03,0x03,0x15,0x32, + 0x2b,0x15,0x03,0x10,0x36,0x3d,0x2f,0x0b,0x08,0x25,0x40,0x43,0x12,0x00,0x03, + 0x02,0x0a,0x24,0x26,0x1c,0x2f,0x47,0x5a,0x3b,0x06,0x01,0x27,0x80,0x83,0x54, + 0x42,0x37,0x32,0x3f,0x54,0x68,0x55,0x12,0x00,0x05,0x19,0x2e,0x3e,0x3f,0x3a, + 0x49,0x3a,0x08,0x00,0x03,0x04,0x01,0x00,0x2a,0x61,0x7e,0x83,0x74,0x63,0x58, + 0x61,0x63,0x5d,0x55,0x51,0x57,0x41,0x19,0x11,0x10,0x07,0x0d,0x1e,0x31,0x41, + 0x49,0x40,0x2b,0x24,0x1d,0x15,0x28,0x4c,0x74,0x6e,0x22,0x03,0x08,0x2f,0x51, + 0x5b,0x35,0x00,0x02,0x07,0x03,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x03,0x07,0x0b,0x0b,0x0a,0x0e,0x28, + 0x53,0x65,0x6d,0x6f,0x69,0x5e,0x5a,0x5a,0x60,0x5e,0x57,0x52,0x51,0x53,0x55, + 0x56,0x55,0x56,0x5b,0x5d,0x5b,0x56,0x53,0x55,0x57,0x5a,0x5f,0x65,0x6c,0x6d, + 0x6b,0x6e,0x71,0x71,0x5f,0x49,0x45,0x3d,0x2b,0x18,0x09,0x0a,0x0a,0x07,0x03, + 0x03,0x04,0x05,0x05,0x04,0x03,0x02,0x01,0x00,0x01,0x01,0x02,0x02,0x01,0x01, + 0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00, + 0x01,0x02,0x02,0x02,0x03,0x03,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x03,0x04,0x04,0x01,0x00, + 0x00,0x00,0x00,0x03,0x04,0x03,0x00,0x00,0x07,0x08,0x04,0x03,0x03,0x02,0x01, + 0x01,0x02,0x02,0x01,0x02,0x02,0x03,0x03,0x02,0x02,0x03,0x03,0x02,0x01,0x01, + 0x01,0x03,0x03,0x03,0x01,0x01,0x03,0x04,0x01,0x00,0x00,0x05,0x08,0x06,0x03, + 0x00,0x02,0x03,0x00,0x01,0x03,0x02,0x01,0x01,0x01,0x02,0x03,0x03,0x03,0x03, + 0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x05,0x07,0x04,0x02,0x00,0x03, + 0x07,0x07,0x03,0x00,0x00,0x02,0x04,0x03,0x00,0x03,0x0a,0x0e,0x0a,0x04,0x05, + 0x06,0x06,0x0c,0x15,0x16,0x11,0x03,0x00,0x00,0x05,0x07,0x03,0x01,0x00,0x02, + 0x04,0x05,0x03,0x01,0x01,0x03,0x06,0x05,0x03,0x01,0x03,0x08,0x05,0x01,0x02, + 0x0a,0x19,0x12,0x07,0x03,0x0a,0x17,0x1e,0x1c,0x07,0x05,0x14,0x1d,0x1d,0x09, + 0x01,0x03,0x02,0x06,0x16,0x19,0x13,0x22,0x31,0x37,0x23,0x03,0x04,0x1c,0x49, + 0x48,0x2c,0x1c,0x14,0x15,0x1e,0x2b,0x3c,0x33,0x0c,0x01,0x05,0x06,0x0c,0x19, + 0x19,0x16,0x26,0x23,0x08,0x01,0x02,0x03,0x01,0x01,0x1d,0x3d,0x4f,0x50,0x43, + 0x36,0x2f,0x33,0x36,0x35,0x31,0x2d,0x2c,0x1e,0x08,0x0d,0x12,0x0a,0x06,0x07, + 0x0f,0x1d,0x2c,0x26,0x13,0x0e,0x0b,0x0b,0x15,0x28,0x40,0x3e,0x12,0x00,0x00, + 0x1a,0x2f,0x32,0x1e,0x03,0x04,0x06,0x01,0x01,0x02,0x00,0x00,0x00,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x03,0x07,0x10,0x14, + 0x07,0x0e,0x28,0x35,0x3d,0x41,0x4f,0x61,0x57,0x4c,0x50,0x52,0x54,0x5a,0x5e, + 0x5c,0x59,0x56,0x58,0x58,0x53,0x55,0x5a,0x58,0x57,0x57,0x5a,0x5e,0x53,0x50, + 0x5a,0x57,0x4e,0x4b,0x49,0x48,0x36,0x20,0x1d,0x19,0x10,0x07,0x00,0x00,0x00, + 0x04,0x04,0x03,0x05,0x06,0x05,0x04,0x03,0x01,0x00,0x00,0x00,0x01,0x01,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x02,0x02,0x03,0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x00,0x01,0x00, + 0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00, + 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x03,0x03,0x01, + 0x01,0x02,0x04,0x03,0x01,0x06,0x07,0x04,0x02,0x01,0x03,0x04,0x03,0x03,0x03, + 0x01,0x01,0x01,0x02,0x02,0x01,0x01,0x02,0x03,0x03,0x00,0x00,0x01,0x01,0x01, + 0x01,0x02,0x03,0x04,0x05,0x05,0x04,0x03,0x05,0x04,0x00,0x00,0x00,0x02,0x03, + 0x03,0x03,0x03,0x07,0x09,0x08,0x07,0x05,0x04,0x04,0x03,0x03,0x03,0x03,0x03, + 0x03,0x02,0x02,0x01,0x01,0x02,0x01,0x00,0x00,0x00,0x03,0x05,0x06,0x03,0x01, + 0x00,0x02,0x04,0x04,0x04,0x05,0x02,0x01,0x07,0x07,0x01,0x03,0x03,0x00,0x00, + 0x01,0x04,0x04,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x03,0x0b,0x0d,0x03,0x01, + 0x02,0x05,0x06,0x03,0x02,0x01,0x02,0x03,0x05,0x07,0x06,0x01,0x00,0x02,0x04, + 0x06,0x03,0x01,0x00,0x01,0x03,0x06,0x04,0x00,0x00,0x01,0x01,0x03,0x07,0x05, + 0x03,0x03,0x04,0x04,0x01,0x00,0x07,0x07,0x04,0x0b,0x13,0x16,0x0e,0x01,0x06, + 0x09,0x04,0x05,0x07,0x03,0x01,0x04,0x03,0x02,0x0b,0x0e,0x05,0x05,0x07,0x03, + 0x01,0x02,0x01,0x02,0x0b,0x0e,0x08,0x03,0x00,0x02,0x03,0x04,0x0b,0x12,0x12, + 0x0e,0x08,0x07,0x07,0x07,0x07,0x08,0x08,0x07,0x06,0x0a,0x12,0x18,0x19,0x10, + 0x0a,0x07,0x02,0x03,0x14,0x15,0x0b,0x0c,0x0f,0x15,0x11,0x07,0x04,0x03,0x04, + 0x07,0x09,0x07,0x07,0x08,0x07,0x05,0x04,0x03,0x00,0x01,0x03,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00, + 0x15,0x24,0x1a,0x10,0x09,0x06,0x07,0x07,0x27,0x57,0x4b,0x36,0x35,0x3c,0x49, + 0x5b,0x65,0x5e,0x57,0x50,0x56,0x56,0x45,0x48,0x54,0x59,0x59,0x56,0x57,0x57, + 0x3f,0x32,0x3c,0x33,0x23,0x19,0x15,0x12,0x0a,0x01,0x02,0x03,0x06,0x07,0x07, + 0x03,0x03,0x05,0x06,0x05,0x06,0x06,0x05,0x04,0x03,0x01,0x00,0x00,0x00,0x00, + 0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x02,0x02,0x02, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x04, + 0x03,0x00,0x01,0x02,0x03,0x02,0x00,0x04,0x06,0x02,0x01,0x01,0x00,0x01,0x03, + 0x03,0x02,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x02,0x03,0x04,0x04,0x03,0x03,0x03,0x02,0x01,0x02,0x03, + 0x03,0x03,0x01,0x01,0x03,0x05,0x04,0x03,0x03,0x05,0x04,0x04,0x03,0x04,0x04, + 0x04,0x03,0x03,0x02,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x04,0x03,0x03,0x02, + 0x01,0x01,0x02,0x03,0x04,0x01,0x00,0x03,0x03,0x03,0x05,0x04,0x03,0x02,0x01, + 0x01,0x03,0x04,0x04,0x03,0x04,0x03,0x01,0x00,0x00,0x04,0x03,0x00,0x04,0x06, + 0x02,0x02,0x03,0x05,0x04,0x00,0x00,0x02,0x02,0x02,0x01,0x03,0x04,0x03,0x00, + 0x00,0x02,0x06,0x07,0x04,0x00,0x02,0x06,0x04,0x03,0x00,0x00,0x00,0x03,0x04, + 0x03,0x01,0x01,0x03,0x05,0x05,0x03,0x01,0x01,0x01,0x00,0x03,0x07,0x08,0x07, + 0x03,0x03,0x03,0x02,0x02,0x03,0x02,0x02,0x03,0x05,0x05,0x04,0x03,0x00,0x03, + 0x07,0x07,0x06,0x01,0x03,0x05,0x04,0x03,0x02,0x01,0x01,0x02,0x03,0x03,0x03, + 0x03,0x04,0x04,0x04,0x03,0x04,0x08,0x06,0x00,0x03,0x06,0x03,0x05,0x09,0x09, + 0x08,0x07,0x06,0x04,0x03,0x06,0x0c,0x0c,0x09,0x0a,0x0d,0x11,0x0e,0x06,0x01, + 0x00,0x06,0x08,0x07,0x02,0x00,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00,0x03, + 0x03,0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03, + 0x03,0x01,0x09,0x12,0x16,0x15,0x0e,0x06,0x01,0x00,0x0c,0x1d,0x1a,0x12,0x0e, + 0x15,0x21,0x2b,0x2e,0x29,0x27,0x26,0x2a,0x29,0x1e,0x24,0x34,0x3e,0x41,0x3a, + 0x30,0x26,0x19,0x13,0x18,0x12,0x08,0x07,0x07,0x03,0x05,0x08,0x03,0x01,0x03, + 0x03,0x04,0x04,0x03,0x01,0x03,0x04,0x03,0x03,0x03,0x03,0x03,0x01,0x00,0x00, + 0x00,0x00,0x01,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x01,0x01,0x01, + 0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x02, + 0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x00,0x00,0x03,0x03,0x00,0x00,0x01,0x00, + 0x01,0x02,0x02,0x02,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x02,0x01,0x01,0x01,0x01, + 0x03,0x05,0x03,0x01,0x00,0x00,0x03,0x03,0x01,0x00,0x01,0x03,0x03,0x03,0x03, + 0x03,0x03,0x03,0x03,0x02,0x01,0x01,0x02,0x02,0x02,0x02,0x03,0x04,0x04,0x03, + 0x01,0x00,0x00,0x02,0x03,0x03,0x03,0x02,0x01,0x00,0x03,0x04,0x03,0x02,0x02, + 0x00,0x00,0x03,0x05,0x05,0x03,0x02,0x05,0x04,0x02,0x02,0x03,0x06,0x04,0x00, + 0x00,0x00,0x00,0x02,0x03,0x04,0x03,0x01,0x01,0x03,0x03,0x01,0x00,0x01,0x03, + 0x03,0x03,0x02,0x02,0x03,0x07,0x06,0x02,0x03,0x06,0x03,0x02,0x03,0x02,0x02, + 0x03,0x03,0x01,0x01,0x02,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x01, + 0x03,0x04,0x05,0x03,0x02,0x04,0x04,0x03,0x04,0x05,0x04,0x06,0x07,0x03,0x00, + 0x00,0x02,0x06,0x08,0x07,0x03,0x05,0x09,0x03,0x00,0x00,0x00,0x01,0x01,0x03, + 0x04,0x02,0x00,0x00,0x03,0x05,0x05,0x06,0x09,0x07,0x00,0x03,0x07,0x04,0x03, + 0x03,0x01,0x00,0x03,0x03,0x02,0x05,0x08,0x08,0x07,0x06,0x06,0x07,0x09,0x08, + 0x06,0x03,0x03,0x06,0x07,0x05,0x01,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x01, + 0x00,0x03,0x04,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x01,0x04,0x04,0x02,0x02,0x05,0x0e,0x11,0x0e,0x07,0x01,0x02,0x01,0x00,0x00, + 0x00,0x00,0x01,0x07,0x08,0x07,0x07,0x07,0x08,0x0b,0x0b,0x06,0x0b,0x18,0x20, + 0x24,0x1e,0x12,0x06,0x02,0x02,0x03,0x01,0x00,0x02,0x03,0x00,0x05,0x0b,0x06, + 0x01,0x01,0x01,0x02,0x04,0x04,0x00,0x02,0x03,0x02,0x01,0x02,0x03,0x03,0x02, + 0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x01,0x01,0x02,0x03,0x05,0x03,0x02,0x00,0x00,0x00,0x03,0x03,0x00,0x00, + 0x03,0x04,0x03,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x02,0x02,0x01,0x01, + 0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x02, + 0x02,0x00,0x01,0x03,0x02,0x01,0x00,0x00,0x01,0x01,0x02,0x03,0x03,0x01,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x02,0x01,0x00,0x00, + 0x00,0x01,0x01,0x00,0x00,0x02,0x03,0x03,0x03,0x08,0x07,0x00,0x00,0x01,0x03, + 0x02,0x00,0x00,0x00,0x03,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x04,0x07,0x03, + 0x03,0x04,0x01,0x00,0x00,0x01,0x02,0x03,0x05,0x05,0x04,0x03,0x03,0x03,0x03, + 0x03,0x03,0x02,0x05,0x0a,0x06,0x00,0x01,0x03,0x03,0x02,0x00,0x00,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x00,0x00,0x00,0x02,0x03,0x01,0x01,0x03, + 0x00,0x00,0x03,0x05,0x05,0x03,0x02,0x01,0x02,0x03,0x06,0x05,0x01,0x00,0x00, + 0x03,0x03,0x03,0x03,0x04,0x03,0x01,0x01,0x05,0x09,0x04,0x02,0x03,0x02,0x02, + 0x00,0x02,0x07,0x05,0x03,0x00,0x00,0x02,0x03,0x03,0x01,0x00,0x02,0x03,0x04, + 0x02,0x01,0x01,0x05,0x07,0x06,0x03,0x00,0x03,0x05,0x05,0x03,0x01,0x00,0x00, + 0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x04,0x03,0x01,0x00,0x03,0x06,0x06,0x04, + 0x01,0x03,0x04,0x02,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x02,0x02,0x00,0x03,0x05,0x02,0x02,0x03,0x01,0x00,0x03,0x06, + 0x06,0x03,0x03,0x08,0x08,0x03,0x01,0x02,0x07,0x06,0x01,0x05,0x07,0x06,0x06, + 0x07,0x07,0x07,0x0a,0x07,0x02,0x02,0x03,0x03,0x03,0x05,0x06,0x04,0x02,0x03, + 0x03,0x02,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x04,0x05,0x02,0x00,0x02,0x02, + 0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x00, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x03,0x02,0x01,0x00,0x00,0x01,0x02,0x02, + 0x00,0x01,0x02,0x03,0x02,0x01,0x00,0x00,0x00,0x01,0x02,0x02,0x03,0x02,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02, + 0x02,0x03,0x02,0x00,0x00,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00,0x02,0x03, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x02, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x02,0x05,0x04,0x00,0x00, + 0x00,0x02,0x03,0x02,0x01,0x00,0x01,0x01,0x01,0x02,0x01,0x00,0x00,0x02,0x03, + 0x03,0x01,0x01,0x03,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x03,0x02,0x01, + 0x02,0x03,0x02,0x01,0x01,0x03,0x07,0x05,0x02,0x01,0x02,0x02,0x01,0x00,0x02, + 0x03,0x02,0x01,0x00,0x00,0x00,0x01,0x02,0x03,0x02,0x01,0x00,0x02,0x03,0x01, + 0x01,0x02,0x02,0x02,0x03,0x03,0x04,0x03,0x02,0x03,0x03,0x03,0x03,0x03,0x01, + 0x00,0x01,0x03,0x04,0x03,0x03,0x01,0x01,0x02,0x03,0x03,0x04,0x03,0x02,0x02, + 0x02,0x02,0x00,0x00,0x03,0x05,0x06,0x03,0x02,0x03,0x02,0x01,0x01,0x01,0x03, + 0x04,0x04,0x02,0x00,0x01,0x03,0x05,0x05,0x03,0x00,0x03,0x04,0x02,0x02,0x02, + 0x01,0x00,0x00,0x01,0x04,0x04,0x03,0x02,0x01,0x01,0x04,0x05,0x00,0x02,0x05, + 0x03,0x02,0x00,0x03,0x04,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x02,0x03,0x01,0x00,0x01,0x02,0x03, + 0x03,0x03,0x03,0x03,0x04,0x06,0x04,0x01,0x00,0x01,0x05,0x04,0x00,0x02,0x04, + 0x06,0x05,0x02,0x00,0x00,0x01,0x02,0x03,0x03,0x03,0x04,0x04,0x03,0x02,0x03, + 0x06,0x03,0x00,0x02,0x03,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x01,0x01, + 0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x03,0x03, + 0x03,0x03,0x03,0x03,0x01,0x00,0x00,0x01,0x02,0x02,0x03,0x03,0x02,0x00,0x00, + 0x00,0x01,0x03,0x02,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x02, + 0x03,0x03,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x02,0x03,0x04,0x03,0x01,0x00,0x01,0x04,0x03,0x02,0x00,0x02, + 0x05,0x02,0x00,0x00,0x00,0x00,0x02,0x03,0x03,0x02,0x01,0x00,0x00,0x01,0x00, + 0x00,0x00,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x02,0x05,0x03,0x02,0x00,0x00, + 0x01,0x03,0x04,0x03,0x03,0x02,0x01,0x02,0x03,0x02,0x01,0x03,0x03,0x03,0x02, + 0x02,0x01,0x00,0x00,0x03,0x05,0x02,0x01,0x03,0x01,0x01,0x03,0x03,0x02,0x00, + 0x00,0x01,0x03,0x04,0x04,0x04,0x03,0x02,0x00,0x02,0x04,0x04,0x03,0x00,0x01, + 0x01,0x00,0x02,0x03,0x00,0x00,0x00,0x04,0x07,0x05,0x04,0x04,0x02,0x00,0x03, + 0x03,0x02,0x03,0x05,0x02,0x01,0x02,0x00,0x00,0x03,0x03,0x01,0x03,0x03,0x00, + 0x01,0x05,0x04,0x03,0x02,0x04,0x08,0x06,0x03,0x03,0x01,0x00,0x06,0x08,0x02, + 0x00,0x02,0x00,0x00,0x00,0x02,0x03,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02,0x04,0x04,0x03, + 0x04,0x05,0x01,0x00,0x00,0x03,0x04,0x00,0x00,0x03,0x03,0x03,0x04,0x04,0x03, + 0x02,0x03,0x07,0x06,0x03,0x03,0x03,0x00,0x02,0x07,0x04,0x03,0x07,0x04,0x00, + 0x00,0x01,0x08,0x06,0x00,0x03,0x05,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x04,0x01,0x00,0x00, + 0x01,0x03,0x02,0x01,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x01,0x01,0x01,0x02,0x03,0x03,0x02,0x01,0x00,0x00,0x02,0x03,0x03, + 0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x02,0x00,0x01,0x03,0x03,0x02,0x01,0x00,0x01,0x02,0x03,0x03,0x01,0x00, + 0x02,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x02,0x03,0x03,0x02,0x01,0x01, + 0x02,0x03,0x03,0x00,0x00,0x02,0x04,0x06,0x03,0x00,0x00,0x02,0x04,0x01,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x02,0x03,0x01,0x02,0x03,0x01,0x00, + 0x00,0x01,0x03,0x01,0x02,0x05,0x03,0x00,0x02,0x03,0x02,0x00,0x00,0x01,0x01, + 0x01,0x00,0x00,0x01,0x01,0x01,0x02,0x03,0x00,0x00,0x00,0x01,0x01,0x00,0x03, + 0x06,0x03,0x00,0x01,0x02,0x03,0x03,0x03,0x03,0x03,0x05,0x03,0x02,0x03,0x01, + 0x00,0x03,0x04,0x00,0x01,0x04,0x03,0x02,0x00,0x03,0x05,0x02,0x01,0x03,0x03, + 0x03,0x02,0x01,0x00,0x00,0x01,0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03, + 0x02,0x03,0x03,0x04,0x04,0x03,0x00,0x00,0x02,0x03,0x03,0x03,0x03,0x03,0x04, + 0x03,0x00,0x01,0x03,0x03,0x03,0x04,0x03,0x00,0x01,0x01,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x02,0x03, + 0x04,0x03,0x02,0x02,0x03,0x03,0x02,0x02,0x03,0x07,0x07,0x03,0x02,0x00,0x02, + 0x03,0x03,0x02,0x00,0x01,0x03,0x03,0x02,0x01,0x03,0x03,0x03,0x00,0x00,0x03, + 0x06,0x07,0x03,0x00,0x02,0x02,0x01,0x02,0x02,0x03,0x01,0x00,0x02,0x03,0x02, + 0x03,0x05,0x03,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x03,0x05,0x02, + 0x00,0x03,0x03,0x02,0x02,0x01,0x00,0x00,0x01,0x03,0x03,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x01,0x00,0x00,0x02, + 0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x02,0x02,0x00,0x02,0x03,0x03,0x01,0x00,0x00,0x01,0x02,0x03,0x03, + 0x01,0x00,0x03,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x00, + 0x00,0x00,0x02,0x03,0x02,0x00,0x00,0x03,0x06,0x06,0x03,0x00,0x00,0x02,0x04, + 0x03,0x00,0x00,0x00,0x01,0x02,0x02,0x01,0x00,0x00,0x02,0x03,0x02,0x02,0x01, + 0x00,0x00,0x00,0x01,0x03,0x01,0x01,0x04,0x03,0x01,0x02,0x02,0x00,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x00,0x01,0x00,0x00,0x01,0x01, + 0x00,0x02,0x07,0x03,0x00,0x01,0x02,0x03,0x02,0x01,0x01,0x03,0x06,0x03,0x02, + 0x03,0x02,0x02,0x04,0x04,0x00,0x02,0x04,0x03,0x03,0x01,0x02,0x03,0x00,0x00, + 0x02,0x03,0x04,0x01,0x00,0x00,0x00,0x00,0x01,0x03,0x04,0x04,0x03,0x03,0x03, + 0x03,0x02,0x01,0x04,0x04,0x03,0x03,0x02,0x00,0x00,0x00,0x02,0x03,0x03,0x03, + 0x04,0x03,0x01,0x01,0x02,0x03,0x03,0x03,0x04,0x03,0x00,0x01,0x01,0x00,0x00, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x01, + 0x01,0x03,0x03,0x02,0x00,0x00,0x03,0x04,0x03,0x01,0x02,0x07,0x07,0x03,0x00, + 0x00,0x00,0x02,0x03,0x01,0x00,0x00,0x02,0x03,0x01,0x00,0x03,0x03,0x00,0x00, + 0x01,0x00,0x04,0x09,0x04,0x00,0x00,0x00,0x02,0x01,0x00,0x02,0x01,0x00,0x02, + 0x03,0x03,0x04,0x05,0x02,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02, + 0x02,0x00,0x02,0x06,0x04,0x00,0x01,0x01,0x02,0x03,0x03,0x01,0x01,0x02,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x02,0x00,0x00,0x03,0x03,0x01,0x03, + 0x03,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x01,0x00,0x00,0x01,0x01, + 0x01,0x00,0x00,0x00,0x01,0x02,0x04,0x03,0x03,0x00,0x00,0x00,0x02,0x03,0x03, + 0x02,0x00,0x01,0x01,0x00,0x01,0x03,0x03,0x02,0x00,0x00,0x02,0x02,0x01,0x00, + 0x01,0x03,0x01,0x00,0x00,0x01,0x02,0x00,0x00,0x02,0x02,0x00,0x02,0x03,0x02, + 0x01,0x02,0x03,0x03,0x03,0x02,0x02,0x01,0x01,0x01,0x01,0x02,0x01,0x01,0x01, + 0x00,0x00,0x02,0x02,0x00,0x00,0x02,0x04,0x03,0x00,0x01,0x03,0x00,0x00,0x00, + 0x03,0x05,0x02,0x01,0x02,0x01,0x01,0x00,0x00,0x01,0x00,0x00,0x03,0x03,0x00, + 0x02,0x03,0x01,0x01,0x02,0x00,0x00,0x00,0x03,0x06,0x03,0x00,0x00,0x00,0x02, + 0x03,0x03,0x02,0x04,0x07,0x03,0x00,0x01,0x03,0x03,0x02,0x00,0x00,0x01,0x03, + 0x03,0x01,0x00,0x00,0x00,0x00,0x02,0x03,0x03,0x03,0x00,0x02,0x05,0x03,0x00, + 0x01,0x02,0x03,0x02,0x02,0x03,0x03,0x02,0x01,0x01,0x01,0x02,0x03,0x03,0x03, + 0x01,0x01,0x02,0x00,0x00,0x03,0x02,0x00,0x00,0x00,0x00,0x02,0x05,0x02,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02, + 0x05,0x02,0x00,0x01,0x02,0x00,0x00,0x01,0x02,0x02,0x00,0x02,0x03,0x02,0x01, + 0x00,0x01,0x02,0x00,0x02,0x04,0x02,0x00,0x04,0x04,0x03,0x03,0x03,0x01,0x00, + 0x01,0x05,0x07,0x01,0x00,0x00,0x02,0x02,0x00,0x01,0x02,0x01,0x01,0x01,0x02, + 0x02,0x01,0x01,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02, + 0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x00,0x00,0x01,0x04,0x03,0x00,0x00,0x01,0x01,0x02,0x02,0x00,0x00, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x00,0x02,0x02, + 0x01,0x02,0x03,0x03,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x02,0x03,0x03,0x01,0x00,0x00,0x00,0x01, + 0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x01,0x00,0x00,0x02,0x02, + 0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01, + 0x02,0x01,0x01,0x00,0x02,0x03,0x02,0x02,0x01,0x01,0x00,0x01,0x01,0x01,0x00, + 0x00,0x01,0x00,0x00,0x02,0x02,0x00,0x01,0x02,0x03,0x03,0x00,0x01,0x03,0x00, + 0x00,0x00,0x03,0x04,0x02,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x01,0x03, + 0x02,0x01,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x00, + 0x00,0x01,0x03,0x03,0x02,0x03,0x04,0x01,0x00,0x03,0x03,0x03,0x02,0x01,0x00, + 0x02,0x03,0x03,0x02,0x00,0x00,0x00,0x01,0x02,0x03,0x03,0x03,0x01,0x01,0x03, + 0x01,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03, + 0x03,0x03,0x01,0x01,0x01,0x00,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x03, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x02,0x03,0x02,0x00,0x01,0x01,0x00,0x01,0x02,0x02,0x02,0x01,0x02,0x03, + 0x01,0x00,0x00,0x01,0x02,0x01,0x02,0x03,0x02,0x01,0x04,0x03,0x03,0x03,0x03, + 0x01,0x00,0x01,0x03,0x04,0x01,0x00,0x00,0x01,0x02,0x01,0x02,0x02,0x01,0x01, + 0x01,0x01,0x01,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x01, + 0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x02,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x03, + 0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x02, + 0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x02, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x02,0x02,0x02, + 0x02,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x02, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x02, + 0x02,0x02,0x02,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01, + 0x02,0x02,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00, + 0x01,0x01,0x01,0x02,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x02,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02, + 0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x02,0x02,0x02,0x02,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02, + 0x02,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x02,0x01,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x03,0x02,0x01, + 0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x02,0x02, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x00,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02, + 0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x02,0x01,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03,0x03, + 0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x03, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x00,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x02,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x02, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x03, + 0x03,0x02,0x02,0x02,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, + 0x02,0x02,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x01, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00, + 0x01,0x02,0x02,0x01,0x02,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x02,0x02, + 0x02,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x02, + 0x02,0x02,0x02,0x02,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x01,0x01, + 0x01,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x00,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x00, + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x02,0x00,0x00,0x01, + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8, + 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x01, + 0x01,0x01,0x00,0x00,0x01,0x02,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, + 0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8,0xc8, + 0xc8,0xc8,0xc8,0xc8 +}; + diff --git a/vendor/x11iraf/ximtool/logo/NOTES b/vendor/x11iraf/ximtool/logo/NOTES new file mode 100644 index 00000000..59dcbaef --- /dev/null +++ b/vendor/x11iraf/ximtool/logo/NOTES @@ -0,0 +1,17 @@ + +To make a new logo: + + 1) Create the logo image by some means. Size should be no larger + than 512x512 + 2) Convert the image to FITS, scale it so pixel values are 0-200 + 3) Export to a raw 'logo.bin' file using the IRAF command: + + cl> export logo.fits[*,-*] logo.bin raw outtype='b1' header- + + We flip the image in Y due to the difference in location of the + origin. + 4) Convert the binary logo.bin file to the header: + + % mkhdr logo.bin > ../logo.h + + 5) Recompile the XImtool sources. diff --git a/vendor/x11iraf/ximtool/logo/logo.bin.gz b/vendor/x11iraf/ximtool/logo/logo.bin.gz new file mode 100644 index 00000000..ded144e2 Binary files /dev/null and b/vendor/x11iraf/ximtool/logo/logo.bin.gz differ diff --git a/vendor/x11iraf/ximtool/logo/logo.fits b/vendor/x11iraf/ximtool/logo/logo.fits new file mode 100644 index 00000000..0ff7df28 Binary files /dev/null and b/vendor/x11iraf/ximtool/logo/logo.fits differ diff --git a/vendor/x11iraf/ximtool/logo/logo.fits.gz b/vendor/x11iraf/ximtool/logo/logo.fits.gz new file mode 100644 index 00000000..1837dcdb Binary files /dev/null and b/vendor/x11iraf/ximtool/logo/logo.fits.gz differ diff --git a/vendor/x11iraf/ximtool/logo/mkhdr.c b/vendor/x11iraf/ximtool/logo/mkhdr.c new file mode 100644 index 00000000..240a774b --- /dev/null +++ b/vendor/x11iraf/ximtool/logo/mkhdr.c @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> + +#define NBYTES 262144 /* 512 x 512 bytes */ + +unsigned char buf[NBYTES]; + +main (int argc, char **argv) +{ + int i, fd, sz; + + fd = open (argv[1], O_RDONLY, 0644); + sz = read (fd, buf, NBYTES); + close (fd); + + printf ("#define LOGO_XDIM\t\t512\n"); + printf ("#define LOGO_YDIM\t\t512\n"); + printf ("#define LOGO_NCOLORS\t\t200\n"); + printf ("#define LOGO_NBYTES\t\t262144\n"); + printf ("\n"); + printf ("unsigned char logo_data[] = {"); + for (i=0; i < NBYTES; i++) { + if ((i % 15) == 0) + printf ("\n "); + printf ("0x%02x%s", (unsigned char)buf[i],(i==(NBYTES-1) ? "\n" : ",")); + } + printf ("};\n\n"); +} + + diff --git a/vendor/x11iraf/ximtool/luts/README b/vendor/x11iraf/ximtool/luts/README new file mode 100644 index 00000000..27a95ac6 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/README @@ -0,0 +1,37 @@ +This directory contains a collection of lookup tables compiled from various +sources. The origin of most of these was Klaus Banse of the MIDAS project. +The ultimate source of many of the tables is unknown. + +To have the colortables in this directory loaded automatically by Ximtool +install them in the directory + + /usr/local/lib/imtoolcmap/ + +Or, to load colortables from a custom directory set the cmapDir1 or cmapDir2 +ximtool resource to the pathname of the directory containing the tables. + +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, +and blue values scaled to the range 0.0 (off) to 1.0 (full intensity). + + R G B + R G B + (etc.) + +Blank lines and comment lines (# ...) are ignored. + +Usually 256 rows are provided, but the number may actually be anything +in the range 1 to 256. Ximtool will interpolate the table as necessary +to compute the colortable values used in Ximtool. Ximtool uses only +201 colors to render pixel data, so it is usually necessary to interpolate +the table when it is loaded. + +Tables are loaded into Ximtool by setting one of the user colormap directory +resources. When Ximtool starts up it will read all the files in the +colormap directory, disregarding any files that are unreadable or that do +not appear to be colortables. The name of the colortable as it will appear +in the Ximtool control panel is the root name of the file, e.g., if the +file is "rainbow.lut" the colortable name will be "rainbow". Lower case +names are suggested to avoid name collisions with the builtin colortables. +If the same colortable file appears in multiple user colortable directories, +the first one will be used. diff --git a/vendor/x11iraf/ximtool/luts/alex.lut b/vendor/x11iraf/ximtool/luts/alex.lut new file mode 100644 index 00000000..c5a25a96 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/alex.lut @@ -0,0 +1,256 @@ +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 1.00000 0.00000 +0.98039 1.00000 0.00000 +0.96078 0.97647 0.00000 +0.94510 0.93725 0.00000 +0.92549 0.89804 0.00000 +0.90980 0.85882 0.00000 +0.89412 0.81961 0.00000 +0.87451 0.78039 0.00000 +0.85882 0.74118 0.00000 +0.83922 0.70196 0.00000 +0.82353 0.66275 0.00000 +0.80392 0.62353 0.00000 +0.78824 0.58431 0.00000 +0.76863 0.54510 0.00000 +0.75686 0.50980 0.00000 +0.74118 0.46667 0.00000 +0.72549 0.43137 0.00000 +0.70980 0.39216 0.00000 +0.69412 0.35294 0.00000 +0.68235 0.31765 0.00000 +0.66275 0.27451 0.00000 +0.65098 0.23922 0.00000 +0.63529 0.20000 0.00000 +0.62745 0.16863 0.00000 +0.61569 0.12941 0.00000 +0.60784 0.09804 0.00000 +0.61961 0.08235 0.00000 +0.62745 0.06275 0.00000 +0.63922 0.04706 0.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.80000 0.00784 0.00784 +0.80784 0.02745 0.02745 +0.81961 0.05098 0.05098 +0.82745 0.08235 0.08235 +0.83922 0.11373 0.11373 +0.84706 0.14902 0.14902 +0.85882 0.19216 0.19216 +0.86667 0.23137 0.23137 +0.87843 0.27843 0.27843 +0.88627 0.32549 0.32549 +0.89804 0.37647 0.37647 +0.90980 0.43137 0.43137 +0.91765 0.48627 0.48627 +0.92941 0.54118 0.54118 +0.93725 0.60000 0.60000 +0.94902 0.66275 0.66275 +0.95686 0.72549 0.72549 +0.96863 0.79216 0.79216 +0.97647 0.85882 0.85882 +0.98824 0.92941 0.92941 +1.00000 1.00000 1.00000 +0.00000 0.00000 0.16471 +0.02745 0.00000 0.18431 +0.05882 0.00000 0.20000 +0.08627 0.00000 0.21961 +0.11373 0.00000 0.23922 +0.14510 0.00000 0.25882 +0.17647 0.00000 0.27843 +0.20392 0.00000 0.29804 +0.23137 0.00000 0.31765 +0.26275 0.00000 0.33725 +0.29412 0.00000 0.35686 +0.32157 0.00000 0.37647 +0.35294 0.00000 0.39608 +0.38039 0.00000 0.41569 +0.41176 0.00000 0.43529 +0.43922 0.00000 0.45490 +0.47059 0.00000 0.47451 +0.49804 0.00000 0.49412 +0.52941 0.00000 0.51373 +0.55686 0.00000 0.53725 +0.58824 0.00000 0.55686 +0.55686 0.00000 0.57647 +0.52941 0.00000 0.59608 +0.49804 0.00000 0.61569 +0.47059 0.00000 0.63922 +0.43922 0.00000 0.65882 +0.41176 0.00000 0.67843 +0.38039 0.00000 0.70196 +0.35294 0.00000 0.72157 +0.32157 0.00000 0.74118 +0.29412 0.00000 0.76471 +0.26275 0.00000 0.78431 +0.23137 0.00000 0.80392 +0.20392 0.00000 0.82745 +0.17647 0.00000 0.84706 +0.14510 0.00000 0.87059 +0.11373 0.00000 0.89020 +0.08627 0.00000 0.91373 +0.05882 0.00000 0.93333 +0.02745 0.00000 0.95686 +0.00000 0.00000 0.97647 +0.00000 0.00000 1.00000 +0.00000 0.02353 0.97647 +0.00000 0.04706 0.95686 +0.00000 0.06275 0.93333 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +0.00000 0.21176 0.72157 +0.00000 0.22353 0.70196 +0.00000 0.23529 0.67843 +0.00000 0.25098 0.65882 +0.00000 0.26275 0.63922 +0.00000 0.27451 0.61569 +0.00000 0.28627 0.59608 +0.00000 0.29804 0.57647 +0.00000 0.30980 0.55686 +0.00000 0.32157 0.53725 +0.00000 0.33333 0.51373 +0.00000 0.34510 0.49412 +0.00000 0.35686 0.47451 +0.00000 0.36863 0.45490 +0.00000 0.38039 0.43529 +0.00000 0.39216 0.41569 +0.00000 0.40392 0.39608 +0.00000 0.41176 0.37647 +0.00000 0.42353 0.35686 +0.00000 0.43529 0.33725 +0.00000 0.44706 0.31765 +0.00000 0.45882 0.29804 +0.00000 0.46667 0.27843 +0.00000 0.47843 0.25882 +0.00000 0.49020 0.23922 +0.00000 0.49804 0.21961 +0.00000 0.50980 0.20000 +0.00000 0.52157 0.18431 +0.00000 0.52941 0.16471 +0.00000 0.54118 0.14510 +0.00000 0.55294 0.12941 +0.00000 0.56078 0.10980 +0.00000 0.57255 0.09412 +0.00000 0.58431 0.07451 +0.00000 0.59216 0.05882 +0.00000 0.60392 0.04314 +0.00000 0.61176 0.02745 +0.00000 0.62353 0.01176 +0.00000 0.63137 0.00000 +0.00000 0.64314 0.00000 +0.00000 0.65098 0.00000 +0.00000 0.66275 0.00000 +0.00000 0.67059 0.00000 +0.00000 0.68235 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.70196 0.00000 +0.00000 0.70980 0.00000 +0.00000 0.72157 0.00000 +0.00000 0.72941 0.00000 +0.00000 0.74118 0.00000 +0.00000 0.74902 0.00000 +0.00000 0.76078 0.00000 +0.00000 0.76863 0.00000 +0.00000 0.77647 0.00000 +0.00000 0.78824 0.00000 +0.00000 0.79608 0.00000 +0.00000 0.80784 0.00000 +0.00000 0.81569 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.83529 0.00000 +0.00000 0.84314 0.00000 +0.00000 0.85490 0.00000 +0.00000 0.86275 0.00000 +0.00000 0.87059 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.89020 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.90980 0.00000 +0.00000 0.91765 0.00000 +0.00000 0.92549 0.00000 +0.00000 0.93725 0.00000 +0.00000 0.94510 0.00000 +0.00000 0.95294 0.00000 +0.00000 0.96078 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.98039 0.00000 +0.00000 0.98824 0.00000 +0.00000 1.00000 0.00000 +0.00000 0.98824 0.00000 +0.00000 0.98039 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.96078 0.00000 +0.00000 0.95294 0.00000 +0.00000 0.94510 0.00000 +0.00000 0.93725 0.00000 +0.00000 0.92549 0.00000 +0.00000 0.91765 0.00000 +0.00000 0.90980 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89020 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.87059 0.00000 +0.00000 0.86275 0.00000 +0.00000 0.85490 0.00000 +0.00000 0.84314 0.00000 +0.00000 0.83529 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.81569 0.00000 +0.00000 0.80784 0.00000 +0.00000 0.79608 0.00000 +0.00000 0.78824 0.00000 +0.00000 0.77647 0.00000 +0.00784 0.76863 0.00000 +0.03529 0.77647 0.00000 +0.06667 0.78824 0.00000 +0.09804 0.80000 0.00000 +0.12941 0.81176 0.00000 +0.16471 0.82745 0.00000 +0.20000 0.84314 0.00000 +0.23529 0.85882 0.00000 +0.26667 0.87059 0.00000 +0.30588 0.89020 0.00000 +0.34118 0.90196 0.00000 +0.37647 0.92157 0.00000 +0.41176 0.93333 0.00000 +0.44706 0.95294 0.00000 +0.48627 0.96863 0.00000 +0.52157 0.98824 0.00000 +0.56078 1.00000 0.00000 +0.59608 1.00000 0.00000 +0.63529 1.00000 0.00000 +0.67059 1.00000 0.00000 +0.70980 1.00000 0.00000 +0.74902 1.00000 0.00000 +0.78431 1.00000 0.00000 +0.82353 1.00000 0.00000 +0.85882 1.00000 0.00000 +0.89804 1.00000 0.00000 +0.93333 1.00000 0.00000 +0.97647 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/backgr.lut b/vendor/x11iraf/ximtool/luts/backgr.lut new file mode 100644 index 00000000..515ce439 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/backgr.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.01587 0.01587 0.01587 +0.03174 0.03174 0.03174 +0.04761 0.04761 0.04761 +0.06348 0.06348 0.06348 +0.07935 0.07935 0.07935 +0.09522 0.09522 0.09522 +0.11109 0.11109 0.11109 +0.12696 0.12696 0.12696 +0.14283 0.14283 0.14283 +0.15870 0.15870 0.15870 +0.17457 0.17457 0.17457 +0.19044 0.19044 0.19044 +0.20631 0.20631 0.20631 +0.22218 0.22218 0.22218 +0.23805 0.23805 0.23805 +0.25392 0.25392 0.25392 +0.26979 0.26979 0.26979 +0.28566 0.28566 0.28566 +0.30153 0.30153 0.30153 +0.31740 0.31740 0.31740 +0.33327 0.33327 0.33327 +0.34914 0.34914 0.34914 +0.36501 0.36501 0.36501 +0.38088 0.38088 0.38088 +0.39675 0.39675 0.39675 +0.41262 0.41262 0.41262 +0.42849 0.42849 0.42849 +0.44436 0.44436 0.44436 +0.46023 0.46023 0.46023 +0.47610 0.47610 0.47610 +0.49197 0.49197 0.49197 +0.50784 0.50784 0.50784 +0.52371 0.52371 0.52371 +0.53958 0.53958 0.53958 +0.55545 0.55545 0.55545 +0.57132 0.57132 0.57132 +0.58719 0.58719 0.58719 +0.60306 0.60306 0.60306 +0.61893 0.61893 0.61893 +0.63480 0.63480 0.63480 +0.65067 0.65067 0.65067 +0.66654 0.66654 0.66654 +0.68241 0.68241 0.68241 +0.69828 0.69828 0.69828 +0.71415 0.71415 0.71415 +0.73002 0.73002 0.73002 +0.74589 0.74589 0.74589 +0.76176 0.76176 0.76176 +0.77763 0.77763 0.77763 +0.79350 0.79350 0.79350 +0.80937 0.80937 0.80937 +0.82524 0.82524 0.82524 +0.84111 0.84111 0.84111 +0.85698 0.85698 0.85698 +0.87285 0.87285 0.87285 +0.88872 0.88872 0.88872 +0.90459 0.90459 0.90459 +0.92046 0.92046 0.92046 +0.93633 0.93633 0.93633 +0.95220 0.95220 0.95220 +0.96807 0.96807 0.96807 +0.98394 0.98394 0.98394 +0.99981 0.99981 0.99981 +0.00000 0.00000 0.99981 +0.00000 0.01587 0.98394 +0.00000 0.03174 0.96807 +0.00000 0.04761 0.95220 +0.00000 0.06348 0.93633 +0.00000 0.07935 0.92046 +0.00000 0.09522 0.90459 +0.00000 0.11109 0.88872 +0.00000 0.12696 0.87285 +0.00000 0.14283 0.85698 +0.00000 0.15870 0.84111 +0.00000 0.17457 0.82524 +0.00000 0.19044 0.80937 +0.00000 0.20631 0.79350 +0.00000 0.22218 0.77763 +0.00000 0.23805 0.76176 +0.00000 0.25392 0.74589 +0.00000 0.26979 0.73002 +0.00000 0.28566 0.71415 +0.00000 0.30153 0.69828 +0.00000 0.31740 0.68241 +0.00000 0.33327 0.66654 +0.00000 0.34914 0.65067 +0.00000 0.36501 0.63480 +0.00000 0.38088 0.61893 +0.00000 0.39675 0.60306 +0.00000 0.41262 0.58719 +0.00000 0.42849 0.57132 +0.00000 0.44436 0.55545 +0.00000 0.46023 0.53958 +0.00000 0.47610 0.52371 +0.00000 0.49197 0.50784 +0.00000 0.50784 0.49197 +0.00000 0.52371 0.47610 +0.00000 0.53958 0.46023 +0.00000 0.55545 0.44436 +0.00000 0.57132 0.42849 +0.00000 0.58719 0.41262 +0.00000 0.60306 0.39675 +0.00000 0.61893 0.38088 +0.00000 0.63480 0.36501 +0.00000 0.65067 0.34914 +0.00000 0.66654 0.33327 +0.00000 0.68241 0.31740 +0.00000 0.69828 0.30153 +0.00000 0.71415 0.28566 +0.00000 0.73002 0.26979 +0.00000 0.74589 0.25392 +0.00000 0.76176 0.23805 +0.00000 0.77763 0.22218 +0.00000 0.79350 0.20631 +0.00000 0.80937 0.19044 +0.00000 0.82524 0.17457 +0.00000 0.84111 0.15870 +0.00000 0.85698 0.14283 +0.00000 0.87285 0.12696 +0.00000 0.88872 0.11109 +0.00000 0.90459 0.09522 +0.00000 0.92046 0.07935 +0.00000 0.93633 0.06348 +0.00000 0.95220 0.04761 +0.00000 0.96807 0.03174 +0.00000 0.98394 0.01587 +0.00000 0.99981 0.00000 +0.00000 1.00000 0.00000 +0.01587 1.00000 0.00000 +0.03174 1.00000 0.00000 +0.04761 1.00000 0.00000 +0.06348 1.00000 0.00000 +0.07935 1.00000 0.00000 +0.09522 1.00000 0.00000 +0.11109 1.00000 0.00000 +0.12696 1.00000 0.00000 +0.14283 1.00000 0.00000 +0.15870 1.00000 0.00000 +0.17457 1.00000 0.00000 +0.19044 1.00000 0.00000 +0.20631 1.00000 0.00000 +0.22218 1.00000 0.00000 +0.23805 1.00000 0.00000 +0.25392 1.00000 0.00000 +0.26979 1.00000 0.00000 +0.28566 1.00000 0.00000 +0.30153 1.00000 0.00000 +0.31740 1.00000 0.00000 +0.33327 1.00000 0.00000 +0.34914 1.00000 0.00000 +0.36501 1.00000 0.00000 +0.38088 1.00000 0.00000 +0.39675 1.00000 0.00000 +0.41262 1.00000 0.00000 +0.42849 1.00000 0.00000 +0.44436 1.00000 0.00000 +0.46023 1.00000 0.00000 +0.47610 1.00000 0.00000 +0.49197 1.00000 0.00000 +0.50784 1.00000 0.00000 +0.52371 1.00000 0.00000 +0.53958 1.00000 0.00000 +0.55545 1.00000 0.00000 +0.57132 1.00000 0.00000 +0.58719 1.00000 0.00000 +0.60306 1.00000 0.00000 +0.61893 1.00000 0.00000 +0.63480 1.00000 0.00000 +0.65067 1.00000 0.00000 +0.66654 1.00000 0.00000 +0.68241 1.00000 0.00000 +0.69828 1.00000 0.00000 +0.71415 1.00000 0.00000 +0.73002 1.00000 0.00000 +0.74589 1.00000 0.00000 +0.76176 1.00000 0.00000 +0.77763 1.00000 0.00000 +0.79350 1.00000 0.00000 +0.80937 1.00000 0.00000 +0.82524 1.00000 0.00000 +0.84111 1.00000 0.00000 +0.85698 1.00000 0.00000 +0.87285 1.00000 0.00000 +0.88872 1.00000 0.00000 +0.90459 1.00000 0.00000 +0.92046 1.00000 0.00000 +0.93633 1.00000 0.00000 +0.95220 1.00000 0.00000 +0.96807 1.00000 0.00000 +0.98394 1.00000 0.00000 +0.99981 1.00000 0.00000 +1.00000 0.99981 0.00000 +1.00000 0.98394 0.00000 +1.00000 0.96807 0.00000 +1.00000 0.95220 0.00000 +1.00000 0.93633 0.00000 +1.00000 0.92046 0.00000 +1.00000 0.90459 0.00000 +1.00000 0.88872 0.00000 +1.00000 0.87285 0.00000 +1.00000 0.85698 0.00000 +1.00000 0.84111 0.00000 +1.00000 0.82524 0.00000 +1.00000 0.80937 0.00000 +1.00000 0.79350 0.00000 +1.00000 0.77763 0.00000 +1.00000 0.76176 0.00000 +1.00000 0.74589 0.00000 +1.00000 0.73002 0.00000 +1.00000 0.71415 0.00000 +1.00000 0.69828 0.00000 +1.00000 0.68241 0.00000 +1.00000 0.66654 0.00000 +1.00000 0.65067 0.00000 +1.00000 0.63480 0.00000 +1.00000 0.61893 0.00000 +1.00000 0.60306 0.00000 +1.00000 0.58719 0.00000 +1.00000 0.57132 0.00000 +1.00000 0.55545 0.00000 +1.00000 0.53958 0.00000 +1.00000 0.52371 0.00000 +1.00000 0.50784 0.00000 +1.00000 0.49197 0.00000 +1.00000 0.47610 0.00000 +1.00000 0.46023 0.00000 +1.00000 0.44436 0.00000 +1.00000 0.42849 0.00000 +1.00000 0.41262 0.00000 +1.00000 0.39675 0.00000 +1.00000 0.38088 0.00000 +1.00000 0.36501 0.00000 +1.00000 0.34914 0.00000 +1.00000 0.33327 0.00000 +1.00000 0.31740 0.00000 +1.00000 0.30153 0.00000 +1.00000 0.28566 0.00000 +1.00000 0.26979 0.00000 +1.00000 0.25392 0.00000 +1.00000 0.23805 0.00000 +1.00000 0.22218 0.00000 +1.00000 0.20631 0.00000 +1.00000 0.19044 0.00000 +1.00000 0.17457 0.00000 +1.00000 0.15870 0.00000 +1.00000 0.14283 0.00000 +1.00000 0.12696 0.00000 +1.00000 0.11109 0.00000 +1.00000 0.09522 0.00000 +1.00000 0.07935 0.00000 +1.00000 0.06348 0.00000 +1.00000 0.04761 0.00000 +1.00000 0.03174 0.00000 +1.00000 0.01587 0.00000 +1.00000 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/blulut.lut b/vendor/x11iraf/ximtool/luts/blulut.lut new file mode 100644 index 00000000..1bdc621c --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/blulut.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00392 +0.00000 0.00000 0.00784 +0.00000 0.00000 0.01176 +0.00000 0.00000 0.01569 +0.00000 0.00000 0.01961 +0.00000 0.00000 0.02353 +0.00000 0.00000 0.02745 +0.00000 0.00000 0.03137 +0.00000 0.00000 0.03529 +0.00000 0.00000 0.03922 +0.00000 0.00000 0.04314 +0.00000 0.00000 0.04706 +0.00001 0.00001 0.05098 +0.00001 0.00001 0.05490 +0.00001 0.00001 0.05882 +0.00002 0.00002 0.06275 +0.00002 0.00002 0.06667 +0.00002 0.00002 0.07059 +0.00003 0.00003 0.07451 +0.00004 0.00004 0.07843 +0.00005 0.00005 0.08235 +0.00006 0.00006 0.08627 +0.00007 0.00007 0.09020 +0.00008 0.00008 0.09412 +0.00009 0.00009 0.09804 +0.00011 0.00011 0.10196 +0.00013 0.00013 0.10588 +0.00015 0.00015 0.10980 +0.00017 0.00017 0.11373 +0.00019 0.00019 0.11765 +0.00022 0.00022 0.12157 +0.00025 0.00025 0.12549 +0.00028 0.00028 0.12941 +0.00032 0.00032 0.13333 +0.00035 0.00035 0.13725 +0.00040 0.00040 0.14118 +0.00044 0.00044 0.14510 +0.00049 0.00049 0.14902 +0.00055 0.00055 0.15294 +0.00061 0.00061 0.15686 +0.00067 0.00067 0.16078 +0.00074 0.00074 0.16471 +0.00081 0.00081 0.16863 +0.00089 0.00089 0.17255 +0.00097 0.00097 0.17647 +0.00106 0.00106 0.18039 +0.00115 0.00115 0.18431 +0.00126 0.00126 0.18824 +0.00136 0.00136 0.19216 +0.00148 0.00148 0.19608 +0.00160 0.00160 0.20000 +0.00173 0.00173 0.20392 +0.00187 0.00187 0.20784 +0.00201 0.00201 0.21176 +0.00216 0.00216 0.21569 +0.00233 0.00233 0.21961 +0.00250 0.00250 0.22353 +0.00268 0.00268 0.22745 +0.00287 0.00287 0.23137 +0.00307 0.00307 0.23529 +0.00327 0.00327 0.23922 +0.00349 0.00349 0.24314 +0.00373 0.00373 0.24706 +0.00397 0.00397 0.25098 +0.00422 0.00422 0.25490 +0.00449 0.00449 0.25882 +0.00477 0.00477 0.26275 +0.00506 0.00506 0.26667 +0.00536 0.00536 0.27059 +0.00568 0.00568 0.27451 +0.00601 0.00601 0.27843 +0.00636 0.00636 0.28235 +0.00672 0.00672 0.28627 +0.00709 0.00709 0.29020 +0.00748 0.00748 0.29412 +0.00789 0.00789 0.29804 +0.00831 0.00831 0.30196 +0.00875 0.00875 0.30588 +0.00921 0.00921 0.30980 +0.00969 0.00969 0.31373 +0.01018 0.01018 0.31765 +0.01069 0.01069 0.32157 +0.01122 0.01122 0.32549 +0.01177 0.01177 0.32941 +0.01235 0.01235 0.33333 +0.01294 0.01294 0.33725 +0.01355 0.01355 0.34118 +0.01418 0.01418 0.34510 +0.01484 0.01484 0.34902 +0.01552 0.01552 0.35294 +0.01622 0.01622 0.35686 +0.01694 0.01694 0.36078 +0.01769 0.01769 0.36471 +0.01847 0.01847 0.36863 +0.01926 0.01926 0.37255 +0.02009 0.02009 0.37647 +0.02094 0.02094 0.38039 +0.02181 0.02181 0.38431 +0.02272 0.02272 0.38824 +0.02365 0.02365 0.39216 +0.02461 0.02461 0.39608 +0.02560 0.02560 0.40000 +0.02662 0.02662 0.40392 +0.02767 0.02767 0.40784 +0.02875 0.02875 0.41176 +0.02986 0.02986 0.41569 +0.03100 0.03100 0.41961 +0.03218 0.03218 0.42353 +0.03338 0.03338 0.42745 +0.03463 0.03463 0.43137 +0.03590 0.03590 0.43529 +0.03721 0.03721 0.43922 +0.03856 0.03856 0.44314 +0.03994 0.03994 0.44706 +0.04136 0.04136 0.45098 +0.04282 0.04282 0.45490 +0.04432 0.04432 0.45882 +0.04585 0.04585 0.46275 +0.04743 0.04743 0.46667 +0.04904 0.04904 0.47059 +0.05070 0.05070 0.47451 +0.05239 0.05239 0.47843 +0.05413 0.05413 0.48235 +0.05591 0.05591 0.48627 +0.05774 0.05774 0.49020 +0.05961 0.05961 0.49412 +0.06153 0.06153 0.49804 +0.06349 0.06349 0.50196 +0.06549 0.06549 0.50588 +0.06755 0.06755 0.50980 +0.06965 0.06965 0.51373 +0.07180 0.07180 0.51765 +0.07400 0.07400 0.52157 +0.07625 0.07625 0.52549 +0.07856 0.07856 0.52941 +0.08091 0.08091 0.53333 +0.08331 0.08331 0.53725 +0.08577 0.08577 0.54118 +0.08829 0.08829 0.54510 +0.09086 0.09086 0.54902 +0.09348 0.09348 0.55294 +0.09616 0.09616 0.55686 +0.09890 0.09890 0.56078 +0.10169 0.10169 0.56471 +0.10455 0.10455 0.56863 +0.10746 0.10746 0.57255 +0.11044 0.11044 0.57647 +0.11347 0.11347 0.58039 +0.11657 0.11657 0.58431 +0.11973 0.11973 0.58824 +0.12296 0.12296 0.59216 +0.12624 0.12624 0.59608 +0.12960 0.12960 0.60000 +0.13302 0.13302 0.60392 +0.13651 0.13651 0.60784 +0.14007 0.14007 0.61176 +0.14369 0.14369 0.61569 +0.14739 0.14739 0.61961 +0.15116 0.15116 0.62353 +0.15500 0.15500 0.62745 +0.15891 0.15891 0.63137 +0.16289 0.16289 0.63529 +0.16695 0.16695 0.63922 +0.17109 0.17109 0.64314 +0.17530 0.17530 0.64706 +0.17959 0.17959 0.65098 +0.18395 0.18395 0.65490 +0.18840 0.18840 0.65882 +0.19292 0.19292 0.66275 +0.19753 0.19753 0.66667 +0.20222 0.20222 0.67059 +0.20699 0.20699 0.67451 +0.21185 0.21185 0.67843 +0.21679 0.21679 0.68235 +0.22182 0.22182 0.68627 +0.22693 0.22693 0.69020 +0.23213 0.23213 0.69412 +0.23742 0.23742 0.69804 +0.24280 0.24280 0.70196 +0.24827 0.24827 0.70588 +0.25384 0.25384 0.70980 +0.25949 0.25949 0.71373 +0.26524 0.26524 0.71765 +0.27109 0.27109 0.72157 +0.27703 0.27703 0.72549 +0.28307 0.28307 0.72941 +0.28920 0.28920 0.73333 +0.29544 0.29544 0.73725 +0.30178 0.30178 0.74118 +0.30821 0.30821 0.74510 +0.31476 0.31476 0.74902 +0.32140 0.32140 0.75294 +0.32815 0.32815 0.75686 +0.33500 0.33500 0.76078 +0.34196 0.34196 0.76471 +0.34903 0.34903 0.76863 +0.35621 0.35621 0.77255 +0.36350 0.36350 0.77647 +0.37090 0.37090 0.78039 +0.37841 0.37841 0.78431 +0.38603 0.38603 0.78824 +0.39377 0.39377 0.79216 +0.40163 0.40163 0.79608 +0.40960 0.40960 0.80000 +0.41769 0.41769 0.80392 +0.42590 0.42590 0.80784 +0.43423 0.43423 0.81176 +0.44268 0.44268 0.81569 +0.45126 0.45126 0.81961 +0.45996 0.45996 0.82353 +0.46878 0.46878 0.82745 +0.47773 0.47773 0.83137 +0.48681 0.48681 0.83529 +0.49601 0.49601 0.83922 +0.50535 0.50535 0.84314 +0.51482 0.51482 0.84706 +0.52442 0.52442 0.85098 +0.53415 0.53415 0.85490 +0.54402 0.54402 0.85882 +0.55403 0.55403 0.86275 +0.56417 0.56417 0.86667 +0.57445 0.57445 0.87059 +0.58487 0.58487 0.87451 +0.59543 0.59543 0.87843 +0.60613 0.60613 0.88235 +0.61698 0.61698 0.88627 +0.62798 0.62798 0.89020 +0.63911 0.63911 0.89412 +0.65040 0.65040 0.89804 +0.66184 0.66184 0.90196 +0.67342 0.67342 0.90588 +0.68516 0.68516 0.90980 +0.69705 0.69705 0.91373 +0.70909 0.70909 0.91765 +0.72129 0.72129 0.92157 +0.73365 0.73365 0.92549 +0.74616 0.74616 0.92941 +0.75883 0.75883 0.93333 +0.77167 0.77167 0.93725 +0.78466 0.78466 0.94118 +0.79782 0.79782 0.94510 +0.81115 0.81115 0.94902 +0.82464 0.82464 0.95294 +0.83830 0.83830 0.95686 +0.85213 0.85213 0.96078 +0.86612 0.86612 0.96471 +0.88029 0.88029 0.96863 +0.89464 0.89464 0.97255 +0.90915 0.90915 0.97647 +0.92385 0.92385 0.98039 +0.93872 0.93872 0.98431 +0.95377 0.95377 0.98824 +0.96899 0.96899 0.99216 +0.98441 0.98441 0.99608 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/flag.lut b/vendor/x11iraf/ximtool/luts/flag.lut new file mode 100644 index 00000000..16c010a8 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/flag.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 +0.98039 0.98039 0.98039 +0.00000 0.49020 0.98039 diff --git a/vendor/x11iraf/ximtool/luts/idl11.lut b/vendor/x11iraf/ximtool/luts/idl11.lut new file mode 100644 index 00000000..e6708ae0 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl11.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00392 0.00392 +0.00000 0.00784 0.00784 +0.00000 0.01176 0.01176 +0.00000 0.01569 0.01569 +0.00000 0.03137 0.03137 +0.00000 0.04706 0.04706 +0.00000 0.06275 0.06275 +0.00000 0.08235 0.08235 +0.00000 0.09804 0.09804 +0.00000 0.11373 0.11373 +0.00000 0.12941 0.12941 +0.00000 0.14902 0.14902 +0.00000 0.16471 0.16471 +0.00000 0.18039 0.18039 +0.00000 0.19608 0.19608 +0.00000 0.21569 0.21569 +0.00000 0.23137 0.23137 +0.00000 0.24706 0.24706 +0.00000 0.26275 0.26275 +0.00000 0.28235 0.28235 +0.00000 0.29804 0.29804 +0.00000 0.31373 0.31373 +0.00000 0.32941 0.32941 +0.00000 0.34902 0.34902 +0.00000 0.36471 0.36471 +0.00000 0.38039 0.38039 +0.00000 0.39608 0.39608 +0.00000 0.41569 0.41569 +0.00000 0.43137 0.43137 +0.00000 0.44706 0.44706 +0.00000 0.46275 0.46275 +0.00000 0.48235 0.48235 +0.00000 0.49804 0.49804 +0.00000 0.51373 0.51373 +0.00000 0.52941 0.52941 +0.00000 0.54902 0.54902 +0.00000 0.56471 0.56471 +0.00000 0.58039 0.58039 +0.00000 0.59608 0.59608 +0.00000 0.61569 0.61569 +0.00000 0.63137 0.63137 +0.00000 0.64706 0.64706 +0.00000 0.66275 0.66275 +0.00000 0.68235 0.68235 +0.00000 0.69804 0.69804 +0.00000 0.71373 0.71373 +0.00000 0.72941 0.72941 +0.00000 0.74902 0.74902 +0.00000 0.76471 0.76471 +0.00000 0.78039 0.78039 +0.00000 0.79608 0.79608 +0.00000 0.81569 0.81569 +0.00000 0.83137 0.83137 +0.00000 0.84706 0.84706 +0.00000 0.86275 0.86275 +0.00000 0.88235 0.88235 +0.00000 0.89804 0.89804 +0.00000 0.91373 0.91373 +0.00000 0.92941 0.92941 +0.00000 0.94902 0.94902 +0.00000 0.96471 0.96471 +0.00000 0.98039 0.98039 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 0.98431 1.00000 +0.00000 0.96863 1.00000 +0.00000 0.95294 1.00000 +0.00000 0.93725 1.00000 +0.00000 0.92157 1.00000 +0.00000 0.90588 1.00000 +0.00000 0.89020 1.00000 +0.00000 0.87451 1.00000 +0.00000 0.85882 1.00000 +0.00000 0.84314 1.00000 +0.00000 0.82745 1.00000 +0.00000 0.81176 1.00000 +0.00000 0.79608 1.00000 +0.00000 0.78039 1.00000 +0.00000 0.76471 1.00000 +0.00000 0.74902 1.00000 +0.00000 0.73333 1.00000 +0.00000 0.71765 1.00000 +0.00000 0.70196 1.00000 +0.00000 0.68627 1.00000 +0.00000 0.66667 1.00000 +0.00000 0.65098 1.00000 +0.00000 0.63529 1.00000 +0.00000 0.61961 1.00000 +0.00000 0.60392 1.00000 +0.00000 0.58824 1.00000 +0.00000 0.57255 1.00000 +0.00000 0.55686 1.00000 +0.00000 0.54118 1.00000 +0.00000 0.52549 1.00000 +0.00000 0.50980 1.00000 +0.00000 0.49412 1.00000 +0.00000 0.47843 1.00000 +0.00000 0.46275 1.00000 +0.00000 0.44706 1.00000 +0.00000 0.43137 1.00000 +0.00000 0.41569 1.00000 +0.00000 0.40000 1.00000 +0.00000 0.38431 1.00000 +0.00000 0.36863 1.00000 +0.00000 0.35294 1.00000 +0.00000 0.33333 1.00000 +0.00000 0.31765 1.00000 +0.00000 0.30196 1.00000 +0.00000 0.28627 1.00000 +0.00000 0.27059 1.00000 +0.00000 0.25490 1.00000 +0.00000 0.23922 1.00000 +0.00000 0.22353 1.00000 +0.00000 0.20784 1.00000 +0.00000 0.19216 1.00000 +0.00000 0.17647 1.00000 +0.00000 0.16078 1.00000 +0.00000 0.14510 1.00000 +0.00000 0.12941 1.00000 +0.00000 0.11373 1.00000 +0.00000 0.09804 1.00000 +0.00000 0.08235 1.00000 +0.00000 0.06667 1.00000 +0.00000 0.05098 1.00000 +0.00000 0.03529 1.00000 +0.00000 0.01961 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.01569 0.00000 1.00000 +0.03137 0.00000 1.00000 +0.04706 0.00000 1.00000 +0.06275 0.00000 1.00000 +0.07843 0.00000 1.00000 +0.09412 0.00000 1.00000 +0.10980 0.00000 1.00000 +0.12549 0.00000 1.00000 +0.14118 0.00000 1.00000 +0.15686 0.00000 1.00000 +0.17255 0.00000 1.00000 +0.18824 0.00000 1.00000 +0.20392 0.00000 1.00000 +0.21961 0.00000 1.00000 +0.23529 0.00000 1.00000 +0.25098 0.00000 1.00000 +0.26667 0.00000 1.00000 +0.28235 0.00000 1.00000 +0.29804 0.00000 1.00000 +0.31373 0.00000 1.00000 +0.33333 0.00000 1.00000 +0.34902 0.00000 1.00000 +0.36471 0.00000 1.00000 +0.38039 0.00000 1.00000 +0.39608 0.00000 1.00000 +0.41176 0.00000 1.00000 +0.42745 0.00000 1.00000 +0.44314 0.00000 1.00000 +0.45882 0.00000 1.00000 +0.47451 0.00000 1.00000 +0.49020 0.00000 1.00000 +0.50588 0.00000 1.00000 +0.52157 0.00000 1.00000 +0.53725 0.00000 1.00000 +0.55294 0.00000 1.00000 +0.56863 0.00000 1.00000 +0.58431 0.00000 1.00000 +0.60000 0.00000 1.00000 +0.61569 0.00000 1.00000 +0.63137 0.00000 1.00000 +0.64706 0.00000 1.00000 +0.66667 0.00000 1.00000 +0.68235 0.00000 1.00000 +0.69804 0.00000 1.00000 +0.71373 0.00000 1.00000 +0.72941 0.00000 1.00000 +0.74510 0.00000 1.00000 +0.76078 0.00000 1.00000 +0.77647 0.00000 1.00000 +0.79216 0.00000 1.00000 +0.80784 0.00000 1.00000 +0.82353 0.00000 1.00000 +0.83922 0.00000 1.00000 +0.85490 0.00000 1.00000 +0.87059 0.00000 1.00000 +0.88627 0.00000 1.00000 +0.90196 0.00000 1.00000 +0.91765 0.00000 1.00000 +0.93333 0.00000 1.00000 +0.94902 0.00000 1.00000 +0.96471 0.00000 1.00000 +0.98039 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 0.98431 +1.00000 0.00000 0.96863 +1.00000 0.00000 0.95294 +1.00000 0.00000 0.93725 +1.00000 0.00000 0.92157 +1.00000 0.00000 0.90588 +1.00000 0.00000 0.89020 +1.00000 0.00000 0.87451 +1.00000 0.00000 0.85490 +1.00000 0.00000 0.83922 +1.00000 0.00000 0.82353 +1.00000 0.00000 0.80784 +1.00000 0.00000 0.79216 +1.00000 0.00000 0.77647 +1.00000 0.00000 0.76078 +1.00000 0.00000 0.74510 +1.00000 0.00000 0.72941 +1.00000 0.00000 0.70980 +1.00000 0.00000 0.69412 +1.00000 0.00000 0.67843 +1.00000 0.00000 0.66275 +1.00000 0.00000 0.64706 +1.00000 0.00000 0.63137 +1.00000 0.00000 0.61569 +1.00000 0.00000 0.60000 +1.00000 0.00000 0.58431 +1.00000 0.00000 0.56471 +1.00000 0.00000 0.54902 +1.00000 0.00000 0.53333 +1.00000 0.00000 0.51765 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.48627 +1.00000 0.00000 0.47059 +1.00000 0.00000 0.45490 +1.00000 0.00000 0.43922 +1.00000 0.00000 0.41961 +1.00000 0.00000 0.40392 +1.00000 0.00000 0.38824 +1.00000 0.00000 0.37255 +1.00000 0.00000 0.35686 +1.00000 0.00000 0.34118 +1.00000 0.00000 0.32549 +1.00000 0.00000 0.30980 +1.00000 0.00000 0.29412 +1.00000 0.00000 0.27451 +1.00000 0.00000 0.25882 +1.00000 0.00000 0.24314 +1.00000 0.00000 0.22745 +1.00000 0.00000 0.21176 +1.00000 0.00000 0.19608 +1.00000 0.00000 0.18039 +1.00000 0.00000 0.16471 +1.00000 0.00000 0.14902 +1.00000 0.00000 0.12941 +1.00000 0.00000 0.11373 +1.00000 0.00000 0.09804 +1.00000 0.00000 0.08235 +1.00000 0.00000 0.06667 +1.00000 0.00000 0.05098 +1.00000 0.00000 0.03529 +1.00000 0.00000 0.01961 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl12.lut b/vendor/x11iraf/ximtool/luts/idl12.lut new file mode 100644 index 00000000..78dc76b7 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl12.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.32941 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 0.65882 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.32941 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.65882 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +0.50196 0.00000 1.00000 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.50196 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.25098 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +0.86275 0.74510 0.74510 +0.86275 0.74510 0.74510 +0.86275 0.74510 0.74510 +0.86275 0.74510 0.74510 +0.86275 0.74510 0.74510 +0.86667 0.74510 0.74510 +0.86667 0.74510 0.74510 +0.86667 0.74510 0.74510 +0.86667 0.74510 0.74510 +0.86667 0.74510 0.74510 +0.87059 0.74510 0.74510 +0.87059 0.74510 0.74510 +0.87059 0.74510 0.74510 +0.87059 0.74510 0.74510 +0.87059 0.74510 0.74510 +0.87451 0.74510 0.74510 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +0.86275 0.86275 0.86275 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl14.lut b/vendor/x11iraf/ximtool/luts/idl14.lut new file mode 100644 index 00000000..b253b2fc --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl14.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.16471 0.00000 +0.00000 0.33333 0.00000 +0.00000 0.49804 0.00000 +0.00000 0.66667 0.00000 +0.00000 0.83137 0.00000 +0.00000 1.00000 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.92549 0.00000 +0.00000 0.88627 0.00000 +0.00000 0.84706 0.00000 +0.00000 0.80784 0.00000 +0.00000 0.77255 0.00000 +0.00000 0.73333 0.00000 +0.00000 0.69412 0.00000 +0.00000 0.65490 0.00000 +0.00000 0.61569 0.00000 +0.00000 0.58039 0.00000 +0.00000 0.54118 0.00000 +0.00000 0.50196 0.00000 +0.00000 0.46275 0.00000 +0.00000 0.42353 0.00000 +0.00000 0.38824 0.00000 +0.00000 0.34902 0.00000 +0.00000 0.30980 0.00000 +0.00000 0.27059 0.00000 +0.00000 0.23137 0.00000 +0.00000 0.19608 0.00000 +0.00000 0.15686 0.00000 +0.00000 0.11765 0.00000 +0.00000 0.07843 0.00000 +0.00000 0.03922 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.03137 +0.00000 0.00000 0.06275 +0.00000 0.00000 0.09412 +0.00000 0.00000 0.12549 +0.00000 0.00000 0.16078 +0.00000 0.00000 0.19216 +0.00000 0.00000 0.22353 +0.00000 0.00000 0.25490 +0.00000 0.00000 0.29020 +0.00000 0.00000 0.32157 +0.00000 0.00000 0.35294 +0.00000 0.00000 0.38431 +0.00000 0.00000 0.41569 +0.00000 0.00000 0.45098 +0.00000 0.00000 0.48235 +0.00000 0.00000 0.51373 +0.00000 0.00000 0.54510 +0.00000 0.00000 0.58039 +0.00000 0.00000 0.61176 +0.00000 0.00000 0.64314 +0.00000 0.00000 0.67451 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.74118 +0.00000 0.00000 0.77255 +0.00000 0.00000 0.80392 +0.00000 0.00000 0.83529 +0.00000 0.00000 0.87059 +0.00000 0.00000 0.90196 +0.00000 0.00000 0.93333 +0.00000 0.00000 0.96471 +0.00000 0.00000 1.00000 +0.00000 0.00000 0.00000 +0.02745 0.00000 0.01961 +0.05882 0.00000 0.03922 +0.09020 0.00000 0.05882 +0.12157 0.00000 0.08235 +0.15294 0.00000 0.10196 +0.18431 0.00000 0.12157 +0.21569 0.00000 0.14510 +0.24706 0.00000 0.16471 +0.27451 0.00000 0.18431 +0.30588 0.00000 0.20784 +0.33725 0.00000 0.22745 +0.36863 0.00000 0.24706 +0.40000 0.00000 0.27059 +0.43137 0.00000 0.29020 +0.46275 0.00000 0.30980 +0.49412 0.00000 0.33333 +0.52549 0.00000 0.34902 +0.55686 0.00000 0.36863 +0.59216 0.00000 0.38431 +0.62353 0.00000 0.40392 +0.65882 0.00000 0.42353 +0.69020 0.00000 0.43922 +0.72157 0.00000 0.45882 +0.75686 0.00000 0.47451 +0.78824 0.00000 0.49412 +0.82353 0.00000 0.51373 +0.85490 0.00000 0.52941 +0.88627 0.00000 0.54902 +0.92157 0.00000 0.56471 +0.95294 0.00000 0.58431 +0.98824 0.00000 0.60392 +0.00000 0.00000 0.00000 +0.00392 0.00000 0.00000 +0.00784 0.00000 0.00000 +0.01176 0.00000 0.00000 +0.01569 0.00000 0.00000 +0.01961 0.00000 0.00000 +0.02353 0.00000 0.00000 +0.02745 0.00000 0.00000 +0.03137 0.00000 0.00000 +0.03529 0.00000 0.00000 +0.03922 0.00000 0.00000 +0.04314 0.00000 0.00000 +0.04706 0.00000 0.00000 +0.05490 0.00000 0.00000 +0.06275 0.00000 0.00000 +0.07059 0.00000 0.00000 +0.07843 0.00000 0.00000 +0.09020 0.00000 0.00000 +0.09804 0.00000 0.00000 +0.10588 0.00000 0.00000 +0.11373 0.00000 0.00000 +0.12549 0.00000 0.00000 +0.13333 0.00000 0.00000 +0.14118 0.00000 0.00000 +0.14902 0.00000 0.00000 +0.16078 0.00000 0.00000 +0.17255 0.00000 0.00000 +0.18431 0.00000 0.00000 +0.19608 0.00000 0.00000 +0.20784 0.00000 0.00000 +0.21961 0.00000 0.00000 +0.23137 0.00000 0.00000 +0.24706 0.00000 0.00000 +0.25882 0.00000 0.00000 +0.27059 0.00000 0.00000 +0.28235 0.00000 0.00000 +0.29412 0.00000 0.00000 +0.30588 0.00000 0.00000 +0.32157 0.00000 0.00392 +0.33333 0.00000 0.00392 +0.34902 0.00000 0.00392 +0.36471 0.00000 0.00392 +0.38039 0.00000 0.00392 +0.39608 0.00000 0.00392 +0.41176 0.00000 0.00392 +0.42353 0.00000 0.00392 +0.43922 0.00000 0.00392 +0.45490 0.00000 0.00392 +0.47059 0.00000 0.00392 +0.48627 0.00000 0.00392 +0.50196 0.00392 0.00392 +0.51373 0.00392 0.00392 +0.52941 0.00392 0.00392 +0.54510 0.00392 0.00392 +0.56078 0.00392 0.00392 +0.57647 0.00392 0.00392 +0.59216 0.00392 0.00392 +0.60784 0.00392 0.00392 +0.62353 0.00392 0.00392 +0.63922 0.00392 0.00392 +0.65490 0.00392 0.00392 +0.67059 0.00392 0.00392 +0.68627 0.00392 0.00392 +0.69804 0.00392 0.00392 +0.70980 0.00392 0.00392 +0.72549 0.00392 0.00392 +0.73725 0.00392 0.00392 +0.75294 0.00392 0.00392 +0.76471 0.00392 0.00392 +0.77647 0.00392 0.00392 +0.79216 0.00392 0.00392 +0.80392 0.00392 0.00392 +0.81961 0.00392 0.00392 +0.83137 0.00392 0.00392 +0.84706 0.00392 0.00784 +0.85490 0.00392 0.00784 +0.86275 0.00392 0.00784 +0.87451 0.00392 0.00784 +0.88235 0.00392 0.00784 +0.89020 0.00392 0.00784 +0.90196 0.00392 0.00784 +0.90980 0.00392 0.00784 +0.91765 0.00392 0.00784 +0.92941 0.00392 0.00784 +0.93725 0.00392 0.00784 +0.94510 0.00392 0.00784 +0.95686 0.00784 0.00784 +0.95686 0.00784 0.00784 +0.96078 0.00784 0.00784 +0.96471 0.00784 0.00784 +0.96863 0.00784 0.00784 +0.96863 0.00784 0.00784 +0.97255 0.00784 0.00784 +0.97647 0.00784 0.00784 +0.98039 0.00784 0.00784 +0.98039 0.00784 0.00784 +0.98431 0.00784 0.00784 +0.98824 0.00784 0.00784 +0.99216 0.00784 0.00784 +0.99608 0.00392 0.00784 +0.99608 0.00392 0.00784 +0.99608 0.01176 0.00784 +0.99608 0.01961 0.00784 +0.99608 0.03137 0.00784 +0.99608 0.03922 0.00784 +0.99608 0.04706 0.00784 +0.99608 0.05882 0.00784 +0.99608 0.06667 0.00784 +0.99608 0.07451 0.00784 +0.99608 0.08627 0.00784 +0.99608 0.09412 0.00784 +0.99608 0.10196 0.00784 +0.99608 0.11373 0.00784 +0.99608 0.12157 0.00784 +0.99608 0.12941 0.00784 +0.99608 0.14118 0.00784 +0.99608 0.14118 0.00784 +0.99608 0.14902 0.01176 +0.99608 0.15686 0.01569 +0.99608 0.16471 0.01961 +1.00000 0.17647 0.02745 +1.00000 0.18824 0.03529 +1.00000 0.20000 0.04706 +1.00000 0.21176 0.05490 +1.00000 0.22745 0.06667 +1.00000 0.23922 0.07843 +1.00000 0.25098 0.09020 +1.00000 0.26275 0.10588 +1.00000 0.27451 0.11765 +1.00000 0.28627 0.13333 +1.00000 0.30196 0.15294 +1.00000 0.32157 0.17255 +1.00000 0.34118 0.19216 +1.00000 0.36078 0.21569 +1.00000 0.37647 0.23529 +1.00000 0.39216 0.25490 +1.00000 0.40784 0.27843 +1.00000 0.42353 0.29804 +1.00000 0.44314 0.32157 +1.00000 0.46667 0.34902 +1.00000 0.49020 0.38039 +1.00000 0.51373 0.40784 +1.00000 0.54118 0.43922 +1.00000 0.56471 0.47059 +1.00000 0.59216 0.50196 +1.00000 0.61569 0.53333 +1.00000 0.64314 0.56863 +1.00000 0.67059 0.60000 +1.00000 0.69804 0.63529 +1.00000 0.72549 0.67059 +1.00000 0.75686 0.70588 +1.00000 0.78431 0.74118 +1.00000 0.81569 0.77647 +1.00000 0.84314 0.81176 +1.00000 0.87451 0.85098 +1.00000 0.89804 0.87843 +1.00000 0.92157 0.90980 +1.00000 0.94902 0.93725 +1.00000 0.97255 0.96863 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl15.lut b/vendor/x11iraf/ximtool/luts/idl15.lut new file mode 100644 index 00000000..7fbbdc5e --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl15.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.07059 0.00392 0.00392 +0.14118 0.00784 0.01176 +0.21176 0.01176 0.01961 +0.28235 0.01569 0.02745 +0.35294 0.01961 0.03529 +0.42353 0.02353 0.04314 +0.49804 0.02745 0.05098 +0.56863 0.03137 0.05882 +0.63922 0.03529 0.06667 +0.70980 0.03922 0.07451 +0.78039 0.04314 0.08235 +0.85098 0.04706 0.09020 +0.92157 0.05098 0.09804 +0.99608 0.05490 0.10588 +0.97647 0.05882 0.11373 +0.95686 0.06275 0.12157 +0.93725 0.06667 0.12941 +0.91765 0.07059 0.13725 +0.89804 0.07451 0.14510 +0.87451 0.07843 0.15294 +0.85490 0.08235 0.16078 +0.83529 0.08627 0.16863 +0.81569 0.09020 0.17647 +0.79608 0.09412 0.18431 +0.77255 0.09804 0.19216 +0.75294 0.10196 0.20000 +0.73333 0.10588 0.20784 +0.71373 0.10980 0.21569 +0.69412 0.11373 0.22353 +0.67451 0.11765 0.23137 +0.65098 0.12157 0.23922 +0.63137 0.12549 0.24706 +0.61176 0.12941 0.25490 +0.59216 0.13333 0.26275 +0.57255 0.13725 0.27059 +0.54902 0.14118 0.27843 +0.52941 0.14510 0.28627 +0.50980 0.14902 0.29412 +0.49020 0.15294 0.30196 +0.47059 0.15686 0.30980 +0.45098 0.16078 0.31765 +0.42745 0.16471 0.32549 +0.40784 0.16863 0.33333 +0.38824 0.17255 0.34118 +0.36863 0.17647 0.34902 +0.34902 0.18039 0.35686 +0.32549 0.18431 0.36471 +0.30588 0.18824 0.37255 +0.28627 0.19216 0.38039 +0.26667 0.19608 0.38824 +0.24706 0.20000 0.39608 +0.22745 0.20392 0.40392 +0.20392 0.20784 0.41176 +0.18431 0.21176 0.41961 +0.16471 0.21569 0.42745 +0.14510 0.21961 0.43529 +0.12549 0.22353 0.44314 +0.10196 0.22745 0.45098 +0.08235 0.23137 0.45882 +0.06275 0.23529 0.46667 +0.04314 0.23922 0.47451 +0.02353 0.24314 0.48235 +0.00000 0.24706 0.49020 +0.25098 0.25098 0.49804 +0.25490 0.25490 0.50588 +0.25882 0.25882 0.51373 +0.26275 0.26275 0.52157 +0.26667 0.26667 0.52941 +0.27059 0.27059 0.53725 +0.27451 0.27451 0.54510 +0.27843 0.27843 0.55294 +0.28235 0.28235 0.56078 +0.28627 0.28627 0.56863 +0.29020 0.29020 0.57647 +0.29412 0.29412 0.58431 +0.29804 0.29804 0.59216 +0.30196 0.30196 0.60000 +0.30588 0.30588 0.60784 +0.30980 0.30980 0.61569 +0.31373 0.31373 0.62353 +0.31765 0.31765 0.63137 +0.32157 0.32157 0.63922 +0.32549 0.32549 0.64706 +0.32941 0.32941 0.65490 +0.33333 0.33333 0.66275 +0.33725 0.33725 0.67059 +0.34118 0.34118 0.67843 +0.34510 0.34510 0.68627 +0.34902 0.34902 0.69412 +0.35294 0.35294 0.70196 +0.35686 0.35686 0.70980 +0.36078 0.36078 0.71765 +0.36471 0.36471 0.72549 +0.36863 0.36863 0.73333 +0.37255 0.37255 0.74118 +0.37647 0.37647 0.74902 +0.38039 0.38039 0.75686 +0.38431 0.38431 0.76471 +0.38824 0.38824 0.77255 +0.39216 0.39216 0.78039 +0.39608 0.39608 0.78824 +0.40000 0.40000 0.79608 +0.40392 0.40392 0.80392 +0.40784 0.40784 0.81176 +0.41176 0.41176 0.81961 +0.41569 0.41569 0.82745 +0.41961 0.41961 0.83529 +0.42353 0.42353 0.84314 +0.42745 0.42745 0.85098 +0.43137 0.43137 0.85882 +0.43529 0.43529 0.86667 +0.43922 0.43922 0.87451 +0.44314 0.44314 0.88235 +0.44706 0.44706 0.89020 +0.45098 0.45098 0.89804 +0.45490 0.45490 0.90588 +0.45882 0.45882 0.91373 +0.46275 0.46275 0.92157 +0.46667 0.46667 0.92941 +0.47059 0.47059 0.93725 +0.47451 0.47451 0.94510 +0.47843 0.47843 0.95294 +0.48235 0.48235 0.96078 +0.48627 0.48627 0.96863 +0.49020 0.49020 0.97647 +0.49412 0.49412 0.98431 +0.49804 0.49804 0.99216 +0.50196 0.50196 1.00000 +0.50588 0.50588 0.98431 +0.50980 0.50980 0.96863 +0.51373 0.51373 0.95294 +0.51765 0.51765 0.93333 +0.52157 0.52157 0.91765 +0.52549 0.52549 0.90196 +0.52941 0.52941 0.88627 +0.53333 0.53333 0.86667 +0.53725 0.53725 0.85098 +0.54118 0.54118 0.83529 +0.54510 0.54510 0.81961 +0.54902 0.54902 0.80000 +0.55294 0.55294 0.78431 +0.55686 0.55686 0.76863 +0.56078 0.56078 0.75294 +0.56471 0.56471 0.73333 +0.56863 0.56863 0.71765 +0.57255 0.57255 0.70196 +0.57647 0.57647 0.68627 +0.58039 0.58039 0.66667 +0.58431 0.58431 0.65098 +0.58824 0.58824 0.63529 +0.59216 0.59216 0.61961 +0.59608 0.59608 0.60000 +0.60000 0.60000 0.58431 +0.60392 0.60392 0.56863 +0.60784 0.60784 0.55294 +0.61176 0.61176 0.53333 +0.61569 0.61569 0.51765 +0.61961 0.61961 0.50196 +0.62353 0.62353 0.48627 +0.62745 0.62745 0.46667 +0.63137 0.63137 0.45098 +0.63529 0.63529 0.43529 +0.63922 0.63922 0.41961 +0.64314 0.64314 0.40000 +0.64706 0.64706 0.38431 +0.65098 0.65098 0.36863 +0.65490 0.65490 0.35294 +0.65882 0.65882 0.33333 +0.66275 0.66275 0.31765 +0.66667 0.66667 0.30196 +0.67059 0.67059 0.28627 +0.67451 0.67451 0.26667 +0.67843 0.67843 0.25098 +0.68235 0.68235 0.23529 +0.68627 0.68627 0.21961 +0.69020 0.69020 0.20000 +0.69412 0.69412 0.18431 +0.69804 0.69804 0.16863 +0.70196 0.70196 0.15294 +0.70588 0.70588 0.13333 +0.70980 0.70980 0.11765 +0.71373 0.71373 0.10196 +0.71765 0.71765 0.08627 +0.72157 0.72157 0.06667 +0.72549 0.72549 0.05098 +0.72941 0.72941 0.03529 +0.73333 0.73333 0.01961 +0.73725 0.73725 0.00000 +0.74118 0.74118 0.01176 +0.74510 0.74510 0.02745 +0.74902 0.74902 0.04314 +0.75294 0.75294 0.05882 +0.75686 0.75686 0.07451 +0.76078 0.76078 0.08627 +0.76471 0.76471 0.10196 +0.76863 0.76863 0.11765 +0.77255 0.77255 0.13333 +0.77647 0.77647 0.14902 +0.78039 0.78039 0.16078 +0.78431 0.78431 0.17647 +0.78824 0.78824 0.19216 +0.79216 0.79216 0.20784 +0.79608 0.79608 0.22353 +0.80000 0.80000 0.23529 +0.80392 0.80392 0.25098 +0.80784 0.80784 0.26667 +0.81176 0.81176 0.28235 +0.81569 0.81569 0.29804 +0.81961 0.81961 0.30980 +0.82353 0.82353 0.32549 +0.82745 0.82745 0.34118 +0.83137 0.83137 0.35686 +0.83529 0.83529 0.37255 +0.83922 0.83922 0.38431 +0.84314 0.84314 0.40000 +0.84706 0.84706 0.41569 +0.85098 0.85098 0.43137 +0.85490 0.85490 0.44706 +0.85882 0.85882 0.45882 +0.86275 0.86275 0.47451 +0.86667 0.86667 0.49020 +0.87059 0.87059 0.50588 +0.87451 0.87451 0.52157 +0.87843 0.87843 0.53725 +0.88235 0.88235 0.54902 +0.88627 0.88627 0.56471 +0.89020 0.89020 0.58039 +0.89412 0.89412 0.59608 +0.89804 0.89804 0.61176 +0.90196 0.90196 0.62353 +0.90588 0.90588 0.63922 +0.90980 0.90980 0.65490 +0.91373 0.91373 0.67059 +0.91765 0.91765 0.68627 +0.92157 0.92157 0.69804 +0.92549 0.92549 0.71373 +0.92941 0.92941 0.72941 +0.93333 0.93333 0.74510 +0.93725 0.93725 0.76078 +0.94118 0.94118 0.77255 +0.94510 0.94510 0.78824 +0.94902 0.94902 0.80392 +0.95294 0.95294 0.81961 +0.95686 0.95686 0.83529 +0.96078 0.96078 0.84706 +0.96471 0.96471 0.86275 +0.96863 0.96863 0.87843 +0.97255 0.97255 0.89412 +0.97647 0.97647 0.90980 +0.98039 0.98039 0.92157 +0.98431 0.98431 0.93725 +0.98824 0.98824 0.95294 +0.99216 0.99216 0.96863 +0.99608 0.99608 0.98431 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl2.lut b/vendor/x11iraf/ximtool/luts/idl2.lut new file mode 100644 index 00000000..beb24271 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl2.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.14118 0.00000 +0.00000 0.28235 0.00000 +0.00000 0.29412 0.00000 +0.00000 0.30980 0.00000 +0.00000 0.32157 0.00000 +0.00000 0.33725 0.00000 +0.00000 0.35294 0.00000 +0.00000 0.36471 0.00000 +0.00000 0.38039 0.00000 +0.00000 0.39216 0.00000 +0.00000 0.40784 0.00000 +0.00000 0.42353 0.00000 +0.00000 0.45882 0.00000 +0.00000 0.49412 0.00000 +0.00000 0.52941 0.00000 +0.00000 0.56471 0.00000 +0.00000 0.60000 0.00000 +0.00000 0.63529 0.00000 +0.00000 0.67059 0.00000 +0.00000 0.70588 0.00000 +0.00000 0.74118 0.00000 +0.00000 0.77647 0.00000 +0.00000 0.81176 0.00000 +0.00000 0.84706 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.91765 0.00000 +0.00000 0.95294 0.00000 +0.00000 0.98824 0.00000 +0.02353 0.97647 0.00000 +0.04706 0.96471 0.00000 +0.07059 0.95294 0.00000 +0.09412 0.94118 0.00000 +0.11765 0.91765 0.00000 +0.14118 0.89412 0.00000 +0.16471 0.87059 0.00000 +0.18824 0.84706 0.00000 +0.21176 0.82353 0.00000 +0.23529 0.80000 0.00000 +0.25882 0.77647 0.00000 +0.28235 0.75294 0.00000 +0.30588 0.72941 0.00000 +0.32941 0.70588 0.00000 +0.35294 0.68235 0.00000 +0.37647 0.65882 0.00000 +0.40000 0.63529 0.00000 +0.42353 0.61176 0.00000 +0.44706 0.58824 0.00000 +0.47059 0.56471 0.00000 +0.49412 0.54118 0.00000 +0.51765 0.51765 0.00000 +0.54118 0.49412 0.00000 +0.56471 0.47059 0.00000 +0.58824 0.44706 0.00000 +0.61176 0.42353 0.00000 +0.63529 0.40000 0.00000 +0.65882 0.37647 0.00000 +0.68235 0.35294 0.00000 +0.70588 0.32941 0.00000 +0.72941 0.30588 0.00000 +0.75294 0.28235 0.00000 +0.77647 0.25882 0.00000 +0.80000 0.23529 0.00000 +0.82353 0.21176 0.00000 +0.84706 0.18824 0.00000 +0.87059 0.16471 0.00000 +0.89412 0.14118 0.00000 +0.91765 0.11765 0.00000 +0.94118 0.09412 0.00000 +0.95294 0.07059 0.00000 +0.96471 0.04706 0.00000 +0.97647 0.02353 0.00000 +0.98824 0.00000 0.00000 +0.98824 0.00000 0.00000 +0.98824 0.00000 0.00000 +0.98824 0.00000 0.00000 +0.98824 0.00000 0.00392 +0.98431 0.00000 0.01176 +0.98039 0.00000 0.01961 +0.97647 0.00000 0.02745 +0.97255 0.00000 0.03529 +0.97255 0.00000 0.03922 +0.97255 0.00000 0.04706 +0.97255 0.00000 0.05490 +0.97255 0.00000 0.06275 +0.96863 0.00000 0.07059 +0.96471 0.00000 0.07843 +0.96078 0.00000 0.08627 +0.95686 0.00000 0.09804 +0.95294 0.00000 0.10588 +0.94902 0.00000 0.11373 +0.94510 0.00000 0.12157 +0.94118 0.00000 0.13333 +0.94118 0.00000 0.13725 +0.93725 0.00000 0.14510 +0.93333 0.00000 0.15294 +0.92941 0.00000 0.16078 +0.92549 0.00000 0.16863 +0.92549 0.00000 0.17647 +0.92549 0.00000 0.18431 +0.92549 0.00000 0.19608 +0.92157 0.00000 0.20392 +0.91765 0.00000 0.21176 +0.91373 0.00000 0.21961 +0.90980 0.00000 0.23137 +0.90588 0.00000 0.23922 +0.90196 0.00000 0.24706 +0.89804 0.00000 0.25490 +0.89412 0.00000 0.26275 +0.89412 0.00000 0.26667 +0.89412 0.00000 0.27451 +0.89412 0.00000 0.28235 +0.89412 0.00000 0.29020 +0.89020 0.00000 0.29804 +0.88627 0.00000 0.30588 +0.88235 0.00000 0.31373 +0.87843 0.00000 0.32549 +0.87451 0.00000 0.33333 +0.87059 0.00000 0.34118 +0.86667 0.00000 0.34902 +0.86275 0.00392 0.36078 +0.85882 0.00392 0.36863 +0.85490 0.00392 0.37647 +0.85098 0.00392 0.38431 +0.84706 0.00000 0.39608 +0.84706 0.00000 0.40000 +0.84706 0.00000 0.40784 +0.84706 0.00000 0.41569 +0.84706 0.00000 0.42353 +0.84314 0.00000 0.43137 +0.83922 0.00000 0.43922 +0.83529 0.00000 0.44706 +0.83137 0.00000 0.45490 +0.82745 0.00000 0.46275 +0.82353 0.00000 0.47059 +0.81961 0.00000 0.47843 +0.81569 0.00000 0.49020 +0.81176 0.00000 0.49804 +0.80784 0.00000 0.50588 +0.80392 0.00000 0.51373 +0.80000 0.00000 0.52549 +0.80000 0.00000 0.52941 +0.80000 0.00000 0.53725 +0.80000 0.00000 0.54510 +0.80000 0.00000 0.55294 +0.79608 0.00000 0.56078 +0.79216 0.00000 0.56863 +0.78824 0.00000 0.57647 +0.78431 0.00000 0.58824 +0.78039 0.00000 0.59608 +0.77647 0.00000 0.60392 +0.77255 0.00000 0.61176 +0.76863 0.00000 0.62353 +0.76863 0.00000 0.62745 +0.76863 0.00000 0.63529 +0.76863 0.00000 0.63922 +0.76863 0.00000 0.64706 +0.76471 0.00000 0.65490 +0.76078 0.00000 0.66275 +0.75686 0.00000 0.67059 +0.75294 0.00000 0.68235 +0.74902 0.00000 0.69020 +0.74510 0.00000 0.69804 +0.74118 0.00000 0.70588 +0.73725 0.00000 0.71765 +0.73333 0.00000 0.72549 +0.72941 0.00000 0.73333 +0.72549 0.00000 0.74118 +0.72157 0.00000 0.75294 +0.72157 0.00000 0.75686 +0.72157 0.00000 0.76471 +0.72157 0.00000 0.77255 +0.72157 0.00000 0.78039 +0.71765 0.00000 0.78824 +0.71373 0.00000 0.79608 +0.70980 0.00000 0.80392 +0.70588 0.00000 0.81569 +0.70196 0.00000 0.82353 +0.69804 0.00000 0.83137 +0.69412 0.00000 0.83922 +0.69020 0.00000 0.84706 +0.69020 0.00000 0.85098 +0.69020 0.00000 0.85882 +0.69020 0.00000 0.86667 +0.69020 0.00000 0.87451 +0.68627 0.00000 0.88235 +0.68235 0.00000 0.89020 +0.67843 0.00000 0.89804 +0.67451 0.00000 0.90980 +0.67059 0.00000 0.91765 +0.66667 0.00000 0.92549 +0.66275 0.00000 0.93333 +0.65882 0.00000 0.94510 +0.65490 0.00000 0.95294 +0.65098 0.00000 0.96078 +0.64706 0.00000 0.96863 +0.64314 0.00000 0.98039 +0.64314 0.00000 0.98431 +0.64314 0.00000 0.98824 +0.64314 0.00000 0.99216 +0.64314 0.00000 1.00000 +0.63922 0.00000 1.00000 +0.63529 0.00000 1.00000 +0.63137 0.00000 1.00000 +0.62745 0.00000 1.00000 +0.62353 0.00000 1.00000 +0.61961 0.00000 1.00000 +0.61569 0.00000 1.00000 +0.61176 0.00000 1.00000 +0.60784 0.00000 1.00000 +0.60392 0.00000 1.00000 +0.60000 0.00000 1.00000 +0.59608 0.00000 1.00000 +0.59608 0.00000 1.00000 +0.59608 0.00000 1.00000 +0.59608 0.00000 1.00000 +0.59608 0.00000 1.00000 +0.59216 0.00000 1.00000 +0.58824 0.00000 1.00000 +0.58431 0.00000 1.00000 +0.58039 0.00000 1.00000 +0.59216 0.03137 1.00000 +0.60392 0.06275 1.00000 +0.61569 0.09412 1.00000 +0.62745 0.12549 1.00000 +0.63922 0.15686 1.00000 +0.65098 0.18824 1.00000 +0.66275 0.21961 1.00000 +0.67451 0.25098 1.00000 +0.69020 0.28235 1.00000 +0.70588 0.31373 1.00000 +0.72157 0.34510 1.00000 +0.73725 0.37647 1.00000 +0.74902 0.40784 1.00000 +0.76078 0.43922 1.00000 +0.77255 0.47059 1.00000 +0.78431 0.50196 1.00000 +0.79608 0.52941 1.00000 +0.80784 0.55686 1.00000 +0.81961 0.58431 1.00000 +0.83137 0.61176 1.00000 +0.84314 0.64314 1.00000 +0.85490 0.67451 1.00000 +0.86667 0.70588 1.00000 +0.87843 0.73725 1.00000 +0.89412 0.76863 1.00000 +0.90980 0.80000 1.00000 +0.92549 0.83137 1.00000 +0.94118 0.86275 1.00000 +0.95294 0.89412 1.00000 +0.96471 0.92549 1.00000 +0.97647 0.95686 1.00000 +0.98824 0.98824 1.00000 +0.99216 0.99216 1.00000 +0.99608 0.99608 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl4.lut b/vendor/x11iraf/ximtool/luts/idl4.lut new file mode 100644 index 00000000..fad325f4 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl4.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00784 +0.00000 0.00000 0.01569 +0.00000 0.00000 0.02353 +0.00000 0.00000 0.03137 +0.00000 0.00000 0.03922 +0.00000 0.00000 0.04706 +0.00000 0.00000 0.05490 +0.00000 0.00000 0.06275 +0.00000 0.00000 0.07059 +0.00000 0.00000 0.07843 +0.00000 0.00000 0.08627 +0.00000 0.00000 0.09804 +0.00000 0.00000 0.10588 +0.00000 0.00000 0.11373 +0.00000 0.00000 0.12157 +0.00000 0.00000 0.12941 +0.00000 0.00000 0.13725 +0.00000 0.00000 0.14510 +0.00000 0.00000 0.15294 +0.00000 0.00000 0.16078 +0.00000 0.00000 0.16863 +0.00000 0.00000 0.17647 +0.00000 0.00000 0.18431 +0.00000 0.00000 0.19608 +0.00000 0.00000 0.20392 +0.00000 0.00000 0.21176 +0.00000 0.00000 0.21961 +0.00000 0.00000 0.22745 +0.00000 0.00000 0.23529 +0.00000 0.00000 0.24314 +0.00000 0.00000 0.25098 +0.00000 0.00000 0.25882 +0.00000 0.01176 0.26667 +0.00000 0.02353 0.27451 +0.00000 0.03529 0.28235 +0.00000 0.04706 0.29412 +0.00000 0.05882 0.30196 +0.00000 0.07059 0.30980 +0.00000 0.08235 0.31765 +0.00000 0.09804 0.32549 +0.00000 0.10980 0.33333 +0.00000 0.12157 0.34118 +0.00000 0.13333 0.34902 +0.00000 0.14510 0.35686 +0.00000 0.15686 0.36471 +0.00000 0.16863 0.37255 +0.00000 0.18039 0.38039 +0.00000 0.19608 0.39216 +0.00000 0.20784 0.39216 +0.00000 0.21961 0.39216 +0.00000 0.23137 0.39216 +0.00000 0.24314 0.39216 +0.00000 0.25490 0.39216 +0.00000 0.26667 0.39216 +0.00000 0.27843 0.39216 +0.00000 0.29412 0.39216 +0.00000 0.30588 0.39216 +0.00000 0.31765 0.39216 +0.00000 0.32941 0.39216 +0.00000 0.34118 0.39216 +0.00000 0.35294 0.39216 +0.00000 0.36471 0.39216 +0.00000 0.37647 0.39216 +0.00000 0.39216 0.39216 +0.00000 0.40392 0.39216 +0.00000 0.41569 0.39216 +0.00000 0.42745 0.39216 +0.00000 0.43922 0.39216 +0.00000 0.45098 0.39216 +0.00000 0.46275 0.39216 +0.00000 0.47451 0.39216 +0.00000 0.49020 0.39216 +0.00000 0.50196 0.39216 +0.00000 0.51373 0.39216 +0.00000 0.52549 0.39216 +0.00000 0.53725 0.39216 +0.00000 0.54902 0.39216 +0.00000 0.56078 0.39216 +0.00000 0.57255 0.39216 +0.00000 0.58824 0.39216 +0.00000 0.58824 0.37647 +0.00000 0.58824 0.36471 +0.00000 0.58824 0.35294 +0.00000 0.58824 0.34118 +0.00000 0.58824 0.32941 +0.00000 0.58824 0.31765 +0.00000 0.58824 0.30588 +0.00000 0.58824 0.29412 +0.00000 0.58824 0.27843 +0.00000 0.58824 0.26667 +0.00000 0.58824 0.25490 +0.00000 0.58824 0.24314 +0.00000 0.58824 0.23137 +0.00000 0.58824 0.21961 +0.00000 0.58824 0.20784 +0.00000 0.58824 0.19608 +0.00000 0.58431 0.18039 +0.00000 0.58039 0.16863 +0.00000 0.58039 0.15686 +0.00000 0.57647 0.14510 +0.00000 0.57255 0.13333 +0.00000 0.57255 0.12157 +0.00000 0.56863 0.10980 +0.00000 0.56863 0.09804 +0.00000 0.56471 0.08235 +0.00000 0.56078 0.07059 +0.00000 0.56078 0.05882 +0.00000 0.55686 0.04706 +0.00000 0.55294 0.03529 +0.00000 0.55294 0.02353 +0.00000 0.54902 0.01176 +0.00000 0.54902 0.00000 +0.02745 0.53725 0.00000 +0.05882 0.52941 0.00000 +0.08627 0.51765 0.00000 +0.11765 0.50980 0.00000 +0.14510 0.49804 0.00000 +0.17647 0.49020 0.00000 +0.20392 0.47843 0.00000 +0.23529 0.47059 0.00000 +0.26275 0.45882 0.00000 +0.29412 0.45098 0.00000 +0.32157 0.43922 0.00000 +0.35294 0.43137 0.00000 +0.38039 0.41961 0.00000 +0.41176 0.41176 0.00000 +0.43922 0.40000 0.00000 +0.47059 0.39216 0.00000 +0.49020 0.36471 0.00000 +0.50980 0.34118 0.00000 +0.52941 0.31765 0.00000 +0.54902 0.29412 0.00000 +0.56863 0.26667 0.00000 +0.58824 0.24314 0.00000 +0.60784 0.21961 0.00000 +0.62745 0.19608 0.00000 +0.64706 0.16863 0.00000 +0.66667 0.14510 0.00000 +0.68627 0.12157 0.00000 +0.70588 0.09804 0.00000 +0.72549 0.07059 0.00000 +0.74510 0.04706 0.00000 +0.76471 0.02353 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00784 0.00000 +0.78824 0.01569 0.00000 +0.78824 0.02353 0.00000 +0.79216 0.03529 0.00000 +0.79216 0.04314 0.00000 +0.79608 0.05098 0.00000 +0.79608 0.06275 0.00000 +0.80000 0.07059 0.00000 +0.80000 0.07843 0.00000 +0.80392 0.09020 0.00000 +0.80392 0.09804 0.00000 +0.80784 0.10588 0.00000 +0.80784 0.11373 0.00000 +0.81176 0.12549 0.00000 +0.81176 0.13333 0.00000 +0.81569 0.14118 0.00000 +0.81569 0.15294 0.00000 +0.81961 0.16078 0.00000 +0.81961 0.16863 0.00000 +0.82353 0.18039 0.00000 +0.82353 0.18824 0.00000 +0.82745 0.19608 0.00000 +0.82745 0.20784 0.00000 +0.83137 0.21569 0.00000 +0.83137 0.22353 0.00000 +0.83529 0.23137 0.00000 +0.83529 0.24314 0.00000 +0.83922 0.25098 0.00000 +0.83922 0.25882 0.00000 +0.84314 0.27059 0.00000 +0.84314 0.27843 0.00000 +0.84706 0.28627 0.00000 +0.84706 0.29804 0.00000 +0.85098 0.30588 0.00000 +0.85098 0.31373 0.00000 +0.85490 0.32549 0.00000 +0.85490 0.33333 0.00000 +0.85882 0.34118 0.00000 +0.85882 0.34902 0.00000 +0.86275 0.36078 0.00000 +0.86275 0.36863 0.00000 +0.86667 0.37647 0.00000 +0.86667 0.38824 0.00000 +0.87059 0.39608 0.00000 +0.87059 0.40392 0.00000 +0.87451 0.41569 0.00000 +0.87451 0.42353 0.00000 +0.87843 0.43137 0.00000 +0.87843 0.44314 0.00000 +0.88235 0.45098 0.00000 +0.88235 0.45882 0.00000 +0.88627 0.46667 0.00000 +0.88627 0.47843 0.00000 +0.89020 0.48627 0.00000 +0.89020 0.49412 0.00000 +0.89412 0.50588 0.00000 +0.89412 0.51373 0.00000 +0.89804 0.52157 0.00000 +0.89804 0.53333 0.00000 +0.90196 0.54118 0.00000 +0.90196 0.54902 0.00000 +0.90588 0.55686 0.00000 +0.90588 0.56863 0.00000 +0.90980 0.57647 0.00000 +0.90980 0.58431 0.00000 +0.91373 0.59608 0.00000 +0.91373 0.60392 0.00000 +0.91765 0.61176 0.00000 +0.91765 0.62353 0.00000 +0.92157 0.63137 0.00000 +0.92157 0.63922 0.00000 +0.92549 0.65098 0.00000 +0.92549 0.65882 0.00000 +0.92941 0.66667 0.00000 +0.92941 0.67451 0.00000 +0.93333 0.68627 0.00000 +0.93333 0.69412 0.00000 +0.93725 0.70196 0.00000 +0.93725 0.71373 0.00000 +0.94118 0.72157 0.00000 +0.94118 0.72941 0.00000 +0.94510 0.74118 0.00000 +0.94510 0.74902 0.00000 +0.94902 0.75686 0.00000 +0.94902 0.76863 0.00000 +0.95294 0.77647 0.00000 +0.95294 0.78431 0.00000 +0.95686 0.79216 0.00000 +0.95686 0.80392 0.00000 +0.96078 0.81176 0.00000 +0.96078 0.81961 0.00000 +0.96471 0.83137 0.00000 +0.96471 0.83922 0.00000 +0.96863 0.84706 0.00000 +0.96863 0.85882 0.00000 +0.97255 0.86667 0.00000 +0.97255 0.87451 0.00000 +0.97647 0.88627 0.00000 +0.97647 0.89412 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90980 0.00000 +0.98431 0.92157 0.00000 +0.98431 0.92941 0.00000 +0.98824 0.93725 0.00000 +0.98824 0.94902 0.00000 +0.99216 0.95686 0.00000 +0.99216 0.96471 0.00000 +0.99608 0.97647 0.00000 +0.99608 0.98431 0.00000 +1.00000 0.99216 0.00000 +1.00000 1.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl5.lut b/vendor/x11iraf/ximtool/luts/idl5.lut new file mode 100644 index 00000000..a557730b --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl5.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.01961 +0.00000 0.00000 0.03922 +0.00000 0.00000 0.05882 +0.00000 0.00000 0.07843 +0.00000 0.00000 0.10196 +0.00000 0.00000 0.12157 +0.00000 0.00000 0.14118 +0.00000 0.00000 0.16078 +0.00000 0.00000 0.18039 +0.00000 0.00000 0.20392 +0.00000 0.00000 0.22353 +0.00000 0.00000 0.24314 +0.00000 0.00000 0.26275 +0.00000 0.00000 0.28235 +0.00000 0.00000 0.30588 +0.00000 0.00000 0.32549 +0.00000 0.00000 0.34510 +0.00000 0.00000 0.36471 +0.00000 0.00000 0.38431 +0.00000 0.00000 0.40784 +0.00000 0.00000 0.42745 +0.00000 0.00000 0.44706 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.48627 +0.00000 0.00000 0.50980 +0.00000 0.00000 0.52941 +0.00000 0.00000 0.54902 +0.00000 0.00000 0.56863 +0.00000 0.00000 0.58824 +0.00000 0.00000 0.61176 +0.00000 0.00000 0.63137 +0.00000 0.00000 0.65098 +0.00000 0.00000 0.67059 +0.00000 0.00000 0.69020 +0.00000 0.00000 0.71373 +0.00000 0.00000 0.73333 +0.00000 0.00000 0.75294 +0.00000 0.00000 0.77255 +0.00000 0.00000 0.79216 +0.00000 0.00000 0.81569 +0.00000 0.00000 0.83529 +0.00000 0.00000 0.85490 +0.00000 0.00000 0.87451 +0.00000 0.00000 0.89412 +0.00000 0.00000 0.91765 +0.00000 0.00000 0.93725 +0.00000 0.00000 0.95686 +0.01569 0.00000 0.97647 +0.03529 0.00000 1.00000 +0.05490 0.00000 0.98039 +0.07451 0.00000 0.96078 +0.09020 0.00000 0.93725 +0.10980 0.00000 0.91765 +0.12941 0.00000 0.89412 +0.14902 0.00000 0.87451 +0.16471 0.00000 0.85490 +0.18431 0.00000 0.83137 +0.20392 0.00000 0.81176 +0.22353 0.00000 0.78824 +0.23922 0.00000 0.76863 +0.25882 0.00000 0.74510 +0.27843 0.00000 0.72549 +0.29804 0.00000 0.70588 +0.31765 0.00000 0.68235 +0.31765 0.00000 0.66275 +0.31765 0.00000 0.63922 +0.31765 0.00000 0.61961 +0.31765 0.00000 0.59608 +0.31765 0.00000 0.57647 +0.31765 0.00000 0.55686 +0.31765 0.00000 0.53333 +0.31373 0.00000 0.51373 +0.31373 0.00000 0.49020 +0.31373 0.00000 0.47059 +0.31373 0.00000 0.44706 +0.31373 0.00000 0.42745 +0.31373 0.00000 0.40784 +0.31373 0.00000 0.38431 +0.30980 0.00000 0.36471 +0.32941 0.00000 0.34118 +0.34902 0.00000 0.32157 +0.36863 0.00000 0.29804 +0.38824 0.00000 0.27843 +0.40784 0.00000 0.25882 +0.42745 0.00000 0.23529 +0.44706 0.00000 0.21569 +0.46667 0.00000 0.19216 +0.48627 0.00000 0.17255 +0.50588 0.00000 0.14902 +0.52549 0.00000 0.12941 +0.54510 0.00000 0.10980 +0.56471 0.00000 0.08627 +0.58431 0.00000 0.06667 +0.60392 0.00000 0.04314 +0.62353 0.00000 0.02353 +0.64314 0.00000 0.00000 +0.66275 0.00000 0.00000 +0.68235 0.00000 0.00000 +0.70588 0.00000 0.00000 +0.72549 0.00000 0.00000 +0.74510 0.00000 0.00000 +0.76863 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.80784 0.00000 0.00000 +0.83137 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.87059 0.00000 0.00000 +0.89412 0.00000 0.00000 +0.91373 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.01961 0.00000 +1.00000 0.03922 0.00000 +1.00000 0.06275 0.00000 +1.00000 0.08235 0.00000 +1.00000 0.10588 0.00000 +1.00000 0.12549 0.00000 +1.00000 0.14510 0.00000 +1.00000 0.16863 0.00000 +1.00000 0.18824 0.00000 +1.00000 0.21176 0.00000 +1.00000 0.23137 0.00000 +1.00000 0.25098 0.00000 +1.00000 0.27451 0.00000 +1.00000 0.29412 0.00000 +1.00000 0.31765 0.00000 +1.00000 0.33333 0.01569 +1.00000 0.35294 0.03529 +1.00000 0.37255 0.05490 +1.00000 0.39216 0.07451 +1.00000 0.41176 0.09412 +1.00000 0.42745 0.10980 +1.00000 0.44706 0.12941 +1.00000 0.46667 0.14902 +1.00000 0.48627 0.16863 +1.00000 0.50588 0.18824 +1.00000 0.52549 0.20784 +1.00000 0.54118 0.22353 +1.00000 0.56078 0.24314 +1.00000 0.58039 0.26275 +1.00000 0.60000 0.28235 +1.00000 0.61961 0.30196 +1.00000 0.63922 0.32157 +1.00000 0.63922 0.30196 +1.00000 0.63922 0.27843 +1.00000 0.63922 0.25490 +1.00000 0.63922 0.23137 +1.00000 0.63922 0.20784 +1.00000 0.63922 0.18431 +1.00000 0.63922 0.16078 +1.00000 0.63922 0.14118 +1.00000 0.63922 0.11765 +1.00000 0.63922 0.09412 +1.00000 0.63922 0.07059 +1.00000 0.63922 0.04706 +1.00000 0.63922 0.02353 +1.00000 0.63922 0.00000 +1.00000 0.63922 0.00000 +1.00000 0.63922 0.00000 +1.00000 0.63922 0.00000 +0.97255 0.63922 0.00000 +0.94118 0.63922 0.00000 +0.90980 0.63922 0.00000 +0.88235 0.63922 0.00000 +0.85098 0.63922 0.00000 +0.81961 0.63922 0.00000 +0.79216 0.63922 0.00000 +0.76078 0.63922 0.00000 +0.72941 0.63922 0.00000 +0.70196 0.63922 0.00000 +0.67059 0.63922 0.00000 +0.63922 0.63922 0.00000 +0.65882 0.63922 0.00000 +0.67843 0.63922 0.00000 +0.69804 0.66275 0.01176 +0.71765 0.68627 0.02353 +0.73725 0.70980 0.03529 +0.75686 0.73333 0.04706 +0.77647 0.75686 0.06275 +0.79608 0.78039 0.07451 +0.81961 0.80392 0.08627 +0.83922 0.83137 0.09804 +0.85882 0.85490 0.11373 +0.87843 0.87843 0.12549 +0.89804 0.90196 0.13725 +0.91765 0.92549 0.14902 +0.93725 0.94902 0.16078 +0.95686 0.97255 0.17647 +0.97647 1.00000 0.18824 +1.00000 1.00000 0.20000 +1.00000 1.00000 0.21176 +1.00000 1.00000 0.22745 +1.00000 1.00000 0.23922 +1.00000 1.00000 0.25098 +1.00000 1.00000 0.26275 +1.00000 1.00000 0.27843 +1.00000 1.00000 0.29020 +1.00000 1.00000 0.30196 +1.00000 1.00000 0.31373 +1.00000 1.00000 0.32549 +1.00000 1.00000 0.34118 +1.00000 1.00000 0.35294 +1.00000 1.00000 0.36471 +1.00000 1.00000 0.37647 +1.00000 1.00000 0.39216 +1.00000 1.00000 0.40392 +1.00000 1.00000 0.41569 +1.00000 1.00000 0.42745 +1.00000 1.00000 0.43922 +1.00000 1.00000 0.45490 +1.00000 1.00000 0.46667 +1.00000 1.00000 0.47843 +1.00000 1.00000 0.49020 +1.00000 1.00000 0.50588 +1.00000 1.00000 0.51765 +1.00000 1.00000 0.52941 +1.00000 1.00000 0.54118 +1.00000 1.00000 0.55686 +1.00000 1.00000 0.56863 +1.00000 1.00000 0.58039 +1.00000 1.00000 0.59216 +1.00000 1.00000 0.60392 +1.00000 1.00000 0.61961 +1.00000 1.00000 0.63137 +1.00000 1.00000 0.64314 +1.00000 1.00000 0.65490 +1.00000 1.00000 0.67059 +1.00000 1.00000 0.68235 +1.00000 1.00000 0.69412 +1.00000 1.00000 0.70588 +1.00000 1.00000 0.71765 +1.00000 1.00000 0.73333 +1.00000 1.00000 0.74510 +1.00000 1.00000 0.75686 +1.00000 1.00000 0.76863 +1.00000 1.00000 0.78431 +1.00000 1.00000 0.79608 +1.00000 1.00000 0.80784 +1.00000 1.00000 0.81961 +1.00000 1.00000 0.83529 +1.00000 1.00000 0.84706 +1.00000 1.00000 0.85882 +1.00000 1.00000 0.87059 +1.00000 1.00000 0.88235 +1.00000 1.00000 0.89804 +1.00000 1.00000 0.90980 +1.00000 1.00000 0.92157 +1.00000 1.00000 0.93333 +1.00000 1.00000 0.94902 +1.00000 1.00000 0.96078 +1.00000 1.00000 0.97255 +1.00000 1.00000 0.98431 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/idl6.lut b/vendor/x11iraf/ximtool/luts/idl6.lut new file mode 100644 index 00000000..c511860d --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/idl6.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.01176 0.00000 0.00000 +0.02745 0.00000 0.00000 +0.04314 0.00000 0.00000 +0.05882 0.00000 0.00000 +0.07451 0.00000 0.00000 +0.08627 0.00000 0.00000 +0.10196 0.00000 0.00000 +0.11765 0.00000 0.00000 +0.13333 0.00000 0.00000 +0.14902 0.00000 0.00000 +0.16078 0.00000 0.00000 +0.17647 0.00000 0.00000 +0.19216 0.00000 0.00000 +0.20784 0.00000 0.00000 +0.22353 0.00000 0.00000 +0.23529 0.00000 0.00000 +0.25098 0.00000 0.00000 +0.26667 0.00000 0.00000 +0.28235 0.00000 0.00000 +0.29804 0.00000 0.00000 +0.30980 0.00000 0.00000 +0.32549 0.00000 0.00000 +0.34118 0.00000 0.00000 +0.35686 0.00000 0.00000 +0.37255 0.00000 0.00000 +0.38431 0.00000 0.00000 +0.40000 0.00000 0.00000 +0.41569 0.00000 0.00000 +0.43137 0.00000 0.00000 +0.44706 0.00000 0.00000 +0.45882 0.00000 0.00000 +0.47451 0.00000 0.00000 +0.49020 0.00000 0.00000 +0.50588 0.00000 0.00000 +0.52157 0.00000 0.00000 +0.53725 0.00000 0.00000 +0.54902 0.00000 0.00000 +0.56471 0.00000 0.00000 +0.58039 0.00000 0.00000 +0.59608 0.00000 0.00000 +0.61176 0.00000 0.00000 +0.62353 0.00000 0.00000 +0.63922 0.00000 0.00000 +0.65490 0.00000 0.00000 +0.67059 0.00000 0.00000 +0.68627 0.00000 0.00000 +0.69804 0.00000 0.00000 +0.71373 0.00000 0.00000 +0.72941 0.00000 0.00000 +0.74510 0.00000 0.00000 +0.76078 0.00000 0.00000 +0.77255 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.80392 0.00000 0.00000 +0.81961 0.00000 0.00000 +0.83529 0.00000 0.00000 +0.84706 0.00000 0.00000 +0.86275 0.00000 0.00000 +0.87843 0.00000 0.00000 +0.89412 0.00000 0.00000 +0.90980 0.00000 0.00000 +0.92157 0.00000 0.00000 +0.93725 0.00000 0.00000 +0.95294 0.00000 0.00000 +0.96863 0.01176 0.00000 +0.98431 0.02745 0.00000 +1.00000 0.04314 0.00000 +0.98431 0.05882 0.00000 +0.96863 0.07451 0.00000 +0.95294 0.09020 0.00000 +0.93725 0.10588 0.00000 +0.92157 0.12157 0.00000 +0.90196 0.13725 0.00000 +0.88627 0.15294 0.00000 +0.87059 0.16863 0.00000 +0.85490 0.18431 0.00000 +0.83922 0.20000 0.00000 +0.82353 0.21569 0.00000 +0.80392 0.23137 0.00000 +0.78824 0.24706 0.00000 +0.77255 0.26275 0.00000 +0.75686 0.27843 0.00000 +0.74118 0.29412 0.00000 +0.72157 0.30980 0.00000 +0.70588 0.32549 0.00000 +0.69020 0.34118 0.00000 +0.67451 0.35686 0.00000 +0.65882 0.37255 0.00000 +0.64314 0.38824 0.00000 +0.62353 0.40392 0.00000 +0.60784 0.41961 0.00000 +0.59216 0.43529 0.00000 +0.57647 0.45098 0.00000 +0.56078 0.46667 0.00000 +0.54118 0.48235 0.00000 +0.52549 0.49804 0.00000 +0.50980 0.51373 0.00000 +0.49412 0.52941 0.00000 +0.47843 0.54510 0.00000 +0.46275 0.56078 0.00000 +0.44314 0.57647 0.00000 +0.42745 0.59216 0.00000 +0.41176 0.60784 0.00000 +0.39608 0.62353 0.00000 +0.38039 0.63922 0.00000 +0.36078 0.65490 0.00000 +0.34510 0.67059 0.00000 +0.32941 0.68627 0.00000 +0.31373 0.70196 0.00000 +0.29804 0.71765 0.00000 +0.28235 0.73333 0.00000 +0.26275 0.74902 0.00000 +0.24706 0.76471 0.00000 +0.23137 0.78039 0.00000 +0.21569 0.79608 0.00000 +0.20000 0.81176 0.00000 +0.18039 0.82745 0.00000 +0.16471 0.84314 0.00000 +0.14902 0.85882 0.00000 +0.13333 0.87451 0.00000 +0.11765 0.89020 0.00000 +0.10196 0.90588 0.00000 +0.08235 0.92157 0.00000 +0.06667 0.93725 0.00000 +0.05098 0.95294 0.00000 +0.03529 0.96863 0.00000 +0.01961 0.98431 0.01176 +0.00000 1.00000 0.02745 +0.00000 0.98431 0.04314 +0.00000 0.96863 0.05882 +0.00000 0.95294 0.07451 +0.00000 0.93725 0.09020 +0.00000 0.92157 0.10588 +0.00000 0.90588 0.11765 +0.00000 0.89020 0.13333 +0.00000 0.87451 0.14902 +0.00000 0.85882 0.16471 +0.00000 0.84314 0.18039 +0.00000 0.82745 0.19608 +0.00000 0.81176 0.21176 +0.00000 0.79608 0.22353 +0.00000 0.78039 0.23922 +0.00000 0.76471 0.25490 +0.00000 0.74902 0.27059 +0.00000 0.73333 0.28627 +0.00000 0.71765 0.30196 +0.00000 0.70196 0.31765 +0.00000 0.68627 0.33333 +0.00000 0.66667 0.34510 +0.00000 0.65098 0.36078 +0.00000 0.63529 0.37647 +0.00000 0.61961 0.39216 +0.00000 0.60392 0.40784 +0.00000 0.58824 0.42353 +0.00000 0.57255 0.43922 +0.00000 0.55686 0.45098 +0.00000 0.54118 0.46667 +0.00000 0.52549 0.48235 +0.00000 0.50980 0.49804 +0.00000 0.49412 0.51373 +0.00000 0.47843 0.52941 +0.00000 0.46275 0.54510 +0.00000 0.44706 0.55686 +0.00000 0.43137 0.57255 +0.00000 0.41569 0.58824 +0.00000 0.40000 0.60392 +0.00000 0.38431 0.61961 +0.00000 0.36863 0.63529 +0.00000 0.35294 0.65098 +0.00000 0.33333 0.66667 +0.00000 0.31765 0.67843 +0.00000 0.30196 0.69412 +0.00000 0.28627 0.70980 +0.00000 0.27059 0.72549 +0.00000 0.25490 0.74118 +0.00000 0.23922 0.75686 +0.00000 0.22353 0.77255 +0.00000 0.20784 0.78431 +0.00000 0.19216 0.80000 +0.00000 0.17647 0.81569 +0.00000 0.16078 0.83137 +0.00000 0.14510 0.84706 +0.00000 0.12941 0.86275 +0.00000 0.11373 0.87843 +0.00000 0.09804 0.89020 +0.00000 0.08235 0.90588 +0.00000 0.06667 0.92157 +0.00000 0.05098 0.93725 +0.00000 0.03529 0.95294 +0.00000 0.01961 0.96863 +0.00000 0.00000 0.98431 +0.00000 0.00000 1.00000 +0.00000 0.00000 0.98431 +0.00000 0.00000 0.96863 +0.00000 0.00000 0.95294 +0.00000 0.00000 0.93725 +0.00000 0.00000 0.92157 +0.00000 0.00000 0.90588 +0.00000 0.00000 0.89020 +0.00000 0.00000 0.87451 +0.00000 0.00000 0.85882 +0.00000 0.00000 0.84314 +0.00000 0.00000 0.82745 +0.00000 0.00000 0.81176 +0.00000 0.00000 0.79608 +0.00000 0.00000 0.78039 +0.00000 0.00000 0.76471 +0.00000 0.00000 0.74902 +0.00000 0.00000 0.73333 +0.00000 0.00000 0.71765 +0.00000 0.00000 0.70196 +0.00000 0.00000 0.68627 +0.00000 0.00000 0.66667 +0.00000 0.00000 0.65098 +0.00000 0.00000 0.63529 +0.00000 0.00000 0.61961 +0.00000 0.00000 0.60392 +0.00000 0.00000 0.58824 +0.00000 0.00000 0.57255 +0.00000 0.00000 0.55686 +0.00000 0.00000 0.54118 +0.00000 0.00000 0.52549 +0.00000 0.00000 0.50980 +0.00000 0.00000 0.49412 +0.00000 0.00000 0.47843 +0.00000 0.00000 0.46275 +0.00000 0.00000 0.44706 +0.00000 0.00000 0.43137 +0.00000 0.00000 0.41569 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.38431 +0.00000 0.00000 0.36863 +0.00000 0.00000 0.35294 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.31765 +0.00000 0.00000 0.30196 +0.00000 0.00000 0.28627 +0.00000 0.00000 0.27059 +0.00000 0.00000 0.25490 +0.00000 0.00000 0.23922 +0.00000 0.00000 0.22353 +0.00000 0.00000 0.20784 +0.00000 0.00000 0.19216 +0.00000 0.00000 0.17647 +0.00000 0.00000 0.16078 +0.00000 0.00000 0.14510 +0.00000 0.00000 0.12941 +0.00000 0.00000 0.11373 +0.00000 0.00000 0.09804 +0.00000 0.00000 0.08235 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.05098 +0.00000 0.00000 0.03529 +0.00000 0.00000 0.01961 +0.00000 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/ikon.lut b/vendor/x11iraf/ximtool/luts/ikon.lut new file mode 100644 index 00000000..c930305d --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/ikon.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.14118 0.00000 +0.00000 0.28235 0.00000 +0.00000 0.42353 0.00000 +0.00000 0.56471 0.00000 +0.00000 0.70588 0.00000 +0.00000 0.84706 0.00000 +0.00000 0.98824 0.00000 +0.00000 0.00000 0.14118 +0.00000 0.14118 0.14118 +0.00000 0.28235 0.14118 +0.00000 0.42353 0.14118 +0.00000 0.56471 0.14118 +0.00000 0.70588 0.14118 +0.00000 0.84706 0.14118 +0.00000 0.98824 0.14118 +0.00000 0.00000 0.28235 +0.00000 0.14118 0.28235 +0.00000 0.28235 0.28235 +0.00000 0.42353 0.28235 +0.00000 0.56471 0.28235 +0.00000 0.70588 0.28235 +0.00000 0.84706 0.28235 +0.00000 0.98824 0.28235 +0.00000 0.00000 0.42353 +0.00000 0.14118 0.42353 +0.00000 0.28235 0.42353 +0.00000 0.42353 0.42353 +0.00000 0.56471 0.42353 +0.00000 0.70588 0.42353 +0.00000 0.84706 0.42353 +0.00000 0.98824 0.42353 +0.00000 0.00000 0.56471 +0.00000 0.14118 0.56471 +0.00000 0.28235 0.56471 +0.00000 0.42353 0.56471 +0.00000 0.56471 0.56471 +0.00000 0.70588 0.56471 +0.00000 0.84706 0.56471 +0.00000 0.98824 0.56471 +0.00000 0.00000 0.70588 +0.00000 0.14118 0.70588 +0.00000 0.28235 0.70588 +0.00000 0.42353 0.70588 +0.00000 0.56471 0.70588 +0.00000 0.70588 0.70588 +0.00000 0.84706 0.70588 +0.00000 0.98824 0.70588 +0.00000 0.00000 0.84706 +0.00000 0.14118 0.84706 +0.00000 0.28235 0.84706 +0.00000 0.42353 0.84706 +0.00000 0.56471 0.84706 +0.00000 0.70588 0.84706 +0.00000 0.84706 0.84706 +0.00000 0.98824 0.84706 +0.00000 0.00000 0.98824 +0.00000 0.14118 0.98824 +0.00000 0.28235 0.98824 +0.00000 0.42353 0.98824 +0.00000 0.56471 0.98824 +0.00000 0.70588 0.98824 +0.00000 0.84706 0.98824 +0.00000 0.98824 0.98824 +0.00000 0.00000 0.00000 +0.32941 0.14118 0.00000 +0.32941 0.28235 0.00000 +0.32941 0.42353 0.00000 +0.32941 0.56471 0.00000 +0.32941 0.70588 0.00000 +0.32941 0.84706 0.00000 +0.32941 0.98824 0.00000 +0.32941 0.00000 0.14118 +0.32941 0.14118 0.14118 +0.32941 0.28235 0.14118 +0.32941 0.42353 0.14118 +0.32941 0.56471 0.14118 +0.32941 0.70588 0.14118 +0.32941 0.84706 0.14118 +0.32941 0.98824 0.14118 +0.32941 0.00000 0.28235 +0.32941 0.14118 0.28235 +0.32941 0.28235 0.28235 +0.32941 0.42353 0.28235 +0.32941 0.56471 0.28235 +0.32941 0.70588 0.28235 +0.32941 0.84706 0.28235 +0.32941 0.98824 0.28235 +0.32941 0.00000 0.42353 +0.32941 0.14118 0.42353 +0.32941 0.28235 0.42353 +0.32941 0.42353 0.42353 +0.32941 0.56471 0.42353 +0.32941 0.70588 0.42353 +0.32941 0.84706 0.42353 +0.32941 0.98824 0.42353 +0.32941 0.00000 0.56471 +0.32941 0.14118 0.56471 +0.32941 0.28235 0.56471 +0.32941 0.42353 0.56471 +0.32941 0.56471 0.56471 +0.32941 0.70588 0.56471 +0.32941 0.84706 0.56471 +0.32941 0.98824 0.56471 +0.32941 0.00000 0.70588 +0.32941 0.14118 0.70588 +0.32941 0.28235 0.70588 +0.32941 0.42353 0.70588 +0.32941 0.56471 0.70588 +0.32941 0.70588 0.70588 +0.32941 0.84706 0.70588 +0.32941 0.98824 0.70588 +0.32941 0.00000 0.84706 +0.32941 0.14118 0.84706 +0.32941 0.28235 0.84706 +0.32941 0.42353 0.84706 +0.32941 0.56471 0.84706 +0.32941 0.70588 0.84706 +0.32941 0.84706 0.84706 +0.32941 0.98824 0.84706 +0.32941 0.00000 0.98824 +0.32941 0.14118 0.98824 +0.32941 0.28235 0.98824 +0.32941 0.42353 0.98824 +0.32941 0.56471 0.98824 +0.32941 0.70588 0.98824 +0.32941 0.84706 0.98824 +0.32941 0.98824 0.98824 +0.32941 0.00000 0.00000 +0.65882 0.14118 0.00000 +0.65882 0.28235 0.00000 +0.65882 0.42353 0.00000 +0.65882 0.56471 0.00000 +0.65882 0.70588 0.00000 +0.65882 0.84706 0.00000 +0.65882 0.98824 0.00000 +0.65882 0.00000 0.14118 +0.65882 0.14118 0.14118 +0.65882 0.28235 0.14118 +0.65882 0.42353 0.14118 +0.65882 0.56471 0.14118 +0.65882 0.70588 0.14118 +0.65882 0.84706 0.14118 +0.65882 0.98824 0.14118 +0.65882 0.00000 0.28235 +0.65882 0.14118 0.28235 +0.65882 0.28235 0.28235 +0.65882 0.42353 0.28235 +0.65882 0.56471 0.28235 +0.65882 0.70588 0.28235 +0.65882 0.84706 0.28235 +0.65882 0.98824 0.28235 +0.65882 0.00000 0.42353 +0.65882 0.14118 0.42353 +0.65882 0.28235 0.42353 +0.65882 0.42353 0.42353 +0.65882 0.56471 0.42353 +0.65882 0.70588 0.42353 +0.65882 0.84706 0.42353 +0.65882 0.98824 0.42353 +0.65882 0.00000 0.56471 +0.65882 0.14118 0.56471 +0.65882 0.28235 0.56471 +0.65882 0.42353 0.56471 +0.65882 0.56471 0.56471 +0.65882 0.70588 0.56471 +0.65882 0.84706 0.56471 +0.65882 0.98824 0.56471 +0.65882 0.00000 0.70588 +0.65882 0.14118 0.70588 +0.65882 0.28235 0.70588 +0.65882 0.42353 0.70588 +0.65882 0.56471 0.70588 +0.65882 0.70588 0.70588 +0.65882 0.84706 0.70588 +0.65882 0.98824 0.70588 +0.65882 0.00000 0.84706 +0.65882 0.14118 0.84706 +0.65882 0.28235 0.84706 +0.65882 0.42353 0.84706 +0.65882 0.56471 0.84706 +0.65882 0.70588 0.84706 +0.65882 0.84706 0.84706 +0.65882 0.98824 0.84706 +0.65882 0.00000 0.98824 +0.65882 0.14118 0.98824 +0.65882 0.28235 0.98824 +0.65882 0.42353 0.98824 +0.65882 0.56471 0.98824 +0.65882 0.70588 0.98824 +0.65882 0.84706 0.98824 +0.65882 0.98824 0.98824 +0.65882 0.00000 0.00000 +0.98824 0.14118 0.00000 +0.98824 0.28235 0.00000 +0.98824 0.42353 0.00000 +0.98824 0.56471 0.00000 +0.98824 0.70588 0.00000 +0.98824 0.84706 0.00000 +0.98824 0.98824 0.00000 +0.98824 0.00000 0.14118 +0.98824 0.14118 0.14118 +0.98824 0.28235 0.14118 +0.98824 0.42353 0.14118 +0.98824 0.56471 0.14118 +0.98824 0.70588 0.14118 +0.98824 0.84706 0.14118 +0.98824 0.98824 0.14118 +0.98824 0.00000 0.28235 +0.98824 0.14118 0.28235 +0.98824 0.28235 0.28235 +0.98824 0.42353 0.28235 +0.98824 0.56471 0.28235 +0.98824 0.70588 0.28235 +0.98824 0.84706 0.28235 +0.98824 0.98824 0.28235 +0.98824 0.00000 0.42353 +0.98824 0.14118 0.42353 +0.98824 0.28235 0.42353 +0.98824 0.42353 0.42353 +0.98824 0.56471 0.42353 +0.98824 0.70588 0.42353 +0.98824 0.84706 0.42353 +0.98824 0.98824 0.42353 +0.98824 0.00000 0.56471 +0.98824 0.14118 0.56471 +0.98824 0.28235 0.56471 +0.98824 0.42353 0.56471 +0.98824 0.56471 0.56471 +0.98824 0.70588 0.56471 +0.98824 0.84706 0.56471 +0.98824 0.98824 0.56471 +0.98824 0.00000 0.70588 +0.98824 0.14118 0.70588 +0.98824 0.28235 0.70588 +0.98824 0.42353 0.70588 +0.98824 0.56471 0.70588 +0.98824 0.70588 0.70588 +0.98824 0.84706 0.70588 +0.98824 0.98824 0.70588 +0.98824 0.00000 0.84706 +0.98824 0.14118 0.84706 +0.98824 0.28235 0.84706 +0.98824 0.42353 0.84706 +0.98824 0.56471 0.84706 +0.98824 0.70588 0.84706 +0.98824 0.84706 0.84706 +0.98824 0.98824 0.84706 +0.98824 0.00000 0.98824 +0.98824 0.14118 0.98824 +0.98824 0.28235 0.98824 +0.98824 0.42353 0.98824 +0.98824 0.56471 0.98824 +0.98824 0.70588 0.98824 +0.98824 0.84706 0.98824 +0.98824 0.98824 0.98824 diff --git a/vendor/x11iraf/ximtool/luts/isophot.lut b/vendor/x11iraf/ximtool/luts/isophot.lut new file mode 100644 index 00000000..70df9c7b --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/isophot.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.03922 +0.00000 0.00000 0.07843 +0.00000 0.00000 0.11765 +0.00000 0.00000 0.15686 +0.00000 0.00000 0.19608 +0.00000 0.00000 0.23529 +0.00000 0.00000 0.27843 +0.00000 0.00000 0.31765 +0.00000 0.00000 0.35686 +0.00000 0.00000 0.39608 +0.00000 0.00000 0.43529 +0.00000 0.00000 0.47451 +0.00000 0.00000 0.51765 +0.00000 0.00000 0.55686 +0.00000 0.00000 0.59608 +0.00000 0.00000 0.63529 +0.00000 0.00000 0.67451 +0.00000 0.00000 0.71765 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.00000 0.00000 0.87843 +0.00000 0.00000 0.91765 +0.00000 0.00000 0.95686 +0.00000 0.00000 1.00000 +0.00000 0.03137 1.00000 +0.00000 0.06275 1.00000 +0.00000 0.09412 1.00000 +0.00000 0.12549 1.00000 +0.00000 0.15686 1.00000 +0.00000 0.18824 1.00000 +0.00000 0.21961 1.00000 +0.00000 0.25490 1.00000 +0.00000 0.28627 1.00000 +0.00000 0.31765 1.00000 +0.00000 0.34902 1.00000 +0.00000 0.38039 1.00000 +0.00000 0.41176 1.00000 +0.00000 0.44314 1.00000 +0.00000 0.47843 1.00000 +0.00000 0.49804 1.00000 +0.00000 0.51765 1.00000 +0.00000 0.53725 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.00000 0.61961 1.00000 +0.00000 0.63922 1.00000 +0.00000 0.65882 1.00000 +0.00000 0.67843 1.00000 +0.00000 0.70196 1.00000 +0.00000 0.72157 1.00000 +0.00000 0.74118 1.00000 +0.00000 0.76078 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.79608 1.00000 +0.00000 0.81176 1.00000 +0.00000 0.82353 1.00000 +0.00000 0.83922 1.00000 +0.00000 0.85490 1.00000 +0.00000 0.86667 1.00000 +0.00000 0.88235 1.00000 +0.00000 0.89412 1.00000 +0.00000 0.90980 1.00000 +0.00000 0.92549 1.00000 +0.00000 0.93725 1.00000 +0.00000 0.95294 1.00000 +0.00000 0.96863 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.00000 1.00000 0.96078 +0.00000 1.00000 0.94118 +0.00000 1.00000 0.92157 +0.00000 1.00000 0.90196 +0.00000 1.00000 0.88235 +0.00000 1.00000 0.86275 +0.00000 1.00000 0.84314 +0.00000 1.00000 0.82353 +0.00000 1.00000 0.80392 +0.00000 1.00000 0.78431 +0.00000 1.00000 0.76471 +0.00000 1.00000 0.74510 +0.00000 1.00000 0.72549 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.65490 +0.00000 1.00000 0.60784 +0.00000 1.00000 0.56078 +0.00000 1.00000 0.51373 +0.00000 1.00000 0.46667 +0.00000 1.00000 0.41961 +0.00000 1.00000 0.37255 +0.00000 1.00000 0.32549 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.00000 1.00000 0.13725 +0.00000 1.00000 0.09020 +0.00000 1.00000 0.04314 +0.00000 1.00000 0.00000 +0.04706 1.00000 0.00000 +0.09412 1.00000 0.00000 +0.14118 1.00000 0.00000 +0.18824 1.00000 0.00000 +0.23529 1.00000 0.00000 +0.28235 1.00000 0.00000 +0.32941 1.00000 0.00000 +0.37647 1.00000 0.00000 +0.42353 1.00000 0.00000 +0.47059 1.00000 0.00000 +0.51765 1.00000 0.00000 +0.56471 1.00000 0.00000 +0.61176 1.00000 0.00000 +0.65882 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.72549 1.00000 0.00000 +0.74510 1.00000 0.00000 +0.76471 1.00000 0.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.84314 1.00000 0.00000 +0.86275 1.00000 0.00000 +0.88235 1.00000 0.00000 +0.90196 1.00000 0.00000 +0.92157 1.00000 0.00000 +0.94118 1.00000 0.00000 +0.96078 1.00000 0.00000 +0.98039 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 0.98039 0.00000 +0.99608 0.96078 0.00000 +0.99608 0.94118 0.00000 +0.99608 0.92549 0.00000 +0.99216 0.90588 0.00000 +0.99216 0.88627 0.00000 +0.99216 0.87059 0.00000 +0.99216 0.85098 0.00000 +0.98824 0.83137 0.00000 +0.98824 0.81569 0.00000 +0.98824 0.79608 0.00000 +0.98824 0.77647 0.00000 +0.98824 0.76078 0.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.98824 0.69020 0.00000 +0.98824 0.67059 0.00000 +0.98824 0.65490 0.00000 +0.98824 0.63922 0.00000 +0.98824 0.61961 0.00000 +0.99216 0.60392 0.00000 +0.99216 0.58824 0.00000 +0.99216 0.56863 0.00000 +0.99216 0.55294 0.00000 +0.99608 0.53725 0.00000 +0.99608 0.51765 0.00000 +0.99608 0.50196 0.00000 +0.99608 0.48627 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.43529 0.00000 +1.00000 0.40392 0.00000 +1.00000 0.37255 0.00000 +1.00000 0.34118 0.00000 +1.00000 0.30980 0.00000 +1.00000 0.27843 0.00000 +1.00000 0.24706 0.00000 +1.00000 0.21569 0.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 0.09020 0.00000 +1.00000 0.05882 0.00000 +1.00000 0.02745 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.04706 +1.00000 0.00000 0.09412 +1.00000 0.00000 0.14118 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 0.00000 0.32941 +1.00000 0.00000 0.37647 +1.00000 0.00000 0.42353 +1.00000 0.00000 0.47059 +1.00000 0.00000 0.51765 +1.00000 0.00000 0.56471 +1.00000 0.00000 0.61176 +1.00000 0.00000 0.65882 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.72549 +1.00000 0.00000 0.74902 +1.00000 0.00000 0.77255 +1.00000 0.00000 0.79608 +1.00000 0.00000 0.81569 +1.00000 0.00000 0.83922 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.88627 +1.00000 0.00000 0.90588 +1.00000 0.00000 0.92941 +1.00000 0.00000 0.95294 +1.00000 0.00000 0.97647 +1.00000 0.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 0.14118 1.00000 +1.00000 0.17647 1.00000 +1.00000 0.21176 1.00000 +1.00000 0.25098 1.00000 +1.00000 0.28627 1.00000 +1.00000 0.32157 1.00000 +1.00000 0.36078 1.00000 +1.00000 0.39608 1.00000 +1.00000 0.43137 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.48627 1.00000 +1.00000 0.50588 1.00000 +1.00000 0.52157 1.00000 +1.00000 0.54118 1.00000 +1.00000 0.56078 1.00000 +1.00000 0.57647 1.00000 +1.00000 0.59608 1.00000 +1.00000 0.61176 1.00000 +1.00000 0.63137 1.00000 +1.00000 0.65098 1.00000 +1.00000 0.66667 1.00000 +1.00000 0.68627 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.74510 1.00000 +1.00000 0.78824 1.00000 +1.00000 0.83137 1.00000 +1.00000 0.87059 1.00000 +1.00000 0.91373 1.00000 +1.00000 0.95686 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/light.lut b/vendor/x11iraf/ximtool/luts/light.lut new file mode 100644 index 00000000..a58c7120 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/light.lut @@ -0,0 +1,256 @@ +0.00000 0.00392 0.00000 +0.00000 0.00784 0.01961 +0.00000 0.01176 0.05490 +0.00000 0.01569 0.08627 +0.00000 0.01961 0.10980 +0.00000 0.02353 0.13725 +0.00000 0.02745 0.15686 +0.00000 0.03137 0.18039 +0.00000 0.03529 0.20000 +0.00000 0.03922 0.21569 +0.00000 0.04314 0.23529 +0.00000 0.04706 0.25098 +0.00000 0.05098 0.26275 +0.00000 0.05490 0.28235 +0.00000 0.05882 0.29412 +0.00000 0.06275 0.30588 +0.00000 0.06667 0.31765 +0.00000 0.07059 0.33333 +0.00000 0.07451 0.34118 +0.00000 0.07843 0.35294 +0.00000 0.08235 0.36078 +0.00000 0.08627 0.37255 +0.00000 0.09020 0.38431 +0.00000 0.09412 0.39216 +0.00392 0.09804 0.40000 +0.00784 0.10196 0.41176 +0.01176 0.10588 0.41961 +0.01569 0.10980 0.43137 +0.01569 0.11373 0.43529 +0.01961 0.11765 0.44314 +0.02353 0.12157 0.45098 +0.02745 0.12549 0.45882 +0.02745 0.12941 0.46667 +0.03137 0.13333 0.47059 +0.03529 0.13725 0.48235 +0.04314 0.14118 0.48627 +0.04706 0.14510 0.49412 +0.05098 0.14902 0.50196 +0.05882 0.15294 0.50588 +0.06667 0.15686 0.50980 +0.07451 0.16078 0.51765 +0.08235 0.16471 0.52157 +0.09020 0.16863 0.53333 +0.09804 0.17255 0.53725 +0.10588 0.17647 0.54118 +0.11765 0.18039 0.54902 +0.12941 0.18431 0.55294 +0.14118 0.18824 0.55686 +0.15294 0.19216 0.56078 +0.16471 0.19608 0.56471 +0.18039 0.20000 0.57255 +0.18824 0.20392 0.58039 +0.20000 0.20784 0.58431 +0.21569 0.21176 0.58824 +0.23137 0.21569 0.59216 +0.24706 0.21961 0.59608 +0.26275 0.22353 0.60000 +0.27843 0.22745 0.60392 +0.29412 0.23137 0.60784 +0.30980 0.23529 0.61176 +0.32941 0.23922 0.61569 +0.34902 0.24314 0.61961 +0.36863 0.24706 0.62745 +0.38431 0.25098 0.63137 +0.40392 0.25490 0.63529 +0.41569 0.25882 0.63922 +0.43529 0.26275 0.64314 +0.45490 0.26667 0.64706 +0.47059 0.27059 0.65098 +0.48627 0.27451 0.65490 +0.50196 0.27843 0.65490 +0.51765 0.28235 0.65882 +0.52941 0.28627 0.66275 +0.54902 0.29020 0.66667 +0.56471 0.29412 0.67059 +0.58039 0.29804 0.67843 +0.59216 0.30196 0.67843 +0.60392 0.30588 0.68235 +0.61961 0.30980 0.68627 +0.63137 0.31373 0.69020 +0.63922 0.31765 0.69020 +0.65098 0.32157 0.69412 +0.65882 0.32549 0.69804 +0.67059 0.32941 0.70196 +0.67843 0.33333 0.70196 +0.69020 0.33725 0.70588 +0.69804 0.34118 0.70980 +0.70588 0.34510 0.71373 +0.71373 0.34902 0.71373 +0.72157 0.35294 0.71765 +0.72941 0.35686 0.72157 +0.73725 0.36078 0.72157 +0.74510 0.36471 0.72941 +0.75294 0.36863 0.73333 +0.76078 0.37255 0.73333 +0.76863 0.37647 0.73725 +0.77647 0.38039 0.74118 +0.78039 0.38431 0.74118 +0.78824 0.38824 0.74510 +0.79608 0.39216 0.74510 +0.80392 0.39608 0.74902 +0.80784 0.40000 0.75294 +0.81176 0.40392 0.75294 +0.81961 0.40784 0.75686 +0.82353 0.41176 0.76078 +0.82745 0.41569 0.76078 +0.83529 0.41961 0.76471 +0.83922 0.42353 0.76471 +0.84314 0.42745 0.76863 +0.84706 0.43137 0.76863 +0.85098 0.43529 0.77255 +0.85490 0.43922 0.78039 +0.85882 0.44314 0.78039 +0.86275 0.44706 0.78431 +0.86667 0.45098 0.78431 +0.87059 0.45490 0.78824 +0.87451 0.45882 0.78824 +0.87843 0.46275 0.79216 +0.88235 0.46667 0.79216 +0.88627 0.47059 0.79608 +0.89020 0.47451 0.79608 +0.89412 0.47843 0.80000 +0.89804 0.48235 0.80000 +0.89804 0.48627 0.80392 +0.90196 0.49020 0.80392 +0.90588 0.49412 0.80784 +0.90980 0.49804 0.80784 +0.91373 0.50196 0.81176 +0.91373 0.50588 0.81176 +0.91765 0.50980 0.81569 +0.92157 0.51373 0.81569 +0.92157 0.51765 0.81961 +0.92549 0.52157 0.81961 +0.92941 0.52549 0.82745 +0.92941 0.52941 0.82745 +0.93333 0.53333 0.83137 +0.93725 0.53725 0.83137 +0.93725 0.54118 0.83529 +0.93725 0.54510 0.83529 +0.94118 0.54902 0.83922 +0.94118 0.55294 0.83922 +0.94510 0.55686 0.83922 +0.94510 0.56078 0.84314 +0.94902 0.56471 0.84314 +0.94902 0.56863 0.84706 +0.95294 0.57255 0.84706 +0.95294 0.57647 0.85098 +0.95294 0.58039 0.85098 +0.95686 0.58431 0.85490 +0.95686 0.58824 0.85490 +0.96078 0.59216 0.85490 +0.96078 0.59608 0.85882 +0.96078 0.60000 0.85882 +0.96471 0.60392 0.86275 +0.96471 0.60784 0.86275 +0.96471 0.61176 0.86275 +0.96863 0.61569 0.86667 +0.96863 0.61961 0.86667 +0.97255 0.62353 0.87059 +0.97255 0.62745 0.87059 +0.97255 0.63137 0.87059 +0.97647 0.63529 0.87843 +0.97647 0.63922 0.87843 +0.98039 0.64314 0.88235 +0.98039 0.64706 0.88235 +0.98039 0.65098 0.88235 +0.98431 0.65490 0.88627 +0.98431 0.65882 0.88627 +0.98431 0.66275 0.89020 +0.98824 0.66667 0.89020 +0.98824 0.67059 0.89020 +0.98824 0.67451 0.89412 +0.99216 0.67843 0.89412 +0.99216 0.68235 0.89412 +0.99216 0.68627 0.89804 +0.99216 0.69020 0.89804 +0.99216 0.69412 0.89804 +0.99608 0.69804 0.90196 +0.99608 0.70196 0.90196 +0.99608 0.70588 0.90588 +0.99608 0.70980 0.90588 +0.99608 0.71373 0.90588 +0.99608 0.71765 0.90980 +0.99608 0.72157 0.90980 +0.99608 0.72549 0.90980 +0.99608 0.72941 0.91373 +0.99608 0.73333 0.91373 +0.99608 0.73725 0.91373 +0.99608 0.74118 0.91765 +0.99608 0.74510 0.91765 +0.99608 0.74902 0.91765 +0.99608 0.75294 0.92157 +0.99608 0.75686 0.92157 +0.99608 0.76078 0.92157 +0.99608 0.76471 0.92941 +0.99608 0.76863 0.92941 +0.99608 0.77255 0.92941 +0.99608 0.77647 0.93333 +0.99608 0.78039 0.93333 +0.99608 0.78431 0.93333 +0.99608 0.78824 0.93725 +1.00000 0.79216 0.93725 +1.00000 0.79608 0.93725 +1.00000 0.80000 0.94118 +1.00000 0.80392 0.94118 +1.00000 0.80784 0.94118 +1.00000 0.81176 0.94118 +1.00000 0.81569 0.94510 +1.00000 0.81961 0.94510 +1.00000 0.82353 0.94510 +1.00000 0.82745 0.94902 +1.00000 0.83137 0.94902 +1.00000 0.83529 0.94902 +1.00000 0.83922 0.95294 +1.00000 0.84314 0.95294 +1.00000 0.84706 0.95294 +1.00000 0.85098 0.95686 +1.00000 0.85490 0.95686 +1.00000 0.85882 0.95686 +1.00000 0.86275 0.95686 +1.00000 0.86667 0.96078 +1.00000 0.87059 0.96078 +1.00000 0.87451 0.96078 +1.00000 0.87843 0.96471 +1.00000 0.88235 0.96471 +1.00000 0.88627 0.96471 +1.00000 0.89020 0.96471 +1.00000 0.89412 0.96863 +1.00000 0.89804 0.96863 +1.00000 0.90196 0.96863 +1.00000 0.90588 0.97255 +1.00000 0.90980 0.97255 +1.00000 0.91373 0.97255 +1.00000 0.91765 0.97255 +1.00000 0.92157 0.98039 +1.00000 0.92549 0.98039 +1.00000 0.92941 0.98039 +1.00000 0.93333 0.98039 +1.00000 0.93725 0.98431 +1.00000 0.94118 0.98431 +1.00000 0.94510 0.98431 +1.00000 0.94902 0.98824 +1.00000 0.95294 0.98824 +1.00000 0.95686 0.98824 +1.00000 0.96078 0.98824 +1.00000 0.96471 0.99216 +1.00000 0.96863 0.99216 +1.00000 0.97255 0.99216 +1.00000 0.97647 0.99216 +1.00000 0.98039 0.99608 +1.00000 0.98431 0.99608 +1.00000 0.98824 0.99608 +1.00000 0.99216 0.99608 +1.00000 0.99608 1.00000 +1.00000 1.00000 1.00000 +1.00000 0.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/lnspiral.lut b/vendor/x11iraf/ximtool/luts/lnspiral.lut new file mode 100644 index 00000000..bc6ec646 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/lnspiral.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.13725 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.80392 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.53333 0.00000 0.87451 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.91373 0.00000 0.97255 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.46667 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.36863 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.77647 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.99608 0.97647 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.98431 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.36078 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.65490 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.74118 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.26275 0.87843 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.65882 0.59608 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.92157 0.61961 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.89804 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.76863 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.81176 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.51765 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/manycol.lut b/vendor/x11iraf/ximtool/luts/manycol.lut new file mode 100644 index 00000000..dbedc784 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/manycol.lut @@ -0,0 +1,256 @@ +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.34902 0.34902 0.34902 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.44706 0.78431 0.92549 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.69020 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 0.69020 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.88235 0.00000 +0.72549 0.00000 0.72549 +0.72549 0.00000 0.72549 diff --git a/vendor/x11iraf/ximtool/luts/mousse.lut b/vendor/x11iraf/ximtool/luts/mousse.lut new file mode 100644 index 00000000..468af5bc --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/mousse.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.06667 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.13333 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.26667 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.33333 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.46667 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.00000 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.06667 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.13333 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.20000 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.26667 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.33333 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.40000 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.46667 0.00000 0.53333 +0.53333 0.00000 0.53333 +0.53333 0.00000 0.53333 +0.53333 0.00000 0.53333 +0.53333 0.00000 0.53333 +0.53333 0.00000 0.46667 +0.53333 0.00000 0.46667 +0.53333 0.00000 0.46667 +0.53333 0.00000 0.46667 +0.60000 0.00000 0.40000 +0.60000 0.00000 0.40000 +0.60000 0.00000 0.40000 +0.60000 0.00000 0.40000 +0.60000 0.00000 0.33333 +0.60000 0.00000 0.33333 +0.60000 0.00000 0.33333 +0.60000 0.00000 0.33333 +0.66667 0.00000 0.26667 +0.66667 0.00000 0.26667 +0.66667 0.00000 0.26667 +0.66667 0.00000 0.26667 +0.66667 0.00000 0.20000 +0.66667 0.00000 0.20000 +0.66667 0.00000 0.20000 +0.66667 0.00000 0.20000 +0.73333 0.00000 0.13333 +0.73333 0.00000 0.13333 +0.73333 0.00000 0.13333 +0.73333 0.00000 0.13333 +0.73333 0.00000 0.06667 +0.73333 0.00000 0.06667 +0.73333 0.00000 0.06667 +0.73333 0.00000 0.06667 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.80000 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +0.93333 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.06667 0.00000 +1.00000 0.06667 0.00000 +1.00000 0.13333 0.00000 +1.00000 0.13333 0.00000 +1.00000 0.20000 0.00000 +1.00000 0.20000 0.00000 +1.00000 0.26667 0.00000 +1.00000 0.26667 0.00000 +1.00000 0.33333 0.00000 +1.00000 0.33333 0.00000 +1.00000 0.40000 0.00000 +1.00000 0.40000 0.00000 +1.00000 0.46667 0.00000 +1.00000 0.46667 0.00000 +1.00000 0.53333 0.00000 +1.00000 0.53333 0.00000 +1.00000 0.60000 0.00000 +1.00000 0.60000 0.00000 +1.00000 0.66667 0.00000 +1.00000 0.66667 0.00000 +1.00000 0.73333 0.00000 +1.00000 0.73333 0.00000 +1.00000 0.80000 0.00000 +1.00000 0.80000 0.00000 +1.00000 0.86667 0.00000 +1.00000 0.86667 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.06667 +1.00000 1.00000 0.06667 +1.00000 1.00000 0.13333 +1.00000 1.00000 0.13333 +1.00000 1.00000 0.20000 +1.00000 1.00000 0.20000 +1.00000 1.00000 0.26667 +1.00000 1.00000 0.26667 +1.00000 1.00000 0.33333 +1.00000 1.00000 0.33333 +1.00000 1.00000 0.40000 +1.00000 1.00000 0.40000 +1.00000 1.00000 0.46667 +1.00000 1.00000 0.46667 +1.00000 1.00000 0.53333 +1.00000 1.00000 0.53333 +1.00000 1.00000 0.60000 +1.00000 1.00000 0.60000 +1.00000 1.00000 0.66667 +1.00000 1.00000 0.66667 +1.00000 1.00000 0.73333 +1.00000 1.00000 0.73333 +1.00000 1.00000 0.80000 +1.00000 1.00000 0.80000 +1.00000 1.00000 0.86667 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/pastel.lut b/vendor/x11iraf/ximtool/luts/pastel.lut new file mode 100644 index 00000000..c45fcdea --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/pastel.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 1.00000 +0.01961 0.00000 0.98039 +0.05490 0.00000 0.94510 +0.08627 0.00392 0.91373 +0.10980 0.00392 0.89020 +0.13725 0.00392 0.86275 +0.15686 0.00392 0.84314 +0.18039 0.00392 0.81961 +0.20000 0.00784 0.80000 +0.21569 0.00784 0.78431 +0.23529 0.00784 0.76471 +0.25098 0.00784 0.74902 +0.26275 0.01176 0.73725 +0.28235 0.01176 0.71765 +0.29412 0.01176 0.70588 +0.30588 0.01176 0.69412 +0.31765 0.01176 0.68235 +0.33333 0.01569 0.66667 +0.34118 0.01569 0.65882 +0.35294 0.01569 0.64706 +0.36078 0.01569 0.63922 +0.37255 0.01961 0.62745 +0.38431 0.01961 0.61569 +0.39216 0.01961 0.60784 +0.40000 0.01961 0.60000 +0.41176 0.02353 0.58824 +0.41961 0.02353 0.58039 +0.43137 0.02353 0.56863 +0.43529 0.02745 0.56471 +0.44314 0.02745 0.55686 +0.45098 0.02745 0.54902 +0.45882 0.02745 0.54118 +0.46667 0.03137 0.53333 +0.47059 0.03137 0.52941 +0.48235 0.03137 0.51765 +0.48627 0.03529 0.51373 +0.49412 0.03529 0.50588 +0.50196 0.03529 0.49804 +0.50588 0.03529 0.49412 +0.50980 0.04314 0.49020 +0.51765 0.04314 0.48235 +0.52157 0.04314 0.47843 +0.53333 0.04706 0.46667 +0.53725 0.04706 0.46275 +0.54118 0.04706 0.45882 +0.54902 0.05098 0.45098 +0.55294 0.05098 0.44706 +0.55686 0.05098 0.44314 +0.56078 0.05490 0.43922 +0.56471 0.05490 0.43529 +0.57255 0.05490 0.42745 +0.58039 0.05882 0.41961 +0.58431 0.05882 0.41569 +0.58824 0.05882 0.41176 +0.59216 0.06275 0.40784 +0.59608 0.06275 0.40392 +0.60000 0.06275 0.40000 +0.60392 0.06667 0.39608 +0.60784 0.06667 0.39216 +0.61176 0.06667 0.38824 +0.61569 0.07059 0.38431 +0.61961 0.07059 0.38039 +0.62745 0.07451 0.37255 +0.63137 0.07451 0.36863 +0.63529 0.07451 0.36471 +0.63922 0.07843 0.36078 +0.64314 0.07843 0.35686 +0.64706 0.08235 0.35294 +0.65098 0.08235 0.34902 +0.65490 0.08235 0.34510 +0.65490 0.08627 0.34510 +0.65882 0.08627 0.34118 +0.66275 0.09020 0.33725 +0.66667 0.09020 0.33333 +0.67059 0.09020 0.32941 +0.67843 0.09412 0.32157 +0.67843 0.09412 0.32157 +0.68235 0.09804 0.31765 +0.68627 0.09804 0.31373 +0.69020 0.10196 0.30980 +0.69020 0.10196 0.30980 +0.69412 0.10588 0.30588 +0.69804 0.10588 0.30196 +0.70196 0.10980 0.29804 +0.70196 0.10980 0.29804 +0.70588 0.10980 0.29412 +0.70980 0.11765 0.29020 +0.71373 0.11765 0.28627 +0.71373 0.12157 0.28627 +0.71765 0.12157 0.28235 +0.72157 0.12549 0.27843 +0.72157 0.12549 0.27843 +0.72941 0.12941 0.27059 +0.73333 0.12941 0.26667 +0.73333 0.13333 0.26667 +0.73725 0.13725 0.26275 +0.74118 0.13725 0.25882 +0.74118 0.14118 0.25882 +0.74510 0.14118 0.25490 +0.74510 0.14510 0.25490 +0.74902 0.14510 0.25098 +0.75294 0.14902 0.24706 +0.75294 0.14902 0.24706 +0.75686 0.15294 0.24314 +0.76078 0.15686 0.23922 +0.76078 0.15686 0.23922 +0.76471 0.16078 0.23529 +0.76471 0.16078 0.23529 +0.76863 0.16471 0.23137 +0.76863 0.16863 0.23137 +0.77255 0.16863 0.22745 +0.78039 0.17255 0.21961 +0.78039 0.17255 0.21961 +0.78431 0.17647 0.21569 +0.78431 0.18039 0.21569 +0.78824 0.18039 0.21176 +0.78824 0.18431 0.21176 +0.79216 0.18824 0.20784 +0.79216 0.18824 0.20784 +0.79608 0.19608 0.20392 +0.79608 0.20000 0.20392 +0.80000 0.20000 0.20000 +0.80000 0.20392 0.20000 +0.80392 0.20784 0.19608 +0.80392 0.20784 0.19608 +0.80784 0.21176 0.19216 +0.80784 0.21569 0.19216 +0.81176 0.21961 0.18824 +0.81176 0.21961 0.18824 +0.81569 0.22353 0.18431 +0.81569 0.22745 0.18431 +0.81961 0.23137 0.18039 +0.81961 0.23137 0.18039 +0.82745 0.23529 0.17255 +0.82745 0.23922 0.17255 +0.83137 0.24314 0.16863 +0.83137 0.24314 0.16863 +0.83529 0.24706 0.16471 +0.83529 0.25098 0.16471 +0.83922 0.25490 0.16078 +0.83922 0.25882 0.16078 +0.83922 0.26275 0.16078 +0.84314 0.26275 0.15686 +0.84314 0.27059 0.15686 +0.84706 0.27451 0.15294 +0.84706 0.27843 0.15294 +0.85098 0.28235 0.14902 +0.85098 0.28627 0.14902 +0.85490 0.29020 0.14510 +0.85490 0.29412 0.14510 +0.85490 0.29804 0.14510 +0.85882 0.29804 0.14118 +0.85882 0.30196 0.14118 +0.86275 0.30588 0.13725 +0.86275 0.30980 0.13725 +0.86275 0.31373 0.13725 +0.86667 0.31765 0.13333 +0.86667 0.32157 0.13333 +0.87059 0.32549 0.12941 +0.87059 0.33333 0.12941 +0.87059 0.33725 0.12941 +0.87843 0.34118 0.12157 +0.87843 0.34510 0.12157 +0.88235 0.34902 0.11765 +0.88235 0.35294 0.11765 +0.88235 0.35686 0.11765 +0.88627 0.36078 0.11373 +0.88627 0.36471 0.11373 +0.89020 0.37255 0.10980 +0.89020 0.37647 0.10980 +0.89020 0.38039 0.10980 +0.89412 0.38431 0.10588 +0.89412 0.38824 0.10588 +0.89412 0.39216 0.10588 +0.89804 0.40000 0.10196 +0.89804 0.40392 0.10196 +0.89804 0.40784 0.10196 +0.90196 0.41176 0.09804 +0.90196 0.41961 0.09804 +0.90588 0.42353 0.09412 +0.90588 0.42745 0.09412 +0.90588 0.43529 0.09412 +0.90980 0.43922 0.09020 +0.90980 0.44314 0.09020 +0.90980 0.45098 0.09020 +0.91373 0.45490 0.08627 +0.91373 0.45882 0.08627 +0.91373 0.46667 0.08627 +0.91765 0.47059 0.08235 +0.91765 0.47843 0.08235 +0.91765 0.48235 0.08235 +0.92157 0.49020 0.07843 +0.92157 0.49412 0.07843 +0.92157 0.50196 0.07843 +0.92941 0.50588 0.07059 +0.92941 0.51373 0.07059 +0.92941 0.51765 0.07059 +0.93333 0.52549 0.06667 +0.93333 0.52941 0.06667 +0.93333 0.53725 0.06667 +0.93725 0.54118 0.06275 +0.93725 0.54902 0.06275 +0.93725 0.55686 0.06275 +0.94118 0.56078 0.05882 +0.94118 0.56863 0.05882 +0.94118 0.57647 0.05882 +0.94118 0.58039 0.05882 +0.94510 0.58824 0.05490 +0.94510 0.59608 0.05490 +0.94510 0.60000 0.05490 +0.94902 0.60784 0.05098 +0.94902 0.61569 0.05098 +0.94902 0.62353 0.05098 +0.95294 0.63137 0.04706 +0.95294 0.63529 0.04706 +0.95294 0.64314 0.04706 +0.95686 0.65098 0.04314 +0.95686 0.65882 0.04314 +0.95686 0.66667 0.04314 +0.95686 0.67451 0.04314 +0.96078 0.68235 0.03922 +0.96078 0.69020 0.03922 +0.96078 0.69804 0.03922 +0.96471 0.70588 0.03529 +0.96471 0.71373 0.03529 +0.96471 0.72157 0.03529 +0.96471 0.72941 0.03529 +0.96863 0.73725 0.03137 +0.96863 0.74510 0.03137 +0.96863 0.75294 0.03137 +0.97255 0.76078 0.02745 +0.97255 0.77255 0.02745 +0.97255 0.78039 0.02745 +0.97255 0.78824 0.02745 +0.98039 0.79608 0.01961 +0.98039 0.80392 0.01961 +0.98039 0.81569 0.01961 +0.98039 0.82353 0.01961 +0.98431 0.83137 0.01569 +0.98431 0.84314 0.01569 +0.98431 0.85098 0.01569 +0.98824 0.86275 0.01176 +0.98824 0.87059 0.01176 +0.98824 0.87843 0.01176 +0.98824 0.89020 0.01176 +0.99216 0.89804 0.00784 +0.99216 0.90980 0.00784 +0.99216 0.91765 0.00784 +0.99216 0.92941 0.00784 +0.99608 0.94118 0.00392 +0.99608 0.94902 0.00392 +0.99608 0.96078 0.00392 +0.99608 0.97255 0.00392 +1.00000 0.98039 0.00000 +1.00000 0.99216 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/pseudo1.lut b/vendor/x11iraf/ximtool/luts/pseudo1.lut new file mode 100644 index 00000000..bea23581 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/pseudo1.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 1.00000 +0.00000 0.00000 0.99216 +0.00000 0.00000 0.98824 +0.00392 0.00000 0.98431 +0.00392 0.00000 0.98039 +0.00784 0.00000 0.97647 +0.00784 0.00000 0.96863 +0.01176 0.00000 0.96471 +0.01569 0.00000 0.96078 +0.01569 0.00000 0.95686 +0.01961 0.00000 0.95294 +0.01961 0.00000 0.94510 +0.02353 0.00784 0.94118 +0.02745 0.01569 0.93725 +0.02745 0.02745 0.93333 +0.03137 0.03922 0.92941 +0.03529 0.05098 0.92157 +0.03529 0.06667 0.91765 +0.03922 0.08235 0.91373 +0.04314 0.09804 0.90980 +0.04706 0.11765 0.90588 +0.04706 0.09804 0.90196 +0.05098 0.08235 0.89412 +0.05490 0.06667 0.89020 +0.05490 0.05098 0.88627 +0.05882 0.03922 0.88235 +0.06275 0.02745 0.87843 +0.06667 0.01569 0.87059 +0.07059 0.00784 0.86667 +0.07059 0.00000 0.86275 +0.07451 0.00000 0.85882 +0.07843 0.00392 0.85490 +0.08235 0.01176 0.85098 +0.08235 0.02353 0.84314 +0.08627 0.03922 0.83922 +0.09020 0.05490 0.83529 +0.09412 0.07059 0.83137 +0.09804 0.09020 0.82745 +0.09804 0.10980 0.82353 +0.10196 0.13333 0.81569 +0.10588 0.15686 0.81176 +0.10980 0.13333 0.80784 +0.11373 0.10980 0.80392 +0.11765 0.09020 0.80000 +0.11765 0.07059 0.79608 +0.12157 0.05490 0.79216 +0.12549 0.03922 0.78431 +0.12941 0.02353 0.78039 +0.13333 0.01176 0.77647 +0.13725 0.00392 0.77255 +0.14118 0.00000 0.76863 +0.14118 0.00392 0.76471 +0.14510 0.01569 0.75686 +0.14902 0.03137 0.75294 +0.15294 0.04706 0.74902 +0.15686 0.06667 0.74510 +0.16078 0.09020 0.74118 +0.16471 0.11373 0.73725 +0.16863 0.13725 0.73333 +0.17255 0.16471 0.72549 +0.17255 0.19608 0.72157 +0.17647 0.16471 0.71765 +0.18039 0.13725 0.71373 +0.18431 0.11373 0.70980 +0.18824 0.09020 0.70588 +0.19216 0.06667 0.70196 +0.19608 0.04706 0.69804 +0.20000 0.03137 0.69020 +0.20392 0.01569 0.68627 +0.20784 0.00392 0.68235 +0.21176 0.00000 0.67843 +0.21176 0.00784 0.67451 +0.21569 0.02353 0.67059 +0.21961 0.04314 0.66667 +0.22353 0.06667 0.66275 +0.22745 0.09412 0.65490 +0.23137 0.12549 0.65098 +0.23529 0.15686 0.64706 +0.23922 0.19608 0.64314 +0.24314 0.23137 0.63922 +0.24706 0.27451 0.63529 +0.25098 0.23137 0.63137 +0.25490 0.19608 0.62745 +0.25882 0.15686 0.61961 +0.26275 0.12549 0.61569 +0.26667 0.09412 0.61176 +0.27059 0.06667 0.60784 +0.27451 0.04314 0.60392 +0.27843 0.02353 0.60000 +0.28235 0.00784 0.59608 +0.28627 0.00000 0.59216 +0.29020 0.00784 0.58824 +0.29412 0.03137 0.58431 +0.29804 0.05490 0.57647 +0.29804 0.08627 0.57255 +0.30196 0.12157 0.56863 +0.30588 0.16078 0.56471 +0.30980 0.20392 0.56078 +0.31373 0.25098 0.55686 +0.31765 0.29804 0.55294 +0.32157 0.35294 0.54902 +0.32549 0.29804 0.54510 +0.32941 0.25098 0.54118 +0.33333 0.20392 0.53725 +0.33725 0.16078 0.52941 +0.34118 0.12157 0.52549 +0.34510 0.08627 0.52157 +0.34902 0.05490 0.51765 +0.35294 0.03137 0.51373 +0.35686 0.00784 0.50980 +0.36078 0.00000 0.50588 +0.36471 0.01176 0.50196 +0.37255 0.03529 0.49804 +0.37647 0.07059 0.49412 +0.38039 0.10588 0.49020 +0.38431 0.14902 0.48627 +0.38824 0.20000 0.48235 +0.39216 0.25098 0.47843 +0.39608 0.30588 0.47059 +0.40000 0.36471 0.46667 +0.40392 0.43137 0.46275 +0.40784 0.36471 0.45882 +0.41176 0.30588 0.45490 +0.41569 0.25098 0.45098 +0.41961 0.20000 0.44706 +0.42353 0.14902 0.44314 +0.42745 0.10588 0.43922 +0.43137 0.07059 0.43529 +0.43529 0.03529 0.43137 +0.43922 0.01176 0.42745 +0.44314 0.00000 0.42353 +0.44706 0.01569 0.41961 +0.45098 0.04314 0.41569 +0.45490 0.08235 0.41176 +0.45882 0.12549 0.40784 +0.46275 0.17647 0.40392 +0.46667 0.23529 0.40000 +0.47059 0.29804 0.39608 +0.47843 0.36471 0.39216 +0.48235 0.43137 0.38824 +0.48627 0.50980 0.38431 +0.49020 0.43137 0.38039 +0.49412 0.36471 0.37647 +0.49804 0.29804 0.37255 +0.50196 0.23529 0.36471 +0.50588 0.17647 0.36078 +0.50980 0.12549 0.35686 +0.51373 0.08235 0.35294 +0.51765 0.04314 0.34902 +0.52157 0.01569 0.34510 +0.52549 0.00000 0.34118 +0.52941 0.01569 0.33725 +0.53725 0.05098 0.33333 +0.54118 0.09412 0.32941 +0.54510 0.14510 0.32549 +0.54902 0.20784 0.32157 +0.55294 0.27059 0.31765 +0.55686 0.34118 0.31373 +0.56078 0.41961 0.30980 +0.56471 0.50196 0.30588 +0.56863 0.58824 0.30196 +0.57255 0.50196 0.29804 +0.57647 0.41961 0.29804 +0.58431 0.34118 0.29412 +0.58824 0.27059 0.29020 +0.59216 0.20784 0.28627 +0.59608 0.14510 0.28235 +0.60000 0.09412 0.27843 +0.60392 0.05098 0.27451 +0.60784 0.01569 0.27059 +0.61176 0.00000 0.26667 +0.61569 0.01961 0.26275 +0.61961 0.05882 0.25882 +0.62745 0.10588 0.25490 +0.63137 0.16863 0.25098 +0.63529 0.23529 0.24706 +0.63922 0.30980 0.24314 +0.64314 0.38824 0.23922 +0.64706 0.47451 0.23529 +0.65098 0.56863 0.23137 +0.65490 0.66667 0.22745 +0.66275 0.56863 0.22353 +0.66667 0.47451 0.21961 +0.67059 0.38824 0.21569 +0.67451 0.30980 0.21176 +0.67843 0.23529 0.21176 +0.68235 0.16863 0.20784 +0.68627 0.10588 0.20392 +0.69020 0.05882 0.20000 +0.69804 0.01961 0.19608 +0.70196 0.00000 0.19216 +0.70588 0.02353 0.18824 +0.70980 0.06275 0.18431 +0.71373 0.12157 0.18039 +0.71765 0.18824 0.17647 +0.72157 0.26275 0.17255 +0.72549 0.34510 0.17255 +0.73333 0.43529 0.16863 +0.73725 0.52941 0.16471 +0.74118 0.63529 0.16078 +0.74510 0.74510 0.15686 +0.74902 0.63529 0.15294 +0.75294 0.52941 0.14902 +0.75686 0.43529 0.14510 +0.76471 0.34510 0.14118 +0.76863 0.26275 0.14118 +0.77255 0.18824 0.13725 +0.77647 0.12157 0.13333 +0.78039 0.06275 0.12941 +0.78431 0.02353 0.12549 +0.79216 0.00000 0.12157 +0.79608 0.02353 0.11765 +0.80000 0.07059 0.11765 +0.80392 0.13333 0.11373 +0.80784 0.20784 0.10980 +0.81176 0.29020 0.10588 +0.81569 0.38039 0.10196 +0.82353 0.47843 0.09804 +0.82745 0.58824 0.09804 +0.83137 0.70196 0.09412 +0.83529 0.82353 0.09020 +0.83922 0.70196 0.08627 +0.84314 0.58824 0.08235 +0.85098 0.47843 0.08235 +0.85490 0.38039 0.07843 +0.85882 0.29020 0.07451 +0.86275 0.20784 0.07059 +0.86667 0.13333 0.07059 +0.87059 0.07059 0.06667 +0.87843 0.02353 0.06275 +0.88235 0.00000 0.05882 +0.88627 0.02745 0.05490 +0.89020 0.07843 0.05490 +0.89412 0.14510 0.05098 +0.90196 0.22745 0.04706 +0.90588 0.31765 0.04706 +0.90980 0.41569 0.04314 +0.91373 0.52549 0.03922 +0.91765 0.64314 0.03529 +0.92157 0.76863 0.03529 +0.92941 0.90196 0.03137 +0.93333 0.76863 0.02745 +0.93725 0.64314 0.02745 +0.94118 0.52549 0.02353 +0.94510 0.41569 0.01961 +0.95294 0.31765 0.01961 +0.95686 0.25882 0.01569 +0.96078 0.23137 0.01569 +0.96471 0.23922 0.01176 +0.96863 0.27843 0.00784 +0.97647 0.35294 0.00784 +0.98039 0.46275 0.00392 +0.98431 0.58431 0.00392 +0.98824 0.71373 0.00000 +0.99216 0.85098 0.00000 +1.00000 1.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/pseudo2.lut b/vendor/x11iraf/ximtool/luts/pseudo2.lut new file mode 100644 index 00000000..7bb4d78f --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/pseudo2.lut @@ -0,0 +1,256 @@ +0.30980 0.29020 0.22353 +0.32157 0.30196 0.23922 +0.33333 0.31765 0.25490 +0.34510 0.32941 0.27059 +0.35686 0.34510 0.29020 +0.36863 0.36078 0.30588 +0.38039 0.37647 0.32549 +0.39216 0.38824 0.34510 +0.40392 0.40392 0.36471 +0.41569 0.41961 0.38431 +0.42745 0.43529 0.40392 +0.43922 0.45098 0.42353 +0.45098 0.46667 0.44314 +0.46275 0.48235 0.46667 +0.47451 0.49804 0.48627 +0.49020 0.51765 0.50980 +0.50196 0.53333 0.53333 +0.51373 0.54902 0.55686 +0.52549 0.56863 0.58039 +0.54118 0.58431 0.60392 +0.55294 0.60000 0.62745 +0.56863 0.61961 0.65098 +0.58039 0.63529 0.67843 +0.59216 0.65490 0.70196 +0.60784 0.67059 0.72941 +0.61961 0.69020 0.75686 +0.63529 0.70980 0.78431 +0.64706 0.72549 0.75686 +0.66275 0.74510 0.72941 +0.67843 0.76471 0.70588 +0.69020 0.78431 0.68235 +0.70588 0.80392 0.65882 +0.71765 0.82353 0.64314 +0.73333 0.80392 0.62353 +0.74902 0.78824 0.60392 +0.76471 0.77255 0.58824 +0.77647 0.75686 0.57255 +0.79216 0.74118 0.55686 +0.80784 0.73333 0.54118 +0.82353 0.71765 0.52941 +0.83922 0.70588 0.51373 +0.85490 0.69804 0.50588 +0.87059 0.68235 0.49412 +0.85490 0.67451 0.48627 +0.83922 0.66667 0.47843 +0.82745 0.65882 0.47059 +0.81569 0.65098 0.46275 +0.80392 0.63922 0.45882 +0.79216 0.63529 0.45490 +0.78431 0.62745 0.45098 +0.77255 0.61961 0.44706 +0.76078 0.61176 0.44706 +0.74902 0.60784 0.44706 +0.74510 0.60392 0.44706 +0.73333 0.60000 0.44706 +0.72941 0.59608 0.45098 +0.71765 0.59216 0.45490 +0.70980 0.58824 0.45882 +0.70588 0.58824 0.46275 +0.69412 0.58431 0.47059 +0.69020 0.58039 0.47843 +0.68235 0.58039 0.48627 +0.67843 0.58039 0.49412 +0.67451 0.57647 0.50588 +0.66667 0.58039 0.51373 +0.66275 0.57647 0.52941 +0.65490 0.58039 0.54118 +0.65098 0.58039 0.55686 +0.64706 0.58039 0.57255 +0.64314 0.58431 0.58824 +0.63529 0.58824 0.60392 +0.63529 0.58824 0.62353 +0.63137 0.59216 0.64314 +0.62745 0.59608 0.65882 +0.62745 0.60000 0.68235 +0.62353 0.60392 0.70588 +0.62353 0.60784 0.72941 +0.61961 0.61176 0.75686 +0.61961 0.61961 0.78431 +0.61569 0.62745 0.75686 +0.61569 0.63529 0.72941 +0.61176 0.63922 0.70588 +0.61176 0.65098 0.68235 +0.61176 0.65882 0.65882 +0.61176 0.66667 0.64314 +0.61176 0.67451 0.62353 +0.61176 0.68235 0.60392 +0.61176 0.69804 0.58824 +0.61176 0.70588 0.57255 +0.61569 0.71765 0.55686 +0.61569 0.73333 0.54118 +0.61961 0.74118 0.52941 +0.61961 0.75686 0.51373 +0.62353 0.77255 0.50588 +0.62353 0.78824 0.49412 +0.62745 0.80392 0.48627 +0.62745 0.82353 0.47843 +0.63137 0.80392 0.47059 +0.63529 0.78824 0.46275 +0.63529 0.77255 0.45882 +0.64314 0.75686 0.45490 +0.64706 0.74118 0.45098 +0.65098 0.73333 0.44706 +0.65490 0.71765 0.44706 +0.66275 0.70588 0.44706 +0.66667 0.69804 0.44706 +0.67451 0.68235 0.44706 +0.67843 0.67451 0.45098 +0.68235 0.66667 0.45490 +0.69020 0.65882 0.45882 +0.69412 0.65098 0.46275 +0.70588 0.63922 0.47059 +0.70980 0.63529 0.47843 +0.71765 0.62745 0.48627 +0.72941 0.61961 0.49412 +0.73333 0.61176 0.50588 +0.74510 0.60784 0.51373 +0.74902 0.60392 0.52941 +0.76078 0.60000 0.54118 +0.77647 0.59608 0.55686 +0.79216 0.59216 0.57255 +0.80392 0.58824 0.58824 +0.81961 0.58824 0.60392 +0.83922 0.58431 0.62353 +0.85490 0.58039 0.64314 +0.87451 0.58039 0.65882 +0.89804 0.58039 0.68235 +0.92157 0.57647 0.70588 +0.91373 0.58039 0.72941 +0.90588 0.57647 0.75686 +0.89804 0.58039 0.78431 +0.89412 0.58039 0.75686 +0.88627 0.58039 0.72941 +0.88235 0.58431 0.70588 +0.87843 0.58824 0.68235 +0.87451 0.58824 0.65882 +0.87059 0.59216 0.64314 +0.86275 0.59608 0.62353 +0.86275 0.60000 0.60392 +0.85882 0.60392 0.58824 +0.85882 0.60784 0.57255 +0.85490 0.61176 0.55686 +0.85098 0.61961 0.54118 +0.85490 0.62745 0.52941 +0.85098 0.63529 0.51373 +0.85098 0.63922 0.50588 +0.85098 0.65490 0.49412 +0.85098 0.67059 0.48627 +0.85490 0.68235 0.47843 +0.85098 0.69804 0.47059 +0.85490 0.71373 0.46275 +0.85098 0.74118 0.45882 +0.85490 0.75686 0.45490 +0.85882 0.78039 0.45098 +0.86275 0.80392 0.44706 +0.86275 0.82353 0.44706 +0.86667 0.85098 0.44706 +0.87059 0.87843 0.44706 +0.87451 0.90980 0.44706 +0.87843 0.93725 0.45098 +0.88235 0.97255 0.45490 +0.88627 0.96471 0.45882 +0.89020 0.96078 0.46275 +0.89804 0.95686 0.47059 +0.90196 0.95294 0.47843 +0.90588 0.94902 0.48627 +0.91373 0.94902 0.49412 +0.91765 0.94510 0.50588 +0.92549 0.94118 0.51373 +0.92941 0.94510 0.52941 +0.94118 0.94118 0.54118 +0.94902 0.94510 0.55686 +0.95294 0.94510 0.57255 +0.96078 0.94510 0.58824 +0.97255 0.94902 0.60392 +0.98039 0.94902 0.62745 +0.98824 0.95294 0.65098 +0.99608 0.95686 0.67451 +1.00000 0.95686 0.70588 +1.00000 0.96078 0.73333 +1.00000 0.96863 0.76863 +1.00000 0.97255 0.80392 +1.00000 0.98039 0.84314 +1.00000 0.98431 0.82353 +0.98824 0.99216 0.80784 +0.96078 0.99608 0.79608 +0.93333 1.00000 0.78431 +0.90980 1.00000 0.77255 +0.88235 1.00000 0.76471 +0.85882 1.00000 0.75686 +0.83137 1.00000 0.74902 +0.80784 1.00000 0.74118 +0.78039 1.00000 0.73725 +0.75686 1.00000 0.73333 +0.73333 1.00000 0.72941 +0.70588 1.00000 0.72941 +0.69020 1.00000 0.72941 +0.66667 0.97255 0.72941 +0.64314 0.93725 0.73333 +0.62353 0.90196 0.73725 +0.60392 0.86667 0.74118 +0.58431 0.83137 0.74510 +0.56078 0.79608 0.75294 +0.54510 0.76078 0.75686 +0.52941 0.73333 0.76863 +0.51373 0.69804 0.77647 +0.50196 0.67059 0.78824 +0.48627 0.63922 0.80392 +0.47059 0.61176 0.81569 +0.45490 0.58039 0.83137 +0.44314 0.55294 0.84706 +0.43529 0.52941 0.86667 +0.42353 0.50588 0.88235 +0.41569 0.47843 0.90196 +0.41176 0.45490 0.92549 +0.40392 0.43529 0.87843 +0.40000 0.41569 0.83922 +0.39216 0.39216 0.79608 +0.38824 0.37647 0.75686 +0.38431 0.35686 0.72157 +0.38039 0.34118 0.67843 +0.38039 0.32941 0.65098 +0.37255 0.31765 0.61569 +0.37255 0.30588 0.58431 +0.37255 0.29804 0.55686 +0.37255 0.29412 0.52549 +0.37647 0.28627 0.50196 +0.37647 0.28235 0.47843 +0.38039 0.28235 0.45882 +0.38431 0.27843 0.43922 +0.38824 0.27843 0.41961 +0.39608 0.27843 0.40784 +0.40000 0.28235 0.40000 +0.40784 0.28627 0.38824 +0.41569 0.29020 0.38431 +0.42353 0.29804 0.38039 +0.43529 0.30588 0.37647 +0.44706 0.31765 0.37647 +0.45882 0.32549 0.38039 +0.47059 0.34118 0.38431 +0.48235 0.35294 0.39216 +0.50196 0.37255 0.40000 +0.51765 0.39216 0.40784 +0.53725 0.41176 0.42353 +0.55686 0.43922 0.43529 +0.57647 0.46667 0.45098 +0.60000 0.49804 0.47451 +0.62745 0.52941 0.49804 +0.65490 0.56078 0.52549 +0.68235 0.59216 0.54902 +0.70980 0.62745 0.58431 +0.74118 0.66275 0.61569 +0.77255 0.70196 0.65098 +0.80392 0.74118 0.69020 +0.83529 0.78039 0.73333 +0.87059 0.82353 0.78431 diff --git a/vendor/x11iraf/ximtool/luts/rainbow.lut b/vendor/x11iraf/ximtool/luts/rainbow.lut new file mode 100644 index 00000000..37e1977a --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/rainbow.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.16471 +0.02745 0.00000 0.18431 +0.05882 0.00000 0.20000 +0.08627 0.00000 0.21961 +0.11373 0.00000 0.23922 +0.14510 0.00000 0.25882 +0.17647 0.00000 0.27843 +0.20392 0.00000 0.29804 +0.23137 0.00000 0.31765 +0.26275 0.00000 0.33725 +0.29412 0.00000 0.35686 +0.32157 0.00000 0.37647 +0.35294 0.00000 0.39608 +0.38039 0.00000 0.41569 +0.41176 0.00000 0.43529 +0.43922 0.00000 0.45490 +0.47059 0.00000 0.47451 +0.49804 0.00000 0.49412 +0.52941 0.00000 0.51373 +0.55686 0.00000 0.53725 +0.58824 0.00000 0.55686 +0.55686 0.00000 0.57647 +0.52941 0.00000 0.59608 +0.49804 0.00000 0.61569 +0.47059 0.00000 0.63922 +0.43922 0.00000 0.65882 +0.41176 0.00000 0.67843 +0.38039 0.00000 0.70196 +0.35294 0.00000 0.72157 +0.32157 0.00000 0.74118 +0.29412 0.00000 0.76471 +0.26275 0.00000 0.78431 +0.23137 0.00000 0.80392 +0.20392 0.00000 0.82745 +0.17647 0.00000 0.84706 +0.14510 0.00000 0.87059 +0.11373 0.00000 0.89020 +0.08627 0.00000 0.91373 +0.05882 0.00000 0.93333 +0.02745 0.00000 0.95686 +0.00000 0.00000 0.97647 +0.00000 0.00000 1.00000 +0.00000 0.02353 0.97647 +0.00000 0.04706 0.95686 +0.00000 0.06275 0.93333 +0.00000 0.08235 0.91373 +0.00000 0.09804 0.89020 +0.00000 0.11373 0.87059 +0.00000 0.12941 0.84706 +0.00000 0.14118 0.82745 +0.00000 0.15686 0.80392 +0.00000 0.16863 0.78431 +0.00000 0.18431 0.76471 +0.00000 0.19608 0.74118 +0.00000 0.21176 0.72157 +0.00000 0.22353 0.70196 +0.00000 0.23529 0.67843 +0.00000 0.25098 0.65882 +0.00000 0.26275 0.63922 +0.00000 0.27451 0.61569 +0.00000 0.28627 0.59608 +0.00000 0.29804 0.57647 +0.00000 0.30980 0.55686 +0.00000 0.32157 0.53725 +0.00000 0.33333 0.51373 +0.00000 0.34510 0.49412 +0.00000 0.35686 0.47451 +0.00000 0.36863 0.45490 +0.00000 0.38039 0.43529 +0.00000 0.39216 0.41569 +0.00000 0.40392 0.39608 +0.00000 0.41176 0.37647 +0.00000 0.42353 0.35686 +0.00000 0.43529 0.33725 +0.00000 0.44706 0.31765 +0.00000 0.45882 0.29804 +0.00000 0.46667 0.27843 +0.00000 0.47843 0.25882 +0.00000 0.49020 0.23922 +0.00000 0.49804 0.21961 +0.00000 0.50980 0.20000 +0.00000 0.52157 0.18431 +0.00000 0.52941 0.16471 +0.00000 0.54118 0.14510 +0.00000 0.55294 0.12941 +0.00000 0.56078 0.10980 +0.00000 0.57255 0.09412 +0.00000 0.58431 0.07451 +0.00000 0.59216 0.05882 +0.00000 0.60392 0.04314 +0.00000 0.61176 0.02745 +0.00000 0.62353 0.01176 +0.00000 0.63137 0.00000 +0.00000 0.64314 0.00000 +0.00000 0.65098 0.00000 +0.00000 0.66275 0.00000 +0.00000 0.67059 0.00000 +0.00000 0.68235 0.00000 +0.00000 0.69020 0.00000 +0.00000 0.70196 0.00000 +0.00000 0.70980 0.00000 +0.00000 0.72157 0.00000 +0.00000 0.72941 0.00000 +0.00000 0.74118 0.00000 +0.00000 0.74902 0.00000 +0.00000 0.76078 0.00000 +0.00000 0.76863 0.00000 +0.00000 0.77647 0.00000 +0.00000 0.78824 0.00000 +0.00000 0.79608 0.00000 +0.00000 0.80784 0.00000 +0.00000 0.81569 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.83529 0.00000 +0.00000 0.84314 0.00000 +0.00000 0.85490 0.00000 +0.00000 0.86275 0.00000 +0.00000 0.87059 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.89020 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.90980 0.00000 +0.00000 0.91765 0.00000 +0.00000 0.92549 0.00000 +0.00000 0.93725 0.00000 +0.00000 0.94510 0.00000 +0.00000 0.95294 0.00000 +0.00000 0.96078 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.98039 0.00000 +0.00000 0.98824 0.00000 +0.00000 1.00000 0.00000 +0.00000 0.98824 0.00000 +0.00000 0.98039 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.96078 0.00000 +0.00000 0.95294 0.00000 +0.00000 0.94510 0.00000 +0.00000 0.93725 0.00000 +0.00000 0.92549 0.00000 +0.00000 0.91765 0.00000 +0.00000 0.90980 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89020 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.87059 0.00000 +0.00000 0.86275 0.00000 +0.00000 0.85490 0.00000 +0.00000 0.84314 0.00000 +0.00000 0.83529 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.81569 0.00000 +0.00000 0.80784 0.00000 +0.00000 0.79608 0.00000 +0.00000 0.78824 0.00000 +0.00000 0.77647 0.00000 +0.00784 0.76863 0.00000 +0.03529 0.77647 0.00000 +0.06667 0.78824 0.00000 +0.09804 0.80000 0.00000 +0.12941 0.81176 0.00000 +0.16471 0.82745 0.00000 +0.20000 0.84314 0.00000 +0.23529 0.85882 0.00000 +0.26667 0.87059 0.00000 +0.30588 0.89020 0.00000 +0.34118 0.90196 0.00000 +0.37647 0.92157 0.00000 +0.41176 0.93333 0.00000 +0.44706 0.95294 0.00000 +0.48627 0.96863 0.00000 +0.52157 0.98824 0.00000 +0.56078 1.00000 0.00000 +0.59608 1.00000 0.00000 +0.63529 1.00000 0.00000 +0.67059 1.00000 0.00000 +0.70980 1.00000 0.00000 +0.74902 1.00000 0.00000 +0.78431 1.00000 0.00000 +0.82353 1.00000 0.00000 +0.85882 1.00000 0.00000 +0.89804 1.00000 0.00000 +0.93333 1.00000 0.00000 +0.97647 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 1.00000 0.00000 +0.98039 1.00000 0.00000 +0.96078 0.97647 0.00000 +0.94510 0.93725 0.00000 +0.92549 0.89804 0.00000 +0.90980 0.85882 0.00000 +0.89412 0.81961 0.00000 +0.87451 0.78039 0.00000 +0.85882 0.74118 0.00000 +0.83922 0.70196 0.00000 +0.82353 0.66275 0.00000 +0.80392 0.62353 0.00000 +0.78824 0.58431 0.00000 +0.76863 0.54510 0.00000 +0.75686 0.50980 0.00000 +0.74118 0.46667 0.00000 +0.72549 0.43137 0.00000 +0.70980 0.39216 0.00000 +0.69412 0.35294 0.00000 +0.68235 0.31765 0.00000 +0.66275 0.27451 0.00000 +0.65098 0.23922 0.00000 +0.63529 0.20000 0.00000 +0.62745 0.16863 0.00000 +0.61569 0.12941 0.00000 +0.60784 0.09804 0.00000 +0.61961 0.08235 0.00000 +0.62745 0.06275 0.00000 +0.63922 0.04706 0.00000 +0.64706 0.02353 0.00000 +0.65882 0.00000 0.00000 +0.66667 0.00000 0.00000 +0.67843 0.00000 0.00000 +0.68627 0.00000 0.00000 +0.69804 0.00000 0.00000 +0.70980 0.00000 0.00000 +0.71765 0.00000 0.00000 +0.72941 0.00000 0.00000 +0.73725 0.00000 0.00000 +0.74902 0.00000 0.00000 +0.75686 0.00000 0.00000 +0.76863 0.00000 0.00000 +0.77647 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.80000 0.00784 0.00784 +0.80784 0.02745 0.02745 +0.81961 0.05098 0.05098 +0.82745 0.08235 0.08235 +0.83922 0.11373 0.11373 +0.84706 0.14902 0.14902 +0.85882 0.19216 0.19216 +0.86667 0.23137 0.23137 +0.87843 0.27843 0.27843 +0.88627 0.32549 0.32549 +0.89804 0.37647 0.37647 +0.90980 0.43137 0.43137 +0.91765 0.48627 0.48627 +0.92941 0.54118 0.54118 +0.93725 0.60000 0.60000 +0.94902 0.66275 0.66275 +0.95686 0.72549 0.72549 +0.96863 0.79216 0.79216 +0.97647 0.85882 0.85882 +0.98824 0.92941 0.92941 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/rainbow1.lut b/vendor/x11iraf/ximtool/luts/rainbow1.lut new file mode 100644 index 00000000..8871dc2f --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/rainbow1.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.16471 +0.02745 0.00000 0.18431 +0.05882 0.00000 0.20000 +0.08627 0.00000 0.21961 +0.11373 0.00000 0.23922 +0.14510 0.00000 0.25882 +0.17647 0.00000 0.27843 +0.20392 0.00000 0.29804 +0.23137 0.00000 0.31765 +0.26275 0.00000 0.33725 +0.29412 0.00000 0.35686 +0.32157 0.00000 0.37647 +0.35294 0.00000 0.39608 +0.38039 0.00000 0.41569 +0.41176 0.00000 0.43529 +0.43922 0.00000 0.45490 +0.47059 0.00000 0.47451 +0.49804 0.00000 0.49412 +0.52941 0.00000 0.51373 +0.55686 0.00000 0.53725 +0.58824 0.00000 0.55686 +0.55686 0.00000 0.57647 +0.52941 0.00000 0.59608 +0.49804 0.00000 0.61569 +0.47059 0.00000 0.63922 +0.43922 0.00000 0.65882 +0.41176 0.00000 0.67843 +0.38039 0.00000 0.70196 +0.35294 0.00000 0.72157 +0.32157 0.00000 0.74118 +0.29412 0.00000 0.76471 +0.26275 0.00000 0.78431 +0.23137 0.00000 0.80392 +0.20392 0.00000 0.82745 +0.17647 0.00000 0.84706 +0.14510 0.00000 0.87059 +0.11373 0.00000 0.89020 +0.08627 0.00000 0.91373 +0.05882 0.00000 0.93333 +0.02745 0.00000 0.95686 +0.00000 0.00000 0.97647 +0.00000 0.00000 1.00000 +0.00000 0.00000 0.97647 +0.00000 0.00784 0.95686 +0.00000 0.01569 0.93333 +0.00000 0.02353 0.91373 +0.00000 0.03137 0.89020 +0.00000 0.03922 0.87059 +0.00000 0.05098 0.85098 +0.00000 0.06275 0.83137 +0.00000 0.07843 0.81176 +0.00000 0.09804 0.79216 +0.00000 0.11765 0.77255 +0.00000 0.13725 0.75294 +0.00000 0.15686 0.73333 +0.00000 0.17647 0.71373 +0.00000 0.19608 0.69412 +0.00000 0.21569 0.67451 +0.00000 0.23529 0.65882 +0.00000 0.25490 0.64314 +0.00000 0.27059 0.62745 +0.00000 0.28627 0.61176 +0.00000 0.30196 0.59608 +0.00000 0.32157 0.58039 +0.00000 0.33333 0.56471 +0.00000 0.34510 0.54902 +0.00000 0.35686 0.53333 +0.00000 0.36863 0.51765 +0.00000 0.38039 0.50196 +0.00000 0.39216 0.48627 +0.00000 0.40392 0.47059 +0.00000 0.41176 0.45882 +0.00000 0.42353 0.44706 +0.00000 0.43529 0.43529 +0.00000 0.44706 0.42353 +0.00000 0.45882 0.41176 +0.00000 0.46667 0.40000 +0.00000 0.47843 0.38824 +0.00000 0.49020 0.37647 +0.00000 0.49804 0.36471 +0.00000 0.50980 0.35294 +0.00000 0.52157 0.34118 +0.00000 0.52941 0.32941 +0.00000 0.54118 0.31765 +0.00000 0.55294 0.30588 +0.00000 0.56078 0.29412 +0.00000 0.57255 0.28235 +0.00000 0.58431 0.27059 +0.00000 0.59216 0.25882 +0.00000 0.60392 0.24706 +0.00000 0.61176 0.23529 +0.00000 0.62353 0.22353 +0.00000 0.63137 0.21176 +0.00000 0.64314 0.20000 +0.00000 0.65098 0.18824 +0.00000 0.66275 0.17647 +0.00000 0.67059 0.16471 +0.00000 0.68235 0.15294 +0.00000 0.69020 0.14118 +0.00000 0.70196 0.12941 +0.00000 0.70980 0.11765 +0.00000 0.72157 0.10196 +0.00000 0.72941 0.08627 +0.00000 0.74118 0.07059 +0.00000 0.74902 0.05490 +0.00000 0.76078 0.03922 +0.00000 0.76863 0.02353 +0.00000 0.77647 0.00000 +0.00000 0.78824 0.00000 +0.00000 0.79608 0.00000 +0.00000 0.80784 0.00000 +0.00000 0.81569 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.83529 0.00000 +0.00000 0.84314 0.00000 +0.00000 0.85490 0.00000 +0.00000 0.86275 0.00000 +0.00000 0.87059 0.00000 +0.00000 0.88235 0.00000 +0.00000 0.89020 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.90980 0.00000 +0.00000 0.91765 0.00000 +0.00000 0.92549 0.00000 +0.00000 0.93725 0.00000 +0.00000 0.94510 0.00000 +0.00000 0.95294 0.00000 +0.00000 0.96078 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.98039 0.00000 +0.00000 0.98824 0.00000 +0.00784 1.00000 0.00000 +0.01569 0.98824 0.00000 +0.02353 0.98039 0.00000 +0.03137 0.97255 0.00000 +0.04314 0.96078 0.00000 +0.05490 0.95294 0.00000 +0.06667 0.94510 0.00000 +0.07843 0.93725 0.00000 +0.09020 0.92549 0.00000 +0.10196 0.91765 0.00000 +0.11373 0.90980 0.00000 +0.12549 0.89804 0.00000 +0.13725 0.89020 0.00000 +0.14902 0.88235 0.00000 +0.16471 0.87059 0.00000 +0.20000 0.86275 0.00000 +0.23529 0.85490 0.00000 +0.26667 0.84314 0.00000 +0.30588 0.83529 0.00000 +0.34118 0.82353 0.00000 +0.37647 0.81569 0.00000 +0.41176 0.80784 0.00000 +0.44706 0.79608 0.00000 +0.48627 0.78824 0.00000 +0.52157 0.77647 0.00000 +0.56078 0.76863 0.00000 +0.59608 0.77647 0.00000 +0.63529 0.78824 0.00000 +0.67059 0.80000 0.00000 +0.70980 0.81176 0.00000 +0.74902 0.82745 0.00000 +0.78431 0.84314 0.00000 +0.82353 0.85882 0.00000 +0.85882 0.87059 0.00000 +0.89804 0.89020 0.00000 +0.93333 0.90196 0.00000 +0.97647 0.92157 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.95294 0.00000 +1.00000 0.96863 0.00000 +1.00000 0.98824 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 0.97647 0.00000 +1.00000 0.93725 0.00000 +1.00000 0.89804 0.00000 +1.00000 0.85882 0.00000 +1.00000 0.81961 0.00000 +1.00000 0.78039 0.00000 +1.00000 0.74118 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.66275 0.00000 +1.00000 0.62353 0.00000 +1.00000 0.58431 0.00000 +1.00000 0.54510 0.00000 +1.00000 0.50980 0.00000 +1.00000 0.46667 0.00000 +1.00000 0.43137 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.35294 0.00000 +1.00000 0.31765 0.00000 +1.00000 0.27451 0.00000 +1.00000 0.23922 0.00000 +1.00000 0.20000 0.00000 +1.00000 0.16863 0.00000 +1.00000 0.12941 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.08235 0.00000 +1.00000 0.06275 0.00000 +1.00000 0.04706 0.00000 +1.00000 0.02353 0.00000 +1.00000 0.00000 0.00000 +0.99216 0.00000 0.00000 +0.98431 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.96863 0.00000 0.00000 +0.96078 0.00000 0.00000 +0.95294 0.00000 0.00000 +0.94510 0.00000 0.00000 +0.93725 0.00000 0.00000 +0.92941 0.00000 0.00000 +0.92157 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.90588 0.00000 0.00000 +0.89804 0.00000 0.00000 +0.89020 0.00000 0.00000 +0.88235 0.00000 0.00000 +0.87451 0.00000 0.00000 +0.86667 0.00000 0.00000 +0.85882 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.84314 0.00000 0.00000 +0.83529 0.00000 0.00000 +0.82745 0.00000 0.00000 +0.81961 0.00000 0.00000 +0.81176 0.00000 0.00000 +0.80392 0.00000 0.00000 +0.79608 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78039 0.00000 0.00000 +0.77255 0.00000 0.00000 +0.76471 0.00000 0.00000 +0.75686 0.00000 0.00000 +0.74902 0.00000 0.00000 +0.74118 0.00000 0.00000 +0.73333 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/rainbow2.lut b/vendor/x11iraf/ximtool/luts/rainbow2.lut new file mode 100644 index 00000000..594a70cb --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/rainbow2.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.03137 0.00000 0.03137 +0.06275 0.00000 0.06275 +0.09412 0.00000 0.09412 +0.12549 0.00000 0.12549 +0.15686 0.00000 0.15686 +0.18824 0.00000 0.18824 +0.21961 0.00000 0.21961 +0.25098 0.00000 0.25098 +0.28235 0.00000 0.28235 +0.31373 0.00000 0.31373 +0.34510 0.00000 0.34510 +0.37647 0.00000 0.37647 +0.40784 0.00000 0.40784 +0.43922 0.00000 0.43922 +0.47059 0.00000 0.47059 +0.50196 0.00000 0.50196 +0.53333 0.00000 0.53333 +0.56471 0.00000 0.56471 +0.59608 0.00000 0.59608 +0.62745 0.00000 0.62745 +0.65882 0.00000 0.65882 +0.69020 0.00000 0.69020 +0.72157 0.00000 0.72157 +0.75294 0.00000 0.75294 +0.78431 0.00000 0.78431 +0.81569 0.00000 0.81569 +0.84706 0.00000 0.84706 +0.87843 0.00000 0.87843 +0.90980 0.00000 0.90980 +0.94118 0.00000 0.94118 +0.97255 0.00000 0.97255 +1.00000 0.00000 1.00000 +0.96863 0.00000 1.00000 +0.93725 0.00000 1.00000 +0.90588 0.00000 1.00000 +0.87451 0.00000 1.00000 +0.84314 0.00000 1.00000 +0.81176 0.00000 1.00000 +0.78039 0.00000 1.00000 +0.74902 0.00000 1.00000 +0.71765 0.00000 1.00000 +0.68627 0.00000 1.00000 +0.65490 0.00000 1.00000 +0.62353 0.00000 1.00000 +0.59216 0.00000 1.00000 +0.56078 0.00000 1.00000 +0.52941 0.00000 1.00000 +0.49804 0.00000 1.00000 +0.46667 0.00000 1.00000 +0.43529 0.00000 1.00000 +0.40392 0.00000 1.00000 +0.37255 0.00000 1.00000 +0.34118 0.00000 1.00000 +0.30980 0.00000 1.00000 +0.27843 0.00000 1.00000 +0.24706 0.00000 1.00000 +0.21569 0.00000 1.00000 +0.18431 0.00000 1.00000 +0.15294 0.00000 1.00000 +0.12157 0.00000 1.00000 +0.09020 0.00000 1.00000 +0.05882 0.00000 1.00000 +0.02745 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.03137 1.00000 +0.00000 0.06275 1.00000 +0.00000 0.09412 1.00000 +0.00000 0.12549 1.00000 +0.00000 0.15686 1.00000 +0.00000 0.18824 1.00000 +0.00000 0.21961 1.00000 +0.00000 0.25098 1.00000 +0.00000 0.28235 1.00000 +0.00000 0.31373 1.00000 +0.00000 0.34510 1.00000 +0.00000 0.37647 1.00000 +0.00000 0.40784 1.00000 +0.00000 0.43922 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.50196 1.00000 +0.00000 0.53333 1.00000 +0.00000 0.56471 1.00000 +0.00000 0.59608 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.65882 1.00000 +0.00000 0.69020 1.00000 +0.00000 0.72157 1.00000 +0.00000 0.75294 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.81569 1.00000 +0.00000 0.84706 1.00000 +0.00000 0.87843 1.00000 +0.00000 0.90980 1.00000 +0.00000 0.94118 1.00000 +0.00000 0.97255 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 0.96863 +0.00000 1.00000 0.93725 +0.00000 1.00000 0.90588 +0.00000 1.00000 0.87451 +0.00000 1.00000 0.84314 +0.00000 1.00000 0.81176 +0.00000 1.00000 0.78039 +0.00000 1.00000 0.74902 +0.00000 1.00000 0.71765 +0.00000 1.00000 0.68627 +0.00000 1.00000 0.65490 +0.00000 1.00000 0.62353 +0.00000 1.00000 0.59216 +0.00000 1.00000 0.56078 +0.00000 1.00000 0.52941 +0.00000 1.00000 0.49804 +0.00000 1.00000 0.46667 +0.00000 1.00000 0.43529 +0.00000 1.00000 0.40392 +0.00000 1.00000 0.37255 +0.00000 1.00000 0.34118 +0.00000 1.00000 0.30980 +0.00000 1.00000 0.27843 +0.00000 1.00000 0.24706 +0.00000 1.00000 0.21569 +0.00000 1.00000 0.18431 +0.00000 1.00000 0.15294 +0.00000 1.00000 0.12157 +0.00000 1.00000 0.09020 +0.00000 1.00000 0.05882 +0.00000 1.00000 0.02745 +0.00000 1.00000 0.00000 +0.03137 1.00000 0.00000 +0.06275 1.00000 0.00000 +0.09412 1.00000 0.00000 +0.12549 1.00000 0.00000 +0.15686 1.00000 0.00000 +0.18824 1.00000 0.00000 +0.21961 1.00000 0.00000 +0.25098 1.00000 0.00000 +0.28235 1.00000 0.00000 +0.31373 1.00000 0.00000 +0.34510 1.00000 0.00000 +0.37647 1.00000 0.00000 +0.40784 1.00000 0.00000 +0.43922 1.00000 0.00000 +0.47059 1.00000 0.00000 +0.50196 1.00000 0.00000 +0.53333 1.00000 0.00000 +0.56471 1.00000 0.00000 +0.59608 1.00000 0.00000 +0.62745 1.00000 0.00000 +0.65882 1.00000 0.00000 +0.69020 1.00000 0.00000 +0.72157 1.00000 0.00000 +0.75294 1.00000 0.00000 +0.78431 1.00000 0.00000 +0.81569 1.00000 0.00000 +0.84706 1.00000 0.00000 +0.87843 1.00000 0.00000 +0.90980 1.00000 0.00000 +0.94118 1.00000 0.00000 +0.97255 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 0.98431 0.00000 +1.00000 0.96863 0.00000 +1.00000 0.95294 0.00000 +1.00000 0.93725 0.00000 +1.00000 0.92157 0.00000 +1.00000 0.90588 0.00000 +1.00000 0.89020 0.00000 +1.00000 0.87451 0.00000 +1.00000 0.85882 0.00000 +1.00000 0.84314 0.00000 +1.00000 0.82745 0.00000 +1.00000 0.81176 0.00000 +1.00000 0.79608 0.00000 +1.00000 0.78039 0.00000 +1.00000 0.76471 0.00000 +1.00000 0.74902 0.00000 +1.00000 0.73333 0.00000 +1.00000 0.71765 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.68627 0.00000 +1.00000 0.67059 0.00000 +1.00000 0.65490 0.00000 +1.00000 0.63922 0.00000 +1.00000 0.62353 0.00000 +1.00000 0.60784 0.00000 +1.00000 0.59216 0.00000 +1.00000 0.57647 0.00000 +1.00000 0.56078 0.00000 +1.00000 0.54510 0.00000 +1.00000 0.52941 0.00000 +1.00000 0.51373 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.48235 0.00000 +1.00000 0.46667 0.00000 +1.00000 0.45098 0.00000 +1.00000 0.43529 0.00000 +1.00000 0.41961 0.00000 +1.00000 0.40392 0.00000 +1.00000 0.38824 0.00000 +1.00000 0.37255 0.00000 +1.00000 0.35686 0.00000 +1.00000 0.34118 0.00000 +1.00000 0.32549 0.00000 +1.00000 0.30980 0.00000 +1.00000 0.29412 0.00000 +1.00000 0.27843 0.00000 +1.00000 0.26275 0.00000 +1.00000 0.24706 0.00000 +1.00000 0.23137 0.00000 +1.00000 0.21569 0.00000 +1.00000 0.20000 0.00000 +1.00000 0.18431 0.00000 +1.00000 0.16863 0.00000 +1.00000 0.15294 0.00000 +1.00000 0.13725 0.00000 +1.00000 0.12157 0.00000 +1.00000 0.10588 0.00000 +1.00000 0.09020 0.00000 +1.00000 0.07451 0.00000 +1.00000 0.05882 0.00000 +1.00000 0.04314 0.00000 +1.00000 0.02745 0.00000 +1.00000 0.01176 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.03137 0.03137 +1.00000 0.06275 0.06275 +1.00000 0.09412 0.09412 +1.00000 0.12549 0.12549 +1.00000 0.15686 0.15686 +1.00000 0.18824 0.18824 +1.00000 0.21961 0.21961 +1.00000 0.25098 0.25098 +1.00000 0.28235 0.28235 +1.00000 0.31373 0.31373 +1.00000 0.34510 0.34510 +1.00000 0.37647 0.37647 +1.00000 0.40784 0.40784 +1.00000 0.43922 0.43922 +1.00000 0.47059 0.47059 +1.00000 0.50196 0.50196 +1.00000 0.53333 0.53333 +1.00000 0.56471 0.56471 +1.00000 0.59608 0.59608 +1.00000 0.62745 0.62745 +1.00000 0.65882 0.65882 +1.00000 0.69020 0.69020 +1.00000 0.72157 0.72157 +1.00000 0.75294 0.75294 +1.00000 0.78431 0.78431 +1.00000 0.81569 0.81569 +1.00000 0.84706 0.84706 +1.00000 0.87843 0.87843 +1.00000 0.90980 0.90980 +1.00000 0.94118 0.94118 +1.00000 0.97255 0.97255 diff --git a/vendor/x11iraf/ximtool/luts/rainbow3.lut b/vendor/x11iraf/ximtool/luts/rainbow3.lut new file mode 100644 index 00000000..f9769859 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/rainbow3.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.03922 +0.00000 0.00000 0.07843 +0.00000 0.00000 0.11765 +0.00000 0.00000 0.15686 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.23922 +0.00000 0.00000 0.27843 +0.00000 0.00000 0.31765 +0.00000 0.00000 0.35686 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.43922 +0.00000 0.00000 0.47843 +0.00000 0.00000 0.51765 +0.00000 0.00000 0.55686 +0.00000 0.00000 0.60000 +0.00000 0.00000 0.63922 +0.00000 0.00000 0.67843 +0.00000 0.00000 0.71765 +0.00000 0.00000 0.75686 +0.00000 0.00000 0.80000 +0.00000 0.00000 0.83922 +0.00000 0.00000 0.87843 +0.00000 0.00000 0.91765 +0.00000 0.00000 0.95686 +0.00000 0.00000 1.00000 +0.00000 0.03137 1.00000 +0.00000 0.06275 1.00000 +0.00000 0.09412 1.00000 +0.00000 0.12549 1.00000 +0.00000 0.15686 1.00000 +0.00000 0.18824 1.00000 +0.00000 0.21961 1.00000 +0.00000 0.25490 1.00000 +0.00000 0.28627 1.00000 +0.00000 0.31765 1.00000 +0.00000 0.34902 1.00000 +0.00000 0.38039 1.00000 +0.00000 0.41176 1.00000 +0.00000 0.44314 1.00000 +0.00000 0.47843 1.00000 +0.00000 0.49804 1.00000 +0.00000 0.51765 1.00000 +0.00000 0.53725 1.00000 +0.00000 0.55686 1.00000 +0.00000 0.58039 1.00000 +0.00000 0.60000 1.00000 +0.00000 0.61961 1.00000 +0.00000 0.63922 1.00000 +0.00000 0.65882 1.00000 +0.00000 0.68235 1.00000 +0.00000 0.70196 1.00000 +0.00000 0.72157 1.00000 +0.00000 0.74118 1.00000 +0.00000 0.76078 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.79608 1.00000 +0.00000 0.81176 1.00000 +0.00000 0.82745 1.00000 +0.00000 0.83922 1.00000 +0.00000 0.85490 1.00000 +0.00000 0.87059 1.00000 +0.00000 0.88235 1.00000 +0.00000 0.89804 1.00000 +0.00000 0.91373 1.00000 +0.00000 0.92549 1.00000 +0.00000 0.94118 1.00000 +0.00000 0.95686 1.00000 +0.00000 0.96863 1.00000 +0.00000 0.98431 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 0.98039 +0.00000 1.00000 0.96078 +0.00000 1.00000 0.94118 +0.00000 1.00000 0.92157 +0.00000 1.00000 0.90196 +0.00000 1.00000 0.88235 +0.00000 1.00000 0.86275 +0.00000 1.00000 0.84314 +0.00000 1.00000 0.82353 +0.00000 1.00000 0.80392 +0.00000 1.00000 0.78431 +0.00000 1.00000 0.76471 +0.00000 1.00000 0.74510 +0.00000 1.00000 0.72549 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.65882 +0.00000 1.00000 0.61176 +0.00000 1.00000 0.56471 +0.00000 1.00000 0.51765 +0.00000 1.00000 0.47059 +0.00000 1.00000 0.42353 +0.00000 1.00000 0.37647 +0.00000 1.00000 0.32549 +0.00000 1.00000 0.27843 +0.00000 1.00000 0.23137 +0.00000 1.00000 0.18431 +0.00000 1.00000 0.13725 +0.00000 1.00000 0.09020 +0.00000 1.00000 0.04314 +0.00000 1.00000 0.00000 +0.04706 1.00000 0.00000 +0.09412 1.00000 0.00000 +0.14118 1.00000 0.00000 +0.18824 1.00000 0.00000 +0.23529 1.00000 0.00000 +0.28235 1.00000 0.00000 +0.32941 1.00000 0.00000 +0.37647 1.00000 0.00000 +0.42353 1.00000 0.00000 +0.47059 1.00000 0.00000 +0.51765 1.00000 0.00000 +0.56471 1.00000 0.00000 +0.61176 1.00000 0.00000 +0.65882 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.72549 1.00000 0.00000 +0.74510 1.00000 0.00000 +0.76471 1.00000 0.00000 +0.78431 1.00000 0.00000 +0.80392 1.00000 0.00000 +0.82353 1.00000 0.00000 +0.84314 1.00000 0.00000 +0.86275 1.00000 0.00000 +0.88235 1.00000 0.00000 +0.90196 1.00000 0.00000 +0.92157 1.00000 0.00000 +0.94118 1.00000 0.00000 +0.96078 1.00000 0.00000 +0.98039 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 0.98039 0.00000 +0.99608 0.96078 0.00000 +0.99608 0.94510 0.00000 +0.99608 0.92549 0.00000 +0.99608 0.90588 0.00000 +0.99216 0.89020 0.00000 +0.99216 0.87059 0.00000 +0.99216 0.85098 0.00000 +0.99216 0.83529 0.00000 +0.99216 0.81569 0.00000 +0.98824 0.79608 0.00000 +0.98824 0.78039 0.00000 +0.98824 0.76078 0.00000 +0.98824 0.74118 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.70588 0.00000 +0.98824 0.69020 0.00000 +0.98824 0.67451 0.00000 +0.98824 0.65490 0.00000 +0.99216 0.63922 0.00000 +0.99216 0.62353 0.00000 +0.99216 0.60392 0.00000 +0.99216 0.58824 0.00000 +0.99216 0.57255 0.00000 +0.99608 0.55294 0.00000 +0.99608 0.53725 0.00000 +0.99608 0.52157 0.00000 +0.99608 0.50196 0.00000 +0.99608 0.48627 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.43922 0.00000 +1.00000 0.40784 0.00000 +1.00000 0.37647 0.00000 +1.00000 0.34510 0.00000 +1.00000 0.31373 0.00000 +1.00000 0.28235 0.00000 +1.00000 0.25098 0.00000 +1.00000 0.21569 0.00000 +1.00000 0.18431 0.00000 +1.00000 0.15294 0.00000 +1.00000 0.12157 0.00000 +1.00000 0.09020 0.00000 +1.00000 0.05882 0.00000 +1.00000 0.02745 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.04706 +1.00000 0.00000 0.09412 +1.00000 0.00000 0.14118 +1.00000 0.00000 0.18824 +1.00000 0.00000 0.23529 +1.00000 0.00000 0.28235 +1.00000 0.00000 0.32941 +1.00000 0.00000 0.37647 +1.00000 0.00000 0.42353 +1.00000 0.00000 0.47059 +1.00000 0.00000 0.51765 +1.00000 0.00000 0.56471 +1.00000 0.00000 0.61176 +1.00000 0.00000 0.65882 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.72549 +1.00000 0.00000 0.74902 +1.00000 0.00000 0.77255 +1.00000 0.00000 0.79608 +1.00000 0.00000 0.81569 +1.00000 0.00000 0.83922 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.88627 +1.00000 0.00000 0.90588 +1.00000 0.00000 0.92941 +1.00000 0.00000 0.95294 +1.00000 0.00000 0.97647 +1.00000 0.00000 1.00000 +1.00000 0.03529 1.00000 +1.00000 0.07059 1.00000 +1.00000 0.10588 1.00000 +1.00000 0.14118 1.00000 +1.00000 0.18039 1.00000 +1.00000 0.21569 1.00000 +1.00000 0.25098 1.00000 +1.00000 0.28627 1.00000 +1.00000 0.32549 1.00000 +1.00000 0.36078 1.00000 +1.00000 0.39608 1.00000 +1.00000 0.43137 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.48627 1.00000 +1.00000 0.50588 1.00000 +1.00000 0.52157 1.00000 +1.00000 0.54118 1.00000 +1.00000 0.56078 1.00000 +1.00000 0.57647 1.00000 +1.00000 0.59608 1.00000 +1.00000 0.61176 1.00000 +1.00000 0.63137 1.00000 +1.00000 0.65098 1.00000 +1.00000 0.66667 1.00000 +1.00000 0.68627 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.74510 1.00000 +1.00000 0.78824 1.00000 +1.00000 0.83137 1.00000 +1.00000 0.87059 1.00000 +1.00000 0.91373 1.00000 +1.00000 0.95686 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/rainbow4.lut b/vendor/x11iraf/ximtool/luts/rainbow4.lut new file mode 100644 index 00000000..233da89d --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/rainbow4.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.01176 +0.00000 0.00000 0.02745 +0.00000 0.00000 0.04314 +0.00000 0.00000 0.05882 +0.00000 0.00000 0.07451 +0.00000 0.00000 0.09020 +0.00000 0.00000 0.10588 +0.00000 0.00000 0.12157 +0.00000 0.00000 0.13725 +0.00000 0.00000 0.15294 +0.00000 0.00000 0.16863 +0.00000 0.00000 0.18431 +0.00000 0.00000 0.20000 +0.00000 0.00000 0.21176 +0.00000 0.00000 0.22745 +0.00000 0.00000 0.24314 +0.00000 0.00000 0.25882 +0.00000 0.00000 0.27451 +0.00000 0.00000 0.29020 +0.00000 0.00000 0.30588 +0.00000 0.00000 0.32157 +0.00000 0.00000 0.33725 +0.00000 0.00000 0.35294 +0.00000 0.00000 0.36863 +0.00000 0.00000 0.38431 +0.00000 0.00000 0.40000 +0.00000 0.00000 0.41176 +0.00000 0.00000 0.42745 +0.00000 0.00000 0.44314 +0.00000 0.00000 0.45882 +0.00000 0.00000 0.47451 +0.00000 0.00000 0.49020 +0.00000 0.00000 0.50588 +0.00000 0.00000 0.52157 +0.00000 0.00000 0.53725 +0.00000 0.00000 0.55294 +0.00000 0.00000 0.56863 +0.00000 0.00000 0.58431 +0.00000 0.00000 0.60000 +0.00000 0.00000 0.61176 +0.00000 0.00000 0.62745 +0.00000 0.00000 0.64314 +0.00000 0.00000 0.65882 +0.00000 0.00000 0.67451 +0.00000 0.00000 0.69020 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.72157 +0.00000 0.00000 0.73725 +0.00000 0.00000 0.75294 +0.00000 0.00000 0.76863 +0.00000 0.00000 0.78431 +0.00000 0.00000 0.80000 +0.00000 0.00000 0.81176 +0.00000 0.00000 0.82745 +0.00000 0.00000 0.84314 +0.00000 0.00000 0.85882 +0.00000 0.00000 0.87451 +0.00000 0.00000 0.89020 +0.00000 0.00000 0.90588 +0.00000 0.00000 0.92157 +0.00000 0.00000 0.93725 +0.00000 0.00000 0.95294 +0.00000 0.00000 0.96863 +0.00000 0.00000 0.98431 +0.00000 0.00000 1.00000 +0.00000 0.03529 1.00000 +0.00000 0.07059 1.00000 +0.00000 0.10980 1.00000 +0.00000 0.14510 1.00000 +0.00000 0.18039 1.00000 +0.00000 0.21961 1.00000 +0.00000 0.25490 1.00000 +0.00000 0.29412 1.00000 +0.00000 0.32941 1.00000 +0.00000 0.36471 1.00000 +0.00000 0.40392 1.00000 +0.00000 0.43922 1.00000 +0.00000 0.47843 1.00000 +0.00000 0.50196 1.00000 +0.00000 0.52549 1.00000 +0.00000 0.54902 1.00000 +0.00000 0.57255 1.00000 +0.00000 0.59608 1.00000 +0.00000 0.61961 1.00000 +0.00000 0.64314 1.00000 +0.00000 0.66667 1.00000 +0.00000 0.69020 1.00000 +0.00000 0.71373 1.00000 +0.00000 0.73725 1.00000 +0.00000 0.76078 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.80000 1.00000 +0.00000 0.81569 1.00000 +0.00000 0.83137 1.00000 +0.00000 0.84706 1.00000 +0.00000 0.86667 1.00000 +0.00000 0.88235 1.00000 +0.00000 0.89804 1.00000 +0.00000 0.91373 1.00000 +0.00000 0.93333 1.00000 +0.00000 0.94902 1.00000 +0.00000 0.96471 1.00000 +0.00000 0.98039 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 0.97647 +0.00000 1.00000 0.95294 +0.00000 1.00000 0.92941 +0.00000 1.00000 0.90588 +0.00000 1.00000 0.88627 +0.00000 1.00000 0.86275 +0.00000 1.00000 0.83922 +0.00000 1.00000 0.81569 +0.00000 1.00000 0.79608 +0.00000 1.00000 0.77255 +0.00000 1.00000 0.74902 +0.00000 1.00000 0.72549 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.65098 +0.00000 1.00000 0.59608 +0.00000 1.00000 0.54118 +0.00000 1.00000 0.48627 +0.00000 1.00000 0.43137 +0.00000 1.00000 0.37647 +0.00000 1.00000 0.32549 +0.00000 1.00000 0.27059 +0.00000 1.00000 0.21569 +0.00000 1.00000 0.16078 +0.00000 1.00000 0.10588 +0.00000 1.00000 0.05098 +0.00000 1.00000 0.00000 +0.05098 1.00000 0.00000 +0.10588 1.00000 0.00000 +0.16078 1.00000 0.00000 +0.21569 1.00000 0.00000 +0.27059 1.00000 0.00000 +0.32549 1.00000 0.00000 +0.37647 1.00000 0.00000 +0.43137 1.00000 0.00000 +0.48627 1.00000 0.00000 +0.54118 1.00000 0.00000 +0.59608 1.00000 0.00000 +0.65098 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.72549 1.00000 0.00000 +0.74902 1.00000 0.00000 +0.77255 1.00000 0.00000 +0.79608 1.00000 0.00000 +0.81569 1.00000 0.00000 +0.83922 1.00000 0.00000 +0.86275 1.00000 0.00000 +0.88627 1.00000 0.00000 +0.90588 1.00000 0.00000 +0.92941 1.00000 0.00000 +0.95294 1.00000 0.00000 +0.97647 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 0.97647 0.00000 +0.99608 0.95686 0.00000 +0.99608 0.93333 0.00000 +0.99608 0.91373 0.00000 +0.99216 0.89412 0.00000 +0.99216 0.87059 0.00000 +0.99216 0.85098 0.00000 +0.99216 0.82745 0.00000 +0.98824 0.80784 0.00000 +0.98824 0.78824 0.00000 +0.98824 0.76471 0.00000 +0.98824 0.74510 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.70588 0.00000 +0.98824 0.68627 0.00000 +0.98824 0.66667 0.00000 +0.98824 0.64706 0.00000 +0.99216 0.62745 0.00000 +0.99216 0.60784 0.00000 +0.99216 0.58824 0.00000 +0.99216 0.56863 0.00000 +0.99608 0.54902 0.00000 +0.99608 0.52941 0.00000 +0.99608 0.50980 0.00000 +0.99608 0.49020 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.43137 0.00000 +1.00000 0.39608 0.00000 +1.00000 0.36078 0.00000 +1.00000 0.32549 0.00000 +1.00000 0.28627 0.00000 +1.00000 0.25098 0.00000 +1.00000 0.21569 0.00000 +1.00000 0.18039 0.00000 +1.00000 0.14118 0.00000 +1.00000 0.10588 0.00000 +1.00000 0.07059 0.00000 +1.00000 0.03529 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.05098 +1.00000 0.00000 0.10588 +1.00000 0.00000 0.16078 +1.00000 0.00000 0.21569 +1.00000 0.00000 0.27059 +1.00000 0.00000 0.32549 +1.00000 0.00000 0.37647 +1.00000 0.00000 0.43137 +1.00000 0.00000 0.48627 +1.00000 0.00000 0.54118 +1.00000 0.00000 0.59608 +1.00000 0.00000 0.65098 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.72549 +1.00000 0.00000 0.74902 +1.00000 0.00000 0.77255 +1.00000 0.00000 0.79608 +1.00000 0.00000 0.81569 +1.00000 0.00000 0.83922 +1.00000 0.00000 0.86275 +1.00000 0.00000 0.88627 +1.00000 0.00000 0.90588 +1.00000 0.00000 0.92941 +1.00000 0.00000 0.95294 +1.00000 0.00000 0.97647 +1.00000 0.00000 1.00000 +1.00000 0.03529 1.00000 +1.00000 0.07059 1.00000 +1.00000 0.10588 1.00000 +1.00000 0.14118 1.00000 +1.00000 0.18039 1.00000 +1.00000 0.21569 1.00000 +1.00000 0.25098 1.00000 +1.00000 0.28627 1.00000 +1.00000 0.32549 1.00000 +1.00000 0.36078 1.00000 +1.00000 0.39608 1.00000 +1.00000 0.43137 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.48627 1.00000 +1.00000 0.50588 1.00000 +1.00000 0.52157 1.00000 +1.00000 0.54118 1.00000 +1.00000 0.56078 1.00000 +1.00000 0.57647 1.00000 +1.00000 0.59608 1.00000 +1.00000 0.61176 1.00000 +1.00000 0.63137 1.00000 +1.00000 0.65098 1.00000 +1.00000 0.66667 1.00000 +1.00000 0.68627 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.74510 1.00000 +1.00000 0.78824 1.00000 +1.00000 0.83137 1.00000 +1.00000 0.87059 1.00000 +1.00000 0.91373 1.00000 +1.00000 0.95686 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/random.lut b/vendor/x11iraf/ximtool/luts/random.lut new file mode 100644 index 00000000..1b09399d --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/random.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.51765 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98431 0.81176 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.76863 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 0.89804 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +0.92157 0.61961 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.65882 0.59608 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.26275 0.87843 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 0.74118 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.65490 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.36078 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.98431 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.99608 0.97647 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98824 0.77647 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.36863 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.46667 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +0.91373 0.00000 0.97255 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.53333 0.00000 0.87451 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.80392 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.13725 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/random1.lut b/vendor/x11iraf/ximtool/luts/random1.lut new file mode 100644 index 00000000..98dafa52 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/random1.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.00000 0.00000 0.16471 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.23137 0.00000 0.31765 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.47451 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.47059 0.00000 0.63922 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.23137 0.00000 0.80392 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.00000 0.97647 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.05098 0.85098 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.19608 0.69412 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.33333 0.56471 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.42353 0.44706 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.50980 0.35294 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.59216 0.25882 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.67059 0.16471 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.74902 0.05490 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.82353 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.89804 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.00000 0.97255 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.05490 0.95294 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.14902 0.88235 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.41176 0.80784 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +0.70980 0.81176 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 0.93333 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.70196 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.39216 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +1.00000 0.09804 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.97647 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.91373 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.85098 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 +0.78824 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/random2.lut b/vendor/x11iraf/ximtool/luts/random2.lut new file mode 100644 index 00000000..6c0acc81 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/random2.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.47059 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.62745 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 0.78431 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 1.00000 0.00392 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00392 0.86275 0.47059 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.78431 0.62745 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.70588 0.78431 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.00000 0.62745 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.47059 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.23529 0.00392 1.00000 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.47059 0.00392 0.78431 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.62745 0.00392 0.62745 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.78431 0.00392 0.47059 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +0.90196 0.11765 0.23529 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.23529 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.59608 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +0.98039 0.98039 0.47059 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/random3.lut b/vendor/x11iraf/ximtool/luts/random3.lut new file mode 100644 index 00000000..60f216ea --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/random3.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.47059 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.47059 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 0.78431 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.47059 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/random4.lut b/vendor/x11iraf/ximtool/luts/random4.lut new file mode 100644 index 00000000..6865308b --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/random4.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.70588 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.00000 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.47059 0.00000 0.86275 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +0.70588 0.00000 0.90196 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.70588 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +1.00000 0.47059 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72549 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +0.98431 0.85098 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.70588 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 0.70588 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.47059 0.78431 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.62745 0.62745 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +0.78431 0.47059 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.70588 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 0.86275 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/real.lut b/vendor/x11iraf/ximtool/luts/real.lut new file mode 100644 index 00000000..4eb841ea --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/real.lut @@ -0,0 +1,256 @@ +0.00784 0.00392 0.00000 +0.01569 0.00784 0.00000 +0.02353 0.01176 0.00000 +0.03137 0.01569 0.00000 +0.03922 0.01961 0.00000 +0.04706 0.02353 0.00000 +0.05490 0.02745 0.00000 +0.06275 0.03137 0.00000 +0.07059 0.03529 0.00000 +0.07843 0.03922 0.00000 +0.08627 0.04314 0.00000 +0.09412 0.04706 0.00000 +0.10196 0.05098 0.00000 +0.10980 0.05490 0.00000 +0.11765 0.05882 0.00000 +0.12549 0.06275 0.00000 +0.13333 0.06667 0.00000 +0.14118 0.07059 0.00000 +0.14902 0.07451 0.00000 +0.15686 0.07843 0.00000 +0.16471 0.08235 0.00000 +0.17255 0.08627 0.00000 +0.18039 0.09020 0.00000 +0.18824 0.09412 0.00000 +0.19608 0.09804 0.00000 +0.20392 0.10196 0.00000 +0.21176 0.10588 0.00000 +0.21961 0.10980 0.00000 +0.22745 0.11373 0.00000 +0.23529 0.11765 0.00000 +0.24314 0.12157 0.00000 +0.25098 0.12549 0.00000 +0.25882 0.12941 0.00000 +0.26667 0.13333 0.00000 +0.27451 0.13725 0.00000 +0.28235 0.14118 0.00000 +0.29020 0.14510 0.00000 +0.29804 0.14902 0.00000 +0.30588 0.15294 0.00000 +0.31373 0.15686 0.00000 +0.32157 0.16078 0.00000 +0.32941 0.16471 0.00000 +0.33725 0.16863 0.00000 +0.34510 0.17255 0.00000 +0.35294 0.17647 0.00000 +0.36078 0.18039 0.00000 +0.36863 0.18431 0.00000 +0.37647 0.18824 0.00000 +0.38431 0.19216 0.00000 +0.39216 0.19608 0.00000 +0.40000 0.20000 0.00000 +0.40784 0.20392 0.00000 +0.41569 0.20784 0.00000 +0.42353 0.21176 0.00000 +0.43137 0.21569 0.00000 +0.43922 0.21961 0.00000 +0.44706 0.22353 0.00000 +0.45490 0.22745 0.00000 +0.46275 0.23137 0.00000 +0.47059 0.23529 0.00000 +0.47843 0.23922 0.00000 +0.48627 0.24314 0.00000 +0.49412 0.24706 0.00000 +0.50196 0.25098 0.00000 +0.50980 0.25490 0.00000 +0.51765 0.25882 0.00000 +0.52549 0.26275 0.00000 +0.53333 0.26667 0.00000 +0.54118 0.27059 0.00000 +0.54902 0.27451 0.00000 +0.55686 0.27843 0.00000 +0.56471 0.28235 0.00000 +0.57255 0.28627 0.00000 +0.58039 0.29020 0.00000 +0.58824 0.29412 0.00000 +0.59608 0.29804 0.00000 +0.60392 0.30196 0.00000 +0.61176 0.30588 0.00000 +0.61961 0.30980 0.00000 +0.62745 0.31373 0.00000 +0.63529 0.31765 0.00000 +0.64314 0.32157 0.00000 +0.65098 0.32549 0.00000 +0.65882 0.32941 0.00000 +0.66667 0.33333 0.00000 +0.67451 0.33725 0.00000 +0.68235 0.34118 0.00000 +0.69020 0.34510 0.00000 +0.69804 0.34902 0.00000 +0.70588 0.35294 0.00000 +0.71373 0.35686 0.00000 +0.72157 0.36078 0.00000 +0.72941 0.36471 0.00000 +0.73725 0.36863 0.00000 +0.74510 0.37255 0.00000 +0.75294 0.37647 0.00000 +0.76078 0.38039 0.00000 +0.76863 0.38431 0.00000 +0.77647 0.38824 0.00000 +0.78431 0.39216 0.00000 +0.79216 0.39608 0.00000 +0.80000 0.40000 0.00000 +0.80784 0.40392 0.00000 +0.81569 0.40784 0.00000 +0.82353 0.41176 0.00000 +0.83137 0.41569 0.00000 +0.83922 0.41961 0.00000 +0.84706 0.42353 0.00000 +0.85490 0.42745 0.00000 +0.86275 0.43137 0.00000 +0.87059 0.43529 0.00000 +0.87843 0.43922 0.00000 +0.88627 0.44314 0.00000 +0.89412 0.44706 0.00000 +0.90196 0.45098 0.00000 +0.90980 0.45490 0.00000 +0.91765 0.45882 0.00000 +0.92549 0.46275 0.00000 +0.93333 0.46667 0.00000 +0.94118 0.47059 0.00000 +0.94902 0.47451 0.00000 +0.95686 0.47843 0.00000 +0.96471 0.48235 0.00000 +0.97255 0.48627 0.00000 +0.98039 0.49020 0.00000 +0.98824 0.49412 0.00000 +0.99608 0.49804 0.00000 +1.00000 0.50196 0.00000 +1.00000 0.50588 0.00784 +1.00000 0.50980 0.01569 +1.00000 0.51373 0.02353 +1.00000 0.51765 0.03137 +1.00000 0.52157 0.03922 +1.00000 0.52549 0.04706 +1.00000 0.52941 0.05490 +1.00000 0.53333 0.06275 +1.00000 0.53725 0.07059 +1.00000 0.54118 0.07843 +1.00000 0.54510 0.08627 +1.00000 0.54902 0.09412 +1.00000 0.55294 0.10196 +1.00000 0.55686 0.10980 +1.00000 0.56078 0.11765 +1.00000 0.56471 0.12549 +1.00000 0.56863 0.13333 +1.00000 0.57255 0.14118 +1.00000 0.57647 0.14902 +1.00000 0.58039 0.15686 +1.00000 0.58431 0.16471 +1.00000 0.58824 0.17255 +1.00000 0.59216 0.18039 +1.00000 0.59608 0.18824 +1.00000 0.60000 0.19608 +1.00000 0.60392 0.20392 +1.00000 0.60784 0.21176 +1.00000 0.61176 0.21961 +1.00000 0.61569 0.22745 +1.00000 0.61961 0.23529 +1.00000 0.62353 0.24314 +1.00000 0.62745 0.25098 +1.00000 0.63137 0.25882 +1.00000 0.63529 0.26667 +1.00000 0.63922 0.27451 +1.00000 0.64314 0.28235 +1.00000 0.64706 0.29020 +1.00000 0.65098 0.29804 +1.00000 0.65490 0.30588 +1.00000 0.65882 0.31373 +1.00000 0.66275 0.32157 +1.00000 0.66667 0.32941 +1.00000 0.67059 0.33725 +1.00000 0.67451 0.34510 +1.00000 0.67843 0.35294 +1.00000 0.68235 0.36078 +1.00000 0.68627 0.36863 +1.00000 0.69020 0.37647 +1.00000 0.69412 0.38431 +1.00000 0.69804 0.39216 +1.00000 0.70196 0.40000 +1.00000 0.70588 0.40784 +1.00000 0.70980 0.41569 +1.00000 0.71373 0.42353 +1.00000 0.71765 0.43137 +1.00000 0.72157 0.43922 +1.00000 0.72549 0.44706 +1.00000 0.72941 0.45490 +1.00000 0.73333 0.46275 +1.00000 0.73725 0.47059 +1.00000 0.74118 0.47843 +1.00000 0.74510 0.48627 +1.00000 0.74902 0.49412 +1.00000 0.75294 0.50196 +1.00000 0.75686 0.50980 +1.00000 0.76078 0.51765 +1.00000 0.76471 0.52549 +1.00000 0.76863 0.53333 +1.00000 0.77255 0.54118 +1.00000 0.77647 0.54902 +1.00000 0.78039 0.55686 +1.00000 0.78431 0.56471 +1.00000 0.78824 0.57255 +1.00000 0.79216 0.58039 +1.00000 0.79608 0.58824 +1.00000 0.80000 0.59608 +1.00000 0.80392 0.60392 +1.00000 0.80784 0.61176 +1.00000 0.81176 0.61961 +1.00000 0.81569 0.62745 +1.00000 0.81961 0.63529 +1.00000 0.82353 0.64314 +1.00000 0.82745 0.65098 +1.00000 0.83137 0.65882 +1.00000 0.83529 0.66667 +1.00000 0.83922 0.67451 +1.00000 0.84314 0.68235 +1.00000 0.84706 0.69020 +1.00000 0.85098 0.69804 +1.00000 0.85490 0.70588 +1.00000 0.85882 0.71373 +1.00000 0.86275 0.72157 +1.00000 0.86667 0.72941 +1.00000 0.87059 0.73725 +1.00000 0.87451 0.74510 +1.00000 0.87843 0.75294 +1.00000 0.88235 0.76078 +1.00000 0.88627 0.76863 +1.00000 0.89020 0.77647 +1.00000 0.89412 0.78431 +1.00000 0.89804 0.79216 +1.00000 0.90196 0.80000 +1.00000 0.90588 0.80784 +1.00000 0.90980 0.81569 +1.00000 0.91373 0.82353 +1.00000 0.91765 0.83137 +1.00000 0.92157 0.83922 +1.00000 0.92549 0.84706 +1.00000 0.92941 0.85490 +1.00000 0.93333 0.86275 +1.00000 0.93725 0.87059 +1.00000 0.94118 0.87843 +1.00000 0.94510 0.88627 +1.00000 0.94902 0.89412 +1.00000 0.95294 0.90196 +1.00000 0.95686 0.90980 +1.00000 0.96078 0.91765 +1.00000 0.96471 0.92549 +1.00000 0.96863 0.93333 +1.00000 0.97255 0.94118 +1.00000 0.97647 0.94902 +1.00000 0.98039 0.95686 +1.00000 0.98431 0.96471 +1.00000 0.98824 0.97255 +1.00000 0.99216 0.98039 +1.00000 0.99608 0.98824 +1.00000 1.00000 0.99608 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/smooth.lut b/vendor/x11iraf/ximtool/luts/smooth.lut new file mode 100644 index 00000000..b8f5973a --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/smooth.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 1.00000 +0.01569 0.00000 0.98431 +0.03529 0.00000 0.96471 +0.05098 0.00000 0.94902 +0.06667 0.00000 0.93333 +0.08627 0.00000 0.91373 +0.10196 0.00000 0.89804 +0.11765 0.00000 0.88235 +0.13725 0.00000 0.86275 +0.15294 0.00000 0.84706 +0.16863 0.00000 0.83137 +0.18824 0.00000 0.81176 +0.20392 0.00000 0.79608 +0.21961 0.00000 0.78039 +0.23922 0.00000 0.76078 +0.25490 0.00000 0.74510 +0.27059 0.00000 0.72941 +0.28627 0.00000 0.71373 +0.30588 0.00000 0.69412 +0.32157 0.00000 0.67843 +0.33725 0.00000 0.66275 +0.35686 0.00000 0.64314 +0.37255 0.00000 0.62745 +0.38824 0.00000 0.61176 +0.40784 0.00000 0.59216 +0.42353 0.00000 0.57647 +0.43922 0.00000 0.56078 +0.45882 0.00000 0.54118 +0.47451 0.00000 0.52549 +0.49020 0.00000 0.50980 +0.50980 0.00000 0.49020 +0.52549 0.00000 0.47451 +0.54118 0.00000 0.45882 +0.56078 0.00000 0.43922 +0.57647 0.00000 0.42353 +0.59216 0.00000 0.40784 +0.61176 0.00000 0.38824 +0.62745 0.00000 0.37255 +0.64314 0.00000 0.35686 +0.66275 0.00000 0.33725 +0.67843 0.00000 0.32157 +0.69412 0.00000 0.30588 +0.71373 0.00000 0.28627 +0.72941 0.00000 0.27059 +0.74510 0.00000 0.25490 +0.76078 0.00000 0.23922 +0.78039 0.00000 0.21961 +0.79608 0.00000 0.20392 +0.81176 0.00000 0.18824 +0.83137 0.00000 0.16863 +0.84706 0.00000 0.15294 +0.86275 0.00000 0.13725 +0.88235 0.00000 0.11765 +0.89804 0.00000 0.10196 +0.91373 0.00000 0.08627 +0.93333 0.00000 0.06667 +0.94902 0.00000 0.05098 +0.96471 0.00000 0.03529 +0.98431 0.00000 0.01569 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.01176 0.00000 +1.00000 0.01961 0.00000 +1.00000 0.03137 0.00000 +1.00000 0.03922 0.00000 +1.00000 0.05098 0.00000 +1.00000 0.05882 0.00000 +1.00000 0.07059 0.00000 +1.00000 0.08235 0.00000 +1.00000 0.09020 0.00000 +1.00000 0.10196 0.00000 +1.00000 0.10980 0.00000 +1.00000 0.12157 0.00000 +1.00000 0.12941 0.00000 +1.00000 0.14118 0.00000 +0.99608 0.15294 0.00000 +0.99608 0.16078 0.00000 +0.99608 0.17255 0.00000 +0.99608 0.18039 0.00000 +0.99608 0.19216 0.00000 +0.99608 0.20392 0.00000 +0.99608 0.21176 0.00000 +0.99608 0.22353 0.00000 +0.99608 0.23137 0.00000 +0.99608 0.24314 0.00000 +0.99608 0.25098 0.00000 +0.99608 0.26275 0.00000 +0.99608 0.27451 0.00000 +0.99608 0.28235 0.00000 +0.99608 0.29412 0.00000 +0.99608 0.30196 0.00000 +0.99608 0.31373 0.00000 +0.99608 0.32157 0.00000 +0.99608 0.33333 0.00000 +0.99608 0.34510 0.00000 +0.99608 0.35294 0.00000 +0.99608 0.36471 0.00000 +0.99608 0.37255 0.00000 +0.99608 0.38431 0.00000 +0.99608 0.39216 0.00000 +0.99608 0.40392 0.00000 +0.99608 0.41569 0.00000 +0.99608 0.42353 0.00000 +0.99608 0.43529 0.00000 +0.99608 0.44314 0.00000 +0.99216 0.45490 0.00000 +0.99216 0.46667 0.00000 +0.99216 0.47451 0.00000 +0.99216 0.48627 0.00000 +0.99216 0.49412 0.00000 +0.99216 0.50588 0.00000 +0.99216 0.51373 0.00000 +0.99216 0.52549 0.00000 +0.99216 0.53725 0.00000 +0.99216 0.54510 0.00000 +0.99216 0.55686 0.00000 +0.99216 0.56471 0.00000 +0.99216 0.57647 0.00000 +0.99216 0.58431 0.00000 +0.99216 0.59608 0.00000 +0.99216 0.60000 0.00000 +0.99216 0.60784 0.00000 +0.99216 0.61176 0.00000 +0.99216 0.61569 0.00000 +0.99216 0.61961 0.00000 +0.99216 0.62745 0.00000 +0.99216 0.63137 0.00000 +0.99216 0.63529 0.00000 +0.99216 0.64314 0.00000 +0.98824 0.64706 0.00000 +0.98824 0.65098 0.00000 +0.98824 0.65882 0.00000 +0.98824 0.66275 0.00000 +0.98824 0.66667 0.00000 +0.98824 0.67451 0.00000 +0.98824 0.67843 0.00000 +0.98824 0.68235 0.00000 +0.98824 0.68627 0.00000 +0.98824 0.69412 0.00000 +0.98824 0.69804 0.00000 +0.98824 0.70196 0.00000 +0.98824 0.70980 0.00000 +0.98824 0.71373 0.00000 +0.98824 0.71765 0.00000 +0.98824 0.72549 0.00000 +0.98824 0.72941 0.00000 +0.98824 0.73333 0.00000 +0.98824 0.73725 0.00000 +0.98824 0.74510 0.00000 +0.98824 0.74902 0.00000 +0.98431 0.75294 0.00000 +0.98431 0.76078 0.00000 +0.98431 0.76471 0.00000 +0.98431 0.76863 0.00000 +0.98431 0.77255 0.00000 +0.98431 0.78039 0.00000 +0.98431 0.78431 0.00000 +0.98431 0.78824 0.00000 +0.98431 0.79608 0.00000 +0.98431 0.80000 0.00000 +0.98431 0.80392 0.00000 +0.98431 0.81176 0.00000 +0.98431 0.81569 0.00000 +0.98431 0.81961 0.00000 +0.98431 0.82745 0.00000 +0.98431 0.83137 0.00000 +0.98431 0.83529 0.00000 +0.98431 0.83922 0.00000 +0.98431 0.84706 0.00000 +0.98431 0.85098 0.00000 +0.98039 0.85490 0.00000 +0.98039 0.86275 0.00000 +0.98039 0.86667 0.00000 +0.98039 0.87059 0.00000 +0.98039 0.87843 0.00000 +0.98039 0.88235 0.00000 +0.98039 0.88627 0.00000 +0.98039 0.89020 0.00000 +0.98039 0.89804 0.00000 +0.98039 0.90196 0.00000 +0.98039 0.90196 0.00000 +0.96471 0.88627 0.00000 +0.94902 0.87059 0.00000 +0.92941 0.85490 0.00000 +0.91373 0.83922 0.00000 +0.89804 0.82745 0.00000 +0.88235 0.81176 0.00000 +0.86275 0.79608 0.00000 +0.84706 0.78039 0.00000 +0.83137 0.76471 0.00000 +0.81569 0.74902 0.00000 +0.79608 0.73333 0.00000 +0.78039 0.71765 0.00000 +0.76471 0.70196 0.00000 +0.74902 0.68627 0.00000 +0.72941 0.67451 0.00000 +0.71373 0.65882 0.00000 +0.69804 0.64314 0.00000 +0.68235 0.62745 0.00000 +0.66275 0.61176 0.00000 +0.64706 0.59608 0.00000 +0.63137 0.58039 0.00000 +0.61569 0.56471 0.00000 +0.60000 0.54902 0.00000 +0.58039 0.53333 0.00000 +0.56471 0.52157 0.00000 +0.54902 0.50588 0.00000 +0.53333 0.49020 0.00000 +0.51373 0.47451 0.00000 +0.49804 0.45882 0.00000 +0.48235 0.44314 0.00000 +0.46667 0.42745 0.00000 +0.44706 0.41176 0.00000 +0.43137 0.39608 0.00000 +0.41569 0.38039 0.00000 +0.40000 0.36863 0.00000 +0.38039 0.35294 0.00000 +0.36471 0.33725 0.00000 +0.34902 0.32157 0.00000 +0.33333 0.30588 0.00000 +0.31765 0.29020 0.00000 +0.29804 0.27451 0.00000 +0.28235 0.25882 0.00000 +0.26667 0.24314 0.00000 +0.25098 0.22745 0.00000 +0.23137 0.21569 0.00000 +0.21569 0.20000 0.00000 +0.20000 0.18431 0.00000 +0.18431 0.16863 0.00000 +0.16471 0.15294 0.00000 +0.14902 0.13725 0.00000 +0.13333 0.12157 0.00000 +0.11765 0.10588 0.00000 +0.09804 0.09020 0.00000 +0.08235 0.07451 0.00000 +0.06667 0.06275 0.00000 +0.05098 0.04706 0.00000 +0.03137 0.03137 0.00000 +0.01569 0.01569 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 +0.00000 0.00000 0.00000 diff --git a/vendor/x11iraf/ximtool/luts/staircase.lut b/vendor/x11iraf/ximtool/luts/staircase.lut new file mode 100644 index 00000000..dd67419c --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/staircase.lut @@ -0,0 +1,256 @@ +0.00392 0.00392 0.31373 +0.00784 0.00784 0.31373 +0.01176 0.01176 0.31373 +0.01569 0.01569 0.31373 +0.01961 0.01961 0.31373 +0.02353 0.02353 0.31373 +0.02745 0.02745 0.31373 +0.03137 0.03137 0.31373 +0.03529 0.03529 0.31373 +0.03922 0.03922 0.31373 +0.04314 0.04314 0.31373 +0.04706 0.04706 0.31373 +0.05098 0.05098 0.31373 +0.05490 0.05490 0.31373 +0.05882 0.05882 0.31373 +0.06275 0.06275 0.31373 +0.06667 0.06667 0.47059 +0.07059 0.07059 0.47059 +0.07451 0.07451 0.47059 +0.07843 0.07843 0.47059 +0.08235 0.08235 0.47059 +0.08627 0.08627 0.47059 +0.09020 0.09020 0.47059 +0.09412 0.09412 0.47059 +0.09804 0.09804 0.47059 +0.10196 0.10196 0.47059 +0.10588 0.10588 0.47059 +0.10980 0.10980 0.47059 +0.11373 0.11373 0.47059 +0.11765 0.11765 0.47059 +0.12157 0.12157 0.47059 +0.12549 0.12549 0.47059 +0.12941 0.12941 0.62745 +0.13333 0.13333 0.62745 +0.13725 0.13725 0.62745 +0.14118 0.14118 0.62745 +0.14510 0.14510 0.62745 +0.14902 0.14902 0.62745 +0.15294 0.15294 0.62745 +0.15686 0.15686 0.62745 +0.16078 0.16078 0.62745 +0.16471 0.16471 0.62745 +0.16863 0.16863 0.62745 +0.17255 0.17255 0.62745 +0.17647 0.17647 0.62745 +0.18039 0.18039 0.62745 +0.18431 0.18431 0.62745 +0.18824 0.18824 0.62745 +0.19216 0.19216 0.78431 +0.19608 0.19608 0.78431 +0.20000 0.20000 0.78431 +0.20392 0.20392 0.78431 +0.20784 0.20784 0.78431 +0.21176 0.21176 0.78431 +0.21569 0.21569 0.78431 +0.21961 0.21961 0.78431 +0.22353 0.22353 0.78431 +0.22745 0.22745 0.78431 +0.23137 0.23137 0.78431 +0.23529 0.23529 0.78431 +0.23922 0.23922 0.78431 +0.24314 0.24314 0.78431 +0.24706 0.24706 0.78431 +0.25098 0.25098 0.78431 +0.25490 0.25490 0.94118 +0.25882 0.25882 0.94118 +0.26275 0.26275 0.94118 +0.26667 0.26667 0.94118 +0.27059 0.27059 0.94118 +0.27451 0.27451 0.94118 +0.27843 0.27843 0.94118 +0.28235 0.28235 0.94118 +0.28627 0.28627 0.94118 +0.29020 0.29020 0.94118 +0.29412 0.29412 0.94118 +0.29804 0.29804 0.94118 +0.30196 0.30196 0.94118 +0.30588 0.30588 0.94118 +0.30980 0.30980 0.94118 +0.31373 0.31373 0.94118 +0.31765 0.31765 0.95294 +0.32157 0.32157 0.96471 +0.32549 0.32549 0.97647 +0.32941 0.32941 0.98824 +0.33333 0.33333 1.00000 +0.00392 0.31373 0.00392 +0.00784 0.31373 0.00784 +0.01176 0.31373 0.01176 +0.01569 0.31373 0.01569 +0.01961 0.31373 0.01961 +0.02353 0.31373 0.02353 +0.02745 0.31373 0.02745 +0.03137 0.31373 0.03137 +0.03529 0.31373 0.03529 +0.03922 0.31373 0.03922 +0.04314 0.31373 0.04314 +0.04706 0.31373 0.04706 +0.05098 0.31373 0.05098 +0.05490 0.31373 0.05490 +0.05882 0.31373 0.05882 +0.06275 0.31373 0.06275 +0.06667 0.47059 0.06667 +0.07059 0.47059 0.07059 +0.07451 0.47059 0.07451 +0.07843 0.47059 0.07843 +0.08235 0.47059 0.08235 +0.08627 0.47059 0.08627 +0.09020 0.47059 0.09020 +0.09412 0.47059 0.09412 +0.09804 0.47059 0.09804 +0.10196 0.47059 0.10196 +0.10588 0.47059 0.10588 +0.10980 0.47059 0.10980 +0.11373 0.47059 0.11373 +0.11765 0.47059 0.11765 +0.12157 0.47059 0.12157 +0.12549 0.47059 0.12549 +0.12941 0.62745 0.12941 +0.13333 0.62745 0.13333 +0.13725 0.62745 0.13725 +0.14118 0.62745 0.14118 +0.14510 0.62745 0.14510 +0.14902 0.62745 0.14902 +0.15294 0.62745 0.15294 +0.15686 0.62745 0.15686 +0.16078 0.62745 0.16078 +0.16471 0.62745 0.16471 +0.16863 0.62745 0.16863 +0.17255 0.62745 0.17255 +0.17647 0.62745 0.17647 +0.18039 0.62745 0.18039 +0.18431 0.62745 0.18431 +0.18824 0.62745 0.18824 +0.19216 0.78431 0.19216 +0.19608 0.78431 0.19608 +0.20000 0.78431 0.20000 +0.20392 0.78431 0.20392 +0.20784 0.78431 0.20784 +0.21176 0.78431 0.21176 +0.21569 0.78431 0.21569 +0.21961 0.78431 0.21961 +0.22353 0.78431 0.22353 +0.22745 0.78431 0.22745 +0.23137 0.78431 0.23137 +0.23529 0.78431 0.23529 +0.23922 0.78431 0.23922 +0.24314 0.78431 0.24314 +0.24706 0.78431 0.24706 +0.25098 0.78431 0.25098 +0.25490 0.94118 0.25490 +0.25882 0.94118 0.25882 +0.26275 0.94118 0.26275 +0.26667 0.94118 0.26667 +0.27059 0.94118 0.27059 +0.27451 0.94118 0.27451 +0.27843 0.94118 0.27843 +0.28235 0.94118 0.28235 +0.28627 0.94118 0.28627 +0.29020 0.94118 0.29020 +0.29412 0.94118 0.29412 +0.29804 0.94118 0.29804 +0.30196 0.94118 0.30196 +0.30588 0.94118 0.30588 +0.30980 0.94118 0.30980 +0.31373 0.94118 0.31373 +0.31765 0.95294 0.31765 +0.32157 0.96471 0.32157 +0.32549 0.97647 0.32549 +0.32941 0.98824 0.32941 +0.33333 1.00000 0.33333 +0.31373 0.00392 0.00392 +0.31373 0.00784 0.00784 +0.31373 0.01176 0.01176 +0.31373 0.01569 0.01569 +0.31373 0.01961 0.01961 +0.31373 0.02353 0.02353 +0.31373 0.02745 0.02745 +0.31373 0.03137 0.03137 +0.31373 0.03529 0.03529 +0.31373 0.03922 0.03922 +0.31373 0.04314 0.04314 +0.31373 0.04706 0.04706 +0.31373 0.05098 0.05098 +0.31373 0.05490 0.05490 +0.31373 0.05882 0.05882 +0.31373 0.06275 0.06275 +0.47059 0.06667 0.06667 +0.47059 0.07059 0.07059 +0.47059 0.07451 0.07451 +0.47059 0.07843 0.07843 +0.47059 0.08235 0.08235 +0.47059 0.08627 0.08627 +0.47059 0.09020 0.09020 +0.47059 0.09412 0.09412 +0.47059 0.09804 0.09804 +0.47059 0.10196 0.10196 +0.47059 0.10588 0.10588 +0.47059 0.10980 0.10980 +0.47059 0.11373 0.11373 +0.47059 0.11765 0.11765 +0.47059 0.12157 0.12157 +0.47059 0.12549 0.12549 +0.62745 0.12941 0.12941 +0.62745 0.13333 0.13333 +0.62745 0.13725 0.13725 +0.62745 0.14118 0.14118 +0.62745 0.14510 0.14510 +0.62745 0.14902 0.14902 +0.62745 0.15294 0.15294 +0.62745 0.15686 0.15686 +0.62745 0.16078 0.16078 +0.62745 0.16471 0.16471 +0.62745 0.16863 0.16863 +0.62745 0.17255 0.17255 +0.62745 0.17647 0.17647 +0.62745 0.18039 0.18039 +0.62745 0.18431 0.18431 +0.62745 0.18824 0.18824 +0.78431 0.19216 0.19216 +0.78431 0.19608 0.19608 +0.78431 0.20000 0.20000 +0.78431 0.20392 0.20392 +0.78431 0.20784 0.20784 +0.78431 0.21176 0.21176 +0.78431 0.21569 0.21569 +0.78431 0.21961 0.21961 +0.78431 0.22353 0.22353 +0.78431 0.22745 0.22745 +0.78431 0.23137 0.23137 +0.78431 0.23529 0.23529 +0.78431 0.23922 0.23922 +0.78431 0.24314 0.24314 +0.78431 0.24706 0.24706 +0.78431 0.25098 0.25098 +0.94118 0.25490 0.25490 +0.94118 0.25882 0.25882 +0.94118 0.26275 0.26275 +0.94118 0.26667 0.26667 +0.94118 0.27059 0.27059 +0.94118 0.27451 0.27451 +0.94118 0.27843 0.27843 +0.94118 0.28235 0.28235 +0.94118 0.28627 0.28627 +0.94118 0.29020 0.29020 +0.94118 0.29412 0.29412 +0.94118 0.29804 0.29804 +0.94118 0.30196 0.30196 +0.94118 0.30588 0.30588 +0.94118 0.30980 0.30980 +0.94118 0.31373 0.31373 +0.94902 0.39216 0.39216 +0.96078 0.52941 0.52941 +0.97255 0.66667 0.66667 +0.98431 0.80392 0.80392 +0.99216 0.80000 0.80000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/stairs8.lut b/vendor/x11iraf/ximtool/luts/stairs8.lut new file mode 100644 index 00000000..8fab692a --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/stairs8.lut @@ -0,0 +1,256 @@ +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +0.76471 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +1.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +0.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 1.00000 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.49804 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 +1.00000 1.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/stairs9.lut b/vendor/x11iraf/ximtool/luts/stairs9.lut new file mode 100644 index 00000000..cb1f6385 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/stairs9.lut @@ -0,0 +1,256 @@ +0.00000 0.00000 0.00000 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.19608 0.19608 0.19608 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.60784 0.00000 0.47451 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.78431 0.00000 0.00000 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.92549 0.65490 0.37255 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.56863 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 0.96471 0.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 1.00000 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.69412 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 +0.00000 0.00000 1.00000 diff --git a/vendor/x11iraf/ximtool/luts/standard.lut b/vendor/x11iraf/ximtool/luts/standard.lut new file mode 100644 index 00000000..477e4bc8 --- /dev/null +++ b/vendor/x11iraf/ximtool/luts/standard.lut @@ -0,0 +1,256 @@ +0.00392 0.00392 0.33333 +0.00784 0.00784 0.34118 +0.01176 0.01176 0.34902 +0.01569 0.01569 0.35686 +0.01961 0.01961 0.36471 +0.02353 0.02353 0.37255 +0.02745 0.02745 0.38039 +0.03137 0.03137 0.38824 +0.03529 0.03529 0.39608 +0.03922 0.03922 0.40392 +0.04314 0.04314 0.41176 +0.04706 0.04706 0.41961 +0.05098 0.05098 0.42745 +0.05490 0.05490 0.43529 +0.05882 0.05882 0.44314 +0.06275 0.06275 0.45098 +0.06667 0.06667 0.45882 +0.07059 0.07059 0.46667 +0.07451 0.07451 0.47451 +0.07843 0.07843 0.48235 +0.08235 0.08235 0.49020 +0.08627 0.08627 0.49804 +0.09020 0.09020 0.50588 +0.09412 0.09412 0.51373 +0.09804 0.09804 0.52157 +0.10196 0.10196 0.52941 +0.10588 0.10588 0.53725 +0.10980 0.10980 0.54510 +0.11373 0.11373 0.55294 +0.11765 0.11765 0.56078 +0.12157 0.12157 0.56863 +0.12549 0.12549 0.57647 +0.12941 0.12941 0.58431 +0.13333 0.13333 0.59210 +0.13725 0.13725 0.60000 +0.14118 0.14118 0.60784 +0.14510 0.14510 0.61569 +0.14902 0.14902 0.62353 +0.15294 0.15294 0.63137 +0.15686 0.15686 0.63922 +0.16078 0.16078 0.64706 +0.16471 0.16471 0.65490 +0.16863 0.16863 0.66275 +0.17255 0.17255 0.67059 +0.17647 0.17647 0.67843 +0.18039 0.18039 0.68627 +0.18431 0.18431 0.69412 +0.18824 0.18824 0.70196 +0.19216 0.19216 0.70980 +0.19608 0.19608 0.71765 +0.20000 0.20000 0.72549 +0.20392 0.20392 0.73333 +0.20784 0.20784 0.74118 +0.21176 0.21176 0.74902 +0.21569 0.21569 0.75686 +0.21961 0.21961 0.76471 +0.22353 0.22353 0.77255 +0.22745 0.22745 0.78039 +0.23137 0.23137 0.78824 +0.23529 0.23529 0.79608 +0.23922 0.23922 0.80392 +0.24314 0.24314 0.81176 +0.24706 0.24706 0.81961 +0.25098 0.25098 0.82745 +0.25490 0.25490 0.83529 +0.25882 0.25882 0.84314 +0.26275 0.26275 0.85098 +0.26667 0.26667 0.85882 +0.27059 0.27059 0.86667 +0.27451 0.27451 0.87451 +0.27843 0.27843 0.88235 +0.28235 0.28235 0.89020 +0.28627 0.28627 0.89804 +0.29020 0.29020 0.90588 +0.29412 0.29412 0.91373 +0.29804 0.29804 0.92157 +0.30196 0.30196 0.92941 +0.30588 0.30588 0.93725 +0.30980 0.30980 0.94510 +0.31373 0.31373 0.95294 +0.31765 0.31765 0.96078 +0.32157 0.32157 0.96863 +0.32549 0.32549 0.97647 +0.32941 0.32941 0.98431 +0.33333 0.33333 0.99216 +0.00392 0.33333 0.00392 +0.00784 0.34118 0.00784 +0.01176 0.34902 0.01176 +0.01569 0.35686 0.01569 +0.01961 0.36471 0.01961 +0.02353 0.37255 0.02353 +0.02745 0.38039 0.02745 +0.03137 0.38824 0.03137 +0.03529 0.39608 0.03529 +0.03922 0.40392 0.03922 +0.04314 0.41176 0.04314 +0.04706 0.41961 0.04706 +0.05098 0.42745 0.05098 +0.05490 0.43529 0.05490 +0.05882 0.44314 0.05882 +0.06275 0.45098 0.06275 +0.06667 0.45882 0.06667 +0.07059 0.46667 0.07059 +0.07451 0.47451 0.07451 +0.07843 0.48235 0.07843 +0.08235 0.49020 0.08235 +0.08627 0.49804 0.08627 +0.09020 0.50588 0.09020 +0.09412 0.51373 0.09412 +0.09804 0.52157 0.09804 +0.10196 0.52941 0.10196 +0.10588 0.53725 0.10588 +0.10980 0.54510 0.10980 +0.11373 0.55294 0.11373 +0.11765 0.56078 0.11765 +0.12157 0.56863 0.12157 +0.12549 0.57647 0.12549 +0.12941 0.58431 0.12941 +0.13333 0.59210 0.13333 +0.13725 0.60000 0.13725 +0.14118 0.60784 0.14118 +0.14510 0.61569 0.14510 +0.14902 0.62353 0.14902 +0.15294 0.63137 0.15294 +0.15686 0.63922 0.15686 +0.16078 0.64706 0.16078 +0.16471 0.65490 0.16471 +0.16863 0.66275 0.16863 +0.17255 0.67059 0.17255 +0.17647 0.67843 0.17647 +0.18039 0.68627 0.18039 +0.18431 0.69412 0.18431 +0.18824 0.70196 0.18824 +0.19216 0.70980 0.19216 +0.19608 0.71765 0.19608 +0.20000 0.72549 0.20000 +0.20392 0.73333 0.20392 +0.20784 0.74118 0.20784 +0.21176 0.74902 0.21176 +0.21569 0.75686 0.21569 +0.21961 0.76471 0.21961 +0.22353 0.77255 0.22353 +0.22745 0.78039 0.22745 +0.23137 0.78824 0.23137 +0.23529 0.79608 0.23529 +0.23922 0.80392 0.23922 +0.24314 0.81176 0.24314 +0.24706 0.81961 0.24706 +0.25098 0.82745 0.25098 +0.25490 0.83529 0.25490 +0.25882 0.84314 0.25882 +0.26275 0.85098 0.26275 +0.26667 0.85882 0.26667 +0.27059 0.86667 0.27059 +0.27451 0.87451 0.27451 +0.27843 0.88235 0.27843 +0.28235 0.89020 0.28235 +0.28627 0.89804 0.28627 +0.29020 0.90588 0.29020 +0.29412 0.91373 0.29412 +0.29804 0.92157 0.29804 +0.30196 0.92941 0.30196 +0.30588 0.93725 0.30588 +0.30980 0.94510 0.30980 +0.31373 0.95294 0.31373 +0.31765 0.96078 0.31765 +0.32157 0.96863 0.32157 +0.32549 0.97647 0.32549 +0.32941 0.98431 0.32941 +0.33333 0.99216 0.33333 +0.33333 0.00392 0.00392 +0.34118 0.00784 0.00784 +0.34902 0.01176 0.01176 +0.35686 0.01569 0.01569 +0.36471 0.01961 0.01961 +0.37255 0.02353 0.02353 +0.38039 0.02745 0.02745 +0.38824 0.03137 0.03137 +0.39608 0.03529 0.03529 +0.40392 0.03922 0.03922 +0.41176 0.04314 0.04314 +0.41961 0.04706 0.04706 +0.42745 0.05098 0.05098 +0.43529 0.05490 0.05490 +0.44314 0.05882 0.05882 +0.45098 0.06275 0.06275 +0.45882 0.06667 0.06667 +0.46667 0.07059 0.07059 +0.47451 0.07451 0.07451 +0.48235 0.07843 0.07843 +0.49020 0.08235 0.08235 +0.49804 0.08627 0.08627 +0.50588 0.09020 0.09020 +0.51373 0.09412 0.09412 +0.52157 0.09804 0.09804 +0.52941 0.10196 0.10196 +0.53725 0.10588 0.10588 +0.54510 0.10980 0.10980 +0.55294 0.11373 0.11373 +0.56078 0.11765 0.11765 +0.56863 0.12157 0.12157 +0.57647 0.12549 0.12549 +0.58431 0.12941 0.12941 +0.59210 0.13333 0.13333 +0.60000 0.13725 0.13725 +0.60784 0.14118 0.14118 +0.61569 0.14510 0.14510 +0.62353 0.14902 0.14902 +0.63137 0.15294 0.15294 +0.63922 0.15686 0.15686 +0.64706 0.16078 0.16078 +0.65490 0.16471 0.16471 +0.66275 0.16863 0.16863 +0.67059 0.17255 0.17255 +0.67843 0.17647 0.17647 +0.68627 0.18039 0.18039 +0.69412 0.18431 0.18431 +0.70196 0.18824 0.18824 +0.70980 0.19216 0.19216 +0.71765 0.19608 0.19608 +0.72549 0.20000 0.20000 +0.73333 0.20392 0.20392 +0.74118 0.20784 0.20784 +0.74902 0.21176 0.21176 +0.75686 0.21569 0.21569 +0.76471 0.21961 0.21961 +0.77255 0.22353 0.22353 +0.78039 0.22745 0.22745 +0.78824 0.23137 0.23137 +0.79608 0.23529 0.23529 +0.80392 0.23922 0.23922 +0.81176 0.24314 0.24314 +0.81961 0.24706 0.24706 +0.82745 0.25098 0.25098 +0.83529 0.25490 0.25490 +0.84314 0.25882 0.25882 +0.85098 0.26275 0.26275 +0.85882 0.26667 0.26667 +0.86667 0.27059 0.27059 +0.87451 0.27451 0.27451 +0.88235 0.27843 0.27843 +0.89020 0.28235 0.28235 +0.89804 0.28627 0.28627 +0.90588 0.29020 0.29020 +0.91373 0.29412 0.29412 +0.92157 0.29804 0.29804 +0.92941 0.30196 0.30196 +0.93725 0.30588 0.30588 +0.94510 0.30980 0.30980 +0.95294 0.31373 0.31373 +0.96078 0.31765 0.31765 +0.96863 0.32157 0.32157 +0.97647 0.32549 0.32549 +0.98431 0.32941 0.32941 +0.99216 0.33333 0.33333 +1.00000 0.33725 0.33725 diff --git a/vendor/x11iraf/ximtool/print.c b/vendor/x11iraf/ximtool/print.c new file mode 100644 index 00000000..63822aa4 --- /dev/null +++ b/vendor/x11iraf/ximtool/print.c @@ -0,0 +1,387 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <ctype.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> + +#include "ximtool.h" + + +/* +** PRINT.C -- Printer interface. +** +** xim_print (xim, x0,y0, nx,ny) +** +** ximp_rename (xim, old, new) # print alert action +** ximp_cancel (xim, fname) # print alert action +** +** xim_initPrinterOps (xim) +** xim_initPrinterList (xim) +** xim_getPrinterInfo (xim, printer) +** +** xim_print prints the indicated region of the display frame (raster 0). +** If nx or ny is zero the full display frame is printed. The output device +** or file and all print options are maintained in the printer context within +** the XIM descriptor. The xim_initPrinter routines should be called at +** startup to initialize the print options and load the list of local printers. +*/ + +void xim_initPrinterOps(); +int xim_getPrinterInfo(); + +static void printstat(); +static void xim_initPrinterList(); + + +/* XIM_PRINT -- Print the indicated region of the current display frame to +** the printer device or to a file. +*/ + +xim_print (xim, x0,y0, nx,ny) +register XimDataPtr xim; +int x0,y0, nx,ny; /* region of source raster */ +{ + register PSImagePtr psim = xim->psim; + register PrintCfgPtr pcp = xim->pcp; + register FrameBufPtr fb = xim->df_p; + register ColorMapPtr cm = &colormaps[fb->colormap-1]; + unsigned char r[256], g[256], b[256]; + unsigned char *pixels = NULL; + static char tmpfile[SZ_FNAME]; + static char fname[SZ_FNAME]; + static char text[SZ_LINE]; + int w, h, ncolors; + FILE *fp; + char *mktemp(); + + + bzero (text, SZ_LINE); + bzero (fname, SZ_FNAME); + bzero (tmpfile, SZ_FNAME); + + + /* Get the display pixels and colormap. The routine allocates a + * pointer to the pixels we'll need to free when we're done. + */ + printstat (xim, "Get image data..."); + pixels = xim_readDisplay (xim, x0,y0,nx,ny, &w,&h, r,g,b, &ncolors); + if (!pixels) + return (-1); + + /* Set up some of the EPS options and load the colormap. */ + if (psim->label && (psim->page.flags & EPS_DOTITLE)) + eps_setLabel (psim, fb->ctran.imtitle); + eps_setCmap (psim, r, g, b, ncolors); + eps_setTransform (psim, fb->ctran.z1, fb->ctran.z2, fb->ctran.zt, + fb->offset, fb->scale, cm->name); + + + /* Now call the main routine to output the EPS file. + */ + if (pcp->diskfile) { + + /* Print to a file. If we are not clobbering an existing file + * and we can open the output file write to it directly and be + * done with it. If there is any problem we we to a temporary + * file and issue an alert with actions to be taken if the user + * decides to proceed or cancel the operation. + */ + if (strchr (pcp->printFile, (int)'%')) + sprintf (fname, pcp->printFile, pcp->seqno++); + else + strcpy (fname, pcp->printFile); + + if (access (fname, F_OK) < 0) { + if (fp = fopen (fname, "w")) { + struct stat fs; + + printstat (xim, "Generating postscript output..."); + eps_print (psim, fp, pixels, w, h, 8, 0); + fclose (fp); + + stat (fname, &fs); + sprintf (text, "Wrote %d bytes to '%s'", + (int)fs.st_size, fname); + printstat (xim, text); + + } else { + sprintf (text, "Could not open file %s", fname); + xim_alert (xim, text, NULL, NULL); + } + + } else { + /* Named file already exists. Write a temporary file and + * post an alert to ask the user if they want to overwrite + * the existing file. + */ + char ok_action[SZ_LINE]; + char cancel_action[SZ_LINE]; + char tmpfile[SZ_FNAME]; + char *ip, *op, *last; + + + bzero (tmpfile, SZ_FNAME); + bzero (ok_action, SZ_LINE); + bzero (cancel_action, SZ_LINE); + + /* Write to a temporary file in the same directory as fname. + */ + for (ip=fname, op=tmpfile, last=tmpfile; *op = *ip++; op++) { + if (*op == '/') + last = op + 1; + } + *last = '\0'; + strcat (tmpfile, "ximpXXXXXX"); + if (mktemp(tmpfile) == (char *)NULL) + return (-1); + + if (!(fp = fopen (tmpfile, "w"))) { + sprintf (text, "Cannot open temporary file:\n%s", tmpfile); + xim_alert (xim, text, NULL, NULL); + return (-1); + } + printstat (xim, "Generating postscript output..."); + eps_print (psim, fp, pixels, w, h, 8, 0); + fclose (fp); + + for (ip=fname; *ip!='\0' ; ip++) ; + for ( ; *ip != '/' && ip > fname; ip--) ; + sprintf (text, "%s\n%s\n%s", + "File already exists:", (ip == fname ? fname : ++ip), + "Overwrite this file?"); + + sprintf (ok_action, "print rename %s %s", tmpfile, fname); + sprintf (cancel_action, "print cancel %s", tmpfile); + + xim_alert (xim, text, ok_action, cancel_action); + } + + } else { + /* Print to a printer device. */ + strcpy (tmpfile, "/tmp/ximpXXXXXX"); + if (mktemp(tmpfile) == (char *)NULL) + return (-1); + + if (!(fp = fopen (tmpfile, "w"))) + return (-1); + printstat (xim, "Generating postscript output..."); + eps_print (psim, fp, pixels, w, h, 8, 0); + fclose (fp); + + printstat (xim, "Printing file..."); + sprintf (text, "cat %s | %s", tmpfile, pcp->printCmd); + system (text); /* dispose to printer */ + unlink (tmpfile); /* delete tmp file */ + + printstat (xim, "Done."); + } + + /* Clean up and return. */ + free ((char *) pixels); + return (0); +} + +pbob () { int i = 0; } + + +/* The following implement the ok and cancel actions posted by the alert in +** xim_print above. +*/ + +void +ximp_rename (xim, old, new) +register XimDataPtr xim; +char *old, *new; +{ + char text[SZ_LINE]; + struct stat fs; + + bzero (text, SZ_LINE); + unlink (new); + + if (rename(old,new) != 0 || stat(new,&fs) != 0) { + sprintf (text, "Could not write file %s", new); + printstat (xim, text); + } else { + sprintf (text, "Wrote %d bytes to %s", fs.st_size, new); + printstat (xim, text); + } +} + +void +ximp_cancel (xim, fname) +register XimDataPtr xim; +char *fname; +{ + printstat (xim, "Print cancelled."); + unlink (fname); +} + + +/* XIM_INITPRINTEROPS -- Initialize the printer operations. +*/ +void +xim_initPrinterOps (xim) +register XimDataPtr xim; +{ + register PrintCfgPtr pcp; + char buf[SZ_LINE]; + PSImagePtr eps_init(); + + + /* Open a pointer to the EPS structure. */ + xim->psim = eps_init(); + + /* Read the printer configuration file. */ + xim_initPrinterList (xim); + + /* Initialize options. */ + xim_message (xim, "printOptions", "papersize letter"); + xim_message (xim, "printOptions", "orientation portrait"); + xim_message (xim, "printOptions", "colortype gray"); + xim_message (xim, "printOptions", "autoscale True"); + xim_message (xim, "printOptions", "annotate True"); + xim_message (xim, "printOptions", "dotitle True"); + xim_message (xim, "printOptions", "docolorbar True"); + xim_message (xim, "printOptions", "doborders True"); + + /* Allocate the printer configuration struct. */ + xim->pcp = pcp = (PrintCfgPtr) malloc (sizeof (PrintCfg)); + + pcp->seqno = 0; + pcp->printno = 0; + pcp->diskfile = 0; + strcpy (pcp->printFile, "frame%d.eps"); + + bzero (buf, SZ_LINE); + sprintf (buf, "printerName %s", printer_list[0].printerName); + xim_message (xim, "printOptions", buf); + + strcpy (pcp->printCmd, printer_list[0].printCmd); + sprintf (buf, "printCmd %s", pcp->printCmd); + xim_message (xim, "printOptions", buf); +} + + +/* XIM_INITPRINTERLIST -- Read the printer configuration file and initialize +** the structure with the list of printers and commands. Send the printer +** list to the GUI, maintain the command list internally. +*/ + +static void +xim_initPrinterList (xim) +register XimDataPtr xim; +{ + register int i; + register FILE *fp; + char buf[SZ_LINE], plist[MAX_PRINTERS*20]; + char *ip, *pn, *pc, *pl; + + + bzero (buf, SZ_LINE); + bzero (plist, MAX_PRINTERS*20); + + if (access (xim->printConfig, R_OK) == 0) { + if (!(fp = fopen (xim->printConfig, "r"))) + return; + + /* Scan the printer configuration file. + */ + while (fgets (buf, SZ_LINE, fp) != NULL) { + /* Skip comment lines and blank lines. */ + for (ip=buf; *ip == ' ' || *ip == '\t'; ip++) + ; + if (*ip == '\n' || *ip == '#') + continue; + + /* Now scan up to the tab for the list entry, i.e the printer + * name we'll use in the GUI. + */ + pn = printer_list[nprinters].printerName; + while (*ip != '\t') + *pn++ = *ip++; + *pn++ = '\0'; + ip++; + + while (!isalnum(*ip)) + ip++; + + /* Everything up to a comment char or the newline is the + * command to be used to dispose the EPS. + */ + pc = printer_list[nprinters].printCmd; + while (*ip != '#' && *ip != '\n') + *pc++ = *ip++; + *pc++ = '\0'; + + nprinters++; + bzero (buf, SZ_LINE); + } + fclose (fp); + + /* Erase the remaining entries in the default printer list */ + for (i=nprinters; i < MAX_PRINTERS; i++) { + strcpy (printer_list[i].printerName, " "); + printer_list[i].printCmd[0] = '\0'; + } + } else { + while (printer_list[nprinters].printerName[0] != '\0' && + nprinters < MAX_PRINTERS) + nprinters++; + } + + + /* Now build up a list of the printers, either from the config + * file or the fallback, and send it to the GUI. + */ + for (i=0, pl=plist; i < nprinters; i++) { + *pl++ = '"'; + for (ip = printer_list[i].printerName; *pl = *ip++; pl++) + ; + *pl++ = '"'; + *pl++ = '\n'; + } + *pl++ = '\0'; + + xim_message (xim, "printerList", plist); +} + + +/* XIM_GETPRINTERINFO -- For a given printer name search the printer list +** array and update the GUI with the selected printer name and command. +*/ + +int +xim_getPrinterInfo (xim, printer) +register XimDataPtr xim; +char *printer; +{ + register int i; + register PrintCfgPtr pcp = xim->pcp; + + /* Scan down the printer list until we find the requested device. */ + for (i=0; strcmp(printer_list[i].printerName, printer) != 0; i++) + if (i >= MAX_PRINTERS) + return (pcp->printno); + + return (pcp->printno = i); +} + + +/* PRINTSTAT -- Internal routine for print status messages. +*/ + +static void +printstat (xim, message) +register XimDataPtr xim; +char *message; +{ + char text[SZ_LINE]; + + bzero (text, SZ_LINE); + sprintf (text, "status {%s}", message); + xim_message (xim, "printOptions", text); +} diff --git a/vendor/x11iraf/ximtool/quant.c b/vendor/x11iraf/ximtool/quant.c new file mode 100644 index 00000000..34514a50 --- /dev/null +++ b/vendor/x11iraf/ximtool/quant.c @@ -0,0 +1,797 @@ +#include <stdio.h> + +/* QUANT.C -- Quantize the colors in a pixmap down to a specified number. +** This code is largely stolen from PBMPlus by Jef Poskanzer. +** +** ORIGINAL COPYRIGHT NOTICE: +** +** Copyright (C) 1989, 1991 by Jef Poskanzer. +** +** Permission to use, copy, modify, and distribute this software and its +** documentation for any purpose and without fee is hereby granted, provided +** that the above copyright notice appear in all copies and that both that +** copyright notice and this permission notice appear in supporting +** documentation. This software is provided "as is" without express or +** implied warranty. +*/ + +#undef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define min(a,b) ((a) < (b) ? (a) : (b)) +#undef abs +#define abs(a) ((a) >= 0 ? (a) : -(a)) +#undef odd +#define odd(n) ((n) & 1) + +#ifdef HPUX +#define random() rand() +#define srandom(x) srand(x) +#endif + +typedef unsigned char byte; +typedef unsigned char pixval; + +#define PPM_MAXMAXVAL 255 +typedef struct { pixval r, g, b; } pixel; + +#define PPM_GETR(p) ((p).r) +#define PPM_GETG(p) ((p).g) +#define PPM_GETB(p) ((p).b) + +#define PPM_ASSIGN(p,red,grn,blu) \ + { (p).r = (red); (p).g = (grn); (p).b = (blu); } + +#define PPM_EQUAL(p,q) ( (p).r == (q).r && (p).g == (q).g && (p).b == (q).b ) + +/* Color scaling macro -- to make writing ppmtowhatever easier. */ +#define PPM_DEPTH(newp,p,oldmaxval,newmaxval) \ + PPM_ASSIGN( (newp), \ + (int) PPM_GETR(p) * (newmaxval) / (oldmaxval), \ + (int) PPM_GETG(p) * (newmaxval) / (oldmaxval), \ + (int) PPM_GETB(p) * (newmaxval) / (oldmaxval) ) + +/* Luminance macro, using only integer ops. Returns an int (*256) JHB */ +#define PPM_LUMIN(p) \ + ( 77 * PPM_GETR(p) + 150 * PPM_GETG(p) + 29 * PPM_GETB(p) ) + + +/* Color histogram stuff. */ +typedef struct colorhist_item *colorhist_vector; +struct colorhist_item { + pixel color; + int value; +}; + +typedef struct colorhist_list_item *colorhist_list; +struct colorhist_list_item { + struct colorhist_item ch; + colorhist_list next; +}; + + +/* Color hash table stuff. */ + +typedef colorhist_list *colorhash_table; + +#define MAXCOLORS 32767 +#define FS_SCALE 1024 +#define HASH_SIZE 20023 + +#define LARGE_LUM +#define REP_AVERAGE_PIXELS + +#define hashPixel(p) ((((int) PPM_GETR(p) * 33023 + \ + (int) PPM_GETG(p) * 30013 + \ + (int) PPM_GETB(p) * 27011) & 0x7fffffff) \ + % HASH_SIZE) + + +typedef struct box *box_vector; +struct box { + int ind; + int colors; + int sum; +}; + +static colorhist_vector medianCut (), colorHashToColorHist (); +static colorhist_vector computeColorHist (); +static colorhash_table computeColorHash (), colorHistToColorHash (); +static colorhash_table allocColorHash (); +static int redCompare(), greenCompare(), blueCompare(); +static int lookupColor (), addToColorHash (), sumCompare(); +static void freeColorHash (), addToColorHist(),freeColorHist(); + + + +/* PPMQUANT -- Quantize an image with a given colormap to a new number of + * colors, modifies the image in place. Floyd-Steinberg dithering isn't + * current enabled because of speed but can be turned on later. Modified + * from the original code in the PBMplus package by Jef Poskanzer. + */ + +int +ppmquant (image, r, g, b, nx, ny, ncolors, newcolors) +byte *image; /* image pixels (i.e. cmap indices) */ +byte *r, *g, *b; /* colormap */ +int nx, ny; /* image dimensions */ +int ncolors; /* current number of colors */ +int newcolors; /* requested number of colors */ +{ + register pixel *pP; + register long sr, sg, sb, err; + register int i, col, limitcol, index = 0; + byte *pix = image; + pixel **pixels; + pixval maxval = 255, newmaxval; + int rows, cols, row; + int colors; + int floyd = 0, usehash; + colorhist_vector chv, colormap; + colorhash_table cht; + long *thisrerr, *thisgerr, *thisberr; + long *nextrerr, *nextgerr, *nextberr, *temperr; + int fs_direction; + + /* Reformat into 2-dimensional array of pixel structures */ + rows = ny; + cols = nx; + pixels = (pixel **) malloc (rows * sizeof(pixel *)); + if (!pixels) + return; + + for (row=0; row<rows; row++) { + pixels[row] = (pixel *) malloc(cols * sizeof(pixel)); + if (!pixels[row]) + return; + + for (col=0, pP=pixels[row]; col<cols; col++, pP++) { + pP->r = (pixval) r[*pix]; + pP->g = (pixval) g[*pix]; + pP->b = (pixval) b[*pix]; + pix++; + } + } + + + /* Step 2: attempt to make a histogram of the colors, unclustered. + ** If at first we don't succeed, lower maxval to increase color + ** coherence and try again. This will eventually terminate, with + ** maxval at worst 15, since 32^3 is approximately MAXCOLORS. + */ + for (; ;) { + chv = computeColorHist(pixels, cols, rows, MAXCOLORS, &colors) ; + if (chv != (colorhist_vector) 0) + break; + newmaxval = maxval / 2; + for (row = 0; row < rows; ++row) + for (col = 0, pP = pixels[row]; col < cols; ++col, ++pP) + PPM_DEPTH (*pP, *pP, maxval, newmaxval) ; + maxval = newmaxval; + } + + /* Step 3: apply median-cut to histogram, making the new colormap. + */ + colormap = medianCut (chv, colors, rows * cols, maxval, newcolors) ; + freeColorHist (chv) ; + + /* Step 4: map the colors in the image to their closest match in the + ** new colormap, and write 'em out. + */ + cht = allocColorHash (); + usehash = 1; + pix = image; + if (floyd) { + /* Initialize Floyd-Steinberg error vectors. */ + thisrerr = (long *) calloc (cols + 2, sizeof(long) ); + nextrerr = (long *) calloc (cols + 2, sizeof(long) ); + thisgerr = (long *) calloc (cols + 2, sizeof(long) ); + nextgerr = (long *) calloc (cols + 2, sizeof(long) ); + thisberr = (long *) calloc (cols + 2, sizeof(long) ); + nextberr = (long *) calloc (cols + 2, sizeof(long) ); + srandom ((int) (time (0) ^ getpid ()) ) ; + for (col = 0; col < cols + 2; ++col) { + thisrerr[col] = random () % (FS_SCALE * 2) - FS_SCALE; + thisgerr[col] = random () % (FS_SCALE * 2) - FS_SCALE; + thisberr[col] = random () % (FS_SCALE * 2) - FS_SCALE; + /* (random errors in [-1 .. 1]) */ + } + fs_direction = 1; + } + for (row = 0; row < rows; ++row) { + if (floyd) + for (col = 0; col < cols + 2; ++col) + nextrerr[col] = nextgerr[col] = nextberr[col] = 0; + if ( (!floyd) || fs_direction) { + col = 0; + limitcol = cols; + pP = pixels[row]; + } else { + col = cols - 1; + limitcol = -1; + pP = &(pixels[row][col]); + } + do { + if (floyd) { + /* Use Floyd-Steinberg errors to adjust actual color. */ + sr = PPM_GETR(*pP) + thisrerr[col + 1] / FS_SCALE; + sg = PPM_GETG(*pP) + thisgerr[col + 1] / FS_SCALE; + sb = PPM_GETB(*pP) + thisberr[col + 1] / FS_SCALE; + if (sr < 0) + sr = 0; + else if (sr > maxval) + sr = maxval; + if (sg < 0) + sg = 0; + else if (sg > maxval) + sg = maxval; + if (sb < 0) + sb = 0; + else if (sb > maxval) + sb = maxval; + PPM_ASSIGN (*pP, sr, sg, sb) ; + } + + /* Check hash table to see if we have already matched this + * color. + */ + index = lookupColor (cht, pP) ; + if (index == -1) { /* No; search colormap for closest match. */ + register int i, r1, g1, b1, r2, g2, b2; + register long dist, newdist; + r1 = PPM_GETR (*pP) ; + g1 = PPM_GETG (*pP) ; + b1 = PPM_GETB (*pP) ; + dist = 2000000000; + for (i = 0; i < newcolors; ++i) { + r2 = PPM_GETR (colormap[i].color) ; + g2 = PPM_GETG (colormap[i].color) ; + b2 = PPM_GETB (colormap[i].color) ; + newdist = (r1 - r2) * (r1 - r2) + + (g1 - g2) * (g1 - g2) + + (b1 - b2) * (b1 - b2) ; + if (newdist < dist) { + index = i; + dist = newdist; + } + } + if (usehash) { + if (addToColorHash (cht, pP, index) < 0) { + usehash = 0; + } + } + } + + if (floyd) { + /* Propagate Floyd-Steinberg error terms. */ + if (fs_direction) { + err = (sr - (long) PPM_GETR (colormap[index].color)) * FS_SCALE; + thisrerr[col + 2] += (err * 7) / 16; + nextrerr[col ] += (err * 3) / 16; + nextrerr[col + 1] += (err * 5) / 16; + nextrerr[col + 2] += (err ) / 16; + err = (sg - (long) PPM_GETG (colormap[index].color)) * FS_SCALE; + thisgerr[col + 2] += (err * 7) / 16; + nextgerr[col ] += (err * 3) / 16; + nextgerr[col + 1] += (err * 5) / 16; + nextgerr[col + 2] += (err ) / 16; + err = (sb - (long) PPM_GETB (colormap[index].color)) * FS_SCALE; + thisberr[col + 2] += (err * 7) / 16; + nextberr[col ] += (err * 3) / 16; + nextberr[col + 1] += (err * 5) / 16; + nextberr[col + 2] += (err ) / 16; + } else { + + err = (sr - (long) PPM_GETR (colormap[index].color)) * FS_SCALE; + thisrerr[col ] += (err * 7) / 16; + nextrerr[col + 2] += (err * 3) / 16; + nextrerr[col + 1] += (err * 5) / 16; + nextrerr[col ] += (err ) / 16; + err = (sg - (long) PPM_GETG (colormap[index].color)) * FS_SCALE; + thisgerr[col ] += (err * 7) / 16; + nextgerr[col + 2] += (err * 3) / 16; + nextgerr[col + 1] += (err * 5) / 16; + nextgerr[col ] += (err ) / 16; + err = (sb - (long) PPM_GETB (colormap[index].color)) * FS_SCALE; + thisberr[col ] += (err * 7) / 16; + nextberr[col + 2] += (err * 3) / 16; + nextberr[col + 1] += (err * 5) / 16; + nextberr[col ] += (err ) / 16; + } + } + + *pP = colormap[index].color; + *pix++ = index; /* save the new image index */ + + if ( (!floyd) || fs_direction) { + ++col; + ++pP; + } else { + --col; + --pP; + } + } while (col != limitcol) ; + + if (floyd) { + temperr = thisrerr; + thisrerr = nextrerr; + nextrerr = temperr; + temperr = thisgerr; + thisgerr = nextgerr; + nextgerr = temperr; + temperr = thisberr; + thisberr = nextberr; + nextberr = temperr; + fs_direction = !fs_direction; + } + + } + + /* Rescale and load the new colormap. */ + for (i=0; i<newcolors; i++) { + PPM_DEPTH(colormap[i].color, colormap[i].color, maxval, 255); + r[i] = PPM_GETR (colormap[i].color); + g[i] = PPM_GETG (colormap[i].color); + b[i] = PPM_GETB (colormap[i].color); + } + + /* Free the pixels array. */ + for (i=0; i<rows; i++) free (pixels[i]); + free (pixels); + + /* Free cht and colormap. */ + freeColorHist (colormap); + freeColorHash (cht); + + return (0) ; +} + + +/* +** Here is the fun part, the median-cut colormap generator. This is based +** on Paul Heckbert's paper "Color Image Quantization for Frame Buffer +** Display", SIGGRAPH '82 Proceedings, page 297. +*/ + +static colorhist_vector +medianCut (chv, colors, sum, maxval, newcolors) +colorhist_vector chv; +int colors, sum, newcolors; +pixval maxval; +{ + colorhist_vector colormap; + box_vector bv; + register int bi, i; + int boxes; + + bv = (box_vector) malloc (sizeof(struct box) * newcolors) ; + colormap = + (colorhist_vector) malloc (sizeof(struct colorhist_item) * newcolors) ; + if (bv == (box_vector) 0 || colormap == (colorhist_vector) 0) + perror ("out of memory") ; + for (i = 0; i < newcolors; ++i) + PPM_ASSIGN (colormap[i].color, 0, 0, 0) ; + + /* + ** Set up the initial box. + */ + bv[0].ind = 0; + bv[0].colors = colors; + bv[0].sum = sum; + boxes = 1; + + /* + ** Main loop: split boxes until we have enough. + */ + while (boxes < newcolors) { + register int indx, clrs; + int sm; + register int minr, maxr, ming, maxg, minb, maxb, v; + int halfsum, lowersum; + + /* + ** Find the first splittable box. + */ + for (bi = 0; bi < boxes; ++bi) + if (bv[bi].colors >= 2) + break; + if (bi == boxes) + break; /* ran out of colors! */ + indx = bv[bi].ind; + clrs = bv[bi].colors; + sm = bv[bi].sum; + + /* + ** Go through the box finding the minimum and maximum of each + ** component - the boundaries of the box. + */ + minr = maxr = PPM_GETR (chv[indx].color) ; + ming = maxg = PPM_GETG (chv[indx].color) ; + minb = maxb = PPM_GETB (chv[indx].color) ; + for (i = 1; i < clrs; ++i) { + v = PPM_GETR (chv[indx + i].color) ; + if (v < minr) + minr = v; + if (v > maxr) + maxr = v; + v = PPM_GETG (chv[indx + i].color) ; + if (v < ming) + ming = v; + if (v > maxg) + maxg = v; + v = PPM_GETB (chv[indx + i].color) ; + if (v < minb) + minb = v; + if (v > maxb) + maxb = v; + } + + /* + ** Find the largest dimension, and sort by that component. I have + ** included two methods for determining the "largest" dimension; + ** first by simply comparing the range in RGB space, and second + ** by transforming into luminosities before the comparison. You + ** can switch which method is used by switching the commenting on + ** the LARGE_ defines at the beginning of this source file. + */ + { + /* LARGE_LUM version */ + + pixel p; + float rl, gl, bl; + + PPM_ASSIGN(p, maxr - minr, 0, 0); + rl = PPM_LUMIN(p); + PPM_ASSIGN(p, 0, maxg - ming, 0); + gl = PPM_LUMIN(p); + PPM_ASSIGN(p, 0, 0, maxb - minb); + bl = PPM_LUMIN(p); + + if (rl >= gl && rl >= bl) + qsort( + (char *)&(chv[indx]),clrs,sizeof(struct colorhist_item), + redCompare) ; + else if (gl >= bl) + qsort( + (char *)&(chv[indx]),clrs,sizeof(struct colorhist_item), + greenCompare) ; + else + qsort( + (char *)&(chv[indx]),clrs,sizeof(struct colorhist_item), + blueCompare) ; + } + + /* + ** Now find the median based on the counts, so that about half the + ** pixels (not colors, pixels) are in each subdivision. + */ + lowersum = chv[indx].value; + halfsum = sm / 2; + for (i = 1; i < clrs - 1; ++i) { + if (lowersum >= halfsum) + break; + lowersum += chv[indx + i].value; + } + + /* + ** Split the box, and sort to bring the biggest boxes to the top. + */ + bv[bi].colors = i; + bv[bi].sum = lowersum; + bv[boxes].ind = indx + i; + bv[boxes].colors = clrs - i; + bv[boxes].sum = sm - lowersum; + ++boxes; + qsort ((char *) bv, boxes, sizeof(struct box) , sumCompare) ; + } + + /* + ** Ok, we've got enough boxes. Now choose a representative color for + ** each box. There are a number of possible ways to make this choice. + ** One would be to choose the center of the box; this ignores any + ** structure within the boxes. Another method would be to average all + ** the colors in the box - this is the method specified in Heckbert's + ** paper. A third method is to average all the pixels in the box. You + ** can switch which method is used by switching the commenting on the + ** REP_ defines at the beginning of this source file. + */ + for (bi = 0; bi < boxes; ++bi) { + /* REP_AVERAGE_PIXELS version */ + + register int indx = bv[bi].ind; + register int clrs = bv[bi].colors; + register long r = 0, g = 0, b = 0, sum = 0; + + for (i = 0; i < clrs; ++i) { + r += PPM_GETR (chv[indx + i].color) * chv[indx + i].value; + g += PPM_GETG (chv[indx + i].color) * chv[indx + i].value; + b += PPM_GETB (chv[indx + i].color) * chv[indx + i].value; + sum += chv[indx + i].value; + } + r = r / sum; + if (r > maxval) + r = maxval; /* avoid math errors */ + g = g / sum; + if (g > maxval) + g = maxval; + b = b / sum; + if (b > maxval) + b = maxval; + PPM_ASSIGN (colormap[bi].color, r, g, b) ; + } + + /* All done. */ + return colormap; +} + + +static int +redCompare (ch1, ch2) +colorhist_vector ch1, ch2; +{ + return (int) PPM_GETR (ch1->color) - (int) PPM_GETR (ch2->color) ; +} + + +static int +greenCompare (ch1, ch2) +colorhist_vector ch1, ch2; +{ + return (int) PPM_GETG (ch1->color) - (int) PPM_GETG (ch2->color) ; +} + + +static int +blueCompare (ch1, ch2) +colorhist_vector ch1, ch2; +{ + return (int) PPM_GETB (ch1->color) - (int) PPM_GETB (ch2->color) ; +} + + +static int +sumCompare (b1, b2) +box_vector b1, b2; +{ + return b2->sum - b1->sum; +} + + +static colorhist_vector +computeColorHist (pixels, cols, rows, maxcolors, colorsP) +pixel**pixels; +int cols, rows, maxcolors; +int*colorsP; +{ + colorhash_table cht; + colorhist_vector chv; + + cht = computeColorHash (pixels, cols, rows, maxcolors, colorsP) ; + if (cht == (colorhash_table) 0) + return (colorhist_vector) 0; + chv = colorHashToColorHist (cht, maxcolors) ; + freeColorHash (cht) ; + return chv; +} + + +static void +addToColorHist (chv, colorsP, maxcolors, colorP, value, position) +colorhist_vector chv; +pixel*colorP; +int*colorsP; +int maxcolors, value, position; +{ + int i, j; + + /* Search colorhist for the color. */ + for (i = 0; i < *colorsP; ++i) + if (PPM_EQUAL (chv[i].color, *colorP) ) { + /* Found it - move to new slot. */ + if (position > i) { + for (j = i; j < position; ++j) + chv[j] = chv[j + 1]; + } else if (position < i) { + for (j = i; j > position; --j) + chv[j] = chv[j - 1]; + } + chv[position].color = *colorP; + chv[position].value = value; + return; + } + if (*colorsP < maxcolors) { + /* Didn't find it, but there's room to add it; so do so. */ + for (i = *colorsP; i > position; --i) + chv[i] = chv[i - 1]; + chv[position].color = *colorP; + chv[position].value = value; + ++(*colorsP); + } +} + + +static colorhash_table +computeColorHash (pixels, cols, rows, maxcolors, colorsP) +pixel**pixels; +int cols, rows, maxcolors; +int*colorsP; +{ + colorhash_table cht; + register pixel*pP; + colorhist_list chl; + int col, row, hash; + + cht = allocColorHash (); + *colorsP = 0; + + /* Go through the entire image, building a hash table of colors. */ + for (row = 0; row < rows; ++row) + for (col = 0, pP = pixels[row]; col < cols; ++col, ++pP) { + hash = hashPixel (*pP) ; + for (chl=cht[hash]; chl != (colorhist_list) 0; chl=chl->next) + if (PPM_EQUAL (chl->ch.color, *pP) ) + break; + if (chl != (colorhist_list) 0) + ++(chl->ch.value); + else + { + if (++(*colorsP) > maxcolors) { + freeColorHash (cht) ; + return (colorhash_table) 0; + } + chl = (colorhist_list) + malloc (sizeof(struct colorhist_list_item)); + if (chl == 0) + perror ("out of memory computing hash table") ; + chl->ch.color = *pP; + chl->ch.value = 1; + chl->next = cht[hash]; + cht[hash] = chl; + } + } + + return cht; +} + + +static colorhash_table +allocColorHash () +{ + colorhash_table cht; + int i; + + cht = (colorhash_table) malloc (HASH_SIZE * sizeof(colorhist_list)) ; + if (cht == 0) + perror ("out of memory allocating hash table") ; + + for (i = 0; i < HASH_SIZE; ++i) + cht[i] = (colorhist_list) 0; + + return cht; +} + + +static int +addToColorHash (cht, colorP, value) +colorhash_table cht; +pixel*colorP; +int value; +{ + register int hash; + register colorhist_list chl; + + chl = (colorhist_list) malloc (sizeof(struct colorhist_list_item) ) ; + if (chl == 0) + return - 1; + hash = hashPixel (*colorP) ; + chl->ch.color = *colorP; + chl->ch.value = value; + chl->next = cht[hash]; + cht[hash] = chl; + return 0; +} + + +static colorhist_vector +colorHashToColorHist (cht, maxcolors) +colorhash_table cht; +int maxcolors; +{ + colorhist_vector chv; + colorhist_list chl; + int i, j; + + /* Now collate the hash table into a simple colorhist array. */ + chv = (colorhist_vector) malloc (maxcolors * sizeof(struct colorhist_item) ) ; + /* (Leave room for expansion by caller.) */ + if (chv == (colorhist_vector) 0) + perror ("out of memory generating histogram") ; + + /* Loop through the hash table. */ + j = 0; + for (i = 0; i < HASH_SIZE; ++i) + for (chl = cht[i]; chl != (colorhist_list) 0; chl = chl->next) { + /* Add the new entry. */ + chv[j] = chl->ch; + ++j; + } + + /* All done. */ + return chv; +} + + +static colorhash_table +colorHistToColorHash (chv, colors) +colorhist_vector chv; +int colors; +{ + colorhash_table cht; + int i, hash; + pixel color; + colorhist_list chl; + + cht = allocColorHash (); + + for (i = 0; i < colors; ++i) { + color = chv[i].color; + hash = hashPixel (color) ; + for (chl = cht[hash]; chl != (colorhist_list) 0; chl = chl->next) +/* + if (PPM_EQUAL (chl->ch.color, color) ) + pm_error( + "same color found twice - %d %d %d", PPM_GETR(color), + PPM_GETG(color), PPM_GETB(color)) ; +*/ + chl = (colorhist_list) malloc (sizeof(struct colorhist_list_item) ) ; + if (chl == (colorhist_list) 0) + perror ("out of memory") ; + chl->ch.color = color; + chl->ch.value = i; + chl->next = cht[hash]; + cht[hash] = chl; + } + + return cht; +} + + +static int +lookupColor (cht, colorP) +colorhash_table cht; +pixel*colorP; +{ + int hash; + colorhist_list chl; + + hash = hashPixel (*colorP) ; + for (chl = cht[hash]; chl != (colorhist_list) 0; chl = chl->next) + if (PPM_EQUAL (chl->ch.color, *colorP) ) + return chl->ch.value; + + return - 1; +} + + +static void +freeColorHist (chv) +colorhist_vector chv; +{ + free ((char *) chv) ; +} + + +static void +freeColorHash (cht) +colorhash_table cht; +{ + int i; + colorhist_list chl, chlnext; + + for (i = 0; i < HASH_SIZE; ++i) + for (chl = cht[i]; chl != (colorhist_list) 0; chl = chlnext) { + chlnext = chl->next; + free ((char *) chl) ; + } + free ((char *) cht) ; +} diff --git a/vendor/x11iraf/ximtool/rasio.c b/vendor/x11iraf/ximtool/rasio.c new file mode 100644 index 00000000..64400250 --- /dev/null +++ b/vendor/x11iraf/ximtool/rasio.c @@ -0,0 +1,660 @@ +#include <stdio.h> +#include <math.h> +#include <ctype.h> + +/* + * RASIO.C -- Routines to load and save Sun rasterfiles. + * + * ival = isSunRas (fname) + * loadSunRas (fname, pixels, pixtype, w,h, r,g,b, ncolors, colorstyle) + * writeSunRas (fp, pixels, pixtype, w,h, r,g,b, ncolors, colorstyle) + * getSunRasHdr (fname) + * + * isSunRas returns nonzero if the named file is a Sun rasterfile. + * loadSunRas reads a Sun rasterfile and returns the decoded pixel array and + * 8 bit colormap if any. The caller is responsible for freeing the pixels + * buffer. writeSunRas performs the converse operation, writing the given + * pixel array and colormap to the output Sun rasterfile. + */ + +#define DEBUG 0 + +/* MONO returns total intensity of r,g,b components */ +#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ + +/* + * Info on sun rasterfiles taken from rasterfile(5) man page. + * ------------------------------------------------------------ + */ + +#define RAS_MAGIC 0x59a66a95 + +struct rasterfile { + long ras_magic; + long ras_width; + long ras_height; + long ras_depth; + long ras_length; + long ras_type; + long ras_maptype; + long ras_maplength; +}; + +static char errstr[128]; + +#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */ +#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */ +#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */ +#define RT_FORMAT_RGB 3 /* XRGB or RGB instead of XBGR or BGR */ + +#define RMT_RAW 2 +#define RMT_NONE 0 +#define RMT_EQUAL_RGB 1 + +#define RAS_RLE 0x80 + + +#ifdef __STDC__ +static char *sunRasError(char *, char *); +static int rle_read(unsigned char *, int, int, FILE *, int); +static void SunRas1to8(unsigned char *, unsigned char *, int); +static void SunRas8to1(unsigned char *, unsigned char *, int, int); +static int read_sun_long(long *, FILE *); +static int write_sun_long(long, FILE *); +static void fixBGR(unsigned char *, int, int); +#else +static char *sunRasError(); +static int rle_read(); +static void SunRas1to8(); +static void SunRas8to1(); +static int read_sun_long(), write_sun_long(); +static void fixBGR(); +#endif + + +/* + * Public routines. + * ---------------- + */ + + +/* LoadSunRas -- Load the Sun rasterfile. The Sun rasterfile is input in + * the file fname and the decoded pixel array and colormap are output in + * the output variables PIXELS and R/G/B. The caller is responsible for + * freeing PIXELS when it is no longer needed. The RGB arrays should be + * contain space for at least 256 elements. + */ +char * +loadSunRas (fname, pixels, pixtype, o_w,o_h, r,g,b, ncolors, colorstyle) +char *fname; /* input filename */ +unsigned char **pixels; /* output pixels */ +int *pixtype; /* 8-bit or 24-bit */ +int *o_w, *o_h; /* dimensions */ +unsigned char *r, *g, *b; /* colormap */ +int *ncolors; /* number of colors */ +int colorstyle; /* return color (0) or grayscale (1) */ +{ + register FILE *fp; + register int i, j; + int linesize, lsize, csize, isize, w, h, d, nc, ct; + unsigned char *image, *line, p; + struct rasterfile sunhdr; + + /* Read in the Sun Rasterfile picture. */ + fp = fopen (fname, "r"); + if (!fp) + return (sunRasError(fname, "unable to open file")); + + read_sun_long (&sunhdr.ras_magic, fp); + read_sun_long (&sunhdr.ras_width, fp); + read_sun_long (&sunhdr.ras_height, fp); + read_sun_long (&sunhdr.ras_depth, fp); + read_sun_long (&sunhdr.ras_length, fp); + read_sun_long (&sunhdr.ras_type, fp); + read_sun_long (&sunhdr.ras_maptype, fp); + read_sun_long (&sunhdr.ras_maplength, fp); + + if (sunhdr.ras_magic != RAS_MAGIC) { + fclose (fp); + return (sunRasError(fname, "not a Sun rasterfile")); + } + + /* Make sure that the input picture can be dealt with. */ + if (sunhdr.ras_depth != 1 && + sunhdr.ras_depth != 8 && + sunhdr.ras_depth != 24 && + sunhdr.ras_depth != 32) { + + fprintf (stderr, "Sun rasterfile image has depth %d\n", + sunhdr.ras_depth); + fprintf (stderr, "Depths supported are 1, 8, 24, and 32\n"); + fclose (fp); + return (sunRasError(fname, "Unsupported rasterfile depth")); + } + + if (sunhdr.ras_type != RT_OLD && + sunhdr.ras_type != RT_STANDARD && + sunhdr.ras_type != RT_BYTE_ENCODED && + sunhdr.ras_type != RT_FORMAT_RGB) { + + fprintf (stderr, "Sun rasterfile of unsupported type %d\n", + sunhdr.ras_type); + fclose (fp); + return (sunRasError(fname, "Unsupported rasterfile type")); + } + + if (sunhdr.ras_maptype != RMT_RAW && + sunhdr.ras_maptype != RMT_NONE && + sunhdr.ras_maptype != RMT_EQUAL_RGB) { + + fprintf (stderr, "Sun rasterfile colormap of unsupported type %d\n", + sunhdr.ras_maptype); + fclose (fp); + return (sunRasError(fname, "Unsupported rasterfile colormap")); + } + + w = sunhdr.ras_width; + h = sunhdr.ras_height; + d = sunhdr.ras_depth; + isize = sunhdr.ras_length ? sunhdr.ras_length : (w * h * d) / 8; + csize = (sunhdr.ras_maptype == RMT_NONE) ? 0 : sunhdr.ras_maplength; + + /* Compute length of the output image. */ + lsize = w * h; + if (d == 24 || d == 32) + lsize = lsize * 3; + + linesize = w * d; + if (linesize % 16) + linesize += (16 - (linesize % 16)); + linesize /= 8; + + if (DEBUG) { + fprintf (stderr, "LoadSunRas() - loading a %dx%d pic, %d planes\n", + w, h, d); + fprintf (stderr, + "type %d, maptype %d, isize %d, csize %d, lsize %d, linesize %d\n", + sunhdr.ras_type, sunhdr.ras_maptype, + isize, csize, lsize, linesize); + fprintf (stderr, "colorstyle=%d nc=%d\n", colorstyle, + sunhdr.ras_maplength/3); + } + + /* Read in the colormap, if any. */ + if (sunhdr.ras_maptype == RMT_EQUAL_RGB && csize) { + nc = sunhdr.ras_maplength / 3; + ct = 8; + fread (r, 1, nc, fp); + fread (g, 1, nc, fp); + fread (b, 1, nc, fp); + } else if (sunhdr.ras_maptype == RMT_RAW && csize) { + /* We don't know how to handle raw colormap, ignore. */ + fseek (fp, (long) csize, 1); + nc = ct = 0; + } else { + /* No colormap, make one up. */ + if (sunhdr.ras_depth == 1) { + r[0] = g[0] = b[0] = 0; + r[1] = g[1] = b[1] = 255; + nc = 2; + ct = 1; + } else if (sunhdr.ras_depth == 8) { + for (i=0, nc=256; i < nc; i++) + r[i] = g[i] = b[i] = i; + ct = 8; + } + } + + /* Allocate memory for picture and read it in. Note we may slightly + * overallocate here (if image is padded) + */ + image = (unsigned char *) malloc (lsize); + line = (unsigned char *) malloc (linesize); + if (!image || !line) { + fclose (fp); + return (sunRasError (fname, "out of memory")); + } + + for (i=0; i < h; i++) { + if (sunhdr.ras_type == RT_BYTE_ENCODED) { + if (rle_read (line, 1, linesize, fp, (i == 0)) != linesize) + break; + } else { + if (fread (line, 1, linesize, fp) != linesize) { + free ((char *)image); + free ((char *)line); + fclose (fp); + return (sunRasError (fname, "file read error")); + } + } + + switch (d) { + case 1: + SunRas1to8 (image + w * i, line, w); + break; + case 8: + if (colorstyle) { + for (j=0; j < w; j++) { + p = line[j]; + image[w*i + j] = MONO(r[p],g[p],b[p]); + } + } else + bcopy(line, image + w * i, w); + break; + case 24: + bcopy(line, image + w * i * 3, w * 3); + break; + case 32: + { + int k; + unsigned char *ip, *op; + + ip = line; + op = (unsigned char *) (image + w * i * 3); + for (k = 0; k < w; k++) { + *ip++; /* skip 'alpha' */ + *op++ = *ip++; /* red */ + *op++ = *ip++; /* green */ + *op++ = *ip++; /* blue */ + } + } + } + } + free ((char *)line); + + if (d == 24 || d == 32) { + if (sunhdr.ras_type != RT_FORMAT_RGB) + fixBGR(image, w, h); + *pixtype = 24; + } else + *pixtype = 8; + + *pixels = (unsigned char *) image; + *o_w = w; + *o_h = h; + + /* If we requested grayscale reset the colormap. */ + if (colorstyle) + for (i=0, nc=256; i < nc; i++) + r[i] = g[i] = b[i] = i; + *ncolors = nc; + + fclose (fp); + return (NULL); +} + + +/* WriteSunRas -- Write a pixel array and colormap to a file in Sun rasterfile + * format. Writes a sun rasterfile to the already open stream. Writes either + * 24-bit, 8-bit or 1-bit. Currently will not write RLE files. If PIC24 and + * F_GREYSCALE, writes an 8-bit grayscale image. + */ +int +writeSunRas (fp, pixels, pixtype, w,h, r,g,b, ncolors, colorstyle) +FILE *fp; +unsigned char *pixels; +int pixtype, w, h; +unsigned char *r, *g, *b; +int ncolors, colorstyle; +{ + unsigned char *line, *graypic, graymap[256], *sp, *dp; + int linesize, i, color, d, y, flipbw; + struct rasterfile sunhdr; + + /* Biggest problem w/ RLE file: should we compute image size first + * (nicer) or go back and write it in when we are done (kludgy)? + */ + graypic = NULL; + + /* Special case: if PIC24 and writing GREYSCALE, write 8-bit file. + */ + if (pixtype == 24 && colorstyle == 1) { + graypic = (unsigned char *) malloc (w * h); + for (i=0, sp=pixels, dp=graypic; i < w * h; i++, sp += 3, dp++) { + *dp = MONO(sp[0], sp[1], sp[2]); + } + + for (i = 0; i < 256; i++) + graymap[i] = i; + r = g = b = graymap; + ncolors = 256; + pixtype = 8; + pixels = graypic; + } + + if (pixtype == 24) { + d = 24; + linesize = w * 3; + } else if (colorstyle != 0) { + d = 8; + linesize = w; + } else { + d = 1; + linesize = w; + if (linesize % 8) + linesize += (8 - linesize % 8); + linesize /= 8; + } + + if (linesize % 2) + linesize++; + line = (unsigned char *) malloc (linesize); + if (!line) { + if (graypic) + free ((char *) graypic); + return (1); + } + + if (DEBUG) + fprintf (stderr, + "WriteSunRas: d %d, linesize %d ncolors %d\n", + d, linesize, ncolors); + + /* Set flipbw if color#0 is black. */ + if (d == 1) + flipbw = (MONO(r[0], g[0], b[0]) < MONO(r[1], g[1], b[1])); + + /* Set up the header. + */ + sunhdr.ras_magic = RAS_MAGIC; + sunhdr.ras_width = w; + sunhdr.ras_height = h; + sunhdr.ras_depth = d; + sunhdr.ras_length = linesize * h; + sunhdr.ras_type = RT_STANDARD; + sunhdr.ras_maptype = (d == 1 || d == 24) ? RMT_NONE : RMT_EQUAL_RGB; + sunhdr.ras_maplength = (d == 1 || d == 24) ? 0 : 3 * ncolors; + + write_sun_long (sunhdr.ras_magic, fp); + write_sun_long (sunhdr.ras_width, fp); + write_sun_long (sunhdr.ras_height, fp); + write_sun_long (sunhdr.ras_depth, fp); + write_sun_long (sunhdr.ras_length, fp); + write_sun_long (sunhdr.ras_type, fp); + write_sun_long (sunhdr.ras_maptype, fp); + write_sun_long (sunhdr.ras_maplength, fp); + + /* Write the colormap. + */ + if (d == 8) { + if (colorstyle == 1) { + /* grayscale */ + for (color = 0; color < 3; color++) + for (i = 0; i < ncolors; i++) + putc (MONO(r[i], g[i], b[i]), fp); + } else { + fwrite ((char *)r, sizeof(char), ncolors, fp); + fwrite ((char *)g, sizeof(char), ncolors, fp); + fwrite ((char *)b, sizeof(char), ncolors, fp); + } + } + + /* Write the image. + */ + line[linesize-1] = 0; + for (y = 0; y < h; y++) { + if (d == 24) { + unsigned char *lptr, *pix; + + pix = pixels + y * w * 3; + for (i=0, lptr=line; i < w; i++, pix += 3) { + *lptr++ = pix[2]; /* write data out in BGR order */ + *lptr++ = pix[1]; + *lptr++ = pix[0]; + } + } else if (d == 8) { + bcopy (pixels + y * w, line, w); + } else { + /* d == 1 */ + SunRas8to1 (line, pixels + y * w, w, flipbw); + } + + if (fwrite ((char *)line, sizeof(char), linesize, fp) != linesize) { + if (graypic) + free ((char *)graypic); + free ((char *)line); + return (2); + } + } + + free ((char *)line); + if (graypic) + free ((char *)graypic); + return (0); +} + + +/* IsSunRas -- Test a file to see if it is a Sun rasterfile. + */ +isSunRas (fname) +char *fname; /* input filename */ +{ + register FILE *fp; + struct rasterfile sunhdr; + int value = 0; + + if (fp = fopen (fname, "r")) { + read_sun_long (&sunhdr.ras_magic, fp); + value = (sunhdr.ras_magic == RAS_MAGIC); + fclose (fp); + } + + return (value); +} + + +/* getSunRasHdr -- Get some set of header information for the GUI. + */ + +char * +getSunRasHdr (fname) +char *fname; +{ + FILE *fp; + char *line; + struct rasterfile hdr; + + /* Open the image. */ + fp = fopen (fname, "r"); + if (!fp) + return NULL; + + /* Read the image header. */ + read_sun_long (&hdr.ras_magic, fp); + read_sun_long (&hdr.ras_width, fp); + read_sun_long (&hdr.ras_height, fp); + read_sun_long (&hdr.ras_depth, fp); + read_sun_long (&hdr.ras_length, fp); + read_sun_long (&hdr.ras_type, fp); + read_sun_long (&hdr.ras_maptype, fp); + read_sun_long (&hdr.ras_maplength, fp); + + /* Format the description. */ + line = (char *) malloc (80); + sprintf (line, "%-16.16s %3d %5dx%-5d %s %s", + fname, hdr.ras_depth, hdr.ras_width, hdr.ras_height, + "Sun Rasterfile", + ((((hdr.ras_type == RT_OLD) ? "(OLD)" : + (hdr.ras_type == RT_STANDARD) ? "(Standard)" : + (hdr.ras_type == RT_BYTE_ENCODED) ? "(Byte-Encoded)" : + (hdr.ras_type == RT_FORMAT_RGB) ? "(RGB)" : " "))) ); + + fclose (fp); + return (line); +} + + +/* + * Internal routines. + * ------------------- + */ + +static int +rle_read (ptr, size, nitems, fp, init) +register unsigned char *ptr; +int size, nitems, init; +FILE *fp; +{ + static int count, ch; + int readbytes, c, read; + + if (init) + count = ch = 0; + + readbytes = size * nitems; + for (read = 0; read < readbytes; read++) { + if (count) { + *ptr++ = (unsigned char) ch; + count--; + } else { + c = getc (fp); + if (c == EOF) + break; + + if (c == RAS_RLE) { /* 0x80 */ + count = getc(fp); + if (count == EOF) + break; + + if (count < 0) + count &= 0xff; + if (count == 0) + *ptr++ = (unsigned char) c; + else { + if ((ch = getc(fp)) == EOF) + break; + *ptr++ = (unsigned char) ch; + } + } else + *ptr++ = (unsigned char) c; + } + } + + return (read / size); +} + + +static char * +sunRasError (fname, st) +char *fname, *st; +{ + sprintf (errstr, "%s: %s\n", fname, st); + return (errstr); +} + + +static void +SunRas1to8 (dest, src, len) +unsigned char *dest, *src; +int len; +{ + register int i, b; + int c = 0; + + for (i = 0, b = -1; i < len; i++) { + if (b < 0) { + b = 7; + c = ~(*src++); + } + *dest++ = (unsigned char)((c >> (b--)) & 1); + } +} + + +static void +SunRas8to1 (dest, src, len, flip) +unsigned char *dest, *src; +int len, flip; +{ + int i, b; + int c; + + for (c = b = i = 0; i < len; i++) { + c <<= 1; + c |= (*src++ ? 1 : 0); + if (b++ == 7) { + if (flip) + c = ~c; + *dest++ = (unsigned char) (c & 0xff); + b = c = 0; + } + } + if (b) { + if (flip) + c = ~c; + *dest = (unsigned char) ((c << (8 - b)) & 0xff); + } +} + + +/* Reads a 4-byte int in Sun byteorder. + * Returns 0 for success, EOF for failure. + */ +static int +read_sun_long (l, fp) +long *l; +FILE *fp; +{ + int c0, c1, c2, c3; + + c0 = fgetc(fp); + c1 = fgetc(fp); + c2 = fgetc(fp); + c3 = fgetc(fp); + + *l = (((unsigned long) c0 & 0xff) << 24) | + (((unsigned long) c1 & 0xff) << 16) | + (((unsigned long) c2 & 0xff) << 8) | + (((unsigned long) c3 & 0xff)); + + if (ferror(fp)) + return EOF; + + return (0); +} + + +/* Write a long word in sun byte-order. + * Returns 0 for success, EOF for failure. + */ +static int +write_sun_long (l, fp) +long l; +FILE *fp; +{ + char c; + + c = ((l >> 24) & 0xff); + if (putc (c, fp) == EOF) + return (EOF); + c = ((l >> 16) & 0xff); + if (putc (c, fp) == EOF) + return (EOF); + c = ((l >> 8) & 0xff); + if (putc (c, fp) == EOF) + return (EOF); + c = (l & 0xff); + if (putc (c, fp) == EOF) + return (EOF); + return (0); +} + + +/* kr3 - fix up BGR order SUN 24-bit rasters to be RGB order + */ +static void +fixBGR (img, w, h) +unsigned char *img; +int w, h; +{ + int i, npixels; + unsigned char tmp; + + npixels = w * h; + for (i = 0; i < npixels; i++) { + tmp = img[0]; /* swap red and blue channels */ + img[0] = img[2]; + img[2] = tmp; + img += 3; /* bump to next pixel */ + } +} diff --git a/vendor/x11iraf/ximtool/raster.c b/vendor/x11iraf/ximtool/raster.c new file mode 100644 index 00000000..51652241 --- /dev/null +++ b/vendor/x11iraf/ximtool/raster.c @@ -0,0 +1,2995 @@ +#include <stdio.h> +#include <sys/types.h> +#include <dirent.h> + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <Obm.h> +#include <ObmW/Gterm.h> +#include "ximtool.h" +#include "iis.h" + +/* Slackware/RedHat4.2 compatibility hack. */ +#if defined(linux) && defined(isalnum) +#undef isalnum +#define isalnum(c) (isalpha(c)||isdigit(c)) +#endif + + +#define DBG_RASTER 0 + + +/* + * RASTER.C -- Raster pixel (frame buffer) routines. These are the routines + * which create and manipulate the frame buffers and the graphics pipeline + * to the screen. + * + * xim_initialize (xim, config, nframes, hardreset) + * xim_reset (xim, w) + * xim_resize (xim, w) + * xim_refresh (xim) + * + * xim_setFrame (xim, frame) + * xim_setReferenceFrame (chan, frame) + * xim_setDisplayFrame (xim, frame) + * xim_initFrame (xim, frame, nframes, config, memModel) + * xim_delFrame (xim, frame) + * xim_matchFrames (xim, frames, reference_frame) + * xim_registerFrames (xim, frames, reference_frame) + * xim_fitFrame (xim) + * xim_tileFrames (xim, frame_list) + * + * xim_cursorMode (xim, state) + * + * xim_setMapping (xim, fb, frame, mapping, src, dst, fill_mode) + * xim_setZoom (xim, fb, frame, mapping, src, dst, + * xcen,ycen, xmag,ymag, xoff,yoff, absolute) + * xim_setFlip (xim, fb, flip_x, flip_y) + * xim_setColormap (name, dirs, red, green, blue, ncolors) + * xim_setRop (xim, fb, rop) + * rop = xim_getAntialias (xim, s) + * + * xim_getScreen (xim, frame, sx, sy, width, height, depth) + * bool = xim_onScreen (xim, frame) + * + * xim_setCursorPos (xim, sx, sy) + * xim_getCursorPos (xim, sx, sy, raster, frame) + * + * pixels = xim_readDisplay (xim, x0,y0,nx,ny, w,h, r,g,b, ncolors) + * stat = xim_writeDisplay (xim, frame, mapname, pixels, w,h, r,g,b, ncolors) + * + * xim_message (xim, object, message) + * xim_msgi (xim, object, intval) + * xim_alert (xim, text, ok_action, cancel_action) + */ + +/* Define some builtin colormaps. */ +static Lut aips0 = { +#include "data/aips0.lut" +}; +static Lut blue = { +#include "data/blue.lut" +}; +static Lut color = { +#include "data/color.lut" +}; +static Lut green = { +#include "data/green.lut" +}; +static Lut halley = { +#include "data/halley.lut" +}; +static Lut heat = { +#include "data/heat.lut" +}; +static Lut rainbow = { +#include "data/rainbow.lut" +}; +static Lut red = { +#include "data/red.lut" +}; +static Lut staircase = { +#include "data/staircase.lut" +}; +static Lut standard = { +#include "data/standard.lut" +}; + +static void get_fbconfig(); +static void set_colorbar(); +static int get_dirfile(); +static void load_testpattern(); +static void set_nframes(); +static void xim_frameRegion(); +static void xim_colortables(); +extern char *getenv(); +double strtod(); + +#define TOL 0.0001 + + +/* XIM_INITIALIZE -- Initialize the imaging subsystem. Read the config file + * and create the frame buffers, mappings, and colormaps. + */ +void +xim_initialize (xim, config, nframes, hardreset) +register XimDataPtr xim; +int config; +int nframes; +int hardreset; +{ + register Widget gt = xim->gt; + register FrameBufPtr fb; + register int i; + + unsigned short m_red[MAX_COLORS]; + unsigned short m_green[MAX_COLORS]; + unsigned short m_blue[MAX_COLORS]; + char *fname, *ip, *op, sbuf[8192]; + String maps[MAX_COLORMAPS], dirs[4]; + int max_cmaps, first, ngray, rgb_len, nfiles, n; + static int nbuiltin_cmaps = 0; + int display_frame = 1; + char cmapname[SZ_NAME]; + char buf[SZ_LINE]; + FbConfigPtr cf; + ColorMapPtr cm; + struct dir *dp; + int startup; + DIR *dir; + + /* The gterm widget handle should already have been set by the + * GUI during startup. + */ + if (!gt) { + fprintf (stderr, "xim_initialize: no gterm-image widget!!\n"); + exit (1); + } + + /* Inform the GUI that the frame buffers are being initialized. + * The initialize parameter is set to "startup" during program + * startup, "restart" at the start of an initialization during + * execution, and "done" when initialization is completed. + */ + startup = (xim->nframes == 0); + xim_message (xim, "initialize", startup ? "startup" : "restart"); + + if (hardreset || startup || config != xim->fb_configno) { + xim_msgi (xim, "frame", 0); + xim_message (xim, "frameTitle", ""); + set_nframes (xim, 0); + cm = &colormaps[DEF_COLORMAP-1]; + strcpy (cmapname, cm->name); + hardreset = 1; + + /* Get frame buffer configurations. */ + get_fbconfig (xim); + + /* Remove any existing border highlight marker. */ + if (xim->gm_border) { + GmDestroy (xim->gm_border); + xim->gm_border = NULL; + } + + /* Initialize the frame buffers. */ + if (DBG_RASTER) + fprintf (stderr, "xim_initialize: Raster init.....\n"); + GtRasterInit (gt); + if (DBG_RASTER) + fprintf (stderr, "xim_initialize: Raster init.....DONE\n"); + for (i=1; i <= MAX_FRAMES; i++) + xim->frames[i].frameno = 0; + + cf = &xim->fb_config[config-1]; + nframes = (nframes <= 0) ? cf->nframes : nframes; + + if (startup) { + /* Set initial tile frames list to be all frames if starting + * up in tile frames mode. + */ + if (xim->tileFrames && nframes > 1) { + xim->tileFramesList = 0; + xim->nTileFrames = 0; + for (i=0; i < nframes; i++) { + xim->tileFramesList |= (1 << i); + xim->nTileFrames++; + } + } + } else { + xim->display_frame = 0; + xim->df_p = NULL; + for (i=0; i < XtNumber(xim->chan); i++) { + IoChanPtr chan = &xim->chan[i]; + if (chan->type) + xim_setReferenceFrame (chan, 1); + } + if (xim->cursor_chan) + xim->cursor_chan = &xim->chan[0]; + } + + xim->rop = xim->antialias ? + xim_getAntialias (xim, xim->antialiasType) : 0x00; + xim->fb_configno = config = max(1, min(MAX_FBCONFIG, config)); + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: ........................SETNFRAME\n"); + set_nframes (xim, nframes); + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: ........................SETNFRAME DONE\n"); + + /* Initialize the tile framing options. */ + xim->tileByRows = 1; + xim->tileTopDown = 1; + xim->tileLabels = 0; + + /* Set the new frame size. */ + sprintf (buf, "%d %d %d", cf->width, cf->height, 8); + xim_message (xim, "frameSize", buf); + + /* Create the frames. */ + for (i=1; i <= nframes; i++) { + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: ...............INITFRAME %d\n",i); + xim_initFrame (xim, i, nframes, cf, xim->memModel); + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: ...............INITFRAME %d DONE\n",i); + } + + /* Reinitialize the tile framing. */ + if (xim->tileFrames) { + xim->tileFramesList = 0; + xim->nTileFrames = 0; + for (i=0; i < nframes; i++) { + xim->tileFramesList |= (1 << i); + xim->nTileFrames++; + } + } + + xim->width = cf->width; + xim->height = cf->height; + GtSetLogRes (gt, cf->width, cf->height); + + } else { + /* Soft reset. */ + display_frame = xim->display_frame; + fb = &xim->frames[display_frame-1]; + cm = &colormaps[fb->colormap-1]; + strcpy (cmapname, cm->name); + + for (i=0; i < ncolormaps; i++) { + cm = &colormaps[i]; + GtFreeColormap (gt, cm->mapno); + } + } + + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: ........................CMAP SETUP\n"); + /* Set up the colormap to emulate the IIS/imtool colormap. Set + * xim->ncolors to the length of the grayscale region of the colormap + * returned by iiscolormap so that our other colormaps will have the + * same size. + */ + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: xim->ncolors = %d\n", xim->ncolors); + xim_iiscolormap (gt, m_red,m_green,m_blue, &first, &ngray, &rgb_len); + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: writeColormap: first=%d ngray=%d len=%d\n", + first, ngray, rgb_len); + GtWriteColormap (gt, 0, first, rgb_len, m_red, m_green, m_blue); + if ((xim->ncolors = ngray) < 0) { + fprintf (stderr, "ERROR: No colormap cells available.\n"); + exit (1); + } + + + /* Initialize the color tables. + */ + max_cmaps = nbuiltin_cmaps ? nbuiltin_cmaps : MAX_COLORMAPS; + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: init colortables: xim->ncolors = %d\n", + xim->ncolors); + for (ncolormaps=0; ncolormaps < max_cmaps; ncolormaps++) { + cm = &colormaps[ncolormaps]; + if (!cm->name[0]) + break; + cm->mapno = GtNextColormap (gt); + xim_setColormap (cm->name, NULL, m_red, m_green, m_blue, + xim->ncolors); + GtWriteColormap (gt, cm->mapno, first, xim->ncolors, + m_red, m_green, m_blue); + } + if (DBG_RASTER) + fprintf (stderr, "xim_initialize: init colortables: DONE\n"); + + /* The first time this is called count the number of builtin cmaps. */ + if (nbuiltin_cmaps == 0) + nbuiltin_cmaps = ncolormaps; + + /* Get the names of the two user defined colormaps, if any. */ + nfiles = 0; + maps[nfiles++] = xim->userCMap1; + maps[nfiles++] = xim->userCMap2; + + /* If any user colormap directories are specified get the names + * of the colormap files in these directories. + */ + dirs[0] = "./"; + dirs[1] = xim->userCMapDir1; + dirs[2] = xim->userCMapDir2; + dirs[3] = NULL; + + for (i=1, op=sbuf; dirs[i]; i++) { + if (strcmp (dirs[i], "none") != 0) { + if (dir = opendir (dirs[i])) { + while ((n = get_dirfile (dir, op, SZ_FNAME)) > 0) { + maps[nfiles++] = op; + op += n + 1; + if (nfiles >= MAX_COLORMAPS) + break; + } + closedir (dir); + } + } + } + + /* Add all the user specified colormaps to the colormap table. + */ + for (i=0; i < nfiles && ncolormaps < MAX_COLORMAPS; i++) { + fname = maps[i]; + if (strcmp (fname, "none") != 0) { + if (xim_setColormap (fname, dirs, + m_red, m_green, m_blue, xim->ncolors) == OK) { + + cm = &colormaps[ncolormaps++]; + cm->mapno = GtNextColormap (gt); + + /* Use root portion of filename as the colormap name. */ + for (ip=fname; *ip; ip++) + if (*ip == '/') + fname = ip + 1; + for (ip=fname, op=cm->name; *ip && *ip != '.'; ip++) { + *op++ = *ip; + if (op - cm->name >= SZ_CMAPNAME) + break; + } + *op = '\0'; + + GtWriteColormap (gt, cm->mapno, first, xim->ncolors, + m_red, m_green, m_blue); + } + } + } + + /* Pass the list of colortables on to the user interface. */ + xim_colortables (xim); + + /* Set initial display frame. */ + xim_setDisplayFrame (xim, display_frame); + + /* Force the initial default colormap to be loaded. */ + fb = &xim->frames[display_frame-1]; + for (i=0; i < ncolormaps; i++) { + cm = &colormaps[i]; + if (strcmp (cm->name, cmapname) == 0) + break; + } + if (i >= ncolormaps) + cm = &colormaps[DEF_COLORMAP-1]; + + GtLoadColormap (gt, cm->mapno, fb->offset, fb->scale); + xim_enhancement (xim, fb); + + /* Set options. */ +/* xim_message (xim, "cmfocus", xim->cm_focus ? "True" : "False");*/ + xim_message (xim, "autoscale", xim->autoscale ? "True" : "False"); + xim_message (xim, "antialias", xim->antialias ? "True" : "False"); + xim_message (xim, "tileFrames", xim->tileFrames ? "True" : "False"); + + xim_message (xim, "initialize", "done"); + + if (DBG_RASTER) + fprintf (stderr, + "xim_initialize: ................................RETURNING\n"); +} + + +/* XIM_RESET -- Called when the active gterm widget is set or changed. + */ +void +xim_reset (xim, w) +XimDataPtr xim; +Widget w; +{ + unsigned short iomap[MAX_COLORS]; + int iomap_len; + + if (!w) + return; + + /* The following assumes that the GUI does a setGterm first for the + * colorbar and second for the main image window. The first thing we + * do is set the iomap so that all ximtool color and pixel i/o will + * see the emulated IIS color model. + */ + if (xim->cb == NULL) { + xim->cb = w; + xim_iisiomap (w, iomap, &iomap_len); + GtPostResizeProc (w, set_colorbar, xim); + GtWriteIomap (w, iomap, 0, iomap_len); + } else { + xim->gt = w; + xim_iisiomap (w, iomap, &iomap_len); + GtPostResizeProc (w, xim_resize, xim); + GtWriteIomap (w, iomap, 0, iomap_len); + } +} + + +/* XIM_RESIZE -- Called when the active gterm widget is resized. We need to + * resize the zoom raster and modify the zoom mapping for each frame to + * reflect the new window size. + */ +void +xim_resize (xim, w) +XimDataPtr xim; +Widget w; +{ + register FrameBufPtr fb; + int junk, sx, sy, width, height, depth; + int i, active, frame, mapping, zoomtype; + float xscale, yscale, scale; + char buf[SZ_LINE]; + + + /* This case is true during startup. */ + if (xim->nframes <= 0) + return; + + /* Get new screen size. In tile frame mode select the first frame + * in the list for the size, which may not always be frame 1. + */ + if (xim->tileFrames && !(xim->tileFramesList & 1)) { + if (xim->nframes == 0) + return; + for (i=1; i <= xim->nframes; i++) + if (xim->tileFramesList & (1 << (i-1))) { + xim_getScreen (xim, i, &sx, &sy, &width, &height, &depth); + break; + } + } else + xim_getScreen (xim, 1, &sx, &sy, &width, &height, &depth); + + /* Compute the new scale factor required to scale the source to the + * destination at magnification 1.0. + */ + if (xim->autoscale) { + xscale = (float)width / (float)xim->width; + yscale = (float)height / (float)xim->height; + scale = min (xscale, yscale); + } else { + xscale = 1.0; + yscale = 1.0; + scale = 1.0; + } + + /* Adjust the mapping for each frame. */ + for (frame=1; frame <= xim->nframes; frame++) { + fb = &xim->frames[frame-1]; + mapping = fb->zoommap; + + /* For rapid frame blink, split screen, etc. the zoom raster + * must be the same size as the screen so we must resize this + * raster when the display window is resized. The CreateRaster + * call will delete the old raster and all its mappings and + * create a new one. We must then restore the mappings, and + * if this is an active display frame, refresh the mapping. + */ + active = xim_onScreen (xim, frame); + + if (fb->zoomras) { + GtQueryRaster (w, fb->zoomras, &zoomtype, &junk, &junk, &junk); + GtCreateRaster (w, fb->zoomras, zoomtype, width, height, depth); + xim_setMapping (xim, NULL, frame, fb->dispmap, + fb->zoomras, 0, M_FILL); + if (!active) { + GtDisableMapping (w, fb->dispmap, 0); + xim_setMapping (xim, NULL, frame, fb->zoommap, + fb->raster, fb->zoomras, M_FILL); + GtDisableMapping (w, fb->zoommap, 0); + } + } else { + if (active) { + GtEnableMapping (w, fb->dispmap, 0); + GtSetDisplayRaster (w, xim->display_frame); + } else + GtDisableMapping (w, fb->dispmap, 0); + } + + /* Set the new mapping. */ + fb->xscale = fb->yscale = scale; + xim_setZoom (xim, fb, frame, mapping, fb->raster, fb->zoomras, + fb->xcen, fb->ycen, fb->xmag, fb->ymag, + fb->xoff, fb->yoff, False); + } + + /* Refresh the screen for any active mappings. Any mappings + * defined on any visible frame should be refreshed, since a + * redraw clears the display window. + */ + for (frame=1; frame <= xim->nframes; frame++) { + if (xim_onScreen (xim, frame)) { + int junk, width, height, depth; + fb = &xim->frames[frame-1]; + GtQueryRaster (w, fb->raster, &junk, &width, &height, &depth); + GtRefreshPixels (w, fb->raster, GtPixel, 0, 0, width, height); + } + } + + /* Highlight the current frame. */ + xim_highlightFrame (xim, xim->display_frame); + + sprintf (buf, "%d %d %d %d", sx, sy, width, height); + xim_message (xim, "resize", buf); +} + + +/* XIM_REFRESH -- Refresh the current display frame. + */ +void +xim_refresh (xim) +XimDataPtr xim; +{ + register FrameBufPtr fb = xim->df_p; + int junk, width, height, depth; + + GtQueryRaster (xim->gt, fb->raster, &junk, &width, &height, &depth); + GtRefreshPixels (xim->gt, fb->raster, GtPixel, 0, 0, width, height); +} + + +/* XIM_CLOSE -- Free any raster specific resources. + */ +void +xim_close (xim) +register XimDataPtr xim; +{ +} + + +/* XIM_SETFRAME -- Configure a frame to be both the display and reference + * frame. + */ +void +xim_setFrame (xim, frame) +register XimDataPtr xim; +int frame; +{ + xim_setDisplayFrame (xim, frame); +} + + +/* XIM_SETREFERENCEFRAME -- Set the frame used for frame buffer i/o. + */ +void +xim_setReferenceFrame (chan, frame) +register IoChanPtr chan; +int frame; +{ + register XimDataPtr xim = (XimDataPtr) chan->xim; + register FrameBufPtr fb; + int frameno; + + /* Ignore request if channel not active. */ + if (!chan->type) + return; + + frameno = max(1, min(MAX_FRAMES, frame)); + fb = &xim->frames[frameno-1]; + + /* Ignore request if not a valid frame. */ + if (fb->frameno > 0) { + chan->reference_frame = frameno; + chan->rf_p = fb; + } +} + + +/* XIM_SETDISPLAYFRAME -- Set the frame which is displayed. + */ +void +xim_setDisplayFrame (xim, frame) +register XimDataPtr xim; +int frame; +{ + register FrameBufPtr fb; + register Widget gt = xim->gt; + FrameBufPtr old_fb = xim->df_p; + int frameno, old_frameno; + char buf[256]; + + old_frameno = old_fb ? old_fb->frameno : 0; + frameno = max(1, min(MAX_FRAMES, frame)); + fb = &xim->frames[frameno-1]; + + /* Ignore request if not a valid frame. */ + if (fb->frameno > 0 && (!old_fb || frameno != old_frameno)) { + /* Special case: if tile frame mode is in effect and we are + * displaying a frame not in the tile list, clear the screen + * before displaying the frame. Likewise, if displaying an + * untiled frame while in tile frame mode and then reverting + * to display of a tiled frame, clear the screen and display + * all the tiled frames. + */ + if (xim->tileFrames && old_fb) { + int tile_old = (xim->tileFramesList & (1 << old_frameno-1)); + int tile_new = (xim->tileFramesList & (1 << frameno-1)); + + if (tile_old && !tile_new) + GtClearScreen (gt); + else if (!tile_old && tile_new) { + GtClearScreen (gt); +/* xim_resize (xim, gt);*/ + } + } + + /* Map the new frame. */ + xim->df_p = fb; + xim->display_frame = frameno; + GtEnableMapping (gt, fb->dispmap, 0); + + /* Unmap the old frame. */ + if (old_fb && !xim_onScreen (xim, old_frameno)) { + FrameBufPtr old_fb = &xim->frames[old_frameno-1]; + GtDisableMapping (gt, old_fb->dispmap, 0); + } + + /* Display the new frame. */ + if (GtActiveMapping (gt, fb->zoommap)) { + GtRefreshMapping (gt, fb->dispmap); + } else { + GtEnableMapping (gt, fb->zoommap, 0); + GtRefreshMapping (gt, fb->zoommap); + } + GtSetDisplayRaster (gt, frameno); + + + /* Highlight the new frame if in tileFrames mode. */ + xim_highlightFrame (xim, frameno); + + /* Load the colormap only if it differs from what we already + * have. This avoids the waste of repeatedly reloading the + * colormap when blinking frames that have matched colormaps. + */ + if (!old_fb || fb->colormap != old_fb->colormap || + abs (fb->offset - old_fb->offset) > 0.001 || + abs (fb->scale - old_fb->scale) > 0.001) { + + GtSetColormapFocus (-1); /* force full update */ + GtLoadColormap (gt, fb->colormap, fb->offset, fb->scale); + GtSetColormapFocus (xim->cm_focus); + } + + xim_msgi (xim, "frame", frameno); + xim_message (xim, "frameTitle", fb->ctran.imtitle); + xim_message (xim, "xflip", fb->xflip ? "true" : "false"); + xim_message (xim, "yflip", fb->yflip ? "true" : "false"); + xim_frameRegion (xim, fb); + + sprintf (buf, "%g %g %g %g %g %g %g %g", + fb->xmag, fb->ymag, fb->xcen, fb->ycen, + fb->xscale, fb->yscale, fb->xoff, fb->yoff); + xim_message (xim, "frameView", buf); + } +} + + +/* XIM_INITFRAME -- Initialize a frame buffer. + */ +void +xim_initFrame (xim, frame, nframes, config, memModel) +register XimDataPtr xim; +int frame, nframes; +FbConfigPtr config; +char *memModel; +{ + register FrameBufPtr fb = &xim->frames[frame-1]; + register Widget gt = xim->gt; + int sx, sy, width, height, depth; + char buf[SZ_LINE]; + + if (frame < 1 || frame > MAX_FRAMES) + return; + + xim_delFrame (xim, frame); + memset ((void *)fb, 0, sizeof(FrameBuf)); + + /* Create the frame buffer. */ + fb->frameno = frame; + fb->raster = GtNextRaster (gt); + + if (DBG_RASTER) { + fprintf (stderr, + "xim_initFrame: Creating CLIENT raster for frame=%d raster=%d (%dx%dx%d)\n", + frame, fb->raster, + config->width, config->height, DEF_FRAME_DEPTH); + fprintf (stderr, + "xim_initFrame: Creating memModel=%s frame=%d raster=%d (%d x %d)\n", + memModel, frame, fb->raster, config->width, config->height); + } + + if (GtCreateRaster (gt, fb->raster, GtClient, + config->width, config->height, DEF_FRAME_DEPTH) < 0) { + + fprintf (stderr, "cannot create %dx%d frame buffer #%d\n", + config->width, config->height, frame); + return; + } + + /* Get region of screen to be written into. */ + xim_getScreen (xim, frame, &sx, &sy, &width, &height, &depth); + + if (DBG_RASTER) + fprintf (stderr, + "xim_initFrame: [%d of %d] screen size -- %d x %d x %d\n", + frame, nframes, width, height, depth); + + /* Set up the graphics pipeline to the screen. The "memory model" + * determines memory is used, trading off memory usage against speed + * for operations like zoom/pan and blink. + */ + + if (strcmp (memModel, "fast") == 0) { + /* Use both client and server memory to achieve the best + * possible performance. The frame buffer raster (type ximage) + * is mapped to a server pixmap with the zoom/pan mapping, and + * the server pixmap is mapped to the screen with the one-to-one + * frame display mapping. + */ +fast: fb->zoomras = GtNextRaster (gt); + if (GtCreateRaster (gt, + fb->zoomras, GtServer, width, height, depth) < 0) + goto nice; + + xim_setMapping (xim, fb, frame, fb->zoommap = GtNextMapping(gt), + fb->raster, fb->zoomras, xim->autoscale ? M_ASPECT : M_UNITARY); + xim_setMapping (xim, fb, frame, fb->dispmap = GtNextMapping(gt), + fb->zoomras, 0, M_FILL); + + } else if (strcmp (memModel, "beNiceToServer") == 0) { + /* Minimize use of X server memory, but keep zoom raster to speed + * up blinks. Everything is the same as with the "fast" memory + * model except that the zoom raster is an ximage rather than + * server pixmap raster. + */ +nice: fb->zoomras = GtNextRaster (gt); + if (DBG_RASTER) + fprintf (stderr, + "xim_initFrame: creating 'nice' model (0x%x)\n", + fb->zoomras); + if (GtCreateRaster (gt, + fb->zoomras, GtClient, width, height, depth) < 0) + goto small; + + xim_setMapping (xim, fb, frame, fb->zoommap = GtNextMapping(gt), + fb->raster, fb->zoomras, xim->autoscale ? M_ASPECT : M_UNITARY); + xim_setMapping (xim, fb, frame, fb->dispmap = GtNextMapping(gt), + fb->zoomras, 0, M_FILL); + + } else if (strcmp (memModel, "small") == 0) { + /* Minimize both client and server memory as far as possible. + * Only the frame buffer raster is used, the zoom/pan mapping + * maps directly to the screen and is also used as the screen + * mapping. + * + * FIXME: On TrueColor visuals we can have an issue here where + * the display pixmap is 24-bits and various things (e.g. pixel + * readback) are expecting 8-bits. + */ +small: fb->zoomras = 0; + if (DBG_RASTER) + fprintf (stderr, + "xim_initFrame: creating 'small' model (0x%x)\n", + fb->zoomras); + + xim_setMapping (xim, fb, frame, fb->zoommap = GtNextMapping(gt), + fb->raster, fb->zoomras, xim->autoscale ? M_ASPECT : M_UNITARY); + fb->dispmap = fb->zoommap; + + } else { + fprintf (stderr, + "unrecognized memModel `%s', default to `fast'\n", memModel); + goto fast; + } + + /* Set up the default colormap. */ + fb->colormap = DEF_COLORMAP; + fb->offset = 0.5; + fb->scale = (xim->invert ? -1.0 : 1.0); + xim_enhancement (xim, fb); + + /* Disable frame display initially if not mapped to screen. */ + if (xim_onScreen (xim, frame)) { + GtEnableMapping (gt, fb->dispmap, 0); + GtSetDisplayRaster (gt, frame); + } else + GtDisableMapping (gt, fb->dispmap, 0); + + set_nframes (xim, max (xim->nframes, frame)); +} + + +/* XIM_DELFRAME -- Delete a frame. + */ +void +xim_delFrame (xim, frame) +register XimDataPtr xim; +int frame; +{ + register FrameBufPtr fb = &xim->frames[frame-1]; + register Widget gt = xim->gt; + + if (frame < 1 || frame > MAX_FRAMES) + return; + if (fb->frameno <= 0) + return; + + GtFreeMapping (gt, fb->dispmap); + if (fb->zoommap != fb->dispmap) + GtFreeMapping (gt, fb->zoommap); + if (fb->zoomras) + GtDestroyRaster (gt, fb->zoomras); + if (fb->raster) + GtDestroyRaster (gt, fb->raster); + + fb->frameno = 0; + if (xim->nframes == frame) + set_nframes (xim, frame - 1); +} + + +/* XIM_ERASEFRAME -- Erase a frame. + */ +void +xim_eraseFrame (xim, frame) +register XimDataPtr xim; +int frame; +{ + FrameBufPtr fb = &xim->frames[frame-1]; + Widget gt = xim->gt; + int Z = 0; + + GtSetPixels (gt, fb->raster, GtPixel, Z,Z,Z,Z, CMS_BACKGROUND, 0); +} + + +/* XIM_FITFRAME -- Attempt to resize the display window to be the same + * size as the frame buffer. + */ +void +xim_fitFrame (xim) +register XimDataPtr xim; +{ + register Widget gt = xim->gt; + + GtCreateRaster (gt, 0, GtServer, xim->width, xim->height, 8); +} + + +/* XIM_TILEFRAMES -- Set or clear tile frame mode. + */ +void +xim_tileFrames (xim, frame_list) +register XimDataPtr xim; +int frame_list; +{ + register int i; + register Widget w = xim->gt; + register FrameBufPtr fb; + char buf[SZ_LINE]; + int mapping; + + + /* Get list of frames to be tiled. */ + xim->tileFramesList = frame_list; + for (i=0, xim->nTileFrames = 0; i < xim->nframes; i++) + if (frame_list & (1 << i)) + xim->nTileFrames++; + + /* Remove any existing border highlight marker. */ + if (xim->gm_border) { + GmDestroy (xim->gm_border); + xim->gm_border = NULL; + } + + xim->tileFrames = (frame_list != 0); + GtClearScreen (w); + initialize_shadow_pixmap (w, 0); + xim_resize (xim, w); + + /* Entering tile frame mode. + */ + if (xim->tileFrames) { + + /* Ensure that the display frame is set to one of the + * tiled frames. + */ + if (!(xim->tileFramesList & (1 << xim->display_frame-1))) { + for (i=1; i <= xim->nframes; i++) + if (xim->tileFramesList & (1 << (i-1))) { + xim->df_p = NULL; + xim->display_frame = 0; + xim_setFrame (xim, i); + break; + } + } + + + /* Change the stacking order of the frame mappings if + * necessary so that any frames not in the tile list are + * displayed above the tiled frames. If this is not + * done the untiled frames may be obscured by the tiled + * frames. + */ + for (i=0, mapping=0; i < xim->nframes; i++) + if (xim->tileFramesList & (1 << i)) { + fb = &xim->frames[i]; + if (!mapping) + mapping = fb->dispmap; + else if (GtCompareMappings (w, mapping, fb->dispmap) < 0) + mapping = fb->dispmap; + } + for (i=0; i < xim->nframes; i++) + if (!(xim->tileFramesList & (1 << i))) { + fb = &xim->frames[i]; + GtRaiseMapping (w, fb->dispmap, mapping); + } + } + + /* Highlight the current frame. */ + xim_highlightFrame (xim, xim->display_frame); + + sprintf (buf, "%s", xim->tileFrames ? "True" : "False"); + xim_message (xim, "tileFrames", buf); +} + + +/* XIM_HIGHLIGHTFRAME -- If in tile frames mode, highlight the current frame + * by coloring the border of the frame. + */ +xim_highlightFrame (xim, frame) +register XimDataPtr xim; +int frame; +{ + /* If we are tiling frames highlight the new display frame. */ + if (xim->gm_border) { + GmDestroy (xim->gm_border); + xim->gm_border = NULL; + } + + if (xim->tileFrames && xim->highlightFrames) { + int sx, sy, width, height, depth; + int interactive, erase; + XtPointer gm; + Arg args[20]; + int nargs = 0; + + xim_getScreen (xim, frame, &sx, &sy, &width, &height, &depth); + if (sx > 0 && sy > 0) { + gm = (XtPointer) GmCreate (xim->gt, Gm_Box, + interactive=False); + + XtSetArg (args[nargs], GmX, sx + (width-1)/2); nargs++; + XtSetArg (args[nargs], GmY, sy + (height-1)/2); nargs++; + XtSetArg (args[nargs], GmWidth, (width-1)/2+1); nargs++; + XtSetArg (args[nargs], GmHeight, (height-1)/2+1); nargs++; + XtSetArg (args[nargs], GmLineWidth, xim->tileBorder); nargs++; + XtSetArg (args[nargs], GmSensitive, False); nargs++; + XtSetArg (args[nargs], GmVisible, True); nargs++; + XtSetArg (args[nargs], GmActivated, True); nargs++; + + GmLower (gm, NULL); + GmSetAttribute (gm, GmLineColor, xim->borderColor, XtRString); + GmSetAttributes (gm, args, nargs, XtRInt); + + xim->gm_border = gm; + } + xim_labelTiles (xim); + } +} + + +/* XIM_LABELTILES -- Label the tile with the frame number. + */ +xim_labelTiles (xim) +register XimDataPtr xim; +{ + FrameBufPtr fb; + MappingPtr mp; + Widget gt = xim->gt; + XtPointer gm; + Arg args[10]; + char text[256], tw[16]; + register int i, j, len; + int sx, sy, width, height, depth, nargs=0; + + static XtPointer labels[MAX_FRAMES]; + static int label_init = 1; + + if (!(xim->tileFrames && xim->tileLabels > 0)) + return; + + /* Initialize the label markers. */ + if (label_init) { + /* First time through make sure we're all NULL. */ + for (i=0; i < MAX_FRAMES; i++) + labels[i] = (XtPointer) NULL; + label_init = 0; + } else { + /* Free up the existing labels. */ + for (i=0; labels[i] && i < MAX_FRAMES; i++) { + GmDestroy (labels[i]); + labels[i] = (XtPointer) NULL; + } + } + + + for (i=0; i < xim->nframes; i++) { + if (xim->tileFramesList & (1 << i)) { + xim_getScreen (xim, i+1, &sx, &sy, &width, &height, &depth); + fb = &xim->frames[i]; + switch (xim->tileLabels) { + case 1: /* frame number */ + sprintf (text, " %d ", i+1); + break; + case 2: /* image name */ + if (fb->nmaps == 0) { + strcpy (text, " Blank "); + } else { + mp = &fb->mapping[0]; + len = strlen (mp->ref); + for (j=len-1; mp->ref[j] != '/' && j > 0; j--) ; + sprintf (text, " %s ", &mp->ref[++j]); + } + break; + case 3: /* image title */ + if (fb->nmaps == 0) { + strcpy (text, " Blank "); + } else { + len = strlen (fb->ctran.imtitle); + for (j=0; fb->ctran.imtitle[j] != ' ' && j < len; j++) ; + j += 3; + sprintf (text, " %s ", &fb->ctran.imtitle[j]); + } + break; + } + + + /* Now draw the label as a text marker on the tile. We use + * markers since they can be placed as needed in the frame + * and provide a background which lets them be read despite + * whatever image scaling is in place. + */ + gm = (XtPointer) GmCreate (xim->gt, Gm_Text, False); + + nargs = 0; /* initialize */ + len = strlen (text); + sprintf (tw, "%dch", len); + + XtSetArg (args[nargs], GmX, sx + 10); nargs++; + XtSetArg (args[nargs], GmY, sy + height - 20); nargs++; + XtSetArg (args[nargs], GmLineWidth, 0); nargs++; + XtSetArg (args[nargs], GmSensitive, True); nargs++; + XtSetArg (args[nargs], GmVisible, True); nargs++; + XtSetArg (args[nargs], GmActivated, True); nargs++; + XtSetArg (args[nargs], GmImageText, True); nargs++; + + GmSetAttribute (gm, GmWidth, tw, XtRString); + GmSetAttribute (gm, GmHeight, "1ch", XtRString); + GmSetAttribute (gm, GmTextBgColor, "black", XtRString); + GmSetAttribute (gm, GmTextColor, "yellow", XtRString); + GmSetAttribute (gm, GmText, text, XtRString); + GmSetAttributes (gm, args, nargs, XtRInt); + GmMarkpos (gm); + GmRedraw (gm, GXcopy, True); + + labels[i] = gm; /* save the marker ptr */ + } + } +} + + +/* XIM_MATCHFRAMES -- Make the color enhancement of the listed frames match + * that of the indicated frame. + */ +void +xim_matchFrames (xim, frames, reference_frame) +XimDataPtr xim; +int *frames; +int reference_frame; +{ + register FrameBufPtr fr, fb = &xim->frames[reference_frame-1]; + register int *ip, i; + Widget gt = xim->gt; + char buf[256]; + int bits; + + /* If frames is NULL match all frames. Set one bit in BITS for + * each frame to be modified. This ensures that each frame is + * only modified once, even if the same frame is listed more than + * once. + */ + if (frames) { + for (ip=frames, bits=0; *ip; ip++) + bits |= (1 << (*ip - 1)); + } else { + for (i=1, bits=0; i <= xim->nframes; i++) + bits |= (1 << (i - 1)); + } + + for (i=0; i < xim->nframes; i++) { + fr = &xim->frames[i]; + if (fr != fb && (bits & (1 << (fr->frameno - 1)))) { + fr->colormap = fb->colormap; + fr->offset = fb->offset; + fr->scale = fb->scale; + xim_enhancement (xim, fr); + } + } +} + + +/* XIM_REGISTERFRAMES -- Register the listed frames with the given reference + * frame, i.e. set the field center and scale of each frame to match the + * reference frame. + */ +void +xim_registerFrames (xim, frames, reference_frame, offsets) +XimDataPtr xim; +int *frames; +int reference_frame; +int offsets; +{ + register int *ip, i; + register FrameBufPtr fr, fb = &xim->frames[reference_frame-1]; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + Widget gt = xim->gt; + int bits, rop; + + /* If frames is NULL register all frames. Set one bit in BITS for + * each frame to be modified. This ensures that each frame is + * only modified once, even if the same frame is listed more than + * once. + */ + if (frames) { + for (ip=frames, bits=0; *ip; ip++) + bits |= (1 << (*ip - 1)); + } else { + for (i=1, bits=0; i <= xim->nframes; i++) + bits |= (1 << (i - 1)); + } + + GtGetMapping (gt, fb->zoommap, + &rop, &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + + for (i=0; i < xim->nframes; i++) { + fr = &xim->frames[i]; + +/* if (fr != fb && (bits & (1 << (fr->frameno - 1)))) {*/ + if ((bits & (1 << (fr->frameno - 1)))) { + fr->xcen = fb->xcen; fr->ycen = fb->ycen; + fr->xmag = fb->xmag; fr->ymag = fb->ymag; + fr->xflip = fb->xflip; fr->yflip = fb->yflip; + + if (!xim_onScreen (xim, fb->frameno)) + GtDisableMapping (gt, fr->zoommap, 0); + + if (offsets) { + /* fb is the current display buffer, fr is some other + * frame in the list. To do the offsets we must + * first subtract the offset of the current display + * and then add the offset peculiar to the frame. + */ + + int nsx, nsy; + + nsx = (int)(sx - fb->xoff + fr->xoff); + nsy = (int)(sy - fb->yoff + fr->yoff); + + GtSetMapping (gt, fr->zoommap, xim->rop, + fr->raster, st,nsx,nsy, snx,sny, + fr->zoomras,dt,dx,dy,dnx,dny); + GtRefreshMapping (gt, fr->zoommap); + + } else { + GtSetMapping (gt, fr->zoommap, xim->rop, + fr->raster, st,sx,sy, snx,sny, + fr->zoomras,dt,dx,dy,dnx,dny); + } + } + } + + /* A normal registration zeroes the offsets for each frame. */ + if (!offsets) { + for (i=0; i < xim->nframes; i++) { + fr = &xim->frames[i]; + fr->xoff = fr->yoff = 0; + } + } + xim_labelTiles (xim); +} + + +/* XIM_CURSORMODE -- Enter or leave cursor mode. The remote client issues + * a cursor read request via the datastream, then blocks until a cursor + * value is returned. The GUI is responsible for signalling to the user + * that the application is waiting for cursor input, and for returning the + * cursor value when the cursor read finishes. + */ +void +xim_cursorMode (xim, state) +register XimDataPtr xim; +int state; +{ + /* The GUI is responsible for implementing cursor reads. */ + xim_message (xim, "cursorMode", state ? "on" : "off"); +} + + +/* XIM_SETMAPPING -- Set up a mapping between two rasters. + */ +void +xim_setMapping (xim, fb, frame, mapping, src, dst, fill_mode) +register FrameBufPtr fb; +register XimDataPtr xim; +int frame; +int mapping; +int src, dst; +int fill_mode; +{ + register Widget gt = xim->gt; + int src_type, src_width, src_height, src_depth; + int dst_type, dst_width, dst_height, dst_depth, dst_x, dst_y; + float xscale, yscale, scale; + int dx, dy, dnx, dny; + int sx, sy, snx, sny; + + /* Get dimensions of source and destination rasters. */ + if (GtQueryRaster (gt, src, + &src_type, &src_width, &src_height, &src_depth) == 0) + return; + + /* Get region of destination to be written into. */ + if (dst == 0) { + xim_getScreen (xim, frame, + &dst_x, &dst_y, &dst_width, &dst_height, &dst_depth); + } else { + if (GtQueryRaster (gt, dst, + &dst_type, &dst_width, &dst_height, &dst_depth) == 0) + return; + dst_x = dst_y = 0; + } + + xscale = (float)dst_width / (float)src_width; + yscale = (float)dst_height / (float)src_height; + + switch (fill_mode) { + case M_UNITARY: + /* Set up a unitary (one-to-one) mapping, i.e. one pixel in the + * source is mapped to one pixel in the destination. The mapped + * region is the center of both rasters. + */ + xscale = yscale = 1.0; + /* fall through */ + + case M_ASPECT: + /* Scale the source to fit the destination, preserving the + * aspect ratio and displaying all source pixels. + */ + scale = min (xscale, yscale); + if (abs(scale - (int)(scale+0.5)) < TOL) + scale = (int)(scale+0.5); + + dnx = src_width * scale; + if (dnx > dst_width) { + /* Clip source rect. */ + dnx = dst_width; + snx = dnx; + sx = max (0, (src_width + 1) / 2 - snx / 2); + dx = 0; + } else { + /* Clip destination rect. */ + snx = src_width; + sx = 0; + dx = max (0, (dst_width + 1) / 2 - dnx / 2); + } + + dny = src_height * scale; + if (dny > dst_height) { + /* Clip source rect. */ + dny = dst_height; + sny = dny; + sy = max (0, (src_height + 1) / 2 - sny / 2); + dy = 0; + } else { + /* Clip destination rect. */ + sny = src_height; + sy = 0; + dy = max (0, (dst_height + 1) / 2 - dny / 2); + } + + GtSetMapping (gt, mapping, xim->rop, + src, GtPixel, sx, sy, snx, sny, + dst, GtPixel, dst_x + dx, dst_y + dy, dnx, dny); + break; + + case M_FILL: + /* Scale the source to fill the destination window. + */ + GtSetMapping (gt, mapping, xim->rop, + src, GtPixel, 0, 0, src_width, src_height, + dst, GtPixel, dst_x, dst_y, dst_width, dst_height); + break; + } + + if (fb && mapping == fb->zoommap) { + fb->xmag = 1.0; + fb->ymag = 1.0; + fb->xscale = xscale; + fb->yscale = yscale; + fb->xcen = (src_width + 1) / 2.0; + fb->ycen = (src_height + 1) / 2.0; + fb->xflip = fb->yflip = 0; + } +} + + +/* XIM_SETZOOM -- Modify a mapping between two rasters given the specified + * view center and zoom factors. + */ +void +xim_setZoom (xim, fb, frame, mapping, src, dst, xcen,ycen,xmag,ymag, xoff,yoff, absolute) +register XimDataPtr xim; +register FrameBufPtr fb; +int frame; +int mapping; +int src, dst; +float xcen, ycen; /* center of source raster region to be mapped */ +float xmag, ymag; /* magnification in each axis */ +float xoff, yoff; /* offset in each axis */ +Boolean absolute; /* ignore xscale/yscale */ +{ + register Widget gt = xim->gt; + int src_type, src_width, src_height, src_depth; + int dst_type, dst_width, dst_height, dst_depth, dst_x, dst_y; + int sx1, sx2, sy1, sy2, snx, sny; + int dx1, dx2, dy1, dy2, dnx, dny; + int fx1, fx2, fy1, fy2, shift; + int src_recenter_allowed = 1; + int dst_recenter_allowed = 1; + int xreplicate, yreplicate; + int scale, max_x, max_y, bias; + float xscale, yscale; + char buf[256]; + + + /* Get dimensions of source and destination rasters. */ + if (GtQueryRaster (gt, src, + &src_type, &src_width, &src_height, &src_depth) == 0) + return; + + /* Get region of destination to be written into. */ + if (dst == 0) { + xim_getScreen (xim, frame, + &dst_x, &dst_y, &dst_width, &dst_height, &dst_depth); + } else { + if (GtQueryRaster (gt, dst, + &dst_type, &dst_width, &dst_height, &dst_depth) == 0) + return; + dst_x = dst_y = 0; + } + + /* Use old center if none given. */ + if (xcen <= 0) + xcen = fb->xcen; + if (ycen <= 0) + ycen = fb->ycen; + + /* Get scaling ratios. */ + if (absolute) { + xscale = xmag; + yscale = ymag; + } else { + xscale = xmag * fb->xscale; + yscale = ymag * fb->yscale; + } + + /* Avoid roundoff if integer scaling. */ + if (xreplicate = (abs(xscale - (int)(xscale+0.5)) < TOL)) + xscale = (int)(xscale+0.5); + if (yreplicate = (abs(yscale - (int)(yscale+0.5)) < TOL)) + yscale = (int)(yscale+0.5); + + /* Sanity check, return if we're getting too small. */ + if (xscale < TOL || yscale < TOL) + return; + + + /* Map the destination rect back into the source with the given + * zoom factor and center, clipping the source rect at the source + * raster boundary. + */ +src_recenter: + max_x = src_width - 1; + max_y = src_height - 1; + + snx = (int) (dst_width / xscale) + 1; + sny = (int) (dst_height / yscale) + 1; + + sx1 = (int) (xcen - snx / 2.0 + 0.5 + xoff); /*********/ + sx2 = (int) (xcen + snx / 2.0 + 0.5); + sy1 = (int) (ycen - sny / 2.0 + 0.5 + yoff); /*********/ + sy2 = (int) (ycen + sny / 2.0 + 0.5); + + /* Fiddle the source rect slightly if necessary to achieve the + * requested snx,sny. This corrects for any pixel selection errors + * introduced in the float to integer truncation. This is a small + * effect but it can be apparent at high pixel magnifications. + */ + sx2 -= ((sx2 - sx1 + 1) - snx); + sy2 -= ((sy2 - sy1 + 1) - sny); + + if (src_recenter_allowed) { + /* Adjust the center of the source rect to make it fit on the + * source raster, but only if only one edge extends beyond the + * raster boundary. If both edges are out of bounds we just + * clip below. + * + * MJF 9/29 - The changes to fx2/fy2 below are to fix an off-by-one + * error in the center pixel computed by an integer zoom. For + * example, display a 256sq image, invert the cmap and zoom by + * two, the center is different than a straight centering op done + * by the pan function. The effect is that hardcopy has an extra + * border on two sides. + */ + fx1 = (sx1 < 0) ? -sx1 : 0; + fx2 = (sx2 > max_x) ? (max_x - sx2 + 1) : 0; + if (fx1 && !fx2 || !fx1 && fx2) + xcen += (fx1 + fx2); + + fy1 = (sy1 < 0) ? -sy1 : 0; + fy2 = (sy2 > max_y) ? (max_y - sy2 + 1) : 0; + if (fy1 && !fy2 || !fy1 && fy2) + ycen += (fy1 + fy2); + + src_recenter_allowed = 0; + goto src_recenter; + } + + /* Clip the source rect to the raster boundary. */ + sx1 = max(0, min(max_x, sx1)); + sx2 = max(0, min(max_x, sx2)); + sy1 = max(0, min(max_y, sy1)); + sy2 = max(0, min(max_y, sy2)); + + snx = sx2 - sx1 + 1; + sny = sy2 - sy1 + 1; + + + /* Map the zoomed, possibly centered, and clipped source rect back + * to the destination. + */ + max_x = dst_width - 1; + max_y = dst_height - 1; + + dx1 = (int) ((sx1-0.5 - xcen) * xscale + dst_width / 2.0 + 0.5); + dx2 = (int) ((sx2+0.5 - xcen) * xscale + dst_width / 2.0 + 0.5); + dy1 = (int) ((sy1-0.5 - ycen) * yscale + dst_height / 2.0 + 0.5); + dy2 = (int) ((sy2+0.5 - ycen) * yscale + dst_height / 2.0 + 0.5); + + if (dst_recenter_allowed) { + /* If the unclipped destination rect extends out of bounds on + * one side or the other (but not both), shift it slightly to + * try to recenter it on the destination raster. This tends + * to cancel out rounding errors occurring in the calculation + * of the destination rect. + */ + fx1 = (dx1 < 0) ? -dx1 : 0; + fx2 = (dx2 > max_x) ? (max_x - dx2) : 0; + if (fx1 && !fx2 || !fx1 && fx2) { + shift = (fx1 + fx2); + dx1 += shift; + dx2 += shift; + } + + fy1 = (dy1 < 0) ? -dy1 : 0; + fy2 = (dy2 > max_y) ? (max_y - dy2) : 0; + if (fy1 && !fy2 || !fy1 && fy2) { + shift = (fy1 + fy2); + dy1 += shift; + dy2 += shift; + } + + /* If the destination rect does not fill the destination raster, + * center it in the raster. + */ + if ((dx2 - dx1 + 1) < dst_width) { + shift = (dx1 + (max_x - dx2)) / 2 - dx1; + dx1 += shift; + dx2 += shift; + } + + if ((dy2 - dy1 + 1) < dst_height) { + shift = (dy1 + (max_y - dy2)) / 2 - dy1; + dy1 += shift; + dy2 += shift; + } + } + + /* Clip to the edge of the destination raster. */ + dx1 = max(0, min(max_x, dx1)); + dx2 = max(0, min(max_x, dx2)); + dy1 = max(0, min(max_y, dy1)); + dy2 = max(0, min(max_y, dy2)); + + dnx = dx2 - dx1 + 1; + dny = dy2 - dy1 + 1; + + /* Attempt to integerize things if integer scaling is selected. This + * can leave a blank pixel or two at the edge depending upon the + * window size and scaling. + */ + scale = (int)xscale; + if (xreplicate && dnx != snx * scale) { + if (snx < src_width) { + snx = max(1, min(src_width, dnx / scale)); + dnx = max(1, min(dst_width, snx * scale)); + } else if (dnx < dst_width) { + dnx = max(1, min(dst_width, snx * scale)); + snx = max(1, min(src_width, dnx / scale)); + } + if ((bias = ((dx2 - dx1 + 1) - dnx) / 2) > 0) { + dx1 += bias; + dx2 += bias; + } + } + scale = (int)yscale; + if (yreplicate && dny != sny * scale) { + if (sny < src_height) { + sny = max(1, min(src_height, dny / scale)); + dny = max(1, min(dst_height, sny * scale)); + } else if (dny < dst_height) { + dny = max(1, min(dst_height, sny * scale)); + sny = max(1, min(src_height, dny / scale)); + } + if ((bias = ((dy2 - dy1 + 1) - dny) / 2) > 0) { + dy1 += bias; + dy2 += bias; + } + } + + + + /* Set the mapping. */ + initialize_shadow_pixmap (gt, dst); + GtSetMapping (gt, mapping, xim->rop, + src, GtPixel, sx1, sy1, snx, sny, + dst, GtPixel, dst_x + dx1, dst_y + dy1, + fb->xflip ? -dnx : dnx, + fb->yflip ? -dny : dny); + + /* Update the frame buffer zoom/pan/flip parameters. */ + fb->xcen = xcen; fb->ycen = ycen; + fb->xoff = xoff; fb->yoff = yoff; + + if (absolute) { + fb->xmag = xmag / fb->xscale; + fb->ymag = ymag / fb->yscale; + } else { + fb->xmag = xmag; + fb->ymag = ymag; + } + + xim_frameRegion (xim, fb); + sprintf (buf, "%g %g %g %g %g %g %g %g", + fb->xmag, fb->ymag, fb->xcen, fb->ycen, + fb->xscale, fb->yscale, fb->xoff, fb->yoff); + xim_message (xim, "frameView", buf); +} + + +/* XIM_GETSCREEN -- Determine the region of the display window to which + * the given frame is mapped. + */ +xim_getScreen (xim, frame, sx, sy, width, height, depth) +register XimDataPtr xim; +int frame; +int *sx, *sy; +int *width, *height, *depth; +{ + register int i; + int border = xim->tileBorder; + int rtype, scr_width, scr_height; + int twidth, theight, tileno, frameno; + int tilex, tiley; + int nrows = xim->tileRows, ncols = xim->tileCols; + + if (GtQueryRaster (xim->gt, 0, + &rtype, &scr_width, &scr_height, depth) == 0) + return; + + /* Use the entire display window if we are not tiling frames, if + * there aren't enough frames to tile, or if the given frame is + * not in the list of tile frames. + */ + if (!xim->tileFrames || xim->nframes <= 1 || + !(xim->tileFramesList & (1 << frame-1))) { + *sx = *sy = 0; + *width = scr_width; + *height = scr_height; + return; + } + + /* Get index of frame in tile Frames list. */ + for (i=1, frameno=0; i <= xim->nframes; i++) { + if (xim->tileFramesList & (1 << (i-1))) { + frameno++; + if (frame == i) + break; + } + } + + /* Now compute the size of each tile. */ + tileno = frameno - 1; + twidth = (scr_width - (ncols * 2 * border)) / ncols; + theight = (scr_height - (nrows * 2 * border)) / nrows; + + /* Get the "coordinates" of the tile in the mosaic. */ + if (xim->tileByRows) { + tilex = tileno % ncols; + tiley = tileno / ncols; + } else { + tilex = tileno / nrows; + tiley = tileno % nrows; + } + if (!xim->tileTopDown) + tiley = (nrows - tiley - 1); + + /* Finally, get the placement of the tile on the screen. */ + *sx = tilex * twidth + ((tilex*2+1) * border); + *sy = tiley * theight + ((tiley*2+1) * border); + + *width = twidth; + *height = theight; +} + + +/* XIM_ONSCREEN -- Test whether the given frame is visible onscreen. + */ +xim_onScreen (xim, frame) +register XimDataPtr xim; +int frame; +{ + if (xim->tileFrames) + return ((xim->tileFramesList & (1 << (frame-1))) != 0); + else + return (frame == xim->display_frame); +} + + +/* XIM_SETFLIP -- Modify a mapping to flip the frame in X and/or Y. + */ +void +xim_setFlip (xim, fb, flip_x, flip_y) +register XimDataPtr xim; +register FrameBufPtr fb; +int flip_x, flip_y; +{ + register Widget gt = xim->gt; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int rop; + + if (!flip_x && !flip_y) + return; + + if (flip_x) + fb->xflip = !fb->xflip; + if (flip_y) + fb->yflip = !fb->yflip; + + GtGetMapping (gt, fb->zoommap, + &rop, &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + + dnx = abs (dnx); + dnx = fb->xflip ? -dnx : dnx; + dny = abs (dny); + dny = fb->yflip ? -dny : dny; + + GtSetMapping (gt, fb->zoommap, + rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); + + xim_message (xim, "xflip", fb->xflip ? "true" : "false"); + xim_message (xim, "yflip", fb->yflip ? "true" : "false"); +} + + +/* XIM_SETROP -- Modify the rasterop portion of a mapping. + */ +void +xim_setRop (xim, fb, rop) +register XimDataPtr xim; +register FrameBufPtr fb; +int rop; +{ + register Widget gt = xim->gt; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + int oldrop; + + GtGetMapping (gt, fb->zoommap, + &oldrop, &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + + GtSetMapping (gt, fb->zoommap, + rop, src,st,sx,sy,snx,sny, dst,dt,dx,dy,dnx,dny); +} + + +/* XIM_SETCURSORPOS -- Set the cursor position. + */ +void +xim_setCursorPos (xim, sx, sy) +register XimDataPtr xim; +float sx, sy; /* raster coordinates */ +{ + GtSetRaster (xim->gt, xim->df_p->frameno); + GtSetCursorPos (xim->gt, (int)sx, (int)sy); + GtSetRaster (xim->gt, 0); +} + + +/* XIM_GETCURSORPOS -- Get the cursor position. This is done to a fractional + * pixel precision if the image is zoomed. + */ +void +xim_getCursorPos (xim, sx, sy, raster, frame) +register XimDataPtr xim; +float *sx, *sy; +int *raster, *frame; +{ + register FrameBufPtr fb; + DPoint pv1, pv2; + int rx, ry, rmap; + int src, x, y, i; + + GtGetCursorPos (xim->gt, &x, &y); + src = GtSelectRaster (xim->gt, 0, GtPixel, x,y, GtNDC, &rx, &ry, &rmap); + + pv1.x = rx; pv1.y = ry; + GtNDCToPixel (xim->gt, src, &pv1, &pv2, 1); + *sx = pv2.x; + *sy = pv2.y; + + if (raster) + *raster = src; + + if (frame) { + *frame = xim->display_frame; + for (i=1; i < xim->nframes; i++) { + fb = &xim->frames[i-1]; + if (fb->raster == src || fb->zoomras == src) { + *frame = fb->frameno; + break; + } + } + } +} + + +/* XIM_READDISPLAY -- Read a region of the current display frame and return + * the pixels and corresponding RGB colormap. We allocate a pointer to the + * pixels that needs to be freed later on. Note this routine returns an + * 8 bit RGB colormap. + */ +unsigned char * +xim_readDisplay (xim, x0,y0,nx,ny, w,h, r,g,b, ncolors) +register XimDataPtr xim; +int x0,y0,nx,ny; /* region to extract (input) */ +int *w, *h; /* size of output region (output). */ +unsigned char *r, *g, *b; /* colortable (output) */ +int *ncolors; /* size of colortable (output) */ +{ + register Widget gt = xim->gt; + register int i, j; + + int raster, x1, y1, nc; + int first, nelem, maxelem; + char buf[SZ_LINE], *tmpfile; + unsigned short *rs, *gs, *bs; + int junk, width, height, depth; + unsigned short *cmap=NULL, *iomap=NULL; + unsigned char *pixels=NULL; + static int debug = 0; + + /* The display is raster zero. */ + raster = 0; + + /* Get the size of the raster we're going to extract. If nx or ny + * is zero use the entire raster, else use the indicated region. + * If a region is given clip it to the raster boundary. + */ + if (GtQueryRaster (gt, raster, &junk, &width, &height, &depth) == 0) + goto error; + + + if (nx <= 0 || ny <= 0) { + x0 = y0 = 0; + nx = width; + ny = height; + } else { + x1 = min (width-1, x0 + nx - 1); + y1 = min (height-1, y0 + ny - 1); + x0 = max (0, x0); + y0 = max (0, y0); + nx = x1 - x0 + 1; + ny = y1 - y0 + 1; + } + + /* Get a pixel buffer and read the pixels. */ + if (nx*ny <= 0 || !(pixels = (unsigned char *) malloc (nx * ny))) + goto error; + if (GtReadPixels (gt, raster, pixels, 8, x0, y0, nx, ny) < 0) + goto error; + + + /* Get Gterm widget colormap. */ + if (!(cmap = (ushort *) malloc (3 * MAX_COLORS * sizeof(ushort)))) + goto error; + + rs = cmap; + gs = rs + MAX_COLORS; + bs = gs + MAX_COLORS; + + if (depth == 8) { + nc = GtReadColormap (gt, raster, 0, MAX_COLORS, rs,gs,bs); + if (nc <= 0) + goto error; + + + /* Get the RGB color associated with each pixel. To determine + ** this we must consider both the Gterm widget colormap and iomap. + ** The iomap maps client pixels to Gterm widget pixels, and the + ** colormap maps Gterm widget pixels to RGB values. GtReadPixels + ** returns client pixels, so to get the RGB value associated with + ** each client pixel we must run the client pixel through the iomap + ** to get the Gterm widget pixel, and then use this to look up the + ** RGB value in the widget's colormap. When reading the display + ** (raster=0) we get the colormap corresponding to the image as + ** currently windowed, hence the output image will be rendered as + ** in the current display. Note: the Gterm widget maps are 16 bits, + ** while we return an 8 bit RGB colormap to our caller. + */ + /* Get iomap. */ + if (!(iomap = (ushort *) malloc (MAX_COLORS * sizeof(ushort)))) + goto error; + GtReadIomap (gt, iomap, 0, MAX_COLORS); + + if (debug) { + register short pmin = MAX_COLORS, pmax = 0, i, j; + fprintf (stderr, "iomap\n"); + for (i=0; i < MAX_COLORS; ) { + for (j=0; j < 8 && i < MAX_COLORS; j++) { + pmin = (iomap[i] < pmin ? iomap[i] : pmin); + pmax = (iomap[i] > pmax ? iomap[i] : pmax); + fprintf (stderr, "%3d(%3d) ", i, iomap[i++]); + } + fprintf (stderr, "\n"); + + } + fprintf (stderr, "iomap min = %d max = %d\n", pmin, pmax); + fprintf (stderr, "Gterm Colormap\n"); + for (i=0; i < MAX_COLORS; ) { + for (j=1; j < 4 && i < MAX_COLORS; j++) + fprintf (stderr, " %3d(%3d,%3d,%3d)",i, + (rs[i]>>8),(gs[i]>>8),(bs[i++]>>8)); + fprintf (stderr, "\n"); + } + fflush (stderr); + } + + /* Output the colormap. */ + for (i=0; i < nc; i++) { + j = iomap[i]; + r[i] = (rs[j] >> 8); + g[i] = (gs[j] >> 8); + b[i] = (bs[j] >> 8); + } + for (i=nc; i < MAX_COLORS; i++) { + j = iomap[i]; + r[i] = (rs[j] >> 8); + g[i] = (gs[j] >> 8); + b[i] = (bs[j] >> 8); + } + + } else { + unsigned long lut[MAX_COLORS]; + int start = 10; /* static colors offset */ + + GtReadLUT (gt, lut, 0, MAX_COLORS); + + nc = 216; + for (i=0; i < nc; i++) { + r[i] = (lut[i] >> 16) & 0xff; + g[i] = (lut[i] >> 8) & 0xff; + b[i] = (lut[i] ) & 0xff; + } + } + + *w = nx; + *h = ny; + *ncolors = nc; /* includes static colors */ + + if (debug) { + fprintf (stderr, + "xim_readDisplay: w=%d h=%d d=%d\n", width, height, depth); + for (i=0; i < nc; i++) + fprintf (stderr, "xim_readDisplay[%3d]: %3d %3d %3d\n", + i, r[i], g[i], b[i]); + } + + free ((char *) cmap); + free ((char *) iomap); + + return (pixels); + +error: + if (cmap) + free ((char *) cmap); + if (iomap) + free ((char *) iomap); + if (pixels) + free ((char *) pixels); + return (NULL); +} + + +/* XIM_WRITEDISPLAY -- Load the current display frame from the pixel array + * and RGB colormap passed in the input arguments. The data is assumed to + * be 8 bit pseudocolor. + */ +int +xim_writeDisplay (xim, frame, mapname, pixels, w,h, r,g,b, ncolors) +register XimDataPtr xim; +int frame; /* display frame to be written */ +char *mapname; /* colormap name to be written */ +unsigned char *pixels; +int w, h; +unsigned char *r, *g, *b; +int ncolors; +{ + register int i, j; + register FrameBufPtr fb; + register Widget gt = xim->gt; + unsigned short rs[MAX_COLORS], gs[MAX_COLORS], bs[MAX_COLORS]; + unsigned short iomap[MAX_COLORS], sv_iomap[MAX_COLORS]; + unsigned short invmap[MAX_COLORS]; + int want, npix, nx, ny, sx0, sy0, dx0, dy0; + int sx, sy, width, height, depth; + float xzoom, yzoom, zoom; + int debug=0, autoscale=xim->autoscale; + unsigned char *gtpix; + ColorMapPtr cm; + + + if (DBG_RASTER) + fprintf (stderr, "raster writeDisplay: ......................."); + + /* If frame=0 use the current display frame. */ + if (frame < 1) frame = xim->display_frame; + + /* Create additional frames if needed. */ + if (frame > xim->nframes) { + for (i=1; i <= frame; i++) { + fb = &xim->frames[i-1]; + if (fb->frameno != i) { + xim_initFrame (xim, i, frame, + &xim->fb_config[xim->fb_configno-1], xim->memModel); + + /* If we're in tile mode, add the frame to the tile list + * and if needed resize the tile frames. + */ + if (xim->tileFrames) { + xim->tileFramesList |= (1 << (i-1)); + xim->nTileFrames++; + xim_tileFrames (xim, xim->tileFramesList); + } + } + } + } + + + /* Erase the existing frame before disabling the mapping, otherwise + * we get a white background when the new image is loaded. + */ + xim_eraseFrame (xim, frame); + + fb = &xim->frames[frame-1]; + GtDisableMapping (gt, fb->dispmap, 0); + + /* Substitute a one-to-one iomap so that we don't confuse colors for + * a non-continuous tone (grayscale) image. + */ + GtReadIomap (gt, sv_iomap, 0, MAX_COLORS); + for (i=0; i < MAX_COLORS; i++) + iomap[i] = FIRST_COLOR + min (xim->ncolors, i); + GtWriteIomap (gt, iomap, 0, MAX_COLORS); + + /* If debug mode is enabled compute and print the minimum and maximum + * pixel values and a histogram or count of the number of pixels at + * each value. + */ + if (debug) { + int count[MAX_COLORS]; + int v, lo, hi; + + memset ((void *)count, 0, sizeof(count)); + for (i=0, lo=MAX_COLORS, hi=0; i < w*h; i++) { + v = pixels[i]; + count[v]++; + if (v < lo) + lo = v; + else if (v > hi) + hi = v; + } + fprintf (stderr, "%s: w=%d h=%d min=%d max=%d\n", + mapname, w, h, lo, hi); + + for (i=0, j=0; i < MAX_COLORS; i++) + if (count[i]) { + fprintf (stderr, " %3d(%4d)", i, min(9999,count[i])); + if (++j >= 7) { + fprintf (stderr, "\n"); + j = 0; + } + } + if (j) + fprintf (stderr, "\n"); + + fprintf (stderr, "zeros: "); + for (i=0; i < MAX_COLORS; i++) + if (!count[i]) + fprintf (stderr, " %d", i); + fprintf (stderr, "\n"); + } + + /* Invert the iomap. We want to map standard pixels 0-N to the range + * FC-FC+N in Gterm color space (FC is shorthand for FIRST_COLOR). + * GtWritePixels will process pixels through the ximtool iomap so we + * need to compute invmap, which tells us the input value needed to + * get the desired value of out the iomap. + GtReadIomap (gt, iomap, 0, MAX_COLORS); + memset ((void *)invmap, 0, sizeof(invmap)); + for (i=0; i < MAX_COLORS; i++) + invmap[iomap[i]] = i; + if (!(gtpix = (unsigned char *) malloc (npix = w * h))) + return (-1); + for (i=0; i < npix; i++) { + want = FIRST_COLOR + pixels[i]; + gtpix[i] = invmap[want]; + } + free ((char *) gtpix); + */ + + /* If the image is too large to fit in the existing frame clip it + * to fit (we need to add an auto-resize option here later). + */ + if (w > xim->width) { + nx = xim->width; + sx0 = (w - nx) / 2; + dx0 = 0; + } else { + nx = w; + sx0 = 0; + dx0 = (xim->width - w) / 2; + } + + if (h > xim->height) { + ny = xim->height; + sy0 = (h - ny) / 2; + dy0 = 0; + } else { + ny = h; + sy0 = 0; + dy0 = (xim->height - h) / 2; + } + + /* Load the frame. The GtWritePixels call loads to the raster + * associated with the frame, not the frame number directly. + */ + if (nx <= xim->width && ny <= xim->height) { + GtWritePixels (gt, fb->raster, pixels, 8, dx0, dy0, nx, ny); + } else { + unsigned char *ip = pixels + sy0 * w + sx0; + for (i=0; i < ny; i++, ip += w) + GtWritePixels (gt, fb->raster, ip, 8, dx0, dy0+i, nx, 1); + } + + /* Get screen size. */ + xim_getScreen (xim, 1, &sx, &sy, &width, &height, &depth); + + /* Compute the new scale factor required to scale the source to the + * destination at magnification 1.0. + */ + if (autoscale) { + xzoom = (float)width / (float)nx; + yzoom = (float)height / (float)ny; + zoom = min (xzoom, yzoom); + } else { + xzoom = 1.0; + yzoom = 1.0; + zoom = 1.0; + } + + /* Set the new mapping. */ + fb->xmag = fb->ymag = zoom; + fb->xcen = xim->width / 2; + fb->ycen = xim->height / 2; + + /* Zoom it to fill the display window. */ + xim_setZoom (xim, fb, frame, fb->zoommap, fb->raster, fb->zoomras, + fb->xcen, fb->ycen, fb->xmag, fb->ymag, + fb->xoff, fb->yoff, True); + + /* Check if the named colortable is already defined. If not, add + * another one. If ncolors=0 omit the colortable handling, e.g. + * when loading a raster that doesn't have a colormap. + */ + if (ncolors > 0) { + for (i=0, cm=NULL; i < ncolormaps; i++) + if (strcmp (colormaps[i].name, mapname) == 0) { + cm = &colormaps[i]; + break; + } + if (!cm) { + if (ncolormaps >= MAX_COLORMAPS - 1) + cm = &colormaps[ncolormaps]; + else { + cm = &colormaps[ncolormaps++]; + cm->mapno = GtNextColormap (gt); + } + strcpy (cm->name, mapname); + ncolormaps = min (MAX_COLORMAPS-1, ncolormaps); + + /* Pass the list of colortables on to the user interface. */ + xim_colortables (xim); + } + + for (i=0; i < ncolors; i++) { + rs[i] = (r[i] << 8); + gs[i] = (g[i] << 8); + bs[i] = (b[i] << 8); + } + + if (DBG_RASTER) + fprintf (stderr,"raster writeDisplay: writing colormap......."); + GtWriteColormap (gt, cm->mapno, + FIRST_COLOR, min(ncolors,xim->ncolors), rs, gs, bs); + if (DBG_RASTER) + fprintf (stderr, + "raster writeDisplay: writing colormap.......DONE"); + + fb->offset = 0.5; + fb->scale = (xim->invert ? -1.0 : 1.0); + fb->colormap = cm->mapno; + } else + cm = &colormaps[fb->colormap-1]; + + /* Display the frame. */ + GtEnableMapping (gt, fb->dispmap, 1); + GtSetDisplayRaster (gt, xim->display_frame); + xim_setDisplayFrame (xim, frame); + + GtSetColormapFocus (-1); /* force full update */ + GtLoadColormap (gt, cm->mapno, fb->offset, fb->scale); + GtSetColormapFocus (xim->cm_focus); + xim_enhancement (xim, fb); + + GtWriteIomap (gt, sv_iomap, 0, MAX_COLORS); + + if (DBG_RASTER) + fprintf (stderr, "raster writeDisplay: ......................DONE"); + return (0); +} + + +/* XIM_MESSAGE -- Send a message to the user interface. + */ +void +xim_message (xim, object, message) +register XimDataPtr xim; +char *object; +char *message; +{ + char msgbuf[SZ_MSGBUF]; + + sprintf (msgbuf, "setValue {%s}", message); + ObmDeliverMsg (xim->obm, object, msgbuf); +} + + +/* XIM_MSGI -- Like xim_message, but the message is an integer value. + */ +void +xim_msgi (xim, object, value) +register XimDataPtr xim; +char *object; +int value; +{ + char msgbuf[SZ_LINE]; + sprintf (msgbuf, "setValue {%d}", value); + ObmDeliverMsg (xim->obm, object, msgbuf); +} + + +/* XIM_ALERT -- Issue an alert to the server. The message text input will + * be displayed and either the ok (proceed) or cancel action will be taken, + * causing the action text input to be sent back to the client to be + * executed as a command. This is used to alert the server (i.e. user) of + * unusual circumstances and determine whether or not the server wants to + * proceed. An alert with no actions is a warning. + */ +void +xim_alert (xim, text, ok_action, cancel_action) +register XimDataPtr xim; +char *text; /* message text */ +char *ok_action; /* command sent back to client for "ok" */ +char *cancel_action; /* command sent back to client for "cancel" */ +{ + char msgbuf[SZ_LINE]; + sprintf (msgbuf, "setValue {{%s} {%s} {%s}}", text, + ok_action ? ok_action : "", cancel_action ? cancel_action : ""); + ObmDeliverMsg (xim->obm, "alert", msgbuf); +} + + +/* + * Internal Routines. + * ------------------- + */ + +/* XIM_FRAMEREGION -- Called when the value of the frameRegion UI parameter + * needs to be updated. + */ +static void +xim_frameRegion (xim, fb) +register XimDataPtr xim; +register FrameBufPtr fb; +{ + int rop, src, dst; + int st, sx, sy, snx, sny; + int dt, dx, dy, dnx, dny; + char buf[SZ_LINE]; + + if (GtGetMapping (xim->gt, fb->zoommap, &rop, + &src, &st, &sx, &sy, &snx, &sny, + &dst, &dt, &dx, &dy, &dnx, &dny) == -1) + return; + + /* args: frame x y width height */ + sprintf (buf, "%d %d %d %d %d", fb->frameno, sx, sy, snx, sny); + xim_message (xim, "frameRegion", buf); +} + + +/* XIM_COLORTABLES -- Called when the "colortables" UI parameter needs to be + * updated, i.e., when some change to the list of colormaps has occurred. + */ +static void +xim_colortables (xim) +XimDataPtr xim; +{ + register char *ip, *op; + char buf[MAX_COLORMAPS*40]; + int i; + + for (i=0, op=buf; i < ncolormaps; i++) { + *op++ = '"'; + for (ip = colormaps[i].name; *op = *ip++; op++) + ; + *op++ = '"'; + *op++ = '\n'; + } + *op++ = '\0'; + + xim_message (xim, "colortables", buf); +} + + +/* XIM_ENHANCEMENT -- Called when the "enhancement" UI parameter needs to + * be updated for a frame. + */ +xim_enhancement (xim, fb) +register XimDataPtr xim; +register FrameBufPtr fb; +{ + char buf[SZ_LINE]; + + sprintf (buf, "%d \"%s\" %0.3f %0.3f", fb->frameno, + colormaps[fb->colormap-1].name, fb->offset, fb->scale); + xim_message (xim, "enhancement", buf); + + + /* Force an update of the colorbar. On TrueColor visuals this + ** is required since the colormap doesn't automatically update + ** the display. + */ + set_colorbar (xim, xim->cb); +} + + +/* GET_FBCONFIG -- Read the XIMTOOL startup file to get the set of possible + * frame buffer sizes. + * + * File format: configno nframes width height [extra fields] + * e.g., 1 2 512 512 + * 2 2 800 800 + * 3 1 1024 1024 # comment + */ +static void +get_fbconfig (xim) +register XimDataPtr xim; +{ + register char *ip; + register FILE *fp = NULL; + int config, nframes, width, height, i; + char lbuf[SZ_LINE+1], *fname; + static char *fb_paths[] = { + "/usr/local/lib/imtoolrc", + "/opt/local/lib/imtoolrc", + "/iraf/iraf/dev/imtoolrc", + "/local/lib/imtoolrc", + "/usr/iraf/dev/imtoolrc", + "/usr/local/iraf/dev/imtoolrc", + NULL}; + + /* Initialize the config table. */ + xim->fb_configno = 1; + for (i=0; i < MAX_FBCONFIG; i++) { + xim->fb_config[i].nframes = 1; + xim->fb_config[i].width = DEF_FRAME_WIDTH; + xim->fb_config[i].height = DEF_FRAME_HEIGHT; + } + + /* Now add in some defaults for commonly used sizes based on the + * standard IRAF imtoolrc file, we'll avoid any instrument specific + * configurations. + */ + xim->fb_config[0].width = xim->fb_config[0].height = 512; + xim->fb_config[1].width = xim->fb_config[1].height = 800; + xim->fb_config[2].width = xim->fb_config[2].height = 1024; + xim->fb_config[3].width = xim->fb_config[3].height = 1600; + xim->fb_config[4].width = xim->fb_config[4].height = 2048; + xim->fb_config[5].width = xim->fb_config[5].height = 4096; + + /* Attempt to open the config file. */ + if ((fname=getenv(FBCONFIG_ENV1)) || (fname=getenv(FBCONFIG_ENV2))) + fp = fopen (fname, "r"); + if (!fp && (fname = getenv ("HOME"))) { + sprintf (lbuf, "%s/%s", fname, FBCONFIG_1); + fp = fopen (fname = lbuf, "r"); + if (fp) { + xim->imtoolrc = (char *) XtCalloc (SZ_LINE, sizeof(char)); + strncpy (xim->imtoolrc, fname, strlen(fname)); + } + } + if (!fp) + fp = fopen (fname = xim->imtoolrc, "r"); + for (i=0; !fp && fb_paths[i]; i++) { + if ((fp = fopen (fname = fb_paths[i], "r"))) { + xim->imtoolrc = XtCalloc(strlen(fb_paths[i]+1),sizeof(char)); + strncpy (xim->imtoolrc, fb_paths[i],strlen(fb_paths[i])); + break; + } + } + if (!fp) { + fprintf (stderr, + "Warning: No frame buffer configuration file found.\n"); + return; + } + + + /* Scan the frame buffer configuration file. + */ + while (fgets (lbuf, SZ_LINE, fp) != NULL) { + /* Skip comment lines and blank lines. */ + for (ip=lbuf; *ip == ' ' || *ip == '\t'; ip++) + ; + if (*ip == '\n' || *ip == '#') + continue; + if (!isdigit (*ip)) + continue; + switch (sscanf (ip, "%d%d%d%d", &config,&nframes,&width,&height)) { + case 4: + break; /* normal case */ + case 3: + height = width; /* default to square format */ + break; + default: + fprintf (stderr, "ximtool: bad config `%s'\n", ip); + continue; + } + + nframes = max (1, nframes); + width = max (1, width); + height = max (1, height); + + /* Since the frame buffer is stored in a memory pixrect + * (effectively), the line length should be an integral number + * of 16 bit words. + */ + if (width & 1) { + fprintf (stderr, "imtool warning: fb config %d [%d-%dx%d] - ", + config, nframes, width, height); + fprintf (stderr, "frame width should be even, reset to %d\n", + --width); + } + + config = max(1, min(MAX_FBCONFIG, config)) - 1; + xim->fb_config[config].nframes = nframes; + xim->fb_config[config].width = width; + xim->fb_config[config].height = height; + } + + if (fp) fclose (fp); +} + + +/* XIM_GETANTIALIAS -- Convert a antialias algorithm expressed as a string + * into a Gterm rasterop code. + */ +xim_getAntialias (xim, s) +XimDataPtr xim; +char *s; +{ + register char *ip, *op; + char word[SZ_NAME]; + int rop = 0; + + for (ip=s; *ip && isspace(*ip); ip++) + ; + + while (*ip) { + for (op=word; *ip && isalnum(*ip); ip++) + *op++ = isupper(*ip) ? tolower(*ip) : *ip; + *op++ = '\0'; + + if (strcmp (word, "nearest") == 0) + rop |= MF_NEAREST; + else if (strcmp (word, "bilinear") == 0) + rop |= MF_BILINEAR; + else if (strcmp (word, "area") == 0) + rop |= MF_AREA; + else if (strcmp (word, "blkavg") == 0) + rop |= MF_BLKAVG; + else if (strcmp (word, "boxcar") == 0) + rop |= MF_BOXCAR; + else if (strcmp (word, "lowpass") == 0) + rop |= MF_LOWPASS; + else if (strcmp (word, "gaussian") == 0) + rop |= MF_GAUSSIAN; + + while (*ip && !isalnum(*ip)) + ip++; + } + + return (rop); +} + + +/* XIM_SETCOLORMAP -- Set up the RGB lookup tables used to map the windowed + * monochrome output of a frame buffer into the hardware colormap. + */ +xim_setColormap (function, dirs, m_red, m_green, m_blue, nelem) +char *function; /* type of colormap */ +String *dirs; +unsigned short *m_red; +unsigned short *m_green; +unsigned short *m_blue; +int nelem; +{ + register int i, j; + register char *ip, *op; + static int seed = 0; + int v, vsat, step; + int knot[7]; + float frac; + + + if (DBG_RASTER) + fprintf (stderr, + "xim_setColormap: name='%s' nelem=%d\n", function, nelem); + + vsat = MAX_COLORS - 1; + step = MAX_COLORS / 6; + for (i=0; i < 7; i++) + knot[i] = i * step; + knot[6] = vsat; + + if (dirs) { + /* Load the colormap from a file. */ + char fname[SZ_FNAME]; + char lbuf[SZ_LINE]; + TripletPtr p; + Lut user; + FILE *fp; + + /* Get full file pathname. If the same file is found in multiple + * directories the first version found is used. + */ + strcpy (fname, function); + for (i=0; function[0] != '/' && dirs[i]; i++) { + for (ip=dirs[i], op=fname; *ip; ) + *op++ = *ip++; + if (op > fname && *(op-1) != '/') + *op++ = '/'; + for (ip=function; *ip; ) + *op++ = *ip++; + *op = '\0'; + if (access (fname, 0) == 0) + break; + } + + /* Try to open the file. */ + if ((fp = fopen (fname, "r")) == NULL) { + fprintf (stderr, "cannot open %s\n", fname); + return (ERR); + } + + /* Scan the file. The user colormap may have any number of + * RGB pairs up to a maximum of MAX_COLORS (256). + */ + user.lutlen = 0; + while (fgets (lbuf, SZ_LINE, fp)) { + char *np, *next; + float v[3]; + + /* Ignore blank lines and comment lines. */ + for (ip=lbuf; isspace(*ip); ip++) + ; + if (*ip == '\0' || *ip == '#') + continue; + if (user.lutlen+1 >= MAX_COLORS) + break; + + /* Get an RGB entry. */ + p = &user.hue[user.lutlen++]; + for (i=0, np=ip; i < 3; i++, np=next) { + v[i] = strtod (np, &next); + if (next == np) { + fclose (fp); + return (ERR); + } + } + + p->red = v[0]; + p->green = v[1]; + p->blue = v[2]; + } + + fclose (fp); + if (user.lutlen <= 0) + return (ERR); + + /* Scale the user colormap to fit the NELEMS colors required + * for the output colormap. nelem and lutlen must be the same + * to disable scaling and preserve the exact colortable values. + */ + for (i=0; i < nelem; i++) { + float x, w1, w2; + float r, g, b; + + x = (float)i / (float)(nelem - 1) * (user.lutlen - 1); + j = max(0, min(user.lutlen-1, (int)x)); + w1 = 1.0 - (x - j); + w2 = 1.0 - w1; + + r = user.hue[j].red; + g = user.hue[j].green; + b = user.hue[j].blue; + + if (w2 > 0.0001 && j+1 < user.lutlen) { + r = r * w1 + user.hue[j+1].red * w2; + g = g * w1 + user.hue[j+1].green * w2; + b = b * w1 + user.hue[j+1].blue * w2; + } + + m_red[i] = r * vsat; + m_green[i] = g * vsat; + m_blue[i] = b * vsat; + } + + } else if (strncmp (function, "Grayscale", 9) == 0) { + for (i=0; i < nelem; i++) + m_red[i] = m_green[i] = m_blue[i] = + (float)i / (float)(nelem - 1) * vsat; + + } else if (strncmp (function, "HSV", 3) == 0) { + /* HSV: hue varies uniformly from 270 to 360 and back to 270. + * Value varies from zero to one using a cube root relation + * which causes the value to approach 1.0 rapidly away from zero. + * Saturation is zero near the endpoints, causing the curve + * to range from black to white at the endpoints, but ranges + * to 1.0 at the halfway point, causing nearly saturated colors + * in the middle of the range. + */ + for (i=0; i < nelem; i++) { + float h, s, v, r, g, b; + double pow(), sin(); + + frac = 1.0 - ((float)i / (float)(nelem - 1)); + h = frac * 360.0 + 270.0; + s = abs (sin (frac * 3.1416)); + v = pow ((1.0 - frac), (1.0 / 3.0)); + + hsv_to_rgb (h, s, v, &r, &g, &b); + m_red[i] = r * vsat; + m_green[i] = g * vsat; + m_blue[i] = b * vsat; + } + + } else if (strncmp (function, "Heat", 4) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = heat.hue[j].red * vsat; + m_green[i] = heat.hue[j].green * vsat; + m_blue[i] = heat.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Ramp", 4) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = heat.hue[j].red * (frac * (vsat * 2)); + m_green[i] = heat.hue[j].green * (frac * (vsat * 2)); + m_blue[i] = heat.hue[j].blue * (frac * (vsat * 2)); + } + + } else if (strncmp (function, "AIPS0", 5) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = aips0.hue[j].red * vsat; + m_green[i] = aips0.hue[j].green * vsat; + m_blue[i] = aips0.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Color", 5) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = color.hue[j].red * vsat; + m_green[i] = color.hue[j].green * vsat; + m_blue[i] = color.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Staircase", 9) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = staircase.hue[j].red * vsat; + m_green[i] = staircase.hue[j].green * vsat; + m_blue[i] = staircase.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Standard", 8) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = standard.hue[j].red * vsat; + m_green[i] = standard.hue[j].green * vsat; + m_blue[i] = standard.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Red", 3) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = red.hue[j].red * vsat; + m_green[i] = red.hue[j].green * vsat; + m_blue[i] = red.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Green", 5) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = green.hue[j].red * vsat; + m_green[i] = green.hue[j].green * vsat; + m_blue[i] = green.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Blue", 4) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = blue.hue[j].red * vsat; + m_green[i] = blue.hue[j].green * vsat; + m_blue[i] = blue.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Halley", 6) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = halley.hue[j].red * vsat; + m_green[i] = halley.hue[j].green * vsat; + m_blue[i] = halley.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Rainbow1", 8) == 0) { + for (i=0; i < nelem; i++) + m_red[i] = m_green[i] = m_blue[i] = 0; + + for (i=knot[0]; i <= knot[1]; i++) + m_blue[i] = vsat * (i - knot[0]) / step; + for (i=knot[1]; i <= knot[2]; i++) + m_blue[i] = vsat; + for (i=knot[2]; i <= knot[3]; i++) + m_blue[i] = vsat * (knot[3] - i) / step; + + for (i=knot[1]; i <= knot[2]; i++) + m_green[i] = vsat * (i - knot[1]) / step; + for (i=knot[2]; i <= knot[4]; i++) + m_green[i] = vsat; + for (i=knot[4]; i <= knot[5]; i++) + m_green[i] = vsat * (knot[5] - i) / step; + + for (i=knot[3]; i <= knot[4]; i++) + m_red[i] = vsat * (i - knot[3]) / step; + for (i=knot[4]; i <= knot[6]; i++) + m_red[i] = vsat; + + for (i=knot[5]; i <= knot[6]; i++) { + if ((v = vsat * (i - knot[5]) / step) > vsat) + v = vsat; + m_green[i] = m_blue[i] = v; + } + + } else if (strncmp (function, "Rainbow2", 8) == 0) { + for (i=0; i < nelem; i++) { + frac = (float)i / (float)(nelem - 1); + j = frac * (heat.lutlen - 1); + m_red[i] = rainbow.hue[j].red * vsat; + m_green[i] = rainbow.hue[j].green * vsat; + m_blue[i] = rainbow.hue[j].blue * vsat; + } + + } else if (strncmp (function, "Random16", 8) == 0) { + int red, green, blue; + + if (!seed) + seed = time(0); + srand (seed++); + + for (i=0; i < nelem; ) { + red = ((rand() >> 4) % vsat); + green = ((rand() >> 4) % vsat); + blue = ((rand() >> 4) % vsat); + + for (j=0; i < nelem && j < nelem/16; j++, i++) { + m_red[i] = red; + m_green[i] = green; + m_blue[i] = blue; + } + } + + } else if (strncmp (function, "Random8", 7) == 0) { + int red, green, blue; + + if (!seed) + seed = time(0); + srand (seed++); + + for (i=0; i < nelem; ) { + red = ((rand() >> 4) % vsat); + green = ((rand() >> 4) % vsat); + blue = ((rand() >> 4) % vsat); + + for (j=0; i < nelem && j < nelem/8; j++, i++) { + m_red[i] = red; + m_green[i] = green; + m_blue[i] = blue; + } + } + + } else if (strncmp (function, "Random", 6) == 0) { + if (!seed) + seed = time(0); + srand (seed++); + for (i=0; i < nelem; i++) { + m_red[i] = ((rand() >> 4) % vsat); + m_green[i] = ((rand() >> 4) % vsat); + m_blue[i] = ((rand() >> 4) % vsat); + } + } + + /* Scale colormap values to 16 bits. */ + for (i=0; i < nelem; i++) { + m_red[i] <<= 8; + m_green[i] <<= 8; + m_blue[i] <<= 8; + } + + return (OK); +} + + +hsv_to_rgb (h, s, v, r, g, b) +float h, s, v; +float *r, *g, *b; +{ + register int i; + float f, p, q, t; + + while (h >= 360.0) + h -= 360.0; + + h /= 60.0; + i = (int) h; + f = h - i; + p = v * (1 - s); + q = v * (1 - s*f); + t = v * (1 - s * (1.0 - f)); + + switch (i) { + case 0: + *r = v; *g = t; *b = p; + break; + case 1: + *r = q; *g = v; *b = p; + break; + case 2: + *r = p; *g = v; *b = t; + break; + case 3: + *r = p; *g = q; *b = v; + break; + case 4: + *r = t; *g = p; *b = v; + break; + case 5: + *r = v; *g = p; *b = q; + break; + } +} + + +/* GET_DIRFILE -- Get the next file name from an open directory file. + */ +static int +get_dirfile (dir, outstr, maxch) +DIR *dir; +char *outstr; +int maxch; +{ + register int n; + register struct dirent *dp; + register char *ip, *op; + int status; + + for (dp = readdir(dir); dp != NULL; dp = readdir(dir)) + if (dp->d_ino != 0) { + n = strlen (dp->d_name); + status = n; + for (ip=dp->d_name, op=outstr; --n >= 0; ) + *op++ = *ip++; + *op = EOS; + return (status); + } + + return (EOF); +} + + +/* LOAD_TESTPATTERN -- Load a test pattern into the given frame. + */ +static void +load_testpattern (xim, frame, type) +XimDataPtr xim; +int frame; +int type; /* not used */ +{ + register FrameBufPtr fb = &xim->frames[frame]; + register int i, j, ncolors; + int rtype, width, height, depth; + unsigned char *data; + + if (GtQueryRaster (xim->gt, fb->raster, + &rtype, &width, &height, &depth) == 0) + return; + + data = (unsigned char *) XtMalloc (width); + if (data == (unsigned char *)NULL) + return; + + ncolors = xim->ncolors; + for (j=0; j < height; j++) { + for (i=0; i < width; i++) + data[i] = (((i + j) * 10) % ncolors); + GtWritePixels (xim->gt, fb->raster, data, 8, 0, j, width, 1); + } + + XtFree ((char *)data); +} + + +/* SET_COLORBAR -- Write the colorbar pixels. + */ +static void +set_colorbar (xim, w) +XimDataPtr xim; +Widget w; +{ + register int i; + static int initialized = 0; + int first, ngray, rgb_len, rtype, width, height, depth; + unsigned short m_red[MAX_COLORS]; + unsigned short m_green[MAX_COLORS]; + unsigned short m_blue[MAX_COLORS]; + unsigned char *data; + + + if (!w) + return; + + if (DBG_RASTER) + fprintf (stderr, "SETTING COLORBAR PIXELS...... init = %d\n", + initialized); + + if (GtQueryRaster (w, 0, &rtype, &width, &height, &depth) == 0) + return; + + data = (unsigned char *) XtMalloc (width * height); + for (i=0; i < width; i++) + data[i] = ((float)i / (float)(width - 1) * (xim->ncolors - 1)); + + for (i=1; i < height; i++) + memmove (data + i * width, data, width); + + if (!initialized) { + xim_iiscolormap (w, m_red,m_green,m_blue, &first, &ngray, &rgb_len); + GtWriteColormap (w, 0, first, rgb_len, m_red, m_green, m_blue); + + xim_setColormap ("Grayscale", NULL, m_red, m_green, m_blue, ngray); + GtWriteColormap (w, 0, first, ngray, m_red, m_green, m_blue); + + xim->ncolors = ngray; + initialized++; + } + + GtWritePixels (w, 0, data, 8, 0, 0, width, height); + XtFree ((char *)data); + + if (DBG_RASTER) + fprintf (stderr, "SETTING COLORBAR PIXELS...... DONE\n"); +} + + +/* SET_NFRAMES -- Called when the number of frame buffers changes. + */ +static void +set_nframes (xim, nframes) +XimDataPtr xim; +int nframes; +{ + xim->nframes = nframes; + xim_msgi (xim, "nframes", nframes); +} diff --git a/vendor/x11iraf/ximtool/save.c b/vendor/x11iraf/ximtool/save.c new file mode 100644 index 00000000..51d5b7c4 --- /dev/null +++ b/vendor/x11iraf/ximtool/save.c @@ -0,0 +1,377 @@ +#include <stdio.h> +#include <unistd.h> +#include <sys/stat.h> +#include <errno.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> + +#include "ximtool.h" + +/* + * SAVE.C -- Routines for saving image rasters to disk files. + * + * xim_initSave (xim) + * xim_saveClose (xim) + * + * status = xim_saveFile (xim, fname, format, x0,y0, nx,ny) + * + * xims_rename (xim, old, new) # save alert action + * xims_cancel (xim, fname) # save alert action + * + * xim_saveFile saves the current display frame to the named file using + * the format specified. If nx or ny is zero the entire frame is saved, + * otherwise the indicated region is saved. + */ + +static int xims_write(); +static void savestat(), savetext(); + + +/* XIM_INITSAVE -- Initialize the file save structure. + */ +void +xim_initSave (xim) +register XimDataPtr xim; +{ + register fileSavePtr fsp; + extern char *getcwd(), *getenv(); + char buf[SZ_LINE]; + + if (!(xim->fsp = fsp = (fileSavePtr) calloc (1, sizeof (fileSave)))) + return; + + fsp->seqno = 0; + fsp->format = XIM_RAS; + fsp->colorType = XIM_PSEUDOCOLOR; + strcpy (fsp->fname, "frame%d.ras"); + + /* Now update the GUI. */ + sprintf (buf, "format ras"); + xim_message (xim, "saveOptions", buf); + sprintf (buf, "color pseudocolor"); + xim_message (xim, "saveOptions", buf); + sprintf (buf, "fname frame%%d.ras"); + xim_message (xim, "saveOptions", buf); +} + + +/* XIM_SAVECLOSE -- Close the save structure. + */ +void +xim_saveClose (xim) +register XimDataPtr xim; +{ + register fileSavePtr fsp = xim->fsp; + + if (fsp) + free ((char *) fsp); +} + + +/* XIM_SAVEFILE - Save the current display frame to a disk file. If nx or + * ny is zero the entire frame is saved, otherwise the given region is saved. + */ +int +xim_saveFile (xim, template, fileformat, x0,y0, nx,ny) +register XimDataPtr xim; +char *template; /* file name or printf format */ +int fileformat; /* output raster file format/type */ +int x0, y0, nx, ny; /* region of display to be saved */ +{ + register int i, j; + register fileSavePtr fsp = xim->fsp; + int w, h, ncols; + char text[SZ_LINE], fname[SZ_FNAME]; + unsigned char r[256], g[256], b[256]; + unsigned char *pixels = NULL; + int status = -1; + static int debug=0; + extern int errno; + FILE *fp; + char *mktemp(); + + /* Generate output file name. */ + sprintf (fname, template, fsp->seqno++); + + /* Get the display pixels and colormap. The routine allocates a + * pointer to the pixels we'll need to free when we're done. + */ + pixels = xim_readDisplay (xim, x0,y0,nx,ny, &w,&h, r,g,b, &ncols); + if (!pixels) + goto done; + + if (debug) { + register int cpix, val; + fprintf (stderr, "saveFile: %s -> %dx%d at %d colors\n", + fname, w, h, ncols); + cpix = (w/2+(h/2)*w); + val = pixels[cpix]; + fprintf (stderr, "Center pixel %d: val=%d (%d,%d,%d)\n",cpix, + val,r[val],g[val],b[val]); + fprintf (stderr, "User Colormap\n"); + for (i=0; i < 256; ) { + for (j=1; j < 4 && i < 256; j++) + fprintf (stderr, " %3d(%3d,%3d,%3d)",i,r[i],g[i],b[i++]); + fprintf (stderr, "\n"); + } + } + + fsp->w = w; + fsp->h = h; + fsp->d = 8; + + if (access (fname, F_OK) < 0) { + if (fp = fopen (fname, "w")) { + struct stat fs; + + xims_write (xim, fp, fileformat, pixels, w,h,8, r,g,b, 256); + fclose (fp); + stat (fname, &fs); + + savetext (xim, fsp->seqno, fname, fileformat, (int)fs.st_size, + w, h, 8); + sprintf (text, "Wrote %d bytes to %s", (int)fs.st_size, fname); + savestat (xim, text); + + } else { + sprintf (text, "Error %d\nCannot open file %s", errno, fname); + xim_alert (xim, text, NULL, NULL); + fsp->seqno--; + } + + } else { + /* Named file already exists. Write a temporary file and + * post an alert to ask the user if they want to overwrite + * the existing file. + */ + char ok_action[SZ_LINE]; + char cancel_action[SZ_LINE]; + char tmpfile[SZ_FNAME]; + char *ip, *op, *last; + + /* Write to a temporary file in the same directory as fname. */ + for (ip=fname, op=tmpfile, last=tmpfile; *op = *ip++; op++) + if (*op == '/') + last = op + 1; + *last = '\0'; + strcat (tmpfile, "ximsXXXXXX"); + if (mktemp(tmpfile) == (char *)NULL) + goto done; + + if (!(fp = fopen (tmpfile, "w"))) { + sprintf (text, "Cannot open temporary file:\n%s", tmpfile); + xim_alert (xim, text, NULL, NULL); + goto done; + } + xims_write (xim, fp, fileformat, pixels, w,h,8, r,g,b, 256); + fclose (fp); + + sprintf (text, "%s\n%s\n%s", + "The following file already exists:", fname, + "Do you want to overwrite this file?"); + + sprintf (ok_action, "save rename %s %s", tmpfile, fname); + sprintf (cancel_action, "save cancel %s", tmpfile); + + xim_alert (xim, text, ok_action, cancel_action); + } + + status = 0; +done: + if (pixels) + free ((char *) pixels); + return (status); +} + + +/* XIMS_WRITE -- Write a file in the indicated format. + */ +static int +xims_write (xim, fp, fileformat, pixels, w,h,d, r,g,b, ncolors) +register XimDataPtr xim; +FILE *fp; +int fileformat; +unsigned char *pixels; +int w, h, d; +unsigned char *r, *g, *b; +int ncolors; +{ + register fileSavePtr fsp = xim->fsp; + register PSImagePtr psim = xim->psim; + register FrameBufPtr fb = xim->df_p; + register ColorMapPtr cm = &colormaps[fb->colormap-1]; + register int sv_annotate = psim->annotate; + register int sv_colorClass = psim->colorClass; + int gray=0, status=0; + + + switch (fileformat) { + case XIM_RAS: + /* Write Sun Rasterfile. We don't support 24-bit yet but can + * add it later. + */ + savestat (xim, "Generating Sun rasterfile..."); + if (xim->fsp->colorType == XIM_GRAYSCALE) + status = writeSunRas (fp, pixels, 8, w,h, r,g,b, ncolors, 1); + else + status = writeSunRas (fp, pixels, 8, w,h, r,g,b, ncolors, 2); + + break; + + case XIM_FITS: + /* Write a simple FITS file. + */ + savestat (xim, "Generating FITS file..."); + status = writeFITS (fp, pixels, w, h, r, g, b, ncolors); + break; + + case XIM_GIF: + /* Write a GIF file. + */ + savestat (xim, "Generating GIF file..."); + gray = (xim->fsp->colorType == XIM_GRAYSCALE); + status = writeGIF (fp, pixels, w, h, r, g, b, ncolors, gray); + break; + + case XIM_TIFF: + /* Write a TIFF file. + */ + savestat (xim, "Generating TIFF file..."); + gray = (xim->fsp->colorType == XIM_GRAYSCALE); + status = writeTIFF (fp, pixels, w, h, ncolors, gray, r, g, b); + break; + + case XIM_EPS: + /* Write an EPS file. + */ + savestat (xim, "Generating postscript output..."); + + /* Temporarily reset the values. */ + psim->annotate = 0; + psim->colorClass = xim->fsp->colorType; + + /* Set up some of the EPS options print to the file. */ + eps_setCmap (psim, r, g, b, ncolors); + eps_setTransform (psim, fb->ctran.z1, fb->ctran.z2, fb->ctran.zt, + fb->offset, fb->scale, cm->name); + eps_print (psim, fp, pixels, w, h, 8, 0); + + /* Restore the saved values. */ + psim->annotate = sv_annotate; + psim->colorClass = sv_colorClass; + break; + + case XIM_JPEG: + case XIM_X11: + case XIM_RAW: + default: + /* We don't know what this is so give up and notify the GUI. */ + savestat (xim, "Save file format not implemented."); + status = -1; + break; + } + + return (status); +} + + +/* The following implement the ok and cancel actions posted by the alert in + * xim_save above. + */ +void +xims_rename (xim, old, new) +register XimDataPtr xim; +char *old, *new; +{ + register fileSavePtr fsp = xim->fsp; + char text[SZ_LINE]; + struct stat fs; + + unlink (new); + if (rename(old,new) != 0 || stat(new,&fs) != 0) { + sprintf (text, "Could not write file %s", new); + savestat (xim, text); + } else { + stat (new, &fs); + savetext (xim, fsp->seqno, new, fsp->format, (int)fs.st_size, + fsp->w, fsp->h, fsp->d); + sprintf (text, "Wrote %d bytes to %s", (int)fs.st_size, new); + savestat (xim, text); + } +} + +void +xims_cancel (xim, fname) +register XimDataPtr xim; +char *fname; +{ + savestat (xim, "Save cancelled."); + unlink (fname); +} + + +/* SAVESTAT -- Internal routine for save status messages. + */ +static void +savestat (xim, message) +register XimDataPtr xim; +char *message; +{ + char text[SZ_LINE]; + sprintf (text, "status {%s}", message); + xim_message (xim, "saveOptions", text); +} + + +/* SAVETEXT -- Write something useful the text box in the save panel. + */ +static void +savetext (xim, seqno, fullname, fileformat, filesize, w,h,d) +register XimDataPtr xim; +int seqno; +char *fullname; +int fileformat; +int filesize; +int w, h, d; +{ + register char *ip; + char *fmt, *fname, text[SZ_LINE]; + + for (ip=fname=fullname; *ip; ip++) + if (*ip == '/') + fname = ip + 1; + + switch (fileformat) { + case XIM_RAS: + fmt = "Sun rasterfile"; + break; + case XIM_GIF: + fmt = "GIF file"; + break; + case XIM_TIFF: + fmt = "TIFF file"; + break; + case XIM_JPEG: + fmt = "JPEG file"; + break; + case XIM_X11: + fmt = "X11 window dump"; + break; + case XIM_FITS: + fmt = "FITS file"; + break; + case XIM_RAW: + fmt = "Raw bytes"; + break; + case XIM_EPS: + fmt = "EPS file"; + break; + default: + fmt = "unknown format"; + break; + } + + sprintf (text, "text {-- Frame %d --\n%s\n%s\n%d bytes\n%dx%dx%d}", + seqno-1, fname, fmt, filesize, w, h, d); + xim_message (xim, "saveOptions", text); +} diff --git a/vendor/x11iraf/ximtool/tiffio.c b/vendor/x11iraf/ximtool/tiffio.c new file mode 100644 index 00000000..1f258338 --- /dev/null +++ b/vendor/x11iraf/ximtool/tiffio.c @@ -0,0 +1,197 @@ +/* + * TIFFIO.C -- Routines to save a simple TIFF 6.0 format file. Loading is + * not supported due to the complexity of the format. + * + * writeTIFF (fa, data, w, h, ncolors, gray, r, g, b) + */ + +#include <stdio.h> +#ifdef ULTRIX +#include <sys/types.h> +#endif +#include <unistd.h> + + +/* TIFF Tag description + */ +typedef struct { + short tag; + short type; + int count; + int offset; +} TiffTag; + +typedef struct { + unsigned short red[256]; + unsigned short green[256]; + unsigned short blue[256]; +} Colors; + +static char *h_order = "MM\0*"; +static char *l_order = "II*\0"; + +/* Tag Definitions */ +#define IMAGEWIDTH 256 +#define IMAGELENGTH 257 +#define BITSPERSAMPLE 258 +#define COMPRESSION 259 +#define PHOTOMETRIC 262 +#define STRIPOFFSETS 273 +#define ROWSPERSTRIP 278 +#define STRIPBYTECOUNT 279 +#define XRESOLUTION 282 +#define YRESOLUTION 283 +#define RESOLUTIONUNIT 296 +#define COLORMAP 320 + +#define MAXCOLORS 256 + +/* MONO returns total intensity of r,g,b components */ +#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ + + + +/* writeTIFF -- Write a TIFF 6.0 image. +*/ + +writeTIFF (fa, data, w, h, ncolors, gray, r, g, b) +FILE *fa; /* output file descriptor */ +unsigned char *data; /* pixel data */ +int w, h; /* image dimensions */ +int ncolors; /* number of colors */ +int gray; /* grayscale? */ +unsigned char *r, *g, *b; /* colormap */ +{ + int i,size,offset; + short dirs = 12; + TiffTag *tt; + unsigned char *dta, r1, b1, g1; + unsigned short *rr, *gg, *bb; + int bitspersample=8, compression=1, photo=3, resolution=2; + int width = w, height = h; + + tt = (TiffTag *) calloc (dirs, sizeof(TiffTag)); + size = w * h; + dta = (unsigned char *) calloc (size+(size%4), sizeof(unsigned char)); + rr = (unsigned short *) calloc (MAXCOLORS, sizeof(unsigned short)); + gg = (unsigned short *) calloc (MAXCOLORS, sizeof(unsigned short)); + bb = (unsigned short *) calloc (MAXCOLORS, sizeof(unsigned short)); + memcpy(dta, data, size * sizeof(unsigned char)); + + if (is_swapped()) { + fwrite (l_order, 4, 1, fa); + } else { + fwrite (h_order, 4, 1, fa); + width = w << 16; + height = h << 16; + bitspersample <<= 16; + compression <<= 16; + photo <<= 16; + resolution <<= 16; + } + + offset = 8; + fwrite (&offset, 4, 1, fa); + fwrite (&dirs, 2, 1, fa); /* number of IFD's */ + + /* Create TIFF IFD's. + */ + create_TIFFtag (tt+0, IMAGEWIDTH, 3, 1, (width)); + create_TIFFtag (tt+1, IMAGELENGTH, 3, 1, (height)); + create_TIFFtag (tt+2, BITSPERSAMPLE, 3, 1, (bitspersample)); + create_TIFFtag (tt+3, COMPRESSION, 3, 1, (compression)); + create_TIFFtag (tt+4, PHOTOMETRIC, 3, 1, (photo)); + create_TIFFtag (tt+5, STRIPOFFSETS, 4, 1, 10+(dirs*12)+4); + create_TIFFtag (tt+6, ROWSPERSTRIP, 3, 1, (width)); + create_TIFFtag (tt+7, STRIPBYTECOUNT, 4, 1, size); + create_TIFFtag (tt+8, XRESOLUTION, 5, 1, + (tt+5)->offset+(2*768)+(size+(size%4))); + create_TIFFtag (tt+9, YRESOLUTION, 5, 1, + (tt+5)->offset+(2*768)+(size+(size%4))+8); + create_TIFFtag (tt+10, RESOLUTIONUNIT, 3, 1, (resolution)); + create_TIFFtag (tt+11, COLORMAP, 3, 768, + (tt+5)->offset+(size+(size%4))); + + /* Write header info and tags. + */ + for (i = 0 ; i < dirs ; i++) { + fwrite ((tt+i), 12, 1, fa); + } + + /* Write a 4-byte NULL -- this tells the TIFF reader that there + * are no more IFD's. + */ + i = 0; + fwrite (&i, 4, 1, fa); + + /* Write data. + */ + fwrite (dta, size+(size%4), 1, fa); + + /* Create unsigned short colormap. + */ + for (i = 0 ; i < ncolors ; i++) { + if (gray) { + r1 = (unsigned char) MONO (*(r+i),*(g+i),*(b+i)); + g1 = (unsigned char) MONO (*(r+i),*(g+i),*(b+i)); + b1 = (unsigned char) MONO (*(r+i),*(g+i),*(b+i)); + *(r+i) = r1; + *(g+i) = g1; + *(b+i) = b1; + } + *(rr+i) = (unsigned short) *(r+i) | ((unsigned short) *(r+i) << 8); + *(gg+i) = (unsigned short) *(g+i) | ((unsigned short) *(g+i) << 8); + *(bb+i) = (unsigned short) *(b+i) | ((unsigned short) *(b+i) << 8); + } + + /* Fill in the rest of the colortable with 0xffff's. + */ + for (i = ncolors ; i < MAXCOLORS ; i++) { + *(rr+i) = (unsigned short) 0xffff; + *(gg+i) = (unsigned short) 0xffff; + *(bb+i) = (unsigned short) 0xffff; + } + + /* Write out colormap. + */ + fwrite (rr, MAXCOLORS*sizeof(unsigned short), 1, fa); + fwrite (gg, MAXCOLORS*sizeof(unsigned short), 1, fa); + fwrite (bb, MAXCOLORS*sizeof(unsigned short), 1, fa); + + /* Write the XResolution. + */ + i = 1; + fwrite (&i, sizeof(int), 1, fa); + fwrite (&i, sizeof(int), 1, fa); + + /* Write the YResolution. + */ + i = 1; + fwrite (&i, sizeof(int), 1, fa); + fwrite (&i, sizeof(int), 1, fa); + + /* Free memory. + */ + free (tt); + free (dta); + free (rr); + free (gg); + free (bb); +} + + +/* create_TIFFtag - Create a TIFF IFD (Image File Directory). +*/ + +create_TIFFtag (tag, desig, type, count, offset) +TiffTag *tag; /* tag to create */ +short desig; /* tag definition */ +short type; /* scalar type of data items */ +int count; /* no. of items in tag data */ +int offset; /* byte offset to data items */ +{ + tag->tag = desig; + tag->type = type; + tag->count = count; + tag->offset = offset; +} diff --git a/vendor/x11iraf/ximtool/util.c b/vendor/x11iraf/ximtool/util.c new file mode 100644 index 00000000..2ac6331b --- /dev/null +++ b/vendor/x11iraf/ximtool/util.c @@ -0,0 +1,251 @@ +/* + * UTIL.C -- Utility routines for the package. + * + * bswap2 (a, b, nbytes) + * bswap4 (a, aoff, b, boff, nbytes) + * bswap8 (a, aoff, b, boff, nbytes) + * flip (buffer, nx, ny) + * is_swapped () + * min_max (a, npts, bitpix, min, max) + * strpak (in, out, len) + * + * + */ + + +#include <stdio.h> +#ifdef ULTRIX +#include <sys/types.h> +#endif +#include <unistd.h> + +#ifndef AIXV3 +#ifndef OSF1 +typedef unsigned char uchar; +#endif +#endif + + + +/* BSWAP2 - Move bytes from array "a" to array "b", swapping successive + * pairs of bytes. The two arrays may be the same but may not be offset + * and overlapping. + */ +bswap2 (a, b, nbytes) +char *a, *b; /* input array */ +int nbytes; /* number of bytes to swap */ +{ + register char *ip=a, *op=b, *otop; + register unsigned temp; + + /* Swap successive pairs of bytes. + */ + for (otop = op + (nbytes & ~1); op < otop; ) { + temp = *ip++; + *op++ = *ip++; + *op++ = temp; + } + + /* If there is an odd byte left, move it to the output array. + */ + if (nbytes & 1) + *op = *ip; +} + + +/* BSWAP4 - Move bytes from array "a" to array "b", swapping the four bytes + * in each successive 4 byte group, i.e., 12345678 becomes 43218765. + * The input and output arrays may be the same but may not partially overlap. + */ +bswap4 (a, aoff, b, boff, nbytes) +char *a; /* input array */ +int aoff; /* first byte in input array */ +char *b; /* output array */ +int boff; /* first byte in output array */ +int nbytes; /* number of bytes to swap */ +{ + register char *ip, *op, *tp; + register int n; + static char temp[4]; + + tp = temp; + ip = (char *)a + aoff - 1; + op = (char *)b + boff - 1; + + /* Swap successive four byte groups. + */ + for (n = nbytes >> 2; --n >= 0; ) { + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + } + + /* If there are any odd bytes left, move them to the output array. + * Do not bother to swap as it is unclear how to swap a partial + * group, and really incorrect if the data is not modulus 4. + */ + for (n = nbytes & 03; --n >= 0; ) + *op++ = *ip++; +} + + +/* BSWAP8 - Move bytes from array "a" to array "b", swapping the eight bytes + * in each successive 8 byte group, i.e., 12345678 becomes 87654321. + * The input and output arrays may be the same but may not partially overlap. + */ +bswap8 (a, aoff, b, boff, nbytes) +char *a; /* input array */ +int aoff; /* first byte in input array */ +char *b; /* output array */ +int boff; /* first byte in output array */ +int nbytes; /* number of bytes to swap */ +{ + register char *ip, *op, *tp; + register int n; + static char temp[8]; + + tp = temp; + ip = (char *)a + aoff - 1; + op = (char *)b + boff - 1; + + /* Swap successive eight byte groups. + */ + for (n = nbytes >> 3; --n >= 0; ) { + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *tp++ = *ip++; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + *op++ = *--tp; + } + + /* If there are any odd bytes left, move them to the output array. + * Do not bother to swap as it is unclear how to swap a partial + * group, and really incorrect if the data is not modulus 8. + */ + for (n = nbytes & 03; --n >= 0; ) + *op++ = *ip++; +} + + +/* IS_SWAPPED -- See if this is a byte-swapped (relative to Sun) machine. + */ + +is_swapped () +{ + union { + char ch[4]; + int i; + } u; + + u.i = 1; + return ((int) u.ch[0]); +} + + +/* MIN_MAX -- Get the min and max values of an array. + */ + +min_max (a, npts, bitpix, min, max) +char *a; +int npts; +int bitpix; +float *min, *max; +{ + register int i; + + *min = 32768.0, *max = -32768.0; + + if (bitpix == 8) { + char *buf = (char *)a; + for (i=0; i < npts; i++) { + if (buf[i] < *min) *min = buf[i]; + if (buf[i] > *max) *max = buf[i]; + } + } else if (bitpix == 16) { + short *buf = (short *)a; + for (i=0; i < npts; i++) { + if (buf[i] < *min) *min = buf[i]; + if (buf[i] > *max) *max = buf[i]; + } + } else if (bitpix == 32) { + int *buf = (int *)a; + for (i=0; i < npts; i++) { + if (buf[i] < *min) *min = buf[i]; + if (buf[i] > *max) *max = buf[i]; + } + } else if (bitpix == -32) { + float *buf = (float *)a; + for (i=0; i < npts; i++) { + if (buf[i] < *min) *min = buf[i]; + if (buf[i] > *max) *max = buf[i]; + } + } else if (bitpix == -64) { + double *buf = (double *)a; + for (i=0; i < npts; i++) { + if (buf[i] < *min) *min = buf[i]; + if (buf[i] > *max) *max = buf[i]; + } + } +} + + +/* STRPAK -- Convert ASCII string from SPP char per short to C char per byte + */ + +strpak (in, out, len) +char *in, *out; +int len; +{ + int i, j; + + /* adaptive byte selection (whichever byte order) chars alternate + * with \0 + */ + if ( in[0] == '\0' ) + j = 1; + else + j = 0; + for ( i = 0; i < len; i++, j += 2 ) + out[i] = in[j]; + out[i] = '\0'; +} + + +/* FLIP -- Reverse order of lines in image. We do this as a separate step + * rather than when reading so the sampling grid for zscale is the same as + * for DISPLAY, even though the pixels are stored "flipped" in the pixfile. + */ +flip (buffer, nx, ny) +uchar *buffer; +int nx, ny; +{ + int i; + register int j, v; + register uchar *buff1, *buff2; + + for (i = 0; i < ny / 2; i++) { + buff1 = &buffer[i*nx]; + buff2 = &buffer[(ny-1-i)*nx]; + for (j = 0; j < nx; j++) { + v = *buff1; + *(buff1++) = *buff2; + *(buff2++) = v; + } + } +} diff --git a/vendor/x11iraf/ximtool/ximclient.c b/vendor/x11iraf/ximtool/ximclient.c new file mode 100644 index 00000000..2d67f25d --- /dev/null +++ b/vendor/x11iraf/ximtool/ximclient.c @@ -0,0 +1,2576 @@ +#include <stdio.h> +#include <ctype.h> +#include <math.h> +#include <sys/stat.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <Tcl/tcl.h> +#include <Obm.h> +#include <ObmW/Gterm.h> +#include "ximtool.h" + +/* + * XIMCLIENT.C -- The Ximtool "client" object. This code implements an OBM + * client and responds to messages sent to the client object by the GUI code + * executing under the object manager. + * + * xim_clientOpen (xim) + * xim_clientClose (xim) + * xim_clientExecute (xim, objname, key, cmd) + * + * The clientExecute callback is called by the GUI code in the object manager + * to execute ximtool client commands. + * + * Client commands: + * + * setFrame frameno + * frameno = getFrame [raster] + * raster = getRaster [frameno] + * frame = getSource [raster [sx sy snx sny]] + * nextFrame + * prevFrame + * matchFrames [frames [reference_frame]] + * registerFrames [frames [reference_frame]] + * offfsetRegister [frames [reference_frame]] + * fitFrame + * clearFrame [frame] + * + * setOption option value [args] + * setColormap colormap + * setOffset xoff yoff + * windowColormap offset scale + * windowRGB color offset scale save_flag + * zoom [mag | xmag ymag [ xcen ycen ]] + * zoomAbs [mag | xmag ymag [ xcen ycen ]] + * center = centroid xcen ycen size [type] + * pix = getPixels x0 y0 nx ny [format] + * pan xcen ycen + * flip axis [axis ...] + * + * setPrintOption option value [args] + * print [x0 y0 nx ny] + * setSaveOption option value [args] + * save [x0 y0 nx ny] + * setLoadOption option value [args] + * load + * help + * info option + * + * wcsstr = encodewcs sx sy sz + * retCursorVal sx sy [frame [wcs [key [strval]]]] + * + * ism_start task + * ism_stop task + * ism_cmd task [args] + * + * initialize + * Reset + * Quit + */ + + +/* Client callback struct. */ +typedef struct { + XimDataPtr xim; + Tcl_Interp *tcl; + Tcl_Interp *server; +} XimClient, *XimClientPtr; + + + +static int initialize(), Reset(), Quit(); +static int setColormap(), updateColormap(), windowColormap(); +static int zoom(), pan(), getSource(); +static int setFrame(), getFrame(), getRaster(), nextFrame(), prevFrame(); +static int fitFrame(), matchFrames(), registerFrames(), retCursorVal(); +static int encodewcs(), flip(), clearFrame(), setOption(), setOffset(); +static int setPrintOption(), setSaveOption(), setLoadOption(); +static int print(), save(), load(), help(), windowRGB(); +static int centroid(), getPixels(); +static int ism_start(), ism_stop(), ism_cmd(); + +extern int ism_evaluate(), info(); +extern IsmModule ismNameToPtr(); +extern double atof(); + + +/* xim_clientOpen -- Initialize the ximtool client code. + */ +void +xim_clientOpen (xim) +XimDataPtr xim; +{ + register XimClientPtr xc; + register Tcl_Interp *tcl; + + xc = (XimClientPtr) XtCalloc (1, sizeof(XimClient)); + xim->clientPrivate = (int *)xc; + + xc->xim = xim; + xc->tcl = tcl = Tcl_CreateInterp(); + ObmAddCallback (xim->obm, OBMCB_clientOutput|OBMCB_preserve, + xim_clientExecute, (XtPointer)xc); + + Tcl_CreateCommand (tcl, + "Quit", Quit, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "Reset", Reset, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "initialize", initialize, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "setFrame", setFrame, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "getFrame", getFrame, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "getRaster", getRaster, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "getSource", getSource, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "nextFrame", nextFrame, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "prevFrame", prevFrame, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "fitFrame", fitFrame, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "matchFrames", matchFrames, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "registerFrames", registerFrames, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "offsetRegister", registerFrames, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "clearFrame", clearFrame, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "setOption", setOption, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "setColormap", setColormap, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "setOffset", setOffset, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "windowColormap", windowColormap, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "updateColormap", updateColormap, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "zoom", zoom, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "zoomAbs", zoom, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "centroid", centroid, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "getPixels", getPixels, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "pan", pan, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "flip", flip, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "retCursorVal", retCursorVal, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "encodewcs", encodewcs, (ClientData)xc, NULL); + + Tcl_CreateCommand (tcl, + "setPrintOption", setPrintOption, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "print", print, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "setSaveOption", setSaveOption, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "save", save, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "setLoadOption", setLoadOption, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "load", load, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "help", help, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "info", info, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "windowRGB", windowRGB, (ClientData)xc, NULL); + + /* ISM module callbacks. */ + Tcl_CreateCommand (tcl, + "ism_start", ism_start, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "ism_stop", ism_stop, (ClientData)xc, NULL); + Tcl_CreateCommand (tcl, + "ism_cmd", ism_cmd, (ClientData)xc, NULL); +} + + +/* xim_clientClose -- Shutdown the ximtool client code. + */ +void +xim_clientClose (xim) +XimDataPtr xim; +{ + register XimClientPtr xc = (XimClientPtr) xim->clientPrivate; + Tcl_DeleteInterp (xc->tcl); +} + + +/* xim_clientExecute -- Called by the GUI code to send a message to the + * "client", which from the object manager's point of view is ximtool itself. + */ +xim_clientExecute (xc, tcl, objname, key, command) +register XimClientPtr xc; +Tcl_Interp *tcl; /* caller's Tcl */ +char *objname; /* object name */ +int key; /* notused */ +char *command; +{ + register XimDataPtr xim = xc->xim; + + xc->server = tcl; + if (strcmp (objname, "client") == 0) + Tcl_Eval (xc->tcl, command); + else + ism_evaluate (xim, objname, command); + + return (0); +} + + +/* + * XIMTOOL CLIENT commands. + * ---------------------------- + */ + +/* Quit -- Exit ximtool. + * + * Usage: Quit + */ +static int +Quit (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + xim_shutdown (xim); +} + + +/* Reset -- Reset ximtool. + * + * Usage: Reset + * + * Reset does a full power-on reset of ximtool. + */ +static int +Reset (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + xim_initialize (xim, xim->fb_configno, xim->nframes, 1); +} + + +/* initialize -- Reinitialize ximtool. + * + * Usage: initialize + * + * Initialize does a partial reinitialization of ximtool, preserving the + * current frame buffers and view. + */ +static int +initialize (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + xim_initialize (xim, xim->fb_configno, xim->nframes, 0); +} + + +/* setFrame -- Set the frame to be displayed. + * + * Usage: setFrame <frameno> + */ +static int +setFrame (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + if (argc == 2) + xim_setFrame (xc->xim, atoi(argv[1])); + return (TCL_OK); +} + + +/* getFrame -- Get the frame number. + * + * Usage: frameno = getFrame [raster] + * + * This routine has two forms. When called with no argument getFrame returns + * the current display frame. When called with a raster number getFrame + * returns the frame number with which the raster is associated. + */ +static int +getFrame (xc, tcl, argc, argv) +XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb; + char frameno[SZ_NAME]; + register int i; + int raster; + + if (argc == 1) + sprintf (frameno, "%d", xc->xim->display_frame); + else { + raster = atoi (argv[1]); + strcpy (frameno, "0"); + + for (i=1; i <= xim->nframes; i++) { + fb = &xim->frames[i-1]; + if (fb->raster == raster || fb->zoomras == raster) { + sprintf (frameno, "%d", fb->frameno); + break; + } + } + } + + Tcl_SetResult (xc->server, frameno, TCL_VOLATILE); + return (TCL_OK); +} + + +/* getRaster -- Get the image raster number of the given frame. + * + * Usage: raster = getRaster [frameno] + * + * This routine has two forms. When called with no argument getRaster returns + * the raster number of the current display frame. When called with a frame + * number getRaster returns the raster number of the given frame. + */ +static int +getRaster (xc, tcl, argc, argv) +XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb; + char buf[SZ_NAME]; + register int i; + int frameno; + + if (argc == 1) + sprintf (buf, "%d", xim->df_p->raster); + else { + frameno = atoi (argv[1]); + strcpy (buf, "0"); + + for (i=1; i < xim->nframes; i++) { + fb = &xim->frames[i-1]; + if (fb->frameno == frameno) { + sprintf (buf, "%d", fb->raster); + break; + } + } + } + + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + return (TCL_OK); +} + + +/* getSource -- Get the source of the currently displayed image. + * + * Usage: frame = getSource [raster [sx sy snx sny]] + * + * getSource returns the frame number of the currently displayed frame as + * the function value, and the raster number and source rect within that + * raster are returned as function arguments. + */ +static int +getSource (xc, tcl, argc, argv) +XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register int i; + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + int src, st, sx, sy, snx, sny; + int dst, dt, dx, dy, dnx, dny; + char buf[SZ_NAME]; + int frameno, rop; + + GtGetMapping (xim->gt, fb->zoommap, &rop, + &src,&st,&sx,&sy,&snx,&sny, &dst,&dt,&dx,&dy,&dnx,&dny); + + if (argc > 1) { + sprintf (buf, "%d", fb->raster); + Tcl_SetVar (xc->server, argv[1], buf, 0); + } + if (argc > 2) { + sprintf (buf, "%d", sx); + Tcl_SetVar (xc->server, argv[2], buf, 0); + sprintf (buf, "%d", sy); + Tcl_SetVar (xc->server, argv[3], buf, 0); + sprintf (buf, "%d", snx); + Tcl_SetVar (xc->server, argv[4], buf, 0); + sprintf (buf, "%d", sny); + Tcl_SetVar (xc->server, argv[5], buf, 0); + } + + sprintf (buf, "%d", fb->frameno); + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* nextFrame -- Display the next frame in sequence. + * + * Usage: nextFrame + */ +static int +nextFrame (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int frame; + + if (xim->display_frame < xim->nframes) + frame = xim->display_frame + 1; + else + frame = 1; + + xim_setFrame (xc->xim, frame); + return (TCL_OK); +} + + +/* prevFrame -- Display the previous frame in sequence. + * + * Usage: prevFrame + */ +static int +prevFrame (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int frame; + + if (xim->display_frame > 1) + frame = xim->display_frame - 1; + else + frame = xim->nframes; + + xim_setFrame (xc->xim, frame); + return (TCL_OK); +} + + +/* matchFrames -- Set the enhancement of the listed frames to match that of + * the given reference frame. If no reference frame is given the current + * display frame is used. If no frames are listed all frames are matched + * to the current display frame. + * + * Usage: matchFrames [frames [reference_frame]] + */ +static int +matchFrames (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int *frames, frame_list[32], reference_frame; + int nitems, i; + char **items; + + /* Get reference frame. */ + if (argc > 2) + reference_frame = atoi (argv[2]); + else + reference_frame = xim->display_frame; + + /* Get frame list. */ + if (argc > 1) { + if (Tcl_SplitList (tcl, argv[1], &nitems, &items) != TCL_OK) + goto nolist; + for (i=0, frames=frame_list; i < nitems; i++) + frames[i] = atoi (items[i]); + frames[i] = (int) NULL; + XtFree ((char *)items); + } else +nolist: frames = NULL; + + xim_matchFrames (xc->xim, frames, reference_frame); + return (TCL_OK); +} + + +/* registerFrames -- Register the listed frames with the given reference + * frame. If no reference frame is given the current display frame is used. + * If no frames are listed all frames are registered with the current + * display frame. + * + * Usage: registerFrames [frames [reference_frame]] + * offsetRegister [frames [reference_frame]] + */ +static int +registerFrames (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int *frames, frame_list[32], reference_frame; + int nitems, i, offsets; + char **items; + + /* Get reference frame. */ + if (argc > 2) + reference_frame = atoi (argv[2]); + else + reference_frame = xim->display_frame; + + /* Get frame list. */ + if (argc > 1) { + if (Tcl_SplitList (tcl, argv[1], &nitems, &items) != TCL_OK) + goto nolist; + for (i=0, frames=frame_list; i < nitems; i++) + frames[i] = atoi (items[i]); + frames[i] = (int) NULL; + XtFree ((char *)items); + } else +nolist: frames = NULL; + + offsets = (strcmp (argv[0], "offsetRegister") == 0); + xim_registerFrames (xc->xim, frames, reference_frame, offsets); + return (TCL_OK); +} + + +/* setOffset -- Set the offset for the current display frame buffer. + * + * Usage: setOffset xoff yoff + */ +static int +setOffset (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + float xcen, ycen; + float xmag, ymag; + float xoff, yoff; + Boolean absolute = False; + int frame = xim->display_frame - 1; + + + if (argc < 3) + return (TCL_ERROR); + + xcen = fb->xcen; + ycen = fb->ycen; + xmag = fb->xmag; + ymag = fb->ymag; + + /* Get offset values for the frame. */ + xoff = atof (argv[1]); + yoff = atof (argv[2]); + + /* Set frame offset. */ + xim_setZoom (xim, fb, fb->frameno, fb->zoommap, + fb->raster, fb->zoomras, xcen, ycen, xmag, ymag, xoff, yoff, + absolute); + + /* Now set he frame values independent of the display frame. */ + fb = &xim->frames[frame]; + fb->xoff = xoff; + fb->yoff = yoff; + + return (TCL_OK); +} + + + +/* clearFrame -- Clear the given frame, or the current frame in no frame + * number is given. + * + * Usage: clearFrame [frame] + */ +static int +clearFrame (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int frame; + + if (argc > 1) + frame = atoi (argv[1]); + else + frame = xim->display_frame; + + xim_eraseFrame (xc->xim, frame); + return (TCL_OK); +} + + +/* fitFrame -- Attempt to make the display window the same size as the frame + * buffer. + * + * Usage: fitFrame + */ +static int +fitFrame (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + + xim_fitFrame (xc->xim); + return (TCL_OK); +} + + +/* setOption -- Set an ximtool client option. + * + * Usage: setOption option value [args] + * + * Options: + * autoscale true|false + * antialias true|false [type] + * tileFrames true|false [frames] + * tileByRow true|false + * tileTopDown true|false + * tileGeom type|geom [frames] + * cmfocus size + */ +char *h_orient[] = { + "1x1","2x1","3x1","2x2", "3x2","3x2","4x2","4x2", "3x3","5x2","4x3","4x3" +}; +char *v_orient[] = { + "1x1","1x2","1x3","2x2", "2x3","2x3","2x4","2x4", "3x3","2x5","3x4","3x4" +}; + +static int +setOption (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + char *option, *strval, **items; + char buf[SZ_LINE]; + int ch, value, nx, ny, nitems, i, frame_list=0; + + + if (argc < 3) + return (TCL_ERROR); + else { + option = argv[1]; + strval = argv[2]; + + if (strcmp (option, "tileGeom") != 0) { + ch = strval[0]; + if (isdigit (ch)) + value = atoi (strval); + else if (ch == 'T' || ch == 't') + value = 1; + else if (ch == 'F' || ch == 'f') + value = 0; + } + } + + if (strcmp (option, "autoscale") == 0) { + if (xim->autoscale != value) { + xim->autoscale = value; + xim_resize (xim, xim->gt); + sprintf (buf, "%s", value ? "True" : "False"); + xim_message (xim, "autoscale", buf); + } + } else if (strcmp (option, "antialias") == 0) { + if (xim->antialias != value) { + xim->antialias = value; + if (value) { + if (argc > 3) + xim->rop = xim_getAntialias (xim, argv[3]); + else + xim->rop = xim_getAntialias (xim, xim->antialiasType); + } else + xim->rop = 0; + xim_setRop (xim, fb, xim->rop); + sprintf (buf, "%s", value ? "True" : "False"); + xim_message (xim, "antialias", buf); + } + + } else if (strcmp (option, "cmfocus") == 0) { + if (xim->cm_focus != value) { + int box_size = value; + xim->cm_focus = box_size; + GtSetColormapFocus (box_size); + } + + } else if (strcmp (option, "tileFrames") == 0) { + if (xim->tileFrames != value) { + /* Get list of frames to be tiled. */ + if (argc > 3) { + if (Tcl_SplitList (tcl, argv[3], &nitems, &items) != TCL_OK) + goto nolist1; + for (i=0; i < nitems; i++) + frame_list |= (1 << (atoi(items[i]) - 1)); + XtFree ((char *)items); + } else { +nolist1: for (i=0; i < xim->nframes; i++) + frame_list |= (1 << i); + nitems = xim->nframes; + } + + /* Set or clear tile frame mode. */ + xim_tileFrames (xim, value ? frame_list : 0); + } + + } else if (strcmp (option, "tileByRows") == 0) { + xim->tileByRows = value; + xim_tileFrames (xim, xim->tileFramesList); + + } else if (strcmp (option, "tileTopDown") == 0) { + xim->tileTopDown = value; + xim_tileFrames (xim, xim->tileFramesList); + + } else if (strcmp (option, "tileLabels") == 0) { + xim->tileLabels = value; + xim_tileFrames (xim, xim->tileFramesList); + + } else if (strcmp (option, "tileGeom") == 0) { + /* Get list of frames to be tiled. */ + if (argc > 3) { + if (Tcl_SplitList (tcl, argv[3], &nitems, &items) != TCL_OK) + goto nolist2; + for (i=0; i < nitems; i++) + frame_list |= (1 << (atoi(items[i]) - 1)); + XtFree ((char *)items); + } else { +nolist2: for (i=0; i < xim->nframes; i++) + frame_list |= (1 << i); + nitems = xim->nframes; + } + nitems = max (nitems, 1); + + + /* Get the option or tile geometry. */ + if (strcmp (strval, "Best") == 0) { + if (xim->width < xim->height) + goto horient; + else + goto vorient; + } else if (strcmp (strval, "Square") == 0) { + for (i=0; (i*i) < nitems; i++) + ; + nx = ny = i; + } else if (strcmp (strval, "Horizontal") == 0) { +horient: if (nitems >= 13) + nx = ny = 4; + else + sscanf (h_orient[nitems-1], "%dx%d", &nx, &ny); + } else if (strcmp (strval, "Vertical") == 0) { +vorient: if (nitems >= 13) + nx = ny = 4; + else + sscanf (v_orient[nitems-1], "%dx%d", &nx, &ny); + } else if (strcmp (strval, "Row") == 0) { + nx = nitems; + ny = 1; + } else if (strcmp (strval, "Column") == 0) { + nx = 1; + ny = nitems; + } else { + sscanf (strval, "%dx%d", &nx, &ny); + } + + /* Set or clear tile frame mode. */ + xim->tileRows = ny; + xim->tileCols = nx; + xim->tileFramesList = frame_list; + sprintf (buf, "%d %d", nx, ny); + xim_message (xim, "tileOptions", buf); + + xim_tileFrames (xim, xim->tileFramesList); + } + + return (TCL_OK); +} + + +/* setColormap -- Set the colormap for the current display frame. + * + * Usage: setColormap <colormap> + * + * The colormap may be specified either by number or by name. + */ +static int +setColormap (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + unsigned short m_red[MAX_COLORS]; + unsigned short m_green[MAX_COLORS]; + unsigned short m_blue[MAX_COLORS]; + char buf[SZ_LINE]; + ColorMapPtr cm; + int i; + + + if (argc == 2) { + if (isdigit (*argv[1])) + i = atoi(argv[1]); + else { + for (i=1; i <= ncolormaps; i++) + if (strcmp (colormaps[i-1].name, argv[1]) == 0) + break; + } + + if (i >= 1 && i <= ncolormaps) { + cm = &colormaps[i-1]; + if (strncmp (cm->name, "Random", 6) == 0) { + xim_setColormap (cm->name, NULL, + m_red, m_green, m_blue, xim->ncolors); + GtWriteColormap (xim->gt, cm->mapno, + first_color, xim->ncolors, m_red, m_green, m_blue); + } + + fb->colormap = i; + GtSetColormapFocus (-1); /* force full update */ + GtLoadColormap (xim->gt, cm->mapno, fb->offset, fb->scale); + GtSetColormapFocus (xim->cm_focus); + xim_enhancement (xim, fb); + } + } + + return (TCL_OK); +} + + +/* windowColormap -- Set the colormap for the current display frame. + * + * Usage: windowColormap <offset> <scale> + */ +static int +windowColormap (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register ColorMapPtr cm; + char buf[SZ_LINE]; + + if (argc > 1) { + cm = &colormaps[fb->colormap-1]; + fb->offset = atof(argv[1]); + fb->scale = (argc > 2) ? (float)atof(argv[2]) : fb->scale; + GtLoadColormap (xim->gt, cm->mapno, fb->offset, fb->scale); + xim_enhancement (xim, fb); + } + + return (TCL_OK); +} + + +/* updateColormap -- Update the colormap for the entire display frame. + * + * Usage: updateColormap <offset> <scale> + */ +static int +updateColormap (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register ColorMapPtr cm; + char buf[SZ_LINE]; + + if (argc > 1) { + cm = &colormaps[fb->colormap-1]; + fb->offset = atof(argv[1]); + fb->scale = (argc > 2) ? (float)atof(argv[2]) : fb->scale; + GtSetColormapFocus (-1); /* force full update */ + GtLoadColormap (xim->gt, cm->mapno, fb->offset, fb->scale); + GtSetColormapFocus (xim->cm_focus); + xim_enhancement (xim, fb); + } + + return (TCL_OK); +} + + +/* zoom -- Set the zoom factors for the current frame to the given values. + * A zoom factor > 1 enlarges the image, < 1 shrinks the image, 1.0 maps + * one source pixel to one destination pixel. + * + * Usage: zoom <xymag> 1 argument + * zoom <xmag> <ymag> 2 arguments + * zoom <xmag> <ymag> <xcen> <ycen> 4 arguments + * + * When called as "zoom" the magnification is relative to the fixed scaling, + * if any, used to scale the frame to fit the display window at mag=1.0. + * When called as zoomAbs" the magnification given is the actual scale factor + * used to map raster pixels to display pixels. + */ +static int +zoom (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + float xmag, ymag; + float xcen, ycen; + float xoff, yoff; + Boolean absolute; + + xmag = fb->xmag; + ymag = fb->ymag; + xcen = fb->xcen; + ycen = fb->ycen; + xoff = fb->xoff; + yoff = fb->yoff; + + switch (argc) { + case 7: + xoff = atof (argv[5]); + yoff = atof (argv[6]); + /* fall through */ + case 5: + xcen = atof (argv[3]); + ycen = atof (argv[4]); + /* fall through */ + case 3: + xmag = atof (argv[1]); + ymag = atof (argv[2]); + break; + case 2: + xmag = ymag = atof (argv[1]); + break; + } + + absolute = (strcmp (argv[0], "zoomAbs") == 0); + xim_setZoom (xim, fb, fb->frameno, fb->zoommap, + fb->raster, fb->zoomras, xcen, ycen, xmag, ymag, xoff, yoff, + absolute); + + return (TCL_OK); +} + + +/* pan -- Pan the current frame, i.e., change the view center. + * + * Usage: pan <xcen> <ycen> + */ +static int +pan (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + Boolean absolute = False; + float xmag, ymag; + float xcen, ycen; + float xoff, yoff; + double atof(); + + xmag = fb->xmag; + ymag = fb->ymag; + xoff = fb->xoff; + yoff = fb->yoff; + + if (argc == 3) { + xcen = atof (argv[1]); + ycen = atof (argv[2]); + + xim_setZoom (xim, fb, fb->frameno, fb->zoommap, + fb->raster, fb->zoomras, xcen, ycen, xmag, ymag, xoff, yoff, + absolute); + } + + return (TCL_OK); +} + + +/* centroid -- Center the cursor on the feature given an initial position + * and box size. Return a correction to the center. + * + * Usage: centroid <xcen> <ycen> <size> [ <type> ] + */ +static int +centroid (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register CtranPtr ct = (CtranPtr) &fb->ctran; + unsigned char junk[MAX_COLORS]; + unsigned char *pix = NULL; + float *data=NULL, *xm=NULL, *ym=NULL; + float xsum, ysum, xsumx, ysumx; + float cx, cy, lo, hi, px, xcen, ycen, size; + float xmin=999999.0, xmax=-999999.0; + int w, h, ncolors, i, j; + int dist=0, mind=99999, maxd=99999, imin=0, imax=0; + int x0, y0, nx, npix, min_max=-1; + char buf[SZ_LINE]; + double atof(); + + + if (argc < 4) + return (TCL_ERROR); + + xcen = atof (argv[1]); + ycen = atof (argv[2]); + size = atof (argv[3]); + if (argc == 5) + min_max = strcmp (argv[4],"max"); + + x0 = xcen - size; + y0 = ycen - size; + nx = size * 2 + 1; + npix = nx * nx; + + /* Read the display raster. */ + pix = xim_readDisplay (xim, x0,y0,nx,nx, &w,&h, junk,junk,junk, + &ncolors); + + /* Scale the data to the WCS pixel values for centroiding. */ + data = (float *) XtMalloc (npix * sizeof(float)); + for (i=0; i < npix; i++) { + if (pix[i] == 0) { + data[i] = 0.0; + } else { + if (ct->zt == W_LINEAR) { + data[i] = ((pix[i]-1) * (ct->z2 - ct->z1) / 199) + ct->z1; + data[i] = max (ct->z1, min (ct->z2, data[i])); + } else + data[i] = (float) pix[i]; + } + cx = (nx / 2) - (i % nx); + cy = (nx / 2) - (i / nx); + dist = (int) (sqrt (cx*cx + cy*cy) + 0.5); + + if (data[i] > xmax) + xmax = data[i], maxd = dist, imax = i; + else if (data[i] == xmax && dist < maxd) + maxd = dist, imax = i; + + if (data[i] < xmin) + xmin = data[i], mind = dist, imin = i; + else if (data[i] == xmin && dist < mind) + mind = dist, imin = i; + } + XtFree ((char *)pix); + + if (min_max >= 0) { + if (min_max == 0) { + if (data[npix/2] == xmax) + sprintf (buf, "0 0"); + else + sprintf (buf, "%g %g", (imax%nx)-size, (imax/nx)-size); + } else { + if (data[npix/2] == xmin) + sprintf (buf, "0 0"); + else + sprintf (buf, "%g %g", (imin%nx)-size, (imin/nx)-size); + } + + /* Return the correction to the position. */ + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + return (TCL_OK); + } + + + /* Find the low threshold for the subraster (i.e. the mean). */ + lo = hi = xsum = data[0]; + for (i=1; i < npix ; i++) { + xsum += data[i]; + lo = (data[i] < lo ? data[i] : lo); + hi = (data[i] > hi ? data[i] : hi); + } + + /* Check for a raster with all the same pixels, in which case + * just return a zero offset. + */ + if (lo == hi) { + sprintf (buf, "0 0"); + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + return (TCL_OK); + + } else + lo = xsum / (float)npix; + + /* Accumulate the x and y marginals. */ + xm = (float *) XtMalloc (nx * sizeof(float)); + ym = (float *) XtMalloc (nx * sizeof(float)); + for (i=0; i < nx; i++) { + xsum = xm[i] = 0.0, ysum = ym[i] = 0.0; + for (j=0; j < nx; j++) { + px = data[(j*nx)+i]; /* column sum */ + if (lo <= px) + xsum += px - lo; + + px = data[(i*nx)+j]; /* row sum */ + if (lo <= px) + ysum += px - lo; + } + xm[i] = xsum; + ym[i] = ysum; + } + XtFree ((char *)data); + + /* Now calculate the centroids as the first moment. If all the + * marginals are zero (i.e. all pixels the same) then return a + * zero correction. + */ + xsum = xsumx = 0.0, ysum = ysumx = 0.0; + px = (float) nx; + for (i=0; i < nx; i++) { + xsum += (xm[i] / px); + xsumx += (xm[i] / px) * i; + + ysum += (ym[i] / px); + ysumx += (ym[i] / px) * i; + } + cx = (xsum == 0.0) ? size : xsumx / xsum; + cy = (ysum == 0.0) ? size : ysumx / ysum; + + XtFree ((char *)xm); /* clean up */ + XtFree ((char *)ym); + + /* Return the correction to the position. */ + sprintf (buf, "%d %d", nint(cx-size), nint(cy-size)); + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* getPixels -- Get an array of pixels around the given center position. + * + * Usage: getPixels <x0> <y0> <nx> <ny> [format [scale]] + */ + +#define PF_NONE 0 /* don't format the output pixels */ +#define PF_PIXTAB 1 /* format for pixel table */ +#define PF_HCUT 2 /* format for horizontal cut-plot */ +#define PF_VCUT 3 /* format for vertical cut-plot */ + +static int +getPixels (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register CtranPtr ct = (CtranPtr) &fb->ctran; + register int i, j, k, l; + unsigned char *pix = NULL; + char *buf = NULL, ch, val[32]; + float *data = NULL; + float z1 = ct->z1, z2 = ct->z2; + float scale=1.0, yscale = 128.0 / (z2 - z1); + int x0, y0, nx, ny, format=0, npix, sample=1, raster=0; + double atof(); + + + if (argc < 5) + return (TCL_ERROR); + + x0 = atof (argv[1]); + y0 = atof (argv[2]); + nx = atof (argv[3]); + ny = atof (argv[4]); + if (argc >= 6) { + if (isdigit ((ch = *argv[5]))) + format = atoi (argv[5]); + else if (ch == 'T' || ch == 't') + format = 1; + else + format = 0; + } + if (argc >= 7) + sample = (isdigit(*argv[6]) ? atoi (argv[6]) : 1); + if (argc == 8) + scale = atof (argv[7]); + + npix = nx * ny; + + + /* Read the display raster. */ + pix = (unsigned char *) XtMalloc (npix); + if (GtReadPixels (xim->gt, raster, pix, 8, x0, y0, nx, ny) < 0) + return (TCL_ERROR); + + /* Scale the data to the WCS pixel values for display. We don't + * get here if an ISM is running that provides access to the real + * pixel values. + */ + data = (float *) XtCalloc (npix, sizeof(float)); + for (i=0; i < npix; i+=sample) { + if (pix[i] == 0) { + data[i] = 0.0; + } else { + if (ct->zt == W_LINEAR) { + data[i] = ((pix[i]-1) * (z2 - z1) / 199) + z1; + data[i] = max (z1, min (z2, data[i])); + } else + data[i] = (float) pix[i]; + } + if (format > 1) { data[i] = (z2 - data[i]) * yscale; } + } + XtFree ((char *)pix); + + /* Get a text buffer large enough to hold the encoded data. */ + if (!(buf = (char *) XtMalloc ((npix + 4) * 30))) { + XtFree ((char *)data); + return (TCL_ERROR); + } + + /* Encode the data as {ddd} {ddd} {ddd}...{ddd}. The first four + * elements are the zscale values and the array min/max. + */ + strcpy (buf, ""); + sprintf (val, "{%10.1f} ", z1); strcat (buf, val); + sprintf (val, "{%10.1f} ", z2); strcat (buf, val); + + if (format == PF_PIXTAB) { + for (i=0; i < npix; i++) { + sprintf (val, "{%10.1f%c} ", data[i], + (data[i] <= z1 ? '-' : (data[i] >= z2 ? '+' : ' ')) ); + strcat (buf, val); + } + } else if (format == PF_HCUT) { + for (i=0; i < npix; i+=sample) { + sprintf (val, "{%g %g} ", i * scale, data[i]); + strcat (buf, val); + } + } else if (format == PF_VCUT) { + for (i=0; i < npix; i+=sample) { + sprintf (val, "{%g %g} ", data[i], i * scale); + strcat (buf, val); + } + } else { + for (i=0; i < npix; i++) { + sprintf (val, "{%f} ", data[i]); + strcat (buf, val); + } + } + + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + XtFree ((char *)data); + XtFree ((char *)buf); + + return (TCL_OK); +} + + +/* flip -- Flip the current display frame in the indicated axis or axes. + * + * Usage: flip [axis [axis ...]] + */ +static int +flip (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + int flip_x = 0, flip_y = 0; + int ch, i; + + for (i=1; i < argc; i++) { + ch = argv[i][0]; + if (ch == 'x' || ch == 'X') + flip_x = !flip_x; + else if (ch == 'y' || ch == 'Y') + flip_y = !flip_y; + } + + xim_setFlip (xim, fb, flip_x, flip_y); + return (TCL_OK); +} + + +/* retCursorVal -- Return a cursor value to the ximtool client process. This + * should be executed by the GUI to terminate a cursor read. + * + * Usage: retCursorVal sx sy [frame [wcs [key [strval]]]] + */ +static int +retCursorVal (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int frame, wcs, key; + float sx, sy; + char *s, *strval; + + if (argc < 3) + return (TCL_ERROR); + + sx = atof (argv[1]); + sy = atof (argv[2]); + frame = (argc > 3) ? atoi (argv[3]) : xim->display_frame; + wcs = (argc > 4) ? atoi (argv[4]) : 1; + + if (argc > 5) { + s = argv[5]; + if (s[0] == '^') + key = s[1] - 'A' + 1; + else + key = s[0]; + } else + key = 0; + + strval = (argc > 6) ? argv[6] : ""; + + xim_retCursorVal (xim, sx, sy, frame, wcs, key, strval); + + return (TCL_OK); +} + + +/* encodewcs -- Convert raw screen coordinates x,y,z (z=pixel value) to + * world coordinates using the WCS passed to ximtool by the client application + * when the frame was loaded. The encoded description of the current position + * and pixel value is returned to the GUI as a string value. + * + * Usage: string = encodewcs sx sy sz + */ +static int +encodewcs (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + char buf[SZ_LINE]; + float sx, sy; + int sz; + + if (argc < 3) + return (TCL_ERROR); + + sx = atof (argv[1]); + sy = atof (argv[2]); + sz = (argc > 3) ? atoi (argv[3]) : 0; + + xim_encodewcs (xc->xim, sx, sy, sz, buf); + Tcl_SetResult (xc->server, buf, TCL_VOLATILE); + + return (TCL_OK); +} + + +/* setPrintOption -- Set an ximtool client hardcopy option. + * + * Usage: setPrintOption option value [args] + * + * Options: + * autoscale true|false + * autorotate true|false + * maxaspect true|false + * annotate true|false + * compress true|false + * + * orientation portrait|landscape + * papersize letter|legal|A4|B5 + * imscale value + * + * colortype gray|pseudo|rgb + * printername strval + * devicetype printer|file + * + * printcmd command + * printfile filename + * + * dotitle true|false + * doborders true|false + * docolorbars true|false + * title string + * + * corners llx lly urx ury + */ +static int +setPrintOption (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register PSImagePtr psim = xim->psim; + register PrintCfgPtr pcp = xim->pcp; + register PrinterPtr prp; + register int i; + int llx, lly, urx, ury; + char *option, strval[SZ_LINE]; + char buf[SZ_LINE]; + int pnum, ch, value, psflags = psim->page.flags; + + if (argc < 3) + return (TCL_ERROR); + else { + option = argv[1]; + strcpy (strval, argv[2]); + for (i=3; i < argc; i++) { + strcat (strval, " "); + strcat (strval, argv[i]); + } + + ch = strval[0]; + if (isdigit (ch)) + value = atoi (strval); + else if (ch == 'T' || ch == 't') + value = 1; + else if (ch == 'F' || ch == 'f') + value = 0; + } + + if (strcmp (option, "autoscale") == 0) { /* AUTOSCALE */ + psflags = value ? psflags | EPS_AUTOSCALE : + psflags & ~EPS_AUTOSCALE ; + psim->page.flags = psflags; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "autorotate") == 0) { /* AUTOROTATE */ + psflags = value ? psflags | EPS_AUTOROTATE : + psflags & ~EPS_AUTOROTATE ; + psim->page.flags = psflags; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "maxaspect") == 0) { /* MAXASPECT */ + psflags = value ? psflags | EPS_MAXASPECT : + psflags & ~EPS_MAXASPECT ; + psim->page.flags = psflags; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "dotitle") == 0) { /* TITLE */ + psflags = value ? psflags | EPS_DOTITLE : + psflags & ~EPS_DOTITLE ; + psim->page.flags = psflags; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "doborders") == 0) { /* BORDERS */ + psflags = value ? psflags | EPS_DOBORDERS : + psflags & ~EPS_DOBORDERS ; + psim->page.flags = psflags; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "docolorbar") == 0) { /* COLORBAR */ + psflags = value ? psflags | EPS_DOCOLORBAR : + psflags & ~EPS_DOCOLORBAR ; + psim->page.flags = psflags; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "title") == 0) { /* TITLE STR */ + if (strcmp ("imtitle", strval) != 0) { + strcpy (psim->label, strval); + sprintf (buf, "title %s", strval); + xim_message (xim, "printOptions", buf); + } + + } else if (strcmp (option, "annotate") == 0) { /* ANNOTATE */ + if (value) { + if (!psim->label) + psim->label = (char *) calloc (SZ_LINE, sizeof (char)); + sprintf (psim->label, "[Frame %d] %s", + fb->frameno, fb->ctran.imtitle); + psim->annotate = 1; + } else { + if (psim->label) { + XtFree ((char *)psim->label); + psim->label = NULL; + } + psim->annotate = 0; + } + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "compress") == 0) { /* COMPRESS */ + if (value) + psim->compression = RLECompression; + else + psim->compression = NoCompression; + sprintf (buf, "%s %s", option, value ? "True" : "False"); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "orientation") == 0) { /* ORIENTATION */ + if (ch == 'P' || ch == 'p') + psim->page.orientation = EPS_PORTRAIT; + else if (ch == 'L' || ch == 'l') + psim->page.orientation = EPS_LANDSCAPE; + sprintf (buf, "%s %s", option, strval); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "papersize") == 0) { /* PAPER SIZE */ + if (strval[2] == 'T' || strval[2] == 't') + psim->page.page_type = EPS_LETTER; + else if (strval[2] == 'G' || strval[2] == 'g') + psim->page.page_type = EPS_LEGAL; + else if (strval[0] == 'A' || strval[0] == 'a') + psim->page.page_type = EPS_A4; + else if (strval[0] == 'B' || strval[0] == 'b') + psim->page.page_type = EPS_B5; + sprintf (buf, "%s %s", option, strval); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "imscale") == 0) { /* IMAGE SCALE */ + if (value >= 10) { + if ((int)(psim->page.scale*100.0) != value) + psim->page.scale = (float) value / 100.0; + sprintf (buf, "%s %d", option, value); + xim_message (xim, "printOptions", buf); + } + + } else if (strcmp (option, "colortype") == 0) { /* COLORTYPE */ + if (ch == 'G' || ch == 'g') + psim->colorClass = EPS_GRAYSCALE; + else if (ch == 'P' || ch == 'p') + psim->colorClass = EPS_PSEUDOCOLOR; + else if (ch == 'R' || ch == 'r') + psim->colorClass = EPS_TRUECOLOR; + sprintf (buf, "%s %s", option, strval); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "devicetype") == 0) { /* DEVICETYPE */ + + if (strval[0] == 'p' || strval[0] == 'P') { + pcp->diskfile = 0; + sprintf (buf, "deviceType Printer"); + xim_message (xim, "printOptions", buf); + sprintf (buf, "printCmd %s", pcp->printCmd); + xim_message (xim, "printOptions", buf); + sprintf (buf, "printerName %d", pcp->printno); + xim_message (xim, "printOptions", buf); + + } else if (strval[0] == 'f' || strval[0] == 'F') { + pcp->diskfile = 1; + sprintf (buf, "deviceType File"); + xim_message (xim, "printOptions", buf); + sprintf (buf, "printFile %s", pcp->printFile); + xim_message (xim, "printOptions", buf); + } + + } else if (strcmp (option, "printername") == 0) { /* PRINTER NAME */ + /* Set to printer mode if called in file mode. */ + if (pcp->diskfile) { + pcp->diskfile = 0; + sprintf (buf, "deviceType Printer"); + xim_message (xim, "printOptions", buf); + } + pnum = xim_getPrinterInfo (xim, strval); + sprintf (buf, "printerName %s", strval); + xim_message (xim, "printOptions", buf); + strcpy (pcp->printCmd, printer_list[pnum].printCmd); + sprintf (buf, "printCmd %s", pcp->printCmd); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "printcmd") == 0) { /* PRINT COMMAND */ + strcpy (pcp->printCmd, strval); + sprintf (buf, "printCmd %s", strval); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "printfile") == 0) { /* PRINT FILENAME */ + strcpy (pcp->printFile, strval); + sprintf (buf, "printFile %s", strval); + xim_message (xim, "printOptions", buf); + + } else if (strcmp (option, "corners") == 0) { /* IMAGE CORNERS */ + /* Set the corners of the image being printed. */ + sscanf (strval, "%d %d %d %d", &llx, &lly, &urx, &ury); + eps_setCorners (psim, llx, lly, urx, ury); + } + + /* Reload the page parameters in case anything's changed. */ + eps_setPage (psim, psim->page.orientation, psim->page.page_type, + (int)(psim->page.scale*100), psim->page.flags); + + return (TCL_OK); +} + + +/* setSaveOption -- Set an ximtool client disk file option. + * + * Usage: setSaveOption option value [args] + * + * Options: + * + * format fmt + * color gray|pseudo|rgb + * fname strval + */ +static int +setSaveOption (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register fileSavePtr fsp = xim->fsp; + register int i; + char *option, strval[SZ_LINE]; + char buf[SZ_LINE]; + int ch, value; + + if (argc < 3) + return (TCL_ERROR); + else { + option = argv[1]; + strcpy (strval, argv[2]); + for (i=3; i < argc; i++) { + strcat (strval, " "); + strcat (strval, argv[i]); + } + + + ch = strval[0]; + if (isdigit (ch)) + value = atoi (strval); + else if (ch == 'T' || ch == 't') + value = 1; + else if (ch == 'F' || ch == 'f') + value = 0; + } + + if (strcmp (option, "format") == 0) { /* FORMAT */ + switch (strval[0]) { + case 'r': + if (strval[2] == 's') { + fsp->format = XIM_RAS; + strcpy (fsp->fname, "frame%d.ras"); + } else if (strval[2] == 'w') { + fsp->format = XIM_RAW; + strcpy (fsp->fname, "frame%d.raw"); + } + break; + case 'g': + fsp->format = XIM_GIF; + strcpy (fsp->fname, "frame%d.gif"); + break; + case 'j': + fsp->format = XIM_JPEG; + strcpy (fsp->fname, "frame%d.jpg"); + break; + case 't': + fsp->format = XIM_TIFF; + strcpy (fsp->fname, "frame%d.tiff"); + break; + case 'f': + fsp->format = XIM_FITS; + strcpy (fsp->fname, "frame%d.fits"); + break; + case 'e': + fsp->format = XIM_EPS; + strcpy (fsp->fname, "frame%d.eps"); + break; + case 'x': + fsp->format = XIM_X11; + strcpy (fsp->fname, "frame%d.xwd"); + break; + } + sprintf (buf, "%s %s", option, strval); + xim_message (xim, "saveOptions", buf); + sprintf (buf, "fname %s", fsp->fname); + xim_message (xim, "saveOptions", buf); + + } else if (strcmp (option, "color") == 0) { /* COLOR */ + if (ch == 'G' || ch == 'g') + fsp->colorType = XIM_GRAYSCALE; + else if (ch == 'P' || ch == 'p') + fsp->colorType = XIM_PSEUDOCOLOR; + else if (ch == 'R' || ch == 'r') + fsp->colorType = XIM_RGB; + sprintf (buf, "%s %s", option, strval); + xim_message (xim, "saveOptions", buf); + + } else if (strcmp (option, "fname") == 0) { /* FILENAME */ + strcpy (fsp->fname, strval); + sprintf (buf, "%s %s", option, strval); + xim_message (xim, "saveOptions", buf); + } + + return (TCL_OK); +} + + +/* setLoadOption -- Set an ximtool client disk file option. + * + * Usage: setLoadOption option value [args] + * + * Options: + * up + * root + * home + * rescan + * headers + * pattern patstr + * gray 0|1 + * zscale 0|1 + * zrange 0|1 + * z1 value + * z2 value + * nsample value + * + */ +static int +setLoadOption (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register int i; + register XimDataPtr xim = xc->xim; + register fileLoadPtr flp = xim->flp; + char *ip, *op, *option, *strval; + char buf[SZ_LINE]; + + if (argc < 2) + return (TCL_ERROR); + else { + option = argv[1]; + strval = (argc == 3 ? argv[2] : "" ); + } + + if (strcmp (option, "up") == 0) { /* UP */ + if (strcmp("/", flp->curdir) != 0) { + for (i=strlen(flp->curdir); i > 1; i--) { + if (flp->curdir[i] == '/') + break; + } + flp->curdir[i] = '\0'; + sprintf (buf, "curdir %s", flp->curdir); + xim_message (xim, "loadOptions", buf); + xim_dirRescan (xim); + } + + } else if (strcmp (option, "root") == 0) { /* ROOT */ + strcpy (flp->curdir, "/"); + sprintf (buf, "curdir %s", flp->curdir); + xim_message (xim, "loadOptions", buf); + xim_dirRescan (xim); + + } else if (strcmp (option, "home") == 0) { /* HOME */ + strcpy (flp->curdir, flp->homedir); + sprintf (buf, "curdir %s", flp->curdir); + xim_message (xim, "loadOptions", buf); + xim_dirRescan (xim); + + } else if (strcmp (option, "pattern") == 0) { /* PATTERN */ + if (strcmp(strval, flp->pattern) != 0) { + strcpy (flp->pattern, strval); + sprintf (buf, "pattern %s", flp->pattern); + xim_message (xim, "loadOptions", buf); + xim_dirRescan (xim); + } + + } else if (strcmp (option, "rescan") == 0) { /* RESCAN */ + xim_dirRescan (xim); + + } else if (strcmp (option, "headers") == 0) { /* HEADERS */ + xim_scanHeaders (xim); + + } else if (strcmp (option, "gray") == 0) { /* GRAY */ + flp->gray = (strval[0] == '0' ? 0 : 1); + sprintf (buf, "gray %s", strval[0] == '0' ? "off" : "on"); + xim_message (xim, "loadOptions", buf); + + } else if (strcmp (option, "zscale") == 0) { /* ZSCALE */ + flp->zscale = (strval[0] == '0' ? 0 : 1); + sprintf (buf, "zscale %s", strval[0] == '0' ? "off" : "on"); + xim_message (xim, "loadOptions", buf); + + } else if (strcmp (option, "zrange") == 0) { /* ZRANGE */ + flp->zrange = (strval[0] == '0' ? 0 : 1); + sprintf (buf, "zrange %s", strval[0] == '0' ? "off" : "on"); + xim_message (xim, "loadOptions", buf); + + } else if (strcmp (option, "z1") == 0) { /* Z1 */ + sscanf (argv[2], "%g", &(flp->z1)); + sprintf (buf, "z1 %s", argv[2]); + xim_message (xim, "loadOptions", buf); + + } else if (strcmp (option, "z2") == 0) { /* Z2 */ + sscanf (argv[2], "%g", &(flp->z2)); + sprintf (buf, "z2 %s", argv[2]); + xim_message (xim, "loadOptions", buf); + + } else if (strcmp (option, "nsample") == 0) { /* NSAMPLE */ + sscanf (argv[2], "%d", &(flp->nsample)); + sprintf (buf, "nsample %s", argv[2]); + xim_message (xim, "loadOptions", buf); + } + + return (TCL_OK); +} + + +/* Print -- Print the current display frame to a printer or to a file (EPS). + * + * Usage: print [x0 y0 nx ny] + * + * print rename old new + * print cancel fname + * + * If a subregion is given the indicated region is printed, otherwise the + * full display frame is printed. + * + * The forms "print rename" and "print cancel" are actions for print alerts. + */ +static int +print (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + int x0, y0, nx, ny; + + /* Handle the special cases first. */ + if (argc == 4 && strcmp (argv[1], "rename") == 0) { + ximp_rename (xim, argv[2], argv[3]); + return (TCL_OK); + } else if (argc == 3 && strcmp (argv[1], "cancel") == 0) { + ximp_cancel (xim, argv[2]); + return (TCL_OK); + } + + /* Normal case of a print. */ + if (argc == 5) { + x0 = atoi (argv[1]); + y0 = atoi (argv[2]); + nx = atoi (argv[3]); + ny = atoi (argv[4]); + } else + x0 = y0 = nx = ny = 0; + + if (xim_print (xim, x0,y0, nx,ny) < 0) + return (TCL_ERROR); + else + return (TCL_OK); +} + + +/* Save -- Save the current display frame to a disk file. + * + * Usage: save [x0 y0 nx ny] + * + * save rename old new + * save cancel fname + * + * If a subregion is given the indicated region is saved, otherwise the + * full display frame is saved. + * + * The forms "save rename" and "save cancel" are actions for save alerts. + */ +static int +save (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register fileSavePtr fsp = xim->fsp; + int x0, y0, nx, ny; + + /* Handle the special cases first. */ + if (argc == 4 && strcmp (argv[1], "rename") == 0) { + xims_rename (xim, argv[2], argv[3]); + return (TCL_OK); + } else if (argc == 3 && strcmp (argv[1], "cancel") == 0) { + xims_cancel (xim, argv[2]); + return (TCL_OK); + } + + if (argc == 5) { + x0 = atoi (argv[1]); + y0 = atoi (argv[2]); + nx = atoi (argv[3]); + ny = atoi (argv[4]); + } else + x0 = y0 = nx = ny = 0; + + /* Pass off to the file save routines. */ + if (xim_saveFile (xim, fsp->fname, fsp->format, x0,y0, nx,ny) < 0) + return (TCL_ERROR); + else + return (TCL_OK); +} + + +/* Load -- Load a frame from a disk file. + * + * Usage: load filename [frame] + * + * Options: frame display frame to be loaded + */ +static int +load (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register int i; + register XimDataPtr xim = xc->xim; + register fileLoadPtr flp = xim->flp; + char *ip, *op, *fname; + char *flist, buf[SZ_LINE]; + struct stat file_info; + int frame; + + if (argc < 2) + return (TCL_ERROR); + + fname = argv[1]; + frame = (argc >= 3) ? atoi(argv[2]) : xim->display_frame; + + /* If given a directory change the directory browser current reference + * directory and get a listing. + */ + if (fname[strlen(fname)-1] == '/') { + fname[strlen(fname)-1] = '\0'; + if (fname[0] == '/') { + sprintf (flp->curdir, "%s", fname); + } else { + strcat (flp->curdir, "/"); + strcat (flp->curdir, fname); + } + sprintf (buf, "curdir %s", flp->curdir); + xim_message (xim, "loadOptions", buf); + + xim_dirRescan (xim); + + } else { + /* Otherwise it may be some kind of image to be loaded, but first + * check to see if it's not some other directory first. + */ + (void) stat (fname, &file_info); + if (S_ISDIR(file_info.st_mode)) { + sprintf (flp->curdir, "%s", fname); + sprintf (buf, "curdir %s", flp->curdir); + xim_message (xim, "loadOptions", buf); + xim_dirRescan (xim); + return (TCL_OK); + } + + /* It's not a directory, so try loading the file. */ + if (xim_loadFile (xim, fname, frame) != 0) + return (TCL_ERROR); + } + + return (TCL_OK); +} + + +/* Help -- Send the default help text (HTML) to the GUI. + * + * Usage: help + */ + +/* The builtin default help text. */ +static char *help_text[] = { + "setValue {", +# include "ximtool.html.h" + "}", + NULL +}; + +static int +help (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register char *ip, *op, *helptxt; + register int i; + + helptxt = (char *) XtMalloc (1024000); + for (i=0, op=helptxt; ip = help_text[i]; i++) { + while (*ip) + *op++ = *ip++; + *op++ = '\n'; + } + *op++ = '\0'; + + ObmDeliverMsg (xim->obm, "help", helptxt); + XtFree ((char *)helptxt); + + return (TCL_OK); +} + + +/* Info -- Send various kinds of information to the GUI. The 'args' option + * allows us to pass in information from the GUI that cannot be easily + * obtained otherwise, e.g. private information inthe Gterm widget such as + * the basePixel resource. + * + * Usage: info option [ args ... ] + */ + +info (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + char line[SZ_LINE], path[80], *option, *message; + + if (argc < 2) + return (TCL_ERROR); + else + option = argv[1]; + + message = (char *) XtCalloc (8182, sizeof(char)); + + if (strcmp (option, "server") == 0) { + info_server (xim, argc, argv, message); + + } else if (strcmp (option, "wcs") == 0) { + info_wcs (xim, message); + + } else if (strcmp (option, "clients") == 0) { + info_clients (xim, message); + + } else if (strcmp (option, "imtoolrc") == 0) { + info_imtoolrc (xim, message); + + } else { + XtFree ((char *)message); + return (TCL_ERROR); + } + + strcat (message, "\n\0"); + + if (*message) + xim_message (xim, "info", message); + XtFree ((char *)message); + + return (TCL_OK); +} + + +/* INFO_SERVER -- Helper routine to report server state information. + */ +info_server (xim, argc, argv, text) +register XimDataPtr xim; +int argc; +char **argv; +char *text; +{ + extern char *ximtool_version[]; + extern int ncolormaps, first_color; + char cmapname[80], line[SZ_LINE]; + ColorMapPtr cm; + + sprintf (text, "\t%s\n\n", ximtool_version[0]); + + sprintf (line, "%20s: %s\n", "Base Pixel", + (argc >= 3 ? argv[2] :"")); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Max Colors", + (argc >= 4 ? argv[3] :"")); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Memory Model", xim->memModel); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Antialias Type", xim->antialiasType); + strcat (text, line); + strcat (text, "\n"); + + cm = &colormaps[DEF_COLORMAP-1]; + strcpy (cmapname, cm->name); + sprintf (line, "%20s: %s\n", "Current Colormap", cmapname); + strcat (text, line); + sprintf (line, "%20s: %d\n", "Colormaps Available", ncolormaps); + strcat (text, line); + sprintf (line, "%20s: %s\n", "User Cmap 1", xim->userCMap1); + strcat (text, line); + sprintf (line, "%20s: %s\n", "User Cmap 2", xim->userCMap1); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Cmap Dir 1", xim->userCMapDir1); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Cmap Dir 2", xim->userCMapDir2); + strcat (text, line); + strcat (text, "\n"); + sprintf (line, "%20s: %s\n", "Printer Config", xim->printConfig); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Printer File", xim->pcp->printFile); + strcat (text, line); + sprintf (line, "%20s: %s\n", "Printer Cmd", xim->pcp->printCmd); + strcat (text, line); +} + + +/* INFO_CLIENTS -- Helper routine to report client (display or ISM) state. + */ +info_clients (xim, text) +register XimDataPtr xim; +char *text; +{ + register IsmModule ism; + register int i; + char line[SZ_LINE], path[80]; + extern ismModule ism_modules[]; + extern int ism_nmodules; + + strcpy (text, "\t\tClient Communications Channels\n\n"); + + strcat (text, " Display Client Connections\t "); + strcat (text, "ISM Client Connections\n"); + strcat (text, " --------------------------\t "); + strcat (text, "----------------------\n"); + + if (xim->port) + sprintf (line, " inet: %d\t\t\t ", xim->port); + else + sprintf (line, " inet: Disabled\t\t"); + strcat (text, line); + + sprintf (path, xim->ism_addr, getuid()); + sprintf (line, "unix: %s\n", path); + strcat (text, line); + + if (strcmp(xim->unixaddr, "none") != 0) { + sprintf (path, xim->unixaddr, getuid()); + sprintf (line, " unix: %s\n", path); + } else + sprintf (line, " unix: Disabled\n"); + strcat (text, line); + + if (strcmp(xim->input_fifo,"") != 0 && + strcmp(xim->input_fifo,"none") != 0) + sprintf (line, " fifo: %s\n\t %s\n\n", + xim->input_fifo, xim->output_fifo); + else + sprintf (line, " fifo: Disabled\n\n"); + strcat (text, line); + + strcat (text, "\n"); + strcat (text, "\t\t Available ISM Components\n\n"); + strcat (text, " Name Channel Command\n"); + strcat (text, " ---- ------- -------\n"); + for (i=0; i < ism_nmodules; i++) { + ism = &ism_modules[i]; + sprintf (line, " %-9.9s %-15.15s '%s'\n", + ism->name, + (ism->connected ? ism->chan->path : "Disabled"), + ism->command); + strcat (text, line); + } +} + + +/* INFO_WCS -- Helper routine to report WCS and mapping information for + * each frame in the display. + */ +info_wcs (xim, text) +register XimDataPtr xim; +char *text; +{ + register FrameBufPtr fr = xim->df_p; + register CtranPtr ct = &fr->ctran; + register int i; + MappingPtr mp = (MappingPtr) NULL; + char line[SZ_LINE]; + + /* Write the current frame WCS. */ + sprintf (line, + "\t\tFrame %d WCS & Mappings\n\t\t------------------------\n\n", + fr->frameno); + strcat (text, line); + + strcat (text, "Frame WCS:\n"); + sprintf (line, " a = %9.3f\t b = %9.3f %s\n", + ct->a, ct->b, "# Scale factors"); + strcat (text, line); + + sprintf (line, " c = %9.3f\t d = %9.3f %s\n", + ct->c, ct->d, "# Cross factors"); + strcat (text, line); + + sprintf (line, " tx = %9.3f\tty = %9.3f %s\n", + ct->tx, ct->ty, "# Translation"); + strcat (text, line); + sprintf (line, " z1 = %9.3f\tz2 = %9.3f %s\n", + ct->z1, ct->z2, "# z-scale range"); + strcat (text, line); + + sprintf (line, " zt = %9s\t%30s\n", + (ct->zt == W_UNITARY ? "unitary" : + (ct->zt == W_LINEAR ? "linear" : + (ct->zt == W_LOG ? "log" : "unknown"))), + "# z-scale type\n"); + strcat (text, line); + + + fr = (FrameBufPtr) NULL; + for (i=0; i < xim->nframes; i++) { + fr = &xim->frames[i]; + if (xim->display_frame == fr->frameno) + break; + } + + if (!fr) { + strcat (text, " \n \n"); + return; + } + + for (i=0; i < fr->nmaps; i++) { + mp = &(fr->mapping[i]); + ct = &(mp->ctran); + + sprintf (line, "\nMapping %d: \n", mp->id); + strcat (text, line); + + sprintf (line, " a = %7.3f b = %7.3f\n", ct->a, ct->b); + strcat (text, line); + sprintf (line, " c = %7.3f d = %7.3f\n", ct->c, ct->d); + strcat (text, line); + sprintf (line, " tx = %7.3f ty = %7.3f\n", ct->tx, ct->ty); + strcat (text, line); + sprintf (line, " z1 = %7.3f z2 = %7.3f\tzt: %s\n", + ct->z1, ct->z2, + (ct->zt == W_UNITARY ? "unitary" : + (ct->zt == W_LINEAR ? "linear" : + (ct->zt == W_LOG ? "log" : "unknown"))) ); + strcat (text, line); + + sprintf (line, " region %d: %s\n", mp->regid, mp->region); + strcat (text, line); + sprintf (line, " src: x=%9f y=%9f nx=%d ny=%d\n", + mp->sx, mp->sy, mp->snx, mp->sny); + strcat (text, line); + sprintf (line, " dest: x=%9d y=%9d nx=%d ny=%d\n", + mp->dx, mp->dy, mp->dnx, mp->dny); + + strcat (text, line); + sprintf (line, " ref: %s\n", mp->ref); + strcat (text, line); + } + strcat (text, " \n \n"); +} + + +/* INFO_IMTOOLRC -- Helper routine to report the frame buffer configuration + * table. + */ +info_imtoolrc (xim, text) +register XimDataPtr xim; +char *text; +{ + register int last_fb_used = MAX_FBCONFIG; + register int i, w, h, nf, fb_config = xim->fb_configno; + char line[SZ_LINE]; + + strcpy (text, " Frame Buffer Configuration Table\n"); + strcat (text, " --------------------------------\n\n"); + + sprintf (line, " Imtoolrc File: %s\n", xim->imtoolrc); + strcat (text, line); + strcat (text, "\n Config NFrames\tWidth\tHeight\n"); + strcat (text, " ------ -------\t-----\t------\n"); + + /* Find the index of the last FB defined. */ + for (i=MAX_FBCONFIG; i > 1; i--) + if (xim->fb_config[i-1].width != DEF_FRAME_WIDTH || + xim->fb_config[i-1].height != DEF_FRAME_HEIGHT) { + last_fb_used = i; + break; + } + + /* Print out the frame buffer configurations. */ + for (i=1; i <= last_fb_used; i++) { + w = xim->fb_config[i-1].width; + h = xim->fb_config[i-1].height; + nf = xim->fb_config[i-1].nframes; + if (i > 1 && (w == DEF_FRAME_WIDTH && h == DEF_FRAME_HEIGHT)) { + sprintf (line, " %4d\t\t 0\t n/a\t n/a\n", i); + } else { + sprintf (line, " %4d\t\t%2d\t%5d\t%5d\t %s\n", + i, nf, w, h, ((i==fb_config) ? "<--- current" : " ")); + } + strcat (text, line); + } + strcat (text, " \n \n"); +} + + +/* windowRGB -- Window an individual component of an RGB colormap. We start + * with the currently defined cmap and scale it's component by the given + * offset and slope. A 'save' flag is set when the button is released meaning + * the user is done with that component and the loaded colormap is updated, + * otherwise continue changing that color from the previous call allowing us + * to window the color progressively. The GUI's 'initialize' option should + * restore the original colormap. [This is still test code.] + * + * Usage: windowRGB <color> <offset> <scale> <save> + * + * Options: color color to manipulate (1=Red,2=Green,3=Blue) + * offset offset of transformation + * scale slope of transformation + * save save to loaded colormap when complete? + */ + +static int +windowRGB (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register FrameBufPtr fb = xim->df_p; + register ColorMapPtr cm; + int color, first, nelem, maxelem, save = 0; + unsigned short r[MAX_COLORS]; + unsigned short g[MAX_COLORS]; + unsigned short b[MAX_COLORS]; + char buf[SZ_LINE]; + + + if (argc > 1) { + cm = &colormaps[fb->colormap-1]; + color = atoi(argv[1]); + fb->offset = atof(argv[2]); + fb->scale = (argc > 2) ? (float)atof(argv[3]) : fb->scale; + save = atoi(argv[4]); + + /* Query and read the current colormap. */ + GtQueryColormap (xim->gt, cm->mapno, &first, &nelem, &maxelem); + GtReadColormap (xim->gt, cm->mapno, first, nelem, r,g,b); + + /* compute the scaled colormap, scaling only the color we're + * interested in. + */ + switch (color) { + case 1: + cmapScale (r, nelem, first, fb->offset, fb->scale); + break; + case 2: + cmapScale (g, nelem, first, fb->offset, fb->scale); + break; + case 3: + cmapScale (b, nelem, first, fb->offset, fb->scale); + break; + } + + /* Lastly, write it back to the widget. */ + GtWriteColormap (xim->gt, 0, first, nelem, r, g, b); + if (save) + GtWriteColormap (xim->gt, cm->mapno, first, nelem, r, g, b); + } + + return (TCL_OK); +} + + +/* cmapScale -- Given a single-color cmap scale it with the given offset and + * slope, the scaling is done in place. + */ + +cmapScale (map, ncells, first, offset, slope) +unsigned short map[MAX_COLORS]; +int ncells, first; +float offset, slope; +{ + register int i, c1, c2; + register float x, y, z, frac; + unsigned short val, out[MAX_COLORS]; + + for (i=0; i < ncells; i++) { + x = (float)i / (float)(ncells - 1); + y = (x - offset) * slope + 0.5; + + if (y <= 0.0) { + val = map[first]; + } else if (y >= 1.0) { + val = map[ncells-1]; + } else { + z = y * (ncells - 1); + c1 = (int)z; + c2 = min (ncells-1, c1 + 1); + frac = z - c1; + val = map[c1] * (1.0 - frac) + map[c2] * frac; + } + + out[i] = val; + } + + for (i=0; i < MAX_COLORS; i++) + map[i] = out[i]; +} + + + +/* ISM_START -- Start the ISM task. The named task must be listed in + * the array of ISM modules. + * + * Usage: ism_start task + */ +static int +ism_start (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register IsmModule ism; + + if (argc < 2) + return (TCL_ERROR); + + /* Lookup the command for the task and start it. + */ + if ((ism = ismNameToPtr (argv[1]))) { + system (ism->command); + return (TCL_OK); + } + + /* Task not found, return an error. */ + return (TCL_ERROR); +} + + +/* ISM_STOP -- Stop the ISM task. The named task is told to shut itself + * down by executing the registered shutdown callback. We return OK if + * the shutdown can be executed, an ERR is returned if the named task is + * not currently running. + * + * Usage: ism_stop task + */ +static int +ism_stop (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register IsmModule ism; + + if (argc < 2) + return (TCL_ERROR); + + /* Lookup the command for the task and stop it. */ + if ((ism = ismNameToPtr (argv[1]))) { + (*ism->shutdownCB) (xim, ism); + ism->connected = 0; + return (TCL_OK); + } + + /* Task not found, return an error. */ + return (TCL_ERROR); +} + + +/* ISM_CMD -- Send a command to the named ISM command callback. Return + * values are sent as messages to the GUI 'ism_msg' parameter object, we + * simply pass the argv to the appropriate function. + * + * Usage: ism_cmd task <args> + */ +static int +ism_cmd (xc, tcl, argc, argv) +register XimClientPtr xc; +Tcl_Interp *tcl; +int argc; +char **argv; +{ + register XimDataPtr xim = xc->xim; + register IsmModule ism; + char **cmd_argv; + int cmd_argc; + + if (argc < 2) + return (TCL_ERROR); + + /* Lookup the command callback for the task and run it. */ + if ((ism = ismNameToPtr (argv[1]))) { + + /* Get local copy of argc and argv containing only the commands + * for the ISM callback. + */ + if ((cmd_argc = (argc - 2) > 0)) { + cmd_argv = (char **) XtMalloc (cmd_argc * sizeof(char *)); + memmove (cmd_argv, &argv[2], cmd_argc * sizeof(char *)); + } + + /* Process the command. */ + (*ism->commandCB) (xim, ism, cmd_argc, cmd_argv); + return (TCL_OK); + } + + /* Task not found, return an error. */ + return (TCL_ERROR); +} diff --git a/vendor/x11iraf/ximtool/ximprint.cfg b/vendor/x11iraf/ximtool/ximprint.cfg new file mode 100644 index 00000000..e552f2cd --- /dev/null +++ b/vendor/x11iraf/ximtool/ximprint.cfg @@ -0,0 +1,30 @@ +default lpr +clp lpr -Pclp +clp2 lpr -Pclp2 +clp2t lpr -Pclp2t +lw1 lpr -Plw1 +lw2 lpr -Plw2 +lw2 lpr -Plw3 +lw4 lpr -Plw4 +lw5 lpr -Plw5 +lw6 lpr -Plw6 +lw7 lpr -Plw7 +lw8 lpr -Plw8 +lw9 lpr -Plw9 +lw10 lpr -Plw10 +lw11 lpr -Plw11 +lw12 lpr -Plw12 +lw13 lpr -Plw13 +lw14 lpr -Plw14 +lw15 lpr -Plw15 +lw16 lpr -Plw16 +lw18 lpr -Plw18 +lw19 lpr -Plw19 +lw20 lpr -Plw20 +lw21 lpr -Plw21 +lw22 lpr -Plw22 +lw23 lpr -Plw23 +lw24 lpr -Plw24 +lw25 lpr -Plw25 +lw26 lpr -Plw26 +lw27 lpr -Plw27 diff --git a/vendor/x11iraf/ximtool/ximtool-alt.csh b/vendor/x11iraf/ximtool/ximtool-alt.csh new file mode 100755 index 00000000..631723ef --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool-alt.csh @@ -0,0 +1,98 @@ +#!/bin/csh -f +# +# XIMTOOL-ALT -- Script wrapper to start XImtool using the alternate GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# Arguments specific to this GUI include: +# +# -showToolBar <bool> show toolbar on startup +# -showPanelBar <bool> show panelbar on startup +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 99 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool V1.3 - Alternative GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm <resource>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else if ("$1" == "-showToolBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showToolBar <bool>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showToolBar:$1$q" + else if ("$1" == "-showPanelBar") then + if ("$2" != "") then + shift + else + echo "missing argument to '-showPanelBar <bool>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q XImtool.showPanelBar:$1$q" + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ +exit 0 + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-ALT.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + diff --git a/vendor/x11iraf/ximtool/ximtool-alt.gui b/vendor/x11iraf/ximtool/ximtool-alt.gui new file mode 120000 index 00000000..ef8416c6 --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool-alt.gui @@ -0,0 +1 @@ +ximtool.gui \ No newline at end of file diff --git a/vendor/x11iraf/ximtool/ximtool-old.csh b/vendor/x11iraf/ximtool/ximtool-old.csh new file mode 100755 index 00000000..37e859aa --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool-old.csh @@ -0,0 +1,78 @@ +#!/bin/csh -f +# +# XIMTOOL-OLD -- Script wrapper to start XImtool using the original GUI. +# The GUI file is contained is this script which is created when the system +# is built, it may be used to run any alternate GUI by simply replacing the +# Tcl script making up the GUI at the end of this script or by using the +# "-gui" command line flag. The only configurable item is the path to the +# XImtool binary to be used, by default the one found in the user's path will +# be used. +# +#---------------------------------------------------------------------------- + +# Configurable parameters +set XIMTOOL = ximtool # Path to default ximtool binary + + +#------------------------------------------------------------------ +#--------------- Do not modify below this line -------------------- +#------------------------------------------------------------------ +unset noclobber +onintr cleanup + +set SKIP = 79 # offset to GUI file + +# Dump the GUI from this script file. +tail +$SKIP $0 > /tmp/_gui.$$ + +# Check for no arguments. +set q = '"' +set cmd = "-gui /tmp/_gui.$$ -title $q XImtool V1.4 - Original GUI $q" + +# Process the script arguments, quoting args when necessary. +if ($#argv > 0) then + while ("$1" != "") + if ("$1" == "-xrm") then + if ("$2" != "") then + shift + else + echo "missing argument to '-xrm <resource>' switch" + exit 1 + endif + set cmd = "$cmd -xrm $q$1$q" + else if ("$1" == "-help") then + $XIMTOOL -help + exit 0 + else if ("$1" == "-defgui") then + tail +$SKIP $0 + exit 0 + else + set cmd = "$cmd $1" + endif + + if ("$2" == "") then + break + else + shift + endif + end +endif + +# Run the command. +echo "$XIMTOOL $cmd ; /bin/rm -f /tmp/_gui*.$$" > /tmp/_gui.cmds.$$ +sh /tmp/_gui.cmds.$$ +exit 0 + +cleanup: + /bin/rm -f /tmp/_gui*.$$ + exit 0 + +#-------------------------------------------------------------------------- +#-------------------------- XIMTOOL-OLD.GUI ------------------------------- +#------ ------ +#------ To change the GUI run by this script just delete everything ------ +#------ below here and replace with the new GUI Tcl script. ------ +#------ ------ +#-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- + diff --git a/vendor/x11iraf/ximtool/ximtool-old.gui b/vendor/x11iraf/ximtool/ximtool-old.gui new file mode 100644 index 00000000..9ffde34a --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool-old.gui @@ -0,0 +1,10873 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL.GUI -- Default GUI for the Ximtool image display server. +# +# Version 2.0 -- BETA VERSION + + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display \ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton \ + menubar MenuButton viewButton \ + menubar MenuButton optionsButton \ + menubar Label imageTitle \ + menubar Toggle controlButton \ + menubar Toggle xflipButton \ + menubar Toggle yflipButton \ + menubar Command prevButton \ + menubar MenuButton frameButton \ + menubar Command nextButton \ + menubar Toggle helpButton \ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +} + + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: Black + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: Black + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.foreground: Black + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: Black + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: Black + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: Black + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 0 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + -2 \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + vcutFrame < * +inf -inf > \ + } \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 plotOpts -4 } \ + } \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 0 + *hcutFrame.outerOffset: 0 + *hcutPlot.color0: #c4c4c4 + *hcutPlot.color1: black + *hcutPlot.color0: darkslategray + *hcutPlot.color1: #eeeee0 + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + *vcutPlot.color0: #c4c4c4 + *vcutPlot.color1: black + *vcutPlot.color0: darkslategray + *vcutPlot.color1: #eeeee0 + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 40 + *menuGroup.width: 518 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 1 < -1 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + controlButton 1 < -1 > \ + 1 < -1 > \ + xflipButton 1 < -1 > yflipButton \ + 1 < -1 > \ + prevButton 1 < -1 > frameButton 1 < -1 > nextButton \ + 1 < -1 > \ + helpButton \ + 1 < -1 > \ + } + + *menubar*SimpleMenu.borderColor: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: white + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *menubar.width: 518 + *menubar*borderWidth: 0 + *menubar*Command.label: x + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 518 + *imageFrame.height: 518 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 518 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>Left: call(moveFrame,-1,0) \n\ + !Ctrl <Key>Down: call(moveFrame,0,1) \n\ + !Ctrl <Key>Up: call(moveFrame,0,-1) \n\ + !Ctrl <Key>Right: call(moveFrame,1,0) \n\ + !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \n\ + !Ctrl <Key>a: call(toggleAutoReg) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>o: call(offset,$x,$y) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl <Key>\[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl <Key>\]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl <Key>0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(controlPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift<Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Up>: call(updateColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \n\ + !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + *colorbar.borderWidth: 0 + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.width: 50 + *colorbar.height: 17 +} + + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(magzoomMenu) + <Btn3Up>: popdown(magzoomMenu) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn2Up>: call(pannerPanXY,$x,$y) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>s: call(cpMatchFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +# This is a kludge to redraw the compass after it is erased when displaying +# a new image. Once the user moves the mouse back into the main window we'll +# do the redraw. +send imagewin addEventHandler drawCompass enterWindowMask + + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: call(deleteNamedRuler,NAME,$x,$y) + <Key>Delete: call(deleteNamedRuler,NAME,$x,$y) + <KeyPress>: m_input() + <Btn3Down>: call(setRulerMenu) popup(rulerMenu) + <Btn3Up>: popdown(rulerMenu) +!Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { tclPanel } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "<pre>%s\n%s</pre>" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + diff --git a/vendor/x11iraf/ximtool/ximtool.c b/vendor/x11iraf/ximtool/ximtool.c new file mode 100644 index 00000000..abb84d9e --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.c @@ -0,0 +1,640 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> +#include <errno.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/Error.h> +#include <Obm.h> + +#define XIMTOOL_MAIN +#include "ximtool.h" + +/* The X11IRAF version. */ +char *ximtool_version[] = { +# include "../version.h" + NULL +}; + + +/* + * XIMTOOL -- X11 based image display server and standalone image display + * client. This program is based on the IRAF prototype widget server (object + * manager library or OBM) and the gterm-image widget. + */ + +/* Compatibility hacks. */ +#ifdef AUX +void *memmove(a,b,n) void *a; const void *b; size_t n; { bcopy(b,a,n); } +#else +#if defined(sun) && !defined(SVR4) +void *memmove(a,b,n) void *a; void *b; size_t n; { bcopy(b,a,n); } +#endif +#endif + +/* Data. */ +XtAppContext app_context; +static char server[] = "server"; + +/* The builtin default GUI. */ +char *defgui_text[] = { +# include "ximtool.gui.h" + NULL +}; + + +#ifdef AUX +#define SIGFUNC sigfunc_t +#else +typedef void (*SIGFUNC)(); +#endif + +void xim_onsig(); + + +/* MAIN -- XImtool main program. This is the only ximtool routine containing + * window system specific code. + */ +main (argc, argv) +int argc; +char *argv[]; +{ + register XimDataPtr xim = &ximtool_data; + register int i; + register IsmModule ism; + + Screen *screen; + Visual *visual; + Widget toplevel; + XtPointer obm; + char **sv_argv, *init_file = NULL, *str; + int sv_argc, ncolors, base; + int depth, tile = 0; + + extern IsmModule ismNameToPtr(); + int xerror(), xioerror(); + + + /* Process the command line arguments. Scan the arglist first to see + * if we're requesting help or a printout of the default GUI, if so + * print these out and exit. + */ + if (argc > 1) { + if (strcmp (argv[1], "-help") == 0) { + Usage (); + exit (1); + + } else if (strcmp (argv[1], "-version") == 0) { + printf ("Version: %s\n", ximtool_version[0]); + exit (1); + + } else if (strcmp (argv[1], "-defgui") == 0) { + register int i; + for (i=0; defgui_text[i]; i++) + printf ("%s\n", defgui_text[i]); + exit (0); + } + } + + + /* Loop over the command line options and preprocess the ones that + * are widget/GUI resources we want to make available more easily. + * To do this we'll tweak the argument list so it appears to be a + * "-xrm" resource setting, this means the X initialization code + * below will do all the real work. + */ + for (i=1; i < argc; i++) { + + if (strcmp (argv[i], "-cmapName") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*cmapName:%s\0", str); + + } else if (strcmp (argv[i], "-maxColors") == 0) { + ncolors = atoi (argv[++i]); + ncolors = max (32, min (201, ncolors)); + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*maxColors:%d\0", ncolors); + + } else if (strcmp (argv[i], "-basePixel") == 0) { + base = atoi (argv[++i]); + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*basePixel:%d", base); + + } else if (strcmp (argv[i], "-cmapInitialize") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*cmapInitialize:%s", str); + + } else if (strcmp (argv[i], "-displayPanner") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*displayPanner:%s", str); + + } else if (strcmp (argv[i], "-displayMagnifier") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*displayMagnifier:%s", str); + + } else if (strcmp (argv[i], "-displayCoords") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*displayCoords:%s", str); + + } else if (strcmp (argv[i], "-printConfig") == 0) { + str = argv[++i]; + strcpy (argv[i-1], "-xrm\0"); + argv[i] = (char *) malloc (256); + sprintf (argv[i], "XImtool*printConfig:%s", str); + } + } + + /* Get local copy of argc and argv. */ + if ((sv_argc = argc) > 0) { + sv_argv = (char **) XtMalloc (argc * sizeof(char *)); + memmove (sv_argv, argv, argc * sizeof(char *)); + } else + sv_argv = argv; + + /* Initialize applications context. We don't use the top level + * shell created here, but we need to deal with it in order to + * get the application resources. The object manager opens its own + * connection to the display server and manages a separate window + * hierarchy with its own top level shell. + */ + xim->toplevel = toplevel = XtAppInitialize (&app_context, "XImtool", + (XrmOptionDescList) NULL, 0, &sv_argc, sv_argv, + (String *) NULL, (ArgList) NULL, 0); + + /* Free saved arglist. */ + free ((char *)sv_argv); + + /* Get application resources. */ + XtVaGetApplicationResources (xim->toplevel, xim, + resources, XtNumber(resources), + /* Add any resource overrides here */ + NULL); + + /* Check to see if we have the correct visual to proceed, if not + * shut down more gracefully and informatively than the BadMatch + * error from X that awaits us. + */ + +#ifdef PSEUDOCOLOR_ONLY + screen = XtScreen (toplevel); + visual = DefaultVisualOfScreen(screen); + depth = DefaultDepthOfScreen(screen); + if (depth != 8 || visual->class != PseudoColor) + xim_badVisual (depth, visual->class); +#endif + + + + /* Initialize the object manager. */ + xim->obm = obm = (XtPointer) ObmOpen (app_context, argc, argv); + ObmAddCallback (obm, OBMCB_setGterm|OBMCB_preserve, xim_reset, + (XtPointer)xim); + + + /* Loop over the command line options. The default xim structure + * should be defined at this point so the command options can be + * used to override them. + */ + for (i=1; i < argc; i++) { + + /* Anything without a '-' is a file name to load at startup. + * Only use the first name defined. + */ + if (argv[i][0] != '-') { /* File name */ + if (!init_file) { + init_file = argv[i]; + if (access (init_file, F_OK) < 0) { + fprintf (stderr, "%s: File does not exist: '%s'\n", + argv[0], init_file); + exit (1); + } else if (access (init_file, R_OK) < 0) { + fprintf (stderr, + "%s: File doesn't have read permission: '%s'\n", + argv[0], init_file); + exit (1); + } + } + + } else if (strcmp (argv[i], "-gui") == 0) { + xim->gui = argv[++i]; + + } else if (strcmp (argv[i], "-cmap1") == 0) { + xim->userCMap1 = argv[++i]; + + } else if (strcmp (argv[i], "-cmap2") == 0) { + xim->userCMap2 = argv[++i]; + + } else if (strcmp (argv[i], "-cmapDir1") == 0) { + xim->userCMapDir1 = argv[++i]; + + } else if (strcmp (argv[i], "-cmapDir2") == 0) { + xim->userCMapDir2 = argv[++i]; + + } else if (strcmp (argv[i], "-imtoolrc") == 0) { + xim->imtoolrc = argv[++i]; + + } else if (strcmp (argv[i], "-memModel") == 0) { + xim->memModel = argv[++i]; + + } else if (strcmp (argv[i], "-config") == 0) { + xim->def_config = atoi (argv[++i]); + + } else if (strcmp (argv[i], "-nframes") == 0) { + i++; + xim->def_nframes = min (MAX_FRAMES, atoi (argv[i])); + + } else if (strcmp (argv[i], "-tile") == 0) { + tile = ++xim->tileFrames; + + } else if (strcmp (argv[i], "-invert") == 0) { + xim->invert++; + + } else if (strcmp (argv[i], "-fifo") == 0) { + if (strcmp ("none", argv[i+1]) == 0) { + xim->input_fifo = "none"; + } else { + xim->input_fifo = malloc (strlen(argv[++i])+2); + xim->output_fifo = malloc (strlen(argv[i])+2); + sprintf (xim->input_fifo, "%si", argv[i]); + sprintf (xim->output_fifo, "%so", argv[i]); + } + + } else if (strcmp (argv[i], "-port") == 0) { + xim->port = atoi (argv[++i]); + + } else if (strcmp (argv[i], "-nports") == 0) { + xim->nports = atoi (argv[++i]); + + } else if (strcmp (argv[i], "-unix") == 0) { + xim->unixaddr = argv[++i]; + + } else if (strcmp (argv[i], "-fifo_only") == 0) { + xim->unixaddr = "none"; + xim->port = 0; + + } else if (strcmp (argv[i], "-inet_only") == 0 || + strcmp (argv[i], "-port_only") == 0 ) { + xim->input_fifo = ""; + xim->unixaddr = "none"; + + } else if (strcmp (argv[i], "-unix_only") == 0) { + xim->input_fifo = ""; + xim->port = 0; + + } else if (strcmp (argv[i], "-ismdev") == 0) { + if (strcmp ("none", xim->ism_addr) ) + xim->ism_addr = argv[++i]; + else + i++; + + + /* Skip any standard X toolkit flags, they're handled above. + */ + } else if (strcmp (argv[i], "-bg") == 0) { + i++; + } else if (strcmp (argv[i], "-fg") == 0) { + i++; + } else if (strcmp (argv[i], "-iconic") == 0) { + ; + } else if (strcmp (argv[i], "-display") == 0) { + i++; + } else if (strcmp (argv[i], "-geometry") == 0) { + i++; + } else if (strcmp (argv[i], "-title") == 0) { + i++; + } else if (strcmp (argv[i], "-xrm") == 0) { + i++; + + } else { + fprintf (stderr, "Unrecognized flag '%s'\n", argv[i]); + Usage(); + exit (1); + } + } + + + /* Initialize the ximtool/obm client code. */ + xim_clientOpen (xim); + + /* Load the Ximtool GUI. If the GUI name is "default" the builtin + * default GUI is used. This is stored as an array of text lines, + * which we must append newlines to and concatenate together to + * form the GUI message. + */ + if (strcmp (xim->gui, "default") == 0 || + (ObmDeliverMsgFromFile (obm, server, xim->gui) != 0)) { + + register char *ip, *op; + char *message; + int i; + + message = (char *) malloc (409600); + for (i=0, op=message; ip = defgui_text[i]; i++) { + while (*ip) + *op++ = *ip++; + *op++ = '\n'; + } + *op++ = '\0'; + + ObmDeliverMsg (obm, server, message); + free ((char *)message); + + } + + /* Activate the GUI. */ + ObmActivate (obm); + + /* Initialize the frame buffers and graphics pipeline. */ + xim->tileFrames = tile; + xim_initialize (xim, xim->def_config, xim->def_nframes, 1); + + /* Listen for a client connection. */ + xim_iisOpen (xim); + xim_ismOpen (xim); + + /* Display a pretty logo. */ + xim_displayLogo (xim); + + /* Initialize the hardcopy option and printer configuration. */ + xim_initPrinterOps (xim); + + /* Open the file Load/Save structures. */ + xim_initLoad (xim); + xim_initSave (xim); + + /* Load a file at startup if it was defined. */ + if ( init_file != NULL ) + xim_loadFile (xim, init_file, 1); + + /* Lookup the ISM command for the WCSPIX task and start it. + */ + if ((ism = ismNameToPtr ("wcspix"))) { + system (ism->command); + ism_message (ism, "wcspix", "initialize"); + } + + XSetErrorHandler(xerror); + XSetIOErrorHandler(xioerror); + + +/* signal (SIGINT, (SIGFUNC)xim_onsig);*/ + + /* EXECUTE */ + XtAppMainLoop (app_context); + + xim_shutdown (xim); +} + + +/* XIM_SHUTDOWN -- Terminate ximtool. + */ +xim_shutdown (xim) +register XimDataPtr xim; +{ + eps_close (xim->psim); + xim_loadClose (xim); + xim_saveClose (xim); + xim_clientClose (xim); + xim_iisClose (xim); + xim_ismClose (xim); + xim_close (xim); + ObmClose (xim->obm); + exit (0); +} + + +/* XIM_ADDINPUT -- Register a procedure to be called when there is input + * to be processed on the given input source. The ximtool code doesn't + * talk to X directly so we need to provide this interface routine. + */ +XtPointer +xim_addInput (xim, input, proc, client_data) +register XimDataPtr xim; +int input; +void (*proc)(); +XtPointer client_data; +{ + return ((XtPointer) XtAppAddInput (app_context, input, + (XtPointer)XtInputReadMask, *proc, client_data)); +} + + +/* XIM_REMOVEINPUT -- Remove a callback previously posted with xim_addInput. + */ +void +xim_removeInput (xim, id) +register XimDataPtr xim; +XtPointer id; +{ + XtRemoveInput ((XtInputId)id); +} + + +/* USAGE -- Print a list of command-line options. + */ +Usage () +{ + fprintf (stderr, "Usage:\n\n"); + printoption (" ximtool"); + printoption ("[-basePixel <num>]"); /* base cmap pixel */ + printoption ("[-cmap1 <file>]"); /* User cmap 1 */ + printoption ("[-cmap2 <file>]"); /* User cmap 2 */ + printoption ("[-cmapDir1 <dir>]"); /* User cmapDir 1 */ + printoption ("[-cmapDir2 <dir>]"); /* User cmapDir 2 */ + printoption ("[-cmapInitialize <bool>]"); /* initialize colormap */ + printoption ("[-cmapName <name>]"); /* colormap name */ + printoption ("[-config <num>]"); /* initial config */ + printoption ("[-defgui]"); /* Print default GUI */ + printoption ("[-displayPanner <bool>]"); /* display panner box */ + printoption ("[-displayMagnifier <bool>]"); /* display magnifier box */ + printoption ("[-displayCoords <bool>]"); /* display wcs coords box */ + printoption ("[-fifo <pipe>]"); /* fifo pipe */ + printoption ("[-fifo_only]"); /* use fifo only */ + printoption ("[-gui <file>]"); /* GUI file */ + printoption ("[-help]"); /* Print help */ + printoption ("[-imtoolrc <file>]"); /* fbconfig file */ + printoption ("[-inet_only | -port_only]"); /* use inet only */ + printoption ("[-invert]"); /* invert colormap */ + printoption ("[-ismdev <dev>]"); /* ISM device template */ + printoption ("[-maxColors <num>]"); /* # of colors */ + printoption ("[-memModel <type>]"); /* memory model */ + printoption ("[-nframes <num>]"); /* # of frames */ + printoption ("[-port <num>]"); /* inet port */ + printoption ("[-printConfig <name>]"); /* printer config file */ + printoption ("[-tile]"); /* tile frames */ + printoption ("[-unix <name>]"); /* unix socket */ + printoption ("[-unix_only]"); /* use unix only */ + printoption ("[<file>]"); /* file to load */ + fprintf (stderr,"\n"); +} + + +/* PRINTOPTION -- Pretty-print an option string. + */ +static int cpos = 0; +printoption(st) +char *st; +{ + if (strlen(st) + cpos > 78) { + fprintf (stderr,"\n\t"); + cpos = 8; + } + fprintf (stderr,"%s ",st); + cpos = cpos + strlen(st) + 1; +} + + +/* xim_badVisual -- A bad X visual has been detected for the screen which + * will cause us to crash with a BadMatch error. Instead, abort with a + * more informative message so the user can correct the visual. + */ +xim_badVisual (depth, class) +int depth; +int class; +{ + fprintf (stderr, + "\nERROR: Detected incorrect X visual: depth=%d class=", depth); + switch (class) { + case StaticGray: fprintf (stderr, "StaticGray\n") ; break; + case GrayScale: fprintf (stderr, "GrayScale\n") ; break; + case StaticColor: fprintf (stderr, "StaticColor\n") ; break; + case PseudoColor: fprintf (stderr, "PseudoColor\n") ; break; + case TrueColor: fprintf (stderr, "TrueColor\n") ; break; + case DirectColor: fprintf (stderr, "DirectColor\n") ; break; + default: fprintf (stderr, "DirectColor\n") ; break; + } + + fprintf (stderr, "\n"); + fprintf (stderr, + "XImtool currently requires an 8-bit PseudoColor visual in order\n"); + fprintf (stderr, + "to operate properly. Unfortunately the only workaround for this\n"); + fprintf (stderr, + "at present is to start an 8-bit server using commands such as\n\n"); + fprintf (stderr, + " %% startx -- -bpp 8\t\t\t\t\t # XFree86 V3.x\n"); + fprintf (stderr, + " %% startx -- -depth 8\t\t\t\t # XFree86 V4.x\n"); + fprintf (stderr, + " %% Xsun :0 -dev /dev/fb defclass PseudoColor defdepth 8 # Sun\n"); + fprintf (stderr, + " %% Xdec -vclass0 PseudoColor\t\t\t\t # Digital Unix\n"); + fprintf (stderr, + "\nThe actual commands used will vary depending on the platform,\n"); + fprintf (stderr, + "window manager/desktop used, and in some cases video hardware.\n"); + fprintf (stderr, + "See the Xserver(1) and xinit(1) man page for details. Users should\n"); + fprintf (stderr, + "also contact IRAF site support (iraf@noao.edu) with any questions\n"); + fprintf (stderr, + "or problems.\n\n"); + + exit (1); +} + + + +#define ERROR_XERROR 83 /* xerror: XError event */ +#define ERROR_XIOERROR 84 /* xioerror: X I/O error */ + +/* XERROR -- Handle an XLIB server error. A standard X error message is + * printed and then the program either dumps core, exits, or ignores the error, + * depending upon the value of the environment variable XGXERROR, if defined. +*/ +/*ARGSUSED*/ +xerror (display, event) +Display *display; +register XErrorEvent *event; +{ + static char *envvar = "XGXERROR"; + static int nerrs = 0; + extern char *getenv(); + char fname[128]; + char *action; + int pid; + + fprintf (stderr, "ximtool: warning, error event received:\n"); + (void) XmuPrintDefaultErrorMessage (display, event, stderr); + if (nerrs++ > 50) + exit (ERROR_XERROR); + + if (action = getenv (envvar)) { + if (strcmp (action, "dumpcore") == 0) { + if ((pid = fork()) >= 0) { + if (pid) { + fprintf (stderr, "dumping core... "); + fflush (stderr); + sprintf (fname, "core.%d", pid); + wait(NULL); rename ("core", fname); + fprintf (stderr, "core file core.%d written\n", pid); + fflush (stderr); + } else + kill (getpid(), 6); + } else + fprintf (stderr, "fork failed, no core dump produced\n"); + } else if (strcmp (action, "exit") == 0) { + fprintf (stderr, "program terminated\n"); + exit (ERROR_XERROR); + } else + fprintf (stderr, "%s: unknown action %s\n", envvar, action); + } + fflush (stderr); + + return (0); +} + + +/*ARGSUSED*/ +xioerror(dpy) +Display *dpy; +{ + char *SysErrorMsg(); + + (void) fprintf (stderr, + "ximtool: fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n", + errno, SysErrorMsg (errno), + DisplayString (dpy)); + + exit (ERROR_XIOERROR); +} + +void xt_error(message) + String message; +{ + (void) fprintf (stderr, "ximtool Xt error: %s\n", message); + exit (1); +} + + +char *SysErrorMsg (n) + int n; +{ + return((n >= 0) ? (char *)strerror(n) : "unknown error"); +} + + +/* XIM_ONSIG -- Catch interrupt and shutdown gracefully. + */ +void +xim_onsig (sig, code, scp) +int sig; /* signal which was trapped */ +int *code; /* not used */ +int *scp; /* not used */ +{ + xim_shutdown (&ximtool_data); +} + diff --git a/vendor/x11iraf/ximtool/ximtool.gui b/vendor/x11iraf/ximtool/ximtool.gui new file mode 100644 index 00000000..d9780811 --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.gui @@ -0,0 +1,11567 @@ +#!/usr/local/bin/obmsh +# +# XIMTOOL-ALT.GUI -- Default GUI for the Ximtool-alt image display server. +# +# Version 2.0 -- BETA VERSION + +set Version "NOAO/IRAF XImtool Version 2.0BETA" + +reset-server + +set Objects(ximtool) { \ + toplevel Layout display\ +\ + display Group menuGroup\ + menuGroup Layout menubar\ + menubar MenuButton fileButton\ + menubar MenuButton viewButton\ + menubar MenuButton optionsButton\ + menubar Label imageTitle\ + menubar Toggle mXflipButton\ + menubar Toggle mYflipButton\ + menubar Command mPrevButton\ + menubar MenuButton mFrameButton\ + menubar Command mNextButton\ + menubar Toggle toolButton\ + menubar Toggle panelButton\ +\ + display Layout toolbar\ + toolbar Command tbZoomIn\ + toolbar Command tbZoom0\ + toolbar Command tbZoomOut\ + toolbar Command tbInvert\ + toolbar Command tbNormalize\ + toolbar Command tbMatchLUT\ + toolbar Toggle tbAutoReg\ + toolbar Command tbRegister\ + toolbar Command tbCenter\ + toolbar Command tbBlinkDec\ + toolbar Toggle tbBlink\ + toolbar Command tbBlinkInc\ + toolbar Toggle xflipButton\ + toolbar Toggle yflipButton\ + toolbar Toggle tbTile\ + toolbar Toggle tbCompass\ + toolbar Command prevButton\ + toolbar MenuButton frameButton\ + toolbar Command nextButton\ +\ + display Frame imageFrame\ + imageFrame Gterm imagewin\ + display Frame cbarFrame\ + cbarFrame Gterm colorbar\ + display Toggle hcut\ + display Toggle vcut\ + display Frame hcutFrame\ + hcutFrame Gterm hcutPlot\ + display Frame vcutFrame\ + vcutFrame Gterm vcutPlot\ + display Slider2d focusSlider\ +\ + display Group plotOpts\ + plotOpts Layout poptsLayout\ + poptsLayout TextToggle plotSpeed\ + poptsLayout TextToggle plotAccurate\ + poptsLayout TextToggle plotImgPix\ + poptsLayout Frame optLine\ + poptsLayout TextToggle curJump\ + poptsLayout TextToggle curSmooth\ + poptsLayout TextToggle curTrack\ +\ + display Layout panelbar\ + panelbar Toggle pbDisplayP\ + panelbar Toggle pbLoadP\ + panelbar Toggle pbSaveP\ + panelbar Toggle pbPrintP\ + panelbar Toggle pbInfoP\ + panelbar Toggle pbTileP\ + panelbar Toggle pbCoordP\ + panelbar Toggle pbPanM\ + panelbar Toggle pbMagM\ + panelbar Toggle pbWcsM\ + panelbar Toggle pbIsm\ + panelbar Toggle helpButton\ + panelbar Command pbQuit\ +} + + +set Objects(panelShell) { \ + toplevel TopLevelShell panelShell\ + panelShell Layout panel\ +\ + panel Frame panelMenuFrame\ + panelMenuFrame Layout panelMenuBar\ + panelMenuBar Command panelHelp\ + panelMenuBar Command panelClose\ +\ + panel Frame tabFrame\ + tabFrame Tabs panelTabs\ + panelTabs Frame display_panel\ + panelTabs Frame print_panel\ + panelTabs Frame load_panel\ + panelTabs Frame save_panel\ + panelTabs Frame info_panel\ + panelTabs Frame tile_panel\ + panelTabs Frame wcs_panel\ +\ +\ + display_panel Layout controlPanel\ + controlPanel Group viewBox\ + controlPanel Group enhancementBox\ + controlPanel Group blinkBox\ + controlPanel Group optionsBox\ + controlPanel Frame controlBox\ +\ + viewBox Layout view\ + view Group frameSelect\ + frameSelect Layout frameBox\ + frameBox Box frlistBox\ + frlistBox Viewport framePort\ + framePort Layout frameList\ + frameList TextToggle frame1\ + frameList TextToggle frame2\ + frameList TextToggle frame3\ + frameList TextToggle frame4\ + frameList TextToggle frame5\ + frameList TextToggle frame6\ + frameList TextToggle frame7\ + frameList TextToggle frame8\ + frameList TextToggle frame9\ + frameList TextToggle frame10\ + frameList TextToggle frame11\ + frameList TextToggle frame12\ + frameList TextToggle frame13\ + frameList TextToggle frame14\ + frameList TextToggle frame15\ + frameList TextToggle frame16\ + frameBox Command prevFrame\ + frameBox Command nextFrame\ + view Frame frameDataBox\ + frameDataBox TextBox frameData\ + view Group zoomBox\ + zoomBox Layout zoom\ + zoom TextButton toggleZoom\ + zoom TextButton zoomIn\ + zoom Command x1\ + zoom Command z2\ + zoom Command z3\ + zoom Command z4\ + zoom Command z5\ + zoom Command z8\ + zoom TextButton zoomOut\ + zoom TextButton centerFrame\ + zoom Command d2\ + zoom Command d3\ + zoom Command d4\ + zoom Command d5\ + zoom Command d8\ + view Layout viewButtons\ + viewButtons Command aspect\ + viewButtons Command flipX\ + viewButtons Command flipY\ + viewButtons Command flipXY\ + viewButtons Command clearFrame\ + viewButtons Command fitFrame\ +\ + enhancementBox Layout enhance\ + enhance Frame colorlistFrame\ + colorlistFrame Viewport colorlistView\ + colorlistView MultiList colorlist\ + enhance Frame colordataFrame\ + colordataFrame TextBox colordata\ + enhance Label contrastLabel\ + enhance Slider2d contrastSlider\ + enhance Label brightnessLabel\ + enhance Slider2d brightnessSlider\ + enhance Command invertButton\ + enhance Command optimizeButton\ +\ + blinkBox Layout blink\ + blink Label blinkFramesLabel\ + blink Command blinkFrame1\ + blink Command blinkFrame2\ + blink Command blinkFrame3\ + blink Command blinkFrame4\ + blink Toggle blinkPanel\ + blink Command blinkReset\ + blink Label blinkRateLabel\ + blink Frame BRframe\ + BRframe Layout BRlayout\ + BRlayout Arrow BRdecrease\ + BRlayout TextBox BRtext\ + BRlayout Arrow BRincrease\ + blink Command registerButton\ + blink Command matchButton\ + blink TextToggle blinkButton\ + blink TextToggle autoregButton\ +\ + optionsBox TextToggle pannerButton\ + optionsBox TextToggle magnifierButton\ + optionsBox TextToggle coordsBoxButton\ + optionsBox TextToggle autoscaleButton\ + optionsBox TextToggle antialiasButton\ + optionsBox TextToggle tileFramesButton\ + optionsBox TextToggle warningsButton\ + optionsBox TextToggle peakupButton\ +\ + controlBox Layout control\ + control Command initializeButton\ + control Command normalizeButton\ +\ +\ + print_panel Layout printLayout\ +\ + printLayout Group printCmdGroup\ + printLayout Group optGroup\ + printLayout Group cmdGroup\ +\ + printCmdGroup Layout printCmdLayout\ + printCmdLayout Layout labelLayout\ + labelLayout Label toLabel\ + labelLayout Label printerLabel\ + printCmdLayout Layout inputLayout\ + inputLayout TextToggle toPrinter\ + inputLayout TextToggle toFile\ + inputLayout Frame printcmdFrame\ + printcmdFrame AsciiText printcmd\ +\ + optGroup Layout optLayout\ + optLayout Group epsPageGroup\ + optLayout Group optionsGroup\ + optLayout Group printColorGroup\ + optLayout Group printerGroup\ + optLayout Group annOptsGroup\ +\ + epsPageGroup Layout epsPage\ + epsPage Label epsOrientLabel\ + epsPage TextToggle epsPortButton\ + epsPage TextToggle epsLandButton\ + epsPage TextToggle epsSquareButton\ + epsPage Label epsSizeLabel\ + epsPage TextToggle epsLetterButton\ + epsPage TextToggle epsLegalButton\ + epsPage TextToggle epsA4Button\ + epsPage TextToggle epsB5Button\ + epsPage Label epsScaleLabel\ + epsPage Frame ScaleFrame\ + ScaleFrame Layout ScaleLayout\ + ScaleLayout Arrow SCdecrease\ + ScaleLayout TextBox SCtext\ + ScaleLayout Arrow SCincrease\ +\ + optionsGroup Layout options\ + options TextToggle epsscaleButton\ + options TextToggle autorotateButton\ + options TextToggle aspectButton\ + options TextToggle compressButton\ +\ + annOptsGroup Layout annOpts\ + annOpts TextToggle annotateButton\ + annOpts TextToggle colorbarButton\ + annOpts TextToggle titleButton\ + annOpts TextToggle bordersButton\ + annOpts Label titleLabel\ + annOpts Frame titleFrame\ + titleFrame AsciiText titleString\ +\ + printColorGroup Layout printColor\ + printColor TextToggle prGrayButton\ + printColor TextToggle prPseudoButton\ + printColor TextToggle prRGBButton\ +\ + printerGroup Layout printers\ + printers Frame printlistFrame\ + printlistFrame Viewport printlistView\ + printlistView MultiList printlist\ +\ + cmdGroup Layout cmdLayout\ + cmdLayout Command okayPrint\ + cmdLayout Label printStatus\ +\ +\ + load_panel Layout filesLayout\ + filesLayout Group imlistGroup\ + imlistGroup Layout imlistLayout\ + imlistLayout Command rootButton\ + imlistLayout Command homeButton\ + imlistLayout Command upButton\ + imlistLayout Command rescanButton\ + imlistLayout Label dirLabel\ + imlistLayout Label fnameLabel\ + imlistLayout Frame filnamFrame\ + filnamFrame AsciiText fnameText\ + imlistLayout Label imtemplateLabel\ + imlistLayout Frame imtemplateFrame\ + imtemplateFrame AsciiText imtemplateText\ + imlistLayout Label imlistLabel\ + imlistLayout Frame imlistFrame\ + imlistFrame Viewport imlistView\ + imlistView MultiList imageList\ +\ + filesLayout Group imoptsGroup\ + imoptsGroup Layout imoptsLayout\ + imoptsLayout TextToggle grayscale\ + imoptsLayout TextToggle autoload\ + imoptsLayout TextToggle browseHdrs\ + imoptsLayout TextToggle zscale\ + imoptsLayout TextToggle zrange\ + imoptsLayout Label z1Label\ + imoptsLayout Frame z1Frame\ + z1Frame AsciiText z1Value\ + imoptsLayout Label z2Label\ + imoptsLayout Frame z2Frame\ + z2Frame AsciiText z2Value\ + imoptsLayout Label nsampLabel\ + imoptsLayout Frame nsampFrame\ + nsampFrame AsciiText nsampValue\ + imoptsLayout Label frameLabel\ + imoptsLayout MenuButton frameFrame\ +\ + filesLayout Group loadCmdGroup\ + loadCmdGroup Layout loadCmdLayout\ + loadCmdLayout Command filesLoadButton\ + loadCmdLayout Label filesStatus\ +\ +\ + save_panel Layout saveLayout\ + saveLayout Group saveNameGroup\ + saveNameGroup Layout saveNameLayout\ + saveNameLayout Label saveLabel\ + saveNameLayout Frame fnameFrame\ + fnameFrame AsciiText saveFile\ +\ + saveLayout Group saveOptGroup\ + saveOptGroup Layout saveOptLayout\ + saveOptLayout Group fmtGroup\ + saveOptLayout Group saveColorGroup\ + saveOptLayout Frame saveDataBox\ + saveDataBox TextBox saveData\ +\ + fmtGroup Layout formats\ + formats TextToggle rasButton\ + formats TextToggle gifButton\ + formats TextToggle jpegButton\ + formats TextToggle tiffButton\ + formats TextToggle fitsButton\ + formats TextToggle epsButton\ + formats TextToggle x11Button\ + formats TextToggle rawButton\ +\ + saveColorGroup Layout saveColor\ + saveColor TextToggle svGrayButton\ + saveColor TextToggle svPseudoButton\ + saveColor TextToggle svRGBButton\ +\ + saveLayout Group saveCmdGroup\ + saveCmdGroup Layout saveCmdLayout\ + saveCmdLayout Command okaySave\ + saveCmdLayout Label saveStatus\ +\ +\ + info_panel Layout infoLayout\ + infoLayout Group infoBox\ + infoBox Layout infoBoxL\ + infoBoxL Frame infoFrame\ + infoFrame AsciiText infoText\ + infoBoxL TextToggle infoOptFr\ + infoBoxL TextToggle infoOptWCS\ + infoBoxL TextToggle infoOptSvr\ + infoBoxL TextToggle infoOptClients\ + infoBoxL TextToggle infoOptIsm\ + infoBoxL TextToggle infoOptFB\ +\ +\ + wcs_panel Layout wcsLayout\ + wcsLayout Group wcsGroup\ + wcsGroup Layout wcsBox\ +\ + wcsBox Frame wcsFrame\ + wcsFrame Layout wcsText\ + wcsText AsciiText wtName\ + wcsText AsciiText wtTitle\ + wcsText AsciiText wtFBCfg\ + wcsText AsciiText wtIPixval\ + wcsText AsciiText wtSPixval\ + wcsText AsciiText wtBPixval\ + wcsText AsciiText wtWcs1\ + wcsText AsciiText wtWcs2\ + wcsText AsciiText wtWcs3\ + wcsText AsciiText wtWcs4\ +\ + wcsBox TextToggle ismToggle\ + wcsBox TextToggle pixelTable\ + wcsBox TextToggle imageHeader\ + wcsBox TextToggle compass\ + wcsBox TextToggle wcsOptions\ +\ +\ + wcsLayout Group wcsOptGroup\ + wcsOptGroup Layout wcsOptLayout\ +\ + wcsOptLayout Group wcsCoords\ + wcsCoords Layout wcLayout\ + wcLayout Label wcTitle\ + wcLayout Frame wcLine\ + wcLayout Label wlWcs1\ + wcLayout Label wlWcs2\ + wcLayout Label wlWcs3\ + wcLayout Label wlWcs4\ + wcLayout MenuButton sysWcs1\ + wcLayout MenuButton sysWcs2\ + wcLayout MenuButton sysWcs3\ + wcLayout MenuButton sysWcs4\ + wcLayout MenuButton fmtWcs1\ + wcLayout MenuButton fmtWcs2\ + wcLayout MenuButton fmtWcs3\ + wcLayout MenuButton fmtWcs4\ + wcLayout TextToggle wpWcs1\ + wcLayout TextToggle wpWcs2\ + wcLayout TextToggle wpWcs3\ + wcLayout TextToggle wpWcs4\ + wcLayout TextToggle wiWcs1\ + wcLayout TextToggle wiWcs2\ + wcLayout TextToggle wiWcs3\ + wcLayout TextToggle wiWcs4\ +\ + wcsOptLayout Group wcsOpts\ + wcsOpts Layout woLayout\ + woLayout TextToggle woptLabels\ + woLayout TextToggle woptTitles\ + woLayout TextToggle woptFBinfo\ + woLayout TextToggle woptBPM\ +\ + wcsOptLayout Group wcsIsmGroup\ + wcsIsmGroup Layout wcsIsmLayout\ + wcsIsmLayout Label wcsIsmLabel\ + wcsIsmLayout Frame wcsIsmFrame\ + wcsIsmFrame AsciiText wcsIsmCmd\ + wcsIsmLayout Command wcsIsmInit\ +\ +\ + tile_panel Frame tileOpts\ + tileOpts Layout toptLayout\ + toptLayout Group tFramesG\ + toptLayout Group tileMode\ + tileMode TextToggle tileDisabled\ + tileMode TextToggle tileManual\ + tileMode TextToggle tileBest\ + tileMode TextToggle tileSquare\ + tileMode TextToggle tileHorizontal\ + tileMode TextToggle tileVertical\ + tileMode TextToggle tileRow\ + tileMode TextToggle tileCol\ + toptLayout Group userOrientG\ + toptLayout Group fillStyle\ + fillStyle TextToggle byCols\ + fillStyle TextToggle bottomUp\ + toptLayout Group tileLabel\ + tileLabel TextToggle labelImname\ + tileLabel TextToggle labelTitles\ + tileLabel TextToggle labelFrames\ + toptLayout Frame geomFrame\ + geomFrame Label tileGeometry\ +\ + userOrientG Layout userOrientL\ + userOrientL Label nrowLab\ + userOrientL Frame nrFrame\ + nrFrame Layout nrLayout\ + nrLayout Arrow nrdecrease\ + nrLayout Label nrtext\ + nrLayout Arrow nrincrease\ + userOrientL Label ncolLab\ + userOrientL Frame ncFrame\ + ncFrame Layout ncLayout\ + ncLayout Arrow ncdecrease\ + ncLayout Label nctext\ + ncLayout Arrow ncincrease\ +\ + tFramesG Layout tFrames\ + tFrames Command tAll\ + tFrames Command tNone\ + tFrames Toggle tFrame1\ + tFrames Toggle tFrame2\ + tFrames Toggle tFrame3\ + tFrames Toggle tFrame4\ + tFrames Toggle tFrame5\ + tFrames Toggle tFrame6\ + tFrames Toggle tFrame7\ + tFrames Toggle tFrame8\ + tFrames Toggle tFrame9\ + tFrames Toggle tFrame10\ + tFrames Toggle tFrame11\ + tFrames Toggle tFrame12\ + tFrames Toggle tFrame13\ + tFrames Toggle tFrame14\ + tFrames Toggle tFrame15\ + tFrames Toggle tFrame16\ +} + + +set Objects(parameters) { \ + toplevel Parameter ximtool\ + ximtool Parameter alert\ + ximtool Parameter initialize\ + ximtool Parameter resize\ + ximtool Parameter frame\ + ximtool Parameter nframes\ + ximtool Parameter frameSize\ + ximtool Parameter frameRegion\ + ximtool Parameter frameView\ + ximtool Parameter frameTitle\ + ximtool Parameter frameFit\ + ximtool Parameter enhancement\ + ximtool Parameter colortables\ + ximtool Parameter cmfocus\ + ximtool Parameter autoscale\ + ximtool Parameter antialias\ + ximtool Parameter tileFrames\ + ximtool Parameter cursorMode\ + ximtool Parameter xflip\ + ximtool Parameter yflip\ + ximtool Parameter printerList\ + ximtool Parameter printOptions\ + ximtool Parameter loadOptions\ + ximtool Parameter saveOptions\ + ximtool Parameter tileOptions\ + ximtool Parameter filelist\ + ximtool Parameter help\ + ximtool Parameter info\ + ximtool Parameter ism_msg\ +} + + +set Objects(help_panel) { \ + toplevel TopLevelShell help_panel\ + help_panel Layout helpLayout\ + helpLayout Group helpMenuGroup\ + helpMenuGroup Layout helpMenubar\ + helpLayout Layout helpInfoLayout\ +\ + helpMenubar Command helpClose\ +\ + helpLayout Command helpBack\ + helpLayout Command helpForward\ + helpLayout Command helpHome\ + helpLayout Frame hfFrame\ + hfFrame AsciiText hfEntry\ + helpLayout Command hfFind\ + helpLayout Command hfClear\ + helpLayout Frame helpTextFrame\ + helpTextFrame HTML helpText\ +\ + helpInfoLayout Label helpIRAFLogo\ + helpInfoLayout Label helpInfo1\ + helpInfoLayout Label helpInfo2\ + helpInfoLayout Label helpInfo3\ + helpInfoLayout Label helpNOAOLogo\ +} + + +set Objects(blink_panel) { \ + toplevel TopLevelShell blink_panel\ + blink_panel Layout bpLayout\ +\ + bpLayout Frame brMenuFrame\ + brMenuFrame Layout brMenuBar\ + brMenuBar Command brClose\ +\ + bpLayout Frame brFrame\ + brFrame Layout brLayout\ +\ + brLayout Group brFramesG\ + brFramesG Layout brFrames\ + brFrames MenuButton brFrame1\ + brFrames MenuButton brFrame2\ + brFrames MenuButton brFrame3\ + brFrames MenuButton brFrame4\ + brFrames MenuButton brFrame5\ + brFrames MenuButton brFrame6\ + brFrames MenuButton brFrame7\ + brFrames MenuButton brFrame8\ + brFrames MenuButton brFrame9\ + brFrames MenuButton brFrame10\ + brFrames MenuButton brFrame11\ + brFrames MenuButton brFrame12\ + brFrames MenuButton brFrame13\ + brFrames MenuButton brFrame14\ + brFrames MenuButton brFrame15\ + brFrames MenuButton brFrame16\ +\ + brLayout Group brCmdG\ + brCmdG Layout brCmd\ + brCmd Command brReset\ + brCmd Label brRateLabel\ + brCmd Frame brBRframe\ + brBRframe Layout brBRlayout\ + brBRlayout Arrow brBRdecrease\ + brBRlayout TextBox brBRtext\ + brBRlayout Arrow brBRincrease\ + brCmd Command brRegButton\ + brCmd Command brMatchButton\ + brCmd TextToggle brBlinkButton\ + brCmd TextToggle brAregButton\ +} + + +set Objects(hdr_panel) { \ + toplevel TopLevelShell hdr_panel\ + hdr_panel Layout hdrLayout\ +\ + hdrLayout Frame hdrMenuFrame\ + hdrMenuFrame Layout hdrMenuBar\ + hdrMenuBar Command hdrClose\ +\ + hdrLayout Group hdrObjGroup\ + hdrObjGroup Layout hdrObjLayout\ + hdrObjLayout Label hdrObjLabel\ + hdrObjLayout MenuButton hdrObjMenu\ +\ + hdrLayout Frame hdrTabFrame\ + hdrTabFrame Tabs hdrTabs\ + hdrTabs Group hdrHdrGroup\ + hdrTabs Group hdrWcsGroup\ +\ + hdrHdrGroup Layout hdrHdrLayout\ + hdrHdrLayout Frame hFindFrame\ + hFindFrame AsciiText hFindEntry\ + hdrHdrLayout Command hdrFilter\ + hdrHdrLayout Command hdrFind\ + hdrHdrLayout Command hdrClear\ + hdrHdrLayout HTML hdrText\ +\ + hdrWcsGroup Layout hdrWcsLayout\ + hdrWcsLayout Group hdrInfoGroup\ + hdrInfoGroup Frame hdrIGFrame\ + hdrIGFrame AsciiText hdrIGText\ + hdrWcsLayout Group hdrKeywGroup\ + hdrKeywGroup Frame hdrKGFrame\ + hdrKGFrame AsciiText hdrKGText\ +} + + +set Objects(pixel_table) { \ + toplevel TopLevelShell pixel_panel\ +\ + pixel_panel Layout pixel_table\ + pixel_table Frame pixtabMenuFrame\ + pixtabMenuFrame Layout pixtabMenuBar\ + pixtabMenuBar MenuButton pixtabSize\ + pixtabMenuBar Command pixtabHelp\ + pixtabMenuBar Command pixtabClose\ +\ + pixel_table Frame pixtabFrame\ + pixtabFrame Porthole ptPort\ + ptPort Layout ptLayout\ + ptLayout Frame ptColFrame\ + ptColFrame MultiList ptColLabs\ + ptLayout Frame ptRowFrame\ + ptRowFrame MultiList ptRowLabs\ + ptLayout Frame ptFrame\ + ptFrame MultiList pixtab\ +\ + ptLayout Label meanLabel\ + ptLayout Frame meanFrame\ + meanFrame Label meanValue\ +\ + ptLayout Label sigLabel\ + ptLayout Frame sigFrame\ + sigFrame Label sigValue\ +} + + +set Objects(tcl_panel) { \ + toplevel TopLevelShell tcl_panel\ + tcl_panel Layout tclLayout\ + tclLayout Group tclCmdGroup\ + tclCmdGroup Layout tclCmd\ + tclCmd Command tclClear\ + tclCmd Command tclExecute\ + tclCmd Command tclDismiss\ + tclLayout Frame tclFrame\ + tclFrame AsciiText tclEntry\ +} + + +set Objects(warning) { \ + toplevel TransientShell warning\ + warning Layout warn\ + warn Frame warnFrame\ + warnFrame Layout WFlayout\ + WFlayout Icon warnIcon\ + WFlayout TextBox warnText\ + warn Command warnOk\ + warn Command warnCancel\ +} + + +set Resources(global) { \ + + !--------------------------------------------------------- + ! Define some global widget resources for the main panels. + !--------------------------------------------------------- + *shadowWidth: 1 + *background: #c4c4c4 +! *foreground: black + *Arrow.width: 16 + *Arrow.height: 25 + *Text*height: 21 + *Command.height: 21 + *Command.highlightThickness: 1 + *MenuButton.height: 21 + *MenuButton.highlightThickness: 1 + *Label.borderWidth: 0 + *Label.shadowWidth: 0 + *TextButton.shadowWidth: 0 + *TextButton.highlightThickness: 1 + *TextToggle*borderWidth: 0 + *TextToggle.highlightThickness: 0 + *Toggle.highlightThickness: 1 + *Group.shrinkToFit: True + + *Arrow.foreground: gray + *Arrow.background: #adadad + *Text*background: #adadad + *AsciiText*background: #adadad + *TextBox.background: #adadad + *MultiList*background: #adadad + *Slider2d.thumbColor: #c4c4c4 + + + !------------------------------------------------------------- + ! Define resources to take advantage of the 3D scrollbar look. + !------------------------------------------------------------- + *Scrollbar*background: #c4c4c4 + *Scrollbar*shadowWidth: 1 + *Scrollbar*width: 15 + *Scrollbar*height: 15 + *Scrollbar*cursorName: top_left_arrow + *Scrollbar*pushThumb: true + + *HTML.Scrollbar.shadowWidth: 1 + *HTML*Scrollbar*width: 15 + *HTML*Scrollbar*height: 15 + + + !---------------------------------------- + ! Menu resources giving a shadow effect. + !---------------------------------------- + *SmeBSB.leftMargin: 10 + *SmeBSB.rightMargin: 5 + *SmeBSB.shadowWidth: 2 + *SmeBSB.foreground: #e5e5e5 + *SmeBSB.background: SteelBlue + *SimpleMenu.background: #c4c4c4 + *SimpleMenu.borderWidth: 2 + *SimpleMenu.borderColor: black + *SimpleMenu.line1.foreground: #9c9c9c + *SimpleMenu.line2.foreground: #e8e8e8 + *SimpleMenu.line3.foreground: #9c9c9c + *SimpleMenu.line4.foreground: #e8e8e8 + *SimpleMenu.line5.foreground: #9c9c9c + *SimpleMenu.line6.foreground: #e8e8e8 + *SimpleMenu.line7.foreground: #9c9c9c + *SimpleMenu.line8.foreground: #e8e8e8 + *SimpleMenu.line9.foreground: #9c9c9c + *SimpleMenu.line10.foreground: #e8e8e8 + *SimpleMenu.line11.foreground: #9c9c9c + *SimpleMenu.line12.foreground: #e8e8e8 + *SimpleMenu.line13.foreground: #9c9c9c + *SimpleMenu.line14.foreground: #e8e8e8 + *SimpleMenu.line15.foreground: #9c9c9c + *SimpleMenu.line16.foreground: #e8e8e8 + *SimpleMenu.line17.foreground: #9c9c9c + *SimpleMenu.line18.foreground: #e8e8e8 + *SimpleMenu.line19.foreground: #9c9c9c + *SimpleMenu.line20.foreground: #e8e8e8 + *SimpleMenu.line21.foreground: #9c9c9c + *SimpleMenu.line22.foreground: #e8e8e8 + *SimpleMenu.line23.foreground: #9c9c9c + *SimpleMenu.line24.foreground: #e8e8e8 + *SimpleMenu.line25.foreground: #9c9c9c + *SimpleMenu.line26.foreground: #e8e8e8 + *SimpleMenu.line27.foreground: #9c9c9c + *SimpleMenu.line28.foreground: #e8e8e8 + *SimpleMenu.line29.foreground: #9c9c9c + *SimpleMenu.line30.foreground: #e8e8e8 + *SimpleMenu.line31.foreground: #9c9c9c + *SimpleMenu.line32.foreground: #e8e8e8 + *SimpleMenu.line33.foreground: #9c9c9c + *SimpleMenu.line34.foreground: #e8e8e8 + *SimpleMenu.line35.foreground: #9c9c9c + *SimpleMenu.line36.foreground: #e8e8e8 + *SimpleMenu.line37.foreground: #9c9c9c + *SimpleMenu.line38.foreground: #e8e8e8 + *SimpleMenu.line39.foreground: #9c9c9c + *SimpleMenu.line40.foreground: #e8e8e8 + + + !--------------------------------------------- + ! Fixups for 24-bit displays + !--------------------------------------------- + *hFindEntry.background: #adadad + *hdrIGText.background: #adadad + *hdrKGText.background: #adadad + *hfEntry.background: #adadad + *printcmd.background: #adadad + *titleString.background: #adadad + *fnameText.background: #adadad + *imtemplateText.background: #adadad + *z1Value.background: #adadad + *z2Value.background: #adadad + *nsampValue.background: #adadad + *saveFile.background: #adadad + *infoText.background: #adadad + *wtName.background: #adadad + *wtTitle.background: #adadad + *wtFBCfg.background: #adadad + *wtIPixval.background: #adadad + *wtSPixval.background: #adadad + *wtBPixval.background: #adadad + *wtWcs1.background: #adadad + *wtWcs2.background: #adadad + *wtWcs3.background: #adadad + *wtWcs4.background: #adadad + *wcsIsmCmd.background: #adadad + *tclEntry.background: #adadad + + *hFindEntry.foreground: #000000 + *hdrIGText.foreground: #000000 + *hdrKGText.foreground: #000000 + *hfEntry.foreground: #000000 + *printcmd.foreground: #000000 + *titleString.foreground: #000000 + *fnameText.foreground: #000000 + *imtemplateText.foreground: #000000 + *z1Value.foreground: #000000 + *z2Value.foreground: #000000 + *nsampValue.foreground: #000000 + *saveFile.foreground: #000000 + *infoText.foreground: #000000 + *wtName.foreground: #000000 + *wtTitle.foreground: #000000 + *wtFBCfg.foreground: #000000 + *wtIPixval.foreground: #000000 + *wtSPixval.foreground: #000000 + *wtBPixval.foreground: #000000 + *wtWcs1.foreground: #000000 + *wtWcs2.foreground: #000000 + *wtWcs3.foreground: #000000 + *wtWcs4.foreground: #000000 + *wcsIsmCmd.foreground: #000000 + *tclEntry.foreground: #000000 +} + + + + + +set Resources(ximtool) { \ + + ! Main image window resources. + ! ------------------------------- + *allowShellResize: True + *beNiceToColormap: False + *menuLabel.foreground: Gold + *markerMenu.foreground: White + *rulerMenu.foreground: White + *display.imagewin.markerMenu.foreground: White + *display.imagewin.rulerMenu.foreground: White + *markerMenu.background: SteelBlue + *markerMenu*SimpleMenu.foreground: White + *markerMenu*SimpleMenu.background: SteelBlue + *rulerMenu.background: SteelBlue + *rulerMenu*SimpleMenu.foreground: White + *rulerMenu*SimpleMenu.background: SteelBlue + *rulerColor.SmeBSB.leftMargin: 16 + *magzoomMenu.foreground: White + *magzoomMenu.background: SteelBlue + *magzoomMenu*SimpleMenu.foreground: White + *magzoomMenu*SimpleMenu.background: SteelBlue + *markerColor.SmeBSB.leftMargin: 64 + *markerColor.SmeBSB.rightMargin: 0 + *markerColor.menuLabel.leftMargin: 5 + *markerColor.menuLabel.rightMargin: 5 + *rulerColor.SmeBSB.leftMargin: 64 + *rulerColor.SmeBSB.rightMargin: 0 + *rulerColor.menuLabel.leftMargin: 5 + *rulerColor.menuLabel.rightMargin: 5 + + *ximtool.title: XIMTOOL_VERSION + + *display.borderWidth: 2 + *display.layout: horizontal { \ + -0 \ + vertical { \ + menuGroup < +inf -inf * > \ + horizontal { 1 toolbar < +inf -inf * > 1 } \ + 1 < -1 > \ + horizontal { 1 panelbar < +inf -inf * > 1 } \ + 1 < -1 > \ + vertical { \ + horizontal { \ + imageFrame < +inf -inf * +inf -inf > \ + -2 \ + vcutFrame < * +inf -inf > \ + } \ + -3 \ + horizontal { \ + hcutFrame < +inf -inf * > 1 \ + vertical { 4 horizontal { -4 plotOpts} -4 } \ + } \ + -3 \ + horizontal { \ + cbarFrame < +inf -inf * > \ + focusSlider 2 hcut 2 vcut 15 \ + } \ + } \ + } \ + -0 \ + } + *hcut.label: H + *hcut.font: *lucida-bold-r*10* + *vcut.label: V + *vcut.font: *lucida-bold-r*10* + *focusSlider.location: 0 0 100 15 + + *hcutFrame.frameType: sunken + *hcutFrame.frameWidth: 1 + *hcutFrame.innerOffset: 1 + *hcutFrame.outerOffset: 1 + //*hcutPlot.color0: #c4c4c4 + //*hcutPlot.color1: #000000 + *hcutPlot.color0: #000000 + *hcutPlot.color1: #ffffff + *hcutPlot.crosshairCursorColor: red + *hcutPlot.width: 512 + *hcutPlot.height: 6 + *hcutPlot.borderWidth: 0 + *hcutPlot.alphaFont1: 6x10 + *hcutPlot.alphaFont2: 6x10 + *hcutPlot.alphaFont3: 6x10 + *hcutPlot.alphaFont4: 6x10 + *hcutPlot.alphaFont5: 6x10 + *hcutPlot.alphaFont6: 6x10 + *hcutPlot.alphaFont7: 6x10 + *hcutPlot.alphaFont8: 6x10 + *hcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(displayPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y) + + + *vcutFrame.frameType: sunken + *vcutFrame.frameWidth: 1 + *vcutFrame.innerOffset: 0 + *vcutFrame.outerOffset: 0 + //*vcutPlot.color0: #c4c4c4 + //*vcutPlot.color1: black + *vcutPlot.color0: #000000 + *vcutPlot.color1: #ffffff + *vcutPlot.crosshairCursorColor: red + *vcutPlot.width: 6 + *vcutPlot.height: 512 + *vcutPlot.borderWidth: 0 + *vcutPlot.alphaFont1: 6x10 + *vcutPlot.alphaFont2: 6x10 + *vcutPlot.alphaFont3: 6x10 + *vcutPlot.alphaFont4: 6x10 + *vcutPlot.alphaFont5: 6x10 + *vcutPlot.alphaFont6: 6x10 + *vcutPlot.alphaFont7: 6x10 + *vcutPlot.alphaFont8: 6x10 + *vcutPlot.translations: \ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(displayPanel) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y) + + + *plotOpts.label: Options + !*plotOpts*location: 0 0 105 18 + *plotOpts*location: 0 0 1 18 + *plotOpts.shrinkToFit: True + *plotOpts.outerOffset: 5 + *plotOpts.innerOffset: 3 + *plotOpts.frameWidth: 2 + *plotOpts*TextToggle.offIcon: square0s + *plotOpts*TextToggle.onIcon: square1s + *plotOpts*TextToggle.highlightColor: yellow + *plotOpts*TextToggle.outerOffset: 0 + *plotOpts*TextToggle.frameWidth: 0 + *plotOpts*TextToggle.selectionStyle: multi + *plotOpts*TextToggle.leftMargin: 3 + *plotOpts*TextToggle.alignment: left + + *poptsLayout.borderWidth: 0 + *poptsLayout.layout: vertical { \ + -1 \ + plotSpeed plotAccurate plotImgPix \ + 2 < -2 > \ + horizontal { -4 optLine < +inf -inf * > -4 } \ + 2 < -2 > \ + curJump curSmooth curTrack \ + -1 \ + } + *plotSpeed.label: Better Speed + *plotSpeed.on: True + *plotAccurate.label: Better Accuracy + *plotAccurate.on: False + *plotImgPix.label: Image Pixels + *plotImgPix.on: False + *plotImgPix.sensitive: False + *optLine.height: 2 + *optLine.width: 120 + *optLine.outerOffset: 0 + *optLine.innerOffset: 0 + *optLine.frameWidth: 2 + *optLine.frameType: chiseled + *curJump.label: Jump Cursor + *curJump.on: True + *curSmooth.label: Smooth Cursor + *curSmooth.on: False + *curTrack.label: Graphics Cursors + *curTrack.on: True + + + *menuGroup.label: + *menuGroup.height: 38 + *menuGroup.width: 512 + *menuGroup.frameType: raised + *menuGroup.frameWidth: 2 + *menubar.layout: horizontal { \ + 2 < -2 > \ + fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \ + 1 < -1 > \ + imageTitle < +inff -inff * > \ + 1 < -1 > \ + mXflipButton 1 < -1 > mYflipButton \ + 1 < -1 > \ + mPrevButton 1 < -1 > mFrameButton 1 < -1 > mNextButton \ + 1 < -1 > \ + toolButton 1 < -1 > panelButton \ + 2 < -2 > \ + } + + *menubar*SimpleMenu.foreground: Black + *menubar*SimpleMenu.borderWidth: 1 + *menubar*SimpleMenu.foreground: White + *menubar*SimpleMenu.background: SteelBlue + *SmeBSB.vertSpace: 10 + + *menubar.width: 512 + *menubar*borderWidth: 0 + *menubar*Command.internalWidth: 0 + *menubar*Command.borderWidth: 0 + *menubar*Toggle.label: x + *menubar*Toggle.internalWidth: 0 + *menubar*Toggle.borderWidth: 0 + + *toolbar.layout: horizontal { \ + tbZoomIn < +inf -inf * > 1 < -1 > \ + tbZoom0 < +inf -inf * > 1 < -1 > \ + tbZoomOut < +inf -inf * > 1 < -1 > \ + tbInvert < +inf -inf * > 1 < -1 > \ + tbNormalize < +inf -inf * > 1 < -1 > \ + tbMatchLUT < +inf -inf * > 1 < -1 > \ + tbAutoReg < +inf -inf * > 1 < -1 > \ + tbRegister < +inf -inf * > 1 < -1 > \ + tbCenter < +inf -inf * > 1 < -1 > \ + tbBlinkDec < +inf -inf * > 1 < -1 > \ + tbBlink < +inf -inf * > 1 < -1 > \ + tbBlinkInc < +inf -inf * > 1 < -1 > \ + xflipButton < +inf -inf * > 1 < -1 > \ + yflipButton < +inf -inf * > 1 < -1 > \ + tbCompass < +inf -inf * > 1 < -1 > \ + tbTile < +inf -inf * > 1 < -1 > \ + prevButton < +inf -inf * > 1 < -1 > \ + frameButton < +inf -inf * > 1 < -1 > \ + nextButton < +inf -inf * > 1 < -1 > \ + } + *toolbar.width: 512 + *toolbar.height: 25 + *toolbar*borderWidth: 0 + *toolbar*Command.internalWidth: 3 + *toolbar*Command.borderWidth: 0 + *toolbar*Toggle.internalWidth: 2 + *toolbar*Toggle.borderWidth: 0 + + *panelbar.layout: horizontal { \ + pbDisplayP < +inf -inf * > 1 < -1 > \ + pbPrintP < +inf -inf * > 1 < -1 > \ + pbLoadP < +inf -inf * > 1 < -1 > \ + pbSaveP < +inf -inf * > 1 < -1 > \ + pbInfoP < +inf -inf * > 1 < -1 > \ + pbTileP < +inf -inf * > 1 < -1 > \ + pbCoordP < +inf -inf * > 1 < -1 > \ + pbPanM < +inf -inf * > 1 < -1 > \ + pbMagM < +inf -inf * > 1 < -1 > \ + pbWcsM < +inf -inf * > 1 < -1 > \ + pbIsm < +inf -inf * > 1 < -1 > \ + helpButton < +inf -inf * > 1 < -1 > \ + pbQuit < +inf -inf * > 1 < -1 > \ + } + *panelbar*SimpleMenu.borderColor: Black + *panelbar*SimpleMenu.borderWidth: 1 + *SmeBSB.vertSpace: 10 + + *panelbar.width: 12 + *panelbar.height: 25 + *panelbar*borderWidth: 0 + *panelbar*Label.internalWidth: 4 + *panelbar*Label.borderWidth: 0 + *panelbar*Command.internalWidth: 4 + *panelbar*Command.borderWidth: 0 + *panelbar*Toggle.internalWidth: 3 + *panelbar*Toggle.borderWidth: 0 + + *pbLoadP.label: Load + *pbDisplayP.label: Display + *pbSaveP.label: Save + *pbPrintP.label: Print + *pbInfoP.label: Info + *pbTileP.label: Tile + *pbCoordP.label: Coords + *pbPanM.label: Pan + *pbPanM.state: 1 + *pbMagM.label: Mag + *pbMagM.state: 0 + *pbWcsM.label: WCS + *pbWcsM.state: 1 + *pbIsm.label: ISM + *pbIsm.state: 0 + *helpButton.label: + + *fileButton.label: File + *fileButton.menuName: fileMenu + *viewButton.label: View + *viewButton.menuName: viewMenu + *optionsButton.label: Options + *optionsButton.menuName: optionsMenu + *toolButton.label: + *toolButton.state: 0 + *panelButton.label: + *panelButton.state: 0 + *imageTitle*font: *times-bold-r*12* + *imageTitle.width: 40 + *imageTitle.height: 20 + *frameButton.menuName: frameMenu + *frameButton.label: 1 + *frameButton.width: 20 + *mFrameButton.menuName: mFrameMenu + *mFrameButton.label: 1 + *mFrameButton.width: 20 + *pbQuit.label: Quit + *tbZoom0.label: Mag + *tbBlink.label: Blink + *tbBlink.internalWidth: 3 + *tbCenter.label: Cntr + *tbAutoReg.label: AReg + *tbRegister.label: Reg + *tbInvert.label: Inv + *tbNormalize.label: Norm + *tbMatchLUT.label: Match + + *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1 + *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *panelbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *toolbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + + *Gterm.cmapName: image + *Gterm.basePixel: 64 + *imageFrame.frameType: sunken + *imageFrame.frameWidth: 1 + *imageFrame.outerOffset: 0 + *imageFrame.innerOffset: 0 + *imageFrame.width: 512 + *imageFrame.height: 512 + *cbarFrame.frameType: sunken + *cbarFrame.frameWidth: 1 + *cbarFrame.outerOffset: 0 + *cbarFrame.innerOffset: 0 + *cbarFrame.width: 512 + *imagewin.warpCursor: true + *imagewin.raiseWindow: true + *imagewin.deiconifyWindow: true + *imagewin.idleCursor: crosshair + *imagewin.ginmodeCursor: circle + *imagewin.ginmodeBlinkInterval: 500 + *imagewin.resizable: true + *imagewin.copyOnResize: false + *imagewin.width: 512 + *imagewin.height: 512 + *imagewin.maxMappings: 64 + *imagewin.borderWidth: 0 + + *imagewin.translations: \ + None<Key>Left: call(move_cursor,-1,0) \n\ + None<Key>Down: call(move_cursor,0,1) \n\ + None<Key>Up: call(move_cursor,0,-1) \n\ + None<Key>Right: call(move_cursor,1,0) \n\ + !Shift <Key>Left: call(move_cursor,-10,0) \n\ + !Shift <Key>Down: call(move_cursor,0,10) \n\ + !Shift <Key>Up: call(move_cursor,0,-10) \n\ + !Shift <Key>Right: call(move_cursor,10,0) \n\ + !Ctrl <Key>h: call(move_cursor,-1,0) \n\ + !Ctrl <Key>j: call(move_cursor,0,1) \n\ + !Ctrl <Key>k: call(move_cursor,0,-1) \n\ + !Ctrl <Key>l: call(move_cursor,1,0) \n\ + !Ctrl Shift <Key>h: call(move_cursor,-10,0) \n\ + !Ctrl Shift <Key>j: call(move_cursor,0,10) \n\ + !Ctrl Shift <Key>k: call(move_cursor,0,-10) \n\ + !Ctrl Shift <Key>l: call(move_cursor,10,0) \n\ + !Ctrl <Key>Left: call(moveFrame,-1,0) \n\ + !Ctrl <Key>Down: call(moveFrame,0,1) \n\ + !Ctrl <Key>Up: call(moveFrame,0,-1) \n\ + !Ctrl <Key>Right: call(moveFrame,1,0) \n\ + !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \n\ + !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \n\ + !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \n\ + !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \n\ + !Alt <Key>1: call(cpSetFrame,frame1) \n\ + !Alt <Key>2: call(cpSetFrame,frame2) \n\ + !Alt <Key>3: call(cpSetFrame,frame3) \n\ + !Alt <Key>4: call(cpSetFrame,frame4) \n\ + !Ctrl <Key>1: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>2: call(cpZoom,2,2,fixed) \n\ + !Ctrl <Key>3: call(cpZoom,3,3,fixed) \n\ + !Ctrl <Key>4: call(cpZoom,4,4,fixed) \n\ + !Ctrl <Key>5: call(cpZoom,5,5,fixed) \n\ + !Ctrl <Key>6: call(cpZoom,6,6,fixed) \n\ + !Ctrl <Key>7: call(cpZoom,7,7,fixed) \n\ + !Ctrl <Key>8: call(cpZoom,8,8,fixed) \n\ + !Ctrl <Key>9: call(cpZoom,9,9,fixed) \n\ + !Ctrl <Key>a: call(tbToggleAutoReg) \n\ + !Ctrl <Key>b: call(prevFrame,$name) \n\ + !Ctrl <Key>c: call(cpZoomAction,centerFrame) \n\ + !Ctrl <Key>f: call(nextFrame,$name) \n\ + !Ctrl <Key>i: call(cpInvert) \n\ + !Ctrl <Key>m: call(toggleMagnifier) \n\ + !Ctrl <Key>n: call(normalize) \n\ + !Ctrl <Key>o: call(offset,$x,$y) \n\ + !Ctrl <Key>p: call(togglePanner) \n\ + !Ctrl Alt <Key>q: call(Quit) \n\ + !Ctrl <Key>r: call(cpRegisterFrames) \n\ + !Ctrl <Key>s: call(cpMatchFrames) \n\ + !Ctrl <Key>t: call(tbTileFramesToggle) \n\ + !Ctrl <Key>u: call(cpZoom,1,1,fixed) \n\ + !Ctrl <Key>x: call(cpFrameAction,flipX) \n\ + !Ctrl <Key>y: call(cpFrameAction,flipY) \n\ + Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \n\ + Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \n\ + !Ctrl Alt <Key>=: call(Print) \n\ + Ctrl <Key>\<: call(cpSetBlinkRate,BRdecrease) \n\ + Ctrl <Key>\>: call(cpSetBlinkRate,BRincrease) \n\ + Ctrl <Key>\[: call(setCtrBoxSize,$x,$y,-1) \n\ + Ctrl <Key>\]: call(setCtrBoxSize,$x,$y,1) \n\ + !Ctrl <Key>0: call(centroid,$x,$y,peak) \n\ + !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \n\ + !Alt <Key>b: call(toggleBlink) \n\ + !Alt <Key>c: call(displayPanel) \n\ + !Ctrl Shift <Key>c: call(displayPanel) \n\ + !Ctrl Alt <Key>f: call(fitFrame) \n\ + !Alt <Key>h: call(Help) \n\ + !Alt <Key>i: call(infoPanel) \n\ + !Alt <Key>l: call(loadPanel) \n\ + !Alt <Key>p: call(printPanel) \n\ + !Alt <Key>s: call(savePanel) \n\ + !Alt <Key>t: call(tclPanel) \n\ + !Ctrl Shift <Key>t: call(tclPanel) \n\ + !Shift<Btn1Down>: call(setDynamicMagnifier,1) \n\ + !Shift<Btn1Up>: call(setDynamicMagnifier,0) \n\ + !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \n\ + !Shift <Btn2Down>: crosshair(on) \n\ + !Shift <Btn2Motion>: crosshair(on) \n\ + !Shift <Btn2Up>: crosshair(off) \n\ + !<Btn2Up>: crosshair(off) \n\ + !<Btn2Down>: call(zoom,$x,$y) \n\ + !<Btn3Down>: call(windowColormap,$x,$y) \n\ + !<Btn3Up>: call(updateColormap,$x,$y) \n\ + !<Btn3Motion>: call(windowColormap,$x,$y) \n\ + !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \n\ + !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \n\ + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \n\ + <EnterWindow>: enter-window() \n\ + <LeaveWindow>: leave-window() \n\ + <KeyPress>: graphics-input() \n\ + !Alt <Motion>: call(curtrack_msg,$x,$y) \n\ + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) + +! The following translations can be used to enable windowing of the +! individual RGB components of the colormap. It's not very useful but +! included here for those that may wish to use it. +!-------------------------------------------------------------------------- +! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \n\ +! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \n\ +! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \n\ +! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \n\ +! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \n\ +! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \n\ + + + *colorbar.maxRasters: 1 + *colorbar.maxMappings: 1 + *colorbar.height: 17 + *colorbar.width: 50 + *colorbar.borderWidth: 0 +} + + +set Resources(panelShell) { \ + + !================================ + ! Main Integrated Control Panel + !================================ + *panelShell.title: XImtool Control Panel + *panelShell.geometry: 480x630 + *panelShell.maxWidth: 480 + *panelShell.minWidth: 480 + *panelTabs.internalHeight: 3 + *panelTabs.internalWidth: 10 + + *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + *display_panel.tabLabel: Display + *display_panel.innerOffset: 5 + *print_panel.tabLabel: Print + *print_panel.innerOffset: 5 + *load_panel.tabLabel: Load + *load_panel.innerOffset: 5 + *save_panel.tabLabel: Save + *save_panel.innerOffset: 5 + *info_panel.tabLabel: Info + *info_panel.innerOffset: 5 + *tile_panel.tabLabel: Tile + *tile_panel.innerOffset: 5 + *wcs_panel.tabLabel: Coords + *wcs_panel.innerOffset: 5 + + *panelMenuBar*borderWidth: 0 + *panelMenuBar*Command.internalHeight: 4 + *panelMenuBar*Command.internalWidth: 15 + *panelMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + 10 < +inf -10> \ + panelHelp \ + 3 < -3 > \ + panelClose \ + 7 < -7 > \ + } \ + 5 < -5 > \ + } + + *panelHelp.label: Help + *panelClose.label: Dismiss + + + *tabFrame.outerOffset: 3 + *tabFrame.innerOffset: 0 + *tabFrame.frameWidth: 0 + *tabFrame.frameType: chiseled + *panelMenuFrame.outerOffset: 0 + *panelMenuFrame.innerOffset: 1 + *panelMenuFrame.frameType: raised + *panelMenuFrame.frameWidth: 2 + *panel.layout: vertical { \ + panelMenuFrame < +inf -inf * > \ + 3 \ + horizontal { tabFrame < +inf -inf * +inf -inf> } \ + } +} + + +set Resources(display_panel) { \ + + !================================ + ! Main Display Control Panel. + !================================ + *controlPanel*internalWidth: 0 + *controlPanel*borderWidth: 0 + + *TextBox.font: 7x13bold + *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1 + *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 + *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *zoom*Command.font: 7x13bold + + *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1 + + *controlPanel.layout: vertical { \ + 5 < -5 > \ + horizontal { \ + -1 \ + viewBox < +inf -inf * > \ + -1 \ + } \ + 5 < -5 > \ + horizontal { \ + -1 \ + enhancementBox < +inf -inf * +inf -inf > \ + -5 \ + vertical { \ + -1 \ + blinkBox < * +inf - inf > \ + 1 \ + optionsBox < * +inff -inff > \ + -1 \ + } \ + -1 \ + } \ + -5 \ + controlBox < +inf * > \ + -5 \ + } + + ! VIEW + ! ------------------ + *viewBox.label: View + *viewBox.location: 0 0 410 0 + *viewBox.shrinkToFit: True + *viewBox.outerOffset: 7 + + *view.layout: vertical { \ + 5 < +inf -5 > \ + horizontal { \ + -1 \ + frameSelect \ + vertical { \ + 3 < -3 > \ + frameDataBox < +inff -100% * +inff -100% > \ + 3 < -3 > \ + } \ + zoomBox \ + -1 \ + } \ + 1 < +inf > \ + viewButtons < +inf -inf * +inf -inf > \ + 5 < +inf -5 > \ + } + + *frameDataBox.frameType: sunken + *frameDataBox.frameWidth: 1 + *frameData.width: 150 + *frameData.height: 50 + + *frameSelect.location: 0 0 72 0 + *frameSelect.shrinkToFit: True + *frameSelect.outerOffset: 7 + *frameSelect.innerOffset: 2 + *frameSelect.frameWidth: 2 + *frameSelect*offIcon: diamond0s + *frameSelect*onIcon: diamond1s + *frameSelect*highlightColor: blue + *frameSelect.label: Frame + + *frameBox.layout: vertical { \ + 3 \ + horizontal { -2 frlistBox < * +inff -inff > } \ + 3 < +inf -3 > \ + horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \ + } + *framePort.allowVert: True + *framePort.allowHoriz: False + *framePort.useRight: True + *framePort.height: 80 + + *frameBox*alignment: left + *frameBox*frameWidth: 0 + *frameBox*frame1.label: 1\ \ + *frameBox*frame2.label: 2\ \ + *frameBox*frame3.label: 3\ \ + *frameBox*frame4.label: 4\ \ + + *frameBox*frame5.label: 5\ \ + *frameBox*frame6.label: 6\ \ + *frameBox*frame7.label: 7\ \ + *frameBox*frame8.label: 8\ \ + *frameBox*frame9.label: 9\ \ + *frameBox*frame10.label: 10\ + *frameBox*frame11.label: 11\ + *frameBox*frame12.label: 12\ + *frameBox*frame13.label: 13\ + *frameBox*frame14.label: 14\ + *frameBox*frame15.label: 15\ + *frameBox*frame16.label: 16\ + *frameBox*Command.width: 24 + *frameBox*prevFrame.label: xxx + *frameBox*nextFrame.label: xxx + + *frameList*location: 0 0 50 20 + *frameList.layout: vertical { \ + frame1 < +inf * >\ + frame2 < +inf * >\ + frame3 < +inf * >\ + frame4 < +inf * >\ + frame5 < +inf * >\ + frame6 < +inf * >\ + frame7 < +inf * >\ + frame8 < +inf * >\ + frame9 < +inf * >\ + frame10 < +inf * >\ + frame11 < +inf * >\ + frame12 < +inf * >\ + frame13 < +inf * >\ + frame14 < +inf * >\ + frame15 < +inf * >\ + frame16 < +inf * >\ + } + + + *zoomBox.label: Zoom: + *zoomBox.location: 0 0 160 127 + *zoomBox.outerOffset: 7 + *zoomBox.shrinkToFit: True + *zoomBox*TextButton.frameWidth: 1 + *zoomBox*TextButton.outerOffset: 0 + + *controlPanel*zoom*internalWidth: 4 + *zoom.layout: vertical { \ + space = ((50% of width zoom) - (50% of width z5)) \ + 1 < +inf > \ + horizontal { \ + vertical { toggleZoom < +inf * +inf > 1 } \ + 1 \ + vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \ + 1 \ + vertical { zoomIn < +inf * +inf > 1 } \ + } \ + 1 \ + horizontal { \ + 1 < +inf > \ + d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \ + 1 < +inf > \ + } \ + 1 \ + horizontal { \ + vertical { 1 zoomOut < +inf * +inf > } \ + 1 \ + vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \ + 1 \ + vertical { 1 centerFrame < +inf * +inf > } \ + } \ + 1 < +inf > \ + } + + *toggleZoom.label: Toggle\nZoom + *toggleZoom.outerOffset: 2 + *toggleZoom.width: 30 + *toggleZoom.height: 25 + + *zoomIn.label: Zoom\nIn + *zoomIn.outerOffset: 2 + *zoomIn.width: 30 + *zoomIn.height: 25 + + *x1.label: 1 + *z2.label: 2 + *z3.label: 3 + *z4.label: 4 + *z5.label: 5 + *z8.label: 8 + + *controlPanel*zoomIn.foreground: royalBlue3 + *controlPanel*z4.foreground: royalBlue3 + *controlPanel*z5.foreground: royalBlue3 + *controlPanel*z8.foreground: royalBlue3 + *controlPanel*z2.foreground: royalBlue3 + *controlPanel*z3.foreground: royalBlue3 + + *zoomOut.label: Zoom\nOut + *zoomOut.outerOffset: 2 + *zoomOut.width: 30 + *zoomOut.height: 25 + + *centerFrame.label: Center + *centerFrame.outerOffset: 2 + *centerFrame.width: 30 + *centerFrame.height: 25 + + *d2.label: 2 + *d3.label: 3 + *d4.label: 4 + *d5.label: 5 + *d8.label: 8 + + *controlPanel*zoomOut.foreground: mediumVioletRed + *controlPanel*d2.foreground: mediumVioletRed + *controlPanel*d3.foreground: mediumVioletRed + *controlPanel*d4.foreground: mediumVioletRed + *controlPanel*d5.foreground: mediumVioletRed + *controlPanel*d8.foreground: mediumVioletRed + + *viewButtons.location: 0 0 100 80 + *viewButtons.layout: horizontal { \ + 2 < -2 > \ + aspect < +inf * > 2 \ + flipX < +inf * > 2 \ + flipY < +inf * > 2 \ + flipXY < +inf * > 2 \ + clearFrame < +inf * > 2 \ + fitFrame < +inf * > \ + 2 < -2 > \ + } + *nextFrame.label: Next Frame + *prevFrame.label: Previous Frame + *fitFrame.label: Fit Frame + *aspect.label: Aspect + *clearFrame.label: Clear Frame + *flipX.label: Flip X + *flipY.label: Flip Y + *flipXY.label: Flip XY + + + ! ENHANCEMENT + ! ------------------ + *enhancementBox.label: Enhancement + *enhancementBox.location: 0 0 110 0 + *enhancementBox.shrinkToFit: True + *enhancementBox.outerOffset: 7 + + *enhance*Viewport.allowVert: True + *enhance*Viewport.allowHoriz: False + *enhance*Viewport.useRight: False + *enhance*Viewport.resizeable: True + *enhance*Scrollbar.width: 17 + *enhance*Scrollbar.minimumThumb: 10 + *enhance.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + colorlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 2 \ + horizontal { \ + 2 < -2 > \ + colordataFrame < +inf -inf * +inf -inf > \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 2 < -2 > \ + vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \ + 3 < -3 > \ + vertical { \ + -1 \ + contrastSlider < +inf -inf * > \ + 3 < -3 > \ + brightnessSlider < +inf -inf * > \ + -1 \ + } \ + 2 < -2 > \ + } \ + 5 < -5 > \ + horizontal { \ + 3 < -3 > \ + invertButton < +inf -inf * > \ + 5 < -5 > \ + optimizeButton < +inf -inf * > \ + 3 < -3 > \ + } \ + 3 < -3 > \ + } + + *enhance*frameType: sunken + *enhance*frameWidth: 1 + *enhance*BorderWidth: 0 + *enhance*Label.ShadowWidth: 0 + + *colorlist.width: 100 + *colorlist.height: 98 + *colordata.width: 100 + *colordata.height: 45 + *enhance*colordata.frameWidth: 0 + *contrastLabel.label: x + *contrastSlider.location: 0 0 100 17 + *brightnessLabel.label: x + *brightnessSlider.location: 0 0 100 17 + *invertButton.label: Invert + *optimizeButton.label: Optimize + + + ! --------------------- + ! BLINK/REGISTER + ! --------------------- + *blinkBox.label: Blink/Register + *blinkBox.location: 0 0 235 0 + *blinkBox.shrinkToFit: True + *blinkBox.outerOffset: 7 + *blinkBox*TextToggle.frameWidth: 1 + + *blink.layout: vertical { \ + space = (width blinkFramesLabel - width blinkRateLabel) \ + 3 < -3 > \ + horizontal { \ + 0 \ + blinkFramesLabel \ + 3 < +inf > \ + blinkFrame1 < -50% * > \ + blinkFrame2 < -50% * > \ + blinkFrame3 < -50% * > \ + blinkFrame4 < -50% * > \ + 4 < +inf > \ + blinkPanel < -50% * > \ + blinkReset \ + 2 \ + } \ + 5 < -5 > \ + horizontal { \ + $space \ + blinkRateLabel \ + 2 \ + BRframe < +inf * > \ + } \ + 5 < +inf -100% > \ + horizontal { \ + vertical { \ + 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \ + } \ + 5 < -5 > \ + vertical { \ + 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \ + } \ + } \ + } + + *BRlayout.layout: horizontal { \ + BRdecrease \ + BRtext < +inf -100% * > \ + BRincrease \ + } + + *blink.Label.borderWidth: 0 + *blink.Label.shadowWidth: 0 + *controlPanel*blink*internalWidth: 4 + *blink.TextToggle.location: 0 0 102 23 + *blink.TextToggle.frameWidth: 1 + *blink*TextToggle.highlightColor: yellow + *blink*TextToggle.offIcon: square0s + *blink*TextToggle.onIcon: square1s + *blink*TextToggle.outerOffset: 1 + *blink*Command.height: 27 + *blink*Arrow.width: 16 + *blink*Arrow.height: 25 + + + *blinkFramesLabel.label: Frames List: + *blinkFrame1.label: 1 + *blinkFrame2.label: 2 + *blinkFrame3.label: 3 + *blinkFrame4.label: 4 + *blinkPanel.label: x + *blinkPanel.width: 20 + *blinkReset.label: Reset + + *blinkRateLabel.label: Blink Rate: + *BRframe.frameType: sunken + *BRframe.frameWidth: 1 + *BRtext.width: 40 + *BRtext.height: 23 + *BRdecrease.direction: left + *BRincrease.direction: right + *registerButton.label: Register + *matchButton.label: Match LUTs + *blinkButton.label: Blink + *autoregButton.label: Auto-Register + + ! OPTIONS + ! --------------------- + *optionsBox.label: Options + *optionsBox.location: 0 0 220 0 + *optionsBox.shrinkToFit: False + *optionsBox.outerOffset: 7 + *optionsBox*offIcon: square0s + *optionsBox*onIcon: square1s + *optionsBox*selectionStyle: multi + *optionsBox*highlightColor: yellow + *optionsBox.TextToggle.location: 0 0 102 20 + *optionsBox.TextToggle.frameWidth: 0 + *optionsBox.TextToggle.highlightThickness: 0 + *optionsBox*alignment: left + + *pannerButton.label: Panner + *coordsBoxButton.label: Coords Box + *autoscaleButton.label: Autoscale + *antialiasButton.label: Antialias + *tileFramesButton.label: Tile Frames + *magnifierButton.label: Magnifier + *warningsButton.label: Warnings + *peakupButton.label: Centroid Peaks + *peakupButton.on: True + + ! CONTROL + ! ---------------------- + *controlBox.frameType: chiseled + *controlBox.frameWidth: 2 + *controlBox.outerOffset: 7 + *controlBox.innerOffset: 5 + *controlBox.height: 30 + + *control.layout: horizontal { \ + 1 \ + initializeButton < +inf * > \ + 5 < -5 > \ + normalizeButton < +inf * > \ + 80 < +inf -100% > \ + } + + *initializeButton.label: Initialize + *normalizeButton.label: Normalize +} + + +set Resources(print_panel) { \ + + !===================================== + ! Print Setup Panel resources. ! + !===================================== + *print_panel*TextToggle.alignment: left + *print_panel*Arrow.width: 16 + *print_panel*Arrow.height: 20 + *print_panel*TextToggle.frameWidth: 0 + *print_panel*TextToggle.height: 20 + *print_panel*Label.borderWidth: 0 + *print_panel*Label.shadowWidth: 0 + *print_panel*TextButton.width: 40 + *print_panel*TextButton.height: 25 + + *printLayout.borderWidth: 0 + *printLayout.layout: vertical { \ + -1 \ + printCmdGroup < +inf * > \ + -1 \ + optGroup < +inf -inf * +inf -inf > \ + -3 \ + cmdGroup < +inf * > \ + -1\ + } + + + ! Print Group resources. + !---------------------------------- + *printCmdGroup.borderWidth: 0 + *printCmdGroup.outerOffset: 5 + *printCmdGroup.label: + *printCmdGroup.location: 0 0 400 80 + *printCmdGroup*offIcon: diamond0s + *printCmdGroup*onIcon: diamond1s + *printCmdGroup*highlightColor: cyan + *printCmdGroup*Frame.frameType: sunken + *printCmdGroup*Frame.frameWidth: 1 + *printCmdGroup*Frame.width: 300 + *printCmdGroup*Label.justify: right + *printCmdGroup*Text*editType: edit + *printCmdGroup*Text*height: 22 + *printCmdGroup*TextToggle.width: 70 + *printCmdGroup*shadowWidth: 0 + *printCmdGroup*borderWidth: 0 + *printCmdLayout.borderWidth: 0 + *printCmdLayout.layout: horizontal { \ + labelLayout 5 inputLayout < +inf -inf * > \ + } + *labelLayout.borderWidth: 0 + *labelLayout.layout: vertical { 5 toLabel 7 printerLabel } + *printerLabel.label: Print Command: + *toLabel.label: Print To: + *toPrinter.label: Printer + *toPrinter.on: True + *toFile.label: File + + *inputLayout.borderWidth: 0 + *inputLayout.layout: horizontal { \ + 3 \ + vertical { \ + 5 \ + horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \ + 5 \ + printcmdFrame < +inf -inf * > \ + 5 \ + } \ + 3 \ + } + *printcmd*string: lpr + *printcmd*height: 22 + *printcmd*Text*editType: edit + + + ! Main options groups layout resources. + !--------------------------------------- + *optGroup.frameWidth: 2 + *optGroup.frameType: chiseled + *optGroup.label: + *optGroup.location: 0 0 400 330 + *optGroup.outerOffset: 5 + *optGroup.innerOffset: 2 + *optLayout*borderWidth: 0 + *optLayout.layout: vertical { \ + -1 \ + horizontal { \ + vertical { \ + 5 \ + epsPageGroup < +inf -inf * > \ + optionsGroup < +inf -inf * +inf -inf > \ + -1 \ + } \ + vertical { \ + 5 \ + printColorGroup < +inf -inf * > \ + printerGroup < +inf -inf * > \ + -1 \ + } \ + -1 \ + } \ + 5 \ + horizontal { annOptsGroup < +inf * +inf > -1 } \ + -1 \ + } + + + ! Postscript Options group resources. + ! ----------------------------------- + *epsPageGroup.label: Postscript Options + *epsPageGroup.outerOffset: 7 + *epsPageGroup.innerOffset: 5 + *epsPageGroup.location: 0 0 250 150 + *epsPageGroup*offIcon: diamond0s + *epsPageGroup*onIcon: diamond1s + *epsPageGroup*highlightColor: cyan + *epsPage*Label.justify: left + *epsPage.layout: vertical { \ + -1 \ + epsOrientLabel 4 < -4 > \ + horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \ + 4 \ + epsSizeLabel -1 \ + horizontal { \ + 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \ + } \ + 10 \ + horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \ + -1 \ + } + + + ! Page Layout resources. + ! ------------------------------- + *epsOrientLabel.label: Orientation: + *epsPortButton.label: Portrait + *epsPortButton.width: 65 + *epsLandButton.label: Landscape + *epsLandButton.width: 85 + *epsSquareButton.label: Square + *epsSquareButton.width: 70 + *epsSquareButton.sensitive: False + + *epsSizeLabel.label: Paper Size: + *epsLetterButton.label: Letter + *epsLetterButton.width: 60 + *epsLegalButton.label: Legal + *epsLegalButton.width: 60 + *epsA4Button.label: A4 + *epsA4Button.width: 50 + *epsB5Button.label: B5 + *epsB5Button.width: 50 + + ! Image scale box resources. + ! ------------------------------- + *epsScaleLabel.label: Output Image Scale: + *epsScaleLabel.justify: right + *ScaleFrame.frameType: sunken + *ScaleFrame.frameWidth: 1 + *ScaleFrame*shadowWidth: 0 + *ScaleLayout.location: 0 0 100 35 + *ScaleLayout.label: + *ScaleLayout.layout: horizontal { \ + SCdecrease SCtext < +inf -100% * > SCincrease \ + } + *SCdecrease.direction: left + *SCtext.width: 75 + *SCtext.height: 22 + *SCtext.label: 100 % + *SCincrease.direction: right + + + ! Miscellaneous print options box resources. + ! ------------------------------------ + *optionsGroup.outerOffset: 7 + *optionsGroup.innerOffset: 5 + *optionsGroup*onIcon: square1s + *optionsGroup*offIcon: square0s + *optionsGroup.label: Processing Options + *optionsGroup*TextToggle.width: 125 + *optionsGroup*TextToggle.highlightColor: yellow + *options.location: 0 0 250 60 + *options.frameWidth: 2 + *options.layout: horizontal { \ + 5 \ + vertical { -1 epsscaleButton 2 autorotateButton -1 } \ + 3 \ + vertical { -1 aspectButton 2 compressButton -1 } \ + -1 \ + } + *epsscaleButton.label: Auto Scale + *autorotateButton.label: Auto Rotate + *aspectButton.label: Max Aspect + *compressButton.label: RLE Compress + *compressButton.sensitive: False + + + ! Annotation options box resources. + ! ------------------------------------ + *annOptsGroup.outerOffset: 7 + *annOptsGroup.innerOffset: 5 + *annOptsGroup*onIcon: square1s + *annOptsGroup*offIcon: square0s + *annOptsGroup.label: Annotation Options + *annOptsGroup*TextToggle.width: 90 + *annOptsGroup*TextToggle.highlightColor: yellow + *annOptsGroup*Frame.frameType: sunken + *annOptsGroup*Frame.frameWidth: 1 + *annOptsGroup*Frame.width: 300 + *annOptsGroup*Text*editType: edit + *annOpts.frameWidth: 2 + *annOpts.location: 0 0 400 70 + *annOpts.layout: vertical { \ + 2 \ + horizontal { \ + 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \ + } \ + 3 \ + horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \ + -1 \ + } + *annotateButton.label: \ Annotate + *titleButton.label: \ Title + *bordersButton.label: \ Borders + *colorbarButton.label: \ Colorbar + *titleLabel.label: Title String + *titleString*string: imtitle + *titleString*height: 23 + *titleString*Text*editType: edit + + + ! Output color box resources. + ! ------------------------------ + *printColorGroup.location: 0 0 150 90 + *printColorGroup.outerOffset: 7 + *printColorGroup.frameWidth: 2 + *printColorGroup*offIcon: diamond0s + *printColorGroup*onIcon: diamond1s + *printColorGroup*highlightColor: cyan + *printColorGroup.innerOffset: 5 + *printColorGroup.label: Output Color + *printColorGroup*TextToggle.width: 110 + *printColor.frameWidth: 2 + *printColor.location: 0 0 250 75 + *printColor.layout: horizontal { \ + 1 \ + vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \ + -1 \ + } + *prGrayButton.label: Grayscale + *prPseudoButton.label: PseudoColor + *prRGBButton.label: RGB + + ! Printer Selection. + ! -------------------------- + *printerGroup.label: Printers + *printerGroup.location: 0 0 110 130 + *printerGroup.shrinkToFit: True + *printerGroup.outerOffset: 7 + + *printers*Viewport.allowVert: True + *printers*Viewport.allowHoriz: False + *printers*Viewport.useRight: True + *printers*Viewport.resizeable: True + *printers*Scrollbar.width: 17 + *printers*Scrollbar.minimumThumb: 10 + *printers.layout: vertical { \ + 3 < -3 > \ + horizontal { \ + 2 < -2 > \ + printlistFrame < +inf -inf * +inff -inff > \ + 2 < -2 > \ + } \ + 3 < -3 > \ + } + + *printers*frameType: sunken + *printers*frameWidth: 1 + *printers*BorderWidth: 0 + *printers*Label.ShadowWidth: 0 + + *printlist.width: 100 + *printlist.height: 78 + + + ! Panel command resources. + ! ------------------------------ + *cmdGroup.frameType: chiseled + *cmdGroup.frameWidth: 2 + *cmdGroup.outerOffset: 5 + *cmdGroup.innerOffset: 5 + *cmdGroup.label: + *cmdGroup.location: 0 0 150 50 + *cmdLayout.borderWidth: 0 + *cmdLayout*Command.internalWidth: 12 + *cmdLayout.layout: horizontal { \ + 2 \ + okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \ + 2 \ + } + *cmdGroup*TextButton*location: 0 0 80 0 + *okayPrint.label: Print +} + + +set Resources(info_panel) { \ + + !-------------------- + ! Information Panel + !-------------------- + *infoLayout*borderWidth: 0 + *infoLayout*Frame.frameType: sunken + *infoLayout*Frame.frameWidth: 1 + *infoLayout*Command.internalWidth: 12 + *infoLayout*Text*editType: read + *infoLayout*Text*scrollVertical: whenNeeded + *infoLayout*Text*scrollHorizontal: whenNeeded + *infoLayout*Text*displayCaret: False + *infoLayout*Scrollbar.background: #c4c4c4 + *infoLayout*Scrollbar.width: 17 + *infoLayout*Scrollbar.height: 17 + + *infoText.height: 240 + *infoText*font: 6x13 + *infoLayout.layout: vertical { \ + infoBox < +inf -inf * > \ + } + + *infoBox.label: + *infoBox.outerOffset: 0 + *infoBox.innerOffset: 3 + *infoBoxL*TextToggle.frameType: raised + *infoBoxL*TextToggle.frameWidth: 1 + *infoBoxL*TextToggle*outerOffset: 0 + *infoBoxL*TextToggle*innerOffset: 1 + *infoBoxL*TextToggle.location: 0 0 100 25 + *infoBoxL*TextToggle*onIcon: square1s + *infoBoxL*TextToggle*offIcon: square0s + *infoBoxL*TextToggle*highlightColor: cyan + *infoBoxL.layout: vertical { \ + infoFrame < +inf -inf * +inf -inf > 1 \ + 4 \ + horizontal { \ + infoOptFr < +inf -inf * > 1 \ + infoOptSvr < +inf -inf * > 1 \ + infoOptClients < +inf -inf * > 1 \ + infoOptWCS < +inf -inf * > 1 \ + infoOptIsm < +inf -inf * > 1 \ + infoOptFB < +inf -inf * > \ + }\ + 2 \ + } + *infoOptFr.label: Frame + *infoOptFr.on: True + *infoOptSvr.label: Server + *infoOptWCS.label: WCS + *infoOptIsm.label: ISM + *infoOptClients.label: Clients + *infoOptFB.label: Imtoolrc +} + + + +set Resources(load_panel) { \ + + !------------------------------- + ! File Load Control Panel. + !------------------------------- + *filesLayout*borderWidth: 0 + *filesLayout*Group.shrinkToFit: True + *filesLayout*Group.frameType: chiseled + *filesLayout*Frame*frameType: sunken + *filesLayout*Frame*frameWidth: 1 + *filesLayout*TextToggle.frameWidth: 0 + *filesLayout*TextToggle.height: 28 + *filesLayout*TextToggle.alignment: left + *filesLayout*TextToggle.ledtMargin: 3 + *filesLayout*SimpleMenu.borderWidth: 1 + *filesLayout*SimpleMenu.borderColor: black + *filesLayout*SimpleMenu.foreground: White + *filesLayout*SimpleMenu.background: SteelBlue + *filesLayout*Label.borderWidth: 0 + *filesLayout*Label.shadowWidth: 0 + *filesLayout.layout: vertical { \ + imlistGroup < +inf -inf * > \ + 3 \ + horizontal { -5 imoptsGroup < +inf -inf * > -5 } \ + -1 \ + loadCmdGroup < +inf -inf * > \ + } + + *imlistGroup.label: + *imlistGroup.frameWidth: 2 + *imlistGroup.outerOffset: 2 + *imlistLayout*Label.shadowWidth: 0 + *imlistLayout*Label.justify: left + *imlistLayout*Command.width: 90 + *imlistLayout*Command.height: 23 + *imlistLayout*Command.shadowWidth: 1 + *imlistLayout*Viewport.allowVert: True + *imlistLayout*Viewport.allowHoriz True + *imlistLayout*Viewport.useRight: True + *imlistLayout*Viewport.useBottom: True + *imlistLayout*Viewport.resizeable: True + *imlistLayout*Scrollbar.height: 17 + *imlistLayout*Scrollbar.width: 17 + *imlistLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + rootButton < +inf -inf * > 1 \ + homeButton < +inf -inf * > 1 \ + upButton < +inf -inf * > 1 \ + rescanButton < +inf -inf * > \ + 3 \ + imtemplateLabel 3 imtemplateFrame < +inf -inf * > \ + 3 \ + } \ + 5 \ + horizontal { 1 imlistLabel < +inf -inf * > 1 } \ + imlistFrame < +inf -inf * +inf -inf > \ + 3 \ + dirLabel < +inf -inf * > \ + 3 \ + horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \ + 3 \ + } + *imtemplateLabel.label: Filter: + *imtemplateText*editType: edit + *imtemplateText*height: 23 + *imtemplateText*font: 7x13 + !*imageList.width: 100 + *imageList*height: 140 + *imageList.shadeSurplus: False + *imageList.defaultColumns: 3 + *imageList.font: 7x13 + *imlistView.resizeable: True + *imlistLabel.height: 0 + *imlistLabel.label: xxx + *imlistLabel.justify: left + *imlistLabel.font: *lucida-bold-r*10* + *upButton.label: Up + *rootButton.label: Root + *homeButton.label: Home + *rescanButton.label: Rescan + *dirLabel.label: \ \ Directory: + *dirLabel.alignment: left + *fnameLabel.label: Load File: + *fnameText*editType: edit + *fnameText.height: 22 + + *imoptsGroup.label: Options + *imoptsGroup.frameWidth: 2 + *imoptsGroup.outerOffset: 7 + *imoptsGroup*offIcon: square0s + *imoptsGroup*onIcon: square1s + *imoptsGroup*highlightColor: yellow + *imoptsLayout*Label.shadowWidth: 0 + *imoptsLayout*Label.justify: left + *imoptsLayout.layout: vertical { \ + 3 \ + horizontal { \ + 3 \ + autoload 6 grayscale \ + 3 < +inf > \ + browseHdrs \ + 3 < +inf > \ + frameLabel 2 frameFrame \ + 3 \ + } \ + 6 \ + horizontal { \ + 3 \ + zscale 6 zrange \ + 3 \ + z1Label z1Frame < +inf * > 2 \ + z2Label z2Frame < +inf * > 2 \ + nsampLabel nsampFrame < +inf * > \ + 3 \ + } \ + 3 \ + } + *grayscale.label: Auto Grayscale + *grayscale.location: 0 0 100 22 + *autoload.label: Auto Load + *autoload.location: 0 0 80 22 + *autoload.on: True + *browseHdrs.label: List Image Headers + *browseHdrs.location: 0 0 120 22 + *browseHdrs.on: False + *zscale.label: Zscale + *zscale.location: 0 0 60 22 + *zrange.label: Zrange + *zrange.location: 0 0 60 22 + *z1Label.label: z1 + *z1Value*width: 60 + *z1Value*height: 22 + *z1Value*editType: edit + *z2Label.label: z2 + *z2Value*width: 60 + *z2Value*height: 22 + *z2Value*editType: edit + *nsampLabel.label: Nsample + *nsampValue*width: 60 + *nsampValue*height: 22 + *nsampValue*editType: edit + *frameLabel.label: Frame:\ + *frameFrame.width: 50 + *frameFrame.resize: False + *frameFrame.label: Current + *frameFrame.font: 6x13 + *frameFrame.menuName: loadFrames + + + *loadCmdGroup.label: + *loadCmdGroup*frameWidth: 2 + *loadCmdGroup*outerOffset: 5 + *loadCmdGroup.outerOffset: 2 + *loadCmdGroup*innerOffset: 5 + *loadCmdGroup.frameType: sunken + *loadCmdGroup.label: + *loadCmdGroup.location: 0 0 400 45 + *loadCmdLayout*Command.internalWidth: 12 + *loadCmdLayout.layout: horizontal { \ + 2 \ + filesLoadButton \ + 1 < +inf > \ + filesStatus \ + 2 \ + } + *filesLoadButton.label: Load + *filesStatus.label: +} + + + +set Resources(save_panel) { \ + + !===================================== + ! Save Setup Panel resources. ! + !===================================== + *save_panel*TextToggle.alignment: left + *save_panel*TextToggle.frameWidth: 0 + *save_panel*TextToggle.height: 20 + *save_panel*Label.borderWidth: 0 + *save_panel*Label.shadowWidth: 0 + *save_panel*TextButton.width: 80 + + *saveLayout.borderWidth: 0 + *saveLayout.layout: vertical { \ + saveNameGroup < +inf * > \ + saveOptGroup < +inf -inf * > -3 \ + saveCmdGroup < +inf * > \ + } + + ! Save Name Group resources. + !---------------------------------- + *saveNameGroup.borderWidth: 0 + *saveNameGroup.outerOffset: 5 + *saveNameGroup.label: + *saveNameGroup.location: 0 0 400 50 + *saveNameGroup*offIcon: diamond0s + *saveNameGroup*onIcon: diamond1s + *saveNameGroup*highlightColor: cyan + *saveNameGroup*Frame.frameType: sunken + *saveNameGroup*Frame.frameWidth: 1 + *saveNameGroup*Label.justify: right + *saveNameGroup*Text*editType: edit + *saveNameGroup*shadowWidth: 0 + *saveNameGroup*borderWidth: 0 + *saveNameLayout.borderWidth: 0 + *saveNameLayout.layout: vertical { \ + 2 \ + horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \ + 2 \ + } + *saveLabel.label: File Name: + *saveFile.height: 22 + + ! Main options groups layout resources. + !--------------------------------------- + *saveOptGroup.frameWidth: 2 + *saveOptGroup.frameType: chiseled + *saveOptGroup.label: + *saveOptGroup.location: 0 0 400 140 + *saveOptGroup.outerOffset: 5 + *saveOptGroup.innerOffset: 0 + *saveOptLayout*borderWidth: 0 + *saveOptLayout.layout: horizontal { \ + -1 \ + vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \ + -1 \ + vertical { \ + 10 < -10 > \ + saveDataBox < +inff -inff * +inff -inff > \ + 5 < -5 > \ + } \ + -1 \ + vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \ + -1 \ + } + + ! Output color box resources. + ! ------------------------------ + *saveColorGroup.location: 0 0 140 120 + *saveColorGroup.outerOffset: 7 + *saveColorGroup.frameWidth: 2 + *saveColorGroup*offIcon: diamond0s + *saveColorGroup*onIcon: diamond1s + *saveColorGroup*highlightColor: cyan + *saveColorGroup.innerOffset: 5 + *saveColorGroup.label: Output Color + *saveColorGroup*TextToggle.width: 110 + *saveColor.frameWidth: 2 + *saveColor.layout: horizontal { \ + 3 \ + vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \ + -1 \ + } + *svGrayButton.label: Grayscale + *svPseudoButton.label: PseudoColor + *svRGBButton.label: RGB + + *saveDataBox.frameType: sunken + *saveDataBox.frameWidth: 1 + + + ! Output format box resources. + ! ----------------------------------- + *fmtGroup.location: 0 0 140 120 + *fmtGroup.outerOffset: 7 + *fmtGroup.frameWidth: 2 + *fmtGroup*offIcon: diamond0s + *fmtGroup*onIcon: diamond1s + *fmtGroup*TextToggle.width: 55 + *fmtGroup*highlightColor: cyan + *fmtGroup.label: File Format + *formats.layout: horizontal { \ + 3 \ + vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \ + 2 < -2 > \ + vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \ + -1 \ + } + *rasButton.label: RAS + *gifButton.label: GIF + *jpegButton.label: JPEG + *tiffButton.label: TIFF + *fitsButton.label: FITS + *x11Button.label: X11 + *epsButton.label: EPS + *rawButton.label: Raw + + ! Change the sensitivity once these formats are implemented. ! + !------------------------------------------------------------- + *jpegButton.sensitive: False + *x11Button.sensitive: False + *rawButton.sensitive: False + + + ! Panel command resources. + ! ------------------------------ + *saveCmdLayout.borderWidth: 0 + *saveCmdGroup.frameType: chiseled + *saveCmdGroup.frameWidth: 2 + *saveCmdGroup.outerOffset: 5 + *saveCmdGroup.innerOffset: 5 + *saveCmdGroup.label: + *saveCmdGroup.location: 0 0 400 50 + *saveCmdLayout*Command.internalWidth: 12 + *saveCmdLayout.layout: horizontal { \ + 2 \ + okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \ + 2 \ + } + *okaySave.label: Save +} + + +set Resources(tile_panel) { \ + + *tileOpts.frameType: chiseled + *tileOpts.frameWidth: 2 + *tileOpts.outerOffset: 5 + *tileOpts.innerOffset: 7 + *tileOpts*shrinkToFit: True + *tileOpts*borderWidth: 0 + + *toptLayout.layout: vertical { \ + horizontal { -6 tFramesG < +inf -inf * > -6 } \ + horizontal { \ + -1 \ + horizontal { -6 tileMode < * +inf -inf > -6 } \ + vertical { \ + horizontal { -3 userOrientG < +inf -inf * > -3 } \ + horizontal { -3 fillStyle < +inf -inf * > -3 } \ + horizontal { -3 tileLabel < +inf -inf * > -3 } \ + -7 \ + horizontal { -3 geomFrame < +inf -inf * > -3 } \ + } \ + -1 \ + } \ + -4 \ + } + *tileMode.label: Tile Mode + *tileMode.outerOffset: 7 + *tileMode.innerOffset: 5 + *tileMode*location: 0 0 150 20 + *tileMode*TextToggle.outerOffset: 2 + *tileMode*TextToggle.innerOffset: 1 + *tileMode*TextToggle.frameWidth: 0 + *tileMode*TextToggle.leftMargin: 10 + *tileMode*TextToggle.rightMargin: 20 + *tileMode*TextToggle.onIcon: diamond1s + *tileMode*TextToggle.offIcon: diamond0s + *tileMode*TextToggle.highlightColor: yellow + + *tileDisabled.label: Disabled + *tileManual.label: Manual + *tileBest.label: Best + *tileSquare.label: Square + *tileHorizontal.label: Horizontal + *tileVertical.label: Vertical + *tileRow.label: One Row + *tileCol.label: One Column + + *fillStyle.label: Fill Style + *fillStyle.location: 0 0 160 30 + *fillStyle.outerOffset: 7 + *fillStyle.innerOffset: 5 + *fillStyle.rows: 1 + *fillStyle*selectionStyle: multi + *fillStyle*outerOffset: 0 + *fillStyle*innerOffset: 1 + *fillStyle*leftMargin: 7 + *fillStyle*onIcon: square1s + *fillStyle*offIcon: square0s + *fillStyle*highlightColor: yellow + *fillStyle.TextToggle.frameWidth: 0 + *fillStyle.TextToggle.location: 0 0 85 23 + *byCols.label: Fill by Columns + *bottomUp.label: Fill from Bottom + + *tileLabel.label: Tile Labels + *tileLabel.location: 0 0 175 30 + *tileLabel.outerOffset: 7 + *tileLabel.innerOffset: 5 + *tileLabel.rows: 1 + *tileLabel*selection: -1 + *tileLabel*outerOffset: 0 + *tileLabel*innerOffset: 1 + *tileLabel*leftMargin: 7 + *tileLabel*onIcon: square1s + *tileLabel*offIcon: square0s + *tileLabel*highlightColor: yellow + *tileLabel.TextToggle.frameWidth: 0 + *tileLabel.TextToggle.location: 0 0 85 23 + *labelFrames.label: Frameno + *labelImname.label: Img Name + *labelTitles.label: Img Title + + *geomFrame.frameWidth: 0 + *geomFrame.frameType: sunken + *geomFrame.outerOffset: 7 + *geomFrame.innerOffset: 4 + *tileGeometry.width: 220 + *tileGeometry.height; 37 + *tileGeometry.background: #c4c4c4 + *tileGeometry.font: 7x13bold + *tileGeometry.label: Tile Geometry: 1 x 2 + + *userOrientG.label: Manual Configuration + *userOrientG.height: 90 + *userOrientG.width: 220 + *userOrientG.outerOffset: 7 + *userOrientG.innerOffset: 5 + *userOrientG.shrinkToFit: True + *userOrientG*Frame.frameWidth: 1 + *userOrientG*Frame.frameType: sunken + *userOrientG*Text.height: 21 + *userOrientG*Text*editType: edit + *userOrientL.borderWidth: 0 + *userOrientL.layout: vertical { \ + 1 \ + horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \ + } + *nrowLab.justify: right + *ncolLab.justify: right + + *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease} + *nrdecrease.direction: left + *nrincrease.direction: right + *nrowLab.label: Tile Rows: + *nrtext.background: #adadad + *nrtext.justify: center + *nrtext.font: 7x13bold + *nrtext.label: 1 + + *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease} + *ncdecrease.direction: left + *ncincrease.direction: right + *ncolLab.label: Tile Columns: + *nctext.background: #adadad + *nctext.justify: center + *nctext.font: 7x13bold + *nctext.label: 2 + + *tFramesG.label: Tile Frames + *tFramesG.outerOffset: 7 + *tFramesG.innerOffset: 7 + *tFrames.borderWidth: 0 + *tFrames*Toggle.height: 17 + *tFrames.layout: horizontal { \ + tAll \ + 2 \ + tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \ + tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \ + tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \ + 2 \ + tNone \ + } + *tAll.label: All\ + *tNone.label: None +} + + +set Resources(wcs_panel) { \ + + !-------------------- + ! WCS Readout Panel + !-------------------- + *wcsGroup*TextToggle.offIcon: square0s + *wcsGroup*TextToggle.onIcon: square1s + + !*wcsLayout*TextToggle.location: 0 0 160 23 + *wcsLayout*TextToggle.height: 23 + *wcsLayout*TextToggle.outerOffset: 0 + *wcsLayout*Layout.borderWidth: 0 + *wcsLayout.borderWidth: 0 + *wcsLayout.layout: vertical { \ + 0 < +0 -0 > \ + wcsGroup < +inf -inf * > \ + 5 \ + horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \ + -2 \ + } + + *wcsOptGroup.label: + *wcsOptGroup.outerOffset: 0 + *wcsOptGroup.innerOffset: 5 + *wcsOptGroup.frameType: chiseled + *wcsOptGroup.frameWidth: 0 + *wcsOptLayout.layout: vertical { \ + horizontal { -9 wcsCoords < +inf -inf * > -9 } \ + -3 \ + horizontal { -5 wcsOpts < +inf -inf * > -5 } \ + horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \ + 1 \ + } + + *wcsOpts.label: + *wcsOpts.width: 265 + *wcsOpts.height: 40 + *wcsOpts.outerOffset: 3 + *wcsOpts.innerOffset: 3 + *woLayout*TextToggle.frameWidth: 0 + *woLayout*TextToggle.onIcon: square1s + *woLayout*TextToggle.offIcon: square0s + *woLayout*TextToggle.highlightColor: cyan + *woLayout*TextToggle.alignment: left + *woLayout*TextToggle.leftMargin: 5 + *woLayout.layout: horizontal { \ + 3 \ + woptLabels < +inf -inf * > 2 \ + woptTitles < +inf -inf * > 2 \ + woptFBinfo < +inf -inf * > 2 \ + woptBPM < +inf -inf * > \ + 3 \ + } + *woptLabels.label: WCS Labels + *woptLabels.on: True + *woptTitles.label: Image Titles + *woptTitles.on: True + *woptFBinfo.label: Frame Buffer Info + *woptFBinfo.on: True + *woptBPM.label: BPM Data + *woptBPM.on: False + *woptLabels.location: 0 0 150 21 + *woptTitles.location: 0 0 150 21 + *woptFBinfo.location: 0 0 175 21 + *woptBPM.location: 0 0 120 21 + + + *wcsCoords.label: Readout Values + *wcsCoords.width: 265 + *wcsCoords.height: 135 + *wcsCoords.outerOffset: 7 + *wcsCoords.innerOffset: 3 + *wcLayout*TextToggle.offIcon: diamond0s + *wcLayout*TextToggle.onIcon: diamond1s + *wcLayout*TextToggle.highlightColor: yellow2 + *wcLayout*TextToggle.shrinkToFit: True + *wcLayout*TextToggle.frameWidth: 0 + *wcLayout*TextToggle.label: + *wcLayout*TextToggle.on: True + *wcLayout*Label.justify: right + *wcLayout*Label.font: 7x13bold + *wcLayout*SimpleMenu.borderColor: black + *wcLayout*SimpleMenu.borderWidth: 1 + *wcLayout*SimpleMenu.foreground: White + *wcLayout*SimpleMenu.background: SteelBlue + *wcLayout*MenuButton.shadowWidth: 1 + *wcLayout*MenuButton.resize: False + *wcLayout.layout: vertical {\ + 1 \ + horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\ + 1 \ + horizontal { 5 wcLine < +inf -inf * > 5 } \ + 5 \ + horizontal { \ + 10 \ + vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \ + vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \ + vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \ + vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \ + vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \ + } \ + 3 \ + } + *wcTitle.label: Type\ \ \ \ \ \ \ \ \ \ Format\ \ \ \ \ \ Panel\ ImgWin + + *wcLine.height: 2 + *wcLine.frameWidth: 2 + *wcLine.frameType: ledged + + *wlWcs1.label: First WCS + *wlWcs2.label: Second WCS + *wlWcs3.label: Third WCS + *wlWcs4.label: Fourth WCS + *sysWcs1.label: \ Image Display\ + *sysWcs1.menuName: sysMenu1 + *sysWcs2.label: None + *sysWcs2.menuName: sysMenu2 + *sysWcs3.label: None + *sysWcs3.menuName: sysMenu3 + *sysWcs4.label: None + *sysWcs4.menuName: sysMenu4 + *fmtWcs1.label: \ Sexigesimal\ + *fmtWcs1.menuName: fmtMenu1 + *fmtWcs2.label: None + *fmtWcs2.menuName: fmtMenu2 + *fmtWcs3.label: None + *fmtWcs3.menuName: fmtMenu3 + *fmtWcs4.label: None + *fmtWcs4.menuName: fmtMenu4 + + *editMenu fmtWcsMenu$i fmtWcs$i $items + + *wcsIsmGroup.label: + *wcsIsmGroup.width: 395 + *wcsIsmGroup.height: 50 + *wcsIsmGroup.outerOffset: 3 + *wcsIsmGroup.innerOffset: 5 + *wcsIsmGroup*borderWidth: 0 + *wcsIsmLayout.layout: horizontal { \ + wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \ + } + *wcsIsmLabel.label: ISM Command + *wcsIsmFrame.frameType: sunken + *wcsIsmFrame.frameWidth: 1 + *wcsIsmFrame.outerOffset: 1 + *wcsIsmFrame*height: 23 + *wcsIsmCmd*editType: edit + *wcsIsmCmd.displayCaret: True + *wcsIsmInit.label: Initialize + *wcsIsmInit.internalWidth: 7 + + *wcsBox*borderWidth: 0 + *wcsBox*TextToggle.frameType: raised + *wcsBox*TextToggle.frameWidth: 1 + *wcsBox*TextToggle.leftMargin: 2 + *wcsBox*borderWidth: 0 + *wcsBox.layout: vertical { \ + wcsFrame < +inf -inf * > \ + 2 \ + horizontal { \ + 2 \ + ismToggle < +inf -inf * > 2 \ + pixelTable < +inf -inf * > 2 \ + imageHeader < +inf -inf * > 2 \ + compass < +inf -inf * > 2 \ + wcsOptions < +inf -inf * > \ + 2 \ + } \ + } + *ismToggle.label: ISM Mod + *ismToggle.label: WCS/Pix + *pixelTable.label: Pix Table + *imageHeader.label: Header + *imageHeader.sensitive: False + *compass.label: Compass + *wcsOptions.label: Options + + *wcsGroup.label: + *wcsGroup.outerOffset: 0 + *wcsGroup.innerOffset: 5 + *wcsGroup.frameType: chiseled + *wcsGroup.frameWidth: 2 + *wcsGroup*Text*width: 260 + *wcsGroup*Text*height: 17 + *wcsGroup*Text*font: 7x13 + *wcsGroup*Text*displayCaret: False + *wcsGroup*Text*editType: read + *wcsGroup*Text*background: black + *wcsGroup*Text*foreground: yellow2 + *wcsGroup*TextToggle.highlightColor: cyan + *wcsFrame.frameType: sunken + *wcsFrame.frameWidth: 1 + *wcsText*background: yellow4 + *wcsText.layout: vertical { \ + wtName < +inf -inf * > -3 \ + wtTitle < +inf -inf * > -3 \ + wtFBCfg < +inf -inf * > \ + 1 < -1 > \ + wtWcs1 < +inf -inf * > -3 \ + wtWcs2 < +inf -inf * > -3 \ + wtWcs3 < +inf -inf * > -3 \ + wtWcs4 < +inf -inf * > \ + 1 < -1 > \ + horizontal { \ + wtIPixval < +inf -inf * +inf > 1 \ + wtSPixval < +inf -inf * +inf > 1 \ + wtBPixval < +inf -inf * +inf > \ + } \ + } +} + + +set Resources(blink_panel) { \ + + *blink_panel.geometry: 425x200 + *blink_panel.title: Blink/Register Frames + + *brMenuBar*Command.internalHeight: 4 + *brMenuBar*Command.internalWidth: 12 + *brMenuBar*Command.height: 27 + *brMenuBar*borderWidth: 0 + + *brMenuBar*Label.font: 7x13bold + *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1 + + + *brMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> brClose 5 } \ + 5 < -5 > \ + } + *brClose.label: Dismiss + + *brMenuFrame.frameType: raised + *brMenuFrame.frameWidth: 2 + *bpLayout.layout: vertical { \ + brMenuFrame < +inf -inf * > \ + 1 < -1 > \ + brFrame < +inf -inf * +inf -inf > \ + } + + *brFrame.frameType: chiseled + *brFrame.frameWidth: 2 + *brFrame.outerOffset: 4 + *brFrame.innerOffset: 4 + + *brLayout.borderWidth: 0 + *brLayout.layout: vertical { \ + 3 < -3 > \ + horizontal { -3 brFramesG < +inf -inf * > -3 } \ + -5 \ + horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \ + -5 \ + } + + *brCmdG.label: + *brCmdG.outerOffset: 7 + *brCmdG.innerOffset: 7 + *brCmdG*borderWidth: 0 + *brCmd.layout: horizontal { \ + 2 \ + vertical { \ + 2 \ + horizontal { \ + 2 \ + brRateLabel \ + 2 \ + brBRframe < +inf -inf * >\ + 4 \ + brReset \ + 2 \ + } \ + 8 < -8 > \ + horizontal { \ + 4 \ + brMatchButton < +inf -inf * > \ + 5 < -5 > \ + brRegButton < +inf -inf * > \ + 2 \ + } \ + 1 < +inf > \ + } \ + 10 \ + vertical { \ + 2 \ + brBlinkButton < +inf * > \ + 10 < -10 > \ + brAregButton < +inf * > \ + 1 < +inf > \ + } \ + 2 \ + } + + *brFramesG.label: Frames List + *brFramesG.outerOffset: 7 + *brFramesG.innerOffset: 7 + *brFramesG*SimpleMenu.borderColor: black + *brFramesG*SimpleMenu.borderWidth: 1 + *brFramesG*SimpleMenu.foreground: White + *brFramesG*SimpleMenu.background: SteelBlue + + *brFrames.borderWidth: 0 + *brFrames.layout: horizontal { \ + 5 < +inf > \ + brFrame1 < +inf * > 1 \ + brFrame2 < +inf * > 1 \ + brFrame3 < +inf * > 1 \ + brFrame4 < +inf * > 1 \ + brFrame5 < +inf * > 1 \ + brFrame6 < +inf * > 1 \ + brFrame7 < +inf * > 1 \ + brFrame8 < +inf * > 1 \ + brFrame9 < +inf * > 1 \ + brFrame10 < +inf * > 1 \ + brFrame11 < +inf * > 1 \ + brFrame12 < +inf * > 1 \ + brFrame13 < +inf * > 1 \ + brFrame14 < +inf * > 1 \ + brFrame15 < +inf * > 1 \ + brFrame16 < +inf * > \ + 5 < +inf > \ + } + + *brBRlayout.layout: horizontal { \ + brBRdecrease \ + brBRtext < +inf -100% * > \ + brBRincrease \ + } + + *blink_panel*TextToggle.location: 0 0 110 23 + *blink_panel*TextToggle.frameWidth: 1 + *blink_panel*TextToggle.highlightColor: yellow + *blink_panel*TextToggle.offIcon: square0s + *blink_panel*TextToggle.onIcon: square1s + *blink_panel*TextToggle.outerOffset: 0 + *blink_panel*TextToggle.innerOffset: 2 + *blink_panel*Command.height: 23 + *blink_panel*Arrow.width: 16 + *blink_panel*Arrow.height: 20 + + + *brFramesLabel.label: Frames: + *brFrame1.menuName: frame1Menu + *brFrame2.menuName: frame2Menu + *brFrame3.menuName: frame3Menu + *brFrame4.menuName: frame4Menu + *brFrame5.menuName: frame5Menu + *brFrame6.menuName: frame6Menu + *brFrame7.menuName: frame7Menu + *brFrame8.menuName: frame8Menu + *brFrame9.menuName: frame9Menu + *brFrame10.menuName: frame10Menu + *brFrame11.menuName: frame11Menu + *brFrame12.menuName: frame12Menu + *brFrame13.menuName: frame13Menu + *brFrame14.menuName: frame14Menu + *brFrame15.menuName: frame15Menu + *brFrame16.menuName: frame16Menu + *brReset.label: Reset + + *brRateLabel.label: Rate: + *brBRframe.frameType: sunken + *brBRframe.frameWidth: 1 + *brBRtext.width: 40 + *brBRtext.height: 23 + *brBRdecrease.direction: left + *brBRincrease.direction: right + *brRegButton.label: Register + *brMatchButton.label: Match LUTs + *brBlinkButton.label: Blink + *brAregButton.label: Auto-Register +} + + +set Resources(hdr_panel) { \ + + *hdr_panel.geometry: 550x600 + *hdr_panel.title: Image Header + + *hdr_panel*SimpleMenu.borderColor: black + *hdr_panel*SimpleMenu.borderWidth: 1 + *hdr_panel*SimpleMenu.foreground: White + *hdr_panel*SimpleMenu.background: SteelBlue + + *hdrMenuFrame.frameType: raised + *hdrMenuFrame.frameWidth: 2 + *hdrLayout.layout: vertical { \ + hdrMenuFrame < +inf -inf * > \ + hdrObjGroup < +inf -inf * > \ + hdrTabFrame < +inf -inf * +inf -inf> \ + } + + *hdrMenuBar*borderWidth: 0 + *hdrMenuBar*Command.internalHeight: 5 + *hdrMenuBar*Command.internalWidth: 12 + *hdrMenuBar.layout: vertical { \ + 5 < -5 > \ + horizontal { 10 < +inf -10> hdrClose 7 } \ + 5 < -5 > \ + } + *hdrClose.label: Dismiss + + *hdrObjGroup.label: + *hdrObjGroup.outerOffset: 7 + *hdrObjGroup.innerOffset: 4 + *hdrObjLayout.borderWidth: 0 + *hdrObjLayout.layout: vertical { \ + horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \ + } + *hdrObjLabel.label: Image Name: + *hdrObjMenu.label: + *hdrObjMenu.justify: left + *hdrObjMenu.font: 7x13 + *hdrObjMenu.menuName: objMenu + *hdrObjMenu.internalWidth: 5 + *hdrObjMenu.internalHeight: 1 + *hdrObjMenu.shadowWidth: 1 + + *hdrHdrGroup.tabLabel: Image Header + *hdrHdrGroup.label: + *hdrHdrGroup.outerOffset: 7 + *hdrHdrGroup.innerOffset: 5 + *hdrHdrLayout.borderWidth: 0 + *hdrHdrLayout.layout: vertical { \ + horizontal { \ + hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \ + } \ + 5 \ + hdrText < +inf -inf * +inf -inf > \ + } + *hFindEntry*editType: edit + *hFindEntry*font: 7x13 + *hFindEntry*displayCaret: True + *hFindEntry*width: 150 + *hFindFrame.frameWidth: 1 + *hFindFrame*borderWidth: 0 + *hFindFrame.frameType: sunken + *hFindFrame.width: 150 + *hFindFrame.height: 23 + *hdrFilter.label: Keyword Filter + *hdrFind.label: Search + *hdrClear.label: Clear + + ! Resources if the header text widget is AsciiText +! *hdrText*scrollVertical: Always +! *hdrText*scrollHorizontal: Always +! *hdrText*editType: edit +! *hdrText*font: 7x13 +! *hdrText*background: #c4c4c4 +! *hdrText*displayCaret: False +! *hdrText*bottomMargin: 10 +! *hdrText*Scrollbar.width: 15 +! *hdrText*Scrollbar.height: 15 + + ! Resources if the header text widget is HTML + *hdrText.width: 600 + *hdrText.height: 500 + *hdrText.anchorUnderlines: 1 + *hdrText.visitedAnchorUnderlines: 1 + *hdrText.verticalScrollOnRight: True + *hdrText.plainFont: 7x13 + *hdrText.marginWidth: 5 + *hdrText.marginHeight: 5 + + + *hdrWcsGroup.tabLabel: Image WCS Info + *hdrWcsGroup.label: + *hdrWcsGroup.outerOffset: 5 + *hdrWcsGroup.innerOffset: 5 + *hdrWcsGroup*Text*scrollVertical: whenNeeded + *hdrWcsGroup*Text*scrollHorizontal: whenNeeded + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*displayCaret: False + *hdrWcsGroup*Text*borderWidth: 0 + *hdrWcsGroup*Text*editType: edit + *hdrWcsGroup*Text*font: 7x13 + *hdrWcsGroup*Text*Scrollbar.width: 15 + *hdrWcsGroup*Text*Scrollbar.height: 15 + *hdrWcsLayout.borderWidth: 0 + *hdrWcsLayout.layout: vertical { \ + 2 < -2 > \ + hdrInfoGroup < +inf -inf * > \ + 2 < -2 > \ + hdrKeywGroup < +inf -inf * +inf -inf > \ + -4 \ + } + *hdrInfoGroup.label: Basic WCS Information + *hdrInfoGroup.outerOffset: 7 + *hdrInfoGroup.innerOffset: 0 + *hdrIGFrame.frameType: sunken + *hdrIGFrame.frameWidth: 1 + *hdrIGText.height: 130 +! *hdrIGText*background: black +! *hdrIGText*foreground: yellow2 + *hdrIGText*background: #adadad + *hdrIGText*foreground: black + *hdrWcsGroup*hdrIGText*scrollVertical: never + *hdrWcsGroup*hdrIGText*scrollHorizontal: never + *hdrWcsGroup*hdrIGText*font: 7x13 + *hdrKeywGroup.label: WCS Header Keywords + *hdrKeywGroup.outerOffset: 7 + *hdrKeywGroup.innerOffset: 5 + *hdrKGFrame.frameType: sunken + *hdrKGFrame.frameWidth: 1 + *hdrKGText*background: #c4c4c4 + *hdrKGText*bottomMargin: 10 + + *hdrIGText*background: #c4c4c4 + *hdrIGFrame.frameWidth: 0 +} + + +set Resources(pixel_table) { \ + + *pixel_panel.title: Image Pixel Table + *pixel_panel*SimpleMenu.borderWidth: 1 + *pixel_panel*SimpleMenu.borderColor: black + *pixel_panel*SimpleMenu.foreground: White + *pixel_panel*SimpleMenu.background: SteelBlue + + *pixtabMenuBar*borderWidth: 0 + *pixtabMenuBar*Command.internalHeight: 4 + *pixtabMenuBar*Command.internalWidth: 12 + *pixtabMenuBar.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \ + 7 \ + } \ + 5 \ + } + *pixtabSize.label: Size + *pixtabSize.menuName: pixtabMenu + *pixtabHelp.label: Help + *pixtabHelp.sensitive: False + *pixtabClose.label: Dismiss + + *pixtabMenuFrame.frameType: raised + *pixtabMenuFrame.frameWidth: 2 + *pixel_table.layout: vertical { \ + 1 \ + pixtabMenuFrame < +inf -inf * > \ + 1 \ + pixtabFrame < +inf -inf * +inf -inf > \ + 1 \ + } + + + *pixtabFrame.frameType: raised + *pixtabFrame.frameWidth: 0 + *pixtabFrame*borderWidth: 0 + *pixtabFrame*font: 6x10 + *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-* + *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-* + + *pixtabFrame*MultiList.forceColumns: True + *pixtabFrame*MultiList.defaultColumns: 5 + *pixtabFrame*MultiList.shadeSurplus: False + *pixtabFrame*MultiList.borderWidth: 0 + *pixtabFrame*MultiList.rowHeight: 25 + *pixtabFrame*MultiList.rowSpacing: 7 + *pixtabFrame*MultiList.internalWidth: 7 + *pixtabFrame*MultiList.internalHeight: 4 + *pixtabFrame*MultiList.width: 410 + *pixtabFrame*MultiList.height: 160 + *pixtabFrame*MultiList.columnWidth: 50 + *pixtabFrame*MultiList.columnSpacing: 2 + *pixtabFrame*MultiList.maxSelectable: 1 + *pixtabFrame*MultiList.highlightForeground: red + *pixtabFrame*MultiList.highlightBackground: #c4c4c4 + *pixtabFrame*MultiList.background: #c4c4c4 + *pixtabFrame*TextToggle.background: #c4c4c4 + + *pixtabFrame*Label.width: 00 + !*pixtabFrame*Label.resize: False + + *meanFrame.frameWidth: 2 + *meanFrame.frameType: chiseled + *meanFrame.outerOffset: 0 + *meanFrame.width: 120 + *meanLabel.label: Mean: + *meanValue.label: + *meanValue.resize: False + + *sigFrame.frameWidth: 2 + *sigFrame.frameType: chiseled + *sigFrame.outerOffset: 0 + *sigFrame.width: 120 + *sigLabel.label: Stdev: + *sigValue.label: + *sigValue.resize: False + + *ptColFrame.frameWidth: 0 + *ptColFrame.outerOffset: 0 + *ptRowFrame.frameWidth: 0 + *ptRowFrame.outerOffset: 0 + + *pixtabFrame*ptColLabs.width: 410 + *pixtabFrame*ptColLabs.height: 23 + *pixtabFrame*ptColLabs.defaultColumns: 5 + *pixtabFrame*ptColLabs.forceColumns: True + *pixtabFrame*ptColLabs.columnWidth: 50 + *pixtabFrame*ptColLabs.columnSpacing: 2 + *pixtabFrame*ptRowLabs.width: 60 + *pixtabFrame*ptRowLabs.height: 110 + *pixtabFrame*ptRowLabs.defaultColumns: 1 + *pixtabFrame*ptRowLabs.forceColumns: True + *pixtabFrame*ptRowLabs.verticalList: True + *pixtabFrame*ptRowLabs.columnWidth: 50 + *pixtabFrame*ptRowLabs.columnSpacing: 2 + *pixtabFrame*pixtab.verticalList: True + + *ptFrame.outerOffset: 0 + *ptFrame.innerOffset: 0 + *ptFrame.borderWidth: 0 + *ptFrame.frameWidth: 1 + *ptFrame.frameType: sunken + *ptLayout.layout: vertical { \ + 3 \ + horizontal { 65 ptColFrame < +inf -inf * > 5 } \ + 1 \ + horizontal { \ + vertical { ptRowFrame< * +inf -inf > 5 } \ + 1 \ + vertical { ptFrame } \ + 5 \ + } \ + 1 \ + horizontal { \ + 2 < +inf > \ + meanLabel meanFrame < +inf -inf * > 2 \ + sigLabel sigFrame < +inf -inf * > \ + 10 \ + } \ + } +} + + +set Resources(help_panel) { \ + + !---------------------- + ! Help panel resources. + !---------------------- + *help_panel.title: XImtool Help Summary + *help_panel.width: 500 + *help_panel.height: 550 + *helpLayout*borderWidth: 0 + *helpLayout*Command.internalHeight: 4 + *helpLayout*Command.internalWidth: 12 + *helpLayout*HTML*shadowWidth: 1 + *helpLayout*helpText*Scrollbar.shadowWidth: 1 + + *helpMenuGroup.label: + *helpMenuGroup.height: 45 + *helpMenuGroup.outerOffset: 0 + *helpMenuGroup.innerOffset: 0 + *helpMenuGroup.frameType: raised + *helpMenubar.layout: vertical { \ + 5 < -5 > \ + horizontal { 20 < +inf -20 > helpClose 7 } \ + 5 < -5 > \ + } + *helpBack.label: Back + *helpBack.sensitive: False + *helpForward.label: Forward + *helpForward.sensitive: False + *helpHome.label: Home + *helpClose.label: Dismiss + + + *hfEntry*editType: edit + *hfEntry*font: 7x13 + *hfEntry*displayCaret: True + *hfFrame.frameWidth: 1 + *hfFrame.frameType: sunken + *hfFrame.width: 250 + *hfFind.label: Search + *hfFind.shadowWidth: 1 + *hfClear.label: Clear + *hfClear.shadowWidth: 1 + + *helpLayout.layout: vertical { \ + -1 \ + horizontal { helpMenuGroup < +inf -inf * > } \ + 5 \ + horizontal { \ + 5 \ + helpBack 2 helpForward 2 helpHome \ + 20 < +inf -20 > \ + hfFrame < +inf -inf * > 3 hfFind 1 hfClear \ + 5 \ + } \ + 5 \ + horizontal { helpTextFrame < +inf -inf * +inf -inf > } \ + horizontal { helpInfoLayout < +inf -inf * > } \ + -1 \ + } + *helpTextFrame.frameWidth: 1 + *helpTextFrame.frameType: sunken + *helpText.width: 600 + *helpText.height: 500 + *helpText.anchorUnderlines: 1 + *helpText.visitedAnchorUnderlines: 1 + *helpText.verticalScrollOnRight: true + *helpText*Scrollbar.shadowWidth: 1 + *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-* + *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-* +! *helpText.boldFont: 6x12bold + + + ! Contact info at the bottom of the panel. + *helpInfoLayout*Label.justify: center + *helpInfoLayout*Label.internalHeight: 0 + *helpInfoLayout.layout: horizontal { \ + 5 \ + vertical { 5 helpIRAFLogo 5 } \ + 1 < +inf > \ + vertical { \ + 5 \ + helpInfo1 < +inf -inf * +inf -inf > \ + helpInfo2 < +inf -inf * +inf -inf > \ + helpInfo3 < +inf -inf * +inf -inf > \ + 5 \ + } \ + 1 < +inf > \ + vertical { 5 helpNOAOLogo 5 } \ + 5 \ + } + *helpInfo1.label: XIMTOOL_VERSION + *helpInfo2.label: For help or questions: http://iraf.net + *helpInfo3.label: \ + NOAO is operated by AURA under cooperative agreement with the NSF + + *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-* + *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-* + + *helpInfoLayout.helpIRAFLogo.internalWidth: 0 + *helpInfoLayout.helpIRAFLogo.internalHeight: 0 + *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue + *helpInfoLayout.helpIRAFLogo.background: white + *helpInfoLayout.helpNOAOLogo.internalWidth: 0 + *helpInfoLayout.helpNOAOLogo.internalHeight: 0 + *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue + *helpInfoLayout.helpNOAOLogo.background: white +} + +set Resources(tcl_panel) { \ + + !-------------------------------- + ! Define a debug Tcl shell. + !-------------------------------- + *tcl_panel.width: 550 + *tcl_panel.height: 180 + *tcl_panel.title: Debug TCL Command Entry + *tclLayout*borderWidth: 0 + *tclLayout*Frame.frameType: sunken + *tclLayout*Frame.frameWidth: 2 + *tclLayout.layout: vertical { \ + 0 < +0 -0 > \ + tclCmdGroup < +inf -inf * > \ + tclFrame < +inf -inf * +inf -inf> \ + 0 < +0 -0 > \ + } + *tclEntry*foreground: black + *tclEntry*editType: edit + *tclEntry*type: string + *tclEntry*font: 7x13 + *tclEntry*scrollVertical: Always + *tclEntry*scrollHorizontal: whenNeeded + + *tclCmdGroup.label: + *tclCmdGroup.outerOffset: 0 + *tclCmdGroup.innerOffset: 0 + *tclCmd.layout: vertical { \ + 5 \ + horizontal { \ + 5 \ + tclClear 3 \ + tclExecute \ + 10 < +inf -10> \ + tclDismiss \ + 5 \ + } \ + 5 \ + } + *tclClear.label: Clear + *tclExecute.label: Execute + *tclDismiss.label: Dismiss +} + + +set Resources(warning) { \ + + ! --------------------- + ! WARNING dialog. + ! --------------------- + *warning.geometry: +400+300 + *warning*borderWidth: 0 + *warning*TextBox.frameWidth: 0 + + *warn.layout: vertical { \ + 5 < -5 > \ + horizontal { 5 warnFrame < +inf * +inf > 5 } \ + 5 < -5 > \ + horizontal { \ + 10 \ + warnOk < +inf * > \ + 5 < +inf -5 > \ + warnCancel < +inf * > \ + 10 \ + } \ + 5 < -5 > \ + } + *warnOk.label: Okay + *warnCancel.label: Cancel + + *WFlayout.layout: horizontal { \ + 5 < -5 > \ + vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \ + 5 < -5 > \ + warnText < +inf -inf * +inf -inf > \ + 5 < -5 > \ + } + + *warnLabel.label: Warning + *warnLabel.width: 300 + *warnLabel.height: 20 + *warnFrame.frameType: sunken + *warnFrame.frameWidth: 2 + *warnIcon.location: 0 0 40 40 + *warnIcon.image: WARNING + *warnText.label: generic warning text + *warnText.width: 270 + *warnText.height: 60 + *warnText.background: #c4c4c4 +} + + + + +set Resources(gui) { \ + + ! GUI resources. + ! ------------------------------ + *autoscale: True + *zoomfactors: 1 2 4 8 + *displayCoords: True + *displayPanner: True + *displayMagnifier: False + *blinkRate: 1.0 + *pannerArea: 150*150 + *pannerGeom: -5+5 + *magnifierArea: 100*100 + *magnifierGeom: +5+5 + *wcsboxGeom: -5-5 + *maxContrast: 5.0 + *showToolBar: False + *showPanelBar: False + *warnings: True + *centerBoxSize: 5 + *peakCentroid: True +} + + + + + +################################################################################ +# GUI Bootstrap Procedures +################################################################################ + +# Initialize the widget tree. +proc InitWidgetTree args \ +{ + global Objects Resources Version + + + # Add a new objects description for each of the panels found so we can + # create them by name later rather that with the defaults. + + set guiResources "" + foreach obj [array names Objects] { + set guiResources \ + [ format "%s\n\n*%s_objects:%s\n" \ + $guiResources $obj $Objects($obj) ] + } + + # Now append all the Resource strings, changing any version strings as + # needed. + + foreach res [array names Resources] { + regsub -all XIMTOOL_VERSION $Resources($res) $Version ver + set guiResources [ format "%s\n\n%s\n\n" $guiResources $ver ] + } + + # Define all of the GUI objects and resources. + appInitialize ximtool XImtool $guiResources +} + + +# Realize a window module, i.e. create it's objects. +proc Realize { module args } \ +{ + global Objects + + # Create any widgets for the module. We only do this once and set a + # flag to indicate the objects have been created so we don't do it on + # subsequent realizations. + if { [info exists Objects($module)] } { + createObjects [format "%s_objects" $module] + reset-server + } +} + + +# Bootstrap up the GUI. +InitWidgetTree +Realize ximtool +Realize parameters +Realize panelShell +Realize tcl_panel +Realize pixel_table +Realize hdr_panel +Realize blink_panel +Realize help_panel +Realize xpan_panel +Realize xmag_panel +Realize warning + +reset-server + +# Set the gterm widget focus. +send colorbar setGterm ; send colorbar activate +send imagewin setGterm ; send imagewin activate + +# Crank it up. +activate + + + + +############################################################################## +# Utility Procedures. +############################################################################## + +# Utility procedure to test True/False strings in resources. +proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}} + +# Utility functions. +proc min {a b} { expr {($a < $b) ? $a : $b} } +proc max {a b} { expr {($a > $b) ? $a : $b} } + +# Global variables. +set version "NOAO/IRAF XImtool Version 2.0BETA" + +set winWidth [send imagewin get width ] ;# display window width +set winHeight [send imagewin get height] ;# display window height +set appWidth [send display get width ] ;# application window width +set appHeight [send display get height] ;# application window height +set marker none ;# selected marker +set markno 0 ;# used to name new markers +set ruler none ;# selected ruler +set ruleno 0 ;# used to name new rulers +set blinkFrames "1 2" ;# list of blink frames +set auto_reg 0 + +set panel_up 0 ;# control panel mapped +set help_up 0 ;# help panel mapped +set ism_enable 0 ;# ISM is running +set ism_capable 1 ;# Client is ISM capable +set frameCache(0) "" ;# ISM frame cache + +set ctype "equatorial" ;# default coord type +set eqtype "fk5" ;# default equatorial type + +# Global constants. +set MAX_FRAMES 16 ;# max frame buffers + +# TCL constants +set tcl_precision 8 + + + +# Window resize callbacks. +proc winResize {w width height} { + global winWidth winHeight + + if {$width <= 1 || $height <= 1} \ + return + + set winWidth $width + set winHeight $height +} ; send imagewin addCallback winResize resize + +proc appResize {w width height} \ +{ + global doHcut doVcut cutXPos cutYPos + global appWidth appHeight + + set appWidth $width + set appHeight $height + + catch { + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + } +} ; #send imagewin addCallback appResize resize + + + +# Additional global variables, taking default values from resources. +getResources { + { zoomfactors } + { displayCoords } + { displayPanner } + { displayMagnifier } + { blinkRate } + { pannerArea } + { pannerGeom } + { magnifierArea } + { magnifierGeom } + { wcsboxGeom } + { maxContrast } + { showToolBar } + { showPanelBar } + { warnings } + { centerBoxSize } + { peakCentroid } + { highlight } +} + +set warnings [true $warnings] +set defaultBlinkRate $blinkRate + +# Client state variables (UI parameter objects). Certain of these parameters +# we mirror in Tcl variables here, updating the values with a callback when +# the parameter value changes. Others require special callbacks. + +set frame 1 ;# current display frame +set nframes 0 ;# number of frame buffers +set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames +set frameWidth 0 ;# frame buffer width, pixels +set frameHeight 0 ;# frame buffer height, pixels +set frameDepth 8 ;# frame buffer pixel size, bits +set cursorMode 0 ;# true when cursor read pending + +foreach i $frames { + set frameZoomX($i) 0 ;# X zoom factor + set frameZoomY($i) 0 ;# Y zoom factor + set frameCenterX($i) 0 ;# X center of field + set frameCenterY($i) 0 ;# Y center of field + set frameScaleX($i) 0 ;# X scale factor + set frameScaleY($i) 0 ;# Y scale factor + set frameOffsetX($i) 0 ;# X register offset + set frameOffsetY($i) 0 ;# Y register offset + set enhancement($i) none ;# colortable enhancement +} + + +#trace variable frameOffsetX w debug_pvar ;# Debug stuff +#trace variable frameOffsetY w debug_pvar +#trace variable frameZoomX w debug_pvar +#trace variable frameZoomY w debug_pvar +#trace variable frameScaleX w debug_pvar +#trace variable frameScaleY w debug_pvar + +proc debug_pvar { name element op } \ +{ + if {$element != ""} { + set name ${name}($element) + } + upvar $name x + puts "Variable $name set to $x" +} + + + + +################################################################################ +# Cut-plot handling routines. +################################################################################ + +set doHcut 0 +set doVcut 0 +set hstate 0 +set vstate 0 +set plotSpeed 1 ; send plotSpeed set on True +set curJump 1 ; send curJump set on True +set curTrack 1 ; send curTrack set on True + +set cutXPos [expr "$winWidth / 2"] +set cutYPos [expr "$winHeight / 2"] +set cutXScale 1.0 +set cutYScale 1.0 + + + +# Change the cursor to the crosshair when in the plot +proc cutCursor { widget event args } \ +{ + global doHcut doVcut curTrack + + if {! $curTrack} \ + return + + if { $event == "enterNotify" } { + send $widget setCursorType ginMode + + # Disable the update of the graph we're in while in the plot window. + if {$widget == "hcutPlot"} { set doHcut 0 } else { set doVcut 0 } + } elseif { $event == "leaveNotify" } { + send $widget setCursorType idle + + # Enable the update of the graph we're leaving. + if {$widget == "hcutPlot"} { set doHcut 1 } else { set doVcut 1 } + } + cutPlotRefresh +} +foreach w {hcutPlot vcutPlot} { + send $w addEventHandler cutCursor enterWindowMask + send $w addEventHandler cutCursor leaveWindowMask +} + +proc cutPlotRefresh args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutPlot clearScreen + hcutInit + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutPlot clearScreen + vcutInit + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask + +proc cutPlotRedraw args \ +{ + global doHcut doVcut cutXPos cutYPos + + if {$doHcut} { + send hcutAxes1 redraw ; send hcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } + if {$doVcut} { + send vcutAxes1 redraw ; send vcutAxes2 redraw + cutPlots $cutXPos $cutYPos + } +} + + +# Disable the options when we first start up. +#send plotOpts "set height 1 ; set width 1 ; unmap" +foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap } + + +# Cut-Plot options callback. +proc doPlotOpts { widget type state args } \ +{ + global plotSpeed curJump curTrack doHcut doVcut + global cutXPos cutYPos + + if {$state} { set not 0 } else { set not 1 } + + switch $widget { + plotSpeed { if {$state} { + send plotAccurate set on 0 ; send plotImgPix set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotAccurate { if {$state} { + send plotImgPix set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + plotImgPix { if {$state} { + send plotAccurate set on 0 ; send plotSpeed set on 0 + } else { + send plotSpeed set on True ; + } + set plotSpeed $not + } + curJump { send curSmooth set on $not ; set curJump $state } + curSmooth { send curJump set on $not ; set curJump $not } + curTrack { set curTrack $state } + } + + # Redraw the plots right away. + if {$widget == "plotSpeed" || $widget == "plotAccurate"} { + cutPlots $cutXPos $cutYPos + } +} +foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } { + send $w addCallback doPlotOpts +} + + +# Toggle the display of the horizontal or vertical cut plot windows. + +proc cutPlotToggle { widget type state args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + set debug 0 + + set hstate [send hcut get state] + set vstate [send vcut get state] + set w [send display get width] + set h [send display get height] + + if {$debug} { print " " ; print [format "display: %d x %d\n" $w $h] } + + if {$widget == "hcut"} { + set hfw [expr [send hcutFrame get width] - 4] + set hpw [send hcutPlot get width] + if {$state} { + # Enable the plot and resize the main window + if {$vstate} { + send plotOpts set width 134 + } + send hcutFrame "set width $hpw ; set height 132; map" + send hcutPlot "set width $hfw ; set height 128" + send display "set height [ expr ($h + 132) ]; set width $w" + drawHcutAxes 1 + setHcutCursor 1 + if {$vstate} { + send plotOpts "set height 134 ; map" + vcutInit + } + hcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setHcutCursor 0 + drawHcutAxes 0 + send hcutPlot clearScreen + send plotOpts "unmap; set height 4" + send hcutFrame "unmap; set width $hfw; set height 4" + send plotOpts "set width 4" + send display "set height [ expr ($h - 128) ] ; set width $w" + if {$vstate} { + vcutInit + } + } + set doHcut $state + } else { + set vfh [expr [send vcutFrame get height] - 4] + set vph [send vcutPlot get height] + if {$state} { + # Enable the plot and resize the main window + if {$hstate} { + send plotOpts set height 134 + } + send vcutFrame "set height $vph ; set width 132 ; map" + send vcutPlot "set height $vfh ; set width 128" + send display "set height $h; set width [ expr ($w + 132) ]" + drawVcutAxes 1 + setVcutCursor 1 + if {$hstate} { + send plotOpts "set height 134 ; set width 134; map" + hcutInit + } + vcutInit ;# Initialize the plot. + } else { + # Disable the plot and resize the main window + setVcutCursor 0 + drawVcutAxes 0 + send vcutPlot clearScreen + send plotOpts "unmap; set width 4" + send vcutFrame "unmap; set height $vfh; set width 4" + send plotOpts "set height 4" + send display "set width [ expr ($w - 128) ] ; set height $h" + if {$hstate} { + hcutInit + } + } + set doVcut $state + } + + if {$debug} { + print [format " hFrame: %d x %d\n" \ + [send hcutFrame get width] [send hcutFrame get height] ] + print [format " hPlot: %d x %d\n" \ + [send hcutPlot get width] [send hcutPlot get height] ] + print [format " vFrame: %d x %d\n" \ + [send vcutFrame get width] [send vcutFrame get height] ] + print [format " vPlot: %d x %d\n" \ + [send vcutPlot get width] [send vcutPlot get height] ] + print [format "state: %d %d\n" $hstate $vstate] + print [format "display: %d x %d\n" $w $h] + } + + cutPlots $cutXPos $cutYPos +} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle } + + +# Draw the cut plots. +proc cutPlots { xpos ypos args } \ +{ + global doHcut doVcut cutXPos cutYPos hstate vstate + + catch { + if {$doHcut} { + drawHcutIndicator $xpos + if {$hstate} { plotHcut $xpos $ypos } + } + if {$doVcut} { + drawVcutIndicator $xpos + if {$vstate} { plotVcut $xpos $ypos } + } + } + + set cutXPos $xpos ; set cutYPos $ypos +} + + +################################################################################ +# Horizontal Cut-Plot Routines +################################################################################ + +set hcutVec {} + +# Initiailize the horizontal cut-plot +proc hcutInit args \ +{ + global logz cutXScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send hcutPlot getPhysRes xr yr + send hcutPlot setLogRes $xr $yr + + set logx [send imagewin get width] + set logz [expr ($z2 - $z1)] + set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6" + drawHcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotHcut { xpos ypos } \ +{ + global doHcut cutXScale + global hcutVec cutXPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \ + return + + # Do the horizontal cut plot. + set width [send imagewin get width] + if {$plotSpeed} { + set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale] + } else { + set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Erase the last plot rather than clear the screen and redraw + # the new vector. + send hcutPlot setColorIndex background + send hcutPlot drawPolyline $hcutVec + send hcutPlot setColorIndex foreground + send hcutPlot drawPolyline $vec + set hcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawHcutIndicator $xpos + + # Minimize the screen refreshes to speed things up. + if { [expr "$ypos % 3"] == 0} { + catch { + drawHcutLabels $z1 $z2 ;# redraw the labels + } + send hcutAxes1 redraw ;# redraw the axes markers + send hcutAxes2 redraw + } +} + + +# Create markers to indicate axes on the horizontal cut-plot. +proc drawHcutAxes { state } \ +{ + if {$state} { + send hcutPlot createMarker hcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 60 \ + height 30 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + send hcutPlot createMarker hcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + height 60 \ + width 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send hcutAxes1 destroy ; send hcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setHcutCursor { state } \ +{ + if {$state} { + set pts { {252 10} {260 10} {256 1} } + + send hcutPlot createMarker hcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 256 \ + y 12 \ + width 8 \ + height 10 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send hcutCursor setVertices $pts + send hcutCursor set visible True + + } else { + send hcutCursor destroy + } +} + +# Label the axes on the horizontal cut plot. +proc drawHcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + send hcutPlot "setColorIndex 6 ; \ + drawAlphaText 2 10 [format "%.1f" $z2] ; \ + drawAlphaText 2 34 [format "%.1f" $high] ; \ + drawAlphaText 2 64 [format "%.1f" $mid] ; \ + drawAlphaText 2 94 [format "%.1f" $low] ; \ + drawAlphaText 2 120 [format "%.1f" $z1]" +} + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawHcutIndicator { xpos } \ +{ + global cutXScale cutXPos + + send hcutCursor move [expr ($xpos * $cutXScale)] 12 + set cutXPos $xpos +} + +# Track the cursor while in the cut-graph window. +proc hcutWCSUpdate { x y args } \ +{ + global cutYPos curTrack + if {$curTrack} { + wcsUpdate $x $cutYPos + } + drawHcutIndicator $x +} + + + + +################################################################################ +# Vertical Cut-Plot Routines +################################################################################ + +set vcutVec {} + +# Initiailize the vertical cut-plot +proc vcutInit args \ +{ + global cutYScale winWidth cutXPos cutYPos + + # Just get some dummy pixels, we only want the z1/z2 values so we can + # initialize the labels. + set xp [expr [send imagewin get width] / 2 ] + set yp [expr [send imagewin get height] / 2 ] + set pix [send client getPixels $xp $yp 2 2 ] + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + + send vcutPlot getPhysRes xr yr + send vcutPlot setLogRes $xr $yr + + set logy [send imagewin get height] + set logz [expr ($z2 - $z1)] + set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)] + + # Initialize the labels. + send vcutPlot "setColorIndex 6; reset" + drawVcutLabels $z1 $z2 +} + +# Draw the horizontal cut-plot. +proc plotVcut { xpos ypos } \ +{ + global doVcut cutYScale + global vcutVec cutXPos cutYPos plotSpeed + + + if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \ + return + + # Do the vertical cut plot. + set height [send imagewin get height] + if {$plotSpeed} { + set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale] + } else { + set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale] + } + set z1 [lindex $pix 0] + set z2 [lindex $pix 1] + set vec [lrange $pix 2 end] + + # Draw the vector. + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground + send vcutPlot drawPolyline $vec + set vcutVec $vec ;# save for later erasure + + # Mark the cursor position. + drawVcutIndicator $ypos + + # Minimize the screen refreshes to speed things up. + if { [expr "$xpos % 3"] == 0} { + catch { + drawVcutLabels $z1 $z2 ;# redraw the labels + } + send vcutAxes1 redraw ;# redraw the axes markers + send vcutAxes2 redraw + } +} + +# Erase the last plot rather than clear the screen and redraw it all. The +# erase is done by redrawing the last vector in the the background color. +proc eraseOldVcut args \ +{ + global cutYPos vcutVec + + send vcutPlot setColorIndex background + send vcutPlot drawPolyline $vcutVec + send vcutPlot setColorIndex foreground +} + +# Draw the horizontal cut-plot. +# Create markers to indicate axes on the vertical cut-plot. +proc drawVcutAxes { state } \ +{ + if {$state} { + send vcutPlot createMarker vcutAxes1 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 60 \ + y 1 \ + height 4096 \ + width 30 \ + activated True \ + visible True \ + sensitive False + send vcutPlot createMarker vcutAxes2 \ + type box \ + createMode noninteractive \ + lineColor gray60 \ + lineStyle 0 \ + x 1 \ + y 1 \ + width 60 \ + height 4096 \ + activated True \ + visible True \ + sensitive False + } else { + send vcutAxes1 destroy ; send vcutAxes2 destroy + } +} + +# Create a marker to be used as the cursor indicator. +proc setVcutCursor { state } \ +{ + if {$state} { + set pts { {10 252} {10 260} {1 256} } + + send vcutPlot createMarker vcutCursor \ + type polygon \ + createMode noninteractive \ + lineColor black \ + fill True \ + fillColor yellow \ + x 12 \ + y 256 \ + width 10 \ + height 8 \ + knotSize 0 \ + activated True \ + visible False \ + sensitive False + send vcutCursor setVertices $pts + send vcutCursor set visible True + + } else { + send vcutCursor destroy + } +} + +# Label the axes on the vertical cut plot. +proc drawVcutLabels { z1 z2 } \ +{ + set mid [expr "($z2-$z1)/2.0+$z1"] + set low [expr "($mid-$z1)/2.0+$z1"] + set high [expr "($z2-$mid)/2.0+$mid"] + + # Initialize the label strings and positions. + set labels {} + foreach i [list $z2 $high $mid $low $z1] { + lappend labels [ format "%.1f" $i ] + } + set xposns { 2 28 58 88 112 } + + send vcutPlot "setColorIndex 6" + + # Draw each label vertically down the position since we can't rotate + # the text. + set xp 0 + foreach lab $labels { + set chars [split $lab {} ] + set yp 12 + set xpos [lindex $xposns $xp] + foreach ch $chars { + if {$ch == "."} { incr yp -4 } + send vcutPlot drawAlphaText $xpos $yp $ch + incr yp 10 + } + incr xp + } +} + + +# Draw the cursor position indicator on the horizontal cut plot. +proc drawVcutIndicator { ypos } \ +{ + global cutYScale cutYPos + + send vcutCursor move 12 [expr ($ypos * $cutYScale)] + set cutYPos $ypos +} + + +# Track the cursor while in the cut-graph window. +proc vcutWCSUpdate { x y args } \ +{ + global cutXPos curTrack + if {$curTrack} { + wcsUpdate $cutXPos $y + } + drawVcutIndicator $y +} + + + +################################################################################ +# UTILITY ROUTINES +################################################################################ + + +# TICSTEP -- Utility routine to compute nice ticmark steps in plots. +# [ NOT CURRENTLY USED. ] + +proc ticstep { range nsteps } \ +{ + set t2 0.301029996 + set t5 0.698970004 + set df [ expr "$range / double($nsteps + 1)" ] + if {$df > 0.0} { + set p1 [ expr "log10(double($df))" ] + } else { + set p1 [ expr "log10(double(-$df))" ] + } + set p2 [ expr "int($p1)" ] + set p3 [ expr "$p1 - $p2" ] + + if { $p3 < 0.0 } { + set p3 [ expr "$p2 + 1.0" ] + set p2 [ expr "$p2 - 1.0" ] + } + + if { $p3 < 1.0e-10 } { + set ticstep [ expr "pow(double(10.0),double($p2))" ] + } elseif { $p3 > 0. && $p3 <= $t2 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t2))" ] + } elseif { $p3 > $t2 && $p3 <= $t5 } { + set ticstep [ expr "pow(double(10.0),double($p2 + $t5))" ] + } elseif { $p3 > $t5 && $p3 <= 1.0 } { + set ticstep [ expr "pow(double(10.0),double($p2 + 1.))" ] + } else { + set ticstep $df + } + + set logtic [ expr "int(log10($ticstep)) - 1" ] + set scale [ expr "pow(double(10.0),double($logtic))" ] + set ticstep [ expr "int( ($ticstep / $scale) * $scale)" ] + + if {$ticstep < 0.1} { set ticstep 0.10 } + + return $ticstep +} + + + +# Cursor positioning routines +#---------------------------- + +proc move_cursor { xstep ystep args } \ +{ + set raster 0 + send imagewin getCursorPos rx ry + send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster +} + + +# Called when the number of frames changes. +proc setNFrames {param old new} \ +{ + global frameMenuDescription nframes frames + + set nframes $new + if {$old != $new} { + foreach i {prevButton nextButton} { + send $i set sensitive [expr "$nframes > 1"] + } + + if {$nframes > 0} { + + # Creates the Frames menu on the main image window. + set items { } + for {set i 1} {$i <= $nframes} {incr i} { + set l [format "%2d" $i] + lappend items "$l f.exec \{send client setFrame $i\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + editMenu frameMenu frameButton $items + + # Create the menu for the blink frames list. + set items { } + for {set i 0} {$i <= $nframes} {incr i} { + set j [expr ($i + 1)] + if {$i == 0} { + set s "\"none\" f.exec \{send brFrameBTN set label \" \"\}" + lappend items $s + } else { + set l [format "%2d" $i] + lappend items "$l f.exec \{send brFrameBTN set label $l\} sensitive \{[expr \"$nframes >= $i\"]\}" + } + } + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + regsub -all BTN $items $i nmenu + editMenu frame${i}Menu brFrame$i $nmenu + } + + } else { + editMenu frameMenu frameButton $frameMenuDescription + + for {set i 1} {$i <= $nframes} {incr i} { + send brFrame$i setSensitive True + send tFrame$i setSensitive True + editMenu frame${i}Menu brFrame$i $frameMenuDescription + } + } + } + + for {set i 1} {$i <= 16} {incr i} { + if {$i <= $nframes} { + send frame$i map + } else { + send frame$i unmap + } + } + + if {$nframes > 2} { + setAllTileFrames + } +}; send nframes addCallback setNFrames + + +# Set the default main window frame menu. +set frameMenuDescription { + {" 1" f.exec "send client setFrame 1" sensitive {[expr "$nframes >= 1"]} } + {" 2" f.exec "send client setFrame 2" sensitive {[expr "$nframes >= 2"]} } + {" 3" f.exec "send client setFrame 3" sensitive {[expr "$nframes >= 3"]} } + {" 4" f.exec "send client setFrame 4" sensitive {[expr "$nframes >= 4"]} } +}; createMenu frameMenu frameButton $frameMenuDescription + + + + +# Initialize the frame lists panels (blink panel and tile tab). +for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label [format "%2d" $i] + send tFrame$i set label [format "%2d" $i] + if {$i <= 4} { + send brFrame$i setSensitive True + send tFrame$i "setSensitive True ; set state 1" + } else { + send brFrame$i setSensitive False + send tFrame$i "setSensitive False ; set state 0" + } + createMenu frame${i}Menu brFrame$i $frameMenuDescription +} + + +# Called when the frame being displayed changes. +proc frameChanged {param old new} \ +{ + global frame + + set frame $new + send frameButton set label [format "%2d" $frame] + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + wcsFmtFBConfig + drawCompass +}; send frame addCallback frameChanged + + +# Called when the frame buffer configuration changes. +proc setFrameSize {param old new} \ +{ + global frameWidth frameHeight frameDepth + set frameWidth [lindex $new 0] + set frameHeight [lindex $new 1] + set frameDepth [lindex $new 2] + + wcsFmtFBConfig +}; send frameSize addCallback setFrameSize + +# Called when the current frame is zoomed or panned. +proc setFrameView {param old new} \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameScaleX frameScaleY frameOffsetX frameOffsetY + global frame auto_reg blinkFrames + + # Update the position. + set frameZoomX($frame) [lindex $new 0] + set frameZoomY($frame) [lindex $new 1] + set frameCenterX($frame) [lindex $new 2] + set frameCenterY($frame) [lindex $new 3] + set frameScaleX($frame) [lindex $new 4] + set frameScaleY($frame) [lindex $new 5] + set frameOffsetX($frame) [lindex $new 6] + set frameOffsetY($frame) [lindex $new 7] + + # If auto-registering is enabled, do it now, but only when we're updating + # the current display frame, and only if that frame is in the framelist. + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + + foreach f $blinkFrames { + if {$f != $frame} { + set frameZoomX($f) $frameZoomX($frame) + set frameZoomY($f) $frameZoomY($frame) + set frameCenterX($f) $frameCenterX($frame) + set frameCenterY($f) $frameCenterY($frame) + set frameScaleX($f) $frameScaleX($frame) + set frameScaleY($f) $frameScaleY($frame) + } + } + } + deleteAllRulers + +}; send frameView addCallback setFrameView + + +# Called when the color enhancement for a frame changes. +proc setEnhancement {param old new} \ +{ + global enhancement + set enhancement([lindex $new 0]) [lrange $new 1 end] +}; send enhancement addCallback setEnhancement + +# Called when the frame title changes (e.g. frame change or new frame loaded). +proc setTitle {param old new} \ +{ + set lab [string trimright $new] + send imageTitle set label $lab + + set image [lindex [ split $lab '-'] 0 ] + wcsFmtImname $image + + set title [lindex [ split $lab '-'] 1 ] + wcsFmtImtitle $title + deleteAllRulers +}; send frameTitle addCallback setTitle + +# Called when the image is flipped in an axis. +proc setFlip {param old new} \ +{ + if {$param == "xflip"} { + send xflipButton set state [true $new] + } else { + send yflipButton set state [true $new] + } + deleteAllRulers +}; foreach i {xflip yflip} { send $i addCallback setFlip } + + +# Various general callbacks. + +proc Quit args \ +{ + global ism_enable + + if {$ism_enable} { + catch { send wcspix quit } + } + send client Quit +} +proc nextFrame args { send client nextFrame } +proc prevFrame args { send client prevFrame } +proc setColormap { mapno } { send client setColormap $mapno } +proc xflip args { send client flip x ; flipRegister } +proc yflip args { send client flip y ; flipRegister } +proc xyflip args { send client flip x y ; flipRegister } +proc flipRegister args \ +{ + global auto_reg frame blinkFrames + + if {$auto_reg == 1 && $frame == [send frameButton get label]} { + if {[string first $frame $blinkFrames] != -1} { + send client offsetRegister \{$blinkFrames\} + } + } +} + + + +# Initialize bitmaps. +createBitmap xflip 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18, + 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap yflip 16 16 { + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00} + +createBitmap qmark 16 16 { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c, + 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, + 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap larrow 16 16 { + 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e, + 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e, + 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00} + +createBitmap rarrow 16 16 { + 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e, + 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07, + 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00} + +createBitmap panel 16 16 { + 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f} + +createBitmap brightness 15 15 { + 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08, + 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b, + 0x84, 0x10, 0x80, 0x00, 0x00, 0x00} + +createBitmap contrast 15 15 { + 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f, + 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07, + 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00} + +createBitmap bar 10 10 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap dot 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, + 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap null 16 16 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +createBitmap solid 64 24 { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} + +catch { send controlButton "set bitmap panel; addCallback panel" } +catch { send helpButton "set bitmap qmark; addCallback Help" } +send xflipButton "set bitmap xflip; addCallback xflip" +send yflipButton "set bitmap yflip; addCallback yflip" +send prevButton "set bitmap larrow; addCallback prevFrame" +send nextButton "set bitmap rarrow; addCallback nextFrame" +send blinkPanel "set bitmap panel" + + + +# WINDOW the current frame. +set old_cm_x 0 +set old_cm_y 0 + +proc windowColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + # For efficiency we won't compute the sqrt of the distance but instead + # just compare the square. Use a threshold of 6 pixels so when we + # narrow in on the ROI we refine the colormap more precisely. + + set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \ + (($old_cm_y - $y) * ($old_cm_y - $y))] + + # Keep the old position. + set old_cm_x $x + set old_cm_y $y + if {$diff > 36} { + return + } + + send client windowColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + +proc updateColormap {x y} \ +{ + global winWidth winHeight maxContrast old_cm_x old_cm_y + + set old_cm_x $x + set old_cm_y $y + send client updateColormap \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] +} + + + +# WINDOW the current frame, but only one color at a time. +proc windowRGB {color x y save_flag} \ +{ + global winWidth winHeight maxContrast + + send client windowRGB $color \ + [expr "double($x) / $winWidth"] \ + [expr "(double($y) - $winHeight / 2.0) / $winHeight * \ + $maxContrast * 2.0"] $save_flag +} + + +# ZOOM and PAN. +set xcen 0 +set ycen 0 +foreach i $frames {set zoomindex($i) 0} +set nzoomfactors 0 +foreach i $zoomfactors { + set zoomfactor($nzoomfactors) $i + incr nzoomfactors +} + +# Zoom or pan image at given center. +proc zoom {x y} \ +{ + global xcen ycen frame + global zoomindex zoomfactor + global nzoomfactors + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set rx [expr "int ($rx)"] + set ry [expr "int ($ry)"] + + # If the pointer did not move (much) zoom the image, otherwise + # pan it. + + send imagewin setCursorType busy + if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} { + set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors] + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $rx $ry + } else { + send client pan $rx $ry + set xcen $x + set ycen $y + } + + # Move the pointer so that it tracks the object feature the user + # selected. + + send imagewin setCursorPos $rx $ry $raster + send imagewin getCursorPos xcen ycen + send imagewin setCursorType idle +} + + +# Zoom using a marker to indicate the region to be displayed. +proc zoomMarker {marker aspect} \ +{ + global xcen ycen frame + global winWidth winHeight + global zoomindex nzoomfactors + global auto_reg frame frameOffsetX frameOffsetY + + # getRegion returns: "rectangle raster x y width height rotangle". + set region [send $marker getRegion unmap] + + set raster [lindex $region 1] + set xcen [expr "int([lindex $region 2]) + 0.5"] + set ycen [expr "int([lindex $region 3]) + 0.5"] + set snx [expr "[lindex $region 4] * 2"] + set sny [expr "[lindex $region 5] * 2"] + + # Compute the magnification ratio. + set xmag [expr "$winWidth / $snx"] + set ymag [expr "$winHeight / $sny"] + if {$aspect == "equal"} { + set mag [expr "($xmag < $ymag) ? $xmag : $ymag"] + set xmag $mag; set ymag $mag + } + + # Zoom the image. + send client zoomAbs \ + $xmag $ymag $xcen $ycen \ + $frameOffsetX($frame) $frameOffsetY($frame) + + # The following causes a button2 to redisplay the full image. + send imagewin setCursorPos $xcen $ycen $raster + send imagewin getCursorPos xcen ycen + set zoomindex($frame) [expr "$nzoomfactors - 1"] +} + +# Pan the display frame one width/height in a given direction. +proc moveFrame { xs ys args } \ +{ + global winWidth winHeight frame + global frameWidth frameHeight + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # Get the step size for the new position. + set xstep_size [ expr "$xs * $winWidth / $frameZoomX($frame)" ] + set ystep_size [ expr "$ys * $winHeight / $frameZoomY($frame)" ] + + # Set the boundaries so we only move up to the edges. + set xl [ expr "($winWidth / $frameZoomX($frame)) / 2 + 1" ] + set yl [ expr "($winHeight / $frameZoomY($frame)) / 2 + 1" ] + set xu [ expr "$frameWidth - $xl" ] + set yu [ expr "$frameHeight - $yl" ] + + # Set the new center position. + set nxc [ expr "$frameCenterX($frame) + $xstep_size" ] + set nyc [ expr "$frameCenterY($frame) + $ystep_size" ] + if {$nxc < $xl} { set nxc $xl } + if {$nxc > $xu} { set nxc $xu } + if {$nyc < $yl} { set nyc $yl } + if {$nyc > $yu} { set nyc $yu } + + # Finally, send the command to move the frame. + send client zoomAbs \ + $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \ + $frameOffsetX($frame) $frameOffsetY($frame) +} + +proc resetView {param old new} { + global zoomindex xcen ycen frames + global frameWidth frameHeight + + if {$new == "done"} { + foreach i $frames { + send client setFrame $i + set xcen [expr $frameWidth / 2] + set ycen [expr $frameHeight / 2] + send client zoom 1 1 $xcen $ycen + set zoomindex($i) 0 + send client setColormap Grayscale + normalize + } + send client setFrame 1 + } +}; #send initialize addCallback resetView + + +# CURSOR READ stuff. +proc setCursorMode {param old new} \ +{ + global cursorMode + + if {$new == "on"} { + send imagewin "activate; setCursorType ginMode" + set cursorMode 1 + } elseif {$new == "off"} { + send imagewin "setCursorType idle; deactivate" + set cursorMode 0 + } +} + +proc keyInput {widget event sx sy data} \ +{ + global cursorMode frame + + if {!$cursorMode || $event != "keyPress"} \ + return + if {[lindex $data 0] == "??"} \ + return + + # Convert raw screen coordinates to raster pixel coordinates. + send imagewin unmapPixel $sx $sy raster rx ry + + # Return the cursor value and exit cursor mode. + send client retCursorVal $rx $ry $frame 1 [lindex $data 0] +} + +proc resetCursorMode args { + global cursorMode frame + if {$cursorMode} { + send imagewin getCursorPos x y + send client retCursorVal $x $y $frame 1 ^D + } +}; send initialize addCallback resetCursorMode + +send cursorMode addCallback setCursorMode +send imagewin addCallback keyInput input + + +# MARKER stuff. The active marker is determined by the global variable +# "marker", which is the marker the pointer is in, or which the pointer +# was most recently in. + +# Translations when pointer is inside marker. +set markerTranslations { \ +!Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(markerMenu) + <Btn3Up>: popdown(markerMenu) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: m_input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + +# Popup menu in effect when inside marker. +createMenu markerMenu imagewin { + { Marker f.title } + { f.dblline } + { Zoom f.exec { + zoomMarker $marker equal + send $marker destroy + } } + { Fill f.exec { + zoomMarker $marker fill + send $marker destroy + } } + { Print f.exec { + send $marker getRect interior x0 y0 nx ny + setPrintCorners $x0 [expr $y0 + $ny -1] \ + [expr $x0 + $nx -1] $y0 + send client print $x0 $y0 $nx $ny + } } + { Save f.exec { + send imagewin setCursorType busy + send $marker getRect interior x0 y0 nx ny + send client save $x0 $y0 $nx $ny + send imagewin setCursorType idle + } } + { Info f.exec { + send infoText append \ + [format "%s\n" [send $marker getRegion unmap]] + } } + { Unrotate f.exec { + send $marker setAttribute rotangle 0 + } } + { f.dblline } + { Color f.menu markerColor } + { Type f.menu markerType } + { f.dblline } + { Destroy f.exec { + send $marker destroy + } } +} + +createMenu markerType markerMenu { + { Type f.title } + { f.dblline } + { Rectangle f.exec "m_setType $marker rectangle" } + { Box f.exec "m_setType $marker box" } + { Circle f.exec "m_setType $marker circle" } + { Ellipse f.exec "m_setType $marker ellipse" } + { Polygon f.exec "m_setType $marker polygon" } +} + +createMenu markerColor markerMenu { + { Color f.title } + { f.dblline } + { "" f.exec "m_setColor $marker black" + bitmap solid foreground black } + { "" f.exec "m_setColor $marker white" + bitmap solid foreground white } + { "" f.exec "m_setColor $marker red" + bitmap solid foreground red } + { "" f.exec "m_setColor $marker green" + bitmap solid foreground green } + { "" f.exec "m_setColor $marker blue" + bitmap solid foreground blue } + { "" f.exec "m_setColor $marker magenta" + bitmap solid foreground magenta } + { "" f.exec "m_setColor $marker cyan" + bitmap solid foreground cyan } + { "" f.exec "m_setColor $marker yellow" + bitmap solid foreground yellow } +} + +proc m_setType {marker type} { + send $marker "markpos; set type $type; redraw" +} +proc m_setColor {marker color} { + send $marker "markpos; + set lineColor $color; set highlightColor $color; redraw" +} + +# Callback executed when a marker gets or loses the focus. +proc selectMarker {active_marker event event_data} \ +{ + global marker + switch $event { + focusIn { set marker $active_marker } + focusOut { } + } +} + +# Create marker action. Makes a new marker. +proc makeMarker {parent x y} \ +{ + global markerTranslations markno + set marker marker$markno; incr markno + + send $parent createMarker $marker \ + type rectangle \ + createMode interactive \ + translations $markerTranslations \ + x $x \ + y $y + + send $marker addCallback selectMarker focusIn focusOut +} + + + +# WCSBOX -- Real time coordinate display. + +set track_enable 0 +set last_x 0 +set last_y 0 + +proc wcsUpdate {x y} \ +{ + global track_enable frame pixtab_up tabTop + global frameWidth frameHeight redraw_compass + global ism_enable wcsLabels last_x last_y + global ct_warn plotSpeed doHcut doVcut + + + # If the cursor was frozen release it now. + if {$ct_warn} { + curtrack_destroy + } + + # Convert screen coords to raster pixel. + send imagewin unmapPixel $x $y raster rx ry rz + + # Set the current frame to the frame the pointer is within. + if {$frame && $raster} { + set track_frame [send client getFrame $raster] + if {$frame != $track_frame} { + send client setFrame $track_frame + } + } + + # Update coords box. + if {$raster} { + set text [send client encodewcs $rx $ry $rz] + scan $text "%g %g %g" nx ny nz + } else { + set text [format " %7.2f %7.2f %9.1f " $rx $ry $rz] + set nx $rx ; set ny $ry ; set nz $rz + } + + # Update the coords panel and pixel table. + wcsFmtSValue $nz + if {$pixtab_up} { + updatePixelTable $x $y $nx $ny + } + + # If the ISM is running update the coords box with all the selected + # options, otherwise just write the one-line frame wcs coords. + if {$ism_enable} { + updateCoordsBox + + } else { + # Update the on-screen marker. + if {$track_enable} { + send wcsbox "set text \{$text\}; redraw noerase" + } + + # Update the control panel readout (always done). + if {$wcsLabels} { + set ln [format " X: %12s Y: %12s WCS: Display" $nx $ny] + } else { + set ln [format " %12s %12s Display" $nx $ny] + } + send wtWcs1 set string $ln + + if {$redraw_compass} \ + drawCompass + } + + + # Update the cut-plots if enabled. If we're set for speed the don't + # track the really large cursor motions, wait till the differences are + # small indicating a finer motion. + if {$doHcut || $doVcut} { + set dist [ expr "sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))" ] + if {($plotSpeed && $dist < 30) || ! $plotSpeed} { + cutPlots $x $y + } + } + + # Save the position so we can track differences with last position. + set last_x $x + set last_y $y +} + + +proc setTrack {state} \ +{ + global ism_enable track_enable wcsboxGeom + global winWidth winHeight up_todo + + if {$state} { + if {$track_enable} \ + return + + send imagewin createMarker wcsbox { + type text + createMode noninteractive + width 27ch + height 1ch + lineWidth 0 + imageText true + textBgColor black + textColor yellow + visible false + } + + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + send wcsbox setAttributes \ + x $x \ + y $y \ + activated true \ + visible true \ + sensitive true + + send wcsbox { + addCallback wcsboxDestroyCallback destroy + addCallback wcsboxMoved moveResize + } + + send imagewin addCallback wcsboxWindowResize resize + set track_enable 1 + send imagewin getCursorPos x y + wcsUpdate $x $y + magnifierMapImage $x $y + + # Turn on the option toggles on the control panel. + foreach n {1 2 3 4} { + if {[send sysWcs$n get label] != "None"} { + send wiWcs$n set on True + } + } + if {$ism_enable} { + resizeCoordsBox $up_todo + } + + } elseif {$track_enable} { + set track_enable 0 + send wcsbox destroy + + # Turn off the option toggles on the control panel. + foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False } + resizeCoordsBox 0 + } + updateCoordsBox +} + +proc wcsboxDestroyCallback args \ +{ + global track_enable + send imagewin deleteCallback wcsboxWindowResize + set track_enable 0 +} + +# If the window is resized make the wcsbox track the corner. +proc wcsboxWindowResize args \ +{ + global track_enable + global wcsboxGeom + + if {$track_enable} { + # Get new location. + set box_width [send wcsbox get width] + set box_height [send wcsbox get height] + set defGeom [format "%sx%s-5-5" $box_width $box_height] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + # Move the marker. + send wcsbox "\ + deleteCallback wcsboxMoved; \ + markpos; setAttributes x $x y $y; redraw; \ + addCallback wcsboxMoved moveResize" + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] + } +} + +proc wcsboxMoved {marker event position} \ +{ + global wcsboxGeom + send wcsbox getRect boundary x y width height + set wcsboxGeom [send imagewin getGeometry $x $y $width $height] +} + +proc resetWcsbox {param old new} \ +{ + global track_enable wcsboxGeom displayCoords + if {$new == "done"} { + setTrack [true $displayCoords] + } elseif {$track_enable} { + setTrack 0 + if {$new == "restart"} { + set wcsboxGeom -5-5 + } + } +}; send initialize addCallback resetWcsbox + + + +#--------------------- +# FRAME BLINK. +#--------------------- +set blinkId 0 +set blinkIndex 0 + +proc toggleBlink args \ +{ + global blinkId blinkRate blinkIndex + global optionsMenuDescription + + if {$blinkId} { + deleteTimedCallback $blinkId + set blinkId 0 + } else { + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] + } + + set blinkIndex 0 + editMenu optionsMenu viewButton $optionsMenuDescription +} + +proc blink args \ +{ + global blinkId blinkRate blinkFrames blinkIndex + + send client setFrame [lindex $blinkFrames $blinkIndex] + incr blinkIndex + if {$blinkIndex >= [llength $blinkFrames]} { + set blinkIndex 0 + } + + set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]] +} + +proc resetBlink args \ +{ + global blinkId + if {$blinkId} \ + toggleBlink +}; send initialize addCallback resetBlink + + + +# Normalize -- Reset the view parameters for the current frame. +proc normalize args \ +{ + global zoomindex zoomfactor + global frameWidth frameHeight + global xcen ycen frame + + #set zoomindex($frame) 0 + #set xcen [expr $frameWidth / 2] + #set ycen [expr $frameHeight / 2] + #send client zoom 1 1 $xcen $ycen + send client updateColormap 0.5 1.0 +} + + +# Popdown menus. +createMenu fileMenu fileButton { + { "Info" f.exec { panelTabToggle info_panel } } + { "Load" f.exec { + panelTabToggle load_panel + set panel_up 1 + } } + { "Save" f.exec { Save } } + { "Save As..." f.exec { panelTabToggle save_panel } } + { "Print" f.exec { + send imagewin setCursorType busy + Print + send imagewin setCursorType idle + } } + { "Print Setup" f.exec { panelTabToggle print_panel } } + { f.dblline } + { "Reset" f.exec { + # Do a hard reset. + send client Reset + #resetView initialize done done + } } + { "Debug Panel" f.exec { tclPanel 1 } } + { "Quit" f.exec { Quit } } +} + +createMenu viewMenu viewButton { + { "Next frame" f.exec nextFrame } + { "Prev frame" f.exec prevFrame } + { f.dblline } + { "Colormap" f.menu cmapMenu } + { "Flip" f.menu flipMenu } + { f.dblline } + { "Equal aspect" f.exec { + set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr ($xmag + $ymag) / 2.0] + cpZoom $zoom $zoom fixed + } } + { "Integer zoom" f.exec { + set xmag [expr round ($frameZoomX($frame))] + set ymag [expr round ($frameZoomY($frame))] + cpZoom $xmag $ymag fixed + } } + { "Toggle zoom" f.exec toggleZoom } + { "Unzoom" f.exec { + set zoomindex($frame) 0 + set mag $zoomfactor($zoomindex($frame)) + send client zoom $mag $mag $xcen $ycen + } } +} + +createMenu cmapMenu viewMenu { + { "Normalize" f.exec normalize } + { "Invert" f.exec cpInvert } + { "Optimize" f.exec cpOptimize sensitive false } + { f.dblline } + { "Grayscale" f.exec "send client setColormap Grayscale" } + { "Color" f.exec "send client setColormap Color" } + { "Heat" f.exec "send client setColormap Heat" } + { "HSV" f.exec "send client setColormap HSV" } + { "AIPS0" f.exec "send client setColormap AIPS0" } + { "Halley" f.exec "send client setColormap Halley" } + { "Ramp" f.exec "send client setColormap Ramp" } + { "Standard" f.exec "send client setColormap Standard" } + { "Staircase" f.exec "send client setColormap Staircase" } + { "Rainbow1" f.exec "send client setColormap Rainbow1" } + { "Rainbow2" f.exec "send client setColormap Rainbow2" } + { "Random8" f.exec "send client setColormap Random8" } +} + +createMenu flipMenu viewMenu { + { "Flip X" f.exec xflip } + { "Flip Y" f.exec yflip } + { "Flip XY" f.exec xyflip } +} + +set optionsMenuDescription { + { "Autoscale" f.exec { + set value [send autoscaleButton get on] + send autoscaleButton set on [expr !$value] + cpSetAutoscale + } } + { "Antialias" f.exec { + set value [send antialiasButton get on] + send antialiasButton set on [expr !$value] + cpSetAntialias + } } + { "Panner" f.exec { setPanner [expr !$panner_enable] } } + { "Magnifier" f.exec { setMagnifier [expr !$magnifier_enable] }} + { "Coords box" f.exec { setTrack [expr !$track_enable] } } + { "Tile frames" f.exec { + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames + } } + { "Clear frame" f.exec clearFrame } + { "Fit frame" f.exec fitFrame } + { "Match LUTs" f.exec cpMatchFrames } + { "Auto-Register" f.exec cpAutoRegister } + { "Register" f.exec cpRegisterFrames } + { {$blinkId ? "Stop blink" : "Blink frames"} + f.exec toggleBlink } + { f.dblline } + { "Control Panel" f.exec { panelTabToggle display_panel } } + { "Print Panel" f.exec { panelTabToggle print_panel } } + { "Load Panel" f.exec { panelTabToggle load_panel } } + { "Save Panel" f.exec { panelTabToggle save_panel } } +}; createMenu optionsMenu optionsButton $optionsMenuDescription + + + +#------------------------------- +# Frozen Cursor Warning Message +#------------------------------- + +set ct_warn 0 + +proc curtrack_msg { x y args } \ +{ + global ct_warn last_x last_y winHeight winWidth + + + if {! $ct_warn == 0} { + return + } + + send imagewin createMarker curtrack_warn { + type text + createMode noninteractive + width 25ch + height 21 + lineWidth 0 + imageText true + textBgColor red + textColor yellow + visible true + sensitive true + activated true + x 5 + y 5 + } + + send curtrack_warn "set text \{ CURSOR READOUT FROZEN \}" + set ypos [ expr ($winHeight - 25) ] + send curtrack_warn "markpos; setAttributes x 5 y $ypos; redraw" + send curtrack_warn "redraw noerase" + set ct_warn 1 + + # Mark the position of the cursor. + send imagewin createMarker x_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x 1 \ + y $last_y \ + width $winWidth \ + height 1 \ + activated True \ + visible True \ + sensitive False + + send imagewin createMarker y_curpos \ + type box \ + createMode noninteractive \ + lineColor red \ + x $last_x \ + y 1 \ + width 1 \ + height $winHeight \ + activated True \ + visible True \ + sensitive False + + # Raise the coordinate marker so we can see where we are. + send wcsbox raise +} + + +proc curtrack_destroy args \ +{ + global ct_warn + + if {$ct_warn} { + send curtrack_warn destroy + send x_curpos destroy + send y_curpos destroy + set ct_warn 0 + } +} + + +################################################################################ +# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS. +################################################################################ + +# Set the centroiding box size. +set ctid 0 +set cid 0 + +proc cbxDestroy args \ +{ + global centerBoxSize cid ctid + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } +} + +proc setCtrBoxSize { x y delta args } \ +{ + global centerBoxSize cid ctid + global cpXscale cpYscale + + incr centerBoxSize $delta + if {$centerBoxSize <= 1} { set centerBoxSize 1 } + + # Kill off any old markers before drawing the new one. + catch { + if {$ctid != 0} { + send cbm$cid destroy + deleteTimedCallback $ctid + set ctid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr cid + send imagewin createMarker cbm$cid \ + type box \ + createMode noninteractive \ + lineColor red \ + x $x \ + y $y \ + width [expr $cpXscale * $centerBoxSize] \ + height [expr $cpXscale * $centerBoxSize] \ + activated True \ + visible True \ + sensitive False + + set ctid [ postTimedCallback cbxDestroy 500] +} + + +# Box size is half-width of the marker size. Value is the slider value. +set focusBoxSize $winWidth +set focusValue 100.0 +set fid 0 +set ftid 0 +set moving 0 + +proc setFocusBoxSize { sz args } \ +{ + global focusBoxSize fid ftid focusValue moving + global winWidth winHeight + + + if { $moving == 0 } { + return done + } + + if { $winWidth < $winHeight } { + set max [expr $winWidth / 2 - 64] + } else { + set max [expr $winHeight / 2 - 64] + } + set focusBoxSize [expr 64 + ($sz * $max) - 1] + #send client setOption cmfocus [expr ($focusBoxSize / 2)] + send client setOption cmfocus $focusBoxSize + + # Destroy any existing markers. + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } + + # create a transient marker indicating the centering box and post a + # callback to delete it in about a second. + incr fid + send imagewin createMarker fm$fid \ + type box \ + createMode noninteractive \ + lineColor green \ + lineWidth 4 \ + x [expr $winWidth / 2] \ + y [expr $winHeight / 2] \ + width $focusBoxSize \ + height $focusBoxSize \ + activated True \ + visible True \ + sensitive False + + set ftid [ postTimedCallback fbxDestroy 500] + set moving 0 +} + +proc fbxDestroy args \ +{ + global fid ftid moving + catch { + if {$ftid != 0} { + send fm$fid destroy + set ftid 0 + } + } +} + +proc setFocusSize { widget cbtype x y } \ +{ + global focusValue ftid moving + + # Only update once we've stopped the movement. + if { $x == $focusValue && $moving == 1 } { + set ftid [ postWorkProc setFocusBoxSize $x ] + } else { + set moving 1 + } + set focusValue $x +} ; send focusSlider addCallback setFocusSize scroll + + +# Compute a centroid offset for the current position to peak-up on the +# feature. + +proc centroid { x y type args } \ +{ + global centerBoxSize + global cpXscale cpYscale + + # Convert to image coords. + set sz [expr "int ($centerBoxSize * $cpXscale)"] + + # Get the centroid position. + if {$type != "min"} { + if {[send peakupButton get on]} { + set center [ send client centroid $x $y $sz ] + } else { + set center [ send client centroid $x $y $sz max ] + } + } else { + set center [ send client centroid $x $y $sz min ] + } + + # Now reposition the cursor. + set xoff [lindex $center 0 ] + set yoff [lindex $center 1 ] + move_cursor $xoff $yoff +} + + +# Set the auto-register center offset position +proc offset { x y args } \ +{ + global frame blinkFrames auto_reg + global frameCenterX frameCenterY + global frameOffsetX frameOffsetY + + # No-op of auto-register isn't on. + if { $auto_reg == 0 } { + Wexec client "Auto-Register is not enabled!" + return + } + + # If we're not in the blink frames list ignore the request. + if { [string first $frame $blinkFrames] == -1 } { + Wexec client "Frame not in current\nregister list." + return + } + + set rx $x; set ry $y + set raster 0 + + # Convert raw screen coordinates to frame buffer raster coordinates. + send imagewin unmapPixel $x $y raster rx ry + + # Select a pixel. + set xoff [expr "int ($rx) - $frameCenterX($frame)" ] + set yoff [expr "int ($ry) - $frameCenterY($frame)" ] + + set frameOffsetX($frame) $xoff + set frameOffsetY($frame) $yoff + + # Adjust the display. + send client setOffset $xoff $yoff +} + + + +################################################################################ +# MAIN CONTROL PANEL +################################################################################ + + +# Global control panel buttons. +# ------------------------------- +proc cpInitialize args \ +{ + send imagewin setCursorType busy + send client initialize + send imagewin setCursorType idle +} +send initializeButton addCallback cpInitialize +send normalizeButton addCallback normalize + +# Temporarily deactivate some buttons. +send optimizeButton setSensitive false + +#----------------------------------------------------------------------------- + +foreach i $frames {set saveView($i) "1 1"} + +send prevFrame set bitmap larrow +send nextFrame set bitmap rarrow +send contrastLabel set bitmap contrast +send brightnessLabel set bitmap brightness +send contrastSlider resizeThumb 0.1 1.0 +send brightnessSlider resizeThumb 0.1 1.0 +send focusSlider "resizeThumb 0.1 1.0 ; moveThumb 1.0" + + +# panel -- Toggle control panel display. +proc panel args \ +{ + global panel_up + if {$panel_up} { + send panelShell unmap + set panel_up 0 + } else { + send panelShell map + set panel_up 1 + } +} + +proc pbTracePanel {name element op} \ +{ + catch { + upvar $name panel_up + send controlButton set state $panel_up + } +} ; trace variable panel_up w pbTracePanel + + +# resetPanel -- Calling during startup or in an initialize, to reset things. +proc resetPanel {param old new} \ +{ + global frame nframes frames + global displayPanner displayMagnifier displayCoords + global blinkFrames warnings peakCentroid + + switch $new { + startup { + } + restart { foreach i $frames { + send frame$frame set on 0 + } + + # Initialize to hide the extra frames. + send frlistBox set width 30 + } + done { if {$frame} { + send frame$frame set on 1 + } + + cpResetBlink + set button 1 + foreach i {1 2 3 4} { + send blinkFrame$button set label $i + incr button + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + + cpResetEnhance + send pannerButton set on [true $displayPanner] + send magnifierButton set on [true $displayMagnifier] + send coordsBoxButton set on [true $displayCoords] + send warningsButton set on $warnings + send peakupButton set on [true $peakCentroid] + } + } +}; send initialize addCallback resetPanel + + + +# Control Panel Tabs widget procedures. +#---------------------------------------- + +set cpTabs { display_panel print_panel load_panel save_panel \ + info_panel wcs_panel tile_panel} +set tabTop "display_panel" + + +# Resize the control panel depending on the Tab selected. +proc cpResizeCB { widget event a b c d e args } \ +{ + global tabTop fileList + + # Handle only the first exposure event generated. + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + set tabTop $widget + + switch $widget { + display_panel { send panel set height 595 } + print_panel { send panel set height 545 } + load_panel { send panel set height 485 + if { [send browseHdrs get on] } { + send imageList setList $fileList resize + } else { + send client setLoadOption rescan + } + } + save_panel { send panel set height 325 } + info_panel { send panel set height 380 } + tile_panel { send panel set height 405 } + wcs_panel { setCoordPanelHeight } + } + } +} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask } + + +proc panelDismiss args \ +{ + global panel_up + send panelShell unmap + set panel_up 0 +} ; send panelClose addCallback panelDismiss + + +proc panelTabToggle { panel args } \ +{ + global tabTop panel_up TabToWidget + + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $TabToWidget($panel) set state 0 + set panel_up 0 + + } else { + # Special cases for each panel. + if {$panel == "load_panel"} { + send client setLoadOption rescan + } + + send panelTabs setTop $panel + set tabTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send panelShell map + set panel_up 1 + } + + } +} + +proc displayPanel args { panelTabToggle display_panel } +proc infoPanel args { panelTabToggle info_panel } +proc loadPanel args { panelTabToggle load_panel } +proc savePanel args { panelTabToggle save_panel } +proc printPanel args { panelTabToggle print_panel } +proc tilePanel args { panelTabToggle tile_panel } +proc wcsPanel args { panelTabToggle wcs_panel } + + + + +# Frame selection. +# ------------------------------- +proc cpSetFrame {widget args} \ +{ + send $widget set on 0 + send client setFrame [send $widget get label] +} + +proc cpFrameChanged {param old new} \ +{ + global frameCache + + if {$old > 0} { + send frame$old set on 0 + } + if {$new > 0} { + send frame$new set on 1 + } + + # The first time we request frame 5 or higher reset + # the extra frame buttons on the control panel to make + # them visible. + if {$new >= 5} { + send frlistBox set width 49 + } + + # Update the header panel object list. + catch { + # Only update when the header panel is open. + if {[info exists frameCache($new)] && [send imageHeader get on]} { + setHdrObjMenu $new + getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1] + } + } +} + +send prevFrame addCallback prevFrame +send nextFrame addCallback nextFrame +send frame addCallback cpFrameChanged +for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame} + +# Initialize to hide the extra frames. +send frlistBox set width 30 + +proc blinkPanelCB { widget type state args } \ +{ + if {$state} { + send blink_panel map + } else { + send blink_panel unmap + } +} ; send blinkPanel addCallback blinkPanelCB + +proc blinkPanelClose args \ +{ + send blink_panel unmap + send blinkPanel set state 0 +} ; send brClose addCallback blinkPanelClose + + + +# Frame buttons. +proc cpFrameAction {widget args} \ +{ + global frameZoomX frameZoomY frame + switch $widget { + aspect { set xmag $frameZoomX($frame) + set ymag $frameZoomY($frame) + set zoom [expr round (($xmag + $ymag) / 2.0)] + cpZoom $zoom $zoom fixed + } + flipX { send client flip x } + flipY { send client flip y } + flipXY { send client flip x y } + clearFrame { clearFrame } + fitFrame { fitFrame } + } +} +foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} { + send $widget addCallback cpFrameAction +} + +# clearFrame -- Clear the current display frame. +proc clearFrame args \ +{ + global warnings + if {$warnings} { + Wexec client \ + "Clearing the frame will destroy\n\ + all data in the frame" \ + clearFrame + } else { + send client clearFrame + } +} + +# fitFrame -- Resize the display window to fit the frame buffer. +proc fitFrame args \ +{ + global frameWidth frameHeight winWidth winHeight + set dw [expr [send display get width] - $winWidth] + set dh [expr [send display get height] - $winHeight] + send display "resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]" +} + +proc initFitFrame { param old new } \ +{ + if { [lindex $new 0] == "resize"} { + fitFrame + } + pannerMapImage init +}; send frameFit addCallback initFitFrame + + + +# Zoom and pan buttons. +# ------------------------------- +proc cpZoomAction {widget args} \ +{ + global frameWidth frameHeight + + switch $widget { + x1 { cpZoom 1 1 fixed } + z2 { cpZoom 2 2 fixed } + z3 { cpZoom 3 3 fixed } + z4 { cpZoom 4 4 fixed } + z5 { cpZoom 5 5 fixed } + z8 { cpZoom 8 8 fixed } + + d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed } + d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed } + d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed } + d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed } + d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed } + + zoomIn { cpZoom 2.0 2.0 relative } + zoomOut { cpZoom 0.5 0.5 relative } + + centerFrame { send client pan \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } + toggleZoom { toggleZoom } + } +} + +proc cpZoom {zoom_x zoom_y mode} \ +{ + global frameZoomX frameZoomY zoomindex frame + global frameOffsetX frameOffsetY frameCenterX frameCenterY + + if {$mode == "fixed"} { + #send client zoom $zoom_x $zoom_y + send client zoomAbs $zoom_x $zoom_y \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + #send client zoom \ + # [expr $frameZoomX($frame) * $zoom_x] \ + # [expr $frameZoomY($frame) * $zoom_y] + send client zoomAbs \ + [expr $frameZoomX($frame) * $zoom_x] \ + [expr $frameZoomY($frame) * $zoom_y] \ + $frameCenterX($frame) $frameCenterY($frame) \ + $frameOffsetX($frame) $frameOffsetY($frame) + } + + set zoomindex($frame) 0 +} + +proc toggleZoom args \ +{ + global frameZoomX frameZoomY frameCenterX frameCenterY + global frameWidth frameHeight saveView frame + + if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} { + set saveView($frame) \ + "$frameZoomX($frame) $frameZoomY($frame) \ + $frameCenterX($frame) $frameCenterY($frame)" + send client zoom 1 1 \ + [expr $frameWidth/2.0] \ + [expr $frameHeight/2.0] + } else { + send client zoom $saveView($frame) + } +} + +foreach widget { toggleZoom centerFrame zoomIn zoomOut \ + x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } { + send $widget addCallback cpZoomAction +} + +# Frame data display. +# ------------------------------- +set cpFrame 0 +set cpXcen 0 +set cpYcen 0 +set cpXmag 0 +set cpYmag 0 +set cpXscale 0 +set cpYscale 0 +set cpXoff 0 +set cpYoff 0 + +proc cpDisplayFrameData {name old new} \ +{ + global cpFrame cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + set update 0 + switch $name { + frame { if {$new != $cpFrame} { + set cpFrame $new + set update 1 + } + } + frameView { # Parse the frameView input. + set xmag [lindex $new 0]; set ymag [lindex $new 1] + set xcen [lindex $new 2]; set ycen [lindex $new 3] + set xnorm [lindex $new 4]; set ynorm [lindex $new 5] + set xoff [lindex $new 6]; set yoff [lindex $new 7] + + # We need client coords and the overall scale factors. + set text [send client encodewcs $xcen $ycen] + set xcen [lindex $text 0] + set ycen [lindex $text 1] + set xscale [expr $xmag * $xnorm] + set yscale [expr $ymag * $ynorm] + + if {$xcen != $cpXcen || $ycen != $cpYcen || + $xmag != $cpXmag || $ymag != $cpYmag || + $xoff != $cpXoff || $yoff != $cpYoff || + $xscale != $cpXscale || $yscale != $cpYscale} { + + set cpXcen $xcen; set cpXscale $xscale + set cpYcen $ycen; set cpYscale $yscale + set cpXmag $xmag; set cpXoff $xoff; + set cpYmag $ymag; set cpYoff $yoff; + set update 1 + } + } + } + + if {$update} { + set header [format "-- Frame %d --" $cpFrame] + set center [format "X center: %0.1f\nY center: %0.1f" $cpXcen $cpYcen] + if {int($cpXmag) >= 10} { + set zoom1 [format " X zoom: %0.1f" $cpXmag] + set zoom2 [format " Y zoom: %0.1f" $cpYmag] + } else { + set zoom1 [format "X zoom: %0.1f" $cpXmag] + set zoom2 [format "Y zoom: %0.1f" $cpYmag] + } + if {int($cpXscale) >= 10} { + set scale1 [format "X scale: %0.1f" $cpXscale] + set scale2 [format "Y scale: %0.1f" $cpYscale] + } else { + set scale1 [format "X scale: %0.2f" $cpXscale] + set scale2 [format "Y scale: %0.2f" $cpYscale] + } + set offset [format " Offset: (%0.1f,%0.1f)" $cpXoff $cpYoff] + + send frameData set label [format "%s\n%s\n%s\n%s\n%s\n%s\n%s" \ + $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \ + ] + } +}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData} + + +# Frame enhancement. +# ------------------------------- +set cpEnhanceDisable 0 +set cpEnhanceId 0 +set cpEnhanceMode none +set cpEnhanceVal 0 +set cpListItem none + +# Windowing the colormap is slow when the mouse is not in the image window, +# so it is necessary to execute the windowColormap in a work procedure. +# This allows any number of slider motion events to be processed for each +# windowColormap, preventing slider events from queueing up. + +proc cpResetEnhance args \ +{ + global cpListItem cpEnhanceId + set cpListItem none + set cpEnhanceId 0 +} + +proc cpSetEnhancement {widget cbtype x y} \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable + set cpEnhanceMode $widget + set cpEnhanceVal $x + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceId [postWorkProc cpEnhanceProc] + } +} +proc cpEnhanceProc args \ +{ + global cpEnhanceMode cpEnhanceVal cpEnhanceId + global enhancement frame maxContrast + set val $cpEnhanceVal + + if {$cpEnhanceMode == "contrastSlider"} { + set contrast [lindex $enhancement($frame) 2] + send client windowColormap [lindex $enhancement($frame) 1] \ + [expr (($contrast < 0) ? -$val : $val) * $maxContrast] + } else { + send client windowColormap $val + } + + set cpEnhanceId 0 + return done +} + +proc cpInvert args \ +{ + global enhancement frame + set contrast [lindex $enhancement($frame) 2] + send client updateColormap [lindex $enhancement($frame) 1] \ + [expr -1.0 * $contrast] +} + +proc cpDisplayEnhancement {param old new} \ +{ + global cpEnhanceId maxContrast cpEnhanceDisable + global cpListItem enhancement frame + + if {!$frame} \ + return + set enhance $enhancement($frame) + if {[llength $enhance] < 3} \ + return + + set colortable [lindex $enhance 0] + set offset [lindex $enhance 1] + set scale [lindex $enhance 2] + + send colordata set label [format "-- %s --\nCon %0.2f Brt %0.2f" \ + $colortable $scale $offset] + + if {$colortable != $cpListItem} { + send colorlist highlight $colortable + set cpListItem $colortable + } + + if {!$cpEnhanceId && !$cpEnhanceDisable} { + set cpEnhanceDisable 1 + send contrastSlider moveThumb [expr abs($scale) / $maxContrast] + send brightnessSlider moveThumb $offset + set cpEnhanceDisable 0 + } +} + +foreach i {enhancement frame} { + send $i addCallback cpDisplayEnhancement +} +send contrastSlider addCallback cpSetEnhancement scroll +send brightnessSlider addCallback cpSetEnhancement scroll +send invertButton addCallback cpInvert + + +# Colortable display and selection. +# ------------------------------- +set colorTables {} + +proc cpSetColorList {param old new} \ +{ + set colorTables $new + send colorlist setList $new resize +}; send colortables addCallback cpSetColorList + +proc colorlistResize args \ +{ + global colorTables + send colorlist setList $colorTables resize +}; send colorlist addEventHandler colorlistResize ResizeRedirectMask + +proc cpSelectColor {widget cbtype selections indices} \ +{ + global colortable + foreach selection $selections { + send client setColormap $selection + } +}; send colorlist addCallback cpSelectColor + + +# Frame blink. +# ------------------------------- +send BRtext set label $blinkRate +send brBRtext set label $blinkRate + +proc cpSetBlinkRate {w args} \ +{ + global blinkRate + if {$w == "BRincrease" || $w == "brBRincrease"} { + if {$blinkRate < 0.01} { + set blinkRate 0.125 + } else { + set blinkRate [expr $blinkRate * 2.0] + } + } else { + set blinkRate [expr $blinkRate / 2.0] + if {$blinkRate < 0.01} { + set blinkRate 0 + } + } + send BRtext set label $blinkRate + send brBRtext set label $blinkRate +} +foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} { + send $w addCallback cpSetBlinkRate +} + +proc cpSetBlinkFrame {widget args} \ +{ + global blinkFrames frames nframes + + set frame [send $widget get label] + if {$frame == " "} { + set frame 1 + } else { + incr frame + if {$frame > $nframes} { + set frame " " + } + } + send $widget set label $frame + + set blinkFrames {} + foreach i {1 2 3 4} { + set frame [send blinkFrame$i get label] + if {$frame != " "} { + lappend blinkFrames $frame + } + } +}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame} + +proc cpBlink {widget args} \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send blinkButton set on False + send brBlinkButton set on False + blink + } elseif {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } +} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink} + + +proc cpAutoRegister {widget type state args} \ +{ + global auto_reg frame frames blinkFrames + global frameZoomX frameZoomY frameOffsetX frameOffsetY + + set auto_reg $state + if {$auto_reg == 1} { + send autoregButton set on True + send brAregButton set on True + } else { + send autoregButton set on False + send brAregButton set on False + } + + # Register the frames to zero the offsets. + send client registerFrames \{$blinkFrames\} + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } +} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister} + + +proc toggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + } +} + +proc resetAutoReg args \ +{ + global auto_reg + if {$auto_reg} \ + toggleAutoReg +}; send initialize addCallback resetAutoReg + + +proc cpResetBlink args \ +{ + global blinkRate blinkFrames blinkIndex frames + global defaultBlinkRate + + foreach i {1 2 3 4} { + send blinkFrame$i set label " " + } + for {set i 1} {$i <= 16} {incr i} { + send brFrame$i set label $i + } + set blinkRate $defaultBlinkRate + send BRtext set label $blinkRate + send brBRtext set label $blinkRate + set blinkIndex 0 +} +send blinkReset addCallback cpResetBlink +send brReset addCallback cpResetBlink + +proc cpTraceBlink {name element op} \ +{ + upvar $name blinkId + send blinkButton set on [expr $blinkId != 0] + send brBlinkButton set on [expr $blinkId != 0] +}; trace variable blinkId w cpTraceBlink + +proc cpSetBlinkFrames {param old new} \ +{ + global blinkFrames frames + + set blinkFrames {} + foreach i $frames { + if {$i <= $new} { + lappend blinkFrames $i + } + } + cpResetBlink + set button 1 + for {set i 1} {$i <= $new} {incr i} { + if {$i <= 4} { + send blinkFrame$button set label $i + } + send brFrame$button set label $i + incr button + } +}; send nframes addCallback cpSetBlinkFrames + +proc cpRegisterFrames args \ +{ + global frames blinkFrames + global frameOffsetX frameOffsetY + + foreach f $frames { + set frameOffsetX($f) 0 + set frameOffsetY($f) 0 + } + send client registerFrames \{$blinkFrames\} +} +send registerButton addCallback cpRegisterFrames +send brRegButton addCallback cpRegisterFrames + +proc cpMatchFrames args \ +{ + global blinkFrames + send client matchFrames \{$blinkFrames\} +} +send matchButton addCallback cpMatchFrames +send brMatchButton addCallback cpMatchFrames + + +# Options buttons. +# ------------------------------- +proc cpSetPanner {widget args} \ +{ + setPanner [send $widget get on] +}; send pannerButton addCallback cpSetPanner + +proc cpTracePanner {name element op} \ +{ + upvar $name panner_enable + send pannerButton set on $panner_enable +}; trace variable panner_enable w cpTracePanner + +proc cpSetMagnifier {widget args} \ +{ + setMagnifier [send $widget get on] +}; send magnifierButton addCallback cpSetMagnifier + +proc cpTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send magnifierButton set on $magnifier_enable +}; trace variable magnifier_enable w cpTraceMagnifier + +proc cpSetCoordsBox {widget args} \ +{ + setTrack [send $widget get on] +}; send coordsBoxButton addCallback cpSetCoordsBox + +proc cpTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send coordsBoxButton set on $track_enable +}; trace variable track_enable w cpTraceCoordsBox + +proc cpSetWarnings args \ +{ + global warnings + set warnings [send warningsButton get on] +}; send warningsButton addCallback cpSetWarnings + +proc cpSetAutoscale args \ +{ + set value [send autoscaleButton get on] + send client setOption autoscale [expr {$value ? "True" : "False"}] +}; send autoscaleButton addCallback cpSetAutoscale + +proc cpTrackAutoscale {param old new} \ +{ + send autoscaleButton set on [true $new] +}; send autoscale addCallback cpTrackAutoscale + +proc cpSetAntialias args \ +{ + set value [send antialiasButton get on] + send client setOption antialias [expr {$value ? "True" : "False"}] +}; send antialiasButton addCallback cpSetAntialias + +proc cpTrackAntialias {param old new} \ +{ + send antialiasButton set on [true $new] +}; send antialias addCallback cpTrackAntialias + +proc cpSetTileFrames { widget type state args } \ +{ + global tile_frames tileOpt + + set value [send tileFramesButton get on] + if {$value} { + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } else { + selectTileOrientation junk junk Disabled + } + send client setOption tileFrames \ + [expr {$value ? "True" : "False"}] \{ $tile_frames \} +} ; send tileFramesButton addCallback cpSetTileFrames + +proc cpTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] +}; send tileFrames addCallback cpTrackTileFrames + +proc tileFramesToggle args \ +{ + set value [send tileFramesButton get on] + send tileFramesButton set on [expr !$value] + cpSetTileFrames +} + + +################################################################################ +# MAGNIFIER. A subraster around the cursor in the main image window is +# displayed at a high resolution in a marker (known as the magnifier window) +# within the main image window. +################################################################################ + +set magnifier_x 0 +set magnifier_y 0 +set magnifier_width 0 +set magnifier_height 0 +set mrm_width 0 +set mrm_height 0 + +set magnifier_enable 0 +set magnifier_mag_enable 0 +set magnifier_mapping 0 + +createMenu magzoomMenu imagewin { + { "Zoom Factors" f.title } + { f.dblline } + { "Zoom 1" f.exec "setMagnifierZoom 1" } + { "Zoom 2" f.exec "setMagnifierZoom 2" } + { "Zoom 4" f.exec "setMagnifierZoom 4" } + { "Zoom 8" f.exec "setMagnifierZoom 8" } + { "Zoom 16" f.exec "setMagnifierZoom 16" } +} + +# Magnifier window translations. +set magnifierWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn3Down>: popup(magzoomMenu) + <Btn3Up>: popdown(magzoomMenu) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setMagnifier -- Turn the magnifier on or off. + +set magAlreadyOn 0 + +proc setDynamicMagnifier {state} \ +{ + global magAlreadyOn magnifier_enable + + if {$state} { + set magAlreadyOn $magnifier_enable + } + if {$magAlreadyOn} { + return + } else { + setMagnifier $state + } +} + +proc toggleMagnifier args \ +{ + global magnifier_enable + if {$magnifier_enable} { + setMagnifier 0 + } else { + setMagnifier 1 + } +} + + +proc setMagnifier {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame magnifier_mapping magnifierWinTranslations magnifierArea + global magnifier_enable magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$state} { + if {$magnifier_enable} \ + return + + # Determine where to place the magnifier. + set scale [expr sqrt(double($magnifierArea) / (512 * 512))] + set scaled_width [expr int(512 * $scale) / 2 * 2 + 1] + set scaled_height [expr int(512 * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Create the main magnifier window (marker). + send imagewin createMarker magnifierWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $magnifierWinTranslations \ + visible true \ + sensitive true \ + activated true + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Register callbacks. + send imagewin addCallback magnifierImagewinResized resize + send resize addCallback magnifierImagewinResized + send magnifierWin addCallback magnifierMovedMapImage moveResize + + send magnifierWin { + addCallback magnifierMoved moveResize; + addCallback magnifierDestroy destroy; + addCallback magnifierWinConstraint constraint; + } + + # Map display frame to magnifier window. + set magnifier_enable 1 + set magnifier_mapping [send imagewin nextMapping] + send imagewin refreshMapping $magnifier_mapping + + # create cross-hair + send imagewin createMarker magPointer \ + type rectangle \ + createMode noninteractive \ + width 3 \ + height 3 \ + lineWidth 3 \ + lineColor green \ + highlightcolor green \ + activated true \ + visible true + + # set its position and size + setMagPointerPosition + magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2] + + } elseif {$magnifier_enable} { + magnifierDestroy + } +} + + +# magnifierDestroy -- Delete the magnifier. + +proc magnifierDestroy args \ +{ + global magnifier_enable + global magnifier_mapping + + if {$magnifier_enable} { + set magnifier_enable 0 + + send imagewin freeMapping $magnifier_mapping + send imagewin deleteCallback magnifierImagewinResized + send resize deleteCallback magnifierImagewinResized + send frame deleteCallback magnifierMapImage + + if [send server queryObject magnifierWin] { + send magnifierWin destroy + } + if [send server queryObject magPointer] { + send magPointer destroy + } + } +} + + +# magnifierMoved -- Called when the user moves the magnifier window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc magnifierMoved {marker event position} \ +{ + global winWidth winHeight magnifierGeom frame + global magnifier_x magnifier_y magnifier_width magnifier_height + + # Move the region marker to the new location. + send client getSource raster sx sy snx sny + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] +} + + +# magnifierWinConstraint -- Called when the magnifier window is moved, resized, +# or rotated. Constrain the magnifier window to remain within the image window; +# rotation is not permitted. + +proc magnifierWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global magnifier_width magnifier_height + + set width $magnifier_width + set height $magnifier_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# magnifierRegionConstraint -- Called when the region marker in the magnifier +# window is moved, resized, or rotated. + +proc magnifierRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + + set constraints [list {}] + send magnifierWin getRect interior p_x p_y p_width p_height + + # Since the magnifier region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + return $constraints +} + + +# magnifierImagewinResized -- If the display window is resized make the +# magnifier track the corner. + +proc magnifierImagewinResized args \ +{ + global magnifier_enable magnifier_mapping magnifier_height + global magnifierGeom magnifier_x magnifier_y magnifier_width + + if {$magnifier_enable} { + set old_x $magnifier_x; set old_width $magnifier_width + set old_y $magnifier_y; set old_height $magnifier_height + + # Get new location of magnifier window. + set defGeom [format "%sx%s+5+5" $magnifier_width $magnifier_height] + send imagewin parseGeometry $magnifierGeom $defGeom x y width height + + # Reposition the marker. + send magnifierWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the magnifier window position variables so that it comes up + # in the same place the next time. + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set magnifierGeom [send imagewin getGeometry \ + $magnifier_x $magnifier_y $magnifier_width $magnifier_height] + + # Make sure the magnifier window is on top. + send imagewin raiseMapping $magnifier_mapping + + # Refresh the magnifier window if it did not move. + if {$magnifier_x == $old_x && $magnifier_y == $old_y && + $magnifier_width == $old_width && $magnifier_height == $old_height} { + send imagewin refreshMapping $magnifier_mapping + } + } +} + + +# resetMagnifier -- Reinitialize the magnifier. + +proc resetMagnifier {param old new} \ +{ + global magnifierGeom displayMagnifier + + if {$new == "done"} { + setMagnifier [true $displayMagnifier] + } else { + setMagnifier 0 + if {$new != "startup"} { + set magnifierGeom +5+5 + } + } +}; send initialize addCallback resetMagnifier + + +set last_mag_x [expr $winWidth / 2] +set last_mag_y [expr $winHeight / 2] + +# magnifierMovedMapImage -- Front end to magnifierMapImage, called when +# magnifier window is moved or resized. + +proc magnifierMovedMapImage args \ +{ + global last_mag_x last_mag_y + + magnifierMapImage $last_mag_x $last_mag_y + setMagPointerPosition +} + +# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO +#-------------------------------------------------------------------------- + +# globals for magnifier +set mag_w 0 +set mag_h 0 + +# +# setMagnifierZoom -- set the zoom factor for the magnifier +# +proc setMagnifierZoom { zoom } \ +{ + global mag_w mag_h + + send magnifierWin getRect boundary \ + magnifier_x magnifier_y magnifier_width magnifier_height + set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ] + set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ] + + #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))] + #if { $mw < 4 } { set mw 4 } + #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))] + #if { $mh < 4 } { set mh 4 } + #send magPointer "setAttributes width $mw height $mh; redraw" +} + +# magnifierMapImage -- Map the of the current display frame centered on the +# pointer into the magnifier window. Called when the frame changes, the +# pointer moves in the main image window, or (via magnifierMovedMapImage) +# the magnifier window is moved or resized. + +set magnifierROP 0 + +proc magnifierMapImage {x y} \ +{ + global magnifier_enable frame + global last_mag_x last_mag_y + global magnifier_mapping + global winWidth winHeight + global mag_w mag_h + global magnifierROP + + if {!$magnifier_enable || $frame == 0} \ + return + +# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} { +# # For efficiency we won't compute the sqrt of the distance but instead +# # just compare the square. Use a threshold of 6 pixels so when we +# # narrow in on the ROI the magnifier is still (mostly) correct. +# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \ +# (($last_mag_y-$y) * ($last_mag_y-$y))] +# if {$diff > 36} { +# set last_mag_x $x +# set last_mag_y $y +# return +# } +# } + + set last_mag_x $x + set last_mag_y $y + + send magnifierWin getRect interior dx dy dnx dny + if [send imagewin activeMapping $magnifier_mapping] { + send imagewin raiseMapping $magnifier_mapping + } + + # initialize the magnifier zoom factor, if necessary + if { !$mag_w || !$mag_h } { + setMagnifierZoom 4 + } + + set sx [expr $x - $mag_w / 2 ] + set sy [expr $y - $mag_h / 2 ] + + # Constrain the source rectangle within the main image window + # (not overlapping an edge or the magnifier window). + + if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && + $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } { + + # The source rectangle would overlap the magnifier window; fix that. + + set dist(l) [expr $sx - ($dx - $mag_w)] + set dist(b) [expr $dy + $dny - $sy] + set dist(r) [expr $dx + $dnx - $sx] + set dist(t) [expr $sy - ($dy - $mag_h)] + + # Put the distances in order. + + foreach j [array names dist] { + set alreadyset($j) 0 + } + + for {set i 0} {$i < 4} {incr i} { + set candidate "" + foreach j [array names dist] { + if {!$alreadyset($j)} { + if {$candidate == ""} { + set candidate $j + set minsofar $dist($j) + } elseif {$dist($j) < $minsofar} { + set candidate $j + set minsofar $dist($j) + } + } + } + set order($i) $candidate + set alreadyset($candidate) 1 + } + + # Try the sides in order, using the first one where there's room. + + for {set i 0} {$i < 4} {incr i} { + if {$order($i) == "l"} { + if {$dx >= $mag_w} { + set sx [expr $dx - $mag_w] + break + } + } elseif {$order($i) == "b"} { + if {$winHeight >= $dy + $dny + $mag_h} { + set sy [expr $dy + $dny] + break + } + } elseif {$order($i) == "r"} { + if {$winWidth >= $dx + $dnx + $mag_w} { + set sx [expr $dx + $dnx] + break + } + } elseif {$order($i) == "t"} { + if {$dy >= $mag_h} { + set sy [expr $dy - $mag_h] + break + } + } + } + } + + # Make sure we don't go beyond an edge of the main window. + + if {$sx < 0} { + set sx 0 + } else { + set sxmax [expr $winWidth - $mag_w] + if {$sx > $sxmax} { + set sx $sxmax + } + } + + if {$sy < 0} { + set sy 0 + } else { + set symax [expr $winHeight - $mag_h] + if {$sy > $symax} { + set sy $symax + } + } + + # Map 32 x 32 centered on pointer in main window. + set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \ + 0 pixel $sx $sy $mag_w $mag_h \ + 0 pixel $dx $dy $dnx $dny}] + if { $err != 0 } { + Print "There was a problem setting up the magnifier ... recovering" + } +} + + +# set the position of the magnifier marker in the center of the mag window +proc setMagPointerPosition args \ +{ + global magnifier_enable + + if { !$magnifier_enable } \ + return + + send magnifierWin "getAttributes x x y y" + set xpos [expr $x + 1] + set ypos [expr $y + 1] + + send magPointer "setAttributes x $xpos y $ypos visible true; redraw" +} + + + +################################################################################ +# PANNER. The full frame mapped into the main image window is displayed at a +# reduced resolution in a marker (known as the panner window) within the main +# image window. The currently displayed region of the frame is indicated +# using a small marker within the panner window. This small marker may be +# moved or resized to pan or zoom the image in the main display window. +################################################################################ + +set panner_x 0 +set panner_y 0 +set panner_width 0 +set panner_height 0 +set prm_width 0 +set prm_height 0 + +set panner_enable 0 +set panner_pan_enable 0 +set panner_mag_enable 0 +set panner_region_enable 0 +set panner_mapping 0 + +# Panner window translations. +set pannerWinTranslations { \ + !Shift <Btn1Motion>: m_rotateResize() + <Btn1Motion>: m_moveResize() + !Shift <Btn1Down>: m_raise() m_markpos() + <Btn1Down>: m_raise() m_markposAdd() + <Btn1Up>: m_redraw() m_destroyNull() + <Btn2Down>: m_lower() + <Btn2Up>: call(pannerPanXY,$x,$y) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(toggleMagnifier) + !Ctrl <Key>p: call(togglePanner) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>s: call(cpMatchFrames) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: m_deleteDestroy() + <Key>Delete: m_deleteDestroy() + <KeyPress>: graphics-input() + <Motion>: track-cursor() call(wcsUpdate,$x,$y) +} + + +# setPanner -- Turn the panner on or off. + +proc togglePanner args \ +{ + global panner_enable + + if {$panner_enable} { + setPanner 0 + } else { + setPanner 1 + } +} + + +proc setPanner {state} \ +{ + global winWidth winHeight frameWidth frameHeight + global frame panner_mapping pannerWinTranslations pannerArea + global panner_enable panner_region_enable panner_pan_enable + global pannerGeom panner_x panner_y panner_width panner_height + global last_compass + + if {$state} { + if {$panner_enable} \ + return + + # Determine where to place the panner. + set scale \ + [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))] + set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1] + set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1] + set defGeom [format "%sx%s-5+5" $scaled_width $scaled_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Create the main panner window (marker). + send imagewin createMarker pannerWin \ + type rectangle \ + createMode noninteractive \ + width [expr $width / 2] \ + height [expr $height / 2] \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + lineColor 8 \ + highlightColor 8 \ + translations $pannerWinTranslations \ + visible true \ + sensitive true \ + autoRedraw true \ + activated true + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Register callbacks. + send frame addCallback pannerMapImage + send frameRegion addCallback pannerSetRegion + send imagewin addCallback pannerImagewinResized resize + send resize addCallback pannerImagewinResized + + send pannerWin { + addCallback pannerMapImage moveResize; + addCallback pannerMoved moveResize; + addCallback pannerDestroy destroy; + addCallback pannerWinConstraint constraint; + } + + # Map display frame to panner window. + set panner_enable 1 + set panner_region_enable 1 + set panner_mapping [send imagewin nextMapping] + pannerMapImage init; send imagewin refreshMapping $panner_mapping + + # Redraw the compass if necessary. + send compass "setSensitive True ; set on $last_compass" + if { $last_compass } \ + drawCompass + + # Draw a marker in the panner window outlining displayed region. + send imagewin createMarker pannerRegionMarker \ + type box \ + createMode noninteractive \ + translations $pannerWinTranslations \ + lineColor green \ + highlightColor green \ + sensitive true + + # Fire up the panner region marker. + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + send pannerRegionMarker "\ + addCallback pannerPanImage moveResize; \ + addCallback pannerDestroy destroy; \ + addCallback pannerRegionConstraint constraint; \ + setAttributes visible true activated true; \ + redraw" + set panner_pan_enable 1 + + } elseif {$panner_enable} { + pannerDestroy + } +} + + +# pannerDestroy -- Delete the panner. + +proc pannerDestroy args \ +{ + global panner_enable panner_region_enable panner_pan_enable + global panner_mapping + + if {$panner_enable} { + set panner_enable 0 + set panner_pan_enable 0 + set panner_region_enable 0 + + send imagewin freeMapping $panner_mapping + send imagewin deleteCallback pannerImagewinResized + send resize deleteCallback pannerImagewinResized + send frame deleteCallback pannerMapImage + send frameRegion deleteCallback pannerSetRegion + + if [send server queryObject pannerRegionMarker] { + send pannerRegionMarker destroy + } + if [send server queryObject pannerWin] { + send pannerWin destroy + } + + # Disable the compass. + send compass "setSensitive False ; set on False" + } +} + + +# pannerMapImage -- Map the current display frame into the panner window. +# Called when the frame changes or the panner window is moved or resized. +# The panner window displays a small dezoomed version of the full frame. + +proc pannerMapImage args \ +{ + global panner_enable frame + global panner_mapping + + if {!$panner_enable || $frame == 0} \ + return + + set raster [send client getRaster] + send pannerWin getRect interior dx dy dnx dny + send imagewin queryRaster $raster width height + + if [send imagewin activeMapping $panner_mapping] { + send imagewin raiseMapping $panner_mapping + } + send imagewin setMapping $panner_mapping 0 \ + $raster pixel 0 0 $width $height \ + 0 pixel $dx $dy $dnx $dny +} + + +# pannerSetRegion -- Adjust the pannerWin region marker to outline the +# region displayed in the main display window. This is called in response +# to a frameRegion event when the main display mapping changes, e.g. when +# the frame changes or the user zooms or pans the main window. The region +# marker is moved and resized to reflect the new view. + +proc pannerSetRegion {param old new} \ +{ + global panner_enable panner_region_marker + global panner_region_enable panner_pan_enable + global frame frameWidth frameHeight prm_width prm_height + + if {!$panner_enable || !$panner_region_enable || $frame == 0} \ + return + + # new: frame sx sy snx sny + set src_frame [lindex $new 0] + set sx [lindex $new 1]; set snx [lindex $new 3] + set sy [lindex $new 2]; set sny [lindex $new 4] + + if {$src_frame != $frame} \ + return + + send pannerWin getRect interior px py pnx pny + + set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px] + set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py] + set width [expr ($snx/2.0) / $frameWidth * $pnx + 1] + set height [expr ($sny/2.0) / $frameHeight * $pny + 1] + + set pan_save $panner_pan_enable; set panner_pan_enable 0 + set panner_region_enable 0 + + send pannerRegionMarker "\ + markpos; \ + setAttributes x $x y $y width $width height $height; \ + redraw; raise" + send pannerRegionMarker getAttributes width prm_width height prm_height + + set panner_region_enable 1 + set panner_pan_enable $pan_save +} + + +# pannerPanImage -- Pan or zoom the image in the main image window. This is +# called when the user moves the region marker within the panner window. + +proc pannerPanImage {marker event position} \ +{ + global panner_pan_enable + global winWidth winHeight + global prm_width prm_height + global frame auto_reg frameOffsetX frameOffsetY + + if {!$panner_pan_enable} \ + return + + # position: x y width height. + set new_width [lindex $position 2] + set new_height [lindex $position 3] + + # region: type raster x y width height. + set region [send pannerRegionMarker getRegion unmap] + set x [expr [lindex $region 2] + 1]; set width [lindex $region 4] + set y [expr [lindex $region 3] + 1]; set height [lindex $region 5] + + set panner_pan_enable 0 + if {$new_width == $prm_width && $new_height == $prm_height} { + send client pan $x $y + } else { + set xscale [expr ($winWidth / 2.0) / $width] + set yscale [expr ($winHeight / 2.0) / $height] + if {$auto_reg == 1} { + send client zoomAbs $xscale $yscale $x $y \ + $frameOffsetX($frame) $frameOffsetY($frame) + } else { + send client zoom $xscale $yscale $x $y + } + } + set panner_pan_enable 1 +} + + +# pannerPanXY -- Pan to the point X,Y in the panner window coordinate +# system. Called when the user clicks MB2 in the panner window. + +proc pannerPanXY {x y} \ +{ + send imagewin unmapPixel $x $y raster rx ry + send client pan $rx $ry +} + + +# pannerMoved -- Called when the user moves the panner window. We need to +# move the region marker to the new window location and record the new location +# so that the window will come up in the same place if closed and reopened. + +proc pannerMoved {marker event position} \ +{ + global winWidth winHeight + global frame panner_pan_enable pannerGeom + global panner_x panner_y panner_width panner_height + + # Move the region marker to the new location. + set pan_save $panner_pan_enable; set panner_pan_enable 0 + send client getSource raster sx sy snx sny + pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny] + set panner_pan_enable $pan_save + + # Update the panner window position variables so that it comes up + # in the same place the next time. + + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + drawCompass + + send pannerRegionMarker raise +} + + +# pannerWinConstraint -- Called when the panner window is moved, resized, or +# rotated. Constrain the panner window to remain within the image window; +# rotation is not permitted. + +proc pannerWinConstraint {marker event attributes} \ +{ + global winWidth winHeight + global panner_width panner_height + + set width $panner_width + set height $panner_height + set constraints [list {}] + + # Check the width and height first as we need these below. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + width { set ww [expr $winWidth / 2] + if {$new > $ww} { + lappend constraints "width $ww" + set width $ww + } else { + set width $new + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh} { + lappend constraints "height $wh" + set height $wh + } else { + set height $new + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + + # Constrain X and Y. + foreach i $attributes { + set new [lindex $i 2] + switch [lindex $i 0] { + x { set pw [expr $width / 2] + if {$new < $pw} { + lappend constraints "x $pw" + } elseif {$new > $winWidth - $pw} { + lappend constraints "x [expr $winWidth - $pw]" + } + } + y { set ph [expr $height / 2] + if {$new < $ph} { + lappend constraints "y $ph" + } elseif {$new > $winHeight - $ph} { + lappend constraints "y [expr $winHeight - $ph]" + } + } + } + } + + return $constraints +} + + +# pannerRegionConstraint -- Called when the region marker in the panner +# window is moved, resized, or rotated. + +proc pannerRegionConstraint {marker event attributes} \ +{ + global winWidth winHeight + global frame + + set constraints [list {}] + send pannerWin getRect interior p_x p_y p_width p_height + send pannerRegionMarker getAttributes width rwidth height rheight + + # Since the panner region marker is a box marker x,y and width,height + # will not both change in the same call, so we can process them all + # independently. + + foreach i $attributes { + set new [lindex $i 2] + + switch [lindex $i 0] { + x { set left [expr $p_x + $rwidth + 1] + set right [expr $p_x + $p_width - $rwidth - 1] + if {$new < $left} { + lappend constraints "x $left" + } elseif {$new > $right} { + lappend constraints "x $right" + } + } + y { set top [expr $p_y + $rheight + 1] + set bottom [expr $p_y + $p_height - $rheight - 1] + if {$new < $top} { + lappend constraints "y $top" + } elseif {$new > $bottom} { + lappend constraints "y $bottom" + } + } + width { set ww [expr $winWidth / 2] + if {$new > $ww / 2} { + lappend constraints "width $ww" + } + } + height { set wh [expr $winHeight / 2] + if {$new > $wh / 2} { + lappend constraints "height $wh" + } + } + rotangle { lappend constraints "rotangle 0" + } + } + } + drawCompass + + return $constraints +} + + +# pannerImagewinResized -- If the display window is resized make the panner +# track the corner. + +proc pannerImagewinResized args \ +{ + global panner_enable panner_mapping + global pannerGeom panner_x panner_y panner_width panner_height + global frame + + if {$panner_enable} { + set old_x $panner_x; set old_width $panner_width + set old_y $panner_y; set old_height $panner_height + + eraseCompass + + # Get new location of panner window. + set defGeom [format "%sx%s-5+5" $panner_width $panner_height] + send imagewin parseGeometry $pannerGeom $defGeom x y width height + + # Reposition the marker. + send pannerWin "\ + markpos; \ + setAttributes \ + x [expr $x + $width / 2] \ + y [expr $y + $height / 2] \ + width [expr $width / 2] \ + height [expr $height / 2]; \ + redraw" + + # Update the panner window position variables so that it comes up + # in the same place the next time. + send pannerWin getRect boundary \ + panner_x panner_y panner_width panner_height + set pannerGeom [send imagewin getGeometry \ + $panner_x $panner_y $panner_width $panner_height] + + # Make sure the panner window is on top. + send imagewin raiseMapping $panner_mapping + + # Refresh the panner window if it did not move. + if {$panner_x == $old_x && $panner_y == $old_y && + $panner_width == $old_width && $panner_height == $old_height} { + send imagewin refreshMapping $panner_mapping + } + + drawCompass + } +} + + +# resetPanner -- Reinitialize the panner. + +proc resetPanner {param old new} \ +{ + global pannerGeom displayPanner + if {$new == "done"} { + setPanner [true $displayPanner] + } else { + setPanner 0 + if {$new != "startup"} { + set pannerGeom -5+5 + } + } +}; send initialize addCallback resetPanner + + + +################################################################################ +# Print Panel Functions. +################################################################################ + +# Global variables needed for the print setup panel + +set printColor prGrayButton +set orientation epsPortButton +set page_size epsLetterButton +set imageScale 100 + +set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel + epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button + ScaleFrame SCdecrease SCtext SCincrease +} + + +proc psetup_init args \ +{ + global printColor orientation page_size imageScale #format + + set_printer toPrinter callback 1 + send SCtext set label [ format "%d %%" $imageScale ] + send $printColor set on true + send $orientation set on true + send $page_size set on true +} + + +proc doPrintOptions { param old new } \ +{ + global imageScale page_size orientation imageScale printColor + global warnings + + send printStatus set label {} + set val [join [lrange $new 1 end] " "] + + # print [format "doPrintOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + autoscale { if { $val == "True" } { + send epsscaleButton set on true + } elseif { $val == "False" } { + send epsscaleButton set on false + } + } + autorotate { if { $val == "True" } { + send autorotateButton set on true + } elseif { $val == "False" } { + send autorotateButton set on false + } + } + maxaspect { if { $val == "True" } { + send aspectButton set on true + } elseif { $val == "False" } { + send aspectButton set on false + } + } + annotate { if { $val == "True" } { + send annotateButton set on true + send titleButton setSensitive true + send colorbarButton setSensitive true + send bordersButton setSensitive true + send titleLabel setSensitive true + send titleString setSensitive true + } elseif { $val == "False" } { + send annotateButton set on false + send titleButton setSensitive false + send colorbarButton setSensitive false + send bordersButton setSensitive false + send titleLabel setSensitive false + send titleString setSensitive false + } + } + compress { if { $val == "True" } { + send compressButton set on true + } elseif { $val == "False" } { + send compressButton set on false + } + } + orientation { send $orientation set on false + if { $val == "portrait" } { + send epsPortButton set on true + set orientation epsPortButton + } elseif { $val == "landscape" } { + send epsPortButton set on false + set orientation epsLandButton + } + } + papersize { send $page_size set on false + if { $val == "letter" } { + send epsLetterButton set on true + set page_size epsLetterButton + } elseif { $val == "legal" } { + send epsLegalButton set on true + set page_size epsLegalButton + } elseif { $val == "A4" } { + send epsA4Button set on true + set page_size epsA4Button + } elseif { $val == "B5" } { + send epsB5Button set on true + set page_size epsB5Button + } + } + imscale { set imageScale $val + send SCtext set label [ format "%d %%" $imageScale ] + } + colortype { send $printColor set on false + if { $val == "gray" } { + send prGrayButton set on true + set printColor prGrayButton + } elseif { $val == "pseudo" } { + send prPseudoButton set on true + set printColor prPseudoButton + } elseif { $val == "rgb" } { + send prRGBButton set on true + set printColor prRGBButton + } + } + printerName { if [send toPrinter get on] { + send printlist highlight $val + } + } + printCmd { if [send toPrinter get on] { + send printcmd set string $val + } + } + printFile { if [send toFile get on] { + send printcmd set string $val + } + } + deviceType { if { $val == "Printer" } { + send printerLabel set label "Print Command:" + send toPrinter set on true + send toFile set on false + } elseif { $val == "File" } { + send printerLabel set label "File Name:" + send toPrinter set on false + send toFile set on true + send printlist unhighlight + } + } + dotitle { if { $val == "True" } { + send titleButton set on true + } elseif { $val == "False" } { + send titleButton set on false + } + } + doborders { if { $val == "True" } { + send bordersButton set on true + } elseif { $val == "False" } { + send bordersButton set on false + } + } + docolorbar { if { $val == "True" } { + send colorbarButton set on true + } elseif { $val == "False" } { + send colorbarButton set on false + } + } + title { send titleString set string $val + } + + status { send printStatus set label $val + send server synchronize + } + warning { if {$warnings} { Wexec server $val } + } + } +}; send printOptions addCallback doPrintOptions + + +# Print options procedures. +# ------------------------------- + +set prOptsWidgets { + toPrinter toFile + prGrayButton prPseudoButton prRGBButton + epsLandButton epsPortButton + epsLetterButton epsLegalButton epsA4Button epsB5Button + SCincrease SCdecrease +} +set prSimpleOptions { + epsscaleButton autorotateButton aspectButton annotateButton compressButton + titleButton bordersButton colorbarButton +} + +proc prPrintCommand { widget cbtype args } \ +{ + if [send toFile get on] { + send client setPrintOption printfile $args + send printStatus set label [format "output file set to %s" $args] + } else { + send client setPrintOption printcmd $args + send printStatus set label [format "print command set to %s" $args] + } +}; send printcmd addCallback prPrintCommand + +proc prTitleString { widget cbtype args } \ +{ + send client setPrintOption title $args +}; send titleString addCallback prTitleString + +proc prOptionToggle { widget cbtype args } \ +{ + global imageScale + + # Handle the image scale widgets first. + switch $widget { + SCincrease { set scale [expr $imageScale + 5] + send client setPrintOption imscale $scale + return + } + SCdecrease { set scale [ expr $imageScale - 5 ] + send client setPrintOption imscale $scale + return + } + } + + # If it's not one of those it must be one of the radio toggles. + set val [ send $widget get on ] + #print [ format "prOptionToggle %s = %s" $widget $val ] + if { $val == 1 } { + switch $widget { + toPrinter { send client setPrintOption devicetype printer } + toFile { send client setPrintOption devicetype file } + + epsLandButton { send client setPrintOption orientation landscape } + epsPortButton { send client setPrintOption orientation portrait } + + epsLetterButton { send client setPrintOption papersize letter } + epsLegalButton { send client setPrintOption papersize legal } + epsA4Button { send client setPrintOption papersize A4 } + epsB5Button { send client setPrintOption papersize B5 } + + prGrayButton { send client setPrintOption colortype gray } + prPseudoButton { send client setPrintOption colortype pseudo } + prRGBButton { send client setPrintOption colortype rgb } + } + } else { + send $widget set on true + } + +} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle } + +proc prSimpleOptionToggle { widget args } \ +{ + set val [ send $widget get on ] + #print [ format "prSimpleOptionToggle %s = %s" $widget $val ] + + switch $widget { + epsscaleButton { send client setPrintOption autoscale $val } + autorotateButton { send client setPrintOption autorotate $val } + aspectButton { send client setPrintOption maxaspect $val } + annotateButton { send client setPrintOption annotate $val } + compressButton { send client setPrintOption compress $val } + + titleButton { send client setPrintOption dotitle $val } + bordersButton { send client setPrintOption doborders $val } + colorbarButton { send client setPrintOption docolorbar $val } + } +} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle } + + + +# Printer display and selection. +# ------------------------------- +set lprList {} + +proc psSetPrintList {param old new} \ +{ + global lprList + set lprList $new + send printlist setList $new resize + send printlist highlight 0 +}; send printerList addCallback psSetPrintList + +proc lprResize args \ +{ + global lprList + send printlist setList $lprList resize + send printlist highlight 0 +}; send printlist addEventHandler lprResize ResizeRedirectMask + +proc psSelectPrint {widget cbtype selections indices} \ +{ + global printerlist + foreach selection $selections { + send client setPrintOption printername $selection + } +}; send printlist addCallback psSelectPrint + + +proc Print args \ +{ + global winWidth winHeight + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send printcmd get string ] + if [send toFile get on] { + send client setPrintOption printfile $val + } else { + send client setPrintOption printcmd $val + } + set val [ send titleString get string ] + send client setPrintOption title $val + setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0 + + send client print + send imagewin setCursorType idle +} ; send okayPrint addCallback Print + + + +# setPrintCorners -- Tell the client the WCS of the image being printed. + +proc setPrintCorners { lx ly ux uy args } \ +{ + global winWidth winHeight + + # Convert raw corner screen coordinates to frame buffer raster coords. + send imagewin unmapPixel $lx $ly raster llx lly + set llx [expr "int ($llx)"] + set lly [expr "int ($lly)"] + set str [send client encodewcs $llx $lly] + scan $str "%g %g %g" llx_r lly_r z + set llx_i [expr "int ($llx_r)"] + set lly_i [expr "int ($lly_r)"] + + send imagewin unmapPixel $ux $uy raster urx ury + set urx [expr "int ($urx)"] + set ury [expr "int ($ury)"] + set str [send client encodewcs $urx $ury] + scan $str "%g %g %g" urx_r ury_r z + set urx_i [expr "int ($urx_r)"] + set ury_i [expr "int ($ury_r)"] + + send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i +} + + + +################################################################################ +# INFO box. +################################################################################ + +set infoMode infoOptFr + + +# Current Frame information. +proc infoFrameUpdate args \ +{ + global version frame nframes + global frameWidth frameHeight frameDepth + global enhancement + global cpXcen cpYcen cpXoff cpYoff + global cpXmag cpYmag cpXscale cpYscale + + if { [send infoOptWCS get on] } { + send client info wcs + return + } elseif {! [send infoOptFr get on]} \ + return + + + if {$frame == 0} { + send infoText set string "initializing display..." + } else { + set line1 $version + set line2 [format "Image:\t\t%s" [send imageTitle get label]] + set line3 [format "Frame %d of %d:\t%d x %d" \ + $frame $nframes $frameWidth $frameHeight] + set cmap [lindex $enhancement($frame) 0] + set brt [lindex $enhancement($frame) 1] + set con [lindex $enhancement($frame) 2] + set line4 [format "Colormap:\t%s" $cmap] + set line5 [format "Enhancement:\tBrt=%s Cont=%s" $brt $con] + + set cntr [format "X: %0.1f\n\t\tY: %0.1f" $cpXcen $cpYcen] + set line6 [format "Center:\t\t%s" $cntr] + + set line7 [format "Zoom:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXmag $cpYmag] + set line8 [format "Scale:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXscale $cpYscale] + set line9 [format "Offset:\t\tX: %0.2f\n\t\tY: %0.2f" $cpXoff $cpYoff] + + send infoText set string [ + format "%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n" \ + $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9 + ] + } +} +set params {frame frameView nframes frameSize frameTitle enhancement} +foreach p $params { send $p addCallback infoFrameUpdate } + + +# Server Program State information. +proc infoOptToggle { widget type state args } \ +{ + global infoMode ismInfoText + + if {$state} { set not False } else { set not True } + + send $infoMode set on $not + set infoMode $widget + + switch $widget { + infoOptFr { infoFrameUpdate } + infoOptSvr { set bp [send imagewin get basePixel] + set mc [send imagewin get maxColors] + send client info server $bp $mc + } + infoOptIsm { send infoText set string $ismInfoText } + infoOptClients { send client info clients } + infoOptWCS { send client info wcs } + infoOptFB { send client info imtoolrc } + } +} +set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB } +foreach w $iopts { send $w addCallback infoOptToggle } + + +proc infoSetText { param old new } \ +{ + send infoText set string $new +} ; send info addCallback infoSetText + + + +################################################################################ +# Image and objects list display and section +################################################################################ + +proc filesTextHighlight { widget event args } \ +{ + if { $event == "enterNotify" } { + send $widget set displayCaret True + } elseif { $event == "leaveNotify" } { + send $widget set displayCaret False + } +} +foreach w {imtemplateText fnameText z1Value z2Value} { + send $w addEventHandler filesTextHighlight enterWindowMask + send $w addEventHandler filesTextHighlight leaveWindowMask +} + +send rootButton addCallback "send client setLoadOption root" +send homeButton addCallback "send client setLoadOption home" +send upButton addCallback "send client setLoadOption up" +send rescanButton addCallback "send client setLoadOption rescan" + +set label \ + [format "%-35.35s %6s %12s %12s"\ + " Image" "Bitpix" " Size" " Title"] +send imlistLabel set label $label +send imlistLabel "set height 0 ; unmap" + + +# Create the Frames menu on the load panel window. +set loadItems { "Current f.exec \{send frameFrame set label Current\}"} +for {set i 1} {$i <= $MAX_FRAMES} {incr i} { + lappend loadItems "\"\ \ $i\ \ \" f.exec \{send frameFrame set label $i\}" +}; createMenu loadFrames frameFrame $loadItems + + + + + +# Filename pattern callback. +proc setPattern { widget mode pattern args } \ +{ + send client setLoadOption pattern $pattern +} ; send imtemplateText addCallback setPattern + + +# Load options parameter callback. +proc doLoadOptions { param old new } \ +{ + global warnings panel_up + + set val [ join [lrange $new 1 end] " " ] + + switch [lindex $new 0] { + pattern { send imtemplateText set string [format "%s" $val ] } + curdir { send dirLabel set label [format " Directory: %s" $val ] } + newfile { send fnameText set string $val } + status { send filesStatus set label $val + if { ! $panel_up } { send imageTitle set label $val } + send server synchronize + } + warning { if {$warnings} { Wexec server $val } } + gray { send grayscale set on $val } + zscale { send zscale set on $val + if {$val} { + send zrange setSensitive False + } else { + send zrange setSensitive True + } + } + zrange { send zrange set on $val + if {$val} { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive False + } + } else { + foreach w {z1Label z1Value z2Label z2Value} { + send $w setSensitive True + } + } + } + z1 { send z1Value set string [format "%s" $val ] } + z2 { send z2Value set string [format "%s" $val ] } + nsample { send nsampValue set string [format "%s" $val ] } + } +} ; send loadOptions addCallback doLoadOptions + +# Option utility routines. +proc toggleGraymap args \ +{ + send client setLoadOption gray [ send grayscale get on ] +} ; send grayscale addCallback toggleGraymap + +proc toggleHeaders args \ +{ + if { [send browseHdrs get on] } { + send client setLoadOption headers + send rootButton setSensitive False + send homeButton setSensitive False + send upButton setSensitive False + send rescanButton setSensitive False + send imlistLabel "set height 10 ; map" + } else { + send client setLoadOption rescan + send rootButton setSensitive True + send homeButton setSensitive True + send upButton setSensitive True + send rescanButton setSensitive True + send imlistLabel "set height 0 ; unmap" + } +} ; send browseHdrs addCallback toggleHeaders + +proc toggleZscale args \ +{ + send client setLoadOption zscale [send zscale get on] +} ; send zscale addCallback toggleZscale + +proc toggleZrange args \ +{ + send client setLoadOption zrange [send zrange get on] +} ; send zrange addCallback toggleZrange + +proc setZ1 { widget mode pattern args } \ +{ + send client setLoadOption z1 $pattern +} ; send z1Value addCallback setZ1 + +proc setZ2 { widget mode pattern args } \ +{ + send client setLoadOption z2 $pattern +} ; send z2Value addCallback setZ2 + +proc setNsamp { widget mode pattern args } \ +{ + send client setLoadOption nsample $pattern +} ; send nsampValue addCallback setNsamp + +proc fileLoad { widget mode fname args } \ +{ + loadImage $fname +} ; send fnameText addCallback fileLoad + + + +# Image list selection routines. + +set fileList {} + +proc setFileList { param old new } \ +{ + global fileList + set fileList $new + + # Get the max length of the strings so we can set + # the list columns appropriately. + set max 0 + foreach n $new { + set len [string length $n] + if {$len > $max} { set max $len } + } + + # Optimize the number of columns for the file list. + if {$max > 35} { + send imageList set defaultColumns 1 + } elseif {$max > 21} { + send imageList set defaultColumns 2 + } elseif {$max > 12} { + send imageList set defaultColumns 3 + } elseif {$max > 5} { + send imageList set defaultColumns 4 + } else { + send imageList set defaultColumns 5 + } + + send imageList setList $new resize +}; send filelist addCallback setFileList + +proc flResize args \ +{ + global fileList + send imageList setList $fileList resize +}; send imageList addEventHandler flResize ResizeRedirectMask + +proc flSelectPrint { widget cbtype selections args } \ +{ + if {! [send autoload get on]} \ + return + + foreach selection $selections { + if { [send zrange get on] } { + loadImage [lindex $selection 0] + } else { + loadImage $selection + } + } +}; send imageList addCallback flSelectPrint + + +# Load the named image in the display. +proc loadImage { name } \ +{ + global frame + + set fr [send frameFrame get label] + + if { $fr == "Current" } { set fr $frame } + + if { [fileSetOptions] >= 0 } { + send imagewin setCursorType busy + send client load $name $fr + send imagewin setCursorType idle + send fnameText set string $name + } +} + +# Load button callback. +proc fileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname == ""} { + Wexec client "No image name specified" + } else { + loadImage $fname + } +} ; send filesLoadButton addCallback fileLoadB + + +# Send and selected options to the client before loading the image. +proc fileSetOptions args \ +{ + if { ![send zscale get on] && ![send zrange get on] } { + set z1 [send z1Value get string] + set z2 [send z2Value get string] + + if {$z1 == $z2} { + Wexec client "z1/z2 values are not set properly" + return -1 + } else { + send client setLoadOption z1 $z1 + send client setLoadOption z2 $z2 + } + } + + return 0 +} + + +################################################################################ +# Save panel functions. +################################################################################ + +# Global variables needed for the save setup panel + +set format rasButton +set saveColor svPseudoButton + +set fileFmtButtons { + rasButton gifButton jpegButton tiffButton + fitsButton x11Button epsButton rawButton +} + + +# Format group procedures. +#--------------------------------- + +# Select a format. + +proc set_format { widget func state args } \ +{ + global format saveColor + + send $format set on false + if {$widget == $format} { + send $widget set on true + } else { + switch $widget { + rasButton { send client setSaveOption format ras } + gifButton { send client setSaveOption format gif } + jpegButton { send client setSaveOption format jpeg } + tiffButton { send client setSaveOption format tiff } + fitsButton { send client setSaveOption format fits } + x11Button { send client setSaveOption format x11 } + epsButton { send client setSaveOption format eps } + rawButton { send client setSaveOption format raw } + } + } +} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format } + +proc setSaveFile { widget cbtype args } \ +{ + send client setSaveOption fname $args + send saveStatus set label [format "output file set to %s" $args] +}; send saveFile addCallback setSaveFile + + +proc doSaveOptions { param old new } \ +{ + global format saveColor + global warnings + + send saveStatus set label {} + set val [join [lrange $new 1 end] " "] + + #print [format "doSaveOptions %s = %s" [lindex $new 0] $val] + switch [lindex $new 0] { + format { + # Now (de)sensitize the color options depending on the format, + # force the color choice when needed. + send $format set on false + switch [lindex $val 0] { + ras { #send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format rasButton + } + gif { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + if {$saveColor == "svRGBButton"} { + send $saveColor set on false + send svPseudoButton set on true + set saveColor svPseudoButton + } + set format gifButton + } + jpeg { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format jpegButton + } + tiff { send svRGBButton setSensitive false + send svPseudoButton setSensitive true + set format tiffButton + } + fits { send svRGBButton setSensitive false + send svPseudoButton setSensitive false + send $saveColor set on false + send svGrayButton set on true + set saveColor svGrayButton + set format fitsButton + } + x11 { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format x11Button + } + eps { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format epsButton + } + raw { send svRGBButton setSensitive true + send svPseudoButton setSensitive true + set format rawButton + } + } + send $format set on true + } + color { send $saveColor set on false + switch [lindex $val 0] { + grayscale { send svGrayButton set on true + set saveColor svGrayButton + } + pseudocolor { send svPseudoButton set on true + set saveColor svPseudoButton + } + rgb { send svRGBButton set on true + set saveColor svRGBButton + } + } + } + fname { send saveFile set string $val + } + status { send saveStatus set label $val + send server synchronize + } + text { send saveData set label $val + } + warning { if {$warnings} { Wexec server $val } + } + } +} ; send saveOptions addCallback doSaveOptions + + +# Color group procedures. +#--------------------------------- +send svGrayButton addCallback "send client setSaveOption color grayscale" +send svPseudoButton addCallback "send client setSaveOption color pseudocolor" +send svRGBButton addCallback "send client setSaveOption color rgb" + + +proc Save args \ +{ + global panel_up + + send imagewin setCursorType busy + + # Get the print command or file template if not previous reset. + set val [ send saveFile get string ] + send client setSaveOption fname $val + send saveStatus set label [format "output file set to %s" $args] + + send client save + send imagewin setCursorType idle +} ; send okaySave addCallback Save + + + +################################################################################ +# TILE GEOMETRY +################################################################################ + +set tileSel 2 +set tileOpt 0 +set tileNcols 2 +set tileNrows 1 +set tile_frames {} + +proc selectTileOrientation { widget type select args } \ +{ + global tileSel tileOpt + + set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease } + if {$select == "Manual"} { + foreach p $w { send $p setSensitive True } + } elseif {$select != "none"} { + foreach p $w { send $p setSensitive False } + } + + set w { byCols bottomUp labelFrames labelImname labelTitles } + if {$select == "Disabled"} { + foreach p $w { send $p setSensitive False } + } else { + foreach p $w { send $p setSensitive True } + } + + switch $select { + Disabled { set tileSel 0 } + Manual { set tileSel 1 + set nx [send nctext get label] + set ny [send nrtext get label] + set select [format "%dx%d" $nx $ny] + } + Best { set tileSel 2 } + Square { set tileSel 3 } + Horizontal { set tileSel 4 } + Vertical { set tileSel 5 } + "One Row" { set tileSel 6 } + "One Column" { set tileSel 7 } + none { send tileMode set selection $tileSel ; return } + } + + # Reset the button in case we're called directly from elsewhere. + send tileMode set selection $tileSel + + # Send the option to the client. + if {$tileSel > 0} { + setTileFrames + send client setOption tileFrames "True" + set tileOpt $tileSel + } else { + send client setOption tileFrames "False" + } + +} ; send tileMode addCallback selectTileOrientation + +proc tileSelToLabel { selection args } \ +{ + switch $selection { + 0 { return "Disabled" } + 1 { return "Manual" } + 2 { return "Best" } + 3 { return "Square" } + 4 { return "Horizontal" } + 5 { return "Vertical" } + 6 { return "One Row" } + 7 { return "One Column" } + } + return "Best" +} + +# Callback for the fill style options. +proc selectFillStyle { widget type state args } \ +{ + if {$state} { set not False } else { set not True } + + switch $widget { + byCols { send client setOption tileByRows $not } + bottomUp { send client setOption tileTopDown $not } + } +} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle } + +# Callback for the tile labelling options. +proc selectTileLabels { widget type state args } \ +{ + if {$state} { + switch $widget { + labelFrames { send client setOption tileLabels 1 } + labelImname { send client setOption tileLabels 2 } + labelTitles { send client setOption tileLabels 3 } + } + } else { + send client setOption tileLabels 0 + } + send $widget set on $state +} +foreach w {labelFrames labelImname labelTitles} { + send $w addCallback selectTileLabels +} + +# Callback for the Tile Frame selection toggles. +proc setTileFrames args \ +{ + global tile_frames tileSel tileNcols tileNrows + + # No-op if tiling isn't enabled. + if {$tileSel == 0} \ + return + + # Get the new tile frames list. + set tile_frames {} + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get state]} { + lappend tile_frames $i + } + } + + # Reset the geometry. + set geom [format "%dx%d" $tileNcols $tileNrows] + switch $tileSel { + 1 { send client setOption tileGeom $geom \{ $tile_frames \} } + 2 { send client setOption tileGeom Best \{ $tile_frames \} } + 3 { send client setOption tileGeom Square \{ $tile_frames \} } + 4 { send client setOption tileGeom Horizontal \{ $tile_frames \} } + 5 { send client setOption tileGeom Vertical \{ $tile_frames \} } + 6 { send client setOption tileGeom Row \{ $tile_frames \} } + 7 { send client setOption tileGeom Column \{ $tile_frames \} } + } +}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames} + +proc setAllTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state True + } + } + setTileFrames +} ; send tAll addCallback setAllTileFrames + +proc setNoTileFrames args \ +{ + global tileNcols tileNrows + for {set i 1} {$i <= 16} {incr i} { + if {[send tFrame$i get sensitive]} { + send tFrame$i set state False + } + } + setTileFrames +} ; send tNone addCallback setNoTileFrames + +proc tileOptions { param old new } \ +{ + global tileNcols tileNrows + + set tileNcols [lindex $new 0] + set tileNrows [lindex $new 1] + + # Set the geometry. + send nctext set label $tileNcols + send nrtext set label $tileNrows + send tileGeometry set label [format \ + "Tile Geometry: %-2dx%2d" $tileNcols $tileNrows] + +} ; send tileOptions addCallback tileOptions + + +proc tileSetRows { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "nrdecrease" && [expr ($ny-1)] > 0} { + incr ny -1 + } elseif {$widget == "nrincrease" && [expr ($ny+1)] <= $nframes} { + incr ny 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows } + +proc tileSetCols { widget args } \ +{ + global nframes tile_frames + + set nx [send nctext get label] + set ny [send nrtext get label] + + if {$widget == "ncdecrease" && [expr ($nx-1)] > 0} { + incr nx -1 + } elseif {$widget == "ncincrease" && [expr ($nx+1)] <= $nframes} { + incr nx 1 + } else { + return + } + set geom [format "%dx%d" $nx $ny] + send client setOption tileGeom $geom $tile_frames +} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols } + + +# Initialize the frame tiling. +setAllTileFrames +selectTileOrientation junk junk Disabled +selectFillStyle byRows junk True +selectFillStyle topDown junk True +selectTileLabels labelImname junk False + +################################################################################ +# Coords Panel Callbacks. +################################################################################ + +# In case we need to change the values.... +#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight +#set wcsPHeight 267 +#set wcsPTxtHeight 132 +#set wcsPGrHeight 175 +#set wcsPOptHeight 233 +#setCoordPanelHeight + +set wcsPHeight 267 ;# full panel no options +set wcsPTxtHeight 132 ;# size of text area box +set wcsPGrHeight 175 ;# size of text area group +set wcsPOptHeight 233 ;# extra height for opts boxes + +# Set the WCS readout panel sensitivity depending on whether the ISM +# is currently enabled. +proc setCoordPanelSensitivity args \ +{ + set widgets { + wpWcs2 wpWcs3 wpWcs4 + wiWcs2 wiWcs3 wiWcs4 + wlWcs2 wlWcs3 wlWcs4 + sysWcs2 sysWcs3 sysWcs4 + fmtWcs2 fmtWcs3 fmtWcs4 + } + + send sysWcs1 set label "Display" + send fmtWcs1 set label "Default" + + for {set i 2} {$i <= 4} {incr i} { + send sysWcs$i set label "None" ; send fmtWcs$i set label "Default" + send wpWcs$i set on False ; send wiWcs$i set on False + send wtWcs$i set height 4 + } + + if {[send ismToggle get on]} { + send sysWcs2 set label "World" ; send fmtWcs2 set label "Default" + send wpWcs2 set on True ; send wiWcs2 set on True + send wtWcs2 set height 17 + + foreach w $widgets { send $w setSensitive True } + } else { + foreach w $widgets { send $w setSensitive False } + } +} + + +# Set the Coords Panel height depending on the option settings. +proc setCoordPanelHeight args \ +{ + global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight + global tabTop + + if {$tabTop != "wcs_panel"} \ + return + + # Get the height of the text area + set panel_h $wcsPHeight + set shrinkage 0 + foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } { + if {[send $w get on] == 0} { + incr shrinkage 13 + } + } + if {[send woptTitles get on] == 0} { + incr shrinkage 26 + } + + set ph [expr ($wcsPHeight - $shrinkage)] + if {[send wcsOptions get on] == 1} { + incr ph $wcsPOptHeight + } + + send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ] + send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ] + send panel set height $ph +} + +# Toggle the options display for the panel. +proc wcsOptToggle { widget type state args } \ +{ + global wcsPOptHeight + set h [ send panel get height ] + if {$state == 1} { + send panel set height [ expr ($h + $wcsPOptHeight) ] + } else { + send panel set height [ expr ($h - $wcsPOptHeight) ] + } +} ; send wcsOptions addCallback wcsOptToggle + +# Handle the panel display toggles. +proc wcsCoordsCB { widget type state args } \ +{ + + set hght [ expr (($state == 1) ? 17 : 4)] + switch $widget { + wpWcs1 { send wtWcs1 set height $hght } + wpWcs2 { send wtWcs2 set height $hght } + wpWcs3 { send wtWcs3 set height $hght } + wpWcs4 { send wtWcs4 set height $hght } + woptFBinfo { send wtFBCfg set height $hght } + woptTitles { send wtName set height $hght ; send wtTitle set height $hght } + } + setCoordPanelHeight +} +set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles } +foreach w $wcValues { send $w addCallback wcsCoordsCB } + + +# Handle WCS label string options. +set wcsLabels 1 +proc wcsLabelsCB { widget type state args } \ +{ + global up_todo wcsLabels + set wcsLabels $state + #resizeCoordsBox 0 + resizeCoordsBox $up_todo + updateCoordsBox +} ; send woptLabels addCallback wcsLabelsCB + + +# Toggle the BPM tracking state. +proc wcsBPMCB { widget type state args } \ +{ + global ism_enable + if ($ism_enable) { catch { send wcspix set bpm $state } } +} ; send woptBPM addCallback wcsBPMCB + + +# Procedures to format lines in the wcsText box. +proc wcsFmtImname { name } \ +{ + send wtName set string [format " Name: %s" [string trimleft $name]] +} + +proc wcsFmtImtitle { title } \ +{ + send wtTitle set string [format " Title: %s" [string trimleft $title]] +} + +proc wcsFmtFBConfig args \ +{ + global frameWidth frameHeight frame nframes + set buf [ format "%5d x %-5d" $frameWidth $frameHeight ] + set line [ format "Frame Buf: %-13s Frame: %d of %d" \ + [string trimleft $buf] $frame $nframes ] + send wtFBCfg set string $line +} + +proc wcsFmtIValue { value } \ +{ + global coord + set line [ format " Pixel: %.11s" $value ] + send wtIPixval set string $line + if {[info exists coord(ival)]} { + set coord(ival) $value + updateCoordsBox + } +} + +proc wcsFmtSValue { value } \ +{ + global coord + set line [ format " Scaled: %.8s" $value ] + send wtSPixval set string $line + set coord(sval) [format "%s" $value] +} + +proc wcsFmtBValue { value } \ +{ + global coord + + if { [send woptBPM get on] } { + set line [ format " BPM: %s" $value ] + set color [expr { ($value == 0) ? "black" : "red" } ] + set msg [format "set string \{%s\}; set background %s" $line $color ] + set coord(bval) [format "%s" $value] + } else { + set line [ format " BPM: (off)" ] + set msg [format "set string \{%s\}" $line] + } + send wtBPixval $msg +} + +proc wcsFmtWcs { num wcsname x y xunit yunit args } \ +{ + global coord coordLab wcsLabels + + if {$wcsLabels} { + set line [ format "%4s: %12s %4s: %12s WCS: %s" \ + $xunit $x $yunit $y [string trimleft $wcsname] ] + } else { + set line [ format "%4s %12s %4s %12s %s" \ + " " $x " " $y [string trimleft $wcsname] ] + } + send wtWcs$num set string $line + + if {[info exists coord(wcs$num)]} { + if {$num == 1} { + set coord(wcs1) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(sval) ] + } elseif {$num == 2} { + set coord(wcs2) [ format "\{%s\} \{%s\} \{%s\}" $x $y $coord(ival) ] + } else { + set coord(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" $x $y $wcsname ] + } + + set coordLab(wcs$num) [ format "\{%s\} \{%s\} \{%s\}" \ + $xunit $yunit [string trimleft $wcsname ] ] + updateCoordsBox + } +} + + + +# Handle the wcsbox readout. +#------------------------------ +set up_todo 2 +set up_done 0 +set coord(ival) 0. +set coord(sval) 0. +set coord(bval) 0 +set coord(wcs1) { 0. 0. 0. } +set coord(wcs2) { 0. 0. 0. } +set coord(wcs3) { 0. 0. 0. } +set coord(wcs4) { 0. 0. 0. } + +proc wcsCoordB { widget type state args } \ +{ + global coord up_todo + + switch $widget { + wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. "" } } + wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. "" } } + wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. "" } } + wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. "" } } + } + + if {$state} { + incr up_todo + } else { + unset coord($line) + incr up_todo -1 + } + + resizeCoordsBox $up_todo + updateCoordsBox +} +set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 } +foreach w $wiValues { send $w addCallback wcsCoordB } + + +# Resize the coords box depending on the panel options. +proc resizeCoordsBox { nlines } \ +{ + global track_enable wcsLabels winWidth winHeight wcsboxGeom + + if {! $track_enable} \ + return + + send wcsbox getAttributes width cur_w height cur_h + set defGeom [format "%sx%s-5-5" $cur_w $cur_h] + send imagewin parseGeometry $wcsboxGeom $defGeom x y width height + + set ew [expr (($wcsLabels == 1) ? 125 : 65)] + + # Reset to the default geometry + if {$nlines == 0} { + set x [expr ($x + $ew)] + set y [expr ($y + $height - 17 + 1)] + set new_w 166 + set new_h 17 + + } else { + if {$width > 166} { ;# not using default wcsbox + set new_w $width + } else { + set new_w [expr ($width + $ew)] + set x [expr ($x - $ew)] + if {$wcsLabels == 0} { + incr x 60 + } + } + set new_h [ expr ($nlines * 17) ] + set y [expr ($y + $height - $new_h + 1)] + } + + # Bounds checking. + if {$x < 5} { + set x 5 + } elseif {$x > [expr ($winWidth - $new_w - 5)]} { + set x [expr ($winWidth - $new_w - 5)] + } + if {$y < 5} { + set y 5 + } elseif {$y > [expr ($winHeight - $new_h - 5)]} { + set y [expr ($winHeight - $new_h - 5)] + } + + # Finally redraw the marker. + send wcsbox "\ + setAttributes \ + width $new_w \ + height $new_h \ + x $x \ + y $y; \ + redraw" + + set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h] + send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)] + updateCoordsBox +} + + +# Shortcuts for known WCS labels. +set labels(display) "TV" +set labels(logical) "Log" +set labels(physical) "Phys" +set labels(equatorial) "Eq" +set labels(ecliptic) "Ecl" +set labels(galactic) "Gal" +set labels(supergalactic) "SGal" +set labels(amplifier) "Amp" +set labels(ccd) "CCD" +set labels(detector) "Det" + + +# Format the coords box marker with the selected output options. +proc updateCoordsBox args \ +{ + global ism_enable coord coordLab wcsLabels + global up_done up_todo labels track_enable + global coord + + if {! $ism_enable} \ + return + + incr up_done + + set text "" + foreach l {wcs1 wcs2 wcs3 wcs4} { + if {[info exists coord($l)]} { + set x [lindex $coord($l) 0] + set y [lindex $coord($l) 1] + set z [string tolower [string trimleft [lindex $coord($l) 2] ] ] + if {[info exists labels($z)]} { + set z $labels($z) + } + + if {$wcsLabels && [info exists coordLab($l)]} { + set lx [lindex $coordLab($l) 0] + set ly [lindex $coordLab($l) 1] + append text [format " %4s %12.12s %4s %12.12s %9.9s \n" \ + $lx $x $ly $y $z ] + } else { + append text [format " %12.12s %12.12s %9.9s \n" $x $y $z ] + } + } + } + + # Now send the string. + if {$track_enable} { + set color [expr { ($coord(bval) == 0) ? "black" : "red" } ] + set txt [format "set text \{%s\}; set textBgColor %s; redraw noerase" \ + $text $color ] + send wcsbox $txt + } + + if {$up_done >= $up_todo} { + set up_done 0 ;# reset counter + } +} + + +# Create the WCS format menus. +#------------------------------------ +proc setWcsFmt { format line } \ +{ + catch { send wcspix set format $format $line } +} + +for {set i 1} {$i <= 4} {incr i} { + set items {} + lappend items "\"Default\" f.exec \{setWcsFmt default $i\}" + lappend items "\"Sexigesimal\" f.exec \{setWcsFmt hms $i\}" + lappend items "\"Degrees\" f.exec \{setWcsFmt deg $i\}" + lappend items "\"Radians\" f.exec \{setWcsFmt rad $i\}" + editMenu fmtMenu$i fmtWcs$i $items +} + + +# Create the default WCS type menus. +#------------------------------------ + +set defaultWcsMenu { + { "None" f.exec {setWcsSys none WCS_LINE } } + { "Display" f.exec {setWcsSys display WCS_LINE } } + { "World" f.exec {setWcsSys world WCS_LINE } } + { "Logical" f.exec {setWcsSys logical WCS_LINE } } + { "Physical" f.exec {setWcsSys physical WCS_LINE } } + { f.dblline } +} + +proc setWcsSys { sys line } \ +{ + if {[string tolower $sys] == "none"} { + wcsCoordB wiWcs$line junk 0 + send sysWcs$line set label "None"; send fmtWcs$line set label "Default" + send wpWcs$line set on False ; send wiWcs$line set on False + send wtWcs$line set height 4 + setCoordPanelHeight + + } else { + catch { send wcspix set wcs $sys $line } + } +} + +proc resetDefaultWcsMenu args \ +{ + global defaultWcsMenu + + for {set i 1} {$i <= 4} {incr i} { + regsub -all WCS_LINE $defaultWcsMenu $i menu_def + editMenu sysMenu$i sysWcs$i $menu_def + } +} ; resetDefaultWcsMenu + + +# Initialize the coordinates panel. +#------------------------------------ + +proc initCoordsPanel args \ +{ + #send wcLine set height 2 ;# kludge for label widget + + # Initialize the display strings in the coords box. + wcsFmtImname "" + wcsFmtImtitle "" + wcsFmtFBConfig + wcsFmtIValue "0." ; wcsFmtSValue "0." ; wcsFmtBValue "0" + wcsFmtWcs 1 "" "" "" " X" " Y" + wcsFmtWcs 2 "" "" "" " X" " Y" + wcsFmtWcs 3 "" "" "" " X" " Y" + wcsFmtWcs 4 "" "" "" " X" " Y" + + send fmtWcs1 set label Default + send wpWcs1 set on True ;send wiWcs1 set on True + send wpWcs2 set on True ;send wiWcs2 set on True + send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4 + send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4 + + # Set the Coords Panel height. + set wcsPTxtHeight [send wcsText get height] + setCoordPanelHeight + + # Set the WCS readout panel sensitivity. + setCoordPanelSensitivity + +} ; initCoordsPanel + + + + +################################################################################ +# Compass indicator procedures. +################################################################################ + +set compassColor 207 ;# normally this is yellow +set last_compass [send compass get on] ;# save compass state + +proc drawCompass args \ +{ + global ism_enable frame frameCache compassColor Compass Orient + global panner_x panner_y panner_width panner_height cur_objid + global redraw_compass last_compass + + + if {! [send compass get on]} \ + return + + eraseCompass ;# erase the old compass + + if {! [info exists frameCache($frame)] } { + set id -1 + } elseif {$cur_objid != [lindex $frameCache($frame) 1]} { + set id [lindex $frameCache($frame) 1] + } else { + set id $cur_objid + } + + if { [info exists Compass($id)] } { + set angle [lindex $Compass($id) 0] + set north_x [lindex $Compass($id) 1] + set north_y [lindex $Compass($id) 2] + set east_x [lindex $Compass($id) 3] + set east_y [lindex $Compass($id) 4] + set transpose [lindex $Compass($id) 5] + set xlab [lindex $Compass($id) 6] + set ylab [lindex $Compass($id) 7] + } else { + set north_x 0.0 ; set north_y 1.0 + set east_x 1.0 ; set east_y 0.0 + set xlab X ; set ylab Y + set angle 0.0 ; set transpose 0 + set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y } + } + set xflip 1 + set yflip 1 + + # Adjust the compass for the display orientation (e.g. image sections + # used to flip an image during display). + if { [info exists Orient($id)] } { + set xflip [expr $xflip * [lindex $Orient($id) 1] ] + set yflip [expr $yflip * [lindex $Orient($id) 2] ] + } + + # Get the panner center position. + set pcx [expr ($panner_x + $panner_width / 2)] + set pcy [expr ($panner_y + $panner_height / 2)] + + # Setup for the overlay. + send imagewin getLogRes sv_xl sv_yl + send imagewin getPhysRes sv_xp sv_yp + send imagewin setLogRes $sv_xp $sv_yp + send imagewin setLineWidth 2 + + set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))] + set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))] + + # Normalized compass points. The first row are the axes, second is + # the pointer head, and last are the X/Y label coords. Assumes a + # zero rotation with North up and East left, or standard X/Y orientation. + set cpoints { + {-1 0} {0 0} {0 -1} + {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85} + {-1.2 0} {0 -1.2} + } + + + # Get rotation and scale factors. + set angle [expr "atan2($north_y,$north_x)"] + set coso [expr "cos (-$angle)"] + set sino [expr "sin (-$angle)"] + set scale [expr ([min $panner_width $panner_height] * 0.3)] + + # Initialize the drawing points. + set pts {} + + set cpoints { } + lappend cpoints [list $east_x $east_y ] + lappend cpoints [list 0 0] + lappend cpoints [list $north_x $north_y] + foreach p $cpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + set rpoints { } + set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} } + foreach p $hpoints { + # Break out the position. + set sx [lindex $p [expr "($transpose > 0) ? 1 : 0"]] + set sy [lindex $p [expr "($transpose > 0) ? 0 : 1"]] + + # Do the rotation of the head at the origin. + set rx [expr ($north_x + ($sx * $coso + $sy * $sino))] + set ry [expr ($north_y - ($sx * $sino + $sy * $coso))] + + lappend rpoints [list $rx $ry] + } + foreach p $rpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy + 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + set lpoints { } + lappend lpoints [list [expr "$east_x-0.2"] $east_y ] + lappend lpoints [list $north_x [expr "$north_y+0.2"] ] + foreach p $lpoints { + # Get the scaled position. + set sx [expr ($scale * [lindex $p [expr "($transpose > 0) ? 1 : 0"]])] + set sy [expr ($scale * [lindex $p [expr "($transpose > 0) ? 0 : 1"]])] + + # Translate to the scaled position. + set rx [expr int($pcx + $sx + 0.5)] + set ry [expr int($pcy - $sy - 0.5)] + + # Now handle the axis flip. + set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)] + set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)] + lappend pts $rx $ry + } + + + # Draw the compass axes. + set compassPts [lrange $pts 0 5] + send imagewin setColorIndex $compassColor + send imagewin drawPolyline $compassPts + + + # Draw the compass pointer. + set head [lrange $pts 6 13] + send imagewin setFillType solid + send imagewin drawPolygon $head + + # Draw the labels. + send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab + send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab + + send imagewin setLogRes $sv_xl $sv_yl + + set redraw_compass 0 + +} ; foreach w {xflip yflip} { send $w addCallback drawCompass } + + +# This is a kludge to redraw the compass after it is erased when displaying +# a new image. Once the user moves the mouse back into the main window we'll +# do the redraw. +send imagewin addEventHandler drawCompass enterWindowMask + + + +proc createCompassMarker { pts args } \ +{ + set cm_points { } + lappend cm_points [lrange $pts 0 1] + lappend cm_points [lrange $pts 2 3] + lappend cm_points [lrange $pts 4 5] + + print [list $cm_points] + +} + + +proc eraseCompass args \ +{ + global panner_mapping + send imagewin refreshMapping $panner_mapping +} + +proc toggleCompass { widget type state args } \ +{ + global last_compass + + if {$state} { + drawCompass + set last_compass True + } else { + eraseCompass + set last_compass False + } +} ; send compass addCallback toggleCompass + + + + +################################################################################ +# RULER MARKERS +################################################################################ + +set rulerX 0 ;# ruler start in screen coords +set rulerY 0 +set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices +set rulerList { } ;# ruler list + +set rulerSticky { } ;# list of sticky rulers +set isSticky "Sticky" ;# menu label + +set rulerWCS 0 ;# use WCS coords +set rulerXWCS 0 ;# ruler start in WCS units +set rulerYWCS 0 +set rulerXWCS2 0 ;# ruler end in WCS units +set rulerYWCS2 0 +set rulerFmt pixel ;# ruler label format + + +# Translations when pointer is inside marker. +set rulerTranslations { \ + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>b: call(prevFrame,$name) + !Ctrl <Key>f: call(nextFrame,$name) + !Ctrl <Key>h: call(move_cursor,-1,0) + !Ctrl <Key>j: call(move_cursor,0,1) + !Ctrl <Key>k: call(move_cursor,0,-1) + !Ctrl <Key>l: call(move_cursor,1,0) + !Ctrl <Key>n: call(normalize) + !Ctrl <Key>c: call(cpZoomAction,centerFrame) + !Ctrl <Key>i: call(cpInvert) + !Ctrl <Key>m: call(cpMatchFrames) + !Ctrl <Key>r: call(cpRegisterFrames) + !Ctrl <Key>p: call(togglePanner) + !Alt <Key>1: call(cpSetFrame,frame1) + !Alt <Key>2: call(cpSetFrame,frame2) + !Alt <Key>3: call(cpSetFrame,frame3) + !Alt <Key>4: call(cpSetFrame,frame4) + !Ctrl <Key>1: call(cpZoom,1,1,fixed) + !Ctrl <Key>2: call(cpZoom,2,2,fixed) + !Ctrl <Key>3: call(cpZoom,3,3,fixed) + !Ctrl <Key>4: call(cpZoom,4,4,fixed) + !Ctrl <Key>5: call(cpZoom,5,5,fixed) + !Ctrl <Key>6: call(cpZoom,6,6,fixed) + !Ctrl <Key>7: call(cpZoom,7,7,fixed) + !Ctrl <Key>8: call(cpZoom,8,8,fixed) + !Ctrl <Key>9: call(cpZoom,9,9,fixed) + <Key>BackSpace: call(deleteNamedRuler,NAME,$x,$y) + <Key>Delete: call(deleteNamedRuler,NAME,$x,$y) + <KeyPress>: m_input() + <Btn3Down>: call(setRulerMenu) popup(rulerMenu) + <Btn3Up>: popdown(rulerMenu) +!Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0) + !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) + <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) +} + + + +# Popup menu in effect when inside marker. +set rulerMenuDescription { + { "Ruler" f.title } + { f.dblline } + { "$isSticky" f.exec { + toggleSticky $ruler + } } + { f.line } + { "Units" f.menu rulerUnits } + { "Color" f.menu rulerColor } + { f.line } + { "Draw into Frame" f.exec { + writeRuler $ruler + } sensitive False } + { f.line } + { "Destroy" f.exec { + scan $ruler "ruler%d" num + deleteNamedRuler $num x y + } } +} ; createMenu rulerMenu imagewin $rulerMenuDescription + +set rulerUnitsDescription { + { Units f.title } + { f.dblline } + { "Pixels" f.exec { setUnits $ruler pixel } } + { "Arc Seconds" f.exec { setUnits $ruler arcsec + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Arc Minutes" f.exec { setUnits $ruler arcmin + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } + { "Degrees" f.exec { setUnits $ruler degrees + } sensitive { ($rulerWCS > 0) ? "True" : "False"} } +} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription + +set rulerColorDescription { + { Color f.title } + { f.dblline } + { "" f.exec "r_setColor $ruler black yellow" + bitmap solid foreground black } + { "" f.exec "r_setColor $ruler white black" + bitmap solid foreground white } + { "" f.exec "r_setColor $ruler red yellow" + bitmap solid foreground red } + { "" f.exec "r_setColor $ruler green black" + bitmap solid foreground green } + { "" f.exec "r_setColor $ruler blue white" + bitmap solid foreground blue } + { "" f.exec "r_setColor $ruler magenta black" + bitmap solid foreground magenta } + { "" f.exec "r_setColor $ruler cyan black" + bitmap solid foreground cyan } + { "" f.exec "r_setColor $ruler yellow black" + bitmap solid foreground yellow } +} ; createMenu rulerColor rulerMenu $rulerColorDescription + + +proc makeRuler {parent x y} \ +{ + global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS + global rulerPts rulerX rulerY rulerList + global isSticky rulerMenuDescription rulerUnitsDescription + global coord coordLab + + + incr ruleno ; set ruler ruler$ruleno + + # Substitute so the marker translation will delete the marker + # by it's number rather than the default parent widget name. + regsub -all NAME $rulerTranslations $ruleno translations + + # Create the polygon for the marker. + send $parent createMarker $ruler \ + type polygon\ + createMode noninteractive\ + translations $translations\ + lineColor yellow\ + fill False\ + highlightWidth 1\ + highlightColor yellow\ + knotSize 0\ + activated True\ + visible False\ + sensitive True\ + x $x\ + y $y + + # Define a callback so we can identify the ruler. + send $ruler addCallback selectRuler focusIn focusOut + + # Create the text markers for the labels. + send $parent set markerTextFont 6x9 + makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch + makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch + send $parent set markerTextFont 6x13 + + set rulerX $x ;# save the reference point + set rulerY $y + + set ref [ list $x $y ] ;# initialize the polygon + set rx [ list [expr "$x +1"] $y ] + set ry [ list $x [expr "$y +1"] ] + set rulerPts [list $ref $rx $ry ] + + send $ruler setVertices $rulerPts ;# set attributes + send $ruler set visible True" + send $ruler setAttribute autoRedraw True + + # See whether we have a WCS to use. + set rulerWCS 0 + set rulerXWCS 0 + set rulerYWCS 0 + for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} { + if { [info exists coordLab(wcs$num)] } { + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + if {$xl==" ra" || $xl=="elon" || $xl=="glon" || $xl=="slon"} { + set rulerWCS $num + set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + } + } + } + + # Edit the menus. + set isSticky "Sticky" + editMenu rulerMenu imagewin $rulerMenuDescription + editMenu rulerUnits imagewin $rulerUnitsDescription + + + lappend rulerList $ruleno +} + +proc wcs2log { val label fmt} \ +{ + set newval $val + if {$fmt == "sexigesimal" || $fmt == "default"} { + scan $val "%d:%d:%f" h m s + set newval [expr "double($h) + double($m) / 60.0 + double($s) / 3600.0"] + if {$label == " ra"} { + set newval [expr "double($newval * 15.0)"] + } + } + return [expr "double($newval)" ] +} + + +proc resizeRuler {x y redraw} \ +{ + global rulerPts rulerX rulerY ruleno coord coordLab + global rulerWCS rulerXWCS rulerYWCS rulerFmt + global rulerXWCS2 rulerYWCS2 + + + # Track the mouse. + set ref [ list $rulerX $rulerY ] + set rx [ list $x $rulerY ] + set ry [ list $x $y ] + set rulerPts [list $ref $rx $ry ] + + # Compute the distances. + if {$rulerWCS > 0} { + set num $rulerWCS + set xl [string tolower [lindex $coordLab(wcs$num) 0]] + set yl [string tolower [lindex $coordLab(wcs$num) 1]] + set fmt [string tolower [send fmtWcs$num get label] ] + + # Save the cursor coords in WCS so we can convert labels. + if {$redraw} { + set nx $rulerXWCS2 + set ny $rulerYWCS2 + } else { + set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt] + set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt] + set rulerXWCS2 $nx + set rulerYWCS2 $ny + } + } + + if {$rulerFmt == "pixel"} { + set xdist [ expr "abs($x - $rulerX)" ] + set ydist [ expr "abs($y - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } else { + set xdist [ expr "abs($nx - $rulerXWCS)" ] + set ydist [ expr "abs($ny - $rulerYWCS)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + } + + # Redraw the polygon. + send ruler$ruleno setVertices $rulerPts + + # Label the distances. + setXRulerLabel $x $y $xdist + setYRulerLabel $x $y $ydist + setHRulerLabel $x $y $hdist +} + +# Create a label marker for the ruler. +proc makeLabelMarker { parent name width height } \ +{ + send $parent createMarker $name \ + type text \ + createMode noninteractive \ + width $width \ + height $height \ + lineWidth 0 \ + imageText true \ + textBgColor yellow \ + textColor black \ + activated true \ + visible false +} + +proc setXRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpXscale rulerFmt + + send rulerXlab$ruleno set visible False + + if {[expr "abs($cx - $rulerX)"] > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerXlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cy > $rulerY} { + set yp [expr "$rulerY - 14"] + } else { + set yp [expr "$rulerY + 2"] + } + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - 10"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - 10"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerXlab$ruleno "setAttributes x $xp y $yp" + send rulerXlab$ruleno "set text \{$text\}; redraw erase" + + send rulerXlab$ruleno set visible True + } +} + +proc setYRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale rulerFmt + + send rulerYlab$ruleno set visible False + + if {[expr "abs($cy - $rulerY)"] > 20} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpYscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerYlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$cx + 2"] + } else { + set xp [expr "$cx - $len * 6 - 5"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerYlab$ruleno "setAttributes x $xp y $yp" + send rulerYlab$ruleno "set text \{$text\}; redraw erase" + send rulerYlab$ruleno set visible True + } +} + +proc setHRulerLabel { cx cy dist } \ +{ + global rulerX rulerY ruleno winWidth winHeight + global cpYscale cpXscale rulerFmt + + send rulerHlab$ruleno set visible False + + set xdist [ expr "abs($cx - $rulerX)" ] + set ydist [ expr "abs($cy - $rulerY)" ] + set hdist [ expr "sqrt($xdist * $xdist + $ydist * $ydist)" ] + + if {$hdist > 30} { + switch $rulerFmt { + pixel { set text [format "%.1f" [expr "$dist / $cpXscale"] ] } + arcsec { set text [format "%.2f\"" [expr "$dist * 3600.0"] ] } + arcmin { set text [format "%.2f\'" [expr "$dist * 60.0"] ] } + degrees { set text [format "%.2fd" "$dist" ] } + } + set len [expr [string length $text] + 1] + send rulerHlab$ruleno "set width ${len}ch" + + # Compute the placement of the label marker. + if {$cx > $rulerX} { + set xp [expr "$rulerX + abs($cx - $rulerX)/2 - $len * 6"] + } else { + set xp [expr "$rulerX - abs($cx - $rulerX)/2 - $len * 3"] + } + if {$cy > $rulerY} { + set yp [expr "$rulerY + abs($cy - $rulerY)/2"] + } else { + set yp [expr "$rulerY - abs($cy - $rulerY)/2"] + } + + # Bounds checking. + if {$xp < 0} { set xp 1 } + if {$yp < 0} { set yp 1 } + if {$xp > $winWidth} { set xp [expr "$winWidth - 20" } + if {$yp > $winHeight} { set yp [expr "$winHeight - 20" } + + send rulerHlab$ruleno "setAttributes x $xp y $yp" + send rulerHlab$ruleno "set text \{$text\}; redraw erase" + send rulerHlab$ruleno set visible True + } else { + send rulerHlab$ruleno set visible False + } +} + + +# Callback executed when a marker gets or loses the focus. +proc selectRuler {active_ruler event event_data} \ +{ + global ruler + switch $event { + focusIn { set ruler $active_ruler } + focusOut { } + } +} + +# Reset the ruler format type. +proc setUnits { ruler units } \ +{ + global rulerFmt rulerX rulerY + + send $ruler getVertices pts + set rulerX [lindex [lindex [lindex $pts 0] 0] 0] + set rulerY [lindex [lindex [lindex $pts 0] 0] 1] + set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1 + set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1 + + set rulerFmt $units + resizeRuler $cx $cy 1 +} + +# Menu option toggle callbacks. +proc toggleSticky { ruler } \ +{ + global isSticky rulerSticky rulerMenuDescription + + set index [ lsearch $rulerSticky $ruler] + if { $index >= 0 } { + # Remove it from the list. + set rulerSticky [lreplace $rulerSticky $index $index] + set isSticky "Sticky" + } else { + # Add it to the list. + lappend rulerSticky $ruler + set isSticky "UnSticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + +proc setRulerMenu args \ +{ + global ruler isSticky rulerSticky rulerMenuDescription + + if { [lsearch $rulerSticky $ruler] >= 0 } { + set isSticky "UnSticky" + } else { + set isSticky "Sticky" + } + editMenu rulerMenu imagewin $rulerMenuDescription +} + + +# Draw the ruler to the frame buffer as a graphic. +proc writeRuler { ruler } \ +{ +} + +# Change the color of the ruler. +proc r_setColor {ruler bgcolor fgcolor} { + + # Recolor the polygon. + send $ruler \ + "markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw" + + # Recolor the labels. + scan $ruler "ruler%d" num + send rulerXlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerYlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" + send rulerHlab$num \ + "markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw" +} + + +# Delete the current ruler, called when we have a Btn1Up on the current ruler. +proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y } + +# Delete all rulers on the screen, usually called when the view changes. +# We preserve the rulers marked as 'sticky'. +proc deleteAllRulers args \ +{ + global rulerList rulerSticky + + foreach r $rulerList { + # Delete the ruler if it's not in the sticky list. + if { [lsearch $rulerSticky ruler$r] == -1 } { + deleteNamedRuler $r x y + } + } +} + +# Delete a particular ruler, usually called from the translation table on +# the marker itself. +proc deleteNamedRuler {name x y} \ +{ + global rulerList + + catch { + send ruler$name destroy + send rulerXlab$name destroy + send rulerYlab$name destroy + send rulerHlab$name destroy + } + + # Remove the ruler from the list. + set index [lsearch $rulerList $name] + set rulerList [lreplace $rulerList $index $index] +} + + + + + +############################################### +# Define procedure for the help panel +############################################### + +# Help Panel Bitmaps +#------------------- +createBitmap iraf_logo 45 45 { +0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, +0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff, +0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff, +0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff, +0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff, +0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff, +0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff, +0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff, +0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff, +0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff, +0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff, +0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff, +0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe, +0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc, +0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8, +0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8, +0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0, +0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7, +0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo "set bitmap iraf_logo" + +createBitmap noao_logo 45 45 { +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, +0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, +0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, +0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, +0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, +0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, +0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, +0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, +0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, +0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, +0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, +0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, +0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, +0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, +0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo "set bitmap noao_logo" + +send helpInfo1 set label $version + +# Stuff for keeping track of visited anchors. +set links { 0 } +set linkIndex 0 +set visited(0) empty + +proc Help args \ +{ + global help_up + if {$help_up == 0} { + send client help + } else { + send help_panel unmap + set help_up 0 + } +} + +proc helpPanel args \ +{ + global help_up + if {$help_up} { + send help_panel unmap + set help_up 0 + } else { + send help_panel map + set help_up 1 + } +} + +proc panelHelp args \ +{ + Help +} ; send panelHelp addCallback panelHelp + +proc helpQuit args \ +{ + global help_up + send help_panel unmap + set help_up 0 +}; send helpClose addCallback helpQuit + +proc getHelpText { param old new } \ +{ + send helpText setText $new + helpPanel +}; send help addCallback getHelpText + +proc anchorSelected {widget cbtype event text href args} \ +{ + global visited links linkIndex + set anchID [send helpText anchorToId $href] + set visited($href) 1 + if {$linkIndex == 0} { + send helpBack setSensitive True + if {[lindex $links 1] != $anchID} { + set links { 0 } + send helpForward setSensitive False + } + } + if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} { + set links [lrange $links 0 $linkIndex] + } + if {[lindex $links [expr $linkIndex + 1]] != $anchID} { + lappend links $anchID + incr linkIndex + } else { + send helpForward setSensitive False + incr linkIndex + } + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + } + send helpText gotoId $anchID + send helpText retestAnchors +}; send helpText addCallback anchorSelected anchor + +proc testAnchor {widget cbtype href} \ +{ + global visited + return [info exists visited($href)] +}; send helpText addCallback testAnchor testAnchor + + +# Callbacks to position forwards and backwards in link list. +proc hlpForward args \ +{ + global links linkIndex + incr linkIndex + if {$linkIndex <= [llength $links]} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == [expr [llength $links] - 1]} { + send helpForward setSensitive False + send helpBack setSensitive True + } else { + send helpBack setSensitive True + } + } else { + incr linkIndex -1 + } +}; send helpForward addCallback hlpForward + +proc hlpBack args \ +{ + global links linkIndex + incr linkIndex -1 + if {$linkIndex >= 0} { + set anchID [lindex $links $linkIndex] + send helpText gotoId $anchID + send helpText retestAnchors + if {$linkIndex == 0} { send helpBack setSensitive False } + if {$linkIndex >= 0} { send helpForward setSensitive True } + } else { + incr linkIndex 1 + } +}; send helpBack addCallback hlpBack + +proc hlpHome args \ +{ + global links linkIndex + set links { 0 } + set linkIndex 0 + send helpText gotoId 0 + send helpForward setSensitive False + send helpBack setSensitive False +}; send helpHome addCallback hlpHome + + +proc helpFind args \ +{ + set phrase [send hfEntry get string] + + if { $phrase != "" } { + if {[send helpText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send helpText gotoId $id + send helpText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind } + +send hfClear addCallback { send hfEntry set string "" } + + +################################################################################ +# Header Display Callbacks. +################################################################################ + +set hdrImage "" +set hdrImageId "" +set hdrKeywords "*" + + +proc fitsHdrClose args \ +{ + global hdr_up + + send hdr_panel unmap + send imageHeader set on False + set hdr_up 0 +} ; send hdrClose addCallback fitsHdrClose + +proc ptFitsHeader {widget type state args} \ +{ + global hdr_up + + set hdr_up $state + if {$hdr_up == 1} { + send imageHeader set on True + send hdr_panel map + } else { + send imageHeader set on False + send hdr_panel unmap + } +}; send imageHeader addCallback ptFitsHeader + +proc getHeader { name id } \ +{ + global hdrImage hdrImageId hdrKeywords + + set hdrImage $name + set hdrImageId $id + send hdrObjMenu set label $name + send hdrText setText "" + send hdrIGText set string "" + send hdrKGText set string "" + + catch { send wcspix objinfo $hdrImageId $hdrKeywords } +} + +proc hdrKeywFilter args \ +{ + global hdrImageId hdrKeywords + + set str [ send hFindEntry get string ] + if {$str != ""} { + set hdrKeywords $str + send hdrText setText "" + catch { send wcspix objinfo $hdrImageId $hdrKeywords } + } +} ; send hdrFilter addCallback hdrKeywFilter + + +# Set the image menu in the header panel. +proc setHdrObjMenu { frame args } \ +{ + global frameCache ism_enable + + if {! $ism_enable} \ + return + + # Create the menu of images for the header panel. + set items { } + foreach i [list $frameCache($frame)] { + set l [lindex $i 0] + set lid [lindex $i 1] + regsub -all {[\[]} $l "\\\[" l2 + catch { + lappend items [format "%s f.exec \{getHeader %s %d\}" $l $l2 $lid] + } + } + editMenu objMenu hdrObjMenu $items +} + + +# Search box for the header. +proc hdrFind args \ +{ + set phrase [send hFindEntry get string] + + if { $phrase != "" } { + if {[send hdrText searchText $phrase start end forward caseless] > 0} { + set elid [lindex [lindex $start 0] 0] + set id [max 1 [expr $elid - 10] ] + send hdrText gotoId $id + send hdrText setSelection $start $end + } else { + send warnText set label "Search string not found." + send warning map + } + } else { + send warnText set label "Warning: No search phrase entered." + send warning map + } +} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind } + +send hdrClear addCallback { send hFindEntry set string "" } + + +################################################################################ +# Pixel Table Callbacks. +################################################################################ + +set psize 5 +set pixtab_up 0 +set hdr_up 0 + +createMenu pixtabMenu pixtabSize { + { "3x3" f.exec { pixtabSetSize 3 } } + { "5x5" f.exec { pixtabSetSize 5 } } + { "7x7" f.exec { pixtabSetSize 7 } } + { "9x9" f.exec { pixtabSetSize 9 } } +} + + +proc updatePixelTable { cx cy wx wy args } \ +{ + global psize pixtab_up ism_enable + + if {! $pixtab_up} \ + return + if {$ism_enable} \ + return + + set delta [expr int($psize / 2) ] + set x1 [expr ($wx - $delta) ] + set x2 [expr ($wx + $delta) ] + set y1 [expr ($wy - $delta) ] + set y2 [expr ($wy + $delta) ] + set c [ expr int($psize / 2) ] + + + # Update the table labels. + set x $x1 ; set xl {} + set y $y2 ; set yl {} + for {set i 0} {$i < $psize} {incr i} { + lappend xl [format " %10.1f " $x] ; set x [ expr ($x + 1.) ] + lappend yl [format " %10.1f " $y] ; set y [ expr ($y - 1.) ] + } + send ptColLabs setList $xl ; send ptColLabs highlight $c + send ptRowLabs setList $yl ; send ptRowLabs highlight $c + + # Update the pixel table itself. + #set pix [ send client getPixels $cx $cy $psize True ] + + set x0 [ expr int($cx - $psize / 2. + 0.5)] + set y0 [ expr int($cy - $psize / 2. + 0.5)] + set pix [ send client getPixels $x0 $y0 $psize $psize ] + send pixtab setList [ lrange $pix 4 end ] + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Update the pixtab stats. + set sum 0.0 + set sum2 0.0 + set npix [ expr ($psize * $psize) ] + set nend [ expr ($psize * $psize) + 4 ] + for {set i 4} {$i < $nend} {incr i} { + set val [lindex $pix $i] + catch { + set sum [ expr ($sum + $val) ] + set sum2 [ expr ($sum2 + $val * $val) ] + } + } + + set mean [ expr ($sum / ($npix * 1.0)) ] + set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ] + if {$var <= 0.0} { + set stdev 0.0 + } else { + set stdev [ expr sqrt ($var) ] + } + send meanValue set label [ format "%10.2f" $mean ] + send sigValue set label [ format "%10.4f" $stdev ] +} + + +proc pixtabClose args \ +{ + global pixtab_up + + send pixel_panel unmap + send pixelTable set on False + set pixtab_up 0 + catch { send wcspix set psize 0 } +} ; send pixtabClose addCallback pixtabClose + + +proc pixtabSetSize { size args } \ +{ + global psize ism_enable + + set c [ expr int(($psize * $psize) / 2) ] + send pixtab highlight $c + + # Now reset the window size. + switch $size { + 3 { send pixel_panel "resize 265 175" + send pixtab "set width 180 ; set height 60" + } + 5 { send pixel_panel "resize 375 215" + send pixtab "set width 290 ; set height 105" + } + 7 { send pixel_panel "resize 495 265" + send pixtab "set width 410 ; set height 150" + } + 9 { send pixel_panel "resize 610 310" + send pixtab "set width 525 ; set height 195" + } + } + + send pixtab set defaultColumns $size + send ptColLabs set defaultColumns $size + set psize $size + + # Notify the ISM we've changed size. + if ($ism_enable) { + catch { send wcspix set psize $psize } + } + + send imagewin getCursorPos xc yc + updatePixelTable $xc $yc $xc $yc + +} ; pixtabSetSize $psize + + +proc ptPixelTable {widget type state args} \ +{ + global pixtab_up psize + + set pixtab_up $state + if {$pixtab_up == 1} { + send pixelTable set on True + send pixel_panel map + catch { send wcspix set psize $psize } + } else { + send pixelTable set on False + send pixel_panel unmap + catch { send wcspix set psize 0 } + } +}; send pixelTable addCallback ptPixelTable + + +################################################################################ +# Warning dialog. This pops up a dialog box with the given warning message, +# and executes the given command if the user pushes OK. +# +# Usage: Wexec object message [ok_action [cancel_action]] +# +# The message text is displayed in a popup and the user hits the ok or +# cancel button to close the popup. If an action has been posted for the +# button selected then it is sent to the named object. Only one alert can +# be in effect at a time; posting another alert before the first has +# completed causes the new alert to override the first. +################################################################################ + +set W_object "" +set W_ok_cmd "" +set W_cancel_cmd "" + +proc Wexec {object msg args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + set W_object $object + set W_ok_cmd [lindex $args 0] + set W_cancel_cmd [lindex $args 1] + send warnText set label $msg + send warning map +} + +proc Wbutton {widget args} \ +{ + global W_object W_ok_cmd W_cancel_cmd + switch $widget { + warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd } + } + warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd } + } + } + send warning unmap +} +send warnOk addCallback Wbutton +send warnCancel addCallback Wbutton + +# The parameter "alert" is used to forward alerts from the client. +proc setAlert {param old new} \ +{ + Wexec client [lindex $new 0] [lindex $new 1] +}; send alert addCallback setAlert + + + +################################################ +# Define some TCL debug procedures. +################################################ + +set tcl_up 0 + +proc tclCommandClear {widget args} { send tclEntry set string "" } +proc tclCommandExecute {widget args} { send server [send tclEntry {get string}] +} +proc tclCommand {widget mode command args} { send server $command } +proc tclClose {widget args} { tclPanel } +proc tclOpen args \ +{ + global tcl_up + send tcl_panel map + set tcl_up 1 +} + +proc tclPanel args \ +{ + global tcl_up + if {$tcl_up} { + send tcl_panel unmap + set tcl_up 0 + } else { + send tcl_panel map + set tcl_up 1 + } +} + +send tclClear addCallback tclCommandClear +send tclExecute addCallback tclCommandExecute +send tclEntry addCallback tclCommand +send tclDismiss addCallback tclClose + + + +################################################ +# ISM Module support routines. +################################################ + + +# Turn the ISM on or off. +proc ismToggle { widget type state args } \ +{ + global ism_enable ism_capable psize + + set ism_enable $state + + # Set the coord-panel header option availability. + if {$ism_enable == 1 && $ism_capable} { + send imageHeader setSensitive True + send woptBPM setSensitive True + catch { send client ism_start wcspix } + } else { + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + catch { send client ism_stop wcspix } + send hdr_panel unmap + } + setCoordPanelSensitivity + +} ; send ismToggle addCallback ismToggle + + + +# Handle messages from ISM clients and pass them on to the appropiate +# callback. + +proc ism_msg { param old new } \ +{ + global ism_enable + + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + source { source [lindex $new 1] } + alert { Wexec client [lindex $new 1] } + deliver { ${ism}_msg $argc $argv } + info { ism_info $ism } + } +} ; send ism_msg addCallback ism_msg + + + +# Log a client message to the info panel +set ismInfoText " " + +proc ism_info { text } \ +{ + global infoMode ismInfoText + + set ismInfoText [format "%s\n%s" $ismInfoText $text] + if {$infoMode == "infoOptIsm"} { + send infoText set string $ismInfoText + } +} + +# Initialize the text. +proc ismInitInfoText args \ +{ + global ismInfoText + + set ismInfoText "" + ism_info "\t ISM Client Message Logs" + ism_info "\t -----------------------" + ism_info " " +} ; ismInitInfoText + + + +################################################ +# WPIX module support routines. +################################################ + +set cur_objid 0 +set cur_regid 0 +set redraw_compass 0 +#set Compass(0) { 0.0 1 1 0 X Y } +set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y } +set Orient(0) { 1 1 1 } + +set wcspix_debug 0 + +proc wcspix_msg { argc argv } \ +{ + global wcspix_debug + + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + + if {$wcspix_debug} { print "wcspix_msg: $cmd" } + + + switch $cmd { + startup { wcspix_startup } + shutdown { wcspix_shutdown } + disable { wcspix_disable } + capable { wcspix_capable } + + cache { wcspix_cache [lrange $arg 1 end] } + uncache { wcspix_uncache [lrange $arg 1 end] } + wcstran { wcspix_wcstran [lrange $arg 1 end] } + wcslist { wcspix_wcslist [lrange $arg 1 end] } + + imghdr { send hdrText \ + setText [format "<pre>%s\n%s</pre>" \ + [string trimright [send hdrText getText simple] "\n"]\ + [lindex $arg 1] ] + } + wcshdr { send hdrKGText append [lindex $arg 1] } + + wcsinfo { send hdrIGText append [lindex $arg 1] + send hdrText gotoId 0 + send hdrKGText set insertPosition 0 + } + + compass { wcspix_compass [lrange $arg 1 end] ; drawCompass } + orient { wcspix_orient [lrange $arg 1 end] } + wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] } + wcsfmt { set num [lindex $arg 2] + send fmtWcs$num set label [lindex $arg 1] } + + wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] } + + pixtab { set tab [lindex [lindex $arg 1] 0] + set col [lindex [lindex $arg 1] 1] + set row [lindex [lindex $arg 1] 2] + set stat [lindex [lindex $arg 1] 3] + wcspix_pixtab $tab $col $row $stat + } + } +} + + +# Startup and initialize the wcspix module with the GUI state. +proc wcspix_startup args \ +{ + global ism_enable frame + global up_todo psize pixtab_up frameCache + + set ism_enable 1 + send ismToggle set on True + send imageHeader setSensitive True + send woptBPM setSensitive True + setCoordPanelSensitivity + ismInitInfoText + + if {$up_todo < 3} { + resizeCoordsBox $up_todo + } + updateCoordsBox + drawCompass + + # Initialize the frame cache. + foreach c [array names frameCache] { + if {$c != "0"} { unset frameCache($c) } + } + + catch { + if {$pixtab_up} { send wcspix set psize $psize } + for {set i 1} {$i <= 4} {incr i} { + send wcspix set wcs [send sysWcs$i get label] $i + send wcspix set format [send fmtWcs$i get label] $i + } + } + + if { [send infoOptClients get on] } { + send client info clients + } +} + +# Shutdown the WPIX module. +proc wcspix_shutdown args \ +{ + global ism_enable frame + + set ism_enable 0 + send ismToggle set on False + send imageHeader setSensitive False + send woptBPM set on False + send woptBPM setSensitive False + setCoordPanelSensitivity + setCoordPanelHeight + + wcsFmtIValue "N/A" + wcsFmtBValue "0" + + resizeCoordsBox 0 + drawCompass + + if { [send infoOptClients get on] } { + send client info clients + } +} + + +# Disable the WPIX module. We are only called when a display client has +# indicated it doesn't use the new mapping facilities and having the WPIX +# ISM visible will only confuse the user. + +proc wcspix_disable args \ +{ + global ism_enable ism_capable rulerWCS + + if {$ism_enable} { + send wcspix quit + } + set ism_capable 0 + set rulerWCS 0 + wcspix_shutdown + send ismToggle setSensitive False +} + + +# Client connected is capable of using the ISM, but don't necessarily turn +# it on at this point. + +proc wcspix_capable args \ +{ + global ism_capable + + set ism_capable 1 + wcsFmtIValue "0" + wcsFmtBValue "0" + send ismToggle setSensitive True +} + + +# Cache an image in the GUI. +proc wcspix_cache { argv } \ +{ + global frameCache redraw_compass cur_objid + + set name [lindex $argv 0] + set frame [lindex $argv 1] + set id [lindex $argv 2] + + # Store the image name and id in a local cache. + lappend frameCache($frame) $name $id + send hdrObjMenu set label $name + + # Automatically get the header. + regsub -all {[\[]} $name "\\\[" image + catch { getHeader $image $id } + + setHdrObjMenu $frame + + set cur_objid $id + set redraw_compass 1 +} + +# Uncache an image in the GUI. +proc wcspix_uncache { argv } \ +{ + global frameCache Compass + + set id [lindex $argv 0] + foreach c [array names frameCache] { + set i1 0 + set i2 1 + set new { } + while { $i2 < [llength $frameCache($c)] } { + if {[lindex $frameCache($c) $i2] != $id} { + lappend new [lindex $frameCache($c) $i1] + lappend new [lindex $frameCache($c) $i2] + } + incr i1 2 + incr i2 2 + } + set frameCache($c) $new + } + if [info exists Compass($id)] { + unset Compass($id) + } +} + +# Format the results of the WCSTRAN method. +proc wcspix_wcstran { argv } \ +{ + global frameCache cur_objid cur_regid redraw_compass + + set objid [ lindex [lindex $argv 0] 1] + set regid [ lindex [lindex $argv 1] 1] + set pixval [ lindex [lindex $argv 2] 1] + set bpmval [ lindex [lindex $argv 3] 1] + + wcsFmtIValue $pixval + wcsFmtBValue $bpmval + + set args [lrange $argv 4 end] + set nargs [llength $args] + for {set i 0} {$i < 4} {incr i} { + set coord [lindex $args $i] + set wcsname [lindex $coord 1] + set xval [lindex $coord 2] + set yval [lindex $coord 3] + set xunits [lindex $coord 4] + set yunits [lindex $coord 5] + wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits + } + + set cur_objid $objid + set cur_regid $regid + + if {$redraw_compass} \ + drawCompass +} + +# Save the object compass information. +proc wcspix_compass { argv } \ +{ + global Compass + + set objid [lindex $argv 0] + set angle [lindex $argv 1] + + #set xflip [lindex $argv 2] + #set yflip [lindex $argv 3] + #set transpose [lindex $argv 4] + #set xlab [lindex $argv 5] + #set ylab [lindex $argv 6] + + set north_x [lindex $argv 2] + set north_y [lindex $argv 3] + set east_x [lindex $argv 4] + set east_y [lindex $argv 5] + set transpose [lindex $argv 6] + set xlab [lindex $argv 7] + set ylab [lindex $argv 8] + + #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab + #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab] + set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \ + $transpose $xlab $ylab] + drawCompass +} + +# Save the image display orientation information. +proc wcspix_orient { argv } \ +{ + global Orient + + set objid [lindex $argv 0] + set frame [lindex $argv 1] + set xflip [lindex $argv 2] + set yflip [lindex $argv 3] + + set Orient($objid) [list $frame $xflip $yflip] +} + + +# Handle the list of WCSs available for the current image. +proc wcspix_wcslist { argv } \ +{ + set wcslist [lindex $argv 0] + + for {set i 1} {$i <= 4} {incr i} { + set items {} + foreach nam $wcslist { + if {[string tolower $nam] == "line"} { + lappend items "f.dblline" + } else { + lappend items "\"$nam\" f.exec \{setWcsSys $nam $i\}" + } + } + editMenu sysMenu$i sysWcs$i $items + } +} + +# Set the type of the WCS. +proc wcspix_wcstype { label num } \ +{ + global up_todo + + send sysWcs$num set label $label + if {[string tolower $label] == "none"} { + send wpWcs$num "set on False ; setSensitive False" + send wiWcs$num "set on False ; setSensitive False" + send fmtWcs$num setSensitive False + set hght 4 + } else { + send wpWcs$num "set on True ; setSensitive True" + send wiWcs$num setSensitive True + send fmtWcs$num setSensitive True + set hght 17 + } + send wtWcs$num set height $hght + setCoordPanelHeight + + #resizeCoordsBox $up_todo + updateCoordsBox +} + +# Display the pixel table. +proc wcspix_pixtab { tab col row stat } \ +{ + global psize + + # Update the pixel table. + send pixtab setList [lindex $tab 1] + send pixtab highlight [expr int(($psize * $psize) / 2)] + + # Update the table labels. + set c [ expr int($psize / 2) ] + send ptColLabs setList $col ; send ptColLabs highlight $c + send ptRowLabs setList $row ; send ptRowLabs highlight $c + + # Update the pixtab stats. + send meanValue set label [ format "%10.2f" [lindex $stat 0] ] + send sigValue set label [ format "%10.4f" [lindex $stat 1] ] +} + + + + +################################################################################ +# +# XIMTOOL-ALT -- Procedures and declarations for the ALT GUI. +# +################################################################################ + +# Creat the bitmaps needed for the alternate optional bars. + +createBitmap tools 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf, + 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap control 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xe3, 0xc7, 0xe3, 0xcf, 0x33, 0xcc, + 0x33, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x33, 0xcc, 0xf3, 0xcf, + 0xe3, 0xc7, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff}; + +createBitmap tile 16 16 { + 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, + 0x83, 0xc1, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff}; + +createBitmap compass 16 16 { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x80, 0x0f, 0xc0, 0x1f, 0x00, 0x07, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0xfc, 0x07, + 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00} + +createBitmap plus 11 11 { + 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00}; + +createBitmap minus 11 11 { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, + 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +createBitmap disk 16 16 { + 0xfe,0x1f,0x11,0x25,0x11,0x45,0x11,0x44,0xf1,0x47,0x01,0x40,0x01,0x40,0xf9, + 0x4f,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0xff,0x7f, + 0x00,0x00}; + +createBitmap printer 32 16 { + 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x12, 0x00, + 0x00, 0x02, 0x22, 0x00, 0x00, 0x02, 0x3e, 0x00, 0x00, 0x02, 0x20, 0x00, + 0x00, 0x02, 0x20, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0x10, 0x03, 0xe0, 0x06, + 0x08, 0xff, 0x7f, 0x09, 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, + 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x08, + 0xf8, 0xff, 0xff, 0x0f}; + + +send tbBlinkDec "set bitmap larrow" ;# Assign the bitmaps to the buttons. +send tbBlinkInc "set bitmap rarrow" +send tbZoomIn "set bitmap plus" +send tbZoomOut "set bitmap minus" +send tbTile "set bitmap tile" +send tbCompass "set bitmap compass; addCallback toggleCompass" +#send helpButton "set bitmap qmark; addCallback Help" +send mXflipButton "set bitmap xflip; addCallback xflip" +send mYflipButton "set bitmap yflip; addCallback yflip" +send mNextButton "set bitmap rarrow; addCallback nextFrame" +send mPrevButton "set bitmap larrow; addCallback prevFrame" + + +# toolBox -- Toggle the toolbox and panelbar display. + +set toolbox_up [ true $showToolBar ] +set panelbar_up [ true $showPanelBar ] + +proc toolBoxToggle args \ +{ + global toolbox_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$toolbox_up} { + send toolbar set height 0 + send toolButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w; set height $nh" + set toolbox_up 0 + send mXflipButton map + send mYflipButton map + send mPrevButton map + send mFrameButton map + send mNextButton map + } else { + send toolbar set height 25 + send toolButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set toolbox_up 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap + } +} + +proc panelBarToggle args \ +{ + global panelbar_up + + set w [send display get width] ; set h [send display get height] + set iw [send imagewin get width] ; set ih [send imagewin get height] + + if {$panelbar_up} { + send panelbar set height 0 + send panelButton set state 0 + send imagewin "set width $iw; set height $ih" + set nh [expr $h - 25] + send display "set width $w ; set height $nh" + set panelbar_up 0 + } else { + send panelbar set height 25 + send panelButton set state 1 + send imagewin "set width $iw; set height $ih" + set nh [expr $h + 25] + send display "set width $w ; set height $nh" + set panelbar_up 1 + } +} + + + +# Initialize the bars to be displayed if the resource was set. + +send toolButton "set bitmap tools; addCallback toolBoxToggle" +if { ! [ true $showToolBar ] } { + send display set height [expr [send display get height] - 25] + send toolbar set height 0 + send toolButton set state 0 +} else { + send toolButton set state 1 + send mXflipButton unmap + send mYflipButton unmap + send mPrevButton unmap + send mFrameButton unmap + send mNextButton unmap +} + +send panelButton "deleteCallback panel" +send panelButton "set bitmap control; addCallback panelBarToggle" + +if { ! [ true $showPanelBar ] } { + send display set height [expr [send display get height] - 25] + send panelbar set height 0 + send panelButton set state 0 +} else { + send panelButton set state 1 +} + + +############################################## +# Panelbar callbacks. +############################################## + +send pbQuit addCallback Quit +send helpClose addCallback "send helpButton set state 0" + + +# Control Panel. +#------------------------------------------------------ +proc pbToggleControl {name element op} \ +{ + upvar $name panel_up + send pbDisplayP set state [expr !($panel_up)] +} ; #trace variable panel_up w pbToggleControl + +proc pbResetPanel {param old new} \ +{ + global displayPanner displayMagnifier displayCoords + switch $new { + done { send pbPanM set state [true $displayPanner] + send pbMagM set state [true $displayMagnifier] + send pbWcsM set state [true $displayCoords] + } + } +} ; send initialize addCallback pbResetPanel + +set WidgetToTab(pbDisplayP) display_panel +set WidgetToTab(pbInfoP) info_panel +set WidgetToTab(pbLoadP) load_panel +set WidgetToTab(pbPrintP) print_panel +set WidgetToTab(pbSaveP) save_panel +set WidgetToTab(pbTileP) tile_panel +set WidgetToTab(pbCoordP) wcs_panel + +set TabToWidget(display_panel) pbDisplayP +set TabToWidget(print_panel) pbPrintP +set TabToWidget(load_panel) pbLoadP +set TabToWidget(save_panel) pbSaveP +set TabToWidget(info_panel) pbInfoP +set TabToWidget(tile_panel) pbTileP +set TabToWidget(wcs_panel) pbCoordP + +set pbTabTop "pbDisplayP" + +proc pbPanelDismiss args \ +{ + global tabTop TabToWidget WidgetToTab + set panel $TabToWidget($tabTop) + send $panel set state 0 +} ; send panelClose addCallback pbPanelDismiss + +proc pbResizeCB {widget event a b c d e args} \ +{ + global pbTabTop TabToWidget WidgetToTab + if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } { + send $pbTabTop set state 0 + set new $TabToWidget($widget) + send $new set state 1 + set pbTabTop $new + } +} ; foreach w $cpTabs {send $w addEventHandler pbResizeCB exposureMask} + +proc pbPanelTabs { widget type state args } \ +{ + global pbTabTop tabTop panel_up + global TabToWidget WidgetToTab + + set panel $WidgetToTab($widget) + if {$tabTop == $panel && $panel_up} { + send panelShell unmap + send $widget set state 0 + set panel_up 0 + return + } + + send $TabToWidget($tabTop) set state 0 + set tabTop $panel + set pbTabTop $TabToWidget($panel) + send panelTabs setTop $panel + + # Now fire it up if it's not already open. + if {$panel_up == 0} { + send $widget set state 1 + send panelShell map + set panel_up 1 + } +} +foreach w { pbDisplayP pbInfoP pbLoadP pbPrintP pbSaveP pbTileP pbCoordP } { + send $w addCallback pbPanelTabs +} + + + +# Load Panel. (Really need to clean this up.) +#------------------------------------------------------ +proc pbDoLoadOptions { param old new } \ +{ + set val [ join [lrange $new 1 end] " " ] + switch [lindex $new 0] { + newfile { send fnameText set string $val } + } +} ; send loadOptions addCallback pbDoLoadOptions + +proc pbFileLoad { widget mode fname args } \ +{ + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + send imagewin setCursorType idle +} ; send fnameText addCallback pbFileLoad + +proc pbflSelectPrint {widget cbtype selections args} \ +{ + foreach selection $selections { + ; + } +}; #send imageList addCallback pbflSelectPrint + +proc pbFileLoadB args \ +{ + set fname [send fnameText get string] + if {$fname != ""} { + set fpath [format "%s/%s" \ + [string range [send dirLabel get label] 12 end] $fname ] + } +} ; send filesLoadButton addCallback pbFileLoadB + + +# Panner Marker. +#------------------------------------------------------ +proc pbTracePanner {name element op} \ +{ + global last_compass + + catch { + upvar $name panner_enable + send pbPanM set state $panner_enable + + if { $panner_enable } { + send tbCompass "setSensitive True ; set state $last_compass" + drawCompass + } else { + send tbCompass "setSensitive False ; set state False" + eraseCompass + } + } +} ; trace variable panner_enable w pbTracePanner + +proc pannerPanel args \ +{ + global panner_enable displayPanner + + setPanner [expr !$panner_enable] + send pannerButton set on [expr $panner_enable] +}; send pbPanM addCallback pannerPanel + + +# Magnifier Marker. +#------------------------------------------------------ +proc pbTraceMagnifier {name element op} \ +{ + upvar $name magnifier_enable + send pbMagM set state $magnifier_enable +} ; trace variable magnifier_enable w pbTraceMagnifier + +proc magnifierPanel args \ +{ + global magnifier_enable displayMagnifier + setMagnifier [expr !$magnifier_enable] + send magnifierButton set on [expr $magnifier_enable] +}; send pbMagM addCallback magnifierPanel + + +# CoordsBox Marker. +#------------------------------------------------------ +proc pbTraceCoordsBox {name element op} \ +{ + upvar $name track_enable + send pbWcsM set state $track_enable +} ; trace variable track_enable w pbTraceCoordsBox + +proc wcsPanel args \ +{ + global track_enable + setTrack [expr !$track_enable] +}; send pbWcsM addCallback wcsPanel + + + +# WPIX ISM Callbacks. +#------------------------------------------------------ + +proc altIsmToggle { widget type state args } \ +{ + ismToggle pbIsm junk $state +} ; send pbIsm addCallback altIsmToggle + +proc pbTraceIsm {name element op} \ +{ + upvar $name ism_enable + send pbIsm set state $ism_enable +} ; trace variable ism_enable w pbTraceIsm + + +proc altIsmMsgCB { param old new } \ +{ + set cmd [lindex $new 0] ;# command name + set ism [lindex $new 1] ;# determine ISM name + set argv [lrange $new 2 end] ;# get args + set argc [llength $argv] + + switch $cmd { + deliver { ${ism}_alt_msg $argc $argv } + } +} ; send ism_msg addCallback altIsmMsgCB + + +proc wcspix_alt_msg { argc argv } \ +{ + set arg [string trimleft [ string trimright [lindex $argv 0] ] ] + set cmd [lindex $arg 0] + switch $cmd { + startup { } + shutdown { } + disable { send pbIsm "set state False ; setSensitive False" } + capable { send pbIsm "setSensitive True" } + } +} + + + +############################################## +# Toolbar callbacks. +############################################## + +send tbNormalize addCallback normalize +send tbInvert addCallback cpInvert +send tbRegister addCallback cpRegisterFrames +send tbMatchLUT addCallback cpMatchFrames + + +# Frame Selection. +#------------------ +createMenu mFrameMenu mFrameButton $frameMenuDescription + +proc altFrameChanged {param old new} \ +{ + send mFrameButton set label $new +} ; send frame addCallback altFrameChanged + + +# Image Flipping. +#------------------------------------------------------ +proc tbSetFlip {param old new} \ +{ + if {$param == "xflip"} { + send mXflipButton set state [true $new] + } else { + send mYflipButton set state [true $new] + } +}; foreach i {xflip yflip} { send $i addCallback tbSetFlip } + + +# Zoom/Pan buttons. +#------------------------------------------------------ +proc tbZoomAction { widget args } \ +{ + global frameWidth frameHeight + + switch $widget { + tbZoom0 { cpZoom 1 1 fixed } + tbZoomIn { cpZoom 2.0 2.0 relative } + tbZoomOut { cpZoom 0.5 0.5 relative } + tbCenter { send client pan [expr $frameWidth/2.0] [expr $frameHeight/2.0] } + } +} +foreach widget { tbCenter tbZoomIn tbZoom0 tbZoomOut } { + send $widget addCallback tbZoomAction +} + + +# Frame Blink. +#------------------------------------------------------ +proc tbSetBlinkRate {w args} \ +{ + if {$w == "tbBlinkInc"} { + cpSetBlinkRate BRincrease + } else { + cpSetBlinkRate BRdeccrease + } +} +foreach w {tbBlinkDec tbBlinkInc} { send $w addCallback tbSetBlinkRate } + +proc tbBlink { widget args } \ +{ + global blinkRate blinkId + + if {$blinkRate < 0.01} { + send tbBlink set state 0 + } else { + if {$widget != "tbBlink"} { + if {($blinkId != 0) != [send $widget get on]} { + toggleBlink + } + } else { + if {($blinkId != 0) != [send $widget get state]} { + toggleBlink + } + } + } +} ; send tbBlink addCallback tbBlink + +proc tbTraceBlink {name element op} \ +{ + upvar $name blinkId + send tbBlink set state [expr $blinkId != 0] +} ; trace variable blinkId w tbTraceBlink + + +# Auto-register. +#------------------------------------------------------ +proc tbAutoRegister { widget type state args } \ +{ + send tbAutoReg set state $state +} +foreach w {autoregButton brAregButton tbAutoReg} { + send $w addCallback cpAutoRegister +} + +proc tbToggleAutoReg args \ +{ + global auto_reg + if {$auto_reg} { + cpAutoRegister autoregButton dummy 0 + set auto_reg 0 + send tbAutoReg set state 0 + } else { + cpAutoRegister autoregButton dummy 1 + set auto_reg 1 + send tbAutoReg set state 1 + } +} + + +# Frame Tiles. +#------------------------------------------------------ +proc tbSetTileFrames args \ +{ + global tileOpt + + # Send the option to the client. + if {[send tbTile get state ]} { + if {$tileOpt == 0} { + # If mode is disabled, turn on the tile selection. + selectTileOrientation junk junk Best + } else { + # Otherwise, turn on in current mode. + selectTileOrientation junk junk [tileSelToLabel $tileOpt] + } + } else { + selectTileOrientation junk junk Disabled + } +}; send tbTile addCallback tbSetTileFrames + +proc tbTrackTileFrames {param old new} \ +{ + send tileFramesButton set on [true $new] + send tbTile set state $new +}; send tileFrames addCallback tbTrackTileFrames + +proc tbTileFramesToggle args \ +{ + set value [send tileFramesButton get on] + if {$value} { set not 0 } else { set not 1 } + + send tileFramesButton set on $not + send tbTile set state $not + cpSetTileFrames tbTile junk $not +} + + +# Compass Indicator. +#------------------------------------------------------ +proc tbToggleCompass { widget type state args } \ +{ + global frame + + if {$state} { + send compass set on True + send tbCompass set state 1 + drawCompass + } else { + send compass set on False + send tbCompass set state 0 + eraseCompass + } +} ; foreach w {compass tbCompass} { send $w addCallback tbToggleCompass } + + diff --git a/vendor/x11iraf/ximtool/ximtool.gui.h b/vendor/x11iraf/ximtool/ximtool.gui.h new file mode 100644 index 00000000..dcda45e8 --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.gui.h @@ -0,0 +1,11567 @@ +"#!/usr/local/bin/obmsh", +"#", +"# XIMTOOL-ALT.GUI -- Default GUI for the Ximtool-alt image display server.", +"#", +"# Version 2.0 -- BETA VERSION", +"", +"set Version \"NOAO/IRAF XImtool Version 2.0BETA\"", +"", +"reset-server", +"", +"set Objects(ximtool) { \\", +" toplevel Layout display\\", +"\\", +" display Group menuGroup\\", +" menuGroup Layout menubar\\", +" menubar MenuButton fileButton\\", +" menubar MenuButton viewButton\\", +" menubar MenuButton optionsButton\\", +" menubar Label imageTitle\\", +" menubar Toggle mXflipButton\\", +" menubar Toggle mYflipButton\\", +" menubar Command mPrevButton\\", +" menubar MenuButton mFrameButton\\", +" menubar Command mNextButton\\", +" menubar Toggle toolButton\\", +" menubar Toggle panelButton\\", +"\\", +" display Layout toolbar\\", +" toolbar Command tbZoomIn\\", +" toolbar Command tbZoom0\\", +" toolbar Command tbZoomOut\\", +" toolbar Command tbInvert\\", +" toolbar Command tbNormalize\\", +" toolbar Command tbMatchLUT\\", +" toolbar Toggle tbAutoReg\\", +" toolbar Command tbRegister\\", +" toolbar Command tbCenter\\", +" toolbar Command tbBlinkDec\\", +" toolbar Toggle tbBlink\\", +" toolbar Command tbBlinkInc\\", +" toolbar Toggle xflipButton\\", +" toolbar Toggle yflipButton\\", +" toolbar Toggle tbTile\\", +" toolbar Toggle tbCompass\\", +" toolbar Command prevButton\\", +" toolbar MenuButton frameButton\\", +" toolbar Command nextButton\\", +"\\", +" display Frame imageFrame\\", +" imageFrame Gterm imagewin\\", +" display Frame cbarFrame\\", +" cbarFrame Gterm colorbar\\", +" display Toggle hcut\\", +" display Toggle vcut\\", +" display Frame hcutFrame\\", +" hcutFrame Gterm hcutPlot\\", +" display Frame vcutFrame\\", +" vcutFrame Gterm vcutPlot\\", +" display Slider2d focusSlider\\", +"\\", +" display Group plotOpts\\", +" plotOpts Layout poptsLayout\\", +" poptsLayout TextToggle plotSpeed\\", +" poptsLayout TextToggle plotAccurate\\", +" poptsLayout TextToggle plotImgPix\\", +" poptsLayout Frame optLine\\", +" poptsLayout TextToggle curJump\\", +" poptsLayout TextToggle curSmooth\\", +" poptsLayout TextToggle curTrack\\", +"\\", +" display Layout panelbar\\", +" panelbar Toggle pbDisplayP\\", +" panelbar Toggle pbLoadP\\", +" panelbar Toggle pbSaveP\\", +" panelbar Toggle pbPrintP\\", +" panelbar Toggle pbInfoP\\", +" panelbar Toggle pbTileP\\", +" panelbar Toggle pbCoordP\\", +" panelbar Toggle pbPanM\\", +" panelbar Toggle pbMagM\\", +" panelbar Toggle pbWcsM\\", +" panelbar Toggle pbIsm\\", +" panelbar Toggle helpButton\\", +" panelbar Command pbQuit\\", +"}", +"", +"", +"set Objects(panelShell) { \\", +" toplevel TopLevelShell panelShell\\", +" panelShell Layout panel\\", +"\\", +" panel Frame panelMenuFrame\\", +" panelMenuFrame Layout panelMenuBar\\", +" panelMenuBar Command panelHelp\\", +" panelMenuBar Command panelClose\\", +"\\", +" panel Frame tabFrame\\", +" tabFrame Tabs panelTabs\\", +" panelTabs Frame display_panel\\", +" panelTabs Frame print_panel\\", +" panelTabs Frame load_panel\\", +" panelTabs Frame save_panel\\", +" panelTabs Frame info_panel\\", +" panelTabs Frame tile_panel\\", +" panelTabs Frame wcs_panel\\", +"\\", +"\\", +" display_panel Layout controlPanel\\", +" controlPanel Group viewBox\\", +" controlPanel Group enhancementBox\\", +" controlPanel Group blinkBox\\", +" controlPanel Group optionsBox\\", +" controlPanel Frame controlBox\\", +"\\", +" viewBox Layout view\\", +" view Group frameSelect\\", +" frameSelect Layout frameBox\\", +" frameBox Box frlistBox\\", +" frlistBox Viewport framePort\\", +" framePort Layout frameList\\", +" frameList TextToggle frame1\\", +" frameList TextToggle frame2\\", +" frameList TextToggle frame3\\", +" frameList TextToggle frame4\\", +" frameList TextToggle frame5\\", +" frameList TextToggle frame6\\", +" frameList TextToggle frame7\\", +" frameList TextToggle frame8\\", +" frameList TextToggle frame9\\", +" frameList TextToggle frame10\\", +" frameList TextToggle frame11\\", +" frameList TextToggle frame12\\", +" frameList TextToggle frame13\\", +" frameList TextToggle frame14\\", +" frameList TextToggle frame15\\", +" frameList TextToggle frame16\\", +" frameBox Command prevFrame\\", +" frameBox Command nextFrame\\", +" view Frame frameDataBox\\", +" frameDataBox TextBox frameData\\", +" view Group zoomBox\\", +" zoomBox Layout zoom\\", +" zoom TextButton toggleZoom\\", +" zoom TextButton zoomIn\\", +" zoom Command x1\\", +" zoom Command z2\\", +" zoom Command z3\\", +" zoom Command z4\\", +" zoom Command z5\\", +" zoom Command z8\\", +" zoom TextButton zoomOut\\", +" zoom TextButton centerFrame\\", +" zoom Command d2\\", +" zoom Command d3\\", +" zoom Command d4\\", +" zoom Command d5\\", +" zoom Command d8\\", +" view Layout viewButtons\\", +" viewButtons Command aspect\\", +" viewButtons Command flipX\\", +" viewButtons Command flipY\\", +" viewButtons Command flipXY\\", +" viewButtons Command clearFrame\\", +" viewButtons Command fitFrame\\", +"\\", +" enhancementBox Layout enhance\\", +" enhance Frame colorlistFrame\\", +" colorlistFrame Viewport colorlistView\\", +" colorlistView MultiList colorlist\\", +" enhance Frame colordataFrame\\", +" colordataFrame TextBox colordata\\", +" enhance Label contrastLabel\\", +" enhance Slider2d contrastSlider\\", +" enhance Label brightnessLabel\\", +" enhance Slider2d brightnessSlider\\", +" enhance Command invertButton\\", +" enhance Command optimizeButton\\", +"\\", +" blinkBox Layout blink\\", +" blink Label blinkFramesLabel\\", +" blink Command blinkFrame1\\", +" blink Command blinkFrame2\\", +" blink Command blinkFrame3\\", +" blink Command blinkFrame4\\", +" blink Toggle blinkPanel\\", +" blink Command blinkReset\\", +" blink Label blinkRateLabel\\", +" blink Frame BRframe\\", +" BRframe Layout BRlayout\\", +" BRlayout Arrow BRdecrease\\", +" BRlayout TextBox BRtext\\", +" BRlayout Arrow BRincrease\\", +" blink Command registerButton\\", +" blink Command matchButton\\", +" blink TextToggle blinkButton\\", +" blink TextToggle autoregButton\\", +"\\", +" optionsBox TextToggle pannerButton\\", +" optionsBox TextToggle magnifierButton\\", +" optionsBox TextToggle coordsBoxButton\\", +" optionsBox TextToggle autoscaleButton\\", +" optionsBox TextToggle antialiasButton\\", +" optionsBox TextToggle tileFramesButton\\", +" optionsBox TextToggle warningsButton\\", +" optionsBox TextToggle peakupButton\\", +"\\", +" controlBox Layout control\\", +" control Command initializeButton\\", +" control Command normalizeButton\\", +"\\", +"\\", +" print_panel Layout printLayout\\", +"\\", +" printLayout Group printCmdGroup\\", +" printLayout Group optGroup\\", +" printLayout Group cmdGroup\\", +"\\", +" printCmdGroup Layout printCmdLayout\\", +" printCmdLayout Layout labelLayout\\", +" labelLayout Label toLabel\\", +" labelLayout Label printerLabel\\", +" printCmdLayout Layout inputLayout\\", +" inputLayout TextToggle toPrinter\\", +" inputLayout TextToggle toFile\\", +" inputLayout Frame printcmdFrame\\", +" printcmdFrame AsciiText printcmd\\", +"\\", +" optGroup Layout optLayout\\", +" optLayout Group epsPageGroup\\", +" optLayout Group optionsGroup\\", +" optLayout Group printColorGroup\\", +" optLayout Group printerGroup\\", +" optLayout Group annOptsGroup\\", +"\\", +" epsPageGroup Layout epsPage\\", +" epsPage Label epsOrientLabel\\", +" epsPage TextToggle epsPortButton\\", +" epsPage TextToggle epsLandButton\\", +" epsPage TextToggle epsSquareButton\\", +" epsPage Label epsSizeLabel\\", +" epsPage TextToggle epsLetterButton\\", +" epsPage TextToggle epsLegalButton\\", +" epsPage TextToggle epsA4Button\\", +" epsPage TextToggle epsB5Button\\", +" epsPage Label epsScaleLabel\\", +" epsPage Frame ScaleFrame\\", +" ScaleFrame Layout ScaleLayout\\", +" ScaleLayout Arrow SCdecrease\\", +" ScaleLayout TextBox SCtext\\", +" ScaleLayout Arrow SCincrease\\", +"\\", +" optionsGroup Layout options\\", +" options TextToggle epsscaleButton\\", +" options TextToggle autorotateButton\\", +" options TextToggle aspectButton\\", +" options TextToggle compressButton\\", +"\\", +" annOptsGroup Layout annOpts\\", +" annOpts TextToggle annotateButton\\", +" annOpts TextToggle colorbarButton\\", +" annOpts TextToggle titleButton\\", +" annOpts TextToggle bordersButton\\", +" annOpts Label titleLabel\\", +" annOpts Frame titleFrame\\", +" titleFrame AsciiText titleString\\", +"\\", +" printColorGroup Layout printColor\\", +" printColor TextToggle prGrayButton\\", +" printColor TextToggle prPseudoButton\\", +" printColor TextToggle prRGBButton\\", +"\\", +" printerGroup Layout printers\\", +" printers Frame printlistFrame\\", +" printlistFrame Viewport printlistView\\", +" printlistView MultiList printlist\\", +"\\", +" cmdGroup Layout cmdLayout\\", +" cmdLayout Command okayPrint\\", +" cmdLayout Label printStatus\\", +"\\", +"\\", +" load_panel Layout filesLayout\\", +" filesLayout Group imlistGroup\\", +" imlistGroup Layout imlistLayout\\", +" imlistLayout Command rootButton\\", +" imlistLayout Command homeButton\\", +" imlistLayout Command upButton\\", +" imlistLayout Command rescanButton\\", +" imlistLayout Label dirLabel\\", +" imlistLayout Label fnameLabel\\", +" imlistLayout Frame filnamFrame\\", +" filnamFrame AsciiText fnameText\\", +" imlistLayout Label imtemplateLabel\\", +" imlistLayout Frame imtemplateFrame\\", +" imtemplateFrame AsciiText imtemplateText\\", +" imlistLayout Label imlistLabel\\", +" imlistLayout Frame imlistFrame\\", +" imlistFrame Viewport imlistView\\", +" imlistView MultiList imageList\\", +"\\", +" filesLayout Group imoptsGroup\\", +" imoptsGroup Layout imoptsLayout\\", +" imoptsLayout TextToggle grayscale\\", +" imoptsLayout TextToggle autoload\\", +" imoptsLayout TextToggle browseHdrs\\", +" imoptsLayout TextToggle zscale\\", +" imoptsLayout TextToggle zrange\\", +" imoptsLayout Label z1Label\\", +" imoptsLayout Frame z1Frame\\", +" z1Frame AsciiText z1Value\\", +" imoptsLayout Label z2Label\\", +" imoptsLayout Frame z2Frame\\", +" z2Frame AsciiText z2Value\\", +" imoptsLayout Label nsampLabel\\", +" imoptsLayout Frame nsampFrame\\", +" nsampFrame AsciiText nsampValue\\", +" imoptsLayout Label frameLabel\\", +" imoptsLayout MenuButton frameFrame\\", +"\\", +" filesLayout Group loadCmdGroup\\", +" loadCmdGroup Layout loadCmdLayout\\", +" loadCmdLayout Command filesLoadButton\\", +" loadCmdLayout Label filesStatus\\", +"\\", +"\\", +" save_panel Layout saveLayout\\", +" saveLayout Group saveNameGroup\\", +" saveNameGroup Layout saveNameLayout\\", +" saveNameLayout Label saveLabel\\", +" saveNameLayout Frame fnameFrame\\", +" fnameFrame AsciiText saveFile\\", +"\\", +" saveLayout Group saveOptGroup\\", +" saveOptGroup Layout saveOptLayout\\", +" saveOptLayout Group fmtGroup\\", +" saveOptLayout Group saveColorGroup\\", +" saveOptLayout Frame saveDataBox\\", +" saveDataBox TextBox saveData\\", +"\\", +" fmtGroup Layout formats\\", +" formats TextToggle rasButton\\", +" formats TextToggle gifButton\\", +" formats TextToggle jpegButton\\", +" formats TextToggle tiffButton\\", +" formats TextToggle fitsButton\\", +" formats TextToggle epsButton\\", +" formats TextToggle x11Button\\", +" formats TextToggle rawButton\\", +"\\", +" saveColorGroup Layout saveColor\\", +" saveColor TextToggle svGrayButton\\", +" saveColor TextToggle svPseudoButton\\", +" saveColor TextToggle svRGBButton\\", +"\\", +" saveLayout Group saveCmdGroup\\", +" saveCmdGroup Layout saveCmdLayout\\", +" saveCmdLayout Command okaySave\\", +" saveCmdLayout Label saveStatus\\", +"\\", +"\\", +" info_panel Layout infoLayout\\", +" infoLayout Group infoBox\\", +" infoBox Layout infoBoxL\\", +" infoBoxL Frame infoFrame\\", +" infoFrame AsciiText infoText\\", +" infoBoxL TextToggle infoOptFr\\", +" infoBoxL TextToggle infoOptWCS\\", +" infoBoxL TextToggle infoOptSvr\\", +" infoBoxL TextToggle infoOptClients\\", +" infoBoxL TextToggle infoOptIsm\\", +" infoBoxL TextToggle infoOptFB\\", +"\\", +"\\", +" wcs_panel Layout wcsLayout\\", +" wcsLayout Group wcsGroup\\", +" wcsGroup Layout wcsBox\\", +"\\", +" wcsBox Frame wcsFrame\\", +" wcsFrame Layout wcsText\\", +" wcsText AsciiText wtName\\", +" wcsText AsciiText wtTitle\\", +" wcsText AsciiText wtFBCfg\\", +" wcsText AsciiText wtIPixval\\", +" wcsText AsciiText wtSPixval\\", +" wcsText AsciiText wtBPixval\\", +" wcsText AsciiText wtWcs1\\", +" wcsText AsciiText wtWcs2\\", +" wcsText AsciiText wtWcs3\\", +" wcsText AsciiText wtWcs4\\", +"\\", +" wcsBox TextToggle ismToggle\\", +" wcsBox TextToggle pixelTable\\", +" wcsBox TextToggle imageHeader\\", +" wcsBox TextToggle compass\\", +" wcsBox TextToggle wcsOptions\\", +"\\", +"\\", +" wcsLayout Group wcsOptGroup\\", +" wcsOptGroup Layout wcsOptLayout\\", +"\\", +" wcsOptLayout Group wcsCoords\\", +" wcsCoords Layout wcLayout\\", +" wcLayout Label wcTitle\\", +" wcLayout Frame wcLine\\", +" wcLayout Label wlWcs1\\", +" wcLayout Label wlWcs2\\", +" wcLayout Label wlWcs3\\", +" wcLayout Label wlWcs4\\", +" wcLayout MenuButton sysWcs1\\", +" wcLayout MenuButton sysWcs2\\", +" wcLayout MenuButton sysWcs3\\", +" wcLayout MenuButton sysWcs4\\", +" wcLayout MenuButton fmtWcs1\\", +" wcLayout MenuButton fmtWcs2\\", +" wcLayout MenuButton fmtWcs3\\", +" wcLayout MenuButton fmtWcs4\\", +" wcLayout TextToggle wpWcs1\\", +" wcLayout TextToggle wpWcs2\\", +" wcLayout TextToggle wpWcs3\\", +" wcLayout TextToggle wpWcs4\\", +" wcLayout TextToggle wiWcs1\\", +" wcLayout TextToggle wiWcs2\\", +" wcLayout TextToggle wiWcs3\\", +" wcLayout TextToggle wiWcs4\\", +"\\", +" wcsOptLayout Group wcsOpts\\", +" wcsOpts Layout woLayout\\", +" woLayout TextToggle woptLabels\\", +" woLayout TextToggle woptTitles\\", +" woLayout TextToggle woptFBinfo\\", +" woLayout TextToggle woptBPM\\", +"\\", +" wcsOptLayout Group wcsIsmGroup\\", +" wcsIsmGroup Layout wcsIsmLayout\\", +" wcsIsmLayout Label wcsIsmLabel\\", +" wcsIsmLayout Frame wcsIsmFrame\\", +" wcsIsmFrame AsciiText wcsIsmCmd\\", +" wcsIsmLayout Command wcsIsmInit\\", +"\\", +"\\", +" tile_panel Frame tileOpts\\", +" tileOpts Layout toptLayout\\", +" toptLayout Group tFramesG\\", +" toptLayout Group tileMode\\", +" tileMode TextToggle tileDisabled\\", +" tileMode TextToggle tileManual\\", +" tileMode TextToggle tileBest\\", +" tileMode TextToggle tileSquare\\", +" tileMode TextToggle tileHorizontal\\", +" tileMode TextToggle tileVertical\\", +" tileMode TextToggle tileRow\\", +" tileMode TextToggle tileCol\\", +" toptLayout Group userOrientG\\", +" toptLayout Group fillStyle\\", +" fillStyle TextToggle byCols\\", +" fillStyle TextToggle bottomUp\\", +" toptLayout Group tileLabel\\", +" tileLabel TextToggle labelImname\\", +" tileLabel TextToggle labelTitles\\", +" tileLabel TextToggle labelFrames\\", +" toptLayout Frame geomFrame\\", +" geomFrame Label tileGeometry\\", +"\\", +" userOrientG Layout userOrientL\\", +" userOrientL Label nrowLab\\", +" userOrientL Frame nrFrame\\", +" nrFrame Layout nrLayout\\", +" nrLayout Arrow nrdecrease\\", +" nrLayout Label nrtext\\", +" nrLayout Arrow nrincrease\\", +" userOrientL Label ncolLab\\", +" userOrientL Frame ncFrame\\", +" ncFrame Layout ncLayout\\", +" ncLayout Arrow ncdecrease\\", +" ncLayout Label nctext\\", +" ncLayout Arrow ncincrease\\", +"\\", +" tFramesG Layout tFrames\\", +" tFrames Command tAll\\", +" tFrames Command tNone\\", +" tFrames Toggle tFrame1\\", +" tFrames Toggle tFrame2\\", +" tFrames Toggle tFrame3\\", +" tFrames Toggle tFrame4\\", +" tFrames Toggle tFrame5\\", +" tFrames Toggle tFrame6\\", +" tFrames Toggle tFrame7\\", +" tFrames Toggle tFrame8\\", +" tFrames Toggle tFrame9\\", +" tFrames Toggle tFrame10\\", +" tFrames Toggle tFrame11\\", +" tFrames Toggle tFrame12\\", +" tFrames Toggle tFrame13\\", +" tFrames Toggle tFrame14\\", +" tFrames Toggle tFrame15\\", +" tFrames Toggle tFrame16\\", +"}", +"", +"", +"set Objects(parameters) { \\", +" toplevel Parameter ximtool\\", +" ximtool Parameter alert\\", +" ximtool Parameter initialize\\", +" ximtool Parameter resize\\", +" ximtool Parameter frame\\", +" ximtool Parameter nframes\\", +" ximtool Parameter frameSize\\", +" ximtool Parameter frameRegion\\", +" ximtool Parameter frameView\\", +" ximtool Parameter frameTitle\\", +" ximtool Parameter frameFit\\", +" ximtool Parameter enhancement\\", +" ximtool Parameter colortables\\", +" ximtool Parameter cmfocus\\", +" ximtool Parameter autoscale\\", +" ximtool Parameter antialias\\", +" ximtool Parameter tileFrames\\", +" ximtool Parameter cursorMode\\", +" ximtool Parameter xflip\\", +" ximtool Parameter yflip\\", +" ximtool Parameter printerList\\", +" ximtool Parameter printOptions\\", +" ximtool Parameter loadOptions\\", +" ximtool Parameter saveOptions\\", +" ximtool Parameter tileOptions\\", +" ximtool Parameter filelist\\", +" ximtool Parameter help\\", +" ximtool Parameter info\\", +" ximtool Parameter ism_msg\\", +"}", +"", +"", +"set Objects(help_panel) { \\", +" toplevel TopLevelShell help_panel\\", +" help_panel Layout helpLayout\\", +" helpLayout Group helpMenuGroup\\", +" helpMenuGroup Layout helpMenubar\\", +" helpLayout Layout helpInfoLayout\\", +"\\", +" helpMenubar Command helpClose\\", +"\\", +" helpLayout Command helpBack\\", +" helpLayout Command helpForward\\", +" helpLayout Command helpHome\\", +" helpLayout Frame hfFrame\\", +" hfFrame AsciiText hfEntry\\", +" helpLayout Command hfFind\\", +" helpLayout Command hfClear\\", +" helpLayout Frame helpTextFrame\\", +" helpTextFrame HTML helpText\\", +"\\", +" helpInfoLayout Label helpIRAFLogo\\", +" helpInfoLayout Label helpInfo1\\", +" helpInfoLayout Label helpInfo2\\", +" helpInfoLayout Label helpInfo3\\", +" helpInfoLayout Label helpNOAOLogo\\", +"}", +"", +"", +"set Objects(blink_panel) { \\", +" toplevel TopLevelShell blink_panel\\", +" blink_panel Layout bpLayout\\", +"\\", +" bpLayout Frame brMenuFrame\\", +" brMenuFrame Layout brMenuBar\\", +" brMenuBar Command brClose\\", +"\\", +" bpLayout Frame brFrame\\", +" brFrame Layout brLayout\\", +"\\", +" brLayout Group brFramesG\\", +" brFramesG Layout brFrames\\", +" brFrames MenuButton brFrame1\\", +" brFrames MenuButton brFrame2\\", +" brFrames MenuButton brFrame3\\", +" brFrames MenuButton brFrame4\\", +" brFrames MenuButton brFrame5\\", +" brFrames MenuButton brFrame6\\", +" brFrames MenuButton brFrame7\\", +" brFrames MenuButton brFrame8\\", +" brFrames MenuButton brFrame9\\", +" brFrames MenuButton brFrame10\\", +" brFrames MenuButton brFrame11\\", +" brFrames MenuButton brFrame12\\", +" brFrames MenuButton brFrame13\\", +" brFrames MenuButton brFrame14\\", +" brFrames MenuButton brFrame15\\", +" brFrames MenuButton brFrame16\\", +"\\", +" brLayout Group brCmdG\\", +" brCmdG Layout brCmd\\", +" brCmd Command brReset\\", +" brCmd Label brRateLabel\\", +" brCmd Frame brBRframe\\", +" brBRframe Layout brBRlayout\\", +" brBRlayout Arrow brBRdecrease\\", +" brBRlayout TextBox brBRtext\\", +" brBRlayout Arrow brBRincrease\\", +" brCmd Command brRegButton\\", +" brCmd Command brMatchButton\\", +" brCmd TextToggle brBlinkButton\\", +" brCmd TextToggle brAregButton\\", +"}", +"", +"", +"set Objects(hdr_panel) { \\", +" toplevel TopLevelShell hdr_panel\\", +" hdr_panel Layout hdrLayout\\", +"\\", +" hdrLayout Frame hdrMenuFrame\\", +" hdrMenuFrame Layout hdrMenuBar\\", +" hdrMenuBar Command hdrClose\\", +"\\", +" hdrLayout Group hdrObjGroup\\", +" hdrObjGroup Layout hdrObjLayout\\", +" hdrObjLayout Label hdrObjLabel\\", +" hdrObjLayout MenuButton hdrObjMenu\\", +"\\", +" hdrLayout Frame hdrTabFrame\\", +" hdrTabFrame Tabs hdrTabs\\", +" hdrTabs Group hdrHdrGroup\\", +" hdrTabs Group hdrWcsGroup\\", +"\\", +" hdrHdrGroup Layout hdrHdrLayout\\", +" hdrHdrLayout Frame hFindFrame\\", +" hFindFrame AsciiText hFindEntry\\", +" hdrHdrLayout Command hdrFilter\\", +" hdrHdrLayout Command hdrFind\\", +" hdrHdrLayout Command hdrClear\\", +" hdrHdrLayout HTML hdrText\\", +"\\", +" hdrWcsGroup Layout hdrWcsLayout\\", +" hdrWcsLayout Group hdrInfoGroup\\", +" hdrInfoGroup Frame hdrIGFrame\\", +" hdrIGFrame AsciiText hdrIGText\\", +" hdrWcsLayout Group hdrKeywGroup\\", +" hdrKeywGroup Frame hdrKGFrame\\", +" hdrKGFrame AsciiText hdrKGText\\", +"}", +"", +"", +"set Objects(pixel_table) { \\", +" toplevel TopLevelShell pixel_panel\\", +"\\", +" pixel_panel Layout pixel_table\\", +" pixel_table Frame pixtabMenuFrame\\", +" pixtabMenuFrame Layout pixtabMenuBar\\", +" pixtabMenuBar MenuButton pixtabSize\\", +" pixtabMenuBar Command pixtabHelp\\", +" pixtabMenuBar Command pixtabClose\\", +"\\", +" pixel_table Frame pixtabFrame\\", +" pixtabFrame Porthole ptPort\\", +" ptPort Layout ptLayout\\", +" ptLayout Frame ptColFrame\\", +" ptColFrame MultiList ptColLabs\\", +" ptLayout Frame ptRowFrame\\", +" ptRowFrame MultiList ptRowLabs\\", +" ptLayout Frame ptFrame\\", +" ptFrame MultiList pixtab\\", +"\\", +" ptLayout Label meanLabel\\", +" ptLayout Frame meanFrame\\", +" meanFrame Label meanValue\\", +"\\", +" ptLayout Label sigLabel\\", +" ptLayout Frame sigFrame\\", +" sigFrame Label sigValue\\", +"}", +"", +"", +"set Objects(tcl_panel) { \\", +" toplevel TopLevelShell tcl_panel\\", +" tcl_panel Layout tclLayout\\", +" tclLayout Group tclCmdGroup\\", +" tclCmdGroup Layout tclCmd\\", +" tclCmd Command tclClear\\", +" tclCmd Command tclExecute\\", +" tclCmd Command tclDismiss\\", +" tclLayout Frame tclFrame\\", +" tclFrame AsciiText tclEntry\\", +"}", +"", +"", +"set Objects(warning) { \\", +" toplevel TransientShell warning\\", +" warning Layout warn\\", +" warn Frame warnFrame\\", +" warnFrame Layout WFlayout\\", +" WFlayout Icon warnIcon\\", +" WFlayout TextBox warnText\\", +" warn Command warnOk\\", +" warn Command warnCancel\\", +"}", +"", +"", +"set Resources(global) { \\", +"", +" !---------------------------------------------------------", +" ! Define some global widget resources for the main panels.", +" !---------------------------------------------------------", +" *shadowWidth: 1", +" *background: #c4c4c4", +"! *foreground: black", +" *Arrow.width: 16", +" *Arrow.height: 25", +" *Text*height: 21", +" *Command.height: 21", +" *Command.highlightThickness: 1", +" *MenuButton.height: 21", +" *MenuButton.highlightThickness: 1", +" *Label.borderWidth: 0", +" *Label.shadowWidth: 0", +" *TextButton.shadowWidth: 0", +" *TextButton.highlightThickness: 1", +" *TextToggle*borderWidth: 0", +" *TextToggle.highlightThickness: 0", +" *Toggle.highlightThickness: 1", +" *Group.shrinkToFit: True", +"", +" *Arrow.foreground: gray", +" *Arrow.background: #adadad", +" *Text*background: #adadad", +" *AsciiText*background: #adadad", +" *TextBox.background: #adadad", +" *MultiList*background: #adadad", +" *Slider2d.thumbColor: #c4c4c4", +"", +"", +" !-------------------------------------------------------------", +" ! Define resources to take advantage of the 3D scrollbar look.", +" !-------------------------------------------------------------", +" *Scrollbar*background: #c4c4c4", +" *Scrollbar*shadowWidth: 1", +" *Scrollbar*width: 15", +" *Scrollbar*height: 15", +" *Scrollbar*cursorName: top_left_arrow", +" *Scrollbar*pushThumb: true", +"", +" *HTML.Scrollbar.shadowWidth: 1", +" *HTML*Scrollbar*width: 15", +" *HTML*Scrollbar*height: 15", +"", +"", +" !----------------------------------------", +" ! Menu resources giving a shadow effect.", +" !----------------------------------------", +" *SmeBSB.leftMargin: 10", +" *SmeBSB.rightMargin: 5", +" *SmeBSB.shadowWidth: 2", +" *SmeBSB.foreground: #e5e5e5", +" *SmeBSB.background: SteelBlue", +" *SimpleMenu.background: #c4c4c4", +" *SimpleMenu.borderWidth: 2", +" *SimpleMenu.borderColor: black", +" *SimpleMenu.line1.foreground: #9c9c9c", +" *SimpleMenu.line2.foreground: #e8e8e8", +" *SimpleMenu.line3.foreground: #9c9c9c", +" *SimpleMenu.line4.foreground: #e8e8e8", +" *SimpleMenu.line5.foreground: #9c9c9c", +" *SimpleMenu.line6.foreground: #e8e8e8", +" *SimpleMenu.line7.foreground: #9c9c9c", +" *SimpleMenu.line8.foreground: #e8e8e8", +" *SimpleMenu.line9.foreground: #9c9c9c", +" *SimpleMenu.line10.foreground: #e8e8e8", +" *SimpleMenu.line11.foreground: #9c9c9c", +" *SimpleMenu.line12.foreground: #e8e8e8", +" *SimpleMenu.line13.foreground: #9c9c9c", +" *SimpleMenu.line14.foreground: #e8e8e8", +" *SimpleMenu.line15.foreground: #9c9c9c", +" *SimpleMenu.line16.foreground: #e8e8e8", +" *SimpleMenu.line17.foreground: #9c9c9c", +" *SimpleMenu.line18.foreground: #e8e8e8", +" *SimpleMenu.line19.foreground: #9c9c9c", +" *SimpleMenu.line20.foreground: #e8e8e8", +" *SimpleMenu.line21.foreground: #9c9c9c", +" *SimpleMenu.line22.foreground: #e8e8e8", +" *SimpleMenu.line23.foreground: #9c9c9c", +" *SimpleMenu.line24.foreground: #e8e8e8", +" *SimpleMenu.line25.foreground: #9c9c9c", +" *SimpleMenu.line26.foreground: #e8e8e8", +" *SimpleMenu.line27.foreground: #9c9c9c", +" *SimpleMenu.line28.foreground: #e8e8e8", +" *SimpleMenu.line29.foreground: #9c9c9c", +" *SimpleMenu.line30.foreground: #e8e8e8", +" *SimpleMenu.line31.foreground: #9c9c9c", +" *SimpleMenu.line32.foreground: #e8e8e8", +" *SimpleMenu.line33.foreground: #9c9c9c", +" *SimpleMenu.line34.foreground: #e8e8e8", +" *SimpleMenu.line35.foreground: #9c9c9c", +" *SimpleMenu.line36.foreground: #e8e8e8", +" *SimpleMenu.line37.foreground: #9c9c9c", +" *SimpleMenu.line38.foreground: #e8e8e8", +" *SimpleMenu.line39.foreground: #9c9c9c", +" *SimpleMenu.line40.foreground: #e8e8e8", +"", +"", +" !---------------------------------------------", +" ! Fixups for 24-bit displays", +" !---------------------------------------------", +" *hFindEntry.background: #adadad", +" *hdrIGText.background: #adadad", +" *hdrKGText.background: #adadad", +" *hfEntry.background: #adadad", +" *printcmd.background: #adadad", +" *titleString.background: #adadad", +" *fnameText.background: #adadad", +" *imtemplateText.background: #adadad", +" *z1Value.background: #adadad", +" *z2Value.background: #adadad", +" *nsampValue.background: #adadad", +" *saveFile.background: #adadad", +" *infoText.background: #adadad", +" *wtName.background: #adadad", +" *wtTitle.background: #adadad", +" *wtFBCfg.background: #adadad", +" *wtIPixval.background: #adadad", +" *wtSPixval.background: #adadad", +" *wtBPixval.background: #adadad", +" *wtWcs1.background: #adadad", +" *wtWcs2.background: #adadad", +" *wtWcs3.background: #adadad", +" *wtWcs4.background: #adadad", +" *wcsIsmCmd.background: #adadad", +" *tclEntry.background: #adadad", +"", +" *hFindEntry.foreground: #000000", +" *hdrIGText.foreground: #000000", +" *hdrKGText.foreground: #000000", +" *hfEntry.foreground: #000000", +" *printcmd.foreground: #000000", +" *titleString.foreground: #000000", +" *fnameText.foreground: #000000", +" *imtemplateText.foreground: #000000", +" *z1Value.foreground: #000000", +" *z2Value.foreground: #000000", +" *nsampValue.foreground: #000000", +" *saveFile.foreground: #000000", +" *infoText.foreground: #000000", +" *wtName.foreground: #000000", +" *wtTitle.foreground: #000000", +" *wtFBCfg.foreground: #000000", +" *wtIPixval.foreground: #000000", +" *wtSPixval.foreground: #000000", +" *wtBPixval.foreground: #000000", +" *wtWcs1.foreground: #000000", +" *wtWcs2.foreground: #000000", +" *wtWcs3.foreground: #000000", +" *wtWcs4.foreground: #000000", +" *wcsIsmCmd.foreground: #000000", +" *tclEntry.foreground: #000000", +"}", +" ", +" ", +" ", +" ", +"", +"set Resources(ximtool) { \\", +"", +" ! Main image window resources.", +" ! -------------------------------", +" *allowShellResize: True", +" *beNiceToColormap: False", +" *menuLabel.foreground: Gold", +" *markerMenu.foreground: White", +" *rulerMenu.foreground: White", +" *display.imagewin.markerMenu.foreground: White", +" *display.imagewin.rulerMenu.foreground: White", +" *markerMenu.background: SteelBlue", +" *markerMenu*SimpleMenu.foreground: White", +" *markerMenu*SimpleMenu.background: SteelBlue", +" *rulerMenu.background: SteelBlue", +" *rulerMenu*SimpleMenu.foreground: White", +" *rulerMenu*SimpleMenu.background: SteelBlue", +" *rulerColor.SmeBSB.leftMargin: 16", +" *magzoomMenu.foreground: White", +" *magzoomMenu.background: SteelBlue", +" *magzoomMenu*SimpleMenu.foreground: White", +" *magzoomMenu*SimpleMenu.background: SteelBlue", +" *markerColor.SmeBSB.leftMargin: 64", +" *markerColor.SmeBSB.rightMargin: 0", +" *markerColor.menuLabel.leftMargin: 5", +" *markerColor.menuLabel.rightMargin: 5", +" *rulerColor.SmeBSB.leftMargin: 64", +" *rulerColor.SmeBSB.rightMargin: 0", +" *rulerColor.menuLabel.leftMargin: 5", +" *rulerColor.menuLabel.rightMargin: 5", +"", +" *ximtool.title: XIMTOOL_VERSION", +"", +" *display.borderWidth: 2", +" *display.layout: horizontal { \\", +" -0 \\", +" vertical { \\", +" menuGroup < +inf -inf * > \\", +" horizontal { 1 toolbar < +inf -inf * > 1 } \\", +" 1 < -1 > \\", +" horizontal { 1 panelbar < +inf -inf * > 1 } \\", +" 1 < -1 > \\", +" vertical { \\", +" horizontal { \\", +" imageFrame < +inf -inf * +inf -inf > \\", +" -2 \\", +" vcutFrame < * +inf -inf > \\", +" } \\", +" -3 \\", +" horizontal { \\", +" hcutFrame < +inf -inf * > 1 \\", +" vertical { 4 horizontal { -4 plotOpts} -4 } \\", +" } \\", +" -3 \\", +" horizontal { \\", +" cbarFrame < +inf -inf * > \\", +" focusSlider 2 hcut 2 vcut 15 \\", +" } \\", +" } \\", +" } \\", +" -0 \\", +" }", +" *hcut.label: H", +" *hcut.font: *lucida-bold-r*10*", +" *vcut.label: V", +" *vcut.font: *lucida-bold-r*10*", +" *focusSlider.location: 0 0 100 15", +"", +" *hcutFrame.frameType: sunken", +" *hcutFrame.frameWidth: 1", +" *hcutFrame.innerOffset: 1", +" *hcutFrame.outerOffset: 1", +" //*hcutPlot.color0: #c4c4c4", +" //*hcutPlot.color1: #000000", +" *hcutPlot.color0: #000000", +" *hcutPlot.color1: #ffffff", +" *hcutPlot.crosshairCursorColor: red", +" *hcutPlot.width: 512", +" *hcutPlot.height: 6", +" *hcutPlot.borderWidth: 0", +" *hcutPlot.alphaFont1: 6x10", +" *hcutPlot.alphaFont2: 6x10", +" *hcutPlot.alphaFont3: 6x10", +" *hcutPlot.alphaFont4: 6x10", +" *hcutPlot.alphaFont5: 6x10", +" *hcutPlot.alphaFont6: 6x10", +" *hcutPlot.alphaFont7: 6x10", +" *hcutPlot.alphaFont8: 6x10", +" *hcutPlot.translations: \\", +" !Ctrl <Key>1: call(cpZoom,1,1,fixed) \\n\\", +" !Ctrl <Key>2: call(cpZoom,2,2,fixed) \\n\\", +" !Ctrl <Key>3: call(cpZoom,3,3,fixed) \\n\\", +" !Ctrl <Key>4: call(cpZoom,4,4,fixed) \\n\\", +" !Ctrl <Key>5: call(cpZoom,5,5,fixed) \\n\\", +" !Ctrl <Key>6: call(cpZoom,6,6,fixed) \\n\\", +" !Ctrl <Key>7: call(cpZoom,7,7,fixed) \\n\\", +" !Ctrl <Key>8: call(cpZoom,8,8,fixed) \\n\\", +" !Ctrl <Key>9: call(cpZoom,9,9,fixed) \\n\\", +" !Ctrl <Key>b: call(prevFrame,$name) \\n\\", +" !Ctrl <Key>f: call(nextFrame,$name) \\n\\", +" !Ctrl <Key>i: call(cpInvert) \\n\\", +" !Ctrl <Key>m: call(toggleMagnifier) \\n\\", +" !Ctrl <Key>n: call(normalize) \\n\\", +" !Ctrl <Key>p: call(togglePanner) \\n\\", +" !Ctrl Alt <Key>q: call(Quit) \\n\\", +" !Ctrl <Key>r: call(cpRegisterFrames) \\n\\", +" !Ctrl <Key>s: call(cpMatchFrames) \\n\\", +" !Ctrl <Key>u: call(cpZoom,1,1,fixed) \\n\\", +" Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \\n\\", +" Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \\n\\", +" Ctrl <Key>\\<: call(cpSetBlinkRate,BRdecrease) \\n\\", +" Ctrl <Key>\\>: call(cpSetBlinkRate,BRincrease) \\n\\", +" !Alt <Key>b: call(toggleBlink) \\n\\", +" !Alt <Key>c: call(displayPanel) \\n\\", +" !Alt <Key>h: call(Help) \\n\\", +" !Alt <Key>i: call(infoPanel) \\n\\", +" !Ctrl Alt <Key>f: call(fitFrame) \\n\\", +" !Alt <Key>l: call(loadPanel) \\n\\", +" !Alt <Key>p: call(printPanel) \\n\\", +" !Alt <Key>s: call(savePanel) \\n\\", +" !Alt <Key>t: call(tclPanel) \\n\\", +" !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \\n\\", +" <EnterWindow>: enter-window() \\n\\", +" <LeaveWindow>: leave-window() \\n\\", +" <KeyPress>: graphics-input() \\n\\", +" !Alt <Motion>: call(curtrack_msg,$x,$y) \\n\\", +" <Motion>: track-cursor() call(hcutWCSUpdate,$x,$y)", +"", +"", +" *vcutFrame.frameType: sunken", +" *vcutFrame.frameWidth: 1", +" *vcutFrame.innerOffset: 0", +" *vcutFrame.outerOffset: 0", +" //*vcutPlot.color0: #c4c4c4", +" //*vcutPlot.color1: black", +" *vcutPlot.color0: #000000", +" *vcutPlot.color1: #ffffff", +" *vcutPlot.crosshairCursorColor: red", +" *vcutPlot.width: 6", +" *vcutPlot.height: 512", +" *vcutPlot.borderWidth: 0", +" *vcutPlot.alphaFont1: 6x10", +" *vcutPlot.alphaFont2: 6x10", +" *vcutPlot.alphaFont3: 6x10", +" *vcutPlot.alphaFont4: 6x10", +" *vcutPlot.alphaFont5: 6x10", +" *vcutPlot.alphaFont6: 6x10", +" *vcutPlot.alphaFont7: 6x10", +" *vcutPlot.alphaFont8: 6x10", +" *vcutPlot.translations: \\", +" !Ctrl <Key>1: call(cpZoom,1,1,fixed) \\n\\", +" !Ctrl <Key>2: call(cpZoom,2,2,fixed) \\n\\", +" !Ctrl <Key>3: call(cpZoom,3,3,fixed) \\n\\", +" !Ctrl <Key>4: call(cpZoom,4,4,fixed) \\n\\", +" !Ctrl <Key>5: call(cpZoom,5,5,fixed) \\n\\", +" !Ctrl <Key>6: call(cpZoom,6,6,fixed) \\n\\", +" !Ctrl <Key>7: call(cpZoom,7,7,fixed) \\n\\", +" !Ctrl <Key>8: call(cpZoom,8,8,fixed) \\n\\", +" !Ctrl <Key>9: call(cpZoom,9,9,fixed) \\n\\", +" !Ctrl <Key>b: call(prevFrame,$name) \\n\\", +" !Ctrl <Key>f: call(nextFrame,$name) \\n\\", +" !Ctrl <Key>i: call(cpInvert) \\n\\", +" !Ctrl <Key>m: call(toggleMagnifier) \\n\\", +" !Ctrl <Key>n: call(normalize) \\n\\", +" !Ctrl <Key>p: call(togglePanner) \\n\\", +" !Ctrl Alt <Key>q: call(Quit) \\n\\", +" !Ctrl <Key>r: call(cpRegisterFrames) \\n\\", +" !Ctrl <Key>s: call(cpMatchFrames) \\n\\", +" !Ctrl <Key>u: call(cpZoom,1,1,fixed) \\n\\", +" Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \\n\\", +" Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \\n\\", +" Ctrl <Key>\\<: call(cpSetBlinkRate,BRdecrease) \\n\\", +" Ctrl <Key>\\>: call(cpSetBlinkRate,BRincrease) \\n\\", +" !Alt <Key>b: call(toggleBlink) \\n\\", +" !Alt <Key>c: call(displayPanel) \\n\\", +" !Alt <Key>h: call(Help) \\n\\", +" !Alt <Key>i: call(infoPanel) \\n\\", +" !Ctrl Alt <Key>f: call(fitFrame) \\n\\", +" !Alt <Key>l: call(loadPanel) \\n\\", +" !Alt <Key>p: call(printPanel) \\n\\", +" !Alt <Key>s: call(savePanel) \\n\\", +" !Alt <Key>t: call(tclPanel) \\n\\", +" !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \\n\\", +" <EnterWindow>: enter-window() \\n\\", +" <LeaveWindow>: leave-window() \\n\\", +" <KeyPress>: graphics-input() \\n\\", +" !Alt <Motion>: call(curtrack_msg,$x,$y) \\n\\", +" <Motion>: track-cursor() call(vcutWCSUpdate,$x,$y)", +"", +"", +" *plotOpts.label: Options", +" !*plotOpts*location: 0 0 105 18", +" *plotOpts*location: 0 0 1 18", +" *plotOpts.shrinkToFit: True", +" *plotOpts.outerOffset: 5", +" *plotOpts.innerOffset: 3", +" *plotOpts.frameWidth: 2", +" *plotOpts*TextToggle.offIcon: square0s", +" *plotOpts*TextToggle.onIcon: square1s", +" *plotOpts*TextToggle.highlightColor: yellow", +" *plotOpts*TextToggle.outerOffset: 0", +" *plotOpts*TextToggle.frameWidth: 0", +" *plotOpts*TextToggle.selectionStyle: multi", +" *plotOpts*TextToggle.leftMargin: 3", +" *plotOpts*TextToggle.alignment: left", +"", +" *poptsLayout.borderWidth: 0", +" *poptsLayout.layout: vertical { \\", +" -1 \\", +" plotSpeed plotAccurate plotImgPix \\", +" 2 < -2 > \\", +" horizontal { -4 optLine < +inf -inf * > -4 } \\", +" 2 < -2 > \\", +" curJump curSmooth curTrack \\", +" -1 \\", +" }", +" *plotSpeed.label: Better Speed", +" *plotSpeed.on: True", +" *plotAccurate.label: Better Accuracy", +" *plotAccurate.on: False", +" *plotImgPix.label: Image Pixels", +" *plotImgPix.on: False", +" *plotImgPix.sensitive: False", +" *optLine.height: 2", +" *optLine.width: 120", +" *optLine.outerOffset: 0", +" *optLine.innerOffset: 0", +" *optLine.frameWidth: 2", +" *optLine.frameType: chiseled", +" *curJump.label: Jump Cursor", +" *curJump.on: True", +" *curSmooth.label: Smooth Cursor", +" *curSmooth.on: False", +" *curTrack.label: Graphics Cursors", +" *curTrack.on: True", +"", +"", +" *menuGroup.label: ", +" *menuGroup.height: 38", +" *menuGroup.width: 512", +" *menuGroup.frameType: raised", +" *menuGroup.frameWidth: 2", +" *menubar.layout: horizontal { \\", +" 2 < -2 > \\", +" fileButton 1 < -1 > viewButton 1 < -1 > optionsButton \\", +" 1 < -1 > \\", +" imageTitle < +inff -inff * > \\", +" 1 < -1 > \\", +" mXflipButton 1 < -1 > mYflipButton \\", +" 1 < -1 > \\", +" mPrevButton 1 < -1 > mFrameButton 1 < -1 > mNextButton \\", +" 1 < -1 > \\", +" toolButton 1 < -1 > panelButton \\", +" 2 < -2 > \\", +" }", +"", +" *menubar*SimpleMenu.foreground: Black", +" *menubar*SimpleMenu.borderWidth: 1", +" *menubar*SimpleMenu.foreground: White", +" *menubar*SimpleMenu.background: SteelBlue", +" *SmeBSB.vertSpace: 10", +"", +" *menubar.width: 512", +" *menubar*borderWidth: 0", +" *menubar*Command.internalWidth: 0", +" *menubar*Command.borderWidth: 0", +" *menubar*Toggle.label: x", +" *menubar*Toggle.internalWidth: 0", +" *menubar*Toggle.borderWidth: 0", +"", +" *toolbar.layout: horizontal { \\", +" tbZoomIn < +inf -inf * > 1 < -1 > \\", +" tbZoom0 < +inf -inf * > 1 < -1 > \\", +" tbZoomOut < +inf -inf * > 1 < -1 > \\", +" tbInvert < +inf -inf * > 1 < -1 > \\", +" tbNormalize < +inf -inf * > 1 < -1 > \\", +" tbMatchLUT < +inf -inf * > 1 < -1 > \\", +" tbAutoReg < +inf -inf * > 1 < -1 > \\", +" tbRegister < +inf -inf * > 1 < -1 > \\", +" tbCenter < +inf -inf * > 1 < -1 > \\", +" tbBlinkDec < +inf -inf * > 1 < -1 > \\", +" tbBlink < +inf -inf * > 1 < -1 > \\", +" tbBlinkInc < +inf -inf * > 1 < -1 > \\", +" xflipButton < +inf -inf * > 1 < -1 > \\", +" yflipButton < +inf -inf * > 1 < -1 > \\", +" tbCompass < +inf -inf * > 1 < -1 > \\", +" tbTile < +inf -inf * > 1 < -1 > \\", +" prevButton < +inf -inf * > 1 < -1 > \\", +" frameButton < +inf -inf * > 1 < -1 > \\", +" nextButton < +inf -inf * > 1 < -1 > \\", +" }", +" *toolbar.width: 512", +" *toolbar.height: 25", +" *toolbar*borderWidth: 0", +" *toolbar*Command.internalWidth: 3", +" *toolbar*Command.borderWidth: 0", +" *toolbar*Toggle.internalWidth: 2", +" *toolbar*Toggle.borderWidth: 0", +"", +" *panelbar.layout: horizontal { \\", +" pbDisplayP < +inf -inf * > 1 < -1 > \\", +" pbPrintP < +inf -inf * > 1 < -1 > \\", +" pbLoadP < +inf -inf * > 1 < -1 > \\", +" pbSaveP < +inf -inf * > 1 < -1 > \\", +" pbInfoP < +inf -inf * > 1 < -1 > \\", +" pbTileP < +inf -inf * > 1 < -1 > \\", +" pbCoordP < +inf -inf * > 1 < -1 > \\", +" pbPanM < +inf -inf * > 1 < -1 > \\", +" pbMagM < +inf -inf * > 1 < -1 > \\", +" pbWcsM < +inf -inf * > 1 < -1 > \\", +" pbIsm < +inf -inf * > 1 < -1 > \\", +" helpButton < +inf -inf * > 1 < -1 > \\", +" pbQuit < +inf -inf * > 1 < -1 > \\", +" }", +" *panelbar*SimpleMenu.borderColor: Black", +" *panelbar*SimpleMenu.borderWidth: 1", +" *SmeBSB.vertSpace: 10", +"", +" *panelbar.width: 12", +" *panelbar.height: 25", +" *panelbar*borderWidth: 0", +" *panelbar*Label.internalWidth: 4", +" *panelbar*Label.borderWidth: 0", +" *panelbar*Command.internalWidth: 4", +" *panelbar*Command.borderWidth: 0", +" *panelbar*Toggle.internalWidth: 3", +" *panelbar*Toggle.borderWidth: 0", +"", +" *pbLoadP.label: Load", +" *pbDisplayP.label: Display", +" *pbSaveP.label: Save", +" *pbPrintP.label: Print", +" *pbInfoP.label: Info", +" *pbTileP.label: Tile", +" *pbCoordP.label: Coords", +" *pbPanM.label: Pan", +" *pbPanM.state: 1", +" *pbMagM.label: Mag", +" *pbMagM.state: 0", +" *pbWcsM.label: WCS", +" *pbWcsM.state: 1", +" *pbIsm.label: ISM", +" *pbIsm.state: 0", +" *helpButton.label: ", +"", +" *fileButton.label: File", +" *fileButton.menuName: fileMenu", +" *viewButton.label: View", +" *viewButton.menuName: viewMenu", +" *optionsButton.label: Options", +" *optionsButton.menuName: optionsMenu", +" *toolButton.label: ", +" *toolButton.state: 0", +" *panelButton.label: ", +" *panelButton.state: 0", +" *imageTitle*font: *times-bold-r*12*", +" *imageTitle.width: 40", +" *imageTitle.height: 20", +" *frameButton.menuName: frameMenu", +" *frameButton.label: 1", +" *frameButton.width: 20", +" *mFrameButton.menuName: mFrameMenu", +" *mFrameButton.label: 1", +" *mFrameButton.width: 20", +" *pbQuit.label: Quit", +" *tbZoom0.label: Mag", +" *tbBlink.label: Blink", +" *tbBlink.internalWidth: 3", +" *tbCenter.label: Cntr", +" *tbAutoReg.label: AReg", +" *tbRegister.label: Reg", +" *tbInvert.label: Inv", +" *tbNormalize.label: Norm", +" *tbMatchLUT.label: Match", +"", +" *SimpleMenu*font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1", +" *fileButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1", +" *optionsButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1", +" *viewButton.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1", +" *panelbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1", +" *toolbar*font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1", +"", +" *Gterm.cmapName: image", +" *Gterm.basePixel: 64", +" *imageFrame.frameType: sunken", +" *imageFrame.frameWidth: 1", +" *imageFrame.outerOffset: 0", +" *imageFrame.innerOffset: 0", +" *imageFrame.width: 512", +" *imageFrame.height: 512", +" *cbarFrame.frameType: sunken", +" *cbarFrame.frameWidth: 1", +" *cbarFrame.outerOffset: 0", +" *cbarFrame.innerOffset: 0", +" *cbarFrame.width: 512", +" *imagewin.warpCursor: true", +" *imagewin.raiseWindow: true", +" *imagewin.deiconifyWindow: true", +" *imagewin.idleCursor: crosshair", +" *imagewin.ginmodeCursor: circle", +" *imagewin.ginmodeBlinkInterval: 500", +" *imagewin.resizable: true", +" *imagewin.copyOnResize: false", +" *imagewin.width: 512", +" *imagewin.height: 512", +" *imagewin.maxMappings: 64", +" *imagewin.borderWidth: 0", +"", +" *imagewin.translations: \\", +" None<Key>Left: call(move_cursor,-1,0) \\n\\", +" None<Key>Down: call(move_cursor,0,1) \\n\\", +" None<Key>Up: call(move_cursor,0,-1) \\n\\", +" None<Key>Right: call(move_cursor,1,0) \\n\\", +" !Shift <Key>Left: call(move_cursor,-10,0) \\n\\", +" !Shift <Key>Down: call(move_cursor,0,10) \\n\\", +" !Shift <Key>Up: call(move_cursor,0,-10) \\n\\", +" !Shift <Key>Right: call(move_cursor,10,0) \\n\\", +" !Ctrl <Key>h: call(move_cursor,-1,0) \\n\\", +" !Ctrl <Key>j: call(move_cursor,0,1) \\n\\", +" !Ctrl <Key>k: call(move_cursor,0,-1) \\n\\", +" !Ctrl <Key>l: call(move_cursor,1,0) \\n\\", +" !Ctrl Shift <Key>h: call(move_cursor,-10,0) \\n\\", +" !Ctrl Shift <Key>j: call(move_cursor,0,10) \\n\\", +" !Ctrl Shift <Key>k: call(move_cursor,0,-10) \\n\\", +" !Ctrl Shift <Key>l: call(move_cursor,10,0) \\n\\", +" !Ctrl <Key>Left: call(moveFrame,-1,0) \\n\\", +" !Ctrl <Key>Down: call(moveFrame,0,1) \\n\\", +" !Ctrl <Key>Up: call(moveFrame,0,-1) \\n\\", +" !Ctrl <Key>Right: call(moveFrame,1,0) \\n\\", +" !Ctrl Alt <Key>Left: call(moveFrame,-0.5,0) \\n\\", +" !Ctrl Alt <Key>Down: call(moveFrame,0,0.5) \\n\\", +" !Ctrl Alt <Key>Up: call(moveFrame,0,-0.5) \\n\\", +" !Ctrl Alt <Key>Right: call(moveFrame,0.5,0) \\n\\", +" !Alt <Key>1: call(cpSetFrame,frame1) \\n\\", +" !Alt <Key>2: call(cpSetFrame,frame2) \\n\\", +" !Alt <Key>3: call(cpSetFrame,frame3) \\n\\", +" !Alt <Key>4: call(cpSetFrame,frame4) \\n\\", +" !Ctrl <Key>1: call(cpZoom,1,1,fixed) \\n\\", +" !Ctrl <Key>2: call(cpZoom,2,2,fixed) \\n\\", +" !Ctrl <Key>3: call(cpZoom,3,3,fixed) \\n\\", +" !Ctrl <Key>4: call(cpZoom,4,4,fixed) \\n\\", +" !Ctrl <Key>5: call(cpZoom,5,5,fixed) \\n\\", +" !Ctrl <Key>6: call(cpZoom,6,6,fixed) \\n\\", +" !Ctrl <Key>7: call(cpZoom,7,7,fixed) \\n\\", +" !Ctrl <Key>8: call(cpZoom,8,8,fixed) \\n\\", +" !Ctrl <Key>9: call(cpZoom,9,9,fixed) \\n\\", +" !Ctrl <Key>a: call(tbToggleAutoReg) \\n\\", +" !Ctrl <Key>b: call(prevFrame,$name) \\n\\", +" !Ctrl <Key>c: call(cpZoomAction,centerFrame) \\n\\", +" !Ctrl <Key>f: call(nextFrame,$name) \\n\\", +" !Ctrl <Key>i: call(cpInvert) \\n\\", +" !Ctrl <Key>m: call(toggleMagnifier) \\n\\", +" !Ctrl <Key>n: call(normalize) \\n\\", +" !Ctrl <Key>o: call(offset,$x,$y) \\n\\", +" !Ctrl <Key>p: call(togglePanner) \\n\\", +" !Ctrl Alt <Key>q: call(Quit) \\n\\", +" !Ctrl <Key>r: call(cpRegisterFrames) \\n\\", +" !Ctrl <Key>s: call(cpMatchFrames) \\n\\", +" !Ctrl <Key>t: call(tbTileFramesToggle) \\n\\", +" !Ctrl <Key>u: call(cpZoom,1,1,fixed) \\n\\", +" !Ctrl <Key>x: call(cpFrameAction,flipX) \\n\\", +" !Ctrl <Key>y: call(cpFrameAction,flipY) \\n\\", +" Ctrl <Key>+: call(cpZoom,2.0,2.0,relative) \\n\\", +" Ctrl <Key>-: call(cpZoom,0.5,0.5,relative) \\n\\", +" !Ctrl Alt <Key>=: call(Print) \\n\\", +" Ctrl <Key>\\<: call(cpSetBlinkRate,BRdecrease) \\n\\", +" Ctrl <Key>\\>: call(cpSetBlinkRate,BRincrease) \\n\\", +" Ctrl <Key>\\[: call(setCtrBoxSize,$x,$y,-1) \\n\\", +" Ctrl <Key>\\]: call(setCtrBoxSize,$x,$y,1) \\n\\", +" !Ctrl <Key>0: call(centroid,$x,$y,peak) \\n\\", +" !Ctrl Alt <Key>0: call(centroid,$x,$y,min) \\n\\", +" !Alt <Key>b: call(toggleBlink) \\n\\", +" !Alt <Key>c: call(displayPanel) \\n\\", +" !Ctrl Shift <Key>c: call(displayPanel) \\n\\", +" !Ctrl Alt <Key>f: call(fitFrame) \\n\\", +" !Alt <Key>h: call(Help) \\n\\", +" !Alt <Key>i: call(infoPanel) \\n\\", +" !Alt <Key>l: call(loadPanel) \\n\\", +" !Alt <Key>p: call(printPanel) \\n\\", +" !Alt <Key>s: call(savePanel) \\n\\", +" !Alt <Key>t: call(tclPanel) \\n\\", +" !Ctrl Shift <Key>t: call(tclPanel) \\n\\", +" !Shift<Btn1Down>: call(setDynamicMagnifier,1) \\n\\", +" !Shift<Btn1Up>: call(setDynamicMagnifier,0) \\n\\", +" !<Btn1Down>: call(makeMarker,$name,$x,$y) m_create() \\n\\", +" !Shift <Btn2Down>: crosshair(on) \\n\\", +" !Shift <Btn2Motion>: crosshair(on) \\n\\", +" !Shift <Btn2Up>: crosshair(off) \\n\\", +" !<Btn2Up>: crosshair(off) \\n\\", +" !<Btn2Down>: call(zoom,$x,$y) \\n\\", +" !<Btn3Down>: call(windowColormap,$x,$y) \\n\\", +" !<Btn3Up>: call(updateColormap,$x,$y) \\n\\", +" !<Btn3Motion>: call(windowColormap,$x,$y) \\n\\", +" !Ctrl <Btn1Down>: call(makeRuler,$name,$x,$y) \\n\\", +" !Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y) call(resizeRuler,$x,$y,0) \\n\\", +" !Ctrl <Btn1Up>: call(deleteRuler,$x,$y) \\n\\", +" <EnterWindow>: enter-window() \\n\\", +" <LeaveWindow>: leave-window() \\n\\", +" <KeyPress>: graphics-input() \\n\\", +" !Alt <Motion>: call(curtrack_msg,$x,$y) \\n\\", +" <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y)", +"", +"! The following translations can be used to enable windowing of the", +"! individual RGB components of the colormap. It's not very useful but", +"! included here for those that may wish to use it.", +"!--------------------------------------------------------------------------", +"! !Ctrl <Btn1Down>: call(windowRGB,1,$x,$y,0) \\n\\", +"! !Ctrl <Btn1Motion>: call(windowRGB,1,$x,$y,0) \\n\\", +"! !Ctrl <Btn1Up>: call(windowRGB,1,$x,$y,1) \\n\\", +"! !Ctrl <Btn2Down>: call(windowRGB,2,$x,$y,0) \\n\\", +"! !Ctrl <Btn2Motion>: call(windowRGB,2,$x,$y,0) \\n\\", +"! !Ctrl <Btn2Up>: call(windowRGB,2,$x,$y,1) \\n\\", +"! !Ctrl <Btn3Down>: call(windowRGB,3,$x,$y,0) \\n\\", +"! !Ctrl <Btn3Motion>: call(windowRGB,3,$x,$y,0) \\n\\", +"! !Ctrl <Btn3Up>: call(windowRGB,3,$x,$y,1) \\n\\", +"", +"", +" *colorbar.maxRasters: 1", +" *colorbar.maxMappings: 1", +" *colorbar.height: 17", +" *colorbar.width: 50", +" *colorbar.borderWidth: 0", +"}", +"", +"", +"set Resources(panelShell) { \\", +"", +" !================================", +" ! Main Integrated Control Panel", +" !================================", +" *panelShell.title: XImtool Control Panel", +" *panelShell.geometry: 480x630", +" *panelShell.maxWidth: 480", +" *panelShell.minWidth: 480", +" *panelTabs.internalHeight: 3", +" *panelTabs.internalWidth: 10", +"", +" *Text*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *TextBox*font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *List.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *MultiList.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *TextButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *TextToggle.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +"", +" *display_panel.tabLabel: Display", +" *display_panel.innerOffset: 5", +" *print_panel.tabLabel: Print", +" *print_panel.innerOffset: 5", +" *load_panel.tabLabel: Load", +" *load_panel.innerOffset: 5", +" *save_panel.tabLabel: Save", +" *save_panel.innerOffset: 5", +" *info_panel.tabLabel: Info", +" *info_panel.innerOffset: 5", +" *tile_panel.tabLabel: Tile", +" *tile_panel.innerOffset: 5", +" *wcs_panel.tabLabel: Coords", +" *wcs_panel.innerOffset: 5", +"", +" *panelMenuBar*borderWidth: 0", +" *panelMenuBar*Command.internalHeight: 4", +" *panelMenuBar*Command.internalWidth: 15", +" *panelMenuBar.layout: vertical { \\", +" 5 < -5 > \\", +" horizontal { \\", +" 10 < +inf -10> \\", +" panelHelp \\", +" 3 < -3 > \\", +" panelClose \\", +" 7 < -7 > \\", +" } \\", +" 5 < -5 > \\", +" }", +"", +" *panelHelp.label: Help", +" *panelClose.label: Dismiss", +"", +"", +" *tabFrame.outerOffset: 3", +" *tabFrame.innerOffset: 0", +" *tabFrame.frameWidth: 0", +" *tabFrame.frameType: chiseled", +" *panelMenuFrame.outerOffset: 0", +" *panelMenuFrame.innerOffset: 1", +" *panelMenuFrame.frameType: raised", +" *panelMenuFrame.frameWidth: 2", +" *panel.layout: vertical { \\", +" panelMenuFrame < +inf -inf * > \\", +" 3 \\", +" horizontal { tabFrame < +inf -inf * +inf -inf> } \\", +" }", +"} ", +"", +"", +"set Resources(display_panel) { \\", +"", +" !================================", +" ! Main Display Control Panel.", +" !================================", +" *controlPanel*internalWidth: 0", +" *controlPanel*borderWidth: 0", +"", +" *TextBox.font: 7x13bold", +" *TextToggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1", +" *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*-*-*-iso8859-1", +" *Toggle.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1", +" *Label.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *MultiList.font: -adobe-times-medium-r-normal-*-12-*-*-*-*-*-iso8859-1", +" *toggleZoom.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *centerFrame.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *zoom*Command.font: 7x13bold", +"", +" *blinkFrame1.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *blinkFrame2.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *blinkFrame3.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *blinkFrame4.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *matchButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *registerButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *blinkButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +" *autoregButton.font: -adobe-times-medium-r-normal-*-12-*-iso8859-1", +"", +" *controlPanel.layout: vertical { \\", +" 5 < -5 > \\", +" horizontal { \\", +" -1 \\", +" viewBox < +inf -inf * > \\", +" -1 \\", +" } \\", +" 5 < -5 > \\", +" horizontal { \\", +" -1 \\", +" enhancementBox < +inf -inf * +inf -inf > \\", +" -5 \\", +" vertical { \\", +" -1 \\", +" blinkBox < * +inf - inf > \\", +" 1 \\", +" optionsBox < * +inff -inff > \\", +" -1 \\", +" } \\", +" -1 \\", +" } \\", +" -5 \\", +" controlBox < +inf * > \\", +" -5 \\", +" }", +"", +" ! VIEW", +" ! ------------------", +" *viewBox.label: View", +" *viewBox.location: 0 0 410 0", +" *viewBox.shrinkToFit: True", +" *viewBox.outerOffset: 7", +"", +" *view.layout: vertical { \\", +" 5 < +inf -5 > \\", +" horizontal { \\", +" -1 \\", +" frameSelect \\", +" vertical { \\", +" 3 < -3 > \\", +" frameDataBox < +inff -100% * +inff -100% > \\", +" 3 < -3 > \\", +" } \\", +" zoomBox \\", +" -1 \\", +" } \\", +" 1 < +inf > \\", +" viewButtons < +inf -inf * +inf -inf > \\", +" 5 < +inf -5 > \\", +" }", +"", +" *frameDataBox.frameType: sunken", +" *frameDataBox.frameWidth: 1", +" *frameData.width: 150", +" *frameData.height: 50", +"", +" *frameSelect.location: 0 0 72 0", +" *frameSelect.shrinkToFit: True", +" *frameSelect.outerOffset: 7", +" *frameSelect.innerOffset: 2", +" *frameSelect.frameWidth: 2", +" *frameSelect*offIcon: diamond0s", +" *frameSelect*onIcon: diamond1s", +" *frameSelect*highlightColor: blue", +" *frameSelect.label: Frame", +"", +" *frameBox.layout: vertical { \\", +" 3 \\", +" horizontal { -2 frlistBox < * +inff -inff > } \\", +" 3 < +inf -3 > \\", +" horizontal { prevFrame < +inf -inf * > 4 nextFrame < +inf -inf * > } \\", +" }", +" *framePort.allowVert: True", +" *framePort.allowHoriz: False", +" *framePort.useRight: True", +" *framePort.height: 80", +"", +" *frameBox*alignment: left", +" *frameBox*frameWidth: 0", +" *frameBox*frame1.label: 1\\ \\ ", +" *frameBox*frame2.label: 2\\ \\ ", +" *frameBox*frame3.label: 3\\ \\ ", +" *frameBox*frame4.label: 4\\ \\ ", +"", +" *frameBox*frame5.label: 5\\ \\ ", +" *frameBox*frame6.label: 6\\ \\ ", +" *frameBox*frame7.label: 7\\ \\ ", +" *frameBox*frame8.label: 8\\ \\ ", +" *frameBox*frame9.label: 9\\ \\ ", +" *frameBox*frame10.label: 10\\ ", +" *frameBox*frame11.label: 11\\ ", +" *frameBox*frame12.label: 12\\ ", +" *frameBox*frame13.label: 13\\ ", +" *frameBox*frame14.label: 14\\ ", +" *frameBox*frame15.label: 15\\ ", +" *frameBox*frame16.label: 16\\ ", +" *frameBox*Command.width: 24", +" *frameBox*prevFrame.label: xxx", +" *frameBox*nextFrame.label: xxx", +"", +" *frameList*location: 0 0 50 20", +" *frameList.layout: vertical { \\", +" frame1 < +inf * >\\", +" frame2 < +inf * >\\", +" frame3 < +inf * >\\", +" frame4 < +inf * >\\", +" frame5 < +inf * >\\", +" frame6 < +inf * >\\", +" frame7 < +inf * >\\", +" frame8 < +inf * >\\", +" frame9 < +inf * >\\", +" frame10 < +inf * >\\", +" frame11 < +inf * >\\", +" frame12 < +inf * >\\", +" frame13 < +inf * >\\", +" frame14 < +inf * >\\", +" frame15 < +inf * >\\", +" frame16 < +inf * >\\", +" }", +"", +"", +" *zoomBox.label: Zoom:", +" *zoomBox.location: 0 0 160 127", +" *zoomBox.outerOffset: 7", +" *zoomBox.shrinkToFit: True", +" *zoomBox*TextButton.frameWidth: 1", +" *zoomBox*TextButton.outerOffset: 0", +"", +" *controlPanel*zoom*internalWidth: 4", +" *zoom.layout: vertical { \\", +" space = ((50% of width zoom) - (50% of width z5)) \\", +" 1 < +inf > \\", +" horizontal { \\", +" vertical { toggleZoom < +inf * +inf > 1 } \\", +" 1 \\", +" vertical { 1 < +inf > z5 1 < +inf > z3 0 < +inf > } \\", +" 1 \\", +" vertical { zoomIn < +inf * +inf > 1 } \\", +" } \\", +" 1 \\", +" horizontal { \\", +" 1 < +inf > \\", +" d8 1 d4 1 d2 1 x1 1 z2 1 z4 1 z8 \\", +" 1 < +inf > \\", +" } \\", +" 1 \\", +" horizontal { \\", +" vertical { 1 zoomOut < +inf * +inf > } \\", +" 1 \\", +" vertical { 0 < +inf > d3 1 < +inf > d5 1 < +inf > } \\", +" 1 \\", +" vertical { 1 centerFrame < +inf * +inf > } \\", +" } \\", +" 1 < +inf > \\", +" }", +"", +" *toggleZoom.label: Toggle\\nZoom", +" *toggleZoom.outerOffset: 2", +" *toggleZoom.width: 30", +" *toggleZoom.height: 25", +"", +" *zoomIn.label: Zoom\\nIn", +" *zoomIn.outerOffset: 2", +" *zoomIn.width: 30", +" *zoomIn.height: 25", +"", +" *x1.label: 1", +" *z2.label: 2", +" *z3.label: 3", +" *z4.label: 4", +" *z5.label: 5", +" *z8.label: 8", +"", +" *controlPanel*zoomIn.foreground: royalBlue3", +" *controlPanel*z4.foreground: royalBlue3", +" *controlPanel*z5.foreground: royalBlue3", +" *controlPanel*z8.foreground: royalBlue3", +" *controlPanel*z2.foreground: royalBlue3", +" *controlPanel*z3.foreground: royalBlue3", +"", +" *zoomOut.label: Zoom\\nOut", +" *zoomOut.outerOffset: 2", +" *zoomOut.width: 30", +" *zoomOut.height: 25", +"", +" *centerFrame.label: Center", +" *centerFrame.outerOffset: 2", +" *centerFrame.width: 30", +" *centerFrame.height: 25", +"", +" *d2.label: 2", +" *d3.label: 3", +" *d4.label: 4", +" *d5.label: 5", +" *d8.label: 8", +"", +" *controlPanel*zoomOut.foreground: mediumVioletRed", +" *controlPanel*d2.foreground: mediumVioletRed", +" *controlPanel*d3.foreground: mediumVioletRed", +" *controlPanel*d4.foreground: mediumVioletRed", +" *controlPanel*d5.foreground: mediumVioletRed", +" *controlPanel*d8.foreground: mediumVioletRed", +"", +" *viewButtons.location: 0 0 100 80", +" *viewButtons.layout: horizontal { \\", +" 2 < -2 > \\", +" aspect < +inf * > 2 \\", +" flipX < +inf * > 2 \\", +" flipY < +inf * > 2 \\", +" flipXY < +inf * > 2 \\", +" clearFrame < +inf * > 2 \\", +" fitFrame < +inf * > \\", +" 2 < -2 > \\", +" }", +" *nextFrame.label: Next Frame", +" *prevFrame.label: Previous Frame", +" *fitFrame.label: Fit Frame", +" *aspect.label: Aspect", +" *clearFrame.label: Clear Frame", +" *flipX.label: Flip X", +" *flipY.label: Flip Y", +" *flipXY.label: Flip XY", +"", +"", +" ! ENHANCEMENT", +" ! ------------------", +" *enhancementBox.label: Enhancement", +" *enhancementBox.location: 0 0 110 0", +" *enhancementBox.shrinkToFit: True", +" *enhancementBox.outerOffset: 7", +"", +" *enhance*Viewport.allowVert: True", +" *enhance*Viewport.allowHoriz: False", +" *enhance*Viewport.useRight: False", +" *enhance*Viewport.resizeable: True", +" *enhance*Scrollbar.width: 17", +" *enhance*Scrollbar.minimumThumb: 10", +" *enhance.layout: vertical { \\", +" 3 < -3 > \\", +" horizontal { \\", +" 2 < -2 > \\", +" colorlistFrame < +inf -inf * +inff -inff > \\", +" 2 < -2 > \\", +" } \\", +" 2 \\", +" horizontal { \\", +" 2 < -2 > \\", +" colordataFrame < +inf -inf * +inf -inf > \\", +" 2 < -2 > \\", +" } \\", +" 5 < -5 > \\", +" horizontal { \\", +" 2 < -2 > \\", +" vertical { -1 contrastLabel 3 < -3 > brightnessLabel -1 } \\", +" 3 < -3 > \\", +" vertical { \\", +" -1 \\", +" contrastSlider < +inf -inf * > \\", +" 3 < -3 > \\", +" brightnessSlider < +inf -inf * > \\", +" -1 \\", +" } \\", +" 2 < -2 > \\", +" } \\", +" 5 < -5 > \\", +" horizontal { \\", +" 3 < -3 > \\", +" invertButton < +inf -inf * > \\", +" 5 < -5 > \\", +" optimizeButton < +inf -inf * > \\", +" 3 < -3 > \\", +" } \\", +" 3 < -3 > \\", +" }", +"", +" *enhance*frameType: sunken", +" *enhance*frameWidth: 1", +" *enhance*BorderWidth: 0", +" *enhance*Label.ShadowWidth: 0", +"", +" *colorlist.width: 100", +" *colorlist.height: 98", +" *colordata.width: 100", +" *colordata.height: 45", +" *enhance*colordata.frameWidth: 0", +" *contrastLabel.label: x", +" *contrastSlider.location: 0 0 100 17", +" *brightnessLabel.label: x", +" *brightnessSlider.location: 0 0 100 17", +" *invertButton.label: Invert", +" *optimizeButton.label: Optimize", +"", +"", +" ! ---------------------", +" ! BLINK/REGISTER", +" ! ---------------------", +" *blinkBox.label: Blink/Register", +" *blinkBox.location: 0 0 235 0", +" *blinkBox.shrinkToFit: True", +" *blinkBox.outerOffset: 7", +" *blinkBox*TextToggle.frameWidth: 1", +"", +" *blink.layout: vertical { \\", +" space = (width blinkFramesLabel - width blinkRateLabel) \\", +" 3 < -3 > \\", +" horizontal { \\", +" 0 \\", +" blinkFramesLabel \\", +" 3 < +inf > \\", +" blinkFrame1 < -50% * > \\", +" blinkFrame2 < -50% * > \\", +" blinkFrame3 < -50% * > \\", +" blinkFrame4 < -50% * > \\", +" 4 < +inf > \\", +" blinkPanel < -50% * > \\", +" blinkReset \\", +" 2 \\", +" } \\", +" 5 < -5 > \\", +" horizontal { \\", +" $space \\", +" blinkRateLabel \\", +" 2 \\", +" BRframe < +inf * > \\", +" } \\", +" 5 < +inf -100% > \\", +" horizontal { \\", +" vertical { \\", +" 2 matchButton < +inf * > 4 < -4 > registerButton < +inf * > \\", +" } \\", +" 5 < -5 > \\", +" vertical { \\", +" 1 blinkButton < +inf * > 4 < -4 > autoregButton < +inf * > \\", +" } \\", +" } \\", +" }", +"", +" *BRlayout.layout: horizontal { \\", +" BRdecrease \\", +" BRtext < +inf -100% * > \\", +" BRincrease \\", +" }", +"", +" *blink.Label.borderWidth: 0", +" *blink.Label.shadowWidth: 0", +" *controlPanel*blink*internalWidth: 4", +" *blink.TextToggle.location: 0 0 102 23", +" *blink.TextToggle.frameWidth: 1", +" *blink*TextToggle.highlightColor: yellow", +" *blink*TextToggle.offIcon: square0s", +" *blink*TextToggle.onIcon: square1s", +" *blink*TextToggle.outerOffset: 1", +" *blink*Command.height: 27", +" *blink*Arrow.width: 16", +" *blink*Arrow.height: 25", +"", +"", +" *blinkFramesLabel.label: Frames List:", +" *blinkFrame1.label: 1", +" *blinkFrame2.label: 2", +" *blinkFrame3.label: 3", +" *blinkFrame4.label: 4", +" *blinkPanel.label: x", +" *blinkPanel.width: 20", +" *blinkReset.label: Reset", +"", +" *blinkRateLabel.label: Blink Rate:", +" *BRframe.frameType: sunken", +" *BRframe.frameWidth: 1", +" *BRtext.width: 40", +" *BRtext.height: 23", +" *BRdecrease.direction: left", +" *BRincrease.direction: right", +" *registerButton.label: Register", +" *matchButton.label: Match LUTs", +" *blinkButton.label: Blink", +" *autoregButton.label: Auto-Register", +"", +" ! OPTIONS", +" ! ---------------------", +" *optionsBox.label: Options", +" *optionsBox.location: 0 0 220 0", +" *optionsBox.shrinkToFit: False", +" *optionsBox.outerOffset: 7", +" *optionsBox*offIcon: square0s", +" *optionsBox*onIcon: square1s", +" *optionsBox*selectionStyle: multi", +" *optionsBox*highlightColor: yellow", +" *optionsBox.TextToggle.location: 0 0 102 20", +" *optionsBox.TextToggle.frameWidth: 0", +" *optionsBox.TextToggle.highlightThickness: 0", +" *optionsBox*alignment: left", +"", +" *pannerButton.label: Panner", +" *coordsBoxButton.label: Coords Box", +" *autoscaleButton.label: Autoscale", +" *antialiasButton.label: Antialias", +" *tileFramesButton.label: Tile Frames", +" *magnifierButton.label: Magnifier", +" *warningsButton.label: Warnings", +" *peakupButton.label: Centroid Peaks", +" *peakupButton.on: True", +"", +" ! CONTROL", +" ! ----------------------", +" *controlBox.frameType: chiseled", +" *controlBox.frameWidth: 2", +" *controlBox.outerOffset: 7", +" *controlBox.innerOffset: 5", +" *controlBox.height: 30", +"", +" *control.layout: horizontal { \\", +" 1 \\", +" initializeButton < +inf * > \\", +" 5 < -5 > \\", +" normalizeButton < +inf * > \\", +" 80 < +inf -100% > \\", +" }", +"", +" *initializeButton.label: Initialize", +" *normalizeButton.label: Normalize", +"}", +"", +"", +"set Resources(print_panel) { \\", +"", +" !=====================================", +" ! Print Setup Panel resources. !", +" !=====================================", +" *print_panel*TextToggle.alignment: left", +" *print_panel*Arrow.width: 16", +" *print_panel*Arrow.height: 20", +" *print_panel*TextToggle.frameWidth: 0", +" *print_panel*TextToggle.height: 20", +" *print_panel*Label.borderWidth: 0", +" *print_panel*Label.shadowWidth: 0", +" *print_panel*TextButton.width: 40", +" *print_panel*TextButton.height: 25", +"", +" *printLayout.borderWidth: 0", +" *printLayout.layout: vertical { \\", +" -1 \\", +" printCmdGroup < +inf * > \\", +" -1 \\", +" optGroup < +inf -inf * +inf -inf > \\", +" -3 \\", +" cmdGroup < +inf * > \\", +" -1\\", +" }", +"", +"", +" ! Print Group resources.", +" !----------------------------------", +" *printCmdGroup.borderWidth: 0", +" *printCmdGroup.outerOffset: 5", +" *printCmdGroup.label: ", +" *printCmdGroup.location: 0 0 400 80", +" *printCmdGroup*offIcon: diamond0s", +" *printCmdGroup*onIcon: diamond1s", +" *printCmdGroup*highlightColor: cyan", +" *printCmdGroup*Frame.frameType: sunken", +" *printCmdGroup*Frame.frameWidth: 1", +" *printCmdGroup*Frame.width: 300", +" *printCmdGroup*Label.justify: right", +" *printCmdGroup*Text*editType: edit", +" *printCmdGroup*Text*height: 22", +" *printCmdGroup*TextToggle.width: 70", +" *printCmdGroup*shadowWidth: 0", +" *printCmdGroup*borderWidth: 0", +" *printCmdLayout.borderWidth: 0", +" *printCmdLayout.layout: horizontal { \\", +" labelLayout 5 inputLayout < +inf -inf * > \\", +" }", +" *labelLayout.borderWidth: 0", +" *labelLayout.layout: vertical { 5 toLabel 7 printerLabel }", +" *printerLabel.label: Print Command:", +" *toLabel.label: Print To:", +" *toPrinter.label: Printer", +" *toPrinter.on: True", +" *toFile.label: File", +"", +" *inputLayout.borderWidth: 0", +" *inputLayout.layout: horizontal { \\", +" 3 \\", +" vertical { \\", +" 5 \\", +" horizontal { 5 toPrinter 5 toFile 5 < +inf -inf > } \\", +" 5 \\", +" printcmdFrame < +inf -inf * > \\", +" 5 \\", +" } \\", +" 3 \\", +" }", +" *printcmd*string: lpr", +" *printcmd*height: 22", +" *printcmd*Text*editType: edit", +"", +"", +" ! Main options groups layout resources.", +" !---------------------------------------", +" *optGroup.frameWidth: 2", +" *optGroup.frameType: chiseled", +" *optGroup.label: ", +" *optGroup.location: 0 0 400 330", +" *optGroup.outerOffset: 5", +" *optGroup.innerOffset: 2", +" *optLayout*borderWidth: 0", +" *optLayout.layout: vertical { \\", +" -1 \\", +" horizontal { \\", +" vertical { \\", +" 5 \\", +" epsPageGroup < +inf -inf * > \\", +" optionsGroup < +inf -inf * +inf -inf > \\", +" -1 \\", +" } \\", +" vertical { \\", +" 5 \\", +" printColorGroup < +inf -inf * > \\", +" printerGroup < +inf -inf * > \\", +" -1 \\", +" } \\", +" -1 \\", +" } \\", +" 5 \\", +" horizontal { annOptsGroup < +inf * +inf > -1 } \\", +" -1 \\", +" }", +"", +"", +" ! Postscript Options group resources.", +" ! -----------------------------------", +" *epsPageGroup.label: Postscript Options", +" *epsPageGroup.outerOffset: 7", +" *epsPageGroup.innerOffset: 5", +" *epsPageGroup.location: 0 0 250 150", +" *epsPageGroup*offIcon: diamond0s", +" *epsPageGroup*onIcon: diamond1s", +" *epsPageGroup*highlightColor: cyan", +" *epsPage*Label.justify: left", +" *epsPage.layout: vertical { \\", +" -1 \\", +" epsOrientLabel 4 < -4 > \\", +" horizontal { 25 epsPortButton epsLandButton epsSquareButton -1 } \\", +" 4 \\", +" epsSizeLabel -1 \\", +" horizontal { \\", +" 25 epsLetterButton epsLegalButton epsA4Button epsB5Button -1 \\", +" } \\", +" 10 \\", +" horizontal { 5 epsScaleLabel 4 ScaleFrame < +inf -inf * > } \\", +" -1 \\", +" }", +"", +"", +" ! Page Layout resources.", +" ! -------------------------------", +" *epsOrientLabel.label: Orientation:", +" *epsPortButton.label: Portrait", +" *epsPortButton.width: 65", +" *epsLandButton.label: Landscape", +" *epsLandButton.width: 85", +" *epsSquareButton.label: Square", +" *epsSquareButton.width: 70", +" *epsSquareButton.sensitive: False", +"", +" *epsSizeLabel.label: Paper Size:", +" *epsLetterButton.label: Letter", +" *epsLetterButton.width: 60", +" *epsLegalButton.label: Legal", +" *epsLegalButton.width: 60", +" *epsA4Button.label: A4", +" *epsA4Button.width: 50", +" *epsB5Button.label: B5", +" *epsB5Button.width: 50", +"", +" ! Image scale box resources.", +" ! -------------------------------", +" *epsScaleLabel.label: Output Image Scale:", +" *epsScaleLabel.justify: right", +" *ScaleFrame.frameType: sunken", +" *ScaleFrame.frameWidth: 1", +" *ScaleFrame*shadowWidth: 0", +" *ScaleLayout.location: 0 0 100 35", +" *ScaleLayout.label: ", +" *ScaleLayout.layout: horizontal { \\", +" SCdecrease SCtext < +inf -100% * > SCincrease \\", +" }", +" *SCdecrease.direction: left", +" *SCtext.width: 75", +" *SCtext.height: 22", +" *SCtext.label: 100 %", +" *SCincrease.direction: right", +"", +"", +" ! Miscellaneous print options box resources.", +" ! ------------------------------------", +" *optionsGroup.outerOffset: 7", +" *optionsGroup.innerOffset: 5", +" *optionsGroup*onIcon: square1s", +" *optionsGroup*offIcon: square0s", +" *optionsGroup.label: Processing Options", +" *optionsGroup*TextToggle.width: 125", +" *optionsGroup*TextToggle.highlightColor: yellow", +" *options.location: 0 0 250 60", +" *options.frameWidth: 2", +" *options.layout: horizontal { \\", +" 5 \\", +" vertical { -1 epsscaleButton 2 autorotateButton -1 } \\", +" 3 \\", +" vertical { -1 aspectButton 2 compressButton -1 } \\", +" -1 \\", +" }", +" *epsscaleButton.label: Auto Scale", +" *autorotateButton.label: Auto Rotate", +" *aspectButton.label: Max Aspect", +" *compressButton.label: RLE Compress", +" *compressButton.sensitive: False", +"", +"", +" ! Annotation options box resources.", +" ! ------------------------------------", +" *annOptsGroup.outerOffset: 7", +" *annOptsGroup.innerOffset: 5", +" *annOptsGroup*onIcon: square1s", +" *annOptsGroup*offIcon: square0s", +" *annOptsGroup.label: Annotation Options", +" *annOptsGroup*TextToggle.width: 90", +" *annOptsGroup*TextToggle.highlightColor: yellow", +" *annOptsGroup*Frame.frameType: sunken", +" *annOptsGroup*Frame.frameWidth: 1", +" *annOptsGroup*Frame.width: 300", +" *annOptsGroup*Text*editType: edit", +" *annOpts.frameWidth: 2", +" *annOpts.location: 0 0 400 70", +" *annOpts.layout: vertical { \\", +" 2 \\", +" horizontal { \\", +" 5 annotateButton 2 titleButton 2 bordersButton 2 colorbarButton 5 \\", +" } \\", +" 3 \\", +" horizontal { -1 titleLabel 2 titleFrame < +inf -inf * > -1 } \\", +" -1 \\", +" }", +" *annotateButton.label: \\ Annotate", +" *titleButton.label: \\ Title", +" *bordersButton.label: \\ Borders", +" *colorbarButton.label: \\ Colorbar", +" *titleLabel.label: Title String", +" *titleString*string: imtitle", +" *titleString*height: 23", +" *titleString*Text*editType: edit", +"", +"", +" ! Output color box resources.", +" ! ------------------------------", +" *printColorGroup.location: 0 0 150 90", +" *printColorGroup.outerOffset: 7", +" *printColorGroup.frameWidth: 2", +" *printColorGroup*offIcon: diamond0s", +" *printColorGroup*onIcon: diamond1s", +" *printColorGroup*highlightColor: cyan", +" *printColorGroup.innerOffset: 5", +" *printColorGroup.label: Output Color", +" *printColorGroup*TextToggle.width: 110", +" *printColor.frameWidth: 2", +" *printColor.location: 0 0 250 75", +" *printColor.layout: horizontal { \\", +" 1 \\", +" vertical { -1 prGrayButton 2 prPseudoButton 2 prRGBButton -1 } \\", +" -1 \\", +" }", +" *prGrayButton.label: Grayscale", +" *prPseudoButton.label: PseudoColor", +" *prRGBButton.label: RGB", +"", +" ! Printer Selection.", +" ! --------------------------", +" *printerGroup.label: Printers", +" *printerGroup.location: 0 0 110 130", +" *printerGroup.shrinkToFit: True", +" *printerGroup.outerOffset: 7", +"", +" *printers*Viewport.allowVert: True", +" *printers*Viewport.allowHoriz: False", +" *printers*Viewport.useRight: True", +" *printers*Viewport.resizeable: True", +" *printers*Scrollbar.width: 17", +" *printers*Scrollbar.minimumThumb: 10", +" *printers.layout: vertical { \\", +" 3 < -3 > \\", +" horizontal { \\", +" 2 < -2 > \\", +" printlistFrame < +inf -inf * +inff -inff > \\", +" 2 < -2 > \\", +" } \\", +" 3 < -3 > \\", +" }", +"", +" *printers*frameType: sunken", +" *printers*frameWidth: 1", +" *printers*BorderWidth: 0", +" *printers*Label.ShadowWidth: 0", +"", +" *printlist.width: 100", +" *printlist.height: 78", +"", +"", +" ! Panel command resources.", +" ! ------------------------------", +" *cmdGroup.frameType: chiseled", +" *cmdGroup.frameWidth: 2", +" *cmdGroup.outerOffset: 5", +" *cmdGroup.innerOffset: 5", +" *cmdGroup.label:", +" *cmdGroup.location: 0 0 150 50", +" *cmdLayout.borderWidth: 0", +" *cmdLayout*Command.internalWidth: 12", +" *cmdLayout.layout: horizontal { \\", +" 2 \\", +" okayPrint 1 < +inf > printStatus < +inf -inf * +inf -inf > \\", +" 2 \\", +" }", +" *cmdGroup*TextButton*location: 0 0 80 0", +" *okayPrint.label: Print", +"}", +"", +"", +"set Resources(info_panel) { \\", +"", +" !--------------------", +" ! Information Panel", +" !--------------------", +" *infoLayout*borderWidth: 0", +" *infoLayout*Frame.frameType: sunken", +" *infoLayout*Frame.frameWidth: 1", +" *infoLayout*Command.internalWidth: 12", +" *infoLayout*Text*editType: read", +" *infoLayout*Text*scrollVertical: whenNeeded", +" *infoLayout*Text*scrollHorizontal: whenNeeded", +" *infoLayout*Text*displayCaret: False", +" *infoLayout*Scrollbar.background: #c4c4c4", +" *infoLayout*Scrollbar.width: 17", +" *infoLayout*Scrollbar.height: 17", +"", +" *infoText.height: 240", +" *infoText*font: 6x13", +" *infoLayout.layout: vertical { \\", +" infoBox < +inf -inf * > \\", +" }", +"", +" *infoBox.label:", +" *infoBox.outerOffset: 0", +" *infoBox.innerOffset: 3", +" *infoBoxL*TextToggle.frameType: raised", +" *infoBoxL*TextToggle.frameWidth: 1", +" *infoBoxL*TextToggle*outerOffset: 0", +" *infoBoxL*TextToggle*innerOffset: 1", +" *infoBoxL*TextToggle.location: 0 0 100 25", +" *infoBoxL*TextToggle*onIcon: square1s", +" *infoBoxL*TextToggle*offIcon: square0s", +" *infoBoxL*TextToggle*highlightColor: cyan", +" *infoBoxL.layout: vertical { \\", +" infoFrame < +inf -inf * +inf -inf > 1 \\", +" 4 \\", +" horizontal { \\", +" infoOptFr < +inf -inf * > 1 \\", +" infoOptSvr < +inf -inf * > 1 \\", +" infoOptClients < +inf -inf * > 1 \\", +" infoOptWCS < +inf -inf * > 1 \\", +" infoOptIsm < +inf -inf * > 1 \\", +" infoOptFB < +inf -inf * > \\", +" }\\", +" 2 \\", +" }", +" *infoOptFr.label: Frame", +" *infoOptFr.on: True", +" *infoOptSvr.label: Server", +" *infoOptWCS.label: WCS", +" *infoOptIsm.label: ISM", +" *infoOptClients.label: Clients", +" *infoOptFB.label: Imtoolrc", +"}", +"", +"", +"", +"set Resources(load_panel) { \\", +"", +" !-------------------------------", +" ! File Load Control Panel.", +" !-------------------------------", +" *filesLayout*borderWidth: 0", +" *filesLayout*Group.shrinkToFit: True", +" *filesLayout*Group.frameType: chiseled", +" *filesLayout*Frame*frameType: sunken", +" *filesLayout*Frame*frameWidth: 1", +" *filesLayout*TextToggle.frameWidth: 0", +" *filesLayout*TextToggle.height: 28", +" *filesLayout*TextToggle.alignment: left", +" *filesLayout*TextToggle.ledtMargin: 3", +" *filesLayout*SimpleMenu.borderWidth: 1", +" *filesLayout*SimpleMenu.borderColor: black", +" *filesLayout*SimpleMenu.foreground: White", +" *filesLayout*SimpleMenu.background: SteelBlue", +" *filesLayout*Label.borderWidth: 0", +" *filesLayout*Label.shadowWidth: 0", +" *filesLayout.layout: vertical { \\", +" imlistGroup < +inf -inf * > \\", +" 3 \\", +" horizontal { -5 imoptsGroup < +inf -inf * > -5 } \\", +" -1 \\", +" loadCmdGroup < +inf -inf * > \\", +" }", +"", +" *imlistGroup.label:", +" *imlistGroup.frameWidth: 2", +" *imlistGroup.outerOffset: 2", +" *imlistLayout*Label.shadowWidth: 0", +" *imlistLayout*Label.justify: left", +" *imlistLayout*Command.width: 90", +" *imlistLayout*Command.height: 23", +" *imlistLayout*Command.shadowWidth: 1", +" *imlistLayout*Viewport.allowVert: True", +" *imlistLayout*Viewport.allowHoriz True", +" *imlistLayout*Viewport.useRight: True", +" *imlistLayout*Viewport.useBottom: True", +" *imlistLayout*Viewport.resizeable: True", +" *imlistLayout*Scrollbar.height: 17", +" *imlistLayout*Scrollbar.width: 17", +" *imlistLayout.layout: vertical { \\", +" 3 \\", +" horizontal { \\", +" 3 \\", +" rootButton < +inf -inf * > 1 \\", +" homeButton < +inf -inf * > 1 \\", +" upButton < +inf -inf * > 1 \\", +" rescanButton < +inf -inf * > \\", +" 3 \\", +" imtemplateLabel 3 imtemplateFrame < +inf -inf * > \\", +" 3 \\", +" } \\", +" 5 \\", +" horizontal { 1 imlistLabel < +inf -inf * > 1 } \\", +" imlistFrame < +inf -inf * +inf -inf > \\", +" 3 \\", +" dirLabel < +inf -inf * > \\", +" 3 \\", +" horizontal { 5 fnameLabel 5 filnamFrame < +inf -inf * > } \\", +" 3 \\", +" }", +" *imtemplateLabel.label: Filter:", +" *imtemplateText*editType: edit", +" *imtemplateText*height: 23", +" *imtemplateText*font: 7x13", +" !*imageList.width: 100", +" *imageList*height: 140", +" *imageList.shadeSurplus: False", +" *imageList.defaultColumns: 3", +" *imageList.font: 7x13", +" *imlistView.resizeable: True", +" *imlistLabel.height: 0", +" *imlistLabel.label: xxx", +" *imlistLabel.justify: left", +" *imlistLabel.font: *lucida-bold-r*10*", +" *upButton.label: Up", +" *rootButton.label: Root", +" *homeButton.label: Home", +" *rescanButton.label: Rescan", +" *dirLabel.label: \\ \\ Directory:", +" *dirLabel.alignment: left", +" *fnameLabel.label: Load File:", +" *fnameText*editType: edit", +" *fnameText.height: 22", +"", +" *imoptsGroup.label: Options", +" *imoptsGroup.frameWidth: 2", +" *imoptsGroup.outerOffset: 7", +" *imoptsGroup*offIcon: square0s", +" *imoptsGroup*onIcon: square1s", +" *imoptsGroup*highlightColor: yellow", +" *imoptsLayout*Label.shadowWidth: 0", +" *imoptsLayout*Label.justify: left", +" *imoptsLayout.layout: vertical { \\", +" 3 \\", +" horizontal { \\", +" 3 \\", +" autoload 6 grayscale \\", +" 3 < +inf > \\", +" browseHdrs \\", +" 3 < +inf > \\", +" frameLabel 2 frameFrame \\", +" 3 \\", +" } \\", +" 6 \\", +" horizontal { \\", +" 3 \\", +" zscale 6 zrange \\", +" 3 \\", +" z1Label z1Frame < +inf * > 2 \\", +" z2Label z2Frame < +inf * > 2 \\", +" nsampLabel nsampFrame < +inf * > \\", +" 3 \\", +" } \\", +" 3 \\", +" }", +" *grayscale.label: Auto Grayscale", +" *grayscale.location: 0 0 100 22", +" *autoload.label: Auto Load", +" *autoload.location: 0 0 80 22", +" *autoload.on: True", +" *browseHdrs.label: List Image Headers", +" *browseHdrs.location: 0 0 120 22", +" *browseHdrs.on: False", +" *zscale.label: Zscale", +" *zscale.location: 0 0 60 22", +" *zrange.label: Zrange", +" *zrange.location: 0 0 60 22", +" *z1Label.label: z1", +" *z1Value*width: 60", +" *z1Value*height: 22", +" *z1Value*editType: edit", +" *z2Label.label: z2", +" *z2Value*width: 60", +" *z2Value*height: 22", +" *z2Value*editType: edit", +" *nsampLabel.label: Nsample", +" *nsampValue*width: 60", +" *nsampValue*height: 22", +" *nsampValue*editType: edit", +" *frameLabel.label: Frame:\\ ", +" *frameFrame.width: 50", +" *frameFrame.resize: False", +" *frameFrame.label: Current", +" *frameFrame.font: 6x13", +" *frameFrame.menuName: loadFrames", +"", +"", +" *loadCmdGroup.label:", +" *loadCmdGroup*frameWidth: 2", +" *loadCmdGroup*outerOffset: 5", +" *loadCmdGroup.outerOffset: 2", +" *loadCmdGroup*innerOffset: 5", +" *loadCmdGroup.frameType: sunken", +" *loadCmdGroup.label:", +" *loadCmdGroup.location: 0 0 400 45", +" *loadCmdLayout*Command.internalWidth: 12", +" *loadCmdLayout.layout: horizontal { \\", +" 2 \\", +" filesLoadButton \\", +" 1 < +inf > \\", +" filesStatus \\", +" 2 \\", +" }", +" *filesLoadButton.label: Load", +" *filesStatus.label:", +"}", +"", +"", +"", +"set Resources(save_panel) { \\", +"", +" !=====================================", +" ! Save Setup Panel resources. !", +" !=====================================", +" *save_panel*TextToggle.alignment: left", +" *save_panel*TextToggle.frameWidth: 0", +" *save_panel*TextToggle.height: 20", +" *save_panel*Label.borderWidth: 0", +" *save_panel*Label.shadowWidth: 0", +" *save_panel*TextButton.width: 80", +"", +" *saveLayout.borderWidth: 0", +" *saveLayout.layout: vertical { \\", +" saveNameGroup < +inf * > \\", +" saveOptGroup < +inf -inf * > -3 \\", +" saveCmdGroup < +inf * > \\", +" }", +"", +" ! Save Name Group resources.", +" !----------------------------------", +" *saveNameGroup.borderWidth: 0", +" *saveNameGroup.outerOffset: 5", +" *saveNameGroup.label:", +" *saveNameGroup.location: 0 0 400 50", +" *saveNameGroup*offIcon: diamond0s", +" *saveNameGroup*onIcon: diamond1s", +" *saveNameGroup*highlightColor: cyan", +" *saveNameGroup*Frame.frameType: sunken", +" *saveNameGroup*Frame.frameWidth: 1", +" *saveNameGroup*Label.justify: right", +" *saveNameGroup*Text*editType: edit", +" *saveNameGroup*shadowWidth: 0", +" *saveNameGroup*borderWidth: 0", +" *saveNameLayout.borderWidth: 0", +" *saveNameLayout.layout: vertical { \\", +" 2 \\", +" horizontal { 5 saveLabel 5 fnameFrame < +inf -inf * > 5 } \\", +" 2 \\", +" }", +" *saveLabel.label: File Name:", +" *saveFile.height: 22", +"", +" ! Main options groups layout resources.", +" !---------------------------------------", +" *saveOptGroup.frameWidth: 2", +" *saveOptGroup.frameType: chiseled", +" *saveOptGroup.label:", +" *saveOptGroup.location: 0 0 400 140", +" *saveOptGroup.outerOffset: 5", +" *saveOptGroup.innerOffset: 0", +" *saveOptLayout*borderWidth: 0", +" *saveOptLayout.layout: horizontal { \\", +" -1 \\", +" vertical { 5 < -5 > fmtGroup < +inf * +inf > -1 } \\", +" -1 \\", +" vertical { \\", +" 10 < -10 > \\", +" saveDataBox < +inff -inff * +inff -inff > \\", +" 5 < -5 > \\", +" } \\", +" -1 \\", +" vertical { 5 < -5 > saveColorGroup < +inf * +inf > -1 } \\", +" -1 \\", +" }", +"", +" ! Output color box resources.", +" ! ------------------------------", +" *saveColorGroup.location: 0 0 140 120", +" *saveColorGroup.outerOffset: 7", +" *saveColorGroup.frameWidth: 2", +" *saveColorGroup*offIcon: diamond0s", +" *saveColorGroup*onIcon: diamond1s", +" *saveColorGroup*highlightColor: cyan", +" *saveColorGroup.innerOffset: 5", +" *saveColorGroup.label: Output Color", +" *saveColorGroup*TextToggle.width: 110", +" *saveColor.frameWidth: 2", +" *saveColor.layout: horizontal { \\", +" 3 \\", +" vertical { 5 svGrayButton 2 svPseudoButton 2 svRGBButton -1 } \\", +" -1 \\", +" }", +" *svGrayButton.label: Grayscale", +" *svPseudoButton.label: PseudoColor", +" *svRGBButton.label: RGB", +"", +" *saveDataBox.frameType: sunken", +" *saveDataBox.frameWidth: 1", +"", +"", +" ! Output format box resources.", +" ! -----------------------------------", +" *fmtGroup.location: 0 0 140 120", +" *fmtGroup.outerOffset: 7", +" *fmtGroup.frameWidth: 2", +" *fmtGroup*offIcon: diamond0s", +" *fmtGroup*onIcon: diamond1s", +" *fmtGroup*TextToggle.width: 55", +" *fmtGroup*highlightColor: cyan", +" *fmtGroup.label: File Format", +" *formats.layout: horizontal { \\", +" 3 \\", +" vertical { 5 fitsButton 2 gifButton 2 tiffButton 2 rawButton 1 } \\", +" 2 < -2 > \\", +" vertical { 5 epsButton 2 rasButton 2 x11Button 2 jpegButton 1 } \\", +" -1 \\", +" }", +" *rasButton.label: RAS", +" *gifButton.label: GIF", +" *jpegButton.label: JPEG", +" *tiffButton.label: TIFF", +" *fitsButton.label: FITS", +" *x11Button.label: X11", +" *epsButton.label: EPS", +" *rawButton.label: Raw", +"", +" ! Change the sensitivity once these formats are implemented. !", +" !-------------------------------------------------------------", +" *jpegButton.sensitive: False", +" *x11Button.sensitive: False", +" *rawButton.sensitive: False", +"", +"", +" ! Panel command resources.", +" ! ------------------------------", +" *saveCmdLayout.borderWidth: 0", +" *saveCmdGroup.frameType: chiseled", +" *saveCmdGroup.frameWidth: 2", +" *saveCmdGroup.outerOffset: 5", +" *saveCmdGroup.innerOffset: 5", +" *saveCmdGroup.label:", +" *saveCmdGroup.location: 0 0 400 50", +" *saveCmdLayout*Command.internalWidth: 12", +" *saveCmdLayout.layout: horizontal { \\", +" 2 \\", +" okaySave 1 < +inf -1 > saveStatus < +inf -inf * > \\", +" 2 \\", +" }", +" *okaySave.label: Save", +"}", +"", +"", +"set Resources(tile_panel) { \\", +"", +" *tileOpts.frameType: chiseled", +" *tileOpts.frameWidth: 2", +" *tileOpts.outerOffset: 5", +" *tileOpts.innerOffset: 7", +" *tileOpts*shrinkToFit: True", +" *tileOpts*borderWidth: 0", +"", +" *toptLayout.layout: vertical { \\", +" horizontal { -6 tFramesG < +inf -inf * > -6 } \\", +" horizontal { \\", +" -1 \\", +" horizontal { -6 tileMode < * +inf -inf > -6 } \\", +" vertical { \\", +" horizontal { -3 userOrientG < +inf -inf * > -3 } \\", +" horizontal { -3 fillStyle < +inf -inf * > -3 } \\", +" horizontal { -3 tileLabel < +inf -inf * > -3 } \\", +" -7 \\", +" horizontal { -3 geomFrame < +inf -inf * > -3 } \\", +" } \\", +" -1 \\", +" } \\", +" -4 \\", +" }", +" *tileMode.label: Tile Mode", +" *tileMode.outerOffset: 7", +" *tileMode.innerOffset: 5", +" *tileMode*location: 0 0 150 20", +" *tileMode*TextToggle.outerOffset: 2", +" *tileMode*TextToggle.innerOffset: 1", +" *tileMode*TextToggle.frameWidth: 0", +" *tileMode*TextToggle.leftMargin: 10", +" *tileMode*TextToggle.rightMargin: 20", +" *tileMode*TextToggle.onIcon: diamond1s", +" *tileMode*TextToggle.offIcon: diamond0s", +" *tileMode*TextToggle.highlightColor: yellow", +"", +" *tileDisabled.label: Disabled", +" *tileManual.label: Manual", +" *tileBest.label: Best", +" *tileSquare.label: Square", +" *tileHorizontal.label: Horizontal", +" *tileVertical.label: Vertical", +" *tileRow.label: One Row", +" *tileCol.label: One Column", +"", +" *fillStyle.label: Fill Style", +" *fillStyle.location: 0 0 160 30", +" *fillStyle.outerOffset: 7", +" *fillStyle.innerOffset: 5", +" *fillStyle.rows: 1", +" *fillStyle*selectionStyle: multi", +" *fillStyle*outerOffset: 0", +" *fillStyle*innerOffset: 1", +" *fillStyle*leftMargin: 7", +" *fillStyle*onIcon: square1s", +" *fillStyle*offIcon: square0s", +" *fillStyle*highlightColor: yellow", +" *fillStyle.TextToggle.frameWidth: 0", +" *fillStyle.TextToggle.location: 0 0 85 23", +" *byCols.label: Fill by Columns", +" *bottomUp.label: Fill from Bottom", +"", +" *tileLabel.label: Tile Labels", +" *tileLabel.location: 0 0 175 30", +" *tileLabel.outerOffset: 7", +" *tileLabel.innerOffset: 5", +" *tileLabel.rows: 1", +" *tileLabel*selection: -1", +" *tileLabel*outerOffset: 0", +" *tileLabel*innerOffset: 1", +" *tileLabel*leftMargin: 7", +" *tileLabel*onIcon: square1s", +" *tileLabel*offIcon: square0s", +" *tileLabel*highlightColor: yellow", +" *tileLabel.TextToggle.frameWidth: 0", +" *tileLabel.TextToggle.location: 0 0 85 23", +" *labelFrames.label: Frameno", +" *labelImname.label: Img Name", +" *labelTitles.label: Img Title", +"", +" *geomFrame.frameWidth: 0", +" *geomFrame.frameType: sunken", +" *geomFrame.outerOffset: 7", +" *geomFrame.innerOffset: 4", +" *tileGeometry.width: 220", +" *tileGeometry.height; 37", +" *tileGeometry.background: #c4c4c4", +" *tileGeometry.font: 7x13bold", +" *tileGeometry.label: Tile Geometry: 1 x 2", +"", +" *userOrientG.label: Manual Configuration", +" *userOrientG.height: 90", +" *userOrientG.width: 220", +" *userOrientG.outerOffset: 7", +" *userOrientG.innerOffset: 5", +" *userOrientG.shrinkToFit: True", +" *userOrientG*Frame.frameWidth: 1", +" *userOrientG*Frame.frameType: sunken", +" *userOrientG*Text.height: 21", +" *userOrientG*Text*editType: edit", +" *userOrientL.borderWidth: 0", +" *userOrientL.layout: vertical { \\", +" 1 \\", +" horizontal { 18 nrowLab < +50% -inf * > nrFrame < +inf -inf * > 5 } \\", +" 1 \\", +" horizontal { ncolLab < +50% -inf * > ncFrame < +inf -inf * > 5 } \\", +" }", +" *nrowLab.justify: right", +" *ncolLab.justify: right", +"", +" *nrLayout.layout: horizontal {nrdecrease nrtext < +inf -inf * > nrincrease}", +" *nrdecrease.direction: left", +" *nrincrease.direction: right", +" *nrowLab.label: Tile Rows:", +" *nrtext.background: #adadad", +" *nrtext.justify: center", +" *nrtext.font: 7x13bold", +" *nrtext.label: 1", +"", +" *ncLayout.layout: horizontal {ncdecrease nctext < +inf -inf * > ncincrease}", +" *ncdecrease.direction: left", +" *ncincrease.direction: right", +" *ncolLab.label: Tile Columns:", +" *nctext.background: #adadad", +" *nctext.justify: center", +" *nctext.font: 7x13bold", +" *nctext.label: 2", +"", +" *tFramesG.label: Tile Frames", +" *tFramesG.outerOffset: 7", +" *tFramesG.innerOffset: 7", +" *tFrames.borderWidth: 0", +" *tFrames*Toggle.height: 17", +" *tFrames.layout: horizontal { \\", +" tAll \\", +" 2 \\", +" tFrame1 tFrame2 tFrame3 tFrame4 tFrame5 \\", +" tFrame6 tFrame7 tFrame8 tFrame9 tFrame10 \\", +" tFrame11 tFrame12 tFrame13 tFrame14 tFrame15 tFrame16 \\", +" 2 \\", +" tNone \\", +" }", +" *tAll.label: All\\ ", +" *tNone.label: None", +"}", +"", +"", +"set Resources(wcs_panel) { \\", +"", +" !--------------------", +" ! WCS Readout Panel", +" !--------------------", +" *wcsGroup*TextToggle.offIcon: square0s", +" *wcsGroup*TextToggle.onIcon: square1s", +"", +" !*wcsLayout*TextToggle.location: 0 0 160 23", +" *wcsLayout*TextToggle.height: 23", +" *wcsLayout*TextToggle.outerOffset: 0", +" *wcsLayout*Layout.borderWidth: 0", +" *wcsLayout.borderWidth: 0", +" *wcsLayout.layout: vertical { \\", +" 0 < +0 -0 > \\", +" wcsGroup < +inf -inf * > \\", +" 5 \\", +" horizontal { -1 wcsOptGroup < +inf -inf * > -1 } \\", +" -2 \\", +" }", +"", +" *wcsOptGroup.label:", +" *wcsOptGroup.outerOffset: 0", +" *wcsOptGroup.innerOffset: 5", +" *wcsOptGroup.frameType: chiseled", +" *wcsOptGroup.frameWidth: 0", +" *wcsOptLayout.layout: vertical { \\", +" horizontal { -9 wcsCoords < +inf -inf * > -9 } \\", +" -3 \\", +" horizontal { -5 wcsOpts < +inf -inf * > -5 } \\", +" horizontal { -5 wcsIsmGroup < +inf -inf * > -5 } \\", +" 1 \\", +" }", +"", +" *wcsOpts.label:", +" *wcsOpts.width: 265", +" *wcsOpts.height: 40", +" *wcsOpts.outerOffset: 3", +" *wcsOpts.innerOffset: 3", +" *woLayout*TextToggle.frameWidth: 0", +" *woLayout*TextToggle.onIcon: square1s", +" *woLayout*TextToggle.offIcon: square0s", +" *woLayout*TextToggle.highlightColor: cyan", +" *woLayout*TextToggle.alignment: left", +" *woLayout*TextToggle.leftMargin: 5", +" *woLayout.layout: horizontal { \\", +" 3 \\", +" woptLabels < +inf -inf * > 2 \\", +" woptTitles < +inf -inf * > 2 \\", +" woptFBinfo < +inf -inf * > 2 \\", +" woptBPM < +inf -inf * > \\", +" 3 \\", +" }", +" *woptLabels.label: WCS Labels", +" *woptLabels.on: True", +" *woptTitles.label: Image Titles", +" *woptTitles.on: True", +" *woptFBinfo.label: Frame Buffer Info", +" *woptFBinfo.on: True", +" *woptBPM.label: BPM Data", +" *woptBPM.on: False", +" *woptLabels.location: 0 0 150 21", +" *woptTitles.location: 0 0 150 21", +" *woptFBinfo.location: 0 0 175 21", +" *woptBPM.location: 0 0 120 21", +"", +"", +" *wcsCoords.label: Readout Values", +" *wcsCoords.width: 265", +" *wcsCoords.height: 135", +" *wcsCoords.outerOffset: 7", +" *wcsCoords.innerOffset: 3", +" *wcLayout*TextToggle.offIcon: diamond0s", +" *wcLayout*TextToggle.onIcon: diamond1s", +" *wcLayout*TextToggle.highlightColor: yellow2", +" *wcLayout*TextToggle.shrinkToFit: True", +" *wcLayout*TextToggle.frameWidth: 0", +" *wcLayout*TextToggle.label:", +" *wcLayout*TextToggle.on: True", +" *wcLayout*Label.justify: right", +" *wcLayout*Label.font: 7x13bold", +" *wcLayout*SimpleMenu.borderColor: black", +" *wcLayout*SimpleMenu.borderWidth: 1", +" *wcLayout*SimpleMenu.foreground: White", +" *wcLayout*SimpleMenu.background: SteelBlue", +" *wcLayout*MenuButton.shadowWidth: 1", +" *wcLayout*MenuButton.resize: False", +" *wcLayout.layout: vertical {\\", +" 1 \\", +" horizontal { 20 < -20 > wcTitle < +inf -inf * > 20 < -20 > }\\", +" 1 \\", +" horizontal { 5 wcLine < +inf -inf * > 5 } \\", +" 5 \\", +" horizontal { \\", +" 10 \\", +" vertical { 2 wlWcs1 2 wlWcs2 2 wlWcs3 2 wlWcs4 2 } 5 \\", +" vertical { 1 sysWcs1 1 sysWcs2 1 sysWcs3 1 sysWcs4 1 } 5 \\", +" vertical { 1 fmtWcs1 1 fmtWcs2 1 fmtWcs3 1 fmtWcs4 1 } 20 \\", +" vertical { 1 wpWcs1 3 wpWcs2 3 wpWcs3 3 wpWcs4 3 } 20 \\", +" vertical { 1 wiWcs1 3 wiWcs2 3 wiWcs3 3 wiWcs4 3 } 15 \\", +" } \\", +" 3 \\", +" }", +" *wcTitle.label: Type\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ Format\\ \\ \\ \\ \\ \\ Panel\\ ImgWin", +"", +" *wcLine.height: 2", +" *wcLine.frameWidth: 2", +" *wcLine.frameType: ledged", +"", +" *wlWcs1.label: First WCS", +" *wlWcs2.label: Second WCS", +" *wlWcs3.label: Third WCS", +" *wlWcs4.label: Fourth WCS", +" *sysWcs1.label: \\ Image Display\\ ", +" *sysWcs1.menuName: sysMenu1", +" *sysWcs2.label: None", +" *sysWcs2.menuName: sysMenu2", +" *sysWcs3.label: None", +" *sysWcs3.menuName: sysMenu3", +" *sysWcs4.label: None", +" *sysWcs4.menuName: sysMenu4", +" *fmtWcs1.label: \\ Sexigesimal\\ ", +" *fmtWcs1.menuName: fmtMenu1", +" *fmtWcs2.label: None", +" *fmtWcs2.menuName: fmtMenu2", +" *fmtWcs3.label: None", +" *fmtWcs3.menuName: fmtMenu3", +" *fmtWcs4.label: None", +" *fmtWcs4.menuName: fmtMenu4", +"", +" *editMenu fmtWcsMenu$i fmtWcs$i $items", +"", +" *wcsIsmGroup.label:", +" *wcsIsmGroup.width: 395", +" *wcsIsmGroup.height: 50", +" *wcsIsmGroup.outerOffset: 3", +" *wcsIsmGroup.innerOffset: 5", +" *wcsIsmGroup*borderWidth: 0", +" *wcsIsmLayout.layout: horizontal { \\", +" wcsIsmLabel 1 wcsIsmFrame < +inf -inf * > 3 wcsIsmInit 1 \\", +" }", +" *wcsIsmLabel.label: ISM Command", +" *wcsIsmFrame.frameType: sunken", +" *wcsIsmFrame.frameWidth: 1", +" *wcsIsmFrame.outerOffset: 1", +" *wcsIsmFrame*height: 23", +" *wcsIsmCmd*editType: edit", +" *wcsIsmCmd.displayCaret: True", +" *wcsIsmInit.label: Initialize", +" *wcsIsmInit.internalWidth: 7", +"", +" *wcsBox*borderWidth: 0", +" *wcsBox*TextToggle.frameType: raised", +" *wcsBox*TextToggle.frameWidth: 1", +" *wcsBox*TextToggle.leftMargin: 2", +" *wcsBox*borderWidth: 0", +" *wcsBox.layout: vertical { \\", +" wcsFrame < +inf -inf * > \\", +" 2 \\", +" horizontal { \\", +" 2 \\", +" ismToggle < +inf -inf * > 2 \\", +" pixelTable < +inf -inf * > 2 \\", +" imageHeader < +inf -inf * > 2 \\", +" compass < +inf -inf * > 2 \\", +" wcsOptions < +inf -inf * > \\", +" 2 \\", +" } \\", +" }", +" *ismToggle.label: ISM Mod", +" *ismToggle.label: WCS/Pix", +" *pixelTable.label: Pix Table", +" *imageHeader.label: Header", +" *imageHeader.sensitive: False", +" *compass.label: Compass", +" *wcsOptions.label: Options", +"", +" *wcsGroup.label:", +" *wcsGroup.outerOffset: 0", +" *wcsGroup.innerOffset: 5", +" *wcsGroup.frameType: chiseled", +" *wcsGroup.frameWidth: 2", +" *wcsGroup*Text*width: 260", +" *wcsGroup*Text*height: 17", +" *wcsGroup*Text*font: 7x13", +" *wcsGroup*Text*displayCaret: False", +" *wcsGroup*Text*editType: read", +" *wcsGroup*Text*background: black", +" *wcsGroup*Text*foreground: yellow2", +" *wcsGroup*TextToggle.highlightColor: cyan", +" *wcsFrame.frameType: sunken", +" *wcsFrame.frameWidth: 1", +" *wcsText*background: yellow4", +" *wcsText.layout: vertical { \\", +" wtName < +inf -inf * > -3 \\", +" wtTitle < +inf -inf * > -3 \\", +" wtFBCfg < +inf -inf * > \\", +" 1 < -1 > \\", +" wtWcs1 < +inf -inf * > -3 \\", +" wtWcs2 < +inf -inf * > -3 \\", +" wtWcs3 < +inf -inf * > -3 \\", +" wtWcs4 < +inf -inf * > \\", +" 1 < -1 > \\", +" horizontal { \\", +" wtIPixval < +inf -inf * +inf > 1 \\", +" wtSPixval < +inf -inf * +inf > 1 \\", +" wtBPixval < +inf -inf * +inf > \\", +" } \\", +" }", +"}", +"", +"", +"set Resources(blink_panel) { \\", +"", +" *blink_panel.geometry: 425x200", +" *blink_panel.title: Blink/Register Frames", +"", +" *brMenuBar*Command.internalHeight: 4", +" *brMenuBar*Command.internalWidth: 12", +" *brMenuBar*Command.height: 27", +" *brMenuBar*borderWidth: 0", +"", +" *brMenuBar*Label.font: 7x13bold", +" *brLayout*Command.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *brRegButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *brReset.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *brMatchButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *brBlinkButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +" *brAregButton.font: -*-helvetica-medium-r-normal-*-12-*-iso8859-1", +"", +"", +" *brMenuBar.layout: vertical { \\", +" 5 < -5 > \\", +" horizontal { 10 < +inf -10> brClose 5 } \\", +" 5 < -5 > \\", +" }", +" *brClose.label: Dismiss", +"", +" *brMenuFrame.frameType: raised", +" *brMenuFrame.frameWidth: 2", +" *bpLayout.layout: vertical { \\", +" brMenuFrame < +inf -inf * > \\", +" 1 < -1 > \\", +" brFrame < +inf -inf * +inf -inf > \\", +" }", +"", +" *brFrame.frameType: chiseled", +" *brFrame.frameWidth: 2", +" *brFrame.outerOffset: 4", +" *brFrame.innerOffset: 4", +"", +" *brLayout.borderWidth: 0", +" *brLayout.layout: vertical { \\", +" 3 < -3 > \\", +" horizontal { -3 brFramesG < +inf -inf * > -3 } \\", +" -5 \\", +" horizontal { -3 brCmdG < +inf -inf * +inf -inf > -3 } \\", +" -5 \\", +" }", +"", +" *brCmdG.label:", +" *brCmdG.outerOffset: 7", +" *brCmdG.innerOffset: 7", +" *brCmdG*borderWidth: 0", +" *brCmd.layout: horizontal { \\", +" 2 \\", +" vertical { \\", +" 2 \\", +" horizontal { \\", +" 2 \\", +" brRateLabel \\", +" 2 \\", +" brBRframe < +inf -inf * >\\", +" 4 \\", +" brReset \\", +" 2 \\", +" } \\", +" 8 < -8 > \\", +" horizontal { \\", +" 4 \\", +" brMatchButton < +inf -inf * > \\", +" 5 < -5 > \\", +" brRegButton < +inf -inf * > \\", +" 2 \\", +" } \\", +" 1 < +inf > \\", +" } \\", +" 10 \\", +" vertical { \\", +" 2 \\", +" brBlinkButton < +inf * > \\", +" 10 < -10 > \\", +" brAregButton < +inf * > \\", +" 1 < +inf > \\", +" } \\", +" 2 \\", +" }", +"", +" *brFramesG.label: Frames List", +" *brFramesG.outerOffset: 7", +" *brFramesG.innerOffset: 7", +" *brFramesG*SimpleMenu.borderColor: black", +" *brFramesG*SimpleMenu.borderWidth: 1", +" *brFramesG*SimpleMenu.foreground: White", +" *brFramesG*SimpleMenu.background: SteelBlue", +"", +" *brFrames.borderWidth: 0", +" *brFrames.layout: horizontal { \\", +" 5 < +inf > \\", +" brFrame1 < +inf * > 1 \\", +" brFrame2 < +inf * > 1 \\", +" brFrame3 < +inf * > 1 \\", +" brFrame4 < +inf * > 1 \\", +" brFrame5 < +inf * > 1 \\", +" brFrame6 < +inf * > 1 \\", +" brFrame7 < +inf * > 1 \\", +" brFrame8 < +inf * > 1 \\", +" brFrame9 < +inf * > 1 \\", +" brFrame10 < +inf * > 1 \\", +" brFrame11 < +inf * > 1 \\", +" brFrame12 < +inf * > 1 \\", +" brFrame13 < +inf * > 1 \\", +" brFrame14 < +inf * > 1 \\", +" brFrame15 < +inf * > 1 \\", +" brFrame16 < +inf * > \\", +" 5 < +inf > \\", +" }", +"", +" *brBRlayout.layout: horizontal { \\", +" brBRdecrease \\", +" brBRtext < +inf -100% * > \\", +" brBRincrease \\", +" }", +"", +" *blink_panel*TextToggle.location: 0 0 110 23", +" *blink_panel*TextToggle.frameWidth: 1", +" *blink_panel*TextToggle.highlightColor: yellow", +" *blink_panel*TextToggle.offIcon: square0s", +" *blink_panel*TextToggle.onIcon: square1s", +" *blink_panel*TextToggle.outerOffset: 0", +" *blink_panel*TextToggle.innerOffset: 2", +" *blink_panel*Command.height: 23", +" *blink_panel*Arrow.width: 16", +" *blink_panel*Arrow.height: 20", +"", +"", +" *brFramesLabel.label: Frames:", +" *brFrame1.menuName: frame1Menu", +" *brFrame2.menuName: frame2Menu", +" *brFrame3.menuName: frame3Menu", +" *brFrame4.menuName: frame4Menu", +" *brFrame5.menuName: frame5Menu", +" *brFrame6.menuName: frame6Menu", +" *brFrame7.menuName: frame7Menu", +" *brFrame8.menuName: frame8Menu", +" *brFrame9.menuName: frame9Menu", +" *brFrame10.menuName: frame10Menu", +" *brFrame11.menuName: frame11Menu", +" *brFrame12.menuName: frame12Menu", +" *brFrame13.menuName: frame13Menu", +" *brFrame14.menuName: frame14Menu", +" *brFrame15.menuName: frame15Menu", +" *brFrame16.menuName: frame16Menu", +" *brReset.label: Reset", +"", +" *brRateLabel.label: Rate:", +" *brBRframe.frameType: sunken", +" *brBRframe.frameWidth: 1", +" *brBRtext.width: 40", +" *brBRtext.height: 23", +" *brBRdecrease.direction: left", +" *brBRincrease.direction: right", +" *brRegButton.label: Register", +" *brMatchButton.label: Match LUTs", +" *brBlinkButton.label: Blink", +" *brAregButton.label: Auto-Register", +"}", +"", +"", +"set Resources(hdr_panel) { \\", +"", +" *hdr_panel.geometry: 550x600", +" *hdr_panel.title: Image Header", +"", +" *hdr_panel*SimpleMenu.borderColor: black", +" *hdr_panel*SimpleMenu.borderWidth: 1", +" *hdr_panel*SimpleMenu.foreground: White", +" *hdr_panel*SimpleMenu.background: SteelBlue", +"", +" *hdrMenuFrame.frameType: raised", +" *hdrMenuFrame.frameWidth: 2", +" *hdrLayout.layout: vertical { \\", +" hdrMenuFrame < +inf -inf * > \\", +" hdrObjGroup < +inf -inf * > \\", +" hdrTabFrame < +inf -inf * +inf -inf> \\", +" }", +"", +" *hdrMenuBar*borderWidth: 0", +" *hdrMenuBar*Command.internalHeight: 5", +" *hdrMenuBar*Command.internalWidth: 12", +" *hdrMenuBar.layout: vertical { \\", +" 5 < -5 > \\", +" horizontal { 10 < +inf -10> hdrClose 7 } \\", +" 5 < -5 > \\", +" }", +" *hdrClose.label: Dismiss", +"", +" *hdrObjGroup.label:", +" *hdrObjGroup.outerOffset: 7", +" *hdrObjGroup.innerOffset: 4", +" *hdrObjLayout.borderWidth: 0", +" *hdrObjLayout.layout: vertical { \\", +" horizontal { hdrObjLabel 2 hdrObjMenu < +inf -inf * > 2 } \\", +" }", +" *hdrObjLabel.label: Image Name:", +" *hdrObjMenu.label:", +" *hdrObjMenu.justify: left", +" *hdrObjMenu.font: 7x13", +" *hdrObjMenu.menuName: objMenu", +" *hdrObjMenu.internalWidth: 5", +" *hdrObjMenu.internalHeight: 1", +" *hdrObjMenu.shadowWidth: 1", +"", +" *hdrHdrGroup.tabLabel: Image Header", +" *hdrHdrGroup.label:", +" *hdrHdrGroup.outerOffset: 7", +" *hdrHdrGroup.innerOffset: 5", +" *hdrHdrLayout.borderWidth: 0", +" *hdrHdrLayout.layout: vertical { \\", +" horizontal { \\", +" hdrFilter 2 hFindFrame < +inf -inf * > 2 hdrFind 1 hdrClear \\", +" } \\", +" 5 \\", +" hdrText < +inf -inf * +inf -inf > \\", +" }", +" *hFindEntry*editType: edit", +" *hFindEntry*font: 7x13", +" *hFindEntry*displayCaret: True", +" *hFindEntry*width: 150", +" *hFindFrame.frameWidth: 1", +" *hFindFrame*borderWidth: 0", +" *hFindFrame.frameType: sunken", +" *hFindFrame.width: 150", +" *hFindFrame.height: 23", +" *hdrFilter.label: Keyword Filter", +" *hdrFind.label: Search", +" *hdrClear.label: Clear", +"", +" ! Resources if the header text widget is AsciiText", +"! *hdrText*scrollVertical: Always", +"! *hdrText*scrollHorizontal: Always", +"! *hdrText*editType: edit", +"! *hdrText*font: 7x13", +"! *hdrText*background: #c4c4c4", +"! *hdrText*displayCaret: False", +"! *hdrText*bottomMargin: 10", +"! *hdrText*Scrollbar.width: 15", +"! *hdrText*Scrollbar.height: 15", +"", +" ! Resources if the header text widget is HTML", +" *hdrText.width: 600", +" *hdrText.height: 500", +" *hdrText.anchorUnderlines: 1", +" *hdrText.visitedAnchorUnderlines: 1", +" *hdrText.verticalScrollOnRight: True", +" *hdrText.plainFont: 7x13", +" *hdrText.marginWidth: 5", +" *hdrText.marginHeight: 5", +"", +"", +" *hdrWcsGroup.tabLabel: Image WCS Info", +" *hdrWcsGroup.label:", +" *hdrWcsGroup.outerOffset: 5", +" *hdrWcsGroup.innerOffset: 5", +" *hdrWcsGroup*Text*scrollVertical: whenNeeded", +" *hdrWcsGroup*Text*scrollHorizontal: whenNeeded", +" *hdrWcsGroup*Text*editType: edit", +" *hdrWcsGroup*Text*displayCaret: False", +" *hdrWcsGroup*Text*borderWidth: 0", +" *hdrWcsGroup*Text*editType: edit", +" *hdrWcsGroup*Text*font: 7x13", +" *hdrWcsGroup*Text*Scrollbar.width: 15", +" *hdrWcsGroup*Text*Scrollbar.height: 15", +" *hdrWcsLayout.borderWidth: 0", +" *hdrWcsLayout.layout: vertical { \\", +" 2 < -2 > \\", +" hdrInfoGroup < +inf -inf * > \\", +" 2 < -2 > \\", +" hdrKeywGroup < +inf -inf * +inf -inf > \\", +" -4 \\", +" }", +" *hdrInfoGroup.label: Basic WCS Information", +" *hdrInfoGroup.outerOffset: 7", +" *hdrInfoGroup.innerOffset: 0", +" *hdrIGFrame.frameType: sunken", +" *hdrIGFrame.frameWidth: 1", +" *hdrIGText.height: 130", +"! *hdrIGText*background: black", +"! *hdrIGText*foreground: yellow2", +" *hdrIGText*background: #adadad", +" *hdrIGText*foreground: black", +" *hdrWcsGroup*hdrIGText*scrollVertical: never", +" *hdrWcsGroup*hdrIGText*scrollHorizontal: never", +" *hdrWcsGroup*hdrIGText*font: 7x13", +" *hdrKeywGroup.label: WCS Header Keywords", +" *hdrKeywGroup.outerOffset: 7", +" *hdrKeywGroup.innerOffset: 5", +" *hdrKGFrame.frameType: sunken", +" *hdrKGFrame.frameWidth: 1", +" *hdrKGText*background: #c4c4c4", +" *hdrKGText*bottomMargin: 10", +"", +" *hdrIGText*background: #c4c4c4", +" *hdrIGFrame.frameWidth: 0", +"}", +"", +"", +"set Resources(pixel_table) { \\", +"", +" *pixel_panel.title: Image Pixel Table", +" *pixel_panel*SimpleMenu.borderWidth: 1", +" *pixel_panel*SimpleMenu.borderColor: black", +" *pixel_panel*SimpleMenu.foreground: White", +" *pixel_panel*SimpleMenu.background: SteelBlue", +"", +" *pixtabMenuBar*borderWidth: 0", +" *pixtabMenuBar*Command.internalHeight: 4", +" *pixtabMenuBar*Command.internalWidth: 12", +" *pixtabMenuBar.layout: vertical { \\", +" 5 \\", +" horizontal { \\", +" 5 \\", +" pixtabSize 10 < +inf -10> pixtabHelp 5 pixtabClose \\", +" 7 \\", +" } \\", +" 5 \\", +" }", +" *pixtabSize.label: Size", +" *pixtabSize.menuName: pixtabMenu", +" *pixtabHelp.label: Help", +" *pixtabHelp.sensitive: False", +" *pixtabClose.label: Dismiss", +"", +" *pixtabMenuFrame.frameType: raised", +" *pixtabMenuFrame.frameWidth: 2", +" *pixel_table.layout: vertical { \\", +" 1 \\", +" pixtabMenuFrame < +inf -inf * > \\", +" 1 \\", +" pixtabFrame < +inf -inf * +inf -inf > \\", +" 1 \\", +" }", +" ", +"", +" *pixtabFrame.frameType: raised", +" *pixtabFrame.frameWidth: 0", +" *pixtabFrame*borderWidth: 0", +" *pixtabFrame*font: 6x10", +" *pixtabFrame*MultiList.font: -*-helvetica-medium-r-normal-*-10-*", +" *pixtabFrame*Label.font: -*-helvetica-medium-r-normal-*-10-*", +" *pixtabFrame*TextToggle.font: -*-helvetica-medium-r-normal-*-10-*", +"", +" *pixtabFrame*MultiList.forceColumns: True", +" *pixtabFrame*MultiList.defaultColumns: 5", +" *pixtabFrame*MultiList.shadeSurplus: False", +" *pixtabFrame*MultiList.borderWidth: 0", +" *pixtabFrame*MultiList.rowHeight: 25", +" *pixtabFrame*MultiList.rowSpacing: 7", +" *pixtabFrame*MultiList.internalWidth: 7", +" *pixtabFrame*MultiList.internalHeight: 4", +" *pixtabFrame*MultiList.width: 410", +" *pixtabFrame*MultiList.height: 160", +" *pixtabFrame*MultiList.columnWidth: 50", +" *pixtabFrame*MultiList.columnSpacing: 2", +" *pixtabFrame*MultiList.maxSelectable: 1", +" *pixtabFrame*MultiList.highlightForeground: red", +" *pixtabFrame*MultiList.highlightBackground: #c4c4c4", +" *pixtabFrame*MultiList.background: #c4c4c4", +" *pixtabFrame*TextToggle.background: #c4c4c4", +"", +" *pixtabFrame*Label.width: 00", +" !*pixtabFrame*Label.resize: False", +"", +" *meanFrame.frameWidth: 2", +" *meanFrame.frameType: chiseled", +" *meanFrame.outerOffset: 0", +" *meanFrame.width: 120", +" *meanLabel.label: Mean:", +" *meanValue.label:", +" *meanValue.resize: False", +"", +" *sigFrame.frameWidth: 2", +" *sigFrame.frameType: chiseled", +" *sigFrame.outerOffset: 0", +" *sigFrame.width: 120", +" *sigLabel.label: Stdev:", +" *sigValue.label:", +" *sigValue.resize: False", +"", +" *ptColFrame.frameWidth: 0", +" *ptColFrame.outerOffset: 0", +" *ptRowFrame.frameWidth: 0", +" *ptRowFrame.outerOffset: 0", +"", +" *pixtabFrame*ptColLabs.width: 410", +" *pixtabFrame*ptColLabs.height: 23", +" *pixtabFrame*ptColLabs.defaultColumns: 5", +" *pixtabFrame*ptColLabs.forceColumns: True", +" *pixtabFrame*ptColLabs.columnWidth: 50", +" *pixtabFrame*ptColLabs.columnSpacing: 2", +" *pixtabFrame*ptRowLabs.width: 60", +" *pixtabFrame*ptRowLabs.height: 110", +" *pixtabFrame*ptRowLabs.defaultColumns: 1", +" *pixtabFrame*ptRowLabs.forceColumns: True", +" *pixtabFrame*ptRowLabs.verticalList: True", +" *pixtabFrame*ptRowLabs.columnWidth: 50", +" *pixtabFrame*ptRowLabs.columnSpacing: 2", +" *pixtabFrame*pixtab.verticalList: True", +"", +" *ptFrame.outerOffset: 0", +" *ptFrame.innerOffset: 0", +" *ptFrame.borderWidth: 0", +" *ptFrame.frameWidth: 1", +" *ptFrame.frameType: sunken", +" *ptLayout.layout: vertical { \\", +" 3 \\", +" horizontal { 65 ptColFrame < +inf -inf * > 5 } \\", +" 1 \\", +" horizontal { \\", +" vertical { ptRowFrame< * +inf -inf > 5 } \\", +" 1 \\", +" vertical { ptFrame } \\", +" 5 \\", +" } \\", +" 1 \\", +" horizontal { \\", +" 2 < +inf > \\", +" meanLabel meanFrame < +inf -inf * > 2 \\", +" sigLabel sigFrame < +inf -inf * > \\", +" 10 \\", +" } \\", +" }", +"}", +"", +"", +"set Resources(help_panel) { \\", +"", +" !----------------------", +" ! Help panel resources.", +" !----------------------", +" *help_panel.title: XImtool Help Summary", +" *help_panel.width: 500", +" *help_panel.height: 550", +" *helpLayout*borderWidth: 0", +" *helpLayout*Command.internalHeight: 4", +" *helpLayout*Command.internalWidth: 12", +" *helpLayout*HTML*shadowWidth: 1", +" *helpLayout*helpText*Scrollbar.shadowWidth: 1", +"", +" *helpMenuGroup.label: ", +" *helpMenuGroup.height: 45", +" *helpMenuGroup.outerOffset: 0", +" *helpMenuGroup.innerOffset: 0", +" *helpMenuGroup.frameType: raised", +" *helpMenubar.layout: vertical { \\", +" 5 < -5 > \\", +" horizontal { 20 < +inf -20 > helpClose 7 } \\", +" 5 < -5 > \\", +" }", +" *helpBack.label: Back", +" *helpBack.sensitive: False", +" *helpForward.label: Forward", +" *helpForward.sensitive: False", +" *helpHome.label: Home", +" *helpClose.label: Dismiss", +"", +"", +" *hfEntry*editType: edit", +" *hfEntry*font: 7x13", +" *hfEntry*displayCaret: True", +" *hfFrame.frameWidth: 1", +" *hfFrame.frameType: sunken", +" *hfFrame.width: 250", +" *hfFind.label: Search", +" *hfFind.shadowWidth: 1", +" *hfClear.label: Clear", +" *hfClear.shadowWidth: 1", +"", +" *helpLayout.layout: vertical { \\", +" -1 \\", +" horizontal { helpMenuGroup < +inf -inf * > } \\", +" 5 \\", +" horizontal { \\", +" 5 \\", +" helpBack 2 helpForward 2 helpHome \\", +" 20 < +inf -20 > \\", +" hfFrame < +inf -inf * > 3 hfFind 1 hfClear \\", +" 5 \\", +" } \\", +" 5 \\", +" horizontal { helpTextFrame < +inf -inf * +inf -inf > } \\", +" horizontal { helpInfoLayout < +inf -inf * > } \\", +" -1 \\", +" }", +" *helpTextFrame.frameWidth: 1", +" *helpTextFrame.frameType: sunken", +" *helpText.width: 600", +" *helpText.height: 500", +" *helpText.anchorUnderlines: 1", +" *helpText.visitedAnchorUnderlines: 1", +" *helpText.verticalScrollOnRight: true", +" *helpText*Scrollbar.shadowWidth: 1", +" *helpText.plainFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-*-*", +" *helpText.plainboldFont: -adobe-courier-bold-r-normal-*-12-*-*-*-*-*-*-*", +" *helpText.plainitalicFont: -adobe-courier-medium-o-normal-*-12-*-*-*-*-*-*-*", +"! *helpText.boldFont: 6x12bold", +"", +"", +" ! Contact info at the bottom of the panel.", +" *helpInfoLayout*Label.justify: center", +" *helpInfoLayout*Label.internalHeight: 0", +" *helpInfoLayout.layout: horizontal { \\", +" 5 \\", +" vertical { 5 helpIRAFLogo 5 } \\", +" 1 < +inf > \\", +" vertical { \\", +" 5 \\", +" helpInfo1 < +inf -inf * +inf -inf > \\", +" helpInfo2 < +inf -inf * +inf -inf > \\", +" helpInfo3 < +inf -inf * +inf -inf > \\", +" 5 \\", +" } \\", +" 1 < +inf > \\", +" vertical { 5 helpNOAOLogo 5 } \\", +" 5 \\", +" }", +" *helpInfo1.label: XIMTOOL_VERSION", +" *helpInfo2.label: For help or questions: http://iraf.net", +" *helpInfo3.label: \\", +" NOAO is operated by AURA under cooperative agreement with the NSF", +"", +" *helpInfoLayout*helpInfo1.font: -*-helvetica-medium-r-normal-*-12-*-*-*", +" *helpInfoLayout*helpInfo2.font: -*-helvetica-medium-r-normal-*-12-*-*-*", +" *helpInfoLayout*helpInfo3.font: -*-helvetica-medium-r-normal-*-10-*-*-*", +"", +" *helpInfoLayout.helpIRAFLogo.internalWidth: 0", +" *helpInfoLayout.helpIRAFLogo.internalHeight: 0", +" *helpInfoLayout.helpIRAFLogo.foreground: SteelBlue", +" *helpInfoLayout.helpIRAFLogo.background: white", +" *helpInfoLayout.helpNOAOLogo.internalWidth: 0", +" *helpInfoLayout.helpNOAOLogo.internalHeight: 0", +" *helpInfoLayout.helpNOAOLogo.foreground: SteelBlue", +" *helpInfoLayout.helpNOAOLogo.background: white", +"}", +"", +"set Resources(tcl_panel) { \\", +"", +" !--------------------------------", +" ! Define a debug Tcl shell.", +" !--------------------------------", +" *tcl_panel.width: 550", +" *tcl_panel.height: 180", +" *tcl_panel.title: Debug TCL Command Entry", +" *tclLayout*borderWidth: 0", +" *tclLayout*Frame.frameType: sunken", +" *tclLayout*Frame.frameWidth: 2", +" *tclLayout.layout: vertical { \\", +" 0 < +0 -0 > \\", +" tclCmdGroup < +inf -inf * > \\", +" tclFrame < +inf -inf * +inf -inf> \\", +" 0 < +0 -0 > \\", +" }", +" *tclEntry*foreground: black", +" *tclEntry*editType: edit", +" *tclEntry*type: string", +" *tclEntry*font: 7x13", +" *tclEntry*scrollVertical: Always", +" *tclEntry*scrollHorizontal: whenNeeded", +"", +" *tclCmdGroup.label: ", +" *tclCmdGroup.outerOffset: 0", +" *tclCmdGroup.innerOffset: 0", +" *tclCmd.layout: vertical { \\", +" 5 \\", +" horizontal { \\", +" 5 \\", +" tclClear 3 \\", +" tclExecute \\", +" 10 < +inf -10> \\", +" tclDismiss \\", +" 5 \\", +" } \\", +" 5 \\", +" }", +" *tclClear.label: Clear", +" *tclExecute.label: Execute", +" *tclDismiss.label: Dismiss", +"}", +"", +"", +"set Resources(warning) { \\", +"", +" ! ---------------------", +" ! WARNING dialog.", +" ! ---------------------", +" *warning.geometry: +400+300", +" *warning*borderWidth: 0", +" *warning*TextBox.frameWidth: 0", +"", +" *warn.layout: vertical { \\", +" 5 < -5 > \\", +" horizontal { 5 warnFrame < +inf * +inf > 5 } \\", +" 5 < -5 > \\", +" horizontal { \\", +" 10 \\", +" warnOk < +inf * > \\", +" 5 < +inf -5 > \\", +" warnCancel < +inf * > \\", +" 10 \\", +" } \\", +" 5 < -5 > \\", +" }", +" *warnOk.label: Okay", +" *warnCancel.label: Cancel", +"", +" *WFlayout.layout: horizontal { \\", +" 5 < -5 > \\", +" vertical { 5 < +inf -5 > warnIcon 5 < +inf -5 > } \\", +" 5 < -5 > \\", +" warnText < +inf -inf * +inf -inf > \\", +" 5 < -5 > \\", +" }", +"", +" *warnLabel.label: Warning", +" *warnLabel.width: 300", +" *warnLabel.height: 20", +" *warnFrame.frameType: sunken", +" *warnFrame.frameWidth: 2", +" *warnIcon.location: 0 0 40 40", +" *warnIcon.image: WARNING", +" *warnText.label: generic warning text", +" *warnText.width: 270", +" *warnText.height: 60", +" *warnText.background: #c4c4c4", +"}", +"", +"", +"", +"", +"set Resources(gui) { \\", +"", +" ! GUI resources.", +" ! ------------------------------", +" *autoscale: True", +" *zoomfactors: 1 2 4 8", +" *displayCoords: True", +" *displayPanner: True", +" *displayMagnifier: False", +" *blinkRate: 1.0", +" *pannerArea: 150*150", +" *pannerGeom: -5+5", +" *magnifierArea: 100*100", +" *magnifierGeom: +5+5", +" *wcsboxGeom: -5-5", +" *maxContrast: 5.0", +" *showToolBar: False", +" *showPanelBar: False", +" *warnings: True", +" *centerBoxSize: 5", +" *peakCentroid: True", +"}", +"", +"", +"", +"", +"", +"################################################################################", +"# GUI Bootstrap Procedures", +"################################################################################", +"", +"# Initialize the widget tree.", +"proc InitWidgetTree args \\", +"{", +" global Objects Resources Version", +"", +"", +" # Add a new objects description for each of the panels found so we can", +" # create them by name later rather that with the defaults.", +"", +" set guiResources \"\"", +" foreach obj [array names Objects] {", +" set guiResources \\", +" [ format \"%s\\n\\n*%s_objects:%s\\n\" \\", +" $guiResources $obj $Objects($obj) ]", +" }", +"", +" # Now append all the Resource strings, changing any version strings as", +" # needed.", +"", +" foreach res [array names Resources] {", +" regsub -all XIMTOOL_VERSION $Resources($res) $Version ver", +" set guiResources [ format \"%s\\n\\n%s\\n\\n\" $guiResources $ver ]", +" }", +"", +" # Define all of the GUI objects and resources.", +" appInitialize ximtool XImtool $guiResources", +"}", +"", +"", +"# Realize a window module, i.e. create it's objects.", +"proc Realize { module args } \\", +"{", +" global Objects", +"", +" # Create any widgets for the module. We only do this once and set a", +" # flag to indicate the objects have been created so we don't do it on", +" # subsequent realizations.", +" if { [info exists Objects($module)] } {", +" createObjects [format \"%s_objects\" $module]", +" reset-server", +" }", +"}", +"", +"", +"# Bootstrap up the GUI.", +"InitWidgetTree", +"Realize ximtool", +"Realize parameters", +"Realize panelShell", +"Realize tcl_panel", +"Realize pixel_table", +"Realize hdr_panel", +"Realize blink_panel", +"Realize help_panel", +"Realize xpan_panel", +"Realize xmag_panel", +"Realize warning", +"", +"reset-server", +"", +"# Set the gterm widget focus.", +"send colorbar setGterm ; send colorbar activate", +"send imagewin setGterm ; send imagewin activate", +"", +"# Crank it up.", +"activate", +"", +"", +"", +"", +"##############################################################################", +"# Utility Procedures.", +"##############################################################################", +"", +"# Utility procedure to test True/False strings in resources.", +"proc true {v} {expr {$v == \"true\" || $v == \"True\" || $v == \"TRUE\"}}", +"", +"# Utility functions.", +"proc min {a b} { expr {($a < $b) ? $a : $b} }", +"proc max {a b} { expr {($a > $b) ? $a : $b} }", +"", +"# Global variables.", +"set version \"NOAO/IRAF XImtool Version 2.0BETA\"", +"", +"set winWidth [send imagewin get width ] ;# display window width", +"set winHeight [send imagewin get height] ;# display window height", +"set appWidth [send display get width ] ;# application window width", +"set appHeight [send display get height] ;# application window height", +"set marker none ;# selected marker", +"set markno 0 ;# used to name new markers", +"set ruler none ;# selected ruler", +"set ruleno 0 ;# used to name new rulers", +"set blinkFrames \"1 2\" ;# list of blink frames", +"set auto_reg 0", +"", +"set panel_up 0 ;# control panel mapped", +"set help_up 0 ;# help panel mapped", +"set ism_enable 0 ;# ISM is running", +"set ism_capable 1 ;# Client is ISM capable", +"set frameCache(0) \"\" ;# ISM frame cache", +"", +"set ctype \"equatorial\" ;# default coord type", +"set eqtype \"fk5\" ;# default equatorial type", +"", +"# Global constants.", +"set MAX_FRAMES 16 ;# max frame buffers", +"", +"# TCL constants", +"set tcl_precision 8", +"", +"", +"", +"# Window resize callbacks.", +"proc winResize {w width height} { ", +" global winWidth winHeight", +"", +" if {$width <= 1 || $height <= 1} \\", +" return", +"", +" set winWidth $width", +" set winHeight $height ", +"} ; send imagewin addCallback winResize resize", +"", +"proc appResize {w width height} \\", +"{", +" global doHcut doVcut cutXPos cutYPos", +" global appWidth appHeight", +"", +" set appWidth $width", +" set appHeight $height ", +"", +" catch {", +" if {$doHcut} { ", +" send hcutPlot clearScreen", +" hcutInit", +" send hcutAxes1 redraw ; send hcutAxes2 redraw", +" cutPlots $cutXPos $cutYPos ", +" }", +" if {$doVcut} { ", +" send vcutPlot clearScreen", +" vcutInit", +" send vcutAxes1 redraw ; send vcutAxes2 redraw", +" cutPlots $cutXPos $cutYPos ", +" }", +" }", +"} ; #send imagewin addCallback appResize resize", +"", +"", +"", +"# Additional global variables, taking default values from resources.", +"getResources {", +" { zoomfactors }", +" { displayCoords }", +" { displayPanner }", +" { displayMagnifier }", +" { blinkRate }", +" { pannerArea }", +" { pannerGeom }", +" { magnifierArea }", +" { magnifierGeom }", +" { wcsboxGeom }", +" { maxContrast }", +" { showToolBar }", +" { showPanelBar }", +" { warnings }", +" { centerBoxSize }", +" { peakCentroid }", +" { highlight }", +"}", +"", +"set warnings [true $warnings]", +"set defaultBlinkRate $blinkRate", +"", +"# Client state variables (UI parameter objects). Certain of these parameters", +"# we mirror in Tcl variables here, updating the values with a callback when", +"# the parameter value changes. Others require special callbacks.", +"", +"set frame 1 ;# current display frame", +"set nframes 0 ;# number of frame buffers", +"set frames {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16} ;# list of image frames", +"set frameWidth 0 ;# frame buffer width, pixels", +"set frameHeight 0 ;# frame buffer height, pixels", +"set frameDepth 8 ;# frame buffer pixel size, bits", +"set cursorMode 0 ;# true when cursor read pending", +"", +"foreach i $frames {", +" set frameZoomX($i) 0 ;# X zoom factor", +" set frameZoomY($i) 0 ;# Y zoom factor", +" set frameCenterX($i) 0 ;# X center of field", +" set frameCenterY($i) 0 ;# Y center of field", +" set frameScaleX($i) 0 ;# X scale factor", +" set frameScaleY($i) 0 ;# Y scale factor", +" set frameOffsetX($i) 0 ;# X register offset", +" set frameOffsetY($i) 0 ;# Y register offset", +" set enhancement($i) none ;# colortable enhancement", +"}", +"", +"", +"#trace variable frameOffsetX w debug_pvar ;# Debug stuff", +"#trace variable frameOffsetY w debug_pvar", +"#trace variable frameZoomX w debug_pvar", +"#trace variable frameZoomY w debug_pvar", +"#trace variable frameScaleX w debug_pvar", +"#trace variable frameScaleY w debug_pvar", +"", +"proc debug_pvar { name element op } \\", +"{", +" if {$element != \"\"} {", +" set name ${name}($element)", +" }", +" upvar $name x", +" puts \"Variable $name set to $x\"", +"}", +"", +"", +"", +"", +"################################################################################", +"# Cut-plot handling routines.", +"################################################################################", +"", +"set doHcut 0", +"set doVcut 0", +"set hstate 0", +"set vstate 0", +"set plotSpeed 1 ; send plotSpeed set on True", +"set curJump 1 ; send curJump set on True", +"set curTrack 1 ; send curTrack set on True", +"", +"set cutXPos [expr \"$winWidth / 2\"]", +"set cutYPos [expr \"$winHeight / 2\"]", +"set cutXScale 1.0", +"set cutYScale 1.0", +"", +"", +"", +"# Change the cursor to the crosshair when in the plot", +"proc cutCursor { widget event args } \\", +"{", +" global doHcut doVcut curTrack", +"", +" if {! $curTrack} \\", +" return", +"", +" if { $event == \"enterNotify\" } {", +" send $widget setCursorType ginMode", +"", +" # Disable the update of the graph we're in while in the plot window.", +" if {$widget == \"hcutPlot\"} { set doHcut 0 } else { set doVcut 0 }", +" } elseif { $event == \"leaveNotify\" } {", +" send $widget setCursorType idle", +"", +" # Enable the update of the graph we're leaving.", +" if {$widget == \"hcutPlot\"} { set doHcut 1 } else { set doVcut 1 }", +" }", +" cutPlotRefresh", +"}", +"foreach w {hcutPlot vcutPlot} {", +" send $w addEventHandler cutCursor enterWindowMask", +" send $w addEventHandler cutCursor leaveWindowMask", +"}", +"", +"proc cutPlotRefresh args \\", +"{", +" global doHcut doVcut cutXPos cutYPos", +"", +" if {$doHcut} {", +" send hcutPlot clearScreen", +" hcutInit", +" send hcutAxes1 redraw ; send hcutAxes2 redraw", +" cutPlots $cutXPos $cutYPos", +" }", +" if {$doVcut} {", +" send vcutPlot clearScreen", +" vcutInit", +" send vcutAxes1 redraw ; send vcutAxes2 redraw", +" cutPlots $cutXPos $cutYPos", +" }", +"} ; send imagewin addEventHandler cutPlotRefresh enterWindowMask", +"", +"proc cutPlotRedraw args \\", +"{", +" global doHcut doVcut cutXPos cutYPos", +"", +" if {$doHcut} {", +" send hcutAxes1 redraw ; send hcutAxes2 redraw", +" cutPlots $cutXPos $cutYPos", +" }", +" if {$doVcut} {", +" send vcutAxes1 redraw ; send vcutAxes2 redraw", +" cutPlots $cutXPos $cutYPos", +" }", +"}", +"", +"", +"# Disable the options when we first start up.", +"#send plotOpts \"set height 1 ; set width 1 ; unmap\"", +"foreach w {plotOpts hcutFrame vcutFrame} { send $w unmap }", +"", +"", +"# Cut-Plot options callback.", +"proc doPlotOpts { widget type state args } \\", +"{", +" global plotSpeed curJump curTrack doHcut doVcut", +" global cutXPos cutYPos", +"", +" if {$state} { set not 0 } else { set not 1 }", +"", +" switch $widget {", +" plotSpeed { if {$state} {", +" send plotAccurate set on 0 ; send plotImgPix set on 0", +" } else {", +" send plotSpeed set on True ; ", +" }", +" set plotSpeed $not", +" }", +" plotAccurate { if {$state} {", +" send plotImgPix set on 0 ; send plotSpeed set on 0", +" } else {", +" send plotSpeed set on True ; ", +" }", +" set plotSpeed $not", +" }", +" plotImgPix { if {$state} {", +" send plotAccurate set on 0 ; send plotSpeed set on 0", +" } else {", +" send plotSpeed set on True ; ", +" }", +" set plotSpeed $not", +" }", +" curJump { send curSmooth set on $not ; set curJump $state }", +" curSmooth { send curJump set on $not ; set curJump $not }", +" curTrack { set curTrack $state }", +" }", +"", +" # Redraw the plots right away.", +" if {$widget == \"plotSpeed\" || $widget == \"plotAccurate\"} { ", +" cutPlots $cutXPos $cutYPos", +" }", +"}", +"foreach w { plotSpeed plotAccurate plotImgPix curJump curSmooth curTrack } {", +" send $w addCallback doPlotOpts ", +"}", +"", +"", +"# Toggle the display of the horizontal or vertical cut plot windows.", +"", +"proc cutPlotToggle { widget type state args } \\", +"{", +" global doHcut doVcut cutXPos cutYPos hstate vstate", +" set debug 0", +"", +" set hstate [send hcut get state]", +" set vstate [send vcut get state]", +" set w [send display get width]", +" set h [send display get height]", +"", +" if {$debug} { print \" \" ; print [format \"display: %d x %d\\n\" $w $h] }", +"", +" if {$widget == \"hcut\"} {", +" set hfw [expr [send hcutFrame get width] - 4]", +" set hpw [send hcutPlot get width]", +" if {$state} {", +" # Enable the plot and resize the main window", +" if {$vstate} { ", +" send plotOpts set width 134 ", +" }", +" send hcutFrame \"set width $hpw ; set height 132; map\"", +" send hcutPlot \"set width $hfw ; set height 128\"", +" send display \"set height [ expr ($h + 132) ]; set width $w\"", +" drawHcutAxes 1", +" setHcutCursor 1", +" if {$vstate} { ", +" send plotOpts \"set height 134 ; map\"", +" vcutInit", +" }", +" hcutInit ;# Initialize the plot.", +" } else {", +" # Disable the plot and resize the main window", +" setHcutCursor 0", +" drawHcutAxes 0", +" send hcutPlot clearScreen", +" send plotOpts \"unmap; set height 4\"", +" send hcutFrame \"unmap; set width $hfw; set height 4\"", +" send plotOpts \"set width 4\"", +" send display \"set height [ expr ($h - 128) ] ; set width $w\"", +" if {$vstate} { ", +" vcutInit", +" }", +" }", +" set doHcut $state", +" } else {", +" set vfh [expr [send vcutFrame get height] - 4]", +" set vph [send vcutPlot get height]", +" if {$state} {", +" # Enable the plot and resize the main window", +" if {$hstate} { ", +" send plotOpts set height 134", +" }", +" send vcutFrame \"set height $vph ; set width 132 ; map\"", +" send vcutPlot \"set height $vfh ; set width 128\"", +" send display \"set height $h; set width [ expr ($w + 132) ]\"", +" drawVcutAxes 1", +" setVcutCursor 1", +" if {$hstate} { ", +" send plotOpts \"set height 134 ; set width 134; map\"", +" hcutInit", +" }", +" vcutInit ;# Initialize the plot.", +" } else {", +" # Disable the plot and resize the main window", +" setVcutCursor 0", +" drawVcutAxes 0", +" send vcutPlot clearScreen", +" send plotOpts \"unmap; set width 4\"", +" send vcutFrame \"unmap; set height $vfh; set width 4\"", +" send plotOpts \"set height 4\"", +" send display \"set width [ expr ($w - 128) ] ; set height $h\"", +" if {$hstate} { ", +" hcutInit", +" }", +" }", +" set doVcut $state", +" }", +" ", +" if {$debug} {", +" print [format \" hFrame: %d x %d\\n\" \\", +" [send hcutFrame get width] [send hcutFrame get height] ]", +" print [format \" hPlot: %d x %d\\n\" \\", +" [send hcutPlot get width] [send hcutPlot get height] ]", +" print [format \" vFrame: %d x %d\\n\" \\", +" [send vcutFrame get width] [send vcutFrame get height] ]", +" print [format \" vPlot: %d x %d\\n\" \\", +" [send vcutPlot get width] [send vcutPlot get height] ]", +" print [format \"state: %d %d\\n\" $hstate $vstate]", +" print [format \"display: %d x %d\\n\" $w $h]", +" }", +"", +" cutPlots $cutXPos $cutYPos", +"} ; foreach w { hcut vcut } { send $w addCallback cutPlotToggle }", +"", +"", +"# Draw the cut plots.", +"proc cutPlots { xpos ypos args } \\", +"{", +" global doHcut doVcut cutXPos cutYPos hstate vstate", +"", +" catch {", +" if {$doHcut} {", +" drawHcutIndicator $xpos", +" if {$hstate} { plotHcut $xpos $ypos }", +" }", +" if {$doVcut} {", +" drawVcutIndicator $xpos", +" if {$vstate} { plotVcut $xpos $ypos }", +" }", +" }", +"", +" set cutXPos $xpos ; set cutYPos $ypos", +"}", +"", +"", +"################################################################################", +"# Horizontal Cut-Plot Routines", +"################################################################################", +"", +"set hcutVec {}", +"", +"# Initiailize the horizontal cut-plot", +"proc hcutInit args \\", +"{", +" global logz cutXScale winWidth cutXPos cutYPos", +"", +" # Just get some dummy pixels, we only want the z1/z2 values so we can ", +" # initialize the labels.", +" set xp [expr [send imagewin get width] / 2 ]", +" set yp [expr [send imagewin get height] / 2 ]", +" set pix [send client getPixels $xp $yp 2 2 ]", +" set z1 [lindex $pix 0]", +" set z2 [lindex $pix 1]", +"", +" send hcutPlot getPhysRes xr yr", +" send hcutPlot setLogRes $xr $yr", +"", +" set logx [send imagewin get width]", +" set logz [expr ($z2 - $z1)]", +" set cutXScale [expr ($xr * 1.0) / ($logx * 1.0)]", +"", +" # Initialize the labels.", +" send vcutPlot \"setColorIndex 6\"", +" drawHcutLabels $z1 $z2", +"}", +"", +"# Draw the horizontal cut-plot.", +"proc plotHcut { xpos ypos } \\", +"{", +" global doHcut cutXScale", +" global hcutVec cutXPos plotSpeed", +"", +"", +" if { ($xpos == 0 && $ypos == 0) || ! $doHcut } \\", +" return", +"", +" # Do the horizontal cut plot.", +" set width [send imagewin get width]", +" if {$plotSpeed} {", +" set pix [send client getPixels 0 $ypos $width 1 2 5 $cutXScale]", +" } else {", +" set pix [send client getPixels 0 $ypos $width 1 2 1 $cutXScale]", +" }", +" set z1 [lindex $pix 0]", +" set z2 [lindex $pix 1]", +" set vec [lrange $pix 2 end]", +"", +" # Erase the last plot rather than clear the screen and redraw ", +" # the new vector.", +" send hcutPlot setColorIndex background", +" send hcutPlot drawPolyline $hcutVec", +" send hcutPlot setColorIndex foreground", +" send hcutPlot drawPolyline $vec", +" set hcutVec $vec ;# save for later erasure", +"", +" # Mark the cursor position.", +" drawHcutIndicator $xpos", +"", +" # Minimize the screen refreshes to speed things up.", +" if { [expr \"$ypos % 3\"] == 0} {", +" catch {", +" drawHcutLabels $z1 $z2 ;# redraw the labels", +" }", +" send hcutAxes1 redraw ;# redraw the axes markers", +" send hcutAxes2 redraw", +" }", +"}", +"", +"", +"# Create markers to indicate axes on the horizontal cut-plot.", +"proc drawHcutAxes { state } \\", +"{", +" if {$state} {", +" send hcutPlot createMarker hcutAxes1 \\", +" type box \\", +" createMode noninteractive \\", +" lineColor gray60 \\", +" lineStyle 0 \\", +" x 1 \\", +" y 60 \\", +" height 30 \\", +" width 4096 \\", +" activated True \\", +" visible True \\", +" sensitive False", +" send hcutPlot createMarker hcutAxes2 \\", +" type box \\", +" createMode noninteractive \\", +" lineColor gray60 \\", +" lineStyle 0 \\", +" x 1 \\", +" y 1 \\", +" height 60 \\", +" width 4096 \\", +" activated True \\", +" visible True \\", +" sensitive False", +" } else {", +" send hcutAxes1 destroy ; send hcutAxes2 destroy", +" }", +"}", +"", +"# Create a marker to be used as the cursor indicator.", +"proc setHcutCursor { state } \\", +"{", +" if {$state} {", +" set pts { {252 10} {260 10} {256 1} }", +"", +" send hcutPlot createMarker hcutCursor \\", +" type polygon \\", +" createMode noninteractive \\", +" lineColor black \\", +" fill True \\", +" fillColor yellow \\", +" x 256 \\", +" y 12 \\", +" width 8 \\", +" height 10 \\", +" knotSize 0 \\", +" activated True \\", +" visible False \\", +" sensitive False", +" send hcutCursor setVertices $pts", +" send hcutCursor set visible True", +"", +" } else {", +" send hcutCursor destroy", +" }", +"}", +"", +"# Label the axes on the horizontal cut plot.", +"proc drawHcutLabels { z1 z2 } \\", +"{", +" set mid [expr \"($z2-$z1)/2.0+$z1\"]", +" set low [expr \"($mid-$z1)/2.0+$z1\"]", +" set high [expr \"($z2-$mid)/2.0+$mid\"]", +"", +" send hcutPlot \"setColorIndex 6 ; \\", +" drawAlphaText 2 10 [format \"%.1f\" $z2] ; \\", +" drawAlphaText 2 34 [format \"%.1f\" $high] ; \\", +" drawAlphaText 2 64 [format \"%.1f\" $mid] ; \\", +" drawAlphaText 2 94 [format \"%.1f\" $low] ; \\", +" drawAlphaText 2 120 [format \"%.1f\" $z1]\"", +"}", +"", +"# Draw the cursor position indicator on the horizontal cut plot.", +"proc drawHcutIndicator { xpos } \\", +"{", +" global cutXScale cutXPos", +"", +" send hcutCursor move [expr ($xpos * $cutXScale)] 12", +" set cutXPos $xpos", +"}", +"", +"# Track the cursor while in the cut-graph window.", +"proc hcutWCSUpdate { x y args } \\", +"{", +" global cutYPos curTrack", +" if {$curTrack} { ", +" wcsUpdate $x $cutYPos ", +" }", +" drawHcutIndicator $x", +"}", +"", +"", +"", +"", +"################################################################################", +"# Vertical Cut-Plot Routines", +"################################################################################", +"", +"set vcutVec {}", +"", +"# Initiailize the vertical cut-plot", +"proc vcutInit args \\", +"{", +" global cutYScale winWidth cutXPos cutYPos", +"", +" # Just get some dummy pixels, we only want the z1/z2 values so we can ", +" # initialize the labels.", +" set xp [expr [send imagewin get width] / 2 ]", +" set yp [expr [send imagewin get height] / 2 ]", +" set pix [send client getPixels $xp $yp 2 2 ]", +" set z1 [lindex $pix 0]", +" set z2 [lindex $pix 1]", +"", +" send vcutPlot getPhysRes xr yr", +" send vcutPlot setLogRes $xr $yr", +"", +" set logy [send imagewin get height]", +" set logz [expr ($z2 - $z1)]", +" set cutYScale [expr ($yr * 1.0) / ($logy * 1.0)]", +"", +" # Initialize the labels.", +" send vcutPlot \"setColorIndex 6; reset\"", +" drawVcutLabels $z1 $z2", +"}", +"", +"# Draw the horizontal cut-plot.", +"proc plotVcut { xpos ypos } \\", +"{", +" global doVcut cutYScale", +" global vcutVec cutXPos cutYPos plotSpeed", +"", +"", +" if { ($xpos == 0 && $ypos == 0) || ! $doVcut } \\", +" return", +"", +" # Do the vertical cut plot.", +" set height [send imagewin get height]", +" if {$plotSpeed} {", +" set pix [send client getPixels $xpos 0 1 $height 3 5 $cutYScale]", +" } else {", +" set pix [send client getPixels $xpos 0 1 $height 3 1 $cutYScale]", +" }", +" set z1 [lindex $pix 0]", +" set z2 [lindex $pix 1]", +" set vec [lrange $pix 2 end]", +"", +" # Draw the vector.", +" send vcutPlot setColorIndex background", +" send vcutPlot drawPolyline $vcutVec", +" send vcutPlot setColorIndex foreground", +" send vcutPlot drawPolyline $vec", +" set vcutVec $vec ;# save for later erasure", +"", +" # Mark the cursor position.", +" drawVcutIndicator $ypos", +"", +" # Minimize the screen refreshes to speed things up.", +" if { [expr \"$xpos % 3\"] == 0} {", +" catch {", +" drawVcutLabels $z1 $z2 ;# redraw the labels", +" }", +" send vcutAxes1 redraw ;# redraw the axes markers", +" send vcutAxes2 redraw", +" }", +"}", +"", +"# Erase the last plot rather than clear the screen and redraw it all. The", +"# erase is done by redrawing the last vector in the the background color.", +"proc eraseOldVcut args \\", +"{", +" global cutYPos vcutVec", +"", +" send vcutPlot setColorIndex background", +" send vcutPlot drawPolyline $vcutVec", +" send vcutPlot setColorIndex foreground", +"}", +"", +"# Draw the horizontal cut-plot.", +"# Create markers to indicate axes on the vertical cut-plot.", +"proc drawVcutAxes { state } \\", +"{", +" if {$state} {", +" send vcutPlot createMarker vcutAxes1 \\", +" type box \\", +" createMode noninteractive \\", +" lineColor gray60 \\", +" lineStyle 0 \\", +" x 60 \\", +" y 1 \\", +" height 4096 \\", +" width 30 \\", +" activated True \\", +" visible True \\", +" sensitive False", +" send vcutPlot createMarker vcutAxes2 \\", +" type box \\", +" createMode noninteractive \\", +" lineColor gray60 \\", +" lineStyle 0 \\", +" x 1 \\", +" y 1 \\", +" width 60 \\", +" height 4096 \\", +" activated True \\", +" visible True \\", +" sensitive False", +" } else {", +" send vcutAxes1 destroy ; send vcutAxes2 destroy", +" }", +"}", +"", +"# Create a marker to be used as the cursor indicator.", +"proc setVcutCursor { state } \\", +"{", +" if {$state} {", +" set pts { {10 252} {10 260} {1 256} }", +"", +" send vcutPlot createMarker vcutCursor \\", +" type polygon \\", +" createMode noninteractive \\", +" lineColor black \\", +" fill True \\", +" fillColor yellow \\", +" x 12 \\", +" y 256 \\", +" width 10 \\", +" height 8 \\", +" knotSize 0 \\", +" activated True \\", +" visible False \\", +" sensitive False", +" send vcutCursor setVertices $pts", +" send vcutCursor set visible True", +"", +" } else {", +" send vcutCursor destroy", +" }", +"}", +"", +"# Label the axes on the vertical cut plot.", +"proc drawVcutLabels { z1 z2 } \\", +"{", +" set mid [expr \"($z2-$z1)/2.0+$z1\"]", +" set low [expr \"($mid-$z1)/2.0+$z1\"]", +" set high [expr \"($z2-$mid)/2.0+$mid\"]", +"", +" # Initialize the label strings and positions.", +" set labels {}", +" foreach i [list $z2 $high $mid $low $z1] {", +" lappend labels [ format \"%.1f\" $i ]", +" }", +" set xposns { 2 28 58 88 112 }", +"", +" send vcutPlot \"setColorIndex 6\"", +"", +" # Draw each label vertically down the position since we can't rotate", +" # the text.", +" set xp 0", +" foreach lab $labels {", +" set chars [split $lab {} ]", +" set yp 12", +" set xpos [lindex $xposns $xp]", +" foreach ch $chars {", +" if {$ch == \".\"} { incr yp -4 }", +" send vcutPlot drawAlphaText $xpos $yp $ch", +" incr yp 10", +" }", +" incr xp", +" }", +"}", +"", +"", +"# Draw the cursor position indicator on the horizontal cut plot.", +"proc drawVcutIndicator { ypos } \\", +"{", +" global cutYScale cutYPos", +"", +" send vcutCursor move 12 [expr ($ypos * $cutYScale)]", +" set cutYPos $ypos", +"}", +"", +"", +"# Track the cursor while in the cut-graph window.", +"proc vcutWCSUpdate { x y args } \\", +"{", +" global cutXPos curTrack", +" if {$curTrack} { ", +" wcsUpdate $cutXPos $y ", +" }", +" drawVcutIndicator $y", +"}", +"", +"", +"", +"################################################################################", +"# UTILITY ROUTINES", +"################################################################################", +"", +"", +"# TICSTEP -- Utility routine to compute nice ticmark steps in plots.", +"# [ NOT CURRENTLY USED. ]", +"", +"proc ticstep { range nsteps } \\", +"{", +" set t2 0.301029996", +" set t5 0.698970004", +" set df [ expr \"$range / double($nsteps + 1)\" ]", +" if {$df > 0.0} {", +" set p1 [ expr \"log10(double($df))\" ]", +" } else {", +" set p1 [ expr \"log10(double(-$df))\" ]", +" }", +" set p2 [ expr \"int($p1)\" ]", +" set p3 [ expr \"$p1 - $p2\" ]", +"", +" if { $p3 < 0.0 } {", +" set p3 [ expr \"$p2 + 1.0\" ]", +" set p2 [ expr \"$p2 - 1.0\" ]", +" }", +"", +" if { $p3 < 1.0e-10 } {", +" set ticstep [ expr \"pow(double(10.0),double($p2))\" ]", +" } elseif { $p3 > 0. && $p3 <= $t2 } {", +" set ticstep [ expr \"pow(double(10.0),double($p2 + $t2))\" ]", +" } elseif { $p3 > $t2 && $p3 <= $t5 } {", +" set ticstep [ expr \"pow(double(10.0),double($p2 + $t5))\" ]", +" } elseif { $p3 > $t5 && $p3 <= 1.0 } {", +" set ticstep [ expr \"pow(double(10.0),double($p2 + 1.))\" ]", +" } else {", +" set ticstep $df", +" }", +"", +" set logtic [ expr \"int(log10($ticstep)) - 1\" ]", +" set scale [ expr \"pow(double(10.0),double($logtic))\" ]", +" set ticstep [ expr \"int( ($ticstep / $scale) * $scale)\" ]", +"", +" if {$ticstep < 0.1} { set ticstep 0.10 }", +"", +" return $ticstep", +"}", +"", +"", +"", +"# Cursor positioning routines", +"#----------------------------", +"", +"proc move_cursor { xstep ystep args } \\", +"{", +" set raster 0", +" send imagewin getCursorPos rx ry", +" send imagewin setCursorPos [expr $rx + $xstep] [expr $ry + $ystep] $raster", +"}", +"", +"", +"# Called when the number of frames changes.", +"proc setNFrames {param old new} \\", +"{", +" global frameMenuDescription nframes frames", +"", +" set nframes $new", +" if {$old != $new} {", +" foreach i {prevButton nextButton} {", +" send $i set sensitive [expr \"$nframes > 1\"]", +" }", +"", +" if {$nframes > 0} {", +"", +" # Creates the Frames menu on the main image window.", +" set items { }", +" for {set i 1} {$i <= $nframes} {incr i} {", +" set l [format \"%2d\" $i]", +" lappend items \"$l f.exec \\{send client setFrame $i\\} sensitive \\{[expr \\\"$nframes >= $i\\\"]\\}\"", +" }", +" editMenu frameMenu frameButton $items", +"", +" # Create the menu for the blink frames list.", +" set items { }", +" for {set i 0} {$i <= $nframes} {incr i} {", +" set j [expr ($i + 1)]", +" if {$i == 0} {", +" set s \"\\\"none\\\" f.exec \\{send brFrameBTN set label \\\" \\\"\\}\"", +" lappend items $s", +" } else {", +" set l [format \"%2d\" $i]", +" lappend items \"$l f.exec \\{send brFrameBTN set label $l\\} sensitive \\{[expr \\\"$nframes >= $i\\\"]\\}\"", +" }", +" }", +" for {set i 1} {$i <= $nframes} {incr i} {", +" send brFrame$i setSensitive True", +" send tFrame$i setSensitive True", +" regsub -all BTN $items $i nmenu", +" editMenu frame${i}Menu brFrame$i $nmenu", +" }", +"", +" } else {", +" editMenu frameMenu frameButton $frameMenuDescription", +"", +" for {set i 1} {$i <= $nframes} {incr i} {", +" send brFrame$i setSensitive True", +" send tFrame$i setSensitive True", +" editMenu frame${i}Menu brFrame$i $frameMenuDescription", +" }", +" }", +" }", +"", +" for {set i 1} {$i <= 16} {incr i} {", +" if {$i <= $nframes} {", +" send frame$i map", +" } else {", +" send frame$i unmap", +" }", +" }", +"", +" if {$nframes > 2} {", +" setAllTileFrames", +" }", +"}; send nframes addCallback setNFrames", +"", +"", +"# Set the default main window frame menu.", +"set frameMenuDescription {", +" {\" 1\" f.exec \"send client setFrame 1\" sensitive {[expr \"$nframes >= 1\"]} }", +" {\" 2\" f.exec \"send client setFrame 2\" sensitive {[expr \"$nframes >= 2\"]} }", +" {\" 3\" f.exec \"send client setFrame 3\" sensitive {[expr \"$nframes >= 3\"]} }", +" {\" 4\" f.exec \"send client setFrame 4\" sensitive {[expr \"$nframes >= 4\"]} }", +"}; createMenu frameMenu frameButton $frameMenuDescription", +"", +"", +"", +"", +"# Initialize the frame lists panels (blink panel and tile tab).", +"for {set i 1} {$i <= 16} {incr i} {", +" send brFrame$i set label [format \"%2d\" $i]", +" send tFrame$i set label [format \"%2d\" $i]", +" if {$i <= 4} {", +" send brFrame$i setSensitive True", +" send tFrame$i \"setSensitive True ; set state 1\"", +" } else {", +" send brFrame$i setSensitive False", +" send tFrame$i \"setSensitive False ; set state 0\"", +" }", +" createMenu frame${i}Menu brFrame$i $frameMenuDescription", +"}", +"", +"", +"# Called when the frame being displayed changes.", +"proc frameChanged {param old new} \\", +"{", +" global frame", +"", +" set frame $new", +" send frameButton set label [format \"%2d\" $frame]", +"", +" # The first time we request frame 5 or higher reset ", +" # the extra frame buttons on the control panel to make", +" # them visible.", +" if {$new >= 5} {", +" send frlistBox set width 49", +" }", +" wcsFmtFBConfig", +" drawCompass", +"}; send frame addCallback frameChanged", +"", +"", +"# Called when the frame buffer configuration changes.", +"proc setFrameSize {param old new} \\", +"{", +" global frameWidth frameHeight frameDepth", +" set frameWidth [lindex $new 0]", +" set frameHeight [lindex $new 1]", +" set frameDepth [lindex $new 2]", +"", +" wcsFmtFBConfig", +"}; send frameSize addCallback setFrameSize", +"", +"# Called when the current frame is zoomed or panned.", +"proc setFrameView {param old new} \\", +"{", +" global frameZoomX frameZoomY frameCenterX frameCenterY", +" global frameScaleX frameScaleY frameOffsetX frameOffsetY", +" global frame auto_reg blinkFrames", +"", +" # Update the position.", +" set frameZoomX($frame) [lindex $new 0]", +" set frameZoomY($frame) [lindex $new 1]", +" set frameCenterX($frame) [lindex $new 2]", +" set frameCenterY($frame) [lindex $new 3]", +" set frameScaleX($frame) [lindex $new 4]", +" set frameScaleY($frame) [lindex $new 5]", +" set frameOffsetX($frame) [lindex $new 6]", +" set frameOffsetY($frame) [lindex $new 7]", +"", +" # If auto-registering is enabled, do it now, but only when we're updating", +" # the current display frame, and only if that frame is in the framelist.", +"", +" if {$auto_reg == 1 && $frame == [send frameButton get label]} {", +" if {[string first $frame $blinkFrames] != -1} {", +" send client offsetRegister \\{$blinkFrames\\}", +" }", +"", +" foreach f $blinkFrames {", +" if {$f != $frame} {", +" set frameZoomX($f) $frameZoomX($frame)", +" set frameZoomY($f) $frameZoomY($frame)", +" set frameCenterX($f) $frameCenterX($frame)", +" set frameCenterY($f) $frameCenterY($frame)", +" set frameScaleX($f) $frameScaleX($frame)", +" set frameScaleY($f) $frameScaleY($frame)", +" }", +" }", +" }", +" deleteAllRulers", +"", +"}; send frameView addCallback setFrameView", +"", +"", +"# Called when the color enhancement for a frame changes.", +"proc setEnhancement {param old new} \\", +"{", +" global enhancement", +" set enhancement([lindex $new 0]) [lrange $new 1 end]", +"}; send enhancement addCallback setEnhancement", +"", +"# Called when the frame title changes (e.g. frame change or new frame loaded).", +"proc setTitle {param old new} \\", +"{", +" set lab [string trimright $new]", +" send imageTitle set label $lab", +"", +" set image [lindex [ split $lab '-'] 0 ]", +" wcsFmtImname $image", +"", +" set title [lindex [ split $lab '-'] 1 ]", +" wcsFmtImtitle $title", +" deleteAllRulers", +"}; send frameTitle addCallback setTitle", +"", +"# Called when the image is flipped in an axis.", +"proc setFlip {param old new} \\", +"{", +" if {$param == \"xflip\"} { ", +" send xflipButton set state [true $new]", +" } else {", +" send yflipButton set state [true $new]", +" }", +" deleteAllRulers", +"}; foreach i {xflip yflip} { send $i addCallback setFlip }", +"", +"", +"# Various general callbacks.", +"", +"proc Quit args \\", +"{", +" global ism_enable", +"", +" if {$ism_enable} {", +" catch { send wcspix quit }", +" }", +" send client Quit ", +"}", +"proc nextFrame args { send client nextFrame }", +"proc prevFrame args { send client prevFrame }", +"proc setColormap { mapno } { send client setColormap $mapno }", +"proc xflip args { send client flip x ; flipRegister }", +"proc yflip args { send client flip y ; flipRegister }", +"proc xyflip args { send client flip x y ; flipRegister }", +"proc flipRegister args \\", +"{", +" global auto_reg frame blinkFrames", +"", +" if {$auto_reg == 1 && $frame == [send frameButton get label]} {", +" if {[string first $frame $blinkFrames] != -1} {", +" send client offsetRegister \\{$blinkFrames\\}", +" }", +" }", +"}", +"", +"", +"", +"# Initialize bitmaps.", +"createBitmap xflip 16 16 {", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18, 0x18,", +" 0x1c, 0x38, 0xfe, 0x7f, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap yflip 16 16 {", +" 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01,", +" 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f,", +" 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00}", +"", +"createBitmap qmark 16 16 {", +" 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x0f, 0x18, 0x0c, 0x18, 0x0c,", +" 0x18, 0x0e, 0x00, 0x07, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00,", +" 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap larrow 16 16 {", +" 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x1e, 0x70, 0x1e,", +" 0x38, 0x18, 0x1c, 0x18, 0x1c, 0x18, 0x38, 0x18, 0x70, 0x1e, 0xe0, 0x1e,", +" 0xc0, 0x03, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00}", +"", +"createBitmap rarrow 16 16 {", +" 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x78, 0x07, 0x78, 0x0e,", +" 0x18, 0x1c, 0x18, 0x38, 0x18, 0x38, 0x18, 0x1c, 0x78, 0x0e, 0x78, 0x07,", +" 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00}", +"", +"createBitmap panel 16 16 {", +" 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,", +" 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x98, 0x19, 0x18, 0x18,", +" 0x18, 0x18, 0x18, 0x18, 0xf8, 0x1f, 0xf8, 0x1f}", +"", +"createBitmap brightness 15 15 {", +" 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x10, 0x04, 0x08, 0x08,", +" 0x08, 0x08, 0x0e, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0xe8, 0x0b,", +" 0x84, 0x10, 0x80, 0x00, 0x00, 0x00}", +"", +"createBitmap contrast 15 15 {", +" 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x30, 0x07, 0x08, 0x0f, 0x08, 0x0f,", +" 0x04, 0x1f, 0x04, 0x1f, 0x04, 0x1f, 0x08, 0x0f, 0x08, 0x0f, 0x30, 0x07,", +" 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap bar 10 10 {", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x42, 0x00, 0x7e, 0x00,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap dot 16 16 {", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01,", +" 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap null 16 16 {", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap solid 64 24 {", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}", +"", +"catch { send controlButton \"set bitmap panel; addCallback panel\" }", +"catch { send helpButton \"set bitmap qmark; addCallback Help\" }", +"send xflipButton \"set bitmap xflip; addCallback xflip\"", +"send yflipButton \"set bitmap yflip; addCallback yflip\"", +"send prevButton \"set bitmap larrow; addCallback prevFrame\"", +"send nextButton \"set bitmap rarrow; addCallback nextFrame\"", +"send blinkPanel \"set bitmap panel\"", +"", +"", +"", +"# WINDOW the current frame.", +"set old_cm_x 0", +"set old_cm_y 0", +"", +"proc windowColormap {x y} \\", +"{", +" global winWidth winHeight maxContrast old_cm_x old_cm_y", +"", +" # For efficiency we won't compute the sqrt of the distance but instead", +" # just compare the square. Use a threshold of 6 pixels so when we", +" # narrow in on the ROI we refine the colormap more precisely.", +"", +" set diff [expr (($old_cm_x - $x) * ($old_cm_x - $x)) + \\", +" (($old_cm_y - $y) * ($old_cm_y - $y))]", +"", +" # Keep the old position.", +" set old_cm_x $x", +" set old_cm_y $y", +" if {$diff > 36} {", +" return", +" }", +"", +" send client windowColormap \\", +" [expr \"double($x) / $winWidth\"] \\", +" [expr \"(double($y) - $winHeight / 2.0) / $winHeight * \\", +" $maxContrast * 2.0\"]", +"}", +"", +"proc updateColormap {x y} \\", +"{", +" global winWidth winHeight maxContrast old_cm_x old_cm_y", +"", +" set old_cm_x $x", +" set old_cm_y $y", +" send client updateColormap \\", +" [expr \"double($x) / $winWidth\"] \\", +" [expr \"(double($y) - $winHeight / 2.0) / $winHeight * \\", +" $maxContrast * 2.0\"]", +"}", +"", +"", +"", +"# WINDOW the current frame, but only one color at a time.", +"proc windowRGB {color x y save_flag} \\", +"{", +" global winWidth winHeight maxContrast", +"", +" send client windowRGB $color \\", +" [expr \"double($x) / $winWidth\"] \\", +" [expr \"(double($y) - $winHeight / 2.0) / $winHeight * \\", +" $maxContrast * 2.0\"] $save_flag", +"}", +"", +"", +"# ZOOM and PAN.", +"set xcen 0", +"set ycen 0", +"foreach i $frames {set zoomindex($i) 0}", +"set nzoomfactors 0", +"foreach i $zoomfactors {", +" set zoomfactor($nzoomfactors) $i", +" incr nzoomfactors", +"}", +"", +"# Zoom or pan image at given center.", +"proc zoom {x y} \\", +"{", +" global xcen ycen frame", +" global zoomindex zoomfactor", +" global nzoomfactors", +"", +" set rx $x; set ry $y", +" set raster 0", +"", +" # Convert raw screen coordinates to frame buffer raster coordinates.", +" send imagewin unmapPixel $x $y raster rx ry", +"", +" # Select a pixel.", +" set rx [expr \"int ($rx)\"]", +" set ry [expr \"int ($ry)\"]", +"", +" # If the pointer did not move (much) zoom the image, otherwise", +" # pan it.", +"", +" send imagewin setCursorType busy", +" if {sqrt(pow($x-$xcen, 2) + pow($y-$ycen, 2)) < 4} {", +" set zoomindex($frame) [expr [incr zoomindex($frame)] % $nzoomfactors]", +" set mag $zoomfactor($zoomindex($frame))", +" send client zoom $mag $mag $rx $ry", +" } else {", +" send client pan $rx $ry", +" set xcen $x", +" set ycen $y", +" }", +"", +" # Move the pointer so that it tracks the object feature the user", +" # selected.", +"", +" send imagewin setCursorPos $rx $ry $raster", +" send imagewin getCursorPos xcen ycen", +" send imagewin setCursorType idle", +"}", +"", +"", +"# Zoom using a marker to indicate the region to be displayed.", +"proc zoomMarker {marker aspect} \\", +"{", +" global xcen ycen frame", +" global winWidth winHeight", +" global zoomindex nzoomfactors", +" global auto_reg frame frameOffsetX frameOffsetY", +"", +" # getRegion returns: \"rectangle raster x y width height rotangle\".", +" set region [send $marker getRegion unmap]", +"", +" set raster [lindex $region 1]", +" set xcen [expr \"int([lindex $region 2]) + 0.5\"]", +" set ycen [expr \"int([lindex $region 3]) + 0.5\"]", +" set snx [expr \"[lindex $region 4] * 2\"]", +" set sny [expr \"[lindex $region 5] * 2\"]", +"", +" # Compute the magnification ratio.", +" set xmag [expr \"$winWidth / $snx\"]", +" set ymag [expr \"$winHeight / $sny\"]", +" if {$aspect == \"equal\"} {", +" set mag [expr \"($xmag < $ymag) ? $xmag : $ymag\"]", +" set xmag $mag; set ymag $mag", +" }", +"", +" # Zoom the image.", +" send client zoomAbs \\", +" $xmag $ymag $xcen $ycen \\", +" $frameOffsetX($frame) $frameOffsetY($frame)", +"", +" # The following causes a button2 to redisplay the full image.", +" send imagewin setCursorPos $xcen $ycen $raster", +" send imagewin getCursorPos xcen ycen", +" set zoomindex($frame) [expr \"$nzoomfactors - 1\"]", +"}", +"", +"# Pan the display frame one width/height in a given direction.", +"proc moveFrame { xs ys args } \\", +"{", +" global winWidth winHeight frame", +" global frameWidth frameHeight", +" global frameZoomX frameZoomY frameCenterX frameCenterY", +" global frameOffsetX frameOffsetY", +"", +" # Get the step size for the new position.", +" set xstep_size [ expr \"$xs * $winWidth / $frameZoomX($frame)\" ]", +" set ystep_size [ expr \"$ys * $winHeight / $frameZoomY($frame)\" ]", +"", +" # Set the boundaries so we only move up to the edges.", +" set xl [ expr \"($winWidth / $frameZoomX($frame)) / 2 + 1\" ]", +" set yl [ expr \"($winHeight / $frameZoomY($frame)) / 2 + 1\" ]", +" set xu [ expr \"$frameWidth - $xl\" ]", +" set yu [ expr \"$frameHeight - $yl\" ]", +"", +" # Set the new center position.", +" set nxc [ expr \"$frameCenterX($frame) + $xstep_size\" ]", +" set nyc [ expr \"$frameCenterY($frame) + $ystep_size\" ]", +" if {$nxc < $xl} { set nxc $xl }", +" if {$nxc > $xu} { set nxc $xu }", +" if {$nyc < $yl} { set nyc $yl }", +" if {$nyc > $yu} { set nyc $yu }", +"", +" # Finally, send the command to move the frame.", +" send client zoomAbs \\", +" $frameZoomX($frame) $frameZoomY($frame) $nxc $nyc \\", +" $frameOffsetX($frame) $frameOffsetY($frame)", +"}", +"", +"proc resetView {param old new} {", +" global zoomindex xcen ycen frames", +" global frameWidth frameHeight", +"", +" if {$new == \"done\"} {", +" foreach i $frames {", +" send client setFrame $i", +" set xcen [expr $frameWidth / 2]", +" set ycen [expr $frameHeight / 2]", +" send client zoom 1 1 $xcen $ycen", +" set zoomindex($i) 0", +" send client setColormap Grayscale", +" normalize", +" }", +" send client setFrame 1", +" }", +"}; #send initialize addCallback resetView", +"", +"", +"# CURSOR READ stuff.", +"proc setCursorMode {param old new} \\", +"{", +" global cursorMode", +"", +" if {$new == \"on\"} {", +" send imagewin \"activate; setCursorType ginMode\"", +" set cursorMode 1", +" } elseif {$new == \"off\"} {", +" send imagewin \"setCursorType idle; deactivate\"", +" set cursorMode 0", +" }", +"}", +"", +"proc keyInput {widget event sx sy data} \\", +"{", +" global cursorMode frame", +"", +" if {!$cursorMode || $event != \"keyPress\"} \\", +" return", +" if {[lindex $data 0] == \"??\"} \\", +" return", +"", +" # Convert raw screen coordinates to raster pixel coordinates.", +" send imagewin unmapPixel $sx $sy raster rx ry", +"", +" # Return the cursor value and exit cursor mode.", +" send client retCursorVal $rx $ry $frame 1 [lindex $data 0]", +"}", +"", +"proc resetCursorMode args {", +" global cursorMode frame", +" if {$cursorMode} {", +" send imagewin getCursorPos x y", +" send client retCursorVal $x $y $frame 1 ^D", +" }", +"}; send initialize addCallback resetCursorMode", +"", +"send cursorMode addCallback setCursorMode", +"send imagewin addCallback keyInput input", +"", +"", +"# MARKER stuff. The active marker is determined by the global variable", +"# \"marker\", which is the marker the pointer is in, or which the pointer", +"# was most recently in.", +"", +"# Translations when pointer is inside marker.", +"set markerTranslations { \\", +"!Shift <Btn1Motion>: m_rotateResize()", +" <Btn1Motion>: m_moveResize()", +" !Shift <Btn1Down>: m_raise() m_markpos()", +" <Btn1Down>: m_raise() m_markposAdd()", +" <Btn1Up>: m_redraw() m_destroyNull()", +" <Btn2Down>: m_lower()", +" <Btn3Down>: popup(markerMenu)", +" <Btn3Up>: popdown(markerMenu)", +" !Ctrl <Key>b: call(prevFrame,$name)", +" !Ctrl <Key>f: call(nextFrame,$name)", +" !Ctrl <Key>h: call(move_cursor,-1,0)", +" !Ctrl <Key>j: call(move_cursor,0,1)", +" !Ctrl <Key>k: call(move_cursor,0,-1)", +" !Ctrl <Key>l: call(move_cursor,1,0)", +" !Ctrl <Key>n: call(normalize)", +" !Ctrl <Key>c: call(cpZoomAction,centerFrame)", +" !Ctrl <Key>i: call(cpInvert)", +" !Ctrl <Key>m: call(cpMatchFrames)", +" !Ctrl <Key>r: call(cpRegisterFrames)", +" !Ctrl <Key>p: call(togglePanner)", +" !Alt <Key>1: call(cpSetFrame,frame1)", +" !Alt <Key>2: call(cpSetFrame,frame2)", +" !Alt <Key>3: call(cpSetFrame,frame3)", +" !Alt <Key>4: call(cpSetFrame,frame4)", +" !Ctrl <Key>1: call(cpZoom,1,1,fixed)", +" !Ctrl <Key>2: call(cpZoom,2,2,fixed)", +" !Ctrl <Key>3: call(cpZoom,3,3,fixed)", +" !Ctrl <Key>4: call(cpZoom,4,4,fixed)", +" !Ctrl <Key>5: call(cpZoom,5,5,fixed)", +" !Ctrl <Key>6: call(cpZoom,6,6,fixed)", +" !Ctrl <Key>7: call(cpZoom,7,7,fixed)", +" !Ctrl <Key>8: call(cpZoom,8,8,fixed)", +" !Ctrl <Key>9: call(cpZoom,9,9,fixed)", +" <Key>BackSpace: m_deleteDestroy()", +" <Key>Delete: m_deleteDestroy()", +" <KeyPress>: m_input()", +" <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y)", +"}", +"", +"# Popup menu in effect when inside marker.", +"createMenu markerMenu imagewin {", +" { Marker f.title }", +" { f.dblline }", +" { Zoom f.exec {", +" zoomMarker $marker equal", +" send $marker destroy", +" } }", +" { Fill f.exec {", +" zoomMarker $marker fill", +" send $marker destroy", +" } }", +" { Print f.exec {", +" send $marker getRect interior x0 y0 nx ny", +" setPrintCorners $x0 [expr $y0 + $ny -1] \\", +" [expr $x0 + $nx -1] $y0", +" send client print $x0 $y0 $nx $ny", +" } }", +" { Save f.exec {", +" send imagewin setCursorType busy", +" send $marker getRect interior x0 y0 nx ny", +" send client save $x0 $y0 $nx $ny", +" send imagewin setCursorType idle", +" } }", +" { Info f.exec {", +" send infoText append \\", +" [format \"%s\\n\" [send $marker getRegion unmap]]", +" } }", +" { Unrotate f.exec {", +" send $marker setAttribute rotangle 0", +" } }", +" { f.dblline }", +" { Color f.menu markerColor }", +" { Type f.menu markerType }", +" { f.dblline }", +" { Destroy f.exec {", +" send $marker destroy", +" } }", +"}", +"", +"createMenu markerType markerMenu {", +" { Type f.title }", +" { f.dblline }", +" { Rectangle f.exec \"m_setType $marker rectangle\" }", +" { Box f.exec \"m_setType $marker box\" }", +" { Circle f.exec \"m_setType $marker circle\" }", +" { Ellipse f.exec \"m_setType $marker ellipse\" }", +" { Polygon f.exec \"m_setType $marker polygon\" }", +"}", +"", +"createMenu markerColor markerMenu {", +" { Color f.title }", +" { f.dblline }", +" { \"\" f.exec \"m_setColor $marker black\"", +" bitmap solid foreground black }", +" { \"\" f.exec \"m_setColor $marker white\" ", +" bitmap solid foreground white }", +" { \"\" f.exec \"m_setColor $marker red\" ", +" bitmap solid foreground red }", +" { \"\" f.exec \"m_setColor $marker green\" ", +" bitmap solid foreground green }", +" { \"\" f.exec \"m_setColor $marker blue\" ", +" bitmap solid foreground blue }", +" { \"\" f.exec \"m_setColor $marker magenta\" ", +" bitmap solid foreground magenta }", +" { \"\" f.exec \"m_setColor $marker cyan\" ", +" bitmap solid foreground cyan }", +" { \"\" f.exec \"m_setColor $marker yellow\" ", +" bitmap solid foreground yellow }", +"}", +"", +"proc m_setType {marker type} {", +" send $marker \"markpos; set type $type; redraw\"", +"}", +"proc m_setColor {marker color} {", +" send $marker \"markpos;", +" set lineColor $color; set highlightColor $color; redraw\"", +"}", +"", +"# Callback executed when a marker gets or loses the focus.", +"proc selectMarker {active_marker event event_data} \\", +"{", +" global marker", +" switch $event {", +" focusIn { set marker $active_marker }", +" focusOut { }", +" }", +"}", +"", +"# Create marker action. Makes a new marker.", +"proc makeMarker {parent x y} \\", +"{", +" global markerTranslations markno", +" set marker marker$markno; incr markno", +"", +" send $parent createMarker $marker \\", +" type rectangle \\", +" createMode interactive \\", +" translations $markerTranslations \\", +" x $x \\", +" y $y", +"", +" send $marker addCallback selectMarker focusIn focusOut", +"}", +"", +"", +" ", +"# WCSBOX -- Real time coordinate display.", +"", +"set track_enable 0", +"set last_x 0", +"set last_y 0", +"", +"proc wcsUpdate {x y} \\", +"{", +" global track_enable frame pixtab_up tabTop", +" global frameWidth frameHeight redraw_compass", +" global ism_enable wcsLabels last_x last_y", +" global ct_warn plotSpeed doHcut doVcut", +"", +"", +" # If the cursor was frozen release it now.", +" if {$ct_warn} {", +" curtrack_destroy", +" }", +"", +" # Convert screen coords to raster pixel.", +" send imagewin unmapPixel $x $y raster rx ry rz", +"", +" # Set the current frame to the frame the pointer is within.", +" if {$frame && $raster} {", +" set track_frame [send client getFrame $raster]", +" if {$frame != $track_frame} {", +" send client setFrame $track_frame", +" }", +" }", +"", +" # Update coords box.", +" if {$raster} {", +" set text [send client encodewcs $rx $ry $rz]", +" scan $text \"%g %g %g\" nx ny nz", +" } else {", +" set text [format \" %7.2f %7.2f %9.1f \" $rx $ry $rz]", +" set nx $rx ; set ny $ry ; set nz $rz", +" }", +" ", +" # Update the coords panel and pixel table.", +" wcsFmtSValue $nz", +" if {$pixtab_up} {", +" updatePixelTable $x $y $nx $ny", +" }", +"", +" # If the ISM is running update the coords box with all the selected", +" # options, otherwise just write the one-line frame wcs coords.", +" if {$ism_enable} {", +" updateCoordsBox", +"", +" } else {", +" # Update the on-screen marker.", +" if {$track_enable} {", +" send wcsbox \"set text \\{$text\\}; redraw noerase\"", +" }", +"", +" # Update the control panel readout (always done).", +" if {$wcsLabels} {", +" set ln [format \" X: %12s Y: %12s WCS: Display\" $nx $ny]", +" } else {", +" set ln [format \" %12s %12s Display\" $nx $ny]", +" }", +" send wtWcs1 set string $ln", +"", +" if {$redraw_compass} \\", +" drawCompass", +" }", +"", +"", +" # Update the cut-plots if enabled. If we're set for speed the don't ", +" # track the really large cursor motions, wait till the differences are", +" # small indicating a finer motion. ", +" if {$doHcut || $doVcut} {", +" set dist [ expr \"sqrt(pow(($last_x - $x),2) + pow(($last_y - $y),2))\" ]", +" if {($plotSpeed && $dist < 30) || ! $plotSpeed} {", +" cutPlots $x $y", +" }", +" }", +"", +" # Save the position so we can track differences with last position.", +" set last_x $x", +" set last_y $y", +"}", +"", +"", +"proc setTrack {state} \\", +"{", +" global ism_enable track_enable wcsboxGeom", +" global winWidth winHeight up_todo", +"", +" if {$state} {", +" if {$track_enable} \\", +" return", +"", +" send imagewin createMarker wcsbox {", +" type text", +" createMode noninteractive", +" width 27ch", +" height 1ch", +" lineWidth 0", +" imageText true", +" textBgColor black", +" textColor yellow", +" visible false", +" }", +"", +" set box_width [send wcsbox get width]", +" set box_height [send wcsbox get height]", +" set defGeom [format \"%sx%s-5-5\" $box_width $box_height]", +" send imagewin parseGeometry $wcsboxGeom $defGeom x y width height", +"", +" send wcsbox setAttributes \\", +" x $x \\", +" y $y \\", +" activated true \\", +" visible true \\", +" sensitive true", +"", +" send wcsbox {", +" addCallback wcsboxDestroyCallback destroy", +" addCallback wcsboxMoved moveResize", +" }", +"", +" send imagewin addCallback wcsboxWindowResize resize", +" set track_enable 1", +" send imagewin getCursorPos x y", +" wcsUpdate $x $y", +" magnifierMapImage $x $y", +"", +" # Turn on the option toggles on the control panel.", +" foreach n {1 2 3 4} { ", +" if {[send sysWcs$n get label] != \"None\"} {", +" send wiWcs$n set on True", +" }", +" }", +" if {$ism_enable} {", +" resizeCoordsBox $up_todo", +" }", +"", +" } elseif {$track_enable} {", +" set track_enable 0", +" send wcsbox destroy", +"", +" # Turn off the option toggles on the control panel.", +" foreach w {wiWcs1 wiWcs2 wiWcs3 wiWcs4} { send $w set on False }", +" resizeCoordsBox 0", +" }", +" updateCoordsBox", +"}", +"", +"proc wcsboxDestroyCallback args \\", +"{", +" global track_enable", +" send imagewin deleteCallback wcsboxWindowResize", +" set track_enable 0", +"}", +"", +"# If the window is resized make the wcsbox track the corner.", +"proc wcsboxWindowResize args \\", +"{", +" global track_enable", +" global wcsboxGeom", +"", +" if {$track_enable} {", +" # Get new location.", +" set box_width [send wcsbox get width]", +" set box_height [send wcsbox get height]", +" set defGeom [format \"%sx%s-5-5\" $box_width $box_height]", +" send imagewin parseGeometry $wcsboxGeom $defGeom x y width height", +"", +" # Move the marker.", +" send wcsbox \"\\", +" deleteCallback wcsboxMoved; \\", +" markpos; setAttributes x $x y $y; redraw; \\", +" addCallback wcsboxMoved moveResize\"", +" set wcsboxGeom [send imagewin getGeometry $x $y $width $height]", +" }", +"}", +"", +"proc wcsboxMoved {marker event position} \\", +"{", +" global wcsboxGeom", +" send wcsbox getRect boundary x y width height", +" set wcsboxGeom [send imagewin getGeometry $x $y $width $height]", +"}", +"", +"proc resetWcsbox {param old new} \\", +"{", +" global track_enable wcsboxGeom displayCoords", +" if {$new == \"done\"} {", +" setTrack [true $displayCoords]", +" } elseif {$track_enable} {", +" setTrack 0", +" if {$new == \"restart\"} {", +" set wcsboxGeom -5-5", +" }", +" }", +"}; send initialize addCallback resetWcsbox", +"", +"", +"", +"#---------------------", +"# FRAME BLINK.", +"#---------------------", +"set blinkId 0", +"set blinkIndex 0", +"", +"proc toggleBlink args \\", +"{", +" global blinkId blinkRate blinkIndex", +" global optionsMenuDescription", +"", +" if {$blinkId} {", +" deleteTimedCallback $blinkId", +" set blinkId 0", +" } else {", +" set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]]", +" }", +"", +" set blinkIndex 0", +" editMenu optionsMenu viewButton $optionsMenuDescription", +"}", +"", +"proc blink args \\", +"{", +" global blinkId blinkRate blinkFrames blinkIndex", +"", +" send client setFrame [lindex $blinkFrames $blinkIndex]", +" incr blinkIndex", +" if {$blinkIndex >= [llength $blinkFrames]} {", +" set blinkIndex 0", +" }", +"", +" set blinkId [postTimedCallback blink [expr int($blinkRate * 1000)]]", +"}", +"", +"proc resetBlink args \\", +"{", +" global blinkId", +" if {$blinkId} \\", +" toggleBlink", +"}; send initialize addCallback resetBlink", +"", +"", +"", +"# Normalize -- Reset the view parameters for the current frame.", +"proc normalize args \\", +"{", +" global zoomindex zoomfactor", +" global frameWidth frameHeight", +" global xcen ycen frame", +"", +" #set zoomindex($frame) 0", +" #set xcen [expr $frameWidth / 2]", +" #set ycen [expr $frameHeight / 2]", +" #send client zoom 1 1 $xcen $ycen", +" send client updateColormap 0.5 1.0", +"}", +"", +"", +"# Popdown menus.", +"createMenu fileMenu fileButton {", +" { \"Info\" f.exec { panelTabToggle info_panel } }", +" { \"Load\" f.exec {", +" panelTabToggle load_panel", +" set panel_up 1", +" } }", +" { \"Save\" f.exec { Save } }", +" { \"Save As...\" f.exec { panelTabToggle save_panel } }", +" { \"Print\" f.exec { ", +" send imagewin setCursorType busy", +" Print", +" send imagewin setCursorType idle", +" } }", +" { \"Print Setup\" f.exec { panelTabToggle print_panel } }", +" { f.dblline }", +" { \"Reset\" f.exec {", +" # Do a hard reset.", +" send client Reset", +" #resetView initialize done done", +" } }", +" { \"Debug Panel\" f.exec { tclPanel 1 } }", +" { \"Quit\" f.exec { Quit } }", +"}", +"", +"createMenu viewMenu viewButton {", +" { \"Next frame\" f.exec nextFrame }", +" { \"Prev frame\" f.exec prevFrame }", +" { f.dblline }", +" { \"Colormap\" f.menu cmapMenu }", +" { \"Flip\" f.menu flipMenu }", +" { f.dblline }", +" { \"Equal aspect\" f.exec {", +" set xmag $frameZoomX($frame)", +" set ymag $frameZoomY($frame)", +" set zoom [expr ($xmag + $ymag) / 2.0]", +" cpZoom $zoom $zoom fixed", +" } }", +" { \"Integer zoom\" f.exec {", +" set xmag [expr round ($frameZoomX($frame))]", +" set ymag [expr round ($frameZoomY($frame))]", +" cpZoom $xmag $ymag fixed", +" } }", +" { \"Toggle zoom\" f.exec toggleZoom }", +" { \"Unzoom\" f.exec {", +" set zoomindex($frame) 0", +" set mag $zoomfactor($zoomindex($frame))", +" send client zoom $mag $mag $xcen $ycen", +" } }", +"}", +"", +"createMenu cmapMenu viewMenu {", +" { \"Normalize\" f.exec normalize }", +" { \"Invert\" f.exec cpInvert }", +" { \"Optimize\" f.exec cpOptimize sensitive false }", +" { f.dblline }", +" { \"Grayscale\" f.exec \"send client setColormap Grayscale\" }", +" { \"Color\" f.exec \"send client setColormap Color\" }", +" { \"Heat\" f.exec \"send client setColormap Heat\" }", +" { \"HSV\" f.exec \"send client setColormap HSV\" }", +" { \"AIPS0\" f.exec \"send client setColormap AIPS0\" }", +" { \"Halley\" f.exec \"send client setColormap Halley\" }", +" { \"Ramp\" f.exec \"send client setColormap Ramp\" }", +" { \"Standard\" f.exec \"send client setColormap Standard\" }", +" { \"Staircase\" f.exec \"send client setColormap Staircase\" }", +" { \"Rainbow1\" f.exec \"send client setColormap Rainbow1\" }", +" { \"Rainbow2\" f.exec \"send client setColormap Rainbow2\" }", +" { \"Random8\" f.exec \"send client setColormap Random8\" }", +"}", +"", +"createMenu flipMenu viewMenu {", +" { \"Flip X\" f.exec xflip }", +" { \"Flip Y\" f.exec yflip }", +" { \"Flip XY\" f.exec xyflip }", +"}", +"", +"set optionsMenuDescription {", +" { \"Autoscale\" f.exec {", +" set value [send autoscaleButton get on]", +" send autoscaleButton set on [expr !$value]", +" cpSetAutoscale", +" } }", +" { \"Antialias\" f.exec {", +" set value [send antialiasButton get on]", +" send antialiasButton set on [expr !$value]", +" cpSetAntialias", +" } }", +" { \"Panner\" f.exec { setPanner [expr !$panner_enable] } }", +" { \"Magnifier\" f.exec { setMagnifier [expr !$magnifier_enable] }}", +" { \"Coords box\" f.exec { setTrack [expr !$track_enable] } }", +" { \"Tile frames\" f.exec {", +" set value [send tileFramesButton get on]", +" send tileFramesButton set on [expr !$value]", +" cpSetTileFrames", +" } }", +" { \"Clear frame\" f.exec clearFrame }", +" { \"Fit frame\" f.exec fitFrame }", +" { \"Match LUTs\" f.exec cpMatchFrames }", +" { \"Auto-Register\" f.exec cpAutoRegister }", +" { \"Register\" f.exec cpRegisterFrames }", +" { {$blinkId ? \"Stop blink\" : \"Blink frames\"}", +" f.exec toggleBlink }", +" { f.dblline }", +" { \"Control Panel\" f.exec { panelTabToggle display_panel } }", +" { \"Print Panel\" f.exec { panelTabToggle print_panel } }", +" { \"Load Panel\" f.exec { panelTabToggle load_panel } }", +" { \"Save Panel\" f.exec { panelTabToggle save_panel } }", +"}; createMenu optionsMenu optionsButton $optionsMenuDescription", +"", +"", +"", +"#-------------------------------", +"# Frozen Cursor Warning Message", +"#-------------------------------", +"", +"set ct_warn 0", +"", +"proc curtrack_msg { x y args } \\", +"{", +" global ct_warn last_x last_y winHeight winWidth", +"", +"", +" if {! $ct_warn == 0} {", +" return", +" }", +" ", +" send imagewin createMarker curtrack_warn {", +" type text", +" createMode noninteractive", +" width 25ch", +" height 21", +" lineWidth 0", +" imageText true", +" textBgColor red", +" textColor yellow", +" visible true", +" sensitive true", +" activated true", +" x 5", +" y 5", +" }", +"", +" send curtrack_warn \"set text \\{ CURSOR READOUT FROZEN \\}\"", +" set ypos [ expr ($winHeight - 25) ]", +" send curtrack_warn \"markpos; setAttributes x 5 y $ypos; redraw\"", +" send curtrack_warn \"redraw noerase\"", +" set ct_warn 1", +"", +" # Mark the position of the cursor.", +" send imagewin createMarker x_curpos \\", +" type box \\", +" createMode noninteractive \\", +" lineColor red \\", +" x 1 \\", +" y $last_y \\", +" width $winWidth \\", +" height 1 \\", +" activated True \\", +" visible True \\", +" sensitive False", +"", +" send imagewin createMarker y_curpos \\", +" type box \\", +" createMode noninteractive \\", +" lineColor red \\", +" x $last_x \\", +" y 1 \\", +" width 1 \\", +" height $winHeight \\", +" activated True \\", +" visible True \\", +" sensitive False", +"", +" # Raise the coordinate marker so we can see where we are.", +" send wcsbox raise", +"}", +"", +"", +"proc curtrack_destroy args \\", +"{", +" global ct_warn", +"", +" if {$ct_warn} {", +" send curtrack_warn destroy", +" send x_curpos destroy", +" send y_curpos destroy", +" set ct_warn 0", +" }", +"}", +"", +"", +"################################################################################", +"# CURSOR CENTEROID AND AUTO-REGISTER FUNCTIONS.", +"################################################################################", +"", +"# Set the centroiding box size.", +"set ctid 0", +"set cid 0", +"", +"proc cbxDestroy args \\", +"{", +" global centerBoxSize cid ctid", +" catch { ", +" if {$ctid != 0} {", +" send cbm$cid destroy ", +" deleteTimedCallback $ctid", +" set ctid 0", +" }", +" }", +"}", +"", +"proc setCtrBoxSize { x y delta args } \\", +"{", +" global centerBoxSize cid ctid", +" global cpXscale cpYscale", +"", +" incr centerBoxSize $delta", +" if {$centerBoxSize <= 1} { set centerBoxSize 1 }", +"", +" # Kill off any old markers before drawing the new one.", +" catch { ", +" if {$ctid != 0} {", +" send cbm$cid destroy ", +" deleteTimedCallback $ctid", +" set ctid 0", +" }", +" }", +"", +" # create a transient marker indicating the centering box and post a", +" # callback to delete it in about a second.", +" incr cid", +" send imagewin createMarker cbm$cid \\", +" type box \\", +" createMode noninteractive \\", +" lineColor red \\", +" x $x \\", +" y $y \\", +" width [expr $cpXscale * $centerBoxSize] \\", +" height [expr $cpXscale * $centerBoxSize] \\", +" activated True \\", +" visible True \\", +" sensitive False", +"", +" set ctid [ postTimedCallback cbxDestroy 500]", +"}", +"", +"", +"# Box size is half-width of the marker size. Value is the slider value.", +"set focusBoxSize $winWidth ", +"set focusValue 100.0", +"set fid 0", +"set ftid 0", +"set moving 0", +"", +"proc setFocusBoxSize { sz args } \\", +"{", +" global focusBoxSize fid ftid focusValue moving", +" global winWidth winHeight", +"", +"", +" if { $moving == 0 } {", +" return done", +" }", +"", +" if { $winWidth < $winHeight } {", +" set max [expr $winWidth / 2 - 64]", +" } else {", +" set max [expr $winHeight / 2 - 64]", +" }", +" set focusBoxSize [expr 64 + ($sz * $max) - 1]", +" #send client setOption cmfocus [expr ($focusBoxSize / 2)]", +" send client setOption cmfocus $focusBoxSize", +"", +" # Destroy any existing markers.", +" catch { ", +" if {$ftid != 0} {", +" send fm$fid destroy ", +" set ftid 0", +" }", +" }", +"", +" # create a transient marker indicating the centering box and post a", +" # callback to delete it in about a second.", +" incr fid", +" send imagewin createMarker fm$fid \\", +" type box \\", +" createMode noninteractive \\", +" lineColor green \\", +" lineWidth 4 \\", +" x [expr $winWidth / 2] \\", +" y [expr $winHeight / 2] \\", +" width $focusBoxSize \\", +" height $focusBoxSize \\", +" activated True \\", +" visible True \\", +" sensitive False", +"", +" set ftid [ postTimedCallback fbxDestroy 500]", +" set moving 0", +"}", +"", +"proc fbxDestroy args \\", +"{", +" global fid ftid moving", +" catch { ", +" if {$ftid != 0} {", +" send fm$fid destroy ", +" set ftid 0", +" }", +" }", +"}", +"", +"proc setFocusSize { widget cbtype x y } \\", +"{", +" global focusValue ftid moving", +"", +" # Only update once we've stopped the movement.", +" if { $x == $focusValue && $moving == 1 } {", +" set ftid [ postWorkProc setFocusBoxSize $x ]", +" } else {", +" set moving 1", +" }", +" set focusValue $x", +"} ; send focusSlider addCallback setFocusSize scroll", +"", +"", +"# Compute a centroid offset for the current position to peak-up on the", +"# feature.", +"", +"proc centroid { x y type args } \\", +"{", +" global centerBoxSize", +" global cpXscale cpYscale", +"", +" # Convert to image coords.", +" set sz [expr \"int ($centerBoxSize * $cpXscale)\"]", +"", +" # Get the centroid position.", +" if {$type != \"min\"} {", +" if {[send peakupButton get on]} {", +" set center [ send client centroid $x $y $sz ]", +" } else {", +" set center [ send client centroid $x $y $sz max ]", +" }", +" } else {", +" set center [ send client centroid $x $y $sz min ]", +" }", +"", +" # Now reposition the cursor.", +" set xoff [lindex $center 0 ]", +" set yoff [lindex $center 1 ]", +" move_cursor $xoff $yoff", +"}", +"", +"", +"# Set the auto-register center offset position", +"proc offset { x y args } \\", +"{", +" global frame blinkFrames auto_reg", +" global frameCenterX frameCenterY", +" global frameOffsetX frameOffsetY", +"", +" # No-op of auto-register isn't on.", +" if { $auto_reg == 0 } {", +" Wexec client \"Auto-Register is not enabled!\"", +" return", +" }", +"", +" # If we're not in the blink frames list ignore the request.", +" if { [string first $frame $blinkFrames] == -1 } {", +" Wexec client \"Frame not in current\\nregister list.\"", +" return", +" }", +"", +" set rx $x; set ry $y", +" set raster 0", +"", +" # Convert raw screen coordinates to frame buffer raster coordinates.", +" send imagewin unmapPixel $x $y raster rx ry", +"", +" # Select a pixel.", +" set xoff [expr \"int ($rx) - $frameCenterX($frame)\" ]", +" set yoff [expr \"int ($ry) - $frameCenterY($frame)\" ]", +"", +" set frameOffsetX($frame) $xoff", +" set frameOffsetY($frame) $yoff", +"", +" # Adjust the display.", +" send client setOffset $xoff $yoff", +"}", +"", +"", +"", +"################################################################################", +"# MAIN CONTROL PANEL", +"################################################################################", +"", +"", +"# Global control panel buttons.", +"# -------------------------------", +"proc cpInitialize args \\", +"{", +" send imagewin setCursorType busy", +" send client initialize", +" send imagewin setCursorType idle", +"}", +"send initializeButton addCallback cpInitialize", +"send normalizeButton addCallback normalize", +"", +"# Temporarily deactivate some buttons.", +"send optimizeButton setSensitive false", +"", +"#-----------------------------------------------------------------------------", +"", +"foreach i $frames {set saveView($i) \"1 1\"}", +"", +"send prevFrame set bitmap larrow", +"send nextFrame set bitmap rarrow", +"send contrastLabel set bitmap contrast", +"send brightnessLabel set bitmap brightness", +"send contrastSlider resizeThumb 0.1 1.0", +"send brightnessSlider resizeThumb 0.1 1.0", +"send focusSlider \"resizeThumb 0.1 1.0 ; moveThumb 1.0\"", +"", +"", +"# panel -- Toggle control panel display.", +"proc panel args \\", +"{", +" global panel_up", +" if {$panel_up} {", +" send panelShell unmap", +" set panel_up 0", +" } else {", +" send panelShell map", +" set panel_up 1", +" }", +"}", +"", +"proc pbTracePanel {name element op} \\", +"{", +" catch {", +" upvar $name panel_up", +" send controlButton set state $panel_up", +" }", +"} ; trace variable panel_up w pbTracePanel", +"", +"", +"# resetPanel -- Calling during startup or in an initialize, to reset things.", +"proc resetPanel {param old new} \\", +"{", +" global frame nframes frames", +" global displayPanner displayMagnifier displayCoords", +" global blinkFrames warnings peakCentroid", +"", +" switch $new {", +" startup {", +" }", +" restart { foreach i $frames {", +" send frame$frame set on 0", +" }", +"", +" # Initialize to hide the extra frames.", +" send frlistBox set width 30", +" }", +" done { if {$frame} {", +" send frame$frame set on 1", +" }", +"", +" cpResetBlink", +" set button 1", +" foreach i {1 2 3 4} {", +" send blinkFrame$button set label $i", +" incr button", +" }", +" for {set i 1} {$i <= 16} {incr i} {", +" send brFrame$i set label $i", +" }", +"", +" cpResetEnhance", +" send pannerButton set on [true $displayPanner]", +" send magnifierButton set on [true $displayMagnifier]", +" send coordsBoxButton set on [true $displayCoords]", +" send warningsButton set on $warnings", +" send peakupButton set on [true $peakCentroid]", +" }", +" }", +"}; send initialize addCallback resetPanel", +"", +"", +"", +"# Control Panel Tabs widget procedures.", +"#----------------------------------------", +"", +"set cpTabs { display_panel print_panel load_panel save_panel \\", +" info_panel wcs_panel tile_panel}", +"set tabTop \"display_panel\"", +"", +"", +"# Resize the control panel depending on the Tab selected.", +"proc cpResizeCB { widget event a b c d e args } \\", +"{", +" global tabTop fileList", +"", +" # Handle only the first exposure event generated.", +" if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } {", +" set tabTop $widget", +"", +" switch $widget {", +" display_panel { send panel set height 595 }", +" print_panel { send panel set height 545 }", +" load_panel { send panel set height 485 ", +" if { [send browseHdrs get on] } {", +" send imageList setList $fileList resize", +" } else {", +" send client setLoadOption rescan", +" }", +" }", +" save_panel { send panel set height 325 }", +" info_panel { send panel set height 380 }", +" tile_panel { send panel set height 405 }", +" wcs_panel { setCoordPanelHeight }", +" }", +" }", +"} ; foreach w $cpTabs { send $w addEventHandler cpResizeCB exposureMask }", +"", +"", +"proc panelDismiss args \\", +"{", +" global panel_up", +" send panelShell unmap", +" set panel_up 0", +"} ; send panelClose addCallback panelDismiss", +"", +"", +"proc panelTabToggle { panel args } \\", +"{", +" global tabTop panel_up TabToWidget", +"", +" if {$tabTop == $panel && $panel_up} {", +" send panelShell unmap", +" send $TabToWidget($panel) set state 0", +" set panel_up 0", +"", +" } else {", +" # Special cases for each panel.", +" if {$panel == \"load_panel\"} {", +" send client setLoadOption rescan", +" }", +"", +" send panelTabs setTop $panel", +" set tabTop $panel", +"", +" # Now fire it up if it's not already open.", +" if {$panel_up == 0} {", +" send panelShell map", +" set panel_up 1", +" }", +"", +" }", +"}", +"", +"proc displayPanel args { panelTabToggle display_panel }", +"proc infoPanel args { panelTabToggle info_panel }", +"proc loadPanel args { panelTabToggle load_panel }", +"proc savePanel args { panelTabToggle save_panel }", +"proc printPanel args { panelTabToggle print_panel }", +"proc tilePanel args { panelTabToggle tile_panel }", +"proc wcsPanel args { panelTabToggle wcs_panel }", +"", +"", +"", +"", +"# Frame selection.", +"# -------------------------------", +"proc cpSetFrame {widget args} \\", +"{", +" send $widget set on 0", +" send client setFrame [send $widget get label]", +"}", +"", +"proc cpFrameChanged {param old new} \\", +"{", +" global frameCache", +"", +" if {$old > 0} {", +" send frame$old set on 0", +" }", +" if {$new > 0} {", +" send frame$new set on 1", +" }", +"", +" # The first time we request frame 5 or higher reset ", +" # the extra frame buttons on the control panel to make", +" # them visible.", +" if {$new >= 5} {", +" send frlistBox set width 49", +" }", +"", +" # Update the header panel object list.", +" catch {", +" # Only update when the header panel is open.", +" if {[info exists frameCache($new)] && [send imageHeader get on]} {", +" setHdrObjMenu $new", +" getHeader [lindex $frameCache($new) 0] [lindex $frameCache($new) 1]", +" }", +" }", +"}", +"", +"send prevFrame addCallback prevFrame", +"send nextFrame addCallback nextFrame", +"send frame addCallback cpFrameChanged", +"for {set i 1} {$i <= 16} {incr i} {send frame$i addCallback cpSetFrame}", +"", +"# Initialize to hide the extra frames.", +"send frlistBox set width 30", +"", +"proc blinkPanelCB { widget type state args } \\", +"{", +" if {$state} {", +" send blink_panel map", +" } else {", +" send blink_panel unmap", +" }", +"} ; send blinkPanel addCallback blinkPanelCB", +"", +"proc blinkPanelClose args \\", +"{", +" send blink_panel unmap", +" send blinkPanel set state 0", +"} ; send brClose addCallback blinkPanelClose", +"", +"", +"", +"# Frame buttons.", +"proc cpFrameAction {widget args} \\", +"{", +" global frameZoomX frameZoomY frame", +" switch $widget {", +" aspect { set xmag $frameZoomX($frame)", +" set ymag $frameZoomY($frame)", +" set zoom [expr round (($xmag + $ymag) / 2.0)]", +" cpZoom $zoom $zoom fixed", +" }", +" flipX { send client flip x }", +" flipY { send client flip y }", +" flipXY { send client flip x y }", +" clearFrame { clearFrame }", +" fitFrame { fitFrame }", +" }", +"}", +"foreach widget {aspect flipX flipY flipXY clearFrame fitFrame} {", +" send $widget addCallback cpFrameAction", +"}", +"", +"# clearFrame -- Clear the current display frame.", +"proc clearFrame args \\", +"{", +" global warnings", +" if {$warnings} {", +" Wexec client \\", +" \"Clearing the frame will destroy\\n\\", +" all data in the frame\" \\", +" clearFrame", +" } else {", +" send client clearFrame", +" }", +"}", +"", +"# fitFrame -- Resize the display window to fit the frame buffer.", +"proc fitFrame args \\", +"{", +" global frameWidth frameHeight winWidth winHeight", +" set dw [expr [send display get width] - $winWidth]", +" set dh [expr [send display get height] - $winHeight]", +" send display \"resize [expr $frameWidth + $dw] [expr $frameHeight + $dh]\"", +"}", +"", +"proc initFitFrame { param old new } \\", +"{", +" if { [lindex $new 0] == \"resize\"} {", +" fitFrame", +" }", +" pannerMapImage init", +"}; send frameFit addCallback initFitFrame", +"", +"", +"", +"# Zoom and pan buttons.", +"# -------------------------------", +"proc cpZoomAction {widget args} \\", +"{", +" global frameWidth frameHeight", +"", +" switch $widget {", +" x1 { cpZoom 1 1 fixed }", +" z2 { cpZoom 2 2 fixed }", +" z3 { cpZoom 3 3 fixed }", +" z4 { cpZoom 4 4 fixed }", +" z5 { cpZoom 5 5 fixed }", +" z8 { cpZoom 8 8 fixed }", +"", +" d2 { cpZoom [expr 1.0/2] [expr 1.0/2] fixed }", +" d3 { cpZoom [expr 1.0/3] [expr 1.0/3] fixed }", +" d4 { cpZoom [expr 1.0/4] [expr 1.0/4] fixed }", +" d5 { cpZoom [expr 1.0/5] [expr 1.0/5] fixed }", +" d8 { cpZoom [expr 1.0/8] [expr 1.0/8] fixed }", +"", +" zoomIn { cpZoom 2.0 2.0 relative }", +" zoomOut { cpZoom 0.5 0.5 relative }", +"", +" centerFrame { send client pan \\", +" [expr $frameWidth/2.0] \\", +" [expr $frameHeight/2.0]", +" }", +" toggleZoom { toggleZoom }", +" }", +"}", +"", +"proc cpZoom {zoom_x zoom_y mode} \\", +"{", +" global frameZoomX frameZoomY zoomindex frame", +" global frameOffsetX frameOffsetY frameCenterX frameCenterY", +"", +" if {$mode == \"fixed\"} {", +" #send client zoom $zoom_x $zoom_y", +" send client zoomAbs $zoom_x $zoom_y \\", +" $frameCenterX($frame) $frameCenterY($frame) \\", +" $frameOffsetX($frame) $frameOffsetY($frame)", +" } else {", +" #send client zoom \\", +" # [expr $frameZoomX($frame) * $zoom_x] \\", +" # [expr $frameZoomY($frame) * $zoom_y]", +" send client zoomAbs \\", +" [expr $frameZoomX($frame) * $zoom_x] \\", +" [expr $frameZoomY($frame) * $zoom_y] \\", +" $frameCenterX($frame) $frameCenterY($frame) \\", +" $frameOffsetX($frame) $frameOffsetY($frame)", +" }", +"", +" set zoomindex($frame) 0", +"}", +"", +"proc toggleZoom args \\", +"{", +" global frameZoomX frameZoomY frameCenterX frameCenterY", +" global frameWidth frameHeight saveView frame", +"", +" if {$frameZoomX($frame) != 1 && $frameZoomY($frame) != 1} {", +" set saveView($frame) \\", +" \"$frameZoomX($frame) $frameZoomY($frame) \\", +" $frameCenterX($frame) $frameCenterY($frame)\"", +" send client zoom 1 1 \\", +" [expr $frameWidth/2.0] \\", +" [expr $frameHeight/2.0]", +" } else {", +" send client zoom $saveView($frame)", +" }", +"}", +"", +"foreach widget { toggleZoom centerFrame zoomIn zoomOut \\", +" x1 z2 z3 z4 z5 z8 d2 d3 d4 d5 d8 } {", +" send $widget addCallback cpZoomAction", +"}", +"", +"# Frame data display.", +"# -------------------------------", +"set cpFrame 0", +"set cpXcen 0", +"set cpYcen 0", +"set cpXmag 0", +"set cpYmag 0", +"set cpXscale 0", +"set cpYscale 0", +"set cpXoff 0", +"set cpYoff 0", +"", +"proc cpDisplayFrameData {name old new} \\", +"{", +" global cpFrame cpXcen cpYcen cpXoff cpYoff", +" global cpXmag cpYmag cpXscale cpYscale", +"", +" set update 0", +" switch $name {", +" frame { if {$new != $cpFrame} {", +" set cpFrame $new", +" set update 1", +" }", +" }", +" frameView { # Parse the frameView input.", +" set xmag [lindex $new 0]; set ymag [lindex $new 1]", +" set xcen [lindex $new 2]; set ycen [lindex $new 3]", +" set xnorm [lindex $new 4]; set ynorm [lindex $new 5]", +" set xoff [lindex $new 6]; set yoff [lindex $new 7]", +"", +" # We need client coords and the overall scale factors.", +" set text [send client encodewcs $xcen $ycen]", +" set xcen [lindex $text 0]", +" set ycen [lindex $text 1]", +" set xscale [expr $xmag * $xnorm]", +" set yscale [expr $ymag * $ynorm]", +"", +" if {$xcen != $cpXcen || $ycen != $cpYcen ||", +" $xmag != $cpXmag || $ymag != $cpYmag ||", +" $xoff != $cpXoff || $yoff != $cpYoff ||", +" $xscale != $cpXscale || $yscale != $cpYscale} {", +"", +" set cpXcen $xcen; set cpXscale $xscale", +" set cpYcen $ycen; set cpYscale $yscale", +" set cpXmag $xmag; set cpXoff $xoff; ", +" set cpYmag $ymag; set cpYoff $yoff;", +" set update 1", +" }", +" }", +" }", +"", +" if {$update} {", +" set header [format \"-- Frame %d --\" $cpFrame]", +" set center [format \"X center: %0.1f\\nY center: %0.1f\" $cpXcen $cpYcen]", +" if {int($cpXmag) >= 10} {", +" set zoom1 [format \" X zoom: %0.1f\" $cpXmag]", +" set zoom2 [format \" Y zoom: %0.1f\" $cpYmag]", +" } else {", +" set zoom1 [format \"X zoom: %0.1f\" $cpXmag]", +" set zoom2 [format \"Y zoom: %0.1f\" $cpYmag]", +" }", +" if {int($cpXscale) >= 10} {", +" set scale1 [format \"X scale: %0.1f\" $cpXscale]", +" set scale2 [format \"Y scale: %0.1f\" $cpYscale]", +" } else {", +" set scale1 [format \"X scale: %0.2f\" $cpXscale]", +" set scale2 [format \"Y scale: %0.2f\" $cpYscale]", +" }", +" set offset [format \" Offset: (%0.1f,%0.1f)\" $cpXoff $cpYoff]", +"", +" send frameData set label [format \"%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\" \\", +" $header $center $scale1 $scale2 $zoom1 $zoom2 $offset \\", +" ]", +" }", +"}; foreach p {frame frameView} {send $p addCallback cpDisplayFrameData}", +"", +"", +"# Frame enhancement.", +"# -------------------------------", +"set cpEnhanceDisable 0", +"set cpEnhanceId 0", +"set cpEnhanceMode none", +"set cpEnhanceVal 0", +"set cpListItem none", +"", +"# Windowing the colormap is slow when the mouse is not in the image window,", +"# so it is necessary to execute the windowColormap in a work procedure.", +"# This allows any number of slider motion events to be processed for each", +"# windowColormap, preventing slider events from queueing up.", +"", +"proc cpResetEnhance args \\", +"{", +" global cpListItem cpEnhanceId", +" set cpListItem none", +" set cpEnhanceId 0", +"}", +"", +"proc cpSetEnhancement {widget cbtype x y} \\", +"{", +" global cpEnhanceMode cpEnhanceVal cpEnhanceId cpEnhanceDisable", +" set cpEnhanceMode $widget", +" set cpEnhanceVal $x", +" if {!$cpEnhanceId && !$cpEnhanceDisable} {", +" set cpEnhanceId [postWorkProc cpEnhanceProc]", +" }", +"}", +"proc cpEnhanceProc args \\", +"{", +" global cpEnhanceMode cpEnhanceVal cpEnhanceId", +" global enhancement frame maxContrast", +" set val $cpEnhanceVal", +"", +" if {$cpEnhanceMode == \"contrastSlider\"} {", +" set contrast [lindex $enhancement($frame) 2]", +" send client windowColormap [lindex $enhancement($frame) 1] \\", +" [expr (($contrast < 0) ? -$val : $val) * $maxContrast] ", +" } else {", +" send client windowColormap $val", +" }", +"", +" set cpEnhanceId 0", +" return done", +"}", +"", +"proc cpInvert args \\", +"{", +" global enhancement frame", +" set contrast [lindex $enhancement($frame) 2]", +" send client updateColormap [lindex $enhancement($frame) 1] \\", +" [expr -1.0 * $contrast]", +"}", +"", +"proc cpDisplayEnhancement {param old new} \\", +"{", +" global cpEnhanceId maxContrast cpEnhanceDisable", +" global cpListItem enhancement frame", +"", +" if {!$frame} \\", +" return", +" set enhance $enhancement($frame)", +" if {[llength $enhance] < 3} \\", +" return", +"", +" set colortable [lindex $enhance 0]", +" set offset [lindex $enhance 1]", +" set scale [lindex $enhance 2]", +"", +" send colordata set label [format \"-- %s --\\nCon %0.2f Brt %0.2f\" \\", +" $colortable $scale $offset]", +"", +" if {$colortable != $cpListItem} {", +" send colorlist highlight $colortable", +" set cpListItem $colortable", +" }", +"", +" if {!$cpEnhanceId && !$cpEnhanceDisable} {", +" set cpEnhanceDisable 1", +" send contrastSlider moveThumb [expr abs($scale) / $maxContrast]", +" send brightnessSlider moveThumb $offset", +" set cpEnhanceDisable 0", +" }", +"}", +"", +"foreach i {enhancement frame} {", +" send $i addCallback cpDisplayEnhancement", +"}", +"send contrastSlider addCallback cpSetEnhancement scroll", +"send brightnessSlider addCallback cpSetEnhancement scroll", +"send invertButton addCallback cpInvert", +"", +"", +"# Colortable display and selection.", +"# -------------------------------", +"set colorTables {}", +"", +"proc cpSetColorList {param old new} \\", +"{", +" set colorTables $new", +" send colorlist setList $new resize", +"}; send colortables addCallback cpSetColorList", +"", +"proc colorlistResize args \\", +"{", +" global colorTables", +" send colorlist setList $colorTables resize", +"}; send colorlist addEventHandler colorlistResize ResizeRedirectMask", +"", +"proc cpSelectColor {widget cbtype selections indices} \\", +"{", +" global colortable", +" foreach selection $selections {", +" send client setColormap $selection", +" }", +"}; send colorlist addCallback cpSelectColor", +" ", +"", +"# Frame blink.", +"# -------------------------------", +"send BRtext set label $blinkRate", +"send brBRtext set label $blinkRate", +"", +"proc cpSetBlinkRate {w args} \\", +"{", +" global blinkRate", +" if {$w == \"BRincrease\" || $w == \"brBRincrease\"} {", +" if {$blinkRate < 0.01} {", +" set blinkRate 0.125", +" } else {", +" set blinkRate [expr $blinkRate * 2.0]", +" }", +" } else {", +" set blinkRate [expr $blinkRate / 2.0]", +" if {$blinkRate < 0.01} {", +" set blinkRate 0", +" }", +" }", +" send BRtext set label $blinkRate", +" send brBRtext set label $blinkRate", +"}", +"foreach w {BRincrease BRdecrease brBRincrease brBRdecrease} {", +" send $w addCallback cpSetBlinkRate", +"}", +"", +"proc cpSetBlinkFrame {widget args} \\", +"{", +" global blinkFrames frames nframes", +"", +" set frame [send $widget get label]", +" if {$frame == \" \"} {", +" set frame 1", +" } else {", +" incr frame", +" if {$frame > $nframes} {", +" set frame \" \"", +" }", +" }", +" send $widget set label $frame", +"", +" set blinkFrames {}", +" foreach i {1 2 3 4} {", +" set frame [send blinkFrame$i get label]", +" if {$frame != \" \"} {", +" lappend blinkFrames $frame", +" }", +" }", +"}; foreach i {1 2 3 4} {send blinkFrame$i addCallback cpSetBlinkFrame}", +"", +"proc cpBlink {widget args} \\", +"{", +" global blinkRate blinkId", +"", +" if {$blinkRate < 0.01} {", +" send blinkButton set on False", +" send brBlinkButton set on False", +" blink", +" } elseif {($blinkId != 0) != [send $widget get on]} {", +" toggleBlink", +" }", +"} ; foreach w {blinkButton brBlinkButton} {send $w addCallback cpBlink}", +"", +"", +"proc cpAutoRegister {widget type state args} \\", +"{", +" global auto_reg frame frames blinkFrames", +" global frameZoomX frameZoomY frameOffsetX frameOffsetY", +"", +" set auto_reg $state", +" if {$auto_reg == 1} {", +" send autoregButton set on True", +" send brAregButton set on True", +" } else {", +" send autoregButton set on False", +" send brAregButton set on False", +" }", +"", +" # Register the frames to zero the offsets.", +" send client registerFrames \\{$blinkFrames\\}", +" foreach f $frames {", +" set frameOffsetX($f) 0", +" set frameOffsetY($f) 0", +" }", +"} ; foreach w {autoregButton brAregButton} {send $w addCallback cpAutoRegister}", +"", +"", +"proc toggleAutoReg args \\", +"{", +" global auto_reg", +" if {$auto_reg} {", +" cpAutoRegister autoregButton dummy 0 ", +" set auto_reg 0", +" } else {", +" cpAutoRegister autoregButton dummy 1 ", +" set auto_reg 1", +" }", +"}", +"", +"proc resetAutoReg args \\", +"{", +" global auto_reg", +" if {$auto_reg} \\", +" toggleAutoReg", +"}; send initialize addCallback resetAutoReg", +"", +"", +"proc cpResetBlink args \\", +"{", +" global blinkRate blinkFrames blinkIndex frames", +" global defaultBlinkRate", +"", +" foreach i {1 2 3 4} {", +" send blinkFrame$i set label \" \"", +" }", +" for {set i 1} {$i <= 16} {incr i} {", +" send brFrame$i set label $i", +" }", +" set blinkRate $defaultBlinkRate", +" send BRtext set label $blinkRate", +" send brBRtext set label $blinkRate", +" set blinkIndex 0", +"} ", +"send blinkReset addCallback cpResetBlink", +"send brReset addCallback cpResetBlink", +"", +"proc cpTraceBlink {name element op} \\", +"{", +" upvar $name blinkId", +" send blinkButton set on [expr $blinkId != 0]", +" send brBlinkButton set on [expr $blinkId != 0]", +"}; trace variable blinkId w cpTraceBlink", +"", +"proc cpSetBlinkFrames {param old new} \\", +"{", +" global blinkFrames frames", +"", +" set blinkFrames {}", +" foreach i $frames {", +" if {$i <= $new} {", +" lappend blinkFrames $i", +" }", +" }", +" cpResetBlink", +" set button 1", +" for {set i 1} {$i <= $new} {incr i} {", +" if {$i <= 4} {", +" send blinkFrame$button set label $i", +" }", +" send brFrame$button set label $i", +" incr button", +" }", +"}; send nframes addCallback cpSetBlinkFrames", +"", +"proc cpRegisterFrames args \\", +"{", +" global frames blinkFrames", +" global frameOffsetX frameOffsetY", +"", +" foreach f $frames {", +" set frameOffsetX($f) 0", +" set frameOffsetY($f) 0", +" }", +" send client registerFrames \\{$blinkFrames\\}", +"}", +"send registerButton addCallback cpRegisterFrames", +"send brRegButton addCallback cpRegisterFrames", +"", +"proc cpMatchFrames args \\", +"{", +" global blinkFrames", +" send client matchFrames \\{$blinkFrames\\}", +"}", +"send matchButton addCallback cpMatchFrames", +"send brMatchButton addCallback cpMatchFrames", +"", +"", +"# Options buttons.", +"# -------------------------------", +"proc cpSetPanner {widget args} \\", +"{", +" setPanner [send $widget get on]", +"}; send pannerButton addCallback cpSetPanner", +"", +"proc cpTracePanner {name element op} \\", +"{", +" upvar $name panner_enable", +" send pannerButton set on $panner_enable", +"}; trace variable panner_enable w cpTracePanner", +"", +"proc cpSetMagnifier {widget args} \\", +"{", +" setMagnifier [send $widget get on]", +"}; send magnifierButton addCallback cpSetMagnifier", +"", +"proc cpTraceMagnifier {name element op} \\", +"{", +" upvar $name magnifier_enable", +" send magnifierButton set on $magnifier_enable", +"}; trace variable magnifier_enable w cpTraceMagnifier", +"", +"proc cpSetCoordsBox {widget args} \\", +"{", +" setTrack [send $widget get on]", +"}; send coordsBoxButton addCallback cpSetCoordsBox", +"", +"proc cpTraceCoordsBox {name element op} \\", +"{", +" upvar $name track_enable", +" send coordsBoxButton set on $track_enable", +"}; trace variable track_enable w cpTraceCoordsBox", +"", +"proc cpSetWarnings args \\", +"{", +" global warnings", +" set warnings [send warningsButton get on]", +"}; send warningsButton addCallback cpSetWarnings", +"", +"proc cpSetAutoscale args \\", +"{", +" set value [send autoscaleButton get on]", +" send client setOption autoscale [expr {$value ? \"True\" : \"False\"}]", +"}; send autoscaleButton addCallback cpSetAutoscale", +"", +"proc cpTrackAutoscale {param old new} \\", +"{", +" send autoscaleButton set on [true $new]", +"}; send autoscale addCallback cpTrackAutoscale", +"", +"proc cpSetAntialias args \\", +"{", +" set value [send antialiasButton get on]", +" send client setOption antialias [expr {$value ? \"True\" : \"False\"}]", +"}; send antialiasButton addCallback cpSetAntialias", +"", +"proc cpTrackAntialias {param old new} \\", +"{", +" send antialiasButton set on [true $new]", +"}; send antialias addCallback cpTrackAntialias", +"", +"proc cpSetTileFrames { widget type state args } \\", +"{", +" global tile_frames tileOpt", +"", +" set value [send tileFramesButton get on]", +" if {$value} {", +" selectTileOrientation junk junk [tileSelToLabel $tileOpt]", +" } else {", +" selectTileOrientation junk junk Disabled", +" }", +" send client setOption tileFrames \\", +" [expr {$value ? \"True\" : \"False\"}] \\{ $tile_frames \\}", +"} ; send tileFramesButton addCallback cpSetTileFrames", +"", +"proc cpTrackTileFrames {param old new} \\", +"{", +" send tileFramesButton set on [true $new]", +"}; send tileFrames addCallback cpTrackTileFrames", +"", +"proc tileFramesToggle args \\", +"{", +" set value [send tileFramesButton get on]", +" send tileFramesButton set on [expr !$value]", +" cpSetTileFrames", +"}", +"", +"", +"################################################################################", +"# MAGNIFIER. A subraster around the cursor in the main image window is", +"# displayed at a high resolution in a marker (known as the magnifier window)", +"# within the main image window.", +"################################################################################", +"", +"set magnifier_x 0", +"set magnifier_y 0", +"set magnifier_width 0", +"set magnifier_height 0", +"set mrm_width 0", +"set mrm_height 0", +"", +"set magnifier_enable 0", +"set magnifier_mag_enable 0", +"set magnifier_mapping 0", +"", +"createMenu magzoomMenu imagewin {", +" { \"Zoom Factors\" f.title }", +" { f.dblline }", +" { \"Zoom 1\" f.exec \"setMagnifierZoom 1\" }", +" { \"Zoom 2\" f.exec \"setMagnifierZoom 2\" }", +" { \"Zoom 4\" f.exec \"setMagnifierZoom 4\" }", +" { \"Zoom 8\" f.exec \"setMagnifierZoom 8\" }", +" { \"Zoom 16\" f.exec \"setMagnifierZoom 16\" }", +"} ", +"", +"# Magnifier window translations.", +"set magnifierWinTranslations { \\", +" !Shift <Btn1Motion>: m_rotateResize()", +" <Btn1Motion>: m_moveResize()", +" !Shift <Btn1Down>: m_raise() m_markpos()", +" <Btn1Down>: m_raise() m_markposAdd()", +" <Btn1Up>: m_redraw() m_destroyNull()", +" <Btn2Down>: m_lower()", +" <Btn3Down>: popup(magzoomMenu)", +" <Btn3Up>: popdown(magzoomMenu)", +" !Ctrl <Key>m: call(toggleMagnifier)", +" !Ctrl <Key>p: call(togglePanner)", +" <Key>BackSpace: m_deleteDestroy()", +" <Key>Delete: m_deleteDestroy()", +" <KeyPress>: graphics-input()", +" <Motion>: track-cursor() call(wcsUpdate,$x,$y)", +"}", +"", +"", +"# setMagnifier -- Turn the magnifier on or off.", +"", +"set magAlreadyOn 0", +"", +"proc setDynamicMagnifier {state} \\", +"{", +" global magAlreadyOn magnifier_enable", +"", +" if {$state} {", +" set magAlreadyOn $magnifier_enable", +" }", +" if {$magAlreadyOn} {", +" return", +" } else {", +" setMagnifier $state", +" }", +"}", +"", +"proc toggleMagnifier args \\", +"{", +" global magnifier_enable", +" if {$magnifier_enable} {", +" setMagnifier 0", +" } else {", +" setMagnifier 1", +" }", +"}", +"", +"", +"proc setMagnifier {state} \\", +"{", +" global winWidth winHeight frameWidth frameHeight", +" global frame magnifier_mapping magnifierWinTranslations magnifierArea", +" global magnifier_enable magnifier_height", +" global magnifierGeom magnifier_x magnifier_y magnifier_width", +"", +" if {$state} {", +" if {$magnifier_enable} \\", +" return", +"", +" # Determine where to place the magnifier.", +" set scale [expr sqrt(double($magnifierArea) / (512 * 512))]", +" set scaled_width [expr int(512 * $scale) / 2 * 2 + 1]", +" set scaled_height [expr int(512 * $scale) / 2 * 2 + 1]", +" set defGeom [format \"%sx%s-5+5\" $scaled_width $scaled_height]", +" send imagewin parseGeometry $magnifierGeom $defGeom x y width height", +"", +" # Create the main magnifier window (marker).", +" send imagewin createMarker magnifierWin \\", +" type rectangle \\", +" createMode noninteractive \\", +" width [expr $width / 2] \\", +" height [expr $height / 2] \\", +" x [expr $x + $width / 2] \\", +" y [expr $y + $height / 2] \\", +" lineColor 8 \\", +" highlightColor 8 \\", +" translations $magnifierWinTranslations \\", +" visible true \\", +" sensitive true \\", +" activated true", +"", +" # Update the magnifier window position variables so that it comes up", +" # in the same place the next time.", +"", +" send magnifierWin getRect boundary \\", +" magnifier_x magnifier_y magnifier_width magnifier_height", +" set magnifierGeom [send imagewin getGeometry \\", +" $magnifier_x $magnifier_y $magnifier_width $magnifier_height]", +"", +" # Register callbacks.", +" send imagewin addCallback magnifierImagewinResized resize", +" send resize addCallback magnifierImagewinResized", +" send magnifierWin addCallback magnifierMovedMapImage moveResize", +"", +" send magnifierWin {", +" addCallback magnifierMoved moveResize;", +" addCallback magnifierDestroy destroy;", +" addCallback magnifierWinConstraint constraint;", +" }", +"", +" # Map display frame to magnifier window.", +" set magnifier_enable 1", +" set magnifier_mapping [send imagewin nextMapping]", +" send imagewin refreshMapping $magnifier_mapping", +"", +" # create cross-hair", +" send imagewin createMarker magPointer \\", +" type rectangle \\", +" createMode noninteractive \\", +" width 3 \\", +" height 3 \\", +" lineWidth 3 \\", +" lineColor green \\", +" highlightcolor green \\", +" activated true \\", +" visible true", +"", +" # set its position and size", +" setMagPointerPosition ", +" magnifierMapImage [expr $winWidth / 2] [expr $winHeight / 2]", +"", +" } elseif {$magnifier_enable} {", +" magnifierDestroy", +" }", +"}", +"", +"", +"# magnifierDestroy -- Delete the magnifier.", +"", +"proc magnifierDestroy args \\", +"{", +" global magnifier_enable ", +" global magnifier_mapping", +"", +" if {$magnifier_enable} {", +" set magnifier_enable 0", +"", +" send imagewin freeMapping $magnifier_mapping", +" send imagewin deleteCallback magnifierImagewinResized", +" send resize deleteCallback magnifierImagewinResized", +" send frame deleteCallback magnifierMapImage", +"", +" if [send server queryObject magnifierWin] {", +" send magnifierWin destroy", +" }", +" if [send server queryObject magPointer] {", +" send magPointer destroy", +" } ", +" }", +"}", +"", +"", +"# magnifierMoved -- Called when the user moves the magnifier window. We need to", +"# move the region marker to the new window location and record the new location", +"# so that the window will come up in the same place if closed and reopened.", +"", +"proc magnifierMoved {marker event position} \\", +"{", +" global winWidth winHeight magnifierGeom frame ", +" global magnifier_x magnifier_y magnifier_width magnifier_height", +"", +" # Move the region marker to the new location.", +" send client getSource raster sx sy snx sny", +"", +" # Update the magnifier window position variables so that it comes up", +" # in the same place the next time.", +"", +" send magnifierWin getRect boundary \\", +" magnifier_x magnifier_y magnifier_width magnifier_height", +" set magnifierGeom [send imagewin getGeometry \\", +" $magnifier_x $magnifier_y $magnifier_width $magnifier_height]", +"}", +"", +"", +"# magnifierWinConstraint -- Called when the magnifier window is moved, resized,", +"# or rotated. Constrain the magnifier window to remain within the image window;", +"# rotation is not permitted.", +"", +"proc magnifierWinConstraint {marker event attributes} \\", +"{", +" global winWidth winHeight", +" global magnifier_width magnifier_height", +"", +" set width $magnifier_width", +" set height $magnifier_height", +" set constraints [list {}]", +"", +" # Check the width and height first as we need these below.", +" foreach i $attributes {", +" set new [lindex $i 2]", +" switch [lindex $i 0] {", +" width { set ww [expr $winWidth / 2]", +" if {$new > $ww} {", +" lappend constraints \"width $ww\"", +" set width $ww", +" } else {", +" set width $new", +" }", +" }", +" height { set wh [expr $winHeight / 2]", +" if {$new > $wh} {", +" lappend constraints \"height $wh\"", +" set height $wh", +" } else {", +" set height $new", +" }", +" }", +" rotangle { lappend constraints \"rotangle 0\"", +" }", +" }", +" }", +"", +" # Constrain X and Y.", +" foreach i $attributes {", +" set new [lindex $i 2]", +" switch [lindex $i 0] {", +" x { set pw [expr $width / 2]", +" if {$new < $pw} {", +" lappend constraints \"x $pw\"", +" } elseif {$new > $winWidth - $pw} {", +" lappend constraints \"x [expr $winWidth - $pw]\"", +" }", +" }", +" y { set ph [expr $height / 2]", +" if {$new < $ph} {", +" lappend constraints \"y $ph\"", +" } elseif {$new > $winHeight - $ph} {", +" lappend constraints \"y [expr $winHeight - $ph]\"", +" }", +" }", +" }", +" }", +"", +" return $constraints", +"}", +"", +"", +"# magnifierRegionConstraint -- Called when the region marker in the magnifier", +"# window is moved, resized, or rotated.", +"", +"proc magnifierRegionConstraint {marker event attributes} \\", +"{", +" global winWidth winHeight", +"", +" set constraints [list {}]", +" send magnifierWin getRect interior p_x p_y p_width p_height", +"", +" # Since the magnifier region marker is a box marker x,y and width,height", +" # will not both change in the same call, so we can process them all", +" # independently.", +"", +" foreach i $attributes {", +" set new [lindex $i 2]", +"", +" switch [lindex $i 0] {", +" x { set left [expr $p_x + $rwidth + 1]", +" set right [expr $p_x + $p_width - $rwidth - 1]", +" if {$new < $left} {", +" lappend constraints \"x $left\"", +" } elseif {$new > $right} {", +" lappend constraints \"x $right\"", +" }", +" }", +" y { set top [expr $p_y + $rheight + 1]", +" set bottom [expr $p_y + $p_height - $rheight - 1]", +" if {$new < $top} {", +" lappend constraints \"y $top\"", +" } elseif {$new > $bottom} {", +" lappend constraints \"y $bottom\"", +" }", +" }", +" width { set ww [expr $winWidth / 2]", +" if {$new > $ww / 2} {", +" lappend constraints \"width $ww\"", +" }", +" }", +" height { set wh [expr $winHeight / 2]", +" if {$new > $wh / 2} {", +" lappend constraints \"height $wh\"", +" }", +" }", +" rotangle { lappend constraints \"rotangle 0\"", +" }", +" }", +" }", +"", +" return $constraints", +"}", +"", +"", +"# magnifierImagewinResized -- If the display window is resized make the", +"# magnifier track the corner.", +"", +"proc magnifierImagewinResized args \\", +"{", +" global magnifier_enable magnifier_mapping magnifier_height", +" global magnifierGeom magnifier_x magnifier_y magnifier_width", +"", +" if {$magnifier_enable} {", +" set old_x $magnifier_x; set old_width $magnifier_width", +" set old_y $magnifier_y; set old_height $magnifier_height", +"", +" # Get new location of magnifier window.", +" set defGeom [format \"%sx%s+5+5\" $magnifier_width $magnifier_height]", +" send imagewin parseGeometry $magnifierGeom $defGeom x y width height", +"", +" # Reposition the marker.", +" send magnifierWin \"\\", +" markpos; \\", +" setAttributes \\", +" x [expr $x + $width / 2] \\", +" y [expr $y + $height / 2] \\", +" width [expr $width / 2] \\", +" height [expr $height / 2]; \\", +" redraw\"", +"", +" # Update the magnifier window position variables so that it comes up", +" # in the same place the next time.", +" send magnifierWin getRect boundary \\", +" magnifier_x magnifier_y magnifier_width magnifier_height", +" set magnifierGeom [send imagewin getGeometry \\", +" $magnifier_x $magnifier_y $magnifier_width $magnifier_height]", +"", +" # Make sure the magnifier window is on top.", +" send imagewin raiseMapping $magnifier_mapping", +"", +" # Refresh the magnifier window if it did not move.", +" if {$magnifier_x == $old_x && $magnifier_y == $old_y &&", +" $magnifier_width == $old_width && $magnifier_height == $old_height} {", +" send imagewin refreshMapping $magnifier_mapping", +" }", +" }", +"}", +"", +"", +"# resetMagnifier -- Reinitialize the magnifier.", +"", +"proc resetMagnifier {param old new} \\", +"{", +" global magnifierGeom displayMagnifier", +"", +" if {$new == \"done\"} {", +" setMagnifier [true $displayMagnifier]", +" } else {", +" setMagnifier 0", +" if {$new != \"startup\"} {", +" set magnifierGeom +5+5", +" }", +" }", +"}; send initialize addCallback resetMagnifier", +"", +"", +"set last_mag_x [expr $winWidth / 2]", +"set last_mag_y [expr $winHeight / 2]", +"", +"# magnifierMovedMapImage -- Front end to magnifierMapImage, called when ", +"# magnifier window is moved or resized.", +"", +"proc magnifierMovedMapImage args \\", +"{", +" global last_mag_x last_mag_y", +"", +" magnifierMapImage $last_mag_x $last_mag_y", +" setMagPointerPosition", +"}", +"", +"# The following code was borrowed from the SAOtng GUI by Eric Mandel of SAO", +"#--------------------------------------------------------------------------", +"", +"# globals for magnifier", +"set mag_w 0", +"set mag_h 0", +"", +"#", +"# setMagnifierZoom -- set the zoom factor for the magnifier", +"#", +"proc setMagnifierZoom { zoom } \\", +"{", +" global mag_w mag_h", +"", +" send magnifierWin getRect boundary \\", +" magnifier_x magnifier_y magnifier_width magnifier_height", +" set mag_w [expr int( ( $magnifier_width + $zoom - 1 ) / $zoom) ]", +" set mag_h [expr int( ( $magnifier_height + $zoom - 1 ) / $zoom) ]", +"", +" #set mw [expr int (($magnifier_width - 1) / ($mag_w * 2))]", +" #if { $mw < 4 } { set mw 4 }", +" #set mh [expr int (($magnifier_height - 1) / ($mag_h * 2))]", +" #if { $mh < 4 } { set mh 4 }", +" #send magPointer \"setAttributes width $mw height $mh; redraw\"", +"}", +"", +"# magnifierMapImage -- Map the of the current display frame centered on the", +"# pointer into the magnifier window. Called when the frame changes, the", +"# pointer moves in the main image window, or (via magnifierMovedMapImage)", +"# the magnifier window is moved or resized.", +"", +"set magnifierROP 0", +"", +"proc magnifierMapImage {x y} \\", +"{", +" global magnifier_enable frame", +" global last_mag_x last_mag_y", +" global magnifier_mapping", +" global winWidth winHeight", +" global mag_w mag_h", +" global magnifierROP", +"", +" if {!$magnifier_enable || $frame == 0} \\", +" return", +"", +"# if {abs($last_mag_x-$x) != 1 && abs($last_mag_y-$y) != 1} {", +"# # For efficiency we won't compute the sqrt of the distance but instead", +"# # just compare the square. Use a threshold of 6 pixels so when we", +"# # narrow in on the ROI the magnifier is still (mostly) correct.", +"# set diff [expr (($last_mag_x-$x) * ($last_mag_x-$x)) + \\", +"# (($last_mag_y-$y) * ($last_mag_y-$y))]", +"# if {$diff > 36} {", +"# set last_mag_x $x", +"# set last_mag_y $y", +"# return", +"# }", +"# }", +"", +" set last_mag_x $x", +" set last_mag_y $y", +"", +" send magnifierWin getRect interior dx dy dnx dny", +" if [send imagewin activeMapping $magnifier_mapping] {", +" send imagewin raiseMapping $magnifier_mapping", +" }", +"", +" # initialize the magnifier zoom factor, if necessary", +" if { !$mag_w || !$mag_h } {", +" setMagnifierZoom 4", +" }", +"", +" set sx [expr $x - $mag_w / 2 ]", +" set sy [expr $y - $mag_h / 2 ]", +"", +" # Constrain the source rectangle within the main image window ", +" # (not overlapping an edge or the magnifier window).", +"", +" if {$sx > [expr $dx - $mag_w] && $sx < [expr $dx + $dnx] && ", +" $sy > [expr $dy - $mag_h] && $sy < [expr $dy + $dny] } {", +"", +" # The source rectangle would overlap the magnifier window; fix that.", +"", +" set dist(l) [expr $sx - ($dx - $mag_w)]", +" set dist(b) [expr $dy + $dny - $sy]", +" set dist(r) [expr $dx + $dnx - $sx]", +" set dist(t) [expr $sy - ($dy - $mag_h)]", +"", +" # Put the distances in order.", +"", +" foreach j [array names dist] {", +" set alreadyset($j) 0", +" }", +"", +" for {set i 0} {$i < 4} {incr i} {", +" set candidate \"\"", +" foreach j [array names dist] {", +" if {!$alreadyset($j)} {", +" if {$candidate == \"\"} {", +" set candidate $j", +" set minsofar $dist($j)", +" } elseif {$dist($j) < $minsofar} {", +" set candidate $j", +" set minsofar $dist($j)", +" }", +" }", +" }", +" set order($i) $candidate", +" set alreadyset($candidate) 1", +" }", +"", +" # Try the sides in order, using the first one where there's room.", +"", +" for {set i 0} {$i < 4} {incr i} {", +" if {$order($i) == \"l\"} {", +" if {$dx >= $mag_w} {", +" set sx [expr $dx - $mag_w]", +" break", +" }", +" } elseif {$order($i) == \"b\"} {", +" if {$winHeight >= $dy + $dny + $mag_h} {", +" set sy [expr $dy + $dny]", +" break", +" }", +" } elseif {$order($i) == \"r\"} {", +" if {$winWidth >= $dx + $dnx + $mag_w} {", +" set sx [expr $dx + $dnx]", +" break", +" }", +" } elseif {$order($i) == \"t\"} {", +" if {$dy >= $mag_h} {", +" set sy [expr $dy - $mag_h]", +" break", +" }", +" }", +" }", +" }", +"", +" # Make sure we don't go beyond an edge of the main window.", +"", +" if {$sx < 0} {", +" set sx 0", +" } else {", +" set sxmax [expr $winWidth - $mag_w]", +" if {$sx > $sxmax} {", +" set sx $sxmax", +" }", +" }", +"", +" if {$sy < 0} {", +" set sy 0", +" } else {", +" set symax [expr $winHeight - $mag_h]", +" if {$sy > $symax} {", +" set sy $symax", +" }", +" }", +"", +" # Map 32 x 32 centered on pointer in main window.", +" set err [catch {send imagewin setMapping $magnifier_mapping $magnifierROP \\", +" 0 pixel $sx $sy $mag_w $mag_h \\", +" 0 pixel $dx $dy $dnx $dny}]", +" if { $err != 0 } {", +" Print \"There was a problem setting up the magnifier ... recovering\"", +" }", +"}", +"", +"", +"# set the position of the magnifier marker in the center of the mag window", +"proc setMagPointerPosition args \\", +"{", +" global magnifier_enable", +"", +" if { !$magnifier_enable } \\", +" return", +"", +" send magnifierWin \"getAttributes x x y y\"", +" set xpos [expr $x + 1]", +" set ypos [expr $y + 1]", +"", +" send magPointer \"setAttributes x $xpos y $ypos visible true; redraw\"", +"}", +"", +"", +"", +"################################################################################", +"# PANNER. The full frame mapped into the main image window is displayed at a", +"# reduced resolution in a marker (known as the panner window) within the main", +"# image window. The currently displayed region of the frame is indicated", +"# using a small marker within the panner window. This small marker may be", +"# moved or resized to pan or zoom the image in the main display window.", +"################################################################################", +"", +"set panner_x 0", +"set panner_y 0", +"set panner_width 0", +"set panner_height 0", +"set prm_width 0", +"set prm_height 0", +"", +"set panner_enable 0", +"set panner_pan_enable 0", +"set panner_mag_enable 0", +"set panner_region_enable 0", +"set panner_mapping 0", +"", +"# Panner window translations.", +"set pannerWinTranslations { \\", +" !Shift <Btn1Motion>: m_rotateResize()", +" <Btn1Motion>: m_moveResize()", +" !Shift <Btn1Down>: m_raise() m_markpos()", +" <Btn1Down>: m_raise() m_markposAdd()", +" <Btn1Up>: m_redraw() m_destroyNull()", +" <Btn2Down>: m_lower()", +" <Btn2Up>: call(pannerPanXY,$x,$y)", +" !Ctrl <Key>b: call(prevFrame,$name)", +" !Ctrl <Key>f: call(nextFrame,$name)", +" !Ctrl <Key>h: call(move_cursor,-1,0)", +" !Ctrl <Key>j: call(move_cursor,0,1)", +" !Ctrl <Key>k: call(move_cursor,0,-1)", +" !Ctrl <Key>l: call(move_cursor,1,0)", +" !Ctrl <Key>n: call(normalize)", +" !Ctrl <Key>c: call(cpZoomAction,centerFrame)", +" !Ctrl <Key>i: call(cpInvert)", +" !Ctrl <Key>m: call(toggleMagnifier)", +" !Ctrl <Key>p: call(togglePanner)", +" !Ctrl <Key>r: call(cpRegisterFrames)", +" !Ctrl <Key>s: call(cpMatchFrames)", +" !Alt <Key>1: call(cpSetFrame,frame1)", +" !Alt <Key>2: call(cpSetFrame,frame2)", +" !Alt <Key>3: call(cpSetFrame,frame3)", +" !Alt <Key>4: call(cpSetFrame,frame4)", +" !Ctrl <Key>1: call(cpZoom,1,1,fixed)", +" !Ctrl <Key>2: call(cpZoom,2,2,fixed)", +" !Ctrl <Key>3: call(cpZoom,3,3,fixed)", +" !Ctrl <Key>4: call(cpZoom,4,4,fixed)", +" !Ctrl <Key>5: call(cpZoom,5,5,fixed)", +" !Ctrl <Key>6: call(cpZoom,6,6,fixed)", +" !Ctrl <Key>7: call(cpZoom,7,7,fixed)", +" !Ctrl <Key>8: call(cpZoom,8,8,fixed)", +" !Ctrl <Key>9: call(cpZoom,9,9,fixed)", +" <Key>BackSpace: m_deleteDestroy()", +" <Key>Delete: m_deleteDestroy()", +" <KeyPress>: graphics-input()", +" <Motion>: track-cursor() call(wcsUpdate,$x,$y)", +"}", +"", +"", +"# setPanner -- Turn the panner on or off.", +"", +"proc togglePanner args \\", +"{", +" global panner_enable", +"", +" if {$panner_enable} {", +" setPanner 0", +" } else {", +" setPanner 1", +" }", +"}", +"", +"", +"proc setPanner {state} \\", +"{", +" global winWidth winHeight frameWidth frameHeight", +" global frame panner_mapping pannerWinTranslations pannerArea", +" global panner_enable panner_region_enable panner_pan_enable", +" global pannerGeom panner_x panner_y panner_width panner_height", +" global last_compass", +"", +" if {$state} {", +" if {$panner_enable} \\", +" return", +"", +" # Determine where to place the panner.", +" set scale \\", +" [expr sqrt(double($pannerArea) / ($frameWidth * $frameHeight))]", +" set scaled_width [expr int($frameWidth * $scale) / 2 * 2 + 1]", +" set scaled_height [expr int($frameHeight * $scale) / 2 * 2 + 1]", +" set defGeom [format \"%sx%s-5+5\" $scaled_width $scaled_height]", +" send imagewin parseGeometry $pannerGeom $defGeom x y width height", +"", +" # Create the main panner window (marker).", +" send imagewin createMarker pannerWin \\", +" type rectangle \\", +" createMode noninteractive \\", +" width [expr $width / 2] \\", +" height [expr $height / 2] \\", +" x [expr $x + $width / 2] \\", +" y [expr $y + $height / 2] \\", +" lineColor 8 \\", +" highlightColor 8 \\", +" translations $pannerWinTranslations \\", +" visible true \\", +" sensitive true \\", +" autoRedraw true \\", +" activated true", +"", +" # Update the panner window position variables so that it comes up", +" # in the same place the next time.", +"", +" send pannerWin getRect boundary \\", +" panner_x panner_y panner_width panner_height", +" set pannerGeom [send imagewin getGeometry \\", +" $panner_x $panner_y $panner_width $panner_height]", +"", +" # Register callbacks.", +" send frame addCallback pannerMapImage", +" send frameRegion addCallback pannerSetRegion", +" send imagewin addCallback pannerImagewinResized resize", +" send resize addCallback pannerImagewinResized", +"", +" send pannerWin {", +" addCallback pannerMapImage moveResize;", +" addCallback pannerMoved moveResize;", +" addCallback pannerDestroy destroy;", +" addCallback pannerWinConstraint constraint;", +" }", +"", +" # Map display frame to panner window.", +" set panner_enable 1", +" set panner_region_enable 1", +" set panner_mapping [send imagewin nextMapping]", +" pannerMapImage init; send imagewin refreshMapping $panner_mapping", +"", +" # Redraw the compass if necessary.", +" send compass \"setSensitive True ; set on $last_compass\"", +" if { $last_compass } \\", +" drawCompass", +"", +" # Draw a marker in the panner window outlining displayed region.", +" send imagewin createMarker pannerRegionMarker \\", +" type box \\", +" createMode noninteractive \\", +" translations $pannerWinTranslations \\", +" lineColor green \\", +" highlightColor green \\", +" sensitive true", +"", +" # Fire up the panner region marker.", +" send client getSource raster sx sy snx sny", +" pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny]", +" send pannerRegionMarker \"\\", +" addCallback pannerPanImage moveResize; \\", +" addCallback pannerDestroy destroy; \\", +" addCallback pannerRegionConstraint constraint; \\", +" setAttributes visible true activated true; \\", +" redraw\"", +" set panner_pan_enable 1", +"", +" } elseif {$panner_enable} {", +" pannerDestroy", +" }", +"}", +"", +"", +"# pannerDestroy -- Delete the panner.", +"", +"proc pannerDestroy args \\", +"{", +" global panner_enable panner_region_enable panner_pan_enable", +" global panner_mapping", +"", +" if {$panner_enable} {", +" set panner_enable 0", +" set panner_pan_enable 0", +" set panner_region_enable 0", +"", +" send imagewin freeMapping $panner_mapping", +" send imagewin deleteCallback pannerImagewinResized", +" send resize deleteCallback pannerImagewinResized", +" send frame deleteCallback pannerMapImage", +" send frameRegion deleteCallback pannerSetRegion", +"", +" if [send server queryObject pannerRegionMarker] {", +" send pannerRegionMarker destroy", +" }", +" if [send server queryObject pannerWin] {", +" send pannerWin destroy", +" }", +"", +" # Disable the compass.", +" send compass \"setSensitive False ; set on False\"", +" }", +"}", +"", +"", +"# pannerMapImage -- Map the current display frame into the panner window.", +"# Called when the frame changes or the panner window is moved or resized.", +"# The panner window displays a small dezoomed version of the full frame.", +"", +"proc pannerMapImage args \\", +"{", +" global panner_enable frame", +" global panner_mapping", +"", +" if {!$panner_enable || $frame == 0} \\", +" return", +"", +" set raster [send client getRaster]", +" send pannerWin getRect interior dx dy dnx dny", +" send imagewin queryRaster $raster width height", +"", +" if [send imagewin activeMapping $panner_mapping] {", +" send imagewin raiseMapping $panner_mapping", +" }", +" send imagewin setMapping $panner_mapping 0 \\", +" $raster pixel 0 0 $width $height \\", +" 0 pixel $dx $dy $dnx $dny", +"}", +"", +"", +"# pannerSetRegion -- Adjust the pannerWin region marker to outline the", +"# region displayed in the main display window. This is called in response", +"# to a frameRegion event when the main display mapping changes, e.g. when", +"# the frame changes or the user zooms or pans the main window. The region", +"# marker is moved and resized to reflect the new view.", +"", +"proc pannerSetRegion {param old new} \\", +"{", +" global panner_enable panner_region_marker", +" global panner_region_enable panner_pan_enable", +" global frame frameWidth frameHeight prm_width prm_height", +"", +" if {!$panner_enable || !$panner_region_enable || $frame == 0} \\", +" return", +"", +" # new: frame sx sy snx sny", +" set src_frame [lindex $new 0]", +" set sx [lindex $new 1]; set snx [lindex $new 3]", +" set sy [lindex $new 2]; set sny [lindex $new 4]", +"", +" if {$src_frame != $frame} \\", +" return", +"", +" send pannerWin getRect interior px py pnx pny", +"", +" set x [expr ($sx + $snx/2.0) / $frameWidth * $pnx + $px]", +" set y [expr ($sy + $sny/2.0) / $frameHeight * $pny + $py]", +" set width [expr ($snx/2.0) / $frameWidth * $pnx + 1]", +" set height [expr ($sny/2.0) / $frameHeight * $pny + 1]", +"", +" set pan_save $panner_pan_enable; set panner_pan_enable 0", +" set panner_region_enable 0", +"", +" send pannerRegionMarker \"\\", +" markpos; \\", +" setAttributes x $x y $y width $width height $height; \\", +" redraw; raise\"", +" send pannerRegionMarker getAttributes width prm_width height prm_height", +"", +" set panner_region_enable 1", +" set panner_pan_enable $pan_save", +"}", +"", +"", +"# pannerPanImage -- Pan or zoom the image in the main image window. This is", +"# called when the user moves the region marker within the panner window.", +"", +"proc pannerPanImage {marker event position} \\", +"{", +" global panner_pan_enable", +" global winWidth winHeight", +" global prm_width prm_height", +" global frame auto_reg frameOffsetX frameOffsetY", +"", +" if {!$panner_pan_enable} \\", +" return", +"", +" # position: x y width height.", +" set new_width [lindex $position 2]", +" set new_height [lindex $position 3]", +"", +" # region: type raster x y width height.", +" set region [send pannerRegionMarker getRegion unmap]", +" set x [expr [lindex $region 2] + 1]; set width [lindex $region 4]", +" set y [expr [lindex $region 3] + 1]; set height [lindex $region 5]", +"", +" set panner_pan_enable 0", +" if {$new_width == $prm_width && $new_height == $prm_height} {", +" send client pan $x $y", +" } else {", +" set xscale [expr ($winWidth / 2.0) / $width]", +" set yscale [expr ($winHeight / 2.0) / $height]", +" if {$auto_reg == 1} {", +" send client zoomAbs $xscale $yscale $x $y \\", +" $frameOffsetX($frame) $frameOffsetY($frame)", +" } else {", +" send client zoom $xscale $yscale $x $y", +" }", +" }", +" set panner_pan_enable 1", +"}", +"", +"", +"# pannerPanXY -- Pan to the point X,Y in the panner window coordinate", +"# system. Called when the user clicks MB2 in the panner window.", +"", +"proc pannerPanXY {x y} \\", +"{", +" send imagewin unmapPixel $x $y raster rx ry", +" send client pan $rx $ry", +"}", +"", +"", +"# pannerMoved -- Called when the user moves the panner window. We need to", +"# move the region marker to the new window location and record the new location", +"# so that the window will come up in the same place if closed and reopened.", +"", +"proc pannerMoved {marker event position} \\", +"{", +" global winWidth winHeight", +" global frame panner_pan_enable pannerGeom", +" global panner_x panner_y panner_width panner_height", +"", +" # Move the region marker to the new location.", +" set pan_save $panner_pan_enable; set panner_pan_enable 0", +" send client getSource raster sx sy snx sny", +" pannerSetRegion dummy dummy [concat $frame $sx $sy $snx $sny]", +" set panner_pan_enable $pan_save", +"", +" # Update the panner window position variables so that it comes up", +" # in the same place the next time.", +"", +" send pannerWin getRect boundary \\", +" panner_x panner_y panner_width panner_height", +" set pannerGeom [send imagewin getGeometry \\", +" $panner_x $panner_y $panner_width $panner_height]", +"", +" drawCompass", +"", +" send pannerRegionMarker raise", +"}", +"", +"", +"# pannerWinConstraint -- Called when the panner window is moved, resized, or", +"# rotated. Constrain the panner window to remain within the image window;", +"# rotation is not permitted.", +"", +"proc pannerWinConstraint {marker event attributes} \\", +"{", +" global winWidth winHeight", +" global panner_width panner_height", +"", +" set width $panner_width", +" set height $panner_height", +" set constraints [list {}]", +"", +" # Check the width and height first as we need these below.", +" foreach i $attributes {", +" set new [lindex $i 2]", +" switch [lindex $i 0] {", +" width { set ww [expr $winWidth / 2]", +" if {$new > $ww} {", +" lappend constraints \"width $ww\"", +" set width $ww", +" } else {", +" set width $new", +" }", +" }", +" height { set wh [expr $winHeight / 2]", +" if {$new > $wh} {", +" lappend constraints \"height $wh\"", +" set height $wh", +" } else {", +" set height $new", +" }", +" }", +" rotangle { lappend constraints \"rotangle 0\"", +" }", +" }", +" }", +"", +" # Constrain X and Y.", +" foreach i $attributes {", +" set new [lindex $i 2]", +" switch [lindex $i 0] {", +" x { set pw [expr $width / 2]", +" if {$new < $pw} {", +" lappend constraints \"x $pw\"", +" } elseif {$new > $winWidth - $pw} {", +" lappend constraints \"x [expr $winWidth - $pw]\"", +" }", +" }", +" y { set ph [expr $height / 2]", +" if {$new < $ph} {", +" lappend constraints \"y $ph\"", +" } elseif {$new > $winHeight - $ph} {", +" lappend constraints \"y [expr $winHeight - $ph]\"", +" }", +" }", +" }", +" }", +"", +" return $constraints", +"}", +"", +"", +"# pannerRegionConstraint -- Called when the region marker in the panner", +"# window is moved, resized, or rotated.", +"", +"proc pannerRegionConstraint {marker event attributes} \\", +"{", +" global winWidth winHeight", +" global frame", +"", +" set constraints [list {}]", +" send pannerWin getRect interior p_x p_y p_width p_height", +" send pannerRegionMarker getAttributes width rwidth height rheight", +"", +" # Since the panner region marker is a box marker x,y and width,height", +" # will not both change in the same call, so we can process them all", +" # independently.", +"", +" foreach i $attributes {", +" set new [lindex $i 2]", +"", +" switch [lindex $i 0] {", +" x { set left [expr $p_x + $rwidth + 1]", +" set right [expr $p_x + $p_width - $rwidth - 1]", +" if {$new < $left} {", +" lappend constraints \"x $left\"", +" } elseif {$new > $right} {", +" lappend constraints \"x $right\"", +" }", +" }", +" y { set top [expr $p_y + $rheight + 1]", +" set bottom [expr $p_y + $p_height - $rheight - 1]", +" if {$new < $top} {", +" lappend constraints \"y $top\"", +" } elseif {$new > $bottom} {", +" lappend constraints \"y $bottom\"", +" }", +" }", +" width { set ww [expr $winWidth / 2]", +" if {$new > $ww / 2} {", +" lappend constraints \"width $ww\"", +" }", +" }", +" height { set wh [expr $winHeight / 2]", +" if {$new > $wh / 2} {", +" lappend constraints \"height $wh\"", +" }", +" }", +" rotangle { lappend constraints \"rotangle 0\"", +" }", +" }", +" }", +" drawCompass", +"", +" return $constraints", +"}", +"", +"", +"# pannerImagewinResized -- If the display window is resized make the panner", +"# track the corner.", +"", +"proc pannerImagewinResized args \\", +"{", +" global panner_enable panner_mapping ", +" global pannerGeom panner_x panner_y panner_width panner_height", +" global frame", +"", +" if {$panner_enable} {", +" set old_x $panner_x; set old_width $panner_width", +" set old_y $panner_y; set old_height $panner_height", +"", +" eraseCompass", +"", +" # Get new location of panner window.", +" set defGeom [format \"%sx%s-5+5\" $panner_width $panner_height]", +" send imagewin parseGeometry $pannerGeom $defGeom x y width height", +"", +" # Reposition the marker.", +" send pannerWin \"\\", +" markpos; \\", +" setAttributes \\", +" x [expr $x + $width / 2] \\", +" y [expr $y + $height / 2] \\", +" width [expr $width / 2] \\", +" height [expr $height / 2]; \\", +" redraw\"", +"", +" # Update the panner window position variables so that it comes up", +" # in the same place the next time.", +" send pannerWin getRect boundary \\", +" panner_x panner_y panner_width panner_height", +" set pannerGeom [send imagewin getGeometry \\", +" $panner_x $panner_y $panner_width $panner_height]", +"", +" # Make sure the panner window is on top.", +" send imagewin raiseMapping $panner_mapping", +"", +" # Refresh the panner window if it did not move.", +" if {$panner_x == $old_x && $panner_y == $old_y &&", +" $panner_width == $old_width && $panner_height == $old_height} {", +" send imagewin refreshMapping $panner_mapping", +" }", +"", +" drawCompass", +" }", +"}", +"", +"", +"# resetPanner -- Reinitialize the panner.", +"", +"proc resetPanner {param old new} \\", +"{", +" global pannerGeom displayPanner", +" if {$new == \"done\"} {", +" setPanner [true $displayPanner]", +" } else {", +" setPanner 0", +" if {$new != \"startup\"} {", +" set pannerGeom -5+5", +" }", +" }", +"}; send initialize addCallback resetPanner", +"", +"", +"", +"################################################################################", +"# Print Panel Functions.", +"################################################################################", +"", +"# Global variables needed for the print setup panel", +"", +"set printColor prGrayButton", +"set orientation epsPortButton", +"set page_size epsLetterButton", +"set imageScale 100", +"", +"set epsWidgets { epsPageGroup epsOrientLabel epsSizeLabel ", +" epsPortButton epsLandButton epsLetterButton epsLegalButton epsA4Button", +" ScaleFrame SCdecrease SCtext SCincrease ", +"}", +"", +"", +"proc psetup_init args \\", +"{", +" global printColor orientation page_size imageScale #format", +"", +" set_printer toPrinter callback 1", +" send SCtext set label [ format \"%d %%\" $imageScale ]", +" send $printColor set on true", +" send $orientation set on true", +" send $page_size set on true", +"}", +"", +"", +"proc doPrintOptions { param old new } \\", +"{", +" global imageScale page_size orientation imageScale printColor", +" global warnings", +"", +" send printStatus set label {}", +" set val [join [lrange $new 1 end] \" \"]", +"", +" # print [format \"doPrintOptions %s = %s\" [lindex $new 0] $val]", +" switch [lindex $new 0] {", +" autoscale { if { $val == \"True\" } {", +" send epsscaleButton set on true", +" } elseif { $val == \"False\" } {", +" send epsscaleButton set on false", +" }", +" }", +" autorotate { if { $val == \"True\" } {", +" send autorotateButton set on true", +" } elseif { $val == \"False\" } {", +" send autorotateButton set on false", +" }", +" }", +" maxaspect { if { $val == \"True\" } {", +" send aspectButton set on true", +" } elseif { $val == \"False\" } {", +" send aspectButton set on false", +" }", +" }", +" annotate { if { $val == \"True\" } {", +" send annotateButton set on true", +" send titleButton setSensitive true", +" send colorbarButton setSensitive true", +" send bordersButton setSensitive true", +" send titleLabel setSensitive true", +" send titleString setSensitive true", +" } elseif { $val == \"False\" } {", +" send annotateButton set on false", +" send titleButton setSensitive false", +" send colorbarButton setSensitive false", +" send bordersButton setSensitive false", +" send titleLabel setSensitive false", +" send titleString setSensitive false", +" }", +" }", +" compress { if { $val == \"True\" } {", +" send compressButton set on true", +" } elseif { $val == \"False\" } {", +" send compressButton set on false", +" }", +" }", +" orientation { send $orientation set on false", +" if { $val == \"portrait\" } {", +" send epsPortButton set on true", +" set orientation epsPortButton", +" } elseif { $val == \"landscape\" } {", +" send epsPortButton set on false", +" set orientation epsLandButton", +" }", +" }", +" papersize { send $page_size set on false", +" if { $val == \"letter\" } {", +" send epsLetterButton set on true", +" set page_size epsLetterButton", +" } elseif { $val == \"legal\" } {", +" send epsLegalButton set on true", +" set page_size epsLegalButton", +" } elseif { $val == \"A4\" } {", +" send epsA4Button set on true", +" set page_size epsA4Button", +" } elseif { $val == \"B5\" } {", +" send epsB5Button set on true", +" set page_size epsB5Button", +" }", +" }", +" imscale { set imageScale $val", +" send SCtext set label [ format \"%d %%\" $imageScale ]", +" }", +" colortype { send $printColor set on false", +" if { $val == \"gray\" } {", +" send prGrayButton set on true", +" set printColor prGrayButton", +" } elseif { $val == \"pseudo\" } {", +" send prPseudoButton set on true", +" set printColor prPseudoButton", +" } elseif { $val == \"rgb\" } {", +" send prRGBButton set on true", +" set printColor prRGBButton", +" }", +" }", +" printerName { if [send toPrinter get on] {", +" send printlist highlight $val", +" }", +" }", +" printCmd { if [send toPrinter get on] {", +" send printcmd set string $val", +" }", +" }", +" printFile { if [send toFile get on] {", +" send printcmd set string $val", +" }", +" }", +" deviceType { if { $val == \"Printer\" } {", +" send printerLabel set label \"Print Command:\"", +" send toPrinter set on true", +" send toFile set on false", +" } elseif { $val == \"File\" } {", +" send printerLabel set label \"File Name:\"", +" send toPrinter set on false", +" send toFile set on true", +" send printlist unhighlight", +" }", +" }", +" dotitle { if { $val == \"True\" } {", +" send titleButton set on true", +" } elseif { $val == \"False\" } {", +" send titleButton set on false", +" }", +" }", +" doborders { if { $val == \"True\" } {", +" send bordersButton set on true", +" } elseif { $val == \"False\" } {", +" send bordersButton set on false", +" }", +" }", +" docolorbar { if { $val == \"True\" } {", +" send colorbarButton set on true", +" } elseif { $val == \"False\" } {", +" send colorbarButton set on false", +" }", +" }", +" title { send titleString set string $val", +" }", +"", +" status { send printStatus set label $val", +" send server synchronize", +" }", +" warning { if {$warnings} { Wexec server $val }", +" }", +" }", +"}; send printOptions addCallback doPrintOptions", +"", +"", +"# Print options procedures.", +"# -------------------------------", +"", +"set prOptsWidgets { ", +" toPrinter toFile", +" prGrayButton prPseudoButton prRGBButton", +" epsLandButton epsPortButton", +" epsLetterButton epsLegalButton epsA4Button epsB5Button", +" SCincrease SCdecrease", +"}", +"set prSimpleOptions { ", +" epsscaleButton autorotateButton aspectButton annotateButton compressButton ", +" titleButton bordersButton colorbarButton", +"}", +"", +"proc prPrintCommand { widget cbtype args } \\", +"{", +" if [send toFile get on] {", +" send client setPrintOption printfile $args", +" send printStatus set label [format \"output file set to %s\" $args]", +" } else {", +" send client setPrintOption printcmd $args", +" send printStatus set label [format \"print command set to %s\" $args]", +" }", +"}; send printcmd addCallback prPrintCommand", +"", +"proc prTitleString { widget cbtype args } \\", +"{", +" send client setPrintOption title $args", +"}; send titleString addCallback prTitleString", +"", +"proc prOptionToggle { widget cbtype args } \\", +"{", +" global imageScale", +"", +" # Handle the image scale widgets first.", +" switch $widget {", +" SCincrease { set scale [expr $imageScale + 5] ", +" send client setPrintOption imscale $scale", +" return", +" }", +" SCdecrease { set scale [ expr $imageScale - 5 ]", +" send client setPrintOption imscale $scale", +" return", +" }", +" }", +"", +" # If it's not one of those it must be one of the radio toggles.", +" set val [ send $widget get on ]", +" #print [ format \"prOptionToggle %s = %s\" $widget $val ]", +" if { $val == 1 } {", +" switch $widget {", +" toPrinter { send client setPrintOption devicetype printer }", +" toFile { send client setPrintOption devicetype file }", +"", +" epsLandButton { send client setPrintOption orientation landscape }", +" epsPortButton { send client setPrintOption orientation portrait }", +"", +" epsLetterButton { send client setPrintOption papersize letter }", +" epsLegalButton { send client setPrintOption papersize legal }", +" epsA4Button { send client setPrintOption papersize A4 }", +" epsB5Button { send client setPrintOption papersize B5 }", +"", +" prGrayButton { send client setPrintOption colortype gray }", +" prPseudoButton { send client setPrintOption colortype pseudo }", +" prRGBButton { send client setPrintOption colortype rgb }", +" }", +" } else {", +" send $widget set on true", +" }", +"", +"} ; foreach w $prOptsWidgets { send $w addCallback prOptionToggle }", +"", +"proc prSimpleOptionToggle { widget args } \\", +"{", +" set val [ send $widget get on ]", +" #print [ format \"prSimpleOptionToggle %s = %s\" $widget $val ]", +"", +" switch $widget {", +" epsscaleButton { send client setPrintOption autoscale $val }", +" autorotateButton { send client setPrintOption autorotate $val }", +" aspectButton { send client setPrintOption maxaspect $val }", +" annotateButton { send client setPrintOption annotate $val }", +" compressButton { send client setPrintOption compress $val }", +"", +" titleButton { send client setPrintOption dotitle $val }", +" bordersButton { send client setPrintOption doborders $val }", +" colorbarButton { send client setPrintOption docolorbar $val }", +" }", +"} ; foreach w $prSimpleOptions { send $w addCallback prSimpleOptionToggle }", +"", +"", +"", +"# Printer display and selection.", +"# -------------------------------", +"set lprList {}", +"", +"proc psSetPrintList {param old new} \\", +"{", +" global lprList", +" set lprList $new", +" send printlist setList $new resize", +" send printlist highlight 0", +"}; send printerList addCallback psSetPrintList", +"", +"proc lprResize args \\", +"{", +" global lprList", +" send printlist setList $lprList resize", +" send printlist highlight 0", +"}; send printlist addEventHandler lprResize ResizeRedirectMask", +"", +"proc psSelectPrint {widget cbtype selections indices} \\", +"{", +" global printerlist", +" foreach selection $selections {", +" send client setPrintOption printername $selection", +" }", +"}; send printlist addCallback psSelectPrint", +"", +"", +"proc Print args \\", +"{", +" global winWidth winHeight", +" send imagewin setCursorType busy", +"", +" # Get the print command or file template if not previous reset.", +" set val [ send printcmd get string ]", +" if [send toFile get on] {", +" send client setPrintOption printfile $val", +" } else {", +" send client setPrintOption printcmd $val", +" }", +" set val [ send titleString get string ]", +" send client setPrintOption title $val", +" setPrintCorners 0 [expr $winWidth - 1] [expr $winHeight - 1] 0", +"", +" send client print", +" send imagewin setCursorType idle", +"} ; send okayPrint addCallback Print", +"", +"", +"", +"# setPrintCorners -- Tell the client the WCS of the image being printed.", +"", +"proc setPrintCorners { lx ly ux uy args } \\", +"{", +" global winWidth winHeight", +"", +" # Convert raw corner screen coordinates to frame buffer raster coords.", +" send imagewin unmapPixel $lx $ly raster llx lly", +" set llx [expr \"int ($llx)\"]", +" set lly [expr \"int ($lly)\"]", +" set str [send client encodewcs $llx $lly]", +" scan $str \"%g %g %g\" llx_r lly_r z", +" set llx_i [expr \"int ($llx_r)\"]", +" set lly_i [expr \"int ($lly_r)\"]", +"", +" send imagewin unmapPixel $ux $uy raster urx ury", +" set urx [expr \"int ($urx)\"]", +" set ury [expr \"int ($ury)\"]", +" set str [send client encodewcs $urx $ury]", +" scan $str \"%g %g %g\" urx_r ury_r z", +" set urx_i [expr \"int ($urx_r)\"]", +" set ury_i [expr \"int ($ury_r)\"]", +"", +" send client setPrintOption corners $llx_i $lly_i $urx_i $ury_i", +"}", +"", +"", +"", +"################################################################################", +"# INFO box.", +"################################################################################", +"", +"set infoMode infoOptFr", +"", +"", +"# Current Frame information.", +"proc infoFrameUpdate args \\", +"{", +" global version frame nframes", +" global frameWidth frameHeight frameDepth", +" global enhancement", +" global cpXcen cpYcen cpXoff cpYoff", +" global cpXmag cpYmag cpXscale cpYscale", +"", +" if { [send infoOptWCS get on] } {", +" send client info wcs", +" return", +" } elseif {! [send infoOptFr get on]} \\", +" return", +"", +"", +" if {$frame == 0} {", +" send infoText set string \"initializing display...\"", +" } else {", +" set line1 $version", +" set line2 [format \"Image:\\t\\t%s\" [send imageTitle get label]]", +" set line3 [format \"Frame %d of %d:\\t%d x %d\" \\", +" $frame $nframes $frameWidth $frameHeight]", +" set cmap [lindex $enhancement($frame) 0]", +" set brt [lindex $enhancement($frame) 1]", +" set con [lindex $enhancement($frame) 2]", +" set line4 [format \"Colormap:\\t%s\" $cmap]", +" set line5 [format \"Enhancement:\\tBrt=%s Cont=%s\" $brt $con]", +"", +" set cntr [format \"X: %0.1f\\n\\t\\tY: %0.1f\" $cpXcen $cpYcen]", +" set line6 [format \"Center:\\t\\t%s\" $cntr]", +"", +" set line7 [format \"Zoom:\\t\\tX: %0.2f\\n\\t\\tY: %0.2f\" $cpXmag $cpYmag]", +" set line8 [format \"Scale:\\t\\tX: %0.2f\\n\\t\\tY: %0.2f\" $cpXscale $cpYscale]", +" set line9 [format \"Offset:\\t\\tX: %0.2f\\n\\t\\tY: %0.2f\" $cpXoff $cpYoff]", +"", +" send infoText set string [", +" format \"%s\\n\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n%s\\n\\n\" \\", +" $line1 $line2 $line3 $line4 $line5 $line6 $line7 $line8 $line9", +" ]", +" }", +"}", +"set params {frame frameView nframes frameSize frameTitle enhancement}", +"foreach p $params { send $p addCallback infoFrameUpdate }", +"", +"", +"# Server Program State information.", +"proc infoOptToggle { widget type state args } \\", +"{", +" global infoMode ismInfoText", +"", +" if {$state} { set not False } else { set not True }", +"", +" send $infoMode set on $not", +" set infoMode $widget", +"", +" switch $widget {", +" infoOptFr { infoFrameUpdate }", +" infoOptSvr { set bp [send imagewin get basePixel] ", +" set mc [send imagewin get maxColors]", +" send client info server $bp $mc", +" }", +" infoOptIsm { send infoText set string $ismInfoText }", +" infoOptClients { send client info clients }", +" infoOptWCS { send client info wcs }", +" infoOptFB { send client info imtoolrc }", +" }", +"}", +"set iopts {infoOptFr infoOptSvr infoOptIsm infoOptClients infoOptWCS infoOptFB }", +"foreach w $iopts { send $w addCallback infoOptToggle }", +"", +"", +"proc infoSetText { param old new } \\", +"{", +" send infoText set string $new", +"} ; send info addCallback infoSetText", +"", +"", +"", +"################################################################################", +"# Image and objects list display and section", +"################################################################################", +"", +"proc filesTextHighlight { widget event args } \\", +"{", +" if { $event == \"enterNotify\" } {", +" send $widget set displayCaret True", +" } elseif { $event == \"leaveNotify\" } {", +" send $widget set displayCaret False", +" }", +"}", +"foreach w {imtemplateText fnameText z1Value z2Value} {", +" send $w addEventHandler filesTextHighlight enterWindowMask", +" send $w addEventHandler filesTextHighlight leaveWindowMask", +"}", +"", +"send rootButton addCallback \"send client setLoadOption root\"", +"send homeButton addCallback \"send client setLoadOption home\"", +"send upButton addCallback \"send client setLoadOption up\"", +"send rescanButton addCallback \"send client setLoadOption rescan\"", +"", +"set label \\", +" [format \"%-35.35s %6s %12s %12s\"\\", +" \" Image\" \"Bitpix\" \" Size\" \" Title\"]", +"send imlistLabel set label $label", +"send imlistLabel \"set height 0 ; unmap\"", +"", +"", +"# Create the Frames menu on the load panel window.", +"set loadItems { \"Current f.exec \\{send frameFrame set label Current\\}\"}", +"for {set i 1} {$i <= $MAX_FRAMES} {incr i} {", +" lappend loadItems \"\\\"\\ \\ $i\\ \\ \\\" f.exec \\{send frameFrame set label $i\\}\"", +"}; createMenu loadFrames frameFrame $loadItems", +"", +"", +"", +"", +"", +"# Filename pattern callback.", +"proc setPattern { widget mode pattern args } \\", +"{", +" send client setLoadOption pattern $pattern", +"} ; send imtemplateText addCallback setPattern", +"", +"", +"# Load options parameter callback.", +"proc doLoadOptions { param old new } \\", +"{", +" global warnings panel_up", +"", +" set val [ join [lrange $new 1 end] \" \" ]", +"", +" switch [lindex $new 0] {", +" pattern { send imtemplateText set string [format \"%s\" $val ] }", +" curdir { send dirLabel set label [format \" Directory: %s\" $val ] }", +" newfile { send fnameText set string $val }", +" status { send filesStatus set label $val", +" if { ! $panel_up } { send imageTitle set label $val }", +" send server synchronize", +" }", +" warning { if {$warnings} { Wexec server $val } }", +" gray { send grayscale set on $val }", +" zscale { send zscale set on $val", +" if {$val} {", +" send zrange setSensitive False", +" } else {", +" send zrange setSensitive True", +" }", +" }", +" zrange { send zrange set on $val", +" if {$val} {", +" foreach w {z1Label z1Value z2Label z2Value} {", +" send $w setSensitive False", +" }", +" } else {", +" foreach w {z1Label z1Value z2Label z2Value} {", +" send $w setSensitive True", +" }", +" }", +" }", +" z1 { send z1Value set string [format \"%s\" $val ] }", +" z2 { send z2Value set string [format \"%s\" $val ] }", +" nsample { send nsampValue set string [format \"%s\" $val ] }", +" }", +"} ; send loadOptions addCallback doLoadOptions", +"", +"# Option utility routines.", +"proc toggleGraymap args \\", +"{", +" send client setLoadOption gray [ send grayscale get on ]", +"} ; send grayscale addCallback toggleGraymap", +"", +"proc toggleHeaders args \\", +"{", +" if { [send browseHdrs get on] } {", +" send client setLoadOption headers ", +" send rootButton setSensitive False", +" send homeButton setSensitive False", +" send upButton setSensitive False", +" send rescanButton setSensitive False", +" send imlistLabel \"set height 10 ; map\"", +" } else {", +" send client setLoadOption rescan ", +" send rootButton setSensitive True", +" send homeButton setSensitive True", +" send upButton setSensitive True", +" send rescanButton setSensitive True", +" send imlistLabel \"set height 0 ; unmap\"", +" }", +"} ; send browseHdrs addCallback toggleHeaders", +"", +"proc toggleZscale args \\", +"{", +" send client setLoadOption zscale [send zscale get on]", +"} ; send zscale addCallback toggleZscale", +"", +"proc toggleZrange args \\", +"{", +" send client setLoadOption zrange [send zrange get on]", +"} ; send zrange addCallback toggleZrange", +"", +"proc setZ1 { widget mode pattern args } \\", +"{", +" send client setLoadOption z1 $pattern", +"} ; send z1Value addCallback setZ1", +"", +"proc setZ2 { widget mode pattern args } \\", +"{", +" send client setLoadOption z2 $pattern", +"} ; send z2Value addCallback setZ2", +"", +"proc setNsamp { widget mode pattern args } \\", +"{", +" send client setLoadOption nsample $pattern", +"} ; send nsampValue addCallback setNsamp", +"", +"proc fileLoad { widget mode fname args } \\", +"{", +" loadImage $fname", +"} ; send fnameText addCallback fileLoad", +"", +"", +"", +"# Image list selection routines.", +"", +"set fileList {}", +"", +"proc setFileList { param old new } \\", +"{", +" global fileList", +" set fileList $new", +"", +" # Get the max length of the strings so we can set", +" # the list columns appropriately.", +" set max 0", +" foreach n $new {", +" set len [string length $n]", +" if {$len > $max} { set max $len }", +" }", +"", +" # Optimize the number of columns for the file list.", +" if {$max > 35} { ", +" send imageList set defaultColumns 1", +" } elseif {$max > 21} { ", +" send imageList set defaultColumns 2", +" } elseif {$max > 12} { ", +" send imageList set defaultColumns 3", +" } elseif {$max > 5} { ", +" send imageList set defaultColumns 4", +" } else { ", +" send imageList set defaultColumns 5", +" }", +"", +" send imageList setList $new resize", +"}; send filelist addCallback setFileList", +"", +"proc flResize args \\", +"{", +" global fileList", +" send imageList setList $fileList resize", +"}; send imageList addEventHandler flResize ResizeRedirectMask", +"", +"proc flSelectPrint { widget cbtype selections args } \\", +"{", +" if {! [send autoload get on]} \\", +" return", +"", +" foreach selection $selections { ", +" if { [send zrange get on] } {", +" loadImage [lindex $selection 0]", +" } else {", +" loadImage $selection", +" }", +" }", +"}; send imageList addCallback flSelectPrint", +"", +"", +"# Load the named image in the display.", +"proc loadImage { name } \\", +"{", +" global frame", +"", +" set fr [send frameFrame get label]", +"", +" if { $fr == \"Current\" } { set fr $frame }", +"", +" if { [fileSetOptions] >= 0 } {", +" send imagewin setCursorType busy", +" send client load $name $fr", +" send imagewin setCursorType idle", +" send fnameText set string $name", +" }", +"}", +"", +"# Load button callback.", +"proc fileLoadB args \\", +"{", +" set fname [send fnameText get string]", +" if {$fname == \"\"} {", +" Wexec client \"No image name specified\"", +" } else {", +" loadImage $fname", +" }", +"} ; send filesLoadButton addCallback fileLoadB", +"", +"", +"# Send and selected options to the client before loading the image.", +"proc fileSetOptions args \\", +"{", +" if { ![send zscale get on] && ![send zrange get on] } {", +" set z1 [send z1Value get string]", +" set z2 [send z2Value get string]", +"", +" if {$z1 == $z2} {", +" Wexec client \"z1/z2 values are not set properly\"", +" return -1", +" } else {", +" send client setLoadOption z1 $z1", +" send client setLoadOption z2 $z2", +" }", +" }", +"", +" return 0", +"}", +"", +"", +"################################################################################", +"# Save panel functions.", +"################################################################################", +"", +"# Global variables needed for the save setup panel", +"", +"set format rasButton", +"set saveColor svPseudoButton", +"", +"set fileFmtButtons {", +" rasButton gifButton jpegButton tiffButton ", +" fitsButton x11Button epsButton rawButton ", +"}", +"", +"", +"# Format group procedures.", +"#---------------------------------", +"", +"# Select a format.", +"", +"proc set_format { widget func state args } \\", +"{", +" global format saveColor", +"", +" send $format set on false", +" if {$widget == $format} {", +" send $widget set on true", +" } else {", +" switch $widget { ", +" rasButton { send client setSaveOption format ras } ", +" gifButton { send client setSaveOption format gif }", +" jpegButton { send client setSaveOption format jpeg }", +" tiffButton { send client setSaveOption format tiff }", +" fitsButton { send client setSaveOption format fits }", +" x11Button { send client setSaveOption format x11 }", +" epsButton { send client setSaveOption format eps }", +" rawButton { send client setSaveOption format raw }", +" }", +" }", +"} ; foreach fmt $fileFmtButtons { send $fmt addCallback set_format }", +"", +"proc setSaveFile { widget cbtype args } \\", +"{", +" send client setSaveOption fname $args", +" send saveStatus set label [format \"output file set to %s\" $args]", +"}; send saveFile addCallback setSaveFile", +"", +"", +"proc doSaveOptions { param old new } \\", +"{", +" global format saveColor", +" global warnings", +"", +" send saveStatus set label {}", +" set val [join [lrange $new 1 end] \" \"]", +"", +" #print [format \"doSaveOptions %s = %s\" [lindex $new 0] $val]", +" switch [lindex $new 0] {", +" format { ", +" # Now (de)sensitize the color options depending on the format,", +" # force the color choice when needed.", +" send $format set on false", +" switch [lindex $val 0] {", +" ras { #send svRGBButton setSensitive false", +" send svPseudoButton setSensitive true", +" set format rasButton", +" }", +" gif { send svRGBButton setSensitive false", +" send svPseudoButton setSensitive true", +" if {$saveColor == \"svRGBButton\"} {", +" send $saveColor set on false", +" send svPseudoButton set on true", +" set saveColor svPseudoButton", +" }", +" set format gifButton", +" }", +" jpeg { send svRGBButton setSensitive true", +" send svPseudoButton setSensitive true", +" set format jpegButton", +" }", +" tiff { send svRGBButton setSensitive false", +" send svPseudoButton setSensitive true", +" set format tiffButton", +" }", +" fits { send svRGBButton setSensitive false", +" send svPseudoButton setSensitive false", +" send $saveColor set on false", +" send svGrayButton set on true", +" set saveColor svGrayButton", +" set format fitsButton", +" }", +" x11 { send svRGBButton setSensitive true", +" send svPseudoButton setSensitive true", +" set format x11Button", +" }", +" eps { send svRGBButton setSensitive true", +" send svPseudoButton setSensitive true", +" set format epsButton", +" }", +" raw { send svRGBButton setSensitive true", +" send svPseudoButton setSensitive true", +" set format rawButton", +" }", +" }", +" send $format set on true", +" }", +" color { send $saveColor set on false", +" switch [lindex $val 0] {", +" grayscale { send svGrayButton set on true", +" set saveColor svGrayButton", +" }", +" pseudocolor { send svPseudoButton set on true", +" set saveColor svPseudoButton", +" }", +" rgb { send svRGBButton set on true", +" set saveColor svRGBButton", +" }", +" }", +" }", +" fname { send saveFile set string $val", +" }", +" status { send saveStatus set label $val", +" send server synchronize", +" }", +" text { send saveData set label $val", +" }", +" warning { if {$warnings} { Wexec server $val }", +" }", +" }", +"} ; send saveOptions addCallback doSaveOptions", +"", +"", +"# Color group procedures.", +"#---------------------------------", +"send svGrayButton addCallback \"send client setSaveOption color grayscale\"", +"send svPseudoButton addCallback \"send client setSaveOption color pseudocolor\"", +"send svRGBButton addCallback \"send client setSaveOption color rgb\"", +"", +"", +"proc Save args \\", +"{", +" global panel_up", +"", +" send imagewin setCursorType busy", +"", +" # Get the print command or file template if not previous reset.", +" set val [ send saveFile get string ]", +" send client setSaveOption fname $val", +" send saveStatus set label [format \"output file set to %s\" $args]", +"", +" send client save", +" send imagewin setCursorType idle", +"} ; send okaySave addCallback Save", +"", +"", +"", +"################################################################################", +"# TILE GEOMETRY", +"################################################################################", +"", +"set tileSel 2", +"set tileOpt 0", +"set tileNcols 2", +"set tileNrows 1", +"set tile_frames {}", +"", +"proc selectTileOrientation { widget type select args } \\", +"{", +" global tileSel tileOpt", +"", +" set w { nrowLab ncolLab nrdecrease nrincrease ncdecrease ncincrease }", +" if {$select == \"Manual\"} {", +" foreach p $w { send $p setSensitive True }", +" } elseif {$select != \"none\"} {", +" foreach p $w { send $p setSensitive False }", +" }", +"", +" set w { byCols bottomUp labelFrames labelImname labelTitles }", +" if {$select == \"Disabled\"} {", +" foreach p $w { send $p setSensitive False }", +" } else {", +" foreach p $w { send $p setSensitive True }", +" }", +"", +" switch $select {", +" Disabled { set tileSel 0 }", +" Manual { set tileSel 1", +" set nx [send nctext get label]", +" set ny [send nrtext get label]", +" set select [format \"%dx%d\" $nx $ny]", +" }", +" Best { set tileSel 2 }", +" Square { set tileSel 3 }", +" Horizontal { set tileSel 4 }", +" Vertical { set tileSel 5 }", +" \"One Row\" { set tileSel 6 }", +" \"One Column\" { set tileSel 7 }", +" none { send tileMode set selection $tileSel ; return }", +" }", +"", +" # Reset the button in case we're called directly from elsewhere.", +" send tileMode set selection $tileSel", +"", +" # Send the option to the client.", +" if {$tileSel > 0} {", +" setTileFrames", +" send client setOption tileFrames \"True\"", +" set tileOpt $tileSel", +" } else {", +" send client setOption tileFrames \"False\"", +" }", +"", +"} ; send tileMode addCallback selectTileOrientation", +"", +"proc tileSelToLabel { selection args } \\", +"{", +" switch $selection {", +" 0 { return \"Disabled\" }", +" 1 { return \"Manual\" }", +" 2 { return \"Best\" }", +" 3 { return \"Square\" }", +" 4 { return \"Horizontal\" }", +" 5 { return \"Vertical\" }", +" 6 { return \"One Row\" }", +" 7 { return \"One Column\" }", +" }", +" return \"Best\"", +"}", +"", +"# Callback for the fill style options.", +"proc selectFillStyle { widget type state args } \\", +"{", +" if {$state} { set not False } else { set not True }", +"", +" switch $widget {", +" byCols { send client setOption tileByRows $not }", +" bottomUp { send client setOption tileTopDown $not }", +" }", +"} ; foreach w {byCols bottomUp} { send $w addCallback selectFillStyle }", +"", +"# Callback for the tile labelling options.", +"proc selectTileLabels { widget type state args } \\", +"{", +" if {$state} { ", +" switch $widget {", +" labelFrames { send client setOption tileLabels 1 }", +" labelImname { send client setOption tileLabels 2 }", +" labelTitles { send client setOption tileLabels 3 }", +" }", +" } else {", +" send client setOption tileLabels 0", +" }", +" send $widget set on $state", +"}", +"foreach w {labelFrames labelImname labelTitles} {", +" send $w addCallback selectTileLabels", +"}", +"", +"# Callback for the Tile Frame selection toggles.", +"proc setTileFrames args \\", +"{", +" global tile_frames tileSel tileNcols tileNrows", +"", +" # No-op if tiling isn't enabled.", +" if {$tileSel == 0} \\", +" return", +"", +" # Get the new tile frames list.", +" set tile_frames {}", +" for {set i 1} {$i <= 16} {incr i} {", +" if {[send tFrame$i get state]} {", +" lappend tile_frames $i", +" }", +" }", +"", +" # Reset the geometry.", +" set geom [format \"%dx%d\" $tileNcols $tileNrows]", +" switch $tileSel {", +" 1 { send client setOption tileGeom $geom \\{ $tile_frames \\} }", +" 2 { send client setOption tileGeom Best \\{ $tile_frames \\} }", +" 3 { send client setOption tileGeom Square \\{ $tile_frames \\} }", +" 4 { send client setOption tileGeom Horizontal \\{ $tile_frames \\} }", +" 5 { send client setOption tileGeom Vertical \\{ $tile_frames \\} }", +" 6 { send client setOption tileGeom Row \\{ $tile_frames \\} }", +" 7 { send client setOption tileGeom Column \\{ $tile_frames \\} }", +" }", +"}; for {set i 1} {$i <= 16} {incr i} {send tFrame$i addCallback setTileFrames}", +"", +"proc setAllTileFrames args \\", +"{", +" global tileNcols tileNrows", +" for {set i 1} {$i <= 16} {incr i} {", +" if {[send tFrame$i get sensitive]} {", +" send tFrame$i set state True", +" }", +" }", +" setTileFrames", +"} ; send tAll addCallback setAllTileFrames", +"", +"proc setNoTileFrames args \\", +"{", +" global tileNcols tileNrows", +" for {set i 1} {$i <= 16} {incr i} {", +" if {[send tFrame$i get sensitive]} {", +" send tFrame$i set state False", +" }", +" }", +" setTileFrames", +"} ; send tNone addCallback setNoTileFrames", +"", +"proc tileOptions { param old new } \\", +"{", +" global tileNcols tileNrows", +"", +" set tileNcols [lindex $new 0]", +" set tileNrows [lindex $new 1]", +"", +" # Set the geometry.", +" send nctext set label $tileNcols", +" send nrtext set label $tileNrows", +" send tileGeometry set label [format \\", +" \"Tile Geometry: %-2dx%2d\" $tileNcols $tileNrows]", +"", +"} ; send tileOptions addCallback tileOptions", +"", +"", +"proc tileSetRows { widget args } \\", +"{", +" global nframes tile_frames", +"", +" set nx [send nctext get label]", +" set ny [send nrtext get label]", +"", +" if {$widget == \"nrdecrease\" && [expr ($ny-1)] > 0} {", +" incr ny -1", +" } elseif {$widget == \"nrincrease\" && [expr ($ny+1)] <= $nframes} {", +" incr ny 1", +" } else {", +" return", +" }", +" set geom [format \"%dx%d\" $nx $ny]", +" send client setOption tileGeom $geom $tile_frames", +"} ; foreach w { nrdecrease nrincrease } { send $w addCallback tileSetRows }", +"", +"proc tileSetCols { widget args } \\", +"{", +" global nframes tile_frames", +"", +" set nx [send nctext get label]", +" set ny [send nrtext get label]", +"", +" if {$widget == \"ncdecrease\" && [expr ($nx-1)] > 0} {", +" incr nx -1", +" } elseif {$widget == \"ncincrease\" && [expr ($nx+1)] <= $nframes} {", +" incr nx 1", +" } else {", +" return", +" }", +" set geom [format \"%dx%d\" $nx $ny]", +" send client setOption tileGeom $geom $tile_frames", +"} ; foreach w { ncdecrease ncincrease } { send $w addCallback tileSetCols }", +"", +"", +"# Initialize the frame tiling.", +"setAllTileFrames", +"selectTileOrientation junk junk Disabled", +"selectFillStyle byRows junk True", +"selectFillStyle topDown junk True", +"selectTileLabels labelImname junk False", +"", +"################################################################################", +"# Coords Panel Callbacks.", +"################################################################################", +"", +"# In case we need to change the values....", +"#global wcsPHeight wcsPTxtHeight wcsPGrHeight wcsPOptHeight", +"#set wcsPHeight 267", +"#set wcsPTxtHeight 132", +"#set wcsPGrHeight 175", +"#set wcsPOptHeight 233", +"#setCoordPanelHeight", +"", +"set wcsPHeight 267 ;# full panel no options", +"set wcsPTxtHeight 132 ;# size of text area box", +"set wcsPGrHeight 175 ;# size of text area group", +"set wcsPOptHeight 233 ;# extra height for opts boxes", +"", +"# Set the WCS readout panel sensitivity depending on whether the ISM", +"# is currently enabled.", +"proc setCoordPanelSensitivity args \\", +"{", +" set widgets { ", +" wpWcs2 wpWcs3 wpWcs4 ", +" wiWcs2 wiWcs3 wiWcs4 ", +" wlWcs2 wlWcs3 wlWcs4", +" sysWcs2 sysWcs3 sysWcs4 ", +" fmtWcs2 fmtWcs3 fmtWcs4", +" }", +"", +" send sysWcs1 set label \"Display\"", +" send fmtWcs1 set label \"Default\"", +"", +" for {set i 2} {$i <= 4} {incr i} {", +" send sysWcs$i set label \"None\" ; send fmtWcs$i set label \"Default\"", +" send wpWcs$i set on False ; send wiWcs$i set on False", +" send wtWcs$i set height 4", +" }", +"", +" if {[send ismToggle get on]} {", +" send sysWcs2 set label \"World\" ; send fmtWcs2 set label \"Default\"", +" send wpWcs2 set on True ; send wiWcs2 set on True", +" send wtWcs2 set height 17", +"", +" foreach w $widgets { send $w setSensitive True }", +" } else {", +" foreach w $widgets { send $w setSensitive False }", +" }", +"}", +"", +"", +"# Set the Coords Panel height depending on the option settings.", +"proc setCoordPanelHeight args \\", +"{", +" global wcsPHeight wcsPOptHeight wcsPTxtHeight wcsPGrHeight", +" global tabTop", +"", +" if {$tabTop != \"wcs_panel\"} \\", +" return", +"", +" # Get the height of the text area", +" set panel_h $wcsPHeight", +" set shrinkage 0", +" foreach w { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo } {", +" if {[send $w get on] == 0} {", +" incr shrinkage 13", +" }", +" }", +" if {[send woptTitles get on] == 0} {", +" incr shrinkage 26", +" }", +"", +" set ph [expr ($wcsPHeight - $shrinkage)]", +" if {[send wcsOptions get on] == 1} {", +" incr ph $wcsPOptHeight", +" }", +"", +" send wcsGroup set height [ expr ($wcsPGrHeight - $shrinkage) ]", +" send wcsFrame set height [ expr ($wcsPTxtHeight - $shrinkage) ]", +" send panel set height $ph", +"}", +"", +"# Toggle the options display for the panel.", +"proc wcsOptToggle { widget type state args } \\", +"{", +" global wcsPOptHeight", +" set h [ send panel get height ] ", +" if {$state == 1} {", +" send panel set height [ expr ($h + $wcsPOptHeight) ]", +" } else { ", +" send panel set height [ expr ($h - $wcsPOptHeight) ]", +" }", +"} ; send wcsOptions addCallback wcsOptToggle", +"", +"# Handle the panel display toggles.", +"proc wcsCoordsCB { widget type state args } \\", +"{", +"", +" set hght [ expr (($state == 1) ? 17 : 4)]", +" switch $widget {", +" wpWcs1 { send wtWcs1 set height $hght }", +" wpWcs2 { send wtWcs2 set height $hght }", +" wpWcs3 { send wtWcs3 set height $hght }", +" wpWcs4 { send wtWcs4 set height $hght }", +" woptFBinfo { send wtFBCfg set height $hght }", +" woptTitles { send wtName set height $hght ; send wtTitle set height $hght }", +" }", +" setCoordPanelHeight ", +"}", +"set wcValues { wpWcs1 wpWcs2 wpWcs3 wpWcs4 woptFBinfo woptTitles }", +"foreach w $wcValues { send $w addCallback wcsCoordsCB }", +"", +"", +"# Handle WCS label string options.", +"set wcsLabels 1", +"proc wcsLabelsCB { widget type state args } \\", +"{", +" global up_todo wcsLabels", +" set wcsLabels $state", +" #resizeCoordsBox 0", +" resizeCoordsBox $up_todo", +" updateCoordsBox", +"} ; send woptLabels addCallback wcsLabelsCB", +"", +"", +"# Toggle the BPM tracking state.", +"proc wcsBPMCB { widget type state args } \\", +"{", +" global ism_enable", +" if ($ism_enable) { catch { send wcspix set bpm $state } }", +"} ; send woptBPM addCallback wcsBPMCB", +"", +"", +"# Procedures to format lines in the wcsText box.", +"proc wcsFmtImname { name } \\", +"{", +" send wtName set string [format \" Name: %s\" [string trimleft $name]]", +"}", +"", +"proc wcsFmtImtitle { title } \\", +"{", +" send wtTitle set string [format \" Title: %s\" [string trimleft $title]]", +"}", +"", +"proc wcsFmtFBConfig args \\", +"{", +" global frameWidth frameHeight frame nframes", +" set buf [ format \"%5d x %-5d\" $frameWidth $frameHeight ]", +" set line [ format \"Frame Buf: %-13s Frame: %d of %d\" \\", +" [string trimleft $buf] $frame $nframes ]", +" send wtFBCfg set string $line", +"}", +"", +"proc wcsFmtIValue { value } \\", +"{", +" global coord", +" set line [ format \" Pixel: %.11s\" $value ]", +" send wtIPixval set string $line", +" if {[info exists coord(ival)]} {", +" set coord(ival) $value", +" updateCoordsBox", +" }", +"}", +"", +"proc wcsFmtSValue { value } \\", +"{", +" global coord", +" set line [ format \" Scaled: %.8s\" $value ]", +" send wtSPixval set string $line", +" set coord(sval) [format \"%s\" $value]", +"}", +"", +"proc wcsFmtBValue { value } \\", +"{", +" global coord", +"", +" if { [send woptBPM get on] } {", +" set line [ format \" BPM: %s\" $value ]", +" set color [expr { ($value == 0) ? \"black\" : \"red\" } ]", +" set msg [format \"set string \\{%s\\}; set background %s\" $line $color ]", +" set coord(bval) [format \"%s\" $value]", +" } else {", +" set line [ format \" BPM: (off)\" ]", +" set msg [format \"set string \\{%s\\}\" $line]", +" }", +" send wtBPixval $msg", +"}", +"", +"proc wcsFmtWcs { num wcsname x y xunit yunit args } \\", +"{ ", +" global coord coordLab wcsLabels", +"", +" if {$wcsLabels} {", +" set line [ format \"%4s: %12s %4s: %12s WCS: %s\" \\", +" $xunit $x $yunit $y [string trimleft $wcsname] ]", +" } else {", +" set line [ format \"%4s %12s %4s %12s %s\" \\", +" \" \" $x \" \" $y [string trimleft $wcsname] ]", +" }", +" send wtWcs$num set string $line", +"", +" if {[info exists coord(wcs$num)]} {", +" if {$num == 1} {", +" set coord(wcs1) [ format \"\\{%s\\} \\{%s\\} \\{%s\\}\" $x $y $coord(sval) ]", +" } elseif {$num == 2} {", +" set coord(wcs2) [ format \"\\{%s\\} \\{%s\\} \\{%s\\}\" $x $y $coord(ival) ]", +" } else {", +" set coord(wcs$num) [ format \"\\{%s\\} \\{%s\\} \\{%s\\}\" $x $y $wcsname ]", +" }", +"", +" set coordLab(wcs$num) [ format \"\\{%s\\} \\{%s\\} \\{%s\\}\" \\", +" $xunit $yunit [string trimleft $wcsname ] ]", +" updateCoordsBox", +" }", +"}", +"", +"", +"", +"# Handle the wcsbox readout.", +"#------------------------------", +"set up_todo 2", +"set up_done 0", +"set coord(ival) 0.", +"set coord(sval) 0.", +"set coord(bval) 0", +"set coord(wcs1) { 0. 0. 0. }", +"set coord(wcs2) { 0. 0. 0. }", +"set coord(wcs3) { 0. 0. 0. }", +"set coord(wcs4) { 0. 0. 0. }", +"", +"proc wcsCoordB { widget type state args } \\", +"{", +" global coord up_todo", +"", +" switch $widget {", +" wiWcs1 { set line wcs1 ;set coord($line) { 0. 0. \"\" } }", +" wiWcs2 { set line wcs2 ;set coord($line) { 0. 0. \"\" } }", +" wiWcs3 { set line wcs3 ;set coord($line) { 0. 0. \"\" } }", +" wiWcs4 { set line wcs4 ;set coord($line) { 0. 0. \"\" } }", +" }", +"", +" if {$state} {", +" incr up_todo", +" } else {", +" unset coord($line)", +" incr up_todo -1", +" }", +"", +" resizeCoordsBox $up_todo", +" updateCoordsBox", +"}", +"set wiValues { wiWcs1 wiWcs2 wiWcs3 wiWcs4 }", +"foreach w $wiValues { send $w addCallback wcsCoordB }", +"", +"", +"# Resize the coords box depending on the panel options.", +"proc resizeCoordsBox { nlines } \\", +"{", +" global track_enable wcsLabels winWidth winHeight wcsboxGeom ", +"", +" if {! $track_enable} \\", +" return", +"", +" send wcsbox getAttributes width cur_w height cur_h ", +" set defGeom [format \"%sx%s-5-5\" $cur_w $cur_h]", +" send imagewin parseGeometry $wcsboxGeom $defGeom x y width height", +"", +" set ew [expr (($wcsLabels == 1) ? 125 : 65)]", +"", +" # Reset to the default geometry", +" if {$nlines == 0} {", +" set x [expr ($x + $ew)]", +" set y [expr ($y + $height - 17 + 1)]", +" set new_w 166", +" set new_h 17", +"", +" } else {", +" if {$width > 166} { ;# not using default wcsbox", +" set new_w $width", +" } else {", +" set new_w [expr ($width + $ew)]", +" set x [expr ($x - $ew)]", +" if {$wcsLabels == 0} {", +" incr x 60", +" }", +" }", +" set new_h [ expr ($nlines * 17) ]", +" set y [expr ($y + $height - $new_h + 1)]", +" }", +"", +" # Bounds checking.", +" if {$x < 5} {", +" set x 5", +" } elseif {$x > [expr ($winWidth - $new_w - 5)]} {", +" set x [expr ($winWidth - $new_w - 5)]", +" }", +" if {$y < 5} {", +" set y 5", +" } elseif {$y > [expr ($winHeight - $new_h - 5)]} {", +" set y [expr ($winHeight - $new_h - 5)]", +" }", +"", +" # Finally redraw the marker.", +" send wcsbox \"\\", +" setAttributes \\", +" width $new_w \\", +" height $new_h \\", +" x $x \\", +" y $y; \\", +" redraw\"", +"", +" set wcsboxGeom [send imagewin getGeometry $x $y $new_w $new_h]", +" send client encodewcs [expr ($winWidth / 2)] [expr ($winHeight / 2)]", +" updateCoordsBox", +"}", +"", +"", +"# Shortcuts for known WCS labels.", +"set labels(display) \"TV\"", +"set labels(logical) \"Log\"", +"set labels(physical) \"Phys\"", +"set labels(equatorial) \"Eq\"", +"set labels(ecliptic) \"Ecl\"", +"set labels(galactic) \"Gal\"", +"set labels(supergalactic) \"SGal\"", +"set labels(amplifier) \"Amp\"", +"set labels(ccd) \"CCD\"", +"set labels(detector) \"Det\"", +"", +"", +"# Format the coords box marker with the selected output options.", +"proc updateCoordsBox args \\", +"{", +" global ism_enable coord coordLab wcsLabels", +" global up_done up_todo labels track_enable", +" global coord", +"", +" if {! $ism_enable} \\", +" return", +"", +" incr up_done", +"", +" set text \"\"", +" foreach l {wcs1 wcs2 wcs3 wcs4} {", +" if {[info exists coord($l)]} {", +" set x [lindex $coord($l) 0]", +" set y [lindex $coord($l) 1]", +" set z [string tolower [string trimleft [lindex $coord($l) 2] ] ]", +" if {[info exists labels($z)]} {", +" set z $labels($z)", +" }", +"", +" if {$wcsLabels && [info exists coordLab($l)]} {", +" set lx [lindex $coordLab($l) 0]", +" set ly [lindex $coordLab($l) 1]", +" append text [format \" %4s %12.12s %4s %12.12s %9.9s \\n\" \\", +" $lx $x $ly $y $z ]", +" } else {", +" append text [format \" %12.12s %12.12s %9.9s \\n\" $x $y $z ]", +" }", +" }", +" }", +"", +" # Now send the string.", +" if {$track_enable} {", +" set color [expr { ($coord(bval) == 0) ? \"black\" : \"red\" } ]", +" set txt [format \"set text \\{%s\\}; set textBgColor %s; redraw noerase\" \\", +" $text $color ]", +" send wcsbox $txt", +" }", +"", +" if {$up_done >= $up_todo} {", +" set up_done 0 ;# reset counter", +" }", +"}", +"", +"", +"# Create the WCS format menus.", +"#------------------------------------", +"proc setWcsFmt { format line } \\", +"{", +" catch { send wcspix set format $format $line }", +"}", +"", +"for {set i 1} {$i <= 4} {incr i} {", +" set items {}", +" lappend items \"\\\"Default\\\" f.exec \\{setWcsFmt default $i\\}\"", +" lappend items \"\\\"Sexigesimal\\\" f.exec \\{setWcsFmt hms $i\\}\"", +" lappend items \"\\\"Degrees\\\" f.exec \\{setWcsFmt deg $i\\}\"", +" lappend items \"\\\"Radians\\\" f.exec \\{setWcsFmt rad $i\\}\"", +" editMenu fmtMenu$i fmtWcs$i $items", +"}", +"", +"", +"# Create the default WCS type menus.", +"#------------------------------------", +"", +"set defaultWcsMenu {", +" { \"None\" f.exec {setWcsSys none WCS_LINE } }", +" { \"Display\" f.exec {setWcsSys display WCS_LINE } }", +" { \"World\" f.exec {setWcsSys world WCS_LINE } }", +" { \"Logical\" f.exec {setWcsSys logical WCS_LINE } }", +" { \"Physical\" f.exec {setWcsSys physical WCS_LINE } }", +" { f.dblline }", +"}", +"", +"proc setWcsSys { sys line } \\", +"{", +" if {[string tolower $sys] == \"none\"} {", +" wcsCoordB wiWcs$line junk 0", +" send sysWcs$line set label \"None\"; send fmtWcs$line set label \"Default\"", +" send wpWcs$line set on False ; send wiWcs$line set on False", +" send wtWcs$line set height 4", +" setCoordPanelHeight", +"", +" } else {", +" catch { send wcspix set wcs $sys $line }", +" }", +"}", +"", +"proc resetDefaultWcsMenu args \\", +"{", +" global defaultWcsMenu", +"", +" for {set i 1} {$i <= 4} {incr i} {", +" regsub -all WCS_LINE $defaultWcsMenu $i menu_def", +" editMenu sysMenu$i sysWcs$i $menu_def", +" }", +"} ; resetDefaultWcsMenu", +"", +"", +"# Initialize the coordinates panel.", +"#------------------------------------", +"", +"proc initCoordsPanel args \\", +"{", +" #send wcLine set height 2 ;# kludge for label widget", +"", +" # Initialize the display strings in the coords box.", +" wcsFmtImname \"\"", +" wcsFmtImtitle \"\"", +" wcsFmtFBConfig", +" wcsFmtIValue \"0.\" ; wcsFmtSValue \"0.\" ; wcsFmtBValue \"0\"", +" wcsFmtWcs 1 \"\" \"\" \"\" \" X\" \" Y\"", +" wcsFmtWcs 2 \"\" \"\" \"\" \" X\" \" Y\"", +" wcsFmtWcs 3 \"\" \"\" \"\" \" X\" \" Y\"", +" wcsFmtWcs 4 \"\" \"\" \"\" \" X\" \" Y\"", +"", +" send fmtWcs1 set label Default", +" send wpWcs1 set on True ;send wiWcs1 set on True", +" send wpWcs2 set on True ;send wiWcs2 set on True", +" send wpWcs3 set on False ;send wiWcs3 set on False ;send wtWcs3 set height 4", +" send wpWcs4 set on False ;send wiWcs4 set on False ;send wtWcs4 set height 4", +"", +" # Set the Coords Panel height.", +" set wcsPTxtHeight [send wcsText get height]", +" setCoordPanelHeight", +"", +" # Set the WCS readout panel sensitivity.", +" setCoordPanelSensitivity", +"", +"} ; initCoordsPanel", +"", +"", +"", +"", +"################################################################################", +"# Compass indicator procedures.", +"################################################################################", +"", +"set compassColor 207 ;# normally this is yellow", +"set last_compass [send compass get on] ;# save compass state", +"", +"proc drawCompass args \\", +"{", +" global ism_enable frame frameCache compassColor Compass Orient", +" global panner_x panner_y panner_width panner_height cur_objid", +" global redraw_compass last_compass", +"", +" ", +" if {! [send compass get on]} \\", +" return", +"", +" eraseCompass ;# erase the old compass", +"", +" if {! [info exists frameCache($frame)] } {", +" set id -1", +" } elseif {$cur_objid != [lindex $frameCache($frame) 1]} {", +" set id [lindex $frameCache($frame) 1]", +" } else {", +" set id $cur_objid", +" }", +"", +" if { [info exists Compass($id)] } {", +" set angle [lindex $Compass($id) 0]", +" set north_x [lindex $Compass($id) 1]", +" set north_y [lindex $Compass($id) 2]", +" set east_x [lindex $Compass($id) 3]", +" set east_y [lindex $Compass($id) 4]", +" set transpose [lindex $Compass($id) 5]", +" set xlab [lindex $Compass($id) 6]", +" set ylab [lindex $Compass($id) 7]", +" } else {", +" set north_x 0.0 ; set north_y 1.0", +" set east_x 1.0 ; set east_y 0.0", +" set xlab X ; set ylab Y", +" set angle 0.0 ; set transpose 0", +" set Compass($id) { 0.0 1.0 0.0 1.0 0.0 0 X Y }", +" }", +" set xflip 1", +" set yflip 1", +"", +" # Adjust the compass for the display orientation (e.g. image sections", +" # used to flip an image during display).", +" if { [info exists Orient($id)] } {", +" set xflip [expr $xflip * [lindex $Orient($id) 1] ]", +" set yflip [expr $yflip * [lindex $Orient($id) 2] ]", +" }", +"", +" # Get the panner center position.", +" set pcx [expr ($panner_x + $panner_width / 2)]", +" set pcy [expr ($panner_y + $panner_height / 2)]", +"", +" # Setup for the overlay.", +" send imagewin getLogRes sv_xl sv_yl", +" send imagewin getPhysRes sv_xp sv_yp", +" send imagewin setLogRes $sv_xp $sv_yp", +" send imagewin setLineWidth 2", +"", +" set xflip [ expr ($xflip * ([send xflipButton get state] ? -1 : 1))]", +" set yflip [ expr ($yflip * ([send yflipButton get state] ? -1 : 1))]", +"", +" # Normalized compass points. The first row are the axes, second is", +" # the pointer head, and last are the X/Y label coords. Assumes a", +" # zero rotation with North up and East left, or standard X/Y orientation.", +" set cpoints {", +" {-1 0} {0 0} {0 -1}", +" {-0.07 -0.85} {0 -1} {0.07 -0.85} {-0.07 -0.85}", +" {-1.2 0} {0 -1.2}", +" }", +"", +"", +" # Get rotation and scale factors.", +" set angle [expr \"atan2($north_y,$north_x)\"]", +" set coso [expr \"cos (-$angle)\"]", +" set sino [expr \"sin (-$angle)\"]", +" set scale [expr ([min $panner_width $panner_height] * 0.3)]", +"", +" # Initialize the drawing points.", +" set pts {}", +"", +" set cpoints { }", +" lappend cpoints [list $east_x $east_y ]", +" lappend cpoints [list 0 0]", +" lappend cpoints [list $north_x $north_y]", +" foreach p $cpoints {", +" # Get the scaled position.", +" set sx [expr ($scale * [lindex $p [expr \"($transpose > 0) ? 1 : 0\"]])]", +" set sy [expr ($scale * [lindex $p [expr \"($transpose > 0) ? 0 : 1\"]])]", +"", +" # Translate to the scaled position.", +" set rx [expr int($pcx + $sx + 0.5)]", +" set ry [expr int($pcy - $sy + 0.5)]", +"", +" # Now handle the axis flip.", +" set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)]", +" set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)]", +" lappend pts $rx $ry", +" }", +"", +"", +" set rpoints { }", +" set hpoints { {0.0 0.0} {-0.1 -0.07} {-0.1 0.07} {0.0 0.0} }", +" foreach p $hpoints {", +" # Break out the position.", +" set sx [lindex $p [expr \"($transpose > 0) ? 1 : 0\"]]", +" set sy [lindex $p [expr \"($transpose > 0) ? 0 : 1\"]]", +"", +" # Do the rotation of the head at the origin.", +" set rx [expr ($north_x + ($sx * $coso + $sy * $sino))]", +" set ry [expr ($north_y - ($sx * $sino + $sy * $coso))]", +"", +" lappend rpoints [list $rx $ry]", +" }", +" foreach p $rpoints {", +" # Get the scaled position.", +" set sx [expr ($scale * [lindex $p [expr \"($transpose > 0) ? 1 : 0\"]])]", +" set sy [expr ($scale * [lindex $p [expr \"($transpose > 0) ? 0 : 1\"]])]", +"", +" # Translate to the scaled position.", +" set rx [expr int($pcx + $sx + 0.5)]", +" set ry [expr int($pcy - $sy + 0.5)]", +"", +" # Now handle the axis flip.", +" set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)]", +" set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)]", +" lappend pts $rx $ry", +" }", +"", +" set lpoints { }", +" lappend lpoints [list [expr \"$east_x-0.2\"] $east_y ]", +" lappend lpoints [list $north_x [expr \"$north_y+0.2\"] ]", +" foreach p $lpoints {", +" # Get the scaled position.", +" set sx [expr ($scale * [lindex $p [expr \"($transpose > 0) ? 1 : 0\"]])]", +" set sy [expr ($scale * [lindex $p [expr \"($transpose > 0) ? 0 : 1\"]])]", +"", +" # Translate to the scaled position.", +" set rx [expr int($pcx + $sx + 0.5)]", +" set ry [expr int($pcy - $sy - 0.5)]", +"", +" # Now handle the axis flip.", +" set rx [expr (($xflip < 0) ? ($pcx + ($pcx - $rx)) : $rx)]", +" set ry [expr (($yflip < 0) ? ($pcy + ($pcy - $ry)) : $ry)]", +" lappend pts $rx $ry", +" }", +"", +"", +" # Draw the compass axes.", +" set compassPts [lrange $pts 0 5]", +" send imagewin setColorIndex $compassColor", +" send imagewin drawPolyline $compassPts", +"", +" ", +" # Draw the compass pointer.", +" set head [lrange $pts 6 13]", +" send imagewin setFillType solid", +" send imagewin drawPolygon $head", +"", +" # Draw the labels.", +" send imagewin drawAlphaText [lindex $pts 14] [lindex $pts 15] $xlab", +" send imagewin drawAlphaText [lindex $pts 16] [lindex $pts 17] $ylab", +"", +" send imagewin setLogRes $sv_xl $sv_yl", +"", +" set redraw_compass 0", +"", +"} ; foreach w {xflip yflip} { send $w addCallback drawCompass }", +"", +"", +"# This is a kludge to redraw the compass after it is erased when displaying", +"# a new image. Once the user moves the mouse back into the main window we'll", +"# do the redraw.", +"send imagewin addEventHandler drawCompass enterWindowMask", +"", +"", +"", +"proc createCompassMarker { pts args } \\", +"{", +" set cm_points { }", +" lappend cm_points [lrange $pts 0 1]", +" lappend cm_points [lrange $pts 2 3]", +" lappend cm_points [lrange $pts 4 5]", +"", +" print [list $cm_points]", +"", +"}", +"", +"", +"proc eraseCompass args \\", +"{", +" global panner_mapping", +" send imagewin refreshMapping $panner_mapping", +"}", +"", +"proc toggleCompass { widget type state args } \\", +"{", +" global last_compass", +"", +" if {$state} {", +" drawCompass", +" set last_compass True", +" } else {", +" eraseCompass", +" set last_compass False", +" }", +"} ; send compass addCallback toggleCompass", +"", +"", +"", +" ", +"################################################################################", +"# RULER MARKERS", +"################################################################################", +"", +"set rulerX 0 ;# ruler start in screen coords", +"set rulerY 0", +"set rulerPts { {0 0} {0 0} {0 0} } ;# ruler vertices", +"set rulerList { } ;# ruler list", +"", +"set rulerSticky { } ;# list of sticky rulers", +"set isSticky \"Sticky\" ;# menu label", +"", +"set rulerWCS 0 ;# use WCS coords", +"set rulerXWCS 0 ;# ruler start in WCS units", +"set rulerYWCS 0", +"set rulerXWCS2 0 ;# ruler end in WCS units", +"set rulerYWCS2 0", +"set rulerFmt pixel ;# ruler label format", +"", +"", +"# Translations when pointer is inside marker.", +"set rulerTranslations { \\", +" !Ctrl <Key>b: call(prevFrame,$name)", +" !Ctrl <Key>b: call(prevFrame,$name)", +" !Ctrl <Key>f: call(nextFrame,$name)", +" !Ctrl <Key>h: call(move_cursor,-1,0)", +" !Ctrl <Key>j: call(move_cursor,0,1)", +" !Ctrl <Key>k: call(move_cursor,0,-1)", +" !Ctrl <Key>l: call(move_cursor,1,0)", +" !Ctrl <Key>n: call(normalize)", +" !Ctrl <Key>c: call(cpZoomAction,centerFrame)", +" !Ctrl <Key>i: call(cpInvert)", +" !Ctrl <Key>m: call(cpMatchFrames)", +" !Ctrl <Key>r: call(cpRegisterFrames)", +" !Ctrl <Key>p: call(togglePanner)", +" !Alt <Key>1: call(cpSetFrame,frame1)", +" !Alt <Key>2: call(cpSetFrame,frame2)", +" !Alt <Key>3: call(cpSetFrame,frame3)", +" !Alt <Key>4: call(cpSetFrame,frame4)", +" !Ctrl <Key>1: call(cpZoom,1,1,fixed)", +" !Ctrl <Key>2: call(cpZoom,2,2,fixed)", +" !Ctrl <Key>3: call(cpZoom,3,3,fixed)", +" !Ctrl <Key>4: call(cpZoom,4,4,fixed)", +" !Ctrl <Key>5: call(cpZoom,5,5,fixed)", +" !Ctrl <Key>6: call(cpZoom,6,6,fixed)", +" !Ctrl <Key>7: call(cpZoom,7,7,fixed)", +" !Ctrl <Key>8: call(cpZoom,8,8,fixed)", +" !Ctrl <Key>9: call(cpZoom,9,9,fixed)", +" <Key>BackSpace: call(deleteNamedRuler,NAME,$x,$y)", +" <Key>Delete: call(deleteNamedRuler,NAME,$x,$y)", +" <KeyPress>: m_input()", +" <Btn3Down>: call(setRulerMenu) popup(rulerMenu)", +" <Btn3Up>: popdown(rulerMenu)", +"!Ctrl <Btn1Motion>: track-cursor() call(wcsUpdate,$x,$y) call(resizeRuler,$x,$y,0)", +" !Ctrl <Btn1Up>: call(deleteRuler,$x,$y)", +" <Motion>: track-cursor() call(wcsUpdate,$x,$y) call(magnifierMapImage,$x,$y)", +"}", +"", +"", +"", +"# Popup menu in effect when inside marker.", +"set rulerMenuDescription {", +" { \"Ruler\" f.title }", +" { f.dblline }", +" { \"$isSticky\" f.exec { ", +" toggleSticky $ruler", +" } }", +" { f.line }", +" { \"Units\" f.menu rulerUnits }", +" { \"Color\" f.menu rulerColor }", +" { f.line }", +" { \"Draw into Frame\" f.exec { ", +" writeRuler $ruler", +" } sensitive False }", +" { f.line }", +" { \"Destroy\" f.exec { ", +" scan $ruler \"ruler%d\" num", +" deleteNamedRuler $num x y", +" } }", +"} ; createMenu rulerMenu imagewin $rulerMenuDescription", +"", +"set rulerUnitsDescription {", +" { Units f.title }", +" { f.dblline }", +" { \"Pixels\" f.exec { setUnits $ruler pixel } }", +" { \"Arc Seconds\" f.exec { setUnits $ruler arcsec ", +" } sensitive { ($rulerWCS > 0) ? \"True\" : \"False\"} }", +" { \"Arc Minutes\" f.exec { setUnits $ruler arcmin ", +" } sensitive { ($rulerWCS > 0) ? \"True\" : \"False\"} }", +" { \"Degrees\" f.exec { setUnits $ruler degrees ", +" } sensitive { ($rulerWCS > 0) ? \"True\" : \"False\"} }", +"} ; createMenu rulerUnits rulerMenu $rulerUnitsDescription", +"", +"set rulerColorDescription {", +" { Color f.title }", +" { f.dblline }", +" { \"\" f.exec \"r_setColor $ruler black yellow\"", +" bitmap solid foreground black }", +" { \"\" f.exec \"r_setColor $ruler white black\" ", +" bitmap solid foreground white }", +" { \"\" f.exec \"r_setColor $ruler red yellow\" ", +" bitmap solid foreground red }", +" { \"\" f.exec \"r_setColor $ruler green black\" ", +" bitmap solid foreground green }", +" { \"\" f.exec \"r_setColor $ruler blue white\" ", +" bitmap solid foreground blue }", +" { \"\" f.exec \"r_setColor $ruler magenta black\" ", +" bitmap solid foreground magenta }", +" { \"\" f.exec \"r_setColor $ruler cyan black\" ", +" bitmap solid foreground cyan }", +" { \"\" f.exec \"r_setColor $ruler yellow black\" ", +" bitmap solid foreground yellow }", +"} ; createMenu rulerColor rulerMenu $rulerColorDescription", +"", +"", +"proc makeRuler {parent x y} \\", +"{", +" global rulerTranslations ruleno rulerWCS rulerXWCS rulerYWCS", +" global rulerPts rulerX rulerY rulerList", +" global isSticky rulerMenuDescription rulerUnitsDescription", +" global coord coordLab", +"", +"", +" incr ruleno ; set ruler ruler$ruleno", +"", +" # Substitute so the marker translation will delete the marker", +" # by it's number rather than the default parent widget name.", +" regsub -all NAME $rulerTranslations $ruleno translations", +"", +" # Create the polygon for the marker.", +" send $parent createMarker $ruler \\", +" type polygon\\", +" createMode noninteractive\\", +" translations $translations\\", +" lineColor yellow\\", +" fill False\\", +" highlightWidth 1\\", +" highlightColor yellow\\", +" knotSize 0\\", +" activated True\\", +" visible False\\", +" sensitive True\\", +" x $x\\", +" y $y", +"", +" # Define a callback so we can identify the ruler.", +" send $ruler addCallback selectRuler focusIn focusOut", +"", +" # Create the text markers for the labels.", +" send $parent set markerTextFont 6x9", +" makeLabelMarker $parent rulerXlab$ruleno 5ch 1ch", +" makeLabelMarker $parent rulerYlab$ruleno 5ch 1ch", +" makeLabelMarker $parent rulerHlab$ruleno 8ch 1ch", +" send $parent set markerTextFont 6x13", +"", +" set rulerX $x ;# save the reference point", +" set rulerY $y", +"", +" set ref [ list $x $y ] ;# initialize the polygon", +" set rx [ list [expr \"$x +1\"] $y ]", +" set ry [ list $x [expr \"$y +1\"] ]", +" set rulerPts [list $ref $rx $ry ]", +"", +" send $ruler setVertices $rulerPts ;# set attributes", +" send $ruler set visible True\"", +" send $ruler setAttribute autoRedraw True", +"", +" # See whether we have a WCS to use.", +" set rulerWCS 0", +" set rulerXWCS 0", +" set rulerYWCS 0", +" for {set num 1} {$num <= 4 && $rulerWCS == 0} {incr num} {", +" if { [info exists coordLab(wcs$num)] } {", +" set xl [string tolower [lindex $coordLab(wcs$num) 0]]", +" set yl [string tolower [lindex $coordLab(wcs$num) 1]]", +" set fmt [string tolower [send fmtWcs$num get label] ]", +" if {$xl==\" ra\" || $xl==\"elon\" || $xl==\"glon\" || $xl==\"slon\"} {", +" set rulerWCS $num", +" set rulerXWCS [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt]", +" set rulerYWCS [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt]", +" }", +" }", +" }", +"", +" # Edit the menus.", +" set isSticky \"Sticky\"", +" editMenu rulerMenu imagewin $rulerMenuDescription", +" editMenu rulerUnits imagewin $rulerUnitsDescription", +"", +"", +" lappend rulerList $ruleno", +"}", +"", +"proc wcs2log { val label fmt} \\", +"{", +" set newval $val", +" if {$fmt == \"sexigesimal\" || $fmt == \"default\"} {", +" scan $val \"%d:%d:%f\" h m s", +" set newval [expr \"double($h) + double($m) / 60.0 + double($s) / 3600.0\"]", +" if {$label == \" ra\"} {", +" set newval [expr \"double($newval * 15.0)\"]", +" }", +" }", +" return [expr \"double($newval)\" ]", +"}", +"", +"", +"proc resizeRuler {x y redraw} \\", +"{", +" global rulerPts rulerX rulerY ruleno coord coordLab", +" global rulerWCS rulerXWCS rulerYWCS rulerFmt", +" global rulerXWCS2 rulerYWCS2", +"", +"", +" # Track the mouse.", +" set ref [ list $rulerX $rulerY ]", +" set rx [ list $x $rulerY ]", +" set ry [ list $x $y ]", +" set rulerPts [list $ref $rx $ry ]", +"", +" # Compute the distances.", +" if {$rulerWCS > 0} {", +" set num $rulerWCS", +" set xl [string tolower [lindex $coordLab(wcs$num) 0]]", +" set yl [string tolower [lindex $coordLab(wcs$num) 1]]", +" set fmt [string tolower [send fmtWcs$num get label] ]", +"", +" # Save the cursor coords in WCS so we can convert labels.", +" if {$redraw} {", +" set nx $rulerXWCS2", +" set ny $rulerYWCS2", +" } else {", +" set nx [wcs2log [lindex $coord(wcs$num) 0] $xl $fmt]", +" set ny [wcs2log [lindex $coord(wcs$num) 1] $yl $fmt]", +" set rulerXWCS2 $nx", +" set rulerYWCS2 $ny", +" }", +" }", +"", +" if {$rulerFmt == \"pixel\"} {", +" set xdist [ expr \"abs($x - $rulerX)\" ]", +" set ydist [ expr \"abs($y - $rulerY)\" ]", +" set hdist [ expr \"sqrt($xdist * $xdist + $ydist * $ydist)\" ]", +" } else {", +" set xdist [ expr \"abs($nx - $rulerXWCS)\" ]", +" set ydist [ expr \"abs($ny - $rulerYWCS)\" ]", +" set hdist [ expr \"sqrt($xdist * $xdist + $ydist * $ydist)\" ]", +" }", +"", +" # Redraw the polygon.", +" send ruler$ruleno setVertices $rulerPts", +"", +" # Label the distances.", +" setXRulerLabel $x $y $xdist", +" setYRulerLabel $x $y $ydist", +" setHRulerLabel $x $y $hdist", +"}", +"", +"# Create a label marker for the ruler.", +"proc makeLabelMarker { parent name width height } \\", +"{", +" send $parent createMarker $name \\", +" type text \\", +" createMode noninteractive \\", +" width $width \\", +" height $height \\", +" lineWidth 0 \\", +" imageText true \\", +" textBgColor yellow \\", +" textColor black \\", +" activated true \\", +" visible false", +"}", +"", +"proc setXRulerLabel { cx cy dist } \\", +"{", +" global rulerX rulerY ruleno winWidth winHeight", +" global cpXscale rulerFmt", +"", +" send rulerXlab$ruleno set visible False", +"", +" if {[expr \"abs($cx - $rulerX)\"] > 30} {", +" switch $rulerFmt {", +" pixel { set text [format \"%.1f\" [expr \"$dist / $cpXscale\"] ] }", +" arcsec { set text [format \"%.2f\\\"\" [expr \"$dist * 3600.0\"] ] }", +" arcmin { set text [format \"%.2f\\'\" [expr \"$dist * 60.0\"] ] }", +" degrees { set text [format \"%.2fd\" \"$dist\" ] }", +" }", +" set len [expr [string length $text] + 1]", +" send rulerXlab$ruleno \"set width ${len}ch\"", +"", +" # Compute the placement of the label marker.", +" if {$cy > $rulerY} {", +" set yp [expr \"$rulerY - 14\"]", +" } else {", +" set yp [expr \"$rulerY + 2\"]", +" }", +" if {$cx > $rulerX} {", +" set xp [expr \"$rulerX + abs($cx - $rulerX)/2 - 10\"]", +" } else {", +" set xp [expr \"$rulerX - abs($cx - $rulerX)/2 - 10\"]", +" }", +"", +" # Bounds checking.", +" if {$xp < 0} { set xp 1 }", +" if {$yp < 0} { set yp 1 }", +" if {$xp > $winWidth} { set xp [expr \"$winWidth - 20\" }", +" if {$yp > $winHeight} { set yp [expr \"$winHeight - 20\" }", +"", +" send rulerXlab$ruleno \"setAttributes x $xp y $yp\"", +" send rulerXlab$ruleno \"set text \\{$text\\}; redraw erase\"", +"", +" send rulerXlab$ruleno set visible True", +" }", +"}", +"", +"proc setYRulerLabel { cx cy dist } \\", +"{", +" global rulerX rulerY ruleno winWidth winHeight", +" global cpYscale rulerFmt", +"", +" send rulerYlab$ruleno set visible False", +"", +" if {[expr \"abs($cy - $rulerY)\"] > 20} {", +" switch $rulerFmt {", +" pixel { set text [format \"%.1f\" [expr \"$dist / $cpYscale\"] ] }", +" arcsec { set text [format \"%.2f\\\"\" [expr \"$dist * 3600.0\"] ] }", +" arcmin { set text [format \"%.2f\\'\" [expr \"$dist * 60.0\"] ] }", +" degrees { set text [format \"%.2fd\" \"$dist\" ] }", +" }", +" set len [expr [string length $text] + 1]", +" send rulerYlab$ruleno \"set width ${len}ch\"", +"", +" # Compute the placement of the label marker.", +" if {$cx > $rulerX} {", +" set xp [expr \"$cx + 2\"]", +" } else {", +" set xp [expr \"$cx - $len * 6 - 5\"]", +" }", +" if {$cy > $rulerY} {", +" set yp [expr \"$rulerY + abs($cy - $rulerY)/2\"]", +" } else {", +" set yp [expr \"$rulerY - abs($cy - $rulerY)/2\"]", +" }", +"", +" # Bounds checking.", +" if {$xp < 0} { set xp 1 }", +" if {$yp < 0} { set yp 1 }", +" if {$xp > $winWidth} { set xp [expr \"$winWidth - 20\" }", +" if {$yp > $winHeight} { set yp [expr \"$winHeight - 20\" }", +"", +" send rulerYlab$ruleno \"setAttributes x $xp y $yp\"", +" send rulerYlab$ruleno \"set text \\{$text\\}; redraw erase\"", +" send rulerYlab$ruleno set visible True", +" } ", +"}", +"", +"proc setHRulerLabel { cx cy dist } \\", +"{", +" global rulerX rulerY ruleno winWidth winHeight", +" global cpYscale cpXscale rulerFmt", +"", +" send rulerHlab$ruleno set visible False", +"", +" set xdist [ expr \"abs($cx - $rulerX)\" ]", +" set ydist [ expr \"abs($cy - $rulerY)\" ]", +" set hdist [ expr \"sqrt($xdist * $xdist + $ydist * $ydist)\" ]", +"", +" if {$hdist > 30} {", +" switch $rulerFmt {", +" pixel { set text [format \"%.1f\" [expr \"$dist / $cpXscale\"] ] }", +" arcsec { set text [format \"%.2f\\\"\" [expr \"$dist * 3600.0\"] ] }", +" arcmin { set text [format \"%.2f\\'\" [expr \"$dist * 60.0\"] ] }", +" degrees { set text [format \"%.2fd\" \"$dist\" ] }", +" }", +" set len [expr [string length $text] + 1]", +" send rulerHlab$ruleno \"set width ${len}ch\"", +"", +" # Compute the placement of the label marker.", +" if {$cx > $rulerX} {", +" set xp [expr \"$rulerX + abs($cx - $rulerX)/2 - $len * 6\"]", +" } else {", +" set xp [expr \"$rulerX - abs($cx - $rulerX)/2 - $len * 3\"]", +" }", +" if {$cy > $rulerY} {", +" set yp [expr \"$rulerY + abs($cy - $rulerY)/2\"]", +" } else {", +" set yp [expr \"$rulerY - abs($cy - $rulerY)/2\"]", +" }", +"", +" # Bounds checking.", +" if {$xp < 0} { set xp 1 }", +" if {$yp < 0} { set yp 1 }", +" if {$xp > $winWidth} { set xp [expr \"$winWidth - 20\" }", +" if {$yp > $winHeight} { set yp [expr \"$winHeight - 20\" }", +"", +" send rulerHlab$ruleno \"setAttributes x $xp y $yp\"", +" send rulerHlab$ruleno \"set text \\{$text\\}; redraw erase\"", +" send rulerHlab$ruleno set visible True", +" } else {", +" send rulerHlab$ruleno set visible False", +" }", +"}", +"", +"", +"# Callback executed when a marker gets or loses the focus.", +"proc selectRuler {active_ruler event event_data} \\", +"{", +" global ruler", +" switch $event {", +" focusIn { set ruler $active_ruler }", +" focusOut { }", +" }", +"}", +"", +"# Reset the ruler format type.", +"proc setUnits { ruler units } \\", +"{", +" global rulerFmt rulerX rulerY", +"", +" send $ruler getVertices pts", +" set rulerX [lindex [lindex [lindex $pts 0] 0] 0]", +" set rulerY [lindex [lindex [lindex $pts 0] 0] 1]", +" set cx [lindex [lindex [lindex $pts 0] 1] 0] ; incr cx -1", +" set cy [lindex [lindex [lindex $pts 0] 2] 1] ; incr cy -1", +"", +" set rulerFmt $units", +" resizeRuler $cx $cy 1", +"}", +"", +"# Menu option toggle callbacks.", +"proc toggleSticky { ruler } \\", +"{", +" global isSticky rulerSticky rulerMenuDescription", +"", +" set index [ lsearch $rulerSticky $ruler]", +" if { $index >= 0 } {", +" # Remove it from the list.", +" set rulerSticky [lreplace $rulerSticky $index $index]", +" set isSticky \"Sticky\"", +" } else {", +" # Add it to the list.", +" lappend rulerSticky $ruler ", +" set isSticky \"UnSticky\"", +" }", +" editMenu rulerMenu imagewin $rulerMenuDescription", +"}", +"", +"proc setRulerMenu args \\", +"{", +" global ruler isSticky rulerSticky rulerMenuDescription", +"", +" if { [lsearch $rulerSticky $ruler] >= 0 } {", +" set isSticky \"UnSticky\"", +" } else {", +" set isSticky \"Sticky\"", +" }", +" editMenu rulerMenu imagewin $rulerMenuDescription", +"}", +"", +"", +"# Draw the ruler to the frame buffer as a graphic.", +"proc writeRuler { ruler } \\", +"{", +"}", +"", +"# Change the color of the ruler.", +"proc r_setColor {ruler bgcolor fgcolor} {", +" ", +" # Recolor the polygon.", +" send $ruler \\", +" \"markpos; set lineColor $bgcolor; set highlightColor $bgcolor; redraw\"", +"", +" # Recolor the labels.", +" scan $ruler \"ruler%d\" num", +" send rulerXlab$num \\", +" \"markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw\"", +" send rulerYlab$num \\", +" \"markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw\"", +" send rulerHlab$num \\", +" \"markpos; set textBgColor $bgcolor; set textColor $fgcolor; redraw\"", +"}", +"", +"", +"# Delete the current ruler, called when we have a Btn1Up on the current ruler.", +"proc deleteRuler {x y} { global ruleno ; deleteNamedRuler $ruleno $x $y }", +"", +"# Delete all rulers on the screen, usually called when the view changes.", +"# We preserve the rulers marked as 'sticky'.", +"proc deleteAllRulers args \\", +"{", +" global rulerList rulerSticky", +"", +" foreach r $rulerList { ", +" # Delete the ruler if it's not in the sticky list.", +" if { [lsearch $rulerSticky ruler$r] == -1 } {", +" deleteNamedRuler $r x y ", +" }", +" }", +"}", +"", +"# Delete a particular ruler, usually called from the translation table on", +"# the marker itself.", +"proc deleteNamedRuler {name x y} \\", +"{", +" global rulerList", +"", +" catch {", +" send ruler$name destroy", +" send rulerXlab$name destroy", +" send rulerYlab$name destroy", +" send rulerHlab$name destroy", +" }", +"", +" # Remove the ruler from the list.", +" set index [lsearch $rulerList $name]", +" set rulerList [lreplace $rulerList $index $index]", +"}", +"", +"", +"", +"", +"", +"###############################################", +"# Define procedure for the help panel", +"###############################################", +"", +"# Help Panel Bitmaps", +"#-------------------", +"createBitmap iraf_logo 45 45 {", +"0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff,", +"0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff,", +"0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff,", +"0xff, 0x3f, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xff, 0xff, 0xff,", +"0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc0, 0xff, 0xff, 0xff,", +"0xff, 0x3f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x80, 0xfc, 0xff, 0xff,", +"0xff, 0x3f, 0x84, 0xf8, 0xff, 0xff, 0xff, 0x1f, 0x84, 0xf4, 0xff, 0xff,", +"0xff, 0x1b, 0x04, 0x09, 0x00, 0xfc, 0xff, 0x11, 0x04, 0x11, 0xf8, 0xff,", +"0x7f, 0x10, 0x04, 0x21, 0xc0, 0xff, 0x1f, 0x10, 0x04, 0x41, 0xf0, 0xff,", +"0x00, 0x18, 0x04, 0x01, 0xe0, 0xff, 0x00, 0x18, 0x00, 0x81, 0xc0, 0xff,", +"0x00, 0x08, 0x00, 0x01, 0xe0, 0xff, 0x07, 0x08, 0x00, 0x01, 0xf1, 0xff,", +"0x1f, 0x08, 0x80, 0x21, 0xf0, 0xff, 0xff, 0x08, 0xc0, 0x41, 0xf4, 0xff,", +"0xff, 0x08, 0xc0, 0x41, 0xf8, 0xff, 0xff, 0x09, 0xc0, 0xc1, 0xf0, 0xff,", +"0xff, 0x0b, 0x80, 0xc1, 0xf1, 0xff, 0xff, 0x07, 0x80, 0x81, 0xe1, 0xff,", +"0xff, 0x07, 0x80, 0x01, 0xc1, 0xff, 0xff, 0x07, 0x00, 0x01, 0xc0, 0xff,", +"0xff, 0x07, 0xc2, 0x05, 0x81, 0xff, 0xff, 0x07, 0xf2, 0x07, 0x81, 0xff,", +"0xff, 0x07, 0xf2, 0x17, 0x03, 0xff, 0xff, 0x03, 0xfa, 0x7f, 0x02, 0xfe,", +"0xff, 0x03, 0xfe, 0xff, 0x02, 0xfe, 0xff, 0x03, 0xfe, 0xff, 0x03, 0xfc,", +"0xff, 0x03, 0xff, 0xff, 0x07, 0xfc, 0xff, 0x83, 0xff, 0xff, 0x0f, 0xf8,", +"0xff, 0xc1, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xe1, 0xff, 0xff, 0x7f, 0xf8,", +"0xff, 0xf1, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xe0,", +"0xff, 0xf8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xe7,", +"0xff, 0xfc, 0xff, 0xff, 0xff, 0xef}; send helpIRAFLogo \"set bitmap iraf_logo\"", +" ", +"createBitmap noao_logo 45 45 {", +"0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +"0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff,", +"0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff,", +"0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff,", +"0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff,", +"0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0xff,", +"0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff,", +"0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,", +"0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff,", +"0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff,", +"0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff,", +"0xff, 0xff, 0x03, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfe, 0xff, 0xff,", +"0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff,", +"0xff, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff,", +"0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff,", +"0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff,", +"0xff, 0x1f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xff,", +"0xff, 0x0f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff,", +"0xff, 0x03, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff,", +"0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff,", +"0xff, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0xff,", +"0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff,", +"0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff}; send helpNOAOLogo \"set bitmap noao_logo\"", +" ", +"send helpInfo1 set label $version", +"", +"# Stuff for keeping track of visited anchors.", +"set links { 0 }", +"set linkIndex 0", +"set visited(0) empty", +"", +"proc Help args \\", +"{", +" global help_up", +" if {$help_up == 0} {", +" send client help", +" } else {", +" send help_panel unmap", +" set help_up 0", +" } ", +"}", +"", +"proc helpPanel args \\", +"{", +" global help_up", +" if {$help_up} {", +" send help_panel unmap", +" set help_up 0", +" } else {", +" send help_panel map", +" set help_up 1", +" }", +"}", +"", +"proc panelHelp args \\", +"{", +" Help", +"} ; send panelHelp addCallback panelHelp", +"", +"proc helpQuit args \\", +"{", +" global help_up", +" send help_panel unmap", +" set help_up 0", +"}; send helpClose addCallback helpQuit", +"", +"proc getHelpText { param old new } \\", +"{", +" send helpText setText $new", +" helpPanel", +"}; send help addCallback getHelpText", +"", +"proc anchorSelected {widget cbtype event text href args} \\", +"{", +" global visited links linkIndex", +" set anchID [send helpText anchorToId $href]", +" set visited($href) 1", +" if {$linkIndex == 0} {", +" send helpBack setSensitive True", +" if {[lindex $links 1] != $anchID} {", +" set links { 0 }", +" send helpForward setSensitive False", +" }", +" }", +" if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} {", +" set links [lrange $links 0 $linkIndex]", +" }", +" if {[lindex $links [expr $linkIndex + 1]] != $anchID} {", +" lappend links $anchID", +" incr linkIndex", +" } else {", +" send helpForward setSensitive False", +" incr linkIndex", +" }", +" if {$linkIndex == [expr [llength $links] - 1]} {", +" send helpForward setSensitive False", +" }", +" send helpText gotoId $anchID", +" send helpText retestAnchors", +"}; send helpText addCallback anchorSelected anchor ", +"", +"proc testAnchor {widget cbtype href} \\", +"{", +" global visited", +" return [info exists visited($href)]", +"}; send helpText addCallback testAnchor testAnchor", +"", +"", +"# Callbacks to position forwards and backwards in link list.", +"proc hlpForward args \\", +"{", +" global links linkIndex", +" incr linkIndex", +" if {$linkIndex <= [llength $links]} {", +" set anchID [lindex $links $linkIndex]", +" send helpText gotoId $anchID", +" send helpText retestAnchors", +" if {$linkIndex == [expr [llength $links] - 1]} {", +" send helpForward setSensitive False", +" send helpBack setSensitive True", +" } else {", +" send helpBack setSensitive True", +" }", +" } else {", +" incr linkIndex -1", +" }", +"}; send helpForward addCallback hlpForward", +" ", +"proc hlpBack args \\", +"{", +" global links linkIndex", +" incr linkIndex -1", +" if {$linkIndex >= 0} {", +" set anchID [lindex $links $linkIndex]", +" send helpText gotoId $anchID", +" send helpText retestAnchors", +" if {$linkIndex == 0} { send helpBack setSensitive False }", +" if {$linkIndex >= 0} { send helpForward setSensitive True }", +" } else {", +" incr linkIndex 1", +" }", +"}; send helpBack addCallback hlpBack", +"", +"proc hlpHome args \\", +"{", +" global links linkIndex", +" set links { 0 }", +" set linkIndex 0", +" send helpText gotoId 0", +" send helpForward setSensitive False", +" send helpBack setSensitive False", +"}; send helpHome addCallback hlpHome", +"", +"", +"proc helpFind args \\", +"{", +" set phrase [send hfEntry get string]", +"", +" if { $phrase != \"\" } {", +" if {[send helpText searchText $phrase start end forward caseless] > 0} {", +" set elid [lindex [lindex $start 0] 0]", +" set id [max 1 [expr $elid - 10] ]", +" send helpText gotoId $id", +" send helpText setSelection $start $end", +" } else {", +" send warnText set label \"Search string not found.\"", +" send warning map", +" }", +" } else {", +" send warnText set label \"Warning: No search phrase entered.\"", +" send warning map", +" }", +"} ; foreach w { hfEntry hfFind } { send $w addCallback helpFind }", +"", +"send hfClear addCallback { send hfEntry set string \"\" }", +"", +"", +"################################################################################", +"# Header Display Callbacks.", +"################################################################################", +"", +"set hdrImage \"\"", +"set hdrImageId \"\"", +"set hdrKeywords \"*\"", +"", +"", +"proc fitsHdrClose args \\", +"{", +" global hdr_up", +"", +" send hdr_panel unmap", +" send imageHeader set on False", +" set hdr_up 0", +"} ; send hdrClose addCallback fitsHdrClose", +"", +"proc ptFitsHeader {widget type state args} \\", +"{", +" global hdr_up", +"", +" set hdr_up $state", +" if {$hdr_up == 1} {", +" send imageHeader set on True", +" send hdr_panel map", +" } else {", +" send imageHeader set on False", +" send hdr_panel unmap", +" }", +"}; send imageHeader addCallback ptFitsHeader", +"", +"proc getHeader { name id } \\", +"{", +" global hdrImage hdrImageId hdrKeywords", +"", +" set hdrImage $name", +" set hdrImageId $id", +" send hdrObjMenu set label $name", +" send hdrText setText \"\"", +" send hdrIGText set string \"\"", +" send hdrKGText set string \"\"", +"", +" catch { send wcspix objinfo $hdrImageId $hdrKeywords }", +"}", +"", +"proc hdrKeywFilter args \\", +"{", +" global hdrImageId hdrKeywords", +"", +" set str [ send hFindEntry get string ]", +" if {$str != \"\"} {", +" set hdrKeywords $str", +" send hdrText setText \"\"", +" catch { send wcspix objinfo $hdrImageId $hdrKeywords }", +" }", +"} ; send hdrFilter addCallback hdrKeywFilter", +"", +"", +"# Set the image menu in the header panel.", +"proc setHdrObjMenu { frame args } \\", +"{", +" global frameCache ism_enable", +"", +" if {! $ism_enable} \\", +" return", +"", +" # Create the menu of images for the header panel.", +" set items { }", +" foreach i [list $frameCache($frame)] {", +" set l [lindex $i 0]", +" set lid [lindex $i 1]", +" regsub -all {[\\[]} $l \"\\\\\\[\" l2", +" catch {", +" lappend items [format \"%s f.exec \\{getHeader %s %d\\}\" $l $l2 $lid]", +" }", +" }", +" editMenu objMenu hdrObjMenu $items", +"}", +"", +"", +"# Search box for the header.", +"proc hdrFind args \\", +"{", +" set phrase [send hFindEntry get string]", +"", +" if { $phrase != \"\" } {", +" if {[send hdrText searchText $phrase start end forward caseless] > 0} {", +" set elid [lindex [lindex $start 0] 0]", +" set id [max 1 [expr $elid - 10] ]", +" send hdrText gotoId $id", +" send hdrText setSelection $start $end", +" } else {", +" send warnText set label \"Search string not found.\"", +" send warning map", +" }", +" } else {", +" send warnText set label \"Warning: No search phrase entered.\"", +" send warning map", +" }", +"} ; foreach w { hFindEntry hdrFind } { send $w addCallback hdrFind }", +"", +"send hdrClear addCallback { send hFindEntry set string \"\" }", +"", +"", +"################################################################################", +"# Pixel Table Callbacks.", +"################################################################################", +"", +"set psize 5", +"set pixtab_up 0", +"set hdr_up 0", +"", +"createMenu pixtabMenu pixtabSize {", +" { \"3x3\" f.exec { pixtabSetSize 3 } }", +" { \"5x5\" f.exec { pixtabSetSize 5 } }", +" { \"7x7\" f.exec { pixtabSetSize 7 } }", +" { \"9x9\" f.exec { pixtabSetSize 9 } }", +"}", +"", +"", +"proc updatePixelTable { cx cy wx wy args } \\", +"{", +" global psize pixtab_up ism_enable", +"", +" if {! $pixtab_up} \\", +" return", +" if {$ism_enable} \\", +" return", +"", +" set delta [expr int($psize / 2) ]", +" set x1 [expr ($wx - $delta) ]", +" set x2 [expr ($wx + $delta) ]", +" set y1 [expr ($wy - $delta) ]", +" set y2 [expr ($wy + $delta) ]", +" set c [ expr int($psize / 2) ]", +"", +"", +" # Update the table labels.", +" set x $x1 ; set xl {}", +" set y $y2 ; set yl {}", +" for {set i 0} {$i < $psize} {incr i} {", +" lappend xl [format \" %10.1f \" $x] ; set x [ expr ($x + 1.) ]", +" lappend yl [format \" %10.1f \" $y] ; set y [ expr ($y - 1.) ]", +" }", +" send ptColLabs setList $xl ; send ptColLabs highlight $c", +" send ptRowLabs setList $yl ; send ptRowLabs highlight $c", +"", +" # Update the pixel table itself.", +" #set pix [ send client getPixels $cx $cy $psize True ]", +"", +" set x0 [ expr int($cx - $psize / 2. + 0.5)]", +" set y0 [ expr int($cy - $psize / 2. + 0.5)]", +" set pix [ send client getPixels $x0 $y0 $psize $psize ]", +" send pixtab setList [ lrange $pix 4 end ]", +" set c [ expr int(($psize * $psize) / 2) ]", +" send pixtab highlight $c", +"", +" # Update the pixtab stats.", +" set sum 0.0", +" set sum2 0.0", +" set npix [ expr ($psize * $psize) ]", +" set nend [ expr ($psize * $psize) + 4 ]", +" for {set i 4} {$i < $nend} {incr i} {", +" set val [lindex $pix $i]", +" catch {", +" set sum [ expr ($sum + $val) ]", +" set sum2 [ expr ($sum2 + $val * $val) ]", +" }", +" }", +"", +" set mean [ expr ($sum / ($npix * 1.0)) ]", +" set var [ expr (($sum2 - $sum * $mean) / ($npix - 1)) ]", +" if {$var <= 0.0} {", +" set stdev 0.0", +" } else {", +" set stdev [ expr sqrt ($var) ]", +" }", +" send meanValue set label [ format \"%10.2f\" $mean ]", +" send sigValue set label [ format \"%10.4f\" $stdev ]", +"}", +"", +"", +"proc pixtabClose args \\", +"{", +" global pixtab_up", +"", +" send pixel_panel unmap", +" send pixelTable set on False", +" set pixtab_up 0", +" catch { send wcspix set psize 0 }", +"} ; send pixtabClose addCallback pixtabClose", +"", +"", +"proc pixtabSetSize { size args } \\", +"{", +" global psize ism_enable", +"", +" set c [ expr int(($psize * $psize) / 2) ]", +" send pixtab highlight $c", +"", +" # Now reset the window size.", +" switch $size {", +" 3 { send pixel_panel \"resize 265 175\"", +" send pixtab \"set width 180 ; set height 60\"", +" }", +" 5 { send pixel_panel \"resize 375 215\"", +" send pixtab \"set width 290 ; set height 105\"", +" }", +" 7 { send pixel_panel \"resize 495 265\"", +" send pixtab \"set width 410 ; set height 150\"", +" }", +" 9 { send pixel_panel \"resize 610 310\"", +" send pixtab \"set width 525 ; set height 195\"", +" }", +" }", +"", +" send pixtab set defaultColumns $size", +" send ptColLabs set defaultColumns $size", +" set psize $size", +"", +" # Notify the ISM we've changed size.", +" if ($ism_enable) {", +" catch { send wcspix set psize $psize }", +" }", +"", +" send imagewin getCursorPos xc yc", +" updatePixelTable $xc $yc $xc $yc", +"", +"} ; pixtabSetSize $psize", +"", +"", +"proc ptPixelTable {widget type state args} \\", +"{", +" global pixtab_up psize", +"", +" set pixtab_up $state", +" if {$pixtab_up == 1} {", +" send pixelTable set on True", +" send pixel_panel map", +" catch { send wcspix set psize $psize }", +" } else {", +" send pixelTable set on False", +" send pixel_panel unmap", +" catch { send wcspix set psize 0 }", +" }", +"}; send pixelTable addCallback ptPixelTable", +"", +"", +"################################################################################", +"# Warning dialog. This pops up a dialog box with the given warning message,", +"# and executes the given command if the user pushes OK.", +"#", +"# Usage: Wexec object message [ok_action [cancel_action]]", +"#", +"# The message text is displayed in a popup and the user hits the ok or", +"# cancel button to close the popup. If an action has been posted for the", +"# button selected then it is sent to the named object. Only one alert can", +"# be in effect at a time; posting another alert before the first has", +"# completed causes the new alert to override the first.", +"################################################################################", +"", +"set W_object \"\"", +"set W_ok_cmd \"\"", +"set W_cancel_cmd \"\"", +"", +"proc Wexec {object msg args} \\", +"{", +" global W_object W_ok_cmd W_cancel_cmd", +" set W_object $object", +" set W_ok_cmd [lindex $args 0]", +" set W_cancel_cmd [lindex $args 1]", +" send warnText set label $msg", +" send warning map", +"}", +"", +"proc Wbutton {widget args} \\", +"{", +" global W_object W_ok_cmd W_cancel_cmd", +" switch $widget {", +" warnOk { if [llength $W_ok_cmd] { send $W_object $W_ok_cmd }", +" }", +" warnCancel { if [llength $W_cancel_cmd] { send $W_object $W_cancel_cmd }", +" }", +" }", +" send warning unmap", +"}", +"send warnOk addCallback Wbutton", +"send warnCancel addCallback Wbutton", +"", +"# The parameter \"alert\" is used to forward alerts from the client.", +"proc setAlert {param old new} \\", +"{", +" Wexec client [lindex $new 0] [lindex $new 1]", +"}; send alert addCallback setAlert", +"", +"", +"", +"################################################", +"# Define some TCL debug procedures.", +"################################################", +"", +"set tcl_up 0", +"", +"proc tclCommandClear {widget args} { send tclEntry set string \"\" }", +"proc tclCommandExecute {widget args} { send server [send tclEntry {get string}]", +"}", +"proc tclCommand {widget mode command args} { send server $command }", +"proc tclClose {widget args} { tclPanel }", +"proc tclOpen args \\", +"{ ", +" global tcl_up", +" send tcl_panel map ", +" set tcl_up 1", +"}", +"", +"proc tclPanel args \\", +"{", +" global tcl_up", +" if {$tcl_up} {", +" send tcl_panel unmap", +" set tcl_up 0", +" } else {", +" send tcl_panel map", +" set tcl_up 1", +" }", +"}", +"", +"send tclClear addCallback tclCommandClear", +"send tclExecute addCallback tclCommandExecute", +"send tclEntry addCallback tclCommand", +"send tclDismiss addCallback tclClose", +"", +"", +"", +"################################################", +"# ISM Module support routines.", +"################################################", +"", +"", +"# Turn the ISM on or off.", +"proc ismToggle { widget type state args } \\", +"{", +" global ism_enable ism_capable psize", +"", +" set ism_enable $state", +"", +" # Set the coord-panel header option availability.", +" if {$ism_enable == 1 && $ism_capable} {", +" send imageHeader setSensitive True", +" send woptBPM setSensitive True", +" catch { send client ism_start wcspix }", +" } else {", +" send imageHeader setSensitive False", +" send woptBPM set on False", +" send woptBPM setSensitive False", +" catch { send client ism_stop wcspix }", +" send hdr_panel unmap", +" }", +" setCoordPanelSensitivity", +"", +"} ; send ismToggle addCallback ismToggle", +"", +"", +"", +"# Handle messages from ISM clients and pass them on to the appropiate", +"# callback.", +"", +"proc ism_msg { param old new } \\", +"{", +" global ism_enable ", +"", +" set cmd [lindex $new 0] ;# command name", +" set ism [lindex $new 1] ;# determine ISM name", +" set argv [lrange $new 2 end] ;# get args", +" set argc [llength $argv]", +"", +" switch $cmd {", +" source { source [lindex $new 1] }", +" alert { Wexec client [lindex $new 1] }", +" deliver { ${ism}_msg $argc $argv }", +" info { ism_info $ism }", +" }", +"} ; send ism_msg addCallback ism_msg", +"", +"", +"", +"# Log a client message to the info panel", +"set ismInfoText \" \" ", +"", +"proc ism_info { text } \\", +"{", +" global infoMode ismInfoText", +"", +" set ismInfoText [format \"%s\\n%s\" $ismInfoText $text]", +" if {$infoMode == \"infoOptIsm\"} {", +" send infoText set string $ismInfoText", +" }", +"}", +"", +"# Initialize the text.", +"proc ismInitInfoText args \\", +"{", +" global ismInfoText", +"", +" set ismInfoText \"\"", +" ism_info \"\\t ISM Client Message Logs\"", +" ism_info \"\\t -----------------------\"", +" ism_info \" \"", +"} ; ismInitInfoText", +"", +"", +"", +"################################################", +"# WPIX module support routines.", +"################################################", +"", +"set cur_objid 0", +"set cur_regid 0", +"set redraw_compass 0", +"#set Compass(0) { 0.0 1 1 0 X Y }", +"set Compass(0) { 0.0 0.0 1.0 -1.0 0.0 0 X Y }", +"set Orient(0) { 1 1 1 }", +"", +"set wcspix_debug 0", +"", +"proc wcspix_msg { argc argv } \\", +"{", +" global wcspix_debug", +"", +" set arg [string trimleft [ string trimright [lindex $argv 0] ] ]", +" set cmd [lindex $arg 0]", +"", +" if {$wcspix_debug} { print \"wcspix_msg: $cmd\" }", +"", +"", +" switch $cmd {", +" startup { wcspix_startup }", +" shutdown { wcspix_shutdown }", +" disable { wcspix_disable }", +" capable { wcspix_capable }", +"", +" cache { wcspix_cache [lrange $arg 1 end] }", +" uncache { wcspix_uncache [lrange $arg 1 end] }", +" wcstran { wcspix_wcstran [lrange $arg 1 end] }", +" wcslist { wcspix_wcslist [lrange $arg 1 end] }", +"", +" imghdr { send hdrText \\", +" setText [format \"<pre>%s\\n%s</pre>\" \\", +" [string trimright [send hdrText getText simple] \"\\n\"]\\", +" [lindex $arg 1] ]", +" }", +" wcshdr { send hdrKGText append [lindex $arg 1] }", +"", +" wcsinfo { send hdrIGText append [lindex $arg 1] ", +" send hdrText gotoId 0", +" send hdrKGText set insertPosition 0", +" }", +"", +" compass { wcspix_compass [lrange $arg 1 end] ; drawCompass }", +" orient { wcspix_orient [lrange $arg 1 end] }", +" wcstype { wcspix_wcstype [lindex $arg 1] [lindex $arg 2] }", +" wcsfmt { set num [lindex $arg 2]", +" send fmtWcs$num set label [lindex $arg 1] }", +"", +" wcspix_cmd { send wcsIsmCmd set string [lindex $arg 1] }", +"", +" pixtab { set tab [lindex [lindex $arg 1] 0]", +" set col [lindex [lindex $arg 1] 1]", +" set row [lindex [lindex $arg 1] 2]", +" set stat [lindex [lindex $arg 1] 3]", +" wcspix_pixtab $tab $col $row $stat", +" }", +" }", +"}", +"", +"", +"# Startup and initialize the wcspix module with the GUI state.", +"proc wcspix_startup args \\", +"{", +" global ism_enable frame", +" global up_todo psize pixtab_up frameCache", +"", +" set ism_enable 1", +" send ismToggle set on True", +" send imageHeader setSensitive True", +" send woptBPM setSensitive True", +" setCoordPanelSensitivity", +" ismInitInfoText", +"", +" if {$up_todo < 3} {", +" resizeCoordsBox $up_todo", +" }", +" updateCoordsBox", +" drawCompass", +"", +" # Initialize the frame cache.", +" foreach c [array names frameCache] {", +" if {$c != \"0\"} { unset frameCache($c) }", +" }", +"", +" catch { ", +" if {$pixtab_up} { send wcspix set psize $psize }", +" for {set i 1} {$i <= 4} {incr i} {", +" send wcspix set wcs [send sysWcs$i get label] $i", +" send wcspix set format [send fmtWcs$i get label] $i", +" }", +" }", +"", +" if { [send infoOptClients get on] } {", +" send client info clients", +" }", +"}", +"", +"# Shutdown the WPIX module.", +"proc wcspix_shutdown args \\", +"{", +" global ism_enable frame", +"", +" set ism_enable 0", +" send ismToggle set on False", +" send imageHeader setSensitive False", +" send woptBPM set on False", +" send woptBPM setSensitive False", +" setCoordPanelSensitivity", +" setCoordPanelHeight", +"", +" wcsFmtIValue \"N/A\"", +" wcsFmtBValue \"0\"", +"", +" resizeCoordsBox 0", +" drawCompass", +"", +" if { [send infoOptClients get on] } {", +" send client info clients", +" }", +"}", +"", +"", +"# Disable the WPIX module. We are only called when a display client has", +"# indicated it doesn't use the new mapping facilities and having the WPIX", +"# ISM visible will only confuse the user.", +"", +"proc wcspix_disable args \\", +"{", +" global ism_enable ism_capable rulerWCS", +"", +" if {$ism_enable} {", +" send wcspix quit", +" }", +" set ism_capable 0", +" set rulerWCS 0", +" wcspix_shutdown", +" send ismToggle setSensitive False", +"}", +"", +"", +"# Client connected is capable of using the ISM, but don't necessarily turn", +"# it on at this point.", +"", +"proc wcspix_capable args \\", +"{", +" global ism_capable", +"", +" set ism_capable 1", +" wcsFmtIValue \"0\"", +" wcsFmtBValue \"0\"", +" send ismToggle setSensitive True", +"}", +"", +"", +"# Cache an image in the GUI.", +"proc wcspix_cache { argv } \\", +"{", +" global frameCache redraw_compass cur_objid", +"", +" set name [lindex $argv 0]", +" set frame [lindex $argv 1]", +" set id [lindex $argv 2]", +"", +" # Store the image name and id in a local cache.", +" lappend frameCache($frame) $name $id", +" send hdrObjMenu set label $name", +"", +" # Automatically get the header.", +" regsub -all {[\\[]} $name \"\\\\\\[\" image", +" catch { getHeader $image $id }", +"", +" setHdrObjMenu $frame", +"", +" set cur_objid $id", +" set redraw_compass 1", +"}", +"", +"# Uncache an image in the GUI.", +"proc wcspix_uncache { argv } \\", +"{", +" global frameCache Compass", +"", +" set id [lindex $argv 0]", +" foreach c [array names frameCache] {", +" set i1 0", +" set i2 1", +" set new { }", +" while { $i2 < [llength $frameCache($c)] } {", +" if {[lindex $frameCache($c) $i2] != $id} { ", +" lappend new [lindex $frameCache($c) $i1]", +" lappend new [lindex $frameCache($c) $i2]", +" }", +" incr i1 2", +" incr i2 2", +" }", +" set frameCache($c) $new", +" }", +" if [info exists Compass($id)] {", +" unset Compass($id)", +" }", +"}", +"", +"# Format the results of the WCSTRAN method.", +"proc wcspix_wcstran { argv } \\", +"{", +" global frameCache cur_objid cur_regid redraw_compass", +"", +" set objid [ lindex [lindex $argv 0] 1]", +" set regid [ lindex [lindex $argv 1] 1]", +" set pixval [ lindex [lindex $argv 2] 1]", +" set bpmval [ lindex [lindex $argv 3] 1]", +"", +" wcsFmtIValue $pixval", +" wcsFmtBValue $bpmval", +"", +" set args [lrange $argv 4 end]", +" set nargs [llength $args]", +" for {set i 0} {$i < 4} {incr i} {", +" set coord [lindex $args $i]", +" set wcsname [lindex $coord 1]", +" set xval [lindex $coord 2]", +" set yval [lindex $coord 3]", +" set xunits [lindex $coord 4]", +" set yunits [lindex $coord 5]", +" wcsFmtWcs [expr ($i + 1)] $wcsname $xval $yval $xunits $yunits", +" }", +"", +" set cur_objid $objid", +" set cur_regid $regid", +"", +" if {$redraw_compass} \\", +" drawCompass", +"}", +"", +"# Save the object compass information.", +"proc wcspix_compass { argv } \\", +"{", +" global Compass", +"", +" set objid [lindex $argv 0]", +" set angle [lindex $argv 1]", +"", +" #set xflip [lindex $argv 2]", +" #set yflip [lindex $argv 3]", +" #set transpose [lindex $argv 4]", +" #set xlab [lindex $argv 5]", +" #set ylab [lindex $argv 6]", +"", +" set north_x [lindex $argv 2]", +" set north_y [lindex $argv 3]", +" set east_x [lindex $argv 4]", +" set east_y [lindex $argv 5]", +" set transpose [lindex $argv 6]", +" set xlab [lindex $argv 7]", +" set ylab [lindex $argv 8]", +"", +" #lappend Compass($objid) $angle $xflip $yflip $transpose $xlab $ylab", +" #set Compass($objid) [list $angle $xflip $yflip $transpose $xlab $ylab]", +" set Compass($objid) [list $angle $north_x $north_y $east_x $east_y \\", +" $transpose $xlab $ylab]", +" drawCompass", +"}", +"", +"# Save the image display orientation information.", +"proc wcspix_orient { argv } \\", +"{", +" global Orient", +"", +" set objid [lindex $argv 0]", +" set frame [lindex $argv 1]", +" set xflip [lindex $argv 2]", +" set yflip [lindex $argv 3]", +"", +" set Orient($objid) [list $frame $xflip $yflip]", +"}", +"", +"", +"# Handle the list of WCSs available for the current image.", +"proc wcspix_wcslist { argv } \\", +"{", +" set wcslist [lindex $argv 0]", +"", +" for {set i 1} {$i <= 4} {incr i} {", +" set items {}", +" foreach nam $wcslist {", +" if {[string tolower $nam] == \"line\"} {", +" lappend items \"f.dblline\"", +" } else {", +" lappend items \"\\\"$nam\\\" f.exec \\{setWcsSys $nam $i\\}\"", +" }", +" }", +" editMenu sysMenu$i sysWcs$i $items", +" }", +"}", +"", +"# Set the type of the WCS.", +"proc wcspix_wcstype { label num } \\", +"{", +" global up_todo", +"", +" send sysWcs$num set label $label", +" if {[string tolower $label] == \"none\"} {", +" send wpWcs$num \"set on False ; setSensitive False\"", +" send wiWcs$num \"set on False ; setSensitive False\"", +" send fmtWcs$num setSensitive False", +" set hght 4", +" } else {", +" send wpWcs$num \"set on True ; setSensitive True\"", +" send wiWcs$num setSensitive True", +" send fmtWcs$num setSensitive True", +" set hght 17", +" }", +" send wtWcs$num set height $hght", +" setCoordPanelHeight", +"", +" #resizeCoordsBox $up_todo", +" updateCoordsBox", +"}", +"", +"# Display the pixel table.", +"proc wcspix_pixtab { tab col row stat } \\", +"{", +" global psize", +"", +" # Update the pixel table.", +" send pixtab setList [lindex $tab 1]", +" send pixtab highlight [expr int(($psize * $psize) / 2)]", +"", +" # Update the table labels.", +" set c [ expr int($psize / 2) ]", +" send ptColLabs setList $col ; send ptColLabs highlight $c", +" send ptRowLabs setList $row ; send ptRowLabs highlight $c", +"", +" # Update the pixtab stats.", +" send meanValue set label [ format \"%10.2f\" [lindex $stat 0] ]", +" send sigValue set label [ format \"%10.4f\" [lindex $stat 1] ]", +"}", +"", +"", +"", +"", +"################################################################################", +"#", +"# XIMTOOL-ALT -- Procedures and declarations for the ALT GUI.", +"#", +"################################################################################", +"", +"# Creat the bitmaps needed for the alternate optional bars.", +"", +"createBitmap tools 16 16 {", +" 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf3, 0xcf, 0xf3, 0xcf, 0xf3, 0xcf,", +" 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1,", +" 0x83, 0xc1, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff};", +"", +"createBitmap control 16 16 {", +" 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xe3, 0xc7, 0xe3, 0xcf, 0x33, 0xcc,", +" 0x33, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x1b, 0xc0, 0x33, 0xcc, 0xf3, 0xcf,", +" 0xe3, 0xc7, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff};", +"", +"createBitmap tile 16 16 {", +" 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1,", +" 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc1, 0x83, 0xc1, 0x83, 0xc1,", +" 0x83, 0xc1, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff};", +"", +"createBitmap compass 16 16 {", +" 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x80, 0x0f, 0xc0, 0x1f, 0x00, 0x07,", +" 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0xfc, 0x07,", +" 0xfc, 0x07, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00}", +"", +"createBitmap plus 11 11 {", +" 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0xfe, 0x03, 0xfe, 0x03,", +" 0xfe, 0x03, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00};", +"", +"createBitmap minus 11 11 {", +" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03,", +" 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};", +"", +"createBitmap disk 16 16 {", +" 0xfe,0x1f,0x11,0x25,0x11,0x45,0x11,0x44,0xf1,0x47,0x01,0x40,0x01,0x40,0xf9,", +" 0x4f,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0x05,0x50,0xff,0x7f,", +" 0x00,0x00};", +"", +"createBitmap printer 32 16 {", +" 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x12, 0x00,", +" 0x00, 0x02, 0x22, 0x00, 0x00, 0x02, 0x3e, 0x00, 0x00, 0x02, 0x20, 0x00,", +" 0x00, 0x02, 0x20, 0x00, 0xe0, 0x03, 0xe0, 0x03, 0x10, 0x03, 0xe0, 0x06,", +" 0x08, 0xff, 0x7f, 0x09, 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f,", +" 0x04, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x08,", +" 0xf8, 0xff, 0xff, 0x0f};", +"", +"", +"send tbBlinkDec \"set bitmap larrow\" ;# Assign the bitmaps to the buttons.", +"send tbBlinkInc \"set bitmap rarrow\"", +"send tbZoomIn \"set bitmap plus\"", +"send tbZoomOut \"set bitmap minus\"", +"send tbTile \"set bitmap tile\"", +"send tbCompass \"set bitmap compass; addCallback toggleCompass\"", +"#send helpButton \"set bitmap qmark; addCallback Help\"", +"send mXflipButton \"set bitmap xflip; addCallback xflip\"", +"send mYflipButton \"set bitmap yflip; addCallback yflip\"", +"send mNextButton \"set bitmap rarrow; addCallback nextFrame\"", +"send mPrevButton \"set bitmap larrow; addCallback prevFrame\"", +"", +"", +"# toolBox -- Toggle the toolbox and panelbar display.", +"", +"set toolbox_up [ true $showToolBar ]", +"set panelbar_up [ true $showPanelBar ]", +"", +"proc toolBoxToggle args \\", +"{", +" global toolbox_up ", +"", +" set w [send display get width] ; set h [send display get height]", +" set iw [send imagewin get width] ; set ih [send imagewin get height]", +"", +" if {$toolbox_up} {", +" send toolbar set height 0", +" send toolButton set state 0", +" send imagewin \"set width $iw; set height $ih\"", +" set nh [expr $h - 25]", +" send display \"set width $w; set height $nh\"", +" set toolbox_up 0", +" send mXflipButton map", +" send mYflipButton map", +" send mPrevButton map", +" send mFrameButton map", +" send mNextButton map", +" } else {", +" send toolbar set height 25", +" send toolButton set state 1", +" send imagewin \"set width $iw; set height $ih\"", +" set nh [expr $h + 25]", +" send display \"set width $w ; set height $nh\"", +" set toolbox_up 1", +" send mXflipButton unmap", +" send mYflipButton unmap", +" send mPrevButton unmap", +" send mFrameButton unmap", +" send mNextButton unmap", +" }", +"}", +"", +"proc panelBarToggle args \\", +"{", +" global panelbar_up", +"", +" set w [send display get width] ; set h [send display get height]", +" set iw [send imagewin get width] ; set ih [send imagewin get height]", +"", +" if {$panelbar_up} {", +" send panelbar set height 0", +" send panelButton set state 0", +" send imagewin \"set width $iw; set height $ih\"", +" set nh [expr $h - 25]", +" send display \"set width $w ; set height $nh\"", +" set panelbar_up 0", +" } else {", +" send panelbar set height 25", +" send panelButton set state 1", +" send imagewin \"set width $iw; set height $ih\"", +" set nh [expr $h + 25]", +" send display \"set width $w ; set height $nh\"", +" set panelbar_up 1", +" }", +"}", +"", +"", +"", +"# Initialize the bars to be displayed if the resource was set.", +"", +"send toolButton \"set bitmap tools; addCallback toolBoxToggle\"", +"if { ! [ true $showToolBar ] } {", +" send display set height [expr [send display get height] - 25]", +" send toolbar set height 0", +" send toolButton set state 0", +"} else {", +" send toolButton set state 1", +" send mXflipButton unmap", +" send mYflipButton unmap", +" send mPrevButton unmap", +" send mFrameButton unmap", +" send mNextButton unmap", +"}", +"", +"send panelButton \"deleteCallback panel\"", +"send panelButton \"set bitmap control; addCallback panelBarToggle\"", +"", +"if { ! [ true $showPanelBar ] } {", +" send display set height [expr [send display get height] - 25]", +" send panelbar set height 0", +" send panelButton set state 0", +"} else {", +" send panelButton set state 1", +"}", +"", +"", +"##############################################", +"# Panelbar callbacks.", +"##############################################", +"", +"send pbQuit addCallback Quit", +"send helpClose addCallback \"send helpButton set state 0\"", +"", +"", +"# Control Panel.", +"#------------------------------------------------------", +"proc pbToggleControl {name element op} \\", +"{", +" upvar $name panel_up", +" send pbDisplayP set state [expr !($panel_up)]", +"} ; #trace variable panel_up w pbToggleControl", +"", +"proc pbResetPanel {param old new} \\", +"{", +" global displayPanner displayMagnifier displayCoords", +" switch $new {", +" done { send pbPanM set state [true $displayPanner]", +" send pbMagM set state [true $displayMagnifier]", +" send pbWcsM set state [true $displayCoords]", +" }", +" }", +"} ; send initialize addCallback pbResetPanel", +"", +"set WidgetToTab(pbDisplayP) display_panel", +"set WidgetToTab(pbInfoP) info_panel", +"set WidgetToTab(pbLoadP) load_panel", +"set WidgetToTab(pbPrintP) print_panel", +"set WidgetToTab(pbSaveP) save_panel", +"set WidgetToTab(pbTileP) tile_panel", +"set WidgetToTab(pbCoordP) wcs_panel", +"", +"set TabToWidget(display_panel) pbDisplayP", +"set TabToWidget(print_panel) pbPrintP", +"set TabToWidget(load_panel) pbLoadP", +"set TabToWidget(save_panel) pbSaveP", +"set TabToWidget(info_panel) pbInfoP", +"set TabToWidget(tile_panel) pbTileP", +"set TabToWidget(wcs_panel) pbCoordP", +"", +"set pbTabTop \"pbDisplayP\"", +"", +"proc pbPanelDismiss args \\", +"{", +" global tabTop TabToWidget WidgetToTab", +" set panel $TabToWidget($tabTop)", +" send $panel set state 0", +"} ; send panelClose addCallback pbPanelDismiss", +"", +"proc pbResizeCB {widget event a b c d e args} \\", +"{", +" global pbTabTop TabToWidget WidgetToTab", +" if { $a == 0 && $b == 0 && $c == 0 && $d == 0 && $e == 0 } {", +" send $pbTabTop set state 0", +" set new $TabToWidget($widget)", +" send $new set state 1", +" set pbTabTop $new", +" }", +"} ; foreach w $cpTabs {send $w addEventHandler pbResizeCB exposureMask}", +"", +"proc pbPanelTabs { widget type state args } \\", +"{", +" global pbTabTop tabTop panel_up", +" global TabToWidget WidgetToTab", +"", +" set panel $WidgetToTab($widget)", +" if {$tabTop == $panel && $panel_up} {", +" send panelShell unmap", +" send $widget set state 0", +" set panel_up 0", +" return", +" }", +"", +" send $TabToWidget($tabTop) set state 0", +" set tabTop $panel", +" set pbTabTop $TabToWidget($panel)", +" send panelTabs setTop $panel", +"", +" # Now fire it up if it's not already open.", +" if {$panel_up == 0} {", +" send $widget set state 1", +" send panelShell map", +" set panel_up 1", +" }", +"}", +"foreach w { pbDisplayP pbInfoP pbLoadP pbPrintP pbSaveP pbTileP pbCoordP } {", +" send $w addCallback pbPanelTabs", +"}", +"", +"", +"", +"# Load Panel. (Really need to clean this up.)", +"#------------------------------------------------------", +"proc pbDoLoadOptions { param old new } \\", +"{", +" set val [ join [lrange $new 1 end] \" \" ]", +" switch [lindex $new 0] {", +" newfile { send fnameText set string $val }", +" }", +"} ; send loadOptions addCallback pbDoLoadOptions", +"", +"proc pbFileLoad { widget mode fname args } \\", +"{", +" set fpath [format \"%s/%s\" \\", +" [string range [send dirLabel get label] 12 end] $fname ]", +" send imagewin setCursorType idle", +"} ; send fnameText addCallback pbFileLoad", +"", +"proc pbflSelectPrint {widget cbtype selections args} \\", +"{", +" foreach selection $selections {", +" ;", +" }", +"}; #send imageList addCallback pbflSelectPrint", +"", +"proc pbFileLoadB args \\", +"{", +" set fname [send fnameText get string]", +" if {$fname != \"\"} {", +" set fpath [format \"%s/%s\" \\", +" [string range [send dirLabel get label] 12 end] $fname ]", +" }", +"} ; send filesLoadButton addCallback pbFileLoadB", +"", +"", +"# Panner Marker.", +"#------------------------------------------------------", +"proc pbTracePanner {name element op} \\", +"{", +" global last_compass", +"", +" catch {", +" upvar $name panner_enable", +" send pbPanM set state $panner_enable", +"", +" if { $panner_enable } {", +" send tbCompass \"setSensitive True ; set state $last_compass\"", +" drawCompass", +" } else {", +" send tbCompass \"setSensitive False ; set state False\"", +" eraseCompass", +" }", +" }", +"} ; trace variable panner_enable w pbTracePanner", +"", +"proc pannerPanel args \\", +"{", +" global panner_enable displayPanner", +"", +" setPanner [expr !$panner_enable]", +" send pannerButton set on [expr $panner_enable]", +"}; send pbPanM addCallback pannerPanel", +"", +"", +"# Magnifier Marker.", +"#------------------------------------------------------", +"proc pbTraceMagnifier {name element op} \\", +"{", +" upvar $name magnifier_enable", +" send pbMagM set state $magnifier_enable", +"} ; trace variable magnifier_enable w pbTraceMagnifier", +"", +"proc magnifierPanel args \\", +"{", +" global magnifier_enable displayMagnifier", +" setMagnifier [expr !$magnifier_enable]", +" send magnifierButton set on [expr $magnifier_enable]", +"}; send pbMagM addCallback magnifierPanel", +"", +"", +"# CoordsBox Marker.", +"#------------------------------------------------------", +"proc pbTraceCoordsBox {name element op} \\", +"{", +" upvar $name track_enable", +" send pbWcsM set state $track_enable", +"} ; trace variable track_enable w pbTraceCoordsBox", +"", +"proc wcsPanel args \\", +"{", +" global track_enable", +" setTrack [expr !$track_enable]", +"}; send pbWcsM addCallback wcsPanel", +"", +"", +"", +"# WPIX ISM Callbacks.", +"#------------------------------------------------------", +"", +"proc altIsmToggle { widget type state args } \\", +"{", +" ismToggle pbIsm junk $state", +"} ; send pbIsm addCallback altIsmToggle", +"", +"proc pbTraceIsm {name element op} \\", +"{", +" upvar $name ism_enable", +" send pbIsm set state $ism_enable", +"} ; trace variable ism_enable w pbTraceIsm", +"", +"", +"proc altIsmMsgCB { param old new } \\", +"{", +" set cmd [lindex $new 0] ;# command name", +" set ism [lindex $new 1] ;# determine ISM name", +" set argv [lrange $new 2 end] ;# get args", +" set argc [llength $argv]", +"", +" switch $cmd {", +" deliver { ${ism}_alt_msg $argc $argv }", +" }", +"} ; send ism_msg addCallback altIsmMsgCB", +"", +"", +"proc wcspix_alt_msg { argc argv } \\", +"{", +" set arg [string trimleft [ string trimright [lindex $argv 0] ] ]", +" set cmd [lindex $arg 0]", +" switch $cmd {", +" startup { }", +" shutdown { }", +" disable { send pbIsm \"set state False ; setSensitive False\" }", +" capable { send pbIsm \"setSensitive True\" }", +" }", +"}", +"", +"", +"", +"##############################################", +"# Toolbar callbacks.", +"##############################################", +"", +"send tbNormalize addCallback normalize", +"send tbInvert addCallback cpInvert", +"send tbRegister addCallback cpRegisterFrames", +"send tbMatchLUT addCallback cpMatchFrames", +"", +"", +"# Frame Selection.", +"#------------------", +"createMenu mFrameMenu mFrameButton $frameMenuDescription", +"", +"proc altFrameChanged {param old new} \\", +"{", +" send mFrameButton set label $new", +"} ; send frame addCallback altFrameChanged", +"", +"", +"# Image Flipping.", +"#------------------------------------------------------", +"proc tbSetFlip {param old new} \\", +"{", +" if {$param == \"xflip\"} {", +" send mXflipButton set state [true $new]", +" } else {", +" send mYflipButton set state [true $new]", +" }", +"}; foreach i {xflip yflip} { send $i addCallback tbSetFlip }", +"", +"", +"# Zoom/Pan buttons.", +"#------------------------------------------------------", +"proc tbZoomAction { widget args } \\", +"{", +" global frameWidth frameHeight", +"", +" switch $widget {", +" tbZoom0 { cpZoom 1 1 fixed }", +" tbZoomIn { cpZoom 2.0 2.0 relative }", +" tbZoomOut { cpZoom 0.5 0.5 relative }", +" tbCenter { send client pan [expr $frameWidth/2.0] [expr $frameHeight/2.0] }", +" }", +"}", +"foreach widget { tbCenter tbZoomIn tbZoom0 tbZoomOut } {", +" send $widget addCallback tbZoomAction", +"}", +"", +"", +"# Frame Blink.", +"#------------------------------------------------------", +"proc tbSetBlinkRate {w args} \\", +"{", +" if {$w == \"tbBlinkInc\"} {", +" cpSetBlinkRate BRincrease", +" } else {", +" cpSetBlinkRate BRdeccrease", +" }", +"}", +"foreach w {tbBlinkDec tbBlinkInc} { send $w addCallback tbSetBlinkRate }", +"", +"proc tbBlink { widget args } \\", +"{", +" global blinkRate blinkId", +"", +" if {$blinkRate < 0.01} {", +" send tbBlink set state 0", +" } else {", +" if {$widget != \"tbBlink\"} {", +" if {($blinkId != 0) != [send $widget get on]} {", +" toggleBlink", +" }", +" } else {", +" if {($blinkId != 0) != [send $widget get state]} {", +" toggleBlink", +" }", +" }", +" }", +"} ; send tbBlink addCallback tbBlink", +"", +"proc tbTraceBlink {name element op} \\", +"{", +" upvar $name blinkId", +" send tbBlink set state [expr $blinkId != 0]", +"} ; trace variable blinkId w tbTraceBlink", +"", +"", +"# Auto-register.", +"#------------------------------------------------------", +"proc tbAutoRegister { widget type state args } \\", +"{", +" send tbAutoReg set state $state", +"}", +"foreach w {autoregButton brAregButton tbAutoReg} {", +" send $w addCallback cpAutoRegister", +"}", +"", +"proc tbToggleAutoReg args \\", +"{", +" global auto_reg", +" if {$auto_reg} {", +" cpAutoRegister autoregButton dummy 0", +" set auto_reg 0", +" send tbAutoReg set state 0", +" } else {", +" cpAutoRegister autoregButton dummy 1", +" set auto_reg 1", +" send tbAutoReg set state 1", +" }", +"}", +"", +"", +"# Frame Tiles.", +"#------------------------------------------------------", +"proc tbSetTileFrames args \\", +"{", +" global tileOpt", +"", +" # Send the option to the client.", +" if {[send tbTile get state ]} {", +" if {$tileOpt == 0} {", +" # If mode is disabled, turn on the tile selection.", +" selectTileOrientation junk junk Best", +" } else {", +" # Otherwise, turn on in current mode.", +" selectTileOrientation junk junk [tileSelToLabel $tileOpt]", +" }", +" } else {", +" selectTileOrientation junk junk Disabled", +" }", +"}; send tbTile addCallback tbSetTileFrames", +"", +"proc tbTrackTileFrames {param old new} \\", +"{", +" send tileFramesButton set on [true $new]", +" send tbTile set state $new", +"}; send tileFrames addCallback tbTrackTileFrames", +"", +"proc tbTileFramesToggle args \\", +"{", +" set value [send tileFramesButton get on]", +" if {$value} { set not 0 } else { set not 1 }", +"", +" send tileFramesButton set on $not", +" send tbTile set state $not", +" cpSetTileFrames tbTile junk $not", +"}", +"", +"", +"# Compass Indicator.", +"#------------------------------------------------------", +"proc tbToggleCompass { widget type state args } \\", +"{", +" global frame", +"", +" if {$state} {", +" send compass set on True", +" send tbCompass set state 1", +" drawCompass", +" } else {", +" send compass set on False", +" send tbCompass set state 0", +" eraseCompass", +" }", +"} ; foreach w {compass tbCompass} { send $w addCallback tbToggleCompass }", +"", +"", diff --git a/vendor/x11iraf/ximtool/ximtool.h b/vendor/x11iraf/ximtool/ximtool.h new file mode 100644 index 00000000..4d55f0ed --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.h @@ -0,0 +1,733 @@ +/* + * XIMTOOL.H -- Global definitions for XImtool. + */ + +#include "eps.h" + +/* Default values, size limiting values. + */ +#define MAX_FBCONFIG 128 /* max possible frame buf sizes */ +#define MAX_FRAMES 16 /* max number of frames */ +#define MAX_MAPPINGS 100 /* max number of mappings/frame */ +#define MAX_CLIENTS 32 /* max display server clients */ +#define MAX_ISM 8 /* max ISM module clients */ +#define MAX_COLORMAPS 256 /* max number of colormaps */ +#define MAX_COLORS 256 /* max size colormap */ +#define MAX_PRINTERS 128 /* max number of printers */ +#define FIRST_COLOR 10 /* first allocatable color */ +#define DEF_NCOLORS 201 /* default number of colors */ +#define DEF_COLORMAP 1 /* default colormap */ +#define DEF_NFRAMES 1 /* save memory; only one frame */ +#define DEF_FRAME_WIDTH 512 /* 512 square frame */ +#define DEF_FRAME_HEIGHT 512 /* 512 square frame */ +#define DEF_FRAME_DEPTH 8 /* 8 bits deep */ +#define DEF_WIN_WIDTH 512 /* default size window */ +#define DEF_WIN_HEIGHT 512 /* default size window */ +#define DEF_TILE_BORDER 3 /* border width for tileFrames */ +#define DEF_BORDER_COLOR "9" /* border highlight color */ +#define SZ_CMAPNAME 32 /* colormap name buffer */ +#define SZ_NAME 80 /* object name buffer */ +#define SZ_LABEL 256 /* main frame label string */ +#define SZ_IMTITLE 128 /* image title string */ +#define SZ_WCTEXT 80 /* WCS box text */ +#define SZ_OLD_WCSBUF 320 /* old WCS text buffer size */ +#define SZ_WCSBUF 1024 /* WCS text buffer size */ +#define SZ_MSGBUF 8192 /* message buffer size */ +#define SZ_COLORBAR 11 /* height of colorbar in pixels */ +#define SZ_FIFOBUF 4000 /* transfer size for FIFO i/o */ + +#define SZ_FNAME 256 +#define SZ_LINE 256 +#define ERR (-1) +#define OK 0 +#define EOS '\0' + +#define M_UNITARY 0 /* xim_setmapping */ +#define M_ASPECT 1 +#define M_FILL 2 + +/* Magic numbers. */ +#define DEF_PORT 5137 /* default tcp/ip socket */ +#define DEF_NPORTS 1 /* no. of inet ports to open */ +#define I_DEVNAME "/dev/imt1o" /* pseudo device names */ +#define O_DEVNAME "/dev/imt1i" /* our IN is client's OUT */ +#define DEF_UNIXADDR "/tmp/.IMT%d" /* default unix socket */ +#define DEF_ANTIALIASTYPE "boxcar" /* default antialiasing */ +#define FBCONFIG_1 ".imtoolrc" +#define FBCONFIG_2 "/usr/local/lib/imtoolrc" +#define CMAPCONFIG "/usr/local/lib/imtoolcmap" +#define FBCONFIG_ENV1 "imtoolrc" +#define FBCONFIG_ENV2 "IMTOOLRC" +#define PRINTCONFIG "/usr/local/lib/ximprint.cfg" + +#define DEF_ISM_ADDR "/tmp/.ISM%d" /* default ISM unix socket */ +#define DEF_ISM_TEMPLATE "/tmp/.ISM%d_%d" /* ISM client socket template */ +#define DEF_ISM_TASK "wcspix" +#define DEF_ISM_CMD "/usr/local/bin/ism_wcspix.e wcspix &" +#define DEF_ISM_CMD "ism_wcspix.e wcspix &" +#define SZ_ISMBUF 4096 + +/* WCS definitions. */ +#define W_UNITARY 0 +#define W_LINEAR 1 +#define W_LOG 2 +#define W_USER 3 +#define W_DEFFORMAT " %7.2f %7.2f %7.1f%c" + +/* Rotation matrix defining world coordinate system (WCS) of a frame. */ +typedef struct { + int valid; /* has WCS been set? */ + float a, b; /* x, y scale factors */ + float c, d; /* x, y cross factors */ + float tx, ty; /* x, y translation */ + float z1, z2; /* greyscale range */ + int zt; /* greyscale mapping */ + char format[32]; /* wcs output format */ + char imtitle[SZ_IMTITLE+1]; /* image title from WCS */ +} Ctran, *CtranPtr; + +/* Coordinate mappings on each frame buffer. */ +typedef struct { + int id; /* object id */ + Ctran ctran; /* world coordinate system */ + char ref[SZ_FNAME+1]; /* image reference from WCS */ + int regid; /* region id */ + char region[SZ_FNAME+1]; /* region name from WCS */ + float sx, sy; /* source rect */ + int snx, sny; + int dx, dy; /* destination rect */ + int dnx, dny; +} Mapping, *MappingPtr; + +/* The frame buffers. */ +typedef struct { + int frameno; /* frame number */ + int raster; /* frame buffer raster */ + int zoomras; /* zoom/pan raster */ + int zoommap; /* zoom/pan mapping */ + int dispmap; /* mapping used for display */ + int colormap; /* greyscale transformation */ + float offset, scale; /* transfer function */ + float xscale, yscale; /* scaling at [xy]mag==1.0 */ + float xmag, ymag; /* zoom/dezoom factors */ + float xcen, ycen; /* center of zoomed region */ + float xoff, yoff; /* offset of zoomed region */ + int xflip, yflip; /* flip in X or Y? */ + char label[SZ_LABEL+1]; /* frame label string */ + Ctran ctran; /* world coordinate system */ + char wcsbuf[SZ_WCSBUF]; /* wcs info string */ + Mapping mapping[MAX_MAPPINGS]; /* coordinate mappings */ + int nmaps; /* number of defined mappings */ +} FrameBuf, *FrameBufPtr; + +/* Possible frame buffer sizes. */ +typedef struct { + int nframes; /* number of frames */ + int width; /* frame buffer width */ + int height; /* frame buffer height */ +} FbConfig, *FbConfigPtr; + + +/* Predefined colormaps. */ +typedef struct { + int mapno; /* widget colormap number */ + char name[SZ_CMAPNAME+1]; /* colormap name */ +} ColorMap, *ColorMapPtr; + +/* Predefined lookup tables. */ +typedef struct { + float red, green, blue; +} Triplet, *TripletPtr; + +typedef struct { + int lutlen; + Triplet hue[MAX_COLORS]; +} Lut, *LutPtr; + + +/* Client IIS I/O channel. */ +typedef struct { + XtPointer xim; /* backpointer to xim descriptor */ + XtPointer id; /* input callback id */ + int type; /* channel type */ + int datain; /* input channel */ + int dataout; /* output channel */ + int keepalive; /* used to keep input fifo ready */ + char path[SZ_FNAME+1]; /* for unix sockets */ + int reference_frame; /* reference (cmd i/o) frame */ + int version; /* flags capability of client */ + FrameBufPtr rf_p; /* reference frame descriptor */ +} IoChan, *IoChanPtr; + +#define IO_FIFO 1 +#define IO_INET 2 +#define IO_UNIX 3 + + +/* Client ISM I/O channel. */ +typedef struct { + XtPointer xim; /* backpointer to xim descriptor */ + XtPointer id; /* input callback id */ + int datain; /* input channel */ + int dataout; /* output channel */ + int connected; /* client connected? */ + char name[SZ_FNAME+1]; /* client name */ + char path[SZ_FNAME+1]; /* for unix sockets */ + char msgbuf[SZ_ISMBUF+1]; /* incomplete message buffer */ +} IsmIoChan, *IsmIoChanPtr; + + +/* Definitions for the supported ISM Modules. */ +typedef void (*IsmFunc)(); + +typedef struct { + char name[SZ_FNAME]; /* name of the module */ + char command[SZ_LINE]; /* cmd to execute for module */ + IsmFunc startupCB; /* connection callback func */ + IsmFunc shutdownCB; /* shutdown callback func */ + IsmFunc commandCB; /* client command callback func */ + int connected; /* client is connected */ + int ref_count; /* reference count */ + IsmIoChanPtr chan; /* i/o channel */ +} ismModule, *IsmModule; + + +/* Printer list. */ +typedef struct { + char printerName[SZ_FNAME+1]; /* printer name */ + char printCmd[SZ_FNAME+1]; /* printer dispose command */ +} Printer, *PrinterPtr; + + +/* Printer configuration struct. */ +typedef struct { + int printno; /* printer number */ + int seqno; /* sequence number */ + int diskfile; /* print to diskfile? */ + char printFile[SZ_FNAME+1]; /* disk filename template */ + char printCmd[SZ_FNAME+1]; /* dispose command */ +} PrintCfg, *PrintCfgPtr; + +/* File save definitions and structure. */ +typedef struct { + int seqno; /* sequence number */ + int format; /* save format */ + int colorType; /* save color type */ + int w, h, d; /* dimensions of last file saved */ + char fname[SZ_FNAME+1]; /* save filename */ +} fileSave, *fileSavePtr; + +#define XIM_GRAYSCALE 0 /* save color options */ +#define XIM_PSEUDOCOLOR 1 +#define XIM_RGB 2 + +#define XIM_RAS 0 /* save format options */ +#define XIM_GIF 1 +#define XIM_TIFF 2 +#define XIM_JPEG 3 +#define XIM_X11 4 +#define XIM_FITS 5 +#define XIM_RAW 6 +#define XIM_EPS 7 +#define XIM_OIF 8 + + +/* File load struct. */ +typedef struct { + int nfiles; /* number of files in directory */ + char **FileList; /* list of directory contents */ + char curdir[SZ_FNAME+1]; /* current directory */ + char homedir[SZ_FNAME+1]; /* home directory */ + char pattern[SZ_NAME+1]; /* file pattern to match */ + int gray; /* load as a grayscale image? */ + int zscale; /* zscale the image */ + int zrange; /* use full data range */ + float z1, z2; /* user-supplied zrange limits */ + int nsample; /* number of zscale sample pts */ +} fileLoad, *fileLoadPtr; + +/* + * Application resources and runtime descriptor. + * ---------------------------------------------- + */ +typedef struct { + /* Resources. */ + Boolean autoscale; /* is XY autoscaling enabled */ + Boolean antialias; /* apply antialiasing when dezooming */ + Boolean tileFrames; /* tile rather than overlay frames */ + Boolean highlightFrames; /* highlight tiled frames */ + Boolean invert; /* use inverted colormap */ + int def_config; /* default FB config */ + int def_nframes; /* default number of frames */ + int ncolors; /* number of image pixel colors */ + int tileBorder; /* image border when tiling frames */ + int cm_focus; /* colormap update screen size */ + String borderColor; /* border color for tileFrames */ + String gui; /* GUI file name */ + String imtoolrc; /* imtoolrc file name */ + String memModel; /* FB memory model */ + String userCMap1; /* user colormap file */ + String userCMap2; /* user colormap file */ + String userCMapDir1; /* user colormap directory */ + String userCMapDir2; /* user colormap directory */ + String antialiasType; /* type of antialiasing */ + String printConfig; /* printer configuration file */ + String input_fifo; /* client's output, e.g. /dev/imt1o */ + String output_fifo; /* client's input, e.g. /dev/imt1i */ + String unixaddr; /* format for unix socket path */ + String ism_addr; /* format for ISM unix socket path */ + String ism_task; /* image support module taskname */ + int port; /* port for INET socket */ + int nports; /* no. of INET ports to open */ + + /* Internal state. */ + XtPointer obm; /* object manager */ + IoChanPtr cursor_chan; /* cursor mode channel */ + IoChan chan[MAX_CLIENTS]; /* client i/o descriptors */ + IsmIoChan ism_chan; /* image support module channel */ + IsmIoChan ism_client[MAX_ISM]; /* ISM client i/o descriptors */ + Widget toplevel; /* dummy toplevel app shell */ + Widget gt; /* imagewin gterm-image widget */ + Widget cb; /* colorbar gterm-image widget */ + XtPointer gm_border; /* border marker for tileFrames */ + int tileFramesList; /* frames to be tiled (bitmask) */ + int nTileFrames; /* number of frames to be tiled */ + int tileRows; /* number of tile rows */ + int tileCols; /* number of tile cols */ + Boolean tileByRows; /* fill tiles by row vs cols */ + Boolean tileTopDown; /* fill tiles by top to bottom */ + Boolean tileLabels; /* label frame tiles */ + int rop; /* rasterop for mappings */ + int display_frame; /* currently displayed frame */ + FrameBufPtr df_p; /* display frame descriptor */ + FrameBuf frames[MAX_FRAMES]; /* array of frame descriptors */ + int fb_configno; /* current config number */ + int nframes; /* current number of frame bufs */ + int width, height; /* current width, height */ + FbConfig fb_config[MAX_FBCONFIG]; /* fb config table */ + int *clientPrivate; /* used by imtool client code */ + + PSImagePtr psim; /* EPS image struct pointer */ + PrintCfgPtr pcp; /* printer config pointer */ + fileLoadPtr flp; /* load disk file pointer */ + fileSavePtr fsp; /* save disk file pointer */ + +} XimData, *XimDataPtr; + + + +#ifdef XIMTOOL_MAIN +XimData ximtool_data; + +#define XtNdefConfig "defConfig" +#define XtCDefConfig "DefConfig" +#define XtNdefNFrames "defNFrames" +#define XtCDefNFrames "DefNFrames" +#define XtNncolors "ncolors" +#define XtCNcolors "Ncolors" +#define XtNtileBorderWidth "tileBorderWidth" +#define XtCTileBorderWidth "TileBorderWidth" +#define XtNtileBorderColor "tileBorderColor" +#define XtCTileBorderColor "TileBorderColor" +#define XtNautoscale "autoscale" +#define XtCAutoscale "Autoscale" +#define XtNantialias "antialias" +#define XtCAntialias "Antialias" +#define XtNantialiasType "antialiasType" +#define XtCAntialiasType "AntialiasType" +#define XtNinvert "invert" +#define XtCInvert "Invert" +#define XtNtileFrames "tileFrames" +#define XtCTileFrames "TileFrames" +#define XtNhighlightFrames "highlightFrames" +#define XtCHighlightFrames "HighlightFrames" +#define XtNgui "gui" +#define XtCGui "Gui" +#define XtNimtoolrc "imtoolrc" +#define XtCImtoolrc "Imtoolrc" +#define XtNmemModel "memModel" +#define XtCMemModel "MemModel" +#define XtNuserCMap1 "cmap1" +#define XtNuserCMap2 "cmap2" +#define XtNcmFocus "cmFocus" +#define XtCCmFocus "cmFocus" +#define XtCUserCMap "UserCMap" +#define XtNuserCMapDir1 "cmapDir1" +#define XtNuserCMapDir2 "cmapDir2" +#define XtCUserCMapDir "UserCMapDir" +#define XtNprintConfig "printConfig" +#define XtCprintConfig "printConfig" +#define XtNinput_fifo "input_fifo" +#define XtCInput_fifo "Input_fifo" +#define XtNoutput_fifo "output_fifo" +#define XtCOutput_fifo "Output_fifo" +#define XtNunixaddr "unixaddr" +#define XtCUnixaddr "Unixaddr" +#define XtNism_addr "ism_addr" +#define XtCIsm_addr "Ism_addr" +#define XtNport "port" +#define XtCPort "Port" +#define XtNnports "nports" +#define XtCNPorts "NPorts" +#define XtNism_task "ism_task" +#define XtCIsm_task "Ism_task" + +static XtResource resources[] = { + { + XtNdefConfig, + XtCDefConfig, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, def_config), + XtRImmediate, + (caddr_t)1 + }, + { + XtNdefNFrames, + XtCDefNFrames, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, def_nframes), + XtRImmediate, + (caddr_t)0 + }, + { + XtNncolors, + XtCNcolors, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, ncolors), + XtRImmediate, + (caddr_t)DEF_NCOLORS + }, + { + XtNtileBorderWidth, + XtCTileBorderWidth, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, tileBorder), + XtRImmediate, + (caddr_t)DEF_TILE_BORDER + }, + { + XtNtileBorderColor, + XtCTileBorderColor, + XtRString, + sizeof(String), + XtOffsetOf(XimData, borderColor), + XtRImmediate, + (caddr_t)DEF_BORDER_COLOR + }, + { + XtNautoscale, + XtCAutoscale, + XtRBoolean, + sizeof(Boolean), + XtOffsetOf(XimData, autoscale), + XtRImmediate, + (caddr_t)FALSE + }, + { + XtNantialias, + XtCAntialias, + XtRBoolean, + sizeof(Boolean), + XtOffsetOf(XimData, antialias), + XtRImmediate, + (caddr_t)FALSE + }, + { + XtNantialiasType, + XtCAntialiasType, + XtRString, + sizeof(String), + XtOffsetOf(XimData, antialiasType), + XtRImmediate, + (caddr_t)DEF_ANTIALIASTYPE + }, + { + XtNinvert, + XtCInvert, + XtRBoolean, + sizeof(Boolean), + XtOffsetOf(XimData, invert), + XtRImmediate, + (caddr_t)FALSE + }, + { + XtNtileFrames, + XtCTileFrames, + XtRBoolean, + sizeof(Boolean), + XtOffsetOf(XimData, tileFrames), + XtRImmediate, + (caddr_t)FALSE + }, + { + XtNhighlightFrames, + XtCHighlightFrames, + XtRBoolean, + sizeof(Boolean), + XtOffsetOf(XimData, highlightFrames), + XtRImmediate, + (caddr_t)TRUE + }, + { + XtNcmFocus, + XtCCmFocus, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, cm_focus), + XtRImmediate, + (caddr_t)512 + }, + { + XtNgui, + XtCGui, + XtRString, + sizeof(String), + XtOffsetOf(XimData, gui), + XtRImmediate, + (caddr_t)"default" + }, + { + XtNimtoolrc, + XtCImtoolrc, + XtRString, + sizeof(String), + XtOffsetOf(XimData, imtoolrc), + XtRImmediate, + (caddr_t)FBCONFIG_2 + }, + { + XtNmemModel, + XtCMemModel, + XtRString, + sizeof(String), + XtOffsetOf(XimData, memModel), + XtRImmediate, + (caddr_t)"fast" + }, + { + XtNuserCMap1, + XtCUserCMap, + XtRString, + sizeof(String), + XtOffsetOf(XimData, userCMap1), + XtRImmediate, + (caddr_t)"none" + }, + { + XtNuserCMap2, + XtCUserCMap, + XtRString, + sizeof(String), + XtOffsetOf(XimData, userCMap2), + XtRImmediate, + (caddr_t)"none" + }, + { + XtNuserCMapDir1, + XtCUserCMapDir, + XtRString, + sizeof(String), + XtOffsetOf(XimData, userCMapDir1), + XtRImmediate, + (caddr_t)"none" + }, + { + XtNuserCMapDir2, + XtCUserCMapDir, + XtRString, + sizeof(String), + XtOffsetOf(XimData, userCMapDir2), + XtRImmediate, + (caddr_t)CMAPCONFIG + }, + { + XtNprintConfig, + XtCprintConfig, + XtRString, + sizeof(String), + XtOffsetOf(XimData, printConfig), + XtRImmediate, + (caddr_t)PRINTCONFIG + }, + { + XtNinput_fifo, + XtCInput_fifo, + XtRString, + sizeof(String), + XtOffsetOf(XimData, input_fifo), + XtRImmediate, + (caddr_t)O_DEVNAME + }, + { + XtNoutput_fifo, + XtCOutput_fifo, + XtRString, + sizeof(String), + XtOffsetOf(XimData, output_fifo), + XtRImmediate, + (caddr_t)I_DEVNAME + }, + { + XtNunixaddr, + XtCUnixaddr, + XtRString, + sizeof(String), + XtOffsetOf(XimData, unixaddr), + XtRImmediate, + (caddr_t)DEF_UNIXADDR + }, + { + XtNism_addr, + XtCIsm_addr, + XtRString, + sizeof(String), + XtOffsetOf(XimData, ism_addr), + XtRImmediate, + (caddr_t)DEF_ISM_ADDR + }, + { + XtNport, + XtCPort, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, port), + XtRImmediate, + (caddr_t)DEF_PORT + }, + { + XtNnports, + XtCNPorts, + XtRInt, + sizeof(int), + XtOffsetOf(XimData, nports), + XtRImmediate, + (caddr_t)DEF_NPORTS + }, + { + XtNism_task, + XtCIsm_task, + XtRString, + sizeof(String), + XtOffsetOf(XimData, ism_task), + XtRImmediate, + (caddr_t)DEF_ISM_TASK + }, +}; + +int ncolormaps = 0; +int first_color = FIRST_COLOR; + +ColorMap colormaps[MAX_COLORMAPS] = { + { 0, "Grayscale" }, + { 0, "Color" }, + { 0, "Heat" }, + { 0, "HSV" }, + { 0, "AIPS0" }, + { 0, "Halley" }, + { 0, "Ramp" }, + { 0, "Standard" }, + { 0, "Staircase" }, + { 0, "Rainbow1" }, + { 0, "Rainbow2" }, + { 0, "Random" }, + { 0, "Random8" }, + { 0, "Random16" }, + { 0, "Red" }, + { 0, "Green" }, + { 0, "Blue" }, +}; + + +int nprinters = 0; +Printer printer_list[MAX_PRINTERS] = { + { "default", "lpr" }, /* should do more interesting examples */ + { "clp", "lpr -Pclp" }, + { "clp2", "lpr -Pclp2" }, + { "clp2t", "lpr -Pclp2t" }, + { "lw1", "lpr -Plw1" }, + { "lw2", "lpr -Plw2" }, + { "lw3", "lpr -Plw3" }, + { "lw4", "lpr -Plw4" }, + { "lw5", "lpr -Plw5" }, + { "lw6", "lpr -Plw6" }, + { "lw7", "lpr -Plw7" }, + { "lw8", "lpr -Plw8" }, + { "lw9", "lpr -Plw9" }, + { "lw10", "lpr -Plw10" }, + { "lw11", "lpr -Plw11" }, + { "lw12", "lpr -Plw12" }, + { "lw13", "lpr -Plw13" }, + { "lw14", "lpr -Plw14" }, + { "lw15", "lpr -Plw15" }, + { "lw16", "lpr -Plw16" }, + { "lw18", "lpr -Plw18" }, + { "lw19", "lpr -Plw19" }, + { "lw20", "lpr -Plw20" }, + { "lw21", "lpr -Plw21" }, + { "lw22", "lpr -Plw22" }, + { "lw23", "lpr -Plw23" }, + { "lw24", "lpr -Plw24" }, + { "lw25", "lpr -Plw25" }, + { "lw26", "lpr -Plw26" }, + { "lw27", "lpr -Plw27" }, + { "\0", "\0" }, +}; + + +#else + +extern XtResource resources[]; +extern XimData ximtool_data; +extern int ncolormaps; +extern int first_color; +extern ColorMap colormaps[]; +extern int nprinters; +extern Printer printer_list[]; + +#endif + +/* Functions. + */ +#ifndef abs +#define abs(a) (((a)<0)?(-(a)):(a)) +#endif +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef max +#define max(a,b) ((a)<(b)?(b):(a)) +#endif +#ifndef nint +#define nint(a) ((a)<(0)?((int)(a-0.5)):((int)(a+0.5))) +#endif + +void xim_initialize(), xim_reset(), xim_resize(), xim_refresh(); +void xim_close(), xim_initFrame(), xim_setFrame(), xim_setRop(); +void xim_setReferenceFrame(), xim_setDisplayFrame(); +void xim_delFrame(), xim_setMapping(), xim_setZoom(); +void xim_setCursorPos(), xim_getCursorPos(), xim_setFlip(); +void xim_matchFrames(), xim_registerFrames(); +void xim_readCursor(), xim_frameChanged(); +void xim_message(), xim_msgi(), xim_alert(); +int xim_setColormap(); +int xim_getAntialias(); +char *xim_frameLabel(); + +int xim_writeDisplay(); +unsigned char *xim_readDisplay(); +void xim_initSave(), xim_closeSave(); +void ximp_rename(), ximp_cancel(); +void xims_rename(), xims_cancel(); +int xim_saveFile(); + +int xim_iisopen(); +void xim_iisclose(), xim_iisio(); +XtPointer xim_addInput(); +void xim_removeInput(); + +void xim_clientOpen(), xim_clientClose(); +int xim_clientExecute(); diff --git a/vendor/x11iraf/ximtool/ximtool.html b/vendor/x11iraf/ximtool/ximtool.html new file mode 100644 index 00000000..129f84fc --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.html @@ -0,0 +1,1219 @@ +<HTML> <HEAD> +<TITLE>XImtool On-Line Help Summary</TITLE> +</HEAD> <BODY> +<H2>Welcome to XImtool V2.0BETA</H2> + +XImtool is an image display server developed by the IRAF Project at the +National Optical Astronomy Observatories. To view images you need +client software (such as IRAF) to load images into the display, or it can +load images directly when run as a standalone task. +<p> +More <a href=#toc>detailed help</a> is available on the following topics: +<dl><dl> +<dt>Basic Usage:</dt> +<ul> +<li><A HREF="#basic">Getting Started</A> -- The basics. </li> +<li><A HREF="#gui">GUI Overview</A> -- What it looks like. </li> +<li><A HREF="#mouse">Mouse Operations</A> -- Doing stuff. </li> +<li><A HREF="#keystroke">Keystroke Accelerators</A> -- Keystroke summary.</li> +<li><A HREF="#markers">Markers</A> -- Panner/WCS markers, general markers.</li> +<li><A HREF="#control">Control Panel</A> -- Operating the Control panel.</li> +<li><A HREF="#load">Load Panel</A> -- Load panel operation and options.</li> +<li><A HREF="#save">Save Panel</A> -- Save panel operation and options.</li> +<li><A HREF="#print">Print Panel</A> -- Print panel operation and options.</li> +<li><A HREF="#info">Info Panel</A> -- Information panel.</li> +</ul></dl></dl> +<dl><dl> +<dt>Advanced Features:</dt> +<ul> +<li><A HREF="#comline">Command-line Options</A> -- Startup flags. </li> +<li><A HREF="#client">Client Connections</A> -- Use as a display server. </li> +<li><A HREF="#framebuf">Frame Buffers</A> -- Explanation of Frame buffers. </li> +<li><A HREF="#pprinter">Printer Configurations</A> -- Configuring output devices. </li> +<li><A HREF="#tclshell">TclShell</A> -- Expert-mode interactive shell.</li> +</ul></dl></dl> +<p> +Please contact <i>iraf@noao.edu</i> with comments, bugs, or suggestions. +More detailed documentation is also available in the man page for this +task. +<p> +<hr> + +<a name=#toc> <h2>Table of Contents:</h2> </a> +<pre> + <A HREF="#basic">Getting Started</A> + <A HREF="#gui">GUI Overview</A> + <A HREF="#mouse">Mouse Operations</A> + <A HREF="#keystroke">Keystroke Accelerators</A> + <A HREF="#comline">Command-line Options</A> + <A HREF="#client">Client Connections</A> + <A HREF="#framebuf">Frame Buffers</A> + <A HREF="#frame16">Support for 16 Frames</A> + <A HREF="#markers">Markers</A> + <A HREF="#panner">Panner Marker</A> + <A HREF="#magnifier">Magnifier Marker</A> + <A HREF="#coords">Coords Box Marker</A> + <A HREF="#rulers">Ruler Markers</A> + <A HREF="#genmark">General Markers</A> + <A HREF="#markmenu">Menu Options</A> + <A HREF="#wcspix">Real-Time WCS/Pixel Readout</A> + <A HREF="#curfreeze">Freezing Cursor Readout</A> + <A HREF="#autoreg">Auto-Registration of Images</A> + <A HREF="#cutgraphs">Image Cut Graphics</A> + <A HREF="#peakup">Peak-Up Cursor Centroid Positioning</A> + + <A HREF="#control">Integrated Control Panel</A> + <A HREF="#display">Display Panel</A> + <A HREF="#cview">View Controls</A> + <A HREF="#cenhance">Enhancement Controls</A> + <A HREF="#cblink">Blink Controls</A> + <A HREF="#copts">Options:</A> + <A HREF="#cpanner">Panner</A> + <A HREF="#cmagnifier">Magnifier</A> + <A HREF="#ccoords">Coords Box</A> + <A HREF="#cautoscale">Autoscale</A> + <A HREF="#cantialias">Antialias</A> + <A HREF="#ctile">Tile Frames</A> + <A HREF="#cwarnings">Warnings</A> + <A HREF="#ccentroid">Centroid Peaks</A> + <A HREF="#ccmap">Colormap Selection</A> + <A HREF="#cbltin">Builtin Colormaps</A> + <A HREF="#cuser">User-defined Colormaps</A> + <A HREF="#load">Load Panel</A> + <A HREF="#lbrowse">Directory browsing</A> + <A HREF="#lpattern">File Patterns</A> + <A HREF="#lload">Direct File Load</A> + <A HREF="#lframe">Frame Selections</A> + <A HREF="#save">Save Panel</A> + <A HREF="#sfname">File Name</A> + <A HREF="#sformat">Format</A> + <A HREF="#scolor">Color</A> + <A HREF="#print">Print Panel</A> + <A HREF="#popts">Postscript Options</A> + <A HREF="#pcolors">Color Options</A> + <A HREF="#pproc">Processing Options</A> + <A HREF="#pprinter">Printer selection</A> + <A HREF="#info">Info Panel</A> + <A HREF="#tileP">Tile Panel</A> + <A HREF="#coordsP">Coords Panel</A> + + <A HREF="#tclshell">Tcl Interactie Shell</A> +</pre> +<p> +<hr> +<h2><a name=#basic>Getting Started</a></h2> +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept +<a href=#client>client connections</a> simultaneously on fifo pipes, unix +domain sockets, or inet sockets. A display client like the IRAF DISPLAY +task makes a connection and sends the image across using an IIS protocol +(other/different protocols may be supported in the future). Once the image +is loaded in the display buffer it may be <a href=#cenhance>enhanced</a>, +<a href=#save>saved to a disk file</a> in a number of different formats, or +<a href=#print>printed</a> as Encapsulated Postscript to a printer or disk file. +<p> +When run in standalone mode, images may be loaded on the +<a href=#comline>command line</a> or by using the <a href=#load>Load Panel</a>. +This allows you to browse images and perform the same manipulations as if +they had been displayed by a client. +<hr> + +<h2><a name=#gui>GUI Overview</a></h2> +<p> +The GUI consists of a large image display window and a number of smaller +pannels that control various specific functions such as image +<a href=#load>Load</a>, <a href=#save>Save</a> and <a href=#print>Print</a> +as well as a general purpose <a href=#control>Control Panel</a>. The main +window menubar has several menu buttons to the left: the <i>Files</i> menu +is used to load/save/print an image as well as quit the task. The <i>View</i> +menu let's you select the image orientation, zoom, colormap or frame. The +<i>Options</i> menu allows you to call up control panels, toggle markers +or blinking etc. Some of this functionality is duplicated elsewhere in +the GUI. The right side of the menubar contains command buttons to flip the +image as well as buttons for frame selection and the help button. +<p> +For more detailed information on the operation of the control panels please +see the on-line help (i.e. use the '?' button or Alt-h keystroke in the +main image window). + +<h2><a name=#mouse>Mouse Operations</a></h2> +Clicking and dragging MB1 (mouse button 1) in the main image +window creates a rectangular region <a href=#markers>marker</a>, used +to select a region of the image. If you do this accidentally and don't +want the marker, put the pointer in the marker and type DELETE or +BACKSPACE to delete the marker. With the pointer in the marker, +MB3 will call up a <a href=#markmenu>marker menu</a> listing some things + you can do with the marker, like zoom the outlined region. MB1 can be used +to drag or resize the marker. <a href=#markers>See below</a> for more +information on markers. +<p> +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. +<p> +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the display. +<hr> + +<h2><a name=#keystroke>Keystroke Accelerators</a></h2> + The following keystrokes are currently defined in the GUI: +<pre> + <b>Misc Functions</b> + <b>Ctrl-b </b><i>Previous (back) frame</i> + <b>Ctrl-c </b><i>Center frame</i> + <b>Ctrl-f </b><i>Forward frame</i> + <b>Ctrl-i </b><i>Invert colormap</i> + <b>Ctrl-m </b><i>Toggle magnifier</i> + <b>Ctrl-n </b><i>Normalize</i> + <b>Ctrl-p </b><i>Toggle panner</i> + <b>Ctrl-r </b><i>Register</i> + <b>Ctrl-s </b><i>Match LUT scaling</i> + <b>Ctrl-t </b><i>Tile frames toggle</i> + <b>Ctrl-u </b><i>Unzoom (zoom=1)</i> + <b>Ctrl-x </b><i>Flip X</i> + <b>Ctrl-y </b><i>Flip Y</i> + + <b>Ctrl-= </b><i>Print using current setup</i> + <b>Ctrl-< </b><i>Decrease blink rate (blink faster)</i> + <b>Ctrl-> </b><i>Increase blink rate (blink slower)</i> + <b>Ctrl-+ </b><i>Zoom in</i> + <b>Ctrl-- </b><i>Zoom out</i> + + <b>Alt-1 thru Alt-4 </b><i>Set frame to be displayed</i> + <b>Ctrl-1 thru Ctrl9 </b><i>Set integer zoom factor</i> + + <b>Ctrl-Alt-q </b><i>Quit</i> + <b>Ctrl-Alt-f </b><i>Fitframe</i> + + <b>Panel Toggles</b> + <b>Alt-b </b><i>Blink frames</i> + <b>Alt-c </b><i>Control panel</i> + <b>Alt-h </b><i>Help popup</i> + <b>Alt-i </b><i>Info box popup</i> + <b>Alt-l </b><i>Load file popup</i> + <b>Alt-p </b><i>Print popup</i> + <b>Alt-s </b><i>Save popup</i> + <b>Alt-t </b><i>TclShell popup</i> + + <b>Cursor Positioning</b> + <b>Ctrl-h / Ctrl-Left </b><i>Move cursor one pixel left</i> + <b>Ctrl-j / Ctrl-Down </b><i>Move cursor one pixel down</i> + <b>Ctrl-k / Ctrl-Up </b><i>Move cursor one pixel up</i> + <b>Ctrl-l / Ctrl-Right </b><i>Move cursor one pixel right</i> + + <b>Shift-Ctrl-h </b><i>Move cursor ten pixels left</i> + <b>Shift-Ctrl-Left </b><i>Move cursor ten pixels left</i> + <b>Shift-Ctrl-j </b><i>Move cursor ten pixels down</i> + <b>Shift-Ctrl-Down </b><i>Move cursor ten pixels down</i> + <b>Shift-Ctrl-k </b><i>Move cursor ten pixels up</i> + <b>Shift-Ctrl-Up </b><i>Move cursor ten pixels up</i> + <b>Shift-Ctrl-l </b><i>Move cursor ten pixels right</i> + <b>Shift-Ctrl-Right </b><i>Move cursor ten pixels right</i> + + <b>Auto-Registration</b> + <b>Ctrl-a </b><i>Toggle auto-registration</i> + <b>Ctrl-o </b><i>Set frame offset</i> + + <b>Frame Positioning</b> + <b>Ctrl-Left </b><i>Shift one full frame left</i> + <b>Ctrl-Down </b><i>Shift one full frame down</i> + <b>Ctrl-Up </b><i>Shift one full frame up</i> + <b>Ctrl-Right </b><i>Shift one full frame right</i> + + <b>Ctrl-Alt-Left </b><i>Shift one half frame left</i> + <b>Ctrl-Alt-Down </b><i>Shift one half frame down</i> + <b>Ctrl-Alt-Up </b><i>Shift one half frame up</i> + <b>Ctrl-Alt-Right </b><i>Shift one half frame right</i> + + <b>Peak Up Centroiding</b> + <b>Ctrl-[ </b><i>Decrease centroiding box size</i> + <b>Ctrl-] </b><i>Increase centroiding box size</i> + <b>Ctrl-0 (zero) </b><i>Centroid/find local maximum</i> + <b>Alt-Ctrl-0 (zero) </b><i>Find local minimum</i> + + <b>Mouse Button Events</b> + <b>Shift-Btn1Down </b><i>Turn on magnifier</i> + <b>Shift-Btn1Up </b><i>Turn off magnifier</i> + <b>Shift-Btn2Down </b><i>Turn on crosshair cursor</i> + <b>Shift-Btn2Up </b><i>Turn off crosshair cursor</i> + + <b>Btn1Down </b><i>Create a Marker</i> + <b>Btn1Motion </b><i>Resize marker being created</i> + <b>Btn2Down </b><i>Zoom/center on cursor position</i> + <b>Btn3Down/Motion </b><i>Brightness/contrast scale the image</i> + + <b>Ctrl-Btn1Down </b><i>Create Ruler Marker</i> + <b>Ctrl-Btn1Motion </b><i>Resize Ruler Marker being created</i> + <b>Ctrl-Btn1Up </b><i>Destroy Ruler Marker</i> + + <b>Alt-Motion </b><i>Freeze cursor readout</i> +</pre> +<hr> + +<h2><a name=#client>Client Connections</a></h2> +Ximtool allows clients to connect in any of the following ways: + +<dl> +<dt><b>fifo pipes</b></dt> + <dd>The traditional approach. The default, global /dev/imt1[io] pipes may + be used, or a private set of fifos.</dd> +<dt><b>tcp/ip socket</b></dt> + <dd>Clients connect via a tcp/ip socket. There is a default port, or + a custom port may be specified. This permits connecting to the + server over a remote network connection anywhere on the Internet.</dd> +<dt><b>unix domain socket</b></dt> + <dd>Like a tcp/ip socket, but limited to a single host system. Usually + faster than a tcp/ip socket, and comparable to a fifo. By default + each user gets their own unix domain socket, so this option allows + multiple users to run ximtools on the same host without having to + customize things.</dd> +</dl> + +By default ximtool listens simultaneously for client connctions on all three +types of ports. Clients communicate with XImtool using the IIS protocol, +other protocols may be supported in the future. +<hr> + +<h2><a name=#framebuf>Frame Buffers</a></h2> +XImtool starts up using default frame buffer size of 512x512 pixels, two +(of 16 possible) frames will be created. When loading disk images (i.e. +run in standalone mode) the frame buffer configuration file will be +searched for a defined frame buffer that is the same size or larger than +the current image, if no suitable buffer can be found a custom frame +buffer the same size as the image will be created in an unused portion of +the configuration table. When used as a display server the frame buffer +configuration number is passed in by the client and loaded explicitly even +if it means clipping the image. If a new frame buffer is a different size +than previously defined frames, all available frames will be initialized +and cleared prior to the display. The default frame buffer configuration +file is <b>/usr/local/lib/imtoolrc</b>, this can be overridden by defining a +<b>IMTOOLRC</b> environment variable naming the file to be used, by creating a +<b>.imtoolrc</b> file in your home directory, or a new file may be specified +using the <b>-imtoolrc</b> command line flag or <b>imtoolrc</b> application +resource. +<p> +The format of the frame buffer configuration file is +<pre> + configno nframes width height [extra fields] + +e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment +</pre> +At most 128 frame buffer sizes may be defined, each configuration may +define up to 16 frames, configuration numbers need not be sequential. + +<h3><a name=#frame16>Support for 16 Display Frames</a></h3> +<p> +As part of the extensive GUI changes with the V1.3 release, support for +the full 16 frames allowed by the IIS protocol is now available. IRAF +V2.11.4 or later client tasks (and CDL library) are required to take +advantage of this frames. All changes are backwards compatible, older +versions of IRAF will continue to work but cannot access more than the +original four frames. The new DISPLAY task will automatically sense +whether the display server being used supports 16 frames or the original 4 +and adjust the 'frame' parameter maximum accordingly. The changes are +fully backwards compatible for other servers. +<p> +More frames are possible if needed but will require further changes to the +client IRAF code to be effective. Allowing creation of more than 16 +frames by the Load panel can be done independently but would also require +numerous code change to XImtool. Please contact site support if there is +a need for this, or for workaround suggestions depending on your +application. + + +<h2><a name=#comline>Command-line Options</a></h2> + The following command-line options are currently recognized: +<pre> + <b>-basePixel</b> &lt;num&gt Base colormap pixel number + <b>-cmap1</b> &lt;file&gt User cmap 1 + <b>-cmap2</b> &lt;file&gt User cmap 2 + <b>-cmapDir1</b> &lt;dir&gt User cmapDir 1 + <b>-cmapDir1</b> &lt;dir&gt User cmapDir 2 + <b>-cmapInitialize</b> &lt;bool&gt Initialize colormap at startup + <b>-cmapName</b> &lt;name&gt Private colormap name + <b>-config</b> &lt;num&gt Initial config number + <b>-defgui</b> Print default GUI to stdout + <b>-displayPanner</b> &lt;bool&gt Display panner box + <b>-displayCoords</b> &lt;bool&gt Display wcs coords box + <b>-fifo</b> &lt;pipe&gt Fifo pipe to use + <b>-fifo_only</b> Use fifo pipes only + <b>-gui</b> &lt;file&gt GUI file to use + <b>-help</b> Print command-line summary + <b>-imtoolrc</b> &lt;file&gt Frame buffer configuration file + <b>-inet_only</b> Use inet sockets only + <b>-invert</b> Invert colormap on startup? + <b>-ismdev</b> ISM socket template + <b>-maxColors</b> &lt;num&gt Number of colors + <b>-memModel</b> &lt;type&gt Memory model (fast,small,beNiceToServer) + <b>-nframes</b> &lt;num&gt Number of frames at startup + <b>-port</b> &lt;num&gt Inet port to use + <b>-printConfig</b> &lt;file&gt Printer configuration file + <b>-port_only</b> Use inet sockets only + <b>-tile</b> Tile frames on startup? + <b>-unix</b> &lt;name&gt Unix socket to use + <b>-unix_only</b> Use unix sockets only + &lt;<b>file</b>&gt File to load on startup +</pre> +<hr> +<h2><a name=#markers>Markers</a></h2> +<h3><a name=#panner>Panner Marker</a></h3> +<p> +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. +<p> +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned <a href=#genmark>below</a> apply to these markers as well, e.g. +you can use MB1 to reposition on the panner window within the main image +display window, or to drag the region marker within the panner (pan the +image). Resizing the region marker zooms the image; this is a non-aspect +constrained zoom. The panner window itself can be resized by dragging a +corner with MB1. Typing delete or backspace anywhere in the panner window +deletes the panner. +<p> +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to typing MB2 in the main display +window to pan the image. +<p> +The panner marker can be disabled by defining the <i>displayPanner</i> +GUI resource, its size and location can be controlled using the +<i>pannerArea</i> and <i>pannerGeom</i> GUI resources respectively. + +<h3><a name=#magnifier>Magnifier Marker</a></h3> +The magnifier marker can be used to zoom in on a small area around the cursor. +It will be updated as the cursor moves but only for small motions (either +mouse movement or with the cursor movement keystrokes) to minimize the +impact on the system. The zoom factor is expressed as some fraction of the +size of the magnifier marker itself. The default zoom is 4, i.e. the area +in the marker represents and area in the image that's one-fourth the size +of the marker. Other zoom factors may be selected using the popup menu +created by hitting MB1 in the marker. +<p> +By default the magnifier marker is not visible, to toggle it select the +<i>Magnifier</i> option from the <i>Options</i> menubar button. Alternatively, +for just a quick look holding down the Shift Key and MB2 Button will display +the marker until the button is released. +<p> +The magnifier marker can be disabled by defining the <i>displayMagnifier</i> +GUI resource, its size and location can be controlled using the +<i>magnifierArea</i>and <i>magnifierGeom</i> GUI resources respectively. + +<h3><a name=#coords>Coords Box Marker</a></h3> +<p> +Ximtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +client defined coordinate system. The coords box feature is used to display +these world coordinates as the pointer is moved about in the image window. +<p> +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated +a "+" will be displayed after the intensity value. +<p> +The coords box is a marker (text marker) and it can be moved and resized +with the pointer like any other marker. + +<h3><a name=#rulers>Ruler Markers</a></h3> +<p> +Holding down the Ctrl key and the Left-Mouse-Button while moving +the mouse will drag out a "ruler marker" measuring the distance from the +initial point to the current mouse position. Releasing the Ctrl key before +lifting the mouse button will leave the marker on the display, otherwise +it will be erased automatically once the mouse button is released. Any +number of ruler markers can be created in the frame. +<p> +Distances are measured by default in image logical pixels however +the Right-Mouse-Button can be used inside the marker to popup a menu of +options: + +<dl> +<dt><b>Sticky</b></dt> + <dd>By default rulers are destroyed whenever the display changes due + to a pan, zoom, flip, or frame change. This option will make the + ruler "sticky" so it will not be erased, subsequent use of the menu + to shows this option to be "UnSticky" to remove this feature.</dd> +<dt><b>Units</b></dt> + <dd>Sub-menu to select the units of the display. If the ISM is enabled + and a WCS is present in the image and selected as one of the readout + options, distances may also be read out in units of arcseconds, + arcminutes, or degrees instead of the default logical pixels. All + markers created after the unit change will readout in the new units + as their default. </dd> +<dt><b>Color</b></dt> + <dd>Select the color of the marker.</dd> +<dt><b>Draw into Frame</b></dt> + <dd>(<i>Not Yet Implemented</i>) Draw the marker as overlay graphics + in the frame. Doing so will retain the marker when printing a + hardcopy of the display.</dd> +<dt><b>Destroy</b></dt> + <dd>Destroy the marker.</dd> +</dl> + +<p> +The marker can also be destroyed by hitting the Delete or Backspace key +while the cursor is in the marker. There is presently no way to move the +marker to a new position in the frame. + + +<h3><a name=#genmark>General Markers</a></h3> +Although ximtool doesn't do much with markers currently, they are a general +feature of the Gterm widget and are used more extensively in other programs +(e.g. the prototype IRAF science GUI applications). Ximtool uses markers +for the marker zoom feature discussed above, and also for the +<a href=#panner>panner</a> and the <a href=#coords>coords box</a>. All +markers share some of the same characteristics, so it is worthwhile learning +basic marker manipulation keystrokes. + +<ul> +<li> MB1 anywhere inside a marker may be used to drag the marker. +<li> MB1 near a marker corner or edge, depending on the type of marker, + resizes the marker. +<li> Shift-MB1 on the corner of most markers will rotate the marker. +<li> Markers stack, if you have several markers and you put one on top + of the other. The active marker is highlighted to tell you which of the + stacked markers is active. If the markers overlap, this will be marker + "on top" in the stacking order. +<li> MB2 in the body of a marker "lowers" the marker, i.e. moves it to + the bottom of the stacking order. +<li> Delete or backspace in a marker deletes it. +<li> Markers have their own translation resources and so the default + <a href=#keystroke>keystroke commands</a> will not be recognized when the + cursor is in a marker. +</ul> + +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The <b>Initialize</b> button will get +the original coords box back if you delete it). +<p> +<h4><a name=#markmenu>Marker Menu Options</a></h4> +<ul> +<li> MB3 (mouse button 3) calls up the marker menu (by default). +<li> <b>Zoom</b> does an equal aspect zoom of the region outlined by the marker. + In this way you can mark a region of the image and zoom it up. +<li> <b>Fill</b> exactly zooms the area outlined by the marker, making it fill + the display window. Since the marker is not likely to be exactly square, + the aspect ratio of the resultant image will not be unitary. +<li> <b>Print</b> prints the region outlined by the marker to the printer or + file currently configured by the <a href=#print>Print Panel</a>. +<li> <b>Save</b> saves the region outlined by the marker to the file currently + configured by the <a href=#save>Save Panel</a>. +<li> <b>Info</b> prints a description of the marked region. The text is + printed in the <a href=#info>Info Panel</a>. +<li> <b>Unrotate</b> unrotates a rotated marker. +<li> <b>Color</b> is a menu of possible marker colors. +<li> <b>Type</b> is a menu of possible marker types. This is still a little + buggy and it isn't very useful, but you can use it to play with different + types of markers. +<li> <b>Destroy</b> destroys the marker. You can also hit the delete or + backspace key in a marker to destroy the marker. +</ul> + +<hr> +<h2><a name=#wcspix>Real-Time WCS/Pixel Readout</a></h2> +XImtool now has the ability to display the actual pixel value of an image +(as well as the scaled value previously shown) and the cursor position in +image WCS values (e.g. RA/DEC, GLAT/GLONG, etc). This is done using an +external task (the 'ism_wcspix.e' binary in the new distribution) to +access the image and pass the coordinate/pixel information to the GUI. +<p> +WCS readout is enabled by default but can be toggled or reset using the +<i>WCS/Pix</i> button on the Coords tab in the control panel or the <i>ISM</i> +toggle on the alt-gui menubar. When enabled, images currently in the +server or subsequently displayed will be passed to the external process +where they are cached for access. Cursor movements generate an event that +maps the current frame buffer position to a position in the cached image. +The ISM (ISM is Image Support Module) task then reads the image to +determine the pixel value (or a small table of values around the current +position), and computes one or more coordinates from the image position. +The ISM task also has access to the associated BPM images and can +optionally return bad pixel information during the cursor readout. +<p> +By default, the logical and world image coordinates are displayed to both +the Coords panel readout as well as the main display window wcsbox text +marker. Alternate coordinate systems (e.g. transformation of equatorial +to galactic coordinates or some other sky system, physical coords, +amplifier coords, etc) can be selected for display by hitting the +<i>Options</i> toggle on the Coords panel. Available coordinate systems are +chosen using the <i>Type</i> menu on the panel, the readout format +(sexigesimal, degrees, etc) using the <i>Format</i> menu, and the display to +the current panel or main image window using the remaining toggles for +each WCS. Up to four systems may be displayed at one time, the coordinate +panel and wcsbox marker will adjust size automatically depending on the +display. +<p> +By selecting the <i>BPM Data</i> toggle from the Coords.Options panel ximtool +is able to flag pixels in images with an associated bad pixel mask. This +bad pixel mask is currently assumed to be named in the image header "BPM" +keyword by convention. If the cursor passes over a bad pixel in the mask, +the Coords bpm display as well as the main window wcsbox will change to a +red background color. Only the Coords display will show the value, any +non-zero value will be flagged with the color change. +<p> +With the ISM enabled the Compass indicator will display a set of arrows +showing North-East if a WCS is available, otherwise just the current X-Y +axes are shown. The pixel table will display actual pixel values from the +image, with the ISM off the pixel table displays the scaled image values +from the frame buffer. + + +<hr> +<h2><a name=#curfreeze>Freezing Cursor Readout</a></h2> +<p> +Holding down the Alt key will now freeze the cursor display readout +and draw crosshairs on the screen at the last position. This can be used +for example to position the cursor but then allow the cursor to be moved to +another window (to enter text, start a program, whatever) without losing +the position information displayed on the screen. + + + +<hr> +<h2><a name=#autoreg>Auto-Registration of Images</a></h2> +<p> +The auto-register feature allows you specify a registration of two or +more display frames with an offset. When enabled, this registration is +maintained for all frames in the list if any one of them is panned or +zoomed to a new location in the frame buffer. +<p> +For example, to use this feature do the following: + +<ul> +<li> Enable Auto-Register (either on the Control Panel or the toolbar on the + alt-gui) and pan/zoom to some star of interest. +<li> Use Mouse-Button-2 to center the star in the frame. +<li> Cycle through the frames and you may see a small shift of the star. For + each frame, position the cursor on the star and type <b>Ctrl-o</b> to + offset it to the center. Repeat as necessary. Small corrections will be + cumulatively added so you can use the <b>Ctrl-0</b> (Ctrl-zero) peak-up + command to centroid each object in the frame before the <b>Ctrl-o</b> + offset. +<li> Pan around the image in one display frame, then switch frames and the new + frame should also be panned to the new image with the proper offset. +<li> A <b>Ctrl-a</b> command will toggle the feature, offsets are only allowed + when autoreg is enabled. +</ul> + +Hitting <b>Register</b> will zero the offsets, as will toggling the +auto-register function. What you should see is the object centered in the +frame and as you blink through it remains registered but the panner box +marker is moving around. Drag the panner around and all frames still +remain registered with the given offset. The control/info panels now +display what the offset is for each frame. +<p> +The register display list is shared with the blink list and can be set +using the Display control panel. By default all frames are included in +the list. For accessing more than four frames, use the box icon in the +Blink/Register box of the Display control panel to bring up a new window +with access to all 16 available frames. + + +<hr> +<h2><a name=#cutgraphs>Image Cut Graphics</a></h2> +<p> +XImtool now has the ability to display horizontal and vertical +cut-graphs of the display, these appear as "flip-out" panels that appear +on the bottom and right side of the main display window and are controlled +by the small <b>H</b> and <b>V</b> buttons in the lower right corner of +the window. When both panels are enabled the corner area of the display +also shows an options panel for the graphs. Current options are: + +<dl> +<dt><b>Better Speed</b></dt> + <dd>Draw the graphics so they update at the fastest possible rate. + This is done by subsampling pixels to produce a smoother graph + but without sacrificing too much accuracy.</dd> +<dt><b>Better Accuracy</b></dt> + <dd>Draw the graphics using all screen pixels to produce the most + accurate display. On fast modern machines this can be enabled with + no apparent loss of speed, however older machines may wish to use + this only occassionally to limit any lag in the cursor tracking.</dd> +<dt><b>Image Pixels</b></dt> + <dd>(<i>Not Yet Implemented</i>)<dd> +<dt><b>Jump Cursor</b></dt> + <dd>If enabled, large jumps of the cursor do not update the graphics + display, small movements around an object of interest will update + the display continuously.</dd> +<dt><b>Smooth Cursor</b></dt> + <dd>If enabled, all cursor movements cause the display to be updated. + This is another option that can be set safely on faster machines + but will cause a delay on slower ones.</dd> +<dt><b>Graphics Cursors</b></dt> + <dd>If enabled, the graphics cursors in either of the plots are active + and can be used to update the cursor readout on the main image window + and the complementary cut-graph. This can be used for example to + freeze the cursor in the main display using the Alt key (see above), + then moving to one of the graphics windows to perform cut graphs in + only one axis.</dd> +</dl> + +Graphs are (currently) drawn using only the scaled display values +to avoid complications of accessing multiple images in a mosaic display. Both +plots are labeled using the frame z1/z2 values and contain cursor indicators +which update contuously. + + +<hr> +<h2><a name=#peakup>Peak-Up Cursor Centroid Positioning</a></h2> +<p> +Several new keystroke commands are available to reposition the +cursor to a centroid or min/max pixel value within a bounding box of the +cursor position, allowing you to approximate the position with the mouse +and fine tune it quickly before typing the application keystroke command. +The initial box size is controlled with a <b>centerBoxSize</b> GUI resource +(defaults to 5 pixels) but can be adjusted interactively using the +<b>Ctrl-[</b> and <b>Ctrl-]</b> commands to descrease/increase the box +size respectively. A marker will flash briefly to indicate the box size. +<p> +The <b>Ctrl-0</b> (zero) key finds either a centroid or the local maximum +pixel value within this box region, <b>Alt-Ctrl-0</i> (zero) will find the +local minimum value. In either case the cursor is reposition to the computed +value. The default peak-up action is to find the centroid position in the +box however this can be changed to find the max pixel by selection the +"<a href=#ccentroid>Centroid Peaks</a>" option from the main Display +control panel or by resetting the <i>peakCentroid</i> GUI resource +(defaults to True). +<p> +Centroiding is done using only the scaled screen pixel values and +only pixels above the mean value within the box are used. It works best +if the box size is set appropriately, the centroid position may appear to +drift if the box is too large and includes too many background pixels. + + +<hr> +<h2><a name=#control>Integrated Control Panel</a></h2> + +<h3><a name=#display>Display Panel</a></h3> +XImtool has a control panel which can be used to exercise most of the +capabilities the program has for image display. The control panel can be +accessed either via the <b>Options</b> menu from the main window menubar, or +by +pressing the leftmost button in the row of buttons at the upper right side +of the display in the standard GUI (in the alternate GUI the +<i>Control Bar</i> accessed by the rightmost button on the menubar +provides widgets for selecting the desired control panel). +<p> +The separate windows previously used for Control/Print/Load/Save/etc +have now been integrated into a single window with the appropriate control +panel selectable with a Tab widget. There are also new Tab panels for +setting the frame tile configuration (see below), more detailed information +on the server status, and selecting the WCS readout options (see below). + +<h3><a name=#cview>View Controls</a></h3> +<p> +The <b>Frame</b> box will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 4) will be created +automatically if requested by the client. +<p> +The <b>text display window</b> gives the field X,Y center, X,Y scale +factors, and the X,Y zoom factors. The scale factor and the zoom factor +will be the same unless autoscale is enabled. The scale is in units of +display pixels per frame buffer pixel, and is an absolute measure (it doesn't +matter whether or not <a href=#cautoscale>autoscale</a> is enabled). Zoom is +relative to the autoscale factor, which is 1.0 if autoscaling is disabled. +This information is also presented in the <a href=#info>Info panel</a>. +<p> +The numbers in the <b>Zoom</b> box are zoom factors. Blue numbers zoom, +red numbers dezoom. <b>Zoom In</b> and <b>Zoom Out</b> may be used to go to +larger or smaller zoom factors, e.g. "Ctrl-5" followed by "Zoom In" will get you +to zoom factor 10. Specific zoom factors may also be accessed directly as +Control <a href=#keystrokes>keystrokes</a>, e.g. Ctrl-5 will set zoom factor 5. +<b>Center</b> centers the field. <b>Toggle Zoom</b> toggles between the +current zoom/center values, and the unzoomed image. +<p> +<b>Aspect</b> recomputes the view so that the aspect ratio is 1.0. +Aspect also integerizes the zoom factor (use the version in the View menu +if you don't want integerization). +<p> +<b>Fit Frame</b> makes the display window the same size as the frame +buffer. Note that <a href=#cautoscale>autoscale</a> has much the same effect, +and allows you to resize the display window to any size you want, or view +images to large to fit on the screen. + +<h3><a name=#cenhance>Enhancement Controls</a></h3> + +<p> +At the top is a scrolled list of all the <a href=#cbltin>available +colormaps</a>. Click on the one you want to load it. You can add your own +<a href=#cuser>colormaps</a> to this list. +<p> +The two sliders adjust the <b>contrast</b> (upper slider) and +<b>brightness</b> (lower slider) of the display. The <b>Invert</b> button +inverts the colormap (multiples the contrast by -1.0). Note that due to the +use of the private colormap the sliders are a bit sluggish when dragged to +window the display. If this is annoying, using MB3 in the display window is +faster. +<p> +The <b>Normalize</b> button (on the bottom of the control panel) will +normalize the enhancement, i.e. set the contrast and brightness to the default +one-to-one values (1.0, 0.5). This is the preferred setting for many of the +pseudocolor colortables and for private colormaps loaded from disk images. + +<h3><a name=#cblink>Blink Controls</a></h3> +<p> +<b>Blink frames</b> is the list of frames to be blinked. When blink mode is +in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered in +the list more than once. To program an arbitrary list of blink frames, +hit the Reset button and click on each blink frame button until it is set +to the desired frame number. The main control panel allows only the +original four frames to be specified in the blink list, however access to +the full list of 16 frames now supported is gained using the box icon +button next the the <b>Reset</b> button to bring up a new control panel. +<p> +The <b>Blink Rate</b> can be adjusted as slow or as fast as you want using +the arrow buttons. If you set the blink rate small enough it will go to +zero, enabling single step mode (see below). +<p> +The <b>Register</b> button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. +<p> +The <b>Match LUTs</b> button sets the enhancement of all blink frames to +the same values as the display frame. Frames not in the blink list are not +affected. +<p> +The <b>Blink</b> button turns blink on and off. When the blink rate is set +to zero the Blink button will single step through the blink frames, one +frame per button press. +<p> +<b>NOTE:</b> You can blink no matter what ximtool options are in effect, +but many of these will slow blink down. To get the fastest blink you may +want to turn off the panner and coords box, and match the LUTs of all the +blink frames. All the ximtool controls are fully active during blink +mode, plus you can load frames etc. + + +<h3><a name=#copts>Options:</a></h3> +<dl> +<dt><b><a name=#cpanner>Panner</a></b></dt> + <dd>Toggles the display of the Panner marker.</dd> +<dt><b><a name=#cmagnifier>Magnifier</a></b></dt> + <dd>Toggles the display of the magnifier marker.</dd> +<dt><b><a name=#ccoords>Coords Box</a></b></dt> + <dd>Toggles the display of the WCS Coords Box marker.</dd> +<dt><b><a name=#cautoscale>Autoscale</a></b></dt> + <dd>If autoscale is enabled then at zoom=1, the frame buffer will + be automatically scaled to fit within the display window. With + autoscale disabled (the default), the image scale is more + predictable, but the image may be clipped by the display window, + or may not fill the display window.</dd> +<dt><b><a name=#cantialias>Antialias</a></b></dt> + <dd>When dezooming an image, i.e., displaying a large image in a + smaller display window, antialiasing causes all the data to be used + to compute the displayed image. If antialiasing is disabled then + image is subsampled to compute the displayed image. Antialiasing + can prevent subsampling from omitting image features that don't + fall in the sample grid, but it is significantly slower than + dezooming via subsampling. The default is no antialising. </dd> +<dt><b><a name=#ctile>Tile Frames</a></b></dt> + <dd>The default display mode is to view one frame at a time. In tile + frames mode, 2 or 4 frames may be viewed simultaneously in the + display window. All the usual operations (zoom and pan, colortable + enhancement, cursor readback, etc.) still work for each frame even + when in tile frames mode. </dd> +<dt><b><a name=#cwarnings>Warnings</a></b></dt> + <dd>The warnings options toggles whether you see warning dialog boxes + in situations like overwriting an existing file, clearing the frame + buffer, etc.</dd> +<dt><b><a name=#ccentroid>Centroid Peaks</a></b></dt> + <dd>If enabled, the <b>Ctrl-0</b> keystroke will reposition the cursor + to the computed centroid of the centroiding box, otherwise the cursor + is repositioned to the local maximum value within the box.</dd> +</dl> + +<h3><a name=#ccmap>Colormap Selection</a></h3> +By default XImtool will display images using either a grayscale colormap +if loaded by a client, or a private colormap when loading an image from +disk that contains a colormap. Each frame defines its own colormap so +you can define different colormaps or enhancements for each frame, they +will change automatically as you cycle through the frames. + +<h4><a name=#cbltin>Builtin Colormaps</a></h4> +Once loaded, the colormap may either be changed using the builtin colormap +menu under the <b>View</b> menu button on the main window, or from the +<a href=#cenhance>Enhancement</a> box on the <a href=#control>control panel</a>. Ximtool has about a dozen colormap +options builtin, other <a href=#cuser>user-defined colormaps</a> may +optionally be loaded. + +<h4><a name=#cuser>User-defined Colormaps</a></h4> +The cmap[12] and cmapDir[12] resources (or <a href=#comline>command line +arguments</a> are used to tell ximtool which specific colormaps to make +available or where to look for colortables respectively. The colortables +are loaded when ximtool starts up, or when it is reinitialized (e.g. by +pressing the <b>Initialize</b> button in the <a href=#control>control +panel</a>). Ximtool will ignore any files in the colormap directory +which do not look like colortables. New colortables will also be added +for each images loaded from disk. +<p> +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, +and blue values scaled to the range 0.0 (off) to 1.0 (full intensity). +<pre> + R G B + R G B + (etc.) +</pre> +Blank lines and comment lines (# ...) are ignored. +<p> +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. Ximtool will interpolate the table as necessary to +compute the colortable values used in Ximtool. Ximtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. +<p> +The name of the colortable as it will appear in the Ximtool control panel +is the root name of the file, e.g., if the file is "rainbow.lut" the +colortable name will be "rainbow". Lower case names are suggested to avoid +name collisions with the builtin colortables. Private colormaps for disk +images will be have the same name as the image loaded. If the same colortable +file appears in multiple user colortable directories, the first one will be +used. +<p> +The directory "luts" in the ximtool source directory contains a sample set +of colortable files. This can be installed as /usr/local/lib/imtoolcmap +when ximtool is installed. + +<hr> +<h2><a name=#load>Load Panel</a></h2> +The Load Panel allows you load images from disk directly to the frame +buffer, this is analogous to loading an image on the command line except +that browsing is possible. At present recognized formats include IRAF OIF +format (i.e. <i>.imh</i> extension), simple FITS files, GIF, and Sun +rasterfiles. The task will automatically sense the format of the image +and load it appropriately. Images with private colormaps (such as GIF) +will be loaded using the private colormap (meaning that changing the +brightness/contrast enhancements will render an apparently random-colored +image), all others will be loaded with a grayscale colormap. +<p> +When loading new images the frame buffer configuration table will be +searched for a frame buffer that is the same size or larger than the new +image size, if no frame buffer can be found a custom buffer exactly the +size of the image will be created. This means that the image may not fill +the display window when loaded, or you may see a subsection of the image +in the main display window. Setting the +<a href=#cautoscale><b>autoscale</b></a> option on the main +Display panel will scale the entire image to fit the main display window, +the full frame buffer will always be visible in the Panner marker window. +<p> +Images with more colors than can be displayed will automatically be +quantized to the number of available colors before display. If the +<b>Auto Grayscale</b> button is enabled any image colormap will be +converted to grayscale and loaded as the standard grayscale colormap. +<p> +Formats which permit pixels larger than 8-bits/pixel will be sampled on +a grid to determine an optimal range in the data to be used to compute a +linear transformation to the number of display colors. This is the same +z-scale sampling and transformation used by the IRAF <b>DISPLAY</b> task +when computing the <b>z1/z2</b> values and provides a much better initial +display than simple truncation to 8-bits. This scaling will be done +automatically using a grid of <b>Nsample</b> points if the <b>Zscale</b> +option is enabled. Otherwise, if the <b>Zrange</b> option is set the full +data range will be used to scale the image. Lastly, is neither <b>Zscale</b> +nor <b>Zrange</b> are enabled, the z1/z2 values may be set explicitly using +the options box. + +<h3><a name=#lbrowse>Directory Browsing</a></h3> +The load panel contains a list of files in the current directory that may +be selected for loading by selecting with left mouse button. If the file +is a directory the contents of the new directory will be loaded, if it's a +plain file an attempt will be made to load it as an image otherwise an +error popup will appear. Directories in the list are identified with a +trailing '/' character, you will always see any subdirectories listed even +if a filter is specified. +<p> +The <b>Root</b> button will reset the current directory to the system root +directory. The <b>Home</b> button will reset the current directory to the +user's login directory, the <b>Up</b> button moves up one directory level, and +<b>Rescan</b> reloads the file list by rescanning the directory. The current +working directory is given below the file selection window. +<p> +Selecting the <b>List Image Headers</b> option will change the display text +to list all images in the current directory which match the filename filter. +Directory browsing is disabled while this option is in effect. + +<h3><a name=#lpattern>File Patterns</a></h3> +By default all files and directories will be listed. You may specify a +filter to select only those files with a given extension such as +"*.fits" using the <b>Filter</b> text box. Directories will +always be seen in the list and are identified with a trailing '/' +character. Any valid unix pattern matching string will be recognized, +multiple templates may be specified in a comma-delimited list such as +"*.imh,*.fits" to list both OIF and FITS images. + +<h3><a name=#lload>Direct File Load</a></h3> +If you know exactly which file you wish to load, you may enter its +name in the <b>Load File</b> text box and either hit &lt;cr&gt or the +<b>Load</b> button to load it. An absolute or relative path name may +be given, if a simple filename is specified it will be searched for in +the current working directory which is displayed in the <b>Directory</b> +label of the panel. + +<h3><a name=#lframe>Frame Selections</a></h3> +By default images will be loaded into the current frame, you may choose +a different frame using the Frame menu button to select from the +available frames. + + +<hr> +<h2><a name=#save>Save Panel</a></h2> +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, any general graphics +markers, or overlay graphics displayed by the client program). Presently, +only the contents of the main display window may be saved, there is no +facility for saving the undisplayed contents of the entire frame buffer +other than to enable the <a href=#cautoscale>autoscale</a> feature. A limited +number of formats are currently available, others will be added in future +versions. + +<dl> +<dt><b><a name=#sfname>File Name</a></b></dt> + <dd>The <b>File Name</b> text box allows you to enter the file name of + the saved file. A "%d" anywhere in the name will be replaced by a + sequence number allowing multiple frames to be saved with unique + names. </dd> +<dt><b><a name=#sformat>Format</a></b></dt> + <dd>The <b>Format</b> box allows you to choose the format of the image + to be created. Not all formats are currently implemented. The EPS + format is similar to the \fIPrint\fR option however there is no + annotation. </dd> +<dt><b><a name=#scolor>Color</a></b></dt> + <dd>The <b>Color</b> box lets you choose the color type of the image + to be created. The options will change depending on the format, + e.g. FITS doesn't allow color so no color options will be allowed. + Formats which allow 24-bit images will be written using the current + colormap after converting to a 24-bit image, pseudocolor images will + be written with the current colormap. </dd> +</dl> +<hr> + +<h2><a name=#print>Print Panel</a></h2> +The Print Panel allows you dump the contents of the main display window as +Enacpsulated Postscript to either a named printer device or to a disk file. +The <b>Print To</b> selects the type of output, the <b>Print Command</b> +box will adjust accordingly, either as a Unix printer command or as a file +name. A "%d" anywhere in the name for disk output will be replaced by a +sequence number allowing multiple frames to be saved with unique names. +<a href=#pprinter>Selecting printers</a> from the installed list will +automatically change the command to be used to generate the output. This +command does not necessarily need to be a printer command, the +<a href=#pprinter>printer configuration file</a> lets you define any command +string to process the image. + +<h3><a name=#pcolors>Color Options</a></h3> +The <b>Color</b> box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap. + +<h3><a name=#popts>Postscript Options</a></h3> +<dl> +<dt>Orientation</dt> + <dd> Set the page orientation.</dd> +<dt>Paper Size</dt> + <dd> Select the paper size to be used.</dd> +<dt>Image Scale</dt> + <dd> Set the scale factor used to compute the final image size.</dd> +</dl> + +<h3><a name=#pproc>Processing Options</a></h3> +<dl> +<dt>Auto Scale</dt> + <dd>The auto scale toggles whether or not the image is automatically + scaled to fit the page. If not enabled, the <b>image scale</b> will + be used to dtermine the output image size.</dd> +<dt>Auto Rotate</dt> + <dd>Auto rotate determines whether or not the image will be rotated to + fit on the page. When set, an image larger than the current + orientation will be rotated and possibly scaled to fit the page.</dd> +<dt>Max Aspect</dt> + <dd>Max Aspect takes images smaller than the page and automatically + increases the scale so the image fills the page in the current + orientation.</dd> +<dt>Annotate</dt> + <dd>The annotate option toggles whether or not the final file includes + annotation such as the image title, a colorbar, and axis labels.</dd> +</dl> +<h3><a name=#pprinter>Printer selection</a></h3> +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the <em>printConfig</em> resource. The format of the file is simply +<pre> + <b>name</b> &lt tab &gt <em>command</em> +</pre> +The <b>name</b> value is what appears in the selection list and may be more +than a single word, the <em>command</em> can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command will be +a simple 'lpr -Pfoo' or some such, but can also include converters or +previewers. At most 128 printer commands may be used. + +<hr> +<h2><a name=#info>Info Panel</a></h2> +The Info panel was revised to provide a greater variety of status +information. The type of output is controlled by the toggle buttons on +the bottom of the frame, however all output is kept current as the program +runs. Current info options include: + +<dl> +<dt><b>Frame</b></dt> + <dd>Info about the current display frame.</dd> +<dt><b>Server</b></dt> + <dd>Info about various server options, e.g. colormaps, memory model, + antialias type, etc.</dd> +<dt><b>Clients</b></dt> + <dd>Show currently connected clients. Lists available connection + channels and active ISM clients.</dd> +<dt><b>WCS</b></dt> + <dd>List all WCS and mappings for the current frame.</dd> +<dt><b>ISM</b></dt> + <dd>Log of various ISM status messages.</dd> +<dt><b>Imtoolrc</b></dt> + <dd>Show current frame buffer configuration table.</dd> +</dl> + + +<hr> +<h2><a name=#tileP>Tile Panel (NEW)</a></h2> +With the additional frames, the default tiling scheme proved inadequate. +A new control panel Tile frame now allows you to select from a number of +tile configurations, the list of frames to be tiled, a <b>fill style</b> +(left-to-right or top-to-bottom), as well as optional labels for each of +the tiles (frame number, image title or image name). +<p> +Tile configuration will make use of all frames currently selected in the +<b>Tile Frame</b> group in the following manner: + +<dl> +<dt><b>Disabled</b></dt> + <dd>Do not tile the display.</dd> +<dt><b>Manual</b></dt> + <dd>Tile according to <b>Manual Configuration</b> settings.</dd> +<dt><b>Best</b></dt> + <dd>Optimize layout for frame buffer aspect.</dd> +<dt><b>Square</b></dt> + <dd>Always force a square layout (2x2, 3x3, etc).</dd> +<dt><b>Horizontal</b></dt> + <dd>Preferentially tile horizontally (6 frames ==> 3x2).</dd> +<dt><b>Vertical</b></dt> + <dd>Preferentially tile vertically (6 frames ==> 2x3).</dd> +<dt><b>One Row</b></dt> + <dd>Tile all in one row (Nx1).</dd> +<dt><b>One Column</b></dt> + <dd>Tile all in one column (1xN).</dd> +</dl> + + +<hr> +<h2><a name=#coordsp>Coords Panel (NEW)</a></h2> +The Coords Panel is meant to provide a full-featured readout as well as +serve as a control panel for the various options. The display window +contains the image name/title and frame buffer info, and a selection of +coordinate and image pixel readouts. The intent is provide more infor- +mation than can fit comfortably on the main image window while still +taking up as little screen space as possible. To this end the <b>Options</b> +button is used to hide most of the feature controls when not in use +(see below). Other options on the main panel include: + +<dl> +<dt><b>WCS/Pix</b></dt> + <dd>Toggle the real-time WCS/pixel readout capability (i.e. the ISM + used to access the disk image). This must be enabled for certain + other options to work.</dd> + +<dt><b>Pix Table</b></dt> + <dd>Open a panel showing an image pixel table. The panel shows an array + of pixels surrounding the cursor position, either the actual pixel + values if the ISM is enabled, or scaled display values otherwise. + The size of the table may be selected from the menubar.</dd> + +<dt><b>Header</b></dt> + <dd>Display the current image header in a new panel. Both the entire + image header as well as WCS-specific parts of the header are + available under different tabs. This option is only active when + the ISM is enabled.</dd> + +<dt><b>Compass</b></dt> + <dd>Draw an orientation compass on the display panner. If the ISM is + enabled and a WCS is present in the header, the compass will + indicate N/E according to the WCS, otherwise the X/Y axes of the + image are drawn.</dd> + +<dt><b>Options</b></dt> + <dd>Pop-up/down the option control portion of the panel. When enabled, + the Coords Panel will change size to reveal the options which can be + changed (explained below). </dd> +</dl> + +The <b>Readout Values</b> group controls the selection of WCS type, +location and format to be displayed. The <b>Type</b> menu always +provides a selection of the image Logical, Physical or World systems, +which may be identical depending on the image header. If a World system +is supplied in the image addition entries for transformations to other sky +systems, (e.g. FK5 to ICRS or galactic/ecliptic) will also be available. +The selection is dependent on whether the ISM is running as well as WCS +information present in the image. The <b>Format</b> menu allows the +use to select a sexigesimal display, conversion to degrees or radians, +or whichever format is most natural for the coordinate being display. +The two toggle to the right control whether this WCS is to be displayed +on the <i>Panel</i> (i.e. the Coords Panel window) or the <i>ImgWin</i> +(i.e. the text marker on the main image window). +<p> +Other options below this group control whether or not to display the WCS +labels, the image name/title, and frame buffer information in the main +Coords Panel display. The <b>BPM Data</b> option controls whether or not the +ISM will try to map any bad-pixel mask associated with the image. If +enabled, a bad-pixel mask specified by the image header BPM keyword +(currently fixed by convention but this may be selectable later) will be +mapped along with the image. Aside from wcs/pixel readouts at each cursor +position, any BPM data values found will also be displayed. A non-zero +value will cause the BPM field of the Coords Panel readout as well as the +main image window marker to switch to a red background color to flag the +value. +<p> +The last box allows the user to specify a different ISM task to be +executed or to reinitialize the current one. In most cases this won't +need to be changed, however a custom ISM could be started when using +special data formats. This command string can also be controlled by the +application <i>ism_task</i> resource. + + +<hr> +<h2><a name=#tclshell>Tcl Interactive Shell</a></h2> + The <em>TclShell</em> is mostly used as a development or debugging +tool for the GUI. It allows the user to type commands directly to the +TCL interpreter letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. Most users will +never need this, but for an example of what it does, bring it up and type a +command such as +<pre> + send helpButton set background red +</pre> +Cool, huh. +<hr> + +<h2><a name=#acknowledgements>Acknowledgements</a></h2> + <i>XImtool</i> was developed by the IRAF Group at the National Optical +Astronomy Observatories in Tucson, AZ. For further information or to report +problems please contact <i>iraf@noao.edu</i> +<hr> +This document was last updated 11/6/96. + +</BODY> +</HTML> diff --git a/vendor/x11iraf/ximtool/ximtool.html.h b/vendor/x11iraf/ximtool/ximtool.html.h new file mode 100644 index 00000000..539441cf --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.html.h @@ -0,0 +1,1219 @@ +"<HTML> <HEAD>", +"<TITLE>XImtool On-Line Help Summary</TITLE>", +"</HEAD> <BODY>", +"<H2>Welcome to XImtool V2.0BETA</H2>", +"", +"XImtool is an image display server developed by the IRAF Project at the", +"National Optical Astronomy Observatories. To view images you need", +"client software (such as IRAF) to load images into the display, or it can", +"load images directly when run as a standalone task.", +"<p>", +"More <a href=#toc>detailed help</a> is available on the following topics:", +"<dl><dl>", +"<dt>Basic Usage:</dt>", +"<ul>", +"<li><A HREF=\"#basic\">Getting Started</A> -- The basics. </li>", +"<li><A HREF=\"#gui\">GUI Overview</A> -- What it looks like. </li>", +"<li><A HREF=\"#mouse\">Mouse Operations</A> -- Doing stuff. </li>", +"<li><A HREF=\"#keystroke\">Keystroke Accelerators</A> -- Keystroke summary.</li>", +"<li><A HREF=\"#markers\">Markers</A> -- Panner/WCS markers, general markers.</li>", +"<li><A HREF=\"#control\">Control Panel</A> -- Operating the Control panel.</li>", +"<li><A HREF=\"#load\">Load Panel</A> -- Load panel operation and options.</li>", +"<li><A HREF=\"#save\">Save Panel</A> -- Save panel operation and options.</li>", +"<li><A HREF=\"#print\">Print Panel</A> -- Print panel operation and options.</li>", +"<li><A HREF=\"#info\">Info Panel</A> -- Information panel.</li>", +"</ul></dl></dl>", +"<dl><dl>", +"<dt>Advanced Features:</dt>", +"<ul>", +"<li><A HREF=\"#comline\">Command-line Options</A> -- Startup flags. </li>", +"<li><A HREF=\"#client\">Client Connections</A> -- Use as a display server. </li>", +"<li><A HREF=\"#framebuf\">Frame Buffers</A> -- Explanation of Frame buffers. </li>", +"<li><A HREF=\"#pprinter\">Printer Configurations</A> -- Configuring output devices. </li>", +"<li><A HREF=\"#tclshell\">TclShell</A> -- Expert-mode interactive shell.</li>", +"</ul></dl></dl>", +"<p>", +"Please contact <i>iraf@noao.edu</i> with comments, bugs, or suggestions.", +"More detailed documentation is also available in the man page for this", +"task.", +"<p>", +"<hr>", +"", +"<a name=#toc> <h2>Table of Contents:</h2> </a>", +"<pre>", +" <A HREF=\"#basic\">Getting Started</A>", +" <A HREF=\"#gui\">GUI Overview</A>", +" <A HREF=\"#mouse\">Mouse Operations</A>", +" <A HREF=\"#keystroke\">Keystroke Accelerators</A>", +" <A HREF=\"#comline\">Command-line Options</A>", +" <A HREF=\"#client\">Client Connections</A>", +" <A HREF=\"#framebuf\">Frame Buffers</A>", +" <A HREF=\"#frame16\">Support for 16 Frames</A>", +" <A HREF=\"#markers\">Markers</A>", +" <A HREF=\"#panner\">Panner Marker</A>", +" <A HREF=\"#magnifier\">Magnifier Marker</A>", +" <A HREF=\"#coords\">Coords Box Marker</A>", +" <A HREF=\"#rulers\">Ruler Markers</A>", +" <A HREF=\"#genmark\">General Markers</A>", +" <A HREF=\"#markmenu\">Menu Options</A>", +" <A HREF=\"#wcspix\">Real-Time WCS/Pixel Readout</A>", +" <A HREF=\"#curfreeze\">Freezing Cursor Readout</A>", +" <A HREF=\"#autoreg\">Auto-Registration of Images</A>", +" <A HREF=\"#cutgraphs\">Image Cut Graphics</A>", +" <A HREF=\"#peakup\">Peak-Up Cursor Centroid Positioning</A>", +"", +" <A HREF=\"#control\">Integrated Control Panel</A>", +" <A HREF=\"#display\">Display Panel</A>", +" <A HREF=\"#cview\">View Controls</A>", +" <A HREF=\"#cenhance\">Enhancement Controls</A>", +" <A HREF=\"#cblink\">Blink Controls</A>", +" <A HREF=\"#copts\">Options:</A>", +" <A HREF=\"#cpanner\">Panner</A>", +" <A HREF=\"#cmagnifier\">Magnifier</A>", +" <A HREF=\"#ccoords\">Coords Box</A>", +" <A HREF=\"#cautoscale\">Autoscale</A>", +" <A HREF=\"#cantialias\">Antialias</A>", +" <A HREF=\"#ctile\">Tile Frames</A>", +" <A HREF=\"#cwarnings\">Warnings</A>", +" <A HREF=\"#ccentroid\">Centroid Peaks</A>", +" <A HREF=\"#ccmap\">Colormap Selection</A>", +" <A HREF=\"#cbltin\">Builtin Colormaps</A>", +" <A HREF=\"#cuser\">User-defined Colormaps</A>", +" <A HREF=\"#load\">Load Panel</A>", +" <A HREF=\"#lbrowse\">Directory browsing</A>", +" <A HREF=\"#lpattern\">File Patterns</A>", +" <A HREF=\"#lload\">Direct File Load</A>", +" <A HREF=\"#lframe\">Frame Selections</A>", +" <A HREF=\"#save\">Save Panel</A>", +" <A HREF=\"#sfname\">File Name</A>", +" <A HREF=\"#sformat\">Format</A>", +" <A HREF=\"#scolor\">Color</A>", +" <A HREF=\"#print\">Print Panel</A>", +" <A HREF=\"#popts\">Postscript Options</A>", +" <A HREF=\"#pcolors\">Color Options</A>", +" <A HREF=\"#pproc\">Processing Options</A>", +" <A HREF=\"#pprinter\">Printer selection</A>", +" <A HREF=\"#info\">Info Panel</A>", +" <A HREF=\"#tileP\">Tile Panel</A>", +" <A HREF=\"#coordsP\">Coords Panel</A>", +"", +" <A HREF=\"#tclshell\">Tcl Interactie Shell</A>", +"</pre>", +"<p>", +"<hr>", +"<h2><a name=#basic>Getting Started</a></h2>", +"As a display server, XImtool is started as a separate process from client", +"software such as IRAF. Once it is running it will accept ", +"<a href=#client>client connections</a> simultaneously on fifo pipes, unix", +"domain sockets, or inet sockets. A display client like the IRAF DISPLAY", +"task makes a connection and sends the image across using an IIS protocol", +"(other/different protocols may be supported in the future). Once the image", +"is loaded in the display buffer it may be <a href=#cenhance>enhanced</a>,", +"<a href=#save>saved to a disk file</a> in a number of different formats, or ", +"<a href=#print>printed</a> as Encapsulated Postscript to a printer or disk file.", +"<p>", +"When run in standalone mode, images may be loaded on the ", +"<a href=#comline>command line</a> or by using the <a href=#load>Load Panel</a>.", +"This allows you to browse images and perform the same manipulations as if", +"they had been displayed by a client.", +"<hr>", +"", +"<h2><a name=#gui>GUI Overview</a></h2>", +"<p>", +"The GUI consists of a large image display window and a number of smaller", +"pannels that control various specific functions such as image", +"<a href=#load>Load</a>, <a href=#save>Save</a> and <a href=#print>Print</a>", +"as well as a general purpose <a href=#control>Control Panel</a>. The main", +"window menubar has several menu buttons to the left: the <i>Files</i> menu", +"is used to load/save/print an image as well as quit the task. The <i>View</i>", +"menu let's you select the image orientation, zoom, colormap or frame. The", +"<i>Options</i> menu allows you to call up control panels, toggle markers", +"or blinking etc. Some of this functionality is duplicated elsewhere in", +"the GUI. The right side of the menubar contains command buttons to flip the", +"image as well as buttons for frame selection and the help button.", +"<p>", +"For more detailed information on the operation of the control panels please", +"see the on-line help (i.e. use the '?' button or Alt-h keystroke in the", +"main image window).", +"", +"<h2><a name=#mouse>Mouse Operations</a></h2>", +"Clicking and dragging MB1 (mouse button 1) in the main image", +"window creates a rectangular region <a href=#markers>marker</a>, used", +"to select a region of the image. If you do this accidentally and don't", +"want the marker, put the pointer in the marker and type DELETE or", +"BACKSPACE to delete the marker. With the pointer in the marker,", +"MB3 will call up a <a href=#markmenu>marker menu</a> listing some things", +" you can do with the marker, like zoom the outlined region. MB1 can be used", +"to drag or resize the marker. <a href=#markers>See below</a> for more", +"information on markers.", +"<p>", +"Clicking on MB2 in the main image window pans (one click) or zooms (two ", +"clicks) the image. Further clicks cycle through the builtin zoom factors. ", +"Moving the pointer to a new location and clicking moves the feature under ", +"the pointer to the center of the display window. Holding down the Shift", +"key while clicking MB2 will cause a full-screen crosshair cursor to appear", +"until the button is released, this can be useful for fine positioning of the", +"cursor.", +"<p>", +"MB3 is used to adjust the contrast and brightness of the displayed image.", +"The position of the pointer within the display window determines the ", +"contrast and brightness values. Click once to set the values corresponding", +"to the pointer location, or click and drag to continuously adjust the display.", +"<hr>", +"", +"<h2><a name=#keystroke>Keystroke Accelerators</a></h2>", +" The following keystrokes are currently defined in the GUI:", +"<pre>", +" <b>Misc Functions</b> ", +" <b>Ctrl-b </b><i>Previous (back) frame</i>", +" <b>Ctrl-c </b><i>Center frame</i>", +" <b>Ctrl-f </b><i>Forward frame</i>", +" <b>Ctrl-i </b><i>Invert colormap</i>", +" <b>Ctrl-m </b><i>Toggle magnifier</i>", +" <b>Ctrl-n </b><i>Normalize</i>", +" <b>Ctrl-p </b><i>Toggle panner</i>", +" <b>Ctrl-r </b><i>Register</i>", +" <b>Ctrl-s </b><i>Match LUT scaling</i>", +" <b>Ctrl-t </b><i>Tile frames toggle</i>", +" <b>Ctrl-u </b><i>Unzoom (zoom=1)</i>", +" <b>Ctrl-x </b><i>Flip X</i>", +" <b>Ctrl-y </b><i>Flip Y</i>", +" ", +" <b>Ctrl-= </b><i>Print using current setup</i>", +" <b>Ctrl-< </b><i>Decrease blink rate (blink faster)</i>", +" <b>Ctrl-> </b><i>Increase blink rate (blink slower)</i>", +" <b>Ctrl-+ </b><i>Zoom in</i>", +" <b>Ctrl-- </b><i>Zoom out</i>", +" ", +" <b>Alt-1 thru Alt-4 </b><i>Set frame to be displayed</i>", +" <b>Ctrl-1 thru Ctrl9 </b><i>Set integer zoom factor</i>", +" ", +" <b>Ctrl-Alt-q </b><i>Quit</i>", +" <b>Ctrl-Alt-f </b><i>Fitframe</i>", +" ", +" <b>Panel Toggles</b> ", +" <b>Alt-b </b><i>Blink frames</i>", +" <b>Alt-c </b><i>Control panel</i>", +" <b>Alt-h </b><i>Help popup</i>", +" <b>Alt-i </b><i>Info box popup</i>", +" <b>Alt-l </b><i>Load file popup</i>", +" <b>Alt-p </b><i>Print popup</i>", +" <b>Alt-s </b><i>Save popup</i>", +" <b>Alt-t </b><i>TclShell popup</i>", +" ", +" <b>Cursor Positioning</b> ", +" <b>Ctrl-h / Ctrl-Left </b><i>Move cursor one pixel left</i>", +" <b>Ctrl-j / Ctrl-Down </b><i>Move cursor one pixel down</i>", +" <b>Ctrl-k / Ctrl-Up </b><i>Move cursor one pixel up</i>", +" <b>Ctrl-l / Ctrl-Right </b><i>Move cursor one pixel right</i>", +" ", +" <b>Shift-Ctrl-h </b><i>Move cursor ten pixels left</i>", +" <b>Shift-Ctrl-Left </b><i>Move cursor ten pixels left</i>", +" <b>Shift-Ctrl-j </b><i>Move cursor ten pixels down</i>", +" <b>Shift-Ctrl-Down </b><i>Move cursor ten pixels down</i>", +" <b>Shift-Ctrl-k </b><i>Move cursor ten pixels up</i>", +" <b>Shift-Ctrl-Up </b><i>Move cursor ten pixels up</i>", +" <b>Shift-Ctrl-l </b><i>Move cursor ten pixels right</i>", +" <b>Shift-Ctrl-Right </b><i>Move cursor ten pixels right</i>", +" ", +" <b>Auto-Registration</b> ", +" <b>Ctrl-a </b><i>Toggle auto-registration</i>", +" <b>Ctrl-o </b><i>Set frame offset</i>", +" ", +" <b>Frame Positioning</b> ", +" <b>Ctrl-Left </b><i>Shift one full frame left</i>", +" <b>Ctrl-Down </b><i>Shift one full frame down</i>", +" <b>Ctrl-Up </b><i>Shift one full frame up</i>", +" <b>Ctrl-Right </b><i>Shift one full frame right</i>", +" ", +" <b>Ctrl-Alt-Left </b><i>Shift one half frame left</i>", +" <b>Ctrl-Alt-Down </b><i>Shift one half frame down</i>", +" <b>Ctrl-Alt-Up </b><i>Shift one half frame up</i>", +" <b>Ctrl-Alt-Right </b><i>Shift one half frame right</i>", +" ", +" <b>Peak Up Centroiding</b> ", +" <b>Ctrl-[ </b><i>Decrease centroiding box size</i>", +" <b>Ctrl-] </b><i>Increase centroiding box size</i>", +" <b>Ctrl-0 (zero) </b><i>Centroid/find local maximum</i>", +" <b>Alt-Ctrl-0 (zero) </b><i>Find local minimum</i>", +" ", +" <b>Mouse Button Events</b> ", +" <b>Shift-Btn1Down </b><i>Turn on magnifier</i>", +" <b>Shift-Btn1Up </b><i>Turn off magnifier</i>", +" <b>Shift-Btn2Down </b><i>Turn on crosshair cursor</i>", +" <b>Shift-Btn2Up </b><i>Turn off crosshair cursor</i>", +" ", +" <b>Btn1Down </b><i>Create a Marker</i>", +" <b>Btn1Motion </b><i>Resize marker being created</i>", +" <b>Btn2Down </b><i>Zoom/center on cursor position</i>", +" <b>Btn3Down/Motion </b><i>Brightness/contrast scale the image</i>", +" ", +" <b>Ctrl-Btn1Down </b><i>Create Ruler Marker</i>", +" <b>Ctrl-Btn1Motion </b><i>Resize Ruler Marker being created</i>", +" <b>Ctrl-Btn1Up </b><i>Destroy Ruler Marker</i>", +" ", +" <b>Alt-Motion </b><i>Freeze cursor readout</i>", +"</pre>", +"<hr>", +"", +"<h2><a name=#client>Client Connections</a></h2>", +"Ximtool allows clients to connect in any of the following ways:", +"", +"<dl>", +"<dt><b>fifo pipes</b></dt>", +" <dd>The traditional approach. The default, global /dev/imt1[io] pipes may ", +" be used, or a private set of fifos.</dd>", +"<dt><b>tcp/ip socket</b></dt>", +" <dd>Clients connect via a tcp/ip socket. There is a default port, or", +" a custom port may be specified. This permits connecting to the", +" server over a remote network connection anywhere on the Internet.</dd>", +"<dt><b>unix domain socket</b></dt>", +" <dd>Like a tcp/ip socket, but limited to a single host system. Usually ", +" faster than a tcp/ip socket, and comparable to a fifo. By default", +" each user gets their own unix domain socket, so this option allows", +" multiple users to run ximtools on the same host without having to", +" customize things.</dd>", +"</dl>", +"", +"By default ximtool listens simultaneously for client connctions on all three", +"types of ports. Clients communicate with XImtool using the IIS protocol,", +"other protocols may be supported in the future.", +"<hr>", +"", +"<h2><a name=#framebuf>Frame Buffers</a></h2>", +"XImtool starts up using default frame buffer size of 512x512 pixels, two", +"(of 16 possible) frames will be created. When loading disk images (i.e.", +"run in standalone mode) the frame buffer configuration file will be", +"searched for a defined frame buffer that is the same size or larger than", +"the current image, if no suitable buffer can be found a custom frame", +"buffer the same size as the image will be created in an unused portion of", +"the configuration table. When used as a display server the frame buffer", +"configuration number is passed in by the client and loaded explicitly even", +"if it means clipping the image. If a new frame buffer is a different size", +"than previously defined frames, all available frames will be initialized", +"and cleared prior to the display. The default frame buffer configuration", +"file is <b>/usr/local/lib/imtoolrc</b>, this can be overridden by defining a", +"<b>IMTOOLRC</b> environment variable naming the file to be used, by creating a", +"<b>.imtoolrc</b> file in your home directory, or a new file may be specified", +"using the <b>-imtoolrc</b> command line flag or <b>imtoolrc</b> application", +"resource.", +"<p>", +"The format of the frame buffer configuration file is", +"<pre>", +" configno nframes width height [extra fields]", +"", +"e.g. ", +" 1 2 512 512", +" 2 2 800 800", +" 3 1 1024 1024 # comment", +"</pre>", +"At most 128 frame buffer sizes may be defined, each configuration may", +"define up to 16 frames, configuration numbers need not be sequential.", +"", +"<h3><a name=#frame16>Support for 16 Display Frames</a></h3>", +"<p>", +"As part of the extensive GUI changes with the V1.3 release, support for", +"the full 16 frames allowed by the IIS protocol is now available. IRAF", +"V2.11.4 or later client tasks (and CDL library) are required to take", +"advantage of this frames. All changes are backwards compatible, older", +"versions of IRAF will continue to work but cannot access more than the", +"original four frames. The new DISPLAY task will automatically sense", +"whether the display server being used supports 16 frames or the original 4", +"and adjust the 'frame' parameter maximum accordingly. The changes are", +"fully backwards compatible for other servers.", +"<p>", +"More frames are possible if needed but will require further changes to the", +"client IRAF code to be effective. Allowing creation of more than 16", +"frames by the Load panel can be done independently but would also require", +"numerous code change to XImtool. Please contact site support if there is", +"a need for this, or for workaround suggestions depending on your", +"application.", +"", +"", +"<h2><a name=#comline>Command-line Options</a></h2>", +" The following command-line options are currently recognized:", +"<pre>", +" <b>-basePixel</b> &lt;num&gt Base colormap pixel number", +" <b>-cmap1</b> &lt;file&gt User cmap 1 ", +" <b>-cmap2</b> &lt;file&gt User cmap 2 ", +" <b>-cmapDir1</b> &lt;dir&gt User cmapDir 1 ", +" <b>-cmapDir1</b> &lt;dir&gt User cmapDir 2 ", +" <b>-cmapInitialize</b> &lt;bool&gt Initialize colormap at startup", +" <b>-cmapName</b> &lt;name&gt Private colormap name ", +" <b>-config</b> &lt;num&gt Initial config number", +" <b>-defgui</b> Print default GUI to stdout", +" <b>-displayPanner</b> &lt;bool&gt Display panner box", +" <b>-displayCoords</b> &lt;bool&gt Display wcs coords box", +" <b>-fifo</b> &lt;pipe&gt Fifo pipe to use", +" <b>-fifo_only</b> Use fifo pipes only ", +" <b>-gui</b> &lt;file&gt GUI file to use ", +" <b>-help</b> Print command-line summary ", +" <b>-imtoolrc</b> &lt;file&gt Frame buffer configuration file ", +" <b>-inet_only</b> Use inet sockets only ", +" <b>-invert</b> Invert colormap on startup?", +" <b>-ismdev</b> ISM socket template", +" <b>-maxColors</b> &lt;num&gt Number of colors ", +" <b>-memModel</b> &lt;type&gt Memory model (fast,small,beNiceToServer)", +" <b>-nframes</b> &lt;num&gt Number of frames at startup", +" <b>-port</b> &lt;num&gt Inet port to use", +" <b>-printConfig</b> &lt;file&gt Printer configuration file ", +" <b>-port_only</b> Use inet sockets only ", +" <b>-tile</b> Tile frames on startup?", +" <b>-unix</b> &lt;name&gt Unix socket to use", +" <b>-unix_only</b> Use unix sockets only ", +" &lt;<b>file</b>&gt File to load on startup", +"</pre>", +"<hr>", +"<h2><a name=#markers>Markers</a></h2>", +"<h3><a name=#panner>Panner Marker</a></h3>", +"<p>", +"The panner window always displays the full frame buffer. Try setting the", +"frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and", +"then displaying a square image (e.g. dev$pix) and the panner will show you", +"exactly where the image has been loaded into the frame.", +"<p>", +"The panner window uses two markers, one for the window border and one to", +"mark the displayed region of the frame. Most of the usual marker keystrokes", +"mentioned <a href=#genmark>below</a> apply to these markers as well, e.g. ", +"you can use MB1 to reposition on the panner window within the main image ", +"display window, or to drag the region marker within the panner (pan the ", +"image). Resizing the region marker zooms the image; this is a non-aspect ", +"constrained zoom. The panner window itself can be resized by dragging a ", +"corner with MB1. Typing delete or backspace anywhere in the panner window ", +"deletes the panner.", +"<p>", +"A special case is MB2. Hitting MB2 anywhere in the panner window pans the", +"image to that point. This is analogous to typing MB2 in the main display", +"window to pan the image.", +"<p>", +"The panner marker can be disabled by defining the <i>displayPanner</i>", +"GUI resource, its size and location can be controlled using the", +"<i>pannerArea</i> and <i>pannerGeom</i> GUI resources respectively.", +"", +"<h3><a name=#magnifier>Magnifier Marker</a></h3>", +"The magnifier marker can be used to zoom in on a small area around the cursor.", +"It will be updated as the cursor moves but only for small motions (either", +"mouse movement or with the cursor movement keystrokes) to minimize the", +"impact on the system. The zoom factor is expressed as some fraction of the", +"size of the magnifier marker itself. The default zoom is 4, i.e. the area", +"in the marker represents and area in the image that's one-fourth the size", +"of the marker. Other zoom factors may be selected using the popup menu ", +"created by hitting MB1 in the marker.", +"<p>", +"By default the magnifier marker is not visible, to toggle it select the", +"<i>Magnifier</i> option from the <i>Options</i> menubar button. Alternatively,", +"for just a quick look holding down the Shift Key and MB2 Button will display", +"the marker until the button is released.", +"<p>", +"The magnifier marker can be disabled by defining the <i>displayMagnifier</i>", +"GUI resource, its size and location can be controlled using the", +"<i>magnifierArea</i>and <i>magnifierGeom</i> GUI resources respectively.", +"", +"<h3><a name=#coords>Coords Box Marker</a></h3>", +"<p>", +"Ximtool provides a limited notion of world coordinates, allowing frame", +"buffer pixel coordinates and pixel values to be converted to some arbitrary", +"client defined coordinate system. The coords box feature is used to display", +"these world coordinates as the pointer is moved about in the image window.", +"<p>", +"The quantities displayed in the coords box are X, Y, and Z: the X,Y world", +"coordinates of the pointer, and Z, the world equivalent of the pixel value", +"under the pointer. All coordinate systems are linear. The precision of a", +"displayed quantity is limited by the range of values of the associated raw", +"frame buffer value. For example, if the display window is 512x512 only 512", +"coordinate values are possible in either axis (the positional precision can", +"be increased however by zooming the image). More seriously, at most about", +"200 pixel values can be displayed since this is the limit on the range of", +"pixel values loaded into the frame buffer. If a display pixel is saturated", +"a \"+\" will be displayed after the intensity value.", +"<p>", +"The coords box is a marker (text marker) and it can be moved and resized", +"with the pointer like any other marker.", +"", +"<h3><a name=#rulers>Ruler Markers</a></h3>", +"<p>", +"Holding down the Ctrl key and the Left-Mouse-Button while moving", +"the mouse will drag out a \"ruler marker\" measuring the distance from the", +"initial point to the current mouse position. Releasing the Ctrl key before", +"lifting the mouse button will leave the marker on the display, otherwise", +"it will be erased automatically once the mouse button is released. Any", +"number of ruler markers can be created in the frame.", +"<p>", +"Distances are measured by default in image logical pixels however", +"the Right-Mouse-Button can be used inside the marker to popup a menu of", +"options:", +"", +"<dl>", +"<dt><b>Sticky</b></dt>", +" <dd>By default rulers are destroyed whenever the display changes due", +" to a pan, zoom, flip, or frame change. This option will make the", +" ruler \"sticky\" so it will not be erased, subsequent use of the menu", +" to shows this option to be \"UnSticky\" to remove this feature.</dd>", +"<dt><b>Units</b></dt>", +" <dd>Sub-menu to select the units of the display. If the ISM is enabled", +" and a WCS is present in the image and selected as one of the readout", +" options, distances may also be read out in units of arcseconds,", +" arcminutes, or degrees instead of the default logical pixels. All", +" markers created after the unit change will readout in the new units", +" as their default. </dd>", +"<dt><b>Color</b></dt>", +" <dd>Select the color of the marker.</dd>", +"<dt><b>Draw into Frame</b></dt>", +" <dd>(<i>Not Yet Implemented</i>) Draw the marker as overlay graphics", +" in the frame. Doing so will retain the marker when printing a", +" hardcopy of the display.</dd>", +"<dt><b>Destroy</b></dt>", +" <dd>Destroy the marker.</dd>", +"</dl>", +"", +"<p>", +"The marker can also be destroyed by hitting the Delete or Backspace key", +"while the cursor is in the marker. There is presently no way to move the", +"marker to a new position in the frame.", +"", +"", +"<h3><a name=#genmark>General Markers</a></h3>", +"Although ximtool doesn't do much with markers currently, they are a general", +"feature of the Gterm widget and are used more extensively in other programs", +"(e.g. the prototype IRAF science GUI applications). Ximtool uses markers", +"for the marker zoom feature discussed above, and also for the ", +"<a href=#panner>panner</a> and the <a href=#coords>coords box</a>. All ", +"markers share some of the same characteristics, so it is worthwhile learning", +"basic marker manipulation keystrokes.", +"", +"<ul>", +"<li> MB1 anywhere inside a marker may be used to drag the marker.", +"<li> MB1 near a marker corner or edge, depending on the type of marker,", +" resizes the marker.", +"<li> Shift-MB1 on the corner of most markers will rotate the marker.", +"<li> Markers stack, if you have several markers and you put one on top", +" of the other. The active marker is highlighted to tell you which of the ", +" stacked markers is active. If the markers overlap, this will be marker ", +" \"on top\" in the stacking order.", +"<li> MB2 in the body of a marker \"lowers\" the marker, i.e. moves it to", +" the bottom of the stacking order.", +"<li> Delete or backspace in a marker deletes it.", +"<li> Markers have their own translation resources and so the default", +" <a href=#keystroke>keystroke commands</a> will not be recognized when the", +" cursor is in a marker.", +"</ul>", +"", +"For example, try placing the pointer anywhere in the coords box, then press", +"MB1 and hold it down, and drag the coords box marker somewhere else on the", +"screen. You can also resize the coords box by dragging a corner, or delete", +"it with the delete or backspace key. (The <b>Initialize</b> button will get", +"the original coords box back if you delete it).", +"<p>", +"<h4><a name=#markmenu>Marker Menu Options</a></h4>", +"<ul>", +"<li> MB3 (mouse button 3) calls up the marker menu (by default).", +"<li> <b>Zoom</b> does an equal aspect zoom of the region outlined by the marker.", +" In this way you can mark a region of the image and zoom it up.", +"<li> <b>Fill</b> exactly zooms the area outlined by the marker, making it fill", +" the display window. Since the marker is not likely to be exactly square, ", +" the aspect ratio of the resultant image will not be unitary.", +"<li> <b>Print</b> prints the region outlined by the marker to the printer or", +" file currently configured by the <a href=#print>Print Panel</a>.", +"<li> <b>Save</b> saves the region outlined by the marker to the file currently", +" configured by the <a href=#save>Save Panel</a>.", +"<li> <b>Info</b> prints a description of the marked region. The text is ", +" printed in the <a href=#info>Info Panel</a>.", +"<li> <b>Unrotate</b> unrotates a rotated marker.", +"<li> <b>Color</b> is a menu of possible marker colors.", +"<li> <b>Type</b> is a menu of possible marker types. This is still a little", +" buggy and it isn't very useful, but you can use it to play with different ", +" types of markers.", +"<li> <b>Destroy</b> destroys the marker. You can also hit the delete or ", +" backspace key in a marker to destroy the marker.", +"</ul>", +"", +"<hr>", +"<h2><a name=#wcspix>Real-Time WCS/Pixel Readout</a></h2>", +"XImtool now has the ability to display the actual pixel value of an image", +"(as well as the scaled value previously shown) and the cursor position in", +"image WCS values (e.g. RA/DEC, GLAT/GLONG, etc). This is done using an", +"external task (the 'ism_wcspix.e' binary in the new distribution) to", +"access the image and pass the coordinate/pixel information to the GUI.", +"<p>", +"WCS readout is enabled by default but can be toggled or reset using the", +"<i>WCS/Pix</i> button on the Coords tab in the control panel or the <i>ISM</i>", +"toggle on the alt-gui menubar. When enabled, images currently in the", +"server or subsequently displayed will be passed to the external process", +"where they are cached for access. Cursor movements generate an event that", +"maps the current frame buffer position to a position in the cached image.", +"The ISM (ISM is Image Support Module) task then reads the image to", +"determine the pixel value (or a small table of values around the current", +"position), and computes one or more coordinates from the image position.", +"The ISM task also has access to the associated BPM images and can", +"optionally return bad pixel information during the cursor readout.", +"<p>", +"By default, the logical and world image coordinates are displayed to both", +"the Coords panel readout as well as the main display window wcsbox text", +"marker. Alternate coordinate systems (e.g. transformation of equatorial", +"to galactic coordinates or some other sky system, physical coords,", +"amplifier coords, etc) can be selected for display by hitting the", +"<i>Options</i> toggle on the Coords panel. Available coordinate systems are", +"chosen using the <i>Type</i> menu on the panel, the readout format", +"(sexigesimal, degrees, etc) using the <i>Format</i> menu, and the display to", +"the current panel or main image window using the remaining toggles for", +"each WCS. Up to four systems may be displayed at one time, the coordinate", +"panel and wcsbox marker will adjust size automatically depending on the", +"display.", +"<p>", +"By selecting the <i>BPM Data</i> toggle from the Coords.Options panel ximtool", +"is able to flag pixels in images with an associated bad pixel mask. This", +"bad pixel mask is currently assumed to be named in the image header \"BPM\"", +"keyword by convention. If the cursor passes over a bad pixel in the mask,", +"the Coords bpm display as well as the main window wcsbox will change to a", +"red background color. Only the Coords display will show the value, any", +"non-zero value will be flagged with the color change.", +"<p>", +"With the ISM enabled the Compass indicator will display a set of arrows", +"showing North-East if a WCS is available, otherwise just the current X-Y", +"axes are shown. The pixel table will display actual pixel values from the", +"image, with the ISM off the pixel table displays the scaled image values", +"from the frame buffer.", +"", +"", +"<hr>", +"<h2><a name=#curfreeze>Freezing Cursor Readout</a></h2>", +"<p>", +"Holding down the Alt key will now freeze the cursor display readout", +"and draw crosshairs on the screen at the last position. This can be used", +"for example to position the cursor but then allow the cursor to be moved to", +"another window (to enter text, start a program, whatever) without losing", +"the position information displayed on the screen.", +"", +"", +"", +"<hr>", +"<h2><a name=#autoreg>Auto-Registration of Images</a></h2>", +"<p>", +"The auto-register feature allows you specify a registration of two or", +"more display frames with an offset. When enabled, this registration is", +"maintained for all frames in the list if any one of them is panned or", +"zoomed to a new location in the frame buffer.", +"<p>", +"For example, to use this feature do the following:", +"", +"<ul>", +"<li> Enable Auto-Register (either on the Control Panel or the toolbar on the", +" alt-gui) and pan/zoom to some star of interest.", +"<li> Use Mouse-Button-2 to center the star in the frame.", +"<li> Cycle through the frames and you may see a small shift of the star. For", +" each frame, position the cursor on the star and type <b>Ctrl-o</b> to", +" offset it to the center. Repeat as necessary. Small corrections will be", +" cumulatively added so you can use the <b>Ctrl-0</b> (Ctrl-zero) peak-up", +" command to centroid each object in the frame before the <b>Ctrl-o</b>", +" offset.", +"<li> Pan around the image in one display frame, then switch frames and the new", +" frame should also be panned to the new image with the proper offset.", +"<li> A <b>Ctrl-a</b> command will toggle the feature, offsets are only allowed", +" when autoreg is enabled.", +"</ul>", +"", +"Hitting <b>Register</b> will zero the offsets, as will toggling the", +"auto-register function. What you should see is the object centered in the", +"frame and as you blink through it remains registered but the panner box", +"marker is moving around. Drag the panner around and all frames still", +"remain registered with the given offset. The control/info panels now", +"display what the offset is for each frame.", +"<p>", +"The register display list is shared with the blink list and can be set", +"using the Display control panel. By default all frames are included in", +"the list. For accessing more than four frames, use the box icon in the", +"Blink/Register box of the Display control panel to bring up a new window", +"with access to all 16 available frames.", +"", +"", +"<hr>", +"<h2><a name=#cutgraphs>Image Cut Graphics</a></h2>", +"<p>", +"XImtool now has the ability to display horizontal and vertical", +"cut-graphs of the display, these appear as \"flip-out\" panels that appear", +"on the bottom and right side of the main display window and are controlled", +"by the small <b>H</b> and <b>V</b> buttons in the lower right corner of", +"the window. When both panels are enabled the corner area of the display", +"also shows an options panel for the graphs. Current options are:", +"", +"<dl>", +"<dt><b>Better Speed</b></dt>", +" <dd>Draw the graphics so they update at the fastest possible rate.", +" This is done by subsampling pixels to produce a smoother graph", +" but without sacrificing too much accuracy.</dd>", +"<dt><b>Better Accuracy</b></dt>", +" <dd>Draw the graphics using all screen pixels to produce the most", +" accurate display. On fast modern machines this can be enabled with", +" no apparent loss of speed, however older machines may wish to use", +" this only occassionally to limit any lag in the cursor tracking.</dd>", +"<dt><b>Image Pixels</b></dt>", +" <dd>(<i>Not Yet Implemented</i>)<dd>", +"<dt><b>Jump Cursor</b></dt>", +" <dd>If enabled, large jumps of the cursor do not update the graphics", +" display, small movements around an object of interest will update", +" the display continuously.</dd>", +"<dt><b>Smooth Cursor</b></dt>", +" <dd>If enabled, all cursor movements cause the display to be updated.", +" This is another option that can be set safely on faster machines", +" but will cause a delay on slower ones.</dd>", +"<dt><b>Graphics Cursors</b></dt>", +" <dd>If enabled, the graphics cursors in either of the plots are active", +" and can be used to update the cursor readout on the main image window", +" and the complementary cut-graph. This can be used for example to", +" freeze the cursor in the main display using the Alt key (see above),", +" then moving to one of the graphics windows to perform cut graphs in", +" only one axis.</dd>", +"</dl>", +"", +"Graphs are (currently) drawn using only the scaled display values ", +"to avoid complications of accessing multiple images in a mosaic display. Both", +"plots are labeled using the frame z1/z2 values and contain cursor indicators", +"which update contuously.", +"", +"", +"<hr>", +"<h2><a name=#peakup>Peak-Up Cursor Centroid Positioning</a></h2>", +"<p>", +"Several new keystroke commands are available to reposition the", +"cursor to a centroid or min/max pixel value within a bounding box of the", +"cursor position, allowing you to approximate the position with the mouse", +"and fine tune it quickly before typing the application keystroke command.", +"The initial box size is controlled with a <b>centerBoxSize</b> GUI resource", +"(defaults to 5 pixels) but can be adjusted interactively using the", +"<b>Ctrl-[</b> and <b>Ctrl-]</b> commands to descrease/increase the box", +"size respectively. A marker will flash briefly to indicate the box size.", +"<p>", +"The <b>Ctrl-0</b> (zero) key finds either a centroid or the local maximum", +"pixel value within this box region, <b>Alt-Ctrl-0</i> (zero) will find the", +"local minimum value. In either case the cursor is reposition to the computed", +"value. The default peak-up action is to find the centroid position in the", +"box however this can be changed to find the max pixel by selection the", +"\"<a href=#ccentroid>Centroid Peaks</a>\" option from the main Display", +"control panel or by resetting the <i>peakCentroid</i> GUI resource", +"(defaults to True). ", +"<p>", +"Centroiding is done using only the scaled screen pixel values and", +"only pixels above the mean value within the box are used. It works best", +"if the box size is set appropriately, the centroid position may appear to", +"drift if the box is too large and includes too many background pixels.", +"", +"", +"<hr>", +"<h2><a name=#control>Integrated Control Panel</a></h2>", +"", +"<h3><a name=#display>Display Panel</a></h3>", +"XImtool has a control panel which can be used to exercise most of the", +"capabilities the program has for image display. The control panel can be", +"accessed either via the <b>Options</b> menu from the main window menubar, or", +"by", +"pressing the leftmost button in the row of buttons at the upper right side", +"of the display in the standard GUI (in the alternate GUI the ", +"<i>Control Bar</i> accessed by the rightmost button on the menubar", +"provides widgets for selecting the desired control panel).", +"<p>", +"The separate windows previously used for Control/Print/Load/Save/etc", +"have now been integrated into a single window with the appropriate control", +"panel selectable with a Tab widget. There are also new Tab panels for", +"setting the frame tile configuration (see below), more detailed information", +"on the server status, and selecting the WCS readout options (see below).", +"", +"<h3><a name=#cview>View Controls</a></h3>", +"<p> ", +"The <b>Frame</b> box will list only the frame buffers you currently have", +"defined. Currently, the only way to destroy a frame buffer is to change the", +"frame buffer configuration, new frame buffers (up to 4) will be created", +"automatically if requested by the client.", +"<p> ", +"The <b>text display window</b> gives the field X,Y center, X,Y scale ", +"factors, and the X,Y zoom factors. The scale factor and the zoom factor ", +"will be the same unless autoscale is enabled. The scale is in units of ", +"display pixels per frame buffer pixel, and is an absolute measure (it doesn't", +"matter whether or not <a href=#cautoscale>autoscale</a> is enabled). Zoom is", +"relative to the autoscale factor, which is 1.0 if autoscaling is disabled. ", +"This information is also presented in the <a href=#info>Info panel</a>.", +"<p> ", +"The numbers in the <b>Zoom</b> box are zoom factors. Blue numbers zoom,", +"red numbers dezoom. <b>Zoom In</b> and <b>Zoom Out</b> may be used to go to", +"larger or smaller zoom factors, e.g. \"Ctrl-5\" followed by \"Zoom In\" will get you", +"to zoom factor 10. Specific zoom factors may also be accessed directly as ", +"Control <a href=#keystrokes>keystrokes</a>, e.g. Ctrl-5 will set zoom factor 5.", +"<b>Center</b> centers the field. <b>Toggle Zoom</b> toggles between the ", +"current zoom/center values, and the unzoomed image.", +"<p> ", +"<b>Aspect</b> recomputes the view so that the aspect ratio is 1.0. ", +"Aspect also integerizes the zoom factor (use the version in the View menu ", +"if you don't want integerization).", +"<p> ", +"<b>Fit Frame</b> makes the display window the same size as the frame ", +"buffer. Note that <a href=#cautoscale>autoscale</a> has much the same effect,", +"and allows you to resize the display window to any size you want, or view ", +"images to large to fit on the screen.", +"", +"<h3><a name=#cenhance>Enhancement Controls</a></h3>", +"", +"<p> ", +"At the top is a scrolled list of all the <a href=#cbltin>available ", +"colormaps</a>. Click on the one you want to load it. You can add your own", +"<a href=#cuser>colormaps</a> to this list.", +"<p> ", +"The two sliders adjust the <b>contrast</b> (upper slider) and ", +"<b>brightness</b> (lower slider) of the display. The <b>Invert</b> button ", +"inverts the colormap (multiples the contrast by -1.0). Note that due to the", +"use of the private colormap the sliders are a bit sluggish when dragged to ", +"window the display. If this is annoying, using MB3 in the display window is", +"faster.", +"<p>", +"The <b>Normalize</b> button (on the bottom of the control panel) will ", +"normalize the enhancement, i.e. set the contrast and brightness to the default", +"one-to-one values (1.0, 0.5). This is the preferred setting for many of the", +"pseudocolor colortables and for private colormaps loaded from disk images.", +"", +"<h3><a name=#cblink>Blink Controls</a></h3>", +"<p>", +"<b>Blink frames</b> is the list of frames to be blinked. When blink mode is", +"in effect ximtool just cycles through these frames endlessly, pausing", +"\"blink rate\" seconds between each frame. The same frame can be entered in", +"the list more than once. To program an arbitrary list of blink frames,", +"hit the Reset button and click on each blink frame button until it is set", +"to the desired frame number. The main control panel allows only the", +"original four frames to be specified in the blink list, however access to", +"the full list of 16 frames now supported is gained using the box icon", +"button next the the <b>Reset</b> button to bring up a new control panel.", +"<p>", +"The <b>Blink Rate</b> can be adjusted as slow or as fast as you want using", +"the arrow buttons. If you set the blink rate small enough it will go to", +"zero, enabling single step mode (see below).", +"<p>", +"The <b>Register</b> button registers all the blink frames with the current", +"display frame. Frames not in the blink list are not affected.", +"<p>", +"The <b>Match LUTs</b> button sets the enhancement of all blink frames to", +"the same values as the display frame. Frames not in the blink list are not", +"affected.", +"<p>", +"The <b>Blink</b> button turns blink on and off. When the blink rate is set", +"to zero the Blink button will single step through the blink frames, one", +"frame per button press.", +"<p>", +"<b>NOTE:</b> You can blink no matter what ximtool options are in effect,", +"but many of these will slow blink down. To get the fastest blink you may", +"want to turn off the panner and coords box, and match the LUTs of all the", +"blink frames. All the ximtool controls are fully active during blink", +"mode, plus you can load frames etc.", +"", +"", +"<h3><a name=#copts>Options:</a></h3>", +"<dl>", +"<dt><b><a name=#cpanner>Panner</a></b></dt>", +" <dd>Toggles the display of the Panner marker.</dd>", +"<dt><b><a name=#cmagnifier>Magnifier</a></b></dt>", +" <dd>Toggles the display of the magnifier marker.</dd>", +"<dt><b><a name=#ccoords>Coords Box</a></b></dt>", +" <dd>Toggles the display of the WCS Coords Box marker.</dd>", +"<dt><b><a name=#cautoscale>Autoscale</a></b></dt>", +" <dd>If autoscale is enabled then at zoom=1, the frame buffer will", +" be automatically scaled to fit within the display window. With", +" autoscale disabled (the default), the image scale is more", +" predictable, but the image may be clipped by the display window,", +" or may not fill the display window.</dd>", +"<dt><b><a name=#cantialias>Antialias</a></b></dt>", +" <dd>When dezooming an image, i.e., displaying a large image in a", +" smaller display window, antialiasing causes all the data to be used", +" to compute the displayed image. If antialiasing is disabled then", +" image is subsampled to compute the displayed image. Antialiasing", +" can prevent subsampling from omitting image features that don't", +" fall in the sample grid, but it is significantly slower than", +" dezooming via subsampling. The default is no antialising. </dd>", +"<dt><b><a name=#ctile>Tile Frames</a></b></dt>", +" <dd>The default display mode is to view one frame at a time. In tile", +" frames mode, 2 or 4 frames may be viewed simultaneously in the", +" display window. All the usual operations (zoom and pan, colortable", +" enhancement, cursor readback, etc.) still work for each frame even", +" when in tile frames mode. </dd>", +"<dt><b><a name=#cwarnings>Warnings</a></b></dt>", +" <dd>The warnings options toggles whether you see warning dialog boxes", +" in situations like overwriting an existing file, clearing the frame", +" buffer, etc.</dd>", +"<dt><b><a name=#ccentroid>Centroid Peaks</a></b></dt>", +" <dd>If enabled, the <b>Ctrl-0</b> keystroke will reposition the cursor", +" to the computed centroid of the centroiding box, otherwise the cursor", +" is repositioned to the local maximum value within the box.</dd>", +"</dl>", +"", +"<h3><a name=#ccmap>Colormap Selection</a></h3>", +"By default XImtool will display images using either a grayscale colormap", +"if loaded by a client, or a private colormap when loading an image from", +"disk that contains a colormap. Each frame defines its own colormap so", +"you can define different colormaps or enhancements for each frame, they", +"will change automatically as you cycle through the frames.", +"", +"<h4><a name=#cbltin>Builtin Colormaps</a></h4>", +"Once loaded, the colormap may either be changed using the builtin colormap", +"menu under the <b>View</b> menu button on the main window, or from the", +"<a href=#cenhance>Enhancement</a> box on the <a href=#control>control panel</a>. Ximtool has about a dozen colormap", +"options builtin, other <a href=#cuser>user-defined colormaps</a> may ", +"optionally be loaded.", +"", +"<h4><a name=#cuser>User-defined Colormaps</a></h4>", +"The cmap[12] and cmapDir[12] resources (or <a href=#comline>command line", +"arguments</a> are used to tell ximtool which specific colormaps to make", +"available or where to look for colortables respectively. The colortables", +"are loaded when ximtool starts up, or when it is reinitialized (e.g. by", +"pressing the <b>Initialize</b> button in the <a href=#control>control ", +"panel</a>). Ximtool will ignore any files in the colormap directory", +"which do not look like colortables. New colortables will also be added", +"for each images loaded from disk.", +"<p>", +"The format of a user lookup table is very simple: each row defines one", +"colortable entry, and consists of three columns defining the red, green,", +"and blue values scaled to the range 0.0 (off) to 1.0 (full intensity).", +"<pre>", +" R G B", +" R G B", +" (etc.)", +"</pre>", +"Blank lines and comment lines (# ...) are ignored.", +"<p>", +"Usually 256 rows are provided, but the number may actually be anything in", +"the range 1 to 256. Ximtool will interpolate the table as necessary to", +"compute the colortable values used in Ximtool. Ximtool uses at most 201", +"colors to render pixel data, so it is usually necessary to interpolate the", +"table when it is loaded.", +"<p>", +"The name of the colortable as it will appear in the Ximtool control panel", +"is the root name of the file, e.g., if the file is \"rainbow.lut\" the ", +"colortable name will be \"rainbow\". Lower case names are suggested to avoid", +"name collisions with the builtin colortables. Private colormaps for disk", +"images will be have the same name as the image loaded. If the same colortable", +"file appears in multiple user colortable directories, the first one will be", +"used.", +"<p>", +"The directory \"luts\" in the ximtool source directory contains a sample set", +"of colortable files. This can be installed as /usr/local/lib/imtoolcmap", +"when ximtool is installed.", +"", +"<hr>", +"<h2><a name=#load>Load Panel</a></h2>", +"The Load Panel allows you load images from disk directly to the frame", +"buffer, this is analogous to loading an image on the command line except", +"that browsing is possible. At present recognized formats include IRAF OIF", +"format (i.e. <i>.imh</i> extension), simple FITS files, GIF, and Sun", +"rasterfiles. The task will automatically sense the format of the image", +"and load it appropriately. Images with private colormaps (such as GIF)", +"will be loaded using the private colormap (meaning that changing the", +"brightness/contrast enhancements will render an apparently random-colored", +"image), all others will be loaded with a grayscale colormap. ", +"<p>", +"When loading new images the frame buffer configuration table will be", +"searched for a frame buffer that is the same size or larger than the new", +"image size, if no frame buffer can be found a custom buffer exactly the", +"size of the image will be created. This means that the image may not fill", +"the display window when loaded, or you may see a subsection of the image", +"in the main display window. Setting the", +"<a href=#cautoscale><b>autoscale</b></a> option on the main", +"Display panel will scale the entire image to fit the main display window,", +"the full frame buffer will always be visible in the Panner marker window.", +"<p>", +"Images with more colors than can be displayed will automatically be", +"quantized to the number of available colors before display. If the", +"<b>Auto Grayscale</b> button is enabled any image colormap will be", +"converted to grayscale and loaded as the standard grayscale colormap.", +"<p>", +"Formats which permit pixels larger than 8-bits/pixel will be sampled on", +"a grid to determine an optimal range in the data to be used to compute a", +"linear transformation to the number of display colors. This is the same", +"z-scale sampling and transformation used by the IRAF <b>DISPLAY</b> task", +"when computing the <b>z1/z2</b> values and provides a much better initial", +"display than simple truncation to 8-bits. This scaling will be done", +"automatically using a grid of <b>Nsample</b> points if the <b>Zscale</b>", +"option is enabled. Otherwise, if the <b>Zrange</b> option is set the full", +"data range will be used to scale the image. Lastly, is neither <b>Zscale</b>", +"nor <b>Zrange</b> are enabled, the z1/z2 values may be set explicitly using", +"the options box.", +"", +"<h3><a name=#lbrowse>Directory Browsing</a></h3>", +"The load panel contains a list of files in the current directory that may", +"be selected for loading by selecting with left mouse button. If the file", +"is a directory the contents of the new directory will be loaded, if it's a", +"plain file an attempt will be made to load it as an image otherwise an", +"error popup will appear. Directories in the list are identified with a", +"trailing '/' character, you will always see any subdirectories listed even", +"if a filter is specified.", +"<p>", +"The <b>Root</b> button will reset the current directory to the system root", +"directory. The <b>Home</b> button will reset the current directory to the", +"user's login directory, the <b>Up</b> button moves up one directory level, and", +"<b>Rescan</b> reloads the file list by rescanning the directory. The current", +"working directory is given below the file selection window.", +"<p>", +"Selecting the <b>List Image Headers</b> option will change the display text", +"to list all images in the current directory which match the filename filter.", +"Directory browsing is disabled while this option is in effect.", +"", +"<h3><a name=#lpattern>File Patterns</a></h3>", +"By default all files and directories will be listed. You may specify a", +"filter to select only those files with a given extension such as", +"\"*.fits\" using the <b>Filter</b> text box. Directories will", +"always be seen in the list and are identified with a trailing '/'", +"character. Any valid unix pattern matching string will be recognized, ", +"multiple templates may be specified in a comma-delimited list such as", +"\"*.imh,*.fits\" to list both OIF and FITS images.", +"", +"<h3><a name=#lload>Direct File Load</a></h3>", +"If you know exactly which file you wish to load, you may enter its", +"name in the <b>Load File</b> text box and either hit &lt;cr&gt or the", +"<b>Load</b> button to load it. An absolute or relative path name may", +"be given, if a simple filename is specified it will be searched for in", +"the current working directory which is displayed in the <b>Directory</b>", +"label of the panel.", +"", +"<h3><a name=#lframe>Frame Selections</a></h3>", +"By default images will be loaded into the current frame, you may choose", +"a different frame using the Frame menu button to select from the", +"available frames.", +"", +"", +"<hr>", +"<h2><a name=#save>Save Panel</a></h2>", +"The Save Panel lets you save the current contents of the main display window ", +"to a disk file (including the Panner/Coords markers, any general graphics", +"markers, or overlay graphics displayed by the client program). Presently,", +"only the contents of the main display window may be saved, there is no", +"facility for saving the undisplayed contents of the entire frame buffer ", +"other than to enable the <a href=#cautoscale>autoscale</a> feature. A limited", +"number of formats are currently available, others will be added in future", +"versions.", +"", +"<dl>", +"<dt><b><a name=#sfname>File Name</a></b></dt>", +" <dd>The <b>File Name</b> text box allows you to enter the file name of", +" the saved file. A \"%d\" anywhere in the name will be replaced by a", +" sequence number allowing multiple frames to be saved with unique", +" names. </dd>", +"<dt><b><a name=#sformat>Format</a></b></dt>", +" <dd>The <b>Format</b> box allows you to choose the format of the image", +" to be created. Not all formats are currently implemented. The EPS", +" format is similar to the \\fIPrint\\fR option however there is no", +" annotation. </dd>", +"<dt><b><a name=#scolor>Color</a></b></dt>", +" <dd>The <b>Color</b> box lets you choose the color type of the image", +" to be created. The options will change depending on the format,", +" e.g. FITS doesn't allow color so no color options will be allowed.", +" Formats which allow 24-bit images will be written using the current", +" colormap after converting to a 24-bit image, pseudocolor images will", +" be written with the current colormap. </dd>", +"</dl>", +"<hr>", +"", +"<h2><a name=#print>Print Panel</a></h2>", +"The Print Panel allows you dump the contents of the main display window as", +"Enacpsulated Postscript to either a named printer device or to a disk file.", +"The <b>Print To</b> selects the type of output, the <b>Print Command</b>", +"box will adjust accordingly, either as a Unix printer command or as a file", +"name. A \"%d\" anywhere in the name for disk output will be replaced by a ", +"sequence number allowing multiple frames to be saved with unique names.", +"<a href=#pprinter>Selecting printers</a> from the installed list will", +"automatically change the command to be used to generate the output. This", +"command does not necessarily need to be a printer command, the ", +"<a href=#pprinter>printer configuration file</a> lets you define any command", +"string to process the image.", +"", +"<h3><a name=#pcolors>Color Options</a></h3>", +"The <b>Color</b> box lets you choose the color type of the image to be created.", +"PseudoColor or 24-bit postscript will be created using the current colormap.", +"", +"<h3><a name=#popts>Postscript Options</a></h3>", +"<dl>", +"<dt>Orientation</dt>", +" <dd> Set the page orientation.</dd>", +"<dt>Paper Size</dt>", +" <dd> Select the paper size to be used.</dd>", +"<dt>Image Scale</dt>", +" <dd> Set the scale factor used to compute the final image size.</dd>", +"</dl>", +"", +"<h3><a name=#pproc>Processing Options</a></h3>", +"<dl>", +"<dt>Auto Scale</dt>", +" <dd>The auto scale toggles whether or not the image is automatically", +" scaled to fit the page. If not enabled, the <b>image scale</b> will", +" be used to dtermine the output image size.</dd>", +"<dt>Auto Rotate</dt>", +" <dd>Auto rotate determines whether or not the image will be rotated to", +" fit on the page. When set, an image larger than the current", +" orientation will be rotated and possibly scaled to fit the page.</dd>", +"<dt>Max Aspect</dt>", +" <dd>Max Aspect takes images smaller than the page and automatically", +" increases the scale so the image fills the page in the current", +" orientation.</dd>", +"<dt>Annotate</dt>", +" <dd>The annotate option toggles whether or not the final file includes", +" annotation such as the image title, a colorbar, and axis labels.</dd>", +"</dl>", +"<h3><a name=#pprinter>Printer selection</a></h3>", +"The printer selection list lets choose the printer to be used. The printer", +"configuration file is /usr/local/lib/ximprint.cfg by default or may be reset", +"using the <em>printConfig</em> resource. The format of the file is simply", +"<pre>", +" <b>name</b> &lt tab &gt <em>command</em>", +"</pre>", +"The <b>name</b> value is what appears in the selection list and may be more", +"than a single word, the <em>command</em> can be any command that accepts EPS", +"input from a pipe, the two fields must be separated by a tab character. ", +"Normally the command will be", +"a simple 'lpr -Pfoo' or some such, but can also include converters or", +"previewers. At most 128 printer commands may be used.", +"", +"<hr>", +"<h2><a name=#info>Info Panel</a></h2>", +"The Info panel was revised to provide a greater variety of status", +"information. The type of output is controlled by the toggle buttons on", +"the bottom of the frame, however all output is kept current as the program", +"runs. Current info options include:", +"", +"<dl>", +"<dt><b>Frame</b></dt>", +" <dd>Info about the current display frame.</dd>", +"<dt><b>Server</b></dt>", +" <dd>Info about various server options, e.g. colormaps, memory model,", +" antialias type, etc.</dd>", +"<dt><b>Clients</b></dt>", +" <dd>Show currently connected clients. Lists available connection", +" channels and active ISM clients.</dd>", +"<dt><b>WCS</b></dt>", +" <dd>List all WCS and mappings for the current frame.</dd>", +"<dt><b>ISM</b></dt>", +" <dd>Log of various ISM status messages.</dd>", +"<dt><b>Imtoolrc</b></dt>", +" <dd>Show current frame buffer configuration table.</dd>", +"</dl>", +"", +"", +"<hr>", +"<h2><a name=#tileP>Tile Panel (NEW)</a></h2>", +"With the additional frames, the default tiling scheme proved inadequate.", +"A new control panel Tile frame now allows you to select from a number of", +"tile configurations, the list of frames to be tiled, a <b>fill style</b>", +"(left-to-right or top-to-bottom), as well as optional labels for each of", +"the tiles (frame number, image title or image name).", +"<p>", +"Tile configuration will make use of all frames currently selected in the", +"<b>Tile Frame</b> group in the following manner:", +"", +"<dl>", +"<dt><b>Disabled</b></dt>", +" <dd>Do not tile the display.</dd>", +"<dt><b>Manual</b></dt>", +" <dd>Tile according to <b>Manual Configuration</b> settings.</dd>", +"<dt><b>Best</b></dt>", +" <dd>Optimize layout for frame buffer aspect.</dd>", +"<dt><b>Square</b></dt>", +" <dd>Always force a square layout (2x2, 3x3, etc).</dd>", +"<dt><b>Horizontal</b></dt>", +" <dd>Preferentially tile horizontally (6 frames ==> 3x2).</dd>", +"<dt><b>Vertical</b></dt>", +" <dd>Preferentially tile vertically (6 frames ==> 2x3).</dd>", +"<dt><b>One Row</b></dt>", +" <dd>Tile all in one row (Nx1).</dd>", +"<dt><b>One Column</b></dt>", +" <dd>Tile all in one column (1xN).</dd>", +"</dl>", +"", +"", +"<hr>", +"<h2><a name=#coordsp>Coords Panel (NEW)</a></h2>", +"The Coords Panel is meant to provide a full-featured readout as well as", +"serve as a control panel for the various options. The display window", +"contains the image name/title and frame buffer info, and a selection of", +"coordinate and image pixel readouts. The intent is provide more infor-", +"mation than can fit comfortably on the main image window while still", +"taking up as little screen space as possible. To this end the <b>Options</b>", +"button is used to hide most of the feature controls when not in use", +"(see below). Other options on the main panel include:", +"", +"<dl>", +"<dt><b>WCS/Pix</b></dt>", +" <dd>Toggle the real-time WCS/pixel readout capability (i.e. the ISM", +" used to access the disk image). This must be enabled for certain", +" other options to work.</dd>", +"", +"<dt><b>Pix Table</b></dt>", +" <dd>Open a panel showing an image pixel table. The panel shows an array", +" of pixels surrounding the cursor position, either the actual pixel", +" values if the ISM is enabled, or scaled display values otherwise.", +" The size of the table may be selected from the menubar.</dd>", +"", +"<dt><b>Header</b></dt>", +" <dd>Display the current image header in a new panel. Both the entire", +" image header as well as WCS-specific parts of the header are", +" available under different tabs. This option is only active when", +" the ISM is enabled.</dd>", +"", +"<dt><b>Compass</b></dt>", +" <dd>Draw an orientation compass on the display panner. If the ISM is", +" enabled and a WCS is present in the header, the compass will", +" indicate N/E according to the WCS, otherwise the X/Y axes of the", +" image are drawn.</dd>", +"", +"<dt><b>Options</b></dt>", +" <dd>Pop-up/down the option control portion of the panel. When enabled,", +" the Coords Panel will change size to reveal the options which can be", +" changed (explained below). </dd>", +"</dl>", +"", +"The <b>Readout Values</b> group controls the selection of WCS type,", +"location and format to be displayed. The <b>Type</b> menu always", +"provides a selection of the image Logical, Physical or World systems,", +"which may be identical depending on the image header. If a World system", +"is supplied in the image addition entries for transformations to other sky", +"systems, (e.g. FK5 to ICRS or galactic/ecliptic) will also be available.", +"The selection is dependent on whether the ISM is running as well as WCS", +"information present in the image. The <b>Format</b> menu allows the", +"use to select a sexigesimal display, conversion to degrees or radians,", +"or whichever format is most natural for the coordinate being display.", +"The two toggle to the right control whether this WCS is to be displayed", +"on the <i>Panel</i> (i.e. the Coords Panel window) or the <i>ImgWin</i>", +"(i.e. the text marker on the main image window).", +"<p>", +"Other options below this group control whether or not to display the WCS", +"labels, the image name/title, and frame buffer information in the main", +"Coords Panel display. The <b>BPM Data</b> option controls whether or not the", +"ISM will try to map any bad-pixel mask associated with the image. If", +"enabled, a bad-pixel mask specified by the image header BPM keyword", +"(currently fixed by convention but this may be selectable later) will be", +"mapped along with the image. Aside from wcs/pixel readouts at each cursor", +"position, any BPM data values found will also be displayed. A non-zero", +"value will cause the BPM field of the Coords Panel readout as well as the", +"main image window marker to switch to a red background color to flag the", +"value.", +"<p>", +"The last box allows the user to specify a different ISM task to be", +"executed or to reinitialize the current one. In most cases this won't", +"need to be changed, however a custom ISM could be started when using", +"special data formats. This command string can also be controlled by the", +"application <i>ism_task</i> resource.", +"", +"", +"<hr>", +"<h2><a name=#tclshell>Tcl Interactive Shell</a></h2>", +" The <em>TclShell</em> is mostly used as a development or debugging", +"tool for the GUI. It allows the user to type commands directly to the", +"TCL interpreter letting you send messages to the object manager or execute", +"specific procedures in the TCL code that makes up the GUI. Most users will", +"never need this, but for an example of what it does, bring it up and type a", +"command such as", +"<pre>", +" send helpButton set background red", +"</pre>", +"Cool, huh.", +"<hr>", +"", +"<h2><a name=#acknowledgements>Acknowledgements</a></h2>", +" <i>XImtool</i> was developed by the IRAF Group at the National Optical", +"Astronomy Observatories in Tucson, AZ. For further information or to report", +"problems please contact <i>iraf@noao.edu</i>", +"<hr>", +"This document was last updated 11/6/96.", +"", +"</BODY>", +"</HTML>", diff --git a/vendor/x11iraf/ximtool/ximtool.man b/vendor/x11iraf/ximtool/ximtool.man new file mode 100644 index 00000000..2ca62eaf --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.man @@ -0,0 +1,2338 @@ +.\" @(#)ximtool.1 1.1 12-Aug-2001 MJF +.TH XIMTOOL 1 "12 Aug 2001" "X11IRAF Project" +.SH NAME +ximtool \- interactive image display program for the X Window System +.sp 0.5 +.SH SYNOPSIS +.B "ximtool" [\-\fItoolkitoption\fP ...] [ \fIoptions\fP ...] [\fIimagename\fP] +.sp 0.5 +.SH OPTIONS +.TP 5 +.B "-basePixel \fIN\fP" +The base colormap cell used by the colormap. This essentially allows you +to reserve \fIbasePixel\fP colors in the global colormap for other applications. +The default is 64, if changed you'll need to also specify the +\fI-cmapInitialize\fP option or resource. +.TP 5 +.B "-cmap1 \fIfile\fP" +User colormap 1. This flag allows you to specify a colormap to be made +available at task startup. +.TP 5 +.B "-cmap2 \fIfile\fP" +User colormap 2. This flag allows you to specify a second colormap to be +made available at task startup. +.TP 5 +.B "-cmapDir1 \fIdir\fP" +User colormap directory 1. Specifies a directory to be searched for colormaps. +.TP 5 +.B "-cmapDir2 \fIdir\fP" +User colormap directory 2. Specifies a directory to be searched for colormaps. +By default this points to the system directory /usr/local/lib/imtoolcmap, +allowing a set of site default colormaps to be defined here. +.TP 5 +.B "-cmapInitialize \fIbool\fP" +Initialize the ximtool colormap at startup. When setting the \fIbasePixel\fP +option or resource this is required in order to force the Gterm widget to +update its global colormap resource in the X server. The default is +\fIfalse\fP. +.TP 5 +.B "-cmapName \fIname\fP" +Name used for private colormap. The default for all IRAF imaging +applications is \fIimage\fP. Gterm widget based imaging applications +which have the same value of cmapName will share the same colormap, +minimizing colormap flashing and allowing multiple applications to be +run at the same time. +.TP 5 +.B "-config \fIN\fP" +Initial frame buffer configuration number. The default value is 1, indicating +a 512x512 frame buffer with 2 frames. See below for information on the frame +buffers. +.TP 5 +.B "-defgui" +Print the default GUI to the stdout. The GUI is a Tcl program that may be +customized by the user and reloaded using the \fI-gui\fP option or +the \fIgui\fP resource parameter. +.TP 5 +.B "-displayPanner \fIbool\fP" +Display panner marker window at startup. If set, a panner window showing +the full frame buffer will appear in the upper-right side of the main display +window. +.TP 5 +.B "-displayCoords \fIbool\fP" +Display WCS coordinate marker window at startup. If set, a coordinate +readout text marker showing will appear in the lower-right side of the main +display window. +.TP 5 +.B "-fifo \fIpipe\fP" +Specifies the name of the fifo pipe to be used, the \fIi\fP +and \fIo\fP suffixes will be added automatically. The default pipe names +will be /dev/imt1i (input pipe) and /dev/imt1o (output pipe). +.TP 5 +.B "-fifo_only" +If set, only fifo pipes will be used for communication with a client program, +sockets will be disabled. +.TP 5 +.B "-gui \fIfile\fP" +Specifies the GUI file to be used. +.TP 5 +.B "-help" +Print a summary of command line options to the screen. +.TP 5 +.B "-imtoolrc \fIfile\fP" +Specifies the frame buffer configuration file to be used. See below for +information on frame buffers. +.TP 5 +.B "-inet_only" +If set, only inet sockets will be used for communication with a client program, +fifo pipes and unix sockets will be disabled. +.TP 5 +.B "-invert" +Start XImtool using inverted colormaps. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 5 +.B "-ismdev \fIdev\fP" +Specifies the plug-in ISM connection socket. This should be a unix domain +socket of the form "\fI/tmp/.ISM%d\fP", where the \fI%d\fP will be replaced +by the user id. Once an ISM has connected this port is freed to accept +other connections. +.TP 5 +.B "-maxColors \fIN\fP" +Specify the max number of colors to be used for the display. +.TP 5 +.B "-memModel \fItype\fP" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are \fIfast\fP, \fIbeNiceToServer\fP, and \fIsmall\fP. The +default is \fIfast\fP, which uses server pixmaps to make frame blink fast. +This is recommended unless server memory is very limited. Note that even in +fast mode, the server pixmap is only the size of the display window, so memory +usage is reasonable even if the frame buffer is very large. +.TP 5 +.B "-nframes \fIN\fP" +Specifies the number of frame buffers to configure at startup. By default +there will be 2 frames available, a maximum of 4 frames are allowed. +.TP 5 +.B "-port \fIN\fP" +Specifies the port number to use when connecting through an inet socket. +.TP 5 +.B "-port_only" +Same as \fI-inet_only\fP option. If set, only inet sockets will be used for +communication with a client program. +.TP 5 +.B "-printConfig \fIname\fP" +Specifies the printer configuration file to use. By default this will be +/usr/local/lib/ximprint.cfg. See below for more information on configuring +output devices. +.TP 5 +.B "-tile" +The default display mode is to view one frame at a time. In tile frames mode, +2 or 4 frames may be viewed simultaneously in the display window. All the +usual operations (zoom and pan, colortable enhancement, cursor readback, etc.) +still work for each frame even when in tile frames mode. +.TP 5 +.B "-unix \fIname\fP" +Specifies the unix domain socket name to use. A "%d" in the filename will +be replaced with the user id. +.TP 5 +.B "-unix_only" +If set, only unix domain sockets will be used for communication with a client +program, inet sockets and fifos will be disabled. + +.SH "APPLICATION RESOURCES" +XImtool is implemented as a client program which is responsible for loading +the frame buffers/colormaps, communicating with clients, etc, and a +user-modifiable GUI file written as a Tcl script which handles all the user +interface details. The \fIclient resources\fP described below will be common +to any user-defined GUI, the \fIgui resources\fP may change depending on how +extensively the GUI has been modified by the user. Each of these components +has its own set of resources, but to the user setting them is the same as +with any other application. + +\fIGterm\fP widget resources (i.e. those for the main image window or +colorbar) may be set as either client or GUI resources. See the +\fIxgterm(1)\fP man page for a complete description of \fIGterm\fP widget +resources. + +.SS "CLIENT RESOURCES" +The client resources generally define the initial state of the application +or set configuration parameters. +.RS +.TP 25 +.B "Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 25 +defConfig +1 +.sp -0.5 +.TP 25 +defNFrames +0 +.sp -0.5 +.TP 25 +tileBorderWidth +3 +.sp -0.5 +.TP 25 +tileBorderColor +9 +.sp -0.5 +.TP 25 +autoscale +false +.sp -0.5 +.TP 25 +antialias +false +.sp -0.5 +.TP 25 +antialiasType +boxcar +.sp -0.5 +.TP 25 +tileFrames +false +.sp -0.5 +.TP 25 +highlightFrames +true +.sp -0.5 +.TP 25 +gui +default +.sp -0.5 +.TP 25 +imtoolrc +/usr/local/lib/imtoolrc +.sp -0.5 +.TP 25 +invert +false +.sp -0.5 +.TP 25 +memModel +fast +.sp -0.5 +.TP 25 +basePixel: +64 +.sp -0.5 +.TP 25 +maxColors: +216 +.sp -0.5 +.TP 25 +cmapInitialize: +false +.sp -0.5 +.TP 25 +cmap1 +none +.sp -0.5 +.TP 25 +cmap2 +none +.sp -0.5 +.TP 25 +cmapDir1 +none +.sp -0.5 +.TP 25 +cmapDir2 +/usr/local/lib/imtoolcmap +.sp -0.5 +.TP 25 +input_fifo +/dev/imt1i +.sp -0.5 +.TP 25 +output_fifo +/dev/imt1o +.sp -0.5 +.TP 25 +unixaddr +/tmp/.IMT%d +.sp -0.5 +.TP 25 +port +5137 +.sp -0.5 +.TP 25 +ism_addr +/tmp/.ISM%d +.sp -0.5 +.TP 25 +ism_task +"ism_wcspix.e wcspix &" +.RE + +Description of ximtool client resources: + +.TP 18 +.B "defConfig" +Default frame buffer configuration number on startup. See below for more +information on frame buffers. +.TP 18 +.B "defNFrames" +Default number of frames on startup. Set to zero to use the value from +the frame buffer configuration (\fIimtoolrc\fP) file. +.TP 18 +.B "tileBorderWidth" +.sp -0.5 +.TP 18 +.B "tileBorderColor" +Used by the tile frames option. Specifies how far +apart to space the frames in tile frames mode. +Color "9" refers to the Gterm widget resource color9, +which is assigned a color with its own resource. +.TP 18 +.B "autoscale" +Enable/disable the autoscale option. +.TP 18 +.B "antialias" +Enable/disable the antialias option. +.TP 18 +.B "antialiasType" +Type of antialiasing. Options include \fIboxcar\fP (default), \fIbilinear\fP, +\fInearest\fP, \fIarea\fP, \fIblkavg\fP, \fIlowpass\fP, and \fIgaussian\fP. +.TP 18 +.B "tileFrames" +Enable/disable the tile frames option. +.TP 18 +.B "highlightFrames" +Determines whether the current frame is highlighted when in tile frames mode. +.TP 18 +.B "gui" +The GUI to be executed. "default" refers to the default, builtin ximtool GUI. +You can replace this with your own GUI file if you are bold enough, and +completely change the look and functionality of the GUI if desired. +.TP 18 +.B "imtoolrc" +Where to find the imtoolrc file. This defines the +recognized frame buffer configurations. +.TP 18 +.B "invert" +Start Ximtool using an inverted colormap. When set, a "normalized" display +will always be the inverse of the selected colormap. +.TP 18 +.B "memModel" +Determines how ximtool uses memory in the ximtool client and the X server. +The options are \fIfast\fP, \fIbeNiceToServer\fP, and \fIsmall\fP. +The default is \fIfast\fP, which uses server pixmaps to make frame blink fast. +This is recommended unless server memory is very limited. Note that even in +fast mode, the server pixmap is only the size of the display window, so +memory usage is reasonable even if the frame buffer is very large. +.sp -0.5 +.TP 18 +.B "basePixel" +.sp -0.5 +.TP 18 +.B "maxColors" +These two resources determine the region of colormap space used to +render image pixels. +.TP 18 +.B "cmapInitialize" +Initialize the ximtool colormap at startup. This is a required resource to +clear a previous ximtool colormap allowing a new \fBbasePixel\fP and +\fBmaxColors\fP to take effect. +.TP 18 +.B "cmap1" +.sp -0.5 +.TP 18 +.B "cmap2" +User colormap files. The intent here is to allow individual colormaps to be +conveniently specified as a resource. +.TP 18 +.B "cmapDir1" +.sp -0.5 +.TP 18 +.B "cmapDir2" +User or system colormap directories. By default cmapDir2 points to the system +directory /usr/local/lib/imtoolcmap, allowing a set of site default colormaps +to be defined here. This leaves cmapDir1 available to a user colormap +directory. +.TP 18 +.B "input_fifo" +.sp -0.5 +.TP 18 +.B "output_fifo" +The input and output fifos for fifo i/o. "Input" and "output" are from the +client's point of view. Note that only one display server can use a +fifo-pair at one time. +.TP 18 +.B "unixaddr" +Template address for unix domain socket. The user must have write permission +on this directory, or the file must already exist. \fI%d\fP, if given, +is replaced by the user's UID. +.TP 18 +.B "port" +TCP/IP port for the server. Note that only one server can listen on a port +at one time, so if multiple ximtool servers are desired on the same +machine, they should be given different ports. +.TP 18 +.B "ism_addr" +Template address for ISM unix domain socket. The user must have write +permission on this directory, or the file must already exist. \fI%d\fP, +if given, is replaced by the user's UID. +.TP 18 +.B "ism_task" +Command string to execute for the real-time pixel and WCS readout ISM +(Image Support Module) task. + +.SS "GUI RESOURCES" + +In principle ximtool can have any number of different GUIs, each of which +defines its own set of resources. GUIs typically define a great many +resources, but most of these are not really intended for modification by +the user (although one can modify them if desired). + +The following are some of the more useful resources used by the default +ximtool GUI. The \fIimagewin\fR resources are Gterm widget resources. +.RS + +.TP -10 +.B Main Display Gterm Widget Resources +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + *imagewin.cmapName: +image +.sp -0.5 +.TP 35 + *imagewin.basePixel: +64 +.sp -0.5 +.TP 35 + *imagewin.warpCursor: +True +.sp -0.5 +.TP 35 + *imagewin.raiseWindow: +True +.sp -0.5 +.TP 35 + *imagewin.deiconifyWindow: +True +.sp -0.5 +.TP 35 + *imagewin.ginmodeCursor: +circle +.sp -0.5 +.TP 35 + *imagewin.ginmodeBlinkInterval: +500 +.sp -0.5 +.TP 35 + *imagewin.color0 (background): +black +.sp -0.5 +.TP 35 + *imagewin.color1 (foreground): +white +.sp -0.5 +.TP 35 + *imagewin.color8 (panner highlight): +#7c8498 +.sp -0.5 +.TP 35 + *imagewin.color9 (tileFrame color): +SteelBlue +.sp -0.5 +.TP 35 + *imagewin.width: +512 +.sp -0.5 +.TP 35 + *imagewin.height: +512 + +.TP -10 +.B GUI Resources + +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + *autoscale: +True +.sp -0.5 +.TP 35 + *zoomfactors: +1 2 4 8 +.sp -0.5 +.TP 35 + *displayCoords: +True +.sp -0.5 +.TP 35 + *displayPanner: +True +.sp -0.5 +.TP 35 + *displayMagnifier: +True +.sp -0.5 +.TP 35 + *blinkRate: +1.0 +.sp -0.5 +.TP 35 + *pannerArea: +150*150 +.sp -0.5 +.TP 35 + *pannerGeom: +-5+5 +.sp -0.5 +.TP 35 + *magnifierArea: +100*100 +.sp -0.5 +.TP 35 + *magnifierGeom: ++5+5 +.sp -0.5 +.TP 35 + *wcsboxGeom: +-5-5 +.sp -0.5 +.TP 35 + *maxContrast: +5.0 +.sp -0.5 +.TP 35 + *warnings: +True +.sp -0.5 +.TP 35 + *centerBoxSize: +5 +.sp -0.5 +.TP 35 + *peakCentroid: +True + +.TP -10 +.B Alternate GUI Resources +.TP 35 +.B " Resource Name" +\fBDefault Value\fP +.sp -0.5 +.TP 35 + *showToolBar: +False +.sp -0.5 +.TP 35 + *showPanelBar: +False +.RE + +Description of selected resources: + +.TP 22 +.B "*cmapName" +Name used for private colormap. The default for all IRAF imaging applications +is "image". Gterm widget based imaging applications which have the same value +of cmapName will share the same colormap, minimizing colormap flashing and +allowing multiple applications to be run at the same time. +.TP 22 +.B "*basePixel" +The base colormap cell used by the display colormap. +.TP 22 +.B "*imagewin.warpCursor" +Warp pointer into image window when initiating a cursor read. +.TP 22 +.B "*imagewin.raiseWindow" +Raise image window when initiating a cursor read. +.TP 22 +.B "*imagewin.deiconifyWindow" +Deiconify image window if necessary when initiating a cursor read. +.TP 22 +.B "*imagewin.ginmodeCursor" +Type of cursor when a cursor read is in progress. The default is a +circle. Any selection from the X cursor font can be used. A special +case is "full_crosshair" which is the full crosshair cursor of the +Gterm widget. +.TP 22 +.B "*imagewin.ginmodeBlinkInterval" +Determines whether the cursor blinks when a cursor read is in progress. +The value is given in milliseconds. +.TP 22 +.B "*imagewin.color0" +Background color. +.TP 22 +.B "*imagewin.color1" +Foreground color. +.TP 22 +.B "*imagewin.color8" +Color assigned the panner window. +.TP 22 +.B "*imagewin.color9" +Color used for the tileFrames highlight. +.TP 22 +.B "*imagewin.width" +Width of the main image window. +.TP 22 +.B "*imagewin.height" +Height of the main image window. +.TP 22 +.B "*pannerArea" +Area in pixels of the panner window. +.TP 22 +.B "*pannerGeom" +Where to place the panner window. +.TP 22 +.B "*wcsboxGeom" +Where to place the coords box. +.TP 22 +.B "*maxContrast" +Maximum contrast value. + + +.SH DESCRIPTION + +As a display server, XImtool is started as a separate process from client +software such as IRAF. Once it is running it will accept client connections +simultaneously on fifo pipes, unix domain sockets, or inet sockets. A +display client like the IRAF \fIDISPLAY\fP task makes a connection and sends +the image across using a modified IIS Model 70 protocol. Once the image is +loaded in the display buffer it may be enhanced, saved to a disk file in a +number of different formats, or printed as Encapsulated Postscript to a +printer or disk file. Up to sixteen frame buffers are allowed, these may be +displayed simultaneously in a tiled mode, or blinked frame-to-frame. +Each frame may have its own colormap or brightness/contrast enhancement. +Pan/Zoom and cursor readout are permitted using \fImarkers\fP, on-line help +is also available. + +When run in standalone mode, images (currently IRAF OIF, GIF, Sun Rasterfiles +or simple FITS (i.e. excluding MEF files) formats are permitted) may be +loaded on the command line or by using the Load Panel. This allows you to +browse images and perform the same manipulations as if they had been displayed +by a client. + +.SS "MOUSE OPERATIONS" + +Clicking and dragging MB1 (mouse button 1) in the main image window creates +a rectangular region marker, used to select a region of the image. If you do +this accidentally and don't want the marker, put the pointer in the marker +and type DELETE or BACKSPACE to delete the marker. With the pointer in the +marker, MB3 will call up a marker menu listing some things you can do with +the marker, like zoom the outlined region. MB1 can be used to drag or resize +the marker. See below for more information on markers. + +Clicking on MB2 in the main image window pans (one click) or zooms (two +clicks) the image. Further clicks cycle through the builtin zoom factors. +Moving the pointer to a new location and clicking moves the feature under +the pointer to the center of the display window. Holding down the Shift +key while clicking MB2 will cause a full-screen crosshair cursor to appear +until the button is released, this can be useful for fine positioning of the +cursor. + +MB3 is used to adjust the contrast and brightness of the displayed image. +The position of the pointer within the display window determines the +contrast and brightness values. Click once to set the values corresponding +to the pointer location, or click and drag to continuously adjust the +display. + +.SS "KEYSTROKE ACCELERATORS" + +The following keystrokes are currently defined in the GUI: + +.RS +-------------------- \fBMisc Functions\fP --------------------- +.sp -0.2 +.TP 20 +.B "Ctrl-b" +Previous (back) frame +.sp -0.5 +.TP 20 +.B "Ctrl-c" +Center frame +.sp -0.5 +.TP 20 +.B "Ctrl-f" +Forward frame +.sp -0.5 +.TP 20 +.B "Ctrl-i" +Invert colormap +.sp -0.5 +.TP 20 +.B "Ctrl-m" +Toggle magnifier +.sp -0.5 +.TP 20 +.B "Ctrl-n" +Normalize +.sp -0.5 +.TP 20 +.B "Ctrl-p" +Toggle panner +.sp -0.5 +.TP 20 +.B "Ctrl-r" +Register +.sp -0.5 +.TP 20 +.B "Ctrl-s" +Match LUT scaling +.sp -0.5 +.TP 20 +.B "Ctrl-t" +Tile frames toggle +.sp -0.5 +.TP 20 +.B "Ctrl-u" +Unzoom (zoom=1) +.sp -0.5 +.TP 20 +.B "Ctrl-x" +Flip X +.sp -0.5 +.TP 20 +.B "Ctrl-y" +Flip Y +.TP 20 +.B "Ctrl-=" +Print using current setup +.sp -0.5 +.TP 20 +.B "Ctrl-<" +Decrease blink rate (blink faster) +.sp -0.5 +.TP 20 +.B "Ctrl->" +Increase blink rate (blink slower) +.sp -0.5 +.TP 20 +.B "Ctrl-+" +Zoom in +.sp -0.5 +.TP 20 +.B "Ctrl--" +Zoom out +.TP 20 +.B "Alt-1 thru Alt-4" +Set frame to be displayed +.sp -0.5 +.TP 20 +.B "Ctrl-1 thru Ctrl9" +Set integer zoom factor +.TP 20 +.B "Ctrl-Alt-q" +Quit +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-f" +Fitframe +.TP -12 +--------------------- \fBPanel Toggles\fP --------------------- +.sp -0.2 +.TP 20 +.B "Alt-b" +Blink frames +.sp -0.5 +.TP 20 +.B "Alt-c" +Control panel +.sp -0.5 +.TP 20 +.B "Alt-h" +Help popup +.sp -0.5 +.TP 20 +.B "Alt-i" +Info box popup +.sp -0.5 +.TP 20 +.B "Alt-l" +Load file popup +.sp -0.5 +.TP 20 +.B "Alt-p" +Print popup +.sp -0.5 +.TP 20 +.B "Alt-s" +Save popup +.sp -0.5 +.TP 20 +.B "Alt-t" +TclShell popup +.sp 0.5 +.TP -12 +------------------- \fBCursor Positioning\fP ------------------ +.sp -0.2 +.TP 28 +.B "Ctrl-h / Ctrl-Left" +Move cursor one pixel left +.sp -0.5 +.TP 28 +.B "Ctrl-j / Ctrl-Down" +Move cursor one pixel down +.sp -0.5 +.TP 28 +.B "Ctrl-k / Ctrl-Up" +Move cursor one pixel up +.sp -0.5 +.TP 28 +.B "Ctrl-l / Ctrl-Right" +Move cursor one pixel right +.TP 28 +.B "Shift-Ctrl-h / Shift-Ctrl-Left" +Move cursor ten pixels left +.sp -0.5 +.TP 28 +.B "Shift-Ctrl-j / Shift-Ctrl-Down" +Move cursor ten pixels down +.sp -0.5 +.TP 28 +.B "Shift-Ctrl-k / Shift-Ctrl-Up" +Move cursor ten pixels up +.sp -0.5 +.TP 28 +.B "Shift-Ctrl-l / Shift-Ctrl-Right" +Move cursor ten pixels right +.sp 0.5 +.TP -12 +------------------- \fBAuto-Registration\fP ------------------- +.sp -0.2 +.TP 20 +.B "Ctrl-a" +Toggle auto-registration +.sp -0.5 +.TP 20 +.B "Ctrl-o" +Set frame offset +.sp 0.5 +.TP -12 +-------------------- \fBFrame Positioning\fP ------------------ +.sp -0.2 +.TP 20 +.B "Ctrl-Left" +Shift one full frame left +.sp -0.5 +.TP 20 +.B "Ctrl-Down" +Shift one full frame down +.sp -0.5 +.TP 20 +.B "Ctrl-Up" +Shift one full frame up +.sp -0.5 +.TP 20 +.B "Ctrl-Right" +Shift one full frame right +.TP 20 +.B "Ctrl-Alt-Left" +Shift one half frame left +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-Down" +Shift one half frame down +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-Up" +Shift one half frame up +.sp -0.5 +.TP 20 +.B "Ctrl-Alt-Right" +Shift one half frame right +.sp 0.5 +.TP -12 +------------------- \fBPeak-Up Centroiding\fP ----------------- +.sp -0.2 +.TP 20 +.B "Ctrl-[" +Decrease centroiding box size +.sp -0.5 +.TP 20 +.B "Ctrl-]" +Increase centroiding box size +.sp -0.5 +.TP 20 +.B "Ctrl-0 (zero)" +Centroid/find local maximum +.sp -0.5 +.TP 20 +.B "Alt-Ctrl-0 (zero)" +Find local minimum +.sp 0.5 +.TP -12 +------------------ \fBMouse Button Events\fP ------------------ +.sp -0.2 +.TP 20 +.B "Shift-Btn1Down" +Turn on magnifier +.sp -0.5 +.TP 20 +.B "Shift-Btn1Up" +Turn off magnifier +.sp -0.5 +.TP 20 +.B "Shift-Btn2Down" +Turn on crosshair cursor +.sp -0.5 +.TP 20 +.B "Shift-Btn2Up" +Turn off crosshair cursor +.TP 20 +.B "Btn1Down" +Create a Marker +.sp -0.5 +.TP 20 +.B "Btn1Motion" +Resize marker being created +.sp -0.5 +.TP 20 +.B "Btn2Down" +Zoom/center on cursor position +.sp -0.5 +.TP 20 +.B "Btn3Down/Motion" +Brightness/contrast scale the image +.TP 20 +.B "Ctrl-Btn1Down" +Create Ruler Marker +.sp -0.5 +.TP 20 +.B "Ctrl-Btn1Motion" +Resize Ruler Marker being created +.sp -0.5 +.TP 20 +.B "Ctrl-Btn1Up" +Destroy Ruler Marker +.TP 20 +.B "Alt-Motion" +Freeze cursor readout +.RE + +.LP +\fBNOTE:\fP These keystrokes only work with the cursor in the main image +window, only a few of the commands are implemented to work within subwindows +or markers to avoid conflicts with translations for those objects. If a +command does not work, check the cursor location and try it again in the +main display window. + +.SH "FRAME BUFFER CONFIGURATIONS" + +XImtool starts up using default frame buffer size of 512x512 pixels, two +(of 16 possible) frames will be created. When loading disk images (i.e. +run in standalone mode) the frame buffer configuration file will be +searched for a defined frame buffer that is the same size or larger than +the current image, if no suitable buffer can be found a custom frame +buffer the same size as the image will be created in an unused portion of +the configuration table. When used as a display server the frame buffer +configuration number is passed in by the client and loaded explicitly even +if it means clipping the image. If a new frame buffer is a different size +than previously defined frames, all available frames will be initialized +and cleared prior to the display. The default frame buffer configuration +file is /usr/local/lib/imtoolrc, this can be overridden by defining a +IMTOOLRC environment variable naming the file to be used, by creating a +.imtoolrc file in your home directory, or a new file may be specified +using the \fI-imtoolrc\fR command line flag or \fIimtoolrc\fR application +resource. + +The format of the frame buffer configuration file is + + \fIconfigno nframes width height [extra fields]\fP + e.g. + 1 2 512 512 + 2 2 800 800 + 3 1 1024 1024 # comment + : : : : + +At most 128 frame buffer sizes may be defined, each configuration may define +up to 16 frames, configuration numbers need not be sequential. + +.LP +\fBNOTE:\fR When defining a new frame buffer for use with client software +such as IRAF the user must also remember to define those frame buffers in +the IRAF \fIdev$graphcap\fR file. + +.SS "SUPPORT FOR 16 DISPLAY FRAMES" + +As part of the extensive GUI changes with the V1.3 release, support for +the full 16 frames allowed by the IIS protocol is now available. IRAF +V2.11.4 or later client tasks (and CDL library) are required to take +advantage of this frames. All changes are backwards compatible, older +versions of IRAF will continue to work but cannot access more than the +original four frames. The new DISPLAY task will automatically sense +whether the display server being used supports 16 frames or the original 4 +and adjust the 'frame' parameter maximum accordingly. The changes are +fully backwards compatible for other servers. + +More frames are possible if needed but will require further changes to the +client IRAF code to be effective. Allowing creation of more than 16 +frames by the Load panel can be done independently but would also require +numerous code change to XImtool. Please contact site support if there is +a need for this, or for workaround suggestions depending on your +application. + +.SH "MARKERS" + +Although ximtool doesn't do much with markers currently, they are a general +feature of the \fIGterm\fP widget and are used more extensively in other +programs (e.g. the prototype IRAF science GUI applications). XImtool uses +markers for the marker zoom feature discussed above, and also for the panner +and the coords box. All markers share some of the same characteristics, so it +is worthwhile learning basic marker manipulation keystrokes. +.TP 3 +\fBo\fP +MB1 anywhere inside a marker may be used to drag the marker. +.TP 3 +\fBo\fP +MB1 near a marker corner or edge, depending on the type of marker, +resizes the marker. +.TP 3 +\fBo\fP +Shift-MB1 on the corner of most markers will rotate the marker. +.TP 3 +\fBo\fP +Markers stack, if you have several markers and you put one on top of +the other. The active marker is highlighted to tell you which of the +stacked markers is active. If the markers overlap, this will be marker +"on top" in the stacking order. +.TP 3 +\fBo\fP +MB2 in the body of a marker "lowers" the marker, i.e. moves it to the +bottom of the stacking order. +.TP 3 +\fBo\fP +Delete or backspace in a marker deletes it. +.TP 3 +\fBo\fP +Markers have their own translation resources and so the default +keystroke commands will not be recognized when the cursor is in a marker. + +For example, try placing the pointer anywhere in the coords box, then press +MB1 and hold it down, and drag the coords box marker somewhere else on the +screen. You can also resize the coords box by dragging a corner, or delete +it with the delete or backspace key. (The Initialize button will get the +original coords box back if you delete it, or you can reset the toggle in +the control panel). + +.SS "PANNER MARKER" + +The panner window always displays the full frame buffer. Try setting the +frame buffer configuration to a nonsquare frame buffer (e.g. imtcryo) and +then displaying a square image (e.g. dev$pix) and the panner will show you +exactly where the image has been loaded into the frame. + +The panner window uses two markers, one for the window border and one to +mark the displayed region of the frame. Most of the usual marker keystrokes +mentioned below apply to these markers as well, e.g. you can use MB1 to +reposition on the panner window within the main image display window, or to +drag the region marker within the panner (pan the image). Resizing the +region marker zooms the image; this is a non-aspect constrained zoom. The +panner window itself can be resized by dragging a corner with MB1. Typing +delete or backspace anywhere in the panner window deletes the panner. + +A special case is MB2. Hitting MB2 anywhere in the panner window pans the +image to that point. This is analogous to hitting MB2 in the main display +window to pan the image. + +The panner marker can be disabled by defining the \fIdisplayPanner\fP +GUI resource, its size and location can be controlled using the +\fIpannerArea\fP and \fIpannerGeom\fP GUI resources respectively. + +.SS "MAGNIFIER MARKER" + +The magnifier marker can be used to zoom in on a small area around the +cursor. +It will be updated as the cursor moves but only for small motions (either +mouse movement or with the cursor movement keystrokes) to minimize the +impact on the system. The zoom factor is expressed as some fraction of the +size of the magnifier marker itself. The default zoom is 4, i.e. the area +in the marker represents and area in the image that's one-fourth the size +of the marker. Other zoom factors may be selected using the popup menu +created by hitting MB1 in the marker. + +By default the magnifier marker is not visible, to toggle it select the +\fIMagnifier\fR option from the \fIOptions\fR menubar button. Alternatively, +for just a quick look holding down the Shift and MB2 buttons will display +the marker until the button is released. + +The magnifier marker can be disabled by defining the \fIdisplayMagnifier\fP +GUI resource, its size and location can be controlled using the +\fImagnifierArea\fP and \fImagnifierGeom\fP GUI resources respectively. + +.SS "COORDS BOX MARKER" + +XImtool provides a limited notion of world coordinates, allowing frame +buffer pixel coordinates and pixel values to be converted to some arbitrary +linear client-defined coordinate system. The coords box feature is used to +display these world coordinates as the pointer is moved about in the image +window. + +The quantities displayed in the coords box are X, Y, and Z: the X,Y world +coordinates of the pointer, and Z, the world equivalent of the pixel value +under the pointer. All coordinate systems are linear. The precision of a +displayed quantity is limited by the range of values of the associated raw +frame buffer value. For example, if the display window is 512x512 only 512 +coordinate values are possible in either axis (the positional precision can +be increased however by zooming the image). More seriously, at most about +200 pixel values can be displayed since this is the limit on the range of +pixel values loaded into the frame buffer. If a display pixel is saturated a +"+" will be displayed after the intensity value. + +The coords box is a text marker, it can be moved and resized +with the pointer like any other marker. The coords box marker can be +disabled by defining the \fIdisplayCoords\fP GUI resource, its location +can be controlled by the \fIwcsboxGeom\fP GUI resource. + +.SS "MARKER MENU OPTIONS" + +Except for the panner and WCS markers, MB3 (mouse button 3) calls up the +marker menu providing a limited set of functions common to all markers: +.TP 3 +\fBo +Zoom\fP does an equal aspect zoom of the region outlined by the marker. In +this way you can mark a region of the image and zoom it up. +.TP 3 +\fBo +Fill\fP exactly zooms the area outlined by the marker, making it fill the +display window. Since the marker is not likely to be exactly square, +the aspect ratio of the resultant image will not be unitary. +.TP 3 +\fBo +Print\fP prints the region outlined by the marker to the printer or file +currently configured by the Print Panel. +.TP 3 +\fBo +Save\fP saves the region outlined by the marker to the file currently +configured by the Save Panel. +.TP 3 +\fBo +Info\fP prints a description of the marked region. The text is printed in +the Info Panel. +.TP 3 +\fBo +Unrotate\fP unrotates a rotated marker. +.TP 3 +\fBo +Color\fP is a menu of possible marker colors. +.TP 3 +\fBo +Type\fP is a menu of possible marker types. This is still a little buggy +and it isn't very useful, but you can use it to play with different +types of markers. +.TP 3 +\fBo +Destroy\fP destroys the marker. You can also hit the delete or backspace +key in a marker to destroy the marker. + +.SS "RULER MARKERS" + +Holding down the Ctrl key and the Left-Mouse-Button while moving +the mouse will drag out a "ruler marker" measuring the distance from the +initial point to the current mouse position. Releasing the Ctrl key before +lifting the mouse button will leave the marker on the display, otherwise +it will be erased automatically once the mouse button is released. Any +number of ruler markers can be created in the frame. + +Distances are measured by default in image logical pixels however +the Right-Mouse-Button can be used inside the marker to popup a menu of +options: + +.TP 20 +.B Sticky +By default rulers are destroyed whenever the display +changes due to a pan, zoom, flip, or frame change. +This option will make the ruler "sticky" so it will +not be erased, subsequent use of the menu to shows +this option to be "UnSticky" to remove this feature. +.TP 20 +.B Units +Sub-menu to select the units of the display. If the +ISM is enabled and a WCS is present in the image and +selected as one of the readout options, distances may +also be read out in units of arcseconds, arcminutes, +or degrees instead of the default logical pixels. All +markers created after the unit change will readout in +the new units as their default. +.TP 20 +.B Color +Select the color of the marker. +.TP 20 +.B Draw into Frame +(\fINot Yet Implemented\fP) Draw the marker as overlay +graphics in the frame. Doing so will retain the +marker when printing a hardcopy of the display. +.TP 20 +.B Destroy +Destroy the marker. + +The marker can also be destroyed by hitting the Delete or Backspace key +while the cursor is in the marker. There is presently no way to move the +marker to a new position in the frame. + +.SH "REAL-TIME WCS/PIXEL-VALUE READOUT" + +XImtool now has the ability to display the actual pixel value of an image +(as well as the scaled value previously shown) and the cursor position in +image WCS values (e.g. RA/DEC, GLAT/GLONG, etc). This is done using an +external task (the 'ism_wcspix.e' binary in the new distribution) to +access the image and pass the coordinate/pixel information to the GUI. + +WCS readout is enabled by default but can be toggled or reset using the +\fIWCS/Pix\fP button on the Coords tab in the control panel or the \fIISM\fP +toggle on the alt-gui menubar. When enabled, images currently in the +server or subsequently displayed will be passed to the external process +where they are cached for access. Cursor movements generate an event that +maps the current frame buffer position to a position in the cached image. +The ISM (ISM is Image Support Module) task then reads the image to +determine the pixel value (or a small table of values around the current +position), and computes one or more coordinates from the image position. +The ISM task also has access to the associated BPM images and can +optionally return bad pixel information during the cursor readout. + +By default, the logical and world image coordinates are displayed to both +the Coords panel readout as well as the main display window wcsbox text +marker. Alternate coordinate systems (e.g. transformation of equatorial +to galactic coordinates or some other sky system, physical coords, +amplifier coords, etc) can be selected for display by hitting the +\fIOptions\fP toggle on the Coords panel. Available coordinate systems are +chosen using the \fIType\fP menu on the panel, the readout format +(sexigesimal, degrees, etc) using the \fIFormat\fP menu, and the display to +the current panel or main image window using the remaining toggles for +each WCS. Up to four systems may be displayed at one time, the coordinate +panel and wcsbox marker will adjust size automatically depending on the +display. + +By selecting the \fIBPM Data\fP toggle from the Coords.Options panel ximtool +is able to flag pixels in images with an associated bad pixel mask. This +bad pixel mask is currently assumed to be named in the image header "BPM" +keyword by convention. If the cursor passes over a bad pixel in the mask, +the Coords bpm display as well as the main window wcsbox will change to a +red background color. Only the Coords display will show the value, any +non-zero value will be flagged with the color change. + +With the ISM enabled the Compass indicator will display a set of arrows +showing North-East if a WCS is available, otherwise just the current X-Y +axes are shown. The pixel table will display actual pixel values from the +image, with the ISM off the pixel table displays the scaled image values +from the frame buffer. + +.SH "FREEZING CURSOR READOUT" + +Holding down the Alt key will now freeze the cursor display readout +and draw crosshairs on the screen at the last position. This can be used +for example to position the cursor but then allow the cursor to be moved to +another window (to enter text, start a program, whatever) without losing +the position information displayed on the screen. + +.SH "CUT-GRAPHS" + +XImtool now has the ability to display horizontal and vertical +cut-graphs of the display, these appear as "flip-out" panels that appear +on the bottom and right side of the main display window and are controlled +by the small "H" and "V" buttons in the lower right corner of the window. +When both panels are enabled the corner area of the display also shows an +options panel for the graphs. Current options are: + +.TP 20 +.B Better Speed +Draw the graphics so they update at the fastest possible rate. This is +done by subsampling pixels to produce a smoother graph but without sacrificing +too much accuracy. +.TP 20 +.B Better Accuracy +Draw the graphics using all screen pixels to produce the most accurate +display. On fast modern machines this can be enabled with no apparent +loss of speed, however older machines may wish to use this only +occassionally to limit any lag in the cursor tracking. +.TP 20 +.B Image Pixels +(\fINot Yet Implemented\fP) +.TP 20 +.B Jump Cursor +If enabled, large jumps of the cursor do not update the graphics display, +small movements around an object of interest will update the display +continuously. +.TP 20 +.B Smooth Cursor +If enabled, all cursor movements cause the display to be updated. This +is another option that can be set safely on faster machines but will +cause a delay on slower ones. +.TP 20 +.B Graphics Cursors +If enabled, the graphics cursors in either of the plots are active and +can be used to update the cursor readout on the main image window and the +complementary cut-graph. This can be used for example to freeze +the cursor in the main display using the Alt key (see above), then moving +to one of the graphics windows to perform cut graphs in only one axis. + +Graphs are (currently) drawn using only the scaled display values +to avoid complications of accessing multiple images in a mosaic display. Both +plots are labeled using the frame z1/z2 values and contain cursor indicators +which update contuously. + +.SH "PEAK-UP CURSOR CENTROID POSITIONING" + +Several new keystroke commands are available to reposition the +cursor to a centroid or min/max pixel value within a bounding box of the +cursor position, allowing you to approximate the position with the mouse +and fine tune it quickly before typing the application keystroke command. +The initial box size is controlled with a \fIcenterBoxSize\fP GUI resource +(defaults to 5 pixels) but can be adjusted interactively using the \fBCtrl-[\fP +and \fBCtrl-]\fP commands to descrease/increase the box size respectively. A +marker will flash briefly to indicate the box size. + +The \fBCtrl-0\fP (zero) key finds either a centroid or the local maximum +pixel value within this box region, \fBAlt-Ctrl-0\fP (zero) will find the local +minimum value. In either case the cursor is reposition to the computed +value. The default peak-up action is to find the centroid position in the +box however this can be changed to find the max pixel by selection the +"\fICentroid Peaks\fP" option from the main Display control panel or by +resetting the \fIpeakCentroid\fP GUI resource (defaults to True). + +Centroiding is done using only the scaled screen pixel values and +only pixels above the mean value within the box are used. It works best +if the box size is set appropriately, the centroid position may appear to +drift if the box is too large and includes too many background pixels. + +.SS "Command Summary" +.TP 20 +.B Ctrl-0 (zero) +Reposition to centroid/max-pixel +.sp -0.5 +.TP 20 +.B Alt-Ctrl-0 (zero) +Reposition to min-pixel +.sp -0.5 +.TP 20 +.B Ctrl-[ +Decrease centering box size (min of 5) +.sp -0.5 +.TP 20 +.B Ctrl-] +Increase centering box size + +.SS "Resource Summary" +.TP 20 +.B "peakCentroid = True" +Compute the box centroid position, a 'False' value force the max value +to be used +.sp -0.5 +.TP 20 +.B "centerBoxSize = 5" +Size of the centroid box, used as cursor position +/- this value + +.SH "AUTO-REGISTRATION OF IMAGES" + +The auto-register feature allows you specify a registration of +two or more display frames with an offset. When enabled, this registration +is maintained for all frames in the list if any one of them is panned or +zoomed to a new location in the frame buffer. + +For example, to use this feature do the following: +.RS +.TP 5 +.B 1) +Enable Auto-Register (either on the Control Panel or the toolbar on the +alt-gui) and pan/zoom to some star of interest. +.TP 5 +.B 2) +Use Mouse-Button-2 to center the star in the frame. +.TP 5 +.B 3) +Cycle through the frames and you may see a small shift of the star. For +each frame, position the cursor on the star and type \fBCtrl-o\fP to +offset it to the center. Repeat as necessary. Small corrections will be +cumulatively added so you can use the \fBCtrl-0\fP (Ctrl-zero) peak-up +command to centroid each object in the frame before the \fBCtrl-o\fP offset. +.TP 5 +.B 4) +Pan around the image in one display frame, then switch frames and the new +frame should also be panned to the new image with the proper offset. +.TP 5 +.B 5) +A \fBCtrl-a\fP command will toggle the feature, offsets are only allowed +when autoreg is enabled. +.RE +.LP +Hitting \fBRegister\fP will zero the offsets, as will toggling the +auto-register function. What you should see is the object centered in +the frame and as you blink through it remains registered but the panner +box marker is moving around. Drag the panner around and all frames +still remain registered with the given offset. The control/info panels +now display what the offset is for each frame. + +The register display list is shared with the blink list and can +be set using the Display control panel. By default all frames are included +in the list. For accessing more than four frames, use the box icon in +the Blink/Register box of the Display control panel to bring up a new window +with access to all 16 available frames. + +.SS "Command Summary" +.TP 20 +.B Ctrl-o +Set the registration offset from center +.sp -0.5 +.TP 20 +.B Ctrl-a +Toggle the Auto-Register feature + +.SH "CONTROL PANEL" + +XImtool has a control panel which can be used to exercise most of the +capabilities the program has for image display. The control panel can be +accessed either via the \fBOptions\fP menu from the main window menubar, or by +pressing the leftmost button in the row of buttons at the upper right side +of the display in the standard GUI (in the alternate GUI the \fIControl +Bar\fP accessed by the rightmost button on the menubar provides widgets +for selecting the desired control panel). + +The separate windows previously used for Control/Print/Load/Save/etc +have now been integrated into a single window with the appropriate control +panel selectable with a Tab widget. There are also new Tab panels for +setting the frame tile configuration (see below), more detailed information +on the server status, and selecting the WCS readout options (see below). + +.SS "VIEW CONTROLS" + +The \fBFrame box\fP will list only the frame buffers you currently have +defined. Currently, the only way to destroy a frame buffer is to change the +frame buffer configuration, new frame buffers (up to 16) will be created +automatically if requested by the client. The number of frame buffers +created at startup can be controlled using the \fI-nframes\fP command-line +switch or the \fIdefNFrames\fP resource. + +The \fBtext display\fP window gives the field X,Y center, X,Y scale +factors, the X,Y zoom factors, and the frame offset used in +Auto-Registration. The scale factor and the zoom factor will be the same +unless \fIautoscale\fP is enabled. The scale is in units of display pixels +per frame buffer pixel, and is an absolute measure (it doesn't matter +whether or not autoscale is enabled). Zoom is relative to the autoscale +factor, which is 1.0 if autoscaling is disabled. This information is also +presented in the Info panel. + +The numbers in the \fBZoom box\fP are zoom factors. Blue numbers zoom, red +numbers dezoom. \fIZoom In\fP and \fIZoom Out\fP may be used to go to +larger or smaller zoom factors, e.g. \fICtrl-5\fP followed by "Zoom In" +will get you to zoom factor 10. Specific zoom factors may also be +accessed directly as Control keystrokes, e.g. Ctrl-5 will set zoom factor +5. \fICenter\fP centers the field. \fIToggle Zoom\fP toggles between the +current zoom/center values, and the unzoomed image. + +\fIAspect\fP recomputes the view so that the aspect ratio is 1.0. Aspect +also integerizes the zoom factor (use the version in the View menu if you +don't want integerization). + +\fIFit Frame\fP makes the display window the same size as the frame +buffer. Note that autoscale has much the same effect, and allows you to +resize the display window to any size you want, or view images too large +to fit on the screen. + +.SS "ENHANCEMENT CONTROLS" + +At the top is a scrolled list of all the available colormaps. Click on the +one you want to load. You can add your own colormaps to this list by +defining the \fIcmap[12]\fP or \fIcmapDir[12]\fP command line flags or +application resources. + +The two sliders adjust the contrast (upper slider) and brightness (lower +slider) of the display. The \fIInvert\fP button inverts the colormap +(multiples the contrast by -1.0). Note that due to the use of the private +colormap the sliders are a bit sluggish when dragged to window the +display. If this is annoying, using MB3 in the display window is faster. + +The \fINormalize\fP button (on the bottom of the control panel) will +normalize the enhancement, i.e. set the contrast and brightness to the +default one-to-one values (1.0, 0.5). This is the preferred setting for +many of the pseudocolor colortables and for private colormaps loaded from +disk images. The \fIInitialize\fP button does a reset of the server. + +.SS "BLINK CONTROLS" + +\fIBlink frames\fP is the list of frames to be blinked. When blink mode is +in effect ximtool just cycles through these frames endlessly, pausing +"blink rate" seconds between each frame. The same frame can be entered in +the list more than once. To program an arbitrary list of blink frames, +hit the Reset button and click on each blink frame button until it is set +to the desired frame number. The main control panel allows only the +original four frames to be specified in the blink list, however access to +the full list of 16 frames now supported is gained using the box icon +button next the the \fIReset\fP button to bring up a new control panel. + +The \fIBlink Rate\fP can be adjusted as slow or as fast as you want using +the arrow buttons. If you set the blink rate small enough it will go to +zero, enabling single step mode (see below). + +The \fIRegister\fP button registers all the blink frames with the current +display frame. Frames not in the blink list are not affected. + +The \fIMatch LUTs\fP button sets the enhancement of all blink frames to +the same values as the display frame. Frames not in the blink list are not +affected. + +The \fIBlink\fP button turns blink on and off. When the blink rate is set +to zero the Blink button will single step through the blink frames, one +frame per button press. + +\fBNOTE:\fP You can blink no matter what ximtool options are in effect, +but many of these will slow blink down. To get the fastest blink you may +want to turn off the panner and coords box, and match the LUTs of all the +blink frames. All the ximtool controls are fully active during blink +mode, plus you can load frames etc. + +.SS "OPTIONS:" +.TP 5 +.B "Panner" +Toggles whether to display the Panner marker. +.TP 5 +.B "Magnifier" +Toggles whether to display the Magnifier marker. +.TP 5 +.B "Coords Box" +Toggles whether to display the coordinate box marker. +.TP 5 +.B "Autoscale" +If autoscale is enabled then at zoom=1, the frame buffer will be +automatically scaled to fit within the display window. With autoscale +disabled (the default), the image scale is more predictable, but the +image may be clipped by the display window, or may not fill the display +window. +.TP 5 +.B "Antialias" +When dezooming an image, i.e., displaying a large image in a smaller +display window, antialiasing causes all the data to be used to compute +the displayed image. If antialiasing is disabled then image is +subsampled to compute the displayed image. Antialiasing can prevent +subsampling from omitting image features that don't fall in the sample +grid, but it is significantly slower than dezooming via subsampling. +The default is no antialising. +.TP 5 +.B "Tile Frames" +The default display mode is to view one frame at a time. In tile frames +mode, 2 or 4 frames may be viewed simultaneously in the display window. +All the usual operations (zoom and pan, colortable enhancement, cursor +readback, etc.) still work for each frame even when in tile frames mode. +.TP 5 +.B "Warnings" +The warnings options toggles whether you see warning dialog boxes in +situations like overwriting an existing file, clearing the frame +buffer, etc. +.TP 5 +.B "Centroid Peaks" +If enabled, the \fBCtrl-0\fP keystroke will reposition the cursor to the +computed centroid of the centroiding box, otherwise the cursor is +repositioned to the local maximum value within the box. + +.SH "LOAD PANEL" + +The Load Panel allows you load images from disk directly to the frame +buffer, this is analogous to loading an image on the command line except +that browsing is possible. At present recognized formats include IRAF OIF +format (i.e. \fI.imh\fP extension), simple FITS files, GIF, and Sun +rasterfiles. The task will automatically sense the format of the image +and load it appropriately. Images with private colormaps (such as GIF) +will be loaded using the private colormap (meaning that changing the +brightness/contrast enhancements will render an apparently random-colored +image), all others will be loaded with a grayscale colormap. + +When loading new images the frame buffer configuration table will be +searched for a frame buffer that is the same size or larger than the new +image size, if no frame buffer can be found a custom buffer exactly the +size of the image will be created. This means that the image may not fill +the display window when loaded, or you may see a subsection of the image +in the main display window. Setting the \fIautoscale\fP option on the main +Display panel will scale the entire image to fit the main display window, +the full frame buffer will always be visible in the Panner marker window. + +Images with more colors than can be displayed will automatically be +quantized to the number of available colors before display. +If the \fIAuto Grayscale\fP button is enabled any image colormap will be +converted to grayscale and loaded as the standard grayscale colormap. + +Formats which permit pixels larger than 8-bits/pixel will be sampled on +a grid to determine an optimal range in the data to be used to compute a +linear transformation to the number of display colors. This is the same +z-scale sampling and transformation used by the IRAF \fIDISPLAY\fR task +when computing the \fIz1/z2\fP values and provides a much better initial +display than simple truncation to 8-bits. This scaling will be done +automatically using a grid of \fINsample\fP points if the \fIZscale\fP +option is enabled. Otherwise, if the \fIZrange\fP option is set the full +data range will be used to scale the image. Lastly, is neither \fIZscale\fP +nor \fIZrange\fR are enabled, the z1/z2 values may be set explicitly using +the options box. + +.TP 5 +.B "Directory Browsing" +The load panel contains a list of files in the current directory that may +be selected for loading by selecting with left mouse button. If the file +is a directory the contents of the new directory will be loaded, if it's a +plain file an attempt will be made to load it as an image otherwise an +error popup will appear. Directories in the list are identified with a +trailing '/' character, you will always see any subdirectories listed even +if a filter is specified. + +The \fIRoot\fP button will reset the current directory to the system root +directory. The \fIHome\fP button will reset the current directory to the +user's login directory, the \fIUp\fP button moves up one directory level, and +\fIRescan\fP reloads the file list by rescanning the directory. The current +working directory is given below the file selection window. + +Selecting the \fIList Image Headers\fP option will change the display text +to list all images in the current directory which match the filename filter. +Directory browsing is disabled while this option is in effect. +.TP 5 +.B "File Patterns" +By default all files and directories will be listed. You may specify a +filter to select only those files with a given extension such as +"*.fits" using the \fIFilter\fP text box. Directories will +always be seen in the list and are identified with a trailing '/' +character. Any valid unix pattern matching string will be recognized, +multiple templates may be specified in a comma-delimited list such as +"*.imh,*.fits" to list both OIF and FITS images. +.TP 5 +.B "Direct File Load" +If you know exactly which file you wish to load, you may enter its +name in the \fILoad File\fP text box and either hit <cr> or the Load button +to load it. An absolute or relative path name may be given, if a simple +filename is specified it will be searched for in the current working directory. +.TP 5 +.B "Frame Selections" +By default images will be loaded into the current frame, you may choose +a different frame using the Frame menu button to select from the +available frames. + +.SH "SAVE PANEL" + +The Save Panel lets you save the current contents of the main display window +to a disk file (including the Panner/Coords markers, or overlay graphics +displayed by the client program). Presently, only the contents of the main +display window may be saved, there is no facility for saving the undisplayed +contents of the entire frame buffer other than to enable the autoscale feature +or zoom out so the whole buffer is in the display window. A limited number +of formats are currently available, others will be added in future versions. +.TP 15 +.B "File Name" +The File Name text box allows you to enter the file name of the saved +file. A "%d" anywhere in the name will be replaced by a sequence number +allowing multiple frames to be saved with unique names. +.TP 15 +.B "Format" +The Format box allows you to choose the format of the image to be +created however not all formats are currently implemented. The EPS format +is similar to the \fIPrint\fR option however there is no annotation. +.TP 15 +.B "Color" +The Color box lets you choose the color type of the image to be +created. The options will change depending on the format, e.g. FITS +doesn't allow color so no color options will be enabled. Formats which +allow 24-bit images will be written using the current colormap after +converting to a 24-bit image, pseudocolor images will be written with +the current colormap. + +.SH "PRINT PANEL" + +The Print Panel allows you dump the contents of the main display window as +Encapsulated Postscript to either a named printer device or to a disk file. +The \fIPrint To\fP selects the type of output, the \fIPrint Command\fP box +will adjust accordingly, either as a Unix printer command or as a file name. +A "%d" anywhere in the name for disk output will be replaced by a sequence +number allowing multiple frames to be saved with unique names. Selecting +printers from the installed list will automatically change the command to be +used to generate the output. This command does not necessarily need to be a +printer command, the printer configuration file lets you define any command +string to process the image. + +.SS "COLOR OPTIONS" + +The Color box lets you choose the color type of the image to be created. +PseudoColor or 24-bit postscript will be created using the current colormap +and enhancements. + +.SS "POSTSCRIPT OPTIONS" + +.TP 15 +.B "Orientation" +Set the page orientation. +.sp 0.5 +.TP 15 +.B "Paper Size" +Select the paper size to be used. +.sp 0.5 +.TP 15 +.B "Image Scale" +Set the scale factor used to compute the final image size. No checking is +done to make sure the image will fit correctly on the page. + +.SS "PROCESSING OPTIONS" +.TP 5 +.B "Auto Scale" +Toggles whether or not the image is automatically scaled +to fit the page. If not enabled, the image scale will be used to +determine the output image size, otherwise the image will be scaled down +(if necessary) to fit on the page. +.TP 5 +.B "Auto Rotate" +Determines whether or not the image will be rotated to fit +on the page. When set, an image larger than the current orientation +will be rotated and possibly scaled to fit the page, otherwise the image +may be scaled so that it fits in the current orientation. +.TP 5 +.B "Max Aspect" +Automatically increases the scale so the image fills the page in the current +orientation. +.TP 5 +.B "Annotate" +The annotate option toggles whether or not the final file includes +annotation such as the image title, a colorbar, and axis labels. There is +currently no option for partial annotation. + +.SS "ANNOTATION OPTIONS" + +.TP 5 +.B "Annotate" +Selects whether Postscript image is to be annotated. +.B "Title" +Annotate with a title on the top of the image. +.B "Borders" +Annotate with borders surrounding the image giving image coordinates. +.B "Colorbar" +Annotate with colorbar at the bottom of the image +.B "Title String" +Title string to use when \fItitle\fR is selected. The special value +\fIimtitle\fR will force the title to be the currently displayed image title, +otherwise it will be this user-selected field. + +.SS "PRINTER SELECTION" + +The printer selection list lets choose the printer to be used. The printer +configuration file is /usr/local/lib/ximprint.cfg by default or may be reset +using the \fI-printConfig\fP command line switch or \fIprintConfig\fP +resource. The format of the file is simply + + \fIname\\tcommand\fP + +The \fIname\fP value is what appears in the selection list and may be more +than a single word, the \fIcommand\fP can be any command that accepts EPS +input from a pipe, the two fields must be separated by a tab character. +Normally the command +will be a simple \fIlpr -Pfoo\fP or some such, but can also include converters +or previewers. At most 128 printer commands may be used. + +.SH "INFO PANEL" + +The Info panel was revised to provide a greater variety of status +information. The type of output is controlled by the toggle buttons on +the bottom of the frame, however all output is kept current as the program +runs. Current info options include: +.RS +.TP 15 +.B Frame +Info about the current display frame. +.TP 15 +.B Server +Info about various server options, e.g. colormaps, memory model, +antialias type, etc. +.TP 15 +.B Clients +Show currently connected clients. Lists available connection channels +and active ISM clients. +.TP 15 +.B WCS +List all WCS and mappings for the current frame. +.TP 15 +.B ISM +Log of various ISM status messages. +.TP 15 +.B Imtoolrc +Show current frame buffer configuration table. +.RE + +.SH "TILE PANEL (NEW)" + +With the additional frames, the default tiling scheme proved inadequate. +A new control panel Tile frame now allows you to select from a number of +tile configurations, the list of frames to be tiled, a \fIfill style\fP +(left-to-right or top-to-bottom), as well as optional labels for each of +the tiles (frame number, image title or image name). + +Tile configuration will make use of all frames currently selected in the +\fITile Frame\fP group in the following manner: +.RS +.TP 15 +.B "Disabled" +Do not tile the display. +.TP 15 +.B "Manual" +Tile according to \fIManual Configuration\fP settings. +.TP 15 +.B "Best" +Optimize layout for frame buffer aspect. +.TP 15 +.B "Square" +Always force a square layout (2x2, 3x3, etc). +.TP 15 +.B "Horizontal" +Preferentially tile horizontally (6 frames ==> 3x2). +.TP 15 +.B "Vertical" +Preferentially tile vertically (6 frames ==> 2x3). +.TP 15 +.B "One Row" +Tile all in one row (Nx1). +.TP 15 +.B "One Column" +Tile all in one column (1xN). +.RE + +.SH "COORDS PANEL (NEW)" + +The Coords Panel is meant to provide a full-featured readout as well as +serve as a control panel for the various options. The display window +contains the image name/title and frame buffer info, and a selection of +coordinate and image pixel readouts. The intent is provide more infor- +mation than can fit comfortably on the main image window while still +taking up as little screen space as possible. To this end the "Options" +button is used to hide most of the feature controls when not in use (see +below). Other options on the main panel include: + +.RS +.TP 15 +.B WCS/Pix +Toggle the real-time WCS/pixel readout capability (i.e. the ISM used +to access the disk image). This must be enabled for certain other +options to work. +.TP 15 +.B "Pix Table" +Open a panel showing an image pixel table. The panel shows an array +of pixels surrounding the cursor position, either the actual pixel +values if the ISM is enabled, or scaled display values otherwise. The +size of the table may be selected from the menubar. +.TP 15 +.B Header +Display the current image header in a new panel. Both the entire image +header as well as WCS-specific parts of the header are available under +different tabs. This option is only active when the ISM is enabled. +.TP 15 +.B Compass +Draw an orientation compass on the display panner. If the ISM is enabled +and a WCS is present in the header, the compass will indicate N/E +according to the WCS, otherwise the X/Y axes of the image are drawn. +.TP 15 +.B Options +Pop-up/down the option control portion of the panel. When enabled, the +Coords Panel will change size to reveal the options which can be +changed (explained below). +.RE + +.LP +The "Readout Values" group controls the selection of WCS type, location +and format to be displayed. The "Type" menu always provides a selection +of the image Logical, Physical or World systems, which may be identical +depending on the image header. If a World system is supplied in the image +addition entries for transformations to other sky systems, (e.g. FK5 to +ICRS or galactic/ecliptic) will also be available. The selection is +dependent on whether the ISM is running as well as WCS information present +in the image. The "Format" menu allows the use to select a sexigesimal +display, conversion to degrees or radians, or whichever format is most +natural for the coordinate being display. The two toggle to the right +control whether this WCS is to be displayed on the Panel (i.e. the Coords +Panel window) or the ImgWin (i.e. the text marker on the main image +window). + +Other options below this group control whether or not to display the WCS +labels, the image name/title, and frame buffer information in the main +Coords Panel display. The "BPM Data" option controls whether or not the +ISM will try to map any bad-pixel mask associated with the image. If +enabled, a bad-pixel mask specified by the image header BPM keyword +(currently fixed by convention but this may be selectable later) will be +mapped along with the image. Aside from wcs/pixel readouts at each cursor +position, any BPM data values found will also be displayed. A non-zero +value will cause the BPM field of the Coords Panel readout as well as the +main image window marker to switch to a red background color to flag the +value. + +The last box allows the user to specify a different ISM task to be +executed or to reinitialize the current one. In most cases this won't +need to be changed, however a custom ISM could be started when using +special data formats. This command string can also be controlled by the +application "ism_task" resource. + +.SH "TCLSHELL" + +The \fITclShell\fP allows the user to type commands directly to the TCL +interpreter, letting you send messages to the object manager or execute +specific procedures in the TCL code that makes up the GUI. It is used as a +development or debugging tool for the GUI, but for an example of what it +does, bring it up and type a command such as + + \fIsend fileButton set background red\fP + + +.SH "COLORMAP SELECTION" + +By default XImtool will display images using either a grayscale colormap +(e.g. if loaded by a client), or a private colormap when loading an image +from disk that contains a colormap. Each frame defines its own colormap so +you can define different colormaps or enhancements for each frame, they +will change automatically as you cycle through the frames. + +.SS "BUILTIN COLORMAPS" + +Once loaded, the colormap may either be changed using the builtin colormap +menu under the View menu button on the main window, or from the +Enhancement box on the control panel. XImtool has about a dozen colormap +options builtin, other user-defined colormaps may optionally be loaded. +It is not presently possible to save colormaps for later use. + +.SS "USER-DEFINED COLORMAPS" + +The \fIcmap[12]\fP and \fIcmapDir[12]\fP resources (or command line +arguments) are used to tell which specific colormaps to make available or +where to look for colortables respectively. The colortables are loaded +when ximtool starts up, or when it is reinitialized (e.g. by pressing the +Initialize button in the control panel). XImtool will ignore any files in +the colormap directory which do not look like colortables. New +colortables will also be added automatically for each image loaded from +disk. + +The format of a user lookup table is very simple: each row defines one +colortable entry, and consists of three columns defining the red, green, and +blue values scaled to the range 0.0 (off) to 1.0 (full intensity). + + R G B + R G B + (etc.) + +Blank and comment lines (lines beginning with a '#') are ignored. + +Usually 256 rows are provided, but the number may actually be anything in +the range 1 to 256. XImtool will interpolate the table as necessary to +compute the colortable values used in XImtool. XImtool uses at most 201 +colors to render pixel data, so it is usually necessary to interpolate the +table when it is loaded. + +The name of the colortable as it will appear in the XImtool control panel +is the root name of the file, e.g., if the file is "rainbow.lut" the +colortable name will be "rainbow". Lower case names are suggested to avoid +name collisions with the builtin colortables. Private colormaps for disk +images will be have the same name as the image loaded. If the same +colortable file appears in multiple user colortable directories, the first +one found will be used. + +.SS "MINIMIZING COLORMAP CONFLICTS" + +The Gterm widget used by XImtool (i.e. the main display window) uses a +private global colormap for display, this allows it to have greater +control over color cell allocation but can occasionally also cause +"colormap flashing" as the mouse is moved in and out of the application. +The problem here is that in a system with only an 8-bit colormap (256 +colors) all applications must compete for colors, programs such as XV or +Netscape allocate colors from the default colormap leaving only a few free +cells for XImtool. Since XImtool defines a private global colormap it is +still able to allocate the needed cells rather than failing, but it's +allocating cells already used by other applications. As the mouse moves +out of the ximtool window those cells are once again defined in terms of +the default colormap, so the ximtool window is then using a different +colormap. It is this switching of the colormap context that causes the +flashing to occur, but there are a few things that can be done to help +minimize this. + +XImtool logically defines 200 colors which the client image display +program can use to render pixels. However, ximtool may or may not +actually allocate all of those colors. By default it currently allocates +only about 192 colors, to reserve 64 colors for the other windows on the +screen. You don't normally notice this as 1) usually the default screen +colormap has enough free cells to allow ximtool to match the colors, and +2) the extra unallocated cells correspond to the brightest pixels in the +rendered image, and these colors may not be used or usually only +correspond to a few small regions near the saturated cores of bright +objects. + +You can eliminate this problem by setting the \fIbasePixel\fP resource to +e.g. 48 instead of 64, which will let the gterm widget allocate all 200 +colors. However, this isn't recommended for normal use as it will +increase the likelihood of colormap flashing. If you change +\fIbasePixel\fP, either restart the X server or set the resource +\fIcmapInitialize\fP=\fITrue\fP to force the gterm widget to update its +global colormap resource in the X server. The colormap resource may also +be deleted by using the command +.sp 0.7 + \fIxprop -root -remove GT_image\fP +.sp 0.7 +These options may also be set on the command line when first starting up. + +In general one can set the Gterm widget resources \fIbasePixel\fP and +\fImaxColors\fP to specify the region of colormap space to be used for +image display. If you set \fImaxColors\fP to a small value, the 200 +logical colors defined by the widget will be mapped by the imtool color +model into whatever number of colors are actually available to the +widget. For example, in the default setup, 200 color values are really +being mapped into 192 color cells used for display, the remaining colors +are used for buttons, menus etc and are allocated from the default +colormap by the X toolkit when the application starts up. + +Even though the Gterm widget uses a private colormap, it is a private +\fIglobal\fP colormap meaning that all Gterm widgets share the same +colormap. An example of colormap sharing in ximtool is the main image +window and the colorbar window. These are two separate gterm widgets that +share the same colormap. They have to share the same colormap, as +otherwise when you windowed the main image window the colorbar window +would not accurately reflect the modified colormap. By default two +separate ximtools would also share the same colormap meaning contrast +enhancements in one window would affect the other. By resetting the +\fIcmapName\fP command line option or resource you can change the name of +the private colormap used causing separate ximtools to use different +colormaps, but note this also creates colormap flashing between the two +windows that cannot easily be avoided. By setting the \fIcmapName\fR to +"default" the widget will allocate colors from the default colormap, but +this is of little use at the moment. + +There are a number of other resources that can be used to modify the +behavior of the Gterm widget color management scheme, but these are the +most useful ones. For question and further information feel free to +contact \fIiraf@noao.edu\fP. + + +.SH "DISPLAY CLIENT CONNECTIONS" + +XImtool allows display clients to connect in any of the following ways: +.TP 5 +.B "fifo pipes" +The traditional approach. The default global /dev/imt1[io] +pipes may be used, or a private set of fifos can be specified using the +\fI-fifo\fP command line argument or \fI*fifo\fP resource. Values should +be specified as the root pathname to a pair of fifo pipes whose last +character is 'i' or 'o', these characters will be added automatically when +opening the pipes. For example, to use the default pipes the path would +be specified as simply "/dev/imt1". A value of "none" disables this connection. +.TP 5 +.B "tcp/ip sockets" +Clients connect via a tcp/ip socket. The default port is \fI5137\fP, or a +custom port may be specified using the \fI-port\fP command line switch or +a \fI*port\fP resource. This permits connecting to the server +over a remote network connection anywhere on the Internet. +A port number of 0 (zero) disables this connection. +.TP 5 +.B "unix domain sockets" +Like a tcp/ip socket, but limited to a single host system. Usually faster +than a tcp/ip socket, and comparable to a fifo. By default each user gets +their own unix domain socket, so this option allows multiple users to run +ximtools on the same host without having to customize things. The default +value is "/tmp/.IMT%d", other sockets may be defined using the \fI-unix\fP +command line switch or the \fI*unixaddr\fR resource. Legal values +should be specified as a filename to be used for the socket, up to two "%d" +fields are allowed and will be replaced by the userid. An empty string value +disables this connection. + +By default ximtool listens simultaneously for client connections on all three +types of ports. Clients may connect simultaneously by different +means allowing up to three different displays to be loading at the same +time into different frames. + + +.SS "COMMUNICATIONS PROTOCOL" + +The communications protocol used is a slightly modified version of +that used by the IIS Model 70; other more modern protocols will likely be +supported in the future. The IIS protocol is basically a command packet +stream with a header describing the operation to be performed (select +frame, load display, read cursor, etc), and an optional data packet +containing e.g. pixels. + +Beginning with XImtool V1.3 the protocol was modified even more to allow +extra text at the end of the WCS string to define image mappings and to +better support multiple world coordinate systems within a frame. For +backwards compatability none of the existing IIS protocols were +modified completely, however we take advantage of unused registers to flag +the new features in existing functions (like read/write WCS). The WCS mapping +changes required only that the unused 'x' register be set to indicate the new +behavior was desired, e.g. the wcs text containing the extra mapping data. + +We also added two new WCS calls that allow us to query the WCS version, +or query a WCS by a specific number corresponding to a mapping. The WCS +version query will return a string such as "version=10" which can be parsed +by the client to get a version number '10' (corresponding to version 1.0). + +Because of the added mapping text the WCS string length was increased +from 320 to 1024 bytes, the string length used internally depends on whether +the 'x' register has been set. + +Support for the full 16 frames allowed by the bit-flag 'z' register +in the IIS header packet required the masking values be changed at various +places in the code. This was more a limitation of the initial implementation +than a required change to the protocol. + +A complete summary of the XImtool IIS protocol implementation follows. + + +.SS "IIS PROTOCOL SUMMARY" + +All operations are initiated by sending a +header packet containing a \fIthing id\fR (tid) and \fIsubunit\fR selecting +the function to be performed, optionally followed by data up to 32Kb long. +The IIS header packet used is defined as +.nf + \f(CWstruct iism70 { + short tid; + short thingct; + short subunit; + short checksum; + short x, y, z; + short t; + };\fR +.fi + +The \fIthing count\fR field contains the negative number of bytes of data +that will be sent following the header packet. The IIS header checksum is +computed as +.nf +\f(CW + checksum = 0177777 - (tid + subunit + thingct + x + y + z + t); +\fR +.fi +The four IIS registers are set differently depending on the operation, a +summary of the header packets for each operation is summarized below. +.br + +.KS +.ce 1 +\fBIIS Header Packet Summary\fR +.TS +tab(:); +c c c c c c c c c. +:TID:Subunit:Tct:X:Y:Z:T:Data +.T& +l | l | l | c | c | c | l | l | l |. +:_:_:_:_:_:_:_:_ +Read Data:IIS_READ\fB|\fPPACKED:MEMORY:-NB:x:y:fr:-:NB +Write Data:IIS_WRITE\fB|\fPPACKED:MEMORY:-NB:x:y:fr:-:NB +Read Cursor:IIS_READ:IMCURSOR:-:-:-:-:-:- +Write Cursor:IIS_WRITE:IMCURSOR:-:x:y:wcs:-:- +Set Frame:IIS_WRITE:LUT\fB|\fPCOMMAND:-1:-:-:-:-:2 +Erase Frame:IIS_WRITE \fB|\fP fb:FEEDBACK:-:-:-:fr:-:- + +Old Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:-:-:fr:fb:320 +Old Read WCS:IIS_READ:WCS:-:-:-:fr:wcs:320 + +WCS Version?:IIS_READ:WCS:-:1:1:-:-:320 +WCS by Number?:IIS_READ:WCS:-:1:-:fr:wcs:1024 +New Write WCS:IIS_WRITE\fB|\fPPACKED:WCS:-N:1:-:fr:fb:1024 +New Read WCS:IIS_READ:WCS:-:1:-:fr:wcs:1024 +:_:_:_:_:_:_:_:_ +.TE +.KE + +.TS +l l l. +Where NB = number of bytes expected or written + x = x position of operation in frame buffer coords + y = y position of operation in frame buffer coords + fr = frame number (passed as bitflag (i.e. 1, 2 ,4 8, etc) + fb = frame buffer config number (zero indexed) + N = length of WCS string + wcs = WCS number (usually zero) + Data = the number of bytes of data to be read or written following the header packet. + + IIS_WRITE = 0400000 + IIS_READ = 0100000 + COMMAND = 0100000 + PACKED = 0040000 + IMC_SAMPLE = 0040000 + + MEMORY = 001 + LUT = 002 + FEEDBACK = 005 + IMCURSOR = 020 + WCS = 021 +.TE + +TID fields can be logically OR'd with the PACKED flag indicating the number +of data bytes is exactly \fIthingct\fR bytes long, otherwise \fIthingct\fR +must be specified as half the number of data bytes. In a cursor read, if +the IIS_READ flag is OR'd with IMC_SAMPLE the logical cursor position (i.e. +the last value read or set) is returned immediately, otherwise the server +will wait for a keystroke to be hit before returning a string containing the +(x,y) position, wcs of the read, and the keystroke. When setting the frame +you must send a short integer in the data containing the frame selected. + +.SH "ISM COMMUNICATIONS" + +The ISM (Image Support Module) can be any external task which +connects to XImtool over a socket. Communications are limited to simple +null-terminated text strings. In most cases these strings are just the +standard OBM messages sent to XImtool objects but can also include Tcl +callback code (either ISM-specific callbacks, procedures which can be +added to the callback list for existing XImtool objects, or even new GUI +code to create panels and new objects). + +.SS "ISM SOCKET CONNECTION" + +The ISM first requests a connection to XImtool on a dedicated +socket whose default value is "/tmp/.ISM%d", where the '%d' is replaced +by the userid allowing multiple users on a machine to have independent +sockets. The XImtool 'ism_addr' resource or "-ismdev" command-line option +can be used to change this address, a value of 'none' will disable ISM +communications. The socket may also be set with an ISMDEV environment +variable which will override the resource or command-line options. + +Once a connection request is received, XImtool replies with +a message telling the ISM to reconnect on a different socket, it then +frees the initial connection allowing multiple other ISMs to request +their own connection. The communications between XImtool and the ISM +are carried out entirely over this second negotiated socket. Once connected, +the ISM appears as just another named object which can receive OBM messages. + +.SS "COMMUNICATIONS PROTOCOL" + +Messages from the ISM are written to the connection socket and must +be preceeded by one of the following keywords: +.RS +.TP 15 +.B callback +Negotiate a connection on another socket +.TP 15 +.B ready +Client is ready to begin processing +.TP 15 +.B quit +Client is shutting down and disconnecting +.TP 15 +.B send +Send a message to another object +.RE +.sp 0.8 + +Where messages are of the form: +.RS +.TP 30 +.B connect <\fIname\fP> +Request a connection for the <\fIname\fP> ISM +.TP 30 +.B ready <\fIname\fP> +Reconnection request for the <\fIname\fP> ISM on negotiated socket, ISM is +ready to processing. +.TP 30 +.B send <\fIobj\fP> '{' <\fImsg\fP> '}' +Send <\fImsg\fP> to the named <\fIobj\fP>. The message may be any valid string that +will be understood by the recipient. The object may be any object in +the GUI or OBM (see below). +.TP 30 +.B quit +ISM is shutting down. The named is determined from the communications +channel, ISM is responsible for any cleanup of it's callbacks before +issuing the shutdown. +.RE + +All messages must be null-terminated. XImtool will buffer the text until +a complete message is received. Once an ISM client has delivered a QUIT +message no further messages will be sent the that ISM. + +In OBM terminology the ISM is a named Client class object, where the name +is set in the connection request. Messages sent to the ISM should use +this name, messages sent to "client" are still interpreted to mean the +XImtool client. + +The content of messages delivered to the ISM are totally free-form and may +contain any text the ISM is expected to understand. + +.SS "GUI OBJECTS" + +While the ISM can send a message to any object in the task, there +is a GUI Parameter object called 'ism_msg' designed especially to process +messages from the ISM. The callback in the GUI is expecting a message +beginning with one of the following keywords: +.RS +.TP 15 +.B source +Source message text as Tcl code +.TP 15 +.B alert +Message contains error text to be displayed in the GUI 'alert' box +.TP 15 +.B deliver +Message text should be passed to a callback routine specific to that ISM. +This processing callback may have been previously uploaded. The message text +may be any form the processing callback is expected to understand. +.TP 15 +.B info +Message text is status output intended for the XImtool 'info' panel +(connect/disconnect requests, etc) +.RE + +In all cases the message is expected to be of the form + + <\fIcmd\fP> <\fIism_name\fP> [ <\fIarg1\fP> <\fIarg2\fP> <...> ] + +where <cmd> is one of the above keywords, <ism_name> is the name of the +ISM sending the message. The remainder of the message is passed as an 'argv' +list to the processing callback uploaded for the ISM. The ISM is responsible +for formatting these messages. + + +.SH ENVIRONMENT +.TP 30 +.B HOME +Specifies user login directory +.sp -0.5 +.TP 30 +.B DISPLAY +Specifies which display screen to use +.sp -0.5 +.TP 30 +.B "IMTOOLRC or imtoolrc" +Frame buffer configuration file +.sp -0.5 +.TP 30 +.B "ISMDEV" +ISM Connection socket + +.TP 30 +.B "DEBUG_IIS" +Debug IIS communications packets +.sp -0.5 +.TP 30 +.B "DEBUG_ISM" +Debug ISM communications packets +.sp -0.5 +.TP 30 +.B "DEBUG_MAPPINGS" +Debug WCS image mappings +.sp -0.5 + +.SH FILES +.TP 30 +.B "/usr/local/lib/imtoolrc" +Default frame buffer configuration file +.sp -0.5 +.TP 30 +.B "/usr/local/lib/ximprint.cfg" +Default printer configuration file +.sp -0.5 +.TP 30 +.B "/usr/local/lib/imtoolcmap" +Default colormap directory +.sp -0.5 +.TP 30 +.B "/dev/imt1i" +Default input display fifo +.sp -0.5 +.TP 30 +.B "/dev/imt1o" +Default output display fifo +.sp -0.5 +.TP 30 +.B "/tmp/.IMT%d" +Default unix display socket +.sp -0.5 +.TP 30 +.B "/tmp/.ISM%d" +Default unix ISM connection socket +.sp -0.5 + +.SH BUGS +Users should report bugs to \fIiraf@noao.edu\fR. + +.SH SEE ALSO +xgterm(1), xtapemon(1) + +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/ximtool/ximtool.ps b/vendor/x11iraf/ximtool/ximtool.ps new file mode 100644 index 00000000..336513cf --- /dev/null +++ b/vendor/x11iraf/ximtool/ximtool.ps @@ -0,0 +1,16410 @@ +%!PS-Adobe-1.0 +%%Creator: devps (Pipeline Associates, Inc.) +%%CreationDate: Sun Aug 12 22:32:59 2001 +%%Pages: (atend) +%%DocumentFonts: (atend) + +/X{exch}def +/r{rmoveto}def +/m{moveto}def +/l{lineto}def +/rl{rlineto}def +/lc{yc X xc X l st}def +/mc{yc X xc X m}def +/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}def +/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}def +/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}def +/st{stroke}def +/gs{gsave}def +/gr{grestore}def +/cp{currentpoint}def +/np{newpath}def +/ct{curveto}def +/m0{0 0 moveto}def +/BP{/devps-save save def m0}def +/EP{ +clear devps-save restore +showpage}def +/res 10.000000 def +/V{res neg div 792 add +currentpoint pop X +m}def +/H{res div +currentpoint X pop +moveto}def +/h{res div 0 r}def +/v{res neg div 0 X r}def +/xc{res div}def +/yc{res neg div 792 add}def +/S{X H show}def +/psize 10 def +/height 1 def +/slant 0 def +/FF{findfont X dup 12 div setlinewidth /psize X def + [psize 0 psize height mul slant sin slant cos div mul psize height mul 0 0] + makefont setfont}def +/shade{gs + /dy X def + /dx X def + np m + setgray + 0 dy rl + dx 0 rl + 0 dy neg rl + dx neg 0 rl + closepath + fill +gr}def +1 setlinecap +/R{/Times-Roman FF}def +/B{/Times-Bold FF}def +/I{/Times-Italic FF}def +/Y{/Symbol FF}def +/C{/Courier FF}def +%% Troff special characters not on Symbol font +%% Copyright (C) 1986 by Pipeline Associates, Inc. +%% Version 1.1 +/altRTD 20 dict def +altRTD begin +/s{setcachedevice}def +/C{1000 1000 scale}def +/m{moveto}def +/c{curveto}def +/S{stroke}def +/l{lineto}def +/a{arcto}def +/p{pop}def +/sl{setlinewidth}def +end +/F_Troff 17 dict def F_Troff begin +systemdict /currentpacking known +{/SavePacking currentpacking def true setpacking}if +/PaintType 0 def +/FontType 3 def +/StrokeWidth 0 def +/UniqueID 8277003 def +/FontMatrix [.001000 0 0 .001000 0 0] def +/FontBBox [-12 -105 942 855 ] def +/Encoding 256 array def +/CD 256 1 add dict def +/FontInfo 3 dict def FontInfo begin +/UnderlinePosition -133 def /UnderlineThickness 20 def end +/FontName (Troff) def +0 1 256 1 sub{Encoding exch /.notdef put}for +CD /.notdef{500 0 setcharwidth{}}put +Encoding (1) 0 get /br put +%% bold vertical rule used by tbl +CD /br{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +0 .9 l +{S} +}put +Encoding (2) 0 get /ul put +%% underline used by tbl +CD /ul{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 -.1 m +.5 -.1 l +{S} +}put +Encoding (3) 0 get /ru put +%% baseline rule +CD /ru{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +m0 +.5 0 l +{S} +}put +Encoding (4) 0 get /vr put +%% vertical rule +CD /vr{ +C +0 0 -.5 -.5 1 1 s +np +.05 sl +m0 +0 1 l +{S} +}put +Encoding (5) 0 get /sq put +%% square +CD /sq{ +C +.5 0 -.5 -.5 1 1 s +np +.05 sl +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{S} +}put +Encoding (6) 0 get /bx put +%% solid box +CD /bx{ +C +.5 0 -.5 -.5 1 1 s +np +0 .25 m +0 .5 rl +.5 0 rl +0 -.5 rl +-.5 0 rl +closepath +{fill} +}put +Encoding (7) 0 get /rn put +%% radical extender +CD /rn{ +C +.5 0 -.5 -.5 1 1 s +np +.03 sl +-.03 .9 m +.5 0 rl +{S} +}put +Encoding (8) 0 get /GR put +%% gray mask +CD /GR{ +C +.5 0 setcharwidth +.5 setgray +np +0 -.1 m +0 1 rl +.5 0 rl +0 -1 rl +-.5 0 rl +closepath +{fill} +}put +Encoding 97 /a put +CD /a{1000 0 0 66 942 421 s 430 415 +m 578 406 678 349 662 319 c 655 306 614 287 583 +296 c 570 300 466 340 438 332 c 365 309 335 213 +270 209 c 0 310 m 108 310 l 108 114 l 0 +114 l 0 310 l 42 161 m 42 134 l 66 134 l 66 +161 l 42 161 l 47 155 m 47 140 l 62 140 l 62 +155 l 47 155 l 110 133 m 226 113 300 66 410 +80 c 497 91 550 69 634 76 c 645 76 663 92 669 +107 c 677 125 673 141 668 160 c 725 334 m 758 +332 734 253 701 250 c 501 325 m 475 316 476 309 +473 302 c 465 282 482 263 499 257 c 552 236 615 +253 689 253 c 701 253 713 236 713 218 c 712 194 +702 168 678 161 c 671 159 663 160 655 160 c 591 +158 516 156 479 168 c 461 173 453 191 453 210 c 453 +224 456 235 466 244 c 476 253 490 252 503 255 c 459 +84 m 447 96 435 106 435 123 c 435 136 440 145 447 +155 c 453 163 462 168 469 173 c 110 293 m 173 +318 300 421 435 415 c 609 407 852 416 885 411 c 898 +409 924 411 930 380 c 942 316 828 339 742 334 c 731 +334 730 335 725 335 c 701 336 685 336 660 336 c{S}}put +Encoding 98 /b put +CD /b{1000 0 -12 66 930 421 s 500 +415 m 352 406 252 349 268 319 c 275 306 316 287 +347 296 c 360 300 464 340 492 332 c 565 309 595 +213 660 209 c 930 310 m 822 310 l 822 114 l 930 +114 l 930 310 l 888 161 m 888 134 l 864 134 +l 864 161 l 888 161 l 883 155 m 883 140 l 868 +140 l 868 155 l 883 155 l 820 133 m 704 113 +630 66 520 80 c 433 91 380 69 296 76 c 285 76 +267 92 261 107 c 253 125 257 141 262 160 c 205 +334 m 172 332 196 253 229 250 c 429 325 m 455 +316 454 309 457 302 c 465 282 448 263 431 257 c 378 +236 315 253 241 253 c 229 253 217 236 217 218 c 218 +194 228 168 252 161 c 259 159 267 160 275 160 c 339 +158 414 156 451 168 c 469 173 477 191 477 210 c 477 +224 474 235 464 244 c 454 253 440 252 427 255 c 471 +84 m 483 96 495 106 495 123 c 495 136 490 145 483 +155 c 477 163 468 168 461 173 c 820 293 m 757 +318 630 421 495 415 c 321 407 78 416 45 411 c 32 +409 6 411 0 380 c -12 316 102 339 188 334 c 199 +334 200 335 205 335 c 229 336 245 336 270 336 c{S}}put +Encoding 99 /c put +CD /c{1000 0 184 0 827 627 s 185 315 +m 186 488 332 627 505 625 c 682 623 827 467 815 +290 c 804 124 666 0 500 0 c 327 0 184 142 185 +315 c{S}}put +Encoding 100 /d put +CD /d{590 0 134 158 477 500 s 300 +160 m 208 162 134 238 135 330 c 136 423 212 500 +305 500 c 397 500 473 427 475 335 c 477 239 396 +158 300 160 c{fill}}put +Encoding 101 /e put % Bell Symbol +CD /e{1010 0 -100 -210 1010 1010 s 100 sl 0 setlinecap +420 300 450 0 360 arc +420 650 m 420 575 l S +newpath 120 125 m 720 125 l 75 sl S +420 125 m 420 25 l S +220 400 m 220 175 120 175 100 a p p p p +220 400 m 220 550 420 550 80 a p p p p +620 400 m 620 175 720 175 100 a p p p p +620 400 m 620 550 420 550 80 a p p p p +295 550 m 545 550 l{S}}put +/BuildChar{altRTD /BuildChar get exec}def end +altRTD begin /BuildChar{altRTD begin +/char exch def /fontdict exch def save +/charname fontdict /Encoding get char get def +fontdict /StrokeWidth get sl +fontdict /CD get dup charname known +{charname}{/.notdef}ifelse get newpath exec +fontdict /PaintType get 0 eq{exec}{p S}ifelse +restore end}def end +systemdict /currentpacking known{F_Troff /SavePacking get setpacking}if +/Troff F_Troff definefont pop +/Y1{/Troff FF}def +%%EndProlog +%%Page: 1 1 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +120 V +1260(#)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(1)S +7920 V +EP +%%Page: 1 2 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(NAME)S +1080 V +10 R +1260(ximtool)S +1602(\261)S +1682(interactive)S +2133(image)S +2407(display)S +2726(program)S +3094(for)S +3240(the)S +3392(X)S +3494(Window)S +3868(System)S +1308 V +9 B +900(SYNOPSIS)S +1428 V +10 B +1260(ximtool)S +1612([\261)S +10 I +1695(toolkitoption)S +10 B +2237(...])S +2375([)S +10 I +2438(options)S +10 B +2763(...])S +1656 V +9 B +900(OPTIONS)S +1776 V +10 B +1260(-basePixel)S +10 I +1723(N)S +1896 V +10 R +1510(The)S +1709(base)S +1930(colormap)S +2351(cell)S +2539(used)S +2766(by)S +2910(the)S +3076(colormap.)S +3552(This)S +3774(essentially)S +4240(allows)S +4545(you)S +4739(to)S +4861(reserve)S +10 I +5192(basePixel)S +2016 V +10 R +1510(colors)S +1793(in)S +1910(the)S +2071(global)S +2360(colormap)S +2776(for)S +2931(other)S +3175(applications.)S +3752(The)S +3946(default)S +4262(is)S +4367(64,)S +4530(if)S +4629(changed)S +4999(you'll)S +5276(need)S +5502(to)S +2136 V +1510(also)S +1701(specify)S +2019(the)S +10 I +2171(-cmapInitialize)S +10 R +2806(option)S +3092(or)S +3205(resource.)S +2304 V +10 B +1260(-cmap1)S +10 I +1606(\256le)S +2424 V +10 R +1510(User)S +1728(colormap)S +2135(1.)S +2270(This)S +2478(\257ag)S +2658(allows)S +2949(you)S +3129(to)S +3237(specify)S +3555(a)S +3629(colormap)S +4036(to)S +4144(be)S +4268(made)S +4514(available)S +4904(at)S +5006(task)S +5197(startup.)S +2592 V +10 B +1260(-cmap2)S +10 I +1606(\256le)S +2712 V +10 R +1510(User)S +1734(colormap)S +2147(2.)S +2288(This)S +2502(\257ag)S +2688(allows)S +2985(you)S +3171(to)S +3285(specify)S +3609(a)S +3689(second)S +4002(colormap)S +4415(to)S +4529(be)S +4660(made)S +4913(available)S +5310(at)S +5419(task)S +2832 V +1510(startup.)S +3000 V +10 B +1260(-cmapDir1)S +10 I +1750(dir)S +3120 V +10 R +1510(User)S +1728(colormap)S +2135(directory)S +2525(1.)S +2660(Speci\256es)S +3051(a)S +3125(directory)S +3515(to)S +3623(be)S +3747(searched)S +4125(for)S +4271(colormaps.)S +3288 V +10 B +1260(-cmapDir2)S +10 I +1750(dir)S +3408 V +10 R +1510(User)S +1742(colormap)S +2164(directory)S +2569(2.)S +2719(Speci\256es)S +3125(a)S +3214(directory)S +3619(to)S +3742(be)S +3881(searched)S +4274(for)S +4435(colormaps.)S +4951(By)S +5113(default)S +5435(this)S +3528 V +1510(points)S +1790(to)S +1903(the)S +2060(system)S +2373(directory)S +2768(/usr/local/lib/imtoolcmap,)S +3840(allowing)S +4225(a)S +4304(set)S +4450(of)S +4568(site)S +4741(default)S +5052(colormaps)S +5502(to)S +3648 V +1510(be)S +1634(de\256ned)S +1958(here.)S +3816 V +10 B +1260(-cmapInitialize)S +10 I +1934(bool)S +3936 V +10 R +1510(Initialize)S +1908(the)S +2073(ximtool)S +2428(colormap)S +2848(at)S +2963(startup.)S +3333(When)S +3614(setting)S +3924(the)S +10 I +4089(basePixel)S +10 R +4520(option)S +4819(or)S +4945(resource)S +5325(this)S +5513(is)S +4056 V +1510(required)S +1876(in)S +1988(order)S +2232(to)S +2344(force)S +2582(the)S +2738(Gterm)S +3027(widget)S +3333(to)S +3445(update)S +3745(its)S +3874(global)S +4158(colormap)S +4569(resource)S +4940(in)S +5052(the)S +5207(X)S +5312(server.)S +4176 V +1510(The)S +1695(default)S +2002(is)S +10 I +2099(false)S +10 R +2288(.)S +4344 V +10 B +1260(-cmapName)S +10 I +1805(name)S +4464 V +10 R +1510(Name)S +1784(used)S +2003(for)S +2156(private)S +2470(colormap.)S +2939(The)S +3131(default)S +3445(for)S +3598(all)S +3735(IRAF)S +4000(imaging)S +4365(applications)S +4885(is)S +10 I +4989(image)S +10 R +5233(.)S +5325(Gterm)S +4584 V +1510(widget)S +1822(based)S +2089(imaging)S +2457(applications)S +2980(which)S +3264(have)S +3492(the)S +3654(same)S +3899(value)S +4155(of)S +4277(cmapName)S +4770(will)S +4965(share)S +5214(the)S +5375(same)S +4704 V +1510(colormap,)S +1950(minimizing)S +2450(colormap)S +2865(\257ashing)S +3220(and)S +3402(allowing)S +3790(multiple)S +4162(applications)S +4683(to)S +4799(be)S +4931(run)S +5103(at)S +5214(the)S +5375(same)S +4824 V +1510(time.)S +4992 V +10 B +1260(-con\256g)S +10 I +1579(N)S +5112 V +10 R +1510(Initial)S +1799(frame)S +2081(bu)S +2181 H + (f)show 10 -.5 mul h (f)show +10 R +2242(er)S +2369(con\256guration)S +2952(number.)S +3362(The)S +3567(default)S +3894(value)S +4160(is)S +4277(1,)S +4402(indicating)S +4852(a)S +4947(512x512)S +5348(frame)S +5232 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(er)S +1778(with)S +1986(2)S +2066(frames.)S +2422(See)S +2596(below)S +2870(for)S +3016(information)S +3518(on)S +3648(the)S +3800(frame)S +4062(bu)S +4162 H + (f)show 10 -.5 mul h (f)show +10 R +4223(ers.)S +5400 V +10 B +1260(-defgui)S +5520 V +10 R +1510(Print)S +1737(the)S +1892(default)S +2202(GUI)S +2412(to)S +2523(the)S +2678(stdout.)S +3011(The)S +3199(GUI)S +3409(is)S +3509(a)S +3586(Tcl)S +3752(program)S +4123(that)S +4306(may)S +4511(be)S +4638(customized)S +5126(by)S +5259(the)S +5414(user)S +5640 V +1510(and)S +1684(reloaded)S +2057(using)S +2304(the)S +10 I +2456(-gui)S +10 R +2647(option)S +2933(or)S +3046(the)S +10 I +3198(gui)S +10 R +3356(resource)S +3723(parameter.)S +5808 V +10 B +1260(-displayPanner)S +10 I +1941(bool)S +5928 V +10 R +1510(Display)S +1859(panner)S +2168(marker)S +2488(window)S +2848(at)S +2958(startup.)S +3323(If)S +3427(set,)S +3601(a)S +3683(panner)S +3993(window)S +4354(showing)S +4732(the)S +4893(full)S +5071(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +6048 V +1510(will)S +1696(appear)S +1991(in)S +2099(the)S +2251(upper-right)S +2730(side)S +2921(of)S +3034(the)S +3186(main)S +3416(display)S +3735(window.)S +6216 V +10 B +1260(-displayCoords)S +10 I +1941(bool)S +6336 V +10 R +1510(Display)S +1855(WCS)S +2106(coordinate)S +2561(marker)S +2877(window)S +3233(at)S +3339(startup.)S +3700(If)S +3800(set,)S +3970(a)S +4048(coordinate)S +4503(readout)S +4836(text)S +5020(marker)S +5336(show-)S +6456 V +1510(ing)S +1668(will)S +1854(appear)S +2149(in)S +2257(the)S +2409(lower-right)S +2888(side)S +3079(of)S +3192(the)S +3344(main)S +3574(display)S +3893(window.)S +6624 V +10 B +1260(-\256fo)S +10 I +1462(pipe)S +6744 V +10 R +1510(Speci\256es)S +1901(the)S +2053(name)S +2299(of)S +2412(the)S +2564(\256fo)S +2733(pipe)S +2936(to)S +3045(be)S +3170(used,)S +3409(the)S +10 I +3562(i)S +10 R +3621(and)S +10 I +3796(o)S +10 R +3877(su)S +3966 H + (f)show 10 -.5 mul h (\256)show +10 R +4050(xes)S +4214(will)S +4401(be)S +4526(added)S +4795(automatically.)S +5425(The)S +6864 V +1510(default)S +1817(pipe)S +2019(names)S +2304(will)S +2490(be)S +2614(/dev/imt1i)S +3056(\(input)S +3325(pipe\))S +3560(and)S +3734(/dev/imt1o)S +4198(\(output)S +4517(pipe\).)S +7032 V +10 B +1260(-\256fo_only)S +7152 V +10 R +1510(If)S +1615(set,)S +1790(only)S +2007(\256fo)S +2185(pipes)S +2435(will)S +2630(be)S +2763(used)S +2985(for)S +3140(communication)S +3801(with)S +4018(a)S +4101(client)S +4363(program,)S +4766(sockets)S +5100(will)S +5296(be)S +5430(dis-)S +7272 V +1510(abled.)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(1)S +7920 V +EP +%%Page: 2 3 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(-gui)S +10 I +1457(\256le)S +1080 V +10 R +1510(Speci\256es)S +1901(the)S +2053(GUI)S +2260(\256le)S +2418(to)S +2526(be)S +2650(used.)S +1248 V +10 B +1260(-help)S +10 R +1510(Print)S +1735(a)S +1809(summary)S +2211(of)S +2324(command)S +2748(line)S +2928(options)S +3253(to)S +3361(the)S +3513(screen.)S +1416 V +10 B +1260(-imtoolrc)S +10 I +1683(\256le)S +1536 V +10 R +1510(Speci\256es)S +1923(the)S +2097(frame)S +2381(bu)S +2481 H + (f)show 10 -.5 mul h (f)show +10 R +2542(er)S +2671(con\256guration)S +3257(\256le)S +3438(to)S +3569(be)S +3716(used.)S +4007(See)S +4204(below)S +4501(for)S +4670(information)S +5195(on)S +5348(frame)S +1656 V +1510(bu)S +1610 H + (f)show 10 -.5 mul h (f)show +10 R +1671(ers.)S +1824 V +10 B +1260(-inet_only)S +1944 V +10 R +1510(If)S +1611(set,)S +1782(only)S +1995(inet)S +2180(sockets)S +2509(will)S +2700(be)S +2829(used)S +3047(for)S +3198(communication)S +3855(with)S +4068(a)S +4147(client)S +4404(program,)S +4802(\256fo)S +4976(pipes)S +5222(and)S +5402(unix)S +2064 V +1510(sockets)S +1834(will)S +2020(be)S +2144(disabled.)S +2232 V +10 B +1260(-invert)S +2352 V +10 R +1510(Start)S +1748(XImtool)S +2136(using)S +2402(inverted)S +2778(colormaps.)S +3298(When)S +3585(set,)S +3770(a)S +3863("normalized")S +4443(display)S +4781(will)S +4987(always)S +5314(be)S +5458(the)S +2472 V +1510(inverse)S +1828(of)S +1941(the)S +2093(selected)S +2444(colormap.)S +2640 V +10 B +1260(-ismdev)S +10 I +1623(dev)S +2760 V +10 R +1510(Speci\256es)S +1914(the)S +2079(plug-in)S +2411(ISM)S +2633(connection)S +3115(socket.)S +3469(This)S +3691(should)S +4002(be)S +4140(a)S +4228(unix)S +4450(domain)S +4794(socket)S +5093(of)S +5220(the)S +5386(form)S +2880 V +1510(")S +10 I +1551(/tmp/.ISM%d)S +10 R +2081(",)S +2189(where)S +2474(the)S +10 I +2638(%d)S +10 R +2813(will)S +3011(be)S +3147(replaced)S +3526(by)S +3667(the)S +3830(user)S +4037(id.)S +4211(Once)S +4462(an)S +4597(ISM)S +4816(has)S +4990(connected)S +5435(this)S +3000 V +1510(port)S +1701(is)S +1798(freed)S +2032(to)S +2140(accept)S +2424(other)S +2659(connections.)S +3168 V +10 B +1260(-maxColors)S +10 I +1789(N)S +3288 V +10 R +1510(Specify)S +1845(the)S +1997(max)S +2199(number)S +2534(of)S +2647(colors)S +2921(to)S +3029(be)S +3153(used)S +3366(for)S +3512(the)S +3664(display.)S +3456 V +10 B +1260(-memModel)S +10 I +1805(type)S +3576 V +10 R +1510(Determines)S +2003(how)S +2208(ximtool)S +2553(uses)S +2758(memory)S +3125(in)S +3237(the)S +3393(ximtool)S +3739(client)S +3995(and)S +4173(the)S +4329(X)S +4435(server.)S +4737(The)S +4926(options)S +5255(are)S +10 I +5410(fast)S +10 R +5555(,)S +3696 V +10 I +1510(beNiceToServer)S +10 R +2153(,)S +2220(and)S +10 I +2406(small)S +10 R +2623(.)S +2720(The)S +2917(default)S +3236(is)S +10 I +3345(fast)S +10 R +3490(,)S +3557(which)S +3843(uses)S +4057(server)S +4342(pixmaps)S +4723(to)S +4843(make)S +5101(frame)S +5374(blink)S +3816 V +1510(fast.)S +1742(This)S +1953(is)S +2053(recommended)S +2651(unless)S +2934(server)S +3210(memory)S +3576(is)S +3676(very)S +3886(limited.)S +4258(Note)S +4485(that)S +4668(even)S +4889(in)S +5000(fast)S +5177(mode,)S +5458(the)S +3936 V +1510(server)S +1792(pixmap)S +2131(is)S +2237(only)S +2454(the)S +2615(size)S +2808(of)S +2929(the)S +3089(display)S +3416(window,)S +3801(so)S +3928(memory)S +4299(usage)S +4564(is)S +4669(reasonable)S +5133(even)S +5359(if)S +5458(the)S +4056 V +1510(frame)S +1772(bu)S +1872 H + (f)show 10 -.5 mul h (f)show +10 R +1933(er)S +2040(is)S +2137(very)S +2344(large.)S +4224 V +10 B +1260(-nframes)S +10 I +1672(N)S +4344 V +10 R +1510(Speci\256es)S +1913(the)S +2077(number)S +2424(of)S +2549(frame)S +2823(bu)S +2923 H + (f)show 10 -.5 mul h (f)show +10 R +2984(ers)S +3142(to)S +3262(con\256gure)S +3681(at)S +3795(startup.)S +4164(By)S +4323(default)S +4642(there)S +4883(will)S +5081(be)S +5217(2)S +5309(frames)S +4464 V +1510(available,)S +1925(a)S +1999(maximum)S +2435(of)S +2548(4)S +2628(frames)S +2929(are)S +3080(allowed.)S +4632 V +10 B +1260(-port)S +10 I +1506(N)S +4752 V +10 R +1510(Speci\256es)S +1901(the)S +2053(port)S +2244(number)S +2579(to)S +2687(use)S +2850(when)S +3096(connecting)S +3564(through)S +3905(an)S +4029(inet)S +4209(socket.)S +4920 V +10 B +1260(-port_only)S +5040 V +10 R +1510(Same)S +1770(as)S +10 I +1891(-inet_only)S +10 R +2334(option.)S +2683(If)S +2787(set,)S +2961(only)S +3177(inet)S +3365(sockets)S +3697(will)S +3891(be)S +4023(used)S +4244(for)S +4398(communication)S +5058(with)S +5275(a)S +5358(client)S +5160 V +1510(program.)S +5328 V +10 B +1260(-printCon\256g)S +10 I +1824(name)S +5448 V +10 R +1510(Speci\256es)S +1916(the)S +2083(printer)S +2394(con\256guration)S +2973(\256le)S +3147(to)S +3271(use.)S +3505(By)S +3668(default)S +3991(this)S +4182(will)S +4384(be)S +4524(/usr/local/lib/ximprint.cfg.)S +5568 V +1510(See)S +1684(below)S +1958(for)S +2104(more)S +2339(information)S +2841(on)S +2971(con\256guring)S +3462(output)S +3748(devices.)S +5736 V +10 B +1260(-tile)S +10 R +1510(The)S +1695(default)S +2002(display)S +2321(mode)S +2573(is)S +2670(to)S +2778(view)S +3002(one)S +3177(frame)S +3440(at)S +3543(a)S +3618(time.)S +3852(In)S +3966(tile)S +4125(frames)S +4427(mode,)S +4705(2)S +4786(or)S +4900(4)S +4981(frames)S +5283(may)S +5486(be)S +5856 V +1510(viewed)S +1834(simultaneously)S +2476(in)S +2590(the)S +2748(display)S +3073(window.)S +3486(All)S +3650(the)S +3808(usual)S +4055(operations)S +4507(\(zoom)S +4798(and)S +4977(pan,)S +5181(colortable)S +5976 V +1510(enhancement,)S +2091(cursor)S +2370(readback,)S +2784(etc.\))S +3018(still)S +3199(work)S +3434(for)S +3580(each)S +3792(frame)S +4054(even)S +4272(when)S +4518(in)S +4626(tile)S +4784(frames)S +5085(mode.)S +6144 V +10 B +1260(-unix)S +10 I +1513(name)S +6264 V +10 R +1510(Speci\256es)S +1909(the)S +2069(unix)S +2285(domain)S +2623(socket)S +2916(name)S +3170(to)S +3286(use.)S +3512(A)S +3622("%d")S +3876(in)S +3993(the)S +4154(\256lename)S +4537(will)S +4732(be)S +4865(replaced)S +5241(with)S +5458(the)S +6384 V +1510(user)S +1706(id.)S +6552 V +10 B +1260(-unix_only)S +6672 V +10 R +1510(If)S +1607(set,)S +1774(only)S +1983(unix)S +2192(domain)S +2523(sockets)S +2848(will)S +3035(be)S +3160(used)S +3374(for)S +3521(communication)S +4174(with)S +4383(a)S +4458(client)S +4711(program,)S +5105(inet)S +5286(sockets)S +6792 V +1510(and)S +1684(\256fos)S +1892(will)S +2078(be)S +2202(disabled.)S +7080 V +9 B +900(APPLICATION)S +1557(RESOURCES)S +7200 V +10 R +1260(XImtool)S +1629(is)S +1726(implemented)S +2278(as)S +2391(a)S +2465(client)S +2717(program)S +3085(which)S +3359(is)S +3456(responsible)S +3941(for)S +4087(loading)S +4418(the)S +4571(frame)S +4834(bu)S +4934 H + (f)show 10 -.5 mul h (f)show +10 R +4995(ers/colormaps,)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(2)S +7920 V +EP +%%Page: 3 4 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(communicating)S +1917(with)S +2130(clients,)S +2451(etc,)S +2627(and)S +2806(a)S +2885(user-modi\256able)S +3547(GUI)S +3759(\256le)S +3922(written)S +4240(as)S +4358(a)S +4437(Tcl)S +4605(script)S +4862(which)S +5141(handles)S +5480(all)S +1080 V +1260(the)S +1412(user)S +1608(interface)S +1986(details.)S +2332(The)S +10 I +2517(client)S +2770(resources)S +10 R +3189(described)S +3602(below)S +3877(will)S +4064(be)S +4189(common)S +4570(to)S +4679(any)S +4854(user-de\256ned)S +5378(GUI,)S +1200 V +1260(the)S +10 I +1426(gui)S +1598(resources)S +10 R +2030(may)S +2246(change)S +2572(depending)S +3032(on)S +3176(how)S +3392(extensively)S +3890(the)S +4055(GUI)S +4275(has)S +4451(been)S +4682(modi\256ed)S +5081(by)S +5224(the)S +5389(user.)S +1320 V +1260(Each)S +1495(of)S +1615(these)S +1857(components)S +2377(has)S +2547(its)S +2679(own)S +2888(set)S +3036(of)S +3156(resources,)S +3594(but)S +3759(to)S +3874(the)S +4033(user)S +4236(setting)S +4540(them)S +4777(is)S +4881(the)S +5040(same)S +5282(as)S +5402(with)S +1440 V +1260(any)S +1434(other)S +1669(application.)S +1680 V +10 I +1260(Gterm)S +10 R +1548(widget)S +1853(resources)S +2262(\(i.e.)S +2450(those)S +2694(for)S +2844(the)S +3000(main)S +3234(image)S +3512(window)S +3868(or)S +3985(colorbar\))S +4384(may)S +4590(be)S +4718(set)S +4863(as)S +4980(either)S +5241(client)S +5497(or)S +1800 V +1260(GUI)S +1467(resources.)S +1928(See)S +2102(the)S +10 I +2254(xgterm\(1\))S +10 R +2677(man)S +2879(page)S +3097(for)S +3243(a)S +3317(complete)S +3713(description)S +4187(of)S +10 I +4300(Gterm)S +10 R +4585(widget)S +4887(resources.)S +2088 V +9 B +1080(CLIENT)S +1452(RESOURCES)S +2208 V +10 R +1260(The)S +1445(client)S +1697(resources)S +2103(generally)S +2504(de\256ne)S +2778(the)S +2930(initial)S +3194(state)S +3407(of)S +3520(the)S +3672(application)S +4146(or)S +4259(set)S +4400(con\256guration)S +4963(parameters.)S +2376 V +10 B +1620(Resource)S +2043(Name)S +2870(Default)S +3216(Value)S +2484 V +10 R +1620(defCon\256g)S +2870(1)S +2592 V +1620(defNFrames)S +2870(0)S +2700 V +1620(tileBorderWidth)S +2870(3)S +2808 V +1620(tileBorderColor)S +2870(9)S +2916 V +1620(autoscale)S +2870(false)S +3024 V +1620(antialias)S +2870(false)S +3132 V +1620(antialiasType)S +2870(boxcar)S +3240 V +1620(tileFrames)S +2870(false)S +3348 V +1620(highlightFrames)S +2870(true)S +3456 V +1620(gui)S +2870(default)S +3564 V +1620(imtoolrc)S +2870(/usr/local/lib/imtoolrc)S +3672 V +1620(invert)S +2870(false)S +3780 V +1620(memModel)S +2870(fast)S +3888 V +1620(basePixel:)S +2870(64)S +3996 V +1620(maxColors:)S +2870(216)S +4104 V +1620(cmapInitialize:)S +2870(false)S +4212 V +1620(cmap1)S +2870(none)S +4320 V +1620(cmap2)S +2870(none)S +4428 V +1620(cmapDir1)S +2870(none)S +4536 V +1620(cmapDir2)S +2870(/usr/local/lib/imtoolcmap)S +4644 V +1620(input_\256fo)S +2870(/dev/imt1i)S +4752 V +1620(output_\256fo)S +2870(/dev/imt1o)S +4860 V +1620(unixaddr)S +2870(/tmp/.IMT%d)S +4968 V +1620(port)S +2870(5137)S +5076 V +1620(ism_addr)S +2870(/tmp/.ISM%d)S +5184 V +1620(ism_task)S +2870("ism_wcspix.e)S +3488(wcspix)S +3801(&")S +5424 V +1260(Description)S +1756(of)S +1869(ximtool)S +2211(client)S +2463(resources:)S +5712 V +10 B +1260(defCon\256g)S +10 R +2160(Default)S +2499(frame)S +2772(bu)S +2872 H + (f)show 10 -.5 mul h (f)show +10 R +2933(er)S +3051(con\256guration)S +3625(number)S +3971(on)S +4112(startup.)S +4480(See)S +4665(below)S +4950(for)S +5107(more)S +5353(infor-)S +5832 V +2160(mation)S +2468(on)S +2598(frame)S +2860(bu)S +2960 H + (f)show 10 -.5 mul h (f)show +10 R +3021(ers.)S +6000 V +10 B +1260(defNFrames)S +10 R +2160(Default)S +2496(number)S +2838(of)S +2958(frames)S +3266(on)S +3403(startup.)S +3767(Set)S +3932(to)S +4047(zero)S +4255(to)S +4371(use)S +4542(the)S +4702(value)S +4956(from)S +5188(the)S +5348(frame)S +6120 V +2160(bu)S +2260 H + (f)show 10 -.5 mul h (f)show +10 R +2321(er)S +2428(con\256guration)S +2991(\()S +10 I +3024(imtoolrc)S +10 R +3363(\))S +3426(\256le.)S +6288 V +10 B +1260(tileBorderWidth)S +6396 V +1260(tileBorderColor)S +10 R +2160(Used)S +2401(by)S +2537(the)S +2695(tile)S +2859(frames)S +3166(option.)S +3513(Speci\256es)S +3910(how)S +4118(far)S +4264(apart)S +4499(to)S +4613(space)S +4870(the)S +5029(frames)S +5337(in)S +5452(tile)S +6516 V +2160(frames)S +2484(mode.)S +2814(Color)S +3095("9")S +3280(refers)S +3559(to)S +3690(the)S +3865(Gterm)S +4172(widget)S +4496(resource)S +4885(color9,)S +5217(which)S +5513(is)S +6636 V +2160(assigned)S +2534(a)S +2608(color)S +2843(with)S +3051(its)S +3176(own)S +3378(resource.)S +6804 V +10 B +1260(autoscale)S +10 R +2160(Enable/disable)S +2778(the)S +2930(autoscale)S +3331(option.)S +6972 V +10 B +1260(antialias)S +10 R +2160(Enable/disable)S +2778(the)S +2930(antialias)S +3293(option.)S +7140 V +10 B +1260(antialiasType)S +10 R +2160(Type)S +2419(of)S +2556(antialiasing.)S +3126(Options)S +3497(include)S +10 I +3846(boxcar)S +10 R +4178(\(default\),)S +10 I +4601(bilinear)S +10 R +4918(,)S +10 I +4998(nearest)S +10 R +5292(,)S +10 I +5372(area)S +10 R +5555(,)S +7260 V +10 I +2160(blkavg)S +10 R +2426(,)S +10 I +2481(lowpass)S +10 R +2804(,)S +2859(and)S +10 I +3033(gaussian)S +10 R +3389(.)S +7740 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(3)S +7920 V +EP +%%Page: 4 5 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(tileFrames)S +10 R +2160(Enable/disable)S +2778(the)S +2930(tile)S +3088(frames)S +3389(option.)S +1128 V +10 B +1260(highlightFrames)S +10 R +2160(Determines)S +2650(whether)S +3001(the)S +3153(current)S +3465(frame)S +3727(is)S +3824(highlighted)S +4310(when)S +4556(in)S +4664(tile)S +4822(frames)S +5123(mode.)S +1296 V +10 B +1260(gui)S +10 R +2160(The)S +2349(GUI)S +2560(to)S +2672(be)S +2800(executed.)S +3243("default")S +3636(refers)S +3896(to)S +4008(the)S +4164(default,)S +4500(builtin)S +4796(ximtool)S +5142(GUI.)S +5408(You)S +1416 V +2160(can)S +2341(replace)S +2671(this)S +2859(with)S +3080(your)S +3306(own)S +3521(GUI)S +3741(\256le)S +3911(if)S +4014(you)S +4206(are)S +4369(bold)S +4589(enough,)S +4950(and)S +5136(completely)S +1536 V +2160(change)S +2472(the)S +2624(look)S +2832(and)S +3006(functionality)S +3547(of)S +3660(the)S +3812(GUI)S +4019(if)S +4110(desired.)S +1704 V +10 B +1260(imtoolrc)S +10 R +2160(Where)S +2496(to)S +2645(\256nd)S +2872(the)S +3065(imtoolrc)S +3475(\256le.)S +3730(This)S +3980(de\256nes)S +4335(the)S +4529(recognized)S +5038(frame)S +5342(bu)S +5442 H + (f)show 10 -.5 mul h (f)show +10 R +5503(er)S +1824 V +2160(con\256gurations.)S +1992 V +10 B +1260(invert)S +10 R +2160(Start)S +2388(Ximtool)S +2761(using)S +3017(an)S +3150(inverted)S +3516(colormap.)S +3987(When)S +4264(set,)S +4440(a)S +4524("normalized")S +5095(display)S +5424(will)S +2112 V +2160(always)S +2467(be)S +2591(the)S +2743(inverse)S +3061(of)S +3174(the)S +3326(selected)S +3677(colormap.)S +2280 V +10 B +1260(memModel)S +10 R +2160(Determines)S +2656(how)S +2864(ximtool)S +3212(uses)S +3420(memory)S +3789(in)S +3904(the)S +4063(ximtool)S +4412(client)S +4671(and)S +4852(the)S +5011(X)S +5120(server.)S +5425(The)S +2400 V +2160(options)S +2491(are)S +10 I +2648(fast)S +10 R +2793(,)S +10 I +2853(beNiceToServer)S +10 R +3496(,)S +3556(and)S +10 I +3735(small)S +10 R +3952(.)S +4042(The)S +4232(default)S +4544(is)S +10 I +4646(fast)S +10 R +4791(,)S +4851(which)S +5130(uses)S +5337(server)S +2520 V +2160(pixmaps)S +2536(to)S +2651(make)S +2904(frame)S +3173(blink)S +3416(fast.)S +3652(This)S +3867(is)S +3971(recommended)S +4573(unless)S +4861(server)S +5142(memory)S +5513(is)S +2640 V +2160(very)S +2369(limited.)S +2740(Note)S +2966(that)S +3148(even)S +3368(in)S +3478(fast)S +3654(mode,)S +3933(the)S +4087(server)S +4362(pixmap)S +4694(is)S +4793(only)S +5003(the)S +5157(size)S +5344(of)S +5458(the)S +2760 V +2160(display)S +2491(window,)S +2880(so)S +3012(memory)S +3388(usage)S +3658(is)S +3768(reasonable)S +4237(even)S +4468(if)S +4572(the)S +4737(frame)S +5012(bu)S +5112 H + (f)show 10 -.5 mul h (f)show +10 R +5173(er)S +5293(is)S +5403(very)S +2880 V +2160(large.)S +2988 V +10 B +1260(basePixel)S +3096 V +1260(maxColors)S +10 R +2160(These)S +2434(two)S +2620(resources)S +3032(determine)S +3467(the)S +3626(region)S +3918(of)S +4038(colormap)S +4452(space)S +4710(used)S +4930(to)S +5045(render)S +5336(image)S +3216 V +2160(pixels.)S +3384 V +10 B +1260(cmapInitialize)S +10 R +2160(Initialize)S +2545(the)S +2697(ximtool)S +3039(colormap)S +3446(at)S +3548(startup.)S +3905(This)S +4113(is)S +4210(a)S +4284(required)S +4646(resource)S +5013(to)S +5121(clear)S +5345(a)S +5420(pre-)S +3504 V +2160(vious)S +2407(ximtool)S +2749(colormap)S +3156(allowing)S +3536(a)S +3610(new)S +10 B +3806(basePixel)S +10 R +4236(and)S +10 B +4410(maxColors)S +10 R +4906(to)S +5014(take)S +5210(e)S +5254 H + (f)show 10 -.5 mul h (f)show +10 R +5315(ect.)S +3672 V +10 B +1260(cmap1)S +3780 V +1260(cmap2)S +10 R +2160(User)S +2389(colormap)S +2807(\256les.)S +3070(The)S +3266(intent)S +3535(here)S +3748(is)S +3857(to)S +3977(allow)S +4241(individual)S +4689(colormaps)S +5147(to)S +5267(be)S +5403(con-)S +3900 V +2160(veniently)S +2562(speci\256ed)S +2947(as)S +3060(a)S +3134(resource.)S +4068 V +10 B +1260(cmapDir1)S +4176 V +1260(cmapDir2)S +10 R +2160(User)S +2393(or)S +2521(system)S +2844(colormap)S +3266(directories.)S +3788(By)S +3951(default)S +4274(cmapDir2)S +4719(points)S +5010(to)S +5134(the)S +5302(system)S +4296 V +2160(directory)S +2564(/usr/local/lib/imtoolcmap,)S +3644(allowing)S +4037(a)S +4124(set)S +4278(of)S +4404(site)S +4586(default)S +4906(colormaps)S +5365(to)S +5486(be)S +4416 V +2160(de\256ned)S +2484(here.)S +2740(This)S +2948(leaves)S +3227(cmapDir1)S +3656(available)S +4046(to)S +4154(a)S +4228(user)S +4424(colormap)S +4831(directory.)S +4584 V +10 B +1260(input_\256fo)S +4692 V +1260(output_\256fo)S +10 R +2160(The)S +2354(input)S +2600(and)S +2784(output)S +3080(\256fos)S +3298(for)S +3454(\256fo)S +3633(i/o.)S +3834("Input")S +4167(and)S +4351("output")S +4729(are)S +4890(from)S +5124(the)S +5286(client's)S +4812 V +2160(point)S +2396(of)S +2509(view.)S +2788(Note)S +3012(that)S +3192(only)S +3400(one)S +3574(display)S +3893(server)S +4166(can)S +4334(use)S +4497(a)S +4571(\256fo-pair)S +4928(at)S +5030(one)S +5204(time.)S +4980 V +10 B +1260(unixaddr)S +10 R +2160(Template)S +2569(address)S +2900(for)S +3048(unix)S +3258(domain)S +3591(socket.)S +3934(The)S +4122(user)S +4321(must)S +4549(have)S +4770(write)S +5008(permission)S +5480(on)S +5100 V +2160(this)S +2338(directory,)S +2756(or)S +2872(the)S +3027(\256le)S +3188(must)S +3416(already)S +3742(exist.)S +10 I +4019(%d)S +10 R +4152(,)S +4210(if)S +4304(given,)S +4584(is)S +4684(replaced)S +5054(by)S +5187(the)S +5342(user's)S +5220 V +2160(UID.)S +5388 V +10 B +1260(port)S +10 R +2160(TCP/IP)S +2500(port)S +2700(for)S +2855(the)S +3017(server.)S +3355(Note)S +3589(that)S +3779(only)S +3997(one)S +4181(server)S +4464(can)S +4642(listen)S +4899(on)S +5039(a)S +5123(port)S +5324(at)S +5436(one)S +5508 V +2160(time,)S +2402(so)S +2530(if)S +2630(multiple)S +3003(ximtool)S +3354(servers)S +3675(are)S +3835(desired)S +4161(on)S +4299(the)S +4459(same)S +4702(machine,)S +5103(they)S +5313(should)S +5628 V +2160(be)S +2284(given)S +2536(di)S +2614 H + (f)show 10 -.5 mul h (f)show +10 R +2675(erent)S +2904(ports.)S +5796 V +10 B +1260(ism_addr)S +10 R +2160(Template)S +2576(address)S +2914(for)S +3070(ISM)S +3288(unix)S +3506(domain)S +3846(socket.)S +4166(The)S +4361(user)S +4567(must)S +4802(have)S +5030(write)S +5275(permis-)S +5916 V +2160(sion)S +2367(on)S +2507(this)S +2692(directory,)S +3116(or)S +3238(the)S +3399(\256le)S +3566(must)S +3800(already)S +4132(exist.)S +10 I +4415(%d)S +10 R +4548(,)S +4612(if)S +4712(given,)S +4998(is)S +5104(replaced)S +5480(by)S +6036 V +2160(the)S +2312(user's)S +2580(UID.)S +6204 V +10 B +1260(ism_task)S +10 R +2160(Command)S +2616(string)S +2883(to)S +3000(execute)S +3343(for)S +3498(the)S +3660(real-time)S +4060(pixel)S +4300(and)S +4484(WCS)S +4741(readout)S +5080(ISM)S +5298(\(Image)S +6324 V +2160(Support)S +2507(Module\))S +2881(task.)S +6612 V +9 B +1080(GUI)S +1277(RESOURCES)S +6732 V +10 R +1260(In)S +1394(principle)S +1800(ximtool)S +2163(can)S +2352(have)S +2592(any)S +2788(number)S +3145(of)S +3280(di)S +3358 H + (f)show 10 -.5 mul h (f)show +10 R +3419(erent)S +3670(GUIs,)S +3963(each)S +4197(of)S +4332(which)S +4628(de\256nes)S +4963(its)S +5110(own)S +5334(set)S +5497(of)S +6852 V +1260(resources.)S +1733(GUIs)S +1991(typically)S +2383(de\256ne)S +2669(a)S +2755(great)S +2996(many)S +3260(resources,)S +3703(but)S +3873(most)S +4110(of)S +4234(these)S +4480(are)S +4642(not)S +4811(really)S +5079(intended)S +5464(for)S +6972 V +1260(modi\256cation)S +1796(by)S +1926(the)S +2078(user)S +2274(\(although)S +2687(one)S +2861(can)S +3029(modify)S +3348(them)S +3578(if)S +3669(desired\).)S +7212 V +1260(The)S +1455(following)S +1884(are)S +2045(some)S +2296(of)S +2419(the)S +2581(more)S +2826(useful)S +3110(resources)S +3526(used)S +3749(by)S +3889(the)S +4051(default)S +4369(ximtool)S +4722(GUI.)S +4995(The)S +10 I +5191(imagewin)S +7692 V +10 R +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(4)S +7920 V +EP +%%Page: 5 6 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(resources)S +1666(are)S +1817(Gterm)S +2102(widget)S +2404(resources.)S +1248 V +10 B +1620(Main)S +1878(Display)S +2231(Gterm)S +2543(Widget)S +2884(Resources)S +1416 V +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +1524 V +10 Y +1650(*)S +10 R +1700(imagewin.cmapName:)S +3370(image)S +1632 V +10 Y +1650(*)S +10 R +1700(imagewin.basePixel:)S +3370(64)S +1740 V +10 Y +1650(*)S +10 R +1700(imagewin.warpCursor:)S +3370(True)S +1848 V +10 Y +1650(*)S +10 R +1700(imagewin.raiseWindow:)S +3370(True)S +1956 V +10 Y +1650(*)S +10 R +1700(imagewin.deiconifyWindow:)S +3370(True)S +2064 V +10 Y +1650(*)S +10 R +1700(imagewin.ginmodeCursor:)S +3370(circle)S +2172 V +10 Y +1650(*)S +10 R +1700(imagewin.ginmodeBlinkInterval:)S +3370(500)S +2280 V +10 Y +1650(*)S +10 R +1700(imagewin.color0)S +2404(\(background\):)S +3370(black)S +2388 V +10 Y +1650(*)S +10 R +1700(imagewin.color1)S +2404(\(foreground\):)S +3370(white)S +2496 V +10 Y +1650(*)S +10 R +1700(imagewin.color8)S +2404(\(panner)S +2738(highlight\):)S +3370(#7c8498)S +2604 V +10 Y +1650(*)S +10 R +1700(imagewin.color9)S +2404(\(tileFrame)S +2850(color\):)S +3370(SteelBlue)S +2712 V +10 Y +1650(*)S +10 R +1700(imagewin.width:)S +3370(512)S +2820 V +10 Y +1650(*)S +10 R +1700(imagewin.height:)S +3370(512)S +3108 V +10 B +1620(GUI)S +1839(Resources)S +3276 V +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +3384 V +10 Y +1650(*)S +10 R +1700(autoscale:)S +3370(True)S +3492 V +10 Y +1650(*)S +10 R +1700(zoomfactors:)S +3370(1)S +3450(2)S +3530(4)S +3610(8)S +3600 V +10 Y +1650(*)S +10 R +1700(displayCoords:)S +3370(True)S +3708 V +10 Y +1650(*)S +10 R +1700(displayPanner:)S +3370(True)S +3816 V +10 Y +1650(*)S +10 R +1700(displayMagni\256er:)S +3370(True)S +3924 V +10 Y +1650(*)S +10 R +1700(blinkRate:)S +3370(1.0)S +4032 V +10 Y +1650(*)S +10 R +1700(pannerArea:)S +3370(150)S +10 Y +3520(*)S +10 R +3570(150)S +4140 V +10 Y +1650(*)S +10 R +1700(pannerGeom:)S +3370(-5+5)S +4248 V +10 Y +1650(*)S +10 R +1700(magni\256erArea:)S +3370(100)S +10 Y +3520(*)S +10 R +3570(100)S +4356 V +10 Y +1650(*)S +10 R +1700(magni\256erGeom:)S +3370(+5+5)S +4464 V +10 Y +1650(*)S +10 R +1700(wcsboxGeom:)S +3370(-5-5)S +4572 V +10 Y +1650(*)S +10 R +1700(maxContrast:)S +3370(5.0)S +4680 V +10 Y +1650(*)S +10 R +1700(warnings:)S +3370(True)S +4788 V +10 Y +1650(*)S +10 R +1700(centerBoxSize:)S +3370(5)S +4896 V +10 Y +1650(*)S +10 R +1700(peakCentroid:)S +3370(True)S +5184 V +10 B +1620(Alternate)S +2054(GUI)S +2273(Resources)S +5352 V +1650(Resource)S +2073(Name)S +3370(Default)S +3716(Value)S +5460 V +10 Y +1650(*)S +10 R +1700(showToolBar:)S +3370(False)S +5568 V +10 Y +1650(*)S +10 R +1700(showPanelBar:)S +3370(False)S +5808 V +1260(Description)S +1756(of)S +1869(selected)S +2220(resources:)S +6096 V +10 Y +1260(*)S +10 B +1310(cmapName)S +10 R +2360(Name)S +2638(used)S +2861(for)S +3018(private)S +3336(colormap.)S +3809(The)S +4005(default)S +4323(for)S +4480(all)S +4621(IRAF)S +4890(imaging)S +5259(applica-)S +6216 V +2360(tions)S +2601(is)S +2714("image".)S +3141(Gterm)S +3442(widget)S +3760(based)S +4033(imaging)S +4407(applications)S +4936(which)S +5225(have)S +5458(the)S +6336 V +2360(same)S +2597(value)S +2845(of)S +2961(cmapName)S +3448(will)S +3637(share)S +3880(the)S +4035(same)S +4273(colormap,)S +4708(minimizing)S +5203(colormap)S +6456 V +2360(\257ashing)S +2707(and)S +2881(allowing)S +3261(multiple)S +3625(applications)S +4138(to)S +4246(be)S +4370(run)S +4533(at)S +4635(the)S +4787(same)S +5022(time.)S +6624 V +10 Y +1260(*)S +10 B +1310(basePixel)S +10 R +2360(The)S +2545(base)S +2752(colormap)S +3159(cell)S +3333(used)S +3546(by)S +3676(the)S +3828(display)S +4147(colormap.)S +6792 V +10 Y +1260(*)S +10 B +1310(imagewin.warpCursor)S +10 R +2360(Warp)S +2611(pointer)S +2924(into)S +3110(image)S +3384(window)S +3736(when)S +3982(initiating)S +4374(a)S +4448(cursor)S +4727(read.)S +6960 V +10 Y +1260(*)S +10 B +1310(imagewin.raiseWindow)S +10 R +2360(Raise)S +2612(image)S +2886(window)S +3238(when)S +3484(initiating)S +3876(a)S +3950(cursor)S +4229(read.)S +7128 V +10 Y +1260(*)S +10 B +1310(imagewin.deiconifyWindow)S +7248 V +10 R +2360(Deiconify)S +2789(image)S +3063(window)S +3415(if)S +3506(necessary)S +3923(when)S +4169(initiating)S +4561(a)S +4635(cursor)S +4914(read.)S +7728 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(5)S +7920 V +EP +%%Page: 6 7 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 Y +1260(*)S +10 B +1310(imagewin.ginmodeCursor)S +1080 V +10 R +2360(Type)S +2596(of)S +2710(cursor)S +2990(when)S +3237(a)S +3312(cursor)S +3592(read)S +3795(is)S +3894(in)S +4004(progress.)S +4429(The)S +4616(default)S +4925(is)S +5024(a)S +5100(circle.)S +5408(Any)S +1200 V +2360(selection)S +2800(from)S +3079(the)S +3285(X)S +3441(cursor)S +3774(font)S +4019(can)S +4241(be)S +4419(used.)S +4741(A)S +4897(special)S +5258(case)S +5513(is)S +1320 V +2360("full_crosshair")S +3021(which)S +3295(is)S +3392(the)S +3544(full)S +3713(crosshair)S +4103(cursor)S +4382(of)S +4495(the)S +4647(Gterm)S +4932(widget.)S +1488 V +10 Y +1260(*)S +10 B +1310(imagewin.ginmodeBlinkInterval)S +1608 V +10 R +2360(Determines)S +2857(whether)S +3215(the)S +3374(cursor)S +3660(blinks)S +3942(when)S +4195(a)S +4277(cursor)S +4564(read)S +4773(is)S +4878(in)S +4994(progress.)S +5425(The)S +1728 V +2360(value)S +2606(is)S +2703(given)S +2955(in)S +3063(milliseconds.)S +1896 V +10 Y +1260(*)S +10 B +1310(imagewin.color0)S +10 R +2360(Background)S +2878(color.)S +2064 V +10 Y +1260(*)S +10 B +1310(imagewin.color1)S +10 R +2360(Foreground)S +2856(color.)S +2232 V +10 Y +1260(*)S +10 B +1310(imagewin.color8)S +10 R +2360(Color)S +2618(assigned)S +2992(the)S +3144(panner)S +3445(window.)S +2400 V +10 Y +1260(*)S +10 B +1310(imagewin.color9)S +10 R +2360(Color)S +2618(used)S +2831(for)S +2977(the)S +3129(tileFrames)S +3581(highlight.)S +2568 V +10 Y +1260(*)S +10 B +1310(imagewin.width)S +10 R +2360(Width)S +2640(of)S +2753(the)S +2905(main)S +3135(image)S +3409(window.)S +2736 V +10 Y +1260(*)S +10 B +1310(imagewin.height)S +10 R +2360(Height)S +2662(of)S +2775(the)S +2927(main)S +3157(image)S +3431(window.)S +2904 V +10 Y +1260(*)S +10 B +1310(pannerArea)S +10 R +2360(Area)S +2583(in)S +2691(pixels)S +2960(of)S +3073(the)S +3225(panner)S +3526(window.)S +3072 V +10 Y +1260(*)S +10 B +1310(pannerGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(panner)S +3456(window.)S +3240 V +10 Y +1260(*)S +10 B +1310(wcsboxGeom)S +10 R +2360(Where)S +2655(to)S +2763(place)S +3003(the)S +3155(coords)S +3451(box.)S +3408 V +10 Y +1260(*)S +10 B +1310(maxContrast)S +10 R +2360(Maximum)S +2807(contrast)S +3153(value.)S +3816 V +9 B +900(DESCRIPTION)S +3936 V +10 R +1260(As)S +1401(a)S +1475(display)S +1794(server,)S +2092(XImtool)S +2461(is)S +2558(started)S +2854(as)S +2967(a)S +3041(separate)S +3397(process)S +3726(from)S +3950(client)S +4202(software)S +4575(such)S +4788(as)S +4901(IRAF.)S +5185(Once)S +5426(it)S +5513(is)S +4056 V +1260(running)S +1606(it)S +1697(will)S +1888(accept)S +2177(client)S +2434(connections)S +2946(simultaneously)S +3587(on)S +3721(\256fo)S +3894(pipes,)S +4164(unix)S +4376(domain)S +4710(sockets,)S +5063(or)S +5180(inet)S +5364(sock-)S +4176 V +1260(ets.)S +1427(A)S +1530(display)S +1850(client)S +2103(like)S +2285(the)S +2439(IRAF)S +10 I +2699(DISPLAY)S +10 R +3120(task)S +3313(makes)S +3600(a)S +3676(connection)S +4146(and)S +4322(sends)S +4576(the)S +4730(image)S +5006(across)S +5287(using)S +5536(a)S +4296 V +1260(modi\256ed)S +1660(IIS)S +1826(Model)S +2131(70)S +2274(protocol.)S +2705(Once)S +2958(the)S +3123(image)S +3410(is)S +3520(loaded)S +3829(in)S +3950(the)S +4115(display)S +4447(bu)S +4547 H + (f)show 10 -.5 mul h (f)show +10 R +4608(er)S +4728(it)S +4827(may)S +5042(be)S +5179(enhanced,)S +4416 V +1260(saved)S +1521(to)S +1633(a)S +1711(disk)S +1912(\256le)S +2074(in)S +2186(a)S +2264(number)S +2603(of)S +2720(di)S +2798 H + (f)show 10 -.5 mul h (f)show +10 R +2859(erent)S +3092(formats,)S +3456(or)S +3573(printed)S +3890(as)S +4007(Encapsulated)S +4574(Postscript)S +5004(to)S +5117(a)S +5196(printer)S +5497(or)S +4536 V +1260(disk)S +1475(\256le.)S +1706(Up)S +1876(to)S +2002(sixteen)S +2332(frame)S +2611(bu)S +2711 H + (f)show 10 -.5 mul h (f)show +10 R +2772(ers)S +2935(are)S +3103(allowed,)S +3491(these)S +3743(may)S +3962(be)S +4103(displayed)S +4533(simultaneously)S +5186(in)S +5311(a)S +5402(tiled)S +4656 V +1260(mode,)S +1537(or)S +1650(blinked)S +1980(frame-to-frame.)S +2673(Each)S +2902(frame)S +3164(may)S +3366(have)S +3584(its)S +3710(own)S +3913(colormap)S +4321(or)S +4435(brightness/contrast)S +5221(enhance-)S +4776 V +1260(ment.)S +1545(Pan/Zoom)S +1992(and)S +2166(cursor)S +2445(readout)S +2774(are)S +2925(permitted)S +3338(using)S +10 I +3585(markers)S +10 R +3912(,)S +3967(on-line)S +4280(help)S +4482(is)S +4579(also)S +4770(available.)S +5016 V +1260(When)S +1540(run)S +1715(in)S +1835(standalone)S +2304(mode,)S +2593(images)S +2918(\(currently)S +3353(IRAF)S +3623(OIF,)S +3851(GIF,)S +4079(Sun)S +4277(Raster\256les)S +4741(or)S +4866(simple)S +5176(FITS)S +5425(\(i.e.)S +5136 V +1260(excluding)S +1693(MEF)S +1938(\256les\))S +2177(formats)S +2521(are)S +2681(permitted\))S +3136(may)S +3347(be)S +3479(loaded)S +3783(on)S +3921(the)S +4081(command)S +4513(line)S +4701(or)S +4822(by)S +4960(using)S +5215(the)S +5375(Load)S +5256 V +1260(Panel.)S +1558(This)S +1787(allows)S +2099(you)S +2300(to)S +2430(browse)S +2770(images)S +3105(and)S +3301(perform)S +3674(the)S +3848(same)S +4105(manipulations)S +4724(as)S +4859(if)S +4972(they)S +5196(had)S +5392(been)S +5376 V +1260(displayed)S +1673(by)S +1803(a)S +1877(client.)S +5664 V +9 B +1080(MOUSE)S +1437(OPERATIONS)S +5784 V +10 R +1260(Clicking)S +1648(and)S +1835(dragging)S +2233(MB1)S +2482(\(mouse)S +2819(button)S +3118(1\))S +3244(in)S +3365(the)S +3530(main)S +3773(image)S +4060(window)S +4425(creates)S +4745(a)S +4833(rectangular)S +5325(region)S +5904 V +1260(marker,)S +1604(used)S +1824(to)S +1939(select)S +2203(a)S +2284(region)S +2576(of)S +2696(the)S +2855(image.)S +3161(If)S +3264(you)S +3451(do)S +3588(this)S +3770(accidentally)S +4289(and)S +4470(don't)S +4718(want)S +4949(the)S +5108(marker,)S +5452(put)S +6024 V +1260(the)S +1419(pointer)S +1739(in)S +1854(the)S +2013(marker)S +2332(and)S +2513(type)S +2722(DELETE)S +3137(or)S +3258(BACKSPACE)S +3886(to)S +4002(delete)S +4278(the)S +4438(marker.)S +4783(With)S +5021(the)S +5181(pointer)S +5502(in)S +6144 V +1260(the)S +1417(marker,)S +1759(MB3)S +2000(will)S +2191(call)S +2370(up)S +2505(a)S +2584(marker)S +2901(menu)S +3158(listing)S +3444(some)S +3690(things)S +3970(you)S +4155(can)S +4328(do)S +4463(with)S +4676(the)S +4833(marker,)S +5174(like)S +5358(zoom)S +6264 V +1260(the)S +1420(outlined)S +1786(region.)S +2104(MB1)S +2348(can)S +2524(be)S +2656(used)S +2877(to)S +2993(drag)S +3208(or)S +3329(resize)S +3599(the)S +3759(marker.)S +4104(See)S +4287(below)S +4570(for)S +4725(more)S +4969(information)S +5480(on)S +6384 V +1260(markers.)S +6624 V +1260(Clicking)S +1642(on)S +1779(MB2)S +2022(in)S +2137(the)S +2296(main)S +2533(image)S +2814(window)S +3173(pans)S +3394(\(one)S +3609(click\))S +3874(or)S +3995(zooms)S +4294(\(two)S +4515(clicks\))S +4819(the)S +4979(image.)S +5286(Further)S +6744 V +1260(clicks)S +1529(cycle)S +1775(through)S +2122(the)S +2280(builtin)S +2578(zoom)S +2836(factors.)S +3198(Moving)S +3551(the)S +3709(pointer)S +4028(to)S +4142(a)S +4222(new)S +4424(location)S +4782(and)S +4962(clicking)S +5319(moves)S +6864 V +1260(the)S +1423(feature)S +1741(under)S +2010(the)S +2174(pointer)S +2499(to)S +2619(the)S +2783(center)S +3068(of)S +3193(the)S +3357(display)S +3688(window.)S +4137(Holding)S +4507(down)S +4771(the)S +4935(Shift)S +5172(key)S +5358(while)S +6984 V +1260(clicking)S +1620(MB2)S +1864(will)S +2058(cause)S +2317(a)S +2399(full-screen)S +2863(crosshair)S +3261(cursor)S +3547(to)S +3662(appear)S +3964(until)S +4185(the)S +4344(button)S +4637(is)S +4741(released,)S +5129(this)S +5311(can)S +5486(be)S +7104 V +1260(useful)S +1534(for)S +1680(\256ne)S +1860(positioning)S +2341(of)S +2454(the)S +2606(cursor.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(6)S +7920 V +EP +%%Page: 7 8 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(MB3)S +1507(is)S +1615(used)S +1839(to)S +1958(adjust)S +2238(the)S +2401(contrast)S +2758(and)S +2943(brightness)S +3395(of)S +3519(the)S +3682(displayed)S +4106(image.)S +4446(The)S +4643(position)S +5008(of)S +5133(the)S +5297(pointer)S +1080 V +1260(within)S +1560(the)S +1726(display)S +2059(window)S +2425(determines)S +2906(the)S +3071(contrast)S +3430(and)S +3617(brightness)S +4071(values.)S +4394(Click)S +4654(once)S +4885(to)S +5006(set)S +5160(the)S +5325(values)S +1200 V +1260(corresponding)S +1861(to)S +1969(the)S +2121(pointer)S +2434(location,)S +2811(or)S +2924(click)S +3148(and)S +3322(drag)S +3529(to)S +3637(continuously)S +4184(adjust)S +4453(the)S +4605(display.)S +1488 V +9 B +1080(KEYSTROKE)S +1677(ACCELERATORS)S +1608 V +10 R +1260(The)S +1445(following)S +1864(keystrokes)S +2321(are)S +2472(currently)S +2862(de\256ned)S +3186(in)S +3294(the)S +3446(GUI:)S +1848 V +1620(--------------------)S +10 B +2310(Misc)S +2545(Functions)S +10 R +2998(---------------------)S +1992 V +10 B +1620(Ctrl-b)S +10 R +2620(Previous)S +3000(\(back\))S +3284(frame)S +2100 V +10 B +1620(Ctrl-c)S +10 R +2620(Center)S +2916(frame)S +2208 V +10 B +1620(Ctrl-f)S +10 R +2620(Forward)S +2988(frame)S +2316 V +10 B +1620(Ctrl-i)S +10 R +2620(Invert)S +2888(colormap)S +2424 V +10 B +1620(Ctrl-m)S +10 R +2620(Toggle)S +2933(magni\256er)S +2532 V +10 B +1620(Ctrl-n)S +10 R +2620(Normalize)S +2640 V +10 B +1620(Ctrl-p)S +10 R +2620(Toggle)S +2933(panner)S +2748 V +10 B +1620(Ctrl-r)S +10 R +2620(Register)S +2856 V +10 B +1620(Ctrl-s)S +10 R +2620(Match)S +2905(LUT)S +3129(scaling)S +2964 V +10 B +1620(Ctrl-t)S +10 R +2620(Tile)S +2811(frames)S +3112(toggle)S +3072 V +10 B +1620(Ctrl-u)S +10 R +2620(Unzoom)S +2994(\(zoom=1\))S +3180 V +10 B +1620(Ctrl-x)S +10 R +2620(Flip)S +2812(X)S +3288 V +10 B +1620(Ctrl-y)S +10 R +2620(Flip)S +2812(Y)S +3456 V +10 B +1620(Ctrl-=)S +10 R +2620(Print)S +2845(using)S +3092(current)S +3404(setup)S +3564 V +10 B +1620(Ctrl-<)S +10 R +2620(Decrease)S +3014(blink)S +3250(rate)S +3429(\(blink)S +3698(faster\))S +3672 V +10 B +1620(Ctrl->)S +10 R +2620(Increase)S +2981(blink)S +3217(rate)S +3396(\(blink)S +3665(slower\))S +3780 V +10 B +1620(Ctrl-+)S +10 R +2620(Zoom)S +2889(in)S +3888 V +10 B +1620(Ctrl--)S +10 R +2620(Zoom)S +2889(out)S +4056 V +10 B +1620(Alt-1)S +1866(thru)S +2085(Alt-4)S +10 R +2620(Set)S +2778(frame)S +3040(to)S +3148(be)S +3272(displayed)S +4164 V +10 B +1620(Ctrl-1)S +1910(thru)S +2129(Ctrl9)S +10 R +2620(Set)S +2778(integer)S +3085(zoom)S +3337(factor)S +4332 V +10 B +1620(Ctrl-Alt-q)S +10 R +2620(Quit)S +4440 V +10 B +1620(Ctrl-Alt-f)S +10 R +2620(Fitframe)S +4608 V +1620(---------------------)S +10 B +2343(Panel)S +2612(Toggles)S +10 R +2970(---------------------)S +4752 V +10 B +1620(Alt-b)S +10 R +2620(Blink)S +2873(frames)S +4860 V +10 B +1620(Alt-c)S +10 R +2620(Control)S +2956(panel)S +4968 V +10 B +1620(Alt-h)S +10 R +2620(Help)S +2844(popup)S +5076 V +10 B +1620(Alt-i)S +10 R +2620(Info)S +2816(box)S +2996(popup)S +5184 V +10 B +1620(Alt-l)S +10 R +2620(Load)S +2855(\256le)S +3013(popup)S +5292 V +10 B +1620(Alt-p)S +10 R +2620(Print)S +2845(popup)S +5400 V +10 B +1620(Alt-s)S +10 R +2620(Save)S +2844(popup)S +5508 V +10 B +1620(Alt-t)S +10 R +2620(TclShell)S +2989(popup)S +5736 V +1620(-------------------)S +10 B +2277(Cursor)S +2612(Positioning)S +10 R +3121(------------------)S +5880 V +10 B +1620(Ctrl-h)S +1916(/)S +1974(Ctrl-Left)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(left)S +5988 V +10 B +1620(Ctrl-j)S +1893(/)S +1951(Ctrl-Down)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(down)S +6096 V +10 B +1620(Ctrl-k)S +1916(/)S +1974(Ctrl-Up)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(up)S +6204 V +10 B +1620(Ctrl-l)S +1888(/)S +1946(Ctrl-Right)S +10 R +3020(Move)S +3283(cursor)S +3562(one)S +3736(pixel)S +3966(right)S +6372 V +10 B +1620(Shift-Ctrl-h)S +2155(/)S +2213(Shift-Ctrl-Left)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(left)S +6480 V +10 B +1620(Shift-Ctrl-j)S +2132(/)S +2190(Shift-Ctrl-Down)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(down)S +6588 V +10 B +1620(Shift-Ctrl-k)S +2155(/)S +2213(Shift-Ctrl-Up)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(up)S +6696 V +10 B +1620(Shift-Ctrl-l)S +2127(/)S +2185(Shift-Ctrl-Right)S +10 R +3020(Move)S +3283(cursor)S +3562(ten)S +3714(pixels)S +3983(right)S +6924 V +1620(-------------------)S +10 B +2277(Auto-Registration)S +10 R +3078(-------------------)S +7068 V +10 B +1620(Ctrl-a)S +10 R +2620(Toggle)S +2933(auto-registration)S +7176 V +10 B +1620(Ctrl-o)S +10 R +2620(Set)S +2778(frame)S +3040(o)S +3090 H + (f)show 10 -.5 mul h (f)show +10 R +3151(set)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(7)S +7920 V +EP +%%Page: 8 9 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1620(--------------------)S +10 B +2310(Frame)S +2622(Positioning)S +10 R +3131(------------------)S +1104 V +10 B +1620(Ctrl-Left)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(left)S +1212 V +10 B +1620(Ctrl-Down)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(down)S +1320 V +10 B +1620(Ctrl-Up)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(up)S +1428 V +10 B +1620(Ctrl-Right)S +10 R +2620(Shift)S +2845(one)S +3019(full)S +3188(frame)S +3450(right)S +1596 V +10 B +1620(Ctrl-Alt-Left)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(left)S +1704 V +10 B +1620(Ctrl-Alt-Down)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(down)S +1812 V +10 B +1620(Ctrl-Alt-Up)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(up)S +1920 V +10 B +1620(Ctrl-Alt-Right)S +10 R +2620(Shift)S +2845(one)S +3019(half)S +3204(frame)S +3466(right)S +2148 V +1620(-------------------)S +10 B +2277(Peak-Up)S +2679(Centroiding)S +10 R +3226(-----------------)S +2292 V +10 B +1620(Ctrl-[)S +10 R +2620(Decrease)S +3014(centroiding)S +3499(box)S +3679(size)S +2400 V +10 B +1620(Ctrl-])S +10 R +2620(Increase)S +2981(centroiding)S +3466(box)S +3646(size)S +2508 V +10 B +1620(Ctrl-0)S +1910(\(zero\))S +10 R +2620(Centroid/\256nd)S +3184(local)S +3408(maximum)S +2616 V +10 B +1620(Alt-Ctrl-0)S +2076(\(zero\))S +10 R +2620(Find)S +2834(local)S +3058(minimum)S +2844 V +1620(------------------)S +10 B +2244(Mouse)S +2557(Button)S +2882(Events)S +10 R +3201(------------------)S +2988 V +10 B +1620(Shift-Btn1Down)S +10 R +2620(Turn)S +2844(on)S +2974(magni\256er)S +3096 V +10 B +1620(Shift-Btn1Up)S +10 R +2620(Turn)S +2844(o)S +2894 H + (f)show 10 -.5 mul h (f)show +10 R +2985(magni\256er)S +3204 V +10 B +1620(Shift-Btn2Down)S +10 R +2620(Turn)S +2844(on)S +2974(crosshair)S +3364(cursor)S +3312 V +10 B +1620(Shift-Btn2Up)S +10 R +2620(Turn)S +2844(o)S +2894 H + (f)show 10 -.5 mul h (f)show +10 R +2985(crosshair)S +3375(cursor)S +3480 V +10 B +1620(Btn1Down)S +10 R +2620(Create)S +2910(a)S +2984(Marker)S +3588 V +10 B +1620(Btn1Motion)S +10 R +2620(Resize)S +2916(marker)S +3228(being)S +3480(created)S +3696 V +10 B +1620(Btn2Down)S +10 R +2620(Zoom/center)S +3160(on)S +3290(cursor)S +3569(position)S +3804 V +10 B +1620(Btn3Down/Motion)S +10 R +2620(Brightness/contrast)S +3422(scale)S +3651(the)S +3803(image)S +3972 V +10 B +1620(Ctrl-Btn1Down)S +10 R +2620(Create)S +2910(Ruler)S +3162(Marker)S +4080 V +10 B +1620(Ctrl-Btn1Motion)S +10 R +2620(Resize)S +2916(Ruler)S +3168(Marker)S +3491(being)S +3743(created)S +4188 V +10 B +1620(Ctrl-Btn1Up)S +10 R +2620(Destroy)S +2966(Ruler)S +3218(Marker)S +4356 V +10 B +1620(Alt-Motion)S +10 R +2620(Freeze)S +2915(cursor)S +3194(readout)S +4644 V +10 B +1260(NOTE:)S +10 R +1612(These)S +1885(keystrokes)S +2347(only)S +2560(work)S +2800(with)S +3013(the)S +3170(cursor)S +3454(in)S +3567(the)S +3724(main)S +3959(image)S +4238(window,)S +4620(only)S +4833(a)S +4913(few)S +5098(of)S +5217(the)S +5375(com-)S +4764 V +1260(mands)S +1563(are)S +1726(implemented)S +2290(to)S +2410(work)S +2657(within)S +2954(subwindows)S +3495(or)S +3619(markers)S +3981(to)S +4100(avoid)S +4363(con\257icts)S +4743(with)S +4962(translations)S +5464(for)S +4884 V +1260(those)S +1501(objects.)S +1869(If)S +1965(a)S +2039(command)S +2464(does)S +2678(not)S +2837(work,)S +3098(check)S +3361(the)S +3514(cursor)S +3794(location)S +4147(and)S +4322(try)S +4464(it)S +4551(again)S +4798(in)S +4907(the)S +5060(main)S +5291(display)S +5004 V +1260(window.)S +5292 V +9 B +900(FRAME)S +1257(BUFFER)S +1644(CONFIGURATIONS)S +5412 V +10 R +1260(XImtool)S +1634(starts)S +1880(up)S +2015(using)S +2267(default)S +2579(frame)S +2846(bu)S +2946 H + (f)show 10 -.5 mul h (f)show +10 R +3007(er)S +3120(size)S +3311(of)S +3430(512x512)S +3816(pixels,)S +4116(two)S +4302(\(of)S +4454(16)S +4590(possible\))S +4987(frames)S +5294(will)S +5486(be)S +5532 V +1260(created.)S +1608(When)S +1882(loading)S +2218(disk)S +2421(images)S +2740(\(i.e.)S +2961(run)S +3130(in)S +3244(standalone)S +3706(mode\))S +3996(the)S +4153(frame)S +4420(bu)S +4520 H + (f)show 10 -.5 mul h (f)show +10 R +4581(er)S +4693(con\256guration)S +5261(\256le)S +5424(will)S +5652 V +1260(be)S +1385(searched)S +1764(for)S +1911(a)S +1986(de\256ned)S +2311(frame)S +2574(bu)S +2674 H + (f)show 10 -.5 mul h (f)show +10 R +2735(er)S +2843(that)S +3024(is)S +3122(the)S +3275(same)S +3511(size)S +3697(or)S +3811(larger)S +4074(than)S +4277(the)S +4430(current)S +4743(image,)S +5044(if)S +5137(no)S +5269(suitable)S +5772 V +1260(bu)S +1360 H + (f)show 10 -.5 mul h (f)show +10 R +1421(er)S +1529(can)S +1698(be)S +1822(found)S +2085(a)S +2159(custom)S +2478(frame)S +2740(bu)S +2840 H + (f)show 10 -.5 mul h (f)show +10 R +2901(er)S +3008(the)S +3160(same)S +3395(size)S +3580(as)S +3693(the)S +3845(image)S +4119(will)S +4305(be)S +4429(created)S +4746(in)S +4854(an)S +4978(unused)S +5291(portion)S +5892 V +1260(of)S +1373(the)S +1525(con\256guration)S +2088(table.)S +2367(When)S +2635(used)S +2848(as)S +2962(a)S +3037(display)S +3357(server)S +3631(the)S +3784(frame)S +4047(bu)S +4147 H + (f)show 10 -.5 mul h (f)show +10 R +4208(er)S +4316(con\256guration)S +4880(number)S +5216(is)S +5314(passed)S +6012 V +1260(in)S +1381(by)S +1524(the)S +1689(client)S +1954(and)S +2140(loaded)S +2448(explicitly)S +2868(even)S +3098(if)S +3201(it)S +3299(means)S +3596(clipping)S +3966(the)S +4130(image.)S +4471(If)S +4579(a)S +4665(new)S +4873(frame)S +5147(bu)S +5247 H + (f)show 10 -.5 mul h (f)show +10 R +5308(er)S +5427(is)S +5536(a)S +6132 V +1260(di)S +1338 H + (f)show 10 -.5 mul h (f)show +10 R +1399(erent)S +1635(size)S +1827(than)S +2036(previously)S +2495(de\256ned)S +2826(frames,)S +3159(all)S +3296(available)S +3693(frames)S +4001(will)S +4194(be)S +4325(initialized)S +4763(and)S +4945(cleared)S +5270(prior)S +5502(to)S +6252 V +1260(the)S +1422(display.)S +1806(The)S +2001(default)S +2318(frame)S +2590(bu)S +2690 H + (f)show 10 -.5 mul h (f)show +10 R +2751(er)S +2868(con\256guration)S +3441(\256le)S +3609(is)S +3716(/usr/local/lib/imtoolrc,)S +4654(this)S +4838(can)S +5015(be)S +5148(overridden)S +6372 V +1260(by)S +1407(de\256ning)S +1782(a)S +1874(IMTOOLRC)S +2444(environment)S +2997(variable)S +3366(naming)S +3714(the)S +3884(\256le)S +4060(to)S +4186(be)S +4328(used,)S +4584(by)S +4732(creating)S +5101(a)S +5193(using)S +5458(the)S +6492 V +10 I +1260(-imtoolrc)S +10 R +1662(command)S +2086(line)S +2266(\257ag)S +2446(or)S +10 I +2559(imtoolrc)S +10 R +2928(application)S +3402(resource.)S +6732 V +1260(The)S +1445(format)S +1741(of)S +1854(the)S +2006(frame)S +2268(bu)S +2368 H + (f)show 10 -.5 mul h (f)show +10 R +2429(er)S +2536(con\256guration)S +3099(\256le)S +3257(is)S +6972 V +10 I +1410(con\256gno)S +1784(nframes)S +2136(width)S +2389(height)S +2669([extra)S +2943(\256elds])S +7092 V +10 R +1290(e.g.)S +7212 V +1560(1)S +1670(2)S +1780(512)S +1990(512)S +7692 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(8)S +7920 V +EP +%%Page: 9 10 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1560(2)S +1670(2)S +1780(800)S +1990(800)S +1080 V +1560(3)S +1670(1)S +1750(1024)S +1980(1024)S +2480(#)S +2560(comment)S +1200 V +1560(:)S +1648(:)S +1766(:)S +1914(:)S +1440 V +1260(At)S +1417(most)S +1669(128)S +1876(frame)S +2165(bu)S +2265 H + (f)show 10 -.5 mul h (f)show +10 R +2326(er)S +2460(sizes)S +2711(may)S +2940(be)S +3092(de\256ned,)S +3469(each)S +3709(con\256guration)S +4300(may)S +4530(de\256ne)S +4832(up)S +4990(to)S +5126(16)S +5284(frames,)S +1560 V +1260(con\256guration)S +1823(numbers)S +2197(need)S +2415(not)S +2573(be)S +2697(sequential.)S +1848 V +10 B +1260(NOTE:)S +10 R +1640(When)S +1911(de\256ning)S +2272(a)S +2349(new)S +2548(frame)S +2813(bu)S +2913 H + (f)show 10 -.5 mul h (f)show +10 R +2974(er)S +3084(for)S +3233(use)S +3399(with)S +3610(client)S +3865(software)S +4241(such)S +4457(as)S +4573(IRAF)S +4834(the)S +4990(user)S +5190(must)S +5419(also)S +1968 V +1260(remember)S +1694(to)S +1802(de\256ne)S +2076(those)S +2317(frame)S +2579(bu)S +2679 H + (f)show 10 -.5 mul h (f)show +10 R +2740(ers)S +2886(in)S +2994(the)S +3146(IRAF)S +10 I +3404(dev$graphcap)S +10 R +4005(\256le.)S +2256 V +9 B +1080(SUPPORT)S +1527(FOR)S +1744(16)S +1861(DISPLAY)S +2283(FRAMES)S +2376 V +10 R +1260(As)S +1402(part)S +1588(of)S +1702(the)S +1855(extensive)S +2263(GUI)S +2471(changes)S +2823(with)S +3032(the)S +3185(V1.3)S +3413(release,)S +3745(support)S +4076(for)S +4223(the)S +4376(full)S +4546(16)S +4677(frames)S +4979(allowed)S +5326(by)S +5458(the)S +2496 V +1260(IIS)S +1418(protocol)S +1787(is)S +1890(now)S +2098(available.)S +2549(IRAF)S +2813(V2.11.4)S +3171(or)S +3290(later)S +3503(client)S +3761(tasks)S +3997(\(and)S +4209(CDL)S +4444(library\))S +4778(are)S +4934(required)S +5301(to)S +5414(take)S +2616 V +1260(advantage)S +1695(of)S +1809(this)S +1985(frames.)S +2342(All)S +2501(changes)S +2853(are)S +3005(backwards)S +3462(compatible,)S +3962(older)S +4198(versions)S +4563(of)S +4678(IRAF)S +4938(will)S +5126(continue)S +5502(to)S +2736 V +1260(work)S +1503(but)S +1669(cannot)S +1973(access)S +2265(more)S +2508(than)S +2718(the)S +2877(original)S +3225(four)S +3428(frames.)S +3791(The)S +3983(new)S +4186(DISPLAY)S +4645(task)S +4843(will)S +5036(automatically)S +2856 V +1260(sense)S +1513(whether)S +1872(the)S +2032(display)S +2359(server)S +2640(being)S +2900(used)S +3121(supports)S +3498(16)S +3636(frames)S +3945(or)S +4066(the)S +4226(original)S +4575(4)S +4663(and)S +4845(adjust)S +5122(the)S +5282('frame')S +2976 V +1260(parameter)S +1688(maximum)S +2124(accordingly.)S +2680(The)S +2865(changes)S +3216(are)S +3367(fully)S +3586(backwards)S +4042(compatible)S +4516(for)S +4662(other)S +4897(servers.)S +3216 V +1260(More)S +1527(frames)S +1849(are)S +2021(possible)S +2400(if)S +2512(needed)S +2845(but)S +3024(will)S +3231(require)S +3564(further)S +3886(changes)S +4258(to)S +4388(the)S +4562(client)S +4836(IRAF)S +5116(code)S +5356(to)S +5486(be)S +3336 V +1260(e)S +1304 H + (f)show 10 -.5 mul h (f)show +10 R +1365(ective.)S +1698(Allowing)S +2116(creation)S +2477(of)S +2600(more)S +2845(than)S +3056(16)S +3195(frames)S +3505(by)S +3644(the)S +3805(Load)S +4049(panel)S +4304(can)S +4481(be)S +4614(done)S +4847(independently)S +5452(but)S +3456 V +1260(would)S +1547(also)S +1745(require)S +2064(numerous)S +2495(code)S +2720(change)S +3039(to)S +3154(XImtool.)S +3585(Please)S +3877(contact)S +4202(site)S +4378(support)S +4715(if)S +4814(there)S +5051(is)S +5156(a)S +5238(need)S +5464(for)S +3576 V +1260(this,)S +1460(or)S +1573(for)S +1719(workaround)S +2231(suggestions)S +2728(depending)S +3174(on)S +3304(your)S +3517(application.)S +3864 V +9 B +900(MARKERS)S +3984 V +10 R +1260(Although)S +1668(ximtool)S +2010(doesn't)S +2334(do)S +2464(much)S +2717(with)S +2926(markers)S +3278(currently,)S +3694(they)S +3897(are)S +4049(a)S +4124(general)S +4448(feature)S +4755(of)S +4869(the)S +10 I +5022(Gterm)S +10 R +5308(widget)S +4104 V +1260(and)S +1450(are)S +1616(used)S +1844(more)S +2094(extensively)S +2594(in)S +2717(other)S +2967(programs)S +3389(\(e.g.)S +3611(the)S +3778(prototype)S +4206(IRAF)S +4479(science)S +4817(GUI)S +5039(applications\).)S +4224 V +1260(XImtool)S +1645(uses)S +1863(markers)S +2230(for)S +2392(the)S +2560(marker)S +2888(zoom)S +3156(feature)S +3478(discussed)S +3908(above,)S +4218(and)S +4409(also)S +4617(for)S +4780(the)S +4949(panner)S +5267(and)S +5458(the)S +4344 V +1260(coords)S +1559(box.)S +1767(All)S +1928(markers)S +2282(share)S +2525(some)S +2769(of)S +2885(the)S +3040(same)S +3278(characteristics,)S +3906(so)S +4028(it)S +4116(is)S +4215(worthwhile)S +4702(learning)S +5061(basic)S +5298(marker)S +4464 V +1260(manipulation)S +1818(keystrokes.)S +4632 V +10 B +1260(o)S +10 R +1410(MB1)S +1646(anywhere)S +2063(inside)S +2332(a)S +2406(marker)S +2718(may)S +2920(be)S +3044(used)S +3257(to)S +3365(drag)S +3572(the)S +3724(marker.)S +4800 V +10 B +1260(o)S +10 R +1410(MB1)S +1646(near)S +1847(a)S +1921(marker)S +2233(corner)S +2517(or)S +2630(edge,)S +2873(depending)S +3319(on)S +3449(the)S +3601(type)S +3803(of)S +3916(marker,)S +4253(resizes)S +4554(the)S +4706(marker.)S +4968 V +10 B +1260(o)S +10 R +1410(Shift-MB1)S +1874(on)S +2004(the)S +2156(corner)S +2440(of)S +2553(most)S +2778(markers)S +3129(will)S +3315(rotate)S +3572(the)S +3724(marker.)S +5136 V +10 B +1260(o)S +10 R +1410(Markers)S +1775(stack,)S +2038(if)S +2132(you)S +2315(have)S +2536(several)S +2851(markers)S +3205(and)S +3382(you)S +3565(put)S +3726(one)S +3903(on)S +4037(top)S +4199(of)S +4316(the)S +4472(other.)S +4736(The)S +4925(active)S +5197(marker)S +5513(is)S +5256 V +1410(highlighted)S +1909(to)S +2030(tell)S +2201(you)S +2394(which)S +2681(of)S +2807(the)S +2972(stacked)S +3314(markers)S +3678(is)S +3788(active.)S +4094(If)S +4203(the)S +4368(markers)S +4732(overlap,)S +5099(this)S +5287(will)S +5486(be)S +5376 V +1410(marker)S +1722("on)S +1893(top")S +2092(in)S +2200(the)S +2352(stacking)S +2715(order.)S +5544 V +10 B +1260(o)S +10 R +1410(MB2)S +1646(in)S +1754(the)S +1906(body)S +2136(of)S +2249(a)S +2323(marker)S +2635("lowers")S +3013(the)S +3165(marker,)S +3502(i.e.)S +3654(moves)S +3945(it)S +4031(to)S +4139(the)S +4291(bottom)S +4605(of)S +4718(the)S +4870(stacking)S +5233(order.)S +5712 V +10 B +1260(o)S +10 R +1410(Delete)S +1700(or)S +1813(backspace)S +2252(in)S +2360(a)S +2434(marker)S +2746(deletes)S +3053(it.)S +5880 V +10 B +1260(o)S +10 R +1410(Markers)S +1789(have)S +2024(their)S +2254(own)S +2473(translation)S +2942(resources)S +3365(and)S +3557(so)S +3694(the)S +3864(default)S +4189(keystroke)S +4625(commands)S +5106(will)S +5310(not)S +5486(be)S +6000 V +1410(recognized)S +1877(when)S +2123(the)S +2275(cursor)S +2554(is)S +2651(in)S +2759(a)S +2833(marker.)S +6240 V +1410(For)S +1585(example,)S +1984(try)S +2131(placing)S +2461(the)S +2619(pointer)S +2938(anywhere)S +3361(in)S +3476(the)S +3635(coords)S +3938(box,)S +4150(then)S +4359(press)S +4601(MB1)S +4844(and)S +5025(hold)S +5240(it)S +5333(down,)S +6360 V +1410(and)S +1587(drag)S +1797(the)S +1951(coords)S +2249(box)S +2431(marker)S +2745(somewhere)S +3231(else)S +3418(on)S +3550(the)S +3704(screen.)S +4015(You)S +4219(can)S +4389(also)S +4582(resize)S +4846(the)S +5000(coords)S +5298(box)S +5480(by)S +6480 V +1410(dragging)S +1796(a)S +1871(corner,)S +2181(or)S +2296(delete)S +2566(it)S +2654(with)S +2864(the)S +3018(delete)S +3288(or)S +3403(backspace)S +3844(key.)S +4045(\(The)S +4265(Initialize)S +4652(button)S +4940(will)S +5128(get)S +5282(the)S +5436(ori-)S +6600 V +1410(ginal)S +1640(coords)S +1936(box)S +2116(back)S +2334(if)S +2425(you)S +2605(delete)S +2873(it,)S +2984(or)S +3097(you)S +3277(can)S +3445(reset)S +3663(the)S +3815(toggle)S +4095(in)S +4203(the)S +4355(control)S +4668(panel\).)S +6888 V +9 B +1080(PANNER)S +1482(MARKER)S +7008 V +10 R +1260(The)S +1449(panner)S +1754(window)S +2110(always)S +2421(displays)S +2783(the)S +2939(full)S +3112(frame)S +3379(bu)S +3479 H + (f)show 10 -.5 mul h (f)show +10 R +3540(er.)S +3677(Try)S +3856(setting)S +4158(the)S +4315(frame)S +4582(bu)S +4682 H + (f)show 10 -.5 mul h (f)show +10 R +4743(er)S +4855(con\256guration)S +5423(to)S +5536(a)S +7128 V +1260(nonsquare)S +1708(frame)S +1978(bu)S +2078 H + (f)show 10 -.5 mul h (f)show +10 R +2139(er)S +2254(\(e.g.)S +2469(imtcryo\))S +2851(and)S +3033(then)S +3243(displaying)S +3698(a)S +3780(square)S +4078(image)S +4360(\(e.g.)S +4575(dev$pix\))S +4968(and)S +5150(the)S +5309(panner)S +7248 V +1260(will)S +1446(show)S +1687(you)S +1867(exactly)S +2185(where)S +2458(the)S +2610(image)S +2884(has)S +3047(been)S +3265(loaded)S +3561(into)S +3747(the)S +3899(frame.)S +7728 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5530(9)S +7920 V +EP +%%Page: 10 11 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(The)S +1450(panner)S +1756(window)S +2113(uses)S +2321(two)S +2507(markers,)S +2889(one)S +3069(for)S +3221(the)S +3379(window)S +3737(border)S +4033(and)S +4213(one)S +4393(to)S +4507(mark)S +4748(the)S +4906(displayed)S +5325(region)S +1080 V +1260(of)S +1379(the)S +1537(frame.)S +1830(Most)S +2072(of)S +2191(the)S +2349(usual)S +2596(marker)S +2914(keystrokes)S +3377(mentioned)S +3835(below)S +4115(apply)S +4373(to)S +4487(these)S +4728(markers)S +5085(as)S +5204(well,)S +5436(e.g.)S +1200 V +1260(you)S +1443(can)S +1614(use)S +1780(MB1)S +2019(to)S +2130(reposition)S +2563(on)S +2696(the)S +2851(panner)S +3156(window)S +3512(within)S +3802(the)S +3958(main)S +4192(image)S +4470(display)S +4793(window,)S +5174(or)S +5291(to)S +5403(drag)S +1320 V +1260(the)S +1414(region)S +1701(marker)S +2015(within)S +2303(the)S +2457(panner)S +2760(\(pan)S +2969(the)S +3123(image\).)S +3456(Resizing)S +3837(the)S +3990(region)S +4276(marker)S +4589(zooms)S +4881(the)S +5034(image;)S +5337(this)S +5513(is)S +1440 V +1260(a)S +1336(non-aspect)S +1800(constrained)S +2292(zoom.)S +2571(The)S +2758(panner)S +3061(window)S +3415(itself)S +3647(can)S +3817(be)S +3943(resized)S +4257(by)S +4389(dragging)S +4776(a)S +4852(corner)S +5138(with)S +5349(MB1.)S +1560 V +1260(Typing)S +1579(delete)S +1847(or)S +1960(backspace)S +2399(anywhere)S +2816(in)S +2924(the)S +3076(panner)S +3377(window)S +3729(deletes)S +4036(the)S +4188(panner.)S +1800 V +1260(A)S +1362(special)S +1669(case)S +1870(is)S +1967(MB2.)S +2228(Hitting)S +2542(MB2)S +2778(anywhere)S +3195(in)S +3303(the)S +3455(panner)S +3757(window)S +4110(pans)S +4324(the)S +4477(image)S +4752(to)S +4861(that)S +5042(point.)S +5304(This)S +5513(is)S +1920 V +1260(analogous)S +1695(to)S +1803(hitting)S +2095(MB2)S +2331(in)S +2439(the)S +2591(main)S +2821(display)S +3140(window)S +3492(to)S +3600(pan)S +3774(the)S +3926(image.)S +2160 V +1260(The)S +1447(panner)S +1750(marker)S +2064(can)S +2234(be)S +2360(disabled)S +2725(by)S +2857(de\256ning)S +3218(the)S +10 I +3373(displayPanner)S +10 R +3989(GUI)S +4199(resource,)S +4594(its)S +4722(size)S +4910(and)S +5087(location)S +5442(can)S +2280 V +1260(be)S +1384(controlled)S +1819(using)S +2066(the)S +10 I +2218(pannerArea)S +10 R +2725(and)S +10 I +2899(pannerGeom)S +10 R +3450(GUI)S +3657(resources)S +4063(respectively.)S +2568 V +9 B +1080(MAGNIFIER)S +1642(MARKER)S +2688 V +10 R +1260(The)S +1445(magni\256er)S +1858(marker)S +2170(can)S +2338(be)S +2462(used)S +2676(to)S +2785(zoom)S +3038(in)S +3147(on)S +3278(a)S +3353(small)S +3601(area)S +3797(around)S +4105(the)S +4258(cursor.)S +4593(It)S +4685(will)S +4872(be)S +4997(updated)S +5344(as)S +5458(the)S +2808 V +1260(cursor)S +1552(moves)S +1856(but)S +2027(only)S +2248(for)S +2407(small)S +2666(motions)S +3031(\(either)S +3333(mouse)S +3636(movement)S +4100(or)S +4225(with)S +4445(the)S +4609(cursor)S +4900(movement)S +5364(keys-)S +2928 V +1260(trokes\))S +1570(to)S +1681(minimize)S +2092(the)S +2247(impact)S +2552(on)S +2685(the)S +2840(system.)S +3207(The)S +3396(zoom)S +3652(factor)S +3918(is)S +4019(expressed)S +4446(as)S +4563(some)S +4808(fraction)S +5152(of)S +5269(the)S +5425(size)S +3048 V +1260(of)S +1381(the)S +1541(magni\256er)S +1962(marker)S +2282(itself.)S +2575(The)S +2768(default)S +3083(zoom)S +3343(is)S +3448(4,)S +3561(i.e.)S +3721(the)S +3881(area)S +4084(in)S +4200(the)S +4359(marker)S +4678(represents)S +5119(and)S +5300(area)S +5502(in)S +3168 V +1260(the)S +1417(image)S +1696(that's)S +1953(one-fourth)S +2409(the)S +2566(size)S +2756(of)S +2874(the)S +3031(marker.)S +3403(Other)S +3665(zoom)S +3922(factors)S +4228(may)S +4435(be)S +4564(selected)S +4920(using)S +5172(the)S +5330(popup)S +3288 V +1260(menu)S +1512(created)S +1829(by)S +1959(hitting)S +2251(MB1)S +2487(in)S +2595(the)S +2747(marker.)S +3528 V +1260(By)S +1414(default)S +1728(the)S +1887(magni\256er)S +2307(marker)S +2626(is)S +2730(not)S +2895(visible,)S +3224(to)S +3339(toggle)S +3626(it)S +3720(select)S +3985(the)S +10 I +4145(Magni\256er)S +10 R +4577(option)S +4871(from)S +5103(the)S +10 I +5263(Options)S +3648 V +10 R +1260(menubar)S +1660(button.)S +2022(Alternatively,)S +2625(for)S +2792(just)S +2988(a)S +3083(quick)S +3356(look)S +3584(holding)S +3940(down)S +4212(the)S +4384(Shift)S +4629(and)S +4823(MB1)S +5079(buttons)S +5424(will)S +3768 V +1260(display)S +1579(the)S +1731(marker)S +2043(until)S +2257(the)S +2409(button)S +2695(is)S +2792(released.)S +4008 V +1260(The)S +1453(magni\256er)S +1874(marker)S +2194(can)S +2370(be)S +2502(disabled)S +2873(by)S +3011(de\256ning)S +3377(the)S +10 I +3537(displayMagni\256er)S +10 R +4258(GUI)S +4473(resource,)S +4873(its)S +5006(size)S +5199(and)S +5381(loca-)S +4128 V +1260(tion)S +1446(can)S +1614(be)S +1738(controlled)S +2173(using)S +2420(the)S +10 I +2572(magni\256erArea)S +10 R +3179(and)S +10 I +3353(magni\256erGeom)S +10 R +4004(GUI)S +4211(resources)S +4617(respectively.)S +4416 V +9 B +1080(COORDS)S +1492(BOX)S +1714(MARKER)S +4536 V +10 R +1260(XImtool)S +1629(provides)S +2003(a)S +2077(limited)S +2391(notion)S +2677(of)S +2790(world)S +3054(coordinates,)S +3570(allowing)S +3951(frame)S +4214(bu)S +4314 H + (f)show 10 -.5 mul h (f)show +10 R +4375(er)S +4483(pixel)S +4714(coordinates)S +5205(and)S +5380(pixel)S +4656 V +1260(values)S +1546(to)S +1655(be)S +1780(converted)S +2204(to)S +2312(some)S +2553(arbitrary)S +2926(linear)S +3183(client-de\256ned)S +3762(coordinate)S +4213(system.)S +4546(The)S +4731(coords)S +5027(box)S +5207(feature)S +5513(is)S +4776 V +1260(used)S +1473(to)S +1581(display)S +1900(these)S +2135(world)S +2398(coordinates)S +2888(as)S +3001(the)S +3153(pointer)S +3466(is)S +3563(moved)S +3865(about)S +4117(in)S +4225(the)S +4377(image)S +4651(window.)S +5016 V +1260(The)S +1445(quantities)S +1865(displayed)S +2279(in)S +2388(the)S +2541(coords)S +2838(box)S +3019(are)S +3171(X,)S +3299(Y,)S +3427(and)S +3602(Z:)S +3722(the)S +3875(X,Y)S +4075(world)S +4339(coordinates)S +4830(of)S +4944(the)S +5097(pointer,)S +5436(and)S +5136 V +1260(Z,)S +1379(the)S +1534(world)S +1800(equivalent)S +2249(of)S +2365(the)S +2520(pixel)S +2753(value)S +3002(under)S +3262(the)S +3417(pointer.)S +3758(All)S +3919(coordinate)S +4373(systems)S +4723(are)S +4877(linear.)S +5161(The)S +5348(preci-)S +5256 V +1260(sion)S +1466(of)S +1588(a)S +1671(displayed)S +2093(quantity)S +2460(is)S +2566(limited)S +2889(by)S +3028(the)S +3189(range)S +3449(of)S +3571(values)S +3865(of)S +3988(the)S +4150(associated)S +4600(raw)S +4789(frame)S +5061(bu)S +5161 H + (f)show 10 -.5 mul h (f)show +10 R +5222(er)S +5339(value.)S +5376 V +1260(For)S +1431(example,)S +1826(if)S +1919(the)S +2073(display)S +2394(window)S +2748(is)S +2846(512x512)S +3227(only)S +3436(512)S +3617(coordinate)S +4069(values)S +4355(are)S +4507(possible)S +4866(in)S +4975(either)S +5233(axis)S +5425(\(the)S +5496 V +1260(positional)S +1687(precision)S +2085(can)S +2256(be)S +2383(increased)S +2792(however)S +3168(by)S +3301(zooming)S +3684(the)S +3839(image\).)S +4174(More)S +4423(seriously,)S +4842(at)S +4947(most)S +5175(about)S +5430(200)S +5616 V +1260(pixel)S +1501(values)S +1797(can)S +1976(be)S +2111(displayed)S +2534(since)S +2779(this)S +2964(is)S +3071(the)S +3233(limit)S +3463(on)S +3603(the)S +3765(range)S +4026(of)S +4149(pixel)S +4389(values)S +4684(loaded)S +4990(into)S +5186(the)S +5348(frame)S +5736 V +1260(bu)S +1360 H + (f)show 10 -.5 mul h (f)show +10 R +1421(er.)S +1553(If)S +1649(a)S +1723(display)S +2042(pixel)S +2272(is)S +2369(saturated)S +2759(a)S +2833("+")S +3001(will)S +3187(be)S +3311(displayed)S +3724(after)S +3936(the)S +4088(intensity)S +4463(value.)S +5976 V +1260(The)S +1446(coords)S +1743(box)S +1924(is)S +2022(a)S +2097(text)S +2278(marker,)S +2616(it)S +2703(can)S +2872(be)S +2997(moved)S +3300(and)S +3475(resized)S +3788(with)S +3997(the)S +4150(pointer)S +4464(like)S +4645(any)S +4820(other)S +5056(marker.)S +5425(The)S +6096 V +1260(coords)S +1561(box)S +1746(marker)S +2063(can)S +2236(be)S +2365(disabled)S +2733(by)S +2868(de\256ning)S +3231(the)S +10 I +3388(displayCoords)S +10 R +4007(GUI)S +4219(resource,)S +4616(its)S +4746(location)S +5103(can)S +5275(be)S +5403(con-)S +6216 V +1260(trolled)S +1551(by)S +1681(the)S +10 I +1833(wcsboxGeom)S +10 R +2395(GUI)S +2602(resource.)S +6504 V +9 B +1080(MARKER)S +1517(MENU)S +1819(OPTIONS)S +6624 V +10 R +1260(Except)S +1575(for)S +1729(the)S +1889(panner)S +2198(and)S +2380(WCS)S +2635(markers,)S +3019(MB3)S +3263(\(mouse)S +3595(button)S +3889(3\))S +4010(calls)S +4231(up)S +4369(the)S +4529(marker)S +4849(menu)S +5109(providing)S +5536(a)S +6744 V +1260(limited)S +1574(set)S +1715(of)S +1828(functions)S +2230(common)S +2610(to)S +2718(all)S +2848(markers:)S +6912 V +10 B +1260(o)S +10 R +1410(Zoom)S +1686(does)S +1906(an)S +2037(equal)S +2291(aspect)S +2578(zoom)S +2838(of)S +2959(the)S +3119(region)S +3412(outlined)S +3778(by)S +3916(the)S +4076(marker.)S +4421(In)S +4542(this)S +4725(way)S +4929(you)S +5117(can)S +5293(mark)S +5536(a)S +7032 V +1410(region)S +1695(of)S +1808(the)S +1960(image)S +2234(and)S +2408(zoom)S +2660(it)S +2746(up.)S +7200 V +10 B +1260(o)S +10 R +1410(Fill)S +1597(exactly)S +1933(zooms)S +2242(the)S +2412(area)S +2625(outlined)S +3001(by)S +3149(the)S +3319(marker,)S +3674(making)S +4022(it)S +4126(\256ll)S +4286(the)S +4456(display)S +4793(window.)S +5188(Since)S +5458(the)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(10)S +7920 V +EP +%%Page: 11 12 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1410(marker)S +1722(is)S +1819(not)S +1977(likely)S +2235(to)S +2343(be)S +2467(exactly)S +2785(square,)S +3100(the)S +3252(aspect)S +3531(ratio)S +3744(of)S +3857(the)S +4009(resultant)S +4383(image)S +4657(will)S +4843(not)S +5001(be)S +5125(unitary.)S +1128 V +10 B +1260(o)S +10 R +1410(Print)S +1643(prints)S +1909(the)S +2069(region)S +2362(outlined)S +2728(by)S +2866(the)S +3027(marker)S +3348(to)S +3465(the)S +3626(printer)S +3931(or)S +4053(\256le)S +4220(currently)S +4619(con\256gured)S +5085(by)S +5224(the)S +5385(Print)S +1248 V +1410(Panel.)S +1416 V +10 B +1260(o)S +10 R +1410(Save)S +1634(saves)S +1880(the)S +2032(region)S +2317(outlined)S +2675(by)S +2805(the)S +2957(marker)S +3269(to)S +3377(the)S +3529(\256le)S +3687(currently)S +4077(con\256gured)S +4534(by)S +4664(the)S +4816(Save)S +5040(Panel.)S +1584 V +10 B +1260(o)S +10 R +1410(Info)S +1606(prints)S +1864(a)S +1938(description)S +2412(of)S +2525(the)S +2677(marked)S +3006(region.)S +3316(The)S +3501(text)S +3681(is)S +3778(printed)S +4091(in)S +4199(the)S +4351(Info)S +4547(Panel.)S +1752 V +10 B +1260(o)S +10 R +1410(Unrotate)S +1789(unrotates)S +2185(a)S +2259(rotated)S +2566(marker.)S +1920 V +10 B +1260(o)S +10 R +1410(Color)S +1668(is)S +1765(a)S +1839(menu)S +2091(of)S +2204(possible)S +2562(marker)S +2874(colors.)S +2088 V +10 B +1260(o)S +10 R +1410(Type)S +1651(is)S +1754(a)S +1834(menu)S +2092(of)S +2211(possible)S +2575(marker)S +2893(types.)S +3165(This)S +3379(is)S +3482(still)S +3669(a)S +3749(little)S +3969(buggy)S +4256(and)S +4437(it)S +4530(isn't)S +4745(very)S +4959(useful,)S +5265(but)S +5430(you)S +2208 V +1410(can)S +1578(use)S +1741(it)S +1827(to)S +1935(play)S +2137(with)S +2345(di)S +2423 H + (f)show 10 -.5 mul h (f)show +10 R +2484(erent)S +2713(types)S +2954(of)S +3067(markers.)S +2376 V +10 B +1260(o)S +10 R +1410(Destroy)S +1760(destroys)S +2127(the)S +2283(marker.)S +2624(You)S +2830(can)S +3002(also)S +3197(hit)S +3337(the)S +3493(delete)S +3766(or)S +3884(backspace)S +4328(key)S +4507(in)S +4620(a)S +4699(marker)S +5016(to)S +5129(destroy)S +5458(the)S +2496 V +1410(marker.)S +2784 V +9 B +1080(RULER)S +1422(MARKERS)S +2904 V +10 R +1260(Holding)S +1629(down)S +1892(the)S +2055(Ctrl)S +2252(key)S +2437(and)S +2622(the)S +2785(Left-Mouse-Button)S +3603(while)S +3866(moving)S +4213(the)S +4376(mouse)S +4678(will)S +4876(drag)S +5095(out)S +5265(a)S +5351("ruler)S +3024 V +1260(marker")S +1622(measuring)S +2077(the)S +2238(distance)S +2604(from)S +2837(the)S +2998(initial)S +3271(point)S +3516(to)S +3633(the)S +3794(current)S +4115(mouse)S +4415(position.)S +4832(Releasing)S +5264(the)S +5424(Ctrl)S +3144 V +1260(key)S +1450(before)S +1750(lifting)S +2041(the)S +2209(mouse)S +2516(button)S +2818(will)S +3020(leave)S +3276(the)S +3444(marker)S +3772(on)S +3918(the)S +4086(display,)S +4446(otherwise)S +4880(it)S +4982(will)S +5185(be)S +5326(erased)S +3264 V +1260(automatically)S +1849(once)S +2082(the)S +2249(mouse)S +2555(button)S +2856(is)S +2968(released.)S +3394(Any)S +3611(number)S +3961(of)S +4088(ruler)S +4320(markers)S +4685(can)S +4867(be)S +5005(created)S +5336(in)S +5458(the)S +3384 V +1260(frame.)S +3624 V +1260(Distances)S +1684(are)S +1841(measured)S +2259(by)S +2395(default)S +2708(in)S +2822(image)S +3102(logical)S +3410(pixels)S +3685(however)S +4064(the)S +4222(Right-Mouse-Button)S +5092(can)S +5266(be)S +5397(used)S +3744 V +1260(inside)S +1529(the)S +1681(marker)S +1993(to)S +2101(popup)S +2381(a)S +2455(menu)S +2707(of)S +2820(options:)S +4032 V +10 B +1260(Sticky)S +10 R +2260(By)S +2430(default)S +2760(rulers)S +3040(are)S +3214(destroyed)S +3655(whenever)S +4095(the)S +4270(display)S +4612(changes)S +4986(due)S +5183(to)S +5314(a)S +5411(pan,)S +4152 V +2260(zoom,)S +2545(\257ip,)S +2742(or)S +2863(frame)S +3133(change.)S +3508(This)S +3724(option)S +4017(will)S +4210(make)S +4463(the)S +4622(ruler)S +4847("sticky")S +5205(so)S +5331(it)S +5424(will)S +4272 V +2260(not)S +2420(be)S +2546(erased,)S +2857(subsequent)S +3333(use)S +3498(of)S +3613(the)S +3767(menu)S +4021(to)S +4132(shows)S +4415(this)S +4593(option)S +4882(to)S +4993(be)S +5120("UnSticky")S +4392 V +2260(to)S +2368(remove)S +2697(this)S +2872(feature.)S +4560 V +10 B +1260(Units)S +10 R +2260(Sub-menu)S +2703(to)S +2813(select)S +3072(the)S +3226(units)S +3453(of)S +3569(the)S +3724(display.)S +4101(If)S +4200(the)S +4355(ISM)S +4566(is)S +4666(enabled)S +5009(and)S +5186(a)S +5263(WCS)S +5513(is)S +4680 V +2260(present)S +2590(in)S +2709(the)S +2872(image)S +3157(and)S +3342(selected)S +3704(as)S +3828(one)S +4013(of)S +4137(the)S +4300(readout)S +4640(options,)S +5001(distances)S +5408(may)S +4800 V +2260(also)S +2467(be)S +2608(read)S +2826(out)S +3001(in)S +3126(units)S +3368(of)S +3498(arcseconds,)S +4007(arcminutes,)S +4517(or)S +4647(degrees)S +4998(instead)S +5328(of)S +5458(the)S +4920 V +2260(default)S +2579(logical)S +2893(pixels.)S +3199(All)S +3369(markers)S +3731(created)S +4059(after)S +4282(the)S +4445(unit)S +4642(change)S +4965(will)S +5162(readout)S +5502(in)S +5040 V +2260(the)S +2412(new)S +2608(units)S +2833(as)S +2946(their)S +3159(default.)S +5208 V +10 B +1260(Color)S +10 R +2260(Select)S +2534(the)S +2686(color)S +2921(of)S +3034(the)S +3186(marker.)S +5376 V +10 B +1260(Draw)S +1528(into)S +1725(Frame)S +10 R +2260(\()S +10 I +2293(Not)S +2495(Yet)S +2680(Implemented)S +10 R +3195(\))S +3315(Draw)S +3593(the)S +3773(marker)S +4113(as)S +4254(overlay)S +4611(graphics)S +5007(in)S +5143(the)S +5323(frame.)S +5496 V +2260(Doing)S +2540(so)S +2659(will)S +2845(retain)S +3102(the)S +3254(marker)S +3566(when)S +3812(printing)S +4159(a)S +4233(hardcopy)S +4634(of)S +4747(the)S +4899(display.)S +5664 V +10 B +1260(Destroy)S +10 R +2260(Destroy)S +2606(the)S +2758(marker.)S +5904 V +2260(The)S +2452(marker)S +2771(can)S +2946(also)S +3144(be)S +3275(destroyed)S +3700(by)S +3837(hitting)S +4136(the)S +4295(Delete)S +4592(or)S +4712(Backspace)S +5176(key)S +5358(while)S +6024 V +2260(the)S +2419(cursor)S +2705(is)S +2809(in)S +2924(the)S +3083(marker.)S +3457(There)S +3726(is)S +3830(presently)S +4233(no)S +4370(way)S +4573(to)S +4688(move)S +4946(the)S +5104(marker)S +5422(to)S +5536(a)S +6144 V +2260(new)S +2456(position)S +2809(in)S +2917(the)S +3069(frame.)S +6432 V +9 B +900(REAL-TIME)S +1447(WCS/PIXEL-VALUE)S +2324(READOUT)S +6552 V +10 R +1260(XImtool)S +1629(now)S +1831(has)S +1994(the)S +2146(ability)S +2433(to)S +2542(display)S +2862(the)S +3015(actual)S +3284(pixel)S +3515(value)S +3762(of)S +3876(an)S +4001(image)S +4276(\(as)S +4423(well)S +4626(as)S +4740(the)S +4893(scaled)S +5173(value)S +5420(pre-)S +6672 V +1260(viously)S +1590(shown\))S +1919(and)S +2098(the)S +2255(cursor)S +2538(position)S +2895(in)S +3007(image)S +3285(WCS)S +3536(values)S +3825(\(e.g.)S +4036(RA/DEC,)S +4462(GLAT/GLONG,)S +5164(etc\).)S +5402(This)S +6792 V +1260(is)S +1358(done)S +1583(using)S +1831(an)S +1956(external)S +2309(task)S +2502(\(the)S +2689('ism_wcspix.e')S +3334(binary)S +3621(in)S +3731(the)S +3885(new)S +4083(distribution\))S +4610(to)S +4720(access)S +5006(the)S +5160(image)S +5436(and)S +6912 V +1260(pass)S +1462(the)S +1614(coordinate/pixel)S +2293(information)S +2795(to)S +2903(the)S +3055(GUI.)S +7152 V +1260(WCS)S +1513(readout)S +1848(is)S +1951(enabled)S +2297(by)S +2433(default)S +2746(but)S +2910(can)S +3084(be)S +3214(toggled)S +3550(or)S +3669(reset)S +3893(using)S +4146(the)S +10 I +4304(WCS/Pix)S +10 R +4702(button)S +4995(on)S +5132(the)S +5291(Coords)S +7272 V +1260(tab)S +1414(in)S +1524(the)S +1678(control)S +1993(panel)S +2241(or)S +2356(the)S +10 I +2510(ISM)S +10 R +2708(toggle)S +2990(on)S +3122(the)S +3276(alt-gui)S +3569(menubar.)S +4005(When)S +4275(enabled,)S +4642(images)S +4957(currently)S +5349(in)S +5458(the)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(11)S +7920 V +EP +%%Page: 12 13 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(server)S +1537(or)S +1654(subsequently)S +2210(displayed)S +2627(will)S +2817(be)S +2945(passed)S +3245(to)S +3357(the)S +3513(external)S +3868(process)S +4201(where)S +4478(they)S +4684(are)S +4839(cached)S +5150(for)S +5301(access.)S +1080 V +1260(Cursor)S +1579(movements)S +2086(generate)S +2469(an)S +2609(event)S +2871(that)S +3067(maps)S +3324(the)S +3492(current)S +3820(frame)S +4098(bu)S +4198 H + (f)show 10 -.5 mul h (f)show +10 R +4259(er)S +4382(position)S +4751(to)S +4875(a)S +4965(position)S +5334(in)S +5458(the)S +1200 V +1260(cached)S +1566(image.)S +1895(The)S +2080(ISM)S +2288(\(ISM)S +2529(is)S +2626(Image)S +2905(Support)S +3252(Module\))S +3626(task)S +3817(then)S +4019(reads)S +4260(the)S +4413(image)S +4688(to)S +4797(determine)S +5227(the)S +5380(pixel)S +1320 V +1260(value)S +1507(\(or)S +1654(a)S +1729(small)S +1977(table)S +2202(of)S +2316(values)S +2602(around)S +2910(the)S +3063(current)S +3376(position\),)S +3787(and)S +3961(computes)S +4374(one)S +4548(or)S +4661(more)S +4896(coordinates)S +5386(from)S +1440 V +1260(the)S +1428(image)S +1718(position.)S +2142(The)S +2343(ISM)S +2567(task)S +2774(also)S +2981(has)S +3160(access)S +3460(to)S +3584(the)S +3752(associated)S +4209(BPM)S +4468(images)S +4798(and)S +4989(can)S +5174(optionally)S +1560 V +1260(return)S +1528(bad)S +1702(pixel)S +1932(information)S +2434(during)S +2725(the)S +2877(cursor)S +3156(readout.)S +1800 V +1260(By)S +1418(default,)S +1761(the)S +1924(logical)S +2237(and)S +2422(world)S +2696(image)S +2981(coordinates)S +3482(are)S +3644(displayed)S +4068(to)S +4187(both)S +4406(the)S +4569(Coords)S +4899(panel)S +5156(readout)S +5497(as)S +1920 V +1260(well)S +1468(as)S +1587(the)S +1745(main)S +1981(display)S +2306(window)S +2664(wcsbox)S +3005(text)S +3191(marker.)S +3564(Alternate)S +3971(coordinate)S +4428(systems)S +4780(\(e.g.)S +4992(transformation)S +2040 V +1260(of)S +1375(equatorial)S +1806(to)S +1916(galactic)S +2258(coordinates)S +2750(or)S +2865(some)S +3108(other)S +3345(sky)S +3516(system,)S +3852(physical)S +4218(coords,)S +4542(ampli\256er)S +4936(coords,)S +5260(etc\))S +5442(can)S +2160 V +1260(be)S +1391(selected)S +1748(for)S +1900(display)S +2225(by)S +2361(hitting)S +2659(the)S +10 I +2817(Options)S +10 R +3170(toggle)S +3456(on)S +3592(the)S +3750(Coords)S +4075(panel.)S +4382(Available)S +4806(coordinate)S +5263(systems)S +2280 V +1260(are)S +1422(chosen)S +1740(using)S +1999(the)S +10 I +2163(Type)S +10 R +2399(menu)S +2663(on)S +2805(the)S +2969(panel,)S +3252(the)S +3416(readout)S +3757(format)S +4065(\(sexigesimal,)S +4637(degrees,)S +5008(etc\))S +5199(using)S +5458(the)S +2400 V +10 I +1260(Format)S +10 R +1591(menu,)S +1869(and)S +2044(the)S +2197(display)S +2517(to)S +2626(the)S +2779(current)S +3092(panel)S +3339(or)S +3453(main)S +3684(image)S +3959(window)S +4311(using)S +4558(the)S +4710(remaining)S +5145(toggles)S +5464(for)S +2520 V +1260(each)S +1478(WCS.)S +1786(Up)S +1944(to)S +2058(four)S +2261(systems)S +2615(may)S +2824(be)S +2955(displayed)S +3375(at)S +3484(one)S +3665(time,)S +3905(the)S +4064(coordinate)S +4522(panel)S +4775(and)S +4956(wcsbox)S +5298(marker)S +2640 V +1260(will)S +1446(adjust)S +1715(size)S +1900(automatically)S +2474(depending)S +2920(on)S +3050(the)S +3202(display.)S +2880 V +1260(By)S +1408(selecting)S +1794(the)S +10 I +1947(BPM)S +2183(Data)S +10 R +2414(toggle)S +2695(from)S +2920(the)S +3073(Coords.Options)S +3735(panel)S +3983(ximtool)S +4327(is)S +4426(able)S +4624(to)S +4734(\257ag)S +4916(pixels)S +5187(in)S +5297(images)S +3000 V +1260(with)S +1474(an)S +1604(associated)S +2050(bad)S +2230(pixel)S +2466(mask.)S +2768(This)S +2982(bad)S +3162(pixel)S +3398(mask)S +3645(is)S +3748(currently)S +4144(assumed)S +4523(to)S +4636(be)S +4765(named)S +5066(in)S +5179(the)S +5336(image)S +3120 V +1260(header)S +1566("BPM")S +1901(keyword)S +2291(by)S +2432(convention.)S +2972(If)S +3080(the)S +3244(cursor)S +3535(passes)S +3832(over)S +4051(a)S +4137(bad)S +4323(pixel)S +4565(in)S +4685(the)S +4849(mask,)S +5127(the)S +5291(Coords)S +3240 V +1260(bpm)S +1487(display)S +1825(as)S +1957(well)S +2178(as)S +2310(the)S +2481(main)S +2730(window)S +3101(wcsbox)S +3455(will)S +3660(change)S +3990(to)S +4116(a)S +4208(red)S +4383(background)S +4902(color.)S +5210(Only)S +5458(the)S +3360 V +1260(Coords)S +1579(display)S +1898(will)S +2084(show)S +2325(the)S +2477(value,)S +2748(any)S +2922(non-zero)S +3306(value)S +3552(will)S +3738(be)S +3862(\257agged)S +4186(with)S +4394(the)S +4546(color)S +4781(change.)S +3600 V +1260(With)S +1490(the)S +1642(ISM)S +1850(enabled)S +2190(the)S +2342(Compass)S +2739(indicator)S +3124(will)S +3310(display)S +3629(a)S +3703(set)S +3844(of)S +3957(arrows)S +4259(showing)S +4629(North-East)S +5098(if)S +5190(a)S +5265(WCS)S +5513(is)S +3720 V +1260(available,)S +1678(otherwise)S +2099(just)S +2277(the)S +2432(current)S +2747(X-Y)S +2957(axes)S +3167(are)S +3321(shown.)S +3669(The)S +3856(pixel)S +4088(table)S +4314(will)S +4502(display)S +4823(actual)S +5093(pixel)S +5325(values)S +3840 V +1260(from)S +1484(the)S +1636(image,)S +1935(with)S +2143(the)S +2295(ISM)S +2503(o)S +2553 H + (f)show 10 -.5 mul h (f)show +10 R +2644(the)S +2796(pixel)S +3026(table)S +3250(displays)S +3608(the)S +3760(scaled)S +4039(image)S +4313(values)S +4598(from)S +4822(the)S +4974(frame)S +5236(bu)S +5336 H + (f)show 10 -.5 mul h (f)show +10 R +5397(er.)S +4128 V +9 B +900(FREEZING)S +1397(CURSOR)S +1804(READOUT)S +4248 V +10 R +1260(Holding)S +1618(down)S +1871(the)S +2024(Alt)S +2183(key)S +2358(will)S +2545(now)S +2748(freeze)S +3021(the)S +3174(cursor)S +3454(display)S +3774(readout)S +4104(and)S +4279(draw)S +4509(crosshairs)S +4939(on)S +5070(the)S +5223(screen)S +5508(at)S +4368 V +1260(the)S +1424(last)S +1605(position.)S +2025(This)S +2245(can)S +2425(be)S +2561(used)S +2786(for)S +2944(example)S +3324(to)S +3444(position)S +3809(the)S +3973(cursor)S +4264(but)S +4434(then)S +4648(allow)S +4912(the)S +5076(cursor)S +5367(to)S +5486(be)S +4488 V +1260(moved)S +1568(to)S +1682(another)S +2017(window)S +2375(\(to)S +2522(enter)S +2757(text,)S +2968(start)S +3176(a)S +3256(program,)S +3655(whatever\))S +4089(without)S +4431(losing)S +4712(the)S +4871(position)S +5231(informa-)S +4608 V +1260(tion)S +1446(displayed)S +1859(on)S +1989(the)S +2141(screen.)S +4896 V +9 B +900(CUT-GRAPHS)S +5016 V +10 R +1260(XImtool)S +1635(now)S +1843(has)S +2013(the)S +2172(ability)S +2465(to)S +2580(display)S +2906(horizontal)S +3348(and)S +3529(vertical)S +3865(cut-graphs)S +4323(of)S +4443(the)S +4602(display,)S +4953(these)S +5195(appear)S +5497(as)S +5136 V +1260("\257ip-out")S +1672(panels)S +1962(that)S +2147(appear)S +2447(on)S +2582(the)S +2739(bottom)S +3058(and)S +3237(right)S +3461(side)S +3656(of)S +3773(the)S +3929(main)S +4163(display)S +4486(window)S +4842(and)S +5020(are)S +5175(controlled)S +5256 V +1260(by)S +1390(the)S +1542(small)S +1789("H")S +1973(and)S +2147("V")S +2331(buttons)S +2656(in)S +2764(the)S +2916(lower)S +3174(right)S +3394(corner)S +3679(of)S +3793(the)S +3946(window.)S +4354(When)S +4623(both)S +4832(panels)S +5118(are)S +5270(enabled)S +5376 V +1260(the)S +1412(corner)S +1696(area)S +1891(of)S +2004(the)S +2156(display)S +2475(also)S +2666(shows)S +2946(an)S +3070(options)S +3395(panel)S +3641(for)S +3787(the)S +3939(graphs.)S +4290(Current)S +4625(options)S +4950(are:)S +5664 V +10 B +1260(Better)S +1555(Speed)S +10 R +2260(Draw)S +2523(the)S +2687(graphics)S +3067(so)S +3198(they)S +3412(update)S +3720(at)S +3834(the)S +3998(fastest)S +4295(possible)S +4665(rate.)S +4912(This)S +5133(is)S +5243(done)S +5480(by)S +5784 V +2260(subsampling)S +2797(pixels)S +3067(to)S +3176(produce)S +3527(a)S +3601(smoother)S +4003(graph)S +4260(but)S +4418(without)S +4754(sacri\256cing)S +5200(too)S +5358(much)S +5904 V +2260(accuracy.)S +6072 V +10 B +1260(Better)S +1555(Accuracy)S +10 R +2260(Draw)S +2520(the)S +2681(graphics)S +3058(using)S +3314(all)S +3453(screen)S +3746(pixels)S +4024(to)S +4141(produce)S +4501(the)S +4662(most)S +4896(accurate)S +5266(display.)S +6192 V +2260(On)S +2427(fast)S +2615(modern)S +2964(machines)S +3385(this)S +3574(can)S +3756(be)S +3894(enabled)S +4248(with)S +4470(no)S +4614(apparent)S +5001(loss)S +5201(of)S +5328(speed,)S +6312 V +2260(however)S +2635(older)S +2873(machines)S +3283(may)S +3488(wish)S +3710(to)S +3821(use)S +3987(this)S +4165(only)S +4376(occassionally)S +4947(to)S +5058(limit)S +5281(any)S +5458(lag)S +6432 V +2260(in)S +2368(the)S +2520(cursor)S +2799(tracking.)S +6600 V +10 B +1260(Image)S +1556(Pixels)S +10 R +2260(\()S +10 I +2293(Not)S +2468(Yet)S +2626(Implemented)S +10 R +3141(\))S +6768 V +10 B +1260(Jump)S +1535(Cursor)S +10 R +2260(If)S +2367(enabled,)S +2743(large)S +2983(jumps)S +3269(of)S +3393(the)S +3556(cursor)S +3846(do)S +3987(not)S +4156(update)S +4463(the)S +4627(graphics)S +5007(display,)S +5363(small)S +6888 V +2260(movements)S +2751(around)S +3058(an)S +3182(object)S +3456(of)S +3569(interest)S +3893(will)S +4079(update)S +4375(the)S +4527(display)S +4846(continuously.)S +7056 V +10 B +1260(Smooth)S +1618(Cursor)S +10 R +2260(If)S +2356(enabled,)S +2721(all)S +2851(cursor)S +3130(movements)S +3621(cause)S +3872(the)S +4024(display)S +4343(to)S +4451(be)S +4575(updated.)S +4976(This)S +5184(is)S +5281(another)S +7176 V +2260(option)S +2550(that)S +2734(can)S +2906(be)S +3034(set)S +3179(safely)S +3451(on)S +3585(faster)S +3840(machines)S +4251(but)S +4412(will)S +4601(cause)S +4855(a)S +4932(delay)S +5181(on)S +5314(slower)S +7296 V +2260(ones.)S +7776 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(12)S +7920 V +EP +%%Page: 13 14 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(Graphics)S +1685(Cursors)S +10 R +2260(If)S +2362(enabled,)S +2733(the)S +2891(graphics)S +3265(cursors)S +3589(in)S +3703(either)S +3966(of)S +4086(the)S +4245(plots)S +4477(are)S +4635(active)S +4910(and)S +5091(can)S +5266(be)S +5397(used)S +1080 V +2260(to)S +2374(update)S +2676(the)S +2834(cursor)S +3119(readout)S +3454(on)S +3590(the)S +3748(main)S +3984(image)S +4264(window)S +4622(and)S +4802(the)S +4959(complementary)S +1200 V +2260(cut-graph.)S +2729(This)S +2939(can)S +3109(be)S +3235(used)S +3450(for)S +3598(example)S +3969(to)S +4080(freeze)S +4355(the)S +4510(cursor)S +4792(in)S +4903(the)S +5058(main)S +5291(display)S +1320 V +2260(using)S +2518(the)S +2681(Alt)S +2850(key)S +3035(\(see)S +3236(above\),)S +3573(then)S +3786(moving)S +4133(to)S +4252(one)S +4437(of)S +4561(the)S +4723(graphics)S +5101(windows)S +5502(to)S +1440 V +2260(perform)S +2611(cut)S +2763(graphs)S +3059(in)S +3167(only)S +3375(one)S +3549(axis.)S +1680 V +2260(Graphs)S +2583(are)S +2739(\(currently\))S +3200(drawn)S +3484(using)S +3736(only)S +3949(the)S +4106(scaled)S +4390(display)S +4714(values)S +5004(to)S +5117(avoid)S +5375(com-)S +1800 V +2260(plications)S +2706(of)S +2846(accessing)S +3285(multiple)S +3675(images)S +4014(in)S +4148(a)S +4248(mosaic)S +4587(display.)S +4957(Both)S +5208(plots)S +5459(are)S +1920 V +2260(labeled)S +2584(using)S +2837(the)S +2995(frame)S +3263(z1/z2)S +3515(values)S +3806(and)S +3986(contain)S +4316(cursor)S +4602(indicators)S +5033(which)S +5314(update)S +2040 V +2260(contuously.)S +2328 V +9 B +900(PEAK-UP)S +1327(CURSOR)S +1734(CENTROID)S +2246(POSITIONING)S +2448 V +10 R +1260(Several)S +1600(new)S +1807(keystroke)S +2236(commands)S +2710(are)S +2872(available)S +3273(to)S +3392(reposition)S +3833(the)S +3996(cursor)S +4286(to)S +4405(a)S +4490(centroid)S +4858(or)S +4982(min/max)S +5380(pixel)S +2568 V +1260(value)S +1515(within)S +1810(a)S +1893(bounding)S +2310(box)S +2499(of)S +2621(the)S +2782(cursor)S +3070(position,)S +3487(allowing)S +3876(you)S +4065(to)S +4182(approximate)S +4720(the)S +4881(position)S +5242(with)S +5458(the)S +2688 V +1260(mouse)S +1556(and)S +1735(\256ne)S +1920(tune)S +2127(it)S +2218(quickly)S +2553(before)S +2842(typing)S +3133(the)S +3290(application)S +3769(keystroke)S +4192(command.)S +4676(The)S +4866(initial)S +5136(box)S +5322(size)S +5513(is)S +2808 V +1260(controlled)S +1696(with)S +1905(a)S +10 I +1980(centerBoxSize)S +10 R +2576(GUI)S +2784(resource)S +3152(\(defaults)S +3531(to)S +3639(5)S +3719(pixels\))S +4021(but)S +4179(can)S +4347(be)S +4471(adjusted)S +4834(interactively)S +5363(using)S +2928 V +1260(the)S +10 B +1429(Ctrl-[)S +10 R +1719(and)S +10 B +1910(Ctrl-])S +10 R +2200(commands)S +2680(to)S +2805(descrease/increase)S +3587(the)S +3756(box)S +3953(size)S +4155(respectively.)S +4739(A)S +4858(marker)S +5187(will)S +5391(\257ash)S +3048 V +1260(brie\257y)S +1551(to)S +1659(indicate)S +2005(the)S +2157(box)S +2337(size.)S +3288 V +1260(The)S +10 B +1454(Ctrl-0)S +10 R +1754(\(zero\))S +2031(key)S +2215(\256nds)S +2450(either)S +2717(a)S +2801(centroid)S +3168(or)S +3291(the)S +3453(local)S +3687(maximum)S +4133(pixel)S +4373(value)S +4629(within)S +4925(this)S +5110(box)S +5300(region,)S +3408 V +10 B +1260(Alt-Ctrl-0)S +10 R +1724(\(zero\))S +1999(will)S +2193(\256nd)S +2387(the)S +2547(local)S +2779(minimum)S +3207(value.)S +3516(In)S +3637(either)S +3902(case)S +4111(the)S +4271(cursor)S +4558(is)S +4663(reposition)S +5101(to)S +5216(the)S +5375(com-)S +3528 V +1260(puted)S +1520(value.)S +1829(The)S +2022(default)S +2337(peak-up)S +2696(action)S +2978(is)S +3083(to)S +3199(\256nd)S +3393(the)S +3553(centroid)S +3918(position)S +4279(in)S +4395(the)S +4555(box)S +4743(however)S +5125(this)S +5309(can)S +5486(be)S +3648 V +1260(changed)S +1633(to)S +1751(\256nd)S +1947(the)S +2109(max)S +2321(pixel)S +2561(by)S +2701(selection)S +3096(the)S +3258(")S +10 I +3299(Centroid)S +3695(Peaks)S +10 R +3933(")S +4014(option)S +4310(from)S +4544(the)S +4706(main)S +4946(Display)S +5297(control)S +3768 V +1260(panel)S +1506(or)S +1619(by)S +1749(resetting)S +2123(the)S +10 I +2275(peakCentroid)S +10 R +2849(GUI)S +3056(resource)S +3423(\(defaults)S +3802(to)S +3910(True\).)S +4008 V +1260(Centroiding)S +1785(is)S +1899(done)S +2140(using)S +2404(only)S +2629(the)S +2798(scaled)S +3094(screen)S +3395(pixel)S +3642(values)S +3944(and)S +4135(only)S +4360(pixels)S +4646(above)S +4931(the)S +5100(mean)S +5364(value)S +4128 V +1260(within)S +1561(the)S +1728(box)S +1923(are)S +2089(used.)S +2372(It)S +2478(works)S +2767(best)S +2973(if)S +3078(the)S +3244(box)S +3438(size)S +3637(is)S +3748(set)S +3903(appropriately,)S +4504(the)S +4670(centroid)S +5041(position)S +5408(may)S +4248 V +1260(appear)S +1555(to)S +1663(drift)S +1865(if)S +1956(the)S +2108(box)S +2288(is)S +2385(too)S +2543(large)S +2772(and)S +2946(includes)S +3309(too)S +3467(many)S +3719(background)S +4220(pixels.)S +4536 V +9 B +1080(Command)S +1512(Summary)S +4656 V +10 B +1260(Ctrl-0)S +1550(\(zero\))S +10 R +2260(Reposition)S +2724(to)S +2832(centroid/max-pixel)S +4764 V +10 B +1260(Alt-Ctrl-0)S +1716(\(zero\))S +10 R +2260(Reposition)S +2724(to)S +2832(min-pixel)S +4872 V +10 B +1260(Ctrl-[)S +10 R +2260(Decrease)S +2654(centering)S +3055(box)S +3235(size)S +3420(\(min)S +3639(of)S +3752(5\))S +4980 V +10 B +1260(Ctrl-])S +10 R +2260(Increase)S +2621(centering)S +3022(box)S +3202(size)S +5268 V +9 B +1080(Resource)S +1462(Summary)S +5388 V +10 B +1260(peakCentroid)S +1879(=)S +1966(True)S +10 R +2260(Compute)S +2671(the)S +2837(box)S +3032(centroid)S +3404(position,)S +3797(a)S +3886('False')S +4208(value)S +4469(force)S +4718(the)S +4885(max)S +5102(value)S +5363(to)S +5486(be)S +5508 V +2260(used)S +5616 V +10 B +1260(centerBoxSize)S +1894(=)S +1981(5)S +10 R +2260(Size)S +2462(of)S +2575(the)S +2727(centroid)S +3084(box,)S +3289(used)S +3502(as)S +3615(cursor)S +3894(position)S +4247(+/-)S +4394(this)S +4569(value)S +5904 V +9 B +900(AUTO-REGISTRATION)S +1917(OF)S +2069(IMAGES)S +6024 V +10 R +1260(The)S +1451(auto-register)S +1991(feature)S +2303(allows)S +2600(you)S +2786(specify)S +3111(a)S +3192(registration)S +3684(of)S +3804(two)S +3991(or)S +4111(more)S +4353(display)S +4679(frames)S +4987(with)S +5202(an)S +5333(o)S +5383 H + (f)show 10 -.5 mul h (f)show +10 R +5444(set.)S +6144 V +1260(When)S +1538(enabled,)S +1913(this)S +2098(registration)S +2593(is)S +2700(maintained)S +3184(for)S +3340(all)S +3480(frames)S +3791(in)S +3909(the)S +4071(list)S +4234(if)S +4335(any)S +4519(one)S +4703(of)S +4825(them)S +5064(is)S +5170(panned)S +5497(or)S +6264 V +1260(zoomed)S +1606(to)S +1714(a)S +1788(new)S +1984(location)S +2336(in)S +2444(the)S +2596(frame)S +2858(bu)S +2958 H + (f)show 10 -.5 mul h (f)show +10 R +3019(er.)S +6504 V +1260(For)S +1429(example,)S +1822(to)S +1930(use)S +2093(this)S +2268(feature)S +2574(do)S +2704(the)S +2856(following:)S +6672 V +10 B +1620(1\))S +10 R +1870(Enable)S +2201(Auto-Register)S +2821(\(either)S +3135(on)S +3289(the)S +3465(Control)S +3825(Panel)S +4102(or)S +4240(the)S +4417(toolbar)S +4755(on)S +4910(the)S +5087(alt-gui\))S +5436(and)S +6792 V +1870(pan/zoom)S +2294(to)S +2402(some)S +2643(star)S +2817(of)S +2930(interest.)S +6960 V +10 B +1620(2\))S +10 R +1870(Use)S +2055(Mouse-Button-2)S +2746(to)S +2854(center)S +3127(the)S +3279(star)S +3453(in)S +3561(the)S +3713(frame.)S +7128 V +10 B +1620(3\))S +10 R +1870(Cycle)S +2134(through)S +2476(the)S +2629(frames)S +2931(and)S +3106(you)S +3287(may)S +3490(see)S +3648(a)S +3723(small)S +3971(shift)S +4180(of)S +4294(the)S +4447(star.)S +4677(For)S +4847(each)S +5061(frame,)S +5380(posi-)S +7248 V +1870(tion)S +2063(the)S +2222(cursor)S +2508(on)S +2644(the)S +2802(star)S +2982(and)S +3162(type)S +10 B +3370(Ctrl-o)S +10 R +3666(to)S +3780(o)S +3830 H + (f)show 10 -.5 mul h (f)show +10 R +3891(set)S +4038(it)S +4130(to)S +4244(the)S +4402(center.)S +4736(Repeat)S +5049(as)S +5168(necessary.)S +7728 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(13)S +7920 V +EP +%%Page: 14 15 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1870(Small)S +2141(corrections)S +2621(will)S +2814(be)S +2945(cumulatively)S +3504(added)S +3779(so)S +3905(you)S +4092(can)S +4267(use)S +4437(the)S +10 B +4597(Ctrl-0)S +10 R +4895(\(Ctrl-zero\))S +5359(peak-)S +1080 V +1870(up)S +2000(command)S +2424(to)S +2532(centroid)S +2889(each)S +3101(object)S +3375(in)S +3483(the)S +3635(frame)S +3897(before)S +4181(the)S +10 B +4333(Ctrl-o)S +10 R +4623(o)S +4673 H + (f)show 10 -.5 mul h (f)show +10 R +4734(set.)S +1248 V +10 B +1620(4\))S +10 R +1870(Pan)S +2054(around)S +2365(the)S +2521(image)S +2799(in)S +2911(one)S +3089(display)S +3412(frame,)S +3703(then)S +3909(switch)S +4204(frames)S +4509(and)S +4688(the)S +4845(new)S +5046(frame)S +5313(should)S +1368 V +1870(also)S +2061(be)S +2185(panned)S +2503(to)S +2611(the)S +2763(new)S +2959(image)S +3233(with)S +3441(the)S +3593(proper)S +3883(o)S +3933 H + (f)show 10 -.5 mul h (f)show +10 R +3994(set.)S +1536 V +10 B +1620(5\))S +10 R +1870(A)S +10 B +1995(Ctrl-a)S +10 R +2308(command)S +2755(will)S +2964(toggle)S +3267(the)S +3443(feature,)S +3798(o)S +3848 H + (f)show 10 -.5 mul h (f)show +10 R +3909(sets)S +4113(are)S +4288(only)S +4520(allowed)S +4890(when)S +5160(autoreg)S +5513(is)S +1656 V +1870(enabled.)S +1824 V +1260(Hitting)S +10 B +1577(Register)S +10 R +1964(will)S +2153(zero)S +2357(the)S +2512(o)S +2562 H + (f)show 10 -.5 mul h (f)show +10 R +2623(sets,)S +2831(as)S +2947(will)S +3136(toggling)S +3503(the)S +3658(auto-register)S +4195(function.)S +4617(What)S +4867(you)S +5051(should)S +5352(see)S +5513(is)S +1944 V +1260(the)S +1414(object)S +1690(centered)S +2059(in)S +2169(the)S +2323(frame)S +2587(and)S +2763(as)S +2878(you)S +3060(blink)S +3298(through)S +3641(it)S +3729(remains)S +4077(registered)S +4502(but)S +4662(the)S +4815(panner)S +5117(box)S +5298(marker)S +2064 V +1260(is)S +1367(moving)S +1713(around.)S +2085(Drag)S +2324(the)S +2486(panner)S +2797(around)S +3114(and)S +3298(all)S +3438(frames)S +3749(still)S +3940(remain)S +4257(registered)S +4690(with)S +4908(the)S +5070(given)S +5333(o)S +5383 H + (f)show 10 -.5 mul h (f)show +10 R +5444(set.)S +2184 V +1260(The)S +1445(control/info)S +1947(panels)S +2232(now)S +2434(display)S +2753(what)S +2977(the)S +3129(o)S +3179 H + (f)show 10 -.5 mul h (f)show +10 R +3240(set)S +3381(is)S +3478(for)S +3624(each)S +3836(frame.)S +2424 V +1260(The)S +1451(register)S +1786(display)S +2111(list)S +2270(is)S +2373(shared)S +2669(with)S +2883(the)S +3041(blink)S +3283(list)S +3442(and)S +3622(can)S +3796(be)S +3926(set)S +4074(using)S +4328(the)S +4487(Display)S +4835(control)S +5155(panel.)S +5463(By)S +2544 V +1260(default)S +1574(all)S +1711(frames)S +2019(are)S +2177(included)S +2558(in)S +2673(the)S +2832(list.)S +3047(For)S +3222(accessing)S +3640(more)S +3881(than)S +4089(four)S +4291(frames,)S +4623(use)S +4792(the)S +4950(box)S +5136(icon)S +5344(in)S +5458(the)S +2664 V +1260(Blink/Register)S +1876(box)S +2058(of)S +2173(the)S +2327(Display)S +2670(control)S +2985(panel)S +3233(to)S +3343(bring)S +3586(up)S +3718(a)S +3794(new)S +3992(window)S +4346(with)S +4556(access)S +4843(to)S +4954(all)S +5087(16)S +5220(available)S +2784 V +1260(frames.)S +3072 V +9 B +1080(Command)S +1512(Summary)S +3192 V +10 B +1260(Ctrl-o)S +10 R +2260(Set)S +2418(the)S +2570(registration)S +3055(o)S +3105 H + (f)show 10 -.5 mul h (f)show +10 R +3166(set)S +3307(from)S +3531(center)S +3300 V +10 B +1260(Ctrl-a)S +10 R +2260(Toggle)S +2573(the)S +2725(Auto-Register)S +3321(feature)S +3588 V +9 B +900(CONTROL)S +1382(PANEL)S +3708 V +10 R +1260(XImtool)S +1636(has)S +1806(a)S +1887(control)S +2207(panel)S +2460(which)S +2741(can)S +2917(be)S +3049(used)S +3270(to)S +3386(exercise)S +3750(most)S +3983(of)S +4104(the)S +4264(capabilities)S +4757(the)S +4917(program)S +5293(has)S +5464(for)S +3828 V +1260(image)S +1544(display.)S +1928(The)S +2123(control)S +2445(panel)S +2700(can)S +2877(be)S +3010(accessed)S +3397(either)S +3663(via)S +3824(the)S +10 B +3985(Options)S +10 R +4364(menu)S +4625(from)S +4858(the)S +5019(main)S +5258(window)S +3948 V +1260(menubar,)S +1666(or)S +1781(by)S +1913(pressing)S +2278(the)S +2432(leftmost)S +2792(button)S +3080(in)S +3190(the)S +3344(row)S +3531(of)S +3646(buttons)S +3973(at)S +4078(the)S +4233(upper)S +4493(right)S +4715(side)S +4909(of)S +5025(the)S +5180(display)S +5502(in)S +4068 V +1260(the)S +1416(standard)S +1788(GUI)S +1999(\(in)S +2144(the)S +2299(alternate)S +2675(GUI)S +2885(the)S +10 I +3040(Control)S +3385(Bar)S +10 R +3568(accessed)S +3949(by)S +4082(the)S +4237(rightmost)S +4654(button)S +4943(on)S +5076(the)S +5231(menubar)S +4188 V +1260(provides)S +1634(widgets)S +1975(for)S +2121(selecting)S +2506(the)S +2658(desired)S +2976(control)S +3289(panel\).)S +4428 V +1260(The)S +1455(separate)S +1821(windows)S +2222(previously)S +2684(used)S +2907(for)S +3063(Control/Print/Load/Save/etc)S +4231(have)S +4459(now)S +4671(been)S +4899(integrated)S +5339(into)S +5536(a)S +4548 V +1260(single)S +1535(window)S +1893(with)S +2107(the)S +2265(appropriate)S +2755(control)S +3074(panel)S +3326(selectable)S +3755(with)S +3969(a)S +4049(Tab)S +4240(widget.)S +4603(There)S +4871(are)S +5028(also)S +5224(new)S +5425(Tab)S +4668 V +1260(panels)S +1547(for)S +1696(setting)S +1996(the)S +2151(frame)S +2416(tile)S +2577(con\256guration)S +3143(\(see)S +3336(below\),)S +3671(more)S +3909(detailed)S +4258(information)S +4763(on)S +4896(the)S +5051(server)S +5327(status,)S +4788 V +1260(and)S +1434(selecting)S +1819(the)S +1971(WCS)S +2218(readout)S +2547(options)S +2872(\(see)S +3062(below\).)S +5076 V +9 B +1080(VIEW)S +1357(CONTROLS)S +5196 V +10 R +1260(The)S +10 B +1452(Frame)S +1771(box)S +10 R +1964(will)S +2157(list)S +2317(only)S +2532(the)S +2692(frame)S +2962(bu)S +3062 H + (f)show 10 -.5 mul h (f)show +10 R +3123(ers)S +3277(you)S +3465(currently)S +3863(have)S +4089(de\256ned.)S +4476(Currently,)S +4922(the)S +5082(only)S +5298(way)S +5502(to)S +5316 V +1260(destroy)S +1591(a)S +1672(frame)S +1941(bu)S +2041 H + (f)show 10 -.5 mul h (f)show +10 R +2102(er)S +2216(is)S +2320(to)S +2435(change)S +2754(the)S +2913(frame)S +3182(bu)S +3282 H + (f)show 10 -.5 mul h (f)show +10 R +3343(er)S +3457(con\256guration,)S +4052(new)S +4255(frame)S +4524(bu)S +4624 H + (f)show 10 -.5 mul h (f)show +10 R +4685(ers)S +4838(\(up)S +5008(to)S +5123(16\))S +5293(will)S +5486(be)S +5436 V +1260(created)S +1586(automatically)S +2169(if)S +2269(requested)S +2690(by)S +2829(the)S +2990(client.)S +3306(The)S +3500(number)S +3845(of)S +3968(frame)S +4240(bu)S +4340 H + (f)show 10 -.5 mul h (f)show +10 R +4401(ers)S +4557(created)S +4884(at)S +4996(startup)S +5308(can)S +5486(be)S +5556 V +1260(controlled)S +1695(using)S +1942(the)S +10 I +2094(-nframes)S +10 R +2479(command-line)S +3086(switch)S +3377(or)S +3490(the)S +10 I +3642(defNFrames)S +10 R +4166(resource.)S +5796 V +1260(The)S +10 B +1455(text)S +1655(display)S +10 R +2002(window)S +2364(gives)S +2615(the)S +2777(\256eld)S +2995(X,Y)S +3204(center,)S +3513(X,Y)S +3723(scale)S +3963(factors,)S +4300(the)S +4463(X,Y)S +4673(zoom)S +4936(factors,)S +5273(and)S +5458(the)S +5916 V +1260(frame)S +1538(o)S +1588 H + (f)show 10 -.5 mul h (f)show +10 R +1649(set)S +1806(used)S +2035(in)S +2159(Auto-Registration.)S +2952(The)S +3152(scale)S +3396(factor)S +3673(and)S +3862(the)S +4029(zoom)S +4296(factor)S +4573(will)S +4774(be)S +4913(the)S +5080(same)S +5330(unless)S +6036 V +10 I +1260(autoscale)S +10 R +1685(is)S +1794(enabled.)S +2171(The)S +2368(scale)S +2610(is)S +2720(in)S +2841(units)S +3079(of)S +3205(display)S +3537(pixels)S +3819(per)S +3989(frame)S +4264(bu)S +4364 H + (f)show 10 -.5 mul h (f)show +10 R +4425(er)S +4545(pixel,)S +4813(and)S +5000(is)S +5110(an)S +5247(absolute)S +6156 V +1260(measure)S +1629(\(it)S +1755(doesn't)S +2086(matter)S +2377(whether)S +2734(or)S +2853(not)S +3017(autoscale)S +3424(is)S +3527(enabled\).)S +3931(Zoom)S +4206(is)S +4309(relative)S +4644(to)S +4758(the)S +4916(autoscale)S +5323(factor,)S +6276 V +1260(which)S +1534(is)S +1631(1.0)S +1786(if)S +1877(autoscaling)S +2362(is)S +2459(disabled.)S +2847(This)S +3055(information)S +3557(is)S +3654(also)S +3845(presented)S +4257(in)S +4365(the)S +4517(Info)S +4713(panel.)S +6516 V +1260(The)S +1446(numbers)S +1821(in)S +1930(the)S +10 B +2083(Zoom)S +2364(box)S +10 R +2551(are)S +2703(zoom)S +2956(factors.)S +3283(Blue)S +3503(numbers)S +3878(zoom,)S +4156(red)S +4314(numbers)S +4689(dezoom.)S +10 I +5061(Zoom)S +5321(In)S +10 R +5436(and)S +6636 V +10 I +1260(Zoom)S +1526(Out)S +10 R +1714(may)S +1924(be)S +2055(used)S +2275(to)S +2390(go)S +2527(to)S +2642(larger)S +2911(or)S +3031(smaller)S +3362(zoom)S +3621(factors,)S +3954(e.g.)S +10 I +4135(Ctrl-5)S +10 R +4417(followed)S +4809(by)S +4946("Zoom)S +5263(In")S +5424(will)S +6756 V +1260(get)S +1421(you)S +1610(to)S +1727(zoom)S +1988(factor)S +2259(10.)S +2453(Speci\256c)S +2814(zoom)S +3075(factors)S +3385(may)S +3596(also)S +3796(be)S +3929(accessed)S +4316(directly)S +4660(as)S +4782(Control)S +5128(keystrokes,)S +6876 V +1260(e.g.)S +1448(Ctrl-5)S +1731(will)S +1931(set)S +2086(zoom)S +2352(factor)S +2628(5.)S +10 I +2747(Center)S +10 R +3063(centers)S +3389(the)S +3555(\256eld.)S +10 I +3832(Toggle)S +4154(Zoom)S +10 R +4426(toggles)S +4758(between)S +5133(the)S +5298(current)S +6996 V +1260(zoom/center)S +1783(values,)S +2093(and)S +2267(the)S +2419(unzoomed)S +2865(image.)S +7236 V +10 I +1260(Aspect)S +10 R +1564(recomputes)S +2062(the)S +2222(view)S +2454(so)S +2581(that)S +2769(the)S +2929(aspect)S +3217(ratio)S +3439(is)S +3545(1.0.)S +3734(Aspect)S +4050(also)S +4250(integerizes)S +4721(the)S +4882(zoom)S +5143(factor)S +5414(\(use)S +7716 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(14)S +7920 V +EP +%%Page: 15 16 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(the)S +1412(version)S +1736(in)S +1844(the)S +1996(View)S +2242(menu)S +2494(if)S +2585(you)S +2765(don't)S +3006(want)S +3230(integerization\).)S +1200 V +10 I +1260(Fit)S +1408(Frame)S +10 R +1706(makes)S +1993(the)S +2147(display)S +2468(window)S +2822(the)S +2976(same)S +3213(size)S +3400(as)S +3515(the)S +3669(frame)S +3933(bu)S +4033 H + (f)show 10 -.5 mul h (f)show +10 R +4094(er.)S +4228(Note)S +4454(that)S +4636(autoscale)S +5039(has)S +5204(much)S +5458(the)S +1320 V +1260(same)S +1499(e)S +1543 H + (f)show 10 -.5 mul h (f)show +10 R +1604(ect,)S +1779(and)S +1957(allows)S +2252(you)S +2436(to)S +2548(resize)S +2814(the)S +2970(display)S +3293(window)S +3649(to)S +3761(any)S +3938(size)S +4126(you)S +4309(want,)S +4561(or)S +4677(view)S +4904(images)S +5220(too)S +5381(large)S +1440 V +1260(to)S +1368(\256t)S +1482(on)S +1612(the)S +1764(screen.)S +1728 V +9 B +1080(ENHANCEMENT)S +1827(CONTROLS)S +1848 V +10 R +1260(At)S +1398(the)S +1558(top)S +1724(is)S +1829(a)S +1911(scrolled)S +2265(list)S +2426(of)S +2547(all)S +2685(the)S +2845(available)S +3243(colormaps.)S +3722(Click)S +3977(on)S +4115(the)S +4275(one)S +4457(you)S +4645(want)S +4878(to)S +4995(load.)S +5231(You)S +5442(can)S +1968 V +1260(add)S +1447(your)S +1673(own)S +1888(colormaps)S +2347(to)S +2468(this)S +2656(list)S +2822(by)S +2965(de\256ning)S +3336(the)S +10 I +3501(cmap[12])S +10 R +3938(or)S +10 I +4063(cmapDir[12])S +10 R +4638(command)S +5074(line)S +5266(\257ags)S +5497(or)S +2088 V +1260(application)S +1734(resources.)S +2328 V +1260(The)S +1451(two)S +1637(sliders)S +1934(adjust)S +2209(the)S +2367(contrast)S +2719(\(upper)S +3015(slider\))S +3306(and)S +3486(brightness)S +3933(\(lower)S +4229(slider\))S +4520(of)S +4640(the)S +4799(display.)S +5150(The)S +10 I +5342(Invert)S +2448 V +10 R +1260(button)S +1549(inverts)S +1854(the)S +2009(colormap)S +2419(\(multiples)S +2858(the)S +3013(contrast)S +3362(by)S +3495(-1.0\).)S +3744(Note)S +3971(that)S +4154(due)S +4331(to)S +4442(the)S +4597(use)S +4763(of)S +4879(the)S +5033(private)S +5342(color-)S +2568 V +1260(map)S +1464(the)S +1618(sliders)S +1911(are)S +2064(a)S +2140(bit)S +2278(sluggish)S +2644(when)S +2892(dragged)S +3245(to)S +3355(window)S +3709(the)S +3863(display.)S +4209(If)S +4307(this)S +4484(is)S +4583(annoying,)S +5013(using)S +5263(MB3)S +5502(in)S +2688 V +1260(the)S +1412(display)S +1731(window)S +2083(is)S +2180(faster.)S +2928 V +1260(The)S +10 I +1454(Normalize)S +10 R +1910(button)S +2205(\(on)S +2377(the)S +2538(bottom)S +2861(of)S +2983(the)S +3145(control)S +3468(panel\))S +3757(will)S +3953(normalize)S +4392(the)S +4554(enhancement,)S +5145(i.e.)S +5307(set)S +5458(the)S +3048 V +1260(contrast)S +1613(and)S +1794(brightness)S +2242(to)S +2357(the)S +2516(default)S +2830(one-to-one)S +3299(values)S +3590(\(1.0,)S +3809(0.5\).)S +4028(This)S +4242(is)S +4345(the)S +4503(preferred)S +4903(setting)S +5206(for)S +5358(many)S +3168 V +1260(of)S +1381(the)S +1541(pseudocolor)S +2067(colortables)S +2543(and)S +2725(for)S +2879(private)S +3194(colormaps)S +3648(loaded)S +3952(from)S +4184(disk)S +4389(images.)S +4735(The)S +10 I +4929(Initialize)S +10 R +5324(button)S +3288 V +1260(does)S +1473(a)S +1547(reset)S +1765(of)S +1878(the)S +2030(server.)S +3576 V +9 B +1080(BLINK)S +1397(CONTROLS)S +3696 V +10 I +1260(Blink)S +1503(frames)S +10 R +1807(is)S +1907(the)S +2062(list)S +2218(of)S +2334(frames)S +2638(to)S +2749(be)S +2876(blinked.)S +3234(When)S +3505(blink)S +3744(mode)S +3999(is)S +4099(in)S +4210(e)S +4254 H + (f)show 10 -.5 mul h (f)show +10 R +4315(ect)S +4464(ximtool)S +4809(just)S +4987(cycles)S +5269(through)S +3816 V +1260(these)S +1498(frames)S +1802(endlessly,)S +2232(pausing)S +2576("blink)S +2856(rate")S +3079(seconds)S +3428(between)S +3793(each)S +4008(frame.)S +4298(The)S +4486(same)S +4724(frame)S +4989(can)S +5160(be)S +5287(entered)S +3936 V +1260(in)S +1369(the)S +1523(list)S +1678(more)S +1915(than)S +2119(once.)S +2394(To)S +2537(program)S +2907(an)S +3033(arbitrary)S +3408(list)S +3563(of)S +3678(blink)S +3916(frames,)S +4244(hit)S +4382(the)S +4536(Reset)S +4790(button)S +5078(and)S +5254(click)S +5480(on)S +4056 V +1260(each)S +1479(blink)S +1722(frame)S +1991(button)S +2284(until)S +2505(it)S +2597(is)S +2700(set)S +2847(to)S +2961(the)S +3119(desired)S +3443(frame)S +3711(number.)S +4107(The)S +4298(main)S +4534(control)S +4853(panel)S +5105(allows)S +5402(only)S +4176 V +1260(the)S +1416(original)S +1761(four)S +1961(frames)S +2266(to)S +2378(be)S +2506(speci\256ed)S +2895(in)S +3007(the)S +3163(blink)S +3403(list,)S +3585(however)S +3962(access)S +4250(to)S +4362(the)S +4518(full)S +4691(list)S +4849(of)S +4967(16)S +5102(frames)S +5408(now)S +4296 V +1260(supported)S +1684(is)S +1781(gained)S +2077(using)S +2324(the)S +2476(box)S +2656(icon)S +2858(button)S +3144(next)S +3346(the)S +3498(the)S +10 I +3650(Reset)S +10 R +3896(button)S +4182(to)S +4290(bring)S +4531(up)S +4661(a)S +4735(new)S +4931(control)S +5244(panel.)S +4536 V +1260(The)S +10 I +1455(Blink)S +1706(Rate)S +10 R +1929(can)S +2107(be)S +2242(adjusted)S +2616(as)S +2740(slow)S +2970(or)S +3094(as)S +3218(fast)S +3403(as)S +3527(you)S +3718(want)S +3953(using)S +4211(the)S +4374(arrow)S +4647(buttons.)S +5008(If)S +5115(you)S +5306(set)S +5458(the)S +4656 V +1260(blink)S +1496(rate)S +1675(small)S +1922(enough)S +2246(it)S +2332(will)S +2518(go)S +2648(to)S +2756(zero,)S +2982(enabling)S +3356(single)S +3625(step)S +3816(mode)S +4068(\(see)S +4258(below\).)S +4896 V +1260(The)S +10 I +1449(Register)S +10 R +1816(button)S +2106(registers)S +2478(all)S +2612(the)S +2768(blink)S +3008(frames)S +3313(with)S +3525(the)S +3681(current)S +3997(display)S +4320(frame.)S +4612(Frames)S +4941(not)S +5104(in)S +5217(the)S +5374(blink)S +5016 V +1260(list)S +1413(are)S +1564(not)S +1722(a)S +1766 H + (f)show 10 -.5 mul h (f)show +10 R +1827(ected.)S +5256 V +1260(The)S +10 I +1446(Match)S +1732(LUTs)S +10 R +1986(button)S +2273(sets)S +2454(the)S +2607(enhancement)S +3164(of)S +3278(all)S +3409(blink)S +3646(frames)S +3948(to)S +4057(the)S +4210(same)S +4446(values)S +4733(as)S +4848(the)S +5002(display)S +5323(frame.)S +5376 V +1260(Frames)S +1584(not)S +1742(in)S +1850(the)S +2002(blink)S +2238(list)S +2391(are)S +2542(not)S +2700(a)S +2744 H + (f)show 10 -.5 mul h (f)show +10 R +2805(ected.)S +5616 V +1260(The)S +10 I +1453(Blink)S +10 R +1702(button)S +1996(turns)S +2234(blink)S +2478(on)S +2616(and)S +2799(o)S +2849 H + (f)show 10 -.5 mul h (f)show +10 R +2910(.)S +2974(When)S +3251(the)S +3412(blink)S +3657(rate)S +3845(is)S +3951(set)S +4101(to)S +4218(zero)S +4428(the)S +4589(Blink)S +4851(button)S +5146(will)S +5341(single)S +5736 V +1260(step)S +1451(through)S +1792(the)S +1944(blink)S +2180(frames,)S +2506(one)S +2680(frame)S +2942(per)S +3099(button)S +3385(press.)S +5976 V +10 B +1260(NOTE:)S +10 R +1615(You)S +1825(can)S +2001(blink)S +2245(no)S +2383(matter)S +2677(what)S +2910(ximtool)S +3261(options)S +3595(are)S +3755(in)S +3872(e)S +3916 H + (f)show 10 -.5 mul h (f)show +10 R +3977(ect,)S +4157(but)S +4324(many)S +4585(of)S +4707(these)S +4951(will)S +5146(slow)S +5374(blink)S +6096 V +1260(down.)S +1541(To)S +1686(get)S +1842(the)S +1998(fastest)S +2287(blink)S +2527(you)S +2711(may)S +2917(want)S +3145(to)S +3257(turn)S +3451(o)S +3501 H + (f)show 10 -.5 mul h (f)show +10 R +3595(the)S +3750(panner)S +4054(and)S +4231(coords)S +4530(box,)S +4738(and)S +4915(match)S +5192(the)S +5347(LUTs)S +6216 V +1260(of)S +1382(all)S +1521(the)S +1682(blink)S +1927(frames.)S +2292(All)S +2459(the)S +2620(ximtool)S +2971(controls)S +3332(are)S +3492(fully)S +3721(active)S +3999(during)S +4300(blink)S +4546(mode,)S +4833(plus)S +5040(you)S +5230(can)S +5408(load)S +6336 V +1260(frames)S +1561(etc.)S +6624 V +9 B +1080(OPTIONS:)S +6744 V +10 B +1260(Panner)S +6864 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(Panner)S +3099(marker.)S +7032 V +10 B +1260(Magni\256er)S +7152 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(Magni\256er)S +3216(marker.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(15)S +7920 V +EP +%%Page: 16 17 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(Coords)S +1601(Box)S +1080 V +10 R +1510(Toggles)S +1862(whether)S +2213(to)S +2321(display)S +2640(the)S +2792(coordinate)S +3243(box)S +3423(marker.)S +1248 V +10 B +1260(Autoscale)S +1368 V +10 R +1510(If)S +1613(autoscale)S +2021(is)S +2126(enabled)S +2474(then)S +2684(at)S +2794(zoom=1,)S +3185(the)S +3345(frame)S +3615(bu)S +3715 H + (f)show 10 -.5 mul h (f)show +10 R +3776(er)S +3891(will)S +4085(be)S +4217(automatically)S +4799(scaled)S +5086(to)S +5202(\256t)S +5324(within)S +1488 V +1510(the)S +1667(display)S +1991(window.)S +2373(With)S +2608(autoscale)S +3014(disabled)S +3382(\(the)S +3572(default\),)S +3942(the)S +4099(image)S +4377(scale)S +4610(is)S +4711(more)S +4950(predictable,)S +5452(but)S +1608 V +1510(the)S +1662(image)S +1936(may)S +2138(be)S +2262(clipped)S +2586(by)S +2716(the)S +2868(display)S +3187(window,)S +3564(or)S +3677(may)S +3879(not)S +4037(\256ll)S +4179(the)S +4331(display)S +4650(window.)S +1776 V +10 B +1260(Antialias)S +1896 V +10 R +1510(When)S +1780(dezooming)S +2257(an)S +2384(image,)S +2686(i.e.,)S +2866(displaying)S +3316(a)S +3393(large)S +3625(image)S +3902(in)S +4013(a)S +4090(smaller)S +4417(display)S +4739(window,)S +5119(antialiasing)S +2016 V +1510(causes)S +1802(all)S +1933(the)S +2086(data)S +2283(to)S +2392(be)S +2517(used)S +2731(to)S +2840(compute)S +3215(the)S +3368(displayed)S +3782(image.)S +4082(If)S +4179(antialiasing)S +4671(is)S +4769(disabled)S +5133(then)S +5336(image)S +2136 V +1510(is)S +1607(subsampled)S +2109(to)S +2217(compute)S +2592(the)S +2745(displayed)S +3159(image.)S +3459(Antialiasing)S +3979(can)S +4148(prevent)S +4478(subsampling)S +5015(from)S +5240(omitting)S +2256 V +1510(image)S +1792(features)S +2145(that)S +2333(don't)S +2582(fall)S +2753(in)S +2869(the)S +3028(sample)S +3348(grid,)S +3571(but)S +3736(it)S +3829(is)S +3933(signi\256cantly)S +4465(slower)S +4768(than)S +4977(dezooming)S +5458(via)S +2376 V +1510(subsampling.)S +2101(The)S +2286(default)S +2593(is)S +2690(no)S +2820(antialising.)S +2544 V +10 B +1260(Tile)S +1457(Frames)S +2664 V +10 R +1510(The)S +1695(default)S +2002(display)S +2321(mode)S +2573(is)S +2670(to)S +2778(view)S +3002(one)S +3177(frame)S +3440(at)S +3543(a)S +3618(time.)S +3852(In)S +3966(tile)S +4125(frames)S +4427(mode,)S +4705(2)S +4786(or)S +4900(4)S +4981(frames)S +5283(may)S +5486(be)S +2784 V +1510(viewed)S +1834(simultaneously)S +2476(in)S +2590(the)S +2748(display)S +3073(window.)S +3486(All)S +3650(the)S +3808(usual)S +4055(operations)S +4507(\(zoom)S +4798(and)S +4977(pan,)S +5181(colortable)S +2904 V +1510(enhancement,)S +2091(cursor)S +2370(readback,)S +2784(etc.\))S +2988(still)S +3169(work)S +3404(for)S +3550(each)S +3762(frame)S +4024(even)S +4242(when)S +4488(in)S +4596(tile)S +4754(frames)S +5055(mode.)S +3072 V +10 B +1260(Warnings)S +3192 V +10 R +1510(The)S +1701(warnings)S +2103(options)S +2435(toggles)S +2761(whether)S +3119(you)S +3306(see)S +3470(warning)S +3834(dialog)S +4121(boxes)S +4391(in)S +4506(situations)S +4927(like)S +5114(overwriting)S +3312 V +1510(an)S +1634(existing)S +1981(\256le,)S +2164(clearing)S +2515(the)S +2667(frame)S +2929(bu)S +3029 H + (f)show 10 -.5 mul h (f)show +10 R +3090(er,)S +3222(etc.)S +3480 V +10 B +1260(Centroid)S +1673(Peaks)S +3600 V +10 R +1510(If)S +1608(enabled,)S +1975(the)S +10 B +2129(Ctrl-0)S +10 R +2421(keystroke)S +2841(will)S +3029(reposition)S +3461(the)S +3615(cursor)S +3896(to)S +4007(the)S +4162(computed)S +4589(centroid)S +4949(of)S +5065(the)S +5220(centroid-)S +3720 V +1510(ing)S +1668(box,)S +1873(otherwise)S +2291(the)S +2443(cursor)S +2722(is)S +2819(repositioned)S +3343(to)S +3451(the)S +3603(local)S +3827(maximum)S +4263(value)S +4509(within)S +4795(the)S +4947(box.)S +4008 V +9 B +900(LOAD)S +1187(PANEL)S +4128 V +10 R +1260(The)S +1448(Load)S +1687(Panel)S +1943(allows)S +2238(you)S +2422(load)S +2628(images)S +2945(from)S +3173(disk)S +3374(directly)S +3713(to)S +3825(the)S +3981(frame)S +4247(bu)S +4347 H + (f)show 10 -.5 mul h (f)show +10 R +4408(er,)S +4544(this)S +4723(is)S +4824(analogous)S +5263(to)S +5375(load-)S +4248 V +1260(ing)S +1439(an)S +1584(image)S +1879(on)S +2030(the)S +2203(command)S +2648(line)S +2848(except)S +3158(that)S +3358(browsing)S +3780(is)S +3897(possible.)S +4300(At)S +4450(present)S +4788(recognized)S +5275(formats)S +4368 V +1260(include)S +1587(IRAF)S +1848(OIF)S +2042(format)S +2341(\(i.e.)S +10 I +2529(.imh)S +10 R +2737(extension\),)S +3211(simple)S +3511(FITS)S +3750(\256les,)S +3975(GIF,)S +4195(and)S +4373(Sun)S +4563(raster\256les.)S +5040(The)S +5229(task)S +5424(will)S +4488 V +1260(automatically)S +1850(sense)S +2112(the)S +2280(format)S +2592(of)S +2721(the)S +2888(image)S +3177(and)S +3366(load)S +3583(it)S +3684(appropriately.)S +4286(Images)S +4619(with)S +4842(private)S +5164(colormaps)S +4608 V +1260(\(such)S +1515(as)S +1637(GIF\))S +1870(will)S +2065(be)S +2198(loaded)S +2503(using)S +2759(the)S +2920(private)S +3236(colormap)S +3652(\(meaning)S +4068(that)S +4257(changing)S +4663(the)S +4825(brightness/contrast)S +4728 V +1260(enhancements)S +1856(will)S +2043(render)S +2328(an)S +2453(apparently)S +2905(random-colored)S +3573(image\),)S +3906(all)S +4037(others)S +4312(will)S +4499(be)S +4624(loaded)S +4921(with)S +5130(a)S +5204(grayscale)S +4848 V +1260(colormap.)S +5088 V +1260(When)S +1531(loading)S +1864(new)S +2063(images)S +2379(the)S +2534(frame)S +2799(bu)S +2899 H + (f)show 10 -.5 mul h (f)show +10 R +2960(er)S +3070(con\256guration)S +3636(table)S +3863(will)S +4053(be)S +4181(searched)S +4563(for)S +4713(a)S +4791(frame)S +5057(bu)S +5157 H + (f)show 10 -.5 mul h (f)show +10 R +5218(er)S +5329(that)S +5513(is)S +5208 V +1260(the)S +1417(same)S +1657(size)S +1847(or)S +1965(larger)S +2231(than)S +2437(the)S +2593(new)S +2793(image)S +3071(size,)S +3285(if)S +3380(no)S +3514(frame)S +3780(bu)S +3880 H + (f)show 10 -.5 mul h (f)show +10 R +3941(er)S +4052(can)S +4224(be)S +4352(found)S +4619(a)S +4697(custom)S +5020(bu)S +5120 H + (f)show 10 -.5 mul h (f)show +10 R +5181(er)S +5292(exactly)S +5328 V +1260(the)S +1420(size)S +1613(of)S +1734(the)S +1894(image)S +2176(will)S +2370(be)S +2502(created.)S +2852(This)S +3068(means)S +3361(that)S +3549(the)S +3709(image)S +3991(may)S +4201(not)S +4367(\256ll)S +4517(the)S +4677(display)S +5004(window)S +5364(when)S +5448 V +1260(loaded,)S +1594(or)S +1720(you)S +1913(may)S +2128(see)S +2298(a)S +2385(subsection)S +2850(of)S +2976(the)S +3141(image)S +3428(in)S +3549(the)S +3714(main)S +3957(display)S +4288(window.)S +4707(Setting)S +5033(the)S +10 I +5197(autoscale)S +5568 V +10 R +1260(option)S +1559(on)S +1702(the)S +1867(main)S +2110(Display)S +2464(panel)S +2723(will)S +2923(scale)S +3166(the)S +3332(entire)S +3603(image)S +3891(to)S +4013(\256t)S +4141(the)S +4307(main)S +4551(display)S +4884(window,)S +5275(the)S +5441(full)S +5688 V +1260(frame)S +1522(bu)S +1622 H + (f)show 10 -.5 mul h (f)show +10 R +1683(er)S +1790(will)S +1976(always)S +2283(be)S +2407(visible)S +2704(in)S +2812(the)S +2964(Panner)S +3271(marker)S +3583(window.)S +5928 V +1260(Images)S +1578(with)S +1786(more)S +2021(colors)S +2295(than)S +2497(can)S +2665(be)S +2789(displayed)S +3202(will)S +3389(automatically)S +3964(be)S +4089(quantized)S +4508(to)S +4617(the)S +4770(number)S +5106(of)S +5220(available)S +6048 V +1260(colors)S +1540(before)S +1830(display.)S +2210(If)S +2312(the)S +10 I +2470(Auto)S +2695(Grayscale)S +10 R +3141(button)S +3433(is)S +3536(enabled)S +3882(any)S +4062(image)S +4342(colormap)S +4754(will)S +4945(be)S +5074(converted)S +5502(to)S +6168 V +1260(grayscale)S +1666(and)S +1840(loaded)S +2136(as)S +2249(the)S +2401(standard)S +2769(grayscale)S +3175(colormap.)S +6408 V +1260(Formats)S +1626(which)S +1909(permit)S +2209(pixels)S +2487(larger)S +2758(than)S +2969(8-bits/pixel)S +3464(will)S +3659(be)S +3792(sampled)S +4164(on)S +4303(a)S +4386(grid)S +4586(to)S +4703(determine)S +5141(an)S +5274(optimal)S +6528 V +1260(range)S +1519(in)S +1635(the)S +1795(data)S +1998(to)S +2113(be)S +2244(used)S +2464(to)S +2579(compute)S +2960(a)S +3041(linear)S +3305(transformation)S +3930(to)S +4045(the)S +4204(number)S +4546(of)S +4666(display)S +4992(colors.)S +5298(This)S +5513(is)S +6648 V +1260(the)S +1412(same)S +1647(z-scale)S +1954(sampling)S +2352(and)S +2527(transformation)S +3146(used)S +3360(by)S +3491(the)S +3644(IRAF)S +10 I +3903(DISPLAY)S +10 R +4323(task)S +4515(when)S +4762(computing)S +5221(the)S +10 I +5374(z1/z2)S +6768 V +10 R +1260(values)S +1556(and)S +1741(provides)S +2126(a)S +2211(much)S +2474(better)S +2741(initial)S +3015(display)S +3344(than)S +3556(simple)S +3863(truncation)S +4308(to)S +4426(8-bits.)S +4749(This)S +4967(scaling)S +5290(will)S +5486(be)S +6888 V +1260(done)S +1499(automatically)S +2088(using)S +2350(a)S +2439(grid)S +2646(of)S +10 I +2775(Nsample)S +10 R +3171(points)S +3462(if)S +3569(the)S +10 I +3737(Zscale)S +10 R +4044(option)S +4346(is)S +4459(enabled.)S +4870(Otherwise,)S +5351(if)S +5458(the)S +7008 V +10 I +1260(Zrange)S +10 R +1592(option)S +1891(is)S +2001(set)S +2155(the)S +2320(full)S +2502(data)S +2711(range)S +2974(will)S +3172(be)S +3308(used)S +3533(to)S +3653(scale)S +3894(the)S +4058(image.)S +4399(Lastly,)S +4716(is)S +4825(neither)S +10 I +5144(Zscale)S +10 R +5447(nor)S +7128 V +10 I +1260(Zrange)S +10 R +1579(are)S +1730(enabled,)S +2095(the)S +2247(z1/z2)S +2493(values)S +2778(may)S +2980(be)S +3104(set)S +3245(explicitly)S +3653(using)S +3900(the)S +4052(options)S +4377(box.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(16)S +7920 V +EP +%%Page: 17 18 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1260(Directory)S +1699(Browsing)S +1080 V +10 R +1510(The)S +1702(load)S +1911(panel)S +2165(contains)S +2536(a)S +2618(list)S +2779(of)S +2900(\256les)S +3105(in)S +3221(the)S +3381(current)S +3701(directory)S +4099(that)S +4287(may)S +4497(be)S +4629(selected)S +4988(for)S +5142(loading)S +5480(by)S +1200 V +1510(selecting)S +1901(with)S +2115(left)S +2284(mouse)S +2581(button.)S +2898(If)S +3000(the)S +3158(\256le)S +3322(is)S +3425(a)S +3504(directory)S +3899(the)S +4056(contents)S +4424(of)S +4542(the)S +4699(new)S +4900(directory)S +5295(will)S +5486(be)S +1320 V +1510(loaded,)S +1836(if)S +1932(it's)S +2095(a)S +2174(plain)S +2409(\256le)S +2572(an)S +2701(attempt)S +3036(will)S +3227(be)S +3356(made)S +3607(to)S +3720(load)S +3927(it)S +4018(as)S +4137(an)S +4267(image)S +4547(otherwise)S +4971(an)S +5101(error)S +5330(popup)S +1440 V +1510(will)S +1706(appear.)S +2065(Directories)S +2547(in)S +2664(the)S +2825(list)S +2987(are)S +3147(identi\256ed)S +3564(with)S +3781(a)S +3864(trailing)S +4192('/')S +4325(character,)S +4753(you)S +4942(will)S +5137(always)S +5453(see)S +1560 V +1510(any)S +1684(subdirectories)S +2274(listed)S +2521(even)S +2739(if)S +2830(a)S +2904(\256lter)S +3123(is)S +3220(speci\256ed.)S +1800 V +1510(The)S +10 I +1698(Root)S +10 R +1920(button)S +2209(will)S +2398(reset)S +2619(the)S +2774(current)S +3089(directory)S +3482(to)S +3593(the)S +3748(system)S +4059(root)S +4254(directory.)S +4673(The)S +10 I +4862(Home)S +10 R +5134(button)S +5424(will)S +1920 V +1510(reset)S +1730(the)S +1884(current)S +2198(directory)S +2590(to)S +2700(the)S +2854(user's)S +3124(login)S +3362(directory,)S +3779(the)S +10 I +3932(Up)S +10 R +4085(button)S +4372(moves)S +4664(up)S +4795(one)S +4970(directory)S +5361(level,)S +2040 V +1510(and)S +10 I +1688(Rescan)S +10 R +2010(reloads)S +2332(the)S +2488(\256le)S +2650(list)S +2807(by)S +2942(rescanning)S +3409(the)S +3566(directory.)S +3986(The)S +4176(current)S +4493(working)S +4861(directory)S +5256(is)S +5358(given)S +2160 V +1510(below)S +1784(the)S +1936(\256le)S +2094(selection)S +2479(window.)S +2400 V +1510(Selecting)S +1912(the)S +10 I +2064(List)S +2245(Image)S +2524(Headers)S +10 R +2892(option)S +3178(will)S +3364(change)S +3676(the)S +3828(display)S +4147(text)S +4328(to)S +4437(list)S +4591(all)S +4722(images)S +5036(in)S +5145(the)S +5298(current)S +2520 V +1510(directory)S +1913(which)S +2200(match)S +2486(the)S +2650(\256lename)S +3036(\256lter.)S +3322(Directory)S +3746(browsing)S +4160(is)S +4269(disabled)S +4644(while)S +4908(this)S +5095(option)S +5393(is)S +5502(in)S +2640 V +1510(e)S +1554 H + (f)show 10 -.5 mul h (f)show +10 R +1615(ect.)S +2808 V +10 B +1260(File)S +1451(Patterns)S +2928 V +10 R +1510(By)S +1661(default)S +1972(all)S +2106(\256les)S +2307(and)S +2486(directories)S +2942(will)S +3133(be)S +3262(listed.)S +3539(You)S +3746(may)S +3953(specify)S +4276(a)S +4355(\256lter)S +4579(to)S +4692(select)S +4954(only)S +5167(those)S +5413(\256les)S +3048 V +1510(with)S +1721(a)S +1798(given)S +2053(extension)S +2469(such)S +2685(as)S +2801(")S +10 Y +2842(*)S +10 R +2892(.\256ts")S +3113(using)S +3362(the)S +10 I +3516(Filter)S +10 R +3776(text)S +3958(box.)S +4195(Directories)S +4670(will)S +4858(always)S +5167(be)S +5293(seen)S +5502(in)S +3168 V +1510(the)S +1662(list)S +1815(and)S +1989(are)S +2140(identi\256ed)S +2548(with)S +2756(a)S +2830(trailing)S +3149('/')S +3273(character.)S +3692(Any)S +3894(valid)S +4124(unix)S +4332(pattern)S +4639(matching)S +5041(string)S +5299(will)S +5486(be)S +3288 V +1510(recognized,)S +2006(multiple)S +2374(templates)S +2791(may)S +2997(be)S +3125(speci\256ed)S +3514(in)S +3626(a)S +3704(comma-delimited)S +4443(list)S +4600(such)S +4817(as)S +4933(")S +10 Y +4974(*)S +10 R +5024(.imh,)S +10 Y +5230(*)S +10 R +5280(.\256ts")S +5502(to)S +3408 V +1510(list)S +1663(both)S +1871(OIF)S +2062(and)S +2236(FITS)S +2472(images.)S +3576 V +10 B +1260(Direct)S +1555(File)S +1746(Load)S +3696 V +10 R +1510(If)S +1608(you)S +1791(know)S +2046(exactly)S +2367(which)S +2644(\256le)S +2805(you)S +2988(wish)S +3210(to)S +3321(load,)S +3551(you)S +3734(may)S +3939(enter)S +4171(its)S +4299(name)S +4548(in)S +4659(the)S +10 I +4814(Load)S +5053(File)S +10 R +5247(text)S +5430(box)S +3816 V +1510(and)S +1688(either)S +1949(hit)S +2089(<cr>)S +2312(or)S +2429(the)S +2585(Load)S +2824(button)S +3114(to)S +3226(load)S +3432(it.)S +3577(An)S +3733(absolute)S +4099(or)S +4215(relative)S +4547(path)S +4752(name)S +5001(may)S +5206(be)S +5333(given,)S +3936 V +1510(if)S +1601(a)S +1675(simple)S +1972(\256lename)S +2346(is)S +2443(speci\256ed)S +2828(it)S +2914(will)S +3100(be)S +3224(searched)S +3602(for)S +3748(in)S +3856(the)S +4008(current)S +4320(working)S +4683(directory.)S +4104 V +10 B +1260(Frame)S +1572(Selections)S +4224 V +10 R +1510(By)S +1666(default)S +1982(images)S +2304(will)S +2499(be)S +2632(loaded)S +2937(into)S +3132(the)S +3293(current)S +3614(frame,)S +3910(you)S +4100(may)S +4312(choose)S +4629(a)S +4713(di)S +4791 H + (f)show 10 -.5 mul h (f)show +10 R +4852(erent)S +5091(frame)S +5363(using)S +4344 V +1510(the)S +1662(Frame)S +1947(menu)S +2199(button)S +2485(to)S +2593(select)S +2850(from)S +3074(the)S +3226(available)S +3616(frames.)S +4632 V +9 B +900(SAVE)S +1167(PANEL)S +4752 V +10 R +1260(The)S +1445(Save)S +1669(Panel)S +1921(lets)S +2090(you)S +2270(save)S +2477(the)S +2629(current)S +2941(contents)S +3304(of)S +3418(the)S +3571(main)S +3802(display)S +4122(window)S +4475(to)S +4584(a)S +4659(disk)S +4857(\256le)S +5016(\(including)S +5458(the)S +4872 V +1260(Panner/Coords)S +1886(markers,)S +2264(or)S +2379(overlay)S +2710(graphics)S +3079(displayed)S +3493(by)S +3624(the)S +3777(client)S +4030(program\).)S +4457(Presently,)S +4885(only)S +5094(the)S +5247(contents)S +4992 V +1260(of)S +1377(the)S +1533(main)S +1767(display)S +2090(window)S +2446(may)S +2652(be)S +2780(saved,)S +3066(there)S +3299(is)S +3400(no)S +3534(facility)S +3851(for)S +4001(saving)S +4297(the)S +4454(undisplayed)S +4972(contents)S +5340(of)S +5458(the)S +5112 V +1260(entire)S +1527(frame)S +1799(bu)S +1899 H + (f)show 10 -.5 mul h (f)show +10 R +1960(er)S +2077(other)S +2322(than)S +2534(to)S +2651(enable)S +2950(the)S +3111(autoscale)S +3521(feature)S +3836(or)S +3958(zoom)S +4219(out)S +4386(so)S +4514(the)S +4675(whole)S +4958(bu)S +5058 H + (f)show 10 -.5 mul h (f)show +10 R +5119(er)S +5235(is)S +5341(in)S +5458(the)S +5232 V +1260(display)S +1582(window.)S +1992(A)S +2097(limited)S +2414(number)S +2752(of)S +2868(formats)S +3206(are)S +3360(currently)S +3753(available,)S +4171(others)S +4448(will)S +4637(be)S +4764(added)S +5036(in)S +5148(future)S +5420(ver-)S +5352 V +1260(sions.)S +5520 V +10 B +1260(File)S +1451(Name)S +10 R +2010(The)S +2205(File)S +2401(Name)S +2680(text)S +2871(box)S +3062(allows)S +3364(you)S +3555(to)S +3674(enter)S +3914(the)S +4077(\256le)S +4246(name)S +4503(of)S +4627(the)S +4790(saved)S +5058(\256le.)S +5252(A)S +5365("%d")S +5640 V +2010(anywhere)S +2429(in)S +2539(the)S +2693(name)S +2941(will)S +3129(be)S +3255(replaced)S +3624(by)S +3756(a)S +3831(sequence)S +4227(number)S +4563(allowing)S +4944(multiple)S +5309(frames)S +5760 V +2010(to)S +2118(be)S +2242(saved)S +2499(with)S +2707(unique)S +3009(names.)S +5928 V +10 B +1260(Format)S +10 R +2010(The)S +2203(Format)S +2530(box)S +2718(allows)S +3017(you)S +3205(to)S +3321(choose)S +3636(the)S +3796(format)S +4100(of)S +4221(the)S +4381(image)S +4663(to)S +4779(be)S +4911(created)S +5237(however)S +6048 V +2010(not)S +2187(all)S +2336(formats)S +2690(are)S +2860(currently)S +3269(implemented.)S +3895(The)S +4099(EPS)S +4321(format)S +4636(is)S +4752(similar)S +5078(to)S +5204(the)S +10 I +5374(Print)S +6168 V +10 R +2010(option)S +2296(however)S +2669(there)S +2898(is)S +2995(no)S +3125(annotation.)S +6336 V +10 B +1260(Color)S +10 R +2010(The)S +2201(Color)S +2465(box)S +2651(lets)S +2827(you)S +3014(choose)S +3328(the)S +3487(color)S +3729(type)S +3938(of)S +4058(the)S +4217(image)S +4498(to)S +4613(be)S +4744(created.)S +5093(The)S +5285(options)S +6456 V +2010(will)S +2198(change)S +2512(depending)S +2960(on)S +3092(the)S +3246(format,)S +3569(e.g.)S +3745(FITS)S +3983(doesn't)S +4309(allow)S +4562(color)S +4798(so)S +4918(no)S +5049(color)S +5285(options)S +6576 V +2010(will)S +2203(be)S +2334(enabled.)S +2736(Formats)S +3101(which)S +3382(allow)S +3641(24-bit)S +3917(images)S +4237(will)S +4430(be)S +4562(written)S +4883(using)S +5138(the)S +5298(current)S +6696 V +2010(colormap)S +2427(after)S +2649(converting)S +3116(to)S +3234(a)S +3317(24-bit)S +3595(image,)S +3903(pseudocolor)S +4430(images)S +4752(will)S +4947(be)S +5080(written)S +5402(with)S +6816 V +2010(the)S +2162(current)S +2474(colormap.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(17)S +7920 V +EP +%%Page: 18 19 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +900(PRINT)S +1207(PANEL)S +1080 V +10 R +1260(The)S +1449(Print)S +1678(Panel)S +1934(allows)S +2229(you)S +2413(dump)S +2675(the)S +2831(contents)S +3198(of)S +3315(the)S +3471(main)S +3706(display)S +4030(window)S +4387(as)S +4505(Encapsulated)S +5072(Postscript)S +5502(to)S +1200 V +1260(either)S +1526(a)S +1608(named)S +1912(printer)S +2216(device)S +2514(or)S +2635(to)S +2751(a)S +2833(disk)S +3038(\256le.)S +3259(The)S +10 I +3452(Print)S +3696(To)S +10 R +3840(selects)S +4144(the)S +4304(type)S +4514(of)S +4635(output,)S +4954(the)S +10 I +5114(Print)S +5358(Com-)S +1320 V +1260(mand)S +10 R +1513(box)S +1694(will)S +1881(adjust)S +2151(accordingly,)S +2678(either)S +2936(as)S +3050(a)S +3125(Unix)S +3356(printer)S +3653(command)S +4078(or)S +4192(as)S +4306(a)S +4381(\256le)S +4540(name.)S +4842(A)S +4946("%d")S +5193(anywhere)S +1440 V +1260(in)S +1372(the)S +1528(name)S +1778(for)S +1928(disk)S +2129(output)S +2419(will)S +2609(be)S +2737(replaced)S +3108(by)S +3242(a)S +3320(sequence)S +3719(number)S +4058(allowing)S +4442(multiple)S +4810(frames)S +5115(to)S +5226(be)S +5353(saved)S +1560 V +1260(with)S +1469(unique)S +1772(names.)S +2083(Selecting)S +2486(printers)S +2822(from)S +3047(the)S +3200(installed)S +3570(list)S +3724(will)S +3911(automatically)S +4486(change)S +4799(the)S +4952(command)S +5377(to)S +5486(be)S +1680 V +1260(used)S +1474(to)S +1583(generate)S +1951(the)S +2104(output.)S +2416(This)S +2625(command)S +3049(does)S +3262(not)S +3420(necessarily)S +3893(need)S +4111(to)S +4219(be)S +4343(a)S +4417(printer)S +4713(command,)S +5162(the)S +5314(printer)S +1800 V +1260(con\256guration)S +1823(\256le)S +1981(lets)S +2150(you)S +2330(de\256ne)S +2604(any)S +2778(command)S +3202(string)S +3460(to)S +3568(process)S +3897(the)S +4049(image.)S +2088 V +9 B +1080(COLOR)S +1437(OPTIONS)S +2208 V +10 R +1260(The)S +1469(Color)S +1751(box)S +1955(lets)S +2148(you)S +2352(choose)S +2683(the)S +2859(color)S +3118(type)S +3344(of)S +3481(the)S +3657(image)S +3955(to)S +4087(be)S +4235(created.)S +4631(PseudoColor)S +5203(or)S +5341(24-bit)S +2328 V +1260(postscript)S +1679(will)S +1865(be)S +1989(created)S +2306(using)S +2553(the)S +2705(current)S +3017(colormap)S +3424(and)S +3598(enhancements.)S +2616 V +9 B +1080(POSTSCRIPT)S +1672(OPTIONS)S +2736 V +10 B +1260(Orientation)S +10 R +2010(Set)S +2168(the)S +2320(page)S +2538(orientation.)S +2964 V +10 B +1260(Paper)S +1545(Size)S +10 R +2010(Select)S +2284(the)S +2436(paper)S +2687(size)S +2872(to)S +2980(be)S +3104(used.)S +3192 V +10 B +1260(Image)S +1556(Scale)S +10 R +2010(Set)S +2168(the)S +2320(scale)S +2549(factor)S +2812(used)S +3026(to)S +3135(compute)S +3510(the)S +3663(\256nal)S +3872(image)S +4147(size.)S +4388(No)S +4541(checking)S +4932(is)S +5030(done)S +5255(to)S +5364(make)S +3312 V +2010(sure)S +2206(the)S +2358(image)S +2632(will)S +2818(\256t)S +2932(correctly)S +3316(on)S +3446(the)S +3598(page.)S +3600 V +9 B +1080(PROCESSING)S +1692(OPTIONS)S +3720 V +10 B +1260(Auto)S +1501(Scale)S +3840 V +10 R +1510(Toggles)S +1865(whether)S +2219(or)S +2335(not)S +2496(the)S +2651(image)S +2928(is)S +3028(automatically)S +3605(scaled)S +3887(to)S +3998(\256t)S +4116(the)S +4272(page.)S +4549(If)S +4649(not)S +4811(enabled,)S +5180(the)S +5336(image)S +3960 V +1510(scale)S +1744(will)S +1935(be)S +2064(used)S +2282(to)S +2395(determine)S +2829(the)S +2986(output)S +3277(image)S +3556(size,)S +3771(otherwise)S +4194(the)S +4351(image)S +4629(will)S +4819(be)S +4947(scaled)S +5230(down)S +5486(\(if)S +4080 V +1510(necessary\))S +1960(to)S +2068(\256t)S +2182(on)S +2312(the)S +2464(page.)S +4248 V +10 B +1260(Auto)S +1501(Rotate)S +4368 V +10 R +1510(Determines)S +2005(whether)S +2361(or)S +2479(not)S +2642(the)S +2800(image)S +3080(will)S +3272(be)S +3402(rotated)S +3715(to)S +3829(\256t)S +3949(on)S +4085(the)S +4243(page.)S +4492(When)S +4766(set,)S +4938(an)S +5068(image)S +5348(larger)S +4488 V +1510(than)S +1717(the)S +1874(current)S +2191(orientation)S +2659(will)S +2850(be)S +2979(rotated)S +3291(and)S +3470(possibly)S +3839(scaled)S +4123(to)S +4236(\256t)S +4355(the)S +4511(page,)S +4758(otherwise)S +5180(the)S +5336(image)S +4608 V +1510(may)S +1712(be)S +1836(scaled)S +2115(so)S +2234(that)S +2414(it)S +2500(\256ts)S +2653(in)S +2761(the)S +2913(current)S +3225(orientation.)S +4776 V +10 B +1260(Max)S +1484(Aspect)S +4896 V +10 R +1510(Automatically)S +2112(increases)S +2507(the)S +2659(scale)S +2888(so)S +3007(the)S +3159(image)S +3433(\256lls)S +3614(the)S +3766(page)S +3984(in)S +4092(the)S +4244(current)S +4556(orientation.)S +5064 V +10 B +1260(Annotate)S +5184 V +10 R +1510(The)S +1696(annotate)S +2065(option)S +2352(toggles)S +2672(whether)S +3024(or)S +3138(not)S +3297(the)S +3450(\256nal)S +3660(\256le)S +3820(includes)S +4185(annotation)S +4639(such)S +4854(as)S +4969(the)S +5123(image)S +5399(title,)S +5304 V +1510(a)S +1584(colorbar,)S +1971(and)S +2145(axis)S +2336(labels.)S +2654(There)S +2916(is)S +3013(currently)S +3403(no)S +3533(option)S +3819(for)S +3965(partial)S +4250(annotation.)S +5592 V +9 B +1080(ANNOTATION)S +1727(OPTIONS)S +5712 V +10 B +1260(Annotate)S +5832 V +10 R +1510(Selects)S +1831(whether)S +2190(Postscript)S +2623(image)S +2905(is)S +3010(to)S +3126(be)S +3258(annotated.)S +10 B +3739(Title)S +10 R +3977(Annotate)S +4381(with)S +4597(a)S +4679(title)S +4873(on)S +5011(the)S +5171(top)S +5337(of)S +5458(the)S +5952 V +1510(image.)S +10 B +1850(Borders)S +10 R +2235(Annotate)S +2642(with)S +2860(borders)S +3199(surrounding)S +3722(the)S +3884(image)S +4168(giving)S +4464(image)S +4748(coordinates.)S +10 B +5303(Color-)S +6072 V +1510(bar)S +10 R +1692(Annotate)S +2090(with)S +2300(colorbar)S +2664(at)S +2768(the)S +2922(bottom)S +3238(of)S +3353(the)S +3507(image)S +10 B +3783(Title)S +4015(String)S +10 R +4315(Title)S +4537(string)S +4798(to)S +4909(use)S +5075(when)S +10 I +5324(title)S +10 R +5513(is)S +6192 V +1510(selected.)S +1920(The)S +2108(special)S +2418(value)S +10 I +2667(imtitle)S +10 R +2956(will)S +3145(force)S +3382(the)S +3537(title)S +3726(to)S +3837(be)S +3964(the)S +4119(currently)S +4512(displayed)S +4928(image)S +5205(title,)S +5419(oth-)S +6312 V +1510(erwise)S +1800(it)S +1886(will)S +2072(be)S +2196(this)S +2371(user-selected)S +2921(\256eld.)S +6600 V +9 B +1080(PRINTER)S +1512(SELECTION)S +6720 V +10 R +1260(The)S +1487(printer)S +1825(selection)S +2252(list)S +2447(lets)S +2658(choose)S +3007(the)S +3201(printer)S +3540(to)S +3691(be)S +3858(used.)S +4139(The)S +4367(printer)S +4706(con\256guration)S +5312(\256le)S +5513(is)S +6840 V +1260(/usr/local/lib/ximprint.cfg)S +2342(by)S +2493(default)S +2821(or)S +2954(may)S +3176(be)S +3320(reset)S +3558(using)S +3825(the)S +10 I +3997(-printCon\256g)S +10 R +4542(command)S +4986(line)S +5186(switch)S +5497(or)S +6960 V +10 I +1260(printCon\256g)S +10 R +1752(resource.)S +2144(The)S +2329(format)S +2625(of)S +2738(the)S +2890(\256le)S +3048(is)S +3145(simply)S +7200 V +10 I +1950(name\\tcommand)S +7680 V +10 R +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(18)S +7920 V +EP +%%Page: 19 20 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(The)S +10 I +1450(name)S +10 R +1701(value)S +1952(is)S +2054(what)S +2284(appears)S +2624(in)S +2738(the)S +2896(selection)S +3287(list)S +3446(and)S +3626(may)S +3834(be)S +3964(more)S +4205(than)S +4413(a)S +4493(single)S +4768(word,)S +5034(the)S +10 I +5192(command)S +1080 V +10 R +1260(can)S +1432(be)S +1560(any)S +1738(command)S +2166(that)S +2350(accepts)S +2677(EPS)S +2884(input)S +3124(from)S +3352(a)S +3429(pipe,)S +3659(the)S +3814(two)S +3997(\256elds)S +4247(must)S +4475(be)S +4602(separated)S +5011(by)S +5144(a)S +5221(tab)S +5376(char-)S +1200 V +1260(acter.)S +1538(Normally)S +1951(the)S +2103(command)S +2527(will)S +2713(be)S +2837(a)S +2912(simple)S +10 I +3210(lpr)S +3358(-Pfoo)S +10 R +3611(or)S +3725(some)S +3967(such,)S +4206(but)S +4365(can)S +4534(also)S +4726(include)S +5051(converters)S +5497(or)S +1320 V +1260(previewers.)S +1752(At)S +1882(most)S +2107(128)S +2287(printer)S +2583(commands)S +3046(may)S +3248(be)S +3372(used.)S +1608 V +9 B +900(INFO)S +1152(PANEL)S +1728 V +10 R +1260(The)S +1449(Info)S +1649(panel)S +1899(was)S +2088(revised)S +2410(to)S +2522(provide)S +2861(a)S +2939(greater)S +3249(variety)S +3560(of)S +3677(status)S +3939(information.)S +4500(The)S +4689(type)S +4895(of)S +5012(output)S +5302(is)S +5403(con-)S +1848 V +1260(trolled)S +1560(by)S +1699(the)S +1860(toggle)S +2149(buttons)S +2483(on)S +2622(the)S +2783(bottom)S +3106(of)S +3228(the)S +3389(frame,)S +3685(however)S +4066(all)S +4204(output)S +4498(is)S +4603(kept)S +4813(current)S +5133(as)S +5254(the)S +5414(pro-)S +1968 V +1260(gram)S +1495(runs.)S +1752(Current)S +2087(info)S +2278(options)S +2603(include:)S +2136 V +10 B +1620(Frame)S +10 R +2370(Info)S +2566(about)S +2818(the)S +2970(current)S +3282(display)S +3601(frame.)S +2304 V +10 B +1620(Server)S +10 R +2370(Info)S +2584(about)S +2854(various)S +3197(server)S +3489(options,)S +3858(e.g.)S +4051(colormaps,)S +4541(memory)S +4923(model,)S +5247(antialias)S +2424 V +2370(type,)S +2597(etc.)S +2592 V +10 B +1620(Clients)S +10 R +2370(Show)S +2650(currently)S +3062(connected)S +3518(clients.)S +3886(Lists)S +4133(available)S +4545(connection)S +5035(channels)S +5436(and)S +2712 V +2370(active)S +2638(ISM)S +2846(clients.)S +2880 V +10 B +1620(WCS)S +10 R +2370(List)S +2556(all)S +2686(WCS)S +2933(and)S +3107(mappings)S +3526(for)S +3672(the)S +3824(current)S +4136(frame.)S +3048 V +10 B +1620(ISM)S +10 R +2370(Log)S +2561(of)S +2674(various)S +2998(ISM)S +3206(status)S +3464(messages.)S +3216 V +10 B +1620(Imtoolrc)S +10 R +2370(Show)S +2628(current)S +2940(frame)S +3202(bu)S +3302 H + (f)show 10 -.5 mul h (f)show +10 R +3363(er)S +3470(con\256guration)S +4033(table.)S +3504 V +9 B +900(TILE)S +1142(PANEL)S +1474(\(NEW\))S +3624 V +10 R +1260(With)S +1493(the)S +1648(additional)S +2081(frames,)S +2410(the)S +2565(default)S +2875(tiling)S +3120(scheme)S +3452(proved)S +3762(inadequate.)S +4282(A)S +4387(new)S +4586(control)S +4903(panel)S +5153(Tile)S +5348(frame)S +3744 V +1260(now)S +1471(allows)S +1771(you)S +1960(to)S +2077(select)S +2343(from)S +2576(a)S +2659(number)S +3003(of)S +3125(tile)S +3292(con\256gurations,)S +3928(the)S +4089(list)S +4251(of)S +4373(frames)S +4682(to)S +4798(be)S +4930(tiled,)S +5171(a)S +10 I +5253(\256ll)S +5397(style)S +3864 V +10 R +1260(\(left-to-right)S +1794(or)S +1912(top-to-bottom\),)S +2561(as)S +2679(well)S +2886(as)S +3004(optional)S +3367(labels)S +3635(for)S +3786(each)S +4003(of)S +4121(the)S +4278(tiles)S +4480(\(frame)S +4780(number,)S +5145(image)S +5424(title)S +3984 V +1260(or)S +1373(image)S +1647(name\).)S +4224 V +1260(Tile)S +1452(con\256guration)S +2016(will)S +2204(make)S +2452(use)S +2617(of)S +2732(all)S +2864(frames)S +3167(currently)S +3559(selected)S +3912(in)S +4022(the)S +10 I +4176(Tile)S +4364(Frame)S +10 R +4662(group)S +4927(in)S +5037(the)S +5191(following)S +4344 V +1260(manner:)S +4512 V +10 B +1620(Disabled)S +10 R +2370(Do)S +2522(not)S +2680(tile)S +2838(the)S +2990(display.)S +4680 V +10 B +1620(Manual)S +10 R +2370(Tile)S +2561(according)S +2984(to)S +10 I +3092(Manual)S +3433(Con\256guration)S +10 R +4025(settings.)S +4848 V +10 B +1620(Best)S +10 R +2370(Optimize)S +2772(layout)S +3052(for)S +3198(frame)S +3460(bu)S +3560 H + (f)show 10 -.5 mul h (f)show +10 R +3621(er)S +3728(aspect.)S +5016 V +10 B +1620(Square)S +10 R +2370(Always)S +2705(force)S +2939(a)S +3013(square)S +3303(layout)S +3583(\(2x2,)S +3821(3x3,)S +4026(etc\).)S +5184 V +10 B +1620(Horizontal)S +10 R +2370(Preferentially)S +2943(tile)S +3101(horizontally)S +3614(\(6)S +3727(frames)S +4028(==>)S +4226(3x2\).)S +5352 V +10 B +1620(Vertical)S +10 R +2370(Preferentially)S +2943(tile)S +3101(vertically)S +3508(\(6)S +3621(frames)S +3922(==>)S +4120(2x3\).)S +5520 V +10 B +1620(One)S +1828(Row)S +10 R +2370(Tile)S +2561(all)S +2691(in)S +2799(one)S +2973(row)S +3158(\(Nx1\).)S +5688 V +10 B +1620(One)S +1828(Column)S +10 R +2370(Tile)S +2561(all)S +2691(in)S +2799(one)S +2973(column)S +3303(\(1xN\).)S +5976 V +9 B +900(COORDS)S +1312(PANEL)S +1644(\(NEW\))S +6096 V +10 R +1260(The)S +1452(Coords)S +1778(Panel)S +2037(is)S +2141(meant)S +2422(to)S +2537(provide)S +2879(a)S +2960(full-featured)S +3495(readout)S +3831(as)S +3951(well)S +4160(as)S +4280(serve)S +4527(as)S +4647(a)S +4729(control)S +5050(panel)S +5304(for)S +5458(the)S +6216 V +1260(various)S +1586(options.)S +1968(The)S +2155(display)S +2475(window)S +2828(contains)S +3192(the)S +3345(image)S +3620(name/title)S +4051(and)S +4226(frame)S +4489(bu)S +4589 H + (f)show 10 -.5 mul h (f)show +10 R +4650(er)S +4758(info,)S +4975(and)S +5150(a)S +5225(selection)S +6336 V +1260(of)S +1373(coordinate)S +1824(and)S +1998(image)S +2272(pixel)S +2502(readouts.)S +2925(The)S +3110(intent)S +3368(is)S +3466(provide)S +3802(more)S +4038(infor-)S +4296(mation)S +4605(than)S +4808(can)S +4977(\256t)S +5092(comfortably)S +6456 V +1260(on)S +1409(the)S +1580(main)S +1829(image)S +2122(window)S +2493(while)S +2764(still)S +2964(taking)S +3263(up)S +3412(as)S +3544(little)S +3777(screen)S +4080(space)S +4350(as)S +4482(possible.)S +4914(To)S +5073(this)S +5266(end)S +5458(the)S +6576 V +1260("Options")S +1692(button)S +1981(is)S +2081(used)S +2297(to)S +2408(hide)S +2613(most)S +2841(of)S +2957(the)S +3112(feature)S +3421(controls)S +3776(when)S +4025(not)S +4186(in)S +4297(use)S +4464(\(see)S +4658(below\).)S +5024(Other)S +5285(options)S +6696 V +1260(on)S +1390(the)S +1542(main)S +1772(panel)S +2018(include:)S +6984 V +10 B +1620(WCS/Pix)S +10 R +2370(Toggle)S +2683(the)S +2835(real-time)S +3225(WCS/pixel)S +3700(readout)S +4030(capability)S +4455(\(i.e.)S +4641(the)S +4794(ISM)S +5003(used)S +5217(to)S +5326(access)S +7104 V +2370(the)S +2522(disk)S +2719(image\).)S +3081(This)S +3289(must)S +3514(be)S +3638(enabled)S +3978(for)S +4124(certain)S +4425(other)S +4660(options)S +4985(to)S +5093(work.)S +7272 V +10 B +1620(Pix)S +1789(Table)S +10 R +2370(Open)S +2632(a)S +2722(panel)S +2984(showing)S +3369(an)S +3509(image)S +3800(pixel)S +4047(table.)S +4343(The)S +4545(panel)S +4808(shows)S +5105(an)S +5246(array)S +5497(of)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(19)S +7920 V +EP +%%Page: 20 21 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +2370(pixels)S +2640(surrounding)S +3154(the)S +3307(cursor)S +3587(position,)S +3966(either)S +4224(the)S +4376(actual)S +4644(pixel)S +4874(values)S +5159(if)S +5250(the)S +5402(ISM)S +1080 V +2370(is)S +2476(enabled,)S +2850(or)S +2972(scaled)S +3260(display)S +3588(values)S +3882(otherwise.)S +4365(The)S +4560(size)S +4755(of)S +4878(the)S +5040(table)S +5274(may)S +5486(be)S +1200 V +2370(selected)S +2721(from)S +2945(the)S +3097(menubar.)S +1368 V +10 B +1620(Header)S +10 R +2370(Display)S +2734(the)S +2909(current)S +3244(image)S +3541(header)S +3859(in)S +3990(a)S +4087(new)S +4306(panel.)S +4630(Both)S +4879(the)S +5055(entire)S +5336(image)S +1488 V +2370(header)S +2697(as)S +2842(well)S +3076(as)S +3221(WCS-speci\256c)S +3838(parts)S +4094(of)S +4239(the)S +4423(header)S +4750(are)S +4932(available)S +5353(under)S +1608 V +2370(di)S +2448 H + (f)show 10 -.5 mul h (f)show +10 R +2509(erent)S +2738(tabs.)S +2984(This)S +3192(option)S +3478(is)S +3575(only)S +3783(active)S +4051(when)S +4297(the)S +4449(ISM)S +4657(is)S +4754(enabled.)S +1776 V +10 B +1620(Compass)S +10 R +2370(Draw)S +2621(an)S +2745(orientation)S +3208(compass)S +3582(on)S +3712(the)S +3864(display)S +4183(panner.)S +4539(If)S +4635(the)S +4788(ISM)S +4997(is)S +5095(enabled)S +5436(and)S +1896 V +2370(a)S +2456(WCS)S +2714(is)S +2822(present)S +3151(in)S +3270(the)S +3433(header,)S +3764(the)S +3927(compass)S +4312(will)S +4509(indicate)S +4866(N/E)S +5068(according)S +5502(to)S +2016 V +2370(the)S +2522(WCS,)S +2794(otherwise)S +3212(the)S +3364(X/Y)S +3566(axes)S +3773(of)S +3886(the)S +4038(image)S +4312(are)S +4463(drawn.)S +2184 V +10 B +1620(Options)S +10 R +2370(Pop-up/down)S +2967(the)S +3147(option)S +3461(control)S +3802(portion)S +4149(of)S +4290(the)S +4470(panel.)S +4769(When)S +5065(enabled,)S +5458(the)S +2304 V +2370(Coords)S +2706(Panel)S +2975(will)S +3178(change)S +3507(size)S +3709(to)S +3834(reveal)S +4124(the)S +4293(options)S +4634(which)S +4924(can)S +5108(be)S +5248(changed)S +2424 V +2370(\(explained)S +2821(below\).)S +2712 V +1260(The)S +1457("Readout)S +1873(Values")S +2233(group)S +2508(controls)S +2872(the)S +3036(selection)S +3433(of)S +3558(WCS)S +3817(type,)S +4056(location)S +4420(and)S +4606(format)S +4914(to)S +5035(be)S +5172(displayed.)S +2832 V +1260(The)S +1455("Type")S +1782(menu)S +2044(always)S +2361(provides)S +2745(a)S +2829(selection)S +3224(of)S +3347(the)S +3509(image)S +3792(Logical,)S +4161(Physical)S +4539(or)S +4661(World)S +4955(systems,)S +5336(which)S +2952 V +1260(may)S +1472(be)S +1606(identical)S +1990(depending)S +2446(on)S +2586(the)S +2748(image)S +3032(header.)S +3392(If)S +3498(a)S +3582(World)S +3878(system)S +4197(is)S +4305(supplied)S +4685(in)S +4804(the)S +4967(image)S +5252(addition)S +3072 V +1260(entries)S +1573(for)S +1736(transformations)S +2410(to)S +2535(other)S +2787(sky)S +2973(systems,)S +3362(\(e.g.)S +3616(FK5)S +3841(to)S +3966(ICRS)S +4236(or)S +4366(galactic/ecliptic\))S +5077(will)S +5279(also)S +5486(be)S +3192 V +1260(available.)S +1706(The)S +1892(selection)S +2278(is)S +2376(dependent)S +2817(on)S +2948(whether)S +3300(the)S +3453(ISM)S +3663(is)S +3762(running)S +4105(as)S +4220(well)S +4424(as)S +4539(WCS)S +4788(information)S +5292(present)S +3312 V +1260(in)S +1369(the)S +1522(image.)S +1852(The)S +2038("Format")S +2440(menu)S +2693(allows)S +2985(the)S +3138(use)S +3302(to)S +3410(select)S +3667(a)S +3741(sexigesimal)S +4243(display,)S +4587(conversion)S +5055(to)S +5163(degrees)S +5497(or)S +3432 V +1260(radians,)S +1604(or)S +1718(whichever)S +2164(format)S +2461(is)S +2559(most)S +2785(natural)S +3093(for)S +3240(the)S +3393(coordinate)S +3846(being)S +4100(display.)S +4476(The)S +4663(two)S +4845(toggle)S +5127(to)S +5237(the)S +5391(right)S +3552 V +1260(control)S +1577(whether)S +1932(this)S +2111(WCS)S +2362(is)S +2463(to)S +2575(be)S +2703(displayed)S +3120(on)S +3254(the)S +3410(Panel)S +3666(\(i.e.)S +3855(the)S +4011(Coords)S +4333(Panel)S +4588(window\))S +4976(or)S +5092(the)S +5247(ImgWin)S +3672 V +1260(\(i.e.)S +1475(the)S +1627(text)S +1807(marker)S +2119(on)S +2249(the)S +2401(main)S +2631(image)S +2905(window\).)S +3912 V +1260(Other)S +1524(options)S +1856(below)S +2138(this)S +2321(group)S +2592(control)S +2913(whether)S +3272(or)S +3393(not)S +3559(to)S +3675(display)S +4002(the)S +4162(WCS)S +4417(labels,)S +4713(the)S +4873(image)S +5155(name/title,)S +4032 V +1260(and)S +1459(frame)S +1746(bu)S +1846 H + (f)show 10 -.5 mul h (f)show +10 R +1907(er)S +2039(information)S +2566(in)S +2699(the)S +2876(main)S +3131(Coords)S +3475(Panel)S +3751(display.)S +4149(The)S +4358("BPM)S +4665(Data")S +4948(option)S +5258(controls)S +4152 V +1260(whether)S +1613(or)S +1728(not)S +1888(the)S +2042(ISM)S +2252(will)S +2440(try)S +2583(to)S +2693(map)S +2897(any)S +3073(bad-pixel)S +3482(mask)S +3725(associated)S +4167(with)S +4377(the)S +4531(image.)S +4862(If)S +4960(enabled,)S +5327(a)S +5403(bad-)S +4272 V +1260(pixel)S +1497(mask)S +1745(speci\256ed)S +2137(by)S +2274(the)S +2433(image)S +2714(header)S +3016(BPM)S +3265(keyword)S +3651(\(currently)S +4081(\256xed)S +4317(by)S +4453(convention)S +4933(but)S +5097(this)S +5278(may)S +5486(be)S +4392 V +1260(selectable)S +1698(later\))S +1953(will)S +2154(be)S +2293(mapped)S +2654(along)S +2921(with)S +3144(the)S +3311(image.)S +3655(Aside)S +3933(from)S +4172(wcs/pixel)S +4601(readouts)S +4985(at)S +5103(each)S +5331(cursor)S +4512 V +1260(position,)S +1643(any)S +1822(BPM)S +2069(data)S +2270(values)S +2559(found)S +2826(will)S +3016(also)S +3211(be)S +3339(displayed.)S +3811(A)S +3917(non-zero)S +4305(value)S +4555(will)S +4745(cause)S +5000(the)S +5156(BPM)S +5402(\256eld)S +4632 V +1260(of)S +1384(the)S +1547(Coords)S +1877(Panel)S +2140(readout)S +2480(as)S +2604(well)S +2817(as)S +2941(the)S +3104(main)S +3345(image)S +3630(window)S +3993(marker)S +4316(to)S +4435(switch)S +4737(to)S +4856(a)S +4941(red)S +5109(background)S +4752 V +1260(color)S +1495(to)S +1603(\257ag)S +1783(the)S +1935(value.)S +4992 V +1260(The)S +1453(last)S +1630(box)S +1818(allows)S +2117(the)S +2277(user)S +2481(to)S +2597(specify)S +2923(a)S +3005(di)S +3083 H + (f)show 10 -.5 mul h (f)show +10 R +3144(erent)S +3381(ISM)S +3597(task)S +3796(to)S +3912(be)S +4044(executed)S +4436(or)S +4557(to)S +4673(reinitialize)S +5138(the)S +5298(current)S +5112 V +1260(one.)S +1497(In)S +1618(most)S +1851(cases)S +2098(this)S +2280(won't)S +2550(need)S +2775(to)S +2890(be)S +3021(changed,)S +3415(however)S +3795(a)S +3876(custom)S +4202(ISM)S +4417(could)S +4676(be)S +4807(started)S +5110(when)S +5363(using)S +5232 V +1260(special)S +1567(data)S +1763(formats.)S +2153(This)S +2361(command)S +2785(string)S +3043(can)S +3211(also)S +3402(be)S +3526(controlled)S +3961(by)S +4091(the)S +4243(application)S +4717("ism_task")S +5185(resource.)S +5520 V +9 B +900(TCLSHELL)S +5640 V +10 R +1260(The)S +10 I +1446(TclShell)S +10 R +1805(allows)S +2097(the)S +2250(user)S +2447(to)S +2556(type)S +2759(commands)S +3224(directly)S +3561(to)S +3671(the)S +3825(TCL)S +4046(interpreter,)S +4518(letting)S +4806(you)S +4988(send)S +5203(messages)S +5760 V +1260(to)S +1369(the)S +1522(object)S +1797(manager)S +2171(or)S +2284(execute)S +2618(speci\256c)S +2953(procedures)S +3420(in)S +3528(the)S +3680(TCL)S +3899(code)S +4117(that)S +4297(makes)S +4582(up)S +4712(the)S +4864(GUI.)S +5096(It)S +5187(is)S +5284(used)S +5497(as)S +5880 V +1260(a)S +1338(development)S +1888(or)S +2005(debugging)S +2461(tool)S +2651(for)S +2801(the)S +2957(GUI,)S +3193(but)S +3355(for)S +3505(an)S +3633(example)S +4005(of)S +4122(what)S +4350(it)S +4440(does,)S +4682(bring)S +4927(it)S +5017(up)S +5151(and)S +5329(type)S +5536(a)S +6000 V +1260(command)S +1684(such)S +1897(as)S +6240 V +10 I +1980(send)S +2193(\256leButton)S +2612(set)S +2753(background)S +3260(red)S +6648 V +9 B +900(COLORMAP)S +1462(SELECTION)S +6768 V +10 R +1260(By)S +1410(default)S +1721(XImtool)S +2094(will)S +2284(display)S +2607(images)S +2924(using)S +3175(either)S +3436(a)S +3514(grayscale)S +3924(colormap)S +4335(\(e.g.)S +4576(if)S +4671(loaded)S +4971(by)S +5105(a)S +5183(client\),)S +5497(or)S +6888 V +1260(a)S +1346(private)S +1665(colormap)S +2084(when)S +2342(loading)S +2684(an)S +2820(image)S +3106(from)S +3342(disk)S +3551(that)S +3743(contains)S +4118(a)S +4204(colormap.)S +4648(Each)S +4888(frame)S +5161(de\256nes)S +5485(its)S +7008 V +1260(own)S +1470(colormap)S +1885(so)S +2013(you)S +2202(can)S +2379(de\256ne)S +2662(di)S +2740 H + (f)show 10 -.5 mul h (f)show +10 R +2801(erent)S +3039(colormaps)S +3494(or)S +3616(enhancements)S +4220(for)S +4375(each)S +4596(frame,)S +4892(they)S +5103(will)S +5298(change)S +7128 V +1260(automatically)S +1834(as)S +1947(you)S +2127(cycle)S +2367(through)S +2708(the)S +2860(frames.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(20)S +7920 V +EP +%%Page: 21 22 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(BUILTIN)S +1487(COLORMAPS)S +1080 V +10 R +1260(Once)S +1501(loaded,)S +1823(the)S +1976(colormap)S +2384(may)S +2588(either)S +2847(be)S +2973(changed)S +3337(using)S +3586(the)S +3740(builtin)S +4034(colormap)S +4443(menu)S +4697(under)S +4956(the)S +5110(View)S +5358(menu)S +1200 V +1260(button)S +1559(on)S +1702(the)S +1867(main)S +2110(window,)S +2500(or)S +2625(from)S +2861(the)S +3025(Enhancement)S +3610(box)S +3802(on)S +3944(the)S +4108(control)S +4433(panel.)S +4716(XImtool)S +5097(has)S +5272(about)S +5536(a)S +1320 V +1260(dozen)S +1556(colormap)S +1991(options)S +2344(builtin,)S +2689(other)S +2952(user-de\256ned)S +3503(colormaps)S +3977(may)S +4208(optionally)S +4673(be)S +4826(loaded.)S +5206(It)S +5326(is)S +5452(not)S +1440 V +1260(presently)S +1656(possible)S +2014(to)S +2122(save)S +2329(colormaps)S +2775(for)S +2921(later)S +3128(use.)S +1728 V +9 B +1080(USER-DEFINED)S +1782(COLORMAPS)S +1848 V +10 R +1260(The)S +10 I +1454(cmap[12])S +10 R +1887(and)S +10 I +2070(cmapDir[12])S +10 R +2642(resources)S +3057(\(or)S +3212(command)S +3645(line)S +3834(arguments\))S +4322(are)S +4482(used)S +4705(to)S +4823(tell)S +4991(which)S +5275(speci\256c)S +1968 V +1260(colormaps)S +1719(to)S +1840(make)S +2099(available)S +2502(or)S +2628(where)S +2914(to)S +3035(look)S +3256(for)S +3415(colortables)S +3895(respectively.)S +4474(The)S +4671(colortables)S +5151(are)S +5314(loaded)S +2088 V +1260(when)S +1519(ximtool)S +1874(starts)S +2128(up,)S +2296(or)S +2422(when)S +2681(it)S +2780(is)S +2890(reinitialized)S +3410(\(e.g.)S +3630(by)S +3773(pressing)S +4149(the)S +4314(Initialize)S +4712(button)S +5011(in)S +5132(the)S +5297(control)S +2208 V +1260(panel\).)S +1598(XImtool)S +1971(will)S +2161(ignore)S +2450(any)S +2628(\256les)S +2829(in)S +2941(the)S +3097(colormap)S +3508(directory)S +3901(which)S +4178(do)S +4311(not)S +4472(look)S +4683(like)S +4866(colortables.)S +5392(New)S +2328 V +1260(colortables)S +1728(will)S +1914(also)S +2105(be)S +2229(added)S +2497(automatically)S +3071(for)S +3217(each)S +3429(image)S +3703(loaded)S +3999(from)S +4223(disk.)S +2568 V +1260(The)S +1451(format)S +1753(of)S +1872(a)S +1952(user)S +2154(lookup)S +2468(table)S +2698(is)S +2801(very)S +3015(simple:)S +3347(each)S +3566(row)S +3758(de\256nes)S +4078(one)S +4259(colortable)S +4695(entry,)S +4962(and)S +5143(consists)S +5497(of)S +2688 V +1260(three)S +1489(columns)S +1858(de\256ning)S +2216(the)S +2368(red,)S +2550(green,)S +2826(and)S +3000(blue)S +3202(values)S +3487(scaled)S +3766(to)S +3874(the)S +4026(range)S +4277(0.0)S +4432(\(o)S +4515 H + (f)show 10 -.5 mul h (f)show +10 R +4576(\))S +4639(to)S +4747(1.0)S +4902(\(full)S +5104(intensity\).)S +2928 V +1500(R)S +1597(G)S +1699(B)S +3048 V +1500(R)S +1597(G)S +1699(B)S +3168 V +1500(\(etc.\))S +3408 V +1260(Blank)S +1529(and)S +1703(comment)S +2105(lines)S +2324(\(lines)S +2576(beginning)S +3006(with)S +3214(a)S +3288('#'\))S +3467(are)S +3618(ignored.)S +3648 V +1260(Usually)S +1605(256)S +1789(rows)S +2017(are)S +2172(provided,)S +2586(but)S +2748(the)S +2904(number)S +3243(may)S +3449(actually)S +3799(be)S +3927(anything)S +4311(in)S +4423(the)S +4579(range)S +4834(1)S +4918(to)S +5031(256.)S +5241(XImtool)S +3768 V +1260(will)S +1451(interpolate)S +1912(the)S +2068(table)S +2296(as)S +2413(necessary)S +2834(to)S +2946(compute)S +3324(the)S +3480(colortable)S +3913(values)S +4202(used)S +4419(in)S +4531(XImtool.)S +4929(XImtool)S +5302(uses)S +5508(at)S +3888 V +1260(most)S +1485(201)S +1665(colors)S +1939(to)S +2047(render)S +2331(pixel)S +2561(data,)S +2782(so)S +2901(it)S +2987(is)S +3084(usually)S +3403(necessary)S +3820(to)S +3928(interpolate)S +4385(the)S +4537(table)S +4761(when)S +5007(it)S +5093(is)S +5190(loaded.)S +4128 V +1260(The)S +1446(name)S +1693(of)S +1807(the)S +1960(colortable)S +2390(as)S +2504(it)S +2591(will)S +2778(appear)S +3074(in)S +3183(the)S +3336(XImtool)S +3706(control)S +4020(panel)S +4267(is)S +4365(the)S +4518(root)S +4710(name)S +4957(of)S +5072(the)S +5226(\256le,)S +5411(e.g.,)S +4248 V +1260(if)S +1365(the)S +1531(\256le)S +1703(is)S +1814("rainbow.lut")S +2398(the)S +2564(colortable)S +3007(name)S +3267(will)S +3467(be)S +3605("rainbow".)S +4083(Lower)S +4387(case)S +4602(names)S +4901(are)S +5065(suggested)S +5502(to)S +4368 V +1260(avoid)S +1525(name)S +1784(collisions)S +2211(with)S +2432(the)S +2597(builtin)S +2902(colortables.)S +3408(Private)S +3734(colormaps)S +4193(for)S +4352(disk)S +4562(images)S +4888(will)S +5088(be)S +5226(have)S +5458(the)S +4488 V +1260(same)S +1497(name)S +1745(as)S +1860(the)S +2014(image)S +2290(loaded.)S +2613(If)S +2711(the)S +2865(same)S +3102(colortable)S +3533(\256le)S +3693(appears)S +4029(in)S +4139(multiple)S +4505(user)S +4703(colortable)S +5134(directories,)S +4608 V +1260(the)S +1412(\256rst)S +1598(one)S +1772(found)S +2035(will)S +2221(be)S +2345(used.)S +4896 V +9 B +1080(MINIMIZING)S +1677(COLORMAP)S +2239(CONFLICTS)S +5016 V +10 R +1260(The)S +1456(Gterm)S +1752(widget)S +2065(used)S +2289(by)S +2430(XImtool)S +2810(\(i.e.)S +3006(the)S +3169(main)S +3410(display)S +3740(window\))S +4136(uses)S +4349(a)S +4434(private)S +4753(global)S +5045(colormap)S +5464(for)S +5136 V +1260(display,)S +1615(this)S +1801(allows)S +2103(it)S +2200(to)S +2319(have)S +2548(greater)S +2865(control)S +3189(over)S +3407(color)S +3653(cell)S +3838(allocation)S +4273(but)S +4441(can)S +4619(occasionally)S +5158(also)S +5359(cause)S +5256 V +1260("colormap)S +1714(\257ashing")S +2108(as)S +2227(the)S +2385(mouse)S +2682(is)S +2785(moved)S +3093(in)S +3207(and)S +3387(out)S +3551(of)S +3670(the)S +3828(application.)S +4363(The)S +4554(problem)S +4923(here)S +5130(is)S +5234(that)S +5421(in)S +5536(a)S +5376 V +1260(system)S +1572(with)S +1784(only)S +1996(an)S +2124(8-bit)S +2347(colormap)S +2758(\(256)S +2975(colors\))S +3286(all)S +3420(applications)S +3937(must)S +4165(compete)S +4536(for)S +4685(colors,)S +4987(programs)S +5397(such)S +5496 V +1260(as)S +1380(XV)S +1561(or)S +1681(Netscape)S +2083(allocate)S +2430(colors)S +2711(from)S +2942(the)S +3102(default)S +3417(colormap)S +3832(leaving)S +4164(only)S +4380(a)S +4462(few)S +4649(free)S +4841(cells)S +5062(for)S +5216(XImtool.)S +5616 V +1260(Since)S +1513(XImtool)S +1883(de\256nes)S +2197(a)S +2271(private)S +2578(global)S +2858(colormap)S +3265(it)S +3351(is)S +3448(still)S +3629(able)S +3825(to)S +3933(allocate)S +4273(the)S +4425(needed)S +4737(cells)S +4950(rather)S +5212(than)S +5414(fail-)S +5736 V +1260(ing,)S +1449(but)S +1613(it's)S +1777(allocating)S +2207(cells)S +2426(already)S +2755(used)S +2974(by)S +3110(other)S +3351(applications.)S +3925(As)S +4072(the)S +4230(mouse)S +4527(moves)S +4824(out)S +4989(of)S +5109(the)S +5268(ximtool)S +5856 V +1260(window)S +1623(those)S +1875(cells)S +2099(are)S +2261(once)S +2490(again)S +2747(de\256ned)S +3082(in)S +3201(terms)S +3464(of)S +3587(the)S +3749(default)S +4066(colormap,)S +4508(so)S +4637(the)S +4799(ximtool)S +5151(window)S +5513(is)S +5976 V +1260(then)S +1470(using)S +1725(a)S +1807(di)S +1885 H + (f)show 10 -.5 mul h (f)show +10 R +1946(erent)S +2183(colormap.)S +2653(It)S +2752(is)S +2857(this)S +3040(switching)S +3467(of)S +3588(the)S +3748(colormap)S +4164(context)S +4497(that)S +4686(causes)S +4985(the)S +5146(\257ashing)S +5502(to)S +6096 V +1260(occur,)S +1536(but)S +1694(there)S +1923(are)S +2074(a)S +2148(few)S +2327(things)S +2602(that)S +2782(can)S +2950(be)S +3074(done)S +3298(to)S +3406(help)S +3608(minimize)S +4016(this.)S +6336 V +1260(XImtool)S +1640(logically)S +2031(de\256nes)S +2356(200)S +2548(colors)S +2834(which)S +3120(the)S +3284(client)S +3548(image)S +3834(display)S +4165(program)S +4545(can)S +4725(use)S +4900(to)S +5020(render)S +5316(pixels.)S +6456 V +1260(However,)S +1687(ximtool)S +2036(may)S +2245(or)S +2365(may)S +2574(not)S +2739(actually)S +3092(allocate)S +3439(all)S +3576(of)S +3695(those)S +3942(colors.)S +4277(By)S +4430(default)S +4743(it)S +4835(currently)S +5231(allocates)S +6576 V +1260(only)S +1479(about)S +1743(192)S +1935(colors,)S +2246(to)S +2366(reserve)S +2695(64)S +2837(colors)S +3123(for)S +3281(the)S +3445(other)S +3692(windows)S +4095(on)S +4237(the)S +4401(screen.)S +4752(You)S +4966(don't)S +5219(normally)S +6696 V +1260(notice)S +1539(this)S +1719(as)S +1837(1\))S +1955(usually)S +2279(the)S +2436(default)S +2748(screen)S +3037(colormap)S +3449(has)S +3617(enough)S +3946(free)S +4135(cells)S +4353(to)S +4466(allow)S +4722(ximtool)S +5068(to)S +5180(match)S +5458(the)S +6816 V +1260(colors,)S +1570(and)S +1755(2\))S +1879(the)S +2042(extra)S +2282(unallocated)S +2784(cells)S +3009(correspond)S +3494(to)S +3614(the)S +3778(brightest)S +4170(pixels)S +4451(in)S +4571(the)S +4735(rendered)S +5125(image,)S +5436(and)S +6936 V +1260(these)S +1496(colors)S +1771(may)S +1974(not)S +2132(be)S +2256(used)S +2469(or)S +2582(usually)S +2901(only)S +3109(correspond)S +3582(to)S +3690(a)S +3764(few)S +3943(small)S +4190(regions)S +4514(near)S +4715(the)S +4867(saturated)S +5257(cores)S +5497(of)S +7056 V +1260(bright)S +1529(objects.)S +7296 V +1260(You)S +1465(can)S +1636(eliminate)S +2041(this)S +2219(problem)S +2585(by)S +2718(setting)S +3018(the)S +10 I +3173(basePixel)S +10 R +3594(resource)S +3965(to)S +4077(e.g.)S +4285(48)S +4419(instead)S +4736(of)S +4853(64,)S +5012(which)S +5290(will)S +5480(let)S +7776 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(21)S +7920 V +EP +%%Page: 22 23 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(the)S +1428(gterm)S +1707(widget)S +2025(allocate)S +2381(all)S +2527(200)S +2723(colors.)S +3068(However,)S +3504(this)S +3695(isn't)S +3918(recommended)S +4528(for)S +4689(normal)S +5017(use)S +5195(as)S +5323(it)S +5424(will)S +1080 V +1260(increase)S +1624(the)S +1784(likelihood)S +2228(of)S +2349(colormap)S +2764(\257ashing.)S +3174(If)S +3278(you)S +3466(change)S +10 I +3787(basePixel)S +10 R +4175(,)S +4239(either)S +4505(restart)S +4793(the)S +4954(X)S +5065(server)S +5347(or)S +5469(set)S +1200 V +1260(the)S +1418(resource)S +10 I +1791(cmapInitialize)S +10 R +2363(=)S +10 I +2419(True)S +10 R +2644(to)S +2758(force)S +2998(the)S +3156(gterm)S +3425(widget)S +3732(to)S +3845(update)S +4146(its)S +4276(global)S +4561(colormap)S +4973(resource)S +5345(in)S +5458(the)S +1320 V +1260(X)S +1362(server.)S +1690(The)S +1875(colormap)S +2282(resource)S +2649(may)S +2851(also)S +3042(be)S +3166(deleted)S +3484(by)S +3614(using)S +3861(the)S +4013(command)S +1524 V +10 I +1980(xprop)S +2243(-root)S +2473(-remove)S +2829(GT_image)S +1728 V +10 R +1260(These)S +1528(options)S +1853(may)S +2055(also)S +2246(be)S +2370(set)S +2511(on)S +2641(the)S +2793(command)S +3217(line)S +3397(when)S +3643(\256rst)S +3829(starting)S +4159(up.)S +1968 V +1260(In)S +1388(general)S +1726(one)S +1915(can)S +2098(set)S +2254(the)S +2421(Gterm)S +2721(widget)S +3039(resources)S +10 I +3461(basePixel)S +10 R +3895(and)S +10 I +4085(maxColors)S +10 R +4570(to)S +4694(specify)S +5028(the)S +5196(region)S +5497(of)S +2088 V +1260(colormap)S +1680(space)S +1944(to)S +2065(be)S +2202(used)S +2428(for)S +2587(image)S +2874(display.)S +3261(If)S +3370(you)S +3563(set)S +10 I +3717(maxColors)S +10 R +4199(to)S +4320(a)S +4407(small)S +4667(value,)S +4951(the)S +5116(200)S +5308(logical)S +2208 V +1260(colors)S +1541(de\256ned)S +1872(by)S +2009(the)S +2168(widget)S +2477(will)S +2670(be)S +2801(mapped)S +3154(by)S +3291(the)S +3450(imtool)S +3749(color)S +3991(model)S +4278(into)S +4471(whatever)S +4873(number)S +5215(of)S +5336(colors)S +2328 V +1260(are)S +1417(actually)S +1769(available)S +2165(to)S +2279(the)S +2437(widget.)S +2800(For)S +2974(example,)S +3372(in)S +3485(the)S +3642(default)S +3954(setup,)S +4225(200)S +4410(color)S +4650(values)S +4940(are)S +5096(really)S +5358(being)S +2448 V +1260(mapped)S +1606(into)S +1792(192)S +1972(color)S +2207(cells)S +2420(used)S +2633(for)S +2779(display,)S +3123(the)S +3275(remaining)S +3710(colors)S +3984(are)S +4135(used)S +4348(for)S +4494(buttons,)S +4845(menus)S +5137(etc)S +5284(and)S +5459(are)S +2568 V +1260(allocated)S +1650(from)S +1874(the)S +2026(default)S +2333(colormap)S +2740(by)S +2870(the)S +3022(X)S +3124(toolkit)S +3416(when)S +3662(the)S +3814(application)S +4288(starts)S +4529(up.)S +2808 V +1260(Even)S +1501(though)S +1815(the)S +1973(Gterm)S +2264(widget)S +2572(uses)S +2780(a)S +2860(private)S +3174(colormap,)S +3613(it)S +3706(is)S +3810(a)S +3891(private)S +10 I +4205(global)S +10 R +4498(colormap)S +4912(meaning)S +5293(that)S +5480(all)S +2928 V +1260(Gterm)S +1550(widgets)S +1896(share)S +2141(the)S +2298(same)S +2537(colormap.)S +3003(An)S +3159(example)S +3531(of)S +3648(colormap)S +4059(sharing)S +4387(in)S +4499(ximtool)S +4845(is)S +4946(the)S +5102(main)S +5336(image)S +3048 V +1260(window)S +1619(and)S +1800(the)S +1959(colorbar)S +2328(window.)S +2742(These)S +3017(are)S +3175(two)S +3362(separate)S +3725(gterm)S +3995(widgets)S +4343(that)S +4530(share)S +4777(the)S +4936(same)S +5178(colormap.)S +3168 V +1260(They)S +1506(have)S +1735(to)S +1854(share)S +2105(the)S +2268(same)S +2514(colormap,)S +2957(as)S +3080(otherwise)S +3508(when)S +3764(you)S +3954(windowed)S +4410(the)S +4572(main)S +4812(image)S +5096(window)S +5458(the)S +3288 V +1260(colorbar)S +1630(window)S +1990(would)S +2278(not)S +2444(accurately)S +2891(re\257ect)S +3178(the)S +3338(modi\256ed)S +3732(colormap.)S +4203(By)S +4359(default)S +4675(two)S +4864(separate)S +5229(ximtools)S +3408 V +1260(would)S +1556(also)S +1763(share)S +2019(the)S +2186(same)S +2436(colormap)S +2858(meaning)S +3247(contrast)S +3608(enhancements)S +4218(in)S +4341(one)S +4530(window)S +4897(would)S +5192(a)S +5236 H + (f)show 10 -.5 mul h (f)show +10 R +5297(ect)S +5458(the)S +3528 V +1260(other.)S +1563(By)S +1723(resetting)S +2110(the)S +10 I +2275(cmapName)S +10 R +2767(command)S +3204(line)S +3397(option)S +3696(or)S +3822(resource)S +4203(you)S +4397(can)S +4579(change)S +4905(the)S +5071(name)S +5331(of)S +5458(the)S +3648 V +1260(private)S +1582(colormap)S +2004(used)S +2232(causing)S +2582(separate)S +2953(ximtools)S +3349(to)S +3472(use)S +3650(di)S +3728 H + (f)show 10 -.5 mul h (f)show +10 R +3789(erent)S +4033(colormaps,)S +4519(but)S +4692(note)S +4909(this)S +5099(also)S +5304(creates)S +3768 V +1260(colormap)S +1671(\257ashing)S +2022(between)S +2388(the)S +2544(two)S +2728(windows)S +3123(that)S +3307(cannot)S +3607(easily)S +3874(be)S +4002(avoided.)S +4407(By)S +4559(setting)S +4861(the)S +10 I +5018(cmapName)S +10 R +5502(to)S +3888 V +1260("default")S +1649(the)S +1801(widget)S +2103(will)S +2289(allocate)S +2629(colors)S +2903(from)S +3127(the)S +3279(default)S +3586(colormap,)S +4018(but)S +4176(this)S +4351(is)S +4448(of)S +4561(little)S +4775(use)S +4938(at)S +5040(the)S +5192(moment.)S +4128 V +1260(There)S +1524(are)S +1677(a)S +1753(number)S +2090(of)S +2205(other)S +2442(resources)S +2850(that)S +3032(can)S +3202(be)S +3328(used)S +3543(to)S +3653(modify)S +3974(the)S +4129(behavior)S +4511(of)S +4627(the)S +4782(Gterm)S +5070(widget)S +5375(color)S +4248 V +1260(management)S +1801(scheme,)S +2156(but)S +2315(these)S +2551(are)S +2703(the)S +2856(most)S +3082(useful)S +3356(ones.)S +3624(For)S +3793(question)S +4162(and)S +4336(further)S +4637(information)S +5139(feel)S +5318(free)S +5502(to)S +4368 V +1260(contact)S +10 I +1578(iraf@noao.edu)S +10 R +2184(.)S +4776 V +9 B +900(DISPLAY)S +1322(CLIENT)S +1694(CONNECTIONS)S +4896 V +10 R +1260(XImtool)S +1629(allows)S +1920(display)S +2239(clients)S +2530(to)S +2638(connect)S +2978(in)S +3086(any)S +3260(of)S +3373(the)S +3525(following)S +3944(ways:)S +5064 V +10 B +1260(\256fo)S +1429(pipes)S +5184 V +10 R +1510(The)S +1706(traditional)S +2158(approach.)S +2589(The)S +2785(default)S +3103(global)S +3394(/dev/imt1[io])S +3963(pipes)S +4215(may)S +4428(be)S +4564(used,)S +4814(or)S +4939(a)S +5025(private)S +5344(set)S +5497(of)S +5304 V +1510(\256fos)S +1728(can)S +1906(be)S +2040(speci\256ed)S +2435(using)S +2692(the)S +10 I +2854(-\256fo)S +10 R +3055(command)S +3489(line)S +3678(argument)S +4094(or)S +10 Y +4216(*)S +10 I +4266(\256fo)S +10 R +4433(resource.)S +4864(Values)S +5180(should)S +5486(be)S +5424 V +1510(speci\256ed)S +1895(as)S +2008(the)S +2160(root)S +2351(pathname)S +2769(to)S +2877(a)S +2951(pair)S +3136(of)S +3250(\256fo)S +3420(pipes)S +3662(whose)S +3948(last)S +4118(character)S +4513(is)S +4611('i')S +4736(or)S +4850('o',)S +5052(these)S +5288(charac-)S +5544 V +1510(ters)S +1687(will)S +1876(be)S +2003(added)S +2274(automatically)S +2851(when)S +3100(opening)S +3455(the)S +3610(pipes.)S +3909(For)S +4081(example,)S +4477(to)S +4587(use)S +4752(the)S +4906(default)S +5215(pipes)S +5458(the)S +5664 V +1510(path)S +1712(would)S +1992(be)S +2116(speci\256ed)S +2501(as)S +2614(simply)S +2917("/dev/imt1".)S +3438(A)S +3540(value)S +3786(of)S +3899("none")S +4205(disables)S +4557(this)S +4732(connection.)S +5832 V +10 B +1260(tcp/ip)S +1535(sockets)S +5952 V +10 R +1510(Clients)S +1836(connect)S +2188(via)S +2352(a)S +2438(tcp/ip)S +2708(socket.)S +3030(The)S +3227(default)S +3546(port)S +3749(is)S +10 I +3858(5137)S +10 R +4058(,)S +4125(or)S +4250(a)S +4337(custom)S +4669(port)S +4873(may)S +5088(be)S +5225(speci\256ed)S +6072 V +1510(using)S +1758(the)S +10 I +1911(-port)S +10 R +2142(command)S +2567(line)S +2747(switch)S +3038(or)S +3151(a)S +10 Y +3225(*)S +10 I +3275(port)S +10 R +3472(resource.)S +3864(This)S +4072(permits)S +4402(connecting)S +4870(to)S +4978(the)S +5130(server)S +5403(over)S +6192 V +1510(a)S +1584(remote)S +1891(network)S +2248(connection)S +2716(anywhere)S +3133(on)S +3263(the)S +3415(Internet.)S +3780(A)S +3883(port)S +4075(number)S +4411(of)S +4525(0)S +4606(\(zero\))S +4874(disables)S +5227(this)S +5403(con-)S +6312 V +1510(nection.)S +6480 V +10 B +1260(unix)S +1480(domain)S +1833(sockets)S +6600 V +10 R +1510(Like)S +1733(a)S +1817(tcp/ip)S +2085(socket,)S +2405(but)S +2573(limited)S +2898(to)S +3017(a)S +3102(single)S +3382(host)S +3590(system.)S +3934(Usually)S +4286(faster)S +4548(than)S +4761(a)S +4846(tcp/ip)S +5115(socket,)S +5436(and)S +6720 V +1510(comparable)S +2008(to)S +2119(a)S +2196(\256fo.)S +2393(By)S +2543(default)S +2853(each)S +3068(user)S +3267(gets)S +3460(their)S +3675(own)S +3879(unix)S +4089(domain)S +4421(socket,)S +4733(so)S +4854(this)S +5031(option)S +5319(allows)S +6840 V +1510(multiple)S +1882(users)S +2125(to)S +2241(run)S +2413(ximtools)S +2803(on)S +2942(the)S +3103(same)S +3347(host)S +3553(without)S +3898(having)S +4209(to)S +4326(customize)S +4770(things.)S +5109(The)S +5303(default)S +6960 V +1510(value)S +1761(is)S +1863("/tmp/.IMT%d",)S +2558(other)S +2798(sockets)S +3126(may)S +3332(be)S +3460(de\256ned)S +3788(using)S +4039(the)S +10 I +4195(-unix)S +10 R +4434(command)S +4862(line)S +5046(switch)S +5341(or)S +5458(the)S +7080 V +10 Y +1510(*)S +10 I +1560(unixaddr)S +10 R +1953(resource.)S +2377(Legal)S +2636(values)S +2923(should)S +3222(be)S +3348(speci\256ed)S +3735(as)S +3850(a)S +3926(\256lename)S +4302(to)S +4412(be)S +4538(used)S +4753(for)S +4901(the)S +5056(socket,)S +5369(up)S +5502(to)S +7200 V +1510(two)S +1693("%d")S +1941(\256elds)S +2190(are)S +2343(allowed)S +2691(and)S +2867(will)S +3055(be)S +3181(replaced)S +3550(by)S +3682(the)S +3836(userid.)S +4137(An)S +4291(empty)S +4573(string)S +4833(value)S +5081(disables)S +5435(this)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(22)S +7920 V +EP +%%Page: 23 24 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1510(connection.)S +1200 V +1510(By)S +1657(default)S +1964(ximtool)S +2306(listens)S +2592(simultaneously)S +3228(for)S +3374(client)S +3626(connections)S +4133(on)S +4263(all)S +4394(three)S +4624(types)S +4866(of)S +4980(ports.)S +5296(Clients)S +1320 V +1510(may)S +1713(connect)S +2054(simultaneously)S +2691(by)S +2822(di)S +2900 H + (f)show 10 -.5 mul h (f)show +10 R +2961(erent)S +3190(means)S +3475(allowing)S +3855(up)S +3985(to)S +4093(three)S +4322(di)S +4400 H + (f)show 10 -.5 mul h (f)show +10 R +4461(erent)S +4690(displays)S +5048(to)S +5156(be)S +5280(loading)S +1440 V +1510(at)S +1612(the)S +1764(same)S +1999(time)S +2207(into)S +2393(di)S +2471 H + (f)show 10 -.5 mul h (f)show +10 R +2532(erent)S +2761(frames.)S +1848 V +9 B +1080(COMMUNICATIONS)S +1987(PROTOCOL)S +1968 V +10 R +1260(The)S +1448(communications)S +2142(protocol)S +2508(used)S +2724(is)S +2824(a)S +2901(slightly)S +3236(modi\256ed)S +3626(version)S +3954(of)S +4071(that)S +4255(used)S +4472(by)S +4606(the)S +4762(IIS)S +4918(Model)S +5213(70;)S +5375(other)S +2088 V +1260(more)S +1503(modern)S +1846(protocols)S +2256(will)S +2450(likely)S +2716(be)S +2848(supported)S +3280(in)S +3396(the)S +3556(future.)S +3887(The)S +4080(IIS)S +4239(protocol)S +4609(is)S +4713(basically)S +5105(a)S +5186(command)S +2208 V +1260(packet)S +1562(stream)S +1870(with)S +2090(a)S +2176(header)S +2483(describing)S +2941(the)S +3105(operation)S +3524(to)S +3644(be)S +3780(performed)S +4237(\(select)S +4539(frame,)S +4838(load)S +5052(display,)S +5409(read)S +2328 V +1260(cursor,)S +1564(etc\),)S +1768(and)S +1942(an)S +2066(optional)S +2424(data)S +2620(packet)S +2910(containing)S +3362(e.g.)S +3536(pixels.)S +2568 V +1260(Beginning)S +1712(with)S +1925(XImtool)S +2299(V1.3)S +2531(the)S +2688(protocol)S +3056(was)S +3246(modi\256ed)S +3637(even)S +3860(more)S +4100(to)S +4214(allow)S +4472(extra)S +4707(text)S +4893(at)S +5001(the)S +5159(end)S +5339(of)S +5458(the)S +2688 V +1260(WCS)S +1515(string)S +1781(to)S +1897(de\256ne)S +2179(image)S +2461(mappings)S +2888(and)S +3070(to)S +3186(better)S +3451(support)S +3789(multiple)S +4161(world)S +4431(coordinate)S +4889(systems)S +5243(within)S +5536(a)S +2808 V +1260(frame.)S +1612(For)S +1786(backwards)S +2247(compatability)S +2832(none)S +3061(of)S +3179(the)S +3336(existing)S +3688(IIS)S +3845(protocols)S +4252(were)S +4480(modi\256ed)S +4871(completely,)S +5375(how-)S +2928 V +1260(ever)S +1467(we)S +1619(take)S +1821(advantage)S +2261(of)S +2380(unused)S +2699(registers)S +3073(to)S +3187(\257ag)S +3373(the)S +3531(new)S +3733(features)S +4084(in)S +4198(existing)S +4551(functions)S +4958(\(like)S +5176(read/write)S +3048 V +1260(WCS\).)S +1572(The)S +1764(WCS)S +2018(mapping)S +2405(changes)S +2763(required)S +3132(only)S +3347(that)S +3534(the)S +3693(unused)S +4013('x')S +4166(register)S +4503(be)S +4635(set)S +4784(to)S +4900(indicate)S +5254(the)S +5414(new)S +3168 V +1260(behavior)S +1639(was)S +1824(desired,)S +2167(e.g.)S +2341(the)S +2493(wcs)S +2678(text)S +2858(containing)S +3310(the)S +3462(extra)S +3691(mapping)S +4071(data.)S +3408 V +1260(We)S +1444(also)S +1651(added)S +1935(two)S +2131(new)S +2343(WCS)S +2606(calls)S +2835(that)S +3031(allow)S +3299(us)S +3434(to)S +3558(query)S +3831(the)S +4000(WCS)S +4264(version,)S +4630(or)S +4760(query)S +5034(a)S +5125(WCS)S +5389(by)S +5536(a)S +3528 V +1260(speci\256c)S +1602(number)S +1944(corresponding)S +2552(to)S +2667(a)S +2748(mapping.)S +3190(The)S +3382(WCS)S +3636(version)S +3967(query)S +4231(will)S +4423(return)S +4697(a)S +4777(string)S +5041(such)S +5260(as)S +5379("ver-)S +3648 V +1260(sion=10")S +1654(which)S +1928(can)S +2096(be)S +2220(parsed)S +2510(by)S +2640(the)S +2792(client)S +3044(to)S +3152(get)S +3304(a)S +3378(version)S +3702(number)S +4037('10')S +4233(\(corresponding)S +4867(to)S +4975(version)S +5299(1.0\).)S +3888 V +1260(Because)S +1634(of)S +1759(the)S +1923(added)S +2203(mapping)S +2595(text)S +2787(the)S +2951(WCS)S +3210(string)S +3480(length)S +3772(was)S +3969(increased)S +4387(from)S +4623(320)S +4815(to)S +4936(1024)S +5179(bytes,)S +5458(the)S +4008 V +1260(string)S +1518(length)S +1798(used)S +2011(internally)S +2424(depends)S +2781(on)S +2911(whether)S +3262(the)S +3414('x')S +3560(register)S +3889(has)S +4052(been)S +4270(set.)S +4248 V +1260(Support)S +1616(for)S +1771(the)S +1933(full)S +2112(16)S +2252(frames)S +2563(allowed)S +2919(by)S +3059(the)S +3221(bit-\257ag)S +3550('z')S +3700(register)S +4039(in)S +4157(the)S +4319(IIS)S +4481(header)S +4786(packet)S +5086(required)S +5458(the)S +4368 V +1260(masking)S +1631(values)S +1918(be)S +2044(changed)S +2408(at)S +2512(various)S +2838(places)S +3119(in)S +3229(the)S +3383(code.)S +3658(This)S +3868(was)S +4055(more)S +4291(a)S +4366(limitation)S +4787(of)S +4901(the)S +5054(initial)S +5319(imple-)S +4488 V +1260(mentation)S +1690(than)S +1892(a)S +1966(required)S +2328(change)S +2640(to)S +2748(the)S +2900(protocol.)S +4728 V +1260(A)S +1362(complete)S +1758(summary)S +2160(of)S +2273(the)S +2425(XImtool)S +2794(IIS)S +2946(protocol)S +3309(implementation)S +3967(follows.)S +5136 V +9 B +1080(IIS)S +1227(PROTOCOL)S +1769(SUMMARY)S +5256 V +10 R +1260(All)S +1427(operations)S +1882(are)S +2042(initiated)S +2409(by)S +2548(sending)S +2898(a)S +2981(header)S +3285(packet)S +3584(containing)S +4046(a)S +10 I +4130(thing)S +4376(id)S +10 R +4494(\(tid\))S +4706(and)S +10 I +4890(subunit)S +10 R +5225(selecting)S +5376 V +1260(the)S +1413(function)S +1776(to)S +1884(be)S +2008(performed,)S +2478(optionally)S +2914(followed)S +3299(by)S +3429(data)S +3625(up)S +3755(to)S +3863(32Kb)S +4115(long.)S +4378(The)S +4563(IIS)S +4715(header)S +5010(packet)S +5300(used)S +5513(is)S +5496 V +1260(de\256ned)S +1584(as)S +5616 V +10 C +1980(struct)S +2460(iism70)S +2880({)S +5736 V +2340(short)S +2820(tid;)S +5856 V +2340(short)S +2820(thingct;)S +5976 V +2340(short)S +2820(subunit;)S +6096 V +2340(short)S +2820(checksum;)S +6216 V +2340(short)S +2820(x,)S +3000(y,)S +3180(z;)S +6336 V +2340(short)S +2820(t;)S +6456 V +1980(};)S +6696 V +10 R +1260(The)S +10 I +1447(thing)S +1685(count)S +10 R +1939(\256eld)S +2149(contains)S +2514(the)S +2668(negative)S +3038(number)S +3375(of)S +3490(bytes)S +3733(of)S +3848(data)S +4046(that)S +4228(will)S +4417(be)S +4544(sent)S +4738(following)S +5160(the)S +5315(header)S +6816 V +1260(packet.)S +1605(The)S +1790(IIS)S +1942(header)S +2237(checksum)S +2666(is)S +2763(computed)S +3187(as)S +7056 V +10 C +1500(checksum)S +2040(=)S +2160(0177777)S +2640(-)S +2760(\(tid)S +3060(+)S +3180(subunit)S +3660(+)S +3780(thingct)S +4260(+)S +4380(x)S +4500(+)S +4620(y)S +4740(+)S +4860(z)S +4980(+)S +5100(t\);)S +7296 V +10 R +1260(The)S +1447(four)S +1645(IIS)S +1799(registers)S +2169(are)S +2322(set)S +2465(di)S +2543 H + (f)show 10 -.5 mul h (f)show +10 R +2604(erently)S +2913(depending)S +3361(on)S +3493(the)S +3647(operation,)S +4081(a)S +4158(summary)S +4563(of)S +4679(the)S +4834(header)S +5132(packets)S +5464(for)S +7776 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(23)S +7920 V +EP +%%Page: 24 25 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +1260(each)S +1472(operation)S +1879(is)S +1976(summarized)S +2494(below.)S +1200 V +10 B +2795(IIS)S +2959(Header)S +3305(Packet)S +3623(Summary)S +1320 V +10 R +2530(TID)S +3436(Subunit)S +4136(Tct)S +4439(X)S +4661(Y)S +4930(Z)S +5235(T)S +5514(Data)S +1340 V +10 Y1 +2083(2)S +2123(2222222222222222222222222222222222222222222222222222222222222222222222222)S +1460 V +10 R +1260(Read)S +1495(Data)S +2158(IIS_READ)S +10 B +2602(|)S +10 R +2624(PACKED)S +3218(MEMORY)S +4117(-NB)S +4450(x)S +4672(y)S +4883(fr)S +5188(-)S +5493(NB)S +1580 V +1260(Write)S +1517(Data)S +2158(IIS_WRITE)S +10 B +2646(|)S +10 R +2668(PACKED)S +3218(MEMORY)S +4117(-NB)S +4450(x)S +4672(y)S +4883(fr)S +5188(-)S +5493(NB)S +1700 V +1260(Read)S +1495(Cursor)S +2158(IIS_READ)S +3218(IMCURSOR)S +4186(-)S +4458(-)S +4680(-)S +4883(-)S +5188(-)S +5493(-)S +1820 V +1260(Write)S +1517(Cursor)S +2158(IIS_WRITE)S +3218(IMCURSOR)S +4186(-)S +4450(x)S +4672(y)S +4883(wcs)S +5188(-)S +5493(-)S +1940 V +1260(Set)S +1418(Frame)S +2158(IIS_WRITE)S +3218(LUT)S +10 B +3412(|)S +10 R +3434(COMMAND)S +4161(-1)S +4458(-)S +4680(-)S +4883(-)S +5188(-)S +5493(2)S +2060 V +1260(Erase)S +1511(Frame)S +2158(IIS_WRITE)S +10 B +2676(|)S +10 R +2728(fb)S +3218(FEEDBACK)S +4186(-)S +4458(-)S +4680(-)S +4883(fr)S +5188(-)S +5493(-)S +2300 V +1260(Old)S +1440(Write)S +1697(WCS)S +2158(IIS_WRITE)S +10 B +2646(|)S +10 R +2668(PACKED)S +3218(WCS)S +4150(-N)S +4458(-)S +4680(-)S +4883(fr)S +5188(fb)S +5493(320)S +2420 V +1260(Old)S +1440(Read)S +1675(WCS)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4458(-)S +4680(-)S +4883(fr)S +5188(wcs)S +5493(320)S +2660 V +1260(WCS)S +1507(Version?)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4450(1)S +4672(1)S +4883(-)S +5188(-)S +5493(320)S +2780 V +1260(WCS)S +1507(by)S +1637(Number?)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4450(1)S +4680(-)S +4883(fr)S +5188(wcs)S +5493(1024)S +2900 V +1260(New)S +1478(Write)S +1735(WCS)S +2158(IIS_WRITE)S +10 B +2646(|)S +10 R +2668(PACKED)S +3218(WCS)S +4150(-N)S +4450(1)S +4680(-)S +4883(fr)S +5188(fb)S +5493(1024)S +3020 V +1260(New)S +1478(Read)S +1713(WCS)S +2158(IIS_READ)S +3218(WCS)S +4186(-)S +4450(1)S +4680(-)S +4883(fr)S +5188(wcs)S +5493(1024)S +3040 V +10 Y1 +2083(2)S +2123(2222222222222222222222222222222222222222222222222222222222222222222222222)S +2083(1)S +2940 V +2083(1)S +2840 V +2083(1)S +2740 V +2083(1)S +2640 V +2083(1)S +2540 V +2083(1)S +2440 V +2083(1)S +2340 V +2083(1)S +2240 V +2083(1)S +2140 V +2083(1)S +2040 V +2083(1)S +1940 V +2083(1)S +1840 V +2083(1)S +1740 V +2083(1)S +1640 V +2083(1)S +1540 V +2083(1)S +1440 V +2083(1)S +3040 V +3143(1)S +2940 V +3143(1)S +2840 V +3143(1)S +2740 V +3143(1)S +2640 V +3143(1)S +2540 V +3143(1)S +2440 V +3143(1)S +2340 V +3143(1)S +2240 V +3143(1)S +2140 V +3143(1)S +2040 V +3143(1)S +1940 V +3143(1)S +1840 V +3143(1)S +1740 V +3143(1)S +1640 V +3143(1)S +1540 V +3143(1)S +1440 V +3143(1)S +3040 V +4042(1)S +2940 V +4042(1)S +2840 V +4042(1)S +2740 V +4042(1)S +2640 V +4042(1)S +2540 V +4042(1)S +2440 V +4042(1)S +2340 V +4042(1)S +2240 V +4042(1)S +2140 V +4042(1)S +2040 V +4042(1)S +1940 V +4042(1)S +1840 V +4042(1)S +1740 V +4042(1)S +1640 V +4042(1)S +1540 V +4042(1)S +1440 V +4042(1)S +3040 V +4364(1)S +2940 V +4364(1)S +2840 V +4364(1)S +2740 V +4364(1)S +2640 V +4364(1)S +2540 V +4364(1)S +2440 V +4364(1)S +2340 V +4364(1)S +2240 V +4364(1)S +2140 V +4364(1)S +2040 V +4364(1)S +1940 V +4364(1)S +1840 V +4364(1)S +1740 V +4364(1)S +1640 V +4364(1)S +1540 V +4364(1)S +1440 V +4364(1)S +3040 V +4586(1)S +2940 V +4586(1)S +2840 V +4586(1)S +2740 V +4586(1)S +2640 V +4586(1)S +2540 V +4586(1)S +2440 V +4586(1)S +2340 V +4586(1)S +2240 V +4586(1)S +2140 V +4586(1)S +2040 V +4586(1)S +1940 V +4586(1)S +1840 V +4586(1)S +1740 V +4586(1)S +1640 V +4586(1)S +1540 V +4586(1)S +1440 V +4586(1)S +3040 V +4808(1)S +2940 V +4808(1)S +2840 V +4808(1)S +2740 V +4808(1)S +2640 V +4808(1)S +2540 V +4808(1)S +2440 V +4808(1)S +2340 V +4808(1)S +2240 V +4808(1)S +2140 V +4808(1)S +2040 V +4808(1)S +1940 V +4808(1)S +1840 V +4808(1)S +1740 V +4808(1)S +1640 V +4808(1)S +1540 V +4808(1)S +1440 V +4808(1)S +3040 V +5113(1)S +2940 V +5113(1)S +2840 V +5113(1)S +2740 V +5113(1)S +2640 V +5113(1)S +2540 V +5113(1)S +2440 V +5113(1)S +2340 V +5113(1)S +2240 V +5113(1)S +2140 V +5113(1)S +2040 V +5113(1)S +1940 V +5113(1)S +1840 V +5113(1)S +1740 V +5113(1)S +1640 V +5113(1)S +1540 V +5113(1)S +1440 V +5113(1)S +3040 V +5418(1)S +2940 V +5418(1)S +2840 V +5418(1)S +2740 V +5418(1)S +2640 V +5418(1)S +2540 V +5418(1)S +2440 V +5418(1)S +2340 V +5418(1)S +2240 V +5418(1)S +2140 V +5418(1)S +2040 V +5418(1)S +1940 V +5418(1)S +1840 V +5418(1)S +1740 V +5418(1)S +1640 V +5418(1)S +1540 V +5418(1)S +1440 V +5418(1)S +3040 V +5773(1)S +2940 V +5773(1)S +2840 V +5773(1)S +2740 V +5773(1)S +2640 V +5773(1)S +2540 V +5773(1)S +2440 V +5773(1)S +2340 V +5773(1)S +2240 V +5773(1)S +2140 V +5773(1)S +2040 V +5773(1)S +1940 V +5773(1)S +1840 V +5773(1)S +1740 V +5773(1)S +1640 V +5773(1)S +1540 V +5773(1)S +1440 V +5773(1)S +3280 V +10 R +1260(Where)S +1675(NB)S +2459(=)S +2545(number)S +2880(of)S +2993(bytes)S +3234(expected)S +3618(or)S +3731(written)S +3400 V +1675(x)S +2459(=)S +2545(x)S +2625(position)S +2978(of)S +3091(operation)S +3498(in)S +3606(frame)S +3868(bu)S +3968 H + (f)show 10 -.5 mul h (f)show +10 R +4029(er)S +4136(coords)S +3520 V +1675(y)S +2459(=)S +2545(y)S +2625(position)S +2978(of)S +3091(operation)S +3498(in)S +3606(frame)S +3868(bu)S +3968 H + (f)show 10 -.5 mul h (f)show +10 R +4029(er)S +4136(coords)S +3640 V +1675(fr)S +2459(=)S +2545(frame)S +2807(number)S +3142(\(passed)S +3471(as)S +3584(bit\257ag)S +3870(\(i.e.)S +4055(1,)S +4160(2)S +4240(,4)S +4345(8,)S +4450(etc\))S +3760 V +1675(fb)S +2459(=)S +2545(frame)S +2807(bu)S +2907 H + (f)show 10 -.5 mul h (f)show +10 R +2968(er)S +3075(con\256g)S +3355(number)S +3690(\(zero)S +3924(indexed\))S +3880 V +1675(N)S +2459(=)S +2545(length)S +2825(of)S +2938(WCS)S +3185(string)S +4000 V +1675(wcs)S +2459(=)S +2545(WCS)S +2792(number)S +3127(\(usually)S +3479(zero\))S +4120 V +1675(Data)S +2459(=)S +2545(the)S +2697(number)S +3032(of)S +3145(bytes)S +3386(of)S +3499(data)S +3695(to)S +3803(be)S +3927(read)S +4128(or)S +4241(written)S +4554(following)S +4973(the)S +5125(header)S +5420(packet.)S +4360 V +1675(IIS_WRITE)S +2489(=)S +2575(0400000)S +4480 V +1675(IIS_READ)S +2489(=)S +2575(0100000)S +4600 V +1675(COMMAND)S +2489(=)S +2575(0100000)S +4720 V +1675(PACKED)S +2489(=)S +2575(0040000)S +4840 V +1675(IMC_SAMPLE)S +2489(=)S +2575(0040000)S +5080 V +1675(MEMORY)S +2489(=)S +2575(001)S +5200 V +1675(LUT)S +2489(=)S +2575(002)S +5320 V +1675(FEEDBACK)S +2489(=)S +2575(005)S +5440 V +1675(IMCURSOR)S +2489(=)S +2575(020)S +5560 V +1675(WCS)S +2489(=)S +2575(021)S +5800 V +1260(TID)S +1463(\256elds)S +1717(can)S +1892(be)S +2023(logically)S +2410(OR'd)S +2670(with)S +2886(the)S +3046(PACKED)S +3484(\257ag)S +3672(indicating)S +4110(the)S +4270(number)S +4613(of)S +4734(data)S +4938(bytes)S +5187(is)S +5292(exactly)S +5920 V +10 I +1260(thingct)S +10 R +1570(bytes)S +1813(long,)S +2048(otherwise)S +10 I +2468(thingct)S +10 R +2778(must)S +3005(be)S +3131(speci\256ed)S +3518(as)S +3632(half)S +3818(the)S +3971(number)S +4307(of)S +4421(data)S +4618(bytes.)S +4915(In)S +5029(a)S +5104(cursor)S +5384(read,)S +6040 V +1260(if)S +1353(the)S +1508(IIS_READ)S +1985(\257ag)S +2168(is)S +2268(OR'd)S +2523(with)S +2734(IMC_SAMPLE)S +3401(the)S +3556(logical)S +3861(cursor)S +4143(position)S +4499(\(i.e.)S +4717(the)S +4872(last)S +5044(value)S +5293(read)S +5497(or)S +6160 V +1260(set\))S +1445(is)S +1552(returned)S +1924(immediately,)S +2489(otherwise)S +2917(the)S +3079(server)S +3362(will)S +3558(wait)S +3770(for)S +3926(a)S +4010(keystroke)S +4438(to)S +4556(be)S +4690(hit)S +4836(before)S +5130(returning)S +5536(a)S +6280 V +1260(string)S +1519(containing)S +1972(the)S +2125(\(x,y\))S +2347(position,)S +2727(wcs)S +2914(of)S +3029(the)S +3183(read,)S +3411(and)S +3587(the)S +3741(keystroke.)S +4216(When)S +4486(setting)S +4785(the)S +4939(frame)S +5203(you)S +5385(must)S +6400 V +1260(send)S +1473(a)S +1547(short)S +1777(integer)S +2084(in)S +2192(the)S +2344(data)S +2540(containing)S +2992(the)S +3144(frame)S +3406(selected.)S +6688 V +9 B +900(ISM)S +1097(COMMUNICATIONS)S +6808 V +10 R +1260(The)S +1457(ISM)S +1677(\(Image)S +2001(Support)S +2360(Module\))S +2746(can)S +2926(be)S +3062(any)S +3248(external)S +3611(task)S +3814(which)S +4100(connects)S +4491(to)S +4611(XImtool)S +4993(over)S +5213(a)S +5300(socket.)S +6928 V +1260(Communications)S +1974(are)S +2125(limited)S +2439(to)S +2547(simple)S +2844(null-terminated)S +3490(text)S +3670(strings.)S +4022(In)S +4135(most)S +4360(cases)S +4600(these)S +4835(strings)S +5132(are)S +5283(just)S +5458(the)S +7048 V +1260(standard)S +1642(OBM)S +1914(messages)S +2335(sent)S +2540(to)S +2663(XImtool)S +3047(objects)S +3375(but)S +3548(can)S +3731(also)S +3937(include)S +4276(Tcl)S +4454(callback)S +4831(code)S +5064(\(either)S +5369(ISM-)S +7168 V +1260(speci\256c)S +1609(callbacks,)S +2049(procedures)S +2530(which)S +2818(can)S +3000(be)S +3137(added)S +3418(to)S +3539(the)S +3704(callback)S +4079(list)S +4245(for)S +4404(existing)S +4764(XImtool)S +5146(objects,)S +5497(or)S +7288 V +1260(even)S +1478(new)S +1674(GUI)S +1881(code)S +2099(to)S +2207(create)S +2474(panels)S +2759(and)S +2933(new)S +3129(objects\).)S +7768 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(24)S +7920 V +EP +%%Page: 25 26 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +9 B +1080(ISM)S +1277(SOCKET)S +1679(CONNECTION)S +1080 V +10 R +1260(The)S +1482(ISM)S +1727(\256rst)S +1950(requests)S +2344(a)S +2455(connection)S +2960(to)S +3105(XImtool)S +3511(on)S +3678(a)S +3789(dedicated)S +4238(socket)S +4561(whose)S +4884(default)S +5229(value)S +5513(is)S +1200 V +1260("/tmp/.ISM%d",)S +1953(where)S +2234(the)S +2393('%d')S +2629(is)S +2733(replaced)S +3107(by)S +3244(the)S +3403(userid)S +3684(allowing)S +4071(multiple)S +4442(users)S +4684(on)S +4821(a)S +4902(machine)S +5277(to)S +5392(have)S +1320 V +1260(independent)S +1778(sockets.)S +2157(The)S +2343(XImtool)S +2713('ism_addr')S +3182(resource)S +3550(or)S +3664("-ismdev")S +4099(command-line)S +4707(option)S +4994(can)S +5163(be)S +5288(used)S +5502(to)S +1440 V +1260(change)S +1585(this)S +1773(address,)S +2140(a)S +2227(value)S +2486(of)S +2612('none')S +2915(will)S +3114(disable)S +3440(ISM)S +3661(communications.)S +4420(The)S +4618(socket)S +4916(may)S +5130(also)S +5333(be)S +5469(set)S +1560 V +1260(with)S +1468(an)S +1592(ISMDEV)S +2005(environment)S +2540(variable)S +2891(which)S +3165(will)S +3351(override)S +3713(the)S +3865(resource)S +4232(or)S +4345(command-line)S +4952(options.)S +1800 V +1260(Once)S +1502(a)S +1578(connection)S +2048(request)S +2368(is)S +2467(received,)S +2891(XImtool)S +3262(replies)S +3560(with)S +3770(a)S +3846(message)S +4217(telling)S +4506(the)S +4661(ISM)S +4872(to)S +4983(reconnect)S +5403(on)S +5536(a)S +1920 V +1260(di)S +1338 H + (f)show 10 -.5 mul h (f)show +10 R +1399(erent)S +1629(socket,)S +1940(it)S +2027(then)S +2229(frees)S +2452(the)S +2604(initial)S +2868(connection)S +3336(allowing)S +3716(multiple)S +4080(other)S +4315(ISMs)S +4562(to)S +4670(request)S +4988(their)S +5201(own)S +5403(con-)S +2040 V +1260(nection.)S +1652(The)S +1850(communications)S +2554(between)S +2929(XImtool)S +3311(and)S +3499(the)S +3665(ISM)S +3887(are)S +4052(carried)S +4372(out)S +4544(entirely)S +4893(over)S +5114(this)S +5303(second)S +2160 V +1260(negotiated)S +1723(socket.)S +2079(Once)S +2335(connected,)S +2810(the)S +2978(ISM)S +3202(appears)S +3552(as)S +3681(just)S +3872(another)S +4217(named)S +4529(object)S +4819(which)S +5109(can)S +5293(receive)S +2280 V +1260(OBM)S +1518(messages.)S +2568 V +9 B +1080(COMMUNICATIONS)S +1987(PROTOCOL)S +2688 V +10 R +1260(Messages)S +1679(from)S +1904(the)S +2057(ISM)S +2266(are)S +2418(written)S +2732(to)S +2841(the)S +2994(connection)S +3463(socket)S +3749(and)S +3924(must)S +4150(be)S +4275(preceeded)S +4709(by)S +4841(one)S +5017(of)S +5132(the)S +5286(follow-)S +2808 V +1260(ing)S +1418(keywords:)S +2976 V +10 B +1620(callback)S +10 R +2370(Negotiate)S +2788(a)S +2862(connection)S +3330(on)S +3460(another)S +3789(socket)S +3144 V +10 B +1620(ready)S +10 R +2370(Client)S +2645(is)S +2742(ready)S +2993(to)S +3101(begin)S +3353(processing)S +3312 V +10 B +1620(quit)S +10 R +2370(Client)S +2645(is)S +2742(shutting)S +3095(down)S +3347(and)S +3521(disconnecting)S +3480 V +10 B +1620(send)S +10 R +2370(Send)S +2600(a)S +2674(message)S +3042(to)S +3150(another)S +3479(object)S +3816 V +1260(Where)S +1555(messages)S +1962(are)S +2113(of)S +2226(the)S +2378(form:)S +3984 V +10 B +1620(connect)S +1977(<)S +10 I +2034(name)S +10 B +2250(>)S +10 R +3120(Request)S +3472(a)S +3546(connection)S +4014(for)S +4160(the)S +4312(<)S +10 I +4368(name)S +10 R +4584(>)S +4670(ISM)S +4152 V +10 B +1620(ready)S +1894(<)S +10 I +1951(name)S +10 B +2167(>)S +10 R +3120(Reconnection)S +3720(request)S +4060(for)S +4228(the)S +4402(<)S +10 I +4458(name)S +10 R +4674(>)S +4782(ISM)S +5012(on)S +5164(negotiated)S +4272 V +3120(socket,)S +3430(ISM)S +3638(is)S +3735(ready)S +3986(to)S +4094(processing.)S +4440 V +10 B +1620(send)S +1845(<)S +10 I +1902(obj)S +10 B +2030(>)S +2117('{')S +2252(<)S +10 I +2309(msg)S +10 B +2470(>)S +2557('}')S +10 R +3120(Send)S +3352(<)S +10 I +3408(msg)S +10 R +3569(>)S +3657(to)S +3767(the)S +3921(named)S +4219(<)S +10 I +4275(obj)S +10 R +4403(>.)S +4546(The)S +4733(message)S +5104(may)S +5309(be)S +5436(any)S +4560 V +3120(valid)S +3366(string)S +3640(that)S +3835(will)S +4036(be)S +4175(understood)S +4664(by)S +4809(the)S +4976(recipient.)S +5425(The)S +4680 V +3120(object)S +3394(may)S +3596(be)S +3720(any)S +3894(object)S +4168(in)S +4276(the)S +4428(GUI)S +4635(or)S +4748(OBM)S +5006(\(see)S +5196(below\).)S +4848 V +10 B +1620(quit)S +10 R +3120(ISM)S +3341(is)S +3451(shutting)S +3817(down.)S +4107(The)S +4306(named)S +4616(is)S +4727(determined)S +5220(from)S +5458(the)S +4968 V +3120(communications)S +3865(channel,)S +4284(ISM)S +4546(is)S +4697(responsible)S +5236(for)S +5436(any)S +5088 V +3120(cleanup)S +3460(of)S +3573(it's)S +3731(callbacks)S +4132(before)S +4416(issuing)S +4730(the)S +4882(shutdown.)S +5328 V +1260(All)S +1420(messages)S +1829(must)S +2056(be)S +2182(null-terminated.)S +2885(XImtool)S +3256(will)S +3445(bu)S +3545 H + (f)show 10 -.5 mul h (f)show +10 R +3606(er)S +3716(the)S +3871(text)S +4054(until)S +4271(a)S +4348(complete)S +4747(message)S +5118(is)S +5218(received.)S +5448 V +1260(Once)S +1500(an)S +1624(ISM)S +1832(client)S +2084(has)S +2247(delivered)S +2648(a)S +2722(QUIT)S +2990(message)S +3358(no)S +3488(further)S +3789(messages)S +4196(will)S +4382(be)S +4506(sent)S +4697(the)S +4849(that)S +5029(ISM.)S +5688 V +1260(In)S +1384(OBM)S +1653(terminology)S +2183(the)S +2346(ISM)S +2565(is)S +2673(a)S +2758(named)S +3065(Client)S +3351(class)S +3586(object,)S +3896(where)S +4180(the)S +4343(name)S +4600(is)S +4708(set)S +4860(in)S +4979(the)S +5142(connection)S +5808 V +1260(request.)S +1637(Messages)S +2058(sent)S +2252(to)S +2363(the)S +2518(ISM)S +2729(should)S +3029(use)S +3195(this)S +3373(name,)S +3647(messages)S +4057(sent)S +4251(to)S +4362("client")S +4699(are)S +4853(still)S +5037(interpreted)S +5502(to)S +5928 V +1260(mean)S +1506(the)S +1658(XImtool)S +2027(client.)S +6168 V +1260(The)S +1450(content)S +1779(of)S +1897(messages)S +2309(delivered)S +2715(to)S +2828(the)S +2985(ISM)S +3198(are)S +3354(totally)S +3645(free-form)S +4061(and)S +4240(may)S +4447(contain)S +4776(any)S +4955(text)S +5141(the)S +5299(ISM)S +5513(is)S +6288 V +1260(expected)S +1644(to)S +1752(understand.)S +6576 V +9 B +1080(GUI)S +1277(OBJECTS)S +6696 V +10 R +1260(While)S +1548(the)S +1714(ISM)S +1936(can)S +2118(send)S +2345(a)S +2433(message)S +2815(to)S +2938(any)S +3127(object)S +3416(in)S +3539(the)S +3706(task,)S +3937(there)S +4181(is)S +4293(a)S +4382(GUI)S +4604(Parameter)S +5053(object)S +5342(called)S +6816 V +1260('ism_msg')S +1723(designed)S +2113(especially)S +2547(to)S +2660(process)S +2994(messages)S +3406(from)S +3634(the)S +3790(ISM.)S +4057(The)S +4246(callback)S +4612(in)S +4724(the)S +4880(GUI)S +5091(is)S +5192(expecting)S +6936 V +1260(a)S +1334(message)S +1702(beginning)S +2132(with)S +2340(one)S +2514(of)S +2627(the)S +2779(following)S +3198(keywords:)S +7104 V +10 B +1620(source)S +10 R +2370(Source)S +2677(message)S +3045(text)S +3225(as)S +3338(Tcl)S +3501(code)S +7272 V +10 B +1620(alert)S +10 R +2370(Message)S +2749(contains)S +3112(error)S +3335(text)S +3515(to)S +3623(be)S +3747(displayed)S +4160(in)S +4268(the)S +4420(GUI)S +4627('alert')S +4900(box)S +7752 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(25)S +7920 V +EP +%%Page: 26 27 +BP +/slant 0 def +/height 1.000000 def +10 R +10 R +480 V +900(XIMTOOL)S +1376(\()S +1425(1)S +1491(\))S +2787(USER COMMANDS )S +4956(XIMTOOL)S +5432(\()S +5481(1)S +5547(\))S +960 V +10 B +1620(deliver)S +10 R +2370(Message)S +2750(text)S +2931(should)S +3229(be)S +3354(passed)S +3651(to)S +3760(a)S +3835(callback)S +4198(routine)S +4512(speci\256c)S +4848(to)S +4957(that)S +5138(ISM.)S +5402(This)S +1080 V +2370(processing)S +2844(callback)S +3223(may)S +3442(have)S +3676(been)S +3910(previously)S +4378(uploaded.)S +4845(The)S +5046(message)S +5430(text)S +1200 V +2370(may)S +2572(be)S +2696(any)S +2870(form)S +3094(the)S +3246(processing)S +3703(callback)S +4065(is)S +4162(expected)S +4546(to)S +4654(understand.)S +1368 V +10 B +1620(info)S +10 R +2370(Message)S +2798(text)S +3027(is)S +3173(status)S +3480(output)S +3816(intended)S +4240(for)S +4436(the)S +4638(XImtool)S +5057('info')S +5364(panel)S +1488 V +2370(\(connect/disconnect)S +3198(requests,)S +3580(etc\))S +1728 V +1260(In)S +1373(all)S +1503(cases)S +1743(the)S +1895(message)S +2263(is)S +2360(expected)S +2744(to)S +2852(be)S +2976(of)S +3089(the)S +3241(form)S +1968 V +1525(<)S +10 I +1581(cmd)S +10 R +1747(>)S +1833(<)S +10 I +1889(ism_name)S +10 R +2294(>)S +2380([)S +2443(<)S +10 I +2499(arg1)S +10 R +2688(>)S +2774(<)S +10 I +2830(arg2)S +10 R +3019(>)S +3105(<...>)S +3322(])S +2208 V +1260(where)S +1539(<cmd>)S +1859(is)S +1962(one)S +2142(of)S +2261(the)S +2419(above)S +2693(keywords,)S +3142(<ism_name>)S +3701(is)S +3804(the)S +3963(name)S +4216(of)S +4336(the)S +4495(ISM)S +4710(sending)S +5058(the)S +5217(message.)S +2328 V +1260(The)S +1447(remainder)S +1883(of)S +1998(the)S +2152(message)S +2522(is)S +2621(passed)S +2919(as)S +3034(an)S +3160('argv')S +3435(list)S +3590(to)S +3700(the)S +3854(processing)S +4313(callback)S +4677(uploaded)S +5075(for)S +5223(the)S +5377(ISM.)S +2448 V +1260(The)S +1445(ISM)S +1653(is)S +1750(responsible)S +2235(for)S +2381(formatting)S +2833(these)S +3068(messages.)S +2856 V +9 B +900(ENVIRONMENT)S +2976 V +10 B +1260(HOME)S +10 R +2760(Speci\256es)S +3151(user)S +3347(login)S +3583(directory)S +3084 V +10 B +1260(DISPLAY)S +10 R +2760(Speci\256es)S +3151(which)S +3425(display)S +3744(screen)S +4028(to)S +4136(use)S +3192 V +10 B +1260(IMTOOLRC)S +1857(or)S +1981(imtoolrc)S +10 R +2760(Frame)S +3045(bu)S +3145 H + (f)show 10 -.5 mul h (f)show +10 R +3206(er)S +3313(con\256guration)S +3876(\256le)S +3300 V +10 B +1260(ISMDEV)S +10 R +2760(ISM)S +2968(Connection)S +3459(socket)S +3588 V +10 B +1260(DEBUG_IIS)S +10 R +2760(Debug)S +3056(IIS)S +3208(communications)S +3899(packets)S +3696 V +10 B +1260(DEBUG_ISM)S +10 R +2760(Debug)S +3056(ISM)S +3264(communications)S +3955(packets)S +3804 V +10 B +1260(DEBUG_MAPPINGS)S +10 R +2760(Debug)S +3056(WCS)S +3303(image)S +3577(mappings)S +4032 V +9 B +900(FILES)S +4152 V +10 B +1260(/usr/local/lib/imtoolrc)S +10 R +2760(Default)S +3089(frame)S +3351(bu)S +3451 H + (f)show 10 -.5 mul h (f)show +10 R +3512(er)S +3619(con\256guration)S +4182(\256le)S +4260 V +10 B +1260(/usr/local/lib/ximprint.cfg)S +10 R +2760(Default)S +3089(printer)S +3385(con\256guration)S +3948(\256le)S +4368 V +10 B +1260(/usr/local/lib/imtoolcmap)S +10 R +2760(Default)S +3089(colormap)S +3496(directory)S +4476 V +10 B +1260(/dev/imt1i)S +10 R +2760(Default)S +3089(input)S +3325(display)S +3644(\256fo)S +4584 V +10 B +1260(/dev/imt1o)S +10 R +2760(Default)S +3089(output)S +3375(display)S +3694(\256fo)S +4692 V +10 B +1260(/tmp/.IMT%d)S +10 R +2760(Default)S +3089(unix)S +3297(display)S +3616(socket)S +4800 V +10 B +1260(/tmp/.ISM%d)S +10 R +2760(Default)S +3089(unix)S +3297(ISM)S +3505(connection)S +3973(socket)S +5028 V +9 B +900(BUGS)S +5148 V +10 R +1260(Users)S +1517(should)S +1814(report)S +2082(bugs)S +2301(to)S +10 I +2409(iraf@noao.edu)S +10 R +3015(.)S +5436 V +9 B +900(SEE)S +1112(ALSO)S +5556 V +10 R +1260(xgterm\(1\),)S +1714(xtapemon\(1\))S +5844 V +9 B +900(COPYRIGHT)S +5964 V +10 R +1260(Copyright\(c\))S +1806(1986)S +2036(Association)S +2538(of)S +2651(Universities)S +3164(for)S +3310(Research)S +3705(in)S +3813(Astronomy)S +4293(Inc.)S +7680 V +900(X11IRAF Project)S +2703(Last change: 12 Aug 2001)S +5480(26)S +7920 V +EP +%%Trailer +%%DocumentFonts: Times-Roman Times-Bold Times-Italic Courier Symbol Troff +%%Pages: 27 + \ No newline at end of file diff --git a/vendor/x11iraf/ximtool/zscale.c b/vendor/x11iraf/ximtool/zscale.c new file mode 100644 index 00000000..b516a5ef --- /dev/null +++ b/vendor/x11iraf/ximtool/zscale.c @@ -0,0 +1,532 @@ +#include <stdio.h> +#include <math.h> + +/* + * ZSCALE -- Compute the optimal Z1, Z2 (range of greyscale values to be + * displayed) of an image. For efficiency a statistical subsample of an image + * is used. The pixel sample evenly subsamples the image in x and y. The + * entire image is used if the number of pixels in the image is smaller than + * the desired sample. + * + * The sample is accumulated in a buffer and sorted by greyscale value. + * The median value is the central value of the sorted array. The slope of a + * straight line fitted to the sorted sample is a measure of the standard + * deviation of the sample about the median value. Our algorithm is to sort + * the sample and perform an iterative fit of a straight line to the sample, + * using pixel rejection to omit gross deviants near the endpoints. The fitted + * straight line is the transfer function used to map image Z into display Z. + * If more than half the pixels are rejected the full range is used. The slope + * of the fitted line is divided by the user-supplied contrast factor and the + * final Z1 and Z2 are computed, taking the origin of the fitted line at the + * median value. + */ + +#define MIN_NPIXELS 5 /* smallest permissible sample */ +#define MAX_REJECT 0.5 /* max frac. of pixels to be rejected */ +#define GOOD_PIXEL 0 /* use pixel in fit */ +#define BAD_PIXEL 1 /* ignore pixel in all computations */ +#define REJECT_PIXEL 2 /* reject pixel after a bit */ +#define KREJ 2.5 /* k-sigma pixel rejection factor */ +#define MAX_ITERATIONS 5 /* maximum number of fitline iterations */ +#define INDEF 0 + +#define ZSC_DBG 0 + +#undef max +#define max(a,b) ((a) > (b) ? (a) : (b)) +#undef min +#define min(a,b) ((a) < (b) ? (a) : (b)) +#undef mod +#define mod(a,b) ((a) % (b)) +#undef nint +#define nint(a) ((int)(a + 0.5)) +#undef abs +#define abs(a) ((a) >= 0 ? (a) : -(a)) + + +static void flattenData(), subSample(); +static int sampleImage(), fitLine(), floatCompare(); +static int rejectPixels(), computeSigma(); + + + +/* ZSCALE -- Sample the image and compute optimal Z1 and Z2 values. + */ + +void +zscale (im, nx, ny, bitpix, z1, z2, contrast, opt_size, len_stdline) + +char *im; /* image data to be sampled */ +int nx, ny; /* image dimensions */ +int bitpix; /* bits per pixel */ +float *z1, *z2; /* output min and max greyscale values */ +float contrast; /* adj. to slope of transfer function */ +int opt_size; /* desired number of pixels in sample */ +int len_stdline; /* optimal number of pixels per line */ +{ + register int npix, minpix, ngoodpix, center_pixel, ngrow; + float zmin, zmax, median; + float zstart, zslope; + float *sample, *left; + + /* Subsample the image. */ + npix = sampleImage(im, bitpix, &sample, nx, ny, opt_size, len_stdline); + + /* Sort the sample, compute the minimum, maximum, and median pixel + * values. + */ + qsort (sample, npix, sizeof (float), floatCompare); + zmin = *sample; + zmax = *(sample+npix-1); + + /* The median value is the average of the two central values if there + * are an even number of pixels in the sample. + */ + center_pixel = max (1, (npix + 1) / 2); + left = &(sample[center_pixel - 1]); + if (mod (npix, 2) == 1 || center_pixel >= npix) + median = *left; + else + median = (*left + *(left+1)) / 2; + + /* Fit a line to the sorted sample vector. If more than half of the + * pixels in the sample are rejected give up and return the full range. + * If the user-supplied contrast factor is not 1.0 adjust the scale + * accordingly and compute Z1 and Z2, the y intercepts at indices 1 and + * npix. + */ + minpix = max (MIN_NPIXELS, (int) (npix * MAX_REJECT)); + ngrow = max (1, nint (npix * .01)); + ngoodpix = fitLine (sample, npix, &zstart, &zslope, + KREJ, ngrow, MAX_ITERATIONS); + + if (ngoodpix < minpix) { + *z1 = zmin; + *z2 = zmax; + } else { + if (contrast > 0) + zslope = zslope / contrast; + *z1 = max (zmin, median - (center_pixel - 1) * zslope); + *z2 = min (zmax, median + (npix - center_pixel) * zslope); + } + + if (ZSC_DBG) { + printf ("\tzmin=%g zmax=%g\tleft=%g median=%g\n", + zmin, zmax, *left, median); + printf ("\tminpix=%d ngrow=%d ngood=%d\n", minpix,ngrow,ngoodpix); + printf ("\tzstart=%g zslope=%g\n\tz1=%g z2=%g\n", + zstart, zslope, *z1, *z2); + } + + /* Clean up. */ + free ((float *)sample); +} + + +/* sampleImage -- Extract an evenly gridded subsample of the pixels from + * a two-dimensional image into a one-dimensional vector. + */ + +static int +sampleImage (im, bitpix, sample, nx, ny, optimal_size, len_stdline) + +char *im; /* image to be sampled */ +int bitpix; /* bits per pixel in image */ +float **sample; /* output vector containing the sample */ +int nx, ny; /* image dimensions */ +int optimal_size; /* desired number of pixels in sample */ +int len_stdline; /* optimal number of pixels per line */ +{ + register int i; + int ncols, nlines, col_step, line_step, maxpix, line; + int opt_npix_per_line, npix_per_line, npix = 0; + int opt_nlines_in_sample, min_nlines_in_sample, max_nlines_in_sample; + float *op, *row; + int *ipix; + float *fpix; + double *dpix; + short *spix; + char *bpix; + + + ncols = nx; + nlines = ny; + + /* Compute the number of pixels each line will contribute to the sample, + * and the subsampling step size for a line. The sampling grid must + * span the whole line on a uniform grid. + */ + opt_npix_per_line = max (1, min (ncols, len_stdline)); + col_step = max (2, (ncols + opt_npix_per_line-1) / opt_npix_per_line); + npix_per_line = max (1, (ncols + col_step-1) / col_step); + + /* Compute the number of lines to sample and the spacing between lines. + * We must ensure that the image is adequately sampled despite its + * size, hence there is a lower limit on the number of lines in the + * sample. We also want to minimize the number of lines accessed when + * accessing a large image, because each disk seek and read is ex- + * pensive. The number of lines extracted will be roughly the sample + * size divided by len_stdline, possibly more if the lines are very + * short. + */ + min_nlines_in_sample = max (1, optimal_size / len_stdline); + opt_nlines_in_sample = max(min_nlines_in_sample, min(nlines, + (optimal_size + npix_per_line-1) / npix_per_line)); + line_step = max (2, nlines / (opt_nlines_in_sample)); + max_nlines_in_sample = (nlines + line_step-1) / line_step; + + /* Allocate space for the output vector. Buffer must be freed by our + * caller. + */ + maxpix = npix_per_line * max_nlines_in_sample; + *sample = (float *) malloc (maxpix * sizeof (float)); + row = (float *) malloc (nx * sizeof (float)); + + /* Extract the vector. */ + op = *sample; + for (line = (line_step + 1)/2; line < nlines; line+=line_step) { + /* Load a row of float values from the image */ + switch (bitpix) { + case 8: + bpix = (char *) &im[(line-1) * nx * sizeof(char)]; + for (i=0; i < nx; i++) + row[i] = (float) bpix[i]; + break; + case 16: + spix = (short *) &im[(line-1) * nx * sizeof(short)]; + for (i=0; i < nx; i++) + row[i] = (float) spix[i]; + break; + case 32: + ipix = (int *) &im[(line-1) * nx * sizeof(int)]; + for (i=0; i < nx; i++) + row[i] = (float) ipix[i]; + break; + case -32: + fpix = (float *) &im[(line-1) * nx * sizeof(float)]; + for (i=0; i < nx; i++) + row[i] = (float) fpix[i]; + break; + case -64: + dpix = (double *) &im[(line-1) * nx * sizeof(double)]; + for (i=0; i < nx; i++) + row[i] = (float) dpix[i]; + break; + } + + subSample (row, op, npix_per_line, col_step); + op += npix_per_line; + npix += npix_per_line; + if (npix > maxpix) + break; + } + + free ((float *)row); + return (npix); +} + + +/* subSample -- Subsample an image line. Extract the first pixel and + * every "step"th pixel thereafter for a total of npix pixels. + */ + +static void +subSample (a, b, npix, step) +float *a; +float *b; +int npix, step; +{ + register int ip, i; + + if (step <= 1) + memmove (b, a, npix); + else { + ip = 0; + for (i=0; i < npix; i++) { + b[i] = a[ip]; + ip += step; + } + } +} + + +/* fitLine -- Fit a straight line to a data array of type real. This is + * an iterative fitting algorithm, wherein points further than ksigma from the + * current fit are excluded from the next fit. Convergence occurs when the + * next iteration does not decrease the number of pixels in the fit, or when + * there are no pixels left. The number of pixels left after pixel rejection + * is returned as the function value. + */ + +static int +fitLine (data, npix, zstart, zslope, krej, ngrow, maxiter) + +float *data; /* data to be fitted */ +int npix; /* number of pixels before rejection */ +float *zstart; /* Z-value of pixel data[1] (output) */ +float *zslope; /* dz/pixel (output) */ +float krej; /* k-sigma pixel rejection factor */ +int ngrow; /* number of pixels of growing */ +int maxiter; /* max iterations */ +{ + int i, ngoodpix, last_ngoodpix, minpix, niter; + double xscale, z0, dz, o_dz, x, z, mean, sigma, threshold; + double sumxsqr, sumxz, sumz, sumx, rowrat; + float *flat, *normx; + char *badpix; + + if (npix <= 0) + return (0); + else if (npix == 1) { + *zstart = data[1]; + *zslope = 0.0; + return (1); + } else + xscale = 2.0 / (npix - 1); + + /* Allocate a buffer for data minus fitted curve, another for the + * normalized X values, and another to flag rejected pixels. + */ + flat = (float *) malloc (npix * sizeof (float)); + normx = (float *) malloc (npix * sizeof (float)); + badpix = (char *) calloc (npix, sizeof(char)); + + /* Compute normalized X vector. The data X values [1:npix] are + * normalized to the range [-1:1]. This diagonalizes the lsq matrix + * and reduces its condition number. + */ + for (i=0; i<npix; i++) + normx[i] = i * xscale - 1.0; + + /* Fit a line with no pixel rejection. Accumulate the elements of the + * matrix and data vector. The matrix M is diagonal with + * M[1,1] = sum x**2 and M[2,2] = ngoodpix. The data vector is + * DV[1] = sum (data[i] * x[i]) and DV[2] = sum (data[i]). + */ + sumxsqr = 0; + sumxz = 0; + sumx = 0; + sumz = 0; + + for (i=0; i<npix; i++) { + x = normx[i]; + z = data[i]; + sumxsqr = sumxsqr + (x * x); + sumxz = sumxz + z * x; + sumz = sumz + z; + } + + /* Solve for the coefficients of the fitted line. */ + z0 = sumz / npix; + dz = o_dz = sumxz / sumxsqr; + + if (ZSC_DBG) { + printf ("fitLine:\n\tz0=%g dz=%g\n", z0, dz); + printf ("\tsumz=%g sumxz=%g sumxsqr=%g npix=%d zscale=%g\n\n", + sumz, sumxz, sumxsqr, npix, xscale); + } + + /* Iterate, fitting a new line in each iteration. Compute the flattened + * data vector and the sigma of the flat vector. Compute the lower and + * upper k-sigma pixel rejection thresholds. Run down the flat array + * and detect pixels to be rejected from the fit. Reject pixels from + * the fit by subtracting their contributions from the matrix sums and + * marking the pixel as rejected. + */ + ngoodpix = npix; + minpix = max (MIN_NPIXELS, (int) (npix * MAX_REJECT)); + + for (niter=0; niter < maxiter; niter++) { + last_ngoodpix = ngoodpix; + + /* Subtract the fitted line from the data array. */ + flattenData (data, flat, normx, npix, z0, dz); + + /* Compute the k-sigma rejection threshold. In principle this + * could be more efficiently computed using the matrix sums + * accumulated when the line was fitted, but there are problems with + * numerical stability with that approach. + */ + ngoodpix = computeSigma (flat, badpix, npix, &mean, &sigma); + threshold = sigma * krej; + + /* Detect and reject pixels further than ksigma from the fitted + * line. + */ + ngoodpix = rejectPixels (data, flat, normx, + badpix, npix, &sumxsqr, &sumxz, &sumx, &sumz, threshold, + ngrow); + + /* Solve for the coefficients of the fitted line. Note that after + * pixel rejection the sum of the X values need no longer be zero. + */ + if (ngoodpix > 0) { + rowrat = sumx / sumxsqr; + z0 = (sumz - rowrat * sumxz) / (ngoodpix - rowrat * sumx); + dz = (sumxz - z0 * sumx) / sumxsqr; + } + + if (ngoodpix >= last_ngoodpix || ngoodpix < minpix) + break; + } + + if (ZSC_DBG) { printf ("\tz0=%g dz=%g rowrat=%g\n", z0, dz, rowrat); } + + /* Transform the line coefficients back to the X range [1:npix]. */ + *zstart = z0 - dz; + *zslope = dz * xscale; + if (abs(*zslope) < 0.01) + *zslope = o_dz * xscale; + + free ((float *)flat); + free ((float *)normx); + free ((char *)badpix); + return (ngoodpix); +} + + +/* flattenData -- Compute and subtract the fitted line from the data array, + * returned the flattened data in FLAT. + */ + +static void +flattenData (data, flat, x, npix, z0, dz) +float *data; /* raw data array */ +float *flat; /* flattened data (output) */ +float *x; /* x value of each pixel */ +int npix; /* number of pixels */ +double z0, dz; /* z-intercept, dz/dx of fitted line */ +{ + register int i; + + for (i=0; i < npix; i++) + flat[i] = data[i] - (x[i] * dz + z0); +} + + +/* computeSigma -- Compute the root mean square deviation from the + * mean of a flattened array. Ignore rejected pixels. + */ + +static int +computeSigma (a, badpix, npix, mean, sigma) + +float *a; /* flattened data array */ +char *badpix; /* bad pixel flags (!= 0 if bad pixel) */ +int npix; +double *mean, *sigma; /* (output) */ +{ + float pixval; + int i, ngoodpix = 0; + double sum = 0.0, sumsq = 0.0, temp; + + /* Accumulate sum and sum of squares. */ + for (i=0; i < npix; i++) { + if (badpix[i] == GOOD_PIXEL) { + pixval = a[i]; + ngoodpix = ngoodpix + 1; + sum = sum + pixval; + sumsq = sumsq + pixval * pixval; + } + } + + /* Compute mean and sigma. */ + switch (ngoodpix) { + case 0: + *mean = INDEF; + *sigma = INDEF; + break; + case 1: + *mean = sum; + *sigma = INDEF; + break; + default: + *mean = sum / (double) ngoodpix; + temp = sumsq / (double) (ngoodpix-1) - + (sum*sum) / (double) (ngoodpix*(ngoodpix - 1)); + if (temp < 0) /* possible with roundoff error */ + *sigma = 0.0; + else + *sigma = sqrt (temp); + } + + return (ngoodpix); +} + + +/* rejectPixels -- Detect and reject pixels more than "threshold" greyscale + * units from the fitted line. The residuals about the fitted line are given + * by the "flat" array, while the raw data is in "data". Each time a pixel + * is rejected subtract its contributions from the matrix sums and flag the + * pixel as rejected. When a pixel is rejected reject its neighbors out to + * a specified radius as well. This speeds up convergence considerably and + * produces a more stringent rejection criteria which takes advantage of the + * fact that bad pixels tend to be clumped. The number of pixels left in the + * fit is returned as the function value. + */ + +static int +rejectPixels (data, flat, normx, badpix, npix, + sumxsqr, sumxz, sumx, sumz, threshold, ngrow) + +float *data; /* raw data array */ +float *flat; /* flattened data array */ +float *normx; /* normalized x values of pixels */ +char *badpix; /* bad pixel flags (!= 0 if bad pixel) */ +int npix; +double *sumxsqr, *sumxz, /* matrix sums */ + *sumx, *sumz; +double threshold; /* threshold for pixel rejection */ +int ngrow; /* number of pixels of growing */ +{ + int ngoodpix, i, j; + double residual, lcut, hcut; + double x, z; + + ngoodpix = npix; + lcut = -threshold; + hcut = threshold; + + for (i=0; i < npix; i++) { + if (badpix[i] == BAD_PIXEL) + ngoodpix = ngoodpix - 1; + else { + residual = flat[i]; + if (residual < lcut || residual > hcut) { + /* Reject the pixel and its neighbors out to the growing + * radius. We must be careful how we do this to avoid + * directional effects. Do not turn off thresholding on + * pixels in the forward direction; mark them for rejection + * but do not reject until they have been thresholded. + * If this is not done growing will not be symmetric. + */ + for (j=max(0,i-ngrow); j < min(npix,i+ngrow); j++) { + if (badpix[j] != BAD_PIXEL) { + if (j <= i) { + x = (double) normx[j]; + z = (double) data[j]; + *sumxsqr = *sumxsqr - (x * x); + *sumxz = *sumxz - z * x; + *sumx = *sumx - x; + *sumz = *sumz - z; + badpix[j] = BAD_PIXEL; + ngoodpix = ngoodpix - 1; + } else + badpix[j] = REJECT_PIXEL; + } + } + } + } + } + + return (ngoodpix); +} + + +static int +floatCompare (i,j) +float *i, *j; +{ + /* return ((int) (*i - *j + 0.5)); */ + return ((*i <= *j) ? -1 : 1); +} diff --git a/vendor/x11iraf/xpm/Imakefile b/vendor/x11iraf/xpm/Imakefile new file mode 100644 index 00000000..9a62403d --- /dev/null +++ b/vendor/x11iraf/xpm/Imakefile @@ -0,0 +1,147 @@ +# Copyright 1990-93 GROUPE BULL -- See licence conditions in file COPYRIGHT +# +# XPM Imakefile - Arnaud LE HORS +# + +# SGI requires a specification file for shared library that we don't have +#ifdef SGIArchitecture +#define DoSharedLib No +#else +############## X11IRAF - we don't want shared libraries. +# #define DoSharedLib SharedLibX +#define DoSharedLib NO +#endif + +#ifdef RsArchitecture +REQUIREDLIBS = -lXext -lXt -lX11 +#endif + +# on Dec Alpha we need to define the following to build the shared library +#ifdef AlphaArchitecture +SO_REQLIBS=-lX11 -lc +#endif + +## if your system doesn't provide strcasecmp add -DNEED_STRCASECMP +## if your system doesn't provide strdup add -DNEED_STRDUP +## if your system doesn't provide pipe remove -DZPIPE + +#if defined(UltrixArchitecture) || \ + (defined(MipsArchitecture) && !defined(SGIArchitecture)) +DEFINES = -DZPIPE -DNEED_STRDUP +#else +DEFINES = -DZPIPE +#endif + + +# Normally the following part should not need to be edited +# + +############## X11IRAF - always build normal library. +# #define DoNormalLib NormalLibX +#define DoNormalLib YES + +#if (ProjectX < 5) + STD_DEFINES = LibraryDefines + CDEBUGFLAGS = LibraryCDebugFlags +#else +/* R5 needs another .tmpl file to find these #def's. This .tmpl file will */ +/* also set STD_DEFINES and CDEBUGFLAGS properly. */ +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> +#endif + +#if defined(RsArchitecture) +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> +#endif + + INCLUDES = -I. +#if !defined (SGIArchitecture) + INSTALLFLAGS = $(INSTINCFLAGS) +#endif + LINTLIBS = $(LINTXTOLL) $(LINTXLIB) + +#ifdef OsNameDefines + OS_NAME_DEFINES = OsNameDefines +#endif + +# get the version numbers from the xpm include file +#define XPM_NUMBERS +#include "xpm.h" +SOXPMLIBREV = XpmVersion./**/XpmRevision + +HEADERS = xpm.h xpmP.h + SRCS = data.c create.c misc.c rgb.c scan.c parse.c hashtable.c \ + XpmCrBufFrI.c XpmCrDataFrP.c XpmCrPFrBuf.c XpmRdFToI.c XpmWrFFrI.c \ + XpmCrBufFrP.c XpmCrIFrBuf.c XpmCrPFrData.c XpmRdFToP.c XpmWrFFrP.c \ + XpmCrDataFrI.c XpmCrIFrData.c XpmRdFToData.c XpmWrFFrData.c strdup.c + + OBJS = data.o create.o misc.o rgb.o scan.o parse.o hashtable.o \ + XpmCrBufFrI.o XpmCrDataFrP.o XpmCrPFrBuf.o XpmRdFToI.o XpmWrFFrI.o \ + XpmCrBufFrP.o XpmCrIFrBuf.o XpmCrPFrData.o XpmRdFToP.o XpmWrFFrP.o \ + XpmCrDataFrI.o XpmCrIFrData.o XpmRdFToData.o XpmWrFFrData.o strdup.o + +#if (ProjectX < 5) + +#if DoSharedLib + SharedLibraryObjectRule() + NormalSharedLibraryTarget(Xpm,$(SOXPMLIBREV),$(OBJS)) + InstallSharedLibrary(Xpm,$(SOXPMLIBREV),X11irafLibDir) +#else + NormalLibraryObjectRule() +#endif + NormalLibraryTarget(Xpm,$(OBJS)) +#if InstallLibraries + InstallLibrary(Xpm,X11irafLibDir) +#endif + +#else + +all:: libXpm.a + + LibraryObjectRule() + +#if DoSharedLib +#if DoNormalLib + SharedLibraryTarget(Xpm,$(SOXPMLIBREV),$(OBJS),shared,..) +#else + SharedLibraryTarget(Xpm,$(SOXPMLIBREV),$(OBJS),.,.) +#endif + InstallSharedLibrary(Xpm,$(SOXPMLIBREV),X11irafLibDir) +#endif +#if DoNormalLib + NormalLibraryTarget(Xpm,$(OBJS)) +#if InstallLibraries +install:: libXpm.a + @(set -x; $(RM) X11irafLibDir/libXpm.a) + @(set -x; $(CP) -p libXpm.a X11irafLibDir/libXpm.a) +#endif +#endif + +#endif + +LinkFileList(linklibs,libXpm.a,X11irafLibDir,XpmDir) + +includes:: + MakeDir(X11irafIncDir) + MakeDir(X11irafIncDir/X11) + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/$$i; \ + $(CP) -p $$i X11irafIncDir/$$i; \ + $(RM) X11irafIncDir/X11/$$i; \ + $(CP) -p $$i X11irafIncDir/X11/$$i; \ + done) + +#if InstallIncludes +install:: + @(set -x; for i in $(HEADERS); do \ + $(RM) X11irafIncDir/$$i; \ + $(CP) -p $$i X11irafIncDir; \ + done) +#endif + +LintLibraryTarget(Xpm,$(SRCS)) +InstallLintLibrary(Xpm,$(LINTLIBDIR)) +DependTarget() +NormalLintTarget($(SRCS)) + diff --git a/vendor/x11iraf/xpm/README b/vendor/x11iraf/xpm/README new file mode 100644 index 00000000..0b93eff2 --- /dev/null +++ b/vendor/x11iraf/xpm/README @@ -0,0 +1,2 @@ +# XPM -- This directory (and the doc and icons subdirectories) does not +# contain the full XPM distribution, as X11IRAF uses only the XPM library. diff --git a/vendor/x11iraf/xpm/XpmCrBufFrI.c b/vendor/x11iraf/xpm/XpmCrBufFrI.c new file mode 100644 index 00000000..b9665aab --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrBufFrI.c @@ -0,0 +1,331 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrBufFrI.c: * +* * +* XPM library * +* Scan an image and possibly its mask and create an XPM buffer * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:string.h" +#else +#if defined(SYSV) || defined(SVR4) +#include <string.h> +#else +#include <strings.h> +#endif +#endif + +LFUNC(WriteColors, int, (char **dataptr, unsigned int *data_size, + unsigned int *used_size, XpmColor *colors, + unsigned int ncolors, unsigned int cpp)); + +LFUNC(WritePixels, void, (char *dataptr, unsigned int *used_size, + unsigned int width, unsigned int height, + unsigned int cpp, unsigned int *pixels, + XpmColor *colors)); + +LFUNC(WriteExtensions, void, (char *dataptr, unsigned int *used_size, + XpmExtension *ext, unsigned int num)); + +LFUNC(ExtensionsSize, int, (XpmExtension *ext, unsigned int num)); +LFUNC(CommentsSize, int, (XpmInfos *infos)); + +int +XpmCreateBufferFromImage(display, buffer_return, image, shapeimage, attributes) + Display *display; + char **buffer_return; + XImage *image; + XImage *shapeimage; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage xpmimage; + + /* + * initialize return value + */ + if (buffer_return) + *buffer_return = NULL; + + /* + * Scan image then create data + */ + ErrorStatus = XpmCreateXpmImageFromImage(display, image, shapeimage, + &xpmimage, attributes); + + if (ErrorStatus == XpmSuccess) + ErrorStatus = XpmCreateBufferFromXpmImage(buffer_return, &xpmimage, + attributes, NULL); + XpmFreeXpmImage(&xpmimage); + + return (ErrorStatus); +} + + +#undef RETURN +#define RETURN(status) \ +{ \ + if (ptr) \ + XpmFree(ptr); \ + return(status); \ +} + +int +XpmCreateBufferFromXpmImage(buffer_return, image, attributes, infos) + char **buffer_return; + XpmImage *image; + XpmAttributes *attributes; + XpmInfos *infos; +{ + /* calculation variables */ + int ErrorStatus; + char buf[BUFSIZ]; + unsigned int extensions = 0, ext_size = 0; + unsigned int l, cmt_size = 0; + char *ptr = NULL, *p; + unsigned int ptr_size, used_size; + + *buffer_return = NULL; + + extensions = attributes && (attributes->valuemask & XpmExtensions) + && attributes->nextensions; + + /* compute the extensions and comments size */ + if (extensions) + ext_size = ExtensionsSize(attributes->extensions, + attributes->nextensions); + if (infos) + cmt_size = CommentsSize(infos); + + /* + * write the header line + */ + sprintf(buf, "/* XPM */\nstatic char * image_name[] = {\n"); + used_size = strlen(buf); + ptr_size = used_size + ext_size + cmt_size + 1; + ptr = (char *) XpmMalloc(ptr_size); + if (!ptr) + return XpmNoMemory; + strcpy(ptr, buf); + + /* + * write the values line + */ + if (infos && infos->hints_cmt) { + sprintf(ptr + used_size, "/*%s*/\n", infos->hints_cmt); + used_size += strlen(infos->hints_cmt) + 5; + } + sprintf(buf, "\"%d %d %d %d", image->width, image->height, + image->ncolors, image->cpp); + l = strlen(buf); + + if (attributes && (attributes->valuemask & XpmHotspot)) { + sprintf(buf + l, " %d %d", + attributes->x_hotspot, attributes->y_hotspot); + l = strlen(buf); + } + if (extensions) { + sprintf(buf + l, " XPMEXT"); + l = strlen(buf); + } + sprintf(buf + l, "\",\n"); + l = strlen(buf); + ptr_size += l; + p = (char *) XpmRealloc(ptr, ptr_size); + if (!p) + RETURN(XpmNoMemory); + ptr = p; + strcpy(ptr + used_size, buf); + used_size += l; + + /* + * write colors + */ + if (infos && infos->colors_cmt) { + sprintf(ptr + used_size, "/*%s*/\n", infos->colors_cmt); + used_size += strlen(infos->colors_cmt) + 5; + } + ErrorStatus = WriteColors(&ptr, &ptr_size, &used_size, + image->colorTable, image->ncolors, image->cpp); + + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + /* + * now we know the exact size we needed, realloc the data 4 = 1 (for + * '"') + 3 (for '",\n') 1 = - 2 is because the last line does not end + * with ',\n' + 3 (for '};\n') + */ + ptr_size += image->height * (image->width * image->cpp + 4) + 1; + + p = (char *) XpmRealloc(ptr, ptr_size); + if (!p) + RETURN(XpmNoMemory); + ptr = p; + + /* + * print pixels + */ + if (infos && infos->pixels_cmt) { + sprintf(ptr + used_size, "/*%s*/\n", infos->pixels_cmt); + used_size += strlen(infos->pixels_cmt) + 5; + } + WritePixels(ptr + used_size, &used_size, image->width, image->height, + image->cpp, image->data, image->colorTable); + + /* + * print extensions + */ + if (extensions) + WriteExtensions(ptr + used_size, &used_size, + attributes->extensions, attributes->nextensions); + + /* close the array */ + sprintf(ptr + used_size, "};\n"); + + *buffer_return = ptr; + + return (XpmSuccess); +} + +static int +WriteColors(dataptr, data_size, used_size, colors, ncolors, cpp) + char **dataptr; + unsigned int *data_size; + unsigned int *used_size; + XpmColor *colors; + unsigned int ncolors; + unsigned int cpp; +{ + char buf[BUFSIZ]; + unsigned int a, key, l; + char *s, *s2; + xpmColorDefaults defaults; + + *buf = '"'; + for (a = 0; a < ncolors; a++, colors++) { + + defaults = (xpmColorDefaults) colors; + s = buf + 1; + strncpy(s, *defaults++, cpp); + s += cpp; + + for (key = 1; key <= NKEYS; key++, defaults++) { + if (s2 = *defaults) { + sprintf(s, "\t%s %s", xpmColorKeys[key - 1], s2); + s += strlen(s); + } + } + strcpy(s, "\",\n"); + l = strlen(buf); + s = (char *) XpmRealloc(*dataptr, *data_size + l); + if (!s) + return (XpmNoMemory); + *data_size += l; + strcpy(s + *used_size, buf); + *used_size += l; + *dataptr = s; + } + return (XpmSuccess); +} + +static void +WritePixels(dataptr, used_size, width, height, cpp, pixels, colors) + char *dataptr; + unsigned int *used_size; + unsigned int width; + unsigned int height; + unsigned int cpp; + unsigned int *pixels; + XpmColor *colors; +{ + char *s = dataptr; + unsigned int x, y, h; + + h = height - 1; + for (y = 0; y < h; y++) { + *s++ = '"'; + for (x = 0; x < width; x++, pixels++) { + strncpy(s, colors[*pixels].string, cpp); + s += cpp; + } + strcpy(s, "\",\n"); + s += 3; + } + /* duplicate some code to avoid a test in the loop */ + *s++ = '"'; + for (x = 0; x < width; x++, pixels++) { + strncpy(s, colors[*pixels].string, cpp); + s += cpp; + } + *s++ = '"'; + *used_size += s - dataptr; +} + +static int +ExtensionsSize(ext, num) + XpmExtension *ext; + unsigned int num; +{ + unsigned int x, y, a, size; + char **line; + + size = 0; + for (x = 0; x < num; x++, ext++) { + /* 11 = 10 (for ',\n"XPMEXT ') + 1 (for '"') */ + size += strlen(ext->name) + 11; + a = ext->nlines; + for (y = 0, line = ext->lines; y < a; y++, line++) + /* 4 = 3 (for ',\n"') + 1 (for '"') */ + size += strlen(*line) + 4; + } + /* 13 is for ',\n"XPMENDEXT"' */ + return size + 13; +} + +static void +WriteExtensions(dataptr, used_size, ext, num) + char *dataptr; + unsigned int *used_size; + XpmExtension *ext; + unsigned int num; +{ + unsigned int x, y, a; + char **line; + char *s = dataptr; + + for (x = 0; x < num; x++, ext++) { + sprintf(s, ",\n\"XPMEXT %s\"", ext->name); + s += strlen(ext->name) + 11; + a = ext->nlines; + for (y = 0, line = ext->lines; y < a; y++, line++) { + sprintf(s, ",\n\"%s\"", *line); + s += strlen(*line) + 4; + } + } + strcpy(s, ",\n\"XPMENDEXT\""); + *used_size += s - dataptr + 13; +} + +static int +CommentsSize(infos) + XpmInfos *infos; +{ + int size = 0; + + /* 5 = 2 (for "/_*") + 3 (for "*_/\n") */ + if (infos->hints_cmt) + size += 5 + strlen(infos->hints_cmt); + + if (infos->colors_cmt) + size += 5 + strlen(infos->colors_cmt); + + if (infos->pixels_cmt) + size += 5 + strlen(infos->pixels_cmt); + + return size; +} diff --git a/vendor/x11iraf/xpm/XpmCrBufFrP.c b/vendor/x11iraf/xpm/XpmCrBufFrP.c new file mode 100644 index 00000000..192f8b60 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrBufFrP.c @@ -0,0 +1,48 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrBufFrP.c: * +* * +* XPM library * +* Scan a pixmap and possibly its mask and create an XPM buffer * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:string.h" +#else +#if defined(SYSV) || defined(SVR4) +#include <string.h> +#else +#include <strings.h> +#endif +#endif + +int +XpmCreateBufferFromPixmap(display, buffer_return, pixmap, shapemask, + attributes) + Display *display; + char **buffer_return; + Pixmap pixmap; + Pixmap shapemask; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage image; + + /* + * get the XpmImage + */ + ErrorStatus = XpmCreateXpmImageFromPixmap(display, pixmap, shapemask, + &image, attributes); + if (ErrorStatus == XpmSuccess) { + /* + * create the buffer from the XpmImage + */ + ErrorStatus = XpmCreateBufferFromXpmImage(buffer_return, &image, + attributes, NULL); + XpmFreeXpmImage(&image); + } + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmCrDataFrI.c b/vendor/x11iraf/xpm/XpmCrDataFrI.c new file mode 100644 index 00000000..6fcbba4b --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrDataFrI.c @@ -0,0 +1,313 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrDataFI.c: * +* * +* XPM library * +* Scan an image and possibly its mask and create an XPM array * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:string.h" +#else +#if defined(SYSV) || defined(SVR4) +#include <string.h> +#else +#include <strings.h> +#endif +#endif + + +LFUNC(CreateColors, int, (char **dataptr, unsigned int *data_size, + XpmColor *colors, unsigned int ncolors, + unsigned int cpp)); + +LFUNC(CreatePixels, void, (char **dataptr, unsigned int width, + unsigned int height, unsigned int cpp, + unsigned int *pixels, XpmColor *colors)); + +LFUNC(CountExtensions, void, (XpmExtension *ext, unsigned int num, + unsigned int *ext_size, + unsigned int *ext_nlines)); + +LFUNC(CreateExtensions, void, (char **dataptr, unsigned int offset, + XpmExtension *ext, unsigned int num, + unsigned int ext_nlines)); + +int +XpmCreateDataFromImage(display, data_return, image, shapeimage, attributes) + Display *display; + char ***data_return; + XImage *image; + XImage *shapeimage; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage xpmimage; + + /* + * initialize return value + */ + if (data_return) + *data_return = NULL; + + /* + * Scan image then create data + */ + ErrorStatus = XpmCreateXpmImageFromImage(display, image, shapeimage, + &xpmimage, attributes); + + if (ErrorStatus == XpmSuccess) + ErrorStatus = XpmCreateDataFromXpmImage(data_return, &xpmimage, + attributes); + XpmFreeXpmImage(&xpmimage); + + return (ErrorStatus); +} + +#undef RETURN +#define RETURN(status) \ +{ \ + if (header) { \ + for (l = 0; l < header_nlines; l++) \ + if (header[l]) \ + XpmFree(header[l]); \ + XpmFree(header); \ + } \ + return(status); \ +} + +int +XpmCreateDataFromXpmImage(data_return, image, attributes) + char ***data_return; + XpmImage *image; + XpmAttributes *attributes; +{ + /* calculation variables */ + int ErrorStatus; + char buf[BUFSIZ]; + char **header = NULL, **data, **sptr, **sptr2, *s; + unsigned int header_size, header_nlines; + unsigned int data_size, data_nlines; + unsigned int extensions = 0, ext_size = 0, ext_nlines = 0; + unsigned int offset, l, n; + + *data_return = NULL; + + extensions = attributes && (attributes->valuemask & XpmExtensions) + && attributes->nextensions; + + /* compute the number of extensions lines and size */ + if (extensions) + CountExtensions(attributes->extensions, attributes->nextensions, + &ext_size, &ext_nlines); + + /* + * alloc a temporary array of char pointer for the header section which + * is the hints line + the color table lines + */ + header_nlines = 1 + image->ncolors; + header_size = sizeof(char *) * header_nlines; + header = (char **) XpmCalloc(header_size, sizeof(char *)); + if (!header) + return (XpmNoMemory); + + /* + * print the hints line + */ + s = buf; + sprintf(s, "%d %d %d %d", image->width, image->height, + image->ncolors, image->cpp); + s += strlen(s); + + if (attributes && (attributes->valuemask & XpmHotspot)) { + sprintf(s, " %d %d", attributes->x_hotspot, attributes->y_hotspot); + s += strlen(s); + } + if (extensions) + sprintf(s, " XPMEXT"); + + l = strlen(buf) + 1; + *header = (char *) XpmMalloc(l); + if (!*header) + RETURN(XpmNoMemory); + header_size += l; + strcpy(*header, buf); + + /* + * print colors + */ + ErrorStatus = CreateColors(header + 1, &header_size, + image->colorTable, image->ncolors, image->cpp); + + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + /* + * now we know the size needed, alloc the data and copy the header lines + */ + offset = image->width * image->cpp + 1; + data_size = header_size + (image->height + ext_nlines) * sizeof(char *) + + image->height * offset + ext_size; + + data = (char **) XpmMalloc(data_size); + if (!data) + RETURN(XpmNoMemory); + + data_nlines = header_nlines + image->height + ext_nlines; + *data = (char *) (data + data_nlines); + n = image->ncolors; + for (l = 0, sptr = data, sptr2 = header; l <= n; l++, sptr++, sptr2++) { + strcpy(*sptr, *sptr2); + *(sptr + 1) = *sptr + strlen(*sptr2) + 1; + } + + /* + * print pixels + */ + data[header_nlines] = (char *) data + header_size + + (image->height + ext_nlines) * sizeof(char *); + + CreatePixels(data + header_nlines, image->width, image->height, + image->cpp, image->data, image->colorTable); + + /* + * print extensions + */ + if (extensions) + CreateExtensions(data + header_nlines + image->height - 1, offset, + attributes->extensions, attributes->nextensions, + ext_nlines); + + *data_return = data; + + RETURN(XpmSuccess); +} + +static int +CreateColors(dataptr, data_size, colors, ncolors, cpp) + char **dataptr; + unsigned int *data_size; + XpmColor *colors; + unsigned int ncolors; + unsigned int cpp; +{ + char buf[BUFSIZ]; + unsigned int a, key, l; + char *s, *s2; + xpmColorDefaults defaults; + + for (a = 0; a < ncolors; a++, colors++, dataptr++) { + + defaults = (xpmColorDefaults) colors; + strncpy(buf, *defaults++, cpp); + s = buf + cpp; + + for (key = 1; key <= NKEYS; key++, defaults++) { + if (s2 = *defaults) { + sprintf(s, "\t%s %s", xpmColorKeys[key - 1], s2); + s += strlen(s); + } + } + l = strlen(buf) + 1; + s = (char *) XpmMalloc(l); + if (!s) + return (XpmNoMemory); + *data_size += l; + strcpy(s, buf); + *dataptr = s; + } + return (XpmSuccess); +} + +static void +CreatePixels(dataptr, width, height, cpp, pixels, colors) + char **dataptr; + unsigned int width; + unsigned int height; + unsigned int cpp; + unsigned int *pixels; + XpmColor *colors; +{ + char *s; + unsigned int x, y, h, offset; + + h = height - 1; + offset = width * cpp + 1; + for (y = 0; y < h; y++, dataptr++) { + s = *dataptr; + for (x = 0; x < width; x++, pixels++) { + strncpy(s, colors[*pixels].string, cpp); + s += cpp; + } + *s = '\0'; + *(dataptr + 1) = *dataptr + offset; + } + /* duplicate some code to avoid a test in the loop */ + s = *dataptr; + for (x = 0; x < width; x++, pixels++) { + strncpy(s, colors[*pixels].string, cpp); + s += cpp; + } + *s = '\0'; +} + +static void +CountExtensions(ext, num, ext_size, ext_nlines) + XpmExtension *ext; + unsigned int num; + unsigned int *ext_size; + unsigned int *ext_nlines; +{ + unsigned int x, y, a, size, nlines; + char **line; + + size = 0; + nlines = 0; + for (x = 0; x < num; x++, ext++) { + /* 1 for the name */ + nlines += ext->nlines + 1; + /* 8 = 7 (for "XPMEXT ") + 1 (for 0) */ + size += strlen(ext->name) + 8; + a = ext->nlines; + for (y = 0, line = ext->lines; y < a; y++, line++) + size += strlen(*line) + 1; + } + /* 10 and 1 are for the ending "XPMENDEXT" */ + *ext_size = size + 10; + *ext_nlines = nlines + 1; +} + +static void +CreateExtensions(dataptr, offset, ext, num, ext_nlines) + char **dataptr; + unsigned int offset; + XpmExtension *ext; + unsigned int num; + unsigned int ext_nlines; +{ + unsigned int x, y, a, b; + char **line; + + *(dataptr + 1) = *dataptr + offset; + dataptr++; + a = 0; + for (x = 0; x < num; x++, ext++) { + sprintf(*dataptr, "XPMEXT %s", ext->name); + a++; + if (a < ext_nlines) + *(dataptr + 1) = *dataptr + strlen(ext->name) + 8; + dataptr++; + b = ext->nlines; + for (y = 0, line = ext->lines; y < b; y++, line++) { + strcpy(*dataptr, *line); + a++; + if (a < ext_nlines) + *(dataptr + 1) = *dataptr + strlen(*line) + 1; + dataptr++; + } + } + strcpy(*dataptr, "XPMENDEXT"); +} diff --git a/vendor/x11iraf/xpm/XpmCrDataFrP.c b/vendor/x11iraf/xpm/XpmCrDataFrP.c new file mode 100644 index 00000000..5d6024eb --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrDataFrP.c @@ -0,0 +1,47 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrDataFP.c: * +* * +* XPM library * +* Scan a pixmap and possibly its mask and create an XPM array * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:string.h" +#else +#if defined(SYSV) || defined(SVR4) +#include <string.h> +#else +#include <strings.h> +#endif +#endif + +int +XpmCreateDataFromPixmap(display, data_return, pixmap, shapemask, attributes) + Display *display; + char ***data_return; + Pixmap pixmap; + Pixmap shapemask; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage image; + + /* + * get the XpmImage + */ + ErrorStatus = XpmCreateXpmImageFromPixmap(display, pixmap, shapemask, + &image, attributes); + if (ErrorStatus == XpmSuccess) { + /* + * create data from the XpmImage + */ + ErrorStatus = + XpmCreateDataFromXpmImage(data_return, &image, attributes); + XpmFreeXpmImage(&image); + } + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmCrIFrBuf.c b/vendor/x11iraf/xpm/XpmCrIFrBuf.c new file mode 100644 index 00000000..569b2aa4 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrIFrBuf.c @@ -0,0 +1,69 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrIFrBuf.c: * +* * +* XPM library * +* Parse an Xpm buffer (file in memory) and create the image and possibly its * +* mask * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmCreateImageFromBuffer(display, buffer, image_return, + shapeimage_return, attributes) + Display *display; + char *buffer; + XImage **image_return; + XImage **shapeimage_return; + XpmAttributes *attributes; +{ + XpmImage image; + int ErrorStatus; + + /* + * create an XpmImage then the related XImages + */ + ErrorStatus = + XpmCreateXpmImageFromBuffer(buffer, &image, attributes, NULL); + + if (ErrorStatus == XpmSuccess) + ErrorStatus = XpmCreateImageFromXpmImage(display, &image, + image_return, + shapeimage_return, + attributes); + if (ErrorStatus < 0 && attributes) + XpmFreeAttributes(attributes); + + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} + +int +XpmCreateXpmImageFromBuffer(buffer, image, attributes, infos) + char *buffer; + XpmImage *image; + XpmAttributes *attributes; + XpmInfos *infos; +{ + xpmData mdata; + int ErrorStatus; + + /* + * init returned values + */ + xpmInitAttributes(attributes); + xpmInitXpmImage(image); + xpmInitXpmInfos(infos); + + xpmOpenBuffer(buffer, &mdata); + ErrorStatus = xpmParseData(&mdata, image, attributes, infos); + xpmDataClose(&mdata); + + if (ErrorStatus != XpmSuccess) + XpmFreeXpmInfos(infos); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmCrIFrData.c b/vendor/x11iraf/xpm/XpmCrIFrData.c new file mode 100644 index 00000000..49a7598e --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrIFrData.c @@ -0,0 +1,64 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrIFrData.c: * +* * +* XPM library * +* Parse an Xpm array and create the image and possibly its mask * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmCreateImageFromData(display, data, image_return, + shapeimage_return, attributes) + Display *display; + char **data; + XImage **image_return; + XImage **shapeimage_return; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage image; + + /* + * create an XpmImage then the related XImages + */ + ErrorStatus = XpmCreateXpmImageFromData(data, &image, attributes); + + if (ErrorStatus == XpmSuccess) + ErrorStatus = XpmCreateImageFromXpmImage(display, &image, + image_return, + shapeimage_return, + attributes); + if (ErrorStatus < 0 && attributes) + XpmFreeAttributes(attributes); + + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} + +int +XpmCreateXpmImageFromData(data, image, attributes) + char **data; + XpmImage *image; + XpmAttributes *attributes; +{ + xpmData mdata; + int ErrorStatus; + + /* + * init returned values + */ + xpmInitAttributes(attributes); + xpmInitXpmImage(image); + + xpmOpenArray(data, &mdata); + ErrorStatus = xpmParseData(&mdata, image, attributes, NULL); + xpmDataClose(&mdata); + + return (ErrorStatus); +} + diff --git a/vendor/x11iraf/xpm/XpmCrPFrBuf.c b/vendor/x11iraf/xpm/XpmCrPFrBuf.c new file mode 100644 index 00000000..0c765100 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrPFrBuf.c @@ -0,0 +1,47 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrPFrBuf.c: * +* * +* XPM library * +* Parse an Xpm buffer and create the pixmap and possibly its mask * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmCreatePixmapFromBuffer(display, d, buffer, pixmap_return, + shapemask_return, attributes) + Display *display; + Drawable d; + char *buffer; + Pixmap *pixmap_return; + Pixmap *shapemask_return; + XpmAttributes *attributes; +{ + XpmImage image; + int ErrorStatus; + + /* + * create an XpmImage + */ + ErrorStatus = + XpmCreateXpmImageFromBuffer(buffer, &image, attributes, NULL); + + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + /* + * then create the pixmaps from it + */ + ErrorStatus = XpmCreatePixmapFromXpmImage(display, d, &image, + pixmap_return, shapemask_return, + attributes); + if (ErrorStatus != XpmSuccess) + XpmFreeAttributes(attributes); + + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmCrPFrData.c b/vendor/x11iraf/xpm/XpmCrPFrData.c new file mode 100644 index 00000000..7cac72a9 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmCrPFrData.c @@ -0,0 +1,45 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmCrPFrData.c: * +* * +* XPM library * +* Parse an Xpm array and create the pixmap and possibly its mask * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmCreatePixmapFromData(display, d, data, pixmap_return, + shapemask_return, attributes) + Display *display; + Drawable d; + char **data; + Pixmap *pixmap_return; + Pixmap *shapemask_return; + XpmAttributes *attributes; +{ + XpmImage image; + int ErrorStatus; + + /* + * create an XpmImage + */ + ErrorStatus = XpmCreateXpmImageFromData(data, &image, attributes); + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + /* + * then create the pixmaps from it + */ + ErrorStatus = XpmCreatePixmapFromXpmImage(display, d, &image, + pixmap_return, shapemask_return, + attributes); + if (ErrorStatus != XpmSuccess) + XpmFreeAttributes(attributes); + + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmRdFToData.c b/vendor/x11iraf/xpm/XpmRdFToData.c new file mode 100644 index 00000000..d30292b7 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmRdFToData.c @@ -0,0 +1,41 @@ +/* Copyright 1990,91 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmRdFToData.c: * +* * +* XPM library * +* Parse an XPM file and create an array of strings corresponding to it. * +* * +* Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmReadFileToData(filename, data_return) + char *filename; + char ***data_return; +{ + XpmAttributes attributes; + XpmImage image; + int ErrorStatus; + + attributes.valuemask = XpmReturnExtensions; + + /* + * initialize return value + */ + if (data_return) + *data_return = NULL; + + ErrorStatus = XpmReadFileToXpmImage(filename, &image, &attributes, NULL); + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + ErrorStatus = + XpmCreateDataFromXpmImage(data_return, &image, &attributes); + + XpmFreeAttributes(&attributes); + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmRdFToI.c b/vendor/x11iraf/xpm/XpmRdFToI.c new file mode 100644 index 00000000..850ba434 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmRdFToI.c @@ -0,0 +1,64 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmRdFToI.c: * +* * +* XPM library * +* Parse an XPM file and create the image and possibly its mask * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmReadFileToImage(display, filename, + image_return, shapeimage_return, attributes) + Display *display; + char *filename; + XImage **image_return; + XImage **shapeimage_return; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage image; + + ErrorStatus = XpmReadFileToXpmImage(filename, &image, attributes, NULL); + + if (ErrorStatus == XpmSuccess) + ErrorStatus = XpmCreateImageFromXpmImage(display, &image, + image_return, + shapeimage_return, + attributes); + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} + +int +XpmReadFileToXpmImage(filename, image, attributes, infos) + char *filename; + XpmImage *image; + XpmAttributes *attributes; + XpmInfos *infos; +{ + xpmData mdata; + int ErrorStatus; + + /* + * init returned values + */ + xpmInitAttributes(attributes); + xpmInitXpmImage(image); + xpmInitXpmInfos(infos); + + if ((ErrorStatus = xpmReadFile(filename, &mdata)) != XpmSuccess) + return (ErrorStatus); + + ErrorStatus = xpmParseData(&mdata, image, attributes, infos); + xpmDataClose(&mdata); + + if (ErrorStatus != XpmSuccess) + XpmFreeXpmInfos(infos); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmRdFToP.c b/vendor/x11iraf/xpm/XpmRdFToP.c new file mode 100644 index 00000000..296f2dc4 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmRdFToP.c @@ -0,0 +1,46 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmRdFToP.c: * +* * +* XPM library * +* Parse an XPM file and create the pixmap and possibly its mask * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmReadFileToPixmap(display, d, filename, pixmap_return, + shapemask_return, attributes) + Display *display; + Drawable d; + char *filename; + Pixmap *pixmap_return; + Pixmap *shapemask_return; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage image; + + /* + * get the XpmImage + */ + ErrorStatus = XpmReadFileToXpmImage(filename, &image, attributes, NULL); + + if (ErrorStatus < 0) + return (ErrorStatus); + + /* + * then create the pixmaps from it + */ + ErrorStatus = XpmCreatePixmapFromXpmImage(display, d, &image, + pixmap_return, shapemask_return, + attributes); + if (ErrorStatus != XpmSuccess) + XpmFreeAttributes(attributes); + + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmWrFFrData.c b/vendor/x11iraf/xpm/XpmWrFFrData.c new file mode 100644 index 00000000..22ed71e9 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmWrFFrData.c @@ -0,0 +1,36 @@ +/* Copyright 1990,91 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmWrFFrData.c: * +* * +* XPM library * +* Parse an Xpm array and write a file that corresponds to it. * +* * +* Developed by Dan Greening dgreen@cs.ucla.edu / dgreen@sti.com * +\*****************************************************************************/ + +#include "xpmP.h" + +int +XpmWriteFileFromData(filename, data) + char *filename; + char **data; +{ + XpmAttributes attributes; + XpmImage image; + int ErrorStatus; + + attributes.valuemask = XpmReturnExtensions; + + ErrorStatus = XpmCreateXpmImageFromData(data, &image, &attributes); + + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + ErrorStatus = + XpmWriteFileFromXpmImage(filename, &image, &attributes, NULL); + + XpmFreeAttributes(&attributes); + XpmFreeXpmImage(&image); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/XpmWrFFrI.c b/vendor/x11iraf/xpm/XpmWrFFrI.c new file mode 100644 index 00000000..77fe6c7c --- /dev/null +++ b/vendor/x11iraf/xpm/XpmWrFFrI.c @@ -0,0 +1,251 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmWrFFrI.c: * +* * +* XPM library * +* Write an image and possibly its mask to an XPM file * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +LFUNC(WriteColors, void, (FILE *file, XpmColor *colors, unsigned int ncolors)); + +LFUNC(WritePixels, int, (FILE *file, unsigned int width, unsigned int height, + unsigned int cpp, unsigned int *pixels, + XpmColor *colors)); + +LFUNC(WriteExtensions, void, (FILE *file, XpmExtension *ext, + unsigned int num)); + +int +XpmWriteFileFromImage(display, filename, image, shapeimage, attributes) + Display *display; + char *filename; + XImage *image; + XImage *shapeimage; + XpmAttributes *attributes; +{ + XpmImage xpmimage; + int ErrorStatus; + + /* + * Scan image + */ + ErrorStatus = XpmCreateXpmImageFromImage(display, image, shapeimage, + &xpmimage, attributes); + if (ErrorStatus == XpmSuccess) + ErrorStatus = XpmWriteFileFromXpmImage(filename, &xpmimage, + attributes, NULL); + + XpmFreeXpmImage(&xpmimage); + + return (ErrorStatus); +} + +int +XpmWriteFileFromXpmImage(filename, image, attributes, infos) + char *filename; + XpmImage *image; + XpmAttributes *attributes; + XpmInfos *infos; +{ + xpmData mdata; + char *name, *dot, *s, *new_name = NULL; + int ErrorStatus; + + if ((ErrorStatus = xpmWriteFile(filename, &mdata)) != XpmSuccess) + return (ErrorStatus); + + if (filename) { +#ifdef VMS + name = filename; +#else + if (!(name = rindex(filename, '/'))) + name = filename; + else + name++; +#endif + if (dot = index(name, '.')) { + new_name = (char *) strdup(name); + if (!new_name) { + new_name = NULL; + name = "image_name"; + } else { + /* change '.' to '_' to get a valid C syntax name */ + name = s = new_name; + while (dot = index(s, '.')) { + *dot = '_'; + s = dot; + } + } + } + } else + name = "image_name"; + + if (ErrorStatus == XpmSuccess) + ErrorStatus = xpmWriteData(&mdata, image, name, attributes, infos); + + xpmDataClose(&mdata); + if (new_name) + XpmFree(name); + + return (ErrorStatus); +} + +int +xpmWriteData(mdata, image, name, attributes, infos) + xpmData *mdata; + XpmImage *image; + char *name; + XpmAttributes *attributes; + XpmInfos *infos; +{ + /* calculation variables */ + unsigned int extensions; + FILE *file; + int ErrorStatus; + + /* store this to speed up */ + file = mdata->stream.file; + + extensions = attributes && (attributes->valuemask & XpmExtensions) + && attributes->nextensions; + + /* + * print the header line + */ + fprintf(file, "/* XPM */\nstatic char * %s[] = {\n", name); + + /* + * print the hints line + */ + if (infos && infos->hints_cmt) + fprintf(file, "/*%s*/\n", infos->hints_cmt); + + fprintf(file, "\"%d %d %d %d", image->width, image->height, + image->ncolors, image->cpp); + + if (attributes && (attributes->valuemask & XpmHotspot)) + fprintf(file, " %d %d", attributes->x_hotspot, attributes->y_hotspot); + + if (extensions) + fprintf(file, " XPMEXT"); + + fprintf(file, "\",\n"); + + /* + * print colors + */ + if (infos && infos->colors_cmt) + fprintf(file, "/*%s*/\n", infos->colors_cmt); + + WriteColors(file, image->colorTable, image->ncolors); + + /* + * print pixels + */ + if (infos && infos->pixels_cmt) + fprintf(file, "/*%s*/\n", infos->pixels_cmt); + + ErrorStatus = WritePixels(file, image->width, image->height, image->cpp, + image->data, image->colorTable); + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + /* + * print extensions + */ + if (extensions) + WriteExtensions(file, attributes->extensions, attributes->nextensions); + + /* close the array */ + fprintf(file, "};\n"); + + return (XpmSuccess); +} + +static void +WriteColors(file, colors, ncolors) + FILE *file; + XpmColor *colors; + unsigned int ncolors; +{ + unsigned int a, key; + char *s; + xpmColorDefaults defaults; + + for (a = 0; a < ncolors; a++, colors++) { + + defaults = (xpmColorDefaults) colors; + fprintf(file, "\"%s", *defaults++); + + for (key = 1; key <= NKEYS; key++, defaults++) { + if (s = *defaults) + fprintf(file, "\t%s %s", xpmColorKeys[key - 1], s); + } + fprintf(file, "\",\n"); + } +} + + +static int +WritePixels(file, width, height, cpp, pixels, colors) + FILE *file; + unsigned int width; + unsigned int height; + unsigned int cpp; + unsigned int *pixels; + XpmColor *colors; +{ + char *s, *p, *buf; + unsigned int x, y, h; + + h = height - 1; + p = buf = (char *) XpmMalloc(width * cpp + 3); + if (!buf) + return (XpmNoMemory); + *buf = '"'; + p++; + for (y = 0; y < h; y++) { + s = p; + for (x = 0; x < width; x++, pixels++) { + strncpy(s, colors[*pixels].string, cpp); + s += cpp; + } + *s++ = '"'; + *s = '\0'; + fprintf(file, "%s,\n", buf); + } + /* duplicate some code to avoid a test in the loop */ + s = p; + for (x = 0; x < width; x++, pixels++) { + strncpy(s, colors[*pixels].string, cpp); + s += cpp; + } + *s++ = '"'; + *s = '\0'; + fprintf(file, "%s", buf); + + XpmFree(buf); + return (XpmSuccess); +} + +static void +WriteExtensions(file, ext, num) + FILE *file; + XpmExtension *ext; + unsigned int num; +{ + unsigned int x, y, n; + char **line; + + for (x = 0; x < num; x++, ext++) { + fprintf(file, ",\n\"XPMEXT %s\"", ext->name); + n = ext->nlines; + for (y = 0, line = ext->lines; y < n; y++, line++) + fprintf(file, ",\n\"%s\"", *line); + } + fprintf(file, ",\n\"XPMENDEXT\""); +} diff --git a/vendor/x11iraf/xpm/XpmWrFFrP.c b/vendor/x11iraf/xpm/XpmWrFFrP.c new file mode 100644 index 00000000..16c6ec49 --- /dev/null +++ b/vendor/x11iraf/xpm/XpmWrFFrP.c @@ -0,0 +1,47 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* XpmWrFFrP.c: * +* * +* XPM library * +* Write a pixmap and possibly its mask to an XPM file * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:string.h" +#else +#if defined(SYSV) || defined(SVR4) +#include <string.h> +#else +#include <strings.h> +#endif +#endif + +int +XpmWriteFileFromPixmap(display, filename, pixmap, shapemask, attributes) + Display *display; + char *filename; + Pixmap pixmap; + Pixmap shapemask; + XpmAttributes *attributes; +{ + int ErrorStatus; + XpmImage image; + + /* + * get the XpmImage + */ + ErrorStatus = XpmCreateXpmImageFromPixmap(display, pixmap, shapemask, + &image, attributes); + if (ErrorStatus == XpmSuccess) { + /* + * write it out + */ + ErrorStatus = + XpmWriteFileFromXpmImage(filename, &image, attributes, NULL); + XpmFreeXpmImage(&image); + } + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/create.c b/vendor/x11iraf/xpm/create.c new file mode 100644 index 00000000..0e792b62 --- /dev/null +++ b/vendor/x11iraf/xpm/create.c @@ -0,0 +1,1456 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* create.c: * +* * +* XPM library * +* Create an X image and possibly its related shape mask * +* from the given xpmInternAttrib. * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:ctype.h" +#else +#include <ctype.h> +#endif + +LFUNC(xpmVisualType, int, (Visual *visual)); + +LFUNC(SetCloseColor, int, (Display *display, Colormap colormap, + Visual *visual, XColor *col, + Pixel *image_pixel, Pixel *mask_pixel, + Pixel **pixels, unsigned int *npixels, + XpmAttributes *attributes, + XColor *cols, int ncols)); + +LFUNC(SetColor, int, (Display *display, Colormap colormap, Visual *visual, + char *colorname, unsigned int color_index, + Pixel *image_pixel, Pixel *mask_pixel, + unsigned int *mask_pixel_index, Pixel **pixels, + unsigned int *npixels, XpmAttributes *attributes, + XColor *cols, int ncols)); + +LFUNC(CreateXImage, int, (Display *display, Visual *visual, + unsigned int depth, unsigned int width, + unsigned int height, XImage **image_return)); + +LFUNC(CreateColors, int, (Display *display, XpmAttributes *attributes, + XpmColor *ct, unsigned int ncolors, Pixel *ip, + Pixel *mp, unsigned int *mask_pixel, + Pixel **pixels, unsigned int *npixels)); + +LFUNC(SetImagePixels, void, (XImage *image, unsigned int width, + unsigned int height, unsigned int *pixelindex, + Pixel *pixels)); + +LFUNC(SetImagePixels32, void, (XImage *image, unsigned int width, + unsigned int height, unsigned int *pixelindex, + Pixel *pixels)); + +LFUNC(SetImagePixels16, void, (XImage *image, unsigned int width, + unsigned int height, unsigned int *pixelindex, + Pixel *pixels)); + +LFUNC(SetImagePixels8, void, (XImage *image, unsigned int width, + unsigned int height, unsigned int *pixelindex, + Pixel *pixels)); + +LFUNC(SetImagePixels1, void, (XImage *image, unsigned int width, + unsigned int height, unsigned int *pixelindex, + Pixel *pixels)); + +#ifdef NEED_STRCASECMP +LFUNC(strcasecmp, int, (char *s1, char *s2)); + +/* + * in case strcasecmp is not provided by the system here is one + * which does the trick + */ +static int +strcasecmp(s1, s2) + register char *s1, *s2; +{ + register int c1, c2; + + while (*s1 && *s2) { + c1 = isupper(*s1) ? tolower(*s1) : *s1; + c2 = isupper(*s2) ? tolower(*s2) : *s2; + if (c1 != c2) + return (1); + s1++; + s2++; + } + if (*s1 || *s2) + return (1); + return (0); +} +#endif + +/* + * return the default color key related to the given visual + */ +static int +xpmVisualType(visual) + Visual *visual; +{ + switch (visual->class) { + case StaticGray: + case GrayScale: + switch (visual->map_entries) { + case 2: + return (XPM_MONO); + case 4: + return (XPM_GRAY4); + default: + return (XPM_GRAY); + } + default: + return (XPM_COLOR); + } +} + + +typedef struct { + int cols_index; + long closeness; +} CloseColor; + +static int +closeness_cmp(a, b) + void *a, *b; +{ + CloseColor *x = (CloseColor *) a, *y = (CloseColor *) b; + + return (x->closeness - y->closeness); +} + +/* + * set a close color in case the exact one can't be set + * return 0 if success, 1 otherwise. + */ + +static int +SetCloseColor(display, colormap, visual, col, + image_pixel, mask_pixel, pixels, npixels, attributes, + cols, ncols) + Display *display; + Colormap colormap; + Visual *visual; + XColor *col; + Pixel *image_pixel, *mask_pixel; + Pixel **pixels; + unsigned int *npixels; + XpmAttributes *attributes; + XColor *cols; + int ncols; +{ + /* + * Allocation failed, so try close colors. To get here the visual must + * be GreyScale, PseudoColor or DirectColor (or perhaps StaticColor? + * What about sharing systems like QDSS?). Beware: we have to treat + * DirectColor differently. + */ + + + long int red_closeness, green_closeness, blue_closeness; + int n; + + if (attributes && (attributes->valuemask & XpmCloseness)) + red_closeness = green_closeness = blue_closeness = + attributes->closeness; + else { + red_closeness = attributes->red_closeness; + green_closeness = attributes->green_closeness; + blue_closeness = attributes->blue_closeness; + } + + + /* + * We sort the colormap by closeness and try to allocate the color + * closest to the target. If the allocation of this close color fails, + * which almost never happens, then one of two scenarios is possible. + * Either the colormap must have changed (since the last close color + * allocation or possibly while we were sorting the colormap), or the + * color is allocated as Read/Write by some other client. (Note: X + * _should_ allow clients to check if a particular color is Read/Write, + * but it doesn't! :-( ). We cannot determine which of these scenarios + * occurred, so we try the next closest color, and so on, until no more + * colors are within closeness of the target. If we knew that the + * colormap had changed, we could skip this sequence. + * + * If _none_ of the colors within closeness of the target can be allocated, + * then we can finally be pretty sure that the colormap has actually + * changed. In this case we try to allocate the original color (again), + * then try the closecolor stuff (again)... + * + * In theory it would be possible for an infinite loop to occur if another + * process kept changing the colormap every time we sorted it, so we set + * a maximum on the number of iterations. After this many tries, we use + * XGrabServer() to ensure that the colormap remains unchanged. + * + * This approach gives particularly bad worst case performance - as many as + * <MaximumIterations> colormap reads and sorts may be needed, and as + * many as <MaximumIterations> * <ColormapSize> attempted allocations + * may fail. On an 8-bit system, this means as many as 3 colormap reads, + * 3 sorts and 768 failed allocations per execution of this code! + * Luckily, my experiments show that in general use in a typical 8-bit + * color environment only about 1 in every 10000 allocations fails to + * succeed in the fastest possible time. So virtually every time what + * actually happens is a single sort followed by a successful allocate. + * The very first allocation also costs a colormap read, but no further + * reads are usually necessary. + */ + +#define ITERATIONS 2 /* more than one is almost never + * necessary */ + + for (n = 0; n <= ITERATIONS; ++n) { + CloseColor *closenesses = + (CloseColor *) XpmCalloc(ncols, sizeof(CloseColor)); + int i, c; + + for (i = 0; i < ncols; ++i) { /* build & sort closenesses table */ +#define COLOR_FACTOR 3 +#define BRIGHTNESS_FACTOR 1 + + closenesses[i].cols_index = i; + closenesses[i].closeness = + COLOR_FACTOR * (abs((long) col->red - (long) cols[i].red) + + abs((long) col->green - (long) cols[i].green) + + abs((long) col->blue - (long) cols[i].blue)) + + BRIGHTNESS_FACTOR * abs(((long) col->red + + (long) col->green + + (long) col->blue) + - ((long) cols[i].red + + (long) cols[i].green + + (long) cols[i].blue)); + } + qsort(closenesses, ncols, sizeof(CloseColor), closeness_cmp); + + i = 0; + c = closenesses[i].cols_index; + while ((long) cols[c].red >= (long) col->red - red_closeness && + (long) cols[c].red <= (long) col->red + red_closeness && + (long) cols[c].green >= (long) col->green - green_closeness && + (long) cols[c].green <= (long) col->green + green_closeness && + (long) cols[c].blue >= (long) col->blue - blue_closeness && + (long) cols[c].blue <= (long) col->blue + blue_closeness) { + if (XAllocColor(display, colormap, &cols[c])) { + if (n == ITERATIONS) + XUngrabServer(display); + XpmFree(closenesses); + *image_pixel = cols[c].pixel; + *mask_pixel = 1; + (*pixels)[*npixels] = cols[c].pixel; + (*npixels)++; + return (0); + } else { + ++i; if (i == ncols) break; + c = closenesses[i].cols_index; + } + } + + /* Couldn't allocate _any_ of the close colors! */ + + if (n == ITERATIONS) + XUngrabServer(display); + XpmFree(closenesses); + + if (i == 0 || i == ncols) /* no color close enough or cannot */ + return (1); /* alloc any color (full of r/w's) */ + + if (XAllocColor(display, colormap, col)) { + *image_pixel = col->pixel; + *mask_pixel = 1; + (*pixels)[*npixels] = col->pixel; + (*npixels)++; + return (0); + } else { /* colormap has probably changed, so + * re-read... */ + if (n == ITERATIONS - 1) + XGrabServer(display); + +#if 0 + if (visual->class == DirectColor) { + /* TODO */ + } else +#endif + XQueryColors(display, colormap, cols, ncols); + } + } + return (1); +} + +#define USE_CLOSECOLOR attributes && \ +(((attributes->valuemask & XpmCloseness) && attributes->closeness != 0) \ + || ((attributes->valuemask & XpmRGBCloseness) && \ + attributes->red_closeness != 0 \ + && attributes->green_closeness != 0 \ + && attributes->blue_closeness != 0)) + +/* + * set the color pixel related to the given colorname, + * return 0 if success, 1 otherwise. + */ + +static int +SetColor(display, colormap, visual, colorname, color_index, + image_pixel, mask_pixel, mask_pixel_index, + pixels, npixels, attributes, cols, ncols) + Display *display; + Colormap colormap; + Visual *visual; + char *colorname; + unsigned int color_index; + Pixel *image_pixel, *mask_pixel; + unsigned int *mask_pixel_index; + Pixel **pixels; + unsigned int *npixels; + XpmAttributes *attributes; + XColor *cols; + int ncols; +{ + XColor xcolor; + + if (strcasecmp(colorname, TRANSPARENT_COLOR)) { + if (!XParseColor(display, colormap, colorname, &xcolor)) + return (1); + if (!XAllocColor(display, colormap, &xcolor)) { + if (USE_CLOSECOLOR) + return (SetCloseColor(display, colormap, visual, &xcolor, + image_pixel, mask_pixel, pixels, npixels, + attributes, cols, ncols)); + else + return (1); + } + *image_pixel = xcolor.pixel; + *mask_pixel = 1; + (*pixels)[*npixels] = xcolor.pixel; + (*npixels)++; + } else { + *image_pixel = 0; + *mask_pixel = 0; + *mask_pixel_index = color_index;/* store the color table index */ + } + return (0); +} + + +static int +CreateColors(display, attributes, ct, ncolors, + ip, mp, mask_pixel, pixels, npixels) + Display *display; + XpmAttributes *attributes; + XpmColor *ct; + unsigned int ncolors; + Pixel *ip; + Pixel *mp; + unsigned int *mask_pixel; /* mask pixel index */ + Pixel **pixels; /* allocated pixels */ + unsigned int *npixels; /* number of allocated pixels */ +{ + /* variables stored in the XpmAttributes structure */ + Visual *visual; + Colormap colormap; + XpmColorSymbol *colorsymbols; + unsigned int numsymbols; + + char *colorname; + unsigned int a, b, l; + Boolean pixel_defined; + unsigned int key; + XpmColorSymbol *symbol; + xpmColorDefaults defaults; + int ErrorStatus = XpmSuccess; + char *s; + int default_index; + + XColor *cols = NULL; + unsigned int ncols = 0; + + /* + * retrieve information from the XpmAttributes + */ + if (attributes && attributes->valuemask & XpmColorSymbols) { + colorsymbols = attributes->colorsymbols; + numsymbols = attributes->numsymbols; + } else + numsymbols = 0; + + if (attributes && attributes->valuemask & XpmVisual) + visual = attributes->visual; + else + visual = DefaultVisual(display, DefaultScreen(display)); + + if (attributes && attributes->valuemask & XpmColormap) + colormap = attributes->colormap; + else + colormap = DefaultColormap(display, DefaultScreen(display)); + + if (attributes && attributes->valuemask & XpmColorKey) + key = attributes->color_key; + else + key = xpmVisualType(visual); + + if (USE_CLOSECOLOR) { + /* originally from SetCloseColor */ +#if 0 + if (visual->class == DirectColor) { + /* + * TODO: Implement close colors for DirectColor visuals. This is + * difficult situation. Chances are that we will never get here, + * because any machine that supports DirectColor will probably + * also support TrueColor (and probably PseudoColor). Also, + * DirectColor colormaps can be very large, so looking for close + * colors may be too slow. + */ + } else { +#endif + int i; + ncols = visual->map_entries; + cols = (XColor *) XpmCalloc(ncols, sizeof(XColor)); + for (i = 0; i < ncols; ++i) + cols[i].pixel = i; + XQueryColors(display, colormap, cols, ncols); +#if 0 + } +#endif + } + + switch (key) { + case XPM_MONO: + default_index = 2; + break; + case XPM_GRAY4: + default_index = 3; + break; + case XPM_GRAY: + default_index = 4; + break; + case XPM_COLOR: + default: + default_index = 5; + break; + } + + for (a = 0; a < ncolors; a++, ct++, ip++, mp++) { + colorname = NULL; + pixel_defined = False; + defaults = (xpmColorDefaults) ct; + + /* + * look for a defined symbol + */ + if (numsymbols && defaults[1]) { + s = defaults[1]; + for (l = 0, symbol = colorsymbols; l < numsymbols; l++, symbol++) { + if (symbol->name && s && !strcmp(symbol->name, s)) + /* override name */ + break; + if (!symbol->name && symbol->value) { /* override value */ + int def_index = default_index; + + while (defaults[def_index] == NULL) /* find defined + * colorname */ + --def_index; + if (def_index < 2) {/* nothing towards mono, so try + * towards color */ + def_index = default_index + 1; + while (def_index <= 5 && defaults[def_index] == NULL) + ++def_index; + } + if (def_index >= 2 && defaults[def_index] != NULL && + !strcasecmp(symbol->value, defaults[def_index])) + break; + } + } + if (l != numsymbols) { + if (symbol->name && symbol->value) + colorname = symbol->value; + else + pixel_defined = True; + } + } + if (!pixel_defined) { /* pixel not given as symbol value */ + if (colorname) { /* colorname given as symbol value */ + if (!SetColor(display, colormap, visual, colorname, a, ip, mp, + mask_pixel, pixels, npixels, attributes, + cols, ncols)) + pixel_defined = True; + else + ErrorStatus = XpmColorError; + } + b = key; + while (!pixel_defined && b > 1) { + if (defaults[b]) { + if (!SetColor(display, colormap, visual, defaults[b], + a, ip, mp, mask_pixel, pixels, npixels, + attributes, cols, ncols)) { + pixel_defined = True; + break; + } else + ErrorStatus = XpmColorError; + } + b--; + } + b = key + 1; + while (!pixel_defined && b < NKEYS + 1) { + if (defaults[b]) { + if (!SetColor(display, colormap, visual, defaults[b], + a, ip, mp, mask_pixel, pixels, npixels, + attributes, cols, ncols)) { + pixel_defined = True; + break; + } else + ErrorStatus = XpmColorError; + } + b++; + } + if (!pixel_defined) { + if (cols) + XpmFree(cols); + return (XpmColorFailed); + } + } else { + *ip = colorsymbols[l].pixel; + if (symbol->value + && !strcasecmp(symbol->value, TRANSPARENT_COLOR)) { + *mp = 0; + *mask_pixel = 0; + } else + *mp = 1; + } + } + if (cols) + XpmFree(cols); + return (ErrorStatus); +} + +/* function call in case of error, frees only locally allocated variables */ +#undef RETURN +#define RETURN(status) \ +{ \ + if (ximage) XDestroyImage(ximage); \ + if (shapeimage) XDestroyImage(shapeimage); \ + if (ximage_pixels) XpmFree(ximage_pixels); \ + if (mask_pixels) XpmFree(mask_pixels); \ + if (npixels) XFreeColors(display, colormap, pixels, npixels, 0); \ + if (pixels) XpmFree(pixels); \ + return (status); \ +} + +int +XpmCreateImageFromXpmImage(display, image, + image_return, shapeimage_return, attributes) + Display *display; + XpmImage *image; + XImage **image_return; + XImage **shapeimage_return; + XpmAttributes *attributes; +{ + /* variables stored in the XpmAttributes structure */ + Visual *visual; + Colormap colormap; + unsigned int depth; + + /* variables to return */ + XImage *ximage = NULL; + XImage *shapeimage = NULL; + unsigned int mask_pixel; + int ErrorStatus; + + /* calculation variables */ + Pixel *ximage_pixels = NULL; + Pixel *mask_pixels = NULL; + Pixel *pixels = NULL; /* allocated pixels */ + unsigned int npixels = 0; /* number of allocated pixels */ + + /* + * initialize return values + */ + if (image_return) + *image_return = NULL; + if (shapeimage_return) + *shapeimage_return = NULL; + + /* + * retrieve information from the XpmAttributes + */ + if (attributes && (attributes->valuemask & XpmVisual)) + visual = attributes->visual; + else + visual = DefaultVisual(display, DefaultScreen(display)); + + if (attributes && (attributes->valuemask & XpmColormap)) + colormap = attributes->colormap; + else + colormap = DefaultColormap(display, DefaultScreen(display)); + + if (attributes && (attributes->valuemask & XpmDepth)) + depth = attributes->depth; + else + depth = DefaultDepth(display, DefaultScreen(display)); + ErrorStatus = XpmSuccess; + + /* + * malloc pixels index tables + */ + + ximage_pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * image->ncolors); + if (!ximage_pixels) + return (XpmNoMemory); + + mask_pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * image->ncolors); + if (!mask_pixels) + RETURN(ErrorStatus); + + mask_pixel = UNDEF_PIXEL; + + /* maximum of allocated pixels will be the number of colors */ + pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * image->ncolors); + if (!pixels) + RETURN(ErrorStatus); + + /* + * get pixel colors, store them in index tables + */ + + ErrorStatus = CreateColors(display, attributes, image->colorTable, + image->ncolors, ximage_pixels, mask_pixels, + &mask_pixel, &pixels, &npixels); + + if (ErrorStatus != XpmSuccess + && (ErrorStatus < 0 || (attributes + && (attributes->valuemask & XpmExactColors) + && attributes->exactColors))) + RETURN(ErrorStatus); + + /* + * create the ximage + */ + if (image_return) { + ErrorStatus = CreateXImage(display, visual, depth, + image->width, image->height, &ximage); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + /* + * set the ximage data + * + * In case depth is 1 or bits_per_pixel is 4, 6, 8, 24 or 32 use + * optimized functions, otherwise use slower but sure general one. + * + */ + + if (ximage->depth == 1) + SetImagePixels1(ximage, image->width, image->height, + image->data, ximage_pixels); + else if (ximage->bits_per_pixel == 8) + SetImagePixels8(ximage, image->width, image->height, + image->data, ximage_pixels); + else if (ximage->bits_per_pixel == 16) + SetImagePixels16(ximage, image->width, image->height, + image->data, ximage_pixels); + else if (ximage->bits_per_pixel == 32) + SetImagePixels32(ximage, image->width, image->height, + image->data, ximage_pixels); + else + SetImagePixels(ximage, image->width, image->height, + image->data, ximage_pixels); + } + + /* + * create the shape mask image + */ + if (mask_pixel != UNDEF_PIXEL && shapeimage_return) { + ErrorStatus = CreateXImage(display, visual, 1, image->width, + image->height, &shapeimage); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + SetImagePixels1(shapeimage, image->width, image->height, + image->data, mask_pixels); + } + XpmFree(mask_pixels); + XpmFree(pixels); + + /* + * if requested store alloc'ed pixels in the XpmAttributes structure + */ + if (attributes && attributes->valuemask & XpmReturnPixels) { + if (mask_pixel != UNDEF_PIXEL) { + Pixel *pixels, *p1, *p2; + unsigned int a; + + attributes->npixels = image->ncolors - 1; + pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * attributes->npixels); + if (pixels) { + p1 = ximage_pixels; + p2 = pixels; + for (a = 0; a < image->ncolors; a++, p1++) + if (a != mask_pixel) + *p2++ = *p1; + attributes->pixels = pixels; + } else { + /* if error just say we can't return requested data */ + attributes->valuemask &= ~XpmReturnPixels; + attributes->pixels = NULL; + attributes->npixels = 0; + } + XpmFree(ximage_pixels); + } else { + attributes->pixels = ximage_pixels; + attributes->npixels = image->ncolors; + } + } else + XpmFree(ximage_pixels); + + /* + * return created images + */ + if (image_return) + *image_return = ximage; + + if (shapeimage_return) + *shapeimage_return = shapeimage; + + return (ErrorStatus); +} + + +/* + * Create an XImage + */ +static int +CreateXImage(display, visual, depth, width, height, image_return) + Display *display; + Visual *visual; + unsigned int depth; + unsigned int width; + unsigned int height; + XImage **image_return; +{ + int bitmap_pad; + + /* first get bitmap_pad */ + if (depth > 16) + bitmap_pad = 32; + else if (depth > 8) + bitmap_pad = 16; + else + bitmap_pad = 8; + + /* then create the XImage with data = NULL and bytes_per_line = 0 */ + + *image_return = XCreateImage(display, visual, depth, ZPixmap, 0, 0, + width, height, bitmap_pad, 0); + if (!*image_return) + return (XpmNoMemory); + + /* now that bytes_per_line must have been set properly alloc data */ + + (*image_return)->data = + (char *) XpmMalloc((*image_return)->bytes_per_line * height); + + if (!(*image_return)->data) { + XDestroyImage(*image_return); + *image_return = NULL; + return (XpmNoMemory); + } + return (XpmSuccess); +} + + +/* + * The functions below are written from X11R5 MIT's code (XImUtil.c) + * + * The idea is to have faster functions than the standard XPutPixel function + * to build the image data. Indeed we can speed up things by suppressing tests + * performed for each pixel. We do the same tests but at the image level. + * We also assume that we use only ZPixmap images with null offsets. + */ + +LFUNC(_putbits, void, (register char *src, int dstoffset, + register int numbits, register char *dst)); + +LFUNC(_XReverse_Bytes, int, (register unsigned char *bpt, register int nb)); + + static unsigned char Const _reverse_byte[0x100] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff + }; + + static int + _XReverse_Bytes(bpt, nb) + register unsigned char *bpt; + register int nb; +{ + do { + *bpt = _reverse_byte[*bpt]; + bpt++; + } while (--nb > 0); + return 0; +} + + +void +xpm_xynormalizeimagebits(bp, img) + register unsigned char *bp; + register XImage *img; +{ + register unsigned char c; + + if (img->byte_order != img->bitmap_bit_order) { + switch (img->bitmap_unit) { + + case 16: + c = *bp; + *bp = *(bp + 1); + *(bp + 1) = c; + break; + + case 32: + c = *(bp + 3); + *(bp + 3) = *bp; + *bp = c; + c = *(bp + 2); + *(bp + 2) = *(bp + 1); + *(bp + 1) = c; + break; + } + } + if (img->bitmap_bit_order == MSBFirst) + _XReverse_Bytes(bp, img->bitmap_unit >> 3); +} + +void +xpm_znormalizeimagebits(bp, img) + register unsigned char *bp; + register XImage *img; +{ + register unsigned char c; + + switch (img->bits_per_pixel) { + + case 2: + _XReverse_Bytes(bp, 1); + break; + + case 4: + *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF); + break; + + case 16: + c = *bp; + *bp = *(bp + 1); + *(bp + 1) = c; + break; + + case 24: + c = *(bp + 2); + *(bp + 2) = *bp; + *bp = c; + break; + + case 32: + c = *(bp + 3); + *(bp + 3) = *bp; + *bp = c; + c = *(bp + 2); + *(bp + 2) = *(bp + 1); + *(bp + 1) = c; + break; + } +} + +static unsigned char Const _lomask[0x09] = { +0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; +static unsigned char Const _himask[0x09] = { +0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00}; + +static void +_putbits(src, dstoffset, numbits, dst) + register char *src; /* address of source bit string */ + int dstoffset; /* bit offset into destination; + * range is 0-31 */ + register int numbits; /* number of bits to copy to + * destination */ + register char *dst; /* address of destination bit string */ +{ + register unsigned char chlo, chhi; + int hibits; + + dst = dst + (dstoffset >> 3); + dstoffset = dstoffset & 7; + hibits = 8 - dstoffset; + chlo = *dst & _lomask[dstoffset]; + for (;;) { + chhi = (*src << dstoffset) & _himask[dstoffset]; + if (numbits <= hibits) { + chhi = chhi & _lomask[dstoffset + numbits]; + *dst = (*dst & _himask[dstoffset + numbits]) | chlo | chhi; + break; + } + *dst = chhi | chlo; + dst++; + numbits = numbits - hibits; + chlo = (unsigned char) (*src & _himask[hibits]) >> hibits; + src++; + if (numbits <= dstoffset) { + chlo = chlo & _lomask[numbits]; + *dst = (*dst & _himask[numbits]) | chlo; + break; + } + numbits = numbits - dstoffset; + } +} + +/* + * Default method to write pixels into a Z image data structure. + * The algorithm used is: + * + * copy the destination bitmap_unit or Zpixel to temp + * normalize temp if needed + * copy the pixel bits into the temp + * renormalize temp if needed + * copy the temp back into the destination image data + */ + +static void +SetImagePixels(image, width, height, pixelindex, pixels) + XImage *image; + unsigned int width; + unsigned int height; + unsigned int *pixelindex; + Pixel *pixels; +{ + register char *src; + register char *dst; + register unsigned int *iptr; + register int x, y, i; + register char *data; + Pixel pixel, px; + int nbytes, depth, ibu, ibpp; + + data = image->data; + iptr = pixelindex; + depth = image->depth; + if (depth == 1) { + ibu = image->bitmap_unit; + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + pixel = pixels[*iptr]; + for (i = 0, px = pixel; i < sizeof(unsigned long); + i++, px >>= 8) + ((unsigned char *) &pixel)[i] = px; + src = &data[XYINDEX(x, y, image)]; + dst = (char *) &px; + px = 0; + nbytes = ibu >> 3; + for (i = nbytes; --i >= 0;) + *dst++ = *src++; + XYNORMALIZE(&px, image); + _putbits((char *) &pixel, (x % ibu), 1, (char *) &px); + XYNORMALIZE(&px, image); + src = (char *) &px; + dst = &data[XYINDEX(x, y, image)]; + for (i = nbytes; --i >= 0;) + *dst++ = *src++; + } + } else { + ibpp = image->bits_per_pixel; + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + pixel = pixels[*iptr]; + if (depth == 4) + pixel &= 0xf; + for (i = 0, px = pixel; i < sizeof(unsigned long); i++, + px >>= 8) + ((unsigned char *) &pixel)[i] = px; + src = &data[ZINDEX(x, y, image)]; + dst = (char *) &px; + px = 0; + nbytes = (ibpp + 7) >> 3; + for (i = nbytes; --i >= 0;) + *dst++ = *src++; + ZNORMALIZE(&px, image); + _putbits((char *) &pixel, (x * ibpp) & 7, ibpp, (char *) &px); + ZNORMALIZE(&px, image); + src = (char *) &px; + dst = &data[ZINDEX(x, y, image)]; + for (i = nbytes; --i >= 0;) + *dst++ = *src++; + } + } +} + +/* + * write pixels into a 32-bits Z image data structure + */ + +#ifndef WORD64 +/* this item is static but deterministic so let it slide; doesn't +** hurt re-entrancy of this library. Note if it is actually const then would +** be OK under rules of ANSI-C but probably not C++ which may not +** want to allocate space for it. +*/ +static unsigned long /*constant */ RTXpm_byteorderpixel = MSBFirst << 24; + +#endif + +/* + WITHOUT_SPEEDUPS is a flag to be turned on if you wish to use the original + 3.2e code - by default you get the speeded-up version. +*/ + +static void +SetImagePixels32(image, width, height, pixelindex, pixels) + XImage *image; + unsigned int width; + unsigned int height; + unsigned int *pixelindex; + Pixel *pixels; +{ + unsigned char *data; + unsigned int *iptr; + int y; + Pixel pixel; + +#ifdef WITHOUT_SPEEDUPS + + int x; + unsigned char *addr; + + data = (unsigned char *) image->data; + iptr = pixelindex; +#ifndef WORD64 + if (*((char *) &RTXpm_byteorderpixel) == image->byte_order) { + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX32(x, y, image)]; + *((unsigned long *) addr) = pixels[*iptr]; + } + } else +#endif + if (image->byte_order == MSBFirst) + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX32(x, y, image)]; + pixel = pixels[*iptr]; + addr[0] = pixel >> 24; + addr[1] = pixel >> 16; + addr[2] = pixel >> 8; + addr[3] = pixel; + } + else + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX32(x, y, image)]; + pixel = pixels[*iptr]; + addr[0] = pixel; + addr[1] = pixel >> 8; + addr[2] = pixel >> 16; + addr[3] = pixel >> 24; + } + +#else /* WITHOUT_SPEEDUPS */ + + int bpl = image->bytes_per_line; + unsigned char *data_ptr, *max_data; + + data = (unsigned char *) image->data; + iptr = pixelindex; +#ifndef WORD64 + if (*((char *) &RTXpm_byteorderpixel) == image->byte_order) { + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + (width<<2); + + while (data_ptr < max_data) { + *((unsigned long *)data_ptr) = pixels[*(iptr++)]; + data_ptr += (1<<2); + } + data += bpl; + } + } else +#endif + if (image->byte_order == MSBFirst) + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + (width<<2); + + while (data_ptr < max_data) { + pixel = pixels[*(iptr++)]; + + *data_ptr++ = pixel >> 24; + *data_ptr++ = pixel >> 16; + *data_ptr++ = pixel >> 8; + *data_ptr++ = pixel; + + } + data += bpl; + } + else + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + (width<<2); + + while (data_ptr < max_data) { + pixel = pixels[*(iptr++)]; + + *data_ptr++ = pixel; + *data_ptr++ = pixel >> 8; + *data_ptr++ = pixel >> 16; + *data_ptr++ = pixel >> 24; + } + data += bpl; + } + +#endif /* WITHOUT_SPEEDUPS */ +} + +/* + * write pixels into a 16-bits Z image data structure + */ + +static void +SetImagePixels16(image, width, height, pixelindex, pixels) + XImage *image; + unsigned int width; + unsigned int height; + unsigned int *pixelindex; + Pixel *pixels; +{ + unsigned char *data; + unsigned int *iptr; + int y; + +#ifdef WITHOUT_SPEEDUPS + + int x; + unsigned char *addr; + + data = (unsigned char *) image->data; + iptr = pixelindex; + if (image->byte_order == MSBFirst) + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX16(x, y, image)]; + addr[0] = pixels[*iptr] >> 8; + addr[1] = pixels[*iptr]; + } + else + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX16(x, y, image)]; + addr[0] = pixels[*iptr]; + addr[1] = pixels[*iptr] >> 8; + } + +#else /* WITHOUT_SPEEDUPS */ + + Pixel pixel; + + int bpl=image->bytes_per_line; + unsigned char *data_ptr,*max_data; + + data = (unsigned char *) image->data; + iptr = pixelindex; + if (image->byte_order == MSBFirst) + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + (width<<1); + + while (data_ptr < max_data) { + pixel = pixels[*(iptr++)]; + + data_ptr[0] = pixel >> 8; + data_ptr[1] = pixel; + + data_ptr+=(1<<1); + } + data += bpl; + } + else + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + (width<<1); + + while (data_ptr < max_data) { + pixel = pixels[*(iptr++)]; + + data_ptr[0] = pixel; + data_ptr[1] = pixel >> 8; + + data_ptr+=(1<<1); + } + data += bpl; + } + +#endif /* WITHOUT_SPEEDUPS */ +} + +/* + * write pixels into a 8-bits Z image data structure + */ + +static void +SetImagePixels8(image, width, height, pixelindex, pixels) + XImage *image; + unsigned int width; + unsigned int height; + unsigned int *pixelindex; + Pixel *pixels; +{ + char *data; + unsigned int *iptr; + int y; + +#ifdef WITHOUT_SPEEDUPS + + int x; + + data = image->data; + iptr = pixelindex; + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) + data[ZINDEX8(x, y, image)] = pixels[*iptr]; + +#else /* WITHOUT_SPEEDUPS */ + + int bpl = image->bytes_per_line; + char *data_ptr,*max_data; + + data = image->data; + iptr = pixelindex; + + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + width; + + while (data_ptr < max_data) + *(data_ptr++) = pixels[*(iptr++)]; + + data += bpl; + } + +#endif /* WITHOUT_SPEEDUPS */ +} + +/* + * write pixels into a 1-bit depth image data structure and **offset null** + */ + +static void +SetImagePixels1(image, width, height, pixelindex, pixels) + XImage *image; + unsigned int width; + unsigned int height; + unsigned int *pixelindex; + Pixel *pixels; +{ + if (image->byte_order != image->bitmap_bit_order) + SetImagePixels(image, width, height, pixelindex, pixels); + else { + unsigned int *iptr; + int y; + char *data; + +#ifdef WITHOUT_SPEEDUPS + + int x; + + data = image->data; + iptr = pixelindex; + if (image->bitmap_bit_order == MSBFirst) + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + if (pixels[*iptr] & 1) + data[ZINDEX1(x, y, image)] |= 0x80 >> (x & 7); + else + data[ZINDEX1(x, y, image)] &= ~(0x80 >> (x & 7)); + } + else + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + if (pixels[*iptr] & 1) + data[ZINDEX1(x, y, image)] |= 1 << (x & 7); + else + data[ZINDEX1(x, y, image)] &= ~(1 << (x & 7)); + } + +#else /* WITHOUT_SPEEDUPS */ + + char value; + char *data_ptr, *max_data; + int bpl = image->bytes_per_line; + int diff, count; + + data = image->data; + iptr = pixelindex; + + diff = width & 7; + width >>= 3; + + if (image->bitmap_bit_order == MSBFirst) + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + width; + while (data_ptr < max_data) { + value=0; + + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + value=(value<<1) | (pixels[*(iptr++)] & 1); + + *(data_ptr++) = value; + } + if (diff) { + value = 0; + for (count = 0; count < diff; count++) { + if (pixels[*(iptr++)] & 1) + value |= (0x80>>count); + } + *(data_ptr) = value; + } + data += bpl; + } + else + for (y = 0; y < height; y++) { + data_ptr = data; + max_data = data_ptr + width; + while (data_ptr < max_data) { + value=0; + iptr+=8; + + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + value=(value<<1) | (pixels[*(--iptr)] & 1); + + iptr+=8; + *(data_ptr++) = value; + } + if (diff) { + value=0; + for (count = 0; count < diff; count++) { + if (pixels[*(iptr++)] & 1) + value |= (1<<count); + } + *(data_ptr) = value; + } + data += bpl; + } + +#endif /* WITHOUT_SPEEDUPS */ + } +} + + +int +XpmCreatePixmapFromXpmImage(display, d, image, + pixmap_return, shapemask_return, attributes) + Display *display; + Drawable d; + XpmImage *image; + Pixmap *pixmap_return; + Pixmap *shapemask_return; + XpmAttributes *attributes; +{ + XImage *ximage, **ximageptr = NULL; + XImage *shapeimage, **shapeimageptr = NULL; + int ErrorStatus; + XGCValues gcv; + GC gc; + + /* + * initialize return values + */ + if (pixmap_return) { + *pixmap_return = 0; + ximageptr = &ximage; + } + if (shapemask_return) { + *shapemask_return = 0; + shapeimageptr = &shapeimage; + } + /* + * create the ximages + */ + ErrorStatus = XpmCreateImageFromXpmImage(display, image, + ximageptr, shapeimageptr, + attributes); + if (ErrorStatus < 0) + return (ErrorStatus); + + /* + * create the pixmaps + */ + if (ximageptr && ximage) { + *pixmap_return = XCreatePixmap(display, d, ximage->width, + ximage->height, ximage->depth); + gcv.function = GXcopy; + gc = XCreateGC(display, *pixmap_return, GCFunction, &gcv); + + XPutImage(display, *pixmap_return, gc, ximage, 0, 0, 0, 0, + ximage->width, ximage->height); + + XDestroyImage(ximage); + XFreeGC(display, gc); + } + if (shapeimageptr && shapeimage) { + *shapemask_return = XCreatePixmap(display, d, shapeimage->width, + shapeimage->height, + shapeimage->depth); + gcv.function = GXcopy; + gc = XCreateGC(display, *shapemask_return, GCFunction, &gcv); + + XPutImage(display, *shapemask_return, gc, shapeimage, 0, 0, 0, 0, + shapeimage->width, shapeimage->height); + + XDestroyImage(shapeimage); + XFreeGC(display, gc); + } + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/data.c b/vendor/x11iraf/xpm/data.c new file mode 100644 index 00000000..2dc71ae8 --- /dev/null +++ b/vendor/x11iraf/xpm/data.c @@ -0,0 +1,645 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* data.c: * +* * +* XPM library * +* IO utilities * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +/* Official version number */ +static char *RCS_Version = "$XpmVersion: 3.3 $"; + +/* Internal version number */ +static char *RCS_Id = "$Id: xpm.shar,v 3.19 1993/12/22 13:27:07 lehors Exp $"; + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:stat.h" +#include "sys$library:ctype.h" +#else +#include <sys/stat.h> +#include <ctype.h> +#endif + +FUNC(atoui, unsigned int, (char *p, unsigned int l, unsigned int *ui_return)); +LFUNC(ParseComment, int, (xpmData * mdata)); + +unsigned int +atoui(p, l, ui_return) + register char *p; + unsigned int l; + unsigned int *ui_return; +{ + register int n, i; + + n = 0; + for (i = 0; i < l; i++) + if (*p >= '0' && *p <= '9') + n = n * 10 + *p++ - '0'; + else + break; + + if (i != 0 && i == l) { + *ui_return = n; + return 1; + } else + return 0; +} + +static int +ParseComment(mdata) + xpmData *mdata; +{ + if (mdata->type == XPMBUFFER) { + register char c; + register unsigned int n = 0; + unsigned int notend; + char *s, *s2; + + s = mdata->Comment; + *s = mdata->Bcmt[0]; + + /* skip the string beginning comment */ + s2 = mdata->Bcmt; + do { + c = *mdata->cptr++; + *++s = c; + n++; + s2++; + } while (c == *s2 && *s2 != '\0' && c && c != mdata->Bos); + + if (*s2 != '\0') { + /* this wasn't the beginning of a comment */ + mdata->cptr -= n; + return 0; + } + /* store comment */ + mdata->Comment[0] = *s; + s = mdata->Comment; + notend = 1; + n = 0; + while (notend) { + s2 = mdata->Ecmt; + while (*s != *s2 && c && c != mdata->Bos) { + c = *mdata->cptr++; + *++s = c; + n++; + } + mdata->CommentLength = n; + do { + c = *mdata->cptr++; + n++; + *++s = c; + s2++; + } while (c == *s2 && *s2 != '\0' && c && c != mdata->Bos); + if (*s2 == '\0') { + /* this is the end of the comment */ + notend = 0; + mdata->cptr--; + } + } + return 0; + } else { + FILE *file = mdata->stream.file; + register int c; + register unsigned int n = 0, a; + unsigned int notend; + char *s, *s2; + + s = mdata->Comment; + *s = mdata->Bcmt[0]; + + /* skip the string beginning comment */ + s2 = mdata->Bcmt; + do { + c = getc(file); + *++s = c; + n++; + s2++; + } while (c == *s2 && *s2 != '\0' + && c != EOF && c != mdata->Bos); + + if (*s2 != '\0') { + /* this wasn't the beginning of a comment */ + /* put characters back in the order that we got them */ + for (a = n; a > 0; a--, s--) + ungetc(*s, file); + return 0; + } + /* store comment */ + mdata->Comment[0] = *s; + s = mdata->Comment; + notend = 1; + n = 0; + while (notend) { + s2 = mdata->Ecmt; + while (*s != *s2 && c != EOF && c != mdata->Bos) { + c = getc(file); + *++s = c; + n++; + } + mdata->CommentLength = n; + do { + c = getc(file); + n++; + *++s = c; + s2++; + } while (c == *s2 && *s2 != '\0' + && c != EOF && c != mdata->Bos); + if (*s2 == '\0') { + /* this is the end of the comment */ + notend = 0; + ungetc(*s, file); + } + } + return 0; + } +} + +/* + * skip to the end of the current string and the beginning of the next one + */ +int +xpmNextString(mdata) + xpmData *mdata; +{ + if (!mdata->type) + mdata->cptr = (mdata->stream.data)[++mdata->line]; + else if (mdata->type == XPMBUFFER) { + register char c; + + /* get to the end of the current string */ + if (mdata->Eos) + while ((c = *mdata->cptr++) && c != mdata->Eos); + + /* + * then get to the beginning of the next string looking for possible + * comment + */ + if (mdata->Bos) { + while ((c = *mdata->cptr++) && c != mdata->Bos) + if (mdata->Bcmt && c == mdata->Bcmt[0]) + ParseComment(mdata); + } else if (mdata->Bcmt) { /* XPM2 natural */ + while ((c = *mdata->cptr++) == mdata->Bcmt[0]) + ParseComment(mdata); + mdata->cptr--; + } + } else { + register int c; + FILE *file = mdata->stream.file; + + /* get to the end of the current string */ + if (mdata->Eos) + while ((c = getc(file)) != mdata->Eos && c != EOF); + + /* + * then get to the beginning of the next string looking for possible + * comment + */ + if (mdata->Bos) { + while ((c = getc(file)) != mdata->Bos && c != EOF) + if (mdata->Bcmt && c == mdata->Bcmt[0]) + ParseComment(mdata); + + } else if (mdata->Bcmt) { /* XPM2 natural */ + while ((c = getc(file)) == mdata->Bcmt[0]) + ParseComment(mdata); + ungetc(c, file); + } + } + return 0; +} + + +/* + * skip whitespace and compute the following unsigned int, + * returns 1 if one is found and 0 if not + */ +int +xpmNextUI(mdata, ui_return) + xpmData *mdata; + unsigned int *ui_return; +{ + char buf[BUFSIZ]; + int l; + + l = xpmNextWord(mdata, buf, BUFSIZ); + return atoui(buf, l, ui_return); +} + +/* + * skip whitespace and return the following word + */ +unsigned int +xpmNextWord(mdata, buf, buflen) + xpmData *mdata; + char *buf; + unsigned int buflen; +{ + register unsigned int n = 0; + int c; + + if (!mdata->type || mdata->type == XPMBUFFER) { + while (isspace(c = *mdata->cptr) && c != mdata->Eos) + mdata->cptr++; + do { + c = *mdata->cptr++; + *buf++ = c; + n++; + } while (!isspace(c) && c != mdata->Eos && n < buflen); + n--; + mdata->cptr--; + } else { + FILE *file = mdata->stream.file; + + while ((c = getc(file)) != EOF && isspace(c) && c != mdata->Eos); + while (!isspace(c) && c != mdata->Eos && c != EOF && n < buflen) { + *buf++ = c; + n++; + c = getc(file); + } + ungetc(c, file); + } + return (n); +} + +/* + * return end of string - WARNING: malloc! + */ +int +xpmGetString(mdata, sptr, l) + xpmData *mdata; + char **sptr; + unsigned int *l; +{ + unsigned int i, n = 0; + int c; + char *p, *q, buf[BUFSIZ]; + + if (!mdata->type || mdata->type == XPMBUFFER) { + if (mdata->cptr) { + char *start; + + while (isspace(c = *mdata->cptr) && c != mdata->Eos) + mdata->cptr++; + start = mdata->cptr; + while ((c = *mdata->cptr) && c != mdata->Eos) + mdata->cptr++; + n = mdata->cptr - start + 1; + p = (char *) XpmMalloc(n); + if (!p) + return (XpmNoMemory); + strncpy(p, start, n); + if (mdata->type) /* XPMBUFFER */ + p[n - 1] = '\0'; + } + } else { + FILE *file = mdata->stream.file; + + while ((c = getc(file)) != EOF && isspace(c) && c != mdata->Eos); + if (c == EOF) + return (XpmFileInvalid); + p = NULL; + i = 0; + q = buf; + p = (char *) XpmMalloc(1); + while (c != mdata->Eos && c != EOF) { + if (i == BUFSIZ) { + /* get to the end of the buffer */ + /* malloc needed memory */ + q = (char *) XpmRealloc(p, n + i); + if (!q) { + XpmFree(p); + return (XpmNoMemory); + } + p = q; + q += n; + /* and copy what we already have */ + strncpy(q, buf, i); + n += i; + i = 0; + q = buf; + } + *q++ = c; + i++; + c = getc(file); + } + if (c == EOF) { + XpmFree(p); + return (XpmFileInvalid); + } + if (n + i != 0) { + /* malloc needed memory */ + q = (char *) XpmRealloc(p, n + i + 1); + if (!q) { + XpmFree(p); + return (XpmNoMemory); + } + p = q; + q += n; + /* and copy the buffer */ + strncpy(q, buf, i); + n += i; + p[n++] = '\0'; + } else { + *p = '\0'; + n = 1; + } + ungetc(c, file); + } + *sptr = p; + *l = n; + return (XpmSuccess); +} + +/* + * get the current comment line + */ +int +xpmGetCmt(mdata, cmt) + xpmData *mdata; + char **cmt; +{ + if (!mdata->type) + *cmt = NULL; + else if (mdata->CommentLength) { + *cmt = (char *) XpmMalloc(mdata->CommentLength + 1); + strncpy(*cmt, mdata->Comment, mdata->CommentLength); + (*cmt)[mdata->CommentLength] = '\0'; + mdata->CommentLength = 0; + } else + *cmt = NULL; + return 0; +} + +/* + * open the given file to be read as an xpmData which is returned. + */ +int +xpmReadFile(filename, mdata) + char *filename; + xpmData *mdata; +{ +#ifdef ZPIPE + char *compressfile, buf[BUFSIZ]; + struct stat status; + +#endif + + if (!filename) { + mdata->stream.file = (stdin); + mdata->type = XPMFILE; + } else { +#ifdef ZPIPE + if (((int)strlen(filename) > 2) && + !strcmp(".Z", filename + (strlen(filename) - 2))) { + mdata->type = XPMPIPE; + sprintf(buf, "uncompress -c %s", filename); + if (!(mdata->stream.file = popen(buf, "r"))) + return (XpmOpenFailed); + + } else if (((int)strlen(filename) > 3) && + !strcmp(".gz", filename + (strlen(filename) - 3))) { + mdata->type = XPMPIPE; + sprintf(buf, "gunzip -qc %s", filename); + if (!(mdata->stream.file = popen(buf, "r"))) + return (XpmOpenFailed); + + } else { + if (!(compressfile = (char *) XpmMalloc(strlen(filename) + 4))) + return (XpmNoMemory); + + strcpy(compressfile, filename); + strcat(compressfile, ".Z"); + if (!stat(compressfile, &status)) { + sprintf(buf, "uncompress -c %s", compressfile); + if (!(mdata->stream.file = popen(buf, "r"))) { + XpmFree(compressfile); + return (XpmOpenFailed); + } + mdata->type = XPMPIPE; + } else { + strcpy(compressfile, filename); + strcat(compressfile, ".gz"); + if (!stat(compressfile, &status)) { + sprintf(buf, "gunzip -c %s", compressfile); + if (!(mdata->stream.file = popen(buf, "r"))) { + XpmFree(compressfile); + return (XpmOpenFailed); + } + mdata->type = XPMPIPE; + } else { +#endif + if (!(mdata->stream.file = fopen(filename, "r"))) { +#ifdef ZPIPE + XpmFree(compressfile); +#endif + return (XpmOpenFailed); + } + mdata->type = XPMFILE; +#ifdef ZPIPE + } + } + XpmFree(compressfile); + } +#endif + } + mdata->CommentLength = 0; + return (XpmSuccess); +} + +/* + * open the given file to be written as an xpmData which is returned + */ +int +xpmWriteFile(filename, mdata) + char *filename; + xpmData *mdata; +{ +#ifdef ZPIPE + char buf[BUFSIZ]; + +#endif + + if (!filename) { + mdata->stream.file = (stdout); + mdata->type = XPMFILE; + } else { +#ifdef ZPIPE + if ((int)strlen(filename) > 2 + && !strcmp(".Z", filename + (strlen(filename) - 2))) { + sprintf(buf, "compress > %s", filename); + if (!(mdata->stream.file = popen(buf, "w"))) + return (XpmOpenFailed); + + mdata->type = XPMPIPE; + } else if ((int)strlen(filename) > 3 + && !strcmp(".gz", filename + (strlen(filename) - 3))) { + sprintf(buf, "gzip -q > %s", filename); + if (!(mdata->stream.file = popen(buf, "w"))) + return (XpmOpenFailed); + + mdata->type = XPMPIPE; + } else { +#endif + if (!(mdata->stream.file = fopen(filename, "w"))) + return (XpmOpenFailed); + + mdata->type = XPMFILE; +#ifdef ZPIPE + } +#endif + } + return (XpmSuccess); +} + +/* + * open the given array to be read or written as an xpmData which is returned + */ +void +xpmOpenArray(data, mdata) + char **data; + xpmData *mdata; +{ + mdata->type = XPMARRAY; + mdata->stream.data = data; + mdata->cptr = *data; + mdata->line = 0; + mdata->CommentLength = 0; + mdata->Bcmt = mdata->Ecmt = NULL; + mdata->Bos = mdata->Eos = '\0'; + mdata->format = 0; /* this can only be Xpm 2 or 3 */ +} + +/* + * open the given buffer to be read or written as an xpmData which is returned + */ +void +xpmOpenBuffer(buffer, mdata) + char *buffer; + xpmData *mdata; +{ + mdata->type = XPMBUFFER; + mdata->cptr = buffer; + mdata->CommentLength = 0; +} + +/* + * close the file related to the xpmData if any + */ +int +xpmDataClose(mdata) + xpmData *mdata; +{ + switch (mdata->type) { + case XPMARRAY: + case XPMBUFFER: + break; + case XPMFILE: + if (mdata->stream.file != (stdout) && mdata->stream.file != (stdin)) + fclose(mdata->stream.file); + break; +#ifdef ZPIPE + case XPMPIPE: + pclose(mdata->stream.file); + break; +#endif + } + return 0; +} + +xpmDataType xpmDataTypes[] = +{ + "", "!", "\n", '\0', '\n', "", "", "", "", /* Natural type */ + "C", "/*", "*/", '"', '"', ",\n", "static char *", "[] = {\n", "};\n", + "Lisp", ";", "\n", '"', '"', "\n", "(setq ", " '(\n", "))\n", +#ifdef VMS + NULL +#else + NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL +#endif +}; + +/* + * parse xpm header + */ +int +xpmParseHeader(mdata) + xpmData *mdata; +{ + char buf[BUFSIZ]; + int l, n = 0; + + if (mdata->type) { + mdata->Bos = '\0'; + mdata->Eos = '\n'; + mdata->Bcmt = mdata->Ecmt = NULL; + l = xpmNextWord(mdata, buf, BUFSIZ); + if (l == 7 && !strncmp("#define", buf, 7)) { + /* this maybe an XPM 1 file */ + char *ptr; + + l = xpmNextWord(mdata, buf, BUFSIZ); + if (!l) + return (XpmFileInvalid); + ptr = index(buf, '_'); + if (!ptr || strncmp("_format", ptr, l - (ptr - buf))) + return XpmFileInvalid; + /* this is definitely an XPM 1 file */ + mdata->format = 1; + n = 1; /* handle XPM1 as mainly XPM2 C */ + } else { + + /* + * skip the first word, get the second one, and see if this is + * XPM 2 or 3 + */ + l = xpmNextWord(mdata, buf, BUFSIZ); + if ((l == 3 && !strncmp("XPM", buf, 3)) || + (l == 4 && !strncmp("XPM2", buf, 4))) { + if (l == 3) + n = 1; /* handle XPM as XPM2 C */ + else { + /* get the type key word */ + l = xpmNextWord(mdata, buf, BUFSIZ); + + /* + * get infos about this type + */ + while (xpmDataTypes[n].type + && strncmp(xpmDataTypes[n].type, buf, l)) + n++; + } + mdata->format = 0; + } else + /* nope this is not an XPM file */ + return XpmFileInvalid; + } + if (xpmDataTypes[n].type) { + if (n == 0) { /* natural type */ + mdata->Bcmt = xpmDataTypes[n].Bcmt; + mdata->Ecmt = xpmDataTypes[n].Ecmt; + xpmNextString(mdata); /* skip the end of the headerline */ + mdata->Bos = xpmDataTypes[n].Bos; + mdata->Eos = xpmDataTypes[n].Eos; + } else { + mdata->Bcmt = xpmDataTypes[n].Bcmt; + mdata->Ecmt = xpmDataTypes[n].Ecmt; + if (!mdata->format) { /* XPM 2 or 3 */ + mdata->Bos = xpmDataTypes[n].Bos; + mdata->Eos = '\0'; + /* get to the beginning of the first string */ + xpmNextString(mdata); + mdata->Eos = xpmDataTypes[n].Eos; + } else /* XPM 1 skip end of line */ + xpmNextString(mdata); + } + } else + /* we don't know about that type of XPM file... */ + return XpmFileInvalid; + } + return XpmSuccess; +} diff --git a/vendor/x11iraf/xpm/doc/xpm.ps b/vendor/x11iraf/xpm/doc/xpm.ps new file mode 100644 index 00000000..23706d63 --- /dev/null +++ b/vendor/x11iraf/xpm/doc/xpm.ps @@ -0,0 +1,4750 @@ +%! +%%BoundingBox: (atend) +%%Pages: (atend) +%%DocumentFonts: (atend) +%%EndComments +% +% FrameMaker PostScript Prolog 3.0, for use with FrameMaker 3.0 +% Copyright (c) 1986,87,89,90,91 by Frame Technology Corporation. +% All rights reserved. +% +% Known Problems: +% Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1 +/FMversion (3.0) def +% Set up Color vs. Black-and-White + /FMPrintInColor systemdict /colorimage known + systemdict /currentcolortransfer known or def +% Uncomment this line to force b&w on color printer +% /FMPrintInColor false def +/FrameDict 195 dict def +systemdict /errordict known not {/errordict 10 dict def + errordict /rangecheck {stop} put} if +% The readline in 23.0 doesn't recognize cr's as nl's on AppleTalk +FrameDict /tmprangecheck errordict /rangecheck get put +errordict /rangecheck {FrameDict /bug true put} put +FrameDict /bug false put +mark +% Some PS machines read past the CR, so keep the following 3 lines together! +currentfile 5 string readline +00 +0000000000 +cleartomark +errordict /rangecheck FrameDict /tmprangecheck get put +FrameDict /bug get { + /readline { + /gstring exch def + /gfile exch def + /gindex 0 def + { + gfile read pop + dup 10 eq {exit} if + dup 13 eq {exit} if + gstring exch gindex exch put + /gindex gindex 1 add def + } loop + pop + gstring 0 gindex getinterval true + } def + } if +/FMVERSION { + FMversion ne { + /Times-Roman findfont 18 scalefont setfont + 100 100 moveto + (FrameMaker version does not match postscript_prolog!) + dup = + show showpage + } if + } def +/FMLOCAL { + FrameDict begin + 0 def + end + } def + /gstring FMLOCAL + /gfile FMLOCAL + /gindex FMLOCAL + /orgxfer FMLOCAL + /orgproc FMLOCAL + /organgle FMLOCAL + /orgfreq FMLOCAL + /yscale FMLOCAL + /xscale FMLOCAL + /manualfeed FMLOCAL + /paperheight FMLOCAL + /paperwidth FMLOCAL +/FMDOCUMENT { + array /FMfonts exch def + /#copies exch def + FrameDict begin + 0 ne dup {setmanualfeed} if + /manualfeed exch def + /paperheight exch def + /paperwidth exch def + /yscale exch def + /xscale exch def + currenttransfer cvlit /orgxfer exch def + currentscreen cvlit /orgproc exch def + /organgle exch def /orgfreq exch def + setpapername + manualfeed {true} {papersize} ifelse + {manualpapersize} {false} ifelse + {desperatepapersize} if + end + } def + /pagesave FMLOCAL + /orgmatrix FMLOCAL + /landscape FMLOCAL +/FMBEGINPAGE { + FrameDict begin + /pagesave save def + 3.86 setmiterlimit + /landscape exch 0 ne def + landscape { + 90 rotate 0 exch neg translate pop + } + {pop pop} + ifelse + xscale yscale scale + /orgmatrix matrix def + gsave + } def +/FMENDPAGE { + grestore + pagesave restore + end + showpage + } def +/FMFONTDEFINE { + FrameDict begin + findfont + ReEncode + 1 index exch + definefont + FMfonts 3 1 roll + put + end + } def +/FMFILLS { + FrameDict begin + array /fillvals exch def + end + } def +/FMFILL { + FrameDict begin + fillvals 3 1 roll put + end + } def +/FMNORMALIZEGRAPHICS { + newpath + 0.0 0.0 moveto + 1 setlinewidth + 0 setlinecap + 0 0 0 sethsbcolor + 0 setgray + } bind def + /fx FMLOCAL + /fy FMLOCAL + /fh FMLOCAL + /fw FMLOCAL + /llx FMLOCAL + /lly FMLOCAL + /urx FMLOCAL + /ury FMLOCAL +/FMBEGINEPSF { + end + /FMEPSF save def + /showpage {} def + FMNORMALIZEGRAPHICS + [/fy /fx /fh /fw /ury /urx /lly /llx] {exch def} forall + fx fy translate + rotate + fw urx llx sub div fh ury lly sub div scale + llx neg lly neg translate + } bind def +/FMENDEPSF { + FMEPSF restore + FrameDict begin + } bind def +FrameDict begin +/setmanualfeed { +%%BeginFeature *ManualFeed True + statusdict /manualfeed true put +%%EndFeature + } def +/max {2 copy lt {exch} if pop} bind def +/min {2 copy gt {exch} if pop} bind def +/inch {72 mul} def +/pagedimen { + paperheight sub abs 16 lt exch + paperwidth sub abs 16 lt and + {/papername exch def} {pop} ifelse + } def + /papersizedict FMLOCAL +/setpapername { + /papersizedict 14 dict def + papersizedict begin + /papername /unknown def + /Letter 8.5 inch 11.0 inch pagedimen + /LetterSmall 7.68 inch 10.16 inch pagedimen + /Tabloid 11.0 inch 17.0 inch pagedimen + /Ledger 17.0 inch 11.0 inch pagedimen + /Legal 8.5 inch 14.0 inch pagedimen + /Statement 5.5 inch 8.5 inch pagedimen + /Executive 7.5 inch 10.0 inch pagedimen + /A3 11.69 inch 16.5 inch pagedimen + /A4 8.26 inch 11.69 inch pagedimen + /A4Small 7.47 inch 10.85 inch pagedimen + /B4 10.125 inch 14.33 inch pagedimen + /B5 7.16 inch 10.125 inch pagedimen + end + } def +/papersize { + papersizedict begin + /Letter {a4tray a4} def + /LetterSmall {lettertray lettersmall} def + /Tabloid {11x17tray 11x17} def + /Ledger {ledgertray ledger} def + /Legal {legaltray legal} def + /Statement {statementtray statement} def + /Executive {executivetray executive} def + /A3 {a3tray a3} def + /A4 {a4tray a4} def + /A4Small {a4tray a4small} def + /B4 {b4tray b4} def + /B5 {b5tray b5} def + /unknown {unknown} def + papersizedict dup papername known {papername} {/unknown} ifelse get + end + /FMdicttop countdictstack 1 add def + statusdict begin stopped end + countdictstack -1 FMdicttop {pop end} for + } def +/manualpapersize { + papersizedict begin + /Letter {letter} def + /LetterSmall {lettersmall} def + /Tabloid {11x17} def + /Ledger {ledger} def + /Legal {legal} def + /Statement {statement} def + /Executive {executive} def + /A3 {a3} def + /A4 {a4} def + /A4Small {a4small} def + /B4 {b4} def + /B5 {b5} def + /unknown {unknown} def + papersizedict dup papername known {papername} {/unknown} ifelse get + end + stopped + } def +/desperatepapersize { + statusdict /setpageparams known + { + paperwidth paperheight 0 1 + statusdict begin + {setpageparams} stopped pop + end + } if + } def +/savematrix { + orgmatrix currentmatrix pop + } bind def +/restorematrix { + orgmatrix setmatrix + } bind def +/dmatrix matrix def +/dpi 72 0 dmatrix defaultmatrix dtransform + dup mul exch dup mul add sqrt def +/freq dpi 18.75 div 8 div round dup 0 eq {pop 1} if 8 mul dpi exch div def +/sangle 1 0 dmatrix defaultmatrix dtransform exch atan def +/DiacriticEncoding [ +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl +/numbersign /dollar /percent /ampersand /quotesingle /parenleft +/parenright /asterisk /plus /comma /hyphen /period /slash /zero /one +/two /three /four /five /six /seven /eight /nine /colon /semicolon +/less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K +/L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash +/bracketright /asciicircum /underscore /grave /a /b /c /d /e /f /g /h +/i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar +/braceright /asciitilde /.notdef /Adieresis /Aring /Ccedilla /Eacute +/Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis +/atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis +/iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve +/ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex +/udieresis /dagger /.notdef /cent /sterling /section /bullet +/paragraph /germandbls /registered /copyright /trademark /acute +/dieresis /.notdef /AE /Oslash /.notdef /.notdef /.notdef /.notdef +/yen /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef +/ordfeminine /ordmasculine /.notdef /ae /oslash /questiondown +/exclamdown /logicalnot /.notdef /florin /.notdef /.notdef +/guillemotleft /guillemotright /ellipsis /.notdef /Agrave /Atilde +/Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright +/quoteleft /quoteright /.notdef /.notdef /ydieresis /Ydieresis +/fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl +/periodcentered /quotesinglbase /quotedblbase /perthousand +/Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute +/Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve +/Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron +/breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron +] def +/ReEncode { + dup + length + dict begin + { + 1 index /FID ne + {def} + {pop pop} ifelse + } forall + 0 eq {/Encoding DiacriticEncoding def} if + currentdict + end + } bind def +/graymode true def + /bwidth FMLOCAL + /bpside FMLOCAL + /bstring FMLOCAL + /onbits FMLOCAL + /offbits FMLOCAL + /xindex FMLOCAL + /yindex FMLOCAL + /x FMLOCAL + /y FMLOCAL +/setpattern { + /bwidth exch def + /bpside exch def + /bstring exch def + /onbits 0 def /offbits 0 def + freq sangle landscape {90 add} if + {/y exch def + /x exch def + /xindex x 1 add 2 div bpside mul cvi def + /yindex y 1 add 2 div bpside mul cvi def + bstring yindex bwidth mul xindex 8 idiv add get + 1 7 xindex 8 mod sub bitshift and 0 ne + {/onbits onbits 1 add def 1} + {/offbits offbits 1 add def 0} + ifelse + } + setscreen + {} settransfer + offbits offbits onbits add div FMsetgray + /graymode false def + } bind def +/grayness { + FMsetgray + graymode not { + /graymode true def + orgxfer cvx settransfer + orgfreq organgle orgproc cvx setscreen + } if + } bind def + /HUE FMLOCAL + /SAT FMLOCAL + /BRIGHT FMLOCAL + /Colors FMLOCAL +FMPrintInColor + + { + /HUE 0 def + /SAT 0 def + /BRIGHT 0 def + % array of arrays Hue and Sat values for the separations [HUE BRIGHT] + /Colors + [[0 0 ] % black + [0 0 ] % white + [0.00 1.0] % red + [0.37 1.0] % green + [0.60 1.0] % blue + [0.50 1.0] % cyan + [0.83 1.0] % magenta + [0.16 1.0] % comment / yellow + ] def + + /BEGINBITMAPCOLOR { + BITMAPCOLOR} def + /BEGINBITMAPCOLORc { + BITMAPCOLORc} def + /BEGINBITMAPTRUECOLOR { + BITMAPTRUECOLOR } def + /BEGINBITMAPTRUECOLORc { + BITMAPTRUECOLORc } def + /K { + Colors exch get dup + 0 get /HUE exch store + 1 get /BRIGHT exch store + HUE 0 eq BRIGHT 0 eq and + {1.0 SAT sub setgray} + {HUE SAT BRIGHT sethsbcolor} + ifelse + } def + /FMsetgray { + /SAT exch 1.0 exch sub store + HUE 0 eq BRIGHT 0 eq and + {1.0 SAT sub setgray} + {HUE SAT BRIGHT sethsbcolor} + ifelse + } bind def + } + + { + /BEGINBITMAPCOLOR { + BITMAPGRAY} def + /BEGINBITMAPCOLORc { + BITMAPGRAYc} def + /BEGINBITMAPTRUECOLOR { + BITMAPTRUEGRAY } def + /BEGINBITMAPTRUECOLORc { + BITMAPTRUEGRAYc } def + /FMsetgray {setgray} bind def + /K { + pop + } def + } +ifelse +/normalize { + transform round exch round exch itransform + } bind def +/dnormalize { + dtransform round exch round exch idtransform + } bind def +/lnormalize { + 0 dtransform exch cvi 2 idiv 2 mul 1 add exch idtransform pop + } bind def +/H { + lnormalize setlinewidth + } bind def +/Z { + setlinecap + } bind def + /fillvals FMLOCAL +/X { + fillvals exch get + dup type /stringtype eq + {8 1 setpattern} + {grayness} + ifelse + } bind def +/V { + gsave eofill grestore + } bind def +/N { + stroke + } bind def +/M {newpath moveto} bind def +/E {lineto} bind def +/D {curveto} bind def +/O {closepath} bind def + /n FMLOCAL +/L { + /n exch def + newpath + normalize + moveto + 2 1 n {pop normalize lineto} for + } bind def +/Y { + L + closepath + } bind def + /x1 FMLOCAL + /x2 FMLOCAL + /y1 FMLOCAL + /y2 FMLOCAL + /rad FMLOCAL +/R { + /y2 exch def + /x2 exch def + /y1 exch def + /x1 exch def + x1 y1 + x2 y1 + x2 y2 + x1 y2 + 4 Y + } bind def +/RR { + /rad exch def + normalize + /y2 exch def + /x2 exch def + normalize + /y1 exch def + /x1 exch def + newpath + x1 y1 rad add moveto + x1 y2 x2 y2 rad arcto + x2 y2 x2 y1 rad arcto + x2 y1 x1 y1 rad arcto + x1 y1 x1 y2 rad arcto + closepath + 16 {pop} repeat + } bind def +/C { + grestore + gsave + R + clip + } bind def + /FMpointsize FMLOCAL +/F { + FMfonts exch get + FMpointsize scalefont + setfont + } bind def +/Q { + /FMpointsize exch def + F + } bind def +/T { + moveto show + } bind def +/RF { + rotate + 0 ne {-1 1 scale} if + } bind def +/TF { + gsave + moveto + RF + show + grestore + } bind def +/P { + moveto + 0 32 3 2 roll widthshow + } bind def +/PF { + gsave + moveto + RF + 0 32 3 2 roll widthshow + grestore + } bind def +/S { + moveto + 0 exch ashow + } bind def +/SF { + gsave + moveto + RF + 0 exch ashow + grestore + } bind def +/B { + moveto + 0 32 4 2 roll 0 exch awidthshow + } bind def +/BF { + gsave + moveto + RF + 0 32 4 2 roll 0 exch awidthshow + grestore + } bind def +/G { + gsave + newpath + normalize translate 0.0 0.0 moveto + dnormalize scale + 0.0 0.0 1.0 5 3 roll arc + closepath fill + grestore + } bind def +/A { + gsave + savematrix + newpath + 2 index 2 div add exch 3 index 2 div sub exch + normalize 2 index 2 div sub exch 3 index 2 div add exch + translate + scale + 0.0 0.0 1.0 5 3 roll arc + restorematrix + stroke + grestore + } bind def + /x FMLOCAL + /y FMLOCAL + /w FMLOCAL + /h FMLOCAL + /xx FMLOCAL + /yy FMLOCAL + /ww FMLOCAL + /hh FMLOCAL + /FMsaveobject FMLOCAL + /FMoptop FMLOCAL + /FMdicttop FMLOCAL +/BEGINPRINTCODE { + /FMdicttop countdictstack 1 add def + /FMoptop count 4 sub def + /FMsaveobject save def + userdict begin + /showpage {} def + FMNORMALIZEGRAPHICS + 3 index neg 3 index neg translate + } bind def +/ENDPRINTCODE { + count -1 FMoptop {pop pop} for + countdictstack -1 FMdicttop {pop end} for + FMsaveobject restore + } bind def +/gn { + 0 + { 46 mul + cf read pop + 32 sub + dup 46 lt {exit} if + 46 sub add + } loop + add + } bind def + /str FMLOCAL +/cfs { + /str sl string def + 0 1 sl 1 sub {str exch val put} for + str def + } bind def +/ic [ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223 + 0 + {0 hx} {1 hx} {2 hx} {3 hx} {4 hx} {5 hx} {6 hx} {7 hx} {8 hx} {9 hx} + {10 hx} {11 hx} {12 hx} {13 hx} {14 hx} {15 hx} {16 hx} {17 hx} {18 hx} + {19 hx} {gn hx} {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} + {13} {14} {15} {16} {17} {18} {19} {gn} {0 wh} {1 wh} {2 wh} {3 wh} + {4 wh} {5 wh} {6 wh} {7 wh} {8 wh} {9 wh} {10 wh} {11 wh} {12 wh} + {13 wh} {14 wh} {gn wh} {0 bl} {1 bl} {2 bl} {3 bl} {4 bl} {5 bl} {6 bl} + {7 bl} {8 bl} {9 bl} {10 bl} {11 bl} {12 bl} {13 bl} {14 bl} {gn bl} + {0 fl} {1 fl} {2 fl} {3 fl} {4 fl} {5 fl} {6 fl} {7 fl} {8 fl} {9 fl} + {10 fl} {11 fl} {12 fl} {13 fl} {14 fl} {gn fl} + ] def + /sl FMLOCAL + /val FMLOCAL + /ws FMLOCAL + /im FMLOCAL + /bs FMLOCAL + /cs FMLOCAL + /len FMLOCAL + /pos FMLOCAL +/ms { + /sl exch def + /val 255 def + /ws cfs + /im cfs + /val 0 def + /bs cfs + /cs cfs + } bind def +400 ms +/ip { + is + 0 + cf cs readline pop + { ic exch get exec + add + } forall + pop + + } bind def +/wh { + /len exch def + /pos exch def + ws 0 len getinterval im pos len getinterval copy pop + pos len + } bind def +/bl { + /len exch def + /pos exch def + bs 0 len getinterval im pos len getinterval copy pop + pos len + } bind def +/s1 1 string def +/fl { + /len exch def + /pos exch def + /val cf s1 readhexstring pop 0 get def + pos 1 pos len add 1 sub {im exch val put} for + pos len + } bind def +/hx { + 3 copy getinterval + cf exch readhexstring pop pop + } bind def + /h FMLOCAL + /w FMLOCAL + /d FMLOCAL + /lb FMLOCAL + /bitmapsave FMLOCAL + /is FMLOCAL + /cf FMLOCAL +/wbytes { + dup + 8 eq {pop} {1 eq {7 add 8 idiv} {3 add 4 idiv} ifelse} ifelse + } bind def +/BEGINBITMAPBWc { + 1 {} COMMONBITMAPc + } bind def +/BEGINBITMAPGRAYc { + 8 {} COMMONBITMAPc + } bind def +/BEGINBITMAP2BITc { + 2 {} COMMONBITMAPc + } bind def +/COMMONBITMAPc { + /r exch def + /d exch def + gsave + translate rotate scale /h exch def /w exch def + /lb w d wbytes def + sl lb lt {lb ms} if + /bitmapsave save def + r + /is im 0 lb getinterval def + ws 0 lb getinterval is copy pop + /cf currentfile def + w h d [w 0 0 h neg 0 h] + {ip} image + bitmapsave restore + grestore + } bind def +/BEGINBITMAPBW { + 1 {} COMMONBITMAP + } bind def +/BEGINBITMAPGRAY { + 8 {} COMMONBITMAP + } bind def +/BEGINBITMAP2BIT { + 2 {} COMMONBITMAP + } bind def +/COMMONBITMAP { + /r exch def + /d exch def + gsave + translate rotate scale /h exch def /w exch def + /bitmapsave save def + r + /is w d wbytes string def + /cf currentfile def + w h d [w 0 0 h neg 0 h] + {cf is readhexstring pop} image + bitmapsave restore + grestore + } bind def + /proc1 FMLOCAL + /proc2 FMLOCAL + /newproc FMLOCAL +/Fmcc { + /proc2 exch cvlit def + /proc1 exch cvlit def + /newproc proc1 length proc2 length add array def + newproc 0 proc1 putinterval + newproc proc1 length proc2 putinterval + newproc cvx +} bind def +/ngrayt 256 array def +/nredt 256 array def +/nbluet 256 array def +/ngreent 256 array def + /gryt FMLOCAL + /blut FMLOCAL + /grnt FMLOCAL + /redt FMLOCAL + /indx FMLOCAL + /cynu FMLOCAL + /magu FMLOCAL + /yelu FMLOCAL + /k FMLOCAL + /u FMLOCAL +/colorsetup { + currentcolortransfer + /gryt exch def + /blut exch def + /grnt exch def + /redt exch def + 0 1 255 { + /indx exch def + /cynu 1 red indx get 255 div sub def + /magu 1 green indx get 255 div sub def + /yelu 1 blue indx get 255 div sub def + /k cynu magu min yelu min def + /u k currentundercolorremoval exec def + nredt indx 1 0 cynu u sub max sub redt exec put + ngreent indx 1 0 magu u sub max sub grnt exec put + nbluet indx 1 0 yelu u sub max sub blut exec put + ngrayt indx 1 k currentblackgeneration exec sub gryt exec put + } for + {255 mul cvi nredt exch get} + {255 mul cvi ngreent exch get} + {255 mul cvi nbluet exch get} + {255 mul cvi ngrayt exch get} + setcolortransfer + {pop 0} setundercolorremoval + {} setblackgeneration + } bind def + /tran FMLOCAL +/fakecolorsetup { + /tran 256 string def + 0 1 255 {/indx exch def + tran indx + red indx get 77 mul + green indx get 151 mul + blue indx get 28 mul + add add 256 idiv put} for + currenttransfer + {255 mul cvi tran exch get 255.0 div} + exch Fmcc settransfer +} bind def +/BITMAPCOLOR { + /d 8 def + gsave + translate rotate scale /h exch def /w exch def + /bitmapsave save def + colorsetup + /is w d wbytes string def + /cf currentfile def + w h d [w 0 0 h neg 0 h] + {cf is readhexstring pop} {is} {is} true 3 colorimage + bitmapsave restore + grestore + } bind def +/BITMAPCOLORc { + /d 8 def + gsave + translate rotate scale /h exch def /w exch def + /lb w d wbytes def + sl lb lt {lb ms} if + /bitmapsave save def + colorsetup + /is im 0 lb getinterval def + ws 0 lb getinterval is copy pop + /cf currentfile def + w h d [w 0 0 h neg 0 h] + {ip} {is} {is} true 3 colorimage + bitmapsave restore + grestore + } bind def +/BITMAPTRUECOLORc { + gsave + translate rotate scale /h exch def /w exch def + /bitmapsave save def + + /is w string def + + ws 0 w getinterval is copy pop + /cf currentfile def + w h 8 [w 0 0 h neg 0 h] + {ip} {gip} {bip} true 3 colorimage + bitmapsave restore + grestore + } bind def +/BITMAPTRUECOLOR { + gsave + translate rotate scale /h exch def /w exch def + /bitmapsave save def + /is w string def + /gis w string def + /bis w string def + /cf currentfile def + w h 8 [w 0 0 h neg 0 h] + { cf is readhexstring pop } + { cf gis readhexstring pop } + { cf bis readhexstring pop } + true 3 colorimage + bitmapsave restore + grestore + } bind def +/BITMAPTRUEGRAYc { + gsave + translate rotate scale /h exch def /w exch def + /bitmapsave save def + + /is w string def + + ws 0 w getinterval is copy pop + /cf currentfile def + w h 8 [w 0 0 h neg 0 h] + {ip gip bip w gray} image + bitmapsave restore + grestore + } bind def +/ww FMLOCAL +/r FMLOCAL +/g FMLOCAL +/b FMLOCAL +/i FMLOCAL +/gray { + /ww exch def + /b exch def + /g exch def + /r exch def + 0 1 ww 1 sub { /i exch def r i get .299 mul g i get .587 mul + b i get .114 mul add add r i 3 -1 roll floor cvi put } for + r + } bind def +/BITMAPTRUEGRAY { + gsave + translate rotate scale /h exch def /w exch def + /bitmapsave save def + /is w string def + /gis w string def + /bis w string def + /cf currentfile def + w h 8 [w 0 0 h neg 0 h] + { cf is readhexstring pop + cf gis readhexstring pop + cf bis readhexstring pop w gray} image + bitmapsave restore + grestore + } bind def +/BITMAPGRAY { + 8 {fakecolorsetup} COMMONBITMAP + } bind def +/BITMAPGRAYc { + 8 {fakecolorsetup} COMMONBITMAPc + } bind def +/ENDBITMAP { + } bind def +end + /ALDsave FMLOCAL + /ALDmatrix matrix def ALDmatrix currentmatrix pop +/StartALD { + /ALDsave save def + savematrix + ALDmatrix setmatrix + } bind def +/InALD { + restorematrix + } bind def +/DoneALD { + ALDsave restore + } bind def +%%EndProlog +%%BeginSetup +(3.0) FMVERSION +1 1 612 792 0 1 15 FMDOCUMENT +0 0 /Times-Bold FMFONTDEFINE +1 0 /Times-Roman FMFONTDEFINE +2 0 /Helvetica FMFONTDEFINE +3 0 /Courier FMFONTDEFINE +4 0 /Times-Italic FMFONTDEFINE +32 FMFILLS +0 0 FMFILL +1 0.1 FMFILL +2 0.3 FMFILL +3 0.5 FMFILL +4 0.7 FMFILL +5 0.9 FMFILL +6 0.97 FMFILL +7 1 FMFILL +8 <0f1e3c78f0e1c387> FMFILL +9 <0f87c3e1f0783c1e> FMFILL +10 <cccccccccccccccc> FMFILL +11 <ffff0000ffff0000> FMFILL +12 <8142241818244281> FMFILL +13 <03060c183060c081> FMFILL +14 <8040201008040201> FMFILL +16 1 FMFILL +17 0.9 FMFILL +18 0.7 FMFILL +19 0.5 FMFILL +20 0.3 FMFILL +21 0.1 FMFILL +22 0.03 FMFILL +23 0 FMFILL +24 <f0e1c3870f1e3c78> FMFILL +25 <f0783c1e0f87c3e1> FMFILL +26 <3333333333333333> FMFILL +27 <0000ffff0000ffff> FMFILL +28 <7ebddbe7e7dbbd7e> FMFILL +29 <fcf9f3e7cf9f3f7e> FMFILL +30 <7fbfdfeff7fbfdfe> FMFILL +%%EndSetup +%%Page: "1" 1 +%%BeginPaperSize: Letter +%%EndPaperSize +612 792 0 FMBEGINPAGE +0 36 Q +0 X +0 K +(XPM Manual) 200.51 534 T +1 18 Q +(The) 223.31 468 T +0 F +(X) 255.78 468 T +(P) 273.27 468 T +1 F +(ix) 284.26 468 T +0 F +(M) 298.26 468 T +1 F +(ap Format) 315.24 468 T +1 14 Q +(Version: 3.3) 271.41 375.97 T +(December 20) 249.66 343.97 T +1 8 Q +(th) 324.64 347.97 T +1 14 Q +( 1993) 330.86 343.97 T +2 F +(Arnaud Le Hors) 257.01 253.27 T +3 12 Q +(lehors@sophia.inria.fr) 226.84 238.6 T +1 10 Q +(\251 BULL 1990-93) 270 139.23 T +FMENDPAGE +%%EndPage: "1" 2 +%%Page: "2" 2 +612 792 0 FMBEGINPAGE +0 18 Q +0 X +0 K +(Copyright restrictions) 72 681 T +1 10 Q +(Copyright 1990-93 GROUPE BULL) 72 652.33 T +2 F +0.68 (Permission to use, copy, modify, and distribute this software and its documentation for any purpose and) 72 628.33 P +0.41 (without fee is hereby granted, provided that the above copyright notice appear in all copies and that both) 72 616.33 P +0.05 (that copyright notice and this permission notice appear in supporting documentation, and that the name of) 72 604.33 P +-0.26 (GROUPE BULL not be used in advertising or publicity pertaining to distribution of the software without spe-) 72 592.33 P +0.54 (cific, written prior permission. GROUPE BULL makes no representations about the suitability of this soft-) 72 580.33 P +(ware for any purpose. It is provided) 72 568.33 T +1 F +(\322) 230.87 568.33 T +2 F +(as is) 235.31 568.33 T +1 F +(\323) 255.86 568.33 T +2 F +(without express or implied warranty.) 262.8 568.33 T +1 F +0.26 (GROUPE BULL disclaims all warranties with regard to this software, including all implied warranties of merchant-) 72 544.33 P +0.28 (ability and fitness, in no event shall GROUPE BULL be liable for any special, indirect or consequential damages or) 72 532.33 P +-0.58 (any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other) 72 520.33 P +(tortious action, arising out of or in connection with the use or performance of this software.) 72 508.33 T +0 18 Q +(Acknowledgements) 72 479 T +1 10 Q +-0.53 (I want to thank my team partner and friend Colas Nahaboo who proposed me this project, and who actively participates) 72 450.33 P +-0.34 (to its design. I also want to thank all the users who help me to improve the library by giving feed back and sending bug) 72 438.33 P +(reports.) 72 426.33 T +1 14 Q +(Arnaud Le Hors) 449.08 405.67 T +1 10 Q +(KOALA Project \320 BULL Research c/o INRIA) 354.03 392.33 T +(2004 route des Lucioles \320 06565 Valbonne Cedex \320 FRANCE) 290.44 380.33 T +0 18 Q +(Support) 72 351 T +1 10 Q +1.06 (You can mail any question or suggestion relative to) 72 322.33 P +0 F +1.06 (XPM) 290.05 322.33 P +1 F +1.06 ( by electronic mail to) 312.81 322.33 P +3 F +2.55 (lehors@sophia.inria.fr) 405.57 322.33 P +1 F +1.06 (.) 537.5 322.33 P +-0.05 (There is also a mailing list, please mail requests to) 72 310.33 P +3 F +-0.12 (xpm-talk-request@sophia.inria.fr) 275.53 310.33 P +1 F +-0.05 ( to subscribe. You) 467.42 310.33 P +0.2 (can find the latest release by anonymous ftp on avahi.inria.fr \050138.96.24.30\051 or export.lcs.mit.edu \05018.30.0.238\051, and) 72 298.33 P +(also an archive of the mailing list on avahi.) 72 286.33 T +FMENDPAGE +%%EndPage: "2" 3 +%%Page: "3" 3 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +225 639 396 657 R +7 X +V +1 18 Q +0 X +(Table of Contents) 246.04 645 T +540 72 72 72 2 L +N +1 12 Q +(Chapter 1:) 72 568 T +(Introduction) 135 568 T +(.........................................................................................................) 197.89 568 T +(5) 525 568 T +(Chapter 2:) 72 544 T +(The XPM Format) 135 544 T +(................................................................................................) 224.88 544 T +(6) 525 544 T +(Chapter 3:) 72 520 T +(The XPM Library) 135 520 T +(................................................................................................) 224.88 520 T +(9) 525 520 T +(3.1 The Basic Level Interface) 108 498 T +(.....................................................................................) 257.86 498 T +(9) 525 498 T +(3.1.1 The structures) 144 480 T +(.........................................................................................) 245.87 480 T +(9) 525 480 T +(3.1.2 Functions to deal with XPM files) 144 466 T +(..........................................................) 338.81 466 T +(11) 519.01 466 T +(3.1.3 Functions to deal with XPM data) 144 452 T +(..........................................................) 338.81 452 T +(14) 519.01 452 T +(3.1.4 Functions to deal with XPM files and data) 144 438 T +(............................................) 380.79 438 T +(16) 519.01 438 T +(3.1.5 Functions to deal with XPM buffers) 144 424 T +(......................................................) 350.81 424 T +(16) 519.01 424 T +(3.1.6 Functions to deal with XPM files and buffers) 144 410 T +(.......................................) 395.78 410 T +(18) 519.01 410 T +(3.1.7 Miscellaneous functions) 144 396 T +(........................................................................) 296.84 396 T +(19) 519.01 396 T +(3.2 The Advanced Level Interface) 108 374 T +(..............................................................................) 278.85 374 T +(20) 519.01 374 T +(3.2.1 The structures) 144 356 T +(.........................................................................................) 245.87 356 T +(21) 519.01 356 T +(3.2.2 Functions to deal with XPM files) 144 342 T +(..........................................................) 338.81 342 T +(22) 519.01 342 T +(3.2.3 Functions to deal with XPM data) 144 328 T +(..........................................................) 338.81 328 T +(23) 519.01 328 T +(3.2.4 Functions to deal with XPM buffers) 144 314 T +(......................................................) 350.81 314 T +(23) 519.01 314 T +(3.2.5 Functions to deal with X images) 144 300 T +(............................................................) 332.82 300 T +(24) 519.01 300 T +(3.2.6 Functions to deal with X pixmaps) 144 286 T +(.........................................................) 341.81 286 T +(25) 519.01 286 T +(3.2.7 Miscellaneous functions) 144 272 T +(........................................................................) 296.84 272 T +(26) 519.01 272 T +FMENDPAGE +%%EndPage: "3" 4 +%%Page: "5" 4 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(5) 303.11 54.85 T +0 18 Q +(Chapter 1) 267.28 680.84 T +(Introduction) 257.02 644.84 T +1 10 Q +0.52 (First, Why another image format? We \050Koala team at Bull Research, France\051 felt that most images bundled with X) 72 586.18 P +0.57 (applications will be small "icons", and that since many applications are color-customizable, existing image formats) 72 574.18 P +-0.18 (such as gif, tiff, iff, etc... were intended for big images with well-defined colors and so weren\325t adapted to the task. So) 72 562.18 P +0 F +(XPM) 72 550.18 T +1 F +( was designed with these criterions in mind:) 94.76 550.18 T +(\245) 72 532.18 T +(be editable by hand \050under emacs, vi...\051. Although this sounds pretty weird today.) 86.4 532.18 T +(\245) 72 514.18 T +(be includable in C code. It is unreasonable to load 1000 pixmap files on each start of an application.) 86.4 514.18 T +(\245) 72 496.18 T +(be a portable, mailable ascii format.) 86.4 496.18 T +(\245) 72 478.18 T +(provide defaults for monochrome/color/grayscale renderings.) 86.4 478.18 T +(\245) 72 460.18 T +-0.01 (provide overriding of colors. This way if the user wants your application to be bluish instead of greenish, you can) 86.4 460.18 P +(use the SAME icon files.) 86.4 448.18 T +(\245) 72 430.18 T +(allow comments to be included in the file.) 86.4 430.18 T +(\245) 72 412.18 T +(compression must be managed apart of the format.) 86.4 412.18 T +FMENDPAGE +%%EndPage: "5" 5 +%%Page: "6" 5 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(6) 303 56.01 T +0 18 Q +(Chapter 2) 267.28 681 T +(The XPM Format) 237.05 645 T +1 10 Q +0.02 (The) 72 586.33 P +0 F +0.02 (XPM) 90.06 586.33 P +1 F +0.02 ( format presents a C syntax, in order to provide the ability to include) 112.81 586.33 P +0 F +0.02 (XPM) 389.26 586.33 P +1 F +0.02 ( files in C and C++ programs. It) 412.01 586.33 P +(is in fact an array of strings composed of six different sections as follows:) 72 574.33 T +(/* XPM */ static char*) 129.6 556.33 T +3 F +(<variable_name>) 222.6 556.33 T +1 F +([] = {) 312.55 556.33 T +(<Values>) 129.6 538.33 T +(<Colors>) 129.6 520.33 T +(<Pixels>) 129.6 502.33 T +(<Extensions>) 129.6 484.33 T +(};) 129.6 466.33 T +(The words are separated by a white space which can be composed of space and tabulation characters.) 72 442.33 T +-0.15 (The) 72 418.33 P +3 F +-0.36 (<Values>) 89.89 418.33 P +1 F +-0.15 ( section is a string containing four or six integers in base 10 that correspond to: the pixmap width and) 137.86 418.33 P +0.46 (height, the number of colors, the number of characters per pixel \050so there is no limit on the number of colors\051, and,) 72 406.33 P +(optionally the hotspot coordinates and the) 72 394.33 T +0 F +(XPMEXT) 241.9 394.33 T +1 F +( tag if there is any extension following the) 285.2 394.33 T +3 F +(<Pixels>) 456.48 394.33 T +1 F +( section.) 504.45 394.33 T +3 F +(<width> <height> <ncolors> <cpp> [<x_hotspot> <y_hotspot>] [XPMEXT]) 72 370.33 T +1 F +(The) 72 346.33 T +3 F +(Colors) 90.04 346.33 T +1 F +( section contains as many strings as there are colors, and each string is as follows:) 126.02 346.33 T +3 F +(<chars> {<key> <color>}+) 72 322.33 T +1 F +0.07 (Where) 72 298.33 P +3 F +0.18 (<chars>) 101.21 298.33 P +1 F +0.07 ( is the) 143.18 298.33 P +3 F +0.18 (<chars_per_pixel>) 169.78 298.33 P +1 F +0.07 ( length string \050not surrounded by anything\051 representing the pixels,) 271.73 298.33 P +3 F +-0.43 (<color>) 72 286.33 P +1 F +-0.18 ( is the specified color, and) 113.98 286.33 P +3 F +-0.43 (<key>) 220.32 286.33 P +1 F +-0.18 ( is a keyword describing in which context this color should be used. Cur-) 250.3 286.33 P +(rently the keys may have the following values:) 72 274.33 T +( m) 144 256.33 T +(for mono visual) 216 256.33 T +( s) 144 240.33 T +( for symbolic name) 216 240.33 T +( g4) 144 224.33 T +( for 4-level grayscale) 216 224.33 T +( g) 144 208.33 T +( for grayscale with more than 4 levels) 216 208.33 T +( c) 144 192.33 T +( for color visual) 216 192.33 T +0.14 (Colors can be specified by giving the colorname, a # followed by the RGB code in hexadecimal, or a % followed by) 72 168.33 P +-0.35 (the HSV code \050not implemented\051. The symbolic name provides the ability of specifying the colors at load time and not) 72 156.33 P +0.05 (to hard-code them in the file. Also the string) 72 144.33 P +0 F +0.05 (None) 252.29 144.33 P +1 F +0.05 ( can be given as a colorname to mean \322transparent\323. Transparency) 274.5 144.33 P +(is handled by providing a masking bitmap in addition to the pixmap.) 72 132.33 T +1.18 (The) 72 108.33 P +3 F +2.82 (<Pixels>) 91.22 108.33 P +1 F +1.18 ( section is composed by) 139.19 108.33 P +3 F +2.82 (<height>) 243.07 108.33 P +1 F +1.18 ( strings of) 291.04 108.33 P +3 F +2.82 (<width>) 337.05 108.33 P +1 F +1.18 ( *) 379.03 108.33 P +3 F +2.82 (<chars_per_pixel>) 391.37 108.33 P +1 F +1.18 ( characters,) 493.32 108.33 P +FMENDPAGE +%%EndPage: "6" 6 +%%Page: "7" 6 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(7) 303.11 54.85 T +1 10 Q +0.2 (where every) 72 686.18 P +3 F +0.48 (<chars_per_pixel>) 124.01 686.18 P +1 F +0.2 ( length string must be one of the previously defined groups in the) 225.96 686.18 P +3 F +0.48 (<Colors>) 492.03 686.18 P +1 F +(section.) 72 674.18 T +0.18 (Then follows the) 72 650.18 P +3 F +0.43 (<Extensions>) 142.76 650.18 P +1 F +0.18 ( section which must be labeled, if not empty, in the) 214.72 650.18 P +3 F +0.43 (<Values>) 423.49 650.18 P +1 F +0.18 ( section as previ-) 471.46 650.18 P +(ously described. This section may be composed by several) 72 638.18 T +3 F +(<Extension>) 308.5 638.18 T +1 F +( subsections which may be of two types:) 374.46 638.18 T +(\245) 72 620.18 T +(one stand alone string composed as follows:) 86.4 620.18 T +3 F +(XPMEXT <extension-name> <extension-data>) 86.4 604.18 T +1 F +(\245) 72 586.18 T +(or a block composed by several strings:) 86.4 586.18 T +3 F +(XPMEXT <extension-name>) 86.4 570.18 T +(<related extension-data composed of several strings>) 86.4 554.18 T +1 F +(Finally, if not empty, this section must end by the following string:) 72 530.18 T +3 F +(XPMENDEXT) 72 506.18 T +1 F +-0.28 (To avoid possible conflicts with extension names in shared files, they should be prefixed by the name of the company.) 72 482.18 P +(This would ensure unicity.) 72 470.18 T +FMENDPAGE +%%EndPage: "7" 7 +%%Page: "8" 7 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(8) 303 56.01 T +1 10 Q +-0.11 (Below is an example which is the XPM file of a plaid pixmap. This is a 22x22 pixmap, with 4 colors and 2 characters) 72 686.33 P +-0.12 (per pixel. The hotspot coordinates are \0500, 0\051. There are symbols and default colors for color and monochrome visuals.) 72 674.33 P +(Finally there are two extensions.) 72 662.33 T +3 F +(/* XPM */) 72 620.33 T +(static char * plaid[] = {) 72 608.33 T +(/* plaid pixmap) 72 596.33 T +( * width height ncolors chars_per_pixel */) 72 584.33 T +("22 22 4 2 0 0 XPMEXT",) 72 572.33 T +(/* colors */) 72 560.33 T +(" c red) 72 548.33 T +( m white s light_color ",) 131.97 548.33 T +("Y c green) 72 536.33 T +( m black s lines_in_mix ",) 137.96 536.33 T +("+ c yellow) 72 524.33 T +( m white s lines_in_dark ",) 143.96 524.33 T +("x) 72 512.33 T +( m black s dark_color ",) 144 512.33 T +(/* pixels */) 72 500.33 T +("x x x x x x x x x x x x + x x x x x ",) 72 488.33 T +(" x x x x x x x x x x x x x x x x ",) 72 476.33 T +("x x x x x x x x x x x x + x x x x x ",) 72 464.33 T +(" x x x x x x x x x x x x x x x x ",) 72 452.33 T +("x x x x x x x x x x x x + x x x x x ",) 72 440.33 T +("Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ",) 72 428.33 T +("x x x x x x x x x x x x + x x x x x ",) 72 416.33 T +(" x x x x x x x x x x x x x x x x ",) 72 404.33 T +("x x x x x x x x x x x x + x x x x x ",) 72 392.33 T +(" x x x x x x x x x x x x x x x x ",) 72 380.33 T +("x x x x x x x x x x x x + x x x x x ",) 72 368.33 T +(" x x x x Y x x x ",) 72 356.33 T +(" x x x Y x x ",) 72 344.33 T +(" x x x x Y x x x ",) 72 332.33 T +(" x x x Y x x ",) 72 320.33 T +(" x x x x Y x x x ",) 72 308.33 T +("x x x x x x x x x x x x x x x x x x x x x x ",) 72 296.33 T +(" x x x x Y x x x ",) 72 284.33 T +(" x x x Y x x ",) 72 272.33 T +(" x x x x Y x x x ",) 72 260.33 T +(" x x x Y x x ",) 72 248.33 T +(" x x x x Y x x x ") 72 236.33 T +("XPMEXT ext1 data1",) 72 224.33 T +("XPMEXT ext2",) 72 212.33 T +("data2_1",) 72 200.33 T +("data2_2",) 72 188.33 T +("XPMENDEXT") 72 176.33 T +(};) 72 164.33 T +FMENDPAGE +%%EndPage: "8" 8 +%%Page: "9" 8 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(9) 303.11 54.85 T +0 18 Q +(Chapter 3) 267.28 680.84 T +(The XPM Library) 235.54 644.84 T +1 10 Q +-0.33 (The XPM library basically provides two sets of Xlib-level functions in the C language. Most people should only know) 72 586.18 P +0.25 (about the first one since it provides what most likely one need with a simple interface. The second set, which stands) 72 574.18 P +0.43 (as a lower level called from the first one, is designed to be used from within applications which have more specific) 72 562.18 P +(needs such as a pixmap editor or applications which needs to cache data such as Xpm files.) 72 550.18 T +0 14 Q +(3.1) 72 495.51 T +(The Basic Level Interface) 100.8 495.51 T +1 10 Q +0.06 (The basic level interface allows to deal with XImage, Pixmap, XPM file, data \050included XPM file\051, buffer \050XPM file) 72 470.18 P +(in memory\051, and in many ways.) 72 458.18 T +(The following subsections describe these functions and how to use them.) 72 434.18 T +0 12 Q +(3.1.1) 72 390.84 T +(The structures) 108 390.84 T +1 10 Q +-0.22 (To provide a simple interface all the functions take, in addition to their main arguments such as a filename, a structure) 72 366.18 P +-0.43 (called) 72 354.18 P +0 F +-0.43 (XpmAttributes) 97.94 354.18 P +1 F +-0.43 (. This structure is composed of attributes to pass data such as colormap and visual and attributes) 162.9 354.18 P +(to retrieve returned data such as pixmap\325s width and height. The) 72 342.18 T +0 F +(XpmAttributes) 331.81 342.18 T +1 F +( structure is defined as follows:) 396.76 342.18 T +(typedef struct {) 72 324.18 T +(unsigned long valuemask;) 144 308.18 T +(/* Specifies which attributes are defined */) 288 308.18 T +(Visual *visual;) 144 292.18 T +(/* Specifies the visual to use */) 288 292.18 T +(Colormap colormap;) 144 276.18 T +(/* Specifies the colormap to use */) 288 276.18 T +(unsigned int depth;) 144 260.18 T +(/* Specifies the depth */) 288 260.18 T +(unsigned int width;) 144 244.18 T +(/* Returns the width of the created pixmap */) 288 244.18 T +(unsigned int height;) 144 228.18 T +(/* Returns the height of the created pixmap */) 288 228.18 T +(unsigned int x_hotspot;) 144 212.18 T +(/* Returns the x hotspot\325s coordinate */) 288 212.18 T +(unsigned int y_hotspot;) 144 196.18 T +(/* Returns the y hotspot\325s coordinate */) 288 196.18 T +(unsigned int cpp;) 144 180.18 T +(/* Specifies the number of char per pixel */) 288 180.18 T +(Pixel *pixels;) 144 164.18 T +(/* List of used color pixels */) 288 164.18 T +(unsigned int npixels;) 144 148.18 T +(/* Number of pixels */) 288 148.18 T +(XpmColorSymbol *colorsymbols;) 144 132.18 T +(/* Array of color symbols to override */) 288 132.18 T +(unsigned int numsymbols;) 144 116.18 T +(/* Number of symbols */) 288 116.18 T +FMENDPAGE +%%EndPage: "9" 9 +%%Page: "10" 9 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(10) 300 56.01 T +1 10 Q +(char *rgb_fname;) 144 686.33 T +(/* RGB text file name */) 288 686.33 T +(unsigned int nextensions;) 144 670.33 T +(/* Number of extensions */) 288 670.33 T +(XpmExtension *extensions;) 144 654.33 T +(/* Array of extensions */) 288 654.33 T +( /* Color Allocation Directives */) 72 638.33 T +(unsigned int exactColors;) 144 622.33 T +(/* Only use exact colors for visual */) 288 622.33 T +(unsigned int closeness;) 144 606.33 T +(/* Allowable RGB deviation */) 288 606.33 T +(unsigned int red_closeness;) 144 590.33 T +(/* Allowable red deviation */) 288 590.33 T +(unsigned int green_closeness;) 144 574.33 T +(/* Allowable green deviation */) 288 574.33 T +(unsigned int blue_closeness;) 144 558.33 T +(/* Allowable blue deviation */) 288 558.33 T +(int color_key;) 144 542.33 T +(/* Use colors from this color set */) 288 542.33 T +(} XpmAttributes;) 72 526.33 T +0.03 (The valuemask is the bitwise inclusive OR of the valid attribute mask bits. If the valuemask is zero, the attributes are) 72 502.33 P +-0.41 (ignored and not referenced. And default values are taken for needed attributes which are not specified. This valuemask) 72 490.33 P +0.01 (had to be part of the structure to let) 72 478.33 P +0 F +0.01 (Xpm) 215.06 478.33 P +1 F +0.01 ( functions modify its value when returning possible data such as hotspot co-) 236.16 478.33 P +(ordinates.) 72 466.33 T +0 F +0.19 (NOTE) 72 442.33 P +1 F +0.19 (: In any case this valuemask must be set to some valid value, at least zero, otherwise unpredictable errors can) 100.32 442.33 P +(occur.) 72 430.33 T +(To allow overriding of colors at load time the) 72 398.33 T +0 F +(XPM) 256.6 398.33 T +1 F +( library defines the) 279.36 398.33 T +0 F +(XpmColorSymbol) 357.07 398.33 T +1 F +( structure which contains:) 434.81 398.33 T +(typedef struct {) 72 380.33 T +( char *name;) 144 364.33 T +(/* Symbolic color name */) 288 364.33 T +( char *value;) 144 348.33 T +(/* Color value */) 288 348.33 T +( Pixel pixel;) 144 332.33 T +(/* Color pixel */) 288 332.33 T +(} XpmColorSymbol;) 72 316.33 T +0 (So, to override default colors at load time, you just have to pass, via the) 72 292.33 P +0 F +0 (XpmAttributes) 360.68 292.33 P +1 F +0 ( structure, a list of) 425.64 292.33 P +0 F +0 (XpmCol-) 500.58 292.33 P +-0.11 (orSymbol) 72 280.33 P +1 F +-0.11 ( elements containing the desired colors to the) 113.65 280.33 P +0 F +-0.11 (XpmReadFileToPixmap) 295.95 280.33 P +1 F +-0.11 ( or) 399.78 280.33 P +0 F +-0.11 (XpmCreatePixmapFromData) 412.88 280.33 P +-0.15 (XPM) 72 268.33 P +1 F +-0.15 ( functions. These colors can be specified by giving the color name in the value member or directly by giving the) 94.76 268.33 P +-0.4 (corresponding pixel in the pixel member. In the latter case the value member must be set to) 72 256.33 P +0 F +-0.4 (NULL) 432.67 256.33 P +1 F +-0.4 ( otherwise the given) 460.43 256.33 P +(pixel will not be considered.) 72 244.33 T +-0.28 (In addition, it is possible to set the pixel for a specific color) 72 220.33 P +0 F +-0.28 (value) 308.22 220.33 P +1 F +-0.28 (at load time by setting the color name to NULL, and) 333.21 220.33 P +0.32 (setting the value and pixel fields appropriately. For example, by setting the color name to NULL, the value to \322red\323) 72 208.33 P +0.07 (and the pixel to 51, all symbolic colors that are assigned to \322red\323 will be set to pixel 51. It is even possible to specify) 72 196.33 P +(the pixel used for the transparent color \322none\323 when no mask is required.) 72 184.33 T +(To pass and retrieve extension data use the) 72 160.33 T +0 F +(XpmExtension) 245.76 160.33 T +1 F +( structure which is defined below:) 309.06 160.33 T +(typedef struct {) 72 142.33 T +( char *name;) 144 126.33 T +(/* name of the extension */) 288 126.33 T +( unsigned int nlines;) 144 110.33 T +(/* number of lines in this extension */) 288 110.33 T +FMENDPAGE +%%EndPage: "10" 10 +%%Page: "11" 10 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(1) 300.45 54.85 T +(1) 305.78 54.85 T +1 10 Q +( char **lines;) 144 686.18 T +(/* pointer to the extension array of strings */) 288 686.18 T +(} XpmExtension;) 72 670.18 T +-0.14 (To retrieve possible extension data stored in an) 72 646.18 P +0 F +-0.14 (XPM) 261.85 646.18 P +1 F +-0.14 ( file or data, you must set the mask bits) 284.61 646.18 P +0 F +-0.14 (XpmReturnExtensions) 442.27 646.18 P +1 F +0.18 (to the valuemask of an) 72 634.18 P +0 F +0.18 (XpmAttributes) 165.87 634.18 P +1 F +0.18 ( structure that you pass to the read function you use. Then the same structure) 230.82 634.18 P +(may be passed the same way to any write function if you set the mask bits) 72 622.18 T +0 F +(XpmExtensions) 370.69 622.18 T +1 F +( to the valuemask.) 437.88 622.18 T +0 12 Q +(3.1.2) 72 578.84 T +(Functions to deal with XPM files) 108 578.84 T +1 10 Q +(To create an) 72 558.18 T +0 F +(XImage) 123.89 558.18 T +1 F +( from an) 157.75 558.18 T +0 F +(XPM) 194.11 558.18 T +1 F +( file, use) 216.87 558.18 T +0 F +(XpmReadFileToImage) 253.51 558.18 T +1 F +(.) 351.23 558.18 T +(int XpmReadFileToImage\050) 72 540.18 T +4 F +(display, filename, image_return, shapeimage_return, attributes) 180.54 540.18 T +1 F +(\051) 434.28 540.18 T +(Display) 108 528.18 T +4 F +(*display;) 141.59 528.18 T +1 F +(char) 108 516.18 T +4 F +(*filename;) 127.7 516.18 T +1 F +(XImage) 108 504.18 T +4 F +(**image_return;) 142.69 504.18 T +1 F +(XImage) 108 492.18 T +4 F +(**shapeimage_return;) 142.69 492.18 T +1 F +(XpmAttributes) 108 480.18 T +4 F +(*attributes;) 170.47 480.18 T +(display) 72 464.18 T +1 F +(Specifies the connection to the X server.) 171 464.18 T +4 F +(filename) 72 448.18 T +1 F +(Specifies the file name to use.) 171 448.18 T +4 F +(image_return) 72 432.18 T +1 F +(Returns the image which is created.) 171 432.18 T +4 F +(shapeimage_return) 72 416.18 T +1 F +(Returns the shape mask image which is created if the color None is used.) 171 416.18 T +4 F +(attributes) 72 400.18 T +1 F +(Specifies the location of a structure to get and store information \050or NULL\051.) 171 400.18 T +0.47 (The) 72 376.18 P +0 F +0.47 (XpmReadFileToImage) 90.51 376.18 P +1 F +0.47 ( function reads in a file in the) 188.22 376.18 P +0 F +0.47 (XPM) 311.88 376.18 P +1 F +0.47 ( format. If the file cannot be opened it returns) 334.64 376.18 P +0 F +0.47 (Xp-) 523.9 376.18 P +0.17 (mOpenFailed) 72 364.18 P +1 F +0.17 (. If the file can be opened but does not contain valid) 130.31 364.18 P +0 F +0.17 (XPM) 342.45 364.18 P +1 F +0.17 (data, it returns) 367.87 364.18 P +0 F +0.17 (XpmFileInvalid) 428.33 364.18 P +1 F +0.17 (. If insuffi-) 496.09 364.18 P +(cient working storage is allocated, it returns) 72 352.18 T +0 F +(XpmNoMemory) 249.65 352.18 T +1 F +(.) 319.59 352.18 T +1.21 (If the passed) 72 328.18 P +0 F +1.21 (XpmAttributes) 128.63 328.18 P +1 F +1.21 ( structure pointer is not) 193.59 328.18 P +0 F +1.21 (NULL) 294.84 328.18 P +1 F +1.21 (,) 322.61 328.18 P +0 F +1.21 (XpmReadFileToImage) 328.81 328.18 P +1 F +1.21 ( looks for the following at-) 426.53 328.18 P +0.11 (tributes:) 72 316.18 P +0 F +0.11 (XpmVisual) 107.37 316.18 P +1 F +0.11 (,) 155.68 316.18 P +0 F +0.11 (XpmColormap) 160.79 316.18 P +1 F +0.11 (,) 225.2 316.18 P +0 F +0.11 (XpmDepth) 230.3 316.18 P +1 F +0.11 (,) 277.5 316.18 P +0 F +0.11 (XpmColorSymbols) 282.6 316.18 P +1 F +0.11 (,) 364.23 316.18 P +0 F +0.11 (XpmExactColors) 369.33 316.18 P +1 F +0.11 (,) 443.17 316.18 P +0 F +0.11 (XpmCloseness) 448.28 316.18 P +1 F +0.11 (,) 510.47 316.18 P +0 F +0.11 (Xpm-) 515.57 316.18 P +0.35 (RGBCloseness, XpmReturnPixels) 72 304.18 P +1 F +0.35 (,) 216.71 304.18 P +0 F +0.35 (XpmReturnExtensions) 222.07 304.18 P +1 F +0.35 (, and sets the) 319.79 304.18 P +0 F +0.35 (XpmSize) 375.34 304.18 P +1 F +0.35 ( and possibly the) 413.65 304.18 P +0 F +0.35 (XpmHotspot) 485.03 304.18 P +1 F +-0.25 (attributes when returning. In any case the valuemask of the passed) 72 292.18 P +0 F +-0.25 (XpmAttributes) 336.84 292.18 P +1 F +-0.25 ( must be set to some valid value, at) 401.79 292.18 P +(least zero, otherwise unpredictable errors can occur.) 72 280.18 T +0 F +0.78 (XpmReadFileToImage) 72 256.18 P +1 F +0.78 ( allocates colors, as read from the file or possibly overridden as specified in the) 169.72 256.18 P +0 F +0.78 (XpmCol-) 500.58 256.18 P +0.05 (orSymbols) 72 244.18 P +1 F +0.05 ( attributes. The colors are allocated using the color settings for the visual specified by the) 117.54 244.18 P +0 F +0.05 (XpmColorKey) 477.26 244.18 P +1 F +0.07 (attribute, which has the value) 72 232.18 P +0 F +0.07 (XPM_MONO, XPM_GRAY4, XPM_GRAY,) 192.26 232.18 P +1 F +0.07 (or) 386.77 232.18 P +0 F +0.07 ( XPM_COLOR) 395.1 232.18 P +1 F +0.07 (. If the) 462.07 232.18 P +0 F +0.07 (XpmColor-) 491.15 232.18 P +(Key) 72 220.18 T +1 F +( attribute is not set it is determined by examining the type of visual.) 89.21 220.18 T +-0.15 (If no default value exists for the specified visual, it first looks for other defaults nearer to the monochrome visual type) 72 196.18 P +0.48 (and secondly nearer to the color visual type. If the color which is found is not valid \050cannot be parsed\051, it looks for) 72 184.18 P +(another default one according to the same algorithm.) 72 172.18 T +-0.28 (If allocating a color fails, and the) 72 148.18 P +0 F +-0.28 (closeness) 204.95 148.18 P +1 F +-0.28 ( attribute is set, it tries to find a color already in the colormap that is closest) 243.26 148.18 P +0.12 (to the desired color, and uses that. If no color can be found that is within) 72 136.18 P +0 F +0.12 (closeness) 365.95 136.18 P +1 F +0.12 (of the Red, Green and Blue com-) 406.88 136.18 P +-0.61 (ponents of the desired color, it reverts to trying other default values as explained above. For finer control over the close-) 72 124.18 P +0.77 (ness requirements of a particular icon, the) 72 112.18 P +0 F +0.77 (red_closeness) 247.28 112.18 P +1 F +0.77 (,) 305.02 112.18 P +0 F +0.77 (green_closeness) 314.06 112.18 P +1 F +0.77 (, and) 381.23 112.18 P +0 F +0.77 (blue_closeness) 404.7 112.18 P +1 F +0.77 ( attributes may be) 466.34 112.18 P +FMENDPAGE +%%EndPage: "11" 11 +%%Page: "12" 11 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(12) 300 56.01 T +1 10 Q +(used instead of the more general) 72 686.33 T +0 F +(closeness) 204.12 686.33 T +1 F +( attribute.) 242.43 686.33 T +0.54 (The RGB components are integers within the range 0 \050black\051 to 65535 \050white\051. A closeness of less than 10000, for) 72 662.33 P +-0.03 (example, will cause only quite close colors to be matched, while a closeness of more than 50000 will allow quite dis-) 72 650.33 P +-0.39 (similar colors to match. Specifying a closeness of more than 65535 will allow any color to match, thus forcing the icon) 72 638.33 P +-0.04 (to be drawn in color no matter how bad the colormap is. The value 40000 seems to be about right for many situations) 72 626.33 P +-0.03 (requiring reasonable but not perfect matches. With this setting the color must only be within the same general area of) 72 614.33 P +(the RGB cube as the desired color.) 72 602.33 T +0.13 (If the) 72 578.33 P +0 F +0.13 (exactColors) 96.13 578.33 P +1 F +0.13 ( attribute is set it then returns) 146.64 578.33 P +0 F +0.13 (XpmColorError) 266.66 578.33 P +1 F +0.13 (, otherwise it creates the images and returns) 337.16 578.33 P +0 F +0.13 (Xpm-) 515.57 578.33 P +-0.11 (Success) 72 566.33 P +1 F +-0.11 (. If no color is found, and no close color exists or is wanted, and all visuals have been exhausted,) 104.2 566.33 P +0 F +-0.11 (XpmColor-) 491.15 566.33 P +(Failed) 72 554.33 T +1 F +( is returned.) 98.65 554.33 T +0 F +0.12 (XpmReadFileToImage) 72 530.33 P +1 F +0.12 ( returns the created image to image_return if not) 169.72 530.33 P +0 F +0.12 (NULL) 366.47 530.33 P +1 F +0.12 ( and possibly the created shapemask) 394.23 530.33 P +-0.05 (to shapeimage_return if not) 72 518.33 P +0 F +-0.05 (NULL) 184.51 518.33 P +1 F +-0.05 ( and the color) 212.27 518.33 P +0 F +-0.05 (None) 269.27 518.33 P +1 F +-0.05 ( is used. If required it stores into the) 291.48 518.33 P +0 F +-0.05 (XpmAttributes) 437.62 518.33 P +1 F +-0.05 ( structure) 502.58 518.33 P +(the list of the used pixels.) 72 506.33 T +-0.31 (When finished the caller must free the images using) 72 482.33 P +0 F +-0.31 (XDestroyImage) 279.32 482.33 P +1 F +-0.31 (, the colors using) 346.48 482.33 P +0 F +-0.31 (XFreeColors) 416.02 482.33 P +1 F +-0.31 (, and possibly the) 470.97 482.33 P +(data returned into the) 72 470.33 T +0 F +(XpmAttributes) 159.71 470.33 T +1 F +( using) 224.67 470.33 T +0 F +(XpmFreeAttributes) 251.32 470.33 T +1 F +(.) 335.7 470.33 T +-0.39 (In addition on systems which support such features) 72 446.33 P +0 F +-0.39 (XpmReadFileToImage) 275.97 446.33 P +1 F +-0.39 (deals with compressed files by forking an) 375.79 446.33 P +0 F +0.12 (uncompress) 72 434.33 P +1 F +0.12 ( or) 123.08 434.33 P +0 F +0.12 (gzip) 136.64 434.33 P +1 F +0.12 ( process and reading from the piped result. It assumes that the specified file is compressed if the) 154.41 434.33 P +0.2 (given file name ends by \325.Z\325 or \325.gz\325. In case the file name does not end so,) 72 422.33 P +0 F +0.2 (XpmReadFileToImage) 377.64 422.33 P +1 F +0.2 ( first looks for a) 475.36 422.33 P +-0.31 (file of which the name is the given one followed by \325.Z\325 or \325.gz\325; then if such a file does not exist, it looks for the given) 72 410.33 P +0.15 (file \050assumed as not compressed\051. And if instead of a file name) 72 398.33 P +0 F +0.15 (NULL) 328.37 398.33 P +1 F +0.15 ( is passed to) 356.14 398.33 P +0 F +0.15 (XpmReadFileToImage) 407.83 398.33 P +1 F +0.15 (, it reads) 505.55 398.33 P +(from the standard input.) 72 386.33 T +(To create a) 72 354.33 T +0 F +(Pixmap) 118.89 354.33 T +1 F +( from an) 151.66 354.33 T +0 F +(XPM) 188.02 354.33 T +1 F +( file, use) 210.77 354.33 T +0 F +(XpmReadFileToPixmap) 247.41 354.33 T +1 F +(.) 351.25 354.33 T +(int XpmReadFileToPixmap\050) 72 336.33 T +4 F +(display, d, filename, pixmap_return, shapemask_return, attributes) 186.11 336.33 T +1 F +(\051) 450.95 336.33 T +(Display) 108 324.33 T +4 F +(*display;) 141.59 324.33 T +1 F +(Drawable) 108 312.33 T +4 F +(d;) 149.35 312.33 T +1 F +(char) 108 300.33 T +4 F +(*filename;) 127.7 300.33 T +1 F +(Pixmap) 108 288.33 T +4 F +(*pixmap_return;) 141.04 288.33 T +1 F +(Pixmap) 108 276.33 T +4 F +(*shapemask_return;) 141.04 276.33 T +1 F +(XpmAttributes) 108 264.33 T +4 F +(*attributes;) 170.47 264.33 T +(display) 72 248.33 T +1 F +(Specifies the connection to the X server.) 171 248.33 T +4 F +(d) 72 232.33 T +1 F +(Specifies which screen the pixmap is created on.) 171 232.33 T +4 F +(filename) 72 216.33 T +1 F +(Specifies the file name to use.) 171 216.33 T +4 F +(pixmap_return) 72 200.33 T +1 F +(Returns the pixmap which is created.) 171 200.33 T +4 F +(shapemask_return) 72 184.33 T +1 F +(Returns the shapemask which is created if the color None is used.) 171 184.33 T +4 F +(attributes) 72 168.33 T +1 F +(Specifies the location of a structure to get and store information \050or NULL\051.) 171 168.33 T +-0.19 (The) 72 144.33 P +0 F +-0.19 (XpmReadFileToPixmap) 89.85 144.33 P +1 F +-0.19 ( function creates X images using) 193.68 144.33 P +0 F +-0.19 (XpmReadFileToImage) 325.76 144.33 P +1 F +-0.19 ( and thus returns the same er-) 423.47 144.33 P +-0.56 (rors. In addition on success it then creates the related pixmaps, using) 72 132.33 P +0 F +-0.56 (XPutImage) 342.37 132.33 P +1 F +-0.56 (, which are returned to pixmap_return) 391.23 132.33 P +(and shapemask_return if not) 72 120.33 T +0 F +(NULL) 188.03 120.33 T +1 F +(, and finally destroys the created images using) 215.79 120.33 T +0 F +(XDestroyImage) 403.16 120.33 T +1 F +(.) 470.32 120.33 T +FMENDPAGE +%%EndPage: "12" 12 +%%Page: "13" 12 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(13) 300.12 54.85 T +1 10 Q +-0.17 (When finished the caller must free the pixmaps using) 72 686.18 P +0 F +-0.17 (XFreePixmap) 286.12 686.18 P +1 F +-0.17 (, the colors using) 345.51 686.18 P +0 F +-0.17 (XFreeColors) 415.61 686.18 P +1 F +-0.17 (, and possibly the) 470.56 686.18 P +(data returned into the) 72 674.18 T +0 F +(XpmAttributes) 159.71 674.18 T +1 F +( using) 224.67 674.18 T +0 F +(XpmFreeAttributes) 251.32 674.18 T +1 F +(.) 335.7 674.18 T +0 F +(XpmWriteFileFromImage) 74.5 642.18 T +1 F +( writes out an) 187.19 642.18 T +0 F +(XImage) 243.82 642.18 T +1 F +( to an) 277.68 642.18 T +0 F +(XPM) 302.38 642.18 T +1 F +( file.) 325.14 642.18 T +(int XpmWriteFileFromImage\050) 72 624.18 T +4 F +(display, filename, image, shapeimage, attributes) 193.31 624.18 T +1 F +(\051) 387.09 624.18 T +(Display) 108 612.18 T +4 F +(*display;) 141.59 612.18 T +1 F +(char) 108 600.18 T +4 F +(*filename;) 127.7 600.18 T +1 F +(XImage) 108 588.18 T +4 F +(*image;) 142.69 588.18 T +1 F +(XImage) 108 576.18 T +4 F +(*shapeimage;) 142.69 576.18 T +1 F +(XpmAttributes) 108 564.18 T +4 F +(*attributes;) 170.47 564.18 T +(display) 72 548.18 T +1 F +(Specifies the connection to the X server.) 171 548.18 T +4 F +(filename) 72 532.18 T +1 F +(Specifies the file name to use.) 171 532.18 T +4 F +(image) 72 516.18 T +1 F +(Specifies the image.) 171 516.18 T +4 F +(shapeimage) 72 500.18 T +1 F +(Specifies the shape mask image.) 171 500.18 T +4 F +(attributes) 72 484.18 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 484.18 T +-0.49 (The) 72 460.18 P +0 F +-0.49 (XpmWriteFileFromImage) 89.55 460.18 P +1 F +-0.49 ( function writes an image and its possible shapeimage out to a file in the) 202.24 460.18 P +0 F +-0.49 (XPM) 486.09 460.18 P +1 F +-0.49 ( format.) 508.85 460.18 P +0.1 (If the file cannot be opened, it returns) 72 448.18 P +0 F +0.1 (XpmOpenFailed) 225.71 448.18 P +1 F +0.1 (. If insufficient working storage is allocated, it returns) 296.8 448.18 P +0 F +0.1 (Xpm-) 515.57 448.18 P +(NoMemory) 72 436.18 T +1 F +(. If no error occurs then it returns) 120.84 436.18 T +0 F +(XpmSuccess) 256.01 436.18 T +1 F +(.) 309.31 436.18 T +0.14 (If the passed) 72 412.18 P +0 F +0.14 (XpmAttributes) 125.43 412.18 P +1 F +0.14 ( structure pointer is not) 190.38 412.18 P +0 F +0.14 (NULL) 286.29 412.18 P +1 F +0.14 (,) 314.05 412.18 P +0 F +0.14 (XpmWriteFileFromImage) 319.19 412.18 P +1 F +0.14 ( looks for the following at-) 431.88 412.18 P +(tributes:) 72 400.18 T +0 F +(XpmColormap) 107.26 400.18 T +1 F +(,) 171.66 400.18 T +0 F +(XpmSize) 176.66 400.18 T +1 F +(,) 214.97 400.18 T +0 F +(XpmHotspot) 219.97 400.18 T +1 F +(,) 274.94 400.18 T +0 F +(XpmCharsPerPixel) 279.94 400.18 T +1 F +(,) 363.21 400.18 T +0 F +(XpmRgbFilename) 368.21 400.18 T +1 F +(, and) 446.49 400.18 T +0 F +(XpmExtensions) 468.42 400.18 T +1 F +(.) 535.61 400.18 T +0.26 (If the) 72 376.18 P +0 F +0.26 (XpmSize) 96.39 376.18 P +1 F +0.26 ( attributes are not defined) 134.7 376.18 P +0 F +0.26 (XpmWriteFileFromImage) 240.64 376.18 P +1 F +0.26 (performs an) 356.08 376.18 P +0 F +0.26 (XGetGeometry) 407.11 376.18 P +1 F +0.26 ( operation. If the) 472.61 376.18 P +0.26 (filename contains an extension such as \322.xpm\323, in order to get a valid C variable name, the dot character is replaced) 72 364.18 P +-0.6 (by an underscore \325_\325 when writing out. Also if the) 72 352.18 P +0 F +-0.6 (XpmRgbFilename) 268.96 352.18 P +1 F +-0.6 (attribute is defined,) 349.15 352.18 P +0 F +-0.6 (XpmWriteFileFromImage) 427.31 352.18 P +1 F +(searches for color names in this file and if found writes them out instead of the rgb values.) 72 340.18 T +0.4 (In addition on systems which support such features if the given file name ends by \325.Z\325 or \325.gz\325 it is assumed to be a) 72 316.18 P +0.47 (compressed file. Then,) 72 304.18 P +0 F +0.47 (XpmWriteFileFromImage) 166.95 304.18 P +1 F +0.47 (writes to a piped) 282.6 304.18 P +0 F +0.47 (compress) 353.32 304.18 P +1 F +0.47 ( or) 393.29 304.18 P +0 F +0.47 (gzip) 407.55 304.18 P +1 F +0.47 ( process. And if instead of a) 425.32 304.18 P +(file name) 72 292.18 T +0 F +(NULL) 111.97 292.18 T +1 F +(is passed to) 142.23 292.18 T +0 F +(XpmWriteFileFromImage) 190.82 292.18 T +1 F +(, it writes to the standard output.) 303.5 292.18 T +(To write out a) 72 260.18 T +0 F +(Pixmap) 130.85 260.18 T +1 F +( to an) 163.61 260.18 T +0 F +(XPM) 188.32 260.18 T +1 F +( file, use) 211.07 260.18 T +0 F +(XpmWriteFileFromPixmap) 247.71 260.18 T +1 F +(.) 366.52 260.18 T +(int XpmWriteFileFromPixmap\050) 72 242.18 T +4 F +(display, filename, pixmap, shapemask, attributes) 198.88 242.18 T +1 F +(\051) 393.76 242.18 T +(Display) 108 230.18 T +4 F +(*display;) 141.59 230.18 T +1 F +(char) 108 218.18 T +4 F +(*filename;) 127.7 218.18 T +1 F +(Pixmap) 108 206.18 T +4 F +(pixmap;) 141.04 206.18 T +1 F +(Pixmap) 108 194.18 T +4 F +(shapemask;) 141.04 194.18 T +1 F +(XpmAttributes) 108 182.18 T +4 F +(*attributes;) 170.47 182.18 T +(display) 72 166.18 T +1 F +(Specifies the connection to the X server.) 171 166.18 T +4 F +(filename) 72 150.18 T +1 F +(Specifies the file name to use.) 171 150.18 T +4 F +(pixmap) 72 134.18 T +1 F +(Specifies the pixmap.) 171 134.18 T +4 F +(shapemask) 72 118.18 T +1 F +(Specifies the shape mask pixmap.) 171 118.18 T +FMENDPAGE +%%EndPage: "13" 13 +%%Page: "14" 13 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(14) 300 56.01 T +4 10 Q +(attributes) 72 686.33 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 686.33 T +1.15 (The) 72 662.33 P +0 F +1.15 (XpmWriteFileFromPixmap) 91.19 662.33 P +1 F +1.15 ( function uses) 209.99 662.33 P +0 F +1.15 (XGetImage) 271.46 662.33 P +1 F +1.15 ( to get from the given pixmaps the related X images) 320.86 662.33 P +0.69 (which are passed to) 72 650.33 P +0 F +0.69 (XpmWriteFileFromImage) 155.83 650.33 P +1 F +0.69 (. Finally) 268.52 650.33 P +0 F +0.69 (XpmWriteFileFromPixmap) 305.73 650.33 P +1 F +0.69 ( destroys the created images) 424.53 650.33 P +1.09 (using) 72 638.33 P +0 F +1.09 (XDestroyImage) 97.24 638.33 P +1 F +1.09 (. The) 164.4 638.33 P +0 F +1.09 (XpmWriteFileFromPixmap) 189.61 638.33 P +1 F +1.09 (function returns the same errors as) 312 638.33 P +0 F +1.09 (XpmWriteFileFro-) 458.95 638.33 P +(mImage) 72 626.33 T +1 F +(.) 106.97 626.33 T +0 12 Q +(3.1.3) 72 583 T +(Functions to deal with XPM data) 108 583 T +1 10 Q +0.18 (An) 72 562.33 P +0 F +0.18 (XPM) 86.89 562.33 P +1 F +0.18 ( data is an array of character strings which may be obtained by simply including an) 109.65 562.33 P +0 F +0.18 (XPM) 447.23 562.33 P +1 F +0.18 ( file into a C pro-) 469.99 562.33 P +(gram.) 72 550.33 T +(To create an) 72 518.33 T +0 F +(XImage) 123.89 518.33 T +1 F +( from an) 157.75 518.33 T +0 F +(XPM) 194.11 518.33 T +1 F +( data, use) 216.87 518.33 T +0 F +(XpmCreateImageFromData) 256.84 518.33 T +1 F +(.) 377.84 518.33 T +(int XpmCreateImageFromData\050) 72 500.33 T +4 F +(display, data, image_return, shapeimage_return, attributes) 199.96 500.33 T +1 F +(\051) 437.05 500.33 T +(Display) 108 488.33 T +4 F +(*display;) 141.59 488.33 T +1 F +(char) 108 476.33 T +4 F +(**data;) 127.7 476.33 T +1 F +(XImage) 108 464.33 T +4 F +(**image_return;) 142.69 464.33 T +1 F +(XImage) 108 452.33 T +4 F +(**shapeimage_return;) 142.69 452.33 T +1 F +(XpmAttributes) 108 440.33 T +4 F +(*attributes;) 170.47 440.33 T +(display) 72 424.33 T +1 F +(Specifies the connection to the X server.) 171 424.33 T +4 F +(data) 72 408.33 T +1 F +(Specifies the location of the data.) 171 408.33 T +4 F +(image_return) 72 392.33 T +1 F +(Returns the image which is created.) 171 392.33 T +4 F +(shapeimage_return) 72 376.33 T +1 F +(Returns the shape mask image which is created if the color None is used.) 171 376.33 T +4 F +(attributes) 72 360.33 T +1 F +(Specifies the location of a structure to get and store information \050or NULL\051.) 171 360.33 T +-0.03 (The) 72 336.33 P +0 F +-0.03 (XpmCreateImageFromData) 90.01 336.33 P +1 F +-0.03 ( function allows you to include in your C program an) 211.01 336.33 P +0 F +-0.03 (XPM) 425.78 336.33 P +1 F +-0.03 ( file which was written) 448.54 336.33 P +(out by functions such as) 72 324.33 T +0 F +(XpmWriteFileFromImage) 171.11 324.33 T +1 F +( or) 283.79 324.33 T +0 F +(XpmWriteFileFromPixmap) 297.12 324.33 T +1 F +( without reading in the file.) 415.92 324.33 T +0 F +0.09 (XpmCreateImageFromData) 72 300.33 P +1 F +0.09 ( exactly works as) 193 300.33 P +0 F +0.09 (XpmReadFileToImage) 264.96 300.33 P +1 F +0.09 ( does and returns the same way. It just reads) 362.68 300.33 P +-0.29 (data instead of a file. Here again, it is the caller\325s responsibility to free the returned images, the colors and possibly the) 72 288.33 P +(data returned into the) 72 276.33 T +0 F +(XpmAttributes) 159.71 276.33 T +1 F +( structure.) 224.67 276.33 T +(To create a) 72 244.33 T +0 F +(Pixmap) 118.89 244.33 T +1 F +( from an) 151.66 244.33 T +0 F +(XPM) 188.02 244.33 T +1 F +( data, use) 210.77 244.33 T +0 F +(XpmCreatePixmapFromData.) 250.74 244.33 T +1 F +(int XpmCreatePixmapFromData\050) 72 220.33 T +4 F +(display, d, data, pixmap_return, shapemask_return, attributes) 205.53 220.33 T +1 F +(\051) 453.72 220.33 T +(Display) 108 202.33 T +4 F +(*display;) 141.59 202.33 T +1 F +(Drawable) 108 190.33 T +4 F +(d;) 149.35 190.33 T +1 F +(char) 108 178.33 T +4 F +(**data;) 127.7 178.33 T +1 F +(Pixmap) 108 166.33 T +4 F +(*pixmap_return;) 141.04 166.33 T +1 F +(Pixmap) 108 154.33 T +4 F +(*shapemask_return;) 141.04 154.33 T +1 F +(XpmAttributes) 108 142.33 T +4 F +(*attributes;) 170.47 142.33 T +(display) 72 126.33 T +1 F +(Specifies the connection to the X server.) 171 126.33 T +4 F +(d) 72 110.33 T +1 F +(Specifies which screen the pixmap is created on.) 171 110.33 T +FMENDPAGE +%%EndPage: "14" 14 +%%Page: "15" 14 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(15) 300.12 54.85 T +4 10 Q +(data) 72 686.18 T +1 F +(Specifies the location of the data.) 171 686.18 T +4 F +(pixmap_return) 72 670.18 T +1 F +(Returns the pixmap which is created.) 171 670.18 T +4 F +(shapemask_return) 72 654.18 T +1 F +(Returns the shape mask pixmap which is created if the color None is used.) 171 654.18 T +4 F +(attributes) 72 638.18 T +1 F +(Specifies the location of a structure to get and store information \050or NULL\051.) 171 638.18 T +0.23 (The) 72 614.18 P +0 F +0.23 (XpmCreatePixmapFromData) 90.27 614.18 P +1 F +0.23 ( function creates X images using) 217.39 614.18 P +0 F +0.23 (XpmCreateImageFromData) 351.98 614.18 P +1 F +0.23 ( and thus returns) 472.98 614.18 P +0.36 (the same errors. In addition on success it then creates the related pixmaps, using) 72 602.18 P +0 F +0.36 (XPutImage) 399.52 602.18 P +1 F +0.36 (, which are returned to) 448.38 602.18 P +(pixmap_return and shapemask_return if not) 72 590.18 T +0 F +(NULL) 249.37 590.18 T +1 F +(, and finally destroys the created images using) 277.14 590.18 T +0 F +(XDestroyImage) 464.5 590.18 T +1 F +(.) 531.67 590.18 T +-0.43 (Do not forget to free the returned pixmaps, the colors, and possibly the data returned into the) 72 566.18 P +0 F +-0.43 (XpmAttributes) 438.01 566.18 P +1 F +-0.43 ( structure) 502.96 566.18 P +(when done.) 72 554.18 T +(In some cases, one may want to create an) 72 522.18 T +0 F +(XPM) 239.64 522.18 T +1 F +( data from an) 262.39 522.18 T +0 F +(XImage) 317.9 522.18 T +1 F +(, to do so use) 351.77 522.18 T +0 F +(XpmCreateDataFromImage) 406.74 522.18 T +1 F +(.) 527.74 522.18 T +(int XpmCreateDataFromImage\050) 72 504.18 T +4 F +(display, data_return, image, shapeimage, attributes) 199.96 504.18 T +1 F +(\051) 407.07 504.18 T +(Display) 108 492.18 T +4 F +(*display;) 141.59 492.18 T +1 F +(char) 108 480.18 T +4 F +(***data_return;) 127.7 480.18 T +1 F +(XImage) 108 468.18 T +4 F +(*image;) 142.69 468.18 T +1 F +(XImage) 108 456.18 T +4 F +(*shapeimage;) 142.69 456.18 T +1 F +(XpmAttributes) 108 444.18 T +4 F +(*attributes;) 170.47 444.18 T +(display) 72 428.18 T +1 F +(Specifies the connection to the X server.) 171 428.18 T +4 F +(data_return) 72 412.18 T +1 F +(Returns the data which is created.) 171 412.18 T +4 F +(image) 72 396.18 T +1 F +(Specifies the image.) 171 396.18 T +4 F +(shapeimage) 72 380.18 T +1 F +(Specifies the shape mask image.) 171 380.18 T +4 F +(attributes) 72 364.18 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 364.18 T +0.28 (The) 72 340.18 P +0 F +0.28 (XpmCreateDataFromImage) 90.32 340.18 P +1 F +0.28 ( function exactly works as) 211.32 340.18 P +0 F +0.28 (XpmWriteFileFromImage) 320.15 340.18 P +1 F +0.28 ( does and returns the same) 432.84 340.18 P +0.14 (way. It just writes to a single block malloc\325ed data instead of to a file. It is the caller\325s responsibility to free the data,) 72 328.18 P +(using) 72 316.18 T +0 F +(XpmFree) 96.16 316.18 T +1 F +( when finished.) 136.67 316.18 T +0 F +(XpmCreateDataFromPixmap) 72 284.18 T +1 F +( creates an) 199.12 284.18 T +0 F +(XPM) 243.8 284.18 T +1 F +( data from a) 266.55 284.18 T +0 F +(Pixmap) 317.07 284.18 T +1 F +(.) 349.83 284.18 T +(int XpmCreateDataFromPixmap\050) 72 266.18 T +4 F +(display, data_return, pixmap, shapemask, attributes) 205.53 266.18 T +1 F +(\051) 413.74 266.18 T +(Display) 108 254.18 T +4 F +(*display;) 141.59 254.18 T +1 F +(char) 108 242.18 T +4 F +(***data_return;) 127.7 242.18 T +1 F +(Pixmap) 108 230.18 T +4 F +(pixmap;) 141.04 230.18 T +1 F +(Pixmap) 108 218.18 T +4 F +(shapemask;) 141.04 218.18 T +1 F +(XpmAttributes) 108 206.18 T +4 F +(*attributes;) 170.47 206.18 T +(display) 72 190.18 T +1 F +(Specifies the connection to the X server.) 171 190.18 T +4 F +(data_return) 72 174.18 T +1 F +(Returns the data which is created.) 171 174.18 T +4 F +(pixmap) 72 158.18 T +1 F +(Specifies the pixmap.) 171 158.18 T +4 F +(shapemask) 72 142.18 T +1 F +(Specifies the shape mask pixmap.) 171 142.18 T +4 F +(attributes) 72 126.18 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 126.18 T +FMENDPAGE +%%EndPage: "15" 15 +%%Page: "16" 15 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(16) 300 56.01 T +1 10 Q +0.56 (The) 72 686.33 P +0 F +0.56 (XpmCreateDataFromPixmap) 90.6 686.33 P +1 F +0.56 ( function uses) 217.72 686.33 P +0 F +0.56 (XGetImage) 277.4 686.33 P +1 F +0.56 ( to get from the given pixmaps the related X images) 326.8 686.33 P +-0.28 (which are passed to) 72 674.33 P +0 F +-0.28 (XpmCreateDataFromImage) 151.95 674.33 P +1 F +-0.28 (. Then it destroys the created images using) 272.95 674.33 P +0 F +-0.28 (XDestroyImage) 443.69 674.33 P +1 F +-0.28 (.) 510.85 674.33 P +0 F +-0.28 (Xpm-) 515.57 674.33 P +(CreateDataFromPixmap) 72 662.33 T +1 F +( returns the same errors as) 178.02 662.33 T +0 F +(XpmCreateDataFromImage) 285.15 662.33 T +1 F +(.) 406.16 662.33 T +0 12 Q +(3.1.4) 72 619 T +(Functions to deal with XPM files and data) 108 619 T +1 10 Q +0.5 (To directly tranform an) 72 598.33 P +0 F +0.5 (XPM) 170.04 598.33 P +1 F +0.5 ( file to and from an) 192.8 598.33 P +0 F +0.5 (XPM) 275.19 598.33 P +1 F +0.5 ( data array, without requiring an open X display, use) 297.94 598.33 P +0 F +0.5 (Xpm-) 515.57 598.33 P +(ReadFileToData) 72 586.33 T +1 F +( and) 142.51 586.33 T +0 F +(XpmWriteFileFromData) 161.94 586.33 T +1 F +(.) 268.52 586.33 T +0 F +(XpmReadFileToData) 72 554.33 T +1 F +( allocates and fills an) 163.61 554.33 T +0 F +(XPM) 250.49 554.33 T +1 F +( data array from an) 273.25 554.33 T +0 F +(XPM) 351.79 554.33 T +1 F +( file.) 374.54 554.33 T +(int XpmReadFileToData\050) 72 536.33 T +4 F +(filename, data_return) 174.43 536.33 T +1 F +(\051) 261.61 536.33 T +(char) 108 524.33 T +4 F +(*filename;) 127.7 524.33 T +1 F +(char) 108 512.33 T +4 F +(***data_return;) 127.7 512.33 T +(filename) 72 496.33 T +1 F +(Specifies the file name to read.) 171 496.33 T +4 F +(data_return) 72 480.33 T +1 F +(Returns the data array created.) 171 480.33 T +0 F +0.58 (XpmReadFileToData) 72 456.33 P +1 F +0.58 ( returns) 163.61 456.33 P +0 F +0.58 (XpmOpenFailed) 197.51 456.33 P +1 F +0.58 ( if it cannot open the file,) 268.6 456.33 P +0 F +0.58 (XpmNoMemory) 375.89 456.33 P +1 F +0.58 ( if insufficient working) 445.83 456.33 P +0.19 (storage is allocated,) 72 444.33 P +0 F +0.19 (XpmFileInvalid) 154.19 444.33 P +1 F +0.19 ( if this is not a valid) 221.94 444.33 P +0 F +0.19 (XPM) 305.21 444.33 P +1 F +0.19 ( file, and) 327.96 444.33 P +0 F +0.19 (XpmSuccess) 366.3 444.33 P +1 F +0.19 (otherwise. The allocated data) 422.29 444.33 P +(returned by) 72 432.33 T +0 F +(XpmReadFileToData) 120.29 432.33 T +1 F +( should be freed with) 211.9 432.33 T +0 F +(XpmFree) 298.79 432.33 T +1 F +( when done.) 339.3 432.33 T +0 F +(XpmWriteFileFromData) 72 400.33 T +1 F +( writes an) 178.58 400.33 T +0 F +(XPM) 219.94 400.33 T +1 F +( data array to an) 242.7 400.33 T +0 F +(XPM) 309.58 400.33 T +1 F +( file.) 332.34 400.33 T +(int XpmWriteFileFromData\050) 72 382.33 T +4 F +(filename, data) 187.21 382.33 T +1 F +(\051) 244.4 382.33 T +(char) 108 370.33 T +4 F +(*filename;) 127.7 370.33 T +1 F +(char) 108 358.33 T +4 F +(**data;) 127.7 358.33 T +(filename) 72 342.33 T +1 F +(Specifies the file name to write.) 171 342.33 T +4 F +(data) 72 326.33 T +1 F +(Specifies the data array to read.) 171 326.33 T +0 F +-0.19 (XpmReadFileToData) 72 302.33 P +1 F +-0.19 ( returns) 163.61 302.33 P +0 F +-0.19 (XpmOpenFailed) 195.97 302.33 P +1 F +-0.19 ( if it cannot open the file,) 267.05 302.33 P +0 F +-0.19 (XpmFileInvalid) 368.95 302.33 P +1 F +-0.19 ( if this is not a valid) 436.7 302.33 P +0 F +-0.19 (XPM) 517.24 302.33 P +1 F +(data, and) 72 290.33 T +0 F +(XpmSuccess) 110.58 290.33 T +1 F +( otherwise.) 163.88 290.33 T +0 12 Q +(3.1.5) 72 247 T +(Functions to deal with XPM buffers) 108 247 T +1 10 Q +0.52 (An) 72 226.33 P +0 F +0.52 (XPM) 87.23 226.33 P +1 F +0.52 ( buffer is a character string which may be obtained by simply making the exact copy of an) 109.99 226.33 P +0 F +0.52 (XPM) 482.34 226.33 P +1 F +0.52 ( file into) 505.1 226.33 P +(memory.) 72 214.33 T +(To create an) 72 182.33 T +0 F +(XImage) 123.89 182.33 T +1 F +( from an) 157.75 182.33 T +0 F +(XPM) 194.11 182.33 T +1 F +( buffer, use) 216.87 182.33 T +0 F +(XpmCreateImageFromBuffer) 264.6 182.33 T +1 F +(.) 392.82 182.33 T +(int XpmCreateImageFromBuffer\050) 72 164.33 T +4 F +(display, buffer, image_return, shapeimage_return, attributes) 207.18 164.33 T +1 F +(\051) 450.37 164.33 T +(Display) 108 152.33 T +4 F +(*display;) 141.59 152.33 T +1 F +(char) 108 140.33 T +4 F +(*buffer;) 127.7 140.33 T +1 F +(XImage) 108 128.33 T +4 F +(**image_return;) 142.69 128.33 T +1 F +(XImage) 108 116.33 T +4 F +(**shapeimage_return;) 142.69 116.33 T +1 F +(XpmAttributes) 108 104.33 T +4 F +(*attributes;) 170.47 104.33 T +FMENDPAGE +%%EndPage: "16" 16 +%%Page: "17" 16 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(17) 300.12 54.85 T +4 10 Q +(display) 72 686.18 T +1 F +(Specifies the connection to the X server.) 171 686.18 T +4 F +(buffer) 72 670.18 T +1 F +(Specifies the location of the buffer.) 171 670.18 T +4 F +(image_return) 72 654.18 T +1 F +(Returns the image which is created.) 171 654.18 T +4 F +(shapeimage_return) 72 638.18 T +1 F +(Returns the shape mask image which is created if the color None is used.) 171 638.18 T +4 F +(attributes) 72 622.18 T +1 F +(Specifies the location of a structure to get and store information \050or NULL\051.) 171 622.18 T +-0.04 (The) 72 598.18 P +0 F +-0.04 (XpmCreateImageFromBuffer) 90 598.18 P +1 F +-0.04 ( works the same way as) 218.22 598.18 P +0 F +-0.04 (XpmReadFileToImage) 315.12 598.18 P +1 F +-0.04 (, it just parses the buffer instead) 412.84 598.18 P +0.23 (of the file. Be aware that the feature provided on some systems by) 72 586.18 P +0 F +0.23 (XpmReadFileToImage) 341.99 586.18 P +1 F +0.23 (to deal with compressed) 442.44 586.18 P +(files is not available here.) 72 574.18 T +(To create a) 72 542.18 T +0 F +(Pixmap) 118.89 542.18 T +1 F +( from an) 151.66 542.18 T +0 F +(XPM) 188.02 542.18 T +1 F +( buffer, use) 210.77 542.18 T +0 F +(XpmCreatePixmapFromBuffer) 258.51 542.18 T +1 F +(.) 392.84 542.18 T +(int XpmCreatePixmapFromBuffer\050) 72 524.18 T +4 F +(display, d, buffer, pixmap_return, shapemask_return, attributes) 212.74 524.18 T +1 F +(\051) 467.04 524.18 T +(Display) 108 512.18 T +4 F +(*display;) 141.59 512.18 T +1 F +(Drawable) 108 500.18 T +4 F +(d;) 149.35 500.18 T +1 F +(char) 108 488.18 T +4 F +(*buffer;) 127.7 488.18 T +1 F +(Pixmap) 108 476.18 T +4 F +(*pixmap_return;) 141.04 476.18 T +1 F +(Pixmap) 108 464.18 T +4 F +(*shapemask_return;) 141.04 464.18 T +1 F +(XpmAttributes) 108 452.18 T +4 F +(*attributes;) 170.47 452.18 T +(display) 72 436.18 T +1 F +(Specifies the connection to the X server.) 171 436.18 T +4 F +(d) 72 420.18 T +1 F +(Specifies which screen the pixmap is created on.) 171 420.18 T +4 F +(buffer) 72 404.18 T +1 F +(Specifies the location of the buffer.) 171 404.18 T +4 F +(pixmap_return) 72 388.18 T +1 F +(Returns the pixmap which is created if the color None.) 171 388.18 T +4 F +(shapemask_return) 72 372.18 T +1 F +(Returns the shape mask pixmap which is created if the color None is used.) 171 372.18 T +4 F +(attributes) 72 356.18 T +1 F +(Specifies the location of a structure to get and store information.) 171 356.18 T +0.3 (The) 72 332.18 P +0 F +0.3 (XpmCreatePixmapFromBuffer) 90.34 332.18 P +1 F +0.3 ( function works the same way as) 224.68 332.18 P +0 F +0.3 (XpmReadFileToPixmap) 359.73 332.18 P +1 F +0.3 (, it just calls) 463.56 332.18 P +0 F +0.3 (Xpm-) 515.57 332.18 P +(CreateImageFromBuffer) 72 320.18 T +1 F +( instead of) 179.12 320.18 T +0 F +(XpmReadFileToImage) 223.26 320.18 T +1 F +(.) 320.97 320.18 T +(To create an) 72 288.18 T +0 F +(XPM) 123.89 288.18 T +1 F +( buffer from an) 146.65 288.18 T +0 F +(XImage) 209.92 288.18 T +1 F +(, use) 243.79 288.18 T +0 F +(XpmCreateBufferFromImage) 264.6 288.18 T +1 F +(.) 392.82 288.18 T +(int XpmCreateBufferFromImage\050) 72 270.18 T +4 F +(display, buffer_return, image, shapeimage, attributes) 207.18 270.18 T +1 F +(\051) 420.39 270.18 T +(Display) 108 258.18 T +4 F +(*display;) 141.59 258.18 T +1 F +(char) 108 246.18 T +4 F +(**buffer_return;) 127.7 246.18 T +1 F +(XImage) 108 234.18 T +4 F +(*image;) 142.69 234.18 T +1 F +(XImage) 108 222.18 T +4 F +(*shapeimage;) 142.69 222.18 T +1 F +(XpmAttributes) 108 210.18 T +4 F +(*attributes;) 170.47 210.18 T +(display) 72 194.18 T +1 F +(Specifies the connection to the X server.) 171 194.18 T +4 F +(buffer_return) 72 178.18 T +1 F +(Returns the buffer which is created.) 171 178.18 T +4 F +(image) 72 162.18 T +1 F +(Specifies the image.) 171 162.18 T +4 F +(shapeimage) 72 146.18 T +1 F +(Specifies the shape mask image.) 171 146.18 T +4 F +(attributes) 72 130.18 T +1 F +(Specifies the location of a structure containing information \050or) 171 130.18 T +(NULL\051.) 423.32 130.18 T +-0.25 (The) 72 106.18 P +0 F +-0.25 (XpmCreateBufferFromImage) 89.79 106.18 P +1 F +-0.25 ( works as) 218.01 106.18 P +0 F +-0.25 (XpmWriteFileFromImage) 257.5 106.18 P +1 F +-0.25 (, it just writes to a malloc\325ed buffer instead) 370.19 106.18 P +FMENDPAGE +%%EndPage: "17" 17 +%%Page: "18" 17 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(18) 300 56.01 T +1 10 Q +(of to a file. The caller should free the buffer using) 72 686.33 T +0 F +(XpmFree) 274.06 686.33 T +1 F +( when finished.) 314.58 686.33 T +0 F +(XpmCreateBufferFromPixmap) 72 654.33 T +1 F +( creates an) 206.34 654.33 T +0 F +(XPM) 251.01 654.33 T +1 F +( buffer from a) 273.77 654.33 T +0 F +(Pixmap) 332.05 654.33 T +1 F +(.) 364.81 654.33 T +(int XpmCreateBufferFromPixmap\050) 72 636.33 T +4 F +(display, buffer_return, pixmap, shapemask, attributes) 212.74 636.33 T +1 F +(\051) 427.07 636.33 T +(Display) 108 624.33 T +4 F +(*display;) 141.59 624.33 T +1 F +(char) 108 612.33 T +4 F +(**buffer_return;) 127.7 612.33 T +1 F +(Pixmap) 108 600.33 T +4 F +(pixmap;) 141.04 600.33 T +1 F +(Pixmap) 108 588.33 T +4 F +(shapemask;) 141.04 588.33 T +1 F +(XpmAttributes) 108 576.33 T +4 F +(*attributes;) 170.47 576.33 T +(display) 72 560.33 T +1 F +(Specifies the connection to the X server.) 171 560.33 T +4 F +(buffer_return) 72 544.33 T +1 F +(Returns the buffer which is created.) 171 544.33 T +4 F +(pixmap) 72 528.33 T +1 F +(Specifies the pixmap.) 171 528.33 T +4 F +(shapemask) 72 512.33 T +1 F +(Specifies the shape mask pixmap.) 171 512.33 T +4 F +(attributes) 72 496.33 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 496.33 T +1.85 (The) 72 472.33 P +0 F +1.85 (XpmCreateBufferFromPixmap) 91.89 472.33 P +1 F +1.85 ( function works as) 226.23 472.33 P +0 F +1.85 (XpmWriteFileFromPixmap) 309.69 472.33 P +1 F +1.85 (, it just calls) 428.5 472.33 P +0 F +1.85 (XpmCreate-) 486.72 472.33 P +0.07 (BufferFromImage) 72 460.33 P +1 F +0.07 ( instead of) 150.27 460.33 P +0 F +0.07 (XpmWriteFileFromImage) 194.6 460.33 P +1 F +0.07 (. Once again, the caller should free the buffer using) 307.29 460.33 P +0 F +0.07 (Xpm-) 515.57 460.33 P +(Free) 72 448.33 T +1 F +( when finished.) 91.42 448.33 T +0 12 Q +(3.1.6) 72 405 T +(Functions to deal with XPM files and buffers) 108 405 T +1 10 Q +-0.41 (As a convenience, the) 72 384.33 P +0 F +-0.41 (XpmReadFileToBuffer) 160.58 384.33 P +1 F +-0.41 ( and) 259.41 384.33 P +0 F +-0.41 (XpmWriteFileFromBuffer) 278.03 384.33 P +1 F +-0.41 ( are provided to copy a file to a buffer) 391.83 384.33 P +0.15 (and to write a file from a buffer. Thus for instance one may decide to use) 72 372.33 P +0 F +0.15 (XpmReadFileToBuffer) 368.86 372.33 P +1 F +0.15 (,) 467.69 372.33 P +0 F +0.15 (XpmCreatePix-) 472.84 372.33 P +0.63 (mapFromBuffer) 72 360.33 P +1 F +0.63 (, and) 142.5 360.33 P +0 F +0.63 (XpmFree) 165.7 360.33 P +1 F +0.63 ( instead of) 206.21 360.33 P +0 F +0.63 (XpmReadFileToPixmap) 252.25 360.33 P +1 F +0.63 (. On some systems this may lead to a perfor-) 356.08 360.33 P +(mance improvement, since the parsing will be performed in memory, but it uses more memory.) 72 348.33 T +0 F +(XpmReadFileToBuffer) 72 316.33 T +1 F +( allocates and fills a buffer from a file.) 170.83 316.33 T +(int XpmReadFileToBuffer\050) 72 298.33 T +4 F +(filename, buffer_return) 181.65 298.33 T +1 F +(\051) 274.93 298.33 T +(char) 108 286.33 T +4 F +(*filename;) 127.7 286.33 T +1 F +(char) 108 274.33 T +4 F +(**buffer_return;) 127.7 274.33 T +(filename) 72 258.33 T +1 F +(Specifies the file name to read.) 171 258.33 T +4 F +(buffer_return) 72 242.33 T +1 F +(Returns the buffer created.) 171 242.33 T +0 F +0.44 (XpmReadFileToBuffer) 72 218.33 P +1 F +0.44 ( returns) 170.83 218.33 P +0 F +0.44 (XpmOpenFailed) 204.45 218.33 P +1 F +0.44 ( if it cannot open the file, returns) 275.53 218.33 P +0 F +0.44 (XpmNoMemory) 412.55 218.33 P +1 F +0.44 ( if insufficient) 482.49 218.33 P +0.28 (working storage is allocated, and) 72 206.33 P +0 F +0.28 (XpmSuccess) 207.74 206.33 P +1 F +0.28 ( otherwise. The allocated buffer returned by) 261.04 206.33 P +0 F +0.28 (XpmReadFileToBuffer) 441.17 206.33 P +1 F +(should be freed with) 72 194.33 T +0 F +(XpmFree) 156.38 194.33 T +1 F +( when done.) 196.9 194.33 T +0 F +(XpmWriteFileFromBuffer) 72 162.33 T +1 F +( writes a buffer to a file.) 185.8 162.33 T +(int XpmWriteFileFromData\050) 72 144.33 T +4 F +(filename, data) 187.21 144.33 T +1 F +(\051) 244.4 144.33 T +(char) 108 132.33 T +4 F +(*filename;) 127.7 132.33 T +1 F +(char) 108 120.33 T +4 F +(*buffer;) 127.7 120.33 T +(filename) 72 104.33 T +1 F +(Specifies the file name to write.) 171 104.33 T +FMENDPAGE +%%EndPage: "18" 18 +%%Page: "19" 18 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(19) 300.12 54.85 T +4 10 Q +(buffer) 72 686.18 T +1 F +(Specifies the buffer to read.) 171 686.18 T +0 F +(XpmReadFileTobuffer) 72 662.18 T +1 F +( returns) 169.72 662.18 T +0 F +(XpmOpenFailed) 202.47 662.18 T +1 F +( if it cannot open the file, and) 273.55 662.18 T +0 F +(XpmSuccess) 393.74 662.18 T +1 F +( otherwise.) 447.04 662.18 T +0 12 Q +(3.1.7) 72 618.84 T +(Miscellaneous functions) 108 618.84 T +1 10 Q +(To free possible data stored into an) 72 598.18 T +0 F +(XpmAttributes) 214.95 598.18 T +1 F +( structure use) 279.91 598.18 T +0 F +(XpmFreeAttributes) 335.7 598.18 T +1 F +(.) 420.07 598.18 T +(int XpmFreeAttributes\050) 72 580.18 T +4 F +(attributes) 166.11 580.18 T +1 F +(\051) 204.43 580.18 T +(XpmAttributes) 108 568.18 T +4 F +(*attributes;) 170.47 568.18 T +(attributes) 72 552.18 T +1 F +( Specifies the structure to free.) 110.32 552.18 T +(The) 72 528.18 T +0 F +(XpmFreeAttributes) 90.04 528.18 T +1 F +( frees the structure members which have been malloc\325ed: the pixels list.) 174.41 528.18 T +(To dynamically allocate an) 72 496.18 T +0 F +(XpmAttributes) 183.03 496.18 T +1 F +( structure use the) 247.98 496.18 T +0 F +(XpmAttributesSize) 320.98 496.18 T +1 F +( function.) 403.15 496.18 T +(int XpmAttributesSize\050\051) 72 478.18 T +0.43 (The) 72 454.18 P +0 F +0.43 (XpmAttributesSize) 90.47 454.18 P +1 F +0.43 ( function provides application using dynamic libraries with a safe way to allocate and then) 172.63 454.18 P +-0.41 (refer to an) 72 442.18 P +0 F +-0.41 (XpmAttributes) 114.35 442.18 P +1 F +-0.41 (structure, disregarding whether the) 181.4 442.18 P +0 F +-0.41 (XpmAttributes) 321.61 442.18 P +1 F +-0.41 ( structure size has changed or not since) 386.57 442.18 P +(compiled.) 72 430.18 T +(To free data possibly stored into an array of) 72 398.18 T +0 F +(XpmExtension) 249.36 398.18 T +1 F +( use) 312.67 398.18 T +0 F +(XpmFreeExtensions) 330.99 398.18 T +1 F +(.) 417.6 398.18 T +(int XpmFreeExtensions\050) 72 380.18 T +4 F +(extensions, nextensions) 170 380.18 T +1 F +(\051) 263.27 380.18 T +(XpmExtension) 108 368.18 T +4 F +(*extensions;) 170.47 368.18 T +1 F +(int) 108 356.18 T +4 F +(nextensions;) 121.05 356.18 T +(extensions) 72 340.18 T +1 F +(Specifies the array to free.) 171 340.18 T +4 F +(nextensions) 72 324.18 T +1 F +(Specifies the number of extensions.) 171 324.18 T +-0.29 (This function frees all data stored in every extension and the array itself. Note that) 72 300.18 P +0 F +-0.29 (XpmFreeAttributes) 399.04 300.18 P +1 F +-0.29 ( call this func-) 483.42 300.18 P +(tion and thus most of the time it should not need to be explicitly called.) 72 288.18 T +(To free any data allocated by an) 72 256.18 T +0 F +(Xpm) 202.72 256.18 T +1 F +( function use the) 223.82 256.18 T +0 F +(XpmFree) 292.66 256.18 T +1 F +( function.) 333.18 256.18 T +(int XpmFree\050) 72 238.18 T +4 F +(ptr) 126.13 238.18 T +1 F +(\051) 137.79 238.18 T +(char) 108 226.18 T +4 F +(*ptr;) 127.7 226.18 T +(ptr) 72 210.18 T +1 F +( Specifies the data to free.) 83.66 210.18 T +-0.25 (The current distribution of the Xpm library uses the standard memory allocation functions and thus) 72 186.18 P +0 F +-0.25 (XpmFree) 467.21 186.18 P +1 F +-0.25 ( is noth-) 507.73 186.18 P +0.14 (ing else than a define to the standard) 72 174.18 P +0 F +0.14 (free) 221.9 174.18 P +1 F +0.14 (. However since these functions may be redefined in specific environments) 238.55 174.18 P +(it is wise to use) 72 162.18 T +0 F +(XpmFree) 136.13 162.18 T +1 F +(.) 176.65 162.18 T +(To get data when building an error message, one can use) 72 130.18 T +0 F +(XpmGetErrorString) 301.26 130.18 T +1 F +(char *XpmGetErrorString\050) 72 112.18 T +4 F +(errorcode) 179.97 112.18 T +1 F +(\051) 219.94 112.18 T +FMENDPAGE +%%EndPage: "19" 19 +%%Page: "20" 19 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(20) 300 56.01 T +1 10 Q +(int) 108 686.33 T +4 F +(errorcode) 121.05 686.33 T +1 F +(;) 161.02 686.33 T +4 F +(errorcode) 72 670.33 T +1 F +( Specifies the Xpm error.) 111.97 670.33 T +(XpmGetErrorString returns a string related to the given) 72 646.33 T +0 F +(Xpm) 296.29 646.33 T +1 F +( error code.) 317.39 646.33 T +0 14 Q +(3.2) 72 199.67 T +(The Advanced Level Interface) 100.8 199.67 T +1 10 Q +-0.22 (The advanced level interface is a set of functions that applications, such as icon editors, which needs to retreive all the) 72 174.33 P +(information stored in an XPM file and applications which perform data caching can use.) 72 162.33 T +(The following subsections describe these functions and how to use them.) 72 138.33 T +FMENDPAGE +%%EndPage: "20" 20 +%%Page: "21" 20 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(21) 300.12 54.85 T +(3.2.1) 72 684.84 T +(The structures) 108 684.84 T +1 10 Q +(The purpose of the structures defined in this section is to be able to store XPM images in memory to avoid any) 72 664.18 T +(additional parsing without losing information such as color defaults, symbolic color names, and comments.) 72 652.18 T +-0.31 (Indeed, considering the) 72 636.18 P +0 F +-0.31 (XPM) 167.1 636.18 P +1 F +-0.31 (format one can see that there is a lot more information related to a color than just an rgb) 192.04 636.18 P +-0.13 (value or a colormap index, the) 72 624.18 P +0 F +-0.13 (XpmColor) 195.29 624.18 P +1 F +-0.13 ( structure allows to store the different color defaults, the symbolic name of) 240.81 624.18 P +(a color, and the characters string which represents it.) 72 612.18 T +(typedef struct {) 72 596.18 T +(char *string;) 144 578.18 T +(/* characters string */) 288 578.18 T +(char *symbolic;) 144 560.18 T +(/* symbolic name */) 288 560.18 T +(char *m_color;) 144 542.18 T +(/* monochrom default */) 288 542.18 T +(char *g4_color;) 144 524.18 T +(/* 4 level grayscale default */) 288 524.18 T +(char *g_color;) 144 506.18 T +(/* other level grayscale default */) 288 506.18 T +(char *c_color;) 144 488.18 T +(/* color default */) 288 488.18 T +(} XpmColor;) 72 470.18 T +-0.2 (The) 72 452.18 P +0 F +-0.2 (XpmImage) 89.83 452.18 P +1 F +-0.2 ( structure is defined to store the image data definition with its size, the length of the characters strings) 137.58 452.18 P +(representing each color, and the related color table.) 72 440.18 T +(typedef struct {) 72 422.18 T +(unsigned int width;) 144 404.18 T +(/* image width */) 288 404.18 T +(unsigned int height;) 144 386.18 T +(/* image height */) 288 386.18 T +(unsigned int cpp;) 144 368.18 T +(/* number of characters per pixel */) 288 368.18 T +(unsigned int ncolors;) 144 350.18 T +(/* number of colors */) 288 350.18 T +(XpmColor *colorTable;) 144 332.18 T +(/* list of related colors */) 288 332.18 T +(unsigned int *data;) 144 314.18 T +(/* image data */) 288 314.18 T +(} XpmImage) 72 296.18 T +0.29 (The) 72 278.18 P +0 F +0.29 (XpmImage) 90.33 278.18 P +1 F +0.29 ( data is an array of width*height color indexes, each color index referencing the related color in the) 138.08 278.18 P +(color table.) 72 266.18 T +-0.37 (In addition, to get possible comments back while writing out to a file an) 72 242.18 P +0 F +-0.37 (XpmInfo) 356.91 242.18 P +1 F +-0.37 (s structure can be passed to the read-) 395.78 242.18 P +-0.31 (ing function, and then given back to the writing function. Comments are limited to a single string by) 72 230.18 P +0 F +-0.31 (XPM) 470.12 230.18 P +1 F +-0.31 ( format sec-) 492.88 230.18 P +(tion. If more exist in the read file, then only the last comment of each section will be stored.) 72 218.18 T +(typedef struct {) 72 194.18 T +(char *hints_cmt;) 144 176.18 T +(/* comment of the hints section */) 288 176.18 T +(char *colors_cmt;) 144 160.18 T +(/* comment of the colors section */) 288 160.18 T +(char *pixels_cmt;) 144 144.18 T +(/* comment of the pixels section */) 288 144.18 T +(} XpmInfos;) 72 120.18 T +FMENDPAGE +%%EndPage: "21" 21 +%%Page: "22" 21 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(22) 300 56.01 T +(3.2.2) 72 685 T +(Functions to deal with XPM files) 108 685 T +1 10 Q +(To create an) 72 660.33 T +0 F +(XpmImage) 123.89 660.33 T +1 F +( from an XPM file, use) 171.63 660.33 T +0 F +(XpmReadFileToXpmImage) 266.29 660.33 T +1 F +(.) 385.11 660.33 T +(int XpmReadFileToXpmImage\050) 72 642.33 T +4 F +(filename, image, attributes) 200.53 642.33 T +1 F +(, infos\051) 307.69 642.33 T +(char) 108 630.33 T +4 F +(*filename;) 127.7 630.33 T +1 F +(XpmImage) 108 618.33 T +4 F +(*image;) 155.46 618.33 T +1 F +(XpmAttributes) 108 606.33 T +4 F +(*attributes;) 170.47 606.33 T +1 F +(XpmInfos *infos;) 108 594.33 T +4 F +(filename) 72 578.33 T +1 F +(Specifies the file name to read from.) 171 578.33 T +4 F +(image) 72 562.33 T +1 F +(Specifies the image structure location.) 171 562.33 T +4 F +(attributes) 72 546.33 T +1 F +(Specifies the location of a structure to store possible extensions \050or NULL\051.) 171 546.33 T +(infos) 72 530.33 T +(Specifies the location of a structure to store possible information \050or NULL\051.) 171 530.33 T +0.35 (The) 72 506.33 P +0 F +0.35 (XpmReadFileToXpmImage) 90.39 506.33 P +1 F +0.35 ( function reads in a file in the) 209.21 506.33 P +0 F +0.35 (XPM) 331.96 506.33 P +1 F +0.35 ( format. If the file cannot be opened it returns) 354.72 506.33 P +0 F +-0.2 (XpmOpenFailed) 72 494.33 P +1 F +-0.2 (. If the file can be opened but does not contain valid) 143.08 494.33 P +0 F +-0.2 (XPM) 350.78 494.33 P +1 F +-0.2 (data, it returns) 375.83 494.33 P +0 F +-0.2 (XpmFileInvalid) 435.18 494.33 P +1 F +-0.2 (. If insuf-) 502.93 494.33 P +0.07 (ficient working storage is allocated, it returns) 72 482.33 P +0 F +0.07 (XpmNoMemory) 256.24 482.33 P +1 F +0.07 (. On success it fills in the given) 326.18 482.33 P +0 F +0.07 (XpmImage) 454.72 482.33 P +1 F +0.07 ( structure) 502.46 482.33 P +-0.17 (and returns) 72 470.33 P +0 F +-0.17 (XpmSuccess) 118.85 470.33 P +1 F +-0.17 (. Also it stores possible extensions in the) 172.15 470.33 P +0 F +-0.17 (XpmAttributes) 336.02 470.33 P +1 F +-0.17 ( structure if one is given and possi-) 400.97 470.33 P +(ble information in the) 72 458.33 T +0 F +(XpmInfos) 161.39 458.33 T +1 F +( struture if one is given) 204.15 458.33 T +-0.4 (In addition on systems which support such features) 72 434.33 P +0 F +-0.4 (XpmReadFileToXpmImage) 275.9 434.33 P +1 F +-0.4 (deals with compressed files by fork-) 396.82 434.33 P +-0.09 (ing an) 72 422.33 P +0 F +-0.09 (uncompress) 99.03 422.33 P +1 F +-0.09 ( or) 150.11 422.33 P +0 F +-0.09 (gzip) 163.26 422.33 P +1 F +-0.09 ( process and reading from the piped result. It assumes that the specified file is compressed) 181.03 422.33 P +0.25 (if the given file name ends by \325.Z\325 or \325.gz\325. In case the file name does not end so,) 72 410.33 P +0 F +0.25 (XpmReadFileToXpmImage) 402.33 410.33 P +1 F +0.25 ( first) 521.15 410.33 P +0.01 (looks for a file of which the name is the given one followed by \325.Z\325 or \325.gz\325; then if such a file does not exist, it looks) 72 398.33 P +-0.32 (for the given file \050assumed as not compressed\051. And if instead of a file name) 72 386.33 P +0 F +-0.32 (NULL) 375.27 386.33 P +1 F +-0.32 ( is passed to) 403.03 386.33 P +0 F +-0.32 (XpmReadFileToXp-) 452.83 386.33 P +(mImage) 72 374.33 T +1 F +(, it reads from the standard input.) 106.97 374.33 T +(To write out an) 72 342.33 T +0 F +(XpmImage) 135.85 342.33 T +1 F +( to an) 183.59 342.33 T +0 F +(XPM) 208.29 342.33 T +1 F +( file, use) 231.05 342.33 T +0 F +(XpmWriteFileFromXpmImage) 267.69 342.33 T +1 F +(int XpmWriteFileFromXpmImage\050) 72 324.33 T +4 F +(filename, image, shapeimage, attributes, infos) 213.3 324.33 T +1 F +(\051) 397.64 324.33 T +(char) 108 312.33 T +4 F +(*filename;) 127.7 312.33 T +1 F +(XImage) 108 300.33 T +4 F +(*image;) 142.69 300.33 T +1 F +(XpmAttributes) 108 288.33 T +4 F +(*attributes;) 170.47 288.33 T +1 F +(XpmInfos *infos;) 108 276.33 T +4 F +(filename) 72 260.33 T +1 F +(Specifies the file name to use.) 171 260.33 T +4 F +(image) 72 244.33 T +1 F +(Specifies the image.) 171 244.33 T +4 F +(attributes) 72 228.33 T +1 F +(Specifies the location of a structure containing extensions \050or NULL\051.) 171 228.33 T +4 F +(infos) 72 212.33 T +1 F +(Specifies the location of a structure to get information from \050or NULL\051.) 171 212.33 T +0.2 (The) 72 188.33 P +0 F +0.2 (XpmWriteFileFromXpmImage) 90.24 188.33 P +1 F +0.2 ( function writes an image out to a file in the) 224.03 188.33 P +0 F +0.2 (XPM) 403.63 188.33 P +1 F +0.2 ( format. If the file cannot be) 426.38 188.33 P +-0.61 (opened, it returns) 72 176.33 P +0 F +-0.61 (XpmOpenFailed) 142.34 176.33 P +1 F +-0.61 (. If insufficient working storage is allocated, it returns) 213.42 176.33 P +0 F +-0.61 (XpmNoMemory) 425.83 176.33 P +1 F +-0.61 (. If no error) 495.77 176.33 P +0.19 (occurs then it returns) 72 164.33 P +0 F +0.19 (XpmSuccess) 159.36 164.33 P +1 F +0.19 (. In addition if it is given an) 212.66 164.33 P +0 F +0.19 (XpmAttributes) 327.72 164.33 P +1 F +0.19 ( structure containing extensions and/) 392.67 164.33 P +(or an) 72 152.33 T +0 F +(XpmInfos) 94.76 152.33 T +1 F +( struture containing information it will write them out too.) 137.51 152.33 T +0.4 (In addition on systems which support such features if the given file name ends by \325.Z\325 or \325.gz\325 it is assumed to be a) 72 128.33 P +0.3 (compressed file. Then,) 72 116.33 P +0 F +0.3 (XpmWriteFileFromXpmImage) 166.43 116.33 P +1 F +0.3 (writes to a piped) 303.02 116.33 P +0 F +0.3 (compress) 373.05 116.33 P +1 F +0.3 ( or) 413.02 116.33 P +0 F +0.3 (gzip) 426.94 116.33 P +1 F +0.3 ( process. And if instead) 444.71 116.33 P +(of a file name) 72 104.33 T +0 F +(NULL) 129.73 104.33 T +1 F +(is passed to) 159.99 104.33 T +0 F +(XpmWriteFileFromXpmImage) 208.57 104.33 T +1 F +(, it writes to the standard output.) 342.36 104.33 T +FMENDPAGE +%%EndPage: "22" 22 +%%Page: "23" 22 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(23) 300.12 54.85 T +(3.2.3) 72 684.84 T +(Functions to deal with XPM data) 108 684.84 T +1 10 Q +(To create an) 72 660.18 T +0 F +(XpmImage) 123.89 660.18 T +1 F +( from an) 171.63 660.18 T +0 F +(XPM) 207.99 660.18 T +1 F +( data, use) 230.75 660.18 T +0 F +(XpmCreateXpmImageFromData) 270.72 660.18 T +1 F +(.) 412.82 660.18 T +(int XpmCreateXpmImageFromData\050) 72 642.18 T +4 F +(data, image, attributes) 219.95 642.18 T +1 F +(\051) 310.46 642.18 T +(char) 108 630.18 T +4 F +(**data;) 127.7 630.18 T +1 F +(XpmImage) 108 618.18 T +4 F +(*image;) 155.46 618.18 T +1 F +(XpmAttributes) 108 606.18 T +4 F +(*attributes;) 170.47 606.18 T +(data) 72 590.18 T +1 F +(Specifies the location of the data.) 171 590.18 T +4 F +(image) 72 574.18 T +1 F +(Specifies the image structure location.) 171 574.18 T +4 F +(attributes) 72 558.18 T +1 F +-0.34 (Specifies the location of an) 171 558.18 P +0 F +-0.34 (XpmAttributes) 280.63 558.18 P +1 F +-0.34 ( structure to get and store information, or) 345.59 558.18 P +0 F +-0.34 (NULL) 509.74 558.18 P +1 F +-0.34 (.) 537.5 558.18 P +0 F +-0.08 (XpmCreateXpmImageFromData) 72 534.18 P +1 F +-0.08 ( works as) 214.1 534.18 P +0 F +-0.08 (XpmCreateXpmImageFromFile) 254.11 534.18 P +1 F +-0.08 ( does, excepts it reads from the given) 391.78 534.18 P +-0.25 (data instead of a file, and it does not take any) 72 522.18 P +0 F +-0.25 (XpmInfos) 252.44 522.18 P +1 F +-0.25 ( structure in argument since a data cannot store any comment.) 295.2 522.18 P +0 F +(XpmCreateDataFromXpmImage) 72 498.18 T +1 F +( creates an) 214.1 498.18 T +0 F +(XPM) 258.78 498.18 T +1 F +( data from an) 281.54 498.18 T +0 F +(XmImage) 337.04 498.18 T +1 F +(.) 379.23 498.18 T +(int XpmCreateDataFromXpmImage\050) 72 480.18 T +4 F +(data_return, image, attributes) 219.95 480.18 T +1 F +(\051) 340.44 480.18 T +(char) 108 468.18 T +4 F +(***data_return;) 127.7 468.18 T +1 F +(XxpmImage) 108 456.18 T +4 F +(*image;) 160.46 456.18 T +1 F +(XpmAttributes) 108 444.18 T +4 F +(*attributes;) 170.47 444.18 T +(data_return) 72 428.18 T +1 F +(Returns the data which is created.) 171 428.18 T +4 F +(image) 72 412.18 T +1 F +(Specifies the image.) 171 412.18 T +4 F +(attributes) 72 396.18 T +1 F +(Specifies the location of a structure to get information.) 171 396.18 T +-0.15 (The) 72 372.18 P +0 F +-0.15 (XpmCreateDataFromXpmImage) 89.89 372.18 P +1 F +-0.15 ( function exactly works as) 231.99 372.18 P +0 F +-0.15 (XpmWriteFileFromXpmImage) 338.66 372.18 P +1 F +-0.15 ( does and returns) 472.45 372.18 P +0.08 (the same way. It just writes to a single block malloc\325ed data instead of to a file. It is the caller\325s responsibility to free) 72 360.18 P +0.34 (the data, using) 72 348.18 P +0 F +0.34 (XpmFree) 133.54 348.18 P +1 F +0.34 ( when finished. Of course this function does not take any) 174.06 348.18 P +0 F +0.34 (XpmInfos) 408.22 348.18 P +1 F +0.34 ( structure in argument) 450.98 348.18 P +(since a data cannot store any comment.) 72 336.18 T +0 12 Q +(3.2.4) 72 292.85 T +(Functions to deal with XPM buffers) 108 292.85 T +1 10 Q +(To create an) 72 268.18 T +0 F +(XpmImage) 123.89 268.18 T +1 F +( from an) 171.63 268.18 T +0 F +(XPM) 207.99 268.18 T +1 F +( buffer, use) 230.75 268.18 T +0 F +(XpmCreateXpmImageFromBuffer) 278.49 268.18 T +1 F +(.) 427.8 268.18 T +(int XpmCreateXpmImageFromBuffer\050) 72 250.18 T +4 F +(buffer, image, attributes, infos) 227.16 250.18 T +1 F +(\051) 348.22 250.18 T +(char) 108 238.18 T +4 F +(*buffer;) 127.7 238.18 T +1 F +(XpmImage) 108 226.18 T +4 F +(*image;) 155.46 226.18 T +1 F +(XpmAttributes) 108 214.18 T +4 F +(*attributes;) 170.47 214.18 T +1 F +(XpmInfos) 108 202.18 T +4 F +(*infos;) 151.03 202.18 T +(buffer) 72 186.18 T +1 F +(Specifies the location of the buffer.) 171 186.18 T +4 F +(image) 72 170.18 T +1 F +(Specifies the image structure location.) 171 170.18 T +4 F +(attributes) 72 154.18 T +1 F +(Specifies the location of a structure to get and store information \050or NULL) 171 154.18 T +0 F +(\051) 469.12 154.18 T +1 F +(.) 472.44 154.18 T +4 F +(infos) 72 138.18 T +1 F +(Specifies the location of a structure to store possible information \050or NULL) 171 138.18 T +0 F +(\051) 472.73 138.18 T +1 F +(.) 476.06 138.18 T +-0.3 (The) 72 114.18 P +0 F +-0.3 (XpmCreateXpmImageFromBuffer) 89.74 114.18 P +1 F +-0.3 ( works the same way as) 239.06 114.18 P +0 F +-0.3 (XpmReadFileToXpmImage) 334.41 114.18 P +1 F +-0.3 (, it just reads the buff-) 453.23 114.18 P +FMENDPAGE +%%EndPage: "23" 23 +%%Page: "24" 23 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(24) 300 56.01 T +1 10 Q +-0.48 (er instead of the file. Be aware that the feature provided on some systems by) 72 686.33 P +0 F +-0.48 (XpmReadFileToXpmImage) 372.93 686.33 P +1 F +-0.48 (to deal with) 493.76 686.33 P +(compressed files is not available here.) 72 674.33 T +(To create an) 72 642.33 T +0 F +(XPM) 123.89 642.33 T +1 F +( buffer from an) 146.65 642.33 T +0 F +(XpmImage) 209.92 642.33 T +1 F +(, use) 257.67 642.33 T +0 F +(XpmCreateBufferFromXpmImage) 278.49 642.33 T +1 F +(.) 427.8 642.33 T +(int XpmCreateBufferFromXpmImage\050) 72 624.33 T +4 F +(buffer_return, image, attributes) 227.16 624.33 T +1 F +(\051) 353.77 624.33 T +(char) 108 612.33 T +4 F +(**buffer_return;) 127.7 612.33 T +1 F +(XpmImage) 108 600.33 T +4 F +(*image;) 155.46 600.33 T +1 F +(XpmInfos) 108 588.33 T +4 F +(*infos;) 151.03 588.33 T +(buffer_return) 72 572.33 T +1 F +(Returns the buffer which is created.) 171 572.33 T +4 F +(image) 72 556.33 T +1 F +(Specifies the image.) 171 556.33 T +4 F +(attributes) 72 540.33 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 540.33 T +4 F +(infos) 72 524.33 T +1 F +(Specifies the location of a structure to get possible information \050or NULL) 171 524.33 T +0 F +(\051) 465.52 524.33 T +1 F +(.) 468.85 524.33 T +1.25 (The) 72 500.33 P +0 F +1.25 (XpmCreateBufferFromXpmImage) 91.29 500.33 P +1 F +1.25 ( works as) 240.61 500.33 P +0 F +1.25 (XpmWriteFileFromXpmImage) 284.61 500.33 P +1 F +1.25 (, it just writes to a malloc\325ed) 418.4 500.33 P +(buffer instead of to a file. The caller should free the buffer using) 72 488.33 T +0 F +(XpmFree) 331.79 488.33 T +1 F +( when finished.) 372.3 488.33 T +0 12 Q +(3.2.5) 72 445 T +(Functions to deal with X images) 108 445 T +1 10 Q +(To create an) 72 420.33 T +0 F +(XImage) 123.89 420.33 T +1 F +( from an) 157.75 420.33 T +0 F +(XpmImage) 194.11 420.33 T +1 F +(, use) 241.86 420.33 T +0 F +(XpmCreateImageFromXpmImage) 262.67 420.33 T +1 F +(.) 410.88 420.33 T +(int XpmCreateImageFromXpmImage\050) 72 402.33 T +4 F +(display, image, image_return, shapeimage_return, attributes) 226.05 402.33 T +1 F +(\051) 469.8 402.33 T +(Display) 108 390.33 T +4 F +(*display;) 141.59 390.33 T +1 F +(XpmImage) 108 378.33 T +4 F +(*image;) 155.46 378.33 T +1 F +(XImage) 108 366.33 T +4 F +(*image_return;) 142.69 366.33 T +1 F +(XImage) 108 354.33 T +4 F +(*shapeimage_return;) 142.69 354.33 T +1 F +(XpmAttributes) 108 342.33 T +4 F +(*attributes;) 170.47 342.33 T +(display) 72 326.33 T +1 F +(Specifies the connection to the X server.) 171 326.33 T +4 F +(image) 72 310.33 T +1 F +(Specifies the) 171 310.33 T +0 F +(XpmImage) 224.85 310.33 T +1 F +(.) 272.59 310.33 T +4 F +(image_return) 72 294.33 T +1 F +(Returns the image which is created.) 171 294.33 T +4 F +(shapeimage_return) 72 278.33 T +1 F +(Returns the shape mask image which is created if any.) 171 278.33 T +4 F +(attributes) 72 262.33 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 262.33 T +0.05 (From the given) 72 238.33 P +0 F +0.05 (XpmImage) 135.73 238.33 P +1 F +0.05 ( and) 183.47 238.33 P +0 F +0.05 (XpmAttributes) 203 238.33 P +1 F +0.05 ( if not) 267.95 238.33 P +0 F +0.05 (NULL) 294.48 238.33 P +1 F +0.05 (,) 322.25 238.33 P +0 F +0.05 (XpmCreateImageFromXpmImage) 327.3 238.33 P +1 F +0.05 ( allocates colors) 475.5 238.33 P +(and creates X images following the same mechanism as) 72 226.33 T +0 F +(XpmReadFileToImage) 297.67 226.33 T +1 F +(.) 395.38 226.33 T +(To create an) 72 194.33 T +0 F +(XpmImage) 123.89 194.33 T +1 F +( from an) 171.63 194.33 T +0 F +(XImage) 207.99 194.33 T +1 F +(, use) 241.86 194.33 T +0 F +(XpmCreateXpmImageFromImage) 262.67 194.33 T +1 F +(.) 410.88 194.33 T +(int XpmCreateXpmImageFromImage\050) 72 176.33 T +4 F +(display, image, shapeimage, xpmimage, attributes) 226.05 176.33 T +1 F +(\051) 426.48 176.33 T +(Display) 108 164.33 T +4 F +(*display;) 141.59 164.33 T +1 F +(XImage) 108 152.33 T +4 F +(*image;) 142.69 152.33 T +1 F +(XImage) 108 140.33 T +4 F +(*shapeimage;) 142.69 140.33 T +1 F +(XpmImage) 108 128.33 T +4 F +(*xpmimage) 155.46 128.33 T +1 F +(XpmAttributes) 108 116.33 T +4 F +(*attributes;) 170.47 116.33 T +FMENDPAGE +%%EndPage: "24" 24 +%%Page: "25" 24 +612 792 0 FMBEGINPAGE +540.11 719.92 72.11 719.92 2 L +0.25 H +2 Z +0 X +0 K +N +261.11 728.92 369.11 737.92 R +7 X +V +4 10 Q +0 X +(XPM Manual) 288.05 731.25 T +540.11 70.84 72.11 70.84 2 L +N +0 12 Q +(25) 300.12 54.85 T +4 10 Q +(display) 72 686.18 T +1 F +(Specifies the connection to the X server.) 171 686.18 T +4 F +(image) 72 670.18 T +1 F +(Specifies the image which is created.) 171 670.18 T +4 F +(shapeimage) 72 654.18 T +1 F +(Specifies the shape mask image which is created if any.) 171 654.18 T +4 F +(xpmimage) 72 638.18 T +1 F +(Specifies the location of an) 171 638.18 T +0 F +(XpmImage) 282.31 638.18 T +1 F +(structure.) 332.55 638.18 T +4 F +(attributes) 72 622.18 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 622.18 T +-0.51 (From the given X images and) 72 598.18 P +0 F +-0.51 (XpmAttributes) 189.96 598.18 P +1 F +-0.51 ( if not) 254.92 598.18 P +0 F +-0.51 (NULL) 279.76 598.18 P +1 F +-0.51 (,) 307.52 598.18 P +0 F +-0.51 (XpmCreateXpmImageFromImage) 312.01 598.18 P +1 F +-0.51 ( creates an) 460.22 598.18 P +0 F +-0.51 (XpmIm-) 503.36 598.18 P +(age) 72 586.18 T +1 F +( following the same mechanism as) 86.43 586.18 T +0 F +(XpmWriteFileFromImage) 226.9 586.18 T +1 F +(.) 339.58 586.18 T +0 12 Q +(3.2.6) 72 542.84 T +(Functions to deal with X pixmaps) 108 542.84 T +1 10 Q +-0.25 (To create a) 72 518.18 P +0 F +-0.25 (Pixmap) 118.13 518.18 P +1 F +-0.25 (with its possible related shapemask from an) 153.13 518.18 P +0 F +-0.25 (XpmImage) 328.73 518.18 P +1 F +-0.25 (, use) 376.47 518.18 P +0 F +-0.25 (XpmCreatePixmapFromXpmIm-) 396.78 518.18 P +(age) 72 506.18 T +1 F +(.) 86.43 506.18 T +(int XpmCreatePixmapFromXpmImage\050) 72 488.18 T +4 F +(display, d, image, pixmap_return, shapemask_return, attributes) 231.62 488.18 T +1 F +(\051) 486.47 488.18 T +(Display) 108 476.18 T +4 F +(*display;) 141.59 476.18 T +1 F +(Drawable d;) 108 464.18 T +(XpmImage) 108 452.18 T +4 F +(*image;) 155.46 452.18 T +1 F +(Pixmap) 108 440.18 T +4 F +(*pixmap_return;) 141.04 440.18 T +1 F +(Pixmap) 108 428.18 T +4 F +(*shapemask_return;) 141.04 428.18 T +1 F +(XpmAttributes) 108 416.18 T +4 F +(*attributes;) 170.47 416.18 T +(display) 72 400.18 T +1 F +(Specifies the connection to the X server.) 171 400.18 T +4 F +(d) 72 384.18 T +1 F +(Specifies which screen the pixmap is created on.) 171 384.18 T +4 F +(image) 72 368.18 T +1 F +(Specifies the) 171 368.18 T +0 F +(XpmImage) 224.85 368.18 T +1 F +(.) 272.59 368.18 T +4 F +(pixmap_return) 72 352.18 T +1 F +(Returns the pixmap which is created.) 171 352.18 T +4 F +(shapemask_return) 72 336.18 T +1 F +(Returns the shape mask which is created if any.) 171 336.18 T +4 F +(attributes) 72 320.18 T +1 F +(Specifies the location of a structure to get and store information \050or NULL\051.) 171 320.18 T +0 F +0.35 (XpmCreatePixmapFromXpmImage) 72 296.18 P +1 F +0.35 ( creates X images calling) 226.32 296.18 P +0 F +0.35 (XpmCreateImageFromXpmImage) 331.05 296.18 P +1 F +0.35 ( with the given) 479.26 296.18 P +0 F +-0.07 (XpmImage) 72 284.18 P +1 F +-0.07 ( and) 119.74 284.18 P +0 F +-0.07 (XpmAttributes) 139.03 284.18 P +1 F +-0.07 (, then it creates the related pixmaps which are returned to) 203.98 284.18 P +4 F +-0.07 (pixmap_return) 434.66 284.18 P +1 F +-0.07 ( and) 494.07 284.18 P +4 F +-0.07 (shape-) 513.35 284.18 P +(mask_return) 72 272.18 T +1 F +( using) 122.52 272.18 T +0 F +(XPutImage) 149.18 272.18 T +1 F +(. Finally it destroys the X images with) 198.03 272.18 T +0 F +(XDestroyImage) 353.23 272.18 T +1 F +(.) 420.39 272.18 T +(To create an) 72 240.18 T +0 F +(XpmImage) 123.89 240.18 T +1 F +( from a) 171.63 240.18 T +0 F +(Pixmp) 203 240.18 T +1 F +(, use) 230.76 240.18 T +0 F +(XpmCreateXpmImageFromPixmap) 251.58 240.18 T +1 F +(.) 405.91 240.18 T +(int XpmCreateXpmImageFromPixmap\050) 72 222.18 T +4 F +(display, pixmap, shapemask, xpmimage, attributes) 231.62 222.18 T +1 F +(\051) 433.16 222.18 T +(Display) 108 210.18 T +4 F +(*display;) 141.59 210.18 T +1 F +(Pixmap) 108 198.18 T +4 F +(*pixmap;) 141.04 198.18 T +1 F +(Pixmap) 108 186.18 T +4 F +(*shapemask;) 141.04 186.18 T +1 F +(XpmImage) 108 174.18 T +4 F +(*xpmimage) 155.46 174.18 T +1 F +(XpmAttributes) 108 162.18 T +4 F +(*attributes;) 170.47 162.18 T +(display) 72 146.18 T +1 F +(Specifies the connection to the X server.) 171 146.18 T +4 F +(pixmap) 72 130.18 T +1 F +(Specifies the pixmap.) 171 130.18 T +4 F +(shapemask) 72 114.18 T +1 F +(Specifies the shape mask pixmap.) 171 114.18 T +FMENDPAGE +%%EndPage: "25" 25 +%%Page: "26" 25 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +540 72 72 72 2 L +N +0 12 Q +(26) 300 56.01 T +4 10 Q +(xpmimage) 72 686.33 T +1 F +(Specifies the location of an) 171 686.33 T +0 F +(XpmImage) 282.31 686.33 T +1 F +(structure.) 332.55 686.33 T +4 F +(attributes) 72 670.33 T +1 F +(Specifies the location of a structure containing information \050or NULL\051.) 171 670.33 T +0 (From the given pixmaps and) 72 646.33 P +0 F +0 (XpmAttributes) 188.87 646.33 P +1 F +0 ( if not) 253.82 646.33 P +0 F +0 (NULL) 280.2 646.33 P +1 F +0 (,) 307.96 646.33 P +0 F +0 (XpmCreateXpmImageFromPixmap) 312.96 646.33 P +1 F +0 (gets the related X) 469.78 646.33 P +0.73 (images by calling) 72 634.33 P +0 F +0.73 (XGetImage) 147.19 634.33 P +1 F +0.73 (, then it gives them to) 196.59 634.33 P +0 F +0.73 (XpmCreateXpmImageFromImage) 290.08 634.33 P +1 F +0.73 ( to create an) 438.29 634.33 P +0 F +0.73 (XpmImage) 492.26 634.33 P +1 F +(which is returned to) 72 622.33 T +4 F +(xpmimage) 154.16 622.33 T +1 F +(. Finally it destroys the created X images using) 195.24 622.33 T +0 F +(XDestroyImage) 385.68 622.33 T +1 F +(.) 452.84 622.33 T +0 12 Q +(3.2.7) 72 579 T +(Miscellaneous functions) 108 579 T +1 10 Q +(To free possible data stored into an) 72 554.33 T +0 F +(XpmImage) 214.95 554.33 T +1 F +(structure use) 265.19 554.33 T +0 F +(XpmFreeXpmImage) 318.48 554.33 T +1 F +(.) 406.75 554.33 T +(int XpmFreeXpmImage\050) 72 536.33 T +4 F +(image) 171.1 536.33 T +1 F +(\051) 195.52 536.33 T +(XpmImage) 108 524.33 T +4 F +(*image;) 155.46 524.33 T +(image) 72 508.33 T +1 F +(Specifies the structure to free.) 98.93 508.33 T +(The) 72 484.33 T +0 F +(XpmFreeXpmImage) 90.04 484.33 T +1 F +(frees the structure members which are not NULL, but not the structure itself.) 180.8 484.33 T +(To free possible data stored into an) 72 452.33 T +0 F +(XpmInfos) 214.95 452.33 T +1 F +(structure use) 260.21 452.33 T +0 F +(XpmFreeXpmInfos) 313.5 452.33 T +1 F +(.) 396.77 452.33 T +(int XpmFreeXpmInfos\050) 72 434.33 T +4 F +(infos) 166.66 434.33 T +1 F +(\051) 186.1 434.33 T +(XpmInfos) 108 422.33 T +4 F +(*infos;) 148.53 422.33 T +(iinfos) 72 406.33 T +1 F +(Specifies the structure to free.) 96.72 406.33 T +(The) 72 382.33 T +0 F +(XpmFreeXpmInfos) 90.04 382.33 T +1 F +(frees the structure members which are not NULL, but not the structure itself.) 175.81 382.33 T +FMENDPAGE +%%EndPage: "26" 26 +%%Page: "25" 26 +612 792 0 FMBEGINPAGE +540 720 72 720 2 L +0.25 H +2 Z +0 X +0 K +N +261 729 369 738 R +7 X +V +4 10 Q +0 X +(XPM Manual) 287.93 731.33 T +225 639 396 657 R +7 X +V +1 18 Q +0 X +(Index of Functions) 242.54 645 T +540 72 72 72 2 L +N +1 12 Q +(XpmAttributesSize 19) 72 568 T +(XpmCreateBufferFromImage 17) 72 549 T +(XpmCreateBufferFromPixmap 18) 72 530 T +(XpmCreateBufferFromXpmImage 24) 72 511 T +(XpmCreateDataFromImage 15) 72 492 T +(XpmCreateDataFromPixmap 15) 72 473 T +(XpmCreateDataFromXpmImage 23) 72 454 T +(XpmCreateImageFromBuffer 16) 72 435 T +(XpmCreateImageFromData 14) 72 416 T +(XpmCreateImageFromXpmImage 24) 72 397 T +(XpmCreatePixmapFromBuffer 17) 72 378 T +(XpmCreatePixmapFromData 14) 72 359 T +(XpmCreatePixmapFromXpmImage 25) 72 340 T +(XpmCreateXpmImageFromBuffer 23) 72 321 T +(XpmCreateXpmImageFromData 23) 72 302 T +(XpmCreateXpmImageFromImage 24) 72 283 T +(XpmCreateXpmImageFromPixmap 25) 72 264 T +(XpmFree 19) 72 245 T +(XpmFreeAttributes 19) 72 226 T +(XpmFreeExtensions 19) 72 207 T +(XpmFreeXpmImage 26) 72 188 T +(XpmFreeXpmInfos 26) 72 169 T +(XpmGetErrorString 19) 72 150 T +(XpmReadFileToBuffer 18) 72 131 T +(XpmReadFileToData 16) 72 112 T +(XpmReadFileToImage 11) 315 568 T +(XpmReadFileToPixmap 12) 315 549 T +(XpmReadFileToXpmImage 22) 315 530 T +(XpmWriteFileFromBuffer 18) 315 511 T +(XpmWriteFileFromData 16) 315 492 T +(XpmWriteFileFromImage 13) 315 473 T +(XpmWriteFileFromPixmap 13) 315 454 T +(XpmWriteFileFromXpmImage 22) 315 435 T +FMENDPAGE +%%EndPage: "25" 27 +%%Trailer +%%BoundingBox: 0 0 612 792 +%%Pages: 26 1 +%%DocumentFonts: Times-Bold +%%+ Times-Roman +%%+ Helvetica +%%+ Courier +%%+ Times-Italic diff --git a/vendor/x11iraf/xpm/hashtable.c b/vendor/x11iraf/xpm/hashtable.c new file mode 100644 index 00000000..56452955 --- /dev/null +++ b/vendor/x11iraf/xpm/hashtable.c @@ -0,0 +1,208 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* hashtable.c: * +* * +* XPM library * +* * +* Developed by Arnaud Le Hors * +* this originaly comes from Colas Nahaboo as a part of Wool * +* * +\*****************************************************************************/ + +#include "xpmP.h" + +LFUNC(AtomMake, xpmHashAtom, (char *name, void *data)); +LFUNC(HashTableGrows, int, (xpmHashTable * table)); + +static xpmHashAtom +AtomMake(name, data) /* makes an atom */ + char *name; /* WARNING: is just pointed to */ + void *data; +{ + xpmHashAtom object = (xpmHashAtom) XpmMalloc(sizeof(struct _xpmHashAtom)); + + if (object) { + object->name = name; + object->data = data; + } + return object; +} + +/************************\ +* * +* hash table routines * +* * +\************************/ + +/* + * Hash function definition: + * HASH_FUNCTION: hash function, hash = hashcode, hp = pointer on char, + * hash2 = temporary for hashcode. + * INITIAL_TABLE_SIZE in slots + * HASH_TABLE_GROWS how hash table grows. + */ + +/* Mock lisp function */ +#define HASH_FUNCTION hash = (hash << 5) - hash + *hp++; +/* #define INITIAL_HASH_SIZE 2017 */ +#define INITIAL_HASH_SIZE 256 /* should be enough for colors */ +#define HASH_TABLE_GROWS size = size * 2; + +/* aho-sethi-ullman's HPJ (sizes should be primes)*/ +#ifdef notdef +#define HASH_FUNCTION hash <<= 4; hash += *hp++; \ + if(hash2 = hash & 0xf0000000) hash ^= (hash2 >> 24) ^ hash2; +#define INITIAL_HASH_SIZE 4095 /* should be 2^n - 1 */ +#define HASH_TABLE_GROWS size = size << 1 + 1; +#endif + +/* GNU emacs function */ +/* +#define HASH_FUNCTION hash = (hash << 3) + (hash >> 28) + *hp++; +#define INITIAL_HASH_SIZE 2017 +#define HASH_TABLE_GROWS size = size * 2; +*/ + +/* end of hash functions */ + +/* + * The hash table is used to store atoms via their NAME: + * + * NAME --hash--> ATOM |--name--> "foo" + * |--data--> any value which has to be stored + * + */ + +/* + * xpmHashSlot gives the slot (pointer to xpmHashAtom) of a name + * (slot points to NULL if it is not defined) + * + */ + +xpmHashAtom * +xpmHashSlot(table, s) + xpmHashTable *table; + char *s; +{ + xpmHashAtom *atomTable = table->atomTable; + unsigned int hash; + xpmHashAtom *p; + char *hp = s; + char *ns; + + hash = 0; + while (*hp) { /* computes hash function */ + HASH_FUNCTION + } + p = atomTable + hash % table->size; + while (*p) { + ns = (*p)->name; + if (ns[0] == s[0] && strcmp(ns, s) == 0) + break; + p--; + if (p < atomTable) + p = atomTable + table->size - 1; + } + return p; +} + +static int +HashTableGrows(table) + xpmHashTable *table; +{ + xpmHashAtom *atomTable = table->atomTable; + int size = table->size; + xpmHashAtom *t, *p; + int i; + int oldSize = size; + + t = atomTable; + HASH_TABLE_GROWS + table->size = size; + table->limit = size / 3; + atomTable = (xpmHashAtom *) XpmMalloc(size * sizeof(*atomTable)); + if (!atomTable) + return (XpmNoMemory); + table->atomTable = atomTable; + for (p = atomTable + size; p > atomTable;) + *--p = NULL; + for (i = 0, p = t; i < oldSize; i++, p++) + if (*p) { + xpmHashAtom *ps = xpmHashSlot(table, (*p)->name); + + *ps = *p; + } + XpmFree(t); + return (XpmSuccess); +} + +/* + * xpmHashIntern(table, name, data) + * an xpmHashAtom is created if name doesn't exist, with the given data. + */ + +int +xpmHashIntern(table, tag, data) + xpmHashTable *table; + char *tag; + void *data; +{ + xpmHashAtom *slot; + + if (!*(slot = xpmHashSlot(table, tag))) { + /* undefined, make a new atom with the given data */ + if (!(*slot = AtomMake(tag, data))) + return (XpmNoMemory); + if (table->used >= table->limit) { + int ErrorStatus; + + if ((ErrorStatus = HashTableGrows(table)) != XpmSuccess) + return (ErrorStatus); + table->used++; + return (XpmSuccess); + } + table->used++; + } + return (XpmSuccess); +} + +/* + * must be called before allocating any atom + */ + +int +xpmHashTableInit(table) + xpmHashTable *table; +{ + xpmHashAtom *p; + xpmHashAtom *atomTable; + + table->size = INITIAL_HASH_SIZE; + table->limit = table->size / 3; + table->used = 0; + atomTable = (xpmHashAtom *) XpmMalloc(table->size * sizeof(*atomTable)); + if (!atomTable) + return (XpmNoMemory); + for (p = atomTable + table->size; p > atomTable;) + *--p = NULL; + table->atomTable = atomTable; + return (XpmSuccess); +} + +/* + * frees a hashtable and all the stored atoms + */ + +void +xpmHashTableFree(table) + xpmHashTable *table; +{ + xpmHashAtom *p; + xpmHashAtom *atomTable = table->atomTable; + + for (p = atomTable + table->size; p > atomTable;) + if (*--p) + XpmFree(*p); + XpmFree(atomTable); + table->atomTable = NULL; +} diff --git a/vendor/x11iraf/xpm/icons/NeXT.xpm b/vendor/x11iraf/xpm/icons/NeXT.xpm new file mode 100644 index 00000000..02737d9c --- /dev/null +++ b/vendor/x11iraf/xpm/icons/NeXT.xpm @@ -0,0 +1,79 @@ +/* XPM2 C */ +static char * next[] = { +/* next pixmap + * width height ncolors chars_per_pixel */ +"64 64 8 1 ", +"0 c DimGrey m white s s_DimGrey ", +"+ c black m black s s_black ", +"- c black m black s s_black ", +". c black m black s s_black ", +"y c yellow m white s s_yellow ", +"g c green m white s s_green ", +"r c red m white s s_red ", +"o c orange m white s s_orange ", +/* pixels */ +"00000000000000000000000000000000000000000++000000000000000000000", +"000000000000000000000000000000000000000++++000000000000000000000", +"0000000000000000000000000000000000000+++++++00000000000000000000", +"00000000000000000000000000000000000+++++++++00000000000000000000", +"000000000000000000000000000000000++++++++++++0000000000000000000", +"0000000000000000000000000000000++++yyyyyy++++0000000000000000000", +"00000000000000000000000000000++++yyyyyyyyyy+++000000000000000000", +"000000000000000000000000000+++++yyyy++++yyyy++000000000000000000", +"0000000000000000000000000+++++++yy++++++++yy+++00000000000000000", +"00000000000000000000000++++++++yyy+++++++yyyy++00000000000000000", +"000000000000000000000+++ooo++++yy++++++yyyy+++++0000000000000000", +"0000000000000000000+++++ooo++++yy++++yyyy+++++++0000000000000000", +"00000000000000000++++++++ooo+++yy++yyyy++++yy++++000000000000000", +"000000000000000++++++++++ooo+++yyyyyy++++++yy++++000000000000000", +"0000000000000+++++++++++++ooo++yyyy+++++++yyy+++++00000000000000", +"00000000000+++++++++++++++ooo+++yy++++++++yy++++++00000000000000", +"00000000000++oo++++++++++++ooo++yyyy++++yyyy+++++++0000000000000", +"000000000000+oooooo++++++++ooo+++yyyyyyyyyy++++++++0000000000000", +"0000000000-0++ooooooooo+++++ooo++++yyyyyy++++++rr+++000000000000", +"0000000000-00+ooooooooooooo+ooo++++++++++++++rrrrr++000000000000", +"0000000000--0++ooo+ooooooooooooo+++++++++++rrrrrrr+++00000000000", +"000000000---00+ooo+++++ooooooooo+++++++++rrrrrrr+++++00000000000", +"000000000----0++ooo++++++++oooooo++++++rrrrrrr++++++++0000000000", +"000000000----00+ooo++++++++++++oo++++rrrrrrrrr++++++++0000000000", +"00000000------0++ooo+++++++++++++++++rrrrr+rrr+++++++++000000000", +"00000000------00+ooo++++++++++++++++++rr+++rrrr++++++++000000000", +"00000000-------0++ooo+++++++++++gg++++++++++rrr+++++++++00000000", +"0000000--------00+ooo+++++++++++ggg++++++++++rrr++++++++00000000", +"0000000---------0++ooo+++++++++ggg+++++++++++rrr+++++++++0000000", +"0000000---------00+ooo+++++++++ggg++++++++++++rrr++++++++0000000", +"000000-----------0+++++++++++++ggg++++++++++++rrr+++++++++000000", +"000000-----------00+++g+++++++ggg++++++++++++++rrr++++++++000000", +"0000000-----------0++ggggg++++ggg++++++++++++++rrr++++++00000000", +"0000000-----------00+gggggggg+ggg+++++++++++++++rrr+++000.000000", +"00000000-----------0+++ggggggggg++++++++++++++++r+++000...000000", +"00000000-----------00+++++ggggggggg+++++++++++++++000.....000000", +"000000000-----------0++++++++ggggggggg++++++++++000......0000000", +"000000000-----------00++++++ggg+gggggggg++++++000........0000000", +"0000000000-----------0++++++ggg++++ggggg++++000..........0000000", +"0000000000-----------00+++++ggg+++++++g+++000...........00000000", +"00000000000-----------0++++ggg++++++++++000.............00000000", +"00000000000-----------00+++ggg++++++++000...............00000000", +"000000000000-----------0+++ggg++++++000................000000000", +"000000000000-----------00+ggg+++++000..................000000000", +"0000000000000-----------0++gg+++000....................000000000", +"0000000000000-----------00++++000.....................0000000000", +"00000000000000-----------0++000.......................0000000000", +"00000000000000-----------0000.........................0000000000", +"000000000000000-----------0..........................00000000000", +"000000000000000-----------0........................0000000000000", +"0000000000000000---------00......................000000000000000", +"0000000000000000---------0.....................00000000000000000", +"00000000000000000--------0...................0000000000000000000", +"00000000000000000-------00.................000000000000000000000", +"000000000000000000------0................00000000000000000000000", +"000000000000000000------0..............0000000000000000000000000", +"0000000000000000000----00............000000000000000000000000000", +"0000000000000000000----0...........00000000000000000000000000000", +"00000000000000000000---0.........0000000000000000000000000000000", +"00000000000000000000--00.......000000000000000000000000000000000", +"000000000000000000000-0......00000000000000000000000000000000000", +"000000000000000000000-0....0000000000000000000000000000000000000", +"00000000000000000000000..000000000000000000000000000000000000000", +"0000000000000000000000000000000000000000000000000000000000000000" +} ; diff --git a/vendor/x11iraf/xpm/icons/Plaid.xpm b/vendor/x11iraf/xpm/icons/Plaid.xpm new file mode 100644 index 00000000..1ce89cf0 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/Plaid.xpm @@ -0,0 +1,33 @@ +/* XPM2 C */ +static char * plaid[] = { +/* plaid pixmap + * width height ncolors chars_per_pixel */ +"22 22 4 2 ", +" c red m white s s_red ", +"Y c yellow m black s s_yellow ", +"+ c yellow m white s s_yellow ", +"x c black m black s s_black ", +/* pixels */ +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +"Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x ", +"x x x x x x x x x x x x x x x x x x x x x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x " +} ; diff --git a/vendor/x11iraf/xpm/icons/arrdown.xpm b/vendor/x11iraf/xpm/icons/arrdown.xpm new file mode 100644 index 00000000..04a96a57 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/arrdown.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * arrdown[] = { +/* arrdown pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . ", +" . " +} ; diff --git a/vendor/x11iraf/xpm/icons/arrleft.xpm b/vendor/x11iraf/xpm/icons/arrleft.xpm new file mode 100644 index 00000000..fb8a575b --- /dev/null +++ b/vendor/x11iraf/xpm/icons/arrleft.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * arrleft[] = { +/* arrleft pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +". . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . ", +" . ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/arrne.xpm b/vendor/x11iraf/xpm/icons/arrne.xpm new file mode 100644 index 00000000..83a77a9c --- /dev/null +++ b/vendor/x11iraf/xpm/icons/arrne.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * arrne[] = { +/* arrne pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . ", +" . . . . . . . ", +" . . . . . . ", +" . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . ", +" . " +} ; diff --git a/vendor/x11iraf/xpm/icons/arrright.xpm b/vendor/x11iraf/xpm/icons/arrright.xpm new file mode 100644 index 00000000..ed372986 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/arrright.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * arrright[] = { +/* arrright pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . . ", +" . . ", +" . . ", +". . . . . . . . . . . . . . . . . . . . . . . . ", +". . ", +". . ", +". . ", +". . ", +". . . . ", +". . . . ", +". . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . ", +" . . . . ", +" . . . ", +" . ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/arrup.xpm b/vendor/x11iraf/xpm/icons/arrup.xpm new file mode 100644 index 00000000..62ad1268 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/arrup.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * arrup[] = { +/* arrup pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/bee.xpm b/vendor/x11iraf/xpm/icons/bee.xpm new file mode 100644 index 00000000..4aee9132 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/bee.xpm @@ -0,0 +1,50 @@ +/* XPM2 C */ +static char * bee[] = { +/* bee pixmap + * width height ncolors chars_per_pixel */ +"44 39 4 2 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000 s s_#000 ", +"X c #A8A8A8 s s_#A8A8A8 ", +"o c #545454 s s_#545454 ", +/* pixels */ +" . . . . . . ", +" . . . X . . . . X X . . . ", +" . . X X X . . X X X X X X X . . ", +" . . . X X X X X . . X X X X X X X X . . ", +" . . X X . X X . . X X X X X X X X X X . . ", +" . . X X . X X X . X X X X X X X X . X X X . . ", +" . . X X . X X . X X X X X X X . . X X X X . ", +" . . X X X . X . . X X X X X X . X X X X X X . ", +" . X X . X X . X X X X X X . X X X X X X X . . ", +" . . X X . X . . X X X X X X . X X X X X X X . ", +" . . X X . X X . X X X X X . . X X X X X X X . . ", +" . . . . X X . X . X X X X X . X X X X X X X X X . . ", +" . . X . X X . X X X . . X X X X X X X X X X . ", +". . . . . . X . X o X X X . X X X X X X X X X X X . ", +" . . . . . X X X o X . . X X X X X X X X X X . . . ", +" . . . . . . X X o o X X X X X X X X X X . . . ", +" . . . . . . X X o X X X X X X X . . . . . . ", +" . . . o . . . . . . . . o . ", +" . o . . . . . . o o o . . o . . o . ", +" . . o . . o o . . o o . . . . . ", +" . . X . . . . o . . o o o . . . . ", +" . . X . . o . o o . . o o o . . o . . . ", +" . . . o . o o o . . o o . . o o o . . . ", +". . . o . o o o . . . o . . o o o . . . ", +". . . o . o o o . o . o . . o o o . . . ", +" . . . o . o o o . o . o . . o o o . . . . ", +" . . . . . . . o . o o o . o . o . . o o o . . . . . ", +" . . . o . o o o o . o . o . . o o o . . . . ", +" . . . . . . . o . . o o o . o . o . . o o o . . . ", +" . . o . o o o o o . . . o . . o o o . . . ", +" . o o o o o o o o . . o o . . o o o . o ", +" . o o o o o o . . o o o . . o o . . . ", +" . o o o o . . . . o o o o . . . o . o o ", +" . . . . . . . . . o . . . . . o o ", +" . o o o . . . o o o . ", +" . . . . . ", +" . . . . . . ", +" . . . . . . . ", +" . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/block.xpm b/vendor/x11iraf/xpm/icons/block.xpm new file mode 100644 index 00000000..e08332b3 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/block.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * block[] = { +/* block pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . . . ", +" . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . ", +" . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/bomb.xpm b/vendor/x11iraf/xpm/icons/bomb.xpm new file mode 100644 index 00000000..68999d09 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/bomb.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * bomb[] = { +/* bomb pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 1 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"* c #F00 s s_#F00 ", +/* pixels */ +" * * * ", +" ", +" * * * ", +" * * ", +" * ** * ", +" * * ", +" * * ", +" * ", +" * ** ", +" .... ", +" .... ", +" .... ", +" ...... ", +" .......... ", +" ....... ... ", +" .......... .. ", +" ............ .. ", +" .............. .. ", +" ............... . ", +" ................. .. ", +" ................. .. ", +" .................... ", +" .................... ", +" .................... ", +" .................... ", +" ... .............. ", +" .................. ", +" .... ........... ", +" .............. ", +" ............ ", +" .......... ", +" ...... " +} ; diff --git a/vendor/x11iraf/xpm/icons/bull.xpm b/vendor/x11iraf/xpm/icons/bull.xpm new file mode 100644 index 00000000..6d6e784d --- /dev/null +++ b/vendor/x11iraf/xpm/icons/bull.xpm @@ -0,0 +1,31 @@ +/* XPM2 C */ +static char * bull[] = { +/* bull pixmap + * width height ncolors chars_per_pixel */ +"60 20 4 1 ", +" c white s s_white ", +"+ c DarkSlateBlue s s_DarkSlateBlue ", +"& c green s s_green ", +"= c black s s_black ", +/* pixels */ +"++++++++++++++++++++++++++++++++++++++++++++++&+&+++++++++++", +"+ +++++++++++++ + +++++++++++++++&+&+&++++++++++", +"+ ++++++++++++ + ++++++++++++++&+&+&+&&++++++++", +"++ ++ ++++++++++++++ +++ ++++++++++ +++++", +"++ +++ ++++++++++++++ +++ ++++++++++ ++&+&+&+&+&++ +++++", +"++ +++ ++++++++++++++ +++ ++++++++++ +&+&+&+&+&+&+ +++++", +"++ +++ ++++++++++++++ +++ ++++++++++ &+&+&+&+&+&+& +++++", +"++ ++ +++ +++ +++ +++++++++& +&+&+&+&+&+&+ &++++", +"++ +++ +++ +++ +++ ++++++++&+ &+&+&+&+&+&+& +&+++", +"++ +++ ++++ +++ +++ +++ +++++++++& +&+&+&&&+&+&+ &&+++", +"++ ++++ +++ +++ +++ +++ ++++++++++ &+&+&+&&+&&+& +&+++", +"++ ++++ +++ +++ +++ +++ ++++++++++ +&++&&&&&&+&+ &++++", +"++ ++++ +++ +++ +++ +++ ++++++++++ ++++++&&++&++ +++++", +"++ +++ +++ ++ +++ +++ ++++++++++ ++++++&&+++++ +++++", +"+ +++ +++ +++ ++++++++++ ++++&&&&&&+++ +++++", +"+ +++++ + + +++++++++ +++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"============================================================", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" +} ; diff --git a/vendor/x11iraf/xpm/icons/circles.xpm b/vendor/x11iraf/xpm/icons/circles.xpm new file mode 100644 index 00000000..a9eaac60 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/circles.xpm @@ -0,0 +1,73 @@ +/* XPM2 C */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 2 1 ", +" c #000000 s s_#000000 ", +". c #FF0000 s s_#FF0000 ", +/* pixels */ +" ", +" . .. .. .. .. ", +" . . ... ... . ", +" . . .. .. . ", +" . .. . . .. ", +" . . .. ........... .. . ", +" . . . .... .... . ", +" . . .. .. . ", +" . . ... ... . ", +" . . . . . ", +" . . .. ......... .. . ", +" . . . .... .... . . ", +" . . . .. . . . ", +" . . .. .. . . ", +" . . .. .. . . ", +" . . . . . . ", +" . . . ......... . . . ", +" . . ... ... . . . ", +" . . .. .. . . . ", +" . . .. .. . . ", +" . . . . . . ", +" . . . . . . ", +" . . . ....... . . . ", +" . . . ... ... . . . ", +" . . . .. .. . . . ", +" . . . . . . . . ", +" . . . . . . . ", +" . . . . . . . ", +" . . . ....... . . . . ", +" . . . .. .. . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . ..... . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" .. . . . . . . . . . ", +" . . .. . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . ..... . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . .. .. . . . . ", +" . . . . ....... . . . . ", +" . . . . . . . . ", +" . . . .. .. . . . . ", +" . . . ... ... . . . . ", +" . . . . ....... . . . . ", +" . . . .. .. . . . ", +" . . . .. .. . . . ", +" . . . ... ... . . . ", +" . . . .. ......... .. . . ", +" . . . .. .. . . ", +" . . . .. .. . . ", +" . . . .... .... . . ", +" . . . .. ......... .. . ", +" . . . . . . ", +" . . . ... ... . ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/city.xpm b/vendor/x11iraf/xpm/icons/city.xpm new file mode 100644 index 00000000..ad50ee5f --- /dev/null +++ b/vendor/x11iraf/xpm/icons/city.xpm @@ -0,0 +1,74 @@ +/* XPM2 C */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 3 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +"j c #e0e000 s s_#e0e000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . ", +" . ", +" ..... ... ", +" .j... ... ", +" ...j. ..... ", +" ..... ..... ", +" .j... .......... ", +" ...j. . . . . ", +" ..... . . . . .. ", +" ..j.. .......... .. ", +" ..... . .... . .. ", +" .j... . .... . .. ", +" ..... .... .......... ........... .. ", +" ...j. . . ..... .... .... . .j. . .. .. ", +" ..... .... .j. . .... .... ........... .. ", +" ..... . . .j. . .......... . ..j.. . .. ", +" . . .... ..... . ....... ........... .. ", +" ..... . . .j... . ....... . .j. .j. ....", +" ...j. .... .j... .... . . ........... . .", +" ..... .... ...j. .... . . . .j. . . ....", +" ..j.. .... ...j. .......... ........... . .", +" .......... . . ..... .......... .. .j.. . ....", +" ..... ... .... ..... .......... ........... ....", +" ....... . .... ...j. .......... .. .j. . ....", +" .j........ . . ...j. . .... . ........... . .", +" ..... ... ....... ..... . .... . . . . .. ....", +" ..j....... . . ...j.............. ........... .j..", +" ....... . ....... ...j........ . . . .j.. .j. ....", +" ...j. ... ......... ......j..... . . ........... ..j.", +" .......... . . .j. .j............ . .j..j. .. ....", +".. ...j... . ......... .j. ..... ....... .............. .", +".. ..... ... ......... ......j.. ..........j... .j. .....", +". ....... . .................j........................j.. .", +".. ...j...... . .....j.......... ...... .... ..j.....", +".. .j...................j...j.......... ................... .", +" . ....... .... .......j................j. ..j. .......", +".. ..... ....j...............j..j........ ..............j. ..", +"..... ....................j.....j......... ....j... .j..j....", +"..j...... ....................j...........................j. ..", +".....j..... .... .j.....j..j........ ...j.. ......j....", +" ..j..........j..........j...j...j......... ..........j..... .", +".....j... ...... .....j.................. .......j.....", +"..j........ .....................j.. ...................j.. .", +" ..... .......j.... ...j.....j... .........j..... ..j.....", +"...j.....................j................................j.. .", +"................................................................", +"................................................................", +"................................................................" +} ; diff --git a/vendor/x11iraf/xpm/icons/crab.xpm b/vendor/x11iraf/xpm/icons/crab.xpm new file mode 100644 index 00000000..814f5803 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/crab.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * crab[] = { +/* crab pixmap + * width height ncolors chars_per_pixel */ +"28 28 6 2 ", +". c SkyBlue m white s s_SkyBlue ", +"x c orange m black s s_orange ", +"* c #ff72c2 m black s s_#ff72c2 ", +"+ c SteelBlue m white s s_SteelBlue ", +"G c black m black s s_black ", +"a c LightGrey m white s s_LightGrey ", +/* pixels */ +". . . . . . * * * * . . . . . . . . . * * * * . . . . . ", +". . . . + * x x * . . . . . . . . . . + * x x * . . . . ", +". . . + * x x * . . . . . . . . . . . . + * x x * . . . ", +". . + * x * . . . * . . . . . . . . . * . . + * x * . . ", +". . + * x * . . + * . . . . . . . . + * . . + * x * . . ", +". . + * x * . + * * . . . . . . . . + * * . + * x * . . ", +". . + * x * + * * . . . . . . . . . . + * * + * x * . . ", +". . + * x * * * . . . . . . . . . . . . + * * x x * . . ", +". . . + * x * . . + * . . . . . . + * . . + * x * . . . ", +". . . + * x . . + * . + * * . * * . + * . . + x * . . . ", +". . . . + x . . + * . + * * . * * . + * . . + x . . . . ", +". . . . + x . . . + * + * * * * * + * . . . + x . . . . ", +". . . . + * x . . + * * * * * * * * * . . + x * . . . . ", +". . . . . + * x * * * * x x x x x * * * * x * . . . . . ", +". . . . + + + * * x x x x x x x x x x x x * . . . . . . ", +". . + + * x x x x x x x x x x x x x x x x x x * x . . . ", +". + * x x a + * * x x x x x x x x x x x * * a G * x * . ", +"+ * x . . . + * * x x x x x x x x x x x * * G . . . x * ", +". . . . . . + * * x x x x x x x x x x x * * . . . . . . ", +". . . . . + * * x x x x x x x x x x x x x * * . . . . . ", +". . . + * x x x * x x x x x x x x x x x * x x x * . . . ", +". . + * x a a + * * x x x x x x x x x * * a a a x * . . ", +". + * x G G G + * * x x x x x x x x x * * a G G G x * . ", +". + * G . . . + * x * x x x x x x x * x * a G . . . * . ", +". . . . . . + * x a * * * x x x * * * a x * G . . . . . ", +". . . . . + * x a G a a * * * * * a a G a x * G . . . . ", +". . . . . + x a G . G G a a a a a G G . G G x a G . . . ", +". . . . . + x a G . . . G G G G G . . . . . x a G . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/crab45.xpm b/vendor/x11iraf/xpm/icons/crab45.xpm new file mode 100644 index 00000000..59b2fb69 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/crab45.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * crab45[] = { +/* crab45 pixmap + * width height ncolors chars_per_pixel */ +"28 28 6 2 ", +". c SkyBlue s s_SkyBlue ", +"x c orange s s_orange ", +"* c #ff72c2 s s_#ff72c2 ", +"+ c SteelBlue s s_SteelBlue ", +"G c black s s_black ", +"a c LightGrey s s_LightGrey ", +/* pixels */ +". . . . . . . . . . * * * * * * * . . . . . . . . . . . ", +". . . . . . . . * x x x x x x x * . . . . . . . . . . . ", +". . . . . . . * * * * * * * x x * . . . . . . . . . . . ", +". . . . . . . . . . . . . * x x x * . . . . . . . . . . ", +". . . . . . . . . . * x x x x * x x . . . . . . . . . . ", +". . . . . . . . + + * * * * * * * x x . . . . . . . . . ", +". . . . . . . . . . . . . . . . . * x x . . . . . * . . ", +". . * . . . . . . . . . . . . . . . * x . . * * x x . . ", +". * * . . + . . . . . . + + x x + * * x * * x x x + . . ", +". x * . . + . . . . . . . . + x + * x x x x x + + . . . ", +"* x * . * * . . . . . . + . + x * * x x x * * . . . . . ", +"* x * . x * . . . . . + x + + x x x x x x * * . . * * * ", +"* x * . x * . . + . + x x x x x x x x x x * * * * x x x ", +"* x * * x * . . + . . + x x x x x x x x x * * x x x G G ", +"* x x x x * . . x + + + x x x x x x x x x x x * * G G . ", +"* x x x * * . . x x x x x x x x x x x x x x x * * G G . ", +"* * * x . * . . + + * x x x x x x x x x x x x * * G G . ", +". . . * . x * . * * * x x x x x x x x x x x x x * * * * ", +". . . . . x x * * x x x x x x x x x x x x x x * x x x x ", +". . . . . . x x x x x x x x x x x x x x x x * * G G G x ", +". . . . . . . . * x x x x x x x x x x x x x * * G G + . ", +". . . . . . . . * x * * * * x x x x x x x * * * G G . . ", +". . . . . . . * x x * * * * x x x x x * * * * * * G G . ", +". . . . . . . * x + . . * x * * * x * * * * * G G G G . ", +". . . . . . . x x + . . * x * * * * x G G G * G G G . . ", +". . . . . . * x + . . * x x G G G * x G G G G G . . . . ", +". . . . . . . . . . . * x G G G G * x G + . G G . . . . ", +". . . . . . . . . . . * x G . . . * x x . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/dos.xpm b/vendor/x11iraf/xpm/icons/dos.xpm new file mode 100644 index 00000000..ab578579 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/dos.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * dos[] = { +/* dos pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/doso.xpm b/vendor/x11iraf/xpm/icons/doso.xpm new file mode 100644 index 00000000..ebacf6ec --- /dev/null +++ b/vendor/x11iraf/xpm/icons/doso.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * doso[] = { +/* doso pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . ", +". . . ", +". . . ", +". . . ", +". . . ", +". . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/doss.xpm b/vendor/x11iraf/xpm/icons/doss.xpm new file mode 100644 index 00000000..aaa87aa4 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/doss.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * doss[] = { +/* doss pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" . ", +" . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . ", +" . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +" . . . ", +" . . . . ", +" . . . ", +" . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/editor.xpm b/vendor/x11iraf/xpm/icons/editor.xpm new file mode 100644 index 00000000..21967ac5 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/editor.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * editor[] = { +/* editor pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . ", +" . . . ", +" . . . . . . . ", +" . . . ", +" . . . . . . . ", +". . . . . . . ", +". . ", +". . . . . . ", +". . ", +". . ", +". . . . . . . . . . ", +". . ", +". . . . . . . . . . ", +". . ", +". . . . . . . . . . ", +". . ", +". . . . . . . . . . . . . ", +". . . . . ", +". . . . . . . . . . . ", +". . . . . ", +". . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . . ", +". . . . . ", +". . . . . . . . ", +". . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . ", +" . . . . ", +" . . . ", +" . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/escherknot.xpm b/vendor/x11iraf/xpm/icons/escherknot.xpm new file mode 100644 index 00000000..7e4c1068 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/escherknot.xpm @@ -0,0 +1,61 @@ +/* XPM2 C */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 52 2 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +/* pixels */ +" ", +" . . . ", +" . . . . ... ", +" . . . . . ", +" . . .. ", +" . . . . . . . .. ", +" . . .. . . . . . .. ", +" . . . . .. . .. . . . . . . .. ", +" . . . . . . . ... .... . . .. . ", +" . . . . .. . . . .. .. . ... .. ... ", +" . . . . . .. .. . . . ........ . . .. ", +" . . . . .... .... . .. . . . ...... . . . ", +" . . . . . ... ..... .. . ..... . . . .... ", +" . . ........... . .. . .. . .. . . . ", +" . . ... .................. . ... .. . . .. .. ", +" . .. .................. .. . . . .. . ... ", +" . .. .. ..................... .... .. . ..... ", +" . .. ........ . ....... . .. . .. . . . . . ", +" .. .. .. .. . . . ......... . .. .. . ..... ", +" . . ....... . ... .......... .. . . . . ", +" . ... . . .. . ... . ... .. . .. . . . ..... ", +" . . ....... . ..... .... ... . .. .. ", +" . ... . ... .. .. ... ..... . . ... .. ", +" . . ..... . . .. .... .... . . . .... ", +" . ... . .. . . .. .. .. . . .. .... ", +" .... ... . . . ..... . . . ..... ", +" . . .. . .. . . .. .. . . ... .. ", +" ...... . . . . . . . ... . .. .. .... ", +" . .. .. . . . . .. ... . . . . . .. ...... ", +" ...... ... . . . .. . .. . . . . ....... ", +" . .. . . . . . . . . . .. . .. . .... ..... ", +" ....... . . . . . ... ... . . . ... ..... ... ", +" .... .... .. . . . . . . ..... .......... ", +" ..... . .. .. . .. . . . .. . ....... ...... ", +" ........ . . . . .. . .............. .. ... ", +" ..... ..... . . . . . . ....... . ...... ", +" ....... .. . .. . . . ....... . . ..... ", +" ............ . ... . . ... . .. ... ", +" ....... . ... . . . . ....... ", +" ....... . . . . .. . . . . ... ", +" . .. .. .. .. . . ...... ", +" .. ..... . .. . . .. ... ", +" ... . .. . . . . . . ...... ", +" . ... ...... . .. ... .... ", +" ....... . . ... ... ..... ", +" ... ....... ... ....... ", +" ..... ............... ", +" ....... ........... ", +" ................ ", +" ............ ", +" . ..... ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye.xpm b/vendor/x11iraf/xpm/icons/eye.xpm new file mode 100644 index 00000000..f72a3553 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye[] = { +/* eye pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X X X X . . . ", +" . X X X X . . . . ", +" . X X . X X . ", +" . X X . X X . ", +" . X X . . . . . . . ", +" . X . X X X X X . . X . . ", +" . X X X X X X X X X X . X X . ", +" . . . . . . . . . . . . . X . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye1.xpm b/vendor/x11iraf/xpm/icons/eye1.xpm new file mode 100644 index 00000000..240973c6 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye1.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye1[] = { +/* eye1 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X X X X . . . ", +" . X X X X . . . . ", +" . X X . X X . . . . ", +" . X X . X X . . . X X X . ", +" . X X X . X X X X X X X . ", +" . X X X . X . . . X . . . ", +" . X X X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye10.xpm b/vendor/x11iraf/xpm/icons/eye10.xpm new file mode 100644 index 00000000..f995c5e2 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye10.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye10[] = { +/* eye10 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X . ", +" . . . . . . . X X X X . ", +" . X X X X X X . ", +" . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye11.xpm b/vendor/x11iraf/xpm/icons/eye11.xpm new file mode 100644 index 00000000..44edfc2b --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye11.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye11[] = { +/* eye11 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X . . . . X . . X X . ", +" . . X X X X . . . X X X X . ", +" . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye12.xpm b/vendor/x11iraf/xpm/icons/eye12.xpm new file mode 100644 index 00000000..94a8b215 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye12.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye12[] = { +/* eye12 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X X X . ", +" . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye13.xpm b/vendor/x11iraf/xpm/icons/eye13.xpm new file mode 100644 index 00000000..07ebe105 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye13.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye13[] = { +/* eye13 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X X X X X X X X . ", +" . . . . X X X X . ", +" . . . . X X . X X . ", +" . X X X . . . X X . X X . ", +" . X X X X X X X . X X X . ", +" . . . X . . . X . X X X . ", +" . X X X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye14.xpm b/vendor/x11iraf/xpm/icons/eye14.xpm new file mode 100644 index 00000000..28102ada --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye14.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye14[] = { +/* eye14 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X X X X X X X X . ", +" . . . . X X X X . ", +" . X X . X X . ", +" . . . X X . . X X . . ", +" . X X . . . X X . . X X X . ", +" . X X X X X . . . . X X X . ", +" . . X X X . . X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye15.xpm b/vendor/x11iraf/xpm/icons/eye15.xpm new file mode 100644 index 00000000..6c8a21ee --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye15.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye15[] = { +/* eye15 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X X X X . X X X . ", +" . . . . . . X X . ", +" . X X . . X X . ", +" X . . . X X X . ", +" . X X X X X X X . ", +" . . X . . . . . . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye16.xpm b/vendor/x11iraf/xpm/icons/eye16.xpm new file mode 100644 index 00000000..3252cee5 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye16.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye16[] = { +/* eye16 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X . X X X X X X . ", +" . . . X X X . . . ", +" . X X . X X . ", +" . . . X X X . X X . ", +" . X X X X X X X . X . ", +" . . . . . . . . . X . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye17.xpm b/vendor/x11iraf/xpm/icons/eye17.xpm new file mode 100644 index 00000000..0208cf66 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye17.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye17[] = { +/* eye17 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . o o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . o o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . o o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X . X X X X X X . ", +" . . . X X X . . . ", +" . . X X . X X . ", +" . X . . . X X . . X X . ", +" . X X X . . X X . X . X X . ", +" . X X X X X . X . . . X . ", +" . . X X . X X X X X X X . ", +" . . . X . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye18.xpm b/vendor/x11iraf/xpm/icons/eye18.xpm new file mode 100644 index 00000000..07786277 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye18.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye18[] = { +/* eye18 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X . X X X X X X . ", +" . . . X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . . X X . ", +" . . . . X X . X X X X . ", +" . X X X X X X X . . . . . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye19.xpm b/vendor/x11iraf/xpm/icons/eye19.xpm new file mode 100644 index 00000000..0a3e5840 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye19.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * eye19[] = { +/* eye19 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X X X . ", +" . X X X X . . X X X X X X . ", +" . X X X X X X . . . . . . . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye2.xpm b/vendor/x11iraf/xpm/icons/eye2.xpm new file mode 100644 index 00000000..f49c6c86 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye2.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye2[] = { +/* eye2 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o o . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X X X X . . . ", +" . X X X X . . . . ", +" . X X . X X . ", +" . . X X . . X X . . . ", +" . X X X . . X X . . . X X . ", +" . X X X . . . . X X X X X . ", +" . X X X X X . . X X X . . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye20.xpm b/vendor/x11iraf/xpm/icons/eye20.xpm new file mode 100644 index 00000000..63e9a3ee --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye20.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * eye20[] = { +/* eye20 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . . X X . . ", +" . X X . . X . X X . X . ", +" . X X X X . X . . X X . . ", +" . X X X X X X . . . . . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye21.xpm b/vendor/x11iraf/xpm/icons/eye21.xpm new file mode 100644 index 00000000..672764f6 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye21.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * eye21[] = { +/* eye21 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X . ", +" . . . . . . . X X X X . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye22.xpm b/vendor/x11iraf/xpm/icons/eye22.xpm new file mode 100644 index 00000000..1657d694 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye22.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * eye22[] = { +/* eye22 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X . ", +" . . . . . . . X X X X . ", +" . X X X X X X . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye23.xpm b/vendor/x11iraf/xpm/icons/eye23.xpm new file mode 100644 index 00000000..f0263edb --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye23.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * eye23[] = { +/* eye23 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . . X X . . . X X . ", +" . X . X X . X . . X X . ", +" . . X X . . . X X X X . ", +" . . . . . X X X X X X . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye24.xpm b/vendor/x11iraf/xpm/icons/eye24.xpm new file mode 100644 index 00000000..8db23d4e --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye24.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * eye24[] = { +/* eye24 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X . . X . ", +" . X X X X . . X . X X . X . ", +" . . . . . . . . . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye3.xpm b/vendor/x11iraf/xpm/icons/eye3.xpm new file mode 100644 index 00000000..729fbaf7 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye3.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye3[] = { +/* eye3 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X . X X X X X . . . ", +" . X X . . . . . . ", +" . X X . . X X . ", +" . X X X . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye4.xpm b/vendor/x11iraf/xpm/icons/eye4.xpm new file mode 100644 index 00000000..b2d7ed53 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye4.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye4[] = { +/* eye4 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X . X X . . . ", +" . . . X X X . . . ", +" . X X . X X . ", +" . X X . X X X . . . ", +" . X . X X X X X X X . ", +" . X . . . . . . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye5.xpm b/vendor/x11iraf/xpm/icons/eye5.xpm new file mode 100644 index 00000000..ea70295a --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye5.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye5[] = { +/* eye5 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X . X X . . . ", +" . . . X X X . . . ", +" . X X . X X . . ", +" . X X . . X X . . . X . ", +" . X X . X . X X . . X X X . ", +" . X . . . X . X X X X X . ", +" . X X X X X X X . X X . . ", +" . . . . . . . X . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye6.xpm b/vendor/x11iraf/xpm/icons/eye6.xpm new file mode 100644 index 00000000..7572b8e3 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye6.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye6[] = { +/* eye6 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X . X X . . . ", +" . . . X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . . X X . ", +" . X X X X . X X . . . . ", +" . . . . . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye7.xpm b/vendor/x11iraf/xpm/icons/eye7.xpm new file mode 100644 index 00000000..52287988 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye7.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye7[] = { +/* eye7 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X X X . ", +" . X X X X . . X X X X X X . ", +" . X X X X X X . . . . . . . ", +" . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye8.xpm b/vendor/x11iraf/xpm/icons/eye8.xpm new file mode 100644 index 00000000..9a09f0a7 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye8.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye8[] = { +/* eye8 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X X X . ", +" . X X . . X . . . . X . ", +" . X X X X . . . X X X X . . ", +" . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/eye9.xpm b/vendor/x11iraf/xpm/icons/eye9.xpm new file mode 100644 index 00000000..70416603 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/eye9.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * eye9[] = { +/* eye9 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X X X . ", +" . . . . . . . X X X X X X . ", +" . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/fil.xpm b/vendor/x11iraf/xpm/icons/fil.xpm new file mode 100644 index 00000000..dde88ed6 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/fil.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * fil[] = { +/* fil pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/fils.xpm b/vendor/x11iraf/xpm/icons/fils.xpm new file mode 100644 index 00000000..e36b6558 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/fils.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * fils[] = { +/* fils pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . ", +" . . . . . ", +" . . . . . ", +" . . . . . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/floppy.xpm b/vendor/x11iraf/xpm/icons/floppy.xpm new file mode 100644 index 00000000..a647e176 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/floppy.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * floppy[] = { +/* floppy pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . ", +". . . . ", +". . . . . . ", +". . . . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . . . . . . . . . . . . . . . . . . . ", +". . ", +". . ", +". . ", +". . ", +". . . . . . . . . . . . . . . . . . . ", +". . . . ", +". . . . . . . . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +" . . . . . . . . ", +" . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/jolifond.xpm b/vendor/x11iraf/xpm/icons/jolifond.xpm new file mode 100644 index 00000000..3dbad663 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/jolifond.xpm @@ -0,0 +1,58 @@ +/* XPM2 C */ +static char * jolifond[] = { +/* jolifond pixmap + * width height ncolors chars_per_pixel */ +"47 47 4 2 ", +" c #A800A800A800 s s_#A800A800A800 ", +". c #000 s s_#000 ", +"X c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +"o c #540054005400 s s_#540054005400 ", +/* pixels */ +" . . X X X . . ", +" . . X . . ", +" . o o o o X o . . . . . o o o o X o . ", +" . o o o o X o . . . o o o o X o . ", +" . o o o o o o o o o . . . X . . . o o o o o o o o o . ", +" . o o o o o o o o o . . X X . X X . . o o o o o o o o o . ", +" o o X o o o o o o o X o o . . . X . X . . . o o X o o o o o o o X o o ", +" o o o o o X o o o o o X o o o o o . X . X . o o o o o X o o o o o X o o o o o ", +" o o o o X o o o X o o o o . . X . . o o o o X o o o X o o o o ", +" o o o o o o o X o o o o o o o o . . X . . o o o o o o o o X o o o o o o o ", +" o o . . X . . o o ", +" o o o o o o o o o o . . . o o o o o o o o o o ", +" o o o o X o o o o o . . . X o o o o o X o o o o ", +" o o o o o X o o o o o o . . . . . . . X X o o o o o o X o o o o o ", +" o o X o o o o o o . . . . . . . X X o o o o o o X o o ", +" . o o o o . . . . . . X . o o o o . ", +" . o o o o . . . . . o o o o . ", +" . o . . . . X . o o o X . o o o X . . . . o . . ", +" . o . o o o o o X o o o o o o . . ", +" . . . o o o X o o o o o X o o o . . . ", +". . . . . . o o X X X o o o X X X o o . . . . . . ", +". . X . . . . . . o o o X o o o o o X o o o . . . . . . X . . ", +"X . . X X X . . . . . o o o o o X o o o o o . . . . . X X X . . ", +"X X . . X . . . X X X . . . . . . . X o o o X . X o o o X . . . . . . . X X X . . . X . . ", +"X . . X X X . . . . . o o o o o X o o o o o . . . . . X X X . . ", +". . X . . . . . . o o o X o o o o o X o o o . . . . . . X . . ", +". . . . . . o o X X X o o o X X X o o . . . . . . ", +" . . . o o o X o o o o o X o o o . . . ", +" . o . o o o o o X o o o o o o . . ", +" . o . . . . X . o o o X . o o o X . . . . o . . ", +" . o o o o . . . . . o o o o . ", +" . o o o o . . . . . . . o o o o . ", +" o o X o o o o o o . . . . . . . o o o o o o X o o ", +" o o o o o X o o o o o o . . . . . . . o o o o o o X o o o o o ", +" o o o o X o o o o o . . . o o o o o X o o o o ", +" o o o o o o o o o o . . . o o o o o o o o o o ", +" o o . . X . . o o ", +" o o o o o o o X o o o o o o o o . . X . . o o o o o o o o X o o o o o o o ", +" o o o o X o o o X o o o o . . X . . o o o o X o o o o o o o o ", +" o o o o o X o o o o o X o o o o o . X . X . o o o o o X o o o o o X o o o o o ", +" o o X o o o o o o o X o o . . . X . X . . . o o X o o o o o o o X o o ", +" . o o o o o o o o o . . X X . X X . . o o o o o o o o o . ", +" . o o o o o o o o o . . . X . . . o o o o o o o o o . ", +" . o o o o X . . . . o o o o o . ", +" . o o o o X . . . . . . o o o o o . ", +" . . . . ", +" . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/koala.xpm b/vendor/x11iraf/xpm/icons/koala.xpm new file mode 100644 index 00000000..176f46af --- /dev/null +++ b/vendor/x11iraf/xpm/icons/koala.xpm @@ -0,0 +1,51 @@ +/* XPM2 C */ +static char * [] = { +/* pixmap + * width height ncolors chars_per_pixel */ +"38 38 6 2 ", +" c LightGrey s s_LightGrey ", +"* c black s s_black ", +"o c DarkSlateGrey s s_DarkSlateGrey ", +"X c brown s s_brown ", +". c tan s s_tan ", +"x c wheat s s_wheat ", +/* pixels */ +" ", +" * * * * ", +" * * ", +" * * * * * * * * * * * * * * * * * * ", +" * * * * * * * * * * * * * * * * * * * * * * * * ", +" * * * * . . . . . . . * * * * * * . . . . . . . * * * * ", +" * * * . . . x x x x x . . * * * * . . x x x x x . . . * * * ", +" * * . . x x x x x x x x . * * * * * * * * . x x x x x x x x . . * * ", +" * * . x x x x x x x x x . . * * * * * * . . x x x x x x x x x . * * ", +" * * . x x x x x x x x . . . . . . . . . . . . x x x x x x x x . * * ", +" * * . x x x x x x x . . . . . . . . . . . . . . x x x x x x x . * * ", +" * * . x x x x x x . . . . . . . . . . . . . . . . x x x x x x . * * ", +" * * . x x x x x . . . . . . . . . . . . . . . . . . x x x x x . * * ", +" * * . . x x x . . . . . . . . . . . . . . . . . . . . x x x . . * * ", +" * * * . . . x . . . o o o . . . X X . . . o o o . . . x . . . * * * ", +" * * * * . . . . o o o o o . X X X X . o o o o o . . . . * * * * ", +" * * * * . . o o o o o . X X X X . o o o o o . . * * * * ", +" * * * * . . o o o . . X X X X . . o o o . . * * * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . . X X . . . . . . . . * * ", +" * * * . . . . . . . . . . . . . . . . * * * ", +" * * * * . . . . . . . . . . . . * * * * ", +" * * * * * * * * * * * * * * * * * * ", +" * * * * * * * * * * * * * * ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" * * ", +" * * * * ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/lambda.xpm b/vendor/x11iraf/xpm/icons/lambda.xpm new file mode 100644 index 00000000..4c335031 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/lambda.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * lambda[] = { +/* lambda pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #FFFF00000000 s s_#FFFF00000000 ", +"X c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . X . . . . . . . . ", +". . . . X X X X X X X X . . . . . X X X . . . . ", +". . . X X X X X X X . . . . . X X X X . . . ", +". . . X . . . . . . . . ", +". . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . X . . . . . . . . ", +". . . X X X . . . . . X X X X X X X X X . . . ", +". . . . X X X . . . . . X X X X X X X X X X . . . . ", +" . . . X . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/martini.xpm b/vendor/x11iraf/xpm/icons/martini.xpm new file mode 100644 index 00000000..0515bbb6 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/martini.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * martini[] = { +/* martini pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #7F7FFFFFFFFF s s_#7F7FFFFFFFFF ", +"o c #FFFF00000000 s s_#FFFF00000000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . . . . . . . . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . X X X X X X X X X . X X X X . ", +" . X X X X X X o o o X X X . ", +" . X X X X o o o o o X . ", +" . X X X o o o o o . ", +" . X X o o o o . ", +" . X X o o . ", +" . X X . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . ", +" . . . . ", +" . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/mickey.xpm b/vendor/x11iraf/xpm/icons/mickey.xpm new file mode 100644 index 00000000..e481f07b --- /dev/null +++ b/vendor/x11iraf/xpm/icons/mickey.xpm @@ -0,0 +1,73 @@ +/* XPM2 C */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 2 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +/* pixels */ +" ....... ", +" ............. ", +" ............... ", +" ................ ", +" ................... ", +" ................... ", +" ..................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ..................... ", +" .................... ", +" .................... ", +" .................. ", +" ................. ", +" ............... ", +" ................. ", +" .................... ", +" ....... .................... .... ", +" ........... .................... ...... ", +" .............. ...................... ....... ", +" ............... ........ ....... ... ........ ", +" .................. ....... .... ... ........ ", +" .................. ...... .. .. ........ ", +" ......................... ... .. .. ........ ", +" ......................... .. . .. .. ........ ", +" ......................... . .... ........... ", +" ......................... . ...... . ...... ", +" ........................ . .... ....... .... ", +" ........................ . ...... . .... . ", +" ........................ ....... . . . ", +" ........................ ...... . . . . ", +" ......................... . ... . . . . ", +" ........................ . . .. . ", +" ........................ . . .. . ", +" ......................... . . . . . ", +" ............... ......... . . . . ", +" ............. .......... .... . . ", +" .......... ............ . . ", +" ....... .............. .. . ", +" ................ .. ", +" ........... . ", +" ......... ... .. ", +" ........ .. .. ", +" ....... .... .. ", +" ...... . ... .... ", +" .... . ............. . ", +" .... . ........... . ", +" .. .......... . ", +" .. ......... . ", +" . ....... .. ", +" ... ..... .. ", +" ..... . .. ", +" ..... . .. ", +" ......... ", +" ", +" ", +" ", +" ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/mouse.xpm b/vendor/x11iraf/xpm/icons/mouse.xpm new file mode 100644 index 00000000..6e5006c1 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/mouse.xpm @@ -0,0 +1,61 @@ +/* XPM2 C */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 52 2 1 ", +" c #000000 s s_#000000 ", +". c #00FF00 s s_#00FF00 ", +/* pixels */ +" ", +" ", +" ", +" .... ... ", +" . .. . ", +" . .. . ", +" .......... . . ", +" . ...... ...... . ", +" . ... .... . ..... ", +" .... ... .... ", +" ... .......... ... ... ", +" ...... ...... .. ... .... ", +" .............. .......... ... ... ... ", +" ....... ........ ... ... ........ . .... ", +" .. ... .. ... . ... ", +" ..... .. .. ... ", +" .... . .. ....... ", +" ..... . .. . . .. .... . . ", +" .... .. . .. .... .. . ", +" . .. ........ . . . ", +" .. .. . . .... ", +" ..... ... ... .. .. ", +" ..... ......... .. . .. . ", +" ..... ... .... ", +" ", +" ", +" ", +" ", +" ", +" .... ... ", +" . .. . ", +" . .. . ", +" .......... . . ", +" . ...... ...... . ", +" . ... .... . ..... ", +" .... ... .... ", +" ... .......... ... ... ", +" ...... ...... .. ... .... ", +" .............. .......... ... ... ... ", +" ....... ........ ... ... ........ . .... ", +" .. ... .. ... . ... ", +" ..... .. .. ... ", +" .... . .. ....... ", +" ..... . .. . . .. .... . . ", +" .... .. . .. .... .. . ", +" . .. ........ . . . ", +" .. .. . . .... ", +" ..... ... ... .. .. ", +" ..... ......... .. . .. . ", +" ..... ... .... ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/nobozos.xpm b/vendor/x11iraf/xpm/icons/nobozos.xpm new file mode 100644 index 00000000..df335406 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/nobozos.xpm @@ -0,0 +1,73 @@ +/* XPM2 C */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 2 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +/* pixels */ +" ", +" ........... ", +" ................... ", +" ......................... ", +" ............................. ", +" ................................. ", +" ................................... ", +" ....................................... ", +" ......................................... ", +" ................. ................. ", +" .............. .............. ", +" ............. ............. ", +" ............ ............ ", +" .............. ............ ", +" ............... .......... ", +" ................. .......... ", +" .......... ...... ......... ", +" ...... . ...... . . ..... ", +" ....... . .. ... .. . ...... ", +" ..... .... . . . ... . . . .... .... ", +" ..... .. . .... .. .... .. .... . .. .... ", +" ..... . . .. . ... . .... . ... . .. . . .... ", +" ... .. .. .. ..... .... ..... .. .. .. .. ", +" .... .. ... . ..... .. .. .. ..... . ... .. ... ", +" .... . ... ... . ... .. ..... . ... . ... ... . ... ", +" ... ... ........ ...... .. .. . ..... ........ ... .. ", +" ... .. ....... ..... . ... .. . . ..... ....... .. .. ", +" .... . . ... ... ... .... ..... ... ... ... . . ...", +" ..... .. .... ... ..... . .... ... .... .. ....", +" ..... .. ....... ..... . .. ..... ....... .. ....", +" ..... . . ... ... . .. .... .... ... . ... ... . . ....", +" ...... ... ........ . .. .. .. .. .. ........ ... .....", +" ...... .. ..... . ..... . . . . ...... . ..... .. .....", +" ...... . . .... ... . .. . . .. . .. . .... . . .....", +" ....... .. . . ... . .. ... .. . .. . . . .. ......", +" ........ . . . . ..... . . . . ........", +" ........ . ............. . ........", +" ........ . ....... . . .........", +" ........ . ....... . .. ........ ", +" ........ . ..... . ... ........ ", +" ........ . .. ... .. . .... ........ ", +" ......... . .... .... . ..... ......... ", +" ........ . .. .. .. .. . ....... ........ ", +" ......... . .. ..... .. . ........ ......... ", +" ......... . .. .. . ......... ......... ", +" ......... . ......... . ................... ", +" .......... .. .. .................... ", +" ......... .. .. ................... ", +" .......... .. .. .................... ", +" .......... ..... ................. ", +" .......... ............... ", +" ............ .............. ", +" ............ ............ ", +" ............. ............. ", +" .............. .............. ", +" ................. ................. ", +" ......................................... ", +" ....................................... ", +" ................................... ", +" ................................. ", +" ............................. ", +" ......................... ", +" ................... ", +" ........... " +} ; diff --git a/vendor/x11iraf/xpm/icons/nose.xpm b/vendor/x11iraf/xpm/icons/nose.xpm new file mode 100644 index 00000000..60340ced --- /dev/null +++ b/vendor/x11iraf/xpm/icons/nose.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * nose[] = { +/* nose pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . ", +" . X X X X X . ", +" . X X X X X X X . ", +" . X X X X X X X X . ", +" . X X X X X X . . . . . . ", +" . X X X X X . . . ", +" . X X X X . . o o o o o . . ", +" . X X X X . o o o X . ", +" . X X X X . o o o X X . ", +" . X X X X X . o X X X X . ", +" . X X X X X X . . . X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X X . . X X X X X X X X X X X X X . ", +" . X . X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X . . . X X X X X X X X X . ", +" . . . . X . . . X X X X X . . ", +" . X X . X X . . . . . ", +" . X X . X X . ", +" . X X . X X . ", +" . X X X . . . . . . . ", +" . X X X . X X X X X . . X . . ", +" . X X X X X X X X X X X X . X X . ", +" . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/noseback.xpm b/vendor/x11iraf/xpm/icons/noseback.xpm new file mode 100644 index 00000000..9c481602 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/noseback.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * noseback[] = { +/* noseback pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . ", +" . X X X X X X . ", +" . X X X X X X X X . ", +" . X X X X X X X X . ", +" . . X X X X X X X X . . ", +" . o . X X X X X X X X . o . ", +" . o . X X X X X X X X X X . o . ", +" . o . X X X X X X X X X X . o . ", +" . . X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . . . . . . . X X . . . . X X . . . . . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . . . . X X . . X X . . . . ", +" . . X X . X X X X . . X X X X . X X . . ", +" . X X X X X X X X X X . . X X X X X X X X X X . ", +" . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/nosefront.xpm b/vendor/x11iraf/xpm/icons/nosefront.xpm new file mode 100644 index 00000000..9b8088de --- /dev/null +++ b/vendor/x11iraf/xpm/icons/nosefront.xpm @@ -0,0 +1,43 @@ +/* XPM2 C */ +static char * nosefront[] = { +/* nosefront pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . ", +" . X X X X X X . ", +" . X X X X X X X X . ", +" . X X X X X X X X . ", +" . . . X X X X X X . . . ", +" . . X X X X . . ", +" . . . . . . . X X . . . . . . . ", +" . o o . X X . o o . ", +" . o o . X X . o o . ", +" . . X X X X . . ", +" . X . . . X X X X X X . . . . ", +" . X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X . X X X X X X X X X X X X . X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X . X X X X X X X X X X X X X X . X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X X X X X X X X X X X X X X X X . X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X . X X X X X X X X X X X X X X X X X X . ", +" . X X X X . X X X X X X X X X X X X . X X X X . ", +" . . . . . . X X X X X X X X . . . . . . ", +" . X . . . . . . . . X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . . . . X X . . X X . . . . ", +" . . X X X X . X X . . X X . X X X X . . ", +" . X X X X X X X X X X . . X X X X X X X X X X . ", +" . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/nosmoking.xpm b/vendor/x11iraf/xpm/icons/nosmoking.xpm new file mode 100644 index 00000000..b9646537 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/nosmoking.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * nosmoking[] = { +/* nosmoking pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #FFFF00000000 s s_#FFFF00000000 ", +"X c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . X . . . . ", +" . . . . X X . . . . . . ", +" . . . . X . . . . . . . . ", +" . . . X . . . . . . . . ", +" . . . . X X . . . . . . . . . ", +" . . . X X X . . . . . . . . ", +" . . . X X . . . . . . . . ", +". . . . X X . . . . . . . . . ", +". . . . . . . . . . . ", +". . . X X X X X X X X X X X X X X X X X X . . . ", +". . . X X X . . . . . X . . . ", +". . . X X X . . . . . X . . . ", +". . . X X X . . . . . X . . . ", +". . . X X X X X X X X X X X X X X X X X X . . . ", +". . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/porsche.xpm b/vendor/x11iraf/xpm/icons/porsche.xpm new file mode 100644 index 00000000..7804ea4d --- /dev/null +++ b/vendor/x11iraf/xpm/icons/porsche.xpm @@ -0,0 +1,75 @@ +/* XPM2 C */ +static char * porsche[] = { +/* porsche pixmap + * width height ncolors chars_per_pixel */ +"64 64 4 1 ", +" c slateblue s s_slateblue ", +". c yellow s s_yellow ", +"r c red s s_red ", +"b c black s s_black ", +/* pixels */ +" ", +" ", +" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb............................................bb ", +" bb..bbbb..bbbb..bbbb..bbbb..bbbb..b..b..bbbb..bb ", +" bb..b..b..b..b..b..b..b..b..b..b..b..b..b.....bb ", +" bb..b..b..b..b..b..b..b.....b.....b..b..b.....bb ", +" bb..bbbb..b..b..bbb...bbbb..b.....bbbb..bbbb..bb ", +" bb..b.....b..b..b..b.....b..b.....b..b..b.....bb ", +" bb..b.....b..b..b..b..b..b..b..b..b..b..b.....bb ", +" bb..b.....bbbb..b..b..bbbb..bbbb..b..b..bbbb..bb ", +" bb............................................bb ", +" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb.....................bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb......b...b...bb.....bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb.....b...b...b....b..bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb....bb..bb.bbbbbbb...bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb...bbbbbbbb......bb..bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb..bbbb...............bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb.bbb.................bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb..........b..b.......bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb.....b...b..b........bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb....b...b..b..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb....b.bbbbbbbbb..............bbbbbbbbbbbbbbbbb ", +" bb...bbbb.......bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb..bbb.........b..............bbbbbbbbbbbbbbbbb ", +" bb.bbb..........b...bbb........bbbbbbbbbbbbbbbbb ", +" bb.........b..b.b..bbbbb.......bbbbbbbbbbbbbbbbb ", +" bb.....b..b..b..b..b.bbb.....b.brrrrrrrrrrrrrrbb ", +" bb....b..b..b..bb....bbb....bb.brrrrrrrrrrrrrrbb ", +" bb...bb.bbbbbbb.b....bbb....bb.brrrrrrrrrrrrrrbb ", +" bb..bbbbb......bb...bbbbb...b..brrrrrrrrrrrrrrbb ", +" bb.bbb..........b.bbbbbbbbbbb..brrrrrrrrrrrrrrbb ", +" bb..............b.b.bbbbbbbbb..brrrrrrrrrrrrrrbb ", +" bbbbbbbbbbbbbbbbb.b.b....bbbb..bbbbbbbbbbbbbbbbb ", +" bbbbbbbbbbbbbbbbb...b.....b.b..b..............bb ", +" bbbbbbbbbbbbbbbbb........bb.bb.b...b..b.......bb ", +" bbbbbbbbbbbbbbbb........b..b..b..b..b...b...bb ", +" bbbbbbbbbbbbbbbb.......b..b...b.b..b...b....bb ", +" bbbbbbbbbbbbbbbbb............b.bbbbbbbbbb...bb ", +" bbrrrrrrrrrrrrrrb..........bbbb........bb.bb ", +" bbrrrrrrrrrrrrrrrb........bbbb............bb ", +" bbrrrrrrrrrrrrrrrbbbbbbbb.......b..b....bb ", +" bbrrrrrrrrrrrrrrrrrrbb.....b...b..b..b..bb ", +" bbrrrrrrrrrrrrrrrrrbb....b...b..b..b..bb ", +" bbrrrrrrrrrrrrrrrrrbb...bb.bbbbbbbb...bb ", +" bbbbbbbbbbbbbbbbbbbb...bbbb......bb.bb ", +" bbbbbbbbbbbbbbbbbbb..bbb...........b ", +" bbbbbbbbbbbbbbbbbbb.bbb...........bb ", +" bbbbbbbbbbbbbbbbbb..............bb ", +" bbbbbbbbbbbbbbbbb...b.b.b.....bb ", +" bbbbbbbbbbbbbbbb..b.b.b..b..bb ", +" bbrrrrrrrrrrrbb..bbbbbbb..bb ", +" bbrrrrrrrrrrbb.bbb....b.bb ", +" bbrrrrrrrrrbb.bb......bb ", +" bbbrrrrrrrbb.......bbb ", +" bbbbrrrrrbb.....bbbb ", +" bbbbrrrbb...bbbb ", +" bbbbrbb.bbbb ", +" bbbbbbbb ", +" bbbb ", +" bb ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/stopsign.xpm b/vendor/x11iraf/xpm/icons/stopsign.xpm new file mode 100644 index 00000000..1f390401 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/stopsign.xpm @@ -0,0 +1,42 @@ +/* XPM2 C */ +static char * stopsign[] = { +/* stopsign pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 1 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FF0000 s s_#FF0000 ", +/* pixels */ +" ............ ", +" . . ", +" . XXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXXXXXX . ", +". XXX XX XX XX XXXX .", +". XX XXX XXX XXX XXX X XXX XXX .", +". XX XXXXXXX XXX XXX X XXX XXX .", +". XX XXXXXXX XXX XXX X XXX XXX .", +". XXX XXXXXX XXX XXX X XXX XXX .", +". XXXX XXXXX XXX XXX X XXXX .", +". XXXXX XXXX XXX XXX X XXXXXXX .", +". XXXXXX XXX XXX XXX X XXXXXXX .", +". XXXXXX XXX XXX XXX X XXXXXXX .", +". XXXXXX XXX XXX XXX X XXXXXXX .", +". XX XXX XXX XXX XXX X XXXXXXX .", +". XXX XXXX XXXX XX XXXXXXX .", +" . XXXXXXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXX . ", +" . . ", +" ............ " +} ; diff --git a/vendor/x11iraf/xpm/icons/umbrella.xpm b/vendor/x11iraf/xpm/icons/umbrella.xpm new file mode 100644 index 00000000..a04fc4b9 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/umbrella.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * umbrella[] = { +/* umbrella pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . ", +" . ", +" . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . . . ", +" . . . . ", +" . . . . . . ", +" . . . . . . . ", +" . . . . . . . ", +" . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/wingdogs.xpm b/vendor/x11iraf/xpm/icons/wingdogs.xpm new file mode 100644 index 00000000..d6e2aa53 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/wingdogs.xpm @@ -0,0 +1,41 @@ +/* XPM2 C */ +static char * wingdogs[] = { +/* wingdogs pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . ", +" . . ", +" . . . ", +" . . . . . ", +" . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . ", +". . . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . . . . . . . ", +". . . . . . . . . ", +". . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/NeXT.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/NeXT.xpm new file mode 100644 index 00000000..3ea740bc --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/NeXT.xpm @@ -0,0 +1,79 @@ +/* XPM */ +static char * next[] = { +/* next pixmap + * width height ncolors chars_per_pixel */ +"64 64 8 1 ", +"0 c DimGrey m white s s_DimGrey ", +"+ c black m black s s_black ", +"- c black m black s s_black ", +". c black m black s s_black ", +"y c yellow m white s s_yellow ", +"g c green m white s s_green ", +"r c red m white s s_red ", +"o c orange m white s s_orange ", +/* pixels */ +"00000000000000000000000000000000000000000++000000000000000000000", +"000000000000000000000000000000000000000++++000000000000000000000", +"0000000000000000000000000000000000000+++++++00000000000000000000", +"00000000000000000000000000000000000+++++++++00000000000000000000", +"000000000000000000000000000000000++++++++++++0000000000000000000", +"0000000000000000000000000000000++++yyyyyy++++0000000000000000000", +"00000000000000000000000000000++++yyyyyyyyyy+++000000000000000000", +"000000000000000000000000000+++++yyyy++++yyyy++000000000000000000", +"0000000000000000000000000+++++++yy++++++++yy+++00000000000000000", +"00000000000000000000000++++++++yyy+++++++yyyy++00000000000000000", +"000000000000000000000+++ooo++++yy++++++yyyy+++++0000000000000000", +"0000000000000000000+++++ooo++++yy++++yyyy+++++++0000000000000000", +"00000000000000000++++++++ooo+++yy++yyyy++++yy++++000000000000000", +"000000000000000++++++++++ooo+++yyyyyy++++++yy++++000000000000000", +"0000000000000+++++++++++++ooo++yyyy+++++++yyy+++++00000000000000", +"00000000000+++++++++++++++ooo+++yy++++++++yy++++++00000000000000", +"00000000000++oo++++++++++++ooo++yyyy++++yyyy+++++++0000000000000", +"000000000000+oooooo++++++++ooo+++yyyyyyyyyy++++++++0000000000000", +"0000000000-0++ooooooooo+++++ooo++++yyyyyy++++++rr+++000000000000", +"0000000000-00+ooooooooooooo+ooo++++++++++++++rrrrr++000000000000", +"0000000000--0++ooo+ooooooooooooo+++++++++++rrrrrrr+++00000000000", +"000000000---00+ooo+++++ooooooooo+++++++++rrrrrrr+++++00000000000", +"000000000----0++ooo++++++++oooooo++++++rrrrrrr++++++++0000000000", +"000000000----00+ooo++++++++++++oo++++rrrrrrrrr++++++++0000000000", +"00000000------0++ooo+++++++++++++++++rrrrr+rrr+++++++++000000000", +"00000000------00+ooo++++++++++++++++++rr+++rrrr++++++++000000000", +"00000000-------0++ooo+++++++++++gg++++++++++rrr+++++++++00000000", +"0000000--------00+ooo+++++++++++ggg++++++++++rrr++++++++00000000", +"0000000---------0++ooo+++++++++ggg+++++++++++rrr+++++++++0000000", +"0000000---------00+ooo+++++++++ggg++++++++++++rrr++++++++0000000", +"000000-----------0+++++++++++++ggg++++++++++++rrr+++++++++000000", +"000000-----------00+++g+++++++ggg++++++++++++++rrr++++++++000000", +"0000000-----------0++ggggg++++ggg++++++++++++++rrr++++++00000000", +"0000000-----------00+gggggggg+ggg+++++++++++++++rrr+++000.000000", +"00000000-----------0+++ggggggggg++++++++++++++++r+++000...000000", +"00000000-----------00+++++ggggggggg+++++++++++++++000.....000000", +"000000000-----------0++++++++ggggggggg++++++++++000......0000000", +"000000000-----------00++++++ggg+gggggggg++++++000........0000000", +"0000000000-----------0++++++ggg++++ggggg++++000..........0000000", +"0000000000-----------00+++++ggg+++++++g+++000...........00000000", +"00000000000-----------0++++ggg++++++++++000.............00000000", +"00000000000-----------00+++ggg++++++++000...............00000000", +"000000000000-----------0+++ggg++++++000................000000000", +"000000000000-----------00+ggg+++++000..................000000000", +"0000000000000-----------0++gg+++000....................000000000", +"0000000000000-----------00++++000.....................0000000000", +"00000000000000-----------0++000.......................0000000000", +"00000000000000-----------0000.........................0000000000", +"000000000000000-----------0..........................00000000000", +"000000000000000-----------0........................0000000000000", +"0000000000000000---------00......................000000000000000", +"0000000000000000---------0.....................00000000000000000", +"00000000000000000--------0...................0000000000000000000", +"00000000000000000-------00.................000000000000000000000", +"000000000000000000------0................00000000000000000000000", +"000000000000000000------0..............0000000000000000000000000", +"0000000000000000000----00............000000000000000000000000000", +"0000000000000000000----0...........00000000000000000000000000000", +"00000000000000000000---0.........0000000000000000000000000000000", +"00000000000000000000--00.......000000000000000000000000000000000", +"000000000000000000000-0......00000000000000000000000000000000000", +"000000000000000000000-0....0000000000000000000000000000000000000", +"00000000000000000000000..000000000000000000000000000000000000000", +"0000000000000000000000000000000000000000000000000000000000000000" +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/Plaid.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/Plaid.xpm new file mode 100644 index 00000000..eb88b5ca --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/Plaid.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static char * plaid[] = { +/* plaid pixmap + * width height ncolors chars_per_pixel */ +"22 22 4 2 ", +" c red m white s s_red ", +"Y c yellow m black s s_yellow ", +"+ c yellow m white s s_yellow ", +"x c black m black s s_black ", +/* pixels */ +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +"Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x x x x x x x x x x x x x ", +"x x x x x x x x x x x x + x x x x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x ", +"x x x x x x x x x x x x x x x x x x x x x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x ", +" x x x Y x x ", +" x x x x Y x x x " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/arrdown.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/arrdown.xpm new file mode 100644 index 00000000..764dc72e --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/arrdown.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * arrdown[] = { +/* arrdown pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . ", +" . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/arrleft.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/arrleft.xpm new file mode 100644 index 00000000..b3f40742 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/arrleft.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * arrleft[] = { +/* arrleft pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +". . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . ", +" . ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/arrne.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/arrne.xpm new file mode 100644 index 00000000..ee4b5dce --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/arrne.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * arrne[] = { +/* arrne pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . ", +" . . . . . . . ", +" . . . . . . ", +" . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . ", +" . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/arrright.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/arrright.xpm new file mode 100644 index 00000000..701c83e0 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/arrright.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * arrright[] = { +/* arrright pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . . ", +" . . ", +" . . ", +". . . . . . . . . . . . . . . . . . . . . . . . ", +". . ", +". . ", +". . ", +". . ", +". . . . ", +". . . . ", +". . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . ", +" . . . . ", +" . . . ", +" . ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/arrup.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/arrup.xpm new file mode 100644 index 00000000..e657dee1 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/arrup.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * arrup[] = { +/* arrup pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/bee.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/bee.xpm new file mode 100644 index 00000000..dd1f8771 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/bee.xpm @@ -0,0 +1,50 @@ +/* XPM */ +static char * bee[] = { +/* bee pixmap + * width height ncolors chars_per_pixel */ +"44 39 4 2 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000 s s_#000 ", +"X c #A8A8A8 s s_#A8A8A8 ", +"o c #545454 s s_#545454 ", +/* pixels */ +" . . . . . . ", +" . . . X . . . . X X . . . ", +" . . X X X . . X X X X X X X . . ", +" . . . X X X X X . . X X X X X X X X . . ", +" . . X X . X X . . X X X X X X X X X X . . ", +" . . X X . X X X . X X X X X X X X . X X X . . ", +" . . X X . X X . X X X X X X X . . X X X X . ", +" . . X X X . X . . X X X X X X . X X X X X X . ", +" . X X . X X . X X X X X X . X X X X X X X . . ", +" . . X X . X . . X X X X X X . X X X X X X X . ", +" . . X X . X X . X X X X X . . X X X X X X X . . ", +" . . . . X X . X . X X X X X . X X X X X X X X X . . ", +" . . X . X X . X X X . . X X X X X X X X X X . ", +". . . . . . X . X o X X X . X X X X X X X X X X X . ", +" . . . . . X X X o X . . X X X X X X X X X X . . . ", +" . . . . . . X X o o X X X X X X X X X X . . . ", +" . . . . . . X X o X X X X X X X . . . . . . ", +" . . . o . . . . . . . . o . ", +" . o . . . . . . o o o . . o . . o . ", +" . . o . . o o . . o o . . . . . ", +" . . X . . . . o . . o o o . . . . ", +" . . X . . o . o o . . o o o . . o . . . ", +" . . . o . o o o . . o o . . o o o . . . ", +". . . o . o o o . . . o . . o o o . . . ", +". . . o . o o o . o . o . . o o o . . . ", +" . . . o . o o o . o . o . . o o o . . . . ", +" . . . . . . . o . o o o . o . o . . o o o . . . . . ", +" . . . o . o o o o . o . o . . o o o . . . . ", +" . . . . . . . o . . o o o . o . o . . o o o . . . ", +" . . o . o o o o o . . . o . . o o o . . . ", +" . o o o o o o o o . . o o . . o o o . o ", +" . o o o o o o . . o o o . . o o . . . ", +" . o o o o . . . . o o o o . . . o . o o ", +" . . . . . . . . . o . . . . . o o ", +" . o o o . . . o o o . ", +" . . . . . ", +" . . . . . . ", +" . . . . . . . ", +" . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/block.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/block.xpm new file mode 100644 index 00000000..e350d740 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/block.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * block[] = { +/* block pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . . . ", +" . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . ", +" . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/bomb.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/bomb.xpm new file mode 100644 index 00000000..82497cad --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/bomb.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * bomb[] = { +/* bomb pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 1 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"* c #F00 s s_#F00 ", +/* pixels */ +" * * * ", +" ", +" * * * ", +" * * ", +" * ** * ", +" * * ", +" * * ", +" * ", +" * ** ", +" .... ", +" .... ", +" .... ", +" ...... ", +" .......... ", +" ....... ... ", +" .......... .. ", +" ............ .. ", +" .............. .. ", +" ............... . ", +" ................. .. ", +" ................. .. ", +" .................... ", +" .................... ", +" .................... ", +" .................... ", +" ... .............. ", +" .................. ", +" .... ........... ", +" .............. ", +" ............ ", +" .......... ", +" ...... " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/bull.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/bull.xpm new file mode 100644 index 00000000..ffcd4dc5 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/bull.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static char * bull[] = { +/* bull pixmap + * width height ncolors chars_per_pixel */ +"60 20 4 1 ", +" c white s s_white ", +"+ c DarkSlateBlue s s_DarkSlateBlue ", +"& c green s s_green ", +"= c black s s_black ", +/* pixels */ +"++++++++++++++++++++++++++++++++++++++++++++++&+&+++++++++++", +"+ +++++++++++++ + +++++++++++++++&+&+&++++++++++", +"+ ++++++++++++ + ++++++++++++++&+&+&+&&++++++++", +"++ ++ ++++++++++++++ +++ ++++++++++ +++++", +"++ +++ ++++++++++++++ +++ ++++++++++ ++&+&+&+&+&++ +++++", +"++ +++ ++++++++++++++ +++ ++++++++++ +&+&+&+&+&+&+ +++++", +"++ +++ ++++++++++++++ +++ ++++++++++ &+&+&+&+&+&+& +++++", +"++ ++ +++ +++ +++ +++++++++& +&+&+&+&+&+&+ &++++", +"++ +++ +++ +++ +++ ++++++++&+ &+&+&+&+&+&+& +&+++", +"++ +++ ++++ +++ +++ +++ +++++++++& +&+&+&&&+&+&+ &&+++", +"++ ++++ +++ +++ +++ +++ ++++++++++ &+&+&+&&+&&+& +&+++", +"++ ++++ +++ +++ +++ +++ ++++++++++ +&++&&&&&&+&+ &++++", +"++ ++++ +++ +++ +++ +++ ++++++++++ ++++++&&++&++ +++++", +"++ +++ +++ ++ +++ +++ ++++++++++ ++++++&&+++++ +++++", +"+ +++ +++ +++ ++++++++++ ++++&&&&&&+++ +++++", +"+ +++++ + + +++++++++ +++++", +"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++", +"============================================================", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", +"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/circles.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/circles.xpm new file mode 100644 index 00000000..a665b702 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/circles.xpm @@ -0,0 +1,73 @@ +/* XPM */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 2 1 ", +" c #000000 s s_#000000 ", +". c #FF0000 s s_#FF0000 ", +/* pixels */ +" ", +" . .. .. .. .. ", +" . . ... ... . ", +" . . .. .. . ", +" . .. . . .. ", +" . . .. ........... .. . ", +" . . . .... .... . ", +" . . .. .. . ", +" . . ... ... . ", +" . . . . . ", +" . . .. ......... .. . ", +" . . . .... .... . . ", +" . . . .. . . . ", +" . . .. .. . . ", +" . . .. .. . . ", +" . . . . . . ", +" . . . ......... . . . ", +" . . ... ... . . . ", +" . . .. .. . . . ", +" . . .. .. . . ", +" . . . . . . ", +" . . . . . . ", +" . . . ....... . . . ", +" . . . ... ... . . . ", +" . . . .. .. . . . ", +" . . . . . . . . ", +" . . . . . . . ", +" . . . . . . . ", +" . . . ....... . . . . ", +" . . . .. .. . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . ..... . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" .. . . . . . . . . . ", +" . . .. . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . ..... . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . .. .. . . . . ", +" . . . . ....... . . . . ", +" . . . . . . . . ", +" . . . .. .. . . . . ", +" . . . ... ... . . . . ", +" . . . . ....... . . . . ", +" . . . .. .. . . . ", +" . . . .. .. . . . ", +" . . . ... ... . . . ", +" . . . .. ......... .. . . ", +" . . . .. .. . . ", +" . . . .. .. . . ", +" . . . .... .... . . ", +" . . . .. ......... .. . ", +" . . . . . . ", +" . . . ... ... . ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/city.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/city.xpm new file mode 100644 index 00000000..c1b01b0f --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/city.xpm @@ -0,0 +1,74 @@ +/* XPM */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 3 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +"j c #e0e000 s s_#e0e000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . ", +" . ", +" ..... ... ", +" .j... ... ", +" ...j. ..... ", +" ..... ..... ", +" .j... .......... ", +" ...j. . . . . ", +" ..... . . . . .. ", +" ..j.. .......... .. ", +" ..... . .... . .. ", +" .j... . .... . .. ", +" ..... .... .......... ........... .. ", +" ...j. . . ..... .... .... . .j. . .. .. ", +" ..... .... .j. . .... .... ........... .. ", +" ..... . . .j. . .......... . ..j.. . .. ", +" . . .... ..... . ....... ........... .. ", +" ..... . . .j... . ....... . .j. .j. ....", +" ...j. .... .j... .... . . ........... . .", +" ..... .... ...j. .... . . . .j. . . ....", +" ..j.. .... ...j. .......... ........... . .", +" .......... . . ..... .......... .. .j.. . ....", +" ..... ... .... ..... .......... ........... ....", +" ....... . .... ...j. .......... .. .j. . ....", +" .j........ . . ...j. . .... . ........... . .", +" ..... ... ....... ..... . .... . . . . .. ....", +" ..j....... . . ...j.............. ........... .j..", +" ....... . ....... ...j........ . . . .j.. .j. ....", +" ...j. ... ......... ......j..... . . ........... ..j.", +" .......... . . .j. .j............ . .j..j. .. ....", +".. ...j... . ......... .j. ..... ....... .............. .", +".. ..... ... ......... ......j.. ..........j... .j. .....", +". ....... . .................j........................j.. .", +".. ...j...... . .....j.......... ...... .... ..j.....", +".. .j...................j...j.......... ................... .", +" . ....... .... .......j................j. ..j. .......", +".. ..... ....j...............j..j........ ..............j. ..", +"..... ....................j.....j......... ....j... .j..j....", +"..j...... ....................j...........................j. ..", +".....j..... .... .j.....j..j........ ...j.. ......j....", +" ..j..........j..........j...j...j......... ..........j..... .", +".....j... ...... .....j.................. .......j.....", +"..j........ .....................j.. ...................j.. .", +" ..... .......j.... ...j.....j... .........j..... ..j.....", +"...j.....................j................................j.. .", +"................................................................", +"................................................................", +"................................................................" +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/crab.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/crab.xpm new file mode 100644 index 00000000..ec28b0b6 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/crab.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * crab[] = { +/* crab pixmap + * width height ncolors chars_per_pixel */ +"28 28 6 2 ", +". c SkyBlue m white s s_SkyBlue ", +"x c orange m black s s_orange ", +"* c #ff72c2 m black s s_#ff72c2 ", +"+ c SteelBlue m white s s_SteelBlue ", +"G c black m black s s_black ", +"a c LightGrey m white s s_LightGrey ", +/* pixels */ +". . . . . . * * * * . . . . . . . . . * * * * . . . . . ", +". . . . + * x x * . . . . . . . . . . + * x x * . . . . ", +". . . + * x x * . . . . . . . . . . . . + * x x * . . . ", +". . + * x * . . . * . . . . . . . . . * . . + * x * . . ", +". . + * x * . . + * . . . . . . . . + * . . + * x * . . ", +". . + * x * . + * * . . . . . . . . + * * . + * x * . . ", +". . + * x * + * * . . . . . . . . . . + * * + * x * . . ", +". . + * x * * * . . . . . . . . . . . . + * * x x * . . ", +". . . + * x * . . + * . . . . . . + * . . + * x * . . . ", +". . . + * x . . + * . + * * . * * . + * . . + x * . . . ", +". . . . + x . . + * . + * * . * * . + * . . + x . . . . ", +". . . . + x . . . + * + * * * * * + * . . . + x . . . . ", +". . . . + * x . . + * * * * * * * * * . . + x * . . . . ", +". . . . . + * x * * * * x x x x x * * * * x * . . . . . ", +". . . . + + + * * x x x x x x x x x x x x * . . . . . . ", +". . + + * x x x x x x x x x x x x x x x x x x * x . . . ", +". + * x x a + * * x x x x x x x x x x x * * a G * x * . ", +"+ * x . . . + * * x x x x x x x x x x x * * G . . . x * ", +". . . . . . + * * x x x x x x x x x x x * * . . . . . . ", +". . . . . + * * x x x x x x x x x x x x x * * . . . . . ", +". . . + * x x x * x x x x x x x x x x x * x x x * . . . ", +". . + * x a a + * * x x x x x x x x x * * a a a x * . . ", +". + * x G G G + * * x x x x x x x x x * * a G G G x * . ", +". + * G . . . + * x * x x x x x x x * x * a G . . . * . ", +". . . . . . + * x a * * * x x x * * * a x * G . . . . . ", +". . . . . + * x a G a a * * * * * a a G a x * G . . . . ", +". . . . . + x a G . G G a a a a a G G . G G x a G . . . ", +". . . . . + x a G . . . G G G G G . . . . . x a G . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/crab45.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/crab45.xpm new file mode 100644 index 00000000..022099e5 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/crab45.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * crab45[] = { +/* crab45 pixmap + * width height ncolors chars_per_pixel */ +"28 28 6 2 ", +". c SkyBlue s s_SkyBlue ", +"x c orange s s_orange ", +"* c #ff72c2 s s_#ff72c2 ", +"+ c SteelBlue s s_SteelBlue ", +"G c black s s_black ", +"a c LightGrey s s_LightGrey ", +/* pixels */ +". . . . . . . . . . * * * * * * * . . . . . . . . . . . ", +". . . . . . . . * x x x x x x x * . . . . . . . . . . . ", +". . . . . . . * * * * * * * x x * . . . . . . . . . . . ", +". . . . . . . . . . . . . * x x x * . . . . . . . . . . ", +". . . . . . . . . . * x x x x * x x . . . . . . . . . . ", +". . . . . . . . + + * * * * * * * x x . . . . . . . . . ", +". . . . . . . . . . . . . . . . . * x x . . . . . * . . ", +". . * . . . . . . . . . . . . . . . * x . . * * x x . . ", +". * * . . + . . . . . . + + x x + * * x * * x x x + . . ", +". x * . . + . . . . . . . . + x + * x x x x x + + . . . ", +"* x * . * * . . . . . . + . + x * * x x x * * . . . . . ", +"* x * . x * . . . . . + x + + x x x x x x * * . . * * * ", +"* x * . x * . . + . + x x x x x x x x x x * * * * x x x ", +"* x * * x * . . + . . + x x x x x x x x x * * x x x G G ", +"* x x x x * . . x + + + x x x x x x x x x x x * * G G . ", +"* x x x * * . . x x x x x x x x x x x x x x x * * G G . ", +"* * * x . * . . + + * x x x x x x x x x x x x * * G G . ", +". . . * . x * . * * * x x x x x x x x x x x x x * * * * ", +". . . . . x x * * x x x x x x x x x x x x x x * x x x x ", +". . . . . . x x x x x x x x x x x x x x x x * * G G G x ", +". . . . . . . . * x x x x x x x x x x x x x * * G G + . ", +". . . . . . . . * x * * * * x x x x x x x * * * G G . . ", +". . . . . . . * x x * * * * x x x x x * * * * * * G G . ", +". . . . . . . * x + . . * x * * * x * * * * * G G G G . ", +". . . . . . . x x + . . * x * * * * x G G G * G G G . . ", +". . . . . . * x + . . * x x G G G * x G G G G G . . . . ", +". . . . . . . . . . . * x G G G G * x G + . G G . . . . ", +". . . . . . . . . . . * x G . . . * x x . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/dos.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/dos.xpm new file mode 100644 index 00000000..a43d3321 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/dos.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * dos[] = { +/* dos pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/doso.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/doso.xpm new file mode 100644 index 00000000..f0f763ce --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/doso.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * doso[] = { +/* doso pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . ", +". . . ", +". . . ", +". . . ", +". . . ", +". . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/doss.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/doss.xpm new file mode 100644 index 00000000..bfc89484 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/doss.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * doss[] = { +/* doss pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" ", +" ", +" . ", +" . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . ", +" . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +" . . . ", +" . . . . ", +" . . . ", +" . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/editor.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/editor.xpm new file mode 100644 index 00000000..742424f4 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/editor.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * editor[] = { +/* editor pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . ", +" . . . ", +" . . . . . . . ", +" . . . ", +" . . . . . . . ", +". . . . . . . ", +". . ", +". . . . . . ", +". . ", +". . ", +". . . . . . . . . . ", +". . ", +". . . . . . . . . . ", +". . ", +". . . . . . . . . . ", +". . ", +". . . . . . . . . . . . . ", +". . . . . ", +". . . . . . . . . . . ", +". . . . . ", +". . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . . ", +". . . . . ", +". . . . . . . . ", +". . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . ", +" . . . . ", +" . . . ", +" . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/escherknot.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/escherknot.xpm new file mode 100644 index 00000000..d5a194c9 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/escherknot.xpm @@ -0,0 +1,61 @@ +/* XPM */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 52 2 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +/* pixels */ +" ", +" . . . ", +" . . . . ... ", +" . . . . . ", +" . . .. ", +" . . . . . . . .. ", +" . . .. . . . . . .. ", +" . . . . .. . .. . . . . . . .. ", +" . . . . . . . ... .... . . .. . ", +" . . . . .. . . . .. .. . ... .. ... ", +" . . . . . .. .. . . . ........ . . .. ", +" . . . . .... .... . .. . . . ...... . . . ", +" . . . . . ... ..... .. . ..... . . . .... ", +" . . ........... . .. . .. . .. . . . ", +" . . ... .................. . ... .. . . .. .. ", +" . .. .................. .. . . . .. . ... ", +" . .. .. ..................... .... .. . ..... ", +" . .. ........ . ....... . .. . .. . . . . . ", +" .. .. .. .. . . . ......... . .. .. . ..... ", +" . . ....... . ... .......... .. . . . . ", +" . ... . . .. . ... . ... .. . .. . . . ..... ", +" . . ....... . ..... .... ... . .. .. ", +" . ... . ... .. .. ... ..... . . ... .. ", +" . . ..... . . .. .... .... . . . .... ", +" . ... . .. . . .. .. .. . . .. .... ", +" .... ... . . . ..... . . . ..... ", +" . . .. . .. . . .. .. . . ... .. ", +" ...... . . . . . . . ... . .. .. .... ", +" . .. .. . . . . .. ... . . . . . .. ...... ", +" ...... ... . . . .. . .. . . . . ....... ", +" . .. . . . . . . . . . .. . .. . .... ..... ", +" ....... . . . . . ... ... . . . ... ..... ... ", +" .... .... .. . . . . . . ..... .......... ", +" ..... . .. .. . .. . . . .. . ....... ...... ", +" ........ . . . . .. . .............. .. ... ", +" ..... ..... . . . . . . ....... . ...... ", +" ....... .. . .. . . . ....... . . ..... ", +" ............ . ... . . ... . .. ... ", +" ....... . ... . . . . ....... ", +" ....... . . . . .. . . . . ... ", +" . .. .. .. .. . . ...... ", +" .. ..... . .. . . .. ... ", +" ... . .. . . . . . . ...... ", +" . ... ...... . .. ... .... ", +" ....... . . ... ... ..... ", +" ... ....... ... ....... ", +" ..... ............... ", +" ....... ........... ", +" ................ ", +" ............ ", +" . ..... ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye.xpm new file mode 100644 index 00000000..46e3903d --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye[] = { +/* eye pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X X X X . . . ", +" . X X X X . . . . ", +" . X X . X X . ", +" . X X . X X . ", +" . X X . . . . . . . ", +" . X . X X X X X . . X . . ", +" . X X X X X X X X X X . X X . ", +" . . . . . . . . . . . . . X . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye1.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye1.xpm new file mode 100644 index 00000000..da792df5 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye1.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye1[] = { +/* eye1 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X X X X . . . ", +" . X X X X . . . . ", +" . X X . X X . . . . ", +" . X X . X X . . . X X X . ", +" . X X X . X X X X X X X . ", +" . X X X . X . . . X . . . ", +" . X X X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye10.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye10.xpm new file mode 100644 index 00000000..9a8f37ef --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye10.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye10[] = { +/* eye10 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X . ", +" . . . . . . . X X X X . ", +" . X X X X X X . ", +" . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye11.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye11.xpm new file mode 100644 index 00000000..8bcd2551 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye11.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye11[] = { +/* eye11 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X . . . . X . . X X . ", +" . . X X X X . . . X X X X . ", +" . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye12.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye12.xpm new file mode 100644 index 00000000..8865da53 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye12.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye12[] = { +/* eye12 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X X X . ", +" . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye13.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye13.xpm new file mode 100644 index 00000000..93c38240 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye13.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye13[] = { +/* eye13 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X X X X X X X X . ", +" . . . . X X X X . ", +" . . . . X X . X X . ", +" . X X X . . . X X . X X . ", +" . X X X X X X X . X X X . ", +" . . . X . . . X . X X X . ", +" . X X X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye14.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye14.xpm new file mode 100644 index 00000000..7dd406a9 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye14.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye14[] = { +/* eye14 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X X X X X X X X . ", +" . . . . X X X X . ", +" . X X . X X . ", +" . . . X X . . X X . . ", +" . X X . . . X X . . X X X . ", +" . X X X X X . . . . X X X . ", +" . . X X X . . X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye15.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye15.xpm new file mode 100644 index 00000000..092cc68b --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye15.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye15[] = { +/* eye15 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X X X X . X X X . ", +" . . . . . . X X . ", +" . X X . . X X . ", +" X . . . X X X . ", +" . X X X X X X X . ", +" . . X . . . . . . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye16.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye16.xpm new file mode 100644 index 00000000..2c67a791 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye16.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye16[] = { +/* eye16 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X . X X X X X X . ", +" . . . X X X . . . ", +" . X X . X X . ", +" . . . X X X . X X . ", +" . X X X X X X X . X . ", +" . . . . . . . . . X . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye17.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye17.xpm new file mode 100644 index 00000000..acf6c03f --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye17.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye17[] = { +/* eye17 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . o o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . o o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . o o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X . X X X X X X . ", +" . . . X X X . . . ", +" . . X X . X X . ", +" . X . . . X X . . X X . ", +" . X X X . . X X . X . X X . ", +" . X X X X X . X . . . X . ", +" . . X X . X X X X X X X . ", +" . . . X . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye18.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye18.xpm new file mode 100644 index 00000000..b669b419 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye18.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye18[] = { +/* eye18 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X . X . X X X X X X X X X X X X X X X X . ", +" . X . . . . X X X X X X X X X X X X X X X . ", +" . X . o o . . X X X X X X X X X X X X X X X . ", +" . . o o o o o . . X X X X X X X . X X X X X X . ", +" . o o o o o o . . X X X X . X X . X X X X X . ", +" . . o o o o o o o . X X X X X X . X X . X X X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o o o o . X X X X X X X X . X X . X X . ", +" . o o o o o o o . . X X X X X X . X X . X X X . ", +" . . o o o o o . . X X X X . . . X X . X X X X . ", +" . . o o . . X X X X . X X X X . X X X X . ", +" . X . . . . X X X X . X X X X . X X X X X . ", +" . X . X . X . X X X X X . X X X . . X X X X . ", +" . X X X X X X X X X X X . X X X X . X X . ", +" . X X X X X X X X X X X . X X . X X . ", +" . . X X X X X X X X X X . . X . . ", +" . . . X X . X X X X X X . ", +" . . . X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . . X X . ", +" . . . . X X . X X X X . ", +" . X X X X X X X . . . . . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye19.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye19.xpm new file mode 100644 index 00000000..8e12e502 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye19.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * eye19[] = { +/* eye19 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X X X . ", +" . X X X X . . X X X X X X . ", +" . X X X X X X . . . . . . . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye2.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye2.xpm new file mode 100644 index 00000000..dd4611c2 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye2.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye2[] = { +/* eye2 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o o . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X X X X . . . ", +" . X X X X . . . . ", +" . X X . X X . ", +" . . X X . . X X . . . ", +" . X X X . . X X . . . X X . ", +" . X X X . . . . X X X X X . ", +" . X X X X X . . X X X . . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye20.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye20.xpm new file mode 100644 index 00000000..f690ed9c --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye20.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * eye20[] = { +/* eye20 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . . X X . . ", +" . X X . . X . X X . X . ", +" . X X X X . X . . X X . . ", +" . X X X X X X . . . . . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye21.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye21.xpm new file mode 100644 index 00000000..625c3184 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye21.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * eye21[] = { +/* eye21 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X . ", +" . . . . . . . X X X X . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye22.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye22.xpm new file mode 100644 index 00000000..484211e5 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye22.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * eye22[] = { +/* eye22 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X . ", +" . . . . . . . X X X X . ", +" . X X X X X X . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye23.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye23.xpm new file mode 100644 index 00000000..fadd0d48 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye23.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * eye23[] = { +/* eye23 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . . X X . . . X X . ", +" . X . X X . X . . X X . ", +" . . X X . . . X X X X . ", +" . . . . . X X X X X X . ", +" . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye24.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye24.xpm new file mode 100644 index 00000000..1525a858 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye24.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * eye24[] = { +/* eye24 pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +/* pixels */ +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X X X X X . X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X X . ", +" . . X X X X X X X X X X X X X X X X X X X X X X X . . ", +" . X . X X X X X X X X X X X X X X X X X X X X X . X . ", +" . X X . X X X X X X X X X X X X X X X X X X X . X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . X X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X . . X . ", +" . X X X X . . X . X X . X . ", +" . . . . . . . . . . . . . . ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye3.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye3.xpm new file mode 100644 index 00000000..b0ce7aaa --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye3.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye3[] = { +/* eye3 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X . X X X X X . . . ", +" . X X . . . . . . ", +" . X X . . X X . ", +" . X X X . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye4.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye4.xpm new file mode 100644 index 00000000..49fa55ff --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye4.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye4[] = { +/* eye4 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X . X X . . . ", +" . . . X X X . . . ", +" . X X . X X . ", +" . X X . X X X . . . ", +" . X . X X X X X X X . ", +" . X . . . . . . . . . ", +" . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye5.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye5.xpm new file mode 100644 index 00000000..89dceab2 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye5.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye5[] = { +/* eye5 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X . X X . . . ", +" . . . X X X . . . ", +" . X X . X X . . ", +" . X X . . X X . . . X . ", +" . X X . X . X X . . X X X . ", +" . X . . . X . X X X X X . ", +" . X X X X X X X . X X . . ", +" . . . . . . . X . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye6.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye6.xpm new file mode 100644 index 00000000..e7b32499 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye6.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye6[] = { +/* eye6 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . X . X . X X . ", +" . X X X X X X X X X X X X X X X . . . . X . ", +" . X X X X X X X X X X X X X X X . . o . . X . ", +" . X X X X X X . X X X X X X X . . o o o o o . . ", +" . X X X X X . X X . X X X X . . o o o o o o . ", +" . X X X X . X X . X X X X X X . o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X . X X . X X X X X X X X . o o o o o o o o . . ", +" . X X X . X X . X X X X X X . . o o o o o o o . ", +" . X X X X . X X . . . X X X X . . o o o o o . . ", +" . X X X X . X X X X . X X X X . . o . . . ", +" . X X X X X . X X X X . X X X X . . . . X . ", +" . X X X X . . X X X . X X X X X . X . X . X . ", +" . X X . X X X X . X X X X X X X X X X X . ", +" . X X . X X . X X X X X X X X X X X . ", +" . . X . . X X X X X X X X X X . . ", +" . X X X X X X . X X . . . ", +" . . . X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . . X X . ", +" . X X X X . X X . . . . ", +" . . . . . X X X X X X X . ", +" . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye7.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye7.xpm new file mode 100644 index 00000000..82c85d66 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye7.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye7[] = { +/* eye7 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X X X . ", +" . X X X X . . X X X X X X . ", +" . X X X X X X . . . . . . . ", +" . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye8.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye8.xpm new file mode 100644 index 00000000..17ef0b45 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye8.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye8[] = { +/* eye8 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X X X . ", +" . X X . . X . . . . X . ", +" . X X X X . . . X X X X . . ", +" . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/eye9.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/eye9.xpm new file mode 100644 index 00000000..c72b9cf7 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/eye9.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * eye9[] = { +/* eye9 pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . . ", +" . . . X X X X X X X . . . ", +" . . X X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X . X . X . X . X X X X X X X X . ", +" . X X X X X X X . . . . . X X X X X X X . ", +" . X X X X X X X . . o o . . X X X X X X X . ", +" . X X X X X X X . . o o o o o . . X X X X X X X . ", +" . X X X X X X . . o o o o o o . . X X X X X X . ", +" . X X X . X X X X . o o o o o o o o . X X X X . X X X . ", +" . X X . X X X X . . o o o o o o o . . X X X X . X X . ", +" . X X . X X X X X . o o o o o o o o o . X X X X X . X X . ", +" . X X . X X X . . o o o o o o o . . X X X . X X . ", +" . X X . X X X . . o o o o o . . X X X . X X . ", +" . X X . X X X X . . o o . . X X X X . X X . ", +" . X X . X X X X . . . . . X X X X . X X . ", +" . X X X X . X X X X . X . X . X . X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . X X X X . X X X X X X X X X X X X X X X . X X X X . ", +" . . . . X X X X X X X X X X X X X X X X X . . . . ", +" . . . . X X X . . . X X X X . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X X X . . X X . ", +" . X X X X X X . . X X X X . ", +" . . . . . . . X X X X X X . ", +" . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/fil.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/fil.xpm new file mode 100644 index 00000000..3f288616 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/fil.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * fil[] = { +/* fil pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/fils.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/fils.xpm new file mode 100644 index 00000000..38a1cdf2 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/fils.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * fils[] = { +/* fils pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . ", +" . . . . . ", +" . . . . . ", +" . . . . . . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . ", +" . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/floppy.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/floppy.xpm new file mode 100644 index 00000000..2a1bc1c9 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/floppy.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * floppy[] = { +/* floppy pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . ", +". . . . ", +". . . . . . ", +". . . . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . ", +". . . . . . . . . . . . . . . . . . . . . . ", +". . ", +". . ", +". . ", +". . ", +". . . . . . . . . . . . . . . . . . . ", +". . . . ", +". . . . . . . . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +". . . . . . ", +" . . . . . . . . ", +" . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/jolifond.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/jolifond.xpm new file mode 100644 index 00000000..50013713 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/jolifond.xpm @@ -0,0 +1,58 @@ +/* XPM */ +static char * jolifond[] = { +/* jolifond pixmap + * width height ncolors chars_per_pixel */ +"47 47 4 2 ", +" c #A800A800A800 s s_#A800A800A800 ", +". c #000 s s_#000 ", +"X c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +"o c #540054005400 s s_#540054005400 ", +/* pixels */ +" . . X X X . . ", +" . . X . . ", +" . o o o o X o . . . . . o o o o X o . ", +" . o o o o X o . . . o o o o X o . ", +" . o o o o o o o o o . . . X . . . o o o o o o o o o . ", +" . o o o o o o o o o . . X X . X X . . o o o o o o o o o . ", +" o o X o o o o o o o X o o . . . X . X . . . o o X o o o o o o o X o o ", +" o o o o o X o o o o o X o o o o o . X . X . o o o o o X o o o o o X o o o o o ", +" o o o o X o o o X o o o o . . X . . o o o o X o o o X o o o o ", +" o o o o o o o X o o o o o o o o . . X . . o o o o o o o o X o o o o o o o ", +" o o . . X . . o o ", +" o o o o o o o o o o . . . o o o o o o o o o o ", +" o o o o X o o o o o . . . X o o o o o X o o o o ", +" o o o o o X o o o o o o . . . . . . . X X o o o o o o X o o o o o ", +" o o X o o o o o o . . . . . . . X X o o o o o o X o o ", +" . o o o o . . . . . . X . o o o o . ", +" . o o o o . . . . . o o o o . ", +" . o . . . . X . o o o X . o o o X . . . . o . . ", +" . o . o o o o o X o o o o o o . . ", +" . . . o o o X o o o o o X o o o . . . ", +". . . . . . o o X X X o o o X X X o o . . . . . . ", +". . X . . . . . . o o o X o o o o o X o o o . . . . . . X . . ", +"X . . X X X . . . . . o o o o o X o o o o o . . . . . X X X . . ", +"X X . . X . . . X X X . . . . . . . X o o o X . X o o o X . . . . . . . X X X . . . X . . ", +"X . . X X X . . . . . o o o o o X o o o o o . . . . . X X X . . ", +". . X . . . . . . o o o X o o o o o X o o o . . . . . . X . . ", +". . . . . . o o X X X o o o X X X o o . . . . . . ", +" . . . o o o X o o o o o X o o o . . . ", +" . o . o o o o o X o o o o o o . . ", +" . o . . . . X . o o o X . o o o X . . . . o . . ", +" . o o o o . . . . . o o o o . ", +" . o o o o . . . . . . . o o o o . ", +" o o X o o o o o o . . . . . . . o o o o o o X o o ", +" o o o o o X o o o o o o . . . . . . . o o o o o o X o o o o o ", +" o o o o X o o o o o . . . o o o o o X o o o o ", +" o o o o o o o o o o . . . o o o o o o o o o o ", +" o o . . X . . o o ", +" o o o o o o o X o o o o o o o o . . X . . o o o o o o o o X o o o o o o o ", +" o o o o X o o o X o o o o . . X . . o o o o X o o o o o o o o ", +" o o o o o X o o o o o X o o o o o . X . X . o o o o o X o o o o o X o o o o o ", +" o o X o o o o o o o X o o . . . X . X . . . o o X o o o o o o o X o o ", +" . o o o o o o o o o . . X X . X X . . o o o o o o o o o . ", +" . o o o o o o o o o . . . X . . . o o o o o o o o o . ", +" . o o o o X . . . . o o o o o . ", +" . o o o o X . . . . . . o o o o o . ", +" . . . . ", +" . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm new file mode 100644 index 00000000..315f0c71 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm @@ -0,0 +1,51 @@ +/* XPM */ +static char * koala [] = { +/* pixmap + * width height ncolors chars_per_pixel */ +"38 38 6 2 ", +" c LightGrey s s_LightGrey ", +"* c black s s_black ", +"o c DarkSlateGrey s s_DarkSlateGrey ", +"X c brown s s_brown ", +". c tan s s_tan ", +"x c wheat s s_wheat ", +/* pixels */ +" ", +" * * * * ", +" * * ", +" * * * * * * * * * * * * * * * * * * ", +" * * * * * * * * * * * * * * * * * * * * * * * * ", +" * * * * . . . . . . . * * * * * * . . . . . . . * * * * ", +" * * * . . . x x x x x . . * * * * . . x x x x x . . . * * * ", +" * * . . x x x x x x x x . * * * * * * * * . x x x x x x x x . . * * ", +" * * . x x x x x x x x x . . * * * * * * . . x x x x x x x x x . * * ", +" * * . x x x x x x x x . . . . . . . . . . . . x x x x x x x x . * * ", +" * * . x x x x x x x . . . . . . . . . . . . . . x x x x x x x . * * ", +" * * . x x x x x x . . . . . . . . . . . . . . . . x x x x x x . * * ", +" * * . x x x x x . . . . . . . . . . . . . . . . . . x x x x x . * * ", +" * * . . x x x . . . . . . . . . . . . . . . . . . . . x x x . . * * ", +" * * * . . . x . . . o o o . . . X X . . . o o o . . . x . . . * * * ", +" * * * * . . . . o o o o o . X X X X . o o o o o . . . . * * * * ", +" * * * * . . o o o o o . X X X X . o o o o o . . * * * * ", +" * * * * . . o o o . . X X X X . . o o o . . * * * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . . X X . . . . . . . . * * ", +" * * * . . . . . . . . . . . . . . . . * * * ", +" * * * * . . . . . . . . . . . . * * * * ", +" * * * * * * * * * * * * * * * * * * ", +" * * * * * * * * * * * * * * ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" * * ", +" * * * * ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm~ b/vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm~ new file mode 100644 index 00000000..184639de --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/koala.xpm~ @@ -0,0 +1,51 @@ +/* XPM */ +static char * [] = { +/* pixmap + * width height ncolors chars_per_pixel */ +"38 38 6 2 ", +" c LightGrey s s_LightGrey ", +"* c black s s_black ", +"o c DarkSlateGrey s s_DarkSlateGrey ", +"X c brown s s_brown ", +". c tan s s_tan ", +"x c wheat s s_wheat ", +/* pixels */ +" ", +" * * * * ", +" * * ", +" * * * * * * * * * * * * * * * * * * ", +" * * * * * * * * * * * * * * * * * * * * * * * * ", +" * * * * . . . . . . . * * * * * * . . . . . . . * * * * ", +" * * * . . . x x x x x . . * * * * . . x x x x x . . . * * * ", +" * * . . x x x x x x x x . * * * * * * * * . x x x x x x x x . . * * ", +" * * . x x x x x x x x x . . * * * * * * . . x x x x x x x x x . * * ", +" * * . x x x x x x x x . . . . . . . . . . . . x x x x x x x x . * * ", +" * * . x x x x x x x . . . . . . . . . . . . . . x x x x x x x . * * ", +" * * . x x x x x x . . . . . . . . . . . . . . . . x x x x x x . * * ", +" * * . x x x x x . . . . . . . . . . . . . . . . . . x x x x x . * * ", +" * * . . x x x . . . . . . . . . . . . . . . . . . . . x x x . . * * ", +" * * * . . . x . . . o o o . . . X X . . . o o o . . . x . . . * * * ", +" * * * * . . . . o o o o o . X X X X . o o o o o . . . . * * * * ", +" * * * * . . o o o o o . X X X X . o o o o o . . * * * * ", +" * * * * . . o o o . . X X X X . . o o o . . * * * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . X X X X . . . . . . . * * ", +" * * . . . . . . . . X X . . . . . . . . * * ", +" * * * . . . . . . . . . . . . . . . . * * * ", +" * * * * . . . . . . . . . . . . * * * * ", +" * * * * * * * * * * * * * * * * * * ", +" * * * * * * * * * * * * * * ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" * * ", +" * * * * ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/lambda.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/lambda.xpm new file mode 100644 index 00000000..98cd6d7f --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/lambda.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * lambda[] = { +/* lambda pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #FFFF00000000 s s_#FFFF00000000 ", +"X c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . X . . . . . . . . ", +". . . . X X X X X X X X . . . . . X X X . . . . ", +". . . X X X X X X X . . . . . X X X X . . . ", +". . . X . . . . . . . . ", +". . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . X . . . . . . . . ", +". . . X X X . . . . . X X X X X X X X X . . . ", +". . . . X X X . . . . . X X X X X X X X X X . . . . ", +" . . . X . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/martini.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/martini.xpm new file mode 100644 index 00000000..c739de36 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/martini.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * martini[] = { +/* martini pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #7F7FFFFFFFFF s s_#7F7FFFFFFFFF ", +"o c #FFFF00000000 s s_#FFFF00000000 ", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" . ", +" . ", +" . . . . . . . . . . . . . . . . . . . . . . ", +" . . . ", +" . . . ", +" . X X X X X X X X X . X X X X . ", +" . X X X X X X o o o X X X . ", +" . X X X X o o o o o X . ", +" . X X X o o o o o . ", +" . X X o o o o . ", +" . X X o o . ", +" . X X . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . . . ", +" . . . . ", +" . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/mickey.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/mickey.xpm new file mode 100644 index 00000000..286a7b79 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/mickey.xpm @@ -0,0 +1,73 @@ +/* XPM */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 2 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +/* pixels */ +" ....... ", +" ............. ", +" ............... ", +" ................ ", +" ................... ", +" ................... ", +" ..................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ...................... ", +" ..................... ", +" .................... ", +" .................... ", +" .................. ", +" ................. ", +" ............... ", +" ................. ", +" .................... ", +" ....... .................... .... ", +" ........... .................... ...... ", +" .............. ...................... ....... ", +" ............... ........ ....... ... ........ ", +" .................. ....... .... ... ........ ", +" .................. ...... .. .. ........ ", +" ......................... ... .. .. ........ ", +" ......................... .. . .. .. ........ ", +" ......................... . .... ........... ", +" ......................... . ...... . ...... ", +" ........................ . .... ....... .... ", +" ........................ . ...... . .... . ", +" ........................ ....... . . . ", +" ........................ ...... . . . . ", +" ......................... . ... . . . . ", +" ........................ . . .. . ", +" ........................ . . .. . ", +" ......................... . . . . . ", +" ............... ......... . . . . ", +" ............. .......... .... . . ", +" .......... ............ . . ", +" ....... .............. .. . ", +" ................ .. ", +" ........... . ", +" ......... ... .. ", +" ........ .. .. ", +" ....... .... .. ", +" ...... . ... .... ", +" .... . ............. . ", +" .... . ........... . ", +" .. .......... . ", +" .. ......... . ", +" . ....... .. ", +" ... ..... .. ", +" ..... . .. ", +" ..... . .. ", +" ......... ", +" ", +" ", +" ", +" ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/mouse.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/mouse.xpm new file mode 100644 index 00000000..75661942 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/mouse.xpm @@ -0,0 +1,61 @@ +/* XPM */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 52 2 1 ", +" c #000000 s s_#000000 ", +". c #00FF00 s s_#00FF00 ", +/* pixels */ +" ", +" ", +" ", +" .... ... ", +" . .. . ", +" . .. . ", +" .......... . . ", +" . ...... ...... . ", +" . ... .... . ..... ", +" .... ... .... ", +" ... .......... ... ... ", +" ...... ...... .. ... .... ", +" .............. .......... ... ... ... ", +" ....... ........ ... ... ........ . .... ", +" .. ... .. ... . ... ", +" ..... .. .. ... ", +" .... . .. ....... ", +" ..... . .. . . .. .... . . ", +" .... .. . .. .... .. . ", +" . .. ........ . . . ", +" .. .. . . .... ", +" ..... ... ... .. .. ", +" ..... ......... .. . .. . ", +" ..... ... .... ", +" ", +" ", +" ", +" ", +" ", +" .... ... ", +" . .. . ", +" . .. . ", +" .......... . . ", +" . ...... ...... . ", +" . ... .... . ..... ", +" .... ... .... ", +" ... .......... ... ... ", +" ...... ...... .. ... .... ", +" .............. .......... ... ... ... ", +" ....... ........ ... ... ........ . .... ", +" .. ... .. ... . ... ", +" ..... .. .. ... ", +" .... . .. ....... ", +" ..... . .. . . .. .... . . ", +" .... .. . .. .... .. . ", +" . .. ........ . . . ", +" .. .. . . .... ", +" ..... ... ... .. .. ", +" ..... ......... .. . .. . ", +" ..... ... .... ", +" ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/nobozos.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/nobozos.xpm new file mode 100644 index 00000000..4963c06d --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/nobozos.xpm @@ -0,0 +1,73 @@ +/* XPM */ +static char * ppm[] = { +/* ppm pixmap + * width height ncolors chars_per_pixel */ +"64 64 2 1 ", +" c #FFFFFF s s_#FFFFFF ", +". c #000000 s s_#000000 ", +/* pixels */ +" ", +" ........... ", +" ................... ", +" ......................... ", +" ............................. ", +" ................................. ", +" ................................... ", +" ....................................... ", +" ......................................... ", +" ................. ................. ", +" .............. .............. ", +" ............. ............. ", +" ............ ............ ", +" .............. ............ ", +" ............... .......... ", +" ................. .......... ", +" .......... ...... ......... ", +" ...... . ...... . . ..... ", +" ....... . .. ... .. . ...... ", +" ..... .... . . . ... . . . .... .... ", +" ..... .. . .... .. .... .. .... . .. .... ", +" ..... . . .. . ... . .... . ... . .. . . .... ", +" ... .. .. .. ..... .... ..... .. .. .. .. ", +" .... .. ... . ..... .. .. .. ..... . ... .. ... ", +" .... . ... ... . ... .. ..... . ... . ... ... . ... ", +" ... ... ........ ...... .. .. . ..... ........ ... .. ", +" ... .. ....... ..... . ... .. . . ..... ....... .. .. ", +" .... . . ... ... ... .... ..... ... ... ... . . ...", +" ..... .. .... ... ..... . .... ... .... .. ....", +" ..... .. ....... ..... . .. ..... ....... .. ....", +" ..... . . ... ... . .. .... .... ... . ... ... . . ....", +" ...... ... ........ . .. .. .. .. .. ........ ... .....", +" ...... .. ..... . ..... . . . . ...... . ..... .. .....", +" ...... . . .... ... . .. . . .. . .. . .... . . .....", +" ....... .. . . ... . .. ... .. . .. . . . .. ......", +" ........ . . . . ..... . . . . ........", +" ........ . ............. . ........", +" ........ . ....... . . .........", +" ........ . ....... . .. ........ ", +" ........ . ..... . ... ........ ", +" ........ . .. ... .. . .... ........ ", +" ......... . .... .... . ..... ......... ", +" ........ . .. .. .. .. . ....... ........ ", +" ......... . .. ..... .. . ........ ......... ", +" ......... . .. .. . ......... ......... ", +" ......... . ......... . ................... ", +" .......... .. .. .................... ", +" ......... .. .. ................... ", +" .......... .. .. .................... ", +" .......... ..... ................. ", +" .......... ............... ", +" ............ .............. ", +" ............ ............ ", +" ............. ............. ", +" .............. .............. ", +" ................. ................. ", +" ......................................... ", +" ....................................... ", +" ................................... ", +" ................................. ", +" ............................. ", +" ......................... ", +" ................... ", +" ........... " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/nose.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/nose.xpm new file mode 100644 index 00000000..9d807a49 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/nose.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * nose[] = { +/* nose pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . ", +" . X X X X X . ", +" . X X X X X X X . ", +" . X X X X X X X X . ", +" . X X X X X X . . . . . . ", +" . X X X X X . . . ", +" . X X X X . . o o o o o . . ", +" . X X X X . o o o X . ", +" . X X X X . o o o X X . ", +" . X X X X X . o X X X X . ", +" . X X X X X X . . . X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X X . . X X X X X X X X X X X X X . ", +" . X . X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X . ", +" . X X X . . . X X X X X X X X X . ", +" . . . . X . . . X X X X X . . ", +" . X X . X X . . . . . ", +" . X X . X X . ", +" . X X . X X . ", +" . X X X . . . . . . . ", +" . X X X . X X X X X . . X . . ", +" . X X X X X X X X X X X X . X X . ", +" . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/noseback.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/noseback.xpm new file mode 100644 index 00000000..2d3e021a --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/noseback.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * noseback[] = { +/* noseback pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . ", +" . X X X X X X . ", +" . X X X X X X X X . ", +" . X X X X X X X X . ", +" . . X X X X X X X X . . ", +" . o . X X X X X X X X . o . ", +" . o . X X X X X X X X X X . o . ", +" . o . X X X X X X X X X X . o . ", +" . . X X X X X X X X X X X X . . ", +" . X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . . . . . . . X X . . . . X X . . . . . . . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . . . . X X . . X X . . . . ", +" . . X X . X X X X . . X X X X . X X . . ", +" . X X X X X X X X X X . . X X X X X X X X X X . ", +" . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/nosefront.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/nosefront.xpm new file mode 100644 index 00000000..8182e774 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/nosefront.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char * nosefront[] = { +/* nosefront pixmap + * width height ncolors chars_per_pixel */ +"32 32 4 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FFFFB0B0B0B0 s s_#FFFFB0B0B0B0 ", +"o c #32329999CCCC s s_#32329999CCCC ", +/* pixels */ +" ", +" ", +" . . . . . . ", +" . X X X X X X . ", +" . X X X X X X X X . ", +" . X X X X X X X X . ", +" . . . X X X X X X . . . ", +" . . X X X X . . ", +" . . . . . . . X X . . . . . . . ", +" . o o . X X . o o . ", +" . o o . X X . o o . ", +" . . X X X X . . ", +" . X . . . X X X X X X . . . . ", +" . X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X . ", +" . X . X X X X X X X X X X X X . X . ", +" . X X X X X X X X X X X X X X X X X X . ", +" . X . X X X X X X X X X X X X X X . X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X X X X X X X X X X X X X X X X X X X . ", +" . X X . X X X X X X X X X X X X X X X X . X X . ", +" . X X X X X X X X X X X X X X X X X X X X X X . ", +" . X X X . X X X X X X X X X X X X X X X X X X . ", +" . X X X X . X X X X X X X X X X X X . X X X X . ", +" . . . . . . X X X X X X X X . . . . . . ", +" . X . . . . . . . . X . ", +" . X X . . X X . ", +" . X X . . X X . ", +" . . . . X X . . X X . . . . ", +" . . X X X X . X X . . X X . X X X X . . ", +" . X X X X X X X X X X . . X X X X X X X X X X . ", +" . . . . . . . . . . . . . . . . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/nosmoking.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/nosmoking.xpm new file mode 100644 index 00000000..1c645168 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/nosmoking.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * nosmoking[] = { +/* nosmoking pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #FFFF00000000 s s_#FFFF00000000 ", +"X c #000 s s_#000 ", +/* pixels */ +" . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . X . . . . ", +" . . . . X X . . . . . . ", +" . . . . X . . . . . . . . ", +" . . . X . . . . . . . . ", +" . . . . X X . . . . . . . . . ", +" . . . X X X . . . . . . . . ", +" . . . X X . . . . . . . . ", +". . . . X X . . . . . . . . . ", +". . . . . . . . . . . ", +". . . X X X X X X X X X X X X X X X X X X . . . ", +". . . X X X . . . . . X . . . ", +". . . X X X . . . . . X . . . ", +". . . X X X . . . . . X . . . ", +". . . X X X X X X X X X X X X X X X X X X . . . ", +". . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . ", +" . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/porsche.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/porsche.xpm new file mode 100644 index 00000000..f776e6cd --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/porsche.xpm @@ -0,0 +1,75 @@ +/* XPM */ +static char * porsche[] = { +/* porsche pixmap + * width height ncolors chars_per_pixel */ +"64 64 4 1 ", +" c slateblue s s_slateblue ", +". c yellow s s_yellow ", +"r c red s s_red ", +"b c black s s_black ", +/* pixels */ +" ", +" ", +" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb............................................bb ", +" bb..bbbb..bbbb..bbbb..bbbb..bbbb..b..b..bbbb..bb ", +" bb..b..b..b..b..b..b..b..b..b..b..b..b..b.....bb ", +" bb..b..b..b..b..b..b..b.....b.....b..b..b.....bb ", +" bb..bbbb..b..b..bbb...bbbb..b.....bbbb..bbbb..bb ", +" bb..b.....b..b..b..b.....b..b.....b..b..b.....bb ", +" bb..b.....b..b..b..b..b..b..b..b..b..b..b.....bb ", +" bb..b.....bbbb..b..b..bbbb..bbbb..b..b..bbbb..bb ", +" bb............................................bb ", +" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb.....................bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb......b...b...bb.....bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb.....b...b...b....b..bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb....bb..bb.bbbbbbb...bbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb...bbbbbbbb......bb..bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb..bbbb...............bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb.bbb.................bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb..........b..b.......bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb.....b...b..b........bbrrrrrrrrrrrrrrrrrrrrrbb ", +" bb....b...b..b..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb....b.bbbbbbbbb..............bbbbbbbbbbbbbbbbb ", +" bb...bbbb.......bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ", +" bb..bbb.........b..............bbbbbbbbbbbbbbbbb ", +" bb.bbb..........b...bbb........bbbbbbbbbbbbbbbbb ", +" bb.........b..b.b..bbbbb.......bbbbbbbbbbbbbbbbb ", +" bb.....b..b..b..b..b.bbb.....b.brrrrrrrrrrrrrrbb ", +" bb....b..b..b..bb....bbb....bb.brrrrrrrrrrrrrrbb ", +" bb...bb.bbbbbbb.b....bbb....bb.brrrrrrrrrrrrrrbb ", +" bb..bbbbb......bb...bbbbb...b..brrrrrrrrrrrrrrbb ", +" bb.bbb..........b.bbbbbbbbbbb..brrrrrrrrrrrrrrbb ", +" bb..............b.b.bbbbbbbbb..brrrrrrrrrrrrrrbb ", +" bbbbbbbbbbbbbbbbb.b.b....bbbb..bbbbbbbbbbbbbbbbb ", +" bbbbbbbbbbbbbbbbb...b.....b.b..b..............bb ", +" bbbbbbbbbbbbbbbbb........bb.bb.b...b..b.......bb ", +" bbbbbbbbbbbbbbbb........b..b..b..b..b...b...bb ", +" bbbbbbbbbbbbbbbb.......b..b...b.b..b...b....bb ", +" bbbbbbbbbbbbbbbbb............b.bbbbbbbbbb...bb ", +" bbrrrrrrrrrrrrrrb..........bbbb........bb.bb ", +" bbrrrrrrrrrrrrrrrb........bbbb............bb ", +" bbrrrrrrrrrrrrrrrbbbbbbbb.......b..b....bb ", +" bbrrrrrrrrrrrrrrrrrrbb.....b...b..b..b..bb ", +" bbrrrrrrrrrrrrrrrrrbb....b...b..b..b..bb ", +" bbrrrrrrrrrrrrrrrrrbb...bb.bbbbbbbb...bb ", +" bbbbbbbbbbbbbbbbbbbb...bbbb......bb.bb ", +" bbbbbbbbbbbbbbbbbbb..bbb...........b ", +" bbbbbbbbbbbbbbbbbbb.bbb...........bb ", +" bbbbbbbbbbbbbbbbbb..............bb ", +" bbbbbbbbbbbbbbbbb...b.b.b.....bb ", +" bbbbbbbbbbbbbbbb..b.b.b..b..bb ", +" bbrrrrrrrrrrrbb..bbbbbbb..bb ", +" bbrrrrrrrrrrbb.bbb....b.bb ", +" bbrrrrrrrrrbb.bb......bb ", +" bbbrrrrrrrbb.......bbb ", +" bbbbrrrrrbb.....bbbb ", +" bbbbrrrbb...bbbb ", +" bbbbrbb.bbbb ", +" bbbbbbbb ", +" bbbb ", +" bb ", +" " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/stopsign.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/stopsign.xpm new file mode 100644 index 00000000..c4bd8e57 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/stopsign.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char * stopsign[] = { +/* stopsign pixmap + * width height ncolors chars_per_pixel */ +"32 32 3 1 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +"X c #FF0000 s s_#FF0000 ", +/* pixels */ +" ............ ", +" . . ", +" . XXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXXXXXX . ", +". XXX XX XX XX XXXX .", +". XX XXX XXX XXX XXX X XXX XXX .", +". XX XXXXXXX XXX XXX X XXX XXX .", +". XX XXXXXXX XXX XXX X XXX XXX .", +". XXX XXXXXX XXX XXX X XXX XXX .", +". XXXX XXXXX XXX XXX X XXXX .", +". XXXXX XXXX XXX XXX X XXXXXXX .", +". XXXXXX XXX XXX XXX X XXXXXXX .", +". XXXXXX XXX XXX XXX X XXXXXXX .", +". XXXXXX XXX XXX XXX X XXXXXXX .", +". XX XXX XXX XXX XXX X XXXXXXX .", +". XXX XXXX XXXX XX XXXXXXX .", +" . XXXXXXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXXXX . ", +" . XXXXXXXXXXXX . ", +" . . ", +" ............ " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/umbrella.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/umbrella.xpm new file mode 100644 index 00000000..449182e0 --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/umbrella.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * umbrella[] = { +/* umbrella pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . ", +" . ", +" . . . . . . . . . ", +" . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +" . . . . . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . ", +" . . . ", +" . . . . ", +" . . . . . . ", +" . . . . . . . ", +" . . . . . . . ", +" . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/icons/xpm3icons/wingdogs.xpm b/vendor/x11iraf/xpm/icons/xpm3icons/wingdogs.xpm new file mode 100644 index 00000000..babee86f --- /dev/null +++ b/vendor/x11iraf/xpm/icons/xpm3icons/wingdogs.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char * wingdogs[] = { +/* wingdogs pixmap + * width height ncolors chars_per_pixel */ +"32 32 2 2 ", +" c #FFFFFFFFFFFF s s_#FFFFFFFFFFFF ", +". c #000 s s_#000 ", +/* pixels */ +" . . ", +" . . ", +" . . . ", +" . . . . . ", +" . . . . . . ", +" . . . . . . . . . . ", +" . . . . . . . . . . . . ", +" . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . ", +". . . . . . . . . . . . . . ", +". . . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . . . . . . . . . ", +". . . . . . . . . ", +". . . . . . . . . ", +". . . . . . . . . . " +} ; diff --git a/vendor/x11iraf/xpm/misc.c b/vendor/x11iraf/xpm/misc.c new file mode 100644 index 00000000..071b655c --- /dev/null +++ b/vendor/x11iraf/xpm/misc.c @@ -0,0 +1,293 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* misc.c: * +* * +* XPM library * +* Miscellaneous utilities * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:stat.h" +#include "sys$library:fcntl.h" +#else +#include <sys/stat.h> +#include <fcntl.h> +#endif + +/* + * Free the computed color table + */ +void +xpmFreeColorTable(colorTable, ncolors) + XpmColor *colorTable; + int ncolors; +{ + int a, b; + XpmColor *color; + xpmColorDefaults defaults; + char **sptr; + + if (colorTable) { + for (a = 0, color = colorTable; a < ncolors; a++, color++) { + defaults = (xpmColorDefaults) color; + for (b = 0, sptr = (char **) defaults; b <= NKEYS; b++, sptr++) + if (*sptr) + XpmFree(*sptr); + } + XpmFree(colorTable); + } +} + + +/* + * Free array of extensions + */ +void +XpmFreeExtensions(extensions, nextensions) + XpmExtension *extensions; + int nextensions; +{ + unsigned int i, j, nlines; + XpmExtension *ext; + char **sptr; + + if (extensions) { + for (i = 0, ext = extensions; i < nextensions; i++, ext++) { + if (ext->name) + XpmFree(ext->name); + nlines = ext->nlines; + for (j = 0, sptr = ext->lines; j < nlines; j++, sptr++) + if (*sptr) + XpmFree(*sptr); + if (ext->lines) + XpmFree(ext->lines); + } + XpmFree(extensions); + } +} + + +/* + * Return the XpmAttributes structure size + */ + +int +XpmAttributesSize() +{ + return sizeof(XpmAttributes); +} + +/* + * Init returned data to free safely later on + */ +void +xpmInitAttributes(attributes) + XpmAttributes *attributes; +{ + if (attributes) { + attributes->pixels = NULL; + attributes->npixels = 0; + attributes->extensions = NULL; + attributes->nextensions = 0; + } +} + +/* + * Free the XpmAttributes structure members + * but the structure itself + */ +void +XpmFreeAttributes(attributes) + XpmAttributes *attributes; +{ + if (attributes) { + if (attributes->valuemask & XpmReturnPixels && attributes->npixels) { + XpmFree(attributes->pixels); + attributes->pixels = NULL; + attributes->npixels = 0; + } + if (attributes->valuemask & XpmReturnExtensions + && attributes->nextensions) { + XpmFreeExtensions(attributes->extensions, attributes->nextensions); + attributes->extensions = NULL; + attributes->nextensions = 0; + } + attributes->valuemask = 0; + } +} + +/* + * Init returned data to free safely later on + */ +void +xpmInitXpmImage(image) + XpmImage *image; +{ + image->ncolors = 0; + image->colorTable = NULL; + image->data = NULL; +} + +/* + * Free the XpmImage data which have been allocated + */ +void +XpmFreeXpmImage(image) + XpmImage *image; +{ + if (image->colorTable) + xpmFreeColorTable(image->colorTable, image->ncolors); + XpmFree(image->data); + image->data = NULL; +} + +/* + * Init returned data to free safely later on + */ +void +xpmInitXpmInfos(infos) + XpmInfos *infos; +{ + if (infos) { + infos->hints_cmt = NULL; + infos->colors_cmt = NULL; + infos->pixels_cmt = NULL; + } +} + +/* + * Free the XpmInfos data which have been allocated + */ +void +XpmFreeXpmInfos(infos) + XpmInfos *infos; +{ + if (infos) { + if (infos->hints_cmt) { + XpmFree(infos->hints_cmt); + infos->hints_cmt = NULL; + } + if (infos->colors_cmt) { + XpmFree(infos->colors_cmt); + infos->colors_cmt = NULL; + } + if (infos->pixels_cmt) { + XpmFree(infos->pixels_cmt); + infos->pixels_cmt = NULL; + } + } +} + + +#ifdef NEED_STRDUP +/* + * in case strdup is not provided by the system here is one + * which does the trick + */ +char * +strdup(s1) + char *s1; +{ + char *s2; + int l = strlen(s1) + 1; + + if (s2 = (char *) XpmMalloc(l)) + strncpy(s2, s1, l); + return s2; +} + +#endif + +/* + * File / Buffer utilities + */ +int +XpmReadFileToBuffer(filename, buffer_return) + char *filename; + char **buffer_return; +{ + int fd, fcheck, len; + char *ptr; + struct stat stats; + FILE *fp; + + *buffer_return = NULL; + + fd = open(filename, O_RDONLY); + if (fd < 0) + return XpmOpenFailed; + + if (fstat(fd, &stats)) { + close(fd); + return XpmOpenFailed; + } + fp = fdopen(fd, "r"); + if (!fp) { + close(fd); + return XpmOpenFailed; + } + len = (int) stats.st_size; + ptr = (char *) XpmMalloc(len + 1); + if (!ptr) { + fclose(fp); + return XpmNoMemory; + } + fcheck = fread(ptr, len, 1, fp); + fclose(fp); + if (fcheck != 1) { + XpmFree(ptr); + return XpmOpenFailed; + } + ptr[len] = '\0'; + *buffer_return = ptr; + return XpmSuccess; +} + +int +XpmWriteFileFromBuffer(filename, buffer) + char *filename; + char *buffer; +{ + int fcheck, len; + FILE *fp = fopen(filename, "w"); + + if (!fp) + return XpmOpenFailed; + + len = strlen(buffer); + fcheck = fwrite(buffer, len, 1, fp); + fclose(fp); + if (fcheck != 1) + return XpmOpenFailed; + + return XpmSuccess; +} + + +/* + * Small utility function + */ +char * +XpmGetErrorString(errcode) + int errcode; +{ + switch (errcode) { + case XpmColorError: + return ("XpmColorError"); + case XpmSuccess: + return ("XpmSuccess"); + case XpmOpenFailed: + return ("XpmOpenFailed"); + case XpmFileInvalid: + return ("XpmFileInvalid"); + case XpmNoMemory: + return ("XpmNoMemory"); + case XpmColorFailed: + return ("XpmColorFailed"); + default: + return ("Invalid XpmError"); + } +} diff --git a/vendor/x11iraf/xpm/parse.c b/vendor/x11iraf/xpm/parse.c new file mode 100644 index 00000000..e178c252 --- /dev/null +++ b/vendor/x11iraf/xpm/parse.c @@ -0,0 +1,657 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* parse.c: * +* * +* XPM library * +* Parse an XPM file or array and store the found informations * +* in the given XpmImage structure. * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:ctype.h" +#else +#include <ctype.h> +#endif + +LFUNC(ParseValues, int, (xpmData *data, unsigned int *width, + unsigned int *height, unsigned int *ncolors, + unsigned int *cpp, unsigned int *x_hotspot, + unsigned int *y_hotspot, unsigned int *hotspot, + unsigned int *extensions)); + +LFUNC(ParseColors, int, (xpmData *data, unsigned int ncolors, unsigned int cpp, + XpmColor **colorTablePtr, xpmHashTable *hashtable)); + +LFUNC(ParsePixels, int, (xpmData *data, unsigned int width, + unsigned int height, unsigned int ncolors, + unsigned int cpp, XpmColor *colorTable, + xpmHashTable *hashtable, unsigned int **pixels)); + +LFUNC(ParseExtensions, int, (xpmData *data, XpmExtension **extensions, + unsigned int *nextensions)); + +char *xpmColorKeys[] = { + "s", /* key #1: symbol */ + "m", /* key #2: mono visual */ + "g4", /* key #3: 4 grays visual */ + "g", /* key #4: gray visual */ + "c", /* key #5: color visual */ +}; + + +/* function call in case of error, frees only locally allocated variables */ +#undef RETURN +#define RETURN(status) \ +{ \ + if (colorTable) xpmFreeColorTable(colorTable, ncolors); \ + if (pixelindex) XpmFree(pixelindex); \ + if (hints_cmt) XpmFree(hints_cmt); \ + if (colors_cmt) XpmFree(colors_cmt); \ + if (pixels_cmt) XpmFree(pixels_cmt); \ + return(status); \ +} + +/* + * This function parses an Xpm file or data and store the found informations + * in an an xpmInternAttrib structure which is returned. + */ +int +xpmParseData(data, image_return, attributes, infos) + xpmData *data; + XpmImage *image_return; + XpmAttributes *attributes; + XpmInfos *infos; +{ + /* variables to return */ + unsigned int width, height, ncolors, cpp; + unsigned int x_hotspot, y_hotspot, hotspot = 0, extensions = 0; + XpmColor *colorTable = NULL; + unsigned int *pixelindex = NULL; + char *hints_cmt = NULL; + char *colors_cmt = NULL; + char *pixels_cmt = NULL; + + int ErrorStatus; + xpmHashTable hashtable; + + /* + * parse the header + */ + ErrorStatus = xpmParseHeader(data); + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + /* + * read values + */ + ErrorStatus = ParseValues(data, &width, &height, &ncolors, &cpp, + &x_hotspot, &y_hotspot, &hotspot, &extensions); + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + + /* + * store the hints comment line + */ + if (infos) + xpmGetCmt(data, &hints_cmt); + + /* + * init the hastable + */ + if (USE_HASHTABLE) { + ErrorStatus = xpmHashTableInit(&hashtable); + if (ErrorStatus != XpmSuccess) + return (ErrorStatus); + } + + /* + * read colors + */ + ErrorStatus = ParseColors(data, ncolors, cpp, &colorTable, &hashtable); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + /* + * store the colors comment line + */ + if (infos) + xpmGetCmt(data, &colors_cmt); + + /* + * read pixels and index them on color number + */ + ErrorStatus = ParsePixels(data, width, height, ncolors, cpp, colorTable, + &hashtable, &pixelindex); + + /* + * free the hastable + */ + if (USE_HASHTABLE) + xpmHashTableFree(&hashtable); + + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + /* + * store the pixels comment line + */ + if (infos) + xpmGetCmt(data, &pixels_cmt); + + /* + * parse extensions + */ + if (attributes && (attributes->valuemask & XpmReturnExtensions)) + if (extensions) { + ErrorStatus = ParseExtensions(data, &attributes->extensions, + &attributes->nextensions); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + } else { + attributes->extensions = NULL; + attributes->nextensions = 0; + } + + /* + * store found informations in the XpmImage structure + */ + image_return->width = width; + image_return->height = height; + image_return->cpp = cpp; + image_return->ncolors = ncolors; + image_return->colorTable = colorTable; + image_return->data = pixelindex; + + if (attributes) { + if (hotspot) { + attributes->x_hotspot = x_hotspot; + attributes->y_hotspot = y_hotspot; + attributes->valuemask |= XpmHotspot; + } + attributes->width = width; + attributes->height = height; + } + if (infos) { + infos->hints_cmt = hints_cmt; + infos->colors_cmt = colors_cmt; + infos->pixels_cmt = pixels_cmt; + } + return (XpmSuccess); +} + +static int +ParseValues(data, width, height, ncolors, cpp, + x_hotspot, y_hotspot, hotspot, extensions) + xpmData *data; + unsigned int *width, *height, *ncolors, *cpp; + unsigned int *x_hotspot, *y_hotspot, *hotspot; + unsigned int *extensions; +{ + unsigned int l; + char buf[BUFSIZ]; + + if (!data->format) { /* XPM 2 or 3 */ + + /* + * read values: width, height, ncolors, chars_per_pixel + */ + if (!(xpmNextUI(data, width) && xpmNextUI(data, height) + && xpmNextUI(data, ncolors) && xpmNextUI(data, cpp))) + return (XpmFileInvalid); + + /* + * read optional information (hotspot and/or XPMEXT) if any + */ + l = xpmNextWord(data, buf, BUFSIZ); + if (l) { + *extensions = (l == 6 && !strncmp("XPMEXT", buf, 6)); + if (*extensions) + *hotspot = (xpmNextUI(data, x_hotspot) + && xpmNextUI(data, y_hotspot)); + else { + *hotspot = (atoui(buf, l, x_hotspot) + && xpmNextUI(data, y_hotspot)); + l = xpmNextWord(data, buf, BUFSIZ); + *extensions = (l == 6 && !strncmp("XPMEXT", buf, 6)); + } + } + } else { + + /* + * XPM 1 file read values: width, height, ncolors, chars_per_pixel + */ + int i; + char *ptr; + + for (i = 0; i < 4; i++) { + l = xpmNextWord(data, buf, BUFSIZ); + if (l != 7 || strncmp("#define", buf, 7)) + return (XpmFileInvalid); + l = xpmNextWord(data, buf, BUFSIZ); + if (!l) + return (XpmFileInvalid); + ptr = index(buf, '_'); + if (!ptr) + return (XpmFileInvalid); + switch (l - (ptr - buf)) { + case 6: + if (!strncmp("_width", ptr, 6) && !xpmNextUI(data, width)) + return (XpmFileInvalid); + break; + case 7: + if (!strncmp("_height", ptr, 7) && !xpmNextUI(data, height)) + return (XpmFileInvalid); + break; + case 8: + if (!strncmp("_ncolors", ptr, 8) && !xpmNextUI(data, ncolors)) + return (XpmFileInvalid); + break; + case 16: + if (!strncmp("_chars_per_pixel", ptr, 16) + && !xpmNextUI(data, cpp)) + return (XpmFileInvalid); + break; + default: + return (XpmFileInvalid); + } + /* skip the end of line */ + xpmNextString(data); + } + *hotspot = 0; + *extensions = 0; + } + return (XpmSuccess); +} + +static int +ParseColors(data, ncolors, cpp, colorTablePtr, hashtable) + xpmData *data; + unsigned int ncolors; + unsigned int cpp; + XpmColor **colorTablePtr; + xpmHashTable *hashtable; +{ + unsigned int key, l, a, b; + unsigned int curkey; /* current color key */ + unsigned int lastwaskey; /* key read */ + char buf[BUFSIZ]; + char curbuf[BUFSIZ]; /* current buffer */ + char **sptr, *s; + XpmColor *color; + XpmColor *colorTable; + xpmColorDefaults defaults; + int ErrorStatus; + + colorTable = (XpmColor *) XpmCalloc(ncolors, sizeof(XpmColor)); + if (!colorTable) + return (XpmNoMemory); + + if (!data->format) { /* XPM 2 or 3 */ + for (a = 0, color = colorTable; a < ncolors; a++, color++) { + xpmNextString(data); /* skip the line */ + + /* + * read pixel value + */ + color->string = (char *) XpmMalloc(cpp + 1); + if (!color->string) { + xpmFreeColorTable(colorTable, ncolors); + return (XpmNoMemory); + } + for (b = 0, s = color->string; b < cpp; b++, s++) + *s = xpmGetC(data); + *s = '\0'; + + /* + * store the string in the hashtable with its color index number + */ + if (USE_HASHTABLE) { + ErrorStatus = + xpmHashIntern(hashtable, color->string, HashAtomData(a)); + if (ErrorStatus != XpmSuccess) { + xpmFreeColorTable(colorTable, ncolors); + return (ErrorStatus); + } + } + + /* + * read color keys and values + */ + defaults = (xpmColorDefaults) color; + curkey = 0; + lastwaskey = 0; + *curbuf = '\0'; /* init curbuf */ + while (l = xpmNextWord(data, buf, BUFSIZ)) { + if (!lastwaskey) { + for (key = 0, sptr = xpmColorKeys; key < NKEYS; key++, + sptr++) + if ((strlen(*sptr) == l) && (!strncmp(*sptr, buf, l))) + break; + } + if (!lastwaskey && key < NKEYS) { /* open new key */ + if (curkey) { /* flush string */ + s = (char *) XpmMalloc(strlen(curbuf) + 1); + if (!s) { + xpmFreeColorTable(colorTable, ncolors); + return (XpmNoMemory); + } + defaults[curkey] = s; + strcpy(s, curbuf); + } + curkey = key + 1; /* set new key */ + *curbuf = '\0'; /* reset curbuf */ + lastwaskey = 1; + } else { + if (!curkey) { /* key without value */ + xpmFreeColorTable(colorTable, ncolors); + return (XpmFileInvalid); + } + if (!lastwaskey) + strcat(curbuf, " "); /* append space */ + buf[l] = '\0'; + strcat(curbuf, buf);/* append buf */ + lastwaskey = 0; + } + } + if (!curkey) { /* key without value */ + xpmFreeColorTable(colorTable, ncolors); + return (XpmFileInvalid); + } + s = defaults[curkey] = (char *) XpmMalloc(strlen(curbuf) + 1); + if (!s) { + xpmFreeColorTable(colorTable, ncolors); + return (XpmNoMemory); + } + strcpy(s, curbuf); + } + } else { /* XPM 1 */ + /* get to the beginning of the first string */ + data->Bos = '"'; + data->Eos = '\0'; + xpmNextString(data); + data->Eos = '"'; + for (a = 0, color = colorTable; a < ncolors; a++, color++) { + + /* + * read pixel value + */ + color->string = (char *) XpmMalloc(cpp + 1); + if (!color->string) { + xpmFreeColorTable(colorTable, ncolors); + return (XpmNoMemory); + } + for (b = 0, s = color->string; b < cpp; b++, s++) + *s = xpmGetC(data); + *s = '\0'; + + /* + * store the string in the hashtable with its color index number + */ + if (USE_HASHTABLE) { + ErrorStatus = + xpmHashIntern(hashtable, color->string, HashAtomData(a)); + if (ErrorStatus != XpmSuccess) { + xpmFreeColorTable(colorTable, ncolors); + return (ErrorStatus); + } + } + + /* + * read color values + */ + xpmNextString(data); /* get to the next string */ + *curbuf = '\0'; /* init curbuf */ + while (l = xpmNextWord(data, buf, BUFSIZ)) { + if (*curbuf != '\0') + strcat(curbuf, " ");/* append space */ + buf[l] = '\0'; + strcat(curbuf, buf); /* append buf */ + } + s = (char *) XpmMalloc(strlen(curbuf) + 1); + if (!s) { + xpmFreeColorTable(colorTable, ncolors); + return (XpmNoMemory); + } + strcpy(s, curbuf); + color->c_color = s; + *curbuf = '\0'; /* reset curbuf */ + if (a < ncolors - 1) + xpmNextString(data); /* get to the next string */ + } + } + *colorTablePtr = colorTable; + return (XpmSuccess); +} + +static int +ParsePixels(data, width, height, ncolors, cpp, colorTable, hashtable, pixels) + xpmData *data; + unsigned int width; + unsigned int height; + unsigned int ncolors; + unsigned int cpp; + XpmColor *colorTable; + xpmHashTable *hashtable; + unsigned int **pixels; +{ + unsigned int *iptr, *iptr2; + unsigned int a, x, y; + + iptr2 = (unsigned int *) XpmMalloc(sizeof(unsigned int) * width * height); + if (!iptr2) + return (XpmNoMemory); + + iptr = iptr2; + + switch (cpp) { + + case (1): /* Optimize for single character + * colors */ + { + unsigned short colidx[256]; + + memset(colidx, 0, 256 * sizeof(short)); + for (a = 0; a < ncolors; a++) + colidx[colorTable[a].string[0]] = a + 1; + + for (y = 0; y < height; y++) { + xpmNextString(data); + for (x = 0; x < width; x++, iptr++) { + int idx = colidx[xpmGetC(data)]; + + if (idx != 0) + *iptr = idx - 1; + else { + XpmFree(iptr2); + return (XpmFileInvalid); + } + } + } + } + break; + + case (2): /* Optimize for double character + * colors */ + { + unsigned short cidx[256][256]; + + memset(cidx, 0, 256 * 256 * sizeof(short)); + for (a = 0; a < ncolors; a++) + cidx[colorTable[a].string[0]][colorTable[a].string[1]] = a + 1; + + for (y = 0; y < height; y++) { + xpmNextString(data); + for (x = 0; x < width; x++, iptr++) { + int cc1 = xpmGetC(data); + int idx = cidx[cc1][xpmGetC(data)]; + + if (idx != 0) + *iptr = idx - 1; + else { + XpmFree(iptr2); + return (XpmFileInvalid); + } + } + } + } + break; + + default: /* Non-optimized case of long color + * names */ + { + char *s; + char buf[BUFSIZ]; + + buf[cpp] = '\0'; + if (USE_HASHTABLE) { + xpmHashAtom *slot; + + for (y = 0; y < height; y++) { + xpmNextString(data); + for (x = 0; x < width; x++, iptr++) { + for (a = 0, s = buf; a < cpp; a++, s++) + *s = xpmGetC(data); + slot = xpmHashSlot(hashtable, buf); + if (!*slot) { /* no color matches */ + XpmFree(iptr2); + return (XpmFileInvalid); + } + *iptr = HashColorIndex(slot); + } + } + } else { + for (y = 0; y < height; y++) { + xpmNextString(data); + for (x = 0; x < width; x++, iptr++) { + for (a = 0, s = buf; a < cpp; a++, s++) + *s = xpmGetC(data); + for (a = 0; a < ncolors; a++) + if (!strcmp(colorTable[a].string, buf)) + break; + if (a == ncolors) { /* no color matches */ + XpmFree(iptr2); + return (XpmFileInvalid); + } + *iptr = a; + } + } + } + } + break; + } + *pixels = iptr2; + return (XpmSuccess); +} + +static int +ParseExtensions(data, extensions, nextensions) + xpmData *data; + XpmExtension **extensions; + unsigned int *nextensions; +{ + XpmExtension *exts = NULL, *ext; + unsigned int num = 0; + unsigned int nlines, a, l, notstart, notend = 0; + int status; + char *string, *s, *s2, **sp; + + xpmNextString(data); + exts = (XpmExtension *) XpmMalloc(sizeof(XpmExtension)); + /* get the whole string */ + status = xpmGetString(data, &string, &l); + if (status != XpmSuccess) { + XpmFree(exts); + return (status); + } + /* look for the key word XPMEXT, skip lines before this */ + while ((notstart = strncmp("XPMEXT", string, 6)) + && (notend = strncmp("XPMENDEXT", string, 9))) { + XpmFree(string); + xpmNextString(data); + status = xpmGetString(data, &string, &l); + if (status != XpmSuccess) { + XpmFree(exts); + return (status); + } + } + if (!notstart) + notend = strncmp("XPMENDEXT", string, 9); + while (!notstart && notend) { + /* there starts an extension */ + ext = (XpmExtension *) + XpmRealloc(exts, (num + 1) * sizeof(XpmExtension)); + if (!ext) { + XpmFree(string); + XpmFreeExtensions(exts, num); + return (XpmNoMemory); + } + exts = ext; + ext += num; + /* skip whitespace and store its name */ + s2 = s = string + 6; + while (isspace(*s2)) + s2++; + a = s2 - s; + ext->name = (char *) XpmMalloc(l - a - 6); + if (!ext->name) { + XpmFree(string); + ext->lines = NULL; + ext->nlines = 0; + XpmFreeExtensions(exts, num + 1); + return (XpmNoMemory); + } + strncpy(ext->name, s + a, l - a - 6); + XpmFree(string); + /* now store the related lines */ + xpmNextString(data); + status = xpmGetString(data, &string, &l); + if (status != XpmSuccess) { + ext->lines = NULL; + ext->nlines = 0; + XpmFreeExtensions(exts, num + 1); + return (status); + } + ext->lines = (char **) XpmMalloc(sizeof(char *)); + nlines = 0; + while ((notstart = strncmp("XPMEXT", string, 6)) + && (notend = strncmp("XPMENDEXT", string, 9))) { + sp = (char **) + XpmRealloc(ext->lines, (nlines + 1) * sizeof(char *)); + if (!sp) { + XpmFree(string); + ext->nlines = nlines; + XpmFreeExtensions(exts, num + 1); + return (XpmNoMemory); + } + ext->lines = sp; + ext->lines[nlines] = string; + nlines++; + xpmNextString(data); + status = xpmGetString(data, &string, &l); + if (status != XpmSuccess) { + ext->nlines = nlines; + XpmFreeExtensions(exts, num + 1); + return (status); + } + } + if (!nlines) { + XpmFree(ext->lines); + ext->lines = NULL; + } + ext->nlines = nlines; + num++; + } + if (!num) { + XpmFree(string); + XpmFree(exts); + exts = NULL; + } else if (!notend) + XpmFree(string); + *nextensions = num; + *extensions = exts; + return (XpmSuccess); +} diff --git a/vendor/x11iraf/xpm/rgb.c b/vendor/x11iraf/xpm/rgb.c new file mode 100644 index 00000000..dd9d1b94 --- /dev/null +++ b/vendor/x11iraf/xpm/rgb.c @@ -0,0 +1,136 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* rgb.c: * +* * +* XPM library * +* Rgb file utilities * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +/* + * Part of this code has been taken from the ppmtoxpm.c file written by Mark + * W. Snitily but has been modified for my special need + */ + +#include "xpmP.h" +#ifdef VMS +#include "sys$library:ctype.h" +#include "sys$library:string.h" +#else +#include <ctype.h> +#if defined(SYSV) || defined(SVR4) +#include <string.h> +#else +#include <strings.h> +#endif +#endif + +/* + * Read a rgb text file. It stores the rgb values (0->65535) + * and the rgb mnemonics (malloc'ed) into the "rgbn" array. Returns the + * number of entries stored. + */ +int +xpmReadRgbNames(rgb_fname, rgbn) + char *rgb_fname; + xpmRgbName rgbn[]; + +{ + FILE *rgbf; + int i, items, red, green, blue; + char line[512], name[512], *rgbname, *n, *m; + xpmRgbName *rgb; + + /* Open the rgb text file. Abort if error. */ + if ((rgbf = fopen(rgb_fname, "r")) == NULL) + return 0; + + /* Loop reading each line in the file. */ + for (i = 0, rgb = rgbn; fgets(line, sizeof(line), rgbf); i++, rgb++) { + + /* Quit if rgb text file is too large. */ + if (i == MAX_RGBNAMES) { + /* Too many entries in rgb text file, give up here */ + break; + } + /* Read the line. Skip silently if bad. */ + items = sscanf(line, "%d %d %d %[^\n]\n", &red, &green, &blue, name); + if (items != 4) { + i--; + continue; + } + + /* + * Make sure rgb values are within 0->255 range. Skip silently if + * bad. + */ + if (red < 0 || red > 0xFF || + green < 0 || green > 0xFF || + blue < 0 || blue > 0xFF) { + i--; + continue; + } + /* Allocate memory for ascii name. If error give up here. */ + if (!(rgbname = (char *) XpmMalloc(strlen(name) + 1))) + break; + + /* Copy string to ascii name and lowercase it. */ + for (n = name, m = rgbname; *n; n++) + *m++ = isupper(*n) ? tolower(*n) : *n; + *m = '\0'; + + /* Save the rgb values and ascii name in the array. */ + rgb->r = red * 257; /* 65535/255 = 257 */ + rgb->g = green * 257; + rgb->b = blue * 257; + rgb->name = rgbname; + } + + fclose(rgbf); + + /* Return the number of read rgb names. */ + return i < 0 ? 0 : i; +} + +/* + * Return the color name corresponding to the given rgb values + */ +char * +xpmGetRgbName(rgbn, rgbn_max, red, green, blue) + xpmRgbName rgbn[]; /* rgb mnemonics from rgb text file */ + int rgbn_max; /* number of rgb mnemonics in table */ + int red, green, blue; /* rgb values */ + +{ + int i; + xpmRgbName *rgb; + + /* + * Just perform a dumb linear search over the rgb values of the color + * mnemonics. One could speed things up by sorting the rgb values and + * using a binary search, or building a hash table, etc... + */ + for (i = 0, rgb = rgbn; i < rgbn_max; i++, rgb++) + if (red == rgb->r && green == rgb->g && blue == rgb->b) + return rgb->name; + + /* if not found return NULL */ + return NULL; +} + +/* + * Free the strings which have been malloc'ed in xpmReadRgbNames + */ +void +xpmFreeRgbNames(rgbn, rgbn_max) + xpmRgbName rgbn[]; + int rgbn_max; + +{ + int i; + xpmRgbName *rgb; + + for (i = 0, rgb = rgbn; i < rgbn_max; i++, rgb++) + XpmFree(rgb->name); +} diff --git a/vendor/x11iraf/xpm/scan.c b/vendor/x11iraf/xpm/scan.c new file mode 100644 index 00000000..53927c78 --- /dev/null +++ b/vendor/x11iraf/xpm/scan.c @@ -0,0 +1,722 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* scan.c: * +* * +* XPM library * +* Scanning utility for XPM file format * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#include "xpmP.h" + +#define MAXPRINTABLE 92 /* number of printable ascii chars + * minus \ and " for string compat + * and ? to avoid ANSI trigraphs. */ + +static char *printable = +" .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjklzxcvbnmMNBVCZ\ +ASDFGHJKLPIUYTREWQ!~^/()_`'][{}|"; + +/* + * printable begin with a space, so in most case, due to my algorithm, when + * the number of different colors is less than MAXPRINTABLE, it will give a + * char follow by "nothing" (a space) in the readable xpm file + */ + + +typedef struct { + Pixel *pixels; + unsigned int *pixelindex; + unsigned int size; + unsigned int ncolors; + unsigned int mask_pixel; /* whether there is or not */ +} PixelsMap; + +LFUNC(storePixel, int, (Pixel pixel, PixelsMap *pmap, + unsigned int *index_return)); + +LFUNC(storeMaskPixel, int, (Pixel pixel, PixelsMap *pmap, + unsigned int *index_return)); + +LFUNC(GetImagePixels, int, (XImage *image, unsigned int width, + unsigned int height, PixelsMap *pmap)); + +LFUNC(GetImagePixels32, int, (XImage *image, unsigned int width, + unsigned int height, PixelsMap *pmap)); + +LFUNC(GetImagePixels16, int, (XImage *image, unsigned int width, + unsigned int height, PixelsMap *pmap)); + +LFUNC(GetImagePixels8, int, (XImage *image, unsigned int width, + unsigned int height, PixelsMap *pmap)); + +LFUNC(GetImagePixels1, int, (XImage *image, unsigned int width, + unsigned int height, PixelsMap *pmap, + int (*storeFunc) ())); + +LFUNC(ScanTransparentColor, int, (XpmColor *color, unsigned int cpp)); + +LFUNC(ScanOtherColors, int, (Display *display, XpmColor *colors, int ncolors, + Pixel *pixels, unsigned int cpp, + XpmAttributes *attributes)); + +/* + * This function stores the given pixel in the given arrays which are grown + * if not large enough. + */ +static int +storePixel(pixel, pmap, index_return) + Pixel pixel; + PixelsMap *pmap; + unsigned int *index_return; +{ + unsigned int a; + Pixel *p; + unsigned int ncolors; + + if (*index_return) { /* this is a transparent pixel! */ + *index_return = 0; + return 0; + } + ncolors = pmap->ncolors; + p = &(pmap->pixels[pmap->mask_pixel]); + for (a = pmap->mask_pixel; a < ncolors; a++, p++) + if (*p == pixel) + break; + if (a == ncolors) { + if (ncolors >= pmap->size) { + pmap->size *= 2; + p = (Pixel *) XpmRealloc(pmap->pixels, sizeof(Pixel) * pmap->size); + if (!p) + return (1); + pmap->pixels = p; + + } + (pmap->pixels)[ncolors] = pixel; + pmap->ncolors++; + } + *index_return = a; + return 0; +} + +static int +storeMaskPixel(pixel, pmap, index_return) + Pixel pixel; + PixelsMap *pmap; + unsigned int *index_return; +{ + if (!pixel) { + if (!pmap->ncolors) { + pmap->ncolors = 1; + (pmap->pixels)[0] = 0; + pmap->mask_pixel = 1; + } + *index_return = 1; + } else + *index_return = 0; + return 0; +} + +/* function call in case of error, frees only locally allocated variables */ +#undef RETURN +#define RETURN(status) \ +{ \ + if (pmap.pixelindex) XpmFree(pmap.pixelindex); \ + if (pmap.pixels) XpmFree(pmap.pixels); \ + if (colorTable) xpmFreeColorTable(colorTable, pmap.ncolors); \ + return(status); \ +} + +/* + * This function scans the given image and stores the found informations in + * the given XpmImage structure. + */ +int +XpmCreateXpmImageFromImage(display, image, shapeimage, + xpmimage, attributes) + Display *display; + XImage *image; + XImage *shapeimage; + XpmImage *xpmimage; + XpmAttributes *attributes; +{ + /* variables stored in the XpmAttributes structure */ + unsigned int cpp; + + /* variables to return */ + PixelsMap pmap; + XpmColor *colorTable = NULL; + int ErrorStatus; + + /* calculation variables */ + unsigned int width = 0; + unsigned int height = 0; + unsigned int cppm; /* minimum chars per pixel */ + unsigned int c; + unsigned int offset; + + /* initialize pmap */ + pmap.pixels = NULL; + pmap.pixelindex = NULL; + pmap.size = 256; /* should be enough most of the time */ + pmap.ncolors = 0; + pmap.mask_pixel = 0; + + /* + * get geometry + */ + if (image) { + width = image->width; + height = image->height; + } else if (shapeimage) { + width = shapeimage->width; + height = shapeimage->height; + } + + /* + * retrieve information from the XpmAttributes + */ + if (attributes && (attributes->valuemask & XpmCharsPerPixel)) + cpp = attributes->cpp; + else + cpp = 0; + + pmap.pixelindex = + (unsigned int *) XpmCalloc(width * height, sizeof(unsigned int)); + if (!pmap.pixelindex) + RETURN(XpmNoMemory); + + pmap.pixels = (Pixel *) XpmMalloc(sizeof(Pixel) * pmap.size); + if (!pmap.pixels) + RETURN(XpmNoMemory); + + /* + * scan shape mask if any + */ + if (shapeimage) { + ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap, + storeMaskPixel); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + } + + /* + * scan the image data + * + * In case depth is 1 or bits_per_pixel is 4, 6, 8, 24 or 32 use optimized + * functions, otherwise use slower but sure general one. + * + */ + + if (image) { + if (image->depth == 1) + ErrorStatus = GetImagePixels1(image, width, height, &pmap, + storePixel); + else if (image->bits_per_pixel == 8) + ErrorStatus = GetImagePixels8(image, width, height, &pmap); + else if (image->bits_per_pixel == 16) + ErrorStatus = GetImagePixels16(image, width, height, &pmap); + else if (image->bits_per_pixel == 32) + ErrorStatus = GetImagePixels32(image, width, height, &pmap); + else + ErrorStatus = GetImagePixels(image, width, height, &pmap); + + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + } + + /* + * get rgb values and a string of char, and possibly a name for each + * color + */ + + colorTable = (XpmColor *) XpmCalloc(pmap.ncolors, sizeof(XpmColor)); + if (!colorTable) + RETURN(XpmNoMemory); + + /* compute the minimal cpp */ + for (cppm = 1, c = MAXPRINTABLE; pmap.ncolors > c; cppm++) + c *= MAXPRINTABLE; + if (cpp < cppm) + cpp = cppm; + + if (pmap.mask_pixel) { + ErrorStatus = ScanTransparentColor(colorTable, cpp); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + offset = 1; + } else + offset = 0; + + ErrorStatus = ScanOtherColors(display, colorTable + offset, + pmap.ncolors - offset, + pmap.pixels, cpp, attributes); + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); + + /* + * store found informations in the XpmImage structure + */ + xpmimage->width = width; + xpmimage->height = height; + xpmimage->cpp = cpp; + xpmimage->ncolors = pmap.ncolors; + xpmimage->colorTable = colorTable; + xpmimage->data = pmap.pixelindex; + + XpmFree(pmap.pixels); + return (XpmSuccess); +} + +static int +ScanTransparentColor(color, cpp) + XpmColor *color; + unsigned int cpp; +{ + char *s; + unsigned int a, b, c; + + /* first get a character string */ + a = 0; + if (!(s = color->string = (char *) XpmMalloc(cpp + 1))) + return (XpmNoMemory); + *s++ = printable[c = a % MAXPRINTABLE]; + for (b = 1; b < cpp; b++, s++) + *s = printable[c = ((a - c) / MAXPRINTABLE) % MAXPRINTABLE]; + *s = '\0'; + + color->c_color = (char*)strdup(TRANSPARENT_COLOR); + if (!color->c_color) + return (XpmNoMemory); + + return (XpmSuccess); +} + +static int +ScanOtherColors(display, colors, ncolors, pixels, cpp, attributes) + Display *display; + XpmColor *colors; + int ncolors; + Pixel *pixels; + unsigned int cpp; + XpmAttributes *attributes; +{ + /* variables stored in the XpmAttributes structure */ + Colormap colormap; + char *rgb_fname; + + xpmRgbName rgbn[MAX_RGBNAMES]; + int rgbn_max = 0; + unsigned int a, b, c; + XpmColor *color; + XColor *xcolors = NULL, *xcolor; + char *colorname, *s; + + /* retrieve information from the XpmAttributes */ + if (attributes && (attributes->valuemask & XpmColormap)) + colormap = attributes->colormap; + else + colormap = DefaultColormap(display, DefaultScreen(display)); + if (attributes && (attributes->valuemask & XpmRgbFilename)) + rgb_fname = attributes->rgb_fname; + else + rgb_fname = NULL; + + /* first get character strings and rgb values */ + xcolors = (XColor *) XpmMalloc(sizeof(XColor) * ncolors); + if (!xcolors) + return (XpmNoMemory); + + for (a = 0, color = colors, xcolor = xcolors; a < ncolors; + a++, color++, xcolor++, pixels++) { + + if (!(s = color->string = (char *) XpmMalloc(cpp + 1))) { + XpmFree(xcolors); + return (XpmNoMemory); + } + *s++ = printable[c = a % MAXPRINTABLE]; + for (b = 1; b < cpp; b++, s++) + *s = printable[c = ((a - c) / MAXPRINTABLE) % MAXPRINTABLE]; + *s = '\0'; + + xcolor->pixel = *pixels; + } + XQueryColors(display, colormap, xcolors, ncolors); + + /* read the rgb file if any was specified */ + if (rgb_fname) + rgbn_max = xpmReadRgbNames(attributes->rgb_fname, rgbn); + + for (a = 0, color = colors, xcolor = xcolors; a < ncolors + ; a++, color++, xcolor++) { + + /* look for a color name */ + colorname = NULL; + if (rgbn_max) + colorname = xpmGetRgbName(rgbn, rgbn_max, xcolor->red, + xcolor->green, xcolor->blue); + if (colorname) + color->c_color = (char*)strdup(colorname); + else { + /* at last store the rgb value */ + char buf[BUFSIZ]; + + sprintf(buf, "#%04X%04X%04X", + xcolor->red, xcolor->green, xcolor->blue); + color->c_color = (char*)strdup(buf); + } + if (!color->c_color) { + XpmFree(xcolors); + xpmFreeRgbNames(rgbn, rgbn_max); + return (XpmNoMemory); + } + } + + XpmFree(xcolors); + xpmFreeRgbNames(rgbn, rgbn_max); + return (XpmSuccess); +} + + +/* + * The functions below are written from X11R5 MIT's code (XImUtil.c) + * + * The idea is to have faster functions than the standard XGetPixel function + * to scan the image data. Indeed we can speed up things by suppressing tests + * performed for each pixel. We do exactly the same tests but at the image + * level. Assuming that we use only ZPixmap images. + */ + +static unsigned long Const low_bits_table[] = { + 0x00000000, 0x00000001, 0x00000003, 0x00000007, + 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, + 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, + 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, + 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, + 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, + 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, + 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, + 0xffffffff +}; + +/* + * Default method to scan pixels of a Z image data structure. + * The algorithm used is: + * + * copy the source bitmap_unit or Zpixel into temp + * normalize temp if needed + * extract the pixel bits into return value + * + */ + +static int +GetImagePixels(image, width, height, pmap) + XImage *image; + unsigned int width; + unsigned int height; + PixelsMap *pmap; +{ + char *src; + char *dst; + unsigned int *iptr; + char *data; + int x, y, i; + int bits, depth, ibu, ibpp; + unsigned long lbt; + Pixel pixel, px; + + data = image->data; + iptr = pmap->pixelindex; + depth = image->depth; + lbt = low_bits_table[depth]; + ibpp = image->bits_per_pixel; + if (image->depth == 1) { + ibu = image->bitmap_unit; + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + src = &data[XYINDEX(x, y, image)]; + dst = (char *) &pixel; + pixel = 0; + for (i = ibu >> 3; --i >= 0;) + *dst++ = *src++; + XYNORMALIZE(&pixel, image); + bits = x % ibu; + pixel = ((((char *) &pixel)[bits >> 3]) >> (bits & 7)) & 1; + if (ibpp != depth) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + } else { + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + src = &data[ZINDEX(x, y, image)]; + dst = (char *) &px; + px = 0; + for (i = (ibpp + 7) >> 3; --i >= 0;) + *dst++ = *src++; + ZNORMALIZE(&px, image); + pixel = 0; + for (i = sizeof(unsigned long); --i >= 0;) + pixel = (pixel << 8) | ((unsigned char *) &px)[i]; + if (ibpp == 4) { + if (x & 1) + pixel >>= 4; + else + pixel &= 0xf; + } + if (ibpp != depth) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + } + return (XpmSuccess); +} + +/* + * scan pixels of a 32-bits Z image data structure + */ + +#ifndef WORD64 +static unsigned long byteorderpixel = MSBFirst << 24; + +#endif + +static int +GetImagePixels32(image, width, height, pmap) + XImage *image; + unsigned int width; + unsigned int height; + PixelsMap *pmap; +{ + unsigned char *addr; + unsigned char *data; + unsigned int *iptr; + int x, y; + unsigned long lbt; + Pixel pixel; + int depth; + + data = (unsigned char *) image->data; + iptr = pmap->pixelindex; + depth = image->depth; + lbt = low_bits_table[depth]; +#ifndef WORD64 + if (*((char *) &byteorderpixel) == image->byte_order) { + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX32(x, y, image)]; + pixel = *((unsigned long *) addr); + if (depth != 32) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + } else +#endif + if (image->byte_order == MSBFirst) + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX32(x, y, image)]; + pixel = ((unsigned long) addr[0] << 24 | + (unsigned long) addr[1] << 16 | + (unsigned long) addr[2] << 8 | + addr[4]); + if (depth != 32) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + else + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX32(x, y, image)]; + pixel = (addr[0] | + (unsigned long) addr[1] << 8 | + (unsigned long) addr[2] << 16 | + (unsigned long) addr[3] << 24); + if (depth != 32) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + return (XpmSuccess); +} + +/* + * scan pixels of a 16-bits Z image data structure + */ + +static int +GetImagePixels16(image, width, height, pmap) + XImage *image; + unsigned int width; + unsigned int height; + PixelsMap *pmap; +{ + unsigned char *addr; + unsigned char *data; + unsigned int *iptr; + int x, y; + unsigned long lbt; + Pixel pixel; + int depth; + + data = (unsigned char *) image->data; + iptr = pmap->pixelindex; + depth = image->depth; + lbt = low_bits_table[depth]; + if (image->byte_order == MSBFirst) + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX16(x, y, image)]; + pixel = addr[0] << 8 | addr[1]; + if (depth != 16) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + else + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + addr = &data[ZINDEX16(x, y, image)]; + pixel = addr[0] | addr[1] << 8; + if (depth != 16) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + return (XpmSuccess); +} + +/* + * scan pixels of a 8-bits Z image data structure + */ + +static int +GetImagePixels8(image, width, height, pmap) + XImage *image; + unsigned int width; + unsigned int height; + PixelsMap *pmap; +{ + unsigned int *iptr; + unsigned char *data; + int x, y; + unsigned long lbt; + Pixel pixel; + int depth; + + data = (unsigned char *) image->data; + iptr = pmap->pixelindex; + depth = image->depth; + lbt = low_bits_table[depth]; + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + pixel = data[ZINDEX8(x, y, image)]; + if (depth != 8) + pixel &= lbt; + if (storePixel(pixel, pmap, iptr)) + return (XpmNoMemory); + } + return (XpmSuccess); +} + +/* + * scan pixels of a 1-bit depth Z image data structure + */ + +static int +GetImagePixels1(image, width, height, pmap, storeFunc) + XImage *image; + unsigned int width; + unsigned int height; + PixelsMap *pmap; + int (*storeFunc) (); + +{ + unsigned int *iptr; + int x, y; + char *data; + Pixel pixel; + + if (image->byte_order != image->bitmap_bit_order) + return (GetImagePixels(image, width, height, pmap)); + else { + data = image->data; + iptr = pmap->pixelindex; + if (image->bitmap_bit_order == MSBFirst) + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + pixel = (data[ZINDEX1(x, y, image)] & (0x80 >> (x & 7))) + ? 1 : 0; + if ((*storeFunc) (pixel, pmap, iptr)) + return (XpmNoMemory); + } + else + for (y = 0; y < height; y++) + for (x = 0; x < width; x++, iptr++) { + pixel = (data[ZINDEX1(x, y, image)] & (1 << (x & 7))) + ? 1 : 0; + if ((*storeFunc) (pixel, pmap, iptr)) + return (XpmNoMemory); + } + } + return (XpmSuccess); +} + + +int +XpmCreateXpmImageFromPixmap(display, pixmap, shapemask, + xpmimage, attributes) + Display *display; + Pixmap pixmap; + Pixmap shapemask; + XpmImage *xpmimage; + XpmAttributes *attributes; +{ + XImage *image = NULL; + XImage *shapeimage = NULL; + unsigned int width = 0; + unsigned int height = 0; + int ErrorStatus; + unsigned int dum; + int dummy; + Window win; + + /* + * get geometry + */ + if (attributes && attributes->valuemask & XpmSize) { + width = attributes->width; + height = attributes->height; + } else { + if (pixmap) + XGetGeometry(display, pixmap, &win, &dummy, &dummy, + &width, &height, &dum, &dum); + else if (shapemask) + XGetGeometry(display, shapemask, &win, &dummy, &dummy, + &width, &height, &dum, &dum); + } + + /* + * get the images + */ + if (pixmap) + image = XGetImage(display, pixmap, 0, 0, width, height, + AllPlanes, ZPixmap); + if (shapemask) + shapeimage = XGetImage(display, shapemask, 0, 0, width, height, + AllPlanes, ZPixmap); + + ErrorStatus = XpmCreateXpmImageFromImage(display, image, shapeimage, + xpmimage, attributes); + if (image) + XDestroyImage(image); + if (shapeimage) + XDestroyImage(shapeimage); + + return (ErrorStatus); +} diff --git a/vendor/x11iraf/xpm/strdup.c b/vendor/x11iraf/xpm/strdup.c new file mode 100644 index 00000000..2611949c --- /dev/null +++ b/vendor/x11iraf/xpm/strdup.c @@ -0,0 +1,19 @@ +#include <stdio.h> + +/* + * STRDUP -- Return a pointer to a copy of the input string. + */ +char * +strdup (s) +char *s; +{ + char *str; + int nchars; + char *malloc(); + + nchars = strlen(s) + 1; + if ((str = malloc (nchars)) == NULL) + return (NULL); + memmove (str, s, nchars); + return (str); +} diff --git a/vendor/x11iraf/xpm/xpm.h b/vendor/x11iraf/xpm/xpm.h new file mode 100644 index 00000000..ed734d48 --- /dev/null +++ b/vendor/x11iraf/xpm/xpm.h @@ -0,0 +1,378 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* xpm.h: * +* * +* XPM library * +* Include file * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#ifndef XPM_h +#define XPM_h + +/* + * first some identification numbers: + * the following revision numbers is determined with the following rule: + * SO Major number = LIB minor version number. + * SO Minor number = LIB sub-minor version number. + * e.g: Xpm version 3.2f + * we forget the 3 which is the format number, 2 gives 2, and f gives 6. + * thus we have XpmVersion = 2 and XpmRevision = 6 + * which gives SOXPMLIBREV = 2.6 + */ +#define XpmFormat 3 +#define XpmVersion 3 +#define XpmRevision 0 + +#ifndef XPM_NUMBERS + +#ifdef VMS +#include "decw$include:Xlib.h" +#include "decw$include:Xutil.h" +#else +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#endif + +/* let's define Pixel if it is not done yet */ +#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED) +typedef unsigned long Pixel; /* Index into colormap */ +#define PIXEL_ALREADY_TYPEDEFED +#endif + +/* Return ErrorStatus codes: + * null if full success + * positive if partial success + * negative if failure + */ + +#define XpmColorError 1 +#define XpmSuccess 0 +#define XpmOpenFailed -1 +#define XpmFileInvalid -2 +#define XpmNoMemory -3 +#define XpmColorFailed -4 + +/* the following should help people wanting to use their own functions */ +#define XpmFree(ptr) free(ptr) + +typedef struct { + char *name; /* Symbolic color name */ + char *value; /* Color value */ + Pixel pixel; /* Color pixel */ +} XpmColorSymbol; + +typedef struct { + char *name; /* name of the extension */ + unsigned int nlines; /* number of lines in this extension */ + char **lines; /* pointer to the extension array of + * strings */ +} XpmExtension; + +typedef struct { + unsigned long valuemask; /* Specifies which attributes are + * defined */ + + Visual *visual; /* Specifies the visual to use */ + Colormap colormap; /* Specifies the colormap to use */ + unsigned int depth; /* Specifies the depth */ + unsigned int width; /* Returns the width of the created + * pixmap */ + unsigned int height; /* Returns the height of the created + * pixmap */ + unsigned int x_hotspot; /* Returns the x hotspot's + * coordinate */ + unsigned int y_hotspot; /* Returns the y hotspot's + * coordinate */ + unsigned int cpp; /* Specifies the number of char per + * pixel */ + Pixel *pixels; /* List of used color pixels */ + unsigned int npixels; /* Number of pixels */ + XpmColorSymbol *colorsymbols; /* Array of color symbols to + * override */ + unsigned int numsymbols; /* Number of symbols */ + char *rgb_fname; /* RGB text file name */ + unsigned int nextensions; /* number of extensions */ + XpmExtension *extensions; /* pointer to array of extensions */ + + /* Color Allocation Directives */ + unsigned int exactColors; /* Only use exact colors for visual */ + unsigned int closeness; /* Allowable RGB deviation */ + unsigned int red_closeness; /* Allowable red deviation */ + unsigned int green_closeness; /* Allowable green deviation */ + unsigned int blue_closeness; /* Allowable blue deviation */ + int color_key; /* Use colors from this color set */ + +} XpmAttributes; + +/* Xpm attribute value masks bits */ +#define XpmVisual (1L<<0) +#define XpmColormap (1L<<1) +#define XpmDepth (1L<<2) +#define XpmSize (1L<<3) /* width & height */ +#define XpmHotspot (1L<<4) /* x_hotspot & y_hotspot */ +#define XpmCharsPerPixel (1L<<5) +#define XpmColorSymbols (1L<<6) +#define XpmRgbFilename (1L<<7) +/************************************ there was +#define XpmInfos (1L<<8) all infos members +*/ +#define XpmExtensions (1L<<10) + +#define XpmReturnPixels (1L<<9) +/************************************ there was +#define XpmReturnInfos XpmInfos +*/ +#define XpmReturnExtensions XpmExtensions + +#define XpmExactColors (1L<<11) +#define XpmCloseness (1L<<12) +#define XpmRGBCloseness (1L<<13) +#define XpmColorKey (1L<<14) + +/* + * color keys for visual type, they must fit along with the number key of + * each related element in xpmColorKeys[] defined in xpmP.h + */ +#define XPM_MONO 2 +#define XPM_GREY4 3 +#define XPM_GRAY4 3 +#define XPM_GREY 4 +#define XPM_GRAY 4 +#define XPM_COLOR 5 + + +typedef struct { + char *string; /* characters string */ + char *symbolic; /* symbolic name */ + char *m_color; /* monochrom default */ + char *g4_color; /* 4 level grayscale default */ + char *g_color; /* other level grayscale default */ + char *c_color; /* color default */ +} XpmColor; + +typedef struct { + unsigned int width; /* image width */ + unsigned int height; /* image height */ + unsigned int cpp; /* number of characters per pixel */ + unsigned int ncolors; /* number of colors */ + XpmColor *colorTable; /* list of related colors */ + unsigned int *data; /* image data */ +} XpmImage; + +typedef struct { + char *hints_cmt; /* Comment of the hints section */ + char *colors_cmt; /* Comment of the colors section */ + char *pixels_cmt; /* Comment of the pixels section */ +} XpmInfos; + + +/* + * minimal portability layer between ansi and KR C + */ + +/* forward declaration of functions with prototypes */ + +#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) + /* ANSI || C++ */ +#define FUNC(f, t, p) extern t f p +#define LFUNC(f, t, p) static t f p +#else /* K&R */ +#define FUNC(f, t, p) extern t f() +#define LFUNC(f, t, p) static t f() +#endif /* end of K&R */ + + +/* + * functions declarations + */ + +#ifdef __cplusplus +extern "C" { +#endif + + FUNC(XpmCreatePixmapFromData, int, (Display *display, + Drawable d, + char **data, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes)); + + FUNC(XpmCreateDataFromPixmap, int, (Display *display, + char ***data_return, + Pixmap pixmap, + Pixmap shapemask, + XpmAttributes *attributes)); + + FUNC(XpmReadFileToPixmap, int, (Display *display, + Drawable d, + char *filename, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes)); + + FUNC(XpmWriteFileFromPixmap, int, (Display *display, + char *filename, + Pixmap pixmap, + Pixmap shapemask, + XpmAttributes *attributes)); + + FUNC(XpmCreateImageFromData, int, (Display *display, + char **data, + XImage **image_return, + XImage **shapemask_return, + XpmAttributes *attributes)); + + FUNC(XpmCreateDataFromImage, int, (Display *display, + char ***data_return, + XImage *image, + XImage *shapeimage, + XpmAttributes *attributes)); + + FUNC(XpmReadFileToImage, int, (Display *display, + char *filename, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes)); + + FUNC(XpmWriteFileFromImage, int, (Display *display, + char *filename, + XImage *image, + XImage *shapeimage, + XpmAttributes *attributes)); + + FUNC(XpmCreateImageFromBuffer, int, (Display *display, + char *buffer, + XImage **image_return, + XImage **shapemask_return, + XpmAttributes *attributes)); + + FUNC(XpmCreatePixmapFromBuffer, int, (Display *display, + Drawable d, + char *buffer, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes)); + + FUNC(XpmCreateBufferFromImage, int, (Display *display, + char **buffer_return, + XImage *image, + XImage *shapeimage, + XpmAttributes *attributes)); + + FUNC(XpmCreateBufferFromPixmap, int, (Display *display, + char **buffer_return, + Pixmap pixmap, + Pixmap shapemask, + XpmAttributes *attributes)); + + FUNC(XpmReadFileToBuffer, int, (char *filename, char **buffer_return)); + FUNC(XpmWriteFileFromBuffer, int, (char *filename, char *buffer)); + + FUNC(XpmReadFileToData, int, (char *filename, char ***data_return)); + FUNC(XpmWriteFileFromData, int, (char *filename, char **data)); + + FUNC(XpmAttributesSize, int, ()); + FUNC(XpmFreeAttributes, void, (XpmAttributes *attributes)); + FUNC(XpmFreeExtensions, void, (XpmExtension *extensions, + int nextensions)); + FUNC(XpmFreeXpmImage, void, (XpmImage *image)); + FUNC(XpmFreeXpmInfos, void, (XpmInfos *infos)); + FUNC(XpmGetErrorString, char *, (int errcode)); + + /* XpmImage functions */ + FUNC(XpmReadFileToXpmImage, int, (char *filename, + XpmImage *image, + XpmAttributes *attributes, + XpmInfos *infos)); + + FUNC(XpmWriteFileFromXpmImage, int, (char *filename, + XpmImage *image, + XpmAttributes *attributes, + XpmInfos *infos)); + + FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display, + Drawable d, + XpmImage *image, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes)); + + FUNC(XpmCreateImageFromXpmImage, int, (Display *display, + XpmImage *image, + XImage **image_return, + XImage **shapeimage_return, + XpmAttributes *attributes)); + + FUNC(XpmCreateXpmImageFromImage, int, (Display *display, + XImage *image, + XImage *shapeimage, + XpmImage *xpmimage, + XpmAttributes *attributes)); + + FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display, + Pixmap pixmap, + Pixmap shapemask, + XpmImage *xpmimage, + XpmAttributes *attributes)); + + FUNC(XpmCreateDataFromXpmImage, int, (char ***data_return, + XpmImage *image, + XpmAttributes *attributes)); + + FUNC(XpmCreateXpmImageFromData, int, (char **data, + XpmImage *image, + XpmAttributes *attributes)); + + FUNC(XpmCreateXpmImageFromBuffer, int, (char *buffer, + XpmImage *image, + XpmAttributes *attributes, + XpmInfos *infos)); + + FUNC(XpmCreateBufferFromXpmImage, int, (char **buffer_return, + XpmImage *image, + XpmAttributes *attributes, + XpmInfos *infos)); + +#ifdef __cplusplus +} /* for C++ V2.0 */ +#endif + + +/* backward compatibility */ + +/* for version 3.0c */ +#define XpmPixmapColorError XpmColorError +#define XpmPixmapSuccess XpmSuccess +#define XpmPixmapOpenFailed XpmOpenFailed +#define XpmPixmapFileInvalid XpmFileInvalid +#define XpmPixmapNoMemory XpmNoMemory +#define XpmPixmapColorFailed XpmColorFailed + +#define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \ + XpmReadFileToPixmap(dpy, d, file, pix, mask, att) +#define XpmWritePixmapFile(dpy, file, pix, mask, att) \ + XpmWriteFileFromPixmap(dpy, file, pix, mask, att) + +/* for version 3.0b */ +#define PixmapColorError XpmColorError +#define PixmapSuccess XpmSuccess +#define PixmapOpenFailed XpmOpenFailed +#define PixmapFileInvalid XpmFileInvalid +#define PixmapNoMemory XpmNoMemory +#define PixmapColorFailed XpmColorFailed + +#define ColorSymbol XpmColorSymbol + +#define XReadPixmapFile(dpy, d, file, pix, mask, att) \ + XpmReadFileToPixmap(dpy, d, file, pix, mask, att) +#define XWritePixmapFile(dpy, file, pix, mask, att) \ + XpmWriteFileFromPixmap(dpy, file, pix, mask, att) +#define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \ + XpmCreatePixmapFromData(dpy, d, data, pix, mask, att) +#define XCreateDataFromPixmap(dpy, data, pix, mask, att) \ + XpmCreateDataFromPixmap(dpy, data, pix, mask, att) + +#endif /* XPM_NUMBERS */ +#endif diff --git a/vendor/x11iraf/xpm/xpmP.h b/vendor/x11iraf/xpm/xpmP.h new file mode 100644 index 00000000..78d1283f --- /dev/null +++ b/vendor/x11iraf/xpm/xpmP.h @@ -0,0 +1,251 @@ +/* Copyright 1990-93 GROUPE BULL -- See license conditions in file COPYRIGHT */ +/*****************************************************************************\ +* xpmP.h: * +* * +* XPM library * +* Private Include file * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +#ifndef XPMP_h +#define XPMP_h + +/* + * lets try to solve include files + */ +#ifdef VMS + +#include "sys$library:stdio.h" +#include "sys$library:string.h" + +#else /* VMS */ + +#include <stdio.h> +/* stdio.h doesn't declare popen on a Sequent DYNIX OS */ +#ifdef sequent +extern FILE *popen(); +#endif + +#if defined(SYSV) || defined(SVR4) +#include <string.h> + +#ifndef index +#define index strchr +#endif + +#ifndef rindex +#define rindex strrchr +#endif + +#else /* defined(SYSV) || defined(SVR4) */ +#include <strings.h> +#endif + +#endif /* VMS */ + +#include "xpm.h" + +#if defined(SYSV) || defined(SVR4) || defined(VMS) +#define bcopy(source, dest, count) memcpy(dest, source, count) +#define bzero(b, len) memset(b, 0, len) +#endif + + +/* the following should help people wanting to use their own functions */ +#define XpmMalloc(size) malloc((size)) +#define XpmRealloc(ptr, size) realloc((ptr), (size)) +#define XpmCalloc(nelem, elsize) calloc((nelem), (elsize)) + + +typedef struct { + unsigned int type; + union { + FILE *file; + char **data; + } stream; + char *cptr; + unsigned int line; + int CommentLength; + char Comment[BUFSIZ]; + char *Bcmt, *Ecmt, Bos, Eos; + int format; /* 1 if XPM1, 0 otherwise */ +} xpmData; + +#define XPMARRAY 0 +#define XPMFILE 1 +#define XPMPIPE 2 +#define XPMBUFFER 3 + +typedef unsigned char byte; +typedef int Boolean; + +#define EOL '\n' +#define TAB '\t' +#define SPC ' ' + +typedef struct { + char *type; /* key word */ + char *Bcmt; /* string beginning comments */ + char *Ecmt; /* string ending comments */ + char Bos; /* character beginning strings */ + char Eos; /* character ending strings */ + char *Strs; /* strings separator */ + char *Dec; /* data declaration string */ + char *Boa; /* string beginning assignment */ + char *Eoa; /* string ending assignment */ +} xpmDataType; + +extern xpmDataType xpmDataTypes[]; + +/* + * rgb values and ascii names (from rgb text file) rgb values, + * range of 0 -> 65535 color mnemonic of rgb value + */ +typedef struct { + int r, g, b; + char *name; +} xpmRgbName; + +/* Maximum number of rgb mnemonics allowed in rgb text file. */ +#define MAX_RGBNAMES 1024 + +extern char *xpmColorKeys[]; + +#define TRANSPARENT_COLOR "None" /* this must be a string! */ + +/* number of xpmColorKeys */ +#define NKEYS 5 + +/* define some type to access the XpmColor struct as an array */ +typedef char **xpmColorDefaults; + +#define UNDEF_PIXEL 0x80000000 + +/* XPM private routines */ + +FUNC(xpmWriteData, int, (xpmData *mdata, XpmImage *image, char *name, + XpmAttributes *attributes, XpmInfos *infos)); + +FUNC(xpmParseData, int, (xpmData *data, XpmImage *image, + XpmAttributes *attributes, XpmInfos *infos)); + +FUNC(xpmFreeColorTable, void, (XpmColor *colorTable, int ncolors)); + +FUNC(xpmInitAttributes, void, (XpmAttributes *attributes)); + +FUNC(xpmInitXpmImage, void, (XpmImage *image)); + +FUNC(xpmInitXpmInfos, void, (XpmInfos *infos)); + +/* I/O utility */ + +FUNC(xpmNextString, int, (xpmData *mdata)); +FUNC(xpmNextUI, int, (xpmData *mdata, unsigned int *ui_return)); +FUNC(xpmGetString, int, (xpmData *mdata, char **sptr, unsigned int *l)); + +#define xpmGetC(mdata) \ + ((!mdata->type || mdata->type == XPMBUFFER) ? \ + (*mdata->cptr++) : (getc(mdata->stream.file))) + +FUNC(xpmNextWord, unsigned int, + (xpmData *mdata, char *buf, unsigned int buflen)); +FUNC(xpmGetCmt, int, (xpmData *mdata, char **cmt)); +FUNC(xpmReadFile, int, (char *filename, xpmData *mdata)); +FUNC(xpmWriteFile, int, (char *filename, xpmData *mdata)); +FUNC(xpmOpenArray, void, (char **data, xpmData *mdata)); +FUNC(xpmDataClose, int, (xpmData *mdata)); +FUNC(xpmParseHeader, int, (xpmData *mdata)); +FUNC(xpmOpenBuffer, void, (char *buffer, xpmData *mdata)); + +/* RGB utility */ + +FUNC(xpmReadRgbNames, int, (char *rgb_fname, xpmRgbName *rgbn)); +FUNC(xpmGetRgbName, char *, (xpmRgbName *rgbn, int rgbn_max, + int red, int green, int blue)); +FUNC(xpmFreeRgbNames, void, (xpmRgbName *rgbn, int rgbn_max)); + +FUNC(xpm_xynormalizeimagebits, void, (register unsigned char *bp, + register XImage *img)); +FUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp, + register XImage *img)); + +/* + * Macros + * + * The XYNORMALIZE macro determines whether XY format data requires + * normalization and calls a routine to do so if needed. The logic in + * this module is designed for LSBFirst byte and bit order, so + * normalization is done as required to present the data in this order. + * + * The ZNORMALIZE macro performs byte and nibble order normalization if + * required for Z format data. + * + * The XYINDEX macro computes the index to the starting byte (char) boundary + * for a bitmap_unit containing a pixel with coordinates x and y for image + * data in XY format. + * + * The ZINDEX* macros compute the index to the starting byte (char) boundary + * for a pixel with coordinates x and y for image data in ZPixmap format. + * + */ + +#define XYNORMALIZE(bp, img) \ + if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \ + xpm_xynormalizeimagebits((unsigned char *)(bp), img) + +#define ZNORMALIZE(bp, img) \ + if (img->byte_order == MSBFirst) \ + xpm_znormalizeimagebits((unsigned char *)(bp), img) + +#define XYINDEX(x, y, img) \ + ((y) * img->bytes_per_line) + \ + (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3) + +#define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \ + (((x) * img->bits_per_pixel) >> 3) + +#define ZINDEX32(x, y, img) ((y) * img->bytes_per_line) + ((x) << 2) + +#define ZINDEX16(x, y, img) ((y) * img->bytes_per_line) + ((x) << 1) + +#define ZINDEX8(x, y, img) ((y) * img->bytes_per_line) + (x) + +#define ZINDEX1(x, y, img) ((y) * img->bytes_per_line) + ((x) >> 3) + +#if __STDC__ +#define Const const +#else +#define Const /**/ +#endif + +/* + * there are structures and functions related to hastable code + */ + +typedef struct _xpmHashAtom { + char *name; + void *data; +} *xpmHashAtom; + +typedef struct { + int size; + int limit; + int used; + xpmHashAtom *atomTable; +} xpmHashTable; + +FUNC(xpmHashTableInit, int, (xpmHashTable *table)); +FUNC(xpmHashTableFree, void, (xpmHashTable *table)); +FUNC(xpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s)); +FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data)); + +#define HashAtomData(i) ((void *)i) +#define HashColorIndex(slot) ((unsigned int)((*slot)->data)) +#define USE_HASHTABLE (cpp > 2 && ncolors > 4) + +#ifdef NEED_STRDUP +FUNC(strdup, char *, (char *s1)); +#endif + +#endif diff --git a/vendor/x11iraf/xtapemon/Imakefile b/vendor/x11iraf/xtapemon/Imakefile new file mode 100644 index 00000000..8c745346 --- /dev/null +++ b/vendor/x11iraf/xtapemon/Imakefile @@ -0,0 +1,69 @@ +# +# Imakefile for xtapemon : X11 based tape monitoring utility for IRAF. +# + +X11IRAFDIR = ../ +#include <../X11IRAF.tmpl> + +/* Hack to build on NOAO HP systems where the Xmu and Xaw libs had to be added + * specially to the system they don't come with the default X11 development + * system. This also avoids the binary requiring the shared lib version on + * systems which may not have it. + */ +#if defined(HPArchitecture) && OSMajorVersion >= 10 + XMULIB = /usr/lib/X11R6/libXmu.a + XAWLIB = /usr/lib/X11R6/libXaw.a +#endif + + + CDEBUGFLAGS = -g + XAWLIB = LibXaw3d + +############################################################################## +# Nothing to change below here... + +SRCS= classnames.c types.c xtapemon.c +OBJS= classnames.o types.o xtapemon.o +DEFINES= -DXTAPEMON +INCLUDES= -I. $(X11IRAF_INCLUDES) +DEPLIBS= XawClientDepLibs +LOCAL_LIBRARIES= XawClientLibs +LOCAL_LDFLAGS= -L../lib $(X11IRAF_LDFLAGS) +OBMLIBS = LibObm LibXpm +MATHLIB = -lm + + + +AllTarget(xtapemon) + +NormalProgramTarget(xtapemon,$(OBJS),,${OBMLIBS} XawClientLibs,$(MATHLIB)) + +#if InstallAppdefs +install:: XTapemon.ad + MakeDir(X11irafAppDir) + $(CP) XTapemon.ad X11irafAppDir/XTapemon +#endif + +#if InstallManuals +install:: + MakeDir(X11irafManDir) + $(CP) xtapemon.man X11irafManDir/xtapemon.1 +#endif + +#if InstallBinaries +install:: xtapemon + -@if [ -d X11irafBinDir ]; then set +x; \ + else (set -x; $(MKDIRHIER) X11irafBinDir); fi + $(CP) xtapemon X11irafBinDir +#endif + +xtapemon.o: XTapemon.ad.h +xtapemon.c: XTapemon.ad.h + +XTapemon.ad.h: XTapemon.ad + ad2c.sh XTapemon.ad > XTapemon.ad.h + +clean:: + rm -f *.o xtapemon + +DependTarget() diff --git a/vendor/x11iraf/xtapemon/Imakefile.orig b/vendor/x11iraf/xtapemon/Imakefile.orig new file mode 100644 index 00000000..b0953dcf --- /dev/null +++ b/vendor/x11iraf/xtapemon/Imakefile.orig @@ -0,0 +1,33 @@ +# +# Imakefile for xtapemon : X11 based tape monitoring utility for IRAF. +# + CDEBUGFLAGS = -g + XAWLIB = -lXaw3d # set to Xaw3d for 3d look + +############################################################################## +# Nothing to change below here... + +SRCS= classnames.c types.c xtapemon.c +OBJS= classnames.o types.o xtapemon.o +DEFINES= -DXTAPEMON +INCLUDES= -I. +DEPLIBS= XawClientDepLibs +LOCAL_LIBRARIES= XawClientLibs +LOCAL_LDFLAGS= -L../lib + +ComplexProgramTarget(xtapemon) +InstallAppDefaults(Xtapemon) + +install.xtapemon: xtapemon Xtapemon.ad xtapemon.man + $(INSTALL) -c $(INSTPGMFLAGS) xtapemon $(BINDIR) + $(INSTALL) -c $(INSTAPPFLAGS) Xtapemon.ad $(XAPPLOADDIR)/Xtapemon + $(INSTALL) -c $(INSTMANFLAGS) xtapemon.man $(MANDIR)/xtapemon.1 + +xtapemon.o: XTapemon.ad.h +xtapemon.c: XTapemon.ad.h + +XTapemon.ad.h: XTapemon.ad + ad2c.sh XTapemon.ad > XTapemon.ad.h + +clean:: + rm -f *.o xtapemon diff --git a/vendor/x11iraf/xtapemon/XTapemon.ad b/vendor/x11iraf/xtapemon/XTapemon.ad new file mode 100644 index 00000000..9438d2c4 --- /dev/null +++ b/vendor/x11iraf/xtapemon/XTapemon.ad @@ -0,0 +1,168 @@ +! +! XTapemon.ad : Application defaults for the X11 tape monitor utility. +! + +XTapemon.port: 5138 +XTapemon.alternate: 0 +XTapemon.debug: 0 + +! Main display widget hierachy: +XTapemon.widgets: \ + toplevel Paned panel \ +\ + panel Form statusForm \ + panel.statusForm Label statusLabel \ + panel.statusForm AsciiText statusText \ + panel.statusForm Command quitButton \ +\ + panel AsciiText messages \ +\ + panel Form stringForm \ + panel.stringForm Label devtypeLabel \ + panel.stringForm AsciiText devtypeText \ + panel.stringForm Label tapetypeLabel \ + panel.stringForm AsciiText tapetypeText \ + panel.stringForm Label tapesizeLabel \ + panel.stringForm AsciiText tapesizeText \ + panel.stringForm Label tapeusedLabel \ + panel.stringForm AsciiText tapeusedText \ + panel.stringForm Label acmodeLabel \ + panel.stringForm AsciiText acmodeText \ + panel.stringForm Label densityLabel \ + panel.stringForm AsciiText densityText \ + panel.stringForm Label blksizeLabel \ + panel.stringForm AsciiText blksizeText \ + panel.stringForm Label nfilesLabel \ + panel.stringForm AsciiText nfilesText \ + panel.stringForm Label fileLabel \ + panel.stringForm AsciiText fileText \ + panel.stringForm Label recordLabel \ + panel.stringForm AsciiText recordText \ + panel.stringForm Label recsizeLabel \ + panel.stringForm AsciiText recsizeText + +! Overall Paned widget +*panel.orientation: vertical +*showGrip: false + +! Status window +*statusForm.background: lightgray +*statusForm*statusLabel.label: Status: +*statusForm*statusLabel.background: lightgray +*statusForm*statusText.fromHoriz: statusLabel +*statusForm*statusText*width: 370 +*statusForm*statusText*editType: read +*statusForm*statusText.borderWidth: 0 +*statusForm*statusText*translations: #override\n +*statusForm*statusText.background: lightgray + +*statusForm*quitButton.label: Quit +*statusForm*quitButton.fromHoriz: statusText +*statusForm*quitButton.background: lightgray + +! AsciiText scrolling widget for messages +*messages.scrollVertical: always +*messages.scrollHorizontal: whenNeeded +*messages*editType: append +*messages*Scrollbar.thickness: 10 +*messages*displayCaret: False +*messages*string: idle\n + +! +! Defaults for all the classes of widgets +! + +*input: True +*Grip*height: 5 +*Grip*width: 5 +*Label.borderWidth: 0 +*Label.internalWidth: 0 +*Text*borderWidth: 1 +*Text*font: fixed +*Text*Scrollbar.thickness: 5 +*Text*editType: read +*Text.scrollHorizontal: whenNeeded +*Text*displayCaret: False + +! +! Bottom String Form +! +! These keep the strings from getting bigger or smaller when the panes +! resize. Thus only the message region grows. +*stringForm.min: 100 +*stringForm.max: 100 +*stringForm.background: lightgray +*stringForm*Label.background: lightgray + +*stringForm*devtypeLabel.label: Device Type: +*stringForm*devtypeText*width: 415 +*stringForm*devtypeText.fromHoriz: devtypeLabel + +*stringForm*tapetypeLabel.label: \ \ Tape Type: +*stringForm*tapetypeLabel.fromVert: devtypeLabel +*stringForm*tapetypeText.fromVert: devtypeLabel +*stringForm*tapetypeText.fromHoriz: tapetypeLabel +*stringForm*tapetypeText.width: 105 + +*stringForm*tapesizeLabel.label: Capacity: +*stringForm*tapesizeLabel.fromVert: devtypeLabel +*stringForm*tapesizeLabel.fromHoriz: tapetypeText +*stringForm*tapesizeText.fromVert: devtypeLabel +*stringForm*tapesizeText.fromHoriz: tapesizeLabel +*stringForm*tapesizeText.width: 75 + +*stringForm*tapeusedLabel.label: Used: +*stringForm*tapeusedLabel.fromVert: devtypeLabel +*stringForm*tapeusedLabel.fromHoriz: tapesizeText +*stringForm*tapeusedText.fromVert: devtypeLabel +*stringForm*tapeusedText.fromHoriz: tapeusedLabel +*stringForm*tapeusedText.width: 117 + +*stringForm*acmodeLabel.label: Access Mode: +*stringForm*acmodeLabel.fromVert: tapeusedLabel +*stringForm*acmodeText.fromVert: tapeusedLabel +*stringForm*acmodeText.fromHoriz: acmodeLabel +*stringForm*acmodeText.width: 70 + +*stringForm*densityLabel.label: Density: +*stringForm*densityLabel.fromVert: tapeusedLabel +*stringForm*densityLabel.fromHoriz: acmodeText +*stringForm*densityText.fromVert: tapeusedLabel +*stringForm*densityText.fromHoriz: densityLabel +*stringForm*densityText.width: 72 + +*stringForm*blksizeLabel.label: Device Block Size: +*stringForm*blksizeLabel.fromVert: tapeusedLabel +*stringForm*blksizeLabel.fromHoriz: densityText +*stringForm*blksizeText.fromVert: tapeusedLabel +*stringForm*blksizeText.fromHoriz: blksizeLabel +*stringForm*blksizeText.width: 71 + +*stringForm*nfilesLabel.label: Total Files: +*stringForm*nfilesLabel.fromVert: acmodeLabel +*stringForm*nfilesText.fromVert: acmodeLabel +*stringForm*nfilesText.fromHoriz: nfilesLabel +*stringForm*nfilesText.width: 55 + +*stringForm*fileLabel.label: File: +*stringForm*fileLabel.fromVert: acmodeLabel +*stringForm*fileLabel.fromHoriz: nfilesText +*stringForm*fileText.fromVert: acmodeLabel +*stringForm*fileText.fromHoriz: fileLabel +*stringForm*fileText.width: 62 + +*stringForm*recordLabel.label: Record: +*stringForm*recordLabel.fromVert: acmodeLabel +*stringForm*recordLabel.fromHoriz: fileText +*stringForm*recordText.fromVert: acmodeLabel +*stringForm*recordText.fromHoriz: recordLabel +*stringForm*recordText.width: 50 + +*stringForm*recsizeLabel.label: Record Size: +*stringForm*recsizeLabel.fromVert: acmodeLabel +*stringForm*recsizeLabel.fromHoriz: recordText +*stringForm*recsizeText.fromVert: acmodeLabel +*stringForm*recsizeText.fromHoriz: recsizeLabel +*stringForm*recsizeText.width: 50 + +*beNiceToColormap: False diff --git a/vendor/x11iraf/xtapemon/XTapemon.ad.h b/vendor/x11iraf/xtapemon/XTapemon.ad.h new file mode 100644 index 00000000..b602e0a1 --- /dev/null +++ b/vendor/x11iraf/xtapemon/XTapemon.ad.h @@ -0,0 +1,132 @@ +"XTapemon.port: 5138", +"XTapemon.alternate: 0", +"XTapemon.debug: 0", +"XTapemon.widgets: \ + toplevel Paned panel \ +\ + panel Form statusForm \ + panel.statusForm Label statusLabel \ + panel.statusForm AsciiText statusText \ + panel.statusForm Command quitButton \ +\ + panel AsciiText messages \ +\ + panel Form stringForm \ + panel.stringForm Label devtypeLabel \ + panel.stringForm AsciiText devtypeText \ + panel.stringForm Label tapetypeLabel \ + panel.stringForm AsciiText tapetypeText \ + panel.stringForm Label tapesizeLabel \ + panel.stringForm AsciiText tapesizeText \ + panel.stringForm Label tapeusedLabel \ + panel.stringForm AsciiText tapeusedText \ + panel.stringForm Label acmodeLabel \ + panel.stringForm AsciiText acmodeText \ + panel.stringForm Label densityLabel \ + panel.stringForm AsciiText densityText \ + panel.stringForm Label blksizeLabel \ + panel.stringForm AsciiText blksizeText \ + panel.stringForm Label nfilesLabel \ + panel.stringForm AsciiText nfilesText \ + panel.stringForm Label fileLabel \ + panel.stringForm AsciiText fileText \ + panel.stringForm Label recordLabel \ + panel.stringForm AsciiText recordText \ + panel.stringForm Label recsizeLabel \ + panel.stringForm AsciiText recsizeText", +"*panel.orientation: vertical", +"*showGrip: false", +"*statusForm.background: lightgray", +"*statusForm*statusLabel.label: Status:", +"*statusForm*statusLabel.background: lightgray", +"*statusForm*statusText.fromHoriz: statusLabel", +"*statusForm*statusText*width: 370", +"*statusForm*statusText*editType: read", +"*statusForm*statusText.borderWidth: 0", +"*statusForm*statusText*translations: #override\\n", +"*statusForm*statusText.background: lightgray", +"*statusForm*quitButton.label: Quit", +"*statusForm*quitButton.fromHoriz: statusText", +"*statusForm*quitButton.background: lightgray", +"*messages.scrollVertical: always", +"*messages.scrollHorizontal: whenNeeded", +"*messages*editType: append", +"*messages*Scrollbar.thickness: 10", +"*messages*displayCaret: False", +"*messages*string: idle\\n", +"*input: True", +"*Grip*height: 5", +"*Grip*width: 5", +"*Label.borderWidth: 0", +"*Label.internalWidth: 0", +"*Text*borderWidth: 1", +"*Text*font: fixed", +"*Text*Scrollbar.thickness: 5", +"*Text*editType: read", +"*Text.scrollHorizontal: whenNeeded", +"*Text*displayCaret: False", +"*stringForm.min: 100", +"*stringForm.max: 100", +"*stringForm.background: lightgray", +"*stringForm*Label.background: lightgray", +"*stringForm*devtypeLabel.label: Device Type:", +"*stringForm*devtypeText*width: 415", +"*stringForm*devtypeText.fromHoriz: devtypeLabel", +"*stringForm*tapetypeLabel.label: \\ \\ Tape Type:", +"*stringForm*tapetypeLabel.fromVert: devtypeLabel", +"*stringForm*tapetypeText.fromVert: devtypeLabel", +"*stringForm*tapetypeText.fromHoriz: tapetypeLabel", +"*stringForm*tapetypeText.width: 105", +"*stringForm*tapesizeLabel.label: Capacity:", +"*stringForm*tapesizeLabel.fromVert: devtypeLabel", +"*stringForm*tapesizeLabel.fromHoriz: tapetypeText", +"*stringForm*tapesizeText.fromVert: devtypeLabel", +"*stringForm*tapesizeText.fromHoriz: tapesizeLabel", +"*stringForm*tapesizeText.width: 75", +"*stringForm*tapeusedLabel.label: Used:", +"*stringForm*tapeusedLabel.fromVert: devtypeLabel", +"*stringForm*tapeusedLabel.fromHoriz: tapesizeText", +"*stringForm*tapeusedText.fromVert: devtypeLabel", +"*stringForm*tapeusedText.fromHoriz: tapeusedLabel", +"*stringForm*tapeusedText.width: 117", +"*stringForm*acmodeLabel.label: Access Mode:", +"*stringForm*acmodeLabel.fromVert: tapeusedLabel", +"*stringForm*acmodeText.fromVert: tapeusedLabel", +"*stringForm*acmodeText.fromHoriz: acmodeLabel", +"*stringForm*acmodeText.width: 70", +"*stringForm*densityLabel.label: Density:", +"*stringForm*densityLabel.fromVert: tapeusedLabel", +"*stringForm*densityLabel.fromHoriz: acmodeText", +"*stringForm*densityText.fromVert: tapeusedLabel", +"*stringForm*densityText.fromHoriz: densityLabel", +"*stringForm*densityText.width: 72", +"*stringForm*blksizeLabel.label: Device Block Size:", +"*stringForm*blksizeLabel.fromVert: tapeusedLabel", +"*stringForm*blksizeLabel.fromHoriz: densityText", +"*stringForm*blksizeText.fromVert: tapeusedLabel", +"*stringForm*blksizeText.fromHoriz: blksizeLabel", +"*stringForm*blksizeText.width: 71", +"*stringForm*nfilesLabel.label: Total Files:", +"*stringForm*nfilesLabel.fromVert: acmodeLabel", +"*stringForm*nfilesText.fromVert: acmodeLabel", +"*stringForm*nfilesText.fromHoriz: nfilesLabel", +"*stringForm*nfilesText.width: 55", +"*stringForm*fileLabel.label: File:", +"*stringForm*fileLabel.fromVert: acmodeLabel", +"*stringForm*fileLabel.fromHoriz: nfilesText", +"*stringForm*fileText.fromVert: acmodeLabel", +"*stringForm*fileText.fromHoriz: fileLabel", +"*stringForm*fileText.width: 62", +"*stringForm*recordLabel.label: Record:", +"*stringForm*recordLabel.fromVert: acmodeLabel", +"*stringForm*recordLabel.fromHoriz: fileText", +"*stringForm*recordText.fromVert: acmodeLabel", +"*stringForm*recordText.fromHoriz: recordLabel", +"*stringForm*recordText.width: 50", +"*stringForm*recsizeLabel.label: Record Size:", +"*stringForm*recsizeLabel.fromVert: acmodeLabel", +"*stringForm*recsizeLabel.fromHoriz: recordText", +"*stringForm*recsizeText.fromVert: acmodeLabel", +"*stringForm*recsizeText.fromHoriz: recsizeLabel", +"*stringForm*recsizeText.width: 50", +"*beNiceToColormap: False", diff --git a/vendor/x11iraf/xtapemon/ad2c.sh b/vendor/x11iraf/xtapemon/ad2c.sh new file mode 100755 index 00000000..651ab8c4 --- /dev/null +++ b/vendor/x11iraf/xtapemon/ad2c.sh @@ -0,0 +1,62 @@ +#!/bin/sh +# +# ad2c : Convert app-defaults file to C strings decls. +# +# George Ferguson, ferguson@cs.rcohester.edu, 12 Nov 1990. +# 19 Mar 1991: gf +# Made it self-contained. +# 6 Jan 1992: mycroft@gnu.ai.mit.edu (Charles Hannum) +# Removed use of "-n" and ":read" label since Gnu and +# IBM sed print pattern space on "n" command. Still works +# with Sun sed, of course. +# 7 Jan 1992: matthew@sunpix.East.Sun.COM (Matthew Stier) +# Escape quotes after escaping backslashes. +# 8 Jul 1992: Version 1.6 +# Manpage fixes. +# 19 Apr 1993: Version 1.7 +# Remove comments that were inside the sed command since +# some versions of sed don't like them. The comments are +# now given here in the header. +# +# Comments on the script by line: +# /^!/d Remove comments +# /^$/d Remove blanks +# s/\\/\\\\/g Escape backslashes... +# s/\\$//g ...except the line continuation ones +# s/"/\\"/g Escape quotes +# s/^/"/ Add leading quote +# : test Establish label for later branch +# /\\$/b slash Branch to label "slash" if line ends in backslash +# s/$/",/ Otherwise add closing quote and comma... +# p ...output the line... +# d ...and clear the pattern space so it's not printed again +# : slash Branch comes here if line ends in backslash +# n Read next line, append to pattern space +# [...] The "d" and "s" commands that follow just delete +# comments and blank lines and escape control sequences +# b test Branch up to see if the line ends in backslash or not +# + +sed ' +/^!/d +/^$/d +s/\\/\\\\/g +s/\\$//g +s/"/\\"/g +s/^/"/ +: test +/\\$/b slash +s/$/",/ +p +d +: slash +n +/^!/d +/^$/d +s/"/\\"/g +s/\\\\/\\/g +s/\\n/\\\\n/g +s/\\t/\\\\t/g +s/\\f/\\\\f/g +s/\\b/\\\\b/g +b test' "$@" diff --git a/vendor/x11iraf/xtapemon/appres.h b/vendor/x11iraf/xtapemon/appres.h new file mode 100644 index 00000000..dabd5f1c --- /dev/null +++ b/vendor/x11iraf/xtapemon/appres.h @@ -0,0 +1,21 @@ +/* + * appres.h : External defs for files needing the application + * resources. + * + * George Ferguson, ferguson@cs.rochester.edu, 12 Sep 1991. + * + */ + +#ifndef APP_RESOURCES_H +#define APP_RESOURCES_H + +typedef struct { + String widgets; + int alternate; + int port; + int debug; +} AppResources; + +extern AppResources appResources; + +#endif /* APP_RESOURCES_H */ diff --git a/vendor/x11iraf/xtapemon/classnames.c b/vendor/x11iraf/xtapemon/classnames.c new file mode 100644 index 00000000..20d307d6 --- /dev/null +++ b/vendor/x11iraf/xtapemon/classnames.c @@ -0,0 +1,80 @@ +/* + * classnames.c : Map class names to classes. This code is totally + * self-contained and so can be used for other projects. A smaller + * executable might result from only including the classes an + * application needs. + * + * George Ferguson, ferguson@cs.rochester.edu, 4 Sep 1991. + * + */ +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Grip.h> +#include <X11/Xaw/Label.h> +#include <X11/Xaw/List.h> +#include <X11/Xaw/Scrollbar.h> +#include <X11/Xaw/StripChart.h> +#include <X11/Xaw/Toggle.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/SmeLine.h> +#include <X11/Xaw/MenuButton.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/Box.h> +#include <X11/Xaw/Dialog.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Paned.h> +#include <X11/Xaw/Viewport.h> + +static struct tableRec { + char *name; + WidgetClass *class; + Boolean isShell; +} table[] = { + { "Command", &commandWidgetClass, False }, + { "Grip", &gripWidgetClass, False }, + { "Label", &labelWidgetClass, False }, + { "List", &listWidgetClass, False }, + { "Scrollbar", &scrollbarWidgetClass, False }, + { "StripChart", &stripChartWidgetClass, False }, + { "Toggle", &toggleWidgetClass, False }, + { "SimpleMenu", &simpleMenuWidgetClass, True }, + { "SmeBSB", &smeBSBObjectClass, False }, + { "SmeLine", &smeLineObjectClass, False }, + { "MenuButton", &menuButtonWidgetClass, False }, + { "AsciiText", &asciiTextWidgetClass, False }, + { "Box", &boxWidgetClass, False }, + { "Dialog", &dialogWidgetClass, False }, + { "Form", &formWidgetClass, False }, + { "Paned", &panedWidgetClass, False }, + { "Viewport", &viewportWidgetClass, False }, + { "Shell", &shellWidgetClass, True }, + { "OverrideShell", &overrideShellWidgetClass, True }, + { "WMShell", &wmShellWidgetClass, True }, + { "TransientShell", &transientShellWidgetClass, True }, + { "TopLevelShell", &topLevelShellWidgetClass, True }, + { "ApplicationShell", &applicationShellWidgetClass, True }, +}; + +/* + * classNameToWidgetClass : Returns the WidgetClass with the given "name". + * In addition, sets the isShell flag to True or False depending on + * whether the class is a Shell class or not. + * Return NULL if the name is not the name of any WidgetClass. + */ +WidgetClass +classNameToWidgetClass(name,isShellp) +char *name; +Boolean *isShellp; +{ + int i; + + for (i=0; i < XtNumber(table); i++) + if (strcmp(name,table[i].name) == 0) { + *isShellp = table[i].isShell; + return(*(table[i].class)); + } + return((WidgetClass)NULL); +} diff --git a/vendor/x11iraf/xtapemon/classnames.h b/vendor/x11iraf/xtapemon/classnames.h new file mode 100644 index 00000000..8fc7cc63 --- /dev/null +++ b/vendor/x11iraf/xtapemon/classnames.h @@ -0,0 +1,8 @@ +/* + * classnames.h : External defs for the classname converter + * + * George Ferguson, ferguson@cs.rochester.edu, 4 Sep 1991. + * + */ + +extern WidgetClass classNameToWidgetClass(/* name,isShellp */); diff --git a/vendor/x11iraf/xtapemon/gui2c.sed b/vendor/x11iraf/xtapemon/gui2c.sed new file mode 100644 index 00000000..9a70a93c --- /dev/null +++ b/vendor/x11iraf/xtapemon/gui2c.sed @@ -0,0 +1,6 @@ +s/\\/\\\\/g +s/"/\\"/g +s/^/"/ +s/$/",/ +p +d diff --git a/vendor/x11iraf/xtapemon/patchlevel.h b/vendor/x11iraf/xtapemon/patchlevel.h new file mode 100644 index 00000000..4d4a5a5c --- /dev/null +++ b/vendor/x11iraf/xtapemon/patchlevel.h @@ -0,0 +1,6 @@ +/* + * patchlevel.h : xtapemon version control + */ + +int xtapemonMajorVersion = 1; +int xtapemonMinorVersion = 0; diff --git a/vendor/x11iraf/xtapemon/types.c b/vendor/x11iraf/xtapemon/types.c new file mode 100644 index 00000000..b26a7abf --- /dev/null +++ b/vendor/x11iraf/xtapemon/types.c @@ -0,0 +1,78 @@ +/* + * types.c : Converters for SearchType and SortType, and an improved + * converter for Widget that allows "NULL" to be specified. + * + * George Ferguson, ferguson@cs.rochester.edu, 12 Sep 1991. + * + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include <X11/Xmu/CharSet.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Cardinals.h> +#include "types.h" +extern void XmuConvertStringToWidget(); /* original converter */ + +/* + * Functions defined here: + */ +void initConverters(); + +void cvtStringToWidget(); + +/* Straight from the Xt manual... */ +#define done(VALUE,TYPE)\ +{ \ + if (toVal->addr != NULL) { \ + if (toVal->size < sizeof(TYPE)) { \ + toVal->size = sizeof(TYPE); \ + return(False); \ + } \ + *(TYPE *)(toVal->addr) = (VALUE); \ + } else { \ + static TYPE static_val; \ + static_val = (VALUE); \ + toVal->addr = (XtPointer)&static_val; \ + } \ + toVal->size = sizeof(TYPE); \ + return(True); \ +} + +void +initConverters(appContext) +XtAppContext appContext; +{ + static XtConvertArgRec parentCvtArgs[] = { + {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent), sizeof(Widget)} + }; + + /* Have to initialize Form class first or our converter will be */ + /* overidden by the class initialization function. */ + /* Use the old style here on purpose since that what the default is.*/ + XtInitializeWidgetClass(formWidgetClass); + XtAppAddConverter(appContext,XtRString,XtRWidget,cvtStringToWidget, + parentCvtArgs,XtNumber(parentCvtArgs)); +} + +/* + * cvtStringToWidget() : Allows us to specify "NULL" as a widget name in + * a resource file to override compiled-in defaults for composite + * widget layouts. Simply calls the regular converter if the string + * is not "NULL". Note that this must be registered *after* the + * Form class is initialized. + */ +void +cvtStringToWidget(args,num_args,fromVal,toVal) +XrmValuePtr args; +Cardinal *num_args; +XrmValuePtr fromVal; +XrmValuePtr toVal; +{ + if (XmuCompareISOLatin1(fromVal->addr,"NULL") == 0) { + toVal->addr = NULL; + toVal->size = 0; + } else { + XmuCvtStringToWidget(args,num_args,fromVal,toVal); + } +} diff --git a/vendor/x11iraf/xtapemon/types.h b/vendor/x11iraf/xtapemon/types.h new file mode 100644 index 00000000..106fd717 --- /dev/null +++ b/vendor/x11iraf/xtapemon/types.h @@ -0,0 +1,22 @@ +/* + * types.h : Definitions of SearchType and SortType and external defs + * of their resource converters and the improved Widget converter. + * + * George Ferguson, ferguson@cs.rochester.edu, 4 Sep 1991. + * + */ + +#ifndef CONVERT_H +#define CONVERT_H + +/* This puke is so the bloody converters work. Argh! */ +#define GfDefault '\000' +#define GfInvdate '\001' + +#define GfNDefault "default" +#define GfNInvdate "invdate" + +extern void initConverters(); +extern void cvtStringToWidget(); + +#endif /* CONVERT_H */ diff --git a/vendor/x11iraf/xtapemon/xtapemon.c b/vendor/x11iraf/xtapemon/xtapemon.c new file mode 100644 index 00000000..1cd7f35d --- /dev/null +++ b/vendor/x11iraf/xtapemon/xtapemon.c @@ -0,0 +1,736 @@ +#include <stdio.h> +#include <sys/errno.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> + +/* #ifndef AUX */ +#include <fcntl.h> +/* #endif */ + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Shell.h> +#include <X11/Xaw/Paned.h> +#include <X11/Xaw/Viewport.h> +#include <X11/Xaw/List.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Box.h> +#include <X11/Xaw/Label.h> +#include <X11/Xaw/AsciiText.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Cardinals.h> + +#include "appres.h" +#include "xtapemon.h" +#include "classnames.h" +#include "patchlevel.h" + +/* + * XTAPEMON -- X window system based tape monitoring utility. + * + * Monitors the raw ascii status output of the iraf tape driver and + * maintains a graphical display of the tape status in a window. + * + */ + +/* Local definitions. + */ +#define MAXCONN 0 +#define MAXPORTS 2 +#define ERR (-1) +#define EOS '\0' +#define SZ_FNAME 256 +#define SZ_LINE 512 +#define SZ_MSGBUF 2048 + +extern errno; + +/* Functions defined in this file. + */ +int main(); +void doPendingEvents(); +void initWidgetsFromString(); +void setText(), setLabel(); +void status0(), status1(), status2(); +void fail0(), fail1(); + +static int portSetup(), portOpen(); +static void initGraphics(), initWidgets(); +static void selectItem(), portClose(); +static void syntax(), appendText(); +static void Quit(); +static XtInputCallbackProc connectToClient(), readClientData(); + +/* Global graphics data. + */ +Display *display; +Screen *screen; +Window root; +int server_socket; +int server_port; + +/* Global widget data. + */ +XtAppContext appContext; +Widget toplevel; + +static Widget statusText, messages, quitButton, recordLabel; +static Widget devtypeText, tapetypeText, tapesizeText, tapeusedText; +static Widget acmodeText, densityText, blksizeText, fileText, recordText; +static Widget recsizeText, nfilesText; + +/* Other global data. + */ +char *progname; +AppResources appResources; + +/* Non-widget resources obtained from resource manager. + */ +static XtResource resources[] = { + { "widgets", "Widgets", XtRString, sizeof(String), + XtOffset(AppResources *,widgets), XtRImmediate, "" }, + { "port", "Port", XtRInt, sizeof(int), + XtOffset(AppResources *,port), XtRImmediate, (XtPointer)5138 }, + { "alternate", "Alternate", XtRInt, sizeof(int), + XtOffset(AppResources *,alternate), XtRImmediate, (XtPointer)0 }, + { "debug", "Debug", XtRInt, sizeof(int), + XtOffset(AppResources *,debug), XtRImmediate, (XtPointer)0 }, +}; + +/* Non-widget resources set on command line. + */ +static XrmOptionDescRec options[] = { + { "-port", ".port", XrmoptionSepArg, (XtPointer)"5138" }, + { "-a", ".alternate", XrmoptionNoArg, (XtPointer)"1" }, + { "-d", ".debug", XrmoptionNoArg, (XtPointer)"1" }, +}; + +/* Widget and non-widget resources if the application defaults file can't + * be found. Generated automatically from XTapemon.ad by "ad2c". + */ +static String fallbackResources[] = { +#include "XTapemon.ad.h" + NULL +}; + +/* Compatibility hacks. */ +#ifdef AUX +void *memmove(a,b,n) void *a; const void *b; size_t n; { bcopy(b,a,n); } +#else +#if defined(sun) && !defined(SYSV) +void *memmove(a,b,n) void *a, *b; int n; { bcopy(b,a,n); } +#endif +#endif + +/* + * The main program. + */ +main(argc,argv) +int argc; +char **argv; +{ + char buf[80]; + int port; + + progname = argv[0]; + initGraphics(&argc,argv); + if (argc > 1) { + syntax(argc,argv); + XtDestroyApplicationContext(appContext); + exit(1); + } + initWidgets(); + XtRealizeWidget(toplevel); + /* Set window title to indicate version */ + sprintf (buf, "xtapemon %d.%d - IRAF Tape Monitor Utility", + xtapemonMajorVersion, xtapemonMinorVersion); + XStoreName(display,XtWindow(toplevel),buf); + sprintf(buf, "Welcome to xtapemon %d.%d", + xtapemonMajorVersion, xtapemonMinorVersion); + status0(buf); + + /* Prepare to receive a connection, set up Xt callback to accept a + * client connection when one arrives. + */ + port = appResources.port + appResources.alternate; + if ((server_socket = portSetup(port)) >= 0) + XtAppAddInput (appContext, server_socket, (XtPointer)XtInputReadMask, + (XtInputCallbackProc)connectToClient, (XtPointer)server_socket); + + /* Identify port in use. */ + sprintf (buf, "ready on port %s (%d)", + (server_port == appResources.port) ? "A" : "B", server_port); + setText (messages, buf); + + /* do it */ + XtAppMainLoop(appContext); + /*NOTREACHED*/ +} + + +void +doPendingEvents() +{ + while (XtAppPending(appContext)) + XtAppProcessEvent(appContext,XtIMAll); +} + +static void +initGraphics(argcp,argv) +int *argcp; +char **argv; +{ + toplevel = XtAppInitialize(&appContext, "XTapemon", + options, XtNumber(options), + argcp,argv,fallbackResources,NULL,ZERO); + initConverters(appContext); + /* XawSimpleMenuAddGlobalActions(appContext); */ + /* XtAppAddActions(appContext,actionTable,XtNumber(actionTable)); */ + XtGetApplicationResources(toplevel,(XtPointer)&appResources, + resources,XtNumber(resources),NULL,ZERO); + display = XtDisplay(toplevel); + screen = XtScreen(toplevel); + root = RootWindowOfScreen(screen); +} + + +/* initWidgets -- Initialize the widgets given in the .widgets resource, + * check for required widgets, and set globals vars. + */ +static void +initWidgets() +{ + initWidgetsFromString(appResources.widgets,".widgets"); + + /* set globals for optional widgets */ + statusText = XtNameToWidget (toplevel, "*statusText"); + messages = XtNameToWidget (toplevel, "*messages"); + quitButton = XtNameToWidget (toplevel, "*quitButton"); + devtypeText = XtNameToWidget (toplevel, "*devtypeText"); + tapetypeText = XtNameToWidget (toplevel, "*tapetypeText"); + tapesizeText = XtNameToWidget (toplevel, "*tapesizeText"); + tapeusedText = XtNameToWidget (toplevel, "*tapeusedText"); + acmodeText = XtNameToWidget (toplevel, "*acmodeText"); + densityText = XtNameToWidget (toplevel, "*densityText"); + blksizeText = XtNameToWidget (toplevel, "*blksizeText"); + fileText = XtNameToWidget (toplevel, "*fileText"); + recordText = XtNameToWidget (toplevel, "*recordText"); + recordLabel = XtNameToWidget (toplevel, "*recordLabel"); + recsizeText = XtNameToWidget (toplevel, "*recsizeText"); + nfilesText = XtNameToWidget (toplevel, "*nfilesText"); + + /* Set up Quit button callback. */ + XtAddCallback (quitButton, XtNcallback, Quit, (XtPointer)NULL); +} + +static void +Quit(w, call_data, client_data) +Widget w; +XtPointer call_data, client_data; +{ + XtDestroyApplicationContext(XtWidgetToApplicationContext(w)); + exit(0); +} + +#define ISSPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n') +#define NUL '\0' + +/* initWidgetsFromString -- Create the widgets specified in resourceStr as + * "parent class name" triples. The resourceName is used for error messages. + */ +void +initWidgetsFromString(resourceStr,resourceName) +char *resourceStr,*resourceName; +{ + char name[32],class[32],parent[256]; + char *s,*t; + Boolean isShell; + WidgetClass wc; + Widget pw; + + if ((s=resourceStr) == NULL) + fail1("no widgets specified in %s resource!",resourceName); + while (*s) { + /* skip leading whitespace */ + while (ISSPACE(*s)) + s += 1; + if (!*s) + break; + /* Gather the parent widget name */ + t = parent; + while (*s && !ISSPACE(*s)) + *t++ = *s++; + *t = NUL; + /* skip whitespace */ + while (ISSPACE(*s)) + s += 1; + if (!*s) + fail1("missing widget class and name in %s resource",resourceName); + /* Gather the class name */ + t = class; + while (*s && !ISSPACE(*s)) + *t++ = *s++; + *t = NUL; + /* skip whitespace */ + while (ISSPACE(*s)) + s += 1; + if (!*s) + fail1("missing widget name in %s resource",resourceName); + /* Gather the widget's name */ + t = name; + while (*s && !ISSPACE(*s)) + *t++ = *s++; + *t = NUL; + /* convert class name to WidgetClass */ + if ((wc=classNameToWidgetClass(class,&isShell)) == NULL) + fail1("can't convert string \"%s\" to widgetClass",class); + /* convert parent name to Widget */ + if (strcmp(parent,"toplevel") == 0) + pw = toplevel; + else if ((pw=XtNameToWidget(toplevel,parent)) == NULL) + fail1("can't convert string \"%s\" to widget",parent); + /* finally create the widget */ + if (isShell) + (void)XtCreatePopupShell(name,wc,pw,NULL,ZERO); + else + (void)XtCreateManagedWidget(name,wc,pw,NULL,ZERO); + } +} + + +/* + * Client actions. + * -------------------------- + */ + +/* connectToClient -- Called when a client has attempted a connection on + * the xtapemon socket. Accept the connection and open a file pointer on + * the status output stream of the client. + */ +static XtInputCallbackProc +connectToClient (client_data, source, id) +XtPointer client_data; +int *source; +XtInputId *id; +{ + int fd; + + setText (statusText, "connecting to client..."); + if ((fd = portOpen ((int)*source)) < 0) + setText (statusText, "connection failed"); + else { + setText (statusText, "connection established"); + if (fcntl (fd, F_SETFD, O_RDWR|O_NDELAY) < 0) { + char buf[80]; + sprintf (buf, "fcntl failed, errno=%d", errno); + setText (statusText, buf); + portClose (fd); + } else { + /* Enable the following to prohibit multiple clients. + * XtRemoveInput (*id); + */ + XtAppAddInput (appContext, fd, (XtPointer)XtInputReadMask, + (XtInputCallbackProc)readClientData, (XtPointer)NULL); + } + } + + doPendingEvents(); +} + + +/* readClientData -- Called when there is client data to be read and + * displayed. + */ +static XtInputCallbackProc +readClientData (client_data, source, id) +XtPointer client_data; +int *source; +XtInputId *id; +{ + register int fd = *source; + register char *ip, *op; + static char msg[SZ_MSGBUF]; + static int nleft, tapesize, blksize; + char word[SZ_LINE], value[SZ_LINE]; + char obuf[SZ_LINE], iodev[SZ_FNAME]; + int nchars, newline, maxch, ival; + char *start; + + start = msg + nleft; + maxch = SZ_MSGBUF - nleft; + nleft = 0; + + /* Read a block of text from the input socket and process each line to + * the monitor window. Messages may be batched for efficiency, i.e., + * the text block may contain several lines. Since socket i/o is stream + * based we can't assume that lines are not broken over read transfer + * boundaries, so it is necessary to save any partial line at the end of + * a read and join the line when the next data block is read. + */ + nchars = read (fd, start, maxch); + if (nchars >= 0) { + if (appResources.debug) + write (2, start, nchars); + *(start + nchars) = EOS; + } + ip = msg; + + while (*ip) { + start = ip; + newline = 0; + + /* Get first whitespace delimited word. */ + for (op=word; *ip && !isspace(*ip); ) + *op++ = *ip++; + *op = EOS; + while (*ip && *ip == ' ') + ip++; + + /* Anything other than "keyword = value" is a message and is sent + * to the message window. Messages are newline delimited. The + * newline is required to delimit records. To include a newline + * in a message one must pass an explicit \n, e.g, "foo\\n\n". + */ + if (*ip == '=') { + for (ip++, op=value; *ip; ) { + if (*ip == '\n') { + ip++; + newline++; + break; + } else + *op++ = *ip++; + } + *op = EOS; + } else { + for (ip=start, op=value; *ip; ) { + if (*ip == '\n') { + ip++; + newline++; + break; + } else if (*ip == '\\' && *(ip+1) == 'n') { + *op++ = '\n'; + ip += 2; + } else + *op++ = *ip++; + } + *op = EOS; + if (newline) { + appendText (value); + continue; + } + } + + /* Save any partial line for next time. */ + if (!newline) { + strcpy (msg, start); + nleft = strlen (msg); + break; + } + + /* Set the value of a keyword. */ + if (word[0] == EOS) { + continue; + } else if (strcmp (word, "iodev") == 0) { + strcpy (iodev, value+1); + } else if (strcmp (word, "host") == 0) { + sprintf (obuf, "connected to %s,%s on port %s (%d)", + value+1, iodev, + (server_port == appResources.port) ? "A" : "B", server_port); + setText (statusText, obuf); + + } else if (strcmp (word, "devtype") == 0) { + setText (devtypeText, value); + } else if (strcmp (word, "tapetype") == 0) { + setText (tapetypeText, value); + + } else if (strcmp (word, "tapesize") == 0) { + ival = atoi (value); + sprintf (obuf, " %d.%02d Mb", ival / 1000, ((ival%1000) + 5) / 10); + setText (tapesizeText, obuf); + tapesize = ival; + + } else if (strcmp (word, "tapeused") == 0) { + ival = atoi (value); + sprintf (obuf, " %d.%02d Mb (%02d%%)", + ival / 1000, ((ival % 1000) + 5) / 10, + (ival / tapesize) * 100); + setText (tapeusedText, obuf); + + } else if (strcmp (word, "blksize") == 0) { + ival = atoi (value); + if (ival != blksize) { + setLabel (recordLabel, ival ? " Block:" : "Record:"); + blksize = ival; + } + setText (blksizeText, !strcmp(value," 0") ? " variable" : value); + + } else if (strcmp (word, "acmode") == 0) { + setText (acmodeText, value); + } else if (strcmp (word, "density") == 0) { + setText (densityText, value); + } else if (strcmp (word, "file") == 0) { + setText (fileText, value); + } else if (strcmp (word, "nfiles") == 0) { + setText (nfilesText, !strcmp(value," 0") ? " unknown" : value); + } else if (strcmp (word, "record") == 0) { + setText (recordText, value); + } else if (strcmp (word, "recsize") == 0) { + setText (recsizeText, value); + } else { + sprintf (obuf, "%s = %s", word, value); + appendText (obuf); + } + } + + /* Close connection, and ready to receive further connection. */ + if (nchars <= 0) { + close (fd); + XtRemoveInput (*id); + setText (statusText, "connection closed"); + + /* Enable the following if XtRemoveInput is used in XtInputCallback + * XtAppAddInput (appContext, server_socket, XtInputReadMask, + * (XtInputCallbackProc)connectToClient, (XtPointer)server_socket); + */ + } + +done: + + XFlush (display); + doPendingEvents(); +} + + +/* appendText -- Append some text to the message buffer. + */ +static void +appendText (text) +char *text; +{ + register char *ip, *op; + static XawTextPosition pos = 0; + static int newline = 0; + XawTextBlock tx; + char buf[1024]; + + if (pos == 0) + setText (messages, ""); + + op = buf; + if (newline) + *op++ = '\n'; + + for (ip=text; *ip; ) + *op++ = *ip++; + + if (newline = (*(ip-1) == '\n')) + op--; + + *op = EOS; + + tx.ptr = buf; + tx.length = op - buf; + tx.format = FMT8BIT; + tx.firstPos = 0; + + XawTextReplace (messages, pos, pos, &tx); + XawTextSetInsertionPoint (messages, (pos += (op - buf))); +} + + +/* + * Socket i/o code. + * -------------------------- + */ + + +/* portSetup -- Set up the tape status port, used by remote tape driver client + * to send messages to xtapemon. + */ +static int +portSetup (first_port) +int first_port; +{ + struct sockaddr_in sockaddr; + int bound, reuse=1; + int s, port, i; + + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) { + status1 ("socket creation fails, errno=%d", errno); + return (ERR); + } + + /* Try to bind an address to the socket. If the first try doesn't + * succeed it may be because a server is already bound to the port, + * so try a higher numbered port. + */ + for (bound=i=0; i < MAXPORTS; i++) { + port = first_port + i; + memset ((char *)&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons((short)port); + sockaddr.sin_addr.s_addr = INADDR_ANY; + + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, + sizeof(reuse)) < 0) { + close (s); + return (ERR); + } + + if (bind (s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) >= 0) { + server_port = port; + bound++; + break; + } + } + + if (!bound) { + status1 ("bind on socket fails, errno=%d", errno); + close (s); + return (ERR); + } + + if (listen (s, MAXCONN) < 0) { + status1 ("listen on socket fails, errno=%d", errno); + close (s); + return (ERR); + } + + return (s); +} + + +/* portOpen -- Called when processing is needed on a socket, either when + * a client is requesting a connection or when data is ready on a connected + * socket. + */ +static int +portOpen (s) +int s; +{ + int fd; + if ((fd = accept (s, (struct sockaddr *)0, (int *)0)) < 0) + return (ERR); + else + return (fd); +} + + +/* portClose -- Close a file descriptor opened on an active server socket. + */ +static void +portClose (fd) +int fd; +{ + close (fd); +} + + +/* + * Utility routines. + * -------------------------- + */ + +/* setText -- Set the given Text item's value to the given string. + */ +void +setText(item,text) +Widget item; +char *text; +{ + Arg args[1]; + + if (item != NULL) { + XtSetArg(args[0],XtNstring,text); + XtSetValues(item,args,ONE); + } +} + + +/* setLabel -- Set the given Label item's value to the given string. + */ +void +setLabel(item,text) +Widget item; +char *text; +{ + Arg args[1]; + + if (item != NULL) { + XtSetArg(args[0],XtNlabel,text); + XtSetValues(item,args,ONE); + } +} + +void +status0(str) +char *str; +{ + if (statusText != NULL) + setText(statusText,str); + doPendingEvents(); +} + +void +status1(fmt,arg) +char *fmt,*arg; +{ + char buf[256]; + + sprintf(buf,fmt,arg); + status0(buf); +} + +void +status2(fmt,arg1,arg2) +char *fmt,*arg1,*arg2; +{ + char buf[256]; + + sprintf(buf,fmt,arg1,arg2); + status0(buf); +} + +void +fail0(str) +char *str; +{ + fprintf(stderr,"%s: %s\n",progname,str); + XtDestroyApplicationContext(appContext); + exit(1); +} + +void +fail1(fmt,arg) +char *fmt,*arg; +{ + char buf[256]; + + sprintf(buf,fmt,arg); + fail0(buf); +} + +/* syntax -- Print whatever caused the error and the usage message. + */ +static void +syntax(argc,argv) +int argc; +char **argv; +{ + char *program; + + program = *argv; + argv += 1; + if (argc > 2 || (strcmp(*argv,"-help") != 0 && strcmp(*argv,"-?") != 0)) { + fprintf(stderr,"%s: bad argument(s): ",program); + while (--argc) + fprintf(stderr,"%s ",*argv++); + fprintf(stderr,"\n"); + } + fprintf(stderr,"Valid options (in addition to X Toolkit options) are:\n"); + fprintf(stderr," -port N\tlisten on port number N\n"); + fprintf(stderr," -a\tlisten on alternate port\n"); + fprintf(stderr," -d\tpass client messages to standard out\n"); + fprintf(stderr,"Options can be abbreviated to their shortest unique prefix.\n"); +} diff --git a/vendor/x11iraf/xtapemon/xtapemon.h b/vendor/x11iraf/xtapemon/xtapemon.h new file mode 100644 index 00000000..4fdafc13 --- /dev/null +++ b/vendor/x11iraf/xtapemon/xtapemon.h @@ -0,0 +1,29 @@ +/* + * xarchie.h : Definitions of the X globals and misc. functions + * + * George Ferguson, ferguson@cs.rochester.edu, 4 Sep 1991. + * + */ + +#ifndef XARCHIE_H +#define XARCHIE_H + +extern Display *display; +extern Screen *screen; +extern Window root; + +extern XtAppContext appContext; +extern Widget toplevel; +extern Widget hostList,locationList,fileList; +extern Widget searchText; + +extern void doPendingEvents(); +extern void initWidgetsFromString(); +extern void displayHostInfo(), clearHostInfo(); +extern void displayLocationInfo(), clearLocationInfo(); +extern void displayFileInfo(), clearFileInfo(); +extern void setText(), setLabel(); +extern void status0(), status1(), status2(); +extern void fail0(), fail1(); + +#endif /* XARCHIE_H */ diff --git a/vendor/x11iraf/xtapemon/xtapemon.man b/vendor/x11iraf/xtapemon/xtapemon.man new file mode 100644 index 00000000..359c7bd3 --- /dev/null +++ b/vendor/x11iraf/xtapemon/xtapemon.man @@ -0,0 +1,135 @@ +.\" @(#)xtapemon.1 1.1 11-Dec-96 MJF +.TH XTAPEMON 1 "11 Dec 1996" "X11IRAF Project" +.SH NAME +XTapemon \- magtape I/O status monitor and display utility for IRAF +.SH SYNOPSIS +\fBxtapemon\fP +[\-\fItoolkitoption\fP ...] [ \fI-port\fP <port> ] [ \fI\-a\fP ] [ \fI-d\fP ] +.SH OPTIONS +In addition to the X Toolkit options, the following are supported: +.TP 5 +.B "-port \fIport\fP" +Set the primary port to listen on for client connections. The default +is 5138. +.TP 5 +.B "-a" +Listen on alternate port, this is the primary port number plus one. +The default is 5139. +.TP 5 +.B "-d" +Debug mode, pass client message to the standard out. The default is false. + +.SH "X RESOURCES" +\fBXTapemon\fP options can appear on the command line or in your X +resource file. Options on the command line supercede values +specified in your X resource file. + +.TP 12 +.B "port" +Set the primary port to listen on for client connections. The default +is 5138. +.TP 12 +.B "alternate" +Listen on alternate port, this is the primary port number plus one. +The default is 5139. +.TP 12 +.B "debug" +Debug mode, pass client message to the standard out. The default is false. +.SH DESCRIPTION +.LP +Xtapemon is a magtape status monitor and display utility. You use it to +display the status of a IRAF tape job while it is running. TCP/IP sockets +are used for communication, so the IRAF tape job and xtapemon may be on +the same host machine or on different hosts. All V2.10 versions of IRAF +support tape status output (including even VMS/IRAF). For example, suppose +our workstation is named \fIcygnus\fP and we are running IRAF on host +\fIregulus\fP, using magtape device mta. The first step is to +start xtapemon on cygnus: + + % xtapemon & + +Then in IRAF on regulus we might do the following: + + cl> set tapecap = ":so=cygnus" + cl> allocate mta + cl> rewind mta + +At this point the IRAF magtape i/o driver executing on regulus should open +a connection to the xtapemon tape monitoring server running on cygnus, and +indicate that a rewind operation is taking place. + +If both xtapemon and the IRAF tape job are running on the same host then +the hostname can be omitted, e.g. "set tapecap = :so". The use of +"set tapecap" assumes that the default IRAF tapecap is being used. If +the user has a private tapecap, the syntax is + + cl> set tapecap = "<my-tapecap-file>:so=hostname" + +In general you can append any number of tapecap device capability overrides +(the :xx fields) to the tapecap environment specification. Alternatively, +the :so can be specified on the command line, e.g. + + cl> rewind "mta[:so=cygnus]" + +But in general it will be more convenient to use set tapecap. + +It is safe to have :so (status output) enabled even if there is no xtapemon +server; IRAF will try to make the connection but will proceed without any +indication of an error if the status output connection cannot be established. + + +The amount of tape read or written in Mb will be accurate only if the IRAF +magtape driver actually reads or writes all the data between the beginning +of tape and the current position of the tape. Hence, if one rewinds the +tape and then reads or writes a number of tiles, the Mb used field will be +accurate. If however one does a skip to a random file somewhere far down on +the tape, IRAF will not have read the data and the tape used field will +indicate only the data actually read or written. For example, a rewind +followed by a \fImtexamine\fP will reliably indicate the actual amount of data +on the tape, leaving the tape positioned to EOT. If one then appends new files +to the tape the tape used field will still be accurate. If however one pops +in a new tape and then appends a file at EOT, tape used will be invalid as +the drive will rapidly skip forward to the EOT. + +.SH "ADVANCED USAGE" + +By default xtapemon listens on the port 5138, called port A. If when you +start the xtapemon server this port is already busy, xtapemon will +automatically switch to port B instead (the alternate port, 5139). This +makes it possible to monitor two tape jobs at the same time. + +If you have xtapemon servers running on two ports it will be necessary to +tell the second IRAF tape job what port to use, since the magtape driver +will use port A by default. For example, + + cl> set tapecap = ":so=cygnus,5139" +or + cl> mtexamine "mta[:so=,5139]" + +If there is some problem using the builtin port defaults you can use any +port you want. The following resources tell which port to use. + + XTapemon.port # port A + XTapemon.alternate # port B + +Or you can specify the ports with the argument "-port" or "-a" (alternate) +on the command line when xtapemon is started. +.SH BUGS +You can't necessarily trust displayed information such as the device type and +tape type. On most platforms this information is taken from the tapecap +entry for the device, and the accuracy of this information will depend upon +the diligence of your IRAF system adminstrator when they configured tapecap +for your site (and on whether you use the correct logical device name for +the drive and tape capacity you are using). + +Xtapemon tries to keep track of the amount of tape used: the number of Mb +(megabytes) read or written is displayed, along with the percent of the tape +used. Whether or not the percent used field is accurate depends upon a +number of factors. First the tape capacity given in the tapecap file must +match the actual tape being used. Second, if data compression is in use on +the drive, xtapemon will display the uncompressed quantity of data written. +On a compression drive percent used can be greater than 100%! +.SH SEE ALSO +xgterm(1), ximtool(1) +.SH COPYRIGHT +Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. diff --git a/vendor/x11iraf/xtapemon/xtapemon.ps b/vendor/x11iraf/xtapemon/xtapemon.ps new file mode 100644 index 00000000..bab4ba17 --- /dev/null +++ b/vendor/x11iraf/xtapemon/xtapemon.ps @@ -0,0 +1,361 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.09 +%%CreationDate: Sat Apr 5 14:54:31 1997 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.09 0 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.09 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(XT)72 48 Q 332.94(APEMON\(1\) XT)-.93 F +(APEMON\(1\))-.93 E/F1 9/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0(XT) +108 96 Q +(apemon \255 magtape I/O status monitor and display utility for IRAF)-.8 +E F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(xtapemon)108 124.8 Q F0 +<5bad>2.5 E/F3 10/Times-Italic@0 SF(toolkitoption)A F0(...] [)2.5 E F3 +(-port)2.5 E F0(<port> ] [)2.5 E F3<ad61>2.5 E F0 2.5(][)2.5 G F3(-d)A +F0(])2.5 E F1(OPTIONS)72 141.6 Q F0(In addition to the X T)108 153.6 Q +(oolkit options, the follo)-.8 E(wing are supported:)-.25 E F2(-port)108 +170.4 Q F3(port)2.5 E F0 +(Set the primary port to listen on for client connections.)133 182.4 Q +(The def)5 E(ault is 5138.)-.1 E F2(-a)108 199.2 Q F0 +(Listen on alternate port, this is the primary port number plus one.) +16.67 E(The def)5 E(ault is 5139.)-.1 E F2(-d)108 216 Q F0(Deb)16.11 E +(ug mode, pass client message to the standard out.)-.2 E(The def)5 E +(ault is f)-.1 E(alse.)-.1 E F1 2.25(XR)72 244.8 S(ESOURCES)-2.25 E F2 +(XT)108 256.8 Q(apemon)-.92 E F0 .551 +(options can appear on the command line or in your X resource \214le.) +3.051 F .55(Options on the command)5.55 F(line supercede v)108 268.8 Q +(alues speci\214ed in your X resource \214le.)-.25 E F2(port)108 297.6 Q +F0(Set the primary port to listen on for client connections.)41.67 E +(The def)5 E(ault is 5138.)-.1 E F2(alter)108 314.4 Q(nate)-.15 E F0 +(Listen on alternate port, this is the primary port number plus one.) +21.83 E(The def)5 E(ault is 5139.)-.1 E F2(deb)108 331.2 Q(ug)-.2 E F0 +(Deb)34.08 E(ug mode, pass client message to the standard out.)-.2 E +(The def)5 E(ault is f)-.1 E(alse.)-.1 E F1(DESCRIPTION)72 348 Q F0 .68 +(Xtapemon is a magtape status monitor and display utility)108 360 R 5.68 +(.Y)-.65 G .681(ou use it to display the status of a IRAF tape)-6.78 F +.746(job while it is running.)108 372 R .746(TCP/IP sock)5.746 F .746 +(ets are used for communication, so the IRAF tape job and xtapemon)-.1 F +.984(may be on the same host machine or on dif)108 384 R .984 +(ferent hosts.)-.25 F .985(All V2.10 v)5.985 F .985 +(ersions of IRAF support tape status)-.15 F 1.018(output \(including e) +108 396 R -.15(ve)-.25 G 3.517(nV).15 G 3.517(MS/IRAF\). F)-3.517 F +1.017(or e)-.15 F 1.017(xample, suppose our w)-.15 F 1.017 +(orkstation is named)-.1 F F3(cygnus)3.517 E F0 1.017(and we are)3.517 F +(running IRAF on host)108 408 Q F3 -.37(re)2.5 G(gulus)-.03 E F0 2.5(,u) +C(sing magtape de)-2.5 E(vice mta.)-.25 E +(The \214rst step is to start xtapemon on c)5 E(ygnus:)-.15 E 2.5(%x)128 +432 S(tapemon &)-2.5 E(Then in IRAF on re)108 456 Q +(gulus we might do the follo)-.15 E(wing:)-.25 E +(cl> set tapecap = ":so=c)128 480 Q(ygnus")-.15 E(cl> allocate mta)128 +492 Q(cl> re)128 504 Q(wind mta)-.25 E .578 +(At this point the IRAF magtape i/o dri)108 528 R -.15(ve)-.25 G 3.078 +(re).15 G -.15(xe)-3.228 G .578(cuting on re).15 F .579 +(gulus should open a connection to the xtapemon)-.15 F +(tape monitoring serv)108 540 Q(er running on c)-.15 E +(ygnus, and indicate that a re)-.15 E(wind operation is taking place.) +-.25 E .781(If both xtapemon and the IRAF tape job are running on the s\ +ame host then the hostname can be omitted,)108 564 R .552 +(e.g. "set tapecap = :so".)108 576 R .553 +(The use of "set tapecap" assumes that the def)5.552 F .553 +(ault IRAF tapecap is being used.)-.1 F(If)5.553 E(the user has a pri) +108 588 Q -.25(va)-.25 G(te tapecap, the syntax is).25 E +(cl> set tapecap = "<my-tapecap-\214le>:so=hostname")128 612 Q .247 +(In general you can append an)108 636 R 2.747(yn)-.15 G .247 +(umber of tapecap de)-2.747 F .247(vice capability o)-.25 F -.15(ve)-.15 +G .247(rrides \(the :xx \214elds\) to the tapecap).15 F(en)108 648 Q +(vironment speci\214cation.)-.4 E(Alternati)5 E -.15(ve)-.25 G(ly).15 E +2.5(,t)-.65 G(he :so can be speci\214ed on the command line, e.g.)-2.5 E +(cl> re)128 672 Q(wind "mta[:so=c)-.25 E(ygnus]")-.15 E +(But in general it will be more con)108 696 Q -.15(ve)-.4 G +(nient to use set tapecap.).15 E .251(It is safe to ha)108 720 R .551 +-.15(ve :)-.2 H .251(so \(status output\) enabled e).15 F -.15(ve)-.25 G +2.751(ni).15 G 2.751(ft)-2.751 G .252(here is no xtapemon serv)-2.751 F +2.752(er; IRAF)-.15 F .252(will try to mak)2.752 F 2.752(et)-.1 G(he) +-2.752 E(X11IRAF Project)72 768 Q(11 Dec 1996)137.62 E(1)203.45 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(XT)72 48 Q 332.94(APEMON\(1\) XT)-.93 F +(APEMON\(1\))-.93 E 1.227(connection b)108 84 R 1.227 +(ut will proceed without an)-.2 F 3.727(yi)-.15 G 1.227 +(ndication of an error if the status output connection cannot be)-3.727 +F(established.)108 96 Q .013(The amount of tape read or written in Mb w\ +ill be accurate only if the IRAF magtape dri)108 132 R -.15(ve)-.25 G +2.514(ra).15 G .014(ctually reads or)-2.514 F .073 +(writes all the data between the be)108 144 R .073 +(ginning of tape and the current position of the tape.)-.15 F .072 +(Hence, if one re)5.072 F(winds)-.25 E .184(the tape and then reads or \ +writes a number of tiles, the Mb used \214eld will be accurate.)108 156 +R .184(If ho)5.184 F(we)-.25 E -.15(ve)-.25 G 2.684(ro).15 G .184 +(ne does)-2.684 F 2.651(as)108 168 S .151(kip to a random \214le some) +-2.651 F .151(where f)-.25 F .151(ar do)-.1 F .15 +(wn on the tape, IRAF will not ha)-.25 F .45 -.15(ve r)-.2 H .15 +(ead the data and the tape used).15 F .736 +(\214eld will indicate only the data actually read or written.)108 180 R +-.15(Fo)5.737 G 3.237(re).15 G .737(xample, a re)-3.387 F .737 +(wind follo)-.25 F .737(wed by a)-.25 F/F1 10/Times-Italic@0 SF(mte) +3.237 E(xamine)-.2 E F0 .267 +(will reliably indicate the actual amount of data on the tape, lea)108 +192 R .267(ving the tape positioned to EO)-.2 F 4.246 -.74(T. I)-.4 H +2.766(fo).74 G .266(ne then)-2.766 F .696(appends ne)108 204 R 3.196 +<778c>-.25 G .696 +(les to the tape the tape used \214eld will still be accurate.)-3.196 F +.696(If ho)5.696 F(we)-.25 E -.15(ve)-.25 G 3.196(ro).15 G .697 +(ne pops in a ne)-3.196 F 3.197(wt)-.25 G(ape)-3.197 E +(and then appends a \214le at EO)108 216 Q 1.48 -.74(T, t)-.4 H +(ape used will be in).74 E -.25(va)-.4 G(lid as the dri).25 E .3 -.15 +(ve w)-.25 H(ill rapidly skip forw).15 E(ard to the EO)-.1 E -.74(T.)-.4 +G/F2 9/Times-Bold@0 SF(AD)72 244.8 Q -1.215(VA)-.36 G(NCED USA)1.215 E +(GE)-.495 E F0 .005(By def)108 256.8 R .004 +(ault xtapemon listens on the port 5138, called port A.)-.1 F .004 +(If when you start the xtapemon serv)5.004 F .004(er this port)-.15 F +.048(is already b)108 268.8 R(usy)-.2 E 2.548(,x)-.65 G .048(tapemon wi\ +ll automatically switch to port B instead \(the alternate port, 5139\).) +-2.548 F .049(This mak)5.049 F(es)-.1 E(it possible to monitor tw)108 +280.8 Q 2.5(ot)-.1 G(ape jobs at the same time.)-2.5 E .974(If you ha) +108 304.8 R 1.274 -.15(ve x)-.2 H .973(tapemon serv).15 F .973 +(ers running on tw)-.15 F 3.473(op)-.1 G .973 +(orts it will be necessary to tell the second IRAF tape job)-3.473 F +(what port to use, since the magtape dri)108 316.8 Q -.15(ve)-.25 G 2.5 +(rw).15 G(ill use port A by def)-2.5 E 2.5(ault. F)-.1 F(or e)-.15 E +(xample,)-.15 E(cl> set tapecap = ":so=c)128 340.8 Q(ygnus,5139" or)-.15 +E(cl> mte)128 352.8 Q(xamine "mta[:so=,5139]")-.15 E 1.423 +(If there is some problem using the b)108 376.8 R 1.423(uiltin port def) +-.2 F 1.423(aults you can use an)-.1 F 3.924(yp)-.15 G 1.424(ort you w) +-3.924 F 3.924(ant. The)-.1 F(follo)3.924 E(wing)-.25 E +(resources tell which port to use.)108 388.8 Q(XT)128 412.8 Q 58.7 +(apemon.port #)-.8 F(port A)2.5 E(XT)128 424.8 Q 40.38 +(apemon.alternate #)-.8 F(port B)2.5 E .146 +(Or you can specify the ports with the ar)108 448.8 R .145 +(gument "-port" or "-a" \(alternate\) on the command line when xtape-) +-.18 F(mon is started.)108 460.8 Q F2 -.09(BU)72 477.6 S(GS).09 E F0 +-1.1(Yo)108 489.6 S 2.69(uc)1.1 G(an')-2.69 E 2.69(tn)-.18 G .19 +(ecessarily trust displayed information such as the de)-2.69 F .19 +(vice type and tape type.)-.25 F .19(On most platforms)5.19 F 1.002 +(this information is tak)108 501.6 R 1.001 +(en from the tapecap entry for the de)-.1 F 1.001(vice, and the accurac) +-.25 F 3.501(yo)-.15 G 3.501(ft)-3.501 G 1.001(his information will) +-3.501 F .87 +(depend upon the diligence of your IRAF system adminstrator when the)108 +513.6 R 3.37(yc)-.15 G .87(on\214gured tapecap for your site)-3.37 F +(\(and on whether you use the correct logical de)108 525.6 Q +(vice name for the dri)-.25 E .3 -.15(ve a)-.25 H +(nd tape capacity you are using\).).15 E .404(Xtapemon tries to k)108 +549.6 R .403 +(eep track of the amount of tape used: the number of Mb \(me)-.1 F -.05 +(ga)-.15 G .403(bytes\) read or written is).05 F 1.953 +(displayed, along with the percent of the tape used.)108 561.6 R 1.953 +(Whether or not the percent used \214eld is accurate)6.953 F .73 +(depends upon a number of f)108 573.6 R 3.23(actors. First)-.1 F .729 +(the tape capacity gi)3.23 F -.15(ve)-.25 G 3.229(ni).15 G 3.229(nt) +-3.229 G .729(he tapecap \214le must match the actual)-3.229 F 1.336 +(tape being used.)108 585.6 R 1.336 +(Second, if data compression is in use on the dri)6.336 F -.15(ve)-.25 G +3.837(,x).15 G 1.337(tapemon will display the uncom-)-3.837 F +(pressed quantity of data written.)108 597.6 Q(On a compression dri)5 E +.3 -.15(ve p)-.25 H(ercent used can be greater than 100%!).15 E F2 +(SEE ALSO)72 614.4 Q F0(xgterm\(1\), ximtool\(1\))108 626.4 Q F2 +(COPYRIGHT)72 643.2 Q F0(Cop)108 655.2 Q +(yright\(c\) 1986 Association of Uni)-.1 E -.15(ve)-.25 G +(rsities for Research in Astronomy Inc.).15 E(X11IRAF Project)72 768 Q +(11 Dec 1996)137.62 E(2)203.45 E EP +%%Trailer +end +%%EOF diff --git a/vendor/x11iraf/xtapemon/zzdebug.c b/vendor/x11iraf/xtapemon/zzdebug.c new file mode 100644 index 00000000..6a6c51cf --- /dev/null +++ b/vendor/x11iraf/xtapemon/zzdebug.c @@ -0,0 +1,62 @@ +#include <stdio.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> +#include <fcntl.h> + +#define PORT 5138 + +/* + * Dummy client to test xtapemon server. + */ + +main() +{ + struct sockaddr_in sockaddr; + struct hostent *hp; + unsigned short portaddr; + static char msg[] = "hello, world!\\n\n"; + int connected; + int port, s, i; + + if ((hp = gethostbyname ("lepus")) == NULL) + fprintf (stderr, "host lookup fails\n"); + if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0) + fprintf (stderr, "cannot open socket\n"); + fcntl (s, F_SETFD, O_RDWR|O_NDELAY); + + for (connected=i=0; i < 2; i++) { + port = PORT + i; + portaddr = htons((short)port); + memset ((char *)&sockaddr, 0, sizeof(sockaddr)); + memmove ((char *)&sockaddr.sin_addr, (char *)hp->h_addr, + hp->h_length); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = portaddr; + + if (connect (s,(struct sockaddr *)&sockaddr,sizeof(sockaddr))>=0) { + fprintf (stderr, "connected on port %d\n", port); + connected++; + break; + } + } + + if (!connected) + fprintf (stderr, "cannot connect socket\n"); + + write (s, msg, strlen(msg)); + sleep (5); + for (i=1; i <= 10; i++) { + sprintf (msg, "message %d\\n\nfile = %d\n", i, i); + write (s, msg, strlen(msg)); + sleep (3); + } + + for (i=1; i <= 500; i++) { + sprintf (msg, "record = %d\n", i); + write (s, msg, strlen(msg)); + } + + close (s); +} -- cgit